@axiom-lattice/gateway 7.0.0 → 8.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{WechatChannelAdapter-7WHE5UGY.mjs → WechatChannelAdapter-QLPJJD6S.mjs} +55 -4
- package/dist/WechatChannelAdapter-QLPJJD6S.mjs.map +1 -0
- package/dist/{a2a-standard-DP53K7RC.mjs → a2a-standard-VL5I7B4W.mjs} +831 -59
- package/dist/a2a-standard-VL5I7B4W.mjs.map +1 -0
- package/dist/{chunk-FGSFOXIX.mjs → chunk-L6MBEEII.mjs} +2 -2
- package/dist/{chunk-J6B2VFJ7.mjs → chunk-W3YH4S6G.mjs} +2 -1
- package/dist/{chunk-MWWLJMYN.mjs → chunk-XUWD4VKY.mjs} +4 -2
- package/dist/chunk-XUWD4VKY.mjs.map +1 -0
- package/dist/embed/embed-page-AgentDetailSideApp-23TCREK6.js +1 -0
- package/dist/embed/embed-page-AgentGovernanceWorkbench-N3F65F3W.js +1 -0
- package/dist/embed/embed-page-LangfuseDashboard-WBE7GJPU.js +1 -0
- package/dist/embed/embed-page-MessageGraph-T3EFAXTX.js +6 -0
- package/dist/embed/embed-page-ReactChart-FJFQU4IV.js +1 -0
- package/dist/embed/embed-page-SkillFlow-2BUXCLAL.js +1 -0
- package/dist/embed/{embed-page-TasksSideApp-D7FFG2OC.js → embed-page-TasksSideApp-VFKEYFGR.js} +1 -1
- package/dist/embed/embed-page-ThreadMaintenancePanel-EPBJ4J3L.js +1 -0
- package/dist/embed/{embed-page-TopologyRuntimeView-IS6HEO4F.js → embed-page-TopologyRuntimeView-OWESU7IK.js} +1 -1
- package/dist/embed/{embed-page-WorkflowAutomationView-IDVSQTJB.js → embed-page-WorkflowAutomationView-5J2RQTZ7.js} +1 -1
- package/dist/embed/{embed-page-chunk-XFV3N2LD.js → embed-page-chunk-2ZBEWYJQ.js} +1 -1
- package/dist/embed/{embed-page-chunk-SRMYHWL3.js → embed-page-chunk-34RWKVD7.js} +1 -1
- package/dist/embed/{embed-page-chunk-JFMBLJXY.js → embed-page-chunk-6QLLZJVH.js} +1 -1
- package/dist/embed/embed-page-chunk-B2KNZ3EW.js +59 -0
- package/dist/embed/{embed-page-chunk-BOEX26H7.js → embed-page-chunk-BFVNPGSW.js} +8 -8
- package/dist/embed/embed-page-chunk-CKUSXUKW.js +6746 -0
- package/dist/embed/embed-page-chunk-CQLDPGEG.js +1 -0
- package/dist/embed/embed-page-chunk-D7YTSCUO.js +1 -0
- package/dist/embed/{embed-page-chunk-S2KVN3RB.js → embed-page-chunk-DJKD2PHO.js} +1 -1
- package/dist/embed/{embed-page-chunk-EYYKNTX7.js → embed-page-chunk-EU32IF7M.js} +1 -1
- package/dist/embed/embed-page-chunk-F7TA3LRH.js +459 -0
- package/dist/embed/embed-page-chunk-F7ZUYG42.js +121 -0
- package/dist/embed/{embed-page-chunk-NFMLKSPM.js → embed-page-chunk-GSUSX54K.js} +1 -1
- package/dist/embed/embed-page-chunk-JMTQCORF.js +211 -0
- package/dist/embed/embed-page-chunk-L7TDL27M.js +15 -0
- package/dist/embed/{embed-page-chunk-TVVAPR7I.js → embed-page-chunk-PTKGTA4B.js} +1 -1
- package/dist/embed/embed-page-chunk-R7TLHZR3.js +7 -0
- package/dist/embed/{embed-page-chunk-FEMHLB6I.js → embed-page-chunk-WKQHSEZ4.js} +1 -1
- package/dist/embed/embed-page-code-highlighter-72YW5HXH.js +1 -0
- package/dist/embed/{embed-page-en-ETUCVCSC.js → embed-page-en-E35GE7TA.js} +1 -1
- package/dist/embed/embed-page-en-EKHHBS6L.js +1 -0
- package/dist/embed/embed-page-en-G5J7KW6V.js +1 -0
- package/dist/embed/embed-page-en-HDSVQ4O6.js +1 -0
- package/dist/embed/embed-page-en-KAXIJJ4X.js +1 -0
- package/dist/embed/embed-page-en-OIICQSPX.js +3 -0
- package/dist/embed/embed-page-en-TMGUHZ6Y.js +1 -0
- package/dist/embed/embed-page-en-TSCGSJAI.js +1 -0
- package/dist/embed/embed-page-en-XJYWUJEL.js +1 -0
- package/dist/embed/{embed-page-en-2SWQHPAC.js → embed-page-en-ZCNNAMUD.js} +1 -1
- package/dist/embed/{embed-page-mermaid-KEBBKHQH.js → embed-page-mermaid-4PZJJXQU.js} +1 -1
- package/dist/embed/embed-page-zh-2UVQB4RP.js +3 -0
- package/dist/embed/embed-page-zh-6EBUEFKP.js +1 -0
- package/dist/embed/embed-page-zh-72QSTYRF.js +1 -0
- package/dist/embed/embed-page-zh-B3WBWQAV.js +1 -0
- package/dist/embed/embed-page-zh-IR652A6J.js +1 -0
- package/dist/embed/embed-page-zh-KEMYJJLT.js +1 -0
- package/dist/embed/embed-page-zh-Q22DIOB3.js +1 -0
- package/dist/embed/{embed-page-zh-PRMID3YQ.js → embed-page-zh-Z3URTIHW.js} +1 -1
- package/dist/embed/{embed-page-zh-D3IC6BGA.js → embed-page-zh-ZLK3GLM3.js} +1 -1
- package/dist/embed/embed-page.js +1 -1
- package/dist/index.d.mts +137 -14
- package/dist/index.d.ts +137 -14
- package/dist/index.js +3942 -1479
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2272 -635
- package/dist/index.mjs.map +1 -1
- package/dist/{open-NTH7AGD3.mjs → open-7ED27I5B.mjs} +3 -3
- package/dist/{open-exposure-AGNG4MC3.mjs → open-exposure-I3DN2X4E.mjs} +6 -4
- package/dist/{open-exposure-AGNG4MC3.mjs.map → open-exposure-I3DN2X4E.mjs.map} +1 -1
- package/package.json +13 -7
- package/dist/WechatChannelAdapter-7WHE5UGY.mjs.map +0 -1
- package/dist/a2a-standard-DP53K7RC.mjs.map +0 -1
- package/dist/chunk-MWWLJMYN.mjs.map +0 -1
- package/dist/embed/embed-page-AgentDetailSideApp-KNVDO3FZ.js +0 -1
- package/dist/embed/embed-page-AgentGovernanceWorkbench-QSKWVADP.js +0 -1
- package/dist/embed/embed-page-MessageGraph-VGXX4OWU.js +0 -6
- package/dist/embed/embed-page-ReactChart-PIISVBLU.js +0 -1
- package/dist/embed/embed-page-SkillFlow-JLI5MEZE.js +0 -1
- package/dist/embed/embed-page-ThreadMaintenancePanel-FSQVVIIG.js +0 -1
- package/dist/embed/embed-page-chunk-37LGEEJU.js +0 -21
- package/dist/embed/embed-page-chunk-436REIWY.js +0 -1
- package/dist/embed/embed-page-chunk-4W34QOXT.js +0 -517
- package/dist/embed/embed-page-chunk-BANVRQT7.js +0 -322
- package/dist/embed/embed-page-chunk-N66H4DNH.js +0 -6657
- package/dist/embed/embed-page-code-highlighter-66CSPTFK.js +0 -1
- package/dist/embed/embed-page-en-27OIE2UA.js +0 -1
- package/dist/embed/embed-page-en-7IHJFS63.js +0 -1
- package/dist/embed/embed-page-en-7NF4GCC2.js +0 -1
- package/dist/embed/embed-page-en-FP6DWSG3.js +0 -1
- package/dist/embed/embed-page-en-GHTROC4H.js +0 -1
- package/dist/embed/embed-page-en-WUFULCUS.js +0 -1
- package/dist/embed/embed-page-en-X6B6RVNL.js +0 -1
- package/dist/embed/embed-page-en-XUMHP5CL.js +0 -1
- package/dist/embed/embed-page-zh-EQ5X2M32.js +0 -1
- package/dist/embed/embed-page-zh-FXQGY5HD.js +0 -1
- package/dist/embed/embed-page-zh-G75LDQU4.js +0 -1
- package/dist/embed/embed-page-zh-KJXKOUIY.js +0 -1
- package/dist/embed/embed-page-zh-RMSS6PXD.js +0 -1
- package/dist/embed/embed-page-zh-VH6J7XZO.js +0 -1
- package/dist/embed/embed-page-zh-Y5X5Y2DF.js +0 -1
- /package/dist/{chunk-FGSFOXIX.mjs.map → chunk-L6MBEEII.mjs.map} +0 -0
- /package/dist/{chunk-J6B2VFJ7.mjs.map → chunk-W3YH4S6G.mjs.map} +0 -0
- /package/dist/{open-NTH7AGD3.mjs.map → open-7ED27I5B.mjs.map} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as L,o as j}from"./embed-page-chunk-R7TLHZR3.js";import{k as P}from"./embed-page-chunk-L7TDL27M.js";import{a as _}from"./embed-page-chunk-QV7QAJ4N.js";import{Ja as V}from"./embed-page-chunk-B2KNZ3EW.js";import{Da as g,Ia as v,La as b,Ma as M,_ as R,_a as U,bb as O,za as E}from"./embed-page-chunk-F7TA3LRH.js";import{a as D}from"./embed-page-chunk-R5QL57JJ.js";import{f as w}from"./embed-page-chunk-QBTAJ2YI.js";var d=w(D());function G(f){let k=j("__GLOBAL__"),[z,a]=(0,d.useState)(!1),[u,S]=(0,d.useState)(null),x=(0,d.useCallback)(()=>{f?.onUnauthorized?f.onUnauthorized():window.dispatchEvent(new CustomEvent("lattice:unauthorized"))},[f?.onUnauthorized]),s=(0,d.useCallback)(async(l,o,n,F)=>{a(!0),S(null);try{return await k.request(o,{method:l,body:n,headers:F?.headers})}catch(C){throw C instanceof L&&x(),S(C),C}finally{a(!1)}},[k,x]),I=(0,d.useCallback)((l,o)=>s("GET",l,void 0,o),[s]),r=(0,d.useCallback)((l,o,n)=>s("POST",l,o,n),[s]),t=(0,d.useCallback)((l,o,n)=>s("PUT",l,o,n),[s]),m=(0,d.useCallback)((l,o)=>s("DELETE",l,void 0,o),[s]);return{get:I,post:r,put:t,del:m,isLoading:z,error:u}}var T=w(D());var e=w(_()),{TextArea:W}=v,{Text:h}=O,H=({open:f,onCancel:k,onSuccess:z,skill:a})=>{let[u]=g.useForm(),[S,x]=(0,T.useState)(!1),{post:s,put:I}=G(),{token:r}=U.useToken(),t=P(),m=!!a,l=[{key:"category",value:"global"}],[o,n]=(0,T.useState)(l);(0,T.useEffect)(()=>{f&&a?(u.setFieldsValue({name:a.name,description:a.description,license:a.license||"",compatibility:a.compatibility||"",content:a.content||""}),a.metadata?n(Object.entries(a.metadata).map(([i,c])=>({key:i,value:c}))):n(l)):f&&!a&&(u.resetFields(),n(l))},[f,a]);let F=async()=>{try{let i=await u.validateFields();x(!0);let c=o.length>0?o.reduce((B,q)=>(q.key&&(B[q.key]=q.value),B),{}):void 0,p={id:i.name,name:i.name,description:i.description,license:i.license||void 0,compatibility:i.compatibility||void 0,metadata:c,content:i.content||void 0,subSkills:void 0},y;m?y=await I(`/api/skills/${a.id}`,p):y=await s("/api/skills",p),y.success?(b.success(t(m?"chatConfig.skill.updated":"chatConfig.skill.created")),u.resetFields(),n(l),z?.(),k()):b.error(y.message||t(m?"chatConfig.skill.updateFailed":"chatConfig.skill.createFailed"))}catch(i){if(i.errorFields)return;b.error(i.message||t(m?"chatConfig.skill.updateError":"chatConfig.skill.createError"))}finally{x(!1)}},C=()=>{u.resetFields(),n(l),k()},A=(i,c,p)=>{let y=[...o];y[i]={...y[i],[c]:p},n(y)},$=()=>{n([...o,{key:"",value:""}])};return(0,e.jsx)(M,{title:t(m?"chatConfig.skill.edit.title":"chatConfig.skill.create.title"),open:f,onCancel:C,footer:null,width:520,destroyOnClose:!0,styles:{body:{padding:16}},children:(0,e.jsx)(g,{form:u,layout:"vertical",onFinish:F,autoComplete:"off",children:(0,e.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:12},children:[(0,e.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[(0,e.jsx)(h,{style:{fontSize:12,color:r.colorTextSecondary},children:t("chatConfig.skill.field.name")}),(0,e.jsx)(g.Item,{name:"name",rules:[{required:!0,message:t("chatConfig.skill.validation.nameRequired")},{pattern:/^[a-z0-9]+(-[a-z0-9]+)*$/,message:t("chatConfig.skill.validation.namePattern")},{min:1,max:64,message:t("chatConfig.skill.validation.nameLength")}],style:{marginBottom:0},children:(0,e.jsx)(v,{placeholder:"e.g., data-analysis",disabled:m})})]}),(0,e.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[(0,e.jsx)(h,{style:{fontSize:12,color:r.colorTextSecondary},children:t("chatConfig.skill.field.description")}),(0,e.jsx)(g.Item,{name:"description",rules:[{required:!0,message:t("chatConfig.skill.validation.descriptionRequired")}],style:{marginBottom:0},children:(0,e.jsx)(W,{placeholder:t("chatConfig.skill.placeholder.description"),autoSize:{minRows:2,maxRows:4}})})]}),(0,e.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[(0,e.jsx)(h,{style:{fontSize:12,color:r.colorTextSecondary},children:t("chatConfig.skill.field.license")}),(0,e.jsx)(g.Item,{name:"license",style:{marginBottom:0},children:(0,e.jsx)(v,{placeholder:t("chatConfig.skill.placeholder.license")})})]}),(0,e.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[(0,e.jsx)(h,{style:{fontSize:12,color:r.colorTextSecondary},children:t("chatConfig.skill.field.compatibility")}),(0,e.jsx)(g.Item,{name:"compatibility",style:{marginBottom:0},children:(0,e.jsx)(v,{placeholder:t("chatConfig.skill.placeholder.compatibility")})})]}),(0,e.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8},children:[(0,e.jsx)(h,{style:{fontSize:12,color:r.colorTextSecondary,fontWeight:500},children:t("chatConfig.skill.field.metadata")}),(0,e.jsx)(R,{size:"small",icon:(0,e.jsx)(V,{}),onClick:$,children:t("chatConfig.skill.metadata.add")})]}),(0,e.jsxs)(E,{direction:"vertical",size:8,style:{width:"100%"},children:[o.length===0&&(0,e.jsx)(h,{style:{fontSize:11,color:r.colorTextTertiary},children:t("chatConfig.skill.metadata.empty")}),o.map((i,c)=>(0,e.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:4,width:"100%"},children:[(0,e.jsx)(h,{style:{fontSize:11,color:r.colorTextSecondary},children:t("chatConfig.skill.metadata.row",{index:c+1})}),(0,e.jsxs)(E,{style:{width:"100%"},size:8,wrap:!0,children:[(0,e.jsx)(v,{value:i.key,placeholder:t("chatConfig.keyValue.key"),style:{width:140},onChange:p=>A(c,"key",p.target.value)}),(0,e.jsx)(v,{value:i.value,placeholder:t("chatConfig.keyValue.value"),style:{flex:1,minWidth:200},onChange:p=>A(c,"value",p.target.value)})]})]},c))]})]}),(0,e.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[(0,e.jsx)(h,{style:{fontSize:12,color:r.colorTextSecondary},children:t("chatConfig.skill.field.content")}),(0,e.jsx)(g.Item,{name:"content",style:{marginBottom:0},children:(0,e.jsx)(W,{placeholder:t("chatConfig.skill.placeholder.content"),autoSize:{minRows:4,maxRows:8}})})]}),(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"flex-end",gap:8,marginTop:8},children:[(0,e.jsx)(R,{onClick:C,children:t("common.cancel")}),(0,e.jsx)(R,{type:"primary",htmlType:"submit",loading:S,children:t(m?"chatConfig.skill.action.save":"chatConfig.skill.action.create")})]})]})})})},ie=H;export{G as a,ie as b};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as d}from"./embed-page-chunk-QV7QAJ4N.js";import{a as m}from"./embed-page-chunk-R5QL57JJ.js";import{f as a}from"./embed-page-chunk-QBTAJ2YI.js";var e=a(m()),p=a(d()),E=({option:u,height:O=200,onEvents:o})=>{let i=(0,e.useRef)(null),n=(0,e.useRef)(null),l=(0,e.useRef)(u),f=(0,e.useRef)(o);return(0,e.useEffect)(()=>{l.current=u,n.current?.setOption(u,!0)},[u]),(0,e.useEffect)(()=>{f.current=o;let c=n.current;if(!c||!o)return;let s=Object.entries(o);for(let[r,t]of s)c.on(r,t);return()=>{for(let[r,t]of s)c.off(r,t)}},[o]),(0,e.useEffect)(()=>{let c=!1,s=null;return(async()=>{let r=await import("./embed-page-echarts-QVSODBM4.js");if(c||!i.current)return;let t=r.init(i.current);n.current=t,t.setOption(l.current,!0);let h=f.current;if(h)for(let[v,b]of Object.entries(h))t.on(v,b);s=new ResizeObserver(()=>n.current?.resize()),s.observe(i.current)})().catch(r=>{console.error("[EChart] async init failed:",r)}),()=>{c=!0,s?.disconnect(),n.current?.dispose(),n.current=null}},[]),(0,p.jsx)("div",{ref:i,style:{width:"100%",height:O}})};export{E as a};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{b as Xe,c as zt,d as Dt,f as tt,h as nt,k as _n,l as Cn,m as At}from"./embed-page-chunk-S4XZPBRM.js";import{a as Os}from"./embed-page-chunk-QV7QAJ4N.js";import{a as Hs}from"./embed-page-chunk-4W34QOXT.js";import{a as et}from"./embed-page-chunk-R5QL57JJ.js";import{c as Je,f as Ze}from"./embed-page-chunk-QBTAJ2YI.js";var mo=Je(ho=>{"use strict";var Te=et();function mi(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var yi=typeof Object.is=="function"?Object.is:mi,xi=Te.useState,bi=Te.useEffect,wi=Te.useLayoutEffect,Ei=Te.useDebugValue;function Si(e,t){var n=t(),o=xi({inst:{value:n,getSnapshot:t}}),r=o[0].inst,s=o[1];return wi(function(){r.value=n,r.getSnapshot=t,cn(r)&&s({inst:r})},[e,n,t]),bi(function(){return cn(r)&&s({inst:r}),e(function(){cn(r)&&s({inst:r})})},[e]),Ei(n),n}function cn(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!yi(e,n)}catch{return!0}}function vi(e,t){return t()}var _i=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?vi:Si;ho.useSyncExternalStore=Te.useSyncExternalStore!==void 0?Te.useSyncExternalStore:_i});var xo=Je((tl,yo)=>{"use strict";yo.exports=mo()});var wo=Je(bo=>{"use strict";var bt=et(),Ci=xo();function Ni(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var ki=typeof Object.is=="function"?Object.is:Ni,Mi=Ci.useSyncExternalStore,Ii=bt.useRef,Pi=bt.useEffect,zi=bt.useMemo,Di=bt.useDebugValue;bo.useSyncExternalStoreWithSelector=function(e,t,n,o,r){var s=Ii(null);if(s.current===null){var i={hasValue:!1,value:null};s.current=i}else i=s.current;s=zi(function(){function f(h){if(!l){if(l=!0,g=h,h=o(h),r!==void 0&&i.hasValue){var p=i.value;if(r(p,h))return c=p}return c=h}if(p=c,ki(g,h))return p;var y=o(h);return r!==void 0&&r(p,y)?(g=h,p):(g=h,c=y)}var l=!1,g,c,d=n===void 0?null:n;return[function(){return f(t())},d===null?void 0:function(){return f(d())}]},[t,n,o,r]);var a=Mi(e,s[0],s[1]);return Pi(function(){i.hasValue=!0,i.value=a},[a]),Di(a),a}});var So=Je((ol,Eo)=>{"use strict";Eo.exports=wo()});var ae={error001:()=>"[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001",error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>"The React Flow parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,{id:t,sourceHandle:n,targetHandle:o})=>`Couldn't create edge for ${e} handle id: "${e==="source"?n:o}", edge id: ${t}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(e="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${e}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>"useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.",error015:()=>"It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs."},De=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],Tt=["Enter"," ","Escape"],Rt={"node.a11yDescription.default":"Press enter or space to select a node. Press delete to remove it and escape to cancel.","node.a11yDescription.keyboardDisabled":"Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.","node.a11yDescription.ariaLiveMessage":({direction:e,x:t,y:n})=>`Moved selected node ${e}. New position, x: ${t}, y: ${n}`,"edge.a11yDescription.default":"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.","controls.ariaLabel":"Control Panel","controls.zoomIn.ariaLabel":"Zoom In","controls.zoomOut.ariaLabel":"Zoom Out","controls.fitView.ariaLabel":"Fit View","controls.interactive.ariaLabel":"Toggle Interactivity","minimap.ariaLabel":"Mini Map","handle.ariaLabel":"Handle"},ye;(function(e){e.Strict="strict",e.Loose="loose"})(ye||(ye={}));var ge;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(ge||(ge={}));var Se;(function(e){e.Partial="partial",e.Full="full"})(Se||(Se={}));var Bt={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null},de;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(de||(de={}));var Ie;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(Ie||(Ie={}));var F;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(F||(F={}));var Nn={[F.Left]:F.Right,[F.Right]:F.Left,[F.Top]:F.Bottom,[F.Bottom]:F.Top};function Vt(e){return e===null?null:e?"valid":"invalid"}var Ft=e=>"id"in e&&"source"in e&&"target"in e,Rn=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),Yt=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e);var Ge=(e,t=[0,0])=>{let{width:n,height:o}=ue(e),r=e.origin??t,s=n*r[0],i=o*r[1];return{x:e.position.x-s,y:e.position.y-i}},Zt=(e,t={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};let n=e.reduce((o,r)=>{let s=typeof r=="string",i=!t.nodeLookup&&!s?r:void 0;t.nodeLookup&&(i=s?t.nodeLookup.get(r):Yt(r)?r:t.nodeLookup.get(r.id));let a=i?st(i,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return at(o,a)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return ct(n)},Ae=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},o=!1;return e.forEach(r=>{(t.filter===void 0||t.filter(r))&&(n=at(n,st(r)),o=!0)}),o?ct(n):{x:0,y:0,width:0,height:0}},it=(e,t,[n,o,r]=[0,0,1],s=!1,i=!1)=>{let a={...Oe(t,[n,o,r]),width:t.width/r,height:t.height/r},f=[];for(let l of e.values()){let{measured:g,selectable:c=!0,hidden:d=!1}=l;if(i&&!c||d)continue;let h=g.width??l.width??l.initialWidth??null,p=g.height??l.height??l.initialHeight??null,y=$e(a,_e(l)),m=(h??0)*(p??0),x=s&&y>0;(!l.internals.handleBounds||x||y>=m||l.dragging)&&f.push(l)}return f},Bn=(e,t)=>{let n=new Set;return e.forEach(o=>{n.add(o.id)}),t.filter(o=>n.has(o.source)||n.has(o.target))};function Ls(e,t){let n=new Map,o=t?.nodes?new Set(t.nodes.map(r=>r.id)):null;return e.forEach(r=>{r.measured.width&&r.measured.height&&(t?.includeHiddenNodes||!r.hidden)&&(!o||o.has(r.id))&&n.set(r.id,r)}),n}async function Vn({nodes:e,width:t,height:n,panZoom:o,minZoom:r,maxZoom:s},i){if(e.size===0)return Promise.resolve(!0);let a=Ls(e,i),f=Ae(a),l=qe(f,t,n,i?.minZoom??r,i?.maxZoom??s,i?.padding??.1);return await o.setViewport(l,{duration:i?.duration,ease:i?.ease,interpolate:i?.interpolate}),Promise.resolve(!0)}function Xt({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:o=[0,0],nodeExtent:r,onError:s}){let i=n.get(e),a=i.parentId?n.get(i.parentId):void 0,{x:f,y:l}=a?a.internals.positionAbsolute:{x:0,y:0},g=i.origin??o,c=i.extent||r;if(i.extent==="parent"&&!i.expandParent)if(!a)s?.("005",ae.error005());else{let h=a.measured.width,p=a.measured.height;h&&p&&(c=[[f,l],[f+h,l+p]])}else a&&ze(i.extent)&&(c=[[i.extent[0][0]+f,i.extent[0][1]+l],[i.extent[1][0]+f,i.extent[1][1]+l]]);let d=ze(c)?ve(t,c,i.measured):t;return(i.measured.width===void 0||i.measured.height===void 0)&&s?.("015",ae.error015()),{position:{x:d.x-f+(i.measured.width??0)*g[0],y:d.y-l+(i.measured.height??0)*g[1]},positionAbsolute:d}}async function Fn({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:o,onBeforeDelete:r}){let s=new Set(e.map(d=>d.id)),i=[];for(let d of n){if(d.deletable===!1)continue;let h=s.has(d.id),p=!h&&d.parentId&&i.find(y=>y.id===d.parentId);(h||p)&&i.push(d)}let a=new Set(t.map(d=>d.id)),f=o.filter(d=>d.deletable!==!1),g=Bn(i,f);for(let d of f)a.has(d.id)&&!g.find(p=>p.id===d.id)&&g.push(d);if(!r)return{edges:g,nodes:i};let c=await r({nodes:i,edges:g});return typeof c=="boolean"?c?{edges:g,nodes:i}:{edges:[],nodes:[]}:c}var Pe=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),ve=(e={x:0,y:0},t,n)=>({x:Pe(e.x,t[0][0],t[1][0]-(n?.width??0)),y:Pe(e.y,t[0][1],t[1][1]-(n?.height??0))});function Yn(e,t,n){let{width:o,height:r}=ue(n),{x:s,y:i}=n.internals.positionAbsolute;return ve(e,[[s,i],[s+o,i+r]],t)}var kn=(e,t,n)=>e<t?Pe(Math.abs(e-t),1,t)/t:e>n?-Pe(Math.abs(e-n),1,t)/t:0,Zn=(e,t,n=15,o=40)=>{let r=kn(e.x,o,t.width-o)*n,s=kn(e.y,o,t.height-o)*n;return[r,s]},at=(e,t)=>({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)}),Lt=({x:e,y:t,width:n,height:o})=>({x:e,y:t,x2:e+n,y2:t+o}),ct=({x:e,y:t,x2:n,y2:o})=>({x:e,y:t,width:n-e,height:o-t}),_e=(e,t=[0,0])=>{let{x:n,y:o}=Yt(e)?e.internals.positionAbsolute:Ge(e,t);return{x:n,y:o,width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}},st=(e,t=[0,0])=>{let{x:n,y:o}=Yt(e)?e.internals.positionAbsolute:Ge(e,t);return{x:n,y:o,x2:n+(e.measured?.width??e.width??e.initialWidth??0),y2:o+(e.measured?.height??e.height??e.initialHeight??0)}},Wt=(e,t)=>ct(at(Lt(e),Lt(t))),$e=(e,t)=>{let 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)},Kt=e=>ce(e.width)&&ce(e.height)&&ce(e.x)&&ce(e.y),ce=e=>!isNaN(e)&&isFinite(e),Gt=(e,t)=>{},He=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),Oe=({x:e,y:t},[n,o,r],s=!1,i=[1,1])=>{let a={x:(e-n)/r,y:(t-o)/r};return s?He(a,i):a},Ke=({x:e,y:t},[n,o,r])=>({x:e*r+n,y:t*r+o});function ke(e,t){if(typeof e=="number")return Math.floor((t-t/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){let n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(n)}if(typeof e=="string"&&e.endsWith("%")){let n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return console.error(`[React Flow] The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function Ts(e,t,n){if(typeof e=="string"||typeof e=="number"){let o=ke(e,n),r=ke(e,t);return{top:o,right:r,bottom:o,left:r,x:r*2,y:o*2}}if(typeof e=="object"){let o=ke(e.top??e.y??0,n),r=ke(e.bottom??e.y??0,n),s=ke(e.left??e.x??0,t),i=ke(e.right??e.x??0,t);return{top:o,right:i,bottom:r,left:s,x:s+i,y:o+r}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function Rs(e,t,n,o,r,s){let{x:i,y:a}=Ke(e,[t,n,o]),{x:f,y:l}=Ke({x:e.x+e.width,y:e.y+e.height},[t,n,o]),g=r-f,c=s-l;return{left:Math.floor(i),top:Math.floor(a),right:Math.floor(g),bottom:Math.floor(c)}}var qe=(e,t,n,o,r,s)=>{let i=Ts(s,t,n),a=(t-i.x)/e.width,f=(n-i.y)/e.height,l=Math.min(a,f),g=Pe(l,o,r),c=e.x+e.width/2,d=e.y+e.height/2,h=t/2-c*g,p=n/2-d*g,y=Rs(e,h,p,g,t,n),m={left:Math.min(y.left-i.left,0),top:Math.min(y.top-i.top,0),right:Math.min(y.right-i.right,0),bottom:Math.min(y.bottom-i.bottom,0)};return{x:h-m.left+m.right,y:p-m.top+m.bottom,zoom:g}},Le=()=>typeof navigator<"u"&&navigator?.userAgent?.indexOf("Mac")>=0;function ze(e){return e!=null&&e!=="parent"}function ue(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function lt(e){return(e.measured?.width??e.width??e.initialWidth)!==void 0&&(e.measured?.height??e.height??e.initialHeight)!==void 0}function qt(e,t={width:0,height:0},n,o,r){let s={...e},i=o.get(n);if(i){let a=i.origin||r;s.x+=i.internals.positionAbsolute.x-(t.width??0)*a[0],s.y+=i.internals.positionAbsolute.y-(t.height??0)*a[1]}return s}function Ut(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function Xn(){let e,t;return{promise:new Promise((o,r)=>{e=o,t=r}),resolve:e,reject:t}}function Wn(e){return{...Rt,...e||{}}}function We(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:o,containerBounds:r}){let{x:s,y:i}=le(e),a=Oe({x:s-(r?.left??0),y:i-(r?.top??0)},o),{x:f,y:l}=n?He(a,t):a;return{xSnapped:f,ySnapped:l,...a}}var dt=e=>({width:e.offsetWidth,height:e.offsetHeight}),Qt=e=>e?.getRootNode?.()||window?.document,Bs=["INPUT","SELECT","TEXTAREA"];function jt(e){let t=e.composedPath?.()?.[0]||e.target;return t?.nodeType!==1?!1:Bs.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}var Jt=e=>"clientX"in e,le=(e,t)=>{let n=Jt(e),o=n?e.clientX:e.touches?.[0].clientX,r=n?e.clientY:e.touches?.[0].clientY;return{x:o-(t?.left??0),y:r-(t?.top??0)}},Mn=(e,t,n,o,r)=>{let s=t.querySelectorAll(`.${e}`);return!s||!s.length?null:Array.from(s).map(i=>{let a=i.getBoundingClientRect();return{id:i.getAttribute("data-handleid"),type:e,nodeId:r,position:i.getAttribute("data-handlepos"),x:(a.left-n.left)/o,y:(a.top-n.top)/o,...dt(i)}})};function ut({sourceX:e,sourceY:t,targetX:n,targetY:o,sourceControlX:r,sourceControlY:s,targetControlX:i,targetControlY:a}){let f=e*.125+r*.375+i*.375+n*.125,l=t*.125+s*.375+a*.375+o*.125,g=Math.abs(f-e),c=Math.abs(l-t);return[f,l,g,c]}function ot(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function In({pos:e,x1:t,y1:n,x2:o,y2:r,c:s}){switch(e){case F.Left:return[t-ot(t-o,s),n];case F.Right:return[t+ot(o-t,s),n];case F.Top:return[t,n-ot(n-r,s)];case F.Bottom:return[t,n+ot(r-n,s)]}}function ft({sourceX:e,sourceY:t,sourcePosition:n=F.Bottom,targetX:o,targetY:r,targetPosition:s=F.Top,curvature:i=.25}){let[a,f]=In({pos:n,x1:e,y1:t,x2:o,y2:r,c:i}),[l,g]=In({pos:s,x1:o,y1:r,x2:e,y2:t,c:i}),[c,d,h,p]=ut({sourceX:e,sourceY:t,targetX:o,targetY:r,sourceControlX:a,sourceControlY:f,targetControlX:l,targetControlY:g});return[`M${e},${t} C${a},${f} ${l},${g} ${o},${r}`,c,d,h,p]}function en({sourceX:e,sourceY:t,targetX:n,targetY:o}){let r=Math.abs(n-e)/2,s=n<e?n+r:n-r,i=Math.abs(o-t)/2,a=o<t?o+i:o-i;return[s,a,r,i]}function Kn({sourceNode:e,targetNode:t,selected:n=!1,zIndex:o=0,elevateOnSelect:r=!1,zIndexMode:s="basic"}){if(s==="manual")return o;let i=r&&n?o+1e3:o,a=Math.max(e.parentId||r&&e.selected?e.internals.z:0,t.parentId||r&&t.selected?t.internals.z:0);return i+a}function Gn({sourceNode:e,targetNode:t,width:n,height:o,transform:r}){let s=at(st(e),st(t));s.x===s.x2&&(s.x2+=1),s.y===s.y2&&(s.y2+=1);let i={x:-r[0]/r[2],y:-r[1]/r[2],width:n/r[2],height:o/r[2]};return $e(i,ct(s))>0}var Vs=({source:e,sourceHandle:t,target:n,targetHandle:o})=>`xy-edge__${e}${t||""}-${n}${o||""}`,Fs=(e,t)=>t.some(n=>n.source===e.source&&n.target===e.target&&(n.sourceHandle===e.sourceHandle||!n.sourceHandle&&!e.sourceHandle)&&(n.targetHandle===e.targetHandle||!n.targetHandle&&!e.targetHandle)),tn=(e,t,n={})=>{if(!e.source||!e.target)return Gt("006",ae.error006()),t;let o=n.getEdgeId||Vs,r;return Ft(e)?r={...e}:r={...e,id:o(e)},Fs(r,t)?t:(r.sourceHandle===null&&delete r.sourceHandle,r.targetHandle===null&&delete r.targetHandle,t.concat(r))};function gt({sourceX:e,sourceY:t,targetX:n,targetY:o}){let[r,s,i,a]=en({sourceX:e,sourceY:t,targetX:n,targetY:o});return[`M ${e},${t}L ${n},${o}`,r,s,i,a]}var Pn={[F.Left]:{x:-1,y:0},[F.Right]:{x:1,y:0},[F.Top]:{x:0,y:-1},[F.Bottom]:{x:0,y:1}},Ys=({source:e,sourcePosition:t=F.Bottom,target:n})=>t===F.Left||t===F.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},zn=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function Zs({source:e,sourcePosition:t=F.Bottom,target:n,targetPosition:o=F.Top,center:r,offset:s,stepPosition:i}){let a=Pn[t],f=Pn[o],l={x:e.x+a.x*s,y:e.y+a.y*s},g={x:n.x+f.x*s,y:n.y+f.y*s},c=Ys({source:l,sourcePosition:t,target:g}),d=c.x!==0?"x":"y",h=c[d],p=[],y,m,x={x:0,y:0},b={x:0,y:0},[,,u,w]=en({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(a[d]*f[d]===-1){d==="x"?(y=r.x??l.x+(g.x-l.x)*i,m=r.y??(l.y+g.y)/2):(y=r.x??(l.x+g.x)/2,m=r.y??l.y+(g.y-l.y)*i);let S=[{x:y,y:l.y},{x:y,y:g.y}],_=[{x:l.x,y:m},{x:g.x,y:m}];a[d]===h?p=d==="x"?S:_:p=d==="x"?_:S}else{let S=[{x:l.x,y:g.y}],_=[{x:g.x,y:l.y}];if(d==="x"?p=a.x===h?_:S:p=a.y===h?S:_,t===o){let M=Math.abs(e[d]-n[d]);if(M<=s){let A=Math.min(s-1,s-M);a[d]===h?x[d]=(l[d]>e[d]?-1:1)*A:b[d]=(g[d]>n[d]?-1:1)*A}}if(t!==o){let M=d==="x"?"y":"x",A=a[d]===f[M],H=l[M]>g[M],z=l[M]<g[M];(a[d]===1&&(!A&&H||A&&z)||a[d]!==1&&(!A&&z||A&&H))&&(p=d==="x"?S:_)}let I={x:l.x+x.x,y:l.y+x.y},k={x:g.x+b.x,y:g.y+b.y},R=Math.max(Math.abs(I.x-p[0].x),Math.abs(k.x-p[0].x)),C=Math.max(Math.abs(I.y-p[0].y),Math.abs(k.y-p[0].y));R>=C?(y=(I.x+k.x)/2,m=p[0].y):(y=p[0].x,m=(I.y+k.y)/2)}return[[e,{x:l.x+x.x,y:l.y+x.y},...p,{x:g.x+b.x,y:g.y+b.y},n],y,m,u,w]}function Xs(e,t,n,o){let r=Math.min(zn(e,t)/2,zn(t,n)/2,o),{x:s,y:i}=t;if(e.x===s&&s===n.x||e.y===i&&i===n.y)return`L${s} ${i}`;if(e.y===i){let l=e.x<n.x?-1:1,g=e.y<n.y?1:-1;return`L ${s+r*l},${i}Q ${s},${i} ${s},${i+r*g}`}let a=e.x<n.x?1:-1,f=e.y<n.y?-1:1;return`L ${s},${i+r*f}Q ${s},${i} ${s+r*a},${i}`}function Ue({sourceX:e,sourceY:t,sourcePosition:n=F.Bottom,targetX:o,targetY:r,targetPosition:s=F.Top,borderRadius:i=5,centerX:a,centerY:f,offset:l=20,stepPosition:g=.5}){let[c,d,h,p,y]=Zs({source:{x:e,y:t},sourcePosition:n,target:{x:o,y:r},targetPosition:s,center:{x:a,y:f},offset:l,stepPosition:g});return[c.reduce((x,b,u)=>{let w="";return u>0&&u<c.length-1?w=Xs(c[u-1],b,c[u+1],i):w=`${u===0?"M":"L"}${b.x} ${b.y}`,x+=w,x},""),d,h,p,y]}function Dn(e){return e&&!!(e.internals.handleBounds||e.handles?.length)&&!!(e.measured.width||e.width||e.initialWidth)}function qn(e){let{sourceNode:t,targetNode:n}=e;if(!Dn(t)||!Dn(n))return null;let o=t.internals.handleBounds||An(t.handles),r=n.internals.handleBounds||An(n.handles),s=$n(o?.source??[],e.sourceHandle),i=$n(e.connectionMode===ye.Strict?r?.target??[]:(r?.target??[]).concat(r?.source??[]),e.targetHandle);if(!s||!i)return e.onError?.("008",ae.error008(s?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;let a=s?.position||F.Bottom,f=i?.position||F.Top,l=xe(t,s,a),g=xe(n,i,f);return{sourceX:l.x,sourceY:l.y,targetX:g.x,targetY:g.y,sourcePosition:a,targetPosition:f}}function An(e){if(!e)return null;let t=[],n=[];for(let o of e)o.width=o.width??1,o.height=o.height??1,o.type==="source"?t.push(o):o.type==="target"&&n.push(o);return{source:t,target:n}}function xe(e,t,n=F.Left,o=!1){let r=(t?.x??0)+e.internals.positionAbsolute.x,s=(t?.y??0)+e.internals.positionAbsolute.y,{width:i,height:a}=t??ue(e);if(o)return{x:r+i/2,y:s+a/2};switch(t?.position??n){case F.Top:return{x:r+i/2,y:s};case F.Right:return{x:r+i,y:s+a/2};case F.Bottom:return{x:r+i/2,y:s+a};case F.Left:return{x:r,y:s+a/2}}}function $n(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}function pt(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(o=>`${o}=${e[o]}`).join("&")}`:""}function Un(e,{id:t,defaultColor:n,defaultMarkerStart:o,defaultMarkerEnd:r}){let s=new Set;return e.reduce((i,a)=>([a.markerStart||o,a.markerEnd||r].forEach(f=>{if(f&&typeof f=="object"){let l=pt(f,t);s.has(l)||(i.push({id:l,color:f.color||n,...f}),s.add(l))}}),i),[]).sort((i,a)=>i.id.localeCompare(a.id))}var Qn=1e3,Ws=10,nn={nodeOrigin:[0,0],nodeExtent:De,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},Ks={...nn,checkEquality:!0};function on(e,t){let n={...e};for(let o in t)t[o]!==void 0&&(n[o]=t[o]);return n}function jn(e,t,n){let o=on(nn,n);for(let r of e.values())if(r.parentId)sn(r,e,t,o);else{let s=Ge(r,o.nodeOrigin),i=ze(r.extent)?r.extent:o.nodeExtent,a=ve(s,i,ue(r));r.internals.positionAbsolute=a}}function Gs(e,t){if(!e.handles)return e.measured?t?.internals.handleBounds:void 0;let n=[],o=[];for(let r of e.handles){let s={id:r.id,width:r.width??1,height:r.height??1,nodeId:e.id,x:r.x,y:r.y,position:r.position,type:r.type};r.type==="source"?n.push(s):r.type==="target"&&o.push(s)}return{source:n,target:o}}function rn(e){return e==="manual"}function ht(e,t,n,o={}){let r=on(Ks,o),s={i:0},i=new Map(t),a=r?.elevateNodesOnSelect&&!rn(r.zIndexMode)?Qn:0,f=e.length>0;t.clear(),n.clear();for(let l of e){let g=i.get(l.id);if(r.checkEquality&&l===g?.internals.userNode)t.set(l.id,g);else{let c=Ge(l,r.nodeOrigin),d=ze(l.extent)?l.extent:r.nodeExtent,h=ve(c,d,ue(l));g={...r.defaults,...l,measured:{width:l.measured?.width,height:l.measured?.height},internals:{positionAbsolute:h,handleBounds:Gs(l,g),z:Jn(l,a,r.zIndexMode),userNode:l}},t.set(l.id,g)}(g.measured===void 0||g.measured.width===void 0||g.measured.height===void 0)&&!g.hidden&&(f=!1),l.parentId&&sn(g,t,n,o,s)}return f}function qs(e,t){if(!e.parentId)return;let n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function sn(e,t,n,o,r){let{elevateNodesOnSelect:s,nodeOrigin:i,nodeExtent:a,zIndexMode:f}=on(nn,o),l=e.parentId,g=t.get(l);if(!g){console.warn(`Parent node ${l} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}qs(e,n),r&&!g.parentId&&g.internals.rootParentIndex===void 0&&f==="auto"&&(g.internals.rootParentIndex=++r.i,g.internals.z=g.internals.z+r.i*Ws),r&&g.internals.rootParentIndex!==void 0&&(r.i=g.internals.rootParentIndex);let c=s&&!rn(f)?Qn:0,{x:d,y:h,z:p}=Us(e,g,i,a,c,f),{positionAbsolute:y}=e.internals,m=d!==y.x||h!==y.y;(m||p!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:m?{x:d,y:h}:y,z:p}})}function Jn(e,t,n){let o=ce(e.zIndex)?e.zIndex:0;return rn(n)?o:o+(e.selected?t:0)}function Us(e,t,n,o,r,s){let{x:i,y:a}=t.internals.positionAbsolute,f=ue(e),l=Ge(e,n),g=ze(e.extent)?ve(l,e.extent,f):l,c=ve({x:i+g.x,y:a+g.y},o,f);e.extent==="parent"&&(c=Yn(c,f,t));let d=Jn(e,r,s),h=t.internals.z??0;return{x:c.x,y:c.y,z:h>=d?h+1:d}}function mt(e,t,n,o=[0,0]){let r=[],s=new Map;for(let i of e){let a=t.get(i.parentId);if(!a)continue;let f=s.get(i.parentId)?.expandedRect??_e(a),l=Wt(f,i.rect);s.set(i.parentId,{expandedRect:l,parent:a})}return s.size>0&&s.forEach(({expandedRect:i,parent:a},f)=>{let l=a.internals.positionAbsolute,g=ue(a),c=a.origin??o,d=i.x<l.x?Math.round(Math.abs(l.x-i.x)):0,h=i.y<l.y?Math.round(Math.abs(l.y-i.y)):0,p=Math.max(g.width,Math.round(i.width)),y=Math.max(g.height,Math.round(i.height)),m=(p-g.width)*c[0],x=(y-g.height)*c[1];(d>0||h>0||m||x)&&(r.push({id:f,type:"position",position:{x:a.position.x-d+m,y:a.position.y-h+x}}),n.get(f)?.forEach(b=>{e.some(u=>u.id===b.id)||r.push({id:b.id,type:"position",position:{x:b.position.x+d,y:b.position.y+h}})})),(g.width<i.width||g.height<i.height||d||h)&&r.push({id:f,type:"dimensions",setAttributes:!0,dimensions:{width:p+(d?c[0]*d-m:0),height:y+(h?c[1]*h-x:0)}})}),r}function eo(e,t,n,o,r,s,i){let a=o?.querySelector(".xyflow__viewport"),f=!1;if(!a)return{changes:[],updatedInternals:f};let l=[],g=window.getComputedStyle(a),{m22:c}=new window.DOMMatrixReadOnly(g.transform),d=[];for(let h of e.values()){let p=t.get(h.id);if(!p)continue;if(p.hidden){t.set(p.id,{...p,internals:{...p.internals,handleBounds:void 0}}),f=!0;continue}let y=dt(h.nodeElement),m=p.measured.width!==y.width||p.measured.height!==y.height;if(!!(y.width&&y.height&&(m||!p.internals.handleBounds||h.force))){let b=h.nodeElement.getBoundingClientRect(),u=ze(p.extent)?p.extent:s,{positionAbsolute:w}=p.internals;p.parentId&&p.extent==="parent"?w=Yn(w,y,t.get(p.parentId)):u&&(w=ve(w,u,y));let N={...p,measured:y,internals:{...p.internals,positionAbsolute:w,handleBounds:{source:Mn("source",h.nodeElement,b,c,p.id),target:Mn("target",h.nodeElement,b,c,p.id)}}};t.set(p.id,N),p.parentId&&sn(N,t,n,{nodeOrigin:r,zIndexMode:i}),f=!0,m&&(l.push({id:p.id,type:"dimensions",dimensions:y}),p.expandParent&&p.parentId&&d.push({id:p.id,parentId:p.parentId,rect:_e(N,r)}))}}if(d.length>0){let h=mt(d,t,n,r);l.push(...h)}return{changes:l,updatedInternals:f}}async function to({delta:e,panZoom:t,transform:n,translateExtent:o,width:r,height:s}){if(!t||!e.x&&!e.y)return Promise.resolve(!1);let i=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[r,s]],o),a=!!i&&(i.x!==n[0]||i.y!==n[1]||i.k!==n[2]);return Promise.resolve(a)}function Hn(e,t,n,o,r,s){let i=r,a=o.get(i)||new Map;o.set(i,a.set(n,t)),i=`${r}-${e}`;let f=o.get(i)||new Map;if(o.set(i,f.set(n,t)),s){i=`${r}-${e}-${s}`;let l=o.get(i)||new Map;o.set(i,l.set(n,t))}}function an(e,t,n){e.clear(),t.clear();for(let o of n){let{source:r,target:s,sourceHandle:i=null,targetHandle:a=null}=o,f={edgeId:o.id,source:r,target:s,sourceHandle:i,targetHandle:a},l=`${r}-${i}--${s}-${a}`,g=`${s}-${a}--${r}-${i}`;Hn("source",f,g,e,r,i),Hn("target",f,l,e,s,a),t.set(o.id,o)}}function no(e,t){if(!e.parentId)return!1;let n=t.get(e.parentId);return n?n.selected?!0:no(n,t):!1}function On(e,t,n){let o=e;do{if(o?.matches?.(t))return!0;if(o===n)return!1;o=o?.parentElement}while(o);return!1}function Qs(e,t,n,o){let r=new Map;for(let[s,i]of e)if((i.selected||i.id===o)&&(!i.parentId||!no(i,e))&&(i.draggable||t&&typeof i.draggable>"u")){let a=e.get(s);a&&r.set(s,{id:s,position:a.position||{x:0,y:0},distance:{x:n.x-a.internals.positionAbsolute.x,y:n.y-a.internals.positionAbsolute.y},extent:a.extent,parentId:a.parentId,origin:a.origin,expandParent:a.expandParent,internals:{positionAbsolute:a.internals.positionAbsolute||{x:0,y:0}},measured:{width:a.measured.width??0,height:a.measured.height??0}})}return r}function $t({nodeId:e,dragItems:t,nodeLookup:n,dragging:o=!0}){let r=[];for(let[i,a]of t){let f=n.get(i)?.internals.userNode;f&&r.push({...f,position:a.position,dragging:o})}if(!e)return[r[0],r];let s=n.get(e)?.internals.userNode;return[s?{...s,position:t.get(e)?.position||s.position,dragging:o}:r[0],r]}function js({dragItems:e,snapGrid:t,x:n,y:o}){let r=e.values().next().value;if(!r)return null;let s={x:n-r.distance.x,y:o-r.distance.y},i=He(s,t);return{x:i.x-s.x,y:i.y-s.y}}function oo({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:o,onDragStop:r}){let s={x:null,y:null},i=0,a=new Map,f=!1,l={x:0,y:0},g=null,c=!1,d=null,h=!1,p=!1,y=null;function m({noDragClassName:b,handleSelector:u,domNode:w,isSelectable:N,nodeId:S,nodeClickDistance:_=0}){d=Xe(w);function I({x:M,y:A}){let{nodeLookup:H,nodeExtent:z,snapGrid:O,snapToGrid:$,nodeOrigin:P,onNodeDrag:D,onSelectionDrag:V,onError:B,updateNodePositions:L}=t();s={x:M,y:A};let Y=!1,X=a.size>1,U=X&&z?Lt(Ae(a)):null,J=X&&$?js({dragItems:a,snapGrid:O,x:M,y:A}):null;for(let[G,T]of a){if(!H.has(G))continue;let Z={x:M-T.distance.x,y:A-T.distance.y};$&&(Z=J?{x:Math.round(Z.x+J.x),y:Math.round(Z.y+J.y)}:He(Z,O));let Q=null;if(X&&z&&!T.extent&&U){let{positionAbsolute:K}=T.internals,ee=K.x-U.x+z[0][0],oe=K.x+T.measured.width-U.x2+z[1][0],te=K.y-U.y+z[0][1],ie=K.y+T.measured.height-U.y2+z[1][1];Q=[[ee,te],[oe,ie]]}let{position:q,positionAbsolute:W}=Xt({nodeId:G,nextPosition:Z,nodeLookup:H,nodeExtent:Q||z,nodeOrigin:P,onError:B});Y=Y||T.position.x!==q.x||T.position.y!==q.y,T.position=q,T.internals.positionAbsolute=W}if(p=p||Y,!!Y&&(L(a,!0),y&&(o||D||!S&&V))){let[G,T]=$t({nodeId:S,dragItems:a,nodeLookup:H});o?.(y,a,G,T),D?.(y,G,T),S||V?.(y,T)}}async function k(){if(!g)return;let{transform:M,panBy:A,autoPanSpeed:H,autoPanOnNodeDrag:z}=t();if(!z){f=!1,cancelAnimationFrame(i);return}let[O,$]=Zn(l,g,H);(O!==0||$!==0)&&(s.x=(s.x??0)-O/M[2],s.y=(s.y??0)-$/M[2],await A({x:O,y:$})&&I(s)),i=requestAnimationFrame(k)}function R(M){let{nodeLookup:A,multiSelectionActive:H,nodesDraggable:z,transform:O,snapGrid:$,snapToGrid:P,selectNodesOnDrag:D,onNodeDragStart:V,onSelectionDragStart:B,unselectNodesAndEdges:L}=t();c=!0,(!D||!N)&&!H&&S&&(A.get(S)?.selected||L()),N&&D&&S&&e?.(S);let Y=We(M.sourceEvent,{transform:O,snapGrid:$,snapToGrid:P,containerBounds:g});if(s=Y,a=Qs(A,z,Y,S),a.size>0&&(n||V||!S&&B)){let[X,U]=$t({nodeId:S,dragItems:a,nodeLookup:A});n?.(M.sourceEvent,a,X,U),V?.(M.sourceEvent,X,U),S||B?.(M.sourceEvent,U)}}let C=Dt().clickDistance(_).on("start",M=>{let{domNode:A,nodeDragThreshold:H,transform:z,snapGrid:O,snapToGrid:$}=t();g=A?.getBoundingClientRect()||null,h=!1,p=!1,y=M.sourceEvent,H===0&&R(M),s=We(M.sourceEvent,{transform:z,snapGrid:O,snapToGrid:$,containerBounds:g}),l=le(M.sourceEvent,g)}).on("drag",M=>{let{autoPanOnNodeDrag:A,transform:H,snapGrid:z,snapToGrid:O,nodeDragThreshold:$,nodeLookup:P}=t(),D=We(M.sourceEvent,{transform:H,snapGrid:z,snapToGrid:O,containerBounds:g});if(y=M.sourceEvent,(M.sourceEvent.type==="touchmove"&&M.sourceEvent.touches.length>1||S&&!P.has(S))&&(h=!0),!h){if(!f&&A&&c&&(f=!0,k()),!c){let V=le(M.sourceEvent,g),B=V.x-l.x,L=V.y-l.y;Math.sqrt(B*B+L*L)>$&&R(M)}(s.x!==D.xSnapped||s.y!==D.ySnapped)&&a&&c&&(l=le(M.sourceEvent,g),I(D))}}).on("end",M=>{if(!(!c||h)&&(f=!1,c=!1,cancelAnimationFrame(i),a.size>0)){let{nodeLookup:A,updateNodePositions:H,onNodeDragStop:z,onSelectionDragStop:O}=t();if(p&&(H(a,!1),p=!1),r||z||!S&&O){let[$,P]=$t({nodeId:S,dragItems:a,nodeLookup:A,dragging:!1});r?.(M.sourceEvent,a,$,P),z?.(M.sourceEvent,$,P),S||O?.(M.sourceEvent,P)}}}).filter(M=>{let A=M.target;return!M.button&&(!b||!On(A,`.${b}`,w))&&(!u||On(A,u,w))});d.call(C)}function x(){d?.on(".drag",null)}return{update:m,destroy:x}}function Js(e,t,n){let o=[],r={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(let s of t.values())$e(r,_e(s))>0&&o.push(s);return o}var ei=250;function ti(e,t,n,o){let r=[],s=1/0,i=Js(e,n,t+ei);for(let a of i){let f=[...a.internals.handleBounds?.source??[],...a.internals.handleBounds?.target??[]];for(let l of f){if(o.nodeId===l.nodeId&&o.type===l.type&&o.id===l.id)continue;let{x:g,y:c}=xe(a,l,l.position,!0),d=Math.sqrt(Math.pow(g-e.x,2)+Math.pow(c-e.y,2));d>t||(d<s?(r=[{...l,x:g,y:c}],s=d):d===s&&r.push({...l,x:g,y:c}))}}if(!r.length)return null;if(r.length>1){let a=o.type==="source"?"target":"source";return r.find(f=>f.type===a)??r[0]}return r[0]}function ro(e,t,n,o,r,s=!1){let i=o.get(e);if(!i)return null;let a=r==="strict"?i.internals.handleBounds?.[t]:[...i.internals.handleBounds?.source??[],...i.internals.handleBounds?.target??[]],f=(n?a?.find(l=>l.id===n):a?.[0])??null;return f&&s?{...f,...xe(i,f,f.position,!0)}:f}function so(e,t){return e||(t?.classList.contains("target")?"target":t?.classList.contains("source")?"source":null)}function ni(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}var io=()=>!0;function oi(e,{connectionMode:t,connectionRadius:n,handleId:o,nodeId:r,edgeUpdaterType:s,isTarget:i,domNode:a,nodeLookup:f,lib:l,autoPanOnConnect:g,flowId:c,panBy:d,cancelConnection:h,onConnectStart:p,onConnect:y,onConnectEnd:m,isValidConnection:x=io,onReconnectEnd:b,updateConnection:u,getTransform:w,getFromHandle:N,autoPanSpeed:S,dragThreshold:_=1,handleDomNode:I}){let k=Qt(e.target),R=0,C,{x:M,y:A}=le(e),H=so(s,I),z=a?.getBoundingClientRect(),O=!1;if(!z||!H)return;let $=ro(r,H,o,f,t);if(!$)return;let P=le(e,z),D=!1,V=null,B=!1,L=null;function Y(){if(!g||!z)return;let[q,W]=Zn(P,z,S);d({x:q,y:W}),R=requestAnimationFrame(Y)}let X={...$,nodeId:r,type:H,position:$.position},U=f.get(r),G={inProgress:!0,isValid:null,from:xe(U,X,F.Left,!0),fromHandle:X,fromPosition:X.position,fromNode:U,to:P,toHandle:null,toPosition:Nn[X.position],toNode:null,pointer:P};function T(){O=!0,u(G),p?.(e,{nodeId:r,handleId:o,handleType:H})}_===0&&T();function Z(q){if(!O){let{x:ie,y:pe}=le(q),fe=ie-M,Ee=pe-A;if(!(fe*fe+Ee*Ee>_*_))return;T()}if(!N()||!X){Q(q);return}let W=w();P=le(q,z),C=ti(Oe(P,W,!1,[1,1]),n,f,X),D||(Y(),D=!0);let K=ao(q,{handle:C,connectionMode:t,fromNodeId:r,fromHandleId:o,fromType:i?"target":"source",isValidConnection:x,doc:k,lib:l,flowId:c,nodeLookup:f});L=K.handleDomNode,V=K.connection,B=ni(!!C,K.isValid);let ee=f.get(r),oe=ee?xe(ee,X,F.Left,!0):G.from,te={...G,from:oe,isValid:B,to:K.toHandle&&B?Ke({x:K.toHandle.x,y:K.toHandle.y},W):P,toHandle:K.toHandle,toPosition:B&&K.toHandle?K.toHandle.position:Nn[X.position],toNode:K.toHandle?f.get(K.toHandle.nodeId):null,pointer:P};u(te),G=te}function Q(q){if(!("touches"in q&&q.touches.length>0)){if(O){(C||L)&&V&&B&&y?.(V);let{inProgress:W,...K}=G,ee={...K,toPosition:G.toHandle?G.toPosition:null};m?.(q,ee),s&&b?.(q,ee)}h(),cancelAnimationFrame(R),D=!1,B=!1,V=null,L=null,k.removeEventListener("mousemove",Z),k.removeEventListener("mouseup",Q),k.removeEventListener("touchmove",Z),k.removeEventListener("touchend",Q)}}k.addEventListener("mousemove",Z),k.addEventListener("mouseup",Q),k.addEventListener("touchmove",Z),k.addEventListener("touchend",Q)}function ao(e,{handle:t,connectionMode:n,fromNodeId:o,fromHandleId:r,fromType:s,doc:i,lib:a,flowId:f,isValidConnection:l=io,nodeLookup:g}){let c=s==="target",d=t?i.querySelector(`.${a}-flow__handle[data-id="${f}-${t?.nodeId}-${t?.id}-${t?.type}"]`):null,{x:h,y:p}=le(e),y=i.elementFromPoint(h,p),m=y?.classList.contains(`${a}-flow__handle`)?y:d,x={handleDomNode:m,isValid:!1,connection:null,toHandle:null};if(m){let b=so(void 0,m),u=m.getAttribute("data-nodeid"),w=m.getAttribute("data-handleid"),N=m.classList.contains("connectable"),S=m.classList.contains("connectableend");if(!u||!b)return x;let _={source:c?u:o,sourceHandle:c?w:r,target:c?o:u,targetHandle:c?r:w};x.connection=_;let k=N&&S&&(n===ye.Strict?c&&b==="source"||!c&&b==="target":u!==o||w!==r);x.isValid=k&&l(_),x.toHandle=ro(u,b,w,g,n,!0)}return x}var yt={onPointerDown:oi,isValid:ao};function co({domNode:e,panZoom:t,getTransform:n,getViewScale:o}){let r=Xe(e);function s({translateExtent:a,width:f,height:l,zoomStep:g=1,pannable:c=!0,zoomable:d=!0,inversePan:h=!1}){let p=u=>{if(u.sourceEvent.type!=="wheel"||!t)return;let w=n(),N=u.sourceEvent.ctrlKey&&Le()?10:1,S=-u.sourceEvent.deltaY*(u.sourceEvent.deltaMode===1?.05:u.sourceEvent.deltaMode?1:.002)*g,_=w[2]*Math.pow(2,S*N);t.scaleTo(_)},y=[0,0],m=u=>{(u.sourceEvent.type==="mousedown"||u.sourceEvent.type==="touchstart")&&(y=[u.sourceEvent.clientX??u.sourceEvent.touches[0].clientX,u.sourceEvent.clientY??u.sourceEvent.touches[0].clientY])},x=u=>{let w=n();if(u.sourceEvent.type!=="mousemove"&&u.sourceEvent.type!=="touchmove"||!t)return;let N=[u.sourceEvent.clientX??u.sourceEvent.touches[0].clientX,u.sourceEvent.clientY??u.sourceEvent.touches[0].clientY],S=[N[0]-y[0],N[1]-y[1]];y=N;let _=o()*Math.max(w[2],Math.log(w[2]))*(h?-1:1),I={x:w[0]-S[0]*_,y:w[1]-S[1]*_},k=[[0,0],[f,l]];t.setViewportConstrained({x:I.x,y:I.y,zoom:w[2]},k,a)},b=At().on("start",m).on("zoom",c?x:null).on("zoom.wheel",d?p:null);r.call(b,{})}function i(){r.on("zoom",null)}return{update:s,destroy:i,pointer:zt}}var xt=e=>({x:e.x,y:e.y,zoom:e.k}),Ht=({x:e,y:t,zoom:n})=>_n.translate(e,t).scale(n),Me=(e,t)=>e.target.closest(`.${t}`),lo=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),ri=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,Ot=(e,t=0,n=ri,o=()=>{})=>{let r=typeof t=="number"&&t>0;return r||o(),r?e.transition().duration(t).ease(n).on("end",o):e},uo=e=>{let t=e.ctrlKey&&Le()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function si({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:o,panOnScrollMode:r,panOnScrollSpeed:s,zoomOnPinch:i,onPanZoomStart:a,onPanZoom:f,onPanZoomEnd:l}){return g=>{if(Me(g,t))return g.ctrlKey&&g.preventDefault(),!1;g.preventDefault(),g.stopImmediatePropagation();let c=n.property("__zoom").k||1;if(g.ctrlKey&&i){let m=zt(g),x=uo(g),b=c*Math.pow(2,x);o.scaleTo(n,b,m,g);return}let d=g.deltaMode===1?20:1,h=r===ge.Vertical?0:g.deltaX*d,p=r===ge.Horizontal?0:g.deltaY*d;!Le()&&g.shiftKey&&r!==ge.Vertical&&(h=g.deltaY*d,p=0),o.translateBy(n,-(h/c)*s,-(p/c)*s,{internal:!0});let y=xt(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(f?.(g,y),e.panScrollTimeout=setTimeout(()=>{l?.(g,y),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,a?.(g,y))}}function ii({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(o,r){let s=o.type==="wheel",i=!t&&s&&!o.ctrlKey,a=Me(o,e);if(o.ctrlKey&&s&&a&&o.preventDefault(),i||a)return null;o.preventDefault(),n.call(this,o,r)}}function ai({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return o=>{if(o.sourceEvent?.internal)return;let r=xt(o.transform);e.mouseButton=o.sourceEvent?.button||0,e.isZoomingOrPanning=!0,e.prevViewport=r,o.sourceEvent?.type==="mousedown"&&t(!0),n&&n?.(o.sourceEvent,r)}}function ci({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:o,onPanZoom:r}){return s=>{e.usedRightMouseButton=!!(n&&lo(t,e.mouseButton??0)),s.sourceEvent?.sync||o([s.transform.x,s.transform.y,s.transform.k]),r&&!s.sourceEvent?.internal&&r?.(s.sourceEvent,xt(s.transform))}}function li({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:o,onPanZoomEnd:r,onPaneContextMenu:s}){return i=>{if(!i.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,s&&lo(t,e.mouseButton??0)&&!e.usedRightMouseButton&&i.sourceEvent&&s(i.sourceEvent),e.usedRightMouseButton=!1,o(!1),r)){let a=xt(i.transform);e.prevViewport=a,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{r?.(i.sourceEvent,a)},n?150:0)}}}function di({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:o,panOnScroll:r,zoomOnDoubleClick:s,userSelectionActive:i,noWheelClassName:a,noPanClassName:f,lib:l,connectionInProgress:g}){return c=>{let d=e||t,h=n&&c.ctrlKey,p=c.type==="wheel";if(c.button===1&&c.type==="mousedown"&&(Me(c,`${l}-flow__node`)||Me(c,`${l}-flow__edge`)))return!0;if(!o&&!d&&!r&&!s&&!n||i||g&&!p||Me(c,a)&&p||Me(c,f)&&(!p||r&&p&&!e)||!n&&c.ctrlKey&&p)return!1;if(!n&&c.type==="touchstart"&&c.touches?.length>1)return c.preventDefault(),!1;if(!d&&!r&&!h&&p||!o&&(c.type==="mousedown"||c.type==="touchstart")||Array.isArray(o)&&!o.includes(c.button)&&c.type==="mousedown")return!1;let y=Array.isArray(o)&&o.includes(c.button)||!c.button||c.button<=1;return(!c.ctrlKey||p)&&y}}function fo({domNode:e,minZoom:t,maxZoom:n,translateExtent:o,viewport:r,onPanZoom:s,onPanZoomStart:i,onPanZoomEnd:a,onDraggingChange:f}){let l={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{x:0,y:0,zoom:0},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},g=e.getBoundingClientRect(),c=At().scaleExtent([t,n]).translateExtent(o),d=Xe(e).call(c);b({x:r.x,y:r.y,zoom:Pe(r.zoom,t,n)},[[0,0],[g.width,g.height]],o);let h=d.on("wheel.zoom"),p=d.on("dblclick.zoom");c.wheelDelta(uo);function y(C,M){return d?new Promise(A=>{c?.interpolate(M?.interpolate==="linear"?tt:nt).transform(Ot(d,M?.duration,M?.ease,()=>A(!0)),C)}):Promise.resolve(!1)}function m({noWheelClassName:C,noPanClassName:M,onPaneContextMenu:A,userSelectionActive:H,panOnScroll:z,panOnDrag:O,panOnScrollMode:$,panOnScrollSpeed:P,preventScrolling:D,zoomOnPinch:V,zoomOnScroll:B,zoomOnDoubleClick:L,zoomActivationKeyPressed:Y,lib:X,onTransformChange:U,connectionInProgress:J,paneClickDistance:G,selectionOnDrag:T}){H&&!l.isZoomingOrPanning&&x();let Z=z&&!Y&&!H;c.clickDistance(T?1/0:!ce(G)||G<0?0:G);let Q=Z?si({zoomPanValues:l,noWheelClassName:C,d3Selection:d,d3Zoom:c,panOnScrollMode:$,panOnScrollSpeed:P,zoomOnPinch:V,onPanZoomStart:i,onPanZoom:s,onPanZoomEnd:a}):ii({noWheelClassName:C,preventScrolling:D,d3ZoomHandler:h});if(d.on("wheel.zoom",Q,{passive:!1}),!H){let W=ai({zoomPanValues:l,onDraggingChange:f,onPanZoomStart:i});c.on("start",W);let K=ci({zoomPanValues:l,panOnDrag:O,onPaneContextMenu:!!A,onPanZoom:s,onTransformChange:U});c.on("zoom",K);let ee=li({zoomPanValues:l,panOnDrag:O,panOnScroll:z,onPaneContextMenu:A,onPanZoomEnd:a,onDraggingChange:f});c.on("end",ee)}let q=di({zoomActivationKeyPressed:Y,panOnDrag:O,zoomOnScroll:B,panOnScroll:z,zoomOnDoubleClick:L,zoomOnPinch:V,userSelectionActive:H,noPanClassName:M,noWheelClassName:C,lib:X,connectionInProgress:J});c.filter(q),L?d.on("dblclick.zoom",p):d.on("dblclick.zoom",null)}function x(){c.on("zoom",null)}async function b(C,M,A){let H=Ht(C),z=c?.constrain()(H,M,A);return z&&await y(z),new Promise(O=>O(z))}async function u(C,M){let A=Ht(C);return await y(A,M),new Promise(H=>H(A))}function w(C){if(d){let M=Ht(C),A=d.property("__zoom");(A.k!==C.zoom||A.x!==C.x||A.y!==C.y)&&c?.transform(d,M,null,{sync:!0})}}function N(){let C=d?Cn(d.node()):{x:0,y:0,k:1};return{x:C.x,y:C.y,zoom:C.k}}function S(C,M){return d?new Promise(A=>{c?.interpolate(M?.interpolate==="linear"?tt:nt).scaleTo(Ot(d,M?.duration,M?.ease,()=>A(!0)),C)}):Promise.resolve(!1)}function _(C,M){return d?new Promise(A=>{c?.interpolate(M?.interpolate==="linear"?tt:nt).scaleBy(Ot(d,M?.duration,M?.ease,()=>A(!0)),C)}):Promise.resolve(!1)}function I(C){c?.scaleExtent(C)}function k(C){c?.translateExtent(C)}function R(C){let M=!ce(C)||C<0?0:C;c?.clickDistance(M)}return{update:m,destroy:x,setViewport:u,setViewportConstrained:b,getViewport:N,scaleTo:S,scaleBy:_,setScaleExtent:I,setTranslateExtent:k,syncViewport:w,setClickDistance:R}}var be;(function(e){e.Line="line",e.Handle="handle"})(be||(be={}));function ui({width:e,prevWidth:t,height:n,prevHeight:o,affectsX:r,affectsY:s}){let i=e-t,a=n-o,f=[i>0?1:i<0?-1:0,a>0?1:a<0?-1:0];return i&&r&&(f[0]=f[0]*-1),a&&s&&(f[1]=f[1]*-1),f}function Ln(e){let t=e.includes("right")||e.includes("left"),n=e.includes("bottom")||e.includes("top"),o=e.includes("left"),r=e.includes("top");return{isHorizontal:t,isVertical:n,affectsX:o,affectsY:r}}function he(e,t){return Math.max(0,t-e)}function me(e,t){return Math.max(0,e-t)}function rt(e,t,n){return Math.max(0,t-e,e-n)}function Tn(e,t){return e?!t:t}function fi(e,t,n,o,r,s,i,a){let{affectsX:f,affectsY:l}=t,{isHorizontal:g,isVertical:c}=t,d=g&&c,{xSnapped:h,ySnapped:p}=n,{minWidth:y,maxWidth:m,minHeight:x,maxHeight:b}=o,{x:u,y:w,width:N,height:S,aspectRatio:_}=e,I=Math.floor(g?h-e.pointerX:0),k=Math.floor(c?p-e.pointerY:0),R=N+(f?-I:I),C=S+(l?-k:k),M=-s[0]*N,A=-s[1]*S,H=rt(R,y,m),z=rt(C,x,b);if(i){let P=0,D=0;f&&I<0?P=he(u+I+M,i[0][0]):!f&&I>0&&(P=me(u+R+M,i[1][0])),l&&k<0?D=he(w+k+A,i[0][1]):!l&&k>0&&(D=me(w+C+A,i[1][1])),H=Math.max(H,P),z=Math.max(z,D)}if(a){let P=0,D=0;f&&I>0?P=me(u+I,a[0][0]):!f&&I<0&&(P=he(u+R,a[1][0])),l&&k>0?D=me(w+k,a[0][1]):!l&&k<0&&(D=he(w+C,a[1][1])),H=Math.max(H,P),z=Math.max(z,D)}if(r){if(g){let P=rt(R/_,x,b)*_;if(H=Math.max(H,P),i){let D=0;!f&&!l||f&&!l&&d?D=me(w+A+R/_,i[1][1])*_:D=he(w+A+(f?I:-I)/_,i[0][1])*_,H=Math.max(H,D)}if(a){let D=0;!f&&!l||f&&!l&&d?D=he(w+R/_,a[1][1])*_:D=me(w+(f?I:-I)/_,a[0][1])*_,H=Math.max(H,D)}}if(c){let P=rt(C*_,y,m)/_;if(z=Math.max(z,P),i){let D=0;!f&&!l||l&&!f&&d?D=me(u+C*_+M,i[1][0])/_:D=he(u+(l?k:-k)*_+M,i[0][0])/_,z=Math.max(z,D)}if(a){let D=0;!f&&!l||l&&!f&&d?D=he(u+C*_,a[1][0])/_:D=me(u+(l?k:-k)*_,a[0][0])/_,z=Math.max(z,D)}}}k=k+(k<0?z:-z),I=I+(I<0?H:-H),r&&(d?R>C*_?k=(Tn(f,l)?-I:I)/_:I=(Tn(f,l)?-k:k)*_:g?(k=I/_,l=f):(I=k*_,f=l));let O=f?u+I:u,$=l?w+k:w;return{width:N+(f?-I:I),height:S+(l?-k:k),x:s[0]*I*(f?-1:1)+O,y:s[1]*k*(l?-1:1)+$}}var go={width:0,height:0,x:0,y:0},gi={...go,pointerX:0,pointerY:0,aspectRatio:1};function pi(e){return[[0,0],[e.measured.width,e.measured.height]]}function hi(e,t,n){let o=t.position.x+e.position.x,r=t.position.y+e.position.y,s=e.measured.width??0,i=e.measured.height??0,a=n[0]*s,f=n[1]*i;return[[o-a,r-f],[o+s-a,r+i-f]]}function po({domNode:e,nodeId:t,getStoreItems:n,onChange:o,onEnd:r}){let s=Xe(e),i={controlDirection:Ln("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function a({controlPosition:l,boundaries:g,keepAspectRatio:c,resizeDirection:d,onResizeStart:h,onResize:p,onResizeEnd:y,shouldResize:m}){let x={...go},b={...gi};i={boundaries:g,resizeDirection:d,keepAspectRatio:c,controlDirection:Ln(l)};let u,w=null,N=[],S,_,I,k=!1,R=Dt().on("start",C=>{let{nodeLookup:M,transform:A,snapGrid:H,snapToGrid:z,nodeOrigin:O,paneDomNode:$}=n();if(u=M.get(t),!u)return;w=$?.getBoundingClientRect()??null;let{xSnapped:P,ySnapped:D}=We(C.sourceEvent,{transform:A,snapGrid:H,snapToGrid:z,containerBounds:w});x={width:u.measured.width??0,height:u.measured.height??0,x:u.position.x??0,y:u.position.y??0},b={...x,pointerX:P,pointerY:D,aspectRatio:x.width/x.height},S=void 0,u.parentId&&(u.extent==="parent"||u.expandParent)&&(S=M.get(u.parentId),_=S&&u.extent==="parent"?pi(S):void 0),N=[],I=void 0;for(let[V,B]of M)if(B.parentId===t&&(N.push({id:V,position:{...B.position},extent:B.extent}),B.extent==="parent"||B.expandParent)){let L=hi(B,u,B.origin??O);I?I=[[Math.min(L[0][0],I[0][0]),Math.min(L[0][1],I[0][1])],[Math.max(L[1][0],I[1][0]),Math.max(L[1][1],I[1][1])]]:I=L}h?.(C,{...x})}).on("drag",C=>{let{transform:M,snapGrid:A,snapToGrid:H,nodeOrigin:z}=n(),O=We(C.sourceEvent,{transform:M,snapGrid:A,snapToGrid:H,containerBounds:w}),$=[];if(!u)return;let{x:P,y:D,width:V,height:B}=x,L={},Y=u.origin??z,{width:X,height:U,x:J,y:G}=fi(b,i.controlDirection,O,i.boundaries,i.keepAspectRatio,Y,_,I),T=X!==V,Z=U!==B,Q=J!==P&&T,q=G!==D&&Z;if(!Q&&!q&&!T&&!Z)return;if((Q||q||Y[0]===1||Y[1]===1)&&(L.x=Q?J:x.x,L.y=q?G:x.y,x.x=L.x,x.y=L.y,N.length>0)){let oe=J-P,te=G-D;for(let ie of N)ie.position={x:ie.position.x-oe+Y[0]*(X-V),y:ie.position.y-te+Y[1]*(U-B)},$.push(ie)}if((T||Z)&&(L.width=T&&(!i.resizeDirection||i.resizeDirection==="horizontal")?X:x.width,L.height=Z&&(!i.resizeDirection||i.resizeDirection==="vertical")?U:x.height,x.width=L.width,x.height=L.height),S&&u.expandParent){let oe=Y[0]*(L.width??0);L.x&&L.x<oe&&(x.x=oe,b.x=b.x-(L.x-oe));let te=Y[1]*(L.height??0);L.y&&L.y<te&&(x.y=te,b.y=b.y-(L.y-te))}let W=ui({width:x.width,prevWidth:V,height:x.height,prevHeight:B,affectsX:i.controlDirection.affectsX,affectsY:i.controlDirection.affectsY}),K={...x,direction:W};m?.(C,K)!==!1&&(k=!0,p?.(C,K),o(L,$))}).on("end",C=>{k&&(y?.(C,{...x}),r?.({...x}),k=!1)});s.call(R)}function f(){s.on(".drag",null)}return{update:a,destroy:f}}var E=Ze(Os()),v=Ze(et());function se(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let n=0,o;n<e.length;n++)(o=se(e[n]))!==""&&(t+=(t&&" ")+o);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var No=Ze(et(),1),ko=Ze(So(),1);var vo=e=>{let t,n=new Set,o=(g,c)=>{let d=typeof g=="function"?g(t):g;if(!Object.is(d,t)){let h=t;t=c??(typeof d!="object"||d===null)?d:Object.assign({},t,d),n.forEach(p=>p(t,h))}},r=()=>t,f={setState:o,getState:r,getInitialState:()=>l,subscribe:g=>(n.add(g),()=>n.delete(g)),destroy:()=>{(import.meta.env?import.meta.env.MODE:void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},l=t=e(o,r,f);return f},_o=e=>e?vo(e):vo;var{useDebugValue:Ai}=No.default,{useSyncExternalStoreWithSelector:$i}=ko.default,Hi=e=>e;function ln(e,t=Hi,n){let o=$i(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return Ai(o),o}var Co=(e,t)=>{let n=_o(e),o=(r,s=t)=>ln(n,r,s);return Object.assign(o,n),o},Mo=(e,t)=>e?Co(e,t):Co;function ne(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(let[o,r]of e)if(!Object.is(r,t.get(o)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(let o of e)if(!t.has(o))return!1;return!0}let n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(let o of n)if(!Object.prototype.hasOwnProperty.call(t,o)||!Object.is(e[o],t[o]))return!1;return!0}var Oi=Ze(Hs()),_t=(0,v.createContext)(null),Li=_t.Provider,jo=ae.error001();function j(e,t){let n=(0,v.useContext)(_t);if(n===null)throw new Error(jo);return ln(n,e,t)}function re(){let e=(0,v.useContext)(_t);if(e===null)throw new Error(jo);return(0,v.useMemo)(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}var Io={display:"none"},Ti={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},Jo="react-flow__node-desc",er="react-flow__edge-desc",Ri="react-flow__aria-live",Bi=e=>e.ariaLiveMessage,Vi=e=>e.ariaLabelConfig;function Fi({rfId:e}){let t=j(Bi);return(0,E.jsx)("div",{id:`${Ri}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:Ti,children:t})}function Yi({rfId:e,disableKeyboardA11y:t}){let n=j(Vi);return(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)("div",{id:`${Jo}-${e}`,style:Io,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),(0,E.jsx)("div",{id:`${er}-${e}`,style:Io,children:n["edge.a11yDescription.default"]}),!t&&(0,E.jsx)(Fi,{rfId:e})]})}var Ct=(0,v.forwardRef)(({position:e="top-left",children:t,className:n,style:o,...r},s)=>{let i=`${e}`.split("-");return(0,E.jsx)("div",{className:se(["react-flow__panel",n,...i]),style:o,ref:s,...r,children:t})});Ct.displayName="Panel";function Zi({proOptions:e,position:t="bottom-right"}){return e?.hideAttribution?null:(0,E.jsx)(Ct,{position:t,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://pro.reactflow.dev",children:(0,E.jsx)("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}var Xi=e=>{let t=[],n=[];for(let[,o]of e.nodeLookup)o.selected&&t.push(o.internals.userNode);for(let[,o]of e.edgeLookup)o.selected&&n.push(o);return{selectedNodes:t,selectedEdges:n}},wt=e=>e.id;function Wi(e,t){return ne(e.selectedNodes.map(wt),t.selectedNodes.map(wt))&&ne(e.selectedEdges.map(wt),t.selectedEdges.map(wt))}function Ki({onSelectionChange:e}){let t=re(),{selectedNodes:n,selectedEdges:o}=j(Xi,Wi);return(0,v.useEffect)(()=>{let r={nodes:n,edges:o};e?.(r),t.getState().onSelectionChangeHandlers.forEach(s=>s(r))},[n,o,e]),null}var Gi=e=>!!e.onSelectionChangeHandlers;function qi({onSelectionChange:e}){let t=j(Gi);return e||t?(0,E.jsx)(Ki,{onSelectionChange:e}):null}var tr=[0,0],Ui={x:0,y:0,zoom:1},Qi=["nodes","edges","defaultNodes","defaultEdges","onConnect","onConnectStart","onConnectEnd","onClickConnectStart","onClickConnectEnd","nodesDraggable","autoPanOnNodeFocus","nodesConnectable","nodesFocusable","edgesFocusable","edgesReconnectable","elevateNodesOnSelect","elevateEdgesOnSelect","minZoom","maxZoom","nodeExtent","onNodesChange","onEdgesChange","elementsSelectable","connectionMode","snapGrid","snapToGrid","translateExtent","connectOnClick","defaultEdgeOptions","fitView","fitViewOptions","onNodesDelete","onEdgesDelete","onDelete","onNodeDrag","onNodeDragStart","onNodeDragStop","onSelectionDrag","onSelectionDragStart","onSelectionDragStop","onMoveStart","onMove","onMoveEnd","noPanClassName","nodeOrigin","autoPanOnConnect","autoPanOnNodeDrag","onError","connectionRadius","isValidConnection","selectNodesOnDrag","nodeDragThreshold","connectionDragThreshold","onBeforeDelete","debug","autoPanSpeed","ariaLabelConfig","zIndexMode"],Po=[...Qi,"rfId"],ji=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges}),zo={translateExtent:De,nodeOrigin:tr,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function Ji(e){let{setNodes:t,setEdges:n,setMinZoom:o,setMaxZoom:r,setTranslateExtent:s,setNodeExtent:i,reset:a,setDefaultNodesAndEdges:f}=j(ji,ne),l=re();(0,v.useEffect)(()=>(f(e.defaultNodes,e.defaultEdges),()=>{g.current=zo,a()}),[]);let g=(0,v.useRef)(zo);return(0,v.useEffect)(()=>{for(let c of Po){let d=e[c],h=g.current[c];d!==h&&(typeof e[c]>"u"||(c==="nodes"?t(d):c==="edges"?n(d):c==="minZoom"?o(d):c==="maxZoom"?r(d):c==="translateExtent"?s(d):c==="nodeExtent"?i(d):c==="ariaLabelConfig"?l.setState({ariaLabelConfig:Wn(d)}):c==="fitView"?l.setState({fitViewQueued:d}):c==="fitViewOptions"?l.setState({fitViewOptions:d}):l.setState({[c]:d})))}g.current=e},Po.map(c=>e[c])),null}function Do(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function ea(e){let[t,n]=(0,v.useState)(e==="system"?null:e);return(0,v.useEffect)(()=>{if(e!=="system"){n(e);return}let o=Do(),r=()=>n(o?.matches?"dark":"light");return r(),o?.addEventListener("change",r),()=>{o?.removeEventListener("change",r)}},[e]),t!==null?t:Do()?.matches?"dark":"light"}var Ao=typeof document<"u"?document:null;function Qe(e=null,t={target:Ao,actInsideInputWithModifier:!0}){let[n,o]=(0,v.useState)(!1),r=(0,v.useRef)(!1),s=(0,v.useRef)(new Set([])),[i,a]=(0,v.useMemo)(()=>{if(e!==null){let l=(Array.isArray(e)?e:[e]).filter(c=>typeof c=="string").map(c=>c.replace("+",`
|
|
1
|
+
import{b as Xe,c as zt,d as Dt,f as tt,h as nt,k as _n,l as Cn,m as At}from"./embed-page-chunk-S4XZPBRM.js";import{a as Os}from"./embed-page-chunk-QV7QAJ4N.js";import{a as Hs}from"./embed-page-chunk-F7TA3LRH.js";import{a as et}from"./embed-page-chunk-R5QL57JJ.js";import{c as Je,f as Ze}from"./embed-page-chunk-QBTAJ2YI.js";var mo=Je(ho=>{"use strict";var Te=et();function mi(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var yi=typeof Object.is=="function"?Object.is:mi,xi=Te.useState,bi=Te.useEffect,wi=Te.useLayoutEffect,Ei=Te.useDebugValue;function Si(e,t){var n=t(),o=xi({inst:{value:n,getSnapshot:t}}),r=o[0].inst,s=o[1];return wi(function(){r.value=n,r.getSnapshot=t,cn(r)&&s({inst:r})},[e,n,t]),bi(function(){return cn(r)&&s({inst:r}),e(function(){cn(r)&&s({inst:r})})},[e]),Ei(n),n}function cn(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!yi(e,n)}catch{return!0}}function vi(e,t){return t()}var _i=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?vi:Si;ho.useSyncExternalStore=Te.useSyncExternalStore!==void 0?Te.useSyncExternalStore:_i});var xo=Je((tl,yo)=>{"use strict";yo.exports=mo()});var wo=Je(bo=>{"use strict";var bt=et(),Ci=xo();function Ni(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var ki=typeof Object.is=="function"?Object.is:Ni,Mi=Ci.useSyncExternalStore,Ii=bt.useRef,Pi=bt.useEffect,zi=bt.useMemo,Di=bt.useDebugValue;bo.useSyncExternalStoreWithSelector=function(e,t,n,o,r){var s=Ii(null);if(s.current===null){var i={hasValue:!1,value:null};s.current=i}else i=s.current;s=zi(function(){function f(h){if(!l){if(l=!0,g=h,h=o(h),r!==void 0&&i.hasValue){var p=i.value;if(r(p,h))return c=p}return c=h}if(p=c,ki(g,h))return p;var y=o(h);return r!==void 0&&r(p,y)?(g=h,p):(g=h,c=y)}var l=!1,g,c,d=n===void 0?null:n;return[function(){return f(t())},d===null?void 0:function(){return f(d())}]},[t,n,o,r]);var a=Mi(e,s[0],s[1]);return Pi(function(){i.hasValue=!0,i.value=a},[a]),Di(a),a}});var So=Je((ol,Eo)=>{"use strict";Eo.exports=wo()});var ae={error001:()=>"[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001",error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>"The React Flow parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,{id:t,sourceHandle:n,targetHandle:o})=>`Couldn't create edge for ${e} handle id: "${e==="source"?n:o}", edge id: ${t}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(e="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${e}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>"useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.",error015:()=>"It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs."},De=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],Tt=["Enter"," ","Escape"],Rt={"node.a11yDescription.default":"Press enter or space to select a node. Press delete to remove it and escape to cancel.","node.a11yDescription.keyboardDisabled":"Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.","node.a11yDescription.ariaLiveMessage":({direction:e,x:t,y:n})=>`Moved selected node ${e}. New position, x: ${t}, y: ${n}`,"edge.a11yDescription.default":"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.","controls.ariaLabel":"Control Panel","controls.zoomIn.ariaLabel":"Zoom In","controls.zoomOut.ariaLabel":"Zoom Out","controls.fitView.ariaLabel":"Fit View","controls.interactive.ariaLabel":"Toggle Interactivity","minimap.ariaLabel":"Mini Map","handle.ariaLabel":"Handle"},ye;(function(e){e.Strict="strict",e.Loose="loose"})(ye||(ye={}));var ge;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(ge||(ge={}));var Se;(function(e){e.Partial="partial",e.Full="full"})(Se||(Se={}));var Bt={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null},de;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(de||(de={}));var Ie;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(Ie||(Ie={}));var F;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(F||(F={}));var Nn={[F.Left]:F.Right,[F.Right]:F.Left,[F.Top]:F.Bottom,[F.Bottom]:F.Top};function Vt(e){return e===null?null:e?"valid":"invalid"}var Ft=e=>"id"in e&&"source"in e&&"target"in e,Rn=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),Yt=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e);var Ge=(e,t=[0,0])=>{let{width:n,height:o}=ue(e),r=e.origin??t,s=n*r[0],i=o*r[1];return{x:e.position.x-s,y:e.position.y-i}},Zt=(e,t={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};let n=e.reduce((o,r)=>{let s=typeof r=="string",i=!t.nodeLookup&&!s?r:void 0;t.nodeLookup&&(i=s?t.nodeLookup.get(r):Yt(r)?r:t.nodeLookup.get(r.id));let a=i?st(i,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return at(o,a)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return ct(n)},Ae=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},o=!1;return e.forEach(r=>{(t.filter===void 0||t.filter(r))&&(n=at(n,st(r)),o=!0)}),o?ct(n):{x:0,y:0,width:0,height:0}},it=(e,t,[n,o,r]=[0,0,1],s=!1,i=!1)=>{let a={...Oe(t,[n,o,r]),width:t.width/r,height:t.height/r},f=[];for(let l of e.values()){let{measured:g,selectable:c=!0,hidden:d=!1}=l;if(i&&!c||d)continue;let h=g.width??l.width??l.initialWidth??null,p=g.height??l.height??l.initialHeight??null,y=$e(a,_e(l)),m=(h??0)*(p??0),x=s&&y>0;(!l.internals.handleBounds||x||y>=m||l.dragging)&&f.push(l)}return f},Bn=(e,t)=>{let n=new Set;return e.forEach(o=>{n.add(o.id)}),t.filter(o=>n.has(o.source)||n.has(o.target))};function Ls(e,t){let n=new Map,o=t?.nodes?new Set(t.nodes.map(r=>r.id)):null;return e.forEach(r=>{r.measured.width&&r.measured.height&&(t?.includeHiddenNodes||!r.hidden)&&(!o||o.has(r.id))&&n.set(r.id,r)}),n}async function Vn({nodes:e,width:t,height:n,panZoom:o,minZoom:r,maxZoom:s},i){if(e.size===0)return Promise.resolve(!0);let a=Ls(e,i),f=Ae(a),l=qe(f,t,n,i?.minZoom??r,i?.maxZoom??s,i?.padding??.1);return await o.setViewport(l,{duration:i?.duration,ease:i?.ease,interpolate:i?.interpolate}),Promise.resolve(!0)}function Xt({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:o=[0,0],nodeExtent:r,onError:s}){let i=n.get(e),a=i.parentId?n.get(i.parentId):void 0,{x:f,y:l}=a?a.internals.positionAbsolute:{x:0,y:0},g=i.origin??o,c=i.extent||r;if(i.extent==="parent"&&!i.expandParent)if(!a)s?.("005",ae.error005());else{let h=a.measured.width,p=a.measured.height;h&&p&&(c=[[f,l],[f+h,l+p]])}else a&&ze(i.extent)&&(c=[[i.extent[0][0]+f,i.extent[0][1]+l],[i.extent[1][0]+f,i.extent[1][1]+l]]);let d=ze(c)?ve(t,c,i.measured):t;return(i.measured.width===void 0||i.measured.height===void 0)&&s?.("015",ae.error015()),{position:{x:d.x-f+(i.measured.width??0)*g[0],y:d.y-l+(i.measured.height??0)*g[1]},positionAbsolute:d}}async function Fn({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:o,onBeforeDelete:r}){let s=new Set(e.map(d=>d.id)),i=[];for(let d of n){if(d.deletable===!1)continue;let h=s.has(d.id),p=!h&&d.parentId&&i.find(y=>y.id===d.parentId);(h||p)&&i.push(d)}let a=new Set(t.map(d=>d.id)),f=o.filter(d=>d.deletable!==!1),g=Bn(i,f);for(let d of f)a.has(d.id)&&!g.find(p=>p.id===d.id)&&g.push(d);if(!r)return{edges:g,nodes:i};let c=await r({nodes:i,edges:g});return typeof c=="boolean"?c?{edges:g,nodes:i}:{edges:[],nodes:[]}:c}var Pe=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),ve=(e={x:0,y:0},t,n)=>({x:Pe(e.x,t[0][0],t[1][0]-(n?.width??0)),y:Pe(e.y,t[0][1],t[1][1]-(n?.height??0))});function Yn(e,t,n){let{width:o,height:r}=ue(n),{x:s,y:i}=n.internals.positionAbsolute;return ve(e,[[s,i],[s+o,i+r]],t)}var kn=(e,t,n)=>e<t?Pe(Math.abs(e-t),1,t)/t:e>n?-Pe(Math.abs(e-n),1,t)/t:0,Zn=(e,t,n=15,o=40)=>{let r=kn(e.x,o,t.width-o)*n,s=kn(e.y,o,t.height-o)*n;return[r,s]},at=(e,t)=>({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)}),Lt=({x:e,y:t,width:n,height:o})=>({x:e,y:t,x2:e+n,y2:t+o}),ct=({x:e,y:t,x2:n,y2:o})=>({x:e,y:t,width:n-e,height:o-t}),_e=(e,t=[0,0])=>{let{x:n,y:o}=Yt(e)?e.internals.positionAbsolute:Ge(e,t);return{x:n,y:o,width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}},st=(e,t=[0,0])=>{let{x:n,y:o}=Yt(e)?e.internals.positionAbsolute:Ge(e,t);return{x:n,y:o,x2:n+(e.measured?.width??e.width??e.initialWidth??0),y2:o+(e.measured?.height??e.height??e.initialHeight??0)}},Wt=(e,t)=>ct(at(Lt(e),Lt(t))),$e=(e,t)=>{let 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)},Kt=e=>ce(e.width)&&ce(e.height)&&ce(e.x)&&ce(e.y),ce=e=>!isNaN(e)&&isFinite(e),Gt=(e,t)=>{},He=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),Oe=({x:e,y:t},[n,o,r],s=!1,i=[1,1])=>{let a={x:(e-n)/r,y:(t-o)/r};return s?He(a,i):a},Ke=({x:e,y:t},[n,o,r])=>({x:e*r+n,y:t*r+o});function ke(e,t){if(typeof e=="number")return Math.floor((t-t/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){let n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(n)}if(typeof e=="string"&&e.endsWith("%")){let n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return console.error(`[React Flow] The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function Ts(e,t,n){if(typeof e=="string"||typeof e=="number"){let o=ke(e,n),r=ke(e,t);return{top:o,right:r,bottom:o,left:r,x:r*2,y:o*2}}if(typeof e=="object"){let o=ke(e.top??e.y??0,n),r=ke(e.bottom??e.y??0,n),s=ke(e.left??e.x??0,t),i=ke(e.right??e.x??0,t);return{top:o,right:i,bottom:r,left:s,x:s+i,y:o+r}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function Rs(e,t,n,o,r,s){let{x:i,y:a}=Ke(e,[t,n,o]),{x:f,y:l}=Ke({x:e.x+e.width,y:e.y+e.height},[t,n,o]),g=r-f,c=s-l;return{left:Math.floor(i),top:Math.floor(a),right:Math.floor(g),bottom:Math.floor(c)}}var qe=(e,t,n,o,r,s)=>{let i=Ts(s,t,n),a=(t-i.x)/e.width,f=(n-i.y)/e.height,l=Math.min(a,f),g=Pe(l,o,r),c=e.x+e.width/2,d=e.y+e.height/2,h=t/2-c*g,p=n/2-d*g,y=Rs(e,h,p,g,t,n),m={left:Math.min(y.left-i.left,0),top:Math.min(y.top-i.top,0),right:Math.min(y.right-i.right,0),bottom:Math.min(y.bottom-i.bottom,0)};return{x:h-m.left+m.right,y:p-m.top+m.bottom,zoom:g}},Le=()=>typeof navigator<"u"&&navigator?.userAgent?.indexOf("Mac")>=0;function ze(e){return e!=null&&e!=="parent"}function ue(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function lt(e){return(e.measured?.width??e.width??e.initialWidth)!==void 0&&(e.measured?.height??e.height??e.initialHeight)!==void 0}function qt(e,t={width:0,height:0},n,o,r){let s={...e},i=o.get(n);if(i){let a=i.origin||r;s.x+=i.internals.positionAbsolute.x-(t.width??0)*a[0],s.y+=i.internals.positionAbsolute.y-(t.height??0)*a[1]}return s}function Ut(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function Xn(){let e,t;return{promise:new Promise((o,r)=>{e=o,t=r}),resolve:e,reject:t}}function Wn(e){return{...Rt,...e||{}}}function We(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:o,containerBounds:r}){let{x:s,y:i}=le(e),a=Oe({x:s-(r?.left??0),y:i-(r?.top??0)},o),{x:f,y:l}=n?He(a,t):a;return{xSnapped:f,ySnapped:l,...a}}var dt=e=>({width:e.offsetWidth,height:e.offsetHeight}),Qt=e=>e?.getRootNode?.()||window?.document,Bs=["INPUT","SELECT","TEXTAREA"];function jt(e){let t=e.composedPath?.()?.[0]||e.target;return t?.nodeType!==1?!1:Bs.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}var Jt=e=>"clientX"in e,le=(e,t)=>{let n=Jt(e),o=n?e.clientX:e.touches?.[0].clientX,r=n?e.clientY:e.touches?.[0].clientY;return{x:o-(t?.left??0),y:r-(t?.top??0)}},Mn=(e,t,n,o,r)=>{let s=t.querySelectorAll(`.${e}`);return!s||!s.length?null:Array.from(s).map(i=>{let a=i.getBoundingClientRect();return{id:i.getAttribute("data-handleid"),type:e,nodeId:r,position:i.getAttribute("data-handlepos"),x:(a.left-n.left)/o,y:(a.top-n.top)/o,...dt(i)}})};function ut({sourceX:e,sourceY:t,targetX:n,targetY:o,sourceControlX:r,sourceControlY:s,targetControlX:i,targetControlY:a}){let f=e*.125+r*.375+i*.375+n*.125,l=t*.125+s*.375+a*.375+o*.125,g=Math.abs(f-e),c=Math.abs(l-t);return[f,l,g,c]}function ot(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function In({pos:e,x1:t,y1:n,x2:o,y2:r,c:s}){switch(e){case F.Left:return[t-ot(t-o,s),n];case F.Right:return[t+ot(o-t,s),n];case F.Top:return[t,n-ot(n-r,s)];case F.Bottom:return[t,n+ot(r-n,s)]}}function ft({sourceX:e,sourceY:t,sourcePosition:n=F.Bottom,targetX:o,targetY:r,targetPosition:s=F.Top,curvature:i=.25}){let[a,f]=In({pos:n,x1:e,y1:t,x2:o,y2:r,c:i}),[l,g]=In({pos:s,x1:o,y1:r,x2:e,y2:t,c:i}),[c,d,h,p]=ut({sourceX:e,sourceY:t,targetX:o,targetY:r,sourceControlX:a,sourceControlY:f,targetControlX:l,targetControlY:g});return[`M${e},${t} C${a},${f} ${l},${g} ${o},${r}`,c,d,h,p]}function en({sourceX:e,sourceY:t,targetX:n,targetY:o}){let r=Math.abs(n-e)/2,s=n<e?n+r:n-r,i=Math.abs(o-t)/2,a=o<t?o+i:o-i;return[s,a,r,i]}function Kn({sourceNode:e,targetNode:t,selected:n=!1,zIndex:o=0,elevateOnSelect:r=!1,zIndexMode:s="basic"}){if(s==="manual")return o;let i=r&&n?o+1e3:o,a=Math.max(e.parentId||r&&e.selected?e.internals.z:0,t.parentId||r&&t.selected?t.internals.z:0);return i+a}function Gn({sourceNode:e,targetNode:t,width:n,height:o,transform:r}){let s=at(st(e),st(t));s.x===s.x2&&(s.x2+=1),s.y===s.y2&&(s.y2+=1);let i={x:-r[0]/r[2],y:-r[1]/r[2],width:n/r[2],height:o/r[2]};return $e(i,ct(s))>0}var Vs=({source:e,sourceHandle:t,target:n,targetHandle:o})=>`xy-edge__${e}${t||""}-${n}${o||""}`,Fs=(e,t)=>t.some(n=>n.source===e.source&&n.target===e.target&&(n.sourceHandle===e.sourceHandle||!n.sourceHandle&&!e.sourceHandle)&&(n.targetHandle===e.targetHandle||!n.targetHandle&&!e.targetHandle)),tn=(e,t,n={})=>{if(!e.source||!e.target)return Gt("006",ae.error006()),t;let o=n.getEdgeId||Vs,r;return Ft(e)?r={...e}:r={...e,id:o(e)},Fs(r,t)?t:(r.sourceHandle===null&&delete r.sourceHandle,r.targetHandle===null&&delete r.targetHandle,t.concat(r))};function gt({sourceX:e,sourceY:t,targetX:n,targetY:o}){let[r,s,i,a]=en({sourceX:e,sourceY:t,targetX:n,targetY:o});return[`M ${e},${t}L ${n},${o}`,r,s,i,a]}var Pn={[F.Left]:{x:-1,y:0},[F.Right]:{x:1,y:0},[F.Top]:{x:0,y:-1},[F.Bottom]:{x:0,y:1}},Ys=({source:e,sourcePosition:t=F.Bottom,target:n})=>t===F.Left||t===F.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},zn=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function Zs({source:e,sourcePosition:t=F.Bottom,target:n,targetPosition:o=F.Top,center:r,offset:s,stepPosition:i}){let a=Pn[t],f=Pn[o],l={x:e.x+a.x*s,y:e.y+a.y*s},g={x:n.x+f.x*s,y:n.y+f.y*s},c=Ys({source:l,sourcePosition:t,target:g}),d=c.x!==0?"x":"y",h=c[d],p=[],y,m,x={x:0,y:0},b={x:0,y:0},[,,u,w]=en({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(a[d]*f[d]===-1){d==="x"?(y=r.x??l.x+(g.x-l.x)*i,m=r.y??(l.y+g.y)/2):(y=r.x??(l.x+g.x)/2,m=r.y??l.y+(g.y-l.y)*i);let S=[{x:y,y:l.y},{x:y,y:g.y}],_=[{x:l.x,y:m},{x:g.x,y:m}];a[d]===h?p=d==="x"?S:_:p=d==="x"?_:S}else{let S=[{x:l.x,y:g.y}],_=[{x:g.x,y:l.y}];if(d==="x"?p=a.x===h?_:S:p=a.y===h?S:_,t===o){let M=Math.abs(e[d]-n[d]);if(M<=s){let A=Math.min(s-1,s-M);a[d]===h?x[d]=(l[d]>e[d]?-1:1)*A:b[d]=(g[d]>n[d]?-1:1)*A}}if(t!==o){let M=d==="x"?"y":"x",A=a[d]===f[M],H=l[M]>g[M],z=l[M]<g[M];(a[d]===1&&(!A&&H||A&&z)||a[d]!==1&&(!A&&z||A&&H))&&(p=d==="x"?S:_)}let I={x:l.x+x.x,y:l.y+x.y},k={x:g.x+b.x,y:g.y+b.y},R=Math.max(Math.abs(I.x-p[0].x),Math.abs(k.x-p[0].x)),C=Math.max(Math.abs(I.y-p[0].y),Math.abs(k.y-p[0].y));R>=C?(y=(I.x+k.x)/2,m=p[0].y):(y=p[0].x,m=(I.y+k.y)/2)}return[[e,{x:l.x+x.x,y:l.y+x.y},...p,{x:g.x+b.x,y:g.y+b.y},n],y,m,u,w]}function Xs(e,t,n,o){let r=Math.min(zn(e,t)/2,zn(t,n)/2,o),{x:s,y:i}=t;if(e.x===s&&s===n.x||e.y===i&&i===n.y)return`L${s} ${i}`;if(e.y===i){let l=e.x<n.x?-1:1,g=e.y<n.y?1:-1;return`L ${s+r*l},${i}Q ${s},${i} ${s},${i+r*g}`}let a=e.x<n.x?1:-1,f=e.y<n.y?-1:1;return`L ${s},${i+r*f}Q ${s},${i} ${s+r*a},${i}`}function Ue({sourceX:e,sourceY:t,sourcePosition:n=F.Bottom,targetX:o,targetY:r,targetPosition:s=F.Top,borderRadius:i=5,centerX:a,centerY:f,offset:l=20,stepPosition:g=.5}){let[c,d,h,p,y]=Zs({source:{x:e,y:t},sourcePosition:n,target:{x:o,y:r},targetPosition:s,center:{x:a,y:f},offset:l,stepPosition:g});return[c.reduce((x,b,u)=>{let w="";return u>0&&u<c.length-1?w=Xs(c[u-1],b,c[u+1],i):w=`${u===0?"M":"L"}${b.x} ${b.y}`,x+=w,x},""),d,h,p,y]}function Dn(e){return e&&!!(e.internals.handleBounds||e.handles?.length)&&!!(e.measured.width||e.width||e.initialWidth)}function qn(e){let{sourceNode:t,targetNode:n}=e;if(!Dn(t)||!Dn(n))return null;let o=t.internals.handleBounds||An(t.handles),r=n.internals.handleBounds||An(n.handles),s=$n(o?.source??[],e.sourceHandle),i=$n(e.connectionMode===ye.Strict?r?.target??[]:(r?.target??[]).concat(r?.source??[]),e.targetHandle);if(!s||!i)return e.onError?.("008",ae.error008(s?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;let a=s?.position||F.Bottom,f=i?.position||F.Top,l=xe(t,s,a),g=xe(n,i,f);return{sourceX:l.x,sourceY:l.y,targetX:g.x,targetY:g.y,sourcePosition:a,targetPosition:f}}function An(e){if(!e)return null;let t=[],n=[];for(let o of e)o.width=o.width??1,o.height=o.height??1,o.type==="source"?t.push(o):o.type==="target"&&n.push(o);return{source:t,target:n}}function xe(e,t,n=F.Left,o=!1){let r=(t?.x??0)+e.internals.positionAbsolute.x,s=(t?.y??0)+e.internals.positionAbsolute.y,{width:i,height:a}=t??ue(e);if(o)return{x:r+i/2,y:s+a/2};switch(t?.position??n){case F.Top:return{x:r+i/2,y:s};case F.Right:return{x:r+i,y:s+a/2};case F.Bottom:return{x:r+i/2,y:s+a};case F.Left:return{x:r,y:s+a/2}}}function $n(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}function pt(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(o=>`${o}=${e[o]}`).join("&")}`:""}function Un(e,{id:t,defaultColor:n,defaultMarkerStart:o,defaultMarkerEnd:r}){let s=new Set;return e.reduce((i,a)=>([a.markerStart||o,a.markerEnd||r].forEach(f=>{if(f&&typeof f=="object"){let l=pt(f,t);s.has(l)||(i.push({id:l,color:f.color||n,...f}),s.add(l))}}),i),[]).sort((i,a)=>i.id.localeCompare(a.id))}var Qn=1e3,Ws=10,nn={nodeOrigin:[0,0],nodeExtent:De,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},Ks={...nn,checkEquality:!0};function on(e,t){let n={...e};for(let o in t)t[o]!==void 0&&(n[o]=t[o]);return n}function jn(e,t,n){let o=on(nn,n);for(let r of e.values())if(r.parentId)sn(r,e,t,o);else{let s=Ge(r,o.nodeOrigin),i=ze(r.extent)?r.extent:o.nodeExtent,a=ve(s,i,ue(r));r.internals.positionAbsolute=a}}function Gs(e,t){if(!e.handles)return e.measured?t?.internals.handleBounds:void 0;let n=[],o=[];for(let r of e.handles){let s={id:r.id,width:r.width??1,height:r.height??1,nodeId:e.id,x:r.x,y:r.y,position:r.position,type:r.type};r.type==="source"?n.push(s):r.type==="target"&&o.push(s)}return{source:n,target:o}}function rn(e){return e==="manual"}function ht(e,t,n,o={}){let r=on(Ks,o),s={i:0},i=new Map(t),a=r?.elevateNodesOnSelect&&!rn(r.zIndexMode)?Qn:0,f=e.length>0;t.clear(),n.clear();for(let l of e){let g=i.get(l.id);if(r.checkEquality&&l===g?.internals.userNode)t.set(l.id,g);else{let c=Ge(l,r.nodeOrigin),d=ze(l.extent)?l.extent:r.nodeExtent,h=ve(c,d,ue(l));g={...r.defaults,...l,measured:{width:l.measured?.width,height:l.measured?.height},internals:{positionAbsolute:h,handleBounds:Gs(l,g),z:Jn(l,a,r.zIndexMode),userNode:l}},t.set(l.id,g)}(g.measured===void 0||g.measured.width===void 0||g.measured.height===void 0)&&!g.hidden&&(f=!1),l.parentId&&sn(g,t,n,o,s)}return f}function qs(e,t){if(!e.parentId)return;let n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function sn(e,t,n,o,r){let{elevateNodesOnSelect:s,nodeOrigin:i,nodeExtent:a,zIndexMode:f}=on(nn,o),l=e.parentId,g=t.get(l);if(!g){console.warn(`Parent node ${l} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}qs(e,n),r&&!g.parentId&&g.internals.rootParentIndex===void 0&&f==="auto"&&(g.internals.rootParentIndex=++r.i,g.internals.z=g.internals.z+r.i*Ws),r&&g.internals.rootParentIndex!==void 0&&(r.i=g.internals.rootParentIndex);let c=s&&!rn(f)?Qn:0,{x:d,y:h,z:p}=Us(e,g,i,a,c,f),{positionAbsolute:y}=e.internals,m=d!==y.x||h!==y.y;(m||p!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:m?{x:d,y:h}:y,z:p}})}function Jn(e,t,n){let o=ce(e.zIndex)?e.zIndex:0;return rn(n)?o:o+(e.selected?t:0)}function Us(e,t,n,o,r,s){let{x:i,y:a}=t.internals.positionAbsolute,f=ue(e),l=Ge(e,n),g=ze(e.extent)?ve(l,e.extent,f):l,c=ve({x:i+g.x,y:a+g.y},o,f);e.extent==="parent"&&(c=Yn(c,f,t));let d=Jn(e,r,s),h=t.internals.z??0;return{x:c.x,y:c.y,z:h>=d?h+1:d}}function mt(e,t,n,o=[0,0]){let r=[],s=new Map;for(let i of e){let a=t.get(i.parentId);if(!a)continue;let f=s.get(i.parentId)?.expandedRect??_e(a),l=Wt(f,i.rect);s.set(i.parentId,{expandedRect:l,parent:a})}return s.size>0&&s.forEach(({expandedRect:i,parent:a},f)=>{let l=a.internals.positionAbsolute,g=ue(a),c=a.origin??o,d=i.x<l.x?Math.round(Math.abs(l.x-i.x)):0,h=i.y<l.y?Math.round(Math.abs(l.y-i.y)):0,p=Math.max(g.width,Math.round(i.width)),y=Math.max(g.height,Math.round(i.height)),m=(p-g.width)*c[0],x=(y-g.height)*c[1];(d>0||h>0||m||x)&&(r.push({id:f,type:"position",position:{x:a.position.x-d+m,y:a.position.y-h+x}}),n.get(f)?.forEach(b=>{e.some(u=>u.id===b.id)||r.push({id:b.id,type:"position",position:{x:b.position.x+d,y:b.position.y+h}})})),(g.width<i.width||g.height<i.height||d||h)&&r.push({id:f,type:"dimensions",setAttributes:!0,dimensions:{width:p+(d?c[0]*d-m:0),height:y+(h?c[1]*h-x:0)}})}),r}function eo(e,t,n,o,r,s,i){let a=o?.querySelector(".xyflow__viewport"),f=!1;if(!a)return{changes:[],updatedInternals:f};let l=[],g=window.getComputedStyle(a),{m22:c}=new window.DOMMatrixReadOnly(g.transform),d=[];for(let h of e.values()){let p=t.get(h.id);if(!p)continue;if(p.hidden){t.set(p.id,{...p,internals:{...p.internals,handleBounds:void 0}}),f=!0;continue}let y=dt(h.nodeElement),m=p.measured.width!==y.width||p.measured.height!==y.height;if(!!(y.width&&y.height&&(m||!p.internals.handleBounds||h.force))){let b=h.nodeElement.getBoundingClientRect(),u=ze(p.extent)?p.extent:s,{positionAbsolute:w}=p.internals;p.parentId&&p.extent==="parent"?w=Yn(w,y,t.get(p.parentId)):u&&(w=ve(w,u,y));let N={...p,measured:y,internals:{...p.internals,positionAbsolute:w,handleBounds:{source:Mn("source",h.nodeElement,b,c,p.id),target:Mn("target",h.nodeElement,b,c,p.id)}}};t.set(p.id,N),p.parentId&&sn(N,t,n,{nodeOrigin:r,zIndexMode:i}),f=!0,m&&(l.push({id:p.id,type:"dimensions",dimensions:y}),p.expandParent&&p.parentId&&d.push({id:p.id,parentId:p.parentId,rect:_e(N,r)}))}}if(d.length>0){let h=mt(d,t,n,r);l.push(...h)}return{changes:l,updatedInternals:f}}async function to({delta:e,panZoom:t,transform:n,translateExtent:o,width:r,height:s}){if(!t||!e.x&&!e.y)return Promise.resolve(!1);let i=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[r,s]],o),a=!!i&&(i.x!==n[0]||i.y!==n[1]||i.k!==n[2]);return Promise.resolve(a)}function Hn(e,t,n,o,r,s){let i=r,a=o.get(i)||new Map;o.set(i,a.set(n,t)),i=`${r}-${e}`;let f=o.get(i)||new Map;if(o.set(i,f.set(n,t)),s){i=`${r}-${e}-${s}`;let l=o.get(i)||new Map;o.set(i,l.set(n,t))}}function an(e,t,n){e.clear(),t.clear();for(let o of n){let{source:r,target:s,sourceHandle:i=null,targetHandle:a=null}=o,f={edgeId:o.id,source:r,target:s,sourceHandle:i,targetHandle:a},l=`${r}-${i}--${s}-${a}`,g=`${s}-${a}--${r}-${i}`;Hn("source",f,g,e,r,i),Hn("target",f,l,e,s,a),t.set(o.id,o)}}function no(e,t){if(!e.parentId)return!1;let n=t.get(e.parentId);return n?n.selected?!0:no(n,t):!1}function On(e,t,n){let o=e;do{if(o?.matches?.(t))return!0;if(o===n)return!1;o=o?.parentElement}while(o);return!1}function Qs(e,t,n,o){let r=new Map;for(let[s,i]of e)if((i.selected||i.id===o)&&(!i.parentId||!no(i,e))&&(i.draggable||t&&typeof i.draggable>"u")){let a=e.get(s);a&&r.set(s,{id:s,position:a.position||{x:0,y:0},distance:{x:n.x-a.internals.positionAbsolute.x,y:n.y-a.internals.positionAbsolute.y},extent:a.extent,parentId:a.parentId,origin:a.origin,expandParent:a.expandParent,internals:{positionAbsolute:a.internals.positionAbsolute||{x:0,y:0}},measured:{width:a.measured.width??0,height:a.measured.height??0}})}return r}function $t({nodeId:e,dragItems:t,nodeLookup:n,dragging:o=!0}){let r=[];for(let[i,a]of t){let f=n.get(i)?.internals.userNode;f&&r.push({...f,position:a.position,dragging:o})}if(!e)return[r[0],r];let s=n.get(e)?.internals.userNode;return[s?{...s,position:t.get(e)?.position||s.position,dragging:o}:r[0],r]}function js({dragItems:e,snapGrid:t,x:n,y:o}){let r=e.values().next().value;if(!r)return null;let s={x:n-r.distance.x,y:o-r.distance.y},i=He(s,t);return{x:i.x-s.x,y:i.y-s.y}}function oo({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:o,onDragStop:r}){let s={x:null,y:null},i=0,a=new Map,f=!1,l={x:0,y:0},g=null,c=!1,d=null,h=!1,p=!1,y=null;function m({noDragClassName:b,handleSelector:u,domNode:w,isSelectable:N,nodeId:S,nodeClickDistance:_=0}){d=Xe(w);function I({x:M,y:A}){let{nodeLookup:H,nodeExtent:z,snapGrid:O,snapToGrid:$,nodeOrigin:P,onNodeDrag:D,onSelectionDrag:V,onError:B,updateNodePositions:L}=t();s={x:M,y:A};let Y=!1,X=a.size>1,U=X&&z?Lt(Ae(a)):null,J=X&&$?js({dragItems:a,snapGrid:O,x:M,y:A}):null;for(let[G,T]of a){if(!H.has(G))continue;let Z={x:M-T.distance.x,y:A-T.distance.y};$&&(Z=J?{x:Math.round(Z.x+J.x),y:Math.round(Z.y+J.y)}:He(Z,O));let Q=null;if(X&&z&&!T.extent&&U){let{positionAbsolute:K}=T.internals,ee=K.x-U.x+z[0][0],oe=K.x+T.measured.width-U.x2+z[1][0],te=K.y-U.y+z[0][1],ie=K.y+T.measured.height-U.y2+z[1][1];Q=[[ee,te],[oe,ie]]}let{position:q,positionAbsolute:W}=Xt({nodeId:G,nextPosition:Z,nodeLookup:H,nodeExtent:Q||z,nodeOrigin:P,onError:B});Y=Y||T.position.x!==q.x||T.position.y!==q.y,T.position=q,T.internals.positionAbsolute=W}if(p=p||Y,!!Y&&(L(a,!0),y&&(o||D||!S&&V))){let[G,T]=$t({nodeId:S,dragItems:a,nodeLookup:H});o?.(y,a,G,T),D?.(y,G,T),S||V?.(y,T)}}async function k(){if(!g)return;let{transform:M,panBy:A,autoPanSpeed:H,autoPanOnNodeDrag:z}=t();if(!z){f=!1,cancelAnimationFrame(i);return}let[O,$]=Zn(l,g,H);(O!==0||$!==0)&&(s.x=(s.x??0)-O/M[2],s.y=(s.y??0)-$/M[2],await A({x:O,y:$})&&I(s)),i=requestAnimationFrame(k)}function R(M){let{nodeLookup:A,multiSelectionActive:H,nodesDraggable:z,transform:O,snapGrid:$,snapToGrid:P,selectNodesOnDrag:D,onNodeDragStart:V,onSelectionDragStart:B,unselectNodesAndEdges:L}=t();c=!0,(!D||!N)&&!H&&S&&(A.get(S)?.selected||L()),N&&D&&S&&e?.(S);let Y=We(M.sourceEvent,{transform:O,snapGrid:$,snapToGrid:P,containerBounds:g});if(s=Y,a=Qs(A,z,Y,S),a.size>0&&(n||V||!S&&B)){let[X,U]=$t({nodeId:S,dragItems:a,nodeLookup:A});n?.(M.sourceEvent,a,X,U),V?.(M.sourceEvent,X,U),S||B?.(M.sourceEvent,U)}}let C=Dt().clickDistance(_).on("start",M=>{let{domNode:A,nodeDragThreshold:H,transform:z,snapGrid:O,snapToGrid:$}=t();g=A?.getBoundingClientRect()||null,h=!1,p=!1,y=M.sourceEvent,H===0&&R(M),s=We(M.sourceEvent,{transform:z,snapGrid:O,snapToGrid:$,containerBounds:g}),l=le(M.sourceEvent,g)}).on("drag",M=>{let{autoPanOnNodeDrag:A,transform:H,snapGrid:z,snapToGrid:O,nodeDragThreshold:$,nodeLookup:P}=t(),D=We(M.sourceEvent,{transform:H,snapGrid:z,snapToGrid:O,containerBounds:g});if(y=M.sourceEvent,(M.sourceEvent.type==="touchmove"&&M.sourceEvent.touches.length>1||S&&!P.has(S))&&(h=!0),!h){if(!f&&A&&c&&(f=!0,k()),!c){let V=le(M.sourceEvent,g),B=V.x-l.x,L=V.y-l.y;Math.sqrt(B*B+L*L)>$&&R(M)}(s.x!==D.xSnapped||s.y!==D.ySnapped)&&a&&c&&(l=le(M.sourceEvent,g),I(D))}}).on("end",M=>{if(!(!c||h)&&(f=!1,c=!1,cancelAnimationFrame(i),a.size>0)){let{nodeLookup:A,updateNodePositions:H,onNodeDragStop:z,onSelectionDragStop:O}=t();if(p&&(H(a,!1),p=!1),r||z||!S&&O){let[$,P]=$t({nodeId:S,dragItems:a,nodeLookup:A,dragging:!1});r?.(M.sourceEvent,a,$,P),z?.(M.sourceEvent,$,P),S||O?.(M.sourceEvent,P)}}}).filter(M=>{let A=M.target;return!M.button&&(!b||!On(A,`.${b}`,w))&&(!u||On(A,u,w))});d.call(C)}function x(){d?.on(".drag",null)}return{update:m,destroy:x}}function Js(e,t,n){let o=[],r={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(let s of t.values())$e(r,_e(s))>0&&o.push(s);return o}var ei=250;function ti(e,t,n,o){let r=[],s=1/0,i=Js(e,n,t+ei);for(let a of i){let f=[...a.internals.handleBounds?.source??[],...a.internals.handleBounds?.target??[]];for(let l of f){if(o.nodeId===l.nodeId&&o.type===l.type&&o.id===l.id)continue;let{x:g,y:c}=xe(a,l,l.position,!0),d=Math.sqrt(Math.pow(g-e.x,2)+Math.pow(c-e.y,2));d>t||(d<s?(r=[{...l,x:g,y:c}],s=d):d===s&&r.push({...l,x:g,y:c}))}}if(!r.length)return null;if(r.length>1){let a=o.type==="source"?"target":"source";return r.find(f=>f.type===a)??r[0]}return r[0]}function ro(e,t,n,o,r,s=!1){let i=o.get(e);if(!i)return null;let a=r==="strict"?i.internals.handleBounds?.[t]:[...i.internals.handleBounds?.source??[],...i.internals.handleBounds?.target??[]],f=(n?a?.find(l=>l.id===n):a?.[0])??null;return f&&s?{...f,...xe(i,f,f.position,!0)}:f}function so(e,t){return e||(t?.classList.contains("target")?"target":t?.classList.contains("source")?"source":null)}function ni(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}var io=()=>!0;function oi(e,{connectionMode:t,connectionRadius:n,handleId:o,nodeId:r,edgeUpdaterType:s,isTarget:i,domNode:a,nodeLookup:f,lib:l,autoPanOnConnect:g,flowId:c,panBy:d,cancelConnection:h,onConnectStart:p,onConnect:y,onConnectEnd:m,isValidConnection:x=io,onReconnectEnd:b,updateConnection:u,getTransform:w,getFromHandle:N,autoPanSpeed:S,dragThreshold:_=1,handleDomNode:I}){let k=Qt(e.target),R=0,C,{x:M,y:A}=le(e),H=so(s,I),z=a?.getBoundingClientRect(),O=!1;if(!z||!H)return;let $=ro(r,H,o,f,t);if(!$)return;let P=le(e,z),D=!1,V=null,B=!1,L=null;function Y(){if(!g||!z)return;let[q,W]=Zn(P,z,S);d({x:q,y:W}),R=requestAnimationFrame(Y)}let X={...$,nodeId:r,type:H,position:$.position},U=f.get(r),G={inProgress:!0,isValid:null,from:xe(U,X,F.Left,!0),fromHandle:X,fromPosition:X.position,fromNode:U,to:P,toHandle:null,toPosition:Nn[X.position],toNode:null,pointer:P};function T(){O=!0,u(G),p?.(e,{nodeId:r,handleId:o,handleType:H})}_===0&&T();function Z(q){if(!O){let{x:ie,y:pe}=le(q),fe=ie-M,Ee=pe-A;if(!(fe*fe+Ee*Ee>_*_))return;T()}if(!N()||!X){Q(q);return}let W=w();P=le(q,z),C=ti(Oe(P,W,!1,[1,1]),n,f,X),D||(Y(),D=!0);let K=ao(q,{handle:C,connectionMode:t,fromNodeId:r,fromHandleId:o,fromType:i?"target":"source",isValidConnection:x,doc:k,lib:l,flowId:c,nodeLookup:f});L=K.handleDomNode,V=K.connection,B=ni(!!C,K.isValid);let ee=f.get(r),oe=ee?xe(ee,X,F.Left,!0):G.from,te={...G,from:oe,isValid:B,to:K.toHandle&&B?Ke({x:K.toHandle.x,y:K.toHandle.y},W):P,toHandle:K.toHandle,toPosition:B&&K.toHandle?K.toHandle.position:Nn[X.position],toNode:K.toHandle?f.get(K.toHandle.nodeId):null,pointer:P};u(te),G=te}function Q(q){if(!("touches"in q&&q.touches.length>0)){if(O){(C||L)&&V&&B&&y?.(V);let{inProgress:W,...K}=G,ee={...K,toPosition:G.toHandle?G.toPosition:null};m?.(q,ee),s&&b?.(q,ee)}h(),cancelAnimationFrame(R),D=!1,B=!1,V=null,L=null,k.removeEventListener("mousemove",Z),k.removeEventListener("mouseup",Q),k.removeEventListener("touchmove",Z),k.removeEventListener("touchend",Q)}}k.addEventListener("mousemove",Z),k.addEventListener("mouseup",Q),k.addEventListener("touchmove",Z),k.addEventListener("touchend",Q)}function ao(e,{handle:t,connectionMode:n,fromNodeId:o,fromHandleId:r,fromType:s,doc:i,lib:a,flowId:f,isValidConnection:l=io,nodeLookup:g}){let c=s==="target",d=t?i.querySelector(`.${a}-flow__handle[data-id="${f}-${t?.nodeId}-${t?.id}-${t?.type}"]`):null,{x:h,y:p}=le(e),y=i.elementFromPoint(h,p),m=y?.classList.contains(`${a}-flow__handle`)?y:d,x={handleDomNode:m,isValid:!1,connection:null,toHandle:null};if(m){let b=so(void 0,m),u=m.getAttribute("data-nodeid"),w=m.getAttribute("data-handleid"),N=m.classList.contains("connectable"),S=m.classList.contains("connectableend");if(!u||!b)return x;let _={source:c?u:o,sourceHandle:c?w:r,target:c?o:u,targetHandle:c?r:w};x.connection=_;let k=N&&S&&(n===ye.Strict?c&&b==="source"||!c&&b==="target":u!==o||w!==r);x.isValid=k&&l(_),x.toHandle=ro(u,b,w,g,n,!0)}return x}var yt={onPointerDown:oi,isValid:ao};function co({domNode:e,panZoom:t,getTransform:n,getViewScale:o}){let r=Xe(e);function s({translateExtent:a,width:f,height:l,zoomStep:g=1,pannable:c=!0,zoomable:d=!0,inversePan:h=!1}){let p=u=>{if(u.sourceEvent.type!=="wheel"||!t)return;let w=n(),N=u.sourceEvent.ctrlKey&&Le()?10:1,S=-u.sourceEvent.deltaY*(u.sourceEvent.deltaMode===1?.05:u.sourceEvent.deltaMode?1:.002)*g,_=w[2]*Math.pow(2,S*N);t.scaleTo(_)},y=[0,0],m=u=>{(u.sourceEvent.type==="mousedown"||u.sourceEvent.type==="touchstart")&&(y=[u.sourceEvent.clientX??u.sourceEvent.touches[0].clientX,u.sourceEvent.clientY??u.sourceEvent.touches[0].clientY])},x=u=>{let w=n();if(u.sourceEvent.type!=="mousemove"&&u.sourceEvent.type!=="touchmove"||!t)return;let N=[u.sourceEvent.clientX??u.sourceEvent.touches[0].clientX,u.sourceEvent.clientY??u.sourceEvent.touches[0].clientY],S=[N[0]-y[0],N[1]-y[1]];y=N;let _=o()*Math.max(w[2],Math.log(w[2]))*(h?-1:1),I={x:w[0]-S[0]*_,y:w[1]-S[1]*_},k=[[0,0],[f,l]];t.setViewportConstrained({x:I.x,y:I.y,zoom:w[2]},k,a)},b=At().on("start",m).on("zoom",c?x:null).on("zoom.wheel",d?p:null);r.call(b,{})}function i(){r.on("zoom",null)}return{update:s,destroy:i,pointer:zt}}var xt=e=>({x:e.x,y:e.y,zoom:e.k}),Ht=({x:e,y:t,zoom:n})=>_n.translate(e,t).scale(n),Me=(e,t)=>e.target.closest(`.${t}`),lo=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),ri=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,Ot=(e,t=0,n=ri,o=()=>{})=>{let r=typeof t=="number"&&t>0;return r||o(),r?e.transition().duration(t).ease(n).on("end",o):e},uo=e=>{let t=e.ctrlKey&&Le()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function si({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:o,panOnScrollMode:r,panOnScrollSpeed:s,zoomOnPinch:i,onPanZoomStart:a,onPanZoom:f,onPanZoomEnd:l}){return g=>{if(Me(g,t))return g.ctrlKey&&g.preventDefault(),!1;g.preventDefault(),g.stopImmediatePropagation();let c=n.property("__zoom").k||1;if(g.ctrlKey&&i){let m=zt(g),x=uo(g),b=c*Math.pow(2,x);o.scaleTo(n,b,m,g);return}let d=g.deltaMode===1?20:1,h=r===ge.Vertical?0:g.deltaX*d,p=r===ge.Horizontal?0:g.deltaY*d;!Le()&&g.shiftKey&&r!==ge.Vertical&&(h=g.deltaY*d,p=0),o.translateBy(n,-(h/c)*s,-(p/c)*s,{internal:!0});let y=xt(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(f?.(g,y),e.panScrollTimeout=setTimeout(()=>{l?.(g,y),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,a?.(g,y))}}function ii({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(o,r){let s=o.type==="wheel",i=!t&&s&&!o.ctrlKey,a=Me(o,e);if(o.ctrlKey&&s&&a&&o.preventDefault(),i||a)return null;o.preventDefault(),n.call(this,o,r)}}function ai({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return o=>{if(o.sourceEvent?.internal)return;let r=xt(o.transform);e.mouseButton=o.sourceEvent?.button||0,e.isZoomingOrPanning=!0,e.prevViewport=r,o.sourceEvent?.type==="mousedown"&&t(!0),n&&n?.(o.sourceEvent,r)}}function ci({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:o,onPanZoom:r}){return s=>{e.usedRightMouseButton=!!(n&&lo(t,e.mouseButton??0)),s.sourceEvent?.sync||o([s.transform.x,s.transform.y,s.transform.k]),r&&!s.sourceEvent?.internal&&r?.(s.sourceEvent,xt(s.transform))}}function li({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:o,onPanZoomEnd:r,onPaneContextMenu:s}){return i=>{if(!i.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,s&&lo(t,e.mouseButton??0)&&!e.usedRightMouseButton&&i.sourceEvent&&s(i.sourceEvent),e.usedRightMouseButton=!1,o(!1),r)){let a=xt(i.transform);e.prevViewport=a,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{r?.(i.sourceEvent,a)},n?150:0)}}}function di({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:o,panOnScroll:r,zoomOnDoubleClick:s,userSelectionActive:i,noWheelClassName:a,noPanClassName:f,lib:l,connectionInProgress:g}){return c=>{let d=e||t,h=n&&c.ctrlKey,p=c.type==="wheel";if(c.button===1&&c.type==="mousedown"&&(Me(c,`${l}-flow__node`)||Me(c,`${l}-flow__edge`)))return!0;if(!o&&!d&&!r&&!s&&!n||i||g&&!p||Me(c,a)&&p||Me(c,f)&&(!p||r&&p&&!e)||!n&&c.ctrlKey&&p)return!1;if(!n&&c.type==="touchstart"&&c.touches?.length>1)return c.preventDefault(),!1;if(!d&&!r&&!h&&p||!o&&(c.type==="mousedown"||c.type==="touchstart")||Array.isArray(o)&&!o.includes(c.button)&&c.type==="mousedown")return!1;let y=Array.isArray(o)&&o.includes(c.button)||!c.button||c.button<=1;return(!c.ctrlKey||p)&&y}}function fo({domNode:e,minZoom:t,maxZoom:n,translateExtent:o,viewport:r,onPanZoom:s,onPanZoomStart:i,onPanZoomEnd:a,onDraggingChange:f}){let l={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{x:0,y:0,zoom:0},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},g=e.getBoundingClientRect(),c=At().scaleExtent([t,n]).translateExtent(o),d=Xe(e).call(c);b({x:r.x,y:r.y,zoom:Pe(r.zoom,t,n)},[[0,0],[g.width,g.height]],o);let h=d.on("wheel.zoom"),p=d.on("dblclick.zoom");c.wheelDelta(uo);function y(C,M){return d?new Promise(A=>{c?.interpolate(M?.interpolate==="linear"?tt:nt).transform(Ot(d,M?.duration,M?.ease,()=>A(!0)),C)}):Promise.resolve(!1)}function m({noWheelClassName:C,noPanClassName:M,onPaneContextMenu:A,userSelectionActive:H,panOnScroll:z,panOnDrag:O,panOnScrollMode:$,panOnScrollSpeed:P,preventScrolling:D,zoomOnPinch:V,zoomOnScroll:B,zoomOnDoubleClick:L,zoomActivationKeyPressed:Y,lib:X,onTransformChange:U,connectionInProgress:J,paneClickDistance:G,selectionOnDrag:T}){H&&!l.isZoomingOrPanning&&x();let Z=z&&!Y&&!H;c.clickDistance(T?1/0:!ce(G)||G<0?0:G);let Q=Z?si({zoomPanValues:l,noWheelClassName:C,d3Selection:d,d3Zoom:c,panOnScrollMode:$,panOnScrollSpeed:P,zoomOnPinch:V,onPanZoomStart:i,onPanZoom:s,onPanZoomEnd:a}):ii({noWheelClassName:C,preventScrolling:D,d3ZoomHandler:h});if(d.on("wheel.zoom",Q,{passive:!1}),!H){let W=ai({zoomPanValues:l,onDraggingChange:f,onPanZoomStart:i});c.on("start",W);let K=ci({zoomPanValues:l,panOnDrag:O,onPaneContextMenu:!!A,onPanZoom:s,onTransformChange:U});c.on("zoom",K);let ee=li({zoomPanValues:l,panOnDrag:O,panOnScroll:z,onPaneContextMenu:A,onPanZoomEnd:a,onDraggingChange:f});c.on("end",ee)}let q=di({zoomActivationKeyPressed:Y,panOnDrag:O,zoomOnScroll:B,panOnScroll:z,zoomOnDoubleClick:L,zoomOnPinch:V,userSelectionActive:H,noPanClassName:M,noWheelClassName:C,lib:X,connectionInProgress:J});c.filter(q),L?d.on("dblclick.zoom",p):d.on("dblclick.zoom",null)}function x(){c.on("zoom",null)}async function b(C,M,A){let H=Ht(C),z=c?.constrain()(H,M,A);return z&&await y(z),new Promise(O=>O(z))}async function u(C,M){let A=Ht(C);return await y(A,M),new Promise(H=>H(A))}function w(C){if(d){let M=Ht(C),A=d.property("__zoom");(A.k!==C.zoom||A.x!==C.x||A.y!==C.y)&&c?.transform(d,M,null,{sync:!0})}}function N(){let C=d?Cn(d.node()):{x:0,y:0,k:1};return{x:C.x,y:C.y,zoom:C.k}}function S(C,M){return d?new Promise(A=>{c?.interpolate(M?.interpolate==="linear"?tt:nt).scaleTo(Ot(d,M?.duration,M?.ease,()=>A(!0)),C)}):Promise.resolve(!1)}function _(C,M){return d?new Promise(A=>{c?.interpolate(M?.interpolate==="linear"?tt:nt).scaleBy(Ot(d,M?.duration,M?.ease,()=>A(!0)),C)}):Promise.resolve(!1)}function I(C){c?.scaleExtent(C)}function k(C){c?.translateExtent(C)}function R(C){let M=!ce(C)||C<0?0:C;c?.clickDistance(M)}return{update:m,destroy:x,setViewport:u,setViewportConstrained:b,getViewport:N,scaleTo:S,scaleBy:_,setScaleExtent:I,setTranslateExtent:k,syncViewport:w,setClickDistance:R}}var be;(function(e){e.Line="line",e.Handle="handle"})(be||(be={}));function ui({width:e,prevWidth:t,height:n,prevHeight:o,affectsX:r,affectsY:s}){let i=e-t,a=n-o,f=[i>0?1:i<0?-1:0,a>0?1:a<0?-1:0];return i&&r&&(f[0]=f[0]*-1),a&&s&&(f[1]=f[1]*-1),f}function Ln(e){let t=e.includes("right")||e.includes("left"),n=e.includes("bottom")||e.includes("top"),o=e.includes("left"),r=e.includes("top");return{isHorizontal:t,isVertical:n,affectsX:o,affectsY:r}}function he(e,t){return Math.max(0,t-e)}function me(e,t){return Math.max(0,e-t)}function rt(e,t,n){return Math.max(0,t-e,e-n)}function Tn(e,t){return e?!t:t}function fi(e,t,n,o,r,s,i,a){let{affectsX:f,affectsY:l}=t,{isHorizontal:g,isVertical:c}=t,d=g&&c,{xSnapped:h,ySnapped:p}=n,{minWidth:y,maxWidth:m,minHeight:x,maxHeight:b}=o,{x:u,y:w,width:N,height:S,aspectRatio:_}=e,I=Math.floor(g?h-e.pointerX:0),k=Math.floor(c?p-e.pointerY:0),R=N+(f?-I:I),C=S+(l?-k:k),M=-s[0]*N,A=-s[1]*S,H=rt(R,y,m),z=rt(C,x,b);if(i){let P=0,D=0;f&&I<0?P=he(u+I+M,i[0][0]):!f&&I>0&&(P=me(u+R+M,i[1][0])),l&&k<0?D=he(w+k+A,i[0][1]):!l&&k>0&&(D=me(w+C+A,i[1][1])),H=Math.max(H,P),z=Math.max(z,D)}if(a){let P=0,D=0;f&&I>0?P=me(u+I,a[0][0]):!f&&I<0&&(P=he(u+R,a[1][0])),l&&k>0?D=me(w+k,a[0][1]):!l&&k<0&&(D=he(w+C,a[1][1])),H=Math.max(H,P),z=Math.max(z,D)}if(r){if(g){let P=rt(R/_,x,b)*_;if(H=Math.max(H,P),i){let D=0;!f&&!l||f&&!l&&d?D=me(w+A+R/_,i[1][1])*_:D=he(w+A+(f?I:-I)/_,i[0][1])*_,H=Math.max(H,D)}if(a){let D=0;!f&&!l||f&&!l&&d?D=he(w+R/_,a[1][1])*_:D=me(w+(f?I:-I)/_,a[0][1])*_,H=Math.max(H,D)}}if(c){let P=rt(C*_,y,m)/_;if(z=Math.max(z,P),i){let D=0;!f&&!l||l&&!f&&d?D=me(u+C*_+M,i[1][0])/_:D=he(u+(l?k:-k)*_+M,i[0][0])/_,z=Math.max(z,D)}if(a){let D=0;!f&&!l||l&&!f&&d?D=he(u+C*_,a[1][0])/_:D=me(u+(l?k:-k)*_,a[0][0])/_,z=Math.max(z,D)}}}k=k+(k<0?z:-z),I=I+(I<0?H:-H),r&&(d?R>C*_?k=(Tn(f,l)?-I:I)/_:I=(Tn(f,l)?-k:k)*_:g?(k=I/_,l=f):(I=k*_,f=l));let O=f?u+I:u,$=l?w+k:w;return{width:N+(f?-I:I),height:S+(l?-k:k),x:s[0]*I*(f?-1:1)+O,y:s[1]*k*(l?-1:1)+$}}var go={width:0,height:0,x:0,y:0},gi={...go,pointerX:0,pointerY:0,aspectRatio:1};function pi(e){return[[0,0],[e.measured.width,e.measured.height]]}function hi(e,t,n){let o=t.position.x+e.position.x,r=t.position.y+e.position.y,s=e.measured.width??0,i=e.measured.height??0,a=n[0]*s,f=n[1]*i;return[[o-a,r-f],[o+s-a,r+i-f]]}function po({domNode:e,nodeId:t,getStoreItems:n,onChange:o,onEnd:r}){let s=Xe(e),i={controlDirection:Ln("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function a({controlPosition:l,boundaries:g,keepAspectRatio:c,resizeDirection:d,onResizeStart:h,onResize:p,onResizeEnd:y,shouldResize:m}){let x={...go},b={...gi};i={boundaries:g,resizeDirection:d,keepAspectRatio:c,controlDirection:Ln(l)};let u,w=null,N=[],S,_,I,k=!1,R=Dt().on("start",C=>{let{nodeLookup:M,transform:A,snapGrid:H,snapToGrid:z,nodeOrigin:O,paneDomNode:$}=n();if(u=M.get(t),!u)return;w=$?.getBoundingClientRect()??null;let{xSnapped:P,ySnapped:D}=We(C.sourceEvent,{transform:A,snapGrid:H,snapToGrid:z,containerBounds:w});x={width:u.measured.width??0,height:u.measured.height??0,x:u.position.x??0,y:u.position.y??0},b={...x,pointerX:P,pointerY:D,aspectRatio:x.width/x.height},S=void 0,u.parentId&&(u.extent==="parent"||u.expandParent)&&(S=M.get(u.parentId),_=S&&u.extent==="parent"?pi(S):void 0),N=[],I=void 0;for(let[V,B]of M)if(B.parentId===t&&(N.push({id:V,position:{...B.position},extent:B.extent}),B.extent==="parent"||B.expandParent)){let L=hi(B,u,B.origin??O);I?I=[[Math.min(L[0][0],I[0][0]),Math.min(L[0][1],I[0][1])],[Math.max(L[1][0],I[1][0]),Math.max(L[1][1],I[1][1])]]:I=L}h?.(C,{...x})}).on("drag",C=>{let{transform:M,snapGrid:A,snapToGrid:H,nodeOrigin:z}=n(),O=We(C.sourceEvent,{transform:M,snapGrid:A,snapToGrid:H,containerBounds:w}),$=[];if(!u)return;let{x:P,y:D,width:V,height:B}=x,L={},Y=u.origin??z,{width:X,height:U,x:J,y:G}=fi(b,i.controlDirection,O,i.boundaries,i.keepAspectRatio,Y,_,I),T=X!==V,Z=U!==B,Q=J!==P&&T,q=G!==D&&Z;if(!Q&&!q&&!T&&!Z)return;if((Q||q||Y[0]===1||Y[1]===1)&&(L.x=Q?J:x.x,L.y=q?G:x.y,x.x=L.x,x.y=L.y,N.length>0)){let oe=J-P,te=G-D;for(let ie of N)ie.position={x:ie.position.x-oe+Y[0]*(X-V),y:ie.position.y-te+Y[1]*(U-B)},$.push(ie)}if((T||Z)&&(L.width=T&&(!i.resizeDirection||i.resizeDirection==="horizontal")?X:x.width,L.height=Z&&(!i.resizeDirection||i.resizeDirection==="vertical")?U:x.height,x.width=L.width,x.height=L.height),S&&u.expandParent){let oe=Y[0]*(L.width??0);L.x&&L.x<oe&&(x.x=oe,b.x=b.x-(L.x-oe));let te=Y[1]*(L.height??0);L.y&&L.y<te&&(x.y=te,b.y=b.y-(L.y-te))}let W=ui({width:x.width,prevWidth:V,height:x.height,prevHeight:B,affectsX:i.controlDirection.affectsX,affectsY:i.controlDirection.affectsY}),K={...x,direction:W};m?.(C,K)!==!1&&(k=!0,p?.(C,K),o(L,$))}).on("end",C=>{k&&(y?.(C,{...x}),r?.({...x}),k=!1)});s.call(R)}function f(){s.on(".drag",null)}return{update:a,destroy:f}}var E=Ze(Os()),v=Ze(et());function se(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let n=0,o;n<e.length;n++)(o=se(e[n]))!==""&&(t+=(t&&" ")+o);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var No=Ze(et(),1),ko=Ze(So(),1);var vo=e=>{let t,n=new Set,o=(g,c)=>{let d=typeof g=="function"?g(t):g;if(!Object.is(d,t)){let h=t;t=c??(typeof d!="object"||d===null)?d:Object.assign({},t,d),n.forEach(p=>p(t,h))}},r=()=>t,f={setState:o,getState:r,getInitialState:()=>l,subscribe:g=>(n.add(g),()=>n.delete(g)),destroy:()=>{(import.meta.env?import.meta.env.MODE:void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},l=t=e(o,r,f);return f},_o=e=>e?vo(e):vo;var{useDebugValue:Ai}=No.default,{useSyncExternalStoreWithSelector:$i}=ko.default,Hi=e=>e;function ln(e,t=Hi,n){let o=$i(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return Ai(o),o}var Co=(e,t)=>{let n=_o(e),o=(r,s=t)=>ln(n,r,s);return Object.assign(o,n),o},Mo=(e,t)=>e?Co(e,t):Co;function ne(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(let[o,r]of e)if(!Object.is(r,t.get(o)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(let o of e)if(!t.has(o))return!1;return!0}let n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(let o of n)if(!Object.prototype.hasOwnProperty.call(t,o)||!Object.is(e[o],t[o]))return!1;return!0}var Oi=Ze(Hs()),_t=(0,v.createContext)(null),Li=_t.Provider,jo=ae.error001();function j(e,t){let n=(0,v.useContext)(_t);if(n===null)throw new Error(jo);return ln(n,e,t)}function re(){let e=(0,v.useContext)(_t);if(e===null)throw new Error(jo);return(0,v.useMemo)(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}var Io={display:"none"},Ti={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},Jo="react-flow__node-desc",er="react-flow__edge-desc",Ri="react-flow__aria-live",Bi=e=>e.ariaLiveMessage,Vi=e=>e.ariaLabelConfig;function Fi({rfId:e}){let t=j(Bi);return(0,E.jsx)("div",{id:`${Ri}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:Ti,children:t})}function Yi({rfId:e,disableKeyboardA11y:t}){let n=j(Vi);return(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)("div",{id:`${Jo}-${e}`,style:Io,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),(0,E.jsx)("div",{id:`${er}-${e}`,style:Io,children:n["edge.a11yDescription.default"]}),!t&&(0,E.jsx)(Fi,{rfId:e})]})}var Ct=(0,v.forwardRef)(({position:e="top-left",children:t,className:n,style:o,...r},s)=>{let i=`${e}`.split("-");return(0,E.jsx)("div",{className:se(["react-flow__panel",n,...i]),style:o,ref:s,...r,children:t})});Ct.displayName="Panel";function Zi({proOptions:e,position:t="bottom-right"}){return e?.hideAttribution?null:(0,E.jsx)(Ct,{position:t,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://pro.reactflow.dev",children:(0,E.jsx)("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}var Xi=e=>{let t=[],n=[];for(let[,o]of e.nodeLookup)o.selected&&t.push(o.internals.userNode);for(let[,o]of e.edgeLookup)o.selected&&n.push(o);return{selectedNodes:t,selectedEdges:n}},wt=e=>e.id;function Wi(e,t){return ne(e.selectedNodes.map(wt),t.selectedNodes.map(wt))&&ne(e.selectedEdges.map(wt),t.selectedEdges.map(wt))}function Ki({onSelectionChange:e}){let t=re(),{selectedNodes:n,selectedEdges:o}=j(Xi,Wi);return(0,v.useEffect)(()=>{let r={nodes:n,edges:o};e?.(r),t.getState().onSelectionChangeHandlers.forEach(s=>s(r))},[n,o,e]),null}var Gi=e=>!!e.onSelectionChangeHandlers;function qi({onSelectionChange:e}){let t=j(Gi);return e||t?(0,E.jsx)(Ki,{onSelectionChange:e}):null}var tr=[0,0],Ui={x:0,y:0,zoom:1},Qi=["nodes","edges","defaultNodes","defaultEdges","onConnect","onConnectStart","onConnectEnd","onClickConnectStart","onClickConnectEnd","nodesDraggable","autoPanOnNodeFocus","nodesConnectable","nodesFocusable","edgesFocusable","edgesReconnectable","elevateNodesOnSelect","elevateEdgesOnSelect","minZoom","maxZoom","nodeExtent","onNodesChange","onEdgesChange","elementsSelectable","connectionMode","snapGrid","snapToGrid","translateExtent","connectOnClick","defaultEdgeOptions","fitView","fitViewOptions","onNodesDelete","onEdgesDelete","onDelete","onNodeDrag","onNodeDragStart","onNodeDragStop","onSelectionDrag","onSelectionDragStart","onSelectionDragStop","onMoveStart","onMove","onMoveEnd","noPanClassName","nodeOrigin","autoPanOnConnect","autoPanOnNodeDrag","onError","connectionRadius","isValidConnection","selectNodesOnDrag","nodeDragThreshold","connectionDragThreshold","onBeforeDelete","debug","autoPanSpeed","ariaLabelConfig","zIndexMode"],Po=[...Qi,"rfId"],ji=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges}),zo={translateExtent:De,nodeOrigin:tr,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function Ji(e){let{setNodes:t,setEdges:n,setMinZoom:o,setMaxZoom:r,setTranslateExtent:s,setNodeExtent:i,reset:a,setDefaultNodesAndEdges:f}=j(ji,ne),l=re();(0,v.useEffect)(()=>(f(e.defaultNodes,e.defaultEdges),()=>{g.current=zo,a()}),[]);let g=(0,v.useRef)(zo);return(0,v.useEffect)(()=>{for(let c of Po){let d=e[c],h=g.current[c];d!==h&&(typeof e[c]>"u"||(c==="nodes"?t(d):c==="edges"?n(d):c==="minZoom"?o(d):c==="maxZoom"?r(d):c==="translateExtent"?s(d):c==="nodeExtent"?i(d):c==="ariaLabelConfig"?l.setState({ariaLabelConfig:Wn(d)}):c==="fitView"?l.setState({fitViewQueued:d}):c==="fitViewOptions"?l.setState({fitViewOptions:d}):l.setState({[c]:d})))}g.current=e},Po.map(c=>e[c])),null}function Do(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function ea(e){let[t,n]=(0,v.useState)(e==="system"?null:e);return(0,v.useEffect)(()=>{if(e!=="system"){n(e);return}let o=Do(),r=()=>n(o?.matches?"dark":"light");return r(),o?.addEventListener("change",r),()=>{o?.removeEventListener("change",r)}},[e]),t!==null?t:Do()?.matches?"dark":"light"}var Ao=typeof document<"u"?document:null;function Qe(e=null,t={target:Ao,actInsideInputWithModifier:!0}){let[n,o]=(0,v.useState)(!1),r=(0,v.useRef)(!1),s=(0,v.useRef)(new Set([])),[i,a]=(0,v.useMemo)(()=>{if(e!==null){let l=(Array.isArray(e)?e:[e]).filter(c=>typeof c=="string").map(c=>c.replace("+",`
|
|
2
2
|
`).replace(`
|
|
3
3
|
|
|
4
4
|
`,`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{W as ye,X as be,c as he}from"./embed-page-chunk-
|
|
1
|
+
import{W as ye,X as be,c as he}from"./embed-page-chunk-CKUSXUKW.js";import{a as ce,c as ue,m as ge,n as O,q as Ae}from"./embed-page-chunk-JMTQCORF.js";import{g as ie,k as pe,n as le,s as me}from"./embed-page-chunk-R7TLHZR3.js";import{B as fe,ca as J}from"./embed-page-chunk-F7ZUYG42.js";import{a as C,e as U,f as D,g as $,k as q,n as se,o as de}from"./embed-page-chunk-L7TDL27M.js";import{a as N}from"./embed-page-chunk-QV7QAJ4N.js";import{i as Z,j as Ne,k as Oe,l as je,m as Fe}from"./embed-page-chunk-34RWKVD7.js";import{Ja as ae,M as oe}from"./embed-page-chunk-F7TA3LRH.js";import{a as re}from"./embed-page-chunk-R5QL57JJ.js";import{c as L,f as _}from"./embed-page-chunk-QBTAJ2YI.js";var Pe=L(z=>{"use strict";Object.defineProperty(z,"__esModule",{value:!0});z.default=void 0;var st={items_per_page:"\u6761/\u9875",jump_to:"\u8DF3\u81F3",jump_to_confirm:"\u786E\u5B9A",page:"\u9875",prev_page:"\u4E0A\u4E00\u9875",next_page:"\u4E0B\u4E00\u9875",prev_5:"\u5411\u524D 5 \u9875",next_5:"\u5411\u540E 5 \u9875",prev_3:"\u5411\u524D 3 \u9875",next_3:"\u5411\u540E 3 \u9875",page_size:"\u9875\u7801"},Vt=z.default=st});var We=L(G=>{"use strict";var dt=Ne().default;Object.defineProperty(G,"__esModule",{value:!0});G.default=void 0;var _e=dt(Oe()),pt=je(),lt=(0,_e.default)((0,_e.default)({},pt.commonLocale),{},{locale:"zh_CN",today:"\u4ECA\u5929",now:"\u6B64\u523B",backToToday:"\u8FD4\u56DE\u4ECA\u5929",ok:"\u786E\u5B9A",timeSelect:"\u9009\u62E9\u65F6\u95F4",dateSelect:"\u9009\u62E9\u65E5\u671F",weekSelect:"\u9009\u62E9\u5468",clear:"\u6E05\u9664",week:"\u5468",month:"\u6708",year:"\u5E74",previousMonth:"\u4E0A\u4E2A\u6708 (\u7FFB\u9875\u4E0A\u952E)",nextMonth:"\u4E0B\u4E2A\u6708 (\u7FFB\u9875\u4E0B\u952E)",monthSelect:"\u9009\u62E9\u6708\u4EFD",yearSelect:"\u9009\u62E9\u5E74\u4EFD",decadeSelect:"\u9009\u62E9\u5E74\u4EE3",previousYear:"\u4E0A\u4E00\u5E74 (Control\u952E\u52A0\u5DE6\u65B9\u5411\u952E)",nextYear:"\u4E0B\u4E00\u5E74 (Control\u952E\u52A0\u53F3\u65B9\u5411\u952E)",previousDecade:"\u4E0A\u4E00\u5E74\u4EE3",nextDecade:"\u4E0B\u4E00\u5E74\u4EE3",previousCentury:"\u4E0A\u4E00\u4E16\u7EAA",nextCentury:"\u4E0B\u4E00\u4E16\u7EAA",yearFormat:"YYYY\u5E74",cellDateFormat:"D",monthBeforeYear:!1}),Jt=G.default=lt});var ee=L(K=>{"use strict";Object.defineProperty(K,"__esModule",{value:!0});K.default=void 0;var ct={placeholder:"\u8BF7\u9009\u62E9\u65F6\u95F4",rangePlaceholder:["\u5F00\u59CB\u65F6\u95F4","\u7ED3\u675F\u65F6\u95F4"]},en=K.default=ct});var te=L(X=>{"use strict";var Le=Z().default;Object.defineProperty(X,"__esModule",{value:!0});X.default=void 0;var ut=Le(We()),mt=Le(ee()),xe={lang:Object.assign({placeholder:"\u8BF7\u9009\u62E9\u65E5\u671F",yearPlaceholder:"\u8BF7\u9009\u62E9\u5E74\u4EFD",quarterPlaceholder:"\u8BF7\u9009\u62E9\u5B63\u5EA6",monthPlaceholder:"\u8BF7\u9009\u62E9\u6708\u4EFD",weekPlaceholder:"\u8BF7\u9009\u62E9\u5468",rangePlaceholder:["\u5F00\u59CB\u65E5\u671F","\u7ED3\u675F\u65E5\u671F"],rangeYearPlaceholder:["\u5F00\u59CB\u5E74\u4EFD","\u7ED3\u675F\u5E74\u4EFD"],rangeMonthPlaceholder:["\u5F00\u59CB\u6708\u4EFD","\u7ED3\u675F\u6708\u4EFD"],rangeQuarterPlaceholder:["\u5F00\u59CB\u5B63\u5EA6","\u7ED3\u675F\u5B63\u5EA6"],rangeWeekPlaceholder:["\u5F00\u59CB\u5468","\u7ED3\u675F\u5468"]},ut.default),timePickerLocale:Object.assign({},mt.default)};xe.lang.ok="\u786E\u5B9A";var nn=X.default=xe});var ve=L(Q=>{"use strict";var ft=Z().default;Object.defineProperty(Q,"__esModule",{value:!0});Q.default=void 0;var gt=ft(te()),on=Q.default=gt.default});var Me=L(Y=>{"use strict";var V=Z().default;Object.defineProperty(Y,"__esModule",{value:!0});Y.default=void 0;var At=V(Pe()),ht=V(ve()),yt=V(te()),bt=V(ee()),w="${label}\u4E0D\u662F\u4E00\u4E2A\u6709\u6548\u7684${type}",Ct={locale:"zh-cn",Pagination:At.default,DatePicker:yt.default,TimePicker:bt.default,Calendar:ht.default,global:{placeholder:"\u8BF7\u9009\u62E9",close:"\u5173\u95ED"},Table:{filterTitle:"\u7B5B\u9009",filterConfirm:"\u786E\u5B9A",filterReset:"\u91CD\u7F6E",filterEmptyText:"\u65E0\u7B5B\u9009\u9879",filterCheckAll:"\u5168\u9009",filterSearchPlaceholder:"\u5728\u7B5B\u9009\u9879\u4E2D\u641C\u7D22",emptyText:"\u6682\u65E0\u6570\u636E",selectAll:"\u5168\u9009\u5F53\u9875",selectInvert:"\u53CD\u9009\u5F53\u9875",selectNone:"\u6E05\u7A7A\u6240\u6709",selectionAll:"\u5168\u9009\u6240\u6709",sortTitle:"\u6392\u5E8F",expand:"\u5C55\u5F00\u884C",collapse:"\u5173\u95ED\u884C",triggerDesc:"\u70B9\u51FB\u964D\u5E8F",triggerAsc:"\u70B9\u51FB\u5347\u5E8F",cancelSort:"\u53D6\u6D88\u6392\u5E8F"},Modal:{okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",justOkText:"\u77E5\u9053\u4E86"},Tour:{Next:"\u4E0B\u4E00\u6B65",Previous:"\u4E0A\u4E00\u6B65",Finish:"\u7ED3\u675F\u5BFC\u89C8"},Popconfirm:{cancelText:"\u53D6\u6D88",okText:"\u786E\u5B9A"},Transfer:{titles:["",""],searchPlaceholder:"\u8BF7\u8F93\u5165\u641C\u7D22\u5185\u5BB9",itemUnit:"\u9879",itemsUnit:"\u9879",remove:"\u5220\u9664",selectCurrent:"\u5168\u9009\u5F53\u9875",removeCurrent:"\u5220\u9664\u5F53\u9875",selectAll:"\u5168\u9009\u6240\u6709",deselectAll:"\u53D6\u6D88\u5168\u9009",removeAll:"\u5220\u9664\u5168\u90E8",selectInvert:"\u53CD\u9009\u5F53\u9875"},Upload:{uploading:"\u6587\u4EF6\u4E0A\u4F20\u4E2D",removeFile:"\u5220\u9664\u6587\u4EF6",uploadError:"\u4E0A\u4F20\u9519\u8BEF",previewFile:"\u9884\u89C8\u6587\u4EF6",downloadFile:"\u4E0B\u8F7D\u6587\u4EF6"},Empty:{description:"\u6682\u65E0\u6570\u636E"},Icon:{icon:"\u56FE\u6807"},Text:{edit:"\u7F16\u8F91",copy:"\u590D\u5236",copied:"\u590D\u5236\u6210\u529F",expand:"\u5C55\u5F00",collapse:"\u6536\u8D77"},Form:{optional:"\uFF08\u53EF\u9009\uFF09",defaultValidateMessages:{default:"\u5B57\u6BB5\u9A8C\u8BC1\u9519\u8BEF${label}",required:"\u8BF7\u8F93\u5165${label}",enum:"${label}\u5FC5\u987B\u662F\u5176\u4E2D\u4E00\u4E2A[${enum}]",whitespace:"${label}\u4E0D\u80FD\u4E3A\u7A7A\u5B57\u7B26",date:{format:"${label}\u65E5\u671F\u683C\u5F0F\u65E0\u6548",parse:"${label}\u4E0D\u80FD\u8F6C\u6362\u4E3A\u65E5\u671F",invalid:"${label}\u662F\u4E00\u4E2A\u65E0\u6548\u65E5\u671F"},types:{string:w,method:w,array:w,object:w,number:w,date:w,boolean:w,integer:w,float:w,regexp:w,email:w,url:w,hex:w},string:{len:"${label}\u987B\u4E3A${len}\u4E2A\u5B57\u7B26",min:"${label}\u6700\u5C11${min}\u4E2A\u5B57\u7B26",max:"${label}\u6700\u591A${max}\u4E2A\u5B57\u7B26",range:"${label}\u987B\u5728${min}-${max}\u5B57\u7B26\u4E4B\u95F4"},number:{len:"${label}\u5FC5\u987B\u7B49\u4E8E${len}",min:"${label}\u6700\u5C0F\u503C\u4E3A${min}",max:"${label}\u6700\u5927\u503C\u4E3A${max}",range:"${label}\u987B\u5728${min}-${max}\u4E4B\u95F4"},array:{len:"\u987B\u4E3A${len}\u4E2A${label}",min:"\u6700\u5C11${min}\u4E2A${label}",max:"\u6700\u591A${max}\u4E2A${label}",range:"${label}\u6570\u91CF\u987B\u5728${min}-${max}\u4E4B\u95F4"},pattern:{mismatch:"${label}\u4E0E\u6A21\u5F0F\u4E0D\u5339\u914D${pattern}"}}},Image:{preview:"\u9884\u89C8"},QRCode:{expired:"\u4E8C\u7EF4\u7801\u8FC7\u671F",refresh:"\u70B9\u51FB\u5237\u65B0",scanned:"\u5DF2\u626B\u63CF"},ColorPicker:{presetEmpty:"\u6682\u65E0",transparent:"\u65E0\u8272",singleColor:"\u5355\u8272",gradientColor:"\u6E10\u53D8\u8272"}},sn=Y.default=Ct});var Ue=L((pn,qe)=>{"use strict";qe.exports=Me()});var A=_(re());var y=class extends Error{code;retryable;status;constructor(t,n,r,i){super(n),this.name="AgentWebAppRuntimeClientError",this.code=t,this.retryable=r,this.status=i}};function x(){return new y("STREAM_FAILED","Stream failed",!0)}var He=new Set(["WEB_APP_NOT_FOUND","WEB_APP_DISABLED","USER_ID_REQUIRED","INVALID_USER_ID","PROJECT_NOT_ALLOWED","PROJECT_SELECTOR_DISABLED","MODEL_NOT_ALLOWED","FEATURE_DISABLED","THREAD_NOT_FOUND","STREAM_CONFLICT","STREAM_FAILED","INVALID_REQUEST","INTERNAL_ERROR"]);function v(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function T(e,t){return Object.keys(e).length===t.length&&t.every(r=>r in e)}function Be(e){return v(e)&&T(e,["code","message","retryable"])&&typeof e.code=="string"&&He.has(e.code)&&typeof e.message=="string"&&typeof e.retryable=="boolean"}function ze(e){if(!v(e))return!1;let t=e.data===void 0?["id","type","prompt"]:["id","type","prompt","data"];return T(e,t)&&typeof e.id=="string"&&typeof e.type=="string"&&typeof e.prompt=="string"&&(e.data===void 0||v(e.data))}var Ge=new Set([C.HUMAN,C.AI,C.TOOL,C.INTERRUPT,C.MESSAGE_COMPLETED,C.MESSAGE_FAILED,C.THREAD_IDLE]);function Ke(e,t){let n;try{n=JSON.parse(e)}catch{throw x()}if(!v(n)||typeof n.type!="string")throw x();if(Ge.has(n.type)||n.type==="error"&&v(n.data)&&!v(n.error)){let r=$(n,t);return r.length===0?[]:r}switch(n.type){case"message.delta":if(T(n,["type","text"])&&typeof n.text=="string")return[n];break;case"message.completed":if(T(n,["type","messageId"])&&typeof n.messageId=="string")return[n];break;case"tool.started":if(T(n,["type","id","name"])&&typeof n.id=="string"&&typeof n.name=="string")return[n];break;case"tool.completed":if(T(n,["type","id"])&&typeof n.id=="string")return[n];break;case"interrupt.created":if(T(n,["type","interrupt"])&&ze(n.interrupt))return[n];break;case"genui.render":if(T(n,["type","block"])&&U(n.block))return[n];break;case"error":if(T(n,["type","error"])&&Be(n.error))return[n];break;case"stream.completed":if(T(n,["type"]))return[n];break}throw x()}function Xe(e){return e instanceof Error&&e.name==="AbortError"}async function Ce(e,t){let n=D({allowGenUI:!0,allowInterrupts:!0}),r=e.getReader(),i=new TextDecoder,o="",a=!1,s=!1;try{for(;!a;){let d;try{d=await r.read()}catch(l){if(Xe(l))return;throw x()}d.done&&(s=!0);try{o+=i.decode(d.value,{stream:!d.done})}catch{throw x()}let h=o.split(/\r?\n\r?\n/);o=d.done?"":h.pop()??"";for(let l of h){let g=l.split(/\r?\n/).filter(f=>f==="data"||f.startsWith("data:")).map(f=>f==="data"?"":f.slice(5).replace(/^ /,""));if(g.length!==0){for(let f of Ke(g.join(`
|
|
2
2
|
`),n))if(await t(f),a=f.type==="stream.completed",a)break;if(a)break}}if(d.done)break}if(!a)throw x()}finally{if(!s)try{await r.cancel()}catch{}r.releaseLock()}}var Qe=new Set(["WEB_APP_NOT_FOUND","WEB_APP_DISABLED","USER_ID_REQUIRED","INVALID_USER_ID","PROJECT_NOT_ALLOWED","PROJECT_SELECTOR_DISABLED","MODEL_NOT_ALLOWED","FEATURE_DISABLED","THREAD_NOT_FOUND","STREAM_CONFLICT","STREAM_FAILED","RUN_CANCEL_UNAVAILABLE","RUN_CANCEL_STORE_UNAVAILABLE","INVALID_REQUEST","INTERNAL_ERROR"]);function c(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function b(e,t,n=[]){let r=Object.keys(e);return t.every(i=>i in e)&&r.every(i=>t.includes(i)||n.includes(i))}function p(e){return typeof e=="string"}function j(e){if(!c(e)||!b(e,["id","projectId","createdAt","updatedAt"],["label"])||!p(e.id)||!p(e.projectId)||e.label!==void 0&&!p(e.label)||!p(e.createdAt)||!p(e.updatedAt))return;let t=new Date(e.createdAt),n=new Date(e.updatedAt);if(!(Number.isNaN(t.getTime())||Number.isNaN(n.getTime())))return{id:e.id,projectId:e.projectId,...e.label===void 0?{}:{label:e.label},createdAt:t,updatedAt:n}}function we(e){if(!c(e)||e.success!==!1||!c(e.error))return!1;let t=e.error;return b(e,["success","error"])&&b(t,["code","message","retryable"])&&typeof t.code=="string"&&Qe.has(t.code)&&typeof t.message=="string"&&typeof t.retryable=="boolean"}function Ve(e){if(!c(e))return!1;let t=["projectSelector","modelSelector","threadManagement","attachments","hitl","genUI"];return b(e,t,["files"])&&t.every(n=>typeof e[n]=="boolean")&&(e.files===void 0||typeof e.files=="boolean")}function Ye(e){return Array.isArray(e)&&e.length<=6&&e.every(t=>c(t)&&b(t,["label","text"])&&p(t.label)&&t.label.length>=1&&t.label.length<=40&&p(t.text)&&t.text.length>=1&&t.text.length<=500)}function Je(e){return c(e)&&b(e,[],["title","welcomeMessage","primaryColor","quickPrompts"])&&(e.title===void 0||p(e.title))&&(e.welcomeMessage===void 0||p(e.welcomeMessage))&&(e.primaryColor===void 0||p(e.primaryColor))&&(e.quickPrompts===void 0||Ye(e.quickPrompts))}function Ze(e){if(!c(e)||!b(e,["webApp","projects","models"],["thread"])||!c(e.webApp))return;let t=e.webApp;if(!b(t,["id","name","assistant","defaultProjectId","features","appearance","identityAssurance"],["description","defaultModelKey"])||!p(t.id)||!p(t.name)||!p(t.defaultProjectId)||t.description!==void 0&&!p(t.description)||t.defaultModelKey!==void 0&&!p(t.defaultModelKey)||t.identityAssurance!=="unverified"||!c(t.assistant)||!b(t.assistant,["id","name"],["description"])||!p(t.assistant.id)||!p(t.assistant.name)||t.assistant.description!==void 0&&!p(t.assistant.description)||!Ve(t.features)||!Je(t.appearance)||!Array.isArray(e.projects)||!e.projects.every(r=>c(r)&&b(r,["id","name"])&&p(r.id)&&p(r.name))||!Array.isArray(e.models)||!e.models.every(r=>c(r)&&b(r,["key","label"])&&p(r.key)&&p(r.label)))return;let n=e.thread===void 0?void 0:j(e.thread);if(!(e.thread!==void 0&&!n))return{...e,...n?{thread:n}:{}}}function et(e){if(!c(e)||!b(e,["records","total"])||!Array.isArray(e.records)||typeof e.total!="number")return;let t=e.records.map(j);return t.every(n=>n!==void 0)?{records:t,total:e.total}:void 0}function tt(e){return c(e)&&p(e.id)&&(e.role==="human"||e.role==="ai")&&(e.content===void 0||p(e.content)||Array.isArray(e.content)&&e.content.every(t=>U(t)!==void 0))}function nt(e){return c(e)&&b(e,["messages"])&&Array.isArray(e.messages)&&e.messages.every(tt)?e:void 0}function rt(e){return c(e)&&b(e,["ref","name","mimeType","size"])&&p(e.ref)&&p(e.name)&&p(e.mimeType)&&typeof e.size=="number"?e:void 0}function Ee(e,t){return n=>c(n)&&b(n,e)&&t(n)?n:void 0}function ot(e){let t=c(e.payload)?e.payload:{},n=typeof t.prompt=="string"?t.prompt:typeof t.message=="string"?t.message:"Input required";return{id:e.interruptId,type:e.type,prompt:n,...c(t.data)?{data:t.data}:{}}}var F=class{constructor(t){this.options=t;this.baseUrl=`${t.gatewayUrl.replace(/\/+$/,"")}/api/web-apps/${encodeURIComponent(t.webAppId)}/runtime`,this.fetchImplementation=t.fetch??globalThis.fetch.bind(globalThis),this.translate=t.translate}baseUrl;fetchImplementation;translate;async bootstrap(t={},n){return this.request("bootstrap",Ze,{query:t,signal:n})}async listThreads(t={},n){return this.request("threads",et,{query:t,signal:n})}async createThread(t={},n){return this.request("threads",j,{method:"POST",body:t,signal:n})}async updateThread(t,n,r){return this.request(`threads/${encodeURIComponent(t)}`,j,{method:"PATCH",body:n,signal:r})}async deleteThread(t,n={},r){await this.request(`threads/${encodeURIComponent(t)}`,Ee(["id"],i=>p(i.id)),{method:"DELETE",query:n,signal:r})}async getMessages(t,n={},r){return this.request(`threads/${encodeURIComponent(t)}/messages`,nt,{query:n,signal:r})}async streamMessage(t,n,r,i){return this.streamRequest(`threads/${encodeURIComponent(t)}/messages/stream`,n,r,i)}async resumeInterrupt(t,n,r,i,o){return this.streamRequest(`threads/${encodeURIComponent(t)}/interrupts/${encodeURIComponent(n)}/resume`,r,i,o)}async streamRequest(t,n,r,i){let o;try{o=await this.fetchRequest(t,{method:"POST",body:n,signal:i})}catch(a){throw Re(a)||a instanceof y?a:new y("STREAM_FAILED",this.translate?.("integration.error.streamFailed")??"Stream failed",!0)}if(o.ok||await this.throwResponseError(o),!o.body||!o.headers.get("content-type")?.toLowerCase().includes("text/event-stream")){if(o.body)try{await o.body.cancel()}catch{}throw new y("STREAM_FAILED",this.translate?.("integration.error.streamFailed")??"Stream failed",!0,o.status)}await Ce(o.body,r)}async commandsRunStart(t,n,r,i={},o){return this.request(`api/assistants/${encodeURIComponent(t)}/threads/${encodeURIComponent(n)}/commands`,a=>c(a)&&typeof a.messageId=="string"?{messageId:a.messageId}:void 0,{method:"POST",query:i,body:{command:"run.start",args:r},signal:o})}async commandsRespond(t,n,r,i={},o){return this.request(`api/assistants/${encodeURIComponent(t)}/threads/${encodeURIComponent(n)}/commands`,a=>{if(!c(a)||typeof a.messageId!="string"||typeof a.interruptId!="string")return;let s=typeof a.accepted=="boolean"?a.accepted:void 0,d=typeof a.commandId=="string"?a.commandId:void 0;return{messageId:a.messageId,interruptId:a.interruptId,...s===void 0?{}:{accepted:s},...d===void 0?{}:{commandId:d}}},{method:"POST",query:i,body:{command:"input.respond",args:r},signal:o})}async getThreadStatus(t,n,r={},i){return this.request(`api/assistants/${encodeURIComponent(t)}/threads/${encodeURIComponent(n)}/status`,o=>c(o)&&typeof o.status=="string"&&typeof o.pendingMessages=="number"&&Array.isArray(o.interrupts)?{status:o.status,pendingMessages:o.pendingMessages,interrupts:o.interrupts.map(a=>ot(a))}:void 0,{query:r,signal:i})}async streamThreadEvents(t,n,r,i,o){let a=await this.fetchRequest(`api/assistants/${encodeURIComponent(t)}/threads/${encodeURIComponent(n)}/stream/events`,{method:"POST",query:{projectId:r.projectId,modelKey:r.modelKey},body:{channels:["messages","tools","input","lifecycle"],...r.since?{since:r.since}:{}},signal:o});if(a.ok||await this.throwResponseError(a),!a.body)throw new y("STREAM_FAILED",this.translate?.("integration.error.streamFailed")??"Stream failed",!0,a.status);let s=D({allowInterrupts:r.allowInterrupts??!0,allowGenUI:r.allowGenUI??!1}),d=new TextDecoder,h="",l=!1,g=a.body.getReader();try{for(;;){let{done:f,value:S}=await g.read();if(f)break;h+=d.decode(S,{stream:!0});let k=h.indexOf(`
|
|
3
3
|
|
|
4
4
|
`);for(;k>=0;){let W=h.slice(0,k);h=h.slice(k+2),k=h.indexOf(`
|