@decido/shell 4.0.3 → 4.0.4
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/CenterComposite-V3LL23PG.mjs +64 -0
- package/dist/DebugPanel-NFXQOZQ6.mjs +1 -0
- package/dist/MorphShell-4JGDAN46.mjs +1 -0
- package/dist/PlaygroundAppSidebar-QI73PNRI.mjs +1 -0
- package/dist/PlaygroundChat-CBIIQMWU.mjs +1 -0
- package/dist/PlaygroundTerminal-MVZKXTYW.mjs +1 -0
- package/dist/PluginSandbox-MUNBFWGH.mjs +1 -0
- package/dist/ReactFlowEditor-2ALQWCHQ.mjs +6 -0
- package/dist/ReactFlowEditor-ROZ6RF3K.css +1 -0
- package/dist/TimelineEditor-UPRRXXVM.mjs +3 -0
- package/dist/WidgetSlotPanel-YX2VBQAP.mjs +1 -0
- package/dist/chunk-3YEFIKFH.mjs +1 -0
- package/dist/chunk-53FADIUX.mjs +1 -0
- package/dist/chunk-5FWJFDER.mjs +285 -0
- package/dist/chunk-6K3AFDP5.mjs +1 -0
- package/dist/chunk-AGAAZ2MU.mjs +1 -0
- package/dist/chunk-BCP43BRV.mjs +2 -0
- package/dist/chunk-BSJBW64M.mjs +1 -0
- package/dist/chunk-C5FD536O.mjs +1 -0
- package/dist/chunk-DTH34ILQ.mjs +1 -0
- package/dist/chunk-DWP77YZU.mjs +1 -0
- package/dist/chunk-O3OWL3Q2.mjs +1 -0
- package/dist/chunk-POBZMHZ5.mjs +7 -0
- package/dist/chunk-S3AQ4QDD.mjs +42 -0
- package/dist/chunk-XDA6ZRIQ.mjs +1 -0
- package/dist/chunk-XTDMHHMW.mjs +5 -0
- package/dist/chunk-YAYNNUEX.mjs +12 -0
- package/dist/chunk-YEKQJ4YC.mjs +1 -0
- package/dist/chunk-YHFKY5MB.mjs +1 -0
- package/dist/chunk-ZKD74U4X.mjs +1 -0
- package/dist/index.css +1 -561
- package/dist/index.js +462 -65086
- package/dist/index.mjs +50 -40209
- package/dist/useIntentLens-OCAUBNOQ.mjs +1 -0
- package/dist/useSuggestionsStore-Q4KVPU7L.mjs +1 -0
- package/dist/wasm-A4BTVJWV.mjs +1 -0
- package/package.json +15 -15
- package/dist/CenterComposite-RPEGBKQU.mjs +0 -1697
- package/dist/DebugPanel-KEKDMHDN.mjs +0 -14
- package/dist/MorphShell-FKDBB7E5.mjs +0 -14
- package/dist/PlaygroundAppSidebar-ALYJJGAO.mjs +0 -9
- package/dist/PlaygroundChat-MI2KXMK6.mjs +0 -15
- package/dist/PlaygroundTerminal-5AV4BJAI.mjs +0 -7
- package/dist/PluginSandbox-WMNAUQOJ.mjs +0 -188
- package/dist/ReactFlowEditor-RTF2652X.mjs +0 -3574
- package/dist/ReactFlowEditor-ZW5MCN5Y.css +0 -561
- package/dist/TimelineEditor-N4HRMHTB.mjs +0 -226
- package/dist/WidgetSlotPanel-KJI4CHHD.mjs +0 -11
- package/dist/chunk-2YMI4N5I.mjs +0 -2004
- package/dist/chunk-3BZX7LF2.mjs +0 -139
- package/dist/chunk-3P4P3M54.mjs +0 -136
- package/dist/chunk-F3OTFHNO.mjs +0 -40
- package/dist/chunk-IMHORBTL.mjs +0 -48
- package/dist/chunk-JF5QSJYT.mjs +0 -295
- package/dist/chunk-LWMMFTJC.mjs +0 -382
- package/dist/chunk-MSVEFEXE.mjs +0 -179
- package/dist/chunk-OCHGY2MN.mjs +0 -1662
- package/dist/chunk-PMYAM764.mjs +0 -813
- package/dist/chunk-Q64KZXPK.mjs +0 -43
- package/dist/chunk-QHQW2HMU.mjs +0 -155
- package/dist/chunk-RWZ4BOIN.mjs +0 -385
- package/dist/chunk-UHT6FIYF.mjs +0 -195
- package/dist/chunk-UJCSKKID.mjs +0 -30
- package/dist/chunk-V3CYNPGL.mjs +0 -8758
- package/dist/chunk-VBPGEFNM.mjs +0 -2381
- package/dist/chunk-XMSU6UWD.mjs +0 -158
- package/dist/chunk-ZCCCBHE6.mjs +0 -55
- package/dist/useIntentLens-LEQCAXCK.mjs +0 -13
- package/dist/useSuggestionsStore-4L2AIZ2D.mjs +0 -7
- package/dist/wasm-QFXGEYGP.mjs +0 -81
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{b as L}from"./chunk-AGAAZ2MU.mjs";import D from"react";import d from"react";import{RefreshCw as q,X as A,AlertTriangle as j,Wifi as F,WifiOff as H}from"lucide-react";import{Fragment as ae,jsx as s,jsxs as o}from"react/jsx-runtime";var P=class{data={};listeners=new Set;set(e,r){this.data[e]=r,this.listeners.forEach(a=>a())}resolve(e){let r=e.split("."),a=this.data;for(let n of r){if(a==null)return;a=a[n]}return a}merge(e){Object.assign(this.data,e),this.listeners.forEach(r=>r())}subscribe(e){return this.listeners.add(e),()=>this.listeners.delete(e)}},w=new P;w.merge({sentinel:{metrics:{eventsPerMin:1247,avgLatency:23,uptime:99.7,errorCount:2},events:[{time:"10:23:01",type:"pageload",path:"/dashboard",duration:142},{time:"10:22:58",type:"api",path:"/api/nodes",duration:89},{time:"10:22:45",type:"click",path:"sidebar",duration:3},{time:"10:22:30",type:"session",path:"user:admin",duration:0}],errors:[{message:"TypeError: Cannot read properties of undefined",source:"IssueList.tsx:11:39",ago:"3 min",severity:"error"},{message:"Warning: defaultProps deprecated",source:"recharts.js:28626",ago:"15 min",severity:"warning"}],sessions:{today:3,recording:!0}}});var T=class{iframe=null;handlers=new Map;themeObserver=null;attach(e){this.iframe=e,window.addEventListener("message",this.onMessage),this.themeObserver=new MutationObserver(()=>{let r=document.documentElement.classList.contains("dark");this.emit("theme:changed",r?"dark":"light")}),this.themeObserver.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]})}detach(){window.removeEventListener("message",this.onMessage),this.themeObserver?.disconnect(),this.themeObserver=null,this.iframe=null}onRequest(e,r){this.handlers.set(e,r)}emit(e,r){this.iframe?.contentWindow?.postMessage({type:"DECIDO_HOST_EVENT",topic:e,payload:r},"*")}onMessage=e=>{if(!this.iframe||e.source!==this.iframe.contentWindow)return;let r=e.data;if(r?.type==="DECIDO_PLUGIN_REQUEST"&&r.action){let a=this.handlers.get(r.action);if(a)try{let n=a(r.payload);n instanceof Promise?n.then(i=>this.respond(r.requestId,i)).catch(i=>this.respond(r.requestId,{error:String(i)})):this.respond(r.requestId,n)}catch(n){console.error("[Bridge] Handler error:",n),this.respond(r.requestId,{error:String(n)})}else console.warn(`[Bridge] No handler for action: ${r.action}`)}};respond(e,r){e&&this.iframe?.contentWindow?.postMessage({type:"DECIDO_PLUGIN_RESPONSE",requestId:e,payload:r},"*")}},$=class extends d.Component{state={hasError:!1};static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e,r){console.error(`[Widget:${this.props.widgetId}] Crash:`,e,r)}render(){return this.state.hasError?o("div",{className:"w-full h-full flex flex-col items-center justify-center bg-surface-primary gap-3 p-6",children:[s("div",{className:"w-14 h-14 rounded-2xl bg-red-500/10 border border-red-500/20 flex items-center justify-center",children:s(j,{className:"w-7 h-7 text-red-400"})}),s("p",{className:"text-sm font-semibold text-text-primary",children:"Widget Crashed"}),s("p",{className:"text-xs text-text-muted text-center max-w-[280px] font-mono bg-surface-glass px-3 py-2 rounded-lg",children:this.state.error?.message||"Unknown error"}),s("button",{onClick:()=>{this.setState({hasError:!1,error:void 0}),this.props.onReset?.()},className:"px-4 py-1.5 rounded-lg text-xs font-medium bg-surface-glass hover:bg-surface-elevated border border-border-subtle transition-colors",children:"Retry"})]}):this.props.children}};function _({widget:t,onClose:e,className:r=""}){return s($,{widgetId:t.id,children:t.url?s(J,{widget:t,onClose:e,className:r}):t.schema?s(K,{widget:t,onClose:e,className:r}):t.scriptUrl?s(G,{widget:t,onClose:e,className:r}):t.component?s(V,{widget:t,onClose:e,className:r}):s("div",{className:`w-full h-full flex items-center justify-center text-text-muted ${r}`,children:o("p",{className:"text-xs",children:['Widget "',t.title,'" has no schema, URL, scriptUrl, or component']})})})}function V({widget:t,onClose:e,className:r=""}){let a=t.component;return o("div",{className:`w-full h-full flex flex-col bg-surface-primary ${r} min-w-0 min-h-0`,children:[s(E,{label:"OPTION D \xB7 NATIVE",color:"emerald",title:t.title,onClose:e,children:s("div",{className:"flex items-center gap-1 px-1.5 py-0.5 rounded bg-emerald-500/10 border border-emerald-500/20",children:s("span",{className:"text-[9px] text-emerald-400 font-mono",children:"REACT"})})}),s("div",{className:"flex-1 min-h-0 min-w-0 overflow-y-auto overflow-x-auto bg-surface-primary rr-block relative","data-rr-block":!0,children:s(d.Suspense,{fallback:s(z,{title:t.title,color:"emerald"}),children:s(a,{})})})]})}function G({widget:t,onClose:e,className:r=""}){let[a,n]=d.useState("idle"),[i,c]=d.useState(0),[g,m]=d.useState(null),p=d.useRef(null);d.useEffect(()=>()=>{p.current&&(p.current.destroy(),p.current=null)},[]);let f=d.useCallback(async()=>{try{n("running"),m(null);let l=t.scriptUrl||"";if(l.startsWith("wasm://")){let x=l.replace("wasm://","").split("/"),R=x[0],S=x[1]||"run",{runWasmPlugin:O}=await import("./wasm-A4BTVJWV.mjs"),I=await O(R,S);console.log(`[WASM] Plugin "${R}.${S}" result:`,I),c(C=>C+1),n("stopped");return}let{PluginSandbox:u}=await import("./PluginSandbox-MUNBFWGH.mjs"),b=new u({pluginId:t.pluginId,pluginUrl:l,tenantId:"default",permissions:t.permissions||[]});b.onRpcRequest=async(x,R)=>new Promise((S,O)=>{let I=`headless-${Date.now()}-${Math.random().toString(36).slice(2)}`,C=k=>{k.data?.reqId===I&&(window.removeEventListener("message",C),k.data.error?O(new Error(k.data.error)):S(k.data.result))};window.addEventListener("message",C),window.postMessage({type:"DECIDO_RPC",reqId:I,action:x,pluginId:t.pluginId,payload:R},window.location.origin)}),b.onError=x=>{m(x),n("error")},p.current=b,await b.start(),c(x=>x+1)}catch(l){n("error"),m(typeof l=="string"?l:l?.message||String(l)),console.error("[HeadlessWidget] Error:",l)}},[t]),N=d.useCallback(()=>{p.current&&(p.current.destroy(),p.current=null),n("stopped")},[]),y={idle:"bg-gray-500/20 text-gray-400",running:"bg-emerald-500/20 text-emerald-400",stopped:"bg-amber-500/20 text-amber-400",error:"bg-red-500/20 text-red-400"};return o("div",{className:`flex flex-col h-full ${r}`,children:[s(E,{title:t.title,label:"WORKER",color:"violet",onClose:e,children:s("div",{className:`flex items-center gap-1 px-1.5 py-0.5 rounded ${y[a]}`,children:s("span",{className:"text-[9px] font-mono uppercase",children:a})})}),o("div",{className:"flex-1 flex flex-col items-center justify-center gap-3 p-4",children:[o("div",{className:"text-center",children:[s("p",{className:"text-xs text-text-muted mb-1",children:"Worker Sandbox Plugin"}),s("p",{className:"text-[10px] text-text-disabled font-mono",children:t.scriptUrl})]}),o("div",{className:"flex gap-2",children:[s("button",{onClick:f,disabled:a==="running",className:"px-3 py-1.5 text-xs rounded bg-emerald-500/20 text-emerald-400 hover:bg-emerald-500/30 disabled:opacity-50 transition-colors",children:"\u25B6 Start"}),s("button",{onClick:N,disabled:a!=="running",className:"px-3 py-1.5 text-xs rounded bg-red-500/20 text-red-400 hover:bg-red-500/30 disabled:opacity-50 transition-colors",children:"\u25A0 Stop"})]}),i>0&&o("p",{className:"text-[10px] text-text-disabled",children:["Runs: ",i]}),g&&s("p",{className:"text-[10px] text-red-400 max-w-[200px] text-center",children:g})]})]})}function J({widget:t,onClose:e,className:r=""}){let a=d.useRef(null),n=d.useRef(new T),[i,c]=d.useState(!0),[g,m]=d.useState(!1),[p,f]=d.useState(!0);d.useEffect(()=>{if(!t.url)return;let l=new AbortController;return fetch(t.url,{mode:"no-cors",signal:l.signal}).then(()=>f(!0)).catch(()=>f(!1)),()=>l.abort()},[t.url]),d.useEffect(()=>{let l=n.current;return l.onRequest("getTheme",()=>document.documentElement.classList.contains("dark")?"dark":"light"),l.onRequest("getData",u=>w.resolve(u.path)),l.onRequest("navigate",u=>{console.log("[Bridge] Plugin requested navigation:",u.route)}),l.onRequest("requestAction",u=>(console.log("[Bridge] Action from plugin:",u.command),window.dispatchEvent(new CustomEvent("sdui:action",{detail:{command:u.command,payload:u.payload}})),{dispatched:!0})),l.onRequest("getWidgets",()=>{let u=window.__pluginWidgetStore;return u?{widgets:u.getVisible().map(b=>({id:b.id,title:b.title,pluginId:b.pluginId}))}:{widgets:[]}}),l.onRequest("openExternal",u=>(window.open(u.url,"_blank","noopener,noreferrer"),{opened:!0})),()=>l.detach()},[]),d.useEffect(()=>{c(!0),m(!1)},[t.url]);let N=()=>{c(!1),m(!1),a.current&&n.current.attach(a.current)},y=()=>{a.current&&(c(!0),m(!1),a.current.src=a.current.src)};return p?o("div",{className:`w-full h-full flex flex-col bg-surface-primary ${r}`,children:[s(E,{label:"OPTION B \xB7 IFRAME",color:"blue",title:t.title,onClose:e,onRefresh:y,children:o("div",{className:"flex items-center gap-1 px-1.5 py-0.5 rounded bg-blue-500/10 border border-blue-500/20",children:[s(F,{className:"w-2.5 h-2.5 text-blue-400"}),s("span",{className:"text-[9px] text-blue-400 font-mono",children:"BRIDGE"})]})}),o("div",{className:"flex-1 relative rr-block","data-rr-block":!0,children:[i&&s(z,{title:t.title,color:"blue"}),g&&s(Q,{url:t.url||"",onRetry:y}),s("iframe",{ref:a,src:t.url,className:"w-full h-full border-0 rr-block",onLoad:N,onError:()=>{c(!1),m(!0)},sandbox:"allow-scripts allow-same-origin allow-popups allow-forms allow-modals","data-rr-block":!0,title:t.title})]})]}):o("div",{className:`w-full h-full flex flex-col bg-surface-primary ${r}`,children:[s(E,{label:"OPTION B \xB7 IFRAME",color:"blue",title:t.title,onClose:e,onRefresh:()=>f(!0)}),o("div",{className:"flex-1 flex flex-col items-center justify-center gap-3",children:[s("div",{className:"w-14 h-14 rounded-2xl bg-amber-500/10 border border-amber-500/20 flex items-center justify-center",children:s(H,{className:"w-7 h-7 text-amber-400"})}),s("p",{className:"text-sm font-semibold text-text-primary",children:"Plugin Offline"}),o("p",{className:"text-xs text-text-muted",children:[t.url," no responde"]}),s("button",{onClick:()=>{f(!0)},className:"px-3 py-1.5 rounded-lg text-xs font-medium bg-surface-glass hover:bg-surface-elevated transition-colors",children:"Reintentar"})]})]})}function K({widget:t,onClose:e,className:r=""}){let[,a]=d.useReducer(n=>n+1,0);return d.useEffect(()=>w.subscribe(a),[]),o("div",{className:`w-full h-full flex flex-col bg-surface-primary overflow-hidden ${r}`,children:[s(E,{label:"OPTION A \xB7 SDUI",color:"emerald",title:t.title,onClose:e,children:s("div",{className:"flex items-center gap-1 px-1.5 py-0.5 rounded bg-emerald-500/10 border border-emerald-500/20",children:s("span",{className:"text-[9px] text-emerald-400 font-mono",children:"REACTIVE"})})}),s("div",{className:"flex-1 overflow-auto",children:t.schema&&s(U,{node:t.schema})})]})}function E({label:t,color:e,title:r,onClose:a,onRefresh:n,children:i}){let c={blue:"text-blue-400 bg-blue-400",emerald:"text-emerald-400 bg-emerald-400"},g=c[e]?.split(" ")[0]||"text-cyan-400",m=c[e]?.split(" ")[1]||"bg-cyan-400";return o("div",{className:"flex-none flex items-center justify-between px-3 py-1.5 bg-surface-secondary/80 backdrop-blur-sm border-b border-border-subtle",children:[o("div",{className:"flex items-center gap-2",children:[s("div",{className:`w-2 h-2 rounded-full ${m} animate-pulse`}),s("span",{className:`text-[10px] font-bold ${g} tracking-wider uppercase`,children:t}),s("span",{className:"text-xs font-medium text-text-primary",children:r}),i]}),o("div",{className:"flex items-center gap-1",children:[n&&s("button",{onClick:n,className:"p-1 rounded text-text-muted hover:text-text-primary hover:bg-surface-glass transition-colors",title:"Refresh",children:s(q,{className:"w-3 h-3"})}),a&&s("button",{onClick:a,className:"p-1 rounded text-text-muted hover:text-red-400 hover:bg-red-500/10 transition-colors",title:"Close",children:s(A,{className:"w-3 h-3"})})]})]})}function z({title:t,color:e}){return s("div",{className:"absolute inset-0 flex items-center justify-center bg-surface-primary z-10",children:o("div",{className:"flex flex-col items-center gap-2",children:[s("div",{className:`w-6 h-6 border-2 ${e==="blue"?"border-blue-500/20":"border-emerald-500/20"} rounded-full relative`,children:s("div",{className:`absolute inset-0 w-6 h-6 border-2 border-transparent border-t-current ${e==="blue"?"border-blue-400":"border-emerald-400"} rounded-full animate-spin`})}),o("p",{className:"text-[10px] text-text-muted",children:["Loading ",t,"..."]})]})})}function Q({url:t,onRetry:e}){return s("div",{className:"absolute inset-0 flex items-center justify-center bg-surface-primary z-10",children:o("div",{className:"text-center space-y-2",children:[s(A,{className:"w-8 h-8 text-red-400 mx-auto"}),o("p",{className:"text-xs text-text-muted",children:["Failed to load ",t]}),s("button",{onClick:e,className:"text-[10px] px-2 py-1 rounded bg-surface-glass hover:bg-surface-elevated transition-colors",children:"Retry"})]})})}var X=new Set(["div","span","p","h1","h2","h3","h4","h5","h6","button","a","img","ul","ol","li","table","thead","tbody","tr","th","td","form","input","textarea","select","option","label","section","article","nav","header","footer","main","aside"]),Y={MetricCard:Z,ProgressBar:ee,StatusBadge:te,EventList:re,ErrorList:se,Sparkline:ne};function U({node:t}){if(typeof t=="string")return s(ae,{children:t});if(!t||!t.type||t.conditional&&!w.resolve(t.conditional))return null;let e={...t.props};if(t.dataSource){let n=w.resolve(t.dataSource);if(n!==void 0){if(typeof n=="string"||typeof n=="number")return d.createElement(t.type,e,String(n));e={...e,data:n}}}if(t.onAction){let n=t.onAction;e.onClick=()=>{console.log(`[SDUI Action] ${n.command}`,n.payload),window.dispatchEvent(new CustomEvent("sdui:action",{detail:{command:n.command,payload:n.payload}}))},e.style={...e.style,cursor:"pointer"}}let r=Y[t.type];if(r)return s(r,{...e});if(!X.has(t.type))return o("div",{className:"p-2 border border-amber-500/20 rounded bg-amber-500/5 text-xs text-amber-400",children:["Unknown: ",t.type]});let a=t.children?.map((n,i)=>s(U,{node:n},i));return d.createElement(t.type,e,a)}function Z({label:t,value:e,unit:r,color:a="cyan",trend:n}){let i={cyan:"bg-cyan-900/30 border-cyan-500/20 text-cyan-400",emerald:"bg-emerald-900/30 border-emerald-500/20 text-emerald-400",amber:"bg-amber-900/30 border-amber-500/20 text-amber-400",red:"bg-red-900/30 border-red-500/20 text-red-400",blue:"bg-blue-900/30 border-blue-500/20 text-blue-400"},c={up:"\u2191",down:"\u2193",stable:"\u2192"},g={up:"text-emerald-400",down:"text-red-400",stable:"text-zinc-500"};return o("div",{className:`p-3 rounded-lg border text-center ${i[a]||i.cyan}`,children:[o("div",{className:"text-2xl font-bold flex items-center justify-center gap-1",children:[e,r&&s("span",{className:"text-sm opacity-60",children:r}),n&&s("span",{className:`text-sm ${g[n]}`,children:c[n]})]}),s("div",{className:"text-[10px] text-zinc-400 uppercase tracking-wider mt-1",children:t})]})}function ee({value:t,max:e=100,label:r,color:a="cyan"}){let n=Math.min(100,t/e*100),i={cyan:"bg-cyan-500",emerald:"bg-emerald-500",amber:"bg-amber-500",red:"bg-red-500"};return o("div",{className:"space-y-1",children:[r&&o("div",{className:"flex items-center justify-between text-xs",children:[s("span",{className:"text-zinc-400",children:r}),o("span",{className:"text-zinc-300 font-mono",children:[n.toFixed(0),"%"]})]}),s("div",{className:"h-2 rounded-full bg-zinc-800 overflow-hidden",children:s("div",{className:`h-full rounded-full transition-all duration-700 ${i[a]||i.cyan}`,style:{width:`${n}%`}})})]})}function te({status:t,label:e}){let r={online:"bg-emerald-500/10 border-emerald-500/20 text-emerald-400",offline:"bg-zinc-500/10 border-zinc-500/20 text-zinc-400",warning:"bg-amber-500/10 border-amber-500/20 text-amber-400",error:"bg-red-500/10 border-red-500/20 text-red-400"},a={online:"bg-emerald-400",offline:"bg-zinc-500",warning:"bg-amber-400",error:"bg-red-400"};return o("span",{className:`inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full border text-[10px] font-semibold uppercase tracking-wider ${r[t]}`,children:[s("span",{className:`w-1.5 h-1.5 rounded-full ${a[t]} ${t==="online"?"animate-pulse":""}`}),e||t]})}function re({data:t,maxItems:e=6}){let r=Array.isArray(t)?t.slice(0,e):[];if(r.length===0)return s("p",{className:"text-xs text-zinc-500 italic",children:"No events"});let a={pageload:"text-cyan-400",api:"text-blue-400",click:"text-emerald-400",session:"text-purple-400",error:"text-red-400"};return s("div",{className:"space-y-0.5",children:r.map((n,i)=>o("div",{className:"flex items-center gap-2 text-xs py-1.5 px-2 rounded hover:bg-white/[0.02] transition-colors",children:[s("span",{className:"text-zinc-600 font-mono text-[10px] w-16 shrink-0",children:n.time}),s("span",{className:`text-[10px] font-bold uppercase tracking-wider w-16 shrink-0 ${a[n.type]||"text-zinc-500"}`,children:n.type}),s("span",{className:"text-zinc-400 truncate",children:n.path}),n.duration>0&&o("span",{className:"ml-auto text-zinc-600 font-mono text-[10px] shrink-0",children:[n.duration,"ms"]})]},i))})}function se({data:t}){let e=Array.isArray(t)?t:[];return e.length===0?o("div",{className:"flex items-center gap-2 p-3 bg-emerald-900/10 rounded-lg border border-emerald-500/10",children:[s("span",{className:"text-emerald-400 text-sm",children:"\u2713"}),s("span",{className:"text-xs text-emerald-400",children:"No errors detected"})]}):s("div",{className:"space-y-2",children:e.map((r,a)=>{let n=r.severity==="error";return o("div",{className:`p-3 rounded-lg border space-y-1 ${n?"bg-red-900/10 border-red-500/20":"bg-amber-900/10 border-amber-500/20"}`,children:[o("div",{className:"flex items-center justify-between",children:[s("span",{className:`text-sm font-medium ${n?"text-red-400":"text-amber-400"}`,children:r.message}),s("span",{className:"text-[10px] text-zinc-500",children:r.ago})]}),s("div",{className:"text-xs text-zinc-500 font-mono",children:r.source})]},a)})})}function ne({data:t,color:e="cyan",height:r=32}){let a=Array.isArray(t)?t:[30,45,28,60,42,75,55,90,65,80],n=Math.max(...a),i=Math.min(...a),c=n-i||1,g=120,m=a.map((f,N)=>{let y=N/(a.length-1)*g,l=r-(f-i)/c*(r-4)-2;return`${y},${l}`}).join(" "),p={cyan:"#22d3ee",emerald:"#34d399",amber:"#fbbf24",red:"#f87171",blue:"#60a5fa"};return s("svg",{width:g,height:r,className:"inline-block align-middle",children:s("polyline",{points:m,fill:"none",stroke:p[e]||p.cyan,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}import{jsx as v,jsxs as W}from"react/jsx-runtime";var B="decido:activeWidgets",M=class{widgets=new Map;listeners=new Set;_activeId=null;persistTimer=null;register(e){this.widgets.set(e.id,{...e,visible:e.visible??!0}),this.notify(),this.persist()}remove(e){this.widgets.delete(e),this._activeId===e&&(this._activeId=null),this.notify(),this.persist()}clear(){this.widgets.clear(),this._activeId=null,this.notify(),this.persist()}setActive(e){this._activeId=e,this.notify(),this.persist()}get activeId(){return this._activeId}get size(){return this.widgets.size}getVisible(){return Array.from(this.widgets.values()).filter(e=>e.visible!==!1).sort((e,r)=>(e.order??100)-(r.order??100))}restoreFromPersistence(e){try{let r=localStorage.getItem(B);if(!r)return!1;let a=JSON.parse(r);if(!a?.widgets?.length)return!1;for(let n of a.widgets){let i=e(n.id);this.widgets.set(n.id,{...n,visible:!0,schema:i})}return this._activeId=a.activeId,this.notify(),console.log(`[WidgetStore] Restored ${a.widgets.length} widgets from persistence`),!0}catch(r){return console.warn("[WidgetStore] Restore failed:",r),!1}}subscribe(e){return this.listeners.add(e),()=>this.listeners.delete(e)}notify(){this.listeners.forEach(e=>e())}persist(){this.persistTimer&&clearTimeout(this.persistTimer),this.persistTimer=setTimeout(()=>{try{let e={widgets:Array.from(this.widgets.values()).map(r=>({id:r.id,pluginId:r.pluginId,title:r.title,icon:r.icon,slot:r.slot,url:r.url,order:r.order})),activeId:this._activeId};localStorage.setItem(B,JSON.stringify(e))}catch{}},300)}},h=new M;window.__pluginWidgetStore=h;function ie(){let[,t]=D.useReducer(e=>e+1,0);return D.useEffect(()=>h.subscribe(t),[]),{widgets:h.getVisible(),activeId:h.activeId}}function fe(){let{widgets:t,activeId:e}=ie(),r=e&&t.find(i=>i.id===e)||t[0],a=D.useCallback(i=>{h.remove(i),h.size===0&&L.getState().setSlot("R3",null)},[]),n=D.useCallback(()=>{h.clear(),L.getState().setSlot("R3",null)},[]);return t.length===0?W("div",{className:"w-full h-full flex flex-col items-center justify-center text-text-muted gap-3 bg-surface-primary",children:[v("div",{className:"w-12 h-12 rounded-xl bg-cyan-500/5 border border-cyan-500/10 flex items-center justify-center",children:v("span",{className:"text-xl",children:"\u{1F9E9}"})}),v("p",{className:"text-sm font-medium",children:"No widgets activos"}),v("p",{className:"text-xs opacity-60 max-w-[200px] text-center",children:"Selecciona un plugin del sidebar para ver widgets aqu\xED"})]}):W("div",{className:"w-full h-full flex flex-col bg-surface-primary overflow-hidden",children:[W("div",{className:"flex-none flex items-center gap-1 px-2 py-1 bg-surface-secondary border-b border-border-subtle overflow-x-auto",children:[t.map(i=>W("button",{onClick:()=>h.setActive(i.id),className:`px-2.5 py-1 rounded-md text-[10px] font-medium transition-all whitespace-nowrap ${r?.id===i.id?"bg-surface-glass text-text-primary border border-border-default":"text-text-muted hover:text-text-secondary hover:bg-surface-glass/50"}`,children:[i.icon&&v("span",{className:"mr-1",children:i.icon}),i.title]},i.id)),t.length>1&&v("button",{onClick:n,className:"ml-auto px-2 py-1 rounded-md text-[10px] text-text-muted hover:text-red-400 hover:bg-red-500/10 transition-all",title:"Close all widgets",children:"\u2715 All"})]}),r&&v("div",{className:"flex-1 min-h-0 min-w-0 overflow-hidden",children:v(_,{widget:r,onClose:()=>a(r.id)})})]})}export{h as a,fe as b};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as r}from"./chunk-YHFKY5MB.mjs";import{create as i}from"zustand";var n=new Map,c=i((t,p)=>({activeStage:null,stageHistory:[],setStage:e=>{r.morph(`setStage \u2192 ${e?.type||"null"}${e?.label?` (${e.label})`:""}`,e),t({activeStage:e})},pushStage:e=>{let{activeStage:a,stageHistory:o}=p();r.morph(`pushStage \u2192 ${e.type}${e.label?` (${e.label})`:""} | depth: ${o.length+1}`,{stage:e,previousStage:a?.type});let g=a?[...o,a]:o;t({activeStage:e,stageHistory:g})},popStage:()=>{let{stageHistory:e,activeStage:a}=p();if(e.length===0){r.morph("popStage \u2192 null (history empty)",{poppedStage:a?.type},"warn"),t({activeStage:null});return}let o=e[e.length-1];r.morph(`popStage \u2192 ${o.type}${o.label?` (${o.label})`:""} | depth: ${e.length-1}`,{poppedStage:a?.type,restoredStage:o.type}),t({activeStage:o,stageHistory:e.slice(0,-1)})},clearStages:()=>{r.morph("clearStages \u2192 all stages cleared",{previousDepth:p().stageHistory.length}),t({activeStage:null,stageHistory:[]})}}));function S(t,p){n.set(t,p)}function y(t){return n.get(t)}function h(){return Array.from(n.keys())}export{c as a,S as b,y as c,h as d};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
var ol={value:()=>{}};function hr(){for(var e=0,t=arguments.length,n={},o;e<t;++e){if(!(o=arguments[e]+"")||o in n||/[\s.]/.test(o))throw new Error("illegal type: "+o);n[o]=[]}return new an(n)}function an(e){this._=e}function rl(e,t){return e.trim().split(/^|\s+/).map(function(n){var o="",r=n.indexOf(".");if(r>=0&&(o=n.slice(r+1),n=n.slice(0,r)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:o}})}an.prototype=hr.prototype={constructor:an,on:function(e,t){var n=this._,o=rl(e+"",n),r,i=-1,s=o.length;if(arguments.length<2){for(;++i<s;)if((r=(e=o[i]).type)&&(r=il(n[r],e.name)))return r;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++i<s;)if(r=(e=o[i]).type)n[r]=fr(n[r],e.name,t);else if(t==null)for(r in n)n[r]=fr(n[r],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new an(e)},call:function(e,t){if((r=arguments.length-2)>0)for(var n=new Array(r),o=0,r,i;o<r;++o)n[o]=arguments[o+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(i=this._[e],o=0,r=i.length;o<r;++o)i[o].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var o=this._[e],r=0,i=o.length;r<i;++r)o[r].value.apply(t,n)}};function il(e,t){for(var n=0,o=e.length,r;n<o;++n)if((r=e[n]).name===t)return r.value}function fr(e,t,n){for(var o=0,r=e.length;o<r;++o)if(e[o].name===t){e[o]=ol,e=e.slice(0,o).concat(e.slice(o+1));break}return n!=null&&e.push({name:t,value:n}),e}var Ke=hr;var cn="http://www.w3.org/1999/xhtml",co={svg:"http://www.w3.org/2000/svg",xhtml:cn,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Ae(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),co.hasOwnProperty(t)?{space:co[t],local:e}:e}function sl(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===cn&&t.documentElement.namespaceURI===cn?t.createElement(e):t.createElementNS(n,e)}}function al(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function ln(e){var t=Ae(e);return(t.local?al:sl)(t)}function cl(){}function Ge(e){return e==null?cl:function(){return this.querySelector(e)}}function pr(e){typeof e!="function"&&(e=Ge(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var i=t[r],s=i.length,a=o[r]=new Array(s),l,c,u=0;u<s;++u)(l=i[u])&&(c=e.call(l,l.__data__,u,i))&&("__data__"in l&&(c.__data__=l.__data__),a[u]=c);return new se(o,this._parents)}function lo(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function ll(){return[]}function Pt(e){return e==null?ll:function(){return this.querySelectorAll(e)}}function ul(e){return function(){return lo(e.apply(this,arguments))}}function gr(e){typeof e=="function"?e=ul(e):e=Pt(e);for(var t=this._groups,n=t.length,o=[],r=[],i=0;i<n;++i)for(var s=t[i],a=s.length,l,c=0;c<a;++c)(l=s[c])&&(o.push(e.call(l,l.__data__,c,s)),r.push(l));return new se(o,r)}function zt(e){return function(){return this.matches(e)}}function un(e){return function(t){return t.matches(e)}}var dl=Array.prototype.find;function fl(e){return function(){return dl.call(this.children,e)}}function hl(){return this.firstElementChild}function mr(e){return this.select(e==null?hl:fl(typeof e=="function"?e:un(e)))}var pl=Array.prototype.filter;function gl(){return Array.from(this.children)}function ml(e){return function(){return pl.call(this.children,e)}}function yr(e){return this.selectAll(e==null?gl:ml(typeof e=="function"?e:un(e)))}function xr(e){typeof e!="function"&&(e=zt(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var i=t[r],s=i.length,a=o[r]=[],l,c=0;c<s;++c)(l=i[c])&&e.call(l,l.__data__,c,i)&&a.push(l);return new se(o,this._parents)}function dn(e){return new Array(e.length)}function wr(){return new se(this._enter||this._groups.map(dn),this._parents)}function At(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}At.prototype={constructor:At,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function br(e){return function(){return e}}function yl(e,t,n,o,r,i){for(var s=0,a,l=t.length,c=i.length;s<c;++s)(a=t[s])?(a.__data__=i[s],o[s]=a):n[s]=new At(e,i[s]);for(;s<l;++s)(a=t[s])&&(r[s]=a)}function xl(e,t,n,o,r,i,s){var a,l,c=new Map,u=t.length,d=i.length,f=new Array(u),p;for(a=0;a<u;++a)(l=t[a])&&(f[a]=p=s.call(l,l.__data__,a,t)+"",c.has(p)?r[a]=l:c.set(p,l));for(a=0;a<d;++a)p=s.call(e,i[a],a,i)+"",(l=c.get(p))?(o[a]=l,l.__data__=i[a],c.delete(p)):n[a]=new At(e,i[a]);for(a=0;a<u;++a)(l=t[a])&&c.get(f[a])===l&&(r[a]=l)}function wl(e){return e.__data__}function _r(e,t){if(!arguments.length)return Array.from(this,wl);var n=t?xl:yl,o=this._parents,r=this._groups;typeof e!="function"&&(e=br(e));for(var i=r.length,s=new Array(i),a=new Array(i),l=new Array(i),c=0;c<i;++c){var u=o[c],d=r[c],f=d.length,p=bl(e.call(u,u&&u.__data__,c,o)),g=p.length,w=a[c]=new Array(g),x=s[c]=new Array(g),m=l[c]=new Array(f);n(u,d,w,x,m,p,t);for(var _=0,h=0,y,E;_<g;++_)if(y=w[_]){for(_>=h&&(h=_+1);!(E=x[h])&&++h<g;);y._next=E||null}}return s=new se(s,o),s._enter=a,s._exit=l,s}function bl(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function vr(){return new se(this._exit||this._groups.map(dn),this._parents)}function Sr(e,t,n){var o=this.enter(),r=this,i=this.exit();return typeof e=="function"?(o=e(o),o&&(o=o.selection())):o=o.append(e+""),t!=null&&(r=t(r),r&&(r=r.selection())),n==null?i.remove():n(i),o&&r?o.merge(r).order():r}function Er(e){for(var t=e.selection?e.selection():e,n=this._groups,o=t._groups,r=n.length,i=o.length,s=Math.min(r,i),a=new Array(r),l=0;l<s;++l)for(var c=n[l],u=o[l],d=c.length,f=a[l]=new Array(d),p,g=0;g<d;++g)(p=c[g]||u[g])&&(f[g]=p);for(;l<r;++l)a[l]=n[l];return new se(a,this._parents)}function Nr(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var o=e[t],r=o.length-1,i=o[r],s;--r>=0;)(s=o[r])&&(i&&s.compareDocumentPosition(i)^4&&i.parentNode.insertBefore(s,i),i=s);return this}function Cr(e){e||(e=_l);function t(d,f){return d&&f?e(d.__data__,f.__data__):!d-!f}for(var n=this._groups,o=n.length,r=new Array(o),i=0;i<o;++i){for(var s=n[i],a=s.length,l=r[i]=new Array(a),c,u=0;u<a;++u)(c=s[u])&&(l[u]=c);l.sort(t)}return new se(r,this._parents).order()}function _l(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function kr(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function Mr(){return Array.from(this)}function Ir(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var o=e[t],r=0,i=o.length;r<i;++r){var s=o[r];if(s)return s}return null}function Pr(){let e=0;for(let t of this)++e;return e}function zr(){return!this.node()}function Ar(e){for(var t=this._groups,n=0,o=t.length;n<o;++n)for(var r=t[n],i=0,s=r.length,a;i<s;++i)(a=r[i])&&e.call(a,a.__data__,i,r);return this}function vl(e){return function(){this.removeAttribute(e)}}function Sl(e){return function(){this.removeAttributeNS(e.space,e.local)}}function El(e,t){return function(){this.setAttribute(e,t)}}function Nl(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function Cl(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function kl(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function Dr(e,t){var n=Ae(e);if(arguments.length<2){var o=this.node();return n.local?o.getAttributeNS(n.space,n.local):o.getAttribute(n)}return this.each((t==null?n.local?Sl:vl:typeof t=="function"?n.local?kl:Cl:n.local?Nl:El)(n,t))}function fn(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function Ml(e){return function(){this.style.removeProperty(e)}}function Il(e,t,n){return function(){this.style.setProperty(e,t,n)}}function Pl(e,t,n){return function(){var o=t.apply(this,arguments);o==null?this.style.removeProperty(e):this.style.setProperty(e,o,n)}}function Tr(e,t,n){return arguments.length>1?this.each((t==null?Ml:typeof t=="function"?Pl:Il)(e,t,n??"")):Le(this.node(),e)}function Le(e,t){return e.style.getPropertyValue(t)||fn(e).getComputedStyle(e,null).getPropertyValue(t)}function zl(e){return function(){delete this[e]}}function Al(e,t){return function(){this[e]=t}}function Dl(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function $r(e,t){return arguments.length>1?this.each((t==null?zl:typeof t=="function"?Dl:Al)(e,t)):this.node()[e]}function Or(e){return e.trim().split(/^|\s+/)}function uo(e){return e.classList||new Hr(e)}function Hr(e){this._node=e,this._names=Or(e.getAttribute("class")||"")}Hr.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function Rr(e,t){for(var n=uo(e),o=-1,r=t.length;++o<r;)n.add(t[o])}function Lr(e,t){for(var n=uo(e),o=-1,r=t.length;++o<r;)n.remove(t[o])}function Tl(e){return function(){Rr(this,e)}}function $l(e){return function(){Lr(this,e)}}function Ol(e,t){return function(){(t.apply(this,arguments)?Rr:Lr)(this,e)}}function Br(e,t){var n=Or(e+"");if(arguments.length<2){for(var o=uo(this.node()),r=-1,i=n.length;++r<i;)if(!o.contains(n[r]))return!1;return!0}return this.each((typeof t=="function"?Ol:t?Tl:$l)(n,t))}function Hl(){this.textContent=""}function Rl(e){return function(){this.textContent=e}}function Ll(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function Vr(e){return arguments.length?this.each(e==null?Hl:(typeof e=="function"?Ll:Rl)(e)):this.node().textContent}function Bl(){this.innerHTML=""}function Vl(e){return function(){this.innerHTML=e}}function Fl(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function Fr(e){return arguments.length?this.each(e==null?Bl:(typeof e=="function"?Fl:Vl)(e)):this.node().innerHTML}function Xl(){this.nextSibling&&this.parentNode.appendChild(this)}function Xr(){return this.each(Xl)}function Yl(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Yr(){return this.each(Yl)}function Zr(e){var t=typeof e=="function"?e:ln(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function Zl(){return null}function Wr(e,t){var n=typeof e=="function"?e:ln(e),o=t==null?Zl:typeof t=="function"?t:Ge(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),o.apply(this,arguments)||null)})}function Wl(){var e=this.parentNode;e&&e.removeChild(this)}function qr(){return this.each(Wl)}function ql(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Kl(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Kr(e){return this.select(e?Kl:ql)}function Gr(e){return arguments.length?this.property("__data__",e):this.node().__data__}function Gl(e){return function(t){e.call(this,t,this.__data__)}}function Ul(e){return e.trim().split(/^|\s+/).map(function(t){var n="",o=t.indexOf(".");return o>=0&&(n=t.slice(o+1),t=t.slice(0,o)),{type:t,name:n}})}function Ql(e){return function(){var t=this.__on;if(t){for(var n=0,o=-1,r=t.length,i;n<r;++n)i=t[n],(!e.type||i.type===e.type)&&i.name===e.name?this.removeEventListener(i.type,i.listener,i.options):t[++o]=i;++o?t.length=o:delete this.__on}}}function Jl(e,t,n){return function(){var o=this.__on,r,i=Gl(t);if(o){for(var s=0,a=o.length;s<a;++s)if((r=o[s]).type===e.type&&r.name===e.name){this.removeEventListener(r.type,r.listener,r.options),this.addEventListener(r.type,r.listener=i,r.options=n),r.value=t;return}}this.addEventListener(e.type,i,n),r={type:e.type,name:e.name,value:t,listener:i,options:n},o?o.push(r):this.__on=[r]}}function Ur(e,t,n){var o=Ul(e+""),r,i=o.length,s;if(arguments.length<2){var a=this.node().__on;if(a){for(var l=0,c=a.length,u;l<c;++l)for(r=0,u=a[l];r<i;++r)if((s=o[r]).type===u.type&&s.name===u.name)return u.value}return}for(a=t?Jl:Ql,r=0;r<i;++r)this.each(a(o[r],t,n));return this}function Qr(e,t,n){var o=fn(e),r=o.CustomEvent;typeof r=="function"?r=new r(t,n):(r=o.document.createEvent("Event"),n?(r.initEvent(t,n.bubbles,n.cancelable),r.detail=n.detail):r.initEvent(t,!1,!1)),e.dispatchEvent(r)}function jl(e,t){return function(){return Qr(this,e,t)}}function eu(e,t){return function(){return Qr(this,e,t.apply(this,arguments))}}function Jr(e,t){return this.each((typeof t=="function"?eu:jl)(e,t))}function*jr(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var o=e[t],r=0,i=o.length,s;r<i;++r)(s=o[r])&&(yield s)}var fo=[null];function se(e,t){this._groups=e,this._parents=t}function ei(){return new se([[document.documentElement]],fo)}function tu(){return this}se.prototype=ei.prototype={constructor:se,select:pr,selectAll:gr,selectChild:mr,selectChildren:yr,filter:xr,data:_r,enter:wr,exit:vr,join:Sr,merge:Er,selection:tu,order:Nr,sort:Cr,call:kr,nodes:Mr,node:Ir,size:Pr,empty:zr,each:Ar,attr:Dr,style:Tr,property:$r,classed:Br,text:Vr,html:Fr,raise:Xr,lower:Yr,append:Zr,insert:Wr,remove:qr,clone:Kr,datum:Gr,on:Ur,dispatch:Jr,[Symbol.iterator]:jr};var De=ei;function ue(e){return typeof e=="string"?new se([[document.querySelector(e)]],[document.documentElement]):new se([[e]],fo)}function ti(e){let t;for(;t=e.sourceEvent;)e=t;return e}function pe(e,t){if(e=ti(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var o=n.createSVGPoint();return o.x=e.clientX,o.y=e.clientY,o=o.matrixTransform(t.getScreenCTM().inverse()),[o.x,o.y]}if(t.getBoundingClientRect){var r=t.getBoundingClientRect();return[e.clientX-r.left-t.clientLeft,e.clientY-r.top-t.clientTop]}}return[e.pageX,e.pageY]}var ni={passive:!1},Ue={capture:!0,passive:!1};function hn(e){e.stopImmediatePropagation()}function Be(e){e.preventDefault(),e.stopImmediatePropagation()}function Dt(e){var t=e.document.documentElement,n=ue(e).on("dragstart.drag",Be,Ue);"onselectstart"in t?n.on("selectstart.drag",Be,Ue):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function Tt(e,t){var n=e.document.documentElement,o=ue(e).on("dragstart.drag",null);t&&(o.on("click.drag",Be,Ue),setTimeout(function(){o.on("click.drag",null)},0)),"onselectstart"in n?o.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}var $t=e=>()=>e;function Ot(e,{sourceEvent:t,subject:n,target:o,identifier:r,active:i,x:s,y:a,dx:l,dy:c,dispatch:u}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},identifier:{value:r,enumerable:!0,configurable:!0},active:{value:i,enumerable:!0,configurable:!0},x:{value:s,enumerable:!0,configurable:!0},y:{value:a,enumerable:!0,configurable:!0},dx:{value:l,enumerable:!0,configurable:!0},dy:{value:c,enumerable:!0,configurable:!0},_:{value:u}})}Ot.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function nu(e){return!e.ctrlKey&&!e.button}function ou(){return this.parentNode}function ru(e,t){return t??{x:e.x,y:e.y}}function iu(){return navigator.maxTouchPoints||"ontouchstart"in this}function pn(){var e=nu,t=ou,n=ru,o=iu,r={},i=Ke("start","drag","end"),s=0,a,l,c,u,d=0;function f(y){y.on("mousedown.drag",p).filter(o).on("touchstart.drag",x).on("touchmove.drag",m,ni).on("touchend.drag touchcancel.drag",_).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function p(y,E){if(!(u||!e.call(this,y,E))){var v=h(this,t.call(this,y,E),y,E,"mouse");v&&(ue(y.view).on("mousemove.drag",g,Ue).on("mouseup.drag",w,Ue),Dt(y.view),hn(y),c=!1,a=y.clientX,l=y.clientY,v("start",y))}}function g(y){if(Be(y),!c){var E=y.clientX-a,v=y.clientY-l;c=E*E+v*v>d}r.mouse("drag",y)}function w(y){ue(y.view).on("mousemove.drag mouseup.drag",null),Tt(y.view,c),Be(y),r.mouse("end",y)}function x(y,E){if(e.call(this,y,E)){var v=y.changedTouches,N=t.call(this,y,E),A=v.length,z,L;for(z=0;z<A;++z)(L=h(this,N,y,E,v[z].identifier,v[z]))&&(hn(y),L("start",y,v[z]))}}function m(y){var E=y.changedTouches,v=E.length,N,A;for(N=0;N<v;++N)(A=r[E[N].identifier])&&(Be(y),A("drag",y,E[N]))}function _(y){var E=y.changedTouches,v=E.length,N,A;for(u&&clearTimeout(u),u=setTimeout(function(){u=null},500),N=0;N<v;++N)(A=r[E[N].identifier])&&(hn(y),A("end",y,E[N]))}function h(y,E,v,N,A,z){var L=i.copy(),I=pe(z||v,E),D,O,b;if((b=n.call(y,new Ot("beforestart",{sourceEvent:v,target:f,identifier:A,active:s,x:I[0],y:I[1],dx:0,dy:0,dispatch:L}),N))!=null)return D=b.x-I[0]||0,O=b.y-I[1]||0,function C(S,M,k){var P=I,$;switch(S){case"start":r[A]=C,$=s++;break;case"end":delete r[A],--s;case"drag":I=pe(k||M,E),$=s;break}L.call(S,y,new Ot(S,{sourceEvent:M,subject:b,target:f,identifier:A,active:$,x:I[0]+D,y:I[1]+O,dx:I[0]-P[0],dy:I[1]-P[1],dispatch:L}),N)}}return f.filter=function(y){return arguments.length?(e=typeof y=="function"?y:$t(!!y),f):e},f.container=function(y){return arguments.length?(t=typeof y=="function"?y:$t(y),f):t},f.subject=function(y){return arguments.length?(n=typeof y=="function"?y:$t(y),f):n},f.touchable=function(y){return arguments.length?(o=typeof y=="function"?y:$t(!!y),f):o},f.on=function(){var y=i.on.apply(i,arguments);return y===i?f:y},f.clickDistance=function(y){return arguments.length?(d=(y=+y)*y,f):Math.sqrt(d)},f}function gn(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function ho(e,t){var n=Object.create(e.prototype);for(var o in t)n[o]=t[o];return n}function Lt(){}var Ht=.7,xn=1/Ht,lt="\\s*([+-]?\\d+)\\s*",Rt="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",ke="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",su=/^#([0-9a-f]{3,8})$/,au=new RegExp(`^rgb\\(${lt},${lt},${lt}\\)$`),cu=new RegExp(`^rgb\\(${ke},${ke},${ke}\\)$`),lu=new RegExp(`^rgba\\(${lt},${lt},${lt},${Rt}\\)$`),uu=new RegExp(`^rgba\\(${ke},${ke},${ke},${Rt}\\)$`),du=new RegExp(`^hsl\\(${Rt},${ke},${ke}\\)$`),fu=new RegExp(`^hsla\\(${Rt},${ke},${ke},${Rt}\\)$`),oi={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};gn(Lt,Ee,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:ri,formatHex:ri,formatHex8:hu,formatHsl:pu,formatRgb:ii,toString:ii});function ri(){return this.rgb().formatHex()}function hu(){return this.rgb().formatHex8()}function pu(){return di(this).formatHsl()}function ii(){return this.rgb().formatRgb()}function Ee(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=su.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?si(t):n===3?new xe(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?mn(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?mn(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=au.exec(e))?new xe(t[1],t[2],t[3],1):(t=cu.exec(e))?new xe(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=lu.exec(e))?mn(t[1],t[2],t[3],t[4]):(t=uu.exec(e))?mn(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=du.exec(e))?li(t[1],t[2]/100,t[3]/100,1):(t=fu.exec(e))?li(t[1],t[2]/100,t[3]/100,t[4]):oi.hasOwnProperty(e)?si(oi[e]):e==="transparent"?new xe(NaN,NaN,NaN,0):null}function si(e){return new xe(e>>16&255,e>>8&255,e&255,1)}function mn(e,t,n,o){return o<=0&&(e=t=n=NaN),new xe(e,t,n,o)}function gu(e){return e instanceof Lt||(e=Ee(e)),e?(e=e.rgb(),new xe(e.r,e.g,e.b,e.opacity)):new xe}function ut(e,t,n,o){return arguments.length===1?gu(e):new xe(e,t,n,o??1)}function xe(e,t,n,o){this.r=+e,this.g=+t,this.b=+n,this.opacity=+o}gn(xe,ut,ho(Lt,{brighter(e){return e=e==null?xn:Math.pow(xn,e),new xe(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Ht:Math.pow(Ht,e),new xe(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new xe(Je(this.r),Je(this.g),Je(this.b),wn(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:ai,formatHex:ai,formatHex8:mu,formatRgb:ci,toString:ci}));function ai(){return`#${Qe(this.r)}${Qe(this.g)}${Qe(this.b)}`}function mu(){return`#${Qe(this.r)}${Qe(this.g)}${Qe(this.b)}${Qe((isNaN(this.opacity)?1:this.opacity)*255)}`}function ci(){let e=wn(this.opacity);return`${e===1?"rgb(":"rgba("}${Je(this.r)}, ${Je(this.g)}, ${Je(this.b)}${e===1?")":`, ${e})`}`}function wn(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Je(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Qe(e){return e=Je(e),(e<16?"0":"")+e.toString(16)}function li(e,t,n,o){return o<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Se(e,t,n,o)}function di(e){if(e instanceof Se)return new Se(e.h,e.s,e.l,e.opacity);if(e instanceof Lt||(e=Ee(e)),!e)return new Se;if(e instanceof Se)return e;e=e.rgb();var t=e.r/255,n=e.g/255,o=e.b/255,r=Math.min(t,n,o),i=Math.max(t,n,o),s=NaN,a=i-r,l=(i+r)/2;return a?(t===i?s=(n-o)/a+(n<o)*6:n===i?s=(o-t)/a+2:s=(t-n)/a+4,a/=l<.5?i+r:2-i-r,s*=60):a=l>0&&l<1?0:s,new Se(s,a,l,e.opacity)}function fi(e,t,n,o){return arguments.length===1?di(e):new Se(e,t,n,o??1)}function Se(e,t,n,o){this.h=+e,this.s=+t,this.l=+n,this.opacity=+o}gn(Se,fi,ho(Lt,{brighter(e){return e=e==null?xn:Math.pow(xn,e),new Se(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Ht:Math.pow(Ht,e),new Se(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,o=n+(n<.5?n:1-n)*t,r=2*n-o;return new xe(po(e>=240?e-240:e+120,r,o),po(e,r,o),po(e<120?e+240:e-120,r,o),this.opacity)},clamp(){return new Se(ui(this.h),yn(this.s),yn(this.l),wn(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){let e=wn(this.opacity);return`${e===1?"hsl(":"hsla("}${ui(this.h)}, ${yn(this.s)*100}%, ${yn(this.l)*100}%${e===1?")":`, ${e})`}`}}));function ui(e){return e=(e||0)%360,e<0?e+360:e}function yn(e){return Math.max(0,Math.min(1,e||0))}function po(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}function go(e,t,n,o,r){var i=e*e,s=i*e;return((1-3*e+3*i-s)*t+(4-6*i+3*s)*n+(1+3*e+3*i-3*s)*o+s*r)/6}function hi(e){var t=e.length-1;return function(n){var o=n<=0?n=0:n>=1?(n=1,t-1):Math.floor(n*t),r=e[o],i=e[o+1],s=o>0?e[o-1]:2*r-i,a=o<t-1?e[o+2]:2*i-r;return go((n-o/t)*t,s,r,i,a)}}function pi(e){var t=e.length;return function(n){var o=Math.floor(((n%=1)<0?++n:n)*t),r=e[(o+t-1)%t],i=e[o%t],s=e[(o+1)%t],a=e[(o+2)%t];return go((n-o/t)*t,r,i,s,a)}}var Bt=e=>()=>e;function yu(e,t){return function(n){return e+n*t}}function xu(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(o){return Math.pow(e+o*t,n)}}function gi(e){return(e=+e)==1?bn:function(t,n){return n-t?xu(t,n,e):Bt(isNaN(t)?n:t)}}function bn(e,t){var n=t-e;return n?yu(e,n):Bt(isNaN(e)?t:e)}var je=(function e(t){var n=gi(t);function o(r,i){var s=n((r=ut(r)).r,(i=ut(i)).r),a=n(r.g,i.g),l=n(r.b,i.b),c=bn(r.opacity,i.opacity);return function(u){return r.r=s(u),r.g=a(u),r.b=l(u),r.opacity=c(u),r+""}}return o.gamma=e,o})(1);function mi(e){return function(t){var n=t.length,o=new Array(n),r=new Array(n),i=new Array(n),s,a;for(s=0;s<n;++s)a=ut(t[s]),o[s]=a.r||0,r[s]=a.g||0,i[s]=a.b||0;return o=e(o),r=e(r),i=e(i),a.opacity=1,function(l){return a.r=o(l),a.g=r(l),a.b=i(l),a+""}}}var wu=mi(hi),bu=mi(pi);function yi(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,o=t.slice(),r;return function(i){for(r=0;r<n;++r)o[r]=e[r]*(1-i)+t[r]*i;return o}}function xi(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function wi(e,t){var n=t?t.length:0,o=e?Math.min(n,e.length):0,r=new Array(o),i=new Array(n),s;for(s=0;s<o;++s)r[s]=Te(e[s],t[s]);for(;s<n;++s)i[s]=t[s];return function(a){for(s=0;s<o;++s)i[s]=r[s](a);return i}}function bi(e,t){var n=new Date;return e=+e,t=+t,function(o){return n.setTime(e*(1-o)+t*o),n}}function ge(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function _i(e,t){var n={},o={},r;(e===null||typeof e!="object")&&(e={}),(t===null||typeof t!="object")&&(t={});for(r in t)r in e?n[r]=Te(e[r],t[r]):o[r]=t[r];return function(i){for(r in n)o[r]=n[r](i);return o}}var yo=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,mo=new RegExp(yo.source,"g");function _u(e){return function(){return e}}function vu(e){return function(t){return e(t)+""}}function Vt(e,t){var n=yo.lastIndex=mo.lastIndex=0,o,r,i,s=-1,a=[],l=[];for(e=e+"",t=t+"";(o=yo.exec(e))&&(r=mo.exec(t));)(i=r.index)>n&&(i=t.slice(n,i),a[s]?a[s]+=i:a[++s]=i),(o=o[0])===(r=r[0])?a[s]?a[s]+=r:a[++s]=r:(a[++s]=null,l.push({i:s,x:ge(o,r)})),n=mo.lastIndex;return n<t.length&&(i=t.slice(n),a[s]?a[s]+=i:a[++s]=i),a.length<2?l[0]?vu(l[0].x):_u(t):(t=l.length,function(c){for(var u=0,d;u<t;++u)a[(d=l[u]).i]=d.x(c);return a.join("")})}function Te(e,t){var n=typeof t,o;return t==null||n==="boolean"?Bt(t):(n==="number"?ge:n==="string"?(o=Ee(t))?(t=o,je):Vt:t instanceof Ee?je:t instanceof Date?bi:xi(t)?yi:Array.isArray(t)?wi:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?_i:ge)(e,t)}var vi=180/Math.PI,_n={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function xo(e,t,n,o,r,i){var s,a,l;return(s=Math.sqrt(e*e+t*t))&&(e/=s,t/=s),(l=e*n+t*o)&&(n-=e*l,o-=t*l),(a=Math.sqrt(n*n+o*o))&&(n/=a,o/=a,l/=a),e*o<t*n&&(e=-e,t=-t,l=-l,s=-s),{translateX:r,translateY:i,rotate:Math.atan2(t,e)*vi,skewX:Math.atan(l)*vi,scaleX:s,scaleY:a}}var vn;function Si(e){let t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?_n:xo(t.a,t.b,t.c,t.d,t.e,t.f)}function Ei(e){return e==null?_n:(vn||(vn=document.createElementNS("http://www.w3.org/2000/svg","g")),vn.setAttribute("transform",e),(e=vn.transform.baseVal.consolidate())?(e=e.matrix,xo(e.a,e.b,e.c,e.d,e.e,e.f)):_n)}function Ni(e,t,n,o){function r(c){return c.length?c.pop()+" ":""}function i(c,u,d,f,p,g){if(c!==d||u!==f){var w=p.push("translate(",null,t,null,n);g.push({i:w-4,x:ge(c,d)},{i:w-2,x:ge(u,f)})}else(d||f)&&p.push("translate("+d+t+f+n)}function s(c,u,d,f){c!==u?(c-u>180?u+=360:u-c>180&&(c+=360),f.push({i:d.push(r(d)+"rotate(",null,o)-2,x:ge(c,u)})):u&&d.push(r(d)+"rotate("+u+o)}function a(c,u,d,f){c!==u?f.push({i:d.push(r(d)+"skewX(",null,o)-2,x:ge(c,u)}):u&&d.push(r(d)+"skewX("+u+o)}function l(c,u,d,f,p,g){if(c!==d||u!==f){var w=p.push(r(p)+"scale(",null,",",null,")");g.push({i:w-4,x:ge(c,d)},{i:w-2,x:ge(u,f)})}else(d!==1||f!==1)&&p.push(r(p)+"scale("+d+","+f+")")}return function(c,u){var d=[],f=[];return c=e(c),u=e(u),i(c.translateX,c.translateY,u.translateX,u.translateY,d,f),s(c.rotate,u.rotate,d,f),a(c.skewX,u.skewX,d,f),l(c.scaleX,c.scaleY,u.scaleX,u.scaleY,d,f),c=u=null,function(p){for(var g=-1,w=f.length,x;++g<w;)d[(x=f[g]).i]=x.x(p);return d.join("")}}}var wo=Ni(Si,"px, ","px)","deg)"),bo=Ni(Ei,", ",")",")");var Su=1e-12;function Ci(e){return((e=Math.exp(e))+1/e)/2}function Eu(e){return((e=Math.exp(e))-1/e)/2}function Nu(e){return((e=Math.exp(2*e))-1)/(e+1)}var et=(function e(t,n,o){function r(i,s){var a=i[0],l=i[1],c=i[2],u=s[0],d=s[1],f=s[2],p=u-a,g=d-l,w=p*p+g*g,x,m;if(w<Su)m=Math.log(f/c)/t,x=function(N){return[a+N*p,l+N*g,c*Math.exp(t*N*m)]};else{var _=Math.sqrt(w),h=(f*f-c*c+o*w)/(2*c*n*_),y=(f*f-c*c-o*w)/(2*f*n*_),E=Math.log(Math.sqrt(h*h+1)-h),v=Math.log(Math.sqrt(y*y+1)-y);m=(v-E)/t,x=function(N){var A=N*m,z=Ci(E),L=c/(n*_)*(z*Nu(t*A+E)-Eu(E));return[a+L*p,l+L*g,c*z/Ci(t*A+E)]}}return x.duration=m*1e3*t/Math.SQRT2,x}return r.rho=function(i){var s=Math.max(.001,+i),a=s*s,l=a*a;return e(s,a,l)},r})(Math.SQRT2,2,4);var dt=0,Xt=0,Ft=0,Mi=1e3,Sn,Yt,En=0,tt=0,Nn=0,Zt=typeof performance=="object"&&performance.now?performance:Date,Ii=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function qt(){return tt||(Ii(Cu),tt=Zt.now()+Nn)}function Cu(){tt=0}function Wt(){this._call=this._time=this._next=null}Wt.prototype=Cn.prototype={constructor:Wt,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?qt():+n)+(t==null?0:+t),!this._next&&Yt!==this&&(Yt?Yt._next=this:Sn=this,Yt=this),this._call=e,this._time=n,_o()},stop:function(){this._call&&(this._call=null,this._time=1/0,_o())}};function Cn(e,t,n){var o=new Wt;return o.restart(e,t,n),o}function Pi(){qt(),++dt;for(var e=Sn,t;e;)(t=tt-e._time)>=0&&e._call.call(void 0,t),e=e._next;--dt}function ki(){tt=(En=Zt.now())+Nn,dt=Xt=0;try{Pi()}finally{dt=0,Mu(),tt=0}}function ku(){var e=Zt.now(),t=e-En;t>Mi&&(Nn-=t,En=e)}function Mu(){for(var e,t=Sn,n,o=1/0;t;)t._call?(o>t._time&&(o=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:Sn=n);Yt=e,_o(o)}function _o(e){if(!dt){Xt&&(Xt=clearTimeout(Xt));var t=e-tt;t>24?(e<1/0&&(Xt=setTimeout(ki,e-Zt.now()-Nn)),Ft&&(Ft=clearInterval(Ft))):(Ft||(En=Zt.now(),Ft=setInterval(ku,Mi)),dt=1,Ii(ki))}}function kn(e,t,n){var o=new Wt;return t=t==null?0:+t,o.restart(r=>{o.stop(),e(r+t)},t,n),o}var Iu=Ke("start","end","cancel","interrupt"),Pu=[],Di=0,zi=1,In=2,Mn=3,Ai=4,Pn=5,Kt=6;function Ve(e,t,n,o,r,i){var s=e.__transition;if(!s)e.__transition={};else if(n in s)return;zu(e,n,{name:t,index:o,group:r,on:Iu,tween:Pu,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:Di})}function Gt(e,t){var n=le(e,t);if(n.state>Di)throw new Error("too late; already scheduled");return n}function fe(e,t){var n=le(e,t);if(n.state>Mn)throw new Error("too late; already running");return n}function le(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function zu(e,t,n){var o=e.__transition,r;o[t]=n,n.timer=Cn(i,0,n.time);function i(c){n.state=zi,n.timer.restart(s,n.delay,n.time),n.delay<=c&&s(c-n.delay)}function s(c){var u,d,f,p;if(n.state!==zi)return l();for(u in o)if(p=o[u],p.name===n.name){if(p.state===Mn)return kn(s);p.state===Ai?(p.state=Kt,p.timer.stop(),p.on.call("interrupt",e,e.__data__,p.index,p.group),delete o[u]):+u<t&&(p.state=Kt,p.timer.stop(),p.on.call("cancel",e,e.__data__,p.index,p.group),delete o[u])}if(kn(function(){n.state===Mn&&(n.state=Ai,n.timer.restart(a,n.delay,n.time),a(c))}),n.state=In,n.on.call("start",e,e.__data__,n.index,n.group),n.state===In){for(n.state=Mn,r=new Array(f=n.tween.length),u=0,d=-1;u<f;++u)(p=n.tween[u].value.call(e,e.__data__,n.index,n.group))&&(r[++d]=p);r.length=d+1}}function a(c){for(var u=c<n.duration?n.ease.call(null,c/n.duration):(n.timer.restart(l),n.state=Pn,1),d=-1,f=r.length;++d<f;)r[d].call(e,u);n.state===Pn&&(n.on.call("end",e,e.__data__,n.index,n.group),l())}function l(){n.state=Kt,n.timer.stop(),delete o[t];for(var c in o)return;delete e.__transition}}function nt(e,t){var n=e.__transition,o,r,i=!0,s;if(n){t=t==null?null:t+"";for(s in n){if((o=n[s]).name!==t){i=!1;continue}r=o.state>In&&o.state<Pn,o.state=Kt,o.timer.stop(),o.on.call(r?"interrupt":"cancel",e,e.__data__,o.index,o.group),delete n[s]}i&&delete e.__transition}}function Ti(e){return this.each(function(){nt(this,e)})}function Au(e,t){var n,o;return function(){var r=fe(this,e),i=r.tween;if(i!==n){o=n=i;for(var s=0,a=o.length;s<a;++s)if(o[s].name===t){o=o.slice(),o.splice(s,1);break}}r.tween=o}}function Du(e,t,n){var o,r;if(typeof n!="function")throw new Error;return function(){var i=fe(this,e),s=i.tween;if(s!==o){r=(o=s).slice();for(var a={name:t,value:n},l=0,c=r.length;l<c;++l)if(r[l].name===t){r[l]=a;break}l===c&&r.push(a)}i.tween=r}}function $i(e,t){var n=this._id;if(e+="",arguments.length<2){for(var o=le(this.node(),n).tween,r=0,i=o.length,s;r<i;++r)if((s=o[r]).name===e)return s.value;return null}return this.each((t==null?Au:Du)(n,e,t))}function ft(e,t,n){var o=e._id;return e.each(function(){var r=fe(this,o);(r.value||(r.value={}))[t]=n.apply(this,arguments)}),function(r){return le(r,o).value[t]}}function zn(e,t){var n;return(typeof t=="number"?ge:t instanceof Ee?je:(n=Ee(t))?(t=n,je):Vt)(e,t)}function Tu(e){return function(){this.removeAttribute(e)}}function $u(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Ou(e,t,n){var o,r=n+"",i;return function(){var s=this.getAttribute(e);return s===r?null:s===o?i:i=t(o=s,n)}}function Hu(e,t,n){var o,r=n+"",i;return function(){var s=this.getAttributeNS(e.space,e.local);return s===r?null:s===o?i:i=t(o=s,n)}}function Ru(e,t,n){var o,r,i;return function(){var s,a=n(this),l;return a==null?void this.removeAttribute(e):(s=this.getAttribute(e),l=a+"",s===l?null:s===o&&l===r?i:(r=l,i=t(o=s,a)))}}function Lu(e,t,n){var o,r,i;return function(){var s,a=n(this),l;return a==null?void this.removeAttributeNS(e.space,e.local):(s=this.getAttributeNS(e.space,e.local),l=a+"",s===l?null:s===o&&l===r?i:(r=l,i=t(o=s,a)))}}function Oi(e,t){var n=Ae(e),o=n==="transform"?bo:zn;return this.attrTween(e,typeof t=="function"?(n.local?Lu:Ru)(n,o,ft(this,"attr."+e,t)):t==null?(n.local?$u:Tu)(n):(n.local?Hu:Ou)(n,o,t))}function Bu(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function Vu(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function Fu(e,t){var n,o;function r(){var i=t.apply(this,arguments);return i!==o&&(n=(o=i)&&Vu(e,i)),n}return r._value=t,r}function Xu(e,t){var n,o;function r(){var i=t.apply(this,arguments);return i!==o&&(n=(o=i)&&Bu(e,i)),n}return r._value=t,r}function Hi(e,t){var n="attr."+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!="function")throw new Error;var o=Ae(e);return this.tween(n,(o.local?Fu:Xu)(o,t))}function Yu(e,t){return function(){Gt(this,e).delay=+t.apply(this,arguments)}}function Zu(e,t){return t=+t,function(){Gt(this,e).delay=t}}function Ri(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Yu:Zu)(t,e)):le(this.node(),t).delay}function Wu(e,t){return function(){fe(this,e).duration=+t.apply(this,arguments)}}function qu(e,t){return t=+t,function(){fe(this,e).duration=t}}function Li(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Wu:qu)(t,e)):le(this.node(),t).duration}function Ku(e,t){if(typeof t!="function")throw new Error;return function(){fe(this,e).ease=t}}function Bi(e){var t=this._id;return arguments.length?this.each(Ku(t,e)):le(this.node(),t).ease}function Gu(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;fe(this,e).ease=n}}function Vi(e){if(typeof e!="function")throw new Error;return this.each(Gu(this._id,e))}function Fi(e){typeof e!="function"&&(e=zt(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var i=t[r],s=i.length,a=o[r]=[],l,c=0;c<s;++c)(l=i[c])&&e.call(l,l.__data__,c,i)&&a.push(l);return new me(o,this._parents,this._name,this._id)}function Xi(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,o=t.length,r=n.length,i=Math.min(o,r),s=new Array(o),a=0;a<i;++a)for(var l=t[a],c=n[a],u=l.length,d=s[a]=new Array(u),f,p=0;p<u;++p)(f=l[p]||c[p])&&(d[p]=f);for(;a<o;++a)s[a]=t[a];return new me(s,this._parents,this._name,this._id)}function Uu(e){return(e+"").trim().split(/^|\s+/).every(function(t){var n=t.indexOf(".");return n>=0&&(t=t.slice(0,n)),!t||t==="start"})}function Qu(e,t,n){var o,r,i=Uu(t)?Gt:fe;return function(){var s=i(this,e),a=s.on;a!==o&&(r=(o=a).copy()).on(t,n),s.on=r}}function Yi(e,t){var n=this._id;return arguments.length<2?le(this.node(),n).on.on(e):this.each(Qu(n,e,t))}function Ju(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function Zi(){return this.on("end.remove",Ju(this._id))}function Wi(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Ge(e));for(var o=this._groups,r=o.length,i=new Array(r),s=0;s<r;++s)for(var a=o[s],l=a.length,c=i[s]=new Array(l),u,d,f=0;f<l;++f)(u=a[f])&&(d=e.call(u,u.__data__,f,a))&&("__data__"in u&&(d.__data__=u.__data__),c[f]=d,Ve(c[f],t,n,f,c,le(u,n)));return new me(i,this._parents,t,n)}function qi(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Pt(e));for(var o=this._groups,r=o.length,i=[],s=[],a=0;a<r;++a)for(var l=o[a],c=l.length,u,d=0;d<c;++d)if(u=l[d]){for(var f=e.call(u,u.__data__,d,l),p,g=le(u,n),w=0,x=f.length;w<x;++w)(p=f[w])&&Ve(p,t,n,w,f,g);i.push(f),s.push(u)}return new me(i,s,t,n)}var ju=De.prototype.constructor;function Ki(){return new ju(this._groups,this._parents)}function ed(e,t){var n,o,r;return function(){var i=Le(this,e),s=(this.style.removeProperty(e),Le(this,e));return i===s?null:i===n&&s===o?r:r=t(n=i,o=s)}}function Gi(e){return function(){this.style.removeProperty(e)}}function td(e,t,n){var o,r=n+"",i;return function(){var s=Le(this,e);return s===r?null:s===o?i:i=t(o=s,n)}}function nd(e,t,n){var o,r,i;return function(){var s=Le(this,e),a=n(this),l=a+"";return a==null&&(l=a=(this.style.removeProperty(e),Le(this,e))),s===l?null:s===o&&l===r?i:(r=l,i=t(o=s,a))}}function od(e,t){var n,o,r,i="style."+t,s="end."+i,a;return function(){var l=fe(this,e),c=l.on,u=l.value[i]==null?a||(a=Gi(t)):void 0;(c!==n||r!==u)&&(o=(n=c).copy()).on(s,r=u),l.on=o}}function Ui(e,t,n){var o=(e+="")=="transform"?wo:zn;return t==null?this.styleTween(e,ed(e,o)).on("end.style."+e,Gi(e)):typeof t=="function"?this.styleTween(e,nd(e,o,ft(this,"style."+e,t))).each(od(this._id,e)):this.styleTween(e,td(e,o,t),n).on("end.style."+e,null)}function rd(e,t,n){return function(o){this.style.setProperty(e,t.call(this,o),n)}}function id(e,t,n){var o,r;function i(){var s=t.apply(this,arguments);return s!==r&&(o=(r=s)&&rd(e,s,n)),o}return i._value=t,i}function Qi(e,t,n){var o="style."+(e+="");if(arguments.length<2)return(o=this.tween(o))&&o._value;if(t==null)return this.tween(o,null);if(typeof t!="function")throw new Error;return this.tween(o,id(e,t,n??""))}function sd(e){return function(){this.textContent=e}}function ad(e){return function(){var t=e(this);this.textContent=t??""}}function Ji(e){return this.tween("text",typeof e=="function"?ad(ft(this,"text",e)):sd(e==null?"":e+""))}function cd(e){return function(t){this.textContent=e.call(this,t)}}function ld(e){var t,n;function o(){var r=e.apply(this,arguments);return r!==n&&(t=(n=r)&&cd(r)),t}return o._value=e,o}function ji(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!="function")throw new Error;return this.tween(t,ld(e))}function es(){for(var e=this._name,t=this._id,n=An(),o=this._groups,r=o.length,i=0;i<r;++i)for(var s=o[i],a=s.length,l,c=0;c<a;++c)if(l=s[c]){var u=le(l,t);Ve(l,e,n,c,s,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new me(o,this._parents,e,n)}function ts(){var e,t,n=this,o=n._id,r=n.size();return new Promise(function(i,s){var a={value:s},l={value:function(){--r===0&&i()}};n.each(function(){var c=fe(this,o),u=c.on;u!==e&&(t=(e=u).copy(),t._.cancel.push(a),t._.interrupt.push(a),t._.end.push(l)),c.on=t}),r===0&&i()})}var ud=0;function me(e,t,n,o){this._groups=e,this._parents=t,this._name=n,this._id=o}function ns(e){return De().transition(e)}function An(){return++ud}var $e=De.prototype;me.prototype=ns.prototype={constructor:me,select:Wi,selectAll:qi,selectChild:$e.selectChild,selectChildren:$e.selectChildren,filter:Fi,merge:Xi,selection:Ki,transition:es,call:$e.call,nodes:$e.nodes,node:$e.node,size:$e.size,empty:$e.empty,each:$e.each,on:Yi,attr:Oi,attrTween:Hi,style:Ui,styleTween:Qi,text:Ji,textTween:ji,remove:Zi,tween:$i,delay:Ri,duration:Li,ease:Bi,easeVarying:Vi,end:ts,[Symbol.iterator]:$e[Symbol.iterator]};function Dn(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var dd={time:null,delay:0,duration:250,ease:Dn};function fd(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return n}function os(e){var t,n;e instanceof me?(t=e._id,e=e._name):(t=An(),(n=dd).time=qt(),e=e==null?null:e+"");for(var o=this._groups,r=o.length,i=0;i<r;++i)for(var s=o[i],a=s.length,l,c=0;c<a;++c)(l=s[c])&&Ve(l,e,t,c,s,n||fd(l,t));return new me(o,this._parents,e,t)}De.prototype.interrupt=Ti;De.prototype.transition=os;var Ut=e=>()=>e;function vo(e,{sourceEvent:t,target:n,transform:o,dispatch:r}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:o,enumerable:!0,configurable:!0},_:{value:r}})}function Ne(e,t,n){this.k=e,this.x=t,this.y=n}Ne.prototype={constructor:Ne,scale:function(e){return e===1?this:new Ne(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Ne(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var ot=new Ne(1,0,0);Qt.prototype=Ne.prototype;function Qt(e){for(;!e.__zoom;)if(!(e=e.parentNode))return ot;return e.__zoom}function Tn(e){e.stopImmediatePropagation()}function ht(e){e.preventDefault(),e.stopImmediatePropagation()}function hd(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function pd(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function rs(){return this.__zoom||ot}function gd(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function md(){return navigator.maxTouchPoints||"ontouchstart"in this}function yd(e,t,n){var o=e.invertX(t[0][0])-n[0][0],r=e.invertX(t[1][0])-n[1][0],i=e.invertY(t[0][1])-n[0][1],s=e.invertY(t[1][1])-n[1][1];return e.translate(r>o?(o+r)/2:Math.min(0,o)||Math.max(0,r),s>i?(i+s)/2:Math.min(0,i)||Math.max(0,s))}function $n(){var e=hd,t=pd,n=yd,o=gd,r=md,i=[0,1/0],s=[[-1/0,-1/0],[1/0,1/0]],a=250,l=et,c=Ke("start","zoom","end"),u,d,f,p=500,g=150,w=0,x=10;function m(b){b.property("__zoom",rs).on("wheel.zoom",A,{passive:!1}).on("mousedown.zoom",z).on("dblclick.zoom",L).filter(r).on("touchstart.zoom",I).on("touchmove.zoom",D).on("touchend.zoom touchcancel.zoom",O).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}m.transform=function(b,C,S,M){var k=b.selection?b.selection():b;k.property("__zoom",rs),b!==k?E(b,C,S,M):k.interrupt().each(function(){v(this,arguments).event(M).start().zoom(null,typeof C=="function"?C.apply(this,arguments):C).end()})},m.scaleBy=function(b,C,S,M){m.scaleTo(b,function(){var k=this.__zoom.k,P=typeof C=="function"?C.apply(this,arguments):C;return k*P},S,M)},m.scaleTo=function(b,C,S,M){m.transform(b,function(){var k=t.apply(this,arguments),P=this.__zoom,$=S==null?y(k):typeof S=="function"?S.apply(this,arguments):S,R=P.invert($),H=typeof C=="function"?C.apply(this,arguments):C;return n(h(_(P,H),$,R),k,s)},S,M)},m.translateBy=function(b,C,S,M){m.transform(b,function(){return n(this.__zoom.translate(typeof C=="function"?C.apply(this,arguments):C,typeof S=="function"?S.apply(this,arguments):S),t.apply(this,arguments),s)},null,M)},m.translateTo=function(b,C,S,M,k){m.transform(b,function(){var P=t.apply(this,arguments),$=this.__zoom,R=M==null?y(P):typeof M=="function"?M.apply(this,arguments):M;return n(ot.translate(R[0],R[1]).scale($.k).translate(typeof C=="function"?-C.apply(this,arguments):-C,typeof S=="function"?-S.apply(this,arguments):-S),P,s)},M,k)};function _(b,C){return C=Math.max(i[0],Math.min(i[1],C)),C===b.k?b:new Ne(C,b.x,b.y)}function h(b,C,S){var M=C[0]-S[0]*b.k,k=C[1]-S[1]*b.k;return M===b.x&&k===b.y?b:new Ne(b.k,M,k)}function y(b){return[(+b[0][0]+ +b[1][0])/2,(+b[0][1]+ +b[1][1])/2]}function E(b,C,S,M){b.on("start.zoom",function(){v(this,arguments).event(M).start()}).on("interrupt.zoom end.zoom",function(){v(this,arguments).event(M).end()}).tween("zoom",function(){var k=this,P=arguments,$=v(k,P).event(M),R=t.apply(k,P),H=S==null?y(R):typeof S=="function"?S.apply(k,P):S,F=Math.max(R[1][0]-R[0][0],R[1][1]-R[0][1]),V=k.__zoom,W=typeof C=="function"?C.apply(k,P):C,G=l(V.invert(H).concat(F/V.k),W.invert(H).concat(F/W.k));return function(Z){if(Z===1)Z=W;else{var B=G(Z),Y=F/B[2];Z=new Ne(Y,H[0]-B[0]*Y,H[1]-B[1]*Y)}$.zoom(null,Z)}})}function v(b,C,S){return!S&&b.__zooming||new N(b,C)}function N(b,C){this.that=b,this.args=C,this.active=0,this.sourceEvent=null,this.extent=t.apply(b,C),this.taps=0}N.prototype={event:function(b){return b&&(this.sourceEvent=b),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(b,C){return this.mouse&&b!=="mouse"&&(this.mouse[1]=C.invert(this.mouse[0])),this.touch0&&b!=="touch"&&(this.touch0[1]=C.invert(this.touch0[0])),this.touch1&&b!=="touch"&&(this.touch1[1]=C.invert(this.touch1[0])),this.that.__zoom=C,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(b){var C=ue(this.that).datum();c.call(b,this.that,new vo(b,{sourceEvent:this.sourceEvent,target:m,type:b,transform:this.that.__zoom,dispatch:c}),C)}};function A(b,...C){if(!e.apply(this,arguments))return;var S=v(this,C).event(b),M=this.__zoom,k=Math.max(i[0],Math.min(i[1],M.k*Math.pow(2,o.apply(this,arguments)))),P=pe(b);if(S.wheel)(S.mouse[0][0]!==P[0]||S.mouse[0][1]!==P[1])&&(S.mouse[1]=M.invert(S.mouse[0]=P)),clearTimeout(S.wheel);else{if(M.k===k)return;S.mouse=[P,M.invert(P)],nt(this),S.start()}ht(b),S.wheel=setTimeout($,g),S.zoom("mouse",n(h(_(M,k),S.mouse[0],S.mouse[1]),S.extent,s));function $(){S.wheel=null,S.end()}}function z(b,...C){if(f||!e.apply(this,arguments))return;var S=b.currentTarget,M=v(this,C,!0).event(b),k=ue(b.view).on("mousemove.zoom",H,!0).on("mouseup.zoom",F,!0),P=pe(b,S),$=b.clientX,R=b.clientY;Dt(b.view),Tn(b),M.mouse=[P,this.__zoom.invert(P)],nt(this),M.start();function H(V){if(ht(V),!M.moved){var W=V.clientX-$,G=V.clientY-R;M.moved=W*W+G*G>w}M.event(V).zoom("mouse",n(h(M.that.__zoom,M.mouse[0]=pe(V,S),M.mouse[1]),M.extent,s))}function F(V){k.on("mousemove.zoom mouseup.zoom",null),Tt(V.view,M.moved),ht(V),M.event(V).end()}}function L(b,...C){if(e.apply(this,arguments)){var S=this.__zoom,M=pe(b.changedTouches?b.changedTouches[0]:b,this),k=S.invert(M),P=S.k*(b.shiftKey?.5:2),$=n(h(_(S,P),M,k),t.apply(this,C),s);ht(b),a>0?ue(this).transition().duration(a).call(E,$,M,b):ue(this).call(m.transform,$,M,b)}}function I(b,...C){if(e.apply(this,arguments)){var S=b.touches,M=S.length,k=v(this,C,b.changedTouches.length===M).event(b),P,$,R,H;for(Tn(b),$=0;$<M;++$)R=S[$],H=pe(R,this),H=[H,this.__zoom.invert(H),R.identifier],k.touch0?!k.touch1&&k.touch0[2]!==H[2]&&(k.touch1=H,k.taps=0):(k.touch0=H,P=!0,k.taps=1+!!u);u&&(u=clearTimeout(u)),P&&(k.taps<2&&(d=H[0],u=setTimeout(function(){u=null},p)),nt(this),k.start())}}function D(b,...C){if(this.__zooming){var S=v(this,C).event(b),M=b.changedTouches,k=M.length,P,$,R,H;for(ht(b),P=0;P<k;++P)$=M[P],R=pe($,this),S.touch0&&S.touch0[2]===$.identifier?S.touch0[0]=R:S.touch1&&S.touch1[2]===$.identifier&&(S.touch1[0]=R);if($=S.that.__zoom,S.touch1){var F=S.touch0[0],V=S.touch0[1],W=S.touch1[0],G=S.touch1[1],Z=(Z=W[0]-F[0])*Z+(Z=W[1]-F[1])*Z,B=(B=G[0]-V[0])*B+(B=G[1]-V[1])*B;$=_($,Math.sqrt(Z/B)),R=[(F[0]+W[0])/2,(F[1]+W[1])/2],H=[(V[0]+G[0])/2,(V[1]+G[1])/2]}else if(S.touch0)R=S.touch0[0],H=S.touch0[1];else return;S.zoom("touch",n(h($,R,H),S.extent,s))}}function O(b,...C){if(this.__zooming){var S=v(this,C).event(b),M=b.changedTouches,k=M.length,P,$;for(Tn(b),f&&clearTimeout(f),f=setTimeout(function(){f=null},p),P=0;P<k;++P)$=M[P],S.touch0&&S.touch0[2]===$.identifier?delete S.touch0:S.touch1&&S.touch1[2]===$.identifier&&delete S.touch1;if(S.touch1&&!S.touch0&&(S.touch0=S.touch1,delete S.touch1),S.touch0)S.touch0[1]=this.__zoom.invert(S.touch0[0]);else if(S.end(),S.taps===2&&($=pe($,this),Math.hypot(d[0]-$[0],d[1]-$[1])<x)){var R=ue(this).on("dblclick.zoom");R&&R.apply(this,arguments)}}}return m.wheelDelta=function(b){return arguments.length?(o=typeof b=="function"?b:Ut(+b),m):o},m.filter=function(b){return arguments.length?(e=typeof b=="function"?b:Ut(!!b),m):e},m.touchable=function(b){return arguments.length?(r=typeof b=="function"?b:Ut(!!b),m):r},m.extent=function(b){return arguments.length?(t=typeof b=="function"?b:Ut([[+b[0][0],+b[0][1]],[+b[1][0],+b[1][1]]]),m):t},m.scaleExtent=function(b){return arguments.length?(i[0]=+b[0],i[1]=+b[1],m):[i[0],i[1]]},m.translateExtent=function(b){return arguments.length?(s[0][0]=+b[0][0],s[1][0]=+b[1][0],s[0][1]=+b[0][1],s[1][1]=+b[1][1],m):[[s[0][0],s[0][1]],[s[1][0],s[1][1]]]},m.constrain=function(b){return arguments.length?(n=b,m):n},m.duration=function(b){return arguments.length?(a=+b,m):a},m.interpolate=function(b){return arguments.length?(l=b,m):l},m.on=function(){var b=c.on.apply(c,arguments);return b===c?m:b},m.clickDistance=function(b){return arguments.length?(w=(b=+b)*b,m):Math.sqrt(w)},m.tapDistance=function(b){return arguments.length?(x=+b,m):x},m}var ye={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."},wt=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],ko=["Enter"," ","Escape"],Mo={"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 Oe;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(Oe||(Oe={}));var rt;(function(e){e.Partial="partial",e.Full="full"})(rt||(rt={}));var Io={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null},Me;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Me||(Me={}));var mt;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(mt||(mt={}));var X;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(X||(X={}));var is={[X.Left]:X.Right,[X.Right]:X.Left,[X.Top]:X.Bottom,[X.Bottom]:X.Top};function Po(e){return e===null?null:e?"valid":"invalid"}var zo=e=>"id"in e&&"source"in e&&"target"in e,xs=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),Ao=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e);var en=(e,t=[0,0])=>{let{width:n,height:o}=Ie(e),r=e.origin??t,i=n*r[0],s=o*r[1];return{x:e.position.x-i,y:e.position.y-s}},Do=(e,t={nodeOrigin:[0,0]})=>{if(process.env.NODE_ENV==="development"&&!t.nodeLookup&&console.warn("Please use `getNodesBounds` from `useReactFlow`/`useSvelteFlow` hook to ensure correct values for sub flows. If not possible, you have to provide a nodeLookup to support sub flows."),e.length===0)return{x:0,y:0,width:0,height:0};let n=e.reduce((o,r)=>{let i=typeof r=="string",s=!t.nodeLookup&&!i?r:void 0;t.nodeLookup&&(s=i?t.nodeLookup.get(r):Ao(r)?r:t.nodeLookup.get(r.id));let a=s?Rn(s,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return Bn(o,a)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return Vn(n)},bt=(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=Bn(n,Rn(r)),o=!0)}),o?Vn(n):{x:0,y:0,width:0,height:0}},Ln=(e,t,[n,o,r]=[0,0,1],i=!1,s=!1)=>{let a={...St(t,[n,o,r]),width:t.width/r,height:t.height/r},l=[];for(let c of e.values()){let{measured:u,selectable:d=!0,hidden:f=!1}=c;if(s&&!d||f)continue;let p=u.width??c.width??c.initialWidth??null,g=u.height??c.height??c.initialHeight??null,w=_t(a,st(c)),x=(p??0)*(g??0),m=i&&w>0;(!c.internals.handleBounds||m||w>=x||c.dragging)&&l.push(c)}return l},ws=(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 xd(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 bs({nodes:e,width:t,height:n,panZoom:o,minZoom:r,maxZoom:i},s){if(e.size===0)return Promise.resolve(!0);let a=xd(e,s),l=bt(a),c=tn(l,t,n,s?.minZoom??r,s?.maxZoom??i,s?.padding??.1);return await o.setViewport(c,{duration:s?.duration,ease:s?.ease,interpolate:s?.interpolate}),Promise.resolve(!0)}function To({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:o=[0,0],nodeExtent:r,onError:i}){let s=n.get(e),a=s.parentId?n.get(s.parentId):void 0,{x:l,y:c}=a?a.internals.positionAbsolute:{x:0,y:0},u=s.origin??o,d=s.extent||r;if(s.extent==="parent"&&!s.expandParent)if(!a)i?.("005",ye.error005());else{let p=a.measured.width,g=a.measured.height;p&&g&&(d=[[l,c],[l+p,c+g]])}else a&&xt(s.extent)&&(d=[[s.extent[0][0]+l,s.extent[0][1]+c],[s.extent[1][0]+l,s.extent[1][1]+c]]);let f=xt(d)?it(t,d,s.measured):t;return(s.measured.width===void 0||s.measured.height===void 0)&&i?.("015",ye.error015()),{position:{x:f.x-l+(s.measured.width??0)*u[0],y:f.y-c+(s.measured.height??0)*u[1]},positionAbsolute:f}}async function _s({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:o,onBeforeDelete:r}){let i=new Set(e.map(f=>f.id)),s=[];for(let f of n){if(f.deletable===!1)continue;let p=i.has(f.id),g=!p&&f.parentId&&s.find(w=>w.id===f.parentId);(p||g)&&s.push(f)}let a=new Set(t.map(f=>f.id)),l=o.filter(f=>f.deletable!==!1),u=ws(s,l);for(let f of l)a.has(f.id)&&!u.find(g=>g.id===f.id)&&u.push(f);if(!r)return{edges:u,nodes:s};let d=await r({nodes:s,edges:u});return typeof d=="boolean"?d?{edges:u,nodes:s}:{edges:[],nodes:[]}:d}var yt=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),it=(e={x:0,y:0},t,n)=>({x:yt(e.x,t[0][0],t[1][0]-(n?.width??0)),y:yt(e.y,t[0][1],t[1][1]-(n?.height??0))});function vs(e,t,n){let{width:o,height:r}=Ie(n),{x:i,y:s}=n.internals.positionAbsolute;return it(e,[[i,s],[i+o,s+r]],t)}var ss=(e,t,n)=>e<t?yt(Math.abs(e-t),1,t)/t:e>n?-yt(Math.abs(e-n),1,t)/t:0,Ss=(e,t,n=15,o=40)=>{let r=ss(e.x,o,t.width-o)*n,i=ss(e.y,o,t.height-o)*n;return[r,i]},Bn=(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)}),Co=({x:e,y:t,width:n,height:o})=>({x:e,y:t,x2:e+n,y2:t+o}),Vn=({x:e,y:t,x2:n,y2:o})=>({x:e,y:t,width:n-e,height:o-t}),st=(e,t=[0,0])=>{let{x:n,y:o}=Ao(e)?e.internals.positionAbsolute:en(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}},Rn=(e,t=[0,0])=>{let{x:n,y:o}=Ao(e)?e.internals.positionAbsolute:en(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)}},$o=(e,t)=>Vn(Bn(Co(e),Co(t))),_t=(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)},Oo=e=>we(e.width)&&we(e.height)&&we(e.x)&&we(e.y),we=e=>!isNaN(e)&&isFinite(e),Ho=(e,t)=>{process.env.NODE_ENV==="development"&&console.warn(`[React Flow]: ${t} Help: https://reactflow.dev/error#${e}`)},vt=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),St=({x:e,y:t},[n,o,r],i=!1,s=[1,1])=>{let a={x:(e-n)/r,y:(t-o)/r};return i?vt(a,s):a},jt=({x:e,y:t},[n,o,r])=>({x:e*r+n,y:t*r+o});function pt(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 wd(e,t,n){if(typeof e=="string"||typeof e=="number"){let o=pt(e,n),r=pt(e,t);return{top:o,right:r,bottom:o,left:r,x:r*2,y:o*2}}if(typeof e=="object"){let o=pt(e.top??e.y??0,n),r=pt(e.bottom??e.y??0,n),i=pt(e.left??e.x??0,t),s=pt(e.right??e.x??0,t);return{top:o,right:s,bottom:r,left:i,x:i+s,y:o+r}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function bd(e,t,n,o,r,i){let{x:s,y:a}=jt(e,[t,n,o]),{x:l,y:c}=jt({x:e.x+e.width,y:e.y+e.height},[t,n,o]),u=r-l,d=i-c;return{left:Math.floor(s),top:Math.floor(a),right:Math.floor(u),bottom:Math.floor(d)}}var tn=(e,t,n,o,r,i)=>{let s=wd(i,t,n),a=(t-s.x)/e.width,l=(n-s.y)/e.height,c=Math.min(a,l),u=yt(c,o,r),d=e.x+e.width/2,f=e.y+e.height/2,p=t/2-d*u,g=n/2-f*u,w=bd(e,p,g,u,t,n),x={left:Math.min(w.left-s.left,0),top:Math.min(w.top-s.top,0),right:Math.min(w.right-s.right,0),bottom:Math.min(w.bottom-s.bottom,0)};return{x:p-x.left+x.right,y:g-x.top+x.bottom,zoom:u}},Et=()=>typeof navigator<"u"&&navigator?.userAgent?.indexOf("Mac")>=0;function xt(e){return e!=null&&e!=="parent"}function Ie(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function Ro(e){return(e.measured?.width??e.width??e.initialWidth)!==void 0&&(e.measured?.height??e.height??e.initialHeight)!==void 0}function Lo(e,t={width:0,height:0},n,o,r){let i={...e},s=o.get(n);if(s){let a=s.origin||r;i.x+=s.internals.positionAbsolute.x-(t.width??0)*a[0],i.y+=s.internals.positionAbsolute.y-(t.height??0)*a[1]}return i}function Bo(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function Es(){let e,t;return{promise:new Promise((o,r)=>{e=o,t=r}),resolve:e,reject:t}}function Ns(e){return{...Mo,...e||{}}}function Jt(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:o,containerBounds:r}){let{x:i,y:s}=be(e),a=St({x:i-(r?.left??0),y:s-(r?.top??0)},o),{x:l,y:c}=n?vt(a,t):a;return{xSnapped:l,ySnapped:c,...a}}var Fn=e=>({width:e.offsetWidth,height:e.offsetHeight}),Vo=e=>e?.getRootNode?.()||window?.document,_d=["INPUT","SELECT","TEXTAREA"];function Fo(e){let t=e.composedPath?.()?.[0]||e.target;return t?.nodeType!==1?!1:_d.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}var Xo=e=>"clientX"in e,be=(e,t)=>{let n=Xo(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)}},as=(e,t,n,o,r)=>{let i=t.querySelectorAll(`.${e}`);return!i||!i.length?null:Array.from(i).map(s=>{let a=s.getBoundingClientRect();return{id:s.getAttribute("data-handleid"),type:e,nodeId:r,position:s.getAttribute("data-handlepos"),x:(a.left-n.left)/o,y:(a.top-n.top)/o,...Fn(s)}})};function Xn({sourceX:e,sourceY:t,targetX:n,targetY:o,sourceControlX:r,sourceControlY:i,targetControlX:s,targetControlY:a}){let l=e*.125+r*.375+s*.375+n*.125,c=t*.125+i*.375+a*.375+o*.125,u=Math.abs(l-e),d=Math.abs(c-t);return[l,c,u,d]}function On(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function cs({pos:e,x1:t,y1:n,x2:o,y2:r,c:i}){switch(e){case X.Left:return[t-On(t-o,i),n];case X.Right:return[t+On(o-t,i),n];case X.Top:return[t,n-On(n-r,i)];case X.Bottom:return[t,n+On(r-n,i)]}}function Yn({sourceX:e,sourceY:t,sourcePosition:n=X.Bottom,targetX:o,targetY:r,targetPosition:i=X.Top,curvature:s=.25}){let[a,l]=cs({pos:n,x1:e,y1:t,x2:o,y2:r,c:s}),[c,u]=cs({pos:i,x1:o,y1:r,x2:e,y2:t,c:s}),[d,f,p,g]=Xn({sourceX:e,sourceY:t,targetX:o,targetY:r,sourceControlX:a,sourceControlY:l,targetControlX:c,targetControlY:u});return[`M${e},${t} C${a},${l} ${c},${u} ${o},${r}`,d,f,p,g]}function Yo({sourceX:e,sourceY:t,targetX:n,targetY:o}){let r=Math.abs(n-e)/2,i=n<e?n+r:n-r,s=Math.abs(o-t)/2,a=o<t?o+s:o-s;return[i,a,r,s]}function Cs({sourceNode:e,targetNode:t,selected:n=!1,zIndex:o=0,elevateOnSelect:r=!1,zIndexMode:i="basic"}){if(i==="manual")return o;let s=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 s+a}function ks({sourceNode:e,targetNode:t,width:n,height:o,transform:r}){let i=Bn(Rn(e),Rn(t));i.x===i.x2&&(i.x2+=1),i.y===i.y2&&(i.y2+=1);let s={x:-r[0]/r[2],y:-r[1]/r[2],width:n/r[2],height:o/r[2]};return _t(s,Vn(i))>0}var vd=({source:e,sourceHandle:t,target:n,targetHandle:o})=>`xy-edge__${e}${t||""}-${n}${o||""}`,Sd=(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)),Zo=(e,t,n={})=>{if(!e.source||!e.target)return Ho("006",ye.error006()),t;let o=n.getEdgeId||vd,r;return zo(e)?r={...e}:r={...e,id:o(e)},Sd(r,t)?t:(r.sourceHandle===null&&delete r.sourceHandle,r.targetHandle===null&&delete r.targetHandle,t.concat(r))};function Zn({sourceX:e,sourceY:t,targetX:n,targetY:o}){let[r,i,s,a]=Yo({sourceX:e,sourceY:t,targetX:n,targetY:o});return[`M ${e},${t}L ${n},${o}`,r,i,s,a]}var ls={[X.Left]:{x:-1,y:0},[X.Right]:{x:1,y:0},[X.Top]:{x:0,y:-1},[X.Bottom]:{x:0,y:1}},Ed=({source:e,sourcePosition:t=X.Bottom,target:n})=>t===X.Left||t===X.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},us=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function Nd({source:e,sourcePosition:t=X.Bottom,target:n,targetPosition:o=X.Top,center:r,offset:i,stepPosition:s}){let a=ls[t],l=ls[o],c={x:e.x+a.x*i,y:e.y+a.y*i},u={x:n.x+l.x*i,y:n.y+l.y*i},d=Ed({source:c,sourcePosition:t,target:u}),f=d.x!==0?"x":"y",p=d[f],g=[],w,x,m={x:0,y:0},_={x:0,y:0},[,,h,y]=Yo({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(a[f]*l[f]===-1){f==="x"?(w=r.x??c.x+(u.x-c.x)*s,x=r.y??(c.y+u.y)/2):(w=r.x??(c.x+u.x)/2,x=r.y??c.y+(u.y-c.y)*s);let v=[{x:w,y:c.y},{x:w,y:u.y}],N=[{x:c.x,y:x},{x:u.x,y:x}];a[f]===p?g=f==="x"?v:N:g=f==="x"?N:v}else{let v=[{x:c.x,y:u.y}],N=[{x:u.x,y:c.y}];if(f==="x"?g=a.x===p?N:v:g=a.y===p?v:N,t===o){let D=Math.abs(e[f]-n[f]);if(D<=i){let O=Math.min(i-1,i-D);a[f]===p?m[f]=(c[f]>e[f]?-1:1)*O:_[f]=(u[f]>n[f]?-1:1)*O}}if(t!==o){let D=f==="x"?"y":"x",O=a[f]===l[D],b=c[D]>u[D],C=c[D]<u[D];(a[f]===1&&(!O&&b||O&&C)||a[f]!==1&&(!O&&C||O&&b))&&(g=f==="x"?v:N)}let A={x:c.x+m.x,y:c.y+m.y},z={x:u.x+_.x,y:u.y+_.y},L=Math.max(Math.abs(A.x-g[0].x),Math.abs(z.x-g[0].x)),I=Math.max(Math.abs(A.y-g[0].y),Math.abs(z.y-g[0].y));L>=I?(w=(A.x+z.x)/2,x=g[0].y):(w=g[0].x,x=(A.y+z.y)/2)}return[[e,{x:c.x+m.x,y:c.y+m.y},...g,{x:u.x+_.x,y:u.y+_.y},n],w,x,h,y]}function Cd(e,t,n,o){let r=Math.min(us(e,t)/2,us(t,n)/2,o),{x:i,y:s}=t;if(e.x===i&&i===n.x||e.y===s&&s===n.y)return`L${i} ${s}`;if(e.y===s){let c=e.x<n.x?-1:1,u=e.y<n.y?1:-1;return`L ${i+r*c},${s}Q ${i},${s} ${i},${s+r*u}`}let a=e.x<n.x?1:-1,l=e.y<n.y?-1:1;return`L ${i},${s+r*l}Q ${i},${s} ${i+r*a},${s}`}function nn({sourceX:e,sourceY:t,sourcePosition:n=X.Bottom,targetX:o,targetY:r,targetPosition:i=X.Top,borderRadius:s=5,centerX:a,centerY:l,offset:c=20,stepPosition:u=.5}){let[d,f,p,g,w]=Nd({source:{x:e,y:t},sourcePosition:n,target:{x:o,y:r},targetPosition:i,center:{x:a,y:l},offset:c,stepPosition:u});return[d.reduce((m,_,h)=>{let y="";return h>0&&h<d.length-1?y=Cd(d[h-1],_,d[h+1],s):y=`${h===0?"M":"L"}${_.x} ${_.y}`,m+=y,m},""),f,p,g,w]}function ds(e){return e&&!!(e.internals.handleBounds||e.handles?.length)&&!!(e.measured.width||e.width||e.initialWidth)}function Ms(e){let{sourceNode:t,targetNode:n}=e;if(!ds(t)||!ds(n))return null;let o=t.internals.handleBounds||fs(t.handles),r=n.internals.handleBounds||fs(n.handles),i=hs(o?.source??[],e.sourceHandle),s=hs(e.connectionMode===Ye.Strict?r?.target??[]:(r?.target??[]).concat(r?.source??[]),e.targetHandle);if(!i||!s)return e.onError?.("008",ye.error008(i?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;let a=i?.position||X.Bottom,l=s?.position||X.Top,c=Ze(t,i,a),u=Ze(n,s,l);return{sourceX:c.x,sourceY:c.y,targetX:u.x,targetY:u.y,sourcePosition:a,targetPosition:l}}function fs(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 Ze(e,t,n=X.Left,o=!1){let r=(t?.x??0)+e.internals.positionAbsolute.x,i=(t?.y??0)+e.internals.positionAbsolute.y,{width:s,height:a}=t??Ie(e);if(o)return{x:r+s/2,y:i+a/2};switch(t?.position??n){case X.Top:return{x:r+s/2,y:i};case X.Right:return{x:r+s,y:i+a/2};case X.Bottom:return{x:r+s/2,y:i+a};case X.Left:return{x:r,y:i+a/2}}}function hs(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}function Wn(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(o=>`${o}=${e[o]}`).join("&")}`:""}function Is(e,{id:t,defaultColor:n,defaultMarkerStart:o,defaultMarkerEnd:r}){let i=new Set;return e.reduce((s,a)=>([a.markerStart||o,a.markerEnd||r].forEach(l=>{if(l&&typeof l=="object"){let c=Wn(l,t);i.has(c)||(s.push({id:c,color:l.color||n,...l}),i.add(c))}}),s),[]).sort((s,a)=>s.id.localeCompare(a.id))}var Ps=1e3,kd=10,Wo={nodeOrigin:[0,0],nodeExtent:wt,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},Md={...Wo,checkEquality:!0};function qo(e,t){let n={...e};for(let o in t)t[o]!==void 0&&(n[o]=t[o]);return n}function zs(e,t,n){let o=qo(Wo,n);for(let r of e.values())if(r.parentId)Go(r,e,t,o);else{let i=en(r,o.nodeOrigin),s=xt(r.extent)?r.extent:o.nodeExtent,a=it(i,s,Ie(r));r.internals.positionAbsolute=a}}function Id(e,t){if(!e.handles)return e.measured?t?.internals.handleBounds:void 0;let n=[],o=[];for(let r of e.handles){let i={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(i):r.type==="target"&&o.push(i)}return{source:n,target:o}}function Ko(e){return e==="manual"}function qn(e,t,n,o={}){let r=qo(Md,o),i={i:0},s=new Map(t),a=r?.elevateNodesOnSelect&&!Ko(r.zIndexMode)?Ps:0,l=e.length>0;t.clear(),n.clear();for(let c of e){let u=s.get(c.id);if(r.checkEquality&&c===u?.internals.userNode)t.set(c.id,u);else{let d=en(c,r.nodeOrigin),f=xt(c.extent)?c.extent:r.nodeExtent,p=it(d,f,Ie(c));u={...r.defaults,...c,measured:{width:c.measured?.width,height:c.measured?.height},internals:{positionAbsolute:p,handleBounds:Id(c,u),z:As(c,a,r.zIndexMode),userNode:c}},t.set(c.id,u)}(u.measured===void 0||u.measured.width===void 0||u.measured.height===void 0)&&!u.hidden&&(l=!1),c.parentId&&Go(u,t,n,o,i)}return l}function Pd(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 Go(e,t,n,o,r){let{elevateNodesOnSelect:i,nodeOrigin:s,nodeExtent:a,zIndexMode:l}=qo(Wo,o),c=e.parentId,u=t.get(c);if(!u){console.warn(`Parent node ${c} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}Pd(e,n),r&&!u.parentId&&u.internals.rootParentIndex===void 0&&l==="auto"&&(u.internals.rootParentIndex=++r.i,u.internals.z=u.internals.z+r.i*kd),r&&u.internals.rootParentIndex!==void 0&&(r.i=u.internals.rootParentIndex);let d=i&&!Ko(l)?Ps:0,{x:f,y:p,z:g}=zd(e,u,s,a,d,l),{positionAbsolute:w}=e.internals,x=f!==w.x||p!==w.y;(x||g!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:x?{x:f,y:p}:w,z:g}})}function As(e,t,n){let o=we(e.zIndex)?e.zIndex:0;return Ko(n)?o:o+(e.selected?t:0)}function zd(e,t,n,o,r,i){let{x:s,y:a}=t.internals.positionAbsolute,l=Ie(e),c=en(e,n),u=xt(e.extent)?it(c,e.extent,l):c,d=it({x:s+u.x,y:a+u.y},o,l);e.extent==="parent"&&(d=vs(d,l,t));let f=As(e,r,i),p=t.internals.z??0;return{x:d.x,y:d.y,z:p>=f?p+1:f}}function Kn(e,t,n,o=[0,0]){let r=[],i=new Map;for(let s of e){let a=t.get(s.parentId);if(!a)continue;let l=i.get(s.parentId)?.expandedRect??st(a),c=$o(l,s.rect);i.set(s.parentId,{expandedRect:c,parent:a})}return i.size>0&&i.forEach(({expandedRect:s,parent:a},l)=>{let c=a.internals.positionAbsolute,u=Ie(a),d=a.origin??o,f=s.x<c.x?Math.round(Math.abs(c.x-s.x)):0,p=s.y<c.y?Math.round(Math.abs(c.y-s.y)):0,g=Math.max(u.width,Math.round(s.width)),w=Math.max(u.height,Math.round(s.height)),x=(g-u.width)*d[0],m=(w-u.height)*d[1];(f>0||p>0||x||m)&&(r.push({id:l,type:"position",position:{x:a.position.x-f+x,y:a.position.y-p+m}}),n.get(l)?.forEach(_=>{e.some(h=>h.id===_.id)||r.push({id:_.id,type:"position",position:{x:_.position.x+f,y:_.position.y+p}})})),(u.width<s.width||u.height<s.height||f||p)&&r.push({id:l,type:"dimensions",setAttributes:!0,dimensions:{width:g+(f?d[0]*f-x:0),height:w+(p?d[1]*p-m:0)}})}),r}function Ds(e,t,n,o,r,i,s){let a=o?.querySelector(".xyflow__viewport"),l=!1;if(!a)return{changes:[],updatedInternals:l};let c=[],u=window.getComputedStyle(a),{m22:d}=new window.DOMMatrixReadOnly(u.transform),f=[];for(let p of e.values()){let g=t.get(p.id);if(!g)continue;if(g.hidden){t.set(g.id,{...g,internals:{...g.internals,handleBounds:void 0}}),l=!0;continue}let w=Fn(p.nodeElement),x=g.measured.width!==w.width||g.measured.height!==w.height;if(!!(w.width&&w.height&&(x||!g.internals.handleBounds||p.force))){let _=p.nodeElement.getBoundingClientRect(),h=xt(g.extent)?g.extent:i,{positionAbsolute:y}=g.internals;g.parentId&&g.extent==="parent"?y=vs(y,w,t.get(g.parentId)):h&&(y=it(y,h,w));let E={...g,measured:w,internals:{...g.internals,positionAbsolute:y,handleBounds:{source:as("source",p.nodeElement,_,d,g.id),target:as("target",p.nodeElement,_,d,g.id)}}};t.set(g.id,E),g.parentId&&Go(E,t,n,{nodeOrigin:r,zIndexMode:s}),l=!0,x&&(c.push({id:g.id,type:"dimensions",dimensions:w}),g.expandParent&&g.parentId&&f.push({id:g.id,parentId:g.parentId,rect:st(E,r)}))}}if(f.length>0){let p=Kn(f,t,n,r);c.push(...p)}return{changes:c,updatedInternals:l}}async function Ts({delta:e,panZoom:t,transform:n,translateExtent:o,width:r,height:i}){if(!t||!e.x&&!e.y)return Promise.resolve(!1);let s=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[r,i]],o),a=!!s&&(s.x!==n[0]||s.y!==n[1]||s.k!==n[2]);return Promise.resolve(a)}function ps(e,t,n,o,r,i){let s=r,a=o.get(s)||new Map;o.set(s,a.set(n,t)),s=`${r}-${e}`;let l=o.get(s)||new Map;if(o.set(s,l.set(n,t)),i){s=`${r}-${e}-${i}`;let c=o.get(s)||new Map;o.set(s,c.set(n,t))}}function Uo(e,t,n){e.clear(),t.clear();for(let o of n){let{source:r,target:i,sourceHandle:s=null,targetHandle:a=null}=o,l={edgeId:o.id,source:r,target:i,sourceHandle:s,targetHandle:a},c=`${r}-${s}--${i}-${a}`,u=`${i}-${a}--${r}-${s}`;ps("source",l,u,e,r,s),ps("target",l,c,e,i,a),t.set(o.id,o)}}function $s(e,t){if(!e.parentId)return!1;let n=t.get(e.parentId);return n?n.selected?!0:$s(n,t):!1}function gs(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 Ad(e,t,n,o){let r=new Map;for(let[i,s]of e)if((s.selected||s.id===o)&&(!s.parentId||!$s(s,e))&&(s.draggable||t&&typeof s.draggable>"u")){let a=e.get(i);a&&r.set(i,{id:i,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 So({nodeId:e,dragItems:t,nodeLookup:n,dragging:o=!0}){let r=[];for(let[s,a]of t){let l=n.get(s)?.internals.userNode;l&&r.push({...l,position:a.position,dragging:o})}if(!e)return[r[0],r];let i=n.get(e)?.internals.userNode;return[i?{...i,position:t.get(e)?.position||i.position,dragging:o}:r[0],r]}function Dd({dragItems:e,snapGrid:t,x:n,y:o}){let r=e.values().next().value;if(!r)return null;let i={x:n-r.distance.x,y:o-r.distance.y},s=vt(i,t);return{x:s.x-i.x,y:s.y-i.y}}function Os({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:o,onDragStop:r}){let i={x:null,y:null},s=0,a=new Map,l=!1,c={x:0,y:0},u=null,d=!1,f=null,p=!1,g=!1,w=null;function x({noDragClassName:_,handleSelector:h,domNode:y,isSelectable:E,nodeId:v,nodeClickDistance:N=0}){f=ue(y);function A({x:D,y:O}){let{nodeLookup:b,nodeExtent:C,snapGrid:S,snapToGrid:M,nodeOrigin:k,onNodeDrag:P,onSelectionDrag:$,onError:R,updateNodePositions:H}=t();i={x:D,y:O};let F=!1,V=a.size>1,W=V&&C?Co(bt(a)):null,G=V&&M?Dd({dragItems:a,snapGrid:S,x:D,y:O}):null;for(let[Z,B]of a){if(!b.has(Z))continue;let Y={x:D-B.distance.x,y:O-B.distance.y};M&&(Y=G?{x:Math.round(Y.x+G.x),y:Math.round(Y.y+G.y)}:vt(Y,S));let Q=null;if(V&&C&&!B.extent&&W){let{positionAbsolute:K}=B.internals,j=K.x-W.x+C[0][0],oe=K.x+B.measured.width-W.x2+C[1][0],ne=K.y-W.y+C[0][1],he=K.y+B.measured.height-W.y2+C[1][1];Q=[[j,ne],[oe,he]]}let{position:U,positionAbsolute:q}=To({nodeId:Z,nextPosition:Y,nodeLookup:b,nodeExtent:Q||C,nodeOrigin:k,onError:R});F=F||B.position.x!==U.x||B.position.y!==U.y,B.position=U,B.internals.positionAbsolute=q}if(g=g||F,!!F&&(H(a,!0),w&&(o||P||!v&&$))){let[Z,B]=So({nodeId:v,dragItems:a,nodeLookup:b});o?.(w,a,Z,B),P?.(w,Z,B),v||$?.(w,B)}}async function z(){if(!u)return;let{transform:D,panBy:O,autoPanSpeed:b,autoPanOnNodeDrag:C}=t();if(!C){l=!1,cancelAnimationFrame(s);return}let[S,M]=Ss(c,u,b);(S!==0||M!==0)&&(i.x=(i.x??0)-S/D[2],i.y=(i.y??0)-M/D[2],await O({x:S,y:M})&&A(i)),s=requestAnimationFrame(z)}function L(D){let{nodeLookup:O,multiSelectionActive:b,nodesDraggable:C,transform:S,snapGrid:M,snapToGrid:k,selectNodesOnDrag:P,onNodeDragStart:$,onSelectionDragStart:R,unselectNodesAndEdges:H}=t();d=!0,(!P||!E)&&!b&&v&&(O.get(v)?.selected||H()),E&&P&&v&&e?.(v);let F=Jt(D.sourceEvent,{transform:S,snapGrid:M,snapToGrid:k,containerBounds:u});if(i=F,a=Ad(O,C,F,v),a.size>0&&(n||$||!v&&R)){let[V,W]=So({nodeId:v,dragItems:a,nodeLookup:O});n?.(D.sourceEvent,a,V,W),$?.(D.sourceEvent,V,W),v||R?.(D.sourceEvent,W)}}let I=pn().clickDistance(N).on("start",D=>{let{domNode:O,nodeDragThreshold:b,transform:C,snapGrid:S,snapToGrid:M}=t();u=O?.getBoundingClientRect()||null,p=!1,g=!1,w=D.sourceEvent,b===0&&L(D),i=Jt(D.sourceEvent,{transform:C,snapGrid:S,snapToGrid:M,containerBounds:u}),c=be(D.sourceEvent,u)}).on("drag",D=>{let{autoPanOnNodeDrag:O,transform:b,snapGrid:C,snapToGrid:S,nodeDragThreshold:M,nodeLookup:k}=t(),P=Jt(D.sourceEvent,{transform:b,snapGrid:C,snapToGrid:S,containerBounds:u});if(w=D.sourceEvent,(D.sourceEvent.type==="touchmove"&&D.sourceEvent.touches.length>1||v&&!k.has(v))&&(p=!0),!p){if(!l&&O&&d&&(l=!0,z()),!d){let $=be(D.sourceEvent,u),R=$.x-c.x,H=$.y-c.y;Math.sqrt(R*R+H*H)>M&&L(D)}(i.x!==P.xSnapped||i.y!==P.ySnapped)&&a&&d&&(c=be(D.sourceEvent,u),A(P))}}).on("end",D=>{if(!(!d||p)&&(l=!1,d=!1,cancelAnimationFrame(s),a.size>0)){let{nodeLookup:O,updateNodePositions:b,onNodeDragStop:C,onSelectionDragStop:S}=t();if(g&&(b(a,!1),g=!1),r||C||!v&&S){let[M,k]=So({nodeId:v,dragItems:a,nodeLookup:O,dragging:!1});r?.(D.sourceEvent,a,M,k),C?.(D.sourceEvent,M,k),v||S?.(D.sourceEvent,k)}}}).filter(D=>{let O=D.target;return!D.button&&(!_||!gs(O,`.${_}`,y))&&(!h||gs(O,h,y))});f.call(I)}function m(){f?.on(".drag",null)}return{update:x,destroy:m}}function Td(e,t,n){let o=[],r={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(let i of t.values())_t(r,st(i))>0&&o.push(i);return o}var $d=250;function Od(e,t,n,o){let r=[],i=1/0,s=Td(e,n,t+$d);for(let a of s){let l=[...a.internals.handleBounds?.source??[],...a.internals.handleBounds?.target??[]];for(let c of l){if(o.nodeId===c.nodeId&&o.type===c.type&&o.id===c.id)continue;let{x:u,y:d}=Ze(a,c,c.position,!0),f=Math.sqrt(Math.pow(u-e.x,2)+Math.pow(d-e.y,2));f>t||(f<i?(r=[{...c,x:u,y:d}],i=f):f===i&&r.push({...c,x:u,y:d}))}}if(!r.length)return null;if(r.length>1){let a=o.type==="source"?"target":"source";return r.find(l=>l.type===a)??r[0]}return r[0]}function Hs(e,t,n,o,r,i=!1){let s=o.get(e);if(!s)return null;let a=r==="strict"?s.internals.handleBounds?.[t]:[...s.internals.handleBounds?.source??[],...s.internals.handleBounds?.target??[]],l=(n?a?.find(c=>c.id===n):a?.[0])??null;return l&&i?{...l,...Ze(s,l,l.position,!0)}:l}function Rs(e,t){return e||(t?.classList.contains("target")?"target":t?.classList.contains("source")?"source":null)}function Hd(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}var Ls=()=>!0;function Rd(e,{connectionMode:t,connectionRadius:n,handleId:o,nodeId:r,edgeUpdaterType:i,isTarget:s,domNode:a,nodeLookup:l,lib:c,autoPanOnConnect:u,flowId:d,panBy:f,cancelConnection:p,onConnectStart:g,onConnect:w,onConnectEnd:x,isValidConnection:m=Ls,onReconnectEnd:_,updateConnection:h,getTransform:y,getFromHandle:E,autoPanSpeed:v,dragThreshold:N=1,handleDomNode:A}){let z=Vo(e.target),L=0,I,{x:D,y:O}=be(e),b=Rs(i,A),C=a?.getBoundingClientRect(),S=!1;if(!C||!b)return;let M=Hs(r,b,o,l,t);if(!M)return;let k=be(e,C),P=!1,$=null,R=!1,H=null;function F(){if(!u||!C)return;let[U,q]=Ss(k,C,v);f({x:U,y:q}),L=requestAnimationFrame(F)}let V={...M,nodeId:r,type:b,position:M.position},W=l.get(r),Z={inProgress:!0,isValid:null,from:Ze(W,V,X.Left,!0),fromHandle:V,fromPosition:V.position,fromNode:W,to:k,toHandle:null,toPosition:is[V.position],toNode:null,pointer:k};function B(){S=!0,h(Z),g?.(e,{nodeId:r,handleId:o,handleType:b})}N===0&&B();function Y(U){if(!S){let{x:he,y:Re}=be(U),ze=he-D,qe=Re-O;if(!(ze*ze+qe*qe>N*N))return;B()}if(!E()||!V){Q(U);return}let q=y();k=be(U,C),I=Od(St(k,q,!1,[1,1]),n,l,V),P||(F(),P=!0);let K=Bs(U,{handle:I,connectionMode:t,fromNodeId:r,fromHandleId:o,fromType:s?"target":"source",isValidConnection:m,doc:z,lib:c,flowId:d,nodeLookup:l});H=K.handleDomNode,$=K.connection,R=Hd(!!I,K.isValid);let j=l.get(r),oe=j?Ze(j,V,X.Left,!0):Z.from,ne={...Z,from:oe,isValid:R,to:K.toHandle&&R?jt({x:K.toHandle.x,y:K.toHandle.y},q):k,toHandle:K.toHandle,toPosition:R&&K.toHandle?K.toHandle.position:is[V.position],toNode:K.toHandle?l.get(K.toHandle.nodeId):null,pointer:k};h(ne),Z=ne}function Q(U){if(!("touches"in U&&U.touches.length>0)){if(S){(I||H)&&$&&R&&w?.($);let{inProgress:q,...K}=Z,j={...K,toPosition:Z.toHandle?Z.toPosition:null};x?.(U,j),i&&_?.(U,j)}p(),cancelAnimationFrame(L),P=!1,R=!1,$=null,H=null,z.removeEventListener("mousemove",Y),z.removeEventListener("mouseup",Q),z.removeEventListener("touchmove",Y),z.removeEventListener("touchend",Q)}}z.addEventListener("mousemove",Y),z.addEventListener("mouseup",Q),z.addEventListener("touchmove",Y),z.addEventListener("touchend",Q)}function Bs(e,{handle:t,connectionMode:n,fromNodeId:o,fromHandleId:r,fromType:i,doc:s,lib:a,flowId:l,isValidConnection:c=Ls,nodeLookup:u}){let d=i==="target",f=t?s.querySelector(`.${a}-flow__handle[data-id="${l}-${t?.nodeId}-${t?.id}-${t?.type}"]`):null,{x:p,y:g}=be(e),w=s.elementFromPoint(p,g),x=w?.classList.contains(`${a}-flow__handle`)?w:f,m={handleDomNode:x,isValid:!1,connection:null,toHandle:null};if(x){let _=Rs(void 0,x),h=x.getAttribute("data-nodeid"),y=x.getAttribute("data-handleid"),E=x.classList.contains("connectable"),v=x.classList.contains("connectableend");if(!h||!_)return m;let N={source:d?h:o,sourceHandle:d?y:r,target:d?o:h,targetHandle:d?r:y};m.connection=N;let z=E&&v&&(n===Ye.Strict?d&&_==="source"||!d&&_==="target":h!==o||y!==r);m.isValid=z&&c(N),m.toHandle=Hs(h,_,y,u,n,!0)}return m}var Gn={onPointerDown:Rd,isValid:Bs};function Vs({domNode:e,panZoom:t,getTransform:n,getViewScale:o}){let r=ue(e);function i({translateExtent:a,width:l,height:c,zoomStep:u=1,pannable:d=!0,zoomable:f=!0,inversePan:p=!1}){let g=h=>{if(h.sourceEvent.type!=="wheel"||!t)return;let y=n(),E=h.sourceEvent.ctrlKey&&Et()?10:1,v=-h.sourceEvent.deltaY*(h.sourceEvent.deltaMode===1?.05:h.sourceEvent.deltaMode?1:.002)*u,N=y[2]*Math.pow(2,v*E);t.scaleTo(N)},w=[0,0],x=h=>{(h.sourceEvent.type==="mousedown"||h.sourceEvent.type==="touchstart")&&(w=[h.sourceEvent.clientX??h.sourceEvent.touches[0].clientX,h.sourceEvent.clientY??h.sourceEvent.touches[0].clientY])},m=h=>{let y=n();if(h.sourceEvent.type!=="mousemove"&&h.sourceEvent.type!=="touchmove"||!t)return;let E=[h.sourceEvent.clientX??h.sourceEvent.touches[0].clientX,h.sourceEvent.clientY??h.sourceEvent.touches[0].clientY],v=[E[0]-w[0],E[1]-w[1]];w=E;let N=o()*Math.max(y[2],Math.log(y[2]))*(p?-1:1),A={x:y[0]-v[0]*N,y:y[1]-v[1]*N},z=[[0,0],[l,c]];t.setViewportConstrained({x:A.x,y:A.y,zoom:y[2]},z,a)},_=$n().on("start",x).on("zoom",d?m:null).on("zoom.wheel",f?g:null);r.call(_,{})}function s(){r.on("zoom",null)}return{update:i,destroy:s,pointer:pe}}var Un=e=>({x:e.x,y:e.y,zoom:e.k}),Eo=({x:e,y:t,zoom:n})=>ot.translate(e,t).scale(n),gt=(e,t)=>e.target.closest(`.${t}`),Fs=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),Ld=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,No=(e,t=0,n=Ld,o=()=>{})=>{let r=typeof t=="number"&&t>0;return r||o(),r?e.transition().duration(t).ease(n).on("end",o):e},Xs=e=>{let t=e.ctrlKey&&Et()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function Bd({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:o,panOnScrollMode:r,panOnScrollSpeed:i,zoomOnPinch:s,onPanZoomStart:a,onPanZoom:l,onPanZoomEnd:c}){return u=>{if(gt(u,t))return u.ctrlKey&&u.preventDefault(),!1;u.preventDefault(),u.stopImmediatePropagation();let d=n.property("__zoom").k||1;if(u.ctrlKey&&s){let x=pe(u),m=Xs(u),_=d*Math.pow(2,m);o.scaleTo(n,_,x,u);return}let f=u.deltaMode===1?20:1,p=r===Oe.Vertical?0:u.deltaX*f,g=r===Oe.Horizontal?0:u.deltaY*f;!Et()&&u.shiftKey&&r!==Oe.Vertical&&(p=u.deltaY*f,g=0),o.translateBy(n,-(p/d)*i,-(g/d)*i,{internal:!0});let w=Un(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(l?.(u,w),e.panScrollTimeout=setTimeout(()=>{c?.(u,w),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,a?.(u,w))}}function Vd({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(o,r){let i=o.type==="wheel",s=!t&&i&&!o.ctrlKey,a=gt(o,e);if(o.ctrlKey&&i&&a&&o.preventDefault(),s||a)return null;o.preventDefault(),n.call(this,o,r)}}function Fd({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return o=>{if(o.sourceEvent?.internal)return;let r=Un(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 Xd({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:o,onPanZoom:r}){return i=>{e.usedRightMouseButton=!!(n&&Fs(t,e.mouseButton??0)),i.sourceEvent?.sync||o([i.transform.x,i.transform.y,i.transform.k]),r&&!i.sourceEvent?.internal&&r?.(i.sourceEvent,Un(i.transform))}}function Yd({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:o,onPanZoomEnd:r,onPaneContextMenu:i}){return s=>{if(!s.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,i&&Fs(t,e.mouseButton??0)&&!e.usedRightMouseButton&&s.sourceEvent&&i(s.sourceEvent),e.usedRightMouseButton=!1,o(!1),r)){let a=Un(s.transform);e.prevViewport=a,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{r?.(s.sourceEvent,a)},n?150:0)}}}function Zd({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:o,panOnScroll:r,zoomOnDoubleClick:i,userSelectionActive:s,noWheelClassName:a,noPanClassName:l,lib:c,connectionInProgress:u}){return d=>{let f=e||t,p=n&&d.ctrlKey,g=d.type==="wheel";if(d.button===1&&d.type==="mousedown"&&(gt(d,`${c}-flow__node`)||gt(d,`${c}-flow__edge`)))return!0;if(!o&&!f&&!r&&!i&&!n||s||u&&!g||gt(d,a)&&g||gt(d,l)&&(!g||r&&g&&!e)||!n&&d.ctrlKey&&g)return!1;if(!n&&d.type==="touchstart"&&d.touches?.length>1)return d.preventDefault(),!1;if(!f&&!r&&!p&&g||!o&&(d.type==="mousedown"||d.type==="touchstart")||Array.isArray(o)&&!o.includes(d.button)&&d.type==="mousedown")return!1;let w=Array.isArray(o)&&o.includes(d.button)||!d.button||d.button<=1;return(!d.ctrlKey||g)&&w}}function Ys({domNode:e,minZoom:t,maxZoom:n,translateExtent:o,viewport:r,onPanZoom:i,onPanZoomStart:s,onPanZoomEnd:a,onDraggingChange:l}){let c={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{x:0,y:0,zoom:0},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},u=e.getBoundingClientRect(),d=$n().scaleExtent([t,n]).translateExtent(o),f=ue(e).call(d);_({x:r.x,y:r.y,zoom:yt(r.zoom,t,n)},[[0,0],[u.width,u.height]],o);let p=f.on("wheel.zoom"),g=f.on("dblclick.zoom");d.wheelDelta(Xs);function w(I,D){return f?new Promise(O=>{d?.interpolate(D?.interpolate==="linear"?Te:et).transform(No(f,D?.duration,D?.ease,()=>O(!0)),I)}):Promise.resolve(!1)}function x({noWheelClassName:I,noPanClassName:D,onPaneContextMenu:O,userSelectionActive:b,panOnScroll:C,panOnDrag:S,panOnScrollMode:M,panOnScrollSpeed:k,preventScrolling:P,zoomOnPinch:$,zoomOnScroll:R,zoomOnDoubleClick:H,zoomActivationKeyPressed:F,lib:V,onTransformChange:W,connectionInProgress:G,paneClickDistance:Z,selectionOnDrag:B}){b&&!c.isZoomingOrPanning&&m();let Y=C&&!F&&!b;d.clickDistance(B?1/0:!we(Z)||Z<0?0:Z);let Q=Y?Bd({zoomPanValues:c,noWheelClassName:I,d3Selection:f,d3Zoom:d,panOnScrollMode:M,panOnScrollSpeed:k,zoomOnPinch:$,onPanZoomStart:s,onPanZoom:i,onPanZoomEnd:a}):Vd({noWheelClassName:I,preventScrolling:P,d3ZoomHandler:p});if(f.on("wheel.zoom",Q,{passive:!1}),!b){let q=Fd({zoomPanValues:c,onDraggingChange:l,onPanZoomStart:s});d.on("start",q);let K=Xd({zoomPanValues:c,panOnDrag:S,onPaneContextMenu:!!O,onPanZoom:i,onTransformChange:W});d.on("zoom",K);let j=Yd({zoomPanValues:c,panOnDrag:S,panOnScroll:C,onPaneContextMenu:O,onPanZoomEnd:a,onDraggingChange:l});d.on("end",j)}let U=Zd({zoomActivationKeyPressed:F,panOnDrag:S,zoomOnScroll:R,panOnScroll:C,zoomOnDoubleClick:H,zoomOnPinch:$,userSelectionActive:b,noPanClassName:D,noWheelClassName:I,lib:V,connectionInProgress:G});d.filter(U),H?f.on("dblclick.zoom",g):f.on("dblclick.zoom",null)}function m(){d.on("zoom",null)}async function _(I,D,O){let b=Eo(I),C=d?.constrain()(b,D,O);return C&&await w(C),new Promise(S=>S(C))}async function h(I,D){let O=Eo(I);return await w(O,D),new Promise(b=>b(O))}function y(I){if(f){let D=Eo(I),O=f.property("__zoom");(O.k!==I.zoom||O.x!==I.x||O.y!==I.y)&&d?.transform(f,D,null,{sync:!0})}}function E(){let I=f?Qt(f.node()):{x:0,y:0,k:1};return{x:I.x,y:I.y,zoom:I.k}}function v(I,D){return f?new Promise(O=>{d?.interpolate(D?.interpolate==="linear"?Te:et).scaleTo(No(f,D?.duration,D?.ease,()=>O(!0)),I)}):Promise.resolve(!1)}function N(I,D){return f?new Promise(O=>{d?.interpolate(D?.interpolate==="linear"?Te:et).scaleBy(No(f,D?.duration,D?.ease,()=>O(!0)),I)}):Promise.resolve(!1)}function A(I){d?.scaleExtent(I)}function z(I){d?.translateExtent(I)}function L(I){let D=!we(I)||I<0?0:I;d?.clickDistance(D)}return{update:x,destroy:m,setViewport:h,setViewportConstrained:_,getViewport:E,scaleTo:v,scaleBy:N,setScaleExtent:A,setTranslateExtent:z,syncViewport:y,setClickDistance:L}}var He;(function(e){e.Line="line",e.Handle="handle"})(He||(He={}));var Zs=["top-left","top-right","bottom-left","bottom-right"],Ws=["top","right","bottom","left"];function Wd({width:e,prevWidth:t,height:n,prevHeight:o,affectsX:r,affectsY:i}){let s=e-t,a=n-o,l=[s>0?1:s<0?-1:0,a>0?1:a<0?-1:0];return s&&r&&(l[0]=l[0]*-1),a&&i&&(l[1]=l[1]*-1),l}function ms(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 Fe(e,t){return Math.max(0,t-e)}function Xe(e,t){return Math.max(0,e-t)}function Hn(e,t,n){return Math.max(0,t-e,e-n)}function ys(e,t){return e?!t:t}function qd(e,t,n,o,r,i,s,a){let{affectsX:l,affectsY:c}=t,{isHorizontal:u,isVertical:d}=t,f=u&&d,{xSnapped:p,ySnapped:g}=n,{minWidth:w,maxWidth:x,minHeight:m,maxHeight:_}=o,{x:h,y,width:E,height:v,aspectRatio:N}=e,A=Math.floor(u?p-e.pointerX:0),z=Math.floor(d?g-e.pointerY:0),L=E+(l?-A:A),I=v+(c?-z:z),D=-i[0]*E,O=-i[1]*v,b=Hn(L,w,x),C=Hn(I,m,_);if(s){let k=0,P=0;l&&A<0?k=Fe(h+A+D,s[0][0]):!l&&A>0&&(k=Xe(h+L+D,s[1][0])),c&&z<0?P=Fe(y+z+O,s[0][1]):!c&&z>0&&(P=Xe(y+I+O,s[1][1])),b=Math.max(b,k),C=Math.max(C,P)}if(a){let k=0,P=0;l&&A>0?k=Xe(h+A,a[0][0]):!l&&A<0&&(k=Fe(h+L,a[1][0])),c&&z>0?P=Xe(y+z,a[0][1]):!c&&z<0&&(P=Fe(y+I,a[1][1])),b=Math.max(b,k),C=Math.max(C,P)}if(r){if(u){let k=Hn(L/N,m,_)*N;if(b=Math.max(b,k),s){let P=0;!l&&!c||l&&!c&&f?P=Xe(y+O+L/N,s[1][1])*N:P=Fe(y+O+(l?A:-A)/N,s[0][1])*N,b=Math.max(b,P)}if(a){let P=0;!l&&!c||l&&!c&&f?P=Fe(y+L/N,a[1][1])*N:P=Xe(y+(l?A:-A)/N,a[0][1])*N,b=Math.max(b,P)}}if(d){let k=Hn(I*N,w,x)/N;if(C=Math.max(C,k),s){let P=0;!l&&!c||c&&!l&&f?P=Xe(h+I*N+D,s[1][0])/N:P=Fe(h+(c?z:-z)*N+D,s[0][0])/N,C=Math.max(C,P)}if(a){let P=0;!l&&!c||c&&!l&&f?P=Fe(h+I*N,a[1][0])/N:P=Xe(h+(c?z:-z)*N,a[0][0])/N,C=Math.max(C,P)}}}z=z+(z<0?C:-C),A=A+(A<0?b:-b),r&&(f?L>I*N?z=(ys(l,c)?-A:A)/N:A=(ys(l,c)?-z:z)*N:u?(z=A/N,c=l):(A=z*N,l=c));let S=l?h+A:h,M=c?y+z:y;return{width:E+(l?-A:A),height:v+(c?-z:z),x:i[0]*A*(l?-1:1)+S,y:i[1]*z*(c?-1:1)+M}}var qs={width:0,height:0,x:0,y:0},Kd={...qs,pointerX:0,pointerY:0,aspectRatio:1};function Gd(e){return[[0,0],[e.measured.width,e.measured.height]]}function Ud(e,t,n){let o=t.position.x+e.position.x,r=t.position.y+e.position.y,i=e.measured.width??0,s=e.measured.height??0,a=n[0]*i,l=n[1]*s;return[[o-a,r-l],[o+i-a,r+s-l]]}function Ks({domNode:e,nodeId:t,getStoreItems:n,onChange:o,onEnd:r}){let i=ue(e),s={controlDirection:ms("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function a({controlPosition:c,boundaries:u,keepAspectRatio:d,resizeDirection:f,onResizeStart:p,onResize:g,onResizeEnd:w,shouldResize:x}){let m={...qs},_={...Kd};s={boundaries:u,resizeDirection:f,keepAspectRatio:d,controlDirection:ms(c)};let h,y=null,E=[],v,N,A,z=!1,L=pn().on("start",I=>{let{nodeLookup:D,transform:O,snapGrid:b,snapToGrid:C,nodeOrigin:S,paneDomNode:M}=n();if(h=D.get(t),!h)return;y=M?.getBoundingClientRect()??null;let{xSnapped:k,ySnapped:P}=Jt(I.sourceEvent,{transform:O,snapGrid:b,snapToGrid:C,containerBounds:y});m={width:h.measured.width??0,height:h.measured.height??0,x:h.position.x??0,y:h.position.y??0},_={...m,pointerX:k,pointerY:P,aspectRatio:m.width/m.height},v=void 0,h.parentId&&(h.extent==="parent"||h.expandParent)&&(v=D.get(h.parentId),N=v&&h.extent==="parent"?Gd(v):void 0),E=[],A=void 0;for(let[$,R]of D)if(R.parentId===t&&(E.push({id:$,position:{...R.position},extent:R.extent}),R.extent==="parent"||R.expandParent)){let H=Ud(R,h,R.origin??S);A?A=[[Math.min(H[0][0],A[0][0]),Math.min(H[0][1],A[0][1])],[Math.max(H[1][0],A[1][0]),Math.max(H[1][1],A[1][1])]]:A=H}p?.(I,{...m})}).on("drag",I=>{let{transform:D,snapGrid:O,snapToGrid:b,nodeOrigin:C}=n(),S=Jt(I.sourceEvent,{transform:D,snapGrid:O,snapToGrid:b,containerBounds:y}),M=[];if(!h)return;let{x:k,y:P,width:$,height:R}=m,H={},F=h.origin??C,{width:V,height:W,x:G,y:Z}=qd(_,s.controlDirection,S,s.boundaries,s.keepAspectRatio,F,N,A),B=V!==$,Y=W!==R,Q=G!==k&&B,U=Z!==P&&Y;if(!Q&&!U&&!B&&!Y)return;if((Q||U||F[0]===1||F[1]===1)&&(H.x=Q?G:m.x,H.y=U?Z:m.y,m.x=H.x,m.y=H.y,E.length>0)){let oe=G-k,ne=Z-P;for(let he of E)he.position={x:he.position.x-oe+F[0]*(V-$),y:he.position.y-ne+F[1]*(W-R)},M.push(he)}if((B||Y)&&(H.width=B&&(!s.resizeDirection||s.resizeDirection==="horizontal")?V:m.width,H.height=Y&&(!s.resizeDirection||s.resizeDirection==="vertical")?W:m.height,m.width=H.width,m.height=H.height),v&&h.expandParent){let oe=F[0]*(H.width??0);H.x&&H.x<oe&&(m.x=oe,_.x=_.x-(H.x-oe));let ne=F[1]*(H.height??0);H.y&&H.y<ne&&(m.y=ne,_.y=_.y-(H.y-ne))}let q=Wd({width:m.width,prevWidth:$,height:m.height,prevHeight:R,affectsX:s.controlDirection.affectsX,affectsY:s.controlDirection.affectsY}),K={...m,direction:q};x?.(I,K)!==!1&&(z=!0,g?.(I,K),o(H,M))}).on("end",I=>{z&&(w?.(I,{...m}),r?.({...m}),z=!1)});i.call(L)}function l(){i.on(".drag",null)}return{update:a,destroy:l}}import{jsxs as de,Fragment as Pe,jsx as T}from"react/jsx-runtime";import{createContext as er,useContext as rn,useMemo as Ce,forwardRef as wa,useEffect as te,useRef as ee,useState as _e,useLayoutEffect as Qd,useCallback as ve,memo as ce}from"react";function ae(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=ae(e[n]))!==""&&(t+=(t&&" ")+o);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}import{useStoreWithEqualityFn as Jd,createWithEqualityFn as jd}from"zustand/traditional";import{shallow as re}from"zustand/shallow";import{createPortal as yw}from"react-dom";var to=er(null),ef=to.Provider,ba=ye.error001();function J(e,t){let n=rn(to);if(n===null)throw new Error(ba);return Jd(n,e,t)}function ie(){let e=rn(to);if(e===null)throw new Error(ba);return Ce(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}var Gs={display:"none"},tf={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},_a="react-flow__node-desc",va="react-flow__edge-desc",nf="react-flow__aria-live",of=e=>e.ariaLiveMessage,rf=e=>e.ariaLabelConfig;function sf({rfId:e}){let t=J(of);return T("div",{id:`${nf}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:tf,children:t})}function af({rfId:e,disableKeyboardA11y:t}){let n=J(rf);return de(Pe,{children:[T("div",{id:`${_a}-${e}`,style:Gs,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),T("div",{id:`${va}-${e}`,style:Gs,children:n["edge.a11yDescription.default"]}),!t&&T(sf,{rfId:e})]})}var no=wa(({position:e="top-left",children:t,className:n,style:o,...r},i)=>{let s=`${e}`.split("-");return T("div",{className:ae(["react-flow__panel",n,...s]),style:o,ref:i,...r,children:t})});no.displayName="Panel";function cf({proOptions:e,position:t="bottom-right"}){return e?.hideAttribution?null:T(no,{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:T("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}var lf=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}},Qn=e=>e.id;function uf(e,t){return re(e.selectedNodes.map(Qn),t.selectedNodes.map(Qn))&&re(e.selectedEdges.map(Qn),t.selectedEdges.map(Qn))}function df({onSelectionChange:e}){let t=ie(),{selectedNodes:n,selectedEdges:o}=J(lf,uf);return te(()=>{let r={nodes:n,edges:o};e?.(r),t.getState().onSelectionChangeHandlers.forEach(i=>i(r))},[n,o,e]),null}var ff=e=>!!e.onSelectionChangeHandlers;function hf({onSelectionChange:e}){let t=J(ff);return e||t?T(df,{onSelectionChange:e}):null}var Sa=[0,0],pf={x:0,y:0,zoom:1},gf=["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"],Us=[...gf,"rfId"],mf=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}),Qs={translateExtent:wt,nodeOrigin:Sa,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function yf(e){let{setNodes:t,setEdges:n,setMinZoom:o,setMaxZoom:r,setTranslateExtent:i,setNodeExtent:s,reset:a,setDefaultNodesAndEdges:l}=J(mf,re),c=ie();te(()=>(l(e.defaultNodes,e.defaultEdges),()=>{u.current=Qs,a()}),[]);let u=ee(Qs);return te(()=>{for(let d of Us){let f=e[d],p=u.current[d];f!==p&&(typeof e[d]>"u"||(d==="nodes"?t(f):d==="edges"?n(f):d==="minZoom"?o(f):d==="maxZoom"?r(f):d==="translateExtent"?i(f):d==="nodeExtent"?s(f):d==="ariaLabelConfig"?c.setState({ariaLabelConfig:Ns(f)}):d==="fitView"?c.setState({fitViewQueued:f}):d==="fitViewOptions"?c.setState({fitViewOptions:f}):c.setState({[d]:f})))}u.current=e},Us.map(d=>e[d])),null}function Js(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function xf(e){let[t,n]=_e(e==="system"?null:e);return te(()=>{if(e!=="system"){n(e);return}let o=Js(),r=()=>n(o?.matches?"dark":"light");return r(),o?.addEventListener("change",r),()=>{o?.removeEventListener("change",r)}},[e]),t!==null?t:Js()?.matches?"dark":"light"}var js=typeof document<"u"?document:null;function on(e=null,t={target:js,actInsideInputWithModifier:!0}){let[n,o]=_e(!1),r=ee(!1),i=ee(new Set([])),[s,a]=Ce(()=>{if(e!==null){let c=(Array.isArray(e)?e:[e]).filter(d=>typeof d=="string").map(d=>d.replace("+",`
|
|
2
|
+
`).replace(`
|
|
3
|
+
|
|
4
|
+
`,`
|
|
5
|
+
+`).split(`
|
|
6
|
+
`)),u=c.reduce((d,f)=>d.concat(...f),[]);return[c,u]}return[[],[]]},[e]);return te(()=>{let l=t?.target??js,c=t?.actInsideInputWithModifier??!0;if(e!==null){let u=p=>{if(r.current=p.ctrlKey||p.metaKey||p.shiftKey||p.altKey,(!r.current||r.current&&!c)&&Fo(p))return!1;let w=ta(p.code,a);if(i.current.add(p[w]),ea(s,i.current,!1)){let x=p.composedPath?.()?.[0]||p.target,m=x?.nodeName==="BUTTON"||x?.nodeName==="A";t.preventDefault!==!1&&(r.current||!m)&&p.preventDefault(),o(!0)}},d=p=>{let g=ta(p.code,a);ea(s,i.current,!0)?(o(!1),i.current.clear()):i.current.delete(p[g]),p.key==="Meta"&&i.current.clear(),r.current=!1},f=()=>{i.current.clear(),o(!1)};return l?.addEventListener("keydown",u),l?.addEventListener("keyup",d),window.addEventListener("blur",f),window.addEventListener("contextmenu",f),()=>{l?.removeEventListener("keydown",u),l?.removeEventListener("keyup",d),window.removeEventListener("blur",f),window.removeEventListener("contextmenu",f)}}},[e,o]),n}function ea(e,t,n){return e.filter(o=>n||o.length===t.size).some(o=>o.every(r=>t.has(r)))}function ta(e,t){return t.includes(e)?"code":"key"}var wf=()=>{let e=ie();return Ce(()=>({zoomIn:t=>{let{panZoom:n}=e.getState();return n?n.scaleBy(1.2,{duration:t?.duration}):Promise.resolve(!1)},zoomOut:t=>{let{panZoom:n}=e.getState();return n?n.scaleBy(1/1.2,{duration:t?.duration}):Promise.resolve(!1)},zoomTo:(t,n)=>{let{panZoom:o}=e.getState();return o?o.scaleTo(t,{duration:n?.duration}):Promise.resolve(!1)},getZoom:()=>e.getState().transform[2],setViewport:async(t,n)=>{let{transform:[o,r,i],panZoom:s}=e.getState();return s?(await s.setViewport({x:t.x??o,y:t.y??r,zoom:t.zoom??i},n),Promise.resolve(!0)):Promise.resolve(!1)},getViewport:()=>{let[t,n,o]=e.getState().transform;return{x:t,y:n,zoom:o}},setCenter:async(t,n,o)=>e.getState().setCenter(t,n,o),fitBounds:async(t,n)=>{let{width:o,height:r,minZoom:i,maxZoom:s,panZoom:a}=e.getState(),l=tn(t,o,r,i,s,n?.padding??.1);return a?(await a.setViewport(l,{duration:n?.duration,ease:n?.ease,interpolate:n?.interpolate}),Promise.resolve(!0)):Promise.resolve(!1)},screenToFlowPosition:(t,n={})=>{let{transform:o,snapGrid:r,snapToGrid:i,domNode:s}=e.getState();if(!s)return t;let{x:a,y:l}=s.getBoundingClientRect(),c={x:t.x-a,y:t.y-l},u=n.snapGrid??r,d=n.snapToGrid??i;return St(c,o,d,u)},flowToScreenPosition:t=>{let{transform:n,domNode:o}=e.getState();if(!o)return t;let{x:r,y:i}=o.getBoundingClientRect(),s=jt(t,n);return{x:s.x+r,y:s.y+i}}}),[])};function Ea(e,t){let n=[],o=new Map,r=[];for(let i of e)if(i.type==="add"){r.push(i);continue}else if(i.type==="remove"||i.type==="replace")o.set(i.id,[i]);else{let s=o.get(i.id);s?s.push(i):o.set(i.id,[i])}for(let i of t){let s=o.get(i.id);if(!s){n.push(i);continue}if(s[0].type==="remove")continue;if(s[0].type==="replace"){n.push({...s[0].item});continue}let a={...i};for(let l of s)bf(l,a);n.push(a)}return r.length&&r.forEach(i=>{i.index!==void 0?n.splice(i.index,0,{...i.item}):n.push({...i.item})}),n}function bf(e,t){switch(e.type){case"select":{t.selected=e.selected;break}case"position":{typeof e.position<"u"&&(t.position=e.position),typeof e.dragging<"u"&&(t.dragging=e.dragging);break}case"dimensions":{typeof e.dimensions<"u"&&(t.measured={...e.dimensions},e.setAttributes&&((e.setAttributes===!0||e.setAttributes==="width")&&(t.width=e.dimensions.width),(e.setAttributes===!0||e.setAttributes==="height")&&(t.height=e.dimensions.height))),typeof e.resizing=="boolean"&&(t.resizing=e.resizing);break}}}function Na(e,t){return Ea(e,t)}function Ca(e,t){return Ea(e,t)}function at(e,t){return{id:e,type:"select",selected:t}}function Nt(e,t=new Set,n=!1){let o=[];for(let[r,i]of e){let s=t.has(r);!(i.selected===void 0&&!s)&&i.selected!==s&&(n&&(i.selected=s),o.push(at(i.id,s)))}return o}function na({items:e=[],lookup:t}){let n=[],o=new Map(e.map(r=>[r.id,r]));for(let[r,i]of e.entries()){let s=t.get(i.id),a=s?.internals?.userNode??s;a!==void 0&&a!==i&&n.push({id:i.id,item:i,type:"replace"}),a===void 0&&n.push({item:i,type:"add",index:r})}for(let[r]of t)o.get(r)===void 0&&n.push({id:r,type:"remove"});return n}function oa(e){return{id:e.id,type:"remove"}}var ra=e=>xs(e),_f=e=>zo(e);function ka(e){return wa(e)}var vf=typeof window<"u"?Qd:te;function ia(e){let[t,n]=_e(BigInt(0)),[o]=_e(()=>Sf(()=>n(r=>r+BigInt(1))));return vf(()=>{let r=o.get();r.length&&(e(r),o.reset())},[t]),o}function Sf(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}var Ma=er(null);function Ef({children:e}){let t=ie(),n=ve(a=>{let{nodes:l=[],setNodes:c,hasDefaultNodes:u,onNodesChange:d,nodeLookup:f,fitViewQueued:p,onNodesChangeMiddlewareMap:g}=t.getState(),w=l;for(let m of a)w=typeof m=="function"?m(w):m;let x=na({items:w,lookup:f});for(let m of g.values())x=m(x);u&&c(w),x.length>0?d?.(x):p&&window.requestAnimationFrame(()=>{let{fitViewQueued:m,nodes:_,setNodes:h}=t.getState();m&&h(_)})},[]),o=ia(n),r=ve(a=>{let{edges:l=[],setEdges:c,hasDefaultEdges:u,onEdgesChange:d,edgeLookup:f}=t.getState(),p=l;for(let g of a)p=typeof g=="function"?g(p):g;u?c(p):d&&d(na({items:p,lookup:f}))},[]),i=ia(r),s=Ce(()=>({nodeQueue:o,edgeQueue:i}),[]);return T(Ma.Provider,{value:s,children:e})}function Nf(){let e=rn(Ma);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}var Cf=e=>!!e.panZoom;function tr(){let e=wf(),t=ie(),n=Nf(),o=J(Cf),r=Ce(()=>{let i=d=>t.getState().nodeLookup.get(d),s=d=>{n.nodeQueue.push(d)},a=d=>{n.edgeQueue.push(d)},l=d=>{let{nodeLookup:f,nodeOrigin:p}=t.getState(),g=ra(d)?d:f.get(d.id),w=g.parentId?Lo(g.position,g.measured,g.parentId,f,p):g.position,x={...g,position:w,width:g.measured?.width??g.width,height:g.measured?.height??g.height};return st(x)},c=(d,f,p={replace:!1})=>{s(g=>g.map(w=>{if(w.id===d){let x=typeof f=="function"?f(w):f;return p.replace&&ra(x)?x:{...w,...x}}return w}))},u=(d,f,p={replace:!1})=>{a(g=>g.map(w=>{if(w.id===d){let x=typeof f=="function"?f(w):f;return p.replace&&_f(x)?x:{...w,...x}}return w}))};return{getNodes:()=>t.getState().nodes.map(d=>({...d})),getNode:d=>i(d)?.internals.userNode,getInternalNode:i,getEdges:()=>{let{edges:d=[]}=t.getState();return d.map(f=>({...f}))},getEdge:d=>t.getState().edgeLookup.get(d),setNodes:s,setEdges:a,addNodes:d=>{let f=Array.isArray(d)?d:[d];n.nodeQueue.push(p=>[...p,...f])},addEdges:d=>{let f=Array.isArray(d)?d:[d];n.edgeQueue.push(p=>[...p,...f])},toObject:()=>{let{nodes:d=[],edges:f=[],transform:p}=t.getState(),[g,w,x]=p;return{nodes:d.map(m=>({...m})),edges:f.map(m=>({...m})),viewport:{x:g,y:w,zoom:x}}},deleteElements:async({nodes:d=[],edges:f=[]})=>{let{nodes:p,edges:g,onNodesDelete:w,onEdgesDelete:x,triggerNodeChanges:m,triggerEdgeChanges:_,onDelete:h,onBeforeDelete:y}=t.getState(),{nodes:E,edges:v}=await _s({nodesToRemove:d,edgesToRemove:f,nodes:p,edges:g,onBeforeDelete:y}),N=v.length>0,A=E.length>0;if(N){let z=v.map(oa);x?.(v),_(z)}if(A){let z=E.map(oa);w?.(E),m(z)}return(A||N)&&h?.({nodes:E,edges:v}),{deletedNodes:E,deletedEdges:v}},getIntersectingNodes:(d,f=!0,p)=>{let g=Oo(d),w=g?d:l(d),x=p!==void 0;return w?(p||t.getState().nodes).filter(m=>{let _=t.getState().nodeLookup.get(m.id);if(_&&!g&&(m.id===d.id||!_.internals.positionAbsolute))return!1;let h=st(x?m:_),y=_t(h,w);return f&&y>0||y>=h.width*h.height||y>=w.width*w.height}):[]},isNodeIntersecting:(d,f,p=!0)=>{let w=Oo(d)?d:l(d);if(!w)return!1;let x=_t(w,f);return p&&x>0||x>=f.width*f.height||x>=w.width*w.height},updateNode:c,updateNodeData:(d,f,p={replace:!1})=>{c(d,g=>{let w=typeof f=="function"?f(g):f;return p.replace?{...g,data:w}:{...g,data:{...g.data,...w}}},p)},updateEdge:u,updateEdgeData:(d,f,p={replace:!1})=>{u(d,g=>{let w=typeof f=="function"?f(g):f;return p.replace?{...g,data:w}:{...g,data:{...g.data,...w}}},p)},getNodesBounds:d=>{let{nodeLookup:f,nodeOrigin:p}=t.getState();return Do(d,{nodeLookup:f,nodeOrigin:p})},getHandleConnections:({type:d,id:f,nodeId:p})=>Array.from(t.getState().connectionLookup.get(`${p}-${d}${f?`-${f}`:""}`)?.values()??[]),getNodeConnections:({type:d,handleId:f,nodeId:p})=>Array.from(t.getState().connectionLookup.get(`${p}${d?f?`-${d}-${f}`:`-${d}`:""}`)?.values()??[]),fitView:async d=>{let f=t.getState().fitViewResolver??Es();return t.setState({fitViewQueued:!0,fitViewOptions:d,fitViewResolver:f}),n.nodeQueue.push(p=>[...p]),f.promise}}},[]);return Ce(()=>({...r,...e,viewportInitialized:o}),[o])}var sa=e=>e.selected,kf=typeof window<"u"?window:void 0;function Mf({deleteKeyCode:e,multiSelectionKeyCode:t}){let n=ie(),{deleteElements:o}=tr(),r=on(e,{actInsideInputWithModifier:!1}),i=on(t,{target:kf});te(()=>{if(r){let{edges:s,nodes:a}=n.getState();o({nodes:a.filter(sa),edges:s.filter(sa)}),n.setState({nodesSelectionActive:!1})}},[r]),te(()=>{n.setState({multiSelectionActive:i})},[i])}function If(e){let t=ie();te(()=>{let n=()=>{if(!e.current||!(e.current.checkVisibility?.()??!0))return!1;let o=Fn(e.current);(o.height===0||o.width===0)&&t.getState().onError?.("004",ye.error004()),t.setState({width:o.width||500,height:o.height||500})};if(e.current){n(),window.addEventListener("resize",n);let o=new ResizeObserver(()=>n());return o.observe(e.current),()=>{window.removeEventListener("resize",n),o&&e.current&&o.unobserve(e.current)}}},[])}var oo={position:"absolute",width:"100%",height:"100%",top:0,left:0},Pf=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function zf({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:o=!1,panOnScrollSpeed:r=.5,panOnScrollMode:i=Oe.Free,zoomOnDoubleClick:s=!0,panOnDrag:a=!0,defaultViewport:l,translateExtent:c,minZoom:u,maxZoom:d,zoomActivationKeyCode:f,preventScrolling:p=!0,children:g,noWheelClassName:w,noPanClassName:x,onViewportChange:m,isControlledViewport:_,paneClickDistance:h,selectionOnDrag:y}){let E=ie(),v=ee(null),{userSelectionActive:N,lib:A,connectionInProgress:z}=J(Pf,re),L=on(f),I=ee();If(v);let D=ve(O=>{m?.({x:O[0],y:O[1],zoom:O[2]}),_||E.setState({transform:O})},[m,_]);return te(()=>{if(v.current){I.current=Ys({domNode:v.current,minZoom:u,maxZoom:d,translateExtent:c,viewport:l,onDraggingChange:S=>E.setState(M=>M.paneDragging===S?M:{paneDragging:S}),onPanZoomStart:(S,M)=>{let{onViewportChangeStart:k,onMoveStart:P}=E.getState();P?.(S,M),k?.(M)},onPanZoom:(S,M)=>{let{onViewportChange:k,onMove:P}=E.getState();P?.(S,M),k?.(M)},onPanZoomEnd:(S,M)=>{let{onViewportChangeEnd:k,onMoveEnd:P}=E.getState();P?.(S,M),k?.(M)}});let{x:O,y:b,zoom:C}=I.current.getViewport();return E.setState({panZoom:I.current,transform:[O,b,C],domNode:v.current.closest(".react-flow")}),()=>{I.current?.destroy()}}},[]),te(()=>{I.current?.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:o,panOnScrollSpeed:r,panOnScrollMode:i,zoomOnDoubleClick:s,panOnDrag:a,zoomActivationKeyPressed:L,preventScrolling:p,noPanClassName:x,userSelectionActive:N,noWheelClassName:w,lib:A,onTransformChange:D,connectionInProgress:z,selectionOnDrag:y,paneClickDistance:h})},[e,t,n,o,r,i,s,a,L,p,x,N,w,A,D,z,y,h]),T("div",{className:"react-flow__renderer",ref:v,style:oo,children:g})}var Af=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function Df(){let{userSelectionActive:e,userSelectionRect:t}=J(Af,re);return e&&t?T("div",{className:"react-flow__selection react-flow__container",style:{width:t.width,height:t.height,transform:`translate(${t.x}px, ${t.y}px)`}}):null}var Qo=(e,t)=>n=>{n.target===t.current&&e?.(n)},Tf=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,connectionInProgress:e.connection.inProgress,dragging:e.paneDragging});function $f({isSelecting:e,selectionKeyPressed:t,selectionMode:n=rt.Full,panOnDrag:o,paneClickDistance:r,selectionOnDrag:i,onSelectionStart:s,onSelectionEnd:a,onPaneClick:l,onPaneContextMenu:c,onPaneScroll:u,onPaneMouseEnter:d,onPaneMouseMove:f,onPaneMouseLeave:p,children:g}){let w=ie(),{userSelectionActive:x,elementsSelectable:m,dragging:_,connectionInProgress:h}=J(Tf,re),y=m&&(e||x),E=ee(null),v=ee(),N=ee(new Set),A=ee(new Set),z=ee(!1),L=k=>{if(z.current||h){z.current=!1;return}l?.(k),w.getState().resetSelectedElements(),w.setState({nodesSelectionActive:!1})},I=k=>{if(Array.isArray(o)&&o?.includes(2)){k.preventDefault();return}c?.(k)},D=u?k=>u(k):void 0,O=k=>{z.current&&(k.stopPropagation(),z.current=!1)},b=k=>{let{domNode:P}=w.getState();if(v.current=P?.getBoundingClientRect(),!v.current)return;let $=k.target===E.current;if(!$&&!!k.target.closest(".nokey")||!e||!(i&&$||t)||k.button!==0||!k.isPrimary)return;k.target?.setPointerCapture?.(k.pointerId),z.current=!1;let{x:F,y:V}=be(k.nativeEvent,v.current);w.setState({userSelectionRect:{width:0,height:0,startX:F,startY:V,x:F,y:V}}),$||(k.stopPropagation(),k.preventDefault())},C=k=>{let{userSelectionRect:P,transform:$,nodeLookup:R,edgeLookup:H,connectionLookup:F,triggerNodeChanges:V,triggerEdgeChanges:W,defaultEdgeOptions:G,resetSelectedElements:Z}=w.getState();if(!v.current||!P)return;let{x:B,y:Y}=be(k.nativeEvent,v.current),{startX:Q,startY:U}=P;if(!z.current){let ne=t?0:r;if(Math.hypot(B-Q,Y-U)<=ne)return;Z(),s?.(k)}z.current=!0;let q={startX:Q,startY:U,x:B<Q?B:Q,y:Y<U?Y:U,width:Math.abs(B-Q),height:Math.abs(Y-U)},K=N.current,j=A.current;N.current=new Set(Ln(R,q,$,n===rt.Partial,!0).map(ne=>ne.id)),A.current=new Set;let oe=G?.selectable??!0;for(let ne of N.current){let he=F.get(ne);if(he)for(let{edgeId:Re}of he.values()){let ze=H.get(Re);ze&&(ze.selectable??oe)&&A.current.add(Re)}}if(!Bo(K,N.current)){let ne=Nt(R,N.current,!0);V(ne)}if(!Bo(j,A.current)){let ne=Nt(H,A.current);W(ne)}w.setState({userSelectionRect:q,userSelectionActive:!0,nodesSelectionActive:!1})},S=k=>{k.button===0&&(k.target?.releasePointerCapture?.(k.pointerId),!x&&k.target===E.current&&w.getState().userSelectionRect&&L?.(k),w.setState({userSelectionActive:!1,userSelectionRect:null}),z.current&&(a?.(k),w.setState({nodesSelectionActive:N.current.size>0})))},M=o===!0||Array.isArray(o)&&o.includes(0);return de("div",{className:ae(["react-flow__pane",{draggable:M,dragging:_,selection:e}]),onClick:y?void 0:Qo(L,E),onContextMenu:Qo(I,E),onWheel:Qo(D,E),onPointerEnter:y?void 0:d,onPointerMove:y?C:f,onPointerUp:y?S:void 0,onPointerDownCapture:y?b:void 0,onClickCapture:y?O:void 0,onPointerLeave:p,ref:E,style:oo,children:[g,T(Df,{})]})}function jo({id:e,store:t,unselect:n=!1,nodeRef:o}){let{addSelectedNodes:r,unselectNodesAndEdges:i,multiSelectionActive:s,nodeLookup:a,onError:l}=t.getState(),c=a.get(e);if(!c){l?.("012",ye.error012(e));return}t.setState({nodesSelectionActive:!1}),c.selected?(n||c.selected&&s)&&(i({nodes:[c],edges:[]}),requestAnimationFrame(()=>o?.current?.blur())):r([e])}function Ia({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:o,nodeId:r,isSelectable:i,nodeClickDistance:s}){let a=ie(),[l,c]=_e(!1),u=ee();return te(()=>{u.current=Os({getStoreItems:()=>a.getState(),onNodeMouseDown:d=>{jo({id:d,store:a,nodeRef:e})},onDragStart:()=>{c(!0)},onDragStop:()=>{c(!1)}})},[]),te(()=>{if(!(t||!e.current||!u.current))return u.current.update({noDragClassName:n,handleSelector:o,domNode:e.current,isSelectable:i,nodeId:r,nodeClickDistance:s}),()=>{u.current?.destroy()}},[n,o,t,i,e,r,s]),l}var Of=e=>t=>t.selected&&(t.draggable||e&&typeof t.draggable>"u");function Pa(){let e=ie();return ve(n=>{let{nodeExtent:o,snapToGrid:r,snapGrid:i,nodesDraggable:s,onError:a,updateNodePositions:l,nodeLookup:c,nodeOrigin:u}=e.getState(),d=new Map,f=Of(s),p=r?i[0]:5,g=r?i[1]:5,w=n.direction.x*p*n.factor,x=n.direction.y*g*n.factor;for(let[,m]of c){if(!f(m))continue;let _={x:m.internals.positionAbsolute.x+w,y:m.internals.positionAbsolute.y+x};r&&(_=vt(_,i));let{position:h,positionAbsolute:y}=To({nodeId:m.id,nextPosition:_,nodeLookup:c,nodeExtent:o,nodeOrigin:u,onError:a});m.position=h,m.internals.positionAbsolute=y,d.set(m.id,m)}l(d)},[])}var nr=er(null),Hf=nr.Provider;nr.Consumer;var za=()=>rn(nr),Rf=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),Lf=(e,t,n)=>o=>{let{connectionClickStartHandle:r,connectionMode:i,connection:s}=o,{fromHandle:a,toHandle:l,isValid:c}=s,u=l?.nodeId===e&&l?.id===t&&l?.type===n;return{connectingFrom:a?.nodeId===e&&a?.id===t&&a?.type===n,connectingTo:u,clickConnecting:r?.nodeId===e&&r?.id===t&&r?.type===n,isPossibleEndHandle:i===Ye.Strict?a?.type!==n:e!==a?.nodeId||t!==a?.id,connectionInProcess:!!a,clickConnectionInProcess:!!r,valid:u&&c}};function Bf({type:e="source",position:t=X.Top,isValidConnection:n,isConnectable:o=!0,isConnectableStart:r=!0,isConnectableEnd:i=!0,id:s,onConnect:a,children:l,className:c,onMouseDown:u,onTouchStart:d,...f},p){let g=s||null,w=e==="target",x=ie(),m=za(),{connectOnClick:_,noPanClassName:h,rfId:y}=J(Rf,re),{connectingFrom:E,connectingTo:v,clickConnecting:N,isPossibleEndHandle:A,connectionInProcess:z,clickConnectionInProcess:L,valid:I}=J(Lf(m,g,e),re);m||x.getState().onError?.("010",ye.error010());let D=C=>{let{defaultEdgeOptions:S,onConnect:M,hasDefaultEdges:k}=x.getState(),P={...S,...C};if(k){let{edges:$,setEdges:R}=x.getState();R(Zo(P,$))}M?.(P),a?.(P)},O=C=>{if(!m)return;let S=Xo(C.nativeEvent);if(r&&(S&&C.button===0||!S)){let M=x.getState();Gn.onPointerDown(C.nativeEvent,{handleDomNode:C.currentTarget,autoPanOnConnect:M.autoPanOnConnect,connectionMode:M.connectionMode,connectionRadius:M.connectionRadius,domNode:M.domNode,nodeLookup:M.nodeLookup,lib:M.lib,isTarget:w,handleId:g,nodeId:m,flowId:M.rfId,panBy:M.panBy,cancelConnection:M.cancelConnection,onConnectStart:M.onConnectStart,onConnectEnd:(...k)=>x.getState().onConnectEnd?.(...k),updateConnection:M.updateConnection,onConnect:D,isValidConnection:n||((...k)=>x.getState().isValidConnection?.(...k)??!0),getTransform:()=>x.getState().transform,getFromHandle:()=>x.getState().connection.fromHandle,autoPanSpeed:M.autoPanSpeed,dragThreshold:M.connectionDragThreshold})}S?u?.(C):d?.(C)},b=C=>{let{onClickConnectStart:S,onClickConnectEnd:M,connectionClickStartHandle:k,connectionMode:P,isValidConnection:$,lib:R,rfId:H,nodeLookup:F,connection:V}=x.getState();if(!m||!k&&!r)return;if(!k){S?.(C.nativeEvent,{nodeId:m,handleId:g,handleType:e}),x.setState({connectionClickStartHandle:{nodeId:m,type:e,id:g}});return}let W=Vo(C.target),G=n||$,{connection:Z,isValid:B}=Gn.isValid(C.nativeEvent,{handle:{nodeId:m,id:g,type:e},connectionMode:P,fromNodeId:k.nodeId,fromHandleId:k.id||null,fromType:k.type,isValidConnection:G,flowId:H,doc:W,lib:R,nodeLookup:F});B&&Z&&D(Z);let Y=structuredClone(V);delete Y.inProgress,Y.toPosition=Y.toHandle?Y.toHandle.position:null,M?.(C,Y),x.setState({connectionClickStartHandle:null})};return T("div",{"data-handleid":g,"data-nodeid":m,"data-handlepos":t,"data-id":`${y}-${m}-${g}-${e}`,className:ae(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",h,c,{source:!w,target:w,connectable:o,connectablestart:r,connectableend:i,clickconnecting:N,connectingfrom:E,connectingto:v,valid:I,connectionindicator:o&&(!z||A)&&(z||L?i:r)}]),onMouseDown:O,onTouchStart:O,onClick:_?b:void 0,ref:p,...f,children:l})}var jn=ce(ka(Bf));function Vf({data:e,isConnectable:t,sourcePosition:n=X.Bottom}){return de(Pe,{children:[e?.label,T(jn,{type:"source",position:n,isConnectable:t})]})}function Ff({data:e,isConnectable:t,targetPosition:n=X.Top,sourcePosition:o=X.Bottom}){return de(Pe,{children:[T(jn,{type:"target",position:n,isConnectable:t}),e?.label,T(jn,{type:"source",position:o,isConnectable:t})]})}function Xf(){return null}function Yf({data:e,isConnectable:t,targetPosition:n=X.Top}){return de(Pe,{children:[T(jn,{type:"target",position:n,isConnectable:t}),e?.label]})}var eo={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},aa={input:Vf,default:Ff,output:Yf,group:Xf};function Zf(e){return e.internals.handleBounds===void 0?{width:e.width??e.initialWidth??e.style?.width,height:e.height??e.initialHeight??e.style?.height}:{width:e.width??e.style?.width,height:e.height??e.style?.height}}var Wf=e=>{let{width:t,height:n,x:o,y:r}=bt(e.nodeLookup,{filter:i=>!!i.selected});return{width:we(t)?t:null,height:we(n)?n:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${o}px,${r}px)`}};function qf({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){let o=ie(),{width:r,height:i,transformString:s,userSelectionActive:a}=J(Wf,re),l=Pa(),c=ee(null);te(()=>{n||c.current?.focus({preventScroll:!0})},[n]);let u=!a&&r!==null&&i!==null;if(Ia({nodeRef:c,disabled:!u}),!u)return null;let d=e?p=>{let g=o.getState().nodes.filter(w=>w.selected);e(p,g)}:void 0,f=p=>{Object.prototype.hasOwnProperty.call(eo,p.key)&&(p.preventDefault(),l({direction:eo[p.key],factor:p.shiftKey?4:1}))};return T("div",{className:ae(["react-flow__nodesselection","react-flow__container",t]),style:{transform:s},children:T("div",{ref:c,className:"react-flow__nodesselection-rect",onContextMenu:d,tabIndex:n?void 0:-1,onKeyDown:n?void 0:f,style:{width:r,height:i}})})}var ca=typeof window<"u"?window:void 0,Kf=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function Aa({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:o,onPaneMouseLeave:r,onPaneContextMenu:i,onPaneScroll:s,paneClickDistance:a,deleteKeyCode:l,selectionKeyCode:c,selectionOnDrag:u,selectionMode:d,onSelectionStart:f,onSelectionEnd:p,multiSelectionKeyCode:g,panActivationKeyCode:w,zoomActivationKeyCode:x,elementsSelectable:m,zoomOnScroll:_,zoomOnPinch:h,panOnScroll:y,panOnScrollSpeed:E,panOnScrollMode:v,zoomOnDoubleClick:N,panOnDrag:A,defaultViewport:z,translateExtent:L,minZoom:I,maxZoom:D,preventScrolling:O,onSelectionContextMenu:b,noWheelClassName:C,noPanClassName:S,disableKeyboardA11y:M,onViewportChange:k,isControlledViewport:P}){let{nodesSelectionActive:$,userSelectionActive:R}=J(Kf,re),H=on(c,{target:ca}),F=on(w,{target:ca}),V=F||A,W=F||y,G=u&&V!==!0,Z=H||R||G;return Mf({deleteKeyCode:l,multiSelectionKeyCode:g}),T(zf,{onPaneContextMenu:i,elementsSelectable:m,zoomOnScroll:_,zoomOnPinch:h,panOnScroll:W,panOnScrollSpeed:E,panOnScrollMode:v,zoomOnDoubleClick:N,panOnDrag:!H&&V,defaultViewport:z,translateExtent:L,minZoom:I,maxZoom:D,zoomActivationKeyCode:x,preventScrolling:O,noWheelClassName:C,noPanClassName:S,onViewportChange:k,isControlledViewport:P,paneClickDistance:a,selectionOnDrag:G,children:de($f,{onSelectionStart:f,onSelectionEnd:p,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:o,onPaneMouseLeave:r,onPaneContextMenu:i,onPaneScroll:s,panOnDrag:V,isSelecting:!!Z,selectionMode:d,selectionKeyPressed:H,paneClickDistance:a,selectionOnDrag:G,children:[e,$&&T(qf,{onSelectionContextMenu:b,noPanClassName:S,disableKeyboardA11y:M})]})})}Aa.displayName="FlowRenderer";var Gf=ce(Aa),Uf=e=>t=>e?Ln(t.nodeLookup,{x:0,y:0,width:t.width,height:t.height},t.transform,!0).map(n=>n.id):Array.from(t.nodeLookup.keys());function Qf(e){return J(ve(Uf(e),[e]),re)}var Jf=e=>e.updateNodeInternals;function jf(){let e=J(Jf),[t]=_e(()=>typeof ResizeObserver>"u"?null:new ResizeObserver(n=>{let o=new Map;n.forEach(r=>{let i=r.target.getAttribute("data-id");o.set(i,{id:i,nodeElement:r.target,force:!0})}),e(o)}));return te(()=>()=>{t?.disconnect()},[t]),t}function eh({node:e,nodeType:t,hasDimensions:n,resizeObserver:o}){let r=ie(),i=ee(null),s=ee(null),a=ee(e.sourcePosition),l=ee(e.targetPosition),c=ee(t),u=n&&!!e.internals.handleBounds;return te(()=>{i.current&&!e.hidden&&(!u||s.current!==i.current)&&(s.current&&o?.unobserve(s.current),o?.observe(i.current),s.current=i.current)},[u,e.hidden]),te(()=>()=>{s.current&&(o?.unobserve(s.current),s.current=null)},[]),te(()=>{if(i.current){let d=c.current!==t,f=a.current!==e.sourcePosition,p=l.current!==e.targetPosition;(d||f||p)&&(c.current=t,a.current=e.sourcePosition,l.current=e.targetPosition,r.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:i.current,force:!0}]])))}},[e.id,t,e.sourcePosition,e.targetPosition]),i}function th({id:e,onClick:t,onMouseEnter:n,onMouseMove:o,onMouseLeave:r,onContextMenu:i,onDoubleClick:s,nodesDraggable:a,elementsSelectable:l,nodesConnectable:c,nodesFocusable:u,resizeObserver:d,noDragClassName:f,noPanClassName:p,disableKeyboardA11y:g,rfId:w,nodeTypes:x,nodeClickDistance:m,onError:_}){let{node:h,internals:y,isParent:E}=J(B=>{let Y=B.nodeLookup.get(e),Q=B.parentLookup.has(e);return{node:Y,internals:Y.internals,isParent:Q}},re),v=h.type||"default",N=x?.[v]||aa[v];N===void 0&&(_?.("003",ye.error003(v)),v="default",N=x?.default||aa.default);let A=!!(h.draggable||a&&typeof h.draggable>"u"),z=!!(h.selectable||l&&typeof h.selectable>"u"),L=!!(h.connectable||c&&typeof h.connectable>"u"),I=!!(h.focusable||u&&typeof h.focusable>"u"),D=ie(),O=Ro(h),b=eh({node:h,nodeType:v,hasDimensions:O,resizeObserver:d}),C=Ia({nodeRef:b,disabled:h.hidden||!A,noDragClassName:f,handleSelector:h.dragHandle,nodeId:e,isSelectable:z,nodeClickDistance:m}),S=Pa();if(h.hidden)return null;let M=Ie(h),k=Zf(h),P=z||A||t||n||o||r,$=n?B=>n(B,{...y.userNode}):void 0,R=o?B=>o(B,{...y.userNode}):void 0,H=r?B=>r(B,{...y.userNode}):void 0,F=i?B=>i(B,{...y.userNode}):void 0,V=s?B=>s(B,{...y.userNode}):void 0,W=B=>{let{selectNodesOnDrag:Y,nodeDragThreshold:Q}=D.getState();z&&(!Y||!A||Q>0)&&jo({id:e,store:D,nodeRef:b}),t&&t(B,{...y.userNode})},G=B=>{if(!(Fo(B.nativeEvent)||g)){if(ko.includes(B.key)&&z){let Y=B.key==="Escape";jo({id:e,store:D,unselect:Y,nodeRef:b})}else if(A&&h.selected&&Object.prototype.hasOwnProperty.call(eo,B.key)){B.preventDefault();let{ariaLabelConfig:Y}=D.getState();D.setState({ariaLiveMessage:Y["node.a11yDescription.ariaLiveMessage"]({direction:B.key.replace("Arrow","").toLowerCase(),x:~~y.positionAbsolute.x,y:~~y.positionAbsolute.y})}),S({direction:eo[B.key],factor:B.shiftKey?4:1})}}},Z=()=>{if(g||!b.current?.matches(":focus-visible"))return;let{transform:B,width:Y,height:Q,autoPanOnNodeFocus:U,setCenter:q}=D.getState();if(!U)return;Ln(new Map([[e,h]]),{x:0,y:0,width:Y,height:Q},B,!0).length>0||q(h.position.x+M.width/2,h.position.y+M.height/2,{zoom:B[2]})};return T("div",{className:ae(["react-flow__node",`react-flow__node-${v}`,{[p]:A},h.className,{selected:h.selected,selectable:z,parent:E,draggable:A,dragging:C}]),ref:b,style:{zIndex:y.z,transform:`translate(${y.positionAbsolute.x}px,${y.positionAbsolute.y}px)`,pointerEvents:P?"all":"none",visibility:O?"visible":"hidden",...h.style,...k},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:$,onMouseMove:R,onMouseLeave:H,onContextMenu:F,onClick:W,onDoubleClick:V,onKeyDown:I?G:void 0,tabIndex:I?0:void 0,onFocus:I?Z:void 0,role:h.ariaRole??(I?"group":void 0),"aria-roledescription":"node","aria-describedby":g?void 0:`${_a}-${w}`,"aria-label":h.ariaLabel,...h.domAttributes,children:T(Hf,{value:e,children:T(N,{id:e,data:h.data,type:v,positionAbsoluteX:y.positionAbsolute.x,positionAbsoluteY:y.positionAbsolute.y,selected:h.selected??!1,selectable:z,draggable:A,deletable:h.deletable??!0,isConnectable:L,sourcePosition:h.sourcePosition,targetPosition:h.targetPosition,dragging:C,dragHandle:h.dragHandle,zIndex:y.z,parentId:h.parentId,...M})})})}var nh=ce(th),oh=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function Da(e){let{nodesDraggable:t,nodesConnectable:n,nodesFocusable:o,elementsSelectable:r,onError:i}=J(oh,re),s=Qf(e.onlyRenderVisibleElements),a=jf();return T("div",{className:"react-flow__nodes",style:oo,children:s.map(l=>T(nh,{id:l,nodeTypes:e.nodeTypes,nodeExtent:e.nodeExtent,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,resizeObserver:a,nodesDraggable:t,nodesConnectable:n,nodesFocusable:o,elementsSelectable:r,nodeClickDistance:e.nodeClickDistance,onError:i},l))})}Da.displayName="NodeRenderer";var rh=ce(Da);function ih(e){return J(ve(n=>{if(!e)return n.edges.map(r=>r.id);let o=[];if(n.width&&n.height)for(let r of n.edges){let i=n.nodeLookup.get(r.source),s=n.nodeLookup.get(r.target);i&&s&&ks({sourceNode:i,targetNode:s,width:n.width,height:n.height,transform:n.transform})&&o.push(r.id)}return o},[e]),re)}var sh=({color:e="none",strokeWidth:t=1})=>{let n={strokeWidth:t,...e&&{stroke:e}};return T("polyline",{className:"arrow",style:n,strokeLinecap:"round",fill:"none",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4"})},ah=({color:e="none",strokeWidth:t=1})=>{let n={strokeWidth:t,...e&&{stroke:e,fill:e}};return T("polyline",{className:"arrowclosed",style:n,strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},la={[mt.Arrow]:sh,[mt.ArrowClosed]:ah};function ch(e){let t=ie();return Ce(()=>Object.prototype.hasOwnProperty.call(la,e)?la[e]:(t.getState().onError?.("009",ye.error009(e)),null),[e])}var lh=({id:e,type:t,color:n,width:o=12.5,height:r=12.5,markerUnits:i="strokeWidth",strokeWidth:s,orient:a="auto-start-reverse"})=>{let l=ch(t);return l?T("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${o}`,markerHeight:`${r}`,viewBox:"-10 -10 20 20",markerUnits:i,orient:a,refX:"0",refY:"0",children:T(l,{color:n,strokeWidth:s})}):null},Ta=({defaultColor:e,rfId:t})=>{let n=J(i=>i.edges),o=J(i=>i.defaultEdgeOptions),r=Ce(()=>Is(n,{id:t,defaultColor:e,defaultMarkerStart:o?.markerStart,defaultMarkerEnd:o?.markerEnd}),[n,o,t,e]);return r.length?T("svg",{className:"react-flow__marker","aria-hidden":"true",children:T("defs",{children:r.map(i=>T(lh,{id:i.id,type:i.type,color:i.color,width:i.width,height:i.height,markerUnits:i.markerUnits,strokeWidth:i.strokeWidth,orient:i.orient},i.id))})}):null};Ta.displayName="MarkerDefinitions";var uh=ce(Ta);function $a({x:e,y:t,label:n,labelStyle:o,labelShowBg:r=!0,labelBgStyle:i,labelBgPadding:s=[2,4],labelBgBorderRadius:a=2,children:l,className:c,...u}){let[d,f]=_e({x:1,y:0,width:0,height:0}),p=ae(["react-flow__edge-textwrapper",c]),g=ee(null);return te(()=>{if(g.current){let w=g.current.getBBox();f({x:w.x,y:w.y,width:w.width,height:w.height})}},[n]),n?de("g",{transform:`translate(${e-d.width/2} ${t-d.height/2})`,className:p,visibility:d.width?"visible":"hidden",...u,children:[r&&T("rect",{width:d.width+2*s[0],x:-s[0],y:-s[1],height:d.height+2*s[1],className:"react-flow__edge-textbg",style:i,rx:a,ry:a}),T("text",{className:"react-flow__edge-text",y:d.height/2,dy:"0.3em",ref:g,style:o,children:n}),l]}):null}$a.displayName="EdgeText";var dh=ce($a);function ro({path:e,labelX:t,labelY:n,label:o,labelStyle:r,labelShowBg:i,labelBgStyle:s,labelBgPadding:a,labelBgBorderRadius:l,interactionWidth:c=20,...u}){return de(Pe,{children:[T("path",{...u,d:e,fill:"none",className:ae(["react-flow__edge-path",u.className])}),c?T("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:c,className:"react-flow__edge-interaction"}):null,o&&we(t)&&we(n)?T(dh,{x:t,y:n,label:o,labelStyle:r,labelShowBg:i,labelBgStyle:s,labelBgPadding:a,labelBgBorderRadius:l}):null]})}function ua({pos:e,x1:t,y1:n,x2:o,y2:r}){return e===X.Left||e===X.Right?[.5*(t+o),n]:[t,.5*(n+r)]}function Oa({sourceX:e,sourceY:t,sourcePosition:n=X.Bottom,targetX:o,targetY:r,targetPosition:i=X.Top}){let[s,a]=ua({pos:n,x1:e,y1:t,x2:o,y2:r}),[l,c]=ua({pos:i,x1:o,y1:r,x2:e,y2:t}),[u,d,f,p]=Xn({sourceX:e,sourceY:t,targetX:o,targetY:r,sourceControlX:s,sourceControlY:a,targetControlX:l,targetControlY:c});return[`M${e},${t} C${s},${a} ${l},${c} ${o},${r}`,u,d,f,p]}function Ha(e){return ce(({id:t,sourceX:n,sourceY:o,targetX:r,targetY:i,sourcePosition:s,targetPosition:a,label:l,labelStyle:c,labelShowBg:u,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:p,style:g,markerEnd:w,markerStart:x,interactionWidth:m})=>{let[_,h,y]=Oa({sourceX:n,sourceY:o,sourcePosition:s,targetX:r,targetY:i,targetPosition:a}),E=e.isInternal?void 0:t;return T(ro,{id:E,path:_,labelX:h,labelY:y,label:l,labelStyle:c,labelShowBg:u,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:p,style:g,markerEnd:w,markerStart:x,interactionWidth:m})})}var fh=Ha({isInternal:!1}),Ra=Ha({isInternal:!0});fh.displayName="SimpleBezierEdge";Ra.displayName="SimpleBezierEdgeInternal";function La(e){return ce(({id:t,sourceX:n,sourceY:o,targetX:r,targetY:i,label:s,labelStyle:a,labelShowBg:l,labelBgStyle:c,labelBgPadding:u,labelBgBorderRadius:d,style:f,sourcePosition:p=X.Bottom,targetPosition:g=X.Top,markerEnd:w,markerStart:x,pathOptions:m,interactionWidth:_})=>{let[h,y,E]=nn({sourceX:n,sourceY:o,sourcePosition:p,targetX:r,targetY:i,targetPosition:g,borderRadius:m?.borderRadius,offset:m?.offset,stepPosition:m?.stepPosition}),v=e.isInternal?void 0:t;return T(ro,{id:v,path:h,labelX:y,labelY:E,label:s,labelStyle:a,labelShowBg:l,labelBgStyle:c,labelBgPadding:u,labelBgBorderRadius:d,style:f,markerEnd:w,markerStart:x,interactionWidth:_})})}var Ba=La({isInternal:!1}),Va=La({isInternal:!0});Ba.displayName="SmoothStepEdge";Va.displayName="SmoothStepEdgeInternal";function Fa(e){return ce(({id:t,...n})=>{let o=e.isInternal?void 0:t;return T(Ba,{...n,id:o,pathOptions:Ce(()=>({borderRadius:0,offset:n.pathOptions?.offset}),[n.pathOptions?.offset])})})}var hh=Fa({isInternal:!1}),Xa=Fa({isInternal:!0});hh.displayName="StepEdge";Xa.displayName="StepEdgeInternal";function Ya(e){return ce(({id:t,sourceX:n,sourceY:o,targetX:r,targetY:i,label:s,labelStyle:a,labelShowBg:l,labelBgStyle:c,labelBgPadding:u,labelBgBorderRadius:d,style:f,markerEnd:p,markerStart:g,interactionWidth:w})=>{let[x,m,_]=Zn({sourceX:n,sourceY:o,targetX:r,targetY:i}),h=e.isInternal?void 0:t;return T(ro,{id:h,path:x,labelX:m,labelY:_,label:s,labelStyle:a,labelShowBg:l,labelBgStyle:c,labelBgPadding:u,labelBgBorderRadius:d,style:f,markerEnd:p,markerStart:g,interactionWidth:w})})}var ph=Ya({isInternal:!1}),Za=Ya({isInternal:!0});ph.displayName="StraightEdge";Za.displayName="StraightEdgeInternal";function Wa(e){return ce(({id:t,sourceX:n,sourceY:o,targetX:r,targetY:i,sourcePosition:s=X.Bottom,targetPosition:a=X.Top,label:l,labelStyle:c,labelShowBg:u,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:p,style:g,markerEnd:w,markerStart:x,pathOptions:m,interactionWidth:_})=>{let[h,y,E]=Yn({sourceX:n,sourceY:o,sourcePosition:s,targetX:r,targetY:i,targetPosition:a,curvature:m?.curvature}),v=e.isInternal?void 0:t;return T(ro,{id:v,path:h,labelX:y,labelY:E,label:l,labelStyle:c,labelShowBg:u,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:p,style:g,markerEnd:w,markerStart:x,interactionWidth:_})})}var gh=Wa({isInternal:!1}),qa=Wa({isInternal:!0});gh.displayName="BezierEdge";qa.displayName="BezierEdgeInternal";var da={default:qa,straight:Za,step:Xa,smoothstep:Va,simplebezier:Ra},fa={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},mh=(e,t,n)=>n===X.Left?e-t:n===X.Right?e+t:e,yh=(e,t,n)=>n===X.Top?e-t:n===X.Bottom?e+t:e,ha="react-flow__edgeupdater";function pa({position:e,centerX:t,centerY:n,radius:o=10,onMouseDown:r,onMouseEnter:i,onMouseOut:s,type:a}){return T("circle",{onMouseDown:r,onMouseEnter:i,onMouseOut:s,className:ae([ha,`${ha}-${a}`]),cx:mh(t,o,e),cy:yh(n,o,e),r:o,stroke:"transparent",fill:"transparent"})}function xh({isReconnectable:e,reconnectRadius:t,edge:n,sourceX:o,sourceY:r,targetX:i,targetY:s,sourcePosition:a,targetPosition:l,onReconnect:c,onReconnectStart:u,onReconnectEnd:d,setReconnecting:f,setUpdateHover:p}){let g=ie(),w=(y,E)=>{if(y.button!==0)return;let{autoPanOnConnect:v,domNode:N,connectionMode:A,connectionRadius:z,lib:L,onConnectStart:I,cancelConnection:D,nodeLookup:O,rfId:b,panBy:C,updateConnection:S}=g.getState(),M=E.type==="target",k=(R,H)=>{f(!1),d?.(R,n,E.type,H)},P=R=>c?.(n,R),$=(R,H)=>{f(!0),u?.(y,n,E.type),I?.(R,H)};Gn.onPointerDown(y.nativeEvent,{autoPanOnConnect:v,connectionMode:A,connectionRadius:z,domNode:N,handleId:E.id,nodeId:E.nodeId,nodeLookup:O,isTarget:M,edgeUpdaterType:E.type,lib:L,flowId:b,cancelConnection:D,panBy:C,isValidConnection:(...R)=>g.getState().isValidConnection?.(...R)??!0,onConnect:P,onConnectStart:$,onConnectEnd:(...R)=>g.getState().onConnectEnd?.(...R),onReconnectEnd:k,updateConnection:S,getTransform:()=>g.getState().transform,getFromHandle:()=>g.getState().connection.fromHandle,dragThreshold:g.getState().connectionDragThreshold,handleDomNode:y.currentTarget})},x=y=>w(y,{nodeId:n.target,id:n.targetHandle??null,type:"target"}),m=y=>w(y,{nodeId:n.source,id:n.sourceHandle??null,type:"source"}),_=()=>p(!0),h=()=>p(!1);return de(Pe,{children:[(e===!0||e==="source")&&T(pa,{position:a,centerX:o,centerY:r,radius:t,onMouseDown:x,onMouseEnter:_,onMouseOut:h,type:"source"}),(e===!0||e==="target")&&T(pa,{position:l,centerX:i,centerY:s,radius:t,onMouseDown:m,onMouseEnter:_,onMouseOut:h,type:"target"})]})}function wh({id:e,edgesFocusable:t,edgesReconnectable:n,elementsSelectable:o,onClick:r,onDoubleClick:i,onContextMenu:s,onMouseEnter:a,onMouseMove:l,onMouseLeave:c,reconnectRadius:u,onReconnect:d,onReconnectStart:f,onReconnectEnd:p,rfId:g,edgeTypes:w,noPanClassName:x,onError:m,disableKeyboardA11y:_}){let h=J(q=>q.edgeLookup.get(e)),y=J(q=>q.defaultEdgeOptions);h=y?{...y,...h}:h;let E=h.type||"default",v=w?.[E]||da[E];v===void 0&&(m?.("011",ye.error011(E)),E="default",v=w?.default||da.default);let N=!!(h.focusable||t&&typeof h.focusable>"u"),A=typeof d<"u"&&(h.reconnectable||n&&typeof h.reconnectable>"u"),z=!!(h.selectable||o&&typeof h.selectable>"u"),L=ee(null),[I,D]=_e(!1),[O,b]=_e(!1),C=ie(),{zIndex:S,sourceX:M,sourceY:k,targetX:P,targetY:$,sourcePosition:R,targetPosition:H}=J(ve(q=>{let K=q.nodeLookup.get(h.source),j=q.nodeLookup.get(h.target);if(!K||!j)return{zIndex:h.zIndex,...fa};let oe=Ms({id:e,sourceNode:K,targetNode:j,sourceHandle:h.sourceHandle||null,targetHandle:h.targetHandle||null,connectionMode:q.connectionMode,onError:m});return{zIndex:Cs({selected:h.selected,zIndex:h.zIndex,sourceNode:K,targetNode:j,elevateOnSelect:q.elevateEdgesOnSelect,zIndexMode:q.zIndexMode}),...oe||fa}},[h.source,h.target,h.sourceHandle,h.targetHandle,h.selected,h.zIndex]),re),F=Ce(()=>h.markerStart?`url('#${Wn(h.markerStart,g)}')`:void 0,[h.markerStart,g]),V=Ce(()=>h.markerEnd?`url('#${Wn(h.markerEnd,g)}')`:void 0,[h.markerEnd,g]);if(h.hidden||M===null||k===null||P===null||$===null)return null;let W=q=>{let{addSelectedEdges:K,unselectNodesAndEdges:j,multiSelectionActive:oe}=C.getState();z&&(C.setState({nodesSelectionActive:!1}),h.selected&&oe?(j({nodes:[],edges:[h]}),L.current?.blur()):K([e])),r&&r(q,h)},G=i?q=>{i(q,{...h})}:void 0,Z=s?q=>{s(q,{...h})}:void 0,B=a?q=>{a(q,{...h})}:void 0,Y=l?q=>{l(q,{...h})}:void 0,Q=c?q=>{c(q,{...h})}:void 0,U=q=>{if(!_&&ko.includes(q.key)&&z){let{unselectNodesAndEdges:K,addSelectedEdges:j}=C.getState();q.key==="Escape"?(L.current?.blur(),K({edges:[h]})):j([e])}};return T("svg",{style:{zIndex:S},children:de("g",{className:ae(["react-flow__edge",`react-flow__edge-${E}`,h.className,x,{selected:h.selected,animated:h.animated,inactive:!z&&!r,updating:I,selectable:z}]),onClick:W,onDoubleClick:G,onContextMenu:Z,onMouseEnter:B,onMouseMove:Y,onMouseLeave:Q,onKeyDown:N?U:void 0,tabIndex:N?0:void 0,role:h.ariaRole??(N?"group":"img"),"aria-roledescription":"edge","data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":h.ariaLabel===null?void 0:h.ariaLabel||`Edge from ${h.source} to ${h.target}`,"aria-describedby":N?`${va}-${g}`:void 0,ref:L,...h.domAttributes,children:[!O&&T(v,{id:e,source:h.source,target:h.target,type:h.type,selected:h.selected,animated:h.animated,selectable:z,deletable:h.deletable??!0,label:h.label,labelStyle:h.labelStyle,labelShowBg:h.labelShowBg,labelBgStyle:h.labelBgStyle,labelBgPadding:h.labelBgPadding,labelBgBorderRadius:h.labelBgBorderRadius,sourceX:M,sourceY:k,targetX:P,targetY:$,sourcePosition:R,targetPosition:H,data:h.data,style:h.style,sourceHandleId:h.sourceHandle,targetHandleId:h.targetHandle,markerStart:F,markerEnd:V,pathOptions:"pathOptions"in h?h.pathOptions:void 0,interactionWidth:h.interactionWidth}),A&&T(xh,{edge:h,isReconnectable:A,reconnectRadius:u,onReconnect:d,onReconnectStart:f,onReconnectEnd:p,sourceX:M,sourceY:k,targetX:P,targetY:$,sourcePosition:R,targetPosition:H,setUpdateHover:D,setReconnecting:b})]})})}var bh=ce(wh),_h=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function Ka({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:n,edgeTypes:o,noPanClassName:r,onReconnect:i,onEdgeContextMenu:s,onEdgeMouseEnter:a,onEdgeMouseMove:l,onEdgeMouseLeave:c,onEdgeClick:u,reconnectRadius:d,onEdgeDoubleClick:f,onReconnectStart:p,onReconnectEnd:g,disableKeyboardA11y:w}){let{edgesFocusable:x,edgesReconnectable:m,elementsSelectable:_,onError:h}=J(_h,re),y=ih(t);return de("div",{className:"react-flow__edges",children:[T(uh,{defaultColor:e,rfId:n}),y.map(E=>T(bh,{id:E,edgesFocusable:x,edgesReconnectable:m,elementsSelectable:_,noPanClassName:r,onReconnect:i,onContextMenu:s,onMouseEnter:a,onMouseMove:l,onMouseLeave:c,onClick:u,reconnectRadius:d,onDoubleClick:f,onReconnectStart:p,onReconnectEnd:g,rfId:n,onError:h,edgeTypes:o,disableKeyboardA11y:w},E))]})}Ka.displayName="EdgeRenderer";var vh=ce(Ka),Sh=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function Eh({children:e}){let t=J(Sh);return T("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:t},children:e})}function Nh(e){let t=tr(),n=ee(!1);te(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}var Ch=e=>e.panZoom?.syncViewport;function kh(e){let t=J(Ch),n=ie();return te(()=>{e&&(t?.(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function ga(e){return e.connection.inProgress?{...e.connection,to:St(e.connection.to,e.transform)}:{...e.connection}}function Mh(e){return e?n=>{let o=ga(n);return e(o)}:ga}function Ih(e){let t=Mh(e);return J(t,re)}var Ph=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function zh({containerStyle:e,style:t,type:n,component:o}){let{nodesConnectable:r,width:i,height:s,isValid:a,inProgress:l}=J(Ph,re);return!(i&&r&&l)?null:T("svg",{style:e,width:i,height:s,className:"react-flow__connectionline react-flow__container",children:T("g",{className:ae(["react-flow__connection",Po(a)]),children:T(Ga,{style:t,type:n,CustomComponent:o,isValid:a})})})}var Ga=({style:e,type:t=Me.Bezier,CustomComponent:n,isValid:o})=>{let{inProgress:r,from:i,fromNode:s,fromHandle:a,fromPosition:l,to:c,toNode:u,toHandle:d,toPosition:f,pointer:p}=Ih();if(!r)return;if(n)return T(n,{connectionLineType:t,connectionLineStyle:e,fromNode:s,fromHandle:a,fromX:i.x,fromY:i.y,toX:c.x,toY:c.y,fromPosition:l,toPosition:f,connectionStatus:Po(o),toNode:u,toHandle:d,pointer:p});let g="",w={sourceX:i.x,sourceY:i.y,sourcePosition:l,targetX:c.x,targetY:c.y,targetPosition:f};switch(t){case Me.Bezier:[g]=Yn(w);break;case Me.SimpleBezier:[g]=Oa(w);break;case Me.Step:[g]=nn({...w,borderRadius:0});break;case Me.SmoothStep:[g]=nn(w);break;default:[g]=Zn(w)}return T("path",{d:g,fill:"none",className:"react-flow__connection-path",style:e})};Ga.displayName="ConnectionLine";var Ah={};function ma(e=Ah){let t=ee(e),n=ie();te(()=>{if(process.env.NODE_ENV==="development"){let o=new Set([...Object.keys(t.current),...Object.keys(e)]);for(let r of o)if(t.current[r]!==e[r]){n.getState().onError?.("002",ye.error002());break}t.current=e}},[e])}function Dh(){let e=ie(),t=ee(!1);te(()=>{if(process.env.NODE_ENV==="development"&&!t.current){let n=document.querySelector(".react-flow__pane");n&&window.getComputedStyle(n).zIndex!=="1"&&e.getState().onError?.("013",ye.error013("react")),t.current=!0}},[])}function Ua({nodeTypes:e,edgeTypes:t,onInit:n,onNodeClick:o,onEdgeClick:r,onNodeDoubleClick:i,onEdgeDoubleClick:s,onNodeMouseEnter:a,onNodeMouseMove:l,onNodeMouseLeave:c,onNodeContextMenu:u,onSelectionContextMenu:d,onSelectionStart:f,onSelectionEnd:p,connectionLineType:g,connectionLineStyle:w,connectionLineComponent:x,connectionLineContainerStyle:m,selectionKeyCode:_,selectionOnDrag:h,selectionMode:y,multiSelectionKeyCode:E,panActivationKeyCode:v,zoomActivationKeyCode:N,deleteKeyCode:A,onlyRenderVisibleElements:z,elementsSelectable:L,defaultViewport:I,translateExtent:D,minZoom:O,maxZoom:b,preventScrolling:C,defaultMarkerColor:S,zoomOnScroll:M,zoomOnPinch:k,panOnScroll:P,panOnScrollSpeed:$,panOnScrollMode:R,zoomOnDoubleClick:H,panOnDrag:F,onPaneClick:V,onPaneMouseEnter:W,onPaneMouseMove:G,onPaneMouseLeave:Z,onPaneScroll:B,onPaneContextMenu:Y,paneClickDistance:Q,nodeClickDistance:U,onEdgeContextMenu:q,onEdgeMouseEnter:K,onEdgeMouseMove:j,onEdgeMouseLeave:oe,reconnectRadius:ne,onReconnect:he,onReconnectStart:Re,onReconnectEnd:ze,noDragClassName:qe,noWheelClassName:Ct,noPanClassName:kt,disableKeyboardA11y:Mt,nodeExtent:io,rfId:sn,viewport:ct,onViewportChange:It}){return ma(e),ma(t),Dh(),Nh(n),kh(ct),T(Gf,{onPaneClick:V,onPaneMouseEnter:W,onPaneMouseMove:G,onPaneMouseLeave:Z,onPaneContextMenu:Y,onPaneScroll:B,paneClickDistance:Q,deleteKeyCode:A,selectionKeyCode:_,selectionOnDrag:h,selectionMode:y,onSelectionStart:f,onSelectionEnd:p,multiSelectionKeyCode:E,panActivationKeyCode:v,zoomActivationKeyCode:N,elementsSelectable:L,zoomOnScroll:M,zoomOnPinch:k,zoomOnDoubleClick:H,panOnScroll:P,panOnScrollSpeed:$,panOnScrollMode:R,panOnDrag:F,defaultViewport:I,translateExtent:D,minZoom:O,maxZoom:b,onSelectionContextMenu:d,preventScrolling:C,noDragClassName:qe,noWheelClassName:Ct,noPanClassName:kt,disableKeyboardA11y:Mt,onViewportChange:It,isControlledViewport:!!ct,children:de(Eh,{children:[T(vh,{edgeTypes:t,onEdgeClick:r,onEdgeDoubleClick:s,onReconnect:he,onReconnectStart:Re,onReconnectEnd:ze,onlyRenderVisibleElements:z,onEdgeContextMenu:q,onEdgeMouseEnter:K,onEdgeMouseMove:j,onEdgeMouseLeave:oe,reconnectRadius:ne,defaultMarkerColor:S,noPanClassName:kt,disableKeyboardA11y:Mt,rfId:sn}),T(zh,{style:w,type:g,component:x,containerStyle:m}),T("div",{className:"react-flow__edgelabel-renderer"}),T(rh,{nodeTypes:e,onNodeClick:o,onNodeDoubleClick:i,onNodeMouseEnter:a,onNodeMouseMove:l,onNodeMouseLeave:c,onNodeContextMenu:u,nodeClickDistance:U,onlyRenderVisibleElements:z,noPanClassName:kt,noDragClassName:qe,disableKeyboardA11y:Mt,nodeExtent:io,rfId:sn}),T("div",{className:"react-flow__viewport-portal"})]})})}Ua.displayName="GraphView";var Th=ce(Ua),ya=({nodes:e,edges:t,defaultNodes:n,defaultEdges:o,width:r,height:i,fitView:s,fitViewOptions:a,minZoom:l=.5,maxZoom:c=2,nodeOrigin:u,nodeExtent:d,zIndexMode:f="basic"}={})=>{let p=new Map,g=new Map,w=new Map,x=new Map,m=o??t??[],_=n??e??[],h=u??[0,0],y=d??wt;Uo(w,x,m);let E=qn(_,p,g,{nodeOrigin:h,nodeExtent:y,zIndexMode:f}),v=[0,0,1];if(s&&r&&i){let N=bt(p,{filter:I=>!!((I.width||I.initialWidth)&&(I.height||I.initialHeight))}),{x:A,y:z,zoom:L}=tn(N,r,i,l,c,a?.padding??.1);v=[A,z,L]}return{rfId:"1",width:r??0,height:i??0,transform:v,nodes:_,nodesInitialized:E,nodeLookup:p,parentLookup:g,edges:m,edgeLookup:x,connectionLookup:w,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:n!==void 0,hasDefaultEdges:o!==void 0,panZoom:null,minZoom:l,maxZoom:c,translateExtent:wt,nodeExtent:y,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:Ye.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:h,nodeDragThreshold:1,connectionDragThreshold:1,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesReconnectable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!0,selectNodesOnDrag:!0,multiSelectionActive:!1,fitViewQueued:s??!1,fitViewOptions:a,fitViewResolver:null,connection:{...Io},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:Ho,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:Mo,zIndexMode:f,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},$h=({nodes:e,edges:t,defaultNodes:n,defaultEdges:o,width:r,height:i,fitView:s,fitViewOptions:a,minZoom:l,maxZoom:c,nodeOrigin:u,nodeExtent:d,zIndexMode:f})=>jd((p,g)=>{async function w(){let{nodeLookup:x,panZoom:m,fitViewOptions:_,fitViewResolver:h,width:y,height:E,minZoom:v,maxZoom:N}=g();m&&(await bs({nodes:x,width:y,height:E,panZoom:m,minZoom:v,maxZoom:N},_),h?.resolve(!0),p({fitViewResolver:null}))}return{...ya({nodes:e,edges:t,width:r,height:i,fitView:s,fitViewOptions:a,minZoom:l,maxZoom:c,nodeOrigin:u,nodeExtent:d,defaultNodes:n,defaultEdges:o,zIndexMode:f}),setNodes:x=>{let{nodeLookup:m,parentLookup:_,nodeOrigin:h,elevateNodesOnSelect:y,fitViewQueued:E,zIndexMode:v}=g(),N=qn(x,m,_,{nodeOrigin:h,nodeExtent:d,elevateNodesOnSelect:y,checkEquality:!0,zIndexMode:v});E&&N?(w(),p({nodes:x,nodesInitialized:N,fitViewQueued:!1,fitViewOptions:void 0})):p({nodes:x,nodesInitialized:N})},setEdges:x=>{let{connectionLookup:m,edgeLookup:_}=g();Uo(m,_,x),p({edges:x})},setDefaultNodesAndEdges:(x,m)=>{if(x){let{setNodes:_}=g();_(x),p({hasDefaultNodes:!0})}if(m){let{setEdges:_}=g();_(m),p({hasDefaultEdges:!0})}},updateNodeInternals:x=>{let{triggerNodeChanges:m,nodeLookup:_,parentLookup:h,domNode:y,nodeOrigin:E,nodeExtent:v,debug:N,fitViewQueued:A,zIndexMode:z}=g(),{changes:L,updatedInternals:I}=Ds(x,_,h,y,E,v,z);I&&(zs(_,h,{nodeOrigin:E,nodeExtent:v,zIndexMode:z}),A?(w(),p({fitViewQueued:!1,fitViewOptions:void 0})):p({}),L?.length>0&&(N&&console.log("React Flow: trigger node changes",L),m?.(L)))},updateNodePositions:(x,m=!1)=>{let _=[],h=[],{nodeLookup:y,triggerNodeChanges:E,connection:v,updateConnection:N,onNodesChangeMiddlewareMap:A}=g();for(let[z,L]of x){let I=y.get(z),D=!!(I?.expandParent&&I?.parentId&&L?.position),O={id:z,type:"position",position:D?{x:Math.max(0,L.position.x),y:Math.max(0,L.position.y)}:L.position,dragging:m};if(I&&v.inProgress&&v.fromNode.id===I.id){let b=Ze(I,v.fromHandle,X.Left,!0);N({...v,from:b})}D&&I.parentId&&_.push({id:z,parentId:I.parentId,rect:{...L.internals.positionAbsolute,width:L.measured.width??0,height:L.measured.height??0}}),h.push(O)}if(_.length>0){let{parentLookup:z,nodeOrigin:L}=g(),I=Kn(_,y,z,L);h.push(...I)}for(let z of A.values())h=z(h);E(h)},triggerNodeChanges:x=>{let{onNodesChange:m,setNodes:_,nodes:h,hasDefaultNodes:y,debug:E}=g();if(x?.length){if(y){let v=Na(x,h);_(v)}E&&console.log("React Flow: trigger node changes",x),m?.(x)}},triggerEdgeChanges:x=>{let{onEdgesChange:m,setEdges:_,edges:h,hasDefaultEdges:y,debug:E}=g();if(x?.length){if(y){let v=Ca(x,h);_(v)}E&&console.log("React Flow: trigger edge changes",x),m?.(x)}},addSelectedNodes:x=>{let{multiSelectionActive:m,edgeLookup:_,nodeLookup:h,triggerNodeChanges:y,triggerEdgeChanges:E}=g();if(m){let v=x.map(N=>at(N,!0));y(v);return}y(Nt(h,new Set([...x]),!0)),E(Nt(_))},addSelectedEdges:x=>{let{multiSelectionActive:m,edgeLookup:_,nodeLookup:h,triggerNodeChanges:y,triggerEdgeChanges:E}=g();if(m){let v=x.map(N=>at(N,!0));E(v);return}E(Nt(_,new Set([...x]))),y(Nt(h,new Set,!0))},unselectNodesAndEdges:({nodes:x,edges:m}={})=>{let{edges:_,nodes:h,nodeLookup:y,triggerNodeChanges:E,triggerEdgeChanges:v}=g(),N=x||h,A=m||_,z=[];for(let I of N){if(!I.selected)continue;let D=y.get(I.id);D&&(D.selected=!1),z.push(at(I.id,!1))}let L=[];for(let I of A)I.selected&&L.push(at(I.id,!1));E(z),v(L)},setMinZoom:x=>{let{panZoom:m,maxZoom:_}=g();m?.setScaleExtent([x,_]),p({minZoom:x})},setMaxZoom:x=>{let{panZoom:m,minZoom:_}=g();m?.setScaleExtent([_,x]),p({maxZoom:x})},setTranslateExtent:x=>{g().panZoom?.setTranslateExtent(x),p({translateExtent:x})},resetSelectedElements:()=>{let{edges:x,nodes:m,triggerNodeChanges:_,triggerEdgeChanges:h,elementsSelectable:y}=g();if(!y)return;let E=m.reduce((N,A)=>A.selected?[...N,at(A.id,!1)]:N,[]),v=x.reduce((N,A)=>A.selected?[...N,at(A.id,!1)]:N,[]);_(E),h(v)},setNodeExtent:x=>{let{nodes:m,nodeLookup:_,parentLookup:h,nodeOrigin:y,elevateNodesOnSelect:E,nodeExtent:v,zIndexMode:N}=g();x[0][0]===v[0][0]&&x[0][1]===v[0][1]&&x[1][0]===v[1][0]&&x[1][1]===v[1][1]||(qn(m,_,h,{nodeOrigin:y,nodeExtent:x,elevateNodesOnSelect:E,checkEquality:!1,zIndexMode:N}),p({nodeExtent:x}))},panBy:x=>{let{transform:m,width:_,height:h,panZoom:y,translateExtent:E}=g();return Ts({delta:x,panZoom:y,transform:m,translateExtent:E,width:_,height:h})},setCenter:async(x,m,_)=>{let{width:h,height:y,maxZoom:E,panZoom:v}=g();if(!v)return Promise.resolve(!1);let N=typeof _?.zoom<"u"?_.zoom:E;return await v.setViewport({x:h/2-x*N,y:y/2-m*N,zoom:N},{duration:_?.duration,ease:_?.ease,interpolate:_?.interpolate}),Promise.resolve(!0)},cancelConnection:()=>{p({connection:{...Io}})},updateConnection:x=>{p({connection:x})},reset:()=>p({...ya()})}},Object.is);function Oh({initialNodes:e,initialEdges:t,defaultNodes:n,defaultEdges:o,initialWidth:r,initialHeight:i,initialMinZoom:s,initialMaxZoom:a,initialFitViewOptions:l,fitView:c,nodeOrigin:u,nodeExtent:d,zIndexMode:f,children:p}){let[g]=_e(()=>$h({nodes:e,edges:t,defaultNodes:n,defaultEdges:o,width:r,height:i,fitView:c,minZoom:s,maxZoom:a,fitViewOptions:l,nodeOrigin:u,nodeExtent:d,zIndexMode:f}));return T(ef,{value:g,children:T(Ef,{children:p})})}function Hh({children:e,nodes:t,edges:n,defaultNodes:o,defaultEdges:r,width:i,height:s,fitView:a,fitViewOptions:l,minZoom:c,maxZoom:u,nodeOrigin:d,nodeExtent:f,zIndexMode:p}){return rn(to)?T(Pe,{children:e}):T(Oh,{initialNodes:t,initialEdges:n,defaultNodes:o,defaultEdges:r,initialWidth:i,initialHeight:s,fitView:a,initialFitViewOptions:l,initialMinZoom:c,initialMaxZoom:u,nodeOrigin:d,nodeExtent:f,zIndexMode:p,children:e})}var Rh={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function Lh({nodes:e,edges:t,defaultNodes:n,defaultEdges:o,className:r,nodeTypes:i,edgeTypes:s,onNodeClick:a,onEdgeClick:l,onInit:c,onMove:u,onMoveStart:d,onMoveEnd:f,onConnect:p,onConnectStart:g,onConnectEnd:w,onClickConnectStart:x,onClickConnectEnd:m,onNodeMouseEnter:_,onNodeMouseMove:h,onNodeMouseLeave:y,onNodeContextMenu:E,onNodeDoubleClick:v,onNodeDragStart:N,onNodeDrag:A,onNodeDragStop:z,onNodesDelete:L,onEdgesDelete:I,onDelete:D,onSelectionChange:O,onSelectionDragStart:b,onSelectionDrag:C,onSelectionDragStop:S,onSelectionContextMenu:M,onSelectionStart:k,onSelectionEnd:P,onBeforeDelete:$,connectionMode:R,connectionLineType:H=Me.Bezier,connectionLineStyle:F,connectionLineComponent:V,connectionLineContainerStyle:W,deleteKeyCode:G="Backspace",selectionKeyCode:Z="Shift",selectionOnDrag:B=!1,selectionMode:Y=rt.Full,panActivationKeyCode:Q="Space",multiSelectionKeyCode:U=Et()?"Meta":"Control",zoomActivationKeyCode:q=Et()?"Meta":"Control",snapToGrid:K,snapGrid:j,onlyRenderVisibleElements:oe=!1,selectNodesOnDrag:ne,nodesDraggable:he,autoPanOnNodeFocus:Re,nodesConnectable:ze,nodesFocusable:qe,nodeOrigin:Ct=Sa,edgesFocusable:kt,edgesReconnectable:Mt,elementsSelectable:io=!0,defaultViewport:sn=pf,minZoom:ct=.5,maxZoom:It=2,translateExtent:or=wt,preventScrolling:ec=!0,nodeExtent:so,defaultMarkerColor:tc="#b1b1b7",zoomOnScroll:nc=!0,zoomOnPinch:oc=!0,panOnScroll:rc=!1,panOnScrollSpeed:ic=.5,panOnScrollMode:sc=Oe.Free,zoomOnDoubleClick:ac=!0,panOnDrag:cc=!0,onPaneClick:lc,onPaneMouseEnter:uc,onPaneMouseMove:dc,onPaneMouseLeave:fc,onPaneScroll:hc,onPaneContextMenu:pc,paneClickDistance:gc=1,nodeClickDistance:mc=0,children:yc,onReconnect:xc,onReconnectStart:wc,onReconnectEnd:bc,onEdgeContextMenu:_c,onEdgeDoubleClick:vc,onEdgeMouseEnter:Sc,onEdgeMouseMove:Ec,onEdgeMouseLeave:Nc,reconnectRadius:Cc=10,onNodesChange:kc,onEdgesChange:Mc,noDragClassName:Ic="nodrag",noWheelClassName:Pc="nowheel",noPanClassName:rr="nopan",fitView:ir,fitViewOptions:sr,connectOnClick:zc,attributionPosition:Ac,proOptions:Dc,defaultEdgeOptions:Tc,elevateNodesOnSelect:$c=!0,elevateEdgesOnSelect:Oc=!1,disableKeyboardA11y:ar=!1,autoPanOnConnect:Hc,autoPanOnNodeDrag:Rc,autoPanSpeed:Lc,connectionRadius:Bc,isValidConnection:Vc,onError:Fc,style:Xc,id:cr,nodeDragThreshold:Yc,connectionDragThreshold:Zc,viewport:Wc,onViewportChange:qc,width:Kc,height:Gc,colorMode:Uc="light",debug:Qc,onScroll:lr,ariaLabelConfig:Jc,zIndexMode:ur="basic",...jc},el){let ao=cr||"1",tl=xf(Uc),nl=ve(dr=>{dr.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),lr?.(dr)},[lr]);return T("div",{"data-testid":"rf__wrapper",...jc,onScroll:nl,style:{...Xc,...Rh},ref:el,className:ae(["react-flow",r,tl]),id:cr,role:"application",children:de(Hh,{nodes:e,edges:t,width:Kc,height:Gc,fitView:ir,fitViewOptions:sr,minZoom:ct,maxZoom:It,nodeOrigin:Ct,nodeExtent:so,zIndexMode:ur,children:[T(Th,{onInit:c,onNodeClick:a,onEdgeClick:l,onNodeMouseEnter:_,onNodeMouseMove:h,onNodeMouseLeave:y,onNodeContextMenu:E,onNodeDoubleClick:v,nodeTypes:i,edgeTypes:s,connectionLineType:H,connectionLineStyle:F,connectionLineComponent:V,connectionLineContainerStyle:W,selectionKeyCode:Z,selectionOnDrag:B,selectionMode:Y,deleteKeyCode:G,multiSelectionKeyCode:U,panActivationKeyCode:Q,zoomActivationKeyCode:q,onlyRenderVisibleElements:oe,defaultViewport:sn,translateExtent:or,minZoom:ct,maxZoom:It,preventScrolling:ec,zoomOnScroll:nc,zoomOnPinch:oc,zoomOnDoubleClick:ac,panOnScroll:rc,panOnScrollSpeed:ic,panOnScrollMode:sc,panOnDrag:cc,onPaneClick:lc,onPaneMouseEnter:uc,onPaneMouseMove:dc,onPaneMouseLeave:fc,onPaneScroll:hc,onPaneContextMenu:pc,paneClickDistance:gc,nodeClickDistance:mc,onSelectionContextMenu:M,onSelectionStart:k,onSelectionEnd:P,onReconnect:xc,onReconnectStart:wc,onReconnectEnd:bc,onEdgeContextMenu:_c,onEdgeDoubleClick:vc,onEdgeMouseEnter:Sc,onEdgeMouseMove:Ec,onEdgeMouseLeave:Nc,reconnectRadius:Cc,defaultMarkerColor:tc,noDragClassName:Ic,noWheelClassName:Pc,noPanClassName:rr,rfId:ao,disableKeyboardA11y:ar,nodeExtent:so,viewport:Wc,onViewportChange:qc}),T(yf,{nodes:e,edges:t,defaultNodes:n,defaultEdges:o,onConnect:p,onConnectStart:g,onConnectEnd:w,onClickConnectStart:x,onClickConnectEnd:m,nodesDraggable:he,autoPanOnNodeFocus:Re,nodesConnectable:ze,nodesFocusable:qe,edgesFocusable:kt,edgesReconnectable:Mt,elementsSelectable:io,elevateNodesOnSelect:$c,elevateEdgesOnSelect:Oc,minZoom:ct,maxZoom:It,nodeExtent:so,onNodesChange:kc,onEdgesChange:Mc,snapToGrid:K,snapGrid:j,connectionMode:R,translateExtent:or,connectOnClick:zc,defaultEdgeOptions:Tc,fitView:ir,fitViewOptions:sr,onNodesDelete:L,onEdgesDelete:I,onDelete:D,onNodeDragStart:N,onNodeDrag:A,onNodeDragStop:z,onSelectionDrag:C,onSelectionDragStart:b,onSelectionDragStop:S,onMove:u,onMoveStart:d,onMoveEnd:f,noPanClassName:rr,nodeOrigin:Ct,rfId:ao,autoPanOnConnect:Hc,autoPanOnNodeDrag:Rc,autoPanSpeed:Lc,onError:Fc,connectionRadius:Bc,isValidConnection:Vc,selectNodesOnDrag:ne,nodeDragThreshold:Yc,connectionDragThreshold:Zc,onBeforeDelete:$,debug:Qc,ariaLabelConfig:Jc,zIndexMode:ur}),T(hf,{onSelectionChange:O}),yc,T(cf,{proOptions:Dc,position:Ac}),T(af,{rfId:ao,disableKeyboardA11y:ar})]})})}var xw=ka(Lh);function ww(e){let[t,n]=_e(e),o=ve(r=>n(i=>Na(r,i)),[]);return[t,n,o]}function bw(e){let[t,n]=_e(e),o=ve(r=>n(i=>Ca(r,i)),[]);return[t,n,o]}var _w=ye.error014();function Bh({dimensions:e,lineWidth:t,variant:n,className:o}){return T("path",{strokeWidth:t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:ae(["react-flow__background-pattern",n,o])})}function Vh({radius:e,className:t}){return T("circle",{cx:e,cy:e,r:e,className:ae(["react-flow__background-pattern","dots",t])})}var We;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(We||(We={}));var Fh={[We.Dots]:1,[We.Lines]:1,[We.Cross]:6},Xh=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function Qa({id:e,variant:t=We.Dots,gap:n=20,size:o,lineWidth:r=1,offset:i=0,color:s,bgColor:a,style:l,className:c,patternClassName:u}){let d=ee(null),{transform:f,patternId:p}=J(Xh,re),g=o||Fh[t],w=t===We.Dots,x=t===We.Cross,m=Array.isArray(n)?n:[n,n],_=[m[0]*f[2]||1,m[1]*f[2]||1],h=g*f[2],y=Array.isArray(i)?i:[i,i],E=x?[h,h]:_,v=[y[0]*f[2]||1+E[0]/2,y[1]*f[2]||1+E[1]/2],N=`${p}${e||""}`;return de("svg",{className:ae(["react-flow__background",c]),style:{...l,...oo,"--xy-background-color-props":a,"--xy-background-pattern-color-props":s},ref:d,"data-testid":"rf__background",children:[T("pattern",{id:N,x:f[0]%_[0],y:f[1]%_[1],width:_[0],height:_[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${v[0]},-${v[1]})`,children:w?T(Vh,{radius:h/2,className:u}):T(Bh,{dimensions:E,lineWidth:r,variant:t,className:u})}),T("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${N})`})]})}Qa.displayName="Background";var vw=ce(Qa);function Yh(){return T("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:T("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function Zh(){return T("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:T("path",{d:"M0 0h32v4.2H0z"})})}function Wh(){return T("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:T("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"})})}function qh(){return T("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:T("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"})})}function Kh(){return T("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:T("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"})})}function Jn({children:e,className:t,...n}){return T("button",{type:"button",className:ae(["react-flow__controls-button",t]),...n,children:e})}var Gh=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function Ja({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:o=!0,fitViewOptions:r,onZoomIn:i,onZoomOut:s,onFitView:a,onInteractiveChange:l,className:c,children:u,position:d="bottom-left",orientation:f="vertical","aria-label":p}){let g=ie(),{isInteractive:w,minZoomReached:x,maxZoomReached:m,ariaLabelConfig:_}=J(Gh,re),{zoomIn:h,zoomOut:y,fitView:E}=tr(),v=()=>{h(),i?.()},N=()=>{y(),s?.()},A=()=>{E(r),a?.()},z=()=>{g.setState({nodesDraggable:!w,nodesConnectable:!w,elementsSelectable:!w}),l?.(!w)};return de(no,{className:ae(["react-flow__controls",f==="horizontal"?"horizontal":"vertical",c]),position:d,style:e,"data-testid":"rf__controls","aria-label":p??_["controls.ariaLabel"],children:[t&&de(Pe,{children:[T(Jn,{onClick:v,className:"react-flow__controls-zoomin",title:_["controls.zoomIn.ariaLabel"],"aria-label":_["controls.zoomIn.ariaLabel"],disabled:m,children:T(Yh,{})}),T(Jn,{onClick:N,className:"react-flow__controls-zoomout",title:_["controls.zoomOut.ariaLabel"],"aria-label":_["controls.zoomOut.ariaLabel"],disabled:x,children:T(Zh,{})})]}),n&&T(Jn,{className:"react-flow__controls-fitview",onClick:A,title:_["controls.fitView.ariaLabel"],"aria-label":_["controls.fitView.ariaLabel"],children:T(Wh,{})}),o&&T(Jn,{className:"react-flow__controls-interactive",onClick:z,title:_["controls.interactive.ariaLabel"],"aria-label":_["controls.interactive.ariaLabel"],children:w?T(Kh,{}):T(qh,{})}),u]})}Ja.displayName="Controls";var Sw=ce(Ja);function Uh({id:e,x:t,y:n,width:o,height:r,style:i,color:s,strokeColor:a,strokeWidth:l,className:c,borderRadius:u,shapeRendering:d,selected:f,onClick:p}){let{background:g,backgroundColor:w}=i||{},x=s||g||w;return T("rect",{className:ae(["react-flow__minimap-node",{selected:f},c]),x:t,y:n,rx:u,ry:u,width:o,height:r,style:{fill:x,stroke:a,strokeWidth:l},shapeRendering:d,onClick:p?m=>p(m,e):void 0})}var Qh=ce(Uh),Jh=e=>e.nodes.map(t=>t.id),Jo=e=>e instanceof Function?e:()=>e;function jh({nodeStrokeColor:e,nodeColor:t,nodeClassName:n="",nodeBorderRadius:o=5,nodeStrokeWidth:r,nodeComponent:i=Qh,onClick:s}){let a=J(Jh,re),l=Jo(t),c=Jo(e),u=Jo(n),d=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return T(Pe,{children:a.map(f=>T(tp,{id:f,nodeColorFunc:l,nodeStrokeColorFunc:c,nodeClassNameFunc:u,nodeBorderRadius:o,nodeStrokeWidth:r,NodeComponent:i,onClick:s,shapeRendering:d},f))})}function ep({id:e,nodeColorFunc:t,nodeStrokeColorFunc:n,nodeClassNameFunc:o,nodeBorderRadius:r,nodeStrokeWidth:i,shapeRendering:s,NodeComponent:a,onClick:l}){let{node:c,x:u,y:d,width:f,height:p}=J(g=>{let w=g.nodeLookup.get(e);if(!w)return{node:void 0,x:0,y:0,width:0,height:0};let x=w.internals.userNode,{x:m,y:_}=w.internals.positionAbsolute,{width:h,height:y}=Ie(x);return{node:x,x:m,y:_,width:h,height:y}},re);return!c||c.hidden||!Ro(c)?null:T(a,{x:u,y:d,width:f,height:p,style:c.style,selected:!!c.selected,className:o(c),color:t(c),borderRadius:r,strokeColor:n(c),strokeWidth:i,shapeRendering:s,onClick:l,id:c.id})}var tp=ce(ep),np=ce(jh),op=200,rp=150,ip=e=>!e.hidden,sp=e=>{let t={x:-e.transform[0]/e.transform[2],y:-e.transform[1]/e.transform[2],width:e.width/e.transform[2],height:e.height/e.transform[2]};return{viewBB:t,boundingRect:e.nodeLookup.size>0?$o(bt(e.nodeLookup,{filter:ip}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},ap="react-flow__minimap-desc";function ja({style:e,className:t,nodeStrokeColor:n,nodeColor:o,nodeClassName:r="",nodeBorderRadius:i=5,nodeStrokeWidth:s,nodeComponent:a,bgColor:l,maskColor:c,maskStrokeColor:u,maskStrokeWidth:d,position:f="bottom-right",onClick:p,onNodeClick:g,pannable:w=!1,zoomable:x=!1,ariaLabel:m,inversePan:_,zoomStep:h=1,offsetScale:y=5}){let E=ie(),v=ee(null),{boundingRect:N,viewBB:A,rfId:z,panZoom:L,translateExtent:I,flowWidth:D,flowHeight:O,ariaLabelConfig:b}=J(sp,re),C=e?.width??op,S=e?.height??rp,M=N.width/C,k=N.height/S,P=Math.max(M,k),$=P*C,R=P*S,H=y*P,F=N.x-($-N.width)/2-H,V=N.y-(R-N.height)/2-H,W=$+H*2,G=R+H*2,Z=`${ap}-${z}`,B=ee(0),Y=ee();B.current=P,te(()=>{if(v.current&&L)return Y.current=Vs({domNode:v.current,panZoom:L,getTransform:()=>E.getState().transform,getViewScale:()=>B.current}),()=>{Y.current?.destroy()}},[L]),te(()=>{Y.current?.update({translateExtent:I,width:D,height:O,inversePan:_,pannable:w,zoomStep:h,zoomable:x})},[w,x,_,h,I,D,O]);let Q=p?K=>{let[j,oe]=Y.current?.pointer(K)||[0,0];p(K,{x:j,y:oe})}:void 0,U=g?ve((K,j)=>{let oe=E.getState().nodeLookup.get(j).internals.userNode;g(K,oe)},[]):void 0,q=m??b["minimap.ariaLabel"];return T(no,{position:f,style:{...e,"--xy-minimap-background-color-props":typeof l=="string"?l:void 0,"--xy-minimap-mask-background-color-props":typeof c=="string"?c:void 0,"--xy-minimap-mask-stroke-color-props":typeof u=="string"?u:void 0,"--xy-minimap-mask-stroke-width-props":typeof d=="number"?d*P:void 0,"--xy-minimap-node-background-color-props":typeof o=="string"?o:void 0,"--xy-minimap-node-stroke-color-props":typeof n=="string"?n:void 0,"--xy-minimap-node-stroke-width-props":typeof s=="number"?s:void 0},className:ae(["react-flow__minimap",t]),"data-testid":"rf__minimap",children:de("svg",{width:C,height:S,viewBox:`${F} ${V} ${W} ${G}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":Z,ref:v,onClick:Q,children:[q&&T("title",{id:Z,children:q}),T(np,{onClick:U,nodeColor:o,nodeStrokeColor:n,nodeBorderRadius:i,nodeClassName:r,nodeStrokeWidth:s,nodeComponent:a}),T("path",{className:"react-flow__minimap-mask",d:`M${F-H},${V-H}h${W+H*2}v${G+H*2}h${-W-H*2}z
|
|
7
|
+
M${A.x},${A.y}h${A.width}v${A.height}h${-A.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}ja.displayName="MiniMap";var Ew=ce(ja),cp=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,lp={[He.Line]:"right",[He.Handle]:"bottom-right"};function up({nodeId:e,position:t,variant:n=He.Handle,className:o,style:r=void 0,children:i,color:s,minWidth:a=10,minHeight:l=10,maxWidth:c=Number.MAX_VALUE,maxHeight:u=Number.MAX_VALUE,keepAspectRatio:d=!1,resizeDirection:f,autoScale:p=!0,shouldResize:g,onResizeStart:w,onResize:x,onResizeEnd:m}){let _=za(),h=typeof e=="string"?e:_,y=ie(),E=ee(null),v=n===He.Handle,N=J(ve(cp(v&&p),[v,p]),re),A=ee(null),z=t??lp[n];te(()=>{if(!(!E.current||!h))return A.current||(A.current=Ks({domNode:E.current,nodeId:h,getStoreItems:()=>{let{nodeLookup:I,transform:D,snapGrid:O,snapToGrid:b,nodeOrigin:C,domNode:S}=y.getState();return{nodeLookup:I,transform:D,snapGrid:O,snapToGrid:b,nodeOrigin:C,paneDomNode:S}},onChange:(I,D)=>{let{triggerNodeChanges:O,nodeLookup:b,parentLookup:C,nodeOrigin:S}=y.getState(),M=[],k={x:I.x,y:I.y},P=b.get(h);if(P&&P.expandParent&&P.parentId){let $=P.origin??S,R=I.width??P.measured.width??0,H=I.height??P.measured.height??0,F={id:P.id,parentId:P.parentId,rect:{width:R,height:H,...Lo({x:I.x??P.position.x,y:I.y??P.position.y},{width:R,height:H},P.parentId,b,$)}},V=Kn([F],b,C,S);M.push(...V),k.x=I.x?Math.max($[0]*R,I.x):void 0,k.y=I.y?Math.max($[1]*H,I.y):void 0}if(k.x!==void 0&&k.y!==void 0){let $={id:h,type:"position",position:{...k}};M.push($)}if(I.width!==void 0&&I.height!==void 0){let R={id:h,type:"dimensions",resizing:!0,setAttributes:f?f==="horizontal"?"width":"height":!0,dimensions:{width:I.width,height:I.height}};M.push(R)}for(let $ of D){let R={...$,type:"position"};M.push(R)}O(M)},onEnd:({width:I,height:D})=>{let O={id:h,type:"dimensions",resizing:!1,dimensions:{width:I,height:D}};y.getState().triggerNodeChanges([O])}})),A.current.update({controlPosition:z,boundaries:{minWidth:a,minHeight:l,maxWidth:c,maxHeight:u},keepAspectRatio:d,resizeDirection:f,onResizeStart:w,onResize:x,onResizeEnd:m,shouldResize:g}),()=>{A.current?.destroy()}},[z,a,l,c,u,d,w,x,m,g]);let L=z.split("-");return T("div",{className:ae(["react-flow__resize-control","nodrag",...L,n,o]),ref:E,style:{...r,scale:N,...s&&{[v?"backgroundColor":"borderColor"]:s}},children:i})}var xa=ce(up);function Nw({nodeId:e,isVisible:t=!0,handleClassName:n,handleStyle:o,lineClassName:r,lineStyle:i,color:s,minWidth:a=10,minHeight:l=10,maxWidth:c=Number.MAX_VALUE,maxHeight:u=Number.MAX_VALUE,keepAspectRatio:d=!1,autoScale:f=!0,shouldResize:p,onResizeStart:g,onResize:w,onResizeEnd:x}){return t?de(Pe,{children:[Ws.map(m=>T(xa,{className:r,style:i,nodeId:e,position:m,variant:He.Line,color:s,minWidth:a,minHeight:l,maxWidth:c,maxHeight:u,onResizeStart:g,keepAspectRatio:d,autoScale:f,shouldResize:p,onResize:w,onResizeEnd:x},m)),Zs.map(m=>T(xa,{className:n,style:o,nodeId:e,position:m,color:s,minWidth:a,minHeight:l,maxWidth:c,maxHeight:u,onResizeStart:g,keepAspectRatio:d,autoScale:f,shouldResize:p,onResize:w,onResizeEnd:x},m))]}):null}export{rt as a,mt as b,X as c,Zo as d,no as e,Na as f,Ca as g,tr as h,jn as i,Oh as j,xw as k,ww as l,bw as m,We as n,vw as o,Sw as p,Ew as q,Nw as r};
|