Comparing version 2.0.3 to 2.0.4
@@ -0,1 +1,8 @@ | ||
## [2.0.4](https://github.com/retejs/rete/compare/v2.0.3...v2.0.4) (2024-08-30) | ||
### Bug Fixes | ||
* update cli and fix linting errors ([d219f95](https://github.com/retejs/rete/commit/d219f95cb0d46f79e8d7f5d70e4afcd578f35455)) | ||
## [2.0.3](https://github.com/retejs/rete/compare/v2.0.2...v2.0.3) (2024-01-27) | ||
@@ -2,0 +9,0 @@ |
{ | ||
"name": "rete", | ||
"version": "2.0.3", | ||
"version": "2.0.4", | ||
"description": "JavaScript framework", | ||
@@ -5,0 +5,0 @@ "author": "Vitaliy Stoliarov", |
/*! | ||
* rete v2.0.2 | ||
* rete v2.0.3 | ||
* (c) 2024 Vitaliy Stoliarov | ||
@@ -13,6 +13,5 @@ * Released under the MIT license. | ||
var _createClass = require('@babel/runtime/helpers/createClass'); | ||
var _assertThisInitialized = require('@babel/runtime/helpers/assertThisInitialized'); | ||
var _inherits = require('@babel/runtime/helpers/inherits'); | ||
var _possibleConstructorReturn = require('@babel/runtime/helpers/possibleConstructorReturn'); | ||
var _getPrototypeOf = require('@babel/runtime/helpers/getPrototypeOf'); | ||
var _inherits = require('@babel/runtime/helpers/inherits'); | ||
var _defineProperty = require('@babel/runtime/helpers/defineProperty'); | ||
@@ -26,12 +25,12 @@ var _regeneratorRuntime = require('@babel/runtime/regenerator'); | ||
var _createClass__default = /*#__PURE__*/_interopDefaultLegacy(_createClass); | ||
var _assertThisInitialized__default = /*#__PURE__*/_interopDefaultLegacy(_assertThisInitialized); | ||
var _inherits__default = /*#__PURE__*/_interopDefaultLegacy(_inherits); | ||
var _possibleConstructorReturn__default = /*#__PURE__*/_interopDefaultLegacy(_possibleConstructorReturn); | ||
var _getPrototypeOf__default = /*#__PURE__*/_interopDefaultLegacy(_getPrototypeOf); | ||
var _inherits__default = /*#__PURE__*/_interopDefaultLegacy(_inherits); | ||
var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty); | ||
var _regeneratorRuntime__default = /*#__PURE__*/_interopDefaultLegacy(_regeneratorRuntime); | ||
function _createForOfIteratorHelper$1(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray$1(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } 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 normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; } | ||
function _unsupportedIterableToArray$1(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray$1(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$1(o, minLen); } | ||
function _arrayLikeToArray$1(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; } | ||
function _createForOfIteratorHelper$1(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray$1(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } 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 o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; } | ||
function _unsupportedIterableToArray$1(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray$1(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray$1(r, a) : void 0; } } | ||
function _arrayLikeToArray$1(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; } | ||
/* eslint-disable @typescript-eslint/no-explicit-any */ | ||
/* eslint-disable @typescript-eslint/naming-convention */ | ||
@@ -61,3 +60,4 @@ | ||
return { | ||
debug: function debug(f) { | ||
debug: function debug(_f) { | ||
/* placeholder */ | ||
} | ||
@@ -77,3 +77,3 @@ }; | ||
} | ||
_createClass__default["default"](Signal, [{ | ||
return _createClass__default["default"](Signal, [{ | ||
key: "addPipe", | ||
@@ -86,3 +86,3 @@ value: function addPipe(pipe) { | ||
value: function () { | ||
var _emit = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee(context) { | ||
var _emit = _asyncToGenerator__default["default"](/*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee(context) { | ||
var current, _iterator, _step, pipe; | ||
@@ -139,3 +139,2 @@ return _regeneratorRuntime__default["default"].wrap(function _callee$(_context) { | ||
}]); | ||
return Signal; | ||
}(); | ||
@@ -153,3 +152,3 @@ /** | ||
} | ||
_createClass__default["default"](Scope, [{ | ||
return _createClass__default["default"](Scope, [{ | ||
key: "addPipe", | ||
@@ -193,10 +192,9 @@ value: function addPipe(middleware) { | ||
}]); | ||
return Scope; | ||
}(); | ||
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } 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 normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; } | ||
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } | ||
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; } | ||
function _createSuper$1(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$1(); return function _createSuperInternal() { var Super = _getPrototypeOf__default["default"](Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf__default["default"](this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn__default["default"](this, result); }; } | ||
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; } } | ||
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } 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 o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; } | ||
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } } | ||
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; } | ||
function _callSuper$1(t, o, e) { return o = _getPrototypeOf__default["default"](o), _possibleConstructorReturn__default["default"](t, _isNativeReflectConstruct$1() ? Reflect.construct(o, e || [], _getPrototypeOf__default["default"](t).constructor) : o.apply(t, e)); } | ||
function _isNativeReflectConstruct$1() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct$1 = function _isNativeReflectConstruct() { return !!t; })(); } | ||
@@ -217,10 +215,8 @@ /** | ||
var NodeEditor = /*#__PURE__*/function (_Scope) { | ||
_inherits__default["default"](NodeEditor, _Scope); | ||
var _super = _createSuper$1(NodeEditor); | ||
function NodeEditor() { | ||
var _this; | ||
_classCallCheck__default["default"](this, NodeEditor); | ||
_this = _super.call(this, 'NodeEditor'); | ||
_defineProperty__default["default"](_assertThisInitialized__default["default"](_this), "nodes", []); | ||
_defineProperty__default["default"](_assertThisInitialized__default["default"](_this), "connections", []); | ||
_this = _callSuper$1(this, NodeEditor, ['NodeEditor']); | ||
_defineProperty__default["default"](_this, "nodes", []); | ||
_defineProperty__default["default"](_this, "connections", []); | ||
return _this; | ||
@@ -234,3 +230,4 @@ } | ||
*/ | ||
_createClass__default["default"](NodeEditor, [{ | ||
_inherits__default["default"](NodeEditor, _Scope); | ||
return _createClass__default["default"](NodeEditor, [{ | ||
key: "getNode", | ||
@@ -286,4 +283,4 @@ value: function getNode(id) { | ||
key: "addNode", | ||
value: function () { | ||
var _addNode = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee(data) { | ||
value: (function () { | ||
var _addNode = _asyncToGenerator__default["default"](/*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee(data) { | ||
return _regeneratorRuntime__default["default"].wrap(function _callee$(_context) { | ||
@@ -337,6 +334,7 @@ while (1) switch (_context.prev = _context.next) { | ||
*/ | ||
) | ||
}, { | ||
key: "addConnection", | ||
value: function () { | ||
var _addConnection = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee2(data) { | ||
value: (function () { | ||
var _addConnection = _asyncToGenerator__default["default"](/*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee2(data) { | ||
return _regeneratorRuntime__default["default"].wrap(function _callee2$(_context2) { | ||
@@ -390,6 +388,7 @@ while (1) switch (_context2.prev = _context2.next) { | ||
*/ | ||
) | ||
}, { | ||
key: "removeNode", | ||
value: function () { | ||
var _removeNode = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee3(id) { | ||
value: (function () { | ||
var _removeNode = _asyncToGenerator__default["default"](/*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee3(id) { | ||
var index, node; | ||
@@ -448,6 +447,7 @@ return _regeneratorRuntime__default["default"].wrap(function _callee3$(_context3) { | ||
*/ | ||
) | ||
}, { | ||
key: "removeConnection", | ||
value: function () { | ||
var _removeConnection = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee4(id) { | ||
value: (function () { | ||
var _removeConnection = _asyncToGenerator__default["default"](/*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee4(id) { | ||
var index, connection; | ||
@@ -505,6 +505,7 @@ return _regeneratorRuntime__default["default"].wrap(function _callee4$(_context4) { | ||
*/ | ||
) | ||
}, { | ||
key: "clear", | ||
value: function () { | ||
var _clear = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee5() { | ||
value: (function () { | ||
var _clear = _asyncToGenerator__default["default"](/*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee5() { | ||
var _iterator, _step, connection, _iterator2, _step2, node; | ||
@@ -598,8 +599,6 @@ return _regeneratorRuntime__default["default"].wrap(function _callee5$(_context5) { | ||
return clear; | ||
}() | ||
}()) | ||
}]); | ||
return NodeEditor; | ||
}(Scope); | ||
/* global globalThis*/ | ||
var crypto = globalThis.crypto; | ||
@@ -622,4 +621,4 @@ | ||
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf__default["default"](Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf__default["default"](this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn__default["default"](this, result); }; } | ||
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; } } | ||
function _callSuper(t, o, e) { return o = _getPrototypeOf__default["default"](o), _possibleConstructorReturn__default["default"](t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf__default["default"](t).constructor) : o.apply(t, e)); } | ||
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } | ||
/** | ||
@@ -670,4 +669,2 @@ * The socket class | ||
var Input = /*#__PURE__*/function (_Port) { | ||
_inherits__default["default"](Input, _Port); | ||
var _super = _createSuper(Input); | ||
/** | ||
@@ -682,11 +679,11 @@ * @constructor | ||
_classCallCheck__default["default"](this, Input); | ||
_this = _super.call(this, socket, label, multipleConnections); | ||
_this = _callSuper(this, Input, [socket, label, multipleConnections]); | ||
/** | ||
* Control instance | ||
*/ | ||
_defineProperty__default["default"](_assertThisInitialized__default["default"](_this), "control", null); | ||
_defineProperty__default["default"](_this, "control", null); | ||
/** | ||
* Whether the control is visible. Can be managed dynamically by extensions. Default is `true` | ||
*/ | ||
_defineProperty__default["default"](_assertThisInitialized__default["default"](_this), "showControl", true); | ||
_defineProperty__default["default"](_this, "showControl", true); | ||
_this.socket = socket; | ||
@@ -702,3 +699,4 @@ _this.label = label; | ||
*/ | ||
_createClass__default["default"](Input, [{ | ||
_inherits__default["default"](Input, _Port); | ||
return _createClass__default["default"](Input, [{ | ||
key: "addControl", | ||
@@ -719,3 +717,2 @@ value: function addControl(control) { | ||
}]); | ||
return Input; | ||
}(Port); | ||
@@ -728,4 +725,2 @@ | ||
var Output = /*#__PURE__*/function (_Port2) { | ||
_inherits__default["default"](Output, _Port2); | ||
var _super2 = _createSuper(Output); | ||
/** | ||
@@ -739,4 +734,5 @@ * @constructor | ||
_classCallCheck__default["default"](this, Output); | ||
return _super2.call(this, socket, label, multipleConnections !== false); | ||
return _callSuper(this, Output, [socket, label, multipleConnections !== false]); | ||
} | ||
_inherits__default["default"](Output, _Port2); | ||
return _createClass__default["default"](Output); | ||
@@ -772,4 +768,2 @@ }(Port); | ||
var InputControl = /*#__PURE__*/function (_Control) { | ||
_inherits__default["default"](InputControl, _Control); | ||
var _super3 = _createSuper(InputControl); | ||
/** | ||
@@ -781,9 +775,10 @@ * @constructor | ||
function InputControl(type, options) { | ||
var _options$readonly; | ||
var _this2; | ||
_classCallCheck__default["default"](this, InputControl); | ||
_this2 = _super3.call(this); | ||
_this2 = _callSuper(this, InputControl); | ||
_this2.type = type; | ||
_this2.options = options; | ||
_this2.id = getUID(); | ||
_this2.readonly = options === null || options === void 0 ? void 0 : options.readonly; | ||
_this2.readonly = (_options$readonly = options === null || options === void 0 ? void 0 : options.readonly) !== null && _options$readonly !== void 0 ? _options$readonly : false; | ||
if (typeof (options === null || options === void 0 ? void 0 : options.initial) !== 'undefined') _this2.value = options.initial; | ||
@@ -797,3 +792,4 @@ return _this2; | ||
*/ | ||
_createClass__default["default"](InputControl, [{ | ||
_inherits__default["default"](InputControl, _Control); | ||
return _createClass__default["default"](InputControl, [{ | ||
key: "setValue", | ||
@@ -806,3 +802,2 @@ value: function setValue(value) { | ||
}]); | ||
return InputControl; | ||
}(Control); | ||
@@ -840,3 +835,3 @@ | ||
} | ||
_createClass__default["default"](Node, [{ | ||
return _createClass__default["default"](Node, [{ | ||
key: "hasInput", | ||
@@ -902,3 +897,2 @@ value: function hasInput(key) { | ||
}]); | ||
return Node; | ||
}(); | ||
@@ -905,0 +899,0 @@ |
107
rete.esm.js
/*! | ||
* rete v2.0.2 | ||
* rete v2.0.3 | ||
* (c) 2024 Vitaliy Stoliarov | ||
@@ -9,12 +9,12 @@ * Released under the MIT license. | ||
import _createClass from '@babel/runtime/helpers/createClass'; | ||
import _assertThisInitialized from '@babel/runtime/helpers/assertThisInitialized'; | ||
import _inherits from '@babel/runtime/helpers/inherits'; | ||
import _possibleConstructorReturn from '@babel/runtime/helpers/possibleConstructorReturn'; | ||
import _getPrototypeOf from '@babel/runtime/helpers/getPrototypeOf'; | ||
import _inherits from '@babel/runtime/helpers/inherits'; | ||
import _defineProperty from '@babel/runtime/helpers/defineProperty'; | ||
import _regeneratorRuntime from '@babel/runtime/regenerator'; | ||
function _createForOfIteratorHelper$1(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray$1(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } 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 normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; } | ||
function _unsupportedIterableToArray$1(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray$1(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$1(o, minLen); } | ||
function _arrayLikeToArray$1(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; } | ||
function _createForOfIteratorHelper$1(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray$1(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } 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 o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; } | ||
function _unsupportedIterableToArray$1(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray$1(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray$1(r, a) : void 0; } } | ||
function _arrayLikeToArray$1(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; } | ||
/* eslint-disable @typescript-eslint/no-explicit-any */ | ||
/* eslint-disable @typescript-eslint/naming-convention */ | ||
@@ -44,3 +44,4 @@ | ||
return { | ||
debug: function debug(f) { | ||
debug: function debug(_f) { | ||
/* placeholder */ | ||
} | ||
@@ -60,3 +61,3 @@ }; | ||
} | ||
_createClass(Signal, [{ | ||
return _createClass(Signal, [{ | ||
key: "addPipe", | ||
@@ -69,3 +70,3 @@ value: function addPipe(pipe) { | ||
value: function () { | ||
var _emit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(context) { | ||
var _emit = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(context) { | ||
var current, _iterator, _step, pipe; | ||
@@ -122,3 +123,2 @@ return _regeneratorRuntime.wrap(function _callee$(_context) { | ||
}]); | ||
return Signal; | ||
}(); | ||
@@ -136,3 +136,3 @@ /** | ||
} | ||
_createClass(Scope, [{ | ||
return _createClass(Scope, [{ | ||
key: "addPipe", | ||
@@ -176,10 +176,9 @@ value: function addPipe(middleware) { | ||
}]); | ||
return Scope; | ||
}(); | ||
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } 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 normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; } | ||
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } | ||
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; } | ||
function _createSuper$1(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$1(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } | ||
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; } } | ||
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } 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 o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; } | ||
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } } | ||
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; } | ||
function _callSuper$1(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct$1() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); } | ||
function _isNativeReflectConstruct$1() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct$1 = function _isNativeReflectConstruct() { return !!t; })(); } | ||
@@ -200,10 +199,8 @@ /** | ||
var NodeEditor = /*#__PURE__*/function (_Scope) { | ||
_inherits(NodeEditor, _Scope); | ||
var _super = _createSuper$1(NodeEditor); | ||
function NodeEditor() { | ||
var _this; | ||
_classCallCheck(this, NodeEditor); | ||
_this = _super.call(this, 'NodeEditor'); | ||
_defineProperty(_assertThisInitialized(_this), "nodes", []); | ||
_defineProperty(_assertThisInitialized(_this), "connections", []); | ||
_this = _callSuper$1(this, NodeEditor, ['NodeEditor']); | ||
_defineProperty(_this, "nodes", []); | ||
_defineProperty(_this, "connections", []); | ||
return _this; | ||
@@ -217,3 +214,4 @@ } | ||
*/ | ||
_createClass(NodeEditor, [{ | ||
_inherits(NodeEditor, _Scope); | ||
return _createClass(NodeEditor, [{ | ||
key: "getNode", | ||
@@ -269,4 +267,4 @@ value: function getNode(id) { | ||
key: "addNode", | ||
value: function () { | ||
var _addNode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(data) { | ||
value: (function () { | ||
var _addNode = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(data) { | ||
return _regeneratorRuntime.wrap(function _callee$(_context) { | ||
@@ -320,6 +318,7 @@ while (1) switch (_context.prev = _context.next) { | ||
*/ | ||
) | ||
}, { | ||
key: "addConnection", | ||
value: function () { | ||
var _addConnection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(data) { | ||
value: (function () { | ||
var _addConnection = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(data) { | ||
return _regeneratorRuntime.wrap(function _callee2$(_context2) { | ||
@@ -373,6 +372,7 @@ while (1) switch (_context2.prev = _context2.next) { | ||
*/ | ||
) | ||
}, { | ||
key: "removeNode", | ||
value: function () { | ||
var _removeNode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(id) { | ||
value: (function () { | ||
var _removeNode = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3(id) { | ||
var index, node; | ||
@@ -431,6 +431,7 @@ return _regeneratorRuntime.wrap(function _callee3$(_context3) { | ||
*/ | ||
) | ||
}, { | ||
key: "removeConnection", | ||
value: function () { | ||
var _removeConnection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(id) { | ||
value: (function () { | ||
var _removeConnection = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee4(id) { | ||
var index, connection; | ||
@@ -488,6 +489,7 @@ return _regeneratorRuntime.wrap(function _callee4$(_context4) { | ||
*/ | ||
) | ||
}, { | ||
key: "clear", | ||
value: function () { | ||
var _clear = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5() { | ||
value: (function () { | ||
var _clear = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee5() { | ||
var _iterator, _step, connection, _iterator2, _step2, node; | ||
@@ -581,8 +583,6 @@ return _regeneratorRuntime.wrap(function _callee5$(_context5) { | ||
return clear; | ||
}() | ||
}()) | ||
}]); | ||
return NodeEditor; | ||
}(Scope); | ||
/* global globalThis*/ | ||
var crypto = globalThis.crypto; | ||
@@ -605,4 +605,4 @@ | ||
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } | ||
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; } } | ||
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); } | ||
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } | ||
/** | ||
@@ -653,4 +653,2 @@ * The socket class | ||
var Input = /*#__PURE__*/function (_Port) { | ||
_inherits(Input, _Port); | ||
var _super = _createSuper(Input); | ||
/** | ||
@@ -665,11 +663,11 @@ * @constructor | ||
_classCallCheck(this, Input); | ||
_this = _super.call(this, socket, label, multipleConnections); | ||
_this = _callSuper(this, Input, [socket, label, multipleConnections]); | ||
/** | ||
* Control instance | ||
*/ | ||
_defineProperty(_assertThisInitialized(_this), "control", null); | ||
_defineProperty(_this, "control", null); | ||
/** | ||
* Whether the control is visible. Can be managed dynamically by extensions. Default is `true` | ||
*/ | ||
_defineProperty(_assertThisInitialized(_this), "showControl", true); | ||
_defineProperty(_this, "showControl", true); | ||
_this.socket = socket; | ||
@@ -685,3 +683,4 @@ _this.label = label; | ||
*/ | ||
_createClass(Input, [{ | ||
_inherits(Input, _Port); | ||
return _createClass(Input, [{ | ||
key: "addControl", | ||
@@ -702,3 +701,2 @@ value: function addControl(control) { | ||
}]); | ||
return Input; | ||
}(Port); | ||
@@ -711,4 +709,2 @@ | ||
var Output = /*#__PURE__*/function (_Port2) { | ||
_inherits(Output, _Port2); | ||
var _super2 = _createSuper(Output); | ||
/** | ||
@@ -722,4 +718,5 @@ * @constructor | ||
_classCallCheck(this, Output); | ||
return _super2.call(this, socket, label, multipleConnections !== false); | ||
return _callSuper(this, Output, [socket, label, multipleConnections !== false]); | ||
} | ||
_inherits(Output, _Port2); | ||
return _createClass(Output); | ||
@@ -755,4 +752,2 @@ }(Port); | ||
var InputControl = /*#__PURE__*/function (_Control) { | ||
_inherits(InputControl, _Control); | ||
var _super3 = _createSuper(InputControl); | ||
/** | ||
@@ -764,9 +759,10 @@ * @constructor | ||
function InputControl(type, options) { | ||
var _options$readonly; | ||
var _this2; | ||
_classCallCheck(this, InputControl); | ||
_this2 = _super3.call(this); | ||
_this2 = _callSuper(this, InputControl); | ||
_this2.type = type; | ||
_this2.options = options; | ||
_this2.id = getUID(); | ||
_this2.readonly = options === null || options === void 0 ? void 0 : options.readonly; | ||
_this2.readonly = (_options$readonly = options === null || options === void 0 ? void 0 : options.readonly) !== null && _options$readonly !== void 0 ? _options$readonly : false; | ||
if (typeof (options === null || options === void 0 ? void 0 : options.initial) !== 'undefined') _this2.value = options.initial; | ||
@@ -780,3 +776,4 @@ return _this2; | ||
*/ | ||
_createClass(InputControl, [{ | ||
_inherits(InputControl, _Control); | ||
return _createClass(InputControl, [{ | ||
key: "setValue", | ||
@@ -789,3 +786,2 @@ value: function setValue(value) { | ||
}]); | ||
return InputControl; | ||
}(Control); | ||
@@ -823,3 +819,3 @@ | ||
} | ||
_createClass(Node, [{ | ||
return _createClass(Node, [{ | ||
key: "hasInput", | ||
@@ -885,3 +881,2 @@ value: function hasInput(key) { | ||
}]); | ||
return Node; | ||
}(); | ||
@@ -888,0 +883,0 @@ |
/*! | ||
* rete v2.0.2 | ||
* rete v2.0.3 | ||
* (c) 2024 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)}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.slice()}},{key:"getConnections",value:function(){return this.connections.slice()}},{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(t,r,i){var a;return o(this,n),u(l(a=e.call(this,t,r,i)),"control",null),u(l(a),"showControl",!0),a.socket=t,a.label=r,a.multipleConnections=i,a}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})})); | ||
!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(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}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,n){return e=f(e),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 function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,h()?Reflect.construct(e,n||[],f(t).constructor):e.apply(t,n))}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(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 u(t,e,n){return e&&a(t.prototype,e),n&&a(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function c(t,n){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,n){if(t){if("string"==typeof t)return e(t,n);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?e(t,n):void 0}}(t))||n&&t&&"number"==typeof t.length){r&&(t=r);var o=0,i=function(){};return{s:i,n:function(){return o>=t.length?{done:!0}:{done:!1,value:t[o++]}},e:function(t){throw t},f:i}}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 a,u=!0,c=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return u=t.done,t},e:function(t){c=!0,a=t},f:function(){try{u||null==r.return||r.return()}finally{if(c)throw a}}}}function s(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 f(t){return f=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},f(t)}function l(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&&d(t,e)}function h(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(h=function(){return!!t})()}function p(){p=function(){return e};var t,e={},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 m?e:m,a=Object.create(i.prototype),u=new N(r||[]);return o(a,"_invoke",{value:_(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}}}e.wrap=f;var h="suspendedStart",d="suspendedYield",y="executing",v="completed",b={};function m(){}function w(){}function g(){}var x={};s(x,a,(function(){return this}));var k=Object.getPrototypeOf,O=k&&k(k(I([])));O&&O!==n&&r.call(O,a)&&(x=O);var E=g.prototype=m.prototype=Object.create(x);function j(t){["next","throw","return"].forEach((function(e){s(t,e,(function(t){return this._invoke(e,t)}))}))}function P(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 _(e,n,r){var o=h;return function(i,a){if(o===y)throw Error("Generator is already running");if(o===v){if("throw"===i)throw a;return{value:t,done:!0}}for(r.method=i,r.arg=a;;){var u=r.delegate;if(u){var c=L(u,r);if(c){if(c===b)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===h)throw o=v,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=y;var s=l(e,n,r);if("normal"===s.type){if(o=r.done?v:d,s.arg===b)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(o=v,r.method="throw",r.arg=s.arg)}}}function L(e,n){var r=n.method,o=e.iterator[r];if(o===t)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=t,L(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),b;var i=l(o,e.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,b;var a=i.arg;return a?a.done?(n[e.resultName]=a.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,b):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,b)}function S(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 C(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function N(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(S,this),this.reset(!0)}function I(e){if(e||""===e){var n=e[a];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function n(){for(;++o<e.length;)if(r.call(e,o))return n.value=e[o],n.done=!1,n;return n.value=t,n.done=!0,n};return i.next=i}}throw new TypeError(typeof e+" is not iterable")}return w.prototype=g,o(E,"constructor",{value:g,configurable:!0}),o(g,"constructor",{value:w,configurable:!0}),w.displayName=s(g,c,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===w||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,g):(t.__proto__=g,s(t,c,"GeneratorFunction")),t.prototype=Object.create(E),t},e.awrap=function(t){return{__await:t}},j(P.prototype),s(P.prototype,u,(function(){return this})),e.AsyncIterator=P,e.async=function(t,n,r,o,i){void 0===i&&(i=Promise);var a=new P(f(t,n,r,o),i);return e.isGeneratorFunction(n)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},j(E),s(E,c,"Generator"),s(E,a,(function(){return this})),s(E,"toString",(function(){return"[object Generator]"})),e.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}},e.values=I,N.prototype={constructor:N,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(C),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},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 n=this;function o(r,o){return u.type="throw",u.arg=e,n.next=r,o&&(n.method="next",n.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],u=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var c=r.call(a,"catchLoc"),s=r.call(a,"finallyLoc");if(c&&s){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(c){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.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,b):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),b},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),C(n),b}},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;C(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:I(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),b}},e}function d(t,e){return d=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},d(t,e)}function y(t){var e=function(t,e){if("object"!=typeof t||!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:e+""}var v=function(){return u((function t(){i(this,t),s(this,"pipes",[])}),[{key:"addPipe",value:function(t){this.pipes.push(t)}},{key:"emit",value:(t=r(p().mark((function t(e){var n,r,o,i;return p().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n=e,r=c(this.pipes),t.prev=2,r.s();case 4:if((o=r.n()).done){t.next=13;break}return i=o.value,t.next=8,i(n);case 8:if(void 0!==(n=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),r.e(t.t0);case 18:return t.prev=18,r.f(),t.finish(18);case 21:return t.abrupt("return",n);case 22:case"end":return t.stop()}}),t,this,[[2,15,18,21]])}))),function(e){return t.apply(this,arguments)})}]);var t}(),b=function(){function t(e){i(this,t),s(this,"signal",new v),this.name=e}return u(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}}])}(),m=function(t){function e(){var t;return i(this,e),s(t=o(this,e,["NodeEditor"]),"nodes",[]),s(t,"connections",[]),t}return l(e,t),u(e,[{key:"getNode",value:function(t){return this.nodes.find((function(e){return e.id===t}))}},{key:"getNodes",value:function(){return this.nodes.slice()}},{key:"getConnections",value:function(){return this.connections.slice()}},{key:"getConnection",value:function(t){return this.connections.find((function(e){return e.id===t}))}},{key:"addNode",value:(d=r(p().mark((function t(e){return p().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!this.getNode(e.id)){t.next=2;break}throw new Error("node has already been added");case 2:return t.next=4,this.emit({type:"nodecreate",data:e});case 4:if(t.sent){t.next=6;break}return t.abrupt("return",!1);case 6:return this.nodes.push(e),t.next=9,this.emit({type:"nodecreated",data:e});case 9:return t.abrupt("return",!0);case 10:case"end":return t.stop()}}),t,this)}))),function(t){return d.apply(this,arguments)})},{key:"addConnection",value:(h=r(p().mark((function t(e){return p().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!this.getConnection(e.id)){t.next=2;break}throw new Error("connection has already been added");case 2:return t.next=4,this.emit({type:"connectioncreate",data:e});case 4:if(t.sent){t.next=6;break}return t.abrupt("return",!1);case 6:return this.connections.push(e),t.next=9,this.emit({type:"connectioncreated",data:e});case 9:return t.abrupt("return",!0);case 10:case"end":return t.stop()}}),t,this)}))),function(t){return h.apply(this,arguments)})},{key:"removeNode",value:(f=r(p().mark((function t(e){var n,r;return p().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=this.nodes.findIndex((function(t){return t.id===e})),r=this.nodes[n],!(n<0)){t.next=4;break}throw new Error("cannot find node");case 4:return t.next=6,this.emit({type:"noderemove",data:r});case 6:if(t.sent){t.next=8;break}return t.abrupt("return",!1);case 8:return this.nodes.splice(n,1),t.next=11,this.emit({type:"noderemoved",data:r});case 11:return t.abrupt("return",!0);case 12:case"end":return t.stop()}}),t,this)}))),function(t){return f.apply(this,arguments)})},{key:"removeConnection",value:(a=r(p().mark((function t(e){var n,r;return p().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=this.connections.findIndex((function(t){return t.id===e})),r=this.connections[n],!(n<0)){t.next=4;break}throw new Error("cannot find connection");case 4:return t.next=6,this.emit({type:"connectionremove",data:r});case 6:if(t.sent){t.next=8;break}return t.abrupt("return",!1);case 8:return this.connections.splice(n,1),t.next=11,this.emit({type:"connectionremoved",data:r});case 11:return t.abrupt("return",!0);case 12:case"end":return t.stop()}}),t,this)}))),function(t){return a.apply(this,arguments)})},{key:"clear",value:(n=r(p().mark((function t(){var e,n,r,o,i,a;return p().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:e=c(this.connections.slice()),t.prev=7,e.s();case 9:if((n=e.n()).done){t.next=15;break}return r=n.value,t.next=13,this.removeConnection(r.id);case 13:t.next=9;break;case 15:t.next=20;break;case 17:t.prev=17,t.t0=t.catch(7),e.e(t.t0);case 20:return t.prev=20,e.f(),t.finish(20);case 23:o=c(this.nodes.slice()),t.prev=24,o.s();case 26:if((i=o.n()).done){t.next=32;break}return a=i.value,t.next=30,this.removeNode(a.id);case 30:t.next=26;break;case 32:t.next=37;break;case 34:t.prev=34,t.t1=t.catch(24),o.e(t.t1);case 37:return t.prev=37,o.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)})}]);var n,a,f,h,d}(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=u((function t(e){i(this,t),this.name=e})),k=u((function t(e,n,r){i(this,t),this.socket=e,this.label=n,this.multipleConnections=r,this.id=g()})),O=function(t){function e(t,n,r){var a;return i(this,e),s(a=o(this,e,[t,n,r]),"control",null),s(a,"showControl",!0),a.socket=t,a.label=n,a.multipleConnections=r,a}return l(e,t),u(e,[{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}}])}(k),E=function(t){function e(t,n,r){return i(this,e),o(this,e,[t,n,!1!==r])}return l(e,t),u(e)}(k),j=u((function t(){i(this,t),this.id=g()})),P=function(t){function e(t,n){var r,a;return i(this,e),(a=o(this,e)).type=t,a.options=n,a.id=g(),a.readonly=null!==(r=null==n?void 0:n.readonly)&&void 0!==r&&r,void 0!==(null==n?void 0:n.initial)&&(a.value=n.initial),a}return l(e,t),u(e,[{key:"setValue",value:function(t){var e;this.value=t,null!==(e=this.options)&&void 0!==e&&e.change&&this.options.change(t)}}])}(j),_=function(){return u((function t(e){i(this,t),s(this,"inputs",{}),s(this,"outputs",{}),s(this,"controls",{}),this.label=e,this.id=g()}),[{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]}}])}(),L=u((function t(e,n,r,o){if(i(this,t),this.sourceOutput=n,this.targetInput=o,!e.outputs[n])throw new Error("source node doesn't have output with a key ".concat(String(n)));if(!r.inputs[o])throw new Error("target node doesn't have input with a key ".concat(String(o)));this.id=g(),this.source=e.id,this.target=r.id})),S=Object.freeze({__proto__:null,Socket:x,Port:k,Input:O,Output:E,Control:j,InputControl:P,Node:_,Connection:L});t.ClassicPreset=S,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
34
226745
2348