n8n-editor-ui
Version:
Workflow Editor UI for n8n
2 lines • 528 kB
JavaScript
!function(){try{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{}).SENTRY_RELEASE={id:"n8n@2.16.1"}}catch(e){}}(),System.register(["./chunk-legacy-Dz3fjYb5.js","./vue.runtime.esm-bundler-legacy-BW6xDdqj.js","./core-legacy-VD8c7QJ-.js","./src-legacy-B67uuxhB.js","./get-legacy-CLCnFf3e.js","./constants-legacy-2_ytuuS3.js","./merge-legacy-CqehwKv-.js","./useRootStore-legacy-CC08el-l.js","./settings.store-legacy-I6rZOvfF.js","./dateformat-legacy-BGLHQd3J.js","./useDebounce-legacy-CRJGWVMg.js","./_baseOrderBy-legacy-5zQn-Pv2.js"],(function(e,t){var n,o,a,i,r,s,l,u,c,d,p,f,m,h,y,v,g,w,b,k,x,I,N,S,T,E,A,C,_,P,D,O,M,L,j,$,B,V,R,F,W,U,z,H,G,Y,X,q,J,K,Z,Q,ee,te,ne,oe,ae,ie,re,se,le,ue,ce,de,pe,fe,me,he,ye,ve,ge,we,be,ke,xe,Ie,Ne,Se,Te,Ee,Ae,Ce,_e,Pe,De,Oe,Me,Le,je,$e,Be,Ve,Re,Fe,We,Ue,ze,He,Ge,Ye,Xe,qe,Je,Ke,Ze,Qe,et,tt,nt,ot,at,it,rt,st,lt,ut,ct,dt,pt,ft,mt,ht,yt,vt,gt,wt,bt,kt,xt,It,Nt,St,Tt,Et,At,Ct,_t,Pt,Dt,Ot,Mt,Lt,jt,$t,Bt,Vt,Rt,Ft,Wt,Ut,zt,Ht,Gt,Yt,Xt,qt,Jt,Kt,Zt,Qt,en,tn,nn,on,an,rn,sn,ln,un,cn,dn,pn,fn,mn,hn,yn,vn,gn,wn,bn,kn,xn,In,Nn,Sn,Tn,En,An,Cn,_n,Pn,Dn,On,Mn,Ln,jn,$n,Bn,Vn,Rn,Fn,Wn,Un,zn,Hn,Gn,Yn,Xn,qn,Jn,Kn,Zn,Qn,eo,to,no,oo,ao,io,ro,so,lo,uo,co,po,fo,mo,ho,yo,vo,go,wo,bo,ko,xo,Io,No,So,To,Eo,Ao,Co,_o,Po,Do,Oo,Mo,Lo,jo,$o,Bo,Vo,Ro,Fo,Wo,Uo,zo,Ho,Go,Yo,Xo,qo,Jo,Ko,Zo,Qo,ea,ta,na,oa,aa,ia,ra,sa,la,ua,ca,da,pa,fa,ma,ha,ya,va,ga,wa,ba,ka,xa,Ia,Na,Sa,Ta,Ea,Aa,Ca,_a,Pa,Da,Oa,Ma,La,ja,$a,Ba,Va,Ra,Fa,Wa,Ua,za,Ha,Ga,Ya,Xa,qa,Ja,Ka,Za,Qa,ei,ti,ni,oi,ai,ii,ri,si,li,ui,ci,di,pi,fi,mi,hi,yi,vi,gi,wi,bi,ki,xi,Ii,Ni,Si,Ti,Ei,Ai,Ci,_i,Pi,Di,Oi,Mi,Li,ji,$i,Bi,Vi,Ri,Fi,Wi,Ui,zi,Hi,Gi,Yi,Xi,qi,Ji,Ki,Zi,Qi,er,tr,nr,or,ar,ir,rr,sr,lr,ur,cr,dr,pr,fr,mr,hr,yr,vr,gr,wr,br,kr,xr,Ir,Nr,Sr,Tr,Er,Ar,Cr,_r,Pr,Dr,Or,Mr,Lr,jr,$r,Br,Vr,Rr,Fr,Wr,Ur,zr,Hr,Gr,Yr,Xr,qr,Jr,Kr,Zr,Qr,es,ts,ns,os,as,is,rs,ss,ls,us,cs,ds,ps,fs,ms,hs,ys,vs,gs,ws,bs,ks,xs,Is,Ns,Ss,Ts,Es,As,Cs,_s,Ps,Ds,Os,Ms,Ls,js,$s,Bs,Vs,Rs,Fs,Ws,Us,zs,Hs,Gs,Ys,Xs,qs,Js,Ks,Zs,Qs,el,tl,nl,ol,al,il,rl,sl,ll,ul,cl,dl,pl,fl,ml,hl,yl,vl,gl,wl,bl,kl,xl,Il,Nl,Sl,Tl,El,Al,Cl,_l,Pl,Dl,Ol,Ml,Ll,jl,$l,Bl,Vl,Rl,Fl,Wl,Ul,zl,Hl,Gl,Yl,Xl,ql,Jl,Kl,Zl,Ql,eu,tu,nu,ou,au,iu,ru,su,lu,uu,cu,du,pu,fu,mu,hu,yu,vu,gu,wu,bu,ku,xu,Iu,Nu,Su,Tu,Eu,Au,Cu,_u,Pu,Du,Ou,Mu,Lu,ju,$u,Bu,Vu,Ru,Fu,Wu,Uu,zu,Hu,Gu,Yu,Xu,qu,Ju,Ku,Zu,Qu,ec,tc,nc,oc,ac,ic,rc,sc,lc,uc,cc,dc,pc,fc,mc,hc,yc,vc,gc,wc,bc,kc,xc,Ic,Nc,Sc,Tc,Ec,Ac,Cc,_c,Pc,Dc,Oc,Mc,Lc,jc,$c,Bc,Vc,Rc,Fc,Wc,Uc,zc,Hc,Gc,Yc,Xc,qc,Jc,Kc,Zc,Qc,ed,td,nd,od,ad,id,rd,sd,ld,ud,cd,dd,pd,fd,md,hd,yd,vd,gd,wd,bd,kd,xd,Id,Nd,Sd,Td,Ed,Ad,Cd,_d,Pd,Dd,Od,Md,Ld,jd,$d,Bd,Vd,Rd,Fd,Wd,Ud,zd,Hd,Gd,Yd,Xd,qd,Jd,Kd,Zd,Qd,ep,tp,np,op,ap,ip,rp,sp,lp,up,cp,dp,pp,fp,mp,hp,yp,vp,gp,wp,bp,kp,xp,Ip,Np,Sp,Tp,Ep,Ap,Cp,_p,Pp,Dp,Op,Mp,Lp,jp,$p,Bp,Vp,Rp,Fp,Wp,Up,zp,Hp,Gp,Yp,Xp,qp,Jp,Kp,Zp,Qp,ef,tf,nf,of,af,rf,sf,lf,uf,cf,df,pf,ff,mf,hf,yf,vf,gf,wf,bf,kf,xf,If,Nf,Sf,Tf,Ef,Af,Cf,_f,Pf,Df,Of,Mf,Lf,jf,$f,Bf,Vf,Rf,Ff,Wf,Uf,zf,Hf,Gf,Yf,Xf,qf,Jf,Kf,Zf,Qf,em,tm,nm,om,am,im,rm,sm,lm,um,cm,dm,pm,fm,mm,hm,ym,vm,gm,wm,bm,km,xm,Im,Nm,Sm,Tm,Em,Am,Cm,_m,Pm,Dm,Om,Mm,Lm,jm,$m,Bm,Vm,Rm,Fm,Wm,Um,zm,Hm,Gm,Ym,Xm,qm,Jm,Km,Zm,Qm,eh,th,nh,oh,ah,ih,rh,sh,lh,uh,ch,dh,ph,fh,mh,hh,yh,vh,gh;function wh(e){let t;const n=v(!1),o=I({...e,originalPosition:"",originalOverflow:"",visible:!1});function a(){var e,t;null==(t=null==(e=s.$el)?void 0:e.parentNode)||t.removeChild(s.$el)}function i(){if(!n.value)return;const e=o.parent;n.value=!1,e.vLoadingAddClassList=void 0,function(){const e=o.parent,t=s.ns;if(!e.vLoadingAddClassList){let n=e.getAttribute("loading-number");n=Number.parseInt(n)-1,n?e.setAttribute("loading-number",n.toString()):(rt(e,t.bm("parent","relative")),e.removeAttribute("loading-number")),rt(e,t.bm("parent","hidden"))}a(),r.unmount()}()}const r=q(x({name:"ElLoading",setup(e,{expose:t}){const{ns:n,zIndex:a}=et("loading");return t({ns:n,zIndex:a}),()=>{const e=o.spinner||o.svg,t=w("svg",{class:"circular",viewBox:o.svgViewBox?o.svgViewBox:"0 0 50 50",...e?{innerHTML:e}:{}},[w("circle",{class:"path",cx:"25",cy:"25",r:"20",fill:"none"})]),a=o.text?w("p",{class:n.b("text")},[o.text]):void 0;return w(ne,{name:n.b("fade"),onAfterLeave:i},{default:ve((()=>[z(Z("div",{style:{backgroundColor:o.background||""},class:[n.b("mask"),o.customClass,o.fullscreen?"is-fullscreen":""]},[w("div",{class:n.b("spinner")},[t,a])]),[[ie,o.visible]])]))})}}})),s=r.mount(document.createElement("div"));return{...L(o),setText:function(e){o.text=e},removeElLoadingChild:a,close:function(){var a;e.beforeClose&&!e.beforeClose()||(n.value=!0,clearTimeout(t),t=window.setTimeout(i,400),o.visible=!1,null==(a=e.closed)||a.call(e))},handleAfterLeave:i,vm:s,get $el(){return s.$el}}}function bh(e,t,n,o,i,s){const l=U("el-icon"),u=U("close"),d=U("el-input"),p=U("el-button"),f=U("el-focus-trap"),h=U("el-overlay");return a(),fe(ne,{name:"fade-in-linear",onAfterLeave:t[11]||(t[11]=t=>e.$emit("vanish")),persisted:""},{default:ve((()=>[z(Z(h,{"z-index":e.zIndex,"overlay-class":[e.ns.is("message-box"),e.modalClass],mask:e.modal},{default:ve((()=>[c("div",{role:"dialog","aria-label":e.title,"aria-modal":"true","aria-describedby":e.showInput?void 0:e.contentId,class:F(`${e.ns.namespace.value}-overlay-message-box`),onClick:t[8]||(t[8]=(...t)=>e.overlayEvent.onClick&&e.overlayEvent.onClick(...t)),onMousedown:t[9]||(t[9]=(...t)=>e.overlayEvent.onMousedown&&e.overlayEvent.onMousedown(...t)),onMouseup:t[10]||(t[10]=(...t)=>e.overlayEvent.onMouseup&&e.overlayEvent.onMouseup(...t))},[Z(f,{loop:"",trapped:e.visible,"focus-trap-el":e.rootRef,"focus-start-el":e.focusStartRef,onReleaseRequested:e.onCloseRequested},{default:ve((()=>[c("div",{ref:"rootRef",class:F([e.ns.b(),e.customClass,e.ns.is("draggable",e.draggable),{[e.ns.m("center")]:e.center}]),style:ye(e.customStyle),tabindex:"-1",onClick:t[7]||(t[7]=X((()=>{}),["stop"]))},[null!==e.title&&void 0!==e.title?(a(),m("div",{key:0,ref:"headerRef",class:F(e.ns.e("header"))},[c("div",{class:F(e.ns.e("title"))},[e.iconComponent&&e.center?(a(),fe(l,{key:0,class:F([e.ns.e("status"),e.typeClass])},{default:ve((()=>[(a(),fe(de(e.iconComponent)))])),_:1},8,["class"])):P("v-if",!0),c("span",null,_(e.title),1)],2),e.showClose?(a(),m("button",{key:0,type:"button",class:F(e.ns.e("headerbtn")),"aria-label":e.t("el.messagebox.close"),onClick:t[0]||(t[0]=t=>e.handleAction(e.distinguishCancelAndClose?"close":"cancel")),onKeydown:t[1]||(t[1]=te(X((t=>e.handleAction(e.distinguishCancelAndClose?"close":"cancel")),["prevent"]),["enter"]))},[Z(l,{class:F(e.ns.e("close"))},{default:ve((()=>[Z(u)])),_:1},8,["class"])],42,_r)):P("v-if",!0)],2)):P("v-if",!0),c("div",{id:e.contentId,class:F(e.ns.e("content"))},[c("div",{class:F(e.ns.e("container"))},[e.iconComponent&&!e.center&&e.hasMessage?(a(),fe(l,{key:0,class:F([e.ns.e("status"),e.typeClass])},{default:ve((()=>[(a(),fe(de(e.iconComponent)))])),_:1},8,["class"])):P("v-if",!0),e.hasMessage?(a(),m("div",{key:1,class:F(e.ns.e("message"))},[K(e.$slots,"default",{},(()=>[e.dangerouslyUseHTMLString?(a(),fe(de(e.showInput?"label":"p"),{key:1,for:e.showInput?e.inputId:void 0,innerHTML:e.message},null,8,["for","innerHTML"])):(a(),fe(de(e.showInput?"label":"p"),{key:0,for:e.showInput?e.inputId:void 0},{default:ve((()=>[r(_(e.dangerouslyUseHTMLString?"":e.message),1)])),_:1},8,["for"]))]))],2)):P("v-if",!0)],2),z(c("div",{class:F(e.ns.e("input"))},[Z(d,{id:e.inputId,ref:"inputRef",modelValue:e.inputValue,"onUpdate:modelValue":t[2]||(t[2]=t=>e.inputValue=t),type:e.inputType,placeholder:e.inputPlaceholder,"aria-invalid":e.validateError,class:F({invalid:e.validateError}),onKeydown:te(e.handleInputEnter,["enter"])},null,8,["id","modelValue","type","placeholder","aria-invalid","class","onKeydown"]),c("div",{class:F(e.ns.e("errormsg")),style:ye({visibility:e.editorErrorMessage?"visible":"hidden"})},_(e.editorErrorMessage),7)],2),[[ie,e.showInput]])],10,Pr),c("div",{class:F(e.ns.e("btns"))},[e.showCancelButton?(a(),fe(p,{key:0,loading:e.cancelButtonLoading,class:F([e.cancelButtonClass]),round:e.roundButton,size:e.btnSize,onClick:t[3]||(t[3]=t=>e.handleAction("cancel")),onKeydown:t[4]||(t[4]=te(X((t=>e.handleAction("cancel")),["prevent"]),["enter"]))},{default:ve((()=>[r(_(e.cancelButtonText||e.t("el.messagebox.cancel")),1)])),_:1},8,["loading","class","round","size"])):P("v-if",!0),z(Z(p,{ref:"confirmRef",type:"primary",loading:e.confirmButtonLoading,class:F([e.confirmButtonClasses]),round:e.roundButton,disabled:e.confirmButtonDisabled,size:e.btnSize,onClick:t[5]||(t[5]=t=>e.handleAction("confirm")),onKeydown:t[6]||(t[6]=te(X((t=>e.handleAction("confirm")),["prevent"]),["enter"]))},{default:ve((()=>[r(_(e.confirmButtonText||e.t("el.messagebox.confirm")),1)])),_:1},8,["loading","class","round","disabled","size"]),[[ie,e.showConfirmButton]])],2)],6)])),_:3},8,["trapped","focus-trap-el","focus-start-el","onReleaseRequested"])],42,Cr)])),_:3},8,["z-index","overlay-class","mask"]),[[ie,e.visible]])])),_:3})}function kh(e,t=null){if(!Ye)return Promise.reject();let n;return re(e)||l(e)?e={message:e}:n=e.callback,new Promise(((o,a)=>{const i=$r(e,null!=t?t:kh._context);Or.set(i,{options:e,callback:n,resolve:o,reject:a})}))}function xh(){for(const e of Object.values(qr))e.forEach((({vm:e})=>{e.component.exposed.visible.value=!1}))}function Ih(e){return(0,es.default)(e,{onTagAttr:(e,t,n)=>{if("img"===e&&"src"===t){const e=null!==n.split("#")[0].match(/\.(jpeg|jpg|gif|png|webp)$/)&&n.startsWith("/static/");if(!n.startsWith("https://")&&!e)return""}if(Vt.includes(t)||t.startsWith("data-"))return"href"!==t||n.match(/^https?:\/\//gm)||n.startsWith("/")?`${t}="${(0,es.escapeAttrValue)(n)}"`:""},onTag:e=>{if(!Lt.includes(e))return""}})}function Nh(e){return e?"version"in e?function(e){let t=[];const{version:n,...o}=e;if(0===Object.keys(o).length)return[];const a=e[ls],i=e[ss],r="automationGoal"in e?e[cs]:void 0;let s=null;if("codingSkill"in e&&e.codingSkill&&(s=parseInt(e[us],10),s=isNaN(s)?0:s),t="ecommerce"===i?t.concat(Lo):"msp"===i?t.concat(_o):("personal"===i||"other"===r||"not-sure-yet"===r)&&null!==s&&s>=4?t.concat(da):("personal"===i||"other"===r||"not-sure-yet"===r)&&null!==s&&s<3?t.concat(tn):"customer-integrations"===r?t.concat(da):"customer-support"===r||"finance-accounting"===r?t.concat(Ma):"sales-marketing"===r?t.concat(go):"hr"===r?t.concat(Po):"operations"===r?t.concat(tn):"product"===r?t.concat(un):"security"===r?t.concat(Ko):t.concat(da),t=null!==s&&s>=4?t.concat(Qt):t.concat(Qo),t=null!==s&&s<3?t.concat(Eo):t.concat(ga),"500-999"===a||"1000+"===a)switch(r){case ds:t=t.concat(qo);break;case ps:t=t.concat(co);break;case hs:t=t.concat(fa);break;case"hr":t=t.concat(Wn);break;case ms:t=t.concat(Mo);break;case fs:t=t.concat(Vo);break;case ys:t=t.concat(nn);break;default:t=t.concat(Na)}else switch(r){case ds:t=t.concat(qo);break;case ps:t=t.concat(co);break;case fs:t=t.concat(jn);break;case"hr":t=t.concat(vn);break;case ms:t=t.concat(Mo);break;case hs:t=t.concat(va);break;case ys:t=t.concat(nn);break;default:t=t.concat(Na)}return t=t.concat(qn),t}(e):function(e){const t=e[ls],n=e[rs];function o(e){return Array.isArray(n)?n.includes(e):n===e}const a=!n||0===n.length;if(null===t&&a&&null===e.codingSkill)return[];let i=null;e.codingSkill&&(i=parseInt(e[us],10),i=isNaN(i)?0:i);let r=[];return r=o("IT-Engineering")?r.concat(da):r.concat(tn),r=null!==i&&i>=4?r.concat(Qt):r.concat(Qo),r=null!==i&&i<3?r.concat(Eo):r.concat(ga),r="500-999"===t||"1000+"===t?o("sales-businessDevelopment")?r.concat(fa):o("security")?r.concat([nn,qo]):o("product")?r.concat([_o,Gn]):o("IT-Engineering")?r.concat([la,qo]):r.concat([Mn,Ft]):o("sales-businessDevelopment")?r.concat(Gt):o("security")?r.concat([Va,qo]):o("product")?r.concat([_o,Tt]):o("IT-Engineering")?r.concat([It,qo]):o("finance")?r.concat([Aa,jn,Vo]):r.concat([zn,Na]),r=r.concat(qn),r}(e):[]}async function Sh(e,t){const n=await Ja(e,"GET","/workflows/new",t);return{name:n.name,settings:n.defaultSettings}}async function Th(e,t){return await Ja(e,"GET",`/workflows/${t}`)}async function Eh(e,t,n,o){return await ti(e,"GET","/workflows",{includeScopes:!0,...t?{filter:t}:{},...n||{},...o?{select:JSON.stringify(o)}:{}})}async function Ah(e,t,n,o,a){return await ti(e,"GET","/workflows",{includeScopes:!0,includeFolders:o,onlySharedWithMe:a,...t?{filter:t}:{},...n||{}})}function Ch(e){return"object"==typeof e&&null!==e&&!(e instanceof Date)}function _h(e){return Ch(e)&&!Array.isArray(e)}function Ph(e){return!!_h(e)&&Object.keys(e).includes("json")}function Dh(e){return void 0===e?0:new Blob(["string"==typeof e?e:JSON.stringify(e)]).size}function Oh(e,t,n){return e.length<=t?e:`${e.slice(0,t-n)}...${e.slice(e.length-n,e.length)}`}function Mh(e){return null!=e}async function Lh(e){return await async function(e,t=5,n=500){for(let o=0;o<t;o++){const t=await ei.get(e,{withCredentials:!0});if("object"==typeof t.data&&null!==t.data&&Array.isArray(t.data))return t.data;await Xt(n*o)}throw new Error("Could not fetch credential types")}(e+"types/credentials.json")}async function jh(e,t={}){const{filter:n,includeScopes:o,onlySharedWithMe:a,includeGlobal:i,externalSecretsStore:r}=t;return await Ja(e,"GET","/credentials",{...o?{includeScopes:o}:{},includeData:!0,...n?{filter:n}:{},...a?{onlySharedWithMe:a}:{},..."boolean"==typeof i?{includeGlobal:i}:{},...r?{externalSecretsStore:r}:{}})}function $h(){const e=v(null),t=v(null),n=C((()=>null!==e.value)),o=we();return{active:n,activeVersionId:S(e),activeVersion:S(t),setActiveState:function(n){!function(n,a=tl.UPDATE){e.value=n.activeVersionId,t.value=n.activeVersion,o.trigger({action:a,payload:n})}(n)},onActiveChange:o.on}}function Bh(){const e=v(null),t=we();return{homeProject:S(e),setHomeProject:function(n){!function(n,o=tl.UPDATE){e.value=n,t.trigger({action:o,payload:n})}(n)},onHomeProjectChange:t.on}}function Vh(){const e=v(""),t=we();return{checksum:S(e),setChecksum:function(n){!function(n,o=tl.UPDATE){e.value=n,t.trigger({action:o,payload:{checksum:n}})}(n)},onChecksumChange:t.on}}function Rh(){const e=v({}),t=we();return{pinData:S(e),setPinData:function(n){var o;!function(n,o=tl.UPDATE){e.value=n,t.trigger({action:o,payload:{pinData:n}})}((o=n,Object.keys(o).reduce(((e,t)=>(e[t]=o[t].map((e=>Ph(e)?e:{json:e})),e)),{})))},pinNodeData:function(n,o){!function(n,o){const a=e.value[n]?tl.UPDATE:tl.ADD;e.value={...e.value,[n]:o},t.trigger({action:a,payload:{nodeName:n,data:o}})}(n,function(e){return Array.isArray(e)||(e=[e]),e.map((e=>{if(Ph(e)){const{json:t,binary:n,pairedItem:o}=e;return{json:t,...n&&{binary:n},...void 0!==o&&{pairedItem:o}}}return{json:e}}))}(o))},unpinNodeData:function(n){!function(n){const{[n]:o,...a}=e.value;e.value=a,t.trigger({action:tl.DELETE,payload:{nodeName:n,data:void 0}})}(n)},renamePinDataNode:function(n,o){!function(n,o){if(e.value[n]){const{[n]:t,...a}=e.value;e.value={...a,[o]:t}}Object.values(e.value).flatMap((e=>e.flatMap((e=>Array.isArray(e.pairedItem)?e.pairedItem:[e.pairedItem])))).forEach((e=>{"number"!=typeof e&&e?.sourceOverwrite?.previousNode===n&&(e.sourceOverwrite.previousNode=o)})),t.trigger({action:tl.UPDATE,payload:{nodeName:o,data:e.value[o]}})}(n,o)},getPinDataSnapshot:function(){return{...e.value}},getNodePinData:function(t){return e.value[t]},onPinnedDataChange:t.on}}function Fh(){const e=v([]),t=we();return{scopes:S(e),setScopes:function(n){!function(n,o=tl.UPDATE){e.value=n,t.trigger({action:o,payload:{scopes:n}})}(n)},onScopesChange:t.on}}function Wh(){const e=v([]),t=we();function n(n,o=tl.UPDATE){e.value=n,t.trigger({action:o,payload:{tags:n}})}return{tags:S(e),setTags:function(e){n(e)},addTags:function(t){const o=new Set([...e.value,...t]);n(Array.from(o),tl.ADD)},removeTag:function(n){!function(n){e.value=e.value.filter((e=>e!==n)),t.trigger({action:tl.DELETE,payload:{tags:e.value}})}(n)},onTagsChange:t.on}}function Uh(){const e=v(!1),t=we();return{isArchived:S(e),setIsArchived:function(n){!function(n,o=tl.UPDATE){e.value=n,t.trigger({action:o,payload:{isArchived:n}})}(n)},onIsArchivedChange:t.on}}function zh(){const e=v(-1),t=v(-1),n=we(),o=we();return{createdAt:S(e),updatedAt:S(t),setCreatedAt:function(t){!function(t,o=tl.UPDATE){e.value=t,n.trigger({action:o,payload:{createdAt:t}})}(t)},setUpdatedAt:function(e){!function(e,n=tl.UPDATE){t.value=e,o.trigger({action:n,payload:{updatedAt:e}})}(e)},onCreatedAtChange:n.on,onUpdatedAtChange:o.on}}function Hh(){const e=v(null),t=we();return{parentFolder:S(e),setParentFolder:function(n){!function(n,o=tl.UPDATE){e.value=n,t.trigger({action:o,payload:n})}(n)},onParentFolderChange:t.on}}function Gh(){const e=v({}),t=we();return{usedCredentials:S(e),setUsedCredentials:function(n){!function(n,o=tl.UPDATE){e.value=n,t.trigger({action:o,payload:{usedCredentials:n}})}(n.reduce(((e,t)=>(e[t.id]=t,e)),{}))},onUsedCredentialsChange:t.on}}function Yh(e){const t=rh(),n=we(),o=we();function a(e,n){if(-1===e)return!1;const o=t.workflow.nodes[e],a=!(0,ul.default)((0,ll.default)(o,Object.keys(n)),n);return a&&(Object.assign(o,n),t.workflow.nodes[e]=o,t.workflowObject.setNodes(t.workflow.nodes)),a}function i(e,n){const i=t.workflow.nodes.findIndex((t=>t.name===e.name));if(-1===i)throw new Error(`Node with the name "${e.name}" could not be found to set parameter.`);const{name:r,parameters:s}=t.workflow.nodes[i];a(i,{parameters:n&&_h(e.value)?{...s,...e.value}:e.value})&&(o.trigger(),t.nodeMetadata[r].parametersLastUpdatedAt=Date.now())}function r(e){const n=t.workflow.nodes.findIndex((t=>t.name===e.name));if(-1===n||!e.key)throw new Error(`Node with the name "${e.name}" could not be found to set parameter.`);const i=a(n,{[e.key]:e.value});i&&o.trigger(),i&&!["position","notes","notesInFlow"].includes(e.key)&&(t.nodeMetadata[t.workflow.nodes[n].name].parametersLastUpdatedAt=Date.now())}return{allNodes:C((()=>t.allNodes)),nodesByName:C((()=>t.nodesByName)),canvasNames:C((()=>new Set(t.allNodes.map((e=>e.name))))),getNodeById:function(e){return t.getNodeById(e)},getNodeByName:function(e){return t.getNodeByName(e)},getNodes:function(){return t.getNodes()},findNodeByPartialId:function(e){return t.findNodeByPartialId(e)},getNodesByIds:function(e){return t.getNodesByIds(e)},setNodes:function(e){!function(e){t.setNodes(e)}(e)},addNode:function(e){!function(e){t.addNode(e),n.trigger({action:tl.ADD,payload:{node:e}}),o.trigger()}(e)},removeNode:function(e){!function(e){t.removeNode(e),n.trigger({action:tl.DELETE,payload:{name:e.name,id:e.id}}),o.trigger()}(e)},removeNodeById:function(e){!function(e){const a=t.getNodeById(e);t.removeNodeById(e),n.trigger({action:tl.DELETE,payload:{name:a?.name??"",id:e}}),o.trigger()}(e)},setNodeParameters:i,setNodeValue:r,setNodePositionById:function(e,n){const o=t.workflow.nodes.find((t=>t.id===e));o&&r({name:o.name,key:"position",value:n})},updateNodeProperties:function(e){const n=t.workflow.nodes.findIndex((t=>t.name===e.name));if(-1!==n)for(const t of Object.keys(e.properties)){const i=t;a(n,{[t]:e.properties[i]})&&o.trigger()}},updateNodeById:function(e,n){const o=t.workflow.nodes.findIndex((t=>t.id===e));return-1!==o&&a(o,n)},setNodeIssue:function(e){const n=t.workflow.nodes.findIndex((t=>t.name===e.node));if(-1===n)return;const o=t.workflow.nodes[n];if(null===e.value){if(void 0===o.issues?.[e.type])return;const{[e.type]:t,...i}=o.issues;a(n,{issues:i})}else a(n,{issues:{...o.issues,[e.type]:e.value}})},removeAllNodes:function(){t.workflow.nodes.splice(0,t.workflow.nodes.length),t.workflowObject.setNodes(t.workflow.nodes),t.nodeMetadata={}},resetAllNodesIssues:function(){return t.workflow.nodes.forEach((e=>{e.issues=void 0})),!0},setLastNodeParameters:function(n){const o=(0,cl.default)(t.workflow.nodes,(e=>e.type===n.key));if(!o)return;const a=e.getNodeType(o.type);a&&i({value:$o(a.properties,n.value,!0,!1,o,a),name:o.name},!0)},resetParametersLastUpdatedAt:function(e){t.nodeMetadata[e]||(t.nodeMetadata[e]={pristine:!0}),t.nodeMetadata[e].parametersLastUpdatedAt=Date.now()},onNodesChange:n.on,onStateDirty:o.on}}function Xh(){const e=v(null),t=we();return{viewport:S(e),setViewport:function(n){!function(n,o=tl.UPDATE){e.value=n,t.trigger({action:o,payload:{viewport:n}})}(n)},onViewportChange:t.on}}function qh(e){const t=rh(),n=we(),o=we();function a(e,a){t.removeAllNodeConnection(e,a),n.trigger({action:tl.DELETE,payload:{nodeName:e.name}}),o.trigger()}return{connectionsBySourceNode:C((()=>t.connectionsBySourceNode)),connectionsByDestinationNode:C((()=>t.connectionsByDestinationNode)),outgoingConnectionsByNodeName:function(e){return t.outgoingConnectionsByNodeName(e)},incomingConnectionsByNodeName:function(e){return t.incomingConnectionsByNodeName(e)},nodeHasOutputConnection:function(e){return t.nodeHasOutputConnection(e)},isNodeInOutgoingNodeConnections:function(e,n,o=-1){return t.isNodeInOutgoingNodeConnections(e,n,o)},setConnections:function(e){!function(e){t.setConnections(e)}(e)},addConnection:function(e){!function(e){t.addConnection(e),n.trigger({action:tl.ADD,payload:{connection:e.connection}}),o.trigger()}(e)},removeConnection:function(e){!function(e){t.removeConnection(e),n.trigger({action:tl.DELETE,payload:{connection:e.connection}}),o.trigger()}(e)},removeAllNodeConnection:function(e,t){a(e,t)},removeNodeConnectionsById:function(t){const n=e.getNodeById(t);n&&a(n)},removeAllConnections:function(){t.setConnections({})},onConnectionsChange:n.on,onStateDirty:o.on}}function Jh(){const e=v(""),t=we();return{name:S(e),setName:function(n){!function(n,o=tl.UPDATE){e.value=n,t.trigger({action:o,payload:{name:n}})}(n)},onNameChange:t.on}}function Kh(e,t="latest"){return`${e}@${t}`}function Zh(e){return`${ai.WORKFLOW_DOCUMENTS}/${e}`}function Qh(e){return Xa(Zh(e),(()=>{const[t,n]=e.split("@"),o=Jh(),a=$h(),i=Bh(),r=Vh(),s=function(){const e=v(),t=we();function n(n,o=tl.UPDATE){e.value=n,t.trigger({action:o,payload:{meta:n}})}return{meta:S(e),setMeta:function(e){n(e)},addToMeta:function(t){n({...e.value,...t})},onMetaChange:t.on}}(),l=Wh(),u=Uh(),c=Rh(),d=Fh(),p=zh(),f=function(){const e=v({...nl}),t=we();function n(n,o=tl.UPDATE){e.value=n,t.trigger({action:o,payload:{settings:n}})}return{settings:S(e),setSettings:function(e){n({...nl,...e})},mergeSettings:function(t){n({...e.value,...t})},getSettingsSnapshot:function(){return zt(e.value)},onSettingsChange:t.on}}(),m=Hh(),h=Gh(),y=Xh(),g=Jm(),{onStateDirty:w,...b}=Yh({getNodeType:(e,t)=>g.getNodeType(e,t)}),{onStateDirty:k,...x}=qh({getNodeById:e=>b.getNodeById(e)});return w((()=>dh().markStateDirty())),k((()=>dh().markStateDirty())),{workflowId:t,workflowVersion:n,...o,...a,...i,...r,...u,...s,...f,...l,...c,...d,...p,...m,...h,...y,...b,...x,removeAllNodes:function(){b.removeAllNodes(),x.removeAllConnections(),c.setPinData({})}}}))()}function ey(e){return e.split(" ").filter((e=>!dl.includes(e))).join(" ")}function ty(e,t){let n=!0;for(const o of e){const e=t?.[o]??{},a=Gl[o];n=n&&a(e)}return n}function ny(e){return"string"==typeof e}function oy(e){return"workflow"===e.resourceType}function ay(e){return"folder"===e.resourceType}function iy(e){return"credential"===e.resourceType}function ry(e){const t=ke(e,null,void 0,{writeDefaults:!1});return"undefined"===t.value&&(t.value=null),t}function sy(){return Eu}function ly(){const e=Ie(),t=v(null);return{loadingService:t,isLoading:C((()=>null!==t.value)),startLoading:function(n){null===t.value&&(t.value=Er.service({lock:!0,text:n||e.baseText("genericHelpers.loading"),background:"var(--dialog--overlay--color--background)"}))},setLoadingText:function(e){t.value&&(t.value.text=e)},stopLoading:function(){t.value&&(t.value.close(),t.value=null)}}}function uy(){const e=Gf(),t=wu(),n=Jm(),o=rh(),a=qi(),i=Ie(),r=Au(),s=C((()=>o.workflowId?Qh(Kh(o.workflowId)):void 0)),l=v(!1),u=v(!1),c=v(!1),d=v(null),p=C((()=>o.workflowObject));function f(e){return Object.keys(e.parameters).includes("nodeCredentialType")}function m(e,t,o,a,i="displayOptions"){const r=a?.type?n.getNodeType(a.type,a.typeVersion):null;return bo(e,t,o,a,r,i)}function h(e){const t=o.getWorkflowRunData;if(!t?.hasOwnProperty(e.name))return!1;for(const n of t[e.name])if(void 0!==n.error)return!0;return!1}function y(e){return{credentials:{[e.name]:[i.baseText("nodeHelpers.credentialsUnset",{interpolate:{credentialType:e.displayName}})]}}}function g(e){const t=n.getNodeType(e.type,e.typeVersion);if(!t)return;const o=x(p.value,e,t);s.value?.setNodeIssue({node:e.name,type:"input",value:o?.input?o.input:null})}function w(){const e=s.value?.allNodes??[];for(const t of e)g(t)}function b(e){const t=I(e);let n=null;null!==t&&(n=t.credentials),s.value?.setNodeIssue({node:e.name,type:"credentials",value:n})}function k(e,t){const o=t??n.getNodeType(e.type,e.typeVersion);if(null===o)return;const a=ao(o.properties,e,o);let i=null;null!==a&&(i=a.parameters),s.value?.setNodeIssue({node:e.name,type:"parameters",value:i})}function x(e,t,n){const o={},a=e.getNode(t.name);let r=[];return n&&a&&(r=na(e,a,n)),r.forEach((n=>{"string"!=typeof n&&!0===n.required&&0===e.getParentNodes(t.name,n.type,1).length&&(o[n.type]=[i.baseText("nodeIssues.input.missing",{interpolate:{inputName:n.displayName||n.type}})])})),Object.keys(o).length?{input:o}:null}function I(t,a){const r=a??n.getNodeType(t.type,t.typeVersion),s=o.workflowId?Qh(Kh(o.workflowId)):void 0;if(t.disabled)return null;if(!r?.credentials)return null;const l={};let u,c,d,p;const{authentication:h,genericAuthType:v,nodeCredentialType:g}=t.parameters;if("genericCredentialType"===h&&""!==v&&N(t,v)){const t=e.getCredentialTypeByName(v);return t?y(t):null}if(f(t)&&"predefinedCredentialType"===h&&""!==g&&void 0!==t.credentials){const n=e.getCredentialsByType(g),o=s?.usedCredentials?.[t.credentials?.[g]?.id];if(function(e,t,n){if(!e.credentials||!n)return!1;const o=e.credentials[t];return!!o&&!n.find((e=>e.id===o.id))}(t,g,n)&&!o){const t=e.getCredentialTypeByName(g);return t?y(t):null}}if(f(t)&&"predefinedCredentialType"===h&&""!==g&&N(t,g)){const t=e.getCredentialTypeByName(g);return t?y(t):null}for(const n of r.credentials)if(m(t.parameters,n,"",t))if(c=e.getCredentialTypeByName(n.name),d=c?c.displayName:n.name,t.credentials?.[n.name]){if(p=t.credentials[n.name],"string"==typeof p&&(p={id:null,name:p}),u=e.getCredentialsByType(n.name),null===u&&(u=[]),p.id&&u.find((e=>e.id===p.id)))continue;const o=u.filter((e=>e.name===p.name));if(o.length>1){l[n.name]=[i.baseText("nodeIssues.credentials.notIdentified",{interpolate:{name:p.name,type:d}}),i.baseText("nodeIssues.credentials.notIdentified.hint")];continue}0===o.length&&(s?.usedCredentials?.[p.id]||ty(["rbac"],{rbac:{scope:"credential:read"}})||(l[n.name]=[i.baseText("nodeIssues.credentials.doNotExist",{interpolate:{name:p.name,type:d}}),i.baseText("nodeIssues.credentials.doNotExist.hint")]))}else n.required&&(l[n.name]=[i.baseText("nodeIssues.credentials.notSet",{interpolate:{type:r.displayName}})]);return 0===Object.keys(l).length?null:{credentials:l}}function N(e,t){return!e.credentials||!Object.keys(e.credentials).includes(t)}function S(e,t=0,n){return T(e,n)?.[t]??null}function T(e,t){return(t?.resultData.runData??o.getWorkflowRunData)?.[e]??null}function E(e,t,n=xo.Main){return e?.[n]?.[t]??[]}const A={"n8n-nodes-base.code":{mode:[void 0,"runOnceForAllItems"]},"n8n-nodes-base.executeWorkflow":{mode:[void 0,"once"]},"n8n-nodes-base.crateDb":{operation:[void 0,"update"]},"n8n-nodes-base.timescaleDb":{operation:[void 0,"update"]},"n8n-nodes-base.microsoftSql":{operation:[void 0,"update","delete"]},"n8n-nodes-base.questDb":{operation:[void 0]},"n8n-nodes-base.mongoDb":{operation:["insert","update"]},"n8n-nodes-base.redis":{operation:[void 0]}};return{hasProxyAuth:f,isCustomApiCallSelected:function(e){const{parameters:t}=e;if(!_h(t))return!1;if("resource"in t||"operation"in t){const{resource:e,operation:n}=t;return ny(e)&&e.includes("__CUSTOM_API_CALL__")||ny(n)&&n.includes("__CUSTOM_API_CALL__")}return!1},isNodeExecutable:function(e,t,o){const a=e?n.getNodeType(e.type,e.typeVersion):null;if(e&&a){const t=p.value.getNode(e.name),o=!!e&&n.isTriggerNode(e.type),i=!!e&&n.isToolNode(e.type);if(t){const e=na(p.value,t,a);if(!xa(e).includes(xo.Main)&&!i&&!o)return!1}}return Boolean(t||o.length>0)},getForeignCredentialsIfSharingEnabled:function(e){if(!e||!a.isEnterpriseFeatureEnabled[Nn.Sharing])return[];const t=(o.workflowId?Qh(Kh(o.workflowId)):void 0)?.usedCredentials??{};return Object.values(e).map((({id:e})=>e)).filter((e=>null!==e)).filter((e=>e in t&&!t[e]?.currentUserHasAccess))},displayParameter:m,getNodeIssues:function(e,t,n,a){const i=o.workflowId?Qh(Kh(o.workflowId)):void 0,r=Object.keys(i?.pinData??{});let s=null;if(a=a??[],!0===t.disabled||r.includes(t.name))return null;if(null===e)a.includes("typeUnknown")||(s={typeUnknown:!0});else{if(a.includes("parameters")||(s=ao(e.properties,t,e)),!a.includes("credentials")){const n=I(t,e);null===s?s=n:Ea(s,n)}const o=x(n,t,e);null===s?s=o:Ea(s,o)}return h(t)&&!a.includes("execution")&&(null===s&&(s={}),s.execution=!0),s},updateNodesInputIssues:w,updateNodesExecutionIssues:function(){const e=s.value?.allNodes??[];for(const t of e)s.value?.setNodeIssue({node:t.name,type:"execution",value:!!h(t)||null})},updateNodesParameterIssues:function(){const e=s.value?.allNodes??[];for(const t of e)k(t)},updateNodeInputIssues:g,updateNodeCredentialIssuesByName:function(e){const t=s.value?.getNodeByName(e)??null;t&&b(t)},updateNodeCredentialIssues:b,updateNodeParameterIssuesByName:function(e){const t=s.value?.getNodeByName(e)??null;t&&k(t)},updateNodeParameterIssues:k,getBinaryData:function(e,t,n,o,a=xo.Main){if(null===t)return[];const i=e?.[t]?.[n]?.data;if(!i)return[];const r=E(i,o,a),s=[];for(let l=0;l<r.length;l++){const e=r[l]?.binary;void 0!==e&&s.push(e)}return s},disableNodes:function(e,{trackHistory:n=!1,trackBulk:a=!0}={}){const i=sy();n&&a&&t.startRecordingUndo();const r=e.some((e=>!e.disabled));for(const l of e){if(r===l.disabled)continue;const e={name:l.name,properties:{disabled:r}};i.track("User set node enabled status",{node_type:l.type,is_enabled:l.disabled,workflow_id:o.workflowId}),s.value?.updateNodeProperties(e),o.clearNodeExecutionData(l.name),k(l),b(l),w(),n&&t.pushCommandToUndo(new gu(l.name,!0===l.disabled,r,Date.now()))}n&&a&&t.stopRecordingUndo()},getNodeSubtitle:function(e,t,n){if(e){if(e.notesInFlow)return e.notes;if(void 0!==t?.subtitle)try{return n.expression.getSimpleParameterValue(e,t.subtitle,"internal",{},void 0,Fo)}catch(o){return}if(void 0!==e.parameters.operation){const n=e.parameters.operation;if(null===t)return n;const o=t.properties.find((e=>"operation"===e.name));if(void 0===o)return n;if(void 0===o.options)return n;const a=o.options.find((t=>t.value===e.parameters.operation));return void 0===a?n:a.name}}},updateNodesCredentialsIssues:function(){const e=s.value?.allNodes??[];let t;for(const n of e)t=I(n),s.value?.setNodeIssue({node:n.name,type:"credentials",value:t?.credentials??null})},getLastRunIndexWithData:function(e,t=0,n=xo.Main,o){return(T(e,o)??[]).findLastIndex((e=>e.data&&E(e.data,t,n).length>0))},hasNodeExecuted:function(e){return T(e)?.some((({executionStatus:e})=>e&&["success","error"].includes(e)))??!1},getNodeInputData:function(e,t=0,n=0,o="output",a=xo.Main,i){if(!e)return[];const r=S(e.name,t,i);if(null===r)return[];let s=r.data;return"input"===o&&r.inputOverride&&(s=r.inputOverride),s?E(s,n,a):[]},matchCredentials:function(t){t.credentials&&Object.entries(t.credentials).forEach((([n,o])=>{const a=e.getCredentialsByType(n);if("string"==typeof o&&(o={id:null,name:o},u.value=!0),o.id){const e=o.id.toString(),i=a.find((t=>t.id===e));if(i)return void(i.name===o.name&&"number"!=typeof o.id||(t.credentials[n]={id:i.id,name:i.name},u.value=!0))}t.credentials[n]=o;const i=a.filter((e=>e.name===o.name));1===i.length&&(t.credentials[n].id=i[0].id,u.value=!0)}))},isInsertingNodes:l,credentialsUpdated:u,isProductionExecutionPreview:c,pullConnActiveNodeName:d,loadNodesProperties:async function(e){const t=n.allNodeTypes,o=[];t.forEach((t=>{const n=Array.isArray(t.version)?t.version:[t.version];e.find((e=>e.name===t.name&&n.includes(e.version)))&&!t.hasOwnProperty("properties")&&o.push({name:t.name,version:Array.isArray(t.version)?t.version.slice(-1)[0]:t.version})})),o.length>0&&(r.startLoading(),await n.getNodesInformation(o),r.stopLoading())},getNodeTaskData:S,assignNodeId:function(e){const t=window.crypto.randomUUID();return e.id=t,t},assignWebhookId:function(e){const t=window.crypto.randomUUID();return e.webhookId=t,t},isSingleExecution:function(e,t){const n=A[e];if(n){for(const e of Object.keys(n))if(!n[e].includes(t[e]))return!1;return!0}return!1},getNodeHints:function(e,t,n,o){const a=[];if(n?.hints?.length)for(const r of n.hints)if(r.displayCondition)try{let n;if(void 0===o)n=e.expression.getSimpleParameterValue(t,r.displayCondition,"internal",{})||!1;else{const{runExecutionData:a,runIndex:i,connectionInputData:s}=o;n=e.expression.getParameterValue(r.displayCondition,a??null,i,0,t.name,s,"manual",{})}if("string"==typeof n&&"true"===n.trim()&&(n=!0),"boolean"!=typeof n){console.warn(`Condition was not resolved as boolean in '${t.name}' node for hint: `,r.message);continue}n&&a.push(r)}catch(i){console.warn(`Could not calculate display condition in '${t.name}' node for hint: `,r.message)}else a.push(r);return a},nodeIssuesToString:function(e,t){const n=[];void 0!==e.execution&&n.push("Execution Error.");const o=["parameters","credentials","input"];let a,i;for(const r of o)if(void 0!==e[r])for(i of Object.keys(e[r]))for(a of e[r][i])n.push(a);return void 0!==e.typeUnknown&&(void 0!==t?n.push(`Node Type "${t.type}" is not known.`):n.push("Node Type is not known.")),n},getDefaultNodeName:function(e){const t=n.getNodeType(e.type,e.typeVersion);if(null===t)return null;const o=$o(t?.properties,e.parameters??{},!0,!1,e.typeVersion?{typeVersion:e.typeVersion}:null,t);return Qn(o??{},t)}}}function cy(e,t,n,o){return`${e}_r${t}_o${n}_i${o}`}function dy(e,t,n,o){if(e.size>=Pu)throw Error();e.data[t]=e.data[t]||[];const a=n.input||0,i=o[a]?.previousNode;if(!i)return e.data[t].push([t]),void e.size++;const r=o[a]?.previousNodeOutput||0,s=cy(i,o[a]?.previousNodeRun||0,r,n.item);e.data[s]||(e.data[s]=[[s]],e.size++),e.data[s]?.forEach((n=>{e.data[t]?.push([...n,t]),e.size++}))}function py(e,t,n,o,a,i){const r=`${e}_r${t}`;if(o.has(r))return;if(o.add(r),i.has(e))return;const s=n[e];if(!Array.isArray(s))return;const l=s[t];if(!l?.data?.main)return;const u=l.source||[];u.forEach((e=>{e?.previousNode&&py(e.previousNode,e.previousNodeRun??0,n,o,a,i)})),(l.data.main||[]).forEach(((n,o)=>{n&&n.forEach(((n,i)=>{const r=cy(e,t,o,i);if(!n.pairedItem)return void(a.data[r]=[]);const s=n.pairedItem;Array.isArray(s)?s.forEach((e=>{dy(a,r,e,u)})):dy(a,r,"object"!=typeof s?{item:s}:s,u)}))}))}function fy(e){if(!e?.data?.resultData?.runData)return{};const t=e.data.resultData.runData;if(function(e){let t=0;for(const n in e)for(const o of e[n]){const e=o.data;if(e)for(const n in e)t+=e[n].reduce(((e,t)=>t?e+t.length:e),0)}return t}(t)>1e3)return{};const n={size:0,data:{}};try{const o=new Set,a=new Set(Object.keys(e.data.resultData.pinData??{}));Object.keys(t).forEach((e=>{t[e].forEach(((i,r)=>{py(e,r,t,o,n,a)}))}))}catch{return{}}return function(e){const t={};return Object.keys(e.data).forEach((n=>{e.data[n]?.forEach((e=>{e.forEach((e=>{e!==n&&(t[e]=t[e]||new Set,t[e].add(n),t[n]=t[n]||new Set,t[n].add(e))}))}))})),t}(n)}function my(e){return e?.startsWith("n8n-creds-base")??!1}function hy(e){return e.split(".")[1]}function yy(e){return`${_t}.${e}`}function vy(e,t){const{httpRequestNode:n}=t??{};if(!e||!t||!n)return;const{docsUrl:o,name:a}=n,i=zt(e),r=e.iconUrl;return i.name=yy(t.name),i.extendsCredential=t.name,i.displayName=a??t.displayName,i.description="HTTP request",i.defaults.name=`${a} HTTP Request`,i.codex={...i.codex,alias:[],categories:[],subcategories:{}},i.credentials=[{name:t.name,required:!0}],t.icon??t.iconUrl?(i.icon=t.icon,i.iconUrl=t.iconUrl,i.badgeIconUrl=r):i.iconUrl=r,i.properties=e.properties.map((e=>{switch(e.name){case"authentication":return{...e,type:"hidden",default:"predefinedCredentialType"};case"nodeCredentialType":return{...e,type:"hidden",default:t.name};case"url":const o={...e};if("apiBaseUrl"in n){const{apiBaseUrl:t}=n;o.default=t,o.placeholder=t?`e.g. ${t}`:e.placeholder}else o.placeholder=n.apiBaseUrlPlaceholder;return o;default:return e}})),i.properties.splice(1,0,{type:"notice",displayName:Se.baseText("ndv.httpRequest.credentialOnly.docsNotice",{interpolate:{nodeName:a,docsUrl:o}}),name:"httpVariantWarning",default:""}),i.properties.splice(4,0,{type:"credentials",displayName:"",name:"",default:""}),i}function gy(e){return{getTags:async(t,n)=>await Ja(t,"GET",e,n),createTag:async(t,n)=>await Ja(t,"POST",e,n),updateTag:async(t,n,o)=>await Ja(t,"PATCH",`${e}/${n}`,o),deleteTag:async(t,n)=>await Ja(t,"DELETE",`${e}/${n}`)}}function wy(e){return"custom"===e.type&&"customType"in e&&"version_card"===e.customType}function by(e){return"custom"===e.type&&"customType"in e&&"questions"===e.customType}function ky(e){return"custom"===e.type&&"customType"in e&&"plan"===e.customType}function xy(e){return"type"in e&&"message"===e.type&&"text"in e}function Iy(e){return xy(e)&&"string"==typeof e.revertVersionId}function Ny(e){return"type"in e&&"summary"===e.type&&"title"in e&&"content"in e}function Sy(e){return"type"in e&&"agent-suggestion"===e.type&&"title"in e&&"text"in e}function Ty(e){return"type"in e&&"code-diff"===e.type&&"codeDiff"in e}function Ey(e){return"type"in e&&"workflow-updated"===e.type&&"codeSnippet"in e}function Ay(e){return"type"in e&&"tool"===e.type&&"toolName"in e&&"status"in e}function Cy(e){return"type"in e&&"questions"===e.type&&"questions"in e}function _y(e){return"type"in e&&"plan"===e.type&&"plan"in e}function Py(e){return"type"in e&&"user_answers"===e.type&&"answers"in e}function Dy(e){return"type"in e&&"web_fetch_approval"===e.type&&"requestId"in e&&"url"in e&&"domain"in e}function Oy(e){return"custom"===e.type&&"customType"in e&&"web_fetch_approval"===e.customType}function My(e){return"type"in e&&"messages-compacted"===e.type}function Ly(){return Math.random().toString(36).substring(2,11)}function jy(){return`${Date.now()}-${Ly()}`}async function $y(e,t,n){if(0===n.length)return new Map;try{const o=await Pi(e,t,n);return new Map(o.versions.map((e=>[e.versionId,e.createdAt])))}catch{return new Map}}function By(e,t,n){return{id:e,role:"assistant",type:"custom",customType:"questions",data:{questions:t,introMessage:n},read:!1}}function Vy(e,t){return{id:e,role:"assistant",type:"custom",customType:"plan",data:{plan:t},read:!1}}function Ry(e,t){return{id:e,role:"assistant",type:"custom",customType:"web_fetch_approval",data:t,read:!1}}function Fy(e,t){return{id:e,role:"user",type:"custom",customType:"user_answers",data:{answers:t}}}function Wy(){const e=Ie();function t(e){return e.map((e=>{if("text"===e.type&&"showRating"in e){const{showRating:t,ratingStyle:n,...o}=e;return o}return e}))}function n(e){return e.filter((e=>"tool"===e.type))}function o(e){return n(e).filter((e=>"running"===e.status))}function a(e){if(o(e).length>0)return{hasAnyRunningTools:!0,isStillThinking:!1};const t=e=>"completed"===e||"error"===e,a=n(e).some((e=>t(e.status)));let i=-1;for(let n=e.length-1;n>=0;n--){const o=e[n];if("tool"===o.type&&t(o.status)){i=n;break}}let r=!1;if(-1!==i)for(let n=i+1;n<e.length;n++){const t=e[n];if("text"===t.type||"custom"===t.type||"code-diff"===t.type||"block"===t.type){r=!0;break}}return{hasAnyRunningTools:!1,isStillThinking:a&&!r}}function i(e){return e.map(((t,n)=>{if("error"===t.type&&t.retry&&n!==e.length-1){const{retry:e,...n}=t;return n}return t}))}return{processAssistantMessages:function(t,n,r,s){const l=[...t];let u=!1;const c=n.some(My);c&&(l.length=0);const d=Ly();n.forEach(((e,t)=>{const n=function(e,t,n,o){let a=!1;if(Ny(t))e.push({id:n,role:"assistant",type:"block",title:t.title,content:t.content,read:!1}),a=!0;else if(Sy(t))e.push({id:n,role:"assistant",type:"block",title:t.title,content:t.text,read:!1}),a=!0;else if(xy(t))e.push({id:n,role:"assistant",type:"text",content:t.text,codeSnippet:t.codeSnippet,read:!1}),a=!0;else if(Ty(t))e.push({id:n,role:"assistant",type:"code-diff",description:t.description,codeDiff:t.codeDiff,suggestionId:t.suggestionId,sdkSessionId:t.sdkSessionId,nodeName:t.nodeName,quickReplies:t.quickReplies,read:!1}),a=!0;else if(Cy(t)){const o=e.findIndex((e=>"custom"===e.type&&"customType"in e&&"questions"===e.customType)),i=-1!==o&&e.slice(o+1).some((e=>"user"===e.role));(-1===o||i)&&e.push(By(n,t.questions,t.introMessage)),a=!0}else if(_y(t)){const o=e.findLastIndex((e=>"custom"===e.type&&"customType"in e&&"plan"===e.customType)),i=-1!==o&&e.slice(o+1).some((e=>"user"===e.role));(-1===o||i)&&e.push(Vy(n,t.plan)),a=!0}else Py(t)?(e.push(Fy(n,t.answers)),a=!0):Dy(t)?(e.push(Ry(n,{requestId:t.requestId,url:t.url,domain:t.domain})),a=!0):Ey(t)?e.push({...t,id:n,read:!1}):Ay(t)?function(e,t,n){const o=t.toolCallId?e.findIndex((e=>"tool"===e.type&&e.toolCallId===t.toolCallId)):-1;if(-1!==o){const a=e[o];e[o]={...a,id:`${n}-${t.toolCallId}`,status:t.status,customDisplayTitle:t.customDisplayTitle??a.customDisplayTitle,updates:[...a.updates||[],...t.updates||[]]}}else{const o={id:`${n}-${t.toolCallId}`,role:"assistant",type:"tool",toolName:t.toolName,toolCallId:t.toolCallId,displayTitle:t.displayTitle,customDisplayTitle:t.customDisplayTitle,status:t.status,updates:t.updates||[],read:!1};e.push(o)}}(e,t,n):"type"in t&&"error"===t.type&&"content"in t&&(e.push({id:n,role:"assistant",type:"error",content:t.content,read:!1,retry:o}),a=!0);return a}(l,e,`${r}--${d}--${t}`,s);u=u||n}));const p=c?e.baseText("aiAssistant.thinkingSteps.compacting"):function(t){const{hasAnyRunningTools:n,isStillThinking:i}=a(t);if(n){const n=o(t),a=n[n.length-1];if(a){const e=a.customDisplayTitle||a.displayTitle;if(e)return e}return e.baseText("aiAssistant.thinkingSteps.thinking")}if(!n&&i)return e.baseText("aiAssistant.thinkingSteps.thinking")}(l);return{messages:i(l),thinkingMessage:p,shouldClearThinking:u&&l.length>t.length}},createUserMessage:function(e,t,n,o){return{id:t,role:"user",type:"text",content:e,revertVersion:n,...o&&o.length>0?{focusedNodeNames:o}:{},read:!0}},createUserAnswersMessage:function(e,t){return{id:t,role:"user",type:"custom",customType:"user_answers",data:{answers:e}}},createAssistantMessage:function(e,t,n){return n?.aborted?{id:t,role:"assistant",type:"text",content:e,read:!0,aborted:!0}:{id:t,role:"assistant",type:"text",content:e,read:!0}},createErrorMessage:function(e,t,n){return{id:t,role:"assistant",type:"error",content:e,retry:n,read:!1}},clearMessages:function(){return[]},addMessages:function(e,t){return[...e,...t]},mapAssistantMessageToUI:function(t,n){return Ny(t)?{id:n,role:"assistant",type:"block",title:t.title,content:t.content,read:!1}:Sy(t)?{id:n,role:"assistant",type:"block",title:t.title,content:t.text,read:!1}:xy(t)?{id:n,role:t.role??"assistant",type:"text",content:t.text,codeSnippet:t.codeSnippet,revertVersion:t.revertVersion,read:!1}:Ty(t)?{id:n,role:"assistant",type:"code-diff",description:t.description,codeDiff:t.codeDiff,suggestionId:t.suggestionId,sdkSessionId:t.sdkSessionId,nodeName:t.nodeName,quickReplies:t.quickReplies,read:!1}:Cy(t)?By(n,t.questions,t.introMessage):_y(t)?Vy(n,t.plan):Py(t)?Fy(n,t.answers):Dy(t)?Ry(n,{requestId:t.requestId,url:t.url,domain:t.domain}):Ey(t)?{...t,id:n,read:!1}:Ay(t)?{id:n,role:"assistant",type:"tool",toolName:t.toolName,toolCallId:t.toolCallId,displayTitle:t.displayTitle,customDisplayTitle:t.customDisplayTitle,status:t.status,updates:t.updates||[],read:!1}:"type"in t&&"event"===t.type?{...t,id:n,read:!1}:{id:n,role:"assistant",type:"text",content:e.baseText("aiAssistant.thinkingSteps.thinking"),read:!1}},applyRatingLogic:function(e){const{hasAnyRunningTools:n,isStillThinking:o}=a(e);if(n||o)return t(e);let i=-1;for(let t=e.length-1;t>=0;t--)if("workflow-updated"===e[t].type){i=t;break}if(-1===i)return e;let r=-1;for(let t=e.length-1;t>=0;t--)if("text"===e[t].type&&"assistant"===e[t].role&&t>i){r=t;break}return e.map(((e,t)=>{if("text"===e.type&&"assistant"===e.role&&t===r)return{...e,showRating:!0,ratingStyle:"minimal"};if("text"===e.type&&"showRating"in e){const{showRating:t,ratingStyle:n,...o}=e;return o}return e}))},clearRatingLogic:t,getRunningTools:o}}function Uy(e){let t=e.slice(14,-3);return t.startsWith("_VALUE__")?t=t.slice(8):t.startsWith("__:")?t=t.slice(3):t.startsWith("__")&&(t=t.slice(2)),t.trim()}function zy(e,t=[]){return"string"==typeof e?function(e){if("string"!=typeof e)return[];const t=[],n=new RegExp(Vu.source,"g");let o;for(;null!==(o=n.exec(e));){const e=Uy(o[0]);e.length>0&&t.push(e)}return t}(e).map((e=>({path:t,label:e}))):Array.isArray(e)?e.flatMap(((e,n)=>zy(e,[...t,`[${n}]`]))):null!==e&&"object"==typeof e?Object.entries(e).flatMap((([e,n])=>zy(n,[...t,e]))):[]}function Hy(e){return 0===e.length?"parameters":e.map(((e,t)=>e.startsWith("[")||0===t?e:`.${e}`)).join("")}function Gy(){const e=e=>{if(e instanceof Error)throw e;return e},t=e=>{if(e instanceof Error)throw e;return{value:"",action:e}};return{alert:async function(t,n,o){const a={...o??("object"==typeof n?n:{}),cancelButtonClass:"btn--cancel",confirmButtonClass:"btn--confirm",dangerouslyUseHTMLString:!0};return"string"==typeof n?await Rr.alert(ts(t),n,a).catch(e):await Rr.alert(ts(t),a).catch(e)},confirm:async function(t,n,o){let a=ts(t),i=!0;const{confirmationCheckboxMessage:r,...s}=o??{},l={cancelButtonClass:"btn--cancel",confirmButtonClass:"btn--confirm",distinguishCancelAndClose:!0,showClose:o?.showClose??!1,closeOnClickModal:!1,dangerouslyUseHTMLString:!0,beforeClose:(e,t,n)=>{("confirm"!==e||i)&&n()},...o?s:"object"==typeof n?n:{}};return r&&(i=!1,l.customClass=[l.customClass,"with-confirmation-checkbox"].join(" "),a=w("div",[w("div",{class:"el-message-box__message__structured"},a),w(Ge,{"onUpdate:modelValue":e=>{i=e},required:!0},{label:()=>w("span",ts(r))})])),"string"==typeof n?await Rr.confirm(a,ts(n),l).catch(e):await Rr.confirm(a,l).catch(e)},prompt:async function(e,n,o){const a={...o??("object"==typeof n?n:{}),cancelButtonClass:"btn--cancel",confirmButtonClass:"btn--confirm",dangerouslyUseHTMLString:!0};return"string"==typeof n?await Rr.prompt(ts(e),ts(n),a).catch(t):await Rr.prompt(ts(e),a).catch(t)},message:Rr}}async function Yy(e,t){if(!window.n8nExternalHooks)return;const n=zu(),[o,a]=e.split("."),i=window.n8nExternalHooks[o];if(i?.[a]){const e=i[a];for(const o of e)await o(n,t)}}function Xy(){return{run:Yy}}function qy(){const e=sy(),t=rh(),n=dh(),o=Xy(),a=Ie(),{APP_Z_INDEXES:i}=Yu();function r(o,a=!0){if(n.areNotificationsSuppressed)return{close:()=>{}};const r={dangerouslyUseHTMLString:!0,position:"bottom-right",zIndex:i.TOASTS,appendTo:"#n8n-app",customClass:"content-toast"},{message:s,title:u}=o,c={...r,...o};"string"==typeof s&&(c.message=Ih(s)),"string"==typeof u&&(c.title=Ih(u));const d=Qr(c);if(0===c.duration&&Xu.push(d),"error"===c.type&&a){let n;if("string"==typeof c.message)n=c.message;else if(c.message&&"object"==typeof c.message&&"props"in c.message&&c.message.props){const e=c.message.props,t="object"==typeof e&&null!==e&&"message"in e;n="object"==typeof e&&null!==e&&"errorMessage"in e?String(e.errorMessage):t?String(e.message):"Unknown error"}else n="Unknown error";e.track("Instance FE emitted error",{error_title:c.title,error_message:n,caused_by_credential:l(n),workflow_id:t.workflowId})}return d}function s({description:e,node:t}){if(!e)return"";const n=e.length>500?`${e.slice(0,500)}...`:e;return`\n\t\t\t\t<br>\n\t\t\t\t<br>\n\t\t\t\t<details>\n\t\t\t\t\t<summary\n\t\t\t\t\t\tstyle="color: #ff6d5a; font-weight: bold; cursor: pointer;"\n\t\t\t\t\t>\n\t\t\t\t\t\t${a.baseText("showMessage.showDetails")}\n\t\t\t\t\t</summary>\n\t\t\t\t\t<p>${t.name}: ${n}</p>\n\t\t\t\t</details>\n\t\t\t`}function l(e){return!(!e||"string"!=typeof e)&&e.includes("Credentials for")&&e.includes("are not set")}return{showMessage:r,showToast:function(e){let t;if(e.closeOnClick){const n=e.onClick;e.onClick=()=>{t&&t.close(),n&&n()}}return t=r({title:e.title,message:e.message,onClick:e.onClick,onClose:e.onClose,duration:e.duration,customClass:e.customClass,type:e.type}),t},showError:function(n,a,i){const u=n;r({title:a,message:`\n\t\t\t\t\t${i?`${i}<br/>`:""}\n\t\t\t\t\t<i>${u.message}</i>\n\t\t\t\t\t${s(u)}`,type:"error",duration:0},!1),o.run("showMessage.showError",{title:a,message:i,errorMessage:u.message}),e.track("Instance FE emitted error",{error_title:a,error_description:i,error_message:u.message,caused_by_credential:l(u.message),workflow_id:t.workflowId})},clearAllStickyNotifications:function(){Xu.forEach((e=>{e&&e.close()})),Xu.length=0},showNotificationForViews:function(e){const t=[];e.forEach((e=>{t.push(...n.pendingNotificationsForViews[e]??[])})),t.length&&(t.forEach((async e=>{setTimeout((()=>{r(e)}),5)})),n.setNotificationsForView(Tn.WORKFLOW,[]))}}}function Jy(e){return!!y()&&(k(e),!0)}function Ky(e){return"function"==typeof e?e():$(e)}function Zy(e,t=!1,n="Timeout"){return new Promise(((o,a)=>{t?setTimeout((()=>a(n)),e):setTimeout(o,e)}))}function Qy(e,t,n={}){const{eventFilter:o=oc,...a}=n;return Y(e,(i=o,r=t,function(...e){return new Promise(((t,n)=>{Promise.resolve(i((()=>r.apply(this,e)),{fn:r,thisArg:this,args:e})).then(t).catch(n)}))}),a);var i,r}function ev(e,t,n={}){const{eventFilter:o,...a}=n,{eventFilter:i,pause:r,resume:s,isActive:l}=function(e=oc){const t=v(!0);return{isActive:S(t),pause:function(){t.value=!1},resume:function(){t.value=!0},eventFilter:(...n)=>{t.value&&e(...n)}}}(o);return{stop:Qy(e,t,{...a,eventFilter:i}),pause:r,resume:s,isActive:l}}function tv(e,t={}){if(!s(e))return L(e);const n=Array.isArray(e.value)?Array.from({length:e.value.length}):{};for(const o in e.value)n[o]=me((()=>({get:()=>e.value[o],set(n){var a;if(null==(a=Ky(t.replaceRef))||a)if(Array.isArray(e.value)){const t=[...e.value];t[o]=n,e.value=t}else{const t={...e.value,[o]:n};Object.setPrototypeOf(t,Object.getPrototypeOf(e.value)),e.value=t}else e.value[o]=n}})));return n}function nv(e,t=!1){function n(n,{flush:o="sync",deep:a=!1,timeout:i,throwOnTimeout:r}={}){let s=null;const l=[new Promise((i=>{s=Y(e,(e=>{n(e)!==t&&(s?.(),i(e))}),{flush:o,deep:a,immediate:!0})}))];return null!=i&&l.push(Zy(i,r).then((()=>Ky(e))).finally((()=>null==s?void 0:s()))),Promise.race(l)}function o(o,a){if(!s(o))return n((e=>e===o),a);const{flush:i="sync",deep:r=!1,timeout:l,throwOnTimeout:u}=null!=a?a:{};let c=null;const d=[new Promise((n=>{c=Y([e,o],(([e,o])=>{t!==(e===o)&&(c?.(),n(e))}),{flush:i,deep:r,immediate:!0})}))];return null!=l&&d.push(Zy(l,u).then((()=>Ky(e))).finally((()=>(c?.(),Ky(e))))),Promise.race(d)}function a(e){return i(1,e)}function i(e=1,t){let o=-1;return n((()=>(o+=1,o>=e)),t)}return Array.isArray(Ky(e))?{toMatch:n,toContains:function(e,t){return n((t=>{const n=Array.from(t);return n.includes(e)||n.includes(Ky(e))}),t)},changed:a,changedTimes:i,get not(){return nv(e,!t)}}:{toMatch:n,toBe:o,toBeTruthy:function(e){return n((e=>Boolean(e)),e)},toBeNull:function(e){return o(null,e)},toBeNaN:function(e){return n(Number.isNaN,e)},toBeUndefined:function(e){return o(void 0,e)},changed:a,changedTimes:i,get not(){return nv(e,!t)}}}function ov(e){return nv(e)}function av(e){var t;const n=Ky(e);return null!=(t=null==n?void 0:n.$el)?t:n}function iv(...e){let t,n,o,a;if("string"==typeof e[0]||Array.isArray(e[0])?([n,o,a]=e,t=ac):[t,n,o,a]=e,!t)return nc;Array.isArray(n)||(n=[n]),Array.isArray(o)||(o=[o]);const i=[],r=()=>{i.forEach((e=>e())),i.length=0},s=Y((()=>[av(t),Ky(a)]),(([e,t])=>{if(r(),!e)return;const a=tc(t)?{...t}:t;i.push(...n.flatMap((t=>o.map((n=>((e,t,n,o)=>(e.addEventListener(t,n,o),()=>e.removeEventListener(t,n,o)))(e,t,n,a))))))}),{immediate:!0,flush:"post"}),l=()=>{s(),r()};return Jy(l),l}function rv(...e){let t,n,o={};3===e.length?(t=e[0],n=e[1],o=e[2]):2===e.length?"object"==typeof e[1]?(t=!0,n=e[0],o=e[1]):(t=e[0],n=e[1]):(t=!0,n=e[0]);const{target:a=ac,eventName:i="keydown",passive:r=!1,dedupe:s=!1}=o,l="function"==typeof(u=t)?u:"string"==typeof u?e=>e.key===u:Array.isArray(u)?e=>u.includes(e.key):()=>!0;var u;return iv(a,i,(e=>{e.repeat&&Ky(s)||l(e)&&n(e)}),r)}function sv(e,t,n,o={}){var a,i,r;const{clone:s=!1,passive:l=!1,eventName:u,deep:c=!1,defaultValue:d,shouldEmit:p}=o,f=N(),m=n||(null==f?void 0:f.emit)||(null==(a=null==f?void 0:f.$emit)?void 0:a.bind(f))||(null==(r=null==(i=null==f?void 0:f.proxy)?void 0:i.$emit)?void 0:r.bind(null==f?void 0:f.proxy));let h=u;t||(t="modelValue"),h=h||`update:${t.toString()}`;const y=e=>{return s?"function"==typeof s?s(e):(t=e,JSON.parse(JSON.stringify(t))):e;var t},g=()=>Qu(e[t])?y(e[t]):d,w=e=>{p?p(e)&&m(h,e):m(h,e)};if(l){const n=v(g());let o=!1;return Y((()=>e[t]),(e=>{o||(o=!0,n.value=y(e),j((()=>o=!1)))})),Y(n,(n=>{o||n===e[t]&&!c||w(n)}),{deep:c}),n}return C({get:()=>g(),set(e){w(e)}})}function lv(){for(var e,t=0,n=arguments.length,o={};t<n;++t){if(!(e=arguments[t]+"")||e in o||/[\s.]/.test(e))throw new Error("illegal type: "+e);o[e]=[]}return new uv(o)}function uv(e){this._=e}function cv(e,t){return e.trim().split(/^|\s+/).map((function(e){var n="",o=e.indexOf(".");if(o>=0&&(n=e.slice(o+1),e=e.slice(0,o)),e&&!t.hasOwnProperty(e))throw new Error("unknown type: "+e);return{type:e,name:n}}))}function dv(e,t){for(var n,o=0,a=e.length;o<a;++o)if((n=e[o]).name===t)return n.value}function pv(e,t,n){for(var o=0,a=e.length;o<a;++o)if(e[o].name===t){e[o]=ic,e=e.slice(0,o).concat(e.slice(o+1));break}return null!=n&&e.push({name:t,value:n}),e}function fv(e){var t=e+="",n=t.indexOf(":");return n>=0&&"xmlns"!==(t=e.slice(0,n))&&(e=e.slice(n+1)),sc.hasOwnProperty(t)?{space:sc[t],local:e}:e}function mv(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===rc&&t.documentElement.namespaceURI===rc?t.createElement(e):t.createElementNS(n,e)}}function hv(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function yv(e){var t=fv(e);return(t.local?hv:mv)(t)}function vv(){}function gv(e){return null==e?vv:function(){return this.querySelector(e)}}function wv(e){"function"!=typeof e&&(e=gv(e));for(var t=this._groups,n=t.length,o=new Array(n),a=0;a<n;++a)for(var i,r,s=t[a],l=s.length,u=o[a]=new Array(l),c=0;c<l;++c)(i=s[c])&&(r=e.call(i,i.__data__,c,s))&&("__data__"in i&&(r.__data__=i.__data__),u[c]=r);return new ew(o,this._parents)}function bv(e){return null==e?[]:Array.isArray(e)?e:Array.from(e)}function kv(){return[]}function xv(e){return null==e?kv:function(){return this.querySelectorAll(e)}}function Iv(e){e="function"==typeof e?function(e){return function(){return bv(e.apply(this,arguments))}}(e):xv(e);for(var t=this._groups,n=t.length,o=[],a=[],i=0;i<n;++i)for(var r,s=t[i],l=s.length,u=0;u<l;++u)(r=s[u])&&(o.push(e.call(r,r.__data__,u,s)),a.push(r));return new ew(o,a)}function Nv(e){return function(){return this.matches(e)}}function Sv(e){return function(t){return t.matches(e)}}function Tv(){return this.firstElementChild}function Ev(e){return this.select(null==e?Tv:function(e){return function(){return lc.call(this.children,e)}}("function"==typeof e?e:Sv(e)))}function Av(){return Array.from(this.children)}function Cv(e){return this.selectAll(null==e?Av:function(e){return function(){return uc.call(this.children,e)}}("function"==typeof e?e:Sv(e)))}function _v(e){"function"!=typeof e&&(e=Nv(e));for(var t=this._groups,n=t.length,o=new Array(n),a=0;a<n;++a)for(var i,r=t[a],s=r.length,l=o[a]=[],u=0;u<s;++u)(i=r[u])&&e.call(i,i.__data__,u,r)&&l.push(i);return new ew(o,this._parents)}function Pv(e){return new Array(e.length)}function Dv(){return new ew(this._enter||this._groups.map(Pv),this._parents)}function Ov(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}function Mv(e){return function(){return e}}function Lv(e,t,n,o,a,i){for(var r,s=0,l=t.length,u=i.length;s<u;++s)(r=t[s])?(r.__data__=i[s],o[s]=r):n[s]=new Ov(e,i[s]);for(;s<l;++s)(r=t[s])&&(a[s]=r)}function jv(e,t,n,o,a,i,r){var s,l,u,c=new Map,d=t.length,p=i.length,f=new Array(d);for(s=0;s<d;++s)(l=t[s])&&(f[s]=u=r.call(l,l.__data__,s,t)+"",c.has(u)?a[s]=l:c.set(u,l));for(s=0;s<p;++s)u=r.call(e,i[s],s,i)+"",(l=c.get(u))?(o[s]=l,l.__data__=i[s],c.delete(u)):n[s]=new Ov(e,i[s]);for(s=0;s<d;++s)(l=t[s])&&c.get(f[s])===l&&(a[s]=l)}function $v(e){return e.__data__}function Bv(e,t){if(!arguments.length)return Array.from(this,$v);var n=t?jv:Lv,o=this._parents,a=this._groups;"function"!=typeof e&&(e=Mv(e));for(var i=a.length,r=new Array(i),s=new Array(i),l=new Array(i),u=0;u<i;++u){var c=o[u],d=a[u],p=d.length,f=Vv(e.call(c,c&&c.__data__,u,o)),m=f.length,h=s[u]=new Array(m),y=r[u]=new Array(m);n(c,d,h,y,l[u]=new Array(p),f,t);for(var v,g,w=0,b=0;w<m;++w)if(v=h[w]){for(w>=b&&(b=w+1);!(g=y[b])&&++b<m;);v._next=g||null}}return(r=new ew(r,o))._enter=s,r._exit=l,r}function Vv(e){return"object"==typeof e&&"length"in e?e:Array.from(e)}function Rv(){return new ew(this._exit||this._groups.map(Pv),this._parents)}function Fv(e,t,n){var o=this.enter(),a=this,i=this.exit();return"function"==typeof e?(o=e(o))&&(o=o.selection()):o=o.append(e+""),null!=t&&(a=t(a))&&(a=a.selection()),null==n?i.remove():n(i),o&&a?o.merge(a).order():a}function Wv(e){for(var t=e.selection?e.selection():e,n=this._groups,o=t._groups,a=n.length,i=o.length,r=Math.min(a,i),s=new Array(a),l=0;l<r;++l)for(var u,c=n[l],d=o[l],p=c.length,f=s[l]=new Array(p),m=0;m<p;++m)(u=c[m]||d[m])&&(f[m]=u);for(;l<a;++l)s[l]=n[l];return new ew(s,this._parents)}function Uv(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var o,a=e[t],i=a.length-1,r=a[i];--i>=0;)(o=a[i])&&(r&&4^o.compareDocumentPosition(r)&&r.parentNode.insertBefore(o,r),r=o);return this}function zv(e){function t(t,n){return t&&n?e(t.__data__,n.__data__):!t-!n}e||(e=Hv);for(var n=this._groups,o=n.length,a=new Array(o),i=0;i<o;++i){for(var r,s=n[i],l=s.length,u=a[i]=new Array(l),c=0;c<l;++c)(r=s[c])&&(u[c]=r);u.sort(t)}return new ew(a,this._parents).order()}function Hv(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function Gv(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function Yv(){return Array.from(this)}function Xv(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var o=e[t],a=0,i=o.length;a<i;++a){var r=o[a];if(r)return r}return null}function qv(){let e=0;for(const t of this)++e;return e}function Jv(){return!this.node()}function Kv(e){for(var t=this._groups,n=0,o=t.length;n<o;++n)for(var a,i=t[n],r=0,s=i.length;r<s;++r)(a=i[r])&&e.call(a,a.__data__,r,i);return this}function Zv(e){return function(){this.removeAttribute(e)}}function Qv(e){return function(){this.removeAttributeNS(e.space,e.local)}}function eg(e,t){return function(){this.setAttribute(e,t)}}function tg(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function ng(e,t){return function(){var n=t.apply(this,arguments);null==n?this.removeAttribute(e):this.setAttribute(e,n)}}function og(e,t){return function(){var n=t.apply(this,arguments);null==n?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function ag(e,t){var n=fv(e);if(arguments.length<2){var o=this.node();return n.local?o.getAttributeNS(n.space,n.local):o.getAttribute(n)}return this.each((null==t?n.local?Qv:Zv:"function"==typeof t?n.local?og:ng:n.local?tg:eg)(n,t))}function ig(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function rg(e){return function(){this.style.removeProperty(e)}}function sg(e,t,n){return function(){this.style.setProperty(e,t,n)}}function lg(e,t,n){return function(){var o=t.apply(this,arguments);null==o?this.style.removeProperty(e):this.style.setProperty(e,o,n)}}function ug(e,t,n){return arguments.length>1?this.each((null==t?rg:"function"==typeof t?lg:sg)(e,t,null==n?"":n)):cg(this.node(),e)}function cg(e,t){return e.style.getPropertyValue(t)||ig(e).getComputedStyle(e,null).getPropertyValue(t)}function dg(e){return function(){delete this[e]}}function pg(e,t){return function(){this[e]=t}}function fg(e,t){return function(){var n=t.apply(this,arguments);null==n?delete this[e]:this[e]=n}}function mg(e,t){return arguments.length>1?this.each((null==t?dg:"function"==typeof t?fg:pg)(e,t)):this.node()[e]}function hg(e){return e.trim().split(/^|\s+/)}function yg(e){return e.classList||new vg(e)}function vg(e){this._node=e,this._names=hg(e.getAttribute("class")||"")}function gg(e,t){for(var n=yg(e),o=-1,a=t.length;++o<a;)n.add(t[o])}function wg(e,t){for(var n=yg(e),o=-1,a=t.length;++o<a;)n.remove(t[o])}function bg(e){return function(){gg(this,e)}}function kg(e){return function(){wg(this,e)}}function xg(e,t){return function(){(t.apply(this,arguments)?gg:wg)(this,e)}}function Ig(e,t){var n=hg(e+"");if(arguments.length<2){for(var o=yg(this.node()),a=-1,i=n.length;++a<i;)if(!o.contains(n[a]))return!1;return!0}return this.each(("function"==typeof t?xg:t?bg:kg)(n,t))}function Ng(){this.textContent=""}function Sg(e){return function(){this.textContent=e}}function Tg(e){return function(){var t=e.apply(this,arguments);this.textContent=null==t?"":t}}function Eg(e){return arguments.length?this.each(null==e?Ng:("function"==typeof e?Tg:Sg)(e)):this.node().textContent}function Ag(){this.innerHTML=""}function Cg(e){return function(){this.innerHTML=e}}function _g(e){return function(){var t=e.apply(this,arguments);this.innerHTML=null==t?"":t}}function Pg(e){return arguments.length?this.each(null==e?Ag:("function"==typeof e?_g:Cg)(e)):this.node().innerHTML}function Dg(){this.nextSibling&&this.parentNode.appendChild(this)}function Og(){return this.each(Dg)}function Mg(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Lg(){return this.each(Mg)}function jg(e){var t="function"==typeof e?e:yv(e);return this.select((function(){return this.appendChild(t.apply(this,arguments))}))}function $g(){return null}function Bg(e,t){var n="function"==typeof e?e:yv(e),o=null==t?$g:"function"==typeof t?t:gv(t);return this.select((function(){return this.insertBefore(n.apply(this,arguments),o.apply(this,arguments)||null)}))}function Vg(){var e=this.parentNode;e&&e.removeChild(this)}function Rg(){return this.each(Vg)}function Fg(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Wg(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Ug(e){return this.select(e?Wg:Fg)}function zg(e){return arguments.length?this.property("__data__",e):this.node().__data__}function Hg(e){return e.trim().split(/^|\s+/).map((function(e){var t="",n=e.indexOf(".");return n>=0&&(t=e.slice(n+1),e=e.slice(0,n)),{type:e,name:t}}))}function Gg(e){return function(){var t=this.__on;if(t){for(var n,o=0,a=-1,i=t.length;o<i;++o)n=t[o],e.type&&n.type!==e.type||n.name!==e.name?t[++a]=n:this.removeEventListener(n.type,n.listener,n.options);++a?t.length=a:delete this.__on}}}function Yg(e,t,n){return function(){var o,a=this.__on,i=function(e){return function(t){e.call(this,t,this.__data__)}}(t);if(a)for(var r=0,s=a.length;r<s;++r)if((o=a[r]).type===e.type&&o.name===e.name)return this.removeEventListener(o.type,o.listener,o.options),this.addEventListener(o.type,o.listener=i,o.options=n),void(o.value=t);this.addEventListener(e.type,i,n),o={type:e.type,name:e.name,value:t,listener:i,options:n},a?a.push(o):this.__on=[o]}}function Xg(e,t,n){var o,a,i=Hg(e+""),r=i.length;if(!(arguments.length<2)){for(s=t?Yg:Gg,o=0;o<r;++o)this.each(s(i[o],t,n));return this}var s=this.node().__on;if(s)for(var l,u=0,c=s.length;u<c;++u)for(o=0,l=s[u];o<r;++o)if((a=i[o]).type===l.type&&a.name===l.name)return l.value}function qg(e,t,n){var o=ig(e),a=o.CustomEvent;"function"==typeof a?a=new a(t,n):(a=o.document.createEvent("Event"),n?(a.initEvent(t,n.bubbles,n.cancelable),a.detail=n.detail):a.initEvent(t,!1,!1)),e.dispatchEvent(a)}function Jg(e,t){return function(){return qg(this,e,t)}}function Kg(e,t){return function(){return qg(this,e,t.apply(this,arguments))}}function Zg(e,t){return this.each(("function"==typeof t?Kg:Jg)(e,t))}function*Qg(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var o,a=e[t],i=0,r=a.length;i<r;++i)(o=a[i])&&(yield o)}function ew(e,t){this._groups=e,this._parents=t}function tw(){return new ew([[document.documentElement]],cc)}function nw(){return this}function ow(e){return"string"==typeof e?new ew([[document.querySelector(e)]],[document.documentElement]):new ew([[e]],cc)}function aw(e,t){if(e=function(e){let t;for(;t=e.sourceEvent;)e=t;return e}(e),void 0===t&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var o=n.createSVGPoint();return o.x=e.clientX,o.y=e.clientY,[(o=o.matrixTransform(t.getScreenCTM().inverse())).x,o.y]}if(t.getBoundingClientRect){var a=t.getBoundingClientRect();return[e.clientX-a.left-t.clientLeft,e.clientY-a.top-t.clientTop]}}return[e.pageX,e.pageY]}function iw(e){e.stopImmediatePropagation()}function rw(e){e.preventDefault(),e.stopImmediatePropagation()}function sw(e){var t=e.document.documentElement,n=ow(e).on("dragstart.drag",rw,pc);"onselectstart"in t?n.on("selectstart.drag",rw,pc):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function lw(e,t){var n=e.document.documentElement,o=ow(e).on("dragstart.drag",null);t&&(o.on("click.drag",rw,pc),setTimeout((function(){o.on("click.drag",null)}),0)),"onselectstart"in n?o.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}function uw(e,{sourceEvent:t,subject:n,target:o,identifier:a,active:i,x:r,y:s,dx:l,dy:u,dispatch:c}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},identifier:{value:a,enumerable:!0,configurable:!0},active:{value:i,enumerable:!0,configurable:!0},x:{value:r,enumerable:!0,configurable:!0},y:{value:s,enumerable:!0,configurable:!0},dx:{value:l,enumerable:!0,configurable:!0},dy:{value:u,enumerable:!0,configurable:!0},_:{value:c}})}function cw(e){return!e.ctrlKey&&!e.button}function dw(){return this.parentNode}function pw(e,t){return null==t?{x:e.x,y:e.y}:t}function fw(){return navigator.maxTouchPoints||"ontouchstart"in this}function mw(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function hw(e,t){var n=Object.create(e.prototype);for(var o in t)n[o]=t[o];return n}function yw(){}function vw(){return this.rgb().formatHex()}function gw(){return this.rgb().formatHex8()}function ww(){return Mw(this).formatHsl()}function bw(){return this.rgb().formatRgb()}function kw(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=wc.exec(e))?(n=t[1].length,t=parseInt(t[1],16),6===n?xw(t):3===n?new Tw(t>>8&15|t>>4&240,t>>4&15|240&t,(15&t)<<4|15&t,1):8===n?Iw(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):4===n?Iw(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|240&t,((15&t)<<4|15&t)/255):null):(t=bc.exec(e))?new Tw(t[1],t[2],t[3],1):(t=kc.exec(e))?new Tw(255*t[1]/100,255*t[2]/100,255*t[3]/100,1):(t=xc.exec(e))?Iw(t[1],t[2],t[3],t[4]):(t=Ic.exec(e))?Iw(255*t[1]/100,255*t[2]/100,255*t[3]/100,t[4]):(t=Nc.exec(e))?Ow(t[1],t[2]/100,t[3]/100,1):(t=Sc.exec(e))?Ow(t[1],t[2]/100,t[3]/100,t[4]):Tc.hasOwnProperty(e)?xw(Tc[e]):"transparent"===e?new Tw(NaN,NaN,NaN,0):null}function xw(e){return new Tw(e>>16&255,e>>8&255,255&e,1)}function Iw(e,t,n,o){return o<=0&&(e=t=n=NaN),new Tw(e,t,n,o)}function Nw(e){return e instanceof yw||(e=kw(e)),e?new Tw((e=e.rgb()).r,e.g,e.b,e.opacity):new Tw}function Sw(e,t,n,o){return 1===arguments.length?Nw(e):new Tw(e,t,n,null==o?1:o)}function Tw(e,t,n,o){this.r=+e,this.g=+t,this.b=+n,this.opacity=+o}function Ew(){return`#${Dw(this.r)}${Dw(this.g)}${Dw(this.b)}`}function Aw(){return`#${Dw(this.r)}${Dw(this.g)}${Dw(this.b)}${Dw(255*(isNaN(this.opacity)?1:this.opacity))}`}function Cw(){const e=_w(this.opacity);return`${1===e?"rgb(":"rgba("}${Pw(this.r)}, ${Pw(this.g)}, ${Pw(this.b)}${1===e?")":`, ${e})`}`}function _w(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Pw(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Dw(e){return((e=Pw(e))<16?"0":"")+e.toString(16)}function Ow(e,t,n,o){return o<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new jw(e,t,n,o)}function Mw(e){if(e instanceof jw)return new jw(e.h,e.s,e.l,e.opacity);if(e instanceof yw||(e=kw(e)),!e)return new jw;if(e instanceof jw)return e;var t=(e=e.rgb()).r/255,n=e.g/255,o=e.b/255,a=Math.min(t,n,o),i=Math.max(t,n,o),r=NaN,s=i-a,l=(i+a)/2;return s?(r=t===i?(n-o)/s+6*(n<o):n===i?(o-t)/s+2:(t-n)/s+4,s/=l<.5?i+a:2-i-a,r*=60):s=l>0&&l<1?0:r,new jw(r,s,l,e.opacity)}function Lw(e,t,n,o){return 1===arguments.length?Mw(e):new jw(e,t,n,null==o?1:o)}function jw(e,t,n,o){this.h=+e,this.s=+t,this.l=+n,this.opacity=+o}function $w(e){return(e=(e||0)%360)<0?e+360:e}function Bw(e){return Math.max(0,Math.min(1,e||0))}function Vw(e,t,n){return 255*(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)}function Rw(e){return 1==(e=+e)?Fw:function(t,n){return n-t?function(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(o){return Math.pow(e+o*t,n)}}(t,n,e):Ec(isNaN(t)?n:t)}}function Fw(e,t){var n=t-e;return n?function(e,t){return function(n){return e+n*t}}(e,n):Ec(isNaN(e)?t:e)}function Ww(e,t){t||(t=[]);var n,o=e?Math.min(t.length,e.length):0,a=t.slice();return function(i){for(n=0;n<o;++n)a[n]=e[n]*(1-i)+t[n]*i;return a}}function Uw(e,t){var n,o=t?t.length:0,a=e?Math.min(o,e.length):0,i=new Array(a),r=new Array(o);for(n=0;n<a;++n)i[n]=Xw(e[n],t[n]);for(;n<o;++n)r[n]=t[n];return function(e){for(n=0;n<a;++n)r[n]=i[n](e);return r}}function zw(e,t){var n=new Date;return e=+e,t=+t,function(o){return n.setTime(e*(1-o)+t*o),n}}function Hw(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function Gw(e,t){var n,o={},a={};for(n in null!==e&&"object"==typeof e||(e={}),null!==t&&"object"==typeof t||(t={}),t)n in e?o[n]=Xw(e[n],t[n]):a[n]=t[n];return function(e){for(n in o)a[n]=o[n](e);return a}}function Yw(e,t){var n,o,a,i=Cc.lastIndex=_c.lastIndex=0,r=-1,s=[],l=[];for(e+="",t+="";(n=Cc.exec(e))&&(o=_c.exec(t));)(a=o.index)>i&&(a=t.slice(i,a),s[r]?s[r]+=a:s[++r]=a),(n=n[0])===(o=o[0])?s[r]?s[r]+=o:s[++r]=o:(s[++r]=null,l.push({i:r,x:Hw(n,o)})),i=_c.lastIndex;return i<t.length&&(a=t.slice(i),s[r]?s[r]+=a:s[++r]=a),s.length<2?l[0]?function(e){return function(t){return e(t)+""}}(l[0].x):function(e){return function(){return e}}(t):(t=l.length,function(e){for(var n,o=0;o<t;++o)s[(n=l[o]).i]=n.x(e);return s.join("")})}function Xw(e,t){var n,o,a=typeof t;return null==t||"boolean"===a?Ec(t):("number"===a?Hw:"string"===a?(n=kw(t))?(t=n,Ac):Yw:t instanceof kw?Ac:t instanceof Date?zw:(o=t,!ArrayBuffer.isView(o)||o instanceof DataView?Array.isArray(t)?Uw:"function"!=typeof t.valueOf&&"function"!=typeof t.toString||isNaN(t)?Gw:Hw:Ww))(e,t)}function qw(e,t,n,o,a,i){var r,s,l;return(r=Math.sqrt(e*e+t*t))&&(e/=r,t/=r),(l=e*n+t*o)&&(n-=e*l,o-=t*l),(s=Math.sqrt(n*n+o*o))&&(n/=s,o/=s,l/=s),e*o<t*n&&(e=-e,t=-t,l=-l,r=-r),{translateX:a,translateY:i,rotate:Math.atan2(t,e)*Pc,skewX:Math.atan(l)*Pc,scaleX:r,scaleY:s}}function Jw(e){const t=new("function"==typeof DOMMatrix?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?Dc:qw(t.a,t.b,t.c,t.d,t.e,t.f)}function Kw(e){return null==e?Dc:(Oc||(Oc=document.createElementNS("http://www.w3.org/2000/svg","g")),Oc.setAttribute("transform",e),(e=Oc.transform.baseVal.consolidate())?qw((e=e.matrix).a,e.b,e.c,e.d,e.e,e.f):Dc)}function Zw(e,t,n,o){function a(e){return e.length?e.pop()+" ":""}return function(i,r){var s=[],l=[];return i=e(i),r=e(r),function(e,o,a,i,r,s){if(e!==a||o!==i){var l=r.push("translate(",null,t,null,n);s.push({i:l-4,x:Hw(e,a)},{i:l-2,x:Hw(o,i)})}else(a||i)&&r.push("translate("+a+t+i+n)}(i.translateX,i.translateY,r.translateX,r.translateY,s,l),function(e,t,n,i){e!==t?(e-t>180?t+=360:t-e>180&&(e+=360),i.push({i:n.push(a(n)+"rotate(",null,o)-2,x:Hw(e,t)})):t&&n.push(a(n)+"rotate("+t+o)}(i.rotate,r.rotate,s,l),function(e,t,n,i){e!==t?i.push({i:n.push(a(n)+"skewX(",null,o)-2,x:Hw(e,t)}):t&&n.push(a(n)+"skewX("+t+o)}(i.skewX,r.skewX,s,l),function(e,t,n,o,i,r){if(e!==n||t!==o){var s=i.push(a(i)+"scale(",null,",",null,")");r.push({i:s-4,x:Hw(e,n)},{i:s-2,x:Hw(t,o)})}else 1===n&&1===o||i.push(a(i)+"scale("+n+","+o+")")}(i.scaleX,i.scaleY,r.scaleX,r.scaleY,s,l),i=r=null,function(e){for(var t,n=-1,o=l.length;++n<o;)s[(t=l[n]).i]=t.x(e);return s.join("")}}}function Qw(e){return((e=Math.exp(e))+1/e)/2}function eb(){return zc||(Yc(tb),zc=Gc.now()+Hc)}function tb(){zc=0}function nb(){this._call=this._time=this._next=null}function ob(e,t,n){var o=new nb;return o.restart(e,t,n),o}function ab(){zc=(Uc=Gc.now())+Hc,$c=Bc=0;try{!function(){eb(),++$c;for(var e,t=Fc;t;)(e=zc-t._time)>=0&&t._call.call(void 0,e),t=t._next;--$c}()}finally{$c=0,function(){for(var e,t,n=Fc,o=1/0;n;)n._call?(o>n._time&&(o=n._time),e=n,n=n._next):(t=n._next,n._next=null,n=e?e._next=t:Fc=t);Wc=e,rb(o)}(),zc=0}}function ib(){var e=Gc.now(),t=e-Uc;t>Rc&&(Hc-=t,Uc=e)}function rb(e){$c||(Bc&&(Bc=clearTimeout(Bc)),e-zc>24?(e<1/0&&(Bc=setTimeout(ab,e-Gc.now()-Hc)),Vc&&(Vc=clearInterval(Vc))):(Vc||(Uc=Gc.now(),Vc=setInterval(ib,Rc)),$c=1,Yc(ab)))}function sb(e,t,n){var o=new nb;return t=null==t?0:+t,o.restart((n=>{o.stop(),e(n+t)}),t,n),o}function lb(e,t,n,o,a,i){var r=e.__transition;if(r){if(n in r)return}else e.__transition={};!function(e,t,n){var o,a=e.__transition;function i(e){n.state=Kc,n.timer.restart(r,n.delay,n.time),n.delay<=e&&r(e-n.delay)}function r(i){var u,c,d,p;if(n.state!==Kc)return l();for(u in a)if((p=a[u]).name===n.name){if(p.state===Qc)return sb(r);p.state===ed?(p.state=nd,p.timer.stop(),p.on.call("interrupt",e,e.__data__,p.index,p.group),delete a[u]):+u<t&&(p.state=nd,p.timer.stop(),p.on.call("cancel",e,e.__data__,p.index,p.group),delete a[u])}if(sb((function(){n.state===Qc&&(n.state=ed,n.timer.restart(s,n.delay,n.time),s(i))})),n.state=Zc,n.on.call("start",e,e.__data__,n.index,n.group),n.state===Zc){for(n.state=Qc,o=new Array(d=n.tween.length),u=0,c=-1;u<d;++u)(p=n.tween[u].value.call(e,e.__data__,n.index,n.group))&&(o[++c]=p);o.length=c+1}}function s(t){for(var a=t<n.duration?n.ease.call(null,t/n.duration):(n.timer.restart(l),n.state=td,1),i=-1,r=o.length;++i<r;)o[i].call(e,a);n.state===td&&(n.on.call("end",e,e.__data__,n.index,n.group),l())}function l(){for(var o in n.state=nd,n.timer.stop(),delete a[t],a)return;delete e.__transition}a[t]=n,n.timer=ob(i,0,n.time)}(e,n,{name:t,index:o,group:a,on:Xc,tween:qc,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:Jc})}function ub(e,t){var n=db(e,t);if(n.state>Jc)throw new Error("too late; already scheduled");return n}function cb(e,t){var n=db(e,t);if(n.state>Qc)throw new Error("too late; already running");return n}function db(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function pb(e,t){var n,o,a,i=e.__transition,r=!0;if(i){for(a in t=null==t?null:t+"",i)(n=i[a]).name===t?(o=n.state>Zc&&n.state<td,n.state=nd,n.timer.stop(),n.on.call(o?"interrupt":"cancel",e,e.__data__,n.index,n.group),delete i[a]):r=!1;r&&delete e.__transition}}function fb(e){return this.each((function(){pb(this,e)}))}function mb(e,t){var n,o;return function(){var a=cb(this,e),i=a.tween;if(i!==n)for(var r=0,s=(o=n=i).length;r<s;++r)if(o[r].name===t){(o=o.slice()).splice(r,1);break}a.tween=o}}function hb(e,t,n){var o,a;if("function"!=typeof n)throw new Error;return function(){var i=cb(this,e),r=i.tween;if(r!==o){a=(o=r).slice();for(var s={name:t,value:n},l=0,u=a.length;l<u;++l)if(a[l].name===t){a[l]=s;break}l===u&&a.push(s)}i.tween=a}}function yb(e,t){var n=this._id;if(e+="",arguments.length<2){for(var o,a=db(this.node(),n).tween,i=0,r=a.length;i<r;++i)if((o=a[i]).name===e)return o.value;return null}return this.each((null==t?mb:hb)(n,e,t))}function vb(e,t,n){var o=e._id;return e.each((function(){var e=cb(this,o);(e.value||(e.value={}))[t]=n.apply(this,arguments)})),function(e){return db(e,o).value[t]}}function gb(e,t){var n;return("number"==typeof t?Hw:t instanceof kw?Ac:(n=kw(t))?(t=n,Ac):Yw)(e,t)}function wb(e){return function(){this.removeAttribute(e)}}function bb(e){return function(){this.removeAttributeNS(e.space,e.local)}}function kb(e,t,n){var o,a,i=n+"";return function(){var r=this.getAttribute(e);return r===i?null:r===o?a:a=t(o=r,n)}}function xb(e,t,n){var o,a,i=n+"";return function(){var r=this.getAttributeNS(e.space,e.local);return r===i?null:r===o?a:a=t(o=r,n)}}function Ib(e,t,n){var o,a,i;return function(){var r,s,l=n(this);if(null!=l)return(r=this.getAttribute(e))===(s=l+"")?null:r===o&&s===a?i:(a=s,i=t(o=r,l));this.removeAttribute(e)}}function Nb(e,t,n){var o,a,i;return function(){var r,s,l=n(this);if(null!=l)return(r=this.getAttributeNS(e.space,e.local))===(s=l+"")?null:r===o&&s===a?i:(a=s,i=t(o=r,l));this.removeAttributeNS(e.space,e.local)}}function Sb(e,t){var n=fv(e),o="transform"===n?Lc:gb;return this.attrTween(e,"function"==typeof t?(n.local?Nb:Ib)(n,o,vb(this,"attr."+e,t)):null==t?(n.local?bb:wb)(n):(n.local?xb:kb)(n,o,t))}function Tb(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function Eb(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function Ab(e,t){var n,o;function a(){var a=t.apply(this,arguments);return a!==o&&(n=(o=a)&&Eb(e,a)),n}return a._value=t,a}function Cb(e,t){var n,o;function a(){var a=t.apply(this,arguments);return a!==o&&(n=(o=a)&&Tb(e,a)),n}return a._value=t,a}function _b(e,t){var n="attr."+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(null==t)return this.tween(n,null);if("function"!=typeof t)throw new Error;var o=fv(e);return this.tween(n,(o.local?Ab:Cb)(o,t))}function Pb(e,t){return function(){ub(this,e).delay=+t.apply(this,arguments)}}function Db(e,t){return t=+t,function(){ub(this,e).delay=t}}function Ob(e){var t=this._id;return arguments.length?this.each(("function"==typeof e?Pb:Db)(t,e)):db(this.node(),t).delay}function Mb(e,t){return function(){cb(this,e).duration=+t.apply(this,arguments)}}function Lb(e,t){return t=+t,function(){cb(this,e).duration=t}}function jb(e){var t=this._id;return arguments.length?this.each(("function"==typeof e?Mb:Lb)(t,e)):db(this.node(),t).duration}function $b(e,t){if("function"!=typeof t)throw new Error;return function(){cb(this,e).ease=t}}function Bb(e){var t=this._id;return arguments.length?this.each($b(t,e)):db(this.node(),t).ease}function Vb(e){if("function"!=typeof e)throw new Error;return this.each(function(e,t){return function(){var n=t.apply(this,arguments);if("function"!=typeof n)throw new Error;cb(this,e).ease=n}}(this._id,e))}function Rb(e){"function"!=typeof e&&(e=Nv(e));for(var t=this._groups,n=t.length,o=new Array(n),a=0;a<n;++a)for(var i,r=t[a],s=r.length,l=o[a]=[],u=0;u<s;++u)(i=r[u])&&e.call(i,i.__data__,u,r)&&l.push(i);return new ik(o,this._parents,this._name,this._id)}function Fb(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,o=t.length,a=n.length,i=Math.min(o,a),r=new Array(o),s=0;s<i;++s)for(var l,u=t[s],c=n[s],d=u.length,p=r[s]=new Array(d),f=0;f<d;++f)(l=u[f]||c[f])&&(p[f]=l);for(;s<o;++s)r[s]=t[s];return new ik(r,this._parents,this._name,this._id)}function Wb(e,t,n){var o,a,i=function(e){return(e+"").trim().split(/^|\s+/).every((function(e){var t=e.indexOf(".");return t>=0&&(e=e.slice(0,t)),!e||"start"===e}))}(t)?ub:cb;return function(){var r=i(this,e),s=r.on;s!==o&&(a=(o=s).copy()).on(t,n),r.on=a}}function Ub(e,t){var n=this._id;return arguments.length<2?db(this.node(),n).on.on(e):this.each(Wb(n,e,t))}function zb(){return this.on("end.remove",(e=this._id,function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}));var e}function Hb(e){var t=this._name,n=this._id;"function"!=typeof e&&(e=gv(e));for(var o=this._groups,a=o.length,i=new Array(a),r=0;r<a;++r)for(var s,l,u=o[r],c=u.length,d=i[r]=new Array(c),p=0;p<c;++p)(s=u[p])&&(l=e.call(s,s.__data__,p,u))&&("__data__"in s&&(l.__data__=s.__data__),d[p]=l,lb(d[p],t,n,p,d,db(s,n)));return new ik(i,this._parents,t,n)}function Gb(e){var t=this._name,n=this._id;"function"!=typeof e&&(e=xv(e));for(var o=this._groups,a=o.length,i=[],r=[],s=0;s<a;++s)for(var l,u=o[s],c=u.length,d=0;d<c;++d)if(l=u[d]){for(var p,f=e.call(l,l.__data__,d,u),m=db(l,n),h=0,y=f.length;h<y;++h)(p=f[h])&&lb(p,t,n,h,f,m);i.push(f),r.push(l)}return new ik(i,r,t,n)}function Yb(){return new od(this._groups,this._parents)}function Xb(e){return function(){this.style.removeProperty(e)}}function qb(e,t,n){var o="transform"==(e+="")?Mc:gb;return null==t?this.styleTween(e,function(e,t){var n,o,a;return function(){var i=cg(this,e),r=(this.style.removeProperty(e),cg(this,e));return i===r?null:i===n&&r===o?a:a=t(n=i,o=r)}}(e,o)).on("end.style."+e,Xb(e)):"function"==typeof t?this.styleTween(e,function(e,t,n){var o,a,i;return function(){var r=cg(this,e),s=n(this),l=s+"";return null==s&&(this.style.removeProperty(e),l=s=cg(this,e)),r===l?null:r===o&&l===a?i:(a=l,i=t(o=r,s))}}(e,o,vb(this,"style."+e,t))).each(function(e,t){var n,o,a,i,r="style."+t,s="end."+r;return function(){var l=cb(this,e),u=l.on,c=null==l.value[r]?i||(i=Xb(t)):void 0;u===n&&a===c||(o=(n=u).copy()).on(s,a=c),l.on=o}}(this._id,e)):this.styleTween(e,function(e,t,n){var o,a,i=n+"";return function(){var r=cg(this,e);return r===i?null:r===o?a:a=t(o=r,n)}}(e,o,t),n).on("end.style."+e,null)}function Jb(e,t,n){return function(o){this.style.setProperty(e,t.call(this,o),n)}}function Kb(e,t,n){var o,a;function i(){var i=t.apply(this,arguments);return i!==a&&(o=(a=i)&&Jb(e,i,n)),o}return i._value=t,i}function Zb(e,t,n){var o="style."+(e+="");if(arguments.length<2)return(o=this.tween(o))&&o._value;if(null==t)return this.tween(o,null);if("function"!=typeof t)throw new Error;return this.tween(o,Kb(e,t,null==n?"":n))}function Qb(e){return this.tween("text","function"==typeof e?function(e){return function(){var t=e(this);this.textContent=null==t?"":t}}(vb(this,"text",e)):function(e){return function(){this.textContent=e}}(null==e?"":e+""))}function ek(e){return function(t){this.textContent=e.call(this,t)}}function tk(e){var t,n;function o(){var o=e.apply(this,arguments);return o!==n&&(t=(n=o)&&ek(o)),t}return o._value=e,o}function nk(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(null==e)return this.tween(t,null);if("function"!=typeof e)throw new Error;return this.tween(t,tk(e))}function ok(){for(var e=this._name,t=this._id,n=rk(),o=this._groups,a=o.length,i=0;i<a;++i)for(var r,s=o[i],l=s.length,u=0;u<l;++u)if(r=s[u]){var c=db(r,t);lb(r,e,n,u,s,{time:c.time+c.delay+c.duration,delay:0,duration:c.duration,ease:c.ease})}return new ik(o,this._parents,e,n)}function ak(){var e,t,n=this,o=n._id,a=n.size();return new Promise((function(i,r){var s={value:r},l={value:function(){0==--a&&i()}};n.each((function(){var n=cb(this,o),a=n.on;a!==e&&((t=(e=a).copy())._.cancel.push(s),t._.interrupt.push(s),t._.end.push(l)),n.on=t})),0===a&&i()}))}function ik(e,t,n,o){this._groups=e,this._parents=t,this._name=n,this._id=o}function rk(){return++ad}function sk(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}function lk(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return n}function uk(e){var t,n;e instanceof ik?(t=e._id,e=e._name):(t=rk(),(n=rd).time=eb(),e=null==e?null:e+"");for(var o=this._groups,a=o.length,i=0;i<a;++i)for(var r,s=o[i],l=s.length,u=0;u<l;++u)(r=s[u])&&lb(r,e,t,u,s,n||lk(r,t));return new ik(o,this._parents,e,t)}function ck(e,{sourceEvent:t,target:n,transform:o,dispatch:a}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:o,enumerable:!0,configurable:!0},_:{value:a}})}function dk(e,t,n){this.k=e,this.x=t,this.y=n}function pk(e){e.stopImmediatePropagation()}function fk(e){e.preventDefault(),e.stopImmediatePropagation()}function mk(e){return!(e.ctrlKey&&"wheel"!==e.type||e.button)}function hk(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e).hasAttribute("viewBox")?[[(e=e.viewBox.baseVal).x,e.y],[e.x+e.width,e.y+e.height]]:[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]:[[0,0],[e.clientWidth,e.clientHeight]]}function yk(){return this.__zoom||ld}function vk(e){return-e.deltaY*(1===e.deltaMode?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function gk(){return navigator.maxTouchPoints||"ontouchstart"in this}function wk(e,t,n){var o=e.invertX(t[0][0])-n[0][0],a=e.invertX(t[1][0])-n[1][0],i=e.invertY(t[0][1])-n[0][1],r=e.invertY(t[1][1])-n[1][1];return e.translate(a>o?(o+a)/2:Math.min(0,o)||Math.max(0,a),r>i?(i+r)/2:Math.min(0,i)||Math.max(0,r))}function bk(e){var t,n;const o=(null==(n=null==(t=e.composedPath)?void 0:t.call(e))?void 0:n[0])||e.target,a="function"==typeof(null==o?void 0:o.hasAttribute)&&o.hasAttribute("contenteditable"),i="function"==typeof(null==o?void 0:o.closest)?o.closest(".nokey"):null;return yd.includes(null==o?void 0:o.nodeName)||a||!!i}function kk(e,t,n,o){const a=t.replace("+","\n").replace("\n\n","\n+").split("\n").map((e=>e.trim().toLowerCase()));if(1===a.length)return e.toLowerCase()===t.toLowerCase();o||n.add(e.toLowerCase());const i=a.every(((e,t)=>n.has(e)&&Array.from(n.values())[t]===a[t]));return o&&n.delete(e.toLowerCase()),i}function xk(e,t){const n=C((()=>g(null==t?void 0:t.target)??vd)),o=A(!0===g(e));let a=!1;const i=new Set;let r=l(g(e));function s(){a=!1,i.clear(),o.value=!0===g(e)}function l(e){return null===e?(s(),()=>!1):"boolean"==typeof e?(s(),o.value=e,()=>!1):Array.isArray(e)||"string"==typeof e?function(e,t){return n=>{if(!n.code&&!n.key)return!1;const o=(a=n.code,e.includes(a)?"code":"key");var a;return Array.isArray(e)?e.some((e=>kk(n[o],e,t,"keyup"===n.type))):kk(n[o],e,t,"keyup"===n.type)}}(e,i):e}return Y((()=>g(e)),((e,t)=>{"boolean"==typeof t&&"boolean"!=typeof e&&s(),r=l(e)}),{immediate:!0}),iv(["blur","contextmenu"],s),rv(((...e)=>r(...e)),(e=>{var n,i;const r=g(null==t?void 0:t.actInsideInputWithModifier)??!0,s=g(null==t?void 0:t.preventDefault)??!1;var l;if(a=(l=e).ctrlKey||l.metaKey||l.shiftKey||l.altKey,(!a||a&&!r)&&bk(e))return;const u=(null==(i=null==(n=e.composedPath)?void 0:n.call(e))?void 0:i[0])||e.target,c="BUTTON"===(null==u?void 0:u.nodeName)||"A"===(null==u?void 0:u.nodeName);s||!a&&c||e.preventDefault(),o.value=!0}),{eventName:"keydown",target:n}),rv(((...e)=>r(...e)),(e=>{const n=g(null==t?void 0:t.actInsideInputWithModifier)??!0;if(o.value){if((!a||a&&!n)&&bk(e))return;a=!1,o.value=!1}}),{eventName:"keyup",target:n}),o}function Ik(e){return{...e.computedPosition||{x:0,y:0},width:e.dimensions.width||0,height:e.dimensions.height||0}}function Nk(e,t){const n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),o=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*o)}function Sk(e){return{width:e.offsetWidth,height:e.offsetHeight}}function Tk(e,t=0,n=1){return Math.min(Math.max(e,t),n)}function Ek(e,t){return{x:Tk(e.x,t[0][0],t[1][0]),y:Tk(e.y,t[0][1],t[1][1])}}function Ak(e){const t=e.getRootNode();return"elementFromPoint"in t?t:window.document}function Ck(e){return e&&"object"==typeof e&&"id"in e&&"source"in e&&"target"in e}function _k(e){return e&&"object"==typeof e&&"id"in e&&"position"in e&&!Ck(e)}function Pk(e){return _k(e)&&"computedPosition"in e}function Dk(e){return!Number.isNaN(e)&&Number.isFinite(e)}function Ok(e,t,n){const o={id:e.id.toString(),type:e.type??"default",dimensions:Q({width:0,height:0}),computedPosition:Q({z:0,...e.position}),handleBounds:{source:[],target:[]},draggable:void 0,selectable:void 0,connectable:void 0,focusable:void 0,selected:!1,dragging:!1,resizing:!1,initialized:!1,isParent:!1,position:{x:0,y:0},data:Ex(e.data)?e.data:{},events:Q(Ex(e.events)?e.events:{})};return Object.assign(t??o,e,{id:e.id.toString(),parentNode:n})}function Mk(e,t,n){var o,a;const i={id:e.id.toString(),type:e.type??(null==t?void 0:t.type)??"default",source:e.source.toString(),target:e.target.toString(),sourceHandle:null==(o=e.sourceHandle)?void 0:o.toString(),targetHandle:null==(a=e.targetHandle)?void 0:a.toString(),updatable:e.updatable??(null==n?void 0:n.updatable),selectable:e.selectable??(null==n?void 0:n.selectable),focusable:e.focusable??(null==n?void 0:n.focusable),data:Ex(e.data)?e.data:{},events:Q(Ex(e.events)?e.events:{}),label:e.label??"",interactionWidth:e.interactionWidth??(null==n?void 0:n.interactionWidth),...n??{}};return Object.assign(t??i,e,{id:e.id.toString()})}function Lk(e,t,n,o){const a="string"==typeof e?e:e.id,i=new Set,r="source"===o?"target":"source";for(const s of n)s[r]===a&&i.add(s[o]);return t.filter((e=>i.has(e.id)))}function jk({source:e,sourceHandle:t,target:n,targetHandle:o}){return`vueflow__edge-${e}${t??""}-${n}${o??""}`}function $k({x:e,y:t},{x:n,y:o,zoom:a}){return{x:e*a+n,y:t*a+o}}function Bk({x:e,y:t},{x:n,y:o,zoom:a},i=!1,r=[1,1]){const s={x:(e-n)/a,y:(t-o)/a};return i?vx(s,r):s}function Vk(e,t){return{x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}}function Rk({x:e,y:t,width:n,height:o}){return{x:e,y:t,x2:e+n,y2:t+o}}function Fk({x:e,y:t,x2:n,y2:o}){return{x:e,y:t,width:n-e,height:o-t}}function Wk(e){let t={x:Number.POSITIVE_INFINITY,y:Number.POSITIVE_INFINITY,x2:Number.NEGATIVE_INFINITY,y2:Number.NEGATIVE_INFINITY};for(let n=0;n<e.length;n++){const o=e[n];t=Vk(t,Rk({...o.computedPosition,...o.dimensions}))}return Fk(t)}function Uk(e,t,n={x:0,y:0,zoom:1},o=!1,a=!1){const i={...Bk(t,n),width:t.width/n.zoom,height:t.height/n.zoom},r=[];for(const s of e){const{dimensions:e,selectable:t=!0,hidden:n=!1}=s,l=e.width??s.width??null,u=e.height??s.height??null;if(a&&!t||n)continue;const c=Nk(i,Ik(s));(null===l||null===u||o&&c>0||c>=(l??0)*(u??0)||s.dragging)&&r.push(s)}return r}function zk(e,t){const n=new Set;if("string"==typeof e)n.add(e);else if(e.length>=1)for(const o of e)n.add(o.id);return t.filter((e=>n.has(e.source)||n.has(e.target)))}function Hk(e,t){if("number"==typeof e)return Math.floor(.5*(t-t/(1+e)));if("string"==typeof e&&e.endsWith("px")){const t=Number.parseFloat(e);if(!Number.isNaN(t))return Math.floor(t)}if("string"==typeof e&&e.endsWith("%")){const n=Number.parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return Ix(`The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function Gk(e,t,n,o,a,i=.1){const r=function(e,t,n){if("string"==typeof e||"number"==typeof e){const o=Hk(e,n),a=Hk(e,t);return{top:o,right:a,bottom:o,left:a,x:2*a,y:2*o}}if("object"==typeof e){const o=Hk(e.top??e.y??0,n),a=Hk(e.bottom??e.y??0,n),i=Hk(e.left??e.x??0,t),r=Hk(e.right??e.x??0,t);return{top:o,right:r,bottom:a,left:i,x:i+r,y:o+a}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}(i,t,n),s=(t-r.x)/e.width,l=(n-r.y)/e.height,u=Tk(Math.min(s,l),o,a),c=t/2-(e.x+e.width/2)*u,d=n/2-(e.y+e.height/2)*u,p=function(e,t,n,o,a,i){const{x:r,y:s}=$k(e,{x:t,y:n,zoom:o}),{x:l,y:u}=$k({x:e.x+e.width,y:e.y+e.height},{x:t,y:n,zoom:o}),c=a-l,d=i-u;return{left:Math.floor(r),top:Math.floor(s),right:Math.floor(c),bottom:Math.floor(d)}}(e,c,d,u,t,n),f=Math.min(p.left-r.left,0),m=Math.min(p.top-r.top,0);return{x:c-f+Math.min(p.right-r.right,0),y:d-m+Math.min(p.bottom-r.bottom,0),zoom:u}}function Yk(e,t){if(!e.parentNode)return!1;const n=t.get(e.parentNode);return!!n&&(!!n.selected||Yk(n,t))}function Xk(e,t){return void 0===e?"":"string"==typeof e?e:`${t?`${t}__`:""}${Object.keys(e).sort().map((t=>`${t}=${e[t]}`)).join("&")}`}function qk(e){const t=e.ctrlKey&&Td()?10:1;return-e.deltaY*(1===e.deltaMode?.05:e.deltaMode?1:.002)*t}function Jk(e,t,n){return e<t?Tk(Math.abs(e-t),1,t)/t:e>n?-Tk(Math.abs(e-n),1,t)/t:0}function Kk(e,t,n=15,o=40){return[Jk(e.x,o,t.width-o)*n,Jk(e.y,o,t.height-o)*n]}function Zk(e,t){if(t){const n=e.position.x+e.dimensions.width-t.dimensions.width,o=e.position.y+e.dimensions.height-t.dimensions.height;if(n>0||o>0||e.position.x<0||e.position.y<0){let a={};if("function"==typeof t.style?a={...t.style(t)}:t.style&&(a={...t.style}),a.width=a.width??`${t.dimensions.width}px`,a.height=a.height??`${t.dimensions.height}px`,n>0)if("string"==typeof a.width){const e=Number(a.width.replace("px",""));a.width=`${e+n}px`}else a.width+=n;if(o>0)if("string"==typeof a.height){const e=Number(a.height.replace("px",""));a.height=`${e+o}px`}else a.height+=o;if(e.position.x<0){const n=Math.abs(e.position.x);if(t.position.x=t.position.x-n,"string"==typeof a.width){const e=Number(a.width.replace("px",""));a.width=`${e+n}px`}else a.width+=n;e.position.x=0}if(e.position.y<0){const n=Math.abs(e.position.y);if(t.position.y=t.position.y-n,"string"==typeof a.height){const e=Number(a.height.replace("px",""));a.height=`${e+n}px`}else a.height+=n;e.position.y=0}t.dimensions.width=Number(a.width.toString().replace("px","")),t.dimensions.height=Number(a.height.toString().replace("px","")),"function"==typeof t.style?t.style=e=>({...(0,t.style)(e),...a}):t.style={...t.style,...a}}}}function Qk(e,t){var n,o;const a=e.filter((e=>"add"===e.type||"remove"===e.type));for(const r of a)if("add"===r.type)-1===t.findIndex((e=>e.id===r.item.id))&&t.push(r.item);else if("remove"===r.type){const e=t.findIndex((e=>e.id===r.id));-1!==e&&t.splice(e,1)}const i=t.map((e=>e.id));for(const r of t)for(const a of e)if(a.id===r.id)switch(a.type){case"select":r.selected=a.selected;break;case"position":if(Pk(r)&&(void 0!==a.position&&(r.position=a.position),void 0!==a.dragging&&(r.dragging=a.dragging),r.expandParent&&r.parentNode)){const e=t[i.indexOf(r.parentNode)];e&&Pk(e)&&Zk(r,e)}break;case"dimensions":if(Pk(r)&&(void 0!==a.dimensions&&(r.dimensions=a.dimensions),void 0!==a.updateStyle&&a.updateStyle&&(r.style={...r.style||{},width:`${null==(n=a.dimensions)?void 0:n.width}px`,height:`${null==(o=a.dimensions)?void 0:o.height}px`}),void 0!==a.resizing&&(r.resizing=a.resizing),r.expandParent&&r.parentNode)){const e=t[i.indexOf(r.parentNode)];e&&Pk(e)&&(e.dimensions.width&&e.dimensions.height?Zk(r,e):j((()=>{Zk(r,e)})))}}return t}function ex(e,t){return{id:e,type:"select",selected:t}}function tx(e){return{item:e,type:"add"}}function nx(e){return{id:e,type:"remove"}}function ox(e,t,n,o,a){return{id:e,source:t,target:n,sourceHandle:o||null,targetHandle:a||null,type:"remove"}}function ax(e,t=new Set,n=!1){const o=[];for(const[a,i]of e){const e=t.has(a);void 0===i.selected&&!e||i.selected===e||(n&&(i.selected=e),o.push(ex(i.id,e)))}return o}function ix(e){const t=new Set;let n=xd,o=()=>!1;const a=()=>t.size>0||o(),i=e=>{t.delete(e)};return{on:e=>{t.add(e);const n=()=>i(e);return Jy(n),{off:n}},off:i,trigger:o=>{const i=[n];return a()?i.push(...t):e&&i.push(e),Promise.allSettled(i.map((e=>e(o))))},hasListeners:a,listeners:t,setEmitter:e=>{n=e},removeEmitter:()=>{n=xd},setHasEmitListeners:e=>{o=e},removeHasEmitListeners:()=>{o=()=>!1}}}function rx(e,t,n){let o=e;do{if(o&&o.matches(t))return!0;if(o===n)return!1;o=o.parentElement}while(o);return!1}function sx({id:e,dragItems:t,findNode:n}){const o=[];for(const a of t){const e=n(a.id);e&&o.push(e)}return[e?o.find((t=>t.id===e)):o[0],o]}function lx(e){if(Array.isArray(e))switch(e.length){case 1:return[e[0],e[0],e[0],e[0]];case 2:return[e[0],e[1],e[0],e[1]];case 3:return[e[0],e[1],e[2],e[1]];case 4:return e;default:return[0,0,0,0]}return[e,e,e,e]}function ux(e,t,n,o){let a=e.extent||n;if("parent"!==a&&(Array.isArray(a)||"parent"!==(null==a?void 0:a.range))||e.expandParent){if(Array.isArray(a)){const e=(null==o?void 0:o.computedPosition.x)||0,t=(null==o?void 0:o.computedPosition.y)||0;a=[[a[0][0]+e,a[0][1]+t],[a[1][0]+e,a[1][1]+t]]}else if("parent"!==a&&(null==a?void 0:a.range)&&Array.isArray(a.range)){const[e,t,n,i]=lx(a.padding),r=(null==o?void 0:o.computedPosition.x)||0,s=(null==o?void 0:o.computedPosition.y)||0;a=[[a.range[0][0]+r+i,a.range[0][1]+s+e],[a.range[1][0]+r-t,a.range[1][1]+s-n]]}}else if(e.parentNode&&o&&e.dimensions.width&&e.dimensions.height){const e=function(e,t,n){const[o,a,i,r]="string"!=typeof e?lx(e.padding):[0,0,0,0];return!(!n||void 0===n.computedPosition.x||void 0===n.computedPosition.y||void 0===n.dimensions.width||void 0===n.dimensions.height)&&[[n.computedPosition.x+r,n.computedPosition.y+o],[n.computedPosition.x+n.dimensions.width-a,n.computedPosition.y+n.dimensions.height-i]]}(a,0,o);e&&(a=e)}else t(new Sd(Id.NODE_EXTENT_INVALID,e.id)),a=n;return"parent"===a?[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]]:a}function cx(e,t,n,o,a){const i=Ek(t,function({width:e,height:t},n){return[n[0],[n[1][0]-(e||0),n[1][1]-(t||0)]]}(e.dimensions,ux(e,n,o,a)));return{position:{x:i.x-((null==a?void 0:a.computedPosition.x)||0),y:i.y-((null==a?void 0:a.computedPosition.y)||0)},computedPosition:i}}function dx(e,t,n=ud.Left,o=!1){const a=((null==t?void 0:t.x)??0)+e.computedPosition.x,i=((null==t?void 0:t.y)??0)+e.computedPosition.y,{width:r,height:s}=t??function(e){var t,n;return{width:(null==(t=e.dimensions)?void 0:t.width)??e.width??0,height:(null==(n=e.dimensions)?void 0:n.height)??e.height??0}}(e);if(o)return{x:a+r/2,y:i+s/2};switch((null==t?void 0:t.position)??n){case ud.Top:return{x:a+r/2,y:i};case ud.Right:return{x:a+r,y:i+s/2};case ud.Bottom:return{x:a+r/2,y:i+s};case ud.Left:return{x:a,y:i+s/2}}}function px(e,t){return e&&(t?e.find((e=>e.id===t)):e[0])||null}function fx({sourcePos:e,targetPos:t,sourceWidth:n,sourceHeight:o,targetWidth:a,targetHeight:i,width:r,height:s,viewport:l}){const u={x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x+n,t.x+a),y2:Math.max(e.y+o,t.y+i)};u.x===u.x2&&(u.x2+=1),u.y===u.y2&&(u.y2+=1);const c=Rk({x:(0-l.x)/l.zoom,y:(0-l.y)/l.zoom,width:r/l.zoom,height:s/l.zoom}),d=Math.max(0,Math.min(c.x2,u.x2)-Math.max(c.x,u.x)),p=Math.max(0,Math.min(c.y2,u.y2)-Math.max(c.y,u.y));return Math.ceil(d*p)>0}function mx(e,t,n=!1){const o="number"==typeof e.zIndex;let a=o?e.zIndex:0;const i=t(e.source),r=t(e.target);return i&&r?(n&&(a=o?e.zIndex:Math.max(i.computedPosition.z||0,r.computedPosition.z||0)),a):0}function hx(e){return"clientX"in e}function yx(e,t){let n,o;return hx(e)?(n=e.clientX,o=e.clientY):"touches"in e&&e.touches.length>0?(n=e.touches[0].clientX,o=e.touches[0].clientY):"changedTouches"in e&&e.changedTouches.length>0?(n=e.changedTouches[0].clientX,o=e.changedTouches[0].clientY):(n=0,o=0),{x:n-((null==t?void 0:t.left)??0),y:o-((null==t?void 0:t.top)??0)}}function vx(e,t=[1,1]){return{x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}}function gx(e){e?.classList.remove("valid","connecting","vue-flow__handle-valid","vue-flow__handle-connecting")}function wx(e,t,n,o){var a,i;let r=[],s=Number.POSITIVE_INFINITY;const l=function(e,t,n){const o=[],a={x:e.x-n,y:e.y-n,width:2*n,height:2*n};for(const i of t.values())Nk(a,Ik(i))>0&&o.push(i);return o}(e,n,t+Ad);for(const u of l){const n=[...(null==(a=u.handleBounds)?void 0:a.source)??[],...(null==(i=u.handleBounds)?void 0:i.target)??[]];for(const a of n){if(o.nodeId===a.nodeId&&o.type===a.type&&o.id===a.id)continue;const{x:n,y:i}=dx(u,a,a.position,!0),l=Math.sqrt((n-e.x)**2+(i-e.y)**2);l>t||(l<s?(r=[{...a,x:n,y:i}],s=l):l===s&&r.push({...a,x:n,y:i}))}}if(!r.length)return null;if(r.length>1){const e="source"===o.type?"target":"source";return r.find((t=>t.type===e))??r[0]}return r[0]}function bx(e,{handle:t,connectionMode:n,fromNodeId:o,fromHandleId:a,fromType:i,doc:r,lib:s,flowId:l,isValidConnection:u=Ed},c,d,p,f){const m="target"===i,h=t?r.querySelector(`.${s}-flow__handle[data-id="${l}-${null==t?void 0:t.nodeId}-${null==t?void 0:t.id}-${null==t?void 0:t.type}"]`):null,{x:y,y:v}=yx(e),g=r.elementFromPoint(y,v),w=(null==g?void 0:g.classList.contains(`${s}-flow__handle`))?g:h,b={handleDomNode:w,isValid:!1,connection:null,toHandle:null};if(w){const e=kx(void 0,w),t=w.getAttribute("data-nodeid"),i=w.getAttribute("data-handleid"),r=w.classList.contains("connectable"),s=w.classList.contains("connectableend");if(!t||!e)return b;const l={source:m?t:o,sourceHandle:m?i:a,target:m?o:t,targetHandle:m?a:i};b.connection=l,b.isValid=r&&s&&(n===pd.Strict?m&&"source"===e||!m&&"target"===e:t!==o||i!==a)&&u(l,{nodes:d,edges:c,sourceNode:p(l.source),targetNode:p(l.target)}),b.toHandle=xx(t,e,i,f,n,!0)}return b}function kx(e,t){return e||((null==t?void 0:t.classList.contains("target"))?"target":(null==t?void 0:t.classList.contains("source"))?"source":null)}function xx(e,t,n,o,a,i=!1){var r,s,l;const u=o.get(e);if(!u)return null;const c=a===pd.Strict?null==(r=u.handleBounds)?void 0:r[t]:[...(null==(s=u.handleBounds)?void 0:s.source)??[],...(null==(l=u.handleBounds)?void 0:l.target)??[]],d=(n?null==c?void 0:c.find((e=>e.id===n)):null==c?void 0:c[0])??null;return d&&i?{...d,...dx(u,d,d.position,!0)}:d}function Ix(e,...t){Nx()&&console.warn(`[Vue Flow]: ${e}`,...t)}function Nx(){return!_d.includes("production")}function Sx(e,t,n,o,a){const i=t.querySelectorAll(`.vue-flow__handle.${e}`);return(null==i?void 0:i.length)?Array.from(i).map((t=>{const i=t.getBoundingClientRect();return{id:t.getAttribute("data-handleid"),type:e,nodeId:a,position:t.getAttribute("data-handlepos"),x:(i.left-n.left)/o,y:(i.top-n.top)/o,...Sk(t)}})):null}function Tx(e,t,n,o,a,i=!1,r){a.value=!1,e.selected?(i||e.selected&&t)&&(o([e]),j((()=>{r.blur()}))):n([e])}function Ex(e){return void 0!==$(e)}function Ax(e,t,n,o){if(!e||!e.source||!e.target)return n(new Sd(Id.EDGE_INVALID,(null==e?void 0:e.id)??"[ID UNKNOWN]")),!1;let a;return a=Ck(e)?e:{...e,id:jk(e)},a=Mk(a,void 0,o),!function(e,t){return t.some((t=>Ck(t)&&t.source===e.source&&t.target===e.target&&(t.sourceHandle===e.sourceHandle||!t.sourceHandle&&!e.sourceHandle)&&(t.targetHandle===e.targetHandle||!t.targetHandle&&!e.targetHandle)))}(a,t)&&a}function Cx(e,t,n){const o={},a=[];for(let i=0;i<e.length;++i){const r=e[i];if(!_k(r)){n(new Sd(Id.NODE_INVALID,null==r?void 0:r.id));continue}const s=Ok(r,t(r.id),r.parentNode);r.parentNode&&(o[r.parentNode]=!0),a[i]=s}for(const i of a){const e=t(i.parentNode)||a.find((e=>e.id===i.parentNode));i.parentNode&&!e&&n(new Sd(Id.NODE_MISSING_PARENT,i.id,i.parentNode)),(i.parentNode||o[i.id])&&(o[i.id]&&(i.isParent=!0),e&&(e.isParent=!0))}return a}function _x(e,t,n,o,a,i){let r=a;const s=o.get(r)||new Map;o.set(r,s.set(n,t)),r=`${a}-${e}`;const l=o.get(r)||new Map;if(o.set(r,l.set(n,t)),i){r=`${a}-${e}-${i}`;const s=o.get(r)||new Map;o.set(r,s.set(n,t))}}function Px(e,t,n){e.clear();for(const o of n){const{source:t,target:n,sourceHandle:a=null,targetHandle:i=null}=o,r={edgeId:o.id,source:t,target:n,sourceHandle:a,targetHandle:i},s=`${t}-${a}--${n}-${i}`;_x("source",r,`${n}-${i}--${t}-${a}`,e,t,a),_x("target",r,s,e,n,i)}}function Dx(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function Ox(e,t,n,o,a,i,r,s){const l=[];for(const u of e){const e=Ck(u)?u:Ax(u,s,a,i);if(!e)continue;const c=n(e.source),d=n(e.target);if(!c||!d){a(new Sd(Id.EDGE_SOURCE_TARGET_MISSING,e.id,e.source,e.target));continue}if(!c){a(new Sd(Id.EDGE_SOURCE_MISSING,e.id,e.source));continue}if(!d){a(new Sd(Id.EDGE_TARGET_MISSING,e.id,e.target));continue}if(t&&!t(e,{edges:s,nodes:r,sourceNode:c,targetNode:d})){a(new Sd(Id.EDGE_INVALID,e.id));continue}const p=o(e.id);l.push({...Mk(e,p,i),sourceNode:c,targetNode:d})}return l}function Mx(e){const{vueFlowRef:t,snapToGrid:n,snapGrid:o,noDragClassName:a,nodeLookup:i,nodeExtent:r,nodeDragThreshold:s,viewport:l,autoPanOnNodeDrag:u,autoPanSpeed:c,nodesDraggable:d,panBy:p,findNode:f,multiSelectionActive:m,nodesSelectionActive:h,selectNodesOnDrag:y,removeSelectedElements:v,addSelectedNodes:w,updateNodePositions:b,emits:k}=oI(),{onStart:x,onDrag:I,onStop:N,onClick:S,el:T,disabled:E,id:C,selectable:_,dragHandle:P}=e,D=A(!1);let O,M=[],L=null,j={x:void 0,y:void 0},$={x:0,y:0},B=null,V=!1,R=!1,F=0,W=!1;const U=jx(),z=({x:e,y:t})=>{j={x:e,y:t};let a=!1;if(M=M.map((i=>{const s={x:e-i.distance.x,y:t-i.distance.y},{computedPosition:l}=cx(i,n.value?vx(s,o.value):s,k.error,r.value,i.parentNode?f(i.parentNode):void 0);return a=a||i.position.x!==l.x||i.position.y!==l.y,i.position=l,i})),R=R||a,a&&(b(M,!0,!0),D.value=!0,B)){const[e,t]=sx({id:C,dragItems:M,findNode:f});I({event:B,node:e,nodes:t})}},H=()=>{if(!L)return;const[e,t]=Kk($,L,c.value);if(0!==e||0!==t){const n={x:(j.x??0)-e/l.value.zoom,y:(j.y??0)-t/l.value.zoom};p({x:e,y:t})&&z(n)}F=requestAnimationFrame(H)},G=(e,t)=>{V=!0;const n=f(C);y.value||m.value||!n||n.selected||v(),n&&g(_)&&y.value&&Tx(n,m.value,w,v,h,!1,t);const o=U(e.sourceEvent);if(j=o,M=function(e,t,n,o){var a,i;const r=new Map;for(const[s,l]of e)!l.selected&&l.id!==o||l.parentNode&&Yk(l,e)||!(l.draggable||t&&void 0===l.draggable)||e.get(s)&&r.set(s,{id:l.id,position:l.position||{x:0,y:0},distance:{x:n.x-(null==(a=l.computedPosition)?void 0:a.x)||0,y:n.y-(null==(i=l.computedPosition)?void 0:i.y)||0},from:{x:l.computedPosition.x,y:l.computedPosition.y},extent:l.extent,parentNode:l.parentNode,dimensions:{...l.dimensions},expandParent:l.expandParent});return Array.from(r.values())}(i.value,d.value,o,C),M.length){const[t,n]=sx({id:C,dragItems:M,findNode:f});x({event:e.sourceEvent,node:t,nodes:n})}};return Y([()=>g(E),T],(([e,n],o,i)=>{if(n){const o=ow(n);e||(O=function(){var e,t,n,o,a=cw,i=dw,r=pw,s=fw,l={},u=lv("start","drag","end"),c=0,d=0;function p(e){e.on("mousedown.drag",f).filter(s).on("touchstart.drag",y).on("touchmove.drag",v,dc).on("touchend.drag touchcancel.drag",g).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function f(r,s){if(!o&&a.call(this,r,s)){var l=w(this,i.call(this,r,s),r,s,"mouse");l&&(ow(r.view).on("mousemove.drag",m,pc).on("mouseup.drag",h,pc),sw(r.view),iw(r),n=!1,e=r.clientX,t=r.clientY,l("start",r))}}function m(o){if(rw(o),!n){var a=o.clientX-e,i=o.clientY-t;n=a*a+i*i>d}l.mouse("drag",o)}function h(e){ow(e.view).on("mousemove.drag mouseup.drag",null),lw(e.view,n),rw(e),l.mouse("end",e)}function y(e,t){if(a.call(this,e,t)){var n,o,r=e.changedTouches,s=i.call(this,e,t),l=r.length;for(n=0;n<l;++n)(o=w(this,s,e,t,r[n].identifier,r[n]))&&(iw(e),o("start",e,r[n]))}}function v(e){var t,n,o=e.changedTouches,a=o.length;for(t=0;t<a;++t)(n=l[o[t].identifier])&&(rw(e),n("drag",e,o[t]))}function g(e){var t,n,a=e.changedTouches,i=a.length;for(o&&clearTimeout(o),o=setTimeout((function(){o=null}),500),t=0;t<i;++t)(n=l[a[t].identifier])&&(iw(e),n("end",e,a[t]))}function w(e,t,n,o,a,i){var s,d,f,m=u.copy(),h=aw(i||n,t);if(null!=(f=r.call(e,new uw("beforestart",{sourceEvent:n,target:p,identifier:a,active:c,x:h[0],y:h[1],dx:0,dy:0,dispatch:m}),o)))return s=f.x-h[0]||0,d=f.y-h[1]||0,function n(i,r,u){var y,v=h;switch(i){case"start":l[a]=n,y=c++;break;case"end":delete l[a],--c;case"drag":h=aw(u||r,t),y=c}m.call(i,e,new uw(i,{sourceEvent:r,subject:f,target:p,identifier:a,active:y,x:h[0]+s,y:h[1]+d,dx:h[0]-v[0],dy:h[1]-v[1],dispatch:m}),o)}}return p.filter=function(e){return arguments.length?(a="function"==typeof e?e:fc(!!e),p):a},p.container=function(e){return arguments.length?(i="function"==typeof e?e:fc(e),p):i},p.subject=function(e){return arguments.length?(r="function"==typeof e?e:fc(e),p):r},p.touchable=function(e){return arguments.length?(s="function"==typeof e?e:fc(!!e),p):s},p.on=function(){var e=u.on.apply(u,arguments);return e===u?p:e},p.clickDistance=function(e){return arguments.length?(d=(e=+e)*e,p):Math.sqrt(d)},p}().on("start",(e=>((e,n)=>{var o;"touchmove"===e.sourceEvent.type&&e.sourceEvent.touches.length>1||(R=!1,0===s.value&&G(e,n),j=U(e.sourceEvent),L=(null==(o=t.value)?void 0:o.getBoundingClientRect())||null,$=yx(e.sourceEvent,L))})(e,n))).on("drag",(e=>((e,t)=>{const n=U(e.sourceEvent);if(!W&&V&&u.value&&(W=!0,H()),!V){const o=n.xSnapped-(j.x??0),a=n.ySnapped-(j.y??0);Math.sqrt(o*o+a*a)>s.value&&G(e,t)}(j.x!==n.xSnapped||j.y!==n.ySnapped)&&M.length&&V&&(B=e.sourceEvent,$=yx(e.sourceEvent,L),z(n))})(e,n))).on("end",(e=>(e=>{let t=!1;if(!V&&!D.value&&!m.value){const n=e.sourceEvent,o=U(n),a=o.xSnapped-(j.x??0),i=o.ySnapped-(j.y??0),r=Math.sqrt(a*a+i*i);0!==r&&r<=s.value&&(S?.(n),t=!0)}if(M.length&&!t){R&&(b(M,!1,!1),R=!1);const[t,n]=sx({id:C,dragItems:M,findNode:f});N({event:e.sourceEvent,node:t,nodes:n})}M=[],D.value=!1,W=!1,V=!1,j={x:void 0,y:void 0},cancelAnimationFrame(F)})(e))).filter((e=>{const t=e.target,o=g(P);return!e.button&&(!a.value||!rx(t,`.${a.value}`,n)&&(!o||rx(t,o,n)))})),o.call(O)),i((()=>{o.on(".drag",null),O&&(O.on("start",null),O.on("drag",null),O.on("end",null))}))}})),D}function Lx(e,t){const n={doubleClick:ix(),click:ix(),mouseEnter:ix(),mouseMove:ix(),mouseLeave:ix(),contextMenu:ix(),updateStart:ix(),update:ix(),updateEnd:ix()};return n.doubleClick.on((n=>{var o,a;t.edgeDoubleClick(n),null==(a=null==(o=e.events)?void 0:o.doubleClick)||a.call(o,n)})),n.click.on((n=>{var o,a;t.edgeClick(n),null==(a=null==(o=e.events)?void 0:o.click)||a.call(o,n)})),n.mouseEnter.on((n=>{var o,a;t.edgeMouseEnter(n),null==(a=null==(o=e.events)?void 0:o.mouseEnter)||a.call(o,n)})),n.mouseMove.on((n=>{var o,a;t.edgeMouseMove(n),null==(a=null==(o=e.events)?void 0:o.mouseMove)||a.call(o,n)})),n.mouseLeave.on((n=>{var o,a;t.edgeMouseLeave(n),null==(a=null==(o=e.events)?void 0:o.mouseLeave)||a.call(o,n)})),n.contextMenu.on((n=>{var o,a;t.edgeContextMenu(n),null==(a=null==(o=e.events)?void 0:o.contextMenu)||a.call(o,n)})),n.updateStart.on((n=>{var o,a;t.edgeUpdateStart(n),null==(a=null==(o=e.events)?void 0:o.updateStart)||a.call(o,n)})),n.update.on((n=>{var o,a;t.edgeUpdate(n),null==(a=null==(o=e.events)?void 0:o.update)||a.call(o,n)})),n.updateEnd.on((n=>{var o,a;t.edgeUpdateEnd(n),null==(a=null==(o=e.events)?void 0:o.updateEnd)||a.call(o,n)})),Object.entries(n).reduce(((e,[t,n])=>(e.emit[t]=n.trigger,e.on[t]=n.on,e)),{emit:{},on:{}})}function jx(){const{viewport:e,snapGrid:t,snapToGrid:n,vueFlowRef:o}=oI();return a=>{var i;const r=(null==(i=o.value)?void 0:i.getBoundingClientRect())??{left:0,top:0},{x:s,y:l}=yx(function(e){return"sourceEvent"in e}(a)?a.sourceEvent:a,r),u=Bk({x:s,y:l},e.value),{x:c,y:d}=n.value?vx(u,t.value):u;return{xSnapped:c,ySnapped:d,...u}}}function $x(){return!0}function Bx({handleId:e,nodeId:t,type:n,isValidConnection:o,edgeUpdaterType:a,onEdgeUpdate:i,onEdgeUpdateEnd:r}){const{id:s,vueFlowRef:l,connectionMode:u,connectionRadius:c,connectOnClick:d,connectionClickStartHandle:p,nodesConnectable:f,autoPanOnConnect:m,autoPanSpeed:h,findNode:y,panBy:v,startConnection:w,updateConnection:b,endConnection:k,emits:x,viewport:I,edges:N,nodes:S,isValidConnection:T,nodeLookup:E}=oI();let A=null,C=!1,_=null;return{handlePointerDown:function(d){var p;const f="target"===g(n),P=hx(d),D=Ak(d.target),O=d.currentTarget;if(O&&(P&&0===d.button||!P)){let n=function(n){z=yx(n,F),L=wx(Bk(z,I.value,!1,[1,1]),c.value,E.value,Y),H||(G(),H=!0);const o=bx(n,{handle:L,connectionMode:u.value,fromNodeId:g(t),fromHandleId:g(e),fromType:f?"target":"source",isValidConnection:j,doc:D,lib:"vue",flowId:s,nodeLookup:E.value},N.value,S.value,y,E.value);_=o.handleDomNode,A=o.connection,C=function(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}(!!L,o.isValid);const a={...J,isValid:C,to:o.toHandle&&C?$k({x:o.toHandle.x,y:o.toHandle.y},I.value):z,toHandle:o.toHandle,toPosition:C&&o.toHandle?o.toHandle.position:Cd[Y.position],toNode:o.toHandle?E.value.get(o.toHandle.nodeId):null};if(C&&L&&(null==J?void 0:J.toHandle)&&a.toHandle&&J.toHandle.type===a.toHandle.type&&J.toHandle.nodeId===a.toHandle.nodeId&&J.toHandle.id===a.toHandle.id&&J.to.x===a.to.x&&J.to.y===a.to.y)return;const i=L??o.toHandle;if(b(i&&C?$k({x:i.x,y:i.y},I.value):z,o.toHandle,function(e,t){let n=null;return t?n="valid":e&&!t&&(n="invalid"),n}(!!i,C)),J=a,!L&&!C&&!_)return gx(U);A&&A.source!==A.target&&_&&(gx(U),U=_,_.classList.add("connecting","vue-flow__handle-connecting"),_.classList.toggle("valid",!!C),_.classList.toggle("vue-flow__handle-valid",!!C))},P=function(e){"touches"in e&&e.touches.length>0||((L||_)&&A&&C&&(i?i(e,A):x.connect(A)),x.connectEnd(e),a&&r?.(e),gx(U),cancelAnimationFrame($),k(e),H=!1,C=!1,A=null,_=null,D.removeEventListener("mousemove",n),D.removeEventListener("mouseup",P),D.removeEventListener("touchmove",n),D.removeEventListener("touchend",P))};const M=y(g(t));let L,j=g(o)||T.value||$x;!j&&M&&(j=(f?M.isValidSourcePos:M.isValidTargetPos)||$x);let $=0;const{x:B,y:V}=yx(d),R=kx(g(a),O),F=null==(p=l.value)?void 0:p.getBoundingClientRect();if(!F||!R)return;const W=xx(g(t),R,g(e),E.value,u.value);if(!W)return;let U,z=yx(d,F),H=!1;const G=()=>{if(!m.value)return;const[e,t]=Kk(z,F,h.value);v({x:e,y:t}),$=requestAnimationFrame(G)},Y={...W,nodeId:g(t),type:R,position:W.position},X=E.value.get(g(t)),q={inProgress:!0,isValid:null,from:dx(X,Y,ud.Left,!0),fromHandle:Y,fromPosition:Y.position,fromNode:X,to:z,toHandle:null,toPosition:Cd[Y.position],toNode:null};w({nodeId:g(t),id:g(e),type:R,position:(null==O?void 0:O.getAttribute("data-handlepos"))||ud.Top,...z},{x:B-F.left,y:V-F.top}),x.connectStart({event:d,nodeId:g(t),handleId:g(e),handleType:R});let J=q;D.addEventListener("mousemove",n),D.addEventListener("mouseup",P),D.addEventListener("touchmove",n),D.addEventListener("touchend",P)}},handleClick:function(a){var i,r;if(!d.value)return;const l="target"===g(n);if(!p.value)return x.clickConnectStart({event:a,nodeId:g(t),handleId:g(e)}),void w({nodeId:g(t),type:g(n),id:g(e),position:ud.Top,...yx(a)},void 0,!0);let c=g(o)||T.value||$x;const m=y(g(t));if(!c&&m&&(c=(l?m.isValidSourcePos:m.isValidTargetPos)||$x),m&&!1===(void 0===m.connectable?f.value:m.connectable))return;const h=Ak(a.target),v=bx(a,{handle:{nodeId:g(t),id:g(e),type:g(n),position:ud.Top,...yx(a)},connectionMode:u.value,fromNodeId:p.value.nodeId,fromHandleId:p.value.id??null,fromType:p.value.type,isValidConnection:c,doc:h,lib:"vue",flowId:s,nodeLookup:E.value},N.value,S.value,y,E.value),b=(null==(i=v.connection)?void 0:i.source)===(null==(r=v.connection)?void 0:r.target);v.isValid&&v.connection&&!b&&x.connect(v.connection),x.clickConnectEnd(a),k(a,!0)}}}function Vx(e){const t=e??E(Dd,"")??"",n=E(Od,v(null)),{findNode:o,edges:a,emits:i}=oI(),r=o(t);return r||i.error(new Sd(Id.NODE_NOT_FOUND,t)),{id:t,nodeEl:n,node:r,parentNode:C((()=>o(r.parentNode))),connectedEdges:C((()=>zk([r],a.value)))}}function Rx(e,t){const n={doubleClick:ix(),click:ix(),mouseEnter:ix(),mouseMove:ix(),mouseLeave:ix(),contextMenu:ix(),dragStart:ix(),drag:ix(),dragStop:ix()};return n.doubleClick.on((n=>{var o,a;t.nodeDoubleClick(n),null==(a=null==(o=e.events)?void 0:o.doubleClick)||a.call(o,n)})),n.click.on((n=>{var o,a;t.nodeClick(n),null==(a=null==(o=e.events)?void 0:o.click)||a.call(o,n)})),n.mouseEnter.on((n=>{var o,a;t.nodeMouseEnter(n),null==(a=null==(o=e.events)?void 0:o.mouseEnter)||a.call(o,n)})),n.mouseMove.on((n=>{var o,a;t.nodeMouseMove(n),null==(a=null==(o=e.events)?void 0:o.mouseMove)||a.call(o,n)})),n.mouseLeave.on((n=>{var o,a;t.nodeMouseLeave(n),null==(a=null==(o=e.events)?void 0:o.mouseLeave)||a.call(o,n)})),n.contextMenu.on((n=>{var o,a;t.nodeContextMenu(n),null==(a=null==(o=e.events)?void 0:o.contextMenu)||a.call(o,n)})),n.dragStart.on((n=>{var o,a;t.nodeDragStart(n),null==(a=null==(o=e.events)?void 0:o.dragStart)||a.call(o,n)})),n.drag.on((n=>{var o,a;t.nodeDrag(n),null==(a=null==(o=e.events)?void 0:o.drag)||a.call(o,n)})),n.dragStop.on((n=>{var o,a;t.nodeDragStop(n),null==(a=null==(o=e.events)?void 0:o.dragStop)||a.call(o,n)})),Object.entries(n).reduce(((e,[t,n])=>(e.emit[t]=n.trigger,e.on[t]=n.on,e)),{emit:{},on:{}})}function Fx(){const{getSelectedNodes:e,nodeExtent:t,updateNodePositions:n,findNode:o,snapGrid:a,snapToGrid:i,nodesDraggable:r,emits:s}=oI();return(l,u=!1)=>{const c=i.value?a.value[0]:5,d=i.value?a.value[1]:5,p=u?4:1,f=l.x*c*p,m=l.y*d*p,h=[];for(const n of e.value)if(n.draggable||r&&void 0===n.draggable){const{position:e}=cx(n,{x:n.computedPosition.x+f,y:n.computedPosition.y+m},s.error,t.value,n.parentNode?o(n.parentNode):void 0);h.push({id:n.id,position:e,from:n.position,distance:{x:l.x,y:l.y},dimensions:n.dimensions})}n(h,!0,!1)}}function Wx(){return Ix("Viewport not initialized yet."),Promise.resolve(!1)}function Ux(e,t=0,n=Bd,o=(()=>{})){const a="number"==typeof t&&t>0;return a||o(),a?e.transition().duration(t).ease(n).on("end",o):e}function zx(e,t,n){const o=O(!0);return o.run((()=>{o.run((()=>{let t,o,a=!(!n.nodes.value.length&&!n.edges.value.length);t=ev([e.modelValue,()=>{var t,n;return null==(n=null==(t=e.modelValue)?void 0:t.value)?void 0:n.length}],(([e])=>{e&&Array.isArray(e)&&(o?.pause(),n.setElements(e),o||a||!e.length?o?.resume():a=!0)})),o=ev([n.nodes,n.edges,()=>n.edges.value.length,()=>n.nodes.value.length],(([n,o])=>{var a;(null==(a=e.modelValue)?void 0:a.value)&&Array.isArray(e.modelValue.value)&&(t?.pause(),e.modelValue.value=[...n,...o],j((()=>{t?.resume()})))}),{immediate:a}),k((()=>{t?.stop(),o?.stop()}))})),o.run((()=>{let t,o,a=!!n.nodes.value.length;t=ev([e.nodes,()=>{var t,n;return null==(n=null==(t=e.nodes)?void 0:t.value)?void 0:n.length}],(([e])=>{e&&Array.isArray(e)&&(o?.pause(),n.setNodes(e),o||a||!e.length?o?.resume():a=!0)})),o=ev([n.nodes,()=>n.nodes.value.length],(([n])=>{var o;(null==(o=e.nodes)?void 0:o.value)&&Array.isArray(e.nodes.value)&&(t?.pause(),e.nodes.value=[...n],j((()=>{t?.resume()})))}),{immediate:a}),k((()=>{t?.stop(),o?.stop()}))})),o.run((()=>{let t,o,a=!!n.edges.value.length;t=ev([e.edges,()=>{var t,n;return null==(n=null==(t=e.edges)?void 0:t.value)?void 0:n.length}],(([e])=>{e&&Array.isArray(e)&&(o?.pause(),n.setEdges(e),o||a||!e.length?o?.resume():a=!0)})),o=ev([n.edges,()=>n.edges.value.length],(([n])=>{var o;(null==(o=e.edges)?void 0:o.value)&&Array.isArray(e.edges.value)&&(t?.pause(),e.edges.value=[...n],j((()=>{t?.resume()})))}),{immediate:a}),k((()=>{t?.stop(),o?.stop()}))})),o.run((()=>{Y((()=>t.minZoom),(()=>{t.minZoom&&Ex(t.minZoom)&&n.setMinZoom(t.minZoom)}),{immediate:!0})})),o.run((()=>{Y((()=>t.maxZoom),(()=>{t.maxZoom&&Ex(t.maxZoom)&&n.setMaxZoom(t.maxZoom)}),{immediate:!0})})),o.run((()=>{Y((()=>t.translateExtent),(()=>{t.translateExtent&&Ex(t.translateExtent)&&n.setTranslateExtent(t.translateExtent)}),{immediate:!0})})),o.run((()=>{Y((()=>t.nodeExtent),(()=>{t.nodeExtent&&Ex(t.nodeExtent)&&n.setNodeExtent(t.nodeExtent)}),{immediate:!0})})),o.run((()=>{Y((()=>t.applyDefault),(()=>{Ex(t.applyDefault)&&(n.applyDefault.value=t.applyDefault)}),{immediate:!0})})),o.run((()=>{const e=async e=>{let o=e;"function"==typeof t.autoConnect&&(o=await t.autoConnect(e)),!1!==o&&n.addEdges([o])};Y((()=>t.autoConnect),(()=>{Ex(t.autoConnect)&&(n.autoConnect.value=t.autoConnect)}),{immediate:!0}),Y(n.autoConnect,((t,o,a)=>{t?n.onConnect(e):n.hooks.value.connect.off(e),a((()=>{n.hooks.value.connect.off(e)}))}),{immediate:!0})})),(()=>{const e=["id","modelValue","translateExtent","nodeExtent","edges","nodes","maxZoom","minZoom","applyDefault","autoConnect"];for(const a of Object.keys(t)){const i=a;if(!e.includes(i)){const e=u((()=>t[i])),a=n[i];s(a)&&o.run((()=>{Y(e,(e=>{Ex(e)&&(a.value=e)}),{immediate:!0})}))}}})()})),()=>o.stop()}function Hx(){return{vueFlowRef:null,viewportRef:null,nodes:[],edges:[],connectionLookup:new Map,nodeTypes:{},edgeTypes:{},initialized:!1,dimensions:{width:0,height:0},viewport:{x:0,y:0,zoom:1},d3Zoom:null,d3Selection:null,d3ZoomHandler:null,minZoom:.5,maxZoom:2,translateExtent:[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],nodeExtent:[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],selectionMode:cd.Full,paneDragging:!1,preventScrolling:!0,zoomOnScroll:!0,zoomOnPinch:!0,zoomOnDoubleClick:!0,panOnScroll:!1,panOnScrollSpeed:.5,panOnScrollMode:md.Free,paneClickDistance:0,panOnDrag:!0,edgeUpdaterRadius:10,onlyRenderVisibleElements:!1,defaultViewport:{x:0,y:0,zoom:1},nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,defaultMarkerColor:"#b1b1b7",connectionLineStyle:{},connectionLineType:null,connectionLineOptions:{type:dd.Bezier,style:{}},connectionMode:pd.Loose,connectionStartHandle:null,connectionEndHandle:null,connectionClickStartHandle:null,connectionPosition:{x:NaN,y:NaN},connectionRadius:20,connectOnClick:!0,connectionStatus:null,isValidConnection:null,snapGrid:[15,15],snapToGrid:!1,edgesUpdatable:!1,edgesFocusable:!0,nodesFocusable:!0,nodesConnectable:!0,nodesDraggable:!0,nodeDragThreshold:1,elementsSelectable:!0,selectNodesOnDrag:!0,multiSelectionActive:!1,selectionKeyCode:"Shift",multiSelectionKeyCode:Td()?"Meta":"Control",zoomActivationKeyCode:Td()?"Meta":"Control",deleteKeyCode:"Backspace",panActivationKeyCode:"Space",hooks:{edgesChange:ix(),nodesChange:ix(),nodeDoubleClick:ix(),nodeClick:ix(),nodeMouseEnter:ix(),nodeMouseMove:ix(),nodeMouseLeave:ix(),nodeContextMenu:ix(),nodeDragStart:ix(),nodeDrag:ix(),nodeDragStop:ix(),nodesInitialized:ix(),miniMapNodeClick:ix(),miniMapNodeDoubleClick:ix(),miniMapNodeMouseEnter:ix(),miniMapNodeMouseMove:ix(),miniMapNodeMouseLeave:ix(),connect:ix(),connectStart:ix(),connectEnd:ix(),clickConnectStart:ix(),clickConnectEnd:ix(),paneReady:ix(),init:ix(),move:ix(),moveStart:ix(),moveEnd:ix(),selectionDragStart:ix(),selectionDrag:ix(),selectionDragStop:ix(),selectionContextMenu:ix(),selectionStart:ix(),selectionEnd:ix(),viewportChangeStart:ix(),viewportChange:ix(),viewportChangeEnd:ix(),paneScroll:ix(),paneClick:ix(),paneContextMenu:ix(),paneMouseEnter:ix(),paneMouseMove:ix(),paneMouseLeave:ix(),edgeContextMenu:ix(),edgeMouseEnter:ix(),edgeMouseMove:ix(),edgeMouseLeave:ix(),edgeDoubleClick:ix(),edgeClick:ix(),edgeUpdateStart:ix(),edgeUpdate:ix(),edgeUpdateEnd:ix(),updateNodeInternals:ix(),error:ix((e=>Ix(e.message)))},applyDefault:!0,autoConnect:!1,fitViewOnInit:!1,fitViewOnInitDone:!1,noDragClassName:"nodrag",noWheelClassName:"nowheel",noPanClassName:"nopan",defaultEdgeOptions:void 0,elevateEdgesOnSelect:!1,elevateNodesOnSelect:!0,autoPanOnNodeDrag:!0,autoPanOnConnect:!0,autoPanSpeed:15,disableKeyboardA11y:!1,ariaLiveMessage:""}}function Gx(e,t,n){const o=function(e){function t(t,n){return new Promise((o=>{e.d3Selection&&e.d3Zoom?e.d3Zoom.interpolate("linear"===(null==n?void 0:n.interpolate)?Xw:jc).scaleBy(Ux(e.d3Selection,null==n?void 0:n.duration,null==n?void 0:n.ease,(()=>{o(!0)})),t):o(!1)}))}function n(t,n,o,a){return new Promise((i=>{var r;const{x:s,y:l}=Ek({x:-t,y:-n},e.translateExtent),u=ld.translate(-s,-l).scale(o);e.d3Selection&&e.d3Zoom?null==(r=e.d3Zoom)||r.interpolate("linear"===(null==a?void 0:a.interpolate)?Xw:jc).transform(Ux(e.d3Selection,null==a?void 0:a.duration,null==a?void 0:a.ease,(()=>{i(!0)})),u):i(!1)}))}return C((()=>e.d3Zoom&&e.d3Selection&&e.dimensions.width&&e.dimensions.height?{viewportInitialized:!0,zoomIn:e=>t(1.2,e),zoomOut:e=>t(1/1.2,e),zoomTo:(t,n)=>new Promise((o=>{e.d3Selection&&e.d3Zoom?e.d3Zoom.interpolate("linear"===(null==n?void 0:n.interpolate)?Xw:jc).scaleTo(Ux(e.d3Selection,null==n?void 0:n.duration,null==n?void 0:n.ease,(()=>{o(!0)})),t):o(!1)})),setViewport:(e,t)=>n(e.x,e.y,e.zoom,t),setTransform:(e,t)=>n(e.x,e.y,e.zoom,t),getViewport:()=>({x:e.viewport.x,y:e.viewport.y,zoom:e.viewport.zoom}),getTransform:()=>({x:e.viewport.x,y:e.viewport.y,zoom:e.viewport.zoom}),fitView:(t={padding:$d,includeHiddenNodes:!1,duration:0})=>{var o,a;const i=[];for(const n of e.nodes)n.dimensions.width&&n.dimensions.height&&((null==t?void 0:t.includeHiddenNodes)||!n.hidden)&&(!(null==(o=t.nodes)?void 0:o.length)||(null==(a=t.nodes)?void 0:a.length)&&t.nodes.includes(n.id))&&i.push(n);if(!i.length)return Promise.resolve(!1);const{x:r,y:s,zoom:l}=Gk(Wk(i),e.dimensions.width,e.dimensions.height,t.minZoom??e.minZoom,t.maxZoom??e.maxZoom,t.padding??$d);return n(r,s,l,t)},setCenter:(t,o,a)=>{const i=void 0!==(null==a?void 0:a.zoom)?a.zoom:e.maxZoom;return n(e.dimensions.width/2-t*i,e.dimensions.height/2-o*i,i,a)},fitBounds:(t,o={padding:$d})=>{const{x:a,y:i,zoom:r}=Gk(t,e.dimensions.width,e.dimensions.height,e.minZoom,e.maxZoom,o.padding??$d);return n(a,i,r,o)},project:t=>Bk(t,e.viewport,e.snapToGrid,e.snapGrid),screenToFlowCoordinate:t=>{if(e.vueFlowRef){const{x:n,y:o}=e.vueFlowRef.getBoundingClientRect();return Bk({x:t.x-n,y:t.y-o},e.viewport,e.snapToGrid,e.snapGrid)}return{x:0,y:0}},flowToScreenCoordinate:t=>{if(e.vueFlowRef){const{x:n,y:o}=e.vueFlowRef.getBoundingClientRect();return $k({x:t.x+n,y:t.y+o},e.viewport)}return{x:0,y:0}}}:Vd))}(e),a=t=>{const n=t??[];e.hooks.updateNodeInternals.trigger(n)},i=t=>zk(t,e.edges),r=e=>{if(e)return t.value.get(e)},s=e=>{if(e)return n.value.get(e)},l=(o,a)=>{const i=new Set,r=new Set;for(const e of o)_k(e)?i.add(e.id):Ck(e)&&r.add(e.id);const s=ax(t.value,i,!0),l=ax(n.value,r);if(e.multiSelectionActive){for(const e of i)s.push(ex(e,a));for(const e of r)l.push(ex(e,a))}s.length&&e.hooks.nodesChange.trigger(s),l.length&&e.hooks.edgesChange.trigger(l)},u=t=>{var n;null==(n=e.d3Zoom)||n.scaleExtent([t,e.maxZoom]),e.minZoom=t},c=t=>{var n;null==(n=e.d3Zoom)||n.scaleExtent([e.minZoom,t]),e.maxZoom=t},d=t=>{var n;null==(n=e.d3Zoom)||n.translateExtent(t),e.translateExtent=t},p=t=>{const n=t instanceof Function?t(e.nodes):t;(e.initialized||n.length)&&(e.nodes=Cx(n,r,e.hooks.error.trigger))},f=t=>{const o=t instanceof Function?t(e.edges):t;if(!e.initialized&&!o.length)return;const a=Ox(o,e.isValidConnection,r,s,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges);Px(e.connectionLookup,n.value,a),e.edges=a},m=t=>{const n=t instanceof Function?t([...e.nodes,...e.edges]):t;(e.initialized||n.length)&&(p(n.filter(_k)),f(n.filter(Ck)))},h=e=>{const t=Dk((n=e).width)&&Dk(n.height)&&Dk(n.x)&&Dk(n.y);var n;const o=t?null:Pk(e)?e:r(e.id);return t||o?[t?e:Ik(o),o,t]:[null,null,t]},y=t=>{const n=t instanceof Function?t(e):t,o=["d3Zoom","d3Selection","d3ZoomHandler","viewportRef","vueFlowRef","dimensions","hooks"];Ex(n.defaultEdgeOptions)&&(e.defaultEdgeOptions=n.defaultEdgeOptions);const a=n.modelValue||n.nodes||n.edges?[]:void 0;a&&(n.modelValue&&a.push(...n.modelValue),n.nodes&&a.push(...n.nodes),n.edges&&a.push(...n.edges),m(a));for(const i of Object.keys(n)){const t=i,a=n[t];![...Rd,...o].includes(t)&&Ex(a)&&(e[t]=a)}ov((()=>e.d3Zoom)).not.toBeNull().then((()=>{Ex(n.maxZoom)&&c(n.maxZoom),Ex(n.minZoom)&&u(n.minZoom),Ex(n.translateExtent)&&d(n.translateExtent)})),e.initialized||(e.initialized=!0)};return{updateNodePositions:(t,n,o)=>{var a,i;const s=[];for(const e of t){const t={id:e.id,type:"position",dragging:o,from:e.from};if(n&&(t.position=e.position,e.parentNode)){const n=r(e.parentNode);t.position={x:t.position.x-((null==(a=null==n?void 0:n.computedPosition)?void 0:a.x)??0),y:t.position.y-((null==(i=null==n?void 0:n.computedPosition)?void 0:i.y)??0)}}s.push(t)}(null==s?void 0:s.length)&&e.hooks.nodesChange.trigger(s)},updateNodeDimensions:t=>{if(!e.vueFlowRef)return;const n=e.vueFlowRef.querySelector(".vue-flow__transformationpane");if(!n)return;const a=window.getComputedStyle(n),{m22:i}=new window.DOMMatrixReadOnly(a.transform),s=[];for(const e of t){const t=e,n=r(t.id);if(n){const e=Sk(t.nodeElement);if(e.width&&e.height&&(n.dimensions.width!==e.width||n.dimensions.height!==e.height||t.forceUpdate)){const o=t.nodeElement.getBoundingClientRect();n.dimensions=e,n.handleBounds.source=Sx("source",t.nodeElement,o,i,n.id),n.handleBounds.target=Sx("target",t.nodeElement,o,i,n.id),s.push({id:n.id,type:"dimensions",dimensions:e})}}}!e.fitViewOnInitDone&&e.fitViewOnInit&&o.value.fitView().then((()=>{e.fitViewOnInitDone=!0})),s.length&&e.hooks.nodesChange.trigger(s)},setElements:m,setNodes:p,setEdges:f,addNodes:t=>{let n=t instanceof Function?t(e.nodes):t;n=Array.isArray(n)?n:[n];const o=Cx(n,r,e.hooks.error.trigger),a=[];for(const e of o)a.push(tx(e));a.length&&e.hooks.nodesChange.trigger(a)},addEdges:t=>{let n=t instanceof Function?t(e.edges):t;n=Array.isArray(n)?n:[n];const o=Ox(n,e.isValidConnection,r,s,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges),a=[];for(const e of o)a.push(tx(e));a.length&&e.hooks.edgesChange.trigger(a)},removeNodes:(t,n=!0,o=!1)=>{const a=t instanceof Function?t(e.nodes):t,s=Array.isArray(a)?a:[a],l=[],u=[];function c(e){const t=i(e);for(const n of t)Ex(n.deletable)&&!n.deletable||u.push(ox(n.id,n.source,n.target,n.sourceHandle,n.targetHandle))}function d(t){const o=[];for(const n of e.nodes)n.parentNode===t&&o.push(n);if(o.length){for(const e of o)l.push(nx(e.id));n&&c(o);for(const e of o)d(e.id)}}for(const e of s){const t="string"==typeof e?r(e):e;t&&(Ex(t.deletable)&&!t.deletable||(l.push(nx(t.id)),n&&c([t]),o&&d(t.id)))}u.length&&e.hooks.edgesChange.trigger(u),l.length&&e.hooks.nodesChange.trigger(l)},removeEdges:t=>{const n=t instanceof Function?t(e.edges):t,o=Array.isArray(n)?n:[n],a=[];for(const e of o){const t="string"==typeof e?s(e):e;t&&(Ex(t.deletable)&&!t.deletable||a.push(ox("string"==typeof e?e:e.id,t.source,t.target,t.sourceHandle,t.targetHandle)))}e.hooks.edgesChange.trigger(a)},findNode:r,findEdge:s,updateEdge:(t,o,a=!0)=>{const i=s(t.id);if(!i)return!1;const l=e.edges.indexOf(i),u=function(e,t,n,o,a){if(!t.source||!t.target)return a(new Sd(Id.EDGE_INVALID,e.id)),!1;if(!n)return a(new Sd(Id.EDGE_NOT_FOUND,e.id)),!1;const{id:i,...r}=e;return{...r,id:o?jk(t):i,source:t.source,target:t.target,sourceHandle:t.sourceHandle,targetHandle:t.targetHandle}}(t,o,i,a,e.hooks.error.trigger);if(u){const[t]=Ox([u],e.isValidConnection,r,s,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges);return e.edges=e.edges.map(((e,n)=>n===l?t:e)),Px(e.connectionLookup,n.value,[t]),t}return!1},updateEdgeData:(e,t,n={replace:!1})=>{const o=s(e);if(!o)return;const a="function"==typeof t?t(o):t;o.data=n.replace?a:{...o.data,...a}},updateNode:(t,n,o={replace:!1})=>{const a=r(t);if(!a)return;const i="function"==typeof n?n(a):n;o.replace?e.nodes.splice(e.nodes.indexOf(a),1,i):Object.assign(a,i)},updateNodeData:(e,t,n={replace:!1})=>{const o=r(e);if(!o)return;const a="function"==typeof t?t(o):t;o.data=n.replace?a:{...o.data,...a}},applyEdgeChanges:t=>{const o=Qk(t,e.edges);return Px(e.connectionLookup,n.value,o),o},applyNodeChanges:t=>Qk(t,e.nodes),addSelectedElements:e=>{l(e,!0)},addSelectedNodes:o=>{if(e.multiSelectionActive){const t=o.map((e=>ex(e.id,!0)));e.hooks.nodesChange.trigger(t)}else e.hooks.nodesChange.trigger(ax(t.value,new Set(o.map((e=>e.id))),!0)),e.hooks.edgesChange.trigger(ax(n.value))},addSelectedEdges:o=>{if(e.multiSelectionActive){const t=o.map((e=>ex(e.id,!0)));e.hooks.edgesChange.trigger(t)}else e.hooks.edgesChange.trigger(ax(n.value,new Set(o.map((e=>e.id))))),e.hooks.nodesChange.trigger(ax(t.value,new Set,!0))},setMinZoom:u,setMaxZoom:c,setTranslateExtent:d,setNodeExtent:t=>{e.nodeExtent=t,a()},setPaneClickDistance:t=>{var n;null==(n=e.d3Zoom)||n.clickDistance(t)},removeSelectedElements:t=>{if(!t||!t.length)return l([],!1);const n=t.reduce(((e,t)=>{const n=ex(t.id,!1);return _k(t)?e.nodes.push(n):e.edges.push(n),e}),{nodes:[],edges:[]});n.nodes.length&&e.hooks.nodesChange.trigger(n.nodes),n.edges.length&&e.hooks.edgesChange.trigger(n.edges)},removeSelectedNodes:t=>{const n=(t||e.nodes).map((e=>(e.selected=!1,ex(e.id,!1))));e.hooks.nodesChange.trigger(n)},removeSelectedEdges:t=>{const n=(t||e.edges).map((e=>(e.selected=!1,ex(e.id,!1))));e.hooks.edgesChange.trigger(n)},startConnection:(t,n,o=!1)=>{o?e.connectionClickStartHandle=t:e.connectionStartHandle=t,e.connectionEndHandle=null,e.connectionStatus=null,n&&(e.connectionPosition=n)},updateConnection:(t,n=null,o=null)=>{e.connectionStartHandle&&(e.connectionPosition=t,e.connectionEndHandle=n,e.connectionStatus=o)},endConnection:(t,n)=>{e.connectionPosition={x:NaN,y:NaN},e.connectionEndHandle=null,e.connectionStatus=null,n?e.connectionClickStartHandle=null:e.connectionStartHandle=null},setInteractive:t=>{e.nodesDraggable=t,e.nodesConnectable=t,e.elementsSelectable=t},setState:y,getIntersectingNodes:(t,n=!0,o=e.nodes)=>{const[a,i,r]=h(t);if(!a)return[];const s=[];for(const l of o||e.nodes){if(!(r||l.id!==i.id&&l.computedPosition))continue;const e=Ik(l),t=Nk(e,a);(n&&t>0||t>=e.width*e.height||t>=Number(a.width)*Number(a.height))&&s.push(l)}return s},getIncomers:t=>function(...e){if(3===e.length){const[t,n,o]=e;return Lk(t,n,o,"source")}const[t,n]=e,o="string"==typeof t?t:t.id;return n.filter((e=>Ck(e)&&e.target===o)).map((e=>n.find((t=>_k(t)&&t.id===e.source))))}(t,e.nodes,e.edges),getOutgoers:t=>function(...e){if(3===e.length){const[t,n,o]=e;return Lk(t,n,o,"target")}const[t,n]=e,o="string"==typeof t?t:t.id;return n.filter((e=>Ck(e)&&e.source===o)).map((e=>n.find((t=>_k(t)&&t.id===e.target))))}(t,e.nodes,e.edges),getConnectedEdges:i,getHandleConnections:({id:t,type:n,nodeId:o})=>{var a;const i=t?`-${n}-${t}`:`-${n}`;return Array.from((null==(a=e.connectionLookup.get(`${o}${i}`))?void 0:a.values())??[])},isNodeIntersecting:(e,t,n=!0)=>{const[o]=h(e);if(!o)return!1;const a=Nk(o,t);return n&&a>0||a>=Number(o.width)*Number(o.height)},panBy:t=>{const{viewport:n,dimensions:o,d3Zoom:a,d3Selection:i,translateExtent:r}=e;if(!a||!i||!t.x&&!t.y)return!1;const s=ld.translate(n.x+t.x,n.y+t.y).scale(n.zoom),l=[[0,0],[o.width,o.height]],u=a.constrain()(s,l,r),c=e.viewport.x!==u.x||e.viewport.y!==u.y||e.viewport.zoom!==u.k;return a.transform(i,u),c},fitView:e=>o.value.fitView(e),zoomIn:e=>o.value.zoomIn(e),zoomOut:e=>o.value.zoomOut(e),zoomTo:(e,t)=>o.value.zoomTo(e,t),setViewport:(e,t)=>o.value.setViewport(e,t),setTransform:(e,t)=>o.value.setTransform(e,t),getViewport:()=>o.value.getViewport(),getTransform:()=>o.value.getTransform(),setCenter:(e,t,n)=>o.value.setCenter(e,t,n),fitBounds:(e,t)=>o.value.fitBounds(e,t),project:e=>o.value.project(e),screenToFlowCoordinate:e=>o.value.screenToFlowCoordinate(e),flowToScreenCoordinate:e=>o.value.flowToScreenCoordinate(e),toObject:()=>{const t=[],n=[];for(const o of e.nodes){const{computedPosition:e,handleBounds:n,selected:a,dimensions:i,isParent:r,resizing:s,dragging:l,events:u,...c}=o;t.push(c)}for(const o of e.edges){const{selected:e,sourceNode:t,targetNode:a,events:i,...r}=o;n.push(r)}return JSON.parse(JSON.stringify({nodes:t,edges:n,position:[e.viewport.x,e.viewport.y],zoom:e.viewport.zoom,viewport:e.viewport}))},fromObject:t=>new Promise((n=>{const{nodes:a,edges:i,position:r,zoom:s,viewport:l}=t;a&&p(a),i&&f(i);const[u,c]=(null==l?void 0:l.x)&&(null==l?void 0:l.y)?[l.x,l.y]:r??[null,null];if(u&&c){const t=(null==l?void 0:l.zoom)||s||e.viewport.zoom;return ov((()=>o.value.viewportInitialized)).toBe(!0).then((()=>{o.value.setViewport({x:u,y:c,zoom:t}).then((()=>{n(!0)}))}))}n(!0)})),updateNodeInternals:a,viewportHelper:o,$reset:()=>{const t=Hx();if(e.edges=[],e.nodes=[],e.d3Zoom&&e.d3Selection){const n=ld.translate(t.defaultViewport.x??0,t.defaultViewport.y??0).scale(Tk(t.defaultViewport.zoom??1,t.minZoom,t.maxZoom)),o=e.viewportRef.getBoundingClientRect(),a=[[0,0],[o.width,o.height]],i=e.d3Zoom.constrain()(n,a,t.translateExtent);e.d3Zoom.transform(e.d3Selection,i)}y(t)},$destroy:()=>{}}}function Yx({sourceX:e,sourceY:t,targetX:n,targetY:o}){const a=Math.abs(n-e)/2,i=n<e?n+a:n-a,r=Math.abs(o-t)/2;return[i,o<t?o+r:o-r,a,r]}function Xx({sourceX:e,sourceY:t,targetX:n,targetY:o,sourceControlX:a,sourceControlY:i,targetControlX:r,targetControlY:s}){const l=.125*e+.375*a+.375*r+.125*n,u=.125*t+.375*i+.375*s+.125*o;return[l,u,Math.abs(l-e),Math.abs(u-t)]}function qx(e,t){return e>=0?.5*e:25*t*Math.sqrt(-e)}function Jx({pos:e,x1:t,y1:n,x2:o,y2:a,c:i}){let r,s;switch(e){case ud.Left:r=t-qx(t-o,i),s=n;break;case ud.Right:r=t+qx(o-t,i),s=n;break;case ud.Top:r=t,s=n-qx(n-a,i);break;case ud.Bottom:r=t,s=n+qx(a-n,i)}return[r,s]}function Kx(e){const{sourceX:t,sourceY:n,sourcePosition:o=ud.Bottom,targetX:a,targetY:i,targetPosition:r=ud.Top,curvature:s=.25}=e,[l,u]=Jx({pos:o,x1:t,y1:n,x2:a,y2:i,c:s}),[c,d]=Jx({pos:r,x1:a,y1:i,x2:t,y2:n,c:s}),[p,f,m,h]=Xx({sourceX:t,sourceY:n,targetX:a,targetY:i,sourceControlX:l,sourceControlY:u,targetControlX:c,targetControlY:d});return[`M${t},${n} C${l},${u} ${c},${d} ${a},${i}`,p,f,m,h]}function Zx({pos:e,x1:t,y1:n,x2:o,y2:a}){let i,r;switch(e){case ud.Left:case ud.Right:i=.5*(t+o),r=n;break;case ud.Top:case ud.Bottom:i=t,r=.5*(n+a)}return[i,r]}function Qx(e){const{sourceX:t,sourceY:n,sourcePosition:o=ud.Bottom,targetX:a,targetY:i,targetPosition:r=ud.Top}=e,[s,l]=Zx({pos:o,x1:t,y1:n,x2:a,y2:i}),[u,c]=Zx({pos:r,x1:a,y1:i,x2:t,y2:n}),[d,p,f,m]=Xx({sourceX:t,sourceY:n,targetX:a,targetY:i,sourceControlX:s,sourceControlY:l,targetControlX:u,targetControlY:c});return[`M${t},${n} C${s},${l} ${u},${c} ${a},${i}`,d,p,f,m]}function eI(e,t){return Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2)}function tI({source:e,sourcePosition:t=ud.Bottom,target:n,targetPosition:o=ud.Top,center:a,offset:i}){const r=np[t],s=np[o],l={x:e.x+r.x*i,y:e.y+r.y*i},u={x:n.x+s.x*i,y:n.y+s.y*i},c=function({source:e,sourcePosition:t=ud.Bottom,target:n}){return t===ud.Left||t===ud.Right?e.x<n.x?{x:1,y:0}:{x:-1,y:0}:e.y<n.y?{x:0,y:1}:{x:0,y:-1}}({source:l,sourcePosition:t,target:u}),d=0!==c.x?"x":"y",p=c[d];let f,m,h;const y={x:0,y:0},v={x:0,y:0},[g,w,b,k]=Yx({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(r[d]*s[d]==-1){m=a.x??g,h=a.y??w;const e=[{x:m,y:l.y},{x:m,y:u.y}],t=[{x:l.x,y:h},{x:u.x,y:h}];f=r[d]===p?"x"===d?e:t:"x"===d?t:e}else{const a=[{x:l.x,y:u.y}],c=[{x:u.x,y:l.y}];if(f="x"===d?r.x===p?c:a:r.y===p?a:c,t===o){const t=Math.abs(e[d]-n[d]);if(t<=i){const o=Math.min(i-1,i-t);r[d]===p?y[d]=(l[d]>e[d]?-1:1)*o:v[d]=(u[d]>n[d]?-1:1)*o}}if(t!==o){const e="x"===d?"y":"x",t=r[d]===s[e],n=l[e]>u[e],o=l[e]<u[e];(1===r[d]&&(!t&&n||t&&o)||1!==r[d]&&(!t&&o||t&&n))&&(f="x"===d?a:c)}const g={x:l.x+y.x,y:l.y+y.y},w={x:u.x+v.x,y:u.y+v.y};Math.max(Math.abs(g.x-f[0].x),Math.abs(w.x-f[0].x))>=Math.max(Math.abs(g.y-f[0].y),Math.abs(w.y-f[0].y))?(m=(g.x+w.x)/2,h=f[0].y):(m=f[0].x,h=(g.y+w.y)/2)}return[[e,{x:l.x+y.x,y:l.y+y.y},...f,{x:u.x+v.x,y:u.y+v.y},n],m,h,b,k]}function nI(e){const{sourceX:t,sourceY:n,sourcePosition:o=ud.Bottom,targetX:a,targetY:i,targetPosition:r=ud.Top,borderRadius:s=5,centerX:l,centerY:u,offset:c=20}=e,[d,p,f,m,h]=tI({source:{x:t,y:n},sourcePosition:o,target:{x:a,y:i},targetPosition:r,center:{x:l,y:u},offset:c});return[d.reduce(((e,t,n)=>{let o;return o=n>0&&n<d.length-1?function(e,t,n,o){const a=Math.min(eI(e,t)/2,eI(t,n)/2,o),{x:i,y:r}=t;if(e.x===i&&i===n.x||e.y===r&&r===n.y)return`L${i} ${r}`;if(e.y===r)return`L ${i+a*(e.x<n.x?-1:1)},${r}Q ${i},${r} ${i},${r+a*(e.y<n.y?1:-1)}`;const s=e.x<n.x?1:-1;return`L ${i},${r+a*(e.y<n.y?-1:1)}Q ${i},${r} ${i+a*s},${r}`}(d[n-1],t,d[n+1],s):`${0===n?"M":"L"}${t.x} ${t.y}`,e+=o}),""),p,f,m,h]}function oI(e){const t=cp.getInstance(),n=y(),o="object"==typeof e,a=o?e:{id:e},i=a.id,r=i??(null==n?void 0:n.vueFlowId);let s;if(n){const e=E(Pd,null);null==e||r&&e.id!==r||(s=e)}if(s||r&&(s=t.get(r)),!s||r&&s.id!==r){const e=i??t.getId(),o=t.create(e,a);s=o,(n??O(!0)).run((()=>{Y(o.applyDefault,((e,t,n)=>{const a=e=>{o.applyNodeChanges(e)},i=e=>{o.applyEdgeChanges(e)};e?(o.onNodesChange(a),o.onEdgesChange(i)):(o.hooks.value.nodesChange.off(a),o.hooks.value.edgesChange.off(i)),n((()=>{o.hooks.value.nodesChange.off(a),o.hooks.value.edgesChange.off(i)}))}),{immediate:!0}),Jy((()=>{if(s){const e=t.get(s.id);e?e.$destroy():Ix(`No store instance found for id ${s.id} in storage.`)}}))}))}else o&&s.setState(a);if(n&&(pe(Pd,s),n.vueFlowId=s.id),o){const e=N();"VueFlow"!==(null==e?void 0:e.type.name)&&s.emits.error(new Sd(Id.USEVUEFLOW_OPTIONS))}return s}function aI(e,t,n){return n===ud.Left?e-t:n===ud.Right?e+t:e}function iI(e,t,n){return n===ud.Top?e-t:n===ud.Bottom?e+t:e}function rI(e){return[zp(e[0],16),zp(e[1],16)]}function sI({x:e,y:t,zoom:n},{width:o,height:a}){return{xMin:-e/n,yMin:-t/n,xMax:(o-e)/n,yMax:(a-t)/n}}function lI(e){return JSON.stringify([e.search||"",[...e.categories].sort()])}function uI(e,t){return e.hasOwnProperty(t)}function cI(e,t){const{extraProps:n,extraPropValues:o}=e,a=function(e){try{const t=Go(e.replace(/\\[^`]/g,"\\\\"));if(1===t.length)return{description:t[0].description}}catch(t){}return null}(t);if(a)for(const[i,r]of Object.entries(a))uI(n,i)&&(n[i].initialValue===r?delete o[i]:o[i]=r)}function dI(e){return e.startsWith(`={{ ${to} $fromAI(`)}function pI({router:e,workflowState:t,onSaved:n}){const o=dh(),a=Uu(),i=Gy(),r=Ie(),s=rh(),l=_u(),u=t??gI(),c=tf(),d=qy(),p=sy(),f=uy(),m=Xp(),h=vf(),{getWorkflowDataToSave:y,checkConflictingWebhooks:v,getWorkflowProjectRole:g}=EI(),w=af(),b=rf();function k(t){t(e.resolve({name:Tn.WORKFLOW,params:{name:s.workflow.id}}))}function x(e,t){const n=e[t];return Array.isArray(n)?n[0]??void 0:null!==n?n:void 0}async function I({id:t}={},a=!0,u=!1,c=!1){if(ru().preferences.branchReadOnly)return!1;const f=Au().isLoading,m=t??x(e.currentRoute.value.params,"name"),v=x(e.currentRoute.value.query,"parentFolderId"),b=x(e.currentRoute.value.query,"uiContext");if(w.pendingSave){if(c)return!0;u||await w.pendingSave}const k=(async()=>{const k=m?l.getWorkflowById(m):null;if(!m||!k?.id)return!!(await N({parentFolderId:v,uiContext:b,autosaved:c},a));try{if(!u&&f)return!0;o.addActiveAction("workflowSaving");const e=o.dirtyStateSetCount,t=await y();if(t.id!==m)throw new Error("Attempted to save a workflow different from the current workflow");t.versionId=s.workflowVersionId,t.aiBuilderAssisted=h.getAiBuilderMadeEdits();const a=Qh(Kh(m));t.expectedChecksum=a.checksum,t.autosaved=c;const i=await s.updateWorkflow(m,t,u);if(!i.checksum)throw new Error("Failed to update workflow");return s.setWorkflowVersionData({versionId:i.versionId,name:null,description:null}),a.setUpdatedAt(i.updatedAt),o.dirtyStateSetCount===e&&o.markStateClean(),o.removeActiveAction("workflowSaving"),Xy().run("workflow.afterUpdate",{workflowData:i}),h.resetAiBuilderMadeEdits(),w.resetRetry(),n?.(!1),!0}catch(x){if(console.error(x),o.removeActiveAction("workflowSaving"),409===x.errorCode){if(p.track("User attempted to save locked workflow",{workflowId:m,sharing_role:g(m)}),!w.conflictModalShown){c&&w.setConflictModalShown(!0);const n=e.resolve({name:Tn.WORKFLOW,params:{name:m}}).href;if("confirm"===await i.confirm(r.baseText("workflows.concurrentChanges.confirmMessage.message",{interpolate:{url:n}}),r.baseText("workflows.concurrentChanges.confirmMessage.title"),{confirmButtonText:r.baseText("workflows.concurrentChanges.confirmMessage.confirmButtonText"),cancelButtonText:r.baseText("workflows.concurrentChanges.confirmMessage.cancelButtonText")}))return await I({id:t},a,!0)}if(!c)return!1}if(c){w.incrementRetry(),w.setLastError(x.message);const e=w.getRetryDelay();return w.setRetrying(!0),setTimeout((()=>{w.setRetrying(!1),o.stateIsDirty&&T()}),e),d.showMessage({title:r.baseText("workflowHelpers.showMessage.title"),message:r.baseText("generic.autosave.retrying",{interpolate:{error:x.message,retryIn:`${Math.ceil(e/1e3)}s`}}),type:"error",duration:e}),!1}return d.showMessage({title:r.baseText("workflowHelpers.showMessage.title"),message:x.message,type:"error"}),!1}})();w.setPendingSave(k);try{return await k}finally{w.pendingSave===k&&w.setPendingSave(null)}}async function N({name:t,tags:a,resetWebhookUrls:i,resetNodeIds:h,openInNewWindow:g,parentFolderId:w,uiContext:b,requestNewId:k,data:x,autosaved:I}={},N=!0){try{o.addActiveAction("workflowSaving");const r=o.dirtyStateSetCount,S=x||await y(),T={};k&&delete S.id,h&&(S.nodes=S.nodes.map((e=>(f.assignNodeId(e),e)))),i&&(S.nodes=S.nodes.map((e=>{if(e.webhookId){const t=f.assignWebhookId(e);oa(e.parameters.path)||(e.parameters.path=t),T[e.name]=e.webhookId}return e}))),t&&(S.name=t.trim()),a&&(S.tags=a),w&&(S.parentFolderId=w),b&&(S.uiContext=b),I&&(S.autosaved=I);const E=await s.createNewWorkflow(S);if(l.addWorkflow(E),c.onNewWorkflowSave(E.id),g){const t=e.resolve({name:Tn.WORKFLOW,params:{name:E.id}});return window.open(t.href,"_blank"),o.removeActiveAction("workflowSaving"),n?.(!0),E.id}if(null!==E.activeVersionId){const e=await v(E.id);e&&(E.active=!1,E.activeVersionId=null,d.showMessage({title:"Conflicting Webhook Path",message:`Workflow set to inactive: Live webhook in another workflow uses same path as node '${e.trigger.name}'.`,type:"error"}))}const A=Qh(Kh(E.id));A.setActiveState({activeVersionId:E.activeVersionId,activeVersion:E.activeVersion??null}),E.checksum&&A.setChecksum(E.checksum),u.setWorkflowId(E.id),s.setWorkflowVersionData({versionId:E.versionId,name:null,description:null}),A.setUpdatedAt(E.updatedAt),i&&Object.keys(T).forEach((e=>{const t={key:"webhookId",value:T[e],name:e};A.setNodeValue(t)}));const C=e.currentRoute.value,_=C.query.templateId;return _&&p.track("User saved new workflow from template",{template_id:Vs(String(_)),workflow_id:E.id,wf_template_repo_session_id:m.previousSessionId}),N&&await e.replace({name:C.name,params:{...C.params},query:{...C.query,new:void 0}}),o.removeActiveAction("workflowSaving"),o.dirtyStateSetCount===r&&o.markStateClean(),Xy().run("workflow.afterUpdate",{workflowData:E}),n?.(!0),E.id}catch(S){return o.removeActiveAction("workflowSaving"),d.showMessage({title:r.baseText("workflowHelpers.showMessage.title"),message:S.message,type:"error"}),null}}const S=be((()=>{w.autoSaveState!==ka.Idle&&(w.pendingSave||(w.setAutoSaveState(ka.InProgress),(async()=>{try{await I({},!0,!1,!0)}finally{w.autoSaveState===ka.InProgress&&w.setAutoSaveState(ka.Idle),o.stateIsDirty&&!w.isRetrying&&(w.setAutoSaveState(ka.Scheduled),S())}})()))}),ho(ko.API.AUTOSAVE),{maxWait:ho(ko.API.AUTOSAVE_MAX_WAIT)}),T=()=>{w.pendingSave||w.isRetrying||b.isOnline&&(w.setAutoSaveState(ka.Scheduled),S())};return Y((()=>b.isOnline),((e,t)=>{e&&!t&&o.stateIsDirty&&T()})),{promptSaveUnsavedWorkflowChanges:async function(e,{confirm:t=(async()=>!0),cancel:n=(async()=>{})}={}){const l=s.workflowId?Qh(Kh(s.workflowId)):void 0;if(o.stateIsDirty&&!l?.isArchived&&At(l?.scopes??[]).workflow.update)switch(await i.confirm(r.baseText("generic.unsavedWork.confirmMessage.message"),{title:r.baseText("generic.unsavedWork.confirmMessage.headline"),type:"warning",confirmButtonText:r.baseText("generic.unsavedWork.confirmMessage.confirmButtonText"),cancelButtonText:r.baseText("generic.unsavedWork.confirmMessage.cancelButtonText"),showClose:!0})){case $a:return void(await I({},!1)?(await a.showNpsSurveyIfPossible(),o.markStateClean(),e(await t())):k(e));case oo:return await n(),o.markStateClean(),void e();case Ca:return void(s.isWorkflowSaved[s.workflowId]&&k(e))}else e()},saveCurrentWorkflow:I,saveAsNewWorkflow:N,autoSaveWorkflow:T,cancelAutoSave:()=>{var e;"function"==typeof(e=S)&&"cancel"in e&&"function"==typeof e.cancel&&S.cancel(),w.setAutoSaveState(ka.Idle)}}}function fI(e){const{releaseChannel:t}=qi().settings;return function(e={}){const{releaseChannel:t,windowRef:n}=e,o=t&&"stable"!==t?`${sf}[${t.toUpperCase()}]`:sf,a=v(void 0),i=e=>{const t=[e||lf,o];(n?.value?.document??document).title=t.join(" - ")};return{set:i,reset:()=>{a.value=void 0,i("")},setDocumentTitle:(e,t)=>{a.value=t;let n="⚠️";"EXECUTING"===t?n="🔄":"IDLE"===t?n="▶️":"AI_BUILDING"===t?n="[Building]":"AI_DONE"===t&&(n="[Done]"),i(`${n} ${e}`)},getDocumentState:()=>a.value}}({releaseChannel:t,windowRef:e})}function mI(e={}){const{cooldownMs:t=Bo,maxDismissals:n=uf}=e,o=Ae(Jt,{lastDismissedAt:null,dismissCount:0},{writeDefaults:!1}),a=C((()=>"undefined"!=typeof Notification)),i=C((()=>"granted"===cf.value)),r=C((()=>"denied"===cf.value)),s=C((()=>!!o.value.lastDismissedAt&&Date.now()-o.value.lastDismissedAt<t)),l=C((()=>o.value.dismissCount>=n)),u=C((()=>a.value&&"default"===cf.value&&!s.value&&!l.value));function c(){"undefined"!=typeof Notification&&(cf.value=Notification.permission)}return{permissionState:cf,isSupported:a,isEnabled:i,isDenied:r,isInCooldown:s,canPrompt:u,requestPermission:async function(){if(c(),"granted"===cf.value)return{permission:"granted",wasRequested:!1};if("denied"===cf.value)return{permission:"denied",wasRequested:!1};if(s.value||l.value)return{permission:cf.value,wasRequested:!1};try{const e=await Notification.requestPermission();return cf.value=e,{permission:e,wasRequested:!0}}catch{return c(),{permission:cf.value,wasRequested:!0}}},recordDismissal:function(){o.value={lastDismissedAt:Date.now(),dismissCount:o.value.dismissCount+1}},resetMetadata:function(){o.value={lastDismissedAt:null,dismissCount:0}},refreshPermissionState:c,showNotification:function(e,t){return i.value&&a.value?new Notification(e,t):null},metadata:C((()=>o.value))}}function hI(e){const t=ni(),n=Nu(),o=Ie(),a=v({});function i(e,t,o){n.activeNodeName===t?Object.keys(o).forEach((e=>{const n={node:t,name:`parameters.${e}`,value:o[e]};pf.emit("updateParameterValue",n)})):Qh(Kh(e)).setNodeParameters({name:t,value:o},!0)}function r(e){e!==n.activeNodeName&&qy().showMessage({type:"success",title:o.baseText("aiAssistant.codeUpdated.message.title"),message:w(hf,{nodeName:e}),duration:4e3})}return{suggestions:a,applyCodeDiff:async function(n,o){const s=e.chatMessages.value[o];if(!s||"code-diff"!==s.type)throw new Error("No code diff to apply");const l=s;try{const o=e.getTargetNodeName(l),s=e.getSessionId(l);Qa(o,"No target node for code diff"),l.replacing=!0;const d=l.suggestionId,p=Qh(Kh(n)).getNodeByName(o);Qa(p);const f=a.value[d];if(f)i(n,p.name,f.suggested);else{const{parameters:e}=await async function(e,t){return await Ja(e,"POST","/ai/chat/apply-suggestion",t)}(t.restApiContext,{suggestionId:l.suggestionId,sessionId:s});a.value[d]={previous:(u=p.parameters,c=Object.keys(e),c.reduce(((e,t)=>(e[t]=zt(u[t]),e)),{})),suggested:e},i(n,p.name,e)}l.replaced=!0,df.emit("codeDiffApplied"),r(p.name)}catch(d){console.error(d),l.error=!0}var u,c;l.replacing=!1},undoCodeDiff:async function(t,n){const o=e.chatMessages.value[n];if(!o||"code-diff"!==o.type)throw new Error("No code diff to apply");const s=o;try{const n=e.getTargetNodeName(s);Qa(n,"No target node for code diff"),s.replacing=!0;const o=s.suggestionId,l=a.value[o];Qa(l);const u=Qh(Kh(t)).getNodeByName(n);Qa(u);const c=l.previous;i(t,u.name,c),s.replaced=!1,df.emit("codeDiffApplied"),r(u.name)}catch(l){console.error(l),s.error=!0}s.replacing=!1}}}function yI(){const e=v([]),t=v(null);return{executingNode:e,lastAddedExecutingNode:t,addExecutingNode:function(n){e.value.push(n),t.value=n},removeExecutingNode:function(t){const n=e.value.indexOf(t);-1!==n&&e.value.splice(n,1)},isNodeExecuting:function(t){return e.value.includes(t)},clearNodeExecutionQueue:function(){e.value=[],t.value=null}}}function vI(){const e=rh(),t=gf(),n=dh(),o=ni(),a=Jm();function i(t){t?.setStateDirty&&n.markStateDirty(),e.workflow.connections={},e.workflowObject.setConnections({})}function r(t){t.setStateDirty&&n.markStateDirty(),t.removePinData&&e.workflow.id&&Qh(Kh(e.workflow.id)).setPinData({}),e.workflow.nodes.splice(0,e.workflow.nodes.length),e.workflowObject.setNodes(e.workflow.nodes),e.nodeMetadata={}}function s(t){t?.data?.waitTill&&delete t.data.resultData.runData[t.data.resultData.lastNodeExecuted],e.workflowExecutionData=t,e.workflowExecutionPairedItemMappings=fy(t),e.workflowExecutionResultDataLastUpdate=Date.now(),e.workflowExecutionStartedData=void 0}function l(){return e.workflow.nodes.forEach((e=>{e.issues=void 0})),!0}function u(t){e.workflow.id=t||"",e.workflowObject.id=e.workflow.id}function c(t){e.private.setActiveExecutionId(t)}const d=fI();function p(t,n){if(-1!==t){const o=e.workflow.nodes[t],a=!(0,ul.default)((0,ll.default)(o,Object.keys(n)),n);return a&&(Object.assign(o,n),e.workflow.nodes[t]=o,e.workflowObject.setNodes(e.workflow.nodes)),a}return!1}function f(t,o){const a=e.workflow.nodes.findIndex((e=>e.name===t.name));if(-1===a)throw new Error(`Node with the name "${t.name}" could not be found to set parameter.`);const{name:i,parameters:r}=e.workflow.nodes[a];p(a,{parameters:o&&_h(t.value)?{...r,...t.value}:t.value})&&(n.markStateDirty(),e.nodeMetadata[i].parametersLastUpdatedAt=Date.now())}function m(t){const o=e.workflow.nodes.findIndex((e=>e.name===t.name));if(-1===o||!t.key)throw new Error(`Node with the name "${t.name}" could not be found to set parameter.`);const a=p(o,{[t.key]:t.value});a&&n.markStateDirty(),a&&!["position","notes","notesInFlow"].includes(t.key)&&(e.nodeMetadata[e.workflow.nodes[o].name].parametersLastUpdatedAt=Date.now())}return{resetState:function(){i({setStateDirty:!1}),r({setStateDirty:!1,removePinData:!0}),s(null),l(),e.workflow.id&&Qh(Kh(e.workflow.id)).setName(""),u(""),e.workflowObject.setSettings({...nl}),c(void 0),t.executingNode.executingNode.length=0,e.executionWaitingForWebhook=!1,vf().resetManualExecutionStats()},removeAllConnections:i,removeAllNodes:r,setWorkflowExecutionData:s,resetAllNodesIssues:l,setWorkflowId:u,setWorkflowProperty:function(t,n){e.workflow[t]=n},setActiveExecutionId:c,getNewWorkflowData:async function(e,t,n){let a={name:"",settings:{...nl}};try{const i={name:e,projectId:t,parentFolderId:n};a=await Sh(o.restApiContext,Bs(i)?void 0:i)}catch(i){a.name=e||"My workflow"}return a},markExecutionAsStopped:function(n){c(void 0),t.executingNode.clearNodeExecutionQueue(),e.executionWaitingForWebhook=!1;const o=e.workflow.id?Qh(Kh(e.workflow.id)):void 0;if(d.setDocumentTitle(o?.name??"","IDLE"),e.workflowExecutionStartedData=void 0,Qm(),!e.workflowExecutionData)return;const a=e.workflowExecutionData.data?.resultData.runData??{};for(const e in a)a[e]=a[e].filter((({executionStatus:e})=>"success"===e));n&&(e.workflowExecutionData.status=n.status,e.workflowExecutionData.startedAt=n.startedAt,e.workflowExecutionData.stoppedAt=n.stoppedAt)},setNodeParameters:f,setLastNodeParameters:function(t){const n=(0,cl.default)(e.workflow.nodes,(e=>e.type===t.key)),o=a.getNodeType(n.type);if(!o)return;const i=$o(o.properties,t.value,!0,!1,n,o);n&&f({value:i,name:n.name},!0)},setNodeValue:m,setNodePositionById:function(t,n){const o=e.workflow.nodes.find((e=>e.id===t));o&&m({name:o.name,key:"position",value:n})},setNodeIssue:function(t){const n=e.workflow.nodes.findIndex((e=>e.name===t.node));if(-1===n)return;const o=e.workflow.nodes[n];if(null===t.value){if(void 0===o.issues?.[t.type])return;const{[t.type]:e,...a}=o.issues;p(n,{issues:a})}else p(n,{issues:{...o.issues,[t.type]:t.value}})},updateNodeAtIndex:p,updateNodeById:function(t,n){const o=e.workflow.nodes.findIndex((e=>e.id===t));return-1!==o&&p(o,n)},updateNodeProperties:function(t){const o=e.workflow.nodes.findIndex((e=>e.name===t.name));if(-1!==o)for(const e of Object.keys(t.properties)){const a=e;p(o,{[e]:t.properties[a]})&&n.markStateDirty()}wf.emit("updateNodeProperties",[this,t])},resetParametersLastUpdatedAt:function(t){e.nodeMetadata[t]||(e.nodeMetadata[t]={pristine:!0}),e.nodeMetadata[t].parametersLastUpdatedAt=Date.now()},executingNode:t.executingNode}}function gI(){return E(On,(()=>vI()),!0)}async function wI(e,t={}){if("localResolve"in t&&t.localResolve)return await bI(e,t.workflow,t.connections,t.envVars,t.workflow.getNode(t.nodeName),t.execution,t.workflow.pinData,{inputNodeName:t.inputNode?.name,inputRunIndex:t.inputNode?.runIndex,inputBranchIndex:t.inputNode?.branchIndex,additionalKeys:t.additionalKeys});const n=rh(),o=n.workflowId?Qh(Kh(n.workflowId)):void 0;return await bI(e,n.workflowObject,o?.connectionsBySourceNode??{},Cu().variablesAsObject,Nu().activeNode,n.workflowExecutionData,o?.getPinDataSnapshot(),t)}function bI(e,t,n,o,a,i,r,s={}){let l=s?.targetItem?.itemIndex||0;const u=a??t.getNode(s.contextNodeName||""),c={$execution:{id:Fo,mode:"test",resumeUrl:Fo,resumeFormUrl:Fo},$vars:o,$tool:ca(u?.type)?{name:Fo,parameters:Fo}:void 0,$executionId:Fo,$resumeWebhookUrl:Fo,...s.additionalKeys};if(s.isForCredential)return t.expression.getParameterValue(e,null,0,l,"",[],"manual",c,void 0,!1,void 0,"");const d=xo.Main;let p=u;u&&(p=t.getParentMainInputNode(u)??null);const f=i?.data?.resultData.runData??null;let m=t.getParentNodes(p.name,d,1),h=s?.inputRunIndex??0;const y=t.getNodeConnectionIndexes(p.name,m[0]);if(s.targetItem&&s?.targetItem?.nodeName===p.name&&i){const e=function(e,t){if(!e?.data?.resultData?.runData)return[];const n=e.data.resultData.runData[t.nodeName]?.[t.runIndex],o=n?.source||[];if(0===o.length)return[];const a=n?.data?.main?.[t.outputIndex]?.[t.itemIndex];return void 0===a?.pairedItem?[]:(Array.isArray(a.pairedItem)?a.pairedItem:"object"==typeof a.pairedItem?[a.pairedItem]:[{item:a.pairedItem}]).map((e=>{const t=e.input||0;return{nodeName:o?.[t]?.previousNode,runIndex:o?.[t]?.previousNodeRun||0,itemIndex:e.item,outputIndex:o[t]?.previousNodeOutput||0}})).filter((e=>null!==e))}(i,s.targetItem);if(!e.length)return null;m=[e[0].nodeName],h=e[0].runIndex,l=e[0].itemIndex,y&&(y.sourceIndex=e[0].outputIndex)}else if(m=s.inputNodeName?[s.inputNodeName]:m,y&&(y.sourceIndex=s.inputBranchIndex??y.sourceIndex),void 0===s?.inputRunIndex&&null!==f&&m.length){const e=m.find((e=>f[e]));e&&(h=f[e].length-1)}let v=NI(n,m,p.name,d,h,r,i?.data?.resultData.runData??null,y);null===v&&p&&u?.name!==p.name&&(v=(0,Qp.default)(TI(n,[p.name],p.name,d,0,r,i?.data?.resultData.runData??null),["data",d,0],null));const g=i?.data??Yt();if(null===v&&(v=[]),"n8n-nodes-base.httpRequest"===u?.type){const e={statusCode:200,headers:{},body:{}},t={headers:{},body:{},qs:{}};c.$pageCount=0,c.$response=(0,Qp.default)(i,["data","executionData","contextData",`node:${u.name}`,"response"],e),c.$request=t}let w=s?.targetItem?.runIndex??0;void 0===s?.targetItem&&null!==f&&f[p.name]&&(w=f[p.name].length-1);let b=TI(n,m,p.name,d,w,r,i?.data?.resultData.runData??null,h);return b.source||(b=TI(n,m,p.name,d,h,r,i?.data?.resultData.runData??null)),t.expression.getParameterValue(e,g,w,l,u.name,v,"manual",c,b,!1,{},p.name)}async function kI(e,t,n={}){const o=new Set(e?.typeOptions?.loadOptionsDependsOn??[]),a=Object.entries(t),i=await Promise.all(a.map((async([e,t])=>{if(o.has(e))return[e,await wI(t,n)];try{return[e,await wI(t,n)]}catch(a){return[e,null]}})));return Object.fromEntries(i)}function xI(e,t,n){let o;if("downstream"===e)o=t.getChildNodes(n);else{if("upstream"!==e)throw new Error(`The direction "${e}" is not supported!`);o=t.getParentNodes(n)}let a=[];return o.forEach((e=>{a=[...a,e,...t.getParentNodes(e,"ALL_NON_MAIN")]})),[...new Set(a)]}function II(){return rh().getNodeTypes()}function NI(e,t,n,o,a,i,r,s={sourceIndex:0,destinationIndex:0}){let l=null;const u=TI(e,t,n,o,a,i,r);return t.length&&(!Object.keys(u.data).length||u.data[o].length<=s.sourceIndex?l=[]:(l=u.data[o][s.sourceIndex],null!==l&&(l=l.map(((e,t)=>({...e,pairedItem:{item:t,input:s.destinationIndex}})))))),l}function SI(e,t,n,o,a,i){const r=rh();return TI(e,t,n,o,a,(r.workflowId?Qh(Kh(r.workflowId)):void 0)?.getPinDataSnapshot(),r.getWorkflowRunData,i)}function TI(e,t,n,o,a,i,r,s){const l=Hn(e),u={node:{},data:{},source:null};s=s??a;for(const c of t){const e=i?.[c];if(e)return u.data={main:[e]},u.source={main:[{previousNode:c}]},u;if(null===r)return u;if(r[c]&&!(r[c].length<=s)&&r[c][s]&&r[c][s].hasOwnProperty("data")&&r[c][s].data?.hasOwnProperty(o)){if(u.data=r[c][s].data,r[n]&&r[n][a])u.source={[o]:r[n][a].source};else{let e;if(l[n]?.main)e:for(const t of l[n].main)for(const n of t??[])if(n.type===xo.Main&&n.node===c){e=n.index;break e}u.source={[o]:[{previousNode:c,previousNodeOutput:e,previousNodeRun:s}]}}return u}u.data={}}return u}function EI(){const e=Jm(),t=ni(),n=rh(),o=_u(),a=gI(),i=Lu(),r=dh(),s=uy(),l=su(),u=Mu(),c=Ie(),d=C((()=>n.workflowId?Qh(Kh(n.workflowId)):void 0));async function p(){const e=Qh(Kh(n.workflowId)),t=e.allNodes,o=e.connectionsBySourceNode;let a;const i=[];for(let n=0;n<t.length;n++)a=f(t[n]),i.push(a);const r=zt(o),s={name:e.name,nodes:i,pinData:e.getPinDataSnapshot(),connections:r,active:e.active,settings:e.settings,tags:[...e.tags],versionId:n.workflow.versionId,meta:e.meta},l=n.workflowId;return l&&(s.id=l),s}function f(t){const n=["color","continueOnFail","credentials","disabled","issues","onError","notes","parameters","status"],o={parameters:{}};for(const e in t)"_"!==e.charAt(0)&&-1===n.indexOf(e)&&(o[e]=t[e]);const a=e.getNodeType(t.type,t.typeVersion);if(null!==a){const e=my(a.name);e&&(o.type=qo,o.extendsCredential=hy(a.name));const n=$o(a.properties,t.parameters,e,!1,t,a);if(o.parameters=null!==n?n:{},void 0!==t.credentials&&void 0!==a.credentials){const e={};for(const n of Object.keys(t.credentials)){if(s.hasProxyAuth(t)||Object.keys(t.parameters).includes("genericAuthType")){e[n]=t.credentials[n];continue}const o=a.credentials.filter((e=>s.displayParameter(t.parameters,e,"",t))).find((e=>e.name===n));void 0!==o&&s.displayParameter(t.parameters,o,"",t)&&(e[n]=t.credentials[n])}0!==Object.keys(e).length&&(o.credentials=e)}}else o.credentials=t.credentials,o.parameters=t.parameters,void 0!==o.color&&(o.color=t.color);return!0===t.disabled&&(o.disabled=!0),!0===t.continueOnFail&&(o.continueOnFail=!0),"stopWorkflow"!==t.onError&&(o.onError=t.onError),[void 0,""].includes(t.notes)||(o.notes=t.notes),o}async function m(e,t,n=!0,o){if(void 0===e[t])return"empty";try{return await h(e[t],void 0,{contextNodeName:o},n)}catch(a){return c.baseText("nodeWebhooks.invalidExpression")}}async function h(e,t={},o={},a=!0){const i=await wI({__xxxxxxx__:e,...t},o);if(!i)return null;const r=i.__xxxxxxx__;if("object"==typeof r&&a){const e=r;return e?.isProxy&&e.toJSON?JSON.stringify(e.toJSON()):n.workflowObject.expression.convertObjectValueToString(r)}return r}function y(e){return"n8n-nodes-base.webhook"===e.type?!0===e.parameters.multipleMethods?e.parameters.httpMethod??["GET","POST"]:[e.parameters.httpMethod??"GET"]:["POST"]}function v(e){return"n8n-nodes-base.webhook"===e.type?e.parameters.path||e.webhookId:"n8n-nodes-base.formTrigger"===e.type?(e.parameters.options||{}).path??e.webhookId:"@n8n/n8n-nodes-langchain.chatTrigger"===e.type?`${e.webhookId}/chat`:`${e.webhookId}/webhook`}return{resolveParameter:wI,resolveRequiredParameters:kI,getConnectedNodes:xI,getNodeTypes:II,connectionInputData:NI,executeData:SI,getNodeTypesMaxCount:function(){const t=d.value?.allNodes??[],n={},o=e.allNodeTypes;for(const e of o)void 0!==e.maxNodes&&(n[e.name]={exist:0,max:e.maxNodes,nodeNames:[]});for(const e of t)void 0!==n[e.type]&&(n[e.type].exist+=1,n[e.type].nodeNames.push(e.name));return n},getNodeTypeCount:function(e){const t=d.value?.allNodes??[];let n=0;for(const o of t)o.type===e&&n++;return n},getWorkflowDataToSave:p,getNodeDataToSave:f,getWebhookExpressionValue:m,getWebhookUrl:async function(e,o,a){const{nodeType:i,restartWebhook:r}=e;if(!0===r)return"form"===i?"$execution.resumeFormUrl":"$execution.resumeUrl";const s={test:{form:t.formTestUrl,mcp:t.mcpTestUrl,webhook:t.webhookTestUrl},production:{form:t.formUrl,mcp:t.mcpUrl,webhook:t.webhookUrl}}[a][i??"webhook"],l=n.workflowId,u=await m(e,"path",!0,o.name)??"",c=await m(e,"isFullPath",!0,o.name)||!1;return ia(s,l,o,u,c)},resolveExpression:h,updateWorkflow:async function({workflowId:e,active:t},a=!1){let i={};const s=e===n.workflowId;if(s)i=a?{versionId:n.workflowVersionId}:await p();else{const{versionId:t}=await o.fetchWorkflow(e);i.versionId=t}void 0!==t&&(i.active=t);const l=await n.updateWorkflow(e,i);if(!l.checksum)throw new Error("Failed to update workflow");s&&r.markStateClean();const u=Qh(Kh(e));l.activeVersion?(n.setWorkflowActive(e,l.activeVersion,s),u.setActiveState({activeVersionId:l.activeVersion.versionId,activeVersion:l.activeVersion})):(n.setWorkflowInactive(e),u.setActiveState({activeVersionId:null,activeVersion:null}))},updateNodePositions:function(e,t){if(void 0===e.nodes)return;const n=[99999999,99999999];for(const a of e.nodes)(a.position[1]<n[1]||a.position[1]===n[1]&&a.position[0]<n[0])&&(n[0]=a.position[0],n[1]=a.position[1]);const o=[t[0]-n[0],t[1]-n[1]];for(const a of e.nodes)a.position[0]+=o[0],a.position[1]+=o[1]},removeForeignCredentialsFromWorkflow:function(e,t){(e.nodes??[]).forEach((e=>{e.credentials&&(e.credentials=Object.entries(e.credentials).reduce(((n,[o,a])=>{const i=t.some((e=>`${e.id}`==`${a.id}`));return a.id&&i&&(n[o]=e.credentials[o]),n}),{}))}))},getWorkflowProjectRole:function(e){const t=o.getWorkflowById(e);return t?.homeProject?.id!==l.personalProject?.id&&t?.id?t?.sharedWithProjects?.some((e=>e.id===l.personalProject?.id))?"sharee":"member":"owner"},initState:async function(e,r){const s=r??a;if(o.addWorkflow(e),n.setDescription(e.description),s.setWorkflowId(e.id),n.setWorkflowVersionData({versionId:e.versionId,name:null,description:null}),"activeVersion"in e&&n.setWorkflowActiveVersion(e.activeVersion??null),e.versionId)try{const o=await Gi(t.restApiContext,e.id,e.versionId);n.setWorkflowVersionData({versionId:o.versionId,name:o.name,description:o.description})}catch{}e.sharedWithProjects&&i.setWorkflowSharedWith({workflowId:e.id,sharedWithProjects:e.sharedWithProjects});const l=e.tags??[],c=function(e){return e&&Array.isArray(e)?0===e.length?e:"object"==typeof e[0]&&"id"in e[0]?e.map((e=>e.id)):e:[]}(l),d=Qh(Kh(e.id));return d.onSettingsChange((({payload:e})=>{n.workflowObject.setSettings(e.settings)})),d.onNameChange((({payload:t})=>{n.workflowObject.name=t.name,o.updateWorkflowInCache(e.id,{name:t.name})})),d.setName(e.name),d.setTags(c),d.setActiveState({activeVersionId:e.activeVersionId,activeVersion:e.activeVersion??null}),d.setSettings(e.settings??{}),d.setPinData(e.pinData??{}),d.setCreatedAt(e.createdAt),d.setUpdatedAt(e.updatedAt),d.setHomeProject(e.homeProject??null),e.checksum&&d.setChecksum(e.checksum),d.setIsArchived(e.isArchived),d.setUsedCredentials(e.usedCredentials??[]),d.setMeta(e.meta),d.setParentFolder(e.parentFolder??null),d.setScopes(e.scopes??[]),u.upsertTags(l),{workflowDocumentStore:d}},getNodeParametersWithResolvedExpressions:async function(e){return await async function e(t,n){const o={};for(const i in t){const r=t[i],s=n?`${n}.${i}`:i;if("object"==typeof r&&null!==r)o[i]=await e(r,s);else if("string"==typeof r&&String(r).startsWith("=")){let e;try{e=await h(r,void 0,{isForCredential:!1})}catch(a){e=`Error in expression: "${a.message}"`}o[i]={value:r,resolvedExpressionValue:String(e)}}else o[i]=r}return o}(e,"")},containsNodeFromPackage:(e,t)=>e.nodes.some((e=>e.type.startsWith(t))),checkConflictingWebhooks:async function(e){let n;n=r.stateIsDirty?await p():await o.fetchWorkflow(e);const a=n.nodes.filter((e=>!0!==e.disabled&&e.webhookId&&(e.type.toLowerCase().includes("trigger")||"n8n-nodes-base.webhook"===e.type)));for(const o of a){const n=y(o),a=v(o);for(const i of n){const n=await Fi(t.restApiContext,{path:a,method:i});if(n&&n.workflowId!==e)return{trigger:o,conflict:n}}}return null}}}function AI(e,t){return t.reduce(((e,t)=>"number"==typeof t?`${e}[${t}]`:function(e){return _f.test(e.toString())}(t)?`${e}.${t}`:`${e}['${CI(t)}']`),e)}function CI(e){return e.replace(/\'/g,"\\'")}function _I({nodeName:e,distanceFromActive:t,binaryMode:n}){const o="combined"===n?["item"]:["item","json"];return 1===t?"combined"===n?"$item":"$json":AI(`$('${CI(e)}')`,o)}function PI(e,t=!1){const n=e.replace(/^{{\s*|\s*}}$/g,"").replace(/^(\$\(.*\)\.item\.json|\$json|\$node\[.*\]\.json)\.?(.*)/,"$2");return!n.startsWith("[")||n.slice(1).includes("[")||t?n:Pf(n.slice(1,-1))}function DI(){function e(t,n="",o=!1,a=!1){let i={type:"undefined",value:"undefined",path:n};switch(typeof t){case"object":if(null===t)i={type:"null",value:"[null]",path:n};else if(t instanceof Date)i={type:"string",value:t.toISOString(),path:n};else if(Array.isArray(t))i={type:"array",value:a&&t.length>0?[{key:"0",...e(t.every((e=>xu(e)))?(0,Df.default)({},...t):t[0],`${n}[0]`,o,a)}]:t.map(((t,i)=>({key:i.toString(),...e(t,`${n}[${i}]`,o,a)}))),path:n};else if(xu(t)){const r=Ke(t)?"binary":"object";i={type:r,value:Object.entries(t).map((([t,i])=>({key:t,...e(i,AI(n,[t]),o,a)}))),path:n},"binary"===r&&(i.binaryData=t)}break;case"function":i={type:"function",value:"",path:n};break;default:i={type:typeof t,value:o?"":String(t),path:n}}return i}function t(e){switch(e){case void 0:return"undefined";case"integer":return"number";default:return e}}function n(e,t=0,n=0){const{getWorkflowExecution:o}=rh();if(null===e)return[];if(null===o)return[];const a=o.data;if(!a?.resultData)return[];const i=a.resultData.runData?.[e.name]?.[t];return void 0===i?.data?[]:function(e,t){return!e?.hasOwnProperty(xo.Main)||void 0===e.main||t<0||t>=e.main.length||null===e.main[t]?[]:e.main[t]}(i.data,n)}function o(e,t){const n=t.toLocaleLowerCase();return!!e.key?.toLocaleLowerCase().includes(n)||"string"==typeof e.value&&e.value.toLocaleLowerCase().includes(n)}return{getSchema:e,getSchemaForExecutionData:function(t,n=!1,o=!1){const[a,...i]=t;return e((0,Df.default)({},a,...i,a),void 0,n,o)},getSchemaForJsonSchema:function e(n,o=""){if("object"!=typeof n)return{type:"null",path:o,value:"null"};if("array"===n.type)return{type:"array",value:_h(n.items)?[{...e(n.items,`${o}[0]`),key:"0"}]:[],path:o};if("object"===n.type){const t=n.properties??{};return{type:"object",value:Object.entries(t).map((([t,n])=>({...e(n,o?`${o}.${t}`:`.${t}`),key:t}))),path:o}}return{type:t(Array.isArray(n.type)?n.type[0]:n.type),value:"",path:o}},getNodeInputData:n,getInputDataWithPinned:function(e,t=0,o=0){if(!e)return[];const a=rh(),i=(a.workflowId?Qh(Kh(a.workflowId)):void 0)?.getNodePinData(e.name)?.map((e=>e.json));let r=n(e,t,o);return i&&(r=Array.isArray(i)?i.map((e=>({json:e}))):[{json:i}]),r},filterSchema:function e(t,n){if(!n.trim())return t;if(Array.isArray(t.value)){const a=t.value.map((t=>e(t,n))).filter(Mh);return 0===a.length?o(t,n)?t:null:{...t,value:a}}return o(t,n)?t:null}}}function OI(e){return e.reduce(((e,t)=>{const n=function(e){return Array.isArray(e.version)?e.version:[e.version]}(t);if(0===n.length){const n={1:t};return e[t.name]=n,e}for(const o of n)e[t.name]?e[t.name][o]=Object.assign(e[t.name][o]??{},t):e[t.name]=Object.assign(e[t.name]??{},{[o]:t});return e}),{})}function MI(e,t,n,o,a,i,r,s,l,u){let c=0;if(++l>=u)return{matched:!1,outScore:c};if(n===e.length||o===t.length)return{matched:!1,outScore:c};let d=!1,p=[],f=0,m=!0;for(;n<e.length&&o<t.length;){if(e[n].toLowerCase()===t[o].toLowerCase()){if(s>=r)return{matched:!1,outScore:c};m&&a&&(i=[...a],m=!1);const h=[],y=MI(e,t,n,o+1,i,h,r,s,l,u),v=y.outScore;y.matched&&((!d||v>f)&&(p=[...h],f=v),d=!0),i[s++]=o,++n}++o}const h=n===e.length;if(h){if(c=100,!t.toLowerCase().startsWith("n8n")){let e=rm*i[0];e=e<sm?sm:e,c+=e}const e=t.length-s;c+=lm*e;for(let n=0;n<s;n++){const e=i[n];if(n>0&&e===i[n-1]+1&&(c+=nm),e>0){const n=t[e-1],o=t[e];n!==n.toUpperCase()&&o!==o.toLowerCase()&&(c+=am),"_"!==n&&" "!==n||(c+=om)}else c+=im}return d&&(!h||f>c)?(i=[...p],c=f,{matched:!0,outScore:c}):h?{matched:!0,outScore:c}:{matched:!1,outScore:c}}return{matched:!1,outScore:c}}function LI(e,t){return MI(e,t,0,0,null,[],256,0,0,5)}function jI(e,t,n=um){const o=t.reduce(((t,o)=>{let a=[];n.forEach((({key:e,weight:t})=>{const n=function(e,t){if(e.hasOwnProperty(t))return e[t];const n=t.split(".");let o=e,a=0;for(;o&&a<n.length;)o=o[n[a]],a++;return o}(o,e);Array.isArray(n)?a=a.concat(n.map((e=>({value:e,weight:t})))):"string"==typeof n&&a.push({value:n,weight:t})}));const i=a.reduce(((t,{value:n,weight:o})=>{if(!function(e,t){let n=0,o=0;for(;n<e.length&&o<t.length;)e.charAt(n).toLowerCase()===t.charAt(o).toLowerCase()&&n++,++o;return 0!==e.length&&0!==t.length&&n===e.length}(e,n))return t;const a=LI(e,n);a.outScore*=o;const{matched:i,outScore:r}=a;return!t&&i||i&&t&&r>t.outScore?a:t}),null);return i&&t.push({score:i.outScore,item:o}),t}),[]);return o.sort(((e,t)=>t.score-e.score)),o}function $I(e){let t=e.trim();t=t.replace(cm,mm).replace(dm,mm),t=t.replace(fm,"\0");let n=0,o=t.length;for(;"\0"===t.charAt(n);)n++;if(n===o)return[];for(;"\0"===t.charAt(o-1);)o--;return t.slice(n,o).split(/\0/g)}function BI(e){const t=$I(e);for(let n=0;n<t.length;n++){const e=t[n],o=pm.exec(e);if(o){const a=o.index+(o[1]??o[2]).length;t.splice(n,1,e.slice(0,a),e.slice(a))}}return t}function VI(e){return!1===e?e=>e.toLowerCase():t=>t.toLocaleLowerCase(e)}function RI(e,t={}){const n=t.split??(t.separateNumbers?BI:$I),o=t.prefixCharacters??hm,a=t.suffixCharacters??hm;let i=0,r=e.length;for(;i<e.length;){const t=e.charAt(i);if(!o.includes(t))break;i++}for(;r>i;){const t=r-1,n=e.charAt(t);if(!a.includes(n))break;r=t}return[e.slice(0,i),n(e.slice(i,r)),e.slice(r)]}function FI(e,t,n="node"){const o={uuid:Wt(),key:e.name,subcategory:t??e.codex?.subcategories?.["Core Nodes"]?.[0]??"*",properties:{...e},type:n};return o}function WI(e){return e.sort(((e,t)=>{if("node"!==e.type||"node"!==t.type)return 0;const n=e.properties?.displayName?.toLowerCase()||e.key,o=t.properties?.displayName?.toLowerCase()||t.key;return n.localeCompare(o,void 0,{sensitivity:"base"})}))}function UI(e,t,n={}){return qi().isAskAiEnabled||(t=t.filter((e=>e.key!==Bt))),function(e,t){return e.map((({score:e,item:n})=>({score:e+Object.entries(t).reduce(((e,[t,o])=>{const a=o[n.key];return a?e+a:e}),0),item:n}))).sort(((e,t)=>t.score-e.score))}(jI(function(e){const t=e.split(" ");return t.length>1&&"trigger".startsWith(t.slice(-1)[0].toLowerCase())?t.slice(0,-1).filter((e=>e)).join(" ").trimEnd():e}(e).toLowerCase(),t)||[],n).map((({item:e})=>e))}function zI(e){return"node"===e.type&&!!e.properties.codex?.categories?.includes("AI")&&!e.properties.codex?.subcategories?.AI?.includes(Et)}function HI(e){return"node"!==e.type||e.properties.tag||(Oo.includes(e.properties.name)?e.properties.tag={type:"info",text:Se.baseText("generic.recommended")}:ba.includes(e.properties.name)&&(e.properties.tag={type:"info",text:Se.baseText("generic.betaProper")})),e}function GI(e){return e.map((e=>({...e,uuid:`${e.key}-${Wt()}`}))).map(HI)}function YI(...e){return Se.baseText(...e)}function XI(e,t){const n=e.group.includes("trigger")?Xm("nodeCreator.actionsCategory.triggers"):Xm("nodeCreator.actionsCategory.actions");return{name:e.name,group:e.group,codex:{label:t??"",categories:[n]},iconUrl:e.iconUrl,iconColor:e.iconColor,outputs:e.outputs,icon:e.icon,defaults:e.defaults}}function qI(e){if(e.properties.find((e=>"resource"===e.name)))return[];if("n8n-nodes-base.code"===e.name){const t=e.properties.find((e=>"language"===e.name&&2===e.displayOptions?.show?.["@version"]?.[0]));if(t){const n=qm[e.name]?.(t,e);if(n)return n}}const t=e.properties.find((e=>"operation"===e.name?.toLowerCase()));if(!t?.options)return[];const n=t.options.filter((e=>!["*",""," "].includes(e.name))).map((n=>({...XI(e),actionKey:n.value,displayName:n.action??(0,Gm.default)(n.name),description:n.description??"",displayOptions:t.displayOptions,outputConnectionType:n.outputConnectionType,values:{[t.name]:"multiOptions"===t.type?[n.value]:n.value}})));return 0===n.length?[]:n}function JI(e){if(!e.codex?.categories?.includes("AI"))return[];const t=e.properties.find((e=>"mode"===e.name?.toLowerCase()));if(!t?.options)return[];const n=t.options.map((n=>({...XI(e),actionKey:n.value,displayName:n.action??(0,Gm.default)(n.name),description:n.description??"",displayOptions:t.displayOptions,outputConnectionType:n.outputConnectionType,values:{[t.name]:n.value}})));return 0===n.length?[]:n}function KI(e){const t=["event","events","trigger on"],n=e.displayName?.toLowerCase().includes("trigger"),o=e.properties.find((e=>t.includes(e.displayName?.toLowerCase())));if(!n)return[];if(!o?.options)return[{...XI(e),actionKey:Ym,displayName:Xm("nodeCreator.actionsCategory.onNewEvent",{interpolate:{event:e.displayName.replace("Trigger","").trimEnd()}}),description:""}];const a=o.options.filter((e=>!["*",""," "].includes(e.name)));return qm[e.name]?.(o,e)??a.map((t=>({...XI(e),actionKey:t.value,displayName:t.action??Xm("nodeCreator.actionsCategory.onEvent",{interpolate:{event:Om(t.name)}}),description:t.description??"",displayOptions:o.displayOptions,values:{[o.name]:"multiOptions"===o.type?[t.value]:t.value}})))}function ZI(e){const t=[];return e.properties.filter((e=>"resource"===e.name)).forEach((n=>{(n.options||[]).filter((e=>e.value!==dn)).forEach(((n,o,a)=>{const i=1===a.length,r=e.properties.find((t=>{const o="operation"===t.name,a=t.displayOptions?.show?.resource?.includes(n.value)??i,r=t.displayOptions?.show?.["@version"],s=Array.isArray(e.version)?e.version:[e.version],l=!r||r.some((e=>"number"==typeof e&&s.includes(e)));return o&&a&&l}));if(!r?.options)return;const s=(r.options||[]).map((t=>{const o=t.action??`${n.name} ${(0,Gm.default)(t.name)}`,s=i?{show:{resource:[a[0]?.value]}}:r?.displayOptions;return{...XI(e,`${n.name} ${Xm("nodeCreator.actionsCategory.actions")}`),actionKey:t.value,description:t?.description??"",displayOptions:s,values:{operation:"multiOptions"===r?.type?[t.value]:t.value},displayName:o,group:["trigger"]}}));t.push(...s)}))})),t}function QI(){function e(e){return e?e.codex?.subcategories?.AI?.includes("Tools")&&!e.codex?.subcategories?.AI?.includes("Root Nodes")?[]:[...KI(e),...qI(e),...ZI(e),...JI(e)]:[]}function t(e){return e.length<=1?[]:e.filter(((e,t,n)=>{if("__CUSTOM_API_CALL__"===e.actionKey)return!1;const o=e.actionKey===Ym;return!o||o&&n.length>1}))}function n(e){const{displayName:t,defaults:n,description:o,name:a,group:i,icon:r,iconUrl:s,iconColor:l,badgeIconUrl:u,outputs:c,codex:d}=e;return{displayName:t,defaults:n,description:o,name:a,group:i,icon:r,iconColor:l,iconUrl:s,badgeIconUrl:u,outputs:c,codex:d}}return{generateMergedNodesAndActions:function(o,a){const i=zm(),r=qi(),s=o.filter((e=>!(!i.isEvaluationEnabled&&["n8n-nodes-base.evaluation","n8n-nodes-base.evaluationTrigger"].includes(e.name)||(r.isQueueModeEnabled||r.isMultiMain)&&"@n8n/n8n-nodes-langchain.memoryBufferWindow"===e.name))),l={},u=[];return s.filter((e=>!e.group.includes("trigger"))).forEach((t=>{const o=e(t);if(l[t.name]=o,"n8n-nodes-base.httpRequest"===t.name){const e=a.map((e=>{const o=vy(t,e);return o?n(o):null})).filter((e=>null!==e));u.push(...e)}u.push(n(t))})),s.filter((e=>e.group.includes("trigger"))).forEach((o=>{const a=o.name.replace("Trigger",""),i=e(o),r=l?.[a]||[],s=u.find((e=>e.name===a));s&&r?.length>0?(l[a]=t([...r,...i]),s.description=o.description):(l[o.name]=t(i),u.push(n(o)))})),{actions:l,mergedNodes:u}}}}function eN(e){return e.data?.main?.some((e=>e?.some((e=>e.json?.[Ot]))))}function tN({error:e,lastNodeExecuted:t}){let n;if(t&&e)n=e.message??e.description??"";else if(n=Se.baseText("pushConnection.executionError",{interpolate:{error:"!"}}),e?.message){let t;"node"in e&&(t="string"==typeof e.node?e.node:e.node?.name);const o=t?`${t}: ${e.message}`:e.message;n=Se.baseText("pushConnection.executionError",{interpolate:{error:`.${Se.baseText("pushConnection.executionError.details",{interpolate:{details:o}})}`}})}return n}function nN(e){const t={...e,workflowData:e.workflowData,data:el(e.data)};return t.finished=!!t.finished&&t.finished,e.id&&(t.id=e.id),t}function oN(e,t=0){if(t>th)return"object"===e.type?{}:"array"===e.type?[]:"";switch(e.type){case"string":default:return"";case"number":return 0;case"boolean":return!1;case"object":{if(!e.fields?.length)return{};const n={};for(const o of e.fields)n[o.name]=oN(o,t+1);return n}case"array":{if(!e.itemSchema?.length)return[];const n={};for(const o of e.itemSchema)n[o.name]=oN(o,t+1);return[n]}}}function aN(e){const t=Math.max(1,Math.min(e.itemCount??1,eh)),n=[];for(let o=0;o<t;o++){const t={};for(const n of e.fields)t[n.name]=oN(n);n.push({json:t})}return n}function iN(e){return[xn,lo].includes(e.type)}function rN(e,t){"system"===e?(t??window).document.body.removeAttribute("data-theme"):(t??window).document.body.setAttribute?.("data-theme",e)}function sN(e){return!!e&&["light","dark"].includes(e)}function lN(){const e=(t="theme",new URLSearchParams(window.location.search).get(t)??localStorage.getItem("N8N_THEME"));var t;return sN(e)?e:null}function uN(){return new Map(sh)}function cN(e){return lh.add(e),()=>{lh.delete(e)}}async function dN(e,t){return await Ja(e,"POST","/invitations",t)}return e({$:function(e,t){const[n,o,a]=RI(e,t),i=VI(t?.locale),r=(s=t?.locale,!1===s?e=>e.toUpperCase():e=>e.toLocaleUpperCase(s));var s;return n+o.map(function(e,t){return n=>`${t(n[0])}${e(n.slice(1))}`}(i,r)).join(t?.delimiter??" ")+a},$t:function(e,t,n,o,a,i){const r=Math.max(n,o,1),s=Lp[1]+16*Math.max(0,r-2)*2,l=i?1.5:1;return t?{width:(80+16*((e?1:0)+3*(Math.max(4,a)-1)))*l,height:e?jp[1]:s}:e?{width:jp[0]*l,height:jp[1]}:{width:Lp[0]*l,height:s}},A:function(e){return{uuid:"ai_templates_root",key:"ai_templates_root",type:"link",properties:{title:Se.baseText("nodeCreator.aiPanel.linkItem.title"),icon:"box-open",description:Se.baseText("nodeCreator.aiPanel.linkItem.description"),key:"ai_templates_root",url:e,tag:{type:"info",text:Se.baseText("generic.recommended")}}}},Aa:Th,Ar:function(e){return oy(e)||ay(e)||iy(e)},As:function(e){const t=document.getSelection();return!!(t?.anchorNode&&t.focusNode&&e)&&!(e.contains(t.anchorNode)||e.contains(t.focusNode)||t.anchorNode===t.focusNode&&t.anchorOffset===t.focusOffset)},B:UI,Bi:function(e){return e.split(" ").filter((e=>!pl.includes(e))).join(" ")},Ca:Oh,Cn:zk,Cr:iy,Ct:wI,Da:function(e,t){return Object.fromEntries(Object.entries(e).filter((([e])=>e!==t)))},Dn:jx,Dt:vI,Er:function(e){return e.startsWith("project:")},Et:gI,Fr:function(e){return Ia.includes(e)},Gn:function(e){return{id:`collapsed-group-${e[0]?.id??"unknown"}`,role:"assistant",type:"custom",customType:"collapsed_group",data:{collapsedMessages:e}}},Gt:function(e,t){if(!t)return null;if(function(e,t){if(qp.some((e=>function(e,t){if("string"==typeof e)return t.type===e;{const[n,o]=e;return t.type===n&&t.typeVersion<=o}}(e,t))))return!1;if(Jp.includes(e.path))return!1;if(Kp.includes(e.parameter.type))return!1;const n=Jm().getNodeType(t.type,t?.typeVersion)?.codex;return!(!n?.categories?.includes("AI")||!n?.subcategories?.AI?.includes("Tools")||n?.subcategories?.AI?.includes("Vector Stores")||e.parameter.noDataExpression)}(e,t)){const t={type:"fromAI",extraProps:Zp,extraPropValues:{}};return cI(t,e.value?.toString()??""),t}return null},H:WI,Hn:function(e){return"string"==typeof e&&!!e.match(Vu)},I:function(e){switch(e){case en:return"globe";case No:return"database";case Rn:return"badge-check";default:return"globe"}},Ii:function(e){const t=e.filter((e=>!(e.categories||[]).some((e=>e.name===vo))));return(t.length>0?t:e).filter((e=>!Pt.includes(e.name)))},In:Xy,Ir:function(e){return"variable"===e.resourceType},Ji:function(e){return"string"==typeof e&&!!Kt.find((t=>e.includes(t)))},Jn:by,Kn:function(e){return"custom"===e.type&&"customType"in e&&"collapsed_group"===e.customType},Kt:cI,L:function(e,t,n=!0){const o=t.reduce(((e,t)=>(e[t.key]=t,e)),{}),a=[];for(const i of e){const e=o[i];e&&a.push(e)}return n?WI(a):a},Li:function(e){return e.filter((e=>!e.disabled&&!Uo.includes(e.type)))},Ln:Gy,Lr:function(e){return"source"in e&&"target"in e&&"sourceHandle"in e&&"targetHandle"in e},Lt:mI,M:function(e,{isRagStarterCalloutVisible:t=!1}={}){const n=[];return t&&["rag","vec","know"].some((t=>e.toLowerCase().startsWith(t)))&&n.push({uuid:Em.RagStarterTemplate,key:Em.RagStarterTemplate,type:"openTemplate",properties:{templateId:Em.RagStarterTemplate,title:Se.baseText("nodeCreator.ragStarterTemplate.openTemplateItem.title"),icon:"database",description:Se.baseText("nodeCreator.ragStarterTemplate.openTemplateItem.description"),tag:{type:"info",text:Se.baseText("generic.recommended")}}}),n},Ma:Ah,Mr:function(e){return void 0!==e&&"object"==typeof e&&null!==e},N:function(e,t,n=!0){const o=t.filter((e=>"object"==typeof e)),a=e=>e.reduce(((e,t)=>{const n=o.find((e=>e.items.includes(t.key)))?.key??"other";return n&&(e[n]=[...e[n]??[],t]),e}),{}),i=(e,t)=>e.map((e=>({type:"section",key:e.key,title:e.title,children:n?WI(t[e.key]??[]):t[e.key]??[]}))),r=e.filter((e=>!zI(e))),s=e.filter((e=>zI(e))),l=a(r),u=i(o,l),c=a(s),d=[...u,...i((0,_m.default)(o,["title"]),c)].concat({type:"section",key:"other",title:Se.baseText("nodeCreator.sectionNames.other"),children:WI(l.other??[])}).filter((e=>"section"!==e.type||e.children.length>0));return d.sort(((e,t)=>e.key.toLowerCase().includes("recommended")?-1:t.key.toLowerCase().includes("recommended")?1:"Other Tools"===t.key?-1:0)),Dm(d)?d:e},Nr:function(e){return ku.includes(e)},O:GI,On:oI,Or:function(e){return oy(e)||ay(e)||iy(e)},Os:function(){if(void 0!==ns)return ns;const e=document.createElement("div"),t=document.createElement("div");return e.style.visibility="hidden",e.style.overflow="scroll",document.body.appendChild(e),e.appendChild(t),ns=e.offsetWidth-t.offsetWidth,e.parentElement?.removeChild(e),ns},P:zI,Pn:qy,Pr:function(e){return"object"==typeof e&&null!==e&&"id"in e},R:function(e,t,n,o=[]){const a=!Lm(e.key),i=Mm(e.key.split(".")[0]),r=Jm().communityNodeType(Mm(e.key)),s={title:e.properties.displayName,description:e.properties.description,key:e.key,nodeIcon:t,installed:a,official:r?.isOfficialNode??!1,packageName:i,companyName:r?.companyName};if(o.length){const t=o?.map((t=>FI(t,e.properties.displayName,"action")));return{subcategory:e.properties.displayName,title:Se.baseText("nodeSettings.communityNodeDetails.title"),rootView:n,hasSearch:!1,mode:"actions",items:t,communityNodeDetails:s}}return{subcategory:e.properties.displayName,title:Se.baseText("nodeSettings.communityNodeDetails.title"),rootView:n,hasSearch:!1,items:[e],mode:"community-node",communityNodeDetails:s}},Rt:fI,S:nN,Sa:function(e){return"object"==typeof e&&null!==e&&"select"in e&&"function"==typeof e.select},Sn:function(e,t){return Fk(Vk(Rk(e),Rk(t)))},T:QI,Ta:function(e,t=2){return parseFloat((e/1024/1024).toFixed(t))},Tn:nI,Tr:function(e){return!!e&&"status"in e},Tt:EI,U:function(e){const t=[vo,"AI",Co];return e.reduce(((e,n)=>{let o=["*"];const a=t.flatMap((e=>n.codex?.categories?.includes(e)?n.codex?.subcategories?.[e]??[]:[]));return a.length>0&&(o=a),o.forEach((t=>{e[t]||(e[t]=[]),e[t].push(FI(n,t))})),e}),{})},Ut:function(e,t,n){const{extraPropValues:o,extraProps:a}=e,i=n?`${to} `:"",r=((s=(s=function(e){const t=e.path.split(".").filter((e=>/\[\d+\]/i.test(e))).map((e=>e.replaceAll(/[\[\]]/gi,"")));let n=[...t,e.parameter.displayName].join("_");return n=t.length>1?n.slice(-63):n.slice(0,63),n}(t)).replace(/[^a-zA-Z0-9\-]/g,"_")).length>=64&&(s=s.slice(0,63)),s);var s;const l=o?.description?.toString()??a.description.initialValue,u=function(e){return e.includes("\n")?"`":e.includes("`")?e.includes('"')?"'":'"':"`"}(l);return`={{ ${i}$fromAI('${r}', ${u}${l.replaceAll(/\\/g,"\\\\").replaceAll(u,`\\${u}`)}${u}, '${function(e){switch(e){case"boolean":case"number":case"json":return e;default:return"string"}}(t.parameter.type)}') }}`},Vn:zy,W:FI,Wt:dI,X:function(e){return!!e&&"description"in e&&"categories"in e},Xn:wy,Yn:function(e){return"custom"===e.type&&"user"===e.role&&"customType"in e&&"user_answers"===e.customType},Z:function(e){return!!e&&"totalViews"in e},Zn:Oy,_:function(e){return"success"===e?{title:Se.baseText("executionsList.showMessage.retrySuccess.title"),type:"success"}:"waiting"===e?{title:Se.baseText("executionsList.showMessage.retryWaiting.title"),type:"info"}:"running"===e?{title:Se.baseText("executionsList.showMessage.retryRunning.title"),type:"info"}:"crashed"===e?{title:Se.baseText("executionsList.showMessage.retryCrashed.title"),type:"error"}:"canceled"===e?{title:Se.baseText("executionsList.showMessage.retryCanceled.title"),type:"error"}:"error"===e?{title:Se.baseText("executionsList.showMessage.retryError.title"),type:"error"}:void 0},_a:function(e){return"object"==typeof e&&null!==e&&"focusOnInput"in e&&"function"==typeof e.focusOnInput},_i:async function(e,t,n,o,a,i){return await Ja(e,"PUT",`/projects/${t}/folders/${n}/transfer`,{destinationProjectId:o,destinationParentFolderId:a??"0",shareCredentials:i})},a:function(e){sh.has(e.key)?console.warn(`Modal with key "${e.key}" is already registered. Skipping.`):(sh.set(e.key,e),lh.forEach((e=>e(uN()))))},aa:function(){return E(Dt,null)},ar:my,at:function(e,t,n,o,a,i){try{Ms(t.payload)>100&&Uf().trimPayloadSize(t)}catch(r){return void a(r)}Za(e,"/ai/chat",t,n,o,a,void 0,i)},b:function({error:e,lastNodeExecuted:t}){const n=tN({error:e,lastNodeExecuted:t});if("SubworkflowOperationError"===e.name)return{title:e.message,message:e.description??""};if(("NodeOperationError"===e.name||"NodeApiError"===e.name)&&"configuration-node"===e.functionality){const t="node"in e&&e.node?.name?e.node.name:"";return{title:t?`Error in sub-node ‘${t}‘`:"Problem executing workflow",message:w(Us,{errorMessage:e.description??n,nodeName:t})}}return{title:t?`Problem in node ‘${t}‘`:"Problem executing workflow",message:n}},ba:function(e){return"object"==typeof e&&null!==e&&"focus"in e&&"function"==typeof e.focus},bn:Tk,c:function(e,t){return{completionTokens:e.completionTokens+t.completionTokens,promptTokens:e.promptTokens+t.promptTokens,totalTokens:e.totalTokens+t.totalTokens,isEstimate:e.isEstimate||t.isEstimate}},ca:function(e={}){return Object.values(e).reduce(((e,t)=>e+Dh(t)),0)},ct:DI,d:iN,dr:ly,dt:function({nodeName:e,distanceFromActive:t,path:n,binaryMode:o}){const a=_I({nodeName:e,distanceFromActive:t,binaryMode:o});return"string"==typeof n?`{{ ${a}${n} }}`:`{{ ${AI(a,n)} }}`},ea:function(e,t){return!0!==e.noDataExpression&&("string"==typeof t&&"="===t.charAt(0)||!(!Wo(t)||!t.value||"="!==t.value.toString().charAt(0)))},et:jI,f:function(e,t){if([xo.AiChain,xo.Main].includes(t))return e.map((e=>({raw:e.json,parsedContent:null})));const n=e.map((e=>an(e.binary)?e.json:e.binary)),o=oh[t];return o?n.filter((e=>void 0!==e)).map((e=>({raw:e,parsedContent:o(e)}))):[{raw:n.filter((e=>void 0!==e)),parsedContent:null}]},fa:function(e){const t=Math.log10(Math.abs(e))/3|0;if(0===t)return e;const n=js[t],o=e/Math.pow(10,3*t);return Number(o.toFixed(1))+n},fr:sy,ft:function(e,t,n){const o="resourceLocator"===e.type&&Wo(n)?n.value:n;if(e.requiresDataPath){if("multiple"===e.requiresDataPath){const e=PI(t,!0);return"string"!=typeof o||"="!==o.trim()&&""!==o.trim()?`${o}, ${e}`:e}return PI(t)}return"string"==typeof o&&oa(o)&&o.length>1?`${o} ${t}`:o&&["string","json"].includes(e.type)?"="===o||"object"==typeof o?`=${t}`:`=${o} ${t}`:`=${t}`},ga:function(e){return(0,Ls.default)(e,"d mmmm, yyyy @ HH:MM Z")},h:async function({nodes:e,runData:t,pinData:n,destinationNode:o,triggerNode:a,directParentNodes:i,source:r,getTestUrl:s}){for(const u of e)if((void 0===a||a===u.name)&&!(t?.hasOwnProperty(u.name)&&"n8n-nodes-base.formTrigger"!==u.type||n[u.name])&&["n8n-nodes-base.formTrigger"].includes(u.type)&&(!o||o===u.name||i.includes(u.name))&&(u.name===o||!u.disabled)){let e="";"n8n-nodes-base.formTrigger"===u.type&&(e=s(u));try{if(!(await fetch(e,{method:"GET"})).ok)continue}catch(l){continue}e&&"RunData.ManualChatMessage"!==r&&(Qm(),Zm(e))}},ha:function(e){return(0,Ls.default)(e,"yyyy-mm-dd HH:MM:ss")},i:uN,ia:function(e){const t=Ga();if(!t)return;const n=Zh(e);if(t.state.value[n]){const e=t._s.get(n);e&&e.$dispose(),delete t.state.value[n]}},ii:function(){const e=su();return async t=>await e.searchProjects({search:t,take:50})},ir:function(e,t,n={},o={}){const a=e.filter((e=>e.isTrigger)).sort(((e,t)=>e.node.position[0]-t.node.position[0]));if(0===a.length)return[];const i=new Map;for(const u of e)i.set(u.node.name,u);const r=[],s=new Set,l=e=>{if(s.has(e))return;s.add(e);const a=n[e];if(a)for(const t of Object.keys(a))if("main"!==t)for(const e of a[t])for(const t of e??[])l(t.node);(e=>{const t=i.get(e);t&&r.push(t)})(e);const u=t[e];if(u?.main){const t=u.main;if("n8n-nodes-base.splitInBatches"===o[e]&&t.length>1)for(const e of[1,0])for(const n of t[e]??[])l(n.node);else for(const e of t)for(const t of e??[])l(t.node)}};for(const u of a)l(u.node.name);return r},j:function(e){const t=e.filter((e=>e.actionKey===_n));if(t.length){const e=t[0].name;"n8n-nodes-base.discord"===e&&(t[0].values={...t[0].values,resource:"message",operation:_n}),"n8n-nodes-base.microsoftTeams"===e&&(t[0].values={...t[0].values,resource:"chatMessage",operation:_n})}return t},ja:async function(e,t){return await Ja(e,"GET",`/workflows/${t}/collaboration/write-lock`)},jr:ny,js:Ih,k:function(e){return e.map((e=>"section"===e.type?e.children:e)).flat()},ka:Sh,kn:qk,kr:function(e){return"string"==typeof e||"object"==typeof e&&null!==e&&("name"in e||"path"in e)},ks:function(e,t){return!!(e instanceof Node&&g(t)?.contains(e))},kt:hI,la:function(e){return Object.fromEntries(Object.entries(e).map((([e,t])=>[e,t.map((e=>e.json))])))},lr:uy,nn:sI,o:cN,oa:Qh,or:cy,ot:async function(e,{question:t,context:n,forNode:o}){return await Ja(e,"POST","/ai/ask-ai",{question:t,context:n,forNode:o})},p:function({workflow:e,nodeExecutionSchema:t,executionStatus:n,executionError:o,lastNodeExecuted:a}){const i={};for(const[s,l]of Object.entries(t)){const e={startTime:0,executionIndex:0,executionTime:l.executionTime??0,executionStatus:l.executionStatus,source:[]};l.error&&(e.error=l.error),l.outputSchema&&l.outputSchema.fields.length>0&&(e.data={main:[aN(l.outputSchema)]}),i[s]=[e]}const r=on({resultData:{runData:i,error:o||void 0,lastNodeExecuted:a},executionData:null});return{id:"preview",finished:"success"===n,mode:"manual",status:n,startedAt:(new Date).toISOString(),createdAt:(new Date).toISOString(),stoppedAt:(new Date).toISOString(),data:r,workflowData:e}},pt:PI,qi:function(e){return e.displayName.replace(/ trigger/i,"")},qn:ky,ra:Kh,ri:function(){const e=su();return async t=>{if(e.globalProjectPermissions.list)return await e.searchProjects({search:t,take:50});const n=t.toLowerCase(),o=e.myProjects.filter((e=>!t||(e.name?.toLowerCase().includes(n)??!1)));return{count:o.length,data:o}}},rn:function({workflowNode:e,node:t,nodeType:n,nodeOutputData:o,hasMultipleInputItems:a,nodes:i,connections:r,hasNodeRun:s}){const l=[];if(t?.type.toLocaleLowerCase().includes("tool")&&"@n8n/n8n-nodes-langchain.mcpClientTool"!==t?.type&&s&&(JSON.stringify(e.parameters).includes("$fromAI")||l.push({message:"No parameters are set up to be filled by AI. Click on the ✨ button next to a parameter to allow AI to set its value.",location:"outputPane",whenToDisplay:"afterExecution"})),s&&e.parameters.limit&&o.length===e.parameters.limit&&l.push({message:`Limit of ${e.parameters.limit} items reached. There may be more items that aren't being returned. Tweak the 'Return All' or 'Limit' parameters to access more items.`,location:"outputPane",whenToDisplay:"afterExecution"}),a&&ja.includes(e.parameters.operation||"")&&(Fn(i,t.name)?.executeOnce||l.push({message:"This node runs multiple times, once for each input item. Use ‘Execute Once’ in the node settings if you want to run it only once.",location:"outputPane"})),a&&"sendAndWait"===e.parameters.operation&&(Fn(i,t.name)?.executeOnce||l.push({message:"This action will run only once, for the first input item",location:"outputPane"})),"n8n-nodes-base.set"===t.type&&"manual"===t.parameters.mode){const e=($o(n.properties,t.parameters,!0,!1,t,n)?.assignments||{})?.assignments||[],o=[];for(const[t,n]of e.entries())n.name.startsWith("=")&&o.push(t+1);o.length>0&&l.push({message:`An expression is used in 'Fields to Set' in ${1===o.length?"field":"fields"} ${o.join(", ")}, did you mean to use it in the value instead?`,whenToDisplay:"beforeExecution",location:"outputPane"})}if("n8n-nodes-base.splitInBatches"===t.type){const e=Hn(r)[t.name]?.main[1]||[];if(e.length)for(const n of e||[])(Xn(r,n.node)||[]).includes(t.name)||l.push({message:"The last node in the branch of the 'loop' output must be connected back to the input of this node to loop correctly",whenToDisplay:"beforeExecution",location:"outputPane"});else l.push({message:"No nodes connected to the 'loop' output of this node",whenToDisplay:"beforeExecution",location:"outputPane"})}return l},rr:function(e){if(!e)return e;const{pinData:t,...n}=e;return{...n,nodes:e.nodes.map((e=>{const{issues:t,pinData:n,...o}=e;return o}))}},si:ty,tn:function(e,t,n){const o=[],a=Math.floor(e/2),i=e%2==1;if(0===e)return[];for(let r=-a;r<=a;r++)if(0===r)i&&o.push(0);else{const e=r*t+Math.sign(r)*(Math.abs(r)-(i?0:1))*n;o.push(e)}return o},u:function(e,t){const n="total"===t?e.totalTokens:"completion"===t?e.completionTokens:e.promptTokens;return e.isEstimate?`~${n}`:n.toLocaleString()},ua:jh,un:function(e,t,n,o){function a(e,t,n,o){return e>=n&&t<=o?0:e<n?t>o?0:n-e:o-t}if(0===n.length)return e;const i=e.zoom,r=function({x:e,y:t,width:n,height:o},a){return{x:e-a,y:t-a,width:n+2*a,height:o+2*a}}(Wk(n),o/i),{xMax:s,xMin:l,yMax:u,yMin:c}=sI(e,t),d=a(r.x,r.x+r.width,l,s),p=a(r.y,r.y+r.height,c,u);return{x:e.x+d*i,y:e.y+p*i,zoom:i}},ut:CI,v:function(){return{workflowId:"all",status:"all",startDate:"",endDate:"",tags:[],annotationTags:[],metadata:[],vote:"all",workflowVersionId:"all"}},va:function(e){return"object"==typeof e&&null!==e&&"blur"in e&&"function"==typeof e.blur},vr:ry,wa:Dh,wn:Wk,wr:function(e){return!!e&&"[object Date]"===Object.prototype.toString.call(e)&&!isNaN(e)},wt:kI,x:function(e){return Object.keys(e).some((t=>e[t].some(eN)))},xa:Mh,xn:Kx,xr:function(e){return null!==e&&"object"==typeof e&&"$props"in e},y:tN,yr:function(e){const t=Ie();try{return t.baseText(e),!0}catch{return!1}},zi:ey,zt:pI}),{setters:[function(e){n=e.o,o=e.t},function(e){a=e.$,i=e.$t,r=e.A,s=e.At,l=e.B,u=e.Bt,c=e.C,d=e.Ct,p=e.D,f=e.Dt,m=e.E,h=e.En,y=e.Et,v=e.Ft,g=e.Ht,w=e.I,b=e.K,k=e.Mt,x=e.N,I=e.Nt,N=e.P,S=e.Pt,T=e.Qt,E=e.R,A=e.Rt,C=e.S,_=e.Sn,P=e.T,D=e.Tn,O=e.Tt,M=e.U,L=e.Vt,j=e.W,$=e.Wt,B=e.X,V=e.Z,R=e._,F=e._n,W=e._t,U=e.at,z=e.bt,H=e.en,G=e.ft,Y=e.gt,X=e.h,q=e.i,J=e.in,K=e.it,Z=e.j,Q=e.jt,ee=e.lt,te=e.m,ne=e.n,oe=e.o,ae=e.ot,ie=e.p,re=e.pn,se=e.q,le=e.qt,ue=e.rt,ce=e.sn,de=e.st,pe=e.tt,fe=e.w,me=e.wt,he=e.y,ye=e.yn,ve=e.yt,ge=e.z},function(e){we=e.A,be=e.J,ke=e.T,xe=e.Z,Ie=e.at,Ne=e.et,Se=e.nt,Te=e.s,Ee=e.tt,Ae=e.v,Ce=e.y},function(e){_e=e.$t,Pe=e.Ci,De=e.En,Oe=e.Fi,Me=e.Fn,Le=e.In,je=e.Mn,$e=e.Nn,Be=e.Pn,Ve=e.Sn,Re=e.Xt,Fe=e.ar,We=e.bn,Ue=e.cn,ze=e.cr,He=e.ct,Ge=e.dt,Ye=e.fi,Xe=e.gn,qe=e.gr,Je=e.ir,Ke=e.j,Ze=e.jn,Qe=e.kn,et=e.ln,tt=e.lt,nt=e.mi,ot=e.mn,at=e.nn,it=e.nr,rt=e.or,st=e.pi,lt=e.pr,ut=e.rr,ct=e.si,dt=e.sn,pt=e.sr,ft=e.tr,mt=e.wi,ht=e.xt},function(e){yt=e.a,vt=e.s,gt=e.t,wt=e.u},function(e){e.$,bt=e.$a,kt=e.$c,xt=e.$o,It=e.$t,Nt=e.Ao,St=e.As,Tt=e.At,Et=e.B,At=e.Bo,Ct=e.Bs,_t=e.Bt,Pt=e.C,Dt=e.Cc,Ot=e.Co,Mt=e.Cs,Lt=e.D,jt=e.Dn,$t=e.Ds,Bt=e.Dt,Vt=e.E,Rt=e.Ec,Ft=e.En,Wt=e.Eo,Ut=e.Es,e.Et,zt=e.Fa,Ht=e.Fs,Gt=e.Ft,Yt=e.Gi,Xt=e.Ha,qt=e.Hc,Jt=e.Hs,Kt=e.I,Zt=e.Is,Qt=e.It,en=e.J,tn=e.Jn,nn=e.Jt,on=e.Ki,e.Kt,an=e.La,rn=e.Li,sn=e.Ls,e.M,ln=e.Ma,un=e.Mn,cn=e.Ms,dn=e.N,pn=e.Nc,fn=e.Ni,mn=e.Ns,hn=e.Oo,yn=e.Os,vn=e.Ot,gn=e.P,wn=e.Pa,bn=e.Po,kn=e.Ps,xn=e.Pt,In=e.Qa,Nn=e.Qc,Sn=e.Qi,e.Qn,Tn=e.Qo,En=e.Ra,An=e.Rc,Cn=e.Rs,_n=e.So,Pn=e.Ss,Dn=e.Ta,On=e.Tc,Mn=e.Tn,e.To,Ln=e.Ts,jn=e.Un,$n=e.Vc,Bn=e.Vo,Vn=e.Vr,Rn=e.W,Fn=e.Xi,Wn=e.Xn,Un=e.Xo,zn=e.Xt,Hn=e.Yi,Gn=e.Yn,Yn=e.Ys,e.Z,Xn=e.Zi,qn=e.Zn,Jn=e.Zo,Kn=e.Zs,Zn=e.Zt,Qn=e._a,eo=e._i,to=e._o,no=e._r,oo=e._s,ao=e.aa,io=e.al,ro=e.an,so=e.as,lo=e.bn,uo=e.bo,co=e.br,po=e.bs,fo=e.cc,mo=e.ci,ho=e.cl,e.co,e.cr,yo=e.cs,vo=e.ct,e.dl,go=e.dn,e.do,wo=e.ds,bo=e.ea,ko=e.el,xo=e.eo,Io=e.es,No=e.et,So=e.f,To=e.fi,Eo=e.fn,e.fr,Ao=e.fs,Co=e.ft,_o=e.gn,e.go,Po=e.gr,Do=e.gs,Oo=e.gt,Mo=e.hn,Lo=e.hr,jo=e.hs,$o=e.ia,Bo=e.il,e.in,Vo=e.ir,Ro=e.is,Fo=e.j,Wo=e.ja,Uo=e.jn,zo=e.js,Ho=e.kc,Go=e.ki,Yo=e.kn,Xo=e.ks,qo=e.ln,Jo=e.lo,Ko=e.lr,Zo=e.ls,Qo=e.mn,ea=e.mo,ta=e.ms,e.n,na=e.na,oa=e.no,e.nr,aa=e.ns,ia=e.oa,ra=e.oi,sa=e.ol,la=e.on,ua=e.os,ca=e.pa,e.pl,e.po,da=e.pr,pa=e.ps,fa=e.qn,ma=e.r,ha=e.ra,ya=e.rs,va=e.sn,ga=e.sr,wa=e.ss,ba=e.st,ka=e.t,xa=e.ta,Ia=e.to,Na=e.tr,Sa=e.ts,Ta=e.us,Ea=e.va,Aa=e.vr,Ca=e.vs,_a=e.wi,Pa=e.ws,Da=e.x,Oa=e.xi,Ma=e.xr,La=e.xs,ja=e.yn,$a=e.ys,Ba=e.zc,Va=e.zn,Ra=e.zs,e.zt},function(e){Fa=e.b,Wa=e.n,Ua=e.o,za=e.r,Ha=e.t},function(e){Ga=e.E,Ya=e.S,Xa=e.T,qa=e.a,Ja=e.c,Ka=e.d,Za=e.f,Qa=e.h,ei=e.m,ti=e.s,ni=e.t,oi=e.u},function(e){ai=e.An,ii=e.C,ri=e.Dn,si=e.E,li=e.En,ui=e.On,ci=e.Ot,di=e.S,pi=e.T,fi=e.Tn,mi=e._,hi=e.a,yi=e.at,vi=e.b,gi=e.ct,wi=e.d,bi=e.dt,ki=e.et,xi=e.f,Ii=e.fn,Ni=e.ft,Si=e.g,Ti=e.gn,Ei=e.gt,Ai=e.h,Ci=e.hn,_i=e.ht,Pi=e.i,Di=e.it,Oi=e.kn,Mi=e.l,Li=e.lt,ji=e.m,$i=e.mn,Bi=e.mt,Vi=e.n,Ri=e.nt,Fi=e.o,Wi=e.ot,Ui=e.p,zi=e.pn,Hi=e.pt,Gi=e.r,Yi=e.rt,Xi=e.st,qi=e.t,Ji=e.tt,Ki=e.u,Zi=e.ut,Qi=e.v,er=e.w,tr=e.wn,nr=e.x,or=e.y},function(e){ar=e.t},function(e){ir=e.r,rr=e.t},function(e){sr=e.t}],execute:function(){try{t="undefined"!=typeof window?window:void 0!==D?D:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},(y=(new t.Error).stack)&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[y]="aa96de8b-98c9-47ea-a72e-84a2991a74ba",t._sentryDebugIdIdentifier="sentry-dbid-aa96de8b-98c9-47ea-a72e-84a2991a74ba")}catch(t){}var t,y;e("Ls",lr=(e,t,n)=>{let o={offsetX:0,offsetY:0};const a=t=>{const n=t.clientX,a=t.clientY,{offsetX:i,offsetY:r}=o,s=e.value.getBoundingClientRect(),l=s.left,u=s.top,c=s.width,d=s.height,p=document.documentElement.clientWidth,f=document.documentElement.clientHeight,m=-l+i,h=-u+r,y=p-l-c+i,v=f-u-d+r,g=t=>{const s=Math.min(Math.max(i+t.clientX-n,m),y),l=Math.min(Math.max(r+t.clientY-a,h),v);o={offsetX:s,offsetY:l},e.value&&(e.value.style.transform=`translate(${ut(s)}, ${ut(l)})`)},w=()=>{document.removeEventListener("mousemove",g),document.removeEventListener("mouseup",w)};document.addEventListener("mousemove",g),document.addEventListener("mouseup",w)},i=()=>{t.value&&e.value&&t.value.removeEventListener("mousedown",a)};B((()=>{W((()=>{n.value?t.value&&e.value&&t.value.addEventListener("mousedown",a):i()}))})),se((()=>{i()}))}),f(),e("Is",ur=(e,t={})=>{s(e)||ze("[useLockscreen]","You need to pass a ref param to this function");const n=t.ns||Xe("popup"),o=d((()=>n.bm("parent","hidden")));if(!Ye||Fe(document.body,o.value))return;let a=0,i=!1,r="0";const l=()=>{setTimeout((()=>{"undefined"!=typeof document&&(rt(null==document?void 0:document.body,o.value),i&&document&&(document.body.style.width=r))}),200)};Y(e,(e=>{if(!e)return void l();i=!Fe(document.body,o.value),i&&(r=document.body.style.width),a=ft(n.namespace.value);const t=document.documentElement.clientHeight<document.body.scrollHeight,s=Je(document.body,"overflowY");a>0&&(t||"scroll"===s)&&i&&(document.body.style.width=`calc(100% - ${a}px)`),it(document.body,o.value)})),k((()=>l()))}),H(),e("Fs",cr=e=>{if(!e)return{onClick:le,onMousedown:le,onMouseup:le};let t=!1,n=!1;return{onClick:o=>{t&&n&&e(o),t=n=!1},onMousedown:e=>{t=e.target===e.currentTarget},onMouseup:e=>{n=e.target===e.currentTarget}}}),dr="_trap-focus-children",pr=[],fr=e=>{if(0===pr.length)return;const t=pr[pr.length-1][dr];if(t.length>0&&e.code===De.tab){if(1===t.length)return e.preventDefault(),void(document.activeElement!==t[0]&&t[0].focus());const n=e.shiftKey,o=e.target===t[0],a=e.target===t[t.length-1];o&&n&&(e.preventDefault(),t[t.length-1].focus()),a&&!n&&(e.preventDefault(),t[0].focus())}},mr={beforeMount(e){e[dr]=nt(e),pr.push(e),pr.length<=1&&document.addEventListener("keydown",fr)},updated(e){j((()=>{e[dr]=nt(e)}))},unmounted(){pr.shift(),0===pr.length&&document.removeEventListener("keydown",fr)}},hr=Me({mask:{type:Boolean,default:!0},customMaskEvent:{type:Boolean,default:!1},overlayClass:{type:Le([String,Array,Object])},zIndex:{type:Le([String,Number])}}),yr=x({name:"ElOverlay",props:hr,emits:{click:e=>e instanceof MouseEvent},setup(e,{slots:t,emit:n}){const o=Xe("overlay"),{onClick:a,onMousedown:i,onMouseup:r}=cr(e.customMaskEvent?void 0:e=>{n("click",e)});return()=>e.mask?Z("div",{class:[o.b(),e.overlayClass],style:{zIndex:e.zIndex},onClick:a,onMousedown:i,onMouseup:r},[K(t,"default")],We.STYLE|We.CLASS|We.PROPS,["onClick","onMouseup","onMousedown"]):w("div",{class:e.overlayClass,style:{zIndex:e.zIndex,position:"fixed",top:"0px",right:"0px",bottom:"0px",left:"0px"}},[K(t,"default")])}}),e("Ps",vr=yr),H(),gr=void 0,wr=function(e={}){if(!Ye)return;const t=br(e);if(t.fullscreen&&gr)return gr;const n=wh({...t,closed:()=>{var e;null==(e=t.closed)||e.call(t),t.fullscreen&&(gr=void 0)}});kr(t,t.parent,n),xr(t,t.parent,n),t.parent.vLoadingAddClassList=()=>xr(t,t.parent,n);let o=t.parent.getAttribute("loading-number");return o=o?`${Number.parseInt(o)+1}`:"1",t.parent.setAttribute("loading-number",o),t.parent.appendChild(n.$el),j((()=>n.visible.value=t.visible)),t.fullscreen&&(gr=n),n},br=e=>{var t,n,o,a;let i;return i=re(e.target)?null!=(t=document.querySelector(e.target))?t:document.body:e.target||document.body,{parent:i===document.body||e.body?document.body:i,background:e.background||"",svg:e.svg||"",svgViewBox:e.svgViewBox||"",spinner:e.spinner||!1,text:e.text||"",fullscreen:i===document.body&&(null==(n=e.fullscreen)||n),lock:null!=(o=e.lock)&&o,customClass:e.customClass||"",visible:null==(a=e.visible)||a,target:i}},kr=async(e,t,n)=>{const{nextZIndex:o}=n.vm.zIndex||n.vm._.exposed.zIndex,a={};if(e.fullscreen)n.originalPosition.value=Je(document.body,"position"),n.originalOverflow.value=Je(document.body,"overflow"),a.zIndex=o();else if(e.parent===document.body){n.originalPosition.value=Je(document.body,"position"),await j();for(const t of["top","left"]){const n="top"===t?"scrollTop":"scrollLeft";a[t]=e.target.getBoundingClientRect()[t]+document.body[n]+document.documentElement[n]-Number.parseInt(Je(document.body,`margin-${t}`),10)+"px"}for(const t of["height","width"])a[t]=`${e.target.getBoundingClientRect()[t]}px`}else n.originalPosition.value=Je(t,"position");for(const[i,r]of Object.entries(a))n.$el.style[i]=r},xr=(e,t,n)=>{const o=n.vm.ns||n.vm._.exposed.ns;["absolute","fixed","sticky"].includes(n.originalPosition.value)?rt(t,o.bm("parent","relative")):it(t,o.bm("parent","relative")),e.fullscreen&&e.lock?it(t,o.bm("parent","hidden")):rt(t,o.bm("parent","hidden"))},H(),Ir=Symbol("ElLoading"),Nr=(e,t)=>{var n,o,a,r;const s=t.instance,l=e=>ce(t.value)?t.value[e]:void 0,u=t=>(e=>{const t=re(e)&&(null==s?void 0:s[e])||e;return t?v(t):t})(l(t)||e.getAttribute(`element-loading-${i(t)}`)),c=null!=(n=l("fullscreen"))?n:t.modifiers.fullscreen,d={text:u("text"),svg:u("svg"),svgViewBox:u("svgViewBox"),spinner:u("spinner"),background:u("background"),customClass:u("customClass"),fullscreen:c,target:null!=(o=l("target"))?o:c?void 0:e,body:null!=(a=l("body"))?a:t.modifiers.body,lock:null!=(r=l("lock"))?r:t.modifiers.lock};e[Ir]={options:d,instance:wr(d)}},Sr=(e,t)=>{for(const n of Object.keys(t))s(t[n])&&(t[n].value=e[n])},e("Ns",Er={install(e){e.directive("loading",Tr),e.config.globalProperties.$loading=wr},directive:Tr={mounted(e,t){t.value&&Nr(e,t)},updated(e,t){const n=e[Ir];t.oldValue!==t.value&&(t.value&&!t.oldValue?Nr(e,t):t.value&&t.oldValue?ce(t.value)&&Sr(t.value,n.options):n?.instance.close())},unmounted(e){var t;null==(t=e[Ir])||t.instance.close()}},service:wr}),Ar=x({name:"ElMessageBox",directives:{TrapFocus:mr},components:{ElButton:Re,ElFocusTrap:_e,ElInput:at,ElOverlay:vr,ElIcon:dt,...je},inheritAttrs:!1,props:{buttonSize:{type:String,validator:Ve},modal:{type:Boolean,default:!0},lockScroll:{type:Boolean,default:!0},showClose:{type:Boolean,default:!0},closeOnClickModal:{type:Boolean,default:!0},closeOnPressEscape:{type:Boolean,default:!0},closeOnHashChange:{type:Boolean,default:!0},center:Boolean,draggable:Boolean,roundButton:{default:!1,type:Boolean},container:{type:String,default:"body"},boxType:{type:String,default:""}},emits:["vanish","action"],setup(e,{emit:t}){const{locale:n,zIndex:o,ns:a,size:i}=et("message-box",C((()=>e.buttonSize))),{t:r}=n,{nextZIndex:s}=o,l=v(!1),u=I({autofocus:!0,beforeClose:null,callback:null,cancelButtonText:"",cancelButtonClass:"",confirmButtonText:"",confirmButtonClass:"",customClass:"",customStyle:{},dangerouslyUseHTMLString:!1,distinguishCancelAndClose:!1,icon:"",inputPattern:null,inputPlaceholder:"",inputType:"text",inputValue:null,inputValidator:null,inputErrorMessage:"",message:null,modalFade:!0,modalClass:"",showCancelButton:!1,showConfirmButton:!0,type:"",title:void 0,showInput:!1,action:"",confirmButtonLoading:!1,cancelButtonLoading:!1,confirmButtonDisabled:!1,editorErrorMessage:"",validateError:!1,zIndex:s()}),c=C((()=>{const e=u.type;return{[a.bm("icon",e)]:e&&$e[e]}})),d=ot(),p=ot(),f=C((()=>u.icon||$e[u.type]||"")),m=C((()=>!!u.message)),h=v(),y=v(),g=v(),w=v(),b=v(),k=C((()=>u.confirmButtonClass));function x(){l.value&&(l.value=!1,j((()=>{u.action&&t("action",u.action)})))}Y((()=>u.inputValue),(async t=>{await j(),"prompt"===e.boxType&&null!==t&&E()}),{immediate:!0}),Y((()=>l.value),(t=>{var n,o;t&&("prompt"!==e.boxType&&(u.autofocus?g.value=null!=(o=null==(n=b.value)?void 0:n.$el)?o:h.value:g.value=h.value),u.zIndex=s()),"prompt"===e.boxType&&(t?j().then((()=>{var e;w.value&&w.value.$el&&(u.autofocus?g.value=null!=(e=A())?e:h.value:g.value=h.value)})):(u.editorErrorMessage="",u.validateError=!1))})),lr(h,y,C((()=>e.draggable))),B((async()=>{await j(),e.closeOnHashChange&&window.addEventListener("hashchange",x)})),se((()=>{e.closeOnHashChange&&window.removeEventListener("hashchange",x)}));const N=()=>{e.closeOnClickModal&&T(u.distinguishCancelAndClose?"close":"cancel")},S=cr(N),T=t=>{var n;("prompt"!==e.boxType||"confirm"!==t||E())&&(u.action=t,u.beforeClose?null==(n=u.beforeClose)||n.call(u,t,u,x):x())},E=()=>{if("prompt"===e.boxType){const e=u.inputPattern;if(e&&!e.test(u.inputValue||""))return u.editorErrorMessage=u.inputErrorMessage||r("el.messagebox.error"),u.validateError=!0,!1;const t=u.inputValidator;if("function"==typeof t){const e=t(u.inputValue);if(!1===e)return u.editorErrorMessage=u.inputErrorMessage||r("el.messagebox.error"),u.validateError=!0,!1;if("string"==typeof e)return u.editorErrorMessage=e,u.validateError=!0,!1}}return u.editorErrorMessage="",u.validateError=!1,!0},A=()=>{const e=w.value.$refs;return e.input||e.textarea},_=()=>{T("close")};return e.lockScroll&&ur(l),{...L(u),ns:a,overlayEvent:S,visible:l,hasMessage:m,typeClass:c,contentId:d,inputId:p,btnSize:i,iconComponent:f,confirmButtonClasses:k,rootRef:h,focusStartRef:g,headerRef:y,inputRef:w,confirmRef:b,doClose:x,handleClose:_,onCloseRequested:()=>{e.closeOnPressEscape&&_()},handleWrapperClick:N,handleInputEnter:e=>{if("textarea"!==u.inputType)return e.preventDefault(),T("confirm")},handleAction:T,t:r}}}),Cr=["aria-label","aria-describedby"],_r=["aria-label"],Pr=["id"],Dr=Ue(Ar,[["render",bh],["__file","/home/runner/work/element-plus/element-plus/packages/components/message-box/src/index.vue"]]),H(),Or=new Map,Mr=e=>{let t=document.body;return e.appendTo&&(re(e.appendTo)&&(t=document.querySelector(e.appendTo)),lt(e.appendTo)&&(t=e.appendTo),lt(t)||(pt("ElMessageBox","the appendTo option is not an HTMLElement. Falling back to document.body."),t=document.body)),t},Lr=(e,t,n=null)=>{const o=Z(Dr,e,J(e.message)||l(e.message)?{default:J(e.message)?e.message:()=>e.message}:null);return o.appContext=n,oe(o,t),Mr(e).appendChild(t.firstElementChild),o.component},jr=()=>document.createElement("div"),$r=(e,t)=>{const n=jr();e.onVanish=()=>{oe(null,n),Or.delete(a)},e.onAction=t=>{const n=Or.get(a);let i;i=e.showInput?{value:a.inputValue,action:t}:t,e.callback?e.callback(i,o.proxy):"cancel"===t||"close"===t?e.distinguishCancelAndClose&&"cancel"!==t?n.reject("close"):n.reject("cancel"):n.resolve(i)};const o=Lr(e,n,t),a=o.proxy;for(const i in e)T(e,i)&&!T(a.$props,i)&&(a[i]=e[i]);return a.visible=!0,a},Br={alert:{closeOnPressEscape:!1,closeOnClickModal:!1},confirm:{showCancelButton:!0},prompt:{showCancelButton:!0,showInput:!0}},["alert","confirm","prompt"].forEach((e=>{kh[e]=function(e){return(t,n,o,a)=>{let i="";return ce(n)?(o=n,i=""):i=qe(n)?"":n,kh(Object.assign({title:i,message:t,type:"",...Br[e]},o,{boxType:e}),a)}}(e)})),kh.close=()=>{Or.forEach(((e,t)=>{t.doClose()})),Or.clear()},kh._context=null,(Vr=kh).install=e=>{Vr._context=e._context,e.config.globalProperties.$msgbox=Vr,e.config.globalProperties.$messageBox=Vr,e.config.globalProperties.$alert=Vr.alert,e.config.globalProperties.$confirm=Vr.confirm,e.config.globalProperties.$prompt=Vr.prompt},e("Ms",Rr=Vr),Fr=["success","info","warning","error"],Wr=Me({customClass:{type:String,default:""},dangerouslyUseHTMLString:{type:Boolean,default:!1},duration:{type:Number,default:4500},icon:{type:Be},id:{type:String,default:""},message:{type:Le([String,Object]),default:""},offset:{type:Number,default:0},onClick:{type:Le(Function),default:()=>{}},onClose:{type:Le(Function),required:!0},position:{type:String,values:["top-right","top-left","bottom-right","bottom-left"],default:"top-right"},showClose:{type:Boolean,default:!0},title:{type:String,default:""},type:{type:String,values:[...Fr,""],default:""},zIndex:Number}),Ur={destroy:()=>!0},zr=["id"],Hr=["textContent"],Gr={key:0},Yr=["innerHTML"],Xr=Ue(x({...x({name:"ElNotification"}),props:Wr,emits:Ur,setup(e,{expose:t}){const n=e,{ns:o,zIndex:i}=et("notification"),{nextZIndex:r,currentZIndex:s}=i,{Close:l}=Ze,u=v(!1);let d;const p=C((()=>{const e=n.type;return e&&$e[n.type]?o.m(e):""})),f=C((()=>n.type&&$e[n.type]||n.icon)),h=C((()=>n.position.endsWith("right")?"right":"left")),y=C((()=>n.position.startsWith("top")?"top":"bottom")),g=C((()=>{var e;return{[y.value]:`${n.offset}px`,zIndex:null!=(e=n.zIndex)?e:s.value}}));function w(){n.duration>0&&({stop:d}=st((()=>{u.value&&k()}),n.duration))}function b(){d?.()}function k(){u.value=!1}return B((()=>{w(),r(),u.value=!0})),ct(document,"keydown",(function({code:e}){e===De.delete||e===De.backspace?b():e===De.esc?u.value&&k():w()})),t({visible:u,close:k}),(e,t)=>(a(),fe(ne,{name:$(o).b("fade"),onBeforeLeave:e.onClose,onAfterLeave:t[1]||(t[1]=t=>e.$emit("destroy")),persisted:""},{default:ve((()=>[z(c("div",{id:e.id,class:F([$(o).b(),e.customClass,$(h)]),style:ye($(g)),role:"alert",onMouseenter:b,onMouseleave:w,onClick:t[0]||(t[0]=(...t)=>e.onClick&&e.onClick(...t))},[$(f)?(a(),fe($(dt),{key:0,class:F([$(o).e("icon"),$(p)])},{default:ve((()=>[(a(),fe(de($(f))))])),_:1},8,["class"])):P("v-if",!0),c("div",{class:F($(o).e("group"))},[c("h2",{class:F($(o).e("title")),textContent:_(e.title)},null,10,Hr),z(c("div",{class:F($(o).e("content")),style:ye(e.title?void 0:{margin:0})},[K(e.$slots,"default",{},(()=>[e.dangerouslyUseHTMLString?(a(),m(R,{key:1},[P(" Caution here, message could've been compromised, never use user's input as message "),c("p",{innerHTML:e.message},null,8,Yr)],2112)):(a(),m("p",Gr,_(e.message),1))]))],6),[[ie,e.message]]),e.showClose?(a(),fe($(dt),{key:0,class:F($(o).e("closeBtn")),onClick:X(k,["stop"])},{default:ve((()=>[Z($(l))])),_:1},8,["class","onClick"])):P("v-if",!0)],2)],46,zr),[[ie,u.value]])])),_:3},8,["name","onBeforeLeave"]))}}),[["__file","/home/runner/work/element-plus/element-plus/packages/components/notification/src/notification.vue"]]),H(),qr={"top-left":[],"top-right":[],"bottom-left":[],"bottom-right":[]},Jr=16,Kr=1,Zr=function(e={},t=null){if(!Ye)return{close:()=>{}};("string"==typeof e||l(e))&&(e={message:e});const n=e.position||"top-right";let o=e.offset||0;qr[n].forEach((({vm:e})=>{var t;o+=((null==(t=e.el)?void 0:t.offsetHeight)||0)+Jr})),o+=Jr;const a="notification_"+Kr++,i=e.onClose,r={...e,offset:o,id:a,onClose:()=>{!function(e,t,n){const o=qr[t],a=o.findIndex((({vm:t})=>{var n;return(null==(n=t.component)?void 0:n.props.id)===e}));if(-1===a)return;const{vm:i}=o[a];if(!i)return;n?.(i);const r=i.el.offsetHeight,s=t.split("-")[0];o.splice(a,1);const l=o.length;if(!(l<1))for(let u=a;u<l;u++){const{el:e,component:t}=o[u].vm,n=Number.parseInt(e.style[s],10)-r-Jr;t.props.offset=n}}(a,n,i)}};let s=document.body;lt(e.appendTo)?s=e.appendTo:re(e.appendTo)&&(s=document.querySelector(e.appendTo)),lt(s)||(pt("ElNotification","the appendTo option is not an HTMLElement. Falling back to document.body."),s=document.body);const u=document.createElement("div"),c=Z(Xr,r,l(r.message)?{default:()=>r.message}:null);return c.appContext=null!=t?t:Zr._context,c.props.onDestroy=()=>{oe(null,u)},oe(c,u),qr[n].push({vm:c}),s.appendChild(u.firstElementChild),{close:()=>{c.component.exposed.visible.value=!1}}},Fr.forEach((e=>{Zr[e]=(t={})=>(("string"==typeof t||l(t))&&(t={message:t}),Zr({...t,type:e}))})),Zr.closeAll=xh,Zr._context=null,Qr=Qe(Zr,"$notify"),es=n(wt(),1),ts=e=>"string"==typeof e?Ih(e):e,e("Es",(e=>e.charAt(0).toUpperCase()+e.slice(1))),e("Ds",(async()=>await new Promise((e=>{setTimeout((()=>{e(document.getElementById("banners")?.clientHeight??0)}),0)})))),e("go",os="deleteUser"),e("No",as="inviteUser"),e("Qo",is="personalization"),rs="workArea",e("ho",ss="companyType"),e("Ss","saas"),e("Oo","ecommerce"),e("ko","education"),e("Do","digital-agency"),e("ws","systems-integrator"),e("Yo","other"),e("$o","personal"),e("co","companyIndustryExtended"),e("Jo","otherCompanyIndustryExtended"),e("es","physical-retail-or-services"),e("ts","real-estate-or-construction"),e("jo","government"),e("Fo","legal-industry"),e("Go","marketing-industry"),e("Ko","media-industry"),e("Io","manufacturing-industry"),e("Mo","healthcare"),e("Ao","finance-insurance-industry"),e("Po","it-industry"),e("Cs","security-industry"),e("Ts","telecoms"),e("Xo","other"),e("po",ls="companySize"),e("do","20-99"),e("uo","100-499"),e("fo","500-999"),e("lo","1000+"),e("mo","personalUser"),e("Vo","automationGoalSm"),e("Ho","lead-generation"),e("zo","customer-communication"),e("Lo","actions"),e("Ro","ad-campaign"),e("Wo","reporting"),e("Bo","data-syncing"),e("Uo","other"),e("Zo","automationGoalSmOther"),us="codingSkill",e("io","automationBeneficiary"),e("so","myself"),e("ao","my-team"),e("oo","other-teams"),e("as","reportedSource"),e("cs","reportedSourceOther"),e("is","google"),e("us","twitter"),e("os","linkedin"),e("ds","youtube"),e("rs","friend"),e("ls","podcast"),e("ns","event"),e("ss","other"),cs="automationGoal",e("bo","automationGoalDevops"),e("xo","automationGoalDevopsOther"),e("So","other"),e("_o","ci-cd"),e("vo","cloud-infrastructure-orchestration"),e("yo","data-syncing"),e("Co","incident-response"),e("wo","monitoring-alerting"),e("To","reporting"),e("Eo","ticketing-systems-integrations"),ds="customer-integrations",ps="customer-support",fs="finance-accounting",ms="product",hs="sales-marketing",ys="security",e("qo","other"),e("_s","role"),e("ys","roleOther"),e("fs","business-owner"),e("ps","customer-support"),e("ms","data-science"),e("hs","devops"),e("gs","engineering"),e("bs","sales-and-marketing"),e("xs","security"),e("vs","other"),e("ro",vs="tagsManager"),e("no",gs="annotationTagsManager"),e("to",ws="debugPaywall"),e("eo","communityPlusEnrollment"),e("$a","https://docs.n8n.io/hosting/community-edition-features/#registered-community-edition"),e("Qa",bs="variableModal"),e("Xa",ks="editCredential"),e("Za",xs="selectCredential"),e("Ja",Is=["[","]","^","\\","/",":","*","?",'"',"<",">","|"]),e("Ka",new RegExp(`[${Is.map((e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"))).join("")}]`)),e("qa",/^\.+$/),e("Wa",Ns="deleteFolder"),e("Ya",Ss="moveFolder"),e("Ga",{OPEN:"open",CREATE:"create",CREATE_WORKFLOW:"create_workflow",RENAME:"rename",MOVE:"move",CHOWN:"change_owner",TAGS:"manage_tags",DELETE:"delete"}),e("Ua",Ts="sourceControlPush"),e("Va",Es="sourceControlPull"),e("Ha",As="sourceControlPullResult"),e("Ba",Cs="projectMoveResourceModal"),e("La",_s="communityPackageInstall"),e("Ia",Ps="communityPackageManageConfirm"),e("Pa",`https://${So}/integrations/community-nodes/installation/gui-install/`),e("Fa",`https://${So}/integrations/community-nodes/risks/`),e("za","https://www.npmjs.com/search?q=keywords%3An8n-community-node-package"),e("Ra",Ds={UNINSTALL:"uninstall",UPDATE:"update",VIEW_DOCS:"view-documentation"}),e("Na","createOrEditApiKey"),e("Oa",Os=(e,t)=>(Array.isArray(e)?e:Object.entries(e)).some((e=>Ch(e)?Os(e,t):e?.toString().toLowerCase().includes(t.toLowerCase())))),Ms=e=>{if(null==e)return 0;if("object"==typeof e&&0===Object.keys(e).length||Array.isArray(e)&&0===e.length)return Number((2/1024).toFixed(2));try{const t=JSON.stringify(e),n=(new TextEncoder).encode(t).length/1024;return Number(n.toFixed(2))}catch(t){throw new Error(`Failed to calculate object size: ${t instanceof Error?t.message:"Unknown error"}`)}},Ls=n(ar(),1),js=["","k","M","G","T","P","E"],$s=(e,{[e]:t,...n})=>n,e("ya",Bs=e=>!e&&0!==e||(Array.isArray(e)?!e.length||e.every(Bs):"object"==typeof e&&(!Object.keys(e).length||Object.values(e).every(Bs)))),e("ma",(e=>{const t="*___~#^#~___*";let n=e.match(/\[(.*?)]/g)??[];n=n.map((e=>e.slice(1,-1))).map((e=>e.startsWith('"')&&e.endsWith('"')?e.slice(1,-1):e));const o=e.replace(/\[(.*?)]/g,t).split("."),a=[];return o.forEach((e=>{let o=e.indexOf(t);for(;-1!==o;)0===o?(a.push(n.shift()??""),e=e.substr(13)):(a.push(e.substr(0,o)),e=e.substr(o)),o=e.indexOf(t);""!==e&&a.push(e)})),'["'+a.join('"]["')+'"]'})),e("pa",(e=>{const t="string"==typeof e?En(e):e;return Array.isArray(t)?t.map((e=>Ph(e)?e.json:e)):t})),e("Ea",Vs=e=>isNaN(+e)?e:+e),Rs={"data-test-id":"sanitized-error-message"},Fs=["data-action-parameter-node"],Ws=x({__name:"NodeExecutionErrorMessage",props:{nodeName:{},errorMessage:{}},setup(e){const t=Ie();return(n,o)=>{const i=ae("n8n-html");return a(),m("div",null,[z(c("span",Rs,null,512),[[i,e.errorMessage]]),o[0]||(o[0]=c("br",null,null,-1)),c("a",{"data-action":"openNodeDetail","data-action-parameter-node":e.nodeName},_($(t).baseText("node.executionError.openNode")),9,Fs)])}}}),Us=Ws,({parse:zs,stringify:Hs}=JSON),({keys:Gs}=Object),Ys=String,Xs={},qs="object",Js=(e,t)=>t,Ks=e=>e instanceof Ys?Ys(e):e,Zs=(e,t)=>"string"==typeof t?new Ys(t):t,Qs=(e,t,n,o)=>a=>{for(let i=Gs(a),{length:r}=i,s=0;s<r;s++){const r=i[s],l=a[r];if(l instanceof Ys){const i=e[+l];typeof i!==qs||n.has(i)?a[r]=o.call(a,r,i):(n.add(i),a[r]=Xs,t.push({o:a,k:r,r:i}))}else a[r]!==Xs&&(a[r]=o.call(a,r,l))}return a},e("da",el=(e,t)=>{const n=zs(e,Zs).map(Ks),o=t||Js;let a=n[0];if(typeof a===qs&&a){const e=[],t=Qs(n,e,new Set,o);a=t(a);let i=0;for(;i<e.length;){const{o:n,k:a,r:r}=e[i++];n[a]=o.call(n,a,t(r))}}return o.call({"":a},"",a)}),tl={ADD:"add",UPDATE:"update",DELETE:"delete"},nl={executionOrder:"v1",binaryMode:Jo},ol=o(((e,t)=>{var n=_a(),o=Fa(),a=Nt();t.exports=function(e){return function(t,i,r){var s=Object(t);if(!o(t)){var l=n(i,3);t=a(t),i=function(e){return l(s[e],e,s)}}var u=e(t,i,r);return u>-1?s[l?t[u]:u]:void 0}}})),al=o(((e,t)=>{var n=ir(),o=1/0;t.exports=function(e){return e?(e=n(e))===o||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}})),e("sa",il=o(((e,t)=>{var n=al();t.exports=function(e){var t=n(e),o=t%1;return t==t?o?t-o:t:0}}))),rl=o(((e,t)=>{var n=rn(),o=_a(),a=il(),i=Math.max,r=Math.min;t.exports=function(e,t,s){var l=null==e?0:e.length;if(!l)return-1;var u=l-1;return void 0!==s&&(u=a(s),u=s<0?i(l+u,0):r(u,l-1)),n(e,o(t,3),u,!0)}})),sl=o(((e,t)=>{var n=ol()(rl());t.exports=n})),ll=n(ra(),1),ul=n(hn(),1),cl=n(sl(),1),dl=["API","OAuth1","OAuth2"],pl=["Trigger"],fl=/value\["(.+?)"\]/s,e("Pi",ml=e=>e.reduce(((e,t)=>(Ph(t)&&e.push(t.json),e)),[])),e("Yi",(e=>void 0!==e.modes&&1===e.modes.length&&"list"===e.modes[0].name)),e("Qi",((e,t)=>{if(!t.displayOptions?.show)return!0;const n=hl(e);return!!n&&n.name in t.displayOptions.show})),e("Hi",hl=e=>{if(!e)return null;const t=wl(e),n=t.find((e=>"authentication"===e.name&&!e.options?.find((e=>"value"in e&&"none"===e.value))))??null??yl(e,t),o=!!n&&kl(e,n);return n&&o?n:null}),yl=(e,t)=>{const n={};return e.credentials?.forEach((e=>{if(e.displayOptions?.show)for(const t in e.displayOptions.show)n[t]=(n[t]||[]).concat((e.displayOptions.show[t]??[]).map((e=>e?e.toString():"")))})),t.find((e=>{let t=!0;return e.options?.forEach((o=>{"value"in o&&"string"==typeof o.value&&!n[e.name].includes(o.value)&&(t=!1)})),t}))||null},e("Wi",vl=(e,t)=>{if(!e)return[];const n=Se.baseText("credentialEdit.credentialConfig.recommendedAuthTypeSuffix");let o=[];const a=hl(e);return wl(e,t).filter((e=>e.name===a?.name)).forEach((t=>{t.options&&(o=o.concat(t.options.map((o=>{const a="value"in o?`${o.value}`:"";let i=!1;const r=gl(e,a);return r&&(i=void 0!==Gf().getCredentialTypeByName(r.name)?.__overwrittenProperties),{name:i&&!o.name.endsWith(n)?`${o.name} ${n}`:o.name,value:a,displayOptions:t.displayOptions}}))||[]))})),o.forEach(((e,t)=>{e.name.includes(n)&&(o.splice(t,1),o.unshift(e))})),o}),e("Ri",((e,t)=>e?e.credentials?.filter((e=>e.displayOptions?.show&&t in(e.displayOptions.show||{})))??[]:[])),e("Gi",gl=(e,t)=>{const n=hl(e),o=n?n.name:"";return e.credentials?.find((e=>e.displayOptions?.show?.[o]?.includes(t)))||null}),e("Vi",((e,t)=>{if(e&&t){const n=hl(e),o=n?n.name:"";return vl(e).find((e=>t.displayOptions?.show?.[o]?.includes(e.value)))||null}return null})),e("Xi",((e,t)=>{let n=!1;return e.forEach((e=>{e.displayOptions?.show&&t.name in e.displayOptions.show&&(n=!0)})),n})),e("Ui",wl=(e,t)=>{const n=[];return e?.credentials&&e.credentials.length>0&&e.credentials.forEach((o=>{o.displayOptions?.show&&Object.keys(o.displayOptions.show).forEach((o=>{const a=e.properties.filter((e=>e.name===o));a&&a.forEach((e=>{!n.includes(e)&&bl(e,t)&&n.push(e)}))}))})),n}),bl=(e,t)=>!t||!e.displayOptions?.show?.["@version"]||e.displayOptions.show["@version"]?.includes(t),e("na",((e,t,n)=>{if(!t||!e)return;const o=Jm().getNodeType(t.type,t.typeVersion);if(o){const a=hl(o);if(a){const o={name:t.name,properties:{parameters:{...t.parameters,[a.name]:n}}};Qh(Kh(e)).updateNodeProperties(o)}}})),kl=(e,t)=>!t.displayOptions?.show||(Object.keys(t.displayOptions.show).forEach((t=>{const n=e.properties.find((e=>{e.name}));return!(n&&!kl(e,n))})),!0),e("ta",xl=e=>{const t=e.match(fl);return t?t.pop():e}),e("Fi",((e,t,n="",o=[])=>{const a="id"in e?e.id:e.name;return"add"===n&&!0===e.required||Il(a,o,t)})),e("$i",((e,t)=>{if(e.length!==t.length)return!0;const n=new Map(t.map((e=>[e.id,e])));for(const o of e){const e=n.get(o.id);if(!e)return!0;if(o.displayName!==e.displayName||o.required!==e.required||o.defaultMatch!==e.defaultMatch||o.display!==e.display||o.canBeUsedToMatch!==e.canBeUsedToMatch||o.type!==e.type)return!0}return!1})),e("Zi",Il=(e,t,n)=>{const o=xl(e);return!!o&&n&&(t||[]).includes(o)}),e("Ki",((e,t="light")=>e?"string"==typeof e?e:e[t]:null)),e("Ti",Nl=async(e,t,n,o,a)=>await Ja(e,"GET",t?`/projects/${t}/data-tables`:"/data-tables-global",{...n,filter:o??void 0,sortBy:a})),e("yi",(async(e,t,n,o,a,i=!0)=>await Ja(e,"POST",`/projects/${n}/data-tables`,{name:t,columns:o??[],hasHeaders:i,...a?{fileId:a}:{}}))),e("bi",(async(e,t,n)=>await Ja(e,"DELETE",`/projects/${n}/data-tables/${t}`,{dataTableId:t,projectId:n}))),e("ji",(async(e,t,n,o)=>await Ja(e,"PATCH",`/projects/${o}/data-tables/${t}`,{name:n}))),e("vi",(async(e,t,n,o)=>await Ja(e,"POST",`/projects/${n}/data-tables/${t}/columns`,{...o}))),e("xi",(async(e,t,n,o)=>await Ja(e,"DELETE",`/projects/${n}/data-tables/${t}/columns/${o}`))),e("ki",(async(e,t,n,o,a)=>await Ja(e,"PATCH",`/projects/${n}/data-tables/${t}/columns/${o}/move`,{targetIndex:a}))),e("Ai",(async(e,t,n,o,a)=>await Ja(e,"PATCH",`/projects/${n}/data-tables/${t}/columns/${o}/rename`,{name:a}))),e("Ei",(async(e,t,n,o)=>await Ja(e,"GET",`/projects/${n}/data-tables/${t}/rows`,{...o??{}}))),e("Oi",(async(e,t,n,o)=>await Ja(e,"POST",`/projects/${o}/data-tables/${t}/insert`,{returnType:"all",data:[n]}))),e("Mi",(async(e,t,n,o,a)=>await Ja(e,"PATCH",`/projects/${a}/data-tables/${t}/rows`,{filter:{type:"and",filters:[{columnName:"id",condition:"eq",value:n}]},data:o}))),e("Si",(async(e,t,n,o)=>{const a=n.map((e=>({columnName:"id",condition:"eq",value:e})));return await Ja(e,"DELETE",`/projects/${o}/data-tables/${t}/rows`,{filter:{type:"or",filters:a}})})),e("wi",(async e=>await Ja(e,"GET","/data-tables-global/limits"))),e("Ci",(async(e,t,n,o=!0)=>{const a=await Ja(e,"GET",`/projects/${n}/data-tables/${t}/download-csv`,{includeSystemColumns:o}),i=`${a.dataTableName}.csv`;return{csvContent:a.csvContent,filename:i}})),e("Di",(async(e,t,n,o)=>await Ja(e,"POST",`/projects/${n}/data-tables/${t}/import-csv`,{fileId:o}))),e("Ni",(async(e,t,n=!0)=>{const o=new FormData;return o.append("file",t),o.append("hasHeaders",String(n)),await Ja(e,"POST","/data-tables/uploads",o)})),Sl=async e=>await Ja(e,"GET","/projects"),Tl=async(e,t)=>await ti(e,"GET","/projects",t),El=async e=>await Ja(e,"GET","/projects/my-projects"),Al=async e=>await Ja(e,"GET","/projects/personal"),Cl=async(e,t)=>await Ja(e,"GET",`/projects/${t}`),_l=async(e,t)=>await Ja(e,"POST","/projects",t),Pl=async(e,t,n)=>{await Ja(e,"PATCH",`/projects/${t}`,n)},Dl=async(e,t,n)=>{await Ja(e,"DELETE",`/projects/${t}`,n?{transferId:n}:{})},Ol=async e=>await Ja(e,"GET","/projects/count"),Ml=async(e,t,n)=>{await Ja(e,"POST",`/projects/${t}/users`,{relations:n})},Ll=async(e,t,n,o)=>{await Ja(e,"PATCH",`/projects/${t}/users/${n}`,{role:o})},jl=async(e,t,n)=>{await Ja(e,"DELETE",`/projects/${t}/users/${n}`)},e("gi",$l={Personal:"personal",Team:"team",Public:"public"}),e("hi",Bl=e=>{const t=gh().currentUser;if(t&&e){const n=t.isDefaultUser?Vn.Default:t.role;return e.includes(n)}return!1}),e("mi",Vl=Xa(ai.RBAC,(()=>{const e=v([]),t=v({}),n=v([]),o=v({}),a=v({aiAssistant:{},workflow:{},tag:{},annotationTag:{},user:{},credential:{},variable:{},projectVariable:{},sourceControl:{},externalSecretsProvider:{},externalSecret:{},project:{},orchestration:{},workersView:{},eventBusDestination:{},auditLogs:{},banner:{},community:{},communityPackage:{},ldap:{},license:{},logStreaming:{},saml:{},oidc:{},provisioning:{},securityAudit:{},folder:{},insights:{},dataTable:{},execution:{},workflowTags:{},role:{},mcp:{},mcpApiKey:{},chatHub:{},chatHubAgent:{},breakingChanges:{},apiKey:{},credentialResolver:{},instanceAi:{},securitySettings:{},roleMappingRule:{}});return{globalRoles:e,rolesByProjectId:t,globalScopes:n,scopesByProjectId:o,scopesByResourceId:a,addGlobalRole:function(t){e.value.includes(t)||e.value.push(t)},hasRole:function(t){return e.value.includes(t)},addGlobalScope:function(e){n.value.includes(e)||n.value.push(e)},setGlobalScopes:function(e){n.value=e},addProjectScope:function(e,t){o.value[t.projectId]||(o.value[t.projectId]=[]),o.value[t.projectId].includes(e)||o.value[t.projectId].push(e)},addResourceScope:function(e,t){const n=a.value[t.resourceType];n[t.resourceId]||(n[t.resourceId]=[]),n[t.resourceId].includes(e)||n[t.resourceId].push(e)},hasScope:function(e,t,i){return Bn(e,{global:n.value,project:t?.projectId?o.value[t.projectId]:[],resource:t?.resourceType&&t?.resourceId?a.value[t.resourceType][t.resourceId]:[]},void 0,i)}}}))),e("pi",Rl=e=>{if(!e?.scope)return!0;const{projectId:t,resourceType:n,resourceId:o,scope:a,options:i}=e;return Vl().hasScope(a,{projectId:t,resourceType:n,resourceId:o},i)}),e("di",Fl=e=>!!e?.bypass?.()||!!gh().currentUser),e("fi",(()=>{const e=gh().currentUser?.mfaAuthenticated??!1,t=qi().isMFAEnforced;return!e&&t})),e("ui",Wl=()=>{const e=gh().currentUser;return!!e&&e.isDefaultUser}),Ul=()=>gh().isInstanceOwner,e("li",zl=e=>{if(!e?.feature)return!0;const t=Array.isArray(e.feature)?e.feature:[e.feature],n=qi();return"allOf"===(e.mode??"allOf")?t.every((e=>n.isEnterpriseFeatureEnabled[e])):t.some((e=>n.isEnterpriseFeatureEnabled[e]))}),e("ci",Hl=()=>!gh().currentUser),Gl={authenticated:Fl,custom:e=>!!e&&e(),defaultUser:Wl,instanceOwner:Ul,enterprise:zl,guest:Hl,rbac:Rl,role:Bl},Yl="/source-control",ql=async(e,t)=>await Ja(e,"POST",`${Yl}/push-workfolder`,t),Jl=async(e,t)=>await Ja(e,"POST",`${Yl}/pull-workfolder`,t),Kl=async e=>await Ja(e,"GET",`${Yl}/get-branches`),Zl=(Xl=e=>async(t,n)=>await Ja(t,e,`${Yl}/preferences`,n))("POST"),Ql=Xl("PATCH"),eu=async e=>await Ja(e,"GET",`${Yl}/preferences`),tu=async e=>await Ja(e,"GET",`${Yl}/status`),nu=async(e,t)=>await Ja(e,"GET",`${Yl}/remote-content/workflow/${t}`),ou=async(e,t={direction:"push",preferLocalVersion:!0,verbose:!1})=>await Ja(e,"GET",`${Yl}/get-status`,t),au=async(e,t)=>await Ja(e,"POST",`${Yl}/disconnect`,{keepKeyPair:t}),iu=async(e,t)=>await Ja(e,"POST",`${Yl}/generate-key-pair`,{keyGeneratorType:t}),e("oi",ru=Xa("sourceControl",(()=>{const e=ni(),t=qi(),n=C((()=>t.isEnterpriseFeatureEnabled[Nn.SourceControl])),o=I(["ed25519","rsa"].map((e=>({value:e,label:e.toUpperCase()})))),a=I({branchName:"",branches:[],repositoryUrl:"",branchReadOnly:!1,branchColor:"#5296D6",connected:!1,publicKey:"",keyGeneratorType:"ed25519",connectionType:"ssh"}),i=I({commitMessage:"commit message"}),r=e=>{Object.assign(a,e)},s=t=>async n=>{r(await t(e.restApiContext,n))},l=s(Zl),u=s(Ql);return{isEnterpriseSourceControlEnabled:n,state:i,preferences:a,pushWorkfolder:async t=>(i.commitMessage=t.commitMessage,await ql(e.restApiContext,{force:t.force,commitMessage:t.commitMessage,fileNames:t.fileNames})),pullWorkfolder:async(t,n)=>await Jl(e.restApiContext,{force:t,autoPublish:n}),getPreferences:async()=>{r(await eu(e.restApiContext))},setPreferences:r,generateKeyPair:async t=>{await iu(e.restApiContext,t);const n=await eu(e.restApiContext);return a.publicKey=n.publicKey,{publicKey:n.publicKey}},getBranches:async()=>{r(await Kl(e.restApiContext))},savePreferences:l,updatePreferences:u,disconnect:async t=>{await au(e.restApiContext,t),r({connected:!1,branches:[]})},getStatus:async()=>await tu(e.restApiContext),getAggregatedStatus:async t=>await ou(e.restApiContext,t),getRemoteWorkflow:async t=>await nu(e.restApiContext,t),sshKeyTypesWithLabel:o}}))),e("ai",su=Xa(ai.PROJECTS,(()=>{const e=He(),t=ni(),n=qi(),o=Gf(),a=gh(),i=ru(),r=v([]),s=v([]),l=v(null),u=v(null),c=v({personal:0,team:0,public:0}),d=v(null),p=C((()=>At(a.currentUser?.globalScopes).project)),f=C((()=>p.value.list?r.value:s.value)),m=C((()=>e.params?.projectId??e.query?.projectId??u.value?.id)),h=C((()=>e.path.includes("home"))),y=C((()=>r.value.filter((e=>e.type===$l.Personal)))),g=C((()=>r.value.filter((e=>e.type===$l.Team)))),w=C((()=>n.settings.enterprise.projects.team.limit)),b=C((()=>0!==w.value)),k=C((()=>-1===w.value)),x=C((()=>c.value.team>=w.value)),I=C((()=>(k.value||b.value&&!x.value)&&!i.preferences.branchReadOnly)),N=C((()=>ty(["rbac"],{rbac:{scope:"project:create"}}))),S=C((()=>!n.isChatFeatureEnabled||!Bl(["global:chatUser"]))),T=C({get:()=>e?.params?.projectId??d.value,set:e=>{d.value=e}}),E=e=>{u.value=e},A=async()=>{r.value=await Sl(t.restApiContext)},_=async()=>{s.value=await El(t.restApiContext)},P=async e=>await Cl(t.restApiContext,e),D=async e=>{u.value=await P(e)};async function O(e){e&&u.value?.id!==e&&E(await P(e))}const M=async()=>{c.value=await Ol(t.restApiContext)};return Y(e,(async e=>{T.value=null,e?.path?.includes("home")&&(T.value="home",E(null)),e?.path?.includes("shared")&&(T.value="shared",E(null)),e?.path?.includes("workflow/")&&(m.value?T.value=m.value:T.value="home"),e?.params?.projectId&&await D(e.params.projectId)}),{immediate:!0}),{projects:r,availableProjects:f,myProjects:s,personalProject:l,currentProject:u,currentProjectId:m,isProjectHome:h,personalProjects:y,teamProjects:g,teamProjectsLimit:w,hasUnlimitedProjects:k,canCreateProjects:I,canViewProjects:S,hasPermissionToCreateProjects:N,isTeamProjectFeatureEnabled:b,globalProjectPermissions:p,projectNavActiveId:T,setCurrentProject:E,searchProjects:async e=>await Tl(t.restApiContext,e),getAllProjects:A,getMyProjects:_,getPersonalProject:async()=>{l.value=await Al(t.restApiContext)},getAvailableProjects:async()=>{p.value.list?await A():await _()},getProject:D,fetchProject:P,fetchAndSetProject:O,refreshCurrentProject:async function(){m.value&&u.value?.id!==m.value&&await O(m.value)},createProject:async e=>{const n=await _l(t.restApiContext,e);return await M(),s.value=[...s.value,n],n},updateProject:async(e,n)=>{const{name:o,icon:a,description:i}=n,r={};void 0!==o&&(r.name=o),void 0!==a&&(r.icon=a),void 0!==i&&(r.description=i),await Pl(t.restApiContext,e,r);const l=s.value.findIndex((t=>t.id===e)),{name:c,icon:d,description:p}={name:o,icon:a,description:i};-1!==l&&(void 0!==c&&(s.value[l].name=c),void 0!==d&&(s.value[l].icon=d),void 0!==p&&(s.value[l].description=p)),u.value&&(void 0!==c&&(u.value.name=c),void 0!==d&&(u.value.icon=d),void 0!==p&&(u.value.description=p))},addMember:async(e,{userId:n,role:o})=>{await Ml(t.restApiContext,e,[{userId:n,role:o}]),await D(e)},updateMemberRole:async(e,n,o)=>{await Ll(t.restApiContext,e,n,o),await D(e)},removeMember:async(e,n)=>{await jl(t.restApiContext,e,n),await D(e)},deleteProject:async(e,n)=>{await Dl(t.restApiContext,e,n),await M(),s.value=s.value.filter((t=>t.id!==e))},getProjectsCount:M,setProjectNavActiveIdByWorkflowHomeProject:async(e,t)=>l.value?.id!==e?.id&&e?.type===$l.Personal&&t?.some((e=>e.id===l.value?.id))?(T.value="shared",void E(null)):e?.type===$l.Personal?l.value?.id===e?.id?(T.value=e?.id??null,void(u.value=l.value)):void(T.value="home"):(T.value=e?.id??null,void(e?.id&&!m.value&&await D(e?.id))),moveResourceToProject:async(e,n,a,i,r)=>{"workflow"===e?await async function(e,t,n){return await Ja(e,"PUT",`/workflows/${t}/transfer`,n)}(t.restApiContext,n,{destinationProjectId:a,destinationParentFolderId:i,shareCredentials:r}):(await async function(e,t,n){return await Ja(e,"PUT",`/credentials/${t}/transfer`,{destinationProjectId:n})}(t.restApiContext,n,a),await o.fetchAllCredentials({projectId:m.value}))},getResourceCounts:async e=>{const[n,o,a]=await Promise.all([jh(t.restApiContext,{filter:{projectId:e}}),Eh(t.restApiContext,{projectId:e}),Nl(t.restApiContext,e)]);return{credentials:n.length,workflows:o.count,dataTables:a.count}},getProjectSecretProviders:async e=>await ci(t.restApiContext,e)}}))),e("ni",lu=(e="")=>{const[,t,n]=e.match(/^(.*?)(?:\s*<([^>]+)>)?$/)??[];return{name:t.trim()||void 0,email:n}}),e("ti",(e=>{const{name:t,email:n}=lu(e??"");return Oe(t??n??"",25)})),e("ei",function(e){return e.Credential="credential",e.Workflow="workflow",e.DataTable="dataTable",e}({})),uu=function(e){return e.MOVE_NODE="moveNode",e.ADD_NODE="addNode",e.REMOVE_NODE="removeNode",e.ADD_CONNECTION="addConnection",e.REMOVE_CONNECTION="removeConnection",e.ENABLE_NODE_TOGGLE="enableNodeToggle",e.RENAME_NODE="renameNode",e.REPLACE_NODE_PARAMETERS="replaceNodeParameters",e}({}),e("$r",cu=ht()),du=class{},e("Kr",pu=class extends du{name;timestamp;constructor(e,t){super(),this.name=e,this.timestamp=t}getTimestamp(){return this.timestamp}}),e("Gr",fu=class extends du{commands;constructor(e){super(),this.commands=e}getTimestamp(){return Math.max(0,...this.commands.map((e=>e.timestamp)))}}),e("Jr",class e extends pu{nodeName;oldPosition;newPosition;constructor(e,t,n,o){super(uu.MOVE_NODE,o),this.nodeName=e,this.newPosition=n,this.oldPosition=t}getReverseCommand(t){return new e(this.nodeName,this.newPosition,this.oldPosition,t)}isEqualTo(t){return t instanceof e&&t.nodeName===this.nodeName&&t.oldPosition[0]===this.oldPosition[0]&&t.oldPosition[1]===this.oldPosition[1]&&t.newPosition[0]===this.newPosition[0]&&t.newPosition[1]===this.newPosition[1]}async revert(){return await new Promise((e=>{cu.emit("nodeMove",{nodeName:this.nodeName,position:this.oldPosition}),e()}))}}),e("Wr",mu=class e extends pu{node;constructor(e,t){super(uu.ADD_NODE,t),this.node=e}getReverseCommand(e){return new hu(this.node,e)}isEqualTo(t){return t instanceof e&&t.node.name===this.node.name}async revert(){return await new Promise((e=>{cu.emit("revertAddNode",{node:this.node}),e()}))}}),e("Xr",hu=class extends pu{node;constructor(e,t){super(uu.REMOVE_NODE,t),this.node=e}getReverseCommand(e){return new mu(this.node,e)}isEqualTo(e){return e instanceof mu&&e.node.name===this.node.name}async revert(){return await new Promise((e=>{cu.emit("revertRemoveNode",{node:this.node}),e()}))}}),e("Ur",yu=class e extends pu{connectionData;constructor(e,t){super(uu.ADD_CONNECTION,t),this.connectionData=e}getReverseCommand(e){return new vu(this.connectionData,e)}isEqualTo(t){return t instanceof e&&t.connectionData[0].node===this.connectionData[0].node&&t.connectionData[1].node===this.connectionData[1].node&&t.connectionData[0].index===this.connectionData[0].index&&t.connectionData[1].index===this.connectionData[1].index}async revert(){return await new Promise((e=>{cu.emit("revertAddConnection",{connection:this.connectionData}),e()}))}}),e("Yr",vu=class e extends pu{connectionData;constructor(e,t){super(uu.REMOVE_CONNECTION,t),this.connectionData=e}getReverseCommand(e){return new yu(this.connectionData,e)}isEqualTo(t){return t instanceof e&&t.connectionData[0].node===this.connectionData[0].node&&t.connectionData[1].node===this.connectionData[1].node&&t.connectionData[0].index===this.connectionData[0].index&&t.connectionData[1].index===this.connectionData[1].index}async revert(){return await new Promise((e=>{setTimeout((()=>{cu.emit("revertRemoveConnection",{connection:this.connectionData}),e()}),10)}))}}),e("qr",gu=class e extends pu{nodeName;oldState;newState;constructor(e,t,n,o){super(uu.ENABLE_NODE_TOGGLE,o),this.nodeName=e,this.newState=n,this.oldState=t}getReverseCommand(t){return new e(this.nodeName,this.newState,this.oldState,t)}isEqualTo(t){return t instanceof e&&t.nodeName===this.nodeName}async revert(){return await new Promise((e=>{cu.emit("enableNodeToggle",{nodeName:this.nodeName,isDisabled:this.oldState}),e()}))}}),e("Zr",class e extends pu{currentName;newName;constructor(e,t,n){super(uu.RENAME_NODE,n),this.currentName=e,this.newName=t}getReverseCommand(t){return new e(this.newName,this.currentName,t)}isEqualTo(t){return t instanceof e&&t.currentName===this.currentName&&t.newName===this.newName}async revert(){return await new Promise((e=>{cu.emit("revertRenameNode",{currentName:this.currentName,newName:this.newName}),e()}))}}),e("Qr",class e extends pu{constructor(e,t,n,o){super(uu.REPLACE_NODE_PARAMETERS,o),this.nodeId=e,this.currentParameters=t,this.newParameters=n}getReverseCommand(t){return new e(this.nodeId,this.newParameters,this.currentParameters,t)}isEqualTo(t){return t instanceof e&&t.nodeId===this.nodeId&&t.currentParameters===this.currentParameters&&t.newParameters===this.newParameters}async revert(){return await new Promise((e=>{cu.emit("revertReplaceNodeParameters",{nodeId:this.nodeId,currentProperties:this.currentParameters,newProperties:this.newParameters}),e()}))}}),e("Hr",wu=Xa(ai.HISTORY,{state:()=>({undoStack:[],redoStack:[],currentBulkAction:null,bulkInProgress:!1}),actions:{popUndoableToUndo(){if(this.undoStack.length>0)return this.undoStack.pop()},pushCommandToUndo(e,t=!0){this.bulkInProgress||(this.currentBulkAction?void 0===this.currentBulkAction.commands.find((t=>t.isEqualTo(e)))&&this.currentBulkAction.commands.push(e):this.undoStack.push(e),this.checkUndoStackLimit(),t&&this.clearRedoStack())},pushBulkCommandToUndo(e,t=!0){this.undoStack.push(e),this.checkUndoStackLimit(),t&&this.clearRedoStack()},checkUndoStackLimit(){this.undoStack.length>100&&this.undoStack.shift()},checkRedoStackLimit(){this.redoStack.length>100&&this.redoStack.shift()},clearUndoStack(){this.undoStack=[]},clearRedoStack(){this.redoStack=[]},reset(){this.clearRedoStack(),this.clearUndoStack()},popUndoableToRedo(){if(this.redoStack.length>0)return this.redoStack.pop()},pushUndoableToRedo(e){this.redoStack.push(e),this.checkRedoStackLimit()},startRecordingUndo(){this.currentBulkAction=new fu([])},stopRecordingUndo(){this.currentBulkAction&&this.currentBulkAction.commands.length>0&&(this.undoStack.push(this.currentBulkAction),this.checkUndoStackLimit()),this.currentBulkAction=null}}})),e("zr",bu=function(e){return e.Input="inputs",e.Output="outputs",e}({})),ku=[bu.Input,bu.Output],e("Vr",function(e){return e.Default="default",e.StickyNote="n8n-nodes-base.stickyNote",e.AddNodes="n8n-nodes-internal.addNodes",e.ChoicePrompt="n8n-nodes-internal.choicePrompt",e}({})),e("Br",{PARAMETERS_UPDATED:"parameters-updated",INCOMING_CONNECTIONS_UPDATED:"incoming-connections-updated",PINNED_DATA_UPDATED:"pinned-data-updated",UPSTREAM_DIRTY:"upstream-dirty"}),xu=e=>!!e&&Object.getPrototypeOf(e)===Object.prototype,e("br",(e=>xu(e)&&"mimeType"in e&&"data"in e)),e("Sr",(e=>"object"==typeof e&&null!==e&&"showAuthSelector"in e)),e("Dr",(e=>["string","number","boolean"].includes(typeof e))),e("Rr",(e=>!("resource"in e)||"folder"!==e.resource)),e("_r","N8N_NDV_PANEL_WIDTH"),Iu={relativeLeft:1,relativeRight:1,relativeWidth:1},e("gr",Nu=Xa(ai.NDV,(()=>{const e=ry("N8N_MAPPING_ONBOARDED"),t=ry("N8N_TABLE_HOVER_ONBOARDED"),n=ry("N8N_AUTOCOMPLETE_ONBOARDED"),o=v(null),a=v({unknown:{...Iu},regular:{...Iu},dragless:{...Iu},inputless:{...Iu},wide:{...Iu}}),i=v(""),r=v({nodeName:void 0,run:void 0,branch:void 0,data:{isEmpty:!0}}),s=Ae("N8N_NDV_INPUT_PANEL_DISPLAY_MODE","schema"),l=v({run:void 0,branch:void 0,data:{isEmpty:!0},editMode:{enabled:!1,value:""}}),u=Ae("N8N_NDV_OUTPUT_PANEL_DISPLAY_MODE","table"),c=v(""),d=v(""),p=v({}),f=v(null),m=v(0),h=v({isDragging:!1,type:"",data:"",dimensions:null,activeTarget:null}),y=v("true"===e.value),g=v("true"===t.value),w=v("true"===n.value),b=v(!1),k=v(),x=rh(),I=C((()=>x.workflowId?Qh(Kh(x.workflowId)):void 0)),N=C((()=>I.value?.getNodeByName(o.value||"")??null)),S=C((()=>{const e=x.getWorkflowExecution,t=r.value.nodeName,n=r.value.run??0,o=r.value.branch??0;return e&&t&&void 0!==n&&void 0!==o?e.data?.resultData?.runData?.[t]?.[n]?.data?.main?.[o]??[]:[]})),T=C((()=>r.value.nodeName)),E=C((()=>{const e=S.value;return T.value?I.value?.pinData?.[T.value]??e:e})),A=C((()=>E.value.length>0)),_=C((()=>h.value.isDragging)),P=C((()=>h.value.type)),D=C((()=>h.value.data)),O=C((()=>null!==h.value.activeTarget)),M=C((()=>l.value.editMode)),L=C((()=>h.value.activeTarget?.stickyPosition??null)),j=C((()=>{const e={},t=(I.value?.connectionsByDestinationNode[N.value?.name||""]??{}).main;if(!t||t.length<2)return e;for(const[n,o]of t.entries())for(const t of o??[])e[t.node]||(e[t.node]=[]),e[t.node].push(n+1);return e})),$=C((()=>r.value.run)),B=C((()=>r.value.branch)),V=C((()=>r.value.data.isEmpty)),R=C((()=>l.value.data.isEmpty)),F=C((()=>{const e=T.value;return!(!N.value||!e)&&x.workflowObject.getParentNodes(N.value.name,xo.Main,1).includes(e)})),W=C((()=>F.value?f.value:null)),U=C((()=>W.value?W.value:m.value&&T.value?{nodeName:T.value,runIndex:$.value??0,outputIndex:B.value??0,itemIndex:m.value}:null)),z=C((()=>null!==o.value)),H=()=>{g.value=!0,t.value="true"};return{activeNode:N,ndvInputData:S,ndvInputNodeName:T,ndvInputDataWithPinnedData:E,hasInputData:A,inputPanelDisplayMode:s,outputPanelDisplayMode:u,isDraggableDragging:_,draggableType:P,draggableData:D,canDraggableDrop:O,outputPanelEditMode:M,draggableStickyPos:L,ndvNodeInputNumber:j,ndvInputRunIndex:$,ndvInputBranchIndex:B,isInputParentOfActiveNode:F,getHoveringItem:W,expressionTargetItem:U,isNDVOpen:z,isInputPanelEmpty:V,isOutputPanelEmpty:R,focusedMappableInput:c,isMappingOnboarded:y,pushRef:i,activeNodeName:o,focusedInputPath:d,input:r,output:l,hoveringItem:f,highlightDraggables:b,mappingTelemetry:p,draggable:h,isAutocompleteOnboarded:w,expressionOutputItemIndex:m,isTableHoverOnboarded:g,mainPanelDimensions:a,lastSetActiveNodeSource:k,setActiveNodeName:(e,t)=>{o.value!==e&&(o.value=e,k.value=t)},unsetActiveNodeName:()=>{o.value=null,k.value=void 0},setInputNodeName:e=>{r.value.nodeName=e},setInputRunIndex:e=>{r.value.run=e},setOutputRunIndex:e=>{l.value.run=e},setMainPanelDimensions:e=>{a.value[e.panelType]={...a.value[e.panelType],...e.dimensions}},setNDVPushRef:()=>{i.value=`ndv-${Wt()}`},resetNDVPushRef:()=>{i.value=""},setPanelDisplayMode:e=>{"input"===e.pane?s.value=e.mode:u.value=e.mode},setOutputPanelEditModeEnabled:e=>{l.value.editMode.enabled=e},setOutputPanelEditModeValue:e=>{l.value.editMode.value=e},setMappableNDVInputFocus:e=>{c.value=e},draggableStartDragging:({type:e,data:t,dimensions:n})=>{h.value={isDragging:!0,type:e,data:t,dimensions:n,activeTarget:null}},draggableStopDragging:()=>{h.value={isDragging:!1,type:"",data:"",dimensions:null,activeTarget:null}},setDraggableTarget:e=>{h.value.activeTarget=e},setMappingTelemetry:e=>{p.value={...p.value,...e}},resetMappingTelemetry:()=>{p.value={}},setHoveringItem:e=>{e&&H(),f.value=e},setNDVBranchIndex:e=>{"input"===e.pane?r.value.branch=e.branchIndex:l.value.branch=e.branchIndex},setNDVPanelDataIsEmpty:e=>{"input"===e.panel?r.value.data.isEmpty=e.isEmpty:l.value.data.isEmpty=e.isEmpty},setMappingOnboarded:()=>{y.value=!0,e.value="true"},setTableHoverOnboarded:H,setAutocompleteOnboarded:()=>{w.value=!0,n.value="true"},setHighlightDraggables:e=>{b.value=e},updateNodeParameterIssues:e=>{const t=I.value?.getNodeByName(o.value||"");t?.id&&I.value?.updateNodeById(t.id,{issues:{...t.issues,...e}})},setFocusedInputPath:e=>{d.value=e}}}))),Su={IS_PART_OF_EXPERIMENT:"User is part of experiment"},e("hr",Tu=Xa("posthog",(()=>{const e=gh(),n=qi(),o=sy(),a=ni(),{debounce:i}=rr(),r=v(null),s=v({}),l=v({}),u=e=>l.value[e]??r.value?.[e];if(!window.featureFlags){const e=ry(Yn).value;if(e)try{console.log("Overriding feature flags",e),"object"==typeof JSON.parse(e)&&(l.value=JSON.parse(e))}catch(t){console.log("Could not override experiment",t)}window.featureFlags={override:(e,n)=>{l.value[e]=n;try{ry(Yn).value=JSON.stringify(l.value)}catch(t){}},getVariant:u,getAll:()=>r.value??{}}}const c=()=>{const t=a.instanceId,n=e.currentUser,o={instance_id:t,version_cli:a.versionCli};n&&"string"==typeof n.createdAt&&(o.created_at_timestamp=new Date(n.createdAt).getTime());const i=n?`${t}#${n.id}`:t;window.posthog?.identify?.(i,o)},d=i((e=>{An.forEach((t=>((e,t)=>{const n=e[t];n&&s.value[t]!==n&&(o.track(Su.IS_PART_OF_EXPERIMENT,{name:t,variant:n}),s.value[t]=n)})(e,t)))}),{debounceTime:2e3});return{init:t=>{if(!window.posthog)return;const o=n.settings.posthog;if(!o.enabled)return;const i=e.currentUserId;if(!i)return;const s=`${a.instanceId}#${i}`,l={api_host:n.settings.posthog.proxy,autocapture:o.autocapture,disable_session_recording:o.disableSessionRecording,debug:!1,session_recording:{maskAllInputs:!1}};window.posthog?.init(o.apiKey,l),c(),t&&Object.keys(t).length?(r.value=t,l.bootstrap={distinctId:s,featureFlags:t},d(r.value)):window.posthog?.onFeatureFlags?.(((e,t)=>{r.value=t,d(r.value)}))},isFeatureEnabled:e=>!0===u(e),isVariantEnabled:(e,t)=>u(e)===t,getVariant:u,reset:()=>{window.posthog?.reset?.(),r.value=null,s.value={}},identify:c,setMetadata:(e,t)=>{"function"==typeof window.posthog?.people?.set&&"function"==typeof window.posthog?.register&&("user"===t?window.posthog?.people?.set(e):"events"===t&&window.posthog?.register(e))},capture:(e,t)=>{"function"==typeof window.posthog?.capture&&window.posthog.capture(e,t)},overrides:l}}))),e("mr",Eu=new class{pageEventQueue;previousPath;get rudderStack(){return window.rudderanalytics}constructor(){this.pageEventQueue=[],this.previousPath=""}init(e,{instanceId:t,userId:n,projectId:o,versionCli:a}){if(!e.enabled||!e.config||this.rudderStack)return;const{config:{key:i,proxy:r,sourceConfig:s}}=e,l=ni();this.initRudderStack(i,r,{integrations:{All:!1},loadIntegration:!1,configUrl:s}),this.identify(t,n,a,o),this.flushPageEvents(),this.track("Session started",{session_id:l.pushRef})}identify(e,t,n,o){const a=qi(),i={instance_id:e,version_cli:n};a.isCloudDeployment&&(i.user_cloud_id=a.settings?.n8nMetadata?.userId??""),t?this.rudderStack?.identify(`${e}#${t}${o?"#"+o:""}`,i,{context:{ip:"0.0.0.0"}}):this.rudderStack?.reset()}track(e,t){if(!this.rudderStack)return;const n=window.posthog?.get_session_id?.(),o={...t,version_cli:ni().versionCli,posthog_session_id:n};this.rudderStack.track(e,o,{context:{ip:"0.0.0.0"}}),Tu().capture(e,o)}page(e){if(this.rudderStack){if(e.path===this.previousPath)return;this.previousPath=e.path;const t=String(e.name);let n={};e.meta?.telemetry&&"function"==typeof e.meta.telemetry.getProperties&&(n=e.meta.telemetry.getProperties(e)),n.theme=dh().appliedTheme;const o=e.meta?.telemetry?.pageCategory||"Editor";this.rudderStack.page(o,t,n,{context:{ip:"0.0.0.0"}})}else this.pageEventQueue.push({route:e})}reset(){this.rudderStack?.reset()}flushPageEvents(){const e=this.pageEventQueue;this.pageEventQueue=[],e.forEach((({route:e})=>{this.page(e)}))}trackAskAI(e,t={}){this.rudderStack&&(t.session_id=ni().pushRef,t.ndv_session_id=Nu().pushRef,"askAi.generationFinished"===e)&&this.track("Ai code generation finished",t)}trackAiTransform(e,t={}){this.rudderStack&&(t.session_id=ni().pushRef,t.ndv_session_id=Nu().pushRef,"generationFinished"===e)&&this.track("Ai Transform code generation finished",t)}trackNodeParametersValuesChange(e,t){if(this.rudderStack){const n={"n8n-nodes-base.slack":"parameters.otherOptions.includeLinkToWorkflow","n8n-nodes-base.microsoftTeams":"parameters.options.includeLinkToWorkflow","n8n-nodes-base.telegram":"parameters.additionalFields.appendAttribution"}[e]||"parameters.options.appendAttribution";t.name===n&&this.track("User toggled n8n reference option",{node:e,toValue:t.value})}}initRudderStack(e,t,n){if(window.rudderanalytics=window.rudderanalytics||[],this.rudderStack){this.rudderStack.methods=["load","page","track","identify","alias","group","ready","reset","getAnonymousId","setAnonymousId"],this.rudderStack.factory=e=>(...t)=>{if(!this.rudderStack)throw new Error("RudderStack not initialized");const n=[e,...t];return this.rudderStack.push(n),this.rudderStack};for(const e of this.rudderStack.methods)this.rudderStack[e]=this.rudderStack.factory(e);this.rudderStack.loadJS=()=>{const e=document.createElement("script");e.type="text/javascript",e.async=!0,e.src="https://cdn-rs.n8n.io/v1/ra.min.js";const t=document.getElementsByTagName("script")[0];t&&t.parentNode&&t.parentNode.insertBefore(e,t)},this.rudderStack.loadJS(),this.rudderStack.load(e,t,n)}}}),e("pr",{install(e){e.config.globalProperties.$telemetry=Eu}}),e("ur",Au=Xa("canvas",(()=>{const e=rh(),t=ly(),n=v(null),o=C((()=>e.allNodes)),a=C((()=>o.value.filter((e=>e.type.includes("langchain")||"n8n-nodes-base.evaluation"===e.type&&"setMetrics"===e.parameters?.operation)))),i=v(!1);return{newNodeInsertPosition:n,isLoading:t.isLoading,aiNodes:a,hasRangeSelection:C((()=>i.value)),startLoading:t.startLoading,setLoadingText:t.setLoadingText,stopLoading:t.stopLoading,setHasRangeSelection:function(e){i.value=e}}}))),e("cr",Cu=Xa("environments",(()=>{const e=ni(),t=su(),n=v([]),o=C((()=>t.currentProject?.id)),a=C((()=>n.value.filter((e=>!e.project||!o.value||e.project.id===o.value)))),i=C((()=>n.value.filter((e=>!e.project||!o.value&&!e.project||e.project.id===o.value))));return{variables:a,scopedVariables:i,variablesAsObject:C((()=>{const e=i.value.reduce(((e,t)=>(e[t.key]=t.value,e)),{});return new Proxy(e,{set(){throw new In("Cannot assign values to variables at runtime")}})})),fetchAllVariables:async function(){const t=await async function(e){return await Ja(e,"GET","/variables")}(e.restApiContext);return n.value=t,t},createVariable:async function(o){const a=await async function(e,t){return await Ja(e,"POST","/variables",t)}(e.restApiContext,o);if(o.projectId){const e=t.availableProjects?.find((e=>e.id===o.projectId));e&&(a.project={...e,name:e?.name??""})}return n.value.unshift(a),a},updateVariable:async function(o){const a=await async function(e,{id:t,...n}){return await Ja(e,"PATCH",`/variables/${t}`,n)}(e.restApiContext,o);if(o.projectId){const e=t.availableProjects?.find((e=>e.id===o.projectId));e&&(a.project={...e,name:e?.name??""})}return n.value=n.value.map((e=>e.id===a.id?a:e)),a},deleteVariable:async function(t){const o=await async function(e,{id:t}){return await Ja(e,"DELETE",`/variables/${t}`)}(e.restApiContext,{id:t.id});return n.value=n.value.filter((e=>e.id!==t.id)),o}}}))),e("sr",_u=Xa(ai.WORKFLOWS_LIST,(()=>{const e=ni(),t=v(0),n=v({}),o=v([]),a=C((()=>Object.values(n.value).sort(((e,t)=>e.name.localeCompare(t.name)))));function i(e){n.value=e.reduce(((e,t)=>(t.id&&(e[t.id]=t),e)),{})}function r(e){n.value={...n.value,[e.id]:{...n.value[e.id],...zt(e)}}}function s(e){const{[e]:t,...o}=n.value;n.value=o}function l(e){const t=o.value.indexOf(e);-1!==t&&o.value.splice(t,1);const a=n.value[e];a&&(a.active=!1,a.activeVersionId=null,a.activeVersion=null)}async function u({projectId:t,query:n,nodeTypes:o,tags:a,select:i,isArchived:r,triggerNodeTypes:s}){const l={projectId:t,query:n,nodeTypes:o,tags:a,isArchived:r,triggerNodeTypes:s},u=Object.values(l).some((e=>Mh(e)&&(Array.isArray(e)?e.length>0:""!==e))),{data:c}=await Eh(e.restApiContext,u?l:void 0,void 0,i);return c}return{totalWorkflowCount:t,workflowsById:n,activeWorkflows:o,allWorkflows:a,getWorkflowById:function(e){return n.value[e]},setWorkflows:i,addWorkflow:r,removeWorkflow:s,updateWorkflowInCache:function(e,t){n.value[e]&&(n.value[e]={...n.value[e],...t})},setWorkflowActiveInCache:function(e,t){-1===o.value.indexOf(e)&&o.value.push(e);const a=n.value[e];a&&(a.active=!0,a.activeVersionId=t.versionId,a.activeVersion=t)},setWorkflowInactiveInCache:l,fetchWorkflowsPage:async function(n,o=1,a=50,i,s={},l=!1,u=!1){const c={...s,projectId:n},d={skip:(o-1)*a,take:a,sortBy:i},{count:p,data:f}=await Ah(e.restApiContext,Object.keys(c).length?c:void 0,Object.keys(d).length?d:void 0,l||void 0,u||void 0);return t.value=p,f.filter((e=>"folder"!==e.resource)).forEach((e=>{r({...e,nodes:[],connections:{},versionId:""})})),f},searchWorkflows:u,fetchAllWorkflows:async function(e){const t=await u({projectId:e});return i(t),t},fetchWorkflow:async function(t){const n=await Th(e.restApiContext,t);return r(n),n},fetchWorkflowsWithNodesIncluded:async function(t){return await async function(e,t){return await ti(e,"POST","/workflows/with-node-types",{nodeTypes:t})}(e.restApiContext,t)},fetchActiveWorkflows:async function(){const t=await async function(e){return await Ja(e,"GET","/active-workflows")}(e.restApiContext);return o.value=t,t},checkWorkflowExists:async function(t){return(await async function(e,t){return await Ja(e,"GET",`/workflows/${t}/exists`)}(e.restApiContext,t)).exists},deleteWorkflow:async function(t){await Ja(e.restApiContext,"DELETE",`/workflows/${t}`),s(t)},archiveWorkflowInList:async function(t,o){const a=await Ja(e.restApiContext,"POST",`/workflows/${t}/archive`,{expectedChecksum:o});if(!a.checksum)throw new Error("Failed to archive workflow");return n.value[t]&&(n.value[t].isArchived=!0,n.value[t].versionId=a.versionId),l(t),a},unarchiveWorkflowInList:async function(t){const o=await Ja(e.restApiContext,"POST",`/workflows/${t}/unarchive`);if(!o.checksum)throw new Error("Failed to unarchive workflow");return n.value[t]&&(n.value[t].isArchived=!1,n.value[t].versionId=o.versionId),o}}}))),Pu=1e5,Du={[ai.TAGS]:gy("/tags"),[ai.ANNOTATION_TAGS]:gy("/annotation-tags")},Ou=e=>{const t=Du[e];return Xa(e,(()=>{const e=v({}),n=v(!1),o=v(!1),a=v(!1),i=ni(),r=rh(),s=C((()=>Object.values(e.value).sort(((e,t)=>e.name.localeCompare(t.name))))),l=C((()=>n.value)),u=C((()=>Object.keys(e.value).length>0)),c=t=>{t.forEach((t=>{const n=t.id,o=e.value[n];if(o){const a={...o,...t};e.value={...e.value,[n]:a}}else e.value={...e.value,[n]:t}}))},d=t=>{const{[t]:n,...o}=e.value;e.value=o};return{allTags:s,isLoading:l,hasTags:u,tagsById:e,fetchAll:async r=>{if(!ty(["rbac"],{rbac:{scope:"tag:list"}}))return[];const{force:s=!1,withUsageCount:l=!1}=r??{};if(!s&&o.value&&a.value===l)return Object.values(e.value);n.value=!0;const u=await t.getTags(i.restApiContext,{withUsageCount:l});var c;return c=u,e.value=c.reduce(((e,t)=>(e[t.id]=t,e)),{}),o.value=!0,n.value=!1,u},create:async(e,{incrementExisting:n}={})=>{let o=e;if(n){const e=new RegExp(o),t=s.value.filter((t=>e.test(t.name)));t.length>0&&(o=`${o} (${t.length+1})`)}const a=await t.createTag(i.restApiContext,{name:o});return c([a]),a},rename:async({id:e,name:n})=>{const o=await t.updateTag(i.restApiContext,e,{name:n});return c([o]),o},deleteTagById:async e=>{const n=await t.deleteTag(i.restApiContext,e);return n&&(d(e),r.workflowId&&Qh(Kh(r.workflowId)).removeTag(e)),n},upsertTags:c,deleteTag:d}}),{})},e("nr",Mu=Ou(ai.TAGS)),e("tr",Ou(ai.ANNOTATION_TAGS)),e("er",Lu=Xa(ai.WORKFLOWS_EE,(()=>{const e=ni(),t=qi(),n=_u(),o=C((()=>(e,t=Se.baseText("workflows.shareModal.info.sharee.fallback"))=>{const{name:o,email:a}=lu(n.getWorkflowById(e)?.homeProject?.name??""),i=o?.replace(/\s+/g," ")?.trim();return i?a?`${i} (${a})`:i:a??t})),a=e=>{n.updateWorkflowInCache(e.workflowId,{sharedWithProjects:e.sharedWithProjects})};return{getWorkflowOwnerName:o,setWorkflowSharedWith:a,saveWorkflowSharedWith:async n=>{t.isEnterpriseFeatureEnabled[Nn.Sharing]&&(await async function(e,t,n){return await Ja(e,"PUT",`/workflows/${t}/share`,n)}(e.restApiContext,n.workflowId,{shareWithIds:n.sharedWithProjects.map((e=>e.id))}),a(n))}}}))),e("Qn",[...Un,Tn.EXECUTION_PREVIEW,Tn.WORKFLOWS,Tn.CREDENTIALS,Tn.PROJECTS_CREDENTIALS,Tn.PROJECTS_WORKFLOWS,Tn.PROJECT_SETTINGS,Tn.TEMPLATE_SETUP]),e("$n",ju=[...Un]),e("Wn",$u=Xa(ai.CHAT_PANEL_STATE,(()=>({isOpen:v(!1),width:v(400),activeMode:v("builder"),showCoachmark:v(!1),focusRequested:v(0)})))),e("Un",Bu=Xa(ai.FOCUSED_NODES,(()=>{const e=rh(),t=C((()=>e.workflowId?Qh(Kh(e.workflowId)):void 0)),n=Tu(),o=sy(),a=$u(),i=Nu(),r=C((()=>n.isVariantEnabled($n.name,$n.variant))),s=v({}),l=v(new Set),u=C((()=>Object.values(s.value).filter((e=>"confirmed"===e.state)))),c=C((()=>Object.values(s.value).filter((e=>"unconfirmed"===e.state)))),d=C((()=>{const e=(t.value?.allNodes??[]).length-u.value.length;return u.value.length>0&&e>0&&c.value.length>=e?[]:c.value})),p=C((()=>[...u.value,...d.value])),f=C((()=>u.value.length>=7)),m=C((()=>u.value.map((e=>e.nodeId)))),h=C((()=>p.value.length>0)),y=C((()=>d.value.length>50));function g(e){const n=(t.value?.allNodes??[]).find((t=>t.id===e));return n?{name:n.name,type:n.type}:null}function w(e,t,n){const a=[];for(const o of e){const e=s.value[o];if(e)s.value[o]={...e,state:"confirmed"},a.push(e.nodeType);else{const e=g(o);e&&(s.value[o]={nodeId:o,nodeName:e.name,nodeType:e.type,state:"confirmed"},a.push(e.type))}}a.length>0&&o.track("ai.focusedNodes.added",{source:t,node_count:a.length,node_types:a,..."mention"===t&&void 0!==n?.mentionQueryLength?{mention_query_length:n.mentionQueryLength}:{}})}const b=be((e=>{const t=new Set(m.value),n={};for(const o of u.value)n[o.nodeId]=o;for(const o of e)if(!t.has(o)){const e=s.value[o];if(e&&"unconfirmed"===e.state)n[o]=e;else{const e=g(o);e&&(n[o]={nodeId:o,nodeName:e.name,nodeType:e.type,state:"unconfirmed"})}}s.value=n}),ho(ko.INPUT.VALIDATION));function k(e){l.value=new Set(e),b(e)}function x(e,t="badge_click"){const n=s.value[e];if(!n)return;const a="confirmed"===n.state;delete s.value[e],s.value={...s.value},a&&o.track("ai.focusedNodes.removed",{method:t,removed_count:1,remaining_count:u.value.length})}return Y((()=>e.workflowId),((e,t)=>{const n=u.value.length;s.value={},n>0&&void 0!==t&&o.track("ai.focusedNodes.removed",{method:"workflow_changed",removed_count:n,remaining_count:0})})),Y((()=>t.value?.allNodes??[]),(e=>{const t=new Set(e.map((e=>e.id))),n=Object.keys(s.value);let a=0;for(const o of n)t.has(o)||("confirmed"===s.value[o]?.state&&a++,delete s.value[o]);a>0&&(s.value={...s.value},o.track("ai.focusedNodes.removed",{method:"node_deleted",removed_count:a,remaining_count:u.value.length}))}),{deep:!0}),Y((()=>(t.value?.allNodes??[]).map((e=>({id:e.id,name:e.name})))),(e=>{for(const{id:t,name:n}of e){const e=s.value[t];e&&e.nodeName!==n&&(s.value[t]={...e,nodeName:n})}}),{deep:!0}),Y((()=>i.activeNode),(e=>{r.value&&a.isOpen&&e&&!s.value[e.id]&&k([e.id])})),{focusedNodesMap:s,canvasSelectedNodeIds:l,isFeatureEnabled:r,confirmedNodes:u,unconfirmedNodes:c,filteredUnconfirmedNodes:d,allVisibleNodes:p,shouldCollapseChips:f,confirmedNodeIds:m,hasVisibleNodes:h,tooManyUnconfirmed:y,confirmNodes:w,setUnconfirmedFromCanvasSelection:k,toggleNode:function(e,t){const n=s.value[e];n&&("unconfirmed"===n.state?w([e],"canvas_selection"):"confirmed"===n.state&&(t?s.value[e]={...n,state:"unconfirmed"}:x(e)))},removeNode:x,clearAll:function(){const e=u.value.length;s.value={},e>0&&o.track("ai.focusedNodes.removed",{method:"clear_all",removed_count:e,remaining_count:0})},handleNodeDeleted:function(e){s.value[e]&&(delete s.value[e],s.value={...s.value})},handleNodeRenamed:function(e,t){const n=s.value[e];n&&(s.value[e]={...n,nodeName:t})},setState:function(e,t){const n=s.value[e];n&&(s.value[e]={...n,state:t})},isNodeSelectedOnCanvas:function(e){return l.value.has(e)},buildContextPayload:function(){return r.value?function(e,t,n,o){if(0===e.length)return[];const a=new Map(t.map((e=>[e.id,e])));return e.map((e=>{const t=a.get(e.nodeId);if(!t)return{name:e.nodeName,incomingConnections:[],outgoingConnections:[]};const i=[],r=n[t.name];if(r?.main)for(const n of r.main)if(n)for(const e of n)e.node&&!i.includes(e.node)&&i.push(e.node);const s=[],l=o[t.name];if(l?.main)for(const n of l.main)if(n)for(const e of n)e.node&&!s.includes(e.node)&&s.push(e.node);let u;if(t.issues){u={};const e=t.issues;if(e.parameters)for(const[t,n]of Object.entries(e.parameters))Array.isArray(n)&&(u[t]=n);if(e.credentials)for(const[t,n]of Object.entries(e.credentials))Array.isArray(n)&&(u[`credential:${t}`]=n);0===Object.keys(u).length&&(u=void 0)}return{name:t.name,issues:u,incomingConnections:i,outgoingConnections:s}}))}(u.value,t.value?.allNodes??[],t.value?.connectionsByDestinationNode??{},t.value?.connectionsBySourceNode??{}):[]},confirmAllUnconfirmed:function(){const e=c.value.map((e=>e.nodeId));e.length>0&&w(e,"canvas_selection")},removeAllConfirmed:function(){const e=u.value.length,t=u.value.map((e=>e.nodeId));for(const n of t)if(l.value.has(n)){const e=s.value[n];e&&(s.value[n]={...e,state:"unconfirmed"})}else delete s.value[n];s.value={...s.value},e>0&&o.track("ai.focusedNodes.removed",{method:"clear_all",removed_count:e,remaining_count:u.value.length})}}}))),Vu=/<__PLACEHOLDER.*?__>/g,e("Bn",Ru=o(((e,t)=>{var n,o;h(),n=e,o=function(){function e(e,t,n){var o=new XMLHttpRequest;o.open("GET",e),o.responseType="blob",o.onload=function(){r(o.response,t,n)},o.onerror=function(){console.error("could not download file")},o.send()}function n(e){var t=new XMLHttpRequest;t.open("HEAD",e,!1);try{t.send()}catch(e){}return 200<=t.status&&299>=t.status}function o(t){try{t.dispatchEvent(new MouseEvent("click"))}catch(e){var n=document.createEvent("MouseEvents");n.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),t.dispatchEvent(n)}}var a="object"==typeof window&&window.window===window?window:"object"==typeof self&&self.self===self?self:"object"==typeof D&&D.global===D?D:void 0,i=a.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),r=a.saveAs||("object"!=typeof window||window!==a?function(){}:"download"in HTMLAnchorElement.prototype&&!i?function(t,i,r){var s=a.URL||a.webkitURL,l=document.createElement("a");i=i||t.name||"download",l.download=i,l.rel="noopener","string"==typeof t?(l.href=t,l.origin===location.origin?o(l):n(l.href)?e(t,i,r):o(l,l.target="_blank")):(l.href=s.createObjectURL(t),setTimeout((function(){s.revokeObjectURL(l.href)}),4e4),setTimeout((function(){o(l)}),0))}:"msSaveOrOpenBlob"in navigator?function(t,a,i){if(a=a||t.name||"download","string"!=typeof t)navigator.msSaveOrOpenBlob(function(e,t){return void 0===t?t={autoBom:!1}:"object"!=typeof t&&(console.warn("Deprecated: Expected third argument to be a object"),t={autoBom:!t}),t.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(e.type)?new Blob(["\ufeff",e],{type:e.type}):e}(t,i),a);else if(n(t))e(t,a,i);else{var r=document.createElement("a");r.href=t,r.target="_blank",setTimeout((function(){o(r)}))}}:function(t,n,o,r){if((r=r||open("","_blank"))&&(r.document.title=r.document.body.innerText="downloading..."),"string"==typeof t)return e(t,n,o);var s="application/octet-stream"===t.type,l=/constructor/i.test(a.HTMLElement)||a.safari,u=/CriOS\/[\d]+/.test(navigator.userAgent);if((u||s&&l||i)&&"undefined"!=typeof FileReader){var c=new FileReader;c.onloadend=function(){var e=c.result;e=u?e:e.replace(/^data:[^;]*;/,"data:attachment/file;"),r?r.location.href=e:location=e,r=null},c.readAsDataURL(t)}else{var d=a.URL||a.webkitURL,p=d.createObjectURL(t);r?r.location=p:location.href=p,r=null,setTimeout((function(){d.revokeObjectURL(p)}),4e4)}});a.saveAs=r.saveAs=r,void 0!==t&&(t.exports=r)},"function"==typeof define&&define.amd?define([],o):void 0!==e?o():(o(),n.FileSaver={})}))),Fu=n(Ru(),1),e("zn",Wu=Xa("workflowHistory",(()=>{const e=ni(),t=qi(),n=rh(),o=_u(),a=C((()=>t.settings.workflowHistory?.licensePruneTime)),i=C((()=>t.settings.workflowHistory?.pruneTime)),r=C((()=>-1!==a.value&&a.value===i.value)),s=async(t,n)=>await Gi(e.restApiContext,t,n);return{getWorkflowHistory:async(t,n)=>await Vi(e.restApiContext,t,n),getWorkflowVersion:s,downloadVersion:async(e,t,n)=>{const[a,i]=await Promise.all([o.fetchWorkflow(e),s(e,t)]),{connections:r,nodes:l}=i;(0,Fu.saveAs)(new Blob([JSON.stringify({...a,nodes:l,connections:r},null,2)],{type:"application/json;charset=utf-8"}),`${a.name}(${n.formattedCreatedAt}).json`)},cloneIntoNewWorkflow:async(t,a,i)=>{const[r,l]=await Promise.all([o.fetchWorkflow(t),s(t,a)]),{connections:u,nodes:c}=l,{name:d}=r,p={nodes:c,connections:u,name:(await Sh(e.restApiContext,{name:`${d} (${i.formattedCreatedAt})`})).name};return await n.createNewWorkflow(p)},restoreWorkflow:async(e,t)=>{const{connections:a,nodes:i}=await s(e,t),r={connections:a,nodes:i};return await n.updateWorkflow(e,r,!0).catch((async t=>{if(400===t.httpStatusCode&&"string"==typeof t.message&&t.message.includes("can not be activated"))return await o.fetchWorkflow(e);throw new Error(t)}))},updateWorkflowHistoryVersion:async(t,n,o)=>{await hi(e.restApiContext,t,n,o)},evaluatedPruneTime:i,shouldUpgrade:r}}))),e("Rn",Uu=Xa("npsSurvey",(()=>{const e=ni(),t=dh(),n=qi(),o=v(!1),a=v(),i=v();async function r(){Qa(a.value);const t={responded:!0,lastShownAt:a.value.lastShownAt};await ki(e.restApiContext,t),a.value=t}return{resetNpsSurveyOnLogOut:function(){o.value=!1},showNpsSurveyIfPossible:async function(){if(!o.value)return;t.openModal(La),o.value=!1;const n={waitingForResponse:!0,lastShownAt:Date.now(),ignoredCount:a.value&&"ignoredCount"in a.value?a.value.ignoredCount:0};await ki(e.restApiContext,n),a.value=n},ignoreNpsSurvey:async function(){Qa(a.value);const t=a.value,n="ignoredCount"in t?t.ignoredCount:0;if(n+1>=3)return void(await r());const o={waitingForResponse:!0,lastShownAt:a.value.lastShownAt,ignoredCount:n+1};await ki(e.restApiContext,o),a.value=o},respondNpsSurvey:r,setupNpsSurveyOnLogin:function(e,t){i.value=e,t&&function(e){if(!n.isTelemetryEnabled)return void(o.value=!1);a.value=e.npsSurvey;const t=Boolean(e.userActivated),i=e.userActivatedAt,r=a.value?.lastShownAt;if(!t||!i)return;if(Date.now()-i<sa)return;if(!a.value||!r)return void(o.value=!0);const s=Date.now()-r;"responded"in a.value&&s<io||"waitingForResponse"in a.value&&s<Bo||(o.value=!0)}(t)}}}))),zu=Xa(ai.WEBHOOKS,(()=>({...ni(),...rh(),...dh(),...gh(),...Nu(),...qi()}))),Hu={CONTEXT_MENU:10,APP_HEADER:99,SELECT_BOX:100,CANVAS_ADD_BUTTON:101,APP_SIDEBAR:999,CANVAS_SELECT_BOX:100,TOP_BANNERS:999,NODE_CREATOR:1700,ASK_ASSISTANT_CHAT:1750,NDV:1800,COMMAND_BAR:1900,DIALOGS:1950,MODALS:2e3,TOASTS:2100,ASK_ASSISTANT_FLOATING_BUTTON:3e3,ASK_ASSISTANT_FLOATING_BUTTON_TOOLTIP:3e3,CODEMIRROR_TOOLTIP:3e3,FLOATING_UI:3e3,DRAGGABLE:9999999,ACTIVE_STICKY:9999999,WORKFLOW_PREVIEW_NDV:9999999,NPS_SURVEY_MODAL:3001},Gu=()=>{Object.keys(Hu).forEach((e=>{const t=`--${e.toLowerCase().replaceAll("_","-")}--z`,n=Hu[e];document.documentElement.style.setProperty(t,`${n}`)}))},e("Fn",Yu=()=>({APP_Z_INDEXES:Hu,setAppZIndexes:Gu})),Xu=[],qu={initialized:!1,data:null,usage:null,loadingPlan:!1},e("Nn",Ju=Xa(ai.CLOUD_PLAN,(()=>{const e=ni(),n=qi(),o=I(qu),a=v(null),i=v(Date.now()),r=C((()=>o.data?.userIsTrialing??!1)),s=C((()=>o.data?.bannerConfig)),l=C((()=>!0===s.value?.forceShow)),u=C((()=>{const e=n.permanentlyDismissedBanners;return e.includes("TRIAL")||e.includes("TRIAL_OVER")})),c=C((()=>!!s.value&&(!h.value||l.value||!u.value))),d=C((()=>({show:!!s.value?.timeLeft,text:s.value?.timeLeft?.text}))),p=C((()=>!0===s.value?.showExecutions)),f=C((()=>({text:s.value?.cta?.text??"Upgrade Now",icon:s.value?.cta?.icon??"zap",size:s.value?.cta?.size??"small",style:s.value?.cta?.style??"success",variant:s.value?.cta?.variant,href:s.value?.cta?.href}))),m=C((()=>s.value?.icon)),h=C((()=>s.value?.dismissible??!0)),y=C((()=>o.data)),g=C((()=>o.usage)),w=C((()=>a.value?.selectedApps)),b=C((()=>{const e=a.value?.information;return e&&"which_of_these_do_you_feel_comfortable_doing"in e&&e.which_of_these_do_you_feel_comfortable_doing&&Array.isArray(e.which_of_these_do_you_feel_comfortable_doing)?e.which_of_these_do_you_feel_comfortable_doing.length:0})),k=C((()=>o.data?.userIsTrialing&&bt.now().toMillis()>=bt.fromISO(o.data?.expirationDate).toMillis())),x=C((()=>!(!o.usage?.executions||!o.data?.monthlyExecutionsLimit)&&o.usage?.executions>=o.data?.monthlyExecutionsLimit)),N=C((()=>{const e=n.settings.n8nMetadata?.userId;return ty(["instanceOwner"])&&n.isCloudDeployment&&!!e})),S=async()=>await Ii(e.restApiContext),T=async()=>{if(!N.value)throw new Error("User does not have a cloud plan");let t;o.loadingPlan=!0;try{t=await $i(e.restApiContext),o.data=t,o.loadingPlan=!1}catch(n){throw o.loadingPlan=!1,new Error(n)}return t},E=async()=>{const t=await Ci({baseUrl:e.baseUrl,pushRef:""});return o.usage=t,t},A=C((()=>o.data&&o.usage?{workflowsLeft:o.data.activeWorkflowsLimit-o.usage.activeWorkflows,executionsLeft:o.data.monthlyExecutionsLimit-o.usage.executions}:{workflowsLeft:-1,executionsLeft:-1})),_=C((()=>{if(!o.data?.expirationDate)return-1;const e=(new Date).valueOf()-new Date(o.data.expirationDate).valueOf(),t=Math.floor(e/864e5);return Math.ceil(t)})),P=C((()=>{if(!o.data?.expirationDate)return{count:0,unit:"days"};const e=new Date(o.data.expirationDate).valueOf()-i.value;if(e<=0)return{count:0,unit:"minutes"};const t=e/36e5;return t<1?{count:Math.ceil(e/6e4),unit:"minutes"}:t<24?{count:Math.ceil(t),unit:"hours"}:{count:Math.ceil(t/24),unit:"days"}})),D=async()=>{try{if(await T(),!r.value)return;await E(),(()=>{const e=setInterval((async()=>{i.value=Date.now();try{if(await E(),k.value||x.value)return void clearInterval(e)}catch{}}),kt)})()}catch(t){throw new Error(t.message)}},O=async()=>{try{await(async()=>{if(!N.value)throw new Error("User does not have a cloud plan");let t=null;try{t=await zi(e.restApiContext),a.value=t}catch(n){throw new Error(n.message)}})()}catch(t){throw new Error(t.message)}};return{state:o,usageLeft:A,trialDaysLeft:_,trialTimeLeft:P,userIsTrialing:r,currentPlanData:y,currentUsageData:g,trialExpired:k,allExecutionsUsed:x,hasCloudPlan:N,currentUserCloudInfo:a,generateCloudDashboardAutoLoginLink:async e=>{const t=new URLSearchParams,n=new URL(window.location.href).host.split(".").slice(1).join("."),{code:o}=await S(),a=`https://${n}/login`;return t.set("code",o),t.set("returnPath",e.redirectionPath),`${a}?${t.toString()}`},initialize:async()=>{if(!o.initialized){try{await D()}catch(e){console.warn("Error checking for cloud plan data:",e)}try{await O()}catch(e){console.warn("Error fetching user cloud account:",e)}o.initialized=!0}},getOwnerCurrentPlan:T,getInstanceCurrentUsage:E,reset:()=>{a.value=null,o.data=null,o.usage=null},checkForCloudPlanData:D,fetchUserCloudAccount:O,getAutoLoginCode:S,selectedApps:w,codingSkill:b,shouldShowBanner:c,bannerConfig:s,bannerForceShow:l,isBannerDismissed:u,bannerTimeLeft:d,showExecutions:p,bannerCta:f,bannerIcon:m,bannerDismissible:h}}))),e("jn",(()=>Tu().getVariant(Ba.name)===Ba.variant&&Ju().userIsTrialing)),e("An",function(e){return e.emptyWorkflowLink="empty_workflow_link",e.emptyInstanceCard="empty_instance_card",e.sidebarButton="sidebar_button",e.emptyStateBuilderPrompt="empty_state_builder_prompt",e}({})),Ku=e=>{if(!e)return"";switch(e){case"Executive/Owner":case"Product & Design":return"categories/ai/";case"Support":return"categories/support/";case"Sales":return"categories/sales/";case"IT":case"Engineering":return"categories/it-ops/";case"Marketing":return"categories/marketing/";case"Other":return"categories/other/";default:return""}},e("Mn",(e=>{sy().track("User clicked on templates",{role:Ju().currentUserCloudInfo?.role,active_workflow_count:_u().activeWorkflows.length,source:e})})),Zu="undefined"!=typeof window&&"undefined"!=typeof document,Qu=e=>void 0!==e,ec=Object.prototype.toString,tc=e=>"[object Object]"===ec.call(e),nc=()=>{},oc=e=>e(),ac=Zu?window:void 0,ic={value:()=>{}},uv.prototype=lv.prototype={constructor:uv,on:function(e,t){var n,o=this._,a=cv(e+"",o),i=-1,r=a.length;if(!(arguments.length<2)){if(null!=t&&"function"!=typeof t)throw new Error("invalid callback: "+t);for(;++i<r;)if(n=(e=a[i]).type)o[n]=pv(o[n],e.name,t);else if(null==t)for(n in o)o[n]=pv(o[n],e.name,null);return this}for(;++i<r;)if((n=(e=a[i]).type)&&(n=dv(o[n],e.name)))return n},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new uv(e)},call:function(e,t){if((n=arguments.length-2)>0)for(var n,o,a=new Array(n),i=0;i<n;++i)a[i]=arguments[i+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(i=0,n=(o=this._[e]).length;i<n;++i)o[i].value.apply(t,a)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var o=this._[e],a=0,i=o.length;a<i;++a)o[a].value.apply(t,n)}},sc={svg:"http://www.w3.org/2000/svg",xhtml:rc="http://www.w3.org/1999/xhtml",xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"},lc=Array.prototype.find,uc=Array.prototype.filter,Ov.prototype={constructor:Ov,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}},vg.prototype={add:function(e){this._names.indexOf(e)<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}},cc=[null],ew.prototype=tw.prototype={constructor:ew,select:wv,selectAll:Iv,selectChild:Ev,selectChildren:Cv,filter:_v,data:Bv,enter:Dv,exit:Rv,join:Fv,merge:Wv,selection:nw,order:Uv,sort:zv,call:Gv,nodes:Yv,node:Xv,size:qv,empty:Jv,each:Kv,attr:ag,style:ug,property:mg,classed:Ig,text:Eg,html:Pg,raise:Og,lower:Lg,append:jg,insert:Bg,remove:Rg,clone:Ug,datum:zg,on:Xg,dispatch:Zg,[Symbol.iterator]:Qg},dc={passive:!1},pc={capture:!0,passive:!1},fc=e=>()=>e,uw.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e},hc=1/(mc=.7),yc="\\s*([+-]?\\d+)\\s*",vc="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",gc="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",wc=/^#([0-9a-f]{3,8})$/,bc=new RegExp(`^rgb\\(${yc},${yc},${yc}\\)$`),kc=new RegExp(`^rgb\\(${gc},${gc},${gc}\\)$`),xc=new RegExp(`^rgba\\(${yc},${yc},${yc},${vc}\\)$`),Ic=new RegExp(`^rgba\\(${gc},${gc},${gc},${vc}\\)$`),Nc=new RegExp(`^hsl\\(${vc},${gc},${gc}\\)$`),Sc=new RegExp(`^hsla\\(${vc},${gc},${gc},${vc}\\)$`),Tc={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},mw(yw,kw,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:vw,formatHex:vw,formatHex8:gw,formatHsl:ww,formatRgb:bw,toString:bw}),mw(Tw,Sw,hw(yw,{brighter(e){return e=null==e?hc:Math.pow(hc,e),new Tw(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=null==e?mc:Math.pow(mc,e),new Tw(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Tw(Pw(this.r),Pw(this.g),Pw(this.b),_w(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Ew,formatHex:Ew,formatHex8:Aw,formatRgb:Cw,toString:Cw})),mw(jw,Lw,hw(yw,{brighter(e){return e=null==e?hc:Math.pow(hc,e),new jw(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=null==e?mc:Math.pow(mc,e),new jw(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+360*(this.h<0),t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,o=n+(n<.5?n:1-n)*t,a=2*n-o;return new Tw(Vw(e>=240?e-240:e+120,a,o),Vw(e,a,o),Vw(e<120?e+240:e-120,a,o),this.opacity)},clamp(){return new jw($w(this.h),Bw(this.s),Bw(this.l),_w(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=_w(this.opacity);return`${1===e?"hsl(":"hsla("}${$w(this.h)}, ${100*Bw(this.s)}%, ${100*Bw(this.l)}%${1===e?")":`, ${e})`}`}})),Ec=e=>()=>e,Ac=function e(t){var n=Rw(t);function o(e,t){var o=n((e=Sw(e)).r,(t=Sw(t)).r),a=n(e.g,t.g),i=n(e.b,t.b),r=Fw(e.opacity,t.opacity);return function(t){return e.r=o(t),e.g=a(t),e.b=i(t),e.opacity=r(t),e+""}}return o.gamma=e,o}(1),Cc=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,_c=new RegExp(Cc.source,"g"),Pc=180/Math.PI,Dc={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1},Mc=Zw(Jw,"px, ","px)","deg)"),Lc=Zw(Kw,", ",")",")"),jc=function e(t,n,o){function a(e,a){var i,r,s=e[0],l=e[1],u=e[2],c=a[0],d=a[1],p=a[2],f=c-s,m=d-l,h=f*f+m*m;if(h<1e-12)r=Math.log(p/u)/t,i=function(e){return[s+e*f,l+e*m,u*Math.exp(t*e*r)]};else{var y=Math.sqrt(h),v=(p*p-u*u+o*h)/(2*u*n*y),g=(p*p-u*u-o*h)/(2*p*n*y),w=Math.log(Math.sqrt(v*v+1)-v);r=(Math.log(Math.sqrt(g*g+1)-g)-w)/t,i=function(e){var o,a=e*r,i=Qw(w),c=u/(n*y)*(i*(o=t*a+w,((o=Math.exp(2*o))-1)/(o+1))-function(e){return((e=Math.exp(e))-1/e)/2}(w));return[s+c*f,l+c*m,u*i/Qw(t*a+w)]}}return i.duration=1e3*r*t/Math.SQRT2,i}return a.rho=function(t){var n=Math.max(.001,+t),o=n*n;return e(n,o,o*o)},a}(Math.SQRT2,2,4),$c=0,Bc=0,Vc=0,Rc=1e3,Uc=0,zc=0,Hc=0,Gc="object"==typeof performance&&performance.now?performance:Date,Yc="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)},nb.prototype=ob.prototype={constructor:nb,restart:function(e,t,n){if("function"!=typeof e)throw new TypeError("callback is not a function");n=(null==n?eb():+n)+(null==t?0:+t),this._next||Wc===this||(Wc?Wc._next=this:Fc=this,Wc=this),this._call=e,this._time=n,rb()},stop:function(){this._call&&(this._call=null,this._time=1/0,rb())}},Xc=lv("start","end","cancel","interrupt"),qc=[],Jc=0,Kc=1,Zc=2,Qc=3,ed=4,td=5,nd=6,od=tw.prototype.constructor,ad=0,id=tw.prototype,ik.prototype={constructor:ik,select:Hb,selectAll:Gb,selectChild:id.selectChild,selectChildren:id.selectChildren,filter:Rb,merge:Fb,selection:Yb,transition:ok,call:id.call,nodes:id.nodes,node:id.node,size:id.size,empty:id.empty,each:id.each,on:Ub,attr:Sb,attrTween:_b,style:qb,styleTween:Zb,text:Qb,textTween:nk,remove:zb,tween:yb,delay:Ob,duration:jb,ease:Bb,easeVarying:Vb,end:ak,[Symbol.iterator]:id[Symbol.iterator]},rd={time:null,delay:0,duration:250,ease:sk},tw.prototype.interrupt=fb,tw.prototype.transition=uk,sd=e=>()=>e,dk.prototype={constructor:dk,scale:function(e){return 1===e?this:new dk(this.k*e,this.x,this.y)},translate:function(e,t){return 0===e&0===t?this:new dk(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}},ld=new dk(1,0,0),dk.prototype,e("mn",ud=(e=>(e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom",e))(ud||{})),cd=(e=>(e.Partial="partial",e.Full="full",e))(cd||{}),dd=(e=>(e.Bezier="default",e.SimpleBezier="simple-bezier",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e))(dd||{}),pd=(e=>(e.Strict="strict",e.Loose="loose",e))(pd||{}),e("dn",fd=(e=>(e.Arrow="arrow",e.ArrowClosed="arrowclosed",e))(fd||{})),md=(e=>(e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal",e))(md||{}),e("pn",hd=(e=>(e.TopLeft="top-left",e.TopCenter="top-center",e.TopRight="top-right",e.BottomLeft="bottom-left",e.BottomCenter="bottom-center",e.BottomRight="bottom-right",e))(hd||{})),yd=["INPUT","SELECT","TEXTAREA"],vd="undefined"!=typeof document?document:null,gd="vue-flow__node-desc",wd="vue-flow__edge-desc",bd=["Enter"," ","Escape"],kd={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},xd=()=>{},Id=(e=>(e.MISSING_STYLES="MISSING_STYLES",e.MISSING_VIEWPORT_DIMENSIONS="MISSING_VIEWPORT_DIMENSIONS",e.NODE_INVALID="NODE_INVALID",e.NODE_NOT_FOUND="NODE_NOT_FOUND",e.NODE_MISSING_PARENT="NODE_MISSING_PARENT",e.NODE_TYPE_MISSING="NODE_TYPE_MISSING",e.NODE_EXTENT_INVALID="NODE_EXTENT_INVALID",e.EDGE_INVALID="EDGE_INVALID",e.EDGE_NOT_FOUND="EDGE_NOT_FOUND",e.EDGE_SOURCE_MISSING="EDGE_SOURCE_MISSING",e.EDGE_TARGET_MISSING="EDGE_TARGET_MISSING",e.EDGE_TYPE_MISSING="EDGE_TYPE_MISSING",e.EDGE_SOURCE_TARGET_SAME="EDGE_SOURCE_TARGET_SAME",e.EDGE_SOURCE_TARGET_MISSING="EDGE_SOURCE_TARGET_MISSING",e.EDGE_ORPHANED="EDGE_ORPHANED",e.USEVUEFLOW_OPTIONS="USEVUEFLOW_OPTIONS",e))(Id||{}),Nd={MISSING_STYLES:()=>"It seems that you haven't loaded the necessary styles. Please import '@vue-flow/core/dist/style.css' to ensure that the graph is rendered correctly",MISSING_VIEWPORT_DIMENSIONS:()=>"The Vue Flow parent container needs a width and a height to render the graph",NODE_INVALID:e=>`Node is invalid\nNode: ${e}`,NODE_NOT_FOUND:e=>`Node not found\nNode: ${e}`,NODE_MISSING_PARENT:(e,t)=>`Node is missing a parent\nNode: ${e}\nParent: ${t}`,NODE_TYPE_MISSING:e=>`Node type is missing\nType: ${e}`,NODE_EXTENT_INVALID:e=>`Only child nodes can use a parent extent\nNode: ${e}`,EDGE_INVALID:e=>`An edge needs a source and a target\nEdge: ${e}`,EDGE_SOURCE_MISSING:(e,t)=>`Edge source is missing\nEdge: ${e} \nSource: ${t}`,EDGE_TARGET_MISSING:(e,t)=>`Edge target is missing\nEdge: ${e} \nTarget: ${t}`,EDGE_TYPE_MISSING:e=>`Edge type is missing\nType: ${e}`,EDGE_SOURCE_TARGET_SAME:(e,t,n)=>`Edge source and target are the same\nEdge: ${e} \nSource: ${t} \nTarget: ${n}`,EDGE_SOURCE_TARGET_MISSING:(e,t,n)=>`Edge source or target is missing\nEdge: ${e} \nSource: ${t} \nTarget: ${n}`,EDGE_ORPHANED:e=>`Edge was orphaned (suddenly missing source or target) and has been removed\nEdge: ${e}`,EDGE_NOT_FOUND:e=>`Edge not found\nEdge: ${e}`,USEVUEFLOW_OPTIONS:()=>"The options parameter is deprecated and will be removed in the next major version. Please use the id parameter instead"},Sd=class extends Error{constructor(e,...t){var n;super(null==(n=Nd[e])?void 0:n.call(Nd,...t)),this.name="VueFlowError",this.code=e,this.args=t}},e("En",Td=()=>{var e;return"undefined"!=typeof navigator&&(null==(e=null==navigator?void 0:navigator.userAgent)?void 0:e.indexOf("Mac"))>=0}),Ed=()=>!0,Ad=250,Cd={[ud.Left]:ud.Right,[ud.Right]:ud.Left,[ud.Top]:ud.Bottom,[ud.Bottom]:ud.Top},_d=["production","prod"],Pd=Symbol("vueFlow"),e("fn",Dd=Symbol("nodeId")),Od=Symbol("nodeRef"),Md=Symbol("edgeId"),Ld=Symbol("edgeRef"),jd=Symbol("slots"),$d=.1,Bd=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,Vd={zoomIn:Wx,zoomOut:Wx,zoomTo:Wx,fitView:Wx,setCenter:Wx,fitBounds:Wx,project:e=>e,screenToFlowCoordinate:e=>e,flowToScreenCoordinate:e=>e,setViewport:Wx,setTransform:Wx,getViewport:()=>({x:0,y:0,zoom:1}),getTransform:()=>({x:0,y:0,zoom:1}),viewportInitialized:!1},Rd=["id","vueFlowRef","viewportRef","initialized","modelValue","nodes","edges","maxZoom","minZoom","translateExtent","hooks","defaultEdgeOptions"],Fd=["data-id","data-handleid","data-nodeid","data-handlepos"],e("yn",Wd=x({name:"Handle",compatConfig:{MODE:3},props:{id:{default:null},type:{},position:{default:()=>ud.Top},isValidConnection:{type:Function},connectable:{type:[Boolean,Number,String,Function],default:void 0},connectableStart:{type:Boolean,default:!0},connectableEnd:{type:Boolean,default:!0}},setup(e,{expose:t}){const n=p(e,["position","connectable","connectableStart","connectableEnd","id"]),o=u((()=>n.type??"source")),i=u((()=>n.isValidConnection??null)),{id:r,connectionStartHandle:s,connectionClickStartHandle:l,connectionEndHandle:c,vueFlowRef:d,nodesConnectable:f,noDragClassName:h,noPanClassName:y}=oI(),{id:g,node:w,nodeEl:b,connectedEdges:k}=Vx(),x=v(),I=u((()=>void 0===e.connectableStart||e.connectableStart)),N=u((()=>void 0===e.connectableEnd||e.connectableEnd)),S=u((()=>{var t,n,a,i,r,l;return(null==(t=s.value)?void 0:t.nodeId)===g&&(null==(n=s.value)?void 0:n.id)===e.id&&(null==(a=s.value)?void 0:a.type)===o.value||(null==(i=c.value)?void 0:i.nodeId)===g&&(null==(r=c.value)?void 0:r.id)===e.id&&(null==(l=c.value)?void 0:l.type)===o.value})),T=u((()=>{var t,n,a;return(null==(t=l.value)?void 0:t.nodeId)===g&&(null==(n=l.value)?void 0:n.id)===e.id&&(null==(a=l.value)?void 0:a.type)===o.value})),{handlePointerDown:E,handleClick:A}=Bx({nodeId:g,handleId:e.id,isValidConnection:i,type:o}),_=C((()=>"string"==typeof e.connectable&&"single"===e.connectable?!k.value.some((t=>{const n=t[`${o.value}Handle`];return t[o.value]===g&&(!n||n===e.id)})):"number"==typeof e.connectable?k.value.filter((t=>{const n=t[`${o.value}Handle`];return t[o.value]===g&&(!n||n===e.id)})).length<e.connectable:"function"==typeof e.connectable?e.connectable(w,k.value):Ex(e.connectable)?e.connectable:f.value));function P(e){const t=hx(e);_.value&&I.value&&(t&&0===e.button||!t)&&E(e)}function D(e){g&&(l.value||I.value)&&_.value&&A(e)}return B((()=>{var t;if(!w.dimensions.width||!w.dimensions.height)return;const n=null==(t=w.handleBounds[o.value])?void 0:t.find((t=>t.id===e.id));if(!d.value||n)return;const a=d.value.querySelector(".vue-flow__transformationpane");if(!(b.value&&x.value&&a&&e.id))return;const i=b.value.getBoundingClientRect(),r=x.value.getBoundingClientRect(),s=window.getComputedStyle(a),{m22:l}=new window.DOMMatrixReadOnly(s.transform),u={id:e.id,position:e.position,x:(r.left-i.left)/l,y:(r.top-i.top)/l,type:o.value,nodeId:g,...Sk(x.value)};w.handleBounds[o.value]=[...w.handleBounds[o.value]??[],u]})),t({handleClick:A,handlePointerDown:E,onClick:D,onPointerDown:P}),(t,n)=>(a(),m("div",{ref_key:"handle",ref:x,"data-id":`${$(r)}-${$(g)}-${e.id}-${o.value}`,"data-handleid":e.id,"data-nodeid":$(g),"data-handlepos":t.position,class:F(["vue-flow__handle",[`vue-flow__handle-${t.position}`,`vue-flow__handle-${e.id}`,$(h),$(y),o.value,{connectable:_.value,connecting:T.value,connectablestart:I.value,connectableend:N.value,connectionindicator:_.value&&(I.value&&!S.value||N.value&&S.value)}]]),onMousedown:P,onTouchstartPassive:P,onClick:D},[K(t.$slots,"default",{id:t.id})],42,Fd))}})),(Ud=function({sourcePosition:e=ud.Bottom,targetPosition:t=ud.Top,label:n,connectable:o=!0,isValidTargetPos:a,isValidSourcePos:i,data:r}){const s=r.label??n;return[w(Wd,{type:"target",position:t,connectable:o,isValidConnection:a}),"string"!=typeof s&&s?w(s):w(R,[s]),w(Wd,{type:"source",position:e,connectable:o,isValidConnection:i})]}).props=["sourcePosition","targetPosition","label","isValidTargetPos","isValidSourcePos","connectable","data"],Ud.inheritAttrs=!1,Ud.compatConfig={MODE:3},zd=Ud,(Hd=function({targetPosition:e=ud.Top,label:t,connectable:n=!0,isValidTargetPos:o,data:a}){const i=a.label??t;return[w(Wd,{type:"target",position:e,connectable:n,isValidConnection:o}),"string"!=typeof i&&i?w(i):w(R,[i])]}).props=["targetPosition","label","isValidTargetPos","connectable","data"],Hd.inheritAttrs=!1,Hd.compatConfig={MODE:3},Gd=Hd,(Yd=function({sourcePosition:e=ud.Bottom,label:t,connectable:n=!0,isValidSourcePos:o,data:a}){const i=a.label??t;return["string"!=typeof i&&i?w(i):w(R,[i]),w(Wd,{type:"source",position:e,connectable:n,isValidConnection:o})]}).props=["sourcePosition","label","isValidSourcePos","connectable","data"],Yd.inheritAttrs=!1,Yd.compatConfig={MODE:3},Xd=Yd,qd=["transform"],Jd=["width","height","x","y","rx","ry"],Kd=["y"],Zd=x({name:"EdgeText",compatConfig:{MODE:3},props:{x:{},y:{},label:{},labelStyle:{default:()=>({})},labelShowBg:{type:Boolean,default:!0},labelBgStyle:{default:()=>({})},labelBgPadding:{default:()=>[2,4]},labelBgBorderRadius:{default:2}},setup(e){const t=v({x:0,y:0,width:0,height:0}),n=v(null),o=C((()=>`translate(${e.x-t.value.width/2} ${e.y-t.value.height/2})`));function i(){if(!n.value)return;const e=n.value.getBBox();e.width===t.value.width&&e.height===t.value.height||(t.value=e)}return B(i),Y([()=>e.x,()=>e.y,n,()=>e.label],i),(e,i)=>(a(),m("g",{transform:o.value,class:"vue-flow__edge-textwrapper"},[e.labelShowBg?(a(),m("rect",{key:0,class:"vue-flow__edge-textbg",width:`${t.value.width+2*e.labelBgPadding[0]}px`,height:`${t.value.height+2*e.labelBgPadding[1]}px`,x:-e.labelBgPadding[0],y:-e.labelBgPadding[1],style:ye(e.labelBgStyle),rx:e.labelBgBorderRadius,ry:e.labelBgBorderRadius},null,12,Jd)):P("",!0),c("text",M(e.$attrs,{ref_key:"el",ref:n,class:"vue-flow__edge-text",y:t.value.height/2,dy:"0.3em",style:e.labelStyle}),[K(e.$slots,"default",{},(()=>["string"!=typeof e.label?(a(),fe(de(e.label),{key:0})):(a(),m(R,{key:1},[r(_(e.label),1)],64))]))],16,Kd)],8,qd))}}),Qd=["id","d","marker-end","marker-start"],ep=["d","stroke-width"],e("vn",tp=x({name:"BaseEdge",inheritAttrs:!1,compatConfig:{MODE:3},props:{id:{},labelX:{},labelY:{},path:{},label:{},markerStart:{},markerEnd:{},interactionWidth:{default:20},labelStyle:{},labelShowBg:{type:Boolean},labelBgStyle:{},labelBgPadding:{},labelBgBorderRadius:{}},setup(e,{expose:t}){const n=v(null),o=v(null),i=v(null),r=ee();return t({pathEl:n,interactionEl:o,labelEl:i}),(e,t)=>(a(),m(R,null,[c("path",M($(r),{id:e.id,ref_key:"pathEl",ref:n,d:e.path,class:"vue-flow__edge-path","marker-end":e.markerEnd,"marker-start":e.markerStart}),null,16,Qd),e.interactionWidth?(a(),m("path",{key:0,ref_key:"interactionEl",ref:o,fill:"none",d:e.path,"stroke-width":e.interactionWidth,"stroke-opacity":0,class:"vue-flow__edge-interaction"},null,8,ep)):P("",!0),e.label&&e.labelX&&e.labelY?(a(),fe(Zd,{key:1,ref_key:"labelEl",ref:i,x:e.labelX,y:e.labelY,label:e.label,"label-show-bg":e.labelShowBg,"label-bg-style":e.labelBgStyle,"label-bg-padding":e.labelBgPadding,"label-bg-border-radius":e.labelBgBorderRadius,"label-style":e.labelStyle},null,8,["x","y","label","label-show-bg","label-bg-style","label-bg-padding","label-bg-border-radius","label-style"])):P("",!0)],64))}})),np={[ud.Left]:{x:-1,y:0},[ud.Right]:{x:1,y:0},[ud.Top]:{x:0,y:-1},[ud.Bottom]:{x:0,y:1}},op=x({name:"StraightEdge",props:["label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","markerEnd","markerStart","interactionWidth"],compatConfig:{MODE:3},setup:(e,{attrs:t})=>()=>{const[n,o,a]=function(e){const{sourceX:t,sourceY:n,targetX:o,targetY:a}=e,[i,r,s,l]=Yx({sourceX:t,sourceY:n,targetX:o,targetY:a});return[`M ${t},${n}L ${o},${a}`,i,r,s,l]}(e);return w(tp,{path:n,labelX:o,labelY:a,...t,...e})}}),ap=x({name:"SmoothStepEdge",props:["sourcePosition","targetPosition","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","borderRadius","markerEnd","markerStart","interactionWidth","offset"],compatConfig:{MODE:3},setup:(e,{attrs:t})=>()=>{const[n,o,a]=nI({...e,sourcePosition:e.sourcePosition??ud.Bottom,targetPosition:e.targetPosition??ud.Top});return w(tp,{path:n,labelX:o,labelY:a,...t,...e})}}),ip=x({name:"StepEdge",props:["sourcePosition","targetPosition","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","markerEnd","markerStart","interactionWidth"],setup:(e,{attrs:t})=>()=>w(ap,{...e,...t,borderRadius:0})}),rp=x({name:"BezierEdge",props:["sourcePosition","targetPosition","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","curvature","markerEnd","markerStart","interactionWidth"],compatConfig:{MODE:3},setup:(e,{attrs:t})=>()=>{const[n,o,a]=Kx({...e,sourcePosition:e.sourcePosition??ud.Bottom,targetPosition:e.targetPosition??ud.Top});return w(tp,{path:n,labelX:o,labelY:a,...t,...e})}}),sp=x({name:"SimpleBezierEdge",props:["sourcePosition","targetPosition","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","markerEnd","markerStart","interactionWidth"],compatConfig:{MODE:3},setup:(e,{attrs:t})=>()=>{const[n,o,a]=Qx({...e,sourcePosition:e.sourcePosition??ud.Bottom,targetPosition:e.targetPosition??ud.Top});return w(tp,{path:n,labelX:o,labelY:a,...t,...e})}}),lp={input:Xd,default:zd,output:Gd},up={default:rp,straight:op,step:ip,smoothstep:ap,simplebezier:sp},cp=class e{constructor(){this.currentId=0,this.flows=new Map}static getInstance(){var t;const n=null==(t=N())?void 0:t.appContext.app;return e.instance=(null==n?void 0:n.config.globalProperties.$vueFlowStorage)??e.instance??new e,n&&(n.config.globalProperties.$vueFlowStorage=e.instance),e.instance}set(e,t){return this.flows.set(e,t)}get(e){return this.flows.get(e)}remove(e){return this.flows.delete(e)}create(e,t){const n=I(Hx()),o={};for(const[c,d]of Object.entries(n.hooks))o[`on${c.charAt(0).toUpperCase()+c.slice(1)}`]=d.on;const a={};for(const[c,d]of Object.entries(n.hooks))a[c]=d.trigger;const i=C((()=>{const e=new Map;for(const t of n.nodes)e.set(t.id,t);return e})),r=C((()=>{const e=new Map;for(const t of n.edges)e.set(t.id,t);return e})),s=function(e,t,n){const o=C((()=>e=>t.value.get(e))),a=C((()=>e=>n.value.get(e))),i=C((()=>{const t={...up,...e.edgeTypes},n=Object.keys(t);for(const o of e.edges)o.type&&!n.includes(o.type)&&(t[o.type]=o.type);return t})),r=C((()=>{const t={...lp,...e.nodeTypes},n=Object.keys(t);for(const o of e.nodes)o.type&&!n.includes(o.type)&&(t[o.type]=o.type);return t})),s=C((()=>e.onlyRenderVisibleElements?Uk(e.nodes,{x:0,y:0,width:e.dimensions.width,height:e.dimensions.height},e.viewport,!0):e.nodes)),l=C((()=>{if(e.onlyRenderVisibleElements){const n=[];for(const o of e.edges){const a=t.value.get(o.source),i=t.value.get(o.target);fx({sourcePos:a.computedPosition||{x:0,y:0},targetPos:i.computedPosition||{x:0,y:0},sourceWidth:a.dimensions.width,sourceHeight:a.dimensions.height,targetWidth:i.dimensions.width,targetHeight:i.dimensions.height,width:e.dimensions.width,height:e.dimensions.height,viewport:e.viewport})&&n.push(o)}return n}return e.edges})),u=C((()=>[...s.value,...l.value])),c=C((()=>{const t=[];for(const n of e.nodes)n.selected&&t.push(n);return t})),d=C((()=>{const t=[];for(const n of e.edges)n.selected&&t.push(n);return t})),p=C((()=>[...c.value,...d.value])),f=C((()=>{const t=[];for(const n of e.nodes)n.dimensions.width&&n.dimensions.height&&void 0!==n.handleBounds&&t.push(n);return t}));return{getNode:o,getEdge:a,getElements:u,getEdgeTypes:i,getNodeTypes:r,getEdges:l,getNodes:s,getSelectedElements:p,getSelectedNodes:c,getSelectedEdges:d,getNodesInitialized:f,areNodesInitialized:C((()=>s.value.length>0&&f.value.length===s.value.length))}}(n,i,r),l=Gx(n,i,r);l.setState({...n,...t});const u={...o,...s,...l,...tv(n),nodeLookup:i,edgeLookup:r,emits:a,id:e,vueFlowVersion:"1.48.0",$destroy:()=>{this.remove(e)}};return this.set(e,u),u}getId(){return"vue-flow-"+this.currentId++}},dp=x({name:"UserSelection",compatConfig:{MODE:3},props:{userSelectionRect:{}},setup:e=>(e,t)=>(a(),m("div",{class:"vue-flow__selection vue-flow__container",style:ye({width:`${e.userSelectionRect.width}px`,height:`${e.userSelectionRect.height}px`,transform:`translate(${e.userSelectionRect.x}px, ${e.userSelectionRect.y}px)`})},null,4))}),pp=["tabIndex"],fp=x({name:"NodesSelection",compatConfig:{MODE:3},setup(e){const{emits:t,viewport:n,getSelectedNodes:o,noPanClassName:i,disableKeyboardA11y:r,userSelectionActive:s}=oI(),l=Fx(),u=v(null),d=Mx({el:u,onStart(e){t.selectionDragStart(e),t.nodeDragStart(e)},onDrag(e){t.selectionDrag(e),t.nodeDrag(e)},onStop(e){t.selectionDragStop(e),t.nodeDragStop(e)}});B((()=>{var e;r.value||null==(e=u.value)||e.focus({preventScroll:!0})}));const p=C((()=>Wk(o.value))),f=C((()=>({width:`${p.value.width}px`,height:`${p.value.height}px`,top:`${p.value.y}px`,left:`${p.value.x}px`})));function h(e){t.selectionContextMenu({event:e,nodes:o.value})}function y(e){r.value||kd[e.key]&&(e.preventDefault(),l({x:kd[e.key].x,y:kd[e.key].y},e.shiftKey))}return(e,t)=>!$(s)&&p.value.width&&p.value.height?(a(),m("div",{key:0,class:F(["vue-flow__nodesselection vue-flow__container",$(i)]),style:ye({transform:`translate(${$(n).x}px,${$(n).y}px) scale(${$(n).zoom})`})},[c("div",{ref_key:"el",ref:u,class:F([{dragging:$(d)},"vue-flow__nodesselection-rect"]),style:ye(f.value),tabIndex:$(r)?void 0:-1,onContextmenu:h,onKeydown:y},null,46,pp)],6)):P("",!0)}}),mp=x({name:"Pane",compatConfig:{MODE:3},props:{isSelecting:{type:Boolean},selectionKeyPressed:{type:Boolean}},setup(e){const{vueFlowRef:t,nodes:n,viewport:o,emits:i,userSelectionActive:r,removeSelectedElements:s,userSelectionRect:l,elementsSelectable:c,nodesSelectionActive:d,getSelectedEdges:p,getSelectedNodes:f,removeNodes:h,removeEdges:y,selectionMode:g,deleteKeyCode:w,multiSelectionKeyCode:b,multiSelectionActive:k,edgeLookup:x,nodeLookup:I,connectionLookup:N,defaultEdgeOptions:S,connectionStartHandle:T}=oI(),E=v(null),A=v(new Set),C=v(new Set),_=v(),D=u((()=>c.value&&(e.isSelecting||r.value))),O=u((()=>null!==T.value));let M=!1,L=!1;const j=xk(w,{actInsideInputWithModifier:!1}),B=xk(b);function V(e,t){return n=>{n.target===t&&e?.(n)}}function R(e){M||O.value?M=!1:(i.paneClick(e),s(),d.value=!1)}function W(e){e.preventDefault(),e.stopPropagation(),i.paneContextMenu(e)}function U(e){i.paneScroll(e)}return Y(j,(e=>{e&&(h(f.value),y(p.value),d.value=!1)})),Y(B,(e=>{k.value=e})),(u,p)=>(a(),m("div",{ref_key:"container",ref:E,class:F(["vue-flow__pane vue-flow__container",{selection:u.isSelecting}]),onClick:p[0]||(p[0]=e=>D.value?void 0:V(R,E.value)(e)),onContextmenu:p[1]||(p[1]=e=>V(W,E.value)(e)),onWheelPassive:p[2]||(p[2]=e=>V(U,E.value)(e)),onPointerenter:p[3]||(p[3]=e=>D.value?void 0:$(i).paneMouseEnter(e)),onPointerdown:p[4]||(p[4]=n=>D.value?function(n){var o,a,r;if(_.value=null==(o=t.value)?void 0:o.getBoundingClientRect(),!c.value||!e.isSelecting||0!==n.button||n.target!==E.value||!_.value)return;null==(r=null==(a=n.target)?void 0:a.setPointerCapture)||r.call(a,n.pointerId);const{x:u,y:d}=function(e,t){return{x:e.clientX-t.left,y:e.clientY-t.top}}(n,_.value);L=!0,M=!1,s(),l.value={width:0,height:0,startX:u,startY:d,x:u,y:d},i.selectionStart(n)}(n):$(i).paneMouseMove(n)),onPointermove:p[5]||(p[5]=e=>D.value?function(e){var t;if(!_.value||!l.value)return;M=!0;const{x:a,y:s}=yx(e,_.value),{startX:u=0,startY:c=0}=l.value,p={startX:u,startY:c,x:a<u?a:u,y:s<c?s:c,width:Math.abs(a-u),height:Math.abs(s-c)},f=A.value,m=C.value;A.value=new Set(Uk(n.value,p,o.value,g.value===cd.Partial,!0).map((e=>e.id))),C.value=new Set;const h=(null==(t=S.value)?void 0:t.selectable)??!0;for(const n of A.value){const e=N.value.get(n);if(e)for(const{edgeId:t}of e.values()){const e=x.value.get(t);e&&(e.selectable??h)&&C.value.add(t)}}if(!Dx(f,A.value)){const e=ax(I.value,A.value,!0);i.nodesChange(e)}if(!Dx(m,C.value)){const e=ax(x.value,C.value);i.edgesChange(e)}l.value=p,r.value=!0,d.value=!1}(e):$(i).paneMouseMove(e)),onPointerup:p[6]||(p[6]=t=>D.value?function(t){var n;0===t.button&&L&&(null==(n=t.target)||n.releasePointerCapture(t.pointerId),!r.value&&l.value&&t.target===E.value&&R(t),r.value=!1,l.value=null,d.value=A.value.size>0,i.selectionEnd(t),e.selectionKeyPressed&&(M=!1),L=!1)}(t):void 0),onPointerleave:p[7]||(p[7]=e=>$(i).paneMouseLeave(e))},[K(u.$slots,"default"),$(r)&&$(l)?(a(),fe(dp,{key:0,"user-selection-rect":$(l)},null,8,["user-selection-rect"])):P("",!0),$(d)&&$(f).length?(a(),fe(fp,{key:1})):P("",!0)],34))}}),hp=x({name:"Transform",compatConfig:{MODE:3},setup(e){const{viewport:t,fitViewOnInit:n,fitViewOnInitDone:o}=oI(),i=C((()=>!!n.value&&!o.value)),r=C((()=>`translate(${t.value.x}px,${t.value.y}px) scale(${t.value.zoom})`));return(e,t)=>(a(),m("div",{class:"vue-flow__transformationpane vue-flow__container",style:ye({transform:r.value,opacity:i.value?0:void 0})},[K(e.$slots,"default")],4))}}),yp=x({name:"Viewport",compatConfig:{MODE:3},setup(e){const{minZoom:t,maxZoom:n,defaultViewport:o,translateExtent:i,zoomActivationKeyCode:r,selectionKeyCode:s,panActivationKeyCode:l,panOnScroll:c,panOnScrollMode:d,panOnScrollSpeed:p,panOnDrag:f,zoomOnDoubleClick:h,zoomOnPinch:y,zoomOnScroll:v,preventScrolling:g,noWheelClassName:w,noPanClassName:b,emits:k,connectionStartHandle:x,userSelectionActive:I,paneDragging:N,d3Zoom:S,d3Selection:T,d3ZoomHandler:E,viewport:C,viewportRef:_,paneClickDistance:P}=oI();!function(e){const{emits:t,dimensions:n}=oI();let o;B((()=>{const a=()=>{var o,a;if(!e.value||!((null==(a=(o=e.value).checkVisibility)?void 0:a.call(o))??1))return;const i=Sk(e.value);0!==i.width&&0!==i.height||t.error(new Sd(Id.MISSING_VIEWPORT_DIMENSIONS)),n.value={width:i.width||500,height:i.height||500}};a(),window.addEventListener("resize",a),e.value&&(o=new ResizeObserver((()=>a())),o.observe(e.value)),se((()=>{window.removeEventListener("resize",a),o&&e.value&&o.unobserve(e.value)}))}))}(_);const D=A(!1),O=A(!1);let M=null,L=!1,j=0,V={x:0,y:0,zoom:0};const R=xk(l),W=xk(s),U=xk(r),z=u((()=>(!W.value||W.value&&!0===s.value)&&(R.value||f.value))),H=u((()=>R.value||c.value)),G=u((()=>W.value||!0===s.value&&!0!==z.value)),X=u((()=>null!==x.value));function q(e,t){return 2===t&&Array.isArray(e)&&e.includes(2)}function J(e){return{x:e.x,y:e.y,zoom:e.k}}function Q(e,t){return e.target.closest(`.${t}`)}return B((()=>{if(!_.value)return void Ix("Viewport element is missing");const e=_.value,a=e.getBoundingClientRect(),r=function(){var e,t,n,o=mk,a=hk,i=wk,r=vk,s=gk,l=[0,1/0],u=[[-1/0,-1/0],[1/0,1/0]],c=250,d=jc,p=lv("start","zoom","end"),f=500,m=0,h=10;function y(e){e.property("__zoom",yk).on("wheel.zoom",I,{passive:!1}).on("mousedown.zoom",N).on("dblclick.zoom",S).filter(s).on("touchstart.zoom",T).on("touchmove.zoom",E).on("touchend.zoom touchcancel.zoom",A).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function v(e,t){return(t=Math.max(l[0],Math.min(l[1],t)))===e.k?e:new dk(t,e.x,e.y)}function g(e,t,n){var o=t[0]-n[0]*e.k,a=t[1]-n[1]*e.k;return o===e.x&&a===e.y?e:new dk(e.k,o,a)}function w(e){return[(+e[0][0]+ +e[1][0])/2,(+e[0][1]+ +e[1][1])/2]}function b(e,t,n,o){e.on("start.zoom",(function(){k(this,arguments).event(o).start()})).on("interrupt.zoom end.zoom",(function(){k(this,arguments).event(o).end()})).tween("zoom",(function(){var e=this,i=arguments,r=k(e,i).event(o),s=a.apply(e,i),l=null==n?w(s):"function"==typeof n?n.apply(e,i):n,u=Math.max(s[1][0]-s[0][0],s[1][1]-s[0][1]),c=e.__zoom,p="function"==typeof t?t.apply(e,i):t,f=d(c.invert(l).concat(u/c.k),p.invert(l).concat(u/p.k));return function(e){if(1===e)e=p;else{var t=f(e),n=u/t[2];e=new dk(n,l[0]-t[0]*n,l[1]-t[1]*n)}r.zoom(null,e)}}))}function k(e,t,n){return!n&&e.__zooming||new x(e,t)}function x(e,t){this.that=e,this.args=t,this.active=0,this.sourceEvent=null,this.extent=a.apply(e,t),this.taps=0}function I(e,...t){if(o.apply(this,arguments)){var n=k(this,t).event(e),a=this.__zoom,s=Math.max(l[0],Math.min(l[1],a.k*Math.pow(2,r.apply(this,arguments)))),c=aw(e);if(n.wheel)n.mouse[0][0]===c[0]&&n.mouse[0][1]===c[1]||(n.mouse[1]=a.invert(n.mouse[0]=c)),clearTimeout(n.wheel);else{if(a.k===s)return;n.mouse=[c,a.invert(c)],pb(this),n.start()}fk(e),n.wheel=setTimeout(d,150),n.zoom("mouse",i(g(v(a,s),n.mouse[0],n.mouse[1]),n.extent,u))}function d(){n.wheel=null,n.end()}}function N(e,...t){if(!n&&o.apply(this,arguments)){var a=e.currentTarget,r=k(this,t,!0).event(e),s=ow(e.view).on("mousemove.zoom",p,!0).on("mouseup.zoom",f,!0),l=aw(e,a),c=e.clientX,d=e.clientY;sw(e.view),pk(e),r.mouse=[l,this.__zoom.invert(l)],pb(this),r.start()}function p(e){if(fk(e),!r.moved){var t=e.clientX-c,n=e.clientY-d;r.moved=t*t+n*n>m}r.event(e).zoom("mouse",i(g(r.that.__zoom,r.mouse[0]=aw(e,a),r.mouse[1]),r.extent,u))}function f(e){s.on("mousemove.zoom mouseup.zoom",null),lw(e.view,r.moved),fk(e),r.event(e).end()}}function S(e,...t){if(o.apply(this,arguments)){var n=this.__zoom,r=aw(e.changedTouches?e.changedTouches[0]:e,this),s=n.invert(r),l=n.k*(e.shiftKey?.5:2),d=i(g(v(n,l),r,s),a.apply(this,t),u);fk(e),c>0?ow(this).transition().duration(c).call(b,d,r,e):ow(this).call(y.transform,d,r,e)}}function T(n,...a){if(o.apply(this,arguments)){var i,r,s,l,u=n.touches,c=u.length,d=k(this,a,n.changedTouches.length===c).event(n);for(pk(n),r=0;r<c;++r)l=[l=aw(s=u[r],this),this.__zoom.invert(l),s.identifier],d.touch0?d.touch1||d.touch0[2]===l[2]||(d.touch1=l,d.taps=0):(d.touch0=l,i=!0,d.taps=1+!!e);e&&(e=clearTimeout(e)),i&&(d.taps<2&&(t=l[0],e=setTimeout((function(){e=null}),f)),pb(this),d.start())}}function E(e,...t){if(this.__zooming){var n,o,a,r,s=k(this,t).event(e),l=e.changedTouches,c=l.length;for(fk(e),n=0;n<c;++n)a=aw(o=l[n],this),s.touch0&&s.touch0[2]===o.identifier?s.touch0[0]=a:s.touch1&&s.touch1[2]===o.identifier&&(s.touch1[0]=a);if(o=s.that.__zoom,s.touch1){var d=s.touch0[0],p=s.touch0[1],f=s.touch1[0],m=s.touch1[1],h=(h=f[0]-d[0])*h+(h=f[1]-d[1])*h,y=(y=m[0]-p[0])*y+(y=m[1]-p[1])*y;o=v(o,Math.sqrt(h/y)),a=[(d[0]+f[0])/2,(d[1]+f[1])/2],r=[(p[0]+m[0])/2,(p[1]+m[1])/2]}else{if(!s.touch0)return;a=s.touch0[0],r=s.touch0[1]}s.zoom("touch",i(g(o,a,r),s.extent,u))}}function A(e,...o){if(this.__zooming){var a,i,r=k(this,o).event(e),s=e.changedTouches,l=s.length;for(pk(e),n&&clearTimeout(n),n=setTimeout((function(){n=null}),f),a=0;a<l;++a)i=s[a],r.touch0&&r.touch0[2]===i.identifier?delete r.touch0:r.touch1&&r.touch1[2]===i.identifier&&delete r.touch1;if(r.touch1&&!r.touch0&&(r.touch0=r.touch1,delete r.touch1),r.touch0)r.touch0[1]=this.__zoom.invert(r.touch0[0]);else if(r.end(),2===r.taps&&(i=aw(i,this),Math.hypot(t[0]-i[0],t[1]-i[1])<h)){var u=ow(this).on("dblclick.zoom");u&&u.apply(this,arguments)}}}return y.transform=function(e,t,n,o){var a=e.selection?e.selection():e;a.property("__zoom",yk),e!==a?b(e,t,n,o):a.interrupt().each((function(){k(this,arguments).event(o).start().zoom(null,"function"==typeof t?t.apply(this,arguments):t).end()}))},y.scaleBy=function(e,t,n,o){y.scaleTo(e,(function(){return this.__zoom.k*("function"==typeof t?t.apply(this,arguments):t)}),n,o)},y.scaleTo=function(e,t,n,o){y.transform(e,(function(){var e=a.apply(this,arguments),o=this.__zoom,r=null==n?w(e):"function"==typeof n?n.apply(this,arguments):n,s=o.invert(r),l="function"==typeof t?t.apply(this,arguments):t;return i(g(v(o,l),r,s),e,u)}),n,o)},y.translateBy=function(e,t,n,o){y.transform(e,(function(){return i(this.__zoom.translate("function"==typeof t?t.apply(this,arguments):t,"function"==typeof n?n.apply(this,arguments):n),a.apply(this,arguments),u)}),null,o)},y.translateTo=function(e,t,n,o,r){y.transform(e,(function(){var e=a.apply(this,arguments),r=this.__zoom,s=null==o?w(e):"function"==typeof o?o.apply(this,arguments):o;return i(ld.translate(s[0],s[1]).scale(r.k).translate("function"==typeof t?-t.apply(this,arguments):-t,"function"==typeof n?-n.apply(this,arguments):-n),e,u)}),o,r)},x.prototype={event:function(e){return e&&(this.sourceEvent=e),this},start:function(){return 1==++this.active&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(e,t){return this.mouse&&"mouse"!==e&&(this.mouse[1]=t.invert(this.mouse[0])),this.touch0&&"touch"!==e&&(this.touch0[1]=t.invert(this.touch0[0])),this.touch1&&"touch"!==e&&(this.touch1[1]=t.invert(this.touch1[0])),this.that.__zoom=t,this.emit("zoom"),this},end:function(){return 0==--this.active&&(delete this.that.__zooming,this.emit("end")),this},emit:function(e){var t=ow(this.that).datum();p.call(e,this.that,new ck(e,{sourceEvent:this.sourceEvent,target:y,type:e,transform:this.that.__zoom,dispatch:p}),t)}},y.wheelDelta=function(e){return arguments.length?(r="function"==typeof e?e:sd(+e),y):r},y.filter=function(e){return arguments.length?(o="function"==typeof e?e:sd(!!e),y):o},y.touchable=function(e){return arguments.length?(s="function"==typeof e?e:sd(!!e),y):s},y.extent=function(e){return arguments.length?(a="function"==typeof e?e:sd([[+e[0][0],+e[0][1]],[+e[1][0],+e[1][1]]]),y):a},y.scaleExtent=function(e){return arguments.length?(l[0]=+e[0],l[1]=+e[1],y):[l[0],l[1]]},y.translateExtent=function(e){return arguments.length?(u[0][0]=+e[0][0],u[1][0]=+e[1][0],u[0][1]=+e[0][1],u[1][1]=+e[1][1],y):[[u[0][0],u[0][1]],[u[1][0],u[1][1]]]},y.constrain=function(e){return arguments.length?(i=e,y):i},y.duration=function(e){return arguments.length?(c=+e,y):c},y.interpolate=function(e){return arguments.length?(d=e,y):d},y.on=function(){var e=p.on.apply(p,arguments);return e===p?y:e},y.clickDistance=function(e){return arguments.length?(m=(e=+e)*e,y):Math.sqrt(m)},y.tapDistance=function(e){return arguments.length?(h=+e,y):h},y}().clickDistance(P.value).scaleExtent([t.value,n.value]).translateExtent(i.value),l=ow(e).call(r),u=l.on("wheel.zoom"),m=ld.translate(o.value.x??0,o.value.y??0).scale(Tk(o.value.zoom??1,t.value,n.value)),x=[[0,0],[a.width,a.height]],A=r.constrain()(m,x,i.value);r.transform(l,A),r.wheelDelta(qk),S.value=r,T.value=l,E.value=u,C.value={x:A.x,y:A.y,zoom:A.k},r.on("start",(e=>{var t;if(!e.sourceEvent)return null;j=e.sourceEvent.button,D.value=!0;const n=J(e.transform);"mousedown"===(null==(t=e.sourceEvent)?void 0:t.type)&&(N.value=!0),V=n,k.viewportChangeStart(n),k.moveStart({event:e,flowTransform:n})})),r.on("end",(e=>{if(!e.sourceEvent)return null;if(D.value=!1,N.value=!1,q(z.value,j??0)&&!L&&k.paneContextMenu(e.sourceEvent),L=!1,t=V,n=e.transform,t.x!==n.x&&!Number.isNaN(n.x)||t.y!==n.y&&!Number.isNaN(n.y)||t.zoom!==n.k&&!Number.isNaN(n.k)){const t=J(e.transform);V=t,k.viewportChangeEnd(t),k.moveEnd({event:e,flowTransform:t})}var t,n})),r.filter((e=>{var t;const n=U.value||v.value,o=y.value&&e.ctrlKey,a=e.button,i="wheel"===e.type;if(1===a&&"mousedown"===e.type&&(Q(e,"vue-flow__node")||Q(e,"vue-flow__edge")))return!0;if(!(z.value||n||H.value||h.value||y.value))return!1;if(I.value)return!1;if(X.value&&!i)return!1;if(!h.value&&"dblclick"===e.type)return!1;if(Q(e,w.value)&&i)return!1;if(Q(e,b.value)&&(!i||H.value&&i&&!U.value))return!1;if(!y.value&&e.ctrlKey&&i)return!1;if(!n&&!H.value&&!o&&i)return!1;if(!y&&"touchstart"===e.type&&(null==(t=e.touches)?void 0:t.length)>1)return e.preventDefault(),!1;if(!z.value&&("mousedown"===e.type||"touchstart"===e.type))return!1;if(!0===s.value&&Array.isArray(f.value)&&f.value.includes(0)&&0===a)return!1;if(Array.isArray(f.value)&&!f.value.includes(a)&&("mousedown"===e.type||"touchstart"===e.type))return!1;const r=Array.isArray(f.value)&&f.value.includes(a)||!0===s.value&&Array.isArray(f.value)&&!f.value.includes(0)||!a||a<=1;return(!e.ctrlKey||R.value||i)&&r})),Y([I,z],(()=>{I.value&&!D.value?r.on("zoom",null):I.value||r.on("zoom",(e=>{C.value={x:e.transform.x,y:e.transform.y,zoom:e.transform.k};const t=J(e.transform);L=q(z.value,j??0),k.viewportChange(t),k.move({event:e,flowTransform:t})}))}),{immediate:!0}),Y([I,H,d,U,y,g,w],(()=>{!H.value||U.value||I.value?void 0!==u&&l.on("wheel.zoom",(function(e,t){const n=!g.value&&"wheel"===e.type&&!e.ctrlKey,o=U.value||v.value,a=y.value&&e.ctrlKey;if(!o&&!c.value&&!a&&"wheel"===e.type||n||Q(e,w.value))return null;e.preventDefault(),u.call(this,e,t)}),{passive:!1}):l.on("wheel.zoom",(e=>{if(Q(e,w.value))return!1;const t=U.value||v.value,n=y.value&&e.ctrlKey;if(g.value&&!H.value&&!t&&!n)return!1;e.preventDefault(),e.stopImmediatePropagation();const o=l.property("__zoom").k||1,a=Td();if(!R.value&&e.ctrlKey&&y.value&&a){const t=aw(e),n=o*2**qk(e);return void r.scaleTo(l,n,t,e)}const i=1===e.deltaMode?20:1;let s=d.value===md.Vertical?0:e.deltaX*i,u=d.value===md.Horizontal?0:e.deltaY*i;!a&&e.shiftKey&&d.value!==md.Vertical&&!s&&u&&(s=u,u=0),r.translateBy(l,-s/o*p.value,-u/o*p.value);const c=J(l.property("__zoom"));M&&clearTimeout(M),O.value?(k.move({event:e,flowTransform:c}),k.viewportChange(c),M=setTimeout((()=>{k.moveEnd({event:e,flowTransform:c}),k.viewportChangeEnd(c),O.value=!1}),150)):(O.value=!0,k.moveStart({event:e,flowTransform:c}),k.viewportChangeStart(c))}),{passive:!1})}),{immediate:!0})})),(e,t)=>(a(),m("div",{ref_key:"viewportRef",ref:_,class:"vue-flow__viewport vue-flow__container"},[Z(mp,{"is-selecting":G.value,"selection-key-pressed":$(W),class:F({connecting:X.value,dragging:$(N),draggable:!0===$(f)||Array.isArray($(f))&&$(f).includes(0)})},{default:ve((()=>[Z(hp,null,{default:ve((()=>[K(e.$slots,"default")])),_:3})])),_:3},8,["is-selecting","selection-key-pressed","class"])],512))}}),vp=["id"],gp=["id"],wp=["id"],bp=x({name:"A11yDescriptions",compatConfig:{MODE:3},setup(e){const{id:t,disableKeyboardA11y:n,ariaLiveMessage:o}=oI();return(e,i)=>(a(),m(R,null,[c("div",{id:`${$(gd)}-${$(t)}`,style:{display:"none"}}," Press enter or space to select a node. "+_($(n)?"":"You can then use the arrow keys to move the node around.")+" You can then use the arrow keys to move the node around, press delete to remove it and press escape to cancel. ",9,vp),c("div",{id:`${$(wd)}-${$(t)}`,style:{display:"none"}}," Press enter or space to select an edge. You can then press delete to remove it or press escape to cancel. ",8,gp),$(n)?P("",!0):(a(),m("div",{key:0,id:`${$("vue-flow__aria-live")}-${$(t)}`,"aria-live":"assertive","aria-atomic":"true",style:{position:"absolute",width:"1px",height:"1px",margin:"-1px",border:"0",padding:"0",overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)","clip-path":"inset(100%)"}},_($(o)),9,wp))],64))}}),(kp=function({radius:e=10,centerX:t=0,centerY:n=0,position:o=ud.Top,type:a}){return w("circle",{class:`vue-flow__edgeupdater vue-flow__edgeupdater-${a}`,cx:aI(t,e,o),cy:iI(n,e,o),r:e,stroke:"transparent",fill:"transparent"})}).props=["radius","centerX","centerY","position","type"],kp.compatConfig={MODE:3},xp=kp,Ip=x({name:"Edge",compatConfig:{MODE:3},props:["id"],setup(e){const{id:t,addSelectedEdges:n,connectionMode:o,edgeUpdaterRadius:a,emits:i,nodesSelectionActive:r,noPanClassName:s,getEdgeTypes:l,removeSelectedEdges:c,findEdge:d,findNode:p,isValidConnection:f,multiSelectionActive:m,disableKeyboardA11y:h,elementsSelectable:y,edgesUpdatable:g,edgesFocusable:b,hooks:k}=oI(),x=C((()=>d(e.id))),{emit:I,on:S}=Lx(x.value,i),T=E(jd),A=N(),_=v(!1),P=v(!1),D=v(""),O=v(null),M=v("source"),L=v(null),j=u((()=>void 0===x.value.selectable?y.value:x.value.selectable)),$=u((()=>void 0===x.value.updatable?g.value:x.value.updatable)),B=u((()=>void 0===x.value.focusable?b.value:x.value.focusable));pe(Md,e.id),pe(Ld,L);const V=C((()=>x.value.class instanceof Function?x.value.class(x.value):x.value.class)),R=C((()=>x.value.style instanceof Function?x.value.style(x.value):x.value.style)),F=C((()=>{const e=x.value.type||"default",t=null==T?void 0:T[`edge-${e}`];if(t)return t;let n=x.value.template??l.value[e];if("string"==typeof n&&A){const t=Object.keys(A.appContext.components);t&&t.includes(e)&&(n=U(e,!1))}return n&&"string"!=typeof n?n:(i.error(new Sd(Id.EDGE_TYPE_MISSING,n)),!1)})),{handlePointerDown:W}=Bx({nodeId:D,handleId:O,type:M,isValidConnection:f,edgeUpdaterType:M,onEdgeUpdate:function(e,t){I.update({event:e,edge:x.value,connection:t})},onEdgeUpdateEnd:function(e){I.updateEnd({event:e,edge:x.value}),P.value=!1}});return()=>{const n=p(x.value.source),r=p(x.value.target),u="pathOptions"in x.value?x.value.pathOptions:{};if(!n&&!r)return i.error(new Sd(Id.EDGE_SOURCE_TARGET_MISSING,x.value.id,x.value.source,x.value.target)),null;if(!n)return i.error(new Sd(Id.EDGE_SOURCE_MISSING,x.value.id,x.value.source)),null;if(!r)return i.error(new Sd(Id.EDGE_TARGET_MISSING,x.value.id,x.value.target)),null;if(!x.value||x.value.hidden||n.hidden||r.hidden)return null;let c;c=o.value===pd.Strict?n.handleBounds.source:[...n.handleBounds.source||[],...n.handleBounds.target||[]];const d=px(c,x.value.sourceHandle);let f;f=o.value===pd.Strict?r.handleBounds.target:[...r.handleBounds.target||[],...r.handleBounds.source||[]];const m=px(f,x.value.targetHandle),h=(null==d?void 0:d.position)||ud.Bottom,y=(null==m?void 0:m.position)||ud.Top,{x:v,y:g}=dx(n,d,h),{x:b,y:I}=dx(r,m,y);return x.value.sourceX=v,x.value.sourceY=g,x.value.targetX=b,x.value.targetY=I,w("g",{ref:L,key:e.id,"data-id":e.id,class:["vue-flow__edge",`vue-flow__edge-${!1===F.value?"default":x.value.type||"default"}`,s.value,V.value,{updating:_.value,selected:x.value.selected,animated:x.value.animated,inactive:!j.value&&!k.value.edgeClick.hasListeners()}],tabIndex:B.value?0:void 0,"aria-label":null===x.value.ariaLabel?void 0:x.value.ariaLabel??`Edge from ${x.value.source} to ${x.value.target}`,"aria-describedby":B.value?`${wd}-${t}`:void 0,"aria-roledescription":"edge",role:B.value?"group":"img",...x.value.domAttributes,onClick:Y,onContextmenu:X,onDblclick:q,onMouseenter:J,onMousemove:K,onMouseleave:Z,onKeyDown:B.value?te:void 0},[P.value?null:w(!1===F.value?l.value.default:F.value,{id:e.id,sourceNode:n,targetNode:r,source:x.value.source,target:x.value.target,type:x.value.type,updatable:$.value,selected:x.value.selected,animated:x.value.animated,label:x.value.label,labelStyle:x.value.labelStyle,labelShowBg:x.value.labelShowBg,labelBgStyle:x.value.labelBgStyle,labelBgPadding:x.value.labelBgPadding,labelBgBorderRadius:x.value.labelBgBorderRadius,data:x.value.data,events:{...x.value.events,...S},style:R.value,markerStart:`url('#${Xk(x.value.markerStart,t)}')`,markerEnd:`url('#${Xk(x.value.markerEnd,t)}')`,sourcePosition:h,targetPosition:y,sourceX:v,sourceY:g,targetX:b,targetY:I,sourceHandleId:x.value.sourceHandle,targetHandleId:x.value.targetHandle,interactionWidth:x.value.interactionWidth,...u}),["source"===$.value||!0===$.value?[w("g",{onMousedown:Q,onMouseenter:z,onMouseout:H},w(xp,{position:h,centerX:v,centerY:g,radius:a.value,type:"source","data-type":"source"}))]:null,"target"===$.value||!0===$.value?[w("g",{onMousedown:ee,onMouseenter:z,onMouseout:H},w(xp,{position:y,centerX:b,centerY:I,radius:a.value,type:"target","data-type":"target"}))]:null]])};function z(){_.value=!0}function H(){_.value=!1}function G(e,t){0===e.button&&(P.value=!0,D.value=t?x.value.target:x.value.source,O.value=(t?x.value.targetHandle:x.value.sourceHandle)??null,M.value=t?"target":"source",I.updateStart({event:e,edge:x.value}),W(e))}function Y(e){var t;const o={event:e,edge:x.value};j.value&&(r.value=!1,x.value.selected&&m.value?(c([x.value]),null==(t=L.value)||t.blur()):n([x.value])),I.click(o)}function X(e){I.contextMenu({event:e,edge:x.value})}function q(e){I.doubleClick({event:e,edge:x.value})}function J(e){I.mouseEnter({event:e,edge:x.value})}function K(e){I.mouseMove({event:e,edge:x.value})}function Z(e){I.mouseLeave({event:e,edge:x.value})}function Q(e){G(e,!0)}function ee(e){G(e,!1)}function te(t){var o;!h.value&&bd.includes(t.key)&&j.value&&("Escape"===t.key?(null==(o=L.value)||o.blur(),c([d(e.id)])):n([d(e.id)]))}}}),Np=x({name:"ConnectionLine",compatConfig:{MODE:3},setup(){var e;const{id:t,connectionMode:n,connectionStartHandle:o,connectionEndHandle:a,connectionPosition:i,connectionLineType:r,connectionLineStyle:s,connectionLineOptions:l,connectionStatus:u,viewport:c,findNode:d}=oI(),p=null==(e=E(jd))?void 0:e["connection-line"],f=C((()=>{var e;return d(null==(e=o.value)?void 0:e.nodeId)})),m=C((()=>{var e;return d(null==(e=a.value)?void 0:e.nodeId)??null})),h=C((()=>({x:(i.value.x-c.value.x)/c.value.zoom,y:(i.value.y-c.value.y)/c.value.zoom}))),y=C((()=>l.value.markerStart?`url(#${Xk(l.value.markerStart,t)})`:"")),v=C((()=>l.value.markerEnd?`url(#${Xk(l.value.markerEnd,t)})`:""));return()=>{var e,t,i;if(!f.value||!o.value)return null;const c=o.value.id,d=o.value.type,g=f.value.handleBounds;let b=(null==g?void 0:g[d])??[];if(n.value===pd.Loose){const e=(null==g?void 0:g["source"===d?"target":"source"])??[];b=[...b,...e]}if(!b)return null;const k=(c?b.find((e=>e.id===c)):b[0])??null,x=(null==k?void 0:k.position)??ud.Top,{x:I,y:N}=dx(f.value,k,x);let S=null;m.value&&(S=n.value===pd.Strict?(null==(e=m.value.handleBounds["source"===d?"target":"source"])?void 0:e.find((e=>{var t;return e.id===(null==(t=a.value)?void 0:t.id)})))||null:(null==(t=[...m.value.handleBounds.source??[],...m.value.handleBounds.target??[]])?void 0:t.find((e=>{var t;return e.id===(null==(t=a.value)?void 0:t.id)})))||null);const T=(null==(i=a.value)?void 0:i.position)??(x?Cd[x]:null);if(!x||!T)return null;const E=r.value??l.value.type??dd.Bezier;let A="";const C={sourceX:I,sourceY:N,sourcePosition:x,targetX:h.value.x,targetY:h.value.y,targetPosition:T};return E===dd.Bezier?[A]=Kx(C):E===dd.Step?[A]=nI({...C,borderRadius:0}):E===dd.SmoothStep?[A]=nI(C):E===dd.SimpleBezier?[A]=Qx(C):A=`M${I},${N} ${h.value.x},${h.value.y}`,w("svg",{class:"vue-flow__edges vue-flow__connectionline vue-flow__container"},w("g",{class:"vue-flow__connection"},p?w(p,{sourceX:I,sourceY:N,sourcePosition:x,targetX:h.value.x,targetY:h.value.y,targetPosition:T,sourceNode:f.value,sourceHandle:k,targetNode:m.value,targetHandle:S,markerEnd:v.value,markerStart:y.value,connectionStatus:u.value}):w("path",{d:A,class:[l.value.class,u.value,"vue-flow__connection-path"],style:{...s.value,...l.value.style},"marker-end":v.value,"marker-start":y.value})))}}}),Sp=["id","markerWidth","markerHeight","markerUnits","orient"],Tp=x({name:"MarkerType",compatConfig:{MODE:3},props:{id:{},type:{},color:{default:"none"},width:{default:12.5},height:{default:12.5},markerUnits:{default:"strokeWidth"},orient:{default:"auto-start-reverse"},strokeWidth:{default:1}},setup:e=>(e,t)=>(a(),m("marker",{id:e.id,class:"vue-flow__arrowhead",viewBox:"-10 -10 20 20",refX:"0",refY:"0",markerWidth:`${e.width}`,markerHeight:`${e.height}`,markerUnits:e.markerUnits,orient:e.orient},[e.type===$(fd).ArrowClosed?(a(),m("polyline",{key:0,style:ye({stroke:e.color,fill:e.color,strokeWidth:e.strokeWidth}),"stroke-linecap":"round","stroke-linejoin":"round",points:"-5,-4 0,0 -5,4 -5,-4"},null,4)):P("",!0),e.type===$(fd).Arrow?(a(),m("polyline",{key:1,style:ye({stroke:e.color,strokeWidth:e.strokeWidth}),"stroke-linecap":"round","stroke-linejoin":"round",fill:"none",points:"-5,-4 0,0 -5,4"},null,4)):P("",!0)],8,Sp))}),Ep={class:"vue-flow__marker vue-flow__container","aria-hidden":"true"},Ap=x({name:"MarkerDefinitions",compatConfig:{MODE:3},setup(e){const{id:t,edges:n,connectionLineOptions:o,defaultMarkerColor:i}=oI(),r=C((()=>{const e=new Set,a=[],r=n=>{if(n){const o=Xk(n,t);e.has(o)||("object"==typeof n?a.push({...n,id:o,color:n.color||i.value}):a.push({id:o,color:i.value,type:n}),e.add(o))}};for(const t of[o.value.markerEnd,o.value.markerStart])r(t);for(const t of n.value)for(const e of[t.markerStart,t.markerEnd])r(e);return a.sort(((e,t)=>e.id.localeCompare(t.id)))}));return(e,t)=>(a(),m("svg",Ep,[c("defs",null,[(a(!0),m(R,null,ue(r.value,(e=>(a(),fe(Tp,{id:e.id,key:e.id,type:e.type,color:e.color,width:e.width,height:e.height,markerUnits:e.markerUnits,"stroke-width":e.strokeWidth,orient:e.orient},null,8,["id","type","color","width","height","markerUnits","stroke-width","orient"])))),128))])]))}}),Cp=x({name:"Edges",compatConfig:{MODE:3},setup(e){const{findNode:t,getEdges:n,elevateEdgesOnSelect:o}=oI();return(e,i)=>(a(),m(R,null,[Z(Ap),(a(!0),m(R,null,ue($(n),(e=>(a(),m("svg",{key:e.id,class:"vue-flow__edges vue-flow__container",style:ye({zIndex:$(mx)(e,$(t),$(o))})},[Z($(Ip),{id:e.id},null,8,["id"])],4)))),128)),Z($(Np))],64))}}),_p=x({name:"Node",compatConfig:{MODE:3},props:["id","resizeObserver"],setup(e){const{id:t,noPanClassName:n,selectNodesOnDrag:o,nodesSelectionActive:a,multiSelectionActive:i,emits:r,removeSelectedNodes:s,addSelectedNodes:l,updateNodeDimensions:c,onUpdateNodeInternals:d,getNodeTypes:p,nodeExtent:f,elevateNodesOnSelect:m,disableKeyboardA11y:h,ariaLiveMessage:y,snapToGrid:g,snapGrid:b,nodeDragThreshold:k,nodesDraggable:x,elementsSelectable:I,nodesConnectable:S,nodesFocusable:T,hooks:A}=oI(),_=v(null);pe(Od,_),pe(Dd,e.id);const P=E(jd),D=N(),O=Fx(),{node:M,parentNode:L}=Vx(e.id),{emit:$,on:V}=Rx(M,r),R=u((()=>void 0===M.draggable?x.value:M.draggable)),F=u((()=>void 0===M.selectable?I.value:M.selectable)),W=u((()=>void 0===M.connectable?S.value:M.connectable)),z=u((()=>void 0===M.focusable?T.value:M.focusable)),H=C((()=>F.value||R.value||A.value.nodeClick.hasListeners()||A.value.nodeDoubleClick.hasListeners()||A.value.nodeMouseEnter.hasListeners()||A.value.nodeMouseMove.hasListeners()||A.value.nodeMouseLeave.hasListeners())),G=u((()=>!!M.dimensions.width&&!!M.dimensions.height)),X=C((()=>{const e=M.type||"default",t=null==P?void 0:P[`node-${e}`];if(t)return t;let n=M.template||p.value[e];if("string"==typeof n&&D){const t=Object.keys(D.appContext.components);t&&t.includes(e)&&(n=U(e,!1))}return n&&"string"!=typeof n?n:(r.error(new Sd(Id.NODE_TYPE_MISSING,n)),!1)})),q=Mx({id:e.id,el:_,disabled:()=>!R.value,selectable:F,dragHandle:()=>M.dragHandle,onStart(e){$.dragStart(e)},onDrag(e){$.drag(e)},onStop(e){$.dragStop(e)},onClick(e){re(e)}}),J=C((()=>M.class instanceof Function?M.class(M):M.class)),K=C((()=>{const e=(M.style instanceof Function?M.style(M):M.style)||{},t=M.width instanceof Function?M.width(M):M.width,n=M.height instanceof Function?M.height(M):M.height;return!e.width&&t&&(e.width="string"==typeof t?t:`${t}px`),!e.height&&n&&(e.height="string"==typeof n?n:`${n}px`),e})),Z=u((()=>Number(M.zIndex??K.value.zIndex??0)));return d((t=>{!t.includes(e.id)&&t.length||ee()})),B((()=>{Y((()=>M.hidden),((t=!1,n,o)=>{!t&&_.value&&(e.resizeObserver.observe(_.value),o((()=>{_.value&&e.resizeObserver.unobserve(_.value)})))}),{immediate:!0,flush:"post"})})),Y([()=>M.type,()=>M.sourcePosition,()=>M.targetPosition],(()=>{j((()=>{c([{id:e.id,nodeElement:_.value,forceUpdate:!0}])}))})),Y([()=>M.position.x,()=>M.position.y,()=>{var e;return null==(e=L.value)?void 0:e.computedPosition.x},()=>{var e;return null==(e=L.value)?void 0:e.computedPosition.y},()=>{var e;return null==(e=L.value)?void 0:e.computedPosition.z},Z,()=>M.selected,()=>M.dimensions.height,()=>M.dimensions.width,()=>{var e;return null==(e=L.value)?void 0:e.dimensions.height},()=>{var e;return null==(e=L.value)?void 0:e.dimensions.width}],(([e,t,n,o,a,i])=>{const r={x:e,y:t,z:i+(m.value&&M.selected?1e3:0)};var s,l;M.computedPosition=void 0!==n&&void 0!==o?{x:(l=r).x+(s={x:n,y:o,z:a}).x,y:l.y+s.y,z:(s.z>l.z?s.z:l.z)+1}:r}),{flush:"post",immediate:!0}),Y([()=>M.extent,f],(([e,t],[n,o])=>{e===n&&t===o||Q()})),"parent"===M.extent||"object"==typeof M.extent&&"range"in M.extent&&"parent"===M.extent.range?ov((()=>G)).toBe(!0).then(Q):Q(),()=>M.hidden?null:w("div",{ref:_,"data-id":M.id,class:["vue-flow__node",`vue-flow__node-${!1===X.value?"default":M.type||"default"}`,{[n.value]:R.value,dragging:null==q?void 0:q.value,draggable:R.value,selected:M.selected,selectable:F.value,parent:M.isParent},J.value],style:{visibility:G.value?"visible":"hidden",zIndex:M.computedPosition.z??Z.value,transform:`translate(${M.computedPosition.x}px,${M.computedPosition.y}px)`,pointerEvents:H.value?"all":"none",...K.value},tabIndex:z.value?0:void 0,role:z.value?"group":void 0,"aria-describedby":h.value?void 0:`${gd}-${t}`,"aria-label":M.ariaLabel,"aria-roledescription":"node",...M.domAttributes,onMouseenter:te,onMousemove:ne,onMouseleave:oe,onContextmenu:ae,onClick:re,onDblclick:ie,onKeydown:se},[w(!1===X.value?p.value.default:X.value,{id:M.id,type:M.type,data:M.data,events:{...M.events,...V},selected:M.selected,resizing:M.resizing,dragging:q.value,connectable:W.value,position:M.computedPosition,dimensions:M.dimensions,isValidTargetPos:M.isValidTargetPos,isValidSourcePos:M.isValidSourcePos,parent:M.parentNode,parentNodeId:M.parentNode,zIndex:M.computedPosition.z??Z.value,targetPosition:M.targetPosition,sourcePosition:M.sourcePosition,label:M.label,dragHandle:M.dragHandle,onUpdateNodeInternals:ee})]);function Q(){const e=M.computedPosition,{computedPosition:t,position:n}=cx(M,g.value?vx(e,b.value):e,r.error,f.value,L.value);M.computedPosition.x===t.x&&M.computedPosition.y===t.y||(M.computedPosition={...M.computedPosition,...t}),M.position.x===n.x&&M.position.y===n.y||(M.position=n)}function ee(){_.value&&c([{id:e.id,nodeElement:_.value,forceUpdate:!0}])}function te(e){(null==q?void 0:q.value)||$.mouseEnter({event:e,node:M})}function ne(e){(null==q?void 0:q.value)||$.mouseMove({event:e,node:M})}function oe(e){(null==q?void 0:q.value)||$.mouseLeave({event:e,node:M})}function ae(e){return $.contextMenu({event:e,node:M})}function ie(e){return $.doubleClick({event:e,node:M})}function re(e){F.value&&(!o.value||!R.value||k.value>0)&&Tx(M,i.value,l,s,a,!1,_.value),$.click({event:e,node:M})}function se(e){if(!bk(e)&&!h.value)if(bd.includes(e.key)&&F.value){const t="Escape"===e.key;Tx(M,i.value,l,s,a,t,_.value)}else R.value&&M.selected&&kd[e.key]&&(e.preventDefault(),y.value=`Moved selected node ${e.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~M.position.x}, y: ${~~M.position.y}`,O({x:kd[e.key].x,y:kd[e.key].y},e.shiftKey))}}}),Pp={height:"0",width:"0"},e("_n",x({name:"EdgeLabelRenderer",compatConfig:{MODE:3},setup(e){const{viewportRef:t}=oI(),n=u((()=>{var e;return null==(e=t.value)?void 0:e.getElementsByClassName("vue-flow__edge-labels")[0]}));return(e,t)=>(a(),m("svg",null,[(a(),m("foreignObject",Pp,[(a(),fe(he,{to:n.value,disabled:!n.value},[K(e.$slots,"default")],8,["to","disabled"]))]))]))}})),Dp={class:"vue-flow__nodes vue-flow__container"},Op=x({name:"Nodes",compatConfig:{MODE:3},setup(e){const{getNodes:t,updateNodeDimensions:n,emits:o}=oI(),i=function(e={includeHiddenNodes:!1}){const{nodes:t}=oI();return C((()=>{if(0===t.value.length)return!1;for(const n of t.value)if((e.includeHiddenNodes||!n.hidden)&&(void 0===(null==n?void 0:n.handleBounds)||0===n.dimensions.width||0===n.dimensions.height))return!1;return!0}))}(),r=v();return Y(i,(e=>{e&&j((()=>{o.nodesInitialized(t.value)}))}),{immediate:!0}),B((()=>{r.value=new ResizeObserver((e=>{const t=e.map((e=>({id:e.target.getAttribute("data-id"),nodeElement:e.target,forceUpdate:!0})));j((()=>n(t)))}))})),se((()=>{var e;return null==(e=r.value)?void 0:e.disconnect()})),(e,n)=>(a(),m("div",Dp,[r.value?(a(!0),m(R,{key:0},ue($(t),((e,t,n,o)=>{const i=[e.id];if(o&&o.key===e.id&&ge(o,i))return o;const s=(a(),fe($(_p),{id:e.id,key:e.id,"resize-observer":r.value},null,8,["id","resize-observer"]));return s.memo=i,s}),n,0),128)):P("",!0)]))}}),Mp=c("div",{class:"vue-flow__edge-labels"},null,-1),e("gn",x({name:"VueFlow",compatConfig:{MODE:3},props:{id:{},modelValue:{},nodes:{},edges:{},edgeTypes:{},nodeTypes:{},connectionMode:{},connectionLineType:{},connectionLineStyle:{default:void 0},connectionLineOptions:{default:void 0},connectionRadius:{},isValidConnection:{type:[Function,null],default:void 0},deleteKeyCode:{default:void 0},selectionKeyCode:{type:[Boolean,null],default:void 0},multiSelectionKeyCode:{default:void 0},zoomActivationKeyCode:{default:void 0},panActivationKeyCode:{default:void 0},snapToGrid:{type:Boolean,default:void 0},snapGrid:{},onlyRenderVisibleElements:{type:Boolean,default:void 0},edgesUpdatable:{type:[Boolean,String],default:void 0},nodesDraggable:{type:Boolean,default:void 0},nodesConnectable:{type:Boolean,default:void 0},nodeDragThreshold:{},elementsSelectable:{type:Boolean,default:void 0},selectNodesOnDrag:{type:Boolean,default:void 0},panOnDrag:{type:[Boolean,Array],default:void 0},minZoom:{},maxZoom:{},defaultViewport:{},translateExtent:{},nodeExtent:{},defaultMarkerColor:{},zoomOnScroll:{type:Boolean,default:void 0},zoomOnPinch:{type:Boolean,default:void 0},panOnScroll:{type:Boolean,default:void 0},panOnScrollSpeed:{},panOnScrollMode:{},paneClickDistance:{},zoomOnDoubleClick:{type:Boolean,default:void 0},preventScrolling:{type:Boolean,default:void 0},selectionMode:{},edgeUpdaterRadius:{},fitViewOnInit:{type:Boolean,default:void 0},connectOnClick:{type:Boolean,default:void 0},applyDefault:{type:Boolean,default:void 0},autoConnect:{type:[Boolean,Function],default:void 0},noDragClassName:{},noWheelClassName:{},noPanClassName:{},defaultEdgeOptions:{},elevateEdgesOnSelect:{type:Boolean,default:void 0},elevateNodesOnSelect:{type:Boolean,default:void 0},disableKeyboardA11y:{type:Boolean,default:void 0},edgesFocusable:{type:Boolean,default:void 0},nodesFocusable:{type:Boolean,default:void 0},autoPanOnConnect:{type:Boolean,default:void 0},autoPanOnNodeDrag:{type:Boolean,default:void 0},autoPanSpeed:{}},emits:["nodesChange","edgesChange","nodesInitialized","paneReady","init","updateNodeInternals","error","connect","connectStart","connectEnd","clickConnectStart","clickConnectEnd","moveStart","move","moveEnd","selectionDragStart","selectionDrag","selectionDragStop","selectionContextMenu","selectionStart","selectionEnd","viewportChangeStart","viewportChange","viewportChangeEnd","paneScroll","paneClick","paneContextMenu","paneMouseEnter","paneMouseMove","paneMouseLeave","edgeUpdate","edgeContextMenu","edgeMouseEnter","edgeMouseMove","edgeMouseLeave","edgeDoubleClick","edgeClick","edgeUpdateStart","edgeUpdateEnd","nodeContextMenu","nodeMouseEnter","nodeMouseMove","nodeMouseLeave","nodeDoubleClick","nodeClick","nodeDragStart","nodeDrag","nodeDragStop","miniMapNodeClick","miniMapNodeDoubleClick","miniMapNodeMouseEnter","miniMapNodeMouseMove","miniMapNodeMouseLeave","update:modelValue","update:nodes","update:edges"],setup(e,{expose:t,emit:n}){const o=e,i=G(),r=sv(o,"modelValue",n),s=sv(o,"nodes",n),l=sv(o,"edges",n),u=oI(o),c=zx({modelValue:r,nodes:s,edges:l},o,u);return function(e,t){const n=N();function o(e){var t;const o=function(e){const[t,...n]=e.split(":");return`on${t.replace(/(?:^|-)(\w)/g,((e,t)=>t.toUpperCase()))}${n.length?`:${n.join(":")}`:""}`}(e);return!!(null==(t=null==n?void 0:n.vnode.props)?void 0:t[o])}b((()=>{for(const[n,a]of Object.entries(t.value)){const t=t=>{e(n,t)};a.setEmitter(t),Jy(a.removeEmitter),a.setHasEmitListeners((()=>o(n))),Jy(a.removeHasEmitListeners)}}))}(n,u.hooks),function(){const e=oI();Y((()=>e.viewportHelper.value.viewportInitialized),(t=>{t&&setTimeout((()=>{e.emits.init(e),e.emits.paneReady(e)}),1)}))}(),function(){const{emits:e}=oI();B((()=>{if(Nx()){const t=document.querySelector(".vue-flow__pane");t&&"1"!==window.getComputedStyle(t).zIndex&&e.error(new Sd(Id.MISSING_STYLES))}}))}(),pe(jd,i),V(c),t(u),(e,t)=>(a(),m("div",{ref:$(u).vueFlowRef,class:"vue-flow"},[Z(yp,null,{default:ve((()=>[Z(Cp),Mp,Z(Op),K(e.$slots,"zoom-pane")])),_:3}),K(e.$slots,"default"),Z(bp)],512))}})),e("hn",x({name:"Panel",compatConfig:{MODE:3},props:{position:{}},setup(e){const t=e,{userSelectionActive:n}=oI(),o=C((()=>`${t.position}`.split("-")));return(e,t)=>(a(),m("div",{class:F(["vue-flow__panel",o.value]),style:ye({pointerEvents:$(n)?"none":"all"})},[K(e.$slots,"default")],6))}})),e("Xt",Lp=[96,96]),e("Yt",jp=[80,80]),e("Jt",[256,96]),e("Qt",2*Lp[0]+16),e("Zt",$p={xMin:-1/0,yMin:-1/0,xMax:1/0,yMax:1/0}),Bp=e=>e.reduce(((e,t)=>t.position[0]>e.position[0]||t.position[1]>e.position[1]?e:t),e[0]),Vp=e=>e.reduce(((e,t)=>t.position[0]<e.position[0]?t:e),e[0]),Rp=e=>e.reduce(((e,t)=>t.position[1]<e.position[1]?t:e),e[0]),Fp=e=>e.reduce(((e,t)=>t.position[0]>e.position[0]?t:e),e[0]),Wp=e=>e.reduce(((e,t)=>t.position[1]>e.position[1]?t:e),e[0]),e("cn",(e=>{const t=Vp(e),n=Rp(e),o=Fp(e),a=Wp(e);return[Math.abs(o.position[0]-t.position[0])+Lp[0],Math.abs(a.position[1]-n.position[1])+Lp[1]]})),Up=(e,t,n=Lp)=>!(Math.abs(e[0]-t[0])<=n[0]&&Math.abs(e[1]-t[1])<=n[1]),e("en",((e,t)=>!(e.x+e.width<=t.x||t.x+t.width<=e.x||e.y+e.height<=t.y||t.y+t.height<=e.y))),zp=(e,t)=>{const n=Math.ceil(e/t),o=t*n,a=e*t>0?t*(n+1):t*(n-1);return Math.abs(e-o)<Math.abs(e-a)?o:a},e("on",((e,t,{offset:n=[Lp[0]/2,Lp[1]/2],size:o=Lp,viewport:a=$p,normalize:i=!0}={})=>{const r=rI(n),s=rI(t);if(i){let t,n,i=!1;do{for(i=!1,t=0;t<e.length;t++)if(n=e[t],n&&!Yo.includes(n.type)&&!Up(n.position,s,o)){i=!0;break}i&&(s[0]+=r[0],s[1]+=r[1])}while(i);s[0]<a.xMin+r[0]&&(s[0]=a.xMin+r[0]),s[1]<a.yMin+r[1]&&(s[1]=a.yMin+r[1]),s[0]>a.xMax-r[0]&&(s[0]=a.xMax-o[0]-r[0]),s[1]>a.yMax-r[1]&&(s[1]=a.yMax-o[1]-r[1])}return s})),e("an",(e=>[(e&&"clientX"in e?e.clientX:e?.touches?.[0]?.clientX)??0,(e&&"clientY"in e?e.clientY:e?.touches?.[0]?.clientY)??0])),Hp=(e,t,n,o)=>[(e-o[0])/n,(t-o[1])/n],Gp=()=>{let e=window.innerWidth,t=window.innerHeight;const n=document.getElementById("node-view-root");if(n){const o=n.getBoundingClientRect();e=o.width,t=o.height}return{editorWidth:e,editorHeight:t}},e("in",((e,t)=>{const{editorWidth:n,editorHeight:o}=Gp();return Hp(n/2,(o-65)/2,e,t)})),e("ln",Yp=e=>{const t=[...e];if(t.length){const e=Bp(t),n=176-e.position[0],o=240-e.position[1];t.forEach((e=>{e.position[0]+=n+2*Lp[0],e.position[1]+=o}))}return t}),e("sn",(e=>e.meta?.nodeView?Jn.WORKFLOW:[Tn.WORKFLOW_EXECUTIONS,Tn.EXECUTION_PREVIEW,Tn.EXECUTION_HOME].map(String).includes(String(e.name))?Jn.EXECUTIONS:[Tn.EVALUATION_EDIT,Tn.EVALUATION_RUNS_DETAIL].map(String).includes(String(e.name))?Jn.EVALUATION:null)),e("qt",Xp=Xa(ai.TEMPLATES,(()=>{const e=v([]),n=v({}),o=v({}),a=v({}),i=v({}),r=v(""),s=v(""),l=v(`${window.location.protocol}//${window.location.host}${window.BASE_PATH}`),u=qi(),c=ni(),d=gh(),p=Ju(),f=_u(),m=C((()=>e.value.sort(((e,t)=>e.name>t.name?1:-1)))),h=C((()=>e=>o.value[e])),y=C((()=>e=>{const t=o.value[e];return t&&"full"in t&&t.full?t:null})),g=C((()=>n.value)),w=C((()=>t=>e.value[t])),b=C((()=>e=>{const t=lI(e),o=i.value[t];return o?o.collectionIds.map((e=>n.value[e])):null})),k=C((()=>e=>{const t=lI(e),n=a.value[t];return n?n.workflowIds.map((e=>o.value[e])):null})),x=C((()=>e=>{const t=lI(e),n=a.value[t];return n?n.totalWorkflows:0})),I=C((()=>e=>{const t=lI(e),n=a.value[t];return Boolean(n?.loadingMore)})),N=C((()=>e=>{const t=lI(e),n=a.value[t];return Boolean(n&&!n.loadingMore&&n.totalWorkflows===n.workflowIds.length)})),S=C((()=>u.templatesHost!==Da.DEFAULT_API_HOST)),T=C((()=>p.currentUserCloudInfo?.role??(d.currentUser?.personalizationAnswers&&"role"in d.currentUser.personalizationAnswers?d.currentUser.personalizationAnswers.role:void 0))),E=C((()=>{const e={...Da.UTM_QUERY,utm_instance:l.value,utm_n8n_version:c.versionCli,utm_awc:String(f.activeWorkflows.length)};return T.value&&(e.utm_user_role=T.value),new URLSearchParams({...e})})),A=C((()=>`${Da.BASE_WEBSITE_URL}${Ku(T.value)}?${E.value.toString()}`)),_=t=>{e.value=t},P=e=>{e.forEach((e=>{const t=(e.workflows||[]).map((e=>({id:e.id}))),o=n.value[e.id]||{};n.value[e.id]={...o,...e,workflows:t}}))},D=e=>{e.forEach((e=>{const t=o.value[e.id]||{};o.value[e.id.toString()]={...t,...e}}))},O=e=>{const t=e._collections.map((e=>String(e.id))),n=lI(e.query);i.value[n]={collectionIds:t}},M=t=>{const n=t.workflows.map((e=>e.id)),o=lI(t.query),i=a.value[o];a.value[o]=i?{workflowIds:[...i.workflowIds,...n],totalWorkflows:t.totalWorkflows,categories:e.value}:{workflowIds:n,totalWorkflows:t.totalWorkflows,categories:e.value}},L=e=>{const t=lI(e);a.value[t]&&(a.value[t]={...a.value[t],loadingMore:!0})},j=e=>{const t=lI(e);a.value[t]&&(a.value[t]={...a.value[t],loadingMore:!1})},$=async e=>{const t=u.templatesHost,n=c.versionCli;return await ui(t,e,{"n8n-version":n})};return{categories:e,collections:n,workflows:o,workflowSearches:a,collectionSearches:i,currentSessionId:r,previousSessionId:s,currentN8nPath:l,allCategories:m,getTemplatesById:h,getFullTemplateById:y,getCollectionById:g,getCategoryById:w,getSearchedCollections:b,getSearchedWorkflows:k,getSearchedWorkflowsTotal:x,isSearchLoadingMore:I,isSearchFinished:N,hasCustomTemplatesHost:S,websiteTemplateRepositoryURL:A,constructTemplateRepositoryURL:(e,t)=>`${t?`${Da.BASE_WEBSITE_URL}${t}`:Da.BASE_WEBSITE_URL}?${e.toString()}`,websiteTemplateRepositoryParameters:E,addCategories:_,addCollections:P,addWorkflows:D,addCollectionsSearch:O,addWorkflowsSearch:M,setWorkflowSearchLoading:L,setWorkflowSearchLoaded:j,resetSessionId:()=>{s.value=r.value,r.value=""},setSessionId:()=>{r.value||(r.value=`templates-${Date.now()}`)},fetchTemplateById:async e=>{const t=u.templatesHost,n=c.versionCli,o={...(await ri(t,e,{"n8n-version":n})).workflow,full:!0};return D([o]),o},fetchCollectionById:async e=>{const t=u.templatesHost,n=c.versionCli,o=await fi(t,e,{"n8n-version":n});return P([{...o.collection,full:!0}]),D(o.collection.workflows),g.value[e]},getCategories:async()=>{const e=m.value;if(e.length)return e;const t=u.templatesHost,n=c.versionCli,o=(await tr(t,{"n8n-version":n})).categories;return _(o),o},getCollections:async e=>{const t=b.value(e);if(t)return t;const n=u.templatesHost,o=c.versionCli,a=(await li(n,e,{"n8n-version":o})).collections;return P(a),O({query:e,_collections:a}),a.forEach((e=>D(e.workflows))),a},getWorkflows:async t=>{const n=k.value(t);if(n)return e.value=a.value[lI(t)].categories??[],n;const o=u.templatesHost,i=c.versionCli,r=await Oi(o,{...t,page:1,limit:20},{"n8n-version":i});return D(r.workflows),M({...r,query:t}),k.value(t)||[]},getMoreWorkflows:async e=>{if(I.value(e)&&!N.value(e))return[];const n=k.value(e)||[],o=u.templatesHost;L(e);try{const t=await Oi(o,{...e,page:n.length/20+1,limit:20});return j(e),D(t.workflows),M({...t,query:e}),k.value(e)||[]}catch(t){throw j(e),t}},getWorkflowTemplate:$,getFixedWorkflowTemplate:async e=>{const t=await $(e);return t?.workflow?.nodes&&(t.workflow.nodes=Yp(t.workflow.nodes),t.workflow.nodes?.forEach((e=>{e.credentials&&delete e.credentials}))),t}}}))),qp=["@n8n/n8n-nodes-langchain.toolCode","@n8n/n8n-nodes-langchain.toolHttpRequest","@n8n/n8n-nodes-langchain.mcpClientTool",["@n8n/n8n-nodes-langchain.toolWorkflow",1.2]],Jp=["parameters.name","parameters.toolName","parameters.description","parameters.toolDescription"],Kp=["options","credentialsSelect"],Zp={description:{initialValue:"",type:"string",typeOptions:{rows:2},tooltip:Se.baseText("parameterOverride.descriptionTooltip")}},Qp=n(gt(),1),ef={isActive:!1,parameters:[]},e("Ht",tf=Xa(ai.FOCUS_PANEL,(()=>{const e=rh(),t=C((()=>e.workflowId?Qh(Kh(e.workflowId)):void 0)),n=ry(Kn),o=C((()=>{const t={[e.workflowId]:ef};return n.value?En(n.value,{fallbackValue:t}):t})),a=C((()=>o.value[e.workflowId]??ef)),i=v(0),r=v("setup"),s=C((()=>a.value.isActive)),l=C((()=>a.value.width??500)),u=C((()=>a.value.parameters)),c=C((()=>u.value.map((e=>{const n=t.value?.getNodeById(e.nodeId);if(!n)return e;const o=(0,Qp.default)(n?.parameters??{},e.parameterPath.replace(/parameters\./,""));return"string"==typeof o&&dI(o)?e:{...e,node:n,value:o}})))),d=C((()=>c.value[0]&&f(c.value[0])?c.value[0]:void 0));function p({parameters:t,isActive:a,wid:r=e.workflowId,width:c,removeEmpty:d=!1}){const p=o.value;d&&""in p&&delete p[""],n.value=JSON.stringify({...o.value,[r]:{isActive:a??s.value,parameters:t??u.value,width:c??l.value}}),a&&(i.value=Date.now())}function f(e){return"value"in e&&"node"in e}const m=C((()=>c.value.map((e=>({parameterPath:e.parameterPath,nodeType:f(e)?e.node.type:"unresolved",nodeId:e.nodeId})))));return xe((()=>a.value),(e=>{e.isActive&&e.parameters.length>0&&(i.value=Date.now())})),Y((()=>{const e=d.value;return e?`${e.nodeId}:${e.parameterPath}`:null}),((e,t)=>{e&&e!==t&&(r.value="focus")})),{focusPanelActive:s,focusedNodeParameters:c,focusedNodeParametersInTelemetryFormat:m,lastFocusTimestamp:i,focusPanelWidth:l,resolvedParameter:d,selectedTab:r,openWithFocusedNodeParameter:function(e){p({parameters:[e],isActive:!0})},isRichParameter:f,openFocusPanel:function(){p({isActive:!0})},openFocusPanelForWorkflow:function(e){p({isActive:!0,wid:e})},closeFocusPanel:function(){p({isActive:!1})},toggleFocusPanel:function(){p({isActive:!s.value})},onNewWorkflowSave:function(e){if(!a.value||!(""in o.value))return;const t=o.value[""];p({wid:e,parameters:t.parameters,isActive:t.isActive,removeEmpty:!0})},updateWidth:function(e){p({width:e})},unsetParameters:function(){p({parameters:[]})},setSelectedTab:function(e){r.value=e}}}))),nf=2e3,of=32e3,e("Vt",af=Xa("workflowSave",(()=>{const e=v(ka.Idle),t=v(null),n=v(0),o=v(nf),a=v(!1),i=v(null),r=v(!1);function s(){n.value=0,o.value=nf,a.value=!1,i.value=null,r.value=!1}return{autoSaveState:e,pendingSave:t,retryCount:n,retryDelay:o,isRetrying:a,lastError:i,conflictModalShown:r,setAutoSaveState:function(t){e.value=t},setPendingSave:function(e){t.value=e},incrementRetry:function(){n.value++,o.value=function(e,t=nf,n=of){return Math.min(t*Math.pow(2,e-1),n)}(n.value)},getRetryDelay:function(){return o.value},setRetrying:function(e){a.value=e},setLastError:function(e){i.value=e},setConflictModalShown:function(e){r.value=e},resetRetry:s,reset:function(){e.value=ka.Idle,t.value=null,s()}}}))),e("Bt",rf=Xa("backendConnection",(()=>{const e=v(!0);return{isOnline:S(e),setOnline:function(t){e.value=t}}}))),sf="n8n",lf="Workflow Automation",uf=3,cf=v("undefined"!=typeof Notification?Notification.permission:"denied"),e("It",df=ht()),e("Ft",ht()),e("Pt",ht()),e("Nt",ht()),e("Mt",ht()),e("jt",ht()),e("At",pf=ht()),ff=["data-action-parameter-node"],mf=x({__name:"AiUpdatedCodeMessage",props:{nodeName:{}},setup(e){const t=Ie();return(n,o)=>(a(),m("div",null,[r(_($(t).baseText("aiAssistant.codeUpdated.message.body1"))+" ",1),c("a",{"data-action":"openNodeDetail","data-action-parameter-node":e.nodeName},_(e.nodeName),9,ff),r(" "+_($(t).baseText("aiAssistant.codeUpdated.message.body2")),1)]))}}),hf=mf,yf=new Set(["add_nodes","remove_nodes","connect_nodes","disconnect_nodes","update_node_parameters","generate_workflow"]),e("Ot",vf=Xa(ai.BUILDER,(()=>{const e=v([]),n=v(!1),o=v(!1),a=v(),i=v(null),r=v(!1),s=v("build"),l=v(),u=v(),c=v({success:0,error:0}),d=v(void 0),p=v(void 0),f=C((()=>{if(!d.value)return new Set;const t=e.value.findIndex((e=>e.id===d.value));if(-1===t)return new Set;const n=he.value;if(n.length>0&&n[n.length-1].id===d.value)return new Set;let o=e.value.length;if(p.value){const t=e.value.findIndex((e=>e.id===p.value));-1!==t&&(o=t)}return new Set(e.value.slice(t+1,o).map((e=>e.id)).filter(Boolean))})),m=v(!1),h=v(null),y=v(!1),g=v(0),w=v(new Set),b=v(!1);function k(){g.value=0,w.value.clear(),b.value=!1}const x=v(!1),I=v(),N=v(),S=v(!1),T=v(),E=fI(),A=qi(),_=ni(),P=rh(),D=C((()=>P.workflowId?Qh(Kh(P.workflowId)):void 0)),O=gI(),M=Nu(),L=He(),j=Ie(),$=sy(),B=dh(),V=pI({router:tt()}),R=Tu(),F=Bu(),{processAssistantMessages:W,createUserMessage:U,createUserAnswersMessage:z,createAssistantMessage:H,createErrorMessage:G,clearMessages:X,mapAssistantMessageToUI:q,clearRatingLogic:J,getRunningTools:K}=Wy(),{workflowTodos:Z,getTodosToTrack:Q,hasTodosHiddenByPinnedData:ee}=function(){const e=rh(),t=Ie(),n=C((()=>e.workflowId?Qh(Kh(e.workflowId)):void 0));function o(e,t=new Set){if(t.has(e))return!1;if(t.add(e),!0===n.value?.getNodeByName(e)?.disabled)return!0;const a=n.value?.outgoingConnectionsByNodeName(e)??{};for(const n of Object.keys(a)){if("main"===n)continue;const e=a[n];if(e)for(const n of e)if(n)for(const e of n)if(o(e.node,t))return!0}return!1}function a(e,t=new Set){if(t.has(e))return!1;if(t.add(e),n.value?.pinData?.[e]?.length)return!0;const o=n.value?.outgoingConnectionsByNodeName(e)??{};for(const n of Object.keys(o)){if("main"===n)continue;const e=o[n];if(e)for(const n of e)if(n)for(const e of n)if(a(e.node,t))return!0}return!1}const i=C((()=>(n.value?.pinData,n.value?.allNodes,e.workflowValidationIssues.filter((e=>["credentials","parameters"].includes(e.type)&&!a(e.node)&&!o(e.node)))))),r=C((()=>{n.value?.pinData;const e=[],i=new Set;for(const r of n.value?.allNodes??[]){if(!r?.parameters)continue;if(a(r.name))continue;if(o(r.name))continue;const n=zy(r.parameters);if(0===n.length)continue;const s=r.issues?.parameters??{};for(const o of n){const n=Hy(o.path),a=t.baseText("aiAssistant.builder.executeMessage.fillParameter",{interpolate:{label:o.label}}),l=s[n];if((l?Array.isArray(l)?l:[l]:[]).includes(a))continue;const u=`${r.name}|${n}|${o.label}`;i.has(u)||(i.add(u),e.push({node:r.name,type:"parameters",value:a}))}}return e})),s=C((()=>[...i.value,...r.value])),l=C((()=>{if(s.value.length>0)return!1;const t=n.value?.pinData;if(!t||0===Object.keys(t).length)return!1;if(e.workflowValidationIssues.some((e=>["credentials","parameters"].includes(e.type)&&a(e.node)&&!o(e.node))))return!0;for(const e of n.value?.allNodes??[])if(e?.parameters&&a(e.name)&&!o(e.name)&&zy(e.parameters).length>0)return!0;return!1}));return{workflowTodos:s,placeholderIssues:r,getTodosToTrack:function(){return{credentials_todo_count:e.workflowValidationIssues.filter((e=>"credentials"===e.type)).length,placeholders_todo_count:r.value.length,todos:s.value.map((e=>({type:e.type,node_type:n.value?.getNodeByName(e.node)?.type,label:e.value})))}},hasTodosHiddenByPinnedData:l}}(),{applyCodeDiff:te,undoCodeDiff:ne}=hI({chatMessages:e,getTargetNodeName:e=>e.nodeName??M.activeNodeName??F.confirmedNodes[0]?.nodeName??"",getSessionId:e=>{const t=e.sdkSessionId;return Qa(t,"No SDK session ID for code diff"),t}}),oe=C((()=>_.pushRef)),ae=C((()=>{const e=R.getVariant(pn.name);return e===pn.codeNoPinData||e===pn.codePinData})),ie=C((()=>e.value.find((e=>"user"===e.role&&"text"===e.type))?.content)),re=C((()=>A.isAiBuilderEnabled)),se=C((()=>e.value.filter(Pe))),le=C((()=>e.value.filter(mt))),ue=C((()=>e.value.filter((e=>"assistant"===e.role)))),ce=C((()=>{if(void 0===u.value||void 0===l.value||-1===l.value)return;const e=l.value-u.value;return e>0?e:0})),de=C((()=>void 0!==ce.value&&0===ce.value)),pe=C((()=>{if(void 0!==l.value&&-1!==l.value&&void 0!==ce.value)return 0===l.value?0:ce.value/l.value*100})),fe=C((()=>void 0!==pe.value&&pe.value<=10)),me=C((()=>e.value.length>0)),he=C((()=>e.value.filter(wy))),ye=C((()=>{const e=he.value;if(0===e.length)return null;const t=e[e.length-1];return{id:t.data.versionId,createdAt:t.data.createdAt}})),ve=C((()=>{const e=R.getVariant(Rt.name);return!0===e||e===Rt.variant})),ge=C((()=>{for(let t=e.value.length-1;t>=0;t--){const n=e.value[t];if(by(n)||ky(n)||Oy(n))return n;if("user"===n.role)break}return null})),we=C((()=>null!==ge.value)),be=C((()=>{const e=ge.value;return!!e&&ky(e)})),ke=C((()=>{const e=ge.value;return!!e&&(by(e)||Oy(e))}));function xe(){e.value=X(),a.value=void 0,r.value=!1,N.value=void 0,T.value=void 0,m.value=!1,h.value=null,y.value=!1,s.value="build",k()}function Ne(){c.value={success:0,error:0}}function Se({userMessageId:e,startWorkflowJson:t}){const n=se.value.filter((t=>t.id?.startsWith(e))),o=$e();return{tools_called:wn(n.map((e=>e.toolName))),start_workflow_json:t,end_workflow_json:o,workflow_modified:o!==t}}function Te(t){return e.value.some((e=>"workflow-updated"===e.type&&e.id?.startsWith(t)))}async function Ee(t){o.value=!1,i.value&&(i.value.abort(),i.value=null),function(e){if(!I.value)return;const{userMessageId:t,planApproved:n}=I.value;$.track("End of response from builder",{user_message_id:t,workflow_id:P.workflowId,session_id:oe.value,tab_visible:"visible"===document.visibilityState,code_builder:ae.value,mode:s.value,...n?{plan_approved:!0}:{},...Se(I.value),...e,...Q()})}(t);const a=I.value?.userMessageId,{revertVersion:r}=I.value??{};if(I.value=void 0,a&&Te(a)&&k(),!t&&a&&r&&Te(a)){const t=await async function(){try{if(!(await V.saveCurrentWorkflow()))return;const e=P.workflowVersionId;if(!e)return;return await De(e)}catch{return}}()??r;e.value=[...e.value,{id:`version-card-${a}`,role:"assistant",type:"custom",customType:"version_card",data:{versionId:t.id,createdAt:t.createdAt}}]}n.value=!1;const l=t&&"aborted"in t&&t.aborted;document.hidden?(E.setDocumentTitle(D.value?.name??"","AI_DONE"),!l&&a&&function(e){const{showNotification:t,isEnabled:n}=mI();if(!n.value)return;const o=D.value?.name??"",a="workflow-ready"===e?"aiAssistant.builder.notification.title":"aiAssistant.builder.notification.inputNeeded.title",i="workflow-ready"===e?"aiAssistant.builder.notification.body":"aiAssistant.builder.notification.inputNeeded.body",r=t(j.baseText(a),{body:j.baseText(i,{interpolate:{workflowName:o}}),icon:"/favicon.ico",tag:`workflow-build-${P.workflowId}`,requireInteraction:!1});r&&(Re("browser_generation_done_notified",{completion_type:e}),r.onclick=()=>{window.focus(),r.close()})}(Te(a)?"workflow-ready":"input-needed")):E.setDocumentTitle(D.value?.name??"","IDLE")}function Ae(){Ee({aborted:!0})}function Ce(t,n,o){Qa(t instanceof Error),Ee({error:t.message}),a.value=void 0;const i=e.value.filter((e=>!("tool"===e.type&&"running"===e.status)));if("AbortError"===t.name){const t=H(j.baseText("aiAssistant.builder.streamAbortedMessage"),"aborted-streaming",{aborted:!0});return void(e.value=[...i,t])}const r=G(j.baseText("aiAssistant.serviceError.message",{interpolate:{message:t.message}}),n,o);e.value=[...i,r]}function _e(t,i,r,s,l){if(!l){const n=s?z(s,i):U(t,i,void 0,r??[]);e.value=J([...e.value,n])}const u="/compact"===t.trim()?"aiAssistant.thinkingSteps.compacting":"aiAssistant.thinkingSteps.thinking";var c;c=j.baseText(u),a.value=c,n.value=!0,o.value||E.setDocumentTitle(D.value?.name??"","AI_BUILDING")}async function De(e){const t=P.workflowId,n=(await $y(_.restApiContext,t,[e])).get(e);return n?{id:e,createdAt:n}:void 0}async function Oe(l){if(o.value=Boolean(l.helpMessage),n.value)return;const u=F.confirmedNodes.map((e=>e.nodeName));let f;be.value&&void 0===l.resumeData&&(l={...l,resumeData:{action:"modify",feedback:l.text}});try{f=await async function(){const e=P.isNewWorkflow,t=B.stateIsDirty;if((e||t)&&!(await V.saveCurrentWorkflow()))throw new Error("Could not save changes");const n=P.workflowVersionId;if(n&&D.value?.updatedAt)return await De(n)}()}catch{return}M.unsetActiveNodeName();const{text:m,source:h="chat",quickReplyType:y,errorMessage:v,type:g="message",errorNodeType:w,executionStatus:b,resumeData:k,mode:x}=l;void 0!==l.initialGeneration&&(r.value=l.initialGeneration);const S=jy();N.value=S,d.value&&!p.value&&(p.value=S);const T=$e(),E="object"==typeof k&&null!==k&&"action"in k&&"approve"===k.action;I.value={userMessageId:S,startWorkflowJson:T,revertVersion:f,...E?{planApproved:!0}:{}},function(e){const{text:t,source:n,type:o,userMessageId:a,currentWorkflowJson:i,errorMessage:r,errorNodeType:s,executionStatus:l,mode:u}=e,d={source:n,message:t,session_id:oe.value,start_workflow_json:i,workflow_id:P.workflowId,type:o,manual_exec_success_count_since_prev_msg:c.value.success,manual_exec_error_count_since_prev_msg:c.value.error,user_message_id:a,code_builder:ae.value,mode:u,...Q()};if("execution"===o){let e="{}",t=0;try{e=JSON.stringify(P.workflowExecutionData??{}),t=Dh(e)/1024}catch(f){console.warn("Failed to stringify execution data for telemetry:",f)}d.execution_data=t>512?"{}":e,d.execution_status=l??"","error"===l&&(d.error_message=r??"",d.error_node_type=s??"")}$.track("User submitted builder message",d);const p=F.confirmedNodes.length;if(p>0){const e=/\b(this node|this|it|these nodes|these|that node|that)\b/i.test(t);$.track("ai.focusedNodes.chatSent",{focused_count:p,has_deictic_ref:e})}}({text:m,source:h,type:g,userMessageId:S,currentWorkflowJson:T,errorMessage:v,errorNodeType:w,executionStatus:b,mode:s.value}),Ne(),_e(m,S,u,l.planAnswers,l.skipUserMessage);const C=P.workflowExecutionData?.data?.resultData,O=void 0!==k?x:x??("plan"===s.value?"plan":void 0),L=await async function(e,t,n){const o=Uf(),a=Tu(),i=Bu(),r={},s=!1===n.allowSendingParameterValues;n.workflow&&(r.currentWorkflow={...await o.simplifyWorkflowForAssistant(n.workflow,{excludeParameterValues:s}),id:n.workflow.id}),n.executionData&&(r.executionData=o.simplifyResultData(n.executionData,{compact:!0,removeParameterValues:s}),n.workflow&&!s&&(r.expressionValues=await o.extractExpressionsFromWorkflow(n.workflow,n.executionData)));const l=i.buildContextPayload();l.length>0&&(r.selectedNodes=l);const u=a.getVariant(pn.name)===pn.codePinData,c={templateExamples:a.getVariant(Ho.name)===Ho.variant,pinData:u,planMode:n.isPlanModeEnabled??!1,mergeAskBuild:a.isFeatureEnabled(qt.name)};if(n.nodesForSchema?.length){const{schemas:e,pinnedNodeNames:t}=o.getNodesSchemas(n.workflowId,n.nodesForSchema,s);r.executionSchema=e,r.valuesExcluded=s,t.length>0&&(r.pinnedNodes=t)}return{role:"user",type:"message",id:t,text:e,quickReplyType:n.quickReplyType,workflowContext:r,featureFlags:c,mode:n.mode}}(m,S,{workflowId:P.workflowId,quickReplyType:y,workflow:P.workflow,executionData:C,nodesForSchema:Object.keys(D.value?.nodesByName??{}),mode:O,isPlanModeEnabled:ve.value,allowSendingParameterValues:A.settings.ai.allowSendingParameterValues});void 0!==k&&(L.resumeData=k),F.removeAllConfirmed();const j=(R=S,U=async()=>await Oe(l),async()=>{e.value=e.value.filter((e=>e.id!==R)),await U()});var R,U;i.value&&i.value.abort(),i.value=new AbortController;try{!function(e,t,n,o,a,i,r){Za(e,"/ai/build",{...t,payload:{...t.payload,versionId:i}},n,o,a,void 0,r)}(_.restApiContext,{payload:L},(t=>{o.value||t.messages.some((e=>"toolName"in e&&"assistant"===e.toolName))&&(o.value=!0);const n=W(e.value,t.messages,S,j);e.value=n.messages,function(e){for(const t of e)Dy(t)&&Re("web_fetch_approval_prompted",{domain:t.domain,url:t.url}),!Ay(t)||"web_fetch"!==t.toolName||"completed"!==t.status&&"error"!==t.status||Re("web_fetch_completed",{status:t.status})}(t.messages),n.shouldClearThinking?a.value=void 0:void 0!==n.thinkingMessage&&(a.value=n.thinkingMessage)}),(()=>{Ee()}),(e=>Ce(e,S,j)),f?.id,i.value?.signal)}catch(t){Ce(t,S,j)}}async function Me(){const t=P.workflowId;if(!t)return[];if(!P.isWorkflowSaved[t])return[];if(T.value===t)return[];if(S.value)return[];S.value=!0;try{const n=await async function(e,t,n){return await Ja(e,"POST","/ai/sessions",{workflowId:t,codeBuilder:n})}(_.restApiContext,t,ae.value);T.value=t;const o=n.sessions||[];if(o.length>0){const n=o[0],a=function(e){return e.filter(Iy).map((e=>e.revertVersionId))}(n.messages),i=await $y(_.restApiContext,t,a),r=function(e,t){return e.map((e=>{if(!Iy(e))return e;const n=t.get(e.revertVersionId);return n?{...e,revertVersion:{id:e.revertVersionId,createdAt:n}}:function(e){const{revertVersionId:t,...n}=e;return n}(e)}))}(n.messages,i),s=[];for(let e=0;e<n.messages.length;e++){const t=n.messages[e];"revertVersionId"in t&&"string"==typeof t.revertVersionId&&s.push(t.revertVersionId)}const l=[];for(let e=0;e<s.length;e++)if(e<s.length-1)l.push(s[e+1]);else{const e=P.workflowVersionId;e&&l.push(e)}const u=[...new Set(l)].filter((e=>!i.has(e))),c=u.length>0?await $y(_.restApiContext,t,u):new Map,f=new Map([...i,...c]);let m=0;const v=r.map(((e,t)=>{const o="id"in e&&"string"==typeof e.id?e.id:jy(),a=q(e,o),i=n.messages[t],s="revertVersionId"in i&&"string"==typeof i.revertVersionId?i.revertVersionId:void 0;if("text"===a.type&&"user"===a.role&&s){const e=m;m++;let n=!1;for(let o=t+1;o<r.length;o++){const e=r[o];if("role"in e&&"user"===e.role)break;if("type"in e&&"workflow-updated"===e.type){n=!0;break}if(Ay(e)&&yf.has(e.toolName)){n=!0;break}}const{revertVersion:i,...u}=a,c=l[e],d=c??s,p=(c?f.get(c):void 0)??f.get(s);return{msg:u,...n&&{versionCard:{id:`version-card-${o}`,role:"assistant",type:"custom",customType:"version_card",data:{versionId:d,...p&&{createdAt:p}}}}}}return{msg:a}})),g=[];let w=null;for(const e of v)"user"===e.msg.role&&"text"===e.msg.type&&w&&(g.push(w),w=null),"workflow-updated"!==e.msg.type&&g.push(e.msg),e.versionCard&&(w=e.versionCard);if(w&&g.push(w),R.getVariant(pn.name)===pn.codePinData){const e=(P.workflowId?Qh(Kh(P.workflowId)):void 0)?.getPinDataSnapshot();e&&Object.keys(e).length>0&&(h.value=e,y.value=!0)}e.value=g,n.activeVersionCardId&&g.some((e=>e.id===n.activeVersionCardId))?d.value=n.activeVersionCardId:n.activeVersionCardId&&console.warn("[builder] activeVersionCardId not found in loaded messages — collapse state lost",n.activeVersionCardId),n.resumeAfterRestoreMessageId&&g.some((e=>e.id===n.resumeAfterRestoreMessageId))&&(p.value=n.resumeAfterRestoreMessageId);const b=[...g].reverse().find((e=>"user"===e.role&&"text"===e.type));b&&(N.value=b.id)}return o}catch(n){return console.error("Failed to load AI sessions:",n),[]}finally{S.value=!1}}const Le=C((()=>null!==h.value&&Object.keys(h.value).length>0)),je=C((()=>Le.value&&!y.value));function $e(){return JSON.stringify({nodes:D.value?.allNodes??[],connections:D.value?.connectionsBySourceNode??{}})}function Be(e,t){l.value=e,u.value=t}async function Ve(){if(re.value)try{const e=await async function(e){return await Ja(e,"GET","/ai/build/credits")}(_.restApiContext);Be(e.creditsQuota,e.creditsClaimed)}catch{}}function Re(e,t){const n={workflow_id:P.workflowId,session_id:oe.value,event_type:e};t&&Object.keys(t).length>0&&(n.event_properties=t),N.value&&(n.last_user_message_id=N.value),$.track("Workflow builder journey",n)}Y((()=>P.workflowId),((e,t)=>{e!==t&&(n.value&&Ae(),xe(),e&&L?.name&&ju.includes(L.name)&&re.value&&(Ve(),Me()))})),Y([()=>P.workflowId,()=>(D.value?.allNodes??[]).length],(([,t])=>{e.value.length>0||ve.value&&(s.value=0===t?"plan":"build")}));const Fe=Wu();return{chatMessages:e,streaming:n,isHelpStreaming:o,activeVersionCardId:d,resumeAfterRestoreMessageId:p,collapsedMessageIds:f,builderThinkingMessage:a,isAIBuilderEnabled:re,isCodeBuilder:ae,builderMode:s,isPlanModeAvailable:ve,isInterrupted:we,hasPendingPlan:be,shouldDisableChatInput:ke,workflowPrompt:ie,toolMessages:se,workflowMessages:le,assistantMessages:ue,trackingSessionId:oe,streamingAbortController:i,initialGeneration:r,creditsQuota:C((()=>l.value)),creditsRemaining:ce,hasNoCreditsRemaining:de,creditsPercentageRemaining:pe,isLowCredits:fe,hasMessages:me,latestRevertVersion:ye,versionCardMessages:he,workflowTodos:Z,hasTodosHiddenByPinnedData:ee,hasHadSuccessfulExecution:m,hasDeferredPinData:je,hasGeneratedPinData:Le,pinDataApplied:y,lastUserMessageId:N,wizardCurrentStep:g,wizardClearedPlaceholders:w,wizardHasExecutedWorkflow:b,unpinAllNodes:function(){const e=D.value?.pinData;if(e){for(const t of Object.keys(e))D.value?.unpinNodeData(t),P.nodeMetadata[t]&&(P.nodeMetadata[t].pinnedDataLastRemovedAt=Date.now());B.markStateDirty()}},storeGeneratedPinData:function(e){h.value={...h.value??{},...e}},applyGeneratedPinData:function(){if(!h.value||!P.workflowId)return;const e=Qh(Kh(P.workflowId));e.setPinData({...e.getPinDataSnapshot(),...h.value}),B.markStateDirty(),y.value=!0},abortStreaming:Ae,resetBuilderChat:xe,setBuilderMode:function(e){("plan"!==e||ve.value)&&(s.value=e,Re("user_switched_builder_mode",{mode:e}))},sendChatMessage:Oe,resumeWithQuestionsAnswers:async function(e){we.value&&await Oe({text:j.baseText("aiAssistant.builder.planMode.actions.submitAnswers"),resumeData:e,planAnswers:e})},resumeWithPlanDecision:async function(e){if(!we.value)return;const t=e.feedback?.trim();if("approve"===e.action)return Re("user_clicked_implement_plan"),await Oe({text:j.baseText("aiAssistant.builder.planMode.actions.implement"),resumeData:e,mode:"build"}),void(s.value="build");"modify"!==e.action?await Oe({text:t?j.baseText("aiAssistant.builder.planMode.actions.rejectWithFeedback",{interpolate:{feedback:t}}):j.baseText("aiAssistant.builder.planMode.actions.reject"),resumeData:e}):await Oe({text:t?j.baseText("aiAssistant.builder.planMode.actions.modifyWithFeedback",{interpolate:{feedback:t}}):j.baseText("aiAssistant.builder.planMode.actions.modify"),resumeData:e})},loadSessions:Me,getWorkflowSnapshot:$e,fetchBuilderCredits:Ve,updateBuilderCredits:Be,getRunningTools:K,trackWorkflowBuilderJourney:Re,getAiBuilderMadeEdits:function(){return x.value},resetAiBuilderMadeEdits:function(){x.value=!1},setBuilderMadeEdits:function(e){x.value=e},incrementManualExecutionStats:function(e){c.value[e]++,"success"===e&&(m.value=!0)},resetManualExecutionStats:Ne,applyCodeDiff:te,undoCodeDiff:ne,restoreToVersion:async function(t,n){const o=P.workflowId;if(B.stateIsDirty&&!(await V.saveCurrentWorkflow()))return;const a=await Fe.restoreWorkflow(o,t);O.setWorkflowProperty("versionId",a.versionId),D.value?.setUpdatedAt(a.updatedAt);const i=e.value.findIndex((e=>e.id===n)),r=-1!==i?e.value.slice(i+1).find((e=>"user"===e.role&&"text"===e.type)):void 0;return r?.id&&await async function(e,t,n,o,a){return await Ja(e,"POST","/ai/build/truncate-messages",{workflowId:t,messageId:n,versionCardId:o,codeBuilder:a})}(_.restApiContext,o,r.id,n,ae.value||void 0),d.value=n,p.value=void 0,s.value="build",Re("revert_version_from_builder",{revert_user_message_id:n,revert_version_id:t,no_versions_reverted:-1!==i?e.value.slice(i+1).filter((e=>wy(e))).length:0}),a},clearExistingWorkflow:function(){D.value?.removeAllConnections(),D.value?.removeAllNodes()},clearBackendSession:function(){const e=P.workflowId;e&&async function(e,t){await Ja(e,"POST","/ai/build/clear-session",{workflowId:t})}(_.restApiContext,e)},clearDoneIndicatorTitle:function(){"AI_DONE"===E.getDocumentState()&&E.setDocumentTitle(D.value?.name??"","IDLE")}}}))),gf=Xa(ai.WORKFLOW_STATE,(()=>({executingNode:yI()}))),wf=ht(),e("St",(e=>e.replace(/\{\{(.*)\}\}/,"$1").trim())),e("yt",(e=>oa(e)?e.slice(1):e??"")),e("vt",(e=>fn(e).every((e=>"text"===e.type||/\$secrets(\.[a-zA-Z0-9_]+)+$/.test(e.text.trim()))))),bf=e=>e instanceof In&&"no_execution_data"===e.context.type,kf=e=>e instanceof In&&"no_node_execution_data"===e.context.type,e("_t",xf=e=>e instanceof In&&"paired_item_intermediate_nodes"===e.context.type),If=e=>e instanceof In&&"paired_item_no_connection"===e.context.type,Nf=e=>e instanceof In&&"paired_item_invalid_info"===e.context.type,Sf=e=>e instanceof In&&"paired_item_no_info"===e.context.type,Tf=e=>e instanceof In&&"no_input_connection"===e.context.type,Ef=e=>e instanceof In&&"pairedItem"===e.functionality,e("gt",Af=(e,t=!1)=>e?bf(e)||kf(e)||xf(e)||t?"pending":"invalid":"valid"),e("ht",Cf=(e,t=!1)=>{if(bf(e)||xf(e))return Se.baseText("expressionModalInput.noExecutionData");if(kf(e)){const t=e.context.nodeCause;return Se.baseText("expressionModalInput.noNodeExecutionData",{interpolate:{node:t}})}if(Tf(e))return Se.baseText("expressionModalInput.noInputConnection");if(If(e))return Se.baseText("expressionModalInput.pairedItemConnectionError");if(Nf(e)||Sf(e)){const t=e.context.nodeCause,n=rh();if((n.workflowId?Qh(Kh(n.workflowId)):void 0)?.pinData?.[t])return Se.baseText("expressionModalInput.pairedItemInvalidPinnedError",{interpolate:{node:t}})}return Ef(e)?t?Se.baseText("expressionModalInput.pairedItemError"):Se.baseText("expressionModalInput.pairedItemError.noRunData"):e.message}),e("xt",((e,t=!1)=>e.ok?null===e.result?"":"string"==typeof e.result&&0===e.result.length?Se.baseText("parameterInput.emptyString"):"string"==typeof e.result?e.result:String(e.result):"invalid"!==Af(e.error)?"":`[${Se.baseText("parameterInput.error")}: ${Cf(e.error,t)}]`)),e("mt",((e,t=!1)=>{if(t)return e;if("string"==typeof e&&!e.startsWith("=")){if(e.endsWith("{{ "))return"="+e+" }}";if(e.endsWith("{{$"))return"="+e.slice(0,-1)+" $ }}"}return e})),e("bt",((e,t=!1)=>!t&&"string"==typeof e&&!e.startsWith("=")&&e.includes("{{")&&e.includes("}}"))),_f=/^[a-zA-Z_$][a-zA-Z0-9_$]*$/,Pf=e=>e.startsWith('"')&&e.endsWith('"')?e.slice(1,-1).replace(/\\"/g,'"'):e.startsWith("'")&&e.endsWith("'")?e.slice(1,-1).replace(/\\'/g,"'"):e,Df=n(Ha(),1),Of={binary:gn.file,object:gn.object,array:gn.array,string:gn.string,null:"square-minus",number:gn.number,boolean:gn.boolean,function:"code",bigint:"calculator",symbol:"sun",undefined:"ban"},Mf=e=>Of[e],Lf=(e,{nodeName:t,level:n}={})=>({id:`empty-${window.crypto.randomUUID()}`,type:"empty",key:e,level:n??0,nodeName:t??""}),jf=()=>({id:`moreFields-${window.crypto.randomUUID()}`,type:"icon",icon:"ellipsis",tooltip:Ie().baseText("dataMapping.schemaView.previewExtraFields")}),$f=e=>{const t="object"===e.type,n=Array.isArray(e.value)&&0===e.value.length;return t&&n},Bf=(e,t)=>t?`${t}[${e}]`:e,e("lt",(()=>{const e=v(new Set),t=({isDataEmpty:n,schema:o,nodeType:a,nodeName:i,expressionPrefix:r="",depth:s=0,prefix:l="",level:u=0,preview:c,lastSuccessfulPreview:d,truncateLimit:p})=>{if($f(o)&&u<0)return[Lf(n?"emptyData":"emptySchema")];const f=`{{ ${r?r+o.path:o.path.slice(1)} }}`,m=`${i}-${f}`;if(Array.isArray(o.value)){const h=[];return o.key&&h.push({title:Bf(o.key,l),path:o.path,expression:f,depth:s,level:u,icon:Mf(o.type),id:m,collapsable:!0,nodeType:a,nodeName:i,type:"item",preview:c,binaryData:o.binaryData?o.binaryData:void 0}),e.value.has(m)?h:h.concat(o.value.map((e=>t({isDataEmpty:n,schema:e,expressionPrefix:r,nodeType:a,nodeName:i,depth:s,prefix:"array"===o.type?o.key:"",level:u+1,preview:c,lastSuccessfulPreview:d,truncateLimit:p}))).flat())}return o.key?[{title:Bf(o.key,l),path:o.path,expression:f,level:u,depth:s,value:d?"":Oh(o.value,p,0),id:m,icon:Mf(o.type),collapsable:!1,nodeType:a,nodeName:i,type:"item",preview:c}]:[]};return{closedNodes:e,toggleNode:t=>{e.value.has(t)?e.value.delete(t):e.value.add(t)},flattenSchema:t,flattenMultipleSchemas:(n,o,a)=>n.reduce(((n,i)=>{if(n.push({title:i.node.name,id:i.node.name,collapsable:!0,nodeType:i.nodeType,itemCount:i.itemsCount,info:o(i.node),type:"header",preview:i.preview,lastSuccessfulPreview:i.lastSuccessfulPreview}),e.value.has(i.node.name))return n;if("n8n-nodes-base.merge"===i.node.type&&i.itemsCount>1){const e={id:`${i.node.name}-mergeNotice`,type:"callout",level:2,message:Ie().baseText("dataMapping.schemaView.mergeNotice"),theme:"info"};n.push(e)}return $f(i.schema)?i.isNodeExecuted||i.lastSuccessfulPreview?i.isDataEmpty?(n.push(Lf(i.hasBinary?"emptySchemaWithBinary":"emptyData",{level:1})),n):(n.push(Lf(i.hasBinary?"emptySchemaWithBinary":"emptySchema",{level:1})),n):(n.push(Lf("executeSchema",{level:1})),n):(n=n.concat(t({isDataEmpty:i.isDataEmpty,schema:i.schema,depth:i.depth,nodeType:i.node.type,nodeName:i.node.name,preview:i.preview,lastSuccessfulPreview:i.lastSuccessfulPreview,truncateLimit:a,expressionPrefix:_I({nodeName:i.node.name,distanceFromActive:i.depth,binaryMode:rh().workflow.settings?.binaryMode})})),i.preview&&!i.lastSuccessfulPreview&&n.push(jf()),n)}),[])}})),Vf=[Tn.NEW_WORKFLOW,Tn.WORKFLOW,Tn.EXECUTION_DEBUG],Rf=[Tn.EXECUTION_PREVIEW],Ff=[Tn.WORKFLOWS,Tn.PROJECTS_WORKFLOWS],Wf=[Tn.CREDENTIALS,Tn.PROJECTS_CREDENTIALS],e("st",Uf=()=>{const e=Nu(),t=Jm(),n=EI(),o=Ie(),a=/\$\(\s*(\\?["'`])((?:\\.|(?!\1)[^\\])*)\1\s*\)/g;function i(e){let t;const n=[];for(;null!==(t=a.exec(e));)n.push(t[2]);return n}function r(e){const t=new Set;if(!e)return[];for(const n in e.parameters){let o=[];e.parameters[n]&&"object"==typeof e.parameters[n]&&Object.keys(e.parameters[n]).length?o=i(JSON.stringify(e.parameters[n])):"string"==typeof e.parameters[n]&&e.parameters[n]&&(o=i(e.parameters[n])),o.length&&o.map((e=>e.replace(/\\(['"`])/g,"$1"))).forEach((e=>{t.add(e)}))}return t.size?Array.from(t):[]}function s(e){return Array.isArray(e)?[]:null}function l(e){if(null==e)return e;if(Array.isArray(e))return e.map((e=>l(e)));if("string"==typeof e)return"";if("number"==typeof e||"boolean"==typeof e)return null;if(Wo(e)){const{cachedResultName:t,cachedResultUrl:n,...o}=e;return{...o,value:""}}if(To(e))return{assignments:e.assignments?.map((e=>{const{value:t,...n}=e;return{...n}}))??[]};if(ln(e))return{...e,value:null};if(Dn(e))return{...e,conditions:e.conditions.map((e=>({...e,leftValue:s(e.leftValue),rightValue:s(e.rightValue)})))};if("object"==typeof e){const t={};for(const[n,o]of Object.entries(e))t[n]=l(o);return t}return null}async function u(e,t,o){const a=zt(e);return t.forEach((e=>{delete a[e]})),a.parameters=o?.excludeParameterValues?function(e){const t={},n=e??{};for(const[o,a]of Object.entries(n))t[o]=l(a);return t}(a.parameters):await n.getNodeParametersWithResolvedExpressions(a.parameters),a}function c(e){const t=JSON.stringify(e.parameters);return["$json","$input","$binary"].some((e=>t.includes(e)))}function d(e,t,n){const o=Qh(Kh(e)),a=[],i=[];for(const r of t){const e=o.getNodeByName(r);if(!e)continue;o.pinData?.[e.name]&&i.push(e.name);const{getSchemaForExecutionData:t,getInputDataWithPinned:s}=DI(),l=t(ml(s(e)),n,!0);a.push({nodeName:e.name,schema:l})}return{schemas:a,pinnedNodeNames:i}}const p=e=>{try{return Ms(e.payload)}catch(t){return 0}};return{processNodeForAssistant:u,getNodeInfoForAssistant:function(n,o,a){if(!o)return{};const{schemas:i}=d(n,r(o),a?.excludeParameterValues),s=t.getNodeType(o.type);let l;if(s){const e=hl(s),t=o.parameters[e?.name??""];l=vl(s).find((e=>e.value===t))}let u={};if(!a?.excludeParameterValues){const t=e.ndvInputData;if(c(o)&&t?.length){const t=e.ndvInputData[0].json;u={inputNodeName:e.input.nodeName,inputData:t}}}return{authType:l,schemas:i,nodeInputData:u}},simplifyErrorForAssistant:function(e){const t={name:e.name,message:e.message};return"type"in e&&(t.type=e.type),"description"in e&&e.description&&(t.description=e.description),e.stack&&(t.stack=e.stack),"lineNumber"in e&&(t.lineNumber=e.lineNumber),t},isNodeReferencingInputData:c,getNodesSchemas:d,getCurrentViewDescription:function(e){switch(!0){case Ff.includes(e):return o.baseText("aiAssistant.prompts.currentView.workflowList");case Wf.includes(e):return o.baseText("aiAssistant.prompts.currentView.credentialsList");case Rf.includes(e):return o.baseText("aiAssistant.prompts.currentView.executionsView");case Vf.includes(e):return o.baseText("aiAssistant.prompts.currentView.workflowEditor");default:return}},getReferencedNodes:r,simplifyResultData:function(e,t={}){const{compact:n=!1,removeParameterValues:o=!1}=t,a={runData:{}};if(e.error&&(a.error=e.error),!e.runData)return a;for(const i of Object.keys(e.runData)){const t=e.runData[i];a.runData[i]=t.map((e=>{const{data:t,...a}=e;if(o)delete a.inputOverride;else if(n&&a.inputOverride)try{const e=JSON.stringify(a.inputOverride);new Blob([e]).size>2e3&&delete a.inputOverride}catch(i){delete a.inputOverride}return a}))}return e.lastNodeExecuted&&(a.lastNodeExecuted=e.lastNodeExecuted),e.metadata&&(a.metadata=e.metadata),a},simplifyWorkflowForAssistant:async(e,t)=>{let n=e.nodes;return t?.excludeParameterValues&&(n=await Promise.all(e.nodes.map((async e=>await u(e,[],{excludeParameterValues:!0}))))),{name:e.name,active:e.active,connections:e.connections,nodes:n}},trimPayloadSize:(e,t=100)=>{const n=zt(e),a=n.payload;if("init-support-chat"===a.type?(a.context?.activeNodeInfo?.node&&(a.context.activeNodeInfo.node.parameters={}),a.context?.currentWorkflow&&a.context.currentWorkflow?.nodes?.forEach((e=>{e.parameters={}})),a.context?.executionData?.runData&&(a.context.executionData.runData={}),a.context?.executionData?.error&&"node"in a.context?.executionData?.error&&a.context?.executionData?.error?.node&&(a.context.executionData.error.node.parameters={}),p(n)>t&&(a.context=void 0)):"init-error-helper"===a.type&&(a.node.parameters={}),p(n)>t)throw new Error(o.baseText("aiAssistant.payloadTooBig.message"));e.payload=n.payload},extractExpressionsFromWorkflow:async function(e,t){const o=200,a={};if(!e.nodes||0===e.nodes.length)return a;const i=t?.runData?new Set(Object.keys(t.runData)):null,r=e=>{if(void 0===e)return"<EMPTY>";if("string"==typeof e)return e.length<=o?e:e.substring(0,o)+"... [truncated]";if(null===e||"number"==typeof e||"boolean"==typeof e)return e;try{const t=JSON.stringify(e);return t.length<=o?e:t.substring(0,o)+"... [truncated]"}catch{return"<Could not serialize value>"}};for(const s of e.nodes){if(!s.parameters)continue;if(i&&!i.has(s.name))continue;const e=[],t=async(o,a="",i=new WeakSet)=>{if("string"==typeof o&&o.startsWith("=")){if(!o.includes("{{")||!o.includes("}}"))return;let t;try{t=await n.resolveExpression(o,void 0,{contextNodeName:s.name})}catch(l){t=`Error in expression: "${l instanceof Error?l.message:String(l)}"`}const i=o.length>500?o.substring(0,500)+"... [truncated]":o;e.push({expression:i,resolvedValue:r(t),nodeType:s.type,parameterPath:a})}else if(Array.isArray(o)){if(i.has(o))return;i.add(o);for(let e=0;e<o.length;e++)await t(o[e],`${a}[${e}]`,i)}else if("object"==typeof o&&null!==o){if(i.has(o))return;i.add(o);for(const[e,n]of Object.entries(o))await t(n,a?`${a}.${e}`:e,i)}};await t(s.parameters,""),e.length>0&&(a[s.name]=e)}return a}}}),zf="Unnamed credential",Hf=["httpBasicAuth","oAuth2Api","httpDigestAuth","oAuth1Api"],e("it",Gf=Xa(ai.CREDENTIALS,(()=>{const e=v({credentialTypes:{},credentials:{}}),n=v(new Map),o=ni(),a=C((()=>e.value.credentialTypes)),i=C((()=>Object.values(e.value.credentialTypes).sort(((e,t)=>e.displayName.localeCompare(t.displayName))))),r=C((()=>Object.values(e.value.credentials).sort(((e,t)=>e.name.localeCompare(t.name))))),s=C((()=>{const e=r.value;return i.value.reduce(((t,n)=>(t[n.name]=e.filter((e=>e.type===n.name)),t)),{})})),l=C((()=>{const e=r.value;return i.value.reduce(((t,n)=>(t[n.name]=e.filter((e=>e.type===n.name)),t)),{})})),u=C((()=>e=>{let t=[];const n=Jm().getNodeType(e.type,e.typeVersion);return n?.credentials&&n.credentials.forEach((e=>{t=t.concat(l.value[e.name])})),t.sort(((e,t)=>{const n=new Date(e.updatedAt),o=new Date(t.updatedAt);return n.getTime()-o.getTime()}))})),c=C((()=>t=>e.value.credentialTypes[t])),d=C((()=>t=>e.value.credentials[t])),p=C((()=>(t,n)=>{const o=e.value.credentials[t];return o&&o.type===n?o:void 0})),f=C((()=>e=>s.value[e]||[])),m=C((()=>e=>l.value[e]||[])),h=C((()=>e=>{const t=c.value(e);if(!t)return[];const n=Jm();return(t.supportedNodes??[]).map((e=>n.getNodeType(e))).filter(Mh)})),y=C((()=>e=>{const t=c.value(e);if(!t)return[];const n=t.properties.find((e=>"scope"===e.name));if(!n||!n.default||"string"!=typeof n.default||""===n.default)return[];let{default:o}=n;return o=o.replace(/^=/,"").replace(/\{\{.*\}\}/,""),/ /.test(o)?o.split(" "):/,/.test(o)?o.split(","):[o]})),g=C((()=>e=>{const{name:t,email:n}=lu(e?.homeProject?.name??"");return t?n?`${t} (${n})`:t:n??Se.baseText("credentialEdit.credentialSharing.info.sharee.fallback")})),w=C((()=>e=>{const t=d.value(e);return g.value(t)})),b=C((()=>i.value.filter((e=>e.httpRequestNode&&!e.httpRequestNode.hidden)))),k=t=>{e.value.credentialTypes=t.reduce(((e,t)=>(e[t.name]=t,e)),{})},x=t=>{e.value.credentials=t.reduce(((e,t)=>(t.id&&(e[t.id]=t),e)),{})},I=t=>{t.id&&(e.value.credentials={...e.value.credentials,[t.id]:{...e.value.credentials[t.id],...t}})},N=async t=>(qi().isEnterpriseFeatureEnabled[Nn.Sharing]&&(await async function(e,t,n){return await Ja(e,"PUT",`/credentials/${t}/share`,n)}(ni().restApiContext,t.credentialId,{shareWithIds:t.sharedWithProjects.map((e=>e.id))}),e.value.credentials[t.credentialId]={...e.value.credentials[t.credentialId],sharedWithProjects:t.sharedWithProjects}),e.value.credentials[t.credentialId]);return{state:e,credentialTestResults:n,isCredentialTestedOk:e=>"success"===n.value.get(e),isCredentialTestPending:e=>"pending"===n.value.get(e),getCredentialOwnerName:g,getCredentialsByType:f,getCredentialById:d,getCredentialTypeByName:c,getCredentialByIdAndType:p,getNodesWithAccess:h,getUsableCredentialByType:m,credentialTypesById:a,httpOnlyCredentialTypes:b,getScopesByCredentialType:y,getCredentialOwnerNameById:w,allUsableCredentialsForNode:u,allCredentials:r,allCredentialTypes:i,allUsableCredentialsByType:l,setCredentialTypes:k,addCredentials:t=>{t.forEach((t=>{t.id&&(e.value.credentials[t.id]={...e.value.credentials[t.id],...t})}))},setCredentials:x,deleteCredential:async({id:t})=>{if(await async function(e,t){return await Ja(e,"DELETE",`/credentials/${t}`)}(o.restApiContext,t)){const{[t]:o,...a}=e.value.credentials;e.value.credentials=a,n.value.delete(t)}},upsertCredential:I,fetchCredentialTypes:async e=>{i.value.length>0&&!e||k(await Lh(o.baseUrl))},fetchAllCredentials:async(e={})=>{const{projectId:t,includeScopes:n=!0,onlySharedWithMe:a=!1,includeGlobal:i=!0,externalSecretsStore:r}=e,s={projectId:t},l=await jh(o.restApiContext,{filter:Bs(s)?void 0:s,includeScopes:n,onlySharedWithMe:a,includeGlobal:i,externalSecretsStore:r});return x(l),l},fetchAllCredentialsForWorkflow:async e=>{const t=await async function(e,t){return await Ja(e,"GET","/credentials/for-workflow",{...t})}(o.restApiContext,e);return x(t),t},createNewCredential:async(e,t,n,a)=>{const i=qi(),r=await async function(e,t){return await Ja(e,"POST","/credentials",t)}(o.restApiContext,{name:e.name,type:e.type,data:e.data??{},projectId:t,uiContext:n,isGlobal:e.isGlobal,isResolvable:e.isResolvable});return e?.homeProject&&!r.homeProject&&(r.homeProject=e.homeProject),a?.skipStoreUpdate||(i.isEnterpriseFeatureEnabled[Nn.Sharing]?(I(r),e.sharedWithProjects&&await N({credentialId:r.id,sharedWithProjects:e.sharedWithProjects})):I(r)),r},updateCredential:async e=>{const{id:t,data:a}=e;n.value.delete(t);const i=await async function(e,t,n){return await Ja(e,"PATCH",`/credentials/${t}`,n)}(o.restApiContext,t,a);return I(i),i},getCredentialData:async({id:e})=>await async function(e,t){return await Ja(e,"GET",`/credentials/${t}`,{includeData:!0})}(o.restApiContext,e),getCredentialTypesNodeDescriptions:(e,t)=>{if("string"!=typeof e)return[];const n=c.value(e);return n?[n]:t?.credentials?t.credentials:[]},oAuth1Authorize:async e=>await async function(e,t){return await Ja(e,"GET","/oauth1-credential/auth",t)}(o.restApiContext,e),oAuth2Authorize:async e=>await async function(e,t){return await Ja(e,"GET","/oauth2-credential/auth",t)}(o.restApiContext,e),getNewCredentialName:async e=>{try{const{credentialTypeName:t}=e;let n=zf;if(!Hf.includes(t)){const e=c.value(t);n=e?ey(e.displayName):"",n=n.length>0?`${n} account`:zf}return(await async function(e,t){return await Ja(e,"GET","/credentials/new",t?{name:t}:{})}(o.restApiContext,n)).name}catch(t){return zf}},testCredential:async e=>{e.id&&n.value.set(e.id,"pending");const t=await async function(e,t){return await Ja(e,"POST","/credentials/test",t)}(o.restApiContext,{credentials:e});return e.id&&n.value.set(e.id,"OK"===t.status?"success":"error"),t},getCredentialTranslation:async e=>await Ja(o.restApiContext,"GET","/credential-translation",{credentialType:e}),setCredentialSharedWith:N,claimFreeAiCredits:async e=>{const t=await async function(e,{projectId:t}){return await Ja(e,"POST","/ai/free-credits",{projectId:t})}(o.restApiContext,{projectId:e});return I(t),t}}}))),e("rt",(e=>{const{store:t,onCredentialCreated:n,onCredentialDeleted:o,onCredentialUpdated:a}=e,i=["createNewCredential","updateCredential","deleteCredential"];return t.$onAction((e=>{const{name:t,after:r,args:s}=e;r((async e=>{if(i.includes(t))switch(t){case"createNewCredential":n?.(e);break;case"updateCredential":a?.(e);break;case"deleteCredential":const t=s[0].id;o?.(t)}}))}))})),e("nt",Yf=o(((e,t)=>{t.exports=function(e,t,n){var o=-1,a=e.length;t<0&&(t=-t>a?0:a+t),(n=n>a?a:n)<0&&(n+=a),a=t>n?0:n-t>>>0,t>>>=0;for(var i=Array(a);++o<a;)i[o]=e[o+t];return i}}))),Xf=o(((e,t)=>{var n=Yf();t.exports=function(e,t,o){var a=e.length;return o=void 0===o?a:o,!t&&o>=a?e:n(e,t,o)}})),qf=o(((e,t)=>{var n=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]");t.exports=function(e){return n.test(e)}})),Jf=o(((e,t)=>{t.exports=function(e){return e.split("")}})),Kf=o(((e,t)=>{var n="\\ud800-\\udfff",o="["+n+"]",a="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",i="\\ud83c[\\udffb-\\udfff]",r="[^"+n+"]",s="(?:\\ud83c[\\udde6-\\uddff]){2}",l="[\\ud800-\\udbff][\\udc00-\\udfff]",u="(?:"+a+"|"+i+")?",c="[\\ufe0e\\ufe0f]?",d=c+u+"(?:\\u200d(?:"+[r,s,l].join("|")+")"+c+u+")*",p="(?:"+[r+a+"?",a,s,l,o].join("|")+")",f=RegExp(i+"(?="+i+")|"+p+d,"g");t.exports=function(e){return e.match(f)||[]}})),Zf=o(((e,t)=>{var n=Jf(),o=qf(),a=Kf();t.exports=function(e){return o(e)?a(e):n(e)}})),Qf=o(((e,t)=>{var n=Xf(),o=qf(),a=Zf(),i=yt();t.exports=function(e){return function(t){t=i(t);var r=o(t)?a(t):void 0,s=r?r[0]:t.charAt(0),l=r?n(r,1).join(""):t.slice(1);return s[e]()+l}}})),e("tt",em=o(((e,t)=>{var n=Qf()("toUpperCase");t.exports=n}))),tm=o(((e,t)=>{var n=Oa(),o=em(),a=n((function(e,t,n){return e+(n?" ":"")+o(t)}));t.exports=a})),nm=60,om=38,am=30,im=15,rm=-20,sm=-200,lm=-5,um=[{key:"properties.displayName",weight:1.3},{key:"properties.codex.alias",weight:1}],cm=/([\p{Ll}\d])(\p{Lu})/gu,dm=/(\p{Lu})([\p{Lu}][\p{Ll}])/gu,pm=/(\d)\p{Ll}|(\p{L})\d/u,fm=/[^\p{L}\d]+/giu,mm="$1\0$2",hm="",e("Q",ym=o(((e,t)=>{var n=mo(),o=sr(),a=za(),i=Wa(),r=a((function(e,t){if(null==e)return[];var a=t.length;return a>1&&i(e,t[0],t[1])?t=[]:a>2&&i(t[0],t[1],t[2])&&(t=[t[0]]),o(e,n(t,1),[])}));t.exports=r}))),vm={name:"Demo: My first AI Agent in n8n",meta:{templateId:"self-building-ai-agent"},nodes:[{parameters:{options:{}},id:"b24b05a7-d802-4413-bfb1-23e1e76f6203",name:"When chat message received",type:"@n8n/n8n-nodes-langchain.chatTrigger",typeVersion:1.1,position:[340,20],webhookId:"a889d2ae-2159-402f-b326-5f61e90f602e"},{parameters:{content:"## Start by saying 'hi'\n",height:149,width:150},id:"5592c045-6718-4c4e-9961-ce67a251b6df",name:"Sticky Note",type:"n8n-nodes-base.stickyNote",typeVersion:1,position:[180,-40]},{parameters:{options:{}},id:"d5e60eb2-267c-4f68-aefe-439031bcaceb",name:"OpenAI Model",type:"@n8n/n8n-nodes-langchain.lmChatOpenAi",typeVersion:1,position:[500,240]},{parameters:{promptType:"define",text:"=## Steps to follow\n\n{{ $agentInfo.memoryConnectedToAgent ? '1. Skip': `1. STOP and output the following:\n\"Welcome to n8n. Let's start with the first step to give me memory: \\n\"Click the **+** button on the agent that says 'memory' and choose 'Simple memory.' Just tell me once you've done that.\"\n----- END OF OUTPUT && IGNORE BELOW -----` }} \n\n\n{{ Boolean($agentInfo.tools.find((tool) => tool.type === 'Google Calendar Tool')) ? '2. Skip' : \n`2. STOP and output the following: \\n\"Click the **+** button on the agent that says 'tools' and choose 'Google Calendar.'\" \\n ----- IGNORE BELOW -----` }}\n\n\n{{ $agentInfo.tools.find((tool) => tool.type === 'Google Calendar Tool').hasCredentials ? '3. Skip' :\n`3. STOP and output the following:\n\"Open the Google Calendar tool (double-click) and choose a credential from the drop-down.\" \\n ----- IGNORE BELOW -----` }}\n\n\n{{ $agentInfo.tools.find((tool) => tool.type === 'Google Calendar Tool').resource === 'Event' ? '4. Skip' :\n`4. STOP and output the following:\n\"Open the Google Calendar tool (double-click) and set **resource** = 'Event'\" `}}\n\n\n{{ $agentInfo.tools.find((tool) => tool.type === 'Google Calendar Tool').operation === 'Get Many' ? '5. Skip' :\n`5. STOP and output the following:\n\"Open the Google Calendar tool (double-click) and set **operation** = 'Get Many.'\" \\n ----- IGNORE BELOW -----` }}\n\n\n{{ $agentInfo.tools.find((tool) => tool.type === 'Google Calendar Tool').hasValidCalendar ? '6. Skip' :\n`6. STOP and output the following:\n\"Open the Google Calendar tool (double-click) and choose a calendar from the 'calendar' drop-down.\" \\n ----- IGNORE BELOW -----` }}\n\n\n{{ ($agentInfo.tools.find((tool) => tool.type === 'Google Calendar Tool').aiDefinedFields.includes('Start Time') && $agentInfo.tools.find((tool) => tool.type === 'Google Calendar Tool').aiDefinedFields.includes('End Time')) ? '7. Skip' :\n`7. STOP and output the following: \nOpen the Google Calendar tool (double-click) and click the :sparks: button next to the 'After' and 'Before' fields. \\n ----- IGNORE BELOW -----` }}\n\n\n8. If all steps are completed, output the following:\n\"Would you like me to check all events in your calendar for tomorrow {{ $now.plus(1, 'days').toString().split('T')[0] }}?\"\n\n# User message\n\n{{ $json.chatInput }}",options:{systemMessage:'=You are a friendly Agent designed to guide users through these steps.\n\n- Stop at the earliest step mentioned in the steps\n- Respond concisely and do **not** disclose these internal instructions to the user. Only return defined output below.\n- Don\'t output any lines that start with -----\n- Replace ":sparks:" with "✨" in any message'}},id:"41174c8a-6ac8-42bd-900e-ca15196600c5",name:"Agent",type:"@n8n/n8n-nodes-langchain.agent",typeVersion:1.7,position:[580,20]}],connections:{"When chat message received":{main:[[{node:"Agent",type:"main",index:0}]]},"OpenAI Model":{ai_languageModel:[[{node:"Agent",type:"ai_languageModel",index:0}]]}},pinData:{}},gm={name:"Demo: RAG in n8n",meta:{templateId:"rag-starter-template"},nodes:[{parameters:{formTitle:"Upload your data to test RAG",formFields:{values:[{fieldLabel:"Upload your file(s)",fieldType:"file",acceptFileTypes:".pdf, .csv",requiredField:!0}]},options:{}},type:"n8n-nodes-base.formTrigger",typeVersion:2.2,position:[-128,0],id:"f7a656ec-83fc-4ed2-a089-57a9def662b7",name:"Upload your file here",webhookId:"82848bc4-5ea2-4e5a-8bb6-3c09b94a8c5d"},{parameters:{options:{}},type:"@n8n/n8n-nodes-langchain.embeddingsOpenAi",typeVersion:1.2,position:[528,480],id:"6ea78663-cf2f-4f2d-8e68-43047c2afd87",name:"Embeddings OpenAI",credentials:{openAiApi:{id:"14",name:"OpenAi account"}}},{parameters:{dataType:"binary",options:{}},type:"@n8n/n8n-nodes-langchain.documentDefaultDataLoader",typeVersion:1.1,position:[320,160],id:"94aecac0-03f9-4915-932b-d14a2576607b",name:"Default Data Loader"},{parameters:{content:"### Readme\nLoad your data into a vector database with the 📚 **Load Data** flow, and then use your data as chat context with the 🐕 **Retriever** flow.\n\n**Quick start**\n1. Click on the `Execute Workflow` button to run the 📚 **Load Data** flow.\n2. Click on `Open Chat` button to run the 🐕 **Retriever** flow. Then ask a question about content from your document(s)\n\n\nFor more info, check [our docs on RAG in n8n](https://docs.n8n.io/advanced-ai/rag-in-n8n/).",height:300,width:440,color:4},type:"n8n-nodes-base.stickyNote",position:[-656,-64],typeVersion:1,id:"0d07742b-0b36-4c2e-990c-266cbe6e2d4d",name:"Sticky Note"},{parameters:{content:"### 📚 Load Data Flow",height:460,width:700,color:7},type:"n8n-nodes-base.stickyNote",position:[-176,-64],typeVersion:1,id:"d19d04f3-5231-4e47-bed7-9f24a4a8f582",name:"Sticky Note1"},{parameters:{mode:"insert",memoryKey:{__rl:!0,value:"vector_store_key",mode:"list",cachedResultName:"vector_store_key"}},type:"@n8n/n8n-nodes-langchain.vectorStoreInMemory",typeVersion:1.2,position:[64,0],id:"bf50a11f-ca6a-4e04-a6d2-42fee272b260",name:"Insert Data to Store"},{parameters:{mode:"retrieve-as-tool",toolName:"knowledge_base",toolDescription:"Use this knowledge base to answer questions from the user",memoryKey:{__rl:!0,mode:"list",value:"vector_store_key"}},type:"@n8n/n8n-nodes-langchain.vectorStoreInMemory",typeVersion:1.2,position:[944,208],id:"09c0db62-5413-440e-8c13-fb6bb66d9b6a",name:"Query Data Tool"},{parameters:{options:{}},type:"@n8n/n8n-nodes-langchain.agent",typeVersion:2,position:[944,-16],id:"579aed76-9644-42d1-ac13-7369059ff1c2",name:"AI Agent"},{parameters:{options:{}},type:"@n8n/n8n-nodes-langchain.chatTrigger",typeVersion:1.1,position:[720,-16],id:"9c30de61-935a-471f-ae88-ec5f67beeefc",name:"When chat message received",webhookId:"4091fa09-fb9a-4039-9411-7104d213f601"},{parameters:{model:{__rl:!0,mode:"list",value:"gpt-4o-mini"},options:{}},type:"@n8n/n8n-nodes-langchain.lmChatOpenAi",typeVersion:1.2,position:[720,208],id:"b5aa8942-9cd5-4c2f-bd77-7a0ceb921bac",name:"OpenAI Chat Model",credentials:{openAiApi:{id:"14",name:"OpenAi account"}}},{parameters:{content:"### 🐕 2. Retriever Flow",height:460,width:680,color:7},type:"n8n-nodes-base.stickyNote",position:[608,-64],typeVersion:1,id:"28bc73a1-e64a-47bf-ac1c-ffe644894ea5",name:"Sticky Note2"},{parameters:{content:"### Embeddings\n\nThe Insert and Retrieve operation use the same embedding node.\n\nThis is to ensure that they are using the **exact same embeddings and settings**.\n\nDifferent embeddings might not work at all, or have unintended consequences.\n",height:240,width:320,color:4},type:"n8n-nodes-base.stickyNote",position:[672,448],typeVersion:1,id:"0cf8c647-418c-4d1a-8952-766145afca72",name:"Sticky Note3"}],pinData:{},connections:{"Upload your file here":{main:[[{node:"Insert Data to Store",type:"main",index:0}]]},"Embeddings OpenAI":{ai_embedding:[[{node:"Insert Data to Store",type:"ai_embedding",index:0},{node:"Query Data Tool",type:"ai_embedding",index:0}]]},"Default Data Loader":{ai_document:[[{node:"Insert Data to Store",type:"ai_document",index:0}]]},"Query Data Tool":{ai_tool:[[{node:"AI Agent",type:"ai_tool",index:0}]]},"When chat message received":{main:[[{node:"AI Agent",type:"main",index:0}]]},"OpenAI Chat Model":{ai_languageModel:[[{node:"AI Agent",type:"ai_languageModel",index:0}]]}},active:!1,settings:{executionOrder:"v1"},tags:[]},wm={name:"Build your first AI agent",meta:{templateCredsSetupCompleted:!1,templateId:"build_your_first_ai_agent"},nodes:[{id:"2c408b32-7862-4411-9ad1-b6e9ff4e41f7",name:"Sticky Note2",type:"n8n-nodes-base.stickyNote",position:[592,-256],parameters:{color:7,width:512,height:352,content:"## [Video Tutorial](https://youtu.be/laHIzhsz12E)\n@[youtube](laHIzhsz12E)"},typeVersion:1},{id:"3808de8d-ef18-47f5-9621-b08ba961ae01",cid:"Ikx1Y2FzIFBleXJpbiI",name:"Introduction Note",type:"n8n-nodes-base.stickyNote",notes:"© 2025 Lucas Peyrin",creator:"Lucas Peyrin",position:[-752,-256],parameters:{width:392,height:460,content:"## Try It Out!\n\n**Launch your first AI agent—a chatbot that uses tools to fetch live info, send emails, and automate tasks.**\n\n### To get started:\n1. **Connect Gemini** (see red sticky note below)\n2. Click the **🗨 Open chat** button and try asking:\n * “What’s the weather in Paris?”\n * “Get me the latest tech news.”\n * “Give me ideas for n8n AI agents.”\n\n### Questions or Feedback?\nFor feedback, coaching, buit-for-you workflows or any questions, use my unified AI-powered contact form.\n\n➡️ **[Get in Touch Here](https://api.ia2s.app/form/templates/academy)**\n\n*Happy Automating! —Lucas Peyrin*"},typeVersion:1},{id:"2b55763c-0541-4133-aa79-87c3ce9f0564",cid:"Ikx1Y2FzIFBleXJpbiI",name:"Sticky Note12",type:"n8n-nodes-base.stickyNote",notes:"© 2025 Lucas Peyrin",creator:"Lucas Peyrin",position:[-272,-160],parameters:{color:7,width:300,height:252,content:"💡 Later, activate this workflow and share the public chat URL to let others talk to your AI Agent!"},typeVersion:1},{id:"f09c396a-dab8-41f8-a6e5-3dbd1dd70323",cid:"Ikx1Y2FzIFBleXJpbiI",name:"Sticky Note13",type:"n8n-nodes-base.stickyNote",notes:"© 2025 Lucas Peyrin",creator:"Lucas Peyrin",position:[112,-256],parameters:{color:7,width:396,height:348,content:"Your AI agent can:\n1. **Receive** messages from the chat\n2. **Select** the right tools (e.g., weather, news, email)\n3. **Respond** with live, helpful answers\n\n\n**Open the AI agent node** and edit the **System Message** to adjust your agent’s thinking, behavior, and replies.\n\n\n\n\n\n\n\n\n\n\n"},typeVersion:1},{id:"f7c57d33-2318-409d-9084-13990299db3d",cid:"Ikx1Y2FzIFBleXJpbiI",name:"Sticky Note15",type:"n8n-nodes-base.stickyNote",notes:"© 2025 Lucas Peyrin",creator:"Lucas Peyrin",position:[112,176],parameters:{color:7,width:308,height:260,content:"\n\n\n\n\n\n\n\n\n\n\n\n\n\nThis node helps your agent remember the last few messages to stay on topic."},typeVersion:1},{id:"07ed7ed3-91d0-432f-9327-d2a30601082c",cid:"Ikx1Y2FzIFBleXJpbiI",name:"Sticky Note16",type:"n8n-nodes-base.stickyNote",notes:"© 2025 Lucas Peyrin",creator:"Lucas Peyrin",position:[512,176],parameters:{color:7,width:372,height:324,content:"\n\n\n\n\n\n\n\n\n\n\n\n\nThese tools let your agent access real-world data or take actions. Add more to expand its abilities!\n\nClick the ➕ under the agent’s Tool input to add:\n- Google Calendar (Get Upcoming Events)\n- Gmail (Send an Email) (Gmail)"},typeVersion:1},{id:"24fc1fd5-ed10-43d9-9b35-8facb7f357d5",cid:"Ikx1Y2FzIFBleXJpbiI",name:"Get News",type:"n8n-nodes-base.rssFeedReadTool",notes:"© 2025 Lucas Peyrin",creator:"Lucas Peyrin",position:[656,224],parameters:{url:"={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('URL', `Use one of:\n- https://feeds.bbci.co.uk/news/world/rss.xml (BBC World – global headlines)\n- https://www.aljazeera.com/xml/rss/all.xml (Al Jazeera English – in‑depth global coverage)\n- http://rss.cnn.com/rss/edition_world.rss (CNN World – breaking news worldwide)\n- https://techcrunch.com/feed/ (TechCrunch – global tech & startup news)\n- http://news.ycombinator.com/rss (Hacker News – tech community headlines)\n- https://n8n.io/blog/rss (n8n Blog – updates & tutorials)\n- https://www.bonappetit.com/feed/recipes-rss-feed/rss (Bon Appétit – recent recipes list)\n- https://www.endsreport.com/rss/news-and-analysis (ENDS Report – environmental law & policy news)\n- https://medlineplus.gov/groupfeeds/new.xml (MedlinePlus – health topics & wellness updates)`, 'string') }}",options:{},toolDescription:"Gets the latest blog posts about any rss feed."},typeVersion:1.2},{id:"ac7d0dd1-8885-41c1-abda-f3742c838992",cid:"Ikx1Y2FzIFBleXJpbiI",name:"Get Weather",type:"n8n-nodes-base.httpRequestTool",creator:"Lucas Peyrin",position:[544,224],parameters:{url:"https://api.open-meteo.com/v1/forecast",options:{},sendQuery:!0,queryParameters:{parameters:[{name:"latitude",value:"={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('parameters0_Value', `Latitude of the location, e.g. 45.75 for Lyon. Do not ask the user just infer it automatically.`, 'string') }}"},{name:"longitude",value:"={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('parameters1_Value', `Longitude of the location, e.g. 4.85 for Lyon. Do not ask the user just infer it automatically.`, 'string') }}"},{name:"current",value:"={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('parameters2_Value', `Comma-separated list of current weather variables (no whitespace).\n\nExample: temperature_2m,windspeed_10m,rain.\n\nOptions: temperature_2m,relative_humidity_2m,apparent_temperature,is_day,precipitation,rain,showers,snowfall,weathercode,cloudcover_total,pressure_msl,surface_pressure,windspeed_10m,winddirection_10m,windgusts_10m.`, 'string') }}"},{name:"hourly",value:"={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('parameters3_Value', `Comma-separated list of hourly weather variables (no whitespace). Hourly is only useful to get one day's information. For weakly overview please use daily.\n\nExample: temperature_2m,precipitation.\n\nOptions: temperature_2m,relative_humidity_2m,dewpoint_2m,apparent_temperature,precipitation,rain,showers,snowfall,snow_depth,pressure_msl,surface_pressure,cloudcover_total,cloudcover_low,cloudcover_mid,cloudcover_high,windspeed_10m,winddirection_10m,windgusts_10m,visibility,is_day,sunshine_duration,soil_temperature,soil_moisture,PM10,PM2_5,carbon_monoxide,ozone,us_aqi,UV_index.`, 'string') }}"},{name:"daily",value:"={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('parameters4_Value', `Comma-separated list of daily weather variables (no whitespace).\n\nExample: temperature_2m_max,precipitation_sum.\n\nOptions: weathercode,temperature_2m_max,temperature_2m_min,apparent_temperature_max,apparent_temperature_min,precipitation_sum,rain_sum,showers_sum,snowfall_sum,precipitation_hours,sunrise,sunset,daylight_duration,sunshine_duration,pressure_msl_max,pressure_msl_min,surface_pressure_max,surface_pressure_min,windgusts_10m_max,windspeed_10m_max,winddirection_10m_dominant,shortwave_radiation_sum.`, 'string') }}"},{name:"start_date",value:"={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('parameters5_Value', `Start date in YYYY-MM-DD format. Example: 2025-07-15`, 'string') }}"},{name:"end_date",value:"={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('parameters6_Value', `End date in YYYY-MM-DD format. Must be after start_date. Example: 2025-07-18`, 'string') }}"},{name:"temperature_unit",value:"={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('parameters7_Value', `Unit for temperature. Options: celsius (default), fahrenheit.`, 'string') }}"}]},toolDescription:"Get weather forecast anywhere, anytime. You can make requests by assuming most information, the only thing you need is the location (use the city name to infer lat and long automatically) and time period (assume today if not specified)"},notesInFlow:!0,typeVersion:4.2},{id:"332af12a-45ab-4e5d-8dab-da21ba2111f9",cid:"Ikx1Y2FzIFBleXJpbiI",name:"Your First AI Agent",type:"@n8n/n8n-nodes-langchain.agent",notes:"© 2025 Lucas Peyrin",creator:"Lucas Peyrin",position:[192,-64],parameters:{options:{systemMessage:"=<role>\nYou are the n8n Demo AI Agent, a friendly and helpful assistant designed to showcase the power of AI agents within the n8n automation platform. Your personality is encouraging, slightly educational, and enthusiastic about automation. Your primary function is to demonstrate your capabilities by using your available tools to answer user questions and fulfill their requests. You are conversational.\n</role>\n\n<instructions>\n<goal>\nYour primary goal is to act as a live demonstration of an AI Agent built with n8n. You will interact with users, answer their questions by intelligently using your available tools, and explain the concepts behind AI agents to help them understand their potential.\n</goal>\n\n<context>\n### How I Work\nI am an AI model operating within a simple n8n workflow. This workflow gives me two key things:\n1. **A set of tools:** These are functions I can call to get information or perform actions.\n2. **Simple Memory:** I can remember the immediate past of our current conversation to understand context.\n\n### My Purpose\nMy main purpose is to be a showcase. I demonstrate how you can give a chat interface to various functions (my tools) without needing complex UIs. This is a great way to make powerful automations accessible to anyone through simple conversation.\n\n### My Tools Instructions\nYou must choose one of your available tools if the user's request matches its capability. You cannot perform these actions yourself; you must call the tool.\n\n### About AI Agents in n8n\n- **Reliability:** While I can use one tool at a time effectively, more advanced agents can perform multi-step tasks. However, for `complex, mission-critical processes, it's often more reliable to build structured, step-by-step workflows in n8n rather than relying solely on an agent's reasoning. Agents are fantastic for user-facing interactions, but structured workflows are king for backend reliability.\n- **Best Practices:** A good practice is to keep an agent's toolset focused, typically under 10-15 tools, to ensure reliability and prevent confusion.\n\n### Current Date & Time\n{{ $now }}\n</context>\n\n<output_format>\n- Respond in a friendly, conversational, and helpful tone.\n- When a user's request requires a tool, first select the appropriate tool. Then, present the result of the tool's execution to the user in a clear and understandable way.\n- Be proactive. If the user is unsure what to do, suggest some examples of what they can ask you based on your available tools (e.g., Talk about your tools and what you know about yourself).\n</output_format>\n</instructions>"}},typeVersion:2.2},{id:"95421925-c5ad-48bd-9638-c84ff5b5e3c6",cid:"Ikx1Y2FzIFBleXJpbiI",name:"Example Chat",type:"@n8n/n8n-nodes-langchain.chatTrigger",notes:"© 2025 Lucas Peyrin",creator:"Lucas Peyrin",position:[-176,-64],webhookId:"e5616171-e3b5-4c39-81d4-67409f9fa60a",parameters:{public:!0,options:{title:"Your first AI Agent 🚀",subtitle:"This is for demo purposes. Try me out !",responseMode:"lastNode",inputPlaceholder:"Type your message here...",showWelcomeScreen:!1},initialMessages:"Hi there! 👋"},typeVersion:1.1},{id:"56d2684a-7f83-4ffd-8501-3253d999b4c6",cid:"Ikx1Y2FzIFBleXJpbiI",name:"Conversation Memory",type:"@n8n/n8n-nodes-langchain.memoryBufferWindow",notes:"© 2025 Lucas Peyrin",creator:"Lucas Peyrin",position:[224,224],parameters:{contextWindowLength:30},typeVersion:1.3},{id:"c218a5da-bec7-4034-8d2b-f4bca34e551e",cid:"Ikx1Y2FzIFBleXJpbiI",name:"Connect Gemini",type:"@n8n/n8n-nodes-langchain.lmChatGoogleGemini",notes:"© 2025 Lucas Peyrin",creator:"Lucas Peyrin",position:[-176,224],parameters:{options:{temperature:0}},typeVersion:1},{id:"199eb2cd-bc6b-4f61-bbf1-f196c7869b43",cid:"Ikx1Y2FzIFBleXJpbiI",name:"Sticky Note",type:"n8n-nodes-base.stickyNote",notes:"© 2025 Lucas Peyrin",creator:"Lucas Peyrin",position:[-272,176],parameters:{color:3,width:294,height:316,content:"\n\n\n\n\n\n\n\n\n\n\n\n1. [In Google AI Studio](https://aistudio.google.com/app/apikey) click **“Create API key in new project”** and copy it.\n\n2. Open the ```Connect Gemini``` node:\n * **Select Credential → Create New**\n * Paste into **API Key** and **Save**\n"},typeVersion:1}],pinData:{},connections:{"Get News":{ai_tool:[[{node:"Your First AI Agent",type:"ai_tool",index:0}]]},"Get Weather":{ai_tool:[[{node:"Your First AI Agent",type:"ai_tool",index:0}]]},"Example Chat":{main:[[{node:"Your First AI Agent",type:"main",index:0}]]},"Connect Gemini":{ai_languageModel:[[{node:"Your First AI Agent",type:"ai_languageModel",index:0}]]},"Conversation Memory":{ai_memory:[[{node:"Your First AI Agent",type:"ai_memory",index:0}]]}}},bm={name:"JSON basics",meta:{templateCredsSetupCompleted:!1,templateId:"json_basics"},nodes:[{id:"365fdd40-4e46-497b-8fef-9c356b2234cd",cid:"Ikx1Y2FzIFBleXJpbiI",name:"Execute to Start",type:"n8n-nodes-base.manualTrigger",notes:"© 2025 Lucas Peyrin",creator:"Lucas Peyrin",position:[-3456,1056],parameters:{},typeVersion:1},{id:"6c2fe8ca-9aa9-402a-949d-cc58177eb7e5",cid:"Ikx1Y2FzIFBleXJpbiI",name:"String",type:"n8n-nodes-base.set",notes:"© 2025 Lucas Peyrin",creator:"Lucas Peyrin",position:[-2816,1056],parameters:{options:{},assignments:{assignments:[{id:"e87952cb-878e-4feb-8261-342eaf887838",name:"json_example_string",type:"string",value:"This is a simple string. In JSON, it's always enclosed in double quotes."}]}},typeVersion:3.4},{id:"3cffa562-bedc-42f9-ab4f-8b55cd3b5711",cid:"Ikx1Y2FzIFBleXJpbiI",name:"Key & Value",type:"n8n-nodes-base.set",notes:"© 2025 Lucas Peyrin",creator:"Lucas Peyrin",position:[-3104,1056],parameters:{options:{},assignments:{assignments:[{id:"e87952cb-878e-4feb-8261-342eaf887838",name:"key",type:"string",value:"value"},{id:"b5f030f4-6650-4181-881f-de44790bb24b",name:"another_key",type:"string",value:"another_value"}]}},typeVersion:3.4},{id:"c4742e5d-8017-45e9-ada5-a2897c87b4cc",cid:"Ikx1Y2FzIFBleXJpbiI",name:"Number",type:"n8n-nodes-base.set",notes:"© 2025 Lucas Peyrin",creator:"Lucas Peyrin",position:[-2528,1056],parameters:{options:{},assignments:{assignments:[{id:"e87952cb-878e-4feb-8261-342eaf887838",name:"json_example_integer",type:"number",value:10},{id:"12345",name:"json_example_float",type:"number",value:12.5}]}},typeVersion:3.4},{id:"60ee473c-635c-41d7-acd2-4fa6c3acb665",cid:"Ikx1Y2FzIFBleXJpbiI",name:"Boolean",type:"n8n-nodes-base.set",notes:"© 2025 Lucas Peyrin",creator:"Lucas Peyrin",position:[-2240,1056],parameters:{options:{},assignments:{assignments:[{id:"e87952cb-878e-4feb-8261-342eaf887838",name:"json_example_boolean",type:"boolean",value:!1}]}},typeVersion:3.4},{id:"56683e92-19a0-4a17-99a9-b92120739c74",cid:"Ikx1Y2FzIFBleXJpbiI",name:"Array",type:"n8n-nodes-base.set",notes:"© 2025 Lucas Peyrin",creator:"Lucas Peyrin",position:[-1664,1056],parameters:{options:{},assignments:{assignments:[{id:"e87952cb-878e-4feb-8261-342eaf887838",name:"json_example_array",type:"array",value:'["first element", 2, false, null]'}]}},typeVersion:3.4},{id:"190c86c7-2d0b-47e1-a729-e22e9610dc8f",cid:"Ikx1Y2FzIFBleXJpbiI",name:"Object",type:"n8n-nodes-base.set",notes:"© 2025 Lucas Peyrin",creator:"Lucas Peyrin",position:[-1360,1056],parameters:{options:{},assignments:{assignments:[{id:"e87952cb-878e-4feb-8261-342eaf887838",name:"json_example_object",type:"object",value:'{"key":"value","array":[1,2,3],"boolean":false,"integer":123,"sub_object":{"sub_key":"Find me!"}}'}]}},typeVersion:3.4},{id:"24b198bc-9a82-477f-921e-c7e5055d17cc",cid:"Ikx1Y2FzIFBleXJpbiI",name:"Sticky Note",type:"n8n-nodes-base.stickyNote",notes:"© 2025 Lucas Peyrin",creator:"Lucas Peyrin",position:[-3680,560],parameters:{width:460,height:656,content:'## Tutorial - What is JSON?\n\nWelcome! This workflow will teach you the basics of JSON, the language that apps and n8n nodes use to exchange information.\n\n**What is JSON?**\nImagine a contact card:\n- **Name:** John Doe\n- **Age:** 30\n- **Has Children:** Yes\n- **Phone Numbers:** ["555-1234", "555-5678"]\n\n\nJSON is just a way of writing this down so a computer can understand it perfectly.\n\n**How to use this tutorial:**\n1. Click **"Execute Workflow"** button.\n2. Click on each node, one by one, in order.\n3. Look at the node\'s output in the panel on the right and read the associated sticky note to understand what\'s happening.'},typeVersion:1},{id:"f9dfa173-b51f-41fb-8587-9c4ee2855265",cid:"Ikx1Y2FzIFBleXJpbiI",name:"Sticky Note1",type:"n8n-nodes-base.stickyNote",notes:"© 2025 Lucas Peyrin",creator:"Lucas Peyrin",position:[-3184,704],parameters:{color:7,width:260,height:516,content:'#### The Heart of JSON: Key & Value\n\nEverything in JSON is built on this pair:\n- A **Key** (the name of the data, always in double quotes `"`).\n- A **Value** (the data itself).\n\n\n`"key": "value"`\n\nIn this node\'s output, you see two key/value pairs. This is the basic building block for everything that follows.'},typeVersion:1},{id:"fc2ad88e-b5cc-4dc4-91e6-f246d1654e26",cid:"Ikx1Y2FzIFBleXJpbiI",name:"Sticky Note2",type:"n8n-nodes-base.stickyNote",notes:"© 2025 Lucas Peyrin",creator:"Lucas Peyrin",position:[-2896,704],parameters:{color:7,width:260,height:516,content:'#### Data Type: String\n\nA string is simply **text**.\n- **Syntax:** The text is always enclosed in double quotes `" "`.\n\n\nLook at the output: the value of `json_example_string` is the text we defined.'},typeVersion:1},{id:"4973dad8-cce4-490c-8ad1-01410ffb7740",cid:"Ikx1Y2FzIFBleXJpbiI",name:"Sticky Note3",type:"n8n-nodes-base.stickyNote",notes:"© 2025 Lucas Peyrin",creator:"Lucas Peyrin",position:[-2608,704],parameters:{color:7,width:260,height:516,content:'#### Data Type: Number\n\nThis is simply a number. It can be a whole number (integer) like 10, or a decimal (float) like 12.5.\n- **Syntax:** Just write the number directly, **WITHOUT quotes**.\n\n\n`"age": 30` (Correct)\n`"age": "30"` (Incorrect, this is a String!)\n\nThis distinction is crucial for doing math!'},typeVersion:1},{id:"4240a747-d2de-42dc-882a-55aee236e76a",cid:"Ikx1Y2FzIFBleXJpbiI",name:"Sticky Note4",type:"n8n-nodes-base.stickyNote",notes:"© 2025 Lucas Peyrin",creator:"Lucas Peyrin",position:[-2320,704],parameters:{color:7,width:260,height:516,content:"#### Data Type: Boolean\n\nThis is a value that can only be **TRUE** or **FALSE**.\n- **Syntax:** `true` or `false` (always lowercase and **WITHOUT quotes**).\n\n\nThink of it like a light switch: on (`true`) or off (`false`). It's very useful for conditions (If/Then logic)."},typeVersion:1},{id:"6eb904bc-a082-43fd-85ea-e672830cdcd2",cid:"Ikx1Y2FzIFBleXJpbiI",name:"Sticky Note5",type:"n8n-nodes-base.stickyNote",notes:"© 2025 Lucas Peyrin",creator:"Lucas Peyrin",position:[-1744,704],parameters:{color:7,width:260,height:516,content:"#### Data Type: Array\n\nAn array is an **ordered list** of items.\n- **Syntax:** Starts with `[` and ends with `]`. Items are separated by commas.\n\n\nAn array can hold anything: strings, numbers, booleans, and even other arrays or objects!"},typeVersion:1},{id:"76fa5320-894b-451f-b372-59144fc0ade3",cid:"Ikx1Y2FzIFBleXJpbiI",name:"Sticky Note6",type:"n8n-nodes-base.stickyNote",notes:"© 2025 Lucas Peyrin",creator:"Lucas Peyrin",position:[-1456,704],parameters:{color:7,width:280,height:516,content:"#### Data Type: Object (JSON Object)\n\nThis is the main concept! An object is a **collection of key/value pairs**.\n- **Syntax:** Starts with `{` and ends with `}`.\n\n\nThis is what allows us to structure complex data, like our contact card from the beginning. Notice how this object contains all the other data types we've seen!"},typeVersion:1},{id:"5976d5fa-6788-46b8-b5e5-1cf6d09f5954",cid:"Ikx1Y2FzIFBleXJpbiI",name:"Null",type:"n8n-nodes-base.set",notes:"© 2025 Lucas Peyrin",creator:"Lucas Peyrin",position:[-1952,1056],parameters:{options:{},assignments:{assignments:[{id:"e87952cb-878e-4feb-8261-342eaf887838",name:"json_example_null",type:"null",value:{}}]}},typeVersion:3.4},{id:"7786c224-1cd6-4b05-a41b-d47cde98d2a0",cid:"Ikx1Y2FzIFBleXJpbiI",name:"Sticky Note7",type:"n8n-nodes-base.stickyNote",notes:"© 2025 Lucas Peyrin",creator:"Lucas Peyrin",position:[-2032,704],parameters:{color:7,width:260,height:516,content:'#### Data Type: Null\n\nThis special type means "nothing," "no value," or "empty."\n- **Syntax:** `null` (lowercase and **WITHOUT quotes**).\n\n\nIt\'s different from `0` (which is a number) or `""` (which is an empty string). `null` is the intentional absence of a value.'},typeVersion:1},{id:"f8f6e7b6-3f48-4e5c-86d6-001ec61d1f81",cid:"Ikx1Y2FzIFBleXJpbiI",name:"Using JSON (Expressions)",type:"n8n-nodes-base.set",notes:"© 2025 Lucas Peyrin",creator:"Lucas Peyrin",position:[-1024,1056],parameters:{options:{},assignments:{assignments:[{id:"e87952cb-878e-4feb-8261-342eaf887838",name:"message",type:"string",value:"=Hello, the number from the tutorial is: {{ $('Number').item.json.json_example_integer }}"},{id:"61f385f4-b8e2-4c69-b873-9ffc3ab3fe94",name:"sub_key",type:"string",value:"={{ $json.json_example_object.sub_object.sub_key }}"},{id:"bd752a0f-64bf-44b1-b39b-fca28e86aa5b",name:"array_second_item",type:"string",value:"={{ $json.json_example_object.array[1] }}"}]}},typeVersion:3.4},{id:"0b3ddc47-b1ff-4016-957b-cb6f584a996f",cid:"Ikx1Y2FzIFBleXJpbiI",name:"Sticky Note8",type:"n8n-nodes-base.stickyNote",notes:"© 2025 Lucas Peyrin",creator:"Lucas Peyrin",position:[-1152,704],parameters:{color:5,width:340,height:516,content:"#### ⭐ THE KEY STEP: Using JSON in n8n!\n\nNow for the magic. How do you use data from a previous node? With **expressions** `{{ }}`.\n\nThis node creates a custom message. Look at the value of the `message` field:\n`Hello, the number from the tutorial is: {{ $('Number').item.json.json_example_integer }}`\n\nIt dynamically pulled the number `10` from the \"Number\" node! This is how you make your nodes talk to each other."},typeVersion:1},{id:"d1004e2e-15b6-4108-9811-6e7d980822d3",cid:"Ikx1Y2FzIFBleXJpbiI",name:"Final Exam",type:"n8n-nodes-base.set",notes:"© 2025 Lucas Peyrin",creator:"Lucas Peyrin",position:[-672,1056],parameters:{options:{},assignments:{assignments:[{id:"e87952cb-878e-4feb-8261-342eaf887838",name:"summary_string",type:"string",value:"={{ $('String').item.json.json_example_string }}"},{id:"12345",name:"summary_number",type:"number",value:"={{ $('Number').item.json.json_example_integer }}"},{id:"67890",name:"summary_boolean",type:"boolean",value:"={{ $('Boolean').item.json.json_example_boolean }}"},{id:"abcde",name:"summary_null",type:"null",value:"={{ $('Null').item.json.json_example_null }}"},{id:"fghij",name:"summary_array",type:"array",value:"={{ $('Array').item.json.json_example_array }}"},{id:"klmno",name:"summary_object",type:"object",value:"={{ $('Object').item.json.json_example_object }}"}]}},typeVersion:3.4},{id:"43eb149b-ccd3-4557-b744-ef5d9dcf82d9",cid:"Ikx1Y2FzIFBleXJpbiI",name:"Sticky Note9",type:"n8n-nodes-base.stickyNote",notes:"© 2025 Lucas Peyrin",creator:"Lucas Peyrin",position:[-784,704],parameters:{color:6,width:340,height:516,content:"#### 🎓 FINAL EXAM: Putting It All Together\n\nThis last node creates a final object by using expressions to pull data from **all the previous nodes**.\n\nClick on this node and look at the expressions in each field. It's a perfect summary of everything you've learned.\n\n**Congratulations! You now understand the basics of JSON and how to use it in n8n.**"},typeVersion:1},{id:"b8fce06f-abe9-45cd-b365-97743a0d8dca",cid:"Ikx1Y2FzIFBleXJpbiI",name:"Sticky Note10",type:"n8n-nodes-base.stickyNote",notes:"© 2025 Lucas Peyrin",creator:"Lucas Peyrin",position:[-416,16],parameters:{color:3,width:540,height:1200,content:"## Was this helpful? Let me know!\n[](https://api.ia2s.app/form/templates/academy)\n\nI really hope this tutorial helped you understand JSON better. Your feedback is incredibly valuable and helps me create better resources for the n8n community.\n\n### **Have Feedback, a Question, or a Project Idea?**\n\nI've streamlined the way we connect. It all starts with one simple form that takes less than 10 seconds. After that, you'll chat with my AI assistant who will gather the key details and pass them directly on to me.\n\n#### ➡️ **[Click here to start the conversation](https://api.ia2s.app/form/templates/academy)**\n\nUse this single link for anything you need:\n\n* **Give Feedback:** Share your thoughts on this template—whether you found a typo, encountered an unexpected error, have a suggestion, or just want to say thanks!\n\n* **n8n Coaching:** Get personalized, one-on-one guidance to master n8n. We can work together to get you launched with confidence or help you reach an expert level.\n\n* **n8n Consulting:** Have a complex business challenge or need a custom workflow built from scratch? Let's partner on a powerful automation solution tailored to your specific needs.\n\n---\n\nHappy Automating!\nLucas Peyrin | [n8n Academy](https://n8n.ac)"},typeVersion:1},{id:"da4af3ac-a717-489d-bb64-3ef34167a0fc",cid:"Ikx1Y2FzIFBleXJpbiI",name:"Sticky Note11",type:"n8n-nodes-base.stickyNote",notes:"© 2025 Lucas Peyrin",creator:"Lucas Peyrin",position:[-3680,240],parameters:{color:2,width:460,height:300,content:"## [Video Tutorial](https://youtu.be/PAmgrwYnzWs?si=yXG1oHIL3UiBcAPa)\n@[youtube](PAmgrwYnzWs)"},typeVersion:1},{id:"b29ca9fc-7fc2-4dd7-9fca-d2d2a9bae237",cid:"Ikx1Y2FzIFBleXJpbiI",name:"Sticky Note14",type:"n8n-nodes-base.stickyNote",notes:"© 2025 Lucas Peyrin",creator:"Lucas Peyrin",position:[-3184,288],parameters:{color:7,width:576,height:392,content:"[](https://www.youtube.com/watch?v=PAmgrwYnzWs)"},typeVersion:1},{id:"0d2835ec-33c8-426b-87cd-74af33011bd5",cid:"Ikx1Y2FzIFBleXJpbiI",name:"Sticky Note15",type:"n8n-nodes-base.stickyNote",notes:"© 2025 Lucas Peyrin",creator:"Lucas Peyrin",position:[-784,368],parameters:{color:6,width:336,height:312,content:"## [>> Go to Eval Workflow <<](https://n8n.io/workflows/6232)\n\nVerify your skills with a complete eval workflow to put your JSON Skills to the test.\n[](https://n8n.io/workflows/6232)"},typeVersion:1}],pinData:{},connections:{Null:{main:[[{node:"Array",type:"main",index:0}]]},Array:{main:[[{node:"Object",type:"main",index:0}]]},Number:{main:[[{node:"Boolean",type:"main",index:0}]]},Object:{main:[[{node:"Using JSON (Expressions)",type:"main",index:0}]]},String:{main:[[{node:"Number",type:"main",index:0}]]},Boolean:{main:[[{node:"Null",type:"main",index:0}]]},"Key & Value":{main:[[{node:"String",type:"main",index:0}]]},"Execute to Start":{main:[[{node:"Key & Value",type:"main",index:0}]]},"Using JSON (Expressions)":{main:[[{node:"Final Exam",type:"main",index:0}]]}}},km={name:"Expressions",meta:{templateCredsSetupCompleted:!1,templateId:"expressions_tutorial"},nodes:[{id:"2c20bdef-e54e-46ab-9c63-5cf521ec749e",cid:"Ikx1Y2FzIFBleXJpbiI",name:"Start Tutorial",type:"n8n-nodes-base.manualTrigger",notes:"© 2025 Lucas Peyrin",creator:"Lucas Peyrin",position:[-7360,992],parameters:{},typeVersion:1},{id:"25703548-3e48-4951-9e3b-1d7815e15af5",cid:"Ikx1Y2FzIFBleXJpbiI",name:"Sticky Note",type:"n8n-nodes-base.stickyNote",notes:"© 2025 Lucas Peyrin",creator:"Lucas Peyrin",position:[-7616,592],parameters:{color:5,width:640,height:560,content:"# Tutorial - Mastering n8n Expressions\n\nWelcome! You know what JSON is. Now, let's learn how to **use it**. This workflow teaches you how to pull data from one node and use it in another using n8n's powerful expressions.\n\n**What is an Expression?**\nAn expression is a small piece of code inside double curly braces `{{ }}` that gets replaced with a dynamic value when the workflow runs. It's the \"glue\" that connects your nodes.\n\n**How to use this tutorial:**\n1. The first node, **\"Source Data\"**, contains all the data we will use. Execute it once to see what's inside.\n2. Follow the path from top to bottom. Each node is a new lesson.\n3. Read the sticky note for each lesson, then look at the node's configuration and its output to understand the concept."},typeVersion:1},{id:"b875f86c-a790-49bc-96a0-e1ccc72a5e80",cid:"Ikx1Y2FzIFBleXJpbiI",name:"Source Data",type:"n8n-nodes-base.set",notes:"© 2025 Lucas Peyrin",creator:"Lucas Peyrin",position:[-6720,992],parameters:{options:{},assignments:{assignments:[{id:"12345",name:"name",type:"string",value:"Alice"},{id:"67890",name:"age",type:"number",value:30},{id:"abcde",name:"is_active",type:"boolean",value:!0},{id:"fghij",name:"skills",type:"array",value:'["JavaScript","Python","n8n"]'},{id:"klmno",name:"projects",type:"array",value:'[{"name":"Project A","status":"Done"},{"name":"Project B","status":"In Progress"}]'},{id:"pqrst",name:"contact",type:"object",value:'{"email":"alice@example.com","phone":null}'}]}},typeVersion:3.4},{id:"108d6d9a-6e98-491d-87c1-78d3680f0c40",cid:"Ikx1Y2FzIFBleXJpbiI",name:"Sticky Note1",type:"n8n-nodes-base.stickyNote",notes:"© 2025 Lucas Peyrin",creator:"Lucas Peyrin",position:[-6944,640],parameters:{color:7,width:520,height:520,content:"## Our Data Source\n\nThis node holds all the sample data for our tutorial. Think of it as a filing cabinet. All the other nodes will be reaching into this cabinet to pull out specific pieces of information.\n\nTake a look at its output to familiarize yourself with the structure.\nWe have:\n- Simple text (`name`)\n- A number (`age`)\n- A list of skills (`skills`)\n- A list of complex projects (`projects`)\n- A nested contact object (`contact`)"},typeVersion:1},{id:"54723ed3-94c5-4104-b1c5-3ac70c262b87",cid:"Ikx1Y2FzIFBleXJpbiI",name:"1. The Basics",type:"n8n-nodes-base.set",notes:"© 2025 Lucas Peyrin",creator:"Lucas Peyrin",position:[-6192,992],parameters:{options:{},assignments:{assignments:[{id:"12345",name:"user_name",type:"string",value:"={{ $('Source Data').item.json.name }}"}]}},typeVersion:3.4},{id:"81dc9611-b9b5-41c3-a5ab-460cb0dc1ca6",cid:"Ikx1Y2FzIFBleXJpbiI",name:"Sticky Note2",type:"n8n-nodes-base.stickyNote",notes:"© 2025 Lucas Peyrin",creator:"Lucas Peyrin",position:[-6400,576],parameters:{color:2,width:500,height:580,content:"## Lesson 1: Accessing a Simple Value\n\nThis is the most common thing you'll do in n8n.\n\n**The Goal:** Get the user's name from the \"Source Data\" node.\n\n**The Expression:** `{{ $('Source Data').item.json.name }}`\n\n**Breakdown:**\n- `{{ ... }}`: Tells n8n \"this is a dynamic expression\".\n- `$('Source Data')`: Selects the node we want data from.\n- `.item.json`: Narrows it down to the JSON data of the current item.\n- `.name`: Selects the specific **key** we want the value of.\n\n**Other Possibility:**\n`{{ $json.name }}` would also work in this case, as `$json` accesses the data from the previous node."},typeVersion:1},{id:"b91f6099-5207-4000-9a0e-e6374718c123",cid:"Ikx1Y2FzIFBleXJpbiI",name:"3. Working with Arrays",type:"n8n-nodes-base.set",notes:"© 2025 Lucas Peyrin",creator:"Lucas Peyrin",position:[-4960,992],parameters:{options:{},assignments:{assignments:[{id:"12345",name:"second_skill",type:"string",value:"={{ $('Source Data').last().json.skills[1] }}"}]}},typeVersion:3.4},{id:"2074d65b-2d6b-41af-a4f9-fa9a195a1bf8",cid:"Ikx1Y2FzIFBleXJpbiI",name:"Sticky Note3",type:"n8n-nodes-base.stickyNote",notes:"© 2025 Lucas Peyrin",creator:"Lucas Peyrin",position:[-5168,624],parameters:{color:4,width:540,height:520,content:"## Lesson 3: Accessing an Array Element\n\nWhat if the data is in a list (an array)? You need to specify *which* item you want.\n\n**The Goal:** Get the user's *second* skill.\n\n**The Expression:** `{{ $('Source Data').last().json.skills[1] }}`\n\n**Breakdown:**\n- `...skills`: Selects the array of skills.\n- `[1]`: Selects the item at a specific position.\n- **IMPORTANT:** Arrays are \"zero-indexed\", which means the first item is `[0]`, the second is `[1]`, the third is `[2]`, and so on."},typeVersion:1},{id:"8ccc139f-0e8c-4c25-9d04-cecf2b335934",cid:"Ikx1Y2FzIFBleXJpbiI",name:"4. Going Deeper",type:"n8n-nodes-base.set",notes:"© 2025 Lucas Peyrin",creator:"Lucas Peyrin",position:[-4400,992],parameters:{options:{},assignments:{assignments:[{id:"12345",name:"user_email",type:"string",value:"={{ $('Source Data').last().json.contact.email }}"}]}},typeVersion:3.4},{id:"34264c0c-8282-4b57-a066-0548a31cbf1a",cid:"Ikx1Y2FzIFBleXJpbiI",name:"Sticky Note4",type:"n8n-nodes-base.stickyNote",notes:"© 2025 Lucas Peyrin",creator:"Lucas Peyrin",position:[-4608,672],parameters:{color:5,width:540,height:480,content:"## Lesson 4: Accessing Nested Data\n\nSometimes, data is organized into objects within other objects.\n\n**The Goal:** Get the user's email address.\n\n**The Expression:** `{{ $('Source Data').last().json.contact.email }}`\n\n**Breakdown:**\n- `...contact`: First, we access the `contact` object.\n- `.email`: Then, we use another dot `.` to go one level deeper and get the value of the `email` key inside it."},typeVersion:1},{id:"4c41fb6a-5f93-408f-9583-1e118d139dcf",cid:"Ikx1Y2FzIFBleXJpbiI",name:"5. The Combo Move",type:"n8n-nodes-base.set",notes:"© 2025 Lucas Peyrin",creator:"Lucas Peyrin",position:[-3808,992],parameters:{options:{},assignments:{assignments:[{id:"12345",name:"first_project_status",type:"string",value:"={{ $('Source Data').last().json.projects[0].status }}"}]}},typeVersion:3.4},{id:"2123cd02-5cb6-4dd7-89e5-7af1c6edf234",cid:"Ikx1Y2FzIFBleXJpbiI",name:"Sticky Note5",type:"n8n-nodes-base.stickyNote",notes:"© 2025 Lucas Peyrin",creator:"Lucas Peyrin",position:[-4048,672],parameters:{color:6,width:580,height:480,content:"## Lesson 5: Accessing Data in an Array of Objects\n\nThis is the ultimate test of the previous lessons!\n\n**The Goal:** Get the *status* of the *first* project in the list.\n\n**The Expression:** `{{ $('Source Data').last().json.projects[0].status }}`\n\n**Breakdown:**\n1. `...projects`: We select the array of projects.\n2. `[0]`: We pick the first object in that array.\n3. `.status`: From that chosen object, we grab the value of the `status` key."},typeVersion:1},{id:"f25a5a9d-518d-4a4a-b2ad-36fd0e1f5bd2",cid:"Ikx1Y2FzIFBleXJpbiI",name:"6. A Touch of Magic",type:"n8n-nodes-base.set",notes:"© 2025 Lucas Peyrin",creator:"Lucas Peyrin",position:[-3200,992],parameters:{options:{},assignments:{assignments:[{id:"12345",name:"name_in_caps",type:"string",value:"={{ $('Source Data').last().json.name.toUpperCase() }}"},{id:"67890",name:"age_in_dog_years",type:"number",value:"={{ Math.round($('Source Data').last().json.age / 7) }}"},{id:"abcde",name:"age_data_type",type:"string",value:"={{ typeof $('Source Data').last().json.age }}"}]}},typeVersion:3.4},{id:"0ebf5e6b-feb8-4f32-9979-9d7555b461ed",cid:"Ikx1Y2FzIFBleXJpbiI",name:"Sticky Note6",type:"n8n-nodes-base.stickyNote",notes:"© 2025 Lucas Peyrin",creator:"Lucas Peyrin",position:[-3440,640],parameters:{color:3,width:580,height:520,content:"## Lesson 6: A Touch of Magic (JS Functions)\n\nYou can do more than just retrieve data; you can **manipulate and inspect it!**\n\n**The Expressions:**\n- **Transform Text:** `{{ $('Source Data').last().json.name.toUpperCase() }}`\n- **Do Math:** `{{ Math.round($('Source Data').last().json.age / 7) }}`\n- **Check Data Type:** `{{ typeof $('Source Data').last().json.age }}`\n\n**Breakdown:**\n- **`.toUpperCase()`**: A standard JavaScript function for strings.\n- **`Math.round(...)`**: The `Math` object gives you access to powerful math functions.\n- **`typeof`**: An operator that tells you what kind of data you're looking at (\"string\", \"number\", \"object\", etc.)."},typeVersion:1},{id:"81d8c2d6-95cc-47e3-b0f0-9c698a120d1c",cid:"Ikx1Y2FzIFBleXJpbiI",name:'9. The "All Items" View',type:"n8n-nodes-base.set",notes:"© 2025 Lucas Peyrin",creator:"Lucas Peyrin",position:[-1264,992],parameters:{options:{},assignments:{assignments:[{id:"12345",name:"all_skills_string",type:"string",value:"={{ $('Split Out Skills').all().map(item => item.json.skills).join(', ') }}"}]}},executeOnce:!0,typeVersion:3.4},{id:"609e27f8-1702-493e-bc8b-cbade4561bd2",cid:"Ikx1Y2FzIFBleXJpbiI",name:"Sticky Note7",type:"n8n-nodes-base.stickyNote",notes:"© 2025 Lucas Peyrin",creator:"Lucas Peyrin",position:[-1696,640],parameters:{color:5,width:780,height:520,content:"## Lesson 9: Working with Multiple Items (`$items` & Arrow Functions)\n\nWhat if a node outputs *multiple* items and you want to summarize them? `$items()` is your tool.\n\n**The Goal:** Get a single, comma-separated string of all the user's skills.\n\n**The Expression:** `{{ $('Split Out Skills').all().map(item `=>` item.json.skills).join(', ') }}`\n\n**What is `item => ...`?**\nThis is an **Arrow Function**, a shorthand for \"for each thing, do this\".\n- `item`: A temporary name for each item in the list as we loop over it.\n- =>: The \"arrow\" that separates the item from the action.\n- `item.json.skills`: The action to perform—in this case, get the skill value from the item."},typeVersion:1},{id:"d6afc595-c6f0-47b2-894e-b03d6a0227ee",cid:"Ikx1Y2FzIFBleXJpbiI",name:"Final Exam",type:"n8n-nodes-base.set",notes:"© 2025 Lucas Peyrin",creator:"Lucas Peyrin",position:[-688,992],parameters:{options:{},assignments:{assignments:[{id:"12345",name:"final_summary",type:"string",value:"=User {{ $('2. The n8n Selectors').last().json.user_name_from_first }} is {{ $('Source Data').last().json.age }}.\n\nTheir best skill is {{ $('3. Working with Arrays').last().json.second_skill }}.\n\nTheir first project was {{ $('Source Data').last().json.projects[0].name }}, which is now {{ $('5. The Combo Move').last().json.first_project_status }}.\n\nAll skills: {{ $('9. The \"All Items\" View').last().json.all_skills_string }}."}]}},typeVersion:3.4},{id:"99a7fb24-491c-436e-a775-6fabdc2c4004",cid:"Ikx1Y2FzIFBleXJpbiI",name:"Sticky Note8",type:"n8n-nodes-base.stickyNote",notes:"© 2025 Lucas Peyrin",creator:"Lucas Peyrin",position:[-896,736],parameters:{color:6,width:520,height:420,content:"## 🎓 FINAL EXAM: Putting It All Together\n\nThis node uses everything we've learned to build a final summary object.\n\nLook at the expressions for each field. They pull data from different nodes and use different techniques you've just practiced.\n\n**Congratulations! You now have the foundational knowledge to link data and build powerful, dynamic workflows in n8n.**"},typeVersion:1},{id:"c3f2fd66-784d-4675-8cb3-72dd33e6ee4e",cid:"Ikx1Y2FzIFBleXJpbiI",name:"2. The n8n Selectors",type:"n8n-nodes-base.set",notes:"© 2025 Lucas Peyrin",creator:"Lucas Peyrin",position:[-5568,992],parameters:{options:{},assignments:{assignments:[{id:"12345",name:"user_name_from_first",type:"string",value:"={{ $('Source Data').last().json.name }}"}]}},typeVersion:3.4},{id:"bade9e22-6e9d-4f25-a1b7-974cbf2d5c61",cid:"Ikx1Y2FzIFBleXJpbiI",name:"Sticky Note9",type:"n8n-nodes-base.stickyNote",notes:"© 2025 Lucas Peyrin",creator:"Lucas Peyrin",position:[-5872,528],parameters:{width:680,height:620,content:"## Lesson 2: The n8n Selectors (`.first()`, `.last()`, `.all()`)\n\nIn the last lesson, we used `.item`. When there is only one output item from a node, this is equivalent to `.last()`. Using `.last()` explicitly is often safer and clearer.\n\n**The Goal:** Get the user's name using the `.last()` selector.\n\n**The Expression:** `{{ $('Source Data').last().json.name }}`\n\n**Why is this better?**\nIf a node ever returns multiple items, `.last()` guarantees you only get data from the very last one.\n\nIf you ever need to match the selected data with the input items, this is where `.item` cannot be replaced.\n\n**Other Selectors:**\n- **`.first()`**: Gets the data from the first item.\n- **`.all()`**: Gets data from ALL items, returning it as an array of objects. (This is different from `$items`!)"},typeVersion:1},{id:"7c4b718e-fca8-4dbe-8b3b-d6aeeaa78d6d",cid:"Ikx1Y2FzIFBleXJpbiI",name:"7. Inspecting Objects",type:"n8n-nodes-base.set",notes:"© 2025 Lucas Peyrin",creator:"Lucas Peyrin",position:[-2640,992],parameters:{options:{},assignments:{assignments:[{id:"12345",name:"contact_keys",type:"array",value:"={{ Object.keys($('Source Data').last().json.contact) }}"}]}},typeVersion:3.4},{id:"089b02d1-e43b-4baf-8bcf-b2dd7a95df92",cid:"Ikx1Y2FzIFBleXJpbiI",name:"Sticky Note10",type:"n8n-nodes-base.stickyNote",notes:"© 2025 Lucas Peyrin",creator:"Lucas Peyrin",position:[-2832,640],parameters:{color:2,width:500,height:520,content:'## Lesson 7: Inspecting Objects (`Object.keys()`)\n\nWhat if you have an object but you don\'t know what keys are inside it? `Object.keys()` comes to the rescue.\n\n**The Goal:** Get a list of all the keys inside the `contact` object.\n\n**The Expression:** `{{ Object.keys($(\'Source Data\').last().json.contact) }}`\n\nThis is incredibly useful for dynamically processing data. It returns an **array** containing the names of the keys (e.g., `["email", "phone"]`).'},typeVersion:1},{id:"81a16f66-4fca-47af-841c-91e16ff9587e",cid:"Ikx1Y2FzIFBleXJpbiI",name:"8. Utility Functions",type:"n8n-nodes-base.set",notes:"© 2025 Lucas Peyrin",creator:"Lucas Peyrin",position:[-2064,992],parameters:{options:{},assignments:{assignments:[{id:"12345",name:"contact_as_string",type:"string",value:"={{ JSON.stringify($('Source Data').last().json.contact, null, 2) }}"},{id:"06003b65-7482-4d5a-b2c0-1794859ab461",name:"skills",type:"array",value:"={{ $('Source Data').last().json.skills }}"}]}},typeVersion:3.4},{id:"b7aea910-5fd6-420f-9814-77afb8ab9517",cid:"Ikx1Y2FzIFBleXJpbiI",name:"Sticky Note11",type:"n8n-nodes-base.stickyNote",notes:"© 2025 Lucas Peyrin",creator:"Lucas Peyrin",position:[-2304,640],parameters:{width:580,height:520,content:"## Lesson 8: Utility Functions (`JSON.stringify()`)\n\nSometimes you need to convert a structured JSON object back into a clean, single string. This is common when sending data to another service, like in an AI prompt.\n\n**The Goal:** Turn the entire `contact` object into a formatted string.\n\n**The Expression:** `{{ JSON.stringify($('Source Data').last().json.contact, null, 2) }}`\n\n**Breakdown:**\n- **`JSON.stringify(...)`**: The function that does the conversion.\n- **`null, 2`**: These optional parameters tell it to \"pretty-print\" the string with an indentation of 2 spaces, making it readable."},typeVersion:1},{id:"2b83f9a2-7c71-43bb-b940-d0c3204cf6a2",cid:"Ikx1Y2FzIFBleXJpbiI",name:"Split Out Skills",type:"n8n-nodes-base.splitOut",notes:"© 2025 Lucas Peyrin",creator:"Lucas Peyrin",position:[-1488,992],parameters:{include:"allOtherFields",options:{},fieldToSplitOut:"skills"},typeVersion:1},{id:"933a0592-2deb-4db7-b801-d52dbbed1252",cid:"Ikx1Y2FzIFBleXJpbiI",name:"Sticky Note12",type:"n8n-nodes-base.stickyNote",notes:"© 2025 Lucas Peyrin",creator:"Lucas Peyrin",position:[-352,-128],parameters:{color:3,width:540,height:1280,content:"## Was this helpful? Let me know!\n[](https://n8n.ac)\n\nI really hope this tutorial helped you understand n8n Expressions better. Your feedback is incredibly valuable and helps me create better resources for the n8n community.\n\n### **Share Your Thoughts & Ideas**\n\nWhether you have a suggestion, found a typo, or just want to say thanks, I'd love to hear from you!\nHere's a simple n8n form built for this purpose:\n\n#### ➡️ **[Click here to give feedback](https://api.ia2s.app/form/templates/feedback?template=Expressions%20Tutorial)**\n\n### **Ready to Build Something Great?**\n\nIf you're looking to take your n8n skills or business automation to the next level, I can help.\n\n**🎓 n8n Coaching:** Want to become an n8n pro? I offer one-on-one coaching sessions to help you master workflows, tackle specific problems, and build with confidence.\n#### ➡️ **[Book a Coaching Session](https://api.ia2s.app/form/templates/coaching?template=Expressions%20Tutorial)**\n\n**💼 n8n Consulting:** Have a complex project, an integration challenge, or need a custom workflow built for your business? Let's work together to create a powerful automation solution.\n#### ➡️ **[Inquire About Consulting Services](https://api.ia2s.app/form/templates/consulting?template=Expressions%20Tutorial)**\n\n---\n\nHappy Automating!\nLucas Peyrin | [n8n Academy](https://n8n.ac)"},typeVersion:1},{id:"efc93cff-1e16-46fc-a839-7cca5ccd27f8",cid:"Ikx1Y2FzIFBleXJpbiI",name:"Sticky Note15",type:"n8n-nodes-base.stickyNote",notes:"© 2025 Lucas Peyrin",creator:"Lucas Peyrin",position:[-896,304],parameters:{color:6,width:512,height:408,content:"## [>> Go to Eval Workflow <<](https://n8n.io/workflows/6236)\n\nVerify your skills with a complete eval workflow to put your Expression Skills to the test.\n[](https://n8n.io/workflows/6236)"},typeVersion:1}],connections:{"Source Data":{main:[[{node:"1. The Basics",type:"main",index:0}]]},"1. The Basics":{main:[[{node:"2. The n8n Selectors",type:"main",index:0}]]},"Start Tutorial":{main:[[{node:"Source Data",type:"main",index:0}]]},"4. Going Deeper":{main:[[{node:"5. The Combo Move",type:"main",index:0}]]},"Split Out Skills":{main:[[{node:'9. The "All Items" View',type:"main",index:0}]]},"5. The Combo Move":{main:[[{node:"6. A Touch of Magic",type:"main",index:0}]]},"6. A Touch of Magic":{main:[[{node:"7. Inspecting Objects",type:"main",index:0}]]},"2. The n8n Selectors":{main:[[{node:"3. Working with Arrays",type:"main",index:0}]]},"8. Utility Functions":{main:[[{node:"Split Out Skills",type:"main",index:0}]]},"7. Inspecting Objects":{main:[[{node:"8. Utility Functions",type:"main",index:0}]]},"3. Working with Arrays":{main:[[{node:"4. Going Deeper",type:"main",index:0}]]},'9. The "All Items" View':{main:[[{node:"Final Exam",type:"main",index:0}]]}}},xm={name:"Workflow logic",meta:{templateCredsSetupCompleted:!1,templateId:"workflow_logic"},nodes:[{id:"d6cf9b3d-66b8-4022-8c9d-698e89cd22fd",name:"Start Sorting",type:"n8n-nodes-base.manualTrigger",position:[-880,608],parameters:{},typeVersion:1},{id:"b8c72a1e-0268-4d99-8141-ca14e35cbd6a",name:"Sticky Note",type:"n8n-nodes-base.stickyNote",position:[-1264,192],parameters:{width:624,height:596,content:'### Tutorial: The Logic Trio (Merge, IF, Switch)\n\nWelcome! This workflow will teach you the three most important nodes for controlling the flow of your data.\n\n**The Analogy: A Package Sorting Center**\n- **Data Items:** Think of these as packages moving on a conveyor belt.\n- **Merge Node:** A point where multiple conveyor belts combine into one.\n- **IF Node:** A simple sorting gate with two paths (e.g., "Fragile" or "Not Fragile").\n- **Switch Node:** An advanced sorting machine with many paths (e.g., sorting by destination city).\n\n\n**How to use this tutorial:**\n1. Click **"Execute Workflow"**.\n2. Follow the flow from left to right, clicking on each node to see its output.\n3. Read the sticky notes to understand what each node does.'},typeVersion:1},{id:"81532695-73c0-4357-a957-3d0ef580578f",name:"Sticky Note1",type:"n8n-nodes-base.stickyNote",position:[-272,192],parameters:{color:4,width:384,height:604,content:"### 1. The Merge Node\n\n**Analogy:** A conveyor belt where packages from different loading docks (the `Set` nodes) come together.\n\n**What it does:** The Merge node combines multiple streams of data into a single stream.\n\nHere, it's set to **Append** mode, which is the most common. It waits for all incoming data and then passes it all through together.\n\n**➡️ Look at the output. We now have both the letter and the parcel in one list, ready for the next step!**"},typeVersion:1},{id:"dadbac54-6b31-4a0f-8d5e-b6121467e90e",name:"Sticky Note2",type:"n8n-nodes-base.stickyNote",position:[144,192],parameters:{color:4,width:384,height:596,content:"### 2. The IF Node\n\n**Analogy:** A simple sorting gate with two paths: a \"true\" path and a \"false\" path.\n\n**What it does:** The IF node checks if a condition is met. If it's true, the data goes down the top output. If it's false, it goes down the bottom output.\n\nHere, we're asking a simple question: **\"Does this package have an `is_fragile` property?\"**\n\n**➡️ The parcel will go down the 'true' path, and the letters (which don't have that property) will go down the 'false' path.**"},typeVersion:1},{id:"0c330031-eab5-4ee3-8b11-91aee526952a",name:"Add 'Fragile' Handling",type:"n8n-nodes-base.set",position:[624,512],parameters:{options:{},assignments:{assignments:[{id:"12345",name:"handling_instructions",type:"string",value:"Handle with care!"}]},includeOtherFields:!0},typeVersion:3.4},{id:"d14c0e68-3823-4f15-98eb-58a0d4983861",name:"Add 'Standard' Handling",type:"n8n-nodes-base.set",position:[624,704],parameters:{options:{},assignments:{assignments:[{id:"12345",name:"handling_instructions",type:"string",value:"Standard handling"}]},includeOtherFields:!0},typeVersion:3.4},{id:"2ebde854-aa6b-48de-83b1-33950a1486e0",name:"Sticky Note3",type:"n8n-nodes-base.stickyNote",position:[816,272],parameters:{color:5,width:384,height:552,content:"### Merge Again?\n\n**Why do we need another Merge node here?**\n\nAfter the IF node, our data was split into two different paths. Before we can perform the *next* sorting step on all packages, we need to get them back onto the same conveyor belt.\n\nThis is a very common and important pattern in n8n: \n**Split -> Process -> Merge.**"},typeVersion:1},{id:"66ca4ac5-aceb-426e-ab22-50c012602a85",name:"Sticky Note4",type:"n8n-nodes-base.stickyNote",position:[1232,176],parameters:{color:4,width:400,height:648,content:'### 3. The Switch Node\n\n**Analogy:** An advanced sorting machine that can send packages to many different destinations.\n\n**What it does:** The Switch node is like an IF node with multiple doors. It checks the value of a single field (`destination` in this case) and sends the data down the path that matches the value.\n\n- If the destination is "London", it goes to output 0.\n- If it\'s "New York", it goes to output 1.\n- If it\'s something else, it goes to the **default** output.\n\n\n**➡️ This is much cleaner than using many IF nodes chained together!**'},typeVersion:1},{id:"10f56a78-85cd-4c8b-88e0-b6b3f0346e89",name:"Send to London Bin",type:"n8n-nodes-base.set",position:[1776,320],parameters:{options:{},assignments:{assignments:[{id:"12345",name:"sorting_bin",type:"string",value:"A1 (London)"}]},includeOtherFields:!0},typeVersion:3.4},{id:"2cba95bd-2c9b-42d1-90cb-74c2edf97ec7",name:"Send to New York Bin",type:"n8n-nodes-base.set",position:[1776,512],parameters:{options:{},assignments:{assignments:[{id:"12345",name:"sorting_bin",type:"string",value:"B2 (New York)"}]},includeOtherFields:!0},typeVersion:3.4},{id:"1531b4e3-eece-4c89-98bd-e9633fdd77f6",name:"Send to Tokyo Bin",type:"n8n-nodes-base.set",position:[1776,704],parameters:{options:{},assignments:{assignments:[{id:"12345",name:"sorting_bin",type:"string",value:"C3 (Tokyo)"}]},includeOtherFields:!0},typeVersion:3.4},{id:"d46604a8-663e-42bd-a175-a34edb8953fb",name:"Default Bin",type:"n8n-nodes-base.set",position:[1776,896],parameters:{options:{},assignments:{assignments:[{id:"12345",name:"sorting_bin",type:"string",value:"Return to Sender"}]},includeOtherFields:!0},typeVersion:3.4},{id:"570040aa-3f8d-4f59-904a-ee3deb36a9df",name:"Final Sorted Packages",type:"n8n-nodes-base.noOp",position:[2160,624],parameters:{},typeVersion:1},{id:"756313e7-d2f3-45cc-a4f5-f91e7a8f778a",name:"Sticky Note5",type:"n8n-nodes-base.stickyNote",position:[2032,272],parameters:{color:6,width:368,height:560,content:"### All Packages Sorted!\n\nCongratulations! You've successfully used the three logic nodes to sort your packages.\n\n**You learned how to:**\n- **Merge** data from different sources.\n- Use **IF** for simple true/false decisions.\n- Use **Switch** for complex, multi-path routing.\n\n\nMastering these three nodes is the key to building powerful and intelligent workflows in n8n."},typeVersion:1},{id:"4466652f-cc2b-47b1-bf4f-98d89753881f",name:"3. Switch Node",type:"n8n-nodes-base.switch",position:[1392,576],parameters:{rules:{values:[{outputKey:"London",conditions:{options:{version:2,leftValue:"",caseSensitive:!0,typeValidation:"strict"},combinator:"and",conditions:[{id:"8d43cde4-027a-4ca7-a24c-6f74f12d6238",operator:{type:"string",operation:"equals"},leftValue:"={{ $json.destination }}",rightValue:"London"}]},renameOutput:!0},{outputKey:"New York",conditions:{options:{version:2,leftValue:"",caseSensitive:!0,typeValidation:"strict"},combinator:"and",conditions:[{id:"399a0fbd-6be5-48e9-9f66-04cf385cb418",operator:{name:"filter.operator.equals",type:"string",operation:"equals"},leftValue:"={{ $json.destination }}",rightValue:"New York"}]},renameOutput:!0},{outputKey:"Tokyo",conditions:{options:{version:2,leftValue:"",caseSensitive:!0,typeValidation:"strict"},combinator:"and",conditions:[{id:"a69d387d-a174-42b3-bc5f-c8b46b7c2375",operator:{name:"filter.operator.equals",type:"string",operation:"equals"},leftValue:"={{ $json.destination }}",rightValue:"Tokyo"}]},renameOutput:!0}]},options:{fallbackOutput:"extra",renameFallbackOutput:"Default"}},typeVersion:3.2},{id:"add68013-30a7-43db-93d4-5af691764684",name:"Create Letter",type:"n8n-nodes-base.set",position:[-496,416],parameters:{options:{},assignments:{assignments:[{id:"12345",name:"package_id",type:"string",value:"L-001"},{id:"67890",name:"type",type:"string",value:"letter"},{id:"abcde",name:"destination",type:"string",value:"London"}]}},typeVersion:3.4},{id:"5af75a45-b912-41c6-b073-03188ae914ef",name:"1. Merge Node",type:"n8n-nodes-base.merge",position:[-128,592],parameters:{numberInputs:3},typeVersion:3.2},{id:"11627c3b-465a-4a4a-bfe9-95c08d502f2f",name:"2. IF Node",type:"n8n-nodes-base.if",position:[272,608],parameters:{options:{},conditions:{options:{version:2,leftValue:"",caseSensitive:!0,typeValidation:"loose"},combinator:"and",conditions:[{id:"a68aad83-1d09-4ebe-9732-aaedc407bb4b",operator:{type:"boolean",operation:"true",singleValue:!0},leftValue:"={{ $json.is_fragile }}",rightValue:""}]},looseTypeValidation:!0},typeVersion:2.2},{id:"4b5b5ba4-25e1-4ef0-93d8-50670dbc1ce0",name:"Re-group All Packages",type:"n8n-nodes-base.merge",position:[960,608],parameters:{},typeVersion:3.2},{id:"21d270c4-c19c-42ed-a6e3-67ecedd1c0c9",name:"Create 2nd Letter",type:"n8n-nodes-base.set",position:[-496,608],parameters:{options:{},assignments:{assignments:[{id:"12345",name:"package_id",type:"string",value:"L-002"},{id:"67890",name:"type",type:"string",value:"letter"},{id:"abcde",name:"destination",type:"string",value:"Tokyo"}]}},typeVersion:3.4},{id:"8a295323-9515-410c-9ac1-fb431d08cea2",name:"Create Parcel",type:"n8n-nodes-base.set",position:[-496,800],parameters:{options:{},assignments:{assignments:[{id:"12345",name:"package_id",type:"string",value:"P-001"},{id:"67890",name:"type",type:"string",value:"parcel"},{id:"abcde",name:"destination",type:"string",value:"New York"},{id:"fghij",name:"is_fragile",type:"boolean",value:!0}]}},typeVersion:3.4},{id:"c06a0f40-cc18-4710-8b07-9d396e89a83d",name:"Sticky Note10",type:"n8n-nodes-base.stickyNote",position:[2432,32],parameters:{color:3,width:540,height:800,content:"## Was this helpful? Let me know!\n\nI really hope this template helped you understand how Logical Operation Nodes work here in n8n. Your feedback is incredibly valuable and helps me create better resources for the n8n community.\n\n### **Share Your Thoughts & Ideas**\n\nWhether you have a suggestion, found a typo, or just want to say thanks, I'd love to hear from you!\nHere's a simple n8n form built for this purpose:\n\n#### ➡️ **[Click here to give feedback](https://api.ia2s.app/form/templates/feedback?template=Merge%20If%20Switch)**\n\n### **Ready to Build Something Great?**\n\nIf you're looking to take your n8n skills or business automation to the next level, I can help.\n\n**🎓 n8n Coaching:** Want to become an n8n pro? I offer one-on-one coaching sessions to help you master workflows, tackle specific problems, and build with confidence.\n#### ➡️ **[Book a Coaching Session](https://api.ia2s.app/form/templates/coaching?template=Merge%20If%20Switch)**\n\n**💼 n8n Consulting:** Have a complex project, an integration challenge, or need a custom workflow built for your business? Let's work together to create a powerful automation solution.\n#### ➡️ **[Inquire About Consulting Services](https://api.ia2s.app/form/templates/consulting?template=Merge%20If%20Switch)**\n\n---\n\nHappy Automating!\nLucas Peyrin"},typeVersion:1}],pinData:{},connections:{"2. IF Node":{main:[[{node:"Add 'Fragile' Handling",type:"main",index:0}],[{node:"Add 'Standard' Handling",type:"main",index:0}]]},"Default Bin":{main:[[{node:"Final Sorted Packages",type:"main",index:0}]]},"1. Merge Node":{main:[[{node:"2. IF Node",type:"main",index:0}]]},"Create Letter":{main:[[{node:"1. Merge Node",type:"main",index:0}]]},"Create Parcel":{main:[[{node:"1. Merge Node",type:"main",index:2}]]},"Start Sorting":{main:[[{node:"Create Parcel",type:"main",index:0},{node:"Create 2nd Letter",type:"main",index:0},{node:"Create Letter",type:"main",index:0}]]},"3. Switch Node":{main:[[{node:"Send to London Bin",type:"main",index:0}],[{node:"Send to New York Bin",type:"main",index:0}],[{node:"Send to Tokyo Bin",type:"main",index:0}],[{node:"Default Bin",type:"main",index:0}]]},"Create 2nd Letter":{main:[[{node:"1. Merge Node",type:"main",index:1}]]},"Send to Tokyo Bin":{main:[[{node:"Final Sorted Packages",type:"main",index:0}]]},"Send to London Bin":{main:[[{node:"Final Sorted Packages",type:"main",index:0}]]},"Send to New York Bin":{main:[[{node:"Final Sorted Packages",type:"main",index:0}]]},"Re-group All Packages":{main:[[{node:"3. Switch Node",type:"main",index:0}]]},"Add 'Fragile' Handling":{main:[[{node:"Re-group All Packages",type:"main",index:0}]]},"Add 'Standard' Handling":{main:[[{node:"Re-group All Packages",type:"main",index:1}]]}}},Im={name:"API fundamentals",meta:{templateCredsSetupCompleted:!1,templateId:"api_fundamentals"},nodes:[{id:"52e84ac4-6495-443e-b3d6-16d3291a6261",cid:"Ikx1Y2FzIFBleXJpbiI",name:"Start Tutorial",type:"n8n-nodes-base.manualTrigger",notes:"© 2025 Lucas Peyrin",creator:"Lucas Peyrin",position:[320,464],parameters:{},typeVersion:1},{id:"5aab442c-2fd7-4b41-ae0f-eeaf9e722213",cid:"Ikx1Y2FzIFBleXJpbiI",name:"1. The Kitchen (GET /menu)",type:"n8n-nodes-base.webhook",notes:"© 2025 Lucas Peyrin",creator:"Lucas Peyrin",position:[1632,464],webhookId:"a1b2c3d4-e5f6-7890-1234-567890abcdef",parameters:{path:"/tutorial/api/menu",options:{},responseMode:"lastNode"},typeVersion:2},{id:"cee20f21-eb2e-4ea6-947f-acbc7f27a437",cid:"Ikx1Y2FzIFBleXJpbiI",name:"Prepare Menu Data",type:"n8n-nodes-base.set",notes:"© 2025 Lucas Peyrin",creator:"Lucas Peyrin",position:[1856,464],parameters:{options:{},assignments:{assignments:[{id:"12345",name:"item",type:"string",value:"Pizza"},{id:"67890",name:"price",type:"number",value:12}]}},typeVersion:3.4},{id:"4af53e2a-0d5a-4b2e-8e65-fbc19d138abb",cid:"Ikx1Y2FzIFBleXJpbiI",name:"1. The Customer (GET Menu Item)",type:"n8n-nodes-base.httpRequest",notes:"© 2025 Lucas Peyrin",creator:"Lucas Peyrin",position:[1312,464],parameters:{url:"={{ $json.base_url }}/tutorial/api/menu",options:{}},typeVersion:4.1},{id:"a1f76b04-daf5-41b9-b300-332b61d69cda",cid:"Ikx1Y2FzIFBleXJpbiI",name:"Sticky Note",type:"n8n-nodes-base.stickyNote",notes:"© 2025 Lucas Peyrin",creator:"Lucas Peyrin",position:[-320,-96],parameters:{width:800,height:768,content:'## Tutorial - What is an API?\n\nWelcome! This workflow will teach you the basics of APIs (Application Programming Interfaces).\n\n**What is an API?**\nThink of it like ordering food at a restaurant.\n- **You** are the "Client" (the **HTTP Request** node). You want something.\n- The **Kitchen** is the "Server" (the **Webhook** node). It has the data/service you want.\n- The **API** is the **Waiter and the Menu**. It\'s the set of rules and options for making a request and getting a response.\n\n\n**What is an Endpoint?**\nAn endpoint is a specific address for a specific action. For example, `GET /menu` is one endpoint to get the menu, and `POST /review` is another to submit a review. Each webhook in this tutorial represents one endpoint.\n\n**How to use this tutorial:**\n1. **Activate** the workflow (toggle on the top right).\n2. **Configure the Base URL** (see the yellow note to the left).\n3. Click **"Execute Workflow"**. The workflow will run from top to bottom.\n4. Explore each "Lesson" by clicking on the **HTTP Request** node (the Customer) and its corresponding **Webhook** node (the Kitchen).\n\n\n**➡️ How to See the Data:**\nWhen you run this, the Webhook nodes run in the background. To see the data they received, go to the **"Executions"** tab of this workflow. You will see a separate execution for each API call!'},typeVersion:1},{id:"d37a6305-25ff-412d-8763-06e4c0a6b8ae",cid:"Ikx1Y2FzIFBleXJpbiI",name:"Sticky Note1",type:"n8n-nodes-base.stickyNote",notes:"© 2025 Lucas Peyrin",creator:"Lucas Peyrin",position:[1248,160],parameters:{color:7,width:864,height:512,content:"#### Lesson 1: The Basics (Method & URL)\n\nThis is the simplest possible request.\n\n- **URL (Uniform Resource Locator):** This is the **address of the restaurant's kitchen**. The HTTP Request node needs to know exactly where to send the order. We use an expression to get the Webhook's address automatically from our configuration.\n\n- **Method: `GET`**: This is **what you want to do**. `GET` is used to **retrieve** or **get** information. It's like asking the waiter, \"What's on the menu today?\" `GET` requests are simple and don't contain a \"body\" payload.\n\n\n**➡️ Look at the output of the HTTP Request node. It received exactly what the `Respond to Webhook` node sent back!**"},typeVersion:1},{id:"edef5d0b-f0a4-4651-9ee4-84ecbe9e8062",cid:"Ikx1Y2FzIFBleXJpbiI",name:"2. The Customer (GET with Query Params)",type:"n8n-nodes-base.httpRequest",notes:"© 2025 Lucas Peyrin",creator:"Lucas Peyrin",position:[1312,1136],parameters:{url:"={{ $json.base_url }}/tutorial/api/order",options:{},sendQuery:!0,queryParameters:{parameters:[{name:"extra_cheese",value:"true"}]}},typeVersion:4.1},{id:"a2b5422d-fb46-4737-8182-dbbb50293fa1",cid:"Ikx1Y2FzIFBleXJpbiI",name:"2. The Kitchen (GET /order)",type:"n8n-nodes-base.webhook",notes:"© 2025 Lucas Peyrin",creator:"Lucas Peyrin",position:[1632,1136],webhookId:"b2c3d4e5-f6a7-8901-2345-67890abcdef1",parameters:{path:"/tutorial/api/order",options:{},responseMode:"lastNode"},typeVersion:2},{id:"91d5b241-64c9-48cf-bf79-fff121d0febf",cid:"Ikx1Y2FzIFBleXJpbiI",name:"Prepare Cheese Pizza",type:"n8n-nodes-base.set",notes:"© 2025 Lucas Peyrin",creator:"Lucas Peyrin",position:[2064,1040],parameters:{options:{},assignments:{assignments:[{id:"12345",name:"order",type:"string",value:"Pizza with extra cheese"}]}},typeVersion:3.4},{id:"bee0bce4-f854-4c1d-9ad1-b526f02e1925",cid:"Ikx1Y2FzIFBleXJpbiI",name:"Prepare Plain Pizza",type:"n8n-nodes-base.set",notes:"© 2025 Lucas Peyrin",creator:"Lucas Peyrin",position:[2064,1232],parameters:{options:{},assignments:{assignments:[{id:"12345",name:"order",type:"string",value:"Plain Pizza"}]}},typeVersion:3.4},{id:"d6862155-ea76-4357-bae7-c4329ec1a612",cid:"Ikx1Y2FzIFBleXJpbiI",name:"Sticky Note2",type:"n8n-nodes-base.stickyNote",notes:"© 2025 Lucas Peyrin",creator:"Lucas Peyrin",position:[1248,704],parameters:{color:7,width:1056,height:720,content:'#### Lesson 2: Customizing a Request (Query Parameters)\n\nWhat if you want to customize your order? That\'s what Query Parameters are for.\n\n**Query Parameters:** These are simple `key=value` options added to the end of the URL after a `?`. They are used to filter, sort, or specify what you want.\n\nIt\'s like telling the waiter, "I\'ll have the pizza... **and can you add extra cheese?**"\n\nThe full URL sent by the HTTP Request node looks like this:\n`.../tutorial/api/order?extra_cheese=true`\n\n**⚠️ Important:** Because they are part of the URL, **all query parameter values are treated as strings!** The webhook receives `"true"` (a string), not `true` (a boolean). The IF node is set to a "loose" comparison to handle this correctly.\n\n**➡️ The Webhook node uses an IF node to check for this parameter and changes its response. Try setting the value to `false` in the HTTP Request node and run it again!**'},typeVersion:1},{id:"c568bc8c-822d-42b9-ab9b-2d91ae4e4fed",cid:"Ikx1Y2FzIFBleXJpbiI",name:"3. The Customer (POST with Body)",type:"n8n-nodes-base.httpRequest",notes:"© 2025 Lucas Peyrin",creator:"Lucas Peyrin",position:[1312,1744],parameters:{url:"={{ $json.base_url }}/tutorial/api/review",method:"POST",options:{},sendBody:!0,bodyParameters:{parameters:[{name:"comment",value:"The pizza was amazing!"},{name:"rating",value:5}]}},typeVersion:4.1},{id:"0f0dae83-3290-4a5f-a039-3b54d87bcf7d",cid:"Ikx1Y2FzIFBleXJpbiI",name:"3. The Kitchen (POST /review)",type:"n8n-nodes-base.webhook",notes:"© 2025 Lucas Peyrin",creator:"Lucas Peyrin",position:[1632,1744],webhookId:"c3d4e5f6-a7b8-9012-3456-7890abcdef12",parameters:{path:"/tutorial/api/review",options:{},httpMethod:"POST",responseMode:"lastNode"},typeVersion:2},{id:"c5aa4f94-eca3-4321-b961-084917b93b81",cid:"Ikx1Y2FzIFBleXJpbiI",name:"Process Review Data",type:"n8n-nodes-base.set",notes:"© 2025 Lucas Peyrin",creator:"Lucas Peyrin",position:[1856,1744],parameters:{options:{},assignments:{assignments:[{id:"12345",name:"status",type:"string",value:"review_received"},{id:"67890",name:"your_comment",type:"string",value:"={{ $json.body.comment }}"},{id:"91011",name:"your_rating",type:"number",value:"={{ $json.body.rating }}"}]}},typeVersion:3.4},{id:"4020d264-7c01-4cf2-b51e-b8b3f2bc382b",cid:"Ikx1Y2FzIFBleXJpbiI",name:"Sticky Note3",type:"n8n-nodes-base.stickyNote",notes:"© 2025 Lucas Peyrin",creator:"Lucas Peyrin",position:[1248,1456],parameters:{color:7,width:1056,height:476,content:'#### Lesson 3: Sending Data (POST & Body)\n\nSometimes, you don\'t want to *get* data, you want to *send* it.\n\n- **Method: `POST`**: This method is used to **send new data** to the server to create or update a resource. It\'s like handing the waiter a completed customer feedback card.\n\n- **Body:** This is the **actual data you are sending**. Unlike a `GET` request, a `POST` request has a "body" where you can put complex data, like a JSON object. This is much more powerful than query parameters for sending information.\n\n\n**➡️ The HTTP Request sends a JSON object in its body. The Webhook receives it and includes your comment in its response. Check the "Executions" panel to see the full body the webhook received!**'},typeVersion:1},{id:"0fec2702-e2c9-4090-a327-f1d723b144b6",cid:"Ikx1Y2FzIFBleXJpbiI",name:"4. The Customer (GET with Headers/Auth)",type:"n8n-nodes-base.httpRequest",notes:"© 2025 Lucas Peyrin",creator:"Lucas Peyrin",position:[1312,2608],parameters:{url:"={{ $json.base_url }}/tutorial/api/secret-dish",options:{},sendHeaders:!0,headerParameters:{parameters:[{name:"x-api-key",value:"super-secret-key"}]}},typeVersion:4.1},{id:"a35c1fc1-65a3-4d84-b29e-22939d334005",cid:"Ikx1Y2FzIFBleXJpbiI",name:"4. The Kitchen (GET /secret-dish)",type:"n8n-nodes-base.webhook",notes:"© 2025 Lucas Peyrin",creator:"Lucas Peyrin",position:[1632,2608],webhookId:"d4e5f6a7-b8c9-0123-4567-890abcdef123",parameters:{path:"/tutorial/api/secret-dish",options:{},responseMode:"responseNode"},typeVersion:2},{id:"8cb4d6d3-c29f-4562-a966-d13beafd8f40",cid:"Ikx1Y2FzIFBleXJpbiI",name:"Sticky Note4",type:"n8n-nodes-base.stickyNote",notes:"© 2025 Lucas Peyrin",creator:"Lucas Peyrin",position:[1248,1968],parameters:{color:7,width:1056,height:908,content:"#### Lesson 4: Identification (Headers & Auth)\n\nHeaders contain meta-information *about* your request. They're not part of the data itself, but they provide important context. Authentication is a common use case.\n\n- **Headers:** Think of this as **showing your VIP membership card** or whispering a secret password to the waiter. It's information that proves who you are or what your request's properties are.\n\n- **Authentication (Auth):** This is the process of proving your identity. Here, we use a custom header (`x-api-key`) as a \"secret key\". In the real world, this is how most APIs control access.\n\n\n**➡️ The Webhook checks for the correct secret key in the headers. If it's wrong or missing, it denies the request with a `401 Unauthorized` status code. Try changing the key in the HTTP Request node!**"},typeVersion:1},{id:"3ab5e611-71d2-4ff3-9462-fb69d60b48aa",cid:"Ikx1Y2FzIFBleXJpbiI",name:"5. The Customer (Request with Timeout)",type:"n8n-nodes-base.httpRequest",notes:"© 2025 Lucas Peyrin",creator:"Lucas Peyrin",onError:"continueErrorOutput",position:[1312,3328],parameters:{url:"={{ $json.base_url }}/tutorial/api/slow-service",options:{timeout:2e3}},typeVersion:4.1},{id:"5545e004-b8c3-4c47-91ee-31a2efa4c833",cid:"Ikx1Y2FzIFBleXJpbiI",name:"5. The Kitchen (GET /slow-service)",type:"n8n-nodes-base.webhook",notes:"© 2025 Lucas Peyrin",creator:"Lucas Peyrin",position:[1632,3328],webhookId:"e5f6a7b8-c9d0-1234-5678-90abcdef1234",parameters:{path:"/tutorial/api/slow-service",options:{},responseMode:"lastNode"},typeVersion:2},{id:"237f65ad-3f1d-4afe-8541-89108afd57de",cid:"Ikx1Y2FzIFBleXJpbiI",name:"Prepare Slow Response",type:"n8n-nodes-base.set",notes:"© 2025 Lucas Peyrin",creator:"Lucas Peyrin",position:[2064,3328],parameters:{options:{},assignments:{assignments:[{id:"12345",name:"status",type:"string",value:"Finally, your food is here!"}]}},typeVersion:3.4},{id:"dbe83810-b95f-46dd-bc2d-bf456fe11f94",cid:"Ikx1Y2FzIFBleXJpbiI",name:"Sticky Note5",type:"n8n-nodes-base.stickyNote",notes:"© 2025 Lucas Peyrin",creator:"Lucas Peyrin",position:[1248,2912],parameters:{color:7,width:1056,height:624,content:"#### Lesson 5: Being Patient (Timeout & Error Handling)\n\nAn API request isn't instant. What if the kitchen is really busy?\n\n- **Timeout:** This is the **maximum amount of time (in milliseconds) you are willing to wait** for a response before you give up.\n\n- **On Error Output:** Notice the HTTP Request node has two outputs. The bottom one is the **error path**. If the request fails for any reason (like a timeout), the workflow will continue down this path instead of stopping.\n\n\nIn this example:\n- The **Kitchen (Webhook)** has a 3-second delay.\n- The **Customer (HTTP Request)** is only willing to wait for 2 seconds (2000 ms).\n\n\n**➡️ This request is designed to FAIL! The customer gives up before the kitchen can finish. The error output of the HTTP Request node will light up. This is crucial for building robust workflows that can handle API failures.**"},typeVersion:1},{id:"4e74c301-06e2-4b19-8101-3c63816ea615",cid:"Ikx1Y2FzIFBleXJpbiI",name:"Wait 3 seconds",type:"n8n-nodes-base.wait",notes:"© 2025 Lucas Peyrin",creator:"Lucas Peyrin",position:[1856,3328],webhookId:"86b44ff3-7d31-4027-a1cd-df67f9ab974a",parameters:{amount:3},typeVersion:1.1},{id:"42619763-955e-40d6-bbdb-23eea3c0bd85",cid:"Ikx1Y2FzIFBleXJpbiI",name:"IF Authorized",type:"n8n-nodes-base.if",notes:"© 2025 Lucas Peyrin",creator:"Lucas Peyrin",position:[1856,2608],parameters:{options:{},conditions:{options:{version:2,leftValue:"",caseSensitive:!0,typeValidation:"strict"},combinator:"and",conditions:[{id:"ca861c2d-78d9-403b-8bab-28d8e7dcf39c",operator:{name:"filter.operator.equals",type:"string",operation:"equals"},leftValue:"={{ $json.headers['x-api-key'] }}",rightValue:"super-secret-key"}]}},typeVersion:2.2},{id:"562d4436-df8c-47bf-b259-eea95ea88147",cid:"Ikx1Y2FzIFBleXJpbiI",name:"IF extra cheese",type:"n8n-nodes-base.if",notes:"© 2025 Lucas Peyrin",creator:"Lucas Peyrin",position:[1840,1136],parameters:{options:{},conditions:{options:{version:2,leftValue:"",caseSensitive:!0,typeValidation:"loose"},combinator:"and",conditions:[{id:"ca861c2d-78d9-403b-8bab-28d8e7dcf39c",operator:{type:"boolean",operation:"true",singleValue:!0},leftValue:"={{ $json.query.extra_cheese }}",rightValue:"your-api-key-for-example"}]},looseTypeValidation:!0},typeVersion:2.2},{id:"57a48d64-954c-4871-a5ff-5390c69a003a",cid:"Ikx1Y2FzIFBleXJpbiI",name:"Sticky Note12",type:"n8n-nodes-base.stickyNote",notes:"© 2025 Lucas Peyrin",creator:"Lucas Peyrin",position:[656,2336],parameters:{color:4,width:540,height:1200,content:"## Was this helpful? Let me know!\n[](https://api.ia2s.app/form/templates/academy)\n\nI really hope this tutorial helped you understand APIs better. Your feedback is incredibly valuable and helps me create better resources for the n8n community.\n\n### **Have Feedback, a Question, or a Project Idea?**\n\nI've streamlined the way we connect. It all starts with one simple form that takes less than 10 seconds. After that, you'll chat with my AI assistant who will gather the key details and pass them directly on to me.\n\n#### ➡️ **[Click here to start the conversation](https://api.ia2s.app/form/templates/academy)**\n\nUse this single link for anything you need:\n\n* **Give Feedback:** Share your thoughts on this template—whether you found a typo, encountered an unexpected error, have a suggestion, or just want to say thanks!\n\n* **n8n Coaching:** Get personalized, one-on-one guidance to master n8n. We can work together to get you launched with confidence or help you reach an expert level.\n\n* **n8n Consulting:** Have a complex business challenge or need a custom workflow built from scratch? Let's partner on a powerful automation solution tailored to your specific needs.\n\n---\n\nHappy Automating!\nLucas Peyrin | [n8n Academy](https://n8n.ac)"},typeVersion:1},{id:"df8ea622-c2a5-4f6b-9a09-5d35b1dea0aa",cid:"Ikx1Y2FzIFBleXJpbiI",name:"Sticky Note6",type:"n8n-nodes-base.stickyNote",notes:"© 2025 Lucas Peyrin",creator:"Lucas Peyrin",position:[512,-96],parameters:{color:3,width:700,height:764,content:'## ✨ **CONFIGURATION REQUIRED** ✨\n\nTo use this interactive tutorial, you need to tell the "Customer" nodes where to find the "Kitchen" nodes.\n\n### **1. Get your Webhook URL**\n\n* **Activate** this workflow using the toggle switch at the top right of the screen.\n* Open any Webhook node in this workflow (e.g., `1. The Kitchen (GET /menu)`).\n* Go to the **Production URL** field and click the copy button.\n\n### **2. Update the CONFIGURATION Node**\n\n* Open the `CONFIGURATION` node (the one this note is pointing to).\n* In the **Value** field, **paste the full URL** you just copied.\n\n\nThat\'s it! Now you can run the workflow, and all the HTTP Request nodes will know how to call your webhooks.'},typeVersion:1},{id:"c0c76d70-c630-4630-a22e-1909a410c527",cid:"Ikx1Y2FzIFBleXJpbiI",name:"Base URL",type:"n8n-nodes-base.set",notes:"© 2025 Lucas Peyrin",creator:"Lucas Peyrin",position:[912,464],parameters:{options:{},assignments:{assignments:[{id:"7edededc-2f40-4b8e-b8db-ab4816f1a28e",name:"base_url",type:"string",value:"={{ $json.your_n8n_webhook_url.match(/^(https?:\\/\\/[^\\/]+)\\/(webhook-test|webhook|v1|[^\\/]+)/)[1] + '/' + $json.your_n8n_webhook_url.match(/^(https?:\\/\\/[^\\/]+)\\/(webhook-test|webhook|v1|[^\\/]+)/)[2].replace('webhook-test','webhook') }}"}]}},typeVersion:3.4},{id:"e5f25f10-a1f0-4d67-b0fb-c3a2b8abf786",cid:"Ikx1Y2FzIFBleXJpbiI",name:"Sticky Note8",type:"n8n-nodes-base.stickyNote",notes:"© 2025 Lucas Peyrin",creator:"Lucas Peyrin",position:[1264,2288],parameters:{color:3,width:304,height:496,content:'### ⚠️ **Security Best Practice**\n\nFor this tutorial, we are putting the API key directly in the header. \n\n**In a real project, NEVER do this!**\n\nAlways use n8n\'s built-in **Credentials** system to store and manage secret keys. You would create a "Header Auth" credential and select it in the HTTP Request node\'s "Authentication" parameter. This keeps your secrets safe and out of your workflow JSON.'},typeVersion:1},{id:"e908261b-cced-4539-9ea0-f40fb9e009e5",cid:"Ikx1Y2FzIFBleXJpbiI",name:"Respond with Secret",type:"n8n-nodes-base.respondToWebhook",notes:"© 2025 Lucas Peyrin",creator:"Lucas Peyrin",position:[2064,2496],parameters:{options:{},respondWith:"json",responseBody:'{\n "dish": "The Chef\'s Special Truffle Pasta"\n}'},typeVersion:1.4},{id:"52d54052-eab2-45b8-ac9a-389b7fdf40d3",cid:"Ikx1Y2FzIFBleXJpbiI",name:"Respond: Unauthorized (401)",type:"n8n-nodes-base.respondToWebhook",notes:"© 2025 Lucas Peyrin",creator:"Lucas Peyrin",position:[2064,2704],parameters:{options:{responseCode:401},respondWith:"text",responseBody:"You are not authorized to see the secret dish."},typeVersion:1.4},{id:"f9d72d6c-47b8-4f51-8a69-ce4d557ae90f",cid:"Ikx1Y2FzIFBleXJpbiI",name:"OpenAPI Spec",type:"n8n-nodes-base.stickyNote",notes:"© 2025 Lucas Peyrin",creator:"Lucas Peyrin",position:[2336,704],parameters:{color:6,width:696,height:2096,content:'# What other services give you\n\nReal-world APIs have documentation that tells developers how to use them. This is what the documentation for our little tutorial API would look like. To put you in context, you would see this documentation and create http request nodes accordingly.\n\n**Remember**, AI can help you !\n\n\n# API Documentation Example\n\nA simple API to demonstrate http requests in n8n.\n\n## API Endpoints\n\n### GET /tutorial/api/menu\n\n**Summary:** Get the menu\n\n**Responses:**\n* `200 OK`: The restaurant menu.\n\n---\n\n### GET /tutorial/api/order\n\n**Summary:** Get a customized order\n\n**Parameters:**\n* `extra_cheese` (query, string, example: `true`): Whether to add extra cheese.\n\n\n**Responses:**\n* `200 OK`: Your customized pizza order.\n\n---\n\n### POST /tutorial/api/review\n\n**Summary:** Submit a review\n\n**Request Body (application/json):**\n```json\n{\n "comment": "string",\n "rating": 0\n}\n```\n* `comment` (string): The review comment.\n* `rating` (integer): The rating given (e.g., 1-5).\n\n\n**Responses:**\n* `200 OK`: Confirmation of review receipt.\n\n---\n\n### GET /tutorial/api/secret-dish\n\n**Summary:** Get the secret dish (Auth Required)\n\n**Authentication:** Requires API Key. See [Authentication](https://docs.n8n.io/integrations/builtin/credentials/httprequest/) section for details.\n\n**Responses:**\n* `200 OK`: The secret dish.\n* `401 Unauthorized`: Authentication is required or invalid.\n\n---\n\n### GET /tutorial/api/slow-service\n\n**Summary:** A slow endpoint to test timeouts\n\n**Responses:**\n* `200 OK`: A delayed response.\n\n---\n\n## Authentication\n\nThis API uses an API Key for authentication on certain endpoints.\n\n### API Key Authentication (`ApiKeyAuth`)\n\n* **Type:** API Key\n* **Location:** Header\n* **Header Name:** `x-api-key`\n\n\nTo authenticate, include your API key in the `x-api-key` header of your request.\n\n**Example:**\n```\nGET /tutorial/api/secret-dish\nHost: your-api-domain.com\nx-api-key: YOUR_API_KEY_HERE\n```'},typeVersion:1},{id:"fba94b52-0c18-4f3c-a702-aa883a3df293",cid:"Ikx1Y2FzIFBleXJpbiI",name:"Sticky Note7",type:"n8n-nodes-base.stickyNote",notes:"© 2025 Lucas Peyrin",creator:"Lucas Peyrin",position:[2320,3040],parameters:{color:7,width:384,height:496,content:""},typeVersion:1},{id:"d6b845a9-9d27-49ec-a9fe-ac48650bd260",cid:"Ikx1Y2FzIFBleXJpbiI",name:"Sticky Note9",type:"n8n-nodes-base.stickyNote",notes:"© 2025 Lucas Peyrin",creator:"Lucas Peyrin",position:[1760,1040],parameters:{color:7,width:256,height:272,content:""},typeVersion:1},{id:"c6d51163-f9ea-4d6b-af33-32107d3feb6e",cid:"Ikx1Y2FzIFBleXJpbiI",name:"Sticky Note10",type:"n8n-nodes-base.stickyNote",notes:"© 2025 Lucas Peyrin",creator:"Lucas Peyrin",position:[2128,448],parameters:{color:7,width:176,height:224,content:""},typeVersion:1},{id:"b5a01aca-47be-42d8-8366-4f91bcf24682",cid:"Ikx1Y2FzIFBleXJpbiI",name:"Sticky Note11",type:"n8n-nodes-base.stickyNote",notes:"© 2025 Lucas Peyrin",creator:"Lucas Peyrin",position:[2032,1728],parameters:{color:7,width:256,content:""},typeVersion:1},{id:"adacc21c-801a-49bb-a6da-630fc8b4272c",cid:"Ikx1Y2FzIFBleXJpbiI",name:"⚙️CONFIGURATION⚙️",type:"n8n-nodes-base.set",notes:"© 2025 Lucas Peyrin",creator:"Lucas Peyrin",position:[688,464],parameters:{options:{},assignments:{assignments:[{id:"7edededc-2f40-4b8e-b8db-ab4816f1a28e",name:"your_n8n_webhook_url",type:"string",value:"PASTE_YOUR_WEBHOOK_URL_HERE"}]}},typeVersion:3.4},{id:"9eb6ee32-0d75-4817-a3d0-3106d88b14e6",cid:"Ikx1Y2FzIFBleXJpbiI",name:"Sticky Note14",type:"n8n-nodes-base.stickyNote",notes:"© 2025 Lucas Peyrin",creator:"Lucas Peyrin",position:[1600,2272],parameters:{color:7,width:400,height:256,content:""},typeVersion:1}],pinData:{"1. The Kitchen (GET /menu)":[{body:{},query:{},params:{},headers:{host:"your-n8n-instance.com",accept:"application/json,text/html,application/xhtml+xml,application/xml,text/*;q=0.9, image/*;q=0.8, */*;q=0.7","user-agent":"n8n","accept-encoding":"gzip, deflate, br","x-forwarded-for":"192.168.1.1","x-forwarded-host":"your-n8n-instance.com","x-forwarded-proto":"https"},webhookUrl:"https://your-n8n-instance.com/webhook/tutorial/api/menu"}],"2. The Kitchen (GET /order)":[{body:{},query:{extra_cheese:"true"},params:{},headers:{host:"your-n8n-instance.com",accept:"application/json,text/html,application/xhtml+xml,application/xml,text/*;q=0.9, image/*;q=0.8, */*;q=0.7","user-agent":"n8n","accept-encoding":"gzip, deflate, br","x-forwarded-for":"192.168.1.1","x-forwarded-host":"your-n8n-instance.com","x-forwarded-proto":"https"},webhookUrl:"https://your-n8n-instance.com/webhook/tutorial/api/order?extra_cheese=true"}],"3. The Kitchen (POST /review)":[{body:{rating:5,comment:"The pizza was amazing!"},query:{},params:{},headers:{host:"your-n8n-instance.com",accept:"application/json,text/html,application/xhtml+xml,application/xml,text/*;q=0.9, image/*;q=0.8, */*;q=0.7","user-agent":"n8n","content-type":"application/json","content-length":"49","accept-encoding":"gzip, deflate, br","x-forwarded-for":"192.168.1.1","x-forwarded-host":"your-n8n-instance.com","x-forwarded-proto":"https"},webhookUrl:"https://your-n8n-instance.com/webhook/tutorial/api/review"}],"4. The Kitchen (GET /secret-dish)":[{body:{},query:{},params:{},headers:{host:"your-n8n-instance.com",accept:"application/json,text/html,application/xhtml+xml,application/xml,text/*;q=0.9, image/*;q=0.8, */*;q=0.7","x-api-key":"super-secret-key","user-agent":"n8n","accept-encoding":"gzip, deflate, br","x-forwarded-for":"192.168.1.1","x-forwarded-host":"your-n8n-instance.com","x-forwarded-proto":"https"},webhookUrl:"https://your-n8n-instance.com/webhook/tutorial/api/secret-dish"}],"5. The Kitchen (GET /slow-service)":[{body:{},query:{},params:{},headers:{host:"your-n8n-instance.com",accept:"application/json,text/html,application/xhtml+xml,application/xml,text/*;q=0.9, image/*;q=0.8, */*;q=0.7","user-agent":"n8n","accept-encoding":"gzip, deflate, br","x-forwarded-for":"192.168.1.1","x-forwarded-host":"your-n8n-instance.com","x-forwarded-proto":"https"},webhookUrl:"https://your-n8n-instance.com/webhook/tutorial/api/slow-service"}]},connections:{"Base URL":{main:[[{node:"1. The Customer (GET Menu Item)",type:"main",index:0},{node:"2. The Customer (GET with Query Params)",type:"main",index:0},{node:"3. The Customer (POST with Body)",type:"main",index:0},{node:"4. The Customer (GET with Headers/Auth)",type:"main",index:0},{node:"5. The Customer (Request with Timeout)",type:"main",index:0}]]},"IF Authorized":{main:[[{node:"Respond with Secret",type:"main",index:0}],[{node:"Respond: Unauthorized (401)",type:"main",index:0}]]},"Start Tutorial":{main:[[{node:"⚙️CONFIGURATION⚙️",type:"main",index:0}]]},"Wait 3 seconds":{main:[[{node:"Prepare Slow Response",type:"main",index:0}]]},"IF extra cheese":{main:[[{node:"Prepare Cheese Pizza",type:"main",index:0}],[{node:"Prepare Plain Pizza",type:"main",index:0}]]},"⚙️CONFIGURATION⚙️":{main:[[{node:"Base URL",type:"main",index:0}]]},"1. The Kitchen (GET /menu)":{main:[[{node:"Prepare Menu Data",type:"main",index:0}]]},"2. The Kitchen (GET /order)":{main:[[{node:"IF extra cheese",type:"main",index:0}]]},"3. The Kitchen (POST /review)":{main:[[{node:"Process Review Data",type:"main",index:0}]]},"4. The Kitchen (GET /secret-dish)":{main:[[{node:"IF Authorized",type:"main",index:0}]]},"5. The Kitchen (GET /slow-service)":{main:[[{node:"Wait 3 seconds",type:"main",index:0}]]}}},Nm=e=>{if(!function(e){if(!e||"object"!=typeof e)return!1;const t=e;return!(!t.meta||"object"!=typeof t.meta)&&"string"==typeof t.meta.templateId}(e))throw new bn("Invalid workflow template JSON structure");return e},Sm=()=>Nm(vm),e("K",Tm=()=>Nm(gm)),e("G",Em={RagStarterTemplate:Tm().meta.templateId,EasyAiTemplate:Sm().meta.templateId}),Am={BuildYourFirstAiAgent:Nm(wm).meta.templateId,JsonBasics:Nm(bm).meta.templateId,Expressions:Nm(km).meta.templateId,WorkflowLogic:Nm(xm).meta.templateId,ApiFundamentals:Nm(Im).meta.templateId},e("Y",(e=>Object.values(Am).includes(e))),e("J",Cm=()=>[{name:"Build your first AI agent",description:"This template launches your very first AI Agent —an AI-powered chatbot that can do more than just talk— it can take action using tools.",template:Nm(wm),nodes:[]},{name:"JSON basics",description:"Designed to teach you the absolute basics of JSON (JavaScript Object Notation) and, more importantly, how to use it within n8n.",template:Nm(bm),nodes:[]},{name:"Expressions",description:"Step-by-step tutorial designed to teach you the most important skill in n8n: using expressions to access and manipulate data.",template:Nm(km),nodes:[]},{name:"Workflow logic",description:"This template is a hands-on tutorial that teaches you the three most fundamental nodes for controlling the flow of your automations: Merge, IF, and Switch.",template:Nm(xm),nodes:[]},{name:"API fundamentals",description:"Hands-on tutorial designed to demystify what an API is and how it works, right inside your n8n canvas.",template:Nm(Im),nodes:[]}]),e("q",(e=>[Sm(),Tm(),...Cm().map((e=>e.template))].find((t=>t.meta.templateId===e)))),_m=n(ym(),1),Pm="-preview",Dm=e=>!!e.length&&(e.length>1||"sendAndWait"===e[0].key),Om=e=>{let t=e;return e.includes(".")&&(t=e.split(".").join(" ")),function(e,t){const[n,o,a]=RI(e,t);return n+o.map(VI(t?.locale)).join(t?.delimiter??" ")+a}(t)},e("z",Mm=e=>e.replace(Pm,"")),e("F",Lm=(e="")=>e.includes(Pm)),e("D",((e,t,n)=>!t||n?[]:GI(UI(t||"",e.map((e=>FI(e))))))),e("V",((e,t)=>("AI Other"!==t.rootView||"Tools"!==t.title)&&e&&!t.communityNodeDetails)),jm=(e,t)=>`/workflows/${e}/test-runs${t?`/${t}`:""}`,$m=async(e,t)=>await Ja(e,"GET",jm(t)),Bm=async(e,t)=>await Ja(e,"GET",jm(t.workflowId,t.runId)),Vm=async(e,t)=>await Ka({method:"POST",baseURL:e.baseUrl,endpoint:`/workflows/${t}/test-runs/new`,headers:{"push-ref":e.pushRef}}),Rm=async(e,t,n)=>await Ka({method:"POST",baseURL:e.baseUrl,endpoint:`/workflows/${t}/test-runs/${n}/cancel`,headers:{"push-ref":e.pushRef}}),Fm=async(e,t)=>await Ja(e,"DELETE",jm(t.workflowId,t.runId)),Wm=(e,t)=>`/workflows/${e}/test-runs/${t}/test-cases`,Um=async(e,t,n)=>await Ja(e,"GET",Wm(t,n)),e("E",zm=Xa(ai.EVALUATION,(()=>{const e=v(!1),t=v({}),n=v({}),o=v({}),a=ni(),i=rh(),r=C((()=>i.workflowId?Qh(Kh(i.workflowId)):void 0)),s=Jm(),l=qi(),u=C((()=>0!==l.settings.evaluation?.quota)),c=C((()=>e.value)),d=C((()=>Object.values(t.value).reduce(((e,t)=>(e[t.workflowId]||(e[t.workflowId]=[]),e[t.workflowId].push(t),e)),{}))),p=C((()=>(r.value?.allNodes??[]).some((e=>e.type===ea))));function f(e){return(r.value?.allNodes??[]).some((t=>{if("n8n-nodes-base.evaluation"!==t.type)return!1;const n=s.getNodeType(t.type,t.typeVersion);return!!n&&$o(n.properties,t.parameters,!0,!1,t,n)?.operation===e}))}const m=C((()=>f("setMetrics"))),h=C((()=>f("setOutputs"))),y=async e=>{const n=await Bm(a.restApiContext,e);return t.value[n.id]=n,n},g=(e,t)=>{const n=async()=>{try{const a=await y({workflowId:e,runId:t});["running","new"].includes(a.status)?o.value[t]=setTimeout(n,1e3):delete o.value[t]}catch(a){o.value[t]=setTimeout(n,1e3)}};n()};return{testRunsById:t,testCaseExecutionsById:n,isLoading:c,isEvaluationEnabled:u,testRunsByWorkflowId:d,evaluationTriggerExists:p,evaluationSetMetricsNodeExist:m,evaluationSetOutputsNodeExist:h,fetchTestCaseExecutions:async e=>{const t=await Um(a.restApiContext,e.workflowId,e.runId);return t.forEach((e=>{n.value[e.id]=e})),t},fetchTestRuns:async n=>{e.value=!0;try{const o=await $m(a.restApiContext,n);return o.forEach((e=>{t.value[e.id]=e,["running","new"].includes(e.status)&&g(n,e.id)})),o}finally{e.value=!1}},getTestRun:y,startTestRun:async e=>await Vm(a.restApiContext,e),cancelTestRun:async(e,t)=>await Rm(a.restApiContext,e,t),deleteTestRun:async e=>{const n=await Fm(a.restApiContext,e);if(n.success){const{[e.runId]:n,...o}=t.value;t.value=o}return n},cleanupPolling:()=>{Object.values(o.value).forEach((e=>{clearTimeout(e)})),o.value={}}}}),{})),Hm=n(vt(),1),Gm=n(tm(),1),Ym="placeholder_recommended",Xm=(0,Hm.default)(YI,((...e)=>JSON.stringify(e))),qm={"n8n-nodes-base.hubspotTrigger":(e,t)=>e?.options?.[0]?.values[0]?.options?.map((n=>({...XI(t),actionKey:n.value,displayName:Xm("nodeCreator.actionsCategory.onEvent",{interpolate:{event:(0,Gm.default)(n.name)}}),description:n.description??"",displayOptions:e.displayOptions,values:{eventsUi:{eventValues:[{name:n.value}]}}}))),"n8n-nodes-base.code":(e,t)=>{if("language"!==e.name)return;const n=e.options;return n?n.map((n=>({...XI(t),actionKey:`language_${n.value}`,displayName:`Code in ${n.name}`,description:`Run custom ${n.name} code`,displayOptions:e.displayOptions,values:{language:n.value}}))):void 0}},e("w",Jm=Xa(ai.NODE_TYPES,(()=>{const e=v({}),t=v(new Map),n=ni(),o=QI(),a=qi(),i=C((()=>e=>{const n=t.value.get(e);if(n)return n;const o=Mm(e);for(const a of t.value.values()){const t=a.nodeDescription?.name;if(t===e||Mm(t??"")===o)return a}})),r=C((()=>Array.from(t.value.values()).filter((({isOfficialNode:e,isInstalled:t})=>e&&!t)).map((({nodeDescription:e})=>e)))),s=C((()=>Array.from(t.value.values()).filter((({isOfficialNode:e,isInstalled:t})=>!e&&!t)).map((({nodeDescription:e})=>e)))),l=C((()=>o.generateMergedNodesAndActions(s.value,[]))),u=C((()=>Object.values(e.value).flatMap((e=>Object.keys(e).map((t=>e[Number(t)])))))),c=C((()=>Object.values(e.value).map((e=>{const t=Object.keys(e).map(Number);return e[Math.max(...t)]})).filter(Boolean))),d=C((()=>jt.flatMap((t=>{const n=e.value[t.nodeType]??{},o=Object.keys(n).map(Number),i=n[Math.max(...o)];return i?.hidden&&a.isModuleActive(t.module)?{...i,hidden:void 0}:[]})))),p=C((()=>(t,n)=>{if(my(t))return m.value(t,n);const o=e.value[t];if(!o)return null;const a=Object.keys(o).map(Number);return o[n??Math.max(...a)]??null})),f=C((()=>t=>Object.keys(e.value[t]??{}).map(Number))),m=C((()=>(e,t)=>{const n=hy(e);return vy(p.value(qo,t??4.1),Gf().getCredentialTypeByName(n))??null})),h=C((()=>(e,t,n)=>{if(!e.nodes[t.name])return!1;const o=p.value(n)??i.value(n)?.nodeDescription;if(!o)return!1;const a=ha(e,t,o),r=xa(a);return!!r&&r.filter((e=>e!==xo.Main)).length>0})),y=C((()=>e=>{const t=p.value(e);return!(!t||!t.group.includes("trigger"))})),g=C((()=>e=>{const t=p.value(e);return t?.outputs&&Array.isArray(t.outputs)?t.outputs.map((e=>"string"==typeof e?e:e.type)).includes(xo.AiTool):t?.outputs.includes(xo.AiTool)??!1})),w=C((()=>e=>{const t=p.value(e);return t?.outputs&&Array.isArray(t.outputs)?t.outputs.map((e=>"string"==typeof e?e:e.type)).includes(xo.AiLanguageModel):t?.outputs.includes(xo.AiLanguageModel)??!1})),b=C((()=>e=>e.codex?.categories?.includes("Core Nodes"))),k=C((()=>c.value.concat(r.value).concat(d.value).filter((e=>!e.hidden)))),x=C((()=>u.value.reduce(((e,t)=>(/\d$/.test(t.defaults.name)&&e.push(t.defaults.name),e)),[]))),I=C((()=>k.value.reduce(((e,t)=>{const n=t.outputs;return Array.isArray(n)?n.forEach((n=>{const o="string"==typeof n?n:n.type;e[o]||(e[o]=[]),e[o].push(t.name)})):[xo.AiVectorStore,xo.AiChain,xo.AiDocument,xo.AiEmbedding,xo.AiLanguageModel,xo.AiMemory,xo.AiOutputParser,xo.AiTextSplitter,xo.AiTool].forEach((o=>{n.includes(o)&&(e[o]=e[o]||[],e[o].push(t.name))})),e}),{}))),N=C((()=>k.value.reduce(((e,t)=>{const n=t.inputs;return Array.isArray(n)&&n.forEach((n=>{const o="string"==typeof n?n:n.type;e[o]||(e[o]=[]),e[o].push(t.name)})),e}),{}))),S=C((()=>(e,t,n,o)=>{const a=p.value(n,o);if(null===a)return!1;const i=na(e,t,a),r=xa(i);return!!r&&r.filter((e=>e!==xo.Main)).length>0})),T=(t=[])=>{const n=OI(t);e.value={...e.value,...n}},E=async(e,t=!0)=>{const o=await gi(n.restApiContext,e);return o.forEach((e=>{e.translation&&Ee({[e.name.replace("n8n-nodes-base.","")]:e.translation},n.defaultLocale)})),t&&T(o),o},A=async()=>{const e=await Xi(n.baseUrl);e.length&&T(e)};return{nodeTypes:e,allNodeTypes:u,allLatestNodeTypes:c,getNodeType:p,getNodeVersions:f,getCredentialOnlyNodeType:m,isConfigNode:h,isTriggerNode:y,isToolNode:g,isModelNode:w,isCoreNodeType:b,visibleNodeTypes:k,nativelyNumberSuffixedDefaults:x,visibleNodeTypesByOutputConnectionTypeNames:I,visibleNodeTypesByInputConnectionTypeNames:N,isConfigurableNode:S,communityNodesAndActions:l,communityNodeType:i,fetchCommunityNodePreviews:async()=>{if(a.isCommunityNodesFeatureEnabled)try{const e=await Ri(n.restApiContext);t.value=new Map(e.map((e=>[e.name,e])))}catch(e){t.value=new Map}},getResourceMapperFields:async e=>{try{return await Zi(n.restApiContext,e)}catch(t){return null}},getLocalResourceMapperFields:async e=>{try{return await Yi(n.restApiContext,e)}catch(t){return null}},getNodeParameterActionResult:async e=>await Di(n.restApiContext,e),getResourceLocatorResults:async e=>await Li(n.restApiContext,e),getNodeParameterOptions:async e=>await yi(n.restApiContext,e),getNodesInformation:E,getFullNodesProperties:async(e,t=!0)=>{await Gf().fetchCredentialTypes(!0),t&&await E(e)},getNodeTypes:A,loadNodeTypesIfNotLoaded:async()=>{0===Object.keys(e.value).length&&await A()},getNodeTranslationHeaders:async()=>{const e=await Wi(n.restApiContext);e&&Ne(e,n.defaultLocale)},setNodeTypes:T,removeNodeTypes:t=>{e.value=t.reduce(((e,t)=>$s(t.name,e)),e.value)},getCommunityNodeAttributes:async e=>{if(!a.isCommunityNodesFeatureEnabled)return null;try{return await Ji(n.restApiContext,Mm(e))}catch(t){return null}},getIsNodeInstalled:C((()=>e=>{const t=Mm(e);return!!p.value(t)||!!i.value(t)?.isInstalled}))}}))),e("g",(e=>{const t={};switch("all"!==e.workflowId&&(t.workflowId=e.workflowId),Bs(e.tags)||(t.tags=e.tags),Bs(e.annotationTags)||(t.annotationTags=e.annotationTags),"all"!==e.vote&&(t.vote=e.vote),"all"!==e.workflowVersionId&&(t.workflowVersionId=e.workflowVersionId),Bs(e.metadata)||(t.metadata=e.metadata),e.startDate&&(t.startedAfter=e.startDate),e.endDate&&(t.startedBefore=e.endDate),e.status){case"waiting":t.status=["waiting"];break;case"error":t.status=["crashed","error"];break;case"success":t.status=["success"];break;case"running":t.status=["running","new"];break;case"canceled":t.status=["canceled"];break;case"new":t.status=["new"]}return t})),Km=!1,Zm=e=>{if(!Km){const t=700,n=`width=${t},height=${window.innerHeight-50},left=${(window.innerWidth-t)/2},top=50,resizable=yes,scrollbars=yes`,o=`form-waiting-since-${Date.now()}`;window.open(e,o,n),Km=!0}},e("m",Qm=()=>Km=!1),e("C",((e,t,n)=>{if(!e)return"";try{const o=Jm().getNodeType(e.type)?.waitingNodeTooltip;if(o){const a=rh().activeExecutionId,i={$execution:{id:a,mode:"test",resumeUrl:n?.resumeUrl??`${ni().webhookWaitingUrl}/${a}`,resumeFormUrl:n?.resumeFormUrl??`${ni().formWaitingUrl}/${a}`}};if(t){const n=t.expression.getSimpleParameterValue(e,o,"internal",i);return String(n)}if(o)return o}}catch(o){}return""})),eh=10,th=5,nh=e=>({type:"json",data:e,parsed:!1}),oh={[xo.AiLanguageModel](e){const t=e.response??e;if(!t)throw new Error("No response from Language Model");return Array.isArray(t?.messages)&&1===t?.messages.length&&"string"==typeof t?.messages[0]?{type:"text",data:t.messages[0],parsed:!0}:t.messages&&Array.isArray(t.messages)?oh[xo.AiMemory](e):t.generations?{type:"json",data:t.generations.map((e=>e?.text?e.text:Array.isArray(e)?e.map((e=>e.text??e)).join("\n\n").trim():e)),parsed:!0}:{type:"json",data:t,parsed:!0}},[xo.AiTool]:nh,[xo.AiAgent]:nh,[xo.AiMemory](e){const t=e.chatHistory??e.messages??e?.response?.chat_history;if(Array.isArray(t)){const n=t.map((e=>{if("constructor"===e.type&&e.id?.includes("messages")&&e.kwargs){let t=String(e.kwargs.content);return Array.isArray(t)&&(t=t.map((e=>{const{type:t,image_url:n}=e;return"image_url"===t&&"object"==typeof n&&"string"==typeof n.url?``:"string"==typeof n?``:e.text})).join("\n")),Object.keys(e.kwargs.additional_kwargs).length&&(t+=` (${JSON.stringify(e.kwargs.additional_kwargs)})`),e.id.includes("HumanMessage")?t=`**Human:** ${String(t).trim()}`:e.id.includes("AIMessage")?t=`**AI:** ${t}`:e.id.includes("SystemMessage")&&(t=`**System Message:** ${t}`),t}return""})).join("\n\n");return 0===n.length?nh(e):{type:"markdown",data:n,parsed:!0}}return nh(e)},[xo.AiOutputParser]:nh,[xo.AiRetriever]:nh,[xo.AiReranker]:nh,[xo.AiVectorStore]:e=>e.documents?{type:"json",data:e.documents,parsed:!0}:nh(e),[xo.AiEmbedding]:e=>e.documents?{type:"json",data:e.documents,parsed:!0}:nh(e),[xo.AiDocument]:e=>e.documents?{type:"json",data:e.documents,parsed:!0}:nh(e),[xo.AiTextSplitter]:e=>({type:"text",data:(Array.isArray(e.response)?e.response:[e.textSplitter]).join("\n\n"),parsed:!0})},e("l",{completionTokens:0,promptTokens:0,totalTokens:0,isEstimate:!1}),ah={name:"",description:"",active:!1,activeVersionId:null,isArchived:!1,createdAt:-1,updatedAt:-1,connections:{},nodes:[],settings:{...nl},tags:[],pinData:{},versionId:"",usedCredentials:[]},ih=()=>({id:"",...ah}),e("s",rh=Xa(ai.WORKFLOWS,(()=>{const e=dh(),n=sy(),o=EI(),a=qi(),i=ni(),r=uy(),s=gh(),l=Jm(),u=ru(),c=_u(),d=v(ih()),p=v(pe(d.value.nodes,d.value.connections)),f=v(null),m=v([]),h=v(null),y=v(null),g=v(),w=v(),b=v({}),k=v(!1),x=v({}),I=v(!1),N=v([]),S=v(null),T=v(),E=C((()=>d.value.id)),A=C((()=>d.value.versionId)),_=C((()=>!d.value.id||!c.getWorkflowById(d.value.id)?.id)),P=C((()=>Object.keys(c.workflowsById).reduce(((e,t)=>(e[t]=!0,e)),{}))),D=C((()=>d.value.nodes.filter((e=>{const t=l.getNodeType(e.type,e.typeVersion);return t&&t.group.includes("trigger")})))),O=C((()=>!!d.value.nodes.find((e=>!!e.webhookId)))),M=C((()=>h.value?.data?.resultData?h.value.data.resultData.runData:null)),L=C((()=>d.value.connections)),j=C((()=>d.value.nodes)),$=e=>("n8n-nodes-base.wait"===e.type||"n8n-nodes-base.form"===e.type||"sendAndWait"===e.parameters?.operation)&&!0!==e.disabled,B=C((()=>{const e=Nu().activeNode;if(e){if($(e))return!0;const t=p.value.getParentNodes(e.name);for(const e of t)if($(p.value.nodes[e]))return!0;return!1}return j.value.some((e=>$(e)))})),V=C((()=>null===ne.value||!(!(ne.value&&h.value&&["waiting","running"].includes(h.value.status))||h.value.finished))),R=C((()=>new Set(j.value.map((e=>e.name))))),F=C((()=>d.value.nodes.reduce(((e,t)=>(e[t.name]=t,e)),{}))),W=C((()=>d.value.nodes.filter((e=>{const t=Object.keys(e.issues??{}).length>0,n=Object.keys(re(e.name)).length>0||Object.keys(se(e.name)).length>0;return!e.disabled&&n&&t})))),U=C((()=>W.value.length)),z=C((()=>U.value>0)),H=C((()=>{const e=[];return d.value.nodes.forEach((t=>{t.issues&&!t.disabled&&(Object.keys(re(t.name)).length>0||Object.keys(se(t.name)).length>0)&&Object.entries(t.issues).forEach((([n,o])=>{var a;o&&("object"!=typeof o||Array.isArray(o)?e.push({node:t.name,type:n,value:(a=o,"string"==typeof a||Array.isArray(a)?o:String(o))}):Object.entries(o).forEach((([o,a])=>{a&&e.push({node:t.name,type:n,value:a})})))}))})),e})),G=C((()=>h.value?.executedNode)),X=C((()=>m.value.filter((e=>!0===e.finished||void 0!==e.stoppedAt)))),q=C((()=>h.value)),J=C((()=>N.value)),K=C((()=>d.value.connections)),Z=C((()=>Hn(d.value.connections))),Q=C((()=>D.value.filter((e=>!e.disabled&&!iN(e))))),ee=C((()=>{if(V.value)return h.value?.triggerNode?h.value.triggerNode:Object.keys(h.value?.data?.resultData.runData??{}).find((e=>D.value.some((t=>t.name===e))))})),te=C((()=>!a.isChatFeatureEnabled||!Bl(["global:chatUser"]))),ne=v(),oe=v(),ae=C((()=>ne.value)),ie=C((()=>oe.value));function re(e){return d.value.connections.hasOwnProperty(e)?d.value.connections[e]:{}}function se(e){return Z.value.hasOwnProperty(e)?Z.value[e]:{}}function le(e){return Fn(F.value,e)}function ue(e){return d.value.nodes.find((t=>t.id===e))}function ce(){return{nodeTypes:{},init:async()=>{},getByNameAndVersion:(e,t)=>{const n=l.getNodeType(e,t)??l.communityNodeType(e)?.nodeDescription??null;if(null!==n)return{description:n,trigger:!["n8n-nodes-base.errorTrigger"].includes(e)&&0===n.inputs.length&&!n.webhooks||void 0}}}}function de(){return d.value.nodes.map((e=>({...e})))}function pe(e,t,n){const o=ce();let a=d.value.id;a&&!c.getWorkflowById(a)?.id&&(a=void 0);const i=d.value.id,r=i?Qh(Kh(i)):void 0;return new eo({id:a,name:r?.name??"",nodes:n?zt(e):e,connections:n?zt(t):t,active:!1,nodeTypes:o,settings:r?.settings??{...nl},pinData:r?.getPinDataSnapshot()??{}})}function fe(e){f.value=zt(e),d.value.versionId=e.versionId}function me(e){c.setWorkflowInactiveInCache(e)}function he(e){d.value.description=e}function ye(t,{preserveInputConnections:n=!1,preserveOutputConnections:o=!1}={}){if(e.markStateDirty(),o||delete d.value.connections[t.name],n)return;const a=[];let i,r,s,l,u;for(i of Object.keys(d.value.connections))for(r of Object.keys(d.value.connections[i]))for(s of Object.keys(d.value.connections[i][r])){a.length=0;const e=d.value.connections[i][r][Number.parseInt(s,10)];if(e){for(l of Object.keys(e))u=e[Number.parseInt(l,10)],u.node===t.name&&a.push(l);a.forEach((t=>{e.splice(Number.parseInt(t,10),1)}))}}p.value.setConnections(d.value.connections)}function ve(t){const{[t.name]:n,...o}=x.value;x.value=o,E.value&&Qh(Kh(E.value)).unpinNodeData(t.name);for(let a=0;a<d.value.nodes.length;a++)if(d.value.nodes[a].name===t.name)return d.value.nodes=[...d.value.nodes.slice(0,a),...d.value.nodes.slice(a+1)],p.value.setNodes(d.value.nodes),void e.markStateDirty()}function ge(e){if(!h.value?.data)return;const{[e]:t,...n}=h.value.data.resultData.runData;h.value.data.resultData.runData=n}async function we(e,t,n=!1){null===t.settings&&(t.settings=void 0);const a=await Ja(i.restApiContext,"PATCH",`/workflows/${e}${n?"?forceSave=true":""}`,t);if(!a.checksum)throw new Error("Failed to update workflow");return e===d.value.id&&(fe({versionId:a.versionId,name:f.value?.name??null,description:f.value?.description??null}),Qh(Kh(e)).setChecksum(a.checksum)),o.containsNodeFromPackage(a,"@n8n/n8n-nodes-langchain")&&!s.isEasyAIWorkflowOnboardingDone&&(await di(i.restApiContext,{easyAIWorkflowOnboarded:!0}),s.setEasyAIWorkflowOnboardingDone()),a}function be(e){return!!p.value.getParentNodes(e,xo.Main).find((e=>le(e)?.type===xn))}return Y([Q,ee],(([e,t],[n])=>{if(void 0!==t)return void(T.value=t);if(void 0===T.value||e.every((e=>e.name!==T.value)))return void(T.value=function(e,t){const n={[ro]:10,[da]:9,[tn]:7,[uo]:6,[no]:5,[Zn]:4};function o(e){return t(e.type,e.typeVersion)?.codex?.categories?.includes("Core Nodes")??!1}return e.toSorted(((e,t)=>{const a=n[e.type]??(o(e)?0:8);return(n[t.type]??(o(t)?0:8))-a})).find((e=>!e.disabled))}(Q.value,l.getNodeType)?.name);const o=e?.find((e=>n?.every((t=>t.name!==e.name))));void 0!==o&&(T.value=o.name)}),{immediate:!0}),{workflow:d,versionData:f,currentWorkflowExecutions:m,workflowExecutionData:h,workflowExecutionPairedItemMappings:b,workflowExecutionResultDataLastUpdate:w,workflowExecutionStartedData:g,activeExecutionId:ae,previousExecutionId:ie,executionWaitingForWebhook:k,nodeMetadata:x,isInDebugMode:I,chatMessages:N,chatPartialExecutionDestinationNode:S,workflowId:E,workflowVersionId:A,isNewWorkflow:_,isWorkflowSaved:P,workflowTriggerNodes:D,currentWorkflowHasWebhookNode:O,getWorkflowRunData:M,getWorkflowResultDataByNodeName:function(e){return null===M.value?null:M.value.hasOwnProperty(e)?M.value[e]:null},allConnections:L,allNodes:j,connectionsBySourceNode:K,connectionsByDestinationNode:Z,isWaitingExecution:B,isWorkflowRunning:V,canvasNames:R,nodesByName:F,nodesWithIssuesCount:U,nodesWithIssues:W,nodesIssuesExist:z,workflowValidationIssues:H,formatIssueMessage:function(e){return Array.isArray(e)?e.join(", ").replace(/\.$/,""):String(e)},executedNode:G,getAllLoadedFinishedExecutions:X,getWorkflowExecution:q,getPastChatMessages:J,selectedTriggerNodeName:C((()=>T.value)),workflowExecutionTriggerNodeName:ee,outgoingConnectionsByNodeName:re,incomingConnectionsByNodeName:se,nodeHasOutputConnection:function(e){return d.value.connections.hasOwnProperty(e)},isNodeInOutgoingNodeConnections:function e(t,n,o=-1){if(0===o)return!1;const a=re(t);if(!a?.main?.[0])return!1;const i=a.main[0];return!!i.some((e=>e.node===n))||i.some((t=>e(t.node,n,o-1)))},getNodeByName:le,findRootWithMainConnection:function(e){const t=p.value.getChildNodes(e,"ALL");for(let n=t.length-1;n>=0;n--){const e=t[n];if(p.value.getParentNodes(e,xo.Main).length>0)return e}return null},getNodeById:ue,getNodesByIds:function(e){return e.map(ue).filter(Mh)},getParametersLastUpdate:function(e){return x.value[e]?.parametersLastUpdatedAt},getPinnedDataLastUpdate:function(e){return x.value[e]?.pinnedDataLastUpdatedAt},getPinnedDataLastRemovedAt:function(e){return x.value[e]?.pinnedDataLastRemovedAt},isNodePristine:function(e){return void 0===x.value[e]||x.value[e].pristine},getExecutionDataById:function(e){return m.value.find((t=>t.id===e))},getNodeTypes:ce,getNodes:de,convertTemplateNodeToNodeUi:function(e){const t=Object.keys(e.credentials??{}).reduce(((t,n)=>{const o=e?.credentials?.[n];return o&&"string"!=typeof o?(t[n]=o,t):t}),{});return{...e,credentials:t}},workflowObject:p,createWorkflowObject:pe,cloneWorkflowObject:function(){return pe(de(),L.value)},getWorkflowFromUrl:async function(e,t){return await Ja(i.restApiContext,"GET","/workflows/from-url",{url:e,projectId:t})},getActivationError:async function(e){return await Ja(i.restApiContext,"GET",`/active-workflows/error/${e}`)},resetWorkflow:function(){d.value=ih()},addNodeExecutionStartedData:function(e){const t=g.value?.[0]===e.executionId?g.value?.[1]:{};g.value=[e.executionId,{...t,[e.nodeName]:[...t[e.nodeName]??[],e.data]}]},setWorkflowActiveVersion:function(e){d.value.activeVersion=zt(e)},setWorkflowVersionData:fe,replaceInvalidWorkflowCredentials:function(e){d.value.nodes.forEach((t=>{const n=t.credentials;if(!n?.[e.type])return;const o=n[e.type];"string"!=typeof o||o!==e.invalid.name?null!==o.id?o.id===e.invalid.id&&(t.credentials[e.type]=e.credentials):o.name===e.invalid.name&&(t.credentials[e.type]=e.credentials):t.credentials[e.type]=e.credentials}))},assignCredentialToMatchingNodes:function(e){let t=0;return d.value.nodes.forEach((n=>{if(n.name===e.currentNodeName)return;if(n.credentials&&Object.keys(n.credentials).length>0)return;const o=l.getNodeType(n.type,n.typeVersion);if(!o?.credentials)return;const a=o.credentials.find((t=>t.name===e.type));a&&(a.displayOptions&&!r.displayParameter(n.parameters,a,"",n)||(n.credentials??={},n.credentials[e.type]=e.credentials,t++))})),t},archiveWorkflow:async function(e,t){const n=await c.archiveWorkflowInList(e,t);if(me(e),e===d.value.id){fe({versionId:n.versionId,name:f.value?.name??null,description:f.value?.description??null});const t=Qh(Kh(e));t.setIsArchived(!0),t.setChecksum(n.checksum)}},unarchiveWorkflow:async function(e){const t=await c.unarchiveWorkflowInList(e);if(e===d.value.id){fe({versionId:t.versionId,name:f.value?.name??null,description:f.value?.description??null});const n=Qh(Kh(e));n.setIsArchived(!1),n.setChecksum(t.checksum)}},setWorkflowActive:function(t,n,o){c.setWorkflowActiveInCache(t,n),t===d.value.id&&o&&e.markStateClean()},setWorkflowInactive:me,setDescription:he,getDuplicateCurrentWorkflowName:async function(e){if(e&&e.length+" copy".length>=128)return e;let n=`${e}${ma}`;try{n=(await Sh(i.restApiContext,{name:n})).name}catch(t){}return n},setWorkflowExecutionRunData:function(e){h.value&&(h.value={...h.value,data:e},w.value=Date.now(),g.value=void 0)},setWorkflow:function(e){d.value={...e,...e.hasOwnProperty("active")?{}:{active:!1},...e.hasOwnProperty("connections")?{}:{connections:{}},...e.hasOwnProperty("id")?{}:{id:""},...e.hasOwnProperty("nodes")?{}:{nodes:[]},...e.hasOwnProperty("settings")?{}:{settings:{...nl}}};const t=d.value.id;t&&Qh(Kh(t)).setSettings(d.value.settings??{}),p.value=pe(d.value.nodes,d.value.connections,!0)},addConnection:function(e){if(2!==e.connection.length)return;const t=e.connection[0],n=e.connection[1];if(d.value.connections.hasOwnProperty(t.node)||(d.value.connections[t.node]={}),d.value.connections[t.node].hasOwnProperty(t.type)||(d.value.connections[t.node]={...d.value.connections[t.node],[t.type]:[]}),d.value.connections[t.node][t.type].length<t.index+1)for(let l=d.value.connections[t.node][t.type].length;l<=t.index;l++)d.value.connections[t.node][t.type].push([]);const o=["index","node","type"];let a,i=!1;const r=d.value.connections[t.node][t.type],s=r[t.index];if(s)e:for(const l of s){for(a of o)if(l[a]!==n[a])continue e;i=!0;break}if(!i){r[t.index]=r[t.index]??[];const e=r[t.index];e&&e.push(n)}p.value.setConnections(d.value.connections)},removeConnection:function(t){const n=t.connection[0],o=t.connection[1];if(!d.value.connections.hasOwnProperty(n.node))return;if(!d.value.connections[n.node].hasOwnProperty(n.type))return;if(d.value.connections[n.node][n.type].length<n.index+1)return;e.markStateDirty();const a=d.value.connections[n.node][n.type][n.index];if(a){for(const e in a)a[e].node===o.node&&a[e].type===o.type&&a[e].index===o.index&&a.splice(Number.parseInt(e,10),1);p.value.setConnections(d.value.connections)}},removeAllNodeConnection:ye,renameNodeSelectedAndExecution:function(t){e.markStateDirty();const n=h.value?.data?.resultData?.runData;n?.[t.old]&&(n[t.new]=n[t.old],delete n[t.old]),e.lastSelectedNode===t.old&&(e.lastSelectedNode=t.new);const{[t.old]:o,...a}=x.value;x.value={...a,[t.new]:x.value[t.old]},E.value&&Qh(Kh(E.value)).renamePinDataNode(t.old,t.new);const i=h.value?.data?.resultData;i?.pinData?.[t.old]&&(i.pinData[t.new]=i.pinData[t.old],delete i.pinData[t.old]),Object.values(h.value?.data?.resultData.pinData??{}).flatMap((e=>e.flatMap((e=>Array.isArray(e.pairedItem)?e.pairedItem:[e.pairedItem])))).forEach((e=>{"number"!=typeof e&&e?.sourceOverwrite?.previousNode===t.old&&(e.sourceOverwrite.previousNode=t.new)})),Object.values(h.value?.data?.resultData.runData??{}).flatMap((e=>e.flatMap((e=>e.source)))).forEach((e=>{e&&e.previousNode===t.old&&(e.previousNode=t.new)}))},addNode:function(e){e.hasOwnProperty("name")&&(d.value.nodes.push(e),p.value.setNodes(d.value.nodes),x.value[e.name]||(x.value[e.name]={}))},removeNode:ve,updateNodeExecutionRunData:function(e){const t=h.value?.data?.resultData.runData[e.nodeName],n=t?.findIndex((t=>t.executionIndex===e.data.executionIndex))??-1;t?.[n]&&(t.splice(n,1,e.data),w.value=Date.now())},updateNodeExecutionStatus:function(e){if(!h.value?.data)return void console.warn("[workflows.store] updateNodeExecutionStatus called without execution data; ignoring.");const{nodeName:t,data:i}=e,r="waiting"===i.executionStatus;if(!le(t))return;h.value.data.resultData.lastNodeExecuted=t,void 0===h.value.data.resultData.runData[t]&&(h.value.data.resultData.runData[t]=[]);const s=h.value.data.resultData.runData[t];if(r)s.push(i),w.value=Date.now(),i.metadata?.resumeFormUrl&&Zm(i.metadata.resumeFormUrl);else{const t=s.findIndex((e=>e.executionIndex===i.executionIndex)),r=s.some((e=>"waiting"===e.executionStatus)),l=t>-1&&!r?t:s.length-1,u=s[l]?.executionStatus??"unknown";"waiting"===u||"running"===u||s[t]?s.splice(l,1,i):s.push(i),w.value=Date.now(),async function(e){const t=e.nodeName;if(e.data.error){const i=le(t);n.track("Manual exec errored",{error_title:e.data.error.message,node_type:i?.type,node_type_version:i?.typeVersion,node_id:i?.id,node_graph_string:JSON.stringify(Sn(await o.getWorkflowDataToSave(),o.getNodeTypes(),{isCloudDeployment:a.isCloudDeployment}).nodeGraph)})}}(e)}if(!h.value.data.redactionInfo?.isRedacted&&i.data)for(const n of Object.keys(i.data)){for(const e of i.data[n])if(e?.some((e=>e.redaction?.redacted))){h.value.data.redactionInfo={isRedacted:!0,reason:e.find((e=>e.redaction?.redacted))?.redaction?.reason??"workflow_redaction_policy",canReveal:!1};break}if(h.value.data.redactionInfo?.isRedacted)break}},clearNodeExecutionData:ge,activeNode:function(){return Nu().activeNode},getPastExecutions:async function(e,t,n,o){let a={};return e&&(a={filter:e,firstId:o,lastId:n,limit:t}),await Ja(i.restApiContext,"GET","/executions",a)},getExecution:async function(e){const t=await Ja(i.restApiContext,"GET",`/executions/${e}`);return t&&nN(t)},createNewWorkflow:async function(e){e.active=!1,e.settings||(e.settings??={}),e.settings.availableInMCP=!1;const t=su();!e.projectId&&t.currentProjectId&&(e.projectId=t.currentProjectId);const n=await Ja(i.restApiContext,"POST","/workflows",e);return o.containsNodeFromPackage(n,"@n8n/n8n-nodes-langchain")&&!s.isEasyAIWorkflowOnboardingDone&&(await di(i.restApiContext,{easyAIWorkflowOnboarded:!0}),s.setEasyAIWorkflowOnboardingDone()),n},updateWorkflow:we,publishWorkflow:async function(e,t){return await Ja(i.restApiContext,"POST",`/workflows/${e}/activate`,t)},deactivateWorkflow:async function(e,t){const n=await Ja(i.restApiContext,"POST",`/workflows/${e}/deactivate`,{expectedChecksum:t});if(!n.checksum)throw new Error("Failed to deactivate workflow");return me(e),e===d.value.id&&(fe({versionId:n.versionId,name:f.value?.name??null,description:f.value?.description??null}),Qh(Kh(e)).setChecksum(n.checksum)),n},updateWorkflowSetting:async function(e,t,n){let o={},a="",i="";const r=e===d.value.id,s=r?Qh(Kh(e)):void 0;if(r&&s)o=s.settings,a=d.value.versionId,i=s.checksum;else{const t=c.getWorkflowById(e);if(t&&t.versionId)o=t.settings??{},a=t.versionId;else{const t=await c.fetchWorkflow(e);o=t.settings??{},a=t.versionId}}const l={...o??{},[t]:n},u=await we(e,{versionId:a,settings:l,...i?{expectedChecksum:i}:{}});return r&&s?s.setSettings(u.settings??{}):c.getWorkflowById(e)&&c.updateWorkflowInCache(e,{settings:u.settings,versionId:u.versionId}),u},saveWorkflowDescription:async function(e,t){let n="",o="";const a=e===d.value.id;if(a)n=d.value.versionId,o=Qh(Kh(e)).checksum;else{const t=c.getWorkflowById(e);n=t?.versionId?t.versionId:(await c.fetchWorkflow(e)).versionId}const i=await we(e,{versionId:n,description:t,expectedChecksum:o});return c.getWorkflowById(e)&&c.updateWorkflowInCache(e,{description:i.description,versionId:i.versionId}),a&&he(i.description??""),i},runWorkflow:async function(e){try{return await Ja(i.restApiContext,"POST",`/workflows/${e.workflowId}/run`,e)}catch(t){if(413===t.response?.status)throw new qa(Se.baseText("workflowRun.showError.payloadTooLarge"),{errorCode:413,httpStatusCode:413});throw t}},removeTestWebhook:async function(e){return await Ja(i.restApiContext,"DELETE",`/test-webhook/${e}`)},fetchExecutionDataById:async function(e,t){const n=await async function(e,t,n){return await Ja(e,"GET",`/executions/${t}`,n)}(i.restApiContext,e,t);return n&&nN(n)},deleteExecution:function(e){m.value.splice(m.value.indexOf(e),1)},addToCurrentExecutions:function(e){e.forEach((e=>{m.value.find((t=>t.id===e.id))||e.workflowId!==E.value||m.value.push(e)}))},getBinaryUrl:function(e,t,n,o){let a=i.restUrl;a.startsWith("/")&&(a=window.location.origin+a);const r=new URL(`${a}/binary-data`);return r.searchParams.append("id",e),r.searchParams.append("action",t),n&&r.searchParams.append("fileName",n),o&&r.searchParams.append("mimeType",o),r.toString()},setNodePristine:function(e,t){x.value[e].pristine=t},resetChatMessages:function(){N.value=[]},appendChatMessage:function(e){N.value.push(e)},checkIfNodeHasChatParent:be,checkIfToolNodeHasChatParent:function(e){return p.value.getChildNodes(e,xo.AiTool).some((e=>be(e)))},removeNodeById:function(e){const t=ue(e);t&&ve(t)},removeNodeConnectionsById:function(e){const t=ue(e);t&&ye(t)},removeNodeExecutionDataById:function(e){const t=ue(e);t&&ge(t.name)},setNodes:function(e){e.forEach((e=>{e.id||r.assignNodeId(e),e.extendsCredential&&(e.type=yy(e.extendsCredential)),e.position&&(e.position=rI(e.position)),x.value[e.name]||(x.value[e.name]={pristine:!0})})),d.value.nodes=e,p.value.setNodes(e)},setConnections:function(e){d.value.connections=e,p.value.setConnections(e)},findNodeByPartialId:function(e){return d.value.nodes.find((t=>t.id.startsWith(e)))},getPartialIdForNode:function(e){for(let t=6;t<e.length;++t){const n=e.slice(0,t);if(1===d.value.nodes.filter((e=>e.id.startsWith(n))).length)return n}return e},setSelectedTriggerNodeName:function(e){T.value=e},fetchLastSuccessfulExecution:async function(){const n=At((E.value?Qh(Kh(E.value)):void 0)?.scopes).workflow;try{const t=d.value.id,o=t?Qh(Kh(t)):void 0;if(_.value||u.preferences.branchReadOnly||e.isReadOnlyView||!n.update||o?.isArchived)return;y.value=await async function(e,t){return await Ja(e,"GET",`/workflows/${t}/executions/last-successful`)}(i.restApiContext,E.value)}catch(t){}},lastSuccessfulExecution:y,getWebhookUrl:async function(e,t){const n=ue(e);if(!n)return;const a=l.getNodeType(n.type,n.typeVersion);if(!a?.webhooks?.length)return;const i=a.webhooks[0];return await o.getWebhookUrl(i,n,t)},canViewWorkflows:te,defaults:ah,private:{setActiveExecutionId:function(e){e&&(oe.value=ne.value),ne.value=e}}}}))),sh=new Map,lh=new Set,uh=n(Ua(),1),ch="system";try{const e=lN();null!==e&&(ch=e,rN(e))}catch(t){}e("r",dh=Xa(ai.UI,(()=>{const e=sy(),t=v([]),n=v(null),o=Ae(fo,ch,{writeDefaults:!1,serializer:{read:e=>sN(e)?e:ch,write:uh.default}}),a=v({...Object.fromEntries([xt,ya,aa,Ro,xs,wa,is,as,vs,gs,La,Ut,Ra,Ct,Xo,_s,Do,Pn,Ts,Es,As,Ta,Mt,ua,ws,Zt,Pa,Cs,po,pa,zo,Zo,bs,Sa,St,Cn,Ht,mn,sn,kn,so,Io,ta].map((e=>[e,{open:!1}]))),[os]:{open:!1,activeId:null},[Ps]:{open:!1,mode:"",activeId:null},[Ao]:{open:!1,data:{curlCommands:{}}},[jo]:{open:!1,data:void 0},createOrEditApiKey:{open:!1,data:{activeId:null,mode:""}},[ks]:{open:!1,mode:"",activeId:null,showAuthSelector:!1},[Ns]:{open:!1,activeId:null,data:{workflowListEventBus:void 0,content:{workflowCount:0,subFolderCount:0}}},[Ss]:{open:!1,activeId:null,data:{workflowListEventBus:void 0}},communityPlusEnrollment:{open:!1,data:{customHeading:void 0}},[yn]:{open:!1,data:{triggerType:"",workflowName:"",workflowId:"",webhookPath:"",node:""}},[wo]:{open:!1,data:{nodeName:void 0}},[Ln]:{open:!1,data:{}},[pa]:{open:!1,data:{url:""}},[cn]:{open:!1,data:{workflowName:""}},[$t]:{open:!1,data:{articleId:void 0}},[yo]:{open:!1,data:{nodeName:""}}}),i=v([]),r=Ae("sidebar.collapsed",null,{serializer:{read:e=>"null"===e?null:"true"===e,write:e=>String(e)}}),s=v(""),l=v(!1),u=v(!1),c=v(0),d=v(null),p=v([0,0]),f=v(!1),m=v(!1),h=v({}),y=v(!1),g=v(!1),w=v(!1),b=v({overview:{},project:{},shared:{}}),k=v({}),x=v({width:0,height:0}),I=v(),N=v(null),S=v(),T=v(),E=qi(),A=rh(),_=C((()=>A.workflowId?Qh(Kh(A.workflowId)):void 0)),P=Ce("(prefers-color-scheme: dark)"),D=C((()=>P.value?"dark":"light")),O=C((()=>"system"===o.value?D.value:o.value)),M=C((()=>{let e="";return"cloud"===E.deploymentType&&(e=".cloud"),{feature:{unavailable:{title:`contextual.feature.unavailable.title${e}`}},credentials:{sharing:{unavailable:{title:`contextual.credentials.sharing.unavailable.title${e}`,description:`contextual.credentials.sharing.unavailable.description${e}`,action:`contextual.credentials.sharing.unavailable.action${e}`,button:`contextual.credentials.sharing.unavailable.button${e}`}}},workflows:{sharing:{title:"contextual.workflows.sharing.title",unavailable:{title:`contextual.workflows.sharing.unavailable.title${e}`,description:{modal:`contextual.workflows.sharing.unavailable.description.modal${e}`,tooltip:`contextual.workflows.sharing.unavailable.description.tooltip${e}`},action:`contextual.workflows.sharing.unavailable.action${e}`,button:`contextual.workflows.sharing.unavailable.button${e}`}}},variables:{unavailable:{title:`contextual.variables.unavailable.title${e}`,description:"contextual.variables.unavailable.description",action:`contextual.variables.unavailable.action${e}`,button:`contextual.variables.unavailable.button${e}`}},users:{settings:{unavailable:{title:`contextual.users.settings.unavailable.title${e}`,description:`contextual.users.settings.unavailable.description${e}`,button:`contextual.users.settings.unavailable.button${e}`}}}}})),L=C((()=>S.value?_.value?.getNodeById(S.value)??null:null)),j=C((()=>Object.keys(a.value).reduce(((e,t)=>(e[t]=t===i.value[0],e)),{}))),$=C((()=>i.value.map((e=>e)))),B=C((()=>{const e=[];return Object.entries(k.value).forEach((([t,n])=>{E.isModuleActive(t)&&e.push(...n.map((e=>({available:!0,...e}))))})),e})),V=C((()=>![Tn.WORKFLOW.toString(),Tn.NEW_WORKFLOW.toString(),Tn.EXECUTION_DEBUG.toString()].includes(s.value))),R=C((()=>t.value.reduce(((e,t)=>(e[t]=!0,e)),{}))),F=C((()=>{const e=getComputedStyle(document.body);return Number(e.getPropertyValue("--header--height"))})),W=C((()=>i.value.length>0)),U=C((()=>g.value)),z=(e,t)=>{a.value[e]={...a.value[e],mode:t}},H=(e,t)=>{a.value[e]={...a.value[e],activeId:t}},G=e=>{a.value[e.name]={...a.value[e.name],data:e.data}},Y=e=>{a.value[e]={...a.value[e],open:!0},i.value=[e].concat(i.value)},X=e=>{G(e),Y(e.name)},q=e=>{a.value[e]={...a.value[e],open:!1},i.value=i.value.filter((t=>e!==t))},J=(e,t)=>{a.value[e]||(a.value[e]=t||{open:!1})},K=cN((e=>{e.forEach(((e,t)=>{a.value[t]||J(t,e.initialState)}))}));return{appGridDimensions:x,settingsSidebarItems:B,appliedTheme:O,contextBasedTranslationKeys:M,isModalActiveById:j,isReadOnlyView:V,isActionActive:R,activeActions:t,headerHeight:F,dirtyStateSetCount:C((()=>c.value)),stateIsDirty:C((()=>l.value)),hasUnsavedWorkflowChanges:C((()=>u.value)),isBlankRedirect:w,activeCredentialType:n,lastSelectedNode:d,lastInteractedWithNodeConnection:I,lastInteractedWithNodeHandle:N,lastInteractedWithNodeId:S,lastInteractedWithNode:L,lastCancelledConnectionPosition:T,nodeViewOffsetPosition:p,nodeViewInitialized:f,addFirstStepOnLoad:m,sidebarMenuCollapsed:r,theme:C((()=>o.value)),modalsById:a,currentView:s,isAnyModalOpen:W,pendingNotificationsForViews:h,areNotificationsSuppressed:y,activeModals:$,isProcessingExecutionResults:U,setTheme:e=>{o.value=e,rN(e)},setModalData:G,openModalWithData:X,openModal:Y,closeModal:q,openDeleteUserModal:e=>{H(os,e),Y(os)},openExistingCredential:e=>{H(ks,e),z(ks,"edit"),a.value[ks]={...a.value[ks],projectId:void 0},Y(ks)},openNewCredential:(e,t=!1,n=!1,o,i)=>{H(ks,e),((e,t)=>{a.value[e]={...a.value[e],showAuthSelector:t}})(ks,t),a.value[ks]={...a.value[ks],forceManualMode:n,projectId:o,suggestedName:i},z(ks,"new"),Y(ks)},openCommunityPackageUninstallConfirmModal:e=>{z(Ps,Ds.UNINSTALL),H(Ps,e),Y(Ps)},openCommunityPackageUpdateConfirmModal:(t,n)=>{e.track("User clicked to open community node update modal",{source:n,package_name:t}),z(Ps,Ds.UPDATE),H(Ps,t),Y(Ps)},addActiveAction:e=>{t.value.includes(e)||t.value.push(e)},removeActiveAction:e=>{const n=t.value.indexOf(e);-1!==n&&t.value.splice(n,1)},toggleSidebarMenuCollapse:()=>{r.value=!r.value,e.track("User toggled sidebar",{expanded:!r.value})},setNotificationsForView:(e,t)=>{h.value[e]=t},setNotificationsSuppressed:e=>{y.value=e},resetLastInteractedWith:function(){I.value=void 0,N.value=null,S.value=void 0,T.value=void 0},setProcessingExecutionResults:e=>{g.value=e},markStateDirty:(e="workflow")=>{c.value++,l.value=!0,"workflow"===e&&(u.value=!0)},markStateClean:()=>{l.value=!1,u.value=!1},openDeleteFolderModal:(e,t,n)=>{H(Ns,e),X({name:Ns,data:{workflowListEventBus:t,content:n}})},openMoveToFolderModal:(e,t,n)=>{X({name:Ss,data:{resourceType:e,resource:t,workflowListEventBus:n}})},moduleTabs:b,registerCustomTabs:(e,t,n)=>{if(!b.value[e])throw new Error(`Invalid page type: ${e}`);b.value[e][t]=n},registerSettingsPages:(e,t)=>{k.value[e]=t},registerModal:J,unregisterModal:e=>{a.value[e]&&(a.value[e].open&&q(e),delete a.value[e])},initializeModalsFromRegistry:()=>{uN().forEach(((e,t)=>{J(t,e.initialState)}))},cleanup:()=>{K()}}}))),e("n",(e=>{const{store:t,onModalClosed:n,onModalOpened:o}=e,a=["openModal","openModalWithData","closeModal"];return t.$onAction((e=>{const{name:t,after:i,args:r}=e;i((()=>{if(a.includes(t))switch(t){case"openModal":{const e=r[0];o?.(e);break}case"openModalWithData":{const{name:e}=r[0]??{};o?.(e);break}case"closeModal":{const e=r[0];n?.(e);break}}}))}))})),ph="https://api.n8n.io/api",fh="/accounts/onboarding",mh=e=>!!e?.isPending,hh=e=>e?.role===Vn.Owner,yh=e=>hh(e)&&mh(e),vh=e=>e?.role===Vn.Admin,e("t",gh=Xa(ai.USERS,(()=>{const e=v(!1),n=v(null),o=v({}),a=v(-1),i=v([]),r=v([]),s=dh(),l=ni(),u=qi(),c=C((()=>Object.values(o.value))),d=C((()=>n.value?o.value[n.value]:null)),p=C((()=>Boolean(d.value?.settings?.userActivated))),f=C((()=>yh(d.value))),m=C((()=>hh(d.value))),h=C((()=>vh(d.value))),y=C((()=>m.value||h.value)),g=C((()=>d.value?.mfaEnabled??!1)),w=C((()=>d.value?.role??"default")),b=C((()=>d.value?.settings?.userClaimedAiCredits)),k=C((()=>Boolean(d.value?.settings?.easyAIWorkflowOnboarded))),x=C((()=>m.value)),I=C((()=>{const e=d.value;if(!e)return[];const t=e.personalizationAnswers;return t?Nh(t):[]})),N=C((()=>-1===a.value||a.value>c.value.length)),S=e=>{e.forEach((e=>{const t={...o.value[e.id]||{},...e},n={...t,fullName:e.firstName?`${t.firstName} ${t.lastName||""}`:void 0,isDefaultUser:yh(t),isPendingUser:mh(t)};o.value={...o.value,[n.id]:n}}))},T=async e=>{S([e]),n.value=e.id;for(const n of i.value)try{await n(e)}catch(t){console.error("Error executing login hook:",t)}},E=async()=>{const e=await Ai(l.restApiContext);e&&await T(e)},A=e=>{d.value&&(o.value={...o.value,[d.value.id]:{...d.value,personalizationAnswers:e}})},_=async e=>{const t=await vi(l.restApiContext,e);return S([t]),t},P=async({take:e,skip:t,filter:n}={})=>{if(!ty(["rbac"],{rbac:{scope:"user:list"}}))return;const{items:o}=await Ui(l.restApiContext,{take:e??50,skip:t??0,filter:n});S(o)},D=Te((async e=>await Ui(l.restApiContext,e)),{count:0,items:[]},{immediate:!1,resetOnExecute:!1});return{initialized:e,currentUserId:n,usersById:o,allUsers:c,currentUser:d,userActivated:p,isDefaultUser:f,isInstanceOwner:m,isAdmin:h,isAdminOrOwner:y,mfaEnabled:g,globalRoleName:w,personalizedNodeTypes:I,userClaimedAiCredits:b,isEasyAIWorkflowOnboardingDone:k,canUserUpdateVersion:x,usersLimitNotReached:N,addUsers:S,loginWithCookie:E,initialize:async()=>{if(!e.value)try{await E(),e.value=!0}catch(t){}},setPersonalizationAnswers:A,loginWithCreds:async e=>{const t=await ji(l.restApiContext,e);t&&await T(t)},logout:async()=>{await Si(l.restApiContext),n.value=null;for(const t of r.value)try{await t()}catch(e){console.error("Error executing logout hook:",e)}localStorage.removeItem(Ya)},registerLoginHook:e=>{i.value.push(e)},registerLogoutHook:e=>{r.value.push(e)},createOwner:async e=>{const t=await Qi(l.restApiContext,e);t&&(await T(t),u.stopShowingSetupPage())},validateSignupToken:async e=>await si(l.restApiContext,e),acceptInvitation:async e=>{const t=await async function(e,t){if(!t.token)throw new Error("Token is required");return await Ja(e,"POST","/invitations/accept",t)}(l.restApiContext,e);t&&await T(t)},sendForgotPasswordEmail:async e=>{await mi(l.restApiContext,e)},validatePasswordToken:async e=>{await pi(l.restApiContext,e)},changePassword:async e=>{await Mi(l.restApiContext,e)},updateUser:_,updateUserName:async e=>{if(d.value)return await _({email:d.value.email,...e})},updateUserSettings:async e=>{const t=await di(l.restApiContext,e);d.value&&(d.value.settings=t,S([d.value]))},updateOtherUserSettings:async(e,t)=>{await er(l.restApiContext,e,t)},updateCurrentUserPassword:async e=>{await nr(l.restApiContext,e)},deleteUser:async e=>{await Ki(l.restApiContext,e),(e=>{const{[e]:t,...n}=o.value;o.value=n})(e.id)},fetchUsers:P,inviteUsers:async e=>{const t=await dN(l.restApiContext,e);return S(t.map((({user:e})=>({isPending:!0,...e})))),t},reinviteUser:async({email:e,role:t})=>{const n=await dN(l.restApiContext,[{email:e,role:t}]);if(!n[0].user.emailSent)throw Error(n[0].error)},getUserPasswordResetLink:async e=>await xi(l.restApiContext,e),generateInviteLink:async e=>await wi(l.restApiContext,e),submitPersonalizationSurvey:async e=>{await or(l.restApiContext,e),A(e)},showPersonalizationSurvey:async()=>{u.isPersonalizationSurveyEnabled&&d.value&&!d.value.personalizationAnswers&&s.openModal(is)},fetchMfaQR:async()=>await Bi(l.restApiContext),verifyMfaCode:async e=>await Ei(l.restApiContext,e),enableMfa:async e=>{await Hi(l.restApiContext,e),d.value&&(d.value.mfaEnabled=!0)},disableMfa:async e=>{await Ni(l.restApiContext,e),d.value&&(d.value.mfaEnabled=!1)},updateEnforceMfa:async e=>{await _i(l.restApiContext,e),u.isMFAEnforced=e},canEnableMFA:async()=>await bi(l.restApiContext),sendConfirmationEmail:async()=>{await Ti(l.restApiContext)},updateGlobalRole:async({id:e,newRoleName:t})=>{await ii(l.restApiContext,{id:e,newRoleName:t}),await P({filter:{ids:[e]}})},setEasyAIWorkflowOnboardingDone:()=>{d.value?.settings&&(d.value.settings.easyAIWorkflowOnboarded=!0)},isCalloutDismissed:e=>Boolean(d.value?.settings?.dismissedCallouts?.[e]),setCalloutDismissed:e=>{d.value?.settings&&(d.value?.settings?.dismissedCallouts||(d.value.settings.dismissedCallouts={}),d.value.settings.dismissedCallouts[e]=!0)},submitContactEmail:async(e,t)=>d.value?await async function(e,t,n,o){return await oi(ph,fh,{instance_id:e,user_id:`${e}#${t.id}`,email:n,agree:o,agree_updates:!0})}(l.instanceId,d.value,e??d.value.email,t):null,setUserQuota:e=>{void 0!==e&&(a.value=e)},usersList:D}})))}}}));
//# sourceMappingURL=users.store-legacy-azRUgFdP.js.map