UNPKG

n8n-editor-ui

Version:

Workflow Editor UI for n8n

2 lines 2.71 kB
(function(){try{var e=typeof window<`u`?window:typeof global<`u`?global:typeof globalThis<`u`?globalThis:typeof self<`u`?self:{};e.SENTRY_RELEASE={id:`n8n@2.13.4`}}catch{}})();try{(function(){var e=typeof window<`u`?window:typeof global<`u`?global:typeof globalThis<`u`?globalThis:typeof self<`u`?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]=`a1957442-5f98-4985-a3f3-3fe15d445394`,e._sentryDebugIdIdentifier=`sentry-dbid-a1957442-5f98-4985-a3f3-3fe15d445394`)})()}catch{}import{ci as e,mi as t,ui as n}from"./users.store-BHWXXawf.js";import{K as r,ho as i}from"./constants-CIP7tKq1.js";function a(e,n){let r=[],i=new Map(n.map(e=>[e.name,e.id]));return Object.keys(e).forEach(n=>{let a=i.get(n)??``;Object.keys(e[n]).forEach(o=>{e[n][o]?.forEach((e,s)=>{e?.forEach(e=>{let u=e.node,d=i.get(u)??``,f=e.type,p=e.index,m=c({mode:t.Output,type:o,index:s}),h=c({mode:t.Input,type:f,index:p}),g=l({source:a,sourceHandle:m,target:d,targetHandle:h});a&&d&&r.push({id:g,source:a,target:d,sourceHandle:m,targetHandle:h,data:{source:{node:n,index:s,type:o},target:{node:u,index:p,type:f}}})})})})}),r}function o(e,n,r){return{source:e.id,sourceHandle:c({mode:t.Output,type:r[0].type,index:r[0].index}),target:n.id,targetHandle:c({mode:t.Input,type:r[1].type,index:r[1].index})}}function s(r){let[a,o,s]=(r??``).split(`/`),c=e(a)?a:t.Output,l=n(o)?o:i.Main,u=parseInt(s,10);return isNaN(u)&&(u=0),{mode:c,type:l,index:u}}function c({mode:e,type:t=i.Main,index:n=0}){return`${e}/${t}/${n}`}function l(e){return`[${e.source}/${e.sourceHandle}][${e.target}/${e.targetHandle}]`}function u(e,t,n){let r=e?.name??``,{type:i,index:a}=s(n.sourceHandle),o=t?.name??``,{type:c,index:l}=s(n.targetHandle);return[{node:r,type:i,index:a},{node:o,type:c,index:l}]}function d(e,t=[]){return typeof e==`string`?(console.warn(`Node endpoints have not been evaluated`,e),[]):e.map((r,a)=>{let o=typeof r==`string`?r:r.type,s=n(o)?o:i.Main,c=typeof r==`string`?t[a]:r.displayName,l=e.slice(0,a+1).filter(e=>(typeof e==`string`?e:e.type)===s).length-1,u=typeof r==`string`?!1:r.required,d=typeof r==`string`?void 0:r.maxConnections;return{type:s,index:l,label:c,...d?{maxConnections:d}:{},...u?{required:u}:{}}})}function f(e,t){return!(e.x+e.width<=t.x||t.x+t.width<=e.x||e.y+e.height<=t.y||t.y+t.height<=e.y)}function p(e,t=0){let n=[...e],r=n.length-t,i=4-t-r;if(n.length<4)for(let e=0;e<i;e++)n.splice(t+e,0,null);return n}function m(e){return[`INPUT`,`TEXTAREA`].includes(e.tagName)||e.closest(`[contenteditable]`)!==null||e.closest(`.ignore-key-press-canvas`)!==null}export{o as a,s as c,u as i,m as l,c as n,a as o,p as r,d as s,f as t}; //# sourceMappingURL=canvas.utils-BMxgA7cX.js.map