New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

rete

Package Overview
Dependencies
Maintainers
1
Versions
78
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rete - npm Package Compare versions

Comparing version 1.0.0-alpha.5 to 1.0.0-alpha.7

build/rete-engine.min.js

11

build/rete.min.js
/*!
* rete v1.0.0-alpha.5
* (c) 2018 Vitaliy Stoliarov
* Released under the MIT License.
* rete v1.0.0-alpha.7
* (c) 2018 Ni55aN License
* Released under the MIT license.
*/
!function(t){"use strict";function n(t,n,e,o){var i=n&&n.prototype instanceof r?n:r,a=Object.create(i.prototype),u=new h(o||[]);return a._invoke=c(t,e,u),a}function e(t,n,e){try{return{type:"normal",arg:t.call(n,e)}}catch(t){return{type:"throw",arg:t}}}function r(){}function o(){}function i(){}function a(t){["next","throw","return"].forEach(function(n){t[n]=function(t){return this._invoke(n,t)}})}function u(t){function n(r,o,i,a){var u=e(t[r],t,o);if("throw"!==u.type){var c=u.arg,s=c.value;return s&&"object"==typeof s&&y.call(s,"__await")?Promise.resolve(s.__await).then(function(t){n("next",t,i,a)},function(t){n("throw",t,i,a)}):Promise.resolve(s).then(function(t){c.value=t,i(c)},a)}a(u.arg)}function r(t,e){function r(){return new Promise(function(r,o){n(t,e,r,o)})}return o=o?o.then(r,r):r()}var o;this._invoke=r}function c(t,n,r){var o=O;return function(i,a){if(o===A)throw new Error("Generator is already running");if(o===_){if("throw"===i)throw a;return d()}for(r.method=i,r.arg=a;;){var u=r.delegate;if(u){var c=s(u,r);if(c){if(c===T)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===O)throw o=_,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=A;var l=e(t,n,r);if("normal"===l.type){if(o=r.done?_:j,l.arg===T)continue;return{value:l.arg,done:r.done}}"throw"===l.type&&(o=_,r.method="throw",r.arg=l.arg)}}}function s(t,n){var r=t.iterator[n.method];if(r===v){if(n.delegate=null,"throw"===n.method){if(t.iterator.return&&(n.method="return",n.arg=v,s(t,n),"throw"===n.method))return T;n.method="throw",n.arg=new TypeError("The iterator does not provide a 'throw' method")}return T}var o=e(r,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,T;var i=o.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=v),n.delegate=null,T):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,T)}function l(t){var n={tryLoc:t[0]};1 in t&&(n.catchLoc=t[1]),2 in t&&(n.finallyLoc=t[2],n.afterLoc=t[3]),this.tryEntries.push(n)}function f(t){var n=t.completion||{};n.type="normal",delete n.arg,t.completion=n}function h(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(l,this),this.reset(!0)}function p(t){if(t){var n=t[w];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var e=-1,r=function n(){for(;++e<t.length;)if(y.call(t,e))return n.value=t[e],n.done=!1,n;return n.value=v,n.done=!0,n};return r.next=r}}return{next:d}}function d(){return{value:v,done:!0}}var v,m=Object.prototype,y=m.hasOwnProperty,g="function"==typeof Symbol?Symbol:{},w=g.iterator||"@@iterator",b=g.asyncIterator||"@@asyncIterator",E=g.toStringTag||"@@toStringTag",k="object"==typeof module,x=t.regeneratorRuntime;if(x)return void(k&&(module.exports=x));x=t.regeneratorRuntime=k?module.exports:{},x.wrap=n;var O="suspendedStart",j="suspendedYield",A="executing",_="completed",T={},C={};C[w]=function(){return this};var N=Object.getPrototypeOf,V=N&&N(N(p([])));V&&V!==m&&y.call(V,w)&&(C=V);var S=i.prototype=r.prototype=Object.create(C);o.prototype=S.constructor=i,i.constructor=o,i[E]=o.displayName="GeneratorFunction",x.isGeneratorFunction=function(t){var n="function"==typeof t&&t.constructor;return!!n&&(n===o||"GeneratorFunction"===(n.displayName||n.name))},x.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,i):(t.__proto__=i,E in t||(t[E]="GeneratorFunction")),t.prototype=Object.create(S),t},x.awrap=function(t){return{__await:t}},a(u.prototype),u.prototype[b]=function(){return this},x.AsyncIterator=u,x.async=function(t,e,r,o){var i=new u(n(t,e,r,o));return x.isGeneratorFunction(e)?i:i.next().then(function(t){return t.done?t.value:i.next()})},a(S),S[E]="Generator",S[w]=function(){return this},S.toString=function(){return"[object Generator]"},x.keys=function(t){var n=[];for(var e in t)n.push(e);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},x.values=p,h.prototype={constructor:h,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=v,this.done=!1,this.delegate=null,this.method="next",this.arg=v,this.tryEntries.forEach(f),!t)for(var n in this)"t"===n.charAt(0)&&y.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=v)},stop:function(){this.done=!0;var t=this.tryEntries[0],n=t.completion;if("throw"===n.type)throw n.arg;return this.rval},dispatchException:function(t){function n(n,r){return i.type="throw",i.arg=t,e.next=n,r&&(e.method="next",e.arg=v),!!r}if(this.done)throw t;for(var e=this,r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r],i=o.completion;if("root"===o.tryLoc)return n("end");if(o.tryLoc<=this.prev){var a=y.call(o,"catchLoc"),u=y.call(o,"finallyLoc");if(a&&u){if(this.prev<o.catchLoc)return n(o.catchLoc,!0);if(this.prev<o.finallyLoc)return n(o.finallyLoc)}else if(a){if(this.prev<o.catchLoc)return n(o.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return n(o.finallyLoc)}}}},abrupt:function(t,n){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc<=this.prev&&y.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var o=r;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=n&&n<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=t,i.arg=n,o?(this.method="next",this.next=o.finallyLoc,T):this.complete(i)},complete:function(t,n){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&n&&(this.next=n),T},finish:function(t){for(var n=this.tryEntries.length-1;n>=0;--n){var e=this.tryEntries[n];if(e.finallyLoc===t)return this.complete(e.completion,e.afterLoc),f(e),T}},catch:function(t){for(var n=this.tryEntries.length-1;n>=0;--n){var e=this.tryEntries[n];if(e.tryLoc===t){var r=e.completion;if("throw"===r.type){var o=r.arg;f(e)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,n,e){return this.delegate={iterator:p(t),resultName:n,nextLoc:e},"next"===this.method&&(this.arg=v),T}}}(function(){return this}()||Function("return this")()),function(t,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):t.Rete=n()}(this,function(){"use strict";function t(n,e){if(void 0===e&&(e=0),e+=1,null===n)return"null";if(void 0===n)return"void";if("string"==typeof n||"number"==typeof n||"boolean"==typeof n)return void 0===n?"undefined":d(n);if(Array.isArray(n)){if(n.length>0){if(e>4)return"[...]";var r=t(n[0],e);return n.every(function(n){return t(n,e)===r})?r.trim()+"[]":"["+n.slice(0,15).map(function(n){return t(n,e)}).join(", ")+(n.length>=15?", ...":"")+"]"}return"Array"}var o=Object.keys(n);if(!o.length)return n.constructor&&n.constructor.name&&"Object"!==n.constructor.name?n.constructor.name:"Object";if(e>4)return"{...}";var i=" ".repeat(e-1),a=o.slice(0,15).map(function(r){return(/^([A-Z_$][A-Z0-9_$]*)$/i.test(r)?r:JSON.stringify(r))+": "+t(n[r],e)+";"}).join("\n "+i);return o.length>=15&&(a+="\n "+i+"..."),n.constructor&&n.constructor.name&&"Object"!==n.constructor.name?n.constructor.name+" {\n "+i+a+"\n"+i+"}":"{\n "+i+a+"\n"+i+"}"}function n(t,e){if(void 0===e&&(e=0),e+=1,null===t)return"null";if(void 0===t)return"void";if("string"==typeof t||"number"==typeof t||"boolean"==typeof t)return void 0===t?"undefined":d(t);if(Array.isArray(t)){if(t.length>0){if(e>4)return"[...]";var r=n(t[0],e);return t.every(function(t){return n(t,e)===r})?r.trim()+"[]":"["+t.slice(0,15).map(function(t){return n(t,e)}).join(", ")+(t.length>=15?", ...":"")+"]"}return"Array"}var o=Object.keys(t);if(!o.length)return t.constructor&&t.constructor.name&&"Object"!==t.constructor.name?t.constructor.name:"Object";if(e>4)return"{...}";var i=" ".repeat(e-1),a=o.slice(0,15).map(function(r){return(/^([A-Z_$][A-Z0-9_$]*)$/i.test(r)?r:JSON.stringify(r))+": "+n(t[r],e)+";"}).join("\n "+i);return o.length>=15&&(a+="\n "+i+"..."),t.constructor&&t.constructor.name&&"Object"!==t.constructor.name?t.constructor.name+" {\n "+i+a+"\n"+i+"}":"{\n "+i+a+"\n"+i+"}"}function e(t,n){if(void 0===n&&(n=0),n+=1,null===t)return"null";if(void 0===t)return"void";if("string"==typeof t||"number"==typeof t||"boolean"==typeof t)return void 0===t?"undefined":d(t);if(Array.isArray(t)){if(t.length>0){if(n>4)return"[...]";var r=e(t[0],n);return t.every(function(t){return e(t,n)===r})?r.trim()+"[]":"["+t.slice(0,15).map(function(t){return e(t,n)}).join(", ")+(t.length>=15?", ...":"")+"]"}return"Array"}var o=Object.keys(t);if(!o.length)return t.constructor&&t.constructor.name&&"Object"!==t.constructor.name?t.constructor.name:"Object";if(n>4)return"{...}";var i=" ".repeat(n-1),a=o.slice(0,15).map(function(r){return(/^([A-Z_$][A-Z0-9_$]*)$/i.test(r)?r:JSON.stringify(r))+": "+e(t[r],n)+";"}).join("\n "+i);return o.length>=15&&(a+="\n "+i+"..."),t.constructor&&t.constructor.name&&"Object"!==t.constructor.name?t.constructor.name+" {\n "+i+a+"\n"+i+"}":"{\n "+i+a+"\n"+i+"}"}function r(t,n){if(void 0===n&&(n=0),n+=1,null===t)return"null";if(void 0===t)return"void";if("string"==typeof t||"number"==typeof t||"boolean"==typeof t)return void 0===t?"undefined":d(t);if(Array.isArray(t)){if(t.length>0){if(n>4)return"[...]";var e=r(t[0],n);return t.every(function(t){return r(t,n)===e})?e.trim()+"[]":"["+t.slice(0,15).map(function(t){return r(t,n)}).join(", ")+(t.length>=15?", ...":"")+"]"}return"Array"}var o=Object.keys(t);if(!o.length)return t.constructor&&t.constructor.name&&"Object"!==t.constructor.name?t.constructor.name:"Object";if(n>4)return"{...}";var i=" ".repeat(n-1),a=o.slice(0,15).map(function(e){return(/^([A-Z_$][A-Z0-9_$]*)$/i.test(e)?e:JSON.stringify(e))+": "+r(t[e],n)+";"}).join("\n "+i);return o.length>=15&&(a+="\n "+i+"..."),t.constructor&&t.constructor.name&&"Object"!==t.constructor.name?t.constructor.name+" {\n "+i+a+"\n"+i+"}":"{\n "+i+a+"\n"+i+"}"}function o(t,n){if(void 0===n&&(n=0),n+=1,null===t)return"null";if(void 0===t)return"void";if("string"==typeof t||"number"==typeof t||"boolean"==typeof t)return void 0===t?"undefined":d(t);if(Array.isArray(t)){if(t.length>0){if(n>4)return"[...]";var e=o(t[0],n);return t.every(function(t){return o(t,n)===e})?e.trim()+"[]":"["+t.slice(0,15).map(function(t){return o(t,n)}).join(", ")+(t.length>=15?", ...":"")+"]"}return"Array"}var r=Object.keys(t);if(!r.length)return t.constructor&&t.constructor.name&&"Object"!==t.constructor.name?t.constructor.name:"Object";if(n>4)return"{...}";var i=" ".repeat(n-1),a=r.slice(0,15).map(function(e){return(/^([A-Z_$][A-Z0-9_$]*)$/i.test(e)?e:JSON.stringify(e))+": "+o(t[e],n)+";"}).join("\n "+i);return r.length>=15&&(a+="\n "+i+"..."),t.constructor&&t.constructor.name&&"Object"!==t.constructor.name?t.constructor.name+" {\n "+i+a+"\n"+i+"}":"{\n "+i+a+"\n"+i+"}"}function i(t,n){if(void 0===n&&(n=0),n+=1,null===t)return"null";if(void 0===t)return"void";if("string"==typeof t||"number"==typeof t||"boolean"==typeof t)return void 0===t?"undefined":d(t);if(Array.isArray(t)){if(t.length>0){if(n>4)return"[...]";var e=i(t[0],n);return t.every(function(t){return i(t,n)===e})?e.trim()+"[]":"["+t.slice(0,15).map(function(t){return i(t,n)}).join(", ")+(t.length>=15?", ...":"")+"]"}return"Array"}var r=Object.keys(t);if(!r.length)return t.constructor&&t.constructor.name&&"Object"!==t.constructor.name?t.constructor.name:"Object";if(n>4)return"{...}";var o=" ".repeat(n-1),a=r.slice(0,15).map(function(e){return(/^([A-Z_$][A-Z0-9_$]*)$/i.test(e)?e:JSON.stringify(e))+": "+i(t[e],n)+";"}).join("\n "+o);return r.length>=15&&(a+="\n "+o+"..."),t.constructor&&t.constructor.name&&"Object"!==t.constructor.name?t.constructor.name+" {\n "+o+a+"\n"+o+"}":"{\n "+o+a+"\n"+o+"}"}function a(t,n){if(void 0===n&&(n=0),n+=1,null===t)return"null";if(void 0===t)return"void";if("string"==typeof t||"number"==typeof t||"boolean"==typeof t)return void 0===t?"undefined":d(t);if(Array.isArray(t)){if(t.length>0){if(n>4)return"[...]";var e=a(t[0],n);return t.every(function(t){return a(t,n)===e})?e.trim()+"[]":"["+t.slice(0,15).map(function(t){return a(t,n)}).join(", ")+(t.length>=15?", ...":"")+"]"}return"Array"}var r=Object.keys(t);if(!r.length)return t.constructor&&t.constructor.name&&"Object"!==t.constructor.name?t.constructor.name:"Object";if(n>4)return"{...}";var o=" ".repeat(n-1),i=r.slice(0,15).map(function(e){return(/^([A-Z_$][A-Z0-9_$]*)$/i.test(e)?e:JSON.stringify(e))+": "+a(t[e],n)+";"}).join("\n "+o);return r.length>=15&&(i+="\n "+o+"..."),t.constructor&&t.constructor.name&&"Object"!==t.constructor.name?t.constructor.name+" {\n "+o+i+"\n"+o+"}":"{\n "+o+i+"\n"+o+"}"}function u(t,n){if(void 0===n&&(n=0),n+=1,null===t)return"null";if(void 0===t)return"void";if("string"==typeof t||"number"==typeof t||"boolean"==typeof t)return void 0===t?"undefined":d(t);if(Array.isArray(t)){if(t.length>0){if(n>4)return"[...]";var e=u(t[0],n);return t.every(function(t){return u(t,n)===e})?e.trim()+"[]":"["+t.slice(0,15).map(function(t){return u(t,n)}).join(", ")+(t.length>=15?", ...":"")+"]"}return"Array"}var r=Object.keys(t);if(!r.length)return t.constructor&&t.constructor.name&&"Object"!==t.constructor.name?t.constructor.name:"Object";if(n>4)return"{...}";var o=" ".repeat(n-1),i=r.slice(0,15).map(function(e){return(/^([A-Z_$][A-Z0-9_$]*)$/i.test(e)?e:JSON.stringify(e))+": "+u(t[e],n)+";"}).join("\n "+o);return r.length>=15&&(i+="\n "+o+"..."),t.constructor&&t.constructor.name&&"Object"!==t.constructor.name?t.constructor.name+" {\n "+o+i+"\n"+o+"}":"{\n "+o+i+"\n"+o+"}"}function c(t,n){if(void 0===n&&(n=0),n+=1,null===t)return"null";if(void 0===t)return"void";if("string"==typeof t||"number"==typeof t||"boolean"==typeof t)return void 0===t?"undefined":d(t);if(Array.isArray(t)){if(t.length>0){if(n>4)return"[...]";var e=c(t[0],n);return t.every(function(t){return c(t,n)===e})?e.trim()+"[]":"["+t.slice(0,15).map(function(t){return c(t,n)}).join(", ")+(t.length>=15?", ...":"")+"]"}return"Array"}var r=Object.keys(t);if(!r.length)return t.constructor&&t.constructor.name&&"Object"!==t.constructor.name?t.constructor.name:"Object";if(n>4)return"{...}";var o=" ".repeat(n-1),i=r.slice(0,15).map(function(e){return(/^([A-Z_$][A-Z0-9_$]*)$/i.test(e)?e:JSON.stringify(e))+": "+c(t[e],n)+";"}).join("\n "+o);return r.length>=15&&(i+="\n "+o+"..."),t.constructor&&t.constructor.name&&"Object"!==t.constructor.name?t.constructor.name+" {\n "+o+i+"\n"+o+"}":"{\n "+o+i+"\n"+o+"}"}function s(t,n){if(void 0===n&&(n=0),n+=1,null===t)return"null";if(void 0===t)return"void";if("string"==typeof t||"number"==typeof t||"boolean"==typeof t)return void 0===t?"undefined":d(t);if(Array.isArray(t)){if(t.length>0){if(n>4)return"[...]";var e=s(t[0],n);return t.every(function(t){return s(t,n)===e})?e.trim()+"[]":"["+t.slice(0,15).map(function(t){return s(t,n)}).join(", ")+(t.length>=15?", ...":"")+"]"}return"Array"}var r=Object.keys(t);if(!r.length)return t.constructor&&t.constructor.name&&"Object"!==t.constructor.name?t.constructor.name:"Object";if(n>4)return"{...}";var o=" ".repeat(n-1),i=r.slice(0,15).map(function(e){return(/^([A-Z_$][A-Z0-9_$]*)$/i.test(e)?e:JSON.stringify(e))+": "+s(t[e],n)+";"}).join("\n "+o);return r.length>=15&&(i+="\n "+o+"..."),t.constructor&&t.constructor.name&&"Object"!==t.constructor.name?t.constructor.name+" {\n "+o+i+"\n"+o+"}":"{\n "+o+i+"\n"+o+"}"}function l(t,n){if(void 0===n&&(n=0),n+=1,null===t)return"null";if(void 0===t)return"void";if("string"==typeof t||"number"==typeof t||"boolean"==typeof t)return void 0===t?"undefined":d(t);if(Array.isArray(t)){if(t.length>0){if(n>4)return"[...]";var e=l(t[0],n);return t.every(function(t){return l(t,n)===e})?e.trim()+"[]":"["+t.slice(0,15).map(function(t){return l(t,n)}).join(", ")+(t.length>=15?", ...":"")+"]"}return"Array"}var r=Object.keys(t);if(!r.length)return t.constructor&&t.constructor.name&&"Object"!==t.constructor.name?t.constructor.name:"Object";if(n>4)return"{...}";var o=" ".repeat(n-1),i=r.slice(0,15).map(function(e){return(/^([A-Z_$][A-Z0-9_$]*)$/i.test(e)?e:JSON.stringify(e))+": "+l(t[e],n)+";"}).join("\n "+o);return r.length>=15&&(i+="\n "+o+"..."),t.constructor&&t.constructor.name&&"Object"!==t.constructor.name?t.constructor.name+" {\n "+o+i+"\n"+o+"}":"{\n "+o+i+"\n"+o+"}"}function f(t,n){if(void 0===n&&(n=0),n+=1,null===t)return"null";if(void 0===t)return"void";if("string"==typeof t||"number"==typeof t||"boolean"==typeof t)return void 0===t?"undefined":d(t);if(Array.isArray(t)){if(t.length>0){if(n>4)return"[...]";var e=f(t[0],n);return t.every(function(t){return f(t,n)===e})?e.trim()+"[]":"["+t.slice(0,15).map(function(t){return f(t,n)}).join(", ")+(t.length>=15?", ...":"")+"]"}return"Array"}var r=Object.keys(t);if(!r.length)return t.constructor&&t.constructor.name&&"Object"!==t.constructor.name?t.constructor.name:"Object";if(n>4)return"{...}";var o=" ".repeat(n-1),i=r.slice(0,15).map(function(e){return(/^([A-Z_$][A-Z0-9_$]*)$/i.test(e)?e:JSON.stringify(e))+": "+f(t[e],n)+";"}).join("\n "+o);return r.length>=15&&(i+="\n "+o+"..."),t.constructor&&t.constructor.name&&"Object"!==t.constructor.name?t.constructor.name+" {\n "+o+i+"\n"+o+"}":"{\n "+o+i+"\n"+o+"}"}function h(t,n){if(void 0===n&&(n=0),n+=1,null===t)return"null";if(void 0===t)return"void";if("string"==typeof t||"number"==typeof t||"boolean"==typeof t)return void 0===t?"undefined":d(t);if(Array.isArray(t)){if(t.length>0){if(n>4)return"[...]";var e=h(t[0],n);return t.every(function(t){return h(t,n)===e})?e.trim()+"[]":"["+t.slice(0,15).map(function(t){return h(t,n)}).join(", ")+(t.length>=15?", ...":"")+"]"}return"Array"}var r=Object.keys(t);if(!r.length)return t.constructor&&t.constructor.name&&"Object"!==t.constructor.name?t.constructor.name:"Object";if(n>4)return"{...}";var o=" ".repeat(n-1),i=r.slice(0,15).map(function(e){return(/^([A-Z_$][A-Z0-9_$]*)$/i.test(e)?e:JSON.stringify(e))+": "+h(t[e],n)+";"}).join("\n "+o);return r.length>=15&&(i+="\n "+o+"..."),t.constructor&&t.constructor.name&&"Object"!==t.constructor.name?t.constructor.name+" {\n "+o+i+"\n"+o+"}":"{\n "+o+i+"\n"+o+"}"}function p(t,n){if(void 0===n&&(n=0),n+=1,null===t)return"null";if(void 0===t)return"void";if("string"==typeof t||"number"==typeof t||"boolean"==typeof t)return void 0===t?"undefined":d(t);if(Array.isArray(t)){if(t.length>0){if(n>4)return"[...]";var e=p(t[0],n);return t.every(function(t){return p(t,n)===e})?e.trim()+"[]":"["+t.slice(0,15).map(function(t){return p(t,n)}).join(", ")+(t.length>=15?", ...":"")+"]"}return"Array"}var r=Object.keys(t);if(!r.length)return t.constructor&&t.constructor.name&&"Object"!==t.constructor.name?t.constructor.name:"Object";if(n>4)return"{...}";var o=" ".repeat(n-1),i=r.slice(0,15).map(function(e){return(/^([A-Z_$][A-Z0-9_$]*)$/i.test(e)?e:JSON.stringify(e))+": "+p(t[e],n)+";"}).join("\n "+o);return r.length>=15&&(i+="\n "+o+"..."),t.constructor&&t.constructor.name&&"Object"!==t.constructor.name?t.constructor.name+" {\n "+o+i+"\n"+o+"}":"{\n "+o+i+"\n"+o+"}"}var d="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},v=function(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")},m=function(){function t(t,n){for(var e=0;e<n.length;e++){var r=n[e];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(n,e,r){return e&&t(n.prototype,e),r&&t(n,r),n}}(),y=function(t,n,e){return n in t?Object.defineProperty(t,n,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[n]=e,t},g=Object.assign||function(t){for(var n=1;n<arguments.length;n++){var e=arguments[n];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])}return t},w=function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Super expression must either be null or a function, not "+typeof n);t.prototype=Object.create(n&&n.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),n&&(Object.setPrototypeOf?Object.setPrototypeOf(t,n):t.__proto__=n)},b=function(t,n){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!n||"object"!=typeof n&&"function"!=typeof n?t:n},E=function(){function t(t,n){var e=[],r=!0,o=!1,i=void 0;try{for(var a,u=t[Symbol.iterator]();!(r=(a=u.next()).done)&&(e.push(a.value),!n||e.length!==n);r=!0);}catch(t){o=!0,i=t}finally{try{!r&&u.return&&u.return()}finally{if(o)throw i}}return e}return function(n,e){if(Array.isArray(n))return n;if(Symbol.iterator in Object(n))return t(n,e);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),k=function(t){if(Array.isArray(t)){for(var n=0,e=Array(t.length);n<t.length;n++)e[n]=t[n];return e}return Array.from(t)},x=function(){function t(n){if(v(this,t),this.constructor===t)throw new TypeError("Can not construct abstract class.");this.name=n,this.data={},this.engine=null}return m(t,[{key:"worker",value:function(){}}]),t}(),O=function(){function t(){if(v(this,t),this.constructor===t)throw new TypeError("Can not construct abstract class.");this.data={},this.parent=null}return m(t,[{key:"getNode",value:function(){if(null===this.parent)throw new Error("Control isn't added to Node/Input");return this.parent instanceof N?this.parent:this.parent.node}},{key:"getData",value:function(t){return this.getNode().data[t]}},{key:"putData",value:function(t,n){this.getNode().data[t]=n}}]),t}(),j=function(){function t(n,e){v(this,t),this.output=n,this.input=e,this.data={},this.input.addConnection(this)}return m(t,[{key:"remove",value:function(){this.input.removeConnection(this),this.output.removeConnection(this)}}]),t}(),A=function(){function n(t,e,r){v(this,n),this.node=null,this.multipleConnections=r,this.connections=[],this.name=t,this.socket=e}return m(n,[{key:"removeConnection",value:function(n){if(!(n instanceof j))throw new TypeError('Value of argument "connection" violates contract.\n\nExpected:\nConnection\n\nGot:\n'+t(n));this.connections.splice(this.connections.indexOf(n),1)}},{key:"removeConnections",value:function(){var t=this;this.connections.map(function(n){return t.removeConnection(n)})}}]),n}(),_=function(){function t(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(v(this,t),"string"!=typeof e)throw new TypeError('Value of argument "name" violates contract.\n\nExpected:\nstring\n\nGot:\n'+n(e));this.name=e,this.data=r,this.compatible=[]}return m(t,[{key:"combineWith",value:function(e){if(!(e instanceof t))throw new TypeError('Value of argument "socket" violates contract.\n\nExpected:\nSocket\n\nGot:\n'+n(e));this.compatible.push(e)}},{key:"compatibleWith",value:function(e){if(!(e instanceof t))throw new TypeError('Value of argument "socket" violates contract.\n\nExpected:\nSocket\n\nGot:\n'+n(e));return this===e||this.compatible.includes(e)}}]),t}(),T=function(t){function n(t,r){var o=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(v(this,n),"string"!=typeof t)throw new TypeError('Value of argument "title" violates contract.\n\nExpected:\nstring\n\nGot:\n'+e(t));if(!(r instanceof _))throw new TypeError('Value of argument "socket" violates contract.\n\nExpected:\nSocket\n\nGot:\n'+e(r));if("boolean"!=typeof o)throw new TypeError('Value of argument "multiConns" violates contract.\n\nExpected:\nboolean\n\nGot:\n'+e(o));var i=b(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,t,r,o));return i.control=null,i}return w(n,t),m(n,[{key:"hasConnection",value:function(){return this.connections.length>0}},{key:"addConnection",value:function(t){if(!(t instanceof j))throw new TypeError('Value of argument "connection" violates contract.\n\nExpected:\nConnection\n\nGot:\n'+e(t));if(!this.multipleConnections&&this.hasConnection())throw new Error("Multiple connections not allowed");this.connections.push(t)}},{key:"addControl",value:function(t){if(!(t instanceof O))throw new TypeError('Value of argument "control" violates contract.\n\nExpected:\nControl\n\nGot:\n'+e(t));this.control=t,t.parent=this}},{key:"showControl",value:function(){return!this.hasConnection()&&null!==this.control}},{key:"toJSON",value:function(){return{connections:this.connections.map(function(t){return{node:t.output.node.id,output:t.output.node.outputs.indexOf(t.output),data:t.data}})}}}]),n}(A),C=function(t){function n(t,e){var o=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(v(this,n),"string"!=typeof t)throw new TypeError('Value of argument "title" violates contract.\n\nExpected:\nstring\n\nGot:\n'+r(t));if(!(e instanceof _))throw new TypeError('Value of argument "socket" violates contract.\n\nExpected:\nSocket\n\nGot:\n'+r(e));if("boolean"!=typeof o)throw new TypeError('Value of argument "multiConns" violates contract.\n\nExpected:\nboolean\n\nGot:\n'+r(o));return b(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,t,e,o))}return w(n,t),m(n,[{key:"hasConnection",value:function(){return this.connections.length>0}},{key:"connectTo",value:function(t){if(!(t instanceof T))throw new TypeError('Value of argument "input" violates contract.\n\nExpected:\nInput\n\nGot:\n'+r(t));if(!this.socket.compatibleWith(t.socket))throw new Error("Sockets not compatible");if(!t.multipleConnections&&t.hasConnection())throw new Error("Input already has one connection");if(!this.multipleConnections&&this.hasConnection())throw new Error("Output already has one connection");var n=new j(this,t);return this.connections.push(n),n}},{key:"connectedTo",value:function(t){if(!(t instanceof T))throw new TypeError('Value of argument "input" violates contract.\n\nExpected:\nInput\n\nGot:\n'+r(t));return this.connections.some(function(n){return n.input===t})}},{key:"toJSON",value:function(){return{connections:this.connections.map(function(t){return{node:t.input.node.id,input:t.input.node.inputs.indexOf(t.input),data:t.data}})}}}]),n}(A),N=function(){function t(n){if(v(this,t),"string"!=typeof n)throw new TypeError('Value of argument "name" violates contract.\n\nExpected:\nstring\n\nGot:\n'+o(n));this.name=n,this.id=t.incrementId(),this.position=[0,0],this.inputs=[],this.outputs=[],this.controls=[],this.data={},this.meta={}}return m(t,[{key:"addControl",value:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.controls.length;if(!(t instanceof O))throw new TypeError('Value of argument "control" violates contract.\n\nExpected:\nControl\n\nGot:\n'+o(t));if(!(null==n||"number"==typeof n&&!isNaN(n)&&n>=0&&n<=255&&n===Math.floor(n)))throw new TypeError('Value of argument "index" violates contract.\n\nExpected:\n?uint8\n\nGot:\n'+o(n));return t.parent=this,this.controls.splice(n,0,t),this}},{key:"removeControl",value:function(t){if(!(t instanceof O))throw new TypeError('Value of argument "control" violates contract.\n\nExpected:\nControl\n\nGot:\n'+o(t));t.parent=null,this.controls.splice(this.controls.indexOf(t),1)}},{key:"addInput",value:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.inputs.length;if(!(t instanceof T))throw new TypeError('Value of argument "input" violates contract.\n\nExpected:\nInput\n\nGot:\n'+o(t));if(!(null==n||"number"==typeof n&&!isNaN(n)&&n>=0&&n<=255&&n===Math.floor(n)))throw new TypeError('Value of argument "index" violates contract.\n\nExpected:\n?uint8\n\nGot:\n'+o(n));if(null!==t.node)throw new Error("Input has already been added to the node");return t.node=this,this.inputs.splice(n,0,t),this}},{key:"removeInput",value:function(t){if(!(t instanceof T))throw new TypeError('Value of argument "input" violates contract.\n\nExpected:\nInput\n\nGot:\n'+o(t));t.removeConnections(),t.node=null,this.inputs.splice(this.inputs.indexOf(t),1)}},{key:"addOutput",value:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.outputs.length;if(!(t instanceof C))throw new TypeError('Value of argument "output" violates contract.\n\nExpected:\nOutput\n\nGot:\n'+o(t));if(!(null==n||"number"==typeof n&&!isNaN(n)&&n>=0&&n<=255&&n===Math.floor(n)))throw new TypeError('Value of argument "index" violates contract.\n\nExpected:\n?uint8\n\nGot:\n'+o(n));if(null!==t.node)throw new Error("Output has already been added to the node");return t.node=this,this.outputs.splice(n,0,t),this}},{key:"removeOutput",value:function(t){if(!(t instanceof C))throw new TypeError('Value of argument "output" violates contract.\n\nExpected:\nOutput\n\nGot:\n'+o(t));t.removeConnections(),t.node=null,this.outputs.splice(this.outputs.indexOf(t),1)}},{key:"getConnections",value:function(){return[].concat(k(this.inputs),k(this.outputs)).reduce(function(t,n){return[].concat(k(t),k(n.connections))},[])}},{key:"inputsWithVisibleControl",value:function(){return this.inputs.filter(function(t){return t.showControl()})}},{key:"toJSON",value:function(){return{id:this.id,data:this.data,inputs:this.inputs.map(function(t){return t.toJSON()}),outputs:this.outputs.map(function(t){return t.toJSON()}),position:this.position,name:this.name}}}],[{key:"incrementId",value:function(){return this.latestId?this.latestId++:this.latestId=1,this.latestId}},{key:"fromJSON",value:function(n){if(!(n instanceof Object))throw new TypeError('Value of argument "json" violates contract.\n\nExpected:\nObject\n\nGot:\n'+o(n));var e=new t(n.name);return e.id=n.id,e.data=n.data,e.position=n.position,e.name=n.name,t.latestId=Math.max(e.id,t.latestId),e}}]),t}(),V=function(t){function n(t){v(this,n);var e=b(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,t));if(e.constructor===n)throw new TypeError("Can not construct abstract class.");return e.editor=null,e.data={},e}return w(n,t),m(n,[{key:"builder",value:function(){return regeneratorRuntime.async(function(t){for(;;)switch(t.prev=t.next){case 0:case"end":return t.stop()}},null,this)}},{key:"created",value:function(){}},{key:"destroyed",value:function(){}},{key:"build",value:function(t){return regeneratorRuntime.async(function(n){for(;;)switch(n.prev=n.next){case 0:if(t instanceof N){n.next=2;break}throw new TypeError('Value of argument "node" violates contract.\n\nExpected:\nNode\n\nGot:\n'+i(t));case 2:return n.next=4,regeneratorRuntime.awrap(this.builder(t));case 4:return n.abrupt("return",t);case 5:case"end":return n.stop()}},null,this)}},{key:"createNode",value:function(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return regeneratorRuntime.async(function(e){for(;;)switch(e.prev=e.next){case 0:return t=new N(this.name),t.data=n,e.next=4,regeneratorRuntime.awrap(this.build(t));case 4:return e.abrupt("return",t);case 5:case"end":return e.stop()}},null,this)}}]),n}(x),S=function t(n){v(this,t),this.handlers=g({warn:[console.warn],error:[console.error]},n)},G=function(){function t(n){if(v(this,t),!(n instanceof S||n instanceof t))throw new TypeError('Value of argument "events" violates contract.\n\nExpected:\nEvents | Emitter\n\nGot:\n'+a(n));this.events=n instanceof t?n.events:n.handlers,this.silent=!1}return m(t,[{key:"on",value:function(t,n){var e=this;if("string"!=typeof t)throw new TypeError('Value of argument "names" violates contract.\n\nExpected:\nstring\n\nGot:\n'+a(t));if("function"!=typeof n)throw new TypeError('Value of argument "handler" violates contract.\n\nExpected:\n() => {}\n\nGot:\n'+a(n));return t.split(" ").forEach(function(t){if(!e.events[t])throw new Error("The event "+t+" does not exist");e.events[t].push(n)}),this}},{key:"trigger",value:function(t,n){if("string"!=typeof t)throw new TypeError('Value of argument "name" violates contract.\n\nExpected:\nstring\n\nGot:\n'+a(t));if(!(t in this.events))throw new Error("The event "+t+" cannot be triggered");return this.events[t].reduce(function(t,e){return!1!==e(n)&&t},!0)}}]),t}(),R=function(){function t(){v(this,t)}return m(t,null,[{key:"isValidData",
value:function(t){return"string"==typeof t.id&&this.isValidId(t.id)&&t.nodes instanceof Object&&!(t.nodes instanceof Array)}},{key:"isValidId",value:function(t){return/^[\w-]{3,}@[0-9]+\.[0-9]+\.[0-9]+$/.test(t)}},{key:"validate",value:function(t,n){var e="",r=t.split("@"),o=n.id.split("@");return this.isValidData(n)||(e+="Data is not suitable. "),t!==n.id&&(e+="IDs not equal. "),r[0]!==o[0]&&(e+="Names don't match. "),r[1]!==o[1]&&(e+="Versions don't match"),{success:""===e,msg:e}}}]),t}(),L=function(t){function n(t,e){v(this,n);var r=b(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,e));if(!R.isValidId(t))throw new Error("ID should be valid to name@0.1.0 format");return r.id=t,r}return w(n,t),m(n,[{key:"use",value:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};t.install(this,n)}}]),n}(G),P=function(t){function n(){return v(this,n),b(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,{componentregister:[]}))}return w(n,t),n}(S),I={AVALIABLE:0,PROCESSED:1,ABORT:2},$=function(t){function n(t){if(v(this,n),"string"!=typeof t)throw new TypeError('Value of argument "id" violates contract.\n\nExpected:\nstring\n\nGot:\n'+u(t));var e=b(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,t,new P));return e.components=[],e.args=[],e.data=null,e.state=I.AVALIABLE,e.onAbort=function(){},e}return w(n,t),m(n,[{key:"clone",value:function(){var t=new n(this.id);return this.components.map(function(n){return t.register(n)}),t}},{key:"register",value:function(t){if(!(t instanceof x))throw new TypeError('Value of argument "component" violates contract.\n\nExpected:\nComponent\n\nGot:\n'+u(t));this.components.push(t),this.trigger("componentregister",t)}},{key:"throwError",value:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return regeneratorRuntime.async(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,regeneratorRuntime.awrap(this.abort());case 2:return this.trigger("error",{message:t,data:n}),this.processDone(),e.abrupt("return","error");case 5:case"end":return e.stop()}},null,this)}},{key:"extractInputNodes",value:function(t,n){return t.inputs.reduce(function(t,e){return[].concat(k(t),k((e.connections||[]).reduce(function(t,e){return[].concat(k(t),[n[e.node]])},[])))},[])}},{key:"detectRecursions",value:function(t){var n=this,e=function e(r,o){if(o.some(function(t){return t===r}))return r;for(var i=0;i<o.length;i++)if(e(r,n.extractInputNodes(o[i],t)))return r;return null};return Object.keys(t).map(function(n){return t[n]}).map(function(r){return e(r,n.extractInputNodes(r,t))}).filter(function(t){return null!==t})}},{key:"processStart",value:function(){return this.state===I.AVALIABLE?(this.state=I.PROCESSED,!0):this.state!==I.ABORT&&(console.warn("The process is busy and has not been restarted.\n Use abort() to force it to complete"),!1)}},{key:"processDone",value:function(){var t=this.state!==I.ABORT;return this.state=I.AVALIABLE,t||(this.onAbort(),this.onAbort=function(){}),t}},{key:"abort",value:function(){var t=this;return regeneratorRuntime.async(function(n){for(;;)switch(n.prev=n.next){case 0:return n.abrupt("return",new Promise(function(n){t.state===I.PROCESSED?(t.state=I.ABORT,t.onAbort=n):t.state===I.ABORT?(t.onAbort(),t.onAbort=n):n()}));case 1:case"end":return n.stop()}},null,this)}},{key:"lock",value:function(t){return regeneratorRuntime.async(function(n){for(;;)switch(n.prev=n.next){case 0:return n.abrupt("return",new Promise(function(n){t.unlockPool=t.unlockPool||[],t.busy&&!t.outputData?t.unlockPool.push(n):n(),t.busy=!0}));case 1:case"end":return n.stop()}},null,this)}},{key:"unlock",value:function(t){t.unlockPool.forEach(function(t){return t()}),t.unlockPool=[],t.busy=!1}},{key:"extractInputData",value:function(t){var n=this;return regeneratorRuntime.async(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,regeneratorRuntime.awrap(Promise.all(t.inputs.map(function(t){var e,r;return regeneratorRuntime.async(function(o){for(;;)switch(o.prev=o.next){case 0:return e=t.connections,o.next=3,regeneratorRuntime.awrap(Promise.all(e.map(function(t){var e,r;return regeneratorRuntime.async(function(o){for(;;)switch(o.prev=o.next){case 0:return e=n.data.nodes[t.node],o.next=3,regeneratorRuntime.awrap(n.processNode(e));case 3:if(r=o.sent){o.next=8;break}n.abort(),o.next=9;break;case 8:return o.abrupt("return",r[t.output]);case 9:case"end":return o.stop()}},null,n)})));case 3:return r=o.sent,o.abrupt("return",r);case 5:case"end":return o.stop()}},null,n)})));case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}},null,this)}},{key:"processWorker",value:function(t){var n,e,r;return regeneratorRuntime.async(function(o){for(;;)switch(o.prev=o.next){case 0:return o.next=2,regeneratorRuntime.awrap(this.extractInputData(t));case 2:return n=o.sent,e=this.components.find(function(n){return n.name===t.name}),r=t.outputs.map(function(){return null}),o.prev=5,o.next=8,regeneratorRuntime.awrap(e.worker.apply(e,[t,n,r].concat(k(this.args))));case 8:o.next=14;break;case 10:o.prev=10,o.t0=o.catch(5),this.abort(),this.trigger("warn",o.t0);case 14:return o.abrupt("return",r);case 15:case"end":return o.stop()}},null,this,[[5,10]])}},{key:"processNode",value:function(t){return regeneratorRuntime.async(function(n){for(;;)switch(n.prev=n.next){case 0:if(this.state!==I.ABORT&&t){n.next=2;break}return n.abrupt("return",null);case 2:return n.next=4,regeneratorRuntime.awrap(this.lock(t));case 4:return t.outputData||(t.outputData=this.processWorker(t)),this.unlock(t),n.abrupt("return",t.outputData);case 7:case"end":return n.stop()}},null,this)}},{key:"forwardProcess",value:function(t){var n=this;return regeneratorRuntime.async(function(e){for(;;)switch(e.prev=e.next){case 0:if(this.state!==I.ABORT){e.next=2;break}return e.abrupt("return",null);case 2:return e.next=4,regeneratorRuntime.awrap(Promise.all(t.outputs.map(function(t){return regeneratorRuntime.async(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,regeneratorRuntime.awrap(Promise.all(t.connections.map(function(t){var e;return regeneratorRuntime.async(function(r){for(;;)switch(r.prev=r.next){case 0:return e=n.data.nodes[t.node],r.next=3,regeneratorRuntime.awrap(n.processNode(e));case 3:return r.next=5,regeneratorRuntime.awrap(n.forwardProcess(e));case 5:case"end":return r.stop()}},null,n)})));case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}},null,n)})));case 4:return e.abrupt("return",e.sent);case 5:case"end":return e.stop()}},null,this)}},{key:"copy",value:function(t){return t=Object.assign({},t),t.nodes=Object.assign({},t.nodes),Object.keys(t.nodes).forEach(function(n){t.nodes[n]=Object.assign({},t.nodes[n])}),t}},{key:"validate",value:function(t){var n,e;return regeneratorRuntime.async(function(r){for(;;)switch(r.prev=r.next){case 0:if(n=R.validate(this.id,t),n.success){r.next=5;break}return r.next=4,regeneratorRuntime.awrap(this.throwError(n.msg));case 4:return r.abrupt("return",r.sent);case 5:if(e=this.detectRecursions(t.nodes),!(e.length>0)){r.next=10;break}return r.next=9,regeneratorRuntime.awrap(this.throwError("Recursion detected",e));case 9:return r.abrupt("return",r.sent);case 10:return r.abrupt("return",!0);case 11:case"end":return r.stop()}},null,this)}},{key:"processStartNode",value:function(t){var n;return regeneratorRuntime.async(function(e){for(;;)switch(e.prev=e.next){case 0:if(!t){e.next=10;break}if(n=this.data.nodes[t]){e.next=6;break}return e.next=5,regeneratorRuntime.awrap(this.throwError("Node with such id not found"));case 5:return e.abrupt("return",e.sent);case 6:return e.next=8,regeneratorRuntime.awrap(this.processNode(n));case 8:return e.next=10,regeneratorRuntime.awrap(this.forwardProcess(n));case 10:case"end":return e.stop()}},null,this)}},{key:"processUnreachable",value:function(){var t,n;return regeneratorRuntime.async(function(e){for(;;)switch(e.prev=e.next){case 0:e.t0=regeneratorRuntime.keys(this.data.nodes);case 1:if((e.t1=e.t0()).done){e.next=11;break}if(t=e.t1.value,void 0!==this.data.nodes[t].outputData){e.next=9;break}return n=this.data.nodes[t],e.next=7,regeneratorRuntime.awrap(this.processNode(n));case 7:return e.next=9,regeneratorRuntime.awrap(this.forwardProcess(n));case 9:e.next=1;break;case 11:case"end":return e.stop()}},null,this)}},{key:"process",value:function(t){for(var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,e=arguments.length,r=Array(e>2?e-2:0),o=2;o<e;o++)r[o-2]=arguments[o];return regeneratorRuntime.async(function(e){for(;;)switch(e.prev=e.next){case 0:if(t instanceof Object){e.next=2;break}throw new TypeError('Value of argument "data" violates contract.\n\nExpected:\nObject\n\nGot:\n'+u(t));case 2:if(null==n||"number"==typeof n){e.next=4;break}throw new TypeError('Value of argument "startId" violates contract.\n\nExpected:\n?number\n\nGot:\n'+u(n));case 4:if(this.processStart()){e.next=6;break}return e.abrupt("return");case 6:if(this.validate(t)){e.next=8;break}return e.abrupt("return");case 8:return this.data=this.copy(t),this.args=r,e.next=12,regeneratorRuntime.awrap(this.processStartNode(n));case 12:return e.next=14,regeneratorRuntime.awrap(this.processUnreachable());case 14:return e.abrupt("return",this.processDone()?"success":"aborted");case 15:case"end":return e.stop()}},null,this)}}]),n}(L),Z=function(t){function n(){return v(this,n),b(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,{nodecreate:[],nodecreated:[],noderemove:[],noderemoved:[],connectioncreate:[],connectioncreated:[],connectionremove:[],connectionremoved:[],nodetranslate:[],nodetranslated:[],selectnode:[],nodeselect:[],nodeselected:[],rendernode:[],rendersocket:[],rendercontrol:[],renderconnection:[],componentregister:[],keydown:[],keyup:[],translate:[],translated:[],zoom:[],zoomed:[],click:[],mousemove:[],contextmenu:[],import:[],export:[],process:[]}))}return w(n,t),n}(S),D=function(){function t(n){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(){},o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:function(){};v(this,t),this.mouseStart=null,this.el=n,this.onTranslate=e,this.onStart=r,this.onDrag=o,this.initEvents(n)}return m(t,[{key:"initEvents",value:function(t){t.addEventListener("mousedown",this.down.bind(this)),window.addEventListener("mousemove",this.move.bind(this)),window.addEventListener("mouseup",this.up.bind(this)),t.addEventListener("touchstart",this.down.bind(this)),window.addEventListener("touchmove",this.move.bind(this),{passive:!1}),window.addEventListener("touchend",this.up.bind(this))}},{key:"getCoords",value:function(t){var n=t.touches?t.touches[0]:t;return[n.pageX,n.pageY]}},{key:"down",value:function(t){t.stopPropagation(),this.mouseStart=this.getCoords(t),this.onStart()}},{key:"move",value:function(t){if(this.mouseStart){t.preventDefault(),t.stopPropagation();var n=this.getCoords(t),e=E(n,2),r=e[0],o=e[1],i=[r-this.mouseStart[0],o-this.mouseStart[1]],a=this.el.getBoundingClientRect().width/this.el.offsetWidth;this.mouseStart=[r,o],this.onTranslate(i[0]/a,i[1]/a)}}},{key:"up",value:function(t){this.mouseStart=null,this.onDrag()}}]),t}(),J=function(){function t(n,e,r,o){v(this,t),this.el=e,this.intensity=r,this.onzoom=o,this.distance=null,n.addEventListener("wheel",this.wheel.bind(this)),n.addEventListener("touchmove",this.move.bind(this)),n.addEventListener("touchend",this.end.bind(this)),n.addEventListener("touchcancel",this.end.bind(this))}return m(t,[{key:"wheel",value:function(t){t.preventDefault();var n=this.el.getBoundingClientRect(),e=t.wheelDelta/120*this.intensity,r=(n.left-t.pageX)*e,o=(n.top-t.pageY)*e;this.onzoom(e,r,o)}},{key:"touches",value:function(t){var n=[t.touches[0].pageX,t.touches[0].pageY],e=n[0],r=n[1],o=[t.touches[1].pageX,t.touches[1].pageY],i=o[0],a=o[1];return{cx:(e+i)/2,cy:(r+a)/2,distance:Math.sqrt(Math.pow(e-i,2)+Math.pow(r-a,2))}}},{key:"move",value:function(t){if(!(t.touches.length<2)){var n=this.el.getBoundingClientRect(),e=this.touches(t),r=e.cx,o=e.cy,i=e.distance;if(null!==this.distance){var a=i/this.distance-1,u=(n.left-r)*a,c=(n.top-o)*a;this.onzoom(a,u,c)}this.distance=i}}},{key:"end",value:function(){this.distance=null}}]),t}(),M=function(t){function n(t,e){if(v(this,n),!(e instanceof G))throw new TypeError('Value of argument "emitter" violates contract.\n\nExpected:\nEmitter\n\nGot:\n'+c(e));var r=b(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,e)),o=r.el=document.createElement("div");return r.container=t,r.transform={k:1,x:0,y:0},r.mouse=[0,0],o.style.transformOrigin="0 0",r._zoom=new J(t,o,.1,r.onZoom.bind(r)),r._drag=new D(t,r.onTranslate.bind(r)),r.container.addEventListener("mousemove",r.mousemove.bind(r)),r.update(),r}return w(n,t),m(n,[{key:"update",value:function(){var t=this.transform;this.el.style.transform="translate("+t.x+"px, "+t.y+"px) scale("+t.k+")"}},{key:"mousemove",value:function(t){var n=this.el.getBoundingClientRect(),e=t.clientX-n.left,r=t.clientY-n.top,o=this.transform.k;this.trigger("mousemove",{x:e/o,y:r/o})}},{key:"onTranslate",value:function(t,n){this.translate(this.transform.x+t,this.transform.y+n)}},{key:"onZoom",value:function(t,n,e){this.zoom(this.transform.k*(1+t),n,e),this.update()}},{key:"translate",value:function(t,n){var e={transform:this.transform,x:t,y:n};this.trigger("translate",e)&&(this.transform.x=e.x,this.transform.y=e.y,this.update(),this.trigger("translated"))}},{key:"zoom",value:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=this.transform.k,o={transform:this.transform,zoom:t};if(this.trigger("zoom",o)){var i=(r-o.zoom)/(r-t||1);this.transform.k=o.zoom,this.transform.x+=n*i,this.transform.y+=e*i,this.update(),this.trigger("zoomed")}}},{key:"appendChild",value:function(t){this.el.appendChild(t)}},{key:"removeChild",value:function(t){this.el.removeChild(t)}}]),n}(G),z=function(t){function n(t,e,r){v(this,n);var o=b(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,r));return o.trigger("rendercontrol",{el:t,control:e}),o}return w(n,t),n}(G),B=function(t){function n(t,e,r,o,i){var a;v(this,n);var u=b(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,i));return u.el=t,u.type=e,u.io=r,u.node=o,u.trigger("rendersocket",(a={el:t},y(a,e,u.io),y(a,"socket",r.socket),a)),u}return w(n,t),m(n,[{key:"getPosition",value:function(t){var n=t.position,e=this.el;return[n[0]+e.offsetLeft+e.offsetWidth/2,n[1]+e.offsetTop+e.offsetHeight/2]}}]),n}(G),H=function(t){function n(t,e,r){v(this,n);var o=b(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,r));return o.node=t,o.component=e,o.sockets=new Map,o.controls=new Map,o.el=document.createElement("div"),o.el.style.position="absolute",o.el.addEventListener("contextmenu",function(t){return o.trigger("contextmenu",{e:t,node:o.node})}),o.drag=new D(o.el,o.onTranslate.bind(o),o.onSelect.bind(o)),o.trigger("rendernode",{el:o.el,node:t,component:e.data,bindSocket:o.bindSocket.bind(o),bindControl:o.bindControl.bind(o)}),o.update(),o}return w(n,t),m(n,[{key:"bindSocket",value:function(t,n,e){if(!(t instanceof HTMLElement))throw new TypeError('Value of argument "el" violates contract.\n\nExpected:\nHTMLElement\n\nGot:\n'+s(t));if("string"!=typeof n)throw new TypeError('Value of argument "type" violates contract.\n\nExpected:\nstring\n\nGot:\n'+s(n));if(!(e instanceof A))throw new TypeError('Value of argument "io" violates contract.\n\nExpected:\nIO\n\nGot:\n'+s(e));this.sockets.set(e,new B(t,n,e,this.node,this))}},{key:"bindControl",value:function(t,n){if(!(t instanceof HTMLElement))throw new TypeError('Value of argument "el" violates contract.\n\nExpected:\nHTMLElement\n\nGot:\n'+s(t));if(!(n instanceof O))throw new TypeError('Value of argument "control" violates contract.\n\nExpected:\nControl\n\nGot:\n'+s(n));this.controls.set(n,new z(t,n,this))}},{key:"getSocketPosition",value:function(t){return this.sockets.get(t).getPosition(this.node)}},{key:"onSelect",value:function(){this.trigger("selectnode",this.node)}},{key:"onTranslate",value:function(t,n){var e=this.node,r=e.position[0]+t,o=e.position[1]+n;this.trigger("nodetranslate",{node:e,x:r,y:o})&&(this.translate(r,o),this.trigger("nodetranslated",{node:e}))}},{key:"translate",value:function(t,n){this.node.position[0]=t,this.node.position[1]=n,this.update()}},{key:"update",value:function(){this.el.style.transform="translate("+this.node.position[0]+"px, "+this.node.position[1]+"px)"}},{key:"remove",value:function(){}}]),n}(G),W=function(t){function n(t,e,r,o){if(v(this,n),!(e instanceof H))throw new TypeError('Value of argument "inputNode" violates contract.\n\nExpected:\nViewNode\n\nGot:\n'+l(e));if(!(r instanceof H))throw new TypeError('Value of argument "outputNode" violates contract.\n\nExpected:\nViewNode\n\nGot:\n'+l(r));var i=b(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,o));return i.connection=t,i.inputNode=e,i.outputNode=r,i.el=document.createElement("div"),i.el.style.position="absolute",i.el.style.zIndex="-1",i.update(),i}return w(n,t),m(n,[{key:"update",value:function(){var t=this.outputNode.getSocketPosition(this.connection.output),n=E(t,2),e=n[0],r=n[1],o=this.inputNode.getSocketPosition(this.connection.input),i=E(o,2),a=i[0],u=i[1];this.trigger("renderconnection",{el:this.el,connection:this.connection,x1:e,y1:r,x2:a,y2:u})}}]),n}(G),Y=function(t){function n(t,e,r){if(v(this,n),!(t instanceof HTMLElement))throw new TypeError('Value of argument "container" violates contract.\n\nExpected:\nHTMLElement\n\nGot:\n'+f(t));if(!(e instanceof Object))throw new TypeError('Value of argument "components" violates contract.\n\nExpected:\nObject\n\nGot:\n'+f(e));if(!(r instanceof G))throw new TypeError('Value of argument "emitter" violates contract.\n\nExpected:\nEmitter\n\nGot:\n'+f(r));var o=b(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,r));return o.container=t,o.components=e,o.container.style.overflow="hidden",o.nodes=new Map,o.connections=new Map,o.container.addEventListener("click",o.click.bind(o)),o.container.addEventListener("contextmenu",function(t){return o.trigger("contextmenu",{e:t,view:o})}),window.addEventListener("resize",o.resize.bind(o)),o.on("nodetranslated",o.updateConnections.bind(o)),o.area=new M(t,o),o.container.appendChild(o.area.el),o}return w(n,t),m(n,[{key:"addNode",value:function(t){if(!(t instanceof N))throw new TypeError('Value of argument "node" violates contract.\n\nExpected:\nNode\n\nGot:\n'+f(t));var n=new H(t,this.components.get(t.name),this);this.nodes.set(t,n),this.area.appendChild(n.el)}},{key:"removeNode",value:function(t){if(!(t instanceof N))throw new TypeError('Value of argument "node" violates contract.\n\nExpected:\nNode\n\nGot:\n'+f(t));var n=this.nodes.get(t);this.nodes.delete(t),this.area.removeChild(n.el)}},{key:"addConnection",value:function(t){if(!(t instanceof j))throw new TypeError('Value of argument "connection" violates contract.\n\nExpected:\nConnection\n\nGot:\n'+f(t));var n=this.nodes.get(t.input.node),e=this.nodes.get(t.output.node),r=new W(t,n,e,this);this.connections.set(t,r),this.area.appendChild(r.el)}},{key:"removeConnection",value:function(t){if(!(t instanceof j))throw new TypeError('Value of argument "connection" violates contract.\n\nExpected:\nConnection\n\nGot:\n'+f(t));var n=this.connections.get(t);this.connections.delete(t),this.area.removeChild(n.el)}},{key:"updateConnections",value:function(t){var n=this;t.node.getConnections().map(function(t){n.connections.get(t).update()})}},{key:"resize",value:function(){var t=this.container,n=t.parentElement.clientWidth,e=t.parentElement.clientHeight;t.style.width=n+"px",t.style.height=e+"px"}},{key:"click",value:function(t){var n=this.container;n===t.target&&this.trigger("click",{e:t,container:n})}}]),n}(G),F=function(){function t(){v(this,t),this.list=[]}return m(t,[{key:"add",value:function(t){var n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!(t instanceof N))throw new TypeError('Value of argument "item" violates contract.\n\nExpected:\nNode\n\nGot:\n'+h(t));n?this.contains(t)?this.remove(t):this.list.push(t):this.list=[t]}},{key:"clear",value:function(){var t=this;this.each(function(n){t.remove(n)})}},{key:"remove",value:function(t){this.list.splice(this.list.indexOf(t),1)}},{key:"contains",value:function(t){return-1!==this.list.indexOf(t)}},{key:"each",value:function(t){this.list.forEach(t)}}]),t}(),X=function(t){function n(t,e){if(v(this,n),"string"!=typeof t)throw new TypeError('Value of argument "id" violates contract.\n\nExpected:\nstring\n\nGot:\n'+p(t));if(!(e instanceof HTMLElement))throw new TypeError('Value of argument "container" violates contract.\n\nExpected:\nHTMLElement\n\nGot:\n'+p(e));var r=b(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,t,new Z));return r.nodes=[],r.components=new Map,r.selected=new F,r.view=new Y(e,r.components,r),window.addEventListener("keydown",function(t){return r.trigger("keydown",t)}),window.addEventListener("keyup",function(t){return r.trigger("keyup",t)}),r.on("nodecreated",function(t){return r.getComponent(t.name).created(t)}),r.on("noderemoved",function(t){return r.getComponent(t.name).destroyed(t)}),r.on("selectnode",function(t){return r.selectNode(t)}),r}return w(n,t),m(n,[{key:"addNode",value:function(t){if(!(t instanceof N))throw new TypeError('Value of argument "node" violates contract.\n\nExpected:\nNode\n\nGot:\n'+p(t));this.trigger("nodecreate",t)&&(this.nodes.push(t),this.view.addNode(t),this.trigger("nodecreated",t))}},{key:"removeNode",value:function(t){var n=this;if(!(t instanceof N))throw new TypeError('Value of argument "node" violates contract.\n\nExpected:\nNode\n\nGot:\n'+p(t));this.trigger("noderemove",t)&&(t.getConnections().forEach(function(t){return n.removeConnection(t)}),this.nodes.splice(this.nodes.indexOf(t),1),this.view.removeNode(t),this.trigger("noderemoved",t))}},{key:"connect",value:function(t,n){var e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!(t instanceof C))throw new TypeError('Value of argument "output" violates contract.\n\nExpected:\nOutput\n\nGot:\n'+p(t));if(!(n instanceof T))throw new TypeError('Value of argument "input" violates contract.\n\nExpected:\nInput\n\nGot:\n'+p(n));if(this.trigger("connectioncreate",{output:t,input:n}))try{var r=t.connectTo(n);r.data=e,this.view.addConnection(r),this.trigger("connectioncreated",r)}catch(t){this.trigger("warn",t)}}},{key:"removeConnection",value:function(t){if(!(t instanceof j))throw new TypeError('Value of argument "connection" violates contract.\n\nExpected:\nConnection\n\nGot:\n'+p(t));this.trigger("connectionremove",t)&&(this.view.removeConnection(t),t.remove(),this.trigger("connectionremoved",t))}},{key:"selectNode",value:function(t){var n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!(t instanceof N))throw new TypeError('Value of argument "node" violates contract.\n\nExpected:\nNode\n\nGot:\n'+p(t));if("boolean"!=typeof n)throw new TypeError('Value of argument "accumulate" violates contract.\n\nExpected:\nboolean\n\nGot:\n'+p(n));if(-1===this.nodes.indexOf(t))throw new Error("Node not exist in list");this.trigger("nodeselect",t)&&(this.selected.add(t,n),this.trigger("nodeselected",t))}},{key:"getComponent",value:function(t){var n=this.components.get(t);if(!n)throw"Component "+t+" not found";return n}},{key:"register",value:function(t){if(!(t instanceof V))throw new TypeError('Value of argument "component" violates contract.\n\nExpected:\nComponent\n\nGot:\n'+p(t));t.editor=this,this.components.set(t.name,t),this.trigger("componentregister",t)}},{key:"clear",value:function(){var t=this;[].concat(k(this.nodes)).map(function(n){return t.removeNode(n)})}},{key:"toJSON",value:function(){var t={id:this.id,nodes:{}};return this.nodes.forEach(function(n){return t.nodes[n.id]=n.toJSON()}),this.trigger("export",t),t}},{key:"beforeImport",value:function(t){if(!(t instanceof Object))throw new TypeError('Value of argument "json" violates contract.\n\nExpected:\nObject\n\nGot:\n'+p(t));var n=R.validate(this.id,t);return n.success?(this.silent=!0,this.clear(),this.trigger("import",t),!0):(this.trigger("warn",n.msg),!1)}},{key:"afterImport",value:function(){return this.silent=!1,!0}},{key:"fromJSON",value:function(t){var n,e=this;return regeneratorRuntime.async(function(r){for(;;)switch(r.prev=r.next){case 0:if(t instanceof Object){r.next=2;break}throw new TypeError('Value of argument "json" violates contract.\n\nExpected:\nObject\n\nGot:\n'+p(t));case 2:if(this.beforeImport(t)){r.next=4;break}return r.abrupt("return",!1);case 4:return n={},r.prev=5,r.next=8,regeneratorRuntime.awrap(Promise.all(Object.keys(t.nodes).map(function(r){var o,i;return regeneratorRuntime.async(function(a){for(;;)switch(a.prev=a.next){case 0:return o=t.nodes[r],i=e.getComponent(o.name),a.next=4,regeneratorRuntime.awrap(i.build(N.fromJSON(o)));case 4:n[r]=a.sent,e.addNode(n[r]);case 6:case"end":return a.stop()}},null,e)})));case 8:Object.keys(t.nodes).forEach(function(r){var o=t.nodes[r],i=n[r];o.outputs.forEach(function(t,r){t.connections.forEach(function(t){var o=t.node,a=t.data,u=t.input,c=n[o].inputs[u];e.connect(i.outputs[r],c,a)})})}),r.next=15;break;case 11:return r.prev=11,r.t0=r.catch(5),this.trigger("warn",r.t0),r.abrupt("return",!this.afterImport());case 15:return r.prev=15,r.abrupt("return",this.afterImport());case 18:case"end":return r.stop()}},null,this,[[5,11,15,18]])}}]),n}(L);return{Component:V,Control:O,NodeEditor:X,Emitter:G,Engine:$,Input:T,Node:N,Output:C,Socket:_}});
//# sourceMappingURL=rete.min.js.map
!function(t){"use strict";var c,n=Object.prototype,s=n.hasOwnProperty,e="function"==typeof Symbol?Symbol:{},o=e.iterator||"@@iterator",r=e.asyncIterator||"@@asyncIterator",i=e.toStringTag||"@@toStringTag",a="object"==typeof module,u=t.regeneratorRuntime;if(u)a&&(module.exports=u);else{(u=t.regeneratorRuntime=a?module.exports:{}).wrap=w;var l="suspendedStart",h="suspendedYield",p="executing",d="completed",v={},f={};f[o]=function(){return this};var m=Object.getPrototypeOf,y=m&&m(m(C([])));y&&y!==n&&s.call(y,o)&&(f=y);var g=x.prototype=k.prototype=Object.create(f);E.prototype=g.constructor=x,x.constructor=E,x[i]=E.displayName="GeneratorFunction",u.isGeneratorFunction=function(t){var n="function"==typeof t&&t.constructor;return!!n&&(n===E||"GeneratorFunction"===(n.displayName||n.name))},u.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,x):(t.__proto__=x,i in t||(t[i]="GeneratorFunction")),t.prototype=Object.create(g),t},u.awrap=function(t){return{__await:t}},O(j.prototype),j.prototype[r]=function(){return this},u.AsyncIterator=j,u.async=function(t,n,e,r){var o=new j(w(t,n,e,r));return u.isGeneratorFunction(n)?o:o.next().then(function(t){return t.done?t.value:o.next()})},O(g),g[i]="Generator",g[o]=function(){return this},g.toString=function(){return"[object Generator]"},u.keys=function(e){var r=[];for(var t in e)r.push(t);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},u.values=C,N.prototype={constructor:N,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=c,this.done=!1,this.delegate=null,this.method="next",this.arg=c,this.tryEntries.forEach(A),!t)for(var n in this)"t"===n.charAt(0)&&s.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=c)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function t(t,n){return i.type="throw",i.arg=e,r.next=t,n&&(r.method="next",r.arg=c),!!n}for(var n=this.tryEntries.length-1;0<=n;--n){var o=this.tryEntries[n],i=o.completion;if("root"===o.tryLoc)return t("end");if(o.tryLoc<=this.prev){var a=s.call(o,"catchLoc"),u=s.call(o,"finallyLoc");if(a&&u){if(this.prev<o.catchLoc)return t(o.catchLoc,!0);if(this.prev<o.finallyLoc)return t(o.finallyLoc)}else if(a){if(this.prev<o.catchLoc)return t(o.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return t(o.finallyLoc)}}}},abrupt:function(t,n){for(var e=this.tryEntries.length-1;0<=e;--e){var r=this.tryEntries[e];if(r.tryLoc<=this.prev&&s.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var o=r;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=n&&n<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=t,i.arg=n,o?(this.method="next",this.next=o.finallyLoc,v):this.complete(i)},complete:function(t,n){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&n&&(this.next=n),v},finish:function(t){for(var n=this.tryEntries.length-1;0<=n;--n){var e=this.tryEntries[n];if(e.finallyLoc===t)return this.complete(e.completion,e.afterLoc),A(e),v}},catch:function(t){for(var n=this.tryEntries.length-1;0<=n;--n){var e=this.tryEntries[n];if(e.tryLoc===t){var r=e.completion;if("throw"===r.type){var o=r.arg;A(e)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,n,e){return this.delegate={iterator:C(t),resultName:n,nextLoc:e},"next"===this.method&&(this.arg=c),v}}}function w(t,n,e,r){var i,a,u,c,o=n&&n.prototype instanceof k?n:k,s=Object.create(o.prototype),f=new N(r||[]);return s._invoke=(i=t,a=e,u=f,c=l,function(t,n){if(c===p)throw new Error("Generator is already running");if(c===d){if("throw"===t)throw n;return V()}for(u.method=t,u.arg=n;;){var e=u.delegate;if(e){var r=_(e,u);if(r){if(r===v)continue;return r}}if("next"===u.method)u.sent=u._sent=u.arg;else if("throw"===u.method){if(c===l)throw c=d,u.arg;u.dispatchException(u.arg)}else"return"===u.method&&u.abrupt("return",u.arg);c=p;var o=b(i,a,u);if("normal"===o.type){if(c=u.done?d:h,o.arg===v)continue;return{value:o.arg,done:u.done}}"throw"===o.type&&(c=d,u.method="throw",u.arg=o.arg)}}),s}function b(t,n,e){try{return{type:"normal",arg:t.call(n,e)}}catch(t){return{type:"throw",arg:t}}}function k(){}function E(){}function x(){}function O(t){["next","throw","return"].forEach(function(n){t[n]=function(t){return this._invoke(n,t)}})}function j(c){var n;this._invoke=function(e,r){function t(){return new Promise(function(t,n){!function n(t,e,r,o){var i=b(c[t],c,e);if("throw"!==i.type){var a=i.arg,u=a.value;return u&&"object"==typeof u&&s.call(u,"__await")?Promise.resolve(u.__await).then(function(t){n("next",t,r,o)},function(t){n("throw",t,r,o)}):Promise.resolve(u).then(function(t){a.value=t,r(a)},o)}o(i.arg)}(e,r,t,n)})}return n=n?n.then(t,t):t()}}function _(t,n){var e=t.iterator[n.method];if(e===c){if(n.delegate=null,"throw"===n.method){if(t.iterator.return&&(n.method="return",n.arg=c,_(t,n),"throw"===n.method))return v;n.method="throw",n.arg=new TypeError("The iterator does not provide a 'throw' method")}return v}var r=b(e,t.iterator,n.arg);if("throw"===r.type)return n.method="throw",n.arg=r.arg,n.delegate=null,v;var o=r.arg;return o?o.done?(n[t.resultName]=o.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=c),n.delegate=null,v):o:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}function T(t){var n={tryLoc:t[0]};1 in t&&(n.catchLoc=t[1]),2 in t&&(n.finallyLoc=t[2],n.afterLoc=t[3]),this.tryEntries.push(n)}function A(t){var n=t.completion||{};n.type="normal",delete n.arg,t.completion=n}function N(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(T,this),this.reset(!0)}function C(n){if(n){var t=n[o];if(t)return t.call(n);if("function"==typeof n.next)return n;if(!isNaN(n.length)){var e=-1,r=function t(){for(;++e<n.length;)if(s.call(n,e))return t.value=n[e],t.done=!1,t;return t.value=c,t.done=!0,t};return r.next=r}}return{next:V}}function V(){return{value:c,done:!0}}}(function(){return this}()||Function("return this")()),function(t,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):t.Rete=n()}(this,function(){"use strict";var u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},d=function(t){return function(){var u=t.apply(this,arguments);return new Promise(function(i,a){return function n(t,e){try{var r=u[t](e),o=r.value}catch(t){return void a(t)}if(!r.done)return Promise.resolve(o).then(function(t){n("next",t)},function(t){n("throw",t)});i(o)}("next")})}},p=function(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")},v=function(){function r(t,n){for(var e=0;e<n.length;e++){var r=n[e];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(t,n,e){return n&&r(t.prototype,n),e&&r(t,e),t}}(),c=function(t,n,e){return n in t?Object.defineProperty(t,n,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[n]=e,t},e=Object.assign||function(t){for(var n=1;n<arguments.length;n++){var e=arguments[n];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])}return t},m=function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Super expression must either be null or a function, not "+typeof n);t.prototype=Object.create(n&&n.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),n&&(Object.setPrototypeOf?Object.setPrototypeOf(t,n):t.__proto__=n)},y=function(t,n){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!n||"object"!=typeof n&&"function"!=typeof n?t:n},s=function(t,n){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return function(t,n){var e=[],r=!0,o=!1,i=void 0;try{for(var a,u=t[Symbol.iterator]();!(r=(a=u.next()).done)&&(e.push(a.value),!n||e.length!==n);r=!0);}catch(t){o=!0,i=t}finally{try{!r&&u.return&&u.return()}finally{if(o)throw i}}return e}(t,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")},g=function(t){if(Array.isArray(t)){for(var n=0,e=Array(t.length);n<t.length;n++)e[n]=t[n];return e}return Array.from(t)},w=function(){function n(t){if(p(this,n),this.constructor===n)throw new TypeError("Can not construct abstract class.");this.name=t,this.data={},this.engine=null}return v(n,[{key:"worker",value:function(){}}]),n}(),r=function(){function t(){if(p(this,t),this.constructor===t)throw new TypeError("Can not construct abstract class.");this.data={},this.parent=null}return v(t,[{key:"getNode",value:function(){if(null===this.parent)throw new Error("Control isn't added to Node/Input");return this.parent instanceof E?this.parent:this.parent.node}},{key:"getData",value:function(t){return this.getNode().data[t]}},{key:"putData",value:function(t,n){this.getNode().data[t]=n}}]),t}(),a=function(){function e(t,n){p(this,e),this.output=t,this.input=n,this.data={},this.input.addConnection(this)}return v(e,[{key:"remove",value:function(){this.input.removeConnection(this),this.output.removeConnection(this)}}]),e}(),f=function(){function o(t,n,e,r){p(this,o),this.node=null,this.multipleConnections=r,this.connections=[],this.key=t,this.name=n,this.socket=e}return v(o,[{key:"removeConnection",value:function(t){if(!(t instanceof a))throw new TypeError('Value of argument "connection" violates contract.\n\nExpected:\nConnection\n\nGot:\n'+function n(e,r){void 0===r&&(r=0);r+=1;{if(null===e)return"null";if(void 0===e)return"void";if("string"==typeof e||"number"==typeof e||"boolean"==typeof e)return void 0===e?"undefined":u(e);if(Array.isArray(e)){if(0<e.length){if(4<r)return"[...]";var o=n(e[0],r);return e.every(function(t){return n(t,r)===o})?o.trim()+"[]":"["+e.slice(0,15).map(function(t){return n(t,r)}).join(", ")+(15<=e.length?", ...":"")+"]"}return"Array"}var t=Object.keys(e);if(!t.length)return e.constructor&&e.constructor.name&&"Object"!==e.constructor.name?e.constructor.name:"Object";if(4<r)return"{...}";var i=" ".repeat(r-1),a=t.slice(0,15).map(function(t){return(/^([A-Z_$][A-Z0-9_$]*)$/i.test(t)?t:JSON.stringify(t))+": "+n(e[t],r)+";"}).join("\n "+i);return 15<=t.length&&(a+="\n "+i+"..."),e.constructor&&e.constructor.name&&"Object"!==e.constructor.name?e.constructor.name+" {\n "+i+a+"\n"+i+"}":"{\n "+i+a+"\n"+i+"}"}}(t));this.connections.splice(this.connections.indexOf(t),1)}},{key:"removeConnections",value:function(){var n=this;this.connections.map(function(t){return n.removeConnection(t)})}}]),o}();var l=function(){function e(t){var n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};if(p(this,e),"string"!=typeof t)throw new TypeError('Value of argument "name" violates contract.\n\nExpected:\nstring\n\nGot:\n'+h(t));this.name=t,this.data=n,this.compatible=[]}return v(e,[{key:"combineWith",value:function(t){if(!(t instanceof e))throw new TypeError('Value of argument "socket" violates contract.\n\nExpected:\nSocket\n\nGot:\n'+h(t));this.compatible.push(t)}},{key:"compatibleWith",value:function(t){if(!(t instanceof e))throw new TypeError('Value of argument "socket" violates contract.\n\nExpected:\nSocket\n\nGot:\n'+h(t));return this===t||this.compatible.includes(t)}}]),e}();function h(n,e){if(void 0===e&&(e=0),e+=1,null===n)return"null";if(void 0===n)return"void";if("string"==typeof n||"number"==typeof n||"boolean"==typeof n)return void 0===n?"undefined":u(n);if(Array.isArray(n)){if(0<n.length){if(4<e)return"[...]";var r=h(n[0],e);return n.every(function(t){return h(t,e)===r})?r.trim()+"[]":"["+n.slice(0,15).map(function(t){return h(t,e)}).join(", ")+(15<=n.length?", ...":"")+"]"}return"Array"}var t=Object.keys(n);if(!t.length)return n.constructor&&n.constructor.name&&"Object"!==n.constructor.name?n.constructor.name:"Object";if(4<e)return"{...}";var o=" ".repeat(e-1),i=t.slice(0,15).map(function(t){return(/^([A-Z_$][A-Z0-9_$]*)$/i.test(t)?t:JSON.stringify(t))+": "+h(n[t],e)+";"}).join("\n "+o);return 15<=t.length&&(i+="\n "+o+"..."),n.constructor&&n.constructor.name&&"Object"!==n.constructor.name?n.constructor.name+" {\n "+o+i+"\n"+o+"}":"{\n "+o+i+"\n"+o+"}"}var i=function(t){function i(t,n,e){var r=3<arguments.length&&void 0!==arguments[3]&&arguments[3];if(p(this,i),"string"!=typeof t)throw new TypeError('Value of argument "key" violates contract.\n\nExpected:\nstring\n\nGot:\n'+b(t));if("string"!=typeof n)throw new TypeError('Value of argument "title" violates contract.\n\nExpected:\nstring\n\nGot:\n'+b(n));if(!(e instanceof l))throw new TypeError('Value of argument "socket" violates contract.\n\nExpected:\nSocket\n\nGot:\n'+b(e));if("boolean"!=typeof r)throw new TypeError('Value of argument "multiConns" violates contract.\n\nExpected:\nboolean\n\nGot:\n'+b(r));var o=y(this,(i.__proto__||Object.getPrototypeOf(i)).call(this,t,n,e,r));return o.control=null,o}return m(i,f),v(i,[{key:"hasConnection",value:function(){return 0<this.connections.length}},{key:"addConnection",value:function(t){if(!(t instanceof a))throw new TypeError('Value of argument "connection" violates contract.\n\nExpected:\nConnection\n\nGot:\n'+b(t));if(!this.multipleConnections&&this.hasConnection())throw new Error("Multiple connections not allowed");this.connections.push(t)}},{key:"addControl",value:function(t){if(!(t instanceof r))throw new TypeError('Value of argument "control" violates contract.\n\nExpected:\nControl\n\nGot:\n'+b(t));(this.control=t).parent=this}},{key:"showControl",value:function(){return!this.hasConnection()&&null!==this.control}},{key:"toJSON",value:function(){return{connections:this.connections.map(function(t){return{node:t.output.node.id,output:t.output.key,data:t.data}})}}}]),i}();function b(n,e){if(void 0===e&&(e=0),e+=1,null===n)return"null";if(void 0===n)return"void";if("string"==typeof n||"number"==typeof n||"boolean"==typeof n)return void 0===n?"undefined":u(n);if(Array.isArray(n)){if(0<n.length){if(4<e)return"[...]";var r=b(n[0],e);return n.every(function(t){return b(t,e)===r})?r.trim()+"[]":"["+n.slice(0,15).map(function(t){return b(t,e)}).join(", ")+(15<=n.length?", ...":"")+"]"}return"Array"}var t=Object.keys(n);if(!t.length)return n.constructor&&n.constructor.name&&"Object"!==n.constructor.name?n.constructor.name:"Object";if(4<e)return"{...}";var o=" ".repeat(e-1),i=t.slice(0,15).map(function(t){return(/^([A-Z_$][A-Z0-9_$]*)$/i.test(t)?t:JSON.stringify(t))+": "+b(n[t],e)+";"}).join("\n "+o);return 15<=t.length&&(i+="\n "+o+"..."),n.constructor&&n.constructor.name&&"Object"!==n.constructor.name?n.constructor.name+" {\n "+o+i+"\n"+o+"}":"{\n "+o+i+"\n"+o+"}"}var o=function(t){function o(t,n,e){var r=!(3<arguments.length&&void 0!==arguments[3])||arguments[3];if(p(this,o),"string"!=typeof t)throw new TypeError('Value of argument "key" violates contract.\n\nExpected:\nstring\n\nGot:\n'+k(t));if("string"!=typeof n)throw new TypeError('Value of argument "title" violates contract.\n\nExpected:\nstring\n\nGot:\n'+k(n));if(!(e instanceof l))throw new TypeError('Value of argument "socket" violates contract.\n\nExpected:\nSocket\n\nGot:\n'+k(e));if("boolean"!=typeof r)throw new TypeError('Value of argument "multiConns" violates contract.\n\nExpected:\nboolean\n\nGot:\n'+k(r));return y(this,(o.__proto__||Object.getPrototypeOf(o)).call(this,t,n,e,r))}return m(o,f),v(o,[{key:"hasConnection",value:function(){return 0<this.connections.length}},{key:"connectTo",value:function(t){if(!(t instanceof i))throw new TypeError('Value of argument "input" violates contract.\n\nExpected:\nInput\n\nGot:\n'+k(t));if(!this.socket.compatibleWith(t.socket))throw new Error("Sockets not compatible");if(!t.multipleConnections&&t.hasConnection())throw new Error("Input already has one connection");if(!this.multipleConnections&&this.hasConnection())throw new Error("Output already has one connection");var n=new a(this,t);return this.connections.push(n),n}},{key:"connectedTo",value:function(n){if(!(n instanceof i))throw new TypeError('Value of argument "input" violates contract.\n\nExpected:\nInput\n\nGot:\n'+k(n));return this.connections.some(function(t){return t.input===n})}},{key:"toJSON",value:function(){return{connections:this.connections.map(function(t){return{node:t.input.node.id,input:t.input.key,data:t.data}})}}}]),o}();function k(n,e){if(void 0===e&&(e=0),e+=1,null===n)return"null";if(void 0===n)return"void";if("string"==typeof n||"number"==typeof n||"boolean"==typeof n)return void 0===n?"undefined":u(n);if(Array.isArray(n)){if(0<n.length){if(4<e)return"[...]";var r=k(n[0],e);return n.every(function(t){return k(t,e)===r})?r.trim()+"[]":"["+n.slice(0,15).map(function(t){return k(t,e)}).join(", ")+(15<=n.length?", ...":"")+"]"}return"Array"}var t=Object.keys(n);if(!t.length)return n.constructor&&n.constructor.name&&"Object"!==n.constructor.name?n.constructor.name:"Object";if(4<e)return"{...}";var o=" ".repeat(e-1),i=t.slice(0,15).map(function(t){return(/^([A-Z_$][A-Z0-9_$]*)$/i.test(t)?t:JSON.stringify(t))+": "+k(n[t],e)+";"}).join("\n "+o);return 15<=t.length&&(i+="\n "+o+"..."),n.constructor&&n.constructor.name&&"Object"!==n.constructor.name?n.constructor.name+" {\n "+o+i+"\n"+o+"}":"{\n "+o+i+"\n"+o+"}"}var E=function(){function e(t){if(p(this,e),"string"!=typeof t)throw new TypeError('Value of argument "name" violates contract.\n\nExpected:\nstring\n\nGot:\n'+x(t));this.name=t,this.id=e.incrementId(),this.position=[0,0],this.inputs=[],this.outputs=[],this.controls=[],this.data={},this.meta={}}return v(e,[{key:"addControl",value:function(t){var n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:this.controls.length;if(!(t instanceof r))throw new TypeError('Value of argument "control" violates contract.\n\nExpected:\nControl\n\nGot:\n'+x(t));if(!(null==n||"number"==typeof n&&!isNaN(n)&&0<=n&&n<=255&&n===Math.floor(n)))throw new TypeError('Value of argument "index" violates contract.\n\nExpected:\n?uint8\n\nGot:\n'+x(n));return(t.parent=this).controls.splice(n,0,t),this}},{key:"removeControl",value:function(t){if(!(t instanceof r))throw new TypeError('Value of argument "control" violates contract.\n\nExpected:\nControl\n\nGot:\n'+x(t));t.parent=null,this.controls.splice(this.controls.indexOf(t),1)}},{key:"addInput",value:function(t){var n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:this.inputs.length;if(!(t instanceof i))throw new TypeError('Value of argument "input" violates contract.\n\nExpected:\nInput\n\nGot:\n'+x(t));if(!(null==n||"number"==typeof n&&!isNaN(n)&&0<=n&&n<=255&&n===Math.floor(n)))throw new TypeError('Value of argument "index" violates contract.\n\nExpected:\n?uint8\n\nGot:\n'+x(n));if(null!==t.node)throw new Error("Input has already been added to the node");return(t.node=this).inputs.splice(n,0,t),this}},{key:"removeInput",value:function(t){if(!(t instanceof i))throw new TypeError('Value of argument "input" violates contract.\n\nExpected:\nInput\n\nGot:\n'+x(t));t.removeConnections(),t.node=null,this.inputs.splice(this.inputs.indexOf(t),1)}},{key:"addOutput",value:function(t){var n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:this.outputs.length;if(!(t instanceof o))throw new TypeError('Value of argument "output" violates contract.\n\nExpected:\nOutput\n\nGot:\n'+x(t));if(!(null==n||"number"==typeof n&&!isNaN(n)&&0<=n&&n<=255&&n===Math.floor(n)))throw new TypeError('Value of argument "index" violates contract.\n\nExpected:\n?uint8\n\nGot:\n'+x(n));if(null!==t.node)throw new Error("Output has already been added to the node");return(t.node=this).outputs.splice(n,0,t),this}},{key:"removeOutput",value:function(t){if(!(t instanceof o))throw new TypeError('Value of argument "output" violates contract.\n\nExpected:\nOutput\n\nGot:\n'+x(t));t.removeConnections(),t.node=null,this.outputs.splice(this.outputs.indexOf(t),1)}},{key:"getConnections",value:function(){return[].concat(g(this.inputs),g(this.outputs)).reduce(function(t,n){return[].concat(g(t),g(n.connections))},[])}},{key:"inputsWithVisibleControl",value:function(){return this.inputs.filter(function(t){return t.showControl()})}},{key:"toJSON",value:function(){return{id:this.id,data:this.data,inputs:this.inputs.reduce(function(t,n){return t[n.key]=n.toJSON(),t},{}),outputs:this.outputs.reduce(function(t,n){return t[n.key]=n.toJSON(),t},{}),position:this.position,name:this.name}}}],[{key:"incrementId",value:function(){return this.latestId?this.latestId++:this.latestId=1,this.latestId}},{key:"fromJSON",value:function(t){if(!(t instanceof Object))throw new TypeError('Value of argument "json" violates contract.\n\nExpected:\nObject\n\nGot:\n'+x(t));var n=new e(t.name);return n.id=t.id,n.data=t.data,n.position=t.position,n.name=t.name,e.latestId=Math.max(n.id,e.latestId),n}}]),e}();function x(n,e){if(void 0===e&&(e=0),e+=1,null===n)return"null";if(void 0===n)return"void";if("string"==typeof n||"number"==typeof n||"boolean"==typeof n)return void 0===n?"undefined":u(n);if(Array.isArray(n)){if(0<n.length){if(4<e)return"[...]";var r=x(n[0],e);return n.every(function(t){return x(t,e)===r})?r.trim()+"[]":"["+n.slice(0,15).map(function(t){return x(t,e)}).join(", ")+(15<=n.length?", ...":"")+"]"}return"Array"}var t=Object.keys(n);if(!t.length)return n.constructor&&n.constructor.name&&"Object"!==n.constructor.name?n.constructor.name:"Object";if(4<e)return"{...}";var o=" ".repeat(e-1),i=t.slice(0,15).map(function(t){return(/^([A-Z_$][A-Z0-9_$]*)$/i.test(t)?t:JSON.stringify(t))+": "+x(n[t],e)+";"}).join("\n "+o);return 15<=t.length&&(i+="\n "+o+"..."),n.constructor&&n.constructor.name&&"Object"!==n.constructor.name?n.constructor.name+" {\n "+o+i+"\n"+o+"}":"{\n "+o+i+"\n"+o+"}"}var O=function(t){function e(t){p(this,e);var n=y(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));if(n.constructor===e)throw new TypeError("Can not construct abstract class.");return n.editor=null,n.data={},n}var n,r,o;return m(e,w),v(e,[{key:"builder",value:(o=d(regeneratorRuntime.mark(function t(){return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:case"end":return t.stop()}},t,this)})),function(){return o.apply(this,arguments)})},{key:"created",value:function(){}},{key:"destroyed",value:function(){}},{key:"build",value:(r=d(regeneratorRuntime.mark(function t(n){return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(n instanceof E){t.next=2;break}throw new TypeError('Value of argument "node" violates contract.\n\nExpected:\nNode\n\nGot:\n'+j(n));case 2:return t.next=4,this.builder(n);case 4:return t.abrupt("return",n);case 5:case"end":return t.stop()}},t,this)})),function(t){return r.apply(this,arguments)})},{key:"createNode",value:(n=d(regeneratorRuntime.mark(function t(){var n,e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return(n=new E(this.name)).data=e,t.next=4,this.build(n);case 4:return t.abrupt("return",n);case 5:case"end":return t.stop()}},t,this)})),function(){return n.apply(this,arguments)})}]),e}();function j(n,e){if(void 0===e&&(e=0),e+=1,null===n)return"null";if(void 0===n)return"void";if("string"==typeof n||"number"==typeof n||"boolean"==typeof n)return void 0===n?"undefined":u(n);if(Array.isArray(n)){if(0<n.length){if(4<e)return"[...]";var r=j(n[0],e);return n.every(function(t){return j(t,e)===r})?r.trim()+"[]":"["+n.slice(0,15).map(function(t){return j(t,e)}).join(", ")+(15<=n.length?", ...":"")+"]"}return"Array"}var t=Object.keys(n);if(!t.length)return n.constructor&&n.constructor.name&&"Object"!==n.constructor.name?n.constructor.name:"Object";if(4<e)return"{...}";var o=" ".repeat(e-1),i=t.slice(0,15).map(function(t){return(/^([A-Z_$][A-Z0-9_$]*)$/i.test(t)?t:JSON.stringify(t))+": "+j(n[t],e)+";"}).join("\n "+o);return 15<=t.length&&(i+="\n "+o+"..."),n.constructor&&n.constructor.name&&"Object"!==n.constructor.name?n.constructor.name+" {\n "+o+i+"\n"+o+"}":"{\n "+o+i+"\n"+o+"}"}var _=function t(n){p(this,t),this.handlers=e({warn:[console.warn],error:[console.error]},n)},T=function(){function n(t){if(p(this,n),!(t instanceof _||t instanceof n))throw new TypeError('Value of argument "events" violates contract.\n\nExpected:\nEvents | Emitter\n\nGot:\n'+A(t));this.events=t instanceof n?t.events:t.handlers,this.silent=!1}return v(n,[{key:"on",value:function(t,n){var e=this;if("string"!=typeof t)throw new TypeError('Value of argument "names" violates contract.\n\nExpected:\nstring\n\nGot:\n'+A(t));if("function"!=typeof n)throw new TypeError('Value of argument "handler" violates contract.\n\nExpected:\n() => {}\n\nGot:\n'+A(n));return t.split(" ").forEach(function(t){if(!e.events[t])throw new Error("The event "+t+" does not exist");e.events[t].push(n)}),this}},{key:"trigger",value:function(t,e){if("string"!=typeof t)throw new TypeError('Value of argument "name" violates contract.\n\nExpected:\nstring\n\nGot:\n'+A(t));if(!(t in this.events))throw new Error("The event "+t+" cannot be triggered");return this.events[t].reduce(function(t,n){return!1!==n(e)&&t},!0)}}]),n}();function A(n,e){if(void 0===e&&(e=0),e+=1,null===n)return"null";if(void 0===n)return"void";if("string"==typeof n||"number"==typeof n||"boolean"==typeof n)return void 0===n?"undefined":u(n);if(Array.isArray(n)){if(0<n.length){if(4<e)return"[...]";var r=A(n[0],e);return n.every(function(t){return A(t,e)===r})?r.trim()+"[]":"["+n.slice(0,15).map(function(t){return A(t,e)}).join(", ")+(15<=n.length?", ...":"")+"]"}return"Array"}var t=Object.keys(n);if(!t.length)return n.constructor&&n.constructor.name&&"Object"!==n.constructor.name?n.constructor.name:"Object";if(4<e)return"{...}";var o=" ".repeat(e-1),i=t.slice(0,15).map(function(t){return(/^([A-Z_$][A-Z0-9_$]*)$/i.test(t)?t:JSON.stringify(t))+": "+A(n[t],e)+";"}).join("\n "+o);return 15<=t.length&&(i+="\n "+o+"..."),n.constructor&&n.constructor.name&&"Object"!==n.constructor.name?n.constructor.name+" {\n "+o+i+"\n"+o+"}":"{\n "+o+i+"\n"+o+"}"}var N=function(){function t(){p(this,t)}return v(t,null,[{key:"isValidData",value:function(t){return"string"==typeof t.id&&this.isValidId(t.id)&&t.nodes instanceof Object&&!(t.nodes instanceof Array)}},{key:"isValidId",value:function(t){return/^[\w-]{3,}@[0-9]+\.[0-9]+\.[0-9]+$/.test(t)}},{key:"validate",value:function(t,n){var e="",r=t.split("@"),o=n.id.split("@");return this.isValidData(n)||(e+="Data is not suitable. "),t!==n.id&&(e+="IDs not equal. "),r[0]!==o[0]&&(e+="Names don't match. "),r[1]!==o[1]&&(e+="Versions don't match"),{success:""===e,msg:e}}}]),t}(),C=function(t){function r(t,n){p(this,r);var e=y(this,(r.__proto__||Object.getPrototypeOf(r)).call(this,n));if(!N.isValidId(t))throw new Error("ID should be valid to name@0.1.0 format");return e.id=t,e}return m(r,T),v(r,[{key:"use",value:function(t){var n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};t.install(this,n)}}]),r}(),V=function(t){function n(){return p(this,n),y(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,{componentregister:[]}))}return m(n,_),n}(),G=0,S=1,L=2,t=function(t){function e(t){if(p(this,e),"string"!=typeof t)throw new TypeError('Value of argument "id" violates contract.\n\nExpected:\nstring\n\nGot:\n'+P(t));var n=y(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,new V));return n.components=[],n.args=[],n.data=null,n.state=G,n.onAbort=function(){},n}var n,r,o,i,a,u,c,s,f,l,h;return m(e,C),v(e,[{key:"clone",value:function(){var n=new e(this.id);return this.components.map(function(t){return n.register(t)}),n}},{key:"register",value:function(t){if(!(t instanceof w))throw new TypeError('Value of argument "component" violates contract.\n\nExpected:\nComponent\n\nGot:\n'+P(t));this.components.push(t),this.trigger("componentregister",t)}},{key:"throwError",value:(h=d(regeneratorRuntime.mark(function t(n){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:null;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.abort();case 2:return this.trigger("error",{message:n,data:e}),this.processDone(),t.abrupt("return","error");case 5:case"end":return t.stop()}},t,this)})),function(t){return h.apply(this,arguments)})},{key:"extractInputNodes",value:function(e,r){return Object.keys(e.inputs).reduce(function(t,n){return[].concat(g(t),g((e.inputs[n].connections||[]).reduce(function(t,n){return[].concat(g(t),[r[n.node]])},[])))},[])}},{key:"detectRecursions",value:function(o){var i=this,t=Object.keys(o).map(function(t){return o[t]});return t.map(function(t){return function t(n,e){if(e.some(function(t){return t===n}))return n;for(var r=0;r<e.length;r++)if(t(n,i.extractInputNodes(e[r],o)))return n;return null}(t,i.extractInputNodes(t,o))}).filter(function(t){return null!==t})}},{key:"processStart",value:function(){return this.state===G?(this.state=S,!0):(this.state===L||console.warn("The process is busy and has not been restarted.\n Use abort() to force it to complete"),!1)}},{key:"processDone",value:function(){var t=this.state!==L;return this.state=G,t||(this.onAbort(),this.onAbort=function(){}),t}},{key:"abort",value:(l=d(regeneratorRuntime.mark(function t(){var n=this;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",new Promise(function(t){n.state===S?(n.state=L,n.onAbort=t):n.state===L?(n.onAbort(),n.onAbort=t):t()}));case 1:case"end":return t.stop()}},t,this)})),function(){return l.apply(this,arguments)})},{key:"lock",value:(f=d(regeneratorRuntime.mark(function t(n){return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",new Promise(function(t){n.unlockPool=n.unlockPool||[],n.busy&&!n.outputData?n.unlockPool.push(t):t(),n.busy=!0}));case 1:case"end":return t.stop()}},t,this)})),function(t){return f.apply(this,arguments)})},{key:"unlock",value:function(t){t.unlockPool.forEach(function(t){return t()}),t.unlockPool=[],t.busy=!1}},{key:"extractInputData",value:(s=d(regeneratorRuntime.mark(function t(n){var e,r,o,i,a,u,c,s,f,l,h,p=this;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(e={},(c=Object.keys(n.inputs))&&("function"==typeof c[Symbol.iterator]||Array.isArray(c))){t.next=4;break}throw new TypeError("Expected _Object$keys to be iterable, got "+P(c));case 4:o=!(r=!0),i=void 0,t.prev=7,a=c[Symbol.iterator]();case 9:if(r=(u=a.next()).done){t.next=20;break}return s=u.value,f=n.inputs[s],l=f.connections,t.next=15,Promise.all(l.map(function(){var n=d(regeneratorRuntime.mark(function t(n){var e,r;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return e=p.data.nodes[n.node],t.next=3,p.processNode(e);case 3:if(r=t.sent){t.next=8;break}p.abort(),t.next=9;break;case 8:return t.abrupt("return",r[n.output]);case 9:case"end":return t.stop()}},t,p)}));return function(t){return n.apply(this,arguments)}}()));case 15:h=t.sent,e[s]=h;case 17:r=!0,t.next=9;break;case 20:t.next=26;break;case 22:t.prev=22,t.t0=t.catch(7),o=!0,i=t.t0;case 26:t.prev=26,t.prev=27,!r&&a.return&&a.return();case 29:if(t.prev=29,!o){t.next=32;break}throw i;case 32:return t.finish(29);case 33:return t.finish(26);case 34:return t.abrupt("return",e);case 35:case"end":return t.stop()}},t,this,[[7,22,26,34],[27,,29,33]])})),function(t){return s.apply(this,arguments)})},{key:"processWorker",value:(c=d(regeneratorRuntime.mark(function t(n){var e,r,o;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.extractInputData(n);case 2:return e=t.sent,r=this.components.find(function(t){return t.name===n.name}),o={},t.prev=5,t.next=8,r.worker.apply(r,[n,e,o].concat(g(this.args)));case 8:t.next=14;break;case 10:t.prev=10,t.t0=t.catch(5),this.abort(),this.trigger("warn",t.t0);case 14:return t.abrupt("return",o);case 15:case"end":return t.stop()}},t,this,[[5,10]])})),function(t){return c.apply(this,arguments)})},{key:"processNode",value:(u=d(regeneratorRuntime.mark(function t(n){return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(this.state!==L&&n){t.next=2;break}return t.abrupt("return",null);case 2:return t.next=4,this.lock(n);case 4:return n.outputData||(n.outputData=this.processWorker(n)),this.unlock(n),t.abrupt("return",n.outputData);case 7:case"end":return t.stop()}},t,this)})),function(t){return u.apply(this,arguments)})},{key:"forwardProcess",value:(a=d(regeneratorRuntime.mark(function t(r){var o=this;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(this.state!==L){t.next=2;break}return t.abrupt("return",null);case 2:return t.next=4,Promise.all(Object.keys(r.outputs).map(function(){var n=d(regeneratorRuntime.mark(function t(n){var e;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return e=r.outputs[n],t.next=3,Promise.all(e.connections.map(function(){var n=d(regeneratorRuntime.mark(function t(n){var e;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return e=o.data.nodes[n.node],t.next=3,o.processNode(e);case 3:return t.next=5,o.forwardProcess(e);case 5:case"end":return t.stop()}},t,o)}));return function(t){return n.apply(this,arguments)}}()));case 3:return t.abrupt("return",t.sent);case 4:case"end":return t.stop()}},t,o)}));return function(t){return n.apply(this,arguments)}}()));case 4:return t.abrupt("return",t.sent);case 5:case"end":return t.stop()}},t,this)})),function(t){return a.apply(this,arguments)})},{key:"copy",value:function(n){return(n=Object.assign({},n)).nodes=Object.assign({},n.nodes),Object.keys(n.nodes).forEach(function(t){n.nodes[t]=Object.assign({},n.nodes[t])}),n}},{key:"validate",value:(i=d(regeneratorRuntime.mark(function t(n){var e,r;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if((e=N.validate(this.id,n)).success){t.next=5;break}return t.next=4,this.throwError(e.msg);case 4:return t.abrupt("return",t.sent);case 5:if(!(0<(r=this.detectRecursions(n.nodes)).length)){t.next=10;break}return t.next=9,this.throwError("Recursion detected",r);case 9:return t.abrupt("return",t.sent);case 10:return t.abrupt("return",!0);case 11:case"end":return t.stop()}},t,this)})),function(t){return i.apply(this,arguments)})},{key:"processStartNode",value:(o=d(regeneratorRuntime.mark(function t(n){var e;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(!n){t.next=10;break}if(e=this.data.nodes[n]){t.next=6;break}return t.next=5,this.throwError("Node with such id not found");case 5:return t.abrupt("return",t.sent);case 6:return t.next=8,this.processNode(e);case 8:return t.next=10,this.forwardProcess(e);case 10:case"end":return t.stop()}},t,this)})),function(t){return o.apply(this,arguments)})},{key:"processUnreachable",value:(r=d(regeneratorRuntime.mark(function t(){var n,e;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:t.t0=regeneratorRuntime.keys(this.data.nodes);case 1:if((t.t1=t.t0()).done){t.next=11;break}if(n=t.t1.value,void 0!==this.data.nodes[n].outputData){t.next=9;break}return e=this.data.nodes[n],t.next=7,this.processNode(e);case 7:return t.next=9,this.forwardProcess(e);case 9:t.next=1;break;case 11:case"end":return t.stop()}},t,this)})),function(){return r.apply(this,arguments)})},{key:"process",value:(n=d(regeneratorRuntime.mark(function t(n){for(var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:null,r=arguments.length,o=Array(2<r?r-2:0),i=2;i<r;i++)o[i-2]=arguments[i];return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(n instanceof Object){t.next=2;break}throw new TypeError('Value of argument "data" violates contract.\n\nExpected:\nObject\n\nGot:\n'+P(n));case 2:if(null==e||"number"==typeof e){t.next=4;break}throw new TypeError('Value of argument "startId" violates contract.\n\nExpected:\n?number\n\nGot:\n'+P(e));case 4:if(this.processStart()){t.next=6;break}return t.abrupt("return");case 6:if(this.validate(n)){t.next=8;break}return t.abrupt("return");case 8:return this.data=this.copy(n),this.args=o,t.next=12,this.processStartNode(e);case 12:return t.next=14,this.processUnreachable();case 14:return t.abrupt("return",this.processDone()?"success":"aborted");case 15:case"end":return t.stop()}},t,this)})),function(t){return n.apply(this,arguments)})}]),e}();function P(n,e){if(void 0===e&&(e=0),e+=1,null===n)return"null";if(void 0===n)return"void";if("string"==typeof n||"number"==typeof n||"boolean"==typeof n)return void 0===n?"undefined":u(n);if(Array.isArray(n)){if(0<n.length){if(4<e)return"[...]";var r=P(n[0],e);return n.every(function(t){return P(t,e)===r})?r.trim()+"[]":"["+n.slice(0,15).map(function(t){return P(t,e)}).join(", ")+(15<=n.length?", ...":"")+"]"}return"Array"}var t=Object.keys(n);if(!t.length)return n.constructor&&n.constructor.name&&"Object"!==n.constructor.name?n.constructor.name:"Object";if(4<e)return"{...}";var o=" ".repeat(e-1),i=t.slice(0,15).map(function(t){return(/^([A-Z_$][A-Z0-9_$]*)$/i.test(t)?t:JSON.stringify(t))+": "+P(n[t],e)+";"}).join("\n "+o);return 15<=t.length&&(i+="\n "+o+"..."),n.constructor&&n.constructor.name&&"Object"!==n.constructor.name?n.constructor.name+" {\n "+o+i+"\n"+o+"}":"{\n "+o+i+"\n"+o+"}"}var R=function(t){function n(){return p(this,n),y(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,{nodecreate:[],nodecreated:[],noderemove:[],noderemoved:[],connectioncreate:[],connectioncreated:[],connectionremove:[],connectionremoved:[],nodetranslate:[],nodetranslated:[],selectnode:[],nodeselect:[],nodeselected:[],rendernode:[],rendersocket:[],rendercontrol:[],renderconnection:[],componentregister:[],keydown:[],keyup:[],translate:[],translated:[],zoom:[],zoomed:[],click:[],mousemove:[],contextmenu:[],import:[],export:[],process:[]}))}return m(n,_),n}(),$=function(){function o(t){var n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:function(){},e=2<arguments.length&&void 0!==arguments[2]?arguments[2]:function(){},r=3<arguments.length&&void 0!==arguments[3]?arguments[3]:function(){};p(this,o),this.mouseStart=null,this.el=t,this.onTranslate=n,this.onStart=e,this.onDrag=r,this.initEvents(t)}return v(o,[{key:"initEvents",value:function(t){t.addEventListener("mousedown",this.down.bind(this)),window.addEventListener("mousemove",this.move.bind(this)),window.addEventListener("mouseup",this.up.bind(this)),t.addEventListener("touchstart",this.down.bind(this)),window.addEventListener("touchmove",this.move.bind(this),{passive:!1}),window.addEventListener("touchend",this.up.bind(this))}},{key:"getCoords",value:function(t){var n=t.touches?t.touches[0]:t;return[n.pageX,n.pageY]}},{key:"down",value:function(t){t.stopPropagation(),this.mouseStart=this.getCoords(t),this.onStart()}},{key:"move",value:function(t){if(this.mouseStart){t.preventDefault(),t.stopPropagation();var n=this.getCoords(t),e=s(n,2),r=e[0],o=e[1],i=[r-this.mouseStart[0],o-this.mouseStart[1]],a=this.el.getBoundingClientRect().width/this.el.offsetWidth;this.mouseStart=[r,o],this.onTranslate(i[0]/a,i[1]/a)}}},{key:"up",value:function(){this.mouseStart=null,this.onDrag()}}]),o}(),I=function(){function o(t,n,e,r){p(this,o),this.el=n,this.intensity=e,this.onzoom=r,this.distance=null,t.addEventListener("wheel",this.wheel.bind(this)),t.addEventListener("touchmove",this.move.bind(this)),t.addEventListener("touchend",this.end.bind(this)),t.addEventListener("touchcancel",this.end.bind(this))}return v(o,[{key:"wheel",value:function(t){t.preventDefault();var n=this.el.getBoundingClientRect(),e=(t.wheelDelta?t.wheelDelta/120:-t.deltaY/3)*this.intensity,r=(n.left-t.pageX)*e,o=(n.top-t.pageY)*e;this.onzoom(e,r,o)}},{key:"touches",value:function(t){var n=[t.touches[0].pageX,t.touches[0].pageY],e=n[0],r=n[1],o=[t.touches[1].pageX,t.touches[1].pageY],i=o[0],a=o[1];return{cx:(e+i)/2,cy:(r+a)/2,distance:Math.sqrt(Math.pow(e-i,2)+Math.pow(r-a,2))}}},{key:"move",value:function(t){if(!(t.touches.length<2)){var n=this.el.getBoundingClientRect(),e=this.touches(t),r=e.cx,o=e.cy,i=e.distance;if(null!==this.distance){var a=i/this.distance-1,u=(n.left-r)*a,c=(n.top-o)*a;this.onzoom(a,u,c)}this.distance=i}}},{key:"end",value:function(){this.distance=null}}]),o}(),Z=function(t){function o(t,n){if(p(this,o),!(n instanceof T))throw new TypeError('Value of argument "emitter" violates contract.\n\nExpected:\nEmitter\n\nGot:\n'+function n(e,r){void 0===r&&(r=0);r+=1;{if(null===e)return"null";if(void 0===e)return"void";if("string"==typeof e||"number"==typeof e||"boolean"==typeof e)return void 0===e?"undefined":u(e);if(Array.isArray(e)){if(0<e.length){if(4<r)return"[...]";var o=n(e[0],r);return e.every(function(t){return n(t,r)===o})?o.trim()+"[]":"["+e.slice(0,15).map(function(t){return n(t,r)}).join(", ")+(15<=e.length?", ...":"")+"]"}return"Array"}var t=Object.keys(e);if(!t.length)return e.constructor&&e.constructor.name&&"Object"!==e.constructor.name?e.constructor.name:"Object";if(4<r)return"{...}";var i=" ".repeat(r-1),a=t.slice(0,15).map(function(t){return(/^([A-Z_$][A-Z0-9_$]*)$/i.test(t)?t:JSON.stringify(t))+": "+n(e[t],r)+";"}).join("\n "+i);return 15<=t.length&&(a+="\n "+i+"..."),e.constructor&&e.constructor.name&&"Object"!==e.constructor.name?e.constructor.name+" {\n "+i+a+"\n"+i+"}":"{\n "+i+a+"\n"+i+"}"}}(n));var e=y(this,(o.__proto__||Object.getPrototypeOf(o)).call(this,n)),r=e.el=document.createElement("div");return e.container=t,e.transform={k:1,x:0,y:0},e.mouse=[0,0],r.style.transformOrigin="0 0",e._zoom=new I(t,r,.1,e.onZoom.bind(e)),e._drag=new $(t,e.onTranslate.bind(e)),e.container.addEventListener("mousemove",e.mousemove.bind(e)),e.update(),e}return m(o,T),v(o,[{key:"update",value:function(){var t=this.transform;this.el.style.transform="translate("+t.x+"px, "+t.y+"px) scale("+t.k+")"}},{key:"mousemove",value:function(t){var n=this.el.getBoundingClientRect(),e=t.clientX-n.left,r=t.clientY-n.top,o=this.transform.k;this.trigger("mousemove",{x:e/o,y:r/o})}},{key:"onTranslate",value:function(t,n){this.translate(this.transform.x+t,this.transform.y+n)}},{key:"onZoom",value:function(t,n,e){this.zoom(this.transform.k*(1+t),n,e),this.update()}},{key:"translate",value:function(t,n){var e={transform:this.transform,x:t,y:n};this.trigger("translate",e)&&(this.transform.x=e.x,this.transform.y=e.y,this.update(),this.trigger("translated"))}},{key:"zoom",value:function(t){var n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,e=2<arguments.length&&void 0!==arguments[2]?arguments[2]:0,r=this.transform.k,o={transform:this.transform,zoom:t};if(this.trigger("zoom",o)){var i=(r-o.zoom)/(r-t||1);this.transform.k=o.zoom||1,this.transform.x+=n*i,this.transform.y+=e*i,this.update(),this.trigger("zoomed")}}},{key:"appendChild",value:function(t){this.el.appendChild(t)}},{key:"removeChild",value:function(t){this.el.removeChild(t)}}]),o}();var J=function(t){function o(t,n,e){p(this,o);var r=y(this,(o.__proto__||Object.getPrototypeOf(o)).call(this,e));return r.trigger("rendercontrol",{el:t,control:n}),r}return m(o,T),o}(),D=function(t){function u(t,n,e,r,o){var i;p(this,u);var a=y(this,(u.__proto__||Object.getPrototypeOf(u)).call(this,o));return a.el=t,a.type=n,a.io=e,a.node=r,a.trigger("rendersocket",(c(i={el:t},n,a.io),c(i,"socket",e.socket),i)),a}return m(u,T),v(u,[{key:"getPosition",value:function(t){var n=t.position,e=this.el;return[n[0]+e.offsetLeft+e.offsetWidth/2,n[1]+e.offsetTop+e.offsetHeight/2]}}]),u}(),M=function(t){function o(t,n,e){p(this,o);var r=y(this,(o.__proto__||Object.getPrototypeOf(o)).call(this,e));return r.node=t,r.component=n,r.sockets=new Map,r.controls=new Map,r.el=document.createElement("div"),r.el.style.position="absolute",r.el.addEventListener("contextmenu",function(t){return r.trigger("contextmenu",{e:t,node:r.node})}),r.drag=new $(r.el,r.onTranslate.bind(r),r.onSelect.bind(r)),r.trigger("rendernode",{el:r.el,node:t,component:n.data,bindSocket:r.bindSocket.bind(r),bindControl:r.bindControl.bind(r)}),r.update(),r}return m(o,T),v(o,[{key:"bindSocket",value:function(t,n,e){if(!(t instanceof HTMLElement))throw new TypeError('Value of argument "el" violates contract.\n\nExpected:\nHTMLElement\n\nGot:\n'+z(t));if("string"!=typeof n)throw new TypeError('Value of argument "type" violates contract.\n\nExpected:\nstring\n\nGot:\n'+z(n));if(!(e instanceof f))throw new TypeError('Value of argument "io" violates contract.\n\nExpected:\nIO\n\nGot:\n'+z(e));this.sockets.set(e,new D(t,n,e,this.node,this))}},{key:"bindControl",value:function(t,n){if(!(t instanceof HTMLElement))throw new TypeError('Value of argument "el" violates contract.\n\nExpected:\nHTMLElement\n\nGot:\n'+z(t));if(!(n instanceof r))throw new TypeError('Value of argument "control" violates contract.\n\nExpected:\nControl\n\nGot:\n'+z(n));this.controls.set(n,new J(t,n,this))}},{key:"getSocketPosition",value:function(t){return this.sockets.get(t).getPosition(this.node)}},{key:"onSelect",value:function(){this.trigger("selectnode",this.node)}},{key:"onTranslate",value:function(t,n){var e=this.node,r=e.position[0]+t,o=e.position[1]+n;this.trigger("nodetranslate",{node:e,x:r,y:o})&&(this.translate(r,o),this.trigger("nodetranslated",{node:e}))}},{key:"translate",value:function(t,n){this.node.position[0]=t,this.node.position[1]=n,this.update()}},{key:"update",value:function(){this.el.style.transform="translate("+this.node.position[0]+"px, "+this.node.position[1]+"px)"}},{key:"remove",value:function(){}}]),o}();function z(n,e){if(void 0===e&&(e=0),e+=1,null===n)return"null";if(void 0===n)return"void";if("string"==typeof n||"number"==typeof n||"boolean"==typeof n)return void 0===n?"undefined":u(n);if(Array.isArray(n)){if(0<n.length){if(4<e)return"[...]";var r=z(n[0],e);return n.every(function(t){return z(t,e)===r})?r.trim()+"[]":"["+n.slice(0,15).map(function(t){return z(t,e)}).join(", ")+(15<=n.length?", ...":"")+"]"}return"Array"}var t=Object.keys(n);if(!t.length)return n.constructor&&n.constructor.name&&"Object"!==n.constructor.name?n.constructor.name:"Object";if(4<e)return"{...}";var o=" ".repeat(e-1),i=t.slice(0,15).map(function(t){return(/^([A-Z_$][A-Z0-9_$]*)$/i.test(t)?t:JSON.stringify(t))+": "+z(n[t],e)+";"}).join("\n "+o);return 15<=t.length&&(i+="\n "+o+"..."),n.constructor&&n.constructor.name&&"Object"!==n.constructor.name?n.constructor.name+" {\n "+o+i+"\n"+o+"}":"{\n "+o+i+"\n"+o+"}"}var H=function(t){function i(t,n,e,r){if(p(this,i),!(n instanceof M))throw new TypeError('Value of argument "inputNode" violates contract.\n\nExpected:\nViewNode\n\nGot:\n'+W(n));if(!(e instanceof M))throw new TypeError('Value of argument "outputNode" violates contract.\n\nExpected:\nViewNode\n\nGot:\n'+W(e));var o=y(this,(i.__proto__||Object.getPrototypeOf(i)).call(this,r));return o.connection=t,o.inputNode=n,o.outputNode=e,o.el=document.createElement("div"),o.el.style.position="absolute",o.el.style.zIndex="-1",o.update(),o}return m(i,T),v(i,[{key:"update",value:function(){var t=this.outputNode.getSocketPosition(this.connection.output),n=s(t,2),e=n[0],r=n[1],o=this.inputNode.getSocketPosition(this.connection.input),i=s(o,2),a=i[0],u=i[1];this.trigger("renderconnection",{el:this.el,connection:this.connection,x1:e,y1:r,x2:a,y2:u})}}]),i}();function W(n,e){if(void 0===e&&(e=0),e+=1,null===n)return"null";if(void 0===n)return"void";if("string"==typeof n||"number"==typeof n||"boolean"==typeof n)return void 0===n?"undefined":u(n);if(Array.isArray(n)){if(0<n.length){if(4<e)return"[...]";var r=W(n[0],e);return n.every(function(t){return W(t,e)===r})?r.trim()+"[]":"["+n.slice(0,15).map(function(t){return W(t,e)}).join(", ")+(15<=n.length?", ...":"")+"]"}return"Array"}var t=Object.keys(n);if(!t.length)return n.constructor&&n.constructor.name&&"Object"!==n.constructor.name?n.constructor.name:"Object";if(4<e)return"{...}";var o=" ".repeat(e-1),i=t.slice(0,15).map(function(t){return(/^([A-Z_$][A-Z0-9_$]*)$/i.test(t)?t:JSON.stringify(t))+": "+W(n[t],e)+";"}).join("\n "+o);return 15<=t.length&&(i+="\n "+o+"..."),n.constructor&&n.constructor.name&&"Object"!==n.constructor.name?n.constructor.name+" {\n "+o+i+"\n"+o+"}":"{\n "+o+i+"\n"+o+"}"}var Y=function(t){function o(t,n,e){if(p(this,o),!(t instanceof HTMLElement))throw new TypeError('Value of argument "container" violates contract.\n\nExpected:\nHTMLElement\n\nGot:\n'+F(t));if(!(n instanceof Object))throw new TypeError('Value of argument "components" violates contract.\n\nExpected:\nObject\n\nGot:\n'+F(n));if(!(e instanceof T))throw new TypeError('Value of argument "emitter" violates contract.\n\nExpected:\nEmitter\n\nGot:\n'+F(e));var r=y(this,(o.__proto__||Object.getPrototypeOf(o)).call(this,e));return r.container=t,r.components=n,r.container.style.overflow="hidden",r.nodes=new Map,r.connections=new Map,r.container.addEventListener("click",r.click.bind(r)),r.container.addEventListener("contextmenu",function(t){return r.trigger("contextmenu",{e:t,view:r})}),window.addEventListener("resize",r.resize.bind(r)),r.on("nodetranslated",r.updateConnections.bind(r)),r.area=new Z(t,r),r.container.appendChild(r.area.el),r}return m(o,T),v(o,[{key:"addNode",value:function(t){if(!(t instanceof E))throw new TypeError('Value of argument "node" violates contract.\n\nExpected:\nNode\n\nGot:\n'+F(t));var n=new M(t,this.components.get(t.name),this);this.nodes.set(t,n),this.area.appendChild(n.el)}},{key:"removeNode",value:function(t){if(!(t instanceof E))throw new TypeError('Value of argument "node" violates contract.\n\nExpected:\nNode\n\nGot:\n'+F(t));var n=this.nodes.get(t);this.nodes.delete(t),this.area.removeChild(n.el)}},{key:"addConnection",value:function(t){if(!(t instanceof a))throw new TypeError('Value of argument "connection" violates contract.\n\nExpected:\nConnection\n\nGot:\n'+F(t));var n=this.nodes.get(t.input.node),e=this.nodes.get(t.output.node),r=new H(t,n,e,this);this.connections.set(t,r),this.area.appendChild(r.el)}},{key:"removeConnection",value:function(t){if(!(t instanceof a))throw new TypeError('Value of argument "connection" violates contract.\n\nExpected:\nConnection\n\nGot:\n'+F(t));var n=this.connections.get(t);this.connections.delete(t),this.area.removeChild(n.el)}},{key:"updateConnections",value:function(t){var n=this;t.node.getConnections().map(function(t){n.connections.get(t).update()})}},{key:"resize",value:function(){var t=this.container,n=t.parentElement.clientWidth,e=t.parentElement.clientHeight;t.style.width=n+"px",t.style.height=e+"px"}},{key:"click",value:function(t){var n=this.container;n===t.target&&this.trigger("click",{e:t,container:n})}}]),o}();function F(n,e){if(void 0===e&&(e=0),e+=1,null===n)return"null";if(void 0===n)return"void";if("string"==typeof n||"number"==typeof n||"boolean"==typeof n)return void 0===n?"undefined":u(n);if(Array.isArray(n)){if(0<n.length){if(4<e)return"[...]";var r=F(n[0],e);return n.every(function(t){return F(t,e)===r})?r.trim()+"[]":"["+n.slice(0,15).map(function(t){return F(t,e)}).join(", ")+(15<=n.length?", ...":"")+"]"}return"Array"}var t=Object.keys(n);if(!t.length)return n.constructor&&n.constructor.name&&"Object"!==n.constructor.name?n.constructor.name:"Object";if(4<e)return"{...}";var o=" ".repeat(e-1),i=t.slice(0,15).map(function(t){return(/^([A-Z_$][A-Z0-9_$]*)$/i.test(t)?t:JSON.stringify(t))+": "+F(n[t],e)+";"}).join("\n "+o);return 15<=t.length&&(i+="\n "+o+"..."),n.constructor&&n.constructor.name&&"Object"!==n.constructor.name?n.constructor.name+" {\n "+o+i+"\n"+o+"}":"{\n "+o+i+"\n"+o+"}"}var X=function(){function t(){p(this,t),this.list=[]}return v(t,[{key:"add",value:function(t){var n=1<arguments.length&&void 0!==arguments[1]&&arguments[1];if(!(t instanceof E))throw new TypeError('Value of argument "item" violates contract.\n\nExpected:\nNode\n\nGot:\n'+function n(e,r){void 0===r&&(r=0);r+=1;{if(null===e)return"null";if(void 0===e)return"void";if("string"==typeof e||"number"==typeof e||"boolean"==typeof e)return void 0===e?"undefined":u(e);if(Array.isArray(e)){if(0<e.length){if(4<r)return"[...]";var o=n(e[0],r);return e.every(function(t){return n(t,r)===o})?o.trim()+"[]":"["+e.slice(0,15).map(function(t){return n(t,r)}).join(", ")+(15<=e.length?", ...":"")+"]"}return"Array"}var t=Object.keys(e);if(!t.length)return e.constructor&&e.constructor.name&&"Object"!==e.constructor.name?e.constructor.name:"Object";if(4<r)return"{...}";var i=" ".repeat(r-1),a=t.slice(0,15).map(function(t){return(/^([A-Z_$][A-Z0-9_$]*)$/i.test(t)?t:JSON.stringify(t))+": "+n(e[t],r)+";"}).join("\n "+i);return 15<=t.length&&(a+="\n "+i+"..."),e.constructor&&e.constructor.name&&"Object"!==e.constructor.name?e.constructor.name+" {\n "+i+a+"\n"+i+"}":"{\n "+i+a+"\n"+i+"}"}}(t));n?this.contains(t)?this.remove(t):this.list.push(t):this.list=[t]}},{key:"clear",value:function(){var n=this;this.each(function(t){n.remove(t)})}},{key:"remove",value:function(t){this.list.splice(this.list.indexOf(t),1)}},{key:"contains",value:function(t){return-1!==this.list.indexOf(t)}},{key:"each",value:function(t){this.list.forEach(t)}}]),t}();var n=function(t){function r(t,n){if(p(this,r),"string"!=typeof t)throw new TypeError('Value of argument "id" violates contract.\n\nExpected:\nstring\n\nGot:\n'+B(t));if(!(n instanceof HTMLElement))throw new TypeError('Value of argument "container" violates contract.\n\nExpected:\nHTMLElement\n\nGot:\n'+B(n));var e=y(this,(r.__proto__||Object.getPrototypeOf(r)).call(this,t,new R));return e.nodes=[],e.components=new Map,e.selected=new X,e.view=new Y(n,e.components,e),window.addEventListener("keydown",function(t){return e.trigger("keydown",t)}),window.addEventListener("keyup",function(t){return e.trigger("keyup",t)}),e.on("nodecreated",function(t){return e.getComponent(t.name).created(t)}),e.on("noderemoved",function(t){return e.getComponent(t.name).destroyed(t)}),e.on("selectnode",function(t){return e.selectNode(t)}),e}var n;return m(r,C),v(r,[{key:"addNode",value:function(t){if(!(t instanceof E))throw new TypeError('Value of argument "node" violates contract.\n\nExpected:\nNode\n\nGot:\n'+B(t));this.trigger("nodecreate",t)&&(this.nodes.push(t),this.view.addNode(t),this.trigger("nodecreated",t))}},{key:"removeNode",value:function(t){var n=this;if(!(t instanceof E))throw new TypeError('Value of argument "node" violates contract.\n\nExpected:\nNode\n\nGot:\n'+B(t));this.trigger("noderemove",t)&&(t.getConnections().forEach(function(t){return n.removeConnection(t)}),this.nodes.splice(this.nodes.indexOf(t),1),this.view.removeNode(t),this.trigger("noderemoved",t))}},{key:"connect",value:function(t,n){var e=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{};if(!(t instanceof o))throw new TypeError('Value of argument "output" violates contract.\n\nExpected:\nOutput\n\nGot:\n'+B(t));if(!(n instanceof i))throw new TypeError('Value of argument "input" violates contract.\n\nExpected:\nInput\n\nGot:\n'+B(n));if(this.trigger("connectioncreate",{output:t,input:n}))try{var r=t.connectTo(n);r.data=e,this.view.addConnection(r),this.trigger("connectioncreated",r)}catch(t){this.trigger("warn",t)}}},{key:"removeConnection",value:function(t){if(!(t instanceof a))throw new TypeError('Value of argument "connection" violates contract.\n\nExpected:\nConnection\n\nGot:\n'+B(t));this.trigger("connectionremove",t)&&(this.view.removeConnection(t),t.remove(),this.trigger("connectionremoved",t))}},{key:"selectNode",value:function(t){var n=1<arguments.length&&void 0!==arguments[1]&&arguments[1];if(!(t instanceof E))throw new TypeError('Value of argument "node" violates contract.\n\nExpected:\nNode\n\nGot:\n'+B(t));if("boolean"!=typeof n)throw new TypeError('Value of argument "accumulate" violates contract.\n\nExpected:\nboolean\n\nGot:\n'+B(n));if(-1===this.nodes.indexOf(t))throw new Error("Node not exist in list");this.trigger("nodeselect",t)&&(this.selected.add(t,n),this.trigger("nodeselected",t))}},{key:"getComponent",value:function(t){var n=this.components.get(t);if(!n)throw"Component "+t+" not found";return n}},{key:"register",value:function(t){if(!(t instanceof O))throw new TypeError('Value of argument "component" violates contract.\n\nExpected:\nComponent\n\nGot:\n'+B(t));(t.editor=this).components.set(t.name,t),this.trigger("componentregister",t)}},{key:"clear",value:function(){var n=this;[].concat(g(this.nodes)).map(function(t){return n.removeNode(t)})}},{key:"toJSON",value:function(){var n={id:this.id,nodes:{}};return this.nodes.forEach(function(t){return n.nodes[t.id]=t.toJSON()}),this.trigger("export",n),n}},{key:"beforeImport",value:function(t){if(!(t instanceof Object))throw new TypeError('Value of argument "json" violates contract.\n\nExpected:\nObject\n\nGot:\n'+B(t));var n=N.validate(this.id,t);return n.success?(this.silent=!0,this.clear(),this.trigger("import",t),!0):(this.trigger("warn",n.msg),!1)}},{key:"afterImport",value:function(){return!(this.silent=!1)}},{key:"fromJSON",value:(n=d(regeneratorRuntime.mark(function t(o){var u,c=this;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(o instanceof Object){t.next=2;break}throw new TypeError('Value of argument "json" violates contract.\n\nExpected:\nObject\n\nGot:\n'+B(o));case 2:if(this.beforeImport(o)){t.next=4;break}return t.abrupt("return",!1);case 4:return u={},t.prev=5,t.next=8,Promise.all(Object.keys(o.nodes).map(function(){var n=d(regeneratorRuntime.mark(function t(n){var e,r;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return e=o.nodes[n],r=c.getComponent(e.name),t.next=4,r.build(E.fromJSON(e));case 4:u[n]=t.sent,c.addNode(u[n]);case 6:case"end":return t.stop()}},t,c)}));return function(t){return n.apply(this,arguments)}}()));case 8:Object.keys(o.nodes).forEach(function(t){var n=o.nodes[t],a=u[t];Object.keys(n.outputs).forEach(function(i){n.outputs[i].connections.forEach(function(n){var t=n.node,e=n.data,r=a.outputs.find(function(t){return t.key===i}),o=u[t].inputs.find(function(t){return t.key===n.input});c.connect(r,o,e)})})}),t.next=15;break;case 11:return t.prev=11,t.t0=t.catch(5),this.trigger("warn",t.t0),t.abrupt("return",!this.afterImport());case 15:return t.prev=15,t.abrupt("return",this.afterImport());case 18:case"end":return t.stop()}},t,this,[[5,11,15,18]])})),function(t){return n.apply(this,arguments)})}]),r}();function B(n,e){if(void 0===e&&(e=0),e+=1,null===n)return"null";if(void 0===n)return"void";if("string"==typeof n||"number"==typeof n||"boolean"==typeof n)return void 0===n?"undefined":u(n);if(Array.isArray(n)){if(0<n.length){if(4<e)return"[...]";var r=B(n[0],e);return n.every(function(t){return B(t,e)===r})?r.trim()+"[]":"["+n.slice(0,15).map(function(t){return B(t,e)}).join(", ")+(15<=n.length?", ...":"")+"]"}return"Array"}var t=Object.keys(n);if(!t.length)return n.constructor&&n.constructor.name&&"Object"!==n.constructor.name?n.constructor.name:"Object";if(4<e)return"{...}";var o=" ".repeat(e-1),i=t.slice(0,15).map(function(t){return(/^([A-Z_$][A-Z0-9_$]*)$/i.test(t)?t:JSON.stringify(t))+": "+B(n[t],e)+";"}).join("\n "+o);return 15<=t.length&&(i+="\n "+o+"..."),n.constructor&&n.constructor.name&&"Object"!==n.constructor.name?n.constructor.name+" {\n "+o+i+"\n"+o+"}":"{\n "+o+i+"\n"+o+"}"}return{Component:O,Control:r,NodeEditor:n,Emitter:T,Engine:t,Input:i,Node:E,Output:o,Socket:l}});
//# sourceMappingURL=rete.min.js.map
{
"name": "rete",
"version": "1.0.0-alpha.5",
"version": "1.0.0-alpha.7",
"description": "JavaScript framework",
"main": "build/rete.js",
"main": "build/rete.min.js",
"types": "src/index.d.ts",
"scripts": {
"lint": "eslint src --fix",
"build": "rollup -c",
"build": "rete --build rete.config.js",
"build:dev": "rete --build rete.config.js --watch",
"prepublishOnly": "npm run lint && npm run build",

@@ -30,11 +31,3 @@ "test": "BABEL_ENV=test mocha --compilers js:babel-core/register"

"devDependencies": {
"babel-core": "^6.26.3",
"babel-eslint": "^8.2.3",
"babel-plugin-syntax-flow": "^6.18.0",
"babel-plugin-transform-flow-strip-types": "^6.22.0",
"babel-plugin-transform-object-rest-spread": "^6.26.0",
"babel-plugin-transform-regenerator": "^6.26.0",
"babel-plugin-typecheck": "^3.9.0",
"babel-preset-es2015": "^6.24.1",
"babel-preset-es2015-rollup": "^3.0.0",
"babel-register": "^6.26.0",

@@ -44,9 +37,8 @@ "eslint": "^4.19.1",

"mocha": "^5.2.0",
"rollup": "^0.56.5",
"rollup-copy-plugin": "0.0.1",
"rollup-plugin-babel": "^3.0.4",
"rollup-plugin-minify": "^1.0.3",
"rollup-plugin-multi-entry": "^2.0.2",
"rollup-plugin-regenerator": "^0.5.4"
"rete-cli": "^0.1.0",
"rollup-copy-plugin": "0.0.1"
},
"babel": {
"presets": ["env"]
}
}

@@ -16,3 +16,3 @@ import { Component } from './component';

super(id, new EditorEvents());
this.nodes = [];

@@ -149,10 +149,12 @@ this.components = new Map();

jsonNode.outputs.forEach((outputJson, i) => {
Object.keys(jsonNode.outputs).forEach(key => {
var outputJson = jsonNode.outputs[key];
outputJson.connections.forEach(jsonConnection => {
var nodeId = jsonConnection.node;
var data = jsonConnection.data;
var inputIndex = jsonConnection.input;
var targetInput = nodes[nodeId].inputs[inputIndex];
var targetOutput = node.outputs.find(o => o.key === key);
var targetInput = nodes[nodeId].inputs.find(i => i.key === jsonConnection.input);
this.connect(node.outputs[i], targetInput, data);
this.connect(targetOutput, targetInput, data);
});

@@ -159,0 +161,0 @@ });

@@ -6,3 +6,3 @@ import { Component } from './component';

var State = { AVALIABLE:0, PROCESSED: 1, ABORT: 2};
var State = { AVALIABLE:0, PROCESSED: 1, ABORT: 2 };

@@ -45,4 +45,4 @@ export { Component };

extractInputNodes(node, nodes) {
return node.inputs.reduce((a, inp) => {
return [...a, ...(inp.connections || []).reduce((b, c) => [...b, nodes[c.node]], [])]
return Object.keys(node.inputs).reduce((a, key) => {
return [...a, ...(node.inputs[key].connections || []).reduce((b, c) => [...b, nodes[c.node]], [])]
}, []);

@@ -132,3 +132,6 @@ }

async extractInputData(node) {
return await Promise.all(node.inputs.map(async (input) => {
const obj = {};
for (let key of Object.keys(node.inputs)) {
let input = node.inputs[key];
var conns = input.connections;

@@ -146,4 +149,6 @@ let connData = await Promise.all(conns.map(async (c) => {

return connData;
}));
obj[key] = connData;
}
return obj;
}

@@ -154,3 +159,3 @@

var component = this.components.find(c => c.name === node.name);
var outputData = node.outputs.map(() => null);
var outputData = {};

@@ -185,3 +190,5 @@ try {

return await Promise.all(node.outputs.map(async (output) => {
return await Promise.all(Object.keys(node.outputs).map(async (key) => {
const output = node.outputs[key];
return await Promise.all(output.connections.map(async (c) => {

@@ -188,0 +195,0 @@ const nextNode = this.data.nodes[c.node];

@@ -8,4 +8,4 @@ import { Connection } from './connection';

constructor(title: string, socket: Socket, multiConns: boolean = false) {
super(title, socket, multiConns);
constructor(key: string, title: string, socket: Socket, multiConns: boolean = false) {
super(key, title, socket, multiConns);
this.control = null;

@@ -38,3 +38,3 @@ }

node: c.output.node.id,
output: c.output.node.outputs.indexOf(c.output),
output: c.output.key,
data: c.data

@@ -41,0 +41,0 @@ };

@@ -5,3 +5,3 @@ import { Connection } from './connection';

constructor(name, socket, multiConns) {
constructor(key, name, socket, multiConns) {
this.node = null;

@@ -11,2 +11,3 @@ this.multipleConnections = multiConns;

this.key = key;
this.name = name;

@@ -13,0 +14,0 @@ this.socket = socket;

@@ -1,2 +0,1 @@

import { Component } from './component';
import { Control } from './control';

@@ -91,4 +90,4 @@ import { Input } from './input';

'data': this.data,
'inputs': this.inputs.map(input => input.toJSON()),
'outputs': this.outputs.map(output => output.toJSON()),
'inputs': this.inputs.reduce((obj, input) => (obj[input.key] = input.toJSON(), obj), {}),
'outputs': this.outputs.reduce((obj, output) => (obj[output.key] = output.toJSON(), obj), {}),
'position': this.position,

@@ -95,0 +94,0 @@ 'name': this.name

@@ -8,4 +8,4 @@ import { Connection } from './connection';

constructor(title: string, socket: Socket, multiConns: boolean = true) {
super(title, socket, multiConns);
constructor(key: string, title: string, socket: Socket, multiConns: boolean = true) {
super(key, title, socket, multiConns);
}

@@ -42,3 +42,3 @@

node: c.input.node.id,
input: c.input.node.inputs.indexOf(c.input),
input: c.input.key,
data: c.data

@@ -45,0 +45,0 @@ }

@@ -36,3 +36,3 @@ import { Drag } from './drag';

const k = this.transform.k;
this.trigger('mousemove', { x: x / k, y: y / k });

@@ -71,3 +71,3 @@ }

this.transform.k = params.zoom;
this.transform.k = params.zoom || 1;
this.transform.x += ox * d;

@@ -74,0 +74,0 @@ this.transform.y += oy * d;

@@ -53,3 +53,3 @@ export class Drag {

up(e) {
up() {
this.mouseStart = null;

@@ -56,0 +56,0 @@

@@ -18,5 +18,5 @@ export class Zoom {

e.preventDefault();
var rect = this.el.getBoundingClientRect();
var delta = e.wheelDelta / 120 * this.intensity;
var delta = (e.wheelDelta ? e.wheelDelta / 120 : - e.deltaY / 3) * this.intensity;

@@ -46,3 +46,3 @@ var ox = (rect.left - e.pageX) * delta;

let rect = this.el.getBoundingClientRect();
let {cx, cy, distance} = this.touches(e);
let { cx, cy, distance } = this.touches(e);

@@ -49,0 +49,0 @@ if (this.distance !== null) {

@@ -38,3 +38,3 @@ import './utils/domReady';

builder(node) {
node.addOutput(new Rete.Output('Name', socketNum))
node.addOutput(new Rete.Output('name', 'Name', socketNum))
}

@@ -52,3 +52,3 @@

builder(node) {
node.addInput(new Rete.Input('Name', socketNum));
node.addInput(new Rete.Input('name', 'Name', socketNum));
}

@@ -55,0 +55,0 @@

@@ -1,15 +0,14 @@

import { Socket } from '../src/socket';
import assert from 'assert';
describe('Socket', () => {
it('socket arguments', () => {
assert.throws(() => new Socket(), Error, 'null');
assert.throws(() => new Socket(345), Error, 'number');
assert.doesNotThrow(() => new Socket('valid name'), Error, 'valid string');
it('Socket arguments', () => {
assert.throws(() => new Rete.Socket(), Error, 'null');
assert.throws(() => new Rete.Socket(345), Error, 'number');
assert.doesNotThrow(() => new Rete.Socket('valid name'), Error, 'valid string');
});
it('compatible', () => {
var s1 = new Socket('name1');
var s2 = new Socket('name2');
var s3 = new Socket('name3');
var s1 = new Rete.Socket('name1');
var s2 = new Rete.Socket('name2');
var s3 = new Rete.Socket('name3');

@@ -16,0 +15,0 @@ assert.ok(s1.compatibleWith(s1));

@@ -1,2 +0,2 @@

import {JSDOM} from 'jsdom';
import { JSDOM } from 'jsdom';
const { window } = new JSDOM('<!DOCTYPE html><head></head><body><div id="Rete"></div></body>');

@@ -11,2 +11,2 @@ const { document } = window;

console.warn = function () {};
global.Rete = require('../../build/rete');
global.Rete = require('../../build/rete.min');

@@ -12,4 +12,4 @@ import { Validator } from '../src/core/validator';

assert.ok(!Validator.isValidData({id: 'demo@0.0.0', nodes: null, goups: {} }));
assert.ok(!Validator.isValidData({id: 'demo@0.0.0', nodes: [], goups: {} }), 'nodes array');
assert.ok(!Validator.isValidData({ id: 'demo@0.0.0', nodes: null, goups: {} }));
assert.ok(!Validator.isValidData({ id: 'demo@0.0.0', nodes: [], goups: {} }), 'nodes array');
});

@@ -16,0 +16,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc