{"version":3,"file":"main.min.js","sources":["main.min.js"],"sourcesContent":["// import Popper\n// ../../../node_modules/popper.js/dist/umd/popper.js\n\n// import required js-files Bootstrap 5\n// ../../../node_modules/bootstrap/js/dist/alert.js\n// ../../../node_modules/bootstrap/js/dist/button.js\n// ../../../node_modules/bootstrap/js/dist/carousel.js\n// ../../../node_modules/bootstrap/js/dist/collapse.js\n// ../../../node_modules/bootstrap/js/dist/dropdown.js\n// ../../../node_modules/bootstrap/js/dist/modal.js\n// ../../../node_modules/bootstrap/js/dist/popover.js\n// ../../../node_modules/bootstrap/js/dist/scrollspy.js\n// ../../../node_modules/bootstrap/js/dist/tab.js\n// ../../../node_modules/bootstrap/js/dist/toast.js\n// ../../../node_modules/bootstrap/js/dist/tooltip.js\n\n\nfunction bruh_moment(){\n\talert('this is a bruh moment')\n}\n\nconst downloadToFile = (content, filename, contentType) => {\n const a = document.createElement('a');\n const file = new Blob([content], {type: contentType});\n \n a.href= URL.createObjectURL(file);\n a.download = filename;\n a.click();\n\n\tURL.revokeObjectURL(a.href);\n};\n\nfunction get_smiles_from_element_text(el_id){\n\tvar inputVal = document.getElementById(el_id).value;\n\tlet url = `https://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/name/${inputVal}/property/CanonicalSMILES/JSON`;\n\tconsole.log(url)\n\tfetch(url)\n\t.then(res => res.json())\n\t.then((out) => {\n\t console.log('Aye, got that dub from PubChem');\n\t //console.log(out[\"PropertyTable\"][\"Properties\"][0][\"CanonicalSMILES\"])\n\t document.getElementById(\"inputSMILES\").value = out[\"PropertyTable\"][\"Properties\"][0][\"CanonicalSMILES\"]\n\t})\n\t.catch(err => { \n\t\tbruh_moment()\n\t\tthrow err });\n}\n\n\n\nfunction draw_me_like_one_of_your_french_girls(mol){\n\t\n\tmol.condense_abbreviations();\n\t//var canvas = document.getElementById(\"draw-canvas-2\");\n\t//mol.draw_to_canvas(canvas, -1, -1);\n\tvar dest = document.getElementById(\"draw-output\");\n\tvar svg = mol.get_svg();\n\tdest.outerHTML = \"
\" + svg + \"
\";\n\tdocument.getElementById('drawing-1').children[0].setAttribute(\"height\", \"100%\");\n\tdocument.getElementById('drawing-1').children[0].setAttribute(\"width\", \"100%\");\n}\n\n\nfunction calculate_and_disperse(mol){\n\tconst shy_values_do_not_show = [\"NumUnspecifiedAtomStereoCenters\",\"NumAliphaticHeterocycles\",\n\t\"NumSaturatedHeterocycles\",\"NumAromaticHeterocycles\",\"NumAmideBonds\",\"NumAromaticRings\",\"NumAliphaticRings\"\n\t,\"NumSaturatedRings\",\"NumSpiroAtoms\",\"NumBridgeheadAtoms\",\"NumAtomStereoCenters\"]\n\ttry {\n\t\tvar descrs = JSON.parse(mol.get_descriptors());\n\t} catch(err) {\n\t\talert(\"oo wee, failed to calculate descriptors senpai\")\n\t}\n\t//document.getElementById('exactmw').textContent = descrs[\"exactmw\"];\n\t//document.getElementById('CrippenMR').textContent = descrs[\"CrippenMR\"];\n\t//document.getElementById('CrippenClogP').textContent = descrs[\"CrippenClogP\"];\n\tlet tableRef = document.getElementById(\"analyse_table\");\n\tconst keys = Object.keys(descrs);\n\t\tfor (let i = 0; i < keys.length; i++) {\n\t\t\tconst key = keys[i];\n\t\t\tif(shy_values_do_not_show.indexOf(key) !== -1){\n \t\t//console.log(\"skipping\")\n \t\t} else{\n\t\t\t\t//console.log(key, descrs[key]);\n\t\t\t\tvar newRow = tableRef.insertRow(-1);\n\t\t\t \tvar newCell_label = newRow.insertCell(0);\n\t\t\t \tvar newCell_value = newRow.insertCell(-1);\n\t\t\t \tvar newText_label = document.createTextNode(key);\n\t\t\t \tvar newText_value = document.createTextNode(descrs[key]);\n\t\t\t \tnewCell_label.appendChild(newText_label);\n\t\t\t \tnewCell_value.appendChild(newText_value);\n\t\t\t}\n\t\t}\n\t\n}\n\nfunction convert_me_senpai(smiles) {\n\tvar OpenBabel = OpenBabelModule();\n\tOpenBabel.onRuntimeInitialized = function() {\n\t\tvar conv = new OpenBabel.ObConversionWrapper();\n\t\ttry {\n\t\t\tvar inData = smiles; \n\t\t\tconv.setInFormat('', 'smiles'); \n\t\t\tvar mol = new OpenBabel.OBMol();\n\t\t\tconv.readString(mol, inData);\n\t\t\tconv.setOutFormat('', 'pdbqt');\n\t\t\tvar outData = conv.writeString(mol, false);\n\t\t\t//console.log(outData);\n\t\t\tdocument.getElementById('download-pdbqt').disabled=false;\n\t\t\treturn outData;\n\t\t} finally {\n\t\t\tconv.delete(); // free ObConversionWrapper instance\n\t\t}\n\t}\n}\n\nfunction analyse_me_senpai(smile_pwiz) {\n\tvar smiles = document.getElementById(smile_pwiz).value;\n\tvar mol = Module.get_mol(smiles);\n\tdraw_me_like_one_of_your_french_girls(mol);\n\tcalculate_and_disperse(mol);\n\tsmiles_text = convert_me_senpai(smiles);\n}\n\nfunction download_pdbqt(){\n\tif (document.getElementById(\"inputName\").value === \"\"){\n\t\tvar fname = \"compound.pdbqt\"\n\t} else {\n\t\tvar fname = `${document.getElementById(\"inputName\").value}.pdbqt`\n\t}\n\ttry {\n\t\t\t//var smiles_text = convert_me_senpai(document.getElementById(\"inputSMILES\").value)\n\t\t\tdownloadToFile(smiles_text,fname,\"chemical/x-pdbqt\")\n\t\t} catch(err) {\n\t\t\tconsole.error(err)\n\t\t\tbruh_moment()\n\t\t}\n}"],"names":["bruh_moment","alert","downloadToFile","content","filename","contentType","a","document","createElement","file","Blob","type","href","URL","createObjectURL","download","click","revokeObjectURL","get_smiles_from_element_text","el_id","url","getElementById","value","console","log","fetch","then","res","json","out","catch","err","draw_me_like_one_of_your_french_girls","mol","condense_abbreviations","dest","svg","get_svg","outerHTML","children","setAttribute","calculate_and_disperse","shy_values_do_not_show","descrs","JSON","parse","get_descriptors","tableRef","keys","Object","i","length","newCell_label","newCell_value","newText_label","key","indexOf","newRow","insertRow","insertCell","createTextNode","newText_value","appendChild","convert_me_senpai","smiles","OpenBabel","OpenBabelModule","onRuntimeInitialized","conv","ObConversionWrapper","inData","setInFormat","OBMol","readString","setOutFormat","outData","writeString","disabled","delete","analyse_me_senpai","smile_pwiz","Module","get_mol","smiles_text","download_pdbqt","fname","error"],"mappings":"AAiBA,SAASA,cACRC,MAAM,yBAGP,MAAMC,eAAiB,CAACC,EAASC,EAAUC,KACzC,MAAMC,EAAIC,SAASC,cAAc,KAC3BC,EAAO,IAAIC,KAAK,CAACP,GAAU,CAACQ,KAAMN,IAExCC,EAAEM,KAAMC,IAAIC,gBAAgBL,GAC5BH,EAAES,SAAWX,EACbE,EAAEU,QAEHH,IAAII,gBAAgBX,EAAEM,OAGvB,SAASM,6BAA6BC,GAEjCC,6DADWb,SAASc,eAAeF,GAAOG,sCAE9CC,QAAQC,IAAIJ,GACZK,MAAML,GACLM,KAAKC,GAAOA,EAAIC,QAChBF,KAAK,IACJH,QAAQC,IAAI,kCAEZjB,SAASc,eAAe,eAAeC,MAAQO,EAAmB,cAAc,WAAE,GAAoB,kBAEvGC,MAAMC,IAEN,MADA/B,cACM+B,IAKR,SAASC,sCAAsCC,GAE9CA,EAAIC,yBAGJ,IAAIC,EAAO5B,SAASc,eAAe,eAC/Be,EAAMH,EAAII,UACdF,EAAKG,UAAY,uBAAyBF,EAAM,SAChD7B,SAASc,eAAe,aAAakB,SAAS,GAAGC,aAAa,SAAU,QACxEjC,SAASc,eAAe,aAAakB,SAAS,GAAGC,aAAa,QAAS,QAIxE,SAASC,uBAAuBR,GAC/B,MAAMS,EAAyB,CAAC,kCAAkC,2BAClE,2BAA2B,0BAA0B,gBAAgB,mBAAmB,oBACvF,oBAAoB,gBAAgB,qBAAqB,wBAC1D,IACC,IAAIC,EAASC,KAAKC,MAAMZ,EAAIa,mBAC3B,MAAMf,GACP9B,MAAM,kDAKP,IAAI8C,EAAWxC,SAASc,eAAe,iBACvC,IAAM2B,EAAOC,OAAOD,KAAKL,GACxB,IAAK,IAAIO,EAAI,EAAGA,EAAIF,EAAKG,OAAQD,IAAK,CACrC,IAMOE,EACAC,EACAC,EARDC,EAAMP,EAAKE,IAC2B,IAAzCR,EAAuBc,QA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