@datagrok/bio 2.13.8 → 2.14.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.
Files changed (32) hide show
  1. package/.eslintrc.json +10 -2
  2. package/CHANGELOG.md +15 -0
  3. package/dist/248.js.map +1 -1
  4. package/dist/package-test.js +6 -6
  5. package/dist/package-test.js.map +1 -1
  6. package/dist/package.js +3 -3
  7. package/dist/package.js.map +1 -1
  8. package/files/monomer-sets/monomer-set-PEPTIDE.json +93 -0
  9. package/files/monomer-sets/monomer-set-RNA.json +29 -0
  10. package/files/schemas/monomer-set-schema.json +48 -0
  11. package/package.json +5 -5
  12. package/src/analysis/sequence-similarity-viewer.ts +5 -2
  13. package/src/demo/bio01-similarity-diversity.ts +3 -2
  14. package/src/demo/bio01b-hierarchical-clustering-and-activity-cliffs.ts +1 -1
  15. package/src/package.ts +12 -7
  16. package/src/tests/activity-cliffs-tests.ts +2 -2
  17. package/src/tests/detectors-tests.ts +14 -7
  18. package/src/tests/monomer-libraries-tests.ts +6 -6
  19. package/src/tests/renderers-monomer-placer-tests.ts +2 -2
  20. package/src/tests/scoring.ts +2 -2
  21. package/src/tests/substructure-filters-tests.ts +2 -2
  22. package/src/tests/to-atomic-level-tests.ts +3 -3
  23. package/src/utils/helm-to-molfile/converter/converter.ts +1 -1
  24. package/src/utils/monomer-lib/lib-manager.ts +118 -21
  25. package/src/utils/monomer-lib/library-file-manager/event-manager.ts +25 -8
  26. package/src/utils/monomer-lib/library-file-manager/file-manager.ts +122 -35
  27. package/src/utils/monomer-lib/library-file-manager/ui.ts +1 -1
  28. package/src/utils/monomer-lib/monomer-lib.ts +23 -6
  29. package/src/utils/monomer-lib/monomer-set.ts +61 -0
  30. package/src/widgets/bio-substructure-filter-helm.ts +2 -2
  31. package/src/widgets/bio-substructure-filter.ts +19 -14
  32. package/webpack.config.js +3 -2
package/dist/package.js CHANGED
@@ -1,8 +1,8 @@
1
- var bio;(()=>{var e={8924:(e,t,n)=>{"use strict";n.d(t,{X:()=>r});var i=n(7362);class r extends i.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,r)),this.lesk}static get GrokGroups(){return void 0===this.grokGroups&&(this.grokGroups=this.makePalette([[["C","U"],"yellow"],[["G","P"],"red"],[["A","V","I","L","M","F","Y","W"],"all_green"],[["R","H","K"],"light_blue"],[["D","E"],"dark_blue"],[["S","T","N","Q"],"orange"]],!1,r)),this.grokGroups}static get RasMol(){return void 0===this.rasMol&&(this.rasMol=new r({D:"#E60A0A",E:"#E60A0A",C:"#E6E600",M:"#E6E600",K:"#145AFF",R:"#145AFF",S:"#FA9600",T:"#FA9600",F:"#3232AA",Y:"#3232AA",N:"#00DCDC",Q:"#00DCDC",G:"#EBEBEB",L:"#0F820F",V:"#0F820F",I:"#0F820F",A:"#C8C8C8",W:"#B45AB4",H:"#8282D2",P:"#DC9682",others:"#BEA06E"})),this.rasMol}get(e){const t=e in r.aaSynonyms?r.aaSynonyms[e]:e;return super.get(t)}}r.aaSynonyms={MeNle:"L",MeA:"A",MeG:"G",MeF:"F"};class s{static getPalette(e="grok"){switch(e){case"grok":return r.GrokGroups;case"lesk":return r.Lesk;default:throw new Error(`ChemPalette: scheme \`${e}\` does not exist`)}}static getInnerOuter(e){let t=0,n="",i="";for(const r of e)"("==r?t++:")"==r?t--:t?n+=r:i+=r;return isNaN(parseInt(n))?[i,n]:[i,""]}static getColorAAPivot(e="",t="grok"){const n=this.getPalette(t);let[i,r]=this.getInnerOuter(e);if(i=i.length>6?`${i.slice(0,3)}...`:i,r=r.length>6?`${r.slice(0,3)}...`:r,1==e.length||"("==e[1]){const t=e[0]?.toUpperCase();return t in n?[n.get(t),t,r,1]:[this.undefinedColor,i,r,1]}if("d"==e[0]&&e[1]in n&&(2==e.length||"("==e[2])){const t=e[1]?.toUpperCase();return t in n?[n.get(t),t,r,2]:[this.undefinedColor,i,r,2]}if(e.substring(0,3)in this.AAFullNames&&(3==e.length||"("==e[3])){const t=this.AAFullNames[e.substring(0,3)];return t in n?[n.get(t),t,r,3]:[this.undefinedColor,i,r,3]}if(e[0]?.toLowerCase()==e[0]&&e.substring(1,3)in this.AAFullNames&&(4==e.length||"("==e[4])){const t=this.AAFullNames[e.substring(1,3)];return t in n?[n.get(t),t,r,4]:[this.undefinedColor,i,r,4]}return[this.undefinedColor,i,r,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"}},9124:(e,t,n)=>{"use strict";n.d(t,{b:()=>s});var i=n(7389),r=n(6082);async function s(){const e="Helm",t=r.Func.find({package:e,name:"getHelmHelper"});if(0===t.length)throw new Error(`Package '${e}' must be installed for HelmHelper.`);return(await t[0].prepare().call()).getOutputParamValue()}i.input.helmAsync=async function(e,t){return(await s()).createHelmInput(e,t)}},4356:(e,t,n)=>{"use strict";n.d(t,{Eu:()=>l,so:()=>s,ub:()=>a});var i=n(4328);const r="Libraries",s="System:AppData/Bio/monomer-libraries/";let o=Promise.resolve();async function a(){let e;return o=o.then((async()=>{const t=await i.dapi.userDataStorage.getValue(r,"Settings",!0);e=t?JSON.parse(t):{exclude:[],explicit:[]},e.exclude=e.exclude instanceof Array?e.exclude:[],e.explicit=e.explicit instanceof Array?e.explicit:[],console.debug(`Bio: getUserLibSettings()\n${JSON.stringify(e,void 0,2)}`)})),await o,e}async function l(e){o=o.then((async()=>{console.debug(`Bio: setUserLibSettings()\n${JSON.stringify(e,void 0,2)}`),await i.dapi.userDataStorage.postValue(r,"Settings",JSON.stringify(e),!0)})),await o}},6718:(e,t,n)=>{"use strict";n.d(t,{A7:()=>p,pj:()=>u,uL:()=>h,uX:()=>c});var i=n(6082),r=n(4328),s=n(6295),o=n(3151),a=n(2738),l=(n(826),n(3077));function c(e){const t=[];for(let n=0;n<e.rowCount;n++){const i={};Object.keys(o.Ec).forEach((t=>{if("symbol"===t){const r=e.get(o.Ec[t],n);i[t]="."===r?e.get(o.yw,n):r}else if("rgroups"===t){const r=e.get(o.Ec[t],n).split("\n"),s=[];r.forEach((e=>{const t={},n=e.substring(e.lastIndexOf("]")+1),i=e.match(/\[R(\d+)\]/)[1];t.capGroupSmiles="H"===n?`[*:${i}][H]`:`O[*:${i}]`,t.alternateId="H"===n?`R${i}-H`:`R${i}-OH`,t.capGroupName="H"===n?"H":"OH",t.label=`R${i}`,s.push(t)})),i[t]=s}else o.Ec[t]&&(i[t]=e.get(o.Ec[t],n))})),i.author??(i.author=""),i.id??(i.id=0),i.smiles??(i.smiles=""),i.monomerType??(i.monomerType="Backbone"),i.createDate??(i.createDate=null),t.push(i)}return t}async function u(){const e=i.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 h(e,t){e instanceof i.Column&&(e=(0,l.R)(e).columns.toList());const n=(await u()).getBioLib(),s=new Array(e.length),o=e[0].length,c=new Float32Array(o);for(let l=0;l<e.length;++l){const u=l<t.length?t.getCanonical(l):a._S,h=n.getMonomer("PEPTIDE",u)?.smiles??"";h||r.shell.warning(`Reference monomer ${u} not found in monomer library`);const d=e[l],p=d.getRawData(),m=d.categories,f=m.indexOf("");if(s[l]={categories:m,data:p,emptyIndex:f},void 0===u)continue;const g=i.Column.fromStrings("smiles",m.map((e=>n.getMonomer("PEPTIDE",e)?.smiles??""))),y=(i.DataFrame.fromColumns([g]),await r.chem.getSimilarities(g,h)),b=y?y.getRawData():null;if(b)for(let e=0;e<o;++e){const t=p[e];u!==a._S&&t!==f?c[e]+=b[t]:u===a._S&&t===f&&(c[e]+=1)}}for(let n=0;n<c.length;++n){let r=c[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){r=i.FLOAT_NULL;break}}c[n]=r}return i.Column.fromFloat32Array("Similarity",c)}async function d(e){const t=(await u()).getBioLib(),n=[],s={},o=e.map((e=>t.getMonomer("PEPTIDE",e)?.smiles??"")),a=i.Column.fromStrings("smiles",o);for(let t=0;t<o.length;++t){s[e[t]]=t;const i=o[t],l=""===i?new Array(o.length).fill(0):(await r.chem.getSimilarities(a,i)).getRawData();l[t]=1,n[t]=Array.from(l)}return{scoringMatrix:n,alphabetIndexes:s}}async function p(e,t="Morgan"){const n=(await u()).getBioLib(),r=new Array(e.length).fill(0).map((()=>new Array(e.length).fill(0))),o={},a=e.map((e=>n.getMonomer("PEPTIDE",e)?.smiles??"")),l=i.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 d(e);const c=i.Column.fromStrings("smiles",a),h=(i.DataFrame.fromColumns([c]),(await l.apply({col:c,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 d(e);for(let t=0;t<h.length;++t)if(r[t][t]=1,o[e[t]]=t,h[t])for(let e=t+1;e<h.length;++e)h[e]&&(r[t][e]=r[e][t]=(0,s.$1)(h[t],h[e]));return{scoringMatrix:r,alphabetIndexes:o}}},7384:(e,t,n)=>{"use strict";n.d(t,{C4:()=>d});var i=n(4328),r=n(6082),s=n(1991),o=n.n(s),a=n(439),l=n(826);const c={V2K_RGP_SHIFT:8,V2K_RGP_LINE:"M RGP",V2K_A_LINE:"A ",V3K_COUNTS_SHIFT:14,V3K_IDX_SHIFT:7,V3K_HEADER_FIRST_LINE:"\nDatagrok macromolecule handler\n\n",V3K_HEADER_SECOND_LINE:" 0 0 0 0 0 0 999 V3000\n",V3K_BEGIN_CTAB_BLOCK:"M V30 BEGIN CTAB\n",V3K_END_CTAB_BLOCK:"M V30 END CTAB\n",V3K_BEGIN_COUNTS_LINE:"M V30 COUNTS ",V3K_COUNTS_LINE_ENDING:" 0 0 0\n",V3K_BEGIN_ATOM_BLOCK:"M V30 BEGIN ATOM\n",V3K_END_ATOM_BLOCK:"M V30 END ATOM\n",V3K_BEGIN_BOND_BLOCK:"M V30 BEGIN BOND\n",V3K_END_BOND_BLOCK:"M V30 END BOND\n",V3K_BOND_CONFIG:" CFG=",V3K_BEGIN_DATA_LINE:"M V30 ",V3K_END:"M END",PRECISION_FACTOR:1e4,DEOXYRIBOSE:"d",RIBOSE:"r",PHOSPHATE:"p",OXYGEN:"O",HYDROGEN:"H"};var u=n(3151);function h(e){return Math.round(c.PRECISION_FACTOR*e)/c.PRECISION_FACTOR}async function d(e,t,s){if(0===r.Func.find({package:"Chem",name:"getRdKitModule"}).length)return{col:null,warnings:['Transformation to atomic level requires the package "Chem" installed.']};if(t.semType!==r.SEMTYPE.MACROMOLECULE)return{col:null,warnings:[`Only the ${r.SEMTYPE.MACROMOLECULE} columns can be converted to atomic level, the chosen column has semType '${t.semType}'`]};let h=t;const d=l.GO.forColumn(t);d.isHelm()&&(h=d.convert(a.Hi.SEPARATOR,"."),h.name=t.name);const m=l.GO.forColumn(h).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 '${h.name}' alphabet '${m}'.`]};f="RNA"}const g=function(e){const t=e.length,n=new Array(t),r=l.GO.forColumn(e);let s=!1;for(let e=0;e<t;++e){const t=r.getSplitted(e);s||(s=0===t.length),n[e]=o()(t.canonicals).filter((e=>!r.isGap(e))).map((e=>e)).toArray()}return s&&i.shell.warning(`Some values in the "${e.name}" column are empty`),n}(h),y=await async function(e,t,n,r){const s=function(e,t,n){const i=new Map;for(const r of e.getMonomerSymbolsByType(t)){const s=e.getMonomer(t,r);if("RNA"===t&&("Branch"===s.monomerType||n===a.YI.DNA&&s.symbol===c.DEOXYRIBOSE||n===a.YI.RNA&&s.symbol===c.RIBOSE||s.symbol===c.PHOSPHATE)||"PEPTIDE"===t&&"Branch"!==s.monomerType){const e={};u.f6.forEach((t=>{e[t]=s[t]})),i.set(s.symbol,e)}}return i}(t,n,r),o=new Map,l=await i.functions.call("Chem:getRdKitModule"),h={value:null};if("RNA"===n){const e=r===a.YI.RNA?[c.RIBOSE,c.PHOSPHATE]:[c.DEOXYRIBOSE,c.PHOSPHATE];for(const t of e)p(o,t,s,l,n,h)}for(let t=0;t<e.length;++t){const i=e[t];for(const e of i)if(""!==e)try{p(o,e,s,l,n,h)}catch(t){const n=t instanceof Error?t.message:t.toString(),i=t instanceof Error?t.stack:void 0;throw console.error(`bio lib: getMonomersDictFromLib() sym='${e}', error:\n${n}\n${i}`),new Error(`Can't get monomer '${e}' from library: ${n}`)}}return o}(g,s,f,m),b=h.length,{molfileList:v,molfileWarningList:w}=await async function(e,t,i,r,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)))),l=s/o;let c=[],u=[];const h=new Array(o);for(let n=0;n<o;n++){const c=Math.floor(n*l),u=n===o-1?s:Math.floor((n+1)*l);a[n].postMessage({monomerSequencesArray:e,monomersDict:t,alphabet:i,polymerType:r,start:c,end:u}),h[n]=new Promise((e=>{a[n].onmessage=({data:{molfileList:t,molfileWarningList:n}})=>{e({molfileList:t,molfileWarningList:n})}}))}return(await Promise.all(h)).forEach((e=>{c=c.concat(...e.molfileList),u=u.concat(...e.molfileWarningList)})),setTimeout((()=>{a.forEach((e=>{e.terminate()}))}),0),{molfileList:c,molfileWarningList:u}}(g,y,m,f,b);if(w.length>.05*b)throw new Error("Too many errors getting molfiles.");const C=`molfile(${h.name})`,A=e.columns.getUnusedName(C),S=r.Column.fromStrings(A,v);return S.semType=r.SEMTYPE.MOLECULE,S.meta.units=r.UNITS.Molecule.MOLBLOCK,{col:S,warnings:w}}function p(e,t,n,i,r,s){if(!e.has(t)){const o=function(e,t,n,i,r){if(t.has(e)){const o=t.get(e),a=function(e){const t=[];for(const n of e){let e=n.capGroupSmiles;e||(e=n.capGroupSMILES),e=e.replace(/(\[|\]|\*|:|\d)/g,""),t.push(e)}return t}(o.rgroups),l=(s=o.molfile).includes("V3000")?function(e){const t=new Map,n=/M V30 (\d+) R#.+RGROUPS=\((\d+) (\d+)\).*/gm;let i;for(;null!==(i=n.exec(e));)i.index===n.lastIndex&&n.lastIndex++,t.set(parseInt(i[1]),parseInt(i[3]));return t}(s):function(e){const t=new Map;let n=e.indexOf(c.V2K_A_LINE,0),i=n;for(;-1!==n;){i=e.indexOf("\n",n);const r=parseInt(e.substring(n,i).replace(/^A\s+/,""));n=e.indexOf("R",i),i=e.indexOf("\n",n);const s=parseInt(e.substring(n,i).replace(/^R/,""));t.set(r,s),n=e.indexOf(c.V2K_A_LINE,i)}for(n=e.indexOf(c.V2K_RGP_LINE,0),i=e.indexOf("\n",n);-1!==n;){n+=c.V2K_RGP_SHIFT,i=e.indexOf("\n",n);const r=e.substring(n,i).replaceAll(/\s+/g," ").split(" ").map((e=>parseInt(e))).slice(1);for(let e=0;e<r.length;e+=2){if(t.has(r[e])&&t.get(r[e])!==r[e+1])throw new Error(`r-group index ${r[e]} has already been added with a different value`);t.set(r[e],r[e+1])}n=e.indexOf(c.V2K_RGP_LINE,i)}return t}(s),u=o.molfile.includes("V3000")?o.molfile:function(e,t){const n=t.get_mol(e),i=n.get_v3Kmolblock();return n.delete(),i}(function(e){let t=e.indexOf(c.V2K_A_LINE,0);-1===t&&(t=e.indexOf(c.V2K_RGP_LINE));const n=e.indexOf(c.V3K_END,t);return e.substring(0,t)+e.substring(n)}(o.molfile),n),d=function(e){let t=(e=e.replaceAll("\r","")).indexOf(c.V3K_BEGIN_COUNTS_LINE)+c.V3K_COUNTS_SHIFT,n=e.indexOf(" ",t+1);const i=parseInt(e.substring(t,n));return t=n+1,n=e.indexOf(" ",t+1),{atomCount:i,bondCount:parseInt(e.substring(t,n))}}(u),p=function(e,t){const n=new Array(t),i=new Float32Array(t),r=new Float32Array(t),s=new Array(t);let o=e.indexOf(c.V3K_BEGIN_ATOM_BLOCK);o=e.indexOf("\n",o);let a=o;for(let l=0;l<t;l++){o=e.indexOf(c.V3K_BEGIN_DATA_LINE,o)+c.V3K_IDX_SHIFT,a=e.indexOf(" ",o),o=a+1,a=e.indexOf(" ",o),n[l]=e.substring(o,a);const t=new Array(2);for(let n=0;n<2;++n)o=a+1,a=e.indexOf(" ",o),t[n]=parseFloat(e.substring(o,a));i[l]=t[0],r[l]=t[1],o=a,a=e.indexOf("\n",o)+1,s[l]=e.slice(o,a),o=a}return{atomTypes:n,x:i,y:r,kwargs:s}}(u,d.atomCount),g=function(e,t){const n=new Uint32Array(t),i=new Array(t),r=new Map,s=new Map;let o=e.indexOf(c.V3K_BEGIN_BOND_BLOCK);o=e.indexOf("\n",o);let a=o;for(let l=0;l<t;++l){const t=new Array(3);o=e.indexOf(c.V3K_BEGIN_DATA_LINE,a)+c.V3K_IDX_SHIFT,a=e.indexOf(" ",o);for(let n=0;n<3;++n)o=a+1,a=Math.min(e.indexOf("\n",o),e.indexOf(" ",o)),t[n]=parseInt(e.slice(o,a));n[l]=t[0],i[l]=t.slice(1);const u=e.indexOf("\n",o);let h=e.slice(a,u),d=h.indexOf(c.V3K_BOND_CONFIG);if(-1!==d){d=h.indexOf("=",d)+1;let e=h.indexOf(" ",d);-1===e&&(e=h.length);const t=parseInt(h.slice(d,e));r.set(l,t);const n=c.V3K_BOND_CONFIG+t.toString();h=h.replace(n,"")}h||s.set(l,h)}return{bondTypes:n,atomPairs:i,bondConfiguration:r,kwargs:s}}(u,d.bondCount),b=function(e,t,n,i){const r={backboneShift:null,branchShift:null,terminalNodes:[],rNodes:[]};return function(e,t,n){for(const[i,r]of n)e.atomTypes[i-1]=t[r-1]}(e,n,i),function(e,t){t.rNodes=Array.from(e.keys());for(let n=0;n<t.rNodes.length;n++)for(const i of[1,2])if(e.get(t.rNodes[n])===i){const e=t.rNodes[i-1];t.rNodes[i-1]=t.rNodes[n],t.rNodes[n]=e}}(i,r),m(t,r),r}(p,g,a,l),S=function(e){let t=[],n=e.indexOf("M V30 MDLV30/STEABS ATOMS=(");for(;-1!==n;){n+=28;const i=e.indexOf(")",n);t=t.concat(e.substring(n,i).split(" ").slice(1).map((e=>parseInt(e)))),n=i,n=e.indexOf("M V30 MDLV30/STEABS ATOMS=(",n)}return t}(u),x={atoms:p,bonds:g,meta:b,stereoAtoms:S};return"PEPTIDE"===i?function(e){const t=e.meta.terminalNodes[0]-1,n=e.meta.rNodes[0]-1,i=e.atoms.x,r=e.atoms.y;A(e,-i[t],-r[t]);const s=v(i[n],r[n]);w(e.atoms,-s),i[e.meta.rNodes[1]-1]<0&&function(e){C(e,!1)}(e);const o=function(e){const t=function(e){const t=new Map;for(const n of e.bonds.atomPairs)for(let e=0;e<2;e++){const i=n[e],r=n[(e+1)%2];t.has(i)?t.get(i)?.push(r):t.set(i,new Array(1).fill(r))}return t}(e);let n=0;const i=e.atoms.atomTypes.length;let r=0;for(;0===n;){const s=t.get(e.meta.terminalNodes[1])[r];if(e.atoms.atomTypes[s-1]===c.OXYGEN&&s!==e.meta.rNodes[1]&&(n=s),r++,r>i)throw new Error(`Search for double-bonded Oxygen in ${e} has exceeded the limit of ${i}`)}return n}(e);!function(e,t){e.atoms.y[e.meta.rNodes[1]-1]<0&&e.atoms.y[t-1]<0&&(function(e){C(e,!0)}(e),w(e.atoms,-function(e,t){return v(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 i=t-1,r=n-1,s=e.atoms.x,o=e.atoms.y,a=s[i],l=o[i];s[i]=s[r],o[i]=o[r],s[r]=a,o[r]=l}(e,t,e.meta.rNodes[1])}(e,o)}(x):e===c.RIBOSE||e===c.DEOXYRIBOSE?function(e,t){const n=e.atoms.x,i=e.atoms.y;let r=e.meta.terminalNodes[0]-1;const s=e.meta.rNodes[1]-1;A(e,-n[r],-i[r]);const o=v(n[s],i[s]);w(e.atoms,3*Math.PI/2-o),t.value=function(e){const t=e.atoms.x,n=e.atoms.y,i=e.meta.rNodes[2]-1,r=e.meta.terminalNodes[2]-1,s=t[i]-t[r],o=n[i]-n[r];return Math.atan(o/s)+Math.PI/2}(e),r=e.meta.terminalNodes[0]-1,A(e,-n[r],-i[r])}(x,r):e===c.PHOSPHATE?function(e){const t=e.meta.terminalNodes[0]-1,n=e.meta.rNodes[0]-1,i=e.atoms.x,r=e.atoms.y;A(e,-i[t],-r[t]);const s=v(i[n],r[n]);w(e.atoms,Math.PI/2-s)}(x):function(e,t){const n=e.atoms.x,i=e.atoms.y,r=e.meta.terminalNodes[0]-1,s=e.meta.rNodes[0]-1;A(e,-n[r],-i[r]);const o=v(n[s],i[s]),a=t.value;if(!a)throw new Error("The value of sugarBranchToOYAngle is null");w(e.atoms,Math.PI-o+a);const l=function(e,t){return h(Math.sqrt((e.x-t.x)**2+(e.y-t.y)**2))}({x:n[e.meta.rNodes[0]-1],y:i[e.meta.rNodes[0]-1]},{x:n[e.meta.terminalNodes[0]-1],y:i[e.meta.terminalNodes[0]-1]});if(1!=l)for(let e=0;e<n.length;++e)n[e]=h(n[e]/l),i[e]=h(i[e]/l)}(x,r),function(e,t,n){"PEPTIDE"===e?(f(t,e),y(t,t.meta.rNodes[1])):n===c.RIBOSE||n===c.DEOXYRIBOSE?(y(t,t.meta.rNodes[1]),t.meta.rNodes[1]=t.meta.terminalNodes[1],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===c.PHOSPHATE&&(t.meta.terminalNodes[0]=t.meta.rNodes[0],A(t,-t.atoms.x[t.meta.terminalNodes[0]-1],-t.atoms.y[t.meta.terminalNodes[0]-1]),f(t,e),y(t,t.meta.rNodes[1]))}(i,x,e),function(e){let t=0;for(;t<e.atoms.atomTypes.length;)e.atoms.atomTypes[t]===c.HYDROGEN&&(y(e,t+1),--t),++t}(x),x}var s;return null}(t,n,i,r,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 i=t.terminalNodes,r=e.atomPairs;let s=0,o=0;for(;s<r.length&&o<i.length;){for(let e=0;e<i.length;++e)for(let t=0;t<2;++t)r[s][t]===n[e]&&(i[e]=r[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[h(e.atoms.x[t]-e.atoms.x[n]),h(e.atoms.y[t]-e.atoms.y[n])]}function y(e,t){if(void 0!==t){const n=t-1,i=e.atoms,r=e.bonds,s=e.meta;i.atomTypes.splice(n,1),i.x=b(Float32Array,i.x,n,1),i.y=b(Float32Array,i.y,n,1),i.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<r.atomPairs.length;){const e=r.atomPairs[o][0],n=r.atomPairs[o][1];e===t||n===t?(r.atomPairs.splice(o,1),r.bondTypes=b(Uint32Array,r.bondTypes,o,1),r.bondConfiguration.has(o)&&r.bondConfiguration.delete(o),r.kwargs.has(o)&&r.kwargs.delete(o),--o):(r.atomPairs[o][0]=e>t?e-1:e,r.atomPairs[o][1]=n>t?n-1:n),++o}let a=Array.from(r.bondConfiguration.keys());a.forEach((e=>{if(r.bondConfiguration.has(e)&&e>n){const t=r.bondConfiguration.get(e);r.bondConfiguration.delete(e),r.bondConfiguration.set(e-1,t)}})),a=Array.from(r.kwargs.keys()),a.forEach((e=>{if(r.kwargs.has(e)&&e>n){const t=r.kwargs.get(e);r.kwargs.delete(e),r.kwargs.set(e-1,t)}}))}}function b(e,t,n,i){const r=new e(t.length-i);let s=0,o=0;for(;s<t.length;)s===n&&(s+=i),r[o]=t[s],++o,++s;return r}function v(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 i=t/e,r=Math.atan(i);n=e<0?Math.PI/2+r:-Math.PI/2+r}return n}function w(e,t){if(0!==t){const n=e.x,i=e.y,r=Math.cos(t),s=Math.sin(t);for(let e=0;e<n.length;++e){const t=n[e];n[e]=h(t*r-i[e]*s),i[e]=h(t*s+i[e]*r)}}}function C(e,t){if(t){const t=e.atoms.y;for(let e=0;e<t.length;e++)t[e]=-t[e]}else{const t=e.atoms.x;for(let e=0;e<t.length;e++)t[e]=-t[e]}const n=e.bonds.bondConfiguration;for(const[e,t]of n){const i=1===t?3:1;n.set(e,i)}}function A(e,t,n){const i=e.atoms.x,r=e.atoms.y;for(let e=0;e<i.length;++e)i[e]=h(i[e]+t),void 0!==n&&(r[e]=h(r[e]+n))}},1093:(e,t,n)=>{"use strict";n.d(t,{A:()=>r});var i=n(7362);class r extends i.e{static get Chromatogram(){return void 0===this.chromatogram&&(this.chromatogram=new r({A:"green",C:"blue",G:"black",T:"red",U:"red",others:"gray"})),this.chromatogram}}class 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:()=>i});class i{static makePalette(e,t=!1,n=i){const r={};return e.forEach((e=>{const n=e[0],i=e[1];n.forEach(((e,n)=>{r[e]=this.colourPalette[i][t?0:n]}))})),new n(r)}constructor(e){this._palette=e}get(e){return this._palette[e]}}i.undefinedColor="rgb(100,100,100)",i.colourPalette={orange:["rgb(255,187,120)","rgb(245,167,100)","rgb(235,137,70)","rgb(205, 111, 71)"],all_green:["rgb(44,160,44)","rgb(74,160,74)","rgb(23,103,57)","rgb(30,110,96)","rgb(60,131,95)","rgb(24,110,79)","rgb(152,223,138)","rgb(182, 223, 138)","rgb(152, 193, 138)"],all_blue:["rgb(31,119,180)","rgb(23,190,207)","rgb(122, 102, 189)","rgb(158,218,229)","rgb(141, 124, 217)","rgb(31, 120, 150)"],magenta:["rgb(162,106,192)","rgb(197,165,224)","rgb(208,113,218)"],red:["rgb(214,39,40)","rgb(255,152,150)"],st_blue:["rgb(23,190,207)","rgb(158,218,229)","rgb(31,119,180)"],dark_blue:["rgb(31,119,180)","rgb(31, 120, 150)"],light_blue:["rgb(23,190,207)","rgb(158,218,229)","rgb(108, 218, 229)","rgb(23,190,227)"],lilac_blue:["rgb(124,102,211)","rgb(149,134,217)","rgb(97, 81, 150)"],dark_green:["rgb(23,103,57)","rgb(30,110,96)","rgb(60,131,95)","rgb(24,110,79)"],green:["rgb(44,160,44)","rgb(74,160,74)"],light_green:["rgb(152,223,138)","rgb(182, 223, 138)","rgb(152, 193, 138)"],st_green:["rgb(44,160,44)","rgb(152,223,138)","rgb(39, 174, 96)","rgb(74,160,74)"],pink:["rgb(247,182,210)"],brown:["rgb(140,86,75)","rgb(102, 62, 54)"],gray:["rgb(127,127,127)","rgb(199,199,199)","rgb(196,156,148)","rgb(222, 222, 180)"],yellow:["rgb(188,189,34)"],white:["rgb(230,230,230)"]}},4152:(e,t,n)=>{"use strict";n.d(t,{oT:()=>c});var i=n(6082),r=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 l extends o{static buildPalette(){return[].concat(...Object.values(r.e.colourPalette))}get(e){const t=s.hashCode(e)%l.palette.length;return function(e){if(null==e)return"rgb(100,100,100)";const t=i.Color.fromHtml(e),n=i.Color.g(t),r=i.Color.r(t),s=i.Color.b(t),o=Math.sqrt(Math.pow(0-r,2)+Math.pow(0-n,2)+Math.pow(0-s,2));return o>210?`rgb(${r/o*210},${n/o*210},${s/o*210})`:i.Color.toRgb(t)}(l.palette[t])}}l.palette=l.buildPalette();class c extends r.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 l),this.color}}},6642:(e,t,n)=>{"use strict";n.d(t,{h:()=>o,s:()=>a});var i=n(4328),r=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 i=e.cell.column;if(t=t??i.temp,!t)throw new Error("Grid cell renderer back store (GridColumn or Column) not found.");return[n,i,t]}class a{constructor(e,t,n){this.gridCol=e,this.tableCol=t,this.logger=n,this.subs=[],this.destroyed=!1,this.viewerId=++a.viewerCounter,this.errors=[],this._onRendered=new r.Subject,this.reset(),this.tableCol&&this.tableCol.dataFrame&&this.subs.push(this.tableCol.dataFrame.onDataChanged.subscribe((()=>{try{this.reset()}catch(e){this.logger.error(e)}}))),this.tableCol&&this.subs.push(i.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(i.events.onViewRemoving.subscribe((e=>{try{const t=e.args.view;this.gridCol?.dart&&this.gridCol.grid&&this.gridCol?.grid?.dart&&this.gridCol?.grid?.view?.id===t.id&&!this.destroyed&&this.destroy()}catch(e){this.logger.error(e)}})))}toLog(){return`${this.constructor.name}<${this.viewerId}>`}destroy(){for(const e of this.subs)e.unsubscribe();this.destroyed=!0}invalidateGrid(){this.gridCol&&this.gridCol.dart&&this.gridCol.grid?.invalidate()}get onRendered(){return this._onRendered}invalidate(e){this.invalidateGrid()}async awaitRendered(e=1e4,t=`${e} timeout`){const n=`${this.toLog()}.awaitRendered()`;if(this.logger.debug(`${n}, start, testEvent before`),await(0,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,{J:()=>c});var i=n(6082),r=n(1991),s=n.n(r),o=n(826),a=n(6642),l=n(6718);class c extends a.s{constructor(e,t,n,r,s){super(e,t,n),this.monomerLengthLimit=r,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=i.BitSet.create(this.tableCol.length),this.gridCol&&this.subs.push(this.gridCol.grid.onAfterDrawContent.subscribe((()=>{this._onRendered.next()}))),(0,l.pj)().then((e=>{if(this.destroyed)return;const t=e.getBioLib();this.subs.push(t.onChanged.subscribe((()=>{this.reset(),this.gridCol?.grid?.invalidate()})))}))}reset(){this.propsProvider&&(this.props=this.propsProvider()),this._processedRows=i.BitSet.create(this.tableCol.length),this._monomerLengthList=null,this._monomerLengthMap={},this._monomerStructureMap={}}getCellMonomerLengths(e,t){this.colWidth<t&&(this.colWidth=t,this.reset());const n=this.props.seqHandler.isMsa()?this.getCellMonomerLengthsForSeqMsa():this.getCellMonomerLengthsForSeq(e),i=new Array(n.length+1);i[0]=5;for(let e=1;e<i.length;e++)i[e]=i[e-1]+n[e-1];return[n,i]}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),i=o.GO.forColumn(this.tableCol).getSplitted(e).originals,r=Math.min(n,i.length);let s=this._monomerLengthList[e];if(null===s||s.length<r){s=this._monomerLengthList[e]=new Array(i.length);let t=0;for(let e=0;e<r;++e){const n=i[e],r=this.props.monomerToShort(n,this.monomerLengthLimit),o=(this.props.seqHandler.isSeparator()?this.separatorWidth:this.props.separatorWidth)+r.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:i}=(()=>{try{const e=this.gridCol&&this.gridCol.dart?this.gridCol.grid:null;return e&&e.dart?{startIdx:Math.max(Math.floor((e?.vertScroll.min??0)-10),0),endIdx:Math.min(Math.ceil((e?.vertScroll.max??0)+10),this.tableCol.length)}:{startIdx:0,endIdx:Math.min(this.tableCol.length,10)}}catch(e){return{startIdx:0,endIdx:Math.min(this.tableCol.length,10)}}})(),r=this.props.separatorWidth+1*this.props.monomerCharWidth,s=Math.ceil(this.colWidth/r);for(let e=n;e<i;e++){if(this._processedRows.get(e)&&s<=this._processedMaxVisibleSeqLength)continue;const n=o.GO.forColumn(this.tableCol).getSplitted(e,s).originals,i=Math.min(s,n.length);i>t.length&&t.push(...new Array(i-t.length).fill(r));let a=0;for(let e=0;e<i;++e){const i=n[e],r=this.props.monomerToShort(i,this.monomerLengthLimit),s=this.props.separatorWidth+r.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[i,r]=this.getCellMonomerLengths(e,n),a=o.GO.forColumn(this.tableCol);return 0===s()(a.getSplitted(e).originals).toArray().length?null:function(e,t){let n,i=100,r=0,s=e.length-1;for(;r<=s;){if(n=Math.floor((s+r)/2),e[n]<=t&&t<e[n+1])return n;if(t<e[n]?s=n-1:r=n+1,--i<=0)throw new Error(`Get position for pointer x = ${t} searching has not converged on ${JSON.stringify(e)}. `)}return null}(r,t)}setMonomerLengthLimit(e){this.monomerLengthLimit=e,this.reset()}setSeparatorWidth(e){this.props.separatorWidth=e,this.reset()}isMsa(){return this.props.seqHandler.isMsa()}}},3151:(e,t,n)=>{"use strict";n.d(t,{EK:()=>a,Ec:()=>s,f6:()=>i,q7:()=>o,yw:()=>r});const i=["symbol","molfile","rgroups","name"],r="MonomerName",s={monomerType:null,smiles:null,name:"Name",author:null,molfile:"molecule",naturalAnalog:"MonomerNaturalAnalogCode",rgroups:"MonomerCaps",createDate:null,id:null,polymerType:"MonomerType",symbol:"MonomerName"},o="p",a=new RegExp(`[rd]\\((\\w)\\)${o}?`,"g")},9192:(e,t,n)=>{"use strict";function i(e){return"string"==typeof e||e instanceof String?e:"StateError"===e.constructor.name?e.message:"StateError"===e.constructor.name&&"$thrownJsError"in e?i(e.$thrownJsError):e instanceof Error?e.message:e.toString()}function r(e){return e instanceof Error?e.stack:"StateError"===e.constructor.name&&"$thrownJsError"in e?r(e.$thrownJsError):void 0}function s(e){return[i(e),r(e)]}n.d(t,{AP:()=>s})},3516:(e,t,n)=>{"use strict";n.d(t,{m:()=>o});var i=n(6082),r=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 i=this._fileContent.substring(t.index+1,e.lastIndex);this._descriptionsArray.push(i),0!==n&&this._sequencesArray.push(this.parseMacromolecule(n,t.index)),n=e.lastIndex+1}this._sequencesArray.push(this.parseMacromolecule(n,-1))}importFasta(){const e=i.Column.fromStrings("description",this.descriptionsArray),t=i.Column.fromStrings("sequence",this.sequencesArray);return t.semType=i.SEMTYPE.MACROMOLECULE,t.meta.units=s.Hi.FASTA,r.GO.forColumn(t),[i.DataFrame.fromColumns([e,t])]}constructor(e){this._descriptionsArray=[],this._sequencesArray=[],this._fileContent=e,this.parseColumns()}}},6873:(e,t,n)=>{"use strict";n.d(t,{Hx:()=>u,dW:()=>c});var i=n(6082),r=n(1991),s=n.n(r),o=n(2003),a=n(826),l=n(9322);function c(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=i.Column.fromList(i.COLUMN_TYPE.STRING,"MSA",new Array(100).fill(t));n.semType=i.SEMTYPE.MACROMOLECULE,n.meta.units=o.Hi.SEPARATOR,n.setTag(o.gp.separator,"/"),n.setTag(o.gp.alphabet,o.YI.UN),n.setTag(o.gp.alphabetIsMultichar,"true");const r=[];return r.push(n),r.push(i.Column.fromList(i.COLUMN_TYPE.FLOAT,"Activity",new Array(100).fill(7.30751))),r}function u(e=o.Hi.SEPARATOR,t=o.YI.PT,n=(e===o.Hi.SEPARATOR?"-":void 0),r=void 0,c="seq",u=100,h=10**6){const d=t===o.YI.UN?r?.getMonomerSymbolsByType("PEPTIDE")??[]:Array.from((0,o.Qf)(t)),p=d.length,m=i.Column.fromType(i.COLUMN_TYPE.STRING,c,u);m.semType=i.SEMTYPE.MACROMOLECULE,m.meta.units=e,m.setTag(o.gp.alphabet,t),e==o.Hi.SEPARATOR&&m.setTag(o.gp.separator,n);const f=a.GO.forColumn(m);for(let t=0;t<u;t++){const n=s().count(0).take(h).map((e=>d[Math.floor(Math.random()*p)])).toArray(),i=f.joiner(new l.Mu(n,a.b9[e]));m.set(t,i)}return m}},439:(e,t,n)=>{"use strict";n.d(t,{B5:()=>l,Hi:()=>i,Vl:()=>c,YI:()=>r,gp:()=>s,q7:()=>u,z1:()=>a});var i,r,s,o=n(2738);!function(e){e.FASTA="fasta",e.SEPARATOR="separator",e.HELM="helm"}(i||(i={})),function(e){e.DNA="DNA",e.RNA="RNA",e.PT="PT",e.UN="UN"}(r||(r={})),function(e){e.aligned="aligned",e.alphabet="alphabet",e.alphabetSize=".alphabetSize",e.alphabetIsMultichar=".alphabetIsMultichar",e.separator="separator",e.isHelmCompatible=".isHelmCompatible",e.positionNames=".positionNames",e.positionLabels=".positionLabels",e.regions=".regions"}(s||(s={}));const a=", ",l=/(?:\[([A-Za-z0-9_\-,()]+)\])|([A-Za-z\-])/g,c=new class{constructor(){this.fasta={peptide:new Set(["G","L","Y","S","E","Q","D","N","F","A","K","R","H","C","V","P","W","I","M","T"]),dna:new Set(["A","C","G","T"]),rna:new Set(["A","C","G","U"])}}},u=[new o.aD(r.PT,c.fasta.peptide,.5),new o.aD(r.DNA,c.fasta.dna,.55),new o.aD(r.RNA,c.fasta.rna,.55)]},2003:(e,t,n)=>{"use strict";n.d(t,{Hi:()=>i.Hi,J9:()=>r.J9,Qf:()=>r.Qf,SM:()=>r.SM,YI:()=>i.YI,dh:()=>r.dh,gp:()=>i.gp,mn:()=>r.mn,ny:()=>r.ny,q7:()=>i.q7,qp:()=>r.qp,z1:()=>i.z1,zS:()=>r.zS});var i=n(439),r=n(9322)},2738:(e,t,n)=>{"use strict";n.d(t,{XN:()=>s,_S:()=>i,aD:()=>r});const i="";class r{constructor(e,t,n){this.name=e,this.alphabet=t,this.cutoff=n}}class s extends r{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:()=>_,Qf:()=>E,ny:()=>T,Iv:()=>A,dh:()=>b,zS:()=>x,SM:()=>M,mn:()=>I,J9:()=>g,tm:()=>y,qp:()=>C});var i=n(6082),r=n(1991),s=n.n(r),o=n(2738),a=n(439),l=n(826);class c extends Float32Array{}var u=n(3629),h=n(8924),d=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)===l.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}}const g=e=>{const t=s()(e.toString().matchAll(a.B5)).map((e=>e[2]??e[1])).toArray();return new m(t,l.b9[a.Hi.FASTA])},y=e=>e?new f(e):new m([],l.b9[a.Hi.FASTA]);function b(e,t=void 0){return n=>{if(n){let i;const r=new RegExp(String.raw`"-"|'-'|[^${e}]+`,"g");if(void 0!==t){r.lastIndex=0,i=new Array(Math.ceil(t));let e=null,s=0;for(;null!==(e=r.exec(n))&&s<t;)i[s++]=e[0].replace('"-"',"").replace("'-'","");i.splice(s)}else i=n.replaceAll('"-"',"").replaceAll("'-'","").split(e,t);return new m(i,l.b9[a.Hi.SEPARATOR])}return new m([],l.b9[a.Hi.SEPARATOR])}}const v=/(PEPTIDE1|DNA1|RNA1)\{([^}]+)}/g,w=/\[([^\[\]]+)]/g,C=e=>{v.lastIndex=0;const t=v.exec(e.toString()),n=t?t[2]:null,i=n?n.split("."):[];return new m(i.map((e=>{w.lastIndex=0;const t=w.exec(e);return t&&t.length>=2?t[1]:e})),l.b9[a.Hi.HELM])};function A(e,t,n=void 0){if(e.toLowerCase().startsWith(a.Hi.FASTA))return g;if(e.toLowerCase().startsWith(a.Hi.SEPARATOR))return b(t,n);if(e.toLowerCase().startsWith(a.Hi.HELM))return C;throw new Error(`Unexpected units ${e} .`)}const S=/([^\W_]+)/g;function x(e,t){if(e.length<=t)return e;const n=e.match(S),i=e.length>t||(n?.length??0)>1,r=n?.[0]??" ";return i?r.substring(0,t-1)+"…":r}function E(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 _(e,t,n="-"){const i=t.map((t=>{const i=function(e,t,n="-"){const i=new Set([...new Set(Object.keys(e)),...t]);i.delete(n);const r=[],s=[];for(const n of i)r.push(n in e?e[n]:0),s.push(t.has(n)?1:0);const o=new c(r),a=new c(s);return(0,u.KE)(o,a)/((0,u.wQ)(o)*(0,u.wQ)(a))}(e,t.alphabet,n);return new o.XN(t,e,i)}));let r;const s=Math.max(...i.map((e=>e.similarity>e.cutoff?e.similarity:-1)));return r=s>0?i.find((e=>e.similarity===s)).name:a.YI.UN,r}function M(e,t=5){let n;if(e.semType==i.SEMTYPE.MACROMOLECULE)n=l.GO.forColumn(e).alphabet;else{const i=function(e,t,n){const i=e.categories;return function(e,t){const n={};let i=!0,r=null;for(const s of e)if(null==r?r=s.length:s.length!==r&&(i=!1),s.length>=t)for(const e of s.canonicals)e in n||(n[e]=0),n[e]+=1;return{freq:n,sameLength:i}}(s().enumerate(e.getRawData()).map((([e,t])=>n(i[e]))),t)}(e,t,g);n=_(i.freq,a.q7)}return T(n)}function T(e){switch(e){case a.YI.PT:return h.X.GrokGroups;case a.YI.DNA:case a.YI.RNA:return d.A.Chromatogram;default:return p.oT.Color}}function I(e){const t=e.columns.bySemTypeAll(i.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,j8:()=>d});var i=n(6082),r=n(1991),s=n.n(r),o=n(2003),a=n(2738),l=n(9322),c=n(6863),u=n(6718),h=n(3151);const d=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!==i.TYPE.STRING)throw new Error(`Unexpected column type '${e.type}', must be '${i.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[d.notationProvider]??null,this.columnVersion=this.column.version}static setUnitsToFastaColumn(e){if(e.column.semType!==i.SEMTYPE.MACROMOLECULE||e.column.meta.units!==o.Hi.FASTA)throw new Error(`The column of notation '${o.Hi.FASTA}' must be '${i.SEMTYPE.MACROMOLECULE}'.`);e.column.meta.units=o.Hi.FASTA,m.setTags(e)}static setUnitsToSeparatorColumn(e,t){if(e.column.semType!==i.SEMTYPE.MACROMOLECULE||e.column.meta.units!==o.Hi.SEPARATOR)throw new Error(`The column of notation '${o.Hi.SEPARATOR}' must be '${i.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!==i.SEMTYPE.MACROMOLECULE)throw new Error(`The column of notation '${o.Hi.HELM}' must be '${i.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,l.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)}}get stats(){if(null===this._stats){const e={};let t=!0,n=null;const i=this.column.length;for(let r=0;r<i;++r){const i=this.getSplitted(r);null==n?n=i.length:i.length!==n&&(t=!1);for(const t of i.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,r){const s=this.column,a=e.toLowerCase()+"("+s.name+")",l=n??s.dataFrame.columns.getUnusedName(a),c=i.Column.fromList("string",l,r??new Array(this.column.length).fill(""));if(c.semType=i.SEMTYPE.MACROMOLECULE,c.meta.units=e,e===o.Hi.SEPARATOR){if(!t)throw new Error(`Notation '${o.Hi.SEPARATOR}' requires separator value.`);c.setTag(o.gp.separator,t)}c.setTag(i.TAGS.CELL_RENDERER,e===o.Hi.HELM?"helm":"sequence");const u=s.getTag(o.gp.aligned);u&&c.setTag(o.gp.aligned,u);let h=s.getTag(o.gp.alphabet);h||this.notation!==o.Hi.HELM||e===o.Hi.HELM||(h=o.YI.UN),null!=h&&c.setTag(o.gp.alphabet,h);let d=s.getTag(o.gp.alphabetSize);null!=h&&d&&c.setTag(o.gp.alphabetSize,d);const p=s.getTag(o.gp.alphabetIsMultichar);return null!=h&&void 0!==p&&c.setTag(o.gp.alphabetIsMultichar,p),e==o.Hi.HELM&&(d=this.getAlphabetSize().toString(),c.setTag(o.gp.alphabetSize,d)),c}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 r=i.Column.fromList("string",t,new Array(e).fill(""));return r.semType=i.SEMTYPE.MACROMOLECULE,r.meta.units=n,r}getSplitter(e){let t=null;if(t=this.notationProvider?this.notationProvider.splitter:null,t)return t;if(this.units.toLowerCase().startsWith(o.Hi.FASTA))return null===this.column.getTag(o.gp.alphabet)||this.getAlphabetIsMultichar()?o.J9:l.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 c.Z.HAMMING;switch(this.alphabet){case o.YI.DNA:case o.YI.RNA:case o.YI.PT:}return c.Z.LEVENSHTEIN}getDistanceFunction(){return c.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)()).getBioLib().getMonomerSymbolsByType("PEPTIDE"),t=new Set(e),n=((0,o.dh)(this.separator),new Set),i=this.column.length,r=this.column.getRawData();for(let e=0;e<i;++e){const i=r[e];if(!(i in n)){n.add(i);const r=this.getSplitted(e);for(const e of r.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,i){i||(i=this.toFasta(t)?p[o.Hi.FASTA]:p[o.Hi.SEPARATOR]),n||(n=this.toFasta(t)?"":this.separator);const r=e.startsWith("RNA"),s=this.splitter(e),a=[];for(let e=0;e<s.length;++e){let n=s.getOriginal(e);if(r&&(n=n.replace(h.EK,"")),n===p[o.Hi.HELM])a.push(i);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}),i=this.getNewColumn(e,t);return i.init((e=>{const t=this.getSplitted(e);return n(t)})),i}getRegion(e,t,n){const i=this.getNewColumn(this.notation,this.separator);i.name=n;const r=e??0,s=t??this.maxLength-1,a=this.getJoiner(),c=s-r+1,u=p[this.notation];i.init((e=>{const t=this.getSplitted(e),n=new Array(c);for(let e=0;e<c;++e){const i=r+e;n[e]=i<t.length?t.getOriginal(i):u}return a(new l.Mu(n,u))}));const h=e=>{const t=e.split(",").map((e=>e.trim())),n=new Array(c);for(let e=0;e<c;++e){const i=r+e;n[e]=i<t.length?t[i]:"?"}return n.join(o.z1)},d=this.column.getTag(o.gp.positionNames);d&&i.setTag(o.gp.positionNames,h(d));const m=this.column.getTag(o.gp.positionLabels);return m&&i.setTag(o.gp.positionLabels,h(m)),i}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 i;const r=this;switch(t){case o.Hi.FASTA:i=function(e){return r.joinToFasta(e,r.isHelm())};break;case o.Hi.SEPARATOR:if(!n)throw new Error(`Separator is mandatory for notation '${t}'.`);i=function(e){return f(e,n,r.isHelm())};break;case o.Hi.HELM:{const e=r.alphabet===o.YI.DNA||r.alphabet===o.YI.RNA,t=r.getHelmWrappers();i=function(n){return g(n,t,e)};break}default:throw new Error(`Unexpected notation '${t}'.`)}return i}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[d.seqHandler];return t&&t.columnVersion===e.version||(t=e.temp[d.seqHandler]=new m(e)),t}joinToFasta(e,t){const n=new Array(e.length);for(let i=0;i<e.length;++i){const r=e.getOriginal(i);let s=e.getOriginal(i);t&&(s=s.replace(h.EK,"$1")),r===a._S?s=p[o.Hi.FASTA]:r===h.q7?s="":s.length>1&&(s="["+s+"]"),n[i]=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){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),i=e.startsWith("DNA"),r=e.startsWith("RNA");for(let e=0;e<t.length;++e){let s=t.getOriginal(e);(i||r)&&(s=s.replace(h.EK,"$1"),s=s===h.q7?null:s),n[e]=s||null}return new l.Mu(n.filter((e=>!!e)),p[o.Hi.HELM])}}function f(e,t,n){const i=new Array(e.length);for(let t=0;t<e.length;++t){const r=e.getCanonical(t);let s=e.getOriginal(t);n&&(s=s.replace(h.EK,"$1")),r===a._S?s=p[o.Hi.SEPARATOR]:r===h.q7&&(s=""),i[t]=s}return i.join(t)}function g(e,t,n){const[i,r,s,l]=t,c=new Array(e.length);for(let t=0;t<e.length;++t){const i=e.getCanonical(t);let l=e.getOriginal(t);i===a._S?l=p[o.Hi.HELM]:(n&&(l=l.replace(h.EK,"$1")),l=1===l.length?`${r}${l}${s}`:`${r}[${l}]${s}`),c[t]=l}return`${i}${c.join(".")}${l}`}},3077:(e,t,n)=>{"use strict";n.d(t,{R:()=>s});var i=n(6082),r=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=i.DataFrame.create(s),a=r.GO.forColumn(e);for(let e=0;e<s;++e){const i=a.getSplitted(e);for(let r=0;r<i.length;++r){const s=i.getOriginal(r);((n[r]??null)||t(r)).set(e,s,!1)}}return o}},7602:(e,t,n)=>{"use strict";n.d(t,{g:()=>s});var i,r=n(9192);!function(e){e[e.error=0]="error",e[e.warning=1]="warning",e[e.info=2]="info",e[e.debug=3]="debug"}(i||(i={}));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[i,s]=(0,r.AP)(t);this.logger.error(`${e}, SYNC syncId = ${n}, ERROR:\n${i}`,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:()=>r,gp:()=>i,lT:()=>l,mH:()=>a});var i,r,s,o,a,l,c=n(6082);!function(e){e.tooltipWebLogo=".tooltipWebLogo"}(i||(i={})),function(e){e.Entropy="Entropy",e.full="100%"}(r||(r={})),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"}(l||(l={}));const u=new class{constructor(){this.sequenceColumnName=null,this.valueAggrType=c.AGG.TOTAL_COUNT,this.valueColumnName="Activity",this.startPositionName=null,this.endPositionName=null,this.skipEmptySequences=!0,this.skipEmptyPositions=!1,this.shrinkEmptyTail=!0,this.backgroundColor=4294967295,this.positionHeight=r.Entropy,this.positionWidth=16,this.verticalAlignment=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=l.Filtered}}},5540:(e,t,n)=>{"use strict";e=n.hmd(e);var i,r=(i="undefined"!=typeof document&&document.currentScript?document.currentScript.src:void 0,function(e={}){var t,n,r=void 0!==e?e:{};r.ready=new Promise((function(e,i){t=e,n=i}));var s,o=Object.assign({},r),a="object"==typeof window,l="function"==typeof importScripts,c=("object"==typeof process&&"object"==typeof process.versions&&process.versions.node,"");(a||l)&&(l?c=self.location.href:"undefined"!=typeof document&&document.currentScript&&(c=document.currentScript.src),i&&(c=i),c=0!==c.indexOf("blob:")?c.substr(0,c.replace(/[?#].*/,"").lastIndexOf("/")+1):"",l&&(s=e=>{var t=new XMLHttpRequest;return t.open("GET",e,!1),t.responseType="arraybuffer",t.send(null),new Uint8Array(t.response)})),r.print||console.log.bind(console);var u,h,d=r.printErr||console.warn.bind(console);Object.assign(r,o),o=null,r.arguments&&r.arguments,r.thisProgram&&r.thisProgram,r.quit&&r.quit,r.wasmBinary&&(u=r.wasmBinary),r.noExitRuntime,"object"!=typeof WebAssembly&&x("no native wasm support detected");var p,m,f,g=!1;function y(){var e=h.buffer;r.HEAP8=p=new Int8Array(e),r.HEAP16=new Int16Array(e),r.HEAP32=new Int32Array(e),r.HEAPU8=m=new Uint8Array(e),r.HEAPU16=new Uint16Array(e),r.HEAPU32=f=new Uint32Array(e),r.HEAPF32=new Float32Array(e),r.HEAPF64=new Float64Array(e)}var b=[],v=[],w=[],C=0,A=null,S=null;function x(e){r.onAbort&&r.onAbort(e),d(e="Aborted("+e+")"),g=!0,e+=". Build with -sASSERTIONS for more info.";var t=new WebAssembly.RuntimeError(e);throw n(t),t}var E,_;function M(e){return e.startsWith("data:application/octet-stream;base64,")}function T(e){try{if(e==E&&u)return new Uint8Array(u);if(s)return s(e);throw"both async and sync fetching of the wasm failed"}catch(e){x(e)}}function I(e,t,n){return function(e){return u||!a&&!l||"function"!=typeof fetch?Promise.resolve().then((function(){return T(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 T(e)}))}(e).then((function(e){return WebAssembly.instantiate(e,t)})).then((function(e){return e})).then(n,(function(e){d("failed to asynchronously prepare wasm: "+e),x(e)}))}function L(e){for(;e.length>0;)e.shift()(r)}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(B(this.get_type()))return f[this.excPtr>>2];var e=this.get_adjusted_ptr();return 0!==e?e:this.excPtr}}function $(e){var t=h.buffer;try{return h.grow(e-t.byteLength+65535>>>16),y(),1}catch(e){}}function P(e){return r["_"+e]}M(E="wasmDbscan.wasm")||(_=E,E=r.locateFile?r.locateFile(_,c):c+_);var O="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0;function R(e,t,n,i,r){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 i=e.charCodeAt(n);i<=127?t++:i<=2047?t+=2:i>=55296&&i<=57343?(t+=4,++n):t+=3}return t}(e)+1,n=H(t);return function(e,t,n){!function(e,t,n,i){if(!(i>0))return 0;for(var r=n+i-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>=r)break;t[n++]=o}else if(o<=2047){if(n+1>=r)break;t[n++]=192|o>>6,t[n++]=128|63&o}else if(o<=65535){if(n+2>=r)break;t[n++]=224|o>>12,t[n++]=128|o>>6&63,t[n++]=128|63&o}else{if(n+3>=r)break;t[n++]=240|o>>18,t[n++]=128|o>>12&63,t[n++]=128|o>>6&63,t[n++]=128|63&o}}t[n]=0}(e,m,t,n)}(e,n,t),n}(e)),t},array:e=>{var t,n,i=H(e.length);return t=e,n=i,p.set(t,n),i}},o=P(e),a=[],l=0;if(i)for(var c=0;c<i.length;c++){var u=s[n[c]];u?(0===l&&(l=D()),a[c]=u(i[c])):a[c]=i[c]}var h=o.apply(null,a);return function(e){return 0!==l&&F(l),function(e){return"string"===t?(n=e)?function(e,t,n){for(var i=t+n,r=t;e[r]&&!(r>=i);)++r;if(r-t>16&&e.buffer&&O)return O.decode(e.subarray(t,r));for(var s="";t<r;){var o=e[t++];if(128&o){var a=63&e[t++];if(192!=(224&o)){var l=63&e[t++];if((o=224==(240&o)?(15&o)<<12|a<<6|l:(7&o)<<18|a<<12|l<<6|63&e[t++])<65536)s+=String.fromCharCode(o);else{var c=o-65536;s+=String.fromCharCode(55296|c>>10,56320|1023&c)}}else s+=String.fromCharCode((31&o)<<6|a)}else s+=String.fromCharCode(o)}return s}(m,n,i):"":"boolean"===t?Boolean(e):e;var n,i}(e)}(h)}var k,G={__cxa_throw:function(e,t,n){throw new N(e).init(t,n),e},abort:function(){x("")},emscripten_memcpy_big:function(e,t,n){m.copyWithin(e,t,t+n)},emscripten_resize_heap:function(e){var t,n=m.length,i=2147483648;if((e>>>=0)>i)return!1;for(var r=1;r<=4;r*=2){var s=n*(1+.2/r);if(s=Math.min(s,e+100663296),$(Math.min(i,(t=Math.max(e,s))+(65536-t%65536)%65536)))return!0}return!1}},D=(function(){var e,t,i,s,o={env:G,wasi_snapshot_preview1:G};function a(e,t){var n,i=e.exports;return r.asm=i,h=r.asm.memory,y(),r.asm.__indirect_function_table,n=r.asm.__wasm_call_ctors,v.unshift(n),function(){if(C--,r.monitorRunDependencies&&r.monitorRunDependencies(C),0==C&&(null!==A&&(clearInterval(A),A=null),S)){var e=S;S=null,e()}}(),i}if(C++,r.monitorRunDependencies&&r.monitorRunDependencies(C),r.instantiateWasm)try{return r.instantiateWasm(o,a)}catch(e){d("Module.instantiateWasm callback failed with error: "+e),n(e)}(e=u,t=E,i=o,s=function(e){a(e.instance)},e||"function"!=typeof WebAssembly.instantiateStreaming||M(t)||"function"!=typeof fetch?I(t,i,s):fetch(t,{credentials:"same-origin"}).then((function(e){return WebAssembly.instantiateStreaming(e,i).then(s,(function(e){return d("wasm streaming compile failed: "+e),d("falling back to ArrayBuffer instantiation"),I(t,i,s)}))}))).catch(n)}(),r._dbscan=function(){return(r._dbscan=r.asm.dbscan).apply(null,arguments)},r._malloc=function(){return(r._malloc=r.asm.malloc).apply(null,arguments)},r._free=function(){return(r._free=r.asm.free).apply(null,arguments)},function(){return(D=r.asm.stackSave).apply(null,arguments)}),F=function(){return(F=r.asm.stackRestore).apply(null,arguments)},H=function(){return(H=r.asm.stackAlloc).apply(null,arguments)},B=function(){return(B=r.asm.__cxa_is_pointer_type).apply(null,arguments)};function V(){function e(){k||(k=!0,r.calledRun=!0,g||(L(v),t(r),r.onRuntimeInitialized&&r.onRuntimeInitialized(),function(){if(r.postRun)for("function"==typeof r.postRun&&(r.postRun=[r.postRun]);r.postRun.length;)e=r.postRun.shift(),w.unshift(e);var e;L(w)}()))}C>0||(function(){if(r.preRun)for("function"==typeof r.preRun&&(r.preRun=[r.preRun]);r.preRun.length;)e=r.preRun.shift(),b.unshift(e);var e;L(b)}(),C>0||(r.setStatus?(r.setStatus("Running..."),setTimeout((function(){setTimeout((function(){r.setStatus("")}),1),e()}),1)):e()))}if(r.ccall=R,r.cwrap=function(e,t,n,i){var r=!n||n.every((e=>"number"===e||"boolean"===e));return"string"!==t&&r&&!i?P(e):function(){return R(e,t,n,arguments)}},S=function e(){k||V(),k||(S=e)},r.preInit)for("function"==typeof r.preInit&&(r.preInit=[r.preInit]);r.preInit.length>0;)r.preInit.pop()();return V(),e.ready});"object"==typeof exports?e.exports=r:"function"==typeof define&&n.amdO?define([],(function(){return r})):"object"==typeof exports&&(exports.exportCppDbscanLib=r)},6295:(e,t,n)=>{"use strict";n.d(t,{$1:()=>a,Hr:()=>S,Ii:()=>m,T6:()=>A,TK:()=>w,a4:()=>d,be:()=>p,gt:()=>y,iS:()=>o,ij:()=>b,lO:()=>h,lP:()=>g,rR:()=>f,tO:()=>l,v_:()=>c,yK:()=>v,zn:()=>u});var i=n(8774),r=n(8498),s=n(6863);r.aT.Tanimoto,r.aT.Dice,r.aT.Asymmetric,r.aT.BraunBlanquet,r.aT.Cosine,r.aT.Kulczynski,r.aT.McConnaughey,r.aT.RogotGoldberg,r.aT.Russel,r.aT.Sokal,r.aT.Hamming,r.aT.Euclidean,r.aT.Tanimoto,r.aT.Dice,r.aT.Asymmetric,r.aT.BraunBlanquet,r.aT.Cosine,r.aT.Kulczynski,r.aT.McConnaughey,r.aT.RogotGoldberg,r.aT.Russel,r.aT.Sokal,r.aT.Hamming,r.aT.Euclidean;const o=[r.aT.Tanimoto,r.aT.Dice,r.aT.Cosine];function a(e,t){const n=e.trueCount()+t.trueCount();if(0==n)return 1;const i=e.andWithCountBits(t,!0);return i/(n-i)}function l(e,t){return 1-a(e,t)}function c(e,t){return C(a(new i.A(e,32*e.length),new i.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 h(e,t){return 1-function(e,t){const n=e.trueCount()*t.trueCount();return 0==n?0:e.andWithCountBits(t,!0)/Math.sqrt(n)}(e,t)}function d(e,t){return Math.sqrt(e.trueCount()+t.trueCount()-2*e.andWithCountBits(t,!0))}function 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(),i=e.andWithCountBits(t,!0);return i/(2*n-3*i)}(e,t)}function f(e,t){return C(function(e,t){const n=e.trueCount()+t.trueCount(),i=e.trueCount()*t.trueCount();return 0==i?0:e.andWithCountBits(t,!0)*n/(2*i)}(e,t))}function g(e,t){return C(function(e,t){const n=e.trueCount()+t.trueCount(),i=e.trueCount()*t.trueCount();return 0==i?0:(e.andWithCountBits(t,!0)*n-i)/i}(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 b(e,t){return C(function(e,t){const n=Math.max(e.trueCount(),t.trueCount());return 0==n?0:e.andWithCountBits(t,!0)/n}(e,t))}function v(e,t){return C(function(e,t){return 0==e.length?0:e.andWithCountBits(t,!0)/e.length}(e,t))}function w(e,t){return C(function(e,t){const n=e.andWithCountBits(t,!0),i=e.countBits(!0)+t.countBits(!0),r=e.length,s=r-i+n;return n==r||s==r?1:n/i+s/(2*r-i)}(e,t))}function C(e){return 0===e?3402823e32:1/e-1}function A(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 S(e){const t=function(e){const t=e?.mostCommon??new Set;return(e,n)=>{const i=e.length,r=n.length;let s=0,o=0,a=0;for(;o<i&&a<r;)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)}r.aT.Tanimoto,r.aT.Asymmetric,r.aT.Cosine,r.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:()=>i,Gi:()=>a,YP:()=>c,_X:()=>o,n3:()=>r,vb:()=>l});const i="dim-red-preprocessing-function",r="supportedSemTypes",s="supportedTypes",o="supportedUnits",a="supportedDistanceFunctions",l="bypassLargeDataWarning",c="show-scatterplot-progress"},6863:(e,t,n)=>{"use strict";function i(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,i=Math.min(...Object.keys(t).map((e=>e.charCodeAt(0))))+1,r=new Float32Array((n.length+i)*(n.length+i));return Object.entries(t).forEach((([e,i])=>{const s=n[i];Object.entries(t).forEach((([t,i])=>{r[e.charCodeAt(0)*n.length+t.charCodeAt(0)]=s[i]}))})),(e,t)=>1-r[e.charCodeAt(0)*n.length+t.charCodeAt(0)]}(),n=e?.threshold??0;return(e,i)=>{let r=0;const s=e.length,o=i.length,a=Math.ceil(Math.max(s,o)*(1-n));s!==o&&(r=Math.abs(s-o));let l=0;for(let n=0;n<Math.min(s,o);n++)if(e[n]!==i[n]&&(l+=t(e[n],i[n]),l>a))return 1;return l+=r,l/=Math.max(s,o),l}}n.d(t,{Z:()=>o,V:()=>a});var r=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,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,-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]:i,[o.LEVENSHTEIN]:function(){return(e,t)=>(0,r.I)(e,t)/Math.max(e.length,t.length)},[o.NEEDLEMANN_WUNSCH]:function(e){const t=new Uint16Array(65536),{gapOpen:n,gapExtend:i,scoringMatrix:r,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),l=new Array(e.length+1).fill(!1);let c=0,u=1;for(let t=1;t<e.length+1;t++)a[0][t]=-i-(t-1)*i,a[1][t]=0;a[0][0]=0;for(let h=1;h<s.length+1;h++){a[u][0]=-i-(h-1)*i;for(let d=1;d<e.length+1;d++){const p=a[c][d-1]+r[t[e.charCodeAt(d-1)]][t[s.charCodeAt(h-1)]],m=a[c][d]-(o[d]||1===h||h===s.length?i:n),f=a[u][d-1]-(l[d-1]||1===d||d===e.length?i:n);a[u][d]=Math.max(p,f,m),a[u][d]===p?(o[d]=!1,l[d]=!1):a[u][d]===f?(o[d]=!1,l[d]=!0):(o[d]=!0,l[d]=!1)}c=u,u=(u+1)%2}const h=Math.min(e.length,s.length);return(h-a[c][e.length])/h}},[o.MONOMER_CHEMICAL_DISTANCE]:i}},9039:(e,t,n)=>{"use strict";var i;n.d(t,{c:()=>i}),function(e){e.UMAP="UMAP",e.T_SNE="t-SNE"}(i||(i={}))},8498:(e,t,n)=>{"use strict";var i,r,s,o,a,l,c;n.d(t,{EG:()=>a,Pn:()=>r,RR:()=>l,Wn:()=>c,aT:()=>s,m6:()=>o,xL:()=>i}),function(e){e.Levenshtein="Levenshtein",e.JaroWinkler="Jaro-Winkler",e.Manhattan="Manhattan",e.Onehot="One-Hot"}(i||(i={})),function(e){e.Euclidean="Euclidean"}(r||(r={})),function(e){e.Tanimoto="Tanimoto",e.Dice="Dice",e.Asymmetric="Asymmetric",e.BraunBlanquet="Braun-Blanquet",e.Cosine="Cosine",e.Kulczynski="Kulczynski",e.McConnaughey="Mc-Connaughey",e.RogotGoldberg="Rogot-Goldberg",e.Russel="Russel",e.Sokal="Sokal",e.Hamming="Hamming",e.Euclidean="Euclidean"}(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"}(l||(l={})),function(e){e.CommonItems="Common Items"}(c||(c={}))},2780:(e,t,n)=>{"use strict";n.d(t,{xL:()=>i.xL});var i=n(8498);n(9336)},9336:(e,t,n)=>{"use strict";var i=n(2787),r=n(944),s=n(6295),o=n(3629),a=n(6863),l=n(8498);const c={[l.Pn.Euclidean]:o.ou},u={[l.xL.Levenshtein]:i.I,[l.xL.JaroWinkler]:r.Vb,[l.xL.Manhattan]:function(e,t){if(e.length!==t.length)return 1;{let n=0;for(let i=1;i<e.length;i++)n+=e[i]==t[i]?0:1;return n/e.length}},[l.xL.Onehot]:function(e,t){return e===t?0:1}},h={[l.aT.Tanimoto]:s.tO,[l.aT.Dice]:s.zn,[l.aT.Asymmetric]:s.gt,[l.aT.BraunBlanquet]:s.ij,[l.aT.Cosine]:s.lO,[l.aT.Kulczynski]:s.rR,[l.aT.McConnaughey]:s.lP,[l.aT.RogotGoldberg]:s.TK,[l.aT.Russel]:s.yK,[l.aT.Sokal]:s.Ii,[l.aT.Hamming]:s.be,[l.aT.Euclidean]:s.a4},d={[l.m6.TanimotoIntArray]:s.v_},p={[l.RR.Difference]:s.T6},m={[l.Wn.CommonItems]:s.Hr},f={[l.EG.Vector]:{[l.Pn.Euclidean]:c[l.Pn.Euclidean]},[l.EG.String]:{[l.xL.Levenshtein]:u[l.xL.Levenshtein],[l.xL.JaroWinkler]:u[l.xL.JaroWinkler],[l.xL.Manhattan]:u[l.xL.Manhattan],[l.xL.Onehot]:u[l.xL.Onehot]},[l.EG.BitArray]:{[l.aT.Tanimoto]:h[l.aT.Tanimoto],[l.aT.Dice]:h[l.aT.Dice],[l.aT.Asymmetric]:h[l.aT.Asymmetric],[l.aT.BraunBlanquet]:h[l.aT.BraunBlanquet],[l.aT.Cosine]:h[l.aT.Cosine],[l.aT.Kulczynski]:h[l.aT.Kulczynski],[l.aT.McConnaughey]:h[l.aT.McConnaughey],[l.aT.RogotGoldberg]:h[l.aT.RogotGoldberg],[l.aT.Russel]:h[l.aT.Russel],[l.aT.Sokal]:h[l.aT.Sokal]},[l.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]},[l.EG.Number]:{[l.RR.Difference]:p[l.RR.Difference]},[l.EG.IntArray]:{[l.m6.TanimotoIntArray]:d[l.m6.TanimotoIntArray]},[l.EG.NumberArray]:{[l.Wn.CommonItems]:m[l.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:()=>i});class i{constructor(e,t=!1){if(this._length=0,this._version=0,this._updateLevel=0,this._selectedCount=0,this._selectedCountVersion=-1,this._selectedIndexesVersion=-1,this._versionedName="",this._versionedNameVersion=-1,this.SHRINK_THRESHOLD=256,"number"==typeof e){const n=e,r=i._createBuffer(n);if(t)for(let e=0;e<r.length;e++)r[e]=-1;this._data=r,this._length=n}else{if(!(e instanceof Uint32Array))throw new Error("Invalid constructor");this._data=e,this._length=t}}getRawData(){return this._data}assureGoez(e,t){if(e<0)throw new Error(`${t} should be greater than zero`)}assureInRange(e,t,n,i){if(e<t||e>n)throw new Error(`Argument ${i} (${e}) out of range (${t}, ${n})`)}copy(e,t,n){for(let i=0;i<n;i++)t[i]=e[i]}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 i(e._length);n._length=e._length,n._data=i._createBuffer(n._length),n._version=0;const r=e.lengthInInts;for(let i=0;i<r;i++)n._data[i]=e._data[i]&t._data[i];return n}static _createBuffer(e){return new Uint32Array(Math.floor((e+31)/32))}static fromValues(e){const t=new i(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 i(e);for(let i=0;i<e;++i)n.setBit(i,t(i));return n._version=0,n}static fromString(e){return i.fromSeq(e.length,(t=>"1"==e.charAt(t)))}static fromUint32Array(e,t){const n=new i(e);return n._data=t,n}static fromBytes(e){const t=e.length,n=new i(8*t);n._data=new Uint32Array(Math.floor((t+3)/4)),n._length=8*t;let r=0,s=0;for(;t-s>=4;)n._data[r++]=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[r]=(255&e[s+2])<<16),t-s==2&&(n._data[r]|=(255&e[s+1])<<8),t-s==1&&(n._data[r]|=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 i(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,i=this.lengthInInts;for(let e=0;e<i;e++)this._data[e]=n;this.incrementVersion(t)}setIndexes(e,t=!0,n=!0,i=!0){n&&this.setAll(!t,!1);for(const n of e)this.setFast(n,t);this.incrementVersion(i)}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,i=!0,r=!0){if(n&&r&&this.setAll(!t,!1),r)for(let n=0;n<this._length;n++)e(n)&&this.setFast(n,t);else for(let n=0;n<this._length;n++)this.setFast(n,e(n)?t:!t);this.incrementVersion(i)}getRange(e,t){this.assureInRange(e,0,this._length-1,"from"),this.assureInRange(t,0,this._length,"to");const n=[];for(let i=e;i<t;++i)n.push(this.getBit(i));return i.fromValues(n)}getRangeAsList(e,t){this.assureInRange(e,0,this._length-1,"from"),this.assureInRange(t,0,this._length,"to");const n=[];for(let i=e;i<t;++i)n.push(this.getBit(i));return n}setRange(e,t,n,i=!0){this.assureInRange(e,0,this._length-1,"from"),this.assureInRange(t,0,this._length-1,"to");const r=Math.min(e,t),s=Math.max(e,t);if(n)for(let e=r;e<=s;e++)this.setTrue(e);else for(let e=r;e<=s;e++)this.setFalse(e);return this.incrementVersion(i),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 i=this._length;this.setLength(this._length+t);for(let n=i-1;n>=e;n--)this.setBit(n+t,this.getBit(n));for(let i=e;i<e+t;i++)this.setBit(i,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 i=-1;-1!=(i=e.findNext(i,!t));)this.setFast(n++,this.getBit(i));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+=i._onBitCount[255&e];let n=this._data[t];const r=31&this._length;for(0!=r&&(n&=~(4294967295<<r));0!=n;n>>>=8)this._selectedCount+=i._onBitCount[255&n];this._selectedCountVersion=this._version}return e?this._selectedCount:this._length-this._selectedCount}countWhere(e){let t=0;if(this.trueCount()==this._length)for(let n=0;n<this._length;n++)t+=e(n)?1:0;else for(let n=-1;-1!=(n=this.findNext(n,!0));)t+=e(n)?1:0;return t}andWithCountBits(e,t){if(0==this._length)return 0;let n=0;const r=this.lengthInInts;let s=0;for(;s<r-1;s++)for(let t=this._data[s]&e._data[s];0!=t;t>>>=8)n+=i._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+=i._onBitCount[255&o];return t?n:this._length-n}clear(){this.setLength(0)}contains(e){return this.findNext(-1,e)>=0}get allTrue(){return this.countBits(!0)==this._length}get allFalse(){return this.countBits(!1)==this._length}get anyTrue(){return this.countBits(!0)>0}get anyFalse(){return this.countBits(!1)>0}findNext(e,t=!0){if(this.assureInRange(e,-1,this._length,"index"),e>=this._length-1)return-1;let n=31&(e=e<0?0:e+1);const r=this.lengthInInts;for(let s=Math.floor(e/32);s<r;s++){let r=t?this._data[s]:~this._data[s];if(0!=n)r&=4294967295<<n&4294967295,n=0;else if(!t&&-4294967296==r)continue;for(let t=0;0!=r;t+=8,r>>>=8){const n=i._firstOnBit[255&r];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 r=Math.floor(e/32);r>=0;r--){let e=t?this._data[r]:~this._data[r];0!=n&&(e&=~(4294967295<<n),n=0);for(let t=24;0!=e;t-=8,e<<=8){const n=i._lastOnBit[e>>>24];if(n>=0)return n+32*r+t}}return-1}}i._onBitCount=Int8Array.from([0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4,1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7,1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7,2,3,3,4,3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,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,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,{cb:()=>a,PE:()=>o}),n(4328);var i=n(6082);n(9982),i.DataFrame.fromCsv('countries,fasta,smiles,molregno,LON,Zip Code,Street Address Line 1,ImageUrl,user_id,error_message,xray,flag,magnitude,CS-id,pdb_id,accel_a,time_offset,chart,fit,Questions,empty_number,empty_string\nBelgium,MSNFHNEHVMQFYRNNLKTKGVFGRQ,CC(C(=O)OCCCc1cccnc1)c2cccc(c2)C(=O)c3ccccc3,1480014,36.276729583740234,995042300,14016 ROUTE 31W,https://datagrok.ai/img/slides/access-db-connect.png,id,ErrorMessage,"COMPND \nATOM \nEND",flag,1,1,1QBS,1,1.23,<chart></chart>,"{""series"":[{""name"":""Run:2023-08-08"",""fitFunction"":""sigmoid"",""fitLineColor"":""#1f77b4"",""pointColor"":""#1f77b4"",""showPoints"":""points"",""parameters"":[2.497360340644872, 1.7058694986686864, 5.278052678195135, 0.16000320889028383],""points"":[{""x"":0.10000000149011612,""y"":2.374499797821045},{""x"":0.6000000238418579,""y"":2.6242473125457764},{""x"":1.100000023841858,""y"":2.367267608642578},{""x"":1.600000023841858,""y"":2.6723148822784424},{""x"":2.0999999046325684,""y"":2.6537344455718994},{""x"":2.5999999046325684,""y"":2.3651671409606934},{""x"":3.0999999046325684,""y"":2.5654284954071045},{""x"":3.5999999046325684,""y"":2.4160959720611572},{""x"":4.099999904632568,""y"":2.286726713180542},{""x"":4.599999904632568,""y"":2.5100042819976807},{""x"":5.099999904632568,""y"":1.6676985025405884},{""x"":5.599999904632568,""y"":0.680136501789093},{""x"":6.099999904632568,""y"":0.3391543924808502},{""x"":6.599999904632568,""y"":0.09038983285427094},{""x"":7.099999904632568,""y"":0.19802775979042053}]},{""name"":""Run:2023-08-08"",""fitLineColor"":""#ffbb78"",""pointColor"":""#ffbb78"",""showPoints"":""points"",""parameters"":[7.525235855508179, 1.3186911876809984, 5.335672608564294, 0.7860743343958098],""points"":[{""x"":0.10000000149011612,""y"":7.988070487976074},{""x"":0.6000000238418579,""y"":7.018453121185303},{""x"":1.100000023841858,""y"":8.115279197692871},{""x"":1.600000023841858,""y"":7.486658096313477},{""x"":2.0999999046325684,""y"":7.396438121795654},{""x"":2.5999999046325684,""y"":7.477052211761475},{""x"":3.0999999046325684,""y"":6.913095474243164},{""x"":3.5999999046325684,""y"":8.01385498046875},{""x"":4.099999904632568,""y"":6.985900402069092},{""x"":4.599999904632568,""y"":6.970335960388184},{""x"":5.099999904632568,""y"":5.448817253112793},{""x"":5.599999904632568,""y"":2.5534818172454834},{""x"":6.099999904632568,""y"":1.893947958946228},{""x"":6.599999904632568,""y"":0.6340042352676392},{""x"":7.099999904632568,""y"":0.8403874039649963}]}],""chartOptions"":{""xAxisName"":""Conc."",""yAxisName"":""Activity"",""title"":""Dose-Response curves""}}",text,100,abc\nBurundi,MDYKETLLMPKTDFPMRGGLPNKEPQIQEKW,COc1ccc2cc(ccc2c1)C(C)C(=O)Oc3ccc(C)cc3OC,1480015,36.276729583740234,995073444,80 STATE HIGHWAY 310,https://datagrok.ai/img/slides/access-db-connect.png,id,ErrorMessage,"COMPND \nATOM \nEND",flag,2,2,1ZP8,2,1.23,<chart></chart>,"{""series"":[{""name"":""Run:2023-08-08"",""fitFunction"":""sigmoid"",""fitLineColor"":""#1f77b4"",""pointColor"":""#1f77b4"",""showPoints"":""points"",""parameters"":[4.431460753103398, 2.1691498799246745, 5.266445597102774, 0.7825762827017926],""points"":[{""x"":0.10000000149011612,""y"":4.751083850860596},{""x"":0.6000000238418579,""y"":4.203000068664551},{""x"":1.100000023841858,""y"":4.415858745574951},{""x"":1.600000023841858,""y"":4.68414306640625},{""x"":2.0999999046325684,""y"":4.198400974273682},{""x"":2.5999999046325684,""y"":4.179222106933594},{""x"":3.0999999046325684,""y"":4.638473987579346},{""x"":3.5999999046325684,""y"":4.708553314208984},{""x"":4.099999904632568,""y"":4.291589260101318},{""x"":4.599999904632568,""y"":4.038082599639893},{""x"":5.099999904632568,""y"":3.4349939823150635},{""x"":5.599999904632568,""y"":1.2194708585739136},{""x"":6.099999904632568,""y"":1.1920831203460693},{""x"":6.599999904632568,""y"":0.5352635979652405},{""x"":7.099999904632568,""y"":0.3346920311450958}]},{""name"":""Run:2023-08-08"",""fitLineColor"":""#ffbb78"",""pointColor"":""#ffbb78"",""showPoints"":""points"",""parameters"":[2.339458017970126, -1.0734184310171178, 4.746332950550934, 0.2482416857595658],""points"":[{""x"":0.10000000149011612,""y"":0.2139337658882141},{""x"":0.6000000238418579,""y"":0.4269562065601349},{""x"":1.100000023841858,""y"":0.2441573292016983},{""x"":1.600000023841858,""y"":0.146635964512825},{""x"":2.0999999046325684,""y"":0.08818462491035461},{""x"":2.5999999046325684,""y"":0.2560656666755676},{""x"":3.0999999046325684,""y"":0.42434045672416687},{""x"":3.5999999046325684,""y"":0.37111231684684753},{""x"":4.099999904632568,""y"":0.5581737160682678},{""x"":4.599999904632568,""y"":1.183590054512024},{""x"":5.099999904632568,""y"":1.5629843473434448},{""x"":5.599999904632568,""y"":2.3211288452148438},{""x"":6.099999904632568,""y"":2.229961633682251},{""x"":6.599999904632568,""y"":2.2560226917266846},{""x"":7.099999904632568,""y"":2.2142398357391357}]}],""chartOptions"":{""xAxisName"":""Conc."",""yAxisName"":""Activity"",""title"":""Dose-Response curves""}}",text,,\nCameroon,MIEVFLFGIVLGLIPITLAGLFVTAYLQYRRGDQLDL,COc1ccc2cc(ccc2c1)C(C)C(=O)OCCCc3cccnc3,1480016,36.26095962524414,995153596,30-56 WHITESTONE EXPY,https://datagrok.ai/img/slides/access-db-connect.png,id,ErrorMessage,"COMPND \nATOM \nEND",flag,3,3,2BDJ,3,1.23,<chart></chart>,"{""series"":[{""name"":""Run:2023-08-08"",""fitFunction"":""sigmoid"",""fitLineColor"":""#1f77b4"",""pointColor"":""#1f77b4"",""showPoints"":""points"",""parameters"":[4.6760652578642325, 0.9046956320756703, 5.651408971856738, 0.07738846012184185],""points"":[{""x"":0.10000000149011612,""y"":4.32425594329834},{""x"":0.6000000238418579,""y"":4.668442249298096},{""x"":1.100000023841858,""y"":4.379785060882568},{""x"":1.600000023841858,""y"":5.0345139503479},{""x"":2.0999999046325684,""y"":4.878653526306152},{""x"":2.5999999046325684,""y"":4.3451313972473145},{""x"":3.0999999046325684,""y"":4.336992263793945},{""x"":3.5999999046325684,""y"":5.037430286407471},{""x"":4.099999904632568,""y"":5.0092692375183105},{""x"":4.599999904632568,""y"":4.151902675628662},{""x"":5.099999904632568,""y"":3.4066951274871826},{""x"":5.599999904632568,""y"":2.3732759952545166},{""x"":6.099999904632568,""y"":1.673728108406067},{""x"":6.599999904632568,""y"":0.48574790358543396},{""x"":7.099999904632568,""y"":0.2783052325248718}]},{""name"":""Run:2023-08-08"",""fitLineColor"":""#ffbb78"",""pointColor"":""#ffbb78"",""showPoints"":""points"",""parameters"":[2.938395863010111, -1.4658480661392117, 5.462702751996584, 0.3473139023615039],""points"":[{""x"":0.10000000149011612,""y"":0.4941710829734802},{""x"":0.6000000238418579,""y"":0.15323974192142487},{""x"":1.100000023841858,""y"":0.46373432874679565},{""x"":1.600000023841858,""y"":0.3370431363582611},{""x"":2.0999999046325684,""y"":0.5179030299186707},{""x"":2.5999999046325684,""y"":0.27899765968322754},{""x"":3.0999999046325684,""y"":0.22075064480304718},{""x"":3.5999999046325684,""y"":0.5789918899536133},{""x"":4.099999904632568,""y"":0.21169911324977875},{""x"":4.599999904632568,""y"":0.27857646346092224},{""x"":5.099999904632568,""y"":1.0906332731246948},{""x"":5.599999904632568,""y"":1.8520300388336182},{""x"":6.099999904632568,""y"":2.7177059650421143},{""x"":6.599999904632568,""y"":2.8680918216705322},{""x"":7.099999904632568,""y"":3.2413077354431152}]}],""chartOptions"":{""xAxisName"":""Conc."",""yAxisName"":""Activity"",""title"":""Dose-Response curves""}}",text,,\nCanada,MMELVLKTIIGPIVVGVVLRIVDKWLNKDK,CC(C(=O)NCCS)c1cccc(c1)C(=O)c2ccccc2,1480017,36.26095962524414,99515,30-56 WHITESTONE EXPY,https://datagrok.ai/img/slides/access-db-connect.png,id,ErrorMessage,"COMPND \nATOM \nEND",flag,4,4,1IAN,4,1.23,<chart></chart>,"{""series"":[{""name"":""Run:2023-08-08"",""fitFunction"":""sigmoid"",""fitLineColor"":""#1f77b4"",""pointColor"":""#1f77b4"",""showPoints"":""points"",""parameters"":[0.8597390975430008, 1.0957625732481946, 5.260537067987958, 0.07974187998177736],""points"":[{""x"":0.10000000149011612,""y"":0.8190152645111084},{""x"":0.6000000238418579,""y"":0.8421689867973328},{""x"":1.100000023841858,""y"":0.8740922212600708},{""x"":1.600000023841858,""y"":0.8924275040626526},{""x"":2.0999999046325684,""y"":0.8249067664146423},{""x"":2.5999999046325684,""y"":0.9327669143676758},{""x"":3.0999999046325684,""y"":0.8522974252700806},{""x"":3.5999999046325684,""y"":0.8174492716789246},{""x"":4.099999904632568,""y"":0.8394647240638733},{""x"":4.599999904632568,""y"":0.7139387726783752},{""x"":5.099999904632568,""y"":0.5561167597770691},{""x"":5.599999904632568,""y"":0.3276226818561554},{""x"":6.099999904632568,""y"":0.12479474395513535},{""x"":6.599999904632568,""y"":0.13006797432899475},{""x"":7.099999904632568,""y"":0.059702079743146896}]},{""name"":""Run:2023-08-08"",""fitLineColor"":""#ffbb78"",""pointColor"":""#ffbb78"",""showPoints"":""points"",""parameters"":[5.760930219582546, 1.6591793293833013, 4.667155929720851, 0.7858109544121652],""points"":[{""x"":0.10000000149011612,""y"":6.156993389129639},{""x"":0.6000000238418579,""y"":5.236701965332031},{""x"":1.100000023841858,""y"":6.010560512542725},{""x"":1.600000023841858,""y"":5.495512962341309},{""x"":2.0999999046325684,""y"":6.087770462036133},{""x"":2.5999999046325684,""y"":5.79986572265625},{""x"":3.0999999046325684,""y"":5.597546577453613},{""x"":3.5999999046325684,""y"":5.520902156829834},{""x"":4.099999904632568,""y"":5.360654354095459},{""x"":4.599999904632568,""y"":3.5539746284484863},{""x"":5.099999904632568,""y"":1.577236294746399},{""x"":5.599999904632568,""y"":1.0001264810562134},{""x"":6.099999904632568,""y"":0.9305797815322876},{""x"":6.599999904632568,""y"":0.6033638715744019},{""x"":7.099999904632568,""y"":0.4203685522079468}]}],""chartOptions"":{""xAxisName"":""Conc."",""yAxisName"":""Activity"",""title"":""Dose-Response curves""}}",text,,\nColombia,MDRTDEVSNHTHDKPTLTWFEEIFEEYHSPFHN,FC(F)(F)c1ccc(OC2CCNCC2)cc1,1480029,36.3309440612793,995152050,1 COURT HOUSE SQUARE,https://datagrok.ai/img/slides/access-db-connect.png,id,ErrorMessage,"COMPND \nATOM \nEND",flag,5,5,4UJ1,5,1.23,<chart></chart>,"{""series"":[{""name"":""Run:2023-08-08"",""fitFunction"":""sigmoid"",""fitLineColor"":""#1f77b4"",""pointColor"":""#1f77b4"",""showPoints"":""points"",""parameters"":[6.4995088314153655, 2.4270351004539914, 5.178659535348579, 0.625653346241577],""points"":[{""x"":0.10000000149011612,""y"":6.496231555938721},{""x"":0.6000000238418579,""y"":6.42543363571167},{""x"":1.100000023841858,""y"":7.040063858032227},{""x"":1.600000023841858,""y"":6.1115403175354},{""x"":2.0999999046325684,""y"":6.680728435516357},{""x"":2.5999999046325684,""y"":6.406774520874023},{""x"":3.0999999046325684,""y"":6.611269474029541},{""x"":3.5999999046325684,""y"":5.889094352722168},{""x"":4.099999904632568,""y"":6.75344705581665},{""x"":4.599999904632568,""y"":6.361435890197754},{""x"":5.099999904632568,""y"":4.1666975021362305},{""x"":5.599999904632568,""y"":1.172118902206421},{""x"":6.099999904632568,""y"":0.801048994064331},{""x"":6.599999904632568,""y"":0.4640021026134491},{""x"":7.099999904632568,""y"":0.0010357667924836278}]},{""name"":""Run:2023-08-08"",""fitLineColor"":""#ffbb78"",""pointColor"":""#ffbb78"",""showPoints"":""points"",""parameters"":[1.4734381347446401, 1.1649805188074196, 4.82958608866421, 0.09500545496710007],""points"":[{""x"":0.10000000149011612,""y"":1.5279096364974976},{""x"":0.6000000238418579,""y"":1.3559974431991577},{""x"":1.100000023841858,""y"":1.5246378183364868},{""x"":1.600000023841858,""y"":1.5567657947540283},{""x"":2.0999999046325684,""y"":1.4114240407943726},{""x"":2.5999999046325684,""y"":1.4045010805130005},{""x"":3.0999999046325684,""y"":1.4769829511642456},{""x"":3.5999999046325684,""y"":1.4875500202178955},{""x"":4.099999904632568,""y"":1.2991987466812134},{""x"":4.599999904632568,""y"":0.922961413860321},{""x"":5.099999904632568,""y"":0.6520044803619385},{""x"":5.599999904632568,""y"":0.15350978076457977},{""x"":6.099999904632568,""y"":0.1078903079032898},{""x"":6.599999904632568,""y"":0.17276449501514435},{""x"":7.099999904632568,""y"":0.14066608250141144}]}],""chartOptions"":{""xAxisName"":""Conc."",""yAxisName"":""Activity"",""title"":""Dose-Response curves""}}",text,,\nCosta Rica,MKSTKEEIQTIKTLLKDSRTAKYHKRLQIVL,CC(C)Cc1ccc(cc1)C(C)C(=O)N2CCCC2C(=O)OCCCc3ccccc3,1480018,36.3309440612793,995084218,4041 SOUTHWESTERN BLVD,https://datagrok.ai/img/slides/access-db-connect.png,id,ErrorMessage,"COMPND \nATOM \nEND",flag,6,6,2BPW,6,1.23,<chart></chart>,"{""series"":[{""name"":""Run:2023-08-08"",""fitFunction"":""sigmoid"",""fitLineColor"":""#1f77b4"",""pointColor"":""#1f77b4"",""showPoints"":""points"",""parameters"":[2.4833641843311227, -1.8945978742090062, 4.671127708092568, 0.24159861311815153],""points"":[{""x"":0.10000000149011612,""y"":0.0969524160027504},{""x"":0.6000000238418579,""y"":0.028483040630817413},{""x"":1.100000023841858,""y"":0.22087176144123077},{""x"":1.600000023841858,""y"":0.0068915546871721745},{""x"":2.0999999046325684,""y"":0.4305879771709442},{""x"":2.5999999046325684,""y"":0.44774115085601807},{""x"":3.0999999046325684,""y"":0.45346319675445557},{""x"":3.5999999046325684,""y"":0.2370593100786209},{""x"":4.099999904632568,""y"":0.4657953977584839},{""x"":4.599999904632568,""y"":1.155200719833374},{""x"":5.099999904632568,""y"":2.2294070720672607},{""x"":5.599999904632568,""y"":2.4311530590057373},{""x"":6.099999904632568,""y"":2.33846116065979},{""x"":6.599999904632568,""y"":2.608201026916504},{""x"":7.099999904632568,""y"":2.8136143684387207}]},{""name"":""Run:2023-08-08"",""fitLineColor"":""#ffbb78"",""pointColor"":""#ffbb78"",""showPoints"":""points"",""parameters"":[5.224573521642033, 1.4454033924198528, 5.6014197746076535, 0.2823216054197577],""points"":[{""x"":0.10000000149011612,""y"":4.95027494430542},{""x"":0.6000000238418579,""y"":5.1754679679870605},{""x"":1.100000023841858,""y"":5.276752948760986},{""x"":1.600000023841858,""y"":5.589294910430908},{""x"":2.0999999046325684,""y"":5.616994857788086},{""x"":2.5999999046325684,""y"":5.120813846588135},{""x"":3.0999999046325684,""y"":5.340766906738281},{""x"":3.5999999046325684,""y"":4.876471042633057},{""x"":4.099999904632568,""y"":4.94999361038208},{""x"":4.599999904632568,""y"":5.162564754486084},{""x"":5.099999904632568,""y"":4.399557590484619},{""x"":5.599999904632568,""y"":2.7977969646453857},{""x"":6.099999904632568,""y"":1.0229872465133667},{""x"":6.599999904632568,""y"":0.48275601863861084},{""x"":7.099999904632568,""y"":0.10408931970596313}]}],""chartOptions"":{""xAxisName"":""Conc."",""yAxisName"":""Activity"",""title"":""Dose-Response curves""}}",text,,\nCuba,MHAILRYFIRRLFYHIFYKIYSLISKKHQSLPSDVRQF,COc1ccc2c(c1)c(CC(=O)N3CCCC3C(=O)Oc4ccc(C)cc4OC)c(C)n2C(=O)c5ccc(Cl)cc5,1480019,36.33115768432617,995081928,1227 US HIGHWAY 11,https://datagrok.ai/img/slides/access-db-connect.png,id,ErrorMessage,"COMPND \nATOM \nEND",flag,7,7,1QBS,7,1.23,<chart></chart>,"{""series"":[{""name"":""Run:2023-08-08"",""fitFunction"":""sigmoid"",""fitLineColor"":""#1f77b4"",""pointColor"":""#1f77b4"",""showPoints"":""points"",""parameters"":[3.320838679713925, -1.2421619987316728, 4.831325425225256, 0.3236011098403072],""points"":[{""x"":0.10000000149011612,""y"":0.3727470338344574},{""x"":0.6000000238418579,""y"":0.12365014106035233},{""x"":1.100000023841858,""y"":0.48422467708587646},{""x"":1.600000023841858,""y"":0.2264465093612671},{""x"":2.0999999046325684,""y"":0.16821794211864471},{""x"":2.5999999046325684,""y"":0.3879014551639557},{""x"":3.0999999046325684,""y"":0.5470244884490967},{""x"":3.5999999046325684,""y"":0.3419053554534912},{""x"":4.099999904632568,""y"":0.7655120491981506},{""x"":4.599999904632568,""y"":1.2346516847610474},{""x"":5.099999904632568,""y"":2.453336715698242},{""x"":5.599999904632568,""y"":2.9565491676330566},{""x"":6.099999904632568,""y"":3.335299491882324},{""x"":6.599999904632568,""y"":3.240290880203247},{""x"":7.099999904632568,""y"":3.1107218265533447}]},{""name"":""Run:2023-08-08"",""fitLineColor"":""#ffbb78"",""pointColor"":""#ffbb78"",""showPoints"":""points"",""parameters"":[3.6401853521511094, 1.26211588875013, 5.399028074402744, 0.5089580830068091],""points"":[{""x"":0.10000000149011612,""y"":3.8585598468780518},{""x"":0.6000000238418579,""y"":3.6077206134796143},{""x"":1.100000023841858,""y"":3.855252265930176},{""x"":1.600000023841858,""y"":3.619039297103882},{""x"":2.0999999046325684,""y"":3.839388370513916},{""x"":2.5999999046325684,""y"":3.335283041000366},{""x"":3.0999999046325684,""y"":3.571141481399536},{""x"":3.5999999046325684,""y"":3.4155046939849854},{""x"":4.099999904632568,""y"":3.7316646575927734},{""x"":4.599999904632568,""y"":3.0680155754089355},{""x"":5.099999904632568,""y"":2.891066551208496},{""x"":5.599999904632568,""y"":1.6022753715515137},{""x"":6.099999904632568,""y"":0.7652576565742493},{""x"":6.599999904632568,""y"":0.6875326037406921},{""x"":7.099999904632568,""y"":0.5828871726989746}]}],""chartOptions"":{""xAxisName"":""Conc."",""yAxisName"":""Activity"",""title"":""Dose-Response curves""}}",text,,\nItaly,MSNFHNEHVMQFYRNNLKTKGVFGRQ,CC(C)Cc1ccc(cc1)C(C)C(=O)N2CCCC2C(=O)OCCO[N+](=O)[O-],1480020,36.33115768432617,99502,"168-46 91ST AVE., 2ND FLR",https://datagrok.ai/img/slides/access-db-connect.png,id,ErrorMessage,"COMPND \nATOM \nEND",flag,8,8,1ZP8,8,1.23,<chart></chart>,"{""series"":[{""name"":""Run:2023-08-08"",""fitFunction"":""sigmoid"",""fitLineColor"":""#1f77b4"",""pointColor"":""#1f77b4"",""showPoints"":""points"",""parameters"":[2.293592105923809, 1.3781586549141835, 5.1025898038676605, 0.03493851245291291],""points"":[{""x"":0.10000000149011612,""y"":2.1287283897399902},{""x"":0.6000000238418579,""y"":2.267972230911255},{""x"":1.100000023841858,""y"":2.398442506790161},{""x"":1.600000023841858,""y"":2.5130622386932373},{""x"":2.0999999046325684,""y"":2.3255116939544678},{""x"":2.5999999046325684,""y"":2.127340793609619},{""x"":3.0999999046325684,""y"":2.47259783744812},{""x"":3.5999999046325684,""y"":2.131181478500366},{""x"":4.099999904632568,""y"":2.090421438217163},{""x"":4.599999904632568,""y"":2.02299165725708},{""x"":5.099999904632568,""y"":1.1105059385299683},{""x"":5.599999904632568,""y"":0.4494485855102539},{""x"":6.099999904632568,""y"":0.1375635862350464},{""x"":6.599999904632568,""y"":0.036351121962070465},{""x"":7.099999904632568,""y"":0.1619771122932434}]},{""name"":""Run:2023-08-08"",""fitLineColor"":""#ffbb78"",""pointColor"":""#ffbb78"",""showPoints"":""points"",""parameters"":[5.953125499439879, 1.2528620255306528, 5.187637440149802, 0.3110348753260886],""points"":[{""x"":0.10000000149011612,""y"":5.6585283279418945},{""x"":0.6000000238418579,""y"":5.911152362823486},{""x"":1.100000023841858,""y"":5.924920082092285},{""x"":1.600000023841858,""y"":5.8469438552856445},{""x"":2.0999999046325684,""y"":5.929472923278809},{""x"":2.5999999046325684,""y"":6.190037727355957},{""x"":3.0999999046325684,""y"":6.236179828643799},{""x"":3.5999999046325684,""y"":6.141019344329834},{""x"":4.099999904632568,""y"":5.295210838317871},{""x"":4.599999904632568,""y"":5.265801906585693},{""x"":5.099999904632568,""y"":3.3722851276397705},{""x"":5.599999904632568,""y"":1.8299226760864258},{""x"":6.099999904632568,""y"":0.32690900564193726},{""x"":6.599999904632568,""y"":0.6274543404579163},{""x"":7.099999904632568,""y"":0.8441857099533081}]}],""chartOptions"":{""xAxisName"":""Conc."",""yAxisName"":""Activity"",""title"":""Dose-Response curves""}}",text,,\nRwanda,MPNSEPASLLELFNSIATQGELVRSLKAGNASK,CC(C)Cc1ccc(cc1)C(C)C(=O)N2CCCC2C(=O)OCCO,1480021,36.33137130737305,995037247,"168-46 91ST AVE., 2ND FLR",https://datagrok.ai/img/slides/access-db-connect.png,id,ErrorMessage,"COMPND \nATOM \nEND",flag,9,9,2BDJ,9,1.23,<chart></chart>,"{""series"":[{""name"":""Run:2023-08-08"",""fitFunction"":""sigmoid"",""fitLineColor"":""#1f77b4"",""pointColor"":""#1f77b4"",""showPoints"":""points"",""parameters"":[3.8209972202654474, 1.3779216716448506, 5.299882228439686, 0.06040645519069608],""points"":[{""x"":0.10000000149011612,""y"":3.7821109294891357},{""x"":0.6000000238418579,""y"":3.542433023452759},{""x"":1.100000023841858,""y"":3.7008674144744873},{""x"":1.600000023841858,""y"":3.717301607131958},{""x"":2.0999999046325684,""y"":4.024452209472656},{""x"":2.5999999046325684,""y"":4.013899326324463},{""x"":3.0999999046325684,""y"":3.945094347000122},{""x"":3.5999999046325684,""y"":3.866621971130371},{""x"":4.099999904632568,""y"":3.7461626529693604},{""x"":4.599999904632568,""y"":3.3454740047454834},{""x"":5.099999904632568,""y"":2.61944317817688},{""x"":5.599999904632568,""y"":0.999405026435852},{""x"":6.099999904632568,""y"":0.46259793639183044},{""x"":6.599999904632568,""y"":0.054134611040353775},{""x"":7.099999904632568,""y"":0.05711187422275543}]},{""name"":""Run:2023-08-08"",""fitLineColor"":""#ffbb78"",""pointColor"":""#ffbb78"",""showPoints"":""points"",""parameters"":[5.6318079657726035, 1.8495493770000595, 5.391793312471116, 0.17060707587348442],""points"":[{""x"":0.10000000149011612,""y"":5.458079814910889},{""x"":0.6000000238418579,""y"":5.554427146911621},{""x"":1.100000023841858,""y"":5.799983024597168},{""x"":1.600000023841858,""y"":5.364140033721924},{""x"":2.0999999046325684,""y"":5.864485740661621},{""x"":2.5999999046325684,""y"":5.4509806632995605},{""x"":3.0999999046325684,""y"":5.702574729919434},{""x"":3.5999999046325684,""y"":5.7314534187316895},{""x"":4.099999904632568,""y"":5.5123443603515625},{""x"":4.599999904632568,""y"":5.724395751953125},{""x"":5.099999904632568,""y"":4.354506969451904},{""x"":5.599999904632568,""y"":1.7307666540145874},{""x"":6.099999904632568,""y"":0.6305936574935913},{""x"":6.599999904632568,""y"":0.035183437168598175},{""x"":7.099999904632568,""y"":0.7575169205665588}]}],""chartOptions"":{""xAxisName"":""Conc."",""yAxisName"":""Activity"",""title"":""Dose-Response curves""}}",text,,\nSwitzerland,IRVVGRYLIEVWKAAGMDMDKVLFLWSSDEI,CN1CCC(CC1)Oc2ccc(cc2)C(F)(F)F,1480028,36.33137130737305,99504,92-11 179TH PLACE,https://datagrok.ai/img/slides/access-db-connect.png,id,ErrorMessage,"COMPND \nATOM \nEND",flag,9,10,1IAN,10,1.23,<chart></chart>,"{""series"":[{""name"":""Run:2023-08-08"",""fitFunction"":""sigmoid"",""fitLineColor"":""#1f77b4"",""pointColor"":""#1f77b4"",""showPoints"":""points"",""parameters"":[1.1190255865097471, 2.3163895161544437, 5.4968866182279195, 0.2035204047289052],""points"":[{""x"":0.10000000149011612,""y"":1.1057683229446411},{""x"":0.6000000238418579,""y"":1.1019697189331055},{""x"":1.100000023841858,""y"":1.0818607807159424},{""x"":1.600000023841858,""y"":1.062997817993164},{""x"":2.0999999046325684,""y"":1.046447515487671},{""x"":2.5999999046325684,""y"":1.1217249631881714},{""x"":3.0999999046325684,""y"":1.2166996002197266},{""x"":3.5999999046325684,""y"":1.215477705001831},{""x"":4.099999904632568,""y"":1.0581893920898438},{""x"":4.599999904632568,""y"":1.1747995615005493},{""x"":5.099999904632568,""y"":1.0181127786636353},{""x"":5.599999904632568,""y"":0.5344523191452026},{""x"":6.099999904632568,""y"":0.2569526433944702},{""x"":6.599999904632568,""y"":0.1912207305431366},{""x"":7.099999904632568,""y"":0.15060538053512573}]},{""name"":""Run:2023-08-08"",""fitLineColor"":""#ffbb78"",""pointColor"":""#ffbb78"",""showPoints"":""points"",""parameters"":[3.1038581025805785, 2.0032224204185245, 5.087602825989163, 0.13277988512492753],""points"":[{""x"":0.10000000149011612,""y"":3.0498509407043457},{""x"":0.6000000238418579,""y"":2.805217742919922},{""x"":1.100000023841858,""y"":3.3415253162384033},{""x"":1.600000023841858,""y"":3.0549843311309814},{""x"":2.0999999046325684,""y"":3.250074863433838},{""x"":2.5999999046325684,""y"":3.0432586669921875},{""x"":3.0999999046325684,""y"":3.265852451324463},{""x"":3.5999999046325684,""y"":2.9475724697113037},{""x"":4.099999904632568,""y"":3.1929898262023926},{""x"":4.599999904632568,""y"":2.7460060119628906},{""x"":5.099999904632568,""y"":1.6175861358642578},{""x"":5.599999904632568,""y"":0.3006608486175537},{""x"":6.099999904632568,""y"":0.3444803059101105},{""x"":6.599999904632568,""y"":0.015537971630692482},{""x"":7.099999904632568,""y"":0.5527358055114746}]}],""chartOptions"":{""xAxisName"":""Conc."",""yAxisName"":""Activity"",""title"":""Dose-Response curves""}}",text,,\n,,,,,,,,,,,,,,,,,,,,,').columns.add(i.Column.fromList(i.TYPE.BYTE_ARRAY,"BinaryImage",Array.from(new Uint8Array(11))));var r,s=function(e,t,n,i){return new(n||(n=Promise))((function(r,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};function o(e,t,n,i=0,r="timeout"){return s(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(l)}})),l=setTimeout((()=>{a.unsubscribe(),o(r)}),i);n()}))}))}function a(e){return s(this,void 0,void 0,(function*(){yield new Promise((t=>setTimeout(t,e)))}))}console.log.bind(console),console.info.bind(console),console.warn.bind(console),console.error.bind(console),function(e){e.notNull=function(e,t){if(null==e)throw new Error(`${null==t?"Value":t} not defined`)}}(r||(r={})),i.DataFrame.fromColumns([i.Column.fromStrings("col",["val1","val2","val3"])])},3629:(e,t,n)=>{"use strict";function i(e=!1,t="Assertion error."){if(!e)throw new Error(t)}function r(e){let t=0;for(let n=0;n<e.length;n++)t+=e[n]*e[n];return Math.sqrt(t)}function s(e,t){if(e.length!=t.length)throw new Error("The dimensionality of the vectors must match");let n=0;for(let i=0;i<e.length;i++)n+=e[i]*t[i];return n}function o(e,t){let n=0;const i=e.length;if(i!==t.length)throw new Error("The dimensionality of the vectors must match");for(let r=0;r<i;++r)n+=Math.pow(e[r]-t[r],2);return Math.sqrt(n)}function a(e){const t=e.length;let n=0,i=0;for(let r=0;r<t;++r)n+=e[r],i+=Math.pow(e[r],2);const r=n/t,s=1/Math.sqrt(i/t-Math.pow(r,2));for(let n=0;n<t;++n)e[n]=(e[n]-r)*s;return e}n.d(t,{KE:()=>s,S8:()=>a,ou:()=>o,vA:()=>i,wQ:()=>r})},1913:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(3282),r=n(9029),s=n(1520),o=n(2586),a=n(8708),l=n(2023),c="errorMessage",u=new i.Name("emUsed"),h={required:"missingProperty",dependencies:"property",dependentRequired:"property"},d=/\$\{[^}]+\}/,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:c,schemaType:["string","object"],post:!0,code(t){const{gen:n,data:f,schema:g,schemaValue:y,it:b}=t;if(!1===b.createErrors)return;const v=g,w=r.strConcat(l.default.instancePath,b.errorPath);function C(e,t){return r.and(i._`${e}.keyword !== ${c}`,i._`!${e}.${u}`,i._`${e}.instancePath === ${w}`,i._`${e}.keyword in ${t}`,i._`${e}.schemaPath.indexOf(${b.errSchemaPath}) === 0`,i._`/^\\/[^\\/]*$/.test(${e}.schemaPath.slice(${b.errSchemaPath.length}))`)}function A(e,t){const i=[];for(const n in e){const e=t[n];d.test(e)&&i.push([n,x(e)])}return n.object(...i)}function S(e){return d.test(e)?new s._Code(s.safeStringify(e).replace(p,((e,t)=>`" + JSON.stringify(${o.getData(t,b)}) + "`)).replace(m,"")):i.stringify(e)}function x(e){return i._`function(){return ${S(e)}}`}n.if(i._`${l.default.errors} > 0`,(()=>{if("object"==typeof v){const[s,o]=function(e){let t,n;for(const i in e){if("properties"===i||"items"===i)continue;const r=e[i];if("object"==typeof r){t||(t={});const e=t[i]={};for(const t in r)e[t]=[]}else n||(n={}),n[i]=[]}return[t,n]}(v);o&&function(r){const s=n.const("emErrors",i.stringify(r)),o=n.const("templates",A(r,g));n.forOf("err",l.default.vErrors,(e=>n.if(C(e,s),(()=>n.code(i._`${s}[${e}.keyword].push(${e})`).assign(i._`${e}.${u}`,!0)))));const{singleError:c}=e;if(c){const e=n.let("message",i._`""`),r=n.let("paramsErrors",i._`[]`);h((t=>{n.if(e,(()=>n.code(i._`${e} += ${"string"==typeof c?c:";"}`))),n.code(i._`${e} += ${d(t)}`),n.assign(r,i._`${r}.concat(${s}[${t}])`)})),a.reportError(t,{message:e,params:i._`{errors: ${r}}`})}else h((e=>a.reportError(t,{message:d(e),params:i._`{errors: ${s}[${e}]}`})));function h(e){n.forIn("key",s,(t=>n.if(i._`${s}[${t}].length`,(()=>e(t)))))}function d(e){return i._`${e} in ${o} ? ${o}[${e}]() : ${y}[${e}]`}}(o),s&&function(e){const r=n.const("emErrors",i.stringify(e)),s=[];for(const t in e)s.push([t,A(e[t],g[t])]);const o=n.const("templates",n.object(...s)),c=n.scopeValue("obj",{ref:h,code:i.stringify(h)}),d=n.let("emPropParams"),p=n.let("emParamsErrors");n.forOf("err",l.default.vErrors,(e=>n.if(C(e,r),(()=>{n.assign(d,i._`${c}[${e}.keyword]`),n.assign(p,i._`${r}[${e}.keyword][${e}.params[${d}]]`),n.if(p,(()=>n.code(i._`${p}.push(${e})`).assign(i._`${e}.${u}`,!0)))})))),n.forIn("key",r,(e=>n.forIn("keyProp",i._`${r}[${e}]`,(s=>{n.assign(p,i._`${r}[${e}][${s}]`),n.if(i._`${p}.length`,(()=>{const r=n.const("tmpl",i._`${o}[${e}] && ${o}[${e}][${s}]`);a.reportError(t,{message:i._`${r} ? ${r}() : ${y}[${e}][${s}]`,params:i._`{errors: ${p}}`})}))}))))}(s),function(e){const{props:s,items:o}=e;if(!s&&!o)return;const h=i._`typeof ${f} == "object"`,d=i._`Array.isArray(${f})`,p=n.let("emErrors");let m,b;const v=n.let("templates");function C(e,t){n.assign(p,i.stringify(e)),n.assign(v,A(e,t))}s&&o?(m=n.let("emChildKwd"),n.if(h),n.if(d,(()=>{C(o,g.items),n.assign(m,i.str`items`)}),(()=>{C(s,g.properties),n.assign(m,i.str`properties`)})),b=i._`[${m}]`):o?(n.if(d),C(o,g.items),b=i._`.items`):s&&(n.if(r.and(h,r.not(d))),C(s,g.properties),b=i._`.properties`),n.forOf("err",l.default.vErrors,(e=>function(e,t,s){n.if(r.and(i._`${e}.keyword !== ${c}`,i._`!${e}.${u}`,i._`${e}.instancePath.indexOf(${w}) === 0`),(()=>{const r=n.scopeValue("pattern",{ref:/^\/([^/]*)(?:\/|$)/,code:i._`new RegExp("^\\\/([^/]*)(?:\\\/|$)")`}),o=n.const("emMatches",i._`${r}.exec(${e}.instancePath.slice(${w}.length))`),a=n.const("emChild",i._`${o} && ${o}[1].replace(/~1/g, "/").replace(/~0/g, "~")`);n.if(i._`${a} !== undefined && ${a} in ${t}`,(()=>s(a)))}))}(e,p,(t=>n.code(i._`${p}[${t}].push(${e})`).assign(i._`${e}.${u}`,!0))))),n.forIn("key",p,(e=>n.if(i._`${p}[${e}].length`,(()=>{a.reportError(t,{message:i._`${e} in ${v} ? ${v}[${e}]() : ${y}${b}[${e}]`,params:i._`{errors: ${p}[${e}]}`}),n.assign(i._`${l.default.vErrors}[${l.default.errors}-1].instancePath`,i._`${w} + "/" + ${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}(v))}const s="string"==typeof v?v:v._;s&&function(e){const s=n.const("emErrs",i._`[]`);n.forOf("err",l.default.vErrors,(e=>n.if(function(e){return r.and(i._`${e}.keyword !== ${c}`,i._`!${e}.${u}`,r.or(i._`${e}.instancePath === ${w}`,r.and(i._`${e}.instancePath.indexOf(${w}) === 0`,i._`${e}.instancePath[${w}.length] === "/"`)),i._`${e}.schemaPath.indexOf(${b.errSchemaPath}) === 0`,i._`${e}.schemaPath[${b.errSchemaPath}.length] === "/"`)}(e),(()=>n.code(i._`${s}.push(${e})`).assign(i._`${e}.${u}`,!0))))),n.if(i._`${s}.length`,(()=>a.reportError(t,{message:S(e),params:i._`{errors: ${s}}`})))}(s),e.keepErrors||function(){const e=n.const("emErrs",i._`[]`);n.forOf("err",l.default.vErrors,(t=>n.if(i._`!${t}.${u}`,(()=>n.code(i._`${e}.push(${t})`))))),n.assign(l.default.vErrors,e).assign(l.default.errors,i._`${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 i=n(4042),r=n(6105),s=n(6653),o=n(9572),a="https://json-schema.org/draft/2020-12/schema";class l extends i.default{constructor(e={}){super({...e,dynamicRef:!0,next:!0,unevaluated:!0})}_addVocabularies(){super._addVocabularies(),r.default.forEach((e=>this.addVocabulary(e))),this.opts.discriminator&&this.addKeyword(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=l,e.exports=t=l,e.exports.Ajv2020=l,Object.defineProperty(t,"__esModule",{value:!0}),t.default=l;var c=n(2586);Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return c.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 h=n(3558);Object.defineProperty(t,"ValidationError",{enumerable:!0,get:function(){return h.default}});var d=n(4551);Object.defineProperty(t,"MissingRefError",{enumerable:!0,get:function(){return d.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 i=n(4042),r=n(6144),s=n(6653),o=n(2079),a=["/properties"],l="http://json-schema.org/draft-07/schema";class c extends i.default{_addVocabularies(){super._addVocabularies(),r.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,l,!1),this.refs["http://json-schema.org/schema"]=l}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(l)?l:void 0)}}t.Ajv=c,e.exports=t=c,e.exports.Ajv=c,Object.defineProperty(t,"__esModule",{value:!0}),t.default=c;var u=n(2586);Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return u.KeywordCxt}});var h=n(9029);Object.defineProperty(t,"_",{enumerable:!0,get:function(){return h._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return h.str}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return h.stringify}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return h.nil}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return h.Name}}),Object.defineProperty(t,"CodeGen",{enumerable:!0,get:function(){return h.CodeGen}});var d=n(3558);Object.defineProperty(t,"ValidationError",{enumerable:!0,get:function(){return d.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 i 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=i;class r extends n{constructor(e){super(),this._items="string"==typeof e?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;const e=this._items[0];return""===e||'""'===e}get str(){var e;return null!==(e=this._str)&&void 0!==e?e:this._str=this._items.reduce(((e,t)=>`${e}${t}`),"")}get names(){var e;return null!==(e=this._names)&&void 0!==e?e:this._names=this._items.reduce(((e,t)=>(t instanceof i&&(e[t.str]=(e[t.str]||0)+1),e)),{})}}function s(e,...t){const n=[e[0]];let i=0;for(;i<t.length;)l(n,t[i]),n.push(e[++i]);return new r(n)}t._Code=r,t.nil=new r(""),t._=s;const o=new r("+");function a(e,...t){const n=[u(e[0])];let i=0;for(;i<t.length;)n.push(o),l(n,t[i]),n.push(o,u(e[++i]));return function(e){let t=1;for(;t<e.length-1;){if(e[t]===o){const n=c(e[t-1],e[t+1]);if(void 0!==n){e.splice(t-1,3,n);continue}e[t++]="+"}t++}}(n),new r(n)}function l(e,t){var n;t instanceof r?e.push(...t._items):t instanceof i?e.push(t):e.push("number"==typeof(n=t)||"boolean"==typeof n||null===n?n:u(Array.isArray(n)?n.join(","):n))}function c(e,t){if('""'===t)return e;if('""'===e)return t;if("string"==typeof e){if(t instanceof i||'"'!==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 i?void 0:`"${e}${t.slice(1)}`}function u(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}t.str=a,t.addCodeArg=l,t.strConcat=function(e,t){return t.emptyStr()?e:e.emptyStr()?t:a`${e}${t}`},t.stringify=function(e){return new r(u(e))},t.safeStringify=u,t.getProperty=function(e){return"string"==typeof e&&t.IDENTIFIER.test(e)?new r(`.${e}`):s`[${e}]`},t.getEsmExportName=function(e){if("string"==typeof e&&t.IDENTIFIER.test(e))return new r(`${e}`);throw new Error(`CodeGen: invalid export name: ${e}, use explicit $id name mapping`)},t.regexpCode=function(e){return new r(e.toString())}},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 i=n(1520),r=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 i._Code(">"),GTE:new i._Code(">="),LT:new i._Code("<"),LTE:new i._Code("<="),EQ:new i._Code("==="),NEQ:new i._Code("!=="),NOT:new i._Code("!"),OR:new i._Code("||"),AND:new i._Code("&&"),ADD:new i._Code("+")};class a{optimizeNodes(){return this}optimizeNames(e,t){return this}}class l extends a{constructor(e,t,n){super(),this.varKind=e,this.name=t,this.rhs=n}render({es5:e,_n:t}){const n=e?r.varKinds.var:this.varKind,i=void 0===this.rhs?"":` = ${this.rhs}`;return`${n} ${this.name}${i};`+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 i._CodeOrName?this.rhs.names:{}}}class c extends a{constructor(e,t,n){super(),this.lhs=e,this.rhs=t,this.sideEffects=n}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,t){if(!(this.lhs instanceof i.Name)||e[this.lhs.str]||this.sideEffects)return this.rhs=N(this.rhs,e,t),this}get names(){return L(this.lhs instanceof i.Name?{}:{...this.lhs.names},this.rhs)}}class u extends c{constructor(e,t,n,i){super(e,n,i),this.op=t}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}}class h extends a{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}}class d extends a{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}}class 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 i._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 i=n.length;for(;i--;){const r=n[i];r.optimizeNames(e,t)||($(e,r.names),n.splice(i,1))}return n.length>0?this:void 0}get names(){return this.nodes.reduce(((e,t)=>I(e,t.names)),{})}}class g extends f{render(e){return"{"+e._n+super.render(e)+"}"+e._n}}class y extends f{}class b extends g{}b.kind="else";class v extends g{constructor(e,t){super(t),this.condition=e}render(e){let t=`if(${this.condition})`+super.render(e);return this.else&&(t+="else "+this.else.render(e)),t}optimizeNodes(){super.optimizeNodes();const e=this.condition;if(!0===e)return this.nodes;let t=this.else;if(t){const e=t.optimizeNodes();t=this.else=Array.isArray(e)?new b(e):e}return t?!1===e?t instanceof v?t:t.nodes:this.nodes.length?this:new v(P(e),t instanceof v?[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 L(e,this.condition),this.else&&I(e,this.else.names),e}}v.kind="if";class w extends g{}w.kind="for";class C extends w{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 I(super.names,this.iteration.names)}}class A extends w{constructor(e,t,n,i){super(),this.varKind=e,this.name=t,this.from=n,this.to=i}render(e){const t=e.es5?r.varKinds.var:this.varKind,{name:n,from:i,to:s}=this;return`for(${t} ${n}=${i}; ${n}<${s}; ${n}++)`+super.render(e)}get names(){const e=L(super.names,this.from);return L(e,this.to)}}class S extends w{constructor(e,t,n,i){super(),this.loop=e,this.varKind=t,this.name=n,this.iterable=i}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 I(super.names,this.iterable.names)}}class x 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)}}x.kind="func";class E extends f{render(e){return"return "+super.render(e)}}E.kind="return";class _ extends g{render(e){let t="try"+super.render(e);return this.catch&&(t+=this.catch.render(e)),this.finally&&(t+=this.finally.render(e)),t}optimizeNodes(){var e,t;return super.optimizeNodes(),null===(e=this.catch)||void 0===e||e.optimizeNodes(),null===(t=this.finally)||void 0===t||t.optimizeNodes(),this}optimizeNames(e,t){var n,i;return super.optimizeNames(e,t),null===(n=this.catch)||void 0===n||n.optimizeNames(e,t),null===(i=this.finally)||void 0===i||i.optimizeNames(e,t),this}get names(){const e=super.names;return this.catch&&I(e,this.catch.names),this.finally&&I(e,this.finally.names),e}}class M extends g{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}}M.kind="catch";class T extends g{render(e){return"finally"+super.render(e)}}function I(e,t){for(const n in t)e[n]=(e[n]||0)+(t[n]||0);return e}function L(e,t){return t instanceof i._CodeOrName?I(e,t.names):e}function N(e,t,n){return e instanceof i.Name?s(e):(r=e)instanceof i._Code&&r._items.some((e=>e instanceof i.Name&&1===t[e.str]&&void 0!==n[e.str]))?new i._Code(e._items.reduce(((e,t)=>(t instanceof i.Name&&(t=s(t)),t instanceof i._Code?e.push(...t._items):e.push(t),e)),[])):e;var r;function s(e){const i=n[e.str];return void 0===i||1!==t[e.str]?e:(delete t[e.str],i)}}function $(e,t){for(const n in t)e[n]=(e[n]||0)-(t[n]||0)}function P(e){return"boolean"==typeof e||"number"==typeof e||null===e?!e:i._`!${G(e)}`}T.kind="finally",t.CodeGen=class{constructor(e,t={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...t,_n:t.lines?"\n":""},this._extScope=e,this._scope=new r.Scope({parent:e}),this._nodes=[new y]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,t){const n=this._extScope.value(e,t);return(this._values[n.prefix]||(this._values[n.prefix]=new Set)).add(n),n}getScopeValue(e,t){return this._extScope.getValue(e,t)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,t,n,i){const r=this._scope.toName(t);return void 0!==n&&i&&(this._constants[r.str]=n),this._leafNode(new l(e,r,n)),r}const(e,t,n){return this._def(r.varKinds.const,e,t,n)}let(e,t,n){return this._def(r.varKinds.let,e,t,n)}var(e,t,n){return this._def(r.varKinds.var,e,t,n)}assign(e,t,n){return this._leafNode(new c(e,t,n))}add(e,n){return this._leafNode(new u(e,t.operators.ADD,n))}code(e){return"function"==typeof e?e():e!==i.nil&&this._leafNode(new m(e)),this}object(...e){const t=["{"];for(const[n,r]of e)t.length>1&&t.push(","),t.push(n),(n!==r||this.opts.es5)&&(t.push(":"),(0,i.addCodeArg)(t,r));return t.push("}"),new i._Code(t)}if(e,t,n){if(this._blockNode(new v(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 v(e))}else(){return this._elseNode(new b)}endIf(){return this._endBlockNode(v,b)}_for(e,t){return this._blockNode(e),t&&this.code(t).endFor(),this}for(e,t){return this._for(new C(e),t)}forRange(e,t,n,i,s=(this.opts.es5?r.varKinds.var:r.varKinds.let)){const o=this._scope.toName(e);return this._for(new A(s,o,t,n),(()=>i(o)))}forOf(e,t,n,s=r.varKinds.const){const o=this._scope.toName(e);if(this.opts.es5){const e=t instanceof i.Name?t:this.var("_arr",t);return this.forRange("_i",0,i._`${e}.length`,(t=>{this.var(o,i._`${e}[${t}]`),n(o)}))}return this._for(new S("of",s,o,t),(()=>n(o)))}forIn(e,t,n,s=(this.opts.es5?r.varKinds.var:r.varKinds.const)){if(this.opts.ownProperties)return this.forOf(e,i._`Object.keys(${t})`,n);const o=this._scope.toName(e);return this._for(new S("in",s,o,t),(()=>n(o)))}endFor(){return this._endBlockNode(w)}label(e){return this._leafNode(new h(e))}break(e){return this._leafNode(new d(e))}return(e){const t=new E;if(this._blockNode(t),this.code(e),1!==t.nodes.length)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(E)}try(e,t,n){if(!t&&!n)throw new Error('CodeGen: "try" without "catch" and "finally"');const i=new _;if(this._blockNode(i),this.code(e),t){const e=this.name("e");this._currNode=i.catch=new M(e),t(e)}return n&&(this._currNode=i.finally=new T,this.code(n)),this._endBlockNode(M,T)}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=i.nil,n,r){return this._blockNode(new x(e,t,n)),r&&this.code(r).endFunc(),this}endFunc(){return this._endBlockNode(x)}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 v))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=P;const O=k(t.operators.AND);t.and=function(...e){return e.reduce(O)};const R=k(t.operators.OR);function k(e){return(t,n)=>t===i.nil?n:n===i.nil?t:i._`${G(t)} ${e} ${G(n)}`}function G(e){return e instanceof i.Name?e:i._`(${e})`}t.or=function(...e){return e.reduce(R)}},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 i=n(1520);class r 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 i.Name("const"),let:new i.Name("let"),var:new i.Name("var")};class o{constructor({prefixes:e,parent:t}={}){this._names={},this._prefixes=e,this._parent=t}toName(e){return e instanceof i.Name?e:this.name(e)}name(e){return new i.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 i.Name{constructor(e,t){super(t),this.prefix=e}setValue(e,{property:t,itemIndex:n}){this.value=e,this.scopePath=i._`.${new i.Name(t)}[${n}]`}}t.ValueScopeName=a;const l=i._`\n`;t.ValueScope=class extends o{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?l:i.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 i=this.toName(e),{prefix:r}=i,s=null!==(n=t.key)&&void 0!==n?n:t.ref;let o=this._values[r];if(o){const e=o.get(s);if(e)return e}else o=this._values[r]=new Map;o.set(s,i);const a=this._scope[r]||(this._scope[r]=[]),l=a.length;return a[l]=t.ref,i.setValue(t,{property:r,itemIndex:l}),i}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 i._`${e}${t.scopePath}`}))}scopeCode(e=this._values,t,n){return this._reduceValues(e,(e=>{if(void 0===e.value)throw new Error(`CodeGen: name "${e}" has no value`);return e.value.code}),t,n)}_reduceValues(e,n,o={},a){let l=i.nil;for(const c in e){const u=e[c];if(!u)continue;const h=o[c]=o[c]||new Map;u.forEach((e=>{if(h.has(e))return;h.set(e,s.Started);let o=n(e);if(o){const n=this.opts.es5?t.varKinds.var:t.varKinds.const;l=i._`${l}${n} ${e} = ${o};${this.opts._n}`}else{if(!(o=null==a?void 0:a(e)))throw new r(e);l=i._`${l}${o}${this.opts._n}`}h.set(e,s.Completed)}))}return l}}},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 i=n(9029),r=n(4227),s=n(2023);function o(e,t){const n=e.const("err",t);e.if(i._`${s.default.vErrors} === null`,(()=>e.assign(s.default.vErrors,i._`[${n}]`)),i._`${s.default.vErrors}.push(${n})`),e.code(i._`${s.default.errors}++`)}function a(e,t){const{gen:n,validateName:r,schemaEnv:s}=e;s.$async?n.throw(i._`new ${e.ValidationError}(${t})`):(n.assign(i._`${r}.errors`,t),n.return(!1))}t.keywordError={message:({keyword:e})=>i.str`must pass "${e}" keyword validation`},t.keyword$DataError={message:({keyword:e,schemaType:t})=>t?i.str`"${e}" keyword must be ${t} ($data)`:i.str`"${e}" keyword is invalid ($data)`},t.reportError=function(e,n=t.keywordError,r,s){const{it:l}=e,{gen:u,compositeRule:h,allErrors:d}=l,p=c(e,n,r);(null!=s?s:h||d)?o(u,p):a(l,i._`[${p}]`)},t.reportExtraError=function(e,n=t.keywordError,i){const{it:r}=e,{gen:l,compositeRule:u,allErrors:h}=r;o(l,c(e,n,i)),u||h||a(r,s.default.vErrors)},t.resetErrorsCount=function(e,t){e.assign(s.default.errors,t),e.if(i._`${s.default.vErrors} !== null`,(()=>e.if(t,(()=>e.assign(i._`${s.default.vErrors}.length`,t)),(()=>e.assign(s.default.vErrors,null)))))},t.extendErrors=function({gen:e,keyword:t,schemaValue:n,data:r,errsCount:o,it:a}){if(void 0===o)throw new Error("ajv implementation error");const l=e.name("err");e.forRange("i",o,s.default.errors,(o=>{e.const(l,i._`${s.default.vErrors}[${o}]`),e.if(i._`${l}.instancePath === undefined`,(()=>e.assign(i._`${l}.instancePath`,(0,i.strConcat)(s.default.instancePath,a.errorPath)))),e.assign(i._`${l}.schemaPath`,i.str`${a.errSchemaPath}/${t}`),a.opts.verbose&&(e.assign(i._`${l}.schema`,n),e.assign(i._`${l}.data`,r))}))};const l={keyword:new i.Name("keyword"),schemaPath:new i.Name("schemaPath"),params:new i.Name("params"),propertyName:new i.Name("propertyName"),message:new i.Name("message"),schema:new i.Name("schema"),parentSchema:new i.Name("parentSchema")};function c(e,t,n){const{createErrors:r}=e.it;return!1===r?i._`{}`:function(e,t,n={}){const{gen:r,it:o}=e,a=[u(o,n),h(e,n)];return function(e,{params:t,message:n},r){const{keyword:o,data:a,schemaValue:c,it:u}=e,{opts:h,propertyName:d,topSchemaRef:p,schemaPath:m}=u;r.push([l.keyword,o],[l.params,"function"==typeof t?t(e):t||i._`{}`]),h.messages&&r.push([l.message,"function"==typeof n?n(e):n]),h.verbose&&r.push([l.schema,c],[l.parentSchema,i._`${p}${m}`],[s.default.data,a]),d&&r.push([l.propertyName,d])}(e,t,a),r.object(...a)}(e,t,n)}function u({errorPath:e},{instancePath:t}){const n=t?i.str`${e}${(0,r.getErrorPath)(t,r.Type.Str)}`:e;return[s.default.instancePath,(0,i.strConcat)(s.default.instancePath,n)]}function h({keyword:e,it:{errSchemaPath:t}},{schemaPath:n,parentSchema:s}){let o=s?t:i.str`${t}/${e}`;return n&&(o=i.str`${o}${(0,r.getErrorPath)(n,r.Type.Str)}`),[l.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 i=n(9029),r=n(3558),s=n(2023),o=n(6939),a=n(4227),l=n(2586);class c{constructor(e){var t;let n;this.refs={},this.dynamicAnchors={},"object"==typeof e.schema&&(n=e.schema),this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=null!==(t=e.baseId)&&void 0!==t?t:(0,o.normalizeId)(null==n?void 0:n[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=null==n?void 0:n.$async,this.refs={}}}function u(e){const t=d.call(this,e);if(t)return t;const n=(0,o.getFullPath)(this.opts.uriResolver,e.root.baseId),{es5:a,lines:c}=this.opts.code,{ownProperties:u}=this.opts,h=new i.CodeGen(this.scope,{es5:a,lines:c,ownProperties:u});let p;e.$async&&(p=h.scopeValue("Error",{ref:r.default,code:i._`require("ajv/dist/runtime/validation_error").default`}));const m=h.scopeName("validate");e.validateName=m;const f={gen:h,allErrors:this.opts.allErrors,data:s.default.data,parentData:s.default.parentData,parentDataProperty:s.default.parentDataProperty,dataNames:[s.default.data],dataPathArr:[i.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:h.scopeValue("schema",!0===this.opts.code.source?{ref:e.schema,code:(0,i.stringify)(e.schema)}:{ref:e.schema}),validateName:m,ValidationError:p,schema:e.schema,schemaEnv:e,rootId:n,baseId:e.baseId||n,schemaPath:i.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:i._`""`,opts:this.opts,self:this};let g;try{this._compilations.add(e),(0,l.validateFunctionCode)(f),h.optimize(this.opts.code.optimize);const t=h.toString();g=`${h.scopeRefs(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:h._values}),this.opts.unevaluated){const{props:e,items:t}=f;n.evaluated={props:e instanceof i.Name?void 0:e,items:t instanceof i.Name?void 0:t,dynamicProps:e instanceof i.Name,dynamicItems:t instanceof i.Name},n.source&&(n.source.evaluated=(0,i.stringify)(n.evaluated))}return e.validate=n,e}catch(t){throw delete e.validate,delete e.validateName,g&&this.logger.error("Error compiling schema, function code:",g),t}finally{this._compilations.delete(e)}}function h(e){return(0,o.inlineRef)(e.schema,this.opts.inlineRefs)?e.schema:e.validate?e:u.call(this,e)}function d(e){for(const i of this._compilations)if(n=e,(t=i).schema===n.schema&&t.root===n.root&&t.baseId===n.baseId)return i;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),i=(0,o._getFullPath)(this.opts.uriResolver,n);let r=(0,o.getFullPath)(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&i===r)return g.call(this,n,e);const s=(0,o.normalizeId)(i),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,i=t[n];return i&&(r=(0,o.resolveUrl)(this.opts.uriResolver,r,i)),new c({schema:t,schemaId:n,root:e,baseId:r})}return g.call(this,n,a)}}t.SchemaEnv=c,t.compileSchema=u,t.resolveRef=function(e,t,n){var i;n=(0,o.resolveUrl)(this.opts.uriResolver,t,n);const r=e.refs[n];if(r)return r;let s=p.call(this,e,n);if(void 0===s){const r=null===(i=e.localRefs)||void 0===i?void 0:i[n],{schemaId:o}=this.opts;r&&(s=new c({schema:r,schemaId:o,root:e,baseId:t}))}return void 0!==s?e.refs[n]=h.call(this,s):void 0},t.getCompilingSchema=d,t.resolveSchema=m;const f=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function g(e,{baseId:t,schema:n,root:i}){var r;if("/"!==(null===(r=e.fragment)||void 0===r?void 0:r[0]))return;for(const i of e.fragment.slice(1).split("/")){if("boolean"==typeof n)return;const e=n[(0,a.unescapeFragment)(i)];if(void 0===e)return;const r="object"==typeof(n=e)&&n[this.opts.schemaId];!f.has(i)&&r&&(t=(0,o.resolveUrl)(this.opts.uriResolver,t,r))}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,i,e)}const{schemaId:l}=this.opts;return s=s||new c({schema:n,schemaId:l,root:i,baseId:t}),s.schema!==s.root.schema?s:void 0}},2023:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(9029),r={data:new i.Name("data"),valCxt:new i.Name("valCxt"),instancePath:new i.Name("instancePath"),parentData:new i.Name("parentData"),parentDataProperty:new i.Name("parentDataProperty"),rootData:new i.Name("rootData"),dynamicAnchors:new i.Name("dynamicAnchors"),vErrors:new i.Name("vErrors"),errors:new i.Name("errors"),this:new i.Name("this"),self:new i.Name("self"),scope:new i.Name("scope"),json:new i.Name("json"),jsonPos:new i.Name("jsonPos"),jsonLen:new i.Name("jsonLen"),jsonPart:new i.Name("jsonPart")};t.default=r},4551:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(6939);class r extends Error{constructor(e,t,n,r){super(r||`can't resolve reference ${n} from id ${t}`),this.missingRef=(0,i.resolveUrl)(e,t,n),this.missingSchema=(0,i.normalizeId)((0,i.getFullPath)(e,this.missingRef))}}t.default=r},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 i=n(4227),r=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?!l(e):!!t&&c(e)<=t)};const a=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function l(e){for(const t in e){if(a.has(t))return!0;const n=e[t];if(Array.isArray(n)&&n.some(l))return!0;if("object"==typeof n&&l(n))return!0}return!1}function c(e){let t=0;for(const n in e){if("$ref"===n)return 1/0;if(t++,!o.has(n)&&("object"==typeof e[n]&&(0,i.eachItem)(e[n],(e=>t+=c(e))),t===1/0))return 1/0}return t}function u(e,t="",n){!1!==n&&(t=p(t));const i=e.parse(t);return h(e,i)}function h(e,t){return e.serialize(t).split("#")[0]+"#"}t.getFullPath=u,t._getFullPath=h;const d=/#\/?$/;function p(e){return e?e.replace(d,""):""}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:i}=this.opts,o=p(e[n]||t),a={"":o},l=u(i,o,!1),c={},h=new Set;return s(e,{allKeys:!0},((e,t,i,r)=>{if(void 0===r)return;const s=l+t;let o=a[r];function u(t){const n=this.opts.uriResolver.resolve;if(t=p(o?n(o,t):t),h.has(t))throw f(t);h.add(t);let i=this.refs[t];return"string"==typeof i&&(i=this.refs[i]),"object"==typeof i?d(e,i.schema,t):t!==p(s)&&("#"===t[0]?(d(e,c[t],t),c[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})),c;function d(e,t,n){if(void 0!==t&&!r(e,t))throw f(n)}function f(e){return new Error(`reference "${e}" resolves to more than one schema`)}}},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 i=n(9029),r=n(1520);function s(e,t=e.schema){const{opts:n,self:i}=e;if(!n.strictSchema)return;if("boolean"==typeof t)return;const r=i.RULES.keywords;for(const n in t)r[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 l(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function c({mergeNames:e,mergeToName:t,mergeValues:n,resultToName:r}){return(s,o,a,l)=>{const c=void 0===a?o:a instanceof i.Name?(o instanceof i.Name?e(s,o,a):t(s,o,a),a):o instanceof i.Name?(t(s,a,o),o):n(o,a);return l!==i.Name||c instanceof i.Name?c:r(s,c)}}function u(e,t){if(!0===t)return e.var("props",!0);const n=e.var("props",i._`{}`);return void 0!==t&&h(e,n,t),n}function h(e,t,n){Object.keys(n).forEach((n=>e.assign(i._`${t}${(0,i.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,r,s){if(!s){if("number"==typeof n||"boolean"==typeof n)return n;if("string"==typeof n)return i._`${n}`}return i._`${e}${t}${(0,i.getProperty)(r)}`},t.unescapeFragment=function(e){return l(decodeURIComponent(e))},t.escapeFragment=function(e){return encodeURIComponent(a(e))},t.escapeJsonPointer=a,t.unescapeJsonPointer=l,t.eachItem=function(e,t){if(Array.isArray(e))for(const n of e)t(n);else t(e)},t.mergeEvaluated={props:c({mergeNames:(e,t,n)=>e.if(i._`${n} !== true && ${t} !== undefined`,(()=>{e.if(i._`${t} === true`,(()=>e.assign(n,!0)),(()=>e.assign(n,i._`${n} || {}`).code(i._`Object.assign(${n}, ${t})`)))})),mergeToName:(e,t,n)=>e.if(i._`${n} !== true`,(()=>{!0===t?e.assign(n,!0):(e.assign(n,i._`${n} || {}`),h(e,n,t))})),mergeValues:(e,t)=>!0===e||{...e,...t},resultToName:u}),items:c({mergeNames:(e,t,n)=>e.if(i._`${n} !== true && ${t} !== undefined`,(()=>e.assign(n,i._`${t} === true ? true : ${n} > ${t} ? ${n} : ${t}`))),mergeToName:(e,t,n)=>e.if(i._`${n} !== true`,(()=>e.assign(n,!0===t||i._`${n} > ${t} ? ${n} : ${t}`))),mergeValues:(e,t)=>!0===e||Math.max(e,t),resultToName:(e,t)=>e.var("items",t)})},t.evaluatedPropsToName=u,t.setEvaluated=h;const d={};var 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:d[t.code]||(d[t.code]=new r._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 i.Name){const r=t===p.Num;return n?r?i._`"[" + ${e} + "]"`:i._`"['" + ${e} + "']"`:r?i._`"/" + ${e}`:i._`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return n?(0,i.getProperty)(e).toString():"/"+a(e)},t.checkStrictMode=m},7887:(e,t)=>{"use strict";function n(e,t){return t.rules.some((t=>i(e,t)))}function i(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},i){const r=t.RULES.types[i];return r&&!0!==r&&n(e,r)},t.shouldUseGroup=n,t.shouldUseRule=i},8727:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.boolOrEmptySchema=t.topBoolOrEmptySchema=void 0;const i=n(8708),r=n(9029),s=n(2023),o={message:"boolean schema is false"};function a(e,t){const{gen:n,data:r}=e,s={gen:n,keyword:"false schema",data:r,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e};(0,i.reportError)(s,o,void 0,t)}t.topBoolOrEmptySchema=function(e){const{gen:t,schema:n,validateName:i}=e;!1===n?a(e,!1):"object"==typeof n&&!0===n.$async?t.return(s.default.data):(t.assign(r._`${i}.errors`,null),t.return(!0))},t.boolOrEmptySchema=function(e,t){const{gen:n,schema:i}=e;!1===i?(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 i=n(396),r=n(7887),s=n(8708),o=n(9029),a=n(4227);var l;function c(e){const t=Array.isArray(e)?e:e?[e]:[];if(t.every(i.isJSONType))return t;throw new Error("type must be JSONType or JSONType[]: "+t.join(","))}!function(e){e[e.Correct=0]="Correct",e[e.Wrong=1]="Wrong"}(l||(t.DataType=l={})),t.getSchemaTypes=function(e){const t=c(e.type);if(t.includes("null")){if(!1===e.nullable)throw new Error("type: null contradicts nullable: false")}else{if(!t.length&&void 0!==e.nullable)throw new Error('"nullable" cannot be used without "type"');!0===e.nullable&&t.push("null")}return t},t.getJSONTypes=c,t.coerceAndCheckDataType=function(e,t){const{gen:n,data:i,opts:s}=e,a=function(e,t){return t?e.filter((e=>u.has(e)||"array"===t&&"array"===e)):[]}(t,s.coerceTypes),c=t.length>0&&!(0===a.length&&1===t.length&&(0,r.schemaHasRulesForType)(e,t[0]));if(c){const r=d(t,i,s.strictNumbers,l.Wrong);n.if(r,(()=>{a.length?function(e,t,n){const{gen:i,data:r,opts:s}=e,a=i.let("dataType",o._`typeof ${r}`),l=i.let("coerced",o._`undefined`);"array"===s.coerceTypes&&i.if(o._`${a} == 'object' && Array.isArray(${r}) && ${r}.length == 1`,(()=>i.assign(r,o._`${r}[0]`).assign(a,o._`typeof ${r}`).if(d(t,r,s.strictNumbers),(()=>i.assign(l,r))))),i.if(o._`${l} !== undefined`);for(const e of n)(u.has(e)||"array"===e&&"array"===s.coerceTypes)&&c(e);function c(e){switch(e){case"string":return void i.elseIf(o._`${a} == "number" || ${a} == "boolean"`).assign(l,o._`"" + ${r}`).elseIf(o._`${r} === null`).assign(l,o._`""`);case"number":return void i.elseIf(o._`${a} == "boolean" || ${r} === null
1
+ var bio;(()=>{var e={8924:(e,t,n)=>{"use strict";n.d(t,{X:()=>r});var i=n(7362);class r extends i.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,r)),this.lesk}static get GrokGroups(){return void 0===this.grokGroups&&(this.grokGroups=this.makePalette([[["C","U"],"yellow"],[["G","P"],"red"],[["A","V","I","L","M","F","Y","W"],"all_green"],[["R","H","K"],"light_blue"],[["D","E"],"dark_blue"],[["S","T","N","Q"],"orange"]],!1,r)),this.grokGroups}static get RasMol(){return void 0===this.rasMol&&(this.rasMol=new r({D:"#E60A0A",E:"#E60A0A",C:"#E6E600",M:"#E6E600",K:"#145AFF",R:"#145AFF",S:"#FA9600",T:"#FA9600",F:"#3232AA",Y:"#3232AA",N:"#00DCDC",Q:"#00DCDC",G:"#EBEBEB",L:"#0F820F",V:"#0F820F",I:"#0F820F",A:"#C8C8C8",W:"#B45AB4",H:"#8282D2",P:"#DC9682",others:"#BEA06E"})),this.rasMol}get(e){const t=e in r.aaSynonyms?r.aaSynonyms[e]:e;return super.get(t)}}r.aaSynonyms={MeNle:"L",MeA:"A",MeG:"G",MeF:"F"};class s{static getPalette(e="grok"){switch(e){case"grok":return r.GrokGroups;case"lesk":return r.Lesk;default:throw new Error(`ChemPalette: scheme \`${e}\` does not exist`)}}static getInnerOuter(e){let t=0,n="",i="";for(const r of e)"("==r?t++:")"==r?t--:t?n+=r:i+=r;return isNaN(parseInt(n))?[i,n]:[i,""]}static getColorAAPivot(e="",t="grok"){const n=this.getPalette(t);let[i,r]=this.getInnerOuter(e);if(i=i.length>6?`${i.slice(0,3)}...`:i,r=r.length>6?`${r.slice(0,3)}...`:r,1==e.length||"("==e[1]){const t=e[0]?.toUpperCase();return t in n?[n.get(t),t,r,1]:[this.undefinedColor,i,r,1]}if("d"==e[0]&&e[1]in n&&(2==e.length||"("==e[2])){const t=e[1]?.toUpperCase();return t in n?[n.get(t),t,r,2]:[this.undefinedColor,i,r,2]}if(e.substring(0,3)in this.AAFullNames&&(3==e.length||"("==e[3])){const t=this.AAFullNames[e.substring(0,3)];return t in n?[n.get(t),t,r,3]:[this.undefinedColor,i,r,3]}if(e[0]?.toLowerCase()==e[0]&&e.substring(1,3)in this.AAFullNames&&(4==e.length||"("==e[4])){const t=this.AAFullNames[e.substring(1,3)];return t in n?[n.get(t),t,r,4]:[this.undefinedColor,i,r,4]}return[this.undefinedColor,i,r,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"}},9124:(e,t,n)=>{"use strict";n.d(t,{b:()=>s});var i=n(7389),r=n(6082);async function s(){const e="Helm",t=r.Func.find({package:e,name:"getHelmHelper"});if(0===t.length)throw new Error(`Package '${e}' must be installed for HelmHelper.`);return(await t[0].prepare().call()).getOutputParamValue()}r.JsInputBase,i.input.helmAsync=async function(e,t){return(await s()).createHelmInput(e,t)}},4356:(e,t,n)=>{"use strict";n.d(t,{Es:()=>o,Eu:()=>c,so:()=>s,ub:()=>l});var i=n(4328);const r="Libraries",s="System:AppData/Bio/monomer-libraries/",o="System:AppData/Bio/monomer-sets/";let a=Promise.resolve();async function l(){let e;return a=a.then((async()=>{const t=await i.dapi.userDataStorage.getValue(r,"Settings",!0);e=t?JSON.parse(t):{exclude:[],explicit:[]},e.exclude=e.exclude instanceof Array?e.exclude:[],e.explicit=e.explicit instanceof Array?e.explicit:[],console.debug(`Bio: getUserLibSettings()\n${JSON.stringify(e,void 0,2)}`)})),await a,e}async function c(e){a=a.then((async()=>{console.debug(`Bio: setUserLibSettings()\n${JSON.stringify(e,void 0,2)}`),await i.dapi.userDataStorage.postValue(r,"Settings",JSON.stringify(e),!0)})),await a}},6718:(e,t,n)=>{"use strict";n.d(t,{A7:()=>p,pj:()=>u,uL:()=>h,uX:()=>c});var i=n(6082),r=n(4328),s=n(6295),o=n(3151),a=n(2738),l=(n(826),n(3077));function c(e){const t=[];for(let n=0;n<e.rowCount;n++){const i={};Object.keys(o.Ec).forEach((t=>{if("symbol"===t){const r=e.get(o.Ec[t],n);i[t]="."===r?e.get(o.yw,n):r}else if("rgroups"===t){const r=e.get(o.Ec[t],n).split("\n"),s=[];r.forEach((e=>{const t={},n=e.substring(e.lastIndexOf("]")+1),i=e.match(/\[R(\d+)\]/)[1];t.capGroupSmiles="H"===n?`[*:${i}][H]`:`O[*:${i}]`,t.alternateId="H"===n?`R${i}-H`:`R${i}-OH`,t.capGroupName="H"===n?"H":"OH",t.label=`R${i}`,s.push(t)})),i[t]=s}else o.Ec[t]&&(i[t]=e.get(o.Ec[t],n))})),i.author??(i.author=""),i.id??(i.id=0),i.smiles??(i.smiles=""),i.monomerType??(i.monomerType="Backbone"),i.createDate??(i.createDate=null),t.push(i)}return t}async function u(){const e=i.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 h(e,t){e instanceof i.Column&&(e=(0,l.R)(e).columns.toList());const n=(await u()).getMonomerLib(),s=new Array(e.length),o=e[0].length,c=new Float32Array(o);for(let l=0;l<e.length;++l){const u=l<t.length?t.getCanonical(l):a._S,h=n.getMonomer("PEPTIDE",u)?.smiles??"",d=e[l],p=d.getRawData(),m=d.categories,f=m.indexOf("");if(s[l]={categories:m,data:p,emptyIndex:f},void 0===u)continue;const g=i.Column.fromStrings("smiles",m.map((e=>n.getMonomer("PEPTIDE",e)?.smiles??""))),y=(i.DataFrame.fromColumns([g]),await r.chem.getSimilarities(g,h)),b=y?y.getRawData():null;for(let e=0;e<o;++e){const t=p[e];u!==a._S&&t!==f?c[e]+=b[t]:u===a._S&&t===f&&(c[e]+=1)}}for(let n=0;n<c.length;++n){let r=c[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){r=i.FLOAT_NULL;break}}c[n]=r}return i.Column.fromFloat32Array("Similarity",c)}async function d(e){const t=(await u()).getMonomerLib(),n=[],s={},o=e.map((e=>t.getMonomer("PEPTIDE",e)?.smiles??"")),a=i.Column.fromStrings("smiles",o);for(let t=0;t<o.length;++t){s[e[t]]=t;const i=o[t],l=""===i?new Array(o.length).fill(0):(await r.chem.getSimilarities(a,i)).getRawData();l[t]=1,n[t]=Array.from(l)}return{scoringMatrix:n,alphabetIndexes:s}}async function p(e,t="Morgan"){const n=(await u()).getMonomerLib(),r=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=i.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 d(e);const c=i.Column.fromStrings("smiles",a),h=(i.DataFrame.fromColumns([c]),(await l.apply({col:c,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 d(e);for(let t=0;t<h.length;++t)if(r[t][t]=1,o[e[t]]=t,h[t])for(let e=t+1;e<h.length;++e)h[e]&&(r[t][e]=r[e][t]=(0,s.$1)(h[t],h[e]));return{scoringMatrix:r,alphabetIndexes:o}}},7384:(e,t,n)=>{"use strict";n.d(t,{C4:()=>d});var i=n(4328),r=n(6082),s=n(1991),o=n.n(s),a=n(439),l=n(826);const c={V2K_RGP_SHIFT:8,V2K_RGP_LINE:"M RGP",V2K_A_LINE:"A ",V3K_COUNTS_SHIFT:14,V3K_IDX_SHIFT:7,V3K_HEADER_FIRST_LINE:"\nDatagrok macromolecule handler\n\n",V3K_HEADER_SECOND_LINE:" 0 0 0 0 0 0 999 V3000\n",V3K_BEGIN_CTAB_BLOCK:"M V30 BEGIN CTAB\n",V3K_END_CTAB_BLOCK:"M V30 END CTAB\n",V3K_BEGIN_COUNTS_LINE:"M V30 COUNTS ",V3K_COUNTS_LINE_ENDING:" 0 0 0\n",V3K_BEGIN_ATOM_BLOCK:"M V30 BEGIN ATOM\n",V3K_END_ATOM_BLOCK:"M V30 END ATOM\n",V3K_BEGIN_BOND_BLOCK:"M V30 BEGIN BOND\n",V3K_END_BOND_BLOCK:"M V30 END BOND\n",V3K_BOND_CONFIG:" CFG=",V3K_BEGIN_DATA_LINE:"M V30 ",V3K_END:"M END",PRECISION_FACTOR:1e4,DEOXYRIBOSE:"d",RIBOSE:"r",PHOSPHATE:"p",OXYGEN:"O",HYDROGEN:"H"};var u=n(3151);function h(e){return Math.round(c.PRECISION_FACTOR*e)/c.PRECISION_FACTOR}async function d(e,t,s){if(0===r.Func.find({package:"Chem",name:"getRdKitModule"}).length)return{col:null,warnings:['Transformation to atomic level requires the package "Chem" installed.']};if(t.semType!==r.SEMTYPE.MACROMOLECULE)return{col:null,warnings:[`Only the ${r.SEMTYPE.MACROMOLECULE} columns can be converted to atomic level, the chosen column has semType '${t.semType}'`]};let h=t;const d=l.GO.forColumn(t);d.isHelm()&&(h=d.convert(a.Hi.SEPARATOR,"."),h.name=t.name);const m=l.GO.forColumn(h).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 '${h.name}' alphabet '${m}'.`]};f="RNA"}const g=function(e){const t=e.length,n=new Array(t),r=l.GO.forColumn(e);let s=!1;for(let e=0;e<t;++e){const t=r.getSplitted(e);s||(s=0===t.length),n[e]=o()(t.canonicals).filter((e=>!r.isGap(e))).map((e=>e)).toArray()}return s&&i.shell.warning(`Some values in the "${e.name}" column are empty`),n}(h),y=await async function(e,t,n,r){const s=function(e,t,n){const i=new Map;for(const r of e.getMonomerSymbolsByType(t)){const s=e.getMonomer(t,r);if("RNA"===t&&("Branch"===s.monomerType||n===a.YI.DNA&&s.symbol===c.DEOXYRIBOSE||n===a.YI.RNA&&s.symbol===c.RIBOSE||s.symbol===c.PHOSPHATE)||"PEPTIDE"===t&&"Branch"!==s.monomerType){const e={};u.f6.forEach((t=>{e[t]=s[t]})),i.set(s.symbol,e)}}return i}(t,n,r),o=new Map,l=await i.functions.call("Chem:getRdKitModule"),h={value:null};if("RNA"===n){const e=r===a.YI.RNA?[c.RIBOSE,c.PHOSPHATE]:[c.DEOXYRIBOSE,c.PHOSPHATE];for(const t of e)p(o,t,s,l,n,h)}for(let t=0;t<e.length;++t){const i=e[t];for(const e of i)if(""!==e)try{p(o,e,s,l,n,h)}catch(t){const n=t instanceof Error?t.message:t.toString(),i=t instanceof Error?t.stack:void 0;throw console.error(`bio lib: getMonomersDictFromLib() sym='${e}', error:\n${n}\n${i}`),new Error(`Can't get monomer '${e}' from library: ${n}`)}}return o}(g,s,f,m),b=h.length,{molfileList:v,molfileWarningList:w}=await async function(e,t,i,r,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)))),l=s/o;let c=[],u=[];const h=new Array(o);for(let n=0;n<o;n++){const c=Math.floor(n*l),u=n===o-1?s:Math.floor((n+1)*l);a[n].postMessage({monomerSequencesArray:e,monomersDict:t,alphabet:i,polymerType:r,start:c,end:u}),h[n]=new Promise((e=>{a[n].onmessage=({data:{molfileList:t,molfileWarningList:n}})=>{e({molfileList:t,molfileWarningList:n})}}))}return(await Promise.all(h)).forEach((e=>{c=c.concat(...e.molfileList),u=u.concat(...e.molfileWarningList)})),setTimeout((()=>{a.forEach((e=>{e.terminate()}))}),0),{molfileList:c,molfileWarningList:u}}(g,y,m,f,b);if(w.length>.05*b)throw new Error("Too many errors getting molfiles.");const C=`molfile(${h.name})`,A=e.columns.getUnusedName(C),S=r.Column.fromStrings(A,v);return S.semType=r.SEMTYPE.MOLECULE,S.meta.units=r.UNITS.Molecule.MOLBLOCK,{col:S,warnings:w}}function p(e,t,n,i,r,s){if(!e.has(t)){const o=function(e,t,n,i,r){if(t.has(e)){const o=t.get(e),a=function(e){const t=[];for(const n of e){let e=n.capGroupSmiles;e||(e=n.capGroupSMILES),e=e.replace(/(\[|\]|\*|:|\d)/g,""),t.push(e)}return t}(o.rgroups),l=(s=o.molfile).includes("V3000")?function(e){const t=new Map,n=/M V30 (\d+) R#.+RGROUPS=\((\d+) (\d+)\).*/gm;let i;for(;null!==(i=n.exec(e));)i.index===n.lastIndex&&n.lastIndex++,t.set(parseInt(i[1]),parseInt(i[3]));return t}(s):function(e){const t=new Map;let n=e.indexOf(c.V2K_A_LINE,0),i=n;for(;-1!==n;){i=e.indexOf("\n",n);const r=parseInt(e.substring(n,i).replace(/^A\s+/,""));n=e.indexOf("R",i),i=e.indexOf("\n",n);const s=parseInt(e.substring(n,i).replace(/^R/,""));t.set(r,s),n=e.indexOf(c.V2K_A_LINE,i)}for(n=e.indexOf(c.V2K_RGP_LINE,0),i=e.indexOf("\n",n);-1!==n;){n+=c.V2K_RGP_SHIFT,i=e.indexOf("\n",n);const r=e.substring(n,i).replaceAll(/\s+/g," ").split(" ").map((e=>parseInt(e))).slice(1);for(let e=0;e<r.length;e+=2){if(t.has(r[e])&&t.get(r[e])!==r[e+1])throw new Error(`r-group index ${r[e]} has already been added with a different value`);t.set(r[e],r[e+1])}n=e.indexOf(c.V2K_RGP_LINE,i)}return t}(s),u=o.molfile.includes("V3000")?o.molfile:function(e,t){const n=t.get_mol(e),i=n.get_v3Kmolblock();return n.delete(),i}(function(e){let t=e.indexOf(c.V2K_A_LINE,0);-1===t&&(t=e.indexOf(c.V2K_RGP_LINE));const n=e.indexOf(c.V3K_END,t);return e.substring(0,t)+e.substring(n)}(o.molfile),n),d=function(e){let t=(e=e.replaceAll("\r","")).indexOf(c.V3K_BEGIN_COUNTS_LINE)+c.V3K_COUNTS_SHIFT,n=e.indexOf(" ",t+1);const i=parseInt(e.substring(t,n));return t=n+1,n=e.indexOf(" ",t+1),{atomCount:i,bondCount:parseInt(e.substring(t,n))}}(u),p=function(e,t){const n=new Array(t),i=new Float32Array(t),r=new Float32Array(t),s=new Array(t);let o=e.indexOf(c.V3K_BEGIN_ATOM_BLOCK);o=e.indexOf("\n",o);let a=o;for(let l=0;l<t;l++){o=e.indexOf(c.V3K_BEGIN_DATA_LINE,o)+c.V3K_IDX_SHIFT,a=e.indexOf(" ",o),o=a+1,a=e.indexOf(" ",o),n[l]=e.substring(o,a);const t=new Array(2);for(let n=0;n<2;++n)o=a+1,a=e.indexOf(" ",o),t[n]=parseFloat(e.substring(o,a));i[l]=t[0],r[l]=t[1],o=a,a=e.indexOf("\n",o)+1,s[l]=e.slice(o,a),o=a}return{atomTypes:n,x:i,y:r,kwargs:s}}(u,d.atomCount),g=function(e,t){const n=new Uint32Array(t),i=new Array(t),r=new Map,s=new Map;let o=e.indexOf(c.V3K_BEGIN_BOND_BLOCK);o=e.indexOf("\n",o);let a=o;for(let l=0;l<t;++l){const t=new Array(3);o=e.indexOf(c.V3K_BEGIN_DATA_LINE,a)+c.V3K_IDX_SHIFT,a=e.indexOf(" ",o);for(let n=0;n<3;++n)o=a+1,a=Math.min(e.indexOf("\n",o),e.indexOf(" ",o)),t[n]=parseInt(e.slice(o,a));n[l]=t[0],i[l]=t.slice(1);const u=e.indexOf("\n",o);let h=e.slice(a,u),d=h.indexOf(c.V3K_BOND_CONFIG);if(-1!==d){d=h.indexOf("=",d)+1;let e=h.indexOf(" ",d);-1===e&&(e=h.length);const t=parseInt(h.slice(d,e));r.set(l,t);const n=c.V3K_BOND_CONFIG+t.toString();h=h.replace(n,"")}h||s.set(l,h)}return{bondTypes:n,atomPairs:i,bondConfiguration:r,kwargs:s}}(u,d.bondCount),b=function(e,t,n,i){const r={backboneShift:null,branchShift:null,terminalNodes:[],rNodes:[]};return function(e,t,n){for(const[i,r]of n)e.atomTypes[i-1]=t[r-1]}(e,n,i),function(e,t){t.rNodes=Array.from(e.keys());for(let n=0;n<t.rNodes.length;n++)for(const i of[1,2])if(e.get(t.rNodes[n])===i){const e=t.rNodes[i-1];t.rNodes[i-1]=t.rNodes[n],t.rNodes[n]=e}}(i,r),m(t,r),r}(p,g,a,l),S=function(e){let t=[],n=e.indexOf("M V30 MDLV30/STEABS ATOMS=(");for(;-1!==n;){n+=28;const i=e.indexOf(")",n);t=t.concat(e.substring(n,i).split(" ").slice(1).map((e=>parseInt(e)))),n=i,n=e.indexOf("M V30 MDLV30/STEABS ATOMS=(",n)}return t}(u),x={atoms:p,bonds:g,meta:b,stereoAtoms:S};return"PEPTIDE"===i?function(e){const t=e.meta.terminalNodes[0]-1,n=e.meta.rNodes[0]-1,i=e.atoms.x,r=e.atoms.y;A(e,-i[t],-r[t]);const s=v(i[n],r[n]);w(e.atoms,-s),i[e.meta.rNodes[1]-1]<0&&function(e){C(e,!1)}(e);const o=function(e){const t=function(e){const t=new Map;for(const n of e.bonds.atomPairs)for(let e=0;e<2;e++){const i=n[e],r=n[(e+1)%2];t.has(i)?t.get(i)?.push(r):t.set(i,new Array(1).fill(r))}return t}(e);let n=0;const i=e.atoms.atomTypes.length;let r=0;for(;0===n;){const s=t.get(e.meta.terminalNodes[1])[r];if(e.atoms.atomTypes[s-1]===c.OXYGEN&&s!==e.meta.rNodes[1]&&(n=s),r++,r>i)throw new Error(`Search for double-bonded Oxygen in ${e} has exceeded the limit of ${i}`)}return n}(e);!function(e,t){e.atoms.y[e.meta.rNodes[1]-1]<0&&e.atoms.y[t-1]<0&&(function(e){C(e,!0)}(e),w(e.atoms,-function(e,t){return v(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 i=t-1,r=n-1,s=e.atoms.x,o=e.atoms.y,a=s[i],l=o[i];s[i]=s[r],o[i]=o[r],s[r]=a,o[r]=l}(e,t,e.meta.rNodes[1])}(e,o)}(x):e===c.RIBOSE||e===c.DEOXYRIBOSE?function(e,t){const n=e.atoms.x,i=e.atoms.y;let r=e.meta.terminalNodes[0]-1;const s=e.meta.rNodes[1]-1;A(e,-n[r],-i[r]);const o=v(n[s],i[s]);w(e.atoms,3*Math.PI/2-o),t.value=function(e){const t=e.atoms.x,n=e.atoms.y,i=e.meta.rNodes[2]-1,r=e.meta.terminalNodes[2]-1,s=t[i]-t[r],o=n[i]-n[r];return Math.atan(o/s)+Math.PI/2}(e),r=e.meta.terminalNodes[0]-1,A(e,-n[r],-i[r])}(x,r):e===c.PHOSPHATE?function(e){const t=e.meta.terminalNodes[0]-1,n=e.meta.rNodes[0]-1,i=e.atoms.x,r=e.atoms.y;A(e,-i[t],-r[t]);const s=v(i[n],r[n]);w(e.atoms,Math.PI/2-s)}(x):function(e,t){const n=e.atoms.x,i=e.atoms.y,r=e.meta.terminalNodes[0]-1,s=e.meta.rNodes[0]-1;A(e,-n[r],-i[r]);const o=v(n[s],i[s]),a=t.value;if(!a)throw new Error("The value of sugarBranchToOYAngle is null");w(e.atoms,Math.PI-o+a);const l=function(e,t){return h(Math.sqrt((e.x-t.x)**2+(e.y-t.y)**2))}({x:n[e.meta.rNodes[0]-1],y:i[e.meta.rNodes[0]-1]},{x:n[e.meta.terminalNodes[0]-1],y:i[e.meta.terminalNodes[0]-1]});if(1!=l)for(let e=0;e<n.length;++e)n[e]=h(n[e]/l),i[e]=h(i[e]/l)}(x,r),function(e,t,n){"PEPTIDE"===e?(f(t,e),y(t,t.meta.rNodes[1])):n===c.RIBOSE||n===c.DEOXYRIBOSE?(y(t,t.meta.rNodes[1]),t.meta.rNodes[1]=t.meta.terminalNodes[1],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===c.PHOSPHATE&&(t.meta.terminalNodes[0]=t.meta.rNodes[0],A(t,-t.atoms.x[t.meta.terminalNodes[0]-1],-t.atoms.y[t.meta.terminalNodes[0]-1]),f(t,e),y(t,t.meta.rNodes[1]))}(i,x,e),function(e){let t=0;for(;t<e.atoms.atomTypes.length;)e.atoms.atomTypes[t]===c.HYDROGEN&&(y(e,t+1),--t),++t}(x),x}var s;return null}(t,n,i,r,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 i=t.terminalNodes,r=e.atomPairs;let s=0,o=0;for(;s<r.length&&o<i.length;){for(let e=0;e<i.length;++e)for(let t=0;t<2;++t)r[s][t]===n[e]&&(i[e]=r[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[h(e.atoms.x[t]-e.atoms.x[n]),h(e.atoms.y[t]-e.atoms.y[n])]}function y(e,t){if(void 0!==t){const n=t-1,i=e.atoms,r=e.bonds,s=e.meta;i.atomTypes.splice(n,1),i.x=b(Float32Array,i.x,n,1),i.y=b(Float32Array,i.y,n,1),i.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<r.atomPairs.length;){const e=r.atomPairs[o][0],n=r.atomPairs[o][1];e===t||n===t?(r.atomPairs.splice(o,1),r.bondTypes=b(Uint32Array,r.bondTypes,o,1),r.bondConfiguration.has(o)&&r.bondConfiguration.delete(o),r.kwargs.has(o)&&r.kwargs.delete(o),--o):(r.atomPairs[o][0]=e>t?e-1:e,r.atomPairs[o][1]=n>t?n-1:n),++o}let a=Array.from(r.bondConfiguration.keys());a.forEach((e=>{if(r.bondConfiguration.has(e)&&e>n){const t=r.bondConfiguration.get(e);r.bondConfiguration.delete(e),r.bondConfiguration.set(e-1,t)}})),a=Array.from(r.kwargs.keys()),a.forEach((e=>{if(r.kwargs.has(e)&&e>n){const t=r.kwargs.get(e);r.kwargs.delete(e),r.kwargs.set(e-1,t)}}))}}function b(e,t,n,i){const r=new e(t.length-i);let s=0,o=0;for(;s<t.length;)s===n&&(s+=i),r[o]=t[s],++o,++s;return r}function v(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 i=t/e,r=Math.atan(i);n=e<0?Math.PI/2+r:-Math.PI/2+r}return n}function w(e,t){if(0!==t){const n=e.x,i=e.y,r=Math.cos(t),s=Math.sin(t);for(let e=0;e<n.length;++e){const t=n[e];n[e]=h(t*r-i[e]*s),i[e]=h(t*s+i[e]*r)}}}function C(e,t){if(t){const t=e.atoms.y;for(let e=0;e<t.length;e++)t[e]=-t[e]}else{const t=e.atoms.x;for(let e=0;e<t.length;e++)t[e]=-t[e]}const n=e.bonds.bondConfiguration;for(const[e,t]of n){const i=1===t?3:1;n.set(e,i)}}function A(e,t,n){const i=e.atoms.x,r=e.atoms.y;for(let e=0;e<i.length;++e)i[e]=h(i[e]+t),void 0!==n&&(r[e]=h(r[e]+n))}},1093:(e,t,n)=>{"use strict";n.d(t,{A:()=>r});var i=n(7362);class r extends i.e{static get Chromatogram(){return void 0===this.chromatogram&&(this.chromatogram=new r({A:"green",C:"blue",G:"black",T:"red",U:"red",others:"gray"})),this.chromatogram}}class 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:()=>i});class i{static makePalette(e,t=!1,n=i){const r={};return e.forEach((e=>{const n=e[0],i=e[1];n.forEach(((e,n)=>{r[e]=this.colourPalette[i][t?0:n]}))})),new n(r)}constructor(e){this._palette=e}get(e){return this._palette[e]}}i.undefinedColor="rgb(100,100,100)",i.colourPalette={orange:["rgb(255,187,120)","rgb(245,167,100)","rgb(235,137,70)","rgb(205, 111, 71)"],all_green:["rgb(44,160,44)","rgb(74,160,74)","rgb(23,103,57)","rgb(30,110,96)","rgb(60,131,95)","rgb(24,110,79)","rgb(152,223,138)","rgb(182, 223, 138)","rgb(152, 193, 138)"],all_blue:["rgb(31,119,180)","rgb(23,190,207)","rgb(122, 102, 189)","rgb(158,218,229)","rgb(141, 124, 217)","rgb(31, 120, 150)"],magenta:["rgb(162,106,192)","rgb(197,165,224)","rgb(208,113,218)"],red:["rgb(214,39,40)","rgb(255,152,150)"],st_blue:["rgb(23,190,207)","rgb(158,218,229)","rgb(31,119,180)"],dark_blue:["rgb(31,119,180)","rgb(31, 120, 150)"],light_blue:["rgb(23,190,207)","rgb(158,218,229)","rgb(108, 218, 229)","rgb(23,190,227)"],lilac_blue:["rgb(124,102,211)","rgb(149,134,217)","rgb(97, 81, 150)"],dark_green:["rgb(23,103,57)","rgb(30,110,96)","rgb(60,131,95)","rgb(24,110,79)"],green:["rgb(44,160,44)","rgb(74,160,74)"],light_green:["rgb(152,223,138)","rgb(182, 223, 138)","rgb(152, 193, 138)"],st_green:["rgb(44,160,44)","rgb(152,223,138)","rgb(39, 174, 96)","rgb(74,160,74)"],pink:["rgb(247,182,210)"],brown:["rgb(140,86,75)","rgb(102, 62, 54)"],gray:["rgb(127,127,127)","rgb(199,199,199)","rgb(196,156,148)","rgb(222, 222, 180)"],yellow:["rgb(188,189,34)"],white:["rgb(230,230,230)"]}},4152:(e,t,n)=>{"use strict";n.d(t,{oT:()=>c});var i=n(6082),r=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 l extends o{static buildPalette(){return[].concat(...Object.values(r.e.colourPalette))}get(e){const t=s.hashCode(e)%l.palette.length;return function(e){if(null==e)return"rgb(100,100,100)";const t=i.Color.fromHtml(e),n=i.Color.g(t),r=i.Color.r(t),s=i.Color.b(t),o=Math.sqrt(Math.pow(0-r,2)+Math.pow(0-n,2)+Math.pow(0-s,2));return o>210?`rgb(${r/o*210},${n/o*210},${s/o*210})`:i.Color.toRgb(t)}(l.palette[t])}}l.palette=l.buildPalette();class c extends r.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 l),this.color}}},6642:(e,t,n)=>{"use strict";n.d(t,{h:()=>o,s:()=>a});var i=n(4328),r=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 i=e.cell.column;if(t=t??i.temp,!t)throw new Error("Grid cell renderer back store (GridColumn or Column) not found.");return[n,i,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 r.Subject,this.tableCol&&this.tableCol.dataFrame&&this.subs.push(this.tableCol.dataFrame.onDataChanged.subscribe((()=>{this.dirty=!0}))),this.tableCol&&this.subs.push(i.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(i.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,{J:()=>u});var i=n(6082),r=n(1991),s=n.n(r),o=n(826),a=n(6642),l=n(6718),c=n(9192);class u extends a.s{constructor(e,t,n,r,s){super(e,t,n),this.monomerLengthLimit=r,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=i.BitSet.create(this.tableCol.length),this.gridCol&&this.subs.push(this.gridCol.grid.onAfterDrawContent.subscribe((()=>{this._onRendered.next()}))),(0,l.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=i.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,c.AP)(e);this.logger.error(t,void 0,n)}const n=this.props.seqHandler.isMsa()?this.getCellMonomerLengthsForSeqMsa():this.getCellMonomerLengthsForSeq(e),i=new Array(n.length+1);i[0]=5;for(let e=1;e<i.length;e++)i[e]=i[e-1]+n[e-1];return[n,i]}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),i=o.GO.forColumn(this.tableCol).getSplitted(e).originals,r=Math.min(n,i.length);let s=this._monomerLengthList[e];if(null===s||s.length<r){s=this._monomerLengthList[e]=new Array(i.length);let t=0;for(let e=0;e<r;++e){const n=i[e],r=this.props.monomerToShort(n,this.monomerLengthLimit),o=(this.props.seqHandler.isSeparator()?this.separatorWidth:this.props.separatorWidth)+r.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:i}=(()=>{try{const e=this.gridCol&&this.gridCol.dart?this.gridCol.grid:null;return e&&e.dart?{startIdx:Math.max(Math.floor((e?.vertScroll.min??0)-10),0),endIdx:Math.min(Math.ceil((e?.vertScroll.max??0)+10),this.tableCol.length)}:{startIdx:0,endIdx:Math.min(this.tableCol.length,10)}}catch(e){return{startIdx:0,endIdx:Math.min(this.tableCol.length,10)}}})(),r=this.props.separatorWidth+1*this.props.monomerCharWidth,s=Math.ceil(this.colWidth/r);for(let e=n;e<i;e++){if(this._processedRows.get(e)&&s<=this._processedMaxVisibleSeqLength)continue;const n=o.GO.forColumn(this.tableCol).getSplitted(e,s).originals,i=Math.min(s,n.length);i>t.length&&t.push(...new Array(i-t.length).fill(r));let a=0;for(let e=0;e<i;++e){const i=n[e],r=this.props.monomerToShort(i,this.monomerLengthLimit),s=this.props.separatorWidth+r.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[i,r]=this.getCellMonomerLengths(e,n),a=o.GO.forColumn(this.tableCol);return 0===s()(a.getSplitted(e).originals).toArray().length?null:function(e,t){let n,i=100,r=0,s=e.length-1;for(;r<=s;){if(n=Math.floor((s+r)/2),e[n]<=t&&t<e[n+1])return n;if(t<e[n]?s=n-1:r=n+1,--i<=0)throw new Error(`Get position for pointer x = ${t} searching has not converged on ${JSON.stringify(e)}. `)}return null}(r,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:()=>a,Ec:()=>s,f6:()=>i,q7:()=>o,yw:()=>r});const i=["symbol","molfile","rgroups","name"],r="MonomerName",s={monomerType:null,smiles:null,name:"Name",author:null,molfile:"molecule",naturalAnalog:"MonomerNaturalAnalogCode",rgroups:"MonomerCaps",createDate:null,id:null,polymerType:"MonomerType",symbol:"MonomerName"},o="p",a=new RegExp(`[rd]\\((\\w)\\)${o}?`,"g")},9192:(e,t,n)=>{"use strict";function i(e){return"string"==typeof e||e instanceof String?e:"StateError"===e.constructor.name?e.message:"StateError"===e.constructor.name&&"$thrownJsError"in e?i(e.$thrownJsError):e instanceof Error?e.message:e.toString()}function r(e){return e instanceof Error?e.stack:"StateError"===e.constructor.name&&"$thrownJsError"in e?r(e.$thrownJsError):void 0}function s(e){return[i(e),r(e)]}n.d(t,{AP:()=>s})},3516:(e,t,n)=>{"use strict";n.d(t,{m:()=>o});var i=n(6082),r=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 i=this._fileContent.substring(t.index+1,e.lastIndex);this._descriptionsArray.push(i),0!==n&&this._sequencesArray.push(this.parseMacromolecule(n,t.index)),n=e.lastIndex+1}this._sequencesArray.push(this.parseMacromolecule(n,-1))}importFasta(){const e=i.Column.fromStrings("description",this.descriptionsArray),t=i.Column.fromStrings("sequence",this.sequencesArray);return t.semType=i.SEMTYPE.MACROMOLECULE,t.meta.units=s.Hi.FASTA,r.GO.forColumn(t),[i.DataFrame.fromColumns([e,t])]}constructor(e){this._descriptionsArray=[],this._sequencesArray=[],this._fileContent=e,this.parseColumns()}}},6873:(e,t,n)=>{"use strict";n.d(t,{Hx:()=>u,dW:()=>c});var i=n(6082),r=n(1991),s=n.n(r),o=n(2003),a=n(826),l=n(9322);function c(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=i.Column.fromList(i.COLUMN_TYPE.STRING,"MSA",new Array(100).fill(t));n.semType=i.SEMTYPE.MACROMOLECULE,n.meta.units=o.Hi.SEPARATOR,n.setTag(o.gp.separator,"/"),n.setTag(o.gp.alphabet,o.YI.UN),n.setTag(o.gp.alphabetIsMultichar,"true");const r=[];return r.push(n),r.push(i.Column.fromList(i.COLUMN_TYPE.FLOAT,"Activity",new Array(100).fill(7.30751))),r}function u(e=o.Hi.SEPARATOR,t=o.YI.PT,n=(e===o.Hi.SEPARATOR?"-":void 0),r=void 0,c="seq",u=100,h=10**6){const d=t===o.YI.UN?r?.getMonomerSymbolsByType("PEPTIDE")??[]:Array.from((0,o.Qf)(t)),p=d.length,m=i.Column.fromType(i.COLUMN_TYPE.STRING,c,u);m.semType=i.SEMTYPE.MACROMOLECULE,m.meta.units=e,m.setTag(o.gp.alphabet,t),e==o.Hi.SEPARATOR&&m.setTag(o.gp.separator,n);const f=a.GO.forColumn(m);for(let t=0;t<u;t++){const n=s().count(0).take(h).map((e=>d[Math.floor(Math.random()*p)])).toArray(),i=f.joiner(new l.Mu(n,a.b9[e]));m.set(t,i)}return m}},439:(e,t,n)=>{"use strict";n.d(t,{B5:()=>l,Hi:()=>i,Vl:()=>c,YI:()=>r,gp:()=>s,q7:()=>u,z1:()=>a});var i,r,s,o=n(2738);!function(e){e.FASTA="fasta",e.SEPARATOR="separator",e.HELM="helm"}(i||(i={})),function(e){e.DNA="DNA",e.RNA="RNA",e.PT="PT",e.UN="UN"}(r||(r={})),function(e){e.aligned="aligned",e.alphabet="alphabet",e.alphabetSize=".alphabetSize",e.alphabetIsMultichar=".alphabetIsMultichar",e.separator="separator",e.isHelmCompatible=".isHelmCompatible",e.positionNames=".positionNames",e.positionLabels=".positionLabels",e.regions=".regions"}(s||(s={}));const a=", ",l=/(?:\[([A-Za-z0-9_\-,()]+)\])|([A-Za-z\-])/g,c=new class{constructor(){this.fasta={peptide:new Set(["G","L","Y","S","E","Q","D","N","F","A","K","R","H","C","V","P","W","I","M","T"]),dna:new Set(["A","C","G","T"]),rna:new Set(["A","C","G","U"])}}},u=[new o.aD(r.PT,c.fasta.peptide,.5),new o.aD(r.DNA,c.fasta.dna,.55),new o.aD(r.RNA,c.fasta.rna,.55)]},2003:(e,t,n)=>{"use strict";n.d(t,{Hi:()=>i.Hi,J9:()=>r.J9,Qf:()=>r.Qf,SM:()=>r.SM,YI:()=>i.YI,dh:()=>r.dh,gp:()=>i.gp,mn:()=>r.mn,ny:()=>r.ny,q7:()=>i.q7,qp:()=>r.qp,z1:()=>i.z1,zS:()=>r.zS});var i=n(439),r=n(9322)},2738:(e,t,n)=>{"use strict";n.d(t,{XN:()=>s,_S:()=>i,aD:()=>r});const i="";class r{constructor(e,t,n){this.name=e,this.alphabet=t,this.cutoff=n}}class s extends r{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:()=>_,Qf:()=>E,ny:()=>T,Iv:()=>A,dh:()=>b,zS:()=>x,SM:()=>M,mn:()=>I,J9:()=>g,tm:()=>y,qp:()=>C});var i=n(6082),r=n(1991),s=n.n(r),o=n(2738),a=n(439),l=n(826);class c extends Float32Array{}var u=n(3629),h=n(8924),d=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)===l.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}}const g=e=>{const t=s()(e.toString().matchAll(a.B5)).map((e=>e[2]??e[1])).toArray();return new m(t,l.b9[a.Hi.FASTA])},y=e=>e?new f(e):new m([],l.b9[a.Hi.FASTA]);function b(e,t=void 0){return n=>{if(n){let i;const r=new RegExp(String.raw`"-"|'-'|[^${e}]+`,"g");if(void 0!==t){r.lastIndex=0,i=new Array(Math.ceil(t));let e=null,s=0;for(;null!==(e=r.exec(n))&&s<t;)i[s++]=e[0].replace('"-"',"").replace("'-'","");i.splice(s)}else i=n.replaceAll('"-"',"").replaceAll("'-'","").split(e,t);return new m(i,l.b9[a.Hi.SEPARATOR])}return new m([],l.b9[a.Hi.SEPARATOR])}}const v=/(PEPTIDE1|DNA1|RNA1)\{([^}]+)}/g,w=/\[([^\[\]]+)]/g,C=e=>{v.lastIndex=0;const t=v.exec(e.toString()),n=t?t[2]:null,i=n?n.split("."):[];return new m(i.map((e=>{w.lastIndex=0;const t=w.exec(e);return t&&t.length>=2?t[1]:e})),l.b9[a.Hi.HELM])};function A(e,t,n=void 0){if(e.toLowerCase().startsWith(a.Hi.FASTA))return g;if(e.toLowerCase().startsWith(a.Hi.SEPARATOR))return b(t,n);if(e.toLowerCase().startsWith(a.Hi.HELM))return C;throw new Error(`Unexpected units ${e} .`)}const S=/([^\W_]+)/g;function x(e,t){if(e.length<=t)return e;const n=e.match(S),i=e.length>t||(n?.length??0)>1,r=n?.[0]??" ";return i?r.substring(0,t-1)+"…":r}function E(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 _(e,t,n="-"){const i=t.map((t=>{const i=function(e,t,n="-"){const i=new Set([...new Set(Object.keys(e)),...t]);i.delete(n);const r=[],s=[];for(const n of i)r.push(n in e?e[n]:0),s.push(t.has(n)?1:0);const o=new c(r),a=new c(s);return(0,u.KE)(o,a)/((0,u.wQ)(o)*(0,u.wQ)(a))}(e,t.alphabet,n);return new o.XN(t,e,i)}));let r;const s=Math.max(...i.map((e=>e.similarity>e.cutoff?e.similarity:-1)));return r=s>0?i.find((e=>e.similarity===s)).name:a.YI.UN,r}function M(e,t=5){let n;if(e.semType==i.SEMTYPE.MACROMOLECULE)n=l.GO.forColumn(e).alphabet;else{const i=function(e,t,n){const i=e.categories;return function(e,t){const n={};let i=!0,r=null;for(const s of e)if(null==r?r=s.length:s.length!==r&&(i=!1),s.length>=t)for(const e of s.canonicals)e in n||(n[e]=0),n[e]+=1;return{freq:n,sameLength:i}}(s().enumerate(e.getRawData()).map((([e,t])=>n(i[e]))),t)}(e,t,g);n=_(i.freq,a.q7)}return T(n)}function T(e){switch(e){case a.YI.PT:return h.X.GrokGroups;case a.YI.DNA:case a.YI.RNA:return d.A.Chromatogram;default:return p.oT.Color}}function I(e){const t=e.columns.bySemTypeAll(i.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,j8:()=>d});var i=n(6082),r=n(1991),s=n.n(r),o=n(2003),a=n(2738),l=n(9322),c=n(6863),u=n(6718),h=n(3151);const d=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!==i.TYPE.STRING)throw new Error(`Unexpected column type '${e.type}', must be '${i.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[d.notationProvider]??null,this.columnVersion=this.column.version}static setUnitsToFastaColumn(e){if(e.column.semType!==i.SEMTYPE.MACROMOLECULE||e.column.meta.units!==o.Hi.FASTA)throw new Error(`The column of notation '${o.Hi.FASTA}' must be '${i.SEMTYPE.MACROMOLECULE}'.`);e.column.meta.units=o.Hi.FASTA,m.setTags(e)}static setUnitsToSeparatorColumn(e,t){if(e.column.semType!==i.SEMTYPE.MACROMOLECULE||e.column.meta.units!==o.Hi.SEPARATOR)throw new Error(`The column of notation '${o.Hi.SEPARATOR}' must be '${i.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!==i.SEMTYPE.MACROMOLECULE)throw new Error(`The column of notation '${o.Hi.HELM}' must be '${i.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,l.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)}}get stats(){if(null===this._stats){const e={};let t=!0,n=null;const i=this.column.length;for(let r=0;r<i;++r){const i=this.getSplitted(r);null==n?n=i.length:i.length!==n&&(t=!1);for(const t of i.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,r){const s=this.column,a=e.toLowerCase()+"("+s.name+")",l=n??s.dataFrame.columns.getUnusedName(a),c=i.Column.fromList("string",l,r??new Array(this.column.length).fill(""));if(c.semType=i.SEMTYPE.MACROMOLECULE,c.meta.units=e,e===o.Hi.SEPARATOR){if(!t)throw new Error(`Notation '${o.Hi.SEPARATOR}' requires separator value.`);c.setTag(o.gp.separator,t)}c.setTag(i.TAGS.CELL_RENDERER,e===o.Hi.HELM?"helm":"sequence");const u=s.getTag(o.gp.aligned);u&&c.setTag(o.gp.aligned,u);let h=s.getTag(o.gp.alphabet);h||this.notation!==o.Hi.HELM||e===o.Hi.HELM||(h=o.YI.UN),null!=h&&c.setTag(o.gp.alphabet,h);let d=s.getTag(o.gp.alphabetSize);null!=h&&d&&c.setTag(o.gp.alphabetSize,d);const p=s.getTag(o.gp.alphabetIsMultichar);return null!=h&&void 0!==p&&c.setTag(o.gp.alphabetIsMultichar,p),e==o.Hi.HELM&&(d=this.getAlphabetSize().toString(),c.setTag(o.gp.alphabetSize,d)),c}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 r=i.Column.fromList("string",t,new Array(e).fill(""));return r.semType=i.SEMTYPE.MACROMOLECULE,r.meta.units=n,r}getSplitter(e){let t=null;if(t=this.notationProvider?this.notationProvider.splitter:null,t)return t;if(this.units.toLowerCase().startsWith(o.Hi.FASTA))return null===this.column.getTag(o.gp.alphabet)||this.getAlphabetIsMultichar()?o.J9:l.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 c.Z.HAMMING;switch(this.alphabet){case o.YI.DNA:case o.YI.RNA:case o.YI.PT:}return c.Z.LEVENSHTEIN}getDistanceFunction(){return c.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),i=this.column.length,r=this.column.getRawData();for(let e=0;e<i;++e){const i=r[e];if(!(i in n)){n.add(i);const r=this.getSplitted(e);for(const e of r.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,i){i||(i=this.toFasta(t)?p[o.Hi.FASTA]:p[o.Hi.SEPARATOR]),n||(n=this.toFasta(t)?"":this.separator);const r=e.startsWith("RNA"),s=this.splitter(e),a=[];for(let e=0;e<s.length;++e){let n=s.getOriginal(e);if(r&&(n=n.replace(h.EK,"")),n===p[o.Hi.HELM])a.push(i);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}),i=this.getNewColumn(e,t);return i.init((e=>{const t=this.getSplitted(e);return n(t)})),i}getRegion(e,t,n){const i=this.getNewColumn(this.notation,this.separator);i.name=n;const r=e??0,s=t??this.maxLength-1,a=this.getJoiner(),c=s-r+1,u=p[this.notation];i.init((e=>{const t=this.getSplitted(e),n=new Array(c);for(let e=0;e<c;++e){const i=r+e;n[e]=i<t.length?t.getOriginal(i):u}return a(new l.Mu(n,u))}));const h=e=>{const t=e.split(",").map((e=>e.trim())),n=new Array(c);for(let e=0;e<c;++e){const i=r+e;n[e]=i<t.length?t[i]:"?"}return n.join(o.z1)},d=this.column.getTag(o.gp.positionNames);d&&i.setTag(o.gp.positionNames,h(d));const m=this.column.getTag(o.gp.positionLabels);return m&&i.setTag(o.gp.positionLabels,h(m)),i}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 i;const r=this;switch(t){case o.Hi.FASTA:i=function(e){return r.joinToFasta(e,r.isHelm())};break;case o.Hi.SEPARATOR:if(!n)throw new Error(`Separator is mandatory for notation '${t}'.`);i=function(e){return f(e,n,r.isHelm())};break;case o.Hi.HELM:{const e=r.alphabet===o.YI.DNA||r.alphabet===o.YI.RNA,t=r.getHelmWrappers();i=function(n){return g(n,t,e)};break}default:throw new Error(`Unexpected notation '${t}'.`)}return i}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[d.seqHandler];return t&&t.columnVersion===e.version||(t=e.temp[d.seqHandler]=new m(e)),t}joinToFasta(e,t){const n=new Array(e.length);for(let i=0;i<e.length;++i){const r=e.getOriginal(i);let s=e.getOriginal(i);t&&(s=s.replace(h.EK,"$1")),r===a._S?s=p[o.Hi.FASTA]:r===h.q7?s="":s.length>1&&(s="["+s+"]"),n[i]=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){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),i=e.startsWith("DNA"),r=e.startsWith("RNA");for(let e=0;e<t.length;++e){let s=t.getOriginal(e);(i||r)&&(s=s.replace(h.EK,"$1"),s=s===h.q7?null:s),n[e]=s||null}return new l.Mu(n.filter((e=>!!e)),p[o.Hi.HELM])}}function f(e,t,n){const i=new Array(e.length);for(let t=0;t<e.length;++t){const r=e.getCanonical(t);let s=e.getOriginal(t);n&&(s=s.replace(h.EK,"$1")),r===a._S?s=p[o.Hi.SEPARATOR]:r===h.q7&&(s=""),i[t]=s}return i.join(t)}function g(e,t,n){const[i,r,s,l]=t,c=new Array(e.length);for(let t=0;t<e.length;++t){const i=e.getCanonical(t);let l=e.getOriginal(t);i===a._S?l=p[o.Hi.HELM]:(n&&(l=l.replace(h.EK,"$1")),l=1===l.length?`${r}${l}${s}`:`${r}[${l}]${s}`),c[t]=l}return`${i}${c.join(".")}${l}`}},3077:(e,t,n)=>{"use strict";n.d(t,{R:()=>s});var i=n(6082),r=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=i.DataFrame.create(s),a=r.GO.forColumn(e);for(let e=0;e<s;++e){const i=a.getSplitted(e);for(let r=0;r<i.length;++r){const s=i.getOriginal(r);((n[r]??null)||t(r)).set(e,s,!1)}}return o}},7602:(e,t,n)=>{"use strict";n.d(t,{g:()=>s});var i,r=n(9192);!function(e){e[e.error=0]="error",e[e.warning=1]="warning",e[e.info=2]="info",e[e.debug=3]="debug"}(i||(i={}));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[i,s]=(0,r.AP)(t);this.logger.error(`${e}, SYNC syncId = ${n}, ERROR:\n${i}`,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:()=>r,gp:()=>i,lT:()=>l,mH:()=>a});var i,r,s,o,a,l,c=n(6082);!function(e){e.tooltipWebLogo=".tooltipWebLogo"}(i||(i={})),function(e){e.Entropy="Entropy",e.full="100%"}(r||(r={})),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"}(l||(l={}));const u=new class{constructor(){this.sequenceColumnName=null,this.valueAggrType=c.AGG.TOTAL_COUNT,this.valueColumnName="Activity",this.startPositionName=null,this.endPositionName=null,this.skipEmptySequences=!0,this.skipEmptyPositions=!1,this.shrinkEmptyTail=!0,this.backgroundColor=4294967295,this.positionHeight=r.Entropy,this.positionWidth=16,this.verticalAlignment=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=l.Filtered}}},5540:(e,t,n)=>{"use strict";e=n.hmd(e);var i,r=(i="undefined"!=typeof document&&document.currentScript?document.currentScript.src:void 0,function(e={}){var t,n,r=void 0!==e?e:{};r.ready=new Promise((function(e,i){t=e,n=i}));var s,o=Object.assign({},r),a="object"==typeof window,l="function"==typeof importScripts,c=("object"==typeof process&&"object"==typeof process.versions&&process.versions.node,"");(a||l)&&(l?c=self.location.href:"undefined"!=typeof document&&document.currentScript&&(c=document.currentScript.src),i&&(c=i),c=0!==c.indexOf("blob:")?c.substr(0,c.replace(/[?#].*/,"").lastIndexOf("/")+1):"",l&&(s=e=>{var t=new XMLHttpRequest;return t.open("GET",e,!1),t.responseType="arraybuffer",t.send(null),new Uint8Array(t.response)})),r.print||console.log.bind(console);var u,h,d=r.printErr||console.warn.bind(console);Object.assign(r,o),o=null,r.arguments&&r.arguments,r.thisProgram&&r.thisProgram,r.quit&&r.quit,r.wasmBinary&&(u=r.wasmBinary),r.noExitRuntime,"object"!=typeof WebAssembly&&x("no native wasm support detected");var p,m,f,g=!1;function y(){var e=h.buffer;r.HEAP8=p=new Int8Array(e),r.HEAP16=new Int16Array(e),r.HEAP32=new Int32Array(e),r.HEAPU8=m=new Uint8Array(e),r.HEAPU16=new Uint16Array(e),r.HEAPU32=f=new Uint32Array(e),r.HEAPF32=new Float32Array(e),r.HEAPF64=new Float64Array(e)}var b=[],v=[],w=[],C=0,A=null,S=null;function x(e){r.onAbort&&r.onAbort(e),d(e="Aborted("+e+")"),g=!0,e+=". Build with -sASSERTIONS for more info.";var t=new WebAssembly.RuntimeError(e);throw n(t),t}var E,_;function M(e){return e.startsWith("data:application/octet-stream;base64,")}function T(e){try{if(e==E&&u)return new Uint8Array(u);if(s)return s(e);throw"both async and sync fetching of the wasm failed"}catch(e){x(e)}}function I(e,t,n){return function(e){return u||!a&&!l||"function"!=typeof fetch?Promise.resolve().then((function(){return T(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 T(e)}))}(e).then((function(e){return WebAssembly.instantiate(e,t)})).then((function(e){return e})).then(n,(function(e){d("failed to asynchronously prepare wasm: "+e),x(e)}))}function L(e){for(;e.length>0;)e.shift()(r)}function $(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(B(this.get_type()))return f[this.excPtr>>2];var e=this.get_adjusted_ptr();return 0!==e?e:this.excPtr}}function N(e){var t=h.buffer;try{return h.grow(e-t.byteLength+65535>>>16),y(),1}catch(e){}}function P(e){return r["_"+e]}M(E="wasmDbscan.wasm")||(_=E,E=r.locateFile?r.locateFile(_,c):c+_);var O="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0;function R(e,t,n,i,r){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 i=e.charCodeAt(n);i<=127?t++:i<=2047?t+=2:i>=55296&&i<=57343?(t+=4,++n):t+=3}return t}(e)+1,n=H(t);return function(e,t,n){!function(e,t,n,i){if(!(i>0))return 0;for(var r=n+i-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>=r)break;t[n++]=o}else if(o<=2047){if(n+1>=r)break;t[n++]=192|o>>6,t[n++]=128|63&o}else if(o<=65535){if(n+2>=r)break;t[n++]=224|o>>12,t[n++]=128|o>>6&63,t[n++]=128|63&o}else{if(n+3>=r)break;t[n++]=240|o>>18,t[n++]=128|o>>12&63,t[n++]=128|o>>6&63,t[n++]=128|63&o}}t[n]=0}(e,m,t,n)}(e,n,t),n}(e)),t},array:e=>{var t,n,i=H(e.length);return t=e,n=i,p.set(t,n),i}},o=P(e),a=[],l=0;if(i)for(var c=0;c<i.length;c++){var u=s[n[c]];u?(0===l&&(l=D()),a[c]=u(i[c])):a[c]=i[c]}var h=o.apply(null,a);return function(e){return 0!==l&&F(l),function(e){return"string"===t?(n=e)?function(e,t,n){for(var i=t+n,r=t;e[r]&&!(r>=i);)++r;if(r-t>16&&e.buffer&&O)return O.decode(e.subarray(t,r));for(var s="";t<r;){var o=e[t++];if(128&o){var a=63&e[t++];if(192!=(224&o)){var l=63&e[t++];if((o=224==(240&o)?(15&o)<<12|a<<6|l:(7&o)<<18|a<<12|l<<6|63&e[t++])<65536)s+=String.fromCharCode(o);else{var c=o-65536;s+=String.fromCharCode(55296|c>>10,56320|1023&c)}}else s+=String.fromCharCode((31&o)<<6|a)}else s+=String.fromCharCode(o)}return s}(m,n,i):"":"boolean"===t?Boolean(e):e;var n,i}(e)}(h)}var k,G={__cxa_throw:function(e,t,n){throw new $(e).init(t,n),e},abort:function(){x("")},emscripten_memcpy_big:function(e,t,n){m.copyWithin(e,t,t+n)},emscripten_resize_heap:function(e){var t,n=m.length,i=2147483648;if((e>>>=0)>i)return!1;for(var r=1;r<=4;r*=2){var s=n*(1+.2/r);if(s=Math.min(s,e+100663296),N(Math.min(i,(t=Math.max(e,s))+(65536-t%65536)%65536)))return!0}return!1}},D=(function(){var e,t,i,s,o={env:G,wasi_snapshot_preview1:G};function a(e,t){var n,i=e.exports;return r.asm=i,h=r.asm.memory,y(),r.asm.__indirect_function_table,n=r.asm.__wasm_call_ctors,v.unshift(n),function(){if(C--,r.monitorRunDependencies&&r.monitorRunDependencies(C),0==C&&(null!==A&&(clearInterval(A),A=null),S)){var e=S;S=null,e()}}(),i}if(C++,r.monitorRunDependencies&&r.monitorRunDependencies(C),r.instantiateWasm)try{return r.instantiateWasm(o,a)}catch(e){d("Module.instantiateWasm callback failed with error: "+e),n(e)}(e=u,t=E,i=o,s=function(e){a(e.instance)},e||"function"!=typeof WebAssembly.instantiateStreaming||M(t)||"function"!=typeof fetch?I(t,i,s):fetch(t,{credentials:"same-origin"}).then((function(e){return WebAssembly.instantiateStreaming(e,i).then(s,(function(e){return d("wasm streaming compile failed: "+e),d("falling back to ArrayBuffer instantiation"),I(t,i,s)}))}))).catch(n)}(),r._dbscan=function(){return(r._dbscan=r.asm.dbscan).apply(null,arguments)},r._malloc=function(){return(r._malloc=r.asm.malloc).apply(null,arguments)},r._free=function(){return(r._free=r.asm.free).apply(null,arguments)},function(){return(D=r.asm.stackSave).apply(null,arguments)}),F=function(){return(F=r.asm.stackRestore).apply(null,arguments)},H=function(){return(H=r.asm.stackAlloc).apply(null,arguments)},B=function(){return(B=r.asm.__cxa_is_pointer_type).apply(null,arguments)};function V(){function e(){k||(k=!0,r.calledRun=!0,g||(L(v),t(r),r.onRuntimeInitialized&&r.onRuntimeInitialized(),function(){if(r.postRun)for("function"==typeof r.postRun&&(r.postRun=[r.postRun]);r.postRun.length;)e=r.postRun.shift(),w.unshift(e);var e;L(w)}()))}C>0||(function(){if(r.preRun)for("function"==typeof r.preRun&&(r.preRun=[r.preRun]);r.preRun.length;)e=r.preRun.shift(),b.unshift(e);var e;L(b)}(),C>0||(r.setStatus?(r.setStatus("Running..."),setTimeout((function(){setTimeout((function(){r.setStatus("")}),1),e()}),1)):e()))}if(r.ccall=R,r.cwrap=function(e,t,n,i){var r=!n||n.every((e=>"number"===e||"boolean"===e));return"string"!==t&&r&&!i?P(e):function(){return R(e,t,n,arguments)}},S=function e(){k||V(),k||(S=e)},r.preInit)for("function"==typeof r.preInit&&(r.preInit=[r.preInit]);r.preInit.length>0;)r.preInit.pop()();return V(),e.ready});"object"==typeof exports?e.exports=r:"function"==typeof define&&n.amdO?define([],(function(){return r})):"object"==typeof exports&&(exports.exportCppDbscanLib=r)},6295:(e,t,n)=>{"use strict";n.d(t,{$1:()=>a,Hr:()=>S,Ii:()=>m,T6:()=>A,TK:()=>w,a4:()=>d,be:()=>p,gt:()=>y,iS:()=>o,ij:()=>b,lO:()=>h,lP:()=>g,rR:()=>f,tO:()=>l,v_:()=>c,yK:()=>v,zn:()=>u});var i=n(8774),r=n(8498),s=n(6863);r.aT.Tanimoto,r.aT.Dice,r.aT.Asymmetric,r.aT.BraunBlanquet,r.aT.Cosine,r.aT.Kulczynski,r.aT.McConnaughey,r.aT.RogotGoldberg,r.aT.Russel,r.aT.Sokal,r.aT.Hamming,r.aT.Euclidean,r.aT.Tanimoto,r.aT.Dice,r.aT.Asymmetric,r.aT.BraunBlanquet,r.aT.Cosine,r.aT.Kulczynski,r.aT.McConnaughey,r.aT.RogotGoldberg,r.aT.Russel,r.aT.Sokal,r.aT.Hamming,r.aT.Euclidean;const o=[r.aT.Tanimoto,r.aT.Dice,r.aT.Cosine];function a(e,t){const n=e.trueCount()+t.trueCount();if(0==n)return 1;const i=e.andWithCountBits(t,!0);return i/(n-i)}function l(e,t){return 1-a(e,t)}function c(e,t){return C(a(new i.A(e,32*e.length),new i.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 h(e,t){return 1-function(e,t){const n=e.trueCount()*t.trueCount();return 0==n?0:e.andWithCountBits(t,!0)/Math.sqrt(n)}(e,t)}function d(e,t){return Math.sqrt(e.trueCount()+t.trueCount()-2*e.andWithCountBits(t,!0))}function 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(),i=e.andWithCountBits(t,!0);return i/(2*n-3*i)}(e,t)}function f(e,t){return C(function(e,t){const n=e.trueCount()+t.trueCount(),i=e.trueCount()*t.trueCount();return 0==i?0:e.andWithCountBits(t,!0)*n/(2*i)}(e,t))}function g(e,t){return C(function(e,t){const n=e.trueCount()+t.trueCount(),i=e.trueCount()*t.trueCount();return 0==i?0:(e.andWithCountBits(t,!0)*n-i)/i}(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 b(e,t){return C(function(e,t){const n=Math.max(e.trueCount(),t.trueCount());return 0==n?0:e.andWithCountBits(t,!0)/n}(e,t))}function v(e,t){return C(function(e,t){return 0==e.length?0:e.andWithCountBits(t,!0)/e.length}(e,t))}function w(e,t){return C(function(e,t){const n=e.andWithCountBits(t,!0),i=e.countBits(!0)+t.countBits(!0),r=e.length,s=r-i+n;return n==r||s==r?1:n/i+s/(2*r-i)}(e,t))}function C(e){return 0===e?3402823e32:1/e-1}function A(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 S(e){const t=function(e){const t=e?.mostCommon??new Set;return(e,n)=>{const i=e.length,r=n.length;let s=0,o=0,a=0;for(;o<i&&a<r;)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)}r.aT.Tanimoto,r.aT.Asymmetric,r.aT.Cosine,r.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:()=>i,Gi:()=>a,YP:()=>c,_X:()=>o,n3:()=>r,vb:()=>l});const i="dim-red-preprocessing-function",r="supportedSemTypes",s="supportedTypes",o="supportedUnits",a="supportedDistanceFunctions",l="bypassLargeDataWarning",c="show-scatterplot-progress"},6863:(e,t,n)=>{"use strict";function i(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,i=Math.min(...Object.keys(t).map((e=>e.charCodeAt(0))))+1,r=new Float32Array((n.length+i)*(n.length+i));return Object.entries(t).forEach((([e,i])=>{const s=n[i];Object.entries(t).forEach((([t,i])=>{r[e.charCodeAt(0)*n.length+t.charCodeAt(0)]=s[i]}))})),(e,t)=>1-r[e.charCodeAt(0)*n.length+t.charCodeAt(0)]}(),n=e?.threshold??0;return(e,i)=>{let r=0;const s=e.length,o=i.length,a=Math.ceil(Math.max(s,o)*(1-n));s!==o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,-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]:i,[o.LEVENSHTEIN]:function(){return(e,t)=>(0,r.I)(e,t)/Math.max(e.length,t.length)},[o.NEEDLEMANN_WUNSCH]:function(e){const t=new Uint16Array(65536),{gapOpen:n,gapExtend:i,scoringMatrix:r,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),l=new Array(e.length+1).fill(!1);let c=0,u=1;for(let t=1;t<e.length+1;t++)a[0][t]=-i-(t-1)*i,a[1][t]=0;a[0][0]=0;for(let h=1;h<s.length+1;h++){a[u][0]=-i-(h-1)*i;for(let d=1;d<e.length+1;d++){const p=a[c][d-1]+r[t[e.charCodeAt(d-1)]][t[s.charCodeAt(h-1)]],m=a[c][d]-(o[d]||1===h||h===s.length?i:n),f=a[u][d-1]-(l[d-1]||1===d||d===e.length?i:n);a[u][d]=Math.max(p,f,m),a[u][d]===p?(o[d]=!1,l[d]=!1):a[u][d]===f?(o[d]=!1,l[d]=!0):(o[d]=!0,l[d]=!1)}c=u,u=(u+1)%2}const h=Math.min(e.length,s.length);return(h-a[c][e.length])/h}},[o.MONOMER_CHEMICAL_DISTANCE]:i}},9039:(e,t,n)=>{"use strict";var i;n.d(t,{c:()=>i}),function(e){e.UMAP="UMAP",e.T_SNE="t-SNE"}(i||(i={}))},8498:(e,t,n)=>{"use strict";var i,r,s,o,a,l,c;n.d(t,{EG:()=>a,Pn:()=>r,RR:()=>l,Wn:()=>c,aT:()=>s,m6:()=>o,xL:()=>i}),function(e){e.Levenshtein="Levenshtein",e.JaroWinkler="Jaro-Winkler",e.Manhattan="Manhattan",e.Onehot="One-Hot"}(i||(i={})),function(e){e.Euclidean="Euclidean"}(r||(r={})),function(e){e.Tanimoto="Tanimoto",e.Dice="Dice",e.Asymmetric="Asymmetric",e.BraunBlanquet="Braun-Blanquet",e.Cosine="Cosine",e.Kulczynski="Kulczynski",e.McConnaughey="Mc-Connaughey",e.RogotGoldberg="Rogot-Goldberg",e.Russel="Russel",e.Sokal="Sokal",e.Hamming="Hamming",e.Euclidean="Euclidean"}(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"}(l||(l={})),function(e){e.CommonItems="Common Items"}(c||(c={}))},2780:(e,t,n)=>{"use strict";n.d(t,{xL:()=>i.xL});var i=n(8498);n(9336)},9336:(e,t,n)=>{"use strict";var i=n(2787),r=n(944),s=n(6295),o=n(3629),a=n(6863),l=n(8498);const c={[l.Pn.Euclidean]:o.ou},u={[l.xL.Levenshtein]:i.I,[l.xL.JaroWinkler]:r.Vb,[l.xL.Manhattan]:function(e,t){if(e.length!==t.length)return 1;{let n=0;for(let i=1;i<e.length;i++)n+=e[i]==t[i]?0:1;return n/e.length}},[l.xL.Onehot]:function(e,t){return e===t?0:1}},h={[l.aT.Tanimoto]:s.tO,[l.aT.Dice]:s.zn,[l.aT.Asymmetric]:s.gt,[l.aT.BraunBlanquet]:s.ij,[l.aT.Cosine]:s.lO,[l.aT.Kulczynski]:s.rR,[l.aT.McConnaughey]:s.lP,[l.aT.RogotGoldberg]:s.TK,[l.aT.Russel]:s.yK,[l.aT.Sokal]:s.Ii,[l.aT.Hamming]:s.be,[l.aT.Euclidean]:s.a4},d={[l.m6.TanimotoIntArray]:s.v_},p={[l.RR.Difference]:s.T6},m={[l.Wn.CommonItems]:s.Hr},f={[l.EG.Vector]:{[l.Pn.Euclidean]:c[l.Pn.Euclidean]},[l.EG.String]:{[l.xL.Levenshtein]:u[l.xL.Levenshtein],[l.xL.JaroWinkler]:u[l.xL.JaroWinkler],[l.xL.Manhattan]:u[l.xL.Manhattan],[l.xL.Onehot]:u[l.xL.Onehot]},[l.EG.BitArray]:{[l.aT.Tanimoto]:h[l.aT.Tanimoto],[l.aT.Dice]:h[l.aT.Dice],[l.aT.Asymmetric]:h[l.aT.Asymmetric],[l.aT.BraunBlanquet]:h[l.aT.BraunBlanquet],[l.aT.Cosine]:h[l.aT.Cosine],[l.aT.Kulczynski]:h[l.aT.Kulczynski],[l.aT.McConnaughey]:h[l.aT.McConnaughey],[l.aT.RogotGoldberg]:h[l.aT.RogotGoldberg],[l.aT.Russel]:h[l.aT.Russel],[l.aT.Sokal]:h[l.aT.Sokal]},[l.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]},[l.EG.Number]:{[l.RR.Difference]:p[l.RR.Difference]},[l.EG.IntArray]:{[l.m6.TanimotoIntArray]:d[l.m6.TanimotoIntArray]},[l.EG.NumberArray]:{[l.Wn.CommonItems]:m[l.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:()=>i});class i{constructor(e,t=!1){if(this._length=0,this._version=0,this._updateLevel=0,this._selectedCount=0,this._selectedCountVersion=-1,this._selectedIndexesVersion=-1,this._versionedName="",this._versionedNameVersion=-1,this.SHRINK_THRESHOLD=256,"number"==typeof e){const n=e,r=i._createBuffer(n);if(t)for(let e=0;e<r.length;e++)r[e]=-1;this._data=r,this._length=n}else{if(!(e instanceof Uint32Array))throw new Error("Invalid constructor");this._data=e,this._length=t}}getRawData(){return this._data}assureGoez(e,t){if(e<0)throw new Error(`${t} should be greater than zero`)}assureInRange(e,t,n,i){if(e<t||e>n)throw new Error(`Argument ${i} (${e}) out of range (${t}, ${n})`)}copy(e,t,n){for(let i=0;i<n;i++)t[i]=e[i]}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 i(e._length);n._length=e._length,n._data=i._createBuffer(n._length),n._version=0;const r=e.lengthInInts;for(let i=0;i<r;i++)n._data[i]=e._data[i]&t._data[i];return n}static _createBuffer(e){return new Uint32Array(Math.floor((e+31)/32))}static fromValues(e){const t=new i(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 i(e);for(let i=0;i<e;++i)n.setBit(i,t(i));return n._version=0,n}static fromString(e){return i.fromSeq(e.length,(t=>"1"==e.charAt(t)))}static fromUint32Array(e,t){const n=new i(e);return n._data=t,n}static fromBytes(e){const t=e.length,n=new i(8*t);n._data=new Uint32Array(Math.floor((t+3)/4)),n._length=8*t;let r=0,s=0;for(;t-s>=4;)n._data[r++]=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[r]=(255&e[s+2])<<16),t-s==2&&(n._data[r]|=(255&e[s+1])<<8),t-s==1&&(n._data[r]|=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 i(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,i=this.lengthInInts;for(let e=0;e<i;e++)this._data[e]=n;this.incrementVersion(t)}setIndexes(e,t=!0,n=!0,i=!0){n&&this.setAll(!t,!1);for(const n of e)this.setFast(n,t);this.incrementVersion(i)}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,i=!0,r=!0){if(n&&r&&this.setAll(!t,!1),r)for(let n=0;n<this._length;n++)e(n)&&this.setFast(n,t);else for(let n=0;n<this._length;n++)this.setFast(n,e(n)?t:!t);this.incrementVersion(i)}getRange(e,t){this.assureInRange(e,0,this._length-1,"from"),this.assureInRange(t,0,this._length,"to");const n=[];for(let i=e;i<t;++i)n.push(this.getBit(i));return i.fromValues(n)}getRangeAsList(e,t){this.assureInRange(e,0,this._length-1,"from"),this.assureInRange(t,0,this._length,"to");const n=[];for(let i=e;i<t;++i)n.push(this.getBit(i));return n}setRange(e,t,n,i=!0){this.assureInRange(e,0,this._length-1,"from"),this.assureInRange(t,0,this._length-1,"to");const r=Math.min(e,t),s=Math.max(e,t);if(n)for(let e=r;e<=s;e++)this.setTrue(e);else for(let e=r;e<=s;e++)this.setFalse(e);return this.incrementVersion(i),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 i=this._length;this.setLength(this._length+t);for(let n=i-1;n>=e;n--)this.setBit(n+t,this.getBit(n));for(let i=e;i<e+t;i++)this.setBit(i,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 i=-1;-1!=(i=e.findNext(i,!t));)this.setFast(n++,this.getBit(i));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+=i._onBitCount[255&e];let n=this._data[t];const r=31&this._length;for(0!=r&&(n&=~(4294967295<<r));0!=n;n>>>=8)this._selectedCount+=i._onBitCount[255&n];this._selectedCountVersion=this._version}return e?this._selectedCount:this._length-this._selectedCount}countWhere(e){let t=0;if(this.trueCount()==this._length)for(let n=0;n<this._length;n++)t+=e(n)?1:0;else for(let n=-1;-1!=(n=this.findNext(n,!0));)t+=e(n)?1:0;return t}andWithCountBits(e,t){if(0==this._length)return 0;let n=0;const r=this.lengthInInts;let s=0;for(;s<r-1;s++)for(let t=this._data[s]&e._data[s];0!=t;t>>>=8)n+=i._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+=i._onBitCount[255&o];return t?n:this._length-n}clear(){this.setLength(0)}contains(e){return this.findNext(-1,e)>=0}get allTrue(){return this.countBits(!0)==this._length}get allFalse(){return this.countBits(!1)==this._length}get anyTrue(){return this.countBits(!0)>0}get anyFalse(){return this.countBits(!1)>0}findNext(e,t=!0){if(this.assureInRange(e,-1,this._length,"index"),e>=this._length-1)return-1;let n=31&(e=e<0?0:e+1);const r=this.lengthInInts;for(let s=Math.floor(e/32);s<r;s++){let r=t?this._data[s]:~this._data[s];if(0!=n)r&=4294967295<<n&4294967295,n=0;else if(!t&&-4294967296==r)continue;for(let t=0;0!=r;t+=8,r>>>=8){const n=i._firstOnBit[255&r];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 r=Math.floor(e/32);r>=0;r--){let e=t?this._data[r]:~this._data[r];0!=n&&(e&=~(4294967295<<n),n=0);for(let t=24;0!=e;t-=8,e<<=8){const n=i._lastOnBit[e>>>24];if(n>=0)return n+32*r+t}}return-1}}i._onBitCount=Int8Array.from([0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4,1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7,1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7,3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7,4,5,5,6,5,6,6,7,5,6,6,7,6,7,7,8]),i._firstOnBit=Int8Array.from([-1,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,6,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,7,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,6,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0]),i._lastOnBit=Int8Array.from([-1,0,1,1,2,2,2,2,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7])},8070:(e,t,n)=>{"use strict";n.d(t,{cb:()=>a,PE:()=>o}),n(4328);var i=n(6082);n(9982),i.DataFrame.fromCsv('countries,fasta,smiles,molregno,LON,Zip Code,Street Address Line 1,ImageUrl,user_id,error_message,xray,flag,magnitude,CS-id,pdb_id,accel_a,time_offset,chart,fit,Questions,empty_number,empty_string\nBelgium,MSNFHNEHVMQFYRNNLKTKGVFGRQ,CC(C(=O)OCCCc1cccnc1)c2cccc(c2)C(=O)c3ccccc3,1480014,36.276729583740234,995042300,14016 ROUTE 31W,https://datagrok.ai/img/slides/access-db-connect.png,id,ErrorMessage,"COMPND \nATOM \nEND",flag,1,1,1QBS,1,1.23,<chart></chart>,"{""series"":[{""name"":""Run:2023-08-08"",""fitFunction"":""sigmoid"",""fitLineColor"":""#1f77b4"",""pointColor"":""#1f77b4"",""showPoints"":""points"",""parameters"":[2.497360340644872, 1.7058694986686864, 5.278052678195135, 0.16000320889028383],""points"":[{""x"":0.10000000149011612,""y"":2.374499797821045},{""x"":0.6000000238418579,""y"":2.6242473125457764},{""x"":1.100000023841858,""y"":2.367267608642578},{""x"":1.600000023841858,""y"":2.6723148822784424},{""x"":2.0999999046325684,""y"":2.6537344455718994},{""x"":2.5999999046325684,""y"":2.3651671409606934},{""x"":3.0999999046325684,""y"":2.5654284954071045},{""x"":3.5999999046325684,""y"":2.4160959720611572},{""x"":4.099999904632568,""y"":2.286726713180542},{""x"":4.599999904632568,""y"":2.5100042819976807},{""x"":5.099999904632568,""y"":1.6676985025405884},{""x"":5.599999904632568,""y"":0.680136501789093},{""x"":6.099999904632568,""y"":0.3391543924808502},{""x"":6.599999904632568,""y"":0.09038983285427094},{""x"":7.099999904632568,""y"":0.19802775979042053}]},{""name"":""Run:2023-08-08"",""fitLineColor"":""#ffbb78"",""pointColor"":""#ffbb78"",""showPoints"":""points"",""parameters"":[7.525235855508179, 1.3186911876809984, 5.335672608564294, 0.7860743343958098],""points"":[{""x"":0.10000000149011612,""y"":7.988070487976074},{""x"":0.6000000238418579,""y"":7.018453121185303},{""x"":1.100000023841858,""y"":8.115279197692871},{""x"":1.600000023841858,""y"":7.486658096313477},{""x"":2.0999999046325684,""y"":7.396438121795654},{""x"":2.5999999046325684,""y"":7.477052211761475},{""x"":3.0999999046325684,""y"":6.913095474243164},{""x"":3.5999999046325684,""y"":8.01385498046875},{""x"":4.099999904632568,""y"":6.985900402069092},{""x"":4.599999904632568,""y"":6.970335960388184},{""x"":5.099999904632568,""y"":5.448817253112793},{""x"":5.599999904632568,""y"":2.5534818172454834},{""x"":6.099999904632568,""y"":1.893947958946228},{""x"":6.599999904632568,""y"":0.6340042352676392},{""x"":7.099999904632568,""y"":0.8403874039649963}]}],""chartOptions"":{""xAxisName"":""Conc."",""yAxisName"":""Activity"",""title"":""Dose-Response curves""}}",text,100,abc\nBurundi,MDYKETLLMPKTDFPMRGGLPNKEPQIQEKW,COc1ccc2cc(ccc2c1)C(C)C(=O)Oc3ccc(C)cc3OC,1480015,36.276729583740234,995073444,80 STATE HIGHWAY 310,https://datagrok.ai/img/slides/access-db-connect.png,id,ErrorMessage,"COMPND \nATOM \nEND",flag,2,2,1ZP8,2,1.23,<chart></chart>,"{""series"":[{""name"":""Run:2023-08-08"",""fitFunction"":""sigmoid"",""fitLineColor"":""#1f77b4"",""pointColor"":""#1f77b4"",""showPoints"":""points"",""parameters"":[4.431460753103398, 2.1691498799246745, 5.266445597102774, 0.7825762827017926],""points"":[{""x"":0.10000000149011612,""y"":4.751083850860596},{""x"":0.6000000238418579,""y"":4.203000068664551},{""x"":1.100000023841858,""y"":4.415858745574951},{""x"":1.600000023841858,""y"":4.68414306640625},{""x"":2.0999999046325684,""y"":4.198400974273682},{""x"":2.5999999046325684,""y"":4.179222106933594},{""x"":3.0999999046325684,""y"":4.638473987579346},{""x"":3.5999999046325684,""y"":4.708553314208984},{""x"":4.099999904632568,""y"":4.291589260101318},{""x"":4.599999904632568,""y"":4.038082599639893},{""x"":5.099999904632568,""y"":3.4349939823150635},{""x"":5.599999904632568,""y"":1.2194708585739136},{""x"":6.099999904632568,""y"":1.1920831203460693},{""x"":6.599999904632568,""y"":0.5352635979652405},{""x"":7.099999904632568,""y"":0.3346920311450958}]},{""name"":""Run:2023-08-08"",""fitLineColor"":""#ffbb78"",""pointColor"":""#ffbb78"",""showPoints"":""points"",""parameters"":[2.339458017970126, -1.0734184310171178, 4.746332950550934, 0.2482416857595658],""points"":[{""x"":0.10000000149011612,""y"":0.2139337658882141},{""x"":0.6000000238418579,""y"":0.4269562065601349},{""x"":1.100000023841858,""y"":0.2441573292016983},{""x"":1.600000023841858,""y"":0.146635964512825},{""x"":2.0999999046325684,""y"":0.08818462491035461},{""x"":2.5999999046325684,""y"":0.2560656666755676},{""x"":3.0999999046325684,""y"":0.42434045672416687},{""x"":3.5999999046325684,""y"":0.37111231684684753},{""x"":4.099999904632568,""y"":0.5581737160682678},{""x"":4.599999904632568,""y"":1.183590054512024},{""x"":5.099999904632568,""y"":1.5629843473434448},{""x"":5.599999904632568,""y"":2.3211288452148438},{""x"":6.099999904632568,""y"":2.229961633682251},{""x"":6.599999904632568,""y"":2.2560226917266846},{""x"":7.099999904632568,""y"":2.2142398357391357}]}],""chartOptions"":{""xAxisName"":""Conc."",""yAxisName"":""Activity"",""title"":""Dose-Response curves""}}",text,,\nCameroon,MIEVFLFGIVLGLIPITLAGLFVTAYLQYRRGDQLDL,COc1ccc2cc(ccc2c1)C(C)C(=O)OCCCc3cccnc3,1480016,36.26095962524414,995153596,30-56 WHITESTONE EXPY,https://datagrok.ai/img/slides/access-db-connect.png,id,ErrorMessage,"COMPND \nATOM \nEND",flag,3,3,2BDJ,3,1.23,<chart></chart>,"{""series"":[{""name"":""Run:2023-08-08"",""fitFunction"":""sigmoid"",""fitLineColor"":""#1f77b4"",""pointColor"":""#1f77b4"",""showPoints"":""points"",""parameters"":[4.6760652578642325, 0.9046956320756703, 5.651408971856738, 0.07738846012184185],""points"":[{""x"":0.10000000149011612,""y"":4.32425594329834},{""x"":0.6000000238418579,""y"":4.668442249298096},{""x"":1.100000023841858,""y"":4.379785060882568},{""x"":1.600000023841858,""y"":5.0345139503479},{""x"":2.0999999046325684,""y"":4.878653526306152},{""x"":2.5999999046325684,""y"":4.3451313972473145},{""x"":3.0999999046325684,""y"":4.336992263793945},{""x"":3.5999999046325684,""y"":5.037430286407471},{""x"":4.099999904632568,""y"":5.0092692375183105},{""x"":4.599999904632568,""y"":4.151902675628662},{""x"":5.099999904632568,""y"":3.4066951274871826},{""x"":5.599999904632568,""y"":2.3732759952545166},{""x"":6.099999904632568,""y"":1.673728108406067},{""x"":6.599999904632568,""y"":0.48574790358543396},{""x"":7.099999904632568,""y"":0.2783052325248718}]},{""name"":""Run:2023-08-08"",""fitLineColor"":""#ffbb78"",""pointColor"":""#ffbb78"",""showPoints"":""points"",""parameters"":[2.938395863010111, -1.4658480661392117, 5.462702751996584, 0.3473139023615039],""points"":[{""x"":0.10000000149011612,""y"":0.4941710829734802},{""x"":0.6000000238418579,""y"":0.15323974192142487},{""x"":1.100000023841858,""y"":0.46373432874679565},{""x"":1.600000023841858,""y"":0.3370431363582611},{""x"":2.0999999046325684,""y"":0.5179030299186707},{""x"":2.5999999046325684,""y"":0.27899765968322754},{""x"":3.0999999046325684,""y"":0.22075064480304718},{""x"":3.5999999046325684,""y"":0.5789918899536133},{""x"":4.099999904632568,""y"":0.21169911324977875},{""x"":4.599999904632568,""y"":0.27857646346092224},{""x"":5.099999904632568,""y"":1.0906332731246948},{""x"":5.599999904632568,""y"":1.8520300388336182},{""x"":6.099999904632568,""y"":2.7177059650421143},{""x"":6.599999904632568,""y"":2.8680918216705322},{""x"":7.099999904632568,""y"":3.2413077354431152}]}],""chartOptions"":{""xAxisName"":""Conc."",""yAxisName"":""Activity"",""title"":""Dose-Response curves""}}",text,,\nCanada,MMELVLKTIIGPIVVGVVLRIVDKWLNKDK,CC(C(=O)NCCS)c1cccc(c1)C(=O)c2ccccc2,1480017,36.26095962524414,99515,30-56 WHITESTONE EXPY,https://datagrok.ai/img/slides/access-db-connect.png,id,ErrorMessage,"COMPND \nATOM \nEND",flag,4,4,1IAN,4,1.23,<chart></chart>,"{""series"":[{""name"":""Run:2023-08-08"",""fitFunction"":""sigmoid"",""fitLineColor"":""#1f77b4"",""pointColor"":""#1f77b4"",""showPoints"":""points"",""parameters"":[0.8597390975430008, 1.0957625732481946, 5.260537067987958, 0.07974187998177736],""points"":[{""x"":0.10000000149011612,""y"":0.8190152645111084},{""x"":0.6000000238418579,""y"":0.8421689867973328},{""x"":1.100000023841858,""y"":0.8740922212600708},{""x"":1.600000023841858,""y"":0.8924275040626526},{""x"":2.0999999046325684,""y"":0.8249067664146423},{""x"":2.5999999046325684,""y"":0.9327669143676758},{""x"":3.0999999046325684,""y"":0.8522974252700806},{""x"":3.5999999046325684,""y"":0.8174492716789246},{""x"":4.099999904632568,""y"":0.8394647240638733},{""x"":4.599999904632568,""y"":0.7139387726783752},{""x"":5.099999904632568,""y"":0.5561167597770691},{""x"":5.599999904632568,""y"":0.3276226818561554},{""x"":6.099999904632568,""y"":0.12479474395513535},{""x"":6.599999904632568,""y"":0.13006797432899475},{""x"":7.099999904632568,""y"":0.059702079743146896}]},{""name"":""Run:2023-08-08"",""fitLineColor"":""#ffbb78"",""pointColor"":""#ffbb78"",""showPoints"":""points"",""parameters"":[5.760930219582546, 1.6591793293833013, 4.667155929720851, 0.7858109544121652],""points"":[{""x"":0.10000000149011612,""y"":6.156993389129639},{""x"":0.6000000238418579,""y"":5.236701965332031},{""x"":1.100000023841858,""y"":6.010560512542725},{""x"":1.600000023841858,""y"":5.495512962341309},{""x"":2.0999999046325684,""y"":6.087770462036133},{""x"":2.5999999046325684,""y"":5.79986572265625},{""x"":3.0999999046325684,""y"":5.597546577453613},{""x"":3.5999999046325684,""y"":5.520902156829834},{""x"":4.099999904632568,""y"":5.360654354095459},{""x"":4.599999904632568,""y"":3.5539746284484863},{""x"":5.099999904632568,""y"":1.577236294746399},{""x"":5.599999904632568,""y"":1.0001264810562134},{""x"":6.099999904632568,""y"":0.9305797815322876},{""x"":6.599999904632568,""y"":0.6033638715744019},{""x"":7.099999904632568,""y"":0.4203685522079468}]}],""chartOptions"":{""xAxisName"":""Conc."",""yAxisName"":""Activity"",""title"":""Dose-Response curves""}}",text,,\nColombia,MDRTDEVSNHTHDKPTLTWFEEIFEEYHSPFHN,FC(F)(F)c1ccc(OC2CCNCC2)cc1,1480029,36.3309440612793,995152050,1 COURT HOUSE SQUARE,https://datagrok.ai/img/slides/access-db-connect.png,id,ErrorMessage,"COMPND \nATOM \nEND",flag,5,5,4UJ1,5,1.23,<chart></chart>,"{""series"":[{""name"":""Run:2023-08-08"",""fitFunction"":""sigmoid"",""fitLineColor"":""#1f77b4"",""pointColor"":""#1f77b4"",""showPoints"":""points"",""parameters"":[6.4995088314153655, 2.4270351004539914, 5.178659535348579, 0.625653346241577],""points"":[{""x"":0.10000000149011612,""y"":6.496231555938721},{""x"":0.6000000238418579,""y"":6.42543363571167},{""x"":1.100000023841858,""y"":7.040063858032227},{""x"":1.600000023841858,""y"":6.1115403175354},{""x"":2.0999999046325684,""y"":6.680728435516357},{""x"":2.5999999046325684,""y"":6.406774520874023},{""x"":3.0999999046325684,""y"":6.611269474029541},{""x"":3.5999999046325684,""y"":5.889094352722168},{""x"":4.099999904632568,""y"":6.75344705581665},{""x"":4.599999904632568,""y"":6.361435890197754},{""x"":5.099999904632568,""y"":4.1666975021362305},{""x"":5.599999904632568,""y"":1.172118902206421},{""x"":6.099999904632568,""y"":0.801048994064331},{""x"":6.599999904632568,""y"":0.4640021026134491},{""x"":7.099999904632568,""y"":0.0010357667924836278}]},{""name"":""Run:2023-08-08"",""fitLineColor"":""#ffbb78"",""pointColor"":""#ffbb78"",""showPoints"":""points"",""parameters"":[1.4734381347446401, 1.1649805188074196, 4.82958608866421, 0.09500545496710007],""points"":[{""x"":0.10000000149011612,""y"":1.5279096364974976},{""x"":0.6000000238418579,""y"":1.3559974431991577},{""x"":1.100000023841858,""y"":1.5246378183364868},{""x"":1.600000023841858,""y"":1.5567657947540283},{""x"":2.0999999046325684,""y"":1.4114240407943726},{""x"":2.5999999046325684,""y"":1.4045010805130005},{""x"":3.0999999046325684,""y"":1.4769829511642456},{""x"":3.5999999046325684,""y"":1.4875500202178955},{""x"":4.099999904632568,""y"":1.2991987466812134},{""x"":4.599999904632568,""y"":0.922961413860321},{""x"":5.099999904632568,""y"":0.6520044803619385},{""x"":5.599999904632568,""y"":0.15350978076457977},{""x"":6.099999904632568,""y"":0.1078903079032898},{""x"":6.599999904632568,""y"":0.17276449501514435},{""x"":7.099999904632568,""y"":0.14066608250141144}]}],""chartOptions"":{""xAxisName"":""Conc."",""yAxisName"":""Activity"",""title"":""Dose-Response curves""}}",text,,\nCosta Rica,MKSTKEEIQTIKTLLKDSRTAKYHKRLQIVL,CC(C)Cc1ccc(cc1)C(C)C(=O)N2CCCC2C(=O)OCCCc3ccccc3,1480018,36.3309440612793,995084218,4041 SOUTHWESTERN BLVD,https://datagrok.ai/img/slides/access-db-connect.png,id,ErrorMessage,"COMPND \nATOM \nEND",flag,6,6,2BPW,6,1.23,<chart></chart>,"{""series"":[{""name"":""Run:2023-08-08"",""fitFunction"":""sigmoid"",""fitLineColor"":""#1f77b4"",""pointColor"":""#1f77b4"",""showPoints"":""points"",""parameters"":[2.4833641843311227, -1.8945978742090062, 4.671127708092568, 0.24159861311815153],""points"":[{""x"":0.10000000149011612,""y"":0.0969524160027504},{""x"":0.6000000238418579,""y"":0.028483040630817413},{""x"":1.100000023841858,""y"":0.22087176144123077},{""x"":1.600000023841858,""y"":0.0068915546871721745},{""x"":2.0999999046325684,""y"":0.4305879771709442},{""x"":2.5999999046325684,""y"":0.44774115085601807},{""x"":3.0999999046325684,""y"":0.45346319675445557},{""x"":3.5999999046325684,""y"":0.2370593100786209},{""x"":4.099999904632568,""y"":0.4657953977584839},{""x"":4.599999904632568,""y"":1.155200719833374},{""x"":5.099999904632568,""y"":2.2294070720672607},{""x"":5.599999904632568,""y"":2.4311530590057373},{""x"":6.099999904632568,""y"":2.33846116065979},{""x"":6.599999904632568,""y"":2.608201026916504},{""x"":7.099999904632568,""y"":2.8136143684387207}]},{""name"":""Run:2023-08-08"",""fitLineColor"":""#ffbb78"",""pointColor"":""#ffbb78"",""showPoints"":""points"",""parameters"":[5.224573521642033, 1.4454033924198528, 5.6014197746076535, 0.2823216054197577],""points"":[{""x"":0.10000000149011612,""y"":4.95027494430542},{""x"":0.6000000238418579,""y"":5.1754679679870605},{""x"":1.100000023841858,""y"":5.276752948760986},{""x"":1.600000023841858,""y"":5.589294910430908},{""x"":2.0999999046325684,""y"":5.616994857788086},{""x"":2.5999999046325684,""y"":5.120813846588135},{""x"":3.0999999046325684,""y"":5.340766906738281},{""x"":3.5999999046325684,""y"":4.876471042633057},{""x"":4.099999904632568,""y"":4.94999361038208},{""x"":4.599999904632568,""y"":5.162564754486084},{""x"":5.099999904632568,""y"":4.399557590484619},{""x"":5.599999904632568,""y"":2.7977969646453857},{""x"":6.099999904632568,""y"":1.0229872465133667},{""x"":6.599999904632568,""y"":0.48275601863861084},{""x"":7.099999904632568,""y"":0.10408931970596313}]}],""chartOptions"":{""xAxisName"":""Conc."",""yAxisName"":""Activity"",""title"":""Dose-Response curves""}}",text,,\nCuba,MHAILRYFIRRLFYHIFYKIYSLISKKHQSLPSDVRQF,COc1ccc2c(c1)c(CC(=O)N3CCCC3C(=O)Oc4ccc(C)cc4OC)c(C)n2C(=O)c5ccc(Cl)cc5,1480019,36.33115768432617,995081928,1227 US HIGHWAY 11,https://datagrok.ai/img/slides/access-db-connect.png,id,ErrorMessage,"COMPND \nATOM \nEND",flag,7,7,1QBS,7,1.23,<chart></chart>,"{""series"":[{""name"":""Run:2023-08-08"",""fitFunction"":""sigmoid"",""fitLineColor"":""#1f77b4"",""pointColor"":""#1f77b4"",""showPoints"":""points"",""parameters"":[3.320838679713925, -1.2421619987316728, 4.831325425225256, 0.3236011098403072],""points"":[{""x"":0.10000000149011612,""y"":0.3727470338344574},{""x"":0.6000000238418579,""y"":0.12365014106035233},{""x"":1.100000023841858,""y"":0.48422467708587646},{""x"":1.600000023841858,""y"":0.2264465093612671},{""x"":2.0999999046325684,""y"":0.16821794211864471},{""x"":2.5999999046325684,""y"":0.3879014551639557},{""x"":3.0999999046325684,""y"":0.5470244884490967},{""x"":3.5999999046325684,""y"":0.3419053554534912},{""x"":4.099999904632568,""y"":0.7655120491981506},{""x"":4.599999904632568,""y"":1.2346516847610474},{""x"":5.099999904632568,""y"":2.453336715698242},{""x"":5.599999904632568,""y"":2.9565491676330566},{""x"":6.099999904632568,""y"":3.335299491882324},{""x"":6.599999904632568,""y"":3.240290880203247},{""x"":7.099999904632568,""y"":3.1107218265533447}]},{""name"":""Run:2023-08-08"",""fitLineColor"":""#ffbb78"",""pointColor"":""#ffbb78"",""showPoints"":""points"",""parameters"":[3.6401853521511094, 1.26211588875013, 5.399028074402744, 0.5089580830068091],""points"":[{""x"":0.10000000149011612,""y"":3.8585598468780518},{""x"":0.6000000238418579,""y"":3.6077206134796143},{""x"":1.100000023841858,""y"":3.855252265930176},{""x"":1.600000023841858,""y"":3.619039297103882},{""x"":2.0999999046325684,""y"":3.839388370513916},{""x"":2.5999999046325684,""y"":3.335283041000366},{""x"":3.0999999046325684,""y"":3.571141481399536},{""x"":3.5999999046325684,""y"":3.4155046939849854},{""x"":4.099999904632568,""y"":3.7316646575927734},{""x"":4.599999904632568,""y"":3.0680155754089355},{""x"":5.099999904632568,""y"":2.891066551208496},{""x"":5.599999904632568,""y"":1.6022753715515137},{""x"":6.099999904632568,""y"":0.7652576565742493},{""x"":6.599999904632568,""y"":0.6875326037406921},{""x"":7.099999904632568,""y"":0.5828871726989746}]}],""chartOptions"":{""xAxisName"":""Conc."",""yAxisName"":""Activity"",""title"":""Dose-Response curves""}}",text,,\nItaly,MSNFHNEHVMQFYRNNLKTKGVFGRQ,CC(C)Cc1ccc(cc1)C(C)C(=O)N2CCCC2C(=O)OCCO[N+](=O)[O-],1480020,36.33115768432617,99502,"168-46 91ST AVE., 2ND FLR",https://datagrok.ai/img/slides/access-db-connect.png,id,ErrorMessage,"COMPND \nATOM \nEND",flag,8,8,1ZP8,8,1.23,<chart></chart>,"{""series"":[{""name"":""Run:2023-08-08"",""fitFunction"":""sigmoid"",""fitLineColor"":""#1f77b4"",""pointColor"":""#1f77b4"",""showPoints"":""points"",""parameters"":[2.293592105923809, 1.3781586549141835, 5.1025898038676605, 0.03493851245291291],""points"":[{""x"":0.10000000149011612,""y"":2.1287283897399902},{""x"":0.6000000238418579,""y"":2.267972230911255},{""x"":1.100000023841858,""y"":2.398442506790161},{""x"":1.600000023841858,""y"":2.5130622386932373},{""x"":2.0999999046325684,""y"":2.3255116939544678},{""x"":2.5999999046325684,""y"":2.127340793609619},{""x"":3.0999999046325684,""y"":2.47259783744812},{""x"":3.5999999046325684,""y"":2.131181478500366},{""x"":4.099999904632568,""y"":2.090421438217163},{""x"":4.599999904632568,""y"":2.02299165725708},{""x"":5.099999904632568,""y"":1.1105059385299683},{""x"":5.599999904632568,""y"":0.4494485855102539},{""x"":6.099999904632568,""y"":0.1375635862350464},{""x"":6.599999904632568,""y"":0.036351121962070465},{""x"":7.099999904632568,""y"":0.1619771122932434}]},{""name"":""Run:2023-08-08"",""fitLineColor"":""#ffbb78"",""pointColor"":""#ffbb78"",""showPoints"":""points"",""parameters"":[5.953125499439879, 1.2528620255306528, 5.187637440149802, 0.3110348753260886],""points"":[{""x"":0.10000000149011612,""y"":5.6585283279418945},{""x"":0.6000000238418579,""y"":5.911152362823486},{""x"":1.100000023841858,""y"":5.924920082092285},{""x"":1.600000023841858,""y"":5.8469438552856445},{""x"":2.0999999046325684,""y"":5.929472923278809},{""x"":2.5999999046325684,""y"":6.190037727355957},{""x"":3.0999999046325684,""y"":6.236179828643799},{""x"":3.5999999046325684,""y"":6.141019344329834},{""x"":4.099999904632568,""y"":5.295210838317871},{""x"":4.599999904632568,""y"":5.265801906585693},{""x"":5.099999904632568,""y"":3.3722851276397705},{""x"":5.599999904632568,""y"":1.8299226760864258},{""x"":6.099999904632568,""y"":0.32690900564193726},{""x"":6.599999904632568,""y"":0.6274543404579163},{""x"":7.099999904632568,""y"":0.8441857099533081}]}],""chartOptions"":{""xAxisName"":""Conc."",""yAxisName"":""Activity"",""title"":""Dose-Response curves""}}",text,,\nRwanda,MPNSEPASLLELFNSIATQGELVRSLKAGNASK,CC(C)Cc1ccc(cc1)C(C)C(=O)N2CCCC2C(=O)OCCO,1480021,36.33137130737305,995037247,"168-46 91ST AVE., 2ND FLR",https://datagrok.ai/img/slides/access-db-connect.png,id,ErrorMessage,"COMPND \nATOM \nEND",flag,9,9,2BDJ,9,1.23,<chart></chart>,"{""series"":[{""name"":""Run:2023-08-08"",""fitFunction"":""sigmoid"",""fitLineColor"":""#1f77b4"",""pointColor"":""#1f77b4"",""showPoints"":""points"",""parameters"":[3.8209972202654474, 1.3779216716448506, 5.299882228439686, 0.06040645519069608],""points"":[{""x"":0.10000000149011612,""y"":3.7821109294891357},{""x"":0.6000000238418579,""y"":3.542433023452759},{""x"":1.100000023841858,""y"":3.7008674144744873},{""x"":1.600000023841858,""y"":3.717301607131958},{""x"":2.0999999046325684,""y"":4.024452209472656},{""x"":2.5999999046325684,""y"":4.013899326324463},{""x"":3.0999999046325684,""y"":3.945094347000122},{""x"":3.5999999046325684,""y"":3.866621971130371},{""x"":4.099999904632568,""y"":3.7461626529693604},{""x"":4.599999904632568,""y"":3.3454740047454834},{""x"":5.099999904632568,""y"":2.61944317817688},{""x"":5.599999904632568,""y"":0.999405026435852},{""x"":6.099999904632568,""y"":0.46259793639183044},{""x"":6.599999904632568,""y"":0.054134611040353775},{""x"":7.099999904632568,""y"":0.05711187422275543}]},{""name"":""Run:2023-08-08"",""fitLineColor"":""#ffbb78"",""pointColor"":""#ffbb78"",""showPoints"":""points"",""parameters"":[5.6318079657726035, 1.8495493770000595, 5.391793312471116, 0.17060707587348442],""points"":[{""x"":0.10000000149011612,""y"":5.458079814910889},{""x"":0.6000000238418579,""y"":5.554427146911621},{""x"":1.100000023841858,""y"":5.799983024597168},{""x"":1.600000023841858,""y"":5.364140033721924},{""x"":2.0999999046325684,""y"":5.864485740661621},{""x"":2.5999999046325684,""y"":5.4509806632995605},{""x"":3.0999999046325684,""y"":5.702574729919434},{""x"":3.5999999046325684,""y"":5.7314534187316895},{""x"":4.099999904632568,""y"":5.5123443603515625},{""x"":4.599999904632568,""y"":5.724395751953125},{""x"":5.099999904632568,""y"":4.354506969451904},{""x"":5.599999904632568,""y"":1.7307666540145874},{""x"":6.099999904632568,""y"":0.6305936574935913},{""x"":6.599999904632568,""y"":0.035183437168598175},{""x"":7.099999904632568,""y"":0.7575169205665588}]}],""chartOptions"":{""xAxisName"":""Conc."",""yAxisName"":""Activity"",""title"":""Dose-Response curves""}}",text,,\nSwitzerland,IRVVGRYLIEVWKAAGMDMDKVLFLWSSDEI,CN1CCC(CC1)Oc2ccc(cc2)C(F)(F)F,1480028,36.33137130737305,99504,92-11 179TH PLACE,https://datagrok.ai/img/slides/access-db-connect.png,id,ErrorMessage,"COMPND \nATOM \nEND",flag,9,10,1IAN,10,1.23,<chart></chart>,"{""series"":[{""name"":""Run:2023-08-08"",""fitFunction"":""sigmoid"",""fitLineColor"":""#1f77b4"",""pointColor"":""#1f77b4"",""showPoints"":""points"",""parameters"":[1.1190255865097471, 2.3163895161544437, 5.4968866182279195, 0.2035204047289052],""points"":[{""x"":0.10000000149011612,""y"":1.1057683229446411},{""x"":0.6000000238418579,""y"":1.1019697189331055},{""x"":1.100000023841858,""y"":1.0818607807159424},{""x"":1.600000023841858,""y"":1.062997817993164},{""x"":2.0999999046325684,""y"":1.046447515487671},{""x"":2.5999999046325684,""y"":1.1217249631881714},{""x"":3.0999999046325684,""y"":1.2166996002197266},{""x"":3.5999999046325684,""y"":1.215477705001831},{""x"":4.099999904632568,""y"":1.0581893920898438},{""x"":4.599999904632568,""y"":1.1747995615005493},{""x"":5.099999904632568,""y"":1.0181127786636353},{""x"":5.599999904632568,""y"":0.5344523191452026},{""x"":6.099999904632568,""y"":0.2569526433944702},{""x"":6.599999904632568,""y"":0.1912207305431366},{""x"":7.099999904632568,""y"":0.15060538053512573}]},{""name"":""Run:2023-08-08"",""fitLineColor"":""#ffbb78"",""pointColor"":""#ffbb78"",""showPoints"":""points"",""parameters"":[3.1038581025805785, 2.0032224204185245, 5.087602825989163, 0.13277988512492753],""points"":[{""x"":0.10000000149011612,""y"":3.0498509407043457},{""x"":0.6000000238418579,""y"":2.805217742919922},{""x"":1.100000023841858,""y"":3.3415253162384033},{""x"":1.600000023841858,""y"":3.0549843311309814},{""x"":2.0999999046325684,""y"":3.250074863433838},{""x"":2.5999999046325684,""y"":3.0432586669921875},{""x"":3.0999999046325684,""y"":3.265852451324463},{""x"":3.5999999046325684,""y"":2.9475724697113037},{""x"":4.099999904632568,""y"":3.1929898262023926},{""x"":4.599999904632568,""y"":2.7460060119628906},{""x"":5.099999904632568,""y"":1.6175861358642578},{""x"":5.599999904632568,""y"":0.3006608486175537},{""x"":6.099999904632568,""y"":0.3444803059101105},{""x"":6.599999904632568,""y"":0.015537971630692482},{""x"":7.099999904632568,""y"":0.5527358055114746}]}],""chartOptions"":{""xAxisName"":""Conc."",""yAxisName"":""Activity"",""title"":""Dose-Response curves""}}",text,,\n,,,,,,,,,,,,,,,,,,,,,').columns.add(i.Column.fromList(i.TYPE.BYTE_ARRAY,"BinaryImage",Array.from(new Uint8Array(11))));var r,s=function(e,t,n,i){return new(n||(n=Promise))((function(r,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};function o(e,t,n,i=0,r="timeout"){return s(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(l)}})),l=setTimeout((()=>{a.unsubscribe(),o(r)}),i);n()}))}))}function a(e){return s(this,void 0,void 0,(function*(){yield new Promise((t=>setTimeout(t,e)))}))}console.log.bind(console),console.info.bind(console),console.warn.bind(console),console.error.bind(console),function(e){e.notNull=function(e,t){if(null==e)throw new Error(`${null==t?"Value":t} not defined`)}}(r||(r={})),i.DataFrame.fromColumns([i.Column.fromStrings("col",["val1","val2","val3"])])},3629:(e,t,n)=>{"use strict";function i(e=!1,t="Assertion error."){if(!e)throw new Error(t)}function r(e){let t=0;for(let n=0;n<e.length;n++)t+=e[n]*e[n];return Math.sqrt(t)}function s(e,t){if(e.length!=t.length)throw new Error("The dimensionality of the vectors must match");let n=0;for(let i=0;i<e.length;i++)n+=e[i]*t[i];return n}function o(e,t){let n=0;const i=e.length;if(i!==t.length)throw new Error("The dimensionality of the vectors must match");for(let r=0;r<i;++r)n+=Math.pow(e[r]-t[r],2);return Math.sqrt(n)}function a(e){const t=e.length;let n=0,i=0;for(let r=0;r<t;++r)n+=e[r],i+=Math.pow(e[r],2);const r=n/t,s=1/Math.sqrt(i/t-Math.pow(r,2));for(let n=0;n<t;++n)e[n]=(e[n]-r)*s;return e}n.d(t,{KE:()=>s,S8:()=>a,ou:()=>o,vA:()=>i,wQ:()=>r})},1913:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(3282),r=n(9029),s=n(1520),o=n(2586),a=n(8708),l=n(2023),c="errorMessage",u=new i.Name("emUsed"),h={required:"missingProperty",dependencies:"property",dependentRequired:"property"},d=/\$\{[^}]+\}/,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:c,schemaType:["string","object"],post:!0,code(t){const{gen:n,data:f,schema:g,schemaValue:y,it:b}=t;if(!1===b.createErrors)return;const v=g,w=r.strConcat(l.default.instancePath,b.errorPath);function C(e,t){return r.and(i._`${e}.keyword !== ${c}`,i._`!${e}.${u}`,i._`${e}.instancePath === ${w}`,i._`${e}.keyword in ${t}`,i._`${e}.schemaPath.indexOf(${b.errSchemaPath}) === 0`,i._`/^\\/[^\\/]*$/.test(${e}.schemaPath.slice(${b.errSchemaPath.length}))`)}function A(e,t){const i=[];for(const n in e){const e=t[n];d.test(e)&&i.push([n,x(e)])}return n.object(...i)}function S(e){return d.test(e)?new s._Code(s.safeStringify(e).replace(p,((e,t)=>`" + JSON.stringify(${o.getData(t,b)}) + "`)).replace(m,"")):i.stringify(e)}function x(e){return i._`function(){return ${S(e)}}`}n.if(i._`${l.default.errors} > 0`,(()=>{if("object"==typeof v){const[s,o]=function(e){let t,n;for(const i in e){if("properties"===i||"items"===i)continue;const r=e[i];if("object"==typeof r){t||(t={});const e=t[i]={};for(const t in r)e[t]=[]}else n||(n={}),n[i]=[]}return[t,n]}(v);o&&function(r){const s=n.const("emErrors",i.stringify(r)),o=n.const("templates",A(r,g));n.forOf("err",l.default.vErrors,(e=>n.if(C(e,s),(()=>n.code(i._`${s}[${e}.keyword].push(${e})`).assign(i._`${e}.${u}`,!0)))));const{singleError:c}=e;if(c){const e=n.let("message",i._`""`),r=n.let("paramsErrors",i._`[]`);h((t=>{n.if(e,(()=>n.code(i._`${e} += ${"string"==typeof c?c:";"}`))),n.code(i._`${e} += ${d(t)}`),n.assign(r,i._`${r}.concat(${s}[${t}])`)})),a.reportError(t,{message:e,params:i._`{errors: ${r}}`})}else h((e=>a.reportError(t,{message:d(e),params:i._`{errors: ${s}[${e}]}`})));function h(e){n.forIn("key",s,(t=>n.if(i._`${s}[${t}].length`,(()=>e(t)))))}function d(e){return i._`${e} in ${o} ? ${o}[${e}]() : ${y}[${e}]`}}(o),s&&function(e){const r=n.const("emErrors",i.stringify(e)),s=[];for(const t in e)s.push([t,A(e[t],g[t])]);const o=n.const("templates",n.object(...s)),c=n.scopeValue("obj",{ref:h,code:i.stringify(h)}),d=n.let("emPropParams"),p=n.let("emParamsErrors");n.forOf("err",l.default.vErrors,(e=>n.if(C(e,r),(()=>{n.assign(d,i._`${c}[${e}.keyword]`),n.assign(p,i._`${r}[${e}.keyword][${e}.params[${d}]]`),n.if(p,(()=>n.code(i._`${p}.push(${e})`).assign(i._`${e}.${u}`,!0)))})))),n.forIn("key",r,(e=>n.forIn("keyProp",i._`${r}[${e}]`,(s=>{n.assign(p,i._`${r}[${e}][${s}]`),n.if(i._`${p}.length`,(()=>{const r=n.const("tmpl",i._`${o}[${e}] && ${o}[${e}][${s}]`);a.reportError(t,{message:i._`${r} ? ${r}() : ${y}[${e}][${s}]`,params:i._`{errors: ${p}}`})}))}))))}(s),function(e){const{props:s,items:o}=e;if(!s&&!o)return;const h=i._`typeof ${f} == "object"`,d=i._`Array.isArray(${f})`,p=n.let("emErrors");let m,b;const v=n.let("templates");function C(e,t){n.assign(p,i.stringify(e)),n.assign(v,A(e,t))}s&&o?(m=n.let("emChildKwd"),n.if(h),n.if(d,(()=>{C(o,g.items),n.assign(m,i.str`items`)}),(()=>{C(s,g.properties),n.assign(m,i.str`properties`)})),b=i._`[${m}]`):o?(n.if(d),C(o,g.items),b=i._`.items`):s&&(n.if(r.and(h,r.not(d))),C(s,g.properties),b=i._`.properties`),n.forOf("err",l.default.vErrors,(e=>function(e,t,s){n.if(r.and(i._`${e}.keyword !== ${c}`,i._`!${e}.${u}`,i._`${e}.instancePath.indexOf(${w}) === 0`),(()=>{const r=n.scopeValue("pattern",{ref:/^\/([^/]*)(?:\/|$)/,code:i._`new RegExp("^\\\/([^/]*)(?:\\\/|$)")`}),o=n.const("emMatches",i._`${r}.exec(${e}.instancePath.slice(${w}.length))`),a=n.const("emChild",i._`${o} && ${o}[1].replace(/~1/g, "/").replace(/~0/g, "~")`);n.if(i._`${a} !== undefined && ${a} in ${t}`,(()=>s(a)))}))}(e,p,(t=>n.code(i._`${p}[${t}].push(${e})`).assign(i._`${e}.${u}`,!0))))),n.forIn("key",p,(e=>n.if(i._`${p}[${e}].length`,(()=>{a.reportError(t,{message:i._`${e} in ${v} ? ${v}[${e}]() : ${y}${b}[${e}]`,params:i._`{errors: ${p}[${e}]}`}),n.assign(i._`${l.default.vErrors}[${l.default.errors}-1].instancePath`,i._`${w} + "/" + ${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}(v))}const s="string"==typeof v?v:v._;s&&function(e){const s=n.const("emErrs",i._`[]`);n.forOf("err",l.default.vErrors,(e=>n.if(function(e){return r.and(i._`${e}.keyword !== ${c}`,i._`!${e}.${u}`,r.or(i._`${e}.instancePath === ${w}`,r.and(i._`${e}.instancePath.indexOf(${w}) === 0`,i._`${e}.instancePath[${w}.length] === "/"`)),i._`${e}.schemaPath.indexOf(${b.errSchemaPath}) === 0`,i._`${e}.schemaPath[${b.errSchemaPath}.length] === "/"`)}(e),(()=>n.code(i._`${s}.push(${e})`).assign(i._`${e}.${u}`,!0))))),n.if(i._`${s}.length`,(()=>a.reportError(t,{message:S(e),params:i._`{errors: ${s}}`})))}(s),e.keepErrors||function(){const e=n.const("emErrs",i._`[]`);n.forOf("err",l.default.vErrors,(t=>n.if(i._`!${t}.${u}`,(()=>n.code(i._`${e}.push(${t})`))))),n.assign(l.default.vErrors,e).assign(l.default.errors,i._`${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 i=n(4042),r=n(6105),s=n(6653),o=n(9572),a="https://json-schema.org/draft/2020-12/schema";class l extends i.default{constructor(e={}){super({...e,dynamicRef:!0,next:!0,unevaluated:!0})}_addVocabularies(){super._addVocabularies(),r.default.forEach((e=>this.addVocabulary(e))),this.opts.discriminator&&this.addKeyword(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=l,e.exports=t=l,e.exports.Ajv2020=l,Object.defineProperty(t,"__esModule",{value:!0}),t.default=l;var c=n(2586);Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return c.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 h=n(3558);Object.defineProperty(t,"ValidationError",{enumerable:!0,get:function(){return h.default}});var d=n(4551);Object.defineProperty(t,"MissingRefError",{enumerable:!0,get:function(){return d.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 i=n(4042),r=n(6144),s=n(6653),o=n(2079),a=["/properties"],l="http://json-schema.org/draft-07/schema";class c extends i.default{_addVocabularies(){super._addVocabularies(),r.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,l,!1),this.refs["http://json-schema.org/schema"]=l}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(l)?l:void 0)}}t.Ajv=c,e.exports=t=c,e.exports.Ajv=c,Object.defineProperty(t,"__esModule",{value:!0}),t.default=c;var u=n(2586);Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return u.KeywordCxt}});var h=n(9029);Object.defineProperty(t,"_",{enumerable:!0,get:function(){return h._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return h.str}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return h.stringify}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return h.nil}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return h.Name}}),Object.defineProperty(t,"CodeGen",{enumerable:!0,get:function(){return h.CodeGen}});var d=n(3558);Object.defineProperty(t,"ValidationError",{enumerable:!0,get:function(){return d.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 i 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=i;class r extends n{constructor(e){super(),this._items="string"==typeof e?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;const e=this._items[0];return""===e||'""'===e}get str(){var e;return null!==(e=this._str)&&void 0!==e?e:this._str=this._items.reduce(((e,t)=>`${e}${t}`),"")}get names(){var e;return null!==(e=this._names)&&void 0!==e?e:this._names=this._items.reduce(((e,t)=>(t instanceof i&&(e[t.str]=(e[t.str]||0)+1),e)),{})}}function s(e,...t){const n=[e[0]];let i=0;for(;i<t.length;)l(n,t[i]),n.push(e[++i]);return new r(n)}t._Code=r,t.nil=new r(""),t._=s;const o=new r("+");function a(e,...t){const n=[u(e[0])];let i=0;for(;i<t.length;)n.push(o),l(n,t[i]),n.push(o,u(e[++i]));return function(e){let t=1;for(;t<e.length-1;){if(e[t]===o){const n=c(e[t-1],e[t+1]);if(void 0!==n){e.splice(t-1,3,n);continue}e[t++]="+"}t++}}(n),new r(n)}function l(e,t){var n;t instanceof r?e.push(...t._items):t instanceof i?e.push(t):e.push("number"==typeof(n=t)||"boolean"==typeof n||null===n?n:u(Array.isArray(n)?n.join(","):n))}function c(e,t){if('""'===t)return e;if('""'===e)return t;if("string"==typeof e){if(t instanceof i||'"'!==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 i?void 0:`"${e}${t.slice(1)}`}function u(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}t.str=a,t.addCodeArg=l,t.strConcat=function(e,t){return t.emptyStr()?e:e.emptyStr()?t:a`${e}${t}`},t.stringify=function(e){return new r(u(e))},t.safeStringify=u,t.getProperty=function(e){return"string"==typeof e&&t.IDENTIFIER.test(e)?new r(`.${e}`):s`[${e}]`},t.getEsmExportName=function(e){if("string"==typeof e&&t.IDENTIFIER.test(e))return new r(`${e}`);throw new Error(`CodeGen: invalid export name: ${e}, use explicit $id name mapping`)},t.regexpCode=function(e){return new r(e.toString())}},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 i=n(1520),r=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 i._Code(">"),GTE:new i._Code(">="),LT:new i._Code("<"),LTE:new i._Code("<="),EQ:new i._Code("==="),NEQ:new i._Code("!=="),NOT:new i._Code("!"),OR:new i._Code("||"),AND:new i._Code("&&"),ADD:new i._Code("+")};class a{optimizeNodes(){return this}optimizeNames(e,t){return this}}class l extends a{constructor(e,t,n){super(),this.varKind=e,this.name=t,this.rhs=n}render({es5:e,_n:t}){const n=e?r.varKinds.var:this.varKind,i=void 0===this.rhs?"":` = ${this.rhs}`;return`${n} ${this.name}${i};`+t}optimizeNames(e,t){if(e[this.name.str])return this.rhs&&(this.rhs=$(this.rhs,e,t)),this}get names(){return this.rhs instanceof i._CodeOrName?this.rhs.names:{}}}class c extends a{constructor(e,t,n){super(),this.lhs=e,this.rhs=t,this.sideEffects=n}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,t){if(!(this.lhs instanceof i.Name)||e[this.lhs.str]||this.sideEffects)return this.rhs=$(this.rhs,e,t),this}get names(){return L(this.lhs instanceof i.Name?{}:{...this.lhs.names},this.rhs)}}class u extends c{constructor(e,t,n,i){super(e,n,i),this.op=t}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}}class h extends a{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}}class d extends a{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}}class 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=$(this.code,e,t),this}get names(){return this.code instanceof i._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 i=n.length;for(;i--;){const r=n[i];r.optimizeNames(e,t)||(N(e,r.names),n.splice(i,1))}return n.length>0?this:void 0}get names(){return this.nodes.reduce(((e,t)=>I(e,t.names)),{})}}class g extends f{render(e){return"{"+e._n+super.render(e)+"}"+e._n}}class y extends f{}class b extends g{}b.kind="else";class v extends g{constructor(e,t){super(t),this.condition=e}render(e){let t=`if(${this.condition})`+super.render(e);return this.else&&(t+="else "+this.else.render(e)),t}optimizeNodes(){super.optimizeNodes();const e=this.condition;if(!0===e)return this.nodes;let t=this.else;if(t){const e=t.optimizeNodes();t=this.else=Array.isArray(e)?new b(e):e}return t?!1===e?t instanceof v?t:t.nodes:this.nodes.length?this:new v(P(e),t instanceof v?[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=$(this.condition,e,t),this}get names(){const e=super.names;return L(e,this.condition),this.else&&I(e,this.else.names),e}}v.kind="if";class w extends g{}w.kind="for";class C extends w{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=$(this.iteration,e,t),this}get names(){return I(super.names,this.iteration.names)}}class A extends w{constructor(e,t,n,i){super(),this.varKind=e,this.name=t,this.from=n,this.to=i}render(e){const t=e.es5?r.varKinds.var:this.varKind,{name:n,from:i,to:s}=this;return`for(${t} ${n}=${i}; ${n}<${s}; ${n}++)`+super.render(e)}get names(){const e=L(super.names,this.from);return L(e,this.to)}}class S extends w{constructor(e,t,n,i){super(),this.loop=e,this.varKind=t,this.name=n,this.iterable=i}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=$(this.iterable,e,t),this}get names(){return I(super.names,this.iterable.names)}}class x 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)}}x.kind="func";class E extends f{render(e){return"return "+super.render(e)}}E.kind="return";class _ extends g{render(e){let t="try"+super.render(e);return this.catch&&(t+=this.catch.render(e)),this.finally&&(t+=this.finally.render(e)),t}optimizeNodes(){var e,t;return super.optimizeNodes(),null===(e=this.catch)||void 0===e||e.optimizeNodes(),null===(t=this.finally)||void 0===t||t.optimizeNodes(),this}optimizeNames(e,t){var n,i;return super.optimizeNames(e,t),null===(n=this.catch)||void 0===n||n.optimizeNames(e,t),null===(i=this.finally)||void 0===i||i.optimizeNames(e,t),this}get names(){const e=super.names;return this.catch&&I(e,this.catch.names),this.finally&&I(e,this.finally.names),e}}class M extends g{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}}M.kind="catch";class T extends g{render(e){return"finally"+super.render(e)}}function I(e,t){for(const n in t)e[n]=(e[n]||0)+(t[n]||0);return e}function L(e,t){return t instanceof i._CodeOrName?I(e,t.names):e}function $(e,t,n){return e instanceof i.Name?s(e):(r=e)instanceof i._Code&&r._items.some((e=>e instanceof i.Name&&1===t[e.str]&&void 0!==n[e.str]))?new i._Code(e._items.reduce(((e,t)=>(t instanceof i.Name&&(t=s(t)),t instanceof i._Code?e.push(...t._items):e.push(t),e)),[])):e;var r;function s(e){const i=n[e.str];return void 0===i||1!==t[e.str]?e:(delete t[e.str],i)}}function N(e,t){for(const n in t)e[n]=(e[n]||0)-(t[n]||0)}function P(e){return"boolean"==typeof e||"number"==typeof e||null===e?!e:i._`!${G(e)}`}T.kind="finally",t.CodeGen=class{constructor(e,t={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...t,_n:t.lines?"\n":""},this._extScope=e,this._scope=new r.Scope({parent:e}),this._nodes=[new y]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,t){const n=this._extScope.value(e,t);return(this._values[n.prefix]||(this._values[n.prefix]=new Set)).add(n),n}getScopeValue(e,t){return this._extScope.getValue(e,t)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,t,n,i){const r=this._scope.toName(t);return void 0!==n&&i&&(this._constants[r.str]=n),this._leafNode(new l(e,r,n)),r}const(e,t,n){return this._def(r.varKinds.const,e,t,n)}let(e,t,n){return this._def(r.varKinds.let,e,t,n)}var(e,t,n){return this._def(r.varKinds.var,e,t,n)}assign(e,t,n){return this._leafNode(new c(e,t,n))}add(e,n){return this._leafNode(new u(e,t.operators.ADD,n))}code(e){return"function"==typeof e?e():e!==i.nil&&this._leafNode(new m(e)),this}object(...e){const t=["{"];for(const[n,r]of e)t.length>1&&t.push(","),t.push(n),(n!==r||this.opts.es5)&&(t.push(":"),(0,i.addCodeArg)(t,r));return t.push("}"),new i._Code(t)}if(e,t,n){if(this._blockNode(new v(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 v(e))}else(){return this._elseNode(new b)}endIf(){return this._endBlockNode(v,b)}_for(e,t){return this._blockNode(e),t&&this.code(t).endFor(),this}for(e,t){return this._for(new C(e),t)}forRange(e,t,n,i,s=(this.opts.es5?r.varKinds.var:r.varKinds.let)){const o=this._scope.toName(e);return this._for(new A(s,o,t,n),(()=>i(o)))}forOf(e,t,n,s=r.varKinds.const){const o=this._scope.toName(e);if(this.opts.es5){const e=t instanceof i.Name?t:this.var("_arr",t);return this.forRange("_i",0,i._`${e}.length`,(t=>{this.var(o,i._`${e}[${t}]`),n(o)}))}return this._for(new S("of",s,o,t),(()=>n(o)))}forIn(e,t,n,s=(this.opts.es5?r.varKinds.var:r.varKinds.const)){if(this.opts.ownProperties)return this.forOf(e,i._`Object.keys(${t})`,n);const o=this._scope.toName(e);return this._for(new S("in",s,o,t),(()=>n(o)))}endFor(){return this._endBlockNode(w)}label(e){return this._leafNode(new h(e))}break(e){return this._leafNode(new d(e))}return(e){const t=new E;if(this._blockNode(t),this.code(e),1!==t.nodes.length)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(E)}try(e,t,n){if(!t&&!n)throw new Error('CodeGen: "try" without "catch" and "finally"');const i=new _;if(this._blockNode(i),this.code(e),t){const e=this.name("e");this._currNode=i.catch=new M(e),t(e)}return n&&(this._currNode=i.finally=new T,this.code(n)),this._endBlockNode(M,T)}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=i.nil,n,r){return this._blockNode(new x(e,t,n)),r&&this.code(r).endFunc(),this}endFunc(){return this._endBlockNode(x)}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 v))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=P;const O=k(t.operators.AND);t.and=function(...e){return e.reduce(O)};const R=k(t.operators.OR);function k(e){return(t,n)=>t===i.nil?n:n===i.nil?t:i._`${G(t)} ${e} ${G(n)}`}function G(e){return e instanceof i.Name?e:i._`(${e})`}t.or=function(...e){return e.reduce(R)}},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 i=n(1520);class r 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 i.Name("const"),let:new i.Name("let"),var:new i.Name("var")};class o{constructor({prefixes:e,parent:t}={}){this._names={},this._prefixes=e,this._parent=t}toName(e){return e instanceof i.Name?e:this.name(e)}name(e){return new i.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 i.Name{constructor(e,t){super(t),this.prefix=e}setValue(e,{property:t,itemIndex:n}){this.value=e,this.scopePath=i._`.${new i.Name(t)}[${n}]`}}t.ValueScopeName=a;const l=i._`\n`;t.ValueScope=class extends o{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?l:i.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 i=this.toName(e),{prefix:r}=i,s=null!==(n=t.key)&&void 0!==n?n:t.ref;let o=this._values[r];if(o){const e=o.get(s);if(e)return e}else o=this._values[r]=new Map;o.set(s,i);const a=this._scope[r]||(this._scope[r]=[]),l=a.length;return a[l]=t.ref,i.setValue(t,{property:r,itemIndex:l}),i}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 i._`${e}${t.scopePath}`}))}scopeCode(e=this._values,t,n){return this._reduceValues(e,(e=>{if(void 0===e.value)throw new Error(`CodeGen: name "${e}" has no value`);return e.value.code}),t,n)}_reduceValues(e,n,o={},a){let l=i.nil;for(const c in e){const u=e[c];if(!u)continue;const h=o[c]=o[c]||new Map;u.forEach((e=>{if(h.has(e))return;h.set(e,s.Started);let o=n(e);if(o){const n=this.opts.es5?t.varKinds.var:t.varKinds.const;l=i._`${l}${n} ${e} = ${o};${this.opts._n}`}else{if(!(o=null==a?void 0:a(e)))throw new r(e);l=i._`${l}${o}${this.opts._n}`}h.set(e,s.Completed)}))}return l}}},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 i=n(9029),r=n(4227),s=n(2023);function o(e,t){const n=e.const("err",t);e.if(i._`${s.default.vErrors} === null`,(()=>e.assign(s.default.vErrors,i._`[${n}]`)),i._`${s.default.vErrors}.push(${n})`),e.code(i._`${s.default.errors}++`)}function a(e,t){const{gen:n,validateName:r,schemaEnv:s}=e;s.$async?n.throw(i._`new ${e.ValidationError}(${t})`):(n.assign(i._`${r}.errors`,t),n.return(!1))}t.keywordError={message:({keyword:e})=>i.str`must pass "${e}" keyword validation`},t.keyword$DataError={message:({keyword:e,schemaType:t})=>t?i.str`"${e}" keyword must be ${t} ($data)`:i.str`"${e}" keyword is invalid ($data)`},t.reportError=function(e,n=t.keywordError,r,s){const{it:l}=e,{gen:u,compositeRule:h,allErrors:d}=l,p=c(e,n,r);(null!=s?s:h||d)?o(u,p):a(l,i._`[${p}]`)},t.reportExtraError=function(e,n=t.keywordError,i){const{it:r}=e,{gen:l,compositeRule:u,allErrors:h}=r;o(l,c(e,n,i)),u||h||a(r,s.default.vErrors)},t.resetErrorsCount=function(e,t){e.assign(s.default.errors,t),e.if(i._`${s.default.vErrors} !== null`,(()=>e.if(t,(()=>e.assign(i._`${s.default.vErrors}.length`,t)),(()=>e.assign(s.default.vErrors,null)))))},t.extendErrors=function({gen:e,keyword:t,schemaValue:n,data:r,errsCount:o,it:a}){if(void 0===o)throw new Error("ajv implementation error");const l=e.name("err");e.forRange("i",o,s.default.errors,(o=>{e.const(l,i._`${s.default.vErrors}[${o}]`),e.if(i._`${l}.instancePath === undefined`,(()=>e.assign(i._`${l}.instancePath`,(0,i.strConcat)(s.default.instancePath,a.errorPath)))),e.assign(i._`${l}.schemaPath`,i.str`${a.errSchemaPath}/${t}`),a.opts.verbose&&(e.assign(i._`${l}.schema`,n),e.assign(i._`${l}.data`,r))}))};const l={keyword:new i.Name("keyword"),schemaPath:new i.Name("schemaPath"),params:new i.Name("params"),propertyName:new i.Name("propertyName"),message:new i.Name("message"),schema:new i.Name("schema"),parentSchema:new i.Name("parentSchema")};function c(e,t,n){const{createErrors:r}=e.it;return!1===r?i._`{}`:function(e,t,n={}){const{gen:r,it:o}=e,a=[u(o,n),h(e,n)];return function(e,{params:t,message:n},r){const{keyword:o,data:a,schemaValue:c,it:u}=e,{opts:h,propertyName:d,topSchemaRef:p,schemaPath:m}=u;r.push([l.keyword,o],[l.params,"function"==typeof t?t(e):t||i._`{}`]),h.messages&&r.push([l.message,"function"==typeof n?n(e):n]),h.verbose&&r.push([l.schema,c],[l.parentSchema,i._`${p}${m}`],[s.default.data,a]),d&&r.push([l.propertyName,d])}(e,t,a),r.object(...a)}(e,t,n)}function u({errorPath:e},{instancePath:t}){const n=t?i.str`${e}${(0,r.getErrorPath)(t,r.Type.Str)}`:e;return[s.default.instancePath,(0,i.strConcat)(s.default.instancePath,n)]}function h({keyword:e,it:{errSchemaPath:t}},{schemaPath:n,parentSchema:s}){let o=s?t:i.str`${t}/${e}`;return n&&(o=i.str`${o}${(0,r.getErrorPath)(n,r.Type.Str)}`),[l.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 i=n(9029),r=n(3558),s=n(2023),o=n(6939),a=n(4227),l=n(2586);class c{constructor(e){var t;let n;this.refs={},this.dynamicAnchors={},"object"==typeof e.schema&&(n=e.schema),this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=null!==(t=e.baseId)&&void 0!==t?t:(0,o.normalizeId)(null==n?void 0:n[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=null==n?void 0:n.$async,this.refs={}}}function u(e){const t=d.call(this,e);if(t)return t;const n=(0,o.getFullPath)(this.opts.uriResolver,e.root.baseId),{es5:a,lines:c}=this.opts.code,{ownProperties:u}=this.opts,h=new i.CodeGen(this.scope,{es5:a,lines:c,ownProperties:u});let p;e.$async&&(p=h.scopeValue("Error",{ref:r.default,code:i._`require("ajv/dist/runtime/validation_error").default`}));const m=h.scopeName("validate");e.validateName=m;const f={gen:h,allErrors:this.opts.allErrors,data:s.default.data,parentData:s.default.parentData,parentDataProperty:s.default.parentDataProperty,dataNames:[s.default.data],dataPathArr:[i.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:h.scopeValue("schema",!0===this.opts.code.source?{ref:e.schema,code:(0,i.stringify)(e.schema)}:{ref:e.schema}),validateName:m,ValidationError:p,schema:e.schema,schemaEnv:e,rootId:n,baseId:e.baseId||n,schemaPath:i.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:i._`""`,opts:this.opts,self:this};let g;try{this._compilations.add(e),(0,l.validateFunctionCode)(f),h.optimize(this.opts.code.optimize);const t=h.toString();g=`${h.scopeRefs(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:h._values}),this.opts.unevaluated){const{props:e,items:t}=f;n.evaluated={props:e instanceof i.Name?void 0:e,items:t instanceof i.Name?void 0:t,dynamicProps:e instanceof i.Name,dynamicItems:t instanceof i.Name},n.source&&(n.source.evaluated=(0,i.stringify)(n.evaluated))}return e.validate=n,e}catch(t){throw delete e.validate,delete e.validateName,g&&this.logger.error("Error compiling schema, function code:",g),t}finally{this._compilations.delete(e)}}function h(e){return(0,o.inlineRef)(e.schema,this.opts.inlineRefs)?e.schema:e.validate?e:u.call(this,e)}function d(e){for(const i of this._compilations)if(n=e,(t=i).schema===n.schema&&t.root===n.root&&t.baseId===n.baseId)return i;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),i=(0,o._getFullPath)(this.opts.uriResolver,n);let r=(0,o.getFullPath)(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&i===r)return g.call(this,n,e);const s=(0,o.normalizeId)(i),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,i=t[n];return i&&(r=(0,o.resolveUrl)(this.opts.uriResolver,r,i)),new c({schema:t,schemaId:n,root:e,baseId:r})}return g.call(this,n,a)}}t.SchemaEnv=c,t.compileSchema=u,t.resolveRef=function(e,t,n){var i;n=(0,o.resolveUrl)(this.opts.uriResolver,t,n);const r=e.refs[n];if(r)return r;let s=p.call(this,e,n);if(void 0===s){const r=null===(i=e.localRefs)||void 0===i?void 0:i[n],{schemaId:o}=this.opts;r&&(s=new c({schema:r,schemaId:o,root:e,baseId:t}))}return void 0!==s?e.refs[n]=h.call(this,s):void 0},t.getCompilingSchema=d,t.resolveSchema=m;const f=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function g(e,{baseId:t,schema:n,root:i}){var r;if("/"!==(null===(r=e.fragment)||void 0===r?void 0:r[0]))return;for(const i of e.fragment.slice(1).split("/")){if("boolean"==typeof n)return;const e=n[(0,a.unescapeFragment)(i)];if(void 0===e)return;const r="object"==typeof(n=e)&&n[this.opts.schemaId];!f.has(i)&&r&&(t=(0,o.resolveUrl)(this.opts.uriResolver,t,r))}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,i,e)}const{schemaId:l}=this.opts;return s=s||new c({schema:n,schemaId:l,root:i,baseId:t}),s.schema!==s.root.schema?s:void 0}},2023:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(9029),r={data:new i.Name("data"),valCxt:new i.Name("valCxt"),instancePath:new i.Name("instancePath"),parentData:new i.Name("parentData"),parentDataProperty:new i.Name("parentDataProperty"),rootData:new i.Name("rootData"),dynamicAnchors:new i.Name("dynamicAnchors"),vErrors:new i.Name("vErrors"),errors:new i.Name("errors"),this:new i.Name("this"),self:new i.Name("self"),scope:new i.Name("scope"),json:new i.Name("json"),jsonPos:new i.Name("jsonPos"),jsonLen:new i.Name("jsonLen"),jsonPart:new i.Name("jsonPart")};t.default=r},4551:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(6939);class r extends Error{constructor(e,t,n,r){super(r||`can't resolve reference ${n} from id ${t}`),this.missingRef=(0,i.resolveUrl)(e,t,n),this.missingSchema=(0,i.normalizeId)((0,i.getFullPath)(e,this.missingRef))}}t.default=r},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 i=n(4227),r=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?!l(e):!!t&&c(e)<=t)};const a=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function l(e){for(const t in e){if(a.has(t))return!0;const n=e[t];if(Array.isArray(n)&&n.some(l))return!0;if("object"==typeof n&&l(n))return!0}return!1}function c(e){let t=0;for(const n in e){if("$ref"===n)return 1/0;if(t++,!o.has(n)&&("object"==typeof e[n]&&(0,i.eachItem)(e[n],(e=>t+=c(e))),t===1/0))return 1/0}return t}function u(e,t="",n){!1!==n&&(t=p(t));const i=e.parse(t);return h(e,i)}function h(e,t){return e.serialize(t).split("#")[0]+"#"}t.getFullPath=u,t._getFullPath=h;const d=/#\/?$/;function p(e){return e?e.replace(d,""):""}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:i}=this.opts,o=p(e[n]||t),a={"":o},l=u(i,o,!1),c={},h=new Set;return s(e,{allKeys:!0},((e,t,i,r)=>{if(void 0===r)return;const s=l+t;let o=a[r];function u(t){const n=this.opts.uriResolver.resolve;if(t=p(o?n(o,t):t),h.has(t))throw f(t);h.add(t);let i=this.refs[t];return"string"==typeof i&&(i=this.refs[i]),"object"==typeof i?d(e,i.schema,t):t!==p(s)&&("#"===t[0]?(d(e,c[t],t),c[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})),c;function d(e,t,n){if(void 0!==t&&!r(e,t))throw f(n)}function f(e){return new Error(`reference "${e}" resolves to more than one schema`)}}},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 i=n(9029),r=n(1520);function s(e,t=e.schema){const{opts:n,self:i}=e;if(!n.strictSchema)return;if("boolean"==typeof t)return;const r=i.RULES.keywords;for(const n in t)r[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 l(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function c({mergeNames:e,mergeToName:t,mergeValues:n,resultToName:r}){return(s,o,a,l)=>{const c=void 0===a?o:a instanceof i.Name?(o instanceof i.Name?e(s,o,a):t(s,o,a),a):o instanceof i.Name?(t(s,a,o),o):n(o,a);return l!==i.Name||c instanceof i.Name?c:r(s,c)}}function u(e,t){if(!0===t)return e.var("props",!0);const n=e.var("props",i._`{}`);return void 0!==t&&h(e,n,t),n}function h(e,t,n){Object.keys(n).forEach((n=>e.assign(i._`${t}${(0,i.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,r,s){if(!s){if("number"==typeof n||"boolean"==typeof n)return n;if("string"==typeof n)return i._`${n}`}return i._`${e}${t}${(0,i.getProperty)(r)}`},t.unescapeFragment=function(e){return l(decodeURIComponent(e))},t.escapeFragment=function(e){return encodeURIComponent(a(e))},t.escapeJsonPointer=a,t.unescapeJsonPointer=l,t.eachItem=function(e,t){if(Array.isArray(e))for(const n of e)t(n);else t(e)},t.mergeEvaluated={props:c({mergeNames:(e,t,n)=>e.if(i._`${n} !== true && ${t} !== undefined`,(()=>{e.if(i._`${t} === true`,(()=>e.assign(n,!0)),(()=>e.assign(n,i._`${n} || {}`).code(i._`Object.assign(${n}, ${t})`)))})),mergeToName:(e,t,n)=>e.if(i._`${n} !== true`,(()=>{!0===t?e.assign(n,!0):(e.assign(n,i._`${n} || {}`),h(e,n,t))})),mergeValues:(e,t)=>!0===e||{...e,...t},resultToName:u}),items:c({mergeNames:(e,t,n)=>e.if(i._`${n} !== true && ${t} !== undefined`,(()=>e.assign(n,i._`${t} === true ? true : ${n} > ${t} ? ${n} : ${t}`))),mergeToName:(e,t,n)=>e.if(i._`${n} !== true`,(()=>e.assign(n,!0===t||i._`${n} > ${t} ? ${n} : ${t}`))),mergeValues:(e,t)=>!0===e||Math.max(e,t),resultToName:(e,t)=>e.var("items",t)})},t.evaluatedPropsToName=u,t.setEvaluated=h;const d={};var 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:d[t.code]||(d[t.code]=new r._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 i.Name){const r=t===p.Num;return n?r?i._`"[" + ${e} + "]"`:i._`"['" + ${e} + "']"`:r?i._`"/" + ${e}`:i._`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return n?(0,i.getProperty)(e).toString():"/"+a(e)},t.checkStrictMode=m},7887:(e,t)=>{"use strict";function n(e,t){return t.rules.some((t=>i(e,t)))}function i(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},i){const r=t.RULES.types[i];return r&&!0!==r&&n(e,r)},t.shouldUseGroup=n,t.shouldUseRule=i},8727:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.boolOrEmptySchema=t.topBoolOrEmptySchema=void 0;const i=n(8708),r=n(9029),s=n(2023),o={message:"boolean schema is false"};function a(e,t){const{gen:n,data:r}=e,s={gen:n,keyword:"false schema",data:r,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e};(0,i.reportError)(s,o,void 0,t)}t.topBoolOrEmptySchema=function(e){const{gen:t,schema:n,validateName:i}=e;!1===n?a(e,!1):"object"==typeof n&&!0===n.$async?t.return(s.default.data):(t.assign(r._`${i}.errors`,null),t.return(!0))},t.boolOrEmptySchema=function(e,t){const{gen:n,schema:i}=e;!1===i?(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 i=n(396),r=n(7887),s=n(8708),o=n(9029),a=n(4227);var l;function c(e){const t=Array.isArray(e)?e:e?[e]:[];if(t.every(i.isJSONType))return t;throw new Error("type must be JSONType or JSONType[]: "+t.join(","))}!function(e){e[e.Correct=0]="Correct",e[e.Wrong=1]="Wrong"}(l||(t.DataType=l={})),t.getSchemaTypes=function(e){const t=c(e.type);if(t.includes("null")){if(!1===e.nullable)throw new Error("type: null contradicts nullable: false")}else{if(!t.length&&void 0!==e.nullable)throw new Error('"nullable" cannot be used without "type"');!0===e.nullable&&t.push("null")}return t},t.getJSONTypes=c,t.coerceAndCheckDataType=function(e,t){const{gen:n,data:i,opts:s}=e,a=function(e,t){return t?e.filter((e=>u.has(e)||"array"===t&&"array"===e)):[]}(t,s.coerceTypes),c=t.length>0&&!(0===a.length&&1===t.length&&(0,r.schemaHasRulesForType)(e,t[0]));if(c){const r=d(t,i,s.strictNumbers,l.Wrong);n.if(r,(()=>{a.length?function(e,t,n){const{gen:i,data:r,opts:s}=e,a=i.let("dataType",o._`typeof ${r}`),l=i.let("coerced",o._`undefined`);"array"===s.coerceTypes&&i.if(o._`${a} == 'object' && Array.isArray(${r}) && ${r}.length == 1`,(()=>i.assign(r,o._`${r}[0]`).assign(a,o._`typeof ${r}`).if(d(t,r,s.strictNumbers),(()=>i.assign(l,r))))),i.if(o._`${l} !== undefined`);for(const e of n)(u.has(e)||"array"===e&&"array"===s.coerceTypes)&&c(e);function c(e){switch(e){case"string":return void i.elseIf(o._`${a} == "number" || ${a} == "boolean"`).assign(l,o._`"" + ${r}`).elseIf(o._`${r} === null`).assign(l,o._`""`);case"number":return void i.elseIf(o._`${a} == "boolean" || ${r} === null
2
2
  || (${a} == "string" && ${r} && ${r} == +${r})`).assign(l,o._`+${r}`);case"integer":return void i.elseIf(o._`${a} === "boolean" || ${r} === null
3
3
  || (${a} === "string" && ${r} && ${r} == +${r} && !(${r} % 1))`).assign(l,o._`+${r}`);case"boolean":return void i.elseIf(o._`${r} === "false" || ${r} === 0 || ${r} === null`).assign(l,!1).elseIf(o._`${r} === "true" || ${r} === 1`).assign(l,!0);case"null":return i.elseIf(o._`${r} === "" || ${r} === 0 || ${r} === false`),void i.assign(l,null);case"array":i.elseIf(o._`${a} === "string" || ${a} === "number"
4
- || ${a} === "boolean" || ${r} === null`).assign(l,o._`[${r}]`)}}i.else(),m(e),i.endIf(),i.if(o._`${l} !== undefined`,(()=>{i.assign(r,l),function({gen:e,parentData:t,parentDataProperty:n},i){e.if(o._`${t} !== undefined`,(()=>e.assign(o._`${t}[${n}]`,i)))}(e,l)}))}(e,t,a):m(e)}))}return c};const u=new Set(["string","number","integer","boolean","null"]);function h(e,t,n,i=l.Correct){const r=i===l.Correct?o.operators.EQ:o.operators.NEQ;let s;switch(e){case"null":return o._`${t} ${r} 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} ${r} ${e}`}return i===l.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 d(e,t,n,i){if(1===e.length)return h(e[0],t,n,i);let r;const s=(0,a.toHash)(e);if(s.array&&s.object){const e=o._`typeof ${t} != "object"`;r=s.null?e:o._`!${t} || ${e}`,delete s.null,delete s.array,delete s.object}else r=o.nil;s.number&&delete s.integer;for(const e in s)r=(0,o.and)(r,h(e,t,n,i));return r}t.checkDataType=h,t.checkDataTypes=d;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:i}=e,r=(0,a.schemaRefOrVal)(e,i,"type");return{gen:t,keyword:"type",data:n,schema:i.type,schemaCode:r,schemaValue:r,parentSchema:i,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 i=n(9029),r=n(4227);function s(e,t,n){const{gen:s,compositeRule:o,data:a,opts:l}=e;if(void 0===n)return;const c=i._`${a}${(0,i.getProperty)(t)}`;if(o)return void(0,r.checkStrictMode)(e,`default is ignored for: ${c}`);let u=i._`${c} === undefined`;"empty"===l.useDefaults&&(u=i._`${u} || ${c} === null || ${c} === ""`),s.if(u,i._`${c} = ${(0,i.stringify)(n)}`)}t.assignDefaults=function(e,t){const{properties:n,items:i}=e.schema;if("object"===t&&n)for(const t in n)s(e,t,n[t].default);else"array"===t&&Array.isArray(i)&&i.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 i=n(8727),r=n(208),s=n(7887),o=n(208),a=n(7870),l=n(3673),c=n(4495),u=n(9029),h=n(2023),d=n(6939),p=n(4227),m=n(8708);function f({gen:e,validateName:t,schema:n,schemaEnv:i,opts:r},s){r.code.es5?e.func(t,u._`${h.default.data}, ${h.default.valCxt}`,i.$async,(()=>{e.code(u._`"use strict"; ${g(n,r)}`),function(e,t){e.if(h.default.valCxt,(()=>{e.var(h.default.instancePath,u._`${h.default.valCxt}.${h.default.instancePath}`),e.var(h.default.parentData,u._`${h.default.valCxt}.${h.default.parentData}`),e.var(h.default.parentDataProperty,u._`${h.default.valCxt}.${h.default.parentDataProperty}`),e.var(h.default.rootData,u._`${h.default.valCxt}.${h.default.rootData}`),t.dynamicRef&&e.var(h.default.dynamicAnchors,u._`${h.default.valCxt}.${h.default.dynamicAnchors}`)}),(()=>{e.var(h.default.instancePath,u._`""`),e.var(h.default.parentData,u._`undefined`),e.var(h.default.parentDataProperty,u._`undefined`),e.var(h.default.rootData,h.default.data),t.dynamicRef&&e.var(h.default.dynamicAnchors,u._`{}`)}))}(e,r),e.code(s)})):e.func(t,u._`${h.default.data}, ${function(e){return u._`{${h.default.instancePath}="", ${h.default.parentData}, ${h.default.parentDataProperty}, ${h.default.rootData}=${h.default.data}${e.dynamicRef?u._`, ${h.default.dynamicAnchors}={}`:u.nil}}={}`}(r)}`,i.$async,(()=>e.code(g(n,r)).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 b(e){return"boolean"!=typeof e.schema}function v(e){(0,p.checkUnknownRules)(e),function(e){const{schema:t,errSchemaPath:n,opts:i,self:r}=e;t.$ref&&i.ignoreKeywordsWithRef&&(0,p.schemaHasRulesButRef)(t,r.RULES)&&r.logger.warn(`$ref: keywords ignored in schema at path "${n}"`)}(e)}function w(e,t){if(e.opts.jtd)return A(e,[],!1,t);const n=(0,r.getSchemaTypes)(e.schema);A(e,n,!(0,r.coerceAndCheckDataType)(e,n),t)}function C({gen:e,schemaEnv:t,schema:n,errSchemaPath:i,opts:r}){const s=n.$comment;if(!0===r.$comment)e.code(u._`${h.default.self}.logger.log(${s})`);else if("function"==typeof r.$comment){const n=u.str`${i}/$comment`,r=e.scopeValue("root",{ref:t.root});e.code(u._`${h.default.self}.opts.$comment(${s}, ${n}, ${r}.schema)`)}}function A(e,t,n,i){const{gen:r,schema:a,data:l,allErrors:c,opts:d,self:m}=e,{RULES:f}=m;function g(p){(0,s.shouldUseGroup)(a,p)&&(p.type?(r.if((0,o.checkDataType)(p.type,l,d.strictNumbers)),S(e,p),1===t.length&&t[0]===p.type&&n&&(r.else(),(0,o.reportTypeError)(e)),r.endIf()):S(e,p),c||r.if(u._`${h.default.errors} === ${i||0}`))}!a.$ref||!d.ignoreKeywordsWithRef&&(0,p.schemaHasRulesButRef)(a,f)?(d.jtd||function(e,t){!e.schemaEnv.meta&&e.opts.strictTypes&&(function(e,t){t.length&&(e.dataTypes.length?(t.forEach((t=>{x(e.dataTypes,t)||E(e,`type "${t}" not allowed by context "${e.dataTypes.join(",")}"`)})),function(e,t){const n=[];for(const i of e.dataTypes)x(t,i)?n.push(i):t.includes("integer")&&"number"===i&&n.push("integer");e.dataTypes=n}(e,t)):e.dataTypes=t)}(e,t),e.opts.allowUnionTypes||function(e,t){t.length>1&&(2!==t.length||!t.includes("null"))&&E(e,"use allowUnionTypes to allow union type keyword")}(e,t),function(e,t){const n=e.self.RULES.all;for(const i in n){const r=n[i];if("object"==typeof r&&(0,s.shouldUseRule)(e.schema,r)){const{type:n}=r.definition;n.length&&!n.some((e=>{return i=e,(n=t).includes(i)||"number"===i&&n.includes("integer");var n,i}))&&E(e,`missing type "${n.join(",")}" for keyword "${i}"`)}}}(e,e.dataTypes))}(e,t),r.block((()=>{for(const e of f.rules)g(e);g(f.post)}))):r.block((()=>M(e,"$ref",f.all.$ref.definition)))}function S(e,t){const{gen:n,schema:i,opts:{useDefaults:r}}=e;r&&(0,a.assignDefaults)(e,t.type),n.block((()=>{for(const n of t.rules)(0,s.shouldUseRule)(i,n)&&M(e,n.keyword,n.definition,t.type)}))}function x(e,t){return e.includes(t)||"integer"===t&&e.includes("number")}function E(e,t){t+=` at "${e.schemaEnv.baseId+e.errSchemaPath}" (strictTypes)`,(0,p.checkStrictMode)(e,t,e.opts.strictTypes)}t.validateFunctionCode=function(e){b(e)&&(v(e),y(e))?function(e){const{schema:t,opts:n,gen:i}=e;f(e,(()=>{n.$comment&&t.$comment&&C(e),function(e){const{schema:t,opts:n}=e;void 0!==t.default&&n.useDefaults&&n.strictSchema&&(0,p.checkStrictMode)(e,"default is ignored in the schema root")}(e),i.let(h.default.vErrors,null),i.let(h.default.errors,0),n.unevaluated&&function(e){const{gen:t,validateName:n}=e;e.evaluated=t.const("evaluated",u._`${n}.evaluated`),t.if(u._`${e.evaluated}.dynamicProps`,(()=>t.assign(u._`${e.evaluated}.props`,u._`undefined`))),t.if(u._`${e.evaluated}.dynamicItems`,(()=>t.assign(u._`${e.evaluated}.items`,u._`undefined`)))}(e),w(e),function(e){const{gen:t,schemaEnv:n,validateName:i,ValidationError:r,opts:s}=e;n.$async?t.if(u._`${h.default.errors} === 0`,(()=>t.return(h.default.data)),(()=>t.throw(u._`new ${r}(${h.default.vErrors})`))):(t.assign(u._`${i}.errors`,h.default.vErrors),s.unevaluated&&function({gen:e,evaluated:t,props:n,items:i}){n instanceof u.Name&&e.assign(u._`${t}.props`,n),i instanceof u.Name&&e.assign(u._`${t}.items`,i)}(e),t.return(u._`${h.default.errors} === 0`))}(e)}))}(e):f(e,(()=>(0,i.topBoolOrEmptySchema)(e)))};class _{constructor(e,t,n){if((0,l.validateKeywordUsage)(e,t,n),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=n,this.data=e.data,this.schema=e.schema[n],this.$data=t.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,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",L(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,l.validSchemaType)(this.schema,t.schemaType,t.allowUndefined))throw new Error(`${n} value must be ${JSON.stringify(t.schemaType)}`);("code"in t?t.trackErrors:!1!==t.errors)&&(this.errsCount=e.gen.const("_errs",h.default.errors))}result(e,t,n){this.failResult((0,u.not)(e),t,n)}failResult(e,t,n){this.gen.if(e),n?n():this.error(),t?(this.gen.else(),t(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(e,t){this.failResult((0,u.not)(e),void 0,t)}fail(e){if(void 0===e)return this.error(),void(this.allErrors||this.gen.if(!1));this.gen.if(e),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(e){if(!this.$data)return this.fail(e);const{schemaCode:t}=this;this.fail(u._`${t} !== undefined && (${(0,u.or)(this.invalid$data(),e)})`)}error(e,t,n){if(t)return this.setParams(t),this._error(e,n),void this.setParams({});this._error(e,n)}_error(e,t){(e?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:i,schemaType:r,def:s}=this;n.if((0,u.or)(u._`${i} === undefined`,t)),e!==u.nil&&n.assign(e,!0),(r.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:i,it:r}=this;return(0,u.or)(function(){if(n.length){if(!(t instanceof u.Name))throw new Error("ajv implementation error");const e=Array.isArray(n)?n:[n];return u._`${(0,o.checkDataTypes)(e,t,r.opts.strictNumbers,o.DataType.Wrong)}`}return u.nil}(),function(){if(i.validateSchema){const n=e.scopeValue("validate$data",{ref:i.validateSchema});return u._`!${n}(${t})`}return u.nil}())}subschema(e,t){const n=(0,c.getSubschema)(this.it,e);(0,c.extendSubschemaData)(n,this.it,e),(0,c.extendSubschemaMode)(n,e);const r={...this.it,...n,items:void 0,props:void 0};return function(e,t){b(e)&&(v(e),y(e))?function(e,t){const{schema:n,gen:i,opts:r}=e;r.$comment&&n.$comment&&C(e),function(e){const t=e.schema[e.opts.schemaId];t&&(e.baseId=(0,d.resolveUrl)(e.opts.uriResolver,e.baseId,t))}(e),function(e){if(e.schema.$async&&!e.schemaEnv.$async)throw new Error("async schema in sync schema")}(e);const s=i.const("_errs",h.default.errors);w(e,s),i.var(t,u._`${s} === ${h.default.errors}`)}(e,t):(0,i.boolOrEmptySchema)(e,t)}(r,t),r}mergeEvaluated(e,t){const{it:n,gen:i}=this;n.opts.unevaluated&&(!0!==n.props&&void 0!==e.props&&(n.props=p.mergeEvaluated.props(i,e.props,n.props,t)),!0!==n.items&&void 0!==e.items&&(n.items=p.mergeEvaluated.items(i,e.items,n.items,t)))}mergeValidEvaluated(e,t){const{it:n,gen:i}=this;if(n.opts.unevaluated&&(!0!==n.props||!0!==n.items))return i.if(t,(()=>this.mergeEvaluated(e,u.Name))),!0}}function M(e,t,n,i){const r=new _(e,n,t);"code"in n?n.code(r,i):r.$data&&n.validate?(0,l.funcKeywordCode)(r,n):"macro"in n?(0,l.macroKeywordCode)(r,n):(n.compile||n.validate)&&(0,l.funcKeywordCode)(r,n)}t.KeywordCxt=_;const T=/^\/(?:[^~]|~0|~1)*$/,I=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function L(e,{dataLevel:t,dataNames:n,dataPathArr:i}){let r,s;if(""===e)return h.default.rootData;if("/"===e[0]){if(!T.test(e))throw new Error(`Invalid JSON-pointer: ${e}`);r=e,s=h.default.rootData}else{const o=I.exec(e);if(!o)throw new Error(`Invalid JSON-pointer: ${e}`);const a=+o[1];if(r=o[2],"#"===r){if(a>=t)throw new Error(l("property/index",a));return i[t-a]}if(a>t)throw new Error(l("data",a));if(s=n[t-a],!r)return s}let o=s;const a=r.split("/");for(const e of a)e&&(s=u._`${s}${(0,u.getProperty)((0,p.unescapeJsonPointer)(e))}`,o=u._`${o} && ${s}`);return o;function l(e,n){return`Cannot access ${e} ${n} levels up, current level is ${t}`}}t.getData=L},3673:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.validateKeywordUsage=t.validSchemaType=t.funcKeywordCode=t.macroKeywordCode=void 0;const i=n(9029),r=n(2023),s=n(5765),o=n(8708);function a(e){const{gen:t,data:n,it:r}=e;t.if(r.parentData,(()=>t.assign(n,i._`${r.parentData}[${r.parentDataProperty}]`)))}function l(e,t,n){if(void 0===n)throw new Error(`keyword "${t}" failed to compile`);return e.scopeValue("keyword","function"==typeof n?{ref:n}:{ref:n,code:(0,i.stringify)(n)})}t.macroKeywordCode=function(e,t){const{gen:n,keyword:r,schema:s,parentSchema:o,it:a}=e,c=t.macro.call(a.self,s,o,a),u=l(n,r,c);!1!==a.opts.validateSchema&&a.self.validateSchema(c,!0);const h=n.name("valid");e.subschema({schema:c,schemaPath:i.nil,errSchemaPath:`${a.errSchemaPath}/${r}`,topSchemaRef:u,compositeRule:!0},h),e.pass(h,(()=>e.error(!0)))},t.funcKeywordCode=function(e,t){var n;const{gen:c,keyword:u,schema:h,parentSchema:d,$data: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,h,d,m):t.validate,g=l(c,u,f),y=c.let("valid");function b(n=(t.async?i._`await `:i.nil)){const o=m.opts.passContext?r.default.this:r.default.self,a=!("compile"in t&&!p||!1===t.schema);c.assign(y,i._`${n}${(0,s.callValidateCode)(e,g,o,a)}`,t.modifying)}function v(e){var n;c.if((0,i.not)(null!==(n=t.valid)&&void 0!==n?n:y),e)}e.block$data(y,(function(){if(!1===t.errors)b(),t.modifying&&a(e),v((()=>e.error()));else{const n=t.async?function(){const e=c.let("ruleErrs",null);return c.try((()=>b(i._`await `)),(t=>c.assign(y,!1).if(i._`${t} instanceof ${m.ValidationError}`,(()=>c.assign(e,i._`${t}.errors`)),(()=>c.throw(t))))),e}():function(){const e=i._`${g}.errors`;return c.assign(e,null),b(i.nil),e}();t.modifying&&a(e),v((()=>function(e,t){const{gen:n}=e;n.if(i._`Array.isArray(${t})`,(()=>{n.assign(r.default.vErrors,i._`${r.default.vErrors} === null ? ${t} : ${r.default.vErrors}.concat(${t})`).assign(r.default.errors,i._`${r.default.vErrors}.length`),(0,o.extendErrors)(e)}),(()=>e.error()))}(e,n)))}})),e.ok(null!==(n=t.valid)&&void 0!==n?n:y)},t.validSchemaType=function(e,t,n=!1){return!t.length||t.some((t=>"array"===t?Array.isArray(e):"object"===t?e&&"object"==typeof e&&!Array.isArray(e):typeof e==t||n&&void 0===e))},t.validateKeywordUsage=function({schema:e,opts:t,self:n,errSchemaPath:i},r,s){if(Array.isArray(r.keyword)?!r.keyword.includes(s):r.keyword!==s)throw new Error("ajv implementation error");const o=r.dependencies;if(null==o?void 0:o.some((t=>!Object.prototype.hasOwnProperty.call(e,t))))throw new Error(`parent schema must have dependencies of ${s}: ${o.join(",")}`);if(r.validateSchema&&!r.validateSchema(e[s])){const e=`keyword "${s}" value is invalid at path "${i}": `+n.errorsText(r.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 i=n(9029),r=n(4227);t.getSubschema=function(e,{keyword:t,schemaProp:n,schema:s,schemaPath:o,errSchemaPath:a,topSchemaRef:l}){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:i._`${e.schemaPath}${(0,i.getProperty)(t)}`,errSchemaPath:`${e.errSchemaPath}/${t}`}:{schema:s[n],schemaPath:i._`${e.schemaPath}${(0,i.getProperty)(t)}${(0,i.getProperty)(n)}`,errSchemaPath:`${e.errSchemaPath}/${t}/${(0,r.escapeFragment)(n)}`}}if(void 0!==s){if(void 0===o||void 0===a||void 0===l)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:s,schemaPath:o,topSchemaRef:l,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:l}){if(void 0!==o&&void 0!==n)throw new Error('both "data" and "dataProp" passed, only one allowed');const{gen:c}=t;if(void 0!==n){const{errorPath:o,dataPathArr:a,opts:l}=t;u(c.let("data",i._`${t.data}${(0,i.getProperty)(n)}`,!0)),e.errorPath=i.str`${o}${(0,r.getErrorPath)(n,s,l.jsPropertySyntax)}`,e.parentDataProperty=i._`${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 i.Name?o:c.let("data",o,!0)),void 0!==l&&(e.propertyName=l)),a&&(e.dataTypes=a)},t.extendSubschemaMode=function(e,{jtdDiscriminator:t,jtdMetadata:n,compositeRule:i,createErrors:r,allErrors:s}){void 0!==i&&(e.compositeRule=i),void 0!==r&&(e.createErrors=r),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 i=n(2586);Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return i.KeywordCxt}});var r=n(9029);Object.defineProperty(t,"_",{enumerable:!0,get:function(){return r._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return r.str}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return r.stringify}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return r.nil}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return r.Name}}),Object.defineProperty(t,"CodeGen",{enumerable:!0,get:function(){return r.CodeGen}});const s=n(3558),o=n(4551),a=n(396),l=n(3835),c=n(9029),u=n(6939),h=n(208),d=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"]),b={errorDataPath:"",format:"`validateFormats: false` can be used instead.",nullable:'"nullable" keyword is supported by default.',jsonPointers:"Deprecated jsPropertySyntax can be used instead.",extendRefs:"Deprecated ignoreKeywordsWithRef can be used instead.",missingRefs:"Pass empty schema with $id that should be ignored to ajv.addSchema.",processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cache, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."},v={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'};function w(e){var t,n,i,r,s,o,a,l,c,u,h,d,p,g,y,b,v,w,C,A,S,x,E,_,M;const T=e.strict,I=null===(t=e.code)||void 0===t?void 0:t.optimize,L=!0===I||void 0===I?1:I||0,N=null!==(i=null===(n=e.code)||void 0===n?void 0:n.regExp)&&void 0!==i?i:f,$=null!==(r=e.uriResolver)&&void 0!==r?r:m.default;return{strictSchema:null===(o=null!==(s=e.strictSchema)&&void 0!==s?s:T)||void 0===o||o,strictNumbers:null===(l=null!==(a=e.strictNumbers)&&void 0!==a?a:T)||void 0===l||l,strictTypes:null!==(u=null!==(c=e.strictTypes)&&void 0!==c?c:T)&&void 0!==u?u:"log",strictTuples:null!==(d=null!==(h=e.strictTuples)&&void 0!==h?h:T)&&void 0!==d?d:"log",strictRequired:null!==(g=null!==(p=e.strictRequired)&&void 0!==p?p:T)&&void 0!==g&&g,code:e.code?{...e.code,optimize:L,regExp:N}:{optimize:L,regExp:N},loopRequired:null!==(y=e.loopRequired)&&void 0!==y?y:200,loopEnum:null!==(b=e.loopEnum)&&void 0!==b?b:200,meta:null===(v=e.meta)||void 0===v||v,messages:null===(w=e.messages)||void 0===w||w,inlineRefs:null===(C=e.inlineRefs)||void 0===C||C,schemaId:null!==(A=e.schemaId)&&void 0!==A?A:"$id",addUsedSchema:null===(S=e.addUsedSchema)||void 0===S||S,validateSchema:null===(x=e.validateSchema)||void 0===x||x,validateFormats:null===(E=e.validateFormats)||void 0===E||E,unicodeRegExp:null===(_=e.unicodeRegExp)||void 0===_||_,int32range:null===(M=e.int32range)||void 0===M||M,uriResolver:$}}class C{constructor(e={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...w(e)};const{es5:t,lines:n}=this.opts.code;this.scope=new c.ValueScope({scope:{},prefixes:y,es5:t,lines:n}),this.logger=function(e){if(!1===e)return T;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 i=e.validateFormats;e.validateFormats=!1,this.RULES=(0,a.getRules)(),A.call(this,b,e,"NOT SUPPORTED"),A.call(this,v,e,"DEPRECATED","warn"),this._metaOpts=M.call(this),e.formats&&E.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords&&_.call(this,e.keywords),"object"==typeof e.meta&&this.addMetaSchema(e.meta),x.call(this),e.validateFormats=i}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){const{$data:e,meta:t,schemaId:n}=this.opts;let i=p;"id"===n&&(i={...p},i.id=i.$id,delete i.$id),t&&e&&this.addMetaSchema(i,i[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 i=n(t);return"$async"in n||(this.errors=n.errors),i}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 i.call(this,e,t);async function i(e,t){await r.call(this,e.$schema);const n=this._addSchema(e,t);return n.validate||s.call(this,n)}async function r(e){e&&!this.getSchema(e)&&await i.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 l.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 l(e){const n=await c.call(this,e);this.refs[e]||await r.call(this,n.$schema),this.refs[e]||this.addSchema(n,e,t)}async function c(e){const t=this._loading[e];if(t)return t;try{return await(this._loading[e]=n(e))}finally{delete this._loading[e]}}}addSchema(e,t,n,i=this.opts.validateSchema){if(Array.isArray(e)){for(const t of e)this.addSchema(t,void 0,n,i);return this}let r;if("object"==typeof e){const{schemaId:t}=this.opts;if(r=e[t],void 0!==r&&"string"!=typeof r)throw new Error(`schema ${t} must be string`)}return t=(0,u.normalizeId)(t||r),this._checkUnique(t),this.schemas[t]=this._addSchema(e,n,t,i,!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 i=this.validate(n,e);if(!i&&t){const e="schema is invalid: "+this.errorsText();if("log"!==this.opts.validateSchema)throw new Error(e);this.logger.error(e)}return i}getSchema(e){let t;for(;"string"==typeof(t=S.call(this,e));)e=t;if(void 0===t){const{schemaId:n}=this.opts,i=new l.SchemaEnv({schema:{},schemaId:n});if(t=l.resolveSchema.call(this,i,e),!t)return;this.refs[e]=t}return t.validate||this._compileSchemaEnv(t)}removeSchema(e){if(e instanceof RegExp)return this._removeAllSchemas(this.schemas,e),this._removeAllSchemas(this.refs,e),this;switch(typeof e){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{const t=S.call(this,e);return"object"==typeof t&&this._cache.delete(t.schema),delete this.schemas[e],delete this.refs[e],this}case"object":{const t=e;this._cache.delete(t);let n=e[this.opts.schemaId];return n&&(n=(0,u.normalizeId)(n),delete this.schemas[n],delete this.refs[n]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(e){for(const t of e)this.addKeyword(t);return this}addKeyword(e,t){let n;if("string"==typeof e)n=e,"object"==typeof t&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),t.keyword=n);else{if("object"!=typeof e||void 0!==t)throw new Error("invalid addKeywords parameters");if(n=(t=e).keyword,Array.isArray(n)&&!n.length)throw new Error("addKeywords: keyword must be string or non-empty array")}if(L.call(this,n,t),!t)return(0,d.eachItem)(n,(e=>N.call(this,e))),this;P.call(this,t);const i={...t,type:(0,h.getJSONTypes)(t.type),schemaType:(0,h.getJSONTypes)(t.schemaType)};return(0,d.eachItem)(n,0===i.type.length?e=>N.call(this,e,i):e=>i.type.forEach((t=>N.call(this,e,i,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 i of t){const t=i.split("/").slice(1);let r=e;for(const e of t)r=r[e];for(const e in n){const t=n[e];if("object"!=typeof t)continue;const{$data:i}=t.definition,s=r[e];i&&s&&(r[e]=R(s))}}return e}_removeAllSchemas(e,t){for(const n in e){const i=e[n];t&&!t.test(n)||("string"==typeof i?delete e[n]:i&&!i.meta&&(this._cache.delete(i.schema),delete e[n]))}}_addSchema(e,t,n,i=this.opts.validateSchema,r=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 c=u.getSchemaRefs.call(this,e,n);return a=new l.SchemaEnv({schema:e,schemaId:o,meta:t,baseId:n,localRefs:c}),this._cache.set(a.schema,a),r&&!n.startsWith("#")&&(n&&this._checkUnique(n),this.refs[n]=a),i&&this.validateSchema(e,!0),a}_checkUnique(e){if(this.schemas[e]||this.refs[e])throw new Error(`schema with key or id "${e}" already exists`)}_compileSchemaEnv(e){if(e.meta?this._compileMetaSchema(e):l.compileSchema.call(this,e),!e.validate)throw new Error("ajv implementation error");return e.validate}_compileMetaSchema(e){const t=this.opts;this.opts=this._metaOpts;try{l.compileSchema.call(this,e)}finally{this.opts=t}}}function A(e,t,n,i="error"){for(const r in e){const s=r;s in t&&this.logger[i](`${n}: option ${r}. ${e[s]}`)}}function S(e){return e=(0,u.normalizeId)(e),this.schemas[e]||this.refs[e]}function x(){const e=this.opts.schemas;if(e)if(Array.isArray(e))this.addSchema(e);else for(const t in e)this.addSchema(e[t],t)}function E(){for(const e in this.opts.formats){const t=this.opts.formats[e];t&&this.addFormat(e,t)}}function _(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 M(){const e={...this.opts};for(const t of g)delete e[t];return e}C.ValidationError=s.default,C.MissingRefError=o.default,t.default=C;const T={log(){},warn(){},error(){}},I=/^[a-z_$][a-z0-9_$:-]*$/i;function L(e,t){const{RULES:n}=this;if((0,d.eachItem)(e,(e=>{if(n.keywords[e])throw new Error(`Keyword ${e} is already defined`);if(!I.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 i;const r=null==t?void 0:t.post;if(n&&r)throw new Error('keyword with "post" flag cannot have "type"');const{RULES:s}=this;let o=r?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,h.getJSONTypes)(t.type),schemaType:(0,h.getJSONTypes)(t.schemaType)}};t.before?$.call(this,o,a,t.before):o.rules.push(a),s.all[e]=a,null===(i=t.implements)||void 0===i||i.forEach((e=>this.addKeyword(e)))}function $(e,t,n){const i=e.rules.findIndex((e=>e.keyword===n));i>=0?e.rules.splice(i,0,t):(e.rules.push(t),this.logger.warn(`rule ${n} is not defined`))}function P(e){let{metaSchema:t}=e;void 0!==t&&(e.$data&&this.opts.$data&&(t=R(t)),e.validateSchema=this.compile(t,!0))}const O={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function R(e){return{anyOf:[e,O]}}},9572:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(1678),r=n(7216),s=n(9547),o=n(8226),a=n(518),l=n(4588),c=n(5707),u=n(7082),h=["/properties"];t.default=function(e){return[i,r,s,o,a,t(this,l),c,t(this,u)].forEach((e=>this.addMetaSchema(e,void 0,!1))),this;function t(t,n){return e?t.$dataMetaSchema(n,h):n}}},6250:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2017);i.code='require("ajv/dist/runtime/equal").default',t.default=i},3853:(e,t)=>{"use strict";function n(e){const t=e.length;let n,i=0,r=0;for(;r<t;)i++,n=e.charCodeAt(r++),n>=55296&&n<=56319&&r<t&&(n=e.charCodeAt(r),56320==(64512&n)&&r++);return i}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 i=n(8343);i.code='require("ajv/dist/runtime/uri").default',t.default=i},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 i=n(9029),r=n(4227),s={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:{message:({params:{len:e}})=>i.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>i._`{limit: ${e}}`},code(e){const{parentSchema:t,it:n}=e,{items:i}=t;Array.isArray(i)?o(e,i):(0,r.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:l}=e;l.items=!0;const c=n.const("len",i._`${o}.length`);if(!1===s)e.setParams({len:t.length}),e.pass(i._`${c} <= ${t.length}`);else if("object"==typeof s&&!(0,r.alwaysValidSchema)(l,s)){const s=n.var("valid",i._`${c} <= ${t.length}`);n.if((0,i.not)(s),(()=>function(s){n.forRange("i",t.length,c,(t=>{e.subschema({keyword:a,dataProp:t,dataPropType:r.Type.Num},s),l.allErrors||n.if((0,i.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 i=n(5765),r=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})=>r._`{additionalProperty: ${e.additionalProperty}}`},code(e){const{gen:t,schema:n,parentSchema:a,data:l,errsCount:c,it:u}=e;if(!c)throw new Error("ajv implementation error");const{allErrors:h,opts:d}=u;if(u.props=!0,"all"!==d.removeAdditional&&(0,o.alwaysValidSchema)(u,n))return;const p=(0,i.allSchemaProperties)(a.properties),m=(0,i.allSchemaProperties)(a.patternProperties);function f(e){t.code(r._`delete ${l}[${e}]`)}function g(i){if("all"===d.removeAdditional||d.removeAdditional&&!1===n)f(i);else{if(!1===n)return e.setParams({additionalProperty:i}),e.error(),void(h||t.break());if("object"==typeof n&&!(0,o.alwaysValidSchema)(u,n)){const n=t.name("valid");"failing"===d.removeAdditional?(y(i,n,!1),t.if((0,r.not)(n),(()=>{e.reset(),f(i)}))):(y(i,n),h||t.if((0,r.not)(n),(()=>t.break())))}}}function y(t,n,i){const r={keyword:"additionalProperties",dataProp:t,dataPropType:o.Type.Str};!1===i&&Object.assign(r,{compositeRule:!0,createErrors:!1,allErrors:!1}),e.subschema(r,n)}t.forIn("key",l,(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,i.isOwnProperty)(t,e,n)}else s=p.length?(0,r.or)(...p.map((e=>r._`${n} === ${e}`))):r.nil;return m.length&&(s=(0,r.or)(s,...m.map((t=>r._`${(0,i.usePattern)(e,t)}.test(${n})`)))),(0,r.not)(s)}(n),(()=>g(n))):g(n)})),e.ok(r._`${c} === ${s.default.errors}`)}};t.default=a},5844:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(4227),r={keyword:"allOf",schemaType:"array",code(e){const{gen:t,schema:n,it:r}=e;if(!Array.isArray(n))throw new Error("ajv implementation error");const s=t.name("valid");n.forEach(((t,n)=>{if((0,i.alwaysValidSchema)(r,t))return;const o=e.subschema({keyword:"allOf",schemaProp:n},s);e.ok(s),e.mergeEvaluated(o)}))}};t.default=r},6505:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:n(5765).validateUnion,error:{message:"must match a schema in anyOf"}};t.default=i},2661:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(9029),r=n(4227),s={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:{message:({params:{min:e,max:t}})=>void 0===t?i.str`must contain at least ${e} valid item(s)`:i.str`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>void 0===t?i._`{minContains: ${e}}`:i._`{minContains: ${e}, maxContains: ${t}}`},code(e){const{gen:t,schema:n,parentSchema:s,data:o,it:a}=e;let l,c;const{minContains:u,maxContains:h}=s;a.opts.next?(l=void 0===u?1:u,c=h):l=1;const d=t.const("len",i._`${o}.length`);if(e.setParams({min:l,max:c}),void 0===c&&0===l)return void(0,r.checkStrictMode)(a,'"minContains" == 0 without "maxContains": "contains" keyword ignored');if(void 0!==c&&l>c)return(0,r.checkStrictMode)(a,'"minContains" > "maxContains" is always invalid'),void e.fail();if((0,r.alwaysValidSchema)(a,n)){let t=i._`${d} >= ${l}`;return void 0!==c&&(t=i._`${t} && ${d} <= ${c}`),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(i._`${e}++`),void 0===c?t.if(i._`${e} >= ${l}`,(()=>t.assign(p,!0).break())):(t.if(i._`${e} > ${c}`,(()=>t.assign(p,!1).break())),1===l?t.assign(p,!0):t.if(i._`${e} >= ${l}`,(()=>t.assign(p,!0))))}(n)))))}function f(n,i){t.forRange("i",0,d,(t=>{e.subschema({keyword:"contains",dataProp:t,dataPropType:r.Type.Num,compositeRule:!0},n),i()}))}void 0===c&&1===l?f(p,(()=>t.if(p,(()=>t.break())))):0===l?(t.let(p,!0),void 0!==c&&t.if(i._`${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 i=n(9029),r=n(4227),s=n(5765);t.error={message:({params:{property:e,depsCount:t,deps:n}})=>{const r=1===t?"property":"properties";return i.str`must have ${r} ${n} when property ${e} is present`},params:({params:{property:e,depsCount:t,deps:n,missingProperty:r}})=>i._`{property: ${e},
4
+ || ${a} === "boolean" || ${r} === null`).assign(l,o._`[${r}]`)}}i.else(),m(e),i.endIf(),i.if(o._`${l} !== undefined`,(()=>{i.assign(r,l),function({gen:e,parentData:t,parentDataProperty:n},i){e.if(o._`${t} !== undefined`,(()=>e.assign(o._`${t}[${n}]`,i)))}(e,l)}))}(e,t,a):m(e)}))}return c};const u=new Set(["string","number","integer","boolean","null"]);function h(e,t,n,i=l.Correct){const r=i===l.Correct?o.operators.EQ:o.operators.NEQ;let s;switch(e){case"null":return o._`${t} ${r} 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} ${r} ${e}`}return i===l.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 d(e,t,n,i){if(1===e.length)return h(e[0],t,n,i);let r;const s=(0,a.toHash)(e);if(s.array&&s.object){const e=o._`typeof ${t} != "object"`;r=s.null?e:o._`!${t} || ${e}`,delete s.null,delete s.array,delete s.object}else r=o.nil;s.number&&delete s.integer;for(const e in s)r=(0,o.and)(r,h(e,t,n,i));return r}t.checkDataType=h,t.checkDataTypes=d;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:i}=e,r=(0,a.schemaRefOrVal)(e,i,"type");return{gen:t,keyword:"type",data:n,schema:i.type,schemaCode:r,schemaValue:r,parentSchema:i,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 i=n(9029),r=n(4227);function s(e,t,n){const{gen:s,compositeRule:o,data:a,opts:l}=e;if(void 0===n)return;const c=i._`${a}${(0,i.getProperty)(t)}`;if(o)return void(0,r.checkStrictMode)(e,`default is ignored for: ${c}`);let u=i._`${c} === undefined`;"empty"===l.useDefaults&&(u=i._`${u} || ${c} === null || ${c} === ""`),s.if(u,i._`${c} = ${(0,i.stringify)(n)}`)}t.assignDefaults=function(e,t){const{properties:n,items:i}=e.schema;if("object"===t&&n)for(const t in n)s(e,t,n[t].default);else"array"===t&&Array.isArray(i)&&i.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 i=n(8727),r=n(208),s=n(7887),o=n(208),a=n(7870),l=n(3673),c=n(4495),u=n(9029),h=n(2023),d=n(6939),p=n(4227),m=n(8708);function f({gen:e,validateName:t,schema:n,schemaEnv:i,opts:r},s){r.code.es5?e.func(t,u._`${h.default.data}, ${h.default.valCxt}`,i.$async,(()=>{e.code(u._`"use strict"; ${g(n,r)}`),function(e,t){e.if(h.default.valCxt,(()=>{e.var(h.default.instancePath,u._`${h.default.valCxt}.${h.default.instancePath}`),e.var(h.default.parentData,u._`${h.default.valCxt}.${h.default.parentData}`),e.var(h.default.parentDataProperty,u._`${h.default.valCxt}.${h.default.parentDataProperty}`),e.var(h.default.rootData,u._`${h.default.valCxt}.${h.default.rootData}`),t.dynamicRef&&e.var(h.default.dynamicAnchors,u._`${h.default.valCxt}.${h.default.dynamicAnchors}`)}),(()=>{e.var(h.default.instancePath,u._`""`),e.var(h.default.parentData,u._`undefined`),e.var(h.default.parentDataProperty,u._`undefined`),e.var(h.default.rootData,h.default.data),t.dynamicRef&&e.var(h.default.dynamicAnchors,u._`{}`)}))}(e,r),e.code(s)})):e.func(t,u._`${h.default.data}, ${function(e){return u._`{${h.default.instancePath}="", ${h.default.parentData}, ${h.default.parentDataProperty}, ${h.default.rootData}=${h.default.data}${e.dynamicRef?u._`, ${h.default.dynamicAnchors}={}`:u.nil}}={}`}(r)}`,i.$async,(()=>e.code(g(n,r)).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 b(e){return"boolean"!=typeof e.schema}function v(e){(0,p.checkUnknownRules)(e),function(e){const{schema:t,errSchemaPath:n,opts:i,self:r}=e;t.$ref&&i.ignoreKeywordsWithRef&&(0,p.schemaHasRulesButRef)(t,r.RULES)&&r.logger.warn(`$ref: keywords ignored in schema at path "${n}"`)}(e)}function w(e,t){if(e.opts.jtd)return A(e,[],!1,t);const n=(0,r.getSchemaTypes)(e.schema);A(e,n,!(0,r.coerceAndCheckDataType)(e,n),t)}function C({gen:e,schemaEnv:t,schema:n,errSchemaPath:i,opts:r}){const s=n.$comment;if(!0===r.$comment)e.code(u._`${h.default.self}.logger.log(${s})`);else if("function"==typeof r.$comment){const n=u.str`${i}/$comment`,r=e.scopeValue("root",{ref:t.root});e.code(u._`${h.default.self}.opts.$comment(${s}, ${n}, ${r}.schema)`)}}function A(e,t,n,i){const{gen:r,schema:a,data:l,allErrors:c,opts:d,self:m}=e,{RULES:f}=m;function g(p){(0,s.shouldUseGroup)(a,p)&&(p.type?(r.if((0,o.checkDataType)(p.type,l,d.strictNumbers)),S(e,p),1===t.length&&t[0]===p.type&&n&&(r.else(),(0,o.reportTypeError)(e)),r.endIf()):S(e,p),c||r.if(u._`${h.default.errors} === ${i||0}`))}!a.$ref||!d.ignoreKeywordsWithRef&&(0,p.schemaHasRulesButRef)(a,f)?(d.jtd||function(e,t){!e.schemaEnv.meta&&e.opts.strictTypes&&(function(e,t){t.length&&(e.dataTypes.length?(t.forEach((t=>{x(e.dataTypes,t)||E(e,`type "${t}" not allowed by context "${e.dataTypes.join(",")}"`)})),function(e,t){const n=[];for(const i of e.dataTypes)x(t,i)?n.push(i):t.includes("integer")&&"number"===i&&n.push("integer");e.dataTypes=n}(e,t)):e.dataTypes=t)}(e,t),e.opts.allowUnionTypes||function(e,t){t.length>1&&(2!==t.length||!t.includes("null"))&&E(e,"use allowUnionTypes to allow union type keyword")}(e,t),function(e,t){const n=e.self.RULES.all;for(const i in n){const r=n[i];if("object"==typeof r&&(0,s.shouldUseRule)(e.schema,r)){const{type:n}=r.definition;n.length&&!n.some((e=>{return i=e,(n=t).includes(i)||"number"===i&&n.includes("integer");var n,i}))&&E(e,`missing type "${n.join(",")}" for keyword "${i}"`)}}}(e,e.dataTypes))}(e,t),r.block((()=>{for(const e of f.rules)g(e);g(f.post)}))):r.block((()=>M(e,"$ref",f.all.$ref.definition)))}function S(e,t){const{gen:n,schema:i,opts:{useDefaults:r}}=e;r&&(0,a.assignDefaults)(e,t.type),n.block((()=>{for(const n of t.rules)(0,s.shouldUseRule)(i,n)&&M(e,n.keyword,n.definition,t.type)}))}function x(e,t){return e.includes(t)||"integer"===t&&e.includes("number")}function E(e,t){t+=` at "${e.schemaEnv.baseId+e.errSchemaPath}" (strictTypes)`,(0,p.checkStrictMode)(e,t,e.opts.strictTypes)}t.validateFunctionCode=function(e){b(e)&&(v(e),y(e))?function(e){const{schema:t,opts:n,gen:i}=e;f(e,(()=>{n.$comment&&t.$comment&&C(e),function(e){const{schema:t,opts:n}=e;void 0!==t.default&&n.useDefaults&&n.strictSchema&&(0,p.checkStrictMode)(e,"default is ignored in the schema root")}(e),i.let(h.default.vErrors,null),i.let(h.default.errors,0),n.unevaluated&&function(e){const{gen:t,validateName:n}=e;e.evaluated=t.const("evaluated",u._`${n}.evaluated`),t.if(u._`${e.evaluated}.dynamicProps`,(()=>t.assign(u._`${e.evaluated}.props`,u._`undefined`))),t.if(u._`${e.evaluated}.dynamicItems`,(()=>t.assign(u._`${e.evaluated}.items`,u._`undefined`)))}(e),w(e),function(e){const{gen:t,schemaEnv:n,validateName:i,ValidationError:r,opts:s}=e;n.$async?t.if(u._`${h.default.errors} === 0`,(()=>t.return(h.default.data)),(()=>t.throw(u._`new ${r}(${h.default.vErrors})`))):(t.assign(u._`${i}.errors`,h.default.vErrors),s.unevaluated&&function({gen:e,evaluated:t,props:n,items:i}){n instanceof u.Name&&e.assign(u._`${t}.props`,n),i instanceof u.Name&&e.assign(u._`${t}.items`,i)}(e),t.return(u._`${h.default.errors} === 0`))}(e)}))}(e):f(e,(()=>(0,i.topBoolOrEmptySchema)(e)))};class _{constructor(e,t,n){if((0,l.validateKeywordUsage)(e,t,n),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=n,this.data=e.data,this.schema=e.schema[n],this.$data=t.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,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",L(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,l.validSchemaType)(this.schema,t.schemaType,t.allowUndefined))throw new Error(`${n} value must be ${JSON.stringify(t.schemaType)}`);("code"in t?t.trackErrors:!1!==t.errors)&&(this.errsCount=e.gen.const("_errs",h.default.errors))}result(e,t,n){this.failResult((0,u.not)(e),t,n)}failResult(e,t,n){this.gen.if(e),n?n():this.error(),t?(this.gen.else(),t(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(e,t){this.failResult((0,u.not)(e),void 0,t)}fail(e){if(void 0===e)return this.error(),void(this.allErrors||this.gen.if(!1));this.gen.if(e),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(e){if(!this.$data)return this.fail(e);const{schemaCode:t}=this;this.fail(u._`${t} !== undefined && (${(0,u.or)(this.invalid$data(),e)})`)}error(e,t,n){if(t)return this.setParams(t),this._error(e,n),void this.setParams({});this._error(e,n)}_error(e,t){(e?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:i,schemaType:r,def:s}=this;n.if((0,u.or)(u._`${i} === undefined`,t)),e!==u.nil&&n.assign(e,!0),(r.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:i,it:r}=this;return(0,u.or)(function(){if(n.length){if(!(t instanceof u.Name))throw new Error("ajv implementation error");const e=Array.isArray(n)?n:[n];return u._`${(0,o.checkDataTypes)(e,t,r.opts.strictNumbers,o.DataType.Wrong)}`}return u.nil}(),function(){if(i.validateSchema){const n=e.scopeValue("validate$data",{ref:i.validateSchema});return u._`!${n}(${t})`}return u.nil}())}subschema(e,t){const n=(0,c.getSubschema)(this.it,e);(0,c.extendSubschemaData)(n,this.it,e),(0,c.extendSubschemaMode)(n,e);const r={...this.it,...n,items:void 0,props:void 0};return function(e,t){b(e)&&(v(e),y(e))?function(e,t){const{schema:n,gen:i,opts:r}=e;r.$comment&&n.$comment&&C(e),function(e){const t=e.schema[e.opts.schemaId];t&&(e.baseId=(0,d.resolveUrl)(e.opts.uriResolver,e.baseId,t))}(e),function(e){if(e.schema.$async&&!e.schemaEnv.$async)throw new Error("async schema in sync schema")}(e);const s=i.const("_errs",h.default.errors);w(e,s),i.var(t,u._`${s} === ${h.default.errors}`)}(e,t):(0,i.boolOrEmptySchema)(e,t)}(r,t),r}mergeEvaluated(e,t){const{it:n,gen:i}=this;n.opts.unevaluated&&(!0!==n.props&&void 0!==e.props&&(n.props=p.mergeEvaluated.props(i,e.props,n.props,t)),!0!==n.items&&void 0!==e.items&&(n.items=p.mergeEvaluated.items(i,e.items,n.items,t)))}mergeValidEvaluated(e,t){const{it:n,gen:i}=this;if(n.opts.unevaluated&&(!0!==n.props||!0!==n.items))return i.if(t,(()=>this.mergeEvaluated(e,u.Name))),!0}}function M(e,t,n,i){const r=new _(e,n,t);"code"in n?n.code(r,i):r.$data&&n.validate?(0,l.funcKeywordCode)(r,n):"macro"in n?(0,l.macroKeywordCode)(r,n):(n.compile||n.validate)&&(0,l.funcKeywordCode)(r,n)}t.KeywordCxt=_;const T=/^\/(?:[^~]|~0|~1)*$/,I=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function L(e,{dataLevel:t,dataNames:n,dataPathArr:i}){let r,s;if(""===e)return h.default.rootData;if("/"===e[0]){if(!T.test(e))throw new Error(`Invalid JSON-pointer: ${e}`);r=e,s=h.default.rootData}else{const o=I.exec(e);if(!o)throw new Error(`Invalid JSON-pointer: ${e}`);const a=+o[1];if(r=o[2],"#"===r){if(a>=t)throw new Error(l("property/index",a));return i[t-a]}if(a>t)throw new Error(l("data",a));if(s=n[t-a],!r)return s}let o=s;const a=r.split("/");for(const e of a)e&&(s=u._`${s}${(0,u.getProperty)((0,p.unescapeJsonPointer)(e))}`,o=u._`${o} && ${s}`);return o;function l(e,n){return`Cannot access ${e} ${n} levels up, current level is ${t}`}}t.getData=L},3673:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.validateKeywordUsage=t.validSchemaType=t.funcKeywordCode=t.macroKeywordCode=void 0;const i=n(9029),r=n(2023),s=n(5765),o=n(8708);function a(e){const{gen:t,data:n,it:r}=e;t.if(r.parentData,(()=>t.assign(n,i._`${r.parentData}[${r.parentDataProperty}]`)))}function l(e,t,n){if(void 0===n)throw new Error(`keyword "${t}" failed to compile`);return e.scopeValue("keyword","function"==typeof n?{ref:n}:{ref:n,code:(0,i.stringify)(n)})}t.macroKeywordCode=function(e,t){const{gen:n,keyword:r,schema:s,parentSchema:o,it:a}=e,c=t.macro.call(a.self,s,o,a),u=l(n,r,c);!1!==a.opts.validateSchema&&a.self.validateSchema(c,!0);const h=n.name("valid");e.subschema({schema:c,schemaPath:i.nil,errSchemaPath:`${a.errSchemaPath}/${r}`,topSchemaRef:u,compositeRule:!0},h),e.pass(h,(()=>e.error(!0)))},t.funcKeywordCode=function(e,t){var n;const{gen:c,keyword:u,schema:h,parentSchema:d,$data: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,h,d,m):t.validate,g=l(c,u,f),y=c.let("valid");function b(n=(t.async?i._`await `:i.nil)){const o=m.opts.passContext?r.default.this:r.default.self,a=!("compile"in t&&!p||!1===t.schema);c.assign(y,i._`${n}${(0,s.callValidateCode)(e,g,o,a)}`,t.modifying)}function v(e){var n;c.if((0,i.not)(null!==(n=t.valid)&&void 0!==n?n:y),e)}e.block$data(y,(function(){if(!1===t.errors)b(),t.modifying&&a(e),v((()=>e.error()));else{const n=t.async?function(){const e=c.let("ruleErrs",null);return c.try((()=>b(i._`await `)),(t=>c.assign(y,!1).if(i._`${t} instanceof ${m.ValidationError}`,(()=>c.assign(e,i._`${t}.errors`)),(()=>c.throw(t))))),e}():function(){const e=i._`${g}.errors`;return c.assign(e,null),b(i.nil),e}();t.modifying&&a(e),v((()=>function(e,t){const{gen:n}=e;n.if(i._`Array.isArray(${t})`,(()=>{n.assign(r.default.vErrors,i._`${r.default.vErrors} === null ? ${t} : ${r.default.vErrors}.concat(${t})`).assign(r.default.errors,i._`${r.default.vErrors}.length`),(0,o.extendErrors)(e)}),(()=>e.error()))}(e,n)))}})),e.ok(null!==(n=t.valid)&&void 0!==n?n:y)},t.validSchemaType=function(e,t,n=!1){return!t.length||t.some((t=>"array"===t?Array.isArray(e):"object"===t?e&&"object"==typeof e&&!Array.isArray(e):typeof e==t||n&&void 0===e))},t.validateKeywordUsage=function({schema:e,opts:t,self:n,errSchemaPath:i},r,s){if(Array.isArray(r.keyword)?!r.keyword.includes(s):r.keyword!==s)throw new Error("ajv implementation error");const o=r.dependencies;if(null==o?void 0:o.some((t=>!Object.prototype.hasOwnProperty.call(e,t))))throw new Error(`parent schema must have dependencies of ${s}: ${o.join(",")}`);if(r.validateSchema&&!r.validateSchema(e[s])){const e=`keyword "${s}" value is invalid at path "${i}": `+n.errorsText(r.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 i=n(9029),r=n(4227);t.getSubschema=function(e,{keyword:t,schemaProp:n,schema:s,schemaPath:o,errSchemaPath:a,topSchemaRef:l}){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:i._`${e.schemaPath}${(0,i.getProperty)(t)}`,errSchemaPath:`${e.errSchemaPath}/${t}`}:{schema:s[n],schemaPath:i._`${e.schemaPath}${(0,i.getProperty)(t)}${(0,i.getProperty)(n)}`,errSchemaPath:`${e.errSchemaPath}/${t}/${(0,r.escapeFragment)(n)}`}}if(void 0!==s){if(void 0===o||void 0===a||void 0===l)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:s,schemaPath:o,topSchemaRef:l,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:l}){if(void 0!==o&&void 0!==n)throw new Error('both "data" and "dataProp" passed, only one allowed');const{gen:c}=t;if(void 0!==n){const{errorPath:o,dataPathArr:a,opts:l}=t;u(c.let("data",i._`${t.data}${(0,i.getProperty)(n)}`,!0)),e.errorPath=i.str`${o}${(0,r.getErrorPath)(n,s,l.jsPropertySyntax)}`,e.parentDataProperty=i._`${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 i.Name?o:c.let("data",o,!0)),void 0!==l&&(e.propertyName=l)),a&&(e.dataTypes=a)},t.extendSubschemaMode=function(e,{jtdDiscriminator:t,jtdMetadata:n,compositeRule:i,createErrors:r,allErrors:s}){void 0!==i&&(e.compositeRule=i),void 0!==r&&(e.createErrors=r),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 i=n(2586);Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return i.KeywordCxt}});var r=n(9029);Object.defineProperty(t,"_",{enumerable:!0,get:function(){return r._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return r.str}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return r.stringify}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return r.nil}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return r.Name}}),Object.defineProperty(t,"CodeGen",{enumerable:!0,get:function(){return r.CodeGen}});const s=n(3558),o=n(4551),a=n(396),l=n(3835),c=n(9029),u=n(6939),h=n(208),d=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"]),b={errorDataPath:"",format:"`validateFormats: false` can be used instead.",nullable:'"nullable" keyword is supported by default.',jsonPointers:"Deprecated jsPropertySyntax can be used instead.",extendRefs:"Deprecated ignoreKeywordsWithRef can be used instead.",missingRefs:"Pass empty schema with $id that should be ignored to ajv.addSchema.",processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cache, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."},v={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'};function w(e){var t,n,i,r,s,o,a,l,c,u,h,d,p,g,y,b,v,w,C,A,S,x,E,_,M;const T=e.strict,I=null===(t=e.code)||void 0===t?void 0:t.optimize,L=!0===I||void 0===I?1:I||0,$=null!==(i=null===(n=e.code)||void 0===n?void 0:n.regExp)&&void 0!==i?i:f,N=null!==(r=e.uriResolver)&&void 0!==r?r:m.default;return{strictSchema:null===(o=null!==(s=e.strictSchema)&&void 0!==s?s:T)||void 0===o||o,strictNumbers:null===(l=null!==(a=e.strictNumbers)&&void 0!==a?a:T)||void 0===l||l,strictTypes:null!==(u=null!==(c=e.strictTypes)&&void 0!==c?c:T)&&void 0!==u?u:"log",strictTuples:null!==(d=null!==(h=e.strictTuples)&&void 0!==h?h:T)&&void 0!==d?d:"log",strictRequired:null!==(g=null!==(p=e.strictRequired)&&void 0!==p?p:T)&&void 0!==g&&g,code:e.code?{...e.code,optimize:L,regExp:$}:{optimize:L,regExp:$},loopRequired:null!==(y=e.loopRequired)&&void 0!==y?y:200,loopEnum:null!==(b=e.loopEnum)&&void 0!==b?b:200,meta:null===(v=e.meta)||void 0===v||v,messages:null===(w=e.messages)||void 0===w||w,inlineRefs:null===(C=e.inlineRefs)||void 0===C||C,schemaId:null!==(A=e.schemaId)&&void 0!==A?A:"$id",addUsedSchema:null===(S=e.addUsedSchema)||void 0===S||S,validateSchema:null===(x=e.validateSchema)||void 0===x||x,validateFormats:null===(E=e.validateFormats)||void 0===E||E,unicodeRegExp:null===(_=e.unicodeRegExp)||void 0===_||_,int32range:null===(M=e.int32range)||void 0===M||M,uriResolver:N}}class C{constructor(e={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...w(e)};const{es5:t,lines:n}=this.opts.code;this.scope=new c.ValueScope({scope:{},prefixes:y,es5:t,lines:n}),this.logger=function(e){if(!1===e)return T;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 i=e.validateFormats;e.validateFormats=!1,this.RULES=(0,a.getRules)(),A.call(this,b,e,"NOT SUPPORTED"),A.call(this,v,e,"DEPRECATED","warn"),this._metaOpts=M.call(this),e.formats&&E.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords&&_.call(this,e.keywords),"object"==typeof e.meta&&this.addMetaSchema(e.meta),x.call(this),e.validateFormats=i}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){const{$data:e,meta:t,schemaId:n}=this.opts;let i=p;"id"===n&&(i={...p},i.id=i.$id,delete i.$id),t&&e&&this.addMetaSchema(i,i[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 i=n(t);return"$async"in n||(this.errors=n.errors),i}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 i.call(this,e,t);async function i(e,t){await r.call(this,e.$schema);const n=this._addSchema(e,t);return n.validate||s.call(this,n)}async function r(e){e&&!this.getSchema(e)&&await i.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 l.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 l(e){const n=await c.call(this,e);this.refs[e]||await r.call(this,n.$schema),this.refs[e]||this.addSchema(n,e,t)}async function c(e){const t=this._loading[e];if(t)return t;try{return await(this._loading[e]=n(e))}finally{delete this._loading[e]}}}addSchema(e,t,n,i=this.opts.validateSchema){if(Array.isArray(e)){for(const t of e)this.addSchema(t,void 0,n,i);return this}let r;if("object"==typeof e){const{schemaId:t}=this.opts;if(r=e[t],void 0!==r&&"string"!=typeof r)throw new Error(`schema ${t} must be string`)}return t=(0,u.normalizeId)(t||r),this._checkUnique(t),this.schemas[t]=this._addSchema(e,n,t,i,!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 i=this.validate(n,e);if(!i&&t){const e="schema is invalid: "+this.errorsText();if("log"!==this.opts.validateSchema)throw new Error(e);this.logger.error(e)}return i}getSchema(e){let t;for(;"string"==typeof(t=S.call(this,e));)e=t;if(void 0===t){const{schemaId:n}=this.opts,i=new l.SchemaEnv({schema:{},schemaId:n});if(t=l.resolveSchema.call(this,i,e),!t)return;this.refs[e]=t}return t.validate||this._compileSchemaEnv(t)}removeSchema(e){if(e instanceof RegExp)return this._removeAllSchemas(this.schemas,e),this._removeAllSchemas(this.refs,e),this;switch(typeof e){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{const t=S.call(this,e);return"object"==typeof t&&this._cache.delete(t.schema),delete this.schemas[e],delete this.refs[e],this}case"object":{const t=e;this._cache.delete(t);let n=e[this.opts.schemaId];return n&&(n=(0,u.normalizeId)(n),delete this.schemas[n],delete this.refs[n]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(e){for(const t of e)this.addKeyword(t);return this}addKeyword(e,t){let n;if("string"==typeof e)n=e,"object"==typeof t&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),t.keyword=n);else{if("object"!=typeof e||void 0!==t)throw new Error("invalid addKeywords parameters");if(n=(t=e).keyword,Array.isArray(n)&&!n.length)throw new Error("addKeywords: keyword must be string or non-empty array")}if(L.call(this,n,t),!t)return(0,d.eachItem)(n,(e=>$.call(this,e))),this;P.call(this,t);const i={...t,type:(0,h.getJSONTypes)(t.type),schemaType:(0,h.getJSONTypes)(t.schemaType)};return(0,d.eachItem)(n,0===i.type.length?e=>$.call(this,e,i):e=>i.type.forEach((t=>$.call(this,e,i,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 i of t){const t=i.split("/").slice(1);let r=e;for(const e of t)r=r[e];for(const e in n){const t=n[e];if("object"!=typeof t)continue;const{$data:i}=t.definition,s=r[e];i&&s&&(r[e]=R(s))}}return e}_removeAllSchemas(e,t){for(const n in e){const i=e[n];t&&!t.test(n)||("string"==typeof i?delete e[n]:i&&!i.meta&&(this._cache.delete(i.schema),delete e[n]))}}_addSchema(e,t,n,i=this.opts.validateSchema,r=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 c=u.getSchemaRefs.call(this,e,n);return a=new l.SchemaEnv({schema:e,schemaId:o,meta:t,baseId:n,localRefs:c}),this._cache.set(a.schema,a),r&&!n.startsWith("#")&&(n&&this._checkUnique(n),this.refs[n]=a),i&&this.validateSchema(e,!0),a}_checkUnique(e){if(this.schemas[e]||this.refs[e])throw new Error(`schema with key or id "${e}" already exists`)}_compileSchemaEnv(e){if(e.meta?this._compileMetaSchema(e):l.compileSchema.call(this,e),!e.validate)throw new Error("ajv implementation error");return e.validate}_compileMetaSchema(e){const t=this.opts;this.opts=this._metaOpts;try{l.compileSchema.call(this,e)}finally{this.opts=t}}}function A(e,t,n,i="error"){for(const r in e){const s=r;s in t&&this.logger[i](`${n}: option ${r}. ${e[s]}`)}}function S(e){return e=(0,u.normalizeId)(e),this.schemas[e]||this.refs[e]}function x(){const e=this.opts.schemas;if(e)if(Array.isArray(e))this.addSchema(e);else for(const t in e)this.addSchema(e[t],t)}function E(){for(const e in this.opts.formats){const t=this.opts.formats[e];t&&this.addFormat(e,t)}}function _(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 M(){const e={...this.opts};for(const t of g)delete e[t];return e}C.ValidationError=s.default,C.MissingRefError=o.default,t.default=C;const T={log(){},warn(){},error(){}},I=/^[a-z_$][a-z0-9_$:-]*$/i;function L(e,t){const{RULES:n}=this;if((0,d.eachItem)(e,(e=>{if(n.keywords[e])throw new Error(`Keyword ${e} is already defined`);if(!I.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 $(e,t,n){var i;const r=null==t?void 0:t.post;if(n&&r)throw new Error('keyword with "post" flag cannot have "type"');const{RULES:s}=this;let o=r?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,h.getJSONTypes)(t.type),schemaType:(0,h.getJSONTypes)(t.schemaType)}};t.before?N.call(this,o,a,t.before):o.rules.push(a),s.all[e]=a,null===(i=t.implements)||void 0===i||i.forEach((e=>this.addKeyword(e)))}function N(e,t,n){const i=e.rules.findIndex((e=>e.keyword===n));i>=0?e.rules.splice(i,0,t):(e.rules.push(t),this.logger.warn(`rule ${n} is not defined`))}function P(e){let{metaSchema:t}=e;void 0!==t&&(e.$data&&this.opts.$data&&(t=R(t)),e.validateSchema=this.compile(t,!0))}const O={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function R(e){return{anyOf:[e,O]}}},9572:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(1678),r=n(7216),s=n(9547),o=n(8226),a=n(518),l=n(4588),c=n(5707),u=n(7082),h=["/properties"];t.default=function(e){return[i,r,s,o,a,t(this,l),c,t(this,u)].forEach((e=>this.addMetaSchema(e,void 0,!1))),this;function t(t,n){return e?t.$dataMetaSchema(n,h):n}}},6250:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2017);i.code='require("ajv/dist/runtime/equal").default',t.default=i},3853:(e,t)=>{"use strict";function n(e){const t=e.length;let n,i=0,r=0;for(;r<t;)i++,n=e.charCodeAt(r++),n>=55296&&n<=56319&&r<t&&(n=e.charCodeAt(r),56320==(64512&n)&&r++);return i}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 i=n(8343);i.code='require("ajv/dist/runtime/uri").default',t.default=i},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 i=n(9029),r=n(4227),s={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:{message:({params:{len:e}})=>i.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>i._`{limit: ${e}}`},code(e){const{parentSchema:t,it:n}=e,{items:i}=t;Array.isArray(i)?o(e,i):(0,r.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:l}=e;l.items=!0;const c=n.const("len",i._`${o}.length`);if(!1===s)e.setParams({len:t.length}),e.pass(i._`${c} <= ${t.length}`);else if("object"==typeof s&&!(0,r.alwaysValidSchema)(l,s)){const s=n.var("valid",i._`${c} <= ${t.length}`);n.if((0,i.not)(s),(()=>function(s){n.forRange("i",t.length,c,(t=>{e.subschema({keyword:a,dataProp:t,dataPropType:r.Type.Num},s),l.allErrors||n.if((0,i.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 i=n(5765),r=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})=>r._`{additionalProperty: ${e.additionalProperty}}`},code(e){const{gen:t,schema:n,parentSchema:a,data:l,errsCount:c,it:u}=e;if(!c)throw new Error("ajv implementation error");const{allErrors:h,opts:d}=u;if(u.props=!0,"all"!==d.removeAdditional&&(0,o.alwaysValidSchema)(u,n))return;const p=(0,i.allSchemaProperties)(a.properties),m=(0,i.allSchemaProperties)(a.patternProperties);function f(e){t.code(r._`delete ${l}[${e}]`)}function g(i){if("all"===d.removeAdditional||d.removeAdditional&&!1===n)f(i);else{if(!1===n)return e.setParams({additionalProperty:i}),e.error(),void(h||t.break());if("object"==typeof n&&!(0,o.alwaysValidSchema)(u,n)){const n=t.name("valid");"failing"===d.removeAdditional?(y(i,n,!1),t.if((0,r.not)(n),(()=>{e.reset(),f(i)}))):(y(i,n),h||t.if((0,r.not)(n),(()=>t.break())))}}}function y(t,n,i){const r={keyword:"additionalProperties",dataProp:t,dataPropType:o.Type.Str};!1===i&&Object.assign(r,{compositeRule:!0,createErrors:!1,allErrors:!1}),e.subschema(r,n)}t.forIn("key",l,(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,i.isOwnProperty)(t,e,n)}else s=p.length?(0,r.or)(...p.map((e=>r._`${n} === ${e}`))):r.nil;return m.length&&(s=(0,r.or)(s,...m.map((t=>r._`${(0,i.usePattern)(e,t)}.test(${n})`)))),(0,r.not)(s)}(n),(()=>g(n))):g(n)})),e.ok(r._`${c} === ${s.default.errors}`)}};t.default=a},5844:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(4227),r={keyword:"allOf",schemaType:"array",code(e){const{gen:t,schema:n,it:r}=e;if(!Array.isArray(n))throw new Error("ajv implementation error");const s=t.name("valid");n.forEach(((t,n)=>{if((0,i.alwaysValidSchema)(r,t))return;const o=e.subschema({keyword:"allOf",schemaProp:n},s);e.ok(s),e.mergeEvaluated(o)}))}};t.default=r},6505:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:n(5765).validateUnion,error:{message:"must match a schema in anyOf"}};t.default=i},2661:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(9029),r=n(4227),s={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:{message:({params:{min:e,max:t}})=>void 0===t?i.str`must contain at least ${e} valid item(s)`:i.str`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>void 0===t?i._`{minContains: ${e}}`:i._`{minContains: ${e}, maxContains: ${t}}`},code(e){const{gen:t,schema:n,parentSchema:s,data:o,it:a}=e;let l,c;const{minContains:u,maxContains:h}=s;a.opts.next?(l=void 0===u?1:u,c=h):l=1;const d=t.const("len",i._`${o}.length`);if(e.setParams({min:l,max:c}),void 0===c&&0===l)return void(0,r.checkStrictMode)(a,'"minContains" == 0 without "maxContains": "contains" keyword ignored');if(void 0!==c&&l>c)return(0,r.checkStrictMode)(a,'"minContains" > "maxContains" is always invalid'),void e.fail();if((0,r.alwaysValidSchema)(a,n)){let t=i._`${d} >= ${l}`;return void 0!==c&&(t=i._`${t} && ${d} <= ${c}`),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(i._`${e}++`),void 0===c?t.if(i._`${e} >= ${l}`,(()=>t.assign(p,!0).break())):(t.if(i._`${e} > ${c}`,(()=>t.assign(p,!1).break())),1===l?t.assign(p,!0):t.if(i._`${e} >= ${l}`,(()=>t.assign(p,!0))))}(n)))))}function f(n,i){t.forRange("i",0,d,(t=>{e.subschema({keyword:"contains",dataProp:t,dataPropType:r.Type.Num,compositeRule:!0},n),i()}))}void 0===c&&1===l?f(p,(()=>t.if(p,(()=>t.break())))):0===l?(t.let(p,!0),void 0!==c&&t.if(i._`${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 i=n(9029),r=n(4227),s=n(5765);t.error={message:({params:{property:e,depsCount:t,deps:n}})=>{const r=1===t?"property":"properties";return i.str`must have ${r} ${n} when property ${e} is present`},params:({params:{property:e,depsCount:t,deps:n,missingProperty:r}})=>i._`{property: ${e},
5
5
  missingProperty: ${r},
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 i in e)"__proto__"!==i&&((Array.isArray(e[i])?t:n)[i]=e[i]);return[t,n]}(e);a(e,t),l(e,n)}};function a(e,t=e.schema){const{gen:n,data:r,it:o}=e;if(0===Object.keys(t).length)return;const a=n.let("missing");for(const l in t){const c=t[l];if(0===c.length)continue;const u=(0,s.propertyInData)(n,r,l,o.opts.ownProperties);e.setParams({property:l,depsCount:c.length,deps:c.join(", ")}),o.allErrors?n.if(u,(()=>{for(const t of c)(0,s.checkReportMissingProp)(e,t)})):(n.if(i._`${u} && (${(0,s.checkMissingProp)(e,c,a)})`),(0,s.reportMissingProp)(e,a),n.else())}}function l(e,t=e.schema){const{gen:n,data:i,keyword:o,it:a}=e,l=n.name("valid");for(const c in t)(0,r.alwaysValidSchema)(a,t[c])||(n.if((0,s.propertyInData)(n,i,c,a.opts.ownProperties),(()=>{const t=e.subschema({keyword:o,schemaProp:c},l);e.mergeValidEvaluated(t,l)}),(()=>n.var(l,!0))),e.ok(l))}t.validatePropertyDeps=a,t.validateSchemaDeps=l,t.default=o},4845:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(3025),r={keyword:"dependentSchemas",type:"object",schemaType:"object",code:e=>(0,i.validateSchemaDeps)(e)};t.default=r},1239:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(9029),r=n(4227),s={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:{message:({params:e})=>i.str`must match "${e.ifClause}" schema`,params:({params:e})=>i._`{failingKeyword: ${e.ifClause}}`},code(e){const{gen:t,parentSchema:n,it:s}=e;void 0===n.then&&void 0===n.else&&(0,r.checkStrictMode)(s,'"if" without "then" and "else" is ignored');const a=o(s,"then"),l=o(s,"else");if(!a&&!l)return;const c=t.let("valid",!0),u=t.name("_valid");if(function(){const t=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},u);e.mergeEvaluated(t)}(),e.reset(),a&&l){const n=t.let("ifClause");e.setParams({ifClause:n}),t.if(u,h("then",n),h("else",n))}else a?t.if(u,h("then")):t.if((0,i.not)(u),h("else"));function h(n,r){return()=>{const s=e.subschema({keyword:n},u);t.assign(c,u),e.mergeValidEvaluated(s,c),r?t.assign(r,i._`${n}`):e.setParams({ifClause:n})}}e.pass(c,(()=>e.error(!0)))}};function o(e,t){const n=e.schema[t];return void 0!==n&&!(0,r.alwaysValidSchema)(e,n)}t.default=s},6378:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(5457),r=n(5354),s=n(494),o=n(3966),a=n(2661),l=n(3025),c=n(9713),u=n(8660),h=n(117),d=n(5333),p=n(7923),m=n(6505),f=n(6163),g=n(5844),y=n(1239),b=n(4426);t.default=function(e=!1){const t=[p.default,m.default,f.default,g.default,y.default,b.default,c.default,u.default,l.default,h.default,d.default];return e?t.push(r.default,o.default):t.push(i.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 i=n(9029),r=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,r.alwaysValidSchema)(n,t)||e.ok((0,s.validateArray)(e))}};function a(e,t,n=e.schema){const{gen:s,parentSchema:o,data:a,keyword:l,it:c}=e;!function(e){const{opts:i,errSchemaPath:s}=c,o=n.length,a=o===e.minItems&&(o===e.maxItems||!1===e[t]);if(i.strictTuples&&!a){const e=`"${l}" is ${o}-tuple, but minItems or maxItems/${t} are not specified or different at path "${s}"`;(0,r.checkStrictMode)(c,e,i.strictTuples)}}(o),c.opts.unevaluated&&n.length&&!0!==c.items&&(c.items=r.mergeEvaluated.items(s,n.length,c.items));const u=s.name("valid"),h=s.const("len",i._`${a}.length`);n.forEach(((t,n)=>{(0,r.alwaysValidSchema)(c,t)||(s.if(i._`${h} > ${n}`,(()=>e.subschema({keyword:l,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 i=n(9029),r=n(4227),s=n(5765),o=n(5457),a={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:{message:({params:{len:e}})=>i.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>i._`{limit: ${e}}`},code(e){const{schema:t,parentSchema:n,it:i}=e,{prefixItems:a}=n;i.items=!0,(0,r.alwaysValidSchema)(i,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 i=n(4227),r={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){const{gen:t,schema:n,it:r}=e;if((0,i.alwaysValidSchema)(r,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=r},6163:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(9029),r=n(4227),s={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:{message:"must match exactly one schema in oneOf",params:({params:e})=>i._`{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,l=t.let("valid",!1),c=t.let("passing",null),u=t.name("_valid");e.setParams({passing:c}),t.block((function(){a.forEach(((n,s)=>{let a;(0,r.alwaysValidSchema)(o,n)?t.var(u,!0):a=e.subschema({keyword:"oneOf",schemaProp:s,compositeRule:!0},u),s>0&&t.if(i._`${u} && ${l}`).assign(l,!1).assign(c,i._`[${c}, ${s}]`).else(),t.if(u,(()=>{t.assign(l,!0),t.assign(c,s),a&&e.mergeEvaluated(a,i.Name)}))}))})),e.result(l,(()=>e.reset()),(()=>e.error(!0)))}};t.default=s},5333:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(5765),r=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:l,it:c}=e,{opts:u}=c,h=(0,i.allSchemaProperties)(n),d=h.filter((e=>(0,s.alwaysValidSchema)(c,n[e])));if(0===h.length||d.length===h.length&&(!c.opts.unevaluated||!0===c.props))return;const p=u.strictSchema&&!u.allowMatchingProperties&&l.properties,m=t.name("valid");!0===c.props||c.props instanceof r.Name||(c.props=(0,o.evaluatedPropsToName)(t,c.props));const{props:f}=c;function g(e){for(const t in p)new RegExp(e).test(t)&&(0,s.checkStrictMode)(c,`property ${t} matches pattern ${e} (use allowMatchingProperties)`)}function y(n){t.forIn("key",a,(s=>{t.if(r._`${(0,i.usePattern)(e,n)}.test(${s})`,(()=>{const i=d.includes(n);i||e.subschema({keyword:"patternProperties",schemaProp:n,dataProp:s,dataPropType:o.Type.Str},m),c.opts.unevaluated&&!0!==f?t.assign(r._`${f}[${s}]`,!0):i||c.allErrors||t.if((0,r.not)(m),(()=>t.break()))}))}))}!function(){for(const e of h)p&&g(e),c.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 i=n(494),r={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:e=>(0,i.validateTuple)(e,"items")};t.default=r},117:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2586),r=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:l,it:c}=e;"all"===c.opts.removeAdditional&&void 0===a.additionalProperties&&o.default.code(new i.KeywordCxt(c,o.default,"additionalProperties"));const u=(0,r.allSchemaProperties)(n);for(const e of u)c.definedProperties.add(e);c.opts.unevaluated&&u.length&&!0!==c.props&&(c.props=s.mergeEvaluated.props(t,(0,s.toHash)(u),c.props));const h=u.filter((e=>!(0,s.alwaysValidSchema)(c,n[e])));if(0===h.length)return;const d=t.name("valid");for(const n of h)p(n)?m(n):(t.if((0,r.propertyInData)(t,l,n,c.opts.ownProperties)),m(n),c.allErrors||t.else().var(d,!0),t.endIf()),e.it.definedProperties.add(n),e.ok(d);function p(e){return c.opts.useDefaults&&!c.compositeRule&&void 0!==n[e].default}function m(t){e.subschema({keyword:"properties",schemaProp:t,dataProp:t},d)}}};t.default=a},9713:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(9029),r=n(4227),s={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:{message:"property name must be valid",params:({params:e})=>i._`{propertyName: ${e.propertyName}}`},code(e){const{gen:t,schema:n,data:s,it:o}=e;if((0,r.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,i.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 i=n(4227),r={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:n}){void 0===t.if&&(0,i.checkStrictMode)(n,`"${e}" without "if" is ignored`)}};t.default=r},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 i=n(9029),r=n(4227),s=n(2023),o=n(4227);function a(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:i._`Object.prototype.hasOwnProperty`})}function l(e,t,n){return i._`${a(e)}.call(${t}, ${n})`}function c(e,t,n,r){const s=i._`${t}${(0,i.getProperty)(n)} === undefined`;return r?(0,i.or)(s,(0,i.not)(l(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:r,it:s}=e;n.if(c(n,r,t,s.opts.ownProperties),(()=>{e.setParams({missingProperty:i._`${t}`},!0),e.error()}))},t.checkMissingProp=function({gen:e,data:t,it:{opts:n}},r,s){return(0,i.or)(...r.map((r=>(0,i.and)(c(e,t,r,n.ownProperties),i._`${s} = ${r}`))))},t.reportMissingProp=function(e,t){e.setParams({missingProperty:t},!0),e.error()},t.hasPropFunc=a,t.isOwnProperty=l,t.propertyInData=function(e,t,n,r){const s=i._`${t}${(0,i.getProperty)(n)} !== undefined`;return r?i._`${s} && ${l(e,t,n)}`:s},t.noPropertyInData=c,t.allSchemaProperties=u,t.schemaProperties=function(e,t){return u(t).filter((n=>!(0,r.alwaysValidSchema)(e,t[n])))},t.callValidateCode=function({schemaCode:e,data:t,it:{gen:n,topSchemaRef:r,schemaPath:o,errorPath:a},it:l},c,u,h){const d=h?i._`${e}, ${t}, ${r}${o}`:t,p=[[s.default.instancePath,(0,i.strConcat)(s.default.instancePath,a)],[s.default.parentData,l.parentData],[s.default.parentDataProperty,l.parentDataProperty],[s.default.rootData,s.default.rootData]];l.opts.dynamicRef&&p.push([s.default.dynamicAnchors,s.default.dynamicAnchors]);const m=i._`${d}, ${n.object(...p)}`;return u!==i.nil?i._`${c}.call(${u}, ${m})`:i._`${c}(${m})`};const h=i._`new RegExp`;t.usePattern=function({gen:e,it:{opts:t}},n){const r=t.unicodeRegExp?"u":"",{regExp:s}=t.code,a=s(n,r);return e.scopeValue("pattern",{key:a.toString(),ref:a,code:i._`${"new RegExp"===s.code?h:(0,o.useFunc)(e,s)}(${n}, ${r})`})},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 l((()=>t.assign(e,!1))),e}return t.var(a,!0),l((()=>t.break())),a;function l(o){const l=t.const("len",i._`${n}.length`);t.forRange("i",0,l,(n=>{e.subschema({keyword:s,dataProp:n,dataPropType:r.Type.Num},a),t.if((0,i.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,r.alwaysValidSchema)(o,e)))&&!o.opts.unevaluated)return;const a=t.let("valid",!1),l=t.name("_valid");t.block((()=>n.forEach(((n,r)=>{const o=e.subschema({keyword:s,schemaProp:r,compositeRule:!0},l);t.assign(a,i._`${a} || ${l}`),e.mergeValidEvaluated(o,l)||t.if((0,i.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 i=n(3463),r=n(3693),s=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",i.default,r.default];t.default=s},3693:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.callRef=t.getValidate=void 0;const i=n(4551),r=n(5765),s=n(9029),o=n(2023),a=n(3835),l=n(4227),c={keyword:"$ref",schemaType:"string",code(e){const{gen:t,schema:n,it:r}=e,{baseId:o,schemaEnv:l,validateName:c,opts:d,self:p}=r,{root:m}=l;if(("#"===n||"#/"===n)&&o===m.baseId)return function(){if(l===m)return h(e,c,l,l.$async);const n=t.scopeValue("root",{ref:m});return h(e,s._`${n}.validate`,m,m.$async)}();const f=a.resolveRef.call(p,m,o,n);if(void 0===f)throw new i.default(r.opts.uriResolver,o,n);return f instanceof a.SchemaEnv?function(t){const n=u(e,t);h(e,n,t,t.$async)}(f):function(i){const r=t.scopeValue("schema",!0===d.code.source?{ref:i,code:(0,s.stringify)(i)}:{ref:i}),o=t.name("valid"),a=e.subschema({schema:i,dataTypes:[],schemaPath:s.nil,topSchemaRef:r,errSchemaPath:n},o);e.mergeEvaluated(a),e.ok(o)}(f)}};function u(e,t){const{gen:n}=e;return t.validate?n.scopeValue("validate",{ref:t.validate}):s._`${n.scopeValue("wrapper",{ref:t})}.validate`}function h(e,t,n,i){const{gen:a,it:c}=e,{allErrors:u,schemaEnv:h,opts:d}=c,p=d.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(!c.opts.unevaluated)return;const i=null===(t=null==n?void 0:n.validate)||void 0===t?void 0:t.evaluated;if(!0!==c.props)if(i&&!i.dynamicProps)void 0!==i.props&&(c.props=l.mergeEvaluated.props(a,i.props,c.props));else{const t=a.var("props",s._`${e}.evaluated.props`);c.props=l.mergeEvaluated.props(a,t,c.props,s.Name)}if(!0!==c.items)if(i&&!i.dynamicItems)void 0!==i.items&&(c.items=l.mergeEvaluated.items(a,i.items,c.items));else{const t=a.var("items",s._`${e}.evaluated.items`);c.items=l.mergeEvaluated.items(a,t,c.items,s.Name)}}i?function(){if(!h.$async)throw new Error("async schema referenced by sync schema");const n=a.let("valid");a.try((()=>{a.code(s._`await ${(0,r.callValidateCode)(e,t,p)}`),f(t),u||a.assign(n,!0)}),(e=>{a.if(s._`!(${e} instanceof ${c.ValidationError})`,(()=>a.throw(e))),m(e),u||a.assign(n,!1)})),e.ok(n)}():e.result((0,r.callValidateCode)(e,t,p),(()=>f(t)),(()=>m(t)))}t.getValidate=u,t.callRef=h,t.default=c},6653:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(9029),r=n(7652),s=n(3835),o=n(4551),a=n(4227),l={keyword:"discriminator",type:"object",schemaType:"object",error:{message:({params:{discrError:e,tagName:t}})=>e===r.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:n}})=>i._`{error: ${e}, tag: ${n}, tagValue: ${t}}`},code(e){const{gen:t,data:n,schema:l,parentSchema:c,it:u}=e,{oneOf:h}=c;if(!u.opts.discriminator)throw new Error("discriminator: requires discriminator option");const d=l.propertyName;if("string"!=typeof d)throw new Error("discriminator: requires propertyName");if(l.mapping)throw new Error("discriminator: mapping is not supported");if(!h)throw new Error("discriminator: requires oneOf keyword");const p=t.let("valid",!1),m=t.const("tag",i._`${n}${(0,i.getProperty)(d)}`);function f(n){const r=t.name("valid"),s=e.subschema({keyword:"oneOf",schemaProp:n},r);return e.mergeEvaluated(s,i.Name),r}t.if(i._`typeof ${m} == "string"`,(()=>function(){const n=function(){var e;const t={},n=r(c);let i=!0;for(let t=0;t<h.length;t++){let c=h[t];if((null==c?void 0:c.$ref)&&!(0,a.schemaHasRulesButRef)(c,u.self.RULES)){const e=c.$ref;if(c=s.resolveRef.call(u.self,u.schemaEnv.root,u.baseId,e),c instanceof s.SchemaEnv&&(c=c.schema),void 0===c)throw new o.default(u.opts.uriResolver,u.baseId,e)}const p=null===(e=null==c?void 0:c.properties)||void 0===e?void 0:e[d];if("object"!=typeof p)throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${d}"`);i=i&&(n||r(c)),l(p,t)}if(!i)throw new Error(`discriminator: "${d}" must be required`);return t;function r({required:e}){return Array.isArray(e)&&e.includes(d)}function l(e,t){if(e.const)p(e.const,t);else{if(!e.enum)throw new Error(`discriminator: "properties/${d}" 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: "${d}" values must be unique strings`);t[e]=n}}();t.if(!1);for(const e in n)t.elseIf(i._`${m} === ${e}`),t.assign(p,f(n[e]));t.else(),e.error(!1,{discrError:r.DiscrError.Mapping,tag:m,tagName:d}),t.endIf()}()),(()=>e.error(!1,{discrError:r.DiscrError.Tag,tag:m,tagName:d}))),e.ok(p)}};t.default=l},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 i=n(2128),r=n(7060),s=n(6378),o=n(5520),a=n(5413),l=n(3265),c=n(7532),u=n(9857),h=[o.default,i.default,r.default,(0,s.default)(!0),c.default,u.metadataVocabulary,u.contentVocabulary,a.default,l.default];t.default=h},6144:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2128),r=n(7060),s=n(6378),o=n(7532),a=n(9857),l=[i.default,r.default,(0,s.default)(),o.default,a.metadataVocabulary,a.contentVocabulary];t.default=l},2476:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.dynamicAnchor=void 0;const i=n(9029),r=n(2023),s=n(3835),o=n(3693),a={keyword:"$dynamicAnchor",schemaType:"string",code:e=>l(e,e.schema)};function l(e,t){const{gen:n,it:a}=e;a.schemaEnv.root.dynamicAnchors[t]=!0;const l=i._`${r.default.dynamicAnchors}${(0,i.getProperty)(t)}`,c="#"===a.errSchemaPath?a.validateName:function(e){const{schemaEnv:t,schema:n,self:i}=e.it,{root:r,baseId:a,localRefs:l,meta:c}=t.root,{schemaId:u}=i.opts,h=new s.SchemaEnv({schema:n,schemaId:u,root:r,baseId:a,localRefs:l,meta:c});return s.compileSchema.call(i,h),(0,o.getValidate)(e,h)}(e);n.if(i._`!${l}`,(()=>n.assign(l,c)))}t.dynamicAnchor=l,t.default=a},3252:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.dynamicRef=void 0;const i=n(9029),r=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 l=t.slice(1);if(a.allErrors)c();else{const t=n.let("valid",!1);c(t),e.ok(t)}function c(e){if(a.schemaEnv.root.dynamicAnchors[l]){const t=n.let("_v",i._`${r.default.dynamicAnchors}${(0,i.getProperty)(l)}`);n.if(t,u(t,e),u(a.validateName,e))}else u(a.validateName,e)()}function u(t,i){return i?()=>n.block((()=>{(0,s.callRef)(e,t),n.let(i,!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 i=n(2476),r=n(3252),s=n(2721),o=n(3799),a=[i.default,r.default,s.default,o.default];t.default=a},2721:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2476),r=n(4227),s={keyword:"$recursiveAnchor",schemaType:"boolean",code(e){e.schema?(0,i.dynamicAnchor)(e,""):(0,r.checkStrictMode)(e.it,"$recursiveAnchor: false is ignored")}};t.default=s},3799:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(3252),r={keyword:"$recursiveRef",schemaType:"string",code:e=>(0,i.dynamicRef)(e,e.schema)};t.default=r},4737:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(9029),r={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:{message:({schemaCode:e})=>i.str`must match format "${e}"`,params:({schemaCode:e})=>i._`{format: ${e}}`},code(e,t){const{gen:n,data:r,$data:s,schema:o,schemaCode:a,it:l}=e,{opts:c,errSchemaPath:u,schemaEnv:h,self:d}=l;c.validateFormats&&(s?function(){const s=n.scopeValue("formats",{ref:d.formats,code:c.code.formats}),o=n.const("fDef",i._`${s}[${a}]`),l=n.let("fType"),u=n.let("format");n.if(i._`typeof ${o} == "object" && !(${o} instanceof RegExp)`,(()=>n.assign(l,i._`${o}.type || "string"`).assign(u,i._`${o}.validate`)),(()=>n.assign(l,i._`"string"`).assign(u,o))),e.fail$data((0,i.or)(!1===c.strictSchema?i.nil:i._`${a} && !${u}`,function(){const e=h.$async?i._`(${o}.async ? await ${u}(${r}) : ${u}(${r}))`:i._`${u}(${r})`,n=i._`(typeof ${u} == "function" ? ${e} : ${u}.test(${r}))`;return i._`${u} && ${u} !== true && ${l} === ${t} && !${n}`}()))}():function(){const s=d.formats[o];if(!s)return void function(){if(!1!==c.strictSchema)throw new Error(e());function e(){return`unknown format "${o}" ignored in schema at path "${u}"`}d.logger.warn(e())}();if(!0===s)return;const[a,l,p]=function(e){const t=e instanceof RegExp?(0,i.regexpCode)(e):c.code.formats?i._`${c.code.formats}${(0,i.getProperty)(o)}`:void 0,r=n.scopeValue("formats",{key:o,ref:e,code:t});return"object"!=typeof e||e instanceof RegExp?["string",e,r]:[e.type||"string",e.validate,i._`${r}.validate`]}(s);a===t&&e.pass(function(){if("object"==typeof s&&!(s instanceof RegExp)&&s.async){if(!h.$async)throw new Error("async format in sync schema");return i._`await ${p}(${r})`}return"function"==typeof l?i._`${p}(${r})`:i._`${p}.test(${r})`}())}())}};t.default=r},7532:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=[n(4737).default];t.default=i},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 i=n(1846),r=n(4845),s=n(2626),o=[i.default,r.default,s.default];t.default=o},3265:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(392),r=n(3445),s=[i.default,r.default];t.default=s},3445:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(9029),r=n(4227),s={keyword:"unevaluatedItems",type:"array",schemaType:["boolean","object"],error:{message:({params:{len:e}})=>i.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>i._`{limit: ${e}}`},code(e){const{gen:t,schema:n,data:s,it:o}=e,a=o.items||0;if(!0===a)return;const l=t.const("len",i._`${s}.length`);if(!1===n)e.setParams({len:a}),e.fail(i._`${l} > ${a}`);else if("object"==typeof n&&!(0,r.alwaysValidSchema)(o,n)){const n=t.var("valid",i._`${l} <= ${a}`);t.if((0,i.not)(n),(()=>function(n,s){t.forRange("i",s,l,(s=>{e.subschema({keyword:"unevaluatedItems",dataProp:s,dataPropType:r.Type.Num},n),o.allErrors||t.if((0,i.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 i=n(9029),r=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})=>i._`{unevaluatedProperty: ${e.unevaluatedProperty}}`},code(e){const{gen:t,schema:n,data:o,errsCount:a,it:l}=e;if(!a)throw new Error("ajv implementation error");const{allErrors:c,props:u}=l;function h(s){if(!1===n)return e.setParams({unevaluatedProperty:s}),e.error(),void(c||t.break());if(!(0,r.alwaysValidSchema)(l,n)){const n=t.name("valid");e.subschema({keyword:"unevaluatedProperties",dataProp:s,dataPropType:r.Type.Str},n),c||t.if((0,i.not)(n),(()=>t.break()))}}u instanceof i.Name?t.if(i._`${u} !== true`,(()=>t.forIn("key",o,(e=>t.if(function(e,t){return i._`!${e} || !${e}[${t}]`}(u,e),(()=>h(e))))))):!0!==u&&t.forIn("key",o,(e=>void 0===u?h(e):t.if(function(e,t){const n=[];for(const r in e)!0===e[r]&&n.push(i._`${t} !== ${r}`);return(0,i.and)(...n)}(u,e),(()=>h(e))))),l.props=!0,e.ok(i._`${a} === ${s.default.errors}`)}};t.default=o},7935:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(9029),r=n(4227),s=n(6250),o={keyword:"const",$data:!0,error:{message:"must be equal to constant",params:({schemaCode:e})=>i._`{allowedValue: ${e}}`},code(e){const{gen:t,data:n,$data:o,schemaCode:a,schema:l}=e;o||l&&"object"==typeof l?e.fail$data(i._`!${(0,r.useFunc)(t,s.default)}(${n}, ${a})`):e.fail(i._`${l} !== ${n}`)}};t.default=o},1846:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(3025),r={keyword:"dependentRequired",type:"object",schemaType:"object",error:i.error,code:e=>(0,i.validatePropertyDeps)(e)};t.default=r},8643:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(9029),r=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})=>i._`{allowedValues: ${e}}`},code(e){const{gen:t,data:n,$data:o,schema:a,schemaCode:l,it:c}=e;if(!o&&0===a.length)throw new Error("enum must have non-empty array");const u=a.length>=c.opts.loopEnum;let h;const d=()=>null!=h?h:h=(0,r.useFunc)(t,s.default);let p;if(u||o)p=t.let("valid"),e.block$data(p,(function(){t.assign(p,!1),t.forOf("v",l,(e=>t.if(i._`${d()}(${n}, ${e})`,(()=>t.assign(p,!0).break()))))}));else{if(!Array.isArray(a))throw new Error("ajv implementation error");const e=t.const("vSchema",l);p=(0,i.or)(...a.map(((t,r)=>function(e,t){const r=a[t];return"object"==typeof r&&null!==r?i._`${d()}(${n}, ${e}[${t}])`:i._`${n} === ${r}`}(e,r))))}e.pass(p)}};t.default=o},7060:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(5882),r=n(3439),s=n(7307),o=n(422),a=n(4486),l=n(4003),c=n(1163),u=n(617),h=n(7935),d=n(8643),p=[i.default,r.default,s.default,o.default,a.default,l.default,c.default,u.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},h.default,d.default];t.default=p},2626:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(4227),r={keyword:["maxContains","minContains"],type:"array",schemaType:"number",code({keyword:e,parentSchema:t,it:n}){void 0===t.contains&&(0,i.checkStrictMode)(n,`"${e}" without "contains" is ignored`)}};t.default=r},1163:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(9029),r={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:{message({keyword:e,schemaCode:t}){const n="maxItems"===e?"more":"fewer";return i.str`must NOT have ${n} than ${t} items`},params:({schemaCode:e})=>i._`{limit: ${e}}`},code(e){const{keyword:t,data:n,schemaCode:r}=e,s="maxItems"===t?i.operators.GT:i.operators.LT;e.fail$data(i._`${n}.length ${s} ${r}`)}};t.default=r},7307:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(9029),r=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 i.str`must NOT have ${n} than ${t} characters`},params:({schemaCode:e})=>i._`{limit: ${e}}`},code(e){const{keyword:t,data:n,schemaCode:o,it:a}=e,l="maxLength"===t?i.operators.GT:i.operators.LT,c=!1===a.opts.unicode?i._`${n}.length`:i._`${(0,r.useFunc)(e.gen,s.default)}(${n})`;e.fail$data(i._`${c} ${l} ${o}`)}};t.default=o},5882:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(9029),r=i.operators,s={maximum:{okStr:"<=",ok:r.LTE,fail:r.GT},minimum:{okStr:">=",ok:r.GTE,fail:r.LT},exclusiveMaximum:{okStr:"<",ok:r.LT,fail:r.GTE},exclusiveMinimum:{okStr:">",ok:r.GT,fail:r.LTE}},o={message:({keyword:e,schemaCode:t})=>i.str`must be ${s[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>i._`{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:r}=e;e.fail$data(i._`${n} ${s[t].fail} ${r} || isNaN(${n})`)}};t.default=a},4486:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(9029),r={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:{message({keyword:e,schemaCode:t}){const n="maxProperties"===e?"more":"fewer";return i.str`must NOT have ${n} than ${t} properties`},params:({schemaCode:e})=>i._`{limit: ${e}}`},code(e){const{keyword:t,data:n,schemaCode:r}=e,s="maxProperties"===t?i.operators.GT:i.operators.LT;e.fail$data(i._`Object.keys(${n}).length ${s} ${r}`)}};t.default=r},3439:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(9029),r={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:{message:({schemaCode:e})=>i.str`must be multiple of ${e}`,params:({schemaCode:e})=>i._`{multipleOf: ${e}}`},code(e){const{gen:t,data:n,schemaCode:r,it:s}=e,o=s.opts.multipleOfPrecision,a=t.let("res"),l=o?i._`Math.abs(Math.round(${a}) - ${a}) > 1e-${o}`:i._`${a} !== parseInt(${a})`;e.fail$data(i._`(${r} === 0 || (${a} = ${n}/${r}, ${l}))`)}};t.default=r},422:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(5765),r=n(9029),s={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:{message:({schemaCode:e})=>r.str`must match pattern "${e}"`,params:({schemaCode:e})=>r._`{pattern: ${e}}`},code(e){const{data:t,$data:n,schema:s,schemaCode:o,it:a}=e,l=a.opts.unicodeRegExp?"u":"",c=n?r._`(new RegExp(${o}, ${l}))`:(0,i.usePattern)(e,s);e.fail$data(r._`!${c}.test(${t})`)}};t.default=s},4003:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(5765),r=n(9029),s=n(4227),o={keyword:"required",type:"object",schemaType:"array",$data:!0,error:{message:({params:{missingProperty:e}})=>r.str`must have required property '${e}'`,params:({params:{missingProperty:e}})=>r._`{missingProperty: ${e}}`},code(e){const{gen:t,schema:n,schemaCode:o,data:a,$data:l,it:c}=e,{opts:u}=c;if(!l&&0===n.length)return;const h=n.length>=u.loopRequired;if(c.allErrors?function(){if(h||l)e.block$data(r.nil,d);else for(const t of n)(0,i.checkReportMissingProp)(e,t)}():function(){const s=t.let("missing");if(h||l){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,i.propertyInData)(t,a,n,u.ownProperties)),t.if((0,r.not)(s),(()=>{e.error(),t.break()}))}),r.nil)}(s,n))),e.ok(n)}else t.if((0,i.checkMissingProp)(e,n,s)),(0,i.reportMissingProp)(e,s),t.else()}(),u.strictRequired){const t=e.parentSchema.properties,{definedProperties:i}=e.it;for(const e of n)if(void 0===(null==t?void 0:t[e])&&!i.has(e)){const t=`required property "${e}" is not defined at "${c.schemaEnv.baseId+c.errSchemaPath}" (strictRequired)`;(0,s.checkStrictMode)(c,t,c.opts.strictRequired)}}function d(){t.forOf("prop",o,(n=>{e.setParams({missingProperty:n}),t.if((0,i.noPropertyInData)(t,a,n,u.ownProperties),(()=>e.error()))}))}}};t.default=o},617:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(208),r=n(9029),s=n(4227),o=n(6250),a={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:{message:({params:{i:e,j:t}})=>r.str`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>r._`{i: ${e}, j: ${t}}`},code(e){const{gen:t,data:n,$data:a,schema:l,parentSchema:c,schemaCode:u,it:h}=e;if(!a&&!l)return;const d=t.let("valid"),p=c.items?(0,i.getSchemaTypes)(c.items):[];function m(s,o){const a=t.name("item"),l=(0,i.checkDataTypes)(p,a,h.opts.strictNumbers,i.DataType.Wrong),c=t.const("indices",r._`{}`);t.for(r._`;${s}--;`,(()=>{t.let(a,r._`${n}[${s}]`),t.if(l,r._`continue`),p.length>1&&t.if(r._`typeof ${a} == "string"`,r._`${a} += "_"`),t.if(r._`typeof ${c}[${a}] == "number"`,(()=>{t.assign(o,r._`${c}[${a}]`),e.error(),t.assign(d,!1).break()})).code(r._`${c}[${a}] = ${s}`)}))}function f(i,a){const l=(0,s.useFunc)(t,o.default),c=t.name("outer");t.label(c).for(r._`;${i}--;`,(()=>t.for(r._`${a} = ${i}; ${a}--;`,(()=>t.if(r._`${l}(${n}[${i}], ${n}[${a}])`,(()=>{e.error(),t.assign(d,!1).break(c)}))))))}e.block$data(d,(function(){const i=t.let("i",r._`${n}.length`),s=t.let("j");e.setParams({i,j:s}),t.assign(d,!0),t.if(r._`${i} > 1`,(()=>(p.length>0&&!p.some((e=>"object"===e||"array"===e))?m:f)(i,s)))}),r._`${u} === false`),e.ok(d)}};t.default=a},5488:(e,t,n)=>{"use strict";n.d(t,{A:()=>a});var i=n(1354),r=n.n(i),s=n(6314),o=n.n(s)()(r());o.push([e.id,"\n.ui-form.ui-tooltip .ui-input-root > label.ui-input-label:not(:empty) {\n /* min-width: 30px; /* Breaks right margin /**/\n}\n\n.ui-form.ui-tooltip .ui-input-root > div.ui-input-text:not(:empty) {\n margin-top: 6px;\n}","",{version:3,sources:["webpack://./css/cell-renderer.css"],names:[],mappings:";AACA;IACI,8CAA8C;AAClD;;AAEA;IACI,eAAe;AACnB",sourcesContent:["\n.ui-form.ui-tooltip .ui-input-root > label.ui-input-label:not(:empty) {\n /* min-width: 30px; /* Breaks right margin /**/\n}\n\n.ui-form.ui-tooltip .ui-input-root > div.ui-input-text:not(:empty) {\n margin-top: 6px;\n}"],sourceRoot:""}]);const a=o},5999:(e,t,n)=>{"use strict";n.d(t,{A:()=>a});var i=n(1354),r=n.n(i),s=n(6314),o=n.n(s)()(r());o.push([e.id,".macromolecule-cell-comp-analysis-host{\n max-height: 250px;\n overflow-y: scroll;\n}\n\n.macromolecule-cell-comp-analysis-bar{\n height: inherit;\n display: block;\n margin-top: 1.5px;\n margin-bottom: 1.5px;\n margin-right: 3px;\n}\n\n.macromolecule-cell-comp-analysis-value{\n display: flex;\n}","",{version:3,sources:["webpack://./css/composition-analysis.css"],names:[],mappings:"AAAA;IACI,iBAAiB;IACjB,kBAAkB;AACtB;;AAEA;IACI,eAAe;IACf,cAAc;IACd,iBAAiB;IACjB,oBAAoB;IACpB,iBAAiB;AACrB;;AAEA;IACI,aAAa;AACjB",sourcesContent:[".macromolecule-cell-comp-analysis-host{\n max-height: 250px;\n overflow-y: scroll;\n}\n\n.macromolecule-cell-comp-analysis-bar{\n height: inherit;\n display: block;\n margin-top: 1.5px;\n margin-bottom: 1.5px;\n margin-right: 3px;\n}\n\n.macromolecule-cell-comp-analysis-value{\n display: flex;\n}"],sourceRoot:""}]);const a=o},6369:(e,t,n)=>{"use strict";n.d(t,{A:()=>a});var i=n(1354),r=n.n(i),s=n(6314),o=n.n(s)()(r());o.push([e.id,".kalign-version {\n margin-bottom: 0;\n text-align: end;\n font-size: 12px;\n opacity: 0.8;\n}\nbutton.msa-params-button.ui-btn {\n justify-content: end;\n}","",{version:3,sources:["webpack://./css/msa.css"],names:[],mappings:"AAAA;IACI,gBAAgB;IAChB,eAAe;IACf,eAAe;IACf,YAAY;AAChB;AACA;IACI,oBAAoB;AACxB",sourcesContent:[".kalign-version {\n margin-bottom: 0;\n text-align: end;\n font-size: 12px;\n opacity: 0.8;\n}\nbutton.msa-params-button.ui-btn {\n justify-content: end;\n}"],sourceRoot:""}]);const a=o},7939:(e,t,n)=>{"use strict";n.d(t,{A:()=>a});var i=n(1354),r=n.n(i),s=n(6314),o=n.n(s)()(r());o.push([e.id,".scatter_plot_link {\n position: absolute!important;\n right: 10px;\n}\n\n.cliffs_grid {\n top: 10px;\n}\n\n.show_only_cliffs {\n top: 30px;\n}\n\n.ml-dim-reduction-settings-input i.grok-icon.grok-font-icon-settings {\n font-size: 18px;\n position: absolute;\n height: 28px;\n \n}\n\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 i=n(1354),r=n.n(i),s=n(6314),o=n.n(s)()(r());o.push([e.id,".monomer-lib-controls-form {\n margin-left: auto;\n margin-right: auto;\n display: flex;\n flex-direction: column;\n align-items: center;\n width: 100%;\n}\n","",{version:3,sources:["webpack://./src/utils/monomer-lib/library-file-manager/style.css"],names:[],mappings:"AAAA;EACE,iBAAiB;EACjB,kBAAkB;EAClB,aAAa;EACb,sBAAsB;EACtB,mBAAmB;EACnB,WAAW;AACb",sourcesContent:[".monomer-lib-controls-form {\n margin-left: auto;\n margin-right: auto;\n display: flex;\n flex-direction: column;\n align-items: center;\n width: 100%;\n}\n"],sourceRoot:""}]);const a=o},6314:e=>{"use strict";e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",i=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),i&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),i&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,i,r,s){"string"==typeof e&&(e=[[null,e,void 0]]);var o={};if(i)for(var a=0;a<this.length;a++){var l=this[a][0];null!=l&&(o[l]=!0)}for(var c=0;c<e.length;c++){var u=[].concat(e[c]);i&&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),r&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=r):u[4]="".concat(r)),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 i=btoa(unescape(encodeURIComponent(JSON.stringify(n)))),r="sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(i),s="/*# ".concat(r," */");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 i,r,s;if(Array.isArray(t)){if((i=t.length)!=n.length)return!1;for(r=i;0!=r--;)if(!e(t[r],n[r]))return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if((i=(s=Object.keys(t)).length)!==Object.keys(n).length)return!1;for(r=i;0!=r--;)if(!Object.prototype.hasOwnProperty.call(n,s[r]))return!1;for(r=i;0!=r--;){var o=s[r];if(!e(t[o],n[o]))return!1}return!0}return t!=t&&n!=n}},9982:function(e,t,n){var i;!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,i,r,s){for(var o,a,l,c,u,h,d,p,m,f,g,y,b;s>=64;){for(o=n[0],a=n[1],l=n[2],c=n[3],u=n[4],h=n[5],d=n[6],p=n[7],f=0;f<16;f++)g=r+4*f,e[f]=(255&i[g])<<24|(255&i[g+1])<<16|(255&i[g+2])<<8|255&i[g+3];for(f=16;f<64;f++)y=((m=e[f-2])>>>17|m<<15)^(m>>>19|m<<13)^m>>>10,b=((m=e[f-15])>>>7|m<<25)^(m>>>18|m<<14)^m>>>3,e[f]=(y+e[f-7]|0)+(b+e[f-16]|0);for(f=0;f<64;f++)y=(((u>>>6|u<<26)^(u>>>11|u<<21)^(u>>>25|u<<7))+(u&h^~u&d)|0)+(p+(t[f]+e[f]|0)|0)|0,b=((o>>>2|o<<30)^(o>>>13|o<<19)^(o>>>22|o<<10))+(o&a^o&l^a&l)|0,p=d,d=h,h=u,u=c+y|0,c=l,l=a,a=o,o=y+b|0;n[0]+=o,n[1]+=a,n[2]+=l,n[3]+=c,n[4]+=u,n[5]+=h,n[6]+=d,n[7]+=p,r+=64,s-=64}return r}var i=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 i=0;if(this.bytesHashed+=t,this.bufferLength>0){for(;this.bufferLength<64&&t>0;)this.buffer[this.bufferLength++]=e[i++],t--;64===this.bufferLength&&(n(this.temp,this.state,this.buffer,0,64),this.bufferLength=0)}for(t>=64&&(i=n(this.temp,this.state,e,i,t),t%=64);t>0;)this.buffer[this.bufferLength++]=e[i++],t--;return this},t.prototype.finish=function(e){if(!this.finished){var t=this.bytesHashed,i=this.bufferLength,r=t/536870912|0,s=t<<3,o=t%64<56?64:128;this.buffer[i]=128;for(var a=i+1;a<o-8;a++)this.buffer[a]=0;this.buffer[o-8]=r>>>24&255,this.buffer[o-7]=r>>>16&255,this.buffer[o-6]=r>>>8&255,this.buffer[o-5]=r>>>0&255,this.buffer[o-4]=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=i;var r=function(){function e(e){this.inner=new i,this.outer=new i,this.blockSize=this.inner.blockSize,this.digestLength=this.inner.digestLength;var t=new Uint8Array(this.blockSize);if(e.length>this.blockSize)(new i).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 i).update(e),n=t.digest();return t.clean(),n}function o(e,t){var n=new r(e).update(t),i=n.digest();return n.clean(),i}function a(e,t,n,i){var r=i[0];if(0===r)throw new Error("hkdf: cannot expand more");t.reset(),r>1&&t.update(e),n&&t.update(n),t.update(i),t.finish(e),i[0]++}e.HMAC=r,e.hash=s,e.default=s,e.hmac=o;var l=new Uint8Array(e.digestLength);e.hkdf=function(e,t,n,i){void 0===t&&(t=l),void 0===i&&(i=32);for(var s=new Uint8Array([1]),c=o(t,e),u=new r(c),h=new Uint8Array(u.digestLength),d=h.length,p=new Uint8Array(i),m=0;m<i;m++)d===h.length&&(a(h,u,n,s),d=0),p[m]=h[d++];return u.clean(),h.fill(0),s.fill(0),p},e.pbkdf2=function(e,t,n,i){for(var s=new r(e),o=s.digestLength,a=new Uint8Array(4),l=new Uint8Array(o),c=new Uint8Array(o),u=new Uint8Array(i),h=0;h*o<i;h++){var d=h+1;a[0]=d>>>24&255,a[1]=d>>>16&255,a[2]=d>>>8&255,a[3]=d>>>0&255,s.reset(),s.update(t),s.update(a),s.finish(c);for(var p=0;p<o;p++)l[p]=c[p];for(p=2;p<=n;p++){s.reset(),s.update(c).finish(c);for(var m=0;m<o;m++)l[m]^=c[m]}for(p=0;p<o&&h*o+p<i;p++)u[h*o+p]=l[p]}for(h=0;h<o;h++)l[h]=c[h]=0;for(h=0;h<4;h++)a[h]=0;return s.clean(),u}}(t);var r=t.default;for(var s in t)r[s]=t[s];"object"==typeof e.exports?e.exports=r:void 0===(i=function(){return r}.call(t,n,t,e))||(e.exports=i)}()},2787:(e,t,n)=>{"use strict";n.d(t,{I:()=>r});const i=new Uint32Array(65536),r=(e,t)=>{if(e.length<t.length){const n=t;t=e,e=n}return 0===t.length?e.length:e.length<=32?((e,t)=>{const n=e.length,r=t.length,s=1<<n-1;let o=-1,a=0,l=n,c=n;for(;c--;)i[e.charCodeAt(c)]|=1<<c;for(c=0;c<r;c++){let e=i[t.charCodeAt(c)];const n=e|a;e|=(e&o)+o^o,a|=~(e|o),o&=e,a&s&&l++,o&s&&l--,a=a<<1|1,o=o<<1|~(n|a),a&=n}for(c=n;c--;)i[e.charCodeAt(c)]=0;return l})(e,t):((e,t)=>{const n=t.length,r=e.length,s=[],o=[],a=Math.ceil(n/32),l=Math.ceil(r/32);for(let e=0;e<a;e++)o[e]=-1,s[e]=0;let c=0;for(;c<l-1;c++){let a=0,l=-1;const u=32*c,h=Math.min(32,r)+u;for(let t=u;t<h;t++)i[e.charCodeAt(t)]|=1<<t;for(let e=0;e<n;e++){const n=i[t.charCodeAt(e)],r=o[e/32|0]>>>e&1,c=s[e/32|0]>>>e&1,u=n|a,h=((n|c)&l)+l^l|n|c;let d=a|~(h|l),p=l&h;d>>>31^r&&(o[e/32|0]^=1<<e),p>>>31^c&&(s[e/32|0]^=1<<e),d=d<<1|r,p=p<<1|c,l=p|~(u|d),a=d&u}for(let t=u;t<h;t++)i[e.charCodeAt(t)]=0}let u=0,h=-1;const d=32*c,p=Math.min(32,r-d)+d;for(let t=d;t<p;t++)i[e.charCodeAt(t)]|=1<<t;let m=r;for(let e=0;e<n;e++){const n=i[t.charCodeAt(e)],a=o[e/32|0]>>>e&1,l=s[e/32|0]>>>e&1,c=n|u,d=((n|l)&h)+h^h|n|l;let p=u|~(d|h),f=h&d;m+=p>>>r-1&1,m-=f>>>r-1&1,p>>>31^a&&(o[e/32|0]^=1<<e),f>>>31^l&&(s[e/32|0]^=1<<e),p=p<<1|a,f=f<<1|l,h=f|~(c|p),u=p&c}for(let t=d;t<p;t++)i[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,i,r=Array.prototype.slice.call(arguments).slice(1);for(t=0,i=r.length;t<i;t++)if(r[t])for(n in r[t])e[n]=r[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,i=e.order,r=e.size,s={},o=new Float32Array(10*i),a=new Float32Array(3*r);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,i,r,l,c,u,h){var d=s[r],p=s[l],m=t(e,i,r,l,c,u,h);o[d+6]+=m,o[p+6]+=m,a[n]=d,a[n+1]=p,a[n+2]=m,n+=3})),{nodes:o,edges:a}},t.assignLayoutChanges=function(e,t,n){var i=0;e.updateEachNodeAttributes((function(e,r){return r.x=t[i],r.y=t[i+1],i+=10,n?n(e,r):r}))},t.readGraphPositions=function(e,t){var n=0;e.forEachNode((function(e,i){t[n]=i.x,t[n+1]=i.y,n+=10}))},t.collectLayoutChanges=function(e,t,n){for(var i=e.nodes(),r={},s=0,o=0,a=t.length;s<a;s+=10){if(n){var l=Object.assign({},e.getNodeAttributes(i[o]));l.x=t[s],l.y=t[s+1],l=n(i[o],l),r[i[o]]={x:l.x,y:l.y}}else r[i[o]]={x:t[s],y:t[s+1]};o++}return r},t.createWorker=function(e){var t=window.URL||window.webkitURL,n=e.toString(),i=t.createObjectURL(new Blob(["("+n+").call(this);"],{type:"text/javascript"})),r=new Worker(i);return t.revokeObjectURL(i),r}},8903:(e,t,n)=>{var i=n(1736),r=n(8153).Fd,s=n(2561),o=n(1782),a=n(9937);function l(e,t,n){if(!i(t))throw new Error("graphology-layout-forceatlas2: the given graph is not a valid graphology instance.");"number"==typeof n&&(n={iterations:n});var l=n.iterations;if("number"!=typeof l)throw new Error("graphology-layout-forceatlas2: invalid number of iterations.");if(l<=0)throw new Error("graphology-layout-forceatlas2: you should provide a positive number of iterations.");var c=r("getEdgeWeight"in n?n.getEdgeWeight:"weight").fromEntry,u="function"==typeof n.outputReducer?n.outputReducer:null,h=o.assign({},a,n.settings),d=o.validateSettings(h);if(d)throw new Error("graphology-layout-forceatlas2: "+d.message);var p,m=o.graphToByteArrays(t,c);for(p=0;p<l;p++)s(h,m.nodes,m.edges);if(!e)return o.collectLayoutChanges(t,m.nodes);o.assignLayoutChanges(t,m.nodes,u)}var c=l.bind(null,!1);c.assign=l.bind(null,!0),c.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=c},2561:e=>{var t=10;e.exports=function(e,n,i){var r,s,o,a,l,c,u,h,d,p,m,f,g,y,b,v,w,C,A,S,x,E,_,M=n.length,T=i.length,I=e.adjustSizes,L=e.barnesHutTheta*e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]=n[N[s+0]+0],N[s+8]=n[N[s+0]+1],N[$+0]=N[s+0],N[s+0]=-1,$===(P=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(O--){s=$;continue}O=3;break}N[P+0]=o;break}$=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=$}}if(e.barnesHutOptimize){for(f=e.scalingRatio,o=0;o<M;o+=t)for(s=0;;)if(N[s+5]>=0){if(v=Math.pow(n[o+0]-N[s+7],2)+Math.pow(n[o+1]-N[s+8],2),4*(p=N[s+3])*p/v<L){if(g=n[o+0]-N[s+7],y=n[o+1]-N[s+8],!0===I?v>0?(w=f*n[o+6]*N[s+6]/v,n[o+2]+=g*w,n[o+3]+=y*w):v<0&&(w=-f*n[o+6]*N[s+6]/Math.sqrt(v),n[o+2]+=g*w,n[o+3]+=y*w):v>0&&(w=f*n[o+6]*N[s+6]/v,n[o+2]+=g*w,n[o+3]+=y*w),(s=N[s+4])<0)break;continue}s=N[s+5]}else if((c=N[s+0])>=0&&c!==o&&(v=(g=n[o+0]-n[c+0])*g+(y=n[o+1]-n[c+1])*y,!0===I?v>0?(w=f*n[o+6]*n[c+6]/v,n[o+2]+=g*w,n[o+3]+=y*w):v<0&&(w=-f*n[o+6]*n[c+6]/Math.sqrt(v),n[o+2]+=g*w,n[o+3]+=y*w):v>0&&(w=f*n[o+6]*n[c+6]/v,n[o+2]+=g*w,n[o+3]+=y*w)),(s=N[s+4])<0)break}else for(f=e.scalingRatio,a=0;a<M;a+=t)for(l=0;l<a;l+=t)g=n[a+0]-n[l+0],y=n[a+1]-n[l+1],!0===I?(v=Math.sqrt(g*g+y*y)-n[a+8]-n[l+8])>0?(w=f*n[a+6]*n[l+6]/v/v,n[a+2]+=g*w,n[a+3]+=y*w,n[l+2]-=g*w,n[l+3]-=y*w):v<0&&(w=100*f*n[a+6]*n[l+6],n[a+2]+=g*w,n[a+3]+=y*w,n[l+2]-=g*w,n[l+3]-=y*w):(v=Math.sqrt(g*g+y*y))>0&&(w=f*n[a+6]*n[l+6]/v/v,n[a+2]+=g*w,n[a+3]+=y*w,n[l+2]-=g*w,n[l+3]-=y*w);for(d=e.gravity/e.scalingRatio,f=e.scalingRatio,o=0;o<M;o+=t)w=0,g=n[o+0],y=n[o+1],v=Math.sqrt(Math.pow(g,2)+Math.pow(y,2)),e.strongGravityMode?v>0&&(w=f*n[o+6]*d):v>0&&(w=f*n[o+6]*d/v),n[o+2]-=g*w,n[o+3]-=y*w;for(f=1*(e.outboundAttractionDistribution?m:1),u=0;u<T;u+=3)a=i[u+0],l=i[u+1],h=i[u+2],b=Math.pow(h,e.edgeWeightInfluence),g=n[a+0]-n[l+0],y=n[a+1]-n[l+1],!0===I?(v=Math.sqrt(g*g+y*y)-n[a+8]-n[l+8],e.linLogMode?e.outboundAttractionDistribution?v>0&&(w=-f*b*Math.log(1+v)/v/n[a+6]):v>0&&(w=-f*b*Math.log(1+v)/v):e.outboundAttractionDistribution?v>0&&(w=-f*b/n[a+6]):v>0&&(w=-f*b)):(v=Math.sqrt(Math.pow(g,2)+Math.pow(y,2)),e.linLogMode?e.outboundAttractionDistribution?v>0&&(w=-f*b*Math.log(1+v)/v/n[a+6]):v>0&&(w=-f*b*Math.log(1+v)/v):e.outboundAttractionDistribution?(v=1,w=-f*b/n[a+6]):(v=1,w=-f*b)),v>0&&(n[a+2]+=g*w,n[a+3]+=y*w,n[l+2]-=g*w,n[l+3]-=y*w);if(!0===I)for(o=0;o<M;o+=t)1!==n[o+9]&&((C=Math.sqrt(Math.pow(n[o+2],2)+Math.pow(n[o+3],2)))>10&&(n[o+2]=10*n[o+2]/C,n[o+3]=10*n[o+3]/C),A=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])),S=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,x=.1*Math.log(1+S)/(1+Math.sqrt(A)),E=n[o+0]+n[o+2]*(x/e.slowDown),n[o+0]=E,_=n[o+1]+n[o+3]*(x/e.slowDown),n[o+1]=_);else for(o=0;o<M;o+=t)1!==n[o+9]&&(A=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])),S=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,x=n[o+7]*Math.log(1+S)/(1+Math.sqrt(A)),n[o+7]=Math.min(1,Math.sqrt(x*(Math.pow(n[o+2],2)+Math.pow(n[o+3],2))/(1+Math.sqrt(A)))),E=n[o+0]+n[o+2]*(x/e.slowDown),n[o+0]=E,_=n[o+1]+n[o+3]*(x/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={},i=function(e){return void 0===e?t:e};"function"==typeof t&&(i=t);var r=function(t){return i(t[e])},s=function(){return i(void 0)};return"string"==typeof e?(n.fromAttributes=r,n.fromGraph=function(e,t){return r(e.getEdgeAttributes(t))},n.fromEntry=function(e,t){return r(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 r=t.extremities(n);return i(e(n,t.getEdgeAttributes(n),r[0],r[1],t.getNodeAttributes(r[0]),t.getNodeAttributes(r[1]),t.isUndirected(n)))},n.fromEntry=function(t,n,r,s,o,a,l){return i(e(t,n,r,s,o,a,l))},n.fromPartialEntry=function(t,n,r,s){return i(e(t,n,r,s))},n.fromMinimalEntry=function(t,n){return i(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,i(e,t)}function n(e){return n=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},n(e)}function i(e,t){return i=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},i(e,t)}function r(e,t,n){return r=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 r=[null];r.push.apply(r,t);var s=new(Function.bind.apply(e,r));return n&&i(s,n.prototype),s},r.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 r(e,arguments,n(this).constructor)}return o.prototype=Object.create(e.prototype,{constructor:{value:o,enumerable:!1,writable:!0,configurable:!0}}),i(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 i in arguments[t])e[i]=arguments[t][i];return e};function l(e,t,n,i){var r=e._nodes.get(t),s=null;return r?s="mixed"===i?r.out&&r.out[n]||r.undirected&&r.undirected[n]:"directed"===i?r.out&&r.out[n]:r.undirected&&r.undirected[n]:s}function c(t){return"object"===e(t)&&null!==t}function u(e){var t;for(t in e)return!1;return!0}function h(e,t,n){Object.defineProperty(e,t,{enumerable:!1,configurable:!1,writable:!0,value:n})}function d(e,t,n){var i={enumerable:!0,configurable:!0};"function"==typeof n?i.get=n:(i.value=n,i.writable=!1),Object.defineProperty(e,t,i)}function p(e){return!(!c(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 b=Number.isNaN||function(e){return e!=e};function v(){v.init.call(this)}f.exports=v,f.exports.once=function(e,t){return new Promise((function(n,i){function r(n){e.removeListener(t,s),i(n)}function s(){"function"==typeof e.removeListener&&e.removeListener("error",r),n([].slice.call(arguments))}I(e,t,s,{once:!0}),"error"!==t&&function(e,t){"function"==typeof e.on&&I(e,"error",t,{once:!0})}(e,r)}))},v.EventEmitter=v,v.prototype._events=void 0,v.prototype._eventsCount=0,v.prototype._maxListeners=void 0;var w=10;function C(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function A(e){return void 0===e._maxListeners?v.defaultMaxListeners:e._maxListeners}function S(e,t,n,i){var r,s,o,a;if(C(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]=i?[n,o]:[o,n]:i?o.unshift(n):o.push(n),(r=A(e))>0&&o.length>r&&!o.warned){o.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=e,l.type=t,l.count=o.length,a=l,console&&console.warn&&console.warn(a)}return e}function x(){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 E(e,t,n){var i={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},r=x.bind(i);return r.listener=n,i.wrapFn=r,r}function _(e,t,n){var i=e._events;if(void 0===i)return[];var r=i[t];return void 0===r?[]:"function"==typeof r?n?[r.listener||r]:[r]: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}(r):T(r,r.length)}function M(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 T(e,t){for(var n=new Array(t),i=0;i<t;++i)n[i]=e[i];return n}function I(e,t,n,i){if("function"==typeof e.on)i.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 r(s){i.once&&e.removeEventListener(t,r),n(s)}))}}function L(e){if("function"!=typeof e)throw new Error("obliterator/iterator: expecting a function!");this.next=e}Object.defineProperty(v,"defaultMaxListeners",{enumerable:!0,get:function(){return w},set:function(e){if("number"!=typeof e||e<0||b(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");w=e}}),v.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},v.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||b(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},v.prototype.getMaxListeners=function(){return A(this)},v.prototype.emit=function(e){for(var t=[],n=1;n<arguments.length;n++)t.push(arguments[n]);var i="error"===e,r=this._events;if(void 0!==r)i=i&&void 0===r.error;else if(!i)return!1;if(i){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=r[e];if(void 0===a)return!1;if("function"==typeof a)y(a,this,t);else{var l=a.length,c=T(a,l);for(n=0;n<l;++n)y(c[n],this,t)}return!0},v.prototype.addListener=function(e,t){return S(this,e,t,!1)},v.prototype.on=v.prototype.addListener,v.prototype.prependListener=function(e,t){return S(this,e,t,!0)},v.prototype.once=function(e,t){return C(t),this.on(e,E(this,e,t)),this},v.prototype.prependOnceListener=function(e,t){return C(t),this.prependListener(e,E(this,e,t)),this},v.prototype.removeListener=function(e,t){var n,i,r,s,o;if(C(t),void 0===(i=this._events))return this;if(void 0===(n=i[e]))return this;if(n===t||n.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,n.listener||t));else if("function"!=typeof n){for(r=-1,s=n.length-1;s>=0;s--)if(n[s]===t||n[s].listener===t){o=n[s].listener,r=s;break}if(r<0)return this;0===r?n.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(n,r),1===n.length&&(i[e]=n[0]),void 0!==i.removeListener&&this.emit("removeListener",e,o||t)}return this},v.prototype.off=v.prototype.removeListener,v.prototype.removeAllListeners=function(e){var t,n,i;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 r,s=Object.keys(n);for(i=0;i<s.length;++i)"removeListener"!==(r=s[i])&&this.removeAllListeners(r);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(i=t.length-1;i>=0;i--)this.removeListener(e,t[i]);return this},v.prototype.listeners=function(e){return _(this,e,!0)},v.prototype.rawListeners=function(e){return _(this,e,!1)},v.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):M.call(e,t)},v.prototype.listenerCount=M,v.prototype.eventNames=function(){return this._eventsCount>0?m(this._events):[]},"undefined"!=typeof Symbol&&(L.prototype[Symbol.iterator]=function(){return this}),L.of=function(){var e=arguments,t=e.length,n=0;return new L((function(){return n>=t?{done:!0}:{done:!1,value:e[n++]}}))},L.empty=function(){return new L((function(){return{done:!0}}))},L.fromSequence=function(e){var t=0,n=e.length;return new L((function(){return t>=n?{done:!0}:{done:!1,value:e[t++]}}))},L.is=function(e){return e instanceof L||"object"==typeof e&&null!==e&&"function"==typeof e.next};var N=L,$={};$.ARRAY_BUFFER_SUPPORT="undefined"!=typeof ArrayBuffer,$.SYMBOL_SUPPORT="undefined"!=typeof Symbol;var P=N,O=$,R=O.ARRAY_BUFFER_SUPPORT,k=O.SYMBOL_SUPPORT,G=function(e){var t=function(e){return"string"==typeof e||Array.isArray(e)||R&&ArrayBuffer.isView(e)?P.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},D=G,F=function(e,t){for(var n,i=arguments.length>1?t:1/0,r=i!==1/0?new Array(i):[],s=0,o=D(e);;){if(s===i)return r;if((n=o.next()).done)return s!==t&&(r.length=s),r;r[s++]=n.value}},H=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)),B=function(e){function n(t){var i;return(i=e.call(this,t)||this).name="InvalidArgumentsGraphError","function"==typeof Error.captureStackTrace&&Error.captureStackTrace(o(i),n.prototype.constructor),i}return t(n,e),n}(H),V=function(e){function n(t){var i;return(i=e.call(this,t)||this).name="NotFoundGraphError","function"==typeof Error.captureStackTrace&&Error.captureStackTrace(o(i),n.prototype.constructor),i}return t(n,e),n}(H),j=function(e){function n(t){var i;return(i=e.call(this,t)||this).name="UsageGraphError","function"==typeof Error.captureStackTrace&&Error.captureStackTrace(o(i),n.prototype.constructor),i}return t(n,e),n}(H);function U(e,t){this.key=e,this.attributes=t,this.clear()}function W(e,t){this.key=e,this.attributes=t,this.clear()}function Y(e,t){this.key=e,this.attributes=t,this.clear()}function z(e,t,n,i,r){this.key=t,this.attributes=r,this.undirected=e,this.source=n,this.target=i}function q(e,t,n,i,r,s,o){var a,l,c,u;if(i=""+i,0===n){if(!(a=e._nodes.get(i)))throw new V("Graph.".concat(t,': could not find the "').concat(i,'" node in the graph.'));c=r,u=s}else if(3===n){if(r=""+r,!(l=e._edges.get(r)))throw new V("Graph.".concat(t,': could not find the "').concat(r,'" edge in the graph.'));var h=l.source.key,d=l.target.key;if(i===h)a=l.target;else{if(i!==d)throw new V("Graph.".concat(t,': the "').concat(i,'" node is not attached to the "').concat(r,'" edge (').concat(h,", ").concat(d,")."));a=l.source}c=s,u=o}else{if(!(l=e._edges.get(i)))throw new V("Graph.".concat(t,': could not find the "').concat(i,'" edge in the graph.'));a=1===n?l.source:l.target,c=r,u=s}return[a,c,u]}U.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={}},Y.prototype.clear=function(){this.undirectedDegree=0,this.undirectedLoops=0,this.undirected={}},z.prototype.attach=function(){var e="out",t="in";this.undirected&&(e=t="undirected");var n=this.source.key,i=this.target.key;this.source[e][i]=this,this.undirected&&n===i||(this.target[t][n]=this)},z.prototype.attachMulti=function(){var e="out",t="in",n=this.source.key,i=this.target.key;this.undirected&&(e=t="undirected");var r=this.source[e],s=r[i];if(void 0===s)return r[i]=this,void(this.undirected&&n===i||(this.target[t][n]=this));s.previous=this,this.next=s,r[i]=this,this.target[t][n]=this},z.prototype.detach=function(){var e=this.source.key,t=this.target.key,n="out",i="in";this.undirected&&(n=i="undirected"),delete this.source[n][t],delete this.target[i][e]},z.prototype.detachMulti=function(){var e=this.source.key,t=this.target.key,n="out",i="in";this.undirected&&(n=i="undirected"),void 0===this.previous?void 0===this.next?(delete this.source[n][t],delete this.target[i][e]):(this.next.previous=void 0,this.source[n][t]=this.next,this.target[i][e]=this.next):(this.previous.next=this.next,void 0!==this.next&&(this.next.previous=this.previous))};var K=[{name:function(e){return"get".concat(e,"Attribute")},attacher:function(e,t,n){e.prototype[t]=function(e,i,r){var s=q(this,t,n,e,i,r),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,i){return q(this,t,n,e,i)[0].attributes}}},{name:function(e){return"has".concat(e,"Attribute")},attacher:function(e,t,n){e.prototype[t]=function(e,i,r){var s=q(this,t,n,e,i,r),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,i,r,s){var o=q(this,t,n,e,i,r,s),a=o[0],l=o[1],c=o[2];return a.attributes[l]=c,this.emit("nodeAttributesUpdated",{key:a.key,type:"set",attributes:a.attributes,name:l}),this}}},{name:function(e){return"update".concat(e,"Attribute")},attacher:function(e,t,n){e.prototype[t]=function(e,i,r,s){var o=q(this,t,n,e,i,r,s),a=o[0],l=o[1],c=o[2];if("function"!=typeof c)throw new B("Graph.".concat(t,": updater should be a function."));var u=a.attributes,h=c(u[l]);return u[l]=h,this.emit("nodeAttributesUpdated",{key:a.key,type:"set",attributes:a.attributes,name:l}),this}}},{name:function(e){return"remove".concat(e,"Attribute")},attacher:function(e,t,n){e.prototype[t]=function(e,i,r){var s=q(this,t,n,e,i,r),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,i,r){var s=q(this,t,n,e,i,r),o=s[0],a=s[1];if(!c(a))throw new B("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,i,r){var s=q(this,t,n,e,i,r),o=s[0],l=s[1];if(!c(l))throw new B("Graph.".concat(t,": provided attributes are not a plain object."));return a(o.attributes,l),this.emit("nodeAttributesUpdated",{key:o.key,type:"merge",attributes:o.attributes,data:l}),this}}},{name:function(e){return"update".concat(e,"Attributes")},attacher:function(e,t,n){e.prototype[t]=function(e,i,r){var s=q(this,t,n,e,i,r),o=s[0],a=s[1];if("function"!=typeof a)throw new B("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,i){var r;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new j("Graph.".concat(t,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>2){if(this.multi)throw new j("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=""+i;if(i=arguments[2],!(r=l(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 j("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[i]}}},{name:function(e){return"get".concat(e,"Attributes")},attacher:function(e,t,n){e.prototype[t]=function(e){var i;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new j("Graph.".concat(t,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>1){if(this.multi)throw new j("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 r=""+e,s=""+arguments[1];if(!(i=l(this,r,s,n)))throw new V("Graph.".concat(t,': could not find an edge for the given path ("').concat(r,'" - "').concat(s,'").'))}else{if("mixed"!==n)throw new j("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}}},{name:function(e){return"has".concat(e,"Attribute")},attacher:function(e,t,n){e.prototype[t]=function(e,i){var r;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new j("Graph.".concat(t,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>2){if(this.multi)throw new j("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=""+i;if(i=arguments[2],!(r=l(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 j("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.hasOwnProperty(i)}}},{name:function(e){return"set".concat(e,"Attribute")},attacher:function(e,t,n){e.prototype[t]=function(e,i,r){var s;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new j("Graph.".concat(t,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>3){if(this.multi)throw new j("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=""+i;if(i=arguments[2],r=arguments[3],!(s=l(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 j("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[i]=r,this.emit("edgeAttributesUpdated",{key:s.key,type:"set",attributes:s.attributes,name:i}),this}}},{name:function(e){return"update".concat(e,"Attribute")},attacher:function(e,t,n){e.prototype[t]=function(e,i,r){var s;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new j("Graph.".concat(t,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>3){if(this.multi)throw new j("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=""+i;if(i=arguments[2],r=arguments[3],!(s=l(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 j("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 r)throw new B("Graph.".concat(t,": updater should be a function."));return s.attributes[i]=r(s.attributes[i]),this.emit("edgeAttributesUpdated",{key:s.key,type:"set",attributes:s.attributes,name:i}),this}}},{name:function(e){return"remove".concat(e,"Attribute")},attacher:function(e,t,n){e.prototype[t]=function(e,i){var r;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new j("Graph.".concat(t,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>2){if(this.multi)throw new j("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=""+i;if(i=arguments[2],!(r=l(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 j("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 delete r.attributes[i],this.emit("edgeAttributesUpdated",{key:r.key,type:"remove",attributes:r.attributes,name:i}),this}}},{name:function(e){return"replace".concat(e,"Attributes")},attacher:function(e,t,n){e.prototype[t]=function(e,i){var r;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new j("Graph.".concat(t,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>2){if(this.multi)throw new j("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=""+i;if(i=arguments[2],!(r=l(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 j("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.'))}if(!c(i))throw new B("Graph.".concat(t,": provided attributes are not a plain object."));return r.attributes=i,this.emit("edgeAttributesUpdated",{key:r.key,type:"replace",attributes:r.attributes}),this}}},{name:function(e){return"merge".concat(e,"Attributes")},attacher:function(e,t,n){e.prototype[t]=function(e,i){var r;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new j("Graph.".concat(t,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>2){if(this.multi)throw new j("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=""+i;if(i=arguments[2],!(r=l(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 j("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.'))}if(!c(i))throw new B("Graph.".concat(t,": provided attributes are not a plain object."));return a(r.attributes,i),this.emit("edgeAttributesUpdated",{key:r.key,type:"merge",attributes:r.attributes,data:i}),this}}},{name:function(e){return"update".concat(e,"Attributes")},attacher:function(e,t,n){e.prototype[t]=function(e,i){var r;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new j("Graph.".concat(t,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>2){if(this.multi)throw new j("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=""+i;if(i=arguments[2],!(r=l(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 j("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.'))}if("function"!=typeof i)throw new B("Graph.".concat(t,": provided updater is not a function."));return r.attributes=i(r.attributes),this.emit("edgeAttributesUpdated",{key:r.key,type:"update",attributes:r.attributes}),this}}}],X=N,J=G,Q=function(){var e=arguments,t=null,n=-1;return new X((function(){for(var i=null;;){if(null===t){if(++n>=e.length)return{done:!0};t=J(e[n])}if(!0!==(i=t.next()).done)break;t=null}return i}))},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,i){var r=!1;for(var s in t)if(s!==i){var o=t[s];if(r=n(o.key,o.attributes,o.source.key,o.target.key,o.source.attributes,o.target.attributes,o.undirected),e&&r)return o.key}}function ne(e,t,n,i){var r,s,o,a=!1;for(var l in t)if(l!==i){r=t[l];do{if(s=r.source,o=r.target,a=n(r.key,r.attributes,s.key,o.key,s.attributes,o.attributes,r.undirected),e&&a)return r.key;r=r.next}while(void 0!==r)}}function ie(e,t){var n,i=Object.keys(e),r=i.length,s=0;return new N((function(){do{if(n)n=n.next;else{if(s>=r)return{done:!0};var o=i[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 re(e,t,n,i){var r=t[n];if(r){var s=r.source,o=r.target;return i(r.key,r.attributes,s.key,o.key,s.attributes,o.attributes,r.undirected)&&e?r.key:void 0}}function se(e,t,n,i){var r=t[n];if(r){var s=!1;do{if(s=i(r.key,r.attributes,r.source.key,r.target.key,r.source.attributes,r.target.attributes,r.undirected),e&&s)return r.key;r=r.next}while(void 0!==r)}}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,i){if(0!==t.size)for(var r,s,o="mixed"!==n&&n!==t.type,a="undirected"===n,l=!1,c=t._edges.values();!0!==(r=c.next()).done;)if(s=r.value,!o||s.undirected===a){var u=s,h=u.key,d=u.attributes,p=u.source,m=u.target;if(l=i(h,d,p.key,m.key,p.attributes,m.attributes,s.undirected),e&&l)return h}}function le(e,t,n,i,r,s){var o,a=t?ne:te;if("undirected"!==n){if("out"!==i&&(o=a(e,r.in,s),e&&o))return o;if("in"!==i&&(o=a(e,r.out,s,i?void 0:r.key),e&&o))return o}if("directed"!==n&&(o=a(e,r.undirected,s),e&&o))return o}function ce(e,t,n,i,r,s,o){var a,l=n?se:re;if("undirected"!==t){if(void 0!==r.in&&"out"!==i&&(a=l(e,r.in,s,o),e&&a))return a;if(void 0!==r.out&&"in"!==i&&(i||r.key!==s)&&(a=l(e,r.out,s,o),e&&a))return a}if("directed"!==t&&void 0!==r.undirected&&(a=l(e,r.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 he(){this.A=null,this.B=null}function de(e,t,n,i,r){for(var s in i){var o=i[s],a=o.source,l=o.target,c=a===n?l:a;if(!t||!t.has(c.key)){var u=r(c.key,c.attributes);if(e&&u)return c.key}}}function pe(e,t,n,i,r){if("mixed"!==t){if("undirected"===t)return de(e,null,i,i.undirected,r);if("string"==typeof n)return de(e,null,i,i[n],r)}var s,o=new he;if("undirected"!==t){if("out"!==n){if(s=de(e,null,i,i.in,r),e&&s)return s;o.wrap(i.in)}if("in"!==n){if(s=de(e,o,i,i.out,r),e&&s)return s;o.wrap(i.out)}}if("directed"!==t&&(s=de(e,o,i,i.undirected,r),e&&s))return s}function me(e,t,n){var i=Object.keys(n),r=i.length,s=0;return new N((function(){var o=null;do{if(s>=r)return e&&e.wrap(n),{done:!0};var a=n[i[s++]],l=a.source,c=a.target;o=l===t?c:l,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,i,r){for(var s,o,a,l,c,u,h,d=i._nodes.values(),p=i.type;!0!==(s=d.next()).done;){var m=!1;if(o=s.value,"undirected"!==p)for(a in l=o.out){c=l[a];do{if(u=c.target,m=!0,h=r(o.key,u.key,o.attributes,u.attributes,c.key,c.attributes,c.undirected),e&&h)return c;c=c.next}while(c)}if("directed"!==p)for(a in l=o.undirected)if(!(t&&o.key>a)){c=l[a];do{if((u=c.target).key!==a&&(u=c.source),m=!0,h=r(o.key,u.key,o.attributes,u.attributes,c.key,c.attributes,c.undirected),e&&h)return c;c=c.next}while(c)}if(n&&!m&&(h=r(o.key,null,o.attributes,null,null,null,null),e&&h))return null}}function ge(e){if(!c(e))throw new B('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 B("Graph.import: serialized node is missing its key.");if("attributes"in e&&(!c(e.attributes)||null===e.attributes))throw new B("Graph.import: invalid attributes. Attributes should be a plain object, null or omitted.")}function ye(e){if(!c(e))throw new B('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 B("Graph.import: serialized edge is missing its source.");if(!("target"in e))throw new B("Graph.import: serialized edge is missing its target.");if("attributes"in e&&(!c(e.attributes)||null===e.attributes))throw new B("Graph.import: invalid attributes. Attributes should be a plain object, null or omitted.");if("undirected"in e&&"boolean"!=typeof e.undirected)throw new B("Graph.import: invalid undirectedness information. Undirected should be boolean or omitted.")}he.prototype.wrap=function(e){null===this.A?this.A=e:null===this.B&&(this.B=e)},he.prototype.has=function(e){return null!==this.A&&e in this.A||null!==this.B&&e in this.B};var be,ve=(be=255&Math.floor(256*Math.random()),function(){return be++}),we=new Set(["directed","undirected","mixed"]),Ce=new Set(["domain","_events","_eventsCount","_maxListeners"]),Ae={allowSelfLoops:!0,multi:!1,type:"mixed"};function Se(e,t,n){var i=new e.NodeDataClass(t,n);return e._nodes.set(t,i),e.emit("nodeAdded",{key:t,attributes:n}),i}function xe(e,t,n,i,r,s,o,a){if(!i&&"undirected"===e.type)throw new j("Graph.".concat(t,": you cannot add a directed edge to an undirected graph. Use the #.addEdge or #.addUndirectedEdge instead."));if(i&&"directed"===e.type)throw new j("Graph.".concat(t,": you cannot add an undirected edge to a directed graph. Use the #.addEdge or #.addDirectedEdge instead."));if(a&&!c(a))throw new B("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 j("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 l=e._nodes.get(s),u=e._nodes.get(o);if(!l)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 h={key:null,undirected:i,source:s,target:o,attributes:a};if(n)r=e._edgeKeyGenerator();else if(r=""+r,e._edges.has(r))throw new j("Graph.".concat(t,': the "').concat(r,'" edge already exists in the graph.'));if(!e.multi&&(i?void 0!==l.undirected[o]:void 0!==l.out[o]))throw new j("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 d=new z(i,r,l,u,a);e._edges.set(r,d);var p=s===o;return i?(l.undirectedDegree++,u.undirectedDegree++,p&&(l.undirectedLoops++,e._undirectedSelfLoopCount++)):(l.outDegree++,u.inDegree++,p&&(l.directedLoops++,e._directedSelfLoopCount++)),e.multi?d.attachMulti():d.attach(),i?e._undirectedSize++:e._directedSize++,h.key=r,e.emit("edgeAdded",h),r}function Ee(e,t,n,i,r,s,o,l,u){if(!i&&"undirected"===e.type)throw new j("Graph.".concat(t,": you cannot merge/update a directed edge to an undirected graph. Use the #.mergeEdge/#.updateEdge or #.addUndirectedEdge instead."));if(i&&"directed"===e.type)throw new j("Graph.".concat(t,": you cannot merge/update an undirected edge to a directed graph. Use the #.mergeEdge/#.updateEdge or #.addDirectedEdge instead."));if(l)if(u){if("function"!=typeof l)throw new B("Graph.".concat(t,': invalid updater function. Expecting a function but got "').concat(l,'"'))}else if(!c(l))throw new B("Graph.".concat(t,': invalid attributes. Expecting an object but got "').concat(l,'"'));var h;if(s=""+s,o=""+o,u&&(h=l,l=void 0),!e.allowSelfLoops&&s===o)throw new j("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 d,p,m=e._nodes.get(s),f=e._nodes.get(o);if(!n&&(d=e._edges.get(r))){if(!(d.source.key===s&&d.target.key===o||i&&d.source.key===o&&d.target.key===s))throw new j("Graph.".concat(t,': inconsistency detected when attempting to merge the "').concat(r,'" edge with "').concat(s,'" source & "').concat(o,'" target vs. ("').concat(d.source.key,'", "').concat(d.target.key,'").'));p=d}if(p||e.multi||!m||(p=i?m.undirected[o]:m.out[o]),p){var g=[p.key,!1,!1,!1];if(u?!h:!l)return g;if(u){var y=p.attributes;p.attributes=h(y),e.emit("edgeAttributesUpdated",{type:"replace",key:p.key,attributes:p.attributes})}else a(p.attributes,l),e.emit("edgeAttributesUpdated",{type:"merge",key:p.key,attributes:p.attributes,data:l});return g}l=l||{},u&&h&&(l=h(l));var b={key:null,undirected:i,source:s,target:o,attributes:l};if(n)r=e._edgeKeyGenerator();else if(r=""+r,e._edges.has(r))throw new j("Graph.".concat(t,': the "').concat(r,'" edge already exists in the graph.'));var v=!1,w=!1;m||(m=Se(e,s,{}),v=!0,s===o&&(f=m,w=!0)),f||(f=Se(e,o,{}),w=!0),d=new z(i,r,m,f,l),e._edges.set(r,d);var C=s===o;return i?(m.undirectedDegree++,f.undirectedDegree++,C&&(m.undirectedLoops++,e._undirectedSelfLoopCount++)):(m.outDegree++,f.inDegree++,C&&(m.directedLoops++,e._directedSelfLoopCount++)),e.multi?d.attachMulti():d.attach(),i?e._undirectedSize++:e._directedSize++,b.key=r,e.emit("edgeAdded",b),[r,!0,v,w]}function _e(e,t){e._edges.delete(t.key);var n=t.source,i=t.target,r=t.attributes,s=t.undirected,o=n===i;s?(n.undirectedDegree--,i.undirectedDegree--,o&&(n.undirectedLoops--,e._undirectedSelfLoopCount--)):(n.outDegree--,i.inDegree--,o&&(n.directedLoops--,e._directedSelfLoopCount--)),e.multi?t.detachMulti():t.detach(),s?e._undirectedSize--:e._directedSize--,e.emit("edgeDropped",{key:t.key,attributes:r,source:n.key,target:i.key,undirected:s})}var Me=function(n){function i(e){var t;if(t=n.call(this)||this,"boolean"!=typeof(e=a({},Ae,e)).multi)throw new B("Graph.constructor: invalid 'multi' option. Expecting a boolean but got \"".concat(e.multi,'".'));if(!we.has(e.type))throw new B('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 B("Graph.constructor: invalid 'allowSelfLoops' option. Expecting a boolean but got \"".concat(e.allowSelfLoops,'".'));var i="mixed"===e.type?U:"directed"===e.type?W:Y;h(o(t),"NodeDataClass",i);var r="geid_"+ve()+"_",s=0;return h(o(t),"_attributes",{}),h(o(t),"_nodes",new Map),h(o(t),"_edges",new Map),h(o(t),"_directedSize",0),h(o(t),"_undirectedSize",0),h(o(t),"_directedSelfLoopCount",0),h(o(t),"_undirectedSelfLoopCount",0),h(o(t),"_edgeKeyGenerator",(function(){var e;do{e=r+s++}while(t._edges.has(e));return e})),h(o(t),"_options",e),Ce.forEach((function(e){return h(o(t),e,t[e])})),d(o(t),"order",(function(){return t._nodes.size})),d(o(t),"size",(function(){return t._edges.size})),d(o(t),"directedSize",(function(){return t._directedSize})),d(o(t),"undirectedSize",(function(){return t._undirectedSize})),d(o(t),"selfLoopCount",(function(){return t._directedSelfLoopCount+t._undirectedSelfLoopCount})),d(o(t),"directedSelfLoopCount",(function(){return t._directedSelfLoopCount})),d(o(t),"undirectedSelfLoopCount",(function(){return t._undirectedSelfLoopCount})),d(o(t),"multi",t._options.multi),d(o(t),"type",t._options.type),d(o(t),"allowSelfLoops",t._options.allowSelfLoops),d(o(t),"implementation",(function(){return"graphology"})),t}t(i,n);var r=i.prototype;return r._resetInstanceCounters=function(){this._directedSize=0,this._undirectedSize=0,this._directedSelfLoopCount=0,this._undirectedSelfLoopCount=0},r.hasNode=function(e){return this._nodes.has(""+e)},r.hasDirectedEdge=function(e,t){if("undirected"===this.type)return!1;if(1===arguments.length){var n=""+e,i=this._edges.get(n);return!!i&&!i.undirected}if(2===arguments.length){e=""+e,t=""+t;var r=this._nodes.get(e);return!!r&&r.out.hasOwnProperty(t)}throw new B("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."))},r.hasUndirectedEdge=function(e,t){if("directed"===this.type)return!1;if(1===arguments.length){var n=""+e,i=this._edges.get(n);return!!i&&i.undirected}if(2===arguments.length){e=""+e,t=""+t;var r=this._nodes.get(e);return!!r&&r.undirected.hasOwnProperty(t)}throw new B("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."))},r.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 i=this._nodes.get(e);return!!i&&(void 0!==i.out&&i.out.hasOwnProperty(t)||void 0!==i.undirected&&i.undirected.hasOwnProperty(t))}throw new B("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."))},r.directedEdge=function(e,t){if("undirected"!==this.type){if(e=""+e,t=""+t,this.multi)throw new j("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 i=n.out&&n.out[t]||void 0;return i?i.key:void 0}},r.undirectedEdge=function(e,t){if("directed"!==this.type){if(e=""+e,t=""+t,this.multi)throw new j("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 i=n.undirected&&n.undirected[t]||void 0;return i?i.key:void 0}},r.edge=function(e,t){if(this.multi)throw new j("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 i=n.out&&n.out[t]||n.undirected&&n.undirected[t]||void 0;if(i)return i.key},r.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)},r.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},r.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},r.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},r.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},r.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},r.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},r.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},r.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},r.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},r.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},r.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},r.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},r.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},r.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},r.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},r.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},r.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},r.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,i=0;return"directed"!==this.type&&(n+=t.undirectedDegree,i+=2*t.undirectedLoops),"undirected"!==this.type&&(n+=t.inDegree,i+=t.directedLoops),n-i},r.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,i=0;return"directed"!==this.type&&(n+=t.undirectedDegree,i+=2*t.undirectedLoops),"undirected"!==this.type&&(n+=t.outDegree,i+=t.directedLoops),n-i},r.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,i=0;return"directed"!==this.type&&(n+=t.undirectedDegree,i+=2*t.undirectedLoops),"undirected"!==this.type&&(n+=t.inDegree+t.outDegree,i+=2*t.directedLoops),n-i},r.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},r.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},r.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]},r.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 i=n.source.key,r=n.target.key;if(e===i)return r;if(e===r)return i;throw new V('Graph.opposite: the "'.concat(e,'" node is not attached to the "').concat(t,'" edge (').concat(i,", ").concat(r,")."))},r.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},r.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},r.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},r.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},r.addNode=function(e,t){var n=function(e,t,n){if(n&&!c(n))throw new B('Graph.addNode: invalid attributes. Expecting an object but got "'.concat(n,'"'));if(t=""+t,n=n||{},e._nodes.has(t))throw new j('Graph.addNode: the "'.concat(t,'" node already exist in the graph.'));var i=new e.NodeDataClass(t,n);return e._nodes.set(t,i),e.emit("nodeAdded",{key:t,attributes:n}),i}(this,e,t);return n.key},r.mergeNode=function(e,t){if(t&&!c(t))throw new B('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])},r.updateNode=function(e,t){if(t&&"function"!=typeof t)throw new B('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 i=n.attributes;n.attributes=t(i),this.emit("nodeAttributesUpdated",{type:"replace",key:e,attributes:n.attributes})}return[e,!1]}var r=t?t({}):{};return n=new this.NodeDataClass(e,r),this._nodes.set(e,n),this.emit("nodeAdded",{key:e,attributes:r}),[e,!0]},r.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 i in n.out){t=n.out[i];do{_e(this,t),t=t.next}while(t)}for(var r in n.in){t=n.in[r];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})},r.dropEdge=function(e){var t;if(arguments.length>1){var n=""+arguments[0],i=""+arguments[1];if(!(t=l(this,n,i,this.type)))throw new V('Graph.dropEdge: could not find the "'.concat(n,'" -> "').concat(i,'" 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},r.dropDirectedEdge=function(e,t){if(arguments.length<2)throw new j("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 j("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=l(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},r.dropUndirectedEdge=function(e,t){if(arguments.length<2)throw new j("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 j("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=l(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},r.clear=function(){this._edges.clear(),this._nodes.clear(),this._resetInstanceCounters(),this.emit("cleared")},r.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")},r.getAttribute=function(e){return this._attributes[e]},r.getAttributes=function(){return this._attributes},r.hasAttribute=function(e){return this._attributes.hasOwnProperty(e)},r.setAttribute=function(e,t){return this._attributes[e]=t,this.emit("attributesUpdated",{type:"set",attributes:this._attributes,name:e}),this},r.updateAttribute=function(e,t){if("function"!=typeof t)throw new B("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},r.removeAttribute=function(e){return delete this._attributes[e],this.emit("attributesUpdated",{type:"remove",attributes:this._attributes,name:e}),this},r.replaceAttributes=function(e){if(!c(e))throw new B("Graph.replaceAttributes: provided attributes are not a plain object.");return this._attributes=e,this.emit("attributesUpdated",{type:"replace",attributes:this._attributes}),this},r.mergeAttributes=function(e){if(!c(e))throw new B("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},r.updateAttributes=function(e){if("function"!=typeof e)throw new B("Graph.updateAttributes: provided updater is not a function.");return this._attributes=e(this._attributes),this.emit("attributesUpdated",{type:"update",attributes:this._attributes}),this},r.updateEachNodeAttributes=function(e,t){if("function"!=typeof e)throw new B("Graph.updateEachNodeAttributes: expecting an updater function.");if(t&&!p(t))throw new B("Graph.updateEachNodeAttributes: invalid hints. Expecting an object having the following shape: {attributes?: [string]}");for(var n,i,r=this._nodes.values();!0!==(n=r.next()).done;)(i=n.value).attributes=e(i.key,i.attributes);this.emit("eachNodeAttributesUpdated",{hints:t||null})},r.updateEachEdgeAttributes=function(e,t){if("function"!=typeof e)throw new B("Graph.updateEachEdgeAttributes: expecting an updater function.");if(t&&!p(t))throw new B("Graph.updateEachEdgeAttributes: invalid hints. Expecting an object having the following shape: {attributes?: [string]}");for(var n,i,r,s,o=this._edges.values();!0!==(n=o.next()).done;)r=(i=n.value).source,s=i.target,i.attributes=e(i.key,i.attributes,r.key,s.key,r.attributes,s.attributes,i.undirected);this.emit("eachEdgeAttributesUpdated",{hints:t||null})},r.forEachAdjacencyEntry=function(e){if("function"!=typeof e)throw new B("Graph.forEachAdjacencyEntry: expecting a callback.");fe(!1,!1,!1,this,e)},r.forEachAdjacencyEntryWithOrphans=function(e){if("function"!=typeof e)throw new B("Graph.forEachAdjacencyEntryWithOrphans: expecting a callback.");fe(!1,!1,!0,this,e)},r.forEachAssymetricAdjacencyEntry=function(e){if("function"!=typeof e)throw new B("Graph.forEachAssymetricAdjacencyEntry: expecting a callback.");fe(!1,!0,!1,this,e)},r.forEachAssymetricAdjacencyEntryWithOrphans=function(e){if("function"!=typeof e)throw new B("Graph.forEachAssymetricAdjacencyEntryWithOrphans: expecting a callback.");fe(!1,!0,!0,this,e)},r.nodes=function(){return"function"==typeof Array.from?Array.from(this._nodes.keys()):F(this._nodes.keys(),this._nodes.size)},r.forEachNode=function(e){if("function"!=typeof e)throw new B("Graph.forEachNode: expecting a callback.");for(var t,n,i=this._nodes.values();!0!==(t=i.next()).done;)e((n=t.value).key,n.attributes)},r.findNode=function(e){if("function"!=typeof e)throw new B("Graph.findNode: expecting a callback.");for(var t,n,i=this._nodes.values();!0!==(t=i.next()).done;)if(e((n=t.value).key,n.attributes))return n.key},r.mapNodes=function(e){if("function"!=typeof e)throw new B("Graph.mapNode: expecting a callback.");for(var t,n,i=this._nodes.values(),r=new Array(this.order),s=0;!0!==(t=i.next()).done;)n=t.value,r[s++]=e(n.key,n.attributes);return r},r.someNode=function(e){if("function"!=typeof e)throw new B("Graph.someNode: expecting a callback.");for(var t,n,i=this._nodes.values();!0!==(t=i.next()).done;)if(e((n=t.value).key,n.attributes))return!0;return!1},r.everyNode=function(e){if("function"!=typeof e)throw new B("Graph.everyNode: expecting a callback.");for(var t,n,i=this._nodes.values();!0!==(t=i.next()).done;)if(!e((n=t.value).key,n.attributes))return!1;return!0},r.filterNodes=function(e){if("function"!=typeof e)throw new B("Graph.filterNodes: expecting a callback.");for(var t,n,i=this._nodes.values(),r=[];!0!==(t=i.next()).done;)e((n=t.value).key,n.attributes)&&r.push(n.key);return r},r.reduceNodes=function(e,t){if("function"!=typeof e)throw new B("Graph.reduceNodes: expecting a callback.");if(arguments.length<2)throw new B("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,i,r=t,s=this._nodes.values();!0!==(n=s.next()).done;)r=e(r,(i=n.value).key,i.attributes);return r},r.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}}))},r.export=function(){var e=this,t=new Array(this._nodes.size),n=0;this._nodes.forEach((function(e,i){t[n++]=function(e,t){var n={key:e};return u(t.attributes)||(n.attributes=a({},t.attributes)),n}(i,e)}));var i=new Array(this._edges.size);return n=0,this._edges.forEach((function(t,r){i[n++]=function(e,t,n){var i={key:t,source:n.source.key,target:n.target.key};return u(n.attributes)||(i.attributes=a({},n.attributes)),"mixed"===e&&n.undirected&&(i.undirected=!0),i}(e.type,r,t)})),{options:{type:this.type,multi:this.multi,allowSelfLoops:this.allowSelfLoops},attributes:this.getAttributes(),nodes:t,edges:i}},r.import=function(e){var t,n,r,s,o,a=this,l=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(e instanceof i)return e.forEachNode((function(e,t){l?a.mergeNode(e,t):a.addNode(e,t)})),e.forEachEdge((function(e,t,n,i,r,s,o){l?o?a.mergeUndirectedEdgeWithKey(e,n,i,t):a.mergeDirectedEdgeWithKey(e,n,i,t):o?a.addUndirectedEdgeWithKey(e,n,i,t):a.addDirectedEdgeWithKey(e,n,i,t)})),this;if(!c(e))throw new B("Graph.import: invalid argument. Expecting a serialized graph or, alternatively, a Graph instance.");if(e.attributes){if(!c(e.attributes))throw new B("Graph.import: invalid attributes. Expecting a plain object.");l?this.mergeAttributes(e.attributes):this.replaceAttributes(e.attributes)}if(e.nodes){if(r=e.nodes,!Array.isArray(r))throw new B("Graph.import: invalid nodes. Expecting an array.");for(t=0,n=r.length;t<n;t++){ge(s=r[t]);var u=s,h=u.key,d=u.attributes;l?this.mergeNode(h,d):this.addNode(h,d)}}if(e.edges){var p=!1;if("undirected"===this.type&&(p=!0),r=e.edges,!Array.isArray(r))throw new B("Graph.import: invalid edges. Expecting an array.");for(t=0,n=r.length;t<n;t++){ye(o=r[t]);var m=o,f=m.source,g=m.target,y=m.attributes,b=m.undirected,v=void 0===b?p:b;"key"in o?(l?v?this.mergeUndirectedEdgeWithKey:this.mergeDirectedEdgeWithKey:v?this.addUndirectedEdgeWithKey:this.addDirectedEdgeWithKey).call(this,o.key,f,g,y):(l?v?this.mergeUndirectedEdge:this.mergeDirectedEdge:v?this.addUndirectedEdge:this.addDirectedEdge).call(this,f,g,y)}}return this},r.nullCopy=function(e){var t=new i(a({},this._options,e));return t.replaceAttributes(a({},this.getAttributes())),t},r.emptyCopy=function(e){var t=this.nullCopy(e);return this._nodes.forEach((function(e,n){var i=a({},e.attributes);e=new t.NodeDataClass(n,i),t._nodes.set(n,e)})),t},r.copy=function(e){if("string"==typeof(e=e||{}).type&&e.type!==this.type&&"mixed"!==e.type)throw new j('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 j("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 j("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,i=this.emptyCopy(e),r=this._edges.values();!0!==(t=r.next()).done;)xe(i,"copy",!1,(n=t.value).undirected,n.key,n.source.key,n.target.key,a({},n.attributes));return i},r.toJSON=function(){return this.export()},r.toString=function(){return"[object Graph]"},r.inspect=function(){var t=this,n={};this._nodes.forEach((function(e,t){n[t]=e.attributes}));var i={},r={};this._edges.forEach((function(e,n){var s,o=e.undirected?"--":"->",a="",l=e.source.key,c=e.target.key;e.undirected&&l>c&&(s=l,l=c,c=s);var u="(".concat(l,")").concat(o,"(").concat(c,")");n.startsWith("geid_")?t.multi&&(void 0===r[u]?r[u]=0:r[u]++,a+="".concat(r[u],". ")):a+="[".concat(n,"]: "),i[a+=u]=e.attributes}));var s={};for(var o in this)this.hasOwnProperty(o)&&!Ce.has(o)&&"function"!=typeof this[o]&&"symbol"!==e(o)&&(s[o]=this[o]);return s.attributes=this._attributes,s.nodes=n,s.edges=i,h(s,"constructor",this.constructor),s},i}(f.exports.EventEmitter);"undefined"!=typeof Symbol&&(Me.prototype[Symbol.for("nodejs.util.inspect.custom")]=Me.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),i="add"===t?xe:Ee;e.generateKey?Me.prototype[n]=function(r,s,o){return i(this,n,!0,"undirected"===(e.type||this.type),null,r,s,o,"update"===t)}:Me.prototype[n]=function(r,s,o,a){return i(this,n,!1,"undirected"===(e.type||this.type),r,s,o,a,"update"===t)}}))})),function(e){K.forEach((function(t){var n=t.name,i=t.attacher;i(e,n("Node"),0),i(e,n("Source"),1),i(e,n("Target"),2),i(e,n("Opposite"),3)}))}(Me),function(e){Z.forEach((function(t){var n=t.name,i=t.attacher;i(e,n("Edge"),"mixed"),i(e,n("DirectedEdge"),"directed"),i(e,n("UndirectedEdge"),"undirected")}))}(Me),function(e){ee.forEach((function(t){!function(e,t){var n=t.name,i=t.type,r=t.direction;e.prototype[n]=function(e,t){if("mixed"!==i&&"mixed"!==this.type&&i!==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()):F(e._edges.keys(),e._edges.size);for(var n,i,r="undirected"===t?e.undirectedSize:e.directedSize,s=new Array(r),o="undirected"===t,a=e._edges.values(),l=0;!0!==(n=a.next()).done;)(i=n.value).undirected===o&&(s[l++]=i.key);return s}(this,i);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,i){var r=[];return le(!1,e,t,n,i,(function(e){r.push(e)})),r}(this.multi,"mixed"===i?this.type:i,r,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,i,r){var s=[];return ce(!1,e,t,n,i,r,(function(e){s.push(e)})),s}(i,this.multi,r,o,t)}throw new B("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,i=t.type,r=t.direction,s="forEach"+n[0].toUpperCase()+n.slice(1,-1);e.prototype[s]=function(e,t,n){if("mixed"===i||"mixed"===this.type||i===this.type){if(1===arguments.length)return ae(!1,this,i,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 le(!1,this.multi,"mixed"===i?this.type:i,r,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 ce(!1,i,this.multi,r,a,t,n)}throw new B("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 r=0;"directed"!==i&&(r+=this.undirectedSize),"undirected"!==i&&(r+=this.directedSize),e=new Array(r);var o=0;t.push((function(t,i,r,s,a,l,c){e[o++]=n(t,i,r,s,a,l,c)}))}else e=[],t.push((function(t,i,r,s,o,a,l){e.push(n(t,i,r,s,o,a,l))}));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,i,r,s,o,a,l){t(e,i,r,s,o,a,l)&&n.push(e)})),this[s].apply(this,e),n};var l="reduce"+n[0].toUpperCase()+n.slice(1);e.prototype[l]=function(){var e,t,n=Array.prototype.slice.call(arguments);if(n.length<2||n.length>4)throw new B("Graph.".concat(l,": 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 B("Graph.".concat(l,": 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 i=t;return n.push((function(t,n,r,s,o,a,l){i=e(i,t,n,r,s,o,a,l)})),this[s].apply(this,n),i}}(e,t),function(e,t){var n=t.name,i=t.type,r=t.direction,s="find"+n[0].toUpperCase()+n.slice(1,-1);e.prototype[s]=function(e,t,n){if("mixed"!==i&&"mixed"!==this.type&&i!==this.type)return!1;if(1===arguments.length)return ae(!0,this,i,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 le(!0,this.multi,"mixed"===i?this.type:i,r,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 ce(!0,i,this.multi,r,a,t,n)}throw new B("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,i,r,s,o,a){return t(e,n,i,r,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,i,r,s,o,a){return!t(e,n,i,r,s,o,a)})),!this[s].apply(this,e)}}(e,t),function(e,t){var n=t.name,i=t.type,r=t.direction,s=n.slice(0,-1)+"Entries";e.prototype[s]=function(e,t){if("mixed"!==i&&"mixed"!==this.type&&i!==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,i="undirected"===t,r=e._edges.values();return new N((function(){for(var e,t;;){if((e=r.next()).done)return e;if(t=e.value,!n||t.undirected===i)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,i);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 i=N.empty();return"undirected"!==e&&("out"!==t&&void 0!==n.in&&(i=Q(i,ie(n.in))),"in"!==t&&void 0!==n.out&&(i=Q(i,ie(n.out,t?void 0:n.key)))),"directed"!==e&&void 0!==n.undirected&&(i=Q(i,ie(n.undirected))),i}(i,r,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,i){var r=N.empty();return"undirected"!==e&&(void 0!==n.in&&"out"!==t&&i in n.in&&(r=Q(r,oe(n.in,i))),void 0!==n.out&&"in"!==t&&i in n.out&&(t||n.key!==i)&&(r=Q(r,oe(n.out,i)))),"directed"!==e&&void 0!==n.undirected&&i in n.undirected&&(r=Q(r,oe(n.undirected,i))),r}(i,r,o,t)}throw new B("Graph.".concat(s,": too many arguments (expecting 0, 1 or 2 and got ").concat(arguments.length,")."))}}(e,t)}))}(Me),function(e){ue.forEach((function(t){(function(e,t){var n=t.name,i=t.type,r=t.direction;e.prototype[n]=function(e){if("mixed"!==i&&"mixed"!==this.type&&i!==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 i=[];return pe(!1,e,t,n,(function(e){i.push(e)})),i}("mixed"===i?this.type:i,r,t)}})(e,t),function(e,t){var n=t.name,i=t.type,r=t.direction,s="forEach"+n[0].toUpperCase()+n.slice(1,-1);e.prototype[s]=function(e,t){if("mixed"===i||"mixed"===this.type||i===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"===i?this.type:i,r,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,i){n.push(t(e,i))})),n};var a="filter"+n[0].toUpperCase()+n.slice(1);e.prototype[a]=function(e,t){var n=[];return this[s](e,(function(e,i){t(e,i)&&n.push(e)})),n};var l="reduce"+n[0].toUpperCase()+n.slice(1);e.prototype[l]=function(e,t,n){if(arguments.length<3)throw new B("Graph.".concat(l,": 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 i=n;return this[s](e,(function(e,n){i=t(i,e,n)})),i}}(e,t),function(e,t){var n=t.name,i=t.type,r=t.direction,s=n[0].toUpperCase()+n.slice(1,-1),o="find"+s;e.prototype[o]=function(e,t){if("mixed"===i||"mixed"===this.type||i===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"===i?this.type:i,r,n,t)}};var a="some"+s;e.prototype[a]=function(e,t){return!!this[o](e,t)};var l="every"+s;e.prototype[l]=function(e,t){return!this[o](e,(function(e,n){return!t(e,n)}))}}(e,t),function(e,t){var n=t.name,i=t.type,r=t.direction,s=n.slice(0,-1)+"Entries";e.prototype[s]=function(e){if("mixed"!==i&&"mixed"!==this.type&&i!==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 i=N.empty(),r=new he;return"undirected"!==e&&("out"!==t&&(i=Q(i,me(r,n,n.in))),"in"!==t&&(i=Q(i,me(r,n,n.out)))),"directed"!==e&&(i=Q(i,me(r,n,n.undirected))),i}("mixed"===i?this.type:i,r,t)}}(e,t)}))}(Me);var Te=function(e){function n(t){var n=a({type:"directed"},t);if("multi"in n&&!1!==n.multi)throw new B("DirectedGraph.from: inconsistent indication that the graph should be multi in given options!");if("directed"!==n.type)throw new B('DirectedGraph.from: inconsistent "'+n.type+'" type in given options!');return e.call(this,n)||this}return t(n,e),n}(Me),Ie=function(e){function n(t){var n=a({type:"undirected"},t);if("multi"in n&&!1!==n.multi)throw new B("UndirectedGraph.from: inconsistent indication that the graph should be multi in given options!");if("undirected"!==n.type)throw new B('UndirectedGraph.from: inconsistent "'+n.type+'" type in given options!');return e.call(this,n)||this}return t(n,e),n}(Me),Le=function(e){function n(t){var n=a({multi:!0},t);if("multi"in n&&!0!==n.multi)throw new B("MultiGraph.from: inconsistent indication that the graph should be simple in given options!");return e.call(this,n)||this}return t(n,e),n}(Me),Ne=function(e){function n(t){var n=a({type:"directed",multi:!0},t);if("multi"in n&&!0!==n.multi)throw new B("MultiDirectedGraph.from: inconsistent indication that the graph should be simple in given options!");if("directed"!==n.type)throw new B('MultiDirectedGraph.from: inconsistent "'+n.type+'" type in given options!');return e.call(this,n)||this}return t(n,e),n}(Me),$e=function(e){function n(t){var n=a({type:"undirected",multi:!0},t);if("multi"in n&&!0!==n.multi)throw new B("MultiUndirectedGraph.from: inconsistent indication that the graph should be simple in given options!");if("undirected"!==n.type)throw new B('MultiUndirectedGraph.from: inconsistent "'+n.type+'" type in given options!');return e.call(this,n)||this}return t(n,e),n}(Me);function Pe(e){e.from=function(t,n){var i=a({},t.options,n),r=new e(i);return r.import(t),r}}return Pe(Me),Pe(Te),Pe(Ie),Pe(Le),Pe(Ne),Pe($e),Me.Graph=Me,Me.DirectedGraph=Te,Me.UndirectedGraph=Ie,Me.MultiGraph=Le,Me.MultiDirectedGraph=Ne,Me.MultiUndirectedGraph=$e,Me.InvalidArgumentsGraphError=B,Me.NotFoundGraphError=V,Me.UsageGraphError=j,Me}()},944:(e,t)=>{"use strict";t.Vb=void 0,t.Vb=function(e,t,n){var i=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 i=0,r=e.length,s=t.length,o=Math.floor(Math.max(r,s)/2)-1,a=new Array(r),l=new Array(s),c=0;c<r;c++)for(var u=Math.max(0,c-o);u<=Math.min(s,c+o+1);u++)if(!a[c]&&!l[u]&&e[c]===t[u]){++i,a[c]=l[u]=!0;break}if(0===i)return 0;var h=0,d=0;for(c=0;c<r;c++)if(a[c]){for(;!l[d];)d++;e.charAt(c)!==t.charAt(d++)&&h++}return(i/r+i/s+(i-(h/=2))/i)/3}(e,t,n),r=0;if(i>.7){for(var s=Math.min(e.length,t.length),o=0;e[o]===t[o]&&o<4&&o<s;)++r,o++;i+=.1*r*(1-i)}return i}},7106:e=>{"use strict";var t=e.exports=function(e,t,i){"function"==typeof t&&(i=t,t={}),n(t,"function"==typeof(i=t.cb||i)?i:i.pre||function(){},i.post||function(){},e,"",e)};function n(e,i,r,s,o,a,l,c,u,h){if(s&&"object"==typeof s&&!Array.isArray(s)){for(var d in i(s,o,a,l,c,u,h),s){var p=s[d];if(Array.isArray(p)){if(d in t.arrayKeywords)for(var m=0;m<p.length;m++)n(e,i,r,p[m],o+"/"+d+"/"+m,a,o,d,s,m)}else if(d in t.propsKeywords){if(p&&"object"==typeof p)for(var f in p)n(e,i,r,p[f],o+"/"+d+"/"+f.replace(/~/g,"~0").replace(/\//g,"~1"),a,o,d,s,f)}else(d in t.keywords||e.allKeys&&!(d in t.skipKeywords))&&n(e,i,r,p,o+"/"+d,a,o,d,s)}r(s,o,a,l,c,u,h)}}t.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0},t.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0},t.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0},t.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0}},5072:e=>{"use strict";var t=[];function n(e){for(var n=-1,i=0;i<t.length;i++)if(t[i].identifier===e){n=i;break}return n}function i(e,i){for(var s={},o=[],a=0;a<e.length;a++){var l=e[a],c=i.base?l[0]+i.base:l[0],u=s[c]||0,h="".concat(c," ").concat(u);s[c]=u+1;var d=n(h),p={css:l[1],media:l[2],sourceMap:l[3],supports:l[4],layer:l[5]};if(-1!==d)t[d].references++,t[d].updater(p);else{var m=r(p,i);i.byIndex=a,t.splice(a,0,{identifier:h,updater:m,references:1})}o.push(h)}return o}function r(e,t){var n=t.domAPI(t);return n.update(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap&&t.supports===e.supports&&t.layer===e.layer)return;n.update(e=t)}else n.remove()}}e.exports=function(e,r){var s=i(e=e||[],r=r||{});return function(e){e=e||[];for(var o=0;o<s.length;o++){var a=n(s[o]);t[a].references--}for(var l=i(e,r),c=0;c<s.length;c++){var u=n(s[c]);0===t[u].references&&(t[u].updater(),t.splice(u,1))}s=l}}},7659:e=>{"use strict";var t={};e.exports=function(e,n){var i=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(!i)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");i.appendChild(n)}},540: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 i="";n.supports&&(i+="@supports (".concat(n.supports,") {")),n.media&&(i+="@media ".concat(n.media," {"));var r=void 0!==n.layer;r&&(i+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),i+=n.css,r&&(i+="}"),n.media&&(i+="}"),n.supports&&(i+="}");var s=n.sourceMap;s&&"undefined"!=typeof btoa&&(i+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(s))))," */")),t.styleTagTransform(i,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:()=>c});var i=n(4328),r=n(6082),s=n(6355),o=n(826),a=n(2738);const l=31;async function c(e,t=!1,n){const a=o.GO.forColumn(e);let c;n??=new Map;const h=a.isHelm()?(0,s.getHelmMonomers)(e):Object.keys(a.stats.freq).filter((e=>""!==e));for(let e=0;e<h.length;e++)n.has(h[e])||n.set(h[e],`${n.size+1}`);if(a.isHelm())c=await i.functions.call("HELM:getMolFiles",{col:e}),c=function(e,t,n=!1){const i=new Array(e.length);for(let r=0;r<e.length;r++){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 c=e.get(r);s=c.indexOf("\n",s)+1,s=c.indexOf("\n",s)+1,s=c.indexOf("\n",s)+1;const u=parseInt(c.substring(s,s+3)),h=parseInt(c.substring(s+3,s+6));a+=`M V30 COUNTS ${u} ${h} 0 0 0\n`,a+="M V30 BEGIN ATOM\n";for(let e=0;e<u;e++){s=c.indexOf("\n",s)+1+l,o=c.indexOf(" ",s);const i=c.substring(s,o);a+=n?`M V30 ${e+1} R${t.get(i)} 0.000 0.000 0 0\n`:`M V30 ${e+1} At 0.000 0.000 0 0 MASS=${t.get(i)}\n`}a+="M V30 END ATOM\n",a+="M V30 BEGIN BOND\n";for(let e=0;e<h;e++){s=c.indexOf("\n",s)+1;const t=parseInt(c.substring(s,s+3).trim()),n=parseInt(c.substring(s+3,s+6).trim());a+=`M V30 ${e+1} ${parseInt(c.substring(s+6,s+9).trim())} ${t} ${n}\n`}a+="M V30 END BOND\n",a+="M V30 END CTAB\n",a+="M END",i[r]=a}return i}(c,n,t);else{c=new Array(e.length);for(let i=0;i<e.length;i++){const e=u(a.getSplitted(i),n,t);c[i]=e}}return r.Column.fromStrings("monomericMols",c)}function u(e,t,n=!1){let i="\n Datagrok macromolecule handler\n\n 0 0 0 0 0 0 999 V3000\nM V30 BEGIN CTAB\n";i+=`M V30 COUNTS ${e.length} ${e.length?e.length-1:0} 0 0 0\n`,i+="M V30 BEGIN ATOM\n";for(let r=0;r<e.length;r++){const s=e.getCanonical(r);s!==a._S&&(i+=n?`M V30 ${r+1} R${t.get(s)} 0.000 0.000 0 0\n`:`M V30 ${r+1} At 0.000 0.000 0 0 MASS=${t.get(s)}\n`)}i+="M V30 END ATOM\n",i+="M V30 BEGIN BOND\n";for(let t=0;t<e.length-1;t++)i+=`M V30 ${t+1} 1 ${t+1} ${t+2}\n`;return i+="M V30 END BOND\n",i+="M V30 END CTAB\n",i+="M END",i}},6355:(e,t,n)=>{"use strict";n.r(t),n.d(t,{GetRegionEditor:()=>Ci,SeqActivityCliffsEditor:()=>xi,SeqPaletteCustom:()=>di,SequenceSpaceEditor:()=>Si,SplitToMonomersEditor:()=>Ai,SubsequenceSearchTopMenu:()=>tr,_package:()=>ci,activityCliffs:()=>Ri,addCopyMenu:()=>mr,alignSequences:()=>Bi,applyNotationProviderForCyclized:()=>Sr,bioSubstructureFilter:()=>or,compositionAnalysis:()=>Vi,compositionAnalysisWidget:()=>Mi,convertDialog:()=>Wi,demoBioActivityCliffs:()=>yr,demoBioAtomicLevel:()=>br,demoBioHelmMsaSequenceSpace:()=>vr,demoBioSequenceSpace:()=>gr,demoBioSimilarityDiversity:()=>fr,detectMacromoleculeProbe:()=>Cr,diversitySearchTopMenu:()=>Qi,diversitySearchViewer:()=>Ji,fastaSequenceCellRenderer:()=>Ei,getBioLib:()=>gi,getHelmMonomers:()=>Ki,getMolFromHelm:()=>Ar,getMonomerLib:()=>yi,getMonomerLibHelper:()=>ui,getRegion:()=>Pi,getRegionApp:()=>cr,getRegionHelmApp:()=>ur,getRegionPanel:()=>vi,getRegionTopMenu:()=>Oi,getSeqHandler:()=>bi,helmPreprocessingFunction:()=>Gi,hydrophobPalette:()=>hi,importBam:()=>Ui,importFasta:()=>ji,initBio:()=>mi,libraryPanel:()=>wi,longSeqTableFasta:()=>dr,longSeqTableHelm:()=>pr,longSeqTableSeparator:()=>hr,macroMolColumnPropertyPanel:()=>_i,macromoleculeDifferenceCellRenderer:()=>Ii,macromoleculePreprocessingFunction:()=>ki,manageMonomerLibraries:()=>rr,monomerCellRenderer:()=>Yi,multipleSequenceAlignmentDialog:()=>Hi,saveAsFasta:()=>sr,sdfToJsonLib:()=>wr,searchSubsequenceEditor:()=>er,separatorSequenceCellRenderer:()=>Ti,sequenceAlignment:()=>Li,sequenceIdentityScoring:()=>nr,sequenceSimilarityScoring:()=>ir,sequenceSpaceTopMenu:()=>Di,sequenceTooltip:()=>fi,similaritySearchTopMenu:()=>Xi,similaritySearchViewer:()=>Zi,splitToMonomersTopMenu:()=>qi,testDetectMacromolecule:()=>zi,toAtomicLevel:()=>Fi,vdRegionsViewer:()=>$i,webLogoAggApp:()=>lr,webLogoLargeApp:()=>ar,webLogoViewer:()=>Ni});var i,r,s=n(4328),o=n(7389),a=n(6082),l=n(684),c=n(9039);(r=i||(i={})).EUCLIDEAN="EUCLIDEAN",r.MANHATTAN="MANHATTAN";var u=n(1858),h=n(5072),d=n.n(h),p=n(7825),m=n.n(p),f=n(7659),g=n.n(f),y=n(5056),b=n.n(y),v=n(540),w=n.n(v),C=n(1113),A=n.n(C),S=n(7939),x={};x.styleTagTransform=A(),x.setAttributes=b(),x.insert=g().bind(null,"head"),x.domAPI=m(),x.insertStyleElement=w(),d()(S.A,x),S.A&&S.A.locals&&S.A.locals;var E=function(e,t,n,i){return new(n||(n=Promise))((function(r,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};let _=null,M=null;function T(e,t){return e&&""!=e?e:t}class I{constructor(){this.learningRate={uiName:"Learninig rate",value:1,tooltip:"The initial learning rate for the embedding optimization"},this.nEpochs={uiName:"Epochs",value:0,tooltip:"The number of epochs to optimize embeddings via SGD. Computed automatically if set to 0"},this.nNeighbors={uiName:"Neighbors",value:15,tooltip:"The number of nearest neighbors to construct the fuzzy manifold"},this.spread={uiName:"Spread",value:1,tooltip:"The effective scale of embedded points, used with min distance to control \n the clumped/dispersed nature of the embedding"},this.minDist={uiName:"Min distance",value:.1,tooltip:"The effective minimum distance between embedded points, \n used with spread to control the clumped/dispersed nature of the embedding"},this.randomSeed={uiName:"Random seed",value:null,tooltip:"Random seed",type:"string"},this.useWebGPU={uiName:"Use WebGPU",value:!1,tooltip:"Use WebGPU for KNN computations",type:"boolean",disableTooltip:"WebGPU is not available"},function(){return E(this,void 0,void 0,(function*(){if(!_&&(_=yield navigator.gpu.requestAdapter(),null==_))return null;const e=yield _.requestAdapterInfo();return e?T(e.description,T(e.vendor,"No GPU description available")):null}))}().then((e=>{e?this.useWebGPU.tooltip+=` (${e})`:(this.useWebGPU.value=!1,this.useWebGPU.disable=!0)}))}}class L{constructor(){this.epsilon={uiName:"Epsilon",value:10,tooltip:"Epsilon is learning rate"},this.perplexity={uiName:"Perplexity",value:30,tooltip:"Roughly how many neighbors each point influences"}}}n(934),n(8903),Object.prototype.toString;const N="MCL";a.SEMTYPE.MOLECULE,a.SEMTYPE.MACROMOLECULE;class ${constructor(){this.epsilon={uiName:"Epsilon",value:.01,tooltip:"Minimum distance between cluster points",min:0,max:2,step:.005},this.minPts={uiName:"Minimum points",value:4,tooltip:"Minimum number of points in cluster",min:1,max:1e3,step:1}}}class P{get algorithmOptions(){const e=this.methodsParams[this.methodInput.value],t={};return Object.keys(e).forEach((n=>{null!=e[n].value&&(t[n]=e[n].value)})),t}get dbScanOptions(){return{dbScanEpsilon:this.dbScanParams.epsilon.value??.01,dbScanMinPts:this.dbScanParams.minPts.value??4}}constructor(e={}){this.editorSettings={},this.plotEmbeddingsInput=o.input.bool("Plot embeddings",{value:!0}),this.clusterEmbeddingsInput=o.input.bool("Cluster embeddings",{value:!0}),this.preprocessingFunctionInputRoot=null,this.methods=[c.c.UMAP,c.c.T_SNE],this.columnFunctionsMap={},this.supportedFunctions={},this.availableMetrics=[],this.methodSettingsDiv=o.inputs([]),this.dbScanSettingsDiv=o.inputs([]),this.preprocessingFuncSettingsDiv=o.inputs([]),this.preprocessingFunctionSettings={},this.methodsParams={[c.c.UMAP]:new I,[c.c.T_SNE]:new L},this.dbScanParams=new $,this.editorSettings=e,this.editorSettings.enableMCL&&this.methods.push(N),a.Func.find({tags:[l.GP]}).forEach((e=>{const t=e.options.get(l.n3)??"",n=e.friendlyName??e.name,i=e.options.get(l.C0)??"",r=e.options.get(l._X)??"",s=e.options.get(l.Gi)??"";this.editorSettings.semtype&&!t.includes(this.editorSettings.semtype)||this.editorSettings.type&&!i.includes(this.editorSettings.type)||this.editorSettings.units&&!r.includes(this.editorSettings.units)||(this.supportedFunctions[n]={func:e,semTypes:t?t.split(","):[],types:i?i.split(","):[],units:r?r.split(","):[],distanceFunctions:s?s.split(","):[]})})),this.tableInput=o.input.table("Table",{value:s.shell.tv.dataFrame,items:s.shell.tables,onValueChanged:()=>{this.onTableInputChanged()}}),this.onTableInputChanged(),this.regenerateColInput(),this.onColumnInputChanged();let t=!1,n=!1;this.methodInput=o.input.choice("Method",{value:c.c.UMAP,items:this.methods,onValueChanged:()=>{t&&this.createAlgorithmSettingsDiv(this.methodSettingsDiv,this.methodsParams[this.methodInput.value])}}),this.methodSettingsIcon=o.icons.settings((()=>{t=!t,t?this.createAlgorithmSettingsDiv(this.methodSettingsDiv,this.methodsParams[this.methodInput.value]):o.empty(this.methodSettingsDiv)}),"Modify methods parameters"),this.dbScanSettingsIcon=o.icons.settings((()=>{n=!n,n?this.createAlgorithmSettingsDiv(this.dbScanSettingsDiv,this.dbScanParams):o.empty(this.dbScanSettingsDiv)}),"Modify clustering parameters"),this.clusterEmbeddingsInput.classList.add("ml-dim-reduction-settings-input"),this.clusterEmbeddingsInput.root.prepend(this.dbScanSettingsIcon),this.methodInput.root.classList.add("ml-dim-reduction-settings-input"),this.methodInput.root.prepend(this.methodSettingsIcon),this.methodSettingsDiv=o.inputs([]);const i=this.columnFunctionsMap[this.colInput.value.name];this.preprocessingFunctionInput=o.input.choice("Encoding function",{value:i[0],items:i,onValueChanged:()=>{this.onPreprocessingFunctionChanged()}});let r=!1;this.preprocessingFunctionInputRoot||(this.preprocessingFunctionInputRoot=this.preprocessingFunctionInput.root,r=!0),r||(o.empty(this.preprocessingFunctionInputRoot),Array.from(this.preprocessingFunctionInput.root.children).forEach((e=>this.preprocessingFunctionInputRoot.append(e)))),this.preprocessingFunctionInputRoot.classList.add("ml-dim-reduction-settings-input");let u=!1;this.preprocessingFuncSettingsIcon=o.icons.settings((async()=>{u?o.empty(this.preprocessingFuncSettingsDiv):await this.createPreprocessingFuncParamsDiv(this.preprocessingFuncSettingsDiv,this.supportedFunctions[this.preprocessingFunctionInput.value].func),u=!u}),"Modify encoding function parameters"),this.preprocessingFunctionInputRoot.prepend(this.preprocessingFuncSettingsIcon),this.similarityMetricInput=o.input.choice("Similarity",{value:"",items:[]}),this.similarityMetricInput.nullable=!1,this.similarityMetricInputRoot||(this.similarityMetricInputRoot=this.similarityMetricInput.root),this.onPreprocessingFunctionChanged()}getColInput(){const e=this.tableInput.value?.columns.toList().find((e=>!!this.columnFunctionsMap[e.name]))??null,t=o.input.column("Column",{table:this.tableInput.value,value:e,onValueChanged:()=>this.onColumnInputChanged(),filter:e=>!!this.columnFunctionsMap[e.name]});return this.colInputRoot||(this.colInputRoot=t.root),t}regenerateColInput(){let e=!1;this.colInputRoot&&(e=!0,o.empty(this.colInputRoot)),this.colInput=this.getColInput(),e&&Array.from(this.colInput.root.children).forEach((e=>this.colInputRoot.append(e))),this.onColumnInputChanged()}onTableInputChanged(){const e=this.tableInput.value;e&&(this.columnFunctionsMap={},e.columns.toList().forEach((e=>{Object.keys(this.supportedFunctions).forEach((t=>{const n=this.supportedFunctions[t].semTypes,i=this.supportedFunctions[t].types,r=this.supportedFunctions[t].units,s=!n.length||e.semType&&n.includes(e.semType),o=!i.length||i.includes(e.type),a=!r.length||e.meta.units&&r.includes(e.meta.units);s&&o&&a&&(this.columnFunctionsMap[e.name]||(this.columnFunctionsMap[e.name]=[]),this.columnFunctionsMap[e.name].push(t))}))})),this.regenerateColInput())}onColumnInputChanged(){const e=this.colInput.value;if(!e)return;const t=this.columnFunctionsMap[e.name];this.preprocessingFunctionInput=o.input.choice("Preprocessing function",{value:t[0],items:t,onValueChanged:()=>{this.onPreprocessingFunctionChanged()}});let n=!1;this.preprocessingFunctionInputRoot||(this.preprocessingFunctionInputRoot=this.preprocessingFunctionInput.root,n=!0),n||(o.empty(this.preprocessingFunctionInputRoot),Array.from(this.preprocessingFunctionInput.root.children).forEach((e=>this.preprocessingFunctionInputRoot.append(e)))),this.onPreprocessingFunctionChanged()}onPreprocessingFunctionChanged(){o.empty(this.preprocessingFuncSettingsDiv),this.preprocessingFunctionSettings={};const e=this.preprocessingFunctionInput.value,t=this.supportedFunctions[e].distanceFunctions;this.availableMetrics=[...t],this.similarityMetricInput=o.input.choice("Similarity",{value:this.availableMetrics[0],items:this.availableMetrics}),this.similarityMetricInput.nullable=!1,this.similarityMetricInputRoot||(this.similarityMetricInputRoot=this.similarityMetricInput.root),o.empty(this.similarityMetricInputRoot),Array.from(this.similarityMetricInput.root.children).forEach((e=>this.similarityMetricInputRoot.append(e))),this.preprocessingFuncSettingsIcon&&(this.supportedFunctions[e].func.inputs.length<3?this.preprocessingFuncSettingsIcon.style.display="none":this.preprocessingFuncSettingsIcon.style.display="flex")}createAlgorithmSettingsDiv(e,t){return o.empty(e),Object.keys(t).forEach((n=>{const i=t[n],r="string"===i.type?o.input.string(i.uiName,{value:i.value??"",onValueChanged:()=>{i.value=r.value}}):"boolean"===i.type?o.input.bool(i.uiName,{value:i.value??!1,onValueChanged:()=>{i.value=r.value}}):o.input.float(i.uiName,{value:i.value,onValueChanged:()=>{i.value=r.value}});e.append(r.root),i.disable?(r.enabled=!1,o.tooltip.bind(r.input??r.root,i.disableTooltip??"")):o.tooltip.bind(r.input??r.root,i.tooltip)})),e}async createPreprocessingFuncParamsDiv(e,t){if(o.empty(e),t.inputs.length<3)return o.div();const n=t.prepare(),i=await n.buildEditor(o.div());for(let r=2;r<t.inputs.length;r++){const s=t.inputs[r];(this.preprocessingFunctionSettings[s.name]||n.inputParams[t.inputs[r].name].value||s.defaultValue)&&(this.preprocessingFunctionSettings[s.name]=this.preprocessingFunctionSettings[s.name]??n.inputParams[s.name].value??s.defaultValue);const o=i.find((e=>e.property.name===s.name));o&&(null!==this.preprocessingFunctionSettings[s.name]&&void 0!==this.preprocessingFunctionSettings[s.name]&&(o.value=this.preprocessingFunctionSettings[s.name]),o.onChanged((()=>{this.preprocessingFunctionSettings[s.name]=o.value})),e.append(o.root))}return e}getEditor(){return o.div([this.tableInput,this.colInputRoot,this.preprocessingFunctionInputRoot,this.preprocessingFuncSettingsDiv,this.methodInput,this.methodSettingsDiv,this.similarityMetricInputRoot,this.plotEmbeddingsInput,this.clusterEmbeddingsInput,this.dbScanSettingsDiv],{style:{minWidth:"420px"},classes:"ui-form dim-reduction-dialog-form"})}getParams(){return{table:this.tableInput.value,col:this.colInput.value,methodName:this.methodInput.value,preprocessingFunction:this.supportedFunctions[this.preprocessingFunctionInput.value].func,similarityMetric:this.similarityMetricInput.value,plotEmbeddings:this.plotEmbeddingsInput.value,clusterEmbeddings:this.clusterEmbeddingsInput.value,options:{...this.algorithmOptions,...this.dbScanOptions,preprocessingFuncArgs:this.preprocessingFunctionSettings??{}}}}}const O=rxjs.operators;var R=n(6295);const k=e=>null==e;function G(e,t,n,i){if(n>e[e.length-1])return;const r=e.findIndex((e=>n<e));e.pop(),e.splice(r,0,n),t.pop(),t.splice(r,0,i)}class D{constructor(e=!0,t=!0){const i=navigator.hardwareConcurrency;this._workerCount=e?Math.max(i-2,1):1,this._workers=new Array(this._workerCount).fill(null).map((()=>new Worker(new URL(n.p+n.u(793),n.b)))),this._terminateOnComplete=t}async calc(e,t,n=!0,r){return await this.calcMulti([e],[t],n,[r??{}],[1],i.MANHATTAN)}async calcMulti(e,t,n=!0,r=[{}],s=[1],o=i.MANHATTAN){if(e.length<1)throw new Error("values must contain at least one array");if(t.length!==e.length||r.length!==e.length||s.length!==e.length)throw new Error("values, fnNames, weights and opts must have the same length");return new Promise((async(i,a)=>{try{const a=e[0].length,l=new Array(this._workerCount),c=a*(a-1)/2;this._workerCount=Math.min(this._workerCount,c);const u=c/this._workerCount,h=new Float32Array(c);let d=0,p=1,m=0,f=Number.MIN_VALUE;for(let n=0;n<this._workerCount;n++){const i=Math.floor(n*u),g=n===this._workerCount-1?c:Math.floor((n+1)*u),y=d,b=p;n!==this._workerCount-1&&(d=a-2-Math.floor(Math.sqrt(-8*g+4*a*(a-1)-7)/2-.5),p=g-a*d+Math.floor((d+1)*(d+2)/2)),this._workers[n].postMessage({values:e,fnNames:t,startRow:y,startCol:b,chunckSize:g-i,opts:r,weights:s,aggregationMethod:o}),l[n]=new Promise(((e,t)=>{this._workers[n].onmessage=({data:{error:r,distanceMatrixData:s,min:o,max:a}})=>{this._terminateOnComplete&&setTimeout((()=>this._workers[n].terminate())),r?t(r):(h.set(s,i),o<m&&(m=o),a>f&&(f=a),e())}}))}await Promise.all(l),n&&h.forEach(((e,t)=>{h[t]=(e-m)/(f-m)})),i(h)}catch(e){a(e)}}))}terminate(){this._workers.forEach((e=>e.terminate()))}}class F{constructor(){this._workerCount=Math.max(navigator.hardwareConcurrency-2,1)}async calcMultiColumn(e,t,r,s=[{}],o=[1],a=i.EUCLIDEAN){const l=e[0].length*(e[0].length-1)/2,c=Math.floor(l/this._workerCount),u=e[0].length>2e4?await this.getMinimalThreshold(e,t,s,o,a):0;r<u&&(console.log(`using threshold ${u}`),r=u),s.forEach(((e,t)=>s[t].threshold=r));const h=new Array(this._workerCount),d=new Array(this._workerCount).fill(null).map((()=>new Worker(new URL(n.p+n.u(111),n.b))));for(let n=0;n<this._workerCount;n++)h[n]=new Promise(((i,u)=>{const h=n*c,p=n===this._workerCount-1?l:(n+1)*c;p<=h&&i({i:new Int32Array(0),j:new Int32Array(0),distance:new Float32Array(0),idx:n}),d[n].postMessage({values:e,startIdx:h,endIdx:p,threshold:r,fnNames:t,opts:s,weights:o,aggregationMethod:a}),d[n].onmessage=({data:{error:e,i:t,j:r,distance:s}})=>{e?(d[n].terminate(),u(e)):(d[n].terminate(),i({i:t,j:r,distance:s,idx:n}))}}));const p=await Promise.all(h),m=p.reduce(((e,t)=>e+t.i.length),0),f=new Int32Array(m),g=new Int32Array(m),y=new Float32Array(m);let b=0;for(const e of p)f.set(e.i,b),g.set(e.j,b),y.set(e.distance,b),b+=e.i.length;return{i:f,j:g,distance:y}}async calc(e,t,n,i={}){return await this.calcMultiColumn([e],[t],n,[i],[1])}async getKNN(e,t,n=15,i={}){return await this.multiColumnKNN([e],[t],n,[i],[1])}async getThresholdKNN(e,t,n=.8,i={}){return await this.multiColumnThresholdKnn([e],[t],n,[i],[1])}async multiColumnThresholdKnn(e,t,r=.8,s,o,a=i.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 l=e[0].length*(e[0].length-1)/2,c=Math.floor(l/this._workerCount),u=new Array(this._workerCount),h=new Array(this._workerCount).fill(null).map((()=>new Worker(new URL(n.p+n.u(603),n.b))));for(let n=0;n<this._workerCount;n++)u[n]=new Promise(((i,u)=>{const d=n*c,p=n===this._workerCount-1?l:(n+1)*c;p<=d&&i({knnDistances:new Array(0),knnIndexes:new Array(0)}),h[n].postMessage({values:e,startIdx:d,endIdx:p,fnNames:t,opts:s,threshold:r,weights:o,aggregationMethod:a}),h[n].onmessage=({data:{error:e,knnDistances:t,knnIndexes:r}})=>{e?(h[n].terminate(),u(e)):(h[n].terminate(),i({knnDistances:t,knnIndexes:r}))}}));const d=await Promise.all(u),p=new Int32Array(e[0].length);for(const t of d)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 d)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,r=15,s,o,a=i.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 l=e[0].length*(e[0].length-1)/2,c=Math.floor(l/this._workerCount),u=new Array(this._workerCount),h=new Array(this._workerCount).fill(null).map((()=>new Worker(new URL(n.p+n.u(950),n.b))));for(let n=0;n<this._workerCount;n++)u[n]=new Promise(((i,u)=>{const d=n*c,p=n===this._workerCount-1?l:(n+1)*c;p<=d&&i({knnDistances:new Array(0),knnIndexes:new Array(0)}),h[n].postMessage({values:e,startIdx:d,endIdx:p,fnNames:t,opts:s,nNeighbours:r,weights:o,aggregationMethod:a}),h[n].onmessage=({data:{error:e,knnDistances:t,knnIndexes:r}})=>{e?(h[n].terminate(),u(e)):(h[n].terminate(),i({knnDistances:t,knnIndexes:r}))}}));const d=await Promise.all(u),p={knnDistances:new Array(e[0].length).fill(null).map((()=>new Array(r).fill(99999))),knnIndexes:new Array(e[0].length).fill(null).map((()=>new Array(r).fill(-1)))};for(const t of d)for(let n=0;n<e[0].length;++n)for(let e=0;e<t.knnDistances[n]?.length;++e)G(p.knnDistances[n],p.knnIndexes[n],t.knnDistances[n][e],t.knnIndexes[n][e]);return p}async getSampleDistances(e,t,r=[],s,o=i.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,i=Math.floor(n/this._workerCount),l=1e6,c=Math.max(Math.min(n/1e3,l),Math.min(n,l)),u=Math.floor(c/this._workerCount),h=new Array(this._workerCount);for(let l=0;l<this._workerCount;l++)h[l]=new Promise(((c,h)=>{const d=l*i,p=l===this._workerCount-1?n:(l+1)*i;a[l].postMessage({values:e,startIdx:d,endIdx:p,sampleLength:u,fnNames:t,opts:r,weights:s,aggregationMethod:o}),a[l].onmessage=({data:{error:e,distance:t}})=>{a[l].terminate(),e?h(e):c({distance:t})}}));const d=await Promise.all(h),p=d.reduce(((e,t)=>e+t.distance.length),0),m=new Float32Array(p);let f=0;for(const e of d)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=[],r,s=i.EUCLIDEAN){try{const i=e.length*(e.length-1)/2,o=await this.getSampleDistances(e,t,n,r,s);return 1-o[Math.floor(7e7/i*o.length)]}catch(e){return console.error(e),.5}}static calcSync(e,t,n,i){const r=[],s=[],o=[];let a=0,l=0,c=0;const u=e.length*(e.length-1)/2;for(;a<u;){const t=k(e[l])||k(e[c])?1:n(e[l],e[c]);1-t>=i&&(r.push(l),s.push(c),o.push(t)),a++,c++,c===e.length&&(l++,c=l+1)}return{i:new Int32Array(r),j:new Int32Array(s),distance:new Float32Array(o)}}}var H,B,V=n(8774);(B=H||(H={})).none="none",B.bold="bold",B.dashed="dashed";class j{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,i,r=H.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=r,this.updateLines(i),this.visibility=null!==(s=i.visibility)&&void 0!==s?s:new V.A(this.lines.from.length),i.visibility||this.visibility.setAll(!0,!1),i.arrowSize&&(this.arrowWidth=i.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,i,r,s,o,a,l,c,u,h,d,p,m,f,g;const y=this.sp.getOptions().look,b=this.lines.colors||this.lines.widths||this.lines.opacities||this.lines.drawArrowsArr;b||(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 v=y.sizeColumnName?this.sp.dataFrame.col(y.sizeColumnName):null,w=this.sp.dataFrame.filter,C=Math.pow(null!==(i=this.lines.shortLineThreshold)&&void 0!==i?i: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{sizeFrom:n,sizeTo:i}=this.getMarkersSizes(y,v,e),w=this.sp.worldToScreen(this.xAxisCol.get(this.lines.from[e]),this.yAxisCol.get(this.lines.from[e]));let A=null==w?void 0:w.x,S=null==w?void 0:w.y;const x=this.sp.worldToScreen(this.xAxisCol.get(this.lines.to[e]),this.yAxisCol.get(this.lines.to[e]));let E=null==x?void 0:x.x,_=null==x?void 0:x.y;const M=Math.min(this.sp.viewBox.width,this.sp.viewBox.height);if(this.ctx.beginPath(),A&&S&&E&&_&&Math.hypot(E-A,_-S)/M>.01){if(b){const t=(null===(r=this.lines.colors)||void 0===r?void 0:r[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===(l=this.lines.opacities)||void 0===l?void 0:l[e]:null!==(c=this.lines.opacity)&&void 0!==c?c:1;this.ctx.strokeStyle=`rgba(${t},${n})`,this.ctx.lineWidth=(null===(u=this.lines.widths)||void 0===u?void 0:u[e])?null===(h=this.lines.widths)||void 0===h?void 0:h[e]:null!==(d=this.lines.width)&&void 0!==d?d:1}e===this._currentLineIdx&&this.toggleCurrentLineStyle(!0);const y=this.multipleLinesCounts[e];let v=null;if(y){t=this.getLineLength(A,S,E,_);const r=this.getPointOnDistance(A,S,E,_,i,t),s=this.getPointOnDistance(E,_,A,S,n,t);A=r.x,S=r.y,E=s.x,_=s.y,v=this.lines.from[e]>this.lines.to[e]?this.findControlPoint(y,A,S,E,_,e):this.findControlPoint(y,E,_,A,S,e),this.ctx.moveTo(A,S),this.ctx.quadraticCurveTo(v.x,v.y,E,_)}else(!this.lines.skipShortLines||Math.pow(E-A,2)+Math.pow(_-S,2)>C)&&(this.ctx.moveTo(A,S),this.ctx.lineTo(E,_));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(A,S,E,_)),t>this.arrowWidth)){const e=y?null:this.getPointOnDistance(A,S,E,_,i,t),n=y?v.x:A,r=y?v.y:S;this.canvasArrow(this.ctx,null!==(f=null==e?void 0:e.x)&&void 0!==f?f:A,null!==(g=null==e?void 0:e.y)&&void 0!==g?g:S,n,r)}this.ctx.stroke(),this.ctx.closePath(),e===this._currentLineIdx&&this.toggleCurrentLineStyle(!1)}}this.fillLeftBottomRect()}toggleCurrentLineStyle(e){switch(this.currentLineStyle){case H.bold:e?this.ctx.lineWidth+=2:this.ctx.lineWidth-=2;break;case H.dashed:e?this.ctx.setLineDash([5,5]):this.ctx.setLineDash([]);break;default:return}}getMarkersSizes(e,t,n){let i=3,r=3;return t?(i=(e.markerMinSize+(e.markerMaxSize-e.markerMinSize)*t.scale(this.lines.from[n]))/2,r=(e.markerMinSize+(e.markerMaxSize-e.markerMinSize)*t.scale(this.lines.to[n]))/2):e.markerDefaultSize&&(i=e.markerDefaultSize/2,r=e.markerDefaultSize/2),{sizeFrom:i,sizeTo:r}}fillLeftBottomRect(){const e=new Path2D;e.rect(this.sp.yAxisBox.minX,this.sp.yAxisBox.maxY,this.sp.yAxisBox.width,this.sp.xAxisBox.height),this.ctx.fillStyle="white",this.ctx.beginPath(),this.ctx.fill(e),this.ctx.closePath()}createMultiLinesIndices(){const e={};for(let t=0;t<this.lines.from.length;t++){let n=0,i=0;this.lines.from[t]<this.lines.to[t]?(n=this.lines.from[t],i=this.lines.to[t]):(n=this.lines.to[t],i=this.lines.from[t]),e[`${n}|${i}`]?(1===e[`${n}|${i}`].length&&(this.multipleLinesCounts[e[`${n}|${i}`][0]]=1,e[`${n}|${i}`].push(1)),this.multipleLinesCounts[t]=++e[`${n}|${i}`][1]):e[`${n}|${i}`]=[t]}}checkCoordsOnLine(e,t){let n=-1,i=null,r=null;const s=this.sp.getOptions().look,o=s.sizeColumnName?this.sp.dataFrame.col(s.sizeColumnName):null,a=this.sp.dataFrame.filter;for(let l=0;l<this.lines.from.length;l++)if(a.get(this.lines.from[l])&&a.get(this.lines.to[l])&&this.visibility.getBit(l)){const{sizeFrom:a,sizeTo:c}=this.getMarkersSizes(s,o,l),u=this.sp.worldToScreen(this.xAxisCol.get(this.lines.from[l]),this.yAxisCol.get(this.lines.from[l])),h=this.sp.worldToScreen(this.xAxisCol.get(this.lines.to[l]),this.yAxisCol.get(this.lines.to[l]));if(this.multipleLinesCounts[l]){const n=this.getLineLength(u.x,u.y,h.x,h.y),i=this.getPointOnDistance(u.x,u.y,h.x,h.y,c,n),s=this.getPointOnDistance(h.x,h.y,null==u?void 0:u.x,null==u?void 0:u.y,a,n),o=this.lines.from[l]>this.lines.to[l]?this.findControlPoint(this.multipleLinesCounts[l],i.x,i.y,s.x,s.y,l):this.findControlPoint(this.multipleLinesCounts[l],s.x,s.y,i.x,i.y,l);r=this.calculateDistToCurveLine(l,e,t,i,s,o)}else r=this.calculateDistToStraightLine(e,t,u,h);(!i&&null!==r&&r<5||i&&null!==r&&r<i)&&(i=r,n=l)}return n}calculateDistToStraightLine(e,t,n,i){const r=Math.min(n.x,i.x),s=Math.max(n.x,i.x),o=Math.min(n.y,i.y),a=Math.max(n.y,i.y);return e>=r-2&&e<=s+2&&t>=o-2&&t<=a+2?this.distToStraightLineSegment(e,t,n,i):null}distToStraightLineSegment(e,t,n,i){const r=(e,t,n,i)=>Math.pow(e-n,2)+Math.pow(t-i,2),s=r(n.x,n.y,i.x,i.y);if(0==s)return r(e,t,n.x,n.y);let o=((e-n.x)*(i.x-n.x)+(t-n.y)*(i.y-n.y))/s;return o=Math.max(0,Math.min(1,o)),r(e,t,n.x+o*(i.x-n.x),n.y+o*(i.y-n.y))}calculateDistToCurveLine(e,t,n,i,r,s){const o=Math.min(i.x,r.x,s.x),a=Math.max(i.x,r.x,s.x),l=Math.min(i.y,r.y,s.y),c=Math.max(i.y,r.y,s.y);if(t>=o-2&&t<=a+2&&n>=l-2&&n<=c+2){const e=a-o,u=c-l;return this.calculateDistToCurveInRect(t,n,i,s,r,e,u)}return null}calculateDistToCurveInRect(e,t,n,i,r,s,o){const a=Math.floor((s+o)/3),l=1/a,c=new Uint32Array(a),u=new Uint32Array(a),h=new Uint32Array(a);let d=null;const p=new V.A(a);for(let s=0;s<c.length;s++){const o=s*l,a=Math.pow(1-o,2)*n.x+2*o*(1-o)*i.x+Math.pow(o,2)*r.x,p=Math.pow(1-o,2)*n.y+2*o*(1-o)*i.y+Math.pow(o,2)*r.y,m=Math.abs(e-a),f=Math.abs(t-p),g=m+f;(!d||d>g)&&(d=g),h[s]=Math.max(m,f),c[s]=a,u[s]=p}for(let e=0;e<c.length;e++)h[e]<d&&p.setBit(e,!0,!1);let m=null;for(let n=-1;-1!==(n=p.findNext(n));){const i=Math.hypot(c[n]-e,u[n]-t);(!m||m>i)&&(m=i)}return m}getLineLength(e,t,n,i){return Math.sqrt(Math.pow(n-e,2)+Math.pow(i-t,2))}getPointOnDistance(e,t,n,i,r,s){const o=n-r*((n-e)/s),l=i-r*((i-t)/s);return new a.Point(o,l)}findControlPoint(e,t,n,i,r,s){const o=t+(i-t)/2,l=n+(r-n)/2;let c=o-t,u=l-n;const h=Math.sqrt(c*c+u*u);c/=h,u/=h;const d=50*Math.ceil(e/2);return e%2==0?new a.Point(o+d/2*u,l-d/2*c):new a.Point(o-d/2*u,l+d/2*c)}canvasArrow(e,t,n,i,r){const s=Math.atan2(i-t,r-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 U="dimensionality-reducer-terminate-event";var W,Y,z=n(3629);async function q(e,t,i,r,o,a,l){let c=await async function(e,t,i,r,o,a,l){if(!a.distanceFnArgs)throw new Error("options.distanceFnArgs must be defined");if(e.length!==t.length||e.length!==a.distanceFnArgs.length||e.length!==r.length)throw new Error("data, metrics and options and weights must have the same length");return new Promise((function(c,u){const h=new Worker(new URL(n.p+n.u(234),n.b));h.postMessage({columnsData:e,distanceMetrics:t,method:i,options:a,weights:r,aggregationMethod:o});const d=s.events.onCustomEvent(U).subscribe((()=>{try{h?.terminate()}finally{d.unsubscribe()}}));h.onmessage=({data:{error:e,embedding:t,epochNum:n,epochsLength:i}})=>{k(n)||k(i)?(d.unsubscribe(),e?u(e):c(t),setTimeout((()=>h.terminate()),100)):l&&l(n,i,t)}}))}(e,i,t,r,o,a,l);return c=c.map((e=>(0,z.S8)(e))),c}(Y=W||(W={})).EUCLIDEAN="EUCLIDEAN",Y.MANHATTAN="MANHATTAN";const K={[W.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 `},[W.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 Z,X;(X=Z||(Z={})).HAMMING="Hamming",X.EUCLIDEAN="Euclidean",X.MANHATTAN="Manhattan",X.TANIMOTO="Tanimoto",X.LEVENSTEIN="Levenshtein",X.NEEDLEMAN_WUNSCH="Needlemann-Wunsch",X.MONOMER_CHEMICAL_DISTANCE="Monomer chemical distance",X.SOKAL="Sokal",X.COSINE="Cosine",X.ASYMMETRIC="Asymmetric",X.Difference="Difference",X.OneHot="One-Hot";const J={[Z.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 `},[Z.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 `},[Z.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 `},[Z.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 `},[Z.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 `},[Z.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 `},[Z.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 `},[Z.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 `},[Z.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 `},[Z.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 `},[Z.Difference]:function(e,t){return`\n let range = suppInfo.range${t};\n return f32(abs(f32(a[0]) - f32(b[0])) / range);\n `},[Z.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 `}},Q={[Z.HAMMING]:e=>Math.ceil(e/30),[Z.EUCLIDEAN]:e=>Math.ceil(e/30),[Z.MANHATTAN]:e=>Math.ceil(e/30),[Z.TANIMOTO]:e=>Math.ceil(e/60),[Z.SOKAL]:e=>Math.ceil(e/60),[Z.COSINE]:e=>Math.ceil(e/60),[Z.ASYMMETRIC]:e=>Math.ceil(e/60),[Z.LEVENSTEIN]:e=>Math.ceil(e*e/60),[Z.NEEDLEMAN_WUNSCH]:e=>Math.ceil(e*e/60),[Z.MONOMER_CHEMICAL_DISTANCE]:e=>Math.ceil(e/25),[Z.Difference]:e=>1,[Z.OneHot]:e=>Math.ceil(e/40)},ee={STRING:new Set([Z.HAMMING,Z.LEVENSTEIN,Z.NEEDLEMAN_WUNSCH,Z.MONOMER_CHEMICAL_DISTANCE,Z.OneHot]),UINT32ARRAY:new Set([Z.HAMMING,Z.EUCLIDEAN,Z.MANHATTAN,Z.MONOMER_CHEMICAL_DISTANCE,Z.LEVENSTEIN,Z.NEEDLEMAN_WUNSCH,Z.TANIMOTO,Z.COSINE,Z.SOKAL,Z.ASYMMETRIC,Z.OneHot,Z.Difference]),INT32ARRAY:new Set([Z.EUCLIDEAN,Z.MANHATTAN,Z.OneHot,Z.Difference]),FLOAT32ARRAY:new Set([Z.EUCLIDEAN,Z.MANHATTAN,Z.Difference]),NUMBER:new Set([Z.EUCLIDEAN,Z.MANHATTAN,Z.Difference]),BITARRAY:new Set([Z.TANIMOTO,Z.COSINE,Z.SOKAL,Z.ASYMMETRIC])};var te=function(e,t,n,i){return new(n||(n=Promise))((function(r,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};function ne(e,t,n,i){return e.map(((e,i)=>`\n fn distanceScript${i}(aIndex: u32, bIndex: u32) -> f32 {\n let a = computeInfo.data${i}[aIndex];\n let b = computeInfo.data${i}[bIndex];\n let maxDistance: f32 = ${n};\n ${J[e](t[i],i)}\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 ${K[i](e.length)}\n }\n \n `}let ie=0;const re="cliffsDf",se=new u.Subject,oe="activity_difference",ae="SALI_index",le="similarity",ce="line_index",ue=["1_molecule","2_molecule"],he="filterCliffs";async function de(e,t,i,r,l,c,u,h,d,p,m,f,g,y,b,v){ie++;const w=c/100;let C,A=!1;const S=f.inputs,x=await f.apply({[S[0].name]:t,[S[1].name]:u,...d.preprocessingFuncArgs??{}});let T=[];if(h===N){const t=await function(e,t,i,r,s,o,a=10,l=!1,c=2){const u=new Worker(new URL(n.p+n.u(449),n.b));let h;return u.postMessage({data:e,threshold:t,weights:i,aggregationMethod:r,distanceFns:s,distanceFnArgs:o,maxIterations:a,useWebGPU:l,inflate:c}),{promise:new Promise(((e,t)=>{h=e,u.onmessage=t=>{setTimeout((()=>u.terminate()),100),e(t.data.res)},u.onerror=e=>{setTimeout((()=>u.terminate()),100),t(e)}})),terminate:()=>{try{h(null),u.terminate()}catch(e){console.error(e)}}}}([x.entries],c,[1],"MANHATTAN",[u],[x.options??{}],d?.maxIterations??5,d.useWebGPU??!1).promise;e.columns.addNewInt(e.columns.getUnusedName("MCL Cluster")).init((e=>t.clusters[e])),T=[t.embedX,t.embedY]}else T=await q([x.entries],h,[u],[1],"MANHATTAN",{...d,distanceFnArgs:[x.options??{}]});if(T.length!==i.length)throw new Error("Number of axes names should be equal to number of embedding dimensions");for(let t=0;t<T.length;++t)e.columns.addNewFloat(i[t]).init((e=>T[t][e]));let I=null;if(d.useWebGPU)try{I=await function(e,t=.8,n,i,r,s){return te(this,void 0,void 0,(function*(){const o=yield function(){return E(this,void 0,void 0,(function*(){if(!_&&(_=yield navigator.gpu.requestAdapter({powerPreference:"high-performance"}),null==_))return null;let e=!1;if(M&&(M.lost.then((()=>{e=!0})),yield new Promise((e=>setTimeout(e,10)))),!M||e){const e=1e9,t=_.limits,n=t.maxBufferSize,i=t.maxStorageBufferBindingSize;try{return M=yield _.requestDevice({requiredLimits:{maxBufferSize:Math.min(n,e),maxStorageBufferBindingSize:Math.min(i,e)}}),M}catch(e){return console.error("Failed to create device with required limits",e),M=yield _.requestDevice(),M}}return M}))}();if(!o)return null;const a=Object.values(Z);if(n.some((e=>!a.includes(e))))throw new Error("Invalid distance metrics provided: "+n.join(", "));if(!Object.values(W).includes(i))throw new Error("Invalid aggregation function provided: "+i);const l=1-t;if(s.length!==e.length||s.length!==n.length||s.length!==r.length)throw new Error("Options, weigths and distance functions must be provided for each column");if(e.some((t=>t.length!==e[0].length)))throw new Error("All entry lists must be the same length");const c=e.length,u=e[0].length,h=e.map(((e,t)=>function(e,t=Z.HAMMING,n,i={gapOpenPenalty:1,gapExtensionPenalty:.6}){var r,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 l=a[0]instanceof Int32Array?"INT32ARRAY":a[0]instanceof Float32Array?"FLOAT32ARRAY":"UINT32ARRAY",c=new Uint32Array(a.map((e=>e.length)));if(!ee[o]||!ee[o].has(t))throw new Error(`Distance metric '${t}' not supported for entry type '${o}'`);const u=c.reduce(((e,t)=>Math.max(e,t)),0),h=Q[t](u),d="INT32ARRAY"===l?Int32Array:"FLOAT32ARRAY"===l?Float32Array:Uint32Array,p=new d(a.length*u);a.forEach(((e,t)=>{p.set(e,t*u)}));let m="",f=0,g="FLOAT32ARRAY",y=null;if(t===Z.NEEDLEMAN_WUNSCH||t===Z.MONOMER_CHEMICAL_DISTANCE){let e=i.scoringMatrix&&i.alphabetIndexes?Object.keys(i.alphabetIndexes).reduce(((e,t)=>Math.max(e,t.charCodeAt(0))),0):-1;if(!i.alphabetIndexes||!i.scoringMatrix){for(let t=0;t<p.length;t++)p[t]>e&&(e=p[t]);i.scoringMatrix=new Array(e+1).fill(null).map((()=>new Array(e+1).fill(0))),i.alphabetIndexes={};for(let e=0;e<i.scoringMatrix.length;e++)i.scoringMatrix[e][e]=1,i.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=i.alphabetIndexes;for(const e of Object.keys(a))for(const t of Object.keys(a))e!==t&&(o[e.charCodeAt(0)][t.charCodeAt(0)]=i.scoringMatrix[a[e]][a[t]]);f=2+t,g="FLOAT32ARRAY",y=new Float32Array(f),y[0]=null!==(r=i.gapOpenPenalty)&&void 0!==r?r:1,y[1]=null!==(s=i.gapExtensionPenalty)&&void 0!==s?s:.6;let l=2;for(let e=0;e<o.length;e++)y.set(o[e],l),l+=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===Z.Difference){if(!i.range||"number"!=typeof i.range||i.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]);i.range=t-e}i.range<=0&&(i.range=1),f=1,g="FLOAT32ARRAY",y=new Float32Array([i.range]),m=`\n range${n}: f32`}const b=p instanceof Int32Array?"i32":p instanceof Float32Array?"f32":"u32",v=`data${n}: array<array<${b}, ${u}>, ${a.length}>`;return{flatSourceArray:p,sourceArraySize:p.length,maxEntryLen:u,arraySizes:c,complexity:h,suppInfoBuffer:y,suppInfoSize:f,suppInfoType:g,suppInfoStructWgsl:m,entryType:o,dataTypeWGSL:b,dataStructWgsl:v,EncodedArrayConstructor:d}}(e,n[t],t,s[t])));if(0===c)throw new Error("No columns provided. Please provide at least one column of data.");1===c&&(i=W.MANHATTAN);let d=h.map((e=>e.suppInfoStructWgsl)).filter((e=>!!e&&""!=e)).join(",\n"),p=!1;d&&""!=d.trim()||(p=!0,d="\ndummy: f32\n");const m=h.map((e=>e.dataStructWgsl)).filter((e=>!!e&&""!=e)).join(",\n"),f=new Uint32Array(c*u);h.forEach(((e,t)=>{f.set(e.arraySizes,t*u)}));const g=1e4,y=100,b=h.reduce(((e,t)=>e+t.complexity),0),v=Math.ceil(6e3/b),w=Math.ceil(Math.sqrt(Math.ceil(100))),C=10*w,A=u*(u-1)/2,S=Math.ceil(A/g),x=o.createShaderModule({label:"Sparse matrix compute shader",code:`\n // each thread will perform 100 iterations at one time, comparing 100 pairs of entries.\n // in total, each thread will perform at most ${S} comparisons.\n // first is the result struct, containing is, js, and distances. each array with length of 100,\n // and also integer for how many pairs were found to be below threshold.\n struct SparseResult {\n i: array<array<u32, 100>, 10000>,\n j: array<array<u32, 100>, 10000>,\n distances: array<array<f32, 100>, 10000>,\n found: array<u32, 10000>,\n done: array<u32, 10000>\n }\n // struct for the data\n struct ComputeInfo {\n // start at cols and rows, and end at cols and rows for each thread, these will be calculated on cpu and passed to gpu.\n startAtCols: array<u32, 10000>,\n startAtRows: array<u32, 10000>,\n endAtCols: array<u32, 10000>,\n endAtRows: array<u32, 10000>,\n\n // the ACTUALLY sizes of each entry\n entrySizes: array<array<u32, ${u}>, ${c}>,\n // the weights for each entry\n weights: array<f32, ${c}>,\n // the data for each entry\n ${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 ${d}\n };\n\n @group(0) @binding(0) var<storage, read_write> computeInfo: ComputeInfo;\n @group(0) @binding(1) var<storage, read_write> suppInfo: SuppInfo;\n @group(0) @binding(2) var<storage, read_write> results: SparseResult;\n @compute @workgroup_size(10, 10) fn calcSparseMatrix(\n @builtin(global_invocation_id) id: vec3<u32>\n ) {\n ${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 * ${C} + threadCol;\n if (linearIndex >= 10000) {\n return; // if we are out of bounds, return\n } \n var startAtCol: u32 = computeInfo.startAtCols[linearIndex];\n var startAtRow: u32 = computeInfo.startAtRows[linearIndex];\n let endAtCol: u32 = min(computeInfo.endAtCols[linearIndex], ${u}u);\n let endAtRow: u32 = min(computeInfo.endAtRows[linearIndex], ${u}u);\n let is = &results.i[linearIndex];\n let js = &results.j[linearIndex];\n let distances = &results.distances[linearIndex];\n results.found[linearIndex] = 0; // initialize the found counter\n var found: u32 = 0;\n if (results.done[linearIndex] > 0) {\n return; // if we are done, return\n }\n for (var i = 0; i < ${v}; i++) {\n if (startAtCol >= endAtCol && startAtRow >= endAtRow) {\n results.done[linearIndex] = 1;\n break;\n }\n if (found >= 100) {\n break;\n }\n let dist = combinedDistance(startAtCol, startAtRow);\n if (dist <= ${l}) {\n (*is)[found] = startAtCol;\n (*js)[found] = startAtRow;\n (*distances)[found] = dist;\n found = found + 1;\n }\n startAtCol = startAtCol + 1;\n if (startAtCol >= ${u}u) {\n startAtRow += 1;\n startAtCol = startAtRow + 1;\n }\n }\n results.found[linearIndex] = found;\n // update the startAtCols and startAtRows\n computeInfo.startAtCols[linearIndex] = startAtCol;\n computeInfo.startAtRows[linearIndex] = startAtRow;\n\n }\n\n // this will generate the distance script for each distance metric and then combine them into one\n ${ne(n,h.map((e=>e.maxEntryLen)),l,i)}\n\n\n `}),T=o.createComputePipeline({label:"sparse matrix compute pipeline",layout:"auto",compute:{module:x,entryPoint:"calcSparseMatrix"}}),I=new Uint32Array(g),L=new Uint32Array(g),N=new Uint32Array(g),$=new Uint32Array(g),P=Math.floor(A/g);let O=0,R=1;console.time("GPUthreadStarts");for(let e=0;e<g;e++){const t=9999===e?A-1:(e+1)*P,n=u-2-Math.floor(Math.sqrt(-8*t+4*u*(u-1)-7)/2-.5),i=t-u*n+Math.floor((n+1)*(n+2)/2);I[e]=R,L[e]=O,N[e]=i,$[e]=n,O=n,R=i}console.timeEnd("GPUthreadStarts");const k=4e4+u*c+c+h.reduce(((e,t)=>e+t.sourceArraySize),0),G=h.reduce(((e,t)=>e+t.suppInfoSize),0),D=1e6,F=k*Uint32Array.BYTES_PER_ELEMENT;let H=F;const B=15&F;0!==B&&(H+=16-B);const V=o.createBuffer({label:"compute info buffer",size:H,usage:GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST,mappedAtCreation:!0}),j=V.getMappedRange();let U=0;new Uint32Array(j,U,g).set(I),U+=g*Uint32Array.BYTES_PER_ELEMENT,new Uint32Array(j,U,g).set(L),U+=g*Uint32Array.BYTES_PER_ELEMENT,new Uint32Array(j,U,g).set(N),U+=g*Uint32Array.BYTES_PER_ELEMENT,new Uint32Array(j,U,g).set($),U+=g*Uint32Array.BYTES_PER_ELEMENT,new Uint32Array(j,U,f.length).set(f),U+=f.length*Uint32Array.BYTES_PER_ELEMENT,new Float32Array(j,U,c).set(r),U+=c*Float32Array.BYTES_PER_ELEMENT;for(const e of h){const t=e.EncodedArrayConstructor,n=e.sourceArraySize;new t(j,U,n).set(e.flatSourceArray),U+=n*t.BYTES_PER_ELEMENT}V.unmap();const Y=G*Uint32Array.BYTES_PER_ELEMENT;let z=Y;const q=15&Y;0!==q&&(z+=16-q),z=Math.max(z,16);const K=o.createBuffer({label:"supp info buffer",size:z,usage:GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST,mappedAtCreation:!0}),X=K.getMappedRange();let J=0;for(const e of h)e.suppInfoBuffer&&e.suppInfoBuffer.byteLength>0&&e.suppInfoSize>0&&(new("UINT32ARRAY"===e.suppInfoType?Uint32Array:Float32Array)(X,J,e.suppInfoBuffer.length).set(e.suppInfoBuffer),J+=e.suppInfoBuffer.byteLength);0===J&&new Uint32Array(X,0,4).set([1,1,1,1]),K.unmap();const te=302e4*Uint32Array.BYTES_PER_ELEMENT;let ie=te;const re=15&te;0!==re&&(ie+=16-re);const se=o.createBuffer({label:"results buffer",size:ie,usage:GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_SRC}),oe=o.createBindGroup({label:"bindGroup for sparse matrix buffer",layout:T.getBindGroupLayout(0),entries:[{binding:0,resource:{buffer:V}},{binding:1,resource:{buffer:K}},{binding:2,resource:{buffer:se}}]}),ae=o.createBuffer({label:"results out buffer",size:se.size,usage:GPUBufferUsage.MAP_READ|GPUBufferUsage.COPY_DST}),le=[],ce=[],ue=[];let he=!1;for(;!he;){const e=o.createCommandEncoder({label:"distance encoder"}),t=e.beginComputePass({label:"distance compute pass"});t.setPipeline(T),t.setBindGroup(0,oe),t.dispatchWorkgroups(w,w),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 i=ae.getMappedRange();let r=0;const s=new Uint32Array(i,r,D);r+=D*Uint32Array.BYTES_PER_ELEMENT;const a=new Uint32Array(i,r,D);r+=D*Uint32Array.BYTES_PER_ELEMENT;const l=new Float32Array(i,r,D);r+=D*Float32Array.BYTES_PER_ELEMENT;const c=new Uint32Array(i,r,g);r+=g*Uint32Array.BYTES_PER_ELEMENT,he=new Uint32Array(i,r,g).every((e=>1===e));const u=c.reduce(((e,t)=>e+t),0),h=new Uint32Array(u),d=new Uint32Array(u),p=new Float32Array(u);let m=0;for(let e=0;e<c.length;e++){const t=c[e];0!==t&&(h.set(s.subarray(e*y,e*y+t),m),d.set(a.subarray(e*y,e*y+t),m),p.set(l.subarray(e*y,e*y+t),m),m+=t)}le.push(h),ce.push(d),ue.push(p),ae.unmap()}const de=le.reduce(((e,t)=>e+t.length),0),pe=new Uint32Array(de),me=new Uint32Array(de),fe=new Float32Array(de);let ge=0;for(let e=0;e<le.length;e++)pe.set(le[e],ge),me.set(ce[e],ge),fe.set(ue[e],ge),ge+=le[e].length;return V.destroy(),K.destroy(),se.destroy(),ae.destroy(),{i:pe,j:me,distance:fe}}))}([x.entries],w,[u],W.MANHATTAN,[1],[x.options??{}])}catch(e){console.error(e)}I||(d.useWebGPU&&console.error("WebGPU sparse matrix calculation failed, falling back to CPU implementation"),I=await(new F).calc(x.entries,u,w,x.options));const L=await async function(e,t){const n=e.distance.map(((n,i)=>{const r=Math.abs(t.get(e.i[i])-t.get(e.j[i]));return 0!=n?r/n:1/0})),i=e.distance.map((e=>1-e)),r=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:i,saliVals:n,n1:r,n2:s,cliffsBitSet:o}}(I,l),$=function(e,t,n,i,r,s,o){const l=new Array(e).fill(0);for(let e=0;e!=i.length;++e)n[e]!=1/0&&(o.get(i[e])>o.get(r[e])?l[i[e]]+=n[e]:l[r[e]]+=n[e]);return a.Column.fromList("double",t,l)}(t.length,`sali_${i[0].substring(i[0].lastIndexOf("_"))}`,L.saliVals,L.n1,L.n2,0,l);e.columns.add($);const P=L.cliffsBitSet,R=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}}(L.saliVals),k=.8/(R.max-R.min),G=s.shell.getTableView(e.name),D=G.addViewer(a.VIEWER.SCATTER_PLOT,{xColumnName:i[0],yColumnName:i[1],size:$.name,color:l.name,showXSelector:!1,showYSelector:!1,showSizeSelector:!1,showColorSelector:!1,markerMinSize:5,markerMaxSize:25,title:r}),B=function(e,t,n,i,r,s,o,l){const c={from:new Uint32Array(t.n1.length),to:new Uint32Array(t.n1.length),opacities:new Float32Array(t.n1.length),colors:new Array(t.n1.length),widths:new Float32Array(t.n1.length)};for(let n=0;n<t.n1.length;n++)c.from[n]=t.n1[n],c.to[n]=t.n2[n],c.opacities[n]=t.saliVals[n]===1/0?1:.2+(t.saliVals[n]-o.min)*l,c.colors[n]=e.selection.get(c.from[n])&&e.selection.get(c.to[n])?"255,255,0":"0,128,0",c.widths[n]=1;const u=a.DataFrame.create(c.from.length);return ue.forEach(((e,t)=>{u.columns.addNewString(e).init((e=>n.get(0===t?c.from[e]:c.to[e]))),function(e,t){Object.keys(t).forEach((n=>{e.tags[n]=t[n]}))}(u.col(e),s),u.col(e).semType=r})),u.columns.addNewFloat(oe).init((e=>Math.abs(i.get(c.from[e])-i.get(c.to[e])))),u.columns.addNewInt(ce).init((e=>e)),u.columns.addNewFloat(ae).init((e=>t.saliVals[e])),u.columns.addNewFloat(le).init((e=>t.simVals[e])),u.name=`${re}${ie}`,{lines:c,linesDf:u}}(e,L,t,l,p,m,R,k);B.lines.skipMultiLineCalculation=!0,B.linesDf.col(ae).setTag("description","Structure−Activity Landscape Index (activity difference divided by 1 minus similarity)");const V=new j(D,i[0],i[1],B.lines,H.none),U=b?b(B.linesDf,ue).sort([ae],[!1]):B.linesDf.plot.grid().sort([ae],[!1]);U.col(ce)&&(U.col(ce).visible=!1),e.temp[".cliffsDfGrid"]=U;const Y=o.button(`${B.linesDf.rowCount} cliffs`,(()=>{G.dockManager.dock(U,"down",null,"Activity cliffs",v??.2)}));Y.classList.add("scatter_plot_link","cliffs_grid"),D.root.append(Y);const z=o.input.toggle("Show only cliffs",{value:!1,onValueChanged:()=>{z.value?(D.dataFrame.setTag(he,i[0]),e.filter.and(P),se.next(i[0])):(D.dataFrame.setTag(he,""),e.filter.setAll(!0),se.next(""))}});z.root.classList.add("scatter_plot_link","show_only_cliffs"),D.root.append(z.root),se.subscribe((e=>{z.enabled=""===e||e===i[0]}));let K=!1;D.onEvent("d4-before-draw-scene").subscribe((t=>{K?K=!1:z.value&&(setTimeout((()=>{e.filter.and(P)}),100),K=!0)}));const X=s.events.onViewerClosed.subscribe((e=>{e.args.viewer===D&&(G.dockManager.close(U.root),X.unsubscribe(),G.subs=G.subs.filter((e=>e!==X)))}));return G.subs.push(X),B.linesDf.onCurrentCellChanged.subscribe((()=>{for(let e=0;e<B.linesDf.rowCount;e++)B.lines.widths[e]=e===B.linesDf.currentRowIdx?3:1;V.linesToRender=B.lines;const n=B.linesDf.currentCol&&B.linesDf.currentCol.name===ue[1]?B.lines.to:B.lines.from,r=-1!==B.linesDf.currentRowIdx?B.linesDf.currentRowIdx:null;if(D.dataFrame.currentRowIdx=r?n[r]:-1,null!==r){const n=B.linesDf.currentRowIdx;V.currentLineId=n;const{zoomLeft:a,zoomRight:c,zoomTop:u,zoomBottom:h}=function(e,t,n,i,r,s){const o=Math.abs(n-r),a=Math.abs(i-s),l=e/o,c=t/a,u=Math.min(l,c),h=e/u*5,d=t/u*5,p=(n<r?n:r)+o/2-h/2,m=(i>s?i:s)-a/2+d/2;return{zoomLeft:p,zoomRight:p+h,zoomTop:m,zoomBottom:m-d}}(D.viewport.width,D.viewport.height,D.dataFrame.get(i[0],B.lines.from[n]),D.dataFrame.get(i[1],B.lines.from[n]),D.dataFrame.get(i[0],B.lines.to[n]),D.dataFrame.get(i[1],B.lines.to[n]));D.zoom(a,u,c,h),z.value?e.filter.and(P):!0===z.enabled&&e.filter.setAll(!0),setTimeout((()=>{!function(e,t,n,i,r,a,l,c,u){const h=t.getPane("Cliff Details");o.empty(h.root);const d=u({points:[n,i],lineId:r,df:e,seqCol:a,activityCol:l,sali:c});h.root.append(d),setTimeout((()=>{s.shell.o=t.root}),500)}(e,C,B.lines.from[r],B.lines.to[r],r,t,l,B.linesDf.get(ae,r),y);const n=D.dataFrame.getSortedOrder(G.grid.sortByColumns,G.grid.sortTypes);G.grid.scrollToCell(t.name,n.indexOf(D.dataFrame.currentRowIdx))}),1e3)}})),B.linesDf.onSelectionChanged.subscribe((t=>{setTimeout((()=>(()=>{const t=a.BitSet.create(e.rowCount);for(let e=0;e<B.linesDf.rowCount;e++){const n=B.linesDf.selection.get(e);n&&(t.set(B.lines.from[e],!0),t.set(B.lines.to[e],!0)),B.lines.colors[e]=n?"255,255,0":"0,128,0"}e.selection.copyFrom(t),V.linesToRender=B.lines})()),100)})),e.onSelectionChanged.subscribe((t=>{!1===e.selection.anyTrue&&"number"==typeof t&&(A?A=!1:(e=>{e.selection.setAll(!1);for(let e=0;e<B.lines.colors.length;e++)B.lines.colors[e]="0,128,0";V.linesToRender=B.lines})(U.dataFrame))})),V.lineClicked.subscribe((t=>{if(A=!0,V.currentLineId=t.id,-1!==t.id){const n=B.linesDf.selection.clone();setTimeout((()=>{t.event.ctrlKey?(n.set(t.id,!n.get(t.id)),B.linesDf.selection.copyFrom(n)):(B.linesDf.currentRowIdx!==t.id&&(B.linesDf.currentRowIdx=t.id,e.currentRowIdx=B.lines.from[t.id]),B.linesDf.selection.copyFrom(n));const i=B.linesDf.getSortedOrder(U.sortByColumns,U.sortTypes);U.scrollToCell(ue[0],i.indexOf(t.id))}),500)}})),V.lineHover.pipe((0,O.debounceTime)(500)).subscribe((n=>{-1!==n.id&&-1===e.mouseOverRowIdx&&o.tooltip.show(g({lineId:n.id,points:[B.lines.from[n.id],B.lines.to[n.id]],df:e,seqCol:t,activityCol:l}),n.x,n.y)})),D.addProperty("similarityLimit","double",w),C=function(){const e=o.accordion(),t=o.element("i");return t.className="grok-icon svg-icon svg-view-layout",e.addTitle(o.span([t,o.label("Activity cliffs")])),e.addPane("Cliff Details",(()=>o.divText("Cliff has not been selected")),!0),s.shell.o=e.root,e}(),D}var pe,me=n(2003),fe=n(826),ge=n(3516),ye=n(6718),be=n(2738),ve=n(3077);!function(e){e.IDENTITY="identity",e.SIMILARITY="similarity"}(pe||(pe={}));var we=n(9192),Ce=n(4870),Ae=n(1991),Se=n.n(Ae),xe=n(9322);const Ee="#808080",_e="rgb(0,0,0)",Me=xe.zS;var Te,Ie;!function(e){e.maxMonomerLength=".mm.cellRenderer.maxMonomerLength"}(Te||(Te={})),function(e){e.MSA="MSA",e.classic="classic"}(Ie||(Ie={}));const Le=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=Ie.classic,this.maxWord=[],this.wordIdx=0,this.gridCell=null,this.referenceSequence=null,this.maxLengthOfMonomer=null,this.monomerTextSizeMap={},this.logger=void 0}};function Ne(e,t,n,i,r,s,o){var a,l,c;const u=Object.assign(Object.assign({},Le),o);o.logger?.debug("Bio: printLeftOrCentered(), start"),e.textAlign="start";let h=t.substring(0),d=u.last?"":u.separator;u.drawStyle===Ie.MSA&&(d="");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=h==e?.3:u.transparencyRate),m&&u.referenceSequence.length>0&&"equal"===f&&(u.transparencyRate=h!=e?.3:u.transparencyRate)}null!=u.maxLengthOfMonomer&&(h=Me(h,u.maxLengthOfMonomer));const g=h+d;(a=u.monomerTextSizeMap)[g]??(a[g]=e.measureText(g));let y=u.monomerTextSizeMap[g];(l=u.monomerTextSizeMap)[h]??(l[h]=e.measureText(h));let b=u.monomerTextSizeMap[h].width;const v=s/2-(y.fontBoundingBoxAscent+y.fontBoundingBoxDescent)/2+1;(c=u.monomerTextSizeMap)[d]??(c[d]=e.measureText(d));const w=u.monomerTextSizeMap[d].width;function C(t,r){const s=p?u.color:_e;e.fillStyle=s,e.globalAlpha=u.transparencyRate,u.drawStyle===Ie.classic&&(e.fillText(h,n+t,i+v),e.fillStyle=Ee,e.fillText(d,n+r,i+v)),u.drawStyle===Ie.MSA&&e.fillText(h,n+t,i+v)}y=y.width,u.drawStyle===Ie.MSA&&(b=u.maxWord[u.wordIdx],y=u.maxWord[u.wordIdx]);const A=(u.maxWord[u.wordIdx]??0)-(u.maxWord[0]??0);if(u.left||y>r)return C(A,A+b),n+A+b+w;{const e=(r-y)/2;return C(e,e+b),n+A+e+b}}var $e=n(6882),Pe=n(4152);const Oe={[me.YI.DNA]:"RNA",[me.YI.RNA]:"RNA",[me.YI.PT]:"PEPTIDE",[me.YI.UN]:"PEPTIDE"};var Re=n(6642);const ke={true:"1",false:"0"};var Ge=n(4139);const De="rgb(100,100,100)",Fe=me.zS;function He(e,t,n,i,r){return e?Math.max(Math.min(e.canvas.width/r-n,i)):Math.max(t.canvas.width/r-n,0)}function Be(e){const t=!Se().enumerate(e).some((([t,n])=>t.length>1&&0!=n&&n!=e.length-1)),n=[],i=t?"":" ";for(const[t,r]of Se().enumerate(e)){let s=t;r<e.length&&(s+=`${t?"":"-"}${i}`),n.push(s)}return[n,t]}class Ve extends a.GridCellRenderer{padding=5;get name(){return"sequence"}get cellType(){return"sequence"}get defaultHeight(){return 30}get defaultWidth(){return 230}onClick(e,t){e.cell.column.temp["current-word"]=e.cell.value,e.grid.invalidate()}onMouseMove(e,t){const[n,i,r]=(0,Re.h)(e),s=r.rendererBack;if(!s)return;const a=e.bounds,l=t.offsetX-e.gridColumn.left+(e.gridColumn.left-a.x),c=s.getPosition(e.tableRowIndex,l,a.width),u=fe.GO.forColumn(i).getSplitted(e.tableRowIndex).canonicals;if(null!==c&&c<u.length){const e=u[c],n=[];let r=s._monomerStructureMap[e];r=s._monomerStructureMap[e]=(()=>{const t=fe.GO.forColumn(i).alphabet??me.YI.UN,n=Oe[t],r=yi();return r?r.getTooltip(n,e):o.divText("Monomer library is not available")})(),n.push(r),o.tooltip.show(o.divV(n),t.x+16,t.y+16)}else o.tooltip.hide()}render(e,t,n,i,r,s,o){const a=window.devicePixelRatio,[l,c,u]=(0,Re.h)(s);if(!c)return;const h=c.temp;let d=0,p=(ci.properties?ci.properties.maxMonomerLength:4)??50;if(Te.maxMonomerLength in c.tags){const e=parseInt(c.getTag(Te.maxMonomerLength));p=!isNaN(e)&&e?e:50}if(".mm.cellRenderer.maxMonomerLength"in h){const e=h[".mm.cellRenderer.maxMonomerLength"];p=!isNaN(e)&&e?e:50}const[m,f,g]=(0,Re.h)(s);let y=g.rendererBack;y||(y=g.rendererBack=new $e.J(l,c,ci.logger,p,(()=>{const e=fe.GO.forColumn(c);return{seqHandler:e,monomerCharWidth:7,separatorWidth:e.isMsa()?8:d,monomerToShort:Fe}}))),e.save();try{c.temp[".mm.cellRenderer.settingsChanged"]!==ke.true&&y.monomerLengthLimit==p||(d=h[".mm.cellRenderer.gapLength"]??d,y.setMonomerLengthLimit(p),y.setSeparatorWidth(y.isMsa()?8:d),c.temp[".mm.cellRenderer.settingsChanged"]=ke.false);const[o,u]=y.getCellMonomerLengths(s.tableRowIndex,i),m=(o.length,s.cell.value,s.cell.rowIndex),f=c.getTag(me.gp.alphabet),g=50;i=He(l?.grid,e,t,i,a),e.beginPath(),e.rect(t+this.padding,n+this.padding,i-this.padding-1,r-2*this.padding),e.clip(),e.font="12px monospace",e.textBaseline="top";const b=c.meta.units,v=c.getTag(me.gp.aligned),w=(0,me.ny)(f),C=c.getTag(me.gp.separator)??"",A=y.props.separatorWidth+1*y.props.monomerCharWidth,S=Math.ceil(i/A),x=fe.GO.forColumn(c),E=h["reference-sequence"],_=h["current-word"];_&&-1===c?.dataFrame?.currentRowIdx&&(h["current-word"]=null);const M=(()=>{const e=x.getSplitter(S);return Se()(e(null!=E&&""!=E?E:_??"").originals).toArray()})(),T=x.getSplitted(m);let I=De,L=Ie.classic;v&&v.includes("MSA")&&b==me.Hi.SEPARATOR&&(L=Ie.MSA);const N=Math.min(T.length,S);for(let o=0;o<N;++o){const a=T.getOriginal(o);I=w.get(a),e.fillStyle=De;const l={color:I,pivot:0,left:!0,transparencyRate:1,separator:C,last:o===T.length-1,drawStyle:L,maxWord:u,wordIdx:o,gridCell:s,referenceSequence:M,maxLengthOfMonomer:p,monomerTextSizeMap:y._monomerLengthMap,logger:ci.logger};if(Ne(e,a,t+this.padding,n,i,r,l),g>i)break}}catch(e){const[t,n]=(0,we.AP)(e);y.logger.error(t,void 0,n),y.errors.push(e)}finally{e.restore()}}}class je extends a.GridCellRenderer{get name(){return"MacromoleculeDifferenceCR"}get cellType(){return Ge.uF.MACROMOLECULE_DIFFERENCE}get defaultHeight(){return 30}get defaultWidth(){return 230}render(e,t,n,i,r,s,o){const a=window.devicePixelRatio,l=s.grid,c=s.cell,u=s.tableColumn,h=c.value??"",d=u.tags[me.gp.separator],p=u.meta.units;i=He(l,e,t,i,a);const[m,f]=h.split("#"),g=(0,xe.Iv)(p,d);Ue(e,t,n,i,r,Se()(g(m).canonicals).toArray(),Se()(g(f).canonicals).toArray(),p)}}function Ue(e,t,n,i,r,s,o,a,l,c){if(s.length!==o.length){const e=function(e,t){let n=0,i=0;const r=e.length>t.length?e:t,s=e.length>t.length?t:e;for(let e=0;e<s.length;e++)r[e]===s[e]&&n++;const o=r.length-s.length;for(let e=r.length-1;e>o;e--)r[e]===s[e-o]&&i++;const a=new Array(Math.abs(e.length-t.length)).fill(fe.b9[me.Hi.FASTA]);function l(e){return n>i?e.concat(a):a.concat(e)}return e.length>t.length?t=l(Se()(t).toArray()):e=l(Se()(e).toArray()),{subParts1:e,subParts2:t}}(s,o);s=e.subParts1,o=e.subParts2}const u=e.measureText(Be(s).join("")),h=e.measureText(Be(o).join("")),d=Math.max(u.width,h.width);l&&(i=d+4*s.length,e.canvas.width=d+4*s.length);let p=Math.max(t,t+(i-(d+4*s.length))/2)+5;const m=Math.max(n,n+(r-28)/2);e.save(),e.beginPath(),e.rect(t,n,l?d+4*s.length:i,r),e.clip(),e.font="12px monospace",e.textBaseline="top";let f=Pe.oT.Color;"HELM"!==a&&(f=(0,me.ny)(a.substring(a.length-2)));for(let t=0;t<s.length;t++){const n=s[t],a=o[t],l=f.get(n);if(n!=a){const s=f.get(a),o=Ne(e,n,p,m-7,i,r,{color:l,pivot:0,left:!0}),u=Ne(e,a,p,m+7,i,r,{color:s,pivot:0,left:!0});p=Math.max(u,o),c&&(c[t]=We(n,a,l,s,m,7,r))}else p=Ne(e,n,p,m,i,r,{color:l,pivot:0,left:!0,transparencyRate:.5});p+=4}e.restore()}function We(e,t,n,i,r,s,o){const a=document.createElement("canvas"),l=a.getContext("2d");l.font="12px monospace";const c=l.measureText(Be([e]).join("")).width,u=l.measureText(Be([t]).join("")).width,h=Math.max(c,u);return a.height=o,a.width=h+4,l.font="12px monospace",l.textBaseline="top",Ne(l,e,0,r-s,h,o,{color:n,pivot:0,left:!0}),Ne(l,t,0,r+s,h,o,{color:i,pivot:0,left:!0}),a}var Ye,ze=n(8070),qe=n(4326);!function(e){e.Unknown="unknown",e.FR="framework",e.CDR="cdr"}(Ye||(Ye={}));const Ke=new class{constructor(){this.regionTypes=[Ye.CDR],this.chains=["Heavy","Light"],this.skipEmptyPositions=!1,this.fitWidth=!1,this.positionWidth=16,this.positionHeight=qe.fH.Entropy,this.filterSource=qe.Fo.filterSource}};var Ze=n(7602),Xe=n(8047);const Je=Ye;var Qe,et;!function(e){e.STYLE="Style",e.BEHAVIOR="Behavior",e.LAYOUT="Layout",e.DATA="Data"}(Qe||(Qe={})),function(e){e.skipEmptyPositions="skipEmptyPositions",e.regionTypes="regionTypes",e.chains="chains",e.fitWidth="fitWidth",e.positionWidth="positionWidth",e.positionHeight="positionHeight",e.filterSource="filterSource"}(et||(et={}));const tt=Ke;class nt extends a.JsViewer{viewed=!1;regionsFg=null;regionsRoot=null;isOpened=!1;panelNode=null;regions=[];regionTypes;chains;skipEmptyPositions;fitWidth;positionWidth;positionHeight;filterSource;constructor(){super(),this.skipEmptyPositions=this.bool(et.skipEmptyPositions,tt.skipEmptyPositions,{category:Qe.DATA}),this.regionTypes=this.stringList(et.regionTypes,tt.regionTypes,{category:Qe.DATA,choices:Object.values(Je).filter((e=>e!=Je.Unknown))}),this.chains=this.stringList(et.chains,tt.chains,{category:Qe.DATA,choices:["Heavy","Light"]}),this.fitWidth=this.bool(et.fitWidth,tt.fitWidth,{category:Qe.LAYOUT}),this.positionWidth=this.float(et.positionWidth,tt.positionWidth,{category:Qe.LAYOUT,editor:"slider",min:0,max:64,description:"Internal WebLogo viewers property width of position."}),this.positionHeight=this.string(et.positionHeight,tt.positionHeight,{category:Qe.LAYOUT,choices:Object.keys(qe.fH)}),this.filterSource=this.string(et.filterSource,tt.filterSource,{category:Qe.BEHAVIOR,choices:Object.values(qe.lT)}),this.viewSyncer=new Ze.g(ci.logger)}static viewerCounter=-1;viewerId=++nt.viewerCounter;viewerToLog(){return`VdRegionsViewer<${this.viewerId}>`}async init(){this.subs.push((0,u.fromEvent)(this.root,"mousemove").subscribe(this.rootOnMouseMove.bind(this)))}detach(){const e=`${this.viewerToLog()}.detach()`,t=super.detach.bind(this);this.viewSyncer.sync(`${e}`,(async()=>{this.setDataInProgress||(this.viewed&&(await this.destroyView("detach"),this.viewed=!1),t())}))}onTableAttached(){super.onTableAttached(),this.setData(this.regions)}onPropertyChanged(e){if(super.onPropertyChanged(e),e){switch(e.name){case et.regionTypes:case et.chains:this.setData(this.regions)}switch(e.name){case et.skipEmptyPositions:for(let e=0;e<this.logos.length;++e)for(const t of this.chains)this.logos[e][t].setOptions({[Xe.n5.skipEmptyPositions]:this.skipEmptyPositions});this.calcSize();break;case et.fitWidth:case et.positionWidth:this.calcSize();break;case et.positionHeight:for(let e=0;e<this.logos.length;++e)for(const t of this.chains)this.logos[e][t].setOptions({[Xe.n5.positionHeight]:this.positionHeight});this.calcSize();break;case et.filterSource:this.filterSourceInput.value=this.filterSource;break;default:this.setData(this.regions)}}else console.warn("Bio: VdRegionsViewer.onPropertyChanged() property is null")}setData(e){const t=`${this.viewerToLog()}.setData()`;ci.logger.debug(`${t}, in, regions.length = ${e.length}`),this.viewSyncer.sync(`${t}`,(async()=>{if(!this.setDataInProgress){this.setDataInProgress=!0;try{this.viewed&&(await this.destroyView("setData"),this.viewed=!1),this.regions=e,this.viewed||(await this.buildView("setData"),this.viewed=!0)}finally{this.setDataInProgress=!1}}}))}viewSyncer;setDataInProgress=!1;host=null;filterSourceInput;mainLayout=null;logos=[];viewSubs=[];async destroyView(e){ci.logger.debug(`Bio: VdRegionsViewer.destroyView( mainLayout = ${this.mainLayout?"value":"none"} ), purpose = '${e}', this.regions.length = ${this.regions.length}`),this.filterSourceInput&&o.empty(this.filterSourceInput.root),null!=this.mainLayout&&(this.mainLayout.remove(),this.host.remove(),this.host=null,this.mainLayout=null);for(const e of this.viewSubs)e.unsubscribe()}async buildView(e){ci.logger.debug(`Bio: VdRegionsViewer.buildView() begin, purpose = '${e}', this.regions.length = ${this.regions.length}`);const t=this.regions.filter((e=>this.regionTypes.includes(e.type))),n=Array.from(new Set(t.map((e=>e.order)))).sort(),i=[];for(let e=0;e<n.length;e++)for(const r of this.chains){const s=t.find((t=>t.order==n[e]&&t.chain==r));i.push((async()=>{const t=await this.dataFrame.plot.fromType("WebLogo",{sequenceColumnName:s.sequenceColumnName,startPositionName:s.positionStartName,endPositionName:s.positionEndName,fixWidth:!0,skipEmptyPositions:this.skipEmptyPositions,positionWidth:this.positionWidth,positionHeight:this.positionHeight,filterSource:this.filterSource});return t.onSizeChanged.subscribe((()=>{this.calcSize()})),[e,r,t]})())}const r=await Promise.all(i);this.logos=new Array(n.length);for(let e=0;e<n.length;++e)this.logos[e]={};for(const[e,t,n]of r)this.logos[e][t]=n,this.viewSubs.push(n.onFreqsCalculated.subscribe((()=>{this.calcSize()})));this.mainLayout=o.table(this.chains,(e=>[...n.length>0?[o.div(e,{style:{transform:"rotate(-90deg)",font:"12px Roboto, Roboto Local, sans-serif",textAlign:"center",width:"16px",marginTop:"24px",marginLeft:"6px"}})]:[],...[...Array(n.length).keys()].map((t=>{const n=this.logos[t][e];return n.root.style.height="100%",o.div([n.root],{style:{marginTop:"4px",marginBottom:"4px"}})}))]),["",...[...Array(n.length).keys()].map((e=>t.find((t=>t.order==n[e]&&t.chain==this.chains[0])).name||"Name"))]),this.mainLayout.className="mlb-vd-regions-viewer-table2",this.filterSourceInput=o.input.choice("Data source",{value:this.filterSource,items:Object.values(qe.lT),onValueChanged:this.filterSourceInputOnValueChanged.bind(this)}),this.filterSourceInput.root.style.position="absolute",this.filterSourceInput.root.style.right="9px",this.filterSourceInput.root.style.top="-4px",Math.ceil(255*Math.random()).toString(16),this.host=o.div([this.mainLayout,this.filterSourceInput.root],{}),this.root.appendChild(this.host),this.root.style.overflowX="auto",this.calcSize(),this.viewSubs.push(o.onSizeChanged(this.root).subscribe(this.rootOnSizeChanged.bind(this))),ci.logger.debug("Bio: VdRegionsViewer.buildView() end")}calcSizeRequested=!1;calcSize(){ci.logger.debug("Bio: VdRegionsViewer.calcSize(), start");const e=()=>{if(!this.host)return;const e=(this.root.clientHeight-54)/this.chains.length;let t=0;for(let n=0;n<this.logos.length;n++){for(const t of this.chains)this.logos[n][t].root.style.height=`${e}px`;t+=Math.max(...this.chains.map((e=>this.logos[n][e].Length)))}if(this.fitWidth){if(this.logos.length>0&&t>0){const e=22,n=13,i=9,r=(this.root.clientWidth-e-(this.logos.length-1)*i-n)/t;for(let e=0;e<this.logos.length;e++)for(const t of this.chains){const n=this.logos[e][t];n.setOptions({[Xe.n5.positionWidth]:r-n.positionMarginValue}),n.root.style.width=r*n.Length+"px"}}this.host.style.setProperty("overflow","hidden","important")}else{for(let e=0;e<this.logos.length;e++)for(const t of this.chains)this.logos[e][t].setOptions({[Xe.n5.positionWidth]:this.positionWidth});this.host.style.removeProperty("overflow")}0===this.positionWidth?this.host.style.setProperty("overflow-x","hidden","important"):this.host.style.removeProperty("overflow-x")};this.calcSizeRequested||(this.calcSizeRequested=!0,window.setTimeout((()=>{e(),this.calcSizeRequested=!1}),0))}rootOnSizeChanged(e){this.calcSize()}rootOnMouseMove(e){}filterSourceInputOnValueChanged(){const e=`${this.viewerToLog()}.filterSourceInputOnValueChanged()`,t=this.filterSourceInput.value;this.viewSyncer.sync(`${e}`,(async()=>{if(this.filterSource!==t){this.props.getProperty(et.filterSource).set(this,t);for(let e=0;e<this.logos.length;e++)for(let t=0;t<this.chains.length;t++){const n=this.chains[t];this.logos[e][n].setOptions({[Xe.n5.filterSource]:this.filterSource})}}}))}_onRendered=new u.Subject;get onRendered(){return this._onRendered}invalidate(e){const t=`${this.viewerToLog()}.invalidate(${e?` <- ${e} `:""})`;this.viewSyncer.sync(`${t}`,(async()=>{this._onRendered.next()}))}async awaitRendered(e=5e3){await(0,ze.PE)(this.onRendered,(()=>{}),(()=>{this.invalidate()}),e);const t=this.viewSyncer.resetErrors();if(t.length>0)throw t[0]}}var it=n(6625),rt=n(6863);async function st(e,t,n="Morgan"){const i=e.length,r=fe.GO.forColumn(e),s=Array(i);let o=1;const a=new Map,l=e.categories,c=e.getRawData();for(let t=0;t<i;t++){if(null===l[c[t]]||e.isNone(t)){s[t]=null;continue}s[t]="";const n=r.getSplitted(t);for(let e=0;e<n.length;e++){const i=n.getCanonical(e);a.has(i)||(a.set(i,String.fromCharCode(o)),o++),s[t]+=a.get(i)}}let u={};if(t===rt.Z.MONOMER_CHEMICAL_DISTANCE||t===rt.Z.NEEDLEMANN_WUNSCH){const e=Array.from(a.keys()),t=await(0,ye.A7)(e,n),i={};Object.entries(t.alphabetIndexes).forEach((([e,t])=>{i[a.get(e)]=t})),u={scoringMatrix:t.scoringMatrix,alphabetIndexes:i}}return{seqList:s,options:u}}var ot=n(2780),at=n(8115);function lt(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 i=o.divText(e.activityCol.get(n).toFixed(2));i.style.display="flex",i.style.justifyContent="left",i.style.paddingLeft="30px",t.append(o.divV([o.divText(e.seqCol.get(n)),i]))})),t}function ct(e){const t=o.div();t.append(o.divText(e.seqCol.name,{style:{fontWeight:"bold"}}));const n=new Array(2);e.points.forEach(((t,i)=>{n[i]=e.activityCol.get(t)}));const i={},r=fe.GO.forColumn(e.seqCol),s=ht(r.getSplitted(e.points[0]),r.getSplitted(e.points[1]),r.units,i);return t.append(o.div(s,{style:{width:"300px",overflow:"scroll"}})),t.append(dt(i)),t.append(ut("Activity delta",Math.abs(n[0]-n[1]))),t.append(ut("Cliff",e.sali)),t}function ut(e,t){return o.divH([o.divText(`${e}: `,{style:{fontWeight:"bold",paddingRight:"5px"}}),o.divText(t.toFixed(2))],{style:{paddingTop:"10px"}})}function ht(e,t,n,i){const r=document.createElement("canvas"),s=r.getContext("2d");return r.height=30,Ue(s,0,0,0,30,Se()(e.canonicals).toArray(),Se()(t.canonicals).toArray(),n,!0,i),r}function dt(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}function pt(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(me.gp.separator,e.col(t[0]).getTag(me.gp.separator)),e.columns.add(n);const i=e.plot.grid();return i.col(t[0]).visible=!1,i.col(t[1]).visible=!1,i}class mt extends a.JsViewer{name="";distanceMetric;limit;fingerprint;metricsProperties=["distanceMetric","fingerprint"];fingerprintChoices=["Morgan","Pattern"];moleculeColumn;moleculeColumnName;initialized=!1;tags=[a.TAGS.UNITS,me.gp.aligned,me.gp.separator,me.gp.alphabet];preComputeDistanceMatrix=!1;constructor(e){super(),this.fingerprint=this.string("fingerprint",this.fingerprintChoices[0],{choices:this.fingerprintChoices}),this.limit=this.int("limit",10),this.distanceMetric=this.string("distanceMetric",R.iS[0],{choices:R.iS}),this.moleculeColumnName=this.string("moleculeColumnName"),this.name=e}init(){this.initialized=!0}detach(){this.subs.forEach((e=>e.unsubscribe()))}async onTableAttached(){if(this.init(),this.dataFrame){this.preComputeDistanceMatrix=this.dataFrame.rowCount<=22e3,this.subs.push(a.debounce(this.dataFrame.onRowsRemoved,50).subscribe((e=>this.render(!0))));const e="diversity"!==this.name;this.subs.push(a.debounce(this.dataFrame.onCurrentRowChanged,50).subscribe((t=>this.render(e)))),this.subs.push(a.debounce(this.dataFrame.selection.onChanged,50).subscribe((e=>this.render(!1)))),this.subs.push(a.debounce(o.onSizeChanged(this.root),50).subscribe((e=>this.render(!1)))),this.moleculeColumn=this.dataFrame.columns.bySemType(a.SEMTYPE.MACROMOLECULE),this.moleculeColumnName=this.moleculeColumn?.name,this.getProperty("limit").fromOptions({min:1,max:this.dataFrame.rowCount})}this.render()}onPropertyChanged(e){if(super.onPropertyChanged(e),this.initialized){if("moleculeColumnName"===e.name){const t=this.dataFrame.col(e.get(this));t.semType===a.SEMTYPE.MACROMOLECULE&&(this.moleculeColumn=t)}this.render()}}computeRequested;renderPromise=Promise.resolve();render(e=!0){this.renderPromise=this.renderPromise.then((async()=>{this.computeRequested=this.computeRequested||e,await this.renderInt(e)}))}async renderInt(e){}beforeRender(){return!(!this.initialized||this.dataFrame&&this.moleculeColumnName&&this.dataFrame.col(this.moleculeColumnName).semType!==a.SEMTYPE.MACROMOLECULE&&(s.shell.error(`${this.moleculeColumnName} is not Macromolecule type`),1))}}var ft=n(1407),gt=n(439);const yt={gapPenalty:1,matchScore:1,gapSymbol:fe.b9[gt.Hi.FASTA],localAlignment:!1};class bt extends mt{cutoff;hotSearch;similarColumnLabel;sketchedMolecule="";curIdx=0;molCol=null;idxs=null;scores=null;gridSelect=!1;targetMoleculeIdx=0;computeCompleted=new u.Subject;distanceMatrixComputed=!1;mmDistanceMatrix;knn;kPrevNeighbors=0;constructor(){super("similarity"),this.cutoff=this.float("cutoff",.01,{min:0,max:1}),this.hotSearch=this.bool("hotSearch",!0),this.similarColumnLabel=this.string("similarColumnLabel",null)}init(){this.hotSearch=!0,this.initialized=!0}async renderInt(e){if(this.beforeRender()&&this.moleculeColumn&&(this.curIdx=-1==this.dataFrame.currentRowIdx?0:this.dataFrame.currentRowIdx,e&&!this.gridSelect)){this.targetMoleculeIdx=-1==this.dataFrame.currentRowIdx?0:this.dataFrame.currentRowIdx;const e=fe.GO.forColumn(this.moleculeColumn);await(e.isHelm()?this.computeByChem():this.computeByMM());const t=null!=this.similarColumnLabel?this.similarColumnLabel:`similar (${this.moleculeColumnName})`;this.molCol=a.Column.string(t,this.idxs.length).init((e=>this.moleculeColumn?.get(this.idxs?.get(e)))),this.molCol.semType=a.SEMTYPE.MACROMOLECULE,this.tags.forEach((e=>this.molCol.setTag(e,this.moleculeColumn.getTag(e))));const n=a.DataFrame.fromColumns([this.idxs,this.molCol,this.scores]);n.onCurrentRowChanged.subscribe((e=>{this.dataFrame.currentRowIdx=n.col("indexes").get(n.currentRowIdx),setTimeout((()=>{this.createPropertyPanel(n)}),1e3),this.gridSelect=!0}));const i=n.plot.grid();i.col("indexes").visible=!1;const r=this.idxs?.getRawData().findIndex((e=>e==this.targetMoleculeIdx));i.cell("score",r).cell.value=null,s.shell.v.grid.root.addEventListener("click",(e=>{this.gridSelect=!1})),(0,Ce.K)(this.root,i.root),this.computeCompleted.next(!0)}}async computeByChem(){const e=await(0,ft.R)(this.moleculeColumn),t=(a.DataFrame.fromColumns([e]),await s.functions.call("Chem:callChemSimilaritySearch",{df:this.dataFrame,col:e,molecule:e.get(this.targetMoleculeIdx),metricName:this.distanceMetric,limit:this.limit,minScore:this.cutoff,fingerprint:this.fingerprint}));this.idxs=t.getCol("indexes"),this.scores=t.getCol("score")}async computeByMM(){const e=this.moleculeColumn.length,t=Math.min(this.limit,e-1);if(!this.knn||this.kPrevNeighbors!==t){const n=(await st(this.moleculeColumn,rt.Z.LEVENSHTEIN)).seqList;this.kPrevNeighbors=t,this.knn=await(new F).getKNN(n,rt.Z.LEVENSHTEIN,Math.min(this.limit,e-1))}const n=new Array(t).fill(0).map(((e,t)=>({idx:this.knn.knnIndexes[this.targetMoleculeIdx][t],score:1-this.knn.knnDistances[this.targetMoleculeIdx][t]})));n.sort(((e,t)=>t.score-e.score)),n.unshift({idx:this.targetMoleculeIdx,score:a.FLOAT_NULL}),this.idxs=a.Column.int("indexes",t+1).init((e=>n[e].idx)),this.scores=a.Column.float("score",t+1).init((e=>n[e].score))}createPropertyPanel(e){const t=o.div(),n={},i=this.molCol?.name,r=e.col(i),a=fe.GO.forColumn(this.moleculeColumn),l=fe.GO.forColumn(r),c=a.getSplitted(this.targetMoleculeIdx),u=l.getSplitted(e.currentRowIdx),h=function(e,t,n={}){const i={...yt,...n},r=e.length,s=t.length,o=Array(r+1).fill(0).map((()=>Array(s+1).fill(0)));let a=-9999,l=[1,1];for(let n=1;n<r+1;n++)for(let r=1;r<s+1;r++)o[n][r]=Math.max(0,o[n-1][r-1]+(e.getCanonical(n-1)===t.getCanonical(r-1)?i.matchScore:-i.matchScore),o[n-1][r]-i.gapPenalty,o[n][r-1]-i.gapPenalty),o[n][r]>=a&&(a=o[n][r],l=[n,r]);let c=i.localAlignment?l[0]:r,u=i.localAlignment?l[1]:s,h=new Array(0),d=new Array(0);for(;c>0&&u>0;){const n=Math.max(o[c-1][u-1],o[c-1][u],o[c][u-1]);o[c][u]==o[c-1][u-1]+i.matchScore&&n==o[c-1][u-1]?(h.push(e.getCanonical(c-1)),d.push(t.getCanonical(u-1)),c-=1,u-=1):o[c][u]==o[c-1][u]-i.gapPenalty?(d.push(i.gapSymbol),h.push(e.getCanonical(c-1)),c-=1):o[c][u]==o[c][u-1]-i.gapPenalty?(h.push(i.gapSymbol),d.push(t.getCanonical(u-1)),u-=1):(h.push(e.getCanonical(c-1)),d.push(t.getCanonical(u-1)),c-=1,u-=1)}h=[...Array.from(e.canonicals).splice(0,c),...h.reverse(),...i.localAlignment?Array.from(e.canonicals).splice(l[0],r):[]],d=[...Array.from(t.canonicals).splice(0,u),...d.reverse(),...i.localAlignment?Array.from(t.canonicals).splice(l[1],s):[]];const p=c,m=u;return p>m?d=[...new Array(p-m).fill(i.gapSymbol.valueOf()),...d]:h=[...new Array(m-p).fill(i.gapSymbol.valueOf()),...h],d.length>h.length?h.push(...new Array(d.length-h.length).fill(i.gapSymbol.valueOf())):d.push(...new Array(h.length-d.length).fill(i.gapSymbol.valueOf())),{seq1:h.join(""),seq2:d.join(""),seq1Splitted:new xe.Mu(h,i.gapSymbol),seq2Splitted:new xe.Mu(d,i.gapSymbol)}}(c,u),d=ht(h.seq1Splitted,h.seq2Splitted,l.units,n);t.append(o.div(d,{style:{width:"300px",overflow:"scroll"}})),c.length!==u.length&&t.append(o.divV([o.divText("Different sequence length:",{style:{fontWeight:"bold"}}),o.divText(`target: ${c.length} monomers`),o.divText(`selected: ${u.length} monomers`)],{style:{paddingBottom:"10px"}})),t.append(dt(n));const p=o.accordion(),m=o.element("i");m.className="grok-icon svg-icon svg-view-layout",p.addTitle(o.span([m,o.label("Similarity search")])),p.addPane("Differences",(()=>t),!0),s.shell.o=p.root}}class vt extends mt{diverseColumnLabel;renderMolIds=null;columnNames=[];computeCompleted=new u.Subject;constructor(){super("diversity"),this.diverseColumnLabel=this.string("diverseColumnLabel",null)}async renderInt(e){if(this.beforeRender()&&this.dataFrame&&e&&this.moleculeColumn){const e=fe.GO.forColumn(this.moleculeColumn);await(e.isFasta()?this.computeByMM():this.computeByChem());const t=null!=this.diverseColumnLabel?this.diverseColumnLabel:`diverse (${this.moleculeColumnName})`,n=a.Column.string(t,this.renderMolIds.length).init((e=>this.moleculeColumn?.get(this.renderMolIds[e])));n.semType=a.SEMTYPE.MACROMOLECULE,this.tags.forEach((e=>n.setTag(e,this.moleculeColumn.getTag(e))));const i=a.DataFrame.fromColumns([n]);i.onCurrentRowChanged.subscribe((e=>{this.dataFrame.currentRowIdx=this.renderMolIds[i.currentRowIdx]})),(0,Ce.K)(this.root,i.plot.grid().root),this.computeCompleted.next(!0)}}async computeByChem(){const e=await(0,ft.R)(this.moleculeColumn);a.DataFrame.fromColumns([e]),this.renderMolIds=await s.functions.call("Chem:callChemDiversitySearch",{col:e,metricName:this.distanceMetric,limit:this.limit,fingerprint:this.fingerprint})}async computeByMM(){const e=(await st(this.moleculeColumn,rt.Z.LEVENSHTEIN)).seqList,t=new D(!0,!1),n=await t.calc(e,rt.Z.LEVENSHTEIN);t.terminate();const i=this.moleculeColumn.length,r=(s=i,(e,t)=>s*e+t-Math.floor((e+2)*(e+1)/2));var s;this.renderMolIds=function(e,t,n){function i(e,t){let n=null,i=null;for(const r of e){const e=t(r);(null==i||e>i)&&(n=r,i=e)}return n}const r=[(o=e-1,Math.floor(function(e){return Math.random()*e}(o)))],s=new Set;var o;for(let t=0;t<e;++t)r.includes(t)||s.add(t);for(;r.length<t;){const e=i(s.values(),(e=>Math.min.apply(Math,r.map((function(t,i){return n(e,t)})))));null!=e&&(r.push(e),s.delete(e))}return r}(i,Math.min(i,this.limit),((e,t)=>this.moleculeColumn.isNone(e)||this.moleculeColumn.isNone(t)?0:n[r(e,t)]))}}var wt,Ct=n(5433),At=n(3890),St=n(1687),xt=n(4356);!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"}(wt||(wt={}));class Et{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 i=this.isWhitespace(n)?t:t-1;for(let e=0;e<i;e++)n=this.getNextColumnIdx(n);return n}parseAtomTypes(){const e=this.atomCount,t=new Array(e);let n=this.getAtomBlockIdx();for(let i=0;i<e;i++)n=this.shiftIdxToAtomType(n),t[i]=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 i=this.getAtomBlockIdx();for(let r=0;r<this.atomCount;r++){i=this.shiftIdxToXColumn(i);for(const s of[e,t,n])s[r]=this.parseFloatValue(i),i=this.getNextColumnIdx(i);i=this.getNextLineIdx(i)}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 i=new Uint16Array(2);i[0]=this.parseIntValue(t),t=this.getNextColumnIdx(t),i[1]=this.parseIntValue(t),e[n]=i,t=this.getNextLineIdx(t)}return e}parseBondTypes(){const e=this.bondCount,t=new Uint16Array(e);let n=this.getBondBlockIdx();for(let i=0;i<e;i++)n=this.shiftIdxToBondType(n),t[i]=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 _t extends Et{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 i=0;i<t;i++){if(n=this.shiftIdxToAtomType(n),e(this.fileContent.charCodeAt(n),n))return!0;n=this.getNextLineIdx(n)}return!1}}class Mt extends _t{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(wt.RGP_LINE_START))).forEach((t=>{const n=this.getAtomIdxToRgpIdxList(t);for(const[t,i]of n){if(e.has(t))throw new Error(`R group ${t} is already in the map`);e.set(t,i)}}));const n=t.map(((e,t)=>{if(e.startsWith(wt.ATOM_ALIAS_LINE_START))return t})).filter((e=>void 0!==e)),i=n.map((e=>t[e])),r=n.map((e=>t[e+1]));i.forEach(((t,n)=>{const i=parseInt(t.split(/\s+/)[1])-1,s=parseInt(r[n].substring(1));if(e.has(s))throw new Error(`R group ${s} is already in the map`);e.set(s,i)}));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(wt.TYPE)&&-1!==e.indexOf(wt.END)}shiftIdxToAtomType(e){return this.shiftIdxToSpecifiedColumn(e,wt.ATOM_TYPE_COL)}getCountsLineIdx(){let e=0;for(let t=0;t<wt.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,wt.FIRST_BONDED_ATOM_COL)}shiftIdxToBondType(e){return this.shiftIdxToSpecifiedColumn(e,wt.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+wt.NUM_OF_COUNTS_DIGITS;const n=parseInt(this.fileContent.substring(e,t));return e=t,t+=wt.NUM_OF_COUNTS_DIGITS,{atomCount:n,bondCount:parseInt(this.fileContent.substring(e,t))}}}class Tt extends _t{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 i=t.match(/RGROUPS=\(([\d\s]+)\)/);if(i){const t=i[1].split(/\s+/).map((e=>parseInt(e)));if(t.length>2)throw new Error(`R group data ${t} has more than 2 elements`);const r=t[1];if(e.has(r))throw new Error(`R group ${r} is already in the map`);e.set(r,n)}})),e}shiftIdxToAtomType(e){return this.shiftIdxToSpecifiedColumn(e,4)}getCountsLineIdx(){return this.fileContent.indexOf("M V30 COUNTS ")}getAtomBlockIdx(){let e=this.fileContent.indexOf("M V30 BEGIN ATOM");return e=this.getNextLineIdx(e),e}shiftIdxToXColumn(e){let t=this.shiftIdxToAtomType(e);return this.isQuote(t)?(t=this.getNextIdenticalChar(t),t=this.getNextColumnIdx(t),t):this.shiftIdxToSpecifiedColumn(e,5)}shiftIdxToBondedAtomsPair(e){return this.shiftIdxToSpecifiedColumn(e,5)}shiftIdxToBondType(e){return this.shiftIdxToSpecifiedColumn(e,4)}getBondBlockIdx(){return this.getNextLineIdx(this.fileContent.indexOf("M V30 BEGIN BOND"))}static isValidMolfile(e){return-1!==e.indexOf("V3000")&&-1!==e.indexOf("M END")}parseAtomAndBondCounts(){let e=this.fileContent.indexOf("M V30 COUNTS ")+14,t=this.fileContent.indexOf(" ",e+1);const n=parseInt(this.fileContent.substring(e,t));return e=t+1,t=this.fileContent.indexOf(" ",e+1),{atomCount:n,bondCount:parseInt(this.fileContent.substring(e,t))}}}class It{constructor(){}static getInstance(e){if(It.isMolfileV2K(e))return new Mt(e);if(It.isMolfileV3K(e))return new Tt(e);throw new Error("Malformed molfile")}static isMolfileV2K(e){return Mt.isValidMolfile(e)}static isMolfileV3K(e){return Tt.isValidMolfile(e)}}var Lt=n(5488),Nt={};Nt.styleTagTransform=A(),Nt.setAttributes=b(),Nt.insert=g().bind(null,"head"),Nt.domAPI=m(),Nt.insertStyleElement=w(),d()(Lt.A,Nt),Lt.A&&Lt.A.locals&&Lt.A.locals;class $t{source;error;_monomers={};_onChanged=new u.Subject;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}addMissingMonomer(e,t){let n=this._monomers[e];n||(n=this._monomers[e]={});let i=t;return t===fe.b9[me.Hi.HELM]?i="Gap":("PEPTIDE"===e&&"X"===t||"RNA"===e&&"N"===t)&&(i="Any"),n[t]={symbol:t,name:i,molfile:"",author:"MISSING",id:-1,rgroups:Se().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 i=null;if(e){const t=this._monomers[e];i=t?t[n]:null}else{ci.logger.warning(`Bio: MonomerLib.getMonomer() symbol '${t}', polymerType not specified.`);for(const[e,t]of Object.entries(this._monomers))if(i=t[n],i)break}return i}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 i=this.getMonomerSymbolsByType(t).map((e=>this.getMonomer(t,e)));return i=i.filter((e=>null!==e)),0===i.length?[]:(i=i.filter((t=>{if(!t?.rgroups)return!1;let n=t?.rgroups.length>=e;return It.getInstance(t.molfile).atomTypes.map(((e,t)=>"R#"===e?t:-1)).filter((e=>-1!==e)),n&&=!0,n})),i.map((e=>e?.symbol)))}get onChanged(){return this._onChanged}_updateInt(e){const t=e.getPolymerTypes(),n=this.getPolymerTypes();t.forEach((t=>{n.includes(t)||(this._monomers[t]={}),e.getMonomerSymbolsByType(t).forEach((n=>{this._monomers[t][n]=e.getMonomer(t,n)}))}))}update(e){this._updateInt(e),this._onChanged.next()}updateLibs(e,t=!1){t&&(this._monomers={});for(const t of e)t.error||this._updateInt(t);this._onChanged.next()}clear(){this._monomers={},this._onChanged.next()}getSummaryObj(){const e={},t=this.getPolymerTypes();for(const n of t)e[n]=this.getMonomerSymbolsByType(n).length;return e}getSummaryDf(){const e=this.getPolymerTypes(),t=new Array(e.length);for(const[n,i]of Se().enumerate(e))t[i]=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"}),i=this.getMonomer(e,t);if(i){const e=i.symbol;i.name,n.append(o.divH([o.div([e],{style:{fontWeight:"bolder",textWrap:"nowrap",marginRight:"6px"}}),o.div([i.name])],{style:{display:"flex",flexDirection:"row",justifyContent:"left"}}));const t={autoCrop:!0,autoCropMargin:0,suppressChiralText:!0};let r;r=i.molfile?s.chem.svgMol(i.molfile,void 0,void 0,t):i.smiles?o.divV([s.chem.svgMol(i.smiles,void 0,void 0,t),o.divText("from smiles",{style:{fontSize:"smaller"}})]):o.divText("No structure",{style:{margin:"6px"}}),n.append(o.div(r,{style:{display:"flex",flexDirection:"row",justifyContent:"center",margin:"6px"}})),n.append(o.divText(i.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}}var Pt=n(7433),Ot=n.n(Pt),Rt=n(1913),kt=n.n(Rt);class Gt{helmMonomerSchema;validateMonomerSchema;constructor(e){this.helmMonomerSchema=e;const t=new(Ot())({allErrors:!0,strictTuples:!1,allowUnionTypes:!0});kt()(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;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}}return n}}class Dt{fileValidator;libHelper;eventManager;logger;filesPromise=Promise.resolve();constructor(e,t,n,i){this.fileValidator=e,this.libHelper=t,this.eventManager=n,this.logger=i,this.eventManager.updateValidLibraryFileListRequested$.subscribe((async()=>{await this.updateValidLibraryList()}))}static objCounter=-1;objId=++Dt.objCounter;toLog(){return`MonomerLibFileManager<${this.objId}>`}static async create(e,t,n){const i=await s.dapi.files.readAsText("System:AppData/Bio/tests/libraries/HELMmonomerSchema.json"),r=JSON.parse(i),o=new Gt(r);return new Dt(o,e,t,n)}async addLibraryFile(e,t){try{if(await s.dapi.files.exists(xt.so+`${t}`))return void s.shell.error(`File ${t} already exists`);await this.validateAgainstHELM(e,t),await s.dapi.files.writeAsText(xt.so+`${t}`,e),await this.updateValidLibraryList(),await s.dapi.files.exists(xt.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(xt.so+`${e}`),await this.updateValidLibraryList(),s.shell.info(`Deleted ${e} library`)}catch(t){console.error(t),await s.dapi.files.exists(xt.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 i=new a.FileSource(e),r=await i.readAsText(t);n=JSON.parse(r);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 $t(s,t)}getValidLibraryPaths(){return this.eventManager.getValidFilesPathList()}async getValidLibraryPathsAsynchronously(){return await this.eventManager.getValidLibraryPathsAsynchronously()}async updateValidLibraryList(){const e=`${this.toLog()}.updateValidLibraryList()`;return this.logger.debug(`${e}, start`),this.filesPromise=this.filesPromise.then((async()=>{this.logger.debug(`${e}, IN`);const t=[],n=await this.getFilePathsAtDefaultLocation();if(!this.fileListHasChanged(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(xt.so+`${e}`);this.isValidHELMLibrary(n,e)||t.push(e)}const i=n.filter((e=>!t.includes(e)));if(this.fileListHasChanged(i)&&(this.eventManager.changeValidFilesPathList(i),this.libHelper.loadLibraries(!0)),i.some((e=>!e.endsWith(".json")))&&this.logger.warning(`Wrong validation: ${i}`),t.length>0){const e=`Invalid monomer library files in ${xt.so}, consider fixing or removing them: ${t.join(", ")}`;this.logger.warning(e)}this.logger.debug(`${e}, OUT`)})),this.logger.debug(`${e}, end`),this.filesPromise}fileListHasChanged(e){const t=this.eventManager.getValidFilesPathList();return e.length!==t.length||e.some(((e,n)=>e!==t[n]))}async validateAgainstHELM(e,t){if(!this.isValidHELMLibrary(e,t))throw new Error(`File ${t} does not satisfy HELM standard`)}isValidHELMLibrary(e,t){return this.fileValidator.validateFile(e,t)}async getFilePathsAtDefaultLocation(){const e=`${this.toLog()}.getFilePathsAtDefaultLocation()`;this.logger.debug(`${e}, start`);const t=(await s.dapi.files.list(xt.so)).map((e=>e.fullPath)),n=[];return n.push(...t),n.map((e=>e.substring(xt.so.length)))}}class Ft{constructor(){}static _instance;static getInstance(){return Ft._instance||(Ft._instance=new Ft),Ft._instance}_libraryFilesUpdateSubject$=new u.BehaviorSubject([]);_addLibraryFilesSubject$=new u.Subject;_librarySelectionSubject$=new u.Subject;getValidFilesPathList(){return this._libraryFilesUpdateSubject$.getValue()}async getValidLibraryPathsAsynchronously(){return new Promise((e=>{this._libraryFilesUpdateSubject$.pipe((0,O.skip)(1)).subscribe((t=>{e(t)}))}))}changeValidFilesPathList(e){this._libraryFilesUpdateSubject$.next(e)}get updateUIControlsRequested$(){return this._libraryFilesUpdateSubject$.pipe()}get updateValidLibraryFileListRequested$(){return this._libraryFilesUpdateSubject$.pipe()}get addLibraryFileRequested$(){return this._addLibraryFilesSubject$.pipe()}addLibraryFile(){this._addLibraryFilesSubject$.next()}get librarySelectionRequested$(){return this._librarySelectionSubject$}updateLibrarySelectionStatus(e,t){this._librarySelectionSubject$.next([e,t])}}class Ht{logger;_monomerLib=new $t({},"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,ze.cb)(e),!1))()]).then((t=>{if(!t)throw new Error(`Loading monomer libraries is timeout ${e} ms.`)}))}constructor(e){this.logger=e}getBioLib(){return this._monomerLib}_fileManagerPromise;async getFileManager(){return void 0===this._fileManagerPromise&&(this._fileManagerPromise=(async()=>await Dt.create(this,this._eventManager,this.logger))()),this._fileManagerPromise}loadLibrariesPromise=Promise.resolve();async loadLibraries(e=!1){return this.loadLibrariesPromise=this.loadLibrariesPromise.then((async()=>{const t=a.TaskBarProgressIndicator.create("Loading monomers ...");try{const[n,i]=await Promise.all([(await this.getFileManager()).getValidLibraryPaths(),(0,xt.ub)()]),r=n.filter((e=>{const t=!i.exclude.includes(e),n=0===i.explicit.length||i.explicit.includes(e);return t&&n}));let s=0;const o=await Promise.all(r.map((e=>this.readLibrary(xt.so,e).catch((t=>{const n=`Loading monomers from '${e}' error: ${t instanceof Error?t.message:t.toString()}`;return new $t({},e,n)})).finally((()=>{t.update(Math.round(100*++s/r.length),`Loading monomer libs ${s}/${r.length}`)})))));this._monomerLib.updateLibs(o,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;ci.logger.error(t,void 0,n)}finally{t.close()}}))}async readLibrary(e,t){const n=await this.getFileManager();return await n.loadLibraryFromFile(e,t)}async selectSpecifiedLibraries(e){const t=await this.getInvalidFileNames(e);if(t.length>0)throw new Error(`Cannot select libraries ${t}: no such library in the list`);const n=await(0,xt.ub)();n.exclude=(await this.getFileManager()).getValidLibraryPaths().filter((t=>!e.includes(t))),await(0,xt.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 void 0===e&&(e=window.$monomerLibHelperPromise=(async()=>{const e=new Ht(ci.logger);return e._eventManager=Ft.getInstance(),e})()),e}}var Bt=n(1757),Vt=n.n(Bt),jt=n(3017),Ut={};async function Wt(){await qt.showDialog()}Ut.styleTagTransform=A(),Ut.setAttributes=b(),Ut.insert=g().bind(null,"head"),Ut.domAPI=m(),Ut.insertStyleElement=w(),d()(jt.A,Ut),jt.A&&jt.A.locals&&jt.A.locals;class Yt{_fileManager;_widget;get widget(){return this._widget}constructor(){}static instancePromise;static async getInstance(){return void 0===Yt.instancePromise&&(Yt.instancePromise=(async()=>{const e=new Yt,t=await(0,ye.pj)();return e._fileManager=await t.getFileManager(),e._widget=await e.createWidget(),e})()),Yt.instancePromise}async createWidget(){const e=await this.getWidgetContent();return(await(0,ye.pj)()).eventManager.addLibraryFileRequested$.subscribe((async()=>await this.promptToAddLibraryFiles())),new a.Widget(e)}async getWidgetContent(){const e=await zt.createControlsForm();return Vt()(e).addClass("monomer-lib-controls-form"),o.divV([e])}async promptToAddLibraryFiles(){a.Utils.openFile({accept:".json",open:async e=>{const t=await e.text(),n=e.name,i=a.TaskBarProgressIndicator.create(`Adding ${n} as a monomer library`);try{await this._fileManager.addLibraryFile(t,n)}catch(e){s.shell.error(`File ${n} is not a valid monomer library, verify it is aligned to HELM JSON schema.`)}finally{i.close()}}})}}class zt{fileManager;userLibSettings;constructor(e,t){this.fileManager=e,this.userLibSettings=t,this.fileManager.eventManager.updateUIControlsRequested$.subscribe((()=>{this.updateControlsForm()})),this.fileManager.eventManager.librarySelectionRequested$.subscribe((async([e,t])=>{await this.updateLibrarySelectionStatus(t,e)}))}toLog(){return"LibraryControlsManager<#>"}static async createControlsForm(){ci.logger.debug("LibraryControlsForm.createControlsForm(), start");const[e,t]=await Promise.all([(0,ye.pj)().then((e=>e.getFileManager())),await(0,xt.ub)()]);return new zt(e,t)._createControlsForm()}_createControlsForm(){const e=this.createLibraryControls(),t=o.form(e);return Vt()(t).addClass("monomer-lib-controls-form"),t}updateControlsForm(){const e=this._createControlsForm();Vt()(".monomer-lib-controls-form").replaceWith(e)}createLibraryControls(){return this.fileManager.getValidLibraryPaths().map((e=>this.createLibInput(e)))}createLibInput(e){const t=`${this.toLog()}.createLibInput()`;ci.logger.debug(`${t}, libFileName = '${e}', start`);const n=!this.userLibSettings.exclude.includes(e),i=o.input.bool(e,{value:n,onValueChanged:t=>{this.fileManager.eventManager.updateLibrarySelectionStatus(e,t.value)}});o.tooltip.bind(i.root,`Include monomers from ${e}`);const r=o.iconFA("trash-alt",(()=>this.promptForLibraryDeletion(e)));return o.tooltip.bind(r,`Delete ${e}`),i.addOptions(r),ci.logger.debug(`${t}, libFileName = '${e}', end`),i}async updateLibrarySelectionStatus(e,t){this.updateLibrarySettings(e,t),await(0,xt.Eu)(this.userLibSettings);const n=await(0,ye.pj)();await n.loadLibraries(!0),s.shell.info("Monomer library user settings saved")}updateLibrarySettings(e,t){e?this.userLibSettings.exclude=this.userLibSettings.exclude.filter((e=>e!==t)):this.userLibSettings.exclude.includes(t)||this.userLibSettings.exclude.push(t)}promptForLibraryDeletion(e){o.dialog("Warning").add(o.divText(`Delete file ${e}?`)).onOK((async()=>{try{const t=a.TaskBarProgressIndicator.create(`Deleting ${e} library`);await this.updateLibrarySelectionStatus(!1,e),await this.fileManager.deleteLibraryFile(e),t.close()}catch(t){console.error(t),s.shell.error(`Failed to delete ${e} library`)}})).showModal(!1)}}class qt{constructor(){}static _instance;dialog;closeDialogSubject$=new u.Subject;static async showDialog(){qt._instance||(qt._instance=new qt,qt._instance.closeDialogSubject$.subscribe((()=>{qt._instance.dialog=void 0}))),qt._instance.dialog||(qt._instance.dialog=await qt._instance.getDialog()),qt._instance.dialog.show()}async getDialog(){const e=Ft.getInstance(),t=(await Yt.getInstance()).widget,n=o.dialog({title:"Manage monomer libraries",helpUrl:"/help/datagrok/solutions/domains/bio/bio.md#manage-monomer-libraries"});return Vt()(n.root).css("width","350px"),n.clear(),n.addButton("Add",(()=>e.addLibraryFile()),void 0,"Upload new HELM monomer library"),n.add(t),n.onClose.subscribe((()=>this.closeDialogSubject$.next())),n}}var Kt,Zt=function(e,t,n,i){return new(n||(n=Promise))((function(r,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};class Xt{constructor(e,t,n=!1,i){var r;this.name="",this.description="",this._isAutomatic=!1,this._autoStartFirstStep=!1,this._currentStep=0,this._isStopped=!1,this._isCancelled=!1,this._isStepProcessed=!1,this._root=o.div([],{id:"demo-script",classes:"tutorials-root tutorials-track demo-app-script"}),this._steps=[],this._mainHeader=o.panel([],"tutorials-main-header"),this._header=o.h2(""),this._headerDiv=o.divH([],"tutorials-root-header"),this._stopStartBtn=o.button(o.iconFA("pause"),(()=>this._changeStopState()),"Play / pause"),this._restartBtn=o.button(o.iconFA("redo"),(()=>this._restartScript()),"Restart"),this._nextStepBtn=o.button(o.iconFA("play"),(()=>{this._isStepProcessed||this._nextStep()}),"Next step"),this._activity=o.panel([],"tutorials-root-description"),this._progressDiv=o.divV([],"tutorials-root-progress"),this._progress=o.element("progress"),this._progressSteps=o.divText(""),this._closeBtn=o.button(o.iconFA("chevron-left"),(()=>this._closeDock()),"Back to demo"),this.name=e,this.description=t,this._isAutomatic=n,this._autoStartFirstStep=null!==(r=null==i?void 0:i.autoStartFirstStep)&&void 0!==r&&r,this._progress.max=0,this._progress.value=1,Xt.currentObject=this}get steps(){return this._steps}get stepNumber(){return this._steps.length}_addHeader(){this._createHeaderDiv(),this._createProgressDiv(),this._mainHeader.append(this._headerDiv,this._progressDiv)}_createHeaderDiv(){this._header.innerText=this.name,this._headerDiv.append(this._closeBtn),this._headerDiv.append(this._header),this._nextStepBtn.firstChild.className="grok-icon fas fa-play",this._headerDiv.append(this._isAutomatic?this._stopStartBtn:this._nextStepBtn)}_createProgressDiv(){this._progress.max=this.stepNumber,this._progressDiv.append(this._progress),this._progressSteps=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 i=o.div(this._steps[t].name,"grok-tutorial-entry-instruction"),r=o.div(null===(e=this._steps[t].options)||void 0===e?void 0:e.description,"grok-tutorial-step-description hidden"),s=o.divH([n,i],"grok-tutorial-entry");this._activity.append(s,r)}}_initRoot(){var e,t,n;s.shell.windows.showContextPanel=!0,s.shell.windows.showHelp=!1;const i=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,i,""),(null===(t=null===(e=i.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=i.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 Zt(this,void 0,void 0,(function*(){this._isStepProcessed=!0,this._isAutomatic||(this._nextStepBtn.classList.add("disabled"),this._nextStepBtn.firstChild.classList.add("fa-disabled"));const n=this._activity.getElementsByClassName("grok-tutorial-entry")[this._currentStep],i=this._activity.getElementsByClassName("grok-icon")[this._currentStep],r=this._activity.getElementsByClassName("grok-tutorial-step-description")[this._currentStep];i.className="grok-icon far fa-spinner-third fa-spin",r.classList.remove("hidden"),r.classList.add("visible");const l=n,c=(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,l.offsetTop-this._mainHeader.offsetHeight),this._isAutomatic&&(yield this._countdown(n,i,c),yield(0,ze.cb)(c));const u=o.iconFA("check");if(i.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 Zt(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 Zt(this,void 0,void 0,(function*(){const i=o.div([],"demo-script-countdown");t.classList.add("hidden");let r=n/1e3;const s=this._createSVGIndicator(r);i.append(s),e.prepend(i);const a=setInterval((()=>{r--,0===r&&(clearInterval(a),i.remove(),t.classList.remove("hidden"),t.classList.add("visible"))}),1e3)}))}_createSVGIndicator(e){const t=document.createElementNS("http://www.w3.org/2000/svg","svg"),n=document.createElementNS("http://www.w3.org/2000/svg","circle");return n.setAttributeNS(null,"cx","7"),n.setAttributeNS(null,"cy","7"),n.setAttributeNS(null,"r","6"),n.setAttributeNS(null,"style",`animation: countdown ${e}s linear infinite forwards`),t.append(n),t}_changeStopState(){const e=this._stopStartBtn.getElementsByClassName("grok-icon");e[0].className="grok-icon fas fa-play",this._isStopped=!this._isStopped,this._isStopped||(e[0].className="grok-icon fal fa-pause",this._isStepProcessed||this._startScript())}_restartScript(){s.shell.dockManager.close(this._node),s.shell.closeAll(),this._clearRoot(),this._setInitParams(),this.start()}_clearRoot(){this._root=o.div([],{id:"demo-script",classes:"tutorials-root tutorials-track demo-app-script"}),this._mainHeader=o.panel([],"tutorials-main-header"),this._header=o.h2(""),this._headerDiv=o.divH([],"tutorials-root-header"),this._activity=o.panel([],"tutorials-root-description"),this._progressDiv=o.divV([],"tutorials-root-progress"),this._progress=o.element("progress"),this._progressSteps=o.divText(""),this._progress.max=0,this._progress.value=1}_setInitParams(){this._currentStep=0,this._isStopped=!1,this._isCancelled=!1,this._stopStartBtn.getElementsByClassName("grok-icon")[0].className="grok-icon fal fa-pause",this._nextStepBtn.classList.remove("disabled")}_closeDock(){s.shell.dockManager.close(this._node),this.cancelScript()}cancelScript(){this._isCancelled=!0,Xt.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 Zt(this,void 0,void 0,(function*(){this._initRoot(),s.shell.newView(this.name),this._isAutomatic?this._startScript():this._autoStartFirstStep&&(yield this._nextStep())}))}}function Jt(e){const t=e instanceof Error?e.message:e.toString(),n=e instanceof Error?e.stack:void 0;s.shell.error(t),ci.logger.error(e.message,void 0,n)}Xt.currentObject=null,function(e){e.X="Embed_X",e.Y="Embed_Y"}(Kt||(Kt={}));const Qt="samples/FASTA_PT_activity.csv";async function en(){const e="Dendrogram",t=a.Func.find({package:e,name:"getTreeHelper"});if(0===t.length)throw new Error(`Package "${e}" must be installed for TreeHelper.`);return(await t[0].prepare().call()).getOutputParamValue()}async function tn(){return await s.functions.call("Dendrogram:getDendrogramService",{})}var nn=function(e,t,n,i){return new(n||(n=Promise))((function(r,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};function rn(e,t,i){return nn(this,void 0,void 0,(function*(){return new Promise((function(r,s){const o=new Worker(new URL(n.p+n.u(705),n.b));o.postMessage({distMatArray:e,n:t,methodCode:i}),o.onmessage=({data:{error:e,clusterMatrix:t}})=>{o.terminate(),e?s(e):r(t)}}))}))}var sn,on,an,ln=function(e,t,n,i){return new(n||(n=Promise))((function(r,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};n(5540),function(e){e.ADD="ADD",e.SUB="SUB",e.MULT="MULT"}(sn||(sn={})),function(e){e.SQUARE="SQUARE",e.INVERSE="INVERSE",e.TRANSPOSE="TRANSPOSE",e.NORM="NORM",e.COLUMN_NORM="COLUMN_NORM"}(on||(on={})),function(e){e.SCALARMULT="SCALARMULT",e.SCALARADD="SCALARADD",e.SCALARPOW="SCALARPOW"}(an||(an={}));const cn="samples/FASTA_PT_activity.csv",un="sequence";const hn="samples/FASTA_PT_activity.csv";var dn=n(8152);const pn="samples/HELM.csv";var mn=n(966),fn=n(608),gn=n(1619);class yn{urlParams;funcName;options;df;view;constructor(e,t,n={}){this.urlParams=e,this.funcName=t,this.options=n}async init(e){this.df=e,await this.buildView()}async buildView(){const e=Se()(this.urlParams.entries()).map((([e,t])=>`${e}=${encodeURIComponent(t)}`)).toArray().join("&");this.view=s.shell.addTableView(this.df),this.view.path=this.view.basePath=`func/${ci.name}.${this.funcName}?${e}`;const t={...this.options,sequenceColumnName:"sequence"};for(const[e,n]of this.urlParams.entries())switch(e){case Xe.n5.fixWidth:case Xe.n5.fitArea:t[e]=["1","on","true"].includes(n.toLowerCase());break;default:t[e]=n}const n=await this.view.dataFrame.plot.fromType("WebLogo",t);this.view.dockManager.dock(n,a.DOCK_TYPE.DOWN,null,"WebLogo",.35)}}class bn{tableInput;seqColInput;funcParamsDiv;get funcParams(){return{table:this.tableInput.value,sequence:this.seqColInput.value}}get paramsUI(){return this.funcParamsDiv}constructor(){this.tableInput=o.input.table("Table",{value:s.shell.tv.dataFrame,onValueChanged:()=>{this.onTableInputChanged()}});const e=this.tableInput.value.columns.bySemType(a.SEMTYPE.MACROMOLECULE);this.seqColInput=o.input.column("Sequence",{table:this.tableInput.value,value:e,filter:e=>e.semType===a.SEMTYPE.MACROMOLECULE}),this.funcParamsDiv=o.inputs([this.tableInput,this.seqColInput],{style:{minWidth:"320px"}})}onTableInputChanged(){this.seqColInput=o.input.column("Sequence",{table:this.tableInput.value,value:this.tableInput.value.columns.bySemType(a.SEMTYPE.MACROMOLECULE)})}}var vn=n(5785);class wn{constructor(e){this.monomerLib=e}getCappedRotatedMonomer(e,t){const n=this.monomerLib.getMonomer(e,t);return n?n.molfile:null}}const Cn=new class{tooltipHandlerTemp="tooltip-handler.Monomer"},An={autoCrop:!0,autoCropMargin:0,suppressChiralText:!0};class Sn{gridCol;constructor(e){this.gridCol=e,this.gridCol.grid.onCellTooltip(this.onCellTooltip.bind(this))}onCellTooltip(e,t,n){if(e.grid.dart!=this.gridCol.grid.dart||e.gridColumn.dart!=this.gridCol.dart||!e.tableColumn||!e.isTableCell)return!1;const i=e.tableColumn.getTag(gt.gp.alphabet),r=e.cell.value,a=e.grid.canvas.getBoundingClientRect(),l=e.bounds.right+a.left-4,c=e.bounds.bottom+a.top-4,u=yi();if(!u)return o.tooltip.show(o.divText("Monomer library is not available."),l,c),!0;const h=new wn(u),d=i===me.YI.DNA||i===me.YI.RNA?"RNA":(me.YI.PT,"PEPTIDE"),p=h.getCappedRotatedMonomer(d,r),m=o.div(r),f=p?s.chem.svgMol(p,void 0,void 0,An):null;return o.tooltip.show(o.divV([m,...f?[f]:[]]),l,c),!0}static getOrCreate(e){let t=e.temp[Cn.tooltipHandlerTemp];return t||(t=e.temp[Cn.tooltipHandlerTemp]=new Sn(e)),t}}class xn extends a.GridCellRenderer{get name(){return Ge.uF.MONOMER}get cellType(){return Ge.uF.MONOMER}get defaultHeight(){return 15}get defaultWidth(){return 40}render(e,t,n,i,r,s,o){if(s.gridRow<0)return;Sn.getOrCreate(s.gridColumn),e.font="12px monospace",e.textBaseline="middle",e.textAlign="center";const a=(0,me.ny)(s.cell.column.getTag(gt.gp.alphabet)),l=s.cell.value;if(!l)return;const c=a.get(l);e.fillStyle=c;const u=Math.max(2,Math.floor(.15*i));e.fillText((0,me.zS)(l,u),t+i/2,n+r/2,i)}}class En{constructor(e,t){this.target=e,this.debugEnabled=t}error(e,t,n){return this.target.error(e,t,n)}warning(e,t){return this.target.warning(e,t)}info(e,t){return this.target.info(e,t)}debug(e,t){if(this.debugEnabled)return this.target.debug(e,t)}}class _n extends Map{_onPropertyChanged=new u.Subject;get onPropertyChanged(){return this._onPropertyChanged}get maxMonomerLength(){const e=super.get("MaxMonomerLength");return"long"===e?null:parseInt(e)}set maxMonomerLength(e){const t=null===e?"long":e.toString();super.set("MaxMonomerLength",t),this._onPropertyChanged.next("MaxMonomerLength")}get tooltipWebLogo(){return super.get("TooltipWebLogo")}set tooltipWebLogo(e){super.set("TooltipWebLogo",e),this._onPropertyChanged.next("TooltipWebLogo")}get defaultSeparator(){return super.get("DefaultSeparator")}set defaultSeparator(e){if(1!==e.length)throw new Error("The separator must be of length one.");super.set("DefaultSeparator",e),this._onPropertyChanged.next("DefaultSeparator")}constructor(e){super(Object.entries(e))}}class Mn extends a.Package{_properties;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 En(super.logger,e.debug)}completeInit(){this._initialized=!0}handleErrorUI(e){const[t,n]=(0,we.AP)(e);s.shell.error(t),this.logger.error(t,void 0,n)}}var Tn=n(2174);class In extends a.Widget{viewed=!1;seqCol;wlViewer=null;constructor(e){super(o.divV([])),this.seqCol=e}async init(){const e=fe.GO.forColumn(this.seqCol),t=ci.properties.tooltipWebLogo,n=this.seqCol.getTag(qe.gp.tooltipWebLogo);!1===t||["false","off","disable","disabled"].includes(n)||(this.wlViewer=await this.seqCol.dataFrame.plot.fromType("WebLogo",{sequenceColumnName:this.seqCol.name,backgroundColor:0,positionHeight:"Entropy",positionWidth:e.getAlphabetIsMultichar()?24:16,fixWidth:!0,fitArea:!1,positionNames:"",endPositionName:"50"}),this.wlViewer.root.style.height="50px",this.root.appendChild(this.wlViewer.root),this.root.style.width="100%")}detach(){this.wlViewer&&(this.wlViewer.detach(),this.wlViewer=null),super.detach()}}function Ln(e,t,n,i){const r=fe.GO.forColumn(e);let s=null,o=null;for(let e=0;e<r.posList.length;++e)r.posList[e]==t&&(s=e),r.posList[e]==n&&(o=e);if(null===s&&null!==t)throw new Error(`Start position ${t} not found.`);if(null===o&&null!==n)throw new Error(`End position ${n} not found.`);if(r.posList.length<o)throw new Error(`End position ${o} exceeds positions length`);const a=i||`${e.name}: (${t??""}-${n??""})`;return r.getRegion(s,o,a)}const Nn={df:a.DataFrame.fromCsv("seq,value\nATCCGTCGT,0.5\nTGTTCGTCA,0.4\nATGGTCGTA,0.7\nATCCGTGCA,0.1"),colName:"seq",positionNames:["1","1A","1C","2","4","4A","4B","5","6"].join(me.z1),regions:[{name:"first region",start:"1",end:"2"},{name:"second region",start:"1C",end:"4"},{name:"overlapping second",start:"1C",end:"4A"},{name:"whole sequence",start:"1",end:"6"},{name:"bad start",start:"0",end:"6"},{name:"bad end",start:"1",end:"4C"},{name:"bad start & end",start:"0",end:"4C"}]};class $n{urlParams;funcName;view;data;constructor(e,t){this.urlParams=e,this.funcName=t}async init(e){this.data=e??Nn;const t=this.data.df.getCol(this.data.colName);this.data.positionNames&&t.setTag(me.gp.positionNames,this.data.positionNames),this.data.regions&&t.setTag(me.gp.regions,JSON.stringify(this.data.regions)),await this.buildView()}async buildView(){await s.data.detectSemanticTypes(this.data.df),this.view=s.shell.addTableView(this.data.df),this.view.path=this.view.basePath=`func/${ci.name}.${this.funcName}`;const e=await this.view.dataFrame.plot.fromType("WebLogo",{sequenceColumnName:this.data.colName});this.view.dockManager.dock(e,a.DOCK_TYPE.DOWN,null,"WebLogo",.35)}}class Pn{call;inputs=new class{table;sequence;region;start;end;name};constructor(e){this.call=e;const t=e=>this.call.inputParams[e].property.description;this.inputs.table=o.input.table("Table",{value:this.call.inputParams.table.value??s.shell.tv.dataFrame});const n=this.call.inputParams.sequence.value??this.inputs.table.value.columns.bySemType(a.SEMTYPE.MACROMOLECULE);this.inputs.sequence=o.input.column("Sequence",{table:s.shell.tv.dataFrame,value:n,onValueChanged:this.sequenceInputChanged.bind(this),filter:e=>e.semType===a.SEMTYPE.MACROMOLECULE}),this.inputs.start=o.input.choice("Start",{onValueChanged:this.startInputChanged.bind(this)}),this.inputs.end=o.input.choice("End",{onValueChanged:this.endInputChanged.bind(this)}),this.inputs.region=o.input.choice("Region",{value:null,items:[],onValueChanged:this.regionInputChanged.bind(this)}),this.inputs.name=o.input.string("Column name",{value:this.getDefaultName(),onValueChanged:this.nameInputChanged.bind(this),clearIcon:!0}),this.inputs.name.onInput(this.nameInputInput.bind(this));for(const e in this.call.inputParams)o.tooltip.bind(this.inputs[e].captionLabel,t(e));this.sequenceInputChanged()}sequenceInputChanged(){const e=this.inputs.sequence.value;e&&fe.GO.forColumn(e),this.updateRegionItems(),this.updateStartEndInputItems(),this.updateRegion(!0),this.updateNameInput()}fixRegion=!1;regionInputChanged(){this.fixRegion=!0;try{const e=this.inputs.region.stringValue,t=e?JSON.parse(e):null;if(null!==t)this.inputs.start.value=t?.start,this.inputs.end.value=t?.end;else{const e=fe.GO.forColumn(this.inputs.sequence.value);this.inputs.start.value=e.posList[0],this.inputs.end.value=e.posList[e.posList.length-1]}}finally{this.fixRegion=!1}}startInputChanged(){this.updateRegion(!1),this.updateNameInput()}endInputChanged(){this.updateRegion(!1),this.updateNameInput()}nameInputChanged(){this.defaultNameUpdating||(this.defaultName=!1)}nameInputInput(){this.inputs.name.value||(this.defaultName=!0,this.inputs.name.input.focus())}updateStartEndInputItems(){const e=this.inputs.sequence.value,t=e?fe.GO.forColumn(e):null,n=this.inputs.start.input,i=this.inputs.end.input;for(let e=n.options.length-1;e>=0;--e)n.options.remove(e);for(let e=i.options.length-1;e>=0;--e)i.options.remove(e);for(const e of t?.posList??[]){const t=document.createElement("option"),r=document.createElement("option");t.text=r.text=e,t.value=r.value=e,n.options.add(t),i.options.add(r)}n.value=t?.posList[0]??"",i.value=t?.posList[t?.posList.length-1]??""}updateRegionItems(){const e=this.inputs.sequence.value,t=e?e.getTag(me.gp.regions):null,n=t?JSON.parse(t):null,i=this.inputs.region.input;for(let e=i.options.length-1;e>=0;--e)i.options.remove(e);const r=document.createElement("option");if(r.text="",r.value=JSON.stringify(null),i.options.add(r),null!=n){this.inputs.region.root.style.removeProperty("display");for(const e of n){const t=document.createElement("option");t.text=`${e.name}: ${e.start}-${e.end}`,t.value=JSON.stringify(e),i.options.add(t)}}else this.inputs.region.root.style.display="none"}updateRegion(e){const t=this.inputs.start.stringValue??"",n=this.inputs.end.stringValue??"";if(!this.fixRegion){const e=this.inputs.region.input;e.selectedIndex=-1;for(let i=e.options.length-1;i>=0;--i){const r=e.options[i],s=JSON.parse(r.value);s&&t===s.start&&n===s.end&&(e.selectedIndex=i)}}}defaultName=!0;defaultNameUpdating=!1;updateNameInput(){this.defaultNameUpdating=!0;try{this.defaultName&&(this.inputs.name.value=this.getDefaultName())}finally{this.defaultNameUpdating=!1}}getDefaultName(){const e=this.inputs.region.stringValue,t=e?JSON.parse(e):null,n=this.inputs.sequence.value,i=this.inputs.start.stringValue??"",r=this.inputs.end.stringValue??"";return null!=t?`${n.name}(${t.name}): ${t.start}-${t.end}`:`${n?.name}: (${i}-${r})`}getParams(){return{table:this.inputs.table.value,sequence:this.inputs.sequence.value,start:this.getStart(),end:this.getEnd(),name:this.getName()}}getStart(){return this.inputs.start.stringValue}getEnd(){return this.inputs.end.stringValue}getName(){const e=this.inputs.name.stringValue;return""==e?null:e}dialog(){const e=o.inputs(Object.values(this.inputs),{style:{minWidth:"320px"}});o.dialog({title:"Get Region"}).add(e).onOK((()=>{(async()=>{const e=this.getParams();await this.call.func.prepare(e).call(!0)})().catch((e=>{ci.handleErrorUI(e)}))})).show()}widget(){const e=o.inputs(Object.entries(this.inputs).filter((([e,t])=>!["table","sequence"].includes(e))).map((([e,t])=>t))),t=o.button("Get Region",(()=>{(async()=>{const e=this.getParams();await this.call.func.prepare(e).call(!0)})().catch((e=>{ci.handleErrorUI(e)}))}));return a.Widget.fromRoot(o.divV([e,o.div(t)]))}}var On=n(7384);const Rn=OCL;class kn{constructor(e){const t=e.split("|");t.forEach((e=>this.validateConnectionItem(e))),this.connectionItems=t}connectionItems;validateConnectionItem(e){const t="(PEPTIDE|RNA)",n=new RegExp(`${t}[0-9]+,${t}[0-9]+,[0-9]+:R[0-9]+-[0-9]+:R[0-9]+`,"g");if(!e.match(n))throw new Error(`Cannot parse connection item from ${e}`)}getConnectionData(){const e=[];return this.connectionItems.forEach((t=>{const n=[],i=t.split(",");i[2].split("-").forEach(((e,t)=>{const r=i[t],s=e.split(":"),o={monomerIdx:parseInt(s[0])-1,rGroupId:parseInt(s[1].slice(1))};n.push({polymerId:r,bond:o})})),e.push(n)})),e}}class Gn{simplePolymer;constructor(e){this.simplePolymer=e,this.polymerType=this.getPolymerType(),this.idx=this.getIdx();const{monomers:t,monomerTypes:n}=this.getMonomerSymbolsAndTypes();this.monomers=t,this.monomerTypes=n}polymerType;monomers;idx;monomerTypes;get id(){return this.polymerType+this.idx.toString()}getPolymerType(){const e=new RegExp("(PEPTIDE|RNA)[0-9]+{"),t=this.simplePolymer.match(e);if(!t)throw new Error(`Unsupported polymer type in ${this.simplePolymer}`);return t[1]}getIdx(){const e=new RegExp(`${this.polymerType}([0-9]+){`),t=this.simplePolymer.match(e);if(!t)throw new Error(`Cannot parse simple polymer id from ${this.simplePolymer}`);return parseInt(t[1])}getMonomerSymbolsAndTypes(){const e=new RegExp(`${this.polymerType}${this.idx}{|}`,"g"),t=this.simplePolymer.replace(e,"").split("."),n=[],i=[];return t.forEach((e=>{n.push(e),i.push("Backbone")})),{monomers:n,monomerTypes:i}}getBondData(){const e=[],t=this.monomerTypes.map(((e,t)=>{if("Backbone"===e)return t})).filter((e=>void 0!==e)),n=this.monomerTypes.map(((e,t)=>{if("Branch"===e)return t})).filter((e=>void 0!==e));for(let n=0;n<t.length-1;n++){const i=t[n],r=t[n+1];e.push([{monomerIdx:i,rGroupId:2},{monomerIdx:r,rGroupId:1}])}for(let t=0;t<n.length;t++){const i=n[t],r=i-1;e.push([{monomerIdx:r,rGroupId:3},{monomerIdx:i,rGroupId:1}])}return e}}class Dn{helmString;constructor(e){this.helmString=e;const t=this.helmString.split("$"),n=t[0].split("|");this.simplePolymers=n.map((e=>new Gn(e))),""!==t[1]&&(this.connectionList=new kn(t[1])),this.bondData=this.getBondData(),this.bondedRGroupsMap=this.getBondedRGroupsMap()}bondData;simplePolymers;connectionList;bondedRGroupsMap;getBondedRGroupsMap(){const e=new Map;return this.bondData.forEach((t=>{t.forEach((t=>{const n=t.monomerIdx,i=t.rGroupId;e.get(n)||e.set(n,[]),e.get(n).push(i)}))})),e}toString(){return this.helmString}getPolymerTypeByMonomerIdx(e){return this.getSimplePolymerByMonomerIdx(e).polymerType}getSimplePolymerByMonomerIdx(e){const t=this.getMonomerIdxShifts(),n=Object.values(t).sort(((e,t)=>e-t)).find((t=>e>=t));if(void 0===n)throw new Error(`Cannot find simple polymer for monomer ${e}`);const i=Object.keys(t).find((e=>t[e]===n));return this.simplePolymers.find((e=>e.id===i))}shiftBondMonomerIds(e,t){t.forEach((t=>{t.forEach((t=>{t.monomerIdx+=e}))}))}getMonomerIdxShifts(){const e={};let t=0;return this.simplePolymers.forEach((n=>{e[n.id]=t,t+=n.monomers.length})),e}getBondData(){const e=this.getMonomerIdxShifts(),t=[];return this.simplePolymers.forEach((n=>{const i=n.getBondData(),r=e[n.id];this.shiftBondMonomerIds(r,i),t.push(...i)})),this.connectionList&&this.connectionList.getConnectionData().forEach((n=>{const i=[];n.forEach((t=>{const n=e[t.polymerId],r=t.bond;r.monomerIdx+=n,i.push(r)})),t.push(i)})),t}}class Fn{monomerSymbol;constructor(e){this.monomerSymbol=e}atoms;bonds;rGroups;shiftR1GroupToOrigin(){const e=this.rGroups.getAtomicIdx(1);if(null===e)throw new Error(`Cannot find R1 group for monomer ${this.monomerSymbol}`);const{x:t,y:n}=this.atoms.atomCoordinates[e];this.atoms.shift({x:-t,y:-n})}alignR2AlongX(){const e=this.rGroups.getAtomicIdx(2);if(null===e)throw new Error(`Cannot find R2 group for monomer ${this.monomerSymbol}`);const t=this.atoms.atomCoordinates[e],n=t.y/t.x,i=Math.atan(n);if(isNaN(i))throw new Error(`Cannot calculate angle for R2 group for monomer ${this.monomerSymbol}`);this.rotateCoordinates(-i)}shiftMonomerToDefaultPosition(){this.shiftR1GroupToOrigin(),null!==this.rGroups.getAtomicIdx(2)&&this.alignR2AlongX()}deleteBondLineWithSpecifiedRGroup(e){this.rGroups.deleteBondLineWithSpecifiedRGroup(e)}shiftCoordinates(e){this.atoms.shift(e)}rotateCoordinates(e){this.atoms.rotate(e)}getBondLines(){return this.bonds.getBondLines()}getAtomLines(){return this.atoms.atomLines}removeRGroups(e){this.rGroups.removeRGroups(e)}replaceRGroupWithAttachmentAtom(e,t){this.rGroups.replaceRGroupWithAttachmentAtom(e,t)}getAttachmentAtomByRGroupId(e){return this.rGroups.getAttachmentAtomIdByRGroupId(e)}shiftBonds(e){this.bonds.shift(e)}capRGroups(e){this.rGroups.capRGroups(e)}}class Hn{atoms;bonds;constructor(e,t,n){this.atoms=t,this.bonds=n,this.rGroupIdToAtomicIndexMap=e.getRGroupIdToAtomicIdxMap()}rGroupIdToAtomicIndexMap;rGroupBondPositionMap=new Map;getAtomicIdx(e){const t=this.rGroupIdToAtomicIndexMap.get(e);return void 0===t?null:t}removeRGroupsFromAtomBlock(e){e.forEach((e=>{if(void 0===this.rGroupIdToAtomicIndexMap.get(e))throw new Error(`Cannot find atomic index for R group ${e}`)}));const t=Array.from(this.rGroupIdToAtomicIndexMap.entries()).filter((([t,n])=>e.includes(t))).map((([e,t])=>t));this.atoms.deleteAtoms(t)}removeRGroups(e){this.removeRGroupsFromAtomBlock(e),e.forEach((e=>{const t=this.replaceRGroupInBondsByDummy(e);this.rGroupBondPositionMap.set(e,t)}))}replaceRGroupInBondsByDummy(e){const t=this.rGroupIdToAtomicIndexMap.get(e);if(this.rGroupBondPositionMap.has(e))throw new Error(`R group ${e} is already handled`);const n=this.bonds.getPositionsInBonds(t+1);if(0===n.length)throw new Error(`Cannot find position for R group ${e}`);if(n.length>1)throw new Error(`More than one position for R group ${e}`);const i=n[0];return this.bonds.replacePositionsInBondsByDummy([i]),this.bonds.removeAtomIdFromBonds(t+1),this.removeRGroupFromAtomicIdxMap(e,t),i}removeRGroupFromAtomicIdxMap(e,t){this.rGroupIdToAtomicIndexMap.delete(e);for(const[e,n]of this.rGroupIdToAtomicIndexMap)n>t&&this.rGroupIdToAtomicIndexMap.set(e,n-1)}deleteBondLineWithSpecifiedRGroup(e){const t=this.rGroupBondPositionMap.get(e);if(!t)throw new Error(`Cannot find position for R group ${e}`);const{bondLineIdx:n}=t;this.bonds.deleteBondLines([n]),this.rGroupBondPositionMap.delete(e),this.rGroupIdToAtomicIndexMap.delete(e),this.rGroupBondPositionMap.forEach((e=>{e.bondLineIdx>n&&(e.bondLineIdx-=1)}))}replaceRGroupWithAttachmentAtom(e,t){const n=this.rGroupBondPositionMap.get(e);if(!n)throw new Error(`Cannot find position for R group ${e}`);const{bondLineIdx:i,nodeIdx:r}=n;this.bonds.bondedAtoms[i][r]=t}getAttachmentAtomIdByRGroupId(e){const t=this.rGroupBondPositionMap.get(e);if(!t)throw new Error(`Cannot find position for R group ${e}`);const{bondLineIdx:n,nodeIdx:i}=t;return this.bonds.bondedAtoms[n][(i+1)%2]}capRGroups(e){this.rGroupIdToAtomicIndexMap.forEach(((t,n)=>{const i=e[n-1];"H"===i?(this.removeRGroups([n]),this.deleteBondLineWithSpecifiedRGroup(n)):this.atoms.replaceRGroupSymbolByElement(t,i)}))}}class Bn{coordinates=[];rawAtomLines=[];get atomCoordinates(){return this.coordinates}replaceRGroupSymbolByElement(e,t){this.rawAtomLines[e]=this.rawAtomLines[e].replace("R#",t)}deleteAtoms(e){this.coordinates=this.coordinates.filter(((t,n)=>!e.includes(n))),this.rawAtomLines=this.rawAtomLines.filter(((t,n)=>!e.includes(n)))}shift(e){this.coordinates=this.coordinates.map((t=>{const n=t.x+e.x,i=t.y+e.y;if(isNaN(n)||isNaN(i))throw new Error(`Cannot shift coordinates by ${e.x}, ${e.y}`);return{x:n,y:i}}))}rotate(e){this.coordinates=this.coordinates.map((t=>{const n=t.x,i=t.y,r=n*Math.cos(e)-i*Math.sin(e),s=n*Math.sin(e)+i*Math.cos(e);if(isNaN(r)||isNaN(s))throw new Error(`Cannot rotate coordinates by ${e}`);return{x:r,y:s}}))}}class Vn extends Bn{constructor(e){super(),this.rawAtomLines=e.getAtomLines(),this.coordinates=this.rawAtomLines.map((e=>({x:parseFloat(e.substring(0,10)),y:parseFloat(e.substring(10,20))})))}get atomLines(){return this.rawAtomLines.map(((e,t)=>{const n=this.coordinates[t];return`${n.x.toFixed(4).padStart(10," ")}${n.y.toFixed(4).padStart(10," ")}${e.substring(20)}`}))}}class jn{bondedAtomPairs=[];rawBondLines=[];get bondedAtoms(){return this.bondedAtomPairs}deleteBondLines(e){this.rawBondLines=this.rawBondLines.filter(((t,n)=>!e.includes(n))),this.bondedAtomPairs=this.bondedAtomPairs.filter(((t,n)=>!e.includes(n)))}getPositionsInBonds(e){const t=[];return this.bondedAtomPairs.forEach(((n,i)=>{n.forEach(((n,r)=>{n===e&&t.push({bondLineIdx:i,nodeIdx:r})}))})),t}replacePositionsInBondsByDummy(e,t){void 0===t&&(t=-1),e.forEach((e=>{const{bondLineIdx:n,nodeIdx:i}=e;this.bondedAtomPairs[n][i]=t}))}removeAtomIdFromBonds(e){this.bondedAtomPairs=this.bondedAtomPairs.map((t=>t.map((t=>t>e?t-1:t))))}shift(e){this.bondedAtomPairs=this.bondedAtomPairs.map((t=>t.map((t=>t+e))))}}class Un extends jn{constructor(e){super(),this.rawBondLines=e.getBondLines(),this.bondedAtomPairs=this.rawBondLines.map((e=>[parseInt(e.substring(0,3)),parseInt(e.substring(3,6))]))}getBondLines(){return this.bondedAtomPairs.map(((e,t)=>{if(e.some((e=>-1===e)))throw new Error(`Bonded pair ${e} contains -1`);return`${e[0].toString().padStart(3," ")}${e[1].toString().padStart(3," ")}${this.rawBondLines[t].substring(6)}`}))}}class Wn extends Fn{constructor(e,t){super(t);const n=It.getInstance(e);this.atoms=new Vn(n),this.bonds=new Un(n),this.rGroups=new Hn(n,this.atoms,this.bonds),this.shiftMonomerToDefaultPosition()}}class Yn extends Bn{molfileHandler;constructor(e){super(),this.molfileHandler=e,this.rawAtomLines=e.getAtomLines(),this.coordinates=this.getCoordinates()}getCoordinates(){const e=this.molfileHandler.x,t=this.molfileHandler.y;return Array.from(e).map(((e,n)=>({x:e,y:t[n]})))}get atomLines(){const e=/^(M V30 [^-]*)(-?\d+\.\d+)( )(-?\d+\.\d+)( -?\d+\.\d+.*)$/,t=/\sRGROUPS=\(\d+(\s+\d+)*\)/;return this.rawAtomLines.map(((n,i)=>{const r=this.coordinates[i],s=r.x.toFixed(4)+"00",o=r.y.toFixed(4)+"00";return n.replace(e,((e,t,n,i,r,a)=>t+s+i+o+a)).replace(t,"")}))}replaceRGroupSymbolByElement(e,t){super.replaceRGroupSymbolByElement(e,t);const n=this.rawAtomLines[e].substring(3).split(" ");n.length>7&&(this.rawAtomLines[e]=`M ${n.slice(0,7).join(" ")}`)}}class zn extends jn{molfileHandler;constructor(e){super(),this.molfileHandler=e,this.rawBondLines=e.getBondLines(),this.bondedAtomPairs=this.getBondedAtomPairs()}getBondedAtomPairs(){return this.molfileHandler.pairsOfBondedAtoms.map((e=>[e[0],e[1]]))}getBondLines(){const e=/^(M\s+V30\s+\d+\s+\d+\s+)(\d+)(\s+)(\d+)(.*)$/;return this.bondedAtomPairs.map(((t,n)=>{if(t.some((e=>-1===e)))throw new Error(`Bonded pair ${t} contains -1`);return this.rawBondLines[n].replace(e,((e,n,i,r,s,o)=>`${n}${t[0]}${r}${t[1]}${o}`))}))}}class qn extends Fn{constructor(e,t){super(t);const n=It.getInstance(e);this.atoms=new Yn(n),this.bonds=new zn(n),this.rGroups=new Hn(n,this.atoms,this.bonds),this.shiftMonomerToDefaultPosition()}}class Kn{static getInstance(e,t){if(It.isMolfileV2K(e))return new Wn(e,t);if(It.isMolfileV3K(e))return new qn(e,t);throw new Error("Unsupported molfile version")}}class Zn{monomerSymbol;monomerIdx;helm;monomerLib;molfileWrapper;capGroupElements=[];constructor(e,t,n,i,r,s){this.monomerSymbol=e,this.monomerIdx=t,this.helm=n,this.monomerLib=s;const o=this.getLibraryMonomerObject();let a=o.molfile;It.isMolfileV2K(a)&&(a=this.convertMolfileToV3KFormat(a,e,r)),this.molfileWrapper=Kn.getInstance(a,e),this.capGroupElements=this.getCapGroupElements(o),n.bondedRGroupsMap.has(t)&&this.removeRGroups(n.bondedRGroupsMap.get(t)),this.capRemainingRGroups(),this.shiftCoordinates(i)}convertMolfileToV3KFormat(e,t,n){let i=null;try{if(i=n.get_mol(e,JSON.stringify({mergeQueryHs:!0})),i)return i.get_v3Kmolblock();throw new Error(`Cannot convert ${t} to molV3000`)}finally{i?.delete()}}getLibraryMonomerObject(){const e=this.helm.getPolymerTypeByMonomerIdx(this.monomerIdx),t=this.monomerLib.getMonomer(e,this.monomerSymbol);if(!t)throw new Error(`Monomer ${this.monomerSymbol} is not found in the library`);return t}getCapGroupElements(e){return e.rgroups.map((e=>(e.capGroupSmiles||e.capGroupSMILES).replace(/(\[|\]|\*|:|\d)/g,"")))}shiftCoordinates(e){this.molfileWrapper.shiftCoordinates(e)}getAtomLines(){return this.molfileWrapper.getAtomLines()}getBondLines(){return this.molfileWrapper.getBondLines()}removeRGroups(e){this.molfileWrapper.removeRGroups(e)}capRemainingRGroups(){this.molfileWrapper.capRGroups(this.capGroupElements)}replaceRGroupWithAttachmentAtom(e,t){this.molfileWrapper.replaceRGroupWithAttachmentAtom(e,t)}getAttachmentAtomByRGroupId(e){return this.molfileWrapper.getAttachmentAtomByRGroupId(e)}deleteBondLineWithSpecifiedRGroup(e){this.molfileWrapper.deleteBondLineWithSpecifiedRGroup(e)}shiftBonds(e){this.molfileWrapper.shiftBonds(e)}}class Xn{rdKitModule;monomerLib;constructor(e,t,n){this.rdKitModule=t,this.monomerLib=n,this.helm=new Dn(e)}monomerWrappers=[];helm;addMonomer(e,t,n){const i=new Zn(e,t,this.helm,n,this.rdKitModule,this.monomerLib);this.monomerWrappers.push(i)}getAtomNumberShifts(){const e=[];let t=0;return this.monomerWrappers.forEach((n=>{e.push(t),t+=n.getAtomLines().length})),e}restoreBondsBetweenMonomers(){this.helm.bondData.forEach((e=>{const t=e.map((e=>e.monomerIdx)),n=e.map((e=>e.rGroupId)),i=t.map((e=>this.monomerWrappers[e])),r=i[1].getAttachmentAtomByRGroupId(n[1]);i[0].replaceRGroupWithAttachmentAtom(n[0],r),i[1].deleteBondLineWithSpecifiedRGroup(n[1])}))}compileToMolfile(){const e=[],t=[],n=this.getAtomNumberShifts();this.monomerWrappers.forEach(((e,t)=>{e.shiftBonds(n[t])})),this.restoreBondsBetweenMonomers(),this.monomerWrappers.forEach((n=>{e.push(...n.getAtomLines()),t.push(...n.getBondLines())}));const i=e.length,r=t.length;return[this.getV3KHeader(i,r),this.getV3KAtomBlock(e),this.getV3KBondBlock(t),"M V30 END CTAB\nM END"].join("\n")}getV3KHeader(e,t){return`\n Datagrok\n\n 0 0 0 0 0 0 0 0 0 0999 V3000\nM V30 BEGIN CTAB\nM V30 COUNTS ${e} ${t} 0 0 1`}getV3KAtomBlock(e){const t=/^(M V30 )(\d+)( .*)$/;return["M V30 BEGIN ATOM",...e.map(((e,n)=>{const i=n+1;return e.replace(t,((e,t,n,r)=>t+i+r))})),"M V30 END ATOM"].join("\n")}getV3KBondBlock(e){const t=/^(M V30 )(\d+)( .*)$/;return["M V30 BEGIN BOND",...e.map(((e,n)=>{const i=n+1;return e.replace(t,((e,t,n,r)=>t+i+r))})),"M V30 END BOND"].join("\n")}}class Jn{constructor(e){this.molfileHandler=It.getInstance(e)}molfileHandler;get monomerSymbols(){return this.molfileHandler.atomTypes}getMonomerShifts(e){return{x:this.molfileHandler.x[e],y:this.molfileHandler.y[e]}}}class Qn{helmColumn;df;constructor(e,t){this.helmColumn=e,this.df=t,this.helmColumn=e}async convertToSmiles(){const e=await this.getSmilesList(),t=this.df.columns.getUnusedName(`smiles(${this.helmColumn.name})`);return a.Column.fromStrings(t,e.map((e=>null===e?"":e)))}async getSmilesList(){return(await this.convertToMolfileV3KColumn()).toList().map((e=>a.chem.convert(e,a.chem.Notation.MolBlock,a.chem.Notation.Smiles)))}async getMolV3000ViaOCL(e,t){const n=e.map((e=>{if(null===e)return"";const t=e.get_v3Kmolblock();return e.delete(),t})),i=new Array(n.length),r=a.TaskBarProgressIndicator.create("Handling chirality...");for(let e=0;e<n.length;e++){const t=Rn.Molecule.fromMolfile(n[e]).toMolfileV3();i[e]=t.replace("STERAC1","STEABS");const s=e/n.length*100;r.update(s,`${s?.toFixed(2)}% of molecules completed`)}return r.close(),a.Column.fromStrings(t,i)}async convertToRdKitBeautifiedMolfileColumn(e){const t=(await this.convertToMolfileV3KColumn()).toList(),n=await s.functions.call("Chem:getRdKitModule"),i=t.map((e=>{if(""===e)return null;const t=n.get_mol(e);return t?(t.set_new_coords(),t.normalize_depiction(1),t.straighten_depiction(!0),t):null})),r=this.df.columns.getUnusedName(`molfile(${this.helmColumn.name})`);return e?await this.getMolV3000ViaOCL(i,r):a.Column.fromStrings(r,i.map((e=>{if(null===e)return"";const t=e.get_v3Kmolblock();return e.delete(),t})))}async convertToMolfileV3KColumn(){const e=await this.getPolymerGraphColumn(),t=await s.functions.call("Chem:getRdKitModule"),n=(await ui()).getBioLib(),i=e.toList().map(((e,i)=>{const r=this.helmColumn.get(i);if(!r)return"";let s="";try{s=this.getPolymerMolfile(r,e,t,n)}catch(e){const[t,n]=(0,we.AP)(e);ci.logger.error(t,void 0,n)}finally{return s}})),r=this.df.columns.getUnusedName(`molfileV2K(${this.helmColumn.name})`);return a.Column.fromList("string",r,i)}async getPolymerGraphColumn(){return await s.functions.call("HELM:getMolfiles",{col:this.helmColumn})}getPolymerMolfile(e,t,n,i){const r=new Jn(t),s=new Xn(e,n,i);return r.monomerSymbols.forEach(((e,t)=>{const n=r.getMonomerShifts(t);s.addMonomer(e,t,n)})),s.compileToMolfile()}}async function ei(e,t,n){const i=new Qn(t,e),r=await i.convertToRdKitBeautifiedMolfileColumn(n);return r.semType=a.SEMTYPE.MOLECULE,r}class ti{constructor(){this.maxIterations={uiName:"Max iterations",value:0,tooltip:"Maximum iterations for MCL process.Default is \n 0 which will construct the clusters with plain sparse matrix. Values greater than 0 will \n perform MCL with the given number of iterations and will result in trans-cluster activity cliff lines."},this.useWebGPU={uiName:"Use WebGPU",value:!1,tooltip:"Use WebGPU for MCL calculation. (Experimental)",type:"boolean"}}}class ni extends P{constructor(e={}){super({...e,enableMCL:!0});const t=this.tableInput.value.columns.numericalNoDateTime;this.activitiesInput=o.input.column("Activities",{table:this.tableInput.value,value:a.Utils.firstOrNull(t),filter:e=>Array.from(t).includes(e)}),this.activitiesInputRoot=this.activitiesInput.root,this.similarityInput=o.input.int("Similarity cutoff",{value:80}),this.methodsParams[N]=new ti}onTableInputChanged(){if(super.onTableInputChanged(),this.activitiesInputRoot){o.empty(this.activitiesInputRoot);const e=this.tableInput.value.columns.numerical;this.activitiesInput=o.input.column("Activities",{table:this.tableInput.value,value:a.Utils.firstOrNull(e),filter:t=>Array.from(e).includes(t)}),Array.from(this.activitiesInput.root.children).forEach((e=>this.activitiesInputRoot.append(e)))}}getEditor(){return o.div([this.tableInput,this.colInputRoot,this.preprocessingFunctionInputRoot,this.preprocessingFuncSettingsDiv,this.activitiesInputRoot,this.similarityMetricInputRoot,this.methodInput,this.methodSettingsDiv,this.similarityMetricInputRoot,this.similarityInput],{style:{minWidth:"320px"},classes:"ui-form dim-reduction-dialog-form"})}getParams(){return{...super.getParams(),activities:this.activitiesInput.value,similarityThreshold:this.similarityInput.value}}}function ii(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 ri(e,t){return`${t} (${e.length>4?`${e.length} columns`:e.map((e=>e.name)).join(", ")})`}var si=n(6873);class oi{separator;separatorSplitter;splitter;constructor(e){this.separator=e,this.separatorSplitter=(0,xe.dh)(this.separator),this.splitter=this._splitter.bind(this)}_splitter(e){const t=this.separatorSplitter(e);return new ai(t.originals,fe.b9[me.Hi.SEPARATOR])}}class ai extends xe.Mu{seqCList;_canonicals=null;get canonicals(){if(!this._canonicals){const e=this.length;this._canonicals=new Array(e);for(let t=0;t<e;++t)this._canonicals[t]=this.getCanonical(t)}return this._canonicals}getCanonical(e){if(this.isGap(e))return be._S;let t=this.seqCList[e];if(null===t){const n=this.getOriginal(e);t=n,")"===n[n.length-1]&&(t=this.seqCList[e]=n.replace(/\(\d+\)$/,""))}return t}constructor(e,t){super(e,t),this.seqCList=new Array(this.length).fill(null)}}async function li(e,t,n,i){const r=await async function(e,t,n,i){const r=(0,ve.R)(t),s=fe.GO.forColumn(t).getNewColumnFromList("ref",[n]),o=fe.GO.forColumn(s).getSplitted(0),l=i===pe.IDENTITY?function(e,t){const n=t.columns.length,i=new Array(n),r=new Array(n),s=new Array(n);for(let o=0;o<n;++o){const n=t.columns.byIndex(o);i[o]=n.getRawData(),r[o]=n.categories.indexOf("");const a=o<e.length?e.getOriginal(o):be._S;s[o]=n.categories.indexOf(a)}const o=a.Column.float("Identity",t.rowCount),l=o.getRawData();for(let n=0;n<t.rowCount;++n){l[n]=0;for(let t=0;t<e.length;++t)(i[t]?i[t][n]:0)===s[t]&&++l[n];l[n]/=e.length}return o}(o,r):i===pe.SIMILARITY?await async function(e,t){const n=t.columns.toList();return await(0,ye.uL)(n,e)}(o,r):null;if(null===l)throw new Error(`In bio library: Unknown sequence scoring method: ${i}`);return l.name=e.columns.getUnusedName(l.name),e.columns.add(l),l}(e,t,n,i);for(let e=0;e<r.length;e++)t.isNone(e)&&r.set(e,null,!1);return r}const ci=new Mn;async function ui(){return await Ht.getInstance()}let hi=null;class di{_palette;constructor(e){this._palette=e}get(e){return this._palette[e]}}let pi=null;async function mi(){const e="Bio: _package.initBio()";ci.logger.debug(`${e}, start`);const t=await s.functions.call("Chem:getRdKitModule"),n=window.performance.now();await Promise.all([(async()=>{const e=await Ht.getInstance(),t=await(0,xt.ub)();t.explicit&&(t.explicit=[],await(0,xt.Eu)(t)),await e.loadLibraries(),pi=e.getBioLib()})(),(async()=>{const e=await ci.getProperties(),t=new _n(e);ci.properties=t})()]).finally((()=>{ci.completeInit();const t=window.performance.now();ci.logger.debug(`${e}, loading ET: ${t-n} ms`)}));const i=[],r=[],o=pi.getMonomerMolsByPolymerType("PEPTIDE");Object.keys(o).forEach((e=>{i.push(e);const n=o[e].replaceAll("#R","O "),s=t.get_mol(n),a=JSON.parse(s.get_descriptors()).CrippenClogP;r.push(a),s?.delete()}));const a=r.reduce(((e,t)=>e+t),0)/r.length||0,l={};for(let e=0;e<i.length;e++)l[i[e]]=r[e]<a?"#4682B4":"#DC143C";hi=new di(l),ci.logger.debug(`${e}, end`)}function fi(e){const t=new In(e);return t.init().then((()=>{})).catch((e=>{const t=e instanceof Error?e.message:e.toString();s.shell.error(t)})),t}function gi(){return pi}function yi(){return pi}function bi(e){return fe.GO.forColumn(e)}function vi(e){const t="getRegionTopMenu",n=a.Func.find({package:ci.name,name:t});if(1!==n.length)throw new Error(`Package '${ci.name}' func '${t}' not found`);const i=n[0].prepare({table:e.dataFrame,sequence:e});return new Pn(i).widget()}async function wi(e){return async function(){const e=o.label("Manage monomer libraries");return Vt()(e).addClass("d4-link-action"),e.onclick=async()=>await Wt(),new a.Widget(e)}()}function Ci(e){try{new Pn(e).dialog()}catch(e){const t=e instanceof Error?e.message:e.toString(),n=e instanceof Error?e.stack:void 0;s.shell.error(`Get region editor error: ${t}`),ci.logger.error(t,void 0,n)}}function Ai(e){const t=new bn;o.dialog({title:"Split to Monomers"}).add(t.paramsUI).onOK((async()=>e.func.prepare(t.funcParams).call(!0))).show()}function Si(e){const t=new P({semtype:a.SEMTYPE.MACROMOLECULE});o.dialog({title:"Sequence Space"}).add(t.getEditor()).onOK((async()=>{const n=t.getParams();return e.func.prepare({molecules:n.col,table:n.table,methodName:n.methodName,similarityMetric:n.similarityMetric,plotEmbeddings:n.plotEmbeddings,options:n.options,preprocessingFunction:n.preprocessingFunction,clusterEmbeddings:n.clusterEmbeddings}).call()})).show()}function xi(e){const t=new ni({semtype:a.SEMTYPE.MACROMOLECULE});o.dialog({title:"Activity Cliffs"}).add(t.getEditor()).onOK((async()=>{const n=t.getParams();return e.func.prepare({table:n.table,molecules:n.col,activities:n.activities,similarity:n.similarityThreshold,methodName:n.methodName,similarityMetric:n.similarityMetric,preprocessingFunction:n.preprocessingFunction,options:n.options}).call()})).show()}function Ei(){return new Ve}function _i(e){return function(e){const t=Array.from(e.dataFrame.columns).filter((e=>e.semType===a.SEMTYPE.MOLECULE)).map((e=>e.name));new Set(t).delete(e.name);let n=ci.properties?ci.properties.maxMonomerLength:4;if(Te.maxMonomerLength in e.tags){const t=parseInt(e.getTag(Te.maxMonomerLength));n=isNaN(t)?n:t}if(".mm.cellRenderer.maxMonomerLength"in e.temp){const t=parseInt(e.temp[".mm.cellRenderer.maxMonomerLength"]);n=isNaN(t)?n:t}const i=o.input.int("Max Monomer Length",{value:n,nullable:!0,min:1,max:50,step:1,onValueChanged:()=>{if(0==i.value)setTimeout((()=>{i.value=null}),0);else{const t=i.value??"",n=null==t?"":t.toString();e.temp[".mm.cellRenderer.maxMonomerLength"]=n,e.temp[".mm.cellRenderer.settingsChanged"]=ke.true,e.dataFrame.fireValuesChanged()}},tooltipText:"The max length of monomer symbol displayed without shortening, empty to no limit"}),r=o.input.int("Monomer Margin",{value:e.temp[".mm.cellRenderer.gapLength"]??0,onValueChanged:()=>{e.temp[".mm.cellRenderer.gapLength"]=r.value,e.temp[".mm.cellRenderer.settingsChanged"]=ke.true,e.dataFrame.fireValuesChanged()},tooltipText:"The size of margin between monomers (in pixels)"}),s=o.input.bool("Color Code",{value:null==e?.temp["color-code"]||e.temp["color-code"],onValueChanged:()=>{e.temp["color-code"]=s.value,e.dataFrame.fireValuesChanged()},tooltipText:"Color code"}),l=o.input.string("Reference Sequence",{value:null!=e?.temp["reference-sequence"]?e?.temp["reference-sequence"]:"",nullable:!0,onValueChanged:()=>{e.temp["reference-sequence"]=l.value,e.dataFrame.fireValuesChanged()},tooltipText:"Reference sequence is not empty, then the sequence will be render \nas a difference from the reference sequence"}),c=o.input.bool("Compare with current",{value:null==e?.temp["compare-with-current"]||e.temp["compare-with-current"],onValueChanged:()=>{e.temp["compare-with-current"]=c.value,e.dataFrame.fireValuesChanged()},tooltipText:'When on, all sequences get rendered in the "diff" mode'}),u=o.inputs([i,r,l,s,c]);return new a.Widget(u)}(e)}function Mi(e){return(0,Tn.j)(e)}function Ti(){return new Ve}function Ii(){return new je}function Li(e,t,n,i,r){const s=new it.$(i,r,n,t);return"Local alignment"==e?s.smithWaterman():s.needlemanWunch()}function Ni(){return new Xe.oP}function $i(){return new nt}function Pi(e,t,n,i){return Ln(e,t??null,n??null,i??null)}async function Oi(e,t,n,i,r){const o=Ln(t,n??null,i??null,r??null);t.dataFrame.columns.add(o),await s.data.detectSemanticTypes(t.dataFrame)}async function Ri(e,t,n,i,r,u,h,d){if(!(0,mn.V)(t,"Activity Cliffs"))return;const p=ii(e),m={units:t.meta.units,aligned:t.getTag(me.gp.aligned),separator:t.getTag(me.gp.separator),alphabet:t.getTag(me.gp.alphabet)},f=u,g=t,y=async()=>await de(e,g,p,"Activity cliffs",n,i,f,r,{...d??{}},a.SEMTYPE.MACROMOLECULE,m,h,lt,ct,pt),b=r===c.c.UMAP?2e5:2e4,v=r===c.c.UMAP?5e3:2e3;if(e.rowCount>b)return void s.shell.warning(`Too many rows, maximum for sequence activity cliffs is ${b}`);const w=a.TaskBarProgressIndicator.create("Running sequence activity cliffs ...");return new Promise(((t,n)=>{e.rowCount>v&&!d?.[l.vb]?o.dialog().add(o.divText("Activity cliffs analysis might take several minutes.\n Do you want to continue?")).onOK((async()=>{y().then((e=>t(e))).catch((e=>n(e)))})).onCancel((()=>{t(void 0)})).show():y().then((e=>t(e))).catch((e=>n(e)))})).catch((e=>{const[t,n]=(0,we.AP)(e);throw ci.logger.error(t,void 0,n),e})).finally((()=>{w.close()}))}async function ki(e,t,n=1,i=.6,r="Morgan"){if(e.semType!==a.SEMTYPE.MACROMOLECULE)return{entries:e.toList(),options:{}};const{seqList:s,options:o}=await st(e,t,r);return{entries:s,options:{...o,gapOpen:n,gapExtend:i}}}async function Gi(e,t){e.version!==e.temp["last-invalidated-version"]&&await(0,at.BQ)(e,!1);const n=e.temp["monomeric-mols"],i=await s.functions.call("Chem:getMorganFingerprints",{molColumn:n}),r=new Array(i.length).fill(null);for(let e=0;e<i.length;e++){if(i.isNone(e)||!i.get(e))continue;const t=i.get(e);r[e]=V.A.fromUint32Array(t.length,new Uint32Array(t.getBuffer().buffer))}return{entries:r,options:{}}}async function Di(e,t,i,r,c,u,h,d){if((0,mn.V)(t,"Sequence Space"))return u||(u=a.Func.find({name:"macromoleculePreprocessingFunction",package:"Bio"})[0]),h??={},await async function(e,t,i,r,c,u,h,d=!0,p=!1,m={preprocessingFuncArgs:[]},f={},g=null,y={}){const b={showXAxis:!1,showYAxis:!1,showXSelector:!1,showYSelector:!1};if(t.length!==r.length||t.length!==u.length||t.length!==c.length||t.length!==m.preprocessingFuncArgs.length)throw new Error("columns, metrics and preprocessing functions, weights and function argumentsmust have the same length");const v=d?s.shell.tableView(e.name)??s.shell.addTableView(e):null,w=async()=>{const w=a.TaskBarProgressIndicator.create(`Initializing ${f.scatterPlotName??"dimensionality reduction"} ...`);let C;try{const A=ii(e);function S(n,r,s){let c=null,u=null;e.columns.names().includes(A[0])?(c=e.columns.byName(A[0]),u=e.columns.byName(A[1])):(c=e.columns.add(a.Column.float(A[0],e.rowCount)),u=e.columns.add(a.Column.float(A[1],e.rowCount)),d&&!C&&(C=v.scatterPlot({...b,x:A[0],y:A[1],title:f.scatterPlotName??ri(t,i)}))),f[l.YP]&&(C?.root&&o.setUpdateIndicator(C.root,!1),c.init((e=>s[0]?s[0][e]:void 0)),u.init((e=>s[1]?s[1][e]:void 0)));const h=n/r*100;w.update(h,`Running ${f.scatterPlotName??"dimensionality reduction"}... ${h.toFixed(0)}%`)}async function x(){e.columns.add(a.Column.float(A[0],e.rowCount)),e.columns.add(a.Column.float(A[1],e.rowCount));let n=null;d&&(C=v.scatterPlot({...b,x:A[0],y:A[1],title:f.scatterPlotName??ri(t,i)}),o.setUpdateIndicator(C.root,!0));const p=s.events.onViewerClosed.subscribe((e=>{const t=e.args.viewer;t?.getOptions()?.look?.title&&C?.getOptions()?.look?.title&&t?.getOptions()?.look?.title===C?.getOptions()?.look?.title&&(s.events.fireCustomEvent(U,{}),p.unsubscribe(),n?.(),w.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 i=n.inputs[0].name,o=n.inputs[1].name,{entries:a,options:l}=await n.apply({[i]:t[e],[o]:r[e],...m.preprocessingFuncArgs[e]??{}});s.push({entries:a,options:l}),m.distanceFnArgs.push(l)}else{const n=t[e].toList(),i={};s.push({entries:n,options:i}),m.distanceFnArgs.push(i)}}e(await q(s.map((e=>e.entries)),i,r,c,h,m,f[l.vb]?void 0:S))}catch(e){s(e)}})),y=await g;return w.close(),p.unsubscribe(),y}const E=await x();if(p&&E){const _=a.TaskBarProgressIndicator.create("Clustering embeddings ...");try{const M=await function(e,t,i,r){return ln(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:r,epsilon:i}),a.onmessage=({data:{error:e,clusters:t}})=>{a.terminate(),e?o(e):s(t)}}))}))}(E[0],E[1],m.dbScanEpsilon??.01,m.dbScanMinPts??4),T=e.columns.getUnusedName("Cluster (DBSCAN)");e.columns.addNewString(T).init((e=>M[e].toString())),C&&(C.props.colorColumnName=T)}catch(I){s.shell.error("Clustering embeddings failed"),console.error(I)}finally{_.close()}}if(E){const L=e.columns.byName(A[0]),N=e.columns.byName(A[1]);if(L.init((e=>E[0][e])),N.init((e=>E[1][e])),g)try{const $=g.inputs[0].name,P=g.inputs[1].name;await g.prepare({[$]:L,[P]:N,...y}).call(!0)}catch(O){s.shell.error("Post-processing failed"),console.error(O)}if(C)return o.setUpdateIndicator(C.root,!1),C.helpUrl="/help/compute/sequence-space",C}}catch(R){s.shell.error("Dimensionality reduction failed"),console.error(R),w.close(),C&&o.setUpdateIndicator(C.root,!1)}};return new Promise((async(t,n)=>{try{if(f.fastRowCount&&e.rowCount>f.fastRowCount&&!f[l.vb])o.dialog().add(o.divText("Analysis might take several minutes. Do you want to continue?")).onOK((async()=>{try{const e=await w();t(e)}catch(e){n(e)}})).onCancel((()=>t(void 0))).show();else{const e=await w();t(e)}}catch(e){n(e)}}))}(e,[t],i,[r],[1],[u],"MANHATTAN",c,d??!1,{...h,preprocessingFuncArgs:[h.preprocessingFuncArgs??{}]},{fastRowCount:1e4,scatterPlotName:"Sequence space",bypassLargeDataWarning:h?.[l.vb]})}async function Fi(e,t,n){const i=a.TaskBarProgressIndicator.create("Converting to atomic level ...");try{const i=(await ui()).getBioLib();await async function(e,t,n,i){if(0===a.Func.find({package:"Chem",name:"getRdKitModule"}).length)return void s.shell.warning('Transformation to atomic level requires package "Chem" installed.');if(n){const n=fe.GO.forColumn(t);return n.isHelm()||(t=n.convert(me.Hi.HELM)),async function(e,t){const n=await ei(e,t);e.columns.add(n,!0),await s.data.detectSemanticTypes(e)}(e,t)}if(!(0,mn.V)(t,"To Atomic Level"))return;const r=await(0,On.C4)(e,t,i);null!==r.col&&(e.columns.add(r.col,!0),await s.data.detectSemanticTypes(e)),r.warnings&&r.warnings.length>0&&s.shell.warning(o.list(r.warnings))}(e,t,n,i)}finally{i.close()}}function Hi(){(0,gn.D)().catch((e=>{const[t,n]=(0,we.AP)(e);if(e instanceof fn.Ap)return s.shell.warning(e.element),void ci.logger.warning(t);s.shell.error(t),ci.logger.error(t,void 0,n)}))}async function Bi(e=null,t=null){return(0,gn.D)({col:e,clustersCol:t})}async function Vi(){const e=s.shell.tv,t=e.dataFrame.columns.toList().filter((e=>e.semType==a.SEMTYPE.MACROMOLECULE&&(fe.GO.forColumn(e),!0))),n=async t=>{if(!(0,mn.V)(t,"Composition"))return;const n=e.addViewer("WebLogo",{sequenceColumnName:t.name});s.shell.tv.dockManager.dock(n,a.DOCK_TYPE.DOWN,null,"Composition analysis",.25)};let i=null;if(0!=t.length){if(t.length>1){const e=t.map((e=>e.name)),i=t.find((e=>fe.GO.forColumn(e).isMsa())),r=o.input.choice("Column",{value:i?i.name:e[0],items:e});o.dialog({title:"Composition Analysis",helpUrl:"https://datagrok.ai/help/datagrok/solutions/domains/bio/#sequence-composition"}).add(o.div([r])).onOK((async()=>{const e=t.find((e=>e.name==r.value))??null;e&&await n(e)})).show()}else i=t[0];i&&await n(i)}else s.shell.error("Current table does not contain sequences")}function ji(e){return new ge.m(e).importFasta()}function Ui(e){return console.log(e),[]}function Wi(){const e=(0,Ce.m)()[0];(0,Ct.C)(e)}function Yi(){return new xn}async function zi(e){const t=a.TaskBarProgressIndicator.create("Test detectMacromolecule..."),n=(await s.dapi.files.list(e,!0,"")).filter((e=>e.fileName.endsWith(".csv")));let i=0;const r=[];for(const o of n)try{const t=await s.dapi.files.readAsText(e+o.fullPath),n=a.DataFrame.fromCsv(t);for(const e of n.columns)await s.functions.call("Bio:detectMacromolecule",{col:e})===a.SEMTYPE.MACROMOLECULE&&r.push({file:o.path,result:"detected",column:e.name,message:`units: ${e.meta.units}`})}catch(e){r.push({file:o.path,result:"error",column:null,message:e instanceof Error?e.message:e.toString()})}finally{i+=1,t.update(100*i/n.length,`Test ${o.fileName}`)}s.shell.info("Test Demo:Files for detectMacromolecule finished."),t.close();const o=a.DataFrame.fromObjects(r);return o.name=`datasets_detectMacromolecule_${e}`,o}async function qi(e,t){await(0,vn.k)(e,t)}function Ki(e){const t=fe.GO.forColumn(e).stats;return Object.keys(t.freq)}function Zi(){return new bt}function Xi(){const e=s.shell.v,t=e.addViewer("Sequence Similarity Search");e.dockManager.dock(t,"down")}function Ji(){return new vt}function Qi(){const e=s.shell.v,t=e.addViewer("Sequence Diversity Search");e.dockManager.dock(t,"down")}function er(e){const t=(0,Ce.m)();1===t.length?e.func.prepare({macromolecules:t[0]}).call(!0):new at.a7(t)}function tr(e){s.shell.tv.getFiltersGroup({createDefaultFilters:!1}).updateOrAdd({type:"Bio:bioSubstructureFilter",column:e.name,columnName:e.name}),s.shell.tv.grid.scrollToCell(e,0)}async function nr(e,t,n){return li(e,t,n,pe.IDENTITY)}async function ir(e,t,n){return li(e,t,n,pe.SIMILARITY)}async function rr(){Wt()}function sr(){(0,At.TE)()}function or(){return new St._i}async function ar(){const e=a.TaskBarProgressIndicator.create("WebLogo");try{const e=new URLSearchParams(window.location.search),t=new yn(e,"webLogoLargeApp"),n=await ci.files.readCsv("data/sample_PT_100000x5.csv");await s.data.detectSemanticTypes(n),await t.init(n)}finally{e.close()}}async function lr(){const e=a.TaskBarProgressIndicator.create("WebLogo ...");try{const e=new URLSearchParams(window.location.search),t=new yn(e,"webLogoAggApp"),n=await ci.files.readCsv("samples/FASTA_PT_activity.csv");await s.data.detectSemanticTypes(n),await t.init(n)}finally{e.close()}}async function cr(){const e=a.TaskBarProgressIndicator.create("getRegion ...");try{const e=new URLSearchParams(window.location.search),t=new $n(e,"getRegionApp");await t.init()}finally{e.close()}}async function ur(){const e=a.TaskBarProgressIndicator.create("getRegion ...");try{const e=new URLSearchParams(window.location.search),t=await ci.files.readCsv("samples/HELM_empty_vals.csv"),n=new $n(e,"getRegionHelmApp");await n.init({df:t,colName:"HELM"})}finally{e.close()}}function hr(){const e=a.DataFrame.fromColumns((0,si.dW)());s.shell.addTableView(e)}function dr(){const e=a.DataFrame.fromColumns([(0,si.Hx)(me.Hi.FASTA)]);s.shell.addTableView(e)}function pr(){const e=a.DataFrame.fromColumns([(0,si.Hx)(me.Hi.HELM)]);s.shell.addTableView(e)}function mr(e,t){!function(e,t){const n=fe.GO.forColumn(e.column),i=Object.values(me.Hi).filter((e=>e!==n.units));t.group("Copy").items(i,(t=>{const n=e.column,i=e.rowIndex,r=fe.GO.forColumn(n),o=t===me.Hi.SEPARATOR?ci.properties.defaultSeparator:void 0,a=r.getJoiner({notation:t,separator:o})(r.getSplitted(i));navigator.clipboard?(navigator.clipboard.writeText(a),s.shell.info(`Value of notation '${t}' copied to clipboard`)):s.shell.warning("The clipboard functionality requires a secure origin — either HTTPS or localhost")}))}(e,t)}async function fr(){await async function(){let e,t;try{const n=new Xt("Similarity, Diversity","Sequence similarity tracking and evaluation dataset diversity",!1,{autoStartFirstStep:!0});await n.step("Load DNA sequences",(async()=>{s.shell.windows.showContextPanel=!1,s.shell.windows.showProperties=!1,t=await ci.files.readCsv(Qt),e=s.shell.addTableView(t),e.grid.columns.byName("cluster").visible=!1,e.grid.columns.byName("sequence_id").visible=!1,e.grid.columns.byName("sequence").width=300,e.grid.columns.byName("activity").visible=!1,e.grid.columns.byName("is_cliff").visible=!1}),{description:"Load dataset with macromolecules of 'fasta' notation, 'DNA' alphabet.",delay:2e3}).step("Find the most similar sequences to the current one",(async()=>{const n=await t.plot.fromType("Sequence Similarity Search",{moleculeColumnName:"sequence",similarColumnLabel:"Similar to current"});e.dockManager.dock(n,a.DOCK_TYPE.RIGHT,null,"Similarity search",.35)}),{description:"Add 'Sequence Similarity Search' viewer.",delay:2e3}).step("Explore most diverse sequences in a dataset",(async()=>{const n=await t.plot.fromType("Sequence Diversity Search",{moleculeColumnName:"sequence",diverseColumnLabel:"Top diverse sequences of all data"});e.dockManager.dock(n,a.DOCK_TYPE.DOWN,null,"Diversity search",.27)}),{description:"Add 'Sequence Deversity Search' viewer.",delay:2e3}).step("Choose another sequence for similarity search",(async()=>{t.currentRowIdx=3}),{description:"Handling current row changed of data frame showing update of similar sequences.",delay:2e3}).step("One more sequence for similarity search",(async()=>{t.currentRowIdx=7}),{description:"Just one more sequence to search similar ones.",delay:2e3}).start()}catch(e){Jt(e)}}()}async function gr(){await async function(){let e,t,n,i,r;try{const o=new Xt("Sequence Space","Exploring sequence space of Macromolecules, comparison with hierarchical clustering results",!1,{autoStartFirstStep:!0});await o.step("Load DNA sequences",(async()=>{[i,e,t]=await Promise.all([ci.files.readCsv(cn),en(),tn()]),n=s.shell.addTableView(i),n.grid.props.rowHeight=22,n.grid.columns.byName("cluster").visible=!1,n.grid.columns.byName("sequence").width=200,n.grid.columns.byName("is_cliff").visible=!1,s.shell.windows.showContextPanel=!1,s.shell.windows.showProperties=!1}),{description:"Load dataset with macromolecules of 'fasta' notation, 'DNA' alphabet.",delay:2e3}).step("Build sequence space",(async()=>{r=await async function(e,t,n){let i;{const e=Object.values(Kt);for(let n=0;n<e.length;n++){const i=e[n];if(!t.col(i)){const r=n==e.length-1;t.columns.add(a.Column.float(i,t.rowCount),r)}}if(t.rowCount>=1){const i=t.getCol(n).toList(),r=Date.now();ci.logger.debug("Bio: demoBio01aUI(), calc reduceDimensionality start...");const s=await q([i],"UMAP",[ot.xL.Levenshtein],[1],"MANHATTAN",{distanceFnArgs:[{}]}),o=Date.now();ci.logger.debug(`Bio: demoBio01aUI(), calc reduceDimensionality ET: ${(o-r)/1e3} s`);for(let n=0;n<e.length;n++){const i=e[n],r=t.getCol(i),o=s[n];r.init((e=>o[e]))}const a=Date.now();ci.logger.debug(`MLB: MlbVrSpaceBrowser.buildView(), postprocess reduceDimensionality ET: ${(a-o)/1e3} s`)}i=await t.plot.fromType(a.VIEWER.SCATTER_PLOT,{xColumnName:Kt.X,yColumnName:Kt.Y,lassoTool:!0})}return e.dockManager.dock(i,a.DOCK_TYPE.RIGHT,null,"Sequence Space",.35),i}(n,i,un),r.setOptions({color:"activity"})}),{description:"Reduce sequence space dimensionality to display on 2D representation.",delay:2e3}).step("Cluster sequences",(async()=>{const r=await e.calcDistanceMatrix(i,[un]),s=await rn(r.data,i.rowCount,1),o=e.parseClusterMatrix(s);t.injectTreeForGrid(n.grid,o,void 0,150,void 0)}),{description:"Perform hierarchical clustering to reveal relationships between sequences.",delay:2e3}).step("Select a sequence",(async()=>{i.selection.set(65,!0)}),{description:"Handling selection of data frame row reflecting on linked viewers.",delay:2e3}).step("Select a bunch of sequences",(async()=>{[67,72,77,82,83,84,85,91,93].forEach((e=>i.selection.set(e,!0))),i.currentRowIdx=27}),{description:"Selecting a group of rows from a data frame to show their similarity and proximity to each other on a viewer..",delay:2e3}).start()}catch(e){Jt(e)}}()}async function yr(){await async function(){let e,t,n,i,r;const o=c.c.UMAP;try{const l=new Xt("Activity Cliffs","Activity Cliffs analysis on Macromolecules data",!1,{autoStartFirstStep:!0});await l.step("Load DNA sequences",(async()=>{s.shell.windows.showContextPanel=!1,s.shell.windows.showProperties=!1,[n,e,t]=await Promise.all([ci.files.readCsv(hn),en(),tn()]),i=s.shell.addTableView(n),i.grid.props.rowHeight=22,i.grid.columns.byName("cluster").visible=!1,i.grid.columns.byName("sequence").width=300,i.grid.columns.byName("is_cliff").visible=!1}),{description:"Load dataset with macromolecules of 'fasta' notation, 'DNA' alphabet.",delay:2e3}).step("Find activity cliffs",(async()=>{const e=a.Func.find({name:"macromoleculePreprocessingFunction",package:"Bio"})[0];r=await Ri(n,n.getCol("Sequence"),n.getCol("Activity"),80,o,rt.Z.LEVENSHTEIN,e,{}),i.dockManager.dock(r,a.DOCK_TYPE.RIGHT,null,"Activity Cliffs",.35),Vt()(r.root).find("button.scatter_plot_link,cliffs_grid").get()[0].click()}),{description:"Reveal similar sequences with a cliff of activity.",delay:2e3}).step("Cluster sequences",(async()=>{const r=a.TaskBarProgressIndicator.create("Running sequence clustering..."),s=await e.calcDistanceMatrix(n,["sequence"]),o=await rn(s.data,n.rowCount,1),l=e.parseClusterMatrix(o);r.close(),t.injectTreeForGrid(i.grid,l,void 0,150,void 0),i.grid.columns.byName("Activity").scrollIntoView()}),{description:"Perform hierarchical clustering to reveal relationships between sequences.",delay:2e3}).step("Browse the cliff",(async()=>{const e=r.dataFrame.temp[".cliffsDfGrid"];e.dataFrame.rowCount>0&&(e.dataFrame.currentRowIdx=0)}),{description:"Zoom in to explore selected activity cliff details.",delay:2e3}).start()}catch(e){Jt(e)}}()}async function br(){await async function(){const e="HELM";let t,n,i;try{await new Xt("Atomic Level","Atomic level structure of Macromolecules",!1,{autoStartFirstStep:!0}).step("Loading Macromolecules notation 'Helm'",(async()=>{s.shell.windows.showContextPanel=!1,s.shell.windows.showProperties=!1,t=await ci.files.readCsv("samples/HELM.csv"),n=s.shell.addTableView(t);for(let t=0;t<n.grid.columns.length;t++){const i=n.grid.columns.byIndex(t);[e,"Activity"].includes(i.name)||(i.visible=!1)}}),{description:"Load dataset with macromolecules of 'fasta' notation, 'PT' alphabet (protein, aminoacids).",delay:2e3}).step("To atomic level",(async()=>{const n=t.getCol(e);await Fi(t,n,!1)}),{description:"Get atomic level structures of Macromolecules.",delay:2e3}).step("Sketcher",(async()=>{const n=`molfile(${e})`;t.currentCell=t.cell(1,n);const r=t.currentCell.value,s=new a.chem.Sketcher(a.chem.SKETCHER_MODE.INPLACE);s.setMolFile(r),i=o.dialog().add(s).show(),await(0,ze.cb)(3e3),i.close()}),{description:"Display atomic level structure within a sketcher.",delay:2e3}).start()}catch(e){Jt(e)}}()}async function vr(){await async function(){let e,t,n,i,r,o;const l="msa(HELM)",h=c.c.UMAP,d=(await dn.Nk.getDockerContainer()).id,p=dn.Nk.getDockerContainer();let m,f;try{const c=new Xt("Helm, MSA, Sequence Space","MSA and composition analysis on Helm data",!1,{autoStartFirstStep:!0});await c.step("Load peptides with non-natural aminoacids in 'HELM' notation",(async()=>{[m,t]=await Promise.all([(async()=>(await p).status)(),ci.files.readCsv(pn)]),e=s.shell.addTableView(t),s.shell.windows.showContextPanel=!1,s.shell.windows.showProperties=!1,"started"===m||"checking"===m?(ci.logger.debug(`demoBio05UI(), PepSeA ('${dn.Nk.dcName}') docker container status = '${m}'.`),f=Promise.resolve()):(ci.logger.warning(`demoBio05UI(), PepSeA ('${dn.Nk.dcName}') docker container is trying to start...`),await s.dapi.docker.dockerContainers.run(d),f=async function(e,t,n=3e4,i){const r=window.performance.now(),o=new u.Subject,a=async()=>{const n=await s.dapi.docker.dockerContainers.find(e);return n.status===t&&o.next(n),n};let l;try{await(0,ze.PE)(o,(e=>{const n=window.performance.now();i.debug(`awaitStatus(), docker container ('${e.name}') GET status = '${t}' in ${n-r} ms.`)}),(async()=>{const e=await a();i.debug(`awaitStatus(), docker container ('${e.name}') HAS status = '${e.status}'.`),l=window.setInterval(a,200)}),n)}finally{window.clearInterval(l)}}(d,"started",3e4,ci.logger))}),{description:"Load dataset with macromolecules of 'Helm' notation.",delay:2e3}).step("Align peptides with non-natural aminoacids with PepSeA",(async()=>{const e=a.TaskBarProgressIndicator.create("MSA by PepSeA ...");try{await f,n=t.getCol("HELM");const e=dn.ZY[0],r=1.53,o=0;if(i=await(0,dn.GD)(n,l,e,r,o,void 0),!i)throw new Error("Empty MSA result.");t.columns.add(i),await s.data.detectSemanticTypes(t)}finally{e.close()}}),{description:"Multiple sequence alignment (MSA) performed with PepSeA tool operating on non-natural aminoacids as well.",delay:2e3}).step("Build sequence space",(async()=>{const n=a.Func.find({package:"Bio",name:"macromoleculePreprocessingFunction"})[0];o=await Di(t,i,h,rt.Z.LEVENSHTEIN,!0,n),e.dockManager.dock(o,a.DOCK_TYPE.RIGHT,null,"Sequence Space",.35)}),{description:"Reduce sequence space dimensionality to display on 2D representation.",delay:2e3}).step("Analyse sequence composition",(async()=>{r=await t.plot.fromType("WebLogo",{sequenceColumnName:l,positionWidth:40,maxHeight:50}),e.dockManager.dock(r,a.DOCK_TYPE.DOWN,null,"Composition analysis",.2)}),{description:"Composition analysis allows to reveal functional features of sequences like motifs, or variable loops.",delay:2e3}).start()}catch(e){Jt(e)}}()}async function wr(e){const t=(0,ye.uX)(e),n=JSON.stringify(t);a.Utils.download(`${e.name}.json`,n)}async function Cr(e,t,n){const i=await e.readAsString();await async function(e,t,n){const i=a.TaskBarProgressIndicator.create("detectMacromolecule probe ...");try{let r=0;const o=await s.functions.call("Bio:detectMacromoleculeEnableStore");let l=0;for(let c=0;c<n;++c){const u=a.DataFrame.fromCsv(e),h=t?u.getCol(t):u.columns.byIndex(0);await s.functions.call("Bio:detectMacromolecule",{col:h})!==a.SEMTYPE.MACROMOLECULE&&(++l,console.warn(`Reject reason: ${o.last.rejectReason}`));const d=c/n;d-r>=.1&&(r=d,i.update(100*d,`detectMacromolecule probe ${l}/${c}/${n} ...`),await(0,ze.cb)(0))}l>0?s.shell.warning(`detectMacromolecule failed ${l} / ${n}`):s.shell.info(`detectMacromolecule success ${n}`)}finally{i.close()}}(i,t,n)}async function Ar(e,t,n){return ei(e,t,n)}function Sr(e,t){e.temp[fe.j8.notationProvider]=new oi(t)}},6625:(e,t,n)=>{"use strict";n.d(t,{$:()=>s});class i{value;parentI;parentJ;constructor(){this.value=0,this.parentI=0,this.parentJ=0}}class r{seq1;seq2;score;constructor(e,t,n){this.seq1=e,this.seq2=t,this.score=n}}class s{seq1="";seq2="";gap=1;len1=0;len2=0;step=1;alignGrid=[];scores=[];dpGrid=[];connections={};BLOSUM45=[[5,-2,-1,-2,-1,-1,-1,0,-2,-1,-1,-1,-1,-2,-1,1,0,-2,-2,0,-1,-1,0,-5],[-2,7,0,-1,-3,1,0,-2,0,-3,-2,3,-1,-2,-2,-1,-1,-2,-1,-2,-1,0,-1,-5],[-1,0,6,2,-2,0,0,0,1,-2,-3,0,-2,-2,-2,1,0,-4,-2,-3,4,0,-1,-5],[-2,-1,2,7,-3,0,2,-1,0,-4,-3,0,-3,-4,-1,0,-1,-4,-2,-3,5,1,-1,-5],[-1,-3,-2,-3,12,-3,-3,-3,-3,-3,-2,-3,-2,-2,-4,-1,-1,-5,-3,-1,-2,-3,-2,-5],[-1,1,0,0,-3,6,2,-2,1,-2,-2,1,0,-4,-1,0,-1,-2,-1,-3,0,4,-1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6,-50,-13.6,-50,-11.9,-5.6,-8.8,-7.2,-8.9,-50,-12.4,-14.1,-11.6,2.8,-6.4,.5,-5.2],[-13,-7.9,-13.2,-9.5,-4.6,-1.2,-4.1,-3.4,-12.5,-6.3,-12.5,-8.5,9.6,12.7,.2,10.5,-12.4,-11.6,-13.2,-12,-12.4,-10.1,-11.6,-12,-15.1,-13.1,-14.3,-13.4,-1.4,1.4,-1.6,-.5,-14.9,-14.3,-15.2,-16.8,-7.7,-4.7,-6.3,-6.6,-14.6,-10.8,-12.8,-13,2.3,6,2.5,3.6,-50,-11.2,-50,-11.9,-10.5,-9.2,-10.5,-10.5,-50,-10.3,-16.2,-11.3,-1.7,-3.7,-2.5,-5.4],[-7.1,-9.9,-5.7,-9,-.4,-3,.9,-2.3,-7.2,-8.3,-5.3,-8,3.5,.2,14.3,1,-7.3,-11.2,-6.9,-9.7,-8.5,-10.2,-7.7,-9.8,-10,-10.4,-8.4,-10.2,1,-.6,1.7,-.5,-11.1,-14.8,-9.7,-14.5,-3.7,-5.8,-3.1,-5.6,-10.4,-11.5,-8.2,-11.1,.6,-1.6,1.6,-1.1,-50,-12.4,-50,-11.5,-5.5,-8,-4.9,-7.2,-50,-12.4,-10.3,-11.6,.7,-6.8,2.4,-6],[-11.5,-9.6,-12.6,-7,-3.6,-3.3,-3.5,-.6,-11.6,-7.7,-11.9,-5.3,9.7,10.5,1,12.6,-12,-12.2,-12.5,-9.7,-11.1,-11.2,-11.9,-9.4,-12.9,-14.3,-14,-11.9,-1,-.4,-1.6,1.2,-13.9,-15.4,-13.7,-12.6,-6.2,-6.7,-6.3,-4.4,-13,-12.2,-13,-10.4,2.9,3.8,2.5,5.8,-50,-12.5,-50,-10.2,-9.6,-9.7,-9.6,-8.3,-50,-11.6,-15.4,-9.4,-1.1,-5.4,-1.6,-3.3],[.4,-5,-1.5,-4,-4.8,-7.6,-5.9,-6.5,-.7,-6.1,-2.2,-5.6,-8.7,-12.4,-7.3,-12,12.8,2.3,10.2,3,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-2.4,-3.9],[-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,33.3,-50,30.6,-50,-50,-50,-50,-50,29.2,-50,-50,-50,-50,-50,-50,-50],[-14.8,-6.2,-14.9,-7.6,-14.6,-11.6,-13,-12.2,-14,-9,-14.1,-10.1,-13.6,-11.2,-12.4,-12.5,-8.1,2.2,-8.7,.4,-15.3,-11.3,-13.2,-13.3,-11.9,-7.2,-11.8,-7.9,-10.7,-7.4,-10.8,-8.9,-15.5,-10.3,-15.5,-12.5,-14.5,-12.1,-11.9,-12.8,-18.3,-12.7,-16.4,-14.7,-14.2,-10.4,-13.7,-13,-50,15.1,-50,13.3,-9.9,-5.8,-8.9,-7.6,-50,-1.5,-7.8,-3,-8.1,3.6,-9.4,2],[-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,30.6,-50,35.2,-50,-50,-50,-50,-50,28.5,-50,-50,-50,-50,-50,-50,-50],[-13.8,-7.5,-14.4,-5.1,-12.6,-11.6,-11.5,-10.1,-13.2,-9.7,-12.7,-7.4,-11.9,-11.9,-11.5,-10.2,-7.2,.9,-8.6,2.6,-14.1,-12.8,-13.3,-11,-9.7,-8.4,-11.2,-5.3,-9.3,-8.7,-9.9,-7.1,-13.9,-11.2,-14.2,-8.9,-12.9,-12.6,-12.6,-10.9,-15.4,-13.8,-14.8,-11.4,-12.8,-11.6,-13.2,-10.3,-50,13.3,-50,15.2,-8.6,-7,-8.4,-4.8,-50,-3,-7.1,-.1,-7.3,2.3,-8.7,3.9],[-7.3,-6.3,-8.9,-5.5,2.9,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6.5,-7.4,-7.5,-5.4,-50,-7.6,-50,-4.8,9.8,10,10.2,12.1,-50,-3.1,-11.4,-.7,-4.6,-6.6,-4.9,-3.9],[-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,29.2,-50,28.5,-50,-50,-50,-50,-50,33.3,-50,-50,-50,-50,-50,-50,-50],[-13,-7,-13.1,-8.3,-9.2,-6.5,-8.9,-7.6,-9.8,-.7,-9.2,-2.1,-12.4,-10.3,-12.4,-11.6,-9.5,-4.6,-10.4,-5.7,-13.6,-10.1,-11.4,-10.9,-6.5,-1.5,-6.2,-3.6,-12.8,-8,-12.3,-9.7,-16.5,-12.7,-15.6,-14.3,-8.7,-6,-7.1,-7.5,-9.5,-4.1,-8.4,-6.1,-11,-8.6,-11.3,-9.3,-50,-1.5,-50,-3,-4.8,-1.5,-4.2,-3.1,-50,16.4,-5.1,14.2,-10.1,-4.3,-10,-5.4],[-13.5,-16.3,-11.8,-15.5,-13.6,-15.3,-12.1,-16.1,-7.7,-13.3,-4.2,-12.6,-14.1,-16.2,-10.3,-15.4,-9.6,-11.6,-7.7,-9.8,-14.3,-17.5,-11.1,-17.2,-5.3,-7.1,-2.2,-7.1,-9.6,-11.9,-8.7,-11.4,-17.1,-20.6,-15.3,-19.9,-14.1,-14.8,-12.4,-16.5,-11.7,-12.8,-6.4,-13.4,-14.3,-15.7,-12.7,-14,-50,-7.8,-50,-7.1,-8.7,-11.3,-6.1,-11.4,-50,-5.1,18.6,-4.8,-8.6,-8.1,-4.5,-7.3],[-12.4,-8.2,-13,-5.9,-7.7,-7.8,-7.4,-5.8,-8.8,-2,-9.3,-.4,-11.6,-11.3,-11.6,-9.4,-8.9,-5.6,-10,-3.2,-11.5,-11.1,-10.5,-8.3,-6.3,-4.9,-6.7,-1.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,-50,-10,-4.5,-8.9,9.7,-1.8,11.3,-.9],[-17.2,-13.3,-17.8,-11.6,-11,-11.1,-10.4,-9,-16,-12.7,-16.1,-11.1,-5.2,-5.4,-6,-3.3,-11.8,-7.3,-13.3,-5.9,-12.7,-11.9,-11.9,-9.3,-15.2,-15,-14.9,-11,-2.8,-1.8,-2.9,.4,-17.4,-18.4,-18.3,-15.9,-10.7,-11.2,-10.6,-9,-15.4,-14.8,-15.8,-13.3,-6.8,-5.9,-7.2,-3.9,-50,2,-50,3.9,-7,-6.8,-6.8,-3.9,-50,-5.4,-7.3,-3.4,-.3,11.6,-.9,14.1]];TRANS=[[5,0,0,4],[0,5,4,0],[0,4,5,0],[4,0,0,5]];CONBLO={A:0,R:1,N:2,D:3,C:4,Q:5,E:6,G:7,H:8,I:9,L:10,K:11,M:12,F:13,P:14,S:15,T:16,W:17,Y:18,V:19,B:20,Z:21,X:22,"*":23};CONNUCL={A:0,T:1,C:2,G:3};CONSCHN={AAA:0,AAC:1,AAG:2,AAT:3,ACA:4,ACC:5,ACG:6,ACT:7,AGA:8,AGC:9,AGG:10,AGT:11,ATA:12,ATC:13,ATG:14,ATT:15,CAA:16,CAC:17,CAG:18,CAT:19,CCA:20,CCC:21,CCG:22,CCT:23,CGA:24,CGC:25,CGG:26,CGT:27,CTA:28,CTC:29,CTG:30,CTT:31,GAA:32,GAC:33,GAG:34,GAT:35,GCA:36,GCC:37,GCG:38,GCT:39,GGA:40,GGC:41,GGG:42,GGT:43,GTA:44,GTC:45,GTG:46,GTT:47,TAA:48,TAC:49,TAG:50,TAT:51,TCA:52,TCC:53,TCG:54,TCT:55,TGA:56,TGC:57,TGG:58,TGT:59,TTA:60,TTC:61,TTG:62,TTT:63};fillNeedleman(){for(let e=0;e<=this.len1;e++)this.dpGrid[e][0].value=-e*this.gap,this.dpGrid[e][0].parentI=e-1,this.dpGrid[e][0].parentJ=0;for(let e=1;e<=this.len2;e++)this.dpGrid[0][e].value=-e*this.gap,this.dpGrid[0][e].parentI=0,this.dpGrid[0][e].parentJ=e-1}fillOne(e,t){this.dpGrid[e][t].value=Math.max(this.dpGrid[e-1][t-1].value+this.scores[e-1][t-1],Math.max(this.dpGrid[e-1][t].value-this.gap,this.dpGrid[e][t-1].value-this.gap)),this.dpGrid[e][t].value==this.dpGrid[e-1][t-1].value+this.scores[e-1][t-1]?(this.dpGrid[e][t].parentI=e-1,this.dpGrid[e][t].parentJ=t-1):this.dpGrid[e][t].value==this.dpGrid[e-1][t].value-this.gap?(this.dpGrid[e][t].parentI=e-1,this.dpGrid[e][t].parentJ=t):(this.dpGrid[e][t].parentI=e,this.dpGrid[e][t].parentJ=t-1)}gridFromName(e){switch(e){case"BLOSUM45":this.alignGrid=this.BLOSUM45,this.connections=this.CONBLO,this.step=1;break;case"BLOSUM50":this.alignGrid=this.BLOSUM50,this.connections=this.CONBLO,this.step=1;break;case"BLOSUM62":this.alignGrid=this.BLOSUM62,this.connections=this.CONBLO,this.step=1;break;case"BLOSUM80":this.alignGrid=this.BLOSUM80,this.connections=this.CONBLO,this.step=1;break;case"BLOSUM90":this.alignGrid=this.BLOSUM90,this.connections=this.CONBLO,this.step=1;break;case"PAM30":this.alignGrid=this.PAM30,this.connections=this.CONBLO,this.step=1;break;case"PAM70":this.alignGrid=this.PAM70,this.connections=this.CONBLO,this.step=1;break;case"PAM250":this.alignGrid=this.PAM250,this.connections=this.CONBLO,this.step=1;break;case"NUCLEOTIDES":this.alignGrid=this.NUCLEOTIDES,this.connections=this.CONNUCL,this.step=1;break;case"TRANS":this.alignGrid=this.TRANS,this.connections=this.CONNUCL,this.step=1;break;case"SCHNEIDER":this.alignGrid=this.SCHNEIDER,this.connections=this.CONSCHN,this.step=3}this.fillScores()}constructResult(e,t){let n="",i="",s="";const o=this.dpGrid[e][t].value;for(let e=0;e<this.step;e++)s+="|";for(;e>0||t>0;){this.dpGrid[e][t].parentI==e?(n=s+n,i=this.seq2.substr((t-1)*this.step,this.step)+i):this.dpGrid[e][t].parentJ==t?(i=s+i,n=this.seq1.substr((e-1)*this.step,this.step)+n):(n=e-1>=0?this.seq1.substr((e-1)*this.step,this.step)+n:s+n,i=t-1>=0?this.seq2.substr((t-1)*this.step,this.step)+i:s+i);const r=e;e=this.dpGrid[e][t].parentI,t=this.dpGrid[r][t].parentJ}return new r(n,i,o)}fillScores(){this.scores=[];for(let e=0;e<this.len1;e++){this.scores.push([]);for(let t=0;t<this.len2;t++)this.scores[e].push(this.alignGrid[this.connections[this.seq1.substr(e*this.step,this.step)]][this.connections[this.seq2.substr(t*this.step,this.step)]])}}typeRec(){if(/[ATGC]*/.test(this.seq1)&&/[ATGC]*/.test(this.seq2))return"NUCLEOTIDES";if(/[ARNDCQEGHILKMFPSTWYVBZX*]*/.test(this.seq1)&&/[ARNDCQEGHILKMFPSTWYVBZX*]*/.test(this.seq2))return"BLOSUM62";throw Error("Can't recognize sequence type")}needlemanWunch(){this.dpGrid=[];for(let e=0;e<this.len1+1;e++){const e=[];for(let t=0;t<this.len2+1;t++)e.push(new i);this.dpGrid.push(e)}this.fillNeedleman();for(let e=1;e<=this.len1;e++)for(let t=1;t<=this.len2;t++)this.fillOne(e,t);return this.constructResult(this.len1,this.len2)}smithWaterman(){this.dpGrid=[];for(let e=0;e<this.len1+1;e++){const e=[];for(let t=0;t<this.len2+1;t++)e.push(new i);this.dpGrid.push(e)}let e=0,t=0,n=0;for(let i=1;i<=this.len1;i++)for(let r=1;r<=this.len2;r++)this.fillOne(i,r),this.dpGrid[i][r].value<=0?(this.dpGrid[i][r].value=0,this.dpGrid[i][r].parentI=0,this.dpGrid[i][r].parentJ=0):0==this.dpGrid[this.dpGrid[i][r].parentI][this.dpGrid[i][r].parentJ].value&&(this.dpGrid[i][r].parentI=0,this.dpGrid[i][r].parentJ=0),this.dpGrid[i][r].value>e&&(e=this.dpGrid[i][r].value,t=i,n=r);return this.constructResult(t,n)}setSequences(e,t){this.seq1=e,this.seq2=t,this.len1=this.seq1.length/this.step,this.len2=this.seq2.length/this.step,this.fillScores()}setGap(e){this.gap=e}setMethod(e=""){"AUTO"==e&&(e=this.typeRec()),this.gridFromName(e)}constructor(e,t,n,i=""){this.setMethod(i),this.setSequences(e,t),this.setGap(n)}}},8115:(e,t,n)=>{"use strict";n.d(t,{BQ:()=>m,a7:()=>h,if:()=>p,nI:()=>d});var i=n(4328),r=n(7389),s=n(6082),o=n(1407),a=n(4870),l=n(8070),c=n(2003);const u="substr_helm";class h{units;separator;inputsDiv;substructureInput;separatorInput;editHelmLink;columnsInput;grid;col;dialog;constructor(e){this.col=e[0],this.createUI()}editHelmLinkAction(){(0,a.K)(this.inputsDiv,this.grid.root),r.tools.waitForElementInDom(this.grid.root).then((()=>{setTimeout((()=>{this.grid.cell(u,0).element.children[0].dispatchEvent(new KeyboardEvent("keydown",{key:"Enter"}))}),100)}))}updateInputs(){const e=this.units===c.Hi.HELM?r.divV([this.columnsInput,this.editHelmLink]):this.units===c.Hi.SEPARATOR?r.inputs([this.columnsInput,this.substructureInput,this.separatorInput]):r.inputs([this.columnsInput,this.substructureInput]);(0,a.K)(this.inputsDiv,e)}updateNotationDiv(){this.units=this.col.meta.units,this.separator=this.col.getTag(c.gp.separator);const e=this.dialog.root.getElementsByClassName("notation-text")[0];e&&(e.textContent=`Notation: ${this.units}`)}createUI(){const e=i.shell.tv.dataFrame;this.columnsInput=r.input.column("Column",{table:e,value:this.col,onValueChanged:e=>{this.col=e.value,this.updateNotationDiv(),this.updateInputs()},filter:e=>e.semType===s.SEMTYPE.MACROMOLECULE}),this.substructureInput=r.input.string("Substructure",{value:""}),this.editHelmLink=r.link("Edit helm",(()=>this.editHelmLinkAction()),void 0,{style:{position:"relative",left:"95px"}});const t=s.DataFrame.create(1);t.columns.addNewString(u).init((e=>"")),t.col(u).semType=this.col.semType,t.col(u).meta.units=c.Hi.HELM,this.grid=t.plot.grid(),this.separatorInput=r.input.string("Separator",{value:this.separator}),this.inputsDiv=r.div(),this.units=this.col.meta.units,this.separator=this.col.getTag(c.gp.separator),this.updateInputs(),this.dialog=r.dialog("Substructure Search").add(r.divV([r.divText(`Notation: ${this.units}`,"notation-text"),this.inputsDiv])).onOK((async()=>{let e,n=this.units===c.Hi.HELM?t.get(u,0):this.substructureInput.value;this.units===c.Hi.SEPARATOR&&this.separatorInput.value!==this.separator&&""!==this.separatorInput.value&&(n=n.replaceAll(this.separatorInput.value,this.separator)),e=this.units===c.Hi.HELM?await p(n,this.col):d(n,this.col),this.col.dataFrame.filter.and(e)})).show()}}function d(e,t,n){const i=n?function(e,t){const n=`${t}`.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),i=e.charAt(0)===t,r=e.charAt(e.length-1)===t,s=e.replace(new RegExp(`^${n}|${n}$`,"g"),"");return i?r?`${n}${s}${n}`:`${n}${s}${n}|${n}${s}$`:r?`^${s}${n}|${n}${s}${n}`:`^${s}${n}|${n}${s}${n}|${n}${s}$`}(e,n):e,r=s.BitSet.create(t.length);for(let n=0;n<t.length;n++){const s=t.get(n);(s.match(i)||s===e)&&r.set(n,!0,!1)}return r}async function p(e,t){t.version!==t.temp["last-invalidated-version"]&&await m(t,!0);const n=s.Column.string("helm",1).init((t=>e));n.semType=s.SEMTYPE.MACROMOLECULE,n.meta.units=c.Hi.HELM;const r=await(0,o.R)(n,!0,t.temp["monomers-dict"]);return(await i.functions.call("Chem:searchSubstructure",{molStringsColumn:t.temp["monomeric-mols"],molString:r.get(0),molBlockFailover:""})).get(0)}async function m(e,t){const n=s.TaskBarProgressIndicator.create(`Invalidating molfiles for ${e.name}`);try{await(0,l.cb)(10);const n=new Map,i=await(0,o.R)(e,t,n);e.temp["monomeric-mols"]=i,e.temp["monomers-dict"]=n,e.temp["last-invalidated-version"]=e.version}finally{n.close()}}},966:(e,t,n)=>{"use strict";n.d(t,{V:()=>o});var i=n(4328),r=n(6082),s=n(826);function o(e,t,n=[],o=[],a=!0){const[l,c]=function(e,t,n=[],o=[]){let a=!0,l="";const c=s.GO.forColumn(e);if(e.semType!==r.SEMTYPE.MACROMOLECULE)i.shell.warning(t+" analysis is allowed for Macromolecules semantic type"),a=!1;else{const e=c.notation;if(n.length>0&&!n.some((t=>e.toUpperCase()==t.toUpperCase())))l=`${t} + ' analysis is allowed for Macromolecules with notation ${0==n.length?"any notation":`notation${n.length>1?"s":""} ${n.map((e=>`"${e}"`)).join(", ")} `}.`,a=!1;else if(!c.isHelm()){const e=c.alphabet;o.length>0&&!o.some((t=>e.toUpperCase()==t.toUpperCase()))&&(l=`${t} + ' analysis is allowed for Macromolecules with alphabet ${0==o.length?"any alphabet":`alphabet${o.length>1?"s":""} ${o.map((e=>`"${e}"`)).join(", ")}.`}.`,a=!1)}}return[a,l]}(e,t,n,o);return a&&!l&&i.shell.warning(c),l}},4139:(e,t,n)=>{"use strict";n.d(t,{HX:()=>u,J:()=>a,b9:()=>c,uF:()=>s});var i,r,s,o,a,l=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"}(i||(i={})),function(e){e.AAR="AAR",e.POSITION="Pos",e.SELECTION="selection"}(r||(r={})),function(e){e.MONOMER="Monomer",e.MACROMOLECULE_DIFFERENCE="MacromoleculeDifference",e.ACTIVITY="activity",e.ACTIVITY_SCALED="activityScaled"}(s||(s={})),function(e){e.CELL_CHANGING="isCellChanging"}(o||(o={})),function(e){e.SEPARATOR="."}(a||(a={}));const c="3.3.1",u={pepsea:{gapOpen:1.53,gapExtend:0,method:l.ZY[0]},kalign:{gapOpen:-1,gapExtend:-1,terminalGap:-1}}},5433:(e,t,n)=>{"use strict";n.d(t,{C:()=>d});var i=n(6082),r=n(7389),s=n(4328),o=n(1757),a=n.n(o),l=n(2003),c=n(826);let u=null,h=[];function d(e){let t=e??s.shell.t.columns.bySemType("Macromolecule");if(!t)throw new Error("No column with Macromolecule semantic type found");let n=c.GO.forColumn(t),o=n.notation;const d=r.divText("Current notation: "+o,{style:{"text-align":"center","font-weight":"bold","font-size":"14px",padding:"5px"}}),p=[l.Hi.FASTA,l.Hi.SEPARATOR,l.Hi.HELM],m=r.input.column("Column",{table:s.shell.t,value:t,onValueChanged:e=>{var s;(s=e.value).semType===i.SEMTYPE.MACROMOLECULE?(t=s,n=c.GO.forColumn(t),o=n.notation,o===l.Hi.HELM&&(y.value="/"),d.textContent="Current notation: "+o,g=p.filter((e=>e!==o)),v=r.input.choice("Convert to",{value:g[0],items:g,onValueChanged:b}),b(),u?.clear(),u?.add(r.div([d,m.root,v.root,y.root]))):m.value=t}}),f=["-",".","/"];let g=p.filter((e=>e!==o));const y=r.input.choice("Separator",{value:f[0],items:f}),b=()=>{v.value!==l.Hi.SEPARATOR?a()(y.root).hide():a()(y.root).show()};let v=r.input.choice("Convert to",{value:g[0],items:g,onValueChanged:b});b(),v.onChanged((()=>{b()})),null==u&&(u=r.dialog("Convert Sequence Notation").add(r.div([d,m.root,v.root,y.root])).onOK((async()=>{const e=v.value,n=e===l.Hi.SEPARATOR?y.value:void 0;await async function(e,t,n){const i=c.GO.forColumn(e).convert(t,n);e.dataFrame.columns.add(i);const r=await s.functions.call("Bio:detectMacromolecule",{col:i});return r&&(i.semType=r),await s.data.detectSemanticTypes(e.dataFrame),i}(t,e,n)})).show({x:350,y:100}),h.push(u.onClose.subscribe((e=>{h.forEach((e=>{e.unsubscribe()})),h=[],u=null}))))}},6740:(e,t,n)=>{"use strict";n.d(t,{m8:()=>o});var i=n(4328),r=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 i.dapi.docker.dockerContainers.find(e.id)),a(n)){s=!0;break}switch(n.status){case"stopped":await i.dapi.docker.dockerContainers.run(n.id);break;case"pending change":case"changing":break;case"error":throw new Error("Docker container error state.")}n=null,await(0,r.cb)(200)}if(!s)throw new Error("Docker container start timeout.")}(t,e)}function a(e){return"checking"===e.status||"started"===e.status}},1619:(e,t,n)=>{"use strict";n.d(t,{D:()=>I});var i=n(4328),r=n(6082),s=n(7389),o=n(8070),a=n(2003),l=n(826),c=n(608),u=n(8152),h=n(966),d=n(4139),p=n(6740),m=n(6355),f=n(5072),g=n.n(f),y=n(7825),b=n.n(y),v=n(7659),w=n.n(v),C=n(5056),A=n.n(C),S=n(540),x=n.n(S),E=n(1113),_=n.n(E),M=n(6369),T={};async function I(e={}){return new Promise((async(t,n)=>{e.clustersCol??=null,e.pepsea??={},e.pepsea.method??=d.HX.pepsea.method,e.pepsea.gapOpen??=d.HX.pepsea.gapOpen,e.pepsea.gapExtend??=d.HX.pepsea.gapExtend;const a=e.col?.dataFrame??i.shell.t,l=e.col??a.columns.bySemType(r.SEMTYPE.MACROMOLECULE);if(null==l){const e="Multiple Sequence Alignment analysis requires a dataset with a macromolecule column.";return i.shell.warning(e),void n(new c.Ap(s.divText(e)))}const h=s.input.choice("Method",{value:e.pepsea.method,items:u.ZY});h.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: ${d.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]),b=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");b.classList.add("msa-params-button"),y.hidden=!0,b.prepend(s.icons.settings((()=>null)));const v=[h.root.style],w=[p.root.style,m.style];let C,A=l;const S=s.input.column("Sequence",{table:a,value:l,onValueChanged:async e=>{if(!e.value||e.value.semType!==r.SEMTYPE.MACROMOLECULE)return _.disabled=!0,await(0,o.cb)(0),void(S.value=A);A=e.value,_.disabled=!1,C=await N(S.value,a,v,w,h,x,f,g,p)},filter:e=>e.semType===r.SEMTYPE.MACROMOLECULE});S.setTooltip("Sequences column to use for alignment");const x=s.input.column("Clusters",{table:a,value:e.clustersCol});x.nullable=!0;const E=s.dialog("MSA").add(S).add(x).add(h).add(y).add(b).add(m).onOK((async()=>{await L(S,a,C,t,n)})),_=E.getButton("OK");if(S.fireChanged(),e.col)return C=await N(e.col,a,v,w,h,x,f,g,p),void await L(S,a,C,t,n);E.show()}))}async function L(e,t,n,s,o){let a=null;const l=r.TaskBarProgressIndicator.create("Analyze for MSA ...");try{if(e.fireChanged(),e.value.semType!==r.SEMTYPE.MACROMOLECULE)throw new Error("Chosen column has to be of Macromolecule semantic type");if(void 0===n)throw new Error("Invalid column format");if(a=await n(),null==a)return o("PepSeA container has not started");t.columns.add(a),await i.data.detectSemanticTypes(t),s(a)}catch(e){o(e)}finally{l.close()}}async function N(e,t,n,s,o,f,g,y,b){try{if(e.semType!==r.SEMTYPE.MACROMOLECULE)return;const i=t.columns.getUnusedName(`msa(${e.name})`);if((0,h.V)(e,e.name,[a.Hi.FASTA,a.Hi.SEPARATOR],[a.YI.DNA,a.YI.RNA,a.YI.PT],!1)){$(n,s,"kalign"),g.value=null,y.value=null,b.value=null;const t=l.GO.forColumn(e),r=t.isFasta()?e:t.convert(a.Hi.FASTA);return async()=>await(0,c.eE)(r,!1,i,f.value)}if((0,h.V)(e,e.name,[a.Hi.HELM],[],!1))return $(n,s,"pepsea"),g.value??=d.HX.pepsea.gapOpen,y.value??=d.HX.pepsea.gapExtend,async()=>(await(0,p.m8)(),(0,u.GD)(e,i,o.value,g.value,y.value,f.value));if((0,h.V)(e,e.name,[a.Hi.SEPARATOR],[a.YI.UN],!1)){const t=l.GO.forColumn(e).convert(a.Hi.HELM);return $(n,s,"pepsea"),g.value??=d.HX.pepsea.gapOpen,y.value??=d.HX.pepsea.gapExtend,async()=>(await(0,p.m8)(),(0,u.GD)(t,i,o.value,g.value,y.value,f.value))}return g.value=null,y.value=null,b.value=null,void $(n,s,"kalign")}catch(e){const t=e instanceof Error?e.message:e.toString();i.shell.error(t),m._package.logger.error(t)}}function $(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")}}T.styleTagTransform=_(),T.setAttributes=A(),T.insert=w().bind(null,"head"),T.domAPI=b(),T.insertStyleElement=x(),g()(M.A,T),M.A&&M.A.locals&&M.A.locals},608:(e,t,n)=>{"use strict";n.d(t,{Ap:()=>G,aZ:()=>B,eE:()=>F});var i=n(7389),r=n(6082),s=n(1991),o=n.n(s),a=n(3516),l=n(2003);const c=Symbol("Comlink.proxy"),u=Symbol("Comlink.endpoint"),h=Symbol("Comlink.releaseProxy"),d=Symbol("Comlink.thrown"),p=e=>"object"==typeof e&&null!==e||"function"==typeof e,m=new Map([["proxy",{canHandle:e=>p(e)&&e[c],serialize(e){const{port1:t,port2:n}=new MessageChannel;return f(e,t),[n,[n]]},deserialize:e=>(e.start(),y(e))}],["throw",{canHandle:e=>p(e)&&d in e,serialize({value:e}){let t;return t=e instanceof Error?{isError:!0,value:{message:e.message,name:e.name,stack:e.stack}}:{isError:!1,value:e},[t,[]]},deserialize(e){throw e.isError?Object.assign(new Error(e.value.message),e.value):e.value}}]]);function f(e,t=self){t.addEventListener("message",(function n(i){if(!i||!i.data)return;const{id:r,type:s,path:o}=Object.assign({path:[]},i.data),a=(i.data.argumentList||[]).map(x);let l;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":l=n;break;case"SET":t[o.slice(-1)[0]]=x(i.data.value),l=!0;break;case"APPLY":l=n.apply(t,a);break;case"CONSTRUCT":l=function(e){return Object.assign(e,{[c]:!0})}(new n(...a));break;case"ENDPOINT":{const{port1:t,port2:n}=new MessageChannel;f(e,n),l=function(e,t){return A.set(e,t),e}(t,[t])}break;case"RELEASE":l=void 0;break;default:return}}catch(e){l={value:e,[d]:0}}Promise.resolve(l).catch((e=>({value:e,[d]:0}))).then((e=>{const[i,o]=S(e);t.postMessage(Object.assign(Object.assign({},i),{id:r}),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 v(e,[],t)}function b(e){if(e)throw new Error("Proxy has been released and is not useable")}function v(e,t=[],n=function(){}){let i=!1;const r=new Proxy(n,{get(n,s){if(b(i),s===h)return()=>E(e,{type:"RELEASE",path:t.map((e=>e.toString()))}).then((()=>{g(e),i=!0}));if("then"===s){if(0===t.length)return{then:()=>r};const n=E(e,{type:"GET",path:t.map((e=>e.toString()))}).then(x);return n.then.bind(n)}return v(e,[...t,s])},set(n,r,s){b(i);const[o,a]=S(s);return E(e,{type:"SET",path:[...t,r].map((e=>e.toString())),value:o},a).then(x)},apply(n,r,s){b(i);const o=t[t.length-1];if(o===u)return E(e,{type:"ENDPOINT"}).then(x);if("bind"===o)return v(e,t.slice(0,-1));const[a,l]=C(s);return E(e,{type:"APPLY",path:t.map((e=>e.toString())),argumentList:a},l).then(x)},construct(n,r){b(i);const[s,o]=C(r);return E(e,{type:"CONSTRUCT",path:t.map((e=>e.toString())),argumentList:s},o).then(x)}});return r}function w(e){return Array.prototype.concat.apply([],e)}function C(e){const t=e.map(S);return[t.map((e=>e[0])),w(t.map((e=>e[1])))]}const A=new WeakMap;function S(e){for(const[t,n]of m)if(n.canHandle(e)){const[i,r]=n.serialize(e);return[{type:"HANDLER",name:t,value:i},r]}return[{type:"RAW",value:e},A.get(e)||[]]}function x(e){switch(e.type){case"HANDLER":return m.get(e.name).deserialize(e.value);case"RAW":return e.value}}function E(e,t,n){return new Promise((i=>{const r=new Array(4).fill(0).map((()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16))).join("-");e.addEventListener("message",(function t(n){!n.data||!n.data.id||n.data.id!==r||(e.removeEventListener("message",t),i(n.data))})),e.start&&e.start(),e.postMessage(Object.assign({id:r},t),n)}))}const _="KGZ1bmN0aW9uKCl7InVzZSBzdHJpY3QiO2NvbnN0ICQ9U3ltYm9sKCJDb21saW5rLnByb3h5IiksQT1TeW1ib2woIkNvbWxpbmsuZW5kcG9pbnQiKSxSPVN5bWJvbCgiQ29tbGluay5yZWxlYXNlUHJveHkiKSx5PVN5bWJvbCgiQ29tbGluay50aHJvd24iKSxfPWU9PnR5cGVvZiBlPT0ib2JqZWN0IiYmZSE9PW51bGx8fHR5cGVvZiBlPT0iZnVuY3Rpb24iLEw9e2NhbkhhbmRsZTplPT5fKGUpJiZlWyRdLHNlcmlhbGl6ZShlKXtjb25zdHtwb3J0MTpyLHBvcnQyOml9PW5ldyBNZXNzYWdlQ2hhbm5lbDtyZXR1cm4gdyhlLHIpLFtpLFtpXV19LGRlc2VyaWFsaXplKGUpe3JldHVybiBlLnN0YXJ0KCksQyhlKX19LE89e2NhbkhhbmRsZTplPT5fKGUpJiZ5IGluIGUsc2VyaWFsaXplKHt2YWx1ZTplfSl7bGV0IHI7cmV0dXJuIGUgaW5zdGFuY2VvZiBFcnJvcj9yPXtpc0Vycm9yOiEwLHZhbHVlOnttZXNzYWdlOmUubWVzc2FnZSxuYW1lOmUubmFtZSxzdGFjazplLnN0YWNrfX06cj17aXNFcnJvcjohMSx2YWx1ZTplfSxbcixbXV19LGRlc2VyaWFsaXplKGUpe3Rocm93IGUuaXNFcnJvcj9PYmplY3QuYXNzaWduKG5ldyBFcnJvcihlLnZhbHVlLm1lc3NhZ2UpLGUudmFsdWUpOmUudmFsdWV9fSxFPW5ldyBNYXAoW1sicHJveHkiLExdLFsidGhyb3ciLE9dXSk7ZnVuY3Rpb24gdyhlLHI9c2VsZil7ci5hZGRFdmVudExpc3RlbmVyKCJtZXNzYWdlIixmdW5jdGlvbiBpKHMp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cm4gdC5fbG9nKGBGaWxlICR7cn0gbm90IGZvdW5kLmApLCExO3N3aXRjaChlKXtjYXNlImNhdCI6cmV0dXJuIHQuZnMucmVhZEZpbGUocix7ZW5jb2Rpbmc6InV0ZjgifSk7Y2FzZSJscyI6cmV0dXJuIHQuZnMuaXNGaWxlKGkub2JqZWN0Lm1vZGUpP3QuZnMuc3RhdChyKTp0LmZzLnJlYWRkaXIocik7Y2FzZSJkb3dubG9hZCI6Y29uc3Qgcz1uZXcgQmxvYihbdGhpcy5jYXQocildKTtyZXR1cm4gVVJMLmNyZWF0ZU9iamVjdFVSTChzKX1yZXR1cm4hMX0sX2xvZyhlKXtpZighdC5jb25maWcuZGVidWcpcmV0dXJuO2xldCByPVsuLi5hcmd1bWVudHNdO3Iuc2hpZnQoKSxjb25zb2xlLmxvZyhgJWNbV2ViV29ya2VyXSVjICR7ZX1gLCJmb250LXdlaWdodDpib2xkIiwiIiwuLi5yKX19O3codCl9KSgpOwo=",M=typeof window<"u"&&window.Blob&&new Blob([atob(_)],{type:"text/javascript;charset=utf-8"});function T(){const e=M&&(window.URL||window.webkitURL).createObjectURL(M);try{return e?new Worker(e):new Worker("data:application/javascript;base64,"+_)}finally{e&&(window.URL||window.webkitURL).revokeObjectURL(e)}}const I={urlCDN:"https://biowasm.com/cdn/v3",urlCDNStg:"https://stg.biowasm.com/cdn/v3",dirShared:"/shared",dirMounted:"/mnt",dirData:"/data",printInterleaved:!0,callback:null,debug:!1,env:"prd"};class L{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({},I,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 T;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 ${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]}}$.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 P{constructor(e="categorial"){this.aa2num=$.getScale(e),this.num2aa={},Object.entries(this.aa2num).forEach((([e,t])=>this.num2aa[t]=e))}static _truncateSequence(e){let t=0,n=e.length;const i=["NH2","COOH"];if(e.startsWith(i[0])){const n=i[0].length;(0,N.vA)("-"==e[n],`Wrong sequence format: ${i[0]} without following '-' in '${e}'.`),t=n}if(e.endsWith(i[1])){const t=i[1].length+1;(0,N.vA)("-"==e[n-t],`Wrong sequence format: ${i[1]} without '-' precending in '${e}'.`),n-=t}return e.substring(t,n)}static _dropDefises(e){return e.replace(/(-)([^-]+)/g,"$2")}static clean(e){return P._dropDefises(P._truncateSequence(e))}encode(e){const t=e.length,n=new Array(t).fill(0);for(let i=0;i<t;++i){const t=e[i];(0,N.vA)(t in this.aa2num,`Unknown char '${t}' found in sequence '${e}'`),n[i]=this.encodeLettter(t)}return n}encodeLettter(e){return this.aa2num[e]}decode(e){let t="";for(let n=0;n<e.length;++n){const i=e[n];(0,N.vA)(i in this.num2aa,`Unknown code '${i}' found in vector '${e}'`),t+=this.num2aa[i]}return t}}var O=n(4139);const R="input.fa",k="result.fasta";class G extends Error{element;constructor(e,t){super(e.innerText,t),this.element=e}}function D(e){return e.reduce(((e,t,n)=>e+`>sample${n+1}\n${t}\n`),"")}async function F(e,t=!1,n="",i=null,s,o,c){let u=e.toList();t&&(u=u.map((e=>P.clean(e).replace(/\-/g,""))));const h=e.length;i??=r.Column.string("Clusters",h).init("0"),i.type!=r.COLUMN_TYPE.STRING&&(i=i.convertTo(r.TYPE.STRING)),i.compact();const d=i.categories,p=i.getRawData(),m=new Array(d.length),f=new Array(d.length);for(let e=0;e<h;++e){const t=p[e];(m[t]??=[]).push(u[e]),(f[t]??=[]).push(e)}B(f,d);const g=await new L(["base/1.0.0",{tool:"kalign",version:O.b9,reinit:!0}]),y=r.Column.string(n,h);for(let e=0;e<d.length;++e){const t=D(m[e]);await g.fs.writeFile(R,t);const n=`${void 0!==s?` --gpo ${s}`:""}${void 0!==o?` --gpe ${o}`:""}${void 0!==c?` --tgpe ${c}`:""}`,i=await g.exec(`kalign ${R} -f fasta -o ${k}${n}`);console.warn(i);const r=await g.cat(k);if(!r){const e=H(i,1);throw new Error(e)}const l=new a.m(r).sequencesArray,u=f[e];for(let e=0;e<l.length;++e)y.set(u[e],l[e])}const b=e.meta.units,v=e.getTag(l.gp.alphabet);return y.meta.units=b,y.setTag(l.gp.aligned,"SEQ.MSA"),y.setTag(l.gp.alphabet,v),y.semType=r.SEMTYPE.MACROMOLECULE,y}function H(e,t){const n=[],i=/^.+ERROR : (.+)$/gm;let r;for(;null!=(r=i.exec(e))&&(void 0===t||n.length<t);)n.push(r[1]);return n.join("\n")}function B(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=i.div([i.divText(`MSA analysis is not available on single sequence clusters #${n.length}:`),...o()(n).take(3).map((e=>{let r=t[e];return r.length>25&&(r=r.slice(0,25)+"..."),i.divText(`"${r}"${e<n.length-1?", ":"."}`)})).toArray(),...n.length>3?[i.divText("...")]:[]]);throw new G(e)}}},8152:(e,t,n)=>{"use strict";n.d(t,{GD:()=>d,Nk:()=>c,ZY:()=>u});var i=n(4328),r=n(6082),s=n(2003),o=n(608),a=n(4139),l=n(6355);const c=new class{dcName="bio";async getDockerContainer(){return await i.dapi.docker.dockerContainers.filter(this.dcName).first()}},u=["mafft --auto","mafft","linsi","ginsi","einsi","fftns","fftnsi","nwns","nwnsi"],h=["AlignedSeq","AlignedSubpeptide","HELM","ID","PolymerID"];async function d(e,t,n="ginsi",i=1.53,l=0,u=null,d){const m=await c.getDockerContainer();if("started"!==m.status&&"checking"!==m.status)throw new Error("PepSeA container has not started yet");const f=e.length;u??=r.Column.int("Clusters",f).init(0),u.type!=r.COLUMN_TYPE.STRING&&(u=u.convertTo(r.TYPE.STRING));const g=u.categories,y=u.getRawData(),b=new Array(g.length),v=new Array(g.length);for(let t=0;t<f;++t){const n=y[t],i=g[n];if(""===i)continue;const r=g.indexOf(i),s=e.get(t);s&&((b[r]??=[]).push({ID:t.toString(),HELM:s}),(v[n]??=[]).push(t))}(0,o.aZ)(v,g);const w=new Array(f);for(const e of b){const t=(await p(m.id,e,n,i,l,d)).Alignment;for(const e of t)w[parseInt(e.ID)]=Object.entries(e).filter((e=>!h.includes(e[0]))).map((e=>"-"!==e[1]?e[1]:"")).join(a.J.SEPARATOR)}const C=r.Column.fromStrings(t,w);return C.meta.units=s.Hi.SEPARATOR,C.setTag(s.gp.separator,a.J.SEPARATOR),C.setTag(s.gp.aligned,"SEQ.MSA"),C.setTag(s.gp.alphabet,s.YI.UN),C.setTag(s.gp.alphabetIsMultichar,"true"),C.semType=r.SEMTYPE.MACROMOLECULE,C}async function p(e,t,n,r,s,o){const a={method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(t)},c=`/align?method=${n}&gap_open=${r}&gap_extend=${s}`;let u;if("fetchProxy"in i.dapi.docker.dockerContainers){const t=window.performance.now(),n=await i.dapi.docker.dockerContainers.fetchProxy(e,c,a),r=window.performance.now();l._package.logger.debug(`Bio: requestAlignedObjects() dockerContainers.fetchProxy(), ET: ${r-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 i=e["datagrok-error"];if(i)throw new Error(`Datagrok error: ${i}`);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 i.dapi.docker.dockerContainers.request(e,c,a);if(!t)throw new Error("Empty response");u=JSON.parse(t);const n=u["pepsea-error"];if(n)throw new Error(`PepSeA error: ${n}`);const r=u["datagrok-error"];if(r)throw new Error(`Datagrok error: ${r}`)}if("pepsea-stderr"in u){const e=u["pepsea-stderr"];o?.warning(e)}return u}},3890:(e,t,n)=>{"use strict";n.d(t,{TE:()=>u});var i=n(6082),r=n(7389),s=n(4328),o=n(1991),a=n.n(o),l=n(826);const c=60;function u(){const e=s.shell.tv.grid,t=a().count(0).take(e.columns.length).map((t=>e.columns.byIndex(t))).filter((e=>!!e.column&&e.column.semType!==i.SEMTYPE.MACROMOLECULE)).toArray(),n=t.find((e=>-1!==e.name.toLowerCase().indexOf("id"))),o=n?[n.name]:[],u=r.input.multiChoice("Seq id columns",{value:o,items:t.map((e=>e.name))}),d=a().count(0).take(e.columns.length).map((t=>e.columns.byIndex(t))).filter((e=>{const t=e.column;return!(!t||t.semType!==i.SEMTYPE.MACROMOLECULE)&&l.GO.forColumn(t).isFasta()})).toArray(),p=d.length>0?d[0].name:[],m=r.input.choice("Seq column",{value:p,items:d.map((e=>e.name))}),f=r.input.int("FASTA line width",{value:c});r.dialog({title:"Save as FASTA"}).add(r.inputs([u,m,f])).onOK((()=>{const t=u.value?u.value.map((t=>e.columns.byName(t).column)):[],n=m.value?e.columns.byName(m.value).column:null,i=f.value??c;n||s.shell.warning("Seq column is mandatory to save as FASTA.");const r=function(e,t,n=c,i="\n"){const r=l.GO.forColumn(t),s=[];for(let o=0;o<t.length;o++){const t=e.map((e=>e.get(o).toString())).join("|"),a=h(r.getSplitted(o),n);s.push(`>${t}${i}`);for(const e of a)s.push(`${e}${i}`)}return"".concat(...s)}(t,n,i),o=document.createElement("a");o.setAttribute("href",`data:text/plain;charset=utf-8,${encodeURIComponent(r)}`),o.setAttribute("download",`${e.dataFrame.name}.fasta`),o.click()})).show()}function h(e,t=c){let n=0;const i=e.length,r=[];for(;n<i;){const i=a()(e.originals).slice(n,n+t).toArray(),s=i.map((e=>e.length>1?`[${e}]`:e)).reduce(((e,t)=>e+t),"");r.push(s),n+=i.length}return r}},5785:(e,t,n)=>{"use strict";n.d(t,{k:()=>u});var i=n(4328),r=n(6082),s=n(8070),o=n(966),a=n(3077),l=n(4139),c=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=l.uF.MONOMER,e.setTag(c.gp.alphabet,t.getTag(c.gp.alphabet));const h=/(\d+)(?: \((\d+)\))?/,d=e=>{h.lastIndex=0;const t=e.match(h);return t?`${t[1]} (${parseInt(t[2]??"0")+1})`:e};for(let e=0;e<n.columns.length;e++){const i=n.columns.byIndex(e);i.semType=l.uF.MONOMER,i.setTag(c.gp.alphabet,t.getTag(c.gp.alphabet));const r=100;let s=0;for(;u.columns.byName(i.name)&&s<r;)i.name=d(i.name),s++;u.columns.add(i)}await i.data.detectSemanticTypes(u);for(let e=0;e<n.columns.length;e++){const t=n.columns.byIndex(e);t.setTag(r.TAGS.CELL_RENDERER,"Monomer"),t.setTag(".use-as-filter","false")}return u}},4870:(e,t,n)=>{"use strict";n.d(t,{K:()=>o,m:()=>s});var i=n(4328),r=n(6082);function s(){const e=i.shell.t.columns.bySemTypeAll(r.SEMTYPE.MACROMOLECULE);if(null!==e)return e;i.shell.error("Current table does not contain macromolecules")}function o(e,t){e.innerHTML="",e.append(t)}},8047:(e,t,n)=>{"use strict";n.d(t,{n5:()=>v,oP:()=>M});var i=n(4328),r=n(7389),s=n(6082),o=n(1757),a=n.n(o),l=n(1991),c=n.n(l),u=n(1858),h=n(826),d=n(2003),p=n(4326);function m(e){var t;return"string"==typeof e||e instanceof String?e:("object"==typeof e||e instanceof Object)&&"$thrownJsError"in e?m(e.$thrownJsError):e instanceof Error?null!==(t=e.stack)&&void 0!==t?t:e.message:e.toString()}var f=n(2738),g=n(8070),y=n(7602);var b,v,w=n(2174),C=n(6355);HTMLCanvasElement.prototype.getCursorPosition=function(e,t){const n=this.getBoundingClientRect();return new s.Point((e.clientX-n.left)*t,(e.clientY-n.top)*t)},s.Rect.prototype.contains=function(e,t){return this.left<=e&&e<=this.right&&this.top<=t&&t<=this.bottom};class A{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 S{pos;name;_label;get label(){return this._label?this._label:this.name}_freqs;sumRowCount=0;sumPlotValue;sumPlotValueForHeight;constructor(e,t,n,i){this.pos=e,this.name=t,this._freqs=n??{},i?.sumRowCount&&(this.sumRowCount=i.sumRowCount),i?.sumValueForHeight&&(this.sumPlotValue=i.sumValueForHeight),i?.label&&(this._label=i.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 A),t}aggregate(e){const t=function(e){return t=>{const n=function(e){let t;const n="agg";return t=e instanceof Float32Array?s.Column.fromFloat32Array(n,e):e instanceof Int32Array?s.Column.fromInt32Array(n,e):s.Column.fromList(s.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===p.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 i=(e.plotValue+n)/(this.sumPlotValue+t);this.sumPlotValueForHeight+=-i*Math.log2(i)}}else if(e===p.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,r,o,a,l,c){const u=i===p.fH.Entropy?n*(r-this.sumPlotValueForHeight)/r:n;let h=c*l+(n-u-1);const d=Object.entries(this._freqs).sort(((e,t)=>e[0]!==f._S&&t[0]!==f._S?t[1].value-e[1].value:e[0]===f._S&&t[0]===f._S?0:e[0]===f._S?-1:1));for(const[n,i]of d){const n=u*i.plotValue/this.sumPlotValue;i.bounds=new s.Rect((e-t)*l*o,h,a*l,n),h+=n}}render(e,t,n,i,r){for(const[s,o]of Object.entries(this._freqs))if(s!==f._S){const a=(0,d.zS)(s,5),l=o.bounds,c=l.left;e.resetTransform(),e.strokeStyle="lightgray",e.lineWidth=1,e.rect(c,l.top,l.width,l.height),e.fillStyle=r.get(s)??r.get("other"),e.textAlign="left",e.font=t;const u=e.measureText(a);e.setTransform(l.width/u.width,0,0,l.height/i,c,l.top),e.fillText(a,0,-n)}}getMonomerAt(e,t){const n=Object.entries(this._freqs).find((([n,i])=>i.bounds.contains(e,t)));return n?n[0]:void 0}buildCompositionTable(e){if("-"in this._freqs)throw new Error("Unexpected monomer symbol '-'.");return(0,w.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"}(b||(b={})),function(e){e.sequenceColumnName="sequenceColumnName",e.valueAggrType="valueAggrType",e.valueColumnName="valueColumnName",e.startPositionName="startPositionName",e.endPositionName="endPositionName",e.skipEmptySequences="skipEmptySequences",e.skipEmptyPositions="skipEmptyPositions",e.shrinkEmptyTail="shrinkEmptyTail",e.backgroundColor="backgroundColor",e.positionHeight="positionHeight",e.positionWidth="positionWidth",e.verticalAlignment="verticalAlignment",e.horizontalAlignment="horizontalAlignment",e.fixWidth="fixWidth",e.fitArea="fitArea",e.minHeight="minHeight",e.maxHeight="maxHeight",e.showPositionLabels="showPositionLabels",e.positionMarginState="positionMarginState",e.positionMargin="positionMargin",e.filterSource="filterSource"}(v||(v={}));const x=p.Fo;var E;!function(e){e[e.None=0]="None",e[e.Render=1]="Render",e[e.Layout=1]="Layout",e[e.Freqs=2]="Freqs"}(E||(E={}));const _=new class{render=20};class M extends s.JsViewer{static residuesSet="nucleotides";viewed=!1;seqHandler;initialized=!1;palette=null;host;msgHost;canvas;slider;textBaseline;seqCol=null;positions=[];visibleSlider=!1;allowResize=!0;turnOfResizeForOneSetValue=!1;sequenceColumnName;valueAggrType;valueColumnName;skipEmptySequences;skipEmptyPositions;positionWidth;_positionWidth;_positionWidthWithMargin;get positionWidthWithMargin(){return this._positionWidthWithMargin}minHeight;backgroundColor=4294967295;maxHeight;showPositionLabels;positionMarginState;positionMargin=0;_positionMargin;startPositionName;endPositionName;fixWidth;verticalAlignment;horizontalAlignment;fitArea;shrinkEmptyTail;positionHeight;filterSource;positionNames=[];positionLabels=void 0;startPosition=-1;endPosition=-1;error=null;get Length(){return this.skipEmptyPositions?this.positions.length:this.startPosition<=this.endPosition?this.endPosition-this.startPosition+1:0}get positionMarginValue(){return this.positionMarginState===p.mH.AUTO&&!0===this.seqHandler.getAlphabetIsMultichar()||this.positionMarginState===p.mH.ON?this.positionMargin:0}constructor(){super(),this.textBaseline="top",this.seqHandler=null,this.sequenceColumnName=this.string(v.sequenceColumnName,x.sequenceColumnName,{category:b.DATA});const e=[s.AGG.KEY,s.AGG.PIVOT,s.AGG.MISSING_VALUE_COUNT,s.AGG.SKEW,s.AGG.KURT,s.AGG.SELECTED_ROWS_COUNT],t=Object.values(s.AGG).filter((t=>!e.includes(t)));this.valueAggrType=this.string(v.valueAggrType,x.valueAggrType,{category:b.DATA,choices:t}),this.valueColumnName=this.string(v.valueColumnName,x.valueColumnName,{category:b.DATA}),this.startPositionName=this.string(v.startPositionName,x.startPositionName,{category:b.DATA}),this.endPositionName=this.string(v.endPositionName,x.endPositionName,{category:b.DATA}),this.skipEmptySequences=this.bool(v.skipEmptySequences,x.skipEmptySequences,{category:b.DATA}),this.skipEmptyPositions=this.bool(v.skipEmptyPositions,x.skipEmptyPositions,{category:b.DATA}),this.shrinkEmptyTail=this.bool(v.shrinkEmptyTail,x.shrinkEmptyTail,{category:b.DATA}),this.backgroundColor=this.int(v.backgroundColor,x.backgroundColor,{category:b.STYLE}),this.positionHeight=this.string(v.positionHeight,x.positionHeight,{category:b.STYLE,choices:Object.values(p.fH)}),this._positionWidth=this.positionWidth=this.float(v.positionWidth,x.positionWidth,{category:b.STYLE}),this.verticalAlignment=this.string(v.verticalAlignment,x.verticalAlignment,{category:b.LAYOUT,choices:Object.values(p.Lp)}),this.horizontalAlignment=this.string(v.horizontalAlignment,x.horizontalAlignment,{category:b.LAYOUT,choices:Object.values(p.P4)}),this.fixWidth=this.bool(v.fixWidth,x.fixWidth,{category:b.LAYOUT,userEditable:!1}),this.fitArea=this.bool(v.fitArea,x.fitArea,{category:b.LAYOUT}),this.minHeight=this.float(v.minHeight,x.minHeight,{category:b.LAYOUT}),this.maxHeight=this.float(v.maxHeight,x.maxHeight,{category:b.LAYOUT}),this.showPositionLabels=this.bool(v.showPositionLabels,x.showPositionLabels,{category:b.LAYOUT}),this.positionMarginState=this.string(v.positionMarginState,x.positionMarginState,{category:b.LAYOUT,choices:Object.values(p.mH)});let n=0;"auto"===this.positionMarginState&&(n=4),this.positionMargin=this.int(v.positionMargin,n,{category:b.LAYOUT,min:0,max:16}),this.filterSource=this.string(v.filterSource,x.filterSource,{category:b.BEHAVIOR,choices:Object.values(p.lT)}),this.slider=r.rangeSlider(0,100,0,20,!1,{style:"barbell"}),this.canvas=r.canvas(),this.canvas.classList.value="bio-wl-canvas",this.canvas.style.width="100%",this.viewSyncer=new y.g(C._package.logger)}static viewerCounter=-1;viewerId=++M.viewerCounter;toLog(){return`WebLogoViewer<${this.viewerId}>`}setData(){const e=`${this.toLog()}.setData()`;C._package.logger.debug(`${e}, in`),this.viewSyncer.sync(`${e}`,(async()=>{if(!this.setDataInProgress){this.setDataInProgress=!0;try{this.viewed&&(this.renderRequestSub.unsubscribe(),await this.destroyView(),this.viewed=!1),this.updateSeqCol(),this.updateEditors(),this.viewed||(await this.buildView(),this.viewed=!0)}finally{this.setDataInProgress=!1}}})),C._package.logger.debug(`${e}, out`)}viewSyncer;setDataInProgress=!1;viewSubs=[];async destroyView(){for(const e of this.viewSubs)e.unsubscribe();this.viewSubs=[];const e=this.dataFrame?"data":"null";C._package.logger.debug(`${this.toLog()}.destroyView( dataFrame = ${e} ) start`),this.host.remove(),this.msgHost=void 0,this.host=void 0,C._package.logger.debug(`${this.toLog()}.destroyView() end`)}async buildView(){const e=this.dataFrame?"data":"null";C._package.logger.debug(`${this.toLog()}.buildView( dataFrame = ${e} ) start`),window.devicePixelRatio,this.viewSubs.push(s.debounce(this.renderRequest,_.render).subscribe(this.renderRequestOnDebounce.bind(this))),this.helpUrl="/help/visualize/viewers/web-logo.md",this.msgHost=r.div("No message",{classes:"bio-wl-msg"}),this.msgHost.style.display="none",this.canvas=r.canvas(),this.canvas.style.width="100%",this.slider.root.style.position="absolute",this.slider.root.style.zIndex="999",this.slider.root.style.display="none",this.slider.root.style.height="0.7em",this.visibleSlider=!1,this.host=r.div([this.msgHost,this.canvas],{classes:"bio-wl-host",style:{display:"flex",flexDirection:"row",flexWrap:"wrap"}}),this.root.append(this.host),this.root.append(this.slider.root),this.error&&(this.msgHost.innerText=this.error.message,r.tooltip.bind(this.msgHost,this.error.stack),this.msgHost.style.setProperty("display",null)),this.dataFrame&&(this.viewSubs.push(this.dataFrame.filter.onChanged.subscribe(this.dataFrameFilterOnChanged.bind(this))),this.viewSubs.push(this.dataFrame.selection.onChanged.subscribe(this.dataFrameSelectionOnChanged.bind(this)))),this.viewSubs.push(r.onSizeChanged(this.root).subscribe(this.rootOnSizeChanged.bind(this))),this.viewSubs.push(this.slider.onValuesChanged.subscribe(this.sliderOnValuesChanged.bind(this))),this.viewSubs.push((0,u.fromEvent)(this.canvas,"mousemove").subscribe(this.canvasOnMouseMove.bind(this))),this.viewSubs.push((0,u.fromEvent)(this.canvas,"mousedown").subscribe(this.canvasOnMouseDown.bind(this))),this.viewSubs.push((0,u.fromEvent)(this.canvas,"wheel").subscribe(this.canvasOnWheel.bind(this))),this.render(E.Freqs,"buildView"),C._package.logger.debug(`${this.toLog()}.buildView() end`)}lastSize={width:-1,height:-1};rootOnSizeChanged(e){const t={width:e.target.clientWidth,height:e.target.clientHeight};this.lastSize.width==t.width&&this.lastSize.height==t.height||(C._package.logger.debug(`${this.toLog()}.rootOnSizeChanged(), ${JSON.stringify(t)}, start `),this.render(E.Layout,"rootOnSizeChanged")),this.lastSize=t}updateEditors(){this.props.getProperty(v.valueColumnName).choices=c()(this.dataFrame.columns.numerical).map((e=>e.name)).toArray()}updateSeqCol(){if(this.dataFrame&&(this.seqCol=this.sequenceColumnName?this.dataFrame.col(this.sequenceColumnName):null,null==this.seqCol&&(this.seqCol=(0,d.mn)(this.dataFrame),this.sequenceColumnName=this.seqCol?this.seqCol.name:null),this.seqCol)){try{this.seqHandler=h.GO.forColumn(this.seqCol),this.palette=(0,d.SM)(this.seqCol),this.render(E.Freqs,"updateSeqCol()"),this.error=null}catch(e){throw this.seqCol=null,this.error=e instanceof Error?e:new Error(e.toString()),e}this.seqCol||(this.seqHandler=null,this.positionNames=[],this.positionLabels=[],this.startPosition=-1,this.endPosition=-1,this.palette=null)}}getFilter(){let e;switch(this.filterSource){case p.lT.Filtered:e=this.dataFrame.filter;break;case p.lT.Selected:e=0===this.dataFrame.selection.trueCount?this.dataFrame.filter:this.dataFrame.selection}return e}setSliderVisibility(e){e?(this.slider.root.style.display="inherit",this.visibleSlider=!0):(this.slider.root.style.display="none",this.visibleSlider=!1)}calcLayout(e){this.host&&this.canvas&&this.slider&&(this.host.classList.remove("bio-wl-fixWidth","bio-wl-fitArea"),this.canvas.classList.remove("bio-wl-fixWidth","bio-wl-fitArea"),this._positionWidth=this.positionWidth,this._positionMargin=this.positionMargin,this._positionWidthWithMargin=this._positionWidth+this.positionMarginValue,this.fixWidth?this.calcLayoutFixWidth(e):this.fitArea?this.calcLayoutFitArea(e):this.calcLayoutNoFitArea(e),this.slider.root.style.width=`${this.host.clientWidth}px`)}calcLayoutFixWidth(e){if(!this.host||!this.canvas||!this.slider)return;this.host.classList.add("bio-wl-fixWidth"),this.canvas.classList.add("bio-wl-fitArea");const t=this._positionWidthWithMargin*this.Length,n=Math.min(Math.max(this.minHeight,this.root.clientHeight),this.maxHeight);this.host.style.justifyContent=p.P4.LEFT,this.host.style.removeProperty("margin-left"),this.host.style.removeProperty("margin-top"),this.host.style.width=this.canvas.style.width=`${t}px`,this.host.style.height=this.canvas.style.height=`${n}px`,this.host.style.left=this.canvas.style.left="0",this.host.style.top=this.canvas.style.top="0",this.host.style.setProperty("overflow","hidden","important"),this.slider.root.style.display="none",this.slider.setValues(0,Math.max(0,this.Length-1),0,Math.max(0,this.Length-1)),this.canvas.width=t*e,this.canvas.height=n*e}calcLayoutNoFitArea(e){if(!this.host||!this.canvas||!this.slider)return;const t=this._positionWidthWithMargin*this.Length,n=Math.min(Math.max(this.minHeight,this.root.clientHeight),this.maxHeight),i=Math.min(this.root.clientWidth,t);this.canvas.style.width=`${i}px`,this.canvas.style.height=`${n}px`,this.host.style.width=`${i}px`,this.host.style.height=`${this.root.clientHeight}px`,this.host.style.justifyContent=this.horizontalAlignment,this.host.style.alignContent=this.verticalAlignment===p.Lp.TOP?"start":this.verticalAlignment===p.Lp.MIDDLE?"center":this.verticalAlignment===p.Lp.BOTTOM?"end":"inherit",this.root.clientHeight<this.minHeight&&(this.host.style.alignContent="start",this.host.style.width=`${i+6}px`),this.host.style.width=`${this.host}px`;const r=t>i;if(this.setSliderVisibility(r),r){this.slider.root.style.removeProperty("display"),this.host.style.justifyContent="left",this.host.style.height=this.root.clientHeight-this.slider.root.offsetHeight+"px",this.slider.root.style.top=`${this.host.offsetHeight}px`;let e=Math.min(Math.max(0,this.slider.min),this.Length-.001),t=Math.min(Math.max(0,this.slider.max),this.Length-.001);const n=this.root.clientWidth/this._positionWidthWithMargin;t=Math.min(Math.max(e,0)+n,this.Length-.001),e=Math.max(0,Math.min(t,this.Length-.001)-n),this.slider.setValues(0,Math.max(this.Length-.001),e,t)}else this.slider.setValues(0,Math.max(0,this.Length-.001),0,Math.max(0,this.Length-.001));this.canvas.width=i*e,this.canvas.height=n*e}calcLayoutFitArea(e){if(!this.host||!this.canvas||!this.slider)return;const t=this._positionWidth*this.Length,n=Math.min(Math.max(this.minHeight,this.root.clientHeight),this.maxHeight),i=t>0?(this.root.clientWidth-this.positionMarginValue*this.Length)/t:0,r=this.root.clientHeight/n,s=Math.max(1,Math.min(i,r));this._positionWidth=this.positionWidth*s,this._positionWidthWithMargin=this._positionWidth+this.positionMarginValue;const o=(this._positionWidth+this.positionMarginValue)*this.Length,a=s*n,l=Math.min(this.root.clientWidth,o);this.canvas.style.width=`${l}px`,this.canvas.style.height=`${a}px`,this.host.style.width=`${l}px`,this.host.style.height=`${this.root.clientHeight}px`,this.host.style.justifyContent=this.horizontalAlignment,this.host.style.alignContent=this.verticalAlignment===p.Lp.TOP?"start":this.verticalAlignment===p.Lp.MIDDLE?"center":this.verticalAlignment===p.Lp.BOTTOM?"end":"inherit",this.root.clientHeight<this.minHeight&&(this.host.style.alignContent="start",this.host.style.width=`${l+6}px`),this.host.style.width=`${this.host}px`;const c=o>l;if(this.setSliderVisibility(c),c){this.slider.root.style.removeProperty("display"),this.host.style.justifyContent="left",this.host.style.height=this.root.clientHeight-this.slider.root.offsetHeight+"px",this.slider.root.style.top=`${this.host.offsetHeight}px`;let e=Math.min(Math.max(0,this.slider.min),this.Length-.001),t=Math.min(Math.max(0,this.slider.max),this.Length-.001);const n=this.root.clientWidth/this._positionWidthWithMargin;t=Math.min(Math.max(e,0)+n,this.Length-.001),e=Math.max(0,Math.min(t,this.Length-.001)-n),this.slider.setValues(0,Math.max(0,this.Length-.001),e,t)}else this.slider.setValues(0,Math.max(0,this.Length-.001),0,Math.max(0,this.Length-.001));this.canvas.width=l*e,this.canvas.height=a*e}onPropertyChanged(e){switch(super.onPropertyChanged(e),e.name){case v.sequenceColumnName:this.updateSeqCol();break;case v.sequenceColumnName:case v.startPositionName:case v.endPositionName:case v.filterSource:case v.shrinkEmptyTail:case v.skipEmptyPositions:case v.positionHeight:case v.valueColumnName:case v.valueAggrType:this.render(E.Freqs,`onPropertyChanged( ${e.name} )`);break;case v.minHeight:case v.maxHeight:case v.positionWidth:case v.showPositionLabels:case v.fixWidth:case v.fitArea:case v.horizontalAlignment:case v.verticalAlignment:case v.positionMargin:case v.positionMarginState:this.render(E.Layout,`onPropertyChanged(${e.name})`);break;case v.backgroundColor:this.render(E.Render,`onPropertyChanged(${e.name})`)}}onTableAttached(){C._package.logger.debug(`${this.toLog()}.onTableAttached(), `),super.onTableAttached(),this.setData()}detach(){const e=`${this.toLog()}.detach()`;C._package.logger.debug(`${e}, in`);const t=super.detach.bind(this);this.viewSyncer.sync(`${e}`,(async()=>{this.setDataInProgress||(this.viewed&&(await this.destroyView(),this.viewed=!1),t())})),C._package.logger.debug(`${e}, out`)}_onSizeChanged=new u.Subject;get onSizeChanged(){return this._onSizeChanged}_onFreqsCalculated=new u.Subject;get onFreqsCalculated(){return this._onFreqsCalculated}_onLayoutCalculated=new u.Subject;get onLayoutCalculated(){return this._onLayoutCalculated}getMonomer(e,t){const n=e.x,i=Math.floor(e.x/(this._positionWidthWithMargin*t)+Math.floor(this.slider.min)),r=this.positions[i];if(!r)return[null,null,null];const s=r.getMonomerAt(n,e.y);return void 0===s?[r,null,null]:[r,s,r.getFreq(s)]}_nullSequence(e="X"){return this.skipEmptySequences?"":new Array(this.Length).fill(e).join("")}_removeEmptyPositions(){this.skipEmptyPositions&&(this.positions=c()(this.positions).filter((e=>!e.hasMonomer(f._S)||e.getFreq(f._S).rowCount!==e.sumRowCount)).toArray())}requestedRenderLevel=E.Freqs;renderRequest=new u.Subject;renderRequestSub;render(e,t){C._package.logger.debug(`${this.toLog()}.render( recalcLevelVal=${e}, reason='${t}' )`),this.requestedRenderLevel=Math.max(this.requestedRenderLevel,e),this.renderRequest.next(this.requestedRenderLevel)}async renderInt(e){if(C._package.logger.debug(`${this.toLog()}.render.renderInt( renderLevel=${e} ), start `),this.msgHost&&(this.seqCol&&!this.palette?(this.msgHost.innerText=`Unknown palette (column semType: '${this.seqCol.semType}').`,this.msgHost.style.display=""):this.msgHost.style.display="none"),!this.seqCol||!this.dataFrame||!this.palette||null==this.host||null==this.slider)return;const t=window.devicePixelRatio,n=this.showPositionLabels?12:0;if(e>=E.Freqs&&(()=>{if(C._package.logger.debug(`${this.toLog()}.render.calculateFreqsInt(), start `),!this.host||!this.seqCol||!this.dataFrame)return;const e=this.seqCol.getTag(d.gp.positionNames),t=this.seqCol.getTag(d.gp.positionLabels);let n;!e&&this.endPositionName&&/\d+/.test(this.endPositionName)?n=Number(this.endPositionName):e&&this.endPositionName&&(n=e.split(d.z1).indexOf(this.endPositionName),n=-1!==n?n:void 0);const i=this.getFilter(),r=0===i.trueCount?this.seqHandler.maxLength:c().count(0).take(this.seqHandler.length).map((e=>{const t=this.seqHandler.getSplitted(e,n);return i.get(e)&&t?t.length:0})).reduce(((e,t)=>Math.max(e,t)),0);this.positionNames=e?e.split(d.z1).map((e=>e.trim())):[...Array(r).keys()].map((e=>`${e+1}`)),this.positionLabels=t?t.split(d.z1).map((e=>e.trim())):void 0,this.startPosition=this.startPositionName&&this.positionNames&&this.positionNames.includes(this.startPositionName)?this.positionNames.indexOf(this.startPositionName):0,this.endPosition=this.endPositionName&&this.positionNames&&this.positionNames.includes(this.endPositionName)?this.positionNames.indexOf(this.endPositionName):r-1;const o=this.startPosition<=this.endPosition?this.endPosition-this.startPosition+1:0;this.seqHandler=h.GO.forColumn(this.seqCol);const a=this.startPosition<=this.endPosition?this.endPosition-this.startPosition+1:0;this.positions=new Array(a);for(let e=0;e<o;e++){const t=this.positionNames[this.startPosition+e],n=this.positionLabels?this.positionLabels[this.startPosition+e]:void 0;this.positions[e]=new S(this.startPosition+e,t,{},{label:n})}const l=this.dataFrame.rowCount;for(let e=0;e<o;++e){for(let t=0;t<l;++t)if(i.get(t)){const n=this.seqHandler.getSplitted(t),i=e<n.length?n.getCanonical(this.startPosition+e):this.seqHandler.defaultGapOriginal,r=this.seqHandler.defaultGapOriginal===i?f._S:i,s=this.positions[e],o=s.getFreq(r);++s.sumRowCount,o.value=++o.rowCount}if(this.valueAggrType===s.AGG.TOTAL_COUNT)continue;let t=null;try{t=this.dataFrame.getCol(this.valueColumnName),t.matches("numerical")||(t=null)}catch{t=null}if(t){for(let n=0;n<l;++n)if(i.get(n)){const i=this.seqHandler.getSplitted(n).getCanonical(this.startPosition+e),r=t.get(n);this.positions[e].getFreq(i).push(r)}this.positions[e].aggregate(this.valueAggrType)}}const u=this.valueAggrType===s.AGG.TOTAL_COUNT?0:Math.min(0,Math.min(...this.positions.map((e=>e.getMinValue()))));for(let e=0;e<o;++e)this.positions[e].calcPlotValue(u),this.positions[e].calcHeights(this.positionHeight);this._removeEmptyPositions(),this._onFreqsCalculated.next()})(),this.calcLayout(t),-1===this.startPosition)return;const r=Math.max(Math.floor(this.slider.min),0),o=Math.min(this.positions.length-1,Math.floor(this.slider.max));e>=E.Layout&&((e,t,n,r)=>{C._package.logger.debug(`${this.toLog()}.render.calculateLayoutInt(), start `);const o=this.canvas.height-r*n;let a;if(this.valueAggrType===s.AGG.TOTAL_COUNT){const e=this.getAlphabetSize();this.positionHeight==p.fH.Entropy&&null==e&&i.shell.error("WebLogo: alphabet is undefined."),a=Math.log2(e)}else a=Math.max(...c().count(e).takeWhile((e=>e<=t)).map((e=>this.positions[e].sumPlotValueForHeight)));for(let i=e;i<=t;++i)i in this.positions?this.positions[i].calcScreen(i,this.slider.min,o,this.positionHeight,a,this._positionWidthWithMargin,this._positionWidth,n,r):C._package.logger.warning(`${this.toLog()}.render.calculateLayoutInt() this.positions.length = ${this.positions.length}, jPos = ${i}`);C._package.logger.debug(`${this.toLog()}.render.calculateLayoutInt(), end `),this._onLayoutCalculated.next()})(r,o,window.devicePixelRatio,n);const a=this.canvas.getContext("2d");if(a){a.save();try{this.Length,a.resetTransform(),a.fillStyle=function(e){const t=s.Color.a(e);return`#${(16777215&e).toString(16).padStart(6,"0")}`+t.toString(16).padStart(2,"0")}(this.backgroundColor),a.fillRect(0,0,this.canvas.width,this.canvas.height),a.textBaseline=this.textBaseline;const e=10*t;a.resetTransform(),a.fillStyle="black",a.textAlign="center",a.font=`${e.toFixed(1)}px Roboto, Roboto Local, sans-serif`,n>0&&this.positions.length>0&&function(e,t,n,i,r,s,o,a){e.save();try{e.textAlign="center";let l=null,c=null;for(let t=Math.floor(o);t<=Math.floor(a);t++){const n=s[t],i=e.measureText(n.name),r=i.actualBoundingBoxDescent-i.actualBoundingBoxAscent;l=null===l?i.width:Math.max(l,i.width),c=null===c?r:Math.max(c,r)}const u=l<i*t-2?1:(i*t-2)/l;for(let l=Math.floor(o);l<=Math.floor(a);l++){const a=s[l],h=(l-o)*n*t+i*t/2,d=(r*t-c)/2;e.setTransform(u,0,0,1,h,d),e.measureText(a.label),e.fillText(a.label,0,0)}}finally{e.restore()}}(a,t,this._positionWidthWithMargin,this._positionWidth,n,this.positions,this.slider.min,this.slider.max);const i="16px Roboto, Roboto Local, sans-serif",l=.25,c=12.2;for(let e=r;e<=o;e++)this.positions[e].render(a,i,l,c,this.palette)}finally{a.restore()}C._package.logger.debug(`${this.toLog()}.render.renderInt( recalcLevel=${e} ), end`)}}renderRequestOnDebounce(e){const t=`${this.toLog()}.renderRequestOnDebounce()`;"HTML"!==a()(this.root).offsetParent().get()[0]?.tagName?(this.requestedRenderLevel=E.None,this.viewSyncer.sync(t,(async()=>{await this.renderInt(e)}))):C._package.logger.warning(`${t}, $(this.root).offsetParent() is the 'HTML' tag.`)}_lastWidth;_lastHeight;getAlphabetSize(){return this.seqHandler?.getAlphabetSize()??0}sliderOnValuesChanged(e){try{const e={minRange:this.slider.minRange,min:this.slider.min,max:this.slider.max,maxRange:this.slider.maxRange};C._package.logger.debug(`${this.toLog()}.sliderOnValuesChanged( ${JSON.stringify(e)} ), start`),this.render(E.Layout,"sliderOnValuesChanged")}catch(e){const t=m(e);C._package.logger.error(`${this.toLog()}.sliderOnValuesChanged() error:\n`+t)}}dataFrameFilterOnChanged(e){C._package.logger.debug(`${this.toLog()}.dataFrameFilterChanged()`);try{this.filterSource===p.lT.Filtered&&this.render(E.Freqs,"dataFrameFilterOnChanged")}catch(e){const t=m(e);C._package.logger.error(`${this.toLog()}.dataFrameFilterOnChanged() error:\n`+t)}}dataFrameSelectionOnChanged(e){C._package.logger.debug(`${this.toLog()}.dataFrameSelectionOnChanged()`);try{this.filterSource===p.lT.Selected&&this.render(E.Freqs,"dataFrameSelectionOnChanged")}catch(e){const t=m(e);C._package.logger.error(`${this.toLog()}.dataFrameSelectionOnChanged() error:\n`+t)}}canvasOnMouseMove(e){const t=window.devicePixelRatio;try{const n=e,i=this.canvas.getCursorPosition(n,t),[o,a]=this.getMonomer(i,t),l=this.showPositionLabels?12*t:0;if(null!==o&&null===a&&0<=i.y&&i.y<=l){const e=[r.divText(`Position ${o.label}`)];this.valueAggrType===s.AGG.TOTAL_COUNT&&e.push(o.buildCompositionTable(this.palette));const t=r.divV(e);r.tooltip.show(t,n.x+16,n.y+16)}else if(null!==o&&a&&this.dataFrame&&this.seqCol&&this.seqHandler){const e=o.getFreq(a),t=[r.div(`${a}`),r.div(`${e.rowCount} rows`)];this.valueAggrType!==s.AGG.TOTAL_COUNT&&t.push(r.div(`${this.valueAggrType}: ${e.value.toFixed(3)}`));const i=r.divV(t);r.tooltip.show(i,n.x+16,n.y+16)}else r.tooltip.hide()}catch(e){const t=m(e);C._package.logger.error(`${this.toLog()}.canvasOnMouseMove() error:\n`+t)}}canvasOnMouseDown(e){try{const t=e,n=window.devicePixelRatio,[i,r]=this.getMonomer(this.canvas.getCursorPosition(t,n),n);if(null!==i&&null!==r&&this.dataFrame&&this.seqCol&&this.seqHandler){const e=s.BitSet.create(this.dataFrame.selection.length,(e=>function(e,t,n,i,r,s){const o=t.getSplitted(i),a=s.pos<o.length?o.getCanonical(s.pos):null;return null!==a&&a===r}(this.dataFrame,this.seqHandler,this.getFilter(),e,r,i)));this.dataFrame.selection.init((t=>e.get(t)))}}catch(e){const t=m(e);C._package.logger.error(`${this.toLog()}.canvasOnMouseDown() error:\n`+t)}}canvasOnWheel(e){const t=window.devicePixelRatio;try{if(!this.visibleSlider)return;const n=this.canvas.width/(this._positionWidthWithMargin*t),i=e.deltaY/100*Math.max(Math.floor(n/5),1);this.slider.scrollBy(this.slider.min+i)}catch(e){const t=m(e);C._package.logger.error(`${this.toLog()}.canvasOnWheel() error:\n`+t)}}_onRendered=new u.Subject;get onRendered(){return this._onRendered}invalidate(e){const t=`invalidate(${e?` <- ${e} `:""})`,n=`${this.toLog()}.${t}`;this.render(E.None,t),this.viewSyncer.sync(`${n}`,(async()=>{this._onRendered.next()}))}async awaitRendered(e=5e3){await(0,g.PE)(this.onRendered,(()=>{}),(()=>{this.invalidate()}),e);const t=this.viewSyncer.resetErrors();if(t.length>0)throw t[0]}}},4577:(e,t,n)=>{"use strict";n.d(t,{O:()=>o,n:()=>s});var i=n(1858),r=n(6355);class s{substructure;readOnly;constructor(e,t=!0){return this.substructure=e,this.readOnly=t,new Proxy(this,{set:(e,t,n)=>{if(r._package.logger.debug(`BioFilterProps.set ${t.toString()}( '${n}' )`),this.readOnly)throw new Error("Properties are immutable.");return e[t]=n,!0}})}}class o{onChanged=new i.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:()=>E});var i=n(7389),r=n(6082),s=n(4328),o=n(1991),a=n.n(o),l=n(1858),c=n(2003),u=n(8070),h=n(826),d=n(7602),p=n(8115),m=n(4577),f=n(1757),g=n.n(f),y=n(9124),b=n(9192),v=n(4870),w=n(6355);class C extends m.O{emptyProps=new m.n("");helmEditor;_filterPanel=i.div("",{style:{cursor:"pointer"}});logger;static viewerCounter=-1;viewerId=++C.viewerCounter;viewerToLog(){return`HelmBioFilter<${this.viewerId}>`}get type(){return"HelmBioFilter"}constructor(){super(),this.logger=w._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 i.tools.waitForElementInDom(this._filterPanel),this.logger.warning("TEST: HelmBioFilter.init().sync() waitForElementInDom ready"),this.updateFilterPanel(),this.viewSubs.push((0,l.fromEvent)(this._filterPanel,"click").subscribe((()=>{t=i.div(),n=e.createWebEditorApp(t,this.props.substructure),i.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(i.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,b.AP)(e);this.logger.error(t,void 0,n)}})))}catch(e){const[t,n]=(0,b.AP)(e),r=this._filterPanel;r.innerText="error",r.classList.add("d4-error"),i.tooltip.bind(r,t)}}applyProps(){this.helmEditor&&this.updateFilterPanel(this.props.substructure)}get filterPanel(){return this._filterPanel}updateFilterPanel(e){if(!this.helmEditor)throw new Error("helmEditor is not created, the filter is not in dom yet");const t=this._filterPanel.parentElement.clientWidth<100?100:this._filterPanel.parentElement.clientWidth,n=t/2;if(e)(0,v.K)(this._filterPanel,this.helmEditor.host),this.helmEditor.editor.setHelm(e),this.helmEditor.resizeEditor(t,n);else{const e=i.divText("Click to edit","helm-substructure-filter");(0,v.K)(this._filterPanel,e)}}async substructureSearch(e){const t=`${this.viewerToLog()}.substructureSearch( column = <${e.name}> )`;w._package.logger.debug(`${t}, start`);try{return await(0,u.cb)(10),await(0,p.if)(this.props.substructure,e)}finally{w._package.logger.debug(`${t}, end`)}}}const A="bio-substructure-filter";class S{props;filterId;dataFrameId;columnName;bitset;constructor(e,t,n,i,r){this.props=e,this.filterId=t,this.dataFrameId=n,this.columnName=i,this.bitset=r}}class x extends m.n{separator;constructor(e,t){super(e,!1),this.separator=t,this.readOnly=!0}}class E extends r.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=i.divV([]),this.loader=i.loader(),this.calculating=!1,this.filterSyncer=new d.g(this.logger=w._package.logger),new Proxy(this,{set:(e,t,n)=>(e[t]=n,!0)})}static filterCounter=-1;filterId=++E.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(r.SEMTYPE.MACROMOLECULE)),h.GO.forColumn(this.column),this.columnName??=this.column?.name,this.notation??=this.column?.meta.units,this.bioFilter=this.notation===c.Hi.FASTA?new _:this.notation===c.Hi.SEPARATOR?new M(this.column.getTag(c.gp.separator)):new C,this.root.appendChild(this.bioFilter.filterPanel),this.root.appendChild(this.loader),await this.bioFilter.attach(),this.viewSubs.push(r.debounce(this.bioFilter.onChanged,this.debounceTime).subscribe(this.bioFilterOnChangedDebounced.bind(this))),this.viewSubs.push(s.events.onResetFilterRequest.subscribe(this.grokEventsOnResetFilterRequest.bind(this))),this.viewSubs.push(s.events.onCustomEvent(A).subscribe(this.filterOnSync.bind(this)))}))}detach(){const e=super.detach.bind(this),t=`${this.filterToLog()}.detach()`;this.filterSyncer.sync(t,(async()=>{for(const e of this.viewSubs)e.unsubscribe();this.viewSubs=[],e(),this.bioFilter&&this.bioFilter.detach(),this.bioFilter=null}))}filterOnSync(e){e.filterId!==this.filterId&&e.dataFrameId===this.dataFrame.id&&e.columnName===this.columnName&&(this.bioFilter.props=e.props)}applyFilter(){const e=`${this.filterToLog()}.applyFilter()`;this.logger.debug(`${e}, IN`),this.bitset&&!this.isDetached&&this.dataFrame?.filter.and(this.bitset)}saveState(){const e=`${this.filterToLog()}.saveState()`,t=super.saveState();return this.logger.debug(`${e}, super.state = ${JSON.stringify(t)}`),t.props=this.bioFilter.saveProps(),t}applyState(e){const t=`${this.filterToLog()}.applyState()`;super.applyState(e),this.filterSyncer.sync(t,(async()=>{e.props&&this.bioFilter&&(this.bioFilter.props=r.toJs(e.props??{}))}))}fireFilterSync(){const e=`${this.filterToLog()}.fireFilterSync()`;w._package.logger.debug(`${e}, bioFilter = ${this.bioFilter?this.bioFilter.constructor.name:"null"}`+(this.bioFilter?`, props = ${JSON.stringify(this.bioFilter.saveProps())}`:"")),s.events.fireCustomEvent(A,new S(this.bioFilter.props,this.filterId,this.dataFrame.id,this.columnName,this.bitset))}bioFilterOnChangedDebounced(){if(!this.dataFrame)return;const e=`${this.filterToLog()}.bioFilterOnChangedDebounced()`;if(w._package.logger.debug(`${e}, start, isFiltering = ${this.isFiltering}, props = ${JSON.stringify(this.bioFilter.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{w._package.logger.debug(`${e}, before substructureSearch`),this.bitset=await(this.bioFilter?.substructureSearch(this.column)),w._package.logger.debug(`${e}, after substructureSearch`),this.calculating=!1,this.fireFilterSync(),this.dataFrame?.rows.requestFilter()}finally{this.calculating=!1,w._package.logger.debug(`${e}, end`)}}))}grokEventsOnResetFilterRequest(){const e=`${this.filterToLog()}.grokEventsOnResetFilterRequest()`;w._package.logger.debug(`${e}`),this.bioFilter?.resetFilter()}_onRendered=new l.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 i=this.filterSyncer.resetErrors();if(i.length>0)throw i[0]}}class _ extends m.O{emptyProps=new m.n("");substructureInput;get type(){return"FastaBioFilter"}constructor(){super(),this.substructureInput=i.input.string("",{value:"",onValueChanged:()=>{this.props=new m.n(this.substructureInput.value),this._propsChanging||this.onChanged.next()},placeholder:"Substructure"})}applyProps(){this.substructureInput.value!==this.props.substructure&&(this.substructureInput.value=this.props.substructure)}get filterPanel(){return this.substructureInput.root}get isFiltering(){return""!==this.substructureInput.value}async substructureSearch(e){return(0,p.nI)(this.props.substructure,e)}async attach(){}async detach(){await super.detach()}}class M extends m.O{emptyProps=new x("",void 0);substructureInput;separatorInput;colSeparator="";get type(){return"SeparatorBioFilter"}constructor(e){super(),this.substructureInput=i.input.string("",{value:"",onValueChanged:()=>{this.props=new x(this.substructureInput.value,this.props.separator),this._propsChanging||this.onChanged.next()},placeholder:"Substructure"}),this.separatorInput=i.input.string("",{value:this.colSeparator=e,onValueChanged:()=>{const e=this.separatorInput.value?this.separatorInput.value:void 0;this.props=new x(this.props.substructure,e),this._propsChanging||this.onChanged.next()},placeholder:"Separator"})}applyProps(){this.substructureInput.value!==this.props.substructure&&(this.substructureInput.value=this.props.substructure);const e=this.props.separator??this.colSeparator;this.separatorInput.value!==e&&(this.separatorInput.value=e)}get filterSummary(){return this.props.separator?this.props.separator:this.colSeparator,`${this.props.substructure}, {sep}`}get isFiltering(){return""!==this.props.substructure}resetFilter(){this.props=new x("")}get filterPanel(){return i.divV([this.substructureInput.root,this.separatorInput.root])}get substructure(){return this.separatorInput.value&&this.separatorInput.value!==this.colSeparator?this.substructureInput.value.replaceAll(this.separatorInput.value,this.colSeparator):this.substructureInput.value}set substructure(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:()=>_,j:()=>E});var i=n(7389),r=n(6082),s=n(1991),o=n.n(s),a=n(2003),l=n(4152),c=n(5072),u=n.n(c),h=n(7825),d=n.n(h),p=n(7659),m=n.n(p),f=n(5056),g=n.n(f),y=n(540),b=n.n(y),v=n(1113),w=n.n(v),C=n(5999),A={};A.styleTagTransform=w(),A.setAttributes=g(),A.insert=m().bind(null,"head"),A.domAPI=d(),A.insertStyleElement=b(),u()(C.A,A),C.A&&C.A.locals&&C.A.locals;var S=n(826),x=n(2738);function E(e){const t=i.div();t.classList.add("macromolecule-cell-comp-analysis-host");const n=e.cell.column.tags[a.gp.alphabet];let s=l.oT.Color;switch(n){case a.YI.DNA:case a.YI.RNA:s=(0,a.ny)(a.YI.DNA);break;case a.YI.PT:s=(0,a.ny)(a.YI.PT)}const c={},u=S.GO.forColumn(e.cell.column),h=e.cell.rowIndex,d=u.getSplitted(h);o()(d.canonicals).filter((e=>e!==x._S)).forEach((e=>{const t=c[e]||0;c[e]=t+1}));const p=_(s,c);return Array.from(p.rows).forEach((e=>{const t=e.getElementsByClassName("macromolecule-cell-comp-analysis-bar")[0].style.backgroundColor;e.cells[0].style.color=t})),t.appendChild(p),new r.Widget(t)}function _(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,l=e.get(t),c=i.div("",{classes:"macromolecule-cell-comp-analysis-bar"});c.style.width=50*a/o+"px",c.style.backgroundColor=l,x._S===t&&(c.style.borderWidth="1px",c.style.borderStyle="solid",c.style.borderColor=r.Color.toHtml(r.Color.lightGray));const u=x._S===t?"-":t,h=i.div(`${(100*a).toFixed(2)}%`),d=i.div([c,h],{classes:"macromolecule-cell-comp-analysis-value"});return{[u]:d}}))),l=i.tableFromMap(a);return Array.from(l.rows).forEach((e=>{const t=e.getElementsByClassName("macromolecule-cell-comp-analysis-bar")[0].style.backgroundColor;e.cells[0].style.color=t})),l}},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:i,normalizeIPv4:r,removeDotSegments:s,recomposeAuthority:o,normalizeComponentEncoding:a}=n(4834),l=n(343);function c(e,t,n,i){const r={};return i||(e=p(u(e,n),n),t=p(u(t,n),n)),!(n=n||{}).tolerant&&t.scheme?(r.scheme=t.scheme,r.userinfo=t.userinfo,r.host=t.host,r.port=t.port,r.path=s(t.path||""),r.query=t.query):(void 0!==t.userinfo||void 0!==t.host||void 0!==t.port?(r.userinfo=t.userinfo,r.host=t.host,r.port=t.port,r.path=s(t.path||""),r.query=t.query):(t.path?("/"===t.path.charAt(0)?r.path=s(t.path):(void 0===e.userinfo&&void 0===e.host&&void 0===e.port||e.path?e.path?r.path=e.path.slice(0,e.path.lastIndexOf("/")+1)+t.path:r.path=t.path:r.path="/"+t.path,r.path=s(r.path)),r.query=t.query):(r.path=e.path,void 0!==t.query?r.query=t.query:r.query=e.query),r.userinfo=e.userinfo,r.host=e.host,r.port=e.port),r.scheme=e.scheme),r.fragment=t.fragment,r}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:""},i=Object.assign({},t),r=[],a=l[(i.scheme||n.scheme||"").toLowerCase()];a&&a.serialize&&a.serialize(n,i),void 0!==n.path&&(i.skipEscape?n.path=unescape(n.path):(n.path=escape(n.path),void 0!==n.scheme&&(n.path=n.path.split("%3A").join(":")))),"suffix"!==i.reference&&n.scheme&&(r.push(n.scheme),r.push(":"));const c=o(n,i);if(void 0!==c&&("suffix"!==i.reference&&r.push("//"),r.push(c),n.path&&"/"!==n.path.charAt(0)&&r.push("/")),void 0!==n.path){let e=n.path;i.absolutePath||a&&a.absolutePath||(e=s(e)),void 0===c&&(e=e.replace(/^\/\//u,"/%2F")),r.push(e)}return void 0!==n.query&&(r.push("?"),r.push(n.query)),void 0!==n.fragment&&(r.push("#"),r.push(n.fragment)),r.join("")}const h=Array.from({length:127},((e,t)=>/[^!"$&'()*+,\-.;=_`a-z{}~]/u.test(String.fromCharCode(t)))),d=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\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 c=e.match(d);if(c){if(s.scheme=c[1],s.userinfo=c[3],s.host=c[4],s.port=parseInt(c[5],10),s.path=c[6]||"",s.query=c[7],s.fragment=c[8],isNaN(s.port)&&(s.port=c[5]),s.host){const e=r(s.host);if(!1===e.isIPV4){const t=i(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=l[(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,i=e.length;n<i;++n)if(t=e.charCodeAt(n),t>126||h[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:l,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 i=Object.assign({scheme:"null"},n);return u(c(p(e,i),p(t,i),i,!0),{...i,skipEscape:!0})},resolveComponents:c,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 i(e){return"boolean"==typeof e.secure?e.secure:"wss"===String(e.scheme).toLowerCase()}function r(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:r,serialize:s},a={scheme:"ws",domainHost:!0,parse:function(e){return e.secure=i(e),e.resourceName=(e.path||"/")+(e.query?"?"+e.query:""),e.path=void 0,e.query=void 0,e},serialize:function(e){if(e.port!==(i(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}},l={http:o,https:{scheme:"https",domainHost:o.domainHost,parse:r,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 i=e.path.match(n);if(i){const n=t.scheme||e.scheme||"urn";e.nid=i[1].toLowerCase(),e.nss=i[2];const r=`${n}:${t.nid||e.nid}`,s=l[r];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",i=e.nid.toLowerCase(),r=`${n}:${t.nid||i}`,s=l[r];s&&(e=s.serialize(e,t));const o=e,a=e.nss;return o.path=`${i||t.nid}:${a}`,t.skipEscape=!0,o},skipNormalize:!0},"urn:uuid":{scheme:"urn:uuid",parse:function(e,n){const i=e;return i.uuid=i.nss,i.nss=void 0,n.tolerant||i.uuid&&t.test(i.uuid)||(i.error=i.error||"UUID is not valid."),i},serialize:function(e){const t=e;return t.nss=(e.uuid||"").toLowerCase(),t},skipNormalize:!0}};e.exports=l},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:i}=n(4914);function r(e){if(l(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="",r=!0;for(const t of e){if(void 0===i[t])return;"0"!==t&&!0===r&&(r=!1),r||(n+=t)}return t&&0===n.length&&(n="0"),n}function o(e,t={}){if(l(e,":")<2)return{host:e,isIPV6:!1};const n=function(e){let t=0;const n={error:!1,address:"",zone:""},i=[],r=[];let o=!1,a=!1,l=!1;function c(){if(r.length){if(!1===o){const e=s(r);if(void 0===e)return n.error=!0,!1;i.push(e)}r.length=0}return!0}for(let s=0;s<e.length;s++){const u=e[s];if("["!==u&&"]"!==u)if(":"!==u)if("%"===u){if(!c())break;o=!0}else r.push(u);else{if(!0===a&&(l=!0),!c())break;if(t++,i.push(":"),t>7){n.error=!0;break}s-1>=0&&":"===e[s-1]&&(a=!0)}}return r.length&&(o?n.zone=r.join(""):l?i.push(r.join("")):i.push(s(r))),n.address=i.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="",i=!0;const r=e.length;for(let s=0;s<r;s++){const o=e[s];"0"===o&&i?(s+1<=r&&e[s+1]===t||s+1===r)&&(n+=o,i=!1):(i=o===t,n+=o)}return n}function l(e,t){let n=0;for(let i=0;i<e.length;i++)e[i]===t&&n++;return n}const c=/^\.\.?\//u,u=/^\/\.(?:\/|$)/u,h=/^\/\.\.(?:\/|$)/u,d=/^\/?(?:.|\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 i=r(t);if(i.isIPV4)t=i.host;else{const n=o(i.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(c))e=e.replace(c,"");else if(e.match(u))e=e.replace(u,"/");else if(e.match(h))e=e.replace(h,"/"),t.pop();else if("."===e||".."===e)e="";else{const n=e.match(d);if(!n)throw new Error("Unexpected dot segment condition");{const i=n[0];e=e.slice(i.length),t.push(i)}}return t.join("")},normalizeIPv4:r,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(i){var r=t[i];if(void 0!==r)return r.exports;var s=t[i]={id:i,loaded:!1,exports:{}};return e[i].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 i in t)n.o(t,i)&&!n.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},n.u=e=>e+".js",n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.hmd=e=>((e=Object.create(e)).children||(e.children=[]),Object.defineProperty(e,"exports",{enumerable:!0,set:()=>{throw new Error("ES Modules may not assign module.exports or exports.*, Use ESM export syntax, instead: "+e.id)}}),e),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e;n.g.importScripts&&(e=n.g.location+"");var t=n.g.document;if(!e&&t&&(t.currentScript&&(e=t.currentScript.src),!e)){var i=t.getElementsByTagName("script");if(i.length)for(var r=i.length-1;r>-1&&(!e||!/^http(s?):/.test(e));)e=i[r--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),n.p=e})(),n.b=document.baseURI||self.location.href,n.nc=void 0;var i=n(6355);bio=i})();
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 i in e)"__proto__"!==i&&((Array.isArray(e[i])?t:n)[i]=e[i]);return[t,n]}(e);a(e,t),l(e,n)}};function a(e,t=e.schema){const{gen:n,data:r,it:o}=e;if(0===Object.keys(t).length)return;const a=n.let("missing");for(const l in t){const c=t[l];if(0===c.length)continue;const u=(0,s.propertyInData)(n,r,l,o.opts.ownProperties);e.setParams({property:l,depsCount:c.length,deps:c.join(", ")}),o.allErrors?n.if(u,(()=>{for(const t of c)(0,s.checkReportMissingProp)(e,t)})):(n.if(i._`${u} && (${(0,s.checkMissingProp)(e,c,a)})`),(0,s.reportMissingProp)(e,a),n.else())}}function l(e,t=e.schema){const{gen:n,data:i,keyword:o,it:a}=e,l=n.name("valid");for(const c in t)(0,r.alwaysValidSchema)(a,t[c])||(n.if((0,s.propertyInData)(n,i,c,a.opts.ownProperties),(()=>{const t=e.subschema({keyword:o,schemaProp:c},l);e.mergeValidEvaluated(t,l)}),(()=>n.var(l,!0))),e.ok(l))}t.validatePropertyDeps=a,t.validateSchemaDeps=l,t.default=o},4845:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(3025),r={keyword:"dependentSchemas",type:"object",schemaType:"object",code:e=>(0,i.validateSchemaDeps)(e)};t.default=r},1239:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(9029),r=n(4227),s={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:{message:({params:e})=>i.str`must match "${e.ifClause}" schema`,params:({params:e})=>i._`{failingKeyword: ${e.ifClause}}`},code(e){const{gen:t,parentSchema:n,it:s}=e;void 0===n.then&&void 0===n.else&&(0,r.checkStrictMode)(s,'"if" without "then" and "else" is ignored');const a=o(s,"then"),l=o(s,"else");if(!a&&!l)return;const c=t.let("valid",!0),u=t.name("_valid");if(function(){const t=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},u);e.mergeEvaluated(t)}(),e.reset(),a&&l){const n=t.let("ifClause");e.setParams({ifClause:n}),t.if(u,h("then",n),h("else",n))}else a?t.if(u,h("then")):t.if((0,i.not)(u),h("else"));function h(n,r){return()=>{const s=e.subschema({keyword:n},u);t.assign(c,u),e.mergeValidEvaluated(s,c),r?t.assign(r,i._`${n}`):e.setParams({ifClause:n})}}e.pass(c,(()=>e.error(!0)))}};function o(e,t){const n=e.schema[t];return void 0!==n&&!(0,r.alwaysValidSchema)(e,n)}t.default=s},6378:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(5457),r=n(5354),s=n(494),o=n(3966),a=n(2661),l=n(3025),c=n(9713),u=n(8660),h=n(117),d=n(5333),p=n(7923),m=n(6505),f=n(6163),g=n(5844),y=n(1239),b=n(4426);t.default=function(e=!1){const t=[p.default,m.default,f.default,g.default,y.default,b.default,c.default,u.default,l.default,h.default,d.default];return e?t.push(r.default,o.default):t.push(i.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 i=n(9029),r=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,r.alwaysValidSchema)(n,t)||e.ok((0,s.validateArray)(e))}};function a(e,t,n=e.schema){const{gen:s,parentSchema:o,data:a,keyword:l,it:c}=e;!function(e){const{opts:i,errSchemaPath:s}=c,o=n.length,a=o===e.minItems&&(o===e.maxItems||!1===e[t]);if(i.strictTuples&&!a){const e=`"${l}" is ${o}-tuple, but minItems or maxItems/${t} are not specified or different at path "${s}"`;(0,r.checkStrictMode)(c,e,i.strictTuples)}}(o),c.opts.unevaluated&&n.length&&!0!==c.items&&(c.items=r.mergeEvaluated.items(s,n.length,c.items));const u=s.name("valid"),h=s.const("len",i._`${a}.length`);n.forEach(((t,n)=>{(0,r.alwaysValidSchema)(c,t)||(s.if(i._`${h} > ${n}`,(()=>e.subschema({keyword:l,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 i=n(9029),r=n(4227),s=n(5765),o=n(5457),a={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:{message:({params:{len:e}})=>i.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>i._`{limit: ${e}}`},code(e){const{schema:t,parentSchema:n,it:i}=e,{prefixItems:a}=n;i.items=!0,(0,r.alwaysValidSchema)(i,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 i=n(4227),r={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){const{gen:t,schema:n,it:r}=e;if((0,i.alwaysValidSchema)(r,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=r},6163:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(9029),r=n(4227),s={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:{message:"must match exactly one schema in oneOf",params:({params:e})=>i._`{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,l=t.let("valid",!1),c=t.let("passing",null),u=t.name("_valid");e.setParams({passing:c}),t.block((function(){a.forEach(((n,s)=>{let a;(0,r.alwaysValidSchema)(o,n)?t.var(u,!0):a=e.subschema({keyword:"oneOf",schemaProp:s,compositeRule:!0},u),s>0&&t.if(i._`${u} && ${l}`).assign(l,!1).assign(c,i._`[${c}, ${s}]`).else(),t.if(u,(()=>{t.assign(l,!0),t.assign(c,s),a&&e.mergeEvaluated(a,i.Name)}))}))})),e.result(l,(()=>e.reset()),(()=>e.error(!0)))}};t.default=s},5333:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(5765),r=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:l,it:c}=e,{opts:u}=c,h=(0,i.allSchemaProperties)(n),d=h.filter((e=>(0,s.alwaysValidSchema)(c,n[e])));if(0===h.length||d.length===h.length&&(!c.opts.unevaluated||!0===c.props))return;const p=u.strictSchema&&!u.allowMatchingProperties&&l.properties,m=t.name("valid");!0===c.props||c.props instanceof r.Name||(c.props=(0,o.evaluatedPropsToName)(t,c.props));const{props:f}=c;function g(e){for(const t in p)new RegExp(e).test(t)&&(0,s.checkStrictMode)(c,`property ${t} matches pattern ${e} (use allowMatchingProperties)`)}function y(n){t.forIn("key",a,(s=>{t.if(r._`${(0,i.usePattern)(e,n)}.test(${s})`,(()=>{const i=d.includes(n);i||e.subschema({keyword:"patternProperties",schemaProp:n,dataProp:s,dataPropType:o.Type.Str},m),c.opts.unevaluated&&!0!==f?t.assign(r._`${f}[${s}]`,!0):i||c.allErrors||t.if((0,r.not)(m),(()=>t.break()))}))}))}!function(){for(const e of h)p&&g(e),c.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 i=n(494),r={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:e=>(0,i.validateTuple)(e,"items")};t.default=r},117:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2586),r=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:l,it:c}=e;"all"===c.opts.removeAdditional&&void 0===a.additionalProperties&&o.default.code(new i.KeywordCxt(c,o.default,"additionalProperties"));const u=(0,r.allSchemaProperties)(n);for(const e of u)c.definedProperties.add(e);c.opts.unevaluated&&u.length&&!0!==c.props&&(c.props=s.mergeEvaluated.props(t,(0,s.toHash)(u),c.props));const h=u.filter((e=>!(0,s.alwaysValidSchema)(c,n[e])));if(0===h.length)return;const d=t.name("valid");for(const n of h)p(n)?m(n):(t.if((0,r.propertyInData)(t,l,n,c.opts.ownProperties)),m(n),c.allErrors||t.else().var(d,!0),t.endIf()),e.it.definedProperties.add(n),e.ok(d);function p(e){return c.opts.useDefaults&&!c.compositeRule&&void 0!==n[e].default}function m(t){e.subschema({keyword:"properties",schemaProp:t,dataProp:t},d)}}};t.default=a},9713:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(9029),r=n(4227),s={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:{message:"property name must be valid",params:({params:e})=>i._`{propertyName: ${e.propertyName}}`},code(e){const{gen:t,schema:n,data:s,it:o}=e;if((0,r.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,i.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 i=n(4227),r={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:n}){void 0===t.if&&(0,i.checkStrictMode)(n,`"${e}" without "if" is ignored`)}};t.default=r},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 i=n(9029),r=n(4227),s=n(2023),o=n(4227);function a(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:i._`Object.prototype.hasOwnProperty`})}function l(e,t,n){return i._`${a(e)}.call(${t}, ${n})`}function c(e,t,n,r){const s=i._`${t}${(0,i.getProperty)(n)} === undefined`;return r?(0,i.or)(s,(0,i.not)(l(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:r,it:s}=e;n.if(c(n,r,t,s.opts.ownProperties),(()=>{e.setParams({missingProperty:i._`${t}`},!0),e.error()}))},t.checkMissingProp=function({gen:e,data:t,it:{opts:n}},r,s){return(0,i.or)(...r.map((r=>(0,i.and)(c(e,t,r,n.ownProperties),i._`${s} = ${r}`))))},t.reportMissingProp=function(e,t){e.setParams({missingProperty:t},!0),e.error()},t.hasPropFunc=a,t.isOwnProperty=l,t.propertyInData=function(e,t,n,r){const s=i._`${t}${(0,i.getProperty)(n)} !== undefined`;return r?i._`${s} && ${l(e,t,n)}`:s},t.noPropertyInData=c,t.allSchemaProperties=u,t.schemaProperties=function(e,t){return u(t).filter((n=>!(0,r.alwaysValidSchema)(e,t[n])))},t.callValidateCode=function({schemaCode:e,data:t,it:{gen:n,topSchemaRef:r,schemaPath:o,errorPath:a},it:l},c,u,h){const d=h?i._`${e}, ${t}, ${r}${o}`:t,p=[[s.default.instancePath,(0,i.strConcat)(s.default.instancePath,a)],[s.default.parentData,l.parentData],[s.default.parentDataProperty,l.parentDataProperty],[s.default.rootData,s.default.rootData]];l.opts.dynamicRef&&p.push([s.default.dynamicAnchors,s.default.dynamicAnchors]);const m=i._`${d}, ${n.object(...p)}`;return u!==i.nil?i._`${c}.call(${u}, ${m})`:i._`${c}(${m})`};const h=i._`new RegExp`;t.usePattern=function({gen:e,it:{opts:t}},n){const r=t.unicodeRegExp?"u":"",{regExp:s}=t.code,a=s(n,r);return e.scopeValue("pattern",{key:a.toString(),ref:a,code:i._`${"new RegExp"===s.code?h:(0,o.useFunc)(e,s)}(${n}, ${r})`})},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 l((()=>t.assign(e,!1))),e}return t.var(a,!0),l((()=>t.break())),a;function l(o){const l=t.const("len",i._`${n}.length`);t.forRange("i",0,l,(n=>{e.subschema({keyword:s,dataProp:n,dataPropType:r.Type.Num},a),t.if((0,i.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,r.alwaysValidSchema)(o,e)))&&!o.opts.unevaluated)return;const a=t.let("valid",!1),l=t.name("_valid");t.block((()=>n.forEach(((n,r)=>{const o=e.subschema({keyword:s,schemaProp:r,compositeRule:!0},l);t.assign(a,i._`${a} || ${l}`),e.mergeValidEvaluated(o,l)||t.if((0,i.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 i=n(3463),r=n(3693),s=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",i.default,r.default];t.default=s},3693:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.callRef=t.getValidate=void 0;const i=n(4551),r=n(5765),s=n(9029),o=n(2023),a=n(3835),l=n(4227),c={keyword:"$ref",schemaType:"string",code(e){const{gen:t,schema:n,it:r}=e,{baseId:o,schemaEnv:l,validateName:c,opts:d,self:p}=r,{root:m}=l;if(("#"===n||"#/"===n)&&o===m.baseId)return function(){if(l===m)return h(e,c,l,l.$async);const n=t.scopeValue("root",{ref:m});return h(e,s._`${n}.validate`,m,m.$async)}();const f=a.resolveRef.call(p,m,o,n);if(void 0===f)throw new i.default(r.opts.uriResolver,o,n);return f instanceof a.SchemaEnv?function(t){const n=u(e,t);h(e,n,t,t.$async)}(f):function(i){const r=t.scopeValue("schema",!0===d.code.source?{ref:i,code:(0,s.stringify)(i)}:{ref:i}),o=t.name("valid"),a=e.subschema({schema:i,dataTypes:[],schemaPath:s.nil,topSchemaRef:r,errSchemaPath:n},o);e.mergeEvaluated(a),e.ok(o)}(f)}};function u(e,t){const{gen:n}=e;return t.validate?n.scopeValue("validate",{ref:t.validate}):s._`${n.scopeValue("wrapper",{ref:t})}.validate`}function h(e,t,n,i){const{gen:a,it:c}=e,{allErrors:u,schemaEnv:h,opts:d}=c,p=d.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(!c.opts.unevaluated)return;const i=null===(t=null==n?void 0:n.validate)||void 0===t?void 0:t.evaluated;if(!0!==c.props)if(i&&!i.dynamicProps)void 0!==i.props&&(c.props=l.mergeEvaluated.props(a,i.props,c.props));else{const t=a.var("props",s._`${e}.evaluated.props`);c.props=l.mergeEvaluated.props(a,t,c.props,s.Name)}if(!0!==c.items)if(i&&!i.dynamicItems)void 0!==i.items&&(c.items=l.mergeEvaluated.items(a,i.items,c.items));else{const t=a.var("items",s._`${e}.evaluated.items`);c.items=l.mergeEvaluated.items(a,t,c.items,s.Name)}}i?function(){if(!h.$async)throw new Error("async schema referenced by sync schema");const n=a.let("valid");a.try((()=>{a.code(s._`await ${(0,r.callValidateCode)(e,t,p)}`),f(t),u||a.assign(n,!0)}),(e=>{a.if(s._`!(${e} instanceof ${c.ValidationError})`,(()=>a.throw(e))),m(e),u||a.assign(n,!1)})),e.ok(n)}():e.result((0,r.callValidateCode)(e,t,p),(()=>f(t)),(()=>m(t)))}t.getValidate=u,t.callRef=h,t.default=c},6653:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(9029),r=n(7652),s=n(3835),o=n(4551),a=n(4227),l={keyword:"discriminator",type:"object",schemaType:"object",error:{message:({params:{discrError:e,tagName:t}})=>e===r.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:n}})=>i._`{error: ${e}, tag: ${n}, tagValue: ${t}}`},code(e){const{gen:t,data:n,schema:l,parentSchema:c,it:u}=e,{oneOf:h}=c;if(!u.opts.discriminator)throw new Error("discriminator: requires discriminator option");const d=l.propertyName;if("string"!=typeof d)throw new Error("discriminator: requires propertyName");if(l.mapping)throw new Error("discriminator: mapping is not supported");if(!h)throw new Error("discriminator: requires oneOf keyword");const p=t.let("valid",!1),m=t.const("tag",i._`${n}${(0,i.getProperty)(d)}`);function f(n){const r=t.name("valid"),s=e.subschema({keyword:"oneOf",schemaProp:n},r);return e.mergeEvaluated(s,i.Name),r}t.if(i._`typeof ${m} == "string"`,(()=>function(){const n=function(){var e;const t={},n=r(c);let i=!0;for(let t=0;t<h.length;t++){let c=h[t];if((null==c?void 0:c.$ref)&&!(0,a.schemaHasRulesButRef)(c,u.self.RULES)){const e=c.$ref;if(c=s.resolveRef.call(u.self,u.schemaEnv.root,u.baseId,e),c instanceof s.SchemaEnv&&(c=c.schema),void 0===c)throw new o.default(u.opts.uriResolver,u.baseId,e)}const p=null===(e=null==c?void 0:c.properties)||void 0===e?void 0:e[d];if("object"!=typeof p)throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${d}"`);i=i&&(n||r(c)),l(p,t)}if(!i)throw new Error(`discriminator: "${d}" must be required`);return t;function r({required:e}){return Array.isArray(e)&&e.includes(d)}function l(e,t){if(e.const)p(e.const,t);else{if(!e.enum)throw new Error(`discriminator: "properties/${d}" 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: "${d}" values must be unique strings`);t[e]=n}}();t.if(!1);for(const e in n)t.elseIf(i._`${m} === ${e}`),t.assign(p,f(n[e]));t.else(),e.error(!1,{discrError:r.DiscrError.Mapping,tag:m,tagName:d}),t.endIf()}()),(()=>e.error(!1,{discrError:r.DiscrError.Tag,tag:m,tagName:d}))),e.ok(p)}};t.default=l},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 i=n(2128),r=n(7060),s=n(6378),o=n(5520),a=n(5413),l=n(3265),c=n(7532),u=n(9857),h=[o.default,i.default,r.default,(0,s.default)(!0),c.default,u.metadataVocabulary,u.contentVocabulary,a.default,l.default];t.default=h},6144:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2128),r=n(7060),s=n(6378),o=n(7532),a=n(9857),l=[i.default,r.default,(0,s.default)(),o.default,a.metadataVocabulary,a.contentVocabulary];t.default=l},2476:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.dynamicAnchor=void 0;const i=n(9029),r=n(2023),s=n(3835),o=n(3693),a={keyword:"$dynamicAnchor",schemaType:"string",code:e=>l(e,e.schema)};function l(e,t){const{gen:n,it:a}=e;a.schemaEnv.root.dynamicAnchors[t]=!0;const l=i._`${r.default.dynamicAnchors}${(0,i.getProperty)(t)}`,c="#"===a.errSchemaPath?a.validateName:function(e){const{schemaEnv:t,schema:n,self:i}=e.it,{root:r,baseId:a,localRefs:l,meta:c}=t.root,{schemaId:u}=i.opts,h=new s.SchemaEnv({schema:n,schemaId:u,root:r,baseId:a,localRefs:l,meta:c});return s.compileSchema.call(i,h),(0,o.getValidate)(e,h)}(e);n.if(i._`!${l}`,(()=>n.assign(l,c)))}t.dynamicAnchor=l,t.default=a},3252:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.dynamicRef=void 0;const i=n(9029),r=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 l=t.slice(1);if(a.allErrors)c();else{const t=n.let("valid",!1);c(t),e.ok(t)}function c(e){if(a.schemaEnv.root.dynamicAnchors[l]){const t=n.let("_v",i._`${r.default.dynamicAnchors}${(0,i.getProperty)(l)}`);n.if(t,u(t,e),u(a.validateName,e))}else u(a.validateName,e)()}function u(t,i){return i?()=>n.block((()=>{(0,s.callRef)(e,t),n.let(i,!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 i=n(2476),r=n(3252),s=n(2721),o=n(3799),a=[i.default,r.default,s.default,o.default];t.default=a},2721:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2476),r=n(4227),s={keyword:"$recursiveAnchor",schemaType:"boolean",code(e){e.schema?(0,i.dynamicAnchor)(e,""):(0,r.checkStrictMode)(e.it,"$recursiveAnchor: false is ignored")}};t.default=s},3799:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(3252),r={keyword:"$recursiveRef",schemaType:"string",code:e=>(0,i.dynamicRef)(e,e.schema)};t.default=r},4737:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(9029),r={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:{message:({schemaCode:e})=>i.str`must match format "${e}"`,params:({schemaCode:e})=>i._`{format: ${e}}`},code(e,t){const{gen:n,data:r,$data:s,schema:o,schemaCode:a,it:l}=e,{opts:c,errSchemaPath:u,schemaEnv:h,self:d}=l;c.validateFormats&&(s?function(){const s=n.scopeValue("formats",{ref:d.formats,code:c.code.formats}),o=n.const("fDef",i._`${s}[${a}]`),l=n.let("fType"),u=n.let("format");n.if(i._`typeof ${o} == "object" && !(${o} instanceof RegExp)`,(()=>n.assign(l,i._`${o}.type || "string"`).assign(u,i._`${o}.validate`)),(()=>n.assign(l,i._`"string"`).assign(u,o))),e.fail$data((0,i.or)(!1===c.strictSchema?i.nil:i._`${a} && !${u}`,function(){const e=h.$async?i._`(${o}.async ? await ${u}(${r}) : ${u}(${r}))`:i._`${u}(${r})`,n=i._`(typeof ${u} == "function" ? ${e} : ${u}.test(${r}))`;return i._`${u} && ${u} !== true && ${l} === ${t} && !${n}`}()))}():function(){const s=d.formats[o];if(!s)return void function(){if(!1!==c.strictSchema)throw new Error(e());function e(){return`unknown format "${o}" ignored in schema at path "${u}"`}d.logger.warn(e())}();if(!0===s)return;const[a,l,p]=function(e){const t=e instanceof RegExp?(0,i.regexpCode)(e):c.code.formats?i._`${c.code.formats}${(0,i.getProperty)(o)}`:void 0,r=n.scopeValue("formats",{key:o,ref:e,code:t});return"object"!=typeof e||e instanceof RegExp?["string",e,r]:[e.type||"string",e.validate,i._`${r}.validate`]}(s);a===t&&e.pass(function(){if("object"==typeof s&&!(s instanceof RegExp)&&s.async){if(!h.$async)throw new Error("async format in sync schema");return i._`await ${p}(${r})`}return"function"==typeof l?i._`${p}(${r})`:i._`${p}.test(${r})`}())}())}};t.default=r},7532:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=[n(4737).default];t.default=i},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 i=n(1846),r=n(4845),s=n(2626),o=[i.default,r.default,s.default];t.default=o},3265:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(392),r=n(3445),s=[i.default,r.default];t.default=s},3445:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(9029),r=n(4227),s={keyword:"unevaluatedItems",type:"array",schemaType:["boolean","object"],error:{message:({params:{len:e}})=>i.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>i._`{limit: ${e}}`},code(e){const{gen:t,schema:n,data:s,it:o}=e,a=o.items||0;if(!0===a)return;const l=t.const("len",i._`${s}.length`);if(!1===n)e.setParams({len:a}),e.fail(i._`${l} > ${a}`);else if("object"==typeof n&&!(0,r.alwaysValidSchema)(o,n)){const n=t.var("valid",i._`${l} <= ${a}`);t.if((0,i.not)(n),(()=>function(n,s){t.forRange("i",s,l,(s=>{e.subschema({keyword:"unevaluatedItems",dataProp:s,dataPropType:r.Type.Num},n),o.allErrors||t.if((0,i.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 i=n(9029),r=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})=>i._`{unevaluatedProperty: ${e.unevaluatedProperty}}`},code(e){const{gen:t,schema:n,data:o,errsCount:a,it:l}=e;if(!a)throw new Error("ajv implementation error");const{allErrors:c,props:u}=l;function h(s){if(!1===n)return e.setParams({unevaluatedProperty:s}),e.error(),void(c||t.break());if(!(0,r.alwaysValidSchema)(l,n)){const n=t.name("valid");e.subschema({keyword:"unevaluatedProperties",dataProp:s,dataPropType:r.Type.Str},n),c||t.if((0,i.not)(n),(()=>t.break()))}}u instanceof i.Name?t.if(i._`${u} !== true`,(()=>t.forIn("key",o,(e=>t.if(function(e,t){return i._`!${e} || !${e}[${t}]`}(u,e),(()=>h(e))))))):!0!==u&&t.forIn("key",o,(e=>void 0===u?h(e):t.if(function(e,t){const n=[];for(const r in e)!0===e[r]&&n.push(i._`${t} !== ${r}`);return(0,i.and)(...n)}(u,e),(()=>h(e))))),l.props=!0,e.ok(i._`${a} === ${s.default.errors}`)}};t.default=o},7935:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(9029),r=n(4227),s=n(6250),o={keyword:"const",$data:!0,error:{message:"must be equal to constant",params:({schemaCode:e})=>i._`{allowedValue: ${e}}`},code(e){const{gen:t,data:n,$data:o,schemaCode:a,schema:l}=e;o||l&&"object"==typeof l?e.fail$data(i._`!${(0,r.useFunc)(t,s.default)}(${n}, ${a})`):e.fail(i._`${l} !== ${n}`)}};t.default=o},1846:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(3025),r={keyword:"dependentRequired",type:"object",schemaType:"object",error:i.error,code:e=>(0,i.validatePropertyDeps)(e)};t.default=r},8643:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(9029),r=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})=>i._`{allowedValues: ${e}}`},code(e){const{gen:t,data:n,$data:o,schema:a,schemaCode:l,it:c}=e;if(!o&&0===a.length)throw new Error("enum must have non-empty array");const u=a.length>=c.opts.loopEnum;let h;const d=()=>null!=h?h:h=(0,r.useFunc)(t,s.default);let p;if(u||o)p=t.let("valid"),e.block$data(p,(function(){t.assign(p,!1),t.forOf("v",l,(e=>t.if(i._`${d()}(${n}, ${e})`,(()=>t.assign(p,!0).break()))))}));else{if(!Array.isArray(a))throw new Error("ajv implementation error");const e=t.const("vSchema",l);p=(0,i.or)(...a.map(((t,r)=>function(e,t){const r=a[t];return"object"==typeof r&&null!==r?i._`${d()}(${n}, ${e}[${t}])`:i._`${n} === ${r}`}(e,r))))}e.pass(p)}};t.default=o},7060:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(5882),r=n(3439),s=n(7307),o=n(422),a=n(4486),l=n(4003),c=n(1163),u=n(617),h=n(7935),d=n(8643),p=[i.default,r.default,s.default,o.default,a.default,l.default,c.default,u.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},h.default,d.default];t.default=p},2626:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(4227),r={keyword:["maxContains","minContains"],type:"array",schemaType:"number",code({keyword:e,parentSchema:t,it:n}){void 0===t.contains&&(0,i.checkStrictMode)(n,`"${e}" without "contains" is ignored`)}};t.default=r},1163:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(9029),r={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:{message({keyword:e,schemaCode:t}){const n="maxItems"===e?"more":"fewer";return i.str`must NOT have ${n} than ${t} items`},params:({schemaCode:e})=>i._`{limit: ${e}}`},code(e){const{keyword:t,data:n,schemaCode:r}=e,s="maxItems"===t?i.operators.GT:i.operators.LT;e.fail$data(i._`${n}.length ${s} ${r}`)}};t.default=r},7307:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(9029),r=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 i.str`must NOT have ${n} than ${t} characters`},params:({schemaCode:e})=>i._`{limit: ${e}}`},code(e){const{keyword:t,data:n,schemaCode:o,it:a}=e,l="maxLength"===t?i.operators.GT:i.operators.LT,c=!1===a.opts.unicode?i._`${n}.length`:i._`${(0,r.useFunc)(e.gen,s.default)}(${n})`;e.fail$data(i._`${c} ${l} ${o}`)}};t.default=o},5882:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(9029),r=i.operators,s={maximum:{okStr:"<=",ok:r.LTE,fail:r.GT},minimum:{okStr:">=",ok:r.GTE,fail:r.LT},exclusiveMaximum:{okStr:"<",ok:r.LT,fail:r.GTE},exclusiveMinimum:{okStr:">",ok:r.GT,fail:r.LTE}},o={message:({keyword:e,schemaCode:t})=>i.str`must be ${s[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>i._`{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:r}=e;e.fail$data(i._`${n} ${s[t].fail} ${r} || isNaN(${n})`)}};t.default=a},4486:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(9029),r={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:{message({keyword:e,schemaCode:t}){const n="maxProperties"===e?"more":"fewer";return i.str`must NOT have ${n} than ${t} properties`},params:({schemaCode:e})=>i._`{limit: ${e}}`},code(e){const{keyword:t,data:n,schemaCode:r}=e,s="maxProperties"===t?i.operators.GT:i.operators.LT;e.fail$data(i._`Object.keys(${n}).length ${s} ${r}`)}};t.default=r},3439:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(9029),r={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:{message:({schemaCode:e})=>i.str`must be multiple of ${e}`,params:({schemaCode:e})=>i._`{multipleOf: ${e}}`},code(e){const{gen:t,data:n,schemaCode:r,it:s}=e,o=s.opts.multipleOfPrecision,a=t.let("res"),l=o?i._`Math.abs(Math.round(${a}) - ${a}) > 1e-${o}`:i._`${a} !== parseInt(${a})`;e.fail$data(i._`(${r} === 0 || (${a} = ${n}/${r}, ${l}))`)}};t.default=r},422:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(5765),r=n(9029),s={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:{message:({schemaCode:e})=>r.str`must match pattern "${e}"`,params:({schemaCode:e})=>r._`{pattern: ${e}}`},code(e){const{data:t,$data:n,schema:s,schemaCode:o,it:a}=e,l=a.opts.unicodeRegExp?"u":"",c=n?r._`(new RegExp(${o}, ${l}))`:(0,i.usePattern)(e,s);e.fail$data(r._`!${c}.test(${t})`)}};t.default=s},4003:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(5765),r=n(9029),s=n(4227),o={keyword:"required",type:"object",schemaType:"array",$data:!0,error:{message:({params:{missingProperty:e}})=>r.str`must have required property '${e}'`,params:({params:{missingProperty:e}})=>r._`{missingProperty: ${e}}`},code(e){const{gen:t,schema:n,schemaCode:o,data:a,$data:l,it:c}=e,{opts:u}=c;if(!l&&0===n.length)return;const h=n.length>=u.loopRequired;if(c.allErrors?function(){if(h||l)e.block$data(r.nil,d);else for(const t of n)(0,i.checkReportMissingProp)(e,t)}():function(){const s=t.let("missing");if(h||l){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,i.propertyInData)(t,a,n,u.ownProperties)),t.if((0,r.not)(s),(()=>{e.error(),t.break()}))}),r.nil)}(s,n))),e.ok(n)}else t.if((0,i.checkMissingProp)(e,n,s)),(0,i.reportMissingProp)(e,s),t.else()}(),u.strictRequired){const t=e.parentSchema.properties,{definedProperties:i}=e.it;for(const e of n)if(void 0===(null==t?void 0:t[e])&&!i.has(e)){const t=`required property "${e}" is not defined at "${c.schemaEnv.baseId+c.errSchemaPath}" (strictRequired)`;(0,s.checkStrictMode)(c,t,c.opts.strictRequired)}}function d(){t.forOf("prop",o,(n=>{e.setParams({missingProperty:n}),t.if((0,i.noPropertyInData)(t,a,n,u.ownProperties),(()=>e.error()))}))}}};t.default=o},617:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(208),r=n(9029),s=n(4227),o=n(6250),a={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:{message:({params:{i:e,j:t}})=>r.str`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>r._`{i: ${e}, j: ${t}}`},code(e){const{gen:t,data:n,$data:a,schema:l,parentSchema:c,schemaCode:u,it:h}=e;if(!a&&!l)return;const d=t.let("valid"),p=c.items?(0,i.getSchemaTypes)(c.items):[];function m(s,o){const a=t.name("item"),l=(0,i.checkDataTypes)(p,a,h.opts.strictNumbers,i.DataType.Wrong),c=t.const("indices",r._`{}`);t.for(r._`;${s}--;`,(()=>{t.let(a,r._`${n}[${s}]`),t.if(l,r._`continue`),p.length>1&&t.if(r._`typeof ${a} == "string"`,r._`${a} += "_"`),t.if(r._`typeof ${c}[${a}] == "number"`,(()=>{t.assign(o,r._`${c}[${a}]`),e.error(),t.assign(d,!1).break()})).code(r._`${c}[${a}] = ${s}`)}))}function f(i,a){const l=(0,s.useFunc)(t,o.default),c=t.name("outer");t.label(c).for(r._`;${i}--;`,(()=>t.for(r._`${a} = ${i}; ${a}--;`,(()=>t.if(r._`${l}(${n}[${i}], ${n}[${a}])`,(()=>{e.error(),t.assign(d,!1).break(c)}))))))}e.block$data(d,(function(){const i=t.let("i",r._`${n}.length`),s=t.let("j");e.setParams({i,j:s}),t.assign(d,!0),t.if(r._`${i} > 1`,(()=>(p.length>0&&!p.some((e=>"object"===e||"array"===e))?m:f)(i,s)))}),r._`${u} === false`),e.ok(d)}};t.default=a},5488:(e,t,n)=>{"use strict";n.d(t,{A:()=>a});var i=n(1354),r=n.n(i),s=n(6314),o=n.n(s)()(r());o.push([e.id,"\n.ui-form.ui-tooltip .ui-input-root > label.ui-input-label:not(:empty) {\n /* min-width: 30px; /* Breaks right margin /**/\n}\n\n.ui-form.ui-tooltip .ui-input-root > div.ui-input-text:not(:empty) {\n margin-top: 6px;\n}","",{version:3,sources:["webpack://./css/cell-renderer.css"],names:[],mappings:";AACA;IACI,8CAA8C;AAClD;;AAEA;IACI,eAAe;AACnB",sourcesContent:["\n.ui-form.ui-tooltip .ui-input-root > label.ui-input-label:not(:empty) {\n /* min-width: 30px; /* Breaks right margin /**/\n}\n\n.ui-form.ui-tooltip .ui-input-root > div.ui-input-text:not(:empty) {\n margin-top: 6px;\n}"],sourceRoot:""}]);const a=o},5999:(e,t,n)=>{"use strict";n.d(t,{A:()=>a});var i=n(1354),r=n.n(i),s=n(6314),o=n.n(s)()(r());o.push([e.id,".macromolecule-cell-comp-analysis-host{\n max-height: 250px;\n overflow-y: scroll;\n}\n\n.macromolecule-cell-comp-analysis-bar{\n height: inherit;\n display: block;\n margin-top: 1.5px;\n margin-bottom: 1.5px;\n margin-right: 3px;\n}\n\n.macromolecule-cell-comp-analysis-value{\n display: flex;\n}","",{version:3,sources:["webpack://./css/composition-analysis.css"],names:[],mappings:"AAAA;IACI,iBAAiB;IACjB,kBAAkB;AACtB;;AAEA;IACI,eAAe;IACf,cAAc;IACd,iBAAiB;IACjB,oBAAoB;IACpB,iBAAiB;AACrB;;AAEA;IACI,aAAa;AACjB",sourcesContent:[".macromolecule-cell-comp-analysis-host{\n max-height: 250px;\n overflow-y: scroll;\n}\n\n.macromolecule-cell-comp-analysis-bar{\n height: inherit;\n display: block;\n margin-top: 1.5px;\n margin-bottom: 1.5px;\n margin-right: 3px;\n}\n\n.macromolecule-cell-comp-analysis-value{\n display: flex;\n}"],sourceRoot:""}]);const a=o},6369:(e,t,n)=>{"use strict";n.d(t,{A:()=>a});var i=n(1354),r=n.n(i),s=n(6314),o=n.n(s)()(r());o.push([e.id,".kalign-version {\n margin-bottom: 0;\n text-align: end;\n font-size: 12px;\n opacity: 0.8;\n}\nbutton.msa-params-button.ui-btn {\n justify-content: end;\n}","",{version:3,sources:["webpack://./css/msa.css"],names:[],mappings:"AAAA;IACI,gBAAgB;IAChB,eAAe;IACf,eAAe;IACf,YAAY;AAChB;AACA;IACI,oBAAoB;AACxB",sourcesContent:[".kalign-version {\n margin-bottom: 0;\n text-align: end;\n font-size: 12px;\n opacity: 0.8;\n}\nbutton.msa-params-button.ui-btn {\n justify-content: end;\n}"],sourceRoot:""}]);const a=o},7939:(e,t,n)=>{"use strict";n.d(t,{A:()=>a});var i=n(1354),r=n.n(i),s=n(6314),o=n.n(s)()(r());o.push([e.id,".scatter_plot_link {\n position: absolute!important;\n right: 10px;\n}\n\n.cliffs_grid {\n top: 10px;\n}\n\n.show_only_cliffs {\n top: 30px;\n}\n\n.ml-dim-reduction-settings-input i.grok-icon.grok-font-icon-settings {\n font-size: 18px;\n position: absolute;\n height: 28px;\n \n}\n\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 i=n(1354),r=n.n(i),s=n(6314),o=n.n(s)()(r());o.push([e.id,".monomer-lib-controls-form {\n margin-left: auto;\n margin-right: auto;\n display: flex;\n flex-direction: column;\n align-items: center;\n width: 100%;\n}\n","",{version:3,sources:["webpack://./src/utils/monomer-lib/library-file-manager/style.css"],names:[],mappings:"AAAA;EACE,iBAAiB;EACjB,kBAAkB;EAClB,aAAa;EACb,sBAAsB;EACtB,mBAAmB;EACnB,WAAW;AACb",sourcesContent:[".monomer-lib-controls-form {\n margin-left: auto;\n margin-right: auto;\n display: flex;\n flex-direction: column;\n align-items: center;\n width: 100%;\n}\n"],sourceRoot:""}]);const a=o},6314:e=>{"use strict";e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",i=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),i&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),i&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,i,r,s){"string"==typeof e&&(e=[[null,e,void 0]]);var o={};if(i)for(var a=0;a<this.length;a++){var l=this[a][0];null!=l&&(o[l]=!0)}for(var c=0;c<e.length;c++){var u=[].concat(e[c]);i&&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),r&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=r):u[4]="".concat(r)),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 i=btoa(unescape(encodeURIComponent(JSON.stringify(n)))),r="sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(i),s="/*# ".concat(r," */");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 i,r,s;if(Array.isArray(t)){if((i=t.length)!=n.length)return!1;for(r=i;0!=r--;)if(!e(t[r],n[r]))return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if((i=(s=Object.keys(t)).length)!==Object.keys(n).length)return!1;for(r=i;0!=r--;)if(!Object.prototype.hasOwnProperty.call(n,s[r]))return!1;for(r=i;0!=r--;){var o=s[r];if(!e(t[o],n[o]))return!1}return!0}return t!=t&&n!=n}},9982:function(e,t,n){var i;!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,i,r,s){for(var o,a,l,c,u,h,d,p,m,f,g,y,b;s>=64;){for(o=n[0],a=n[1],l=n[2],c=n[3],u=n[4],h=n[5],d=n[6],p=n[7],f=0;f<16;f++)g=r+4*f,e[f]=(255&i[g])<<24|(255&i[g+1])<<16|(255&i[g+2])<<8|255&i[g+3];for(f=16;f<64;f++)y=((m=e[f-2])>>>17|m<<15)^(m>>>19|m<<13)^m>>>10,b=((m=e[f-15])>>>7|m<<25)^(m>>>18|m<<14)^m>>>3,e[f]=(y+e[f-7]|0)+(b+e[f-16]|0);for(f=0;f<64;f++)y=(((u>>>6|u<<26)^(u>>>11|u<<21)^(u>>>25|u<<7))+(u&h^~u&d)|0)+(p+(t[f]+e[f]|0)|0)|0,b=((o>>>2|o<<30)^(o>>>13|o<<19)^(o>>>22|o<<10))+(o&a^o&l^a&l)|0,p=d,d=h,h=u,u=c+y|0,c=l,l=a,a=o,o=y+b|0;n[0]+=o,n[1]+=a,n[2]+=l,n[3]+=c,n[4]+=u,n[5]+=h,n[6]+=d,n[7]+=p,r+=64,s-=64}return r}var i=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 i=0;if(this.bytesHashed+=t,this.bufferLength>0){for(;this.bufferLength<64&&t>0;)this.buffer[this.bufferLength++]=e[i++],t--;64===this.bufferLength&&(n(this.temp,this.state,this.buffer,0,64),this.bufferLength=0)}for(t>=64&&(i=n(this.temp,this.state,e,i,t),t%=64);t>0;)this.buffer[this.bufferLength++]=e[i++],t--;return this},t.prototype.finish=function(e){if(!this.finished){var t=this.bytesHashed,i=this.bufferLength,r=t/536870912|0,s=t<<3,o=t%64<56?64:128;this.buffer[i]=128;for(var a=i+1;a<o-8;a++)this.buffer[a]=0;this.buffer[o-8]=r>>>24&255,this.buffer[o-7]=r>>>16&255,this.buffer[o-6]=r>>>8&255,this.buffer[o-5]=r>>>0&255,this.buffer[o-4]=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=i;var r=function(){function e(e){this.inner=new i,this.outer=new i,this.blockSize=this.inner.blockSize,this.digestLength=this.inner.digestLength;var t=new Uint8Array(this.blockSize);if(e.length>this.blockSize)(new i).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 i).update(e),n=t.digest();return t.clean(),n}function o(e,t){var n=new r(e).update(t),i=n.digest();return n.clean(),i}function a(e,t,n,i){var r=i[0];if(0===r)throw new Error("hkdf: cannot expand more");t.reset(),r>1&&t.update(e),n&&t.update(n),t.update(i),t.finish(e),i[0]++}e.HMAC=r,e.hash=s,e.default=s,e.hmac=o;var l=new Uint8Array(e.digestLength);e.hkdf=function(e,t,n,i){void 0===t&&(t=l),void 0===i&&(i=32);for(var s=new Uint8Array([1]),c=o(t,e),u=new r(c),h=new Uint8Array(u.digestLength),d=h.length,p=new Uint8Array(i),m=0;m<i;m++)d===h.length&&(a(h,u,n,s),d=0),p[m]=h[d++];return u.clean(),h.fill(0),s.fill(0),p},e.pbkdf2=function(e,t,n,i){for(var s=new r(e),o=s.digestLength,a=new Uint8Array(4),l=new Uint8Array(o),c=new Uint8Array(o),u=new Uint8Array(i),h=0;h*o<i;h++){var d=h+1;a[0]=d>>>24&255,a[1]=d>>>16&255,a[2]=d>>>8&255,a[3]=d>>>0&255,s.reset(),s.update(t),s.update(a),s.finish(c);for(var p=0;p<o;p++)l[p]=c[p];for(p=2;p<=n;p++){s.reset(),s.update(c).finish(c);for(var m=0;m<o;m++)l[m]^=c[m]}for(p=0;p<o&&h*o+p<i;p++)u[h*o+p]=l[p]}for(h=0;h<o;h++)l[h]=c[h]=0;for(h=0;h<4;h++)a[h]=0;return s.clean(),u}}(t);var r=t.default;for(var s in t)r[s]=t[s];"object"==typeof e.exports?e.exports=r:void 0===(i=function(){return r}.call(t,n,t,e))||(e.exports=i)}()},2787:(e,t,n)=>{"use strict";n.d(t,{I:()=>r});const i=new Uint32Array(65536),r=(e,t)=>{if(e.length<t.length){const n=t;t=e,e=n}return 0===t.length?e.length:e.length<=32?((e,t)=>{const n=e.length,r=t.length,s=1<<n-1;let o=-1,a=0,l=n,c=n;for(;c--;)i[e.charCodeAt(c)]|=1<<c;for(c=0;c<r;c++){let e=i[t.charCodeAt(c)];const n=e|a;e|=(e&o)+o^o,a|=~(e|o),o&=e,a&s&&l++,o&s&&l--,a=a<<1|1,o=o<<1|~(n|a),a&=n}for(c=n;c--;)i[e.charCodeAt(c)]=0;return l})(e,t):((e,t)=>{const n=t.length,r=e.length,s=[],o=[],a=Math.ceil(n/32),l=Math.ceil(r/32);for(let e=0;e<a;e++)o[e]=-1,s[e]=0;let c=0;for(;c<l-1;c++){let a=0,l=-1;const u=32*c,h=Math.min(32,r)+u;for(let t=u;t<h;t++)i[e.charCodeAt(t)]|=1<<t;for(let e=0;e<n;e++){const n=i[t.charCodeAt(e)],r=o[e/32|0]>>>e&1,c=s[e/32|0]>>>e&1,u=n|a,h=((n|c)&l)+l^l|n|c;let d=a|~(h|l),p=l&h;d>>>31^r&&(o[e/32|0]^=1<<e),p>>>31^c&&(s[e/32|0]^=1<<e),d=d<<1|r,p=p<<1|c,l=p|~(u|d),a=d&u}for(let t=u;t<h;t++)i[e.charCodeAt(t)]=0}let u=0,h=-1;const d=32*c,p=Math.min(32,r-d)+d;for(let t=d;t<p;t++)i[e.charCodeAt(t)]|=1<<t;let m=r;for(let e=0;e<n;e++){const n=i[t.charCodeAt(e)],a=o[e/32|0]>>>e&1,l=s[e/32|0]>>>e&1,c=n|u,d=((n|l)&h)+h^h|n|l;let p=u|~(d|h),f=h&d;m+=p>>>r-1&1,m-=f>>>r-1&1,p>>>31^a&&(o[e/32|0]^=1<<e),f>>>31^l&&(s[e/32|0]^=1<<e),p=p<<1|a,f=f<<1|l,h=f|~(c|p),u=p&c}for(let t=d;t<p;t++)i[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,i,r=Array.prototype.slice.call(arguments).slice(1);for(t=0,i=r.length;t<i;t++)if(r[t])for(n in r[t])e[n]=r[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,i=e.order,r=e.size,s={},o=new Float32Array(10*i),a=new Float32Array(3*r);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,i,r,l,c,u,h){var d=s[r],p=s[l],m=t(e,i,r,l,c,u,h);o[d+6]+=m,o[p+6]+=m,a[n]=d,a[n+1]=p,a[n+2]=m,n+=3})),{nodes:o,edges:a}},t.assignLayoutChanges=function(e,t,n){var i=0;e.updateEachNodeAttributes((function(e,r){return r.x=t[i],r.y=t[i+1],i+=10,n?n(e,r):r}))},t.readGraphPositions=function(e,t){var n=0;e.forEachNode((function(e,i){t[n]=i.x,t[n+1]=i.y,n+=10}))},t.collectLayoutChanges=function(e,t,n){for(var i=e.nodes(),r={},s=0,o=0,a=t.length;s<a;s+=10){if(n){var l=Object.assign({},e.getNodeAttributes(i[o]));l.x=t[s],l.y=t[s+1],l=n(i[o],l),r[i[o]]={x:l.x,y:l.y}}else r[i[o]]={x:t[s],y:t[s+1]};o++}return r},t.createWorker=function(e){var t=window.URL||window.webkitURL,n=e.toString(),i=t.createObjectURL(new Blob(["("+n+").call(this);"],{type:"text/javascript"})),r=new Worker(i);return t.revokeObjectURL(i),r}},8903:(e,t,n)=>{var i=n(1736),r=n(8153).Fd,s=n(2561),o=n(1782),a=n(9937);function l(e,t,n){if(!i(t))throw new Error("graphology-layout-forceatlas2: the given graph is not a valid graphology instance.");"number"==typeof n&&(n={iterations:n});var l=n.iterations;if("number"!=typeof l)throw new Error("graphology-layout-forceatlas2: invalid number of iterations.");if(l<=0)throw new Error("graphology-layout-forceatlas2: you should provide a positive number of iterations.");var c=r("getEdgeWeight"in n?n.getEdgeWeight:"weight").fromEntry,u="function"==typeof n.outputReducer?n.outputReducer:null,h=o.assign({},a,n.settings),d=o.validateSettings(h);if(d)throw new Error("graphology-layout-forceatlas2: "+d.message);var p,m=o.graphToByteArrays(t,c);for(p=0;p<l;p++)s(h,m.nodes,m.edges);if(!e)return o.collectLayoutChanges(t,m.nodes);o.assignLayoutChanges(t,m.nodes,u)}var c=l.bind(null,!1);c.assign=l.bind(null,!0),c.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=c},2561:e=>{var t=10;e.exports=function(e,n,i){var r,s,o,a,l,c,u,h,d,p,m,f,g,y,b,v,w,C,A,S,x,E,_,M=n.length,T=i.length,I=e.adjustSizes,L=e.barnesHutTheta*e.barnesHutTheta,$=[];for(o=0;o<M;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<M;o+=t)m+=n[o+6];m/=M/t}if(e.barnesHutOptimize){var N,P,O,R=1/0,k=-1/0,G=1/0,D=-1/0;for(o=0;o<M;o+=t)R=Math.min(R,n[o+0]),k=Math.max(k,n[o+0]),G=Math.min(G,n[o+1]),D=Math.max(D,n[o+1]);var F=k-R,H=D-G;for(F>H?D=(G-=(F-H)/2)+F:k=(R-=(H-F)/2)+H,$[0]=-1,$[1]=(R+k)/2,$[2]=(G+D)/2,$[3]=Math.max(k-R,D-G),$[4]=-1,$[5]=-1,$[6]=0,$[7]=0,$[8]=0,r=1,o=0;o<M;o+=t)for(s=0,O=3;;){if(!($[s+5]>=0)){if($[s+0]<0){$[s+0]=o;break}if($[s+5]=9*r,h=$[s+3]/2,$[(d=$[s+5])+0]=-1,$[d+1]=$[s+1]-h,$[d+2]=$[s+2]-h,$[d+3]=h,$[d+4]=d+9,$[d+5]=-1,$[d+6]=0,$[d+7]=0,$[d+8]=0,$[(d+=9)+0]=-1,$[d+1]=$[s+1]-h,$[d+2]=$[s+2]+h,$[d+3]=h,$[d+4]=d+9,$[d+5]=-1,$[d+6]=0,$[d+7]=0,$[d+8]=0,$[(d+=9)+0]=-1,$[d+1]=$[s+1]+h,$[d+2]=$[s+2]-h,$[d+3]=h,$[d+4]=d+9,$[d+5]=-1,$[d+6]=0,$[d+7]=0,$[d+8]=0,$[(d+=9)+0]=-1,$[d+1]=$[s+1]+h,$[d+2]=$[s+2]+h,$[d+3]=h,$[d+4]=$[s+4],$[d+5]=-1,$[d+6]=0,$[d+7]=0,$[d+8]=0,r+=4,N=n[$[s+0]+0]<$[s+1]?n[$[s+0]+1]<$[s+2]?$[s+5]:$[s+5]+9:n[$[s+0]+1]<$[s+2]?$[s+5]+18:$[s+5]+27,$[s+6]=n[$[s+0]+6],$[s+7]=n[$[s+0]+0],$[s+8]=n[$[s+0]+1],$[N+0]=$[s+0],$[s+0]=-1,N===(P=n[o+0]<$[s+1]?n[o+1]<$[s+2]?$[s+5]:$[s+5]+9:n[o+1]<$[s+2]?$[s+5]+18:$[s+5]+27)){if(O--){s=N;continue}O=3;break}$[P+0]=o;break}N=n[o+0]<$[s+1]?n[o+1]<$[s+2]?$[s+5]:$[s+5]+9:n[o+1]<$[s+2]?$[s+5]+18:$[s+5]+27,$[s+7]=($[s+7]*$[s+6]+n[o+0]*n[o+6])/($[s+6]+n[o+6]),$[s+8]=($[s+8]*$[s+6]+n[o+1]*n[o+6])/($[s+6]+n[o+6]),$[s+6]+=n[o+6],s=N}}if(e.barnesHutOptimize){for(f=e.scalingRatio,o=0;o<M;o+=t)for(s=0;;)if($[s+5]>=0){if(v=Math.pow(n[o+0]-$[s+7],2)+Math.pow(n[o+1]-$[s+8],2),4*(p=$[s+3])*p/v<L){if(g=n[o+0]-$[s+7],y=n[o+1]-$[s+8],!0===I?v>0?(w=f*n[o+6]*$[s+6]/v,n[o+2]+=g*w,n[o+3]+=y*w):v<0&&(w=-f*n[o+6]*$[s+6]/Math.sqrt(v),n[o+2]+=g*w,n[o+3]+=y*w):v>0&&(w=f*n[o+6]*$[s+6]/v,n[o+2]+=g*w,n[o+3]+=y*w),(s=$[s+4])<0)break;continue}s=$[s+5]}else if((c=$[s+0])>=0&&c!==o&&(v=(g=n[o+0]-n[c+0])*g+(y=n[o+1]-n[c+1])*y,!0===I?v>0?(w=f*n[o+6]*n[c+6]/v,n[o+2]+=g*w,n[o+3]+=y*w):v<0&&(w=-f*n[o+6]*n[c+6]/Math.sqrt(v),n[o+2]+=g*w,n[o+3]+=y*w):v>0&&(w=f*n[o+6]*n[c+6]/v,n[o+2]+=g*w,n[o+3]+=y*w)),(s=$[s+4])<0)break}else for(f=e.scalingRatio,a=0;a<M;a+=t)for(l=0;l<a;l+=t)g=n[a+0]-n[l+0],y=n[a+1]-n[l+1],!0===I?(v=Math.sqrt(g*g+y*y)-n[a+8]-n[l+8])>0?(w=f*n[a+6]*n[l+6]/v/v,n[a+2]+=g*w,n[a+3]+=y*w,n[l+2]-=g*w,n[l+3]-=y*w):v<0&&(w=100*f*n[a+6]*n[l+6],n[a+2]+=g*w,n[a+3]+=y*w,n[l+2]-=g*w,n[l+3]-=y*w):(v=Math.sqrt(g*g+y*y))>0&&(w=f*n[a+6]*n[l+6]/v/v,n[a+2]+=g*w,n[a+3]+=y*w,n[l+2]-=g*w,n[l+3]-=y*w);for(d=e.gravity/e.scalingRatio,f=e.scalingRatio,o=0;o<M;o+=t)w=0,g=n[o+0],y=n[o+1],v=Math.sqrt(Math.pow(g,2)+Math.pow(y,2)),e.strongGravityMode?v>0&&(w=f*n[o+6]*d):v>0&&(w=f*n[o+6]*d/v),n[o+2]-=g*w,n[o+3]-=y*w;for(f=1*(e.outboundAttractionDistribution?m:1),u=0;u<T;u+=3)a=i[u+0],l=i[u+1],h=i[u+2],b=Math.pow(h,e.edgeWeightInfluence),g=n[a+0]-n[l+0],y=n[a+1]-n[l+1],!0===I?(v=Math.sqrt(g*g+y*y)-n[a+8]-n[l+8],e.linLogMode?e.outboundAttractionDistribution?v>0&&(w=-f*b*Math.log(1+v)/v/n[a+6]):v>0&&(w=-f*b*Math.log(1+v)/v):e.outboundAttractionDistribution?v>0&&(w=-f*b/n[a+6]):v>0&&(w=-f*b)):(v=Math.sqrt(Math.pow(g,2)+Math.pow(y,2)),e.linLogMode?e.outboundAttractionDistribution?v>0&&(w=-f*b*Math.log(1+v)/v/n[a+6]):v>0&&(w=-f*b*Math.log(1+v)/v):e.outboundAttractionDistribution?(v=1,w=-f*b/n[a+6]):(v=1,w=-f*b)),v>0&&(n[a+2]+=g*w,n[a+3]+=y*w,n[l+2]-=g*w,n[l+3]-=y*w);if(!0===I)for(o=0;o<M;o+=t)1!==n[o+9]&&((C=Math.sqrt(Math.pow(n[o+2],2)+Math.pow(n[o+3],2)))>10&&(n[o+2]=10*n[o+2]/C,n[o+3]=10*n[o+3]/C),A=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])),S=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,x=.1*Math.log(1+S)/(1+Math.sqrt(A)),E=n[o+0]+n[o+2]*(x/e.slowDown),n[o+0]=E,_=n[o+1]+n[o+3]*(x/e.slowDown),n[o+1]=_);else for(o=0;o<M;o+=t)1!==n[o+9]&&(A=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])),S=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,x=n[o+7]*Math.log(1+S)/(1+Math.sqrt(A)),n[o+7]=Math.min(1,Math.sqrt(x*(Math.pow(n[o+2],2)+Math.pow(n[o+3],2))/(1+Math.sqrt(A)))),E=n[o+0]+n[o+2]*(x/e.slowDown),n[o+0]=E,_=n[o+1]+n[o+3]*(x/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={},i=function(e){return void 0===e?t:e};"function"==typeof t&&(i=t);var r=function(t){return i(t[e])},s=function(){return i(void 0)};return"string"==typeof e?(n.fromAttributes=r,n.fromGraph=function(e,t){return r(e.getEdgeAttributes(t))},n.fromEntry=function(e,t){return r(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 r=t.extremities(n);return i(e(n,t.getEdgeAttributes(n),r[0],r[1],t.getNodeAttributes(r[0]),t.getNodeAttributes(r[1]),t.isUndirected(n)))},n.fromEntry=function(t,n,r,s,o,a,l){return i(e(t,n,r,s,o,a,l))},n.fromPartialEntry=function(t,n,r,s){return i(e(t,n,r,s))},n.fromMinimalEntry=function(t,n){return i(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,i(e,t)}function n(e){return n=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},n(e)}function i(e,t){return i=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},i(e,t)}function r(e,t,n){return r=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 r=[null];r.push.apply(r,t);var s=new(Function.bind.apply(e,r));return n&&i(s,n.prototype),s},r.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 r(e,arguments,n(this).constructor)}return o.prototype=Object.create(e.prototype,{constructor:{value:o,enumerable:!1,writable:!0,configurable:!0}}),i(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 i in arguments[t])e[i]=arguments[t][i];return e};function l(e,t,n,i){var r=e._nodes.get(t),s=null;return r?s="mixed"===i?r.out&&r.out[n]||r.undirected&&r.undirected[n]:"directed"===i?r.out&&r.out[n]:r.undirected&&r.undirected[n]:s}function c(t){return"object"===e(t)&&null!==t}function u(e){var t;for(t in e)return!1;return!0}function h(e,t,n){Object.defineProperty(e,t,{enumerable:!1,configurable:!1,writable:!0,value:n})}function d(e,t,n){var i={enumerable:!0,configurable:!0};"function"==typeof n?i.get=n:(i.value=n,i.writable=!1),Object.defineProperty(e,t,i)}function p(e){return!(!c(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 b=Number.isNaN||function(e){return e!=e};function v(){v.init.call(this)}f.exports=v,f.exports.once=function(e,t){return new Promise((function(n,i){function r(n){e.removeListener(t,s),i(n)}function s(){"function"==typeof e.removeListener&&e.removeListener("error",r),n([].slice.call(arguments))}I(e,t,s,{once:!0}),"error"!==t&&function(e,t){"function"==typeof e.on&&I(e,"error",t,{once:!0})}(e,r)}))},v.EventEmitter=v,v.prototype._events=void 0,v.prototype._eventsCount=0,v.prototype._maxListeners=void 0;var w=10;function C(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function A(e){return void 0===e._maxListeners?v.defaultMaxListeners:e._maxListeners}function S(e,t,n,i){var r,s,o,a;if(C(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]=i?[n,o]:[o,n]:i?o.unshift(n):o.push(n),(r=A(e))>0&&o.length>r&&!o.warned){o.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=e,l.type=t,l.count=o.length,a=l,console&&console.warn&&console.warn(a)}return e}function x(){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 E(e,t,n){var i={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},r=x.bind(i);return r.listener=n,i.wrapFn=r,r}function _(e,t,n){var i=e._events;if(void 0===i)return[];var r=i[t];return void 0===r?[]:"function"==typeof r?n?[r.listener||r]:[r]: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}(r):T(r,r.length)}function M(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 T(e,t){for(var n=new Array(t),i=0;i<t;++i)n[i]=e[i];return n}function I(e,t,n,i){if("function"==typeof e.on)i.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 r(s){i.once&&e.removeEventListener(t,r),n(s)}))}}function L(e){if("function"!=typeof e)throw new Error("obliterator/iterator: expecting a function!");this.next=e}Object.defineProperty(v,"defaultMaxListeners",{enumerable:!0,get:function(){return w},set:function(e){if("number"!=typeof e||e<0||b(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");w=e}}),v.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},v.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||b(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},v.prototype.getMaxListeners=function(){return A(this)},v.prototype.emit=function(e){for(var t=[],n=1;n<arguments.length;n++)t.push(arguments[n]);var i="error"===e,r=this._events;if(void 0!==r)i=i&&void 0===r.error;else if(!i)return!1;if(i){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=r[e];if(void 0===a)return!1;if("function"==typeof a)y(a,this,t);else{var l=a.length,c=T(a,l);for(n=0;n<l;++n)y(c[n],this,t)}return!0},v.prototype.addListener=function(e,t){return S(this,e,t,!1)},v.prototype.on=v.prototype.addListener,v.prototype.prependListener=function(e,t){return S(this,e,t,!0)},v.prototype.once=function(e,t){return C(t),this.on(e,E(this,e,t)),this},v.prototype.prependOnceListener=function(e,t){return C(t),this.prependListener(e,E(this,e,t)),this},v.prototype.removeListener=function(e,t){var n,i,r,s,o;if(C(t),void 0===(i=this._events))return this;if(void 0===(n=i[e]))return this;if(n===t||n.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,n.listener||t));else if("function"!=typeof n){for(r=-1,s=n.length-1;s>=0;s--)if(n[s]===t||n[s].listener===t){o=n[s].listener,r=s;break}if(r<0)return this;0===r?n.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(n,r),1===n.length&&(i[e]=n[0]),void 0!==i.removeListener&&this.emit("removeListener",e,o||t)}return this},v.prototype.off=v.prototype.removeListener,v.prototype.removeAllListeners=function(e){var t,n,i;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 r,s=Object.keys(n);for(i=0;i<s.length;++i)"removeListener"!==(r=s[i])&&this.removeAllListeners(r);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(i=t.length-1;i>=0;i--)this.removeListener(e,t[i]);return this},v.prototype.listeners=function(e){return _(this,e,!0)},v.prototype.rawListeners=function(e){return _(this,e,!1)},v.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):M.call(e,t)},v.prototype.listenerCount=M,v.prototype.eventNames=function(){return this._eventsCount>0?m(this._events):[]},"undefined"!=typeof Symbol&&(L.prototype[Symbol.iterator]=function(){return this}),L.of=function(){var e=arguments,t=e.length,n=0;return new L((function(){return n>=t?{done:!0}:{done:!1,value:e[n++]}}))},L.empty=function(){return new L((function(){return{done:!0}}))},L.fromSequence=function(e){var t=0,n=e.length;return new L((function(){return t>=n?{done:!0}:{done:!1,value:e[t++]}}))},L.is=function(e){return e instanceof L||"object"==typeof e&&null!==e&&"function"==typeof e.next};var $=L,N={};N.ARRAY_BUFFER_SUPPORT="undefined"!=typeof ArrayBuffer,N.SYMBOL_SUPPORT="undefined"!=typeof Symbol;var P=$,O=N,R=O.ARRAY_BUFFER_SUPPORT,k=O.SYMBOL_SUPPORT,G=function(e){var t=function(e){return"string"==typeof e||Array.isArray(e)||R&&ArrayBuffer.isView(e)?P.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},D=G,F=function(e,t){for(var n,i=arguments.length>1?t:1/0,r=i!==1/0?new Array(i):[],s=0,o=D(e);;){if(s===i)return r;if((n=o.next()).done)return s!==t&&(r.length=s),r;r[s++]=n.value}},H=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)),B=function(e){function n(t){var i;return(i=e.call(this,t)||this).name="InvalidArgumentsGraphError","function"==typeof Error.captureStackTrace&&Error.captureStackTrace(o(i),n.prototype.constructor),i}return t(n,e),n}(H),V=function(e){function n(t){var i;return(i=e.call(this,t)||this).name="NotFoundGraphError","function"==typeof Error.captureStackTrace&&Error.captureStackTrace(o(i),n.prototype.constructor),i}return t(n,e),n}(H),j=function(e){function n(t){var i;return(i=e.call(this,t)||this).name="UsageGraphError","function"==typeof Error.captureStackTrace&&Error.captureStackTrace(o(i),n.prototype.constructor),i}return t(n,e),n}(H);function U(e,t){this.key=e,this.attributes=t,this.clear()}function W(e,t){this.key=e,this.attributes=t,this.clear()}function Y(e,t){this.key=e,this.attributes=t,this.clear()}function z(e,t,n,i,r){this.key=t,this.attributes=r,this.undirected=e,this.source=n,this.target=i}function q(e,t,n,i,r,s,o){var a,l,c,u;if(i=""+i,0===n){if(!(a=e._nodes.get(i)))throw new V("Graph.".concat(t,': could not find the "').concat(i,'" node in the graph.'));c=r,u=s}else if(3===n){if(r=""+r,!(l=e._edges.get(r)))throw new V("Graph.".concat(t,': could not find the "').concat(r,'" edge in the graph.'));var h=l.source.key,d=l.target.key;if(i===h)a=l.target;else{if(i!==d)throw new V("Graph.".concat(t,': the "').concat(i,'" node is not attached to the "').concat(r,'" edge (').concat(h,", ").concat(d,")."));a=l.source}c=s,u=o}else{if(!(l=e._edges.get(i)))throw new V("Graph.".concat(t,': could not find the "').concat(i,'" edge in the graph.'));a=1===n?l.source:l.target,c=r,u=s}return[a,c,u]}U.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={}},Y.prototype.clear=function(){this.undirectedDegree=0,this.undirectedLoops=0,this.undirected={}},z.prototype.attach=function(){var e="out",t="in";this.undirected&&(e=t="undirected");var n=this.source.key,i=this.target.key;this.source[e][i]=this,this.undirected&&n===i||(this.target[t][n]=this)},z.prototype.attachMulti=function(){var e="out",t="in",n=this.source.key,i=this.target.key;this.undirected&&(e=t="undirected");var r=this.source[e],s=r[i];if(void 0===s)return r[i]=this,void(this.undirected&&n===i||(this.target[t][n]=this));s.previous=this,this.next=s,r[i]=this,this.target[t][n]=this},z.prototype.detach=function(){var e=this.source.key,t=this.target.key,n="out",i="in";this.undirected&&(n=i="undirected"),delete this.source[n][t],delete this.target[i][e]},z.prototype.detachMulti=function(){var e=this.source.key,t=this.target.key,n="out",i="in";this.undirected&&(n=i="undirected"),void 0===this.previous?void 0===this.next?(delete this.source[n][t],delete this.target[i][e]):(this.next.previous=void 0,this.source[n][t]=this.next,this.target[i][e]=this.next):(this.previous.next=this.next,void 0!==this.next&&(this.next.previous=this.previous))};var K=[{name:function(e){return"get".concat(e,"Attribute")},attacher:function(e,t,n){e.prototype[t]=function(e,i,r){var s=q(this,t,n,e,i,r),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,i){return q(this,t,n,e,i)[0].attributes}}},{name:function(e){return"has".concat(e,"Attribute")},attacher:function(e,t,n){e.prototype[t]=function(e,i,r){var s=q(this,t,n,e,i,r),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,i,r,s){var o=q(this,t,n,e,i,r,s),a=o[0],l=o[1],c=o[2];return a.attributes[l]=c,this.emit("nodeAttributesUpdated",{key:a.key,type:"set",attributes:a.attributes,name:l}),this}}},{name:function(e){return"update".concat(e,"Attribute")},attacher:function(e,t,n){e.prototype[t]=function(e,i,r,s){var o=q(this,t,n,e,i,r,s),a=o[0],l=o[1],c=o[2];if("function"!=typeof c)throw new B("Graph.".concat(t,": updater should be a function."));var u=a.attributes,h=c(u[l]);return u[l]=h,this.emit("nodeAttributesUpdated",{key:a.key,type:"set",attributes:a.attributes,name:l}),this}}},{name:function(e){return"remove".concat(e,"Attribute")},attacher:function(e,t,n){e.prototype[t]=function(e,i,r){var s=q(this,t,n,e,i,r),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,i,r){var s=q(this,t,n,e,i,r),o=s[0],a=s[1];if(!c(a))throw new B("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,i,r){var s=q(this,t,n,e,i,r),o=s[0],l=s[1];if(!c(l))throw new B("Graph.".concat(t,": provided attributes are not a plain object."));return a(o.attributes,l),this.emit("nodeAttributesUpdated",{key:o.key,type:"merge",attributes:o.attributes,data:l}),this}}},{name:function(e){return"update".concat(e,"Attributes")},attacher:function(e,t,n){e.prototype[t]=function(e,i,r){var s=q(this,t,n,e,i,r),o=s[0],a=s[1];if("function"!=typeof a)throw new B("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,i){var r;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new j("Graph.".concat(t,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>2){if(this.multi)throw new j("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=""+i;if(i=arguments[2],!(r=l(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 j("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[i]}}},{name:function(e){return"get".concat(e,"Attributes")},attacher:function(e,t,n){e.prototype[t]=function(e){var i;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new j("Graph.".concat(t,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>1){if(this.multi)throw new j("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 r=""+e,s=""+arguments[1];if(!(i=l(this,r,s,n)))throw new V("Graph.".concat(t,': could not find an edge for the given path ("').concat(r,'" - "').concat(s,'").'))}else{if("mixed"!==n)throw new j("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}}},{name:function(e){return"has".concat(e,"Attribute")},attacher:function(e,t,n){e.prototype[t]=function(e,i){var r;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new j("Graph.".concat(t,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>2){if(this.multi)throw new j("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=""+i;if(i=arguments[2],!(r=l(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 j("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.hasOwnProperty(i)}}},{name:function(e){return"set".concat(e,"Attribute")},attacher:function(e,t,n){e.prototype[t]=function(e,i,r){var s;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new j("Graph.".concat(t,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>3){if(this.multi)throw new j("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=""+i;if(i=arguments[2],r=arguments[3],!(s=l(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 j("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[i]=r,this.emit("edgeAttributesUpdated",{key:s.key,type:"set",attributes:s.attributes,name:i}),this}}},{name:function(e){return"update".concat(e,"Attribute")},attacher:function(e,t,n){e.prototype[t]=function(e,i,r){var s;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new j("Graph.".concat(t,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>3){if(this.multi)throw new j("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=""+i;if(i=arguments[2],r=arguments[3],!(s=l(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 j("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 r)throw new B("Graph.".concat(t,": updater should be a function."));return s.attributes[i]=r(s.attributes[i]),this.emit("edgeAttributesUpdated",{key:s.key,type:"set",attributes:s.attributes,name:i}),this}}},{name:function(e){return"remove".concat(e,"Attribute")},attacher:function(e,t,n){e.prototype[t]=function(e,i){var r;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new j("Graph.".concat(t,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>2){if(this.multi)throw new j("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=""+i;if(i=arguments[2],!(r=l(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 j("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 delete r.attributes[i],this.emit("edgeAttributesUpdated",{key:r.key,type:"remove",attributes:r.attributes,name:i}),this}}},{name:function(e){return"replace".concat(e,"Attributes")},attacher:function(e,t,n){e.prototype[t]=function(e,i){var r;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new j("Graph.".concat(t,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>2){if(this.multi)throw new j("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=""+i;if(i=arguments[2],!(r=l(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 j("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.'))}if(!c(i))throw new B("Graph.".concat(t,": provided attributes are not a plain object."));return r.attributes=i,this.emit("edgeAttributesUpdated",{key:r.key,type:"replace",attributes:r.attributes}),this}}},{name:function(e){return"merge".concat(e,"Attributes")},attacher:function(e,t,n){e.prototype[t]=function(e,i){var r;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new j("Graph.".concat(t,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>2){if(this.multi)throw new j("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=""+i;if(i=arguments[2],!(r=l(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 j("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.'))}if(!c(i))throw new B("Graph.".concat(t,": provided attributes are not a plain object."));return a(r.attributes,i),this.emit("edgeAttributesUpdated",{key:r.key,type:"merge",attributes:r.attributes,data:i}),this}}},{name:function(e){return"update".concat(e,"Attributes")},attacher:function(e,t,n){e.prototype[t]=function(e,i){var r;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new j("Graph.".concat(t,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>2){if(this.multi)throw new j("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=""+i;if(i=arguments[2],!(r=l(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 j("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.'))}if("function"!=typeof i)throw new B("Graph.".concat(t,": provided updater is not a function."));return r.attributes=i(r.attributes),this.emit("edgeAttributesUpdated",{key:r.key,type:"update",attributes:r.attributes}),this}}}],X=$,J=G,Q=function(){var e=arguments,t=null,n=-1;return new X((function(){for(var i=null;;){if(null===t){if(++n>=e.length)return{done:!0};t=J(e[n])}if(!0!==(i=t.next()).done)break;t=null}return i}))},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,i){var r=!1;for(var s in t)if(s!==i){var o=t[s];if(r=n(o.key,o.attributes,o.source.key,o.target.key,o.source.attributes,o.target.attributes,o.undirected),e&&r)return o.key}}function ne(e,t,n,i){var r,s,o,a=!1;for(var l in t)if(l!==i){r=t[l];do{if(s=r.source,o=r.target,a=n(r.key,r.attributes,s.key,o.key,s.attributes,o.attributes,r.undirected),e&&a)return r.key;r=r.next}while(void 0!==r)}}function ie(e,t){var n,i=Object.keys(e),r=i.length,s=0;return new $((function(){do{if(n)n=n.next;else{if(s>=r)return{done:!0};var o=i[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 re(e,t,n,i){var r=t[n];if(r){var s=r.source,o=r.target;return i(r.key,r.attributes,s.key,o.key,s.attributes,o.attributes,r.undirected)&&e?r.key:void 0}}function se(e,t,n,i){var r=t[n];if(r){var s=!1;do{if(s=i(r.key,r.attributes,r.source.key,r.target.key,r.source.attributes,r.target.attributes,r.undirected),e&&s)return r.key;r=r.next}while(void 0!==r)}}function oe(e,t){var n=e[t];return void 0!==n.next?new $((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}})):$.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,i){if(0!==t.size)for(var r,s,o="mixed"!==n&&n!==t.type,a="undirected"===n,l=!1,c=t._edges.values();!0!==(r=c.next()).done;)if(s=r.value,!o||s.undirected===a){var u=s,h=u.key,d=u.attributes,p=u.source,m=u.target;if(l=i(h,d,p.key,m.key,p.attributes,m.attributes,s.undirected),e&&l)return h}}function le(e,t,n,i,r,s){var o,a=t?ne:te;if("undirected"!==n){if("out"!==i&&(o=a(e,r.in,s),e&&o))return o;if("in"!==i&&(o=a(e,r.out,s,i?void 0:r.key),e&&o))return o}if("directed"!==n&&(o=a(e,r.undirected,s),e&&o))return o}function ce(e,t,n,i,r,s,o){var a,l=n?se:re;if("undirected"!==t){if(void 0!==r.in&&"out"!==i&&(a=l(e,r.in,s,o),e&&a))return a;if(void 0!==r.out&&"in"!==i&&(i||r.key!==s)&&(a=l(e,r.out,s,o),e&&a))return a}if("directed"!==t&&void 0!==r.undirected&&(a=l(e,r.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 he(){this.A=null,this.B=null}function de(e,t,n,i,r){for(var s in i){var o=i[s],a=o.source,l=o.target,c=a===n?l:a;if(!t||!t.has(c.key)){var u=r(c.key,c.attributes);if(e&&u)return c.key}}}function pe(e,t,n,i,r){if("mixed"!==t){if("undirected"===t)return de(e,null,i,i.undirected,r);if("string"==typeof n)return de(e,null,i,i[n],r)}var s,o=new he;if("undirected"!==t){if("out"!==n){if(s=de(e,null,i,i.in,r),e&&s)return s;o.wrap(i.in)}if("in"!==n){if(s=de(e,o,i,i.out,r),e&&s)return s;o.wrap(i.out)}}if("directed"!==t&&(s=de(e,o,i,i.undirected,r),e&&s))return s}function me(e,t,n){var i=Object.keys(n),r=i.length,s=0;return new $((function(){var o=null;do{if(s>=r)return e&&e.wrap(n),{done:!0};var a=n[i[s++]],l=a.source,c=a.target;o=l===t?c:l,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,i,r){for(var s,o,a,l,c,u,h,d=i._nodes.values(),p=i.type;!0!==(s=d.next()).done;){var m=!1;if(o=s.value,"undirected"!==p)for(a in l=o.out){c=l[a];do{if(u=c.target,m=!0,h=r(o.key,u.key,o.attributes,u.attributes,c.key,c.attributes,c.undirected),e&&h)return c;c=c.next}while(c)}if("directed"!==p)for(a in l=o.undirected)if(!(t&&o.key>a)){c=l[a];do{if((u=c.target).key!==a&&(u=c.source),m=!0,h=r(o.key,u.key,o.attributes,u.attributes,c.key,c.attributes,c.undirected),e&&h)return c;c=c.next}while(c)}if(n&&!m&&(h=r(o.key,null,o.attributes,null,null,null,null),e&&h))return null}}function ge(e){if(!c(e))throw new B('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 B("Graph.import: serialized node is missing its key.");if("attributes"in e&&(!c(e.attributes)||null===e.attributes))throw new B("Graph.import: invalid attributes. Attributes should be a plain object, null or omitted.")}function ye(e){if(!c(e))throw new B('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 B("Graph.import: serialized edge is missing its source.");if(!("target"in e))throw new B("Graph.import: serialized edge is missing its target.");if("attributes"in e&&(!c(e.attributes)||null===e.attributes))throw new B("Graph.import: invalid attributes. Attributes should be a plain object, null or omitted.");if("undirected"in e&&"boolean"!=typeof e.undirected)throw new B("Graph.import: invalid undirectedness information. Undirected should be boolean or omitted.")}he.prototype.wrap=function(e){null===this.A?this.A=e:null===this.B&&(this.B=e)},he.prototype.has=function(e){return null!==this.A&&e in this.A||null!==this.B&&e in this.B};var be,ve=(be=255&Math.floor(256*Math.random()),function(){return be++}),we=new Set(["directed","undirected","mixed"]),Ce=new Set(["domain","_events","_eventsCount","_maxListeners"]),Ae={allowSelfLoops:!0,multi:!1,type:"mixed"};function Se(e,t,n){var i=new e.NodeDataClass(t,n);return e._nodes.set(t,i),e.emit("nodeAdded",{key:t,attributes:n}),i}function xe(e,t,n,i,r,s,o,a){if(!i&&"undirected"===e.type)throw new j("Graph.".concat(t,": you cannot add a directed edge to an undirected graph. Use the #.addEdge or #.addUndirectedEdge instead."));if(i&&"directed"===e.type)throw new j("Graph.".concat(t,": you cannot add an undirected edge to a directed graph. Use the #.addEdge or #.addDirectedEdge instead."));if(a&&!c(a))throw new B("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 j("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 l=e._nodes.get(s),u=e._nodes.get(o);if(!l)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 h={key:null,undirected:i,source:s,target:o,attributes:a};if(n)r=e._edgeKeyGenerator();else if(r=""+r,e._edges.has(r))throw new j("Graph.".concat(t,': the "').concat(r,'" edge already exists in the graph.'));if(!e.multi&&(i?void 0!==l.undirected[o]:void 0!==l.out[o]))throw new j("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 d=new z(i,r,l,u,a);e._edges.set(r,d);var p=s===o;return i?(l.undirectedDegree++,u.undirectedDegree++,p&&(l.undirectedLoops++,e._undirectedSelfLoopCount++)):(l.outDegree++,u.inDegree++,p&&(l.directedLoops++,e._directedSelfLoopCount++)),e.multi?d.attachMulti():d.attach(),i?e._undirectedSize++:e._directedSize++,h.key=r,e.emit("edgeAdded",h),r}function Ee(e,t,n,i,r,s,o,l,u){if(!i&&"undirected"===e.type)throw new j("Graph.".concat(t,": you cannot merge/update a directed edge to an undirected graph. Use the #.mergeEdge/#.updateEdge or #.addUndirectedEdge instead."));if(i&&"directed"===e.type)throw new j("Graph.".concat(t,": you cannot merge/update an undirected edge to a directed graph. Use the #.mergeEdge/#.updateEdge or #.addDirectedEdge instead."));if(l)if(u){if("function"!=typeof l)throw new B("Graph.".concat(t,': invalid updater function. Expecting a function but got "').concat(l,'"'))}else if(!c(l))throw new B("Graph.".concat(t,': invalid attributes. Expecting an object but got "').concat(l,'"'));var h;if(s=""+s,o=""+o,u&&(h=l,l=void 0),!e.allowSelfLoops&&s===o)throw new j("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 d,p,m=e._nodes.get(s),f=e._nodes.get(o);if(!n&&(d=e._edges.get(r))){if(!(d.source.key===s&&d.target.key===o||i&&d.source.key===o&&d.target.key===s))throw new j("Graph.".concat(t,': inconsistency detected when attempting to merge the "').concat(r,'" edge with "').concat(s,'" source & "').concat(o,'" target vs. ("').concat(d.source.key,'", "').concat(d.target.key,'").'));p=d}if(p||e.multi||!m||(p=i?m.undirected[o]:m.out[o]),p){var g=[p.key,!1,!1,!1];if(u?!h:!l)return g;if(u){var y=p.attributes;p.attributes=h(y),e.emit("edgeAttributesUpdated",{type:"replace",key:p.key,attributes:p.attributes})}else a(p.attributes,l),e.emit("edgeAttributesUpdated",{type:"merge",key:p.key,attributes:p.attributes,data:l});return g}l=l||{},u&&h&&(l=h(l));var b={key:null,undirected:i,source:s,target:o,attributes:l};if(n)r=e._edgeKeyGenerator();else if(r=""+r,e._edges.has(r))throw new j("Graph.".concat(t,': the "').concat(r,'" edge already exists in the graph.'));var v=!1,w=!1;m||(m=Se(e,s,{}),v=!0,s===o&&(f=m,w=!0)),f||(f=Se(e,o,{}),w=!0),d=new z(i,r,m,f,l),e._edges.set(r,d);var C=s===o;return i?(m.undirectedDegree++,f.undirectedDegree++,C&&(m.undirectedLoops++,e._undirectedSelfLoopCount++)):(m.outDegree++,f.inDegree++,C&&(m.directedLoops++,e._directedSelfLoopCount++)),e.multi?d.attachMulti():d.attach(),i?e._undirectedSize++:e._directedSize++,b.key=r,e.emit("edgeAdded",b),[r,!0,v,w]}function _e(e,t){e._edges.delete(t.key);var n=t.source,i=t.target,r=t.attributes,s=t.undirected,o=n===i;s?(n.undirectedDegree--,i.undirectedDegree--,o&&(n.undirectedLoops--,e._undirectedSelfLoopCount--)):(n.outDegree--,i.inDegree--,o&&(n.directedLoops--,e._directedSelfLoopCount--)),e.multi?t.detachMulti():t.detach(),s?e._undirectedSize--:e._directedSize--,e.emit("edgeDropped",{key:t.key,attributes:r,source:n.key,target:i.key,undirected:s})}var Me=function(n){function i(e){var t;if(t=n.call(this)||this,"boolean"!=typeof(e=a({},Ae,e)).multi)throw new B("Graph.constructor: invalid 'multi' option. Expecting a boolean but got \"".concat(e.multi,'".'));if(!we.has(e.type))throw new B('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 B("Graph.constructor: invalid 'allowSelfLoops' option. Expecting a boolean but got \"".concat(e.allowSelfLoops,'".'));var i="mixed"===e.type?U:"directed"===e.type?W:Y;h(o(t),"NodeDataClass",i);var r="geid_"+ve()+"_",s=0;return h(o(t),"_attributes",{}),h(o(t),"_nodes",new Map),h(o(t),"_edges",new Map),h(o(t),"_directedSize",0),h(o(t),"_undirectedSize",0),h(o(t),"_directedSelfLoopCount",0),h(o(t),"_undirectedSelfLoopCount",0),h(o(t),"_edgeKeyGenerator",(function(){var e;do{e=r+s++}while(t._edges.has(e));return e})),h(o(t),"_options",e),Ce.forEach((function(e){return h(o(t),e,t[e])})),d(o(t),"order",(function(){return t._nodes.size})),d(o(t),"size",(function(){return t._edges.size})),d(o(t),"directedSize",(function(){return t._directedSize})),d(o(t),"undirectedSize",(function(){return t._undirectedSize})),d(o(t),"selfLoopCount",(function(){return t._directedSelfLoopCount+t._undirectedSelfLoopCount})),d(o(t),"directedSelfLoopCount",(function(){return t._directedSelfLoopCount})),d(o(t),"undirectedSelfLoopCount",(function(){return t._undirectedSelfLoopCount})),d(o(t),"multi",t._options.multi),d(o(t),"type",t._options.type),d(o(t),"allowSelfLoops",t._options.allowSelfLoops),d(o(t),"implementation",(function(){return"graphology"})),t}t(i,n);var r=i.prototype;return r._resetInstanceCounters=function(){this._directedSize=0,this._undirectedSize=0,this._directedSelfLoopCount=0,this._undirectedSelfLoopCount=0},r.hasNode=function(e){return this._nodes.has(""+e)},r.hasDirectedEdge=function(e,t){if("undirected"===this.type)return!1;if(1===arguments.length){var n=""+e,i=this._edges.get(n);return!!i&&!i.undirected}if(2===arguments.length){e=""+e,t=""+t;var r=this._nodes.get(e);return!!r&&r.out.hasOwnProperty(t)}throw new B("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."))},r.hasUndirectedEdge=function(e,t){if("directed"===this.type)return!1;if(1===arguments.length){var n=""+e,i=this._edges.get(n);return!!i&&i.undirected}if(2===arguments.length){e=""+e,t=""+t;var r=this._nodes.get(e);return!!r&&r.undirected.hasOwnProperty(t)}throw new B("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."))},r.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 i=this._nodes.get(e);return!!i&&(void 0!==i.out&&i.out.hasOwnProperty(t)||void 0!==i.undirected&&i.undirected.hasOwnProperty(t))}throw new B("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."))},r.directedEdge=function(e,t){if("undirected"!==this.type){if(e=""+e,t=""+t,this.multi)throw new j("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 i=n.out&&n.out[t]||void 0;return i?i.key:void 0}},r.undirectedEdge=function(e,t){if("directed"!==this.type){if(e=""+e,t=""+t,this.multi)throw new j("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 i=n.undirected&&n.undirected[t]||void 0;return i?i.key:void 0}},r.edge=function(e,t){if(this.multi)throw new j("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 i=n.out&&n.out[t]||n.undirected&&n.undirected[t]||void 0;if(i)return i.key},r.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)},r.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},r.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},r.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},r.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},r.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},r.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},r.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},r.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},r.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},r.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},r.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},r.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},r.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},r.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},r.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},r.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},r.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},r.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,i=0;return"directed"!==this.type&&(n+=t.undirectedDegree,i+=2*t.undirectedLoops),"undirected"!==this.type&&(n+=t.inDegree,i+=t.directedLoops),n-i},r.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,i=0;return"directed"!==this.type&&(n+=t.undirectedDegree,i+=2*t.undirectedLoops),"undirected"!==this.type&&(n+=t.outDegree,i+=t.directedLoops),n-i},r.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,i=0;return"directed"!==this.type&&(n+=t.undirectedDegree,i+=2*t.undirectedLoops),"undirected"!==this.type&&(n+=t.inDegree+t.outDegree,i+=2*t.directedLoops),n-i},r.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},r.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},r.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]},r.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 i=n.source.key,r=n.target.key;if(e===i)return r;if(e===r)return i;throw new V('Graph.opposite: the "'.concat(e,'" node is not attached to the "').concat(t,'" edge (').concat(i,", ").concat(r,")."))},r.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},r.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},r.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},r.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},r.addNode=function(e,t){var n=function(e,t,n){if(n&&!c(n))throw new B('Graph.addNode: invalid attributes. Expecting an object but got "'.concat(n,'"'));if(t=""+t,n=n||{},e._nodes.has(t))throw new j('Graph.addNode: the "'.concat(t,'" node already exist in the graph.'));var i=new e.NodeDataClass(t,n);return e._nodes.set(t,i),e.emit("nodeAdded",{key:t,attributes:n}),i}(this,e,t);return n.key},r.mergeNode=function(e,t){if(t&&!c(t))throw new B('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])},r.updateNode=function(e,t){if(t&&"function"!=typeof t)throw new B('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 i=n.attributes;n.attributes=t(i),this.emit("nodeAttributesUpdated",{type:"replace",key:e,attributes:n.attributes})}return[e,!1]}var r=t?t({}):{};return n=new this.NodeDataClass(e,r),this._nodes.set(e,n),this.emit("nodeAdded",{key:e,attributes:r}),[e,!0]},r.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 i in n.out){t=n.out[i];do{_e(this,t),t=t.next}while(t)}for(var r in n.in){t=n.in[r];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})},r.dropEdge=function(e){var t;if(arguments.length>1){var n=""+arguments[0],i=""+arguments[1];if(!(t=l(this,n,i,this.type)))throw new V('Graph.dropEdge: could not find the "'.concat(n,'" -> "').concat(i,'" 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},r.dropDirectedEdge=function(e,t){if(arguments.length<2)throw new j("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 j("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=l(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},r.dropUndirectedEdge=function(e,t){if(arguments.length<2)throw new j("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 j("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=l(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},r.clear=function(){this._edges.clear(),this._nodes.clear(),this._resetInstanceCounters(),this.emit("cleared")},r.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")},r.getAttribute=function(e){return this._attributes[e]},r.getAttributes=function(){return this._attributes},r.hasAttribute=function(e){return this._attributes.hasOwnProperty(e)},r.setAttribute=function(e,t){return this._attributes[e]=t,this.emit("attributesUpdated",{type:"set",attributes:this._attributes,name:e}),this},r.updateAttribute=function(e,t){if("function"!=typeof t)throw new B("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},r.removeAttribute=function(e){return delete this._attributes[e],this.emit("attributesUpdated",{type:"remove",attributes:this._attributes,name:e}),this},r.replaceAttributes=function(e){if(!c(e))throw new B("Graph.replaceAttributes: provided attributes are not a plain object.");return this._attributes=e,this.emit("attributesUpdated",{type:"replace",attributes:this._attributes}),this},r.mergeAttributes=function(e){if(!c(e))throw new B("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},r.updateAttributes=function(e){if("function"!=typeof e)throw new B("Graph.updateAttributes: provided updater is not a function.");return this._attributes=e(this._attributes),this.emit("attributesUpdated",{type:"update",attributes:this._attributes}),this},r.updateEachNodeAttributes=function(e,t){if("function"!=typeof e)throw new B("Graph.updateEachNodeAttributes: expecting an updater function.");if(t&&!p(t))throw new B("Graph.updateEachNodeAttributes: invalid hints. Expecting an object having the following shape: {attributes?: [string]}");for(var n,i,r=this._nodes.values();!0!==(n=r.next()).done;)(i=n.value).attributes=e(i.key,i.attributes);this.emit("eachNodeAttributesUpdated",{hints:t||null})},r.updateEachEdgeAttributes=function(e,t){if("function"!=typeof e)throw new B("Graph.updateEachEdgeAttributes: expecting an updater function.");if(t&&!p(t))throw new B("Graph.updateEachEdgeAttributes: invalid hints. Expecting an object having the following shape: {attributes?: [string]}");for(var n,i,r,s,o=this._edges.values();!0!==(n=o.next()).done;)r=(i=n.value).source,s=i.target,i.attributes=e(i.key,i.attributes,r.key,s.key,r.attributes,s.attributes,i.undirected);this.emit("eachEdgeAttributesUpdated",{hints:t||null})},r.forEachAdjacencyEntry=function(e){if("function"!=typeof e)throw new B("Graph.forEachAdjacencyEntry: expecting a callback.");fe(!1,!1,!1,this,e)},r.forEachAdjacencyEntryWithOrphans=function(e){if("function"!=typeof e)throw new B("Graph.forEachAdjacencyEntryWithOrphans: expecting a callback.");fe(!1,!1,!0,this,e)},r.forEachAssymetricAdjacencyEntry=function(e){if("function"!=typeof e)throw new B("Graph.forEachAssymetricAdjacencyEntry: expecting a callback.");fe(!1,!0,!1,this,e)},r.forEachAssymetricAdjacencyEntryWithOrphans=function(e){if("function"!=typeof e)throw new B("Graph.forEachAssymetricAdjacencyEntryWithOrphans: expecting a callback.");fe(!1,!0,!0,this,e)},r.nodes=function(){return"function"==typeof Array.from?Array.from(this._nodes.keys()):F(this._nodes.keys(),this._nodes.size)},r.forEachNode=function(e){if("function"!=typeof e)throw new B("Graph.forEachNode: expecting a callback.");for(var t,n,i=this._nodes.values();!0!==(t=i.next()).done;)e((n=t.value).key,n.attributes)},r.findNode=function(e){if("function"!=typeof e)throw new B("Graph.findNode: expecting a callback.");for(var t,n,i=this._nodes.values();!0!==(t=i.next()).done;)if(e((n=t.value).key,n.attributes))return n.key},r.mapNodes=function(e){if("function"!=typeof e)throw new B("Graph.mapNode: expecting a callback.");for(var t,n,i=this._nodes.values(),r=new Array(this.order),s=0;!0!==(t=i.next()).done;)n=t.value,r[s++]=e(n.key,n.attributes);return r},r.someNode=function(e){if("function"!=typeof e)throw new B("Graph.someNode: expecting a callback.");for(var t,n,i=this._nodes.values();!0!==(t=i.next()).done;)if(e((n=t.value).key,n.attributes))return!0;return!1},r.everyNode=function(e){if("function"!=typeof e)throw new B("Graph.everyNode: expecting a callback.");for(var t,n,i=this._nodes.values();!0!==(t=i.next()).done;)if(!e((n=t.value).key,n.attributes))return!1;return!0},r.filterNodes=function(e){if("function"!=typeof e)throw new B("Graph.filterNodes: expecting a callback.");for(var t,n,i=this._nodes.values(),r=[];!0!==(t=i.next()).done;)e((n=t.value).key,n.attributes)&&r.push(n.key);return r},r.reduceNodes=function(e,t){if("function"!=typeof e)throw new B("Graph.reduceNodes: expecting a callback.");if(arguments.length<2)throw new B("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,i,r=t,s=this._nodes.values();!0!==(n=s.next()).done;)r=e(r,(i=n.value).key,i.attributes);return r},r.nodeEntries=function(){var e=this._nodes.values();return new $((function(){var t=e.next();if(t.done)return t;var n=t.value;return{value:{node:n.key,attributes:n.attributes},done:!1}}))},r.export=function(){var e=this,t=new Array(this._nodes.size),n=0;this._nodes.forEach((function(e,i){t[n++]=function(e,t){var n={key:e};return u(t.attributes)||(n.attributes=a({},t.attributes)),n}(i,e)}));var i=new Array(this._edges.size);return n=0,this._edges.forEach((function(t,r){i[n++]=function(e,t,n){var i={key:t,source:n.source.key,target:n.target.key};return u(n.attributes)||(i.attributes=a({},n.attributes)),"mixed"===e&&n.undirected&&(i.undirected=!0),i}(e.type,r,t)})),{options:{type:this.type,multi:this.multi,allowSelfLoops:this.allowSelfLoops},attributes:this.getAttributes(),nodes:t,edges:i}},r.import=function(e){var t,n,r,s,o,a=this,l=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(e instanceof i)return e.forEachNode((function(e,t){l?a.mergeNode(e,t):a.addNode(e,t)})),e.forEachEdge((function(e,t,n,i,r,s,o){l?o?a.mergeUndirectedEdgeWithKey(e,n,i,t):a.mergeDirectedEdgeWithKey(e,n,i,t):o?a.addUndirectedEdgeWithKey(e,n,i,t):a.addDirectedEdgeWithKey(e,n,i,t)})),this;if(!c(e))throw new B("Graph.import: invalid argument. Expecting a serialized graph or, alternatively, a Graph instance.");if(e.attributes){if(!c(e.attributes))throw new B("Graph.import: invalid attributes. Expecting a plain object.");l?this.mergeAttributes(e.attributes):this.replaceAttributes(e.attributes)}if(e.nodes){if(r=e.nodes,!Array.isArray(r))throw new B("Graph.import: invalid nodes. Expecting an array.");for(t=0,n=r.length;t<n;t++){ge(s=r[t]);var u=s,h=u.key,d=u.attributes;l?this.mergeNode(h,d):this.addNode(h,d)}}if(e.edges){var p=!1;if("undirected"===this.type&&(p=!0),r=e.edges,!Array.isArray(r))throw new B("Graph.import: invalid edges. Expecting an array.");for(t=0,n=r.length;t<n;t++){ye(o=r[t]);var m=o,f=m.source,g=m.target,y=m.attributes,b=m.undirected,v=void 0===b?p:b;"key"in o?(l?v?this.mergeUndirectedEdgeWithKey:this.mergeDirectedEdgeWithKey:v?this.addUndirectedEdgeWithKey:this.addDirectedEdgeWithKey).call(this,o.key,f,g,y):(l?v?this.mergeUndirectedEdge:this.mergeDirectedEdge:v?this.addUndirectedEdge:this.addDirectedEdge).call(this,f,g,y)}}return this},r.nullCopy=function(e){var t=new i(a({},this._options,e));return t.replaceAttributes(a({},this.getAttributes())),t},r.emptyCopy=function(e){var t=this.nullCopy(e);return this._nodes.forEach((function(e,n){var i=a({},e.attributes);e=new t.NodeDataClass(n,i),t._nodes.set(n,e)})),t},r.copy=function(e){if("string"==typeof(e=e||{}).type&&e.type!==this.type&&"mixed"!==e.type)throw new j('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 j("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 j("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,i=this.emptyCopy(e),r=this._edges.values();!0!==(t=r.next()).done;)xe(i,"copy",!1,(n=t.value).undirected,n.key,n.source.key,n.target.key,a({},n.attributes));return i},r.toJSON=function(){return this.export()},r.toString=function(){return"[object Graph]"},r.inspect=function(){var t=this,n={};this._nodes.forEach((function(e,t){n[t]=e.attributes}));var i={},r={};this._edges.forEach((function(e,n){var s,o=e.undirected?"--":"->",a="",l=e.source.key,c=e.target.key;e.undirected&&l>c&&(s=l,l=c,c=s);var u="(".concat(l,")").concat(o,"(").concat(c,")");n.startsWith("geid_")?t.multi&&(void 0===r[u]?r[u]=0:r[u]++,a+="".concat(r[u],". ")):a+="[".concat(n,"]: "),i[a+=u]=e.attributes}));var s={};for(var o in this)this.hasOwnProperty(o)&&!Ce.has(o)&&"function"!=typeof this[o]&&"symbol"!==e(o)&&(s[o]=this[o]);return s.attributes=this._attributes,s.nodes=n,s.edges=i,h(s,"constructor",this.constructor),s},i}(f.exports.EventEmitter);"undefined"!=typeof Symbol&&(Me.prototype[Symbol.for("nodejs.util.inspect.custom")]=Me.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),i="add"===t?xe:Ee;e.generateKey?Me.prototype[n]=function(r,s,o){return i(this,n,!0,"undirected"===(e.type||this.type),null,r,s,o,"update"===t)}:Me.prototype[n]=function(r,s,o,a){return i(this,n,!1,"undirected"===(e.type||this.type),r,s,o,a,"update"===t)}}))})),function(e){K.forEach((function(t){var n=t.name,i=t.attacher;i(e,n("Node"),0),i(e,n("Source"),1),i(e,n("Target"),2),i(e,n("Opposite"),3)}))}(Me),function(e){Z.forEach((function(t){var n=t.name,i=t.attacher;i(e,n("Edge"),"mixed"),i(e,n("DirectedEdge"),"directed"),i(e,n("UndirectedEdge"),"undirected")}))}(Me),function(e){ee.forEach((function(t){!function(e,t){var n=t.name,i=t.type,r=t.direction;e.prototype[n]=function(e,t){if("mixed"!==i&&"mixed"!==this.type&&i!==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()):F(e._edges.keys(),e._edges.size);for(var n,i,r="undirected"===t?e.undirectedSize:e.directedSize,s=new Array(r),o="undirected"===t,a=e._edges.values(),l=0;!0!==(n=a.next()).done;)(i=n.value).undirected===o&&(s[l++]=i.key);return s}(this,i);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,i){var r=[];return le(!1,e,t,n,i,(function(e){r.push(e)})),r}(this.multi,"mixed"===i?this.type:i,r,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,i,r){var s=[];return ce(!1,e,t,n,i,r,(function(e){s.push(e)})),s}(i,this.multi,r,o,t)}throw new B("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,i=t.type,r=t.direction,s="forEach"+n[0].toUpperCase()+n.slice(1,-1);e.prototype[s]=function(e,t,n){if("mixed"===i||"mixed"===this.type||i===this.type){if(1===arguments.length)return ae(!1,this,i,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 le(!1,this.multi,"mixed"===i?this.type:i,r,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 ce(!1,i,this.multi,r,a,t,n)}throw new B("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 r=0;"directed"!==i&&(r+=this.undirectedSize),"undirected"!==i&&(r+=this.directedSize),e=new Array(r);var o=0;t.push((function(t,i,r,s,a,l,c){e[o++]=n(t,i,r,s,a,l,c)}))}else e=[],t.push((function(t,i,r,s,o,a,l){e.push(n(t,i,r,s,o,a,l))}));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,i,r,s,o,a,l){t(e,i,r,s,o,a,l)&&n.push(e)})),this[s].apply(this,e),n};var l="reduce"+n[0].toUpperCase()+n.slice(1);e.prototype[l]=function(){var e,t,n=Array.prototype.slice.call(arguments);if(n.length<2||n.length>4)throw new B("Graph.".concat(l,": 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 B("Graph.".concat(l,": 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 i=t;return n.push((function(t,n,r,s,o,a,l){i=e(i,t,n,r,s,o,a,l)})),this[s].apply(this,n),i}}(e,t),function(e,t){var n=t.name,i=t.type,r=t.direction,s="find"+n[0].toUpperCase()+n.slice(1,-1);e.prototype[s]=function(e,t,n){if("mixed"!==i&&"mixed"!==this.type&&i!==this.type)return!1;if(1===arguments.length)return ae(!0,this,i,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 le(!0,this.multi,"mixed"===i?this.type:i,r,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 ce(!0,i,this.multi,r,a,t,n)}throw new B("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,i,r,s,o,a){return t(e,n,i,r,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,i,r,s,o,a){return!t(e,n,i,r,s,o,a)})),!this[s].apply(this,e)}}(e,t),function(e,t){var n=t.name,i=t.type,r=t.direction,s=n.slice(0,-1)+"Entries";e.prototype[s]=function(e,t){if("mixed"!==i&&"mixed"!==this.type&&i!==this.type)return $.empty();if(!arguments.length)return function(e,t){if(0===e.size)return $.empty();var n="mixed"!==t&&t!==e.type,i="undirected"===t,r=e._edges.values();return new $((function(){for(var e,t;;){if((e=r.next()).done)return e;if(t=e.value,!n||t.undirected===i)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,i);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 i=$.empty();return"undirected"!==e&&("out"!==t&&void 0!==n.in&&(i=Q(i,ie(n.in))),"in"!==t&&void 0!==n.out&&(i=Q(i,ie(n.out,t?void 0:n.key)))),"directed"!==e&&void 0!==n.undirected&&(i=Q(i,ie(n.undirected))),i}(i,r,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,i){var r=$.empty();return"undirected"!==e&&(void 0!==n.in&&"out"!==t&&i in n.in&&(r=Q(r,oe(n.in,i))),void 0!==n.out&&"in"!==t&&i in n.out&&(t||n.key!==i)&&(r=Q(r,oe(n.out,i)))),"directed"!==e&&void 0!==n.undirected&&i in n.undirected&&(r=Q(r,oe(n.undirected,i))),r}(i,r,o,t)}throw new B("Graph.".concat(s,": too many arguments (expecting 0, 1 or 2 and got ").concat(arguments.length,")."))}}(e,t)}))}(Me),function(e){ue.forEach((function(t){(function(e,t){var n=t.name,i=t.type,r=t.direction;e.prototype[n]=function(e){if("mixed"!==i&&"mixed"!==this.type&&i!==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 i=[];return pe(!1,e,t,n,(function(e){i.push(e)})),i}("mixed"===i?this.type:i,r,t)}})(e,t),function(e,t){var n=t.name,i=t.type,r=t.direction,s="forEach"+n[0].toUpperCase()+n.slice(1,-1);e.prototype[s]=function(e,t){if("mixed"===i||"mixed"===this.type||i===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"===i?this.type:i,r,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,i){n.push(t(e,i))})),n};var a="filter"+n[0].toUpperCase()+n.slice(1);e.prototype[a]=function(e,t){var n=[];return this[s](e,(function(e,i){t(e,i)&&n.push(e)})),n};var l="reduce"+n[0].toUpperCase()+n.slice(1);e.prototype[l]=function(e,t,n){if(arguments.length<3)throw new B("Graph.".concat(l,": 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 i=n;return this[s](e,(function(e,n){i=t(i,e,n)})),i}}(e,t),function(e,t){var n=t.name,i=t.type,r=t.direction,s=n[0].toUpperCase()+n.slice(1,-1),o="find"+s;e.prototype[o]=function(e,t){if("mixed"===i||"mixed"===this.type||i===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"===i?this.type:i,r,n,t)}};var a="some"+s;e.prototype[a]=function(e,t){return!!this[o](e,t)};var l="every"+s;e.prototype[l]=function(e,t){return!this[o](e,(function(e,n){return!t(e,n)}))}}(e,t),function(e,t){var n=t.name,i=t.type,r=t.direction,s=n.slice(0,-1)+"Entries";e.prototype[s]=function(e){if("mixed"!==i&&"mixed"!==this.type&&i!==this.type)return $.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 i=$.empty(),r=new he;return"undirected"!==e&&("out"!==t&&(i=Q(i,me(r,n,n.in))),"in"!==t&&(i=Q(i,me(r,n,n.out)))),"directed"!==e&&(i=Q(i,me(r,n,n.undirected))),i}("mixed"===i?this.type:i,r,t)}}(e,t)}))}(Me);var Te=function(e){function n(t){var n=a({type:"directed"},t);if("multi"in n&&!1!==n.multi)throw new B("DirectedGraph.from: inconsistent indication that the graph should be multi in given options!");if("directed"!==n.type)throw new B('DirectedGraph.from: inconsistent "'+n.type+'" type in given options!');return e.call(this,n)||this}return t(n,e),n}(Me),Ie=function(e){function n(t){var n=a({type:"undirected"},t);if("multi"in n&&!1!==n.multi)throw new B("UndirectedGraph.from: inconsistent indication that the graph should be multi in given options!");if("undirected"!==n.type)throw new B('UndirectedGraph.from: inconsistent "'+n.type+'" type in given options!');return e.call(this,n)||this}return t(n,e),n}(Me),Le=function(e){function n(t){var n=a({multi:!0},t);if("multi"in n&&!0!==n.multi)throw new B("MultiGraph.from: inconsistent indication that the graph should be simple in given options!");return e.call(this,n)||this}return t(n,e),n}(Me),$e=function(e){function n(t){var n=a({type:"directed",multi:!0},t);if("multi"in n&&!0!==n.multi)throw new B("MultiDirectedGraph.from: inconsistent indication that the graph should be simple in given options!");if("directed"!==n.type)throw new B('MultiDirectedGraph.from: inconsistent "'+n.type+'" type in given options!');return e.call(this,n)||this}return t(n,e),n}(Me),Ne=function(e){function n(t){var n=a({type:"undirected",multi:!0},t);if("multi"in n&&!0!==n.multi)throw new B("MultiUndirectedGraph.from: inconsistent indication that the graph should be simple in given options!");if("undirected"!==n.type)throw new B('MultiUndirectedGraph.from: inconsistent "'+n.type+'" type in given options!');return e.call(this,n)||this}return t(n,e),n}(Me);function Pe(e){e.from=function(t,n){var i=a({},t.options,n),r=new e(i);return r.import(t),r}}return Pe(Me),Pe(Te),Pe(Ie),Pe(Le),Pe($e),Pe(Ne),Me.Graph=Me,Me.DirectedGraph=Te,Me.UndirectedGraph=Ie,Me.MultiGraph=Le,Me.MultiDirectedGraph=$e,Me.MultiUndirectedGraph=Ne,Me.InvalidArgumentsGraphError=B,Me.NotFoundGraphError=V,Me.UsageGraphError=j,Me}()},944:(e,t)=>{"use strict";t.Vb=void 0,t.Vb=function(e,t,n){var i=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 i=0,r=e.length,s=t.length,o=Math.floor(Math.max(r,s)/2)-1,a=new Array(r),l=new Array(s),c=0;c<r;c++)for(var u=Math.max(0,c-o);u<=Math.min(s,c+o+1);u++)if(!a[c]&&!l[u]&&e[c]===t[u]){++i,a[c]=l[u]=!0;break}if(0===i)return 0;var h=0,d=0;for(c=0;c<r;c++)if(a[c]){for(;!l[d];)d++;e.charAt(c)!==t.charAt(d++)&&h++}return(i/r+i/s+(i-(h/=2))/i)/3}(e,t,n),r=0;if(i>.7){for(var s=Math.min(e.length,t.length),o=0;e[o]===t[o]&&o<4&&o<s;)++r,o++;i+=.1*r*(1-i)}return i}},7106:e=>{"use strict";var t=e.exports=function(e,t,i){"function"==typeof t&&(i=t,t={}),n(t,"function"==typeof(i=t.cb||i)?i:i.pre||function(){},i.post||function(){},e,"",e)};function n(e,i,r,s,o,a,l,c,u,h){if(s&&"object"==typeof s&&!Array.isArray(s)){for(var d in i(s,o,a,l,c,u,h),s){var p=s[d];if(Array.isArray(p)){if(d in t.arrayKeywords)for(var m=0;m<p.length;m++)n(e,i,r,p[m],o+"/"+d+"/"+m,a,o,d,s,m)}else if(d in t.propsKeywords){if(p&&"object"==typeof p)for(var f in p)n(e,i,r,p[f],o+"/"+d+"/"+f.replace(/~/g,"~0").replace(/\//g,"~1"),a,o,d,s,f)}else(d in t.keywords||e.allKeys&&!(d in t.skipKeywords))&&n(e,i,r,p,o+"/"+d,a,o,d,s)}r(s,o,a,l,c,u,h)}}t.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0},t.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0},t.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0},t.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0}},5072:e=>{"use strict";var t=[];function n(e){for(var n=-1,i=0;i<t.length;i++)if(t[i].identifier===e){n=i;break}return n}function i(e,i){for(var s={},o=[],a=0;a<e.length;a++){var l=e[a],c=i.base?l[0]+i.base:l[0],u=s[c]||0,h="".concat(c," ").concat(u);s[c]=u+1;var d=n(h),p={css:l[1],media:l[2],sourceMap:l[3],supports:l[4],layer:l[5]};if(-1!==d)t[d].references++,t[d].updater(p);else{var m=r(p,i);i.byIndex=a,t.splice(a,0,{identifier:h,updater:m,references:1})}o.push(h)}return o}function r(e,t){var n=t.domAPI(t);return n.update(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap&&t.supports===e.supports&&t.layer===e.layer)return;n.update(e=t)}else n.remove()}}e.exports=function(e,r){var s=i(e=e||[],r=r||{});return function(e){e=e||[];for(var o=0;o<s.length;o++){var a=n(s[o]);t[a].references--}for(var l=i(e,r),c=0;c<s.length;c++){var u=n(s[c]);0===t[u].references&&(t[u].updater(),t.splice(u,1))}s=l}}},7659:e=>{"use strict";var t={};e.exports=function(e,n){var i=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(!i)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");i.appendChild(n)}},540: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 i="";n.supports&&(i+="@supports (".concat(n.supports,") {")),n.media&&(i+="@media ".concat(n.media," {"));var r=void 0!==n.layer;r&&(i+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),i+=n.css,r&&(i+="}"),n.media&&(i+="}"),n.supports&&(i+="}");var s=n.sourceMap;s&&"undefined"!=typeof btoa&&(i+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(s))))," */")),t.styleTagTransform(i,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:()=>c});var i=n(4328),r=n(6082),s=n(682),o=n(826),a=n(2738);const l=31;async function c(e,t=!1,n){const a=o.GO.forColumn(e);let c;n??=new Map;const h=a.isHelm()?(0,s.getHelmMonomers)(e):Object.keys(a.stats.freq).filter((e=>""!==e));for(let e=0;e<h.length;e++)n.has(h[e])||n.set(h[e],`${n.size+1}`);if(a.isHelm())c=await i.functions.call("HELM:getMolFiles",{col:e}),c=function(e,t,n=!1){const i=new Array(e.length);for(let r=0;r<e.length;r++){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 c=e.get(r);s=c.indexOf("\n",s)+1,s=c.indexOf("\n",s)+1,s=c.indexOf("\n",s)+1;const u=parseInt(c.substring(s,s+3)),h=parseInt(c.substring(s+3,s+6));a+=`M V30 COUNTS ${u} ${h} 0 0 0\n`,a+="M V30 BEGIN ATOM\n";for(let e=0;e<u;e++){s=c.indexOf("\n",s)+1+l,o=c.indexOf(" ",s);const i=c.substring(s,o);a+=n?`M V30 ${e+1} R${t.get(i)} 0.000 0.000 0 0\n`:`M V30 ${e+1} At 0.000 0.000 0 0 MASS=${t.get(i)}\n`}a+="M V30 END ATOM\n",a+="M V30 BEGIN BOND\n";for(let e=0;e<h;e++){s=c.indexOf("\n",s)+1;const t=parseInt(c.substring(s,s+3).trim()),n=parseInt(c.substring(s+3,s+6).trim());a+=`M V30 ${e+1} ${parseInt(c.substring(s+6,s+9).trim())} ${t} ${n}\n`}a+="M V30 END BOND\n",a+="M V30 END CTAB\n",a+="M END",i[r]=a}return i}(c,n,t);else{c=new Array(e.length);for(let i=0;i<e.length;i++){const e=u(a.getSplitted(i),n,t);c[i]=e}}return r.Column.fromStrings("monomericMols",c)}function u(e,t,n=!1){let i="\n Datagrok macromolecule handler\n\n 0 0 0 0 0 0 999 V3000\nM V30 BEGIN CTAB\n";i+=`M V30 COUNTS ${e.length} ${e.length?e.length-1:0} 0 0 0\n`,i+="M V30 BEGIN ATOM\n";for(let r=0;r<e.length;r++){const s=e.getCanonical(r);s!==a._S&&(i+=n?`M V30 ${r+1} R${t.get(s)} 0.000 0.000 0 0\n`:`M V30 ${r+1} At 0.000 0.000 0 0 MASS=${t.get(s)}\n`)}i+="M V30 END ATOM\n",i+="M V30 BEGIN BOND\n";for(let t=0;t<e.length-1;t++)i+=`M V30 ${t+1} 1 ${t+1} ${t+2}\n`;return i+="M V30 END BOND\n",i+="M V30 END CTAB\n",i+="M END",i}},682:(e,t,n)=>{"use strict";n.r(t),n.d(t,{GetRegionEditor:()=>Ei,SeqActivityCliffsEditor:()=>Ti,SeqPaletteCustom:()=>fi,SequenceSpaceEditor:()=>Mi,SplitToMonomersEditor:()=>_i,SubsequenceSearchTopMenu:()=>sr,_package:()=>di,activityCliffs:()=>Fi,addCopyMenu:()=>br,alignSequences:()=>Wi,applyNotationProviderForCyclized:()=>Mr,bioSubstructureFilter:()=>ur,compositionAnalysis:()=>Yi,compositionAnalysisWidget:()=>$i,convertDialog:()=>Ki,demoBioActivityCliffs:()=>Cr,demoBioAtomicLevel:()=>Ar,demoBioHelmMsaSequenceSpace:()=>Sr,demoBioSequenceSpace:()=>wr,demoBioSimilarityDiversity:()=>vr,detectMacromoleculeProbe:()=>Er,diversitySearchTopMenu:()=>ir,diversitySearchViewer:()=>nr,fastaSequenceCellRenderer:()=>Ii,getBioLib:()=>wi,getHelmMonomers:()=>Qi,getMolFromHelm:()=>_r,getMonomerLib:()=>Ci,getMonomerLibHelper:()=>pi,getRegion:()=>Gi,getRegionApp:()=>pr,getRegionHelmApp:()=>mr,getRegionPanel:()=>Si,getRegionTopMenu:()=>Di,getSeqHandler:()=>Ai,helmPreprocessingFunction:()=>Bi,hydrophobPalette:()=>mi,importBam:()=>qi,importFasta:()=>zi,initBio:()=>bi,libraryPanel:()=>xi,longSeqTableFasta:()=>gr,longSeqTableHelm:()=>yr,longSeqTableSeparator:()=>fr,macroMolColumnPropertyPanel:()=>Li,macromoleculeDifferenceCellRenderer:()=>Pi,macromoleculePreprocessingFunction:()=>Hi,manageMonomerLibraries:()=>lr,monomerCellRenderer:()=>Zi,multipleSequenceAlignmentDialog:()=>Ui,saveAsFasta:()=>cr,sdfToJsonLib:()=>xr,searchSubsequenceEditor:()=>rr,separatorSequenceCellRenderer:()=>Ni,sequenceAlignment:()=>Oi,sequenceIdentityScoring:()=>or,sequenceSimilarityScoring:()=>ar,sequenceSpaceTopMenu:()=>Vi,sequenceTooltip:()=>vi,similaritySearchTopMenu:()=>tr,similaritySearchViewer:()=>er,splitToMonomersTopMenu:()=>Ji,testDetectMacromolecule:()=>Xi,toAtomicLevel:()=>ji,vdRegionsViewer:()=>ki,webLogoAggApp:()=>dr,webLogoLargeApp:()=>hr,webLogoViewer:()=>Ri});var i,r,s=n(4328),o=n(7389),a=n(6082),l=n(684),c=n(9039);(r=i||(i={})).EUCLIDEAN="EUCLIDEAN",r.MANHATTAN="MANHATTAN";var u=n(1858),h=n(5072),d=n.n(h),p=n(7825),m=n.n(p),f=n(7659),g=n.n(f),y=n(5056),b=n.n(y),v=n(540),w=n.n(v),C=n(1113),A=n.n(C),S=n(7939),x={};x.styleTagTransform=A(),x.setAttributes=b(),x.insert=g().bind(null,"head"),x.domAPI=m(),x.insertStyleElement=w(),d()(S.A,x),S.A&&S.A.locals&&S.A.locals;var E=function(e,t,n,i){return new(n||(n=Promise))((function(r,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};let _=null,M=null;function T(e,t){return e&&""!=e?e:t}class I{constructor(){this.learningRate={uiName:"Learninig rate",value:1,tooltip:"The initial learning rate for the embedding optimization"},this.nEpochs={uiName:"Epochs",value:0,tooltip:"The number of epochs to optimize embeddings via SGD. Computed automatically if set to 0"},this.nNeighbors={uiName:"Neighbors",value:15,tooltip:"The number of nearest neighbors to construct the fuzzy manifold"},this.spread={uiName:"Spread",value:1,tooltip:"The effective scale of embedded points, used with min distance to control \n the clumped/dispersed nature of the embedding"},this.minDist={uiName:"Min distance",value:.1,tooltip:"The effective minimum distance between embedded points, \n used with spread to control the clumped/dispersed nature of the embedding"},this.randomSeed={uiName:"Random seed",value:null,tooltip:"Random seed",type:"string"},this.useWebGPU={uiName:"Use WebGPU",value:!1,tooltip:"Use WebGPU for KNN computations",type:"boolean",disableTooltip:"WebGPU is not available"},function(){return E(this,void 0,void 0,(function*(){if(!_&&(_=yield navigator.gpu.requestAdapter(),null==_))return null;const e=yield _.requestAdapterInfo();return e?T(e.description,T(e.vendor,"No GPU description available")):null}))}().then((e=>{e?this.useWebGPU.tooltip+=` (${e})`:(this.useWebGPU.value=!1,this.useWebGPU.disable=!0)}))}}class L{constructor(){this.epsilon={uiName:"Epsilon",value:10,tooltip:"Epsilon is learning rate"},this.perplexity={uiName:"Perplexity",value:30,tooltip:"Roughly how many neighbors each point influences"}}}n(934),n(8903),Object.prototype.toString;const $="MCL";a.SEMTYPE.MOLECULE,a.SEMTYPE.MACROMOLECULE;class N{constructor(){this.epsilon={uiName:"Epsilon",value:.01,tooltip:"Minimum distance between cluster points",min:0,max:2,step:.005},this.minPts={uiName:"Minimum points",value:4,tooltip:"Minimum number of points in cluster",min:1,max:1e3,step:1}}}class P{get algorithmOptions(){const e=this.methodsParams[this.methodInput.value],t={};return Object.keys(e).forEach((n=>{null!=e[n].value&&(t[n]=e[n].value)})),t}get dbScanOptions(){return{dbScanEpsilon:this.dbScanParams.epsilon.value??.01,dbScanMinPts:this.dbScanParams.minPts.value??4}}constructor(e={}){this.editorSettings={},this.plotEmbeddingsInput=o.input.bool("Plot embeddings",{value:!0}),this.clusterEmbeddingsInput=o.input.bool("Cluster embeddings",{value:!0}),this.preprocessingFunctionInputRoot=null,this.methods=[c.c.UMAP,c.c.T_SNE],this.columnFunctionsMap={},this.supportedFunctions={},this.availableMetrics=[],this.methodSettingsDiv=o.inputs([]),this.dbScanSettingsDiv=o.inputs([]),this.preprocessingFuncSettingsDiv=o.inputs([]),this.preprocessingFunctionSettings={},this.methodsParams={[c.c.UMAP]:new I,[c.c.T_SNE]:new L},this.dbScanParams=new N,this.editorSettings=e,this.editorSettings.enableMCL&&this.methods.push($),a.Func.find({tags:[l.GP]}).forEach((e=>{const t=e.options.get(l.n3)??"",n=e.friendlyName??e.name,i=e.options.get(l.C0)??"",r=e.options.get(l._X)??"",s=e.options.get(l.Gi)??"";this.editorSettings.semtype&&!t.includes(this.editorSettings.semtype)||this.editorSettings.type&&!i.includes(this.editorSettings.type)||this.editorSettings.units&&!r.includes(this.editorSettings.units)||(this.supportedFunctions[n]={func:e,semTypes:t?t.split(","):[],types:i?i.split(","):[],units:r?r.split(","):[],distanceFunctions:s?s.split(","):[]})})),this.tableInput=o.input.table("Table",{value:s.shell.tv.dataFrame,items:s.shell.tables,onValueChanged:()=>{this.onTableInputChanged()}}),this.onTableInputChanged(),this.regenerateColInput(),this.onColumnInputChanged();let t=!1,n=!1;this.methodInput=o.input.choice("Method",{value:c.c.UMAP,items:this.methods,onValueChanged:()=>{t&&this.createAlgorithmSettingsDiv(this.methodSettingsDiv,this.methodsParams[this.methodInput.value])}}),this.methodSettingsIcon=o.icons.settings((()=>{t=!t,t?this.createAlgorithmSettingsDiv(this.methodSettingsDiv,this.methodsParams[this.methodInput.value]):o.empty(this.methodSettingsDiv)}),"Modify methods parameters"),this.dbScanSettingsIcon=o.icons.settings((()=>{n=!n,n?this.createAlgorithmSettingsDiv(this.dbScanSettingsDiv,this.dbScanParams):o.empty(this.dbScanSettingsDiv)}),"Modify clustering parameters"),this.clusterEmbeddingsInput.classList.add("ml-dim-reduction-settings-input"),this.clusterEmbeddingsInput.root.prepend(this.dbScanSettingsIcon),this.methodInput.root.classList.add("ml-dim-reduction-settings-input"),this.methodInput.root.prepend(this.methodSettingsIcon),this.methodSettingsDiv=o.inputs([]);const i=this.columnFunctionsMap[this.colInput.value.name];this.preprocessingFunctionInput=o.input.choice("Encoding function",{value:i[0],items:i,onValueChanged:()=>{this.onPreprocessingFunctionChanged()}});let r=!1;this.preprocessingFunctionInputRoot||(this.preprocessingFunctionInputRoot=this.preprocessingFunctionInput.root,r=!0),r||(o.empty(this.preprocessingFunctionInputRoot),Array.from(this.preprocessingFunctionInput.root.children).forEach((e=>this.preprocessingFunctionInputRoot.append(e)))),this.preprocessingFunctionInputRoot.classList.add("ml-dim-reduction-settings-input");let u=!1;this.preprocessingFuncSettingsIcon=o.icons.settings((async()=>{u?o.empty(this.preprocessingFuncSettingsDiv):await this.createPreprocessingFuncParamsDiv(this.preprocessingFuncSettingsDiv,this.supportedFunctions[this.preprocessingFunctionInput.value].func),u=!u}),"Modify encoding function parameters"),this.preprocessingFunctionInputRoot.prepend(this.preprocessingFuncSettingsIcon),this.similarityMetricInput=o.input.choice("Similarity",{value:"",items:[]}),this.similarityMetricInput.nullable=!1,this.similarityMetricInputRoot||(this.similarityMetricInputRoot=this.similarityMetricInput.root),this.onPreprocessingFunctionChanged()}getColInput(){const e=this.tableInput.value?.columns.toList().find((e=>!!this.columnFunctionsMap[e.name]))??null,t=o.input.column("Column",{table:this.tableInput.value,value:e,onValueChanged:()=>this.onColumnInputChanged(),filter:e=>!!this.columnFunctionsMap[e.name]});return this.colInputRoot||(this.colInputRoot=t.root),t}regenerateColInput(){let e=!1;this.colInputRoot&&(e=!0,o.empty(this.colInputRoot)),this.colInput=this.getColInput(),e&&Array.from(this.colInput.root.children).forEach((e=>this.colInputRoot.append(e))),this.onColumnInputChanged()}onTableInputChanged(){const e=this.tableInput.value;e&&(this.columnFunctionsMap={},e.columns.toList().forEach((e=>{Object.keys(this.supportedFunctions).forEach((t=>{const n=this.supportedFunctions[t].semTypes,i=this.supportedFunctions[t].types,r=this.supportedFunctions[t].units,s=!n.length||e.semType&&n.includes(e.semType),o=!i.length||i.includes(e.type),a=!r.length||e.meta.units&&r.includes(e.meta.units);s&&o&&a&&(this.columnFunctionsMap[e.name]||(this.columnFunctionsMap[e.name]=[]),this.columnFunctionsMap[e.name].push(t))}))})),this.regenerateColInput())}onColumnInputChanged(){const e=this.colInput.value;if(!e)return;const t=this.columnFunctionsMap[e.name];this.preprocessingFunctionInput=o.input.choice("Preprocessing function",{value:t[0],items:t,onValueChanged:()=>{this.onPreprocessingFunctionChanged()}});let n=!1;this.preprocessingFunctionInputRoot||(this.preprocessingFunctionInputRoot=this.preprocessingFunctionInput.root,n=!0),n||(o.empty(this.preprocessingFunctionInputRoot),Array.from(this.preprocessingFunctionInput.root.children).forEach((e=>this.preprocessingFunctionInputRoot.append(e)))),this.onPreprocessingFunctionChanged()}onPreprocessingFunctionChanged(){o.empty(this.preprocessingFuncSettingsDiv),this.preprocessingFunctionSettings={};const e=this.preprocessingFunctionInput.value,t=this.supportedFunctions[e].distanceFunctions;this.availableMetrics=[...t],this.similarityMetricInput=o.input.choice("Similarity",{value:this.availableMetrics[0],items:this.availableMetrics}),this.similarityMetricInput.nullable=!1,this.similarityMetricInputRoot||(this.similarityMetricInputRoot=this.similarityMetricInput.root),o.empty(this.similarityMetricInputRoot),Array.from(this.similarityMetricInput.root.children).forEach((e=>this.similarityMetricInputRoot.append(e))),this.preprocessingFuncSettingsIcon&&(this.supportedFunctions[e].func.inputs.length<3?this.preprocessingFuncSettingsIcon.style.display="none":this.preprocessingFuncSettingsIcon.style.display="flex")}createAlgorithmSettingsDiv(e,t){return o.empty(e),Object.keys(t).forEach((n=>{const i=t[n],r="string"===i.type?o.input.string(i.uiName,{value:i.value??"",onValueChanged:()=>{i.value=r.value}}):"boolean"===i.type?o.input.bool(i.uiName,{value:i.value??!1,onValueChanged:()=>{i.value=r.value}}):o.input.float(i.uiName,{value:i.value,onValueChanged:()=>{i.value=r.value}});e.append(r.root),i.disable?(r.enabled=!1,o.tooltip.bind(r.input??r.root,i.disableTooltip??"")):o.tooltip.bind(r.input??r.root,i.tooltip)})),e}async createPreprocessingFuncParamsDiv(e,t){if(o.empty(e),t.inputs.length<3)return o.div();const n=t.prepare(),i=await n.buildEditor(o.div());for(let r=2;r<t.inputs.length;r++){const s=t.inputs[r];(this.preprocessingFunctionSettings[s.name]||n.inputParams[t.inputs[r].name].value||s.defaultValue)&&(this.preprocessingFunctionSettings[s.name]=this.preprocessingFunctionSettings[s.name]??n.inputParams[s.name].value??s.defaultValue);const o=i.find((e=>e.property.name===s.name));o&&(null!==this.preprocessingFunctionSettings[s.name]&&void 0!==this.preprocessingFunctionSettings[s.name]&&(o.value=this.preprocessingFunctionSettings[s.name]),o.onChanged((()=>{this.preprocessingFunctionSettings[s.name]=o.value})),e.append(o.root))}return e}getEditor(){return o.div([this.tableInput,this.colInputRoot,this.preprocessingFunctionInputRoot,this.preprocessingFuncSettingsDiv,this.methodInput,this.methodSettingsDiv,this.similarityMetricInputRoot,this.plotEmbeddingsInput,this.clusterEmbeddingsInput,this.dbScanSettingsDiv],{style:{minWidth:"420px"},classes:"ui-form dim-reduction-dialog-form"})}getParams(){return{table:this.tableInput.value,col:this.colInput.value,methodName:this.methodInput.value,preprocessingFunction:this.supportedFunctions[this.preprocessingFunctionInput.value].func,similarityMetric:this.similarityMetricInput.value,plotEmbeddings:this.plotEmbeddingsInput.value,clusterEmbeddings:this.clusterEmbeddingsInput.value,options:{...this.algorithmOptions,...this.dbScanOptions,preprocessingFuncArgs:this.preprocessingFunctionSettings??{}}}}}const O=rxjs.operators;var R=n(6295);const k=e=>null==e;function G(e,t,n,i){if(n>e[e.length-1])return;const r=e.findIndex((e=>n<e));e.pop(),e.splice(r,0,n),t.pop(),t.splice(r,0,i)}class D{constructor(e=!0,t=!0){const i=navigator.hardwareConcurrency;this._workerCount=e?Math.max(i-2,1):1,this._workers=new Array(this._workerCount).fill(null).map((()=>new Worker(new URL(n.p+n.u(793),n.b)))),this._terminateOnComplete=t}async calc(e,t,n=!0,r){return await this.calcMulti([e],[t],n,[r??{}],[1],i.MANHATTAN)}async calcMulti(e,t,n=!0,r=[{}],s=[1],o=i.MANHATTAN){if(e.length<1)throw new Error("values must contain at least one array");if(t.length!==e.length||r.length!==e.length||s.length!==e.length)throw new Error("values, fnNames, weights and opts must have the same length");return new Promise((async(i,a)=>{try{const a=e[0].length,l=new Array(this._workerCount),c=a*(a-1)/2;this._workerCount=Math.min(this._workerCount,c);const u=c/this._workerCount,h=new Float32Array(c);let d=0,p=1,m=0,f=Number.MIN_VALUE;for(let n=0;n<this._workerCount;n++){const i=Math.floor(n*u),g=n===this._workerCount-1?c:Math.floor((n+1)*u),y=d,b=p;n!==this._workerCount-1&&(d=a-2-Math.floor(Math.sqrt(-8*g+4*a*(a-1)-7)/2-.5),p=g-a*d+Math.floor((d+1)*(d+2)/2)),this._workers[n].postMessage({values:e,fnNames:t,startRow:y,startCol:b,chunckSize:g-i,opts:r,weights:s,aggregationMethod:o}),l[n]=new Promise(((e,t)=>{this._workers[n].onmessage=({data:{error:r,distanceMatrixData:s,min:o,max:a}})=>{this._terminateOnComplete&&setTimeout((()=>this._workers[n].terminate())),r?t(r):(h.set(s,i),o<m&&(m=o),a>f&&(f=a),e())}}))}await Promise.all(l),n&&h.forEach(((e,t)=>{h[t]=(e-m)/(f-m)})),i(h)}catch(e){a(e)}}))}terminate(){this._workers.forEach((e=>e.terminate()))}}class F{constructor(){this._workerCount=Math.max(navigator.hardwareConcurrency-2,1)}async calcMultiColumn(e,t,r,s=[{}],o=[1],a=i.EUCLIDEAN){const l=e[0].length*(e[0].length-1)/2,c=Math.floor(l/this._workerCount),u=e[0].length>2e4?await this.getMinimalThreshold(e,t,s,o,a):0;r<u&&(console.log(`using threshold ${u}`),r=u),s.forEach(((e,t)=>s[t].threshold=r));const h=new Array(this._workerCount),d=new Array(this._workerCount).fill(null).map((()=>new Worker(new URL(n.p+n.u(111),n.b))));for(let n=0;n<this._workerCount;n++)h[n]=new Promise(((i,u)=>{const h=n*c,p=n===this._workerCount-1?l:(n+1)*c;p<=h&&i({i:new Int32Array(0),j:new Int32Array(0),distance:new Float32Array(0),idx:n}),d[n].postMessage({values:e,startIdx:h,endIdx:p,threshold:r,fnNames:t,opts:s,weights:o,aggregationMethod:a}),d[n].onmessage=({data:{error:e,i:t,j:r,distance:s}})=>{e?(d[n].terminate(),u(e)):(d[n].terminate(),i({i:t,j:r,distance:s,idx:n}))}}));const p=await Promise.all(h),m=p.reduce(((e,t)=>e+t.i.length),0),f=new Int32Array(m),g=new Int32Array(m),y=new Float32Array(m);let b=0;for(const e of p)f.set(e.i,b),g.set(e.j,b),y.set(e.distance,b),b+=e.i.length;return{i:f,j:g,distance:y}}async calc(e,t,n,i={}){return await this.calcMultiColumn([e],[t],n,[i],[1])}async getKNN(e,t,n=15,i={}){return await this.multiColumnKNN([e],[t],n,[i],[1])}async getThresholdKNN(e,t,n=.8,i={}){return await this.multiColumnThresholdKnn([e],[t],n,[i],[1])}async multiColumnThresholdKnn(e,t,r=.8,s,o,a=i.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 l=e[0].length*(e[0].length-1)/2,c=Math.floor(l/this._workerCount),u=new Array(this._workerCount),h=new Array(this._workerCount).fill(null).map((()=>new Worker(new URL(n.p+n.u(603),n.b))));for(let n=0;n<this._workerCount;n++)u[n]=new Promise(((i,u)=>{const d=n*c,p=n===this._workerCount-1?l:(n+1)*c;p<=d&&i({knnDistances:new Array(0),knnIndexes:new Array(0)}),h[n].postMessage({values:e,startIdx:d,endIdx:p,fnNames:t,opts:s,threshold:r,weights:o,aggregationMethod:a}),h[n].onmessage=({data:{error:e,knnDistances:t,knnIndexes:r}})=>{e?(h[n].terminate(),u(e)):(h[n].terminate(),i({knnDistances:t,knnIndexes:r}))}}));const d=await Promise.all(u),p=new Int32Array(e[0].length);for(const t of d)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 d)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,r=15,s,o,a=i.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 l=e[0].length*(e[0].length-1)/2,c=Math.floor(l/this._workerCount),u=new Array(this._workerCount),h=new Array(this._workerCount).fill(null).map((()=>new Worker(new URL(n.p+n.u(950),n.b))));for(let n=0;n<this._workerCount;n++)u[n]=new Promise(((i,u)=>{const d=n*c,p=n===this._workerCount-1?l:(n+1)*c;p<=d&&i({knnDistances:new Array(0),knnIndexes:new Array(0)}),h[n].postMessage({values:e,startIdx:d,endIdx:p,fnNames:t,opts:s,nNeighbours:r,weights:o,aggregationMethod:a}),h[n].onmessage=({data:{error:e,knnDistances:t,knnIndexes:r}})=>{e?(h[n].terminate(),u(e)):(h[n].terminate(),i({knnDistances:t,knnIndexes:r}))}}));const d=await Promise.all(u),p={knnDistances:new Array(e[0].length).fill(null).map((()=>new Array(r).fill(99999))),knnIndexes:new Array(e[0].length).fill(null).map((()=>new Array(r).fill(-1)))};for(const t of d)for(let n=0;n<e[0].length;++n)for(let e=0;e<t.knnDistances[n]?.length;++e)G(p.knnDistances[n],p.knnIndexes[n],t.knnDistances[n][e],t.knnIndexes[n][e]);return p}async getSampleDistances(e,t,r=[],s,o=i.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,i=Math.floor(n/this._workerCount),l=1e6,c=Math.max(Math.min(n/1e3,l),Math.min(n,l)),u=Math.floor(c/this._workerCount),h=new Array(this._workerCount);for(let l=0;l<this._workerCount;l++)h[l]=new Promise(((c,h)=>{const d=l*i,p=l===this._workerCount-1?n:(l+1)*i;a[l].postMessage({values:e,startIdx:d,endIdx:p,sampleLength:u,fnNames:t,opts:r,weights:s,aggregationMethod:o}),a[l].onmessage=({data:{error:e,distance:t}})=>{a[l].terminate(),e?h(e):c({distance:t})}}));const d=await Promise.all(h),p=d.reduce(((e,t)=>e+t.distance.length),0),m=new Float32Array(p);let f=0;for(const e of d)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=[],r,s=i.EUCLIDEAN){try{const i=e.length*(e.length-1)/2,o=await this.getSampleDistances(e,t,n,r,s);return 1-o[Math.floor(7e7/i*o.length)]}catch(e){return console.error(e),.5}}static calcSync(e,t,n,i){const r=[],s=[],o=[];let a=0,l=0,c=0;const u=e.length*(e.length-1)/2;for(;a<u;){const t=k(e[l])||k(e[c])?1:n(e[l],e[c]);1-t>=i&&(r.push(l),s.push(c),o.push(t)),a++,c++,c===e.length&&(l++,c=l+1)}return{i:new Int32Array(r),j:new Int32Array(s),distance:new Float32Array(o)}}}var H,B,V=n(8774);(B=H||(H={})).none="none",B.bold="bold",B.dashed="dashed";class j{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,i,r=H.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=r,this.updateLines(i),this.visibility=null!==(s=i.visibility)&&void 0!==s?s:new V.A(this.lines.from.length),i.visibility||this.visibility.setAll(!0,!1),i.arrowSize&&(this.arrowWidth=i.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,i,r,s,o,a,l,c,u,h,d,p,m,f,g;const y=this.sp.getOptions().look,b=this.lines.colors||this.lines.widths||this.lines.opacities||this.lines.drawArrowsArr;b||(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 v=y.sizeColumnName?this.sp.dataFrame.col(y.sizeColumnName):null,w=this.sp.dataFrame.filter,C=Math.pow(null!==(i=this.lines.shortLineThreshold)&&void 0!==i?i: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{sizeFrom:n,sizeTo:i}=this.getMarkersSizes(y,v,e),w=this.sp.worldToScreen(this.xAxisCol.get(this.lines.from[e]),this.yAxisCol.get(this.lines.from[e]));let A=null==w?void 0:w.x,S=null==w?void 0:w.y;const x=this.sp.worldToScreen(this.xAxisCol.get(this.lines.to[e]),this.yAxisCol.get(this.lines.to[e]));let E=null==x?void 0:x.x,_=null==x?void 0:x.y;const M=Math.min(this.sp.viewBox.width,this.sp.viewBox.height);if(this.ctx.beginPath(),A&&S&&E&&_&&Math.hypot(E-A,_-S)/M>.01){if(b){const t=(null===(r=this.lines.colors)||void 0===r?void 0:r[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===(l=this.lines.opacities)||void 0===l?void 0:l[e]:null!==(c=this.lines.opacity)&&void 0!==c?c:1;this.ctx.strokeStyle=`rgba(${t},${n})`,this.ctx.lineWidth=(null===(u=this.lines.widths)||void 0===u?void 0:u[e])?null===(h=this.lines.widths)||void 0===h?void 0:h[e]:null!==(d=this.lines.width)&&void 0!==d?d:1}e===this._currentLineIdx&&this.toggleCurrentLineStyle(!0);const y=this.multipleLinesCounts[e];let v=null;if(y){t=this.getLineLength(A,S,E,_);const r=this.getPointOnDistance(A,S,E,_,i,t),s=this.getPointOnDistance(E,_,A,S,n,t);A=r.x,S=r.y,E=s.x,_=s.y,v=this.lines.from[e]>this.lines.to[e]?this.findControlPoint(y,A,S,E,_,e):this.findControlPoint(y,E,_,A,S,e),this.ctx.moveTo(A,S),this.ctx.quadraticCurveTo(v.x,v.y,E,_)}else(!this.lines.skipShortLines||Math.pow(E-A,2)+Math.pow(_-S,2)>C)&&(this.ctx.moveTo(A,S),this.ctx.lineTo(E,_));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(A,S,E,_)),t>this.arrowWidth)){const e=y?null:this.getPointOnDistance(A,S,E,_,i,t),n=y?v.x:A,r=y?v.y:S;this.canvasArrow(this.ctx,null!==(f=null==e?void 0:e.x)&&void 0!==f?f:A,null!==(g=null==e?void 0:e.y)&&void 0!==g?g:S,n,r)}this.ctx.stroke(),this.ctx.closePath(),e===this._currentLineIdx&&this.toggleCurrentLineStyle(!1)}}this.fillLeftBottomRect()}toggleCurrentLineStyle(e){switch(this.currentLineStyle){case H.bold:e?this.ctx.lineWidth+=2:this.ctx.lineWidth-=2;break;case H.dashed:e?this.ctx.setLineDash([5,5]):this.ctx.setLineDash([]);break;default:return}}getMarkersSizes(e,t,n){let i=3,r=3;return t?(i=(e.markerMinSize+(e.markerMaxSize-e.markerMinSize)*t.scale(this.lines.from[n]))/2,r=(e.markerMinSize+(e.markerMaxSize-e.markerMinSize)*t.scale(this.lines.to[n]))/2):e.markerDefaultSize&&(i=e.markerDefaultSize/2,r=e.markerDefaultSize/2),{sizeFrom:i,sizeTo:r}}fillLeftBottomRect(){const e=new Path2D;e.rect(this.sp.yAxisBox.minX,this.sp.yAxisBox.maxY,this.sp.yAxisBox.width,this.sp.xAxisBox.height),this.ctx.fillStyle="white",this.ctx.beginPath(),this.ctx.fill(e),this.ctx.closePath()}createMultiLinesIndices(){const e={};for(let t=0;t<this.lines.from.length;t++){let n=0,i=0;this.lines.from[t]<this.lines.to[t]?(n=this.lines.from[t],i=this.lines.to[t]):(n=this.lines.to[t],i=this.lines.from[t]),e[`${n}|${i}`]?(1===e[`${n}|${i}`].length&&(this.multipleLinesCounts[e[`${n}|${i}`][0]]=1,e[`${n}|${i}`].push(1)),this.multipleLinesCounts[t]=++e[`${n}|${i}`][1]):e[`${n}|${i}`]=[t]}}checkCoordsOnLine(e,t){let n=-1,i=null,r=null;const s=this.sp.getOptions().look,o=s.sizeColumnName?this.sp.dataFrame.col(s.sizeColumnName):null,a=this.sp.dataFrame.filter;for(let l=0;l<this.lines.from.length;l++)if(a.get(this.lines.from[l])&&a.get(this.lines.to[l])&&this.visibility.getBit(l)){const{sizeFrom:a,sizeTo:c}=this.getMarkersSizes(s,o,l),u=this.sp.worldToScreen(this.xAxisCol.get(this.lines.from[l]),this.yAxisCol.get(this.lines.from[l])),h=this.sp.worldToScreen(this.xAxisCol.get(this.lines.to[l]),this.yAxisCol.get(this.lines.to[l]));if(this.multipleLinesCounts[l]){const n=this.getLineLength(u.x,u.y,h.x,h.y),i=this.getPointOnDistance(u.x,u.y,h.x,h.y,c,n),s=this.getPointOnDistance(h.x,h.y,null==u?void 0:u.x,null==u?void 0:u.y,a,n),o=this.lines.from[l]>this.lines.to[l]?this.findControlPoint(this.multipleLinesCounts[l],i.x,i.y,s.x,s.y,l):this.findControlPoint(this.multipleLinesCounts[l],s.x,s.y,i.x,i.y,l);r=this.calculateDistToCurveLine(l,e,t,i,s,o)}else r=this.calculateDistToStraightLine(e,t,u,h);(!i&&null!==r&&r<5||i&&null!==r&&r<i)&&(i=r,n=l)}return n}calculateDistToStraightLine(e,t,n,i){const r=Math.min(n.x,i.x),s=Math.max(n.x,i.x),o=Math.min(n.y,i.y),a=Math.max(n.y,i.y);return e>=r-2&&e<=s+2&&t>=o-2&&t<=a+2?this.distToStraightLineSegment(e,t,n,i):null}distToStraightLineSegment(e,t,n,i){const r=(e,t,n,i)=>Math.pow(e-n,2)+Math.pow(t-i,2),s=r(n.x,n.y,i.x,i.y);if(0==s)return r(e,t,n.x,n.y);let o=((e-n.x)*(i.x-n.x)+(t-n.y)*(i.y-n.y))/s;return o=Math.max(0,Math.min(1,o)),r(e,t,n.x+o*(i.x-n.x),n.y+o*(i.y-n.y))}calculateDistToCurveLine(e,t,n,i,r,s){const o=Math.min(i.x,r.x,s.x),a=Math.max(i.x,r.x,s.x),l=Math.min(i.y,r.y,s.y),c=Math.max(i.y,r.y,s.y);if(t>=o-2&&t<=a+2&&n>=l-2&&n<=c+2){const e=a-o,u=c-l;return this.calculateDistToCurveInRect(t,n,i,s,r,e,u)}return null}calculateDistToCurveInRect(e,t,n,i,r,s,o){const a=Math.floor((s+o)/3),l=1/a,c=new Uint32Array(a),u=new Uint32Array(a),h=new Uint32Array(a);let d=null;const p=new V.A(a);for(let s=0;s<c.length;s++){const o=s*l,a=Math.pow(1-o,2)*n.x+2*o*(1-o)*i.x+Math.pow(o,2)*r.x,p=Math.pow(1-o,2)*n.y+2*o*(1-o)*i.y+Math.pow(o,2)*r.y,m=Math.abs(e-a),f=Math.abs(t-p),g=m+f;(!d||d>g)&&(d=g),h[s]=Math.max(m,f),c[s]=a,u[s]=p}for(let e=0;e<c.length;e++)h[e]<d&&p.setBit(e,!0,!1);let m=null;for(let n=-1;-1!==(n=p.findNext(n));){const i=Math.hypot(c[n]-e,u[n]-t);(!m||m>i)&&(m=i)}return m}getLineLength(e,t,n,i){return Math.sqrt(Math.pow(n-e,2)+Math.pow(i-t,2))}getPointOnDistance(e,t,n,i,r,s){const o=n-r*((n-e)/s),l=i-r*((i-t)/s);return new a.Point(o,l)}findControlPoint(e,t,n,i,r,s){const o=t+(i-t)/2,l=n+(r-n)/2;let c=o-t,u=l-n;const h=Math.sqrt(c*c+u*u);c/=h,u/=h;const d=50*Math.ceil(e/2);return e%2==0?new a.Point(o+d/2*u,l-d/2*c):new a.Point(o-d/2*u,l+d/2*c)}canvasArrow(e,t,n,i,r){const s=Math.atan2(i-t,r-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 U="dimensionality-reducer-terminate-event";var W,Y,z=n(3629);async function q(e,t,i,r,o,a,l){let c=await async function(e,t,i,r,o,a,l){if(!a.distanceFnArgs)throw new Error("options.distanceFnArgs must be defined");if(e.length!==t.length||e.length!==a.distanceFnArgs.length||e.length!==r.length)throw new Error("data, metrics and options and weights must have the same length");return new Promise((function(c,u){const h=new Worker(new URL(n.p+n.u(234),n.b));h.postMessage({columnsData:e,distanceMetrics:t,method:i,options:a,weights:r,aggregationMethod:o});const d=s.events.onCustomEvent(U).subscribe((()=>{try{h?.terminate()}finally{d.unsubscribe()}}));h.onmessage=({data:{error:e,embedding:t,epochNum:n,epochsLength:i}})=>{k(n)||k(i)?(d.unsubscribe(),e?u(e):c(t),setTimeout((()=>h.terminate()),100)):l&&l(n,i,t)}}))}(e,i,t,r,o,a,l);return c=c.map((e=>(0,z.S8)(e))),c}(Y=W||(W={})).EUCLIDEAN="EUCLIDEAN",Y.MANHATTAN="MANHATTAN";const K={[W.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 `},[W.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 Z,X;(X=Z||(Z={})).HAMMING="Hamming",X.EUCLIDEAN="Euclidean",X.MANHATTAN="Manhattan",X.TANIMOTO="Tanimoto",X.LEVENSTEIN="Levenshtein",X.NEEDLEMAN_WUNSCH="Needlemann-Wunsch",X.MONOMER_CHEMICAL_DISTANCE="Monomer chemical distance",X.SOKAL="Sokal",X.COSINE="Cosine",X.ASYMMETRIC="Asymmetric",X.Difference="Difference",X.OneHot="One-Hot";const J={[Z.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 `},[Z.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 `},[Z.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 `},[Z.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 `},[Z.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 `},[Z.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 `},[Z.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 `},[Z.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 `},[Z.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 `},[Z.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 `},[Z.Difference]:function(e,t){return`\n let range = suppInfo.range${t};\n return f32(abs(f32(a[0]) - f32(b[0])) / range);\n `},[Z.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 `}},Q={[Z.HAMMING]:e=>Math.ceil(e/30),[Z.EUCLIDEAN]:e=>Math.ceil(e/30),[Z.MANHATTAN]:e=>Math.ceil(e/30),[Z.TANIMOTO]:e=>Math.ceil(e/60),[Z.SOKAL]:e=>Math.ceil(e/60),[Z.COSINE]:e=>Math.ceil(e/60),[Z.ASYMMETRIC]:e=>Math.ceil(e/60),[Z.LEVENSTEIN]:e=>Math.ceil(e*e/60),[Z.NEEDLEMAN_WUNSCH]:e=>Math.ceil(e*e/60),[Z.MONOMER_CHEMICAL_DISTANCE]:e=>Math.ceil(e/25),[Z.Difference]:e=>1,[Z.OneHot]:e=>Math.ceil(e/40)},ee={STRING:new Set([Z.HAMMING,Z.LEVENSTEIN,Z.NEEDLEMAN_WUNSCH,Z.MONOMER_CHEMICAL_DISTANCE,Z.OneHot]),UINT32ARRAY:new Set([Z.HAMMING,Z.EUCLIDEAN,Z.MANHATTAN,Z.MONOMER_CHEMICAL_DISTANCE,Z.LEVENSTEIN,Z.NEEDLEMAN_WUNSCH,Z.TANIMOTO,Z.COSINE,Z.SOKAL,Z.ASYMMETRIC,Z.OneHot,Z.Difference]),INT32ARRAY:new Set([Z.EUCLIDEAN,Z.MANHATTAN,Z.OneHot,Z.Difference]),FLOAT32ARRAY:new Set([Z.EUCLIDEAN,Z.MANHATTAN,Z.Difference]),NUMBER:new Set([Z.EUCLIDEAN,Z.MANHATTAN,Z.Difference]),BITARRAY:new Set([Z.TANIMOTO,Z.COSINE,Z.SOKAL,Z.ASYMMETRIC])};var te=function(e,t,n,i){return new(n||(n=Promise))((function(r,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};function ne(e,t,n,i){return e.map(((e,i)=>`\n fn distanceScript${i}(aIndex: u32, bIndex: u32) -> f32 {\n let a = computeInfo.data${i}[aIndex];\n let b = computeInfo.data${i}[bIndex];\n let maxDistance: f32 = ${n};\n ${J[e](t[i],i)}\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 ${K[i](e.length)}\n }\n \n `}let ie=0;const re="cliffsDf",se=new u.Subject,oe="activity_difference",ae="SALI_index",le="similarity",ce="line_index",ue=["1_molecule","2_molecule"],he="filterCliffs";async function de(e,t,i,r,l,c,u,h,d,p,m,f,g,y,b,v,w){ie++;const C=c/100;let A,S=!1;const x=f.inputs,T=await f.apply({[x[0].name]:t,[x[1].name]:u,...d.preprocessingFuncArgs??{}});let I=[];if(h===$){const t=await function(e,t,i,r,s,o,a=10,l=!1,c=2){const u=new Worker(new URL(n.p+n.u(449),n.b));let h;return u.postMessage({data:e,threshold:t,weights:i,aggregationMethod:r,distanceFns:s,distanceFnArgs:o,maxIterations:a,useWebGPU:l,inflate:c}),{promise:new Promise(((e,t)=>{h=e,u.onmessage=t=>{setTimeout((()=>u.terminate()),100),e(t.data.res)},u.onerror=e=>{setTimeout((()=>u.terminate()),100),t(e)}})),terminate:()=>{try{h(null),u.terminate()}catch(e){console.error(e)}}}}([T.entries],c,[1],"MANHATTAN",[u],[T.options??{}],d?.maxIterations??5,d.useWebGPU??!1).promise;e.columns.addNewInt(e.columns.getUnusedName("MCL Cluster")).init((e=>t.clusters[e])),I=[t.embedX,t.embedY]}else I=await q([T.entries],h,[u],[1],"MANHATTAN",{...d,distanceFnArgs:[T.options??{}]});if(I.length!==i.length)throw new Error("Number of axes names should be equal to number of embedding dimensions");for(let t=0;t<I.length;++t)e.columns.addNewFloat(i[t]).init((e=>I[t][e]));let L=null;if(d.useWebGPU)try{L=await function(e,t=.8,n,i,r,s){return te(this,void 0,void 0,(function*(){const o=yield function(){return E(this,void 0,void 0,(function*(){if(!_&&(_=yield navigator.gpu.requestAdapter({powerPreference:"high-performance"}),null==_))return null;let e=!1;if(M&&(M.lost.then((()=>{e=!0})),yield new Promise((e=>setTimeout(e,10)))),!M||e){const e=1e9,t=_.limits,n=t.maxBufferSize,i=t.maxStorageBufferBindingSize;try{return M=yield _.requestDevice({requiredLimits:{maxBufferSize:Math.min(n,e),maxStorageBufferBindingSize:Math.min(i,e)}}),M}catch(e){return console.error("Failed to create device with required limits",e),M=yield _.requestDevice(),M}}return M}))}();if(!o)return null;const a=Object.values(Z);if(n.some((e=>!a.includes(e))))throw new Error("Invalid distance metrics provided: "+n.join(", "));if(!Object.values(W).includes(i))throw new Error("Invalid aggregation function provided: "+i);const l=1-t;if(s.length!==e.length||s.length!==n.length||s.length!==r.length)throw new Error("Options, weigths and distance functions must be provided for each column");if(e.some((t=>t.length!==e[0].length)))throw new Error("All entry lists must be the same length");const c=e.length,u=e[0].length,h=e.map(((e,t)=>function(e,t=Z.HAMMING,n,i={gapOpenPenalty:1,gapExtensionPenalty:.6}){var r,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 l=a[0]instanceof Int32Array?"INT32ARRAY":a[0]instanceof Float32Array?"FLOAT32ARRAY":"UINT32ARRAY",c=new Uint32Array(a.map((e=>e.length)));if(!ee[o]||!ee[o].has(t))throw new Error(`Distance metric '${t}' not supported for entry type '${o}'`);const u=c.reduce(((e,t)=>Math.max(e,t)),0),h=Q[t](u),d="INT32ARRAY"===l?Int32Array:"FLOAT32ARRAY"===l?Float32Array:Uint32Array,p=new d(a.length*u);a.forEach(((e,t)=>{p.set(e,t*u)}));let m="",f=0,g="FLOAT32ARRAY",y=null;if(t===Z.NEEDLEMAN_WUNSCH||t===Z.MONOMER_CHEMICAL_DISTANCE){let e=i.scoringMatrix&&i.alphabetIndexes?Object.keys(i.alphabetIndexes).reduce(((e,t)=>Math.max(e,t.charCodeAt(0))),0):-1;if(!i.alphabetIndexes||!i.scoringMatrix){for(let t=0;t<p.length;t++)p[t]>e&&(e=p[t]);i.scoringMatrix=new Array(e+1).fill(null).map((()=>new Array(e+1).fill(0))),i.alphabetIndexes={};for(let e=0;e<i.scoringMatrix.length;e++)i.scoringMatrix[e][e]=1,i.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=i.alphabetIndexes;for(const e of Object.keys(a))for(const t of Object.keys(a))e!==t&&(o[e.charCodeAt(0)][t.charCodeAt(0)]=i.scoringMatrix[a[e]][a[t]]);f=2+t,g="FLOAT32ARRAY",y=new Float32Array(f),y[0]=null!==(r=i.gapOpenPenalty)&&void 0!==r?r:1,y[1]=null!==(s=i.gapExtensionPenalty)&&void 0!==s?s:.6;let l=2;for(let e=0;e<o.length;e++)y.set(o[e],l),l+=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===Z.Difference){if(!i.range||"number"!=typeof i.range||i.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]);i.range=t-e}i.range<=0&&(i.range=1),f=1,g="FLOAT32ARRAY",y=new Float32Array([i.range]),m=`\n range${n}: f32`}const b=p instanceof Int32Array?"i32":p instanceof Float32Array?"f32":"u32",v=`data${n}: array<array<${b}, ${u}>, ${a.length}>`;return{flatSourceArray:p,sourceArraySize:p.length,maxEntryLen:u,arraySizes:c,complexity:h,suppInfoBuffer:y,suppInfoSize:f,suppInfoType:g,suppInfoStructWgsl:m,entryType:o,dataTypeWGSL:b,dataStructWgsl:v,EncodedArrayConstructor:d}}(e,n[t],t,s[t])));if(0===c)throw new Error("No columns provided. Please provide at least one column of data.");1===c&&(i=W.MANHATTAN);let d=h.map((e=>e.suppInfoStructWgsl)).filter((e=>!!e&&""!=e)).join(",\n"),p=!1;d&&""!=d.trim()||(p=!0,d="\ndummy: f32\n");const m=h.map((e=>e.dataStructWgsl)).filter((e=>!!e&&""!=e)).join(",\n"),f=new Uint32Array(c*u);h.forEach(((e,t)=>{f.set(e.arraySizes,t*u)}));const g=1e4,y=100,b=h.reduce(((e,t)=>e+t.complexity),0),v=Math.ceil(6e3/b),w=Math.ceil(Math.sqrt(Math.ceil(100))),C=10*w,A=u*(u-1)/2,S=Math.ceil(A/g),x=o.createShaderModule({label:"Sparse matrix compute shader",code:`\n // each thread will perform 100 iterations at one time, comparing 100 pairs of entries.\n // in total, each thread will perform at most ${S} comparisons.\n // first is the result struct, containing is, js, and distances. each array with length of 100,\n // and also integer for how many pairs were found to be below threshold.\n struct SparseResult {\n i: array<array<u32, 100>, 10000>,\n j: array<array<u32, 100>, 10000>,\n distances: array<array<f32, 100>, 10000>,\n found: array<u32, 10000>,\n done: array<u32, 10000>\n }\n // struct for the data\n struct ComputeInfo {\n // start at cols and rows, and end at cols and rows for each thread, these will be calculated on cpu and passed to gpu.\n startAtCols: array<u32, 10000>,\n startAtRows: array<u32, 10000>,\n endAtCols: array<u32, 10000>,\n endAtRows: array<u32, 10000>,\n\n // the ACTUALLY sizes of each entry\n entrySizes: array<array<u32, ${u}>, ${c}>,\n // the weights for each entry\n weights: array<f32, ${c}>,\n // the data for each entry\n ${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 ${d}\n };\n\n @group(0) @binding(0) var<storage, read_write> computeInfo: ComputeInfo;\n @group(0) @binding(1) var<storage, read_write> suppInfo: SuppInfo;\n @group(0) @binding(2) var<storage, read_write> results: SparseResult;\n @compute @workgroup_size(10, 10) fn calcSparseMatrix(\n @builtin(global_invocation_id) id: vec3<u32>\n ) {\n ${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 * ${C} + threadCol;\n if (linearIndex >= 10000) {\n return; // if we are out of bounds, return\n } \n var startAtCol: u32 = computeInfo.startAtCols[linearIndex];\n var startAtRow: u32 = computeInfo.startAtRows[linearIndex];\n let endAtCol: u32 = min(computeInfo.endAtCols[linearIndex], ${u}u);\n let endAtRow: u32 = min(computeInfo.endAtRows[linearIndex], ${u}u);\n let is = &results.i[linearIndex];\n let js = &results.j[linearIndex];\n let distances = &results.distances[linearIndex];\n results.found[linearIndex] = 0; // initialize the found counter\n var found: u32 = 0;\n if (results.done[linearIndex] > 0) {\n return; // if we are done, return\n }\n for (var i = 0; i < ${v}; i++) {\n if (startAtCol >= endAtCol && startAtRow >= endAtRow) {\n results.done[linearIndex] = 1;\n break;\n }\n if (found >= 100) {\n break;\n }\n let dist = combinedDistance(startAtCol, startAtRow);\n if (dist <= ${l}) {\n (*is)[found] = startAtCol;\n (*js)[found] = startAtRow;\n (*distances)[found] = dist;\n found = found + 1;\n }\n startAtCol = startAtCol + 1;\n if (startAtCol >= ${u}u) {\n startAtRow += 1;\n startAtCol = startAtRow + 1;\n }\n }\n results.found[linearIndex] = found;\n // update the startAtCols and startAtRows\n computeInfo.startAtCols[linearIndex] = startAtCol;\n computeInfo.startAtRows[linearIndex] = startAtRow;\n\n }\n\n // this will generate the distance script for each distance metric and then combine them into one\n ${ne(n,h.map((e=>e.maxEntryLen)),l,i)}\n\n\n `}),T=o.createComputePipeline({label:"sparse matrix compute pipeline",layout:"auto",compute:{module:x,entryPoint:"calcSparseMatrix"}}),I=new Uint32Array(g),L=new Uint32Array(g),$=new Uint32Array(g),N=new Uint32Array(g),P=Math.floor(A/g);let O=0,R=1;console.time("GPUthreadStarts");for(let e=0;e<g;e++){const t=9999===e?A-1:(e+1)*P,n=u-2-Math.floor(Math.sqrt(-8*t+4*u*(u-1)-7)/2-.5),i=t-u*n+Math.floor((n+1)*(n+2)/2);I[e]=R,L[e]=O,$[e]=i,N[e]=n,O=n,R=i}console.timeEnd("GPUthreadStarts");const k=4e4+u*c+c+h.reduce(((e,t)=>e+t.sourceArraySize),0),G=h.reduce(((e,t)=>e+t.suppInfoSize),0),D=1e6,F=k*Uint32Array.BYTES_PER_ELEMENT;let H=F;const B=15&F;0!==B&&(H+=16-B);const V=o.createBuffer({label:"compute info buffer",size:H,usage:GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST,mappedAtCreation:!0}),j=V.getMappedRange();let U=0;new Uint32Array(j,U,g).set(I),U+=g*Uint32Array.BYTES_PER_ELEMENT,new Uint32Array(j,U,g).set(L),U+=g*Uint32Array.BYTES_PER_ELEMENT,new Uint32Array(j,U,g).set($),U+=g*Uint32Array.BYTES_PER_ELEMENT,new Uint32Array(j,U,g).set(N),U+=g*Uint32Array.BYTES_PER_ELEMENT,new Uint32Array(j,U,f.length).set(f),U+=f.length*Uint32Array.BYTES_PER_ELEMENT,new Float32Array(j,U,c).set(r),U+=c*Float32Array.BYTES_PER_ELEMENT;for(const e of h){const t=e.EncodedArrayConstructor,n=e.sourceArraySize;new t(j,U,n).set(e.flatSourceArray),U+=n*t.BYTES_PER_ELEMENT}V.unmap();const Y=G*Uint32Array.BYTES_PER_ELEMENT;let z=Y;const q=15&Y;0!==q&&(z+=16-q),z=Math.max(z,16);const K=o.createBuffer({label:"supp info buffer",size:z,usage:GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST,mappedAtCreation:!0}),X=K.getMappedRange();let J=0;for(const e of h)e.suppInfoBuffer&&e.suppInfoBuffer.byteLength>0&&e.suppInfoSize>0&&(new("UINT32ARRAY"===e.suppInfoType?Uint32Array:Float32Array)(X,J,e.suppInfoBuffer.length).set(e.suppInfoBuffer),J+=e.suppInfoBuffer.byteLength);0===J&&new Uint32Array(X,0,4).set([1,1,1,1]),K.unmap();const te=302e4*Uint32Array.BYTES_PER_ELEMENT;let ie=te;const re=15&te;0!==re&&(ie+=16-re);const se=o.createBuffer({label:"results buffer",size:ie,usage:GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_SRC}),oe=o.createBindGroup({label:"bindGroup for sparse matrix buffer",layout:T.getBindGroupLayout(0),entries:[{binding:0,resource:{buffer:V}},{binding:1,resource:{buffer:K}},{binding:2,resource:{buffer:se}}]}),ae=o.createBuffer({label:"results out buffer",size:se.size,usage:GPUBufferUsage.MAP_READ|GPUBufferUsage.COPY_DST}),le=[],ce=[],ue=[];let he=!1;for(;!he;){const e=o.createCommandEncoder({label:"distance encoder"}),t=e.beginComputePass({label:"distance compute pass"});t.setPipeline(T),t.setBindGroup(0,oe),t.dispatchWorkgroups(w,w),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 i=ae.getMappedRange();let r=0;const s=new Uint32Array(i,r,D);r+=D*Uint32Array.BYTES_PER_ELEMENT;const a=new Uint32Array(i,r,D);r+=D*Uint32Array.BYTES_PER_ELEMENT;const l=new Float32Array(i,r,D);r+=D*Float32Array.BYTES_PER_ELEMENT;const c=new Uint32Array(i,r,g);r+=g*Uint32Array.BYTES_PER_ELEMENT,he=new Uint32Array(i,r,g).every((e=>1===e));const u=c.reduce(((e,t)=>e+t),0),h=new Uint32Array(u),d=new Uint32Array(u),p=new Float32Array(u);let m=0;for(let e=0;e<c.length;e++){const t=c[e];0!==t&&(h.set(s.subarray(e*y,e*y+t),m),d.set(a.subarray(e*y,e*y+t),m),p.set(l.subarray(e*y,e*y+t),m),m+=t)}le.push(h),ce.push(d),ue.push(p),ae.unmap()}const de=le.reduce(((e,t)=>e+t.length),0),pe=new Uint32Array(de),me=new Uint32Array(de),fe=new Float32Array(de);let ge=0;for(let e=0;e<le.length;e++)pe.set(le[e],ge),me.set(ce[e],ge),fe.set(ue[e],ge),ge+=le[e].length;return V.destroy(),K.destroy(),se.destroy(),ae.destroy(),{i:pe,j:me,distance:fe}}))}([T.entries],C,[u],W.MANHATTAN,[1],[T.options??{}])}catch(e){console.error(e)}L||(d.useWebGPU&&console.error("WebGPU sparse matrix calculation failed, falling back to CPU implementation"),L=await(new F).calc(T.entries,u,C,T.options));const N=await async function(e,t){const n=e.distance.map(((n,i)=>{const r=Math.abs(t.get(e.i[i])-t.get(e.j[i]));return 0!=n?r/n:1/0})),i=e.distance.map((e=>1-e)),r=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:i,saliVals:n,n1:r,n2:s,cliffsBitSet:o}}(L,l),P=function(e,t,n,i,r,s,o){const l=new Array(e).fill(0);for(let e=0;e!=i.length;++e)n[e]!=1/0&&(o.get(i[e])>o.get(r[e])?l[i[e]]+=n[e]:l[r[e]]+=n[e]);return a.Column.fromList("double",t,l)}(t.length,`sali_${i[0].substring(i[0].lastIndexOf("_"))}`,N.saliVals,N.n1,N.n2,0,l);e.columns.add(P);const R=N.cliffsBitSet,k=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}}(N.saliVals),G=.8/(k.max-k.min),D=w?s.shell.view("Browse").preview:s.shell.getTableView(e.name),B=D.addViewer(a.VIEWER.SCATTER_PLOT,{xColumnName:i[0],yColumnName:i[1],size:P.name,color:l.name,showXSelector:!1,showYSelector:!1,showSizeSelector:!1,showColorSelector:!1,markerMinSize:5,markerMaxSize:25,title:r}),V=function(e,t,n,i,r,s,o,l){const c={from:new Uint32Array(t.n1.length),to:new Uint32Array(t.n1.length),opacities:new Float32Array(t.n1.length),colors:new Array(t.n1.length),widths:new Float32Array(t.n1.length)};for(let n=0;n<t.n1.length;n++)c.from[n]=t.n1[n],c.to[n]=t.n2[n],c.opacities[n]=t.saliVals[n]===1/0?1:.2+(t.saliVals[n]-o.min)*l,c.colors[n]=e.selection.get(c.from[n])&&e.selection.get(c.to[n])?"255,255,0":"0,128,0",c.widths[n]=1;const u=a.DataFrame.create(c.from.length);return ue.forEach(((e,t)=>{u.columns.addNewString(e).init((e=>n.get(0===t?c.from[e]:c.to[e]))),function(e,t){Object.keys(t).forEach((n=>{e.tags[n]=t[n]}))}(u.col(e),s),u.col(e).semType=r})),u.columns.addNewFloat(oe).init((e=>Math.abs(i.get(c.from[e])-i.get(c.to[e])))),u.columns.addNewInt(ce).init((e=>e)),u.columns.addNewFloat(ae).init((e=>t.saliVals[e])),u.columns.addNewFloat(le).init((e=>t.simVals[e])),u.name=`${re}${ie}`,{lines:c,linesDf:u}}(e,N,t,l,p,m,k,G);V.lines.skipMultiLineCalculation=!0,V.linesDf.col(ae).setTag("description","Structure−Activity Landscape Index (activity difference divided by 1 minus similarity)");const U=new j(B,i[0],i[1],V.lines,H.none),Y=b?b(V.linesDf,ue).sort([ae],[!1]):V.linesDf.plot.grid().sort([ae],[!1]);Y.col(ce)&&(Y.col(ce).visible=!1),e.temp[".cliffsDfGrid"]=Y;const z=o.button(`${V.linesDf.rowCount} cliffs`,(()=>{w&&D.addViewer(Y),D.dockManager.dock(Y,"down",null,"Activity cliffs",v??.2)}));z.classList.add("scatter_plot_link","cliffs_grid"),B.root.append(z);const K=o.input.toggle("Show only cliffs",{value:!1,onValueChanged:()=>{K.value?(B.dataFrame.setTag(he,i[0]),e.filter.and(R),se.next(i[0])):(B.dataFrame.setTag(he,""),e.filter.setAll(!0),se.next(""))}});K.root.classList.add("scatter_plot_link","show_only_cliffs"),B.root.append(K.root),se.subscribe((e=>{K.enabled=""===e||e===i[0]}));let X=!1;B.onEvent("d4-before-draw-scene").subscribe((t=>{X?X=!1:K.value&&(setTimeout((()=>{e.filter.and(R)}),100),X=!0)}));const J=s.events.onViewerClosed.subscribe((e=>{e.args.viewer===B&&(D.dockManager.close(Y.root),J.unsubscribe(),D.subs=D.subs.filter((e=>e!==J)))}));return D.subs.push(J),V.linesDf.onCurrentCellChanged.subscribe((()=>{for(let e=0;e<V.linesDf.rowCount;e++)V.lines.widths[e]=e===V.linesDf.currentRowIdx?3:1;U.linesToRender=V.lines;const n=V.linesDf.currentCol&&V.linesDf.currentCol.name===ue[1]?V.lines.to:V.lines.from,r=-1!==V.linesDf.currentRowIdx?V.linesDf.currentRowIdx:null;if(B.dataFrame.currentRowIdx=r?n[r]:-1,null!==r){const n=V.linesDf.currentRowIdx;U.currentLineId=n;const{zoomLeft:a,zoomRight:c,zoomTop:u,zoomBottom:h}=function(e,t,n,i,r,s){const o=Math.abs(n-r),a=Math.abs(i-s),l=e/o,c=t/a,u=Math.min(l,c),h=e/u*5,d=t/u*5,p=(n<r?n:r)+o/2-h/2,m=(i>s?i:s)-a/2+d/2;return{zoomLeft:p,zoomRight:p+h,zoomTop:m,zoomBottom:m-d}}(B.viewport.width,B.viewport.height,B.dataFrame.get(i[0],V.lines.from[n]),B.dataFrame.get(i[1],V.lines.from[n]),B.dataFrame.get(i[0],V.lines.to[n]),B.dataFrame.get(i[1],V.lines.to[n]));B.zoom(a,u,c,h),K.value?e.filter.and(R):!0===K.enabled&&e.filter.setAll(!0),setTimeout((()=>{!function(e,t,n,i,r,a,l,c,u){const h=t.getPane("Cliff Details");o.empty(h.root);const d=u({points:[n,i],lineId:r,df:e,seqCol:a,activityCol:l,sali:c});h.root.append(d),setTimeout((()=>{s.shell.o=t.root}),500)}(e,A,V.lines.from[r],V.lines.to[r],r,t,l,V.linesDf.get(ae,r),y);const n=B.dataFrame.getSortedOrder(D.grid.sortByColumns,D.grid.sortTypes);D.grid.scrollToCell(t.name,n.indexOf(B.dataFrame.currentRowIdx))}),1e3)}})),V.linesDf.onSelectionChanged.subscribe((t=>{setTimeout((()=>(()=>{const t=a.BitSet.create(e.rowCount);for(let e=0;e<V.linesDf.rowCount;e++){const n=V.linesDf.selection.get(e);n&&(t.set(V.lines.from[e],!0),t.set(V.lines.to[e],!0)),V.lines.colors[e]=n?"255,255,0":"0,128,0"}e.selection.copyFrom(t),U.linesToRender=V.lines})()),100)})),e.onSelectionChanged.subscribe((t=>{!1===e.selection.anyTrue&&"number"==typeof t&&(S?S=!1:(e=>{e.selection.setAll(!1);for(let e=0;e<V.lines.colors.length;e++)V.lines.colors[e]="0,128,0";U.linesToRender=V.lines})(Y.dataFrame))})),U.lineClicked.subscribe((t=>{if(S=!0,U.currentLineId=t.id,-1!==t.id){const n=V.linesDf.selection.clone();setTimeout((()=>{t.event.ctrlKey?(n.set(t.id,!n.get(t.id)),V.linesDf.selection.copyFrom(n)):(V.linesDf.currentRowIdx!==t.id&&(V.linesDf.currentRowIdx=t.id,e.currentRowIdx=V.lines.from[t.id]),V.linesDf.selection.copyFrom(n));const i=V.linesDf.getSortedOrder(Y.sortByColumns,Y.sortTypes);Y.scrollToCell(ue[0],i.indexOf(t.id))}),500)}})),U.lineHover.pipe((0,O.debounceTime)(500)).subscribe((n=>{-1!==n.id&&-1===e.mouseOverRowIdx&&o.tooltip.show(g({lineId:n.id,points:[V.lines.from[n.id],V.lines.to[n.id]],df:e,seqCol:t,activityCol:l}),n.x,n.y)})),B.addProperty("similarityLimit","double",C),A=function(){const e=o.accordion(),t=o.element("i");return t.className="grok-icon svg-icon svg-view-layout",e.addTitle(o.span([t,o.label("Activity cliffs")])),e.addPane("Cliff Details",(()=>o.divText("Cliff has not been selected")),!0),s.shell.o=e.root,e}(),B}var pe,me=n(2003),fe=n(826),ge=n(3516),ye=n(6718),be=n(2738),ve=n(3077);!function(e){e.IDENTITY="identity",e.SIMILARITY="similarity"}(pe||(pe={}));var we=n(9192),Ce=n(4870),Ae=n(1991),Se=n.n(Ae),xe=n(9322);const Ee="#808080",_e="rgb(0,0,0)",Me=xe.zS;var Te,Ie;!function(e){e.maxMonomerLength=".mm.cellRenderer.maxMonomerLength"}(Te||(Te={})),function(e){e.MSA="MSA",e.classic="classic"}(Ie||(Ie={}));const Le=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=Ie.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,i,r,s,o){var a,l,c;const u=Object.assign(Object.assign({},Le),o);o.logger?.debug("Bio: printLeftOrCentered(), start"),e.textAlign="start";let h=t.substring(0),d=u.last?"":u.separator;u.drawStyle===Ie.MSA&&(d="");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=h==e?.3:u.transparencyRate),m&&u.referenceSequence.length>0&&"equal"===f&&(u.transparencyRate=h!=e?.3:u.transparencyRate)}null!=u.maxLengthOfMonomer&&(h=Me(h,u.maxLengthOfMonomer));const g=h+d;(a=u.monomerTextSizeMap)[g]??(a[g]=e.measureText(g));let y=u.monomerTextSizeMap[g];(l=u.monomerTextSizeMap)[h]??(l[h]=e.measureText(h));let b=u.monomerTextSizeMap[h].width;const v=s/2-(y.fontBoundingBoxAscent+y.fontBoundingBoxDescent)/2+1;(c=u.monomerTextSizeMap)[d]??(c[d]=e.measureText(d));const w=u.monomerTextSizeMap[d].width;function C(t,r){const s=p?u.color:_e;e.fillStyle=s,e.globalAlpha=u.transparencyRate,u.drawStyle===Ie.classic&&(e.fillText(h,n+t,i+v),e.fillStyle=Ee,e.fillText(d,n+r,i+v)),u.drawStyle===Ie.MSA&&e.fillText(h,n+t,i+v)}y=y.width,u.drawStyle===Ie.MSA&&(b=u.maxWord[u.wordIdx],y=u.maxWord[u.wordIdx]);const A=(u.maxWord[u.wordIdx]??0)-(u.maxWord[0]??0);if(u.left||y>r)return C(A,A+b),n+A+b+w;{const e=(r-y)/2;return C(e,e+b),n+A+e+b}}var Ne=n(6882),Pe=n(4152);const Oe={[me.YI.DNA]:"RNA",[me.YI.RNA]:"RNA",[me.YI.PT]:"PEPTIDE",[me.YI.UN]:"PEPTIDE"};var Re=n(6642);const ke={true:"1",false:"0"};var Ge=n(4139);const De="rgb(100,100,100)",Fe=me.zS;function He(e,t,n,i,r){return e?Math.max(Math.min(e.canvas.width/r-n,i)):Math.max(t.canvas.width/r-n,0)}function Be(e){const t=!Se().enumerate(e).some((([t,n])=>t.length>1&&0!=n&&n!=e.length-1)),n=[],i=t?"":" ";for(const[t,r]of Se().enumerate(e)){let s=t;r<e.length&&(s+=`${t?"":"-"}${i}`),n.push(s)}return[n,t]}class Ve extends a.GridCellRenderer{padding=5;get name(){return"sequence"}get cellType(){return"sequence"}get defaultHeight(){return 30}get defaultWidth(){return 230}onClick(e,t){e.cell.column.temp["current-word"]=e.cell.value,e.grid.invalidate()}onMouseMove(e,t){const[n,i,r]=(0,Re.h)(e),s=r.rendererBack;if(!s)return;const a=e.bounds,l=t.offsetX-e.gridColumn.left+(e.gridColumn.left-a.x),c=s.getPosition(e.tableRowIndex,l,a.width),u=fe.GO.forColumn(i).getSplitted(e.tableRowIndex).canonicals;if(null!==c&&c<u.length){const e=u[c],n=[];let r=s._monomerStructureMap[e];r=s._monomerStructureMap[e]=(()=>{const t=fe.GO.forColumn(i).alphabet??me.YI.UN,n=Oe[t],r=Ci();return r?r.getTooltip(n,e):o.divText("Monomer library is not available")})(),n.push(r),o.tooltip.show(o.divV(n),t.x+16,t.y+16)}else o.tooltip.hide()}render(e,t,n,i,r,s,o){const a=window.devicePixelRatio,[l,c,u]=(0,Re.h)(s);if(!c)return;const h=c.temp;let d=0,p=(di.properties?di.properties.maxMonomerLength:4)??50;if(Te.maxMonomerLength in c.tags){const e=parseInt(c.getTag(Te.maxMonomerLength));p=!isNaN(e)&&e?e:50}if(".mm.cellRenderer.maxMonomerLength"in h){const e=h[".mm.cellRenderer.maxMonomerLength"];p=!isNaN(e)&&e?e:50}const[m,f,g]=(0,Re.h)(s);let y=g.rendererBack;y||(y=g.rendererBack=new Ne.J(l,c,di.logger,p,(()=>{const e=fe.GO.forColumn(c);return{seqHandler:e,monomerCharWidth:7,separatorWidth:e.isMsa()?8:d,monomerToShort:Fe}}))),e.save();try{c.temp[".mm.cellRenderer.settingsChanged"]!==ke.true&&y.monomerLengthLimit==p||(d=h[".mm.cellRenderer.gapLength"]??d,y.setMonomerLengthLimit(p),y.setSeparatorWidth(y.isMsa()?8:d),c.temp[".mm.cellRenderer.settingsChanged"]=ke.false);const[o,u]=y.getCellMonomerLengths(s.tableRowIndex,i),m=(o.length,s.cell.value,s.cell.rowIndex),f=c.getTag(me.gp.alphabet),g=50;i=He(l?.grid,e,t,i,a),e.beginPath(),e.rect(t+this.padding,n+this.padding,i-this.padding-1,r-2*this.padding),e.clip(),e.font="12px monospace",e.textBaseline="top";const b=c.meta.units,v=c.getTag(me.gp.aligned),w=(0,me.ny)(f),C=c.getTag(me.gp.separator)??"",A=y.props.separatorWidth+1*y.props.monomerCharWidth,S=Math.ceil(i/A),x=fe.GO.forColumn(c),E=h["reference-sequence"],_=h["current-word"];_&&-1===c?.dataFrame?.currentRowIdx&&(h["current-word"]=null);const M=(()=>{const e=x.getSplitter(S);return Se()(e(null!=E&&""!=E?E:_??"").originals).toArray()})(),T=x.getSplitted(m);let I=De,L=Ie.classic;v&&v.includes("MSA")&&b==me.Hi.SEPARATOR&&(L=Ie.MSA);const $=Math.min(T.length,S);for(let o=0;o<$;++o){const a=T.getOriginal(o);I=w.get(a),e.fillStyle=De;const l={color:I,pivot:0,left:!0,transparencyRate:1,separator:C,last:o===T.length-1,drawStyle:L,maxWord:u,wordIdx:o,gridCell:s,referenceSequence:M,maxLengthOfMonomer:p,monomerTextSizeMap:y._monomerLengthMap,logger:di.logger};if($e(e,a,t+this.padding,n,i,r,l),g>i)break}}catch(e){const[t,n]=(0,we.AP)(e);y.logger.error(t,void 0,n),y.errors.push(e)}finally{e.restore()}}}class je extends a.GridCellRenderer{get name(){return"MacromoleculeDifferenceCR"}get cellType(){return Ge.uF.MACROMOLECULE_DIFFERENCE}get defaultHeight(){return 30}get defaultWidth(){return 230}render(e,t,n,i,r,s,o){const a=window.devicePixelRatio,l=s.grid,c=s.cell,u=s.tableColumn,h=c.value??"",d=u.tags[me.gp.separator],p=u.meta.units;i=He(l,e,t,i,a);const[m,f]=h.split("#"),g=(0,xe.Iv)(p,d);Ue(e,t,n,i,r,Se()(g(m).canonicals).toArray(),Se()(g(f).canonicals).toArray(),p)}}function Ue(e,t,n,i,r,s,o,a,l,c){if(s.length!==o.length){const e=function(e,t){let n=0,i=0;const r=e.length>t.length?e:t,s=e.length>t.length?t:e;for(let e=0;e<s.length;e++)r[e]===s[e]&&n++;const o=r.length-s.length;for(let e=r.length-1;e>o;e--)r[e]===s[e-o]&&i++;const a=new Array(Math.abs(e.length-t.length)).fill(fe.b9[me.Hi.FASTA]);function l(e){return n>i?e.concat(a):a.concat(e)}return e.length>t.length?t=l(Se()(t).toArray()):e=l(Se()(e).toArray()),{subParts1:e,subParts2:t}}(s,o);s=e.subParts1,o=e.subParts2}const u=e.measureText(Be(s).join("")),h=e.measureText(Be(o).join("")),d=Math.max(u.width,h.width);l&&(i=d+4*s.length,e.canvas.width=d+4*s.length);let p=Math.max(t,t+(i-(d+4*s.length))/2)+5;const m=Math.max(n,n+(r-28)/2);e.save(),e.beginPath(),e.rect(t,n,l?d+4*s.length:i,r),e.clip(),e.font="12px monospace",e.textBaseline="top";let f=Pe.oT.Color;"HELM"!==a&&(f=(0,me.ny)(a.substring(a.length-2)));for(let t=0;t<s.length;t++){const n=s[t],a=o[t],l=f.get(n);if(n!=a){const s=f.get(a),o=$e(e,n,p,m-7,i,r,{color:l,pivot:0,left:!0}),u=$e(e,a,p,m+7,i,r,{color:s,pivot:0,left:!0});p=Math.max(u,o),c&&(c[t]=We(n,a,l,s,m,7,r))}else p=$e(e,n,p,m,i,r,{color:l,pivot:0,left:!0,transparencyRate:.5});p+=4}e.restore()}function We(e,t,n,i,r,s,o){const a=document.createElement("canvas"),l=a.getContext("2d");l.font="12px monospace";const c=l.measureText(Be([e]).join("")).width,u=l.measureText(Be([t]).join("")).width,h=Math.max(c,u);return a.height=o,a.width=h+4,l.font="12px monospace",l.textBaseline="top",$e(l,e,0,r-s,h,o,{color:n,pivot:0,left:!0}),$e(l,t,0,r+s,h,o,{color:i,pivot:0,left:!0}),a}var Ye,ze=n(8070),qe=n(4326);!function(e){e.Unknown="unknown",e.FR="framework",e.CDR="cdr"}(Ye||(Ye={}));const Ke=new class{constructor(){this.regionTypes=[Ye.CDR],this.chains=["Heavy","Light"],this.skipEmptyPositions=!1,this.fitWidth=!1,this.positionWidth=16,this.positionHeight=qe.fH.Entropy,this.filterSource=qe.Fo.filterSource}};var Ze=n(7602),Xe=n(8047);const Je=Ye;var Qe,et;!function(e){e.STYLE="Style",e.BEHAVIOR="Behavior",e.LAYOUT="Layout",e.DATA="Data"}(Qe||(Qe={})),function(e){e.skipEmptyPositions="skipEmptyPositions",e.regionTypes="regionTypes",e.chains="chains",e.fitWidth="fitWidth",e.positionWidth="positionWidth",e.positionHeight="positionHeight",e.filterSource="filterSource"}(et||(et={}));const tt=Ke;class nt extends a.JsViewer{viewed=!1;regionsFg=null;regionsRoot=null;isOpened=!1;panelNode=null;regions=[];regionTypes;chains;skipEmptyPositions;fitWidth;positionWidth;positionHeight;filterSource;constructor(){super(),this.skipEmptyPositions=this.bool(et.skipEmptyPositions,tt.skipEmptyPositions,{category:Qe.DATA}),this.regionTypes=this.stringList(et.regionTypes,tt.regionTypes,{category:Qe.DATA,choices:Object.values(Je).filter((e=>e!=Je.Unknown))}),this.chains=this.stringList(et.chains,tt.chains,{category:Qe.DATA,choices:["Heavy","Light"]}),this.fitWidth=this.bool(et.fitWidth,tt.fitWidth,{category:Qe.LAYOUT}),this.positionWidth=this.float(et.positionWidth,tt.positionWidth,{category:Qe.LAYOUT,editor:"slider",min:0,max:64,description:"Internal WebLogo viewers property width of position."}),this.positionHeight=this.string(et.positionHeight,tt.positionHeight,{category:Qe.LAYOUT,choices:Object.keys(qe.fH)}),this.filterSource=this.string(et.filterSource,tt.filterSource,{category:Qe.BEHAVIOR,choices:Object.values(qe.lT)}),this.viewSyncer=new Ze.g(di.logger)}static viewerCounter=-1;viewerId=++nt.viewerCounter;viewerToLog(){return`VdRegionsViewer<${this.viewerId}>`}async init(){this.subs.push((0,u.fromEvent)(this.root,"mousemove").subscribe(this.rootOnMouseMove.bind(this)))}detach(){const e=`${this.viewerToLog()}.detach()`,t=super.detach.bind(this);this.viewSyncer.sync(`${e}`,(async()=>{this.setDataInProgress||(this.viewed&&(await this.destroyView("detach"),this.viewed=!1),t())}))}onTableAttached(){super.onTableAttached(),this.setData(this.regions)}onPropertyChanged(e){if(super.onPropertyChanged(e),e){switch(e.name){case et.regionTypes:case et.chains:this.setData(this.regions)}switch(e.name){case et.skipEmptyPositions:for(let e=0;e<this.logos.length;++e)for(const t of this.chains)this.logos[e][t].setOptions({[Xe.n5.skipEmptyPositions]:this.skipEmptyPositions});this.calcSize();break;case et.fitWidth:case et.positionWidth:this.calcSize();break;case et.positionHeight:for(let e=0;e<this.logos.length;++e)for(const t of this.chains)this.logos[e][t].setOptions({[Xe.n5.positionHeight]:this.positionHeight});this.calcSize();break;case et.filterSource:this.filterSourceInput.value=this.filterSource;break;default:this.setData(this.regions)}}else console.warn("Bio: VdRegionsViewer.onPropertyChanged() property is null")}setData(e){const t=`${this.viewerToLog()}.setData()`;di.logger.debug(`${t}, in, regions.length = ${e.length}`),this.viewSyncer.sync(`${t}`,(async()=>{if(!this.setDataInProgress){this.setDataInProgress=!0;try{this.viewed&&(await this.destroyView("setData"),this.viewed=!1),this.regions=e,this.viewed||(await this.buildView("setData"),this.viewed=!0)}finally{this.setDataInProgress=!1}}}))}viewSyncer;setDataInProgress=!1;host=null;filterSourceInput;mainLayout=null;logos=[];viewSubs=[];async destroyView(e){di.logger.debug(`Bio: VdRegionsViewer.destroyView( mainLayout = ${this.mainLayout?"value":"none"} ), purpose = '${e}', this.regions.length = ${this.regions.length}`),this.filterSourceInput&&o.empty(this.filterSourceInput.root),null!=this.mainLayout&&(this.mainLayout.remove(),this.host.remove(),this.host=null,this.mainLayout=null);for(const e of this.viewSubs)e.unsubscribe()}async buildView(e){di.logger.debug(`Bio: VdRegionsViewer.buildView() begin, purpose = '${e}', this.regions.length = ${this.regions.length}`);const t=this.regions.filter((e=>this.regionTypes.includes(e.type))),n=Array.from(new Set(t.map((e=>e.order)))).sort(),i=[];for(let e=0;e<n.length;e++)for(const r of this.chains){const s=t.find((t=>t.order==n[e]&&t.chain==r));i.push((async()=>{const t=await this.dataFrame.plot.fromType("WebLogo",{sequenceColumnName:s.sequenceColumnName,startPositionName:s.positionStartName,endPositionName:s.positionEndName,fixWidth:!0,skipEmptyPositions:this.skipEmptyPositions,positionWidth:this.positionWidth,positionHeight:this.positionHeight,filterSource:this.filterSource});return t.onSizeChanged.subscribe((()=>{this.calcSize()})),[e,r,t]})())}const r=await Promise.all(i);this.logos=new Array(n.length);for(let e=0;e<n.length;++e)this.logos[e]={};for(const[e,t,n]of r)this.logos[e][t]=n,this.viewSubs.push(n.onFreqsCalculated.subscribe((()=>{this.calcSize()})));this.mainLayout=o.table(this.chains,(e=>[...n.length>0?[o.div(e,{style:{transform:"rotate(-90deg)",font:"12px Roboto, Roboto Local, sans-serif",textAlign:"center",width:"16px",marginTop:"24px",marginLeft:"6px"}})]:[],...[...Array(n.length).keys()].map((t=>{const n=this.logos[t][e];return n.root.style.height="100%",o.div([n.root],{style:{marginTop:"4px",marginBottom:"4px"}})}))]),["",...[...Array(n.length).keys()].map((e=>t.find((t=>t.order==n[e]&&t.chain==this.chains[0])).name||"Name"))]),this.mainLayout.className="mlb-vd-regions-viewer-table2",this.filterSourceInput=o.input.choice("Data source",{value:this.filterSource,items:Object.values(qe.lT),onValueChanged:this.filterSourceInputOnValueChanged.bind(this)}),this.filterSourceInput.root.style.position="absolute",this.filterSourceInput.root.style.right="9px",this.filterSourceInput.root.style.top="-4px",Math.ceil(255*Math.random()).toString(16),this.host=o.div([this.mainLayout,this.filterSourceInput.root],{}),this.root.appendChild(this.host),this.root.style.overflowX="auto",this.calcSize(),this.viewSubs.push(o.onSizeChanged(this.root).subscribe(this.rootOnSizeChanged.bind(this))),di.logger.debug("Bio: VdRegionsViewer.buildView() end")}calcSizeRequested=!1;calcSize(){di.logger.debug("Bio: VdRegionsViewer.calcSize(), start");const e=()=>{if(!this.host)return;const e=(this.root.clientHeight-54)/this.chains.length;let t=0;for(let n=0;n<this.logos.length;n++){for(const t of this.chains)this.logos[n][t].root.style.height=`${e}px`;t+=Math.max(...this.chains.map((e=>this.logos[n][e].Length)))}if(this.fitWidth){if(this.logos.length>0&&t>0){const e=22,n=13,i=9,r=(this.root.clientWidth-e-(this.logos.length-1)*i-n)/t;for(let e=0;e<this.logos.length;e++)for(const t of this.chains){const n=this.logos[e][t];n.setOptions({[Xe.n5.positionWidth]:r-n.positionMarginValue}),n.root.style.width=r*n.Length+"px"}}this.host.style.setProperty("overflow","hidden","important")}else{for(let e=0;e<this.logos.length;e++)for(const t of this.chains)this.logos[e][t].setOptions({[Xe.n5.positionWidth]:this.positionWidth});this.host.style.removeProperty("overflow")}0===this.positionWidth?this.host.style.setProperty("overflow-x","hidden","important"):this.host.style.removeProperty("overflow-x")};this.calcSizeRequested||(this.calcSizeRequested=!0,window.setTimeout((()=>{e(),this.calcSizeRequested=!1}),0))}rootOnSizeChanged(e){this.calcSize()}rootOnMouseMove(e){}filterSourceInputOnValueChanged(){const e=`${this.viewerToLog()}.filterSourceInputOnValueChanged()`,t=this.filterSourceInput.value;this.viewSyncer.sync(`${e}`,(async()=>{if(this.filterSource!==t){this.props.getProperty(et.filterSource).set(this,t);for(let e=0;e<this.logos.length;e++)for(let t=0;t<this.chains.length;t++){const n=this.chains[t];this.logos[e][n].setOptions({[Xe.n5.filterSource]:this.filterSource})}}}))}_onRendered=new u.Subject;get onRendered(){return this._onRendered}invalidate(e){const t=`${this.viewerToLog()}.invalidate(${e?` <- ${e} `:""})`;this.viewSyncer.sync(`${t}`,(async()=>{this._onRendered.next()}))}async awaitRendered(e=5e3){await(0,ze.PE)(this.onRendered,(()=>{}),(()=>{this.invalidate()}),e);const t=this.viewSyncer.resetErrors();if(t.length>0)throw t[0]}}var it=n(6625),rt=n(6863);async function st(e,t,n="Morgan"){const i=e.length,r=fe.GO.forColumn(e),s=Array(i);let o=1;const a=new Map,l=e.categories,c=e.getRawData();for(let t=0;t<i;t++){if(null===l[c[t]]||e.isNone(t)){s[t]=null;continue}s[t]="";const n=r.getSplitted(t);for(let e=0;e<n.length;e++){const i=n.getCanonical(e);a.has(i)||(a.set(i,String.fromCharCode(o)),o++),s[t]+=a.get(i)}}let u={};if(t===rt.Z.MONOMER_CHEMICAL_DISTANCE||t===rt.Z.NEEDLEMANN_WUNSCH){const e=Array.from(a.keys()),t=await(0,ye.A7)(e,n),i={};Object.entries(t.alphabetIndexes).forEach((([e,t])=>{i[a.get(e)]=t})),u={scoringMatrix:t.scoringMatrix,alphabetIndexes:i}}return{seqList:s,options:u}}var ot=n(2780),at=n(8115);function lt(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 i=o.divText(e.activityCol.get(n).toFixed(2));i.style.display="flex",i.style.justifyContent="left",i.style.paddingLeft="30px",t.append(o.divV([o.divText(e.seqCol.get(n)),i]))})),t}function ct(e){const t=o.div();t.append(o.divText(e.seqCol.name,{style:{fontWeight:"bold"}}));const n=new Array(2);e.points.forEach(((t,i)=>{n[i]=e.activityCol.get(t)}));const i={},r=fe.GO.forColumn(e.seqCol),s=ht(r.getSplitted(e.points[0]),r.getSplitted(e.points[1]),r.units,i);return t.append(o.div(s,{style:{width:"300px",overflow:"scroll"}})),t.append(dt(i)),t.append(ut("Activity delta",Math.abs(n[0]-n[1]))),t.append(ut("Cliff",e.sali)),t}function ut(e,t){return o.divH([o.divText(`${e}: `,{style:{fontWeight:"bold",paddingRight:"5px"}}),o.divText(t.toFixed(2))],{style:{paddingTop:"10px"}})}function ht(e,t,n,i){const r=document.createElement("canvas"),s=r.getContext("2d");return r.height=30,Ue(s,0,0,0,30,Se()(e.canonicals).toArray(),Se()(t.canonicals).toArray(),n,!0,i),r}function dt(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}function pt(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(me.gp.separator,e.col(t[0]).getTag(me.gp.separator)),e.columns.add(n);const i=e.plot.grid();return i.col(t[0]).visible=!1,i.col(t[1]).visible=!1,i}class mt extends a.JsViewer{name="";distanceMetric;limit;fingerprint;metricsProperties=["distanceMetric","fingerprint"];fingerprintChoices=["Morgan","Pattern"];moleculeColumn;moleculeColumnName;initialized=!1;tags=[a.TAGS.UNITS,me.gp.aligned,me.gp.separator,me.gp.alphabet];preComputeDistanceMatrix=!1;constructor(e){super(),this.fingerprint=this.string("fingerprint",this.fingerprintChoices[0],{choices:this.fingerprintChoices}),this.limit=this.int("limit",10),this.distanceMetric=this.string("distanceMetric",R.iS[0],{choices:R.iS}),this.moleculeColumnName=this.string("moleculeColumnName"),this.name=e}init(){this.initialized=!0}detach(){this.subs.forEach((e=>e.unsubscribe()))}async onTableAttached(){if(this.init(),this.dataFrame){this.preComputeDistanceMatrix=this.dataFrame.rowCount<=22e3,this.subs.push(a.debounce(this.dataFrame.onRowsRemoved,50).subscribe((e=>this.render(!0))));const e="diversity"!==this.name;this.subs.push(a.debounce(this.dataFrame.onCurrentRowChanged,50).subscribe((t=>this.render(e)))),this.subs.push(a.debounce(this.dataFrame.selection.onChanged,50).subscribe((e=>this.render(!1)))),this.subs.push(a.debounce(o.onSizeChanged(this.root),50).subscribe((e=>this.render(!1)))),this.moleculeColumn=this.dataFrame.columns.bySemType(a.SEMTYPE.MACROMOLECULE),this.moleculeColumnName=this.moleculeColumn?.name,this.getProperty("limit").fromOptions({min:1,max:this.dataFrame.rowCount})}this.render()}onPropertyChanged(e){if(super.onPropertyChanged(e),this.initialized){if("moleculeColumnName"===e.name){const t=this.dataFrame.col(e.get(this));t.semType===a.SEMTYPE.MACROMOLECULE&&(this.moleculeColumn=t)}this.render()}}computeRequested;renderPromise=Promise.resolve();render(e=!0){this.renderPromise=this.renderPromise.then((async()=>{this.computeRequested=this.computeRequested||e,await this.renderInt(e)}))}async renderInt(e){}beforeRender(){return!(!this.initialized||this.dataFrame&&this.moleculeColumnName&&this.dataFrame.col(this.moleculeColumnName).semType!==a.SEMTYPE.MACROMOLECULE&&(s.shell.error(`${this.moleculeColumnName} is not Macromolecule type`),1))}}var ft=n(1407),gt=n(439);const yt={gapPenalty:1,matchScore:1,gapSymbol:fe.b9[gt.Hi.FASTA],localAlignment:!1};class bt extends mt{cutoff;hotSearch;similarColumnLabel;sketchedMolecule="";curIdx=0;molCol=null;idxs=null;scores=null;gridSelect=!1;targetMoleculeIdx=0;computeCompleted=new u.Subject;distanceMatrixComputed=!1;mmDistanceMatrix;knn;kPrevNeighbors=0;demo;constructor(e){super("similarity"),this.cutoff=this.float("cutoff",.01,{min:0,max:1}),this.hotSearch=this.bool("hotSearch",!0),this.similarColumnLabel=this.string("similarColumnLabel",null),this.demo=e}init(){this.hotSearch=!0,this.initialized=!0}async renderInt(e){if(this.beforeRender()&&this.moleculeColumn&&(this.curIdx=-1==this.dataFrame.currentRowIdx?0:this.dataFrame.currentRowIdx,e&&!this.gridSelect)){this.targetMoleculeIdx=-1==this.dataFrame.currentRowIdx?0:this.dataFrame.currentRowIdx;const e=fe.GO.forColumn(this.moleculeColumn);await(e.isHelm()?this.computeByChem():this.computeByMM());const t=null!=this.similarColumnLabel?this.similarColumnLabel:`similar (${this.moleculeColumnName})`;this.molCol=a.Column.string(t,this.idxs.length).init((e=>this.moleculeColumn?.get(this.idxs?.get(e)))),this.molCol.semType=a.SEMTYPE.MACROMOLECULE,this.tags.forEach((e=>this.molCol.setTag(e,this.moleculeColumn.getTag(e))));const n=a.DataFrame.fromColumns([this.idxs,this.molCol,this.scores]);n.onCurrentRowChanged.subscribe((e=>{this.dataFrame.currentRowIdx=n.col("indexes").get(n.currentRowIdx),setTimeout((()=>{this.createPropertyPanel(n)}),1e3),this.gridSelect=!0}));const i=n.plot.grid();i.col("indexes").visible=!1;const r=this.idxs?.getRawData().findIndex((e=>e==this.targetMoleculeIdx));i.cell("score",r).cell.value=null,(this.demo?s.shell.view("Browse").preview:s.shell.v).grid.root.addEventListener("click",(e=>{this.gridSelect=!1})),(0,Ce.K)(this.root,i.root),this.computeCompleted.next(!0)}}async computeByChem(){const e=await(0,ft.R)(this.moleculeColumn),t=(a.DataFrame.fromColumns([e]),await s.functions.call("Chem:callChemSimilaritySearch",{df:this.dataFrame,col:e,molecule:e.get(this.targetMoleculeIdx),metricName:this.distanceMetric,limit:this.limit,minScore:this.cutoff,fingerprint:this.fingerprint}));this.idxs=t.getCol("indexes"),this.scores=t.getCol("score")}async computeByMM(){const e=this.moleculeColumn.length,t=Math.min(this.limit,e-1);if(!this.knn||this.kPrevNeighbors!==t){const n=(await st(this.moleculeColumn,rt.Z.LEVENSHTEIN)).seqList;this.kPrevNeighbors=t,this.knn=await(new F).getKNN(n,rt.Z.LEVENSHTEIN,Math.min(this.limit,e-1))}const n=new Array(t).fill(0).map(((e,t)=>({idx:this.knn.knnIndexes[this.targetMoleculeIdx][t],score:1-this.knn.knnDistances[this.targetMoleculeIdx][t]})));n.sort(((e,t)=>t.score-e.score)),n.unshift({idx:this.targetMoleculeIdx,score:a.FLOAT_NULL}),this.idxs=a.Column.int("indexes",t+1).init((e=>n[e].idx)),this.scores=a.Column.float("score",t+1).init((e=>n[e].score))}createPropertyPanel(e){const t=o.div(),n={},i=this.molCol?.name,r=e.col(i),a=fe.GO.forColumn(this.moleculeColumn),l=fe.GO.forColumn(r),c=a.getSplitted(this.targetMoleculeIdx),u=l.getSplitted(e.currentRowIdx),h=function(e,t,n={}){const i={...yt,...n},r=e.length,s=t.length,o=Array(r+1).fill(0).map((()=>Array(s+1).fill(0)));let a=-9999,l=[1,1];for(let n=1;n<r+1;n++)for(let r=1;r<s+1;r++)o[n][r]=Math.max(0,o[n-1][r-1]+(e.getCanonical(n-1)===t.getCanonical(r-1)?i.matchScore:-i.matchScore),o[n-1][r]-i.gapPenalty,o[n][r-1]-i.gapPenalty),o[n][r]>=a&&(a=o[n][r],l=[n,r]);let c=i.localAlignment?l[0]:r,u=i.localAlignment?l[1]:s,h=new Array(0),d=new Array(0);for(;c>0&&u>0;){const n=Math.max(o[c-1][u-1],o[c-1][u],o[c][u-1]);o[c][u]==o[c-1][u-1]+i.matchScore&&n==o[c-1][u-1]?(h.push(e.getCanonical(c-1)),d.push(t.getCanonical(u-1)),c-=1,u-=1):o[c][u]==o[c-1][u]-i.gapPenalty?(d.push(i.gapSymbol),h.push(e.getCanonical(c-1)),c-=1):o[c][u]==o[c][u-1]-i.gapPenalty?(h.push(i.gapSymbol),d.push(t.getCanonical(u-1)),u-=1):(h.push(e.getCanonical(c-1)),d.push(t.getCanonical(u-1)),c-=1,u-=1)}h=[...Array.from(e.canonicals).splice(0,c),...h.reverse(),...i.localAlignment?Array.from(e.canonicals).splice(l[0],r):[]],d=[...Array.from(t.canonicals).splice(0,u),...d.reverse(),...i.localAlignment?Array.from(t.canonicals).splice(l[1],s):[]];const p=c,m=u;return p>m?d=[...new Array(p-m).fill(i.gapSymbol.valueOf()),...d]:h=[...new Array(m-p).fill(i.gapSymbol.valueOf()),...h],d.length>h.length?h.push(...new Array(d.length-h.length).fill(i.gapSymbol.valueOf())):d.push(...new Array(h.length-d.length).fill(i.gapSymbol.valueOf())),{seq1:h.join(""),seq2:d.join(""),seq1Splitted:new xe.Mu(h,i.gapSymbol),seq2Splitted:new xe.Mu(d,i.gapSymbol)}}(c,u),d=ht(h.seq1Splitted,h.seq2Splitted,l.units,n);t.append(o.div(d,{style:{width:"300px",overflow:"scroll"}})),c.length!==u.length&&t.append(o.divV([o.divText("Different sequence length:",{style:{fontWeight:"bold"}}),o.divText(`target: ${c.length} monomers`),o.divText(`selected: ${u.length} monomers`)],{style:{paddingBottom:"10px"}})),t.append(dt(n));const p=o.accordion(),m=o.element("i");m.className="grok-icon svg-icon svg-view-layout",p.addTitle(o.span([m,o.label("Similarity search")])),p.addPane("Differences",(()=>t),!0),s.shell.o=p.root}}class vt extends mt{diverseColumnLabel;renderMolIds=null;columnNames=[];computeCompleted=new u.Subject;constructor(){super("diversity"),this.diverseColumnLabel=this.string("diverseColumnLabel",null)}async renderInt(e){if(this.beforeRender()&&this.dataFrame&&e&&this.moleculeColumn){const e=fe.GO.forColumn(this.moleculeColumn);await(e.isFasta()?this.computeByMM():this.computeByChem());const t=null!=this.diverseColumnLabel?this.diverseColumnLabel:`diverse (${this.moleculeColumnName})`,n=a.Column.string(t,this.renderMolIds.length).init((e=>this.moleculeColumn?.get(this.renderMolIds[e])));n.semType=a.SEMTYPE.MACROMOLECULE,this.tags.forEach((e=>n.setTag(e,this.moleculeColumn.getTag(e))));const i=a.DataFrame.fromColumns([n]);i.onCurrentRowChanged.subscribe((e=>{this.dataFrame.currentRowIdx=this.renderMolIds[i.currentRowIdx]})),(0,Ce.K)(this.root,i.plot.grid().root),this.computeCompleted.next(!0)}}async computeByChem(){const e=await(0,ft.R)(this.moleculeColumn);a.DataFrame.fromColumns([e]),this.renderMolIds=await s.functions.call("Chem:callChemDiversitySearch",{col:e,metricName:this.distanceMetric,limit:this.limit,fingerprint:this.fingerprint})}async computeByMM(){const e=(await st(this.moleculeColumn,rt.Z.LEVENSHTEIN)).seqList,t=new D(!0,!1),n=await t.calc(e,rt.Z.LEVENSHTEIN);t.terminate();const i=this.moleculeColumn.length,r=(s=i,(e,t)=>s*e+t-Math.floor((e+2)*(e+1)/2));var s;this.renderMolIds=function(e,t,n){function i(e,t){let n=null,i=null;for(const r of e){const e=t(r);(null==i||e>i)&&(n=r,i=e)}return n}const r=[(o=e-1,Math.floor(function(e){return Math.random()*e}(o)))],s=new Set;var o;for(let t=0;t<e;++t)r.includes(t)||s.add(t);for(;r.length<t;){const e=i(s.values(),(e=>Math.min.apply(Math,r.map((function(t,i){return n(e,t)})))));null!=e&&(r.push(e),s.delete(e))}return r}(i,Math.min(i,this.limit),((e,t)=>this.moleculeColumn.isNone(e)||this.moleculeColumn.isNone(t)?0:n[r(e,t)]))}}var wt,Ct,At=n(5433),St=n(3890),xt=n(1687),Et=n(4356);!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"}(wt||(wt={}));class _t{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 i=this.isWhitespace(n)?t:t-1;for(let e=0;e<i;e++)n=this.getNextColumnIdx(n);return n}parseAtomTypes(){const e=this.atomCount,t=new Array(e);let n=this.getAtomBlockIdx();for(let i=0;i<e;i++)n=this.shiftIdxToAtomType(n),t[i]=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 i=this.getAtomBlockIdx();for(let r=0;r<this.atomCount;r++){i=this.shiftIdxToXColumn(i);for(const s of[e,t,n])s[r]=this.parseFloatValue(i),i=this.getNextColumnIdx(i);i=this.getNextLineIdx(i)}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 i=new Uint16Array(2);i[0]=this.parseIntValue(t),t=this.getNextColumnIdx(t),i[1]=this.parseIntValue(t),e[n]=i,t=this.getNextLineIdx(t)}return e}parseBondTypes(){const e=this.bondCount,t=new Uint16Array(e);let n=this.getBondBlockIdx();for(let i=0;i<e;i++)n=this.shiftIdxToBondType(n),t[i]=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 Mt extends _t{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 i=0;i<t;i++){if(n=this.shiftIdxToAtomType(n),e(this.fileContent.charCodeAt(n),n))return!0;n=this.getNextLineIdx(n)}return!1}}class Tt extends Mt{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(wt.RGP_LINE_START))).forEach((t=>{const n=this.getAtomIdxToRgpIdxList(t);for(const[t,i]of n){if(e.has(t))throw new Error(`R group ${t} is already in the map`);e.set(t,i)}}));const n=t.map(((e,t)=>{if(e.startsWith(wt.ATOM_ALIAS_LINE_START))return t})).filter((e=>void 0!==e)),i=n.map((e=>t[e])),r=n.map((e=>t[e+1]));i.forEach(((t,n)=>{const i=parseInt(t.split(/\s+/)[1])-1,s=parseInt(r[n].substring(1));if(e.has(s))throw new Error(`R group ${s} is already in the map`);e.set(s,i)}));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(wt.TYPE)&&-1!==e.indexOf(wt.END)}shiftIdxToAtomType(e){return this.shiftIdxToSpecifiedColumn(e,wt.ATOM_TYPE_COL)}getCountsLineIdx(){let e=0;for(let t=0;t<wt.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,wt.FIRST_BONDED_ATOM_COL)}shiftIdxToBondType(e){return this.shiftIdxToSpecifiedColumn(e,wt.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+wt.NUM_OF_COUNTS_DIGITS;const n=parseInt(this.fileContent.substring(e,t));return e=t,t+=wt.NUM_OF_COUNTS_DIGITS,{atomCount:n,bondCount:parseInt(this.fileContent.substring(e,t))}}}class It extends Mt{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 i=t.match(/RGROUPS=\(([\d\s]+)\)/);if(i){const t=i[1].split(/\s+/).map((e=>parseInt(e)));if(t.length>2)throw new Error(`R group data ${t} has more than 2 elements`);const r=t[1];if(e.has(r))throw new Error(`R group ${r} is already in the map`);e.set(r,n)}})),e}shiftIdxToAtomType(e){return this.shiftIdxToSpecifiedColumn(e,4)}getCountsLineIdx(){return this.fileContent.indexOf("M V30 COUNTS ")}getAtomBlockIdx(){let e=this.fileContent.indexOf("M V30 BEGIN ATOM");return e=this.getNextLineIdx(e),e}shiftIdxToXColumn(e){let t=this.shiftIdxToAtomType(e);return this.isQuote(t)?(t=this.getNextIdenticalChar(t),t=this.getNextColumnIdx(t),t):this.shiftIdxToSpecifiedColumn(e,5)}shiftIdxToBondedAtomsPair(e){return this.shiftIdxToSpecifiedColumn(e,5)}shiftIdxToBondType(e){return this.shiftIdxToSpecifiedColumn(e,4)}getBondBlockIdx(){return this.getNextLineIdx(this.fileContent.indexOf("M V30 BEGIN BOND"))}static isValidMolfile(e){return-1!==e.indexOf("V3000")&&-1!==e.indexOf("M END")}parseAtomAndBondCounts(){let e=this.fileContent.indexOf("M V30 COUNTS ")+14,t=this.fileContent.indexOf(" ",e+1);const n=parseInt(this.fileContent.substring(e,t));return e=t+1,t=this.fileContent.indexOf(" ",e+1),{atomCount:n,bondCount:parseInt(this.fileContent.substring(e,t))}}}class Lt{constructor(){}static getInstance(e){if(Lt.isMolfileV2K(e))return new Tt(e);if(Lt.isMolfileV3K(e))return new It(e);throw new Error("Malformed molfile")}static isMolfileV2K(e){return Tt.isValidMolfile(e)}static isMolfileV3K(e){return It.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"}(Ct||(Ct={}));class $t{constructor(e){this.monomerLib=e}getCappedRotatedMonomer(e,t){const n=this.monomerLib.getMonomer(e,t);return n?n.molfile:null}}var Nt=n(5488),Pt={};Pt.styleTagTransform=A(),Pt.setAttributes=b(),Pt.insert=g().bind(null,"head"),Pt.domAPI=m(),Pt.insertStyleElement=w(),d()(Nt.A,Pt),Nt.A&&Nt.A.locals&&Nt.A.locals;class Ot{source;error;_monomers={};_onChanged=new u.Subject;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}addMissingMonomer(e,t){let n=this._monomers[e];n||(n=this._monomers[e]={});let i=t;return t===fe.b9[me.Hi.HELM]?i="Gap":("PEPTIDE"===e&&"X"===t||"RNA"===e&&"N"===t)&&(i="Any"),n[t]={symbol:t,name:i,molfile:"",author:"MISSING",id:-1,rgroups:Se().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 i=null;if(e){const t=this._monomers[e];i=t?t[n]:null}else{di.logger.warning(`Bio: MonomerLib.getMonomer() symbol '${t}', polymerType not specified.`);for(const[e,t]of Object.entries(this._monomers))if(i=t[n],i)break}return i}_monomerSets=null;getMonomerSet(e){const t=function(e){let t;switch(e){case Ct.BASE:case Ct.SUGAR:case Ct.LINKER:case Ct.NUCLEOTIDE:case"nucleotide":t="RNA";break;case Ct.AA:t="PEPTIDE";break;case Ct.CHEM:t="CHEM";break;case Ct.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 i=this.getMonomerSymbolsByType(t).map((e=>this.getMonomer(t,e)));return i=i.filter((e=>null!==e)),0===i.length?[]:(i=i.filter((t=>{if(!t?.rgroups)return!1;let n=t?.rgroups.length>=e;return Lt.getInstance(t.molfile).atomTypes.map(((e,t)=>"R#"===e?t:-1)).filter((e=>-1!==e)),n&&=!0,n})),i.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]=e.getMonomer(t,n)}))}))}update(e){this._updateLibInt(e),this._onChanged.next()}updateLibs(e,t=!1){t&&(this._monomers={});for(const t of e)t.error||this._updateLibInt(t);this._onChanged.next()}clear(){this._monomers={},this._onChanged.next()}getSummaryObj(){const e={},t=this.getPolymerTypes();for(const n of t)e[n]=this.getMonomerSymbolsByType(n).length;return e}getSummaryDf(){const e=this.getPolymerTypes(),t=new Array(e.length);for(const[n,i]of Se().enumerate(e))t[i]=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"}),i=this.getMonomer(e,t);if(i){const e=i.symbol;i.name,n.append(o.divH([o.div([e],{style:{fontWeight:"bolder",textWrap:"nowrap",marginRight:"6px"}}),o.div([i.name])],{style:{display:"flex",flexDirection:"row",justifyContent:"left"}}));const t={autoCrop:!0,autoCropMargin:0,suppressChiralText:!0};let r;r=i.molfile?s.chem.svgMol(i.molfile,void 0,void 0,t):i.smiles?o.divV([s.chem.svgMol(i.smiles,void 0,void 0,t),o.divText("from smiles",{style:{fontSize:"smaller"}})]):o.divText("No structure",{style:{margin:"6px"}}),n.append(o.div(r,{style:{display:"flex",flexDirection:"row",justifyContent:"center",margin:"6px"}})),n.append(o.divText(i.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 Rt{monomerLib;symbol;polymerType;monomerType;monomerLinks;monomers;error=null;constructor(e,t,n,i,r){this.monomerLib=e,this.symbol=t,this.polymerType=n,this.monomerType=i,this.monomerLinks=r;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,we.AP)(e);this.error=t,this.monomers=[]}}}class kt{description;placeholders;source;error;constructor(e,t,n=void 0,i=void 0){this.description=e,this.placeholders=t,this.source=n,this.error=i}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 Gt=n(7433),Dt=n.n(Gt),Ft=n(1913),Ht=n.n(Ft);class Bt{helmMonomerSchema;validateMonomerSchema;constructor(e){this.helmMonomerSchema=e;const t=new(Dt())({allErrors:!0,strictTuples:!1,allowUnionTypes:!0});Ht()(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;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}}return n}}class Vt{fileValidator;libHelper;eventManager;logger;filesPromise=Promise.resolve();constructor(e,t,n,i){this.fileValidator=e,this.libHelper=t,this.eventManager=n,this.logger=i,this.eventManager.updateValidLibraryFileListRequested$.subscribe((()=>{this.updateValidLibList().then((()=>{}))})),this.eventManager.updateValidSetFileListRequested$.subscribe((()=>{this.updateValidSetList().then((()=>{}))}))}static objCounter=-1;objId=++Vt.objCounter;toLog(){return`MonomerLibFileManager<${this.objId}>`}static async create(e,t,n){const i=await s.dapi.files.readAsText("System:AppData/Bio/tests/libraries/HELMmonomerSchema.json"),r=JSON.parse(i),o=new Bt(r);return new Vt(o,e,t,n)}async addLibraryFile(e,t){try{if(await s.dapi.files.exists(Et.so+`${t}`))return void s.shell.error(`File ${t} already exists`);await this.validateAgainstHELM(e,t),await s.dapi.files.writeAsText(Et.so+`${t}`,e),await this.updateValidLibList(),await s.dapi.files.exists(Et.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(Et.so+`${e}`),await this.updateValidLibList(),s.shell.info(`Deleted ${e} library`)}catch(t){console.error(t),await s.dapi.files.exists(Et.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 i=new a.FileSource(e),r=await i.readAsText(t);n=JSON.parse(r);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 Ot(s,t)}async loadSetFromFile(e,t,n){let i={};const r=new a.FileSource(t),s=await r.readAsText(n);i=JSON.parse(s);const o=i.description,l=Object.entries(i.placeholders).map((([t,n])=>{const i=t,r=n.polymerType,s=n.monomerType,o=n.set;return new Rt(e,i,r,s,o)}));return new kt(o,l)}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(Et.so+`${e}`);this.isValidHELMLibrary(n,e)||t.push(e)}const i=n.filter((e=>!t.includes(e)));if(this.libListHasChanged(i)&&(this.eventManager.changeValidLibPathList(i),this.libHelper.loadMonomerLib(!0)),i.some((e=>!e.endsWith(".json")))&&this.logger.warning(`Wrong validation: ${i}`),t.length>0){const e=`Invalid monomer library files in ${Et.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 di.logger.debug(`${e}, start`),this.filesPromise=this.filesPromise.then((async()=>{di.logger.debug(`${e}, IN`);const t=[],n=await this.getSetFileListAtLocation();if(!this.setListHasChanged(n))return void di.logger.debug(`${e}, end, not changed`);for(const e of n)e.endsWith(".json")?await s.dapi.files.readAsText(Et.Es+`${e}`):t.push(e);const i=n.filter((e=>!t.includes(e)));this.setListHasChanged(i)&&(this.eventManager.changeValidSetPathList(i),this.libHelper.loadMonomerSets(!0)),di.logger.debug(`${e}, OUT`)})),di.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(Et.so).then((e=>e.map((e=>e.fullPath)))),n=[];return n.push(...t),n.map((e=>e.substring(Et.so.length)))}async getSetFileListAtLocation(){const e=`${this.toLog()}.getSetFileListAtLocation()`;this.logger.debug(`${e}, start`);const t=await s.dapi.files.list(Et.Es).then((e=>e.map((e=>e.fullPath)))),n=[];return n.push(...t),n.map((e=>e.substring(Et.Es.length)))}}class jt{constructor(){}static _instance;static getInstance(){return jt._instance||(jt._instance=new jt),jt._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,O.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 Ut{logger;_monomerLib=new Ot({},"MAIN");_monomerSets=new kt("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,ze.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(++Ut.objCounter>0)throw new Error("MonomerLibManager MUST be a singleton.");return Ut.objCounter})();toLog(){return`MonomerLibManager<${this.objId}>`}getMonomerLib(){return this._monomerLib}getBioLib(){return this.getMonomerLib()}getMonomerSets(){return this._monomerSets}_fileManagerPromise;async getFileManager(){return void 0===this._fileManagerPromise&&(this._fileManagerPromise=(async()=>await Vt.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],i]=await Promise.all([await this.getFileManager().then((e=>[e.getValidLibraryPaths()])),(0,Et.ub)()]),r=t.filter((e=>{const t=!i.exclude.includes(e),n=0===i.explicit.length||i.explicit.includes(e);return t&&n}));let s=0;const o=r.length,[a]=await Promise.all([Promise.all(r.map((e=>this.readLibrary(Et.so,e).catch((t=>{const n=`Loading monomers from '${e}' error: ${t instanceof Error?t.message:t.toString()}`;return new Ot({},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 i=0;const r=n.length,[s]=await Promise.all([Promise.all(n.map((t=>this.readSet(Et.Es,t).catch((e=>{const n=`Loading monomer sets from '${t}' error: ${e instanceof Error?e.message:e.toString()}`;return new kt("Broken monomer set",[],t,n)})).finally((()=>{e.update(Math.round(100*++i/r),`Loading monomers ${i}/${r}`)})))))]);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,Et.ub)();n.exclude=(await this.getFileManager()).getValidLibraryPaths().filter((t=>!e.includes(t))),await(0,Et.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 void 0===e&&(e=window.$monomerLibHelperPromise=(async()=>{const e=new Ut(di.logger);return e._eventManager=jt.getInstance(),e})()),e}}var Wt=n(1757),Yt=n.n(Wt),zt=n(3017),qt={};async function Kt(){await Jt.showDialog()}qt.styleTagTransform=A(),qt.setAttributes=b(),qt.insert=g().bind(null,"head"),qt.domAPI=m(),qt.insertStyleElement=w(),d()(zt.A,qt),zt.A&&zt.A.locals&&zt.A.locals;class Zt{_fileManager;_widget;get widget(){return this._widget}constructor(){}static instancePromise;static async getInstance(){return void 0===Zt.instancePromise&&(Zt.instancePromise=(async()=>{const e=new Zt,t=await(0,ye.pj)();return e._fileManager=await t.getFileManager(),e._widget=await e.createWidget(),e})()),Zt.instancePromise}async createWidget(){const e=await this.getWidgetContent();return(await(0,ye.pj)()).eventManager.addLibraryFileRequested$.subscribe((async()=>await this.promptToAddLibraryFiles())),new a.Widget(e)}async getWidgetContent(){const e=await Xt.createControlsForm();return Yt()(e).addClass("monomer-lib-controls-form"),o.divV([e])}async promptToAddLibraryFiles(){a.Utils.openFile({accept:".json",open:async e=>{const t=await e.text(),n=e.name,i=a.TaskBarProgressIndicator.create(`Adding ${n} as a monomer library`);try{await this._fileManager.addLibraryFile(t,n)}catch(e){s.shell.error(`File ${n} is not a valid monomer library, verify it is aligned to HELM JSON schema.`)}finally{i.close()}}})}}class Xt{fileManager;userLibSettings;constructor(e,t){this.fileManager=e,this.userLibSettings=t,this.fileManager.eventManager.updateUIControlsRequested$.subscribe((()=>{this.updateControlsForm()})),this.fileManager.eventManager.librarySelectionRequested$.subscribe((async([e,t])=>{await this.updateLibrarySelectionStatus(t,e)}))}toLog(){return"LibraryControlsManager<#>"}static async createControlsForm(){di.logger.debug("LibraryControlsForm.createControlsForm(), start");const[e,t]=await Promise.all([(0,ye.pj)().then((e=>e.getFileManager())),await(0,Et.ub)()]);return new Xt(e,t)._createControlsForm()}_createControlsForm(){const e=this.createLibraryControls(),t=o.form(e);return Yt()(t).addClass("monomer-lib-controls-form"),t}updateControlsForm(){const e=this._createControlsForm();Yt()(".monomer-lib-controls-form").replaceWith(e)}createLibraryControls(){return this.fileManager.getValidLibraryPaths().map((e=>this.createLibInput(e)))}createLibInput(e){const t=`${this.toLog()}.createLibInput()`;di.logger.debug(`${t}, libFileName = '${e}', start`);const n=!this.userLibSettings.exclude.includes(e),i=o.input.bool(e,{value:n,onValueChanged:t=>{this.fileManager.eventManager.updateLibrarySelectionStatus(e,t.value)}});o.tooltip.bind(i.root,`Include monomers from ${e}`);const r=o.iconFA("trash-alt",(()=>this.promptForLibraryDeletion(e)));return o.tooltip.bind(r,`Delete ${e}`),i.addOptions(r),di.logger.debug(`${t}, libFileName = '${e}', end`),i}async updateLibrarySelectionStatus(e,t){this.updateLibrarySettings(e,t),await(0,Et.Eu)(this.userLibSettings);const n=await(0,ye.pj)();await n.loadMonomerLib(!0),s.shell.info("Monomer library user settings saved")}updateLibrarySettings(e,t){e?this.userLibSettings.exclude=this.userLibSettings.exclude.filter((e=>e!==t)):this.userLibSettings.exclude.includes(t)||this.userLibSettings.exclude.push(t)}promptForLibraryDeletion(e){o.dialog("Warning").add(o.divText(`Delete file ${e}?`)).onOK((async()=>{try{const t=a.TaskBarProgressIndicator.create(`Deleting ${e} library`);await this.updateLibrarySelectionStatus(!1,e),await this.fileManager.deleteLibraryFile(e),t.close()}catch(t){console.error(t),s.shell.error(`Failed to delete ${e} library`)}})).showModal(!1)}}class Jt{constructor(){}static _instance;dialog;closeDialogSubject$=new u.Subject;static async showDialog(){Jt._instance||(Jt._instance=new Jt,Jt._instance.closeDialogSubject$.subscribe((()=>{Jt._instance.dialog=void 0}))),Jt._instance.dialog||(Jt._instance.dialog=await Jt._instance.getDialog()),Jt._instance.dialog.show()}async getDialog(){const e=jt.getInstance(),t=(await Zt.getInstance()).widget,n=o.dialog({title:"Manage monomer libraries",helpUrl:"/help/datagrok/solutions/domains/bio/bio.md#manage-monomer-libraries"});return Yt()(n.root).css("width","350px"),n.clear(),n.addButton("Add",(()=>e.addLibraryFile()),void 0,"Upload new HELM monomer library"),n.add(t),n.onClose.subscribe((()=>this.closeDialogSubject$.next())),n}}var Qt,en=function(e,t,n,i){return new(n||(n=Promise))((function(r,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};class tn{constructor(e,t,n=!1,i){var r;this.name="",this.description="",this._isAutomatic=!1,this._autoStartFirstStep=!1,this._currentStep=0,this._isStopped=!1,this._isCancelled=!1,this._isStepProcessed=!1,this._root=o.div([],{id:"demo-script",classes:"tutorials-root tutorials-track demo-app-script"}),this._steps=[],this._mainHeader=o.panel([],"tutorials-main-header"),this._header=o.h2(""),this._headerDiv=o.divH([],"tutorials-root-header"),this._stopStartBtn=o.button(o.iconFA("pause"),(()=>this._changeStopState()),"Play / pause"),this._restartBtn=o.button(o.iconFA("redo"),(()=>this._restartScript()),"Restart"),this._nextStepBtn=o.button(o.iconFA("play"),(()=>{this._isStepProcessed||this._nextStep()}),"Next step"),this._activity=o.panel([],"tutorials-root-description"),this._progressDiv=o.divV([],"tutorials-root-progress"),this._progress=o.element("progress"),this._progressSteps=o.divText(""),this._closeBtn=o.button(o.iconFA("chevron-left"),(()=>this._closeDock()),"Back to demo"),this.name=e,this.description=t,this._isAutomatic=n,this._autoStartFirstStep=null!==(r=null==i?void 0:i.autoStartFirstStep)&&void 0!==r&&r,this._progress.max=0,this._progress.value=1,tn.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 i=o.div(this._steps[t].name,"grok-tutorial-entry-instruction"),r=o.div(null===(e=this._steps[t].options)||void 0===e?void 0:e.description,"grok-tutorial-step-description hidden"),s=o.divH([n,i],"grok-tutorial-entry");this._activity.append(s,r)}}_initRoot(){var e,t,n;s.shell.windows.showContextPanel=!0,s.shell.windows.showHelp=!1;const i=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,i,""),(null===(t=null===(e=i.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=i.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 en(this,void 0,void 0,(function*(){this._isStepProcessed=!0,this._isAutomatic||(this._nextStepBtn.classList.add("disabled"),this._nextStepBtn.firstChild.classList.add("fa-disabled"));const n=this._activity.getElementsByClassName("grok-tutorial-entry")[this._currentStep],i=this._activity.getElementsByClassName("grok-icon")[this._currentStep],r=this._activity.getElementsByClassName("grok-tutorial-step-description")[this._currentStep];i.className="grok-icon far fa-spinner-third fa-spin",r.classList.remove("hidden"),r.classList.add("visible");const l=n,c=(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,l.offsetTop-this._mainHeader.offsetHeight),this._isAutomatic&&(yield this._countdown(n,i,c),yield(0,ze.cb)(c));const u=o.iconFA("check");if(i.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 en(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 en(this,void 0,void 0,(function*(){const i=o.div([],"demo-script-countdown");t.classList.add("hidden");let r=n/1e3;const s=this._createSVGIndicator(r);i.append(s),e.prepend(i);const a=setInterval((()=>{r--,0===r&&(clearInterval(a),i.remove(),t.classList.remove("hidden"),t.classList.add("visible"))}),1e3)}))}_createSVGIndicator(e){const t=document.createElementNS("http://www.w3.org/2000/svg","svg"),n=document.createElementNS("http://www.w3.org/2000/svg","circle");return n.setAttributeNS(null,"cx","7"),n.setAttributeNS(null,"cy","7"),n.setAttributeNS(null,"r","6"),n.setAttributeNS(null,"style",`animation: countdown ${e}s linear infinite forwards`),t.append(n),t}_changeStopState(){const e=this._stopStartBtn.getElementsByClassName("grok-icon");e[0].className="grok-icon fas fa-play",this._isStopped=!this._isStopped,this._isStopped||(e[0].className="grok-icon fal fa-pause",this._isStepProcessed||this._startScript())}_restartScript(){s.shell.dockManager.close(this._node),s.shell.closeAll(),this._clearRoot(),this._setInitParams(),this.start()}_clearRoot(){this._root=o.div([],{id:"demo-script",classes:"tutorials-root tutorials-track demo-app-script"}),this._mainHeader=o.panel([],"tutorials-main-header"),this._header=o.h2(""),this._headerDiv=o.divH([],"tutorials-root-header"),this._activity=o.panel([],"tutorials-root-description"),this._progressDiv=o.divV([],"tutorials-root-progress"),this._progress=o.element("progress"),this._progressSteps=o.divText(""),this._progress.max=0,this._progress.value=1}_setInitParams(){this._currentStep=0,this._isStopped=!1,this._isCancelled=!1,this._stopStartBtn.getElementsByClassName("grok-icon")[0].className="grok-icon fal fa-pause",this._nextStepBtn.classList.remove("disabled")}_closeDock(){s.shell.dockManager.close(this._node),this.cancelScript()}cancelScript(){this._isCancelled=!0,tn.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 en(this,void 0,void 0,(function*(){this._initRoot(),s.shell.newView(this.name),this._isAutomatic?this._startScript():this._autoStartFirstStep&&(yield this._nextStep())}))}}function nn(e){const t=e instanceof Error?e.message:e.toString(),n=e instanceof Error?e.stack:void 0;s.shell.error(t),di.logger.error(e.message,void 0,n)}tn.currentObject=null,function(e){e.X="Embed_X",e.Y="Embed_Y"}(Qt||(Qt={}));const rn="samples/FASTA_PT_activity.csv";async function sn(){const e="Dendrogram",t=a.Func.find({package:e,name:"getTreeHelper"});if(0===t.length)throw new Error(`Package "${e}" must be installed for TreeHelper.`);return(await t[0].prepare().call()).getOutputParamValue()}async function on(){return await s.functions.call("Dendrogram:getDendrogramService",{})}var an=function(e,t,n,i){return new(n||(n=Promise))((function(r,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};function ln(e,t,i){return an(this,void 0,void 0,(function*(){return new Promise((function(r,s){const o=new Worker(new URL(n.p+n.u(705),n.b));o.postMessage({distMatArray:e,n:t,methodCode:i}),o.onmessage=({data:{error:e,clusterMatrix:t}})=>{o.terminate(),e?s(e):r(t)}}))}))}var cn,un,hn,dn=function(e,t,n,i){return new(n||(n=Promise))((function(r,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};n(5540),function(e){e.ADD="ADD",e.SUB="SUB",e.MULT="MULT"}(cn||(cn={})),function(e){e.SQUARE="SQUARE",e.INVERSE="INVERSE",e.TRANSPOSE="TRANSPOSE",e.NORM="NORM",e.COLUMN_NORM="COLUMN_NORM"}(un||(un={})),function(e){e.SCALARMULT="SCALARMULT",e.SCALARADD="SCALARADD",e.SCALARPOW="SCALARPOW"}(hn||(hn={}));const pn="samples/FASTA_PT_activity.csv",mn="sequence";const fn="samples/FASTA_PT_activity.csv";var gn=n(8152);const yn="samples/HELM.csv";var bn=n(966),vn=n(608),wn=n(1619);class Cn{urlParams;funcName;options;df;view;constructor(e,t,n={}){this.urlParams=e,this.funcName=t,this.options=n}async init(e){this.df=e,await this.buildView()}async buildView(){const e=Se()(this.urlParams.entries()).map((([e,t])=>`${e}=${encodeURIComponent(t)}`)).toArray().join("&");this.view=s.shell.addTableView(this.df),this.view.path=this.view.basePath=`func/${di.name}.${this.funcName}?${e}`;const t={...this.options,sequenceColumnName:"sequence"};for(const[e,n]of this.urlParams.entries())switch(e){case Xe.n5.fixWidth:case Xe.n5.fitArea:t[e]=["1","on","true"].includes(n.toLowerCase());break;default:t[e]=n}const n=await this.view.dataFrame.plot.fromType("WebLogo",t);this.view.dockManager.dock(n,a.DOCK_TYPE.DOWN,null,"WebLogo",.35)}}class An{tableInput;seqColInput;funcParamsDiv;get funcParams(){return{table:this.tableInput.value,sequence:this.seqColInput.value}}get paramsUI(){return this.funcParamsDiv}constructor(){this.tableInput=o.input.table("Table",{value:s.shell.tv.dataFrame,onValueChanged:()=>{this.onTableInputChanged()}});const e=this.tableInput.value.columns.bySemType(a.SEMTYPE.MACROMOLECULE);this.seqColInput=o.input.column("Sequence",{table:this.tableInput.value,value:e,filter:e=>e.semType===a.SEMTYPE.MACROMOLECULE}),this.funcParamsDiv=o.inputs([this.tableInput,this.seqColInput],{style:{minWidth:"320px"}})}onTableInputChanged(){this.seqColInput=o.input.column("Sequence",{table:this.tableInput.value,value:this.tableInput.value.columns.bySemType(a.SEMTYPE.MACROMOLECULE)})}}var Sn=n(5785);const xn=new class{tooltipHandlerTemp="tooltip-handler.Monomer"},En={autoCrop:!0,autoCropMargin:0,suppressChiralText:!0};class _n{gridCol;constructor(e){this.gridCol=e,this.gridCol.grid.onCellTooltip(this.onCellTooltip.bind(this))}onCellTooltip(e,t,n){if(e.grid.dart!=this.gridCol.grid.dart||e.gridColumn.dart!=this.gridCol.dart||!e.tableColumn||!e.isTableCell)return!1;const i=e.tableColumn.getTag(gt.gp.alphabet),r=e.cell.value,a=e.grid.canvas.getBoundingClientRect(),l=e.bounds.right+a.left-4,c=e.bounds.bottom+a.top-4,u=Ci();if(!u)return o.tooltip.show(o.divText("Monomer library is not available."),l,c),!0;const h=new $t(u),d=i===me.YI.DNA||i===me.YI.RNA?"RNA":(me.YI.PT,"PEPTIDE"),p=h.getCappedRotatedMonomer(d,r),m=o.div(r),f=p?s.chem.svgMol(p,void 0,void 0,En):null;return o.tooltip.show(o.divV([m,...f?[f]:[]]),l,c),!0}static getOrCreate(e){let t=e.temp[xn.tooltipHandlerTemp];return t||(t=e.temp[xn.tooltipHandlerTemp]=new _n(e)),t}}class Mn extends a.GridCellRenderer{get name(){return Ge.uF.MONOMER}get cellType(){return Ge.uF.MONOMER}get defaultHeight(){return 15}get defaultWidth(){return 40}render(e,t,n,i,r,s,o){if(s.gridRow<0)return;_n.getOrCreate(s.gridColumn),e.font="12px monospace",e.textBaseline="middle",e.textAlign="center";const a=(0,me.ny)(s.cell.column.getTag(gt.gp.alphabet)),l=s.cell.value;if(!l)return;const c=a.get(l);e.fillStyle=c;const u=Math.max(2,Math.floor(.15*i));e.fillText((0,me.zS)(l,u),t+i/2,n+r/2,i)}}class Tn{constructor(e,t){this.target=e,this.debugEnabled=t}error(e,t,n){return this.target.error(e,t,n)}warning(e,t){return this.target.warning(e,t)}info(e,t){return this.target.info(e,t)}debug(e,t){if(this.debugEnabled)return this.target.debug(e,t)}}class In extends Map{_onPropertyChanged=new u.Subject;get onPropertyChanged(){return this._onPropertyChanged}get maxMonomerLength(){const e=super.get("MaxMonomerLength");return"long"===e?null:parseInt(e)}set maxMonomerLength(e){const t=null===e?"long":e.toString();super.set("MaxMonomerLength",t),this._onPropertyChanged.next("MaxMonomerLength")}get tooltipWebLogo(){return super.get("TooltipWebLogo")}set tooltipWebLogo(e){super.set("TooltipWebLogo",e),this._onPropertyChanged.next("TooltipWebLogo")}get defaultSeparator(){return super.get("DefaultSeparator")}set defaultSeparator(e){if(1!==e.length)throw new Error("The separator must be of length one.");super.set("DefaultSeparator",e),this._onPropertyChanged.next("DefaultSeparator")}constructor(e){super(Object.entries(e))}}class Ln extends a.Package{_properties;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 Tn(super.logger,e.debug)}completeInit(){this._initialized=!0}handleErrorUI(e){const[t,n]=(0,we.AP)(e);s.shell.error(t),this.logger.error(t,void 0,n)}}var $n=n(2174);class Nn extends a.Widget{viewed=!1;seqCol;wlViewer=null;constructor(e){super(o.divV([])),this.seqCol=e}async init(){const e=fe.GO.forColumn(this.seqCol),t=di.properties.tooltipWebLogo,n=this.seqCol.getTag(qe.gp.tooltipWebLogo);!1===t||["false","off","disable","disabled"].includes(n)||(this.wlViewer=await this.seqCol.dataFrame.plot.fromType("WebLogo",{sequenceColumnName:this.seqCol.name,backgroundColor:0,positionHeight:"Entropy",positionWidth:e.getAlphabetIsMultichar()?24:16,fixWidth:!0,fitArea:!1,positionNames:"",endPositionName:"50"}),this.wlViewer.root.style.height="50px",this.root.appendChild(this.wlViewer.root),this.root.style.width="100%")}detach(){this.wlViewer&&(this.wlViewer.detach(),this.wlViewer=null),super.detach()}}function Pn(e,t,n,i){const r=fe.GO.forColumn(e);let s=null,o=null;for(let e=0;e<r.posList.length;++e)r.posList[e]==t&&(s=e),r.posList[e]==n&&(o=e);if(null===s&&null!==t)throw new Error(`Start position ${t} not found.`);if(null===o&&null!==n)throw new Error(`End position ${n} not found.`);if(r.posList.length<o)throw new Error(`End position ${o} exceeds positions length`);const a=i||`${e.name}: (${t??""}-${n??""})`;return r.getRegion(s,o,a)}const On={df:a.DataFrame.fromCsv("seq,value\nATCCGTCGT,0.5\nTGTTCGTCA,0.4\nATGGTCGTA,0.7\nATCCGTGCA,0.1"),colName:"seq",positionNames:["1","1A","1C","2","4","4A","4B","5","6"].join(me.z1),regions:[{name:"first region",start:"1",end:"2"},{name:"second region",start:"1C",end:"4"},{name:"overlapping second",start:"1C",end:"4A"},{name:"whole sequence",start:"1",end:"6"},{name:"bad start",start:"0",end:"6"},{name:"bad end",start:"1",end:"4C"},{name:"bad start & end",start:"0",end:"4C"}]};class Rn{urlParams;funcName;view;data;constructor(e,t){this.urlParams=e,this.funcName=t}async init(e){this.data=e??On;const t=this.data.df.getCol(this.data.colName);this.data.positionNames&&t.setTag(me.gp.positionNames,this.data.positionNames),this.data.regions&&t.setTag(me.gp.regions,JSON.stringify(this.data.regions)),await this.buildView()}async buildView(){await s.data.detectSemanticTypes(this.data.df),this.view=s.shell.addTableView(this.data.df),this.view.path=this.view.basePath=`func/${di.name}.${this.funcName}`;const e=await this.view.dataFrame.plot.fromType("WebLogo",{sequenceColumnName:this.data.colName});this.view.dockManager.dock(e,a.DOCK_TYPE.DOWN,null,"WebLogo",.35)}}class kn{call;inputs=new class{table;sequence;region;start;end;name};constructor(e){this.call=e;const t=e=>this.call.inputParams[e].property.description;this.inputs.table=o.input.table("Table",{value:this.call.inputParams.table.value??s.shell.tv.dataFrame});const n=this.call.inputParams.sequence.value??this.inputs.table.value.columns.bySemType(a.SEMTYPE.MACROMOLECULE);this.inputs.sequence=o.input.column("Sequence",{table:s.shell.tv.dataFrame,value:n,onValueChanged:this.sequenceInputChanged.bind(this),filter:e=>e.semType===a.SEMTYPE.MACROMOLECULE}),this.inputs.start=o.input.choice("Start",{onValueChanged:this.startInputChanged.bind(this)}),this.inputs.end=o.input.choice("End",{onValueChanged:this.endInputChanged.bind(this)}),this.inputs.region=o.input.choice("Region",{value:null,items:[],onValueChanged:this.regionInputChanged.bind(this)}),this.inputs.name=o.input.string("Column name",{value:this.getDefaultName(),onValueChanged:this.nameInputChanged.bind(this),clearIcon:!0}),this.inputs.name.onInput(this.nameInputInput.bind(this));for(const e in this.call.inputParams)o.tooltip.bind(this.inputs[e].captionLabel,t(e));this.sequenceInputChanged()}sequenceInputChanged(){const e=this.inputs.sequence.value;e&&fe.GO.forColumn(e),this.updateRegionItems(),this.updateStartEndInputItems(),this.updateRegion(!0),this.updateNameInput()}fixRegion=!1;regionInputChanged(){this.fixRegion=!0;try{const e=this.inputs.region.stringValue,t=e?JSON.parse(e):null;if(null!==t)this.inputs.start.value=t?.start,this.inputs.end.value=t?.end;else{const e=fe.GO.forColumn(this.inputs.sequence.value);this.inputs.start.value=e.posList[0],this.inputs.end.value=e.posList[e.posList.length-1]}}finally{this.fixRegion=!1}}startInputChanged(){this.updateRegion(!1),this.updateNameInput()}endInputChanged(){this.updateRegion(!1),this.updateNameInput()}nameInputChanged(){this.defaultNameUpdating||(this.defaultName=!1)}nameInputInput(){this.inputs.name.value||(this.defaultName=!0,this.inputs.name.input.focus())}updateStartEndInputItems(){const e=this.inputs.sequence.value,t=e?fe.GO.forColumn(e):null,n=this.inputs.start.input,i=this.inputs.end.input;for(let e=n.options.length-1;e>=0;--e)n.options.remove(e);for(let e=i.options.length-1;e>=0;--e)i.options.remove(e);for(const e of t?.posList??[]){const t=document.createElement("option"),r=document.createElement("option");t.text=r.text=e,t.value=r.value=e,n.options.add(t),i.options.add(r)}n.value=t?.posList[0]??"",i.value=t?.posList[t?.posList.length-1]??""}updateRegionItems(){const e=this.inputs.sequence.value,t=e?e.getTag(me.gp.regions):null,n=t?JSON.parse(t):null,i=this.inputs.region.input;for(let e=i.options.length-1;e>=0;--e)i.options.remove(e);const r=document.createElement("option");if(r.text="",r.value=JSON.stringify(null),i.options.add(r),null!=n){this.inputs.region.root.style.removeProperty("display");for(const e of n){const t=document.createElement("option");t.text=`${e.name}: ${e.start}-${e.end}`,t.value=JSON.stringify(e),i.options.add(t)}}else this.inputs.region.root.style.display="none"}updateRegion(e){const t=this.inputs.start.stringValue??"",n=this.inputs.end.stringValue??"";if(!this.fixRegion){const e=this.inputs.region.input;e.selectedIndex=-1;for(let i=e.options.length-1;i>=0;--i){const r=e.options[i],s=JSON.parse(r.value);s&&t===s.start&&n===s.end&&(e.selectedIndex=i)}}}defaultName=!0;defaultNameUpdating=!1;updateNameInput(){this.defaultNameUpdating=!0;try{this.defaultName&&(this.inputs.name.value=this.getDefaultName())}finally{this.defaultNameUpdating=!1}}getDefaultName(){const e=this.inputs.region.stringValue,t=e?JSON.parse(e):null,n=this.inputs.sequence.value,i=this.inputs.start.stringValue??"",r=this.inputs.end.stringValue??"";return null!=t?`${n.name}(${t.name}): ${t.start}-${t.end}`:`${n?.name}: (${i}-${r})`}getParams(){return{table:this.inputs.table.value,sequence:this.inputs.sequence.value,start:this.getStart(),end:this.getEnd(),name:this.getName()}}getStart(){return this.inputs.start.stringValue}getEnd(){return this.inputs.end.stringValue}getName(){const e=this.inputs.name.stringValue;return""==e?null:e}dialog(){const e=o.inputs(Object.values(this.inputs),{style:{minWidth:"320px"}});o.dialog({title:"Get Region"}).add(e).onOK((()=>{(async()=>{const e=this.getParams();await this.call.func.prepare(e).call(!0)})().catch((e=>{di.handleErrorUI(e)}))})).show()}widget(){const e=o.inputs(Object.entries(this.inputs).filter((([e,t])=>!["table","sequence"].includes(e))).map((([e,t])=>t))),t=o.button("Get Region",(()=>{(async()=>{const e=this.getParams();await this.call.func.prepare(e).call(!0)})().catch((e=>{di.handleErrorUI(e)}))}));return a.Widget.fromRoot(o.divV([e,o.div(t)]))}}var Gn=n(7384);const Dn=OCL;class Fn{constructor(e){const t=e.split("|");t.forEach((e=>this.validateConnectionItem(e))),this.connectionItems=t}connectionItems;validateConnectionItem(e){const t="(PEPTIDE|RNA)",n=new RegExp(`${t}[0-9]+,${t}[0-9]+,[0-9]+:R[0-9]+-[0-9]+:R[0-9]+`,"g");if(!e.match(n))throw new Error(`Cannot parse connection item from ${e}`)}getConnectionData(){const e=[];return this.connectionItems.forEach((t=>{const n=[],i=t.split(",");i[2].split("-").forEach(((e,t)=>{const r=i[t],s=e.split(":"),o={monomerIdx:parseInt(s[0])-1,rGroupId:parseInt(s[1].slice(1))};n.push({polymerId:r,bond:o})})),e.push(n)})),e}}class Hn{simplePolymer;constructor(e){this.simplePolymer=e,this.polymerType=this.getPolymerType(),this.idx=this.getIdx();const{monomers:t,monomerTypes:n}=this.getMonomerSymbolsAndTypes();this.monomers=t,this.monomerTypes=n}polymerType;monomers;idx;monomerTypes;get id(){return this.polymerType+this.idx.toString()}getPolymerType(){const e=new RegExp("(PEPTIDE|RNA)[0-9]+{"),t=this.simplePolymer.match(e);if(!t)throw new Error(`Unsupported polymer type in ${this.simplePolymer}`);return t[1]}getIdx(){const e=new RegExp(`${this.polymerType}([0-9]+){`),t=this.simplePolymer.match(e);if(!t)throw new Error(`Cannot parse simple polymer id from ${this.simplePolymer}`);return parseInt(t[1])}getMonomerSymbolsAndTypes(){const e=new RegExp(`${this.polymerType}${this.idx}{|}`,"g"),t=this.simplePolymer.replace(e,"").split("."),n=[],i=[];return t.forEach((e=>{n.push(e),i.push("Backbone")})),{monomers:n,monomerTypes:i}}getBondData(){const e=[],t=this.monomerTypes.map(((e,t)=>{if("Backbone"===e)return t})).filter((e=>void 0!==e)),n=this.monomerTypes.map(((e,t)=>{if("Branch"===e)return t})).filter((e=>void 0!==e));for(let n=0;n<t.length-1;n++){const i=t[n],r=t[n+1];e.push([{monomerIdx:i,rGroupId:2},{monomerIdx:r,rGroupId:1}])}for(let t=0;t<n.length;t++){const i=n[t],r=i-1;e.push([{monomerIdx:r,rGroupId:3},{monomerIdx:i,rGroupId:1}])}return e}}class Bn{helmString;constructor(e){this.helmString=e;const t=this.helmString.split("$"),n=t[0].split("|");this.simplePolymers=n.map((e=>new Hn(e))),""!==t[1]&&(this.connectionList=new Fn(t[1])),this.bondData=this.getBondData(),this.bondedRGroupsMap=this.getBondedRGroupsMap()}bondData;simplePolymers;connectionList;bondedRGroupsMap;getBondedRGroupsMap(){const e=new Map;return this.bondData.forEach((t=>{t.forEach((t=>{const n=t.monomerIdx,i=t.rGroupId;e.get(n)||e.set(n,[]),e.get(n).push(i)}))})),e}toString(){return this.helmString}getPolymerTypeByMonomerIdx(e){return this.getSimplePolymerByMonomerIdx(e).polymerType}getSimplePolymerByMonomerIdx(e){const t=this.getMonomerIdxShifts(),n=Object.values(t).sort(((e,t)=>e-t)).find((t=>e>=t));if(void 0===n)throw new Error(`Cannot find simple polymer for monomer ${e}`);const i=Object.keys(t).find((e=>t[e]===n));return this.simplePolymers.find((e=>e.id===i))}shiftBondMonomerIds(e,t){t.forEach((t=>{t.forEach((t=>{t.monomerIdx+=e}))}))}getMonomerIdxShifts(){const e={};let t=0;return this.simplePolymers.forEach((n=>{e[n.id]=t,t+=n.monomers.length})),e}getBondData(){const e=this.getMonomerIdxShifts(),t=[];return this.simplePolymers.forEach((n=>{const i=n.getBondData(),r=e[n.id];this.shiftBondMonomerIds(r,i),t.push(...i)})),this.connectionList&&this.connectionList.getConnectionData().forEach((n=>{const i=[];n.forEach((t=>{const n=e[t.polymerId],r=t.bond;r.monomerIdx+=n,i.push(r)})),t.push(i)})),t}}class Vn{monomerSymbol;constructor(e){this.monomerSymbol=e}atoms;bonds;rGroups;shiftR1GroupToOrigin(){const e=this.rGroups.getAtomicIdx(1);if(null===e)throw new Error(`Cannot find R1 group for monomer ${this.monomerSymbol}`);const{x:t,y:n}=this.atoms.atomCoordinates[e];this.atoms.shift({x:-t,y:-n})}alignR2AlongX(){const e=this.rGroups.getAtomicIdx(2);if(null===e)throw new Error(`Cannot find R2 group for monomer ${this.monomerSymbol}`);const t=this.atoms.atomCoordinates[e],n=t.y/t.x,i=Math.atan(n);if(isNaN(i))throw new Error(`Cannot calculate angle for R2 group for monomer ${this.monomerSymbol}`);this.rotateCoordinates(-i)}shiftMonomerToDefaultPosition(){this.shiftR1GroupToOrigin(),null!==this.rGroups.getAtomicIdx(2)&&this.alignR2AlongX()}deleteBondLineWithSpecifiedRGroup(e){this.rGroups.deleteBondLineWithSpecifiedRGroup(e)}shiftCoordinates(e){this.atoms.shift(e)}rotateCoordinates(e){this.atoms.rotate(e)}getBondLines(){return this.bonds.getBondLines()}getAtomLines(){return this.atoms.atomLines}removeRGroups(e){this.rGroups.removeRGroups(e)}replaceRGroupWithAttachmentAtom(e,t){this.rGroups.replaceRGroupWithAttachmentAtom(e,t)}getAttachmentAtomByRGroupId(e){return this.rGroups.getAttachmentAtomIdByRGroupId(e)}shiftBonds(e){this.bonds.shift(e)}capRGroups(e){this.rGroups.capRGroups(e)}}class jn{atoms;bonds;constructor(e,t,n){this.atoms=t,this.bonds=n,this.rGroupIdToAtomicIndexMap=e.getRGroupIdToAtomicIdxMap()}rGroupIdToAtomicIndexMap;rGroupBondPositionMap=new Map;getAtomicIdx(e){const t=this.rGroupIdToAtomicIndexMap.get(e);return void 0===t?null:t}removeRGroupsFromAtomBlock(e){e.forEach((e=>{if(void 0===this.rGroupIdToAtomicIndexMap.get(e))throw new Error(`Cannot find atomic index for R group ${e}`)}));const t=Array.from(this.rGroupIdToAtomicIndexMap.entries()).filter((([t,n])=>e.includes(t))).map((([e,t])=>t));this.atoms.deleteAtoms(t)}removeRGroups(e){this.removeRGroupsFromAtomBlock(e),e.forEach((e=>{const t=this.replaceRGroupInBondsByDummy(e);this.rGroupBondPositionMap.set(e,t)}))}replaceRGroupInBondsByDummy(e){const t=this.rGroupIdToAtomicIndexMap.get(e);if(this.rGroupBondPositionMap.has(e))throw new Error(`R group ${e} is already handled`);const n=this.bonds.getPositionsInBonds(t+1);if(0===n.length)throw new Error(`Cannot find position for R group ${e}`);if(n.length>1)throw new Error(`More than one position for R group ${e}`);const i=n[0];return this.bonds.replacePositionsInBondsByDummy([i]),this.bonds.removeAtomIdFromBonds(t+1),this.removeRGroupFromAtomicIdxMap(e,t),i}removeRGroupFromAtomicIdxMap(e,t){this.rGroupIdToAtomicIndexMap.delete(e);for(const[e,n]of this.rGroupIdToAtomicIndexMap)n>t&&this.rGroupIdToAtomicIndexMap.set(e,n-1)}deleteBondLineWithSpecifiedRGroup(e){const t=this.rGroupBondPositionMap.get(e);if(!t)throw new Error(`Cannot find position for R group ${e}`);const{bondLineIdx:n}=t;this.bonds.deleteBondLines([n]),this.rGroupBondPositionMap.delete(e),this.rGroupIdToAtomicIndexMap.delete(e),this.rGroupBondPositionMap.forEach((e=>{e.bondLineIdx>n&&(e.bondLineIdx-=1)}))}replaceRGroupWithAttachmentAtom(e,t){const n=this.rGroupBondPositionMap.get(e);if(!n)throw new Error(`Cannot find position for R group ${e}`);const{bondLineIdx:i,nodeIdx:r}=n;this.bonds.bondedAtoms[i][r]=t}getAttachmentAtomIdByRGroupId(e){const t=this.rGroupBondPositionMap.get(e);if(!t)throw new Error(`Cannot find position for R group ${e}`);const{bondLineIdx:n,nodeIdx:i}=t;return this.bonds.bondedAtoms[n][(i+1)%2]}capRGroups(e){this.rGroupIdToAtomicIndexMap.forEach(((t,n)=>{const i=e[n-1];"H"===i?(this.removeRGroups([n]),this.deleteBondLineWithSpecifiedRGroup(n)):this.atoms.replaceRGroupSymbolByElement(t,i)}))}}class Un{coordinates=[];rawAtomLines=[];get atomCoordinates(){return this.coordinates}replaceRGroupSymbolByElement(e,t){this.rawAtomLines[e]=this.rawAtomLines[e].replace("R#",t)}deleteAtoms(e){this.coordinates=this.coordinates.filter(((t,n)=>!e.includes(n))),this.rawAtomLines=this.rawAtomLines.filter(((t,n)=>!e.includes(n)))}shift(e){this.coordinates=this.coordinates.map((t=>{const n=t.x+e.x,i=t.y+e.y;if(isNaN(n)||isNaN(i))throw new Error(`Cannot shift coordinates by ${e.x}, ${e.y}`);return{x:n,y:i}}))}rotate(e){this.coordinates=this.coordinates.map((t=>{const n=t.x,i=t.y,r=n*Math.cos(e)-i*Math.sin(e),s=n*Math.sin(e)+i*Math.cos(e);if(isNaN(r)||isNaN(s))throw new Error(`Cannot rotate coordinates by ${e}`);return{x:r,y:s}}))}}class Wn extends Un{constructor(e){super(),this.rawAtomLines=e.getAtomLines(),this.coordinates=this.rawAtomLines.map((e=>({x:parseFloat(e.substring(0,10)),y:parseFloat(e.substring(10,20))})))}get atomLines(){return this.rawAtomLines.map(((e,t)=>{const n=this.coordinates[t];return`${n.x.toFixed(4).padStart(10," ")}${n.y.toFixed(4).padStart(10," ")}${e.substring(20)}`}))}}class Yn{bondedAtomPairs=[];rawBondLines=[];get bondedAtoms(){return this.bondedAtomPairs}deleteBondLines(e){this.rawBondLines=this.rawBondLines.filter(((t,n)=>!e.includes(n))),this.bondedAtomPairs=this.bondedAtomPairs.filter(((t,n)=>!e.includes(n)))}getPositionsInBonds(e){const t=[];return this.bondedAtomPairs.forEach(((n,i)=>{n.forEach(((n,r)=>{n===e&&t.push({bondLineIdx:i,nodeIdx:r})}))})),t}replacePositionsInBondsByDummy(e,t){void 0===t&&(t=-1),e.forEach((e=>{const{bondLineIdx:n,nodeIdx:i}=e;this.bondedAtomPairs[n][i]=t}))}removeAtomIdFromBonds(e){this.bondedAtomPairs=this.bondedAtomPairs.map((t=>t.map((t=>t>e?t-1:t))))}shift(e){this.bondedAtomPairs=this.bondedAtomPairs.map((t=>t.map((t=>t+e))))}}class zn extends Yn{constructor(e){super(),this.rawBondLines=e.getBondLines(),this.bondedAtomPairs=this.rawBondLines.map((e=>[parseInt(e.substring(0,3)),parseInt(e.substring(3,6))]))}getBondLines(){return this.bondedAtomPairs.map(((e,t)=>{if(e.some((e=>-1===e)))throw new Error(`Bonded pair ${e} contains -1`);return`${e[0].toString().padStart(3," ")}${e[1].toString().padStart(3," ")}${this.rawBondLines[t].substring(6)}`}))}}class qn extends Vn{constructor(e,t){super(t);const n=Lt.getInstance(e);this.atoms=new Wn(n),this.bonds=new zn(n),this.rGroups=new jn(n,this.atoms,this.bonds),this.shiftMonomerToDefaultPosition()}}class Kn extends Un{molfileHandler;constructor(e){super(),this.molfileHandler=e,this.rawAtomLines=e.getAtomLines(),this.coordinates=this.getCoordinates()}getCoordinates(){const e=this.molfileHandler.x,t=this.molfileHandler.y;return Array.from(e).map(((e,n)=>({x:e,y:t[n]})))}get atomLines(){const e=/^(M V30 [^-]*)(-?\d+\.\d+)( )(-?\d+\.\d+)( -?\d+\.\d+.*)$/,t=/\sRGROUPS=\(\d+(\s+\d+)*\)/;return this.rawAtomLines.map(((n,i)=>{const r=this.coordinates[i],s=r.x.toFixed(4)+"00",o=r.y.toFixed(4)+"00";return n.replace(e,((e,t,n,i,r,a)=>t+s+i+o+a)).replace(t,"")}))}replaceRGroupSymbolByElement(e,t){super.replaceRGroupSymbolByElement(e,t);const n=this.rawAtomLines[e].substring(3).split(" ");n.length>7&&(this.rawAtomLines[e]=`M ${n.slice(0,7).join(" ")}`)}}class Zn extends Yn{molfileHandler;constructor(e){super(),this.molfileHandler=e,this.rawBondLines=e.getBondLines(),this.bondedAtomPairs=this.getBondedAtomPairs()}getBondedAtomPairs(){return this.molfileHandler.pairsOfBondedAtoms.map((e=>[e[0],e[1]]))}getBondLines(){const e=/^(M\s+V30\s+\d+\s+\d+\s+)(\d+)(\s+)(\d+)(.*)$/;return this.bondedAtomPairs.map(((t,n)=>{if(t.some((e=>-1===e)))throw new Error(`Bonded pair ${t} contains -1`);return this.rawBondLines[n].replace(e,((e,n,i,r,s,o)=>`${n}${t[0]}${r}${t[1]}${o}`))}))}}class Xn extends Vn{constructor(e,t){super(t);const n=Lt.getInstance(e);this.atoms=new Kn(n),this.bonds=new Zn(n),this.rGroups=new jn(n,this.atoms,this.bonds),this.shiftMonomerToDefaultPosition()}}class Jn{static getInstance(e,t){if(Lt.isMolfileV2K(e))return new qn(e,t);if(Lt.isMolfileV3K(e))return new Xn(e,t);throw new Error("Unsupported molfile version")}}class Qn{monomerSymbol;monomerIdx;helm;monomerLib;molfileWrapper;capGroupElements=[];constructor(e,t,n,i,r,s){this.monomerSymbol=e,this.monomerIdx=t,this.helm=n,this.monomerLib=s;const o=this.getLibraryMonomerObject();let a=o.molfile;Lt.isMolfileV2K(a)&&(a=this.convertMolfileToV3KFormat(a,e,r)),this.molfileWrapper=Jn.getInstance(a,e),this.capGroupElements=this.getCapGroupElements(o),n.bondedRGroupsMap.has(t)&&this.removeRGroups(n.bondedRGroupsMap.get(t)),this.capRemainingRGroups(),this.shiftCoordinates(i)}convertMolfileToV3KFormat(e,t,n){let i=null;try{if(i=n.get_mol(e,JSON.stringify({mergeQueryHs:!0})),i)return i.get_v3Kmolblock();throw new Error(`Cannot convert ${t} to molV3000`)}finally{i?.delete()}}getLibraryMonomerObject(){const e=this.helm.getPolymerTypeByMonomerIdx(this.monomerIdx),t=this.monomerLib.getMonomer(e,this.monomerSymbol);if(!t)throw new Error(`Monomer ${this.monomerSymbol} is not found in the library`);return t}getCapGroupElements(e){return e.rgroups.map((e=>(e.capGroupSmiles||e.capGroupSMILES).replace(/(\[|\]|\*|:|\d)/g,"")))}shiftCoordinates(e){this.molfileWrapper.shiftCoordinates(e)}getAtomLines(){return this.molfileWrapper.getAtomLines()}getBondLines(){return this.molfileWrapper.getBondLines()}removeRGroups(e){this.molfileWrapper.removeRGroups(e)}capRemainingRGroups(){this.molfileWrapper.capRGroups(this.capGroupElements)}replaceRGroupWithAttachmentAtom(e,t){this.molfileWrapper.replaceRGroupWithAttachmentAtom(e,t)}getAttachmentAtomByRGroupId(e){return this.molfileWrapper.getAttachmentAtomByRGroupId(e)}deleteBondLineWithSpecifiedRGroup(e){this.molfileWrapper.deleteBondLineWithSpecifiedRGroup(e)}shiftBonds(e){this.molfileWrapper.shiftBonds(e)}}class ei{rdKitModule;monomerLib;constructor(e,t,n){this.rdKitModule=t,this.monomerLib=n,this.helm=new Bn(e)}monomerWrappers=[];helm;addMonomer(e,t,n){const i=new Qn(e,t,this.helm,n,this.rdKitModule,this.monomerLib);this.monomerWrappers.push(i)}getAtomNumberShifts(){const e=[];let t=0;return this.monomerWrappers.forEach((n=>{e.push(t),t+=n.getAtomLines().length})),e}restoreBondsBetweenMonomers(){this.helm.bondData.forEach((e=>{const t=e.map((e=>e.monomerIdx)),n=e.map((e=>e.rGroupId)),i=t.map((e=>this.monomerWrappers[e])),r=i[1].getAttachmentAtomByRGroupId(n[1]);i[0].replaceRGroupWithAttachmentAtom(n[0],r),i[1].deleteBondLineWithSpecifiedRGroup(n[1])}))}compileToMolfile(){const e=[],t=[],n=this.getAtomNumberShifts();this.monomerWrappers.forEach(((e,t)=>{e.shiftBonds(n[t])})),this.restoreBondsBetweenMonomers(),this.monomerWrappers.forEach((n=>{e.push(...n.getAtomLines()),t.push(...n.getBondLines())}));const i=e.length,r=t.length;return[this.getV3KHeader(i,r),this.getV3KAtomBlock(e),this.getV3KBondBlock(t),"M V30 END CTAB\nM END"].join("\n")}getV3KHeader(e,t){return`\n Datagrok\n\n 0 0 0 0 0 0 0 0 0 0999 V3000\nM V30 BEGIN CTAB\nM V30 COUNTS ${e} ${t} 0 0 1`}getV3KAtomBlock(e){const t=/^(M V30 )(\d+)( .*)$/;return["M V30 BEGIN ATOM",...e.map(((e,n)=>{const i=n+1;return e.replace(t,((e,t,n,r)=>t+i+r))})),"M V30 END ATOM"].join("\n")}getV3KBondBlock(e){const t=/^(M V30 )(\d+)( .*)$/;return["M V30 BEGIN BOND",...e.map(((e,n)=>{const i=n+1;return e.replace(t,((e,t,n,r)=>t+i+r))})),"M V30 END BOND"].join("\n")}}class ti{constructor(e){this.molfileHandler=Lt.getInstance(e)}molfileHandler;get monomerSymbols(){return this.molfileHandler.atomTypes}getMonomerShifts(e){return{x:this.molfileHandler.x[e],y:this.molfileHandler.y[e]}}}class ni{helmColumn;df;constructor(e,t){this.helmColumn=e,this.df=t,this.helmColumn=e}async convertToSmiles(){const e=await this.getSmilesList(),t=this.df.columns.getUnusedName(`smiles(${this.helmColumn.name})`);return a.Column.fromStrings(t,e.map((e=>null===e?"":e)))}async getSmilesList(){return(await this.convertToMolfileV3KColumn()).toList().map((e=>a.chem.convert(e,a.chem.Notation.MolBlock,a.chem.Notation.Smiles)))}async getMolV3000ViaOCL(e,t){const n=e.map((e=>{if(null===e)return"";const t=e.get_v3Kmolblock();return e.delete(),t})),i=new Array(n.length),r=a.TaskBarProgressIndicator.create("Handling chirality...");for(let e=0;e<n.length;e++){const t=Dn.Molecule.fromMolfile(n[e]).toMolfileV3();i[e]=t.replace("STERAC1","STEABS");const s=e/n.length*100;r.update(s,`${s?.toFixed(2)}% of molecules completed`)}return r.close(),a.Column.fromStrings(t,i)}async convertToRdKitBeautifiedMolfileColumn(e){const t=(await this.convertToMolfileV3KColumn()).toList(),n=await s.functions.call("Chem:getRdKitModule"),i=t.map((e=>{if(""===e)return null;const t=n.get_mol(e);return t?(t.set_new_coords(),t.normalize_depiction(1),t.straighten_depiction(!0),t):null})),r=this.df.columns.getUnusedName(`molfile(${this.helmColumn.name})`);return e?await this.getMolV3000ViaOCL(i,r):a.Column.fromStrings(r,i.map((e=>{if(null===e)return"";const t=e.get_v3Kmolblock();return e.delete(),t})))}async convertToMolfileV3KColumn(){const e=await this.getPolymerGraphColumn(),t=await s.functions.call("Chem:getRdKitModule"),n=(await pi()).getMonomerLib(),i=e.toList().map(((e,i)=>{const r=this.helmColumn.get(i);if(!r)return"";let s="";try{s=this.getPolymerMolfile(r,e,t,n)}catch(e){const[t,n]=(0,we.AP)(e);di.logger.error(t,void 0,n)}finally{return s}})),r=this.df.columns.getUnusedName(`molfileV2K(${this.helmColumn.name})`);return a.Column.fromList("string",r,i)}async getPolymerGraphColumn(){return await s.functions.call("HELM:getMolfiles",{col:this.helmColumn})}getPolymerMolfile(e,t,n,i){const r=new ti(t),s=new ei(e,n,i);return r.monomerSymbols.forEach(((e,t)=>{const n=r.getMonomerShifts(t);s.addMonomer(e,t,n)})),s.compileToMolfile()}}async function ii(e,t,n){const i=new ni(t,e),r=await i.convertToRdKitBeautifiedMolfileColumn(n);return r.semType=a.SEMTYPE.MOLECULE,r}class ri{constructor(){this.maxIterations={uiName:"Max iterations",value:0,tooltip:"Maximum iterations for MCL process.Default is \n 0 which will construct the clusters with plain sparse matrix. Values greater than 0 will \n perform MCL with the given number of iterations and will result in trans-cluster activity cliff lines."},this.useWebGPU={uiName:"Use WebGPU",value:!1,tooltip:"Use WebGPU for MCL calculation. (Experimental)",type:"boolean"}}}class si extends P{constructor(e={}){super({...e,enableMCL:!0});const t=this.tableInput.value.columns.numericalNoDateTime;this.activitiesInput=o.input.column("Activities",{table:this.tableInput.value,value:a.Utils.firstOrNull(t),filter:e=>Array.from(t).includes(e)}),this.activitiesInputRoot=this.activitiesInput.root,this.similarityInput=o.input.int("Similarity cutoff",{value:80}),this.methodsParams[$]=new ri}onTableInputChanged(){if(super.onTableInputChanged(),this.activitiesInputRoot){o.empty(this.activitiesInputRoot);const e=this.tableInput.value.columns.numerical;this.activitiesInput=o.input.column("Activities",{table:this.tableInput.value,value:a.Utils.firstOrNull(e),filter:t=>Array.from(e).includes(t)}),Array.from(this.activitiesInput.root.children).forEach((e=>this.activitiesInputRoot.append(e)))}}getEditor(){return o.div([this.tableInput,this.colInputRoot,this.preprocessingFunctionInputRoot,this.preprocessingFuncSettingsDiv,this.activitiesInputRoot,this.similarityMetricInputRoot,this.methodInput,this.methodSettingsDiv,this.similarityMetricInputRoot,this.similarityInput],{style:{minWidth:"320px"},classes:"ui-form dim-reduction-dialog-form"})}getParams(){return{...super.getParams(),activities:this.activitiesInput.value,similarityThreshold:this.similarityInput.value}}}function oi(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 ai(e,t){return`${t} (${e.length>4?`${e.length} columns`:e.map((e=>e.name)).join(", ")})`}var li=n(6873);class ci{separator;separatorSplitter;splitter;constructor(e){this.separator=e,this.separatorSplitter=(0,xe.dh)(this.separator),this.splitter=this._splitter.bind(this)}_splitter(e){const t=this.separatorSplitter(e);return new ui(t.originals,fe.b9[me.Hi.SEPARATOR])}}class ui extends xe.Mu{seqCList;_canonicals=null;get canonicals(){if(!this._canonicals){const e=this.length;this._canonicals=new Array(e);for(let t=0;t<e;++t)this._canonicals[t]=this.getCanonical(t)}return this._canonicals}getCanonical(e){if(this.isGap(e))return be._S;let t=this.seqCList[e];if(null===t){const n=this.getOriginal(e);t=n,")"===n[n.length-1]&&(t=this.seqCList[e]=n.replace(/\(\d+\)$/,""))}return t}constructor(e,t){super(e,t),this.seqCList=new Array(this.length).fill(null)}}async function hi(e,t,n,i){const r=await async function(e,t,n,i){const r=(0,ve.R)(t),s=fe.GO.forColumn(t).getNewColumnFromList("ref",[n]),o=fe.GO.forColumn(s).getSplitted(0),l=i===pe.IDENTITY?function(e,t){const n=t.columns.length,i=new Array(n),r=new Array(n),s=new Array(n);for(let o=0;o<n;++o){const n=t.columns.byIndex(o);i[o]=n.getRawData(),r[o]=n.categories.indexOf("");const a=o<e.length?e.getOriginal(o):be._S;s[o]=n.categories.indexOf(a)}const o=a.Column.float("Identity",t.rowCount),l=o.getRawData();for(let n=0;n<t.rowCount;++n){l[n]=0;for(let t=0;t<e.length;++t)(i[t]?i[t][n]:0)===s[t]&&++l[n];l[n]/=e.length}return o}(o,r):i===pe.SIMILARITY?await async function(e,t){const n=t.columns.toList();return await(0,ye.uL)(n,e)}(o,r):null;if(null===l)throw new Error(`In bio library: Unknown sequence scoring method: ${i}`);return l.name=e.columns.getUnusedName(l.name),e.columns.add(l),l}(e,t,n,i);for(let e=0;e<r.length;e++)t.isNone(e)&&r.set(e,null,!1);return r}const di=new Ln;async function pi(){return await Ut.getInstance()}let mi=null;class fi{_palette;constructor(e){this._palette=e}get(e){return this._palette[e]}}let gi=null,yi=null;async function bi(){const e="Bio: _package.initBio()";di.logger.debug(`${e}, start`);const t=await s.functions.call("Chem:getRdKitModule"),n=window.performance.now();await Promise.all([(async()=>{const e=await Ut.getInstance(),t=await(0,Et.ub)();t.explicit&&(t.explicit=[],await(0,Et.Eu)(t)),await Promise.all([e.loadMonomerLib(),e.loadMonomerSets()]),gi=e.getMonomerLib(),yi=e.getMonomerSets()})(),(async()=>{const e=await di.getProperties(),t=new In(e);di.properties=t})()]).finally((()=>{di.completeInit();const t=window.performance.now();di.logger.debug(`${e}, loading ET: ${t-n} ms`)}));const i=[],r=[],o=gi.getMonomerMolsByPolymerType("PEPTIDE");Object.keys(o).forEach((e=>{i.push(e);const n=o[e].replaceAll("#R","O "),s=t.get_mol(n),a=JSON.parse(s.get_descriptors()).CrippenClogP;r.push(a),s?.delete()}));const a=r.reduce(((e,t)=>e+t),0)/r.length||0,l={};for(let e=0;e<i.length;e++)l[i[e]]=r[e]<a?"#4682B4":"#DC143C";mi=new fi(l),di.logger.debug(`${e}, end`)}function vi(e){const t=new Nn(e);return t.init().then((()=>{})).catch((e=>{const t=e instanceof Error?e.message:e.toString();s.shell.error(t)})),t}function wi(){return gi}function Ci(){return gi}function Ai(e){return fe.GO.forColumn(e)}function Si(e){const t="getRegionTopMenu",n=a.Func.find({package:di.name,name:t});if(1!==n.length)throw new Error(`Package '${di.name}' func '${t}' not found`);const i=n[0].prepare({table:e.dataFrame,sequence:e});return new kn(i).widget()}async function xi(e){return async function(){const e=o.label("Manage monomer libraries");return Yt()(e).addClass("d4-link-action"),e.onclick=async()=>await Kt(),new a.Widget(e)}()}function Ei(e){try{new kn(e).dialog()}catch(e){const t=e instanceof Error?e.message:e.toString(),n=e instanceof Error?e.stack:void 0;s.shell.error(`Get region editor error: ${t}`),di.logger.error(t,void 0,n)}}function _i(e){const t=new An;o.dialog({title:"Split to Monomers"}).add(t.paramsUI).onOK((async()=>e.func.prepare(t.funcParams).call(!0))).show()}function Mi(e){const t=new P({semtype:a.SEMTYPE.MACROMOLECULE});o.dialog({title:"Sequence Space"}).add(t.getEditor()).onOK((async()=>{const n=t.getParams();return e.func.prepare({molecules:n.col,table:n.table,methodName:n.methodName,similarityMetric:n.similarityMetric,plotEmbeddings:n.plotEmbeddings,options:n.options,preprocessingFunction:n.preprocessingFunction,clusterEmbeddings:n.clusterEmbeddings}).call()})).show()}function Ti(e){const t=new si({semtype:a.SEMTYPE.MACROMOLECULE});o.dialog({title:"Activity Cliffs"}).add(t.getEditor()).onOK((async()=>{const n=t.getParams();return e.func.prepare({table:n.table,molecules:n.col,activities:n.activities,similarity:n.similarityThreshold,methodName:n.methodName,similarityMetric:n.similarityMetric,preprocessingFunction:n.preprocessingFunction,options:n.options}).call()})).show()}function Ii(){return new Ve}function Li(e){return function(e){const t=Array.from(e.dataFrame.columns).filter((e=>e.semType===a.SEMTYPE.MOLECULE)).map((e=>e.name));new Set(t).delete(e.name);let n=di.properties?di.properties.maxMonomerLength:4;if(Te.maxMonomerLength in e.tags){const t=parseInt(e.getTag(Te.maxMonomerLength));n=isNaN(t)?n:t}if(".mm.cellRenderer.maxMonomerLength"in e.temp){const t=parseInt(e.temp[".mm.cellRenderer.maxMonomerLength"]);n=isNaN(t)?n:t}const i=o.input.int("Max Monomer Length",{value:n,nullable:!0,min:1,max:50,step:1,onValueChanged:()=>{if(0==i.value)setTimeout((()=>{i.value=null}),0);else{const t=i.value??"",n=null==t?"":t.toString();e.temp[".mm.cellRenderer.maxMonomerLength"]=n,e.temp[".mm.cellRenderer.settingsChanged"]=ke.true,e.dataFrame.fireValuesChanged()}},tooltipText:"The max length of monomer symbol displayed without shortening, empty to no limit"}),r=o.input.int("Monomer Margin",{value:e.temp[".mm.cellRenderer.gapLength"]??0,onValueChanged:()=>{e.temp[".mm.cellRenderer.gapLength"]=r.value,e.temp[".mm.cellRenderer.settingsChanged"]=ke.true,e.dataFrame.fireValuesChanged()},tooltipText:"The size of margin between monomers (in pixels)"}),s=o.input.bool("Color Code",{value:null==e?.temp["color-code"]||e.temp["color-code"],onValueChanged:()=>{e.temp["color-code"]=s.value,e.dataFrame.fireValuesChanged()},tooltipText:"Color code"}),l=o.input.string("Reference Sequence",{value:null!=e?.temp["reference-sequence"]?e?.temp["reference-sequence"]:"",nullable:!0,onValueChanged:()=>{e.temp["reference-sequence"]=l.value,e.dataFrame.fireValuesChanged()},tooltipText:"Reference sequence is not empty, then the sequence will be render \nas a difference from the reference sequence"}),c=o.input.bool("Compare with current",{value:null==e?.temp["compare-with-current"]||e.temp["compare-with-current"],onValueChanged:()=>{e.temp["compare-with-current"]=c.value,e.dataFrame.fireValuesChanged()},tooltipText:'When on, all sequences get rendered in the "diff" mode'}),u=o.inputs([i,r,l,s,c]);return new a.Widget(u)}(e)}function $i(e){return(0,$n.j)(e)}function Ni(){return new Ve}function Pi(){return new je}function Oi(e,t,n,i,r){const s=new it.$(i,r,n,t);return"Local alignment"==e?s.smithWaterman():s.needlemanWunch()}function Ri(){return new Xe.oP}function ki(){return new nt}function Gi(e,t,n,i){return Pn(e,t??null,n??null,i??null)}async function Di(e,t,n,i,r){const o=Pn(t,n??null,i??null,r??null);t.dataFrame.columns.add(o),await s.data.detectSemanticTypes(t.dataFrame)}async function Fi(e,t,n,i,r,u,h,d,p){if(!(0,bn.V)(t,"Activity Cliffs"))return;const m=oi(e),f={units:t.meta.units,aligned:t.getTag(me.gp.aligned),separator:t.getTag(me.gp.separator),alphabet:t.getTag(me.gp.alphabet)},g=u,y=t,b=async()=>await de(e,y,m,"Activity cliffs",n,i,g,r,{...d??{}},a.SEMTYPE.MACROMOLECULE,f,h,lt,ct,pt,void 0,p),v=r===c.c.UMAP?2e5:2e4,w=r===c.c.UMAP?5e3:2e3;if(e.rowCount>v)return void s.shell.warning(`Too many rows, maximum for sequence activity cliffs is ${v}`);const C=a.TaskBarProgressIndicator.create("Running sequence activity cliffs ...");return new Promise(((t,n)=>{e.rowCount>w&&!d?.[l.vb]?o.dialog().add(o.divText("Activity cliffs analysis might take several minutes.\n Do you want to continue?")).onOK((async()=>{b().then((e=>t(e))).catch((e=>n(e)))})).onCancel((()=>{t(void 0)})).show():b().then((e=>t(e))).catch((e=>n(e)))})).catch((e=>{const[t,n]=(0,we.AP)(e);throw di.logger.error(t,void 0,n),e})).finally((()=>{C.close()}))}async function Hi(e,t,n=1,i=.6,r="Morgan"){if(e.semType!==a.SEMTYPE.MACROMOLECULE)return{entries:e.toList(),options:{}};const{seqList:s,options:o}=await st(e,t,r);return{entries:s,options:{...o,gapOpen:n,gapExtend:i}}}async function Bi(e,t){e.version!==e.temp["last-invalidated-version"]&&await(0,at.BQ)(e,!1);const n=e.temp["monomeric-mols"],i=await s.functions.call("Chem:getMorganFingerprints",{molColumn:n}),r=new Array(i.length).fill(null);for(let e=0;e<i.length;e++){if(i.isNone(e)||!i.get(e))continue;const t=i.get(e);r[e]=V.A.fromUint32Array(t.length,new Uint32Array(t.getBuffer().buffer))}return{entries:r,options:{}}}async function Vi(e,t,i,r,c,u,h,d){if((0,bn.V)(t,"Sequence Space"))return u||(u=a.Func.find({name:"macromoleculePreprocessingFunction",package:"Bio"})[0]),h??={},await async function(e,t,i,r,c,u,h,d=!0,p=!1,m={preprocessingFuncArgs:[]},f={},g=null,y={}){const b={showXAxis:!1,showYAxis:!1,showXSelector:!1,showYSelector:!1};if(t.length!==r.length||t.length!==u.length||t.length!==c.length||t.length!==m.preprocessingFuncArgs.length)throw new Error("columns, metrics and preprocessing functions, weights and function argumentsmust have the same length");const v=d?s.shell.tableView(e.name)??s.shell.addTableView(e):null,w=async()=>{const w=a.TaskBarProgressIndicator.create(`Initializing ${f.scatterPlotName??"dimensionality reduction"} ...`);let C;try{const A=oi(e);function S(n,r,s){let c=null,u=null;e.columns.names().includes(A[0])?(c=e.columns.byName(A[0]),u=e.columns.byName(A[1])):(c=e.columns.add(a.Column.float(A[0],e.rowCount)),u=e.columns.add(a.Column.float(A[1],e.rowCount)),d&&!C&&(C=v.scatterPlot({...b,x:A[0],y:A[1],title:f.scatterPlotName??ai(t,i)}))),f[l.YP]&&(C?.root&&o.setUpdateIndicator(C.root,!1),c.init((e=>s[0]?s[0][e]:void 0)),u.init((e=>s[1]?s[1][e]:void 0)));const h=n/r*100;w.update(h,`Running ${f.scatterPlotName??"dimensionality reduction"}... ${h.toFixed(0)}%`)}async function x(){e.columns.add(a.Column.float(A[0],e.rowCount)),e.columns.add(a.Column.float(A[1],e.rowCount));let n=null;d&&(C=v.scatterPlot({...b,x:A[0],y:A[1],title:f.scatterPlotName??ai(t,i)}),o.setUpdateIndicator(C.root,!0));const p=s.events.onViewerClosed.subscribe((e=>{const t=e.args.viewer;t?.getOptions()?.look?.title&&C?.getOptions()?.look?.title&&t?.getOptions()?.look?.title===C?.getOptions()?.look?.title&&(s.events.fireCustomEvent(U,{}),p.unsubscribe(),n?.(),w.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 i=n.inputs[0].name,o=n.inputs[1].name,{entries:a,options:l}=await n.apply({[i]:t[e],[o]:r[e],...m.preprocessingFuncArgs[e]??{}});s.push({entries:a,options:l}),m.distanceFnArgs.push(l)}else{const n=t[e].toList(),i={};s.push({entries:n,options:i}),m.distanceFnArgs.push(i)}}e(await q(s.map((e=>e.entries)),i,r,c,h,m,f[l.vb]?void 0:S))}catch(e){s(e)}})),y=await g;return w.close(),p.unsubscribe(),y}const E=await x();if(p&&E){const _=a.TaskBarProgressIndicator.create("Clustering embeddings ...");try{const M=await function(e,t,i,r){return dn(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:r,epsilon:i}),a.onmessage=({data:{error:e,clusters:t}})=>{a.terminate(),e?o(e):s(t)}}))}))}(E[0],E[1],m.dbScanEpsilon??.01,m.dbScanMinPts??4),T=e.columns.getUnusedName("Cluster (DBSCAN)");e.columns.addNewString(T).init((e=>M[e].toString())),C&&(C.props.colorColumnName=T)}catch(I){s.shell.error("Clustering embeddings failed"),console.error(I)}finally{_.close()}}if(E){const L=e.columns.byName(A[0]),$=e.columns.byName(A[1]);if(L.init((e=>E[0][e])),$.init((e=>E[1][e])),g)try{const N=g.inputs[0].name,P=g.inputs[1].name;await g.prepare({[N]:L,[P]:$,...y}).call(!0)}catch(O){s.shell.error("Post-processing failed"),console.error(O)}if(C)return o.setUpdateIndicator(C.root,!1),C.helpUrl="/help/compute/sequence-space",C}}catch(R){s.shell.error("Dimensionality reduction failed"),console.error(R),w.close(),C&&o.setUpdateIndicator(C.root,!1)}};return new Promise((async(t,n)=>{try{if(f.fastRowCount&&e.rowCount>f.fastRowCount&&!f[l.vb])o.dialog().add(o.divText("Analysis might take several minutes. Do you want to continue?")).onOK((async()=>{try{const e=await w();t(e)}catch(e){n(e)}})).onCancel((()=>t(void 0))).show();else{const e=await w();t(e)}}catch(e){n(e)}}))}(e,[t],i,[r],[1],[u],"MANHATTAN",c,d??!1,{...h,preprocessingFuncArgs:[h.preprocessingFuncArgs??{}]},{fastRowCount:1e4,scatterPlotName:"Sequence space",bypassLargeDataWarning:h?.[l.vb]})}async function ji(e,t,n){const i=a.TaskBarProgressIndicator.create("Converting to atomic level ...");try{const i=(await pi()).getMonomerLib();await async function(e,t,n,i){if(0===a.Func.find({package:"Chem",name:"getRdKitModule"}).length)return void s.shell.warning('Transformation to atomic level requires package "Chem" installed.');if(n){const n=fe.GO.forColumn(t);return n.isHelm()||(t=n.convert(me.Hi.HELM)),async function(e,t){const n=await ii(e,t);e.columns.add(n,!0),await s.data.detectSemanticTypes(e)}(e,t)}if(!(0,bn.V)(t,"To Atomic Level"))return;const r=await(0,Gn.C4)(e,t,i);null!==r.col&&(e.columns.add(r.col,!0),await s.data.detectSemanticTypes(e)),r.warnings&&r.warnings.length>0&&s.shell.warning(o.list(r.warnings))}(e,t,n,i)}finally{i.close()}}function Ui(){(0,wn.D)().catch((e=>{const[t,n]=(0,we.AP)(e);if(e instanceof vn.Ap)return s.shell.warning(e.element),void di.logger.warning(t);s.shell.error(t),di.logger.error(t,void 0,n)}))}async function Wi(e=null,t=null){return(0,wn.D)({col:e,clustersCol:t})}async function Yi(){const e=s.shell.tv,t=e.dataFrame.columns.toList().filter((e=>e.semType==a.SEMTYPE.MACROMOLECULE&&(fe.GO.forColumn(e),!0))),n=async t=>{if(!(0,bn.V)(t,"Composition"))return;const n=e.addViewer("WebLogo",{sequenceColumnName:t.name});s.shell.tv.dockManager.dock(n,a.DOCK_TYPE.DOWN,null,"Composition analysis",.25)};let i=null;if(0!=t.length){if(t.length>1){const e=t.map((e=>e.name)),i=t.find((e=>fe.GO.forColumn(e).isMsa())),r=o.input.choice("Column",{value:i?i.name:e[0],items:e});o.dialog({title:"Composition Analysis",helpUrl:"https://datagrok.ai/help/datagrok/solutions/domains/bio/#sequence-composition"}).add(o.div([r])).onOK((async()=>{const e=t.find((e=>e.name==r.value))??null;e&&await n(e)})).show()}else i=t[0];i&&await n(i)}else s.shell.error("Current table does not contain sequences")}function zi(e){return new ge.m(e).importFasta()}function qi(e){return console.log(e),[]}function Ki(){const e=(0,Ce.m)()[0];(0,At.C)(e)}function Zi(){return new Mn}async function Xi(e){const t=a.TaskBarProgressIndicator.create("Test detectMacromolecule..."),n=(await s.dapi.files.list(e,!0,"")).filter((e=>e.fileName.endsWith(".csv")));let i=0;const r=[];for(const o of n)try{const t=await s.dapi.files.readAsText(e+o.fullPath),n=a.DataFrame.fromCsv(t);for(const e of n.columns)await s.functions.call("Bio:detectMacromolecule",{col:e})===a.SEMTYPE.MACROMOLECULE&&r.push({file:o.path,result:"detected",column:e.name,message:`units: ${e.meta.units}`})}catch(e){r.push({file:o.path,result:"error",column:null,message:e instanceof Error?e.message:e.toString()})}finally{i+=1,t.update(100*i/n.length,`Test ${o.fileName}`)}s.shell.info("Test Demo:Files for detectMacromolecule finished."),t.close();const o=a.DataFrame.fromObjects(r);return o.name=`datasets_detectMacromolecule_${e}`,o}async function Ji(e,t){await(0,Sn.k)(e,t)}function Qi(e){const t=fe.GO.forColumn(e).stats;return Object.keys(t.freq)}function er(){return new bt}function tr(){const e=s.shell.v,t=e.addViewer("Sequence Similarity Search");e.dockManager.dock(t,"down")}function nr(){return new vt}function ir(){const e=s.shell.v,t=e.addViewer("Sequence Diversity Search");e.dockManager.dock(t,"down")}function rr(e){const t=(0,Ce.m)();1===t.length?e.func.prepare({macromolecules:t[0]}).call(!0):new at.a7(t)}function sr(e){s.shell.tv.getFiltersGroup({createDefaultFilters:!1}).updateOrAdd({type:"Bio:bioSubstructureFilter",column:e.name,columnName:e.name}),s.shell.tv.grid.scrollToCell(e,0)}async function or(e,t,n){return hi(e,t,n,pe.IDENTITY)}async function ar(e,t,n){return hi(e,t,n,pe.SIMILARITY)}async function lr(){Kt()}function cr(){(0,St.TE)()}function ur(){return new xt._i}async function hr(){const e=a.TaskBarProgressIndicator.create("WebLogo");try{const e=new URLSearchParams(window.location.search),t=new Cn(e,"webLogoLargeApp"),n=await di.files.readCsv("data/sample_PT_100000x5.csv");await s.data.detectSemanticTypes(n),await t.init(n)}finally{e.close()}}async function dr(){const e=a.TaskBarProgressIndicator.create("WebLogo ...");try{const e=new URLSearchParams(window.location.search),t=new Cn(e,"webLogoAggApp"),n=await di.files.readCsv("samples/FASTA_PT_activity.csv");await s.data.detectSemanticTypes(n),await t.init(n)}finally{e.close()}}async function pr(){const e=a.TaskBarProgressIndicator.create("getRegion ...");try{const e=new URLSearchParams(window.location.search),t=new Rn(e,"getRegionApp");await t.init()}finally{e.close()}}async function mr(){const e=a.TaskBarProgressIndicator.create("getRegion ...");try{const e=new URLSearchParams(window.location.search),t=await di.files.readCsv("samples/HELM_empty_vals.csv"),n=new Rn(e,"getRegionHelmApp");await n.init({df:t,colName:"HELM"})}finally{e.close()}}function fr(){const e=a.DataFrame.fromColumns((0,li.dW)());s.shell.addTableView(e)}function gr(){const e=a.DataFrame.fromColumns([(0,li.Hx)(me.Hi.FASTA)]);s.shell.addTableView(e)}function yr(){const e=a.DataFrame.fromColumns([(0,li.Hx)(me.Hi.HELM)]);s.shell.addTableView(e)}function br(e,t){!function(e,t){const n=fe.GO.forColumn(e.column),i=Object.values(me.Hi).filter((e=>e!==n.units));t.group("Copy").items(i,(t=>{const n=e.column,i=e.rowIndex,r=fe.GO.forColumn(n),o=t===me.Hi.SEPARATOR?di.properties.defaultSeparator:void 0,a=r.getJoiner({notation:t,separator:o})(r.getSplitted(i));navigator.clipboard?(navigator.clipboard.writeText(a),s.shell.info(`Value of notation '${t}' copied to clipboard`)):s.shell.warning("The clipboard functionality requires a secure origin — either HTTPS or localhost")}))}(e,t)}async function vr(){await async function(){let e,t;try{const n=new tn("Similarity, Diversity","Sequence similarity tracking and evaluation dataset diversity",!1,{autoStartFirstStep:!0});await n.step("Load DNA sequences",(async()=>{s.shell.windows.showContextPanel=!1,s.shell.windows.showProperties=!1,t=await di.files.readCsv(rn),e=s.shell.addTableView(t),e.grid.columns.byName("cluster").visible=!1,e.grid.columns.byName("sequence_id").visible=!1,e.grid.columns.byName("sequence").width=300,e.grid.columns.byName("activity").visible=!1,e.grid.columns.byName("is_cliff").visible=!1}),{description:"Load dataset with macromolecules of 'fasta' notation, 'DNA' alphabet.",delay:2e3}).step("Find the most similar sequences to the current one",(async()=>{const t=new bt(!0);e.addViewer(t,{moleculeColumnName:"sequence",similarColumnLabel:"Similar to current"}),e.dockManager.dock(t,a.DOCK_TYPE.RIGHT,null,"Similarity search",.35)}),{description:"Add 'Sequence Similarity Search' viewer.",delay:2e3}).step("Explore most diverse sequences in a dataset",(async()=>{const n=await t.plot.fromType("Sequence Diversity Search",{moleculeColumnName:"sequence",diverseColumnLabel:"Top diverse sequences of all data"});e.dockManager.dock(n,a.DOCK_TYPE.DOWN,null,"Diversity search",.27)}),{description:"Add 'Sequence Deversity Search' viewer.",delay:2e3}).step("Choose another sequence for similarity search",(async()=>{t.currentRowIdx=3}),{description:"Handling current row changed of data frame showing update of similar sequences.",delay:2e3}).step("One more sequence for similarity search",(async()=>{t.currentRowIdx=7}),{description:"Just one more sequence to search similar ones.",delay:2e3}).start()}catch(e){nn(e)}}()}async function wr(){await async function(){let e,t,n,i,r;try{const o=new tn("Sequence Space","Exploring sequence space of Macromolecules, comparison with hierarchical clustering results",!1,{autoStartFirstStep:!0});await o.step("Load DNA sequences",(async()=>{[i,e,t]=await Promise.all([di.files.readCsv(pn),sn(),on()]),n=s.shell.addTableView(i),n.grid.props.rowHeight=22,n.grid.columns.byName("cluster").visible=!1,n.grid.columns.byName("sequence").width=200,n.grid.columns.byName("is_cliff").visible=!1,s.shell.windows.showContextPanel=!1,s.shell.windows.showProperties=!1}),{description:"Load dataset with macromolecules of 'fasta' notation, 'DNA' alphabet.",delay:2e3}).step("Build sequence space",(async()=>{r=await async function(e,t,n){let i;{const e=Object.values(Qt);for(let n=0;n<e.length;n++){const i=e[n];if(!t.col(i)){const r=n==e.length-1;t.columns.add(a.Column.float(i,t.rowCount),r)}}if(t.rowCount>=1){const i=t.getCol(n).toList(),r=Date.now();di.logger.debug("Bio: demoBio01aUI(), calc reduceDimensionality start...");const s=await q([i],"UMAP",[ot.xL.Levenshtein],[1],"MANHATTAN",{distanceFnArgs:[{}]}),o=Date.now();di.logger.debug(`Bio: demoBio01aUI(), calc reduceDimensionality ET: ${(o-r)/1e3} s`);for(let n=0;n<e.length;n++){const i=e[n],r=t.getCol(i),o=s[n];r.init((e=>o[e]))}const a=Date.now();di.logger.debug(`MLB: MlbVrSpaceBrowser.buildView(), postprocess reduceDimensionality ET: ${(a-o)/1e3} s`)}i=await t.plot.fromType(a.VIEWER.SCATTER_PLOT,{xColumnName:Qt.X,yColumnName:Qt.Y,lassoTool:!0})}return e.dockManager.dock(i,a.DOCK_TYPE.RIGHT,null,"Sequence Space",.35),i}(n,i,mn),r.setOptions({color:"activity"})}),{description:"Reduce sequence space dimensionality to display on 2D representation.",delay:2e3}).step("Cluster sequences",(async()=>{const r=await e.calcDistanceMatrix(i,[mn]),s=await ln(r.data,i.rowCount,1),o=e.parseClusterMatrix(s);t.injectTreeForGrid(n.grid,o,void 0,150,void 0)}),{description:"Perform hierarchical clustering to reveal relationships between sequences.",delay:2e3}).step("Select a sequence",(async()=>{i.selection.set(65,!0)}),{description:"Handling selection of data frame row reflecting on linked viewers.",delay:2e3}).step("Select a bunch of sequences",(async()=>{[67,72,77,82,83,84,85,91,93].forEach((e=>i.selection.set(e,!0))),i.currentRowIdx=27}),{description:"Selecting a group of rows from a data frame to show their similarity and proximity to each other on a viewer..",delay:2e3}).start()}catch(e){nn(e)}}()}async function Cr(){await async function(){let e,t,n,i,r;const o=c.c.UMAP;try{const l=new tn("Activity Cliffs","Activity Cliffs analysis on Macromolecules data",!1,{autoStartFirstStep:!0});await l.step("Load DNA sequences",(async()=>{s.shell.windows.showContextPanel=!1,s.shell.windows.showProperties=!1,[n,e,t]=await Promise.all([di.files.readCsv(fn),sn(),on()]),i=s.shell.addTableView(n),i.grid.props.rowHeight=22,i.grid.columns.byName("cluster").visible=!1,i.grid.columns.byName("sequence").width=300,i.grid.columns.byName("is_cliff").visible=!1}),{description:"Load dataset with macromolecules of 'fasta' notation, 'DNA' alphabet.",delay:2e3}).step("Find activity cliffs",(async()=>{const e=a.Func.find({name:"macromoleculePreprocessingFunction",package:"Bio"})[0];r=await Fi(n,n.getCol("Sequence"),n.getCol("Activity"),80,o,rt.Z.LEVENSHTEIN,e,{},!0),i.dockManager.dock(r,a.DOCK_TYPE.RIGHT,null,"Activity Cliffs",.35),Yt()(r.root).find("button.scatter_plot_link,cliffs_grid").get()[0].click()}),{description:"Reveal similar sequences with a cliff of activity.",delay:2e3}).step("Cluster sequences",(async()=>{const r=a.TaskBarProgressIndicator.create("Running sequence clustering..."),s=await e.calcDistanceMatrix(n,["sequence"]),o=await ln(s.data,n.rowCount,1),l=e.parseClusterMatrix(o);r.close(),t.injectTreeForGrid(i.grid,l,void 0,150,void 0),i.grid.columns.byName("Activity").scrollIntoView()}),{description:"Perform hierarchical clustering to reveal relationships between sequences.",delay:2e3}).step("Browse the cliff",(async()=>{const e=r.dataFrame.temp[".cliffsDfGrid"];e.dataFrame.rowCount>0&&(e.dataFrame.currentRowIdx=0)}),{description:"Zoom in to explore selected activity cliff details.",delay:2e3}).start()}catch(e){nn(e)}}()}async function Ar(){await async function(){const e="HELM";let t,n,i;try{await new tn("Atomic Level","Atomic level structure of Macromolecules",!1,{autoStartFirstStep:!0}).step("Loading Macromolecules notation 'Helm'",(async()=>{s.shell.windows.showContextPanel=!1,s.shell.windows.showProperties=!1,t=await di.files.readCsv("samples/HELM.csv"),n=s.shell.addTableView(t);for(let t=0;t<n.grid.columns.length;t++){const i=n.grid.columns.byIndex(t);[e,"Activity"].includes(i.name)||(i.visible=!1)}}),{description:"Load dataset with macromolecules of 'fasta' notation, 'PT' alphabet (protein, aminoacids).",delay:2e3}).step("To atomic level",(async()=>{const n=t.getCol(e);await ji(t,n,!1)}),{description:"Get atomic level structures of Macromolecules.",delay:2e3}).step("Sketcher",(async()=>{const n=`molfile(${e})`;t.currentCell=t.cell(1,n);const r=t.currentCell.value,s=new a.chem.Sketcher(a.chem.SKETCHER_MODE.INPLACE);s.setMolFile(r),i=o.dialog().add(s).show(),await(0,ze.cb)(3e3),i.close()}),{description:"Display atomic level structure within a sketcher.",delay:2e3}).start()}catch(e){nn(e)}}()}async function Sr(){await async function(){let e,t,n,i,r,o;const l="msa(HELM)",h=c.c.UMAP,d=(await gn.Nk.getDockerContainer()).id,p=gn.Nk.getDockerContainer();let m,f;try{const c=new tn("Helm, MSA, Sequence Space","MSA and composition analysis on Helm data",!1,{autoStartFirstStep:!0});await c.step("Load peptides with non-natural aminoacids in 'HELM' notation",(async()=>{[m,t]=await Promise.all([(async()=>(await p).status)(),di.files.readCsv(yn)]),e=s.shell.addTableView(t),s.shell.windows.showContextPanel=!1,s.shell.windows.showProperties=!1,"started"===m||"checking"===m?(di.logger.debug(`demoBio05UI(), PepSeA ('${gn.Nk.dcName}') docker container status = '${m}'.`),f=Promise.resolve()):(di.logger.warning(`demoBio05UI(), PepSeA ('${gn.Nk.dcName}') docker container is trying to start...`),await s.dapi.docker.dockerContainers.run(d),f=async function(e,t,n=3e4,i){const r=window.performance.now(),o=new u.Subject,a=async()=>{const n=await s.dapi.docker.dockerContainers.find(e);return n.status===t&&o.next(n),n};let l;try{await(0,ze.PE)(o,(e=>{const n=window.performance.now();i.debug(`awaitStatus(), docker container ('${e.name}') GET status = '${t}' in ${n-r} ms.`)}),(async()=>{const e=await a();i.debug(`awaitStatus(), docker container ('${e.name}') HAS status = '${e.status}'.`),l=window.setInterval(a,200)}),n)}finally{window.clearInterval(l)}}(d,"started",3e4,di.logger))}),{description:"Load dataset with macromolecules of 'Helm' notation.",delay:2e3}).step("Align peptides with non-natural aminoacids with PepSeA",(async()=>{const e=a.TaskBarProgressIndicator.create("MSA by PepSeA ...");try{await f,n=t.getCol("HELM");const e=gn.ZY[0],r=1.53,o=0;if(i=await(0,gn.GD)(n,l,e,r,o,void 0),!i)throw new Error("Empty MSA result.");t.columns.add(i),await s.data.detectSemanticTypes(t)}finally{e.close()}}),{description:"Multiple sequence alignment (MSA) performed with PepSeA tool operating on non-natural aminoacids as well.",delay:2e3}).step("Build sequence space",(async()=>{const n=a.Func.find({package:"Bio",name:"macromoleculePreprocessingFunction"})[0];o=await Vi(t,i,h,rt.Z.LEVENSHTEIN,!0,n),e.dockManager.dock(o,a.DOCK_TYPE.RIGHT,null,"Sequence Space",.35)}),{description:"Reduce sequence space dimensionality to display on 2D representation.",delay:2e3}).step("Analyse sequence composition",(async()=>{r=await t.plot.fromType("WebLogo",{sequenceColumnName:l,positionWidth:40,maxHeight:50}),e.dockManager.dock(r,a.DOCK_TYPE.DOWN,null,"Composition analysis",.2)}),{description:"Composition analysis allows to reveal functional features of sequences like motifs, or variable loops.",delay:2e3}).start()}catch(e){nn(e)}}()}async function xr(e){const t=(0,ye.uX)(e),n=JSON.stringify(t);a.Utils.download(`${e.name}.json`,n)}async function Er(e,t,n){const i=await e.readAsString();await async function(e,t,n){const i=a.TaskBarProgressIndicator.create("detectMacromolecule probe ...");try{let r=0;const o=await s.functions.call("Bio:detectMacromoleculeEnableStore");let l=0;for(let c=0;c<n;++c){const u=a.DataFrame.fromCsv(e),h=t?u.getCol(t):u.columns.byIndex(0);await s.functions.call("Bio:detectMacromolecule",{col:h})!==a.SEMTYPE.MACROMOLECULE&&(++l,console.warn(`Reject reason: ${o.last.rejectReason}`));const d=c/n;d-r>=.1&&(r=d,i.update(100*d,`detectMacromolecule probe ${l}/${c}/${n} ...`),await(0,ze.cb)(0))}l>0?s.shell.warning(`detectMacromolecule failed ${l} / ${n}`):s.shell.info(`detectMacromolecule success ${n}`)}finally{i.close()}}(i,t,n)}async function _r(e,t,n){return ii(e,t,n)}function Mr(e,t){e.temp[fe.j8.notationProvider]=new ci(t)}},6625:(e,t,n)=>{"use strict";n.d(t,{$:()=>s});class i{value;parentI;parentJ;constructor(){this.value=0,this.parentI=0,this.parentJ=0}}class r{seq1;seq2;score;constructor(e,t,n){this.seq1=e,this.seq2=t,this.score=n}}class s{seq1="";seq2="";gap=1;len1=0;len2=0;step=1;alignGrid=[];scores=[];dpGrid=[];connections={};BLOSUM45=[[5,-2,-1,-2,-1,-1,-1,0,-2,-1,-1,-1,-1,-2,-1,1,0,-2,-2,0,-1,-1,0,-5],[-2,7,0,-1,-3,1,0,-2,0,-3,-2,3,-1,-2,-2,-1,-1,-2,-1,-2,-1,0,-1,-5],[-1,0,6,2,-2,0,0,0,1,-2,-3,0,-2,-2,-2,1,0,-4,-2,-3,4,0,-1,-5],[-2,-1,2,7,-3,0,2,-1,0,-4,-3,0,-3,-4,-1,0,-1,-4,-2,-3,5,1,-1,-5],[-1,-3,-2,-3,12,-3,-3,-3,-3,-3,-2,-3,-2,-2,-4,-1,-1,-5,-3,-1,-2,-3,-2,-5],[-1,1,0,0,-3,6,2,-2,1,-2,-2,1,0,-4,-1,0,-1,-2,-1,-3,0,4,-1,-5],[-1,0,0,2,-3,2,6,-2,0,-3,-2,1,-2,-3,0,0,-1,-3,-2,-3,1,4,-1,-5],[0,-2,0,-1,-3,-2,-2,7,-2,-4,-3,-2,-2,-3,-2,0,-2,-2,-3,-3,-1,-2,-1,-5],[-2,0,1,0,-3,1,0,-2,10,-3,-2,-1,0,-2,-2,-1,-2,-3,2,-3,0,0,-1,-5],[-1,-3,-2,-4,-3,-2,-3,-4,-3,5,2,-3,2,0,-2,-2,-1,-2,0,3,-3,-3,-1,-5],[-1,-2,-3,-3,-2,-2,-2,-3,-2,2,5,-3,2,1,-3,-3,-1,-2,0,1,-3,-2,-1,-5],[-1,3,0,0,-3,1,1,-2,-1,-3,-3,5,-1,-3,-1,-1,-1,-2,-1,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,-4,-14,-3,-4,-7,-6,-6,-8,7,-2,-14,-6,-4,-3,-12,-9,-9,-2,-4,-5,-17],[-5,-4,-9,-11,-13,-4,-7,-8,-10,-1,1,-2,11,-4,-8,-5,-4,-13,-11,-1,-10,-5,-5,-17],[-8,-9,-9,-15,-13,-13,-14,-9,-6,-2,-3,-14,-4,9,-10,-6,-9,-4,2,-8,-10,-13,-8,-17],[-2,-4,-6,-8,-8,-3,-5,-6,-4,-8,-7,-6,-8,-10,8,-2,-4,-14,-13,-6,-7,-4,-5,-17],[0,-3,0,-4,-3,-5,-4,-2,-6,-7,-8,-4,-5,-6,-2,6,0,-5,-7,-6,-1,-5,-3,-17],[-1,-6,-2,-5,-8,-5,-6,-6,-7,-2,-7,-3,-4,-9,-4,0,7,-13,-6,-3,-3,-6,-4,-17],[-13,-2,-8,-15,-15,-13,-17,-15,-7,-14,-6,-12,-13,-4,-14,-5,-13,13,-5,-15,-10,-14,-11,-17],[-8,-10,-4,-11,-4,-12,-8,-14,-3,-6,-7,-9,-11,2,-13,-7,-6,-5,10,-7,-6,-9,-7,-17],[-2,-8,-8,-8,-6,-7,-6,-5,-6,2,-2,-9,-1,-8,-6,-6,-3,-15,-7,7,-8,-6,-5,-17],[-3,-7,6,6,-12,-3,1,-3,-1,-6,-9,-2,-10,-10,-7,-1,-3,-10,-6,-8,6,0,-5,-17],[-3,-4,-3,1,-14,6,6,-5,-1,-6,-7,-4,-5,-13,-4,-5,-6,-14,-9,-6,0,6,-5,-17],[-3,-6,-3,-5,-9,-5,-5,-5,-5,-5,-6,-5,-5,-8,-5,-3,-4,-11,-7,-5,-5,-5,-5,-17],[-17,-17,-17,-17,-17,-17,-17,-17,-17,-17,-17,-17,-17,-17,-17,-17,-17,-17,-17,-17,-17,-17,-17,1]];PAM70=[[5,-4,-2,-1,-4,-2,-1,0,-4,-2,-4,-4,-3,-6,0,1,1,-9,-5,-1,-1,-1,-2,-11],[-4,8,-3,-6,-5,0,-5,-6,0,-3,-6,2,-2,-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-10.4,-50,-11.6,-7.2,-5.7,-7.5,-7.4,-50,-8.6,-15.7,-9.7,-3,-3.7,-3.2,-5.9],[-11.1,-11.9,-10.6,-11.3,-2.6,-4.1,-1.7,-3.5,-11.4,-9.6,-9.6,-9.2,3.7,2.5,1.6,2.5,-9.6,-12.3,-9.5,-11.8,-8,-9.4,-7.2,-9.3,-13.3,-12.8,-10.9,-12.6,-1.8,-2.9,-.8,-2.9,-8.6,-13,-7.4,-12.4,-.4,-2.3,1.3,-2,-8.1,-9.3,-5.4,-8.4,10,8.6,11.4,8.9,-50,-13.7,-50,-13.2,-6.1,-8.1,-5.5,-7.5,-50,-11.3,-12.7,-10.1,-1.6,-7.8,-.3,-7.2],[-11.4,-10,-12.7,-8.2,-3.1,-3.1,-2.8,-.9,-11.7,-7.3,-12.1,-5.8,3.6,3.6,-1.1,5.8,-9.4,-11.9,-10.7,-10,-8.5,-8.8,-8.2,-6.5,-13.9,-13,-12.9,-10.9,-3.1,-2.3,-3.2,-.2,-9.5,-10.8,-10.2,-8.2,-1.1,-1.3,-.8,1.2,-8.6,-7.8,-7.8,-5,9,9.5,8.9,12,-50,-13,-50,-10.3,-6.2,-7,-7.1,-5.4,-50,-9.3,-14,-8.2,-2.4,-6.3,-2.4,-3.9],[-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,33.3,-50,30.6,-50,-50,-50,-50,-50,29.2,-50,-50,-50,-50,-50,-50,-50],[-14.8,-6.2,-14.9,-7.6,-14.6,-11.6,-13,-12.2,-14,-9,-14.1,-10.1,-13.6,-11.2,-12.4,-12.5,-8.1,2.2,-8.7,.4,-15.3,-11.3,-13.2,-13.3,-11.9,-7.2,-11.8,-7.9,-10.7,-7.4,-10.8,-8.9,-15.5,-10.3,-15.5,-12.5,-14.5,-12.1,-11.9,-12.8,-18.3,-12.7,-16.4,-14.7,-14.2,-10.4,-13.7,-13,-50,15.1,-50,13.3,-9.9,-5.8,-8.9,-7.6,-50,-1.5,-7.8,-3,-8.1,3.6,-9.4,2],[-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,30.6,-50,35.2,-50,-50,-50,-50,-50,28.5,-50,-50,-50,-50,-50,-50,-50],[-13.8,-7.5,-14.4,-5.1,-12.6,-11.6,-11.5,-10.1,-13.2,-9.7,-12.7,-7.4,-11.9,-11.9,-11.5,-10.2,-7.2,.9,-8.6,2.6,-14.1,-12.8,-13.3,-11,-9.7,-8.4,-11.2,-5.3,-9.3,-8.7,-9.9,-7.1,-13.9,-11.2,-14.2,-8.9,-12.9,-12.6,-12.6,-10.9,-15.4,-13.8,-14.8,-11.4,-12.8,-11.6,-13.2,-10.3,-50,13.3,-50,15.2,-8.6,-7,-8.4,-4.8,-50,-3,-7.1,-.1,-7.3,2.3,-8.7,3.9],[-7.3,-6.3,-8.9,-5.5,2.9,.2,1.5,1.2,-8.5,-2.3,-10,-1.7,-5.6,-10.5,-5.5,-9.6,-4.3,-7.9,-6.1,-7.2,2.3,-.6,.5,-0,-8.9,-11,-9.4,-9.3,-4.6,-9.4,-7.3,-8.1,-7.8,-9.8,-8.9,-9.2,2.8,.1,1.2,.8,-5.9,-6.8,-5.9,-6.3,-4.1,-7.2,-6.1,-6.2,-50,-9.9,-50,-8.6,12.5,9.4,11,9.8,-50,-4.8,-8.7,-3.5,-0,-8.6,-2.1,-7],[-10.1,-4.3,-10.8,-5.8,.1,2.3,.7,.6,-10.4,-.2,-10.8,-2,-8.8,-9.2,-8,-9.7,-6.8,-5.9,-7.5,-7,-1.4,2.2,-.9,-.4,-10.8,-7.7,-9.8,-8.8,-8.9,-7.3,-9.6,-9.1,-10.5,-8.3,-10.2,-10,-0,2.5,.7,.5,-7.5,-5.1,-7.1,-6.7,-7.4,-5.7,-8.1,-7,-50,-5.8,-50,-7,9.4,12.7,10.1,10,-50,-1.5,-11.3,-3.3,-5.4,-4.2,-5.6,-6.8],[-8.4,-6.2,-8.9,-5.9,1.8,.4,2.7,1.2,-9.1,-1.2,-8.8,-1.5,-7.2,-10.5,-4.9,-9.6,-5.7,-7.4,-5.5,-7.4,.3,-.3,1.8,-.4,-9,-8.7,-7.3,-8.9,-5.9,-9.4,-6.4,-8.7,-8.7,-9.1,-8.5,-9.4,1.4,.7,3.5,.7,-6.6,-5.3,-4.7,-5.8,-5.7,-7.5,-5.5,-7.1,-50,-8.9,-50,-8.4,11,10.1,13.2,10.2,-50,-4.2,-6.1,-3.6,-3.5,-8.4,-1.2,-6.8],[-9.1,-5.4,-10.4,-4.2,1,.5,.6,2.4,-9.6,-1.5,-10.5,-.5,-8.9,-10.5,-7.2,-8.3,-6.3,-6.9,-7.7,-5.1,-.5,.1,-.6,2.3,-11.1,-10.2,-10.5,-7,-8.3,-9.4,-9.4,-6.6,-9.6,-9.7,-10,-7.9,.7,.6,.8,2.3,-7.1,-6.5,-7.2,-5,-6.5,-7.4,-7.5,-5.4,-50,-7.6,-50,-4.8,9.8,10,10.2,12.1,-50,-3.1,-11.4,-.7,-4.6,-6.6,-4.9,-3.9],[-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,29.2,-50,28.5,-50,-50,-50,-50,-50,33.3,-50,-50,-50,-50,-50,-50,-50],[-13,-7,-13.1,-8.3,-9.2,-6.5,-8.9,-7.6,-9.8,-.7,-9.2,-2.1,-12.4,-10.3,-12.4,-11.6,-9.5,-4.6,-10.4,-5.7,-13.6,-10.1,-11.4,-10.9,-6.5,-1.5,-6.2,-3.6,-12.8,-8,-12.3,-9.7,-16.5,-12.7,-15.6,-14.3,-8.7,-6,-7.1,-7.5,-9.5,-4.1,-8.4,-6.1,-11,-8.6,-11.3,-9.3,-50,-1.5,-50,-3,-4.8,-1.5,-4.2,-3.1,-50,16.4,-5.1,14.2,-10.1,-4.3,-10,-5.4],[-13.5,-16.3,-11.8,-15.5,-13.6,-15.3,-12.1,-16.1,-7.7,-13.3,-4.2,-12.6,-14.1,-16.2,-10.3,-15.4,-9.6,-11.6,-7.7,-9.8,-14.3,-17.5,-11.1,-17.2,-5.3,-7.1,-2.2,-7.1,-9.6,-11.9,-8.7,-11.4,-17.1,-20.6,-15.3,-19.9,-14.1,-14.8,-12.4,-16.5,-11.7,-12.8,-6.4,-13.4,-14.3,-15.7,-12.7,-14,-50,-7.8,-50,-7.1,-8.7,-11.3,-6.1,-11.4,-50,-5.1,18.6,-4.8,-8.6,-8.1,-4.5,-7.3],[-12.4,-8.2,-13,-5.9,-7.7,-7.8,-7.4,-5.8,-8.8,-2,-9.3,-.4,-11.6,-11.3,-11.6,-9.4,-8.9,-5.6,-10,-3.2,-11.5,-11.1,-10.5,-8.3,-6.3,-4.9,-6.7,-1.2,-10.6,-9.7,-11.3,-8,-14.8,-13.1,-15.5,-11.4,-7.5,-7.5,-7.1,-5.9,-8.4,-5.8,-8.1,-3.6,-9.9,-9.7,-10.1,-8.2,-50,-3,-50,-.1,-3.5,-3.3,-3.6,-.7,-50,14.2,-4.8,16.4,-8.9,-5.8,-8.9,-3.4],[-10.7,-13.2,-12.4,-11.6,-4.8,-8.4,-6.1,-7.2,-10.3,-11.8,-11,-11.6,2.8,-1.7,.7,-1.1,-6.2,-9.7,-7.3,-8.4,-5.3,-8.6,-6.1,-8.3,-10.5,-11.2,-9.8,-10.2,9.5,6.5,7.6,6.8,-12.1,-16,-13,-16.2,-5.2,-8.6,-7.1,-7.8,-12.5,-14.4,-12.1,-13,1.4,-3,-1.6,-2.4,-50,-8.1,-50,-7.3,-0,-5.4,-3.5,-4.6,-50,-10.1,-8.6,-8.9,13.2,-.9,9.7,-.3],[-18.1,-12.3,-19.4,-14.2,-12.2,-9.5,-11.5,-10.8,-17.9,-11.9,-18.2,-13.9,-6.4,-3.7,-6.8,-5.4,-12.8,-5.9,-13.6,-7.4,-13.7,-9.9,-12.9,-12.7,-16.2,-11.6,-15.2,-12.7,-3.2,.5,-3.3,-1.8,-18.9,-16.6,-18.8,-19.2,-12.5,-9.4,-10.6,-11.1,-17.3,-14.1,-16.2,-16,-7.9,-3.7,-7.8,-6.3,-50,3.6,-50,2.3,-8.6,-4.2,-8.4,-6.6,-50,-4.3,-8.1,-5.8,-.9,14.2,-1.8,11.6],[-11.8,-13.1,-11.5,-12,-6.2,-8.3,-5.4,-7.4,-11.8,-12.3,-11.1,-11.4,.5,-2.5,2.4,-1.6,-6.8,-9.9,-6.4,-8.9,-6.1,-8.6,-5,-7.8,-10.4,-11.6,-8.5,-9.9,8.2,6.4,8.7,6.9,-12.4,-17,-12.6,-15.8,-6.5,-8.5,-5,-7.8,-13.2,-13.6,-10.3,-13.7,-.7,-3.2,-.3,-2.4,-50,-9.4,-50,-8.7,-2.1,-5.6,-1.2,-4.9,-50,-10,-4.5,-8.9,9.7,-1.8,11.3,-.9],[-17.2,-13.3,-17.8,-11.6,-11,-11.1,-10.4,-9,-16,-12.7,-16.1,-11.1,-5.2,-5.4,-6,-3.3,-11.8,-7.3,-13.3,-5.9,-12.7,-11.9,-11.9,-9.3,-15.2,-15,-14.9,-11,-2.8,-1.8,-2.9,.4,-17.4,-18.4,-18.3,-15.9,-10.7,-11.2,-10.6,-9,-15.4,-14.8,-15.8,-13.3,-6.8,-5.9,-7.2,-3.9,-50,2,-50,3.9,-7,-6.8,-6.8,-3.9,-50,-5.4,-7.3,-3.4,-.3,11.6,-.9,14.1]];TRANS=[[5,0,0,4],[0,5,4,0],[0,4,5,0],[4,0,0,5]];CONBLO={A:0,R:1,N:2,D:3,C:4,Q:5,E:6,G:7,H:8,I:9,L:10,K:11,M:12,F:13,P:14,S:15,T:16,W:17,Y:18,V:19,B:20,Z:21,X:22,"*":23};CONNUCL={A:0,T:1,C:2,G:3};CONSCHN={AAA:0,AAC:1,AAG:2,AAT:3,ACA:4,ACC:5,ACG:6,ACT:7,AGA:8,AGC:9,AGG:10,AGT:11,ATA:12,ATC:13,ATG:14,ATT:15,CAA:16,CAC:17,CAG:18,CAT:19,CCA:20,CCC:21,CCG:22,CCT:23,CGA:24,CGC:25,CGG:26,CGT:27,CTA:28,CTC:29,CTG:30,CTT:31,GAA:32,GAC:33,GAG:34,GAT:35,GCA:36,GCC:37,GCG:38,GCT:39,GGA:40,GGC:41,GGG:42,GGT:43,GTA:44,GTC:45,GTG:46,GTT:47,TAA:48,TAC:49,TAG:50,TAT:51,TCA:52,TCC:53,TCG:54,TCT:55,TGA:56,TGC:57,TGG:58,TGT:59,TTA:60,TTC:61,TTG:62,TTT:63};fillNeedleman(){for(let e=0;e<=this.len1;e++)this.dpGrid[e][0].value=-e*this.gap,this.dpGrid[e][0].parentI=e-1,this.dpGrid[e][0].parentJ=0;for(let e=1;e<=this.len2;e++)this.dpGrid[0][e].value=-e*this.gap,this.dpGrid[0][e].parentI=0,this.dpGrid[0][e].parentJ=e-1}fillOne(e,t){this.dpGrid[e][t].value=Math.max(this.dpGrid[e-1][t-1].value+this.scores[e-1][t-1],Math.max(this.dpGrid[e-1][t].value-this.gap,this.dpGrid[e][t-1].value-this.gap)),this.dpGrid[e][t].value==this.dpGrid[e-1][t-1].value+this.scores[e-1][t-1]?(this.dpGrid[e][t].parentI=e-1,this.dpGrid[e][t].parentJ=t-1):this.dpGrid[e][t].value==this.dpGrid[e-1][t].value-this.gap?(this.dpGrid[e][t].parentI=e-1,this.dpGrid[e][t].parentJ=t):(this.dpGrid[e][t].parentI=e,this.dpGrid[e][t].parentJ=t-1)}gridFromName(e){switch(e){case"BLOSUM45":this.alignGrid=this.BLOSUM45,this.connections=this.CONBLO,this.step=1;break;case"BLOSUM50":this.alignGrid=this.BLOSUM50,this.connections=this.CONBLO,this.step=1;break;case"BLOSUM62":this.alignGrid=this.BLOSUM62,this.connections=this.CONBLO,this.step=1;break;case"BLOSUM80":this.alignGrid=this.BLOSUM80,this.connections=this.CONBLO,this.step=1;break;case"BLOSUM90":this.alignGrid=this.BLOSUM90,this.connections=this.CONBLO,this.step=1;break;case"PAM30":this.alignGrid=this.PAM30,this.connections=this.CONBLO,this.step=1;break;case"PAM70":this.alignGrid=this.PAM70,this.connections=this.CONBLO,this.step=1;break;case"PAM250":this.alignGrid=this.PAM250,this.connections=this.CONBLO,this.step=1;break;case"NUCLEOTIDES":this.alignGrid=this.NUCLEOTIDES,this.connections=this.CONNUCL,this.step=1;break;case"TRANS":this.alignGrid=this.TRANS,this.connections=this.CONNUCL,this.step=1;break;case"SCHNEIDER":this.alignGrid=this.SCHNEIDER,this.connections=this.CONSCHN,this.step=3}this.fillScores()}constructResult(e,t){let n="",i="",s="";const o=this.dpGrid[e][t].value;for(let e=0;e<this.step;e++)s+="|";for(;e>0||t>0;){this.dpGrid[e][t].parentI==e?(n=s+n,i=this.seq2.substr((t-1)*this.step,this.step)+i):this.dpGrid[e][t].parentJ==t?(i=s+i,n=this.seq1.substr((e-1)*this.step,this.step)+n):(n=e-1>=0?this.seq1.substr((e-1)*this.step,this.step)+n:s+n,i=t-1>=0?this.seq2.substr((t-1)*this.step,this.step)+i:s+i);const r=e;e=this.dpGrid[e][t].parentI,t=this.dpGrid[r][t].parentJ}return new r(n,i,o)}fillScores(){this.scores=[];for(let e=0;e<this.len1;e++){this.scores.push([]);for(let t=0;t<this.len2;t++)this.scores[e].push(this.alignGrid[this.connections[this.seq1.substr(e*this.step,this.step)]][this.connections[this.seq2.substr(t*this.step,this.step)]])}}typeRec(){if(/[ATGC]*/.test(this.seq1)&&/[ATGC]*/.test(this.seq2))return"NUCLEOTIDES";if(/[ARNDCQEGHILKMFPSTWYVBZX*]*/.test(this.seq1)&&/[ARNDCQEGHILKMFPSTWYVBZX*]*/.test(this.seq2))return"BLOSUM62";throw Error("Can't recognize sequence type")}needlemanWunch(){this.dpGrid=[];for(let e=0;e<this.len1+1;e++){const e=[];for(let t=0;t<this.len2+1;t++)e.push(new i);this.dpGrid.push(e)}this.fillNeedleman();for(let e=1;e<=this.len1;e++)for(let t=1;t<=this.len2;t++)this.fillOne(e,t);return this.constructResult(this.len1,this.len2)}smithWaterman(){this.dpGrid=[];for(let e=0;e<this.len1+1;e++){const e=[];for(let t=0;t<this.len2+1;t++)e.push(new i);this.dpGrid.push(e)}let e=0,t=0,n=0;for(let i=1;i<=this.len1;i++)for(let r=1;r<=this.len2;r++)this.fillOne(i,r),this.dpGrid[i][r].value<=0?(this.dpGrid[i][r].value=0,this.dpGrid[i][r].parentI=0,this.dpGrid[i][r].parentJ=0):0==this.dpGrid[this.dpGrid[i][r].parentI][this.dpGrid[i][r].parentJ].value&&(this.dpGrid[i][r].parentI=0,this.dpGrid[i][r].parentJ=0),this.dpGrid[i][r].value>e&&(e=this.dpGrid[i][r].value,t=i,n=r);return this.constructResult(t,n)}setSequences(e,t){this.seq1=e,this.seq2=t,this.len1=this.seq1.length/this.step,this.len2=this.seq2.length/this.step,this.fillScores()}setGap(e){this.gap=e}setMethod(e=""){"AUTO"==e&&(e=this.typeRec()),this.gridFromName(e)}constructor(e,t,n,i=""){this.setMethod(i),this.setSequences(e,t),this.setGap(n)}}},8115:(e,t,n)=>{"use strict";n.d(t,{BQ:()=>m,a7:()=>h,if:()=>p,nI:()=>d});var i=n(4328),r=n(7389),s=n(6082),o=n(1407),a=n(4870),l=n(8070),c=n(2003);const u="substr_helm";class h{units;separator;inputsDiv;substructureInput;separatorInput;editHelmLink;columnsInput;grid;col;dialog;constructor(e){this.col=e[0],this.createUI()}editHelmLinkAction(){(0,a.K)(this.inputsDiv,this.grid.root),r.tools.waitForElementInDom(this.grid.root).then((()=>{setTimeout((()=>{this.grid.cell(u,0).element.children[0].dispatchEvent(new KeyboardEvent("keydown",{key:"Enter"}))}),100)}))}updateInputs(){const e=this.units===c.Hi.HELM?r.divV([this.columnsInput,this.editHelmLink]):this.units===c.Hi.SEPARATOR?r.inputs([this.columnsInput,this.substructureInput,this.separatorInput]):r.inputs([this.columnsInput,this.substructureInput]);(0,a.K)(this.inputsDiv,e)}updateNotationDiv(){this.units=this.col.meta.units,this.separator=this.col.getTag(c.gp.separator);const e=this.dialog.root.getElementsByClassName("notation-text")[0];e&&(e.textContent=`Notation: ${this.units}`)}createUI(){const e=i.shell.tv.dataFrame;this.columnsInput=r.input.column("Column",{table:e,value:this.col,onValueChanged:e=>{this.col=e.value,this.updateNotationDiv(),this.updateInputs()},filter:e=>e.semType===s.SEMTYPE.MACROMOLECULE}),this.substructureInput=r.input.string("Substructure",{value:""}),this.editHelmLink=r.link("Edit helm",(()=>this.editHelmLinkAction()),void 0,{style:{position:"relative",left:"95px"}});const t=s.DataFrame.create(1);t.columns.addNewString(u).init((e=>"")),t.col(u).semType=this.col.semType,t.col(u).meta.units=c.Hi.HELM,this.grid=t.plot.grid(),this.separatorInput=r.input.string("Separator",{value:this.separator}),this.inputsDiv=r.div(),this.units=this.col.meta.units,this.separator=this.col.getTag(c.gp.separator),this.updateInputs(),this.dialog=r.dialog("Substructure Search").add(r.divV([r.divText(`Notation: ${this.units}`,"notation-text"),this.inputsDiv])).onOK((async()=>{let e,n=this.units===c.Hi.HELM?t.get(u,0):this.substructureInput.value;this.units===c.Hi.SEPARATOR&&this.separatorInput.value!==this.separator&&""!==this.separatorInput.value&&(n=n.replaceAll(this.separatorInput.value,this.separator)),e=this.units===c.Hi.HELM?await p(n,this.col):d(n,this.col),this.col.dataFrame.filter.and(e)})).show()}}function d(e,t,n){const i=n?function(e,t){const n=`${t}`.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),i=e.charAt(0)===t,r=e.charAt(e.length-1)===t,s=e.replace(new RegExp(`^${n}|${n}$`,"g"),"");return i?r?`${n}${s}${n}`:`${n}${s}${n}|${n}${s}$`:r?`^${s}${n}|${n}${s}${n}`:`^${s}${n}|${n}${s}${n}|${n}${s}$`}(e,n):e,r=s.BitSet.create(t.length);for(let n=0;n<t.length;n++){const s=t.get(n);(s.match(i)||s===e)&&r.set(n,!0,!1)}return r}async function p(e,t){t.version!==t.temp["last-invalidated-version"]&&await m(t,!0);const n=s.Column.string("helm",1).init((t=>e));n.semType=s.SEMTYPE.MACROMOLECULE,n.meta.units=c.Hi.HELM;const r=await(0,o.R)(n,!0,t.temp["monomers-dict"]);return(await i.functions.call("Chem:searchSubstructure",{molStringsColumn:t.temp["monomeric-mols"],molString:r.get(0),molBlockFailover:""})).get(0)}async function m(e,t){const n=s.TaskBarProgressIndicator.create(`Invalidating molfiles for ${e.name}`);try{await(0,l.cb)(10);const n=new Map,i=await(0,o.R)(e,t,n);e.temp["monomeric-mols"]=i,e.temp["monomers-dict"]=n,e.temp["last-invalidated-version"]=e.version}finally{n.close()}}},966:(e,t,n)=>{"use strict";n.d(t,{V:()=>o});var i=n(4328),r=n(6082),s=n(826);function o(e,t,n=[],o=[],a=!0){const[l,c]=function(e,t,n=[],o=[]){let a=!0,l="";const c=s.GO.forColumn(e);if(e.semType!==r.SEMTYPE.MACROMOLECULE)i.shell.warning(t+" analysis is allowed for Macromolecules semantic type"),a=!1;else{const e=c.notation;if(n.length>0&&!n.some((t=>e.toUpperCase()==t.toUpperCase())))l=`${t} + ' analysis is allowed for Macromolecules with notation ${0==n.length?"any notation":`notation${n.length>1?"s":""} ${n.map((e=>`"${e}"`)).join(", ")} `}.`,a=!1;else if(!c.isHelm()){const e=c.alphabet;o.length>0&&!o.some((t=>e.toUpperCase()==t.toUpperCase()))&&(l=`${t} + ' analysis is allowed for Macromolecules with alphabet ${0==o.length?"any alphabet":`alphabet${o.length>1?"s":""} ${o.map((e=>`"${e}"`)).join(", ")}.`}.`,a=!1)}}return[a,l]}(e,t,n,o);return a&&!l&&i.shell.warning(c),l}},4139:(e,t,n)=>{"use strict";n.d(t,{HX:()=>u,J:()=>a,b9:()=>c,uF:()=>s});var i,r,s,o,a,l=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"}(i||(i={})),function(e){e.AAR="AAR",e.POSITION="Pos",e.SELECTION="selection"}(r||(r={})),function(e){e.MONOMER="Monomer",e.MACROMOLECULE_DIFFERENCE="MacromoleculeDifference",e.ACTIVITY="activity",e.ACTIVITY_SCALED="activityScaled"}(s||(s={})),function(e){e.CELL_CHANGING="isCellChanging"}(o||(o={})),function(e){e.SEPARATOR="."}(a||(a={}));const c="3.3.1",u={pepsea:{gapOpen:1.53,gapExtend:0,method:l.ZY[0]},kalign:{gapOpen:-1,gapExtend:-1,terminalGap:-1}}},5433:(e,t,n)=>{"use strict";n.d(t,{C:()=>d});var i=n(6082),r=n(7389),s=n(4328),o=n(1757),a=n.n(o),l=n(2003),c=n(826);let u=null,h=[];function d(e){let t=e??s.shell.t.columns.bySemType("Macromolecule");if(!t)throw new Error("No column with Macromolecule semantic type found");let n=c.GO.forColumn(t),o=n.notation;const d=r.divText("Current notation: "+o,{style:{"text-align":"center","font-weight":"bold","font-size":"14px",padding:"5px"}}),p=[l.Hi.FASTA,l.Hi.SEPARATOR,l.Hi.HELM],m=r.input.column("Column",{table:s.shell.t,value:t,onValueChanged:e=>{var s;(s=e.value).semType===i.SEMTYPE.MACROMOLECULE?(t=s,n=c.GO.forColumn(t),o=n.notation,o===l.Hi.HELM&&(y.value="/"),d.textContent="Current notation: "+o,g=p.filter((e=>e!==o)),v=r.input.choice("Convert to",{value:g[0],items:g,onValueChanged:b}),b(),u?.clear(),u?.add(r.div([d,m.root,v.root,y.root]))):m.value=t}}),f=["-",".","/"];let g=p.filter((e=>e!==o));const y=r.input.choice("Separator",{value:f[0],items:f}),b=()=>{v.value!==l.Hi.SEPARATOR?a()(y.root).hide():a()(y.root).show()};let v=r.input.choice("Convert to",{value:g[0],items:g,onValueChanged:b});b(),v.onChanged((()=>{b()})),null==u&&(u=r.dialog("Convert Sequence Notation").add(r.div([d,m.root,v.root,y.root])).onOK((async()=>{const e=v.value,n=e===l.Hi.SEPARATOR?y.value:void 0;await async function(e,t,n){const i=c.GO.forColumn(e).convert(t,n);e.dataFrame.columns.add(i);const r=await s.functions.call("Bio:detectMacromolecule",{col:i});return r&&(i.semType=r),await s.data.detectSemanticTypes(e.dataFrame),i}(t,e,n)})).show({x:350,y:100}),h.push(u.onClose.subscribe((e=>{h.forEach((e=>{e.unsubscribe()})),h=[],u=null}))))}},6740:(e,t,n)=>{"use strict";n.d(t,{m8:()=>o});var i=n(4328),r=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 i.dapi.docker.dockerContainers.find(e.id)),a(n)){s=!0;break}switch(n.status){case"stopped":await i.dapi.docker.dockerContainers.run(n.id);break;case"pending change":case"changing":break;case"error":throw new Error("Docker container error state.")}n=null,await(0,r.cb)(200)}if(!s)throw new Error("Docker container start timeout.")}(t,e)}function a(e){return"checking"===e.status||"started"===e.status}},1619:(e,t,n)=>{"use strict";n.d(t,{D:()=>I});var i=n(4328),r=n(6082),s=n(7389),o=n(8070),a=n(2003),l=n(826),c=n(608),u=n(8152),h=n(966),d=n(4139),p=n(6740),m=n(682),f=n(5072),g=n.n(f),y=n(7825),b=n.n(y),v=n(7659),w=n.n(v),C=n(5056),A=n.n(C),S=n(540),x=n.n(S),E=n(1113),_=n.n(E),M=n(6369),T={};async function I(e={}){return new Promise((async(t,n)=>{e.clustersCol??=null,e.pepsea??={},e.pepsea.method??=d.HX.pepsea.method,e.pepsea.gapOpen??=d.HX.pepsea.gapOpen,e.pepsea.gapExtend??=d.HX.pepsea.gapExtend;const a=e.col?.dataFrame??i.shell.t,l=e.col??a.columns.bySemType(r.SEMTYPE.MACROMOLECULE);if(null==l){const e="Multiple Sequence Alignment analysis requires a dataset with a macromolecule column.";return i.shell.warning(e),void n(new c.Ap(s.divText(e)))}const h=s.input.choice("Method",{value:e.pepsea.method,items:u.ZY});h.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: ${d.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]),b=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");b.classList.add("msa-params-button"),y.hidden=!0,b.prepend(s.icons.settings((()=>null)));const v=[h.root.style],w=[p.root.style,m.style];let C,A=l;const S=s.input.column("Sequence",{table:a,value:l,onValueChanged:async e=>{if(!e.value||e.value.semType!==r.SEMTYPE.MACROMOLECULE)return _.disabled=!0,await(0,o.cb)(0),void(S.value=A);A=e.value,_.disabled=!1,C=await $(S.value,a,v,w,h,x,f,g,p)},filter:e=>e.semType===r.SEMTYPE.MACROMOLECULE});S.setTooltip("Sequences column to use for alignment");const x=s.input.column("Clusters",{table:a,value:e.clustersCol});x.nullable=!0;const E=s.dialog("MSA").add(S).add(x).add(h).add(y).add(b).add(m).onOK((async()=>{await L(S,a,C,t,n)})),_=E.getButton("OK");if(S.fireChanged(),e.col)return C=await $(e.col,a,v,w,h,x,f,g,p),void await L(S,a,C,t,n);E.show()}))}async function L(e,t,n,s,o){let a=null;const l=r.TaskBarProgressIndicator.create("Analyze for MSA ...");try{if(e.fireChanged(),e.value.semType!==r.SEMTYPE.MACROMOLECULE)throw new Error("Chosen column has to be of Macromolecule semantic type");if(void 0===n)throw new Error("Invalid column format");if(a=await n(),null==a)return o("PepSeA container has not started");t.columns.add(a),await i.data.detectSemanticTypes(t),s(a)}catch(e){o(e)}finally{l.close()}}async function $(e,t,n,s,o,f,g,y,b){try{if(e.semType!==r.SEMTYPE.MACROMOLECULE)return;const i=t.columns.getUnusedName(`msa(${e.name})`);if((0,h.V)(e,e.name,[a.Hi.FASTA,a.Hi.SEPARATOR],[a.YI.DNA,a.YI.RNA,a.YI.PT],!1)){N(n,s,"kalign"),g.value=null,y.value=null,b.value=null;const t=l.GO.forColumn(e),r=t.isFasta()?e:t.convert(a.Hi.FASTA);return async()=>await(0,c.eE)(r,!1,i,f.value)}if((0,h.V)(e,e.name,[a.Hi.HELM],[],!1))return N(n,s,"pepsea"),g.value??=d.HX.pepsea.gapOpen,y.value??=d.HX.pepsea.gapExtend,async()=>(await(0,p.m8)(),(0,u.GD)(e,i,o.value,g.value,y.value,f.value));if((0,h.V)(e,e.name,[a.Hi.SEPARATOR],[a.YI.UN],!1)){const t=l.GO.forColumn(e).convert(a.Hi.HELM);return N(n,s,"pepsea"),g.value??=d.HX.pepsea.gapOpen,y.value??=d.HX.pepsea.gapExtend,async()=>(await(0,p.m8)(),(0,u.GD)(t,i,o.value,g.value,y.value,f.value))}return g.value=null,y.value=null,b.value=null,void N(n,s,"kalign")}catch(e){const t=e instanceof Error?e.message:e.toString();i.shell.error(t),m._package.logger.error(t)}}function N(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")}}T.styleTagTransform=_(),T.setAttributes=A(),T.insert=w().bind(null,"head"),T.domAPI=b(),T.insertStyleElement=x(),g()(M.A,T),M.A&&M.A.locals&&M.A.locals},608:(e,t,n)=>{"use strict";n.d(t,{Ap:()=>G,aZ:()=>B,eE:()=>F});var i=n(7389),r=n(6082),s=n(1991),o=n.n(s),a=n(3516),l=n(2003);const c=Symbol("Comlink.proxy"),u=Symbol("Comlink.endpoint"),h=Symbol("Comlink.releaseProxy"),d=Symbol("Comlink.thrown"),p=e=>"object"==typeof e&&null!==e||"function"==typeof e,m=new Map([["proxy",{canHandle:e=>p(e)&&e[c],serialize(e){const{port1:t,port2:n}=new MessageChannel;return f(e,t),[n,[n]]},deserialize:e=>(e.start(),y(e))}],["throw",{canHandle:e=>p(e)&&d in e,serialize({value:e}){let t;return t=e instanceof Error?{isError:!0,value:{message:e.message,name:e.name,stack:e.stack}}:{isError:!1,value:e},[t,[]]},deserialize(e){throw e.isError?Object.assign(new Error(e.value.message),e.value):e.value}}]]);function f(e,t=self){t.addEventListener("message",(function n(i){if(!i||!i.data)return;const{id:r,type:s,path:o}=Object.assign({path:[]},i.data),a=(i.data.argumentList||[]).map(x);let l;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":l=n;break;case"SET":t[o.slice(-1)[0]]=x(i.data.value),l=!0;break;case"APPLY":l=n.apply(t,a);break;case"CONSTRUCT":l=function(e){return Object.assign(e,{[c]:!0})}(new n(...a));break;case"ENDPOINT":{const{port1:t,port2:n}=new MessageChannel;f(e,n),l=function(e,t){return A.set(e,t),e}(t,[t])}break;case"RELEASE":l=void 0;break;default:return}}catch(e){l={value:e,[d]:0}}Promise.resolve(l).catch((e=>({value:e,[d]:0}))).then((e=>{const[i,o]=S(e);t.postMessage(Object.assign(Object.assign({},i),{id:r}),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 v(e,[],t)}function b(e){if(e)throw new Error("Proxy has been released and is not useable")}function v(e,t=[],n=function(){}){let i=!1;const r=new Proxy(n,{get(n,s){if(b(i),s===h)return()=>E(e,{type:"RELEASE",path:t.map((e=>e.toString()))}).then((()=>{g(e),i=!0}));if("then"===s){if(0===t.length)return{then:()=>r};const n=E(e,{type:"GET",path:t.map((e=>e.toString()))}).then(x);return n.then.bind(n)}return v(e,[...t,s])},set(n,r,s){b(i);const[o,a]=S(s);return E(e,{type:"SET",path:[...t,r].map((e=>e.toString())),value:o},a).then(x)},apply(n,r,s){b(i);const o=t[t.length-1];if(o===u)return E(e,{type:"ENDPOINT"}).then(x);if("bind"===o)return v(e,t.slice(0,-1));const[a,l]=C(s);return E(e,{type:"APPLY",path:t.map((e=>e.toString())),argumentList:a},l).then(x)},construct(n,r){b(i);const[s,o]=C(r);return E(e,{type:"CONSTRUCT",path:t.map((e=>e.toString())),argumentList:s},o).then(x)}});return r}function w(e){return Array.prototype.concat.apply([],e)}function C(e){const t=e.map(S);return[t.map((e=>e[0])),w(t.map((e=>e[1])))]}const A=new WeakMap;function S(e){for(const[t,n]of m)if(n.canHandle(e)){const[i,r]=n.serialize(e);return[{type:"HANDLER",name:t,value:i},r]}return[{type:"RAW",value:e},A.get(e)||[]]}function x(e){switch(e.type){case"HANDLER":return m.get(e.name).deserialize(e.value);case"RAW":return e.value}}function E(e,t,n){return new Promise((i=>{const r=new Array(4).fill(0).map((()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16))).join("-");e.addEventListener("message",(function t(n){!n.data||!n.data.id||n.data.id!==r||(e.removeEventListener("message",t),i(n.data))})),e.start&&e.start(),e.postMessage(Object.assign({id:r},t),n)}))}const _="KGZ1bmN0aW9uKCl7InVzZSBzdHJpY3QiO2NvbnN0ICQ9U3ltYm9sKCJDb21saW5rLnByb3h5IiksQT1TeW1ib2woIkNvbWxpbmsuZW5kcG9pbnQiKSxSPVN5bWJvbCgiQ29tbGluay5yZWxlYXNlUHJveHkiKSx5PVN5bWJvbCgiQ29tbGluay50aHJvd24iKSxfPWU9PnR5cGVvZiBlPT0ib2JqZWN0IiYmZSE9PW51bGx8fHR5cGVvZiBlPT0iZnVuY3Rpb24iLEw9e2NhbkhhbmRs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1bWVudHNdO3Iuc2hpZnQoKSxjb25zb2xlLmxvZyhgJWNbV2ViV29ya2VyXSVjICR7ZX1gLCJmb250LXdlaWdodDpib2xkIiwiIiwuLi5yKX19O3codCl9KSgpOwo=",M=typeof window<"u"&&window.Blob&&new Blob([atob(_)],{type:"text/javascript;charset=utf-8"});function T(){const e=M&&(window.URL||window.webkitURL).createObjectURL(M);try{return e?new Worker(e):new Worker("data:application/javascript;base64,"+_)}finally{e&&(window.URL||window.webkitURL).revokeObjectURL(e)}}const I={urlCDN:"https://biowasm.com/cdn/v3",urlCDNStg:"https://stg.biowasm.com/cdn/v3",dirShared:"/shared",dirMounted:"/mnt",dirData:"/data",printInterleaved:!0,callback:null,debug:!1,env:"prd"};class L{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({},I,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 T;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(3629);class N{static getAvailableScales(){return Object.entries(this.scales).map((([e,t])=>e))}static getScale(e){return(0,$.vA)(!(void 0===this.scales[e]),`Scale '${e}' was not found.`),this.scales[e]}}N.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 P{constructor(e="categorial"){this.aa2num=N.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 i=["NH2","COOH"];if(e.startsWith(i[0])){const n=i[0].length;(0,$.vA)("-"==e[n],`Wrong sequence format: ${i[0]} without following '-' in '${e}'.`),t=n}if(e.endsWith(i[1])){const t=i[1].length+1;(0,$.vA)("-"==e[n-t],`Wrong sequence format: ${i[1]} without '-' precending in '${e}'.`),n-=t}return e.substring(t,n)}static _dropDefises(e){return e.replace(/(-)([^-]+)/g,"$2")}static clean(e){return P._dropDefises(P._truncateSequence(e))}encode(e){const t=e.length,n=new Array(t).fill(0);for(let i=0;i<t;++i){const t=e[i];(0,$.vA)(t in this.aa2num,`Unknown char '${t}' found in sequence '${e}'`),n[i]=this.encodeLettter(t)}return n}encodeLettter(e){return this.aa2num[e]}decode(e){let t="";for(let n=0;n<e.length;++n){const i=e[n];(0,$.vA)(i in this.num2aa,`Unknown code '${i}' found in vector '${e}'`),t+=this.num2aa[i]}return t}}var O=n(4139);const R="input.fa",k="result.fasta";class G extends Error{element;constructor(e,t){super(e.innerText,t),this.element=e}}function D(e){return e.reduce(((e,t,n)=>e+`>sample${n+1}\n${t}\n`),"")}async function F(e,t=!1,n="",i=null,s,o,c){let u=e.toList();t&&(u=u.map((e=>P.clean(e).replace(/\-/g,""))));const h=e.length;i??=r.Column.string("Clusters",h).init("0"),i.type!=r.COLUMN_TYPE.STRING&&(i=i.convertTo(r.TYPE.STRING)),i.compact();const d=i.categories,p=i.getRawData(),m=new Array(d.length),f=new Array(d.length);for(let e=0;e<h;++e){const t=p[e];(m[t]??=[]).push(u[e]),(f[t]??=[]).push(e)}B(f,d);const g=await new L(["base/1.0.0",{tool:"kalign",version:O.b9,reinit:!0}]),y=r.Column.string(n,h);for(let e=0;e<d.length;++e){const t=D(m[e]);await g.fs.writeFile(R,t);const n=`${void 0!==s?` --gpo ${s}`:""}${void 0!==o?` --gpe ${o}`:""}${void 0!==c?` --tgpe ${c}`:""}`,i=await g.exec(`kalign ${R} -f fasta -o ${k}${n}`);console.warn(i);const r=await g.cat(k);if(!r){const e=H(i,1);throw new Error(e)}const l=new a.m(r).sequencesArray,u=f[e];for(let e=0;e<l.length;++e)y.set(u[e],l[e])}const b=e.meta.units,v=e.getTag(l.gp.alphabet);return y.meta.units=b,y.setTag(l.gp.aligned,"SEQ.MSA"),y.setTag(l.gp.alphabet,v),y.semType=r.SEMTYPE.MACROMOLECULE,y}function H(e,t){const n=[],i=/^.+ERROR : (.+)$/gm;let r;for(;null!=(r=i.exec(e))&&(void 0===t||n.length<t);)n.push(r[1]);return n.join("\n")}function B(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=i.div([i.divText(`MSA analysis is not available on single sequence clusters #${n.length}:`),...o()(n).take(3).map((e=>{let r=t[e];return r.length>25&&(r=r.slice(0,25)+"..."),i.divText(`"${r}"${e<n.length-1?", ":"."}`)})).toArray(),...n.length>3?[i.divText("...")]:[]]);throw new G(e)}}},8152:(e,t,n)=>{"use strict";n.d(t,{GD:()=>d,Nk:()=>c,ZY:()=>u});var i=n(4328),r=n(6082),s=n(2003),o=n(608),a=n(4139),l=n(682);const c=new class{dcName="bio";async getDockerContainer(){return await i.dapi.docker.dockerContainers.filter(this.dcName).first()}},u=["mafft --auto","mafft","linsi","ginsi","einsi","fftns","fftnsi","nwns","nwnsi"],h=["AlignedSeq","AlignedSubpeptide","HELM","ID","PolymerID"];async function d(e,t,n="ginsi",i=1.53,l=0,u=null,d){const m=await c.getDockerContainer();if("started"!==m.status&&"checking"!==m.status)throw new Error("PepSeA container has not started yet");const f=e.length;u??=r.Column.int("Clusters",f).init(0),u.type!=r.COLUMN_TYPE.STRING&&(u=u.convertTo(r.TYPE.STRING));const g=u.categories,y=u.getRawData(),b=new Array(g.length),v=new Array(g.length);for(let t=0;t<f;++t){const n=y[t],i=g[n];if(""===i)continue;const r=g.indexOf(i),s=e.get(t);s&&((b[r]??=[]).push({ID:t.toString(),HELM:s}),(v[n]??=[]).push(t))}(0,o.aZ)(v,g);const w=new Array(f);for(const e of b){const t=(await p(m.id,e,n,i,l,d)).Alignment;for(const e of t)w[parseInt(e.ID)]=Object.entries(e).filter((e=>!h.includes(e[0]))).map((e=>"-"!==e[1]?e[1]:"")).join(a.J.SEPARATOR)}const C=r.Column.fromStrings(t,w);return C.meta.units=s.Hi.SEPARATOR,C.setTag(s.gp.separator,a.J.SEPARATOR),C.setTag(s.gp.aligned,"SEQ.MSA"),C.setTag(s.gp.alphabet,s.YI.UN),C.setTag(s.gp.alphabetIsMultichar,"true"),C.semType=r.SEMTYPE.MACROMOLECULE,C}async function p(e,t,n,r,s,o){const a={method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(t)},c=`/align?method=${n}&gap_open=${r}&gap_extend=${s}`;let u;if("fetchProxy"in i.dapi.docker.dockerContainers){const t=window.performance.now(),n=await i.dapi.docker.dockerContainers.fetchProxy(e,c,a),r=window.performance.now();l._package.logger.debug(`Bio: requestAlignedObjects() dockerContainers.fetchProxy(), ET: ${r-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 i=e["datagrok-error"];if(i)throw new Error(`Datagrok error: ${i}`);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 i.dapi.docker.dockerContainers.request(e,c,a);if(!t)throw new Error("Empty response");u=JSON.parse(t);const n=u["pepsea-error"];if(n)throw new Error(`PepSeA error: ${n}`);const r=u["datagrok-error"];if(r)throw new Error(`Datagrok error: ${r}`)}if("pepsea-stderr"in u){const e=u["pepsea-stderr"];o?.warning(e)}return u}},3890:(e,t,n)=>{"use strict";n.d(t,{TE:()=>u});var i=n(6082),r=n(7389),s=n(4328),o=n(1991),a=n.n(o),l=n(826);const c=60;function u(){const e=s.shell.tv.grid,t=a().count(0).take(e.columns.length).map((t=>e.columns.byIndex(t))).filter((e=>!!e.column&&e.column.semType!==i.SEMTYPE.MACROMOLECULE)).toArray(),n=t.find((e=>-1!==e.name.toLowerCase().indexOf("id"))),o=n?[n.name]:[],u=r.input.multiChoice("Seq id columns",{value:o,items:t.map((e=>e.name))}),d=a().count(0).take(e.columns.length).map((t=>e.columns.byIndex(t))).filter((e=>{const t=e.column;return!(!t||t.semType!==i.SEMTYPE.MACROMOLECULE)&&l.GO.forColumn(t).isFasta()})).toArray(),p=d.length>0?d[0].name:[],m=r.input.choice("Seq column",{value:p,items:d.map((e=>e.name))}),f=r.input.int("FASTA line width",{value:c});r.dialog({title:"Save as FASTA"}).add(r.inputs([u,m,f])).onOK((()=>{const t=u.value?u.value.map((t=>e.columns.byName(t).column)):[],n=m.value?e.columns.byName(m.value).column:null,i=f.value??c;n||s.shell.warning("Seq column is mandatory to save as FASTA.");const r=function(e,t,n=c,i="\n"){const r=l.GO.forColumn(t),s=[];for(let o=0;o<t.length;o++){const t=e.map((e=>e.get(o).toString())).join("|"),a=h(r.getSplitted(o),n);s.push(`>${t}${i}`);for(const e of a)s.push(`${e}${i}`)}return"".concat(...s)}(t,n,i),o=document.createElement("a");o.setAttribute("href",`data:text/plain;charset=utf-8,${encodeURIComponent(r)}`),o.setAttribute("download",`${e.dataFrame.name}.fasta`),o.click()})).show()}function h(e,t=c){let n=0;const i=e.length,r=[];for(;n<i;){const i=a()(e.originals).slice(n,n+t).toArray(),s=i.map((e=>e.length>1?`[${e}]`:e)).reduce(((e,t)=>e+t),"");r.push(s),n+=i.length}return r}},5785:(e,t,n)=>{"use strict";n.d(t,{k:()=>u});var i=n(4328),r=n(6082),s=n(8070),o=n(966),a=n(3077),l=n(4139),c=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=l.uF.MONOMER,e.setTag(c.gp.alphabet,t.getTag(c.gp.alphabet));const h=/(\d+)(?: \((\d+)\))?/,d=e=>{h.lastIndex=0;const t=e.match(h);return t?`${t[1]} (${parseInt(t[2]??"0")+1})`:e};for(let e=0;e<n.columns.length;e++){const i=n.columns.byIndex(e);i.semType=l.uF.MONOMER,i.setTag(c.gp.alphabet,t.getTag(c.gp.alphabet));const r=100;let s=0;for(;u.columns.byName(i.name)&&s<r;)i.name=d(i.name),s++;u.columns.add(i)}await i.data.detectSemanticTypes(u);for(let e=0;e<n.columns.length;e++){const t=n.columns.byIndex(e);t.setTag(r.TAGS.CELL_RENDERER,"Monomer"),t.setTag(".use-as-filter","false")}return u}},4870:(e,t,n)=>{"use strict";n.d(t,{K:()=>o,m:()=>s});var i=n(4328),r=n(6082);function s(){const e=i.shell.t.columns.bySemTypeAll(r.SEMTYPE.MACROMOLECULE);if(null!==e)return e;i.shell.error("Current table does not contain macromolecules")}function o(e,t){e.innerHTML="",e.append(t)}},8047:(e,t,n)=>{"use strict";n.d(t,{n5:()=>v,oP:()=>M});var i=n(4328),r=n(7389),s=n(6082),o=n(1757),a=n.n(o),l=n(1991),c=n.n(l),u=n(1858),h=n(826),d=n(2003),p=n(4326);function m(e){var t;return"string"==typeof e||e instanceof String?e:("object"==typeof e||e instanceof Object)&&"$thrownJsError"in e?m(e.$thrownJsError):e instanceof Error?null!==(t=e.stack)&&void 0!==t?t:e.message:e.toString()}var f=n(2738),g=n(8070),y=n(7602);var b,v,w=n(2174),C=n(682);HTMLCanvasElement.prototype.getCursorPosition=function(e,t){const n=this.getBoundingClientRect();return new s.Point((e.clientX-n.left)*t,(e.clientY-n.top)*t)},s.Rect.prototype.contains=function(e,t){return this.left<=e&&e<=this.right&&this.top<=t&&t<=this.bottom};class A{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 S{pos;name;_label;get label(){return this._label?this._label:this.name}_freqs;sumRowCount=0;sumPlotValue;sumPlotValueForHeight;constructor(e,t,n,i){this.pos=e,this.name=t,this._freqs=n??{},i?.sumRowCount&&(this.sumRowCount=i.sumRowCount),i?.sumValueForHeight&&(this.sumPlotValue=i.sumValueForHeight),i?.label&&(this._label=i.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 A),t}aggregate(e){const t=function(e){return t=>{const n=function(e){let t;const n="agg";return t=e instanceof Float32Array?s.Column.fromFloat32Array(n,e):e instanceof Int32Array?s.Column.fromInt32Array(n,e):s.Column.fromList(s.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===p.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 i=(e.plotValue+n)/(this.sumPlotValue+t);this.sumPlotValueForHeight+=-i*Math.log2(i)}}else if(e===p.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,r,o,a,l,c){const u=i===p.fH.Entropy?n*(r-this.sumPlotValueForHeight)/r:n;let h=c*l+(n-u-1);const d=Object.entries(this._freqs).sort(((e,t)=>e[0]!==f._S&&t[0]!==f._S?t[1].value-e[1].value:e[0]===f._S&&t[0]===f._S?0:e[0]===f._S?-1:1));for(const[n,i]of d){const n=u*i.plotValue/this.sumPlotValue;i.bounds=new s.Rect((e-t)*l*o,h,a*l,n),h+=n}}render(e,t,n,i,r){for(const[s,o]of Object.entries(this._freqs))if(s!==f._S){const a=(0,d.zS)(s,5),l=o.bounds,c=l.left;e.resetTransform(),e.strokeStyle="lightgray",e.lineWidth=1,e.rect(c,l.top,l.width,l.height),e.fillStyle=r.get(s)??r.get("other"),e.textAlign="left",e.font=t;const u=e.measureText(a);e.setTransform(l.width/u.width,0,0,l.height/i,c,l.top),e.fillText(a,0,-n)}}getMonomerAt(e,t){const n=Object.entries(this._freqs).find((([n,i])=>i.bounds.contains(e,t)));return n?n[0]:void 0}buildCompositionTable(e){if("-"in this._freqs)throw new Error("Unexpected monomer symbol '-'.");return(0,w.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"}(b||(b={})),function(e){e.sequenceColumnName="sequenceColumnName",e.valueAggrType="valueAggrType",e.valueColumnName="valueColumnName",e.startPositionName="startPositionName",e.endPositionName="endPositionName",e.skipEmptySequences="skipEmptySequences",e.skipEmptyPositions="skipEmptyPositions",e.shrinkEmptyTail="shrinkEmptyTail",e.backgroundColor="backgroundColor",e.positionHeight="positionHeight",e.positionWidth="positionWidth",e.verticalAlignment="verticalAlignment",e.horizontalAlignment="horizontalAlignment",e.fixWidth="fixWidth",e.fitArea="fitArea",e.minHeight="minHeight",e.maxHeight="maxHeight",e.showPositionLabels="showPositionLabels",e.positionMarginState="positionMarginState",e.positionMargin="positionMargin",e.filterSource="filterSource"}(v||(v={}));const x=p.Fo;var E;!function(e){e[e.None=0]="None",e[e.Render=1]="Render",e[e.Layout=1]="Layout",e[e.Freqs=2]="Freqs"}(E||(E={}));const _=new class{render=20};class M extends s.JsViewer{static residuesSet="nucleotides";viewed=!1;seqHandler;initialized=!1;palette=null;host;msgHost;canvas;slider;textBaseline;seqCol=null;positions=[];visibleSlider=!1;allowResize=!0;turnOfResizeForOneSetValue=!1;sequenceColumnName;valueAggrType;valueColumnName;skipEmptySequences;skipEmptyPositions;positionWidth;_positionWidth;_positionWidthWithMargin;get positionWidthWithMargin(){return this._positionWidthWithMargin}minHeight;backgroundColor=4294967295;maxHeight;showPositionLabels;positionMarginState;positionMargin=0;_positionMargin;startPositionName;endPositionName;fixWidth;verticalAlignment;horizontalAlignment;fitArea;shrinkEmptyTail;positionHeight;filterSource;positionNames=[];positionLabels=void 0;startPosition=-1;endPosition=-1;error=null;get Length(){return this.skipEmptyPositions?this.positions.length:this.startPosition<=this.endPosition?this.endPosition-this.startPosition+1:0}get positionMarginValue(){return this.positionMarginState===p.mH.AUTO&&!0===this.seqHandler.getAlphabetIsMultichar()||this.positionMarginState===p.mH.ON?this.positionMargin:0}constructor(){super(),this.textBaseline="top",this.seqHandler=null,this.sequenceColumnName=this.string(v.sequenceColumnName,x.sequenceColumnName,{category:b.DATA});const e=[s.AGG.KEY,s.AGG.PIVOT,s.AGG.MISSING_VALUE_COUNT,s.AGG.SKEW,s.AGG.KURT,s.AGG.SELECTED_ROWS_COUNT],t=Object.values(s.AGG).filter((t=>!e.includes(t)));this.valueAggrType=this.string(v.valueAggrType,x.valueAggrType,{category:b.DATA,choices:t}),this.valueColumnName=this.string(v.valueColumnName,x.valueColumnName,{category:b.DATA}),this.startPositionName=this.string(v.startPositionName,x.startPositionName,{category:b.DATA}),this.endPositionName=this.string(v.endPositionName,x.endPositionName,{category:b.DATA}),this.skipEmptySequences=this.bool(v.skipEmptySequences,x.skipEmptySequences,{category:b.DATA}),this.skipEmptyPositions=this.bool(v.skipEmptyPositions,x.skipEmptyPositions,{category:b.DATA}),this.shrinkEmptyTail=this.bool(v.shrinkEmptyTail,x.shrinkEmptyTail,{category:b.DATA}),this.backgroundColor=this.int(v.backgroundColor,x.backgroundColor,{category:b.STYLE}),this.positionHeight=this.string(v.positionHeight,x.positionHeight,{category:b.STYLE,choices:Object.values(p.fH)}),this._positionWidth=this.positionWidth=this.float(v.positionWidth,x.positionWidth,{category:b.STYLE}),this.verticalAlignment=this.string(v.verticalAlignment,x.verticalAlignment,{category:b.LAYOUT,choices:Object.values(p.Lp)}),this.horizontalAlignment=this.string(v.horizontalAlignment,x.horizontalAlignment,{category:b.LAYOUT,choices:Object.values(p.P4)}),this.fixWidth=this.bool(v.fixWidth,x.fixWidth,{category:b.LAYOUT,userEditable:!1}),this.fitArea=this.bool(v.fitArea,x.fitArea,{category:b.LAYOUT}),this.minHeight=this.float(v.minHeight,x.minHeight,{category:b.LAYOUT}),this.maxHeight=this.float(v.maxHeight,x.maxHeight,{category:b.LAYOUT}),this.showPositionLabels=this.bool(v.showPositionLabels,x.showPositionLabels,{category:b.LAYOUT}),this.positionMarginState=this.string(v.positionMarginState,x.positionMarginState,{category:b.LAYOUT,choices:Object.values(p.mH)});let n=0;"auto"===this.positionMarginState&&(n=4),this.positionMargin=this.int(v.positionMargin,n,{category:b.LAYOUT,min:0,max:16}),this.filterSource=this.string(v.filterSource,x.filterSource,{category:b.BEHAVIOR,choices:Object.values(p.lT)}),this.slider=r.rangeSlider(0,100,0,20,!1,{style:"barbell"}),this.canvas=r.canvas(),this.canvas.classList.value="bio-wl-canvas",this.canvas.style.width="100%",this.viewSyncer=new y.g(C._package.logger)}static viewerCounter=-1;viewerId=++M.viewerCounter;toLog(){return`WebLogoViewer<${this.viewerId}>`}setData(){const e=`${this.toLog()}.setData()`;C._package.logger.debug(`${e}, in`),this.viewSyncer.sync(`${e}`,(async()=>{if(!this.setDataInProgress){this.setDataInProgress=!0;try{this.viewed&&(this.renderRequestSub.unsubscribe(),await this.destroyView(),this.viewed=!1),this.updateSeqCol(),this.updateEditors(),this.viewed||(await this.buildView(),this.viewed=!0)}finally{this.setDataInProgress=!1}}})),C._package.logger.debug(`${e}, out`)}viewSyncer;setDataInProgress=!1;viewSubs=[];async destroyView(){for(const e of this.viewSubs)e.unsubscribe();this.viewSubs=[];const e=this.dataFrame?"data":"null";C._package.logger.debug(`${this.toLog()}.destroyView( dataFrame = ${e} ) start`),this.host.remove(),this.msgHost=void 0,this.host=void 0,C._package.logger.debug(`${this.toLog()}.destroyView() end`)}async buildView(){const e=this.dataFrame?"data":"null";C._package.logger.debug(`${this.toLog()}.buildView( dataFrame = ${e} ) start`),window.devicePixelRatio,this.viewSubs.push(s.debounce(this.renderRequest,_.render).subscribe(this.renderRequestOnDebounce.bind(this))),this.helpUrl="/help/visualize/viewers/web-logo.md",this.msgHost=r.div("No message",{classes:"bio-wl-msg"}),this.msgHost.style.display="none",this.canvas=r.canvas(),this.canvas.style.width="100%",this.slider.root.style.position="absolute",this.slider.root.style.zIndex="999",this.slider.root.style.display="none",this.slider.root.style.height="0.7em",this.visibleSlider=!1,this.host=r.div([this.msgHost,this.canvas],{classes:"bio-wl-host",style:{display:"flex",flexDirection:"row",flexWrap:"wrap"}}),this.root.append(this.host),this.root.append(this.slider.root),this.error&&(this.msgHost.innerText=this.error.message,r.tooltip.bind(this.msgHost,this.error.stack),this.msgHost.style.setProperty("display",null)),this.dataFrame&&(this.viewSubs.push(this.dataFrame.filter.onChanged.subscribe(this.dataFrameFilterOnChanged.bind(this))),this.viewSubs.push(this.dataFrame.selection.onChanged.subscribe(this.dataFrameSelectionOnChanged.bind(this)))),this.viewSubs.push(r.onSizeChanged(this.root).subscribe(this.rootOnSizeChanged.bind(this))),this.viewSubs.push(this.slider.onValuesChanged.subscribe(this.sliderOnValuesChanged.bind(this))),this.viewSubs.push((0,u.fromEvent)(this.canvas,"mousemove").subscribe(this.canvasOnMouseMove.bind(this))),this.viewSubs.push((0,u.fromEvent)(this.canvas,"mousedown").subscribe(this.canvasOnMouseDown.bind(this))),this.viewSubs.push((0,u.fromEvent)(this.canvas,"wheel").subscribe(this.canvasOnWheel.bind(this))),this.render(E.Freqs,"buildView"),C._package.logger.debug(`${this.toLog()}.buildView() end`)}lastSize={width:-1,height:-1};rootOnSizeChanged(e){const t={width:e.target.clientWidth,height:e.target.clientHeight};this.lastSize.width==t.width&&this.lastSize.height==t.height||(C._package.logger.debug(`${this.toLog()}.rootOnSizeChanged(), ${JSON.stringify(t)}, start `),this.render(E.Layout,"rootOnSizeChanged")),this.lastSize=t}updateEditors(){this.props.getProperty(v.valueColumnName).choices=c()(this.dataFrame.columns.numerical).map((e=>e.name)).toArray()}updateSeqCol(){if(this.dataFrame&&(this.seqCol=this.sequenceColumnName?this.dataFrame.col(this.sequenceColumnName):null,null==this.seqCol&&(this.seqCol=(0,d.mn)(this.dataFrame),this.sequenceColumnName=this.seqCol?this.seqCol.name:null),this.seqCol)){try{this.seqHandler=h.GO.forColumn(this.seqCol),this.palette=(0,d.SM)(this.seqCol),this.render(E.Freqs,"updateSeqCol()"),this.error=null}catch(e){throw this.seqCol=null,this.error=e instanceof Error?e:new Error(e.toString()),e}this.seqCol||(this.seqHandler=null,this.positionNames=[],this.positionLabels=[],this.startPosition=-1,this.endPosition=-1,this.palette=null)}}getFilter(){let e;switch(this.filterSource){case p.lT.Filtered:e=this.dataFrame.filter;break;case p.lT.Selected:e=0===this.dataFrame.selection.trueCount?this.dataFrame.filter:this.dataFrame.selection}return e}setSliderVisibility(e){e?(this.slider.root.style.display="inherit",this.visibleSlider=!0):(this.slider.root.style.display="none",this.visibleSlider=!1)}calcLayout(e){this.host&&this.canvas&&this.slider&&(this.host.classList.remove("bio-wl-fixWidth","bio-wl-fitArea"),this.canvas.classList.remove("bio-wl-fixWidth","bio-wl-fitArea"),this._positionWidth=this.positionWidth,this._positionMargin=this.positionMargin,this._positionWidthWithMargin=this._positionWidth+this.positionMarginValue,this.fixWidth?this.calcLayoutFixWidth(e):this.fitArea?this.calcLayoutFitArea(e):this.calcLayoutNoFitArea(e),this.slider.root.style.width=`${this.host.clientWidth}px`)}calcLayoutFixWidth(e){if(!this.host||!this.canvas||!this.slider)return;this.host.classList.add("bio-wl-fixWidth"),this.canvas.classList.add("bio-wl-fitArea");const t=this._positionWidthWithMargin*this.Length,n=Math.min(Math.max(this.minHeight,this.root.clientHeight),this.maxHeight);this.host.style.justifyContent=p.P4.LEFT,this.host.style.removeProperty("margin-left"),this.host.style.removeProperty("margin-top"),this.host.style.width=this.canvas.style.width=`${t}px`,this.host.style.height=this.canvas.style.height=`${n}px`,this.host.style.left=this.canvas.style.left="0",this.host.style.top=this.canvas.style.top="0",this.host.style.setProperty("overflow","hidden","important"),this.slider.root.style.display="none",this.slider.setValues(0,Math.max(0,this.Length-1),0,Math.max(0,this.Length-1)),this.canvas.width=t*e,this.canvas.height=n*e}calcLayoutNoFitArea(e){if(!this.host||!this.canvas||!this.slider)return;const t=this._positionWidthWithMargin*this.Length,n=Math.min(Math.max(this.minHeight,this.root.clientHeight),this.maxHeight),i=Math.min(this.root.clientWidth,t);this.canvas.style.width=`${i}px`,this.canvas.style.height=`${n}px`,this.host.style.width=`${i}px`,this.host.style.height=`${this.root.clientHeight}px`,this.host.style.justifyContent=this.horizontalAlignment,this.host.style.alignContent=this.verticalAlignment===p.Lp.TOP?"start":this.verticalAlignment===p.Lp.MIDDLE?"center":this.verticalAlignment===p.Lp.BOTTOM?"end":"inherit",this.root.clientHeight<this.minHeight&&(this.host.style.alignContent="start",this.host.style.width=`${i+6}px`),this.host.style.width=`${this.host}px`;const r=t>i;if(this.setSliderVisibility(r),r){this.slider.root.style.removeProperty("display"),this.host.style.justifyContent="left",this.host.style.height=this.root.clientHeight-this.slider.root.offsetHeight+"px",this.slider.root.style.top=`${this.host.offsetHeight}px`;let e=Math.min(Math.max(0,this.slider.min),this.Length-.001),t=Math.min(Math.max(0,this.slider.max),this.Length-.001);const n=this.root.clientWidth/this._positionWidthWithMargin;t=Math.min(Math.max(e,0)+n,this.Length-.001),e=Math.max(0,Math.min(t,this.Length-.001)-n),this.slider.setValues(0,Math.max(this.Length-.001),e,t)}else this.slider.setValues(0,Math.max(0,this.Length-.001),0,Math.max(0,this.Length-.001));this.canvas.width=i*e,this.canvas.height=n*e}calcLayoutFitArea(e){if(!this.host||!this.canvas||!this.slider)return;const t=this._positionWidth*this.Length,n=Math.min(Math.max(this.minHeight,this.root.clientHeight),this.maxHeight),i=t>0?(this.root.clientWidth-this.positionMarginValue*this.Length)/t:0,r=this.root.clientHeight/n,s=Math.max(1,Math.min(i,r));this._positionWidth=this.positionWidth*s,this._positionWidthWithMargin=this._positionWidth+this.positionMarginValue;const o=(this._positionWidth+this.positionMarginValue)*this.Length,a=s*n,l=Math.min(this.root.clientWidth,o);this.canvas.style.width=`${l}px`,this.canvas.style.height=`${a}px`,this.host.style.width=`${l}px`,this.host.style.height=`${this.root.clientHeight}px`,this.host.style.justifyContent=this.horizontalAlignment,this.host.style.alignContent=this.verticalAlignment===p.Lp.TOP?"start":this.verticalAlignment===p.Lp.MIDDLE?"center":this.verticalAlignment===p.Lp.BOTTOM?"end":"inherit",this.root.clientHeight<this.minHeight&&(this.host.style.alignContent="start",this.host.style.width=`${l+6}px`),this.host.style.width=`${this.host}px`;const c=o>l;if(this.setSliderVisibility(c),c){this.slider.root.style.removeProperty("display"),this.host.style.justifyContent="left",this.host.style.height=this.root.clientHeight-this.slider.root.offsetHeight+"px",this.slider.root.style.top=`${this.host.offsetHeight}px`;let e=Math.min(Math.max(0,this.slider.min),this.Length-.001),t=Math.min(Math.max(0,this.slider.max),this.Length-.001);const n=this.root.clientWidth/this._positionWidthWithMargin;t=Math.min(Math.max(e,0)+n,this.Length-.001),e=Math.max(0,Math.min(t,this.Length-.001)-n),this.slider.setValues(0,Math.max(0,this.Length-.001),e,t)}else this.slider.setValues(0,Math.max(0,this.Length-.001),0,Math.max(0,this.Length-.001));this.canvas.width=l*e,this.canvas.height=a*e}onPropertyChanged(e){switch(super.onPropertyChanged(e),e.name){case v.sequenceColumnName:this.updateSeqCol();break;case v.sequenceColumnName:case v.startPositionName:case v.endPositionName:case v.filterSource:case v.shrinkEmptyTail:case v.skipEmptyPositions:case v.positionHeight:case v.valueColumnName:case v.valueAggrType:this.render(E.Freqs,`onPropertyChanged( ${e.name} )`);break;case v.minHeight:case v.maxHeight:case v.positionWidth:case v.showPositionLabels:case v.fixWidth:case v.fitArea:case v.horizontalAlignment:case v.verticalAlignment:case v.positionMargin:case v.positionMarginState:this.render(E.Layout,`onPropertyChanged(${e.name})`);break;case v.backgroundColor:this.render(E.Render,`onPropertyChanged(${e.name})`)}}onTableAttached(){C._package.logger.debug(`${this.toLog()}.onTableAttached(), `),super.onTableAttached(),this.setData()}detach(){const e=`${this.toLog()}.detach()`;C._package.logger.debug(`${e}, in`);const t=super.detach.bind(this);this.viewSyncer.sync(`${e}`,(async()=>{this.setDataInProgress||(this.viewed&&(await this.destroyView(),this.viewed=!1),t())})),C._package.logger.debug(`${e}, out`)}_onSizeChanged=new u.Subject;get onSizeChanged(){return this._onSizeChanged}_onFreqsCalculated=new u.Subject;get onFreqsCalculated(){return this._onFreqsCalculated}_onLayoutCalculated=new u.Subject;get onLayoutCalculated(){return this._onLayoutCalculated}getMonomer(e,t){const n=e.x,i=Math.floor(e.x/(this._positionWidthWithMargin*t)+Math.floor(this.slider.min)),r=this.positions[i];if(!r)return[null,null,null];const s=r.getMonomerAt(n,e.y);return void 0===s?[r,null,null]:[r,s,r.getFreq(s)]}_nullSequence(e="X"){return this.skipEmptySequences?"":new Array(this.Length).fill(e).join("")}_removeEmptyPositions(){this.skipEmptyPositions&&(this.positions=c()(this.positions).filter((e=>!e.hasMonomer(f._S)||e.getFreq(f._S).rowCount!==e.sumRowCount)).toArray())}requestedRenderLevel=E.Freqs;renderRequest=new u.Subject;renderRequestSub;render(e,t){C._package.logger.debug(`${this.toLog()}.render( recalcLevelVal=${e}, reason='${t}' )`),this.requestedRenderLevel=Math.max(this.requestedRenderLevel,e),this.renderRequest.next(this.requestedRenderLevel)}async renderInt(e){if(C._package.logger.debug(`${this.toLog()}.render.renderInt( renderLevel=${e} ), start `),this.msgHost&&(this.seqCol&&!this.palette?(this.msgHost.innerText=`Unknown palette (column semType: '${this.seqCol.semType}').`,this.msgHost.style.display=""):this.msgHost.style.display="none"),!this.seqCol||!this.dataFrame||!this.palette||null==this.host||null==this.slider)return;const t=window.devicePixelRatio,n=this.showPositionLabels?12:0;if(e>=E.Freqs&&(()=>{if(C._package.logger.debug(`${this.toLog()}.render.calculateFreqsInt(), start `),!this.host||!this.seqCol||!this.dataFrame)return;const e=this.seqCol.getTag(d.gp.positionNames),t=this.seqCol.getTag(d.gp.positionLabels);let n;!e&&this.endPositionName&&/\d+/.test(this.endPositionName)?n=Number(this.endPositionName):e&&this.endPositionName&&(n=e.split(d.z1).indexOf(this.endPositionName),n=-1!==n?n:void 0);const i=this.getFilter(),r=0===i.trueCount?this.seqHandler.maxLength:c().count(0).take(this.seqHandler.length).map((e=>{const t=this.seqHandler.getSplitted(e,n);return i.get(e)&&t?t.length:0})).reduce(((e,t)=>Math.max(e,t)),0);this.positionNames=e?e.split(d.z1).map((e=>e.trim())):[...Array(r).keys()].map((e=>`${e+1}`)),this.positionLabels=t?t.split(d.z1).map((e=>e.trim())):void 0,this.startPosition=this.startPositionName&&this.positionNames&&this.positionNames.includes(this.startPositionName)?this.positionNames.indexOf(this.startPositionName):0,this.endPosition=this.endPositionName&&this.positionNames&&this.positionNames.includes(this.endPositionName)?this.positionNames.indexOf(this.endPositionName):r-1;const o=this.startPosition<=this.endPosition?this.endPosition-this.startPosition+1:0;this.seqHandler=h.GO.forColumn(this.seqCol);const a=this.startPosition<=this.endPosition?this.endPosition-this.startPosition+1:0;this.positions=new Array(a);for(let e=0;e<o;e++){const t=this.positionNames[this.startPosition+e],n=this.positionLabels?this.positionLabels[this.startPosition+e]:void 0;this.positions[e]=new S(this.startPosition+e,t,{},{label:n})}const l=this.dataFrame.rowCount;for(let e=0;e<o;++e){for(let t=0;t<l;++t)if(i.get(t)){const n=this.seqHandler.getSplitted(t),i=e<n.length?n.getCanonical(this.startPosition+e):this.seqHandler.defaultGapOriginal,r=this.seqHandler.defaultGapOriginal===i?f._S:i,s=this.positions[e],o=s.getFreq(r);++s.sumRowCount,o.value=++o.rowCount}if(this.valueAggrType===s.AGG.TOTAL_COUNT)continue;let t=null;try{t=this.dataFrame.getCol(this.valueColumnName),t.matches("numerical")||(t=null)}catch{t=null}if(t){for(let n=0;n<l;++n)if(i.get(n)){const i=this.seqHandler.getSplitted(n).getCanonical(this.startPosition+e),r=t.get(n);this.positions[e].getFreq(i).push(r)}this.positions[e].aggregate(this.valueAggrType)}}const u=this.valueAggrType===s.AGG.TOTAL_COUNT?0:Math.min(0,Math.min(...this.positions.map((e=>e.getMinValue()))));for(let e=0;e<o;++e)this.positions[e].calcPlotValue(u),this.positions[e].calcHeights(this.positionHeight);this._removeEmptyPositions(),this._onFreqsCalculated.next()})(),this.calcLayout(t),-1===this.startPosition)return;const r=Math.max(Math.floor(this.slider.min),0),o=Math.min(this.positions.length-1,Math.floor(this.slider.max));e>=E.Layout&&((e,t,n,r)=>{C._package.logger.debug(`${this.toLog()}.render.calculateLayoutInt(), start `);const o=this.canvas.height-r*n;let a;if(this.valueAggrType===s.AGG.TOTAL_COUNT){const e=this.getAlphabetSize();this.positionHeight==p.fH.Entropy&&null==e&&i.shell.error("WebLogo: alphabet is undefined."),a=Math.log2(e)}else a=Math.max(...c().count(e).takeWhile((e=>e<=t)).map((e=>this.positions[e].sumPlotValueForHeight)));for(let i=e;i<=t;++i)i in this.positions?this.positions[i].calcScreen(i,this.slider.min,o,this.positionHeight,a,this._positionWidthWithMargin,this._positionWidth,n,r):C._package.logger.warning(`${this.toLog()}.render.calculateLayoutInt() this.positions.length = ${this.positions.length}, jPos = ${i}`);C._package.logger.debug(`${this.toLog()}.render.calculateLayoutInt(), end `),this._onLayoutCalculated.next()})(r,o,window.devicePixelRatio,n);const a=this.canvas.getContext("2d");if(a){a.save();try{this.Length,a.resetTransform(),a.fillStyle=function(e){const t=s.Color.a(e);return`#${(16777215&e).toString(16).padStart(6,"0")}`+t.toString(16).padStart(2,"0")}(this.backgroundColor),a.fillRect(0,0,this.canvas.width,this.canvas.height),a.textBaseline=this.textBaseline;const e=10*t;a.resetTransform(),a.fillStyle="black",a.textAlign="center",a.font=`${e.toFixed(1)}px Roboto, Roboto Local, sans-serif`,n>0&&this.positions.length>0&&function(e,t,n,i,r,s,o,a){e.save();try{e.textAlign="center";let l=null,c=null;for(let t=Math.floor(o);t<=Math.floor(a);t++){const n=s[t],i=e.measureText(n.name),r=i.actualBoundingBoxDescent-i.actualBoundingBoxAscent;l=null===l?i.width:Math.max(l,i.width),c=null===c?r:Math.max(c,r)}const u=l<i*t-2?1:(i*t-2)/l;for(let l=Math.floor(o);l<=Math.floor(a);l++){const a=s[l],h=(l-o)*n*t+i*t/2,d=(r*t-c)/2;e.setTransform(u,0,0,1,h,d),e.measureText(a.label),e.fillText(a.label,0,0)}}finally{e.restore()}}(a,t,this._positionWidthWithMargin,this._positionWidth,n,this.positions,this.slider.min,this.slider.max);const i="16px Roboto, Roboto Local, sans-serif",l=.25,c=12.2;for(let e=r;e<=o;e++)this.positions[e].render(a,i,l,c,this.palette)}finally{a.restore()}C._package.logger.debug(`${this.toLog()}.render.renderInt( recalcLevel=${e} ), end`)}}renderRequestOnDebounce(e){const t=`${this.toLog()}.renderRequestOnDebounce()`;"HTML"!==a()(this.root).offsetParent().get()[0]?.tagName?(this.requestedRenderLevel=E.None,this.viewSyncer.sync(t,(async()=>{await this.renderInt(e)}))):C._package.logger.warning(`${t}, $(this.root).offsetParent() is the 'HTML' tag.`)}_lastWidth;_lastHeight;getAlphabetSize(){return this.seqHandler?.getAlphabetSize()??0}sliderOnValuesChanged(e){try{const e={minRange:this.slider.minRange,min:this.slider.min,max:this.slider.max,maxRange:this.slider.maxRange};C._package.logger.debug(`${this.toLog()}.sliderOnValuesChanged( ${JSON.stringify(e)} ), start`),this.render(E.Layout,"sliderOnValuesChanged")}catch(e){const t=m(e);C._package.logger.error(`${this.toLog()}.sliderOnValuesChanged() error:\n`+t)}}dataFrameFilterOnChanged(e){C._package.logger.debug(`${this.toLog()}.dataFrameFilterChanged()`);try{this.filterSource===p.lT.Filtered&&this.render(E.Freqs,"dataFrameFilterOnChanged")}catch(e){const t=m(e);C._package.logger.error(`${this.toLog()}.dataFrameFilterOnChanged() error:\n`+t)}}dataFrameSelectionOnChanged(e){C._package.logger.debug(`${this.toLog()}.dataFrameSelectionOnChanged()`);try{this.filterSource===p.lT.Selected&&this.render(E.Freqs,"dataFrameSelectionOnChanged")}catch(e){const t=m(e);C._package.logger.error(`${this.toLog()}.dataFrameSelectionOnChanged() error:\n`+t)}}canvasOnMouseMove(e){const t=window.devicePixelRatio;try{const n=e,i=this.canvas.getCursorPosition(n,t),[o,a]=this.getMonomer(i,t),l=this.showPositionLabels?12*t:0;if(null!==o&&null===a&&0<=i.y&&i.y<=l){const e=[r.divText(`Position ${o.label}`)];this.valueAggrType===s.AGG.TOTAL_COUNT&&e.push(o.buildCompositionTable(this.palette));const t=r.divV(e);r.tooltip.show(t,n.x+16,n.y+16)}else if(null!==o&&a&&this.dataFrame&&this.seqCol&&this.seqHandler){const e=o.getFreq(a),t=[r.div(`${a}`),r.div(`${e.rowCount} rows`)];this.valueAggrType!==s.AGG.TOTAL_COUNT&&t.push(r.div(`${this.valueAggrType}: ${e.value.toFixed(3)}`));const i=r.divV(t);r.tooltip.show(i,n.x+16,n.y+16)}else r.tooltip.hide()}catch(e){const t=m(e);C._package.logger.error(`${this.toLog()}.canvasOnMouseMove() error:\n`+t)}}canvasOnMouseDown(e){try{const t=e,n=window.devicePixelRatio,[i,r]=this.getMonomer(this.canvas.getCursorPosition(t,n),n);if(null!==i&&null!==r&&this.dataFrame&&this.seqCol&&this.seqHandler){const e=s.BitSet.create(this.dataFrame.selection.length,(e=>function(e,t,n,i,r,s){const o=t.getSplitted(i),a=s.pos<o.length?o.getCanonical(s.pos):null;return null!==a&&a===r}(this.dataFrame,this.seqHandler,this.getFilter(),e,r,i)));this.dataFrame.selection.init((t=>e.get(t)))}}catch(e){const t=m(e);C._package.logger.error(`${this.toLog()}.canvasOnMouseDown() error:\n`+t)}}canvasOnWheel(e){const t=window.devicePixelRatio;try{if(!this.visibleSlider)return;const n=this.canvas.width/(this._positionWidthWithMargin*t),i=e.deltaY/100*Math.max(Math.floor(n/5),1);this.slider.scrollBy(this.slider.min+i)}catch(e){const t=m(e);C._package.logger.error(`${this.toLog()}.canvasOnWheel() error:\n`+t)}}_onRendered=new u.Subject;get onRendered(){return this._onRendered}invalidate(e){const t=`invalidate(${e?` <- ${e} `:""})`,n=`${this.toLog()}.${t}`;this.render(E.None,t),this.viewSyncer.sync(`${n}`,(async()=>{this._onRendered.next()}))}async awaitRendered(e=5e3){await(0,g.PE)(this.onRendered,(()=>{}),(()=>{this.invalidate()}),e);const t=this.viewSyncer.resetErrors();if(t.length>0)throw t[0]}}},4577:(e,t,n)=>{"use strict";n.d(t,{O:()=>o,n:()=>s});var i=n(1858),r=n(682);class s{substructure;readOnly;constructor(e,t=!0){return this.substructure=e,this.readOnly=t,new Proxy(this,{set:(e,t,n)=>{if(r._package.logger.debug(`BioFilterProps.set ${t.toString()}( '${n}' )`),this.readOnly)throw new Error("Properties are immutable.");return e[t]=n,!0}})}}class o{onChanged=new i.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:()=>E});var i=n(7389),r=n(6082),s=n(4328),o=n(1991),a=n.n(o),l=n(1858),c=n(2003),u=n(8070),h=n(826),d=n(7602),p=n(8115),m=n(4577),f=n(1757),g=n.n(f),y=n(9124),b=n(9192),v=n(4870),w=n(682);class C extends m.O{emptyProps=new m.n("");helmEditor;_filterPanel=i.div("",{style:{cursor:"pointer"}});logger;static viewerCounter=-1;viewerId=++C.viewerCounter;viewerToLog(){return`HelmBioFilter<${this.viewerId}>`}get type(){return"HelmBioFilter"}constructor(){super(),this.logger=w._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 i.tools.waitForElementInDom(this._filterPanel),this.logger.warning("TEST: HelmBioFilter.init().sync() waitForElementInDom ready"),this.updateFilterPanel(),this.viewSubs.push((0,l.fromEvent)(this._filterPanel,"click").subscribe((()=>{t=i.div(),n=e.createWebEditorApp(t,this.props.substructure),i.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(i.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,b.AP)(e);this.logger.error(t,void 0,n)}})))}catch(e){const[t,n]=(0,b.AP)(e),r=this._filterPanel;r.innerText="error",r.classList.add("d4-error"),i.tooltip.bind(r,t)}}applyProps(){this.helmEditor&&this.updateFilterPanel(this.props.substructure)}get filterPanel(){return this._filterPanel}updateFilterPanel(e){if(!this.helmEditor)throw new Error("helmEditor is not created, the filter is not in dom yet");const t=this._filterPanel.parentElement.clientWidth<100?100:this._filterPanel.parentElement.clientWidth,n=t/2;if(e)(0,v.K)(this._filterPanel,this.helmEditor.host),this.helmEditor.editor.setHelm(e),this.helmEditor.resizeEditor(t,n);else{const e=i.divText("Click to edit","helm-substructure-filter");(0,v.K)(this._filterPanel,e)}}async substructureSearch(e){const t=`${this.viewerToLog()}.substructureSearch( column = <${e.name}> )`;w._package.logger.debug(`${t}, start`);try{return await(0,u.cb)(10),await(0,p.if)(this.props.substructure,e)}finally{w._package.logger.debug(`${t}, end`)}}}const A="bio-substructure-filter";class S{props;filterId;dataFrameId;columnName;bitset;constructor(e,t,n,i,r){this.props=e,this.filterId=t,this.dataFrameId=n,this.columnName=i,this.bitset=r}}class x extends m.n{separator;constructor(e,t){super(e,!1),this.separator=t,this.readOnly=!0}}class E extends r.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=i.divV([]),this.loader=i.loader(),this.calculating=!1,this.filterSyncer=new d.g(this.logger=w._package.logger),new Proxy(this,{set:(e,t,n)=>(e[t]=n,!0)})}static filterCounter=-1;filterId=++E.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(r.SEMTYPE.MACROMOLECULE)),h.GO.forColumn(this.column),this.columnName??=this.column?.name,this.notation??=this.column?.meta.units,this.bioFilter=this.notation===c.Hi.FASTA?new _:this.notation===c.Hi.SEPARATOR?new M(this.column.getTag(c.gp.separator)):new C,this.root.appendChild(this.bioFilter.filterPanel),this.root.appendChild(this.loader),await this.bioFilter.attach(),this.viewSubs.push(r.debounce(this.bioFilter.onChanged,this.debounceTime).subscribe(this.bioFilterOnChangedDebounced.bind(this))),this.viewSubs.push(s.events.onResetFilterRequest.subscribe(this.grokEventsOnResetFilterRequest.bind(this))),this.viewSubs.push(s.events.onCustomEvent(A).subscribe(this.filterOnSync.bind(this)))}))}detach(){const e=super.detach.bind(this),t=`${this.filterToLog()}.detach()`;this.filterSyncer.sync(t,(async()=>{for(const e of this.viewSubs)e.unsubscribe();this.viewSubs=[],e(),this.bioFilter&&this.bioFilter.detach(),this.bioFilter=null}))}filterOnSync(e){e.filterId!==this.filterId&&e.dataFrameId===this.dataFrame.id&&e.columnName===this.columnName&&(this.bioFilter.props=e.props)}applyFilter(){const e=`${this.filterToLog()}.applyFilter()`;this.logger.debug(`${e}, IN`),this.bitset&&!this.isDetached&&this.dataFrame?.filter.and(this.bitset)}saveState(){const e=`${this.filterToLog()}.saveState()`,t=super.saveState();return this.logger.debug(`${e}, super.state = ${JSON.stringify(t)}`),t.props=this.bioFilter.saveProps(),t}applyState(e){const t=`${this.filterToLog()}.applyState()`;super.applyState(e),this.filterSyncer.sync(t,(async()=>{e.props&&this.bioFilter&&(this.bioFilter.props=r.toJs(e.props??{}))}))}fireFilterSync(){const e=`${this.filterToLog()}.fireFilterSync()`;w._package.logger.debug(`${e}, bioFilter = ${this.bioFilter?this.bioFilter.constructor.name:"null"}`+(this.bioFilter?`, props = ${JSON.stringify(this.bioFilter.saveProps())}`:"")),s.events.fireCustomEvent(A,new S(this.bioFilter.props,this.filterId,this.dataFrame.id,this.columnName,this.bitset))}bioFilterOnChangedDebounced(){if(!this.dataFrame)return;const e=`${this.filterToLog()}.bioFilterOnChangedDebounced()`;if(w._package.logger.debug(`${e}, start, isFiltering = ${this.isFiltering}, props = ${JSON.stringify(this.bioFilter.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{w._package.logger.debug(`${e}, before substructureSearch`),this.bitset=await(this.bioFilter?.substructureSearch(this.column)),w._package.logger.debug(`${e}, after substructureSearch`),this.calculating=!1,this.fireFilterSync(),this.dataFrame?.rows.requestFilter()}finally{this.calculating=!1,w._package.logger.debug(`${e}, end`)}}))}grokEventsOnResetFilterRequest(){const e=`${this.filterToLog()}.grokEventsOnResetFilterRequest()`;w._package.logger.debug(`${e}`),this.bioFilter?.resetFilter()}_onRendered=new l.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 i=this.filterSyncer.resetErrors();if(i.length>0)throw i[0]}}class _ extends m.O{emptyProps=new m.n("");substructureInput;get type(){return"FastaBioFilter"}constructor(){super(),this.substructureInput=i.input.string("",{value:"",onValueChanged:()=>{this.props=new m.n(this.substructureInput.value),this._propsChanging||this.onChanged.next()},placeholder:"Substructure"})}applyProps(){this.substructureInput.value!==this.props.substructure&&(this.substructureInput.value=this.props.substructure)}get filterPanel(){return this.substructureInput.root}get isFiltering(){return""!==this.substructureInput.value}async substructureSearch(e){return(0,p.nI)(this.props.substructure,e)}async attach(){}async detach(){await super.detach()}}class M extends m.O{emptyProps=new x("",void 0);substructureInput;separatorInput;colSeparator="";get type(){return"SeparatorBioFilter"}constructor(e){super(),this.substructureInput=i.input.string("",{value:"",onValueChanged:()=>{this.props=new x(this.substructureInput.value,this.props.separator),this._propsChanging||this.onChanged.next()},placeholder:"Substructure"}),this.separatorInput=i.input.string("",{value:this.colSeparator=e,onValueChanged:()=>{const e=this.separatorInput.value?this.separatorInput.value:void 0;this.props=new x(this.props.substructure,e),this._propsChanging||this.onChanged.next()},placeholder:"Separator"})}applyProps(){this.substructureInput.value!==this.props.substructure&&(this.substructureInput.value=this.props.substructure);const e=this.props.separator??this.colSeparator;this.separatorInput.value!==e&&(this.separatorInput.value=e)}get filterSummary(){return this.props.separator?this.props.separator:this.colSeparator,`${this.props.substructure}, {sep}`}get isFiltering(){return""!==this.props.substructure}resetFilter(){this.props=new x("")}get filterPanel(){return i.divV([this.substructureInput.root,this.separatorInput.root])}get substructure(){return this.separatorInput.value&&this.separatorInput.value!==this.colSeparator?this.substructureInput.value.replaceAll(this.separatorInput.value,this.colSeparator):this.substructureInput.value}set substructure(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:()=>_,j:()=>E});var i=n(7389),r=n(6082),s=n(1991),o=n.n(s),a=n(2003),l=n(4152),c=n(5072),u=n.n(c),h=n(7825),d=n.n(h),p=n(7659),m=n.n(p),f=n(5056),g=n.n(f),y=n(540),b=n.n(y),v=n(1113),w=n.n(v),C=n(5999),A={};A.styleTagTransform=w(),A.setAttributes=g(),A.insert=m().bind(null,"head"),A.domAPI=d(),A.insertStyleElement=b(),u()(C.A,A),C.A&&C.A.locals&&C.A.locals;var S=n(826),x=n(2738);function E(e){const t=i.div();t.classList.add("macromolecule-cell-comp-analysis-host");const n=e.cell.column.tags[a.gp.alphabet];let s=l.oT.Color;switch(n){case a.YI.DNA:case a.YI.RNA:s=(0,a.ny)(a.YI.DNA);break;case a.YI.PT:s=(0,a.ny)(a.YI.PT)}const c={},u=S.GO.forColumn(e.cell.column),h=e.cell.rowIndex,d=u.getSplitted(h);o()(d.canonicals).filter((e=>e!==x._S)).forEach((e=>{const t=c[e]||0;c[e]=t+1}));const p=_(s,c);return Array.from(p.rows).forEach((e=>{const t=e.getElementsByClassName("macromolecule-cell-comp-analysis-bar")[0].style.backgroundColor;e.cells[0].style.color=t})),t.appendChild(p),new r.Widget(t)}function _(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,l=e.get(t),c=i.div("",{classes:"macromolecule-cell-comp-analysis-bar"});c.style.width=50*a/o+"px",c.style.backgroundColor=l,x._S===t&&(c.style.borderWidth="1px",c.style.borderStyle="solid",c.style.borderColor=r.Color.toHtml(r.Color.lightGray));const u=x._S===t?"-":t,h=i.div(`${(100*a).toFixed(2)}%`),d=i.div([c,h],{classes:"macromolecule-cell-comp-analysis-value"});return{[u]:d}}))),l=i.tableFromMap(a);return Array.from(l.rows).forEach((e=>{const t=e.getElementsByClassName("macromolecule-cell-comp-analysis-bar")[0].style.backgroundColor;e.cells[0].style.color=t})),l}},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:i,normalizeIPv4:r,removeDotSegments:s,recomposeAuthority:o,normalizeComponentEncoding:a}=n(4834),l=n(343);function c(e,t,n,i){const r={};return i||(e=p(u(e,n),n),t=p(u(t,n),n)),!(n=n||{}).tolerant&&t.scheme?(r.scheme=t.scheme,r.userinfo=t.userinfo,r.host=t.host,r.port=t.port,r.path=s(t.path||""),r.query=t.query):(void 0!==t.userinfo||void 0!==t.host||void 0!==t.port?(r.userinfo=t.userinfo,r.host=t.host,r.port=t.port,r.path=s(t.path||""),r.query=t.query):(t.path?("/"===t.path.charAt(0)?r.path=s(t.path):(void 0===e.userinfo&&void 0===e.host&&void 0===e.port||e.path?e.path?r.path=e.path.slice(0,e.path.lastIndexOf("/")+1)+t.path:r.path=t.path:r.path="/"+t.path,r.path=s(r.path)),r.query=t.query):(r.path=e.path,void 0!==t.query?r.query=t.query:r.query=e.query),r.userinfo=e.userinfo,r.host=e.host,r.port=e.port),r.scheme=e.scheme),r.fragment=t.fragment,r}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:""},i=Object.assign({},t),r=[],a=l[(i.scheme||n.scheme||"").toLowerCase()];a&&a.serialize&&a.serialize(n,i),void 0!==n.path&&(i.skipEscape?n.path=unescape(n.path):(n.path=escape(n.path),void 0!==n.scheme&&(n.path=n.path.split("%3A").join(":")))),"suffix"!==i.reference&&n.scheme&&(r.push(n.scheme),r.push(":"));const c=o(n,i);if(void 0!==c&&("suffix"!==i.reference&&r.push("//"),r.push(c),n.path&&"/"!==n.path.charAt(0)&&r.push("/")),void 0!==n.path){let e=n.path;i.absolutePath||a&&a.absolutePath||(e=s(e)),void 0===c&&(e=e.replace(/^\/\//u,"/%2F")),r.push(e)}return void 0!==n.query&&(r.push("?"),r.push(n.query)),void 0!==n.fragment&&(r.push("#"),r.push(n.fragment)),r.join("")}const h=Array.from({length:127},((e,t)=>/[^!"$&'()*+,\-.;=_`a-z{}~]/u.test(String.fromCharCode(t)))),d=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\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 c=e.match(d);if(c){if(s.scheme=c[1],s.userinfo=c[3],s.host=c[4],s.port=parseInt(c[5],10),s.path=c[6]||"",s.query=c[7],s.fragment=c[8],isNaN(s.port)&&(s.port=c[5]),s.host){const e=r(s.host);if(!1===e.isIPV4){const t=i(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=l[(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,i=e.length;n<i;++n)if(t=e.charCodeAt(n),t>126||h[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:l,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 i=Object.assign({scheme:"null"},n);return u(c(p(e,i),p(t,i),i,!0),{...i,skipEscape:!0})},resolveComponents:c,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 i(e){return"boolean"==typeof e.secure?e.secure:"wss"===String(e.scheme).toLowerCase()}function r(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:r,serialize:s},a={scheme:"ws",domainHost:!0,parse:function(e){return e.secure=i(e),e.resourceName=(e.path||"/")+(e.query?"?"+e.query:""),e.path=void 0,e.query=void 0,e},serialize:function(e){if(e.port!==(i(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}},l={http:o,https:{scheme:"https",domainHost:o.domainHost,parse:r,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 i=e.path.match(n);if(i){const n=t.scheme||e.scheme||"urn";e.nid=i[1].toLowerCase(),e.nss=i[2];const r=`${n}:${t.nid||e.nid}`,s=l[r];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",i=e.nid.toLowerCase(),r=`${n}:${t.nid||i}`,s=l[r];s&&(e=s.serialize(e,t));const o=e,a=e.nss;return o.path=`${i||t.nid}:${a}`,t.skipEscape=!0,o},skipNormalize:!0},"urn:uuid":{scheme:"urn:uuid",parse:function(e,n){const i=e;return i.uuid=i.nss,i.nss=void 0,n.tolerant||i.uuid&&t.test(i.uuid)||(i.error=i.error||"UUID is not valid."),i},serialize:function(e){const t=e;return t.nss=(e.uuid||"").toLowerCase(),t},skipNormalize:!0}};e.exports=l},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:i}=n(4914);function r(e){if(l(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="",r=!0;for(const t of e){if(void 0===i[t])return;"0"!==t&&!0===r&&(r=!1),r||(n+=t)}return t&&0===n.length&&(n="0"),n}function o(e,t={}){if(l(e,":")<2)return{host:e,isIPV6:!1};const n=function(e){let t=0;const n={error:!1,address:"",zone:""},i=[],r=[];let o=!1,a=!1,l=!1;function c(){if(r.length){if(!1===o){const e=s(r);if(void 0===e)return n.error=!0,!1;i.push(e)}r.length=0}return!0}for(let s=0;s<e.length;s++){const u=e[s];if("["!==u&&"]"!==u)if(":"!==u)if("%"===u){if(!c())break;o=!0}else r.push(u);else{if(!0===a&&(l=!0),!c())break;if(t++,i.push(":"),t>7){n.error=!0;break}s-1>=0&&":"===e[s-1]&&(a=!0)}}return r.length&&(o?n.zone=r.join(""):l?i.push(r.join("")):i.push(s(r))),n.address=i.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="",i=!0;const r=e.length;for(let s=0;s<r;s++){const o=e[s];"0"===o&&i?(s+1<=r&&e[s+1]===t||s+1===r)&&(n+=o,i=!1):(i=o===t,n+=o)}return n}function l(e,t){let n=0;for(let i=0;i<e.length;i++)e[i]===t&&n++;return n}const c=/^\.\.?\//u,u=/^\/\.(?:\/|$)/u,h=/^\/\.\.(?:\/|$)/u,d=/^\/?(?:.|\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 i=r(t);if(i.isIPV4)t=i.host;else{const n=o(i.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(c))e=e.replace(c,"");else if(e.match(u))e=e.replace(u,"/");else if(e.match(h))e=e.replace(h,"/"),t.pop();else if("."===e||".."===e)e="";else{const n=e.match(d);if(!n)throw new Error("Unexpected dot segment condition");{const i=n[0];e=e.slice(i.length),t.push(i)}}return t.join("")},normalizeIPv4:r,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(i){var r=t[i];if(void 0!==r)return r.exports;var s=t[i]={id:i,loaded:!1,exports:{}};return e[i].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 i in t)n.o(t,i)&&!n.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},n.u=e=>e+".js",n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.hmd=e=>((e=Object.create(e)).children||(e.children=[]),Object.defineProperty(e,"exports",{enumerable:!0,set:()=>{throw new Error("ES Modules may not assign module.exports or exports.*, Use ESM export syntax, instead: "+e.id)}}),e),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e;n.g.importScripts&&(e=n.g.location+"");var t=n.g.document;if(!e&&t&&(t.currentScript&&(e=t.currentScript.src),!e)){var i=t.getElementsByTagName("script");if(i.length)for(var r=i.length-1;r>-1&&(!e||!/^http(s?):/.test(e));)e=i[r--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),n.p=e})(),n.b=document.baseURI||self.location.href,n.nc=void 0;var i=n(682);bio=i})();
8
8
  //# sourceMappingURL=package.js.map