@keload/node-red-dxp 1.23.1 → 1.23.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/index.cjs +31 -35
- package/dist/editor/dom-helper/index.cjs +1 -1
- package/dist/editor/dom-helper/index.d.cts +14 -13
- package/dist/editor/dom-helper/index.d.ts +14 -13
- package/dist/editor/dom-helper/index.js +1 -1
- package/dist/editor/index.cjs +1 -1
- package/dist/editor/index.d.cts +5 -4
- package/dist/editor/index.d.ts +5 -4
- package/dist/editor/index.js +1 -1
- package/dist/editor/inject/dxpFormRow.cjs +1 -1
- package/dist/editor/inject/dxpFormRow.d.cts +10 -9
- package/dist/editor/inject/dxpFormRow.d.ts +10 -9
- package/dist/editor/inject/dxpFormRow.js +1 -1
- package/dist/index-Br38J6RF.d.ts +6 -0
- package/dist/index-CZL133rH.d.cts +6 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +1 -5
- package/dist/index.d.ts +1 -5
- package/dist/index.js +1 -1
- package/dist/src-CXOjPWwR.js +0 -0
- package/dist/{types-B7YUmbnu.d.cts → types-B_x2zkuM.d.cts} +8 -7
- package/dist/{types-B7YUmbnu.d.ts → types-LozbF9aD.d.ts} +8 -7
- package/dist/utils/controller.cjs +1 -1
- package/dist/utils/controller.d.cts +13 -15
- package/dist/utils/controller.d.ts +13 -15
- package/dist/utils/controller.js +1 -1
- package/dist/utils/index.cjs +1 -2
- package/dist/utils/index.d.cts +9 -5
- package/dist/utils/index.d.ts +9 -5
- package/dist/utils/index.js +1 -2
- package/package.json +24 -19
- package/dist/chunk-O2XFH626.js +0 -1
- package/dist/chunk-O55HBSM5.js +0 -1
- package/dist/chunk-YESMJQI4.js +0 -1
- /package/dist/{chunk-Z65JVQED.js → src-BNoPX5QG.cjs} +0 -0
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
|
|
1
|
+
import { EditorDomHelper } from "../../types-B_x2zkuM.cjs";
|
|
2
|
+
import "../../index-CZL133rH.cjs";
|
|
3
|
+
|
|
4
|
+
//#region src/editor/dom.d.ts
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* Checks if a given selector is a node input selector.
|
|
@@ -9,10 +10,10 @@ import 'node-red';
|
|
|
9
10
|
* @returns True if the selector is a node input selector, false otherwise.
|
|
10
11
|
*/
|
|
11
12
|
declare function isNodeInput(selector: string): {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
isNodeIdShortcut: boolean;
|
|
14
|
+
isNodeConfigIdShortcut: boolean;
|
|
15
|
+
isFullSelector: boolean;
|
|
16
|
+
value: boolean;
|
|
16
17
|
};
|
|
17
18
|
/**
|
|
18
19
|
* Resolves a selector string into a specific format based on predefined rules.
|
|
@@ -127,7 +128,7 @@ declare function initSelect(selector: string, options: Record<string, string>[],
|
|
|
127
128
|
* watchInput(['$input-1', '$input-2'], (values) => console.log(values));
|
|
128
129
|
*/
|
|
129
130
|
declare function watchInput<T = any>(selectors: string | string[], callback: (values: T[]) => void, opt?: {
|
|
130
|
-
|
|
131
|
+
additionalEvents: any[];
|
|
131
132
|
}): void;
|
|
132
133
|
/**
|
|
133
134
|
* Sets the value of an input element.
|
|
@@ -234,9 +235,9 @@ declare function getFormValues(prefix: string): Record<string, string | boolean>
|
|
|
234
235
|
*/
|
|
235
236
|
declare function setFormValues(prefix: string, values: Record<string, unknown | boolean>): void;
|
|
236
237
|
type InitTabsParams = {
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
238
|
+
targetId: any;
|
|
239
|
+
tabsLabel: string[];
|
|
240
|
+
initialTab: string;
|
|
240
241
|
};
|
|
241
242
|
/**
|
|
242
243
|
* Initializes a tab system with the provided configuration and handles tab switching behavior.
|
|
@@ -273,5 +274,5 @@ type InitTabsParams = {
|
|
|
273
274
|
* @throws {Error} Throws an error if the `params.initialTab` does not match any label in `tabsLabel`.
|
|
274
275
|
*/
|
|
275
276
|
declare function initTabs(params: InitTabsParams): void;
|
|
276
|
-
|
|
277
|
-
export { addClassesOnSelectors, getFormValues, handleAddRemoveClassesOnSelectors, initSelect, initTabs, isCheckboxChecked, isNodeInput, jqSelector, removeClassesOnSelectors, resolveInputKey, resolveSelector, setFormValues, setInputValue, setText, watchInput };
|
|
277
|
+
//#endregion
|
|
278
|
+
export { addClassesOnSelectors, getFormValues, handleAddRemoveClassesOnSelectors, initSelect, initTabs, isCheckboxChecked, isNodeInput, jqSelector, removeClassesOnSelectors, resolveInputKey, resolveSelector, setFormValues, setInputValue, setText, watchInput };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
|
|
1
|
+
import { EditorDomHelper } from "../../types-LozbF9aD.js";
|
|
2
|
+
import "../../index-Br38J6RF.js";
|
|
3
|
+
|
|
4
|
+
//#region src/editor/dom.d.ts
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* Checks if a given selector is a node input selector.
|
|
@@ -9,10 +10,10 @@ import 'node-red';
|
|
|
9
10
|
* @returns True if the selector is a node input selector, false otherwise.
|
|
10
11
|
*/
|
|
11
12
|
declare function isNodeInput(selector: string): {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
isNodeIdShortcut: boolean;
|
|
14
|
+
isNodeConfigIdShortcut: boolean;
|
|
15
|
+
isFullSelector: boolean;
|
|
16
|
+
value: boolean;
|
|
16
17
|
};
|
|
17
18
|
/**
|
|
18
19
|
* Resolves a selector string into a specific format based on predefined rules.
|
|
@@ -127,7 +128,7 @@ declare function initSelect(selector: string, options: Record<string, string>[],
|
|
|
127
128
|
* watchInput(['$input-1', '$input-2'], (values) => console.log(values));
|
|
128
129
|
*/
|
|
129
130
|
declare function watchInput<T = any>(selectors: string | string[], callback: (values: T[]) => void, opt?: {
|
|
130
|
-
|
|
131
|
+
additionalEvents: any[];
|
|
131
132
|
}): void;
|
|
132
133
|
/**
|
|
133
134
|
* Sets the value of an input element.
|
|
@@ -234,9 +235,9 @@ declare function getFormValues(prefix: string): Record<string, string | boolean>
|
|
|
234
235
|
*/
|
|
235
236
|
declare function setFormValues(prefix: string, values: Record<string, unknown | boolean>): void;
|
|
236
237
|
type InitTabsParams = {
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
238
|
+
targetId: any;
|
|
239
|
+
tabsLabel: string[];
|
|
240
|
+
initialTab: string;
|
|
240
241
|
};
|
|
241
242
|
/**
|
|
242
243
|
* Initializes a tab system with the provided configuration and handles tab switching behavior.
|
|
@@ -273,5 +274,5 @@ type InitTabsParams = {
|
|
|
273
274
|
* @throws {Error} Throws an error if the `params.initialTab` does not match any label in `tabsLabel`.
|
|
274
275
|
*/
|
|
275
276
|
declare function initTabs(params: InitTabsParams): void;
|
|
276
|
-
|
|
277
|
-
export { addClassesOnSelectors, getFormValues, handleAddRemoveClassesOnSelectors, initSelect, initTabs, isCheckboxChecked, isNodeInput, jqSelector, removeClassesOnSelectors, resolveInputKey, resolveSelector, setFormValues, setInputValue, setText, watchInput };
|
|
277
|
+
//#endregion
|
|
278
|
+
export { addClassesOnSelectors, getFormValues, handleAddRemoveClassesOnSelectors, initSelect, initTabs, isCheckboxChecked, isNodeInput, jqSelector, removeClassesOnSelectors, resolveInputKey, resolveSelector, setFormValues, setInputValue, setText, watchInput };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import"../../src-CXOjPWwR.js";const e=e=>{if(!e||e.length===0)return``;let t=e.toLowerCase();return t.substring(0,1).toUpperCase()+t.substring(1,t.length)},t=(t,n)=>{var r;let i=(r=t==null?void 0:t.replace(/([A-Z])+/g,e).split(/(?=[A-Z])|[\.\-\s_]/).map(e=>e.toLowerCase()))==null?[]:r;if(i.length===0)return``;if(i.length===1)return i[0];let a=i.reduce((e,t)=>`${e}_${t.toLowerCase()}`);return(n==null?void 0:n.splitOnNumber)===!1?a:a.replace(/([A-Za-z]{1}[0-9]{1})/,e=>`${e[0]}_${e[1]}`)};function n(e){let t=e.startsWith(`$`),n=e.startsWith(`$$`),r=e.startsWith(`#node-config-input`)||e.startsWith(`#node-input`);return{isNodeIdShortcut:t,isNodeConfigIdShortcut:n,isFullSelector:r,value:t||n||r}}function r(e){let t=n(e);return t.isNodeConfigIdShortcut?`#node-config-input-${e.replace(`$$`,``)}`:t.isNodeIdShortcut?`#node-input-${e.replace(`$`,``)}`:e}function i(e,t,n){t.forEach(t=>{let r=document.querySelector(t);r&&n.forEach(t=>r.classList[e](t))})}function a(e,t){i(`remove`,e,t)}function o(e,t){i(`add`,e,t)}function s(e){return r(e).split(`-input-`)[1]}function c(e,t,n){let i=r(e),a=t;n!=null&&n.emptyValue&&(a=[{value:``,text:n.emptyValue},...t]),$(i).empty().append(a.map(e=>$(`<option>`,{value:e.value,text:e.text,selected:e.value===(n==null?void 0:n.selected)})))}function l(e,t,n={additionalEvents:[]}){let i=(Array.isArray(e)?e:[e]).map(r).join(`, `),a=[`input`,...n.additionalEvents];$(i).on(a.join(` `),()=>{t($(i).map(function(){return $(this).val()}).get())})}function u(e,t){let n=r(e);$(n).val(t)}function d(e,t){let n=r(e);$(n).text(t)}function f(e){let t=r(e);return $(t)}function p(e){let t=r(e);return document.querySelector(t).checked}function m(e){let t={};return document.querySelectorAll(`[id^="node-input-${e}-"]`).forEach(n=>{let r=n,i=r.id.replace(`node-input-${e}-`,``);r.type===`checkbox`?t[i]=r.checked:t[i]=r.value}),t}function h(e,t){t&&Object.entries(t).forEach(([t,n])=>{let r=document.querySelector(`#node-input-${e}-${t}`);r&&(r.type===`checkbox`?r.checked=!!n:r.value=String(n))})}function g(e){let n=`#tabs-content-${e.targetId}`,r=RED.tabs.create({id:e.targetId,onchange:e=>{$(n).children().addClass(`hidden`),$(`#${e.id}`).removeClass(`hidden`)}});(e.tabsLabel||[]).forEach(e=>{r.addTab({id:`tab-${t(e)}`,label:e})}),r.activateTab(`tab-${t(e.initialTab)}`)}export{o as addClassesOnSelectors,m as getFormValues,i as handleAddRemoveClassesOnSelectors,c as initSelect,g as initTabs,p as isCheckboxChecked,n as isNodeInput,f as jqSelector,a as removeClassesOnSelectors,s as resolveInputKey,r as resolveSelector,h as setFormValues,u as setInputValue,d as setText,l as watchInput};
|
package/dist/editor/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function e(e){return Object.prototype.toString.call(e).slice(8,-1)}function t(t){if(e(t)!==`Object`)return!1;let n=Object.getPrototypeOf(t);return!!n&&n.constructor===Object&&n===Object.prototype}function n(t){return e(t)===`Symbol`}function r(e,t,n,r){let i={}.propertyIsEnumerable.call(r,t)?`enumerable`:`nonenumerable`;i===`enumerable`&&(e[t]=n),i===`nonenumerable`&&Object.defineProperty(e,t,{value:n,enumerable:!1,writable:!0,configurable:!0})}function i(e,a,o){if(!t(a))return a;let s={};if(t(e)){let t=Object.getOwnPropertyNames(e),i=Object.getOwnPropertySymbols(e);s=[...t,...i].reduce((t,i)=>{if(i===`__proto__`)return t;let o=e[i];return(!n(i)&&!Object.getOwnPropertyNames(a).includes(i)||n(i)&&!Object.getOwnPropertySymbols(a).includes(i))&&r(t,i,o,e),t},{})}let c=Object.getOwnPropertyNames(a),l=Object.getOwnPropertySymbols(a);return[...c,...l].reduce((n,s)=>{if(s===`__proto__`)return n;let c=a[s],l=t(e)?e[s]:void 0;return l!==void 0&&t(c)&&(c=i(l,c,o)),r(n,s,o?o(l,c,s):c,a),n},s)}function a(e,...t){return t.reduce((e,t)=>i(e,t),e)}const o={};function s(e){return a(o,e)}exports.createEditorNode=s;
|
package/dist/editor/index.d.cts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { EditorDomHelper, NodeControllerConfig, NodeControllerInst, NodeEditorDefinition, NodeEditorProps } from "../types-B_x2zkuM.cjs";
|
|
2
|
+
import { EditorNodeDef, EditorNodeProperties } from "node-red";
|
|
3
3
|
|
|
4
|
+
//#region src/editor/index.d.ts
|
|
4
5
|
declare function createEditorNode<TProps extends EditorNodeProperties, TCreds = undefined, TInstProps extends TProps = TProps>(props: Partial<EditorNodeDef<TProps, TCreds, TInstProps>>): EditorNodeDef<TProps, TCreds, TInstProps>;
|
|
5
|
-
|
|
6
|
-
export { createEditorNode };
|
|
6
|
+
//#endregion
|
|
7
|
+
export { EditorDomHelper, NodeControllerConfig, NodeControllerInst, NodeEditorDefinition, NodeEditorProps, createEditorNode };
|
package/dist/editor/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { EditorDomHelper, NodeControllerConfig, NodeControllerInst, NodeEditorDefinition, NodeEditorProps } from "../types-LozbF9aD.js";
|
|
2
|
+
import { EditorNodeDef, EditorNodeProperties } from "node-red";
|
|
3
3
|
|
|
4
|
+
//#region src/editor/index.d.ts
|
|
4
5
|
declare function createEditorNode<TProps extends EditorNodeProperties, TCreds = undefined, TInstProps extends TProps = TProps>(props: Partial<EditorNodeDef<TProps, TCreds, TInstProps>>): EditorNodeDef<TProps, TCreds, TInstProps>;
|
|
5
|
-
|
|
6
|
-
export { createEditorNode };
|
|
6
|
+
//#endregion
|
|
7
|
+
export { EditorDomHelper, NodeControllerConfig, NodeControllerInst, NodeEditorDefinition, NodeEditorProps, createEditorNode };
|
package/dist/editor/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function e(e){return Object.prototype.toString.call(e).slice(8,-1)}function t(t){if(e(t)!==`Object`)return!1;let n=Object.getPrototypeOf(t);return!!n&&n.constructor===Object&&n===Object.prototype}function n(t){return e(t)===`Symbol`}function r(e,t,n,r){let i={}.propertyIsEnumerable.call(r,t)?`enumerable`:`nonenumerable`;i===`enumerable`&&(e[t]=n),i===`nonenumerable`&&Object.defineProperty(e,t,{value:n,enumerable:!1,writable:!0,configurable:!0})}function i(e,a,o){if(!t(a))return a;let s={};if(t(e)){let t=Object.getOwnPropertyNames(e),i=Object.getOwnPropertySymbols(e);s=[...t,...i].reduce((t,i)=>{if(i===`__proto__`)return t;let o=e[i];return(!n(i)&&!Object.getOwnPropertyNames(a).includes(i)||n(i)&&!Object.getOwnPropertySymbols(a).includes(i))&&r(t,i,o,e),t},{})}let c=Object.getOwnPropertyNames(a),l=Object.getOwnPropertySymbols(a);return[...c,...l].reduce((n,s)=>{if(s===`__proto__`)return n;let c=a[s],l=t(e)?e[s]:void 0;return l!==void 0&&t(c)&&(c=i(l,c,o)),r(n,s,o?o(l,c,s):c,a),n},s)}function a(e,...t){return t.reduce((e,t)=>i(e,t),e)}const o={};function s(e){return a(o,e)}export{s as createEditorNode};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function e(e){let t=e.startsWith(`[config]`),n=e.replace(`[config]`,``);return`node-${t?`config-`:``}input-${n}`}function t(){let e=document.createElement(`div`);return e.classList.add(`dxp-form-row`),e}function n(e){let t;return[`text`,`checkbox`,`password`].includes(e.type)&&(t=document.createElement(`input`),t.setAttribute(`type`,e.type),e.type===`text`&&e!=null&&e.placeholder&&t.setAttribute(`placeholder`,e.placeholder)),e.type===`select`&&(t=document.createElement(`select`)),t.setAttribute(`id`,e.id),t}var r=class extends HTMLElement{constructor(){super(),this.formRowContainer=t(),this.rowId=e(this.getAttribute(`row-id`)||`row-id`),this.labelText=this.getAttribute(`label`)||`Label`,this.inputType=this.getAttribute(`type`)||`text`,this.iconClass=this.getAttribute(`icon`),this.mainContainer=document.createElement(`div`),this.mainContainer.classList.add(`main`);let r=this.querySelector(`.hint`),i=this.querySelector(`.checkbox-hint`),a=document.createElement(`div`);if(this.iconClass){let e=document.createElement(`i`);e.classList.add(`fa`,`fa-${this.iconClass}`),a.appendChild(e)}let o=document.createElement(`label`);o.setAttribute(`for`,this.rowId),o.textContent=this.labelText,a.appendChild(o),this.mainContainer.appendChild(a);let s=n({type:this.inputType,id:this.rowId});this.mainContainer.appendChild(s),this.inputType===`checkbox`&&i&&this.mainContainer.appendChild(i),this.formRowContainer.appendChild(this.mainContainer),r&&this.formRowContainer.appendChild(r),this.appendChild(this.formRowContainer)}};customElements.get(`dxp-form-row`)||customElements.define(`dxp-form-row`,r),exports.DxpFormRow=r;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
+
//#region src/editor/web-components/dxpFormRow.d.ts
|
|
1
2
|
declare class DxpFormRow extends HTMLElement {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
private formRowContainer;
|
|
4
|
+
private mainContainer;
|
|
5
|
+
private labelText;
|
|
6
|
+
private inputType;
|
|
7
|
+
private iconClass;
|
|
8
|
+
private rowId;
|
|
9
|
+
constructor();
|
|
9
10
|
}
|
|
10
|
-
|
|
11
|
-
export { DxpFormRow };
|
|
11
|
+
//#endregion
|
|
12
|
+
export { DxpFormRow };
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
+
//#region src/editor/web-components/dxpFormRow.d.ts
|
|
1
2
|
declare class DxpFormRow extends HTMLElement {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
private formRowContainer;
|
|
4
|
+
private mainContainer;
|
|
5
|
+
private labelText;
|
|
6
|
+
private inputType;
|
|
7
|
+
private iconClass;
|
|
8
|
+
private rowId;
|
|
9
|
+
constructor();
|
|
9
10
|
}
|
|
10
|
-
|
|
11
|
-
export { DxpFormRow };
|
|
11
|
+
//#endregion
|
|
12
|
+
export { DxpFormRow };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function e(e){let t=e.startsWith(`[config]`),n=e.replace(`[config]`,``);return`node-${t?`config-`:``}input-${n}`}function t(){let e=document.createElement(`div`);return e.classList.add(`dxp-form-row`),e}function n(e){let t;return[`text`,`checkbox`,`password`].includes(e.type)&&(t=document.createElement(`input`),t.setAttribute(`type`,e.type),e.type===`text`&&e!=null&&e.placeholder&&t.setAttribute(`placeholder`,e.placeholder)),e.type===`select`&&(t=document.createElement(`select`)),t.setAttribute(`id`,e.id),t}var r=class extends HTMLElement{constructor(){super(),this.formRowContainer=t(),this.rowId=e(this.getAttribute(`row-id`)||`row-id`),this.labelText=this.getAttribute(`label`)||`Label`,this.inputType=this.getAttribute(`type`)||`text`,this.iconClass=this.getAttribute(`icon`),this.mainContainer=document.createElement(`div`),this.mainContainer.classList.add(`main`);let r=this.querySelector(`.hint`),i=this.querySelector(`.checkbox-hint`),a=document.createElement(`div`);if(this.iconClass){let e=document.createElement(`i`);e.classList.add(`fa`,`fa-${this.iconClass}`),a.appendChild(e)}let o=document.createElement(`label`);o.setAttribute(`for`,this.rowId),o.textContent=this.labelText,a.appendChild(o),this.mainContainer.appendChild(a);let s=n({type:this.inputType,id:this.rowId});this.mainContainer.appendChild(s),this.inputType===`checkbox`&&i&&this.mainContainer.appendChild(i),this.formRowContainer.appendChild(this.mainContainer),r&&this.formRowContainer.appendChild(r),this.appendChild(this.formRowContainer)}};customElements.get(`dxp-form-row`)||customElements.define(`dxp-form-row`,r);export{r as DxpFormRow};
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
require(`./src-BNoPX5QG.cjs`);
|
package/dist/index.d.cts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import"./src-CXOjPWwR.js";
|
|
File without changes
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { EditorNodeDef, EditorNodeProperties, Node, NodeDef } from "node-red";
|
|
2
2
|
|
|
3
|
+
//#region src/editor/types.d.ts
|
|
3
4
|
type NodeControllerConfig<T> = NodeDef & T;
|
|
4
5
|
type NodeControllerInst<T> = Node & T;
|
|
5
6
|
type NodeEditorProps<T = Record<any, any>> = EditorNodeProperties & T;
|
|
6
7
|
type NodeEditorDefinition<TProps extends EditorNodeProperties, TCreds = undefined, TInstProps extends TProps = TProps> = EditorNodeDef<TProps, TCreds, TInstProps>;
|
|
7
8
|
declare namespace EditorDomHelper {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
type InitSelectParams = {
|
|
10
|
+
selected?: string | number | unknown;
|
|
11
|
+
emptyValue?: string;
|
|
12
|
+
};
|
|
12
13
|
}
|
|
13
|
-
|
|
14
|
-
export { EditorDomHelper
|
|
14
|
+
//#endregion
|
|
15
|
+
export { EditorDomHelper, NodeControllerConfig, NodeControllerInst, NodeEditorDefinition, NodeEditorProps };
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { EditorNodeDef, EditorNodeProperties, Node, NodeDef } from "node-red";
|
|
2
2
|
|
|
3
|
+
//#region src/editor/types.d.ts
|
|
3
4
|
type NodeControllerConfig<T> = NodeDef & T;
|
|
4
5
|
type NodeControllerInst<T> = Node & T;
|
|
5
6
|
type NodeEditorProps<T = Record<any, any>> = EditorNodeProperties & T;
|
|
6
7
|
type NodeEditorDefinition<TProps extends EditorNodeProperties, TCreds = undefined, TInstProps extends TProps = TProps> = EditorNodeDef<TProps, TCreds, TInstProps>;
|
|
7
8
|
declare namespace EditorDomHelper {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
type InitSelectParams = {
|
|
10
|
+
selected?: string | number | unknown;
|
|
11
|
+
emptyValue?: string;
|
|
12
|
+
};
|
|
12
13
|
}
|
|
13
|
-
|
|
14
|
-
export { EditorDomHelper
|
|
14
|
+
//#endregion
|
|
15
|
+
export { EditorDomHelper, NodeControllerConfig, NodeControllerInst, NodeEditorDefinition, NodeEditorProps };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function e(e,t,n,r,i,a,o){try{var s=e[a](o),c=s.value}catch(e){n(e);return}s.done?t(c):Promise.resolve(c).then(r,i)}function t(t){return function(){var n=this,r=arguments;return new Promise(function(i,a){var o=t.apply(n,r);function s(t){e(o,i,a,s,c,`next`,t)}function c(t){e(o,i,a,s,c,`throw`,t)}s(void 0)})}}function n(e,t){return typeof e==`boolean`?e?[t,null]:[null,t]:(console.warn(`Payload must be a boolean (true or false).`),[null,null])}function r(e){return RED.nodes.getNode(e)}function i(e){return new Promise(t=>{try{RED.util.evaluateNodeProperty(e.value,e.type,e.node,e.msg,(e,n)=>{t([e,n])})}catch(e){t([e,void 0])}})}function a(e,n,r={typedSuffix:`Type`}){function a(t,r){return i({value:t,type:r,node:e,msg:n})}function o(e){return typeof e!=`boolean`&&e===``}function s(e,t){return c.apply(this,arguments)}function c(){return c=t(function*(e,t,n={strictDefaultValue:void 0}){let[,i]=yield a(e==null?void 0:e[t],e==null?void 0:e[`${String(t)}${r.typedSuffix}`]);return(n==null?void 0:n.strictDefaultValue)===void 0?i:o(i)?n.strictDefaultValue:i}),c.apply(this,arguments)}return{evaluateNodeProperty:a,quickNodePropertyEval:s}}exports.evaluateNodeProperty=i,exports.getREDNode=r,exports.splitBooleanOutputs=n,exports.useControllerNode=a;
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Node, NodeMessage } from "node-red";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
var RED: NodeAPI;
|
|
5
|
-
}
|
|
3
|
+
//#region src/utils/server-side/controller.d.ts
|
|
6
4
|
|
|
7
5
|
/**
|
|
8
6
|
* Splits a message into two outputs based on a boolean condition.
|
|
@@ -54,10 +52,10 @@ declare function splitBooleanOutputs(conditionTerm: boolean, msg: unknown): unkn
|
|
|
54
52
|
*/
|
|
55
53
|
declare function getREDNode<TFields extends {} = Record<any, any>, TCreds extends {} = Record<any, any>>(idNode: string): (Node<TCreds> & TFields) | null;
|
|
56
54
|
type EvaluateNodePropertyParams = {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
55
|
+
value: string;
|
|
56
|
+
type: string;
|
|
57
|
+
node: Node;
|
|
58
|
+
msg: NodeMessage;
|
|
61
59
|
};
|
|
62
60
|
/**
|
|
63
61
|
* Evaluates a node property in the Node-RED environment.
|
|
@@ -139,12 +137,12 @@ declare function evaluateNodeProperty(params: EvaluateNodePropertyParams): Promi
|
|
|
139
137
|
* @returns {object} An object containing utility functions for evaluating node properties.
|
|
140
138
|
*/
|
|
141
139
|
declare function useControllerNode(node: Node, msg: NodeMessage, opts?: {
|
|
142
|
-
|
|
140
|
+
typedSuffix: string;
|
|
143
141
|
}): {
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
142
|
+
evaluateNodeProperty: (value: EvaluateNodePropertyParams["value"], type: EvaluateNodePropertyParams["type"]) => Promise<[Error | undefined, any | undefined]>;
|
|
143
|
+
quickNodePropertyEval: <T extends object>(bag: T, term: keyof T, quickOpts?: {
|
|
144
|
+
strictDefaultValue: any;
|
|
145
|
+
}) => Promise<any>;
|
|
148
146
|
};
|
|
149
|
-
|
|
150
|
-
export { evaluateNodeProperty, getREDNode, splitBooleanOutputs, useControllerNode };
|
|
147
|
+
//#endregion
|
|
148
|
+
export { evaluateNodeProperty, getREDNode, splitBooleanOutputs, useControllerNode };
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Node, NodeMessage } from "node-red";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
var RED: NodeAPI;
|
|
5
|
-
}
|
|
3
|
+
//#region src/utils/server-side/controller.d.ts
|
|
6
4
|
|
|
7
5
|
/**
|
|
8
6
|
* Splits a message into two outputs based on a boolean condition.
|
|
@@ -54,10 +52,10 @@ declare function splitBooleanOutputs(conditionTerm: boolean, msg: unknown): unkn
|
|
|
54
52
|
*/
|
|
55
53
|
declare function getREDNode<TFields extends {} = Record<any, any>, TCreds extends {} = Record<any, any>>(idNode: string): (Node<TCreds> & TFields) | null;
|
|
56
54
|
type EvaluateNodePropertyParams = {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
55
|
+
value: string;
|
|
56
|
+
type: string;
|
|
57
|
+
node: Node;
|
|
58
|
+
msg: NodeMessage;
|
|
61
59
|
};
|
|
62
60
|
/**
|
|
63
61
|
* Evaluates a node property in the Node-RED environment.
|
|
@@ -139,12 +137,12 @@ declare function evaluateNodeProperty(params: EvaluateNodePropertyParams): Promi
|
|
|
139
137
|
* @returns {object} An object containing utility functions for evaluating node properties.
|
|
140
138
|
*/
|
|
141
139
|
declare function useControllerNode(node: Node, msg: NodeMessage, opts?: {
|
|
142
|
-
|
|
140
|
+
typedSuffix: string;
|
|
143
141
|
}): {
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
142
|
+
evaluateNodeProperty: (value: EvaluateNodePropertyParams["value"], type: EvaluateNodePropertyParams["type"]) => Promise<[Error | undefined, any | undefined]>;
|
|
143
|
+
quickNodePropertyEval: <T extends object>(bag: T, term: keyof T, quickOpts?: {
|
|
144
|
+
strictDefaultValue: any;
|
|
145
|
+
}) => Promise<any>;
|
|
148
146
|
};
|
|
149
|
-
|
|
150
|
-
export { evaluateNodeProperty, getREDNode, splitBooleanOutputs, useControllerNode };
|
|
147
|
+
//#endregion
|
|
148
|
+
export { evaluateNodeProperty, getREDNode, splitBooleanOutputs, useControllerNode };
|
package/dist/utils/controller.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function e(e,t,n,r,i,a,o){try{var s=e[a](o),c=s.value}catch(e){n(e);return}s.done?t(c):Promise.resolve(c).then(r,i)}function t(t){return function(){var n=this,r=arguments;return new Promise(function(i,a){var o=t.apply(n,r);function s(t){e(o,i,a,s,c,`next`,t)}function c(t){e(o,i,a,s,c,`throw`,t)}s(void 0)})}}function n(e,t){return typeof e==`boolean`?e?[t,null]:[null,t]:(console.warn(`Payload must be a boolean (true or false).`),[null,null])}function r(e){return RED.nodes.getNode(e)}function i(e){return new Promise(t=>{try{RED.util.evaluateNodeProperty(e.value,e.type,e.node,e.msg,(e,n)=>{t([e,n])})}catch(e){t([e,void 0])}})}function a(e,n,r={typedSuffix:`Type`}){function a(t,r){return i({value:t,type:r,node:e,msg:n})}function o(e){return typeof e!=`boolean`&&e===``}function s(e,t){return c.apply(this,arguments)}function c(){return c=t(function*(e,t,n={strictDefaultValue:void 0}){let[,i]=yield a(e==null?void 0:e[t],e==null?void 0:e[`${String(t)}${r.typedSuffix}`]);return(n==null?void 0:n.strictDefaultValue)===void 0?i:o(i)?n.strictDefaultValue:i}),c.apply(this,arguments)}return{evaluateNodeProperty:a,quickNodePropertyEval:s}}export{i as evaluateNodeProperty,r as getREDNode,n as splitBooleanOutputs,a as useControllerNode};
|
package/dist/utils/index.cjs
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
exports.isUrl=p;exports.isValidIP=g;exports.isValidIPv4=l;exports.isValidIPv6=a;exports.merge=o;exports.tryit=s;
|
|
1
|
+
const e=Array.isArray,t=e=>!!(e&&e.constructor&&e.call&&e.apply),n=e=>!(!e||!e.then||!t(e.then)),r=(e,t,n=!1)=>e?e.slice().sort(n===!0?(e,n)=>t(n)-t(e):(e,n)=>t(e)-t(n)):[];function*i(e,n,r=e=>e,i=1){let a=t(r)?r:()=>r,o=n?e:0,s=n==null?e:n;for(let e=o;e<=s&&(yield a(e),!(e+i>s));e+=i);}const a=(e,t,n,r)=>Array.from(i(e,t,n,r)),o=(e,t)=>e?e.reduce((e,n)=>{let[r,i]=e;return t(n)?[[...r,n],i]:[r,[...i,n]]},[[],[]]):[[],[]],s=(e,t,n)=>!t&&!e?[]:t?e?n?e.reduce((e,r)=>{let i=t.find(e=>n(r)===n(e));return i?e.push(i):e.push(r),e},[]):e:[]:e;function c(e,t,n,r,i,a,o){try{var s=e[a](o),c=s.value}catch(e){n(e);return}s.done?t(c):Promise.resolve(c).then(r,i)}function l(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var a=e.apply(t,n);function o(e){c(a,r,i,o,s,`next`,e)}function s(e){c(a,r,i,o,s,`throw`,e)}o(void 0)})}}const u=function(){var e=l(function*(e,t,n){let r=n!==void 0;if(!r&&(e==null?void 0:e.length)<1)throw Error(`Cannot reduce empty array with no init value`);let i=r?e:e.slice(1),a=r?n:e[0];for(let[e,n]of i.entries())a=yield t(a,n,e);return a});return function(t,n,r){return e.apply(this,arguments)}}(),d=function(){var e=l(function*(e,t){if(!e)return[];let n=[],r=0;for(let i of e){let e=yield t(i,r++);n.push(e)}return n});return function(t,n){return e.apply(this,arguments)}}(),f=function(){var e=l(function*(e){let t=[],[n,r]=yield _(e)((e,n)=>{var r;return t.push({fn:e,rethrow:(r=n==null?void 0:n.rethrow)==null?!1:r})});for(let{fn:e,rethrow:r}of t){let[t]=yield _(e)(n);if(t&&r)throw t}if(n)throw n;return r});return function(t){return e.apply(this,arguments)}}();var p=class extends Error{constructor(e=[]){var t,n,r,i;super(),this.name=`AggregateError(${(t=(n=e.find(e=>e.name))==null?void 0:n.name)==null?``:t}...)`,this.message=`AggregateError with ${e.length} errors`,this.stack=(r=(i=e.find(e=>e.stack))==null?void 0:i.stack)==null?this.stack:r,this.errors=e}};const m=function(){var e=l(function*(e,t,n){let i=t.map((e,t)=>({index:t,item:e})),s=function(){var e=l(function*(e){let t=[];for(;;){let r=i.pop();if(!r)return e(t);let[a,o]=yield _(n)(r.item);t.push({error:a,result:o,index:r.index})}});return function(t){return e.apply(this,arguments)}}(),c=a(1,e).map(()=>new Promise(s)),[u,d]=o(r((yield Promise.all(c)).flat(),e=>e.index),e=>!!e.error);if(u.length>0)throw new p(u.map(e=>e.error));return d.map(e=>e.result)});return function(t,n,r){return e.apply(this,arguments)}}(),h=function(){var e=l(function*(e,t){var n,r;let a=(n=e==null?void 0:e.times)==null?3:n,o=e==null?void 0:e.delay,s=(r=e==null?void 0:e.backoff)==null?null:r;for(let e of i(1,a)){let[n,r]=yield _(t)(e=>{throw{_exited:e}});if(!n)return r;if(n._exited)throw n._exited;if(e===a)throw n;o&&(yield g(o)),s&&(yield g(s(e)))}});return function(t,n){return e.apply(this,arguments)}}(),g=e=>new Promise(t=>setTimeout(t,e)),_=e=>(...t)=>{try{let r=e(...t);return n(r)?r.then(e=>[void 0,e]).catch(e=>[e,void 0]):[void 0,r]}catch(e){return[e,void 0]}};function v(e){return/^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/.test(e)}function y(e){return/^(([0-9a-fA-F]{1,4}:){7}([0-9a-fA-F]{1,4}|:)|(([0-9a-fA-F]{1,4}:){1,6}:)|(([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2})|(([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3})|(([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4})|(([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5})|([0-9a-fA-F]{1,4}:)((:[0-9a-fA-F]{1,4}){1,6})|(:((:[0-9a-fA-F]{1,4}){1,7}|:))|(fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,})|(::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9])?[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9])?[0-9]))|(([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9])?[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9])?[0-9])))$/.test(e)}function b(e){return v(e)||y(e)}function x(e,{lenient:t=!1}={}){if(typeof e!=`string`)throw TypeError(`isUrl: Expected a string`);let n=e.trim();if(n.includes(` `))return!1;try{return new URL(n),!0}catch(e){return t?x(`https://${n}`):!1}}exports.isUrl=x,exports.isValidIP=b,exports.isValidIPv4=v,exports.isValidIPv6=y,exports.merge=s,exports.tryit=_;
|
package/dist/utils/index.d.cts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import { merge, tryit } from "radash";
|
|
2
|
+
|
|
3
|
+
//#region src/utils/validators.d.ts
|
|
2
4
|
|
|
3
5
|
/**
|
|
4
6
|
* Validates if the given string is a valid IPv4 address.
|
|
@@ -72,8 +74,10 @@ declare function isValidIP(ip: string): boolean;
|
|
|
72
74
|
* isUrl("invalid url"); // false
|
|
73
75
|
* ```
|
|
74
76
|
*/
|
|
75
|
-
declare function isUrl(string: string, {
|
|
76
|
-
|
|
77
|
+
declare function isUrl(string: string, {
|
|
78
|
+
lenient
|
|
79
|
+
}?: {
|
|
80
|
+
lenient?: boolean;
|
|
77
81
|
}): boolean;
|
|
78
|
-
|
|
79
|
-
export { isUrl, isValidIP, isValidIPv4, isValidIPv6 };
|
|
82
|
+
//#endregion
|
|
83
|
+
export { isUrl, isValidIP, isValidIPv4, isValidIPv6, merge, tryit };
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import { merge, tryit } from "radash";
|
|
2
|
+
|
|
3
|
+
//#region src/utils/validators.d.ts
|
|
2
4
|
|
|
3
5
|
/**
|
|
4
6
|
* Validates if the given string is a valid IPv4 address.
|
|
@@ -72,8 +74,10 @@ declare function isValidIP(ip: string): boolean;
|
|
|
72
74
|
* isUrl("invalid url"); // false
|
|
73
75
|
* ```
|
|
74
76
|
*/
|
|
75
|
-
declare function isUrl(string: string, {
|
|
76
|
-
|
|
77
|
+
declare function isUrl(string: string, {
|
|
78
|
+
lenient
|
|
79
|
+
}?: {
|
|
80
|
+
lenient?: boolean;
|
|
77
81
|
}): boolean;
|
|
78
|
-
|
|
79
|
-
export { isUrl, isValidIP, isValidIPv4, isValidIPv6 };
|
|
82
|
+
//#endregion
|
|
83
|
+
export { isUrl, isValidIP, isValidIPv4, isValidIPv6, merge, tryit };
|
package/dist/utils/index.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export{s as isUrl,A as isValidIP,a as isValidIPv4,i as isValidIPv6};
|
|
1
|
+
Array.isArray;const e=e=>!!(e&&e.constructor&&e.call&&e.apply),t=t=>!(!t||!t.then||!e(t.then)),n=(e,t,n=!1)=>e?e.slice().sort(n===!0?(e,n)=>t(n)-t(e):(e,n)=>t(e)-t(n)):[];function*r(t,n,r=e=>e,i=1){let a=e(r)?r:()=>r,o=n?t:0,s=n==null?t:n;for(let e=o;e<=s&&(yield a(e),!(e+i>s));e+=i);}const i=(e,t,n,i)=>Array.from(r(e,t,n,i)),a=(e,t)=>e?e.reduce((e,n)=>{let[r,i]=e;return t(n)?[[...r,n],i]:[r,[...i,n]]},[[],[]]):[[],[]],o=(e,t,n)=>!t&&!e?[]:t?e?n?e.reduce((e,r)=>{let i=t.find(e=>n(r)===n(e));return i?e.push(i):e.push(r),e},[]):e:[]:e;function s(e,t,n,r,i,a,o){try{var s=e[a](o),c=s.value}catch(e){n(e);return}s.done?t(c):Promise.resolve(c).then(r,i)}function c(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var a=e.apply(t,n);function o(e){s(a,r,i,o,c,`next`,e)}function c(e){s(a,r,i,o,c,`throw`,e)}o(void 0)})}}(function(){var e=c(function*(e,t,n){let r=n!==void 0;if(!r&&(e==null?void 0:e.length)<1)throw Error(`Cannot reduce empty array with no init value`);let i=r?e:e.slice(1),a=r?n:e[0];for(let[e,n]of i.entries())a=yield t(a,n,e);return a});return function(t,n,r){return e.apply(this,arguments)}})(),function(){var e=c(function*(e,t){if(!e)return[];let n=[],r=0;for(let i of e){let e=yield t(i,r++);n.push(e)}return n});return function(t,n){return e.apply(this,arguments)}}(),function(){var e=c(function*(e){let t=[],[n,r]=yield d(e)((e,n)=>{var r;return t.push({fn:e,rethrow:(r=n==null?void 0:n.rethrow)==null?!1:r})});for(let{fn:e,rethrow:r}of t){let[t]=yield d(e)(n);if(t&&r)throw t}if(n)throw n;return r});return function(t){return e.apply(this,arguments)}}();var l=class extends Error{constructor(e=[]){var t,n,r,i;super(),this.name=`AggregateError(${(t=(n=e.find(e=>e.name))==null?void 0:n.name)==null?``:t}...)`,this.message=`AggregateError with ${e.length} errors`,this.stack=(r=(i=e.find(e=>e.stack))==null?void 0:i.stack)==null?this.stack:r,this.errors=e}};(function(){var e=c(function*(e,t,r){let o=t.map((e,t)=>({index:t,item:e})),s=function(){var e=c(function*(e){let t=[];for(;;){let n=o.pop();if(!n)return e(t);let[i,a]=yield d(r)(n.item);t.push({error:i,result:a,index:n.index})}});return function(t){return e.apply(this,arguments)}}(),u=i(1,e).map(()=>new Promise(s)),[f,p]=a(n((yield Promise.all(u)).flat(),e=>e.index),e=>!!e.error);if(f.length>0)throw new l(f.map(e=>e.error));return p.map(e=>e.result)});return function(t,n,r){return e.apply(this,arguments)}})(),function(){var e=c(function*(e,t){var n,i;let a=(n=e==null?void 0:e.times)==null?3:n,o=e==null?void 0:e.delay,s=(i=e==null?void 0:e.backoff)==null?null:i;for(let e of r(1,a)){let[n,r]=yield d(t)(e=>{throw{_exited:e}});if(!n)return r;if(n._exited)throw n._exited;if(e===a)throw n;o&&(yield u(o)),s&&(yield u(s(e)))}});return function(t,n){return e.apply(this,arguments)}}();const u=e=>new Promise(t=>setTimeout(t,e)),d=e=>(...n)=>{try{let r=e(...n);return t(r)?r.then(e=>[void 0,e]).catch(e=>[e,void 0]):[void 0,r]}catch(e){return[e,void 0]}};function f(e){return/^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/.test(e)}function p(e){return/^(([0-9a-fA-F]{1,4}:){7}([0-9a-fA-F]{1,4}|:)|(([0-9a-fA-F]{1,4}:){1,6}:)|(([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2})|(([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3})|(([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4})|(([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5})|([0-9a-fA-F]{1,4}:)((:[0-9a-fA-F]{1,4}){1,6})|(:((:[0-9a-fA-F]{1,4}){1,7}|:))|(fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,})|(::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9])?[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9])?[0-9]))|(([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9])?[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9])?[0-9])))$/.test(e)}function m(e){return f(e)||p(e)}function h(e,{lenient:t=!1}={}){if(typeof e!=`string`)throw TypeError(`isUrl: Expected a string`);let n=e.trim();if(n.includes(` `))return!1;try{return new URL(n),!0}catch(e){return t?h(`https://${n}`):!1}}export{h as isUrl,m as isValidIP,f as isValidIPv4,p as isValidIPv6,o as merge,d as tryit};
|