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 2.0.0-beta.9 to 2.0.0-beta.10

69

_types/editor.d.ts
import { Scope } from './scope';
import { BaseSchemes } from './types';
/**
* Signal types produced by NodeEditor instance
* @typeParam Scheme - The scheme type
* @priority 10
* @group Primary
*/
export declare type Root<Scheme extends BaseSchemes> = {

@@ -34,2 +40,8 @@ type: 'nodecreate';

};
/**
* The NodeEditor class is the entry class. It is used to create and manage nodes and connections.
* @typeParam Scheme - The scheme type
* @priority 7
* @group Primary
*/
export declare class NodeEditor<Scheme extends BaseSchemes> extends Scope<Root<Scheme>> {

@@ -39,12 +51,69 @@ private nodes;

constructor();
/**
* Get a node by id
* @param id - The node id
* @returns The node or undefined
*/
getNode(id: Scheme['Node']['id']): Scheme["Node"];
/**
* Get all nodes
* @returns All nodes
*/
getNodes(): Scheme["Node"][];
/**
* Get all connections
* @returns All connections
*/
getConnections(): Scheme["Connection"][];
/**
* Get a connection by id
* @param id - The connection id
* @returns The connection or undefined
*/
getConnection(id: Scheme['Connection']['id']): Scheme["Connection"];
/**
* Add a node
* @param data - The node data
* @returns Whether the node was added
* @throws If the node has already been added
* @emits nodecreate
* @emits nodecreated
*/
addNode(data: Scheme['Node']): Promise<boolean>;
/**
* Add a connection
* @param data - The connection data
* @returns Whether the connection was added
* @throws If the connection has already been added
* @emits connectioncreate
* @emits connectioncreated
*/
addConnection(data: Scheme['Connection']): Promise<boolean>;
/**
* Remove a node
* @param id - The node id
* @returns Whether the node was removed
* @throws If the node cannot be found
* @emits noderemove
* @emits noderemoved
*/
removeNode(id: Scheme['Node']['id']): Promise<boolean>;
/**
* Remove a connection
* @param id - The connection id
* @returns Whether the connection was removed
* @throws If the connection cannot be found
* @emits connectionremove
* @emits connectionremoved
*/
removeConnection(id: Scheme['Connection']['id']): Promise<boolean>;
/**
* Clear all nodes and connections
* @returns Whether the editor was cleared
* @emits clear
* @emits clearcancelled
* @emits cleared
*/
clear(): Promise<boolean>;
}
//# sourceMappingURL=editor.d.ts.map

5

_types/index.d.ts
export * from './editor';
export * as ClassicPreset from './presets/classic';
export type { ScopeAsParameter } from './scope';
export * from './scope';
export type { NestedScope, Pipe, ScopeAsParameter } from './scope';
export { Scope, Signal } from './scope';
export * from './types';
export * from './utility-types';
export * from './utils';
//# sourceMappingURL=index.d.ts.map

@@ -0,3 +1,11 @@

/**
* Contains classes for classic scheme such as Node, Input, Output, Control, Socket, Connection
* @module
* @group Primary
*/
import { ConnectionBase, NodeBase } from '../types';
declare type PortId = string;
/**
* The socket class
*/
export declare class Socket {

@@ -7,2 +15,5 @@ name: string;

}
/**
* General port class
*/
export declare class Port<S extends Socket> {

@@ -16,2 +27,5 @@ socket: S;

}
/**
* The input port class
*/
export declare class Input<S extends Socket> extends Port<S> {

@@ -23,5 +37,11 @@ control: Control | null;

}
/**
* The output port class
*/
export declare class Output<S extends Socket> extends Port<S> {
constructor(socket: S, label?: string, multipleConnections?: boolean);
}
/**
* General control class
*/
export declare class Control {

@@ -37,2 +57,6 @@ id: string;

};
/**
* The input control class
* @example new InputControl('text', { readonly: true, initial: 'hello' })
*/
export declare class InputControl<T extends 'text' | 'number', N = T extends 'text' ? string : number> extends Control {

@@ -46,2 +70,9 @@ type: T;

}
/**
* The node class
* @typeParam Inputs - The inputs type
* @typeParam Outputs - The outputs type
* @typeParam Controls - The controls type
* @example new Node('math')
*/
export declare class Node<Inputs extends {

@@ -48,0 +79,0 @@ [key in string]?: Socket;

import { CanAssignSignal, GetAssignmentReferences, Tail } from './utility-types';
/**
* A middleware type that can modify the data
* @typeParam T - The data type
* @param data - The data to be modified
* @returns The modified data or undefined
* @example (data) => data + 1
* @example (data) => undefined // will stop the execution
* @internal
*/
export declare type Pipe<T> = (data: T) => Promise<undefined | T> | undefined | T;

@@ -10,2 +19,3 @@ export declare type CanAssignEach<D extends any[], F extends any[]> = D extends [infer H1, ...infer Tail1] ? (F extends [infer H2, ...infer Tail2] ? [

* Validate the Scope signals and replace the parameter type with an error message if they are not assignable
* @internal
*/

@@ -16,2 +26,3 @@ export declare type NestedScope<S extends Scope<any, any[]>, Current extends any[]> = (CanAssignEach<Current, S['__scope']['parents']>[number] extends true ? S : 'Parent signals do not satisfy the connected scope. Please use `.debug($ => $) for detailed assignment error');

* @example .debug($ => $)
* @internal
*/

@@ -21,2 +32,7 @@ export declare function useHelper<S extends Scope<any, any[]>, Signals>(): {

};
/**
* A signal is a middleware chain that can be used to modify the data
* @typeParam T - The data type
* @internal
*/
export declare class Signal<T> {

@@ -30,2 +46,5 @@ pipes: Pipe<T>[];

} | (abstract new (...args: any[]) => T);
/**
* Base class for all plugins and the core. Provides a signals mechanism to modify the data
*/
export declare class Scope<Produces, Parents extends unknown[] = []> {

@@ -32,0 +51,0 @@ name: string;

@@ -0,6 +1,21 @@

/**
* Node id type
*/
export declare type NodeId = string;
/**
* Connection id type
* @group Primary
*/
export declare type ConnectionId = string;
/**
* The base node type
* @group Primary
*/
export declare type NodeBase = {
id: NodeId;
};
/**
* The base connection type
* @group Primary
*/
export declare type ConnectionBase = {

@@ -11,2 +26,7 @@ id: ConnectionId;

};
/**
* Get the schemes
* @example GetSchemes<Node & { myProp: number }, Connection>
* @group Primary
*/
export declare type GetSchemes<NodeData extends NodeBase, ConnectionData extends ConnectionBase> = {

@@ -16,3 +36,7 @@ Node: NodeData;

};
/**
* The base schemes
* @group Primary
*/
export declare type BaseSchemes = GetSchemes<NodeBase, ConnectionBase>;
//# sourceMappingURL=types.d.ts.map

3

_types/utils.d.ts

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

/**
* @returns A unique id
*/
export declare function getUID(): string;
//# sourceMappingURL=utils.d.ts.map
{
"name": "rete",
"version": "2.0.0-beta.9",
"version": "2.0.0-beta.10",
"description": "JavaScript framework",

@@ -5,0 +5,0 @@ "author": "Vitaliy Stoliarov",

/*!
* rete v2.0.0-beta.9
* rete v2.0.0-beta.10
* (c) 2023 Vitaliy Stoliarov

@@ -38,3 +38,14 @@ * Released under the MIT license.

/**
* A middleware type that can modify the data
* @typeParam T - The data type
* @param data - The data to be modified
* @returns The modified data or undefined
* @example (data) => data + 1
* @example (data) => undefined // will stop the execution
* @internal
*/
/**
* Validate the Scope signals and replace the parameter type with an error message if they are not assignable
* @internal
*/

@@ -45,2 +56,3 @@

* @example .debug($ => $)
* @internal
*/

@@ -53,2 +65,8 @@ function useHelper() {

}
/**
* A signal is a middleware chain that can be used to modify the data
* @typeParam T - The data type
* @internal
*/
var Signal = /*#__PURE__*/function () {

@@ -121,2 +139,5 @@ function Signal() {

}();
/**
* Base class for all plugins and the core. Provides a signals mechanism to modify the data
*/
var Scope = /*#__PURE__*/function () {

@@ -177,2 +198,16 @@ // Parents['length'] extends 0 ? undefined : Scope<Parents[0], Tail<Parents>>

function _isNativeReflectConstruct$1() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
/**
* Signal types produced by NodeEditor instance
* @typeParam Scheme - The scheme type
* @priority 10
* @group Primary
*/
/**
* The NodeEditor class is the entry class. It is used to create and manage nodes and connections.
* @typeParam Scheme - The scheme type
* @priority 7
* @group Primary
*/
var NodeEditor = /*#__PURE__*/function (_Scope) {

@@ -189,2 +224,8 @@ _inherits__default["default"](NodeEditor, _Scope);

}
/**
* Get a node by id
* @param id - The node id
* @returns The node or undefined
*/
_createClass__default["default"](NodeEditor, [{

@@ -197,2 +238,7 @@ key: "getNode",

}
/**
* Get all nodes
* @returns All nodes
*/
}, {

@@ -203,2 +249,7 @@ key: "getNodes",

}
/**
* Get all connections
* @returns All connections
*/
}, {

@@ -209,2 +260,8 @@ key: "getConnections",

}
/**
* Get a connection by id
* @param id - The connection id
* @returns The connection or undefined
*/
}, {

@@ -217,2 +274,11 @@ key: "getConnection",

}
/**
* Add a node
* @param data - The node data
* @returns Whether the node was added
* @throws If the node has already been added
* @emits nodecreate
* @emits nodecreated
*/
}, {

@@ -262,2 +328,10 @@ key: "addNode",

}()
/**
* Add a connection
* @param data - The connection data
* @returns Whether the connection was added
* @throws If the connection has already been added
* @emits connectioncreate
* @emits connectioncreated
*/
}, {

@@ -307,2 +381,10 @@ key: "addConnection",

}()
/**
* Remove a node
* @param id - The node id
* @returns Whether the node was removed
* @throws If the node cannot be found
* @emits noderemove
* @emits noderemoved
*/
}, {

@@ -357,2 +439,10 @@ key: "removeNode",

}()
/**
* Remove a connection
* @param id - The connection id
* @returns Whether the connection was removed
* @throws If the connection cannot be found
* @emits connectionremove
* @emits connectionremoved
*/
}, {

@@ -407,2 +497,9 @@ key: "removeConnection",

}()
/**
* Clear all nodes and connections
* @returns Whether the editor was cleared
* @emits clear
* @emits clearcancelled
* @emits cleared
*/
}, {

@@ -507,2 +604,6 @@ key: "clear",

var crypto = globalThis.crypto;
/**
* @returns A unique id
*/
function getUID() {

@@ -522,2 +623,5 @@ if ('randomBytes' in crypto) {

function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
/**
* The socket class
*/
var Socket = /*#__PURE__*/_createClass__default["default"](function Socket(name) {

@@ -527,2 +631,6 @@ _classCallCheck__default["default"](this, Socket);

});
/**
* General port class
*/
var Port = /*#__PURE__*/_createClass__default["default"](function Port(socket, label, multipleConnections) {

@@ -535,2 +643,6 @@ _classCallCheck__default["default"](this, Port);

});
/**
* The input port class
*/
var Input = /*#__PURE__*/function (_Port) {

@@ -564,2 +676,6 @@ _inherits__default["default"](Input, _Port);

}(Port);
/**
* The output port class
*/
var Output = /*#__PURE__*/function (_Port2) {

@@ -574,2 +690,6 @@ _inherits__default["default"](Output, _Port2);

}(Port);
/**
* General control class
*/
var Control = /*#__PURE__*/_createClass__default["default"](function Control() {

@@ -579,2 +699,6 @@ _classCallCheck__default["default"](this, Control);

});
/**
* The input control class
* @example new InputControl('text', { readonly: true, initial: 'hello' })
*/
var InputControl = /*#__PURE__*/function (_Control) {

@@ -604,2 +728,10 @@ _inherits__default["default"](InputControl, _Control);

}(Control);
/**
* The node class
* @typeParam Inputs - The inputs type
* @typeParam Outputs - The outputs type
* @typeParam Controls - The controls type
* @example new Node('math')
*/
var Node = /*#__PURE__*/function () {

@@ -709,3 +841,2 @@ function Node(label) {

exports.getUID = getUID;
exports.useHelper = useHelper;
//# sourceMappingURL=rete.common.js.map
/*!
* rete v2.0.0-beta.9
* rete v2.0.0-beta.10
* (c) 2023 Vitaliy Stoliarov

@@ -22,3 +22,14 @@ * Released under the MIT license.

/**
* A middleware type that can modify the data
* @typeParam T - The data type
* @param data - The data to be modified
* @returns The modified data or undefined
* @example (data) => data + 1
* @example (data) => undefined // will stop the execution
* @internal
*/
/**
* Validate the Scope signals and replace the parameter type with an error message if they are not assignable
* @internal
*/

@@ -29,2 +40,3 @@

* @example .debug($ => $)
* @internal
*/

@@ -37,2 +49,8 @@ function useHelper() {

}
/**
* A signal is a middleware chain that can be used to modify the data
* @typeParam T - The data type
* @internal
*/
var Signal = /*#__PURE__*/function () {

@@ -105,2 +123,5 @@ function Signal() {

}();
/**
* Base class for all plugins and the core. Provides a signals mechanism to modify the data
*/
var Scope = /*#__PURE__*/function () {

@@ -161,2 +182,16 @@ // Parents['length'] extends 0 ? undefined : Scope<Parents[0], Tail<Parents>>

function _isNativeReflectConstruct$1() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
/**
* Signal types produced by NodeEditor instance
* @typeParam Scheme - The scheme type
* @priority 10
* @group Primary
*/
/**
* The NodeEditor class is the entry class. It is used to create and manage nodes and connections.
* @typeParam Scheme - The scheme type
* @priority 7
* @group Primary
*/
var NodeEditor = /*#__PURE__*/function (_Scope) {

@@ -173,2 +208,8 @@ _inherits(NodeEditor, _Scope);

}
/**
* Get a node by id
* @param id - The node id
* @returns The node or undefined
*/
_createClass(NodeEditor, [{

@@ -181,2 +222,7 @@ key: "getNode",

}
/**
* Get all nodes
* @returns All nodes
*/
}, {

@@ -187,2 +233,7 @@ key: "getNodes",

}
/**
* Get all connections
* @returns All connections
*/
}, {

@@ -193,2 +244,8 @@ key: "getConnections",

}
/**
* Get a connection by id
* @param id - The connection id
* @returns The connection or undefined
*/
}, {

@@ -201,2 +258,11 @@ key: "getConnection",

}
/**
* Add a node
* @param data - The node data
* @returns Whether the node was added
* @throws If the node has already been added
* @emits nodecreate
* @emits nodecreated
*/
}, {

@@ -246,2 +312,10 @@ key: "addNode",

}()
/**
* Add a connection
* @param data - The connection data
* @returns Whether the connection was added
* @throws If the connection has already been added
* @emits connectioncreate
* @emits connectioncreated
*/
}, {

@@ -291,2 +365,10 @@ key: "addConnection",

}()
/**
* Remove a node
* @param id - The node id
* @returns Whether the node was removed
* @throws If the node cannot be found
* @emits noderemove
* @emits noderemoved
*/
}, {

@@ -341,2 +423,10 @@ key: "removeNode",

}()
/**
* Remove a connection
* @param id - The connection id
* @returns Whether the connection was removed
* @throws If the connection cannot be found
* @emits connectionremove
* @emits connectionremoved
*/
}, {

@@ -391,2 +481,9 @@ key: "removeConnection",

}()
/**
* Clear all nodes and connections
* @returns Whether the editor was cleared
* @emits clear
* @emits clearcancelled
* @emits cleared
*/
}, {

@@ -491,2 +588,6 @@ key: "clear",

var crypto = globalThis.crypto;
/**
* @returns A unique id
*/
function getUID() {

@@ -506,2 +607,5 @@ if ('randomBytes' in crypto) {

function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
/**
* The socket class
*/
var Socket = /*#__PURE__*/_createClass(function Socket(name) {

@@ -511,2 +615,6 @@ _classCallCheck(this, Socket);

});
/**
* General port class
*/
var Port = /*#__PURE__*/_createClass(function Port(socket, label, multipleConnections) {

@@ -519,2 +627,6 @@ _classCallCheck(this, Port);

});
/**
* The input port class
*/
var Input = /*#__PURE__*/function (_Port) {

@@ -548,2 +660,6 @@ _inherits(Input, _Port);

}(Port);
/**
* The output port class
*/
var Output = /*#__PURE__*/function (_Port2) {

@@ -558,2 +674,6 @@ _inherits(Output, _Port2);

}(Port);
/**
* General control class
*/
var Control = /*#__PURE__*/_createClass(function Control() {

@@ -563,2 +683,6 @@ _classCallCheck(this, Control);

});
/**
* The input control class
* @example new InputControl('text', { readonly: true, initial: 'hello' })
*/
var InputControl = /*#__PURE__*/function (_Control) {

@@ -588,2 +712,10 @@ _inherits(InputControl, _Control);

}(Control);
/**
* The node class
* @typeParam Inputs - The inputs type
* @typeParam Outputs - The outputs type
* @typeParam Controls - The controls type
* @example new Node('math')
*/
var Node = /*#__PURE__*/function () {

@@ -688,3 +820,3 @@ function Node(label) {

export { classic as ClassicPreset, NodeEditor, Scope, Signal, getUID, useHelper };
export { classic as ClassicPreset, NodeEditor, Scope, Signal, getUID };
//# sourceMappingURL=rete.esm.js.map
/*!
* rete v2.0.0-beta.9
* rete v2.0.0-beta.10
* (c) 2023 Vitaliy Stoliarov
* Released under the MIT license.
* */
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).Rete={})}(this,(function(t){"use strict";function e(){e=function(){return t};var t={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(t,e,n){t[e]=n.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",u=i.asyncIterator||"@@asyncIterator",c=i.toStringTag||"@@toStringTag";function s(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{s({},"")}catch(t){s=function(t,e,n){return t[e]=n}}function f(t,e,n,r){var i=e&&e.prototype instanceof p?e:p,a=Object.create(i.prototype),u=new P(r||[]);return o(a,"_invoke",{value:k(t,n,u)}),a}function l(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}t.wrap=f;var h={};function p(){}function d(){}function y(){}var v={};s(v,a,(function(){return this}));var b=Object.getPrototypeOf,m=b&&b(b(S([])));m&&m!==n&&r.call(m,a)&&(v=m);var w=y.prototype=p.prototype=Object.create(v);function g(t){["next","throw","return"].forEach((function(e){s(t,e,(function(t){return this._invoke(e,t)}))}))}function x(t,e){function n(o,i,a,u){var c=l(t[o],t,i);if("throw"!==c.type){var s=c.arg,f=s.value;return f&&"object"==typeof f&&r.call(f,"__await")?e.resolve(f.__await).then((function(t){n("next",t,a,u)}),(function(t){n("throw",t,a,u)})):e.resolve(f).then((function(t){s.value=t,a(s)}),(function(t){return n("throw",t,a,u)}))}u(c.arg)}var i;o(this,"_invoke",{value:function(t,r){function o(){return new e((function(e,o){n(t,r,e,o)}))}return i=i?i.then(o,o):o()}})}function k(t,e,n){var r="suspendedStart";return function(o,i){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===o)throw i;return _()}for(n.method=o,n.arg=i;;){var a=n.delegate;if(a){var u=O(a,n);if(u){if(u===h)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var c=l(t,e,n);if("normal"===c.type){if(r=n.done?"completed":"suspendedYield",c.arg===h)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(r="completed",n.method="throw",n.arg=c.arg)}}}function O(t,e){var n=e.method,r=t.iterator[n];if(void 0===r)return e.delegate=null,"throw"===n&&t.iterator.return&&(e.method="return",e.arg=void 0,O(t,e),"throw"===e.method)||"return"!==n&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+n+"' method")),h;var o=l(r,t.iterator,e.arg);if("throw"===o.type)return e.method="throw",e.arg=o.arg,e.delegate=null,h;var i=o.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,h):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,h)}function E(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function j(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function P(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(E,this),this.reset(!0)}function S(t){if(t){var e=t[a];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,o=function e(){for(;++n<t.length;)if(r.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return o.next=o}}return{next:_}}function _(){return{value:void 0,done:!0}}return d.prototype=y,o(w,"constructor",{value:y,configurable:!0}),o(y,"constructor",{value:d,configurable:!0}),d.displayName=s(y,c,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===d||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,y):(t.__proto__=y,s(t,c,"GeneratorFunction")),t.prototype=Object.create(w),t},t.awrap=function(t){return{__await:t}},g(x.prototype),s(x.prototype,u,(function(){return this})),t.AsyncIterator=x,t.async=function(e,n,r,o,i){void 0===i&&(i=Promise);var a=new x(f(e,n,r,o),i);return t.isGeneratorFunction(n)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},g(w),s(w,c,"Generator"),s(w,a,(function(){return this})),s(w,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=Object(t),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},t.values=S,P.prototype={constructor:P,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(j),!t)for(var e in this)"t"===e.charAt(0)&&r.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(n,r){return a.type="throw",a.arg=t,e.next=n,r&&(e.method="next",e.arg=void 0),!!r}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var u=r.call(i,"catchLoc"),c=r.call(i,"finallyLoc");if(u&&c){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(u){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,h):this.complete(a)},complete:function(t,e){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&&e&&(this.next=e),h},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),j(n),h}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var o=r.arg;j(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:S(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),h}},t}function n(t,e,n,r,o,i,a){try{var u=t[i](a),c=u.value}catch(t){return void n(t)}u.done?e(c):Promise.resolve(c).then(r,o)}function r(t){return function(){var e=this,r=arguments;return new Promise((function(o,i){var a=t.apply(e,r);function u(t){n(a,o,i,u,c,"next",t)}function c(t){n(a,o,i,u,c,"throw",t)}u(void 0)}))}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,y(r.key),r)}}function a(t,e,n){return e&&i(t.prototype,e),n&&i(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function u(t,e,n){return(e=y(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function c(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&f(t,e)}function s(t){return s=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},s(t)}function f(t,e){return f=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},f(t,e)}function l(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function h(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=s(t);if(e){var o=s(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return function(t,e){if(e&&("object"==typeof e||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return l(t)}(this,n)}}function p(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function d(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return p(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?p(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,u=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==n.return||n.return()}finally{if(u)throw i}}}}function y(t){var e=function(t,e){if("object"!=typeof t||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:String(e)}function v(){return{debug:function(t){}}}var b=function(){function t(){o(this,t),u(this,"pipes",[])}var n;return a(t,[{key:"addPipe",value:function(t){this.pipes.push(t)}},{key:"emit",value:(n=r(e().mark((function t(n){var r,o,i,a;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:r=n,o=d(this.pipes),t.prev=2,o.s();case 4:if((i=o.n()).done){t.next=13;break}return a=i.value,t.next=8,a(r);case 8:if(void 0!==(r=t.sent)){t.next=11;break}return t.abrupt("return");case 11:t.next=4;break;case 13:t.next=18;break;case 15:t.prev=15,t.t0=t.catch(2),o.e(t.t0);case 18:return t.prev=18,o.f(),t.finish(18);case 21:return t.abrupt("return",r);case 22:case"end":return t.stop()}}),t,this,[[2,15,18,21]])}))),function(t){return n.apply(this,arguments)})}]),t}(),m=function(){function t(e){o(this,t),u(this,"signal",new b),this.name=e}return a(t,[{key:"addPipe",value:function(t){this.signal.addPipe(t)}},{key:"use",value:function(e){if(!(e instanceof t))throw new Error("cannot use non-Scope instance");return e.setParent(this),this.addPipe((function(t){return e.signal.emit(t)})),{debug:function(t){}}}},{key:"setParent",value:function(t){this.parent=t}},{key:"emit",value:function(t){return this.signal.emit(t)}},{key:"hasParent",value:function(){return Boolean(this.parent)}},{key:"parentScope",value:function(t){if(!this.parent)throw new Error("cannot find parent");if(t&&this.parent instanceof t)return this.parent;if(t)throw new Error("actual parent is not instance of type");return this.parent}}]),t}(),w=function(t){c(v,t);var n,i,s,f,p,y=h(v);function v(){var t;return o(this,v),u(l(t=y.call(this,"NodeEditor")),"nodes",[]),u(l(t),"connections",[]),t}return a(v,[{key:"getNode",value:function(t){return this.nodes.find((function(e){return e.id===t}))}},{key:"getNodes",value:function(){return this.nodes}},{key:"getConnections",value:function(){return this.connections}},{key:"getConnection",value:function(t){return this.connections.find((function(e){return e.id===t}))}},{key:"addNode",value:(p=r(e().mark((function t(n){return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!this.getNode(n.id)){t.next=2;break}throw new Error("node has already been added");case 2:return t.next=4,this.emit({type:"nodecreate",data:n});case 4:if(t.sent){t.next=6;break}return t.abrupt("return",!1);case 6:return this.nodes.push(n),t.next=9,this.emit({type:"nodecreated",data:n});case 9:return t.abrupt("return",!0);case 10:case"end":return t.stop()}}),t,this)}))),function(t){return p.apply(this,arguments)})},{key:"addConnection",value:(f=r(e().mark((function t(n){return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!this.getConnection(n.id)){t.next=2;break}throw new Error("connection has already been added");case 2:return t.next=4,this.emit({type:"connectioncreate",data:n});case 4:if(t.sent){t.next=6;break}return t.abrupt("return",!1);case 6:return this.connections.push(n),t.next=9,this.emit({type:"connectioncreated",data:n});case 9:return t.abrupt("return",!0);case 10:case"end":return t.stop()}}),t,this)}))),function(t){return f.apply(this,arguments)})},{key:"removeNode",value:(s=r(e().mark((function t(n){var r,o;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r=this.nodes.findIndex((function(t){return t.id===n})),o=this.nodes[r],!(r<0)){t.next=4;break}throw new Error("cannot find node");case 4:return t.next=6,this.emit({type:"noderemove",data:o});case 6:if(t.sent){t.next=8;break}return t.abrupt("return",!1);case 8:return this.nodes.splice(r,1),t.next=11,this.emit({type:"noderemoved",data:o});case 11:return t.abrupt("return",!0);case 12:case"end":return t.stop()}}),t,this)}))),function(t){return s.apply(this,arguments)})},{key:"removeConnection",value:(i=r(e().mark((function t(n){var r,o;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r=this.connections.findIndex((function(t){return t.id===n})),o=this.connections[r],!(r<0)){t.next=4;break}throw new Error("cannot find connection");case 4:return t.next=6,this.emit({type:"connectionremove",data:o});case 6:if(t.sent){t.next=8;break}return t.abrupt("return",!1);case 8:return this.connections.splice(r,1),t.next=11,this.emit({type:"connectionremoved",data:o});case 11:return t.abrupt("return",!0);case 12:case"end":return t.stop()}}),t,this)}))),function(t){return i.apply(this,arguments)})},{key:"clear",value:(n=r(e().mark((function t(){var n,r,o,i,a,u;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.emit({type:"clear"});case 2:if(t.sent){t.next=6;break}return t.next=5,this.emit({type:"clearcancelled"});case 5:return t.abrupt("return",!1);case 6:n=d(this.connections.slice()),t.prev=7,n.s();case 9:if((r=n.n()).done){t.next=15;break}return o=r.value,t.next=13,this.removeConnection(o.id);case 13:t.next=9;break;case 15:t.next=20;break;case 17:t.prev=17,t.t0=t.catch(7),n.e(t.t0);case 20:return t.prev=20,n.f(),t.finish(20);case 23:i=d(this.nodes.slice()),t.prev=24,i.s();case 26:if((a=i.n()).done){t.next=32;break}return u=a.value,t.next=30,this.removeNode(u.id);case 30:t.next=26;break;case 32:t.next=37;break;case 34:t.prev=34,t.t1=t.catch(24),i.e(t.t1);case 37:return t.prev=37,i.f(),t.finish(37);case 40:return t.next=42,this.emit({type:"cleared"});case 42:return t.abrupt("return",!0);case 43:case"end":return t.stop()}}),t,this,[[7,17,20,23],[24,34,37,40]])}))),function(){return n.apply(this,arguments)})}]),v}(m),g=globalThis.crypto;function x(){if("randomBytes"in g)return g.randomBytes(8).toString("hex");var t=g.getRandomValues(new Uint8Array(8));return Array.from(t).map((function(t){return t.toString(16).padStart(2,"0")})).join("")}var k=a((function t(e){o(this,t),this.name=e})),O=a((function t(e,n,r){o(this,t),this.socket=e,this.label=n,this.multipleConnections=r,this.id=x()})),E=function(t){c(n,t);var e=h(n);function n(){var t;o(this,n);for(var r=arguments.length,i=new Array(r),a=0;a<r;a++)i[a]=arguments[a];return u(l(t=e.call.apply(e,[this].concat(i))),"control",null),u(l(t),"showControl",!0),t}return a(n,[{key:"addControl",value:function(t){if(this.control)throw new Error("control already added for this input");this.control=t}},{key:"removeControl",value:function(){this.control=null}}]),n}(O),j=function(t){c(n,t);var e=h(n);function n(t,r,i){return o(this,n),e.call(this,t,r,!1!==i)}return a(n)}(O),P=a((function t(){o(this,t),this.id=x()})),S=function(t){c(n,t);var e=h(n);function n(t,r){var i;return o(this,n),(i=e.call(this)).type=t,i.options=r,i.id=x(),i.readonly=null==r?void 0:r.readonly,void 0!==(null==r?void 0:r.initial)&&(i.value=r.initial),i}return a(n,[{key:"setValue",value:function(t){var e;this.value=t,null!==(e=this.options)&&void 0!==e&&e.change&&this.options.change(t)}}]),n}(P),_=function(){function t(e){o(this,t),u(this,"inputs",{}),u(this,"outputs",{}),u(this,"controls",{}),this.label=e,this.id=x()}return a(t,[{key:"hasInput",value:function(t){return Object.prototype.hasOwnProperty.call(this.inputs,t)}},{key:"addInput",value:function(t,e){if(this.hasInput(t))throw new Error("input with key '".concat(String(t),"' already added"));Object.defineProperty(this.inputs,t,{value:e,enumerable:!0,configurable:!0})}},{key:"removeInput",value:function(t){delete this.inputs[t]}},{key:"hasOutput",value:function(t){return Object.prototype.hasOwnProperty.call(this.outputs,t)}},{key:"addOutput",value:function(t,e){if(this.hasOutput(t))throw new Error("output with key '".concat(String(t),"' already added"));Object.defineProperty(this.outputs,t,{value:e,enumerable:!0,configurable:!0})}},{key:"removeOutput",value:function(t){delete this.outputs[t]}},{key:"hasControl",value:function(t){return Object.prototype.hasOwnProperty.call(this.controls,t)}},{key:"addControl",value:function(t,e){if(this.hasControl(t))throw new Error("control with key '".concat(String(t),"' already added"));Object.defineProperty(this.controls,t,{value:e,enumerable:!0,configurable:!0})}},{key:"removeControl",value:function(t){delete this.controls[t]}}]),t}(),L=a((function t(e,n,r,i){if(o(this,t),this.sourceOutput=n,this.targetInput=i,!e.outputs[n])throw new Error("source node doesn't have output with a key ".concat(String(n)));if(!r.inputs[i])throw new Error("target node doesn't have input with a key ".concat(String(i)));this.id=x(),this.source=e.id,this.target=r.id})),C=Object.freeze({__proto__:null,Socket:k,Port:O,Input:E,Output:j,Control:P,InputControl:S,Node:_,Connection:L});t.ClassicPreset=C,t.NodeEditor=w,t.Scope=m,t.Signal=b,t.getUID=x,t.useHelper=v,Object.defineProperty(t,"__esModule",{value:!0})}));
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).Rete={})}(this,(function(t){"use strict";function e(){e=function(){return t};var t={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(t,e,n){t[e]=n.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",u=i.asyncIterator||"@@asyncIterator",c=i.toStringTag||"@@toStringTag";function s(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{s({},"")}catch(t){s=function(t,e,n){return t[e]=n}}function f(t,e,n,r){var i=e&&e.prototype instanceof p?e:p,a=Object.create(i.prototype),u=new P(r||[]);return o(a,"_invoke",{value:k(t,n,u)}),a}function l(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}t.wrap=f;var h={};function p(){}function d(){}function y(){}var v={};s(v,a,(function(){return this}));var b=Object.getPrototypeOf,m=b&&b(b(S([])));m&&m!==n&&r.call(m,a)&&(v=m);var w=y.prototype=p.prototype=Object.create(v);function g(t){["next","throw","return"].forEach((function(e){s(t,e,(function(t){return this._invoke(e,t)}))}))}function x(t,e){function n(o,i,a,u){var c=l(t[o],t,i);if("throw"!==c.type){var s=c.arg,f=s.value;return f&&"object"==typeof f&&r.call(f,"__await")?e.resolve(f.__await).then((function(t){n("next",t,a,u)}),(function(t){n("throw",t,a,u)})):e.resolve(f).then((function(t){s.value=t,a(s)}),(function(t){return n("throw",t,a,u)}))}u(c.arg)}var i;o(this,"_invoke",{value:function(t,r){function o(){return new e((function(e,o){n(t,r,e,o)}))}return i=i?i.then(o,o):o()}})}function k(t,e,n){var r="suspendedStart";return function(o,i){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===o)throw i;return _()}for(n.method=o,n.arg=i;;){var a=n.delegate;if(a){var u=O(a,n);if(u){if(u===h)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var c=l(t,e,n);if("normal"===c.type){if(r=n.done?"completed":"suspendedYield",c.arg===h)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(r="completed",n.method="throw",n.arg=c.arg)}}}function O(t,e){var n=e.method,r=t.iterator[n];if(void 0===r)return e.delegate=null,"throw"===n&&t.iterator.return&&(e.method="return",e.arg=void 0,O(t,e),"throw"===e.method)||"return"!==n&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+n+"' method")),h;var o=l(r,t.iterator,e.arg);if("throw"===o.type)return e.method="throw",e.arg=o.arg,e.delegate=null,h;var i=o.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,h):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,h)}function E(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function j(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function P(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(E,this),this.reset(!0)}function S(t){if(t){var e=t[a];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,o=function e(){for(;++n<t.length;)if(r.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return o.next=o}}return{next:_}}function _(){return{value:void 0,done:!0}}return d.prototype=y,o(w,"constructor",{value:y,configurable:!0}),o(y,"constructor",{value:d,configurable:!0}),d.displayName=s(y,c,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===d||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,y):(t.__proto__=y,s(t,c,"GeneratorFunction")),t.prototype=Object.create(w),t},t.awrap=function(t){return{__await:t}},g(x.prototype),s(x.prototype,u,(function(){return this})),t.AsyncIterator=x,t.async=function(e,n,r,o,i){void 0===i&&(i=Promise);var a=new x(f(e,n,r,o),i);return t.isGeneratorFunction(n)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},g(w),s(w,c,"Generator"),s(w,a,(function(){return this})),s(w,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=Object(t),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},t.values=S,P.prototype={constructor:P,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(j),!t)for(var e in this)"t"===e.charAt(0)&&r.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(n,r){return a.type="throw",a.arg=t,e.next=n,r&&(e.method="next",e.arg=void 0),!!r}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var u=r.call(i,"catchLoc"),c=r.call(i,"finallyLoc");if(u&&c){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(u){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,h):this.complete(a)},complete:function(t,e){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&&e&&(this.next=e),h},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),j(n),h}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var o=r.arg;j(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:S(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),h}},t}function n(t,e,n,r,o,i,a){try{var u=t[i](a),c=u.value}catch(t){return void n(t)}u.done?e(c):Promise.resolve(c).then(r,o)}function r(t){return function(){var e=this,r=arguments;return new Promise((function(o,i){var a=t.apply(e,r);function u(t){n(a,o,i,u,c,"next",t)}function c(t){n(a,o,i,u,c,"throw",t)}u(void 0)}))}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,y(r.key),r)}}function a(t,e,n){return e&&i(t.prototype,e),n&&i(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function u(t,e,n){return(e=y(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function c(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&f(t,e)}function s(t){return s=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},s(t)}function f(t,e){return f=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},f(t,e)}function l(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function h(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=s(t);if(e){var o=s(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return function(t,e){if(e&&("object"==typeof e||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return l(t)}(this,n)}}function p(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function d(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return p(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?p(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,u=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==n.return||n.return()}finally{if(u)throw i}}}}function y(t){var e=function(t,e){if("object"!=typeof t||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:String(e)}var v=function(){function t(){o(this,t),u(this,"pipes",[])}var n;return a(t,[{key:"addPipe",value:function(t){this.pipes.push(t)}},{key:"emit",value:(n=r(e().mark((function t(n){var r,o,i,a;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:r=n,o=d(this.pipes),t.prev=2,o.s();case 4:if((i=o.n()).done){t.next=13;break}return a=i.value,t.next=8,a(r);case 8:if(void 0!==(r=t.sent)){t.next=11;break}return t.abrupt("return");case 11:t.next=4;break;case 13:t.next=18;break;case 15:t.prev=15,t.t0=t.catch(2),o.e(t.t0);case 18:return t.prev=18,o.f(),t.finish(18);case 21:return t.abrupt("return",r);case 22:case"end":return t.stop()}}),t,this,[[2,15,18,21]])}))),function(t){return n.apply(this,arguments)})}]),t}(),b=function(){function t(e){o(this,t),u(this,"signal",new v),this.name=e}return a(t,[{key:"addPipe",value:function(t){this.signal.addPipe(t)}},{key:"use",value:function(e){if(!(e instanceof t))throw new Error("cannot use non-Scope instance");return e.setParent(this),this.addPipe((function(t){return e.signal.emit(t)})),{debug:function(t){}}}},{key:"setParent",value:function(t){this.parent=t}},{key:"emit",value:function(t){return this.signal.emit(t)}},{key:"hasParent",value:function(){return Boolean(this.parent)}},{key:"parentScope",value:function(t){if(!this.parent)throw new Error("cannot find parent");if(t&&this.parent instanceof t)return this.parent;if(t)throw new Error("actual parent is not instance of type");return this.parent}}]),t}(),m=function(t){c(v,t);var n,i,s,f,p,y=h(v);function v(){var t;return o(this,v),u(l(t=y.call(this,"NodeEditor")),"nodes",[]),u(l(t),"connections",[]),t}return a(v,[{key:"getNode",value:function(t){return this.nodes.find((function(e){return e.id===t}))}},{key:"getNodes",value:function(){return this.nodes}},{key:"getConnections",value:function(){return this.connections}},{key:"getConnection",value:function(t){return this.connections.find((function(e){return e.id===t}))}},{key:"addNode",value:(p=r(e().mark((function t(n){return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!this.getNode(n.id)){t.next=2;break}throw new Error("node has already been added");case 2:return t.next=4,this.emit({type:"nodecreate",data:n});case 4:if(t.sent){t.next=6;break}return t.abrupt("return",!1);case 6:return this.nodes.push(n),t.next=9,this.emit({type:"nodecreated",data:n});case 9:return t.abrupt("return",!0);case 10:case"end":return t.stop()}}),t,this)}))),function(t){return p.apply(this,arguments)})},{key:"addConnection",value:(f=r(e().mark((function t(n){return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!this.getConnection(n.id)){t.next=2;break}throw new Error("connection has already been added");case 2:return t.next=4,this.emit({type:"connectioncreate",data:n});case 4:if(t.sent){t.next=6;break}return t.abrupt("return",!1);case 6:return this.connections.push(n),t.next=9,this.emit({type:"connectioncreated",data:n});case 9:return t.abrupt("return",!0);case 10:case"end":return t.stop()}}),t,this)}))),function(t){return f.apply(this,arguments)})},{key:"removeNode",value:(s=r(e().mark((function t(n){var r,o;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r=this.nodes.findIndex((function(t){return t.id===n})),o=this.nodes[r],!(r<0)){t.next=4;break}throw new Error("cannot find node");case 4:return t.next=6,this.emit({type:"noderemove",data:o});case 6:if(t.sent){t.next=8;break}return t.abrupt("return",!1);case 8:return this.nodes.splice(r,1),t.next=11,this.emit({type:"noderemoved",data:o});case 11:return t.abrupt("return",!0);case 12:case"end":return t.stop()}}),t,this)}))),function(t){return s.apply(this,arguments)})},{key:"removeConnection",value:(i=r(e().mark((function t(n){var r,o;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r=this.connections.findIndex((function(t){return t.id===n})),o=this.connections[r],!(r<0)){t.next=4;break}throw new Error("cannot find connection");case 4:return t.next=6,this.emit({type:"connectionremove",data:o});case 6:if(t.sent){t.next=8;break}return t.abrupt("return",!1);case 8:return this.connections.splice(r,1),t.next=11,this.emit({type:"connectionremoved",data:o});case 11:return t.abrupt("return",!0);case 12:case"end":return t.stop()}}),t,this)}))),function(t){return i.apply(this,arguments)})},{key:"clear",value:(n=r(e().mark((function t(){var n,r,o,i,a,u;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.emit({type:"clear"});case 2:if(t.sent){t.next=6;break}return t.next=5,this.emit({type:"clearcancelled"});case 5:return t.abrupt("return",!1);case 6:n=d(this.connections.slice()),t.prev=7,n.s();case 9:if((r=n.n()).done){t.next=15;break}return o=r.value,t.next=13,this.removeConnection(o.id);case 13:t.next=9;break;case 15:t.next=20;break;case 17:t.prev=17,t.t0=t.catch(7),n.e(t.t0);case 20:return t.prev=20,n.f(),t.finish(20);case 23:i=d(this.nodes.slice()),t.prev=24,i.s();case 26:if((a=i.n()).done){t.next=32;break}return u=a.value,t.next=30,this.removeNode(u.id);case 30:t.next=26;break;case 32:t.next=37;break;case 34:t.prev=34,t.t1=t.catch(24),i.e(t.t1);case 37:return t.prev=37,i.f(),t.finish(37);case 40:return t.next=42,this.emit({type:"cleared"});case 42:return t.abrupt("return",!0);case 43:case"end":return t.stop()}}),t,this,[[7,17,20,23],[24,34,37,40]])}))),function(){return n.apply(this,arguments)})}]),v}(b),w=globalThis.crypto;function g(){if("randomBytes"in w)return w.randomBytes(8).toString("hex");var t=w.getRandomValues(new Uint8Array(8));return Array.from(t).map((function(t){return t.toString(16).padStart(2,"0")})).join("")}var x=a((function t(e){o(this,t),this.name=e})),k=a((function t(e,n,r){o(this,t),this.socket=e,this.label=n,this.multipleConnections=r,this.id=g()})),O=function(t){c(n,t);var e=h(n);function n(){var t;o(this,n);for(var r=arguments.length,i=new Array(r),a=0;a<r;a++)i[a]=arguments[a];return u(l(t=e.call.apply(e,[this].concat(i))),"control",null),u(l(t),"showControl",!0),t}return a(n,[{key:"addControl",value:function(t){if(this.control)throw new Error("control already added for this input");this.control=t}},{key:"removeControl",value:function(){this.control=null}}]),n}(k),E=function(t){c(n,t);var e=h(n);function n(t,r,i){return o(this,n),e.call(this,t,r,!1!==i)}return a(n)}(k),j=a((function t(){o(this,t),this.id=g()})),P=function(t){c(n,t);var e=h(n);function n(t,r){var i;return o(this,n),(i=e.call(this)).type=t,i.options=r,i.id=g(),i.readonly=null==r?void 0:r.readonly,void 0!==(null==r?void 0:r.initial)&&(i.value=r.initial),i}return a(n,[{key:"setValue",value:function(t){var e;this.value=t,null!==(e=this.options)&&void 0!==e&&e.change&&this.options.change(t)}}]),n}(j),S=function(){function t(e){o(this,t),u(this,"inputs",{}),u(this,"outputs",{}),u(this,"controls",{}),this.label=e,this.id=g()}return a(t,[{key:"hasInput",value:function(t){return Object.prototype.hasOwnProperty.call(this.inputs,t)}},{key:"addInput",value:function(t,e){if(this.hasInput(t))throw new Error("input with key '".concat(String(t),"' already added"));Object.defineProperty(this.inputs,t,{value:e,enumerable:!0,configurable:!0})}},{key:"removeInput",value:function(t){delete this.inputs[t]}},{key:"hasOutput",value:function(t){return Object.prototype.hasOwnProperty.call(this.outputs,t)}},{key:"addOutput",value:function(t,e){if(this.hasOutput(t))throw new Error("output with key '".concat(String(t),"' already added"));Object.defineProperty(this.outputs,t,{value:e,enumerable:!0,configurable:!0})}},{key:"removeOutput",value:function(t){delete this.outputs[t]}},{key:"hasControl",value:function(t){return Object.prototype.hasOwnProperty.call(this.controls,t)}},{key:"addControl",value:function(t,e){if(this.hasControl(t))throw new Error("control with key '".concat(String(t),"' already added"));Object.defineProperty(this.controls,t,{value:e,enumerable:!0,configurable:!0})}},{key:"removeControl",value:function(t){delete this.controls[t]}}]),t}(),_=a((function t(e,n,r,i){if(o(this,t),this.sourceOutput=n,this.targetInput=i,!e.outputs[n])throw new Error("source node doesn't have output with a key ".concat(String(n)));if(!r.inputs[i])throw new Error("target node doesn't have input with a key ".concat(String(i)));this.id=g(),this.source=e.id,this.target=r.id})),L=Object.freeze({__proto__:null,Socket:x,Port:k,Input:O,Output:E,Control:j,InputControl:P,Node:S,Connection:_});t.ClassicPreset=L,t.NodeEditor=m,t.Scope=b,t.Signal=v,t.getUID=g,Object.defineProperty(t,"__esModule",{value:!0})}));
//# sourceMappingURL=rete.min.js.map

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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