Commit db3552fd authored by Jacob Durrant's avatar Jacob Durrant

Improved molecule editing/converting, etc.

parent 47bb71f1
Changes
=======
WIP
---
* Updated copyright notices.
* Created a separate, independent helper app called PDBQTConvert that can
convert files in many other formats (e.g., PDB, XYZ, CAN, SMI) to PDBQT (see
`pdbqt_convert/`). This app uses
[openbabel.js](https://github.com/partridgejiang/cheminfo-to-web/)
and is GNU GPL licensed. We distribute it alongside Webina, but as a
separate program.
* Modified Webina so users can optionally use PDBQTConvert to convert their
files. Webina communicates with PDBQTConvert at "arms length," via an
iframe.
* Added the ability to draw small-molecule ligands using the [PubChem
Sketcher](https://pubchem.ncbi.nlm.nih.gov/edit3/index.html) provided by the
NIH (embedded via an iframe).
1.0.0
-----
The initial version released with the publication.
* The initial version.
* Apache License 2.0.
This diff is collapsed.
/**
* Webina Copyright 2019 Jacob Durrant
*
* Licensed under the Apache License, Version 2.0 (the License);
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.arrayIteratorImpl=function(a){var c=0;return function(){return c<a.length?{done:!1,value:a[c++]}:{done:!0}}};$jscomp.arrayIterator=function(a){return{next:$jscomp.arrayIteratorImpl(a)}};$jscomp.ASSUME_ES5=!1;$jscomp.ASSUME_NO_NATIVE_MAP=!1;$jscomp.ASSUME_NO_NATIVE_SET=!1;$jscomp.SIMPLE_FROUND_POLYFILL=!1;
$jscomp.defineProperty=$jscomp.ASSUME_ES5||"function"==typeof Object.defineProperties?Object.defineProperty:function(a,c,b){a!=Array.prototype&&a!=Object.prototype&&(a[c]=b.value)};$jscomp.getGlobal=function(a){return"undefined"!=typeof window&&window===a?a:"undefined"!=typeof global&&null!=global?global:a};$jscomp.global=$jscomp.getGlobal(this);$jscomp.SYMBOL_PREFIX="jscomp_symbol_";$jscomp.initSymbol=function(){$jscomp.initSymbol=function(){};$jscomp.global.Symbol||($jscomp.global.Symbol=$jscomp.Symbol)};
$jscomp.SymbolClass=function(a,c){this.$jscomp$symbol$id_=a;$jscomp.defineProperty(this,"description",{configurable:!0,writable:!0,value:c})};$jscomp.SymbolClass.prototype.toString=function(){return this.$jscomp$symbol$id_};$jscomp.Symbol=function(){function a(b){if(this instanceof a)throw new TypeError("Symbol is not a constructor");return new $jscomp.SymbolClass($jscomp.SYMBOL_PREFIX+(b||"")+"_"+c++,b)}var c=0;return a}();
$jscomp.initSymbolIterator=function(){$jscomp.initSymbol();var a=$jscomp.global.Symbol.iterator;a||(a=$jscomp.global.Symbol.iterator=$jscomp.global.Symbol("Symbol.iterator"));"function"!=typeof Array.prototype[a]&&$jscomp.defineProperty(Array.prototype,a,{configurable:!0,writable:!0,value:function(){return $jscomp.iteratorPrototype($jscomp.arrayIteratorImpl(this))}});$jscomp.initSymbolIterator=function(){}};
$jscomp.initSymbolAsyncIterator=function(){$jscomp.initSymbol();var a=$jscomp.global.Symbol.asyncIterator;a||(a=$jscomp.global.Symbol.asyncIterator=$jscomp.global.Symbol("Symbol.asyncIterator"));$jscomp.initSymbolAsyncIterator=function(){}};$jscomp.iteratorPrototype=function(a){$jscomp.initSymbolIterator();a={next:a};a[$jscomp.global.Symbol.iterator]=function(){return this};return a};
$jscomp.iteratorFromArray=function(a,c){$jscomp.initSymbolIterator();a instanceof String&&(a+="");var b=0,d={next:function(){if(b<a.length){var e=b++;return{value:c(e,a[e]),done:!1}}d.next=function(){return{done:!0,value:void 0}};return d.next()}};d[Symbol.iterator]=function(){return d};return d};
$jscomp.polyfill=function(a,c,b,d){if(c){b=$jscomp.global;a=a.split(".");for(d=0;d<a.length-1;d++){var e=a[d];e in b||(b[e]={});b=b[e]}a=a[a.length-1];d=b[a];c=c(d);c!=d&&null!=c&&$jscomp.defineProperty(b,a,{configurable:!0,writable:!0,value:c})}};$jscomp.polyfill("Array.prototype.keys",function(a){return a?a:function(){return $jscomp.iteratorFromArray(this,function(a){return a})}},"es6","es3");var VERSION="1.0.0";console.log("Webina Library "+VERSION);console.log(" Compiled from Vina 1.1.2 codebase:");
console.log(" http://vina.scripps.edu/");
var WEBINA_Module,decodeBase64="function"==typeof atob?atob:function(a){var c,b,d,e,f,m,g="",h=0;for(a=a.replace(/[^A-Za-z0-9\+\/=]/g,"");c="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(a.charAt(h++))<<2|(e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(a.charAt(h++)))>>4,b=(15&e)<<4|(f="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(a.charAt(h++)))>>2,d=(3&f)<<6|(m="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(a.charAt(h++))),g+=
String.fromCharCode(c),64!==f&&(g+=String.fromCharCode(b)),64!==m&&(g+=String.fromCharCode(d)),h<a.length;)return g},Webina=function(){return{WEBINA_ENVIRONMENT_IS_NODE:window.WEBINA_ENVIRONMENT_IS_NODE,WEBINA_lengthBytesUTF8:window.WEBINA_lengthBytesUTF8,WEBINA_stringToUTF8Array:window.WEBINA_stringToUTF8Array,WEBINA_assert:window.WEBINA_assert,WEBINA_ASSERTIONS:1,WEBINA_DATA_URI_PREFIX:"data:application/octet-stream;base64,",WEBINA_BASE_URL:"./",FS:window.FS,start:function(a,c,b,d,e,f){var m=this,
g="\nWEBINA\n======\n\n";void 0!==f?("/"!==f.slice(f.length-1)&&(f+="/"),this.WEBINA_BASE_URL=f,g+="User specified baseUrl: "+f+"\n"):g+="No baseUrl specified, so using ./\n\nUse Webina.start() to specify the baseUrl:\n function start(vinaParams, receptorPDBQTTxt, \n ligandPDBQTTxt, onDone, \n onError, baseUrl)\n";g+="\nExpecting files at the following locations:\n";for(var h=0;5>h;h++)g+=" "+(void 0===f?"./":f)+["Webina.min.min.js","vina.html.mem","vina.min.min.js",
"vina.worker.min.min.js","vina.wasm"][h]+"\n";g+="\n";void 0!==f?console.log(g):console.warn(g);void 0===e&&(e=function(){console.log("Webina encountered an error! Does your browser support WebAssembly?")});WEBINA_Module={preRun:[],postRun:[],stdOut:"",stdErr:"",print:function(){return function(a){1<arguments.length&&(a=Array.prototype.slice.call(arguments).join(" "));window.WEBINA_Module.stdOut+=a+"\n"}}(),printErr:function(a){1<arguments.length&&(a=Array.prototype.slice.call(arguments).join(" "));window.WEBINA_Module.stdErr+=
a+"\n"},setStatus:function(a){""===a&&void 0!==d&&(a=(new TextDecoder("utf-8")).decode(window.FS.readFile("ligand_out.pdbqt")),d(a,window.WEBINA_Module.stdOut,window.WEBINA_Module.stdErr))},onError:e,catchError:function(a){e(a)},receptorPDBQTTxt:c,ligandPDBQTTxt:b};void 0!==a.receptor&&console.warn("Webina does not support Vina's --receptor parameter. Instead, pass the content of the receptor file as a string to the webina.start() function.");void 0!==a.receptor&&console.warn("Webina does not support Vina's --ligand parameter. Instead, pass the content of the ligand file as a string to the webina.start() function.");
WEBINA_Module.arguments=["--receptor","/receptor.pdbqt","--ligand","/ligand.pdbqt"];c=Object.keys(a);b=c.length;for(h=0;h<b;h++)f=c[h],g=a[f],WEBINA_Module.arguments.push("--"+f),"boolean"!==typeof g&&WEBINA_Module.arguments.push(String(g));window.WEBINA_Module=WEBINA_Module;var k=this.WEBINA_BASE_URL+"vina.html.mem";k=WEBINA_Module.locateFile?WEBINA_Module.locateFile(k,""):k;WEBINA_Module.memoryInitializerRequestURL=k;var l=WEBINA_Module.memoryInitializerRequest=new XMLHttpRequest;l.onloadend=function(){if(404===
l.status){var a="Unable to access "+k+'. See JavaScript console for warnings. The "baseUrl" variable passed to Webina is likely incorrect.';WEBINA_Module.catchError({message:a});console.warn(a)}else a=document.createElement("script"),a.src=m.WEBINA_BASE_URL+"vina.min.js",document.body.appendChild(a)};l.open("GET",k,!0);l.responseType="arraybuffer";l.send(null)},isDataURI:function(a){return String.prototype.startsWith?a.startsWith(this.WEBINA_DATA_URI_PREFIX):0===a.indexOf(this.WEBINA_DATA_URI_PREFIX)},
intArrayFromBase64:function(a){if("boolean"==typeof this.WEBINA_ENVIRONMENT_IS_NODE&&this.WEBINA_ENVIRONMENT_IS_NODE){try{var c=Buffer.from(a,"base64")}catch(e){c=new Buffer(a,"base64")}return new Uint8Array(c.buffer,c.byteOffset,c.byteLength)}try{var b=decodeBase64(a),d=new Uint8Array(b.length);for(a=0;a<b.length;++a)d[a]=b.charCodeAt(a);return d}catch(e){throw Error("Converting base64 string to bytes failed.");}},tryParseAsDataURI:function(a){if(this.isDataURI(a))return this.intArrayFromBase64(a.slice(this.WEBINA_DATA_URI_PREFIX.length))},
intArrayFromString:function(a,c,b){b=0<b?b:this.WEBINA_lengthBytesUTF8(a)+1;b=Array(b);a=this.WEBINA_stringToUTF8Array(a,b,0,b.length);return c&&(b.length=a),b},intArrayToString:function(a){for(var c=[],b=0;b<a.length;b++){var d=a[b];255<d&&(this.WEBINA_ASSERTIONS&&this.WEBINA_assert(!1,"Character code "+d+" ("+String.fromCharCode(d)+") at offset "+b+" not in 0x00-0xFF."),d&=255);c.push(String.fromCharCode(d))}return c.join("")}}}();
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
var threadInfoStruct=0,selfThreadId=0,parentThreadId=0,tempDoublePtr=0,STACK_BASE=0,STACKTOP=0,STACK_MAX=0,buffer,DYNAMICTOP_PTR=0,DYNAMIC_BASE=0,noExitRuntime,PthreadWorkerInit={},__performance_now_clock_drift=0,WEBINA_Module={};function WEBINA_assert(a,b){a||abort("Assertion failed: "+b)}
this.addEventListener("error",function(a){if(-1!=a.message.indexOf("SimulateInfiniteLoop"))return a.preventDefault();var b=" in "+a.filename+":"+a.lineno+":"+a.colno;console.error("Pthread "+selfThreadId+" uncaught exception"+(a.filename||a.lineno||a.colno?b:"")+": "+a.message+". Error object:");console.error(a.error)});function threadPrintErr(){var a=Array.prototype.slice.call(arguments).join(" ");console.error(a);console.error(Error().stack)}
function threadAlert(){var a=Array.prototype.slice.call(arguments).join(" ");postMessage({cmd:"alert",text:a,threadId:selfThreadId})}var err=threadPrintErr;this.alert=threadAlert;function resetPrototype(a,b){a=Object.create(a.prototype);for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);return a}WEBINA_Module.instantiateWasm=function(a,b){a=new WebAssembly.Instance(wasmModule,a);wasmModule=null;b(a);return a.exports};var wasmModule,wasmMemory;
this.onmessage=function(a){try{if("load"===a.data.cmd){tempDoublePtr=a.data.tempDoublePtr;DYNAMIC_BASE=a.data.DYNAMIC_BASE;DYNAMICTOP_PTR=a.data.DYNAMICTOP_PTR;WEBINA_Module.STACK_MAX=WEBINA_Module.STACKTOP=2147483647;wasmModule=a.data.wasmModule;wasmMemory=a.data.wasmMemory;buffer=wasmMemory.buffer;PthreadWorkerInit=a.data.PthreadWorkerInit;WEBINA_Module.ENVIRONMENT_IS_PTHREAD=!0;if("string"===typeof a.data.urlOrBlob)importScripts(a.data.urlOrBlob);else{var b=URL.createObjectURL(a.data.urlOrBlob);
importScripts(b);URL.revokeObjectURL(b)}"undefined"!==typeof FS&&"function"===typeof FS.createStandardStreams&&FS.createStandardStreams();postMessage({cmd:"loaded"})}else if("objectTransfer"===a.data.cmd)PThread.receiveObjectTransfer(a.data);else if("run"===a.data.cmd){__performance_now_clock_drift=performance.now()-a.data.time;threadInfoStruct=a.data.threadInfoStruct;__register_pthread_ptr(threadInfoStruct,0,0);selfThreadId=a.data.selfThreadId;parentThreadId=a.data.parentThreadId;var d=a.data.stackBase+
a.data.stackSize,e=a.data.stackBase;STACKTOP=STACK_BASE=e;STACK_MAX=d;WEBINA_assert(threadInfoStruct);WEBINA_assert(selfThreadId);WEBINA_assert(parentThreadId);WEBINA_assert(0!=STACK_BASE);WEBINA_assert(d>a.data.stackBase);WEBINA_assert(d>e);WEBINA_assert(a.data.stackBase===e);WEBINA_Module.establishStackSpace(a.data.stackBase,a.data.stackBase+a.data.stackSize);writeStackCookie();PThread.receiveObjectTransfer(a.data);PThread.setThreadStatus(_pthread_self(),1);try{var f=WEBINA_Module.dynCall_ii(a.data.start_routine,
a.data.arg);checkStackCookie()}catch(c){if("Canceled!"===c){PThread.threadCancel();return}if("SimulateInfiniteLoop"===c||"pthread_exit"===c)return;Atomics.store(HEAPU32,threadInfoStruct+4>>2,c instanceof ExitStatus?c.status:-2);Atomics.store(HEAPU32,threadInfoStruct+0>>2,1);if("function"!==typeof _emscripten_futex_wake)throw err("Thread Initialisation failed."),c;_emscripten_futex_wake(threadInfoStruct+0,2147483647);if(!(c instanceof ExitStatus))throw c;}noExitRuntime||PThread.threadExit(f)}else"cancel"===
a.data.cmd?threadInfoStruct&&0==PThread.thisThreadCancelState&&PThread.threadCancel():"setimmediate"!==a.data.target&&("processThreadQueue"===a.data.cmd?threadInfoStruct&&_emscripten_current_thread_process_queued_calls():(err("worker.min.js received unknown command "+a.data.cmd),console.error(a.data)))}catch(c){throw console.error("worker.min.js onmessage() captured an uncaught exception: "+c),console.error(c.stack),c;}};
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
<!doctype html>
<html lang="en-us">
<html lang="en-us">
<head>
<!--
This file is part of Webina, released under the Apache 2.0
License. See LICENSE.md or go to
https://opensource.org/licenses/Apache-2.0 for full details.
Copyright 2020 Jacob D. Durrant.
-->
<meta charset="utf-8">
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<title>Webina</title>
<link rel="shortcut icon" href="favicon.ico"><link href="vendors.24f544c55bbf0fea1b2d.1.css" rel="stylesheet"><link href="styles.24f544c55bbf0fea1b2d.3.css" rel="stylesheet"></head>
<link rel="shortcut icon" href="favicon.ico"><link href="vendors.bada13cfacf3ef663f74.css" rel="stylesheet"><link href="styles.css.bada13cfacf3ef663f74.css" rel="stylesheet"></head>
<body>
<div id="app"></div>
......@@ -19,6 +24,6 @@
<script src="vue.min.js"></script>
<script src="vuex.min.js"></script>
<script src="bootstrap-vue.min.js"></script>
<script type="text/javascript" src="runtime.24f544c55bbf0fea1b2d.js"></script><script type="text/javascript" src="vendors.24f544c55bbf0fea1b2d.js"></script><script type="text/javascript" src="app.24f544c55bbf0fea1b2d.js"></script><script type="text/javascript" src="styles.24f544c55bbf0fea1b2d.js"></script><script type="text/javascript" src="styles.css.24f544c55bbf0fea1b2d.js"></script></body>
<script type="text/javascript" src="runtime.bada13cfacf3ef663f74.js"></script><script type="text/javascript" src="vendors.bada13cfacf3ef663f74.js"></script><script type="text/javascript" src="app.bada13cfacf3ef663f74.js"></script><script type="text/javascript" src="styles.css.bada13cfacf3ef663f74.js"></script></body>
</html>
This diff is collapsed.
(function(m){function p(a){for(var b=a[0],c=a[1],d=a[2],f,h,e=0,g=[];e<b.length;e++)h=b[e],Object.prototype.hasOwnProperty.call(k,h)&&k[h]&&g.push(k[h][0]),k[h]=0;for(f in c)Object.prototype.hasOwnProperty.call(c,f)&&(m[f]=c[f]);for(q&&q(a);g.length;)g.shift()();l.push.apply(l,d||[]);return r()}function r(){for(var a,b=0;b<l.length;b++){for(var n=l[b],d=!0,f=1;f<n.length;f++)0!==k[n[f]]&&(d=!1);d&&(l.splice(b--,1),a=c(c.s=n[0]))}return a}function c(a){if(e[a])return e[a].exports;var b=e[a]={i:a,l:!1,
exports:{}};m[a].call(b.exports,b,b.exports,c);b.l=!0;return b.exports}var e={},k={0:0},l=[];c.m=m;c.c=e;c.d=function(a,b,d){c.o(a,b)||Object.defineProperty(a,b,{enumerable:!0,get:d})};c.r=function(a){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(a,Symbol.toStringTag,{value:"Module"});Object.defineProperty(a,"__esModule",{value:!0})};c.t=function(a,b){b&1&&(a=c(a));if(b&8||b&4&&"object"===typeof a&&a&&a.__esModule)return a;var d=Object.create(null);c.r(d);Object.defineProperty(d,
"default",{enumerable:!0,value:a});if(b&2&&"string"!=typeof a)for(var e in a)c.d(d,e,function(b){return a[b]}.bind(null,e));return d};c.n=function(a){var b=a&&a.__esModule?function(){return a["default"]}:function(){return a};c.d(b,"a",b);return b};c.o=function(a,b){return Object.prototype.hasOwnProperty.call(a,b)};c.p="";var d=window.webpackJsonp=window.webpackJsonp||[],t=d.push.bind(d);d.push=p;d=d.slice();for(var g=0;g<d.length;g++)p(d[g]);var q=t;r()})([]);
This source diff could not be displayed because it is too large. You can view the blob instead.
(window.webpackJsonp=window.webpackJsonp||[]).push([[3],{1:function(b,c,a){a("+eM2");a("LdiE");a("GwUf");b.exports=a("8Lv4")},"8Lv4":function(b,c,a){},GwUf:function(b,c,a){}}]);
(function(){(window.webpackJsonp=window.webpackJsonp||[]).push([[4],[],[[1,0,1,3]]])}).call(this||window);
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
This diff is collapsed.
/**
* vuex v3.1.1
* (c) 2019 Evan You
* @license MIT
*/
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t=t||self).Vuex=e()}(this,function(){"use strict";var t=("undefined"!=typeof window?window:"undefined"!=typeof global?global:{}).__VUE_DEVTOOLS_GLOBAL_HOOK__;function e(t,e){Object.keys(t).forEach(function(n){return e(t[n],n)})}var n=function(t,e){this.runtime=e,this._children=Object.create(null),this._rawModule=t;var n=t.state;this.state=("function"==typeof n?n():n)||{}},o={namespaced:{configurable:!0}};o.namespaced.get=function(){return!!this._rawModule.namespaced},n.prototype.addChild=function(t,e){this._children[t]=e},n.prototype.removeChild=function(t){delete this._children[t]},n.prototype.getChild=function(t){return this._children[t]},n.prototype.update=function(t){this._rawModule.namespaced=t.namespaced,t.actions&&(this._rawModule.actions=t.actions),t.mutations&&(this._rawModule.mutations=t.mutations),t.getters&&(this._rawModule.getters=t.getters)},n.prototype.forEachChild=function(t){e(this._children,t)},n.prototype.forEachGetter=function(t){this._rawModule.getters&&e(this._rawModule.getters,t)},n.prototype.forEachAction=function(t){this._rawModule.actions&&e(this._rawModule.actions,t)},n.prototype.forEachMutation=function(t){this._rawModule.mutations&&e(this._rawModule.mutations,t)},Object.defineProperties(n.prototype,o);var i,r=function(t){this.register([],t,!1)};r.prototype.get=function(t){return t.reduce(function(t,e){return t.getChild(e)},this.root)},r.prototype.getNamespace=function(t){var e=this.root;return t.reduce(function(t,n){return t+((e=e.getChild(n)).namespaced?n+"/":"")},"")},r.prototype.update=function(t){!function t(e,n,o){n.update(o);if(o.modules)for(var i in o.modules){if(!n.getChild(i))return;t(e.concat(i),n.getChild(i),o.modules[i])}}([],this.root,t)},r.prototype.register=function(t,o,i){var r=this;void 0===i&&(i=!0);var s=new n(o,i);0===t.length?this.root=s:this.get(t.slice(0,-1)).addChild(t[t.length-1],s);o.modules&&e(o.modules,function(e,n){r.register(t.concat(n),e,i)})},r.prototype.unregister=function(t){var e=this.get(t.slice(0,-1)),n=t[t.length-1];e.getChild(n).runtime&&e.removeChild(n)};var s=function(e){var n=this;void 0===e&&(e={}),!i&&"undefined"!=typeof window&&window.Vue&&d(window.Vue);var o=e.plugins;void 0===o&&(o=[]);var s=e.strict;void 0===s&&(s=!1),this._committing=!1,this._actions=Object.create(null),this._actionSubscribers=[],this._mutations=Object.create(null),this._wrappedGetters=Object.create(null),this._modules=new r(e),this._modulesNamespaceMap=Object.create(null),this._subscribers=[],this._watcherVM=new i;var a=this,c=this.dispatch,u=this.commit;this.dispatch=function(t,e){return c.call(a,t,e)},this.commit=function(t,e,n){return u.call(a,t,e,n)},this.strict=s;var h=this._modules.root.state;p(this,h,[],this._modules.root),f(this,h),o.forEach(function(t){return t(n)}),(void 0!==e.devtools?e.devtools:i.config.devtools)&&function(e){t&&(e._devtoolHook=t,t.emit("vuex:init",e),t.on("vuex:travel-to-state",function(t){e.replaceState(t)}),e.subscribe(function(e,n){t.emit("vuex:mutation",e,n)}))}(this)},a={state:{configurable:!0}};function c(t,e){return e.indexOf(t)<0&&e.push(t),function(){var n=e.indexOf(t);n>-1&&e.splice(n,1)}}function u(t,e){t._actions=Object.create(null),t._mutations=Object.create(null),t._wrappedGetters=Object.create(null),t._modulesNamespaceMap=Object.create(null);var n=t.state;p(t,n,[],t._modules.root,!0),f(t,n,e)}function f(t,n,o){var r=t._vm;t.getters={};var s=t._wrappedGetters,a={};e(s,function(e,n){a[n]=function(t,e){return function(){return t(e)}}(e,t),Object.defineProperty(t.getters,n,{get:function(){return t._vm[n]},enumerable:!0})});var c=i.config.silent;i.config.silent=!0,t._vm=new i({data:{$$state:n},computed:a}),i.config.silent=c,t.strict&&function(t){t._vm.$watch(function(){return this._data.$$state},function(){},{deep:!0,sync:!0})}(t),r&&(o&&t._withCommit(function(){r._data.$$state=null}),i.nextTick(function(){return r.$destroy()}))}function p(t,e,n,o,r){var s=!n.length,a=t._modules.getNamespace(n);if(o.namespaced&&(t._modulesNamespaceMap[a]=o),!s&&!r){var c=h(e,n.slice(0,-1)),u=n[n.length-1];t._withCommit(function(){i.set(c,u,o.state)})}var f=o.context=function(t,e,n){var o=""===e,i={dispatch:o?t.dispatch:function(n,o,i){var r=l(n,o,i),s=r.payload,a=r.options,c=r.type;return a&&a.root||(c=e+c),t.dispatch(c,s)},commit:o?t.commit:function(n,o,i){var r=l(n,o,i),s=r.payload,a=r.options,c=r.type;a&&a.root||(c=e+c),t.commit(c,s,a)}};return Object.defineProperties(i,{getters:{get:o?function(){return t.getters}:function(){return function(t,e){var n={},o=e.length;return Object.keys(t.getters).forEach(function(i){if(i.slice(0,o)===e){var r=i.slice(o);Object.defineProperty(n,r,{get:function(){return t.getters[i]},enumerable:!0})}}),n}(t,e)}},state:{get:function(){return h(t.state,n)}}}),i}(t,a,n);o.forEachMutation(function(e,n){!function(t,e,n,o){(t._mutations[e]||(t._mutations[e]=[])).push(function(e){n.call(t,o.state,e)})}(t,a+n,e,f)}),o.forEachAction(function(e,n){var o=e.root?n:a+n,i=e.handler||e;!function(t,e,n,o){(t._actions[e]||(t._actions[e]=[])).push(function(e,i){var r,s=n.call(t,{dispatch:o.dispatch,commit:o.commit,getters:o.getters,state:o.state,rootGetters:t.getters,rootState:t.state},e,i);return(r=s)&&"function"==typeof r.then||(s=Promise.resolve(s)),t._devtoolHook?s.catch(function(e){throw t._devtoolHook.emit("vuex:error",e),e}):s})}(t,o,i,f)}),o.forEachGetter(function(e,n){!function(t,e,n,o){if(t._wrappedGetters[e])return;t._wrappedGetters[e]=function(t){return n(o.state,o.getters,t.state,t.getters)}}(t,a+n,e,f)}),o.forEachChild(function(o,i){p(t,e,n.concat(i),o,r)})}function h(t,e){return e.length?e.reduce(function(t,e){return t[e]},t):t}function l(t,e,n){var o;return null!==(o=t)&&"object"==typeof o&&t.type&&(n=e,e=t,t=t.type),{type:t,payload:e,options:n}}function d(t){i&&t===i||function(t){if(Number(t.version.split(".")[0])>=2)t.mixin({beforeCreate:n});else{var e=t.prototype._init;t.prototype._init=function(t){void 0===t&&(t={}),t.init=t.init?[n].concat(t.init):n,e.call(this,t)}}function n(){var t=this.$options;t.store?this.$store="function"==typeof t.store?t.store():t.store:t.parent&&t.parent.$store&&(this.$store=t.parent.$store)}}(i=t)}a.state.get=function(){return this._vm._data.$$state},a.state.set=function(t){},s.prototype.commit=function(t,e,n){var o=this,i=l(t,e,n),r=i.type,s=i.payload,a={type:r,payload:s},c=this._mutations[r];c&&(this._withCommit(function(){c.forEach(function(t){t(s)})}),this._subscribers.forEach(function(t){return t(a,o.state)}))},s.prototype.dispatch=function(t,e){var n=this,o=l(t,e),i=o.type,r=o.payload,s={type:i,payload:r},a=this._actions[i];if(a){try{this._actionSubscribers.filter(function(t){return t.before}).forEach(function(t){return t.before(s,n.state)})}catch(t){}return(a.length>1?Promise.all(a.map(function(t){return t(r)})):a[0](r)).then(function(t){try{n._actionSubscribers.filter(function(t){return t.after}).forEach(function(t){return t.after(s,n.state)})}catch(t){}return t})}},s.prototype.subscribe=function(t){return c(t,this._subscribers)},s.prototype.subscribeAction=function(t){return c("function"==typeof t?{before:t}:t,this._actionSubscribers)},s.prototype.watch=function(t,e,n){var o=this;return this._watcherVM.$watch(function(){return t(o.state,o.getters)},e,n)},s.prototype.replaceState=function(t){var e=this;this._withCommit(function(){e._vm._data.$$state=t})},s.prototype.registerModule=function(t,e,n){void 0===n&&(n={}),"string"==typeof t&&(t=[t]),this._modules.register(t,e),p(this,this.state,t,this._modules.get(t),n.preserveState),f(this,this.state)},s.prototype.unregisterModule=function(t){var e=this;"string"==typeof t&&(t=[t]),this._modules.unregister(t),this._withCommit(function(){var n=h(e.state,t.slice(0,-1));i.delete(n,t[t.length-1])}),u(this)},s.prototype.hotUpdate=function(t){this._modules.update(t),u(this,!0)},s.prototype._withCommit=function(t){var e=this._committing;this._committing=!0,t(),this._committing=e},Object.defineProperties(s.prototype,a);var m=b(function(t,e){var n={};return g(e).forEach(function(e){var o=e.key,i=e.val;n[o]=function(){var e=this.$store.state,n=this.$store.getters;if(t){var o=w(this.$store,"mapState",t);if(!o)return;e=o.context.state,n=o.context.getters}return"function"==typeof i?i.call(this,e,n):e[i]},n[o].vuex=!0}),n}),v=b(function(t,e){var n={};return g(e).forEach(function(e){var o=e.key,i=e.val;n[o]=function(){for(var e=[],n=arguments.length;n--;)e[n]=arguments[n];var o=this.$store.commit;if(t){var r=w(this.$store,"mapMutations",t);if(!r)return;o=r.context.commit}return"function"==typeof i?i.apply(this,[o].concat(e)):o.apply(this.$store,[i].concat(e))}}),n}),_=b(function(t,e){var n={};return g(e).forEach(function(e){var o=e.key,i=e.val;i=t+i,n[o]=function(){if(!t||w(this.$store,"mapGetters",t))return this.$store.getters[i]},n[o].vuex=!0}),n}),y=b(function(t,e){var n={};return g(e).forEach(function(e){var o=e.key,i=e.val;n[o]=function(){for(var e=[],n=arguments.length;n--;)e[n]=arguments[n];var o=this.$store.dispatch;if(t){var r=w(this.$store,"mapActions",t);if(!r)return;o=r.context.dispatch}return"function"==typeof i?i.apply(this,[o].concat(e)):o.apply(this.$store,[i].concat(e))}}),n});function g(t){return Array.isArray(t)?t.map(function(t){return{key:t,val:t}}):Object.keys(t).map(function(e){return{key:e,val:t[e]}})}function b(t){return function(e,n){return"string"!=typeof e?(n=e,e=""):"/"!==e.charAt(e.length-1)&&(e+="/"),t(e,n)}}function w(t,e,n){return t._modulesNamespaceMap[n]}return{Store:s,install:d,version:"3.1.1",mapState:m,mapMutations:v,mapGetters:_,mapActions:y,createNamespacedHelpers:function(t){return{mapState:m.bind(null,t),mapGetters:_.bind(null,t),mapMutations:v.bind(null,t),mapActions:y.bind(null,t)}}}});
\ No newline at end of file
......@@ -336,9 +336,9 @@
}
},
"acorn": {
"version": "6.3.0",
"resolved": "https://registry.npmjs.org/acorn/-/acorn-6.3.0.tgz",
"integrity": "sha512-/czfa8BwS88b9gWQVhc8eknunSA2DoJpJyTQkhheIf5E48u1N0R4q/YxxsAeqRrmK9TQ/uYfgLDfZo91UlANIA==",
"version": "6.4.1",
"resolved": "https://registry.npmjs.org/acorn/-/acorn-6.4.1.tgz",
"integrity": "sha512-ZVA9k326Nwrj3Cj9jlh3wGFutC2ZornPNARZwsNYqQYgN0EsV2d53w5RN/co65Ohn4sUAUtb1rSUAOD6XN9idA==",
"dev": true
},
"acorn-dynamic-import": {
......@@ -986,9 +986,9 @@
"dev": true
},
"cacache": {
"version": "11.3.3",
"resolved": "https://registry.npmjs.org/cacache/-/cacache-11.3.3.tgz",
"integrity": "sha512-p8WcneCytvzPxhDvYp31PD039vi77I12W+/KfR9S8AZbaiARFBCpsPJS+9uhWfeBfeAtW7o/4vt3MUqLkbY6nA==",
"version": "12.0.3",
"resolved": "https://registry.npmjs.org/cacache/-/cacache-12.0.3.tgz",
"integrity": "sha512-kqdmfXEGFepesTuROHMs3MpFLWrPkSSpRqOw80RCflZXy/khxaArvFrQ7uJxSUduzAufc6G0g1VUCOZXxWavPw==",
"dev": true,
"requires": {
"bluebird": "^3.5.5",
......@@ -996,6 +996,7 @@
"figgy-pudding": "^3.5.1",
"glob": "^7.1.4",
"graceful-fs": "^4.1.15",
"infer-owner": "^1.0.3",
"lru-cache": "^5.1.1",
"mississippi": "^3.0.0",
"mkdirp": "^0.5.1",
......@@ -1260,9 +1261,9 @@
},
"dependencies": {
"acorn": {
"version": "5.7.3",
"resolved": "https://registry.npmjs.org/acorn/-/acorn-5.7.3.tgz",
"integrity": "sha512-T/zvzYRfbVojPWahDsE5evJdHb3oJoQfFbsrKM7w5Zcs++Tr257tia3BmMP8XYVjp1S9RZXQMh7gao96BlqZOw==",
"version": "5.7.4",
"resolved": "https://registry.npmjs.org/acorn/-/acorn-5.7.4.tgz",
"integrity": "sha512-1D++VG7BhrtvQpNbBzovKNc1FLGGEE/oGe7b9xJm/RFHMBeUaUGpluV9RLjZa47YFdPcDAenEYuq9pQPcMdLJg==",
"dev": true
}
}
......@@ -1490,12 +1491,12 @@
}
},
"copy-webpack-plugin": {
"version": "5.0.4",
"resolved": "https://registry.npmjs.org/copy-webpack-plugin/-/copy-webpack-plugin-5.0.4.tgz",
"integrity": "sha512-YBuYGpSzoCHSSDGyHy6VJ7SHojKp6WHT4D7ItcQFNAYx2hrwkMe56e97xfVR0/ovDuMTrMffXUiltvQljtAGeg==",
"version": "5.1.1",
"resolved": "https://registry.npmjs.org/copy-webpack-plugin/-/copy-webpack-plugin-5.1.1.tgz",
"integrity": "sha512-P15M5ZC8dyCjQHWwd4Ia/dm0SgVvZJMYeykVIVYXbGyqO4dWB5oyPHp9i7wjwo5LhtlhKbiBCdS2NvM07Wlybg==",
"dev": true,
"requires": {
"cacache": "^11.3.3",
"cacache": "^12.0.3",
"find-cache-dir": "^2.1.0",
"glob-parent": "^3.1.0",
"globby": "^7.1.1",
......@@ -1503,9 +1504,9 @@
"loader-utils": "^1.2.3",
"minimatch": "^3.0.4",
"normalize-path": "^3.0.0",
"p-limit": "^2.2.0",
"p-limit": "^2.2.1",
"schema-utils": "^1.0.0",
"serialize-javascript": "^1.7.0",
"serialize-javascript": "^2.1.2",
"webpack-log": "^2.0.0"
},
"dependencies": {
......@@ -1528,6 +1529,12 @@
"resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz",
"integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=",
"dev": true
},
"serialize-javascript": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-2.1.2.tgz",
"integrity": "sha512-rs9OggEUF0V4jUSecXazOYsLfu7OGK2qIn3c7IPBiffz32XniEp/TX9Xmc9LQfK2nQ2QKHvZ2oygKUGU0lG4jQ==",
"dev": true
}
}
},
......@@ -3912,9 +3919,9 @@
"dev": true
},
"handlebars": {
"version": "4.5.2",
"resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.5.2.tgz",
"integrity": "sha512-29Zxv/cynYB7mkT1rVWQnV7mGX6v7H/miQ6dbEpYTKq5eJBN7PsRB+ViYJlcT6JINTSu4dVB9kOqEun78h6Exg==",
"version": "4.7.3",
"resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.7.3.tgz",
"integrity": "sha512-SRGwSYuNfx8DwHD/6InAPzD6RgeruWLT+B8e8a7gGs8FWgHzlExpTFMEq2IA6QpAfOClpKHy6+8IqTjeBCu6Kg==",
"dev": true,
"requires": {
"neo-async": "^2.6.0",
......@@ -4799,9 +4806,9 @@
"dev": true
},
"kind-of": {
"version": "6.0.2",
"resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz",
"integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA=="
"version": "6.0.3",
"resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz",
"integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw=="
},
"last-call-webpack-plugin": {
"version": "3.0.0",
......@@ -7499,12 +7506,6 @@
}
}
},
"serialize-javascript": {
"version": "1.9.1",
"resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-1.9.1.tgz",
"integrity": "sha512-0Vb/54WJ6k5v8sSWN09S0ora+Hnr+cX40r9F170nT+mSkaxltoE/7R3OrIdBSUv1OoiobH1QoWQbCnAO+e8J1A==",
"dev": true
},
"serve-index": {
"version": "1.9.1",
"resolved": "https://registry.npmjs.org/serve-index/-/serve-index-1.9.1.tgz",
......@@ -8417,44 +8418,27 @@
}
},
"terser-webpack-plugin": {
"version": "1.4.1",
"resolved": "https://registry.npmjs.org/terser-webpack-plugin/-/terser-webpack-plugin-1.4.1.tgz",
"integrity": "sha512-ZXmmfiwtCLfz8WKZyYUuuHf3dMYEjg8NrjHMb0JqHVHVOSkzp3cW2/XG1fP3tRhqEqSzMwzzRQGtAPbs4Cncxg==",
"version": "1.4.3",
"resolved": "https://registry.npmjs.org/terser-webpack-plugin/-/terser-webpack-plugin-1.4.3.tgz",
"integrity": "sha512-QMxecFz/gHQwteWwSo5nTc6UaICqN1bMedC5sMtUc7y3Ha3Q8y6ZO0iCR8pq4RJC8Hjf0FEPEHZqcMB/+DFCrA==",
"dev": true,
"requires": {
"cacache": "^12.0.2",
"find-cache-dir": "^2.1.0",
"is-wsl": "^1.1.0",
"schema-utils": "^1.0.0",
"serialize-javascript": "^1.7.0",
"serialize-javascript": "^2.1.2",
"source-map": "^0.6.1",
"terser": "^4.1.2",
"webpack-sources": "^1.4.0",
"worker-farm": "^1.7.0"
},
"dependencies": {
"cacache": {
"version": "12.0.3",
"resolved": "https://registry.npmjs.org/cacache/-/cacache-12.0.3.tgz",
"integrity": "sha512-kqdmfXEGFepesTuROHMs3MpFLWrPkSSpRqOw80RCflZXy/khxaArvFrQ7uJxSUduzAufc6G0g1VUCOZXxWavPw==",
"dev": true,
"requires": {
"bluebird": "^3.5.5",
"chownr": "^1.1.1",
"figgy-pudding": "^3.5.1",
"glob": "^7.1.4",
"graceful-fs": "^4.1.15",
"infer-owner": "^1.0.3",
"lru-cache": "^5.1.1",
"mississippi": "^3.0.0",
"mkdirp": "^0.5.1",
"move-concurrently": "^1.0.1",
"promise-inflight": "^1.0.1",
"rimraf": "^2.6.3",
"ssri": "^6.0.1",
"unique-filename": "^1.1.1",
"y18n": "^4.0.0"
}
"serialize-javascript": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-2.1.2.tgz",
"integrity": "sha512-rs9OggEUF0V4jUSecXazOYsLfu7OGK2qIn3c7IPBiffz32XniEp/TX9Xmc9LQfK2nQ2QKHvZ2oygKUGU0lG4jQ==",
"dev": true
},
"source-map": {
"version": "0.6.1",
......
// This file is part of Webina, released under the Apache 2.0 License. See
// LICENSE.md or go to https://opensource.org/licenses/Apache-2.0 for full
// details. Copyright 2019 Jacob D. Durrant.
// details. Copyright 2020 Jacob D. Durrant.
declare var Vue;
......
// This file is part of Webina, released under the Apache 2.0 License. See
// LICENSE.md or go to https://opensource.org/licenses/Apache-2.0 for full
// details. Copyright 2019 Jacob D. Durrant.
// details. Copyright 2020 Jacob D. Durrant.
declare var Vue;
......@@ -20,19 +20,41 @@ export function setup(): void {
"file": false
}
},
"methods": {},
"methods": {
/**
* Given a file object, returns a promise that resolves the text
* in that file.
* @param {*} fileObj The file object.
* @returns Promise
*/
getFileContents(fileObj): Promise<any> {
return new Promise((resolve, reject) => {
var fr = new FileReader();
fr.onload = () => {
// @ts-ignore: Not sure why this causes Typescript problems.
var data = new Uint8Array(fr.result);
resolve(new TextDecoder("utf-8").decode(data));
};
fr.readAsArrayBuffer(fileObj);
});
}
},
"template": `
<form-group
:label="label"
:id="'input-group-' + id"
:description="description"
styl="line-height:0;"
>
<template v-slot:extraDescription>
<slot name="extraDescription"></slot>
</template>
<b-form-file
v-model="val"
:state="Boolean(file)"
placeholder="Choose a file or drop it here..."
drop-placeholder="Drop file here..."
:class="id" :accept="accept"
:class="id" :accept="allAcceptableFiles"
:required="required"
></b-form-file>
<small v-if="(!isValid) && (required === true)" alert tabindex="-1" class="text-danger form-text">{{invalidMsg}}</small>
......@@ -53,6 +75,10 @@ export function setup(): void {
"accept": {
"type": String,
"default": ".pdbqt, .out, .pdb"
},
"convert": {
"type": String,
"default": ""
}
},
"computed": {
......@@ -83,8 +109,21 @@ export function setup(): void {
.split(/,/g)
.map(e => e.replace(/ /g, "")
.replace(/\./, ""));
if (acceptableExt.indexOf(ext) === -1) {
let convertExt = this["convert"].toLowerCase()
.split(/,/g)
.map(e => e.replace(/ /g, "")
.replace(/\./, ""));
if (convertExt.indexOf(ext) !== -1) {
this.getFileContents(val).then((text: string) => {
this.$store.commit("openConvertFileModal", {
ext: ext,
type: this["id"],
file: text
});
});
return;
} else if (acceptableExt.indexOf(ext) === -1) {
// It is not one of the acceptable extensions. Need to
// cancel.
let msg = "The file must end in ";
......@@ -122,19 +161,19 @@ export function setup(): void {
val: val.name
});
var fr = new FileReader();
fr.onload = () => {
// @ts-ignore: Not sure why this causes Typescript problems.
var data = new Uint8Array(fr.result);
this.getFileContents(this["file"]).then((text: string) => {
this.$store.commit("setVar", {
name: this["id"] + "Contents",
val: new TextDecoder("utf-8").decode(data)
})
};
fr.readAsArrayBuffer(val);
val: text
});
});
}
},
"allAcceptableFiles"(): string {
return this["accept"] + (this["convert"] === "" ? "" : ", " + this["convert"]);
},
/**
* Determine whether the component value is valid.
* @returns boolean True if it is valid, false otherwise.
......
// This file is part of Webina, released under the Apache 2.0 License. See
// LICENSE.md or go to https://opensource.org/licenses/Apache-2.0 for full
// details. Copyright 2019 Jacob D. Durrant.
// details. Copyright 2020 Jacob D. Durrant.
declare var Vue;
......
// This file is part of Webina, released under the Apache 2.0 License. See
// LICENSE.md or go to https://opensource.org/licenses/Apache-2.0 for full
// details. Copyright 2019 Jacob D. Durrant.
// details. Copyright 2020 Jacob D. Durrant.
declare var Vue;
......@@ -57,9 +57,12 @@ export function setup(): void {
<small
tabindex="-1"
:id="'input-group-input-group-' + id + '__BV_description_'"
class="form-text text-muted"
class="form-text text-muted" style="display:inline;"
v-html="description">
</small>
<small class="form-text text-muted" style="display:inline;">
<slot name="extraDescription"></slot>
</small>
</b-form-group>
<div v-else>
<slot></slot>
......
// This file is part of Webina, released under the Apache 2.0 License. See
// LICENSE.md or go to https://opensource.org/licenses/Apache-2.0 for full
// details. Copyright 2019 Jacob D. Durrant.
// details. Copyright 2020 Jacob D. Durrant.
declare var Vue;
......
// This file is part of Webina, released under the Apache 2.0 License. See
// LICENSE.md or go to https://opensource.org/licenses/Apache-2.0 for full
// details. Copyright 2019 Jacob D. Durrant.
// details. Copyright 2020 Jacob D. Durrant.
declare var Vue;
......
// This file is part of Webina, released under the Apache 2.0 License. See
// LICENSE.md or go to https://opensource.org/licenses/Apache-2.0 for full
// details. Copyright 2020 Jacob D. Durrant.
declare var Vue;
/**
* Setup the convert-file-modal Vue commponent.
* @returns void
*/
export function setup(): void {
Vue.component("convert-file-modal", {
/**
* Get the data associated with this component.
* @returns any The data.
*/
"data": function () {
return {
"addHydrogens": true,
"gen3D": false,
"phVal": 7.4
};
},
"computed": {
"convertFileModalShow": {
/**
* Get the convertFileModalShow value..
* @returns boolean
*/
get(): boolean {
return this.$store.state["convertFileModalShow"];
},
/**
* Set the convertFileModalShow value.
* @param {boolean} val The new value.
* @returns void
*/
set(val: boolean): void {
this.$store.commit("setVar", {
name: "convertFileModalShow",
val,
});
},
},
/**
* Get the extension of the user-submitted file.
* @returns string The extension.
*/
"currentExt"(): string {
return this.$store.state["convertFileExt"].toUpperCase();
},
/**
* Get the current type of the user-submitted file. "receptor" or