@kienmatu/inkos-studio 0.1.2 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. package/dist/assets/{FilmWizard-CuCB-1xV.js → FilmWizard-BAeDX_rI.js} +1 -1
  2. package/dist/assets/{FlowView-rMLtzFZK.js → FlowView-C6n6r8pJ.js} +1 -1
  3. package/dist/assets/{_baseUniq-xbTfIKo7.js → _baseUniq-CHNUfn5h.js} +1 -1
  4. package/dist/assets/{arc-BJ0Jn4qy.js → arc-CdPV8k-0.js} +1 -1
  5. package/dist/assets/{architectureDiagram-Q4EWVU46-B54hBS8X.js → architectureDiagram-Q4EWVU46-oodkcVSQ.js} +1 -1
  6. package/dist/assets/{blockDiagram-DXYQGD6D-BrQpuNBu.js → blockDiagram-DXYQGD6D-CIbxhPHs.js} +1 -1
  7. package/dist/assets/{c4Diagram-AHTNJAMY-nN4kJiPC.js → c4Diagram-AHTNJAMY-CxIpgCiP.js} +1 -1
  8. package/dist/assets/channel-BudrdgJ_.js +1 -0
  9. package/dist/assets/{chunk-4BX2VUAB-DnzQoX6p.js → chunk-4BX2VUAB-Cf70tfVa.js} +1 -1
  10. package/dist/assets/{chunk-4TB4RGXK-PeEeEWP2.js → chunk-4TB4RGXK-uFQAF256.js} +1 -1
  11. package/dist/assets/{chunk-55IACEB6-BZHFzH6I.js → chunk-55IACEB6-4u7WcTds.js} +1 -1
  12. package/dist/assets/{chunk-EDXVE4YY-B06PJNq-.js → chunk-EDXVE4YY-DKvxdCCA.js} +1 -1
  13. package/dist/assets/{chunk-FMBD7UC4-Cny1qCNu.js → chunk-FMBD7UC4-DA6v8xvJ.js} +1 -1
  14. package/dist/assets/{chunk-OYMX7WX6-MqHFCczv.js → chunk-OYMX7WX6-DwLlaWl9.js} +1 -1
  15. package/dist/assets/{chunk-QZHKN3VN-Bu8oSEuV.js → chunk-QZHKN3VN-CFgB8UWK.js} +1 -1
  16. package/dist/assets/{chunk-YZCP3GAM-DW9WLjg7.js → chunk-YZCP3GAM-JgBXvZgf.js} +1 -1
  17. package/dist/assets/classDiagram-6PBFFD2Q-CNYOE6Pk.js +1 -0
  18. package/dist/assets/classDiagram-v2-HSJHXN6E-CNYOE6Pk.js +1 -0
  19. package/dist/assets/clone-CbLIuAlV.js +1 -0
  20. package/dist/assets/{cose-bilkent-S5V4N54A-BFF3VF0W.js → cose-bilkent-S5V4N54A-DKMKqdAL.js} +1 -1
  21. package/dist/assets/{dagre-KV5264BT-7wO_SFt1.js → dagre-KV5264BT-DuZ4zm4B.js} +1 -1
  22. package/dist/assets/{diagram-5BDNPKRD-DpdLNbTp.js → diagram-5BDNPKRD-CoA3HYsp.js} +1 -1
  23. package/dist/assets/{diagram-G4DWMVQ6-B2Xd9yJj.js → diagram-G4DWMVQ6-DVnnKNaz.js} +1 -1
  24. package/dist/assets/{diagram-MMDJMWI5-BcJABwZb.js → diagram-MMDJMWI5-iB_Pzv_O.js} +1 -1
  25. package/dist/assets/{diagram-TYMM5635-ByagqgDJ.js → diagram-TYMM5635-CJ1VtRnc.js} +1 -1
  26. package/dist/assets/{erDiagram-SMLLAGMA-zfdClUWU.js → erDiagram-SMLLAGMA-SWAf-S26.js} +1 -1
  27. package/dist/assets/{flowDiagram-DWJPFMVM-Cign1ovE.js → flowDiagram-DWJPFMVM-bjSm1F6q.js} +1 -1
  28. package/dist/assets/{ganttDiagram-T4ZO3ILL-zHFblbgr.js → ganttDiagram-T4ZO3ILL-B3eioyUQ.js} +1 -1
  29. package/dist/assets/{gitGraphDiagram-UUTBAWPF-DgUNvxqj.js → gitGraphDiagram-UUTBAWPF-DGaIKwEh.js} +1 -1
  30. package/dist/assets/{graph-CT_N4MvP.js → graph-zC0IkLW4.js} +1 -1
  31. package/dist/assets/{highlighted-body-OFNGDK62-CbTQmRda.js → highlighted-body-OFNGDK62-CkE4PgdB.js} +1 -1
  32. package/dist/assets/{index-C5AvWGUU.js → index-9mF0_S-1.js} +12 -7
  33. package/dist/assets/{index-DaFEDFsq.css → index-B9yC-RFq.css} +1 -1
  34. package/dist/assets/{infoDiagram-42DDH7IO-B1j6wnrX.js → infoDiagram-42DDH7IO-z7BfWhD6.js} +1 -1
  35. package/dist/assets/{ishikawaDiagram-UXIWVN3A-CmTERA2Q.js → ishikawaDiagram-UXIWVN3A-DgkoM8pX.js} +1 -1
  36. package/dist/assets/{journeyDiagram-VCZTEJTY-lXMvtopT.js → journeyDiagram-VCZTEJTY-7szsjnaK.js} +1 -1
  37. package/dist/assets/{kanban-definition-6JOO6SKY-D2nd3IRf.js → kanban-definition-6JOO6SKY-CN_iYP62.js} +1 -1
  38. package/dist/assets/{layout-Dwdg17w2.js → layout-B1_IEbhE.js} +1 -1
  39. package/dist/assets/{linear-BGLXP-7J.js → linear-DgZKeCD_.js} +1 -1
  40. package/dist/assets/{min-CWmMAm2D.js → min-BGmTIgk7.js} +1 -1
  41. package/dist/assets/{mindmap-definition-QFDTVHPH-Bc_KwUJk.js → mindmap-definition-QFDTVHPH-CaZaCUVQ.js} +1 -1
  42. package/dist/assets/{pieDiagram-DEJITSTG-Dk4TEXCU.js → pieDiagram-DEJITSTG-Bai_9_pu.js} +1 -1
  43. package/dist/assets/{quadrantDiagram-34T5L4WZ-DjpGwBeJ.js → quadrantDiagram-34T5L4WZ-CgKE3-Ag.js} +1 -1
  44. package/dist/assets/{requirementDiagram-MS252O5E-D-KTxT1S.js → requirementDiagram-MS252O5E-CiP3d8R4.js} +1 -1
  45. package/dist/assets/{sankeyDiagram-XADWPNL6-CAAThfhf.js → sankeyDiagram-XADWPNL6-RIeASvdJ.js} +1 -1
  46. package/dist/assets/{sequenceDiagram-FGHM5R23-EhYXipit.js → sequenceDiagram-FGHM5R23-Buf7D5PQ.js} +1 -1
  47. package/dist/assets/{stateDiagram-FHFEXIEX-DlwRa19l.js → stateDiagram-FHFEXIEX-5uYn-_xo.js} +1 -1
  48. package/dist/assets/stateDiagram-v2-QKLJ7IA2-CiNPYrtS.js +1 -0
  49. package/dist/assets/{timeline-definition-GMOUNBTQ-CnNt36mp.js → timeline-definition-GMOUNBTQ-fcTegT1X.js} +1 -1
  50. package/dist/assets/{value-BUuNnoEe.js → value-CCp47p1v.js} +1 -1
  51. package/dist/assets/{vennDiagram-DHZGUBPP-CONWdidS.js → vennDiagram-DHZGUBPP-BUY_I73j.js} +1 -1
  52. package/dist/assets/{wardley-RL74JXVD-Dx3T9_uF.js → wardley-RL74JXVD-CfGeUcvr.js} +1 -1
  53. package/dist/assets/{wardleyDiagram-NUSXRM2D-Brxifhti.js → wardleyDiagram-NUSXRM2D-0A6kvF9i.js} +1 -1
  54. package/dist/assets/{xychartDiagram-5P7HB3ND-DkX9QW6S.js → xychartDiagram-5P7HB3ND-C2L50m3n.js} +1 -1
  55. package/dist/index.html +2 -2
  56. package/package.json +2 -2
  57. package/dist/assets/channel-BMnRcRpv.js +0 -1
  58. package/dist/assets/classDiagram-6PBFFD2Q-BpMdbRYm.js +0 -1
  59. package/dist/assets/classDiagram-v2-HSJHXN6E-BpMdbRYm.js +0 -1
  60. package/dist/assets/clone-Bfx4_ecn.js +0 -1
  61. package/dist/assets/stateDiagram-v2-QKLJ7IA2-DWOlnZT2.js +0 -1
@@ -1 +1 @@
1
- import{aH as N,j as e,aI as $,r as f,aJ as B,aK as W,aL as l,aM as U,aN as C,aO as H,aP as L}from"./index-C5AvWGUU.js";import V from"./FlowView-rMLtzFZK.js";import"./value-BUuNnoEe.js";function _({projectId:t,theme:s}){const n=$(),a=encodeURIComponent(t),d=N(`/projects/${a}/export/json`)??"#",i=N(`/projects/${a}/export/ink`)??"#",o=N(`/projects/${a}/export/html`)??"#";return e.jsxs("div",{className:"border border-border bg-card rounded p-3","data-testid":"export-bar",children:[e.jsx("div",{className:`text-sm font-medium mb-2 ${n.muted}`,children:"导出 / 交付"}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx("a",{href:d,download:!0,"data-testid":"export-json",className:`inline-flex items-center rounded px-3 py-1.5 text-sm font-medium no-underline ${n.btnSecondary}`,children:"导出 JSON"}),e.jsx("a",{href:i,download:!0,"data-testid":"export-ink",className:`inline-flex items-center rounded px-3 py-1.5 text-sm font-medium no-underline ${n.btnSecondary}`,children:"导出 Ink"}),e.jsx("a",{href:o,download:!0,"data-testid":"export-html",className:`inline-flex items-center rounded px-3 py-1.5 text-sm font-medium no-underline ${n.btnSecondary}`,children:"导出可玩网页(HTML)"})]})]})}const D=["world","scale","structure","workshop","validate"];function z(t){var x,b;const s=!!((b=(x=t.worldAnchor)==null?void 0:x.storyCore)!=null&&b.trim()),n=t.characters.length>0,a=s&&n?"done":s?"partial":"empty",d="empty",i=t.nodes.some(c=>c.type==="start"),o=t.nodes.some(c=>c.type==="ending"),p=t.nodes.some(c=>c.choices.length>0),y=i&&o&&p?"done":t.nodes.length>0?"partial":"empty",h=t.nodes.filter(c=>c.type!=="ending"),u=h.filter(c=>{var g,v;return!!((g=c.sceneDesc)!=null&&g.trim())||(((v=c.dialogue)==null?void 0:v.length)??0)>0}),j=h.length===0?"empty":u.length===h.length?"done":u.length>0?"partial":"empty",m=t.nodes.length>0&&t.endings.length>0?"partial":"empty";return{world:a,scale:d,structure:y,workshop:j,validate:m}}function F(t,s,n){const a=z(t),d=i=>{const o=s==null?void 0:s[i];return typeof o=="number"&&o<n&&a[i]!=="empty"};return{world:d("world"),scale:d("scale"),structure:d("structure"),workshop:d("workshop"),validate:d("validate")}}const k={world:{zh:"世界",en:"World",vi:"Thế giới"},scale:{zh:"规模",en:"Scale",vi:"Quy mô"},structure:{zh:"结构",en:"Structure",vi:"Cấu trúc"},workshop:{zh:"逐节点",en:"Nodes",vi:"Từng nút"},validate:{zh:"校验",en:"Validate",vi:"Kiểm tra"}},I={world:"chat",scale:"scale",structure:"flow",workshop:"tree",validate:"validate"},G={world:[{key:"chat",zh:"对话",en:"Chat",vi:"Trò chuyện"},{key:"anchor",zh:"世界锚点",en:"World anchor",vi:"Neo thế giới"}],scale:[],structure:[{key:"flow",zh:"流程图",en:"Flow",vi:"Sơ đồ luồng"},{key:"tree",zh:"树",en:"Tree",vi:"Cây"}],workshop:[{key:"tree",zh:"树",en:"Tree",vi:"Cây"},{key:"chat",zh:"对话",en:"Chat",vi:"Trò chuyện"}],validate:[]},O={world:"empty",scale:"empty",structure:"empty",workshop:"empty",validate:"empty"},R={world:!1,scale:!1,structure:!1,workshop:!1,validate:!1};function J({graph:t,c:s}){if(!(t!=null&&t.worldAnchor))return e.jsx("div",{className:`p-6 text-sm ${s.muted}`,children:l("暂无世界锚点。请先切换到「对话」,请 AI 帮您设定世界观和角色。","No world anchor yet. Switch to “Chat” and ask the AI to set up the world and characters.","Chưa có neo thế giới. Hãy chuyển sang “Trò chuyện” và nhờ AI thiết lập thế giới và nhân vật.")});const{worldAnchor:n}=t;return e.jsxs("div",{className:"p-4 space-y-3 text-sm","data-testid":"film-world",children:[e.jsxs("div",{children:[e.jsx("div",{className:`text-xs font-medium mb-1 ${s.muted}`,children:l("故事核心","Story core","Cốt lõi câu chuyện")}),e.jsx("div",{className:"text-foreground",children:n.storyCore||"—"})]}),e.jsxs("div",{className:"flex gap-6",children:[e.jsxs("div",{children:[e.jsx("div",{className:`text-xs font-medium mb-1 ${s.muted}`,children:l("主题","Theme","Chủ đề")}),e.jsx("div",{children:n.theme||"—"})]}),e.jsxs("div",{children:[e.jsx("div",{className:`text-xs font-medium mb-1 ${s.muted}`,children:l("题材","Genre","Thể loại")}),e.jsx("div",{children:n.genre||"—"})]}),n.durationMinutes>0&&e.jsxs("div",{children:[e.jsx("div",{className:`text-xs font-medium mb-1 ${s.muted}`,children:l("时长","Duration","Thời lượng")}),e.jsxs("div",{children:[n.durationMinutes," ",l("分钟","min","phút")]})]})]}),n.worldRules&&e.jsxs("div",{children:[e.jsx("div",{className:`text-xs font-medium mb-1 ${s.muted}`,children:l("世界规则","World rules","Quy tắc thế giới")}),e.jsx("div",{className:"whitespace-pre-wrap",children:n.worldRules})]}),t.characters.length>0&&e.jsxs("div",{children:[e.jsx("div",{className:`text-xs font-medium mb-2 ${s.muted}`,children:l("主要角色","Main characters","Nhân vật chính")}),e.jsx("ul",{className:"space-y-2",children:t.characters.map(a=>e.jsxs("li",{className:"flex items-start gap-2",children:[e.jsx("span",{className:`shrink-0 text-xs px-1.5 py-0.5 rounded border border-border ${s.muted}`,children:a.role}),e.jsxs("span",{children:[e.jsx("span",{className:"font-medium text-foreground",children:a.name}),a.motivation&&e.jsx("span",{className:` ml-2 ${s.muted}`,children:a.motivation})]})]},a.id))})]})]})}function K({c:t}){return e.jsx("div",{className:`p-6 text-sm ${t.muted}`,"data-testid":"film-scale-placeholder",children:l("规模配置(P2 功能)— 在此设定节点数量目标、分支深度、多结局数量等参数。","Scale settings (P2) — set node count targets, branch depth, number of endings, and other parameters here.","Cấu hình quy mô (tính năng P2) — đặt số nút mục tiêu, độ sâu nhánh, số kết thúc và các tham số khác tại đây.")})}function X({projectId:t,nav:s,theme:n,t:a,sse:d}){const i=$(),[o,p]=f.useState("world"),[y,h]=f.useState({...I}),[u,j]=f.useState(!1),{data:m,refetch:x}=B(`/projects/${t}/story-graph`);f.useEffect(()=>{x()},[o,x]);const b=f.useCallback(r=>{if(r.event!=="agent:complete")return;const w=r.data;(w==null?void 0:w.activeBookId)===t&&x()},[t,x]);W(d.messages,b);const c=f.useMemo(()=>m?z(m):O,[m]),g=f.useMemo(()=>m?F(m,void 0,0):R,[m]),v=y[o],S=G[o];function A(r){j(!1),p(r)}function E(r){h({...y,[o]:r})}function T(){j(r=>!r)}return e.jsxs("div",{"data-testid":"film-wizard",className:"flex flex-col h-screen bg-background text-foreground",children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-border px-4 py-2 shrink-0 gap-3",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("button",{type:"button","data-testid":"wizard-exit",onClick:s.toDashboard,className:i.link,children:["← ",l("互动影游","Interactive films","Phim tương tác")]}),e.jsx("div",{className:"flex items-center gap-1 flex-wrap",children:D.map((r,w)=>{const M=o===r&&!u,P=c[r];return e.jsxs("button",{type:"button","data-testid":`wizard-step-${r}`,onClick:()=>A(r),className:["relative flex items-center gap-1.5 rounded-md px-3 py-1.5 text-sm font-medium transition-all",M?i.btnPrimary:i.btnSecondary].join(" "),children:[g[r]&&e.jsx("span",{className:"absolute -top-1 -right-1 h-2 w-2 rounded-full bg-destructive"}),e.jsx("span",{className:["flex h-5 w-5 shrink-0 items-center justify-center rounded-full border text-[11px] font-semibold tabular-nums",P==="done"?"border-current bg-current/25":P==="partial"?"border-current/80":"border-current/40 opacity-70"].join(" "),children:w+1}),e.jsx("span",{children:l(k[r].zh,k[r].en,k[r].vi)})]},r)})})]}),e.jsx("button",{type:"button","data-testid":"wizard-preview",onClick:T,className:["shrink-0 flex items-center gap-1 rounded-md px-3 py-1.5 text-sm font-medium",u?i.btnPrimary:i.btnSecondary].join(" "),children:l("试玩","Play","Chơi thử")})]}),!u&&S.length>0&&e.jsx("div",{className:"flex items-center gap-1 border-b border-border px-4 py-1.5 shrink-0",children:S.map(r=>e.jsx("button",{type:"button","data-testid":`wizard-subview-${r.key}`,onClick:()=>E(r.key),className:["rounded px-3 py-1 text-sm font-medium transition-colors",v===r.key?i.btnPrimary:i.btnSecondary].join(" "),children:l(r.zh,r.en,r.vi)},r.key))}),e.jsx("div",{className:"flex-1 min-h-0 overflow-auto",children:e.jsx(Q,{showPreview:u,phase:o,subView:v,projectId:t,nav:s,theme:n,t:a,sse:d,graph:m,c:i})})]})}function Q({showPreview:t,phase:s,subView:n,projectId:a,nav:d,theme:i,t:o,sse:p,graph:y,c:h}){const u="mx-auto w-full max-w-4xl px-6 py-6";return t?e.jsx("div",{className:u,children:e.jsx(U,{projectId:a,nav:d,theme:i,t:o,embedded:!0})}):s==="world"&&n==="chat"?e.jsx("div",{className:"h-full relative overflow-hidden",children:e.jsx(C,{activeBookId:a,mode:"interactive-film-authoring",nav:d,theme:i,t:o,sse:p})}):s==="world"&&n==="anchor"?e.jsx(J,{graph:y,c:h}):s==="scale"?e.jsx(K,{c:h}):s==="structure"&&n==="flow"?e.jsx(V,{projectId:a,nav:d,theme:i,t:o,embedded:!0}):s==="structure"&&n==="tree"||s==="workshop"&&n==="tree"?e.jsx("div",{className:u,children:e.jsx(H,{projectId:a,nav:d,theme:i,t:o,embedded:!0})}):s==="workshop"&&n==="chat"?e.jsx("div",{className:"h-full relative overflow-hidden",children:e.jsx(C,{activeBookId:a,mode:"interactive-film-authoring",nav:d,theme:i,t:o,sse:p})}):s==="validate"?e.jsxs("div",{className:`${u} space-y-4`,children:[e.jsx(L,{projectId:a,theme:i}),e.jsx(_,{projectId:a,theme:i})]}):null}export{X as default};
1
+ import{aH as N,j as e,aI as $,r as f,aJ as B,aK as W,aL as l,aM as U,aN as C,aO as H,aP as L}from"./index-9mF0_S-1.js";import V from"./FlowView-C6n6r8pJ.js";import"./value-CCp47p1v.js";function _({projectId:t,theme:s}){const n=$(),a=encodeURIComponent(t),d=N(`/projects/${a}/export/json`)??"#",i=N(`/projects/${a}/export/ink`)??"#",o=N(`/projects/${a}/export/html`)??"#";return e.jsxs("div",{className:"border border-border bg-card rounded p-3","data-testid":"export-bar",children:[e.jsx("div",{className:`text-sm font-medium mb-2 ${n.muted}`,children:"导出 / 交付"}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx("a",{href:d,download:!0,"data-testid":"export-json",className:`inline-flex items-center rounded px-3 py-1.5 text-sm font-medium no-underline ${n.btnSecondary}`,children:"导出 JSON"}),e.jsx("a",{href:i,download:!0,"data-testid":"export-ink",className:`inline-flex items-center rounded px-3 py-1.5 text-sm font-medium no-underline ${n.btnSecondary}`,children:"导出 Ink"}),e.jsx("a",{href:o,download:!0,"data-testid":"export-html",className:`inline-flex items-center rounded px-3 py-1.5 text-sm font-medium no-underline ${n.btnSecondary}`,children:"导出可玩网页(HTML)"})]})]})}const D=["world","scale","structure","workshop","validate"];function z(t){var x,b;const s=!!((b=(x=t.worldAnchor)==null?void 0:x.storyCore)!=null&&b.trim()),n=t.characters.length>0,a=s&&n?"done":s?"partial":"empty",d="empty",i=t.nodes.some(c=>c.type==="start"),o=t.nodes.some(c=>c.type==="ending"),p=t.nodes.some(c=>c.choices.length>0),y=i&&o&&p?"done":t.nodes.length>0?"partial":"empty",h=t.nodes.filter(c=>c.type!=="ending"),u=h.filter(c=>{var g,v;return!!((g=c.sceneDesc)!=null&&g.trim())||(((v=c.dialogue)==null?void 0:v.length)??0)>0}),j=h.length===0?"empty":u.length===h.length?"done":u.length>0?"partial":"empty",m=t.nodes.length>0&&t.endings.length>0?"partial":"empty";return{world:a,scale:d,structure:y,workshop:j,validate:m}}function F(t,s,n){const a=z(t),d=i=>{const o=s==null?void 0:s[i];return typeof o=="number"&&o<n&&a[i]!=="empty"};return{world:d("world"),scale:d("scale"),structure:d("structure"),workshop:d("workshop"),validate:d("validate")}}const k={world:{zh:"世界",en:"World",vi:"Thế giới"},scale:{zh:"规模",en:"Scale",vi:"Quy mô"},structure:{zh:"结构",en:"Structure",vi:"Cấu trúc"},workshop:{zh:"逐节点",en:"Nodes",vi:"Từng nút"},validate:{zh:"校验",en:"Validate",vi:"Kiểm tra"}},I={world:"chat",scale:"scale",structure:"flow",workshop:"tree",validate:"validate"},G={world:[{key:"chat",zh:"对话",en:"Chat",vi:"Trò chuyện"},{key:"anchor",zh:"世界锚点",en:"World anchor",vi:"Neo thế giới"}],scale:[],structure:[{key:"flow",zh:"流程图",en:"Flow",vi:"Sơ đồ luồng"},{key:"tree",zh:"树",en:"Tree",vi:"Cây"}],workshop:[{key:"tree",zh:"树",en:"Tree",vi:"Cây"},{key:"chat",zh:"对话",en:"Chat",vi:"Trò chuyện"}],validate:[]},O={world:"empty",scale:"empty",structure:"empty",workshop:"empty",validate:"empty"},R={world:!1,scale:!1,structure:!1,workshop:!1,validate:!1};function J({graph:t,c:s}){if(!(t!=null&&t.worldAnchor))return e.jsx("div",{className:`p-6 text-sm ${s.muted}`,children:l("暂无世界锚点。请先切换到「对话」,请 AI 帮您设定世界观和角色。","No world anchor yet. Switch to “Chat” and ask the AI to set up the world and characters.","Chưa có neo thế giới. Hãy chuyển sang “Trò chuyện” và nhờ AI thiết lập thế giới và nhân vật.")});const{worldAnchor:n}=t;return e.jsxs("div",{className:"p-4 space-y-3 text-sm","data-testid":"film-world",children:[e.jsxs("div",{children:[e.jsx("div",{className:`text-xs font-medium mb-1 ${s.muted}`,children:l("故事核心","Story core","Cốt lõi câu chuyện")}),e.jsx("div",{className:"text-foreground",children:n.storyCore||"—"})]}),e.jsxs("div",{className:"flex gap-6",children:[e.jsxs("div",{children:[e.jsx("div",{className:`text-xs font-medium mb-1 ${s.muted}`,children:l("主题","Theme","Chủ đề")}),e.jsx("div",{children:n.theme||"—"})]}),e.jsxs("div",{children:[e.jsx("div",{className:`text-xs font-medium mb-1 ${s.muted}`,children:l("题材","Genre","Thể loại")}),e.jsx("div",{children:n.genre||"—"})]}),n.durationMinutes>0&&e.jsxs("div",{children:[e.jsx("div",{className:`text-xs font-medium mb-1 ${s.muted}`,children:l("时长","Duration","Thời lượng")}),e.jsxs("div",{children:[n.durationMinutes," ",l("分钟","min","phút")]})]})]}),n.worldRules&&e.jsxs("div",{children:[e.jsx("div",{className:`text-xs font-medium mb-1 ${s.muted}`,children:l("世界规则","World rules","Quy tắc thế giới")}),e.jsx("div",{className:"whitespace-pre-wrap",children:n.worldRules})]}),t.characters.length>0&&e.jsxs("div",{children:[e.jsx("div",{className:`text-xs font-medium mb-2 ${s.muted}`,children:l("主要角色","Main characters","Nhân vật chính")}),e.jsx("ul",{className:"space-y-2",children:t.characters.map(a=>e.jsxs("li",{className:"flex items-start gap-2",children:[e.jsx("span",{className:`shrink-0 text-xs px-1.5 py-0.5 rounded border border-border ${s.muted}`,children:a.role}),e.jsxs("span",{children:[e.jsx("span",{className:"font-medium text-foreground",children:a.name}),a.motivation&&e.jsx("span",{className:` ml-2 ${s.muted}`,children:a.motivation})]})]},a.id))})]})]})}function K({c:t}){return e.jsx("div",{className:`p-6 text-sm ${t.muted}`,"data-testid":"film-scale-placeholder",children:l("规模配置(P2 功能)— 在此设定节点数量目标、分支深度、多结局数量等参数。","Scale settings (P2) — set node count targets, branch depth, number of endings, and other parameters here.","Cấu hình quy mô (tính năng P2) — đặt số nút mục tiêu, độ sâu nhánh, số kết thúc và các tham số khác tại đây.")})}function X({projectId:t,nav:s,theme:n,t:a,sse:d}){const i=$(),[o,p]=f.useState("world"),[y,h]=f.useState({...I}),[u,j]=f.useState(!1),{data:m,refetch:x}=B(`/projects/${t}/story-graph`);f.useEffect(()=>{x()},[o,x]);const b=f.useCallback(r=>{if(r.event!=="agent:complete")return;const w=r.data;(w==null?void 0:w.activeBookId)===t&&x()},[t,x]);W(d.messages,b);const c=f.useMemo(()=>m?z(m):O,[m]),g=f.useMemo(()=>m?F(m,void 0,0):R,[m]),v=y[o],S=G[o];function A(r){j(!1),p(r)}function E(r){h({...y,[o]:r})}function T(){j(r=>!r)}return e.jsxs("div",{"data-testid":"film-wizard",className:"flex flex-col h-screen bg-background text-foreground",children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-border px-4 py-2 shrink-0 gap-3",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("button",{type:"button","data-testid":"wizard-exit",onClick:s.toDashboard,className:i.link,children:["← ",l("互动影游","Interactive films","Phim tương tác")]}),e.jsx("div",{className:"flex items-center gap-1 flex-wrap",children:D.map((r,w)=>{const M=o===r&&!u,P=c[r];return e.jsxs("button",{type:"button","data-testid":`wizard-step-${r}`,onClick:()=>A(r),className:["relative flex items-center gap-1.5 rounded-md px-3 py-1.5 text-sm font-medium transition-all",M?i.btnPrimary:i.btnSecondary].join(" "),children:[g[r]&&e.jsx("span",{className:"absolute -top-1 -right-1 h-2 w-2 rounded-full bg-destructive"}),e.jsx("span",{className:["flex h-5 w-5 shrink-0 items-center justify-center rounded-full border text-[11px] font-semibold tabular-nums",P==="done"?"border-current bg-current/25":P==="partial"?"border-current/80":"border-current/40 opacity-70"].join(" "),children:w+1}),e.jsx("span",{children:l(k[r].zh,k[r].en,k[r].vi)})]},r)})})]}),e.jsx("button",{type:"button","data-testid":"wizard-preview",onClick:T,className:["shrink-0 flex items-center gap-1 rounded-md px-3 py-1.5 text-sm font-medium",u?i.btnPrimary:i.btnSecondary].join(" "),children:l("试玩","Play","Chơi thử")})]}),!u&&S.length>0&&e.jsx("div",{className:"flex items-center gap-1 border-b border-border px-4 py-1.5 shrink-0",children:S.map(r=>e.jsx("button",{type:"button","data-testid":`wizard-subview-${r.key}`,onClick:()=>E(r.key),className:["rounded px-3 py-1 text-sm font-medium transition-colors",v===r.key?i.btnPrimary:i.btnSecondary].join(" "),children:l(r.zh,r.en,r.vi)},r.key))}),e.jsx("div",{className:"flex-1 min-h-0 overflow-auto",children:e.jsx(Q,{showPreview:u,phase:o,subView:v,projectId:t,nav:s,theme:n,t:a,sse:d,graph:m,c:i})})]})}function Q({showPreview:t,phase:s,subView:n,projectId:a,nav:d,theme:i,t:o,sse:p,graph:y,c:h}){const u="mx-auto w-full max-w-4xl px-6 py-6";return t?e.jsx("div",{className:u,children:e.jsx(U,{projectId:a,nav:d,theme:i,t:o,embedded:!0})}):s==="world"&&n==="chat"?e.jsx("div",{className:"h-full relative overflow-hidden",children:e.jsx(C,{activeBookId:a,mode:"interactive-film-authoring",nav:d,theme:i,t:o,sse:p})}):s==="world"&&n==="anchor"?e.jsx(J,{graph:y,c:h}):s==="scale"?e.jsx(K,{c:h}):s==="structure"&&n==="flow"?e.jsx(V,{projectId:a,nav:d,theme:i,t:o,embedded:!0}):s==="structure"&&n==="tree"||s==="workshop"&&n==="tree"?e.jsx("div",{className:u,children:e.jsx(H,{projectId:a,nav:d,theme:i,t:o,embedded:!0})}):s==="workshop"&&n==="chat"?e.jsx("div",{className:"h-full relative overflow-hidden",children:e.jsx(C,{activeBookId:a,mode:"interactive-film-authoring",nav:d,theme:i,t:o,sse:p})}):s==="validate"?e.jsxs("div",{className:`${u} space-y-4`,children:[e.jsx(L,{projectId:a,theme:i}),e.jsx(_,{projectId:a,theme:i})]}):null}export{X as default};
@@ -1,4 +1,4 @@
1
- import{d as ae,bq as Zn,br as Rt,bs as Et,bt as St,bu as xr,bv as wr,bw as br,r as z,j as C,aJ as vr,aL as le,aI as Er,bx as Sr}from"./index-C5AvWGUU.js";import{i as Nt}from"./value-BUuNnoEe.js";function Nr(e){let t;for(;t=e.sourceEvent;)e=t;return e}function de(e,t){if(e=Nr(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 s=t.getBoundingClientRect();return[e.clientX-s.left-t.clientLeft,e.clientY-s.top-t.clientTop]}}return[e.pageX,e.pageY]}const Mr={passive:!1},Xe={capture:!0,passive:!1};function Mt(e){e.stopImmediatePropagation()}function Le(e){e.preventDefault(),e.stopImmediatePropagation()}function Un(e){var t=e.document.documentElement,n=ae(e).on("dragstart.drag",Le,Xe);"onselectstart"in t?n.on("selectstart.drag",Le,Xe):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function Qn(e,t){var n=e.document.documentElement,o=ae(e).on("dragstart.drag",null);t&&(o.on("click.drag",Le,Xe),setTimeout(function(){o.on("click.drag",null)},0)),"onselectstart"in n?o.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}const nt=e=>()=>e;function At(e,{sourceEvent:t,subject:n,target:o,identifier:s,active:r,x:i,y:a,dx:d,dy:u,dispatch:h}){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:s,enumerable:!0,configurable:!0},active:{value:r,enumerable:!0,configurable:!0},x:{value:i,enumerable:!0,configurable:!0},y:{value:a,enumerable:!0,configurable:!0},dx:{value:d,enumerable:!0,configurable:!0},dy:{value:u,enumerable:!0,configurable:!0},_:{value:h}})}At.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function Cr(e){return!e.ctrlKey&&!e.button}function Ir(){return this.parentNode}function kr(e,t){return t??{x:e.x,y:e.y}}function Pr(){return navigator.maxTouchPoints||"ontouchstart"in this}function Jn(){var e=Cr,t=Ir,n=kr,o=Pr,s={},r=Zn("start","drag","end"),i=0,a,d,u,h,c=0;function l(x){x.on("mousedown.drag",m).filter(o).on("touchstart.drag",y).on("touchmove.drag",g,Mr).on("touchend.drag touchcancel.drag",v).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function m(x,k){if(!(h||!e.call(this,x,k))){var S=f(this,t.call(this,x,k),x,k,"mouse");S&&(ae(x.view).on("mousemove.drag",p,Xe).on("mouseup.drag",b,Xe),Un(x.view),Mt(x),u=!1,a=x.clientX,d=x.clientY,S("start",x))}}function p(x){if(Le(x),!u){var k=x.clientX-a,S=x.clientY-d;u=k*k+S*S>c}s.mouse("drag",x)}function b(x){ae(x.view).on("mousemove.drag mouseup.drag",null),Qn(x.view,u),Le(x),s.mouse("end",x)}function y(x,k){if(e.call(this,x,k)){var S=x.changedTouches,_=t.call(this,x,k),A=S.length,T,V;for(T=0;T<A;++T)(V=f(this,_,x,k,S[T].identifier,S[T]))&&(Mt(x),V("start",x,S[T]))}}function g(x){var k=x.changedTouches,S=k.length,_,A;for(_=0;_<S;++_)(A=s[k[_].identifier])&&(Le(x),A("drag",x,k[_]))}function v(x){var k=x.changedTouches,S=k.length,_,A;for(h&&clearTimeout(h),h=setTimeout(function(){h=null},500),_=0;_<S;++_)(A=s[k[_].identifier])&&(Mt(x),A("end",x,k[_]))}function f(x,k,S,_,A,T){var V=r.copy(),I=de(T||S,k),D,B,w;if((w=n.call(x,new At("beforestart",{sourceEvent:S,target:l,identifier:A,active:i,x:I[0],y:I[1],dx:0,dy:0,dispatch:V}),_))!=null)return D=w.x-I[0]||0,B=w.y-I[1]||0,function $(N,E,P){var M=I,L;switch(N){case"start":s[A]=$,L=i++;break;case"end":delete s[A],--i;case"drag":I=de(P||E,k),L=i;break}V.call(N,x,new At(N,{sourceEvent:E,subject:w,target:l,identifier:A,active:L,x:I[0]+D,y:I[1]+B,dx:I[0]-M[0],dy:I[1]-M[1],dispatch:V}),_)}}return l.filter=function(x){return arguments.length?(e=typeof x=="function"?x:nt(!!x),l):e},l.container=function(x){return arguments.length?(t=typeof x=="function"?x:nt(x),l):t},l.subject=function(x){return arguments.length?(n=typeof x=="function"?x:nt(x),l):n},l.touchable=function(x){return arguments.length?(o=typeof x=="function"?x:nt(!!x),l):o},l.on=function(){var x=r.on.apply(r,arguments);return x===r?l:x},l.clickDistance=function(x){return arguments.length?(c=(x=+x)*x,l):Math.sqrt(c)},l}var $r=1e-12;function rn(e){return((e=Math.exp(e))+1/e)/2}function _r(e){return((e=Math.exp(e))-1/e)/2}function Ar(e){return((e=Math.exp(2*e))-1)/(e+1)}const ct=(function e(t,n,o){function s(r,i){var a=r[0],d=r[1],u=r[2],h=i[0],c=i[1],l=i[2],m=h-a,p=c-d,b=m*m+p*p,y,g;if(b<$r)g=Math.log(l/u)/t,y=function(_){return[a+_*m,d+_*p,u*Math.exp(t*_*g)]};else{var v=Math.sqrt(b),f=(l*l-u*u+o*b)/(2*u*n*v),x=(l*l-u*u-o*b)/(2*l*n*v),k=Math.log(Math.sqrt(f*f+1)-f),S=Math.log(Math.sqrt(x*x+1)-x);g=(S-k)/t,y=function(_){var A=_*g,T=rn(k),V=u/(n*v)*(T*Ar(t*A+k)-_r(k));return[a+V*m,d+V*p,u*T/rn(t*A+k)]}}return y.duration=g*1e3*t/Math.SQRT2,y}return s.rho=function(r){var i=Math.max(.001,+r),a=i*i,d=a*a;return e(i,a,d)},s})(Math.SQRT2,2,4),ot=e=>()=>e;function zr(e,{sourceEvent:t,target:n,transform:o,dispatch:s}){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:s}})}function Ct(e){e.stopImmediatePropagation()}function Oe(e){e.preventDefault(),e.stopImmediatePropagation()}function Tr(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function Dr(){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 an(){return this.__zoom||Rt}function Lr(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function jr(){return navigator.maxTouchPoints||"ontouchstart"in this}function Hr(e,t,n){var o=e.invertX(t[0][0])-n[0][0],s=e.invertX(t[1][0])-n[1][0],r=e.invertY(t[0][1])-n[0][1],i=e.invertY(t[1][1])-n[1][1];return e.translate(s>o?(o+s)/2:Math.min(0,o)||Math.max(0,s),i>r?(r+i)/2:Math.min(0,r)||Math.max(0,i))}function eo(){var e=Tr,t=Dr,n=Hr,o=Lr,s=jr,r=[0,1/0],i=[[-1/0,-1/0],[1/0,1/0]],a=250,d=ct,u=Zn("start","zoom","end"),h,c,l,m=500,p=150,b=0,y=10;function g(w){w.property("__zoom",an).on("wheel.zoom",A,{passive:!1}).on("mousedown.zoom",T).on("dblclick.zoom",V).filter(s).on("touchstart.zoom",I).on("touchmove.zoom",D).on("touchend.zoom touchcancel.zoom",B).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}g.transform=function(w,$,N,E){var P=w.selection?w.selection():w;P.property("__zoom",an),w!==P?k(w,$,N,E):P.interrupt().each(function(){S(this,arguments).event(E).start().zoom(null,typeof $=="function"?$.apply(this,arguments):$).end()})},g.scaleBy=function(w,$,N,E){g.scaleTo(w,function(){var P=this.__zoom.k,M=typeof $=="function"?$.apply(this,arguments):$;return P*M},N,E)},g.scaleTo=function(w,$,N,E){g.transform(w,function(){var P=t.apply(this,arguments),M=this.__zoom,L=N==null?x(P):typeof N=="function"?N.apply(this,arguments):N,j=M.invert(L),H=typeof $=="function"?$.apply(this,arguments):$;return n(f(v(M,H),L,j),P,i)},N,E)},g.translateBy=function(w,$,N,E){g.transform(w,function(){return n(this.__zoom.translate(typeof $=="function"?$.apply(this,arguments):$,typeof N=="function"?N.apply(this,arguments):N),t.apply(this,arguments),i)},null,E)},g.translateTo=function(w,$,N,E,P){g.transform(w,function(){var M=t.apply(this,arguments),L=this.__zoom,j=E==null?x(M):typeof E=="function"?E.apply(this,arguments):E;return n(Rt.translate(j[0],j[1]).scale(L.k).translate(typeof $=="function"?-$.apply(this,arguments):-$,typeof N=="function"?-N.apply(this,arguments):-N),M,i)},E,P)};function v(w,$){return $=Math.max(r[0],Math.min(r[1],$)),$===w.k?w:new Et($,w.x,w.y)}function f(w,$,N){var E=$[0]-N[0]*w.k,P=$[1]-N[1]*w.k;return E===w.x&&P===w.y?w:new Et(w.k,E,P)}function x(w){return[(+w[0][0]+ +w[1][0])/2,(+w[0][1]+ +w[1][1])/2]}function k(w,$,N,E){w.on("start.zoom",function(){S(this,arguments).event(E).start()}).on("interrupt.zoom end.zoom",function(){S(this,arguments).event(E).end()}).tween("zoom",function(){var P=this,M=arguments,L=S(P,M).event(E),j=t.apply(P,M),H=N==null?x(j):typeof N=="function"?N.apply(P,M):N,O=Math.max(j[1][0]-j[0][0],j[1][1]-j[0][1]),Y=P.__zoom,K=typeof $=="function"?$.apply(P,M):$,Q=d(Y.invert(H).concat(O/Y.k),K.invert(H).concat(O/K.k));return function(q){if(q===1)q=K;else{var R=Q(q),F=O/R[2];q=new Et(F,H[0]-R[0]*F,H[1]-R[1]*F)}L.zoom(null,q)}})}function S(w,$,N){return!N&&w.__zooming||new _(w,$)}function _(w,$){this.that=w,this.args=$,this.active=0,this.sourceEvent=null,this.extent=t.apply(w,$),this.taps=0}_.prototype={event:function(w){return w&&(this.sourceEvent=w),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(w,$){return this.mouse&&w!=="mouse"&&(this.mouse[1]=$.invert(this.mouse[0])),this.touch0&&w!=="touch"&&(this.touch0[1]=$.invert(this.touch0[0])),this.touch1&&w!=="touch"&&(this.touch1[1]=$.invert(this.touch1[0])),this.that.__zoom=$,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(w){var $=ae(this.that).datum();u.call(w,this.that,new zr(w,{sourceEvent:this.sourceEvent,target:g,transform:this.that.__zoom,dispatch:u}),$)}};function A(w,...$){if(!e.apply(this,arguments))return;var N=S(this,$).event(w),E=this.__zoom,P=Math.max(r[0],Math.min(r[1],E.k*Math.pow(2,o.apply(this,arguments)))),M=de(w);if(N.wheel)(N.mouse[0][0]!==M[0]||N.mouse[0][1]!==M[1])&&(N.mouse[1]=E.invert(N.mouse[0]=M)),clearTimeout(N.wheel);else{if(E.k===P)return;N.mouse=[M,E.invert(M)],St(this),N.start()}Oe(w),N.wheel=setTimeout(L,p),N.zoom("mouse",n(f(v(E,P),N.mouse[0],N.mouse[1]),N.extent,i));function L(){N.wheel=null,N.end()}}function T(w,...$){if(l||!e.apply(this,arguments))return;var N=w.currentTarget,E=S(this,$,!0).event(w),P=ae(w.view).on("mousemove.zoom",H,!0).on("mouseup.zoom",O,!0),M=de(w,N),L=w.clientX,j=w.clientY;Un(w.view),Ct(w),E.mouse=[M,this.__zoom.invert(M)],St(this),E.start();function H(Y){if(Oe(Y),!E.moved){var K=Y.clientX-L,Q=Y.clientY-j;E.moved=K*K+Q*Q>b}E.event(Y).zoom("mouse",n(f(E.that.__zoom,E.mouse[0]=de(Y,N),E.mouse[1]),E.extent,i))}function O(Y){P.on("mousemove.zoom mouseup.zoom",null),Qn(Y.view,E.moved),Oe(Y),E.event(Y).end()}}function V(w,...$){if(e.apply(this,arguments)){var N=this.__zoom,E=de(w.changedTouches?w.changedTouches[0]:w,this),P=N.invert(E),M=N.k*(w.shiftKey?.5:2),L=n(f(v(N,M),E,P),t.apply(this,$),i);Oe(w),a>0?ae(this).transition().duration(a).call(k,L,E,w):ae(this).call(g.transform,L,E,w)}}function I(w,...$){if(e.apply(this,arguments)){var N=w.touches,E=N.length,P=S(this,$,w.changedTouches.length===E).event(w),M,L,j,H;for(Ct(w),L=0;L<E;++L)j=N[L],H=de(j,this),H=[H,this.__zoom.invert(H),j.identifier],P.touch0?!P.touch1&&P.touch0[2]!==H[2]&&(P.touch1=H,P.taps=0):(P.touch0=H,M=!0,P.taps=1+!!h);h&&(h=clearTimeout(h)),M&&(P.taps<2&&(c=H[0],h=setTimeout(function(){h=null},m)),St(this),P.start())}}function D(w,...$){if(this.__zooming){var N=S(this,$).event(w),E=w.changedTouches,P=E.length,M,L,j,H;for(Oe(w),M=0;M<P;++M)L=E[M],j=de(L,this),N.touch0&&N.touch0[2]===L.identifier?N.touch0[0]=j:N.touch1&&N.touch1[2]===L.identifier&&(N.touch1[0]=j);if(L=N.that.__zoom,N.touch1){var O=N.touch0[0],Y=N.touch0[1],K=N.touch1[0],Q=N.touch1[1],q=(q=K[0]-O[0])*q+(q=K[1]-O[1])*q,R=(R=Q[0]-Y[0])*R+(R=Q[1]-Y[1])*R;L=v(L,Math.sqrt(q/R)),j=[(O[0]+K[0])/2,(O[1]+K[1])/2],H=[(Y[0]+Q[0])/2,(Y[1]+Q[1])/2]}else if(N.touch0)j=N.touch0[0],H=N.touch0[1];else return;N.zoom("touch",n(f(L,j,H),N.extent,i))}}function B(w,...$){if(this.__zooming){var N=S(this,$).event(w),E=w.changedTouches,P=E.length,M,L;for(Ct(w),l&&clearTimeout(l),l=setTimeout(function(){l=null},m),M=0;M<P;++M)L=E[M],N.touch0&&N.touch0[2]===L.identifier?delete N.touch0:N.touch1&&N.touch1[2]===L.identifier&&delete N.touch1;if(N.touch1&&!N.touch0&&(N.touch0=N.touch1,delete N.touch1),N.touch0)N.touch0[1]=this.__zoom.invert(N.touch0[0]);else if(N.end(),N.taps===2&&(L=de(L,this),Math.hypot(c[0]-L[0],c[1]-L[1])<y)){var j=ae(this).on("dblclick.zoom");j&&j.apply(this,arguments)}}}return g.wheelDelta=function(w){return arguments.length?(o=typeof w=="function"?w:ot(+w),g):o},g.filter=function(w){return arguments.length?(e=typeof w=="function"?w:ot(!!w),g):e},g.touchable=function(w){return arguments.length?(s=typeof w=="function"?w:ot(!!w),g):s},g.extent=function(w){return arguments.length?(t=typeof w=="function"?w:ot([[+w[0][0],+w[0][1]],[+w[1][0],+w[1][1]]]),g):t},g.scaleExtent=function(w){return arguments.length?(r[0]=+w[0],r[1]=+w[1],g):[r[0],r[1]]},g.translateExtent=function(w){return arguments.length?(i[0][0]=+w[0][0],i[1][0]=+w[1][0],i[0][1]=+w[0][1],i[1][1]=+w[1][1],g):[[i[0][0],i[0][1]],[i[1][0],i[1][1]]]},g.constrain=function(w){return arguments.length?(n=w,g):n},g.duration=function(w){return arguments.length?(a=+w,g):a},g.interpolate=function(w){return arguments.length?(d=w,g):d},g.on=function(){var w=u.on.apply(u,arguments);return w===u?g:w},g.clickDistance=function(w){return arguments.length?(b=(w=+w)*w,g):Math.sqrt(b)},g.tapDistance=function(w){return arguments.length?(y=+w,g):y},g}function ie(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=ie(e[n]))!==""&&(t+=(t&&" ")+o);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}const ge={error001:(e="react")=>`Seems like you have not used ${e==="svelte"?"SvelteFlowProvider":"ReactFlowProvider"} as an ancestor. Help: https://${e}flow.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 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.",error016:e=>`Edge with id "${e}" does not exist, it may have been removed. This can happen when an edge is deleted before the "onEdgeClick" handler is called.`},We=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],to=["Enter"," ","Escape"],no={"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"};var je;(function(e){e.Strict="strict",e.Loose="loose"})(je||(je={}));var Pe;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(Pe||(Pe={}));var Ge;(function(e){e.Partial="partial",e.Full="full"})(Ge||(Ge={}));const oo={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var Se;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Se||(Se={}));var lt;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(lt||(lt={}));var W;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(W||(W={}));const cn={[W.Left]:W.Right,[W.Right]:W.Left,[W.Top]:W.Bottom,[W.Bottom]:W.Top};function so(e){return e===null?null:e?"valid":"invalid"}const ro=e=>"id"in e&&"source"in e&&"target"in e,Rr=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),Bt=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),Ue=(e,t=[0,0])=>{const{width:n,height:o}=be(e),s=e.origin??t,r=n*s[0],i=o*s[1];return{x:e.position.x-r,y:e.position.y-i}},Br=(e,t={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((o,s)=>{const r=typeof s=="string";let i=!t.nodeLookup&&!r?s:void 0;t.nodeLookup&&(i=r?t.nodeLookup.get(s):Bt(s)?s:t.nodeLookup.get(s.id));const a=i?ut(i,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return ht(o,a)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return gt(n)},Qe=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},o=!1;return e.forEach(s=>{(t.filter===void 0||t.filter(s))&&(n=ht(n,ut(s)),o=!0)}),o?gt(n):{x:0,y:0,width:0,height:0}},Vt=(e,t,[n,o,s]=[0,0,1],r=!1,i=!1)=>{const a=(t.x-n)/s,d=(t.y-o)/s,u=t.width/s,h=t.height/s,c=[];for(const l of e.values()){const{measured:m,selectable:p=!0,hidden:b=!1}=l;if(i&&!p||b)continue;const y=m.width??l.width??l.initialWidth??0,g=m.height??l.height??l.initialHeight??0,{x:v,y:f}=l.internals.positionAbsolute,x=lo(a,d,u,h,v,f,y,g),k=y*g,S=r&&x>0;(!l.internals.handleBounds||S||x>=k||l.dragging)&&c.push(l)}return c},Vr=(e,t)=>{const n=new Set;return e.forEach(o=>{n.add(o.id)}),t.filter(o=>n.has(o.source)||n.has(o.target))};function Fr(e,t){const n=new Map,o=t!=null&&t.nodes?new Set(t.nodes.map(s=>s.id)):null;return e.forEach(s=>{s.measured.width&&s.measured.height&&((t==null?void 0:t.includeHiddenNodes)||!s.hidden)&&(!o||o.has(s.id))&&n.set(s.id,s)}),n}async function Or({nodes:e,width:t,height:n,panZoom:o,minZoom:s,maxZoom:r},i){if(e.size===0)return!0;const a=Fr(e,i),d=Qe(a),u=Ot(d,t,n,(i==null?void 0:i.minZoom)??s,(i==null?void 0:i.maxZoom)??r,(i==null?void 0:i.padding)??.1);return await o.setViewport(u,{duration:i==null?void 0:i.duration,ease:i==null?void 0:i.ease,interpolate:i==null?void 0:i.interpolate}),!0}function io({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:o=[0,0],nodeExtent:s,onError:r}){const i=n.get(e),a=i.parentId?n.get(i.parentId):void 0,{x:d,y:u}=a?a.internals.positionAbsolute:{x:0,y:0},h=i.origin??o;let c=i.extent||s;if(i.extent==="parent"&&!i.expandParent)if(!a)r==null||r("005",ge.error005());else{const m=a.measured.width,p=a.measured.height;m&&p&&(c=[[d,u],[d+m,u+p]])}else a&&_e(i.extent)&&(c=[[i.extent[0][0]+d,i.extent[0][1]+u],[i.extent[1][0]+d,i.extent[1][1]+u]]);const l=_e(c)?$e(t,c,i.measured):t;return(i.measured.width===void 0||i.measured.height===void 0)&&(r==null||r("015",ge.error015())),{position:{x:l.x-d+(i.measured.width??0)*h[0],y:l.y-u+(i.measured.height??0)*h[1]},positionAbsolute:l}}async function Yr({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:o,onBeforeDelete:s}){const r=new Set(e.map(l=>l.id)),i=[];for(const l of n){if(l.deletable===!1)continue;const m=r.has(l.id),p=!m&&l.parentId&&i.find(b=>b.id===l.parentId);(m||p)&&i.push(l)}const a=new Set(t.map(l=>l.id)),d=o.filter(l=>l.deletable!==!1),h=Vr(i,d);for(const l of d)a.has(l.id)&&!h.find(p=>p.id===l.id)&&h.push(l);if(!s)return{edges:h,nodes:i};const c=await s({nodes:i,edges:h});return typeof c=="boolean"?c?{edges:h,nodes:i}:{edges:[],nodes:[]}:c}const He=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),$e=(e={x:0,y:0},t,n)=>({x:He(e.x,t[0][0],t[1][0]-((n==null?void 0:n.width)??0)),y:He(e.y,t[0][1],t[1][1]-((n==null?void 0:n.height)??0))});function ao(e,t,n){const{width:o,height:s}=be(n),{x:r,y:i}=n.internals.positionAbsolute;return $e(e,[[r,i],[r+o,i+s]],t)}const ln=(e,t,n)=>e<t?He(Math.abs(e-t),1,t)/t:e>n?-He(Math.abs(e-n),1,t)/t:0,Ft=(e,t,n=15,o=40)=>{const s=ln(e.x,o,t.width-o)*n,r=ln(e.y,o,t.height-o)*n;return[s,r]},ht=(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)}),zt=({x:e,y:t,width:n,height:o})=>({x:e,y:t,x2:e+n,y2:t+o}),gt=({x:e,y:t,x2:n,y2:o})=>({x:e,y:t,width:n-e,height:o-t}),qe=(e,t=[0,0])=>{var s,r;const{x:n,y:o}=Bt(e)?e.internals.positionAbsolute:Ue(e,t);return{x:n,y:o,width:((s=e.measured)==null?void 0:s.width)??e.width??e.initialWidth??0,height:((r=e.measured)==null?void 0:r.height)??e.height??e.initialHeight??0}},ut=(e,t=[0,0])=>{var s,r;const{x:n,y:o}=Bt(e)?e.internals.positionAbsolute:Ue(e,t);return{x:n,y:o,x2:n+(((s=e.measured)==null?void 0:s.width)??e.width??e.initialWidth??0),y2:o+(((r=e.measured)==null?void 0:r.height)??e.height??e.initialHeight??0)}},co=(e,t)=>gt(ht(zt(e),zt(t))),lo=(e,t,n,o,s,r,i,a)=>{const d=Math.max(0,Math.min(e+n,s+i)-Math.max(e,s)),u=Math.max(0,Math.min(t+o,r+a)-Math.max(t,r));return Math.ceil(d*u)},dt=(e,t)=>lo(e.x,e.y,e.width,e.height,t.x,t.y,t.width,t.height),un=e=>fe(e.width)&&fe(e.height)&&fe(e.x)&&fe(e.y),fe=e=>!isNaN(e)&&isFinite(e),uo=(e,t)=>(n,o)=>{},Je=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),et=({x:e,y:t},[n,o,s],r=!1,i=[1,1])=>{const a={x:(e-n)/s,y:(t-o)/s};return r?Je(a,i):a},Re=({x:e,y:t},[n,o,s])=>({x:e*s+n,y:t*s+o});function ze(e,t){if(typeof e=="number")return Math.floor((t-t/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(n)}if(typeof e=="string"&&e.endsWith("%")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return console.error(`The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function Xr(e,t,n){if(typeof e=="string"||typeof e=="number"){const o=ze(e,n),s=ze(e,t);return{top:o,right:s,bottom:o,left:s,x:s*2,y:o*2}}if(typeof e=="object"){const o=ze(e.top??e.y??0,n),s=ze(e.bottom??e.y??0,n),r=ze(e.left??e.x??0,t),i=ze(e.right??e.x??0,t);return{top:o,right:i,bottom:s,left:r,x:r+i,y:o+s}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function Wr(e,t,n,o,s,r){const{x:i,y:a}=Re(e,[t,n,o]),{x:d,y:u}=Re({x:e.x+e.width,y:e.y+e.height},[t,n,o]),h=s-d,c=r-u;return{left:Math.floor(i),top:Math.floor(a),right:Math.floor(h),bottom:Math.floor(c)}}const Ot=(e,t,n,o,s,r)=>{const i=Xr(r,t,n),a=(t-i.x)/e.width,d=(n-i.y)/e.height,u=Math.min(a,d),h=He(u,o,s),c=e.x+e.width/2,l=e.y+e.height/2,m=t/2-c*h,p=n/2-l*h,b=Wr(e,m,p,h,t,n),y={left:Math.min(b.left-i.left,0),top:Math.min(b.top-i.top,0),right:Math.min(b.right-i.right,0),bottom:Math.min(b.bottom-i.bottom,0)};return{x:m-y.left+y.right,y:p-y.top+y.bottom,zoom:h}},Ke=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function _e(e){return e!=null&&e!=="parent"}function be(e){var t,n;return{width:((t=e.measured)==null?void 0:t.width)??e.width??e.initialWidth??0,height:((n=e.measured)==null?void 0:n.height)??e.height??e.initialHeight??0}}function fo(e){var t,n;return(((t=e.measured)==null?void 0:t.width)??e.width??e.initialWidth)!==void 0&&(((n=e.measured)==null?void 0:n.height)??e.height??e.initialHeight)!==void 0}function ho(e,t={width:0,height:0},n,o,s){const r={...e},i=o.get(n);if(i){const a=i.origin||s;r.x+=i.internals.positionAbsolute.x-(t.width??0)*a[0],r.y+=i.internals.positionAbsolute.y-(t.height??0)*a[1]}return r}function dn(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function Gr(){let e,t;return{promise:new Promise((o,s)=>{e=o,t=s}),resolve:e,reject:t}}function qr(e){return{...no,...e||{}}}function Ye(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:o,containerBounds:s}){const{x:r,y:i}=he(e),a=et({x:r-((s==null?void 0:s.left)??0),y:i-((s==null?void 0:s.top)??0)},o),{x:d,y:u}=n?Je(a,t):a;return{xSnapped:d,ySnapped:u,...a}}const Yt=e=>({width:e.offsetWidth,height:e.offsetHeight}),go=e=>{var t;return((t=e==null?void 0:e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},Kr=["INPUT","SELECT","TEXTAREA"];function po(e){var o,s;const t=((s=(o=e.composedPath)==null?void 0:o.call(e))==null?void 0:s[0])||e.target;return(t==null?void 0:t.nodeType)!==1?!1:Kr.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const mo=e=>"clientX"in e,he=(e,t)=>{var r,i;const n=mo(e),o=n?e.clientX:(r=e.touches)==null?void 0:r[0].clientX,s=n?e.clientY:(i=e.touches)==null?void 0:i[0].clientY;return{x:o-((t==null?void 0:t.left)??0),y:s-((t==null?void 0:t.top)??0)}},fn=(e,t,n,o,s)=>{const r=t.querySelectorAll(`.${e}`);return!r||!r.length?null:Array.from(r).map(i=>{const a=i.getBoundingClientRect();return{id:i.getAttribute("data-handleid"),type:e,nodeId:s,position:i.getAttribute("data-handlepos"),x:(a.left-n.left)/o,y:(a.top-n.top)/o,...Yt(i)}})};function yo({sourceX:e,sourceY:t,targetX:n,targetY:o,sourceControlX:s,sourceControlY:r,targetControlX:i,targetControlY:a}){const d=e*.125+s*.375+i*.375+n*.125,u=t*.125+r*.375+a*.375+o*.125,h=Math.abs(d-e),c=Math.abs(u-t);return[d,u,h,c]}function st(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function hn({pos:e,x1:t,y1:n,x2:o,y2:s,c:r}){switch(e){case W.Left:return[t-st(t-o,r),n];case W.Right:return[t+st(o-t,r),n];case W.Top:return[t,n-st(n-s,r)];case W.Bottom:return[t,n+st(s-n,r)]}}function xo({sourceX:e,sourceY:t,sourcePosition:n=W.Bottom,targetX:o,targetY:s,targetPosition:r=W.Top,curvature:i=.25}){const[a,d]=hn({pos:n,x1:e,y1:t,x2:o,y2:s,c:i}),[u,h]=hn({pos:r,x1:o,y1:s,x2:e,y2:t,c:i}),[c,l,m,p]=yo({sourceX:e,sourceY:t,targetX:o,targetY:s,sourceControlX:a,sourceControlY:d,targetControlX:u,targetControlY:h});return[`M${e},${t} C${a},${d} ${u},${h} ${o},${s}`,c,l,m,p]}function wo({sourceX:e,sourceY:t,targetX:n,targetY:o}){const s=Math.abs(n-e)/2,r=n<e?n+s:n-s,i=Math.abs(o-t)/2,a=o<t?o+i:o-i;return[r,a,s,i]}function Zr({sourceNode:e,targetNode:t,selected:n=!1,zIndex:o=0,elevateOnSelect:s=!1,zIndexMode:r="basic"}){if(r==="manual")return o;const i=s&&n?o+1e3:o,a=Math.max(e.parentId||s&&e.selected?e.internals.z:0,t.parentId||s&&t.selected?t.internals.z:0);return i+a}function Ur({sourceNode:e,targetNode:t,width:n,height:o,transform:s}){const r=ht(ut(e),ut(t));r.x===r.x2&&(r.x2+=1),r.y===r.y2&&(r.y2+=1);const i={x:-s[0]/s[2],y:-s[1]/s[2],width:n/s[2],height:o/s[2]};return dt(i,gt(r))>0}const Qr=({source:e,sourceHandle:t,target:n,targetHandle:o})=>`xy-edge__${e}${t||""}-${n}${o||""}`,Jr=(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)),ei=(e,t,n={})=>{var r;if(!e.source||!e.target)return(r=n.onError)==null||r.call(n,"006",ge.error006()),t;const o=n.getEdgeId||Qr;let s;return ro(e)?s={...e}:s={...e,id:o(e)},Jr(s,t)?t:(s.sourceHandle===null&&delete s.sourceHandle,s.targetHandle===null&&delete s.targetHandle,t.concat(s))};function bo({sourceX:e,sourceY:t,targetX:n,targetY:o}){const[s,r,i,a]=wo({sourceX:e,sourceY:t,targetX:n,targetY:o});return[`M ${e},${t}L ${n},${o}`,s,r,i,a]}const gn={[W.Left]:{x:-1,y:0},[W.Right]:{x:1,y:0},[W.Top]:{x:0,y:-1},[W.Bottom]:{x:0,y:1}},ti=({source:e,sourcePosition:t=W.Bottom,target:n})=>t===W.Left||t===W.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},pn=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function ni({source:e,sourcePosition:t=W.Bottom,target:n,targetPosition:o=W.Top,center:s,offset:r,stepPosition:i}){const a=gn[t],d=gn[o],u={x:e.x+a.x*r,y:e.y+a.y*r},h={x:n.x+d.x*r,y:n.y+d.y*r},c=ti({source:u,sourcePosition:t,target:h}),l=c.x!==0?"x":"y",m=c[l];let p=[],b,y;const g={x:0,y:0},v={x:0,y:0},[,,f,x]=wo({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(a[l]*d[l]===-1){l==="x"?(b=s.x??u.x+(h.x-u.x)*i,y=s.y??(u.y+h.y)/2):(b=s.x??(u.x+h.x)/2,y=s.y??u.y+(h.y-u.y)*i);const A=[{x:b,y:u.y},{x:b,y:h.y}],T=[{x:u.x,y},{x:h.x,y}];a[l]===m?p=l==="x"?A:T:p=l==="x"?T:A}else{const A=[{x:u.x,y:h.y}],T=[{x:h.x,y:u.y}];if(l==="x"?p=a.x===m?T:A:p=a.y===m?A:T,t===o){const w=Math.abs(e[l]-n[l]);if(w<=r){const $=Math.min(r-1,r-w);a[l]===m?g[l]=(u[l]>e[l]?-1:1)*$:v[l]=(h[l]>n[l]?-1:1)*$}}if(t!==o){const w=l==="x"?"y":"x",$=a[l]===d[w],N=u[w]>h[w],E=u[w]<h[w];(a[l]===1&&(!$&&N||$&&E)||a[l]!==1&&(!$&&E||$&&N))&&(p=l==="x"?A:T)}const V={x:u.x+g.x,y:u.y+g.y},I={x:h.x+v.x,y:h.y+v.y},D=Math.max(Math.abs(V.x-p[0].x),Math.abs(I.x-p[0].x)),B=Math.max(Math.abs(V.y-p[0].y),Math.abs(I.y-p[0].y));D>=B?(b=(V.x+I.x)/2,y=p[0].y):(b=p[0].x,y=(V.y+I.y)/2)}const k={x:u.x+g.x,y:u.y+g.y},S={x:h.x+v.x,y:h.y+v.y};return[[e,...k.x!==p[0].x||k.y!==p[0].y?[k]:[],...p,...S.x!==p[p.length-1].x||S.y!==p[p.length-1].y?[S]:[],n],b,y,f,x]}function oi(e,t,n,o){const s=Math.min(pn(e,t)/2,pn(t,n)/2,o),{x:r,y:i}=t;if(e.x===r&&r===n.x||e.y===i&&i===n.y)return`L${r} ${i}`;if(e.y===i){const u=e.x<n.x?-1:1,h=e.y<n.y?1:-1;return`L ${r+s*u},${i}Q ${r},${i} ${r},${i+s*h}`}const a=e.x<n.x?1:-1,d=e.y<n.y?-1:1;return`L ${r},${i+s*d}Q ${r},${i} ${r+s*a},${i}`}function Tt({sourceX:e,sourceY:t,sourcePosition:n=W.Bottom,targetX:o,targetY:s,targetPosition:r=W.Top,borderRadius:i=5,centerX:a,centerY:d,offset:u=20,stepPosition:h=.5}){const[c,l,m,p,b]=ni({source:{x:e,y:t},sourcePosition:n,target:{x:o,y:s},targetPosition:r,center:{x:a,y:d},offset:u,stepPosition:h});let y=`M${c[0].x} ${c[0].y}`;for(let g=1;g<c.length-1;g++)y+=oi(c[g-1],c[g],c[g+1],i);return y+=`L${c[c.length-1].x} ${c[c.length-1].y}`,[y,l,m,p,b]}function mn(e){var t;return e&&!!(e.internals.handleBounds||(t=e.handles)!=null&&t.length)&&!!(e.measured.width||e.width||e.initialWidth)}function si(e){var c;const{sourceNode:t,targetNode:n}=e;if(!mn(t)||!mn(n))return null;const o=t.internals.handleBounds||yn(t.handles),s=n.internals.handleBounds||yn(n.handles),r=xn((o==null?void 0:o.source)??[],e.sourceHandle),i=xn(e.connectionMode===je.Strict?(s==null?void 0:s.target)??[]:((s==null?void 0:s.target)??[]).concat((s==null?void 0:s.source)??[]),e.targetHandle);if(!r||!i)return(c=e.onError)==null||c.call(e,"008",ge.error008(r?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const a=(r==null?void 0:r.position)||W.Bottom,d=(i==null?void 0:i.position)||W.Top,u=Ae(t,r,a),h=Ae(n,i,d);return{sourceX:u.x,sourceY:u.y,targetX:h.x,targetY:h.y,sourcePosition:a,targetPosition:d}}function yn(e){if(!e)return null;const t=[],n=[];for(const 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 Ae(e,t,n=W.Left,o=!1){const s=((t==null?void 0:t.x)??0)+e.internals.positionAbsolute.x,r=((t==null?void 0:t.y)??0)+e.internals.positionAbsolute.y,{width:i,height:a}=t??be(e);if(o)return{x:s+i/2,y:r+a/2};switch((t==null?void 0:t.position)??n){case W.Top:return{x:s+i/2,y:r};case W.Right:return{x:s+i,y:r+a/2};case W.Bottom:return{x:s+i/2,y:r+a};case W.Left:return{x:s,y:r+a/2}}}function xn(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}function Dt(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(o=>`${o}=${e[o]}`).join("&")}`:""}function ri(e,{id:t,defaultColor:n,defaultMarkerStart:o,defaultMarkerEnd:s}){const r=new Set;return e.reduce((i,a)=>([a.markerStart||o,a.markerEnd||s].forEach(d=>{if(d&&typeof d=="object"){const u=Dt(d,t);r.has(u)||(i.push({id:u,color:d.color||n,...d}),r.add(u))}}),i),[]).sort((i,a)=>i.id.localeCompare(a.id))}const vo=1e3,ii=10,Xt={nodeOrigin:[0,0],nodeExtent:We,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},ai={...Xt,checkEquality:!0};function Wt(e,t){const n={...e};for(const o in t)t[o]!==void 0&&(n[o]=t[o]);return n}function ci(e,t,n){const o=Wt(Xt,n);for(const s of e.values())if(s.parentId)qt(s,e,t,o);else{const r=Ue(s,o.nodeOrigin),i=_e(s.extent)?s.extent:o.nodeExtent,a=$e(r,i,be(s));s.internals.positionAbsolute=a}}function li(e,t){if(!e.handles)return e.measured?t==null?void 0:t.internals.handleBounds:void 0;const n=[],o=[];for(const s of e.handles){const r={id:s.id,width:s.width??1,height:s.height??1,nodeId:e.id,x:s.x,y:s.y,position:s.position,type:s.type};s.type==="source"?n.push(r):s.type==="target"&&o.push(r)}return{source:n,target:o}}function Gt(e){return e==="manual"}function Lt(e,t,n,o={}){var h,c;const s=Wt(ai,o),r={i:0},i=new Map(t),a=s!=null&&s.elevateNodesOnSelect&&!Gt(s.zIndexMode)?vo:0;let d=e.length>0,u=!1;t.clear(),n.clear();for(const l of e){let m=i.get(l.id);if(s.checkEquality&&l===(m==null?void 0:m.internals.userNode))t.set(l.id,m);else{const p=Ue(l,s.nodeOrigin),b=_e(l.extent)?l.extent:s.nodeExtent,y=$e(p,b,be(l));m={...s.defaults,...l,measured:{width:(h=l.measured)==null?void 0:h.width,height:(c=l.measured)==null?void 0:c.height},internals:{positionAbsolute:y,handleBounds:li(l,m),z:Eo(l,a,s.zIndexMode),userNode:l}},t.set(l.id,m)}(m.measured===void 0||m.measured.width===void 0||m.measured.height===void 0)&&!m.hidden&&(d=!1),l.parentId&&qt(m,t,n,o,r),u||(u=l.selected??!1)}return{nodesInitialized:d,hasSelectedNodes:u}}function ui(e,t){if(!e.parentId)return;const n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function qt(e,t,n,o,s){const{elevateNodesOnSelect:r,nodeOrigin:i,nodeExtent:a,zIndexMode:d}=Wt(Xt,o),u=e.parentId,h=t.get(u);if(!h){console.warn(`Parent node ${u} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}ui(e,n),s&&!h.parentId&&h.internals.rootParentIndex===void 0&&d==="auto"&&(h.internals.rootParentIndex=++s.i,h.internals.z=h.internals.z+s.i*ii),s&&h.internals.rootParentIndex!==void 0&&(s.i=h.internals.rootParentIndex);const c=r&&!Gt(d)?vo:0,{x:l,y:m,z:p}=di(e,h,i,a,c,d),{positionAbsolute:b}=e.internals,y=l!==b.x||m!==b.y;(y||p!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:y?{x:l,y:m}:b,z:p}})}function Eo(e,t,n){const o=fe(e.zIndex)?e.zIndex:0;return Gt(n)?o:o+(e.selected?t:0)}function di(e,t,n,o,s,r){const{x:i,y:a}=t.internals.positionAbsolute,d=be(e),u=Ue(e,n),h=_e(e.extent)?$e(u,e.extent,d):u;let c=$e({x:i+h.x,y:a+h.y},o,d);e.extent==="parent"&&(c=ao(c,d,t));const l=Eo(e,s,r),m=t.internals.z??0;return{x:c.x,y:c.y,z:m>=l?m+1:l}}function Kt(e,t,n,o=[0,0]){var i;const s=[],r=new Map;for(const a of e){const d=t.get(a.parentId);if(!d)continue;const u=((i=r.get(a.parentId))==null?void 0:i.expandedRect)??qe(d),h=co(u,a.rect);r.set(a.parentId,{expandedRect:h,parent:d})}return r.size>0&&r.forEach(({expandedRect:a,parent:d},u)=>{var f;const h=d.internals.positionAbsolute,c=be(d),l=d.origin??o,m=a.x<h.x?Math.round(Math.abs(h.x-a.x)):0,p=a.y<h.y?Math.round(Math.abs(h.y-a.y)):0,b=Math.max(c.width,Math.round(a.width)),y=Math.max(c.height,Math.round(a.height)),g=(b-c.width)*l[0],v=(y-c.height)*l[1];(m>0||p>0||g||v)&&(s.push({id:u,type:"position",position:{x:d.position.x-m+g,y:d.position.y-p+v}}),(f=n.get(u))==null||f.forEach(x=>{e.some(k=>k.id===x.id)||s.push({id:x.id,type:"position",position:{x:x.position.x+m,y:x.position.y+p}})})),(c.width<a.width||c.height<a.height||m||p)&&s.push({id:u,type:"dimensions",setAttributes:!0,dimensions:{width:b+(m?l[0]*m-g:0),height:y+(p?l[1]*p-v:0)}})}),s}function fi(e,t,n,o,s,r,i){const a=o==null?void 0:o.querySelector(".xyflow__viewport");let d=!1;if(!a)return{changes:[],updatedInternals:d};const u=[],h=window.getComputedStyle(a),{m22:c}=new window.DOMMatrixReadOnly(h.transform),l=[];for(const m of e.values()){const p=t.get(m.id);if(!p)continue;if(p.hidden){t.set(p.id,{...p,internals:{...p.internals,handleBounds:void 0}}),d=!0;continue}const b=Yt(m.nodeElement),y=p.measured.width!==b.width||p.measured.height!==b.height;if(!!(b.width&&b.height&&(y||!p.internals.handleBounds||m.force))){const v=m.nodeElement.getBoundingClientRect(),f=_e(p.extent)?p.extent:r;let{positionAbsolute:x}=p.internals;p.parentId&&p.extent==="parent"?x=ao(x,b,t.get(p.parentId)):f&&(x=$e(x,f,b));const k={...p,measured:b,internals:{...p.internals,positionAbsolute:x,handleBounds:{source:fn("source",m.nodeElement,v,c,p.id),target:fn("target",m.nodeElement,v,c,p.id)}}};t.set(p.id,k),p.parentId&&qt(k,t,n,{nodeOrigin:s,zIndexMode:i}),d=!0,y&&(u.push({id:p.id,type:"dimensions",dimensions:b}),p.expandParent&&p.parentId&&l.push({id:p.id,parentId:p.parentId,rect:qe(k,s)}))}}if(l.length>0){const m=Kt(l,t,n,s);u.push(...m)}return{changes:u,updatedInternals:d}}async function hi({delta:e,panZoom:t,transform:n,translateExtent:o,width:s,height:r}){if(!t||!e.x&&!e.y)return!1;const i=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[s,r]],o);return!!i&&(i.x!==n[0]||i.y!==n[1]||i.k!==n[2])}function wn(e,t,n,o,s,r){let i=s;const a=o.get(i)||new Map;o.set(i,a.set(n,t)),i=`${s}-${e}`;const d=o.get(i)||new Map;if(o.set(i,d.set(n,t)),r){i=`${s}-${e}-${r}`;const u=o.get(i)||new Map;o.set(i,u.set(n,t))}}function So(e,t,n){e.clear(),t.clear();for(const o of n){const{source:s,target:r,sourceHandle:i=null,targetHandle:a=null}=o,d={edgeId:o.id,source:s,target:r,sourceHandle:i,targetHandle:a},u=`${s}-${i}--${r}-${a}`,h=`${r}-${a}--${s}-${i}`;wn("source",d,h,e,s,i),wn("target",d,u,e,r,a),t.set(o.id,o)}}function No(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:No(n,t):!1}function bn(e,t,n){var s;let o=e;do{if((s=o==null?void 0:o.matches)!=null&&s.call(o,t))return!0;if(o===n)return!1;o=o==null?void 0:o.parentElement}while(o);return!1}function gi(e,t,n,o){const s=new Map;for(const[r,i]of e)if((i.selected||i.id===o)&&(!i.parentId||!No(i,e))&&(i.draggable||t&&typeof i.draggable>"u")){const a=e.get(r);a&&s.set(r,{id:r,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 s}function It({nodeId:e,dragItems:t,nodeLookup:n,dragging:o=!0}){var i,a,d;const s=[];for(const[u,h]of t){const c=(i=n.get(u))==null?void 0:i.internals.userNode;c&&s.push({...c,position:h.position,dragging:o})}if(!e)return[s[0],s];const r=(a=n.get(e))==null?void 0:a.internals.userNode;return[r?{...r,position:((d=t.get(e))==null?void 0:d.position)||r.position,dragging:o}:s[0],s]}function pi({dragItems:e,snapGrid:t,x:n,y:o}){const s=e.values().next().value;if(!s)return null;const r={x:n-s.distance.x,y:o-s.distance.y},i=Je(r,t);return{x:i.x-r.x,y:i.y-r.y}}function mi({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:o,onDragStop:s}){let r={x:null,y:null},i=0,a=new Map,d=!1,u={x:0,y:0},h=null,c=!1,l=null,m=!1,p=!1,b=null;function y({noDragClassName:v,handleSelector:f,domNode:x,isSelectable:k,nodeId:S,nodeClickDistance:_=0}){l=ae(x);function A({x:D,y:B}){const{nodeLookup:w,nodeExtent:$,snapGrid:N,snapToGrid:E,nodeOrigin:P,onNodeDrag:M,onSelectionDrag:L,onError:j,updateNodePositions:H}=t();r={x:D,y:B};let O=!1;const Y=a.size>1,K=Y&&$?zt(Qe(a)):null,Q=Y&&E?pi({dragItems:a,snapGrid:N,x:D,y:B}):null;for(const[q,R]of a){if(!w.has(q))continue;let F={x:D-R.distance.x,y:B-R.distance.y};E&&(F=Q?{x:Math.round(F.x+Q.x),y:Math.round(F.y+Q.y)}:Je(F,N));let U=null;if(Y&&$&&!R.extent&&K){const{positionAbsolute:X}=R.internals,J=X.x-K.x+$[0][0],te=X.x+R.measured.width-K.x2+$[1][0],ne=X.y-K.y+$[0][1],re=X.y+R.measured.height-K.y2+$[1][1];U=[[J,ne],[te,re]]}const{position:Z,positionAbsolute:G}=io({nodeId:q,nextPosition:F,nodeLookup:w,nodeExtent:U||$,nodeOrigin:P,onError:j});O=O||R.position.x!==Z.x||R.position.y!==Z.y,R.position=Z,R.internals.positionAbsolute=G}if(p=p||O,!!O&&(H(a,!0),b&&(o||M||!S&&L))){const[q,R]=It({nodeId:S,dragItems:a,nodeLookup:w});o==null||o(b,a,q,R),M==null||M(b,q,R),S||L==null||L(b,R)}}async function T(){if(!h)return;const{transform:D,panBy:B,autoPanSpeed:w,autoPanOnNodeDrag:$}=t();if(!$){d=!1,cancelAnimationFrame(i);return}const[N,E]=Ft(u,h,w);(N!==0||E!==0)&&(r.x=(r.x??0)-N/D[2],r.y=(r.y??0)-E/D[2],await B({x:N,y:E})&&A(r)),i=requestAnimationFrame(T)}function V(D){var Y;const{nodeLookup:B,multiSelectionActive:w,nodesDraggable:$,transform:N,snapGrid:E,snapToGrid:P,selectNodesOnDrag:M,onNodeDragStart:L,onSelectionDragStart:j,unselectNodesAndEdges:H}=t();c=!0,(!M||!k)&&!w&&S&&((Y=B.get(S))!=null&&Y.selected||H()),k&&M&&S&&(e==null||e(S));const O=Ye(D.sourceEvent,{transform:N,snapGrid:E,snapToGrid:P,containerBounds:h});if(r=O,a=gi(B,$,O,S),a.size>0&&(n||L||!S&&j)){const[K,Q]=It({nodeId:S,dragItems:a,nodeLookup:B});n==null||n(D.sourceEvent,a,K,Q),L==null||L(D.sourceEvent,K,Q),S||j==null||j(D.sourceEvent,Q)}}const I=Jn().clickDistance(_).on("start",D=>{const{domNode:B,nodeDragThreshold:w,transform:$,snapGrid:N,snapToGrid:E}=t();h=(B==null?void 0:B.getBoundingClientRect())||null,m=!1,p=!1,b=D.sourceEvent,w===0&&V(D),r=Ye(D.sourceEvent,{transform:$,snapGrid:N,snapToGrid:E,containerBounds:h}),u=he(D.sourceEvent,h)}).on("drag",D=>{const{autoPanOnNodeDrag:B,transform:w,snapGrid:$,snapToGrid:N,nodeDragThreshold:E,nodeLookup:P}=t(),M=Ye(D.sourceEvent,{transform:w,snapGrid:$,snapToGrid:N,containerBounds:h});if(b=D.sourceEvent,(D.sourceEvent.type==="touchmove"&&D.sourceEvent.touches.length>1||S&&!P.has(S))&&(m=!0),!m){if(!d&&B&&c&&(d=!0,T()),!c){const L=he(D.sourceEvent,h),j=L.x-u.x,H=L.y-u.y;Math.sqrt(j*j+H*H)>E&&V(D)}(r.x!==M.xSnapped||r.y!==M.ySnapped)&&a&&c&&(u=he(D.sourceEvent,h),A(M))}}).on("end",D=>{if(!c||m){m&&a.size>0&&t().updateNodePositions(a,!1);return}if(d=!1,c=!1,cancelAnimationFrame(i),a.size>0){const{nodeLookup:B,updateNodePositions:w,onNodeDragStop:$,onSelectionDragStop:N}=t();if(p&&(w(a,!1),p=!1),s||$||!S&&N){const[E,P]=It({nodeId:S,dragItems:a,nodeLookup:B,dragging:!1});s==null||s(D.sourceEvent,a,E,P),$==null||$(D.sourceEvent,E,P),S||N==null||N(D.sourceEvent,P)}}}).filter(D=>{const B=D.target;return!D.button&&(!v||!bn(B,`.${v}`,x))&&(!f||bn(B,f,x))});l.call(I)}function g(){l==null||l.on(".drag",null)}return{update:y,destroy:g}}function yi(e,t,n){const o=[],s={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(const r of t.values())dt(s,qe(r))>0&&o.push(r);return o}const xi=250;function wi(e,t,n,o){var a,d;let s=[],r=1/0;const i=yi(e,n,t+xi);for(const u of i){const h=[...((a=u.internals.handleBounds)==null?void 0:a.source)??[],...((d=u.internals.handleBounds)==null?void 0:d.target)??[]];for(const c of h){if(o.nodeId===c.nodeId&&o.type===c.type&&o.id===c.id)continue;const{x:l,y:m}=Ae(u,c,c.position,!0),p=Math.sqrt(Math.pow(l-e.x,2)+Math.pow(m-e.y,2));p>t||(p<r?(s=[{...c,x:l,y:m}],r=p):p===r&&s.push({...c,x:l,y:m}))}}if(!s.length)return null;if(s.length>1){const u=o.type==="source"?"target":"source";return s.find(h=>h.type===u)??s[0]}return s[0]}function Mo(e,t,n,o,s,r=!1){var u,h,c;const i=o.get(e);if(!i)return null;const a=s==="strict"?(u=i.internals.handleBounds)==null?void 0:u[t]:[...((h=i.internals.handleBounds)==null?void 0:h.source)??[],...((c=i.internals.handleBounds)==null?void 0:c.target)??[]],d=(n?a==null?void 0:a.find(l=>l.id===n):a==null?void 0:a[0])??null;return d&&r?{...d,...Ae(i,d,d.position,!0)}:d}function Co(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function bi(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const Io=()=>!0;function vi(e,{connectionMode:t,connectionRadius:n,handleId:o,nodeId:s,edgeUpdaterType:r,isTarget:i,domNode:a,nodeLookup:d,lib:u,autoPanOnConnect:h,flowId:c,panBy:l,cancelConnection:m,onConnectStart:p,onConnect:b,onConnectEnd:y,isValidConnection:g=Io,onReconnectEnd:v,updateConnection:f,getTransform:x,getFromHandle:k,autoPanSpeed:S,dragThreshold:_=1,handleDomNode:A}){const T=go(e.target);let V=0,I;const{x:D,y:B}=he(e),w=Co(r,A),$=a==null?void 0:a.getBoundingClientRect();let N=!1;if(!$||!w)return;const E=Mo(s,w,o,d,t);if(!E)return;let P=he(e,$),M=!1,L=null,j=!1,H=null;function O(){if(!h||!$)return;const[Z,G]=Ft(P,$,S);l({x:Z,y:G}),V=requestAnimationFrame(O)}const Y={...E,nodeId:s,type:w,position:E.position},K=d.get(s);let q={inProgress:!0,isValid:null,from:Ae(K,Y,W.Left,!0),fromHandle:Y,fromPosition:Y.position,fromNode:K,to:P,toHandle:null,toPosition:cn[Y.position],toNode:null,pointer:P};function R(){N=!0,f(q),p==null||p(e,{nodeId:s,handleId:o,handleType:w})}_===0&&R();function F(Z){if(!N){const{x:re,y:ce}=he(Z),pe=re-D,me=ce-B;if(!(pe*pe+me*me>_*_))return;R()}if(!k()||!Y){U(Z);return}const G=x();P=he(Z,$),I=wi(et(P,G,!1,[1,1]),n,d,Y),M||(O(),M=!0);const X=ko(Z,{handle:I,connectionMode:t,fromNodeId:s,fromHandleId:o,fromType:i?"target":"source",isValidConnection:g,doc:T,lib:u,flowId:c,nodeLookup:d});H=X.handleDomNode,L=X.connection,j=bi(!!I,X.isValid);const J=d.get(s),te=J?Ae(J,Y,W.Left,!0):q.from,ne={...q,from:te,isValid:j,to:X.toHandle&&j?Re({x:X.toHandle.x,y:X.toHandle.y},G):P,toHandle:X.toHandle,toPosition:j&&X.toHandle?X.toHandle.position:cn[Y.position],toNode:X.toHandle?d.get(X.toHandle.nodeId):null,pointer:P};f(ne),q=ne}function U(Z){if(!("touches"in Z&&Z.touches.length>0)){if(N){(I||H)&&L&&j&&(b==null||b(L));const{inProgress:G,...X}=q,J={...X,toPosition:q.toHandle?q.toPosition:null};y==null||y(Z,J),r&&(v==null||v(Z,J))}m(),cancelAnimationFrame(V),M=!1,j=!1,L=null,H=null,T.removeEventListener("mousemove",F),T.removeEventListener("mouseup",U),T.removeEventListener("touchmove",F),T.removeEventListener("touchend",U)}}T.addEventListener("mousemove",F),T.addEventListener("mouseup",U),T.addEventListener("touchmove",F),T.addEventListener("touchend",U)}function ko(e,{handle:t,connectionMode:n,fromNodeId:o,fromHandleId:s,fromType:r,doc:i,lib:a,flowId:d,isValidConnection:u=Io,nodeLookup:h}){const c=r==="target",l=t?i.querySelector(`.${a}-flow__handle[data-id="${d}-${t==null?void 0:t.nodeId}-${t==null?void 0:t.id}-${t==null?void 0:t.type}"]`):null,{x:m,y:p}=he(e),b=i.elementFromPoint(m,p),y=b!=null&&b.classList.contains(`${a}-flow__handle`)?b:l,g={handleDomNode:y,isValid:!1,connection:null,toHandle:null};if(y){const v=Co(void 0,y),f=y.getAttribute("data-nodeid"),x=y.getAttribute("data-handleid"),k=y.classList.contains("connectable"),S=y.classList.contains("connectableend");if(!f||!v)return g;const _={source:c?f:o,sourceHandle:c?x:s,target:c?o:f,targetHandle:c?s:x};g.connection=_;const T=k&&S&&(n===je.Strict?c&&v==="source"||!c&&v==="target":f!==o||x!==s);g.isValid=T&&u(_),g.toHandle=Mo(f,v,x,h,n,!0)}return g}const jt={onPointerDown:vi,isValid:ko};function Ei({domNode:e,panZoom:t,getTransform:n,getViewScale:o}){const s=ae(e);function r({translateExtent:a,width:d,height:u,zoomStep:h=1,pannable:c=!0,zoomable:l=!0,inversePan:m=!1}){const p=f=>{if(f.sourceEvent.type!=="wheel"||!t)return;const x=n(),k=f.sourceEvent.ctrlKey&&Ke()?10:1,S=-f.sourceEvent.deltaY*(f.sourceEvent.deltaMode===1?.05:f.sourceEvent.deltaMode?1:.002)*h,_=x[2]*Math.pow(2,S*k);t.scaleTo(_)};let b=[0,0];const y=f=>{(f.sourceEvent.type==="mousedown"||f.sourceEvent.type==="touchstart")&&(b=[f.sourceEvent.clientX??f.sourceEvent.touches[0].clientX,f.sourceEvent.clientY??f.sourceEvent.touches[0].clientY])},g=f=>{const x=n();if(f.sourceEvent.type!=="mousemove"&&f.sourceEvent.type!=="touchmove"||!t)return;const k=[f.sourceEvent.clientX??f.sourceEvent.touches[0].clientX,f.sourceEvent.clientY??f.sourceEvent.touches[0].clientY],S=[k[0]-b[0],k[1]-b[1]];b=k;const _=o()*Math.max(x[2],Math.log(x[2]))*(m?-1:1),A={x:x[0]-S[0]*_,y:x[1]-S[1]*_},T=[[0,0],[d,u]];t.setViewportConstrained({x:A.x,y:A.y,zoom:x[2]},T,a)},v=eo().on("start",y).on("zoom",c?g:null).on("zoom.wheel",l?p:null);s.call(v,{})}function i(){s.on("zoom",null)}return{update:r,destroy:i,pointer:de}}const pt=e=>({x:e.x,y:e.y,zoom:e.k}),kt=({x:e,y:t,zoom:n})=>Rt.translate(e,t).scale(n),Te=(e,t)=>e.target.closest(`.${t}`),Po=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),Si=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,Pt=(e,t=0,n=Si,o=()=>{})=>{const s=typeof t=="number"&&t>0;return s||o(),s?e.transition().duration(t).ease(n).on("end",o):e},$o=e=>{const t=e.ctrlKey&&Ke()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function Ni({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:o,panOnScrollMode:s,panOnScrollSpeed:r,zoomOnPinch:i,onPanZoomStart:a,onPanZoom:d,onPanZoomEnd:u}){return h=>{if(Te(h,t))return h.ctrlKey&&h.preventDefault(),!1;h.preventDefault(),h.stopImmediatePropagation();const c=n.property("__zoom").k||1;if(h.ctrlKey&&i){const y=de(h),g=$o(h),v=c*Math.pow(2,g);o.scaleTo(n,v,y,h);return}const l=h.deltaMode===1?20:1;let m=s===Pe.Vertical?0:h.deltaX*l,p=s===Pe.Horizontal?0:h.deltaY*l;!Ke()&&h.shiftKey&&s!==Pe.Vertical&&(m=h.deltaY*l,p=0),o.translateBy(n,-(m/c)*r,-(p/c)*r,{internal:!0});const b=pt(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(d==null||d(h,b),e.panScrollTimeout=setTimeout(()=>{u==null||u(h,b),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,a==null||a(h,b))}}function Mi({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(o,s){const r=o.type==="wheel",i=!t&&r&&!o.ctrlKey,a=Te(o,e);if(o.ctrlKey&&r&&a&&o.preventDefault(),i||a)return null;o.preventDefault(),n.call(this,o,s)}}function Ci({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return o=>{var r,i,a;if((r=o.sourceEvent)!=null&&r.internal)return;const s=pt(o.transform);e.mouseButton=((i=o.sourceEvent)==null?void 0:i.button)||0,e.isZoomingOrPanning=!0,e.prevViewport=s,((a=o.sourceEvent)==null?void 0:a.type)==="mousedown"&&t(!0),n&&(n==null||n(o.sourceEvent,s))}}function Ii({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:o,onPanZoom:s}){return r=>{var i,a;e.usedRightMouseButton=!!(n&&Po(t,e.mouseButton??0)),(i=r.sourceEvent)!=null&&i.sync||o([r.transform.x,r.transform.y,r.transform.k]),s&&!((a=r.sourceEvent)!=null&&a.internal)&&(s==null||s(r.sourceEvent,pt(r.transform)))}}function ki({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:o,onPanZoomEnd:s,onPaneContextMenu:r}){return i=>{var a;if(!((a=i.sourceEvent)!=null&&a.internal)&&(e.isZoomingOrPanning=!1,r&&Po(t,e.mouseButton??0)&&!e.usedRightMouseButton&&i.sourceEvent&&r(i.sourceEvent),e.usedRightMouseButton=!1,o(!1),s)){const d=pt(i.transform);e.prevViewport=d,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{s==null||s(i.sourceEvent,d)},n?150:0)}}}function Pi({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:o,panOnScroll:s,zoomOnDoubleClick:r,userSelectionActive:i,noWheelClassName:a,noPanClassName:d,lib:u,connectionInProgress:h}){return c=>{var y;const l=e||t,m=n&&c.ctrlKey,p=c.type==="wheel";if(c.button===1&&c.type==="mousedown"&&(Te(c,`${u}-flow__node`)||Te(c,`${u}-flow__edge`)))return!0;if(!o&&!l&&!s&&!r&&!n||i||h&&!p||Te(c,a)&&p||Te(c,d)&&(!p||s&&p&&!e)||!n&&c.ctrlKey&&p)return!1;if(!n&&c.type==="touchstart"&&((y=c.touches)==null?void 0:y.length)>1)return c.preventDefault(),!1;if(!l&&!s&&!m&&p||!o&&(c.type==="mousedown"||c.type==="touchstart")||Array.isArray(o)&&!o.includes(c.button)&&c.type==="mousedown")return!1;const b=Array.isArray(o)&&o.includes(c.button)||!c.button||c.button<=1;return(!c.ctrlKey||p)&&b}}function $i({domNode:e,minZoom:t,maxZoom:n,translateExtent:o,viewport:s,onPanZoom:r,onPanZoomStart:i,onPanZoomEnd:a,onDraggingChange:d}){const u={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},h=e.getBoundingClientRect(),c=eo().scaleExtent([t,n]).translateExtent(o),l=ae(e).call(c);v({x:s.x,y:s.y,zoom:He(s.zoom,t,n)},[[0,0],[h.width,h.height]],o);const m=l.on("wheel.zoom"),p=l.on("dblclick.zoom");c.wheelDelta($o);async function b(I,D){return l?new Promise(B=>{c==null||c.interpolate((D==null?void 0:D.interpolate)==="linear"?Nt:ct).transform(Pt(l,D==null?void 0:D.duration,D==null?void 0:D.ease,()=>B(!0)),I)}):!1}function y({noWheelClassName:I,noPanClassName:D,onPaneContextMenu:B,userSelectionActive:w,panOnScroll:$,panOnDrag:N,panOnScrollMode:E,panOnScrollSpeed:P,preventScrolling:M,zoomOnPinch:L,zoomOnScroll:j,zoomOnDoubleClick:H,zoomActivationKeyPressed:O,lib:Y,onTransformChange:K,connectionInProgress:Q,paneClickDistance:q,selectionOnDrag:R}){w&&!u.isZoomingOrPanning&&g();const F=$&&!O&&!w;c.clickDistance(R?1/0:!fe(q)||q<0?0:q);const U=F?Ni({zoomPanValues:u,noWheelClassName:I,d3Selection:l,d3Zoom:c,panOnScrollMode:E,panOnScrollSpeed:P,zoomOnPinch:L,onPanZoomStart:i,onPanZoom:r,onPanZoomEnd:a}):Mi({noWheelClassName:I,preventScrolling:M,d3ZoomHandler:m});l.on("wheel.zoom",U,{passive:!1});const Z=Ci({zoomPanValues:u,onDraggingChange:d,onPanZoomStart:i});c.on("start",Z);const G=Ii({zoomPanValues:u,panOnDrag:N,onPaneContextMenu:!!B,onPanZoom:r,onTransformChange:K});c.on("zoom",G);const X=ki({zoomPanValues:u,panOnDrag:N,panOnScroll:$,onPaneContextMenu:B,onPanZoomEnd:a,onDraggingChange:d});c.on("end",X);const J=Pi({zoomActivationKeyPressed:O,panOnDrag:N,zoomOnScroll:j,panOnScroll:$,zoomOnDoubleClick:H,zoomOnPinch:L,userSelectionActive:w,noPanClassName:D,noWheelClassName:I,lib:Y,connectionInProgress:Q});c.filter(J),H?l.on("dblclick.zoom",p):l.on("dblclick.zoom",null)}function g(){c.on("zoom",null)}async function v(I,D,B){const w=kt(I),$=c==null?void 0:c.constrain()(w,D,B);return $&&await b($),$}async function f(I,D){const B=kt(I);return await b(B,D),B}function x(I){if(l){const D=kt(I),B=l.property("__zoom");(B.k!==I.zoom||B.x!==I.x||B.y!==I.y)&&(c==null||c.transform(l,D,null,{sync:!0}))}}function k(){const I=l?xr(l.node()):{x:0,y:0,k:1};return{x:I.x,y:I.y,zoom:I.k}}async function S(I,D){return l?new Promise(B=>{c==null||c.interpolate((D==null?void 0:D.interpolate)==="linear"?Nt:ct).scaleTo(Pt(l,D==null?void 0:D.duration,D==null?void 0:D.ease,()=>B(!0)),I)}):!1}async function _(I,D){return l?new Promise(B=>{c==null||c.interpolate((D==null?void 0:D.interpolate)==="linear"?Nt:ct).scaleBy(Pt(l,D==null?void 0:D.duration,D==null?void 0:D.ease,()=>B(!0)),I)}):!1}function A(I){c==null||c.scaleExtent(I)}function T(I){c==null||c.translateExtent(I)}function V(I){const D=!fe(I)||I<0?0:I;c==null||c.clickDistance(D)}return{update:y,destroy:g,setViewport:f,setViewportConstrained:v,getViewport:k,scaleTo:S,scaleBy:_,setScaleExtent:A,setTranslateExtent:T,syncViewport:x,setClickDistance:V}}var Be;(function(e){e.Line="line",e.Handle="handle"})(Be||(Be={}));function _i({width:e,prevWidth:t,height:n,prevHeight:o,affectsX:s,affectsY:r}){const i=e-t,a=n-o,d=[i>0?1:i<0?-1:0,a>0?1:a<0?-1:0];return i&&s&&(d[0]=d[0]*-1),a&&r&&(d[1]=d[1]*-1),d}function vn(e){const t=e.includes("right")||e.includes("left"),n=e.includes("bottom")||e.includes("top"),o=e.includes("left"),s=e.includes("top");return{isHorizontal:t,isVertical:n,affectsX:o,affectsY:s}}function ve(e,t){return Math.max(0,t-e)}function Ee(e,t){return Math.max(0,e-t)}function rt(e,t,n){return Math.max(0,t-e,e-n)}function En(e,t){return e?!t:t}function Ai(e,t,n,o,s,r,i,a){let{affectsX:d,affectsY:u}=t;const{isHorizontal:h,isVertical:c}=t,l=h&&c,{xSnapped:m,ySnapped:p}=n,{minWidth:b,maxWidth:y,minHeight:g,maxHeight:v}=o,{x:f,y:x,width:k,height:S,aspectRatio:_}=e;let A=Math.floor(h?m-e.pointerX:0),T=Math.floor(c?p-e.pointerY:0);const V=k+(d?-A:A),I=S+(u?-T:T),D=-r[0]*k,B=-r[1]*S;let w=rt(V,b,y),$=rt(I,g,v);if(i){let P=0,M=0;d&&A<0?P=ve(f+A+D,i[0][0]):!d&&A>0&&(P=Ee(f+V+D,i[1][0])),u&&T<0?M=ve(x+T+B,i[0][1]):!u&&T>0&&(M=Ee(x+I+B,i[1][1])),w=Math.max(w,P),$=Math.max($,M)}if(a){let P=0,M=0;d&&A>0?P=Ee(f+A,a[0][0]):!d&&A<0&&(P=ve(f+V,a[1][0])),u&&T>0?M=Ee(x+T,a[0][1]):!u&&T<0&&(M=ve(x+I,a[1][1])),w=Math.max(w,P),$=Math.max($,M)}if(s){if(h){const P=rt(V/_,g,v)*_;if(w=Math.max(w,P),i){let M=0;!d&&!u||d&&!u&&l?M=Ee(x+B+V/_,i[1][1])*_:M=ve(x+B+(d?A:-A)/_,i[0][1])*_,w=Math.max(w,M)}if(a){let M=0;!d&&!u||d&&!u&&l?M=ve(x+V/_,a[1][1])*_:M=Ee(x+(d?A:-A)/_,a[0][1])*_,w=Math.max(w,M)}}if(c){const P=rt(I*_,b,y)/_;if($=Math.max($,P),i){let M=0;!d&&!u||u&&!d&&l?M=Ee(f+I*_+D,i[1][0])/_:M=ve(f+(u?T:-T)*_+D,i[0][0])/_,$=Math.max($,M)}if(a){let M=0;!d&&!u||u&&!d&&l?M=ve(f+I*_,a[1][0])/_:M=Ee(f+(u?T:-T)*_,a[0][0])/_,$=Math.max($,M)}}}T=T+(T<0?$:-$),A=A+(A<0?w:-w),s&&(l?V>I*_?T=(En(d,u)?-A:A)/_:A=(En(d,u)?-T:T)*_:h?(T=A/_,u=d):(A=T*_,d=u));const N=d?f+A:f,E=u?x+T:x;return{width:k+(d?-A:A),height:S+(u?-T:T),x:r[0]*A*(d?-1:1)+N,y:r[1]*T*(u?-1:1)+E}}const _o={width:0,height:0,x:0,y:0},zi={..._o,pointerX:0,pointerY:0,aspectRatio:1};function Ti(e,t,n){const o=t.position.x+e.position.x,s=t.position.y+e.position.y,r=e.measured.width??0,i=e.measured.height??0,a=n[0]*r,d=n[1]*i;return[[o-a,s-d],[o+r-a,s+i-d]]}function Di({domNode:e,nodeId:t,getStoreItems:n,onChange:o,onEnd:s}){const r=ae(e);let i={controlDirection:vn("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function a({controlPosition:u,boundaries:h,keepAspectRatio:c,resizeDirection:l,onResizeStart:m,onResize:p,onResizeEnd:b,shouldResize:y}){let g={..._o},v={...zi};i={boundaries:h,resizeDirection:l,keepAspectRatio:c,controlDirection:vn(u)};let f,x=null,k=[],S,_,A,T=!1;const V=Jn().on("start",I=>{const{nodeLookup:D,transform:B,snapGrid:w,snapToGrid:$,nodeOrigin:N,paneDomNode:E}=n();if(f=D.get(t),!f)return;x=(E==null?void 0:E.getBoundingClientRect())??null;const{xSnapped:P,ySnapped:M}=Ye(I.sourceEvent,{transform:B,snapGrid:w,snapToGrid:$,containerBounds:x});g={width:f.measured.width??0,height:f.measured.height??0,x:f.position.x??0,y:f.position.y??0},v={...g,pointerX:P,pointerY:M,aspectRatio:g.width/g.height},S=void 0,_=_e(f.extent)?f.extent:void 0,f.parentId&&(f.extent==="parent"||f.expandParent)&&(S=D.get(f.parentId)),S&&f.extent==="parent"&&(_=[[0,0],[S.measured.width,S.measured.height]]),k=[],A=void 0;for(const[L,j]of D)if(j.parentId===t&&(k.push({id:L,position:{...j.position},extent:j.extent}),j.extent==="parent"||j.expandParent)){const H=Ti(j,f,j.origin??N);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}m==null||m(I,{...g})}).on("drag",I=>{const{transform:D,snapGrid:B,snapToGrid:w,nodeOrigin:$}=n(),N=Ye(I.sourceEvent,{transform:D,snapGrid:B,snapToGrid:w,containerBounds:x}),E=[];if(!f)return;const{x:P,y:M,width:L,height:j}=g,H={},O=f.origin??$,{width:Y,height:K,x:Q,y:q}=Ai(v,i.controlDirection,N,i.boundaries,i.keepAspectRatio,O,_,A),R=Y!==L,F=K!==j,U=Q!==P&&R,Z=q!==M&&F;if(!U&&!Z&&!R&&!F)return;if((U||Z||O[0]===1||O[1]===1)&&(H.x=U?Q:g.x,H.y=Z?q:g.y,g.x=H.x,g.y=H.y,k.length>0)){const te=Q-P,ne=q-M;for(const re of k)re.position={x:re.position.x-te+O[0]*(Y-L),y:re.position.y-ne+O[1]*(K-j)},E.push(re)}if((R||F)&&(H.width=R&&(!i.resizeDirection||i.resizeDirection==="horizontal")?Y:g.width,H.height=F&&(!i.resizeDirection||i.resizeDirection==="vertical")?K:g.height,g.width=H.width,g.height=H.height),S&&f.expandParent){const te=O[0]*(H.width??0);H.x&&H.x<te&&(g.x=te,v.x=v.x-(H.x-te));const ne=O[1]*(H.height??0);H.y&&H.y<ne&&(g.y=ne,v.y=v.y-(H.y-ne))}const G=_i({width:g.width,prevWidth:L,height:g.height,prevHeight:j,affectsX:i.controlDirection.affectsX,affectsY:i.controlDirection.affectsY}),X={...g,direction:G};(y==null?void 0:y(I,X))!==!1&&(T=!0,p==null||p(I,X),o(H,E))}).on("end",I=>{T&&(b==null||b(I,{...g}),s==null||s({...g}),T=!1)});r.call(V)}function d(){r.on(".drag",null)}return{update:a,destroy:d}}const Li={},Sn=e=>{let t;const n=new Set,o=(h,c)=>{const l=typeof h=="function"?h(t):h;if(!Object.is(l,t)){const m=t;t=c??(typeof l!="object"||l===null)?l:Object.assign({},t,l),n.forEach(p=>p(t,m))}},s=()=>t,d={setState:o,getState:s,getInitialState:()=>u,subscribe:h=>(n.add(h),()=>n.delete(h)),destroy:()=>{(Li?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},u=t=e(o,s,d);return d},ji=e=>e?Sn(e):Sn,{useDebugValue:Hi}=br,{useSyncExternalStoreWithSelector:Ri}=wr,Bi=e=>e;function Ao(e,t=Bi,n){const o=Ri(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return Hi(o),o}const Nn=(e,t)=>{const n=ji(e),o=(s,r=t)=>Ao(n,s,r);return Object.assign(o,n),o},Vi=(e,t)=>e?Nn(e,t):Nn;function oe(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[o,s]of e)if(!Object.is(s,t.get(o)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const o of e)if(!t.has(o))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const o of n)if(!Object.prototype.hasOwnProperty.call(t,o)||!Object.is(e[o],t[o]))return!1;return!0}const mt=z.createContext(null),Fi=mt.Provider,zo=ge.error001("react");function ee(e,t){const n=z.useContext(mt);if(n===null)throw new Error(zo);return Ao(n,e,t)}function se(){const e=z.useContext(mt);if(e===null)throw new Error(zo);return z.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const Mn={display:"none"},Oi={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},To="react-flow__node-desc",Do="react-flow__edge-desc",Yi="react-flow__aria-live",Xi=e=>e.ariaLiveMessage,Wi=e=>e.ariaLabelConfig;function Gi({rfId:e}){const t=ee(Xi);return C.jsx("div",{id:`${Yi}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:Oi,children:t})}function qi({rfId:e,disableKeyboardA11y:t}){const n=ee(Wi);return C.jsxs(C.Fragment,{children:[C.jsx("div",{id:`${To}-${e}`,style:Mn,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),C.jsx("div",{id:`${Do}-${e}`,style:Mn,children:n["edge.a11yDescription.default"]}),!t&&C.jsx(Gi,{rfId:e})]})}const yt=z.forwardRef(({position:e="top-left",children:t,className:n,style:o,...s},r)=>{const i=`${e}`.split("-");return C.jsx("div",{className:ie(["react-flow__panel",n,...i]),style:o,ref:r,...s,children:t})});yt.displayName="Panel";const Cn="https://reactflow.dev?utm_source=attribution";function Ki({proOptions:e,position:t="bottom-right"}){return e!=null&&e.hideAttribution?null:C.jsx(yt,{position:t,className:"react-flow__attribution","data-message":`Please only hide this attribution when you are subscribed to React Flow Pro: ${Cn}`,children:C.jsx("a",{href:Cn,target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const Zi=e=>{const t=[],n=[];for(const[,o]of e.nodeLookup)o.selected&&t.push(o.internals.userNode);for(const[,o]of e.edgeLookup)o.selected&&n.push(o);return{selectedNodes:t,selectedEdges:n}},it=e=>e.id;function Ui(e,t){return oe(e.selectedNodes.map(it),t.selectedNodes.map(it))&&oe(e.selectedEdges.map(it),t.selectedEdges.map(it))}function Qi({onSelectionChange:e}){const t=se(),{selectedNodes:n,selectedEdges:o}=ee(Zi,Ui);return z.useEffect(()=>{const s={nodes:n,edges:o};e==null||e(s),t.getState().onSelectionChangeHandlers.forEach(r=>r(s))},[n,o,e]),null}const Ji=e=>!!e.onSelectionChangeHandlers;function ea({onSelectionChange:e}){const t=ee(Ji);return e||t?C.jsx(Qi,{onSelectionChange:e}):null}const Lo=[0,0],ta={x:0,y:0,zoom:1},na=["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"],In=[...na,"rfId"],oa=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}),kn={translateExtent:We,nodeOrigin:Lo,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function sa(e){const{setNodes:t,setEdges:n,setMinZoom:o,setMaxZoom:s,setTranslateExtent:r,setNodeExtent:i,reset:a,setDefaultNodesAndEdges:d}=ee(oa,oe),u=se();z.useEffect(()=>(d(e.defaultNodes,e.defaultEdges),()=>{h.current=kn,a()}),[]);const h=z.useRef(kn);return z.useEffect(()=>{for(const c of In){const l=e[c],m=h.current[c];l!==m&&(typeof e[c]>"u"||(c==="nodes"?t(l):c==="edges"?n(l):c==="minZoom"?o(l):c==="maxZoom"?s(l):c==="translateExtent"?r(l):c==="nodeExtent"?i(l):c==="ariaLabelConfig"?u.setState({ariaLabelConfig:qr(l)}):c==="fitView"?u.setState({fitViewQueued:l}):c==="fitViewOptions"?u.setState({fitViewOptions:l}):u.setState({[c]:l})))}h.current=e},In.map(c=>e[c])),null}function Pn(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function ra(e){var o;const[t,n]=z.useState(e==="system"?null:e);return z.useEffect(()=>{if(e!=="system"){n(e);return}const s=Pn(),r=()=>n(s!=null&&s.matches?"dark":"light");return r(),s==null||s.addEventListener("change",r),()=>{s==null||s.removeEventListener("change",r)}},[e]),t!==null?t:(o=Pn())!=null&&o.matches?"dark":"light"}const $n=typeof document<"u"?document:null;function Ze(e=null,t={target:$n,actInsideInputWithModifier:!0}){const[n,o]=z.useState(!1),s=z.useRef(!1),r=z.useRef(new Set([])),[i,a]=z.useMemo(()=>{if(e!==null){const u=(Array.isArray(e)?e:[e]).filter(c=>typeof c=="string").map(c=>c.replace("+",`
1
+ import{d as ae,bq as Zn,br as Rt,bs as Et,bt as St,bu as xr,bv as wr,bw as br,r as z,j as C,aJ as vr,aL as le,aI as Er,bx as Sr}from"./index-9mF0_S-1.js";import{i as Nt}from"./value-CCp47p1v.js";function Nr(e){let t;for(;t=e.sourceEvent;)e=t;return e}function de(e,t){if(e=Nr(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 s=t.getBoundingClientRect();return[e.clientX-s.left-t.clientLeft,e.clientY-s.top-t.clientTop]}}return[e.pageX,e.pageY]}const Mr={passive:!1},Xe={capture:!0,passive:!1};function Mt(e){e.stopImmediatePropagation()}function Le(e){e.preventDefault(),e.stopImmediatePropagation()}function Un(e){var t=e.document.documentElement,n=ae(e).on("dragstart.drag",Le,Xe);"onselectstart"in t?n.on("selectstart.drag",Le,Xe):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function Qn(e,t){var n=e.document.documentElement,o=ae(e).on("dragstart.drag",null);t&&(o.on("click.drag",Le,Xe),setTimeout(function(){o.on("click.drag",null)},0)),"onselectstart"in n?o.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}const nt=e=>()=>e;function At(e,{sourceEvent:t,subject:n,target:o,identifier:s,active:r,x:i,y:a,dx:d,dy:u,dispatch:h}){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:s,enumerable:!0,configurable:!0},active:{value:r,enumerable:!0,configurable:!0},x:{value:i,enumerable:!0,configurable:!0},y:{value:a,enumerable:!0,configurable:!0},dx:{value:d,enumerable:!0,configurable:!0},dy:{value:u,enumerable:!0,configurable:!0},_:{value:h}})}At.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function Cr(e){return!e.ctrlKey&&!e.button}function Ir(){return this.parentNode}function kr(e,t){return t??{x:e.x,y:e.y}}function Pr(){return navigator.maxTouchPoints||"ontouchstart"in this}function Jn(){var e=Cr,t=Ir,n=kr,o=Pr,s={},r=Zn("start","drag","end"),i=0,a,d,u,h,c=0;function l(x){x.on("mousedown.drag",m).filter(o).on("touchstart.drag",y).on("touchmove.drag",g,Mr).on("touchend.drag touchcancel.drag",v).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function m(x,k){if(!(h||!e.call(this,x,k))){var S=f(this,t.call(this,x,k),x,k,"mouse");S&&(ae(x.view).on("mousemove.drag",p,Xe).on("mouseup.drag",b,Xe),Un(x.view),Mt(x),u=!1,a=x.clientX,d=x.clientY,S("start",x))}}function p(x){if(Le(x),!u){var k=x.clientX-a,S=x.clientY-d;u=k*k+S*S>c}s.mouse("drag",x)}function b(x){ae(x.view).on("mousemove.drag mouseup.drag",null),Qn(x.view,u),Le(x),s.mouse("end",x)}function y(x,k){if(e.call(this,x,k)){var S=x.changedTouches,_=t.call(this,x,k),A=S.length,T,V;for(T=0;T<A;++T)(V=f(this,_,x,k,S[T].identifier,S[T]))&&(Mt(x),V("start",x,S[T]))}}function g(x){var k=x.changedTouches,S=k.length,_,A;for(_=0;_<S;++_)(A=s[k[_].identifier])&&(Le(x),A("drag",x,k[_]))}function v(x){var k=x.changedTouches,S=k.length,_,A;for(h&&clearTimeout(h),h=setTimeout(function(){h=null},500),_=0;_<S;++_)(A=s[k[_].identifier])&&(Mt(x),A("end",x,k[_]))}function f(x,k,S,_,A,T){var V=r.copy(),I=de(T||S,k),D,B,w;if((w=n.call(x,new At("beforestart",{sourceEvent:S,target:l,identifier:A,active:i,x:I[0],y:I[1],dx:0,dy:0,dispatch:V}),_))!=null)return D=w.x-I[0]||0,B=w.y-I[1]||0,function $(N,E,P){var M=I,L;switch(N){case"start":s[A]=$,L=i++;break;case"end":delete s[A],--i;case"drag":I=de(P||E,k),L=i;break}V.call(N,x,new At(N,{sourceEvent:E,subject:w,target:l,identifier:A,active:L,x:I[0]+D,y:I[1]+B,dx:I[0]-M[0],dy:I[1]-M[1],dispatch:V}),_)}}return l.filter=function(x){return arguments.length?(e=typeof x=="function"?x:nt(!!x),l):e},l.container=function(x){return arguments.length?(t=typeof x=="function"?x:nt(x),l):t},l.subject=function(x){return arguments.length?(n=typeof x=="function"?x:nt(x),l):n},l.touchable=function(x){return arguments.length?(o=typeof x=="function"?x:nt(!!x),l):o},l.on=function(){var x=r.on.apply(r,arguments);return x===r?l:x},l.clickDistance=function(x){return arguments.length?(c=(x=+x)*x,l):Math.sqrt(c)},l}var $r=1e-12;function rn(e){return((e=Math.exp(e))+1/e)/2}function _r(e){return((e=Math.exp(e))-1/e)/2}function Ar(e){return((e=Math.exp(2*e))-1)/(e+1)}const ct=(function e(t,n,o){function s(r,i){var a=r[0],d=r[1],u=r[2],h=i[0],c=i[1],l=i[2],m=h-a,p=c-d,b=m*m+p*p,y,g;if(b<$r)g=Math.log(l/u)/t,y=function(_){return[a+_*m,d+_*p,u*Math.exp(t*_*g)]};else{var v=Math.sqrt(b),f=(l*l-u*u+o*b)/(2*u*n*v),x=(l*l-u*u-o*b)/(2*l*n*v),k=Math.log(Math.sqrt(f*f+1)-f),S=Math.log(Math.sqrt(x*x+1)-x);g=(S-k)/t,y=function(_){var A=_*g,T=rn(k),V=u/(n*v)*(T*Ar(t*A+k)-_r(k));return[a+V*m,d+V*p,u*T/rn(t*A+k)]}}return y.duration=g*1e3*t/Math.SQRT2,y}return s.rho=function(r){var i=Math.max(.001,+r),a=i*i,d=a*a;return e(i,a,d)},s})(Math.SQRT2,2,4),ot=e=>()=>e;function zr(e,{sourceEvent:t,target:n,transform:o,dispatch:s}){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:s}})}function Ct(e){e.stopImmediatePropagation()}function Oe(e){e.preventDefault(),e.stopImmediatePropagation()}function Tr(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function Dr(){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 an(){return this.__zoom||Rt}function Lr(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function jr(){return navigator.maxTouchPoints||"ontouchstart"in this}function Hr(e,t,n){var o=e.invertX(t[0][0])-n[0][0],s=e.invertX(t[1][0])-n[1][0],r=e.invertY(t[0][1])-n[0][1],i=e.invertY(t[1][1])-n[1][1];return e.translate(s>o?(o+s)/2:Math.min(0,o)||Math.max(0,s),i>r?(r+i)/2:Math.min(0,r)||Math.max(0,i))}function eo(){var e=Tr,t=Dr,n=Hr,o=Lr,s=jr,r=[0,1/0],i=[[-1/0,-1/0],[1/0,1/0]],a=250,d=ct,u=Zn("start","zoom","end"),h,c,l,m=500,p=150,b=0,y=10;function g(w){w.property("__zoom",an).on("wheel.zoom",A,{passive:!1}).on("mousedown.zoom",T).on("dblclick.zoom",V).filter(s).on("touchstart.zoom",I).on("touchmove.zoom",D).on("touchend.zoom touchcancel.zoom",B).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}g.transform=function(w,$,N,E){var P=w.selection?w.selection():w;P.property("__zoom",an),w!==P?k(w,$,N,E):P.interrupt().each(function(){S(this,arguments).event(E).start().zoom(null,typeof $=="function"?$.apply(this,arguments):$).end()})},g.scaleBy=function(w,$,N,E){g.scaleTo(w,function(){var P=this.__zoom.k,M=typeof $=="function"?$.apply(this,arguments):$;return P*M},N,E)},g.scaleTo=function(w,$,N,E){g.transform(w,function(){var P=t.apply(this,arguments),M=this.__zoom,L=N==null?x(P):typeof N=="function"?N.apply(this,arguments):N,j=M.invert(L),H=typeof $=="function"?$.apply(this,arguments):$;return n(f(v(M,H),L,j),P,i)},N,E)},g.translateBy=function(w,$,N,E){g.transform(w,function(){return n(this.__zoom.translate(typeof $=="function"?$.apply(this,arguments):$,typeof N=="function"?N.apply(this,arguments):N),t.apply(this,arguments),i)},null,E)},g.translateTo=function(w,$,N,E,P){g.transform(w,function(){var M=t.apply(this,arguments),L=this.__zoom,j=E==null?x(M):typeof E=="function"?E.apply(this,arguments):E;return n(Rt.translate(j[0],j[1]).scale(L.k).translate(typeof $=="function"?-$.apply(this,arguments):-$,typeof N=="function"?-N.apply(this,arguments):-N),M,i)},E,P)};function v(w,$){return $=Math.max(r[0],Math.min(r[1],$)),$===w.k?w:new Et($,w.x,w.y)}function f(w,$,N){var E=$[0]-N[0]*w.k,P=$[1]-N[1]*w.k;return E===w.x&&P===w.y?w:new Et(w.k,E,P)}function x(w){return[(+w[0][0]+ +w[1][0])/2,(+w[0][1]+ +w[1][1])/2]}function k(w,$,N,E){w.on("start.zoom",function(){S(this,arguments).event(E).start()}).on("interrupt.zoom end.zoom",function(){S(this,arguments).event(E).end()}).tween("zoom",function(){var P=this,M=arguments,L=S(P,M).event(E),j=t.apply(P,M),H=N==null?x(j):typeof N=="function"?N.apply(P,M):N,O=Math.max(j[1][0]-j[0][0],j[1][1]-j[0][1]),Y=P.__zoom,K=typeof $=="function"?$.apply(P,M):$,Q=d(Y.invert(H).concat(O/Y.k),K.invert(H).concat(O/K.k));return function(q){if(q===1)q=K;else{var R=Q(q),F=O/R[2];q=new Et(F,H[0]-R[0]*F,H[1]-R[1]*F)}L.zoom(null,q)}})}function S(w,$,N){return!N&&w.__zooming||new _(w,$)}function _(w,$){this.that=w,this.args=$,this.active=0,this.sourceEvent=null,this.extent=t.apply(w,$),this.taps=0}_.prototype={event:function(w){return w&&(this.sourceEvent=w),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(w,$){return this.mouse&&w!=="mouse"&&(this.mouse[1]=$.invert(this.mouse[0])),this.touch0&&w!=="touch"&&(this.touch0[1]=$.invert(this.touch0[0])),this.touch1&&w!=="touch"&&(this.touch1[1]=$.invert(this.touch1[0])),this.that.__zoom=$,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(w){var $=ae(this.that).datum();u.call(w,this.that,new zr(w,{sourceEvent:this.sourceEvent,target:g,transform:this.that.__zoom,dispatch:u}),$)}};function A(w,...$){if(!e.apply(this,arguments))return;var N=S(this,$).event(w),E=this.__zoom,P=Math.max(r[0],Math.min(r[1],E.k*Math.pow(2,o.apply(this,arguments)))),M=de(w);if(N.wheel)(N.mouse[0][0]!==M[0]||N.mouse[0][1]!==M[1])&&(N.mouse[1]=E.invert(N.mouse[0]=M)),clearTimeout(N.wheel);else{if(E.k===P)return;N.mouse=[M,E.invert(M)],St(this),N.start()}Oe(w),N.wheel=setTimeout(L,p),N.zoom("mouse",n(f(v(E,P),N.mouse[0],N.mouse[1]),N.extent,i));function L(){N.wheel=null,N.end()}}function T(w,...$){if(l||!e.apply(this,arguments))return;var N=w.currentTarget,E=S(this,$,!0).event(w),P=ae(w.view).on("mousemove.zoom",H,!0).on("mouseup.zoom",O,!0),M=de(w,N),L=w.clientX,j=w.clientY;Un(w.view),Ct(w),E.mouse=[M,this.__zoom.invert(M)],St(this),E.start();function H(Y){if(Oe(Y),!E.moved){var K=Y.clientX-L,Q=Y.clientY-j;E.moved=K*K+Q*Q>b}E.event(Y).zoom("mouse",n(f(E.that.__zoom,E.mouse[0]=de(Y,N),E.mouse[1]),E.extent,i))}function O(Y){P.on("mousemove.zoom mouseup.zoom",null),Qn(Y.view,E.moved),Oe(Y),E.event(Y).end()}}function V(w,...$){if(e.apply(this,arguments)){var N=this.__zoom,E=de(w.changedTouches?w.changedTouches[0]:w,this),P=N.invert(E),M=N.k*(w.shiftKey?.5:2),L=n(f(v(N,M),E,P),t.apply(this,$),i);Oe(w),a>0?ae(this).transition().duration(a).call(k,L,E,w):ae(this).call(g.transform,L,E,w)}}function I(w,...$){if(e.apply(this,arguments)){var N=w.touches,E=N.length,P=S(this,$,w.changedTouches.length===E).event(w),M,L,j,H;for(Ct(w),L=0;L<E;++L)j=N[L],H=de(j,this),H=[H,this.__zoom.invert(H),j.identifier],P.touch0?!P.touch1&&P.touch0[2]!==H[2]&&(P.touch1=H,P.taps=0):(P.touch0=H,M=!0,P.taps=1+!!h);h&&(h=clearTimeout(h)),M&&(P.taps<2&&(c=H[0],h=setTimeout(function(){h=null},m)),St(this),P.start())}}function D(w,...$){if(this.__zooming){var N=S(this,$).event(w),E=w.changedTouches,P=E.length,M,L,j,H;for(Oe(w),M=0;M<P;++M)L=E[M],j=de(L,this),N.touch0&&N.touch0[2]===L.identifier?N.touch0[0]=j:N.touch1&&N.touch1[2]===L.identifier&&(N.touch1[0]=j);if(L=N.that.__zoom,N.touch1){var O=N.touch0[0],Y=N.touch0[1],K=N.touch1[0],Q=N.touch1[1],q=(q=K[0]-O[0])*q+(q=K[1]-O[1])*q,R=(R=Q[0]-Y[0])*R+(R=Q[1]-Y[1])*R;L=v(L,Math.sqrt(q/R)),j=[(O[0]+K[0])/2,(O[1]+K[1])/2],H=[(Y[0]+Q[0])/2,(Y[1]+Q[1])/2]}else if(N.touch0)j=N.touch0[0],H=N.touch0[1];else return;N.zoom("touch",n(f(L,j,H),N.extent,i))}}function B(w,...$){if(this.__zooming){var N=S(this,$).event(w),E=w.changedTouches,P=E.length,M,L;for(Ct(w),l&&clearTimeout(l),l=setTimeout(function(){l=null},m),M=0;M<P;++M)L=E[M],N.touch0&&N.touch0[2]===L.identifier?delete N.touch0:N.touch1&&N.touch1[2]===L.identifier&&delete N.touch1;if(N.touch1&&!N.touch0&&(N.touch0=N.touch1,delete N.touch1),N.touch0)N.touch0[1]=this.__zoom.invert(N.touch0[0]);else if(N.end(),N.taps===2&&(L=de(L,this),Math.hypot(c[0]-L[0],c[1]-L[1])<y)){var j=ae(this).on("dblclick.zoom");j&&j.apply(this,arguments)}}}return g.wheelDelta=function(w){return arguments.length?(o=typeof w=="function"?w:ot(+w),g):o},g.filter=function(w){return arguments.length?(e=typeof w=="function"?w:ot(!!w),g):e},g.touchable=function(w){return arguments.length?(s=typeof w=="function"?w:ot(!!w),g):s},g.extent=function(w){return arguments.length?(t=typeof w=="function"?w:ot([[+w[0][0],+w[0][1]],[+w[1][0],+w[1][1]]]),g):t},g.scaleExtent=function(w){return arguments.length?(r[0]=+w[0],r[1]=+w[1],g):[r[0],r[1]]},g.translateExtent=function(w){return arguments.length?(i[0][0]=+w[0][0],i[1][0]=+w[1][0],i[0][1]=+w[0][1],i[1][1]=+w[1][1],g):[[i[0][0],i[0][1]],[i[1][0],i[1][1]]]},g.constrain=function(w){return arguments.length?(n=w,g):n},g.duration=function(w){return arguments.length?(a=+w,g):a},g.interpolate=function(w){return arguments.length?(d=w,g):d},g.on=function(){var w=u.on.apply(u,arguments);return w===u?g:w},g.clickDistance=function(w){return arguments.length?(b=(w=+w)*w,g):Math.sqrt(b)},g.tapDistance=function(w){return arguments.length?(y=+w,g):y},g}function ie(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=ie(e[n]))!==""&&(t+=(t&&" ")+o);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}const ge={error001:(e="react")=>`Seems like you have not used ${e==="svelte"?"SvelteFlowProvider":"ReactFlowProvider"} as an ancestor. Help: https://${e}flow.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 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.",error016:e=>`Edge with id "${e}" does not exist, it may have been removed. This can happen when an edge is deleted before the "onEdgeClick" handler is called.`},We=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],to=["Enter"," ","Escape"],no={"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"};var je;(function(e){e.Strict="strict",e.Loose="loose"})(je||(je={}));var Pe;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(Pe||(Pe={}));var Ge;(function(e){e.Partial="partial",e.Full="full"})(Ge||(Ge={}));const oo={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var Se;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Se||(Se={}));var lt;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(lt||(lt={}));var W;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(W||(W={}));const cn={[W.Left]:W.Right,[W.Right]:W.Left,[W.Top]:W.Bottom,[W.Bottom]:W.Top};function so(e){return e===null?null:e?"valid":"invalid"}const ro=e=>"id"in e&&"source"in e&&"target"in e,Rr=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),Bt=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),Ue=(e,t=[0,0])=>{const{width:n,height:o}=be(e),s=e.origin??t,r=n*s[0],i=o*s[1];return{x:e.position.x-r,y:e.position.y-i}},Br=(e,t={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((o,s)=>{const r=typeof s=="string";let i=!t.nodeLookup&&!r?s:void 0;t.nodeLookup&&(i=r?t.nodeLookup.get(s):Bt(s)?s:t.nodeLookup.get(s.id));const a=i?ut(i,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return ht(o,a)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return gt(n)},Qe=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},o=!1;return e.forEach(s=>{(t.filter===void 0||t.filter(s))&&(n=ht(n,ut(s)),o=!0)}),o?gt(n):{x:0,y:0,width:0,height:0}},Vt=(e,t,[n,o,s]=[0,0,1],r=!1,i=!1)=>{const a=(t.x-n)/s,d=(t.y-o)/s,u=t.width/s,h=t.height/s,c=[];for(const l of e.values()){const{measured:m,selectable:p=!0,hidden:b=!1}=l;if(i&&!p||b)continue;const y=m.width??l.width??l.initialWidth??0,g=m.height??l.height??l.initialHeight??0,{x:v,y:f}=l.internals.positionAbsolute,x=lo(a,d,u,h,v,f,y,g),k=y*g,S=r&&x>0;(!l.internals.handleBounds||S||x>=k||l.dragging)&&c.push(l)}return c},Vr=(e,t)=>{const n=new Set;return e.forEach(o=>{n.add(o.id)}),t.filter(o=>n.has(o.source)||n.has(o.target))};function Fr(e,t){const n=new Map,o=t!=null&&t.nodes?new Set(t.nodes.map(s=>s.id)):null;return e.forEach(s=>{s.measured.width&&s.measured.height&&((t==null?void 0:t.includeHiddenNodes)||!s.hidden)&&(!o||o.has(s.id))&&n.set(s.id,s)}),n}async function Or({nodes:e,width:t,height:n,panZoom:o,minZoom:s,maxZoom:r},i){if(e.size===0)return!0;const a=Fr(e,i),d=Qe(a),u=Ot(d,t,n,(i==null?void 0:i.minZoom)??s,(i==null?void 0:i.maxZoom)??r,(i==null?void 0:i.padding)??.1);return await o.setViewport(u,{duration:i==null?void 0:i.duration,ease:i==null?void 0:i.ease,interpolate:i==null?void 0:i.interpolate}),!0}function io({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:o=[0,0],nodeExtent:s,onError:r}){const i=n.get(e),a=i.parentId?n.get(i.parentId):void 0,{x:d,y:u}=a?a.internals.positionAbsolute:{x:0,y:0},h=i.origin??o;let c=i.extent||s;if(i.extent==="parent"&&!i.expandParent)if(!a)r==null||r("005",ge.error005());else{const m=a.measured.width,p=a.measured.height;m&&p&&(c=[[d,u],[d+m,u+p]])}else a&&_e(i.extent)&&(c=[[i.extent[0][0]+d,i.extent[0][1]+u],[i.extent[1][0]+d,i.extent[1][1]+u]]);const l=_e(c)?$e(t,c,i.measured):t;return(i.measured.width===void 0||i.measured.height===void 0)&&(r==null||r("015",ge.error015())),{position:{x:l.x-d+(i.measured.width??0)*h[0],y:l.y-u+(i.measured.height??0)*h[1]},positionAbsolute:l}}async function Yr({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:o,onBeforeDelete:s}){const r=new Set(e.map(l=>l.id)),i=[];for(const l of n){if(l.deletable===!1)continue;const m=r.has(l.id),p=!m&&l.parentId&&i.find(b=>b.id===l.parentId);(m||p)&&i.push(l)}const a=new Set(t.map(l=>l.id)),d=o.filter(l=>l.deletable!==!1),h=Vr(i,d);for(const l of d)a.has(l.id)&&!h.find(p=>p.id===l.id)&&h.push(l);if(!s)return{edges:h,nodes:i};const c=await s({nodes:i,edges:h});return typeof c=="boolean"?c?{edges:h,nodes:i}:{edges:[],nodes:[]}:c}const He=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),$e=(e={x:0,y:0},t,n)=>({x:He(e.x,t[0][0],t[1][0]-((n==null?void 0:n.width)??0)),y:He(e.y,t[0][1],t[1][1]-((n==null?void 0:n.height)??0))});function ao(e,t,n){const{width:o,height:s}=be(n),{x:r,y:i}=n.internals.positionAbsolute;return $e(e,[[r,i],[r+o,i+s]],t)}const ln=(e,t,n)=>e<t?He(Math.abs(e-t),1,t)/t:e>n?-He(Math.abs(e-n),1,t)/t:0,Ft=(e,t,n=15,o=40)=>{const s=ln(e.x,o,t.width-o)*n,r=ln(e.y,o,t.height-o)*n;return[s,r]},ht=(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)}),zt=({x:e,y:t,width:n,height:o})=>({x:e,y:t,x2:e+n,y2:t+o}),gt=({x:e,y:t,x2:n,y2:o})=>({x:e,y:t,width:n-e,height:o-t}),qe=(e,t=[0,0])=>{var s,r;const{x:n,y:o}=Bt(e)?e.internals.positionAbsolute:Ue(e,t);return{x:n,y:o,width:((s=e.measured)==null?void 0:s.width)??e.width??e.initialWidth??0,height:((r=e.measured)==null?void 0:r.height)??e.height??e.initialHeight??0}},ut=(e,t=[0,0])=>{var s,r;const{x:n,y:o}=Bt(e)?e.internals.positionAbsolute:Ue(e,t);return{x:n,y:o,x2:n+(((s=e.measured)==null?void 0:s.width)??e.width??e.initialWidth??0),y2:o+(((r=e.measured)==null?void 0:r.height)??e.height??e.initialHeight??0)}},co=(e,t)=>gt(ht(zt(e),zt(t))),lo=(e,t,n,o,s,r,i,a)=>{const d=Math.max(0,Math.min(e+n,s+i)-Math.max(e,s)),u=Math.max(0,Math.min(t+o,r+a)-Math.max(t,r));return Math.ceil(d*u)},dt=(e,t)=>lo(e.x,e.y,e.width,e.height,t.x,t.y,t.width,t.height),un=e=>fe(e.width)&&fe(e.height)&&fe(e.x)&&fe(e.y),fe=e=>!isNaN(e)&&isFinite(e),uo=(e,t)=>(n,o)=>{},Je=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),et=({x:e,y:t},[n,o,s],r=!1,i=[1,1])=>{const a={x:(e-n)/s,y:(t-o)/s};return r?Je(a,i):a},Re=({x:e,y:t},[n,o,s])=>({x:e*s+n,y:t*s+o});function ze(e,t){if(typeof e=="number")return Math.floor((t-t/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(n)}if(typeof e=="string"&&e.endsWith("%")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return console.error(`The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function Xr(e,t,n){if(typeof e=="string"||typeof e=="number"){const o=ze(e,n),s=ze(e,t);return{top:o,right:s,bottom:o,left:s,x:s*2,y:o*2}}if(typeof e=="object"){const o=ze(e.top??e.y??0,n),s=ze(e.bottom??e.y??0,n),r=ze(e.left??e.x??0,t),i=ze(e.right??e.x??0,t);return{top:o,right:i,bottom:s,left:r,x:r+i,y:o+s}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function Wr(e,t,n,o,s,r){const{x:i,y:a}=Re(e,[t,n,o]),{x:d,y:u}=Re({x:e.x+e.width,y:e.y+e.height},[t,n,o]),h=s-d,c=r-u;return{left:Math.floor(i),top:Math.floor(a),right:Math.floor(h),bottom:Math.floor(c)}}const Ot=(e,t,n,o,s,r)=>{const i=Xr(r,t,n),a=(t-i.x)/e.width,d=(n-i.y)/e.height,u=Math.min(a,d),h=He(u,o,s),c=e.x+e.width/2,l=e.y+e.height/2,m=t/2-c*h,p=n/2-l*h,b=Wr(e,m,p,h,t,n),y={left:Math.min(b.left-i.left,0),top:Math.min(b.top-i.top,0),right:Math.min(b.right-i.right,0),bottom:Math.min(b.bottom-i.bottom,0)};return{x:m-y.left+y.right,y:p-y.top+y.bottom,zoom:h}},Ke=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function _e(e){return e!=null&&e!=="parent"}function be(e){var t,n;return{width:((t=e.measured)==null?void 0:t.width)??e.width??e.initialWidth??0,height:((n=e.measured)==null?void 0:n.height)??e.height??e.initialHeight??0}}function fo(e){var t,n;return(((t=e.measured)==null?void 0:t.width)??e.width??e.initialWidth)!==void 0&&(((n=e.measured)==null?void 0:n.height)??e.height??e.initialHeight)!==void 0}function ho(e,t={width:0,height:0},n,o,s){const r={...e},i=o.get(n);if(i){const a=i.origin||s;r.x+=i.internals.positionAbsolute.x-(t.width??0)*a[0],r.y+=i.internals.positionAbsolute.y-(t.height??0)*a[1]}return r}function dn(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function Gr(){let e,t;return{promise:new Promise((o,s)=>{e=o,t=s}),resolve:e,reject:t}}function qr(e){return{...no,...e||{}}}function Ye(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:o,containerBounds:s}){const{x:r,y:i}=he(e),a=et({x:r-((s==null?void 0:s.left)??0),y:i-((s==null?void 0:s.top)??0)},o),{x:d,y:u}=n?Je(a,t):a;return{xSnapped:d,ySnapped:u,...a}}const Yt=e=>({width:e.offsetWidth,height:e.offsetHeight}),go=e=>{var t;return((t=e==null?void 0:e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},Kr=["INPUT","SELECT","TEXTAREA"];function po(e){var o,s;const t=((s=(o=e.composedPath)==null?void 0:o.call(e))==null?void 0:s[0])||e.target;return(t==null?void 0:t.nodeType)!==1?!1:Kr.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const mo=e=>"clientX"in e,he=(e,t)=>{var r,i;const n=mo(e),o=n?e.clientX:(r=e.touches)==null?void 0:r[0].clientX,s=n?e.clientY:(i=e.touches)==null?void 0:i[0].clientY;return{x:o-((t==null?void 0:t.left)??0),y:s-((t==null?void 0:t.top)??0)}},fn=(e,t,n,o,s)=>{const r=t.querySelectorAll(`.${e}`);return!r||!r.length?null:Array.from(r).map(i=>{const a=i.getBoundingClientRect();return{id:i.getAttribute("data-handleid"),type:e,nodeId:s,position:i.getAttribute("data-handlepos"),x:(a.left-n.left)/o,y:(a.top-n.top)/o,...Yt(i)}})};function yo({sourceX:e,sourceY:t,targetX:n,targetY:o,sourceControlX:s,sourceControlY:r,targetControlX:i,targetControlY:a}){const d=e*.125+s*.375+i*.375+n*.125,u=t*.125+r*.375+a*.375+o*.125,h=Math.abs(d-e),c=Math.abs(u-t);return[d,u,h,c]}function st(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function hn({pos:e,x1:t,y1:n,x2:o,y2:s,c:r}){switch(e){case W.Left:return[t-st(t-o,r),n];case W.Right:return[t+st(o-t,r),n];case W.Top:return[t,n-st(n-s,r)];case W.Bottom:return[t,n+st(s-n,r)]}}function xo({sourceX:e,sourceY:t,sourcePosition:n=W.Bottom,targetX:o,targetY:s,targetPosition:r=W.Top,curvature:i=.25}){const[a,d]=hn({pos:n,x1:e,y1:t,x2:o,y2:s,c:i}),[u,h]=hn({pos:r,x1:o,y1:s,x2:e,y2:t,c:i}),[c,l,m,p]=yo({sourceX:e,sourceY:t,targetX:o,targetY:s,sourceControlX:a,sourceControlY:d,targetControlX:u,targetControlY:h});return[`M${e},${t} C${a},${d} ${u},${h} ${o},${s}`,c,l,m,p]}function wo({sourceX:e,sourceY:t,targetX:n,targetY:o}){const s=Math.abs(n-e)/2,r=n<e?n+s:n-s,i=Math.abs(o-t)/2,a=o<t?o+i:o-i;return[r,a,s,i]}function Zr({sourceNode:e,targetNode:t,selected:n=!1,zIndex:o=0,elevateOnSelect:s=!1,zIndexMode:r="basic"}){if(r==="manual")return o;const i=s&&n?o+1e3:o,a=Math.max(e.parentId||s&&e.selected?e.internals.z:0,t.parentId||s&&t.selected?t.internals.z:0);return i+a}function Ur({sourceNode:e,targetNode:t,width:n,height:o,transform:s}){const r=ht(ut(e),ut(t));r.x===r.x2&&(r.x2+=1),r.y===r.y2&&(r.y2+=1);const i={x:-s[0]/s[2],y:-s[1]/s[2],width:n/s[2],height:o/s[2]};return dt(i,gt(r))>0}const Qr=({source:e,sourceHandle:t,target:n,targetHandle:o})=>`xy-edge__${e}${t||""}-${n}${o||""}`,Jr=(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)),ei=(e,t,n={})=>{var r;if(!e.source||!e.target)return(r=n.onError)==null||r.call(n,"006",ge.error006()),t;const o=n.getEdgeId||Qr;let s;return ro(e)?s={...e}:s={...e,id:o(e)},Jr(s,t)?t:(s.sourceHandle===null&&delete s.sourceHandle,s.targetHandle===null&&delete s.targetHandle,t.concat(s))};function bo({sourceX:e,sourceY:t,targetX:n,targetY:o}){const[s,r,i,a]=wo({sourceX:e,sourceY:t,targetX:n,targetY:o});return[`M ${e},${t}L ${n},${o}`,s,r,i,a]}const gn={[W.Left]:{x:-1,y:0},[W.Right]:{x:1,y:0},[W.Top]:{x:0,y:-1},[W.Bottom]:{x:0,y:1}},ti=({source:e,sourcePosition:t=W.Bottom,target:n})=>t===W.Left||t===W.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},pn=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function ni({source:e,sourcePosition:t=W.Bottom,target:n,targetPosition:o=W.Top,center:s,offset:r,stepPosition:i}){const a=gn[t],d=gn[o],u={x:e.x+a.x*r,y:e.y+a.y*r},h={x:n.x+d.x*r,y:n.y+d.y*r},c=ti({source:u,sourcePosition:t,target:h}),l=c.x!==0?"x":"y",m=c[l];let p=[],b,y;const g={x:0,y:0},v={x:0,y:0},[,,f,x]=wo({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(a[l]*d[l]===-1){l==="x"?(b=s.x??u.x+(h.x-u.x)*i,y=s.y??(u.y+h.y)/2):(b=s.x??(u.x+h.x)/2,y=s.y??u.y+(h.y-u.y)*i);const A=[{x:b,y:u.y},{x:b,y:h.y}],T=[{x:u.x,y},{x:h.x,y}];a[l]===m?p=l==="x"?A:T:p=l==="x"?T:A}else{const A=[{x:u.x,y:h.y}],T=[{x:h.x,y:u.y}];if(l==="x"?p=a.x===m?T:A:p=a.y===m?A:T,t===o){const w=Math.abs(e[l]-n[l]);if(w<=r){const $=Math.min(r-1,r-w);a[l]===m?g[l]=(u[l]>e[l]?-1:1)*$:v[l]=(h[l]>n[l]?-1:1)*$}}if(t!==o){const w=l==="x"?"y":"x",$=a[l]===d[w],N=u[w]>h[w],E=u[w]<h[w];(a[l]===1&&(!$&&N||$&&E)||a[l]!==1&&(!$&&E||$&&N))&&(p=l==="x"?A:T)}const V={x:u.x+g.x,y:u.y+g.y},I={x:h.x+v.x,y:h.y+v.y},D=Math.max(Math.abs(V.x-p[0].x),Math.abs(I.x-p[0].x)),B=Math.max(Math.abs(V.y-p[0].y),Math.abs(I.y-p[0].y));D>=B?(b=(V.x+I.x)/2,y=p[0].y):(b=p[0].x,y=(V.y+I.y)/2)}const k={x:u.x+g.x,y:u.y+g.y},S={x:h.x+v.x,y:h.y+v.y};return[[e,...k.x!==p[0].x||k.y!==p[0].y?[k]:[],...p,...S.x!==p[p.length-1].x||S.y!==p[p.length-1].y?[S]:[],n],b,y,f,x]}function oi(e,t,n,o){const s=Math.min(pn(e,t)/2,pn(t,n)/2,o),{x:r,y:i}=t;if(e.x===r&&r===n.x||e.y===i&&i===n.y)return`L${r} ${i}`;if(e.y===i){const u=e.x<n.x?-1:1,h=e.y<n.y?1:-1;return`L ${r+s*u},${i}Q ${r},${i} ${r},${i+s*h}`}const a=e.x<n.x?1:-1,d=e.y<n.y?-1:1;return`L ${r},${i+s*d}Q ${r},${i} ${r+s*a},${i}`}function Tt({sourceX:e,sourceY:t,sourcePosition:n=W.Bottom,targetX:o,targetY:s,targetPosition:r=W.Top,borderRadius:i=5,centerX:a,centerY:d,offset:u=20,stepPosition:h=.5}){const[c,l,m,p,b]=ni({source:{x:e,y:t},sourcePosition:n,target:{x:o,y:s},targetPosition:r,center:{x:a,y:d},offset:u,stepPosition:h});let y=`M${c[0].x} ${c[0].y}`;for(let g=1;g<c.length-1;g++)y+=oi(c[g-1],c[g],c[g+1],i);return y+=`L${c[c.length-1].x} ${c[c.length-1].y}`,[y,l,m,p,b]}function mn(e){var t;return e&&!!(e.internals.handleBounds||(t=e.handles)!=null&&t.length)&&!!(e.measured.width||e.width||e.initialWidth)}function si(e){var c;const{sourceNode:t,targetNode:n}=e;if(!mn(t)||!mn(n))return null;const o=t.internals.handleBounds||yn(t.handles),s=n.internals.handleBounds||yn(n.handles),r=xn((o==null?void 0:o.source)??[],e.sourceHandle),i=xn(e.connectionMode===je.Strict?(s==null?void 0:s.target)??[]:((s==null?void 0:s.target)??[]).concat((s==null?void 0:s.source)??[]),e.targetHandle);if(!r||!i)return(c=e.onError)==null||c.call(e,"008",ge.error008(r?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const a=(r==null?void 0:r.position)||W.Bottom,d=(i==null?void 0:i.position)||W.Top,u=Ae(t,r,a),h=Ae(n,i,d);return{sourceX:u.x,sourceY:u.y,targetX:h.x,targetY:h.y,sourcePosition:a,targetPosition:d}}function yn(e){if(!e)return null;const t=[],n=[];for(const 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 Ae(e,t,n=W.Left,o=!1){const s=((t==null?void 0:t.x)??0)+e.internals.positionAbsolute.x,r=((t==null?void 0:t.y)??0)+e.internals.positionAbsolute.y,{width:i,height:a}=t??be(e);if(o)return{x:s+i/2,y:r+a/2};switch((t==null?void 0:t.position)??n){case W.Top:return{x:s+i/2,y:r};case W.Right:return{x:s+i,y:r+a/2};case W.Bottom:return{x:s+i/2,y:r+a};case W.Left:return{x:s,y:r+a/2}}}function xn(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}function Dt(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(o=>`${o}=${e[o]}`).join("&")}`:""}function ri(e,{id:t,defaultColor:n,defaultMarkerStart:o,defaultMarkerEnd:s}){const r=new Set;return e.reduce((i,a)=>([a.markerStart||o,a.markerEnd||s].forEach(d=>{if(d&&typeof d=="object"){const u=Dt(d,t);r.has(u)||(i.push({id:u,color:d.color||n,...d}),r.add(u))}}),i),[]).sort((i,a)=>i.id.localeCompare(a.id))}const vo=1e3,ii=10,Xt={nodeOrigin:[0,0],nodeExtent:We,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},ai={...Xt,checkEquality:!0};function Wt(e,t){const n={...e};for(const o in t)t[o]!==void 0&&(n[o]=t[o]);return n}function ci(e,t,n){const o=Wt(Xt,n);for(const s of e.values())if(s.parentId)qt(s,e,t,o);else{const r=Ue(s,o.nodeOrigin),i=_e(s.extent)?s.extent:o.nodeExtent,a=$e(r,i,be(s));s.internals.positionAbsolute=a}}function li(e,t){if(!e.handles)return e.measured?t==null?void 0:t.internals.handleBounds:void 0;const n=[],o=[];for(const s of e.handles){const r={id:s.id,width:s.width??1,height:s.height??1,nodeId:e.id,x:s.x,y:s.y,position:s.position,type:s.type};s.type==="source"?n.push(r):s.type==="target"&&o.push(r)}return{source:n,target:o}}function Gt(e){return e==="manual"}function Lt(e,t,n,o={}){var h,c;const s=Wt(ai,o),r={i:0},i=new Map(t),a=s!=null&&s.elevateNodesOnSelect&&!Gt(s.zIndexMode)?vo:0;let d=e.length>0,u=!1;t.clear(),n.clear();for(const l of e){let m=i.get(l.id);if(s.checkEquality&&l===(m==null?void 0:m.internals.userNode))t.set(l.id,m);else{const p=Ue(l,s.nodeOrigin),b=_e(l.extent)?l.extent:s.nodeExtent,y=$e(p,b,be(l));m={...s.defaults,...l,measured:{width:(h=l.measured)==null?void 0:h.width,height:(c=l.measured)==null?void 0:c.height},internals:{positionAbsolute:y,handleBounds:li(l,m),z:Eo(l,a,s.zIndexMode),userNode:l}},t.set(l.id,m)}(m.measured===void 0||m.measured.width===void 0||m.measured.height===void 0)&&!m.hidden&&(d=!1),l.parentId&&qt(m,t,n,o,r),u||(u=l.selected??!1)}return{nodesInitialized:d,hasSelectedNodes:u}}function ui(e,t){if(!e.parentId)return;const n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function qt(e,t,n,o,s){const{elevateNodesOnSelect:r,nodeOrigin:i,nodeExtent:a,zIndexMode:d}=Wt(Xt,o),u=e.parentId,h=t.get(u);if(!h){console.warn(`Parent node ${u} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}ui(e,n),s&&!h.parentId&&h.internals.rootParentIndex===void 0&&d==="auto"&&(h.internals.rootParentIndex=++s.i,h.internals.z=h.internals.z+s.i*ii),s&&h.internals.rootParentIndex!==void 0&&(s.i=h.internals.rootParentIndex);const c=r&&!Gt(d)?vo:0,{x:l,y:m,z:p}=di(e,h,i,a,c,d),{positionAbsolute:b}=e.internals,y=l!==b.x||m!==b.y;(y||p!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:y?{x:l,y:m}:b,z:p}})}function Eo(e,t,n){const o=fe(e.zIndex)?e.zIndex:0;return Gt(n)?o:o+(e.selected?t:0)}function di(e,t,n,o,s,r){const{x:i,y:a}=t.internals.positionAbsolute,d=be(e),u=Ue(e,n),h=_e(e.extent)?$e(u,e.extent,d):u;let c=$e({x:i+h.x,y:a+h.y},o,d);e.extent==="parent"&&(c=ao(c,d,t));const l=Eo(e,s,r),m=t.internals.z??0;return{x:c.x,y:c.y,z:m>=l?m+1:l}}function Kt(e,t,n,o=[0,0]){var i;const s=[],r=new Map;for(const a of e){const d=t.get(a.parentId);if(!d)continue;const u=((i=r.get(a.parentId))==null?void 0:i.expandedRect)??qe(d),h=co(u,a.rect);r.set(a.parentId,{expandedRect:h,parent:d})}return r.size>0&&r.forEach(({expandedRect:a,parent:d},u)=>{var f;const h=d.internals.positionAbsolute,c=be(d),l=d.origin??o,m=a.x<h.x?Math.round(Math.abs(h.x-a.x)):0,p=a.y<h.y?Math.round(Math.abs(h.y-a.y)):0,b=Math.max(c.width,Math.round(a.width)),y=Math.max(c.height,Math.round(a.height)),g=(b-c.width)*l[0],v=(y-c.height)*l[1];(m>0||p>0||g||v)&&(s.push({id:u,type:"position",position:{x:d.position.x-m+g,y:d.position.y-p+v}}),(f=n.get(u))==null||f.forEach(x=>{e.some(k=>k.id===x.id)||s.push({id:x.id,type:"position",position:{x:x.position.x+m,y:x.position.y+p}})})),(c.width<a.width||c.height<a.height||m||p)&&s.push({id:u,type:"dimensions",setAttributes:!0,dimensions:{width:b+(m?l[0]*m-g:0),height:y+(p?l[1]*p-v:0)}})}),s}function fi(e,t,n,o,s,r,i){const a=o==null?void 0:o.querySelector(".xyflow__viewport");let d=!1;if(!a)return{changes:[],updatedInternals:d};const u=[],h=window.getComputedStyle(a),{m22:c}=new window.DOMMatrixReadOnly(h.transform),l=[];for(const m of e.values()){const p=t.get(m.id);if(!p)continue;if(p.hidden){t.set(p.id,{...p,internals:{...p.internals,handleBounds:void 0}}),d=!0;continue}const b=Yt(m.nodeElement),y=p.measured.width!==b.width||p.measured.height!==b.height;if(!!(b.width&&b.height&&(y||!p.internals.handleBounds||m.force))){const v=m.nodeElement.getBoundingClientRect(),f=_e(p.extent)?p.extent:r;let{positionAbsolute:x}=p.internals;p.parentId&&p.extent==="parent"?x=ao(x,b,t.get(p.parentId)):f&&(x=$e(x,f,b));const k={...p,measured:b,internals:{...p.internals,positionAbsolute:x,handleBounds:{source:fn("source",m.nodeElement,v,c,p.id),target:fn("target",m.nodeElement,v,c,p.id)}}};t.set(p.id,k),p.parentId&&qt(k,t,n,{nodeOrigin:s,zIndexMode:i}),d=!0,y&&(u.push({id:p.id,type:"dimensions",dimensions:b}),p.expandParent&&p.parentId&&l.push({id:p.id,parentId:p.parentId,rect:qe(k,s)}))}}if(l.length>0){const m=Kt(l,t,n,s);u.push(...m)}return{changes:u,updatedInternals:d}}async function hi({delta:e,panZoom:t,transform:n,translateExtent:o,width:s,height:r}){if(!t||!e.x&&!e.y)return!1;const i=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[s,r]],o);return!!i&&(i.x!==n[0]||i.y!==n[1]||i.k!==n[2])}function wn(e,t,n,o,s,r){let i=s;const a=o.get(i)||new Map;o.set(i,a.set(n,t)),i=`${s}-${e}`;const d=o.get(i)||new Map;if(o.set(i,d.set(n,t)),r){i=`${s}-${e}-${r}`;const u=o.get(i)||new Map;o.set(i,u.set(n,t))}}function So(e,t,n){e.clear(),t.clear();for(const o of n){const{source:s,target:r,sourceHandle:i=null,targetHandle:a=null}=o,d={edgeId:o.id,source:s,target:r,sourceHandle:i,targetHandle:a},u=`${s}-${i}--${r}-${a}`,h=`${r}-${a}--${s}-${i}`;wn("source",d,h,e,s,i),wn("target",d,u,e,r,a),t.set(o.id,o)}}function No(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:No(n,t):!1}function bn(e,t,n){var s;let o=e;do{if((s=o==null?void 0:o.matches)!=null&&s.call(o,t))return!0;if(o===n)return!1;o=o==null?void 0:o.parentElement}while(o);return!1}function gi(e,t,n,o){const s=new Map;for(const[r,i]of e)if((i.selected||i.id===o)&&(!i.parentId||!No(i,e))&&(i.draggable||t&&typeof i.draggable>"u")){const a=e.get(r);a&&s.set(r,{id:r,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 s}function It({nodeId:e,dragItems:t,nodeLookup:n,dragging:o=!0}){var i,a,d;const s=[];for(const[u,h]of t){const c=(i=n.get(u))==null?void 0:i.internals.userNode;c&&s.push({...c,position:h.position,dragging:o})}if(!e)return[s[0],s];const r=(a=n.get(e))==null?void 0:a.internals.userNode;return[r?{...r,position:((d=t.get(e))==null?void 0:d.position)||r.position,dragging:o}:s[0],s]}function pi({dragItems:e,snapGrid:t,x:n,y:o}){const s=e.values().next().value;if(!s)return null;const r={x:n-s.distance.x,y:o-s.distance.y},i=Je(r,t);return{x:i.x-r.x,y:i.y-r.y}}function mi({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:o,onDragStop:s}){let r={x:null,y:null},i=0,a=new Map,d=!1,u={x:0,y:0},h=null,c=!1,l=null,m=!1,p=!1,b=null;function y({noDragClassName:v,handleSelector:f,domNode:x,isSelectable:k,nodeId:S,nodeClickDistance:_=0}){l=ae(x);function A({x:D,y:B}){const{nodeLookup:w,nodeExtent:$,snapGrid:N,snapToGrid:E,nodeOrigin:P,onNodeDrag:M,onSelectionDrag:L,onError:j,updateNodePositions:H}=t();r={x:D,y:B};let O=!1;const Y=a.size>1,K=Y&&$?zt(Qe(a)):null,Q=Y&&E?pi({dragItems:a,snapGrid:N,x:D,y:B}):null;for(const[q,R]of a){if(!w.has(q))continue;let F={x:D-R.distance.x,y:B-R.distance.y};E&&(F=Q?{x:Math.round(F.x+Q.x),y:Math.round(F.y+Q.y)}:Je(F,N));let U=null;if(Y&&$&&!R.extent&&K){const{positionAbsolute:X}=R.internals,J=X.x-K.x+$[0][0],te=X.x+R.measured.width-K.x2+$[1][0],ne=X.y-K.y+$[0][1],re=X.y+R.measured.height-K.y2+$[1][1];U=[[J,ne],[te,re]]}const{position:Z,positionAbsolute:G}=io({nodeId:q,nextPosition:F,nodeLookup:w,nodeExtent:U||$,nodeOrigin:P,onError:j});O=O||R.position.x!==Z.x||R.position.y!==Z.y,R.position=Z,R.internals.positionAbsolute=G}if(p=p||O,!!O&&(H(a,!0),b&&(o||M||!S&&L))){const[q,R]=It({nodeId:S,dragItems:a,nodeLookup:w});o==null||o(b,a,q,R),M==null||M(b,q,R),S||L==null||L(b,R)}}async function T(){if(!h)return;const{transform:D,panBy:B,autoPanSpeed:w,autoPanOnNodeDrag:$}=t();if(!$){d=!1,cancelAnimationFrame(i);return}const[N,E]=Ft(u,h,w);(N!==0||E!==0)&&(r.x=(r.x??0)-N/D[2],r.y=(r.y??0)-E/D[2],await B({x:N,y:E})&&A(r)),i=requestAnimationFrame(T)}function V(D){var Y;const{nodeLookup:B,multiSelectionActive:w,nodesDraggable:$,transform:N,snapGrid:E,snapToGrid:P,selectNodesOnDrag:M,onNodeDragStart:L,onSelectionDragStart:j,unselectNodesAndEdges:H}=t();c=!0,(!M||!k)&&!w&&S&&((Y=B.get(S))!=null&&Y.selected||H()),k&&M&&S&&(e==null||e(S));const O=Ye(D.sourceEvent,{transform:N,snapGrid:E,snapToGrid:P,containerBounds:h});if(r=O,a=gi(B,$,O,S),a.size>0&&(n||L||!S&&j)){const[K,Q]=It({nodeId:S,dragItems:a,nodeLookup:B});n==null||n(D.sourceEvent,a,K,Q),L==null||L(D.sourceEvent,K,Q),S||j==null||j(D.sourceEvent,Q)}}const I=Jn().clickDistance(_).on("start",D=>{const{domNode:B,nodeDragThreshold:w,transform:$,snapGrid:N,snapToGrid:E}=t();h=(B==null?void 0:B.getBoundingClientRect())||null,m=!1,p=!1,b=D.sourceEvent,w===0&&V(D),r=Ye(D.sourceEvent,{transform:$,snapGrid:N,snapToGrid:E,containerBounds:h}),u=he(D.sourceEvent,h)}).on("drag",D=>{const{autoPanOnNodeDrag:B,transform:w,snapGrid:$,snapToGrid:N,nodeDragThreshold:E,nodeLookup:P}=t(),M=Ye(D.sourceEvent,{transform:w,snapGrid:$,snapToGrid:N,containerBounds:h});if(b=D.sourceEvent,(D.sourceEvent.type==="touchmove"&&D.sourceEvent.touches.length>1||S&&!P.has(S))&&(m=!0),!m){if(!d&&B&&c&&(d=!0,T()),!c){const L=he(D.sourceEvent,h),j=L.x-u.x,H=L.y-u.y;Math.sqrt(j*j+H*H)>E&&V(D)}(r.x!==M.xSnapped||r.y!==M.ySnapped)&&a&&c&&(u=he(D.sourceEvent,h),A(M))}}).on("end",D=>{if(!c||m){m&&a.size>0&&t().updateNodePositions(a,!1);return}if(d=!1,c=!1,cancelAnimationFrame(i),a.size>0){const{nodeLookup:B,updateNodePositions:w,onNodeDragStop:$,onSelectionDragStop:N}=t();if(p&&(w(a,!1),p=!1),s||$||!S&&N){const[E,P]=It({nodeId:S,dragItems:a,nodeLookup:B,dragging:!1});s==null||s(D.sourceEvent,a,E,P),$==null||$(D.sourceEvent,E,P),S||N==null||N(D.sourceEvent,P)}}}).filter(D=>{const B=D.target;return!D.button&&(!v||!bn(B,`.${v}`,x))&&(!f||bn(B,f,x))});l.call(I)}function g(){l==null||l.on(".drag",null)}return{update:y,destroy:g}}function yi(e,t,n){const o=[],s={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(const r of t.values())dt(s,qe(r))>0&&o.push(r);return o}const xi=250;function wi(e,t,n,o){var a,d;let s=[],r=1/0;const i=yi(e,n,t+xi);for(const u of i){const h=[...((a=u.internals.handleBounds)==null?void 0:a.source)??[],...((d=u.internals.handleBounds)==null?void 0:d.target)??[]];for(const c of h){if(o.nodeId===c.nodeId&&o.type===c.type&&o.id===c.id)continue;const{x:l,y:m}=Ae(u,c,c.position,!0),p=Math.sqrt(Math.pow(l-e.x,2)+Math.pow(m-e.y,2));p>t||(p<r?(s=[{...c,x:l,y:m}],r=p):p===r&&s.push({...c,x:l,y:m}))}}if(!s.length)return null;if(s.length>1){const u=o.type==="source"?"target":"source";return s.find(h=>h.type===u)??s[0]}return s[0]}function Mo(e,t,n,o,s,r=!1){var u,h,c;const i=o.get(e);if(!i)return null;const a=s==="strict"?(u=i.internals.handleBounds)==null?void 0:u[t]:[...((h=i.internals.handleBounds)==null?void 0:h.source)??[],...((c=i.internals.handleBounds)==null?void 0:c.target)??[]],d=(n?a==null?void 0:a.find(l=>l.id===n):a==null?void 0:a[0])??null;return d&&r?{...d,...Ae(i,d,d.position,!0)}:d}function Co(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function bi(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const Io=()=>!0;function vi(e,{connectionMode:t,connectionRadius:n,handleId:o,nodeId:s,edgeUpdaterType:r,isTarget:i,domNode:a,nodeLookup:d,lib:u,autoPanOnConnect:h,flowId:c,panBy:l,cancelConnection:m,onConnectStart:p,onConnect:b,onConnectEnd:y,isValidConnection:g=Io,onReconnectEnd:v,updateConnection:f,getTransform:x,getFromHandle:k,autoPanSpeed:S,dragThreshold:_=1,handleDomNode:A}){const T=go(e.target);let V=0,I;const{x:D,y:B}=he(e),w=Co(r,A),$=a==null?void 0:a.getBoundingClientRect();let N=!1;if(!$||!w)return;const E=Mo(s,w,o,d,t);if(!E)return;let P=he(e,$),M=!1,L=null,j=!1,H=null;function O(){if(!h||!$)return;const[Z,G]=Ft(P,$,S);l({x:Z,y:G}),V=requestAnimationFrame(O)}const Y={...E,nodeId:s,type:w,position:E.position},K=d.get(s);let q={inProgress:!0,isValid:null,from:Ae(K,Y,W.Left,!0),fromHandle:Y,fromPosition:Y.position,fromNode:K,to:P,toHandle:null,toPosition:cn[Y.position],toNode:null,pointer:P};function R(){N=!0,f(q),p==null||p(e,{nodeId:s,handleId:o,handleType:w})}_===0&&R();function F(Z){if(!N){const{x:re,y:ce}=he(Z),pe=re-D,me=ce-B;if(!(pe*pe+me*me>_*_))return;R()}if(!k()||!Y){U(Z);return}const G=x();P=he(Z,$),I=wi(et(P,G,!1,[1,1]),n,d,Y),M||(O(),M=!0);const X=ko(Z,{handle:I,connectionMode:t,fromNodeId:s,fromHandleId:o,fromType:i?"target":"source",isValidConnection:g,doc:T,lib:u,flowId:c,nodeLookup:d});H=X.handleDomNode,L=X.connection,j=bi(!!I,X.isValid);const J=d.get(s),te=J?Ae(J,Y,W.Left,!0):q.from,ne={...q,from:te,isValid:j,to:X.toHandle&&j?Re({x:X.toHandle.x,y:X.toHandle.y},G):P,toHandle:X.toHandle,toPosition:j&&X.toHandle?X.toHandle.position:cn[Y.position],toNode:X.toHandle?d.get(X.toHandle.nodeId):null,pointer:P};f(ne),q=ne}function U(Z){if(!("touches"in Z&&Z.touches.length>0)){if(N){(I||H)&&L&&j&&(b==null||b(L));const{inProgress:G,...X}=q,J={...X,toPosition:q.toHandle?q.toPosition:null};y==null||y(Z,J),r&&(v==null||v(Z,J))}m(),cancelAnimationFrame(V),M=!1,j=!1,L=null,H=null,T.removeEventListener("mousemove",F),T.removeEventListener("mouseup",U),T.removeEventListener("touchmove",F),T.removeEventListener("touchend",U)}}T.addEventListener("mousemove",F),T.addEventListener("mouseup",U),T.addEventListener("touchmove",F),T.addEventListener("touchend",U)}function ko(e,{handle:t,connectionMode:n,fromNodeId:o,fromHandleId:s,fromType:r,doc:i,lib:a,flowId:d,isValidConnection:u=Io,nodeLookup:h}){const c=r==="target",l=t?i.querySelector(`.${a}-flow__handle[data-id="${d}-${t==null?void 0:t.nodeId}-${t==null?void 0:t.id}-${t==null?void 0:t.type}"]`):null,{x:m,y:p}=he(e),b=i.elementFromPoint(m,p),y=b!=null&&b.classList.contains(`${a}-flow__handle`)?b:l,g={handleDomNode:y,isValid:!1,connection:null,toHandle:null};if(y){const v=Co(void 0,y),f=y.getAttribute("data-nodeid"),x=y.getAttribute("data-handleid"),k=y.classList.contains("connectable"),S=y.classList.contains("connectableend");if(!f||!v)return g;const _={source:c?f:o,sourceHandle:c?x:s,target:c?o:f,targetHandle:c?s:x};g.connection=_;const T=k&&S&&(n===je.Strict?c&&v==="source"||!c&&v==="target":f!==o||x!==s);g.isValid=T&&u(_),g.toHandle=Mo(f,v,x,h,n,!0)}return g}const jt={onPointerDown:vi,isValid:ko};function Ei({domNode:e,panZoom:t,getTransform:n,getViewScale:o}){const s=ae(e);function r({translateExtent:a,width:d,height:u,zoomStep:h=1,pannable:c=!0,zoomable:l=!0,inversePan:m=!1}){const p=f=>{if(f.sourceEvent.type!=="wheel"||!t)return;const x=n(),k=f.sourceEvent.ctrlKey&&Ke()?10:1,S=-f.sourceEvent.deltaY*(f.sourceEvent.deltaMode===1?.05:f.sourceEvent.deltaMode?1:.002)*h,_=x[2]*Math.pow(2,S*k);t.scaleTo(_)};let b=[0,0];const y=f=>{(f.sourceEvent.type==="mousedown"||f.sourceEvent.type==="touchstart")&&(b=[f.sourceEvent.clientX??f.sourceEvent.touches[0].clientX,f.sourceEvent.clientY??f.sourceEvent.touches[0].clientY])},g=f=>{const x=n();if(f.sourceEvent.type!=="mousemove"&&f.sourceEvent.type!=="touchmove"||!t)return;const k=[f.sourceEvent.clientX??f.sourceEvent.touches[0].clientX,f.sourceEvent.clientY??f.sourceEvent.touches[0].clientY],S=[k[0]-b[0],k[1]-b[1]];b=k;const _=o()*Math.max(x[2],Math.log(x[2]))*(m?-1:1),A={x:x[0]-S[0]*_,y:x[1]-S[1]*_},T=[[0,0],[d,u]];t.setViewportConstrained({x:A.x,y:A.y,zoom:x[2]},T,a)},v=eo().on("start",y).on("zoom",c?g:null).on("zoom.wheel",l?p:null);s.call(v,{})}function i(){s.on("zoom",null)}return{update:r,destroy:i,pointer:de}}const pt=e=>({x:e.x,y:e.y,zoom:e.k}),kt=({x:e,y:t,zoom:n})=>Rt.translate(e,t).scale(n),Te=(e,t)=>e.target.closest(`.${t}`),Po=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),Si=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,Pt=(e,t=0,n=Si,o=()=>{})=>{const s=typeof t=="number"&&t>0;return s||o(),s?e.transition().duration(t).ease(n).on("end",o):e},$o=e=>{const t=e.ctrlKey&&Ke()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function Ni({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:o,panOnScrollMode:s,panOnScrollSpeed:r,zoomOnPinch:i,onPanZoomStart:a,onPanZoom:d,onPanZoomEnd:u}){return h=>{if(Te(h,t))return h.ctrlKey&&h.preventDefault(),!1;h.preventDefault(),h.stopImmediatePropagation();const c=n.property("__zoom").k||1;if(h.ctrlKey&&i){const y=de(h),g=$o(h),v=c*Math.pow(2,g);o.scaleTo(n,v,y,h);return}const l=h.deltaMode===1?20:1;let m=s===Pe.Vertical?0:h.deltaX*l,p=s===Pe.Horizontal?0:h.deltaY*l;!Ke()&&h.shiftKey&&s!==Pe.Vertical&&(m=h.deltaY*l,p=0),o.translateBy(n,-(m/c)*r,-(p/c)*r,{internal:!0});const b=pt(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(d==null||d(h,b),e.panScrollTimeout=setTimeout(()=>{u==null||u(h,b),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,a==null||a(h,b))}}function Mi({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(o,s){const r=o.type==="wheel",i=!t&&r&&!o.ctrlKey,a=Te(o,e);if(o.ctrlKey&&r&&a&&o.preventDefault(),i||a)return null;o.preventDefault(),n.call(this,o,s)}}function Ci({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return o=>{var r,i,a;if((r=o.sourceEvent)!=null&&r.internal)return;const s=pt(o.transform);e.mouseButton=((i=o.sourceEvent)==null?void 0:i.button)||0,e.isZoomingOrPanning=!0,e.prevViewport=s,((a=o.sourceEvent)==null?void 0:a.type)==="mousedown"&&t(!0),n&&(n==null||n(o.sourceEvent,s))}}function Ii({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:o,onPanZoom:s}){return r=>{var i,a;e.usedRightMouseButton=!!(n&&Po(t,e.mouseButton??0)),(i=r.sourceEvent)!=null&&i.sync||o([r.transform.x,r.transform.y,r.transform.k]),s&&!((a=r.sourceEvent)!=null&&a.internal)&&(s==null||s(r.sourceEvent,pt(r.transform)))}}function ki({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:o,onPanZoomEnd:s,onPaneContextMenu:r}){return i=>{var a;if(!((a=i.sourceEvent)!=null&&a.internal)&&(e.isZoomingOrPanning=!1,r&&Po(t,e.mouseButton??0)&&!e.usedRightMouseButton&&i.sourceEvent&&r(i.sourceEvent),e.usedRightMouseButton=!1,o(!1),s)){const d=pt(i.transform);e.prevViewport=d,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{s==null||s(i.sourceEvent,d)},n?150:0)}}}function Pi({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:o,panOnScroll:s,zoomOnDoubleClick:r,userSelectionActive:i,noWheelClassName:a,noPanClassName:d,lib:u,connectionInProgress:h}){return c=>{var y;const l=e||t,m=n&&c.ctrlKey,p=c.type==="wheel";if(c.button===1&&c.type==="mousedown"&&(Te(c,`${u}-flow__node`)||Te(c,`${u}-flow__edge`)))return!0;if(!o&&!l&&!s&&!r&&!n||i||h&&!p||Te(c,a)&&p||Te(c,d)&&(!p||s&&p&&!e)||!n&&c.ctrlKey&&p)return!1;if(!n&&c.type==="touchstart"&&((y=c.touches)==null?void 0:y.length)>1)return c.preventDefault(),!1;if(!l&&!s&&!m&&p||!o&&(c.type==="mousedown"||c.type==="touchstart")||Array.isArray(o)&&!o.includes(c.button)&&c.type==="mousedown")return!1;const b=Array.isArray(o)&&o.includes(c.button)||!c.button||c.button<=1;return(!c.ctrlKey||p)&&b}}function $i({domNode:e,minZoom:t,maxZoom:n,translateExtent:o,viewport:s,onPanZoom:r,onPanZoomStart:i,onPanZoomEnd:a,onDraggingChange:d}){const u={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},h=e.getBoundingClientRect(),c=eo().scaleExtent([t,n]).translateExtent(o),l=ae(e).call(c);v({x:s.x,y:s.y,zoom:He(s.zoom,t,n)},[[0,0],[h.width,h.height]],o);const m=l.on("wheel.zoom"),p=l.on("dblclick.zoom");c.wheelDelta($o);async function b(I,D){return l?new Promise(B=>{c==null||c.interpolate((D==null?void 0:D.interpolate)==="linear"?Nt:ct).transform(Pt(l,D==null?void 0:D.duration,D==null?void 0:D.ease,()=>B(!0)),I)}):!1}function y({noWheelClassName:I,noPanClassName:D,onPaneContextMenu:B,userSelectionActive:w,panOnScroll:$,panOnDrag:N,panOnScrollMode:E,panOnScrollSpeed:P,preventScrolling:M,zoomOnPinch:L,zoomOnScroll:j,zoomOnDoubleClick:H,zoomActivationKeyPressed:O,lib:Y,onTransformChange:K,connectionInProgress:Q,paneClickDistance:q,selectionOnDrag:R}){w&&!u.isZoomingOrPanning&&g();const F=$&&!O&&!w;c.clickDistance(R?1/0:!fe(q)||q<0?0:q);const U=F?Ni({zoomPanValues:u,noWheelClassName:I,d3Selection:l,d3Zoom:c,panOnScrollMode:E,panOnScrollSpeed:P,zoomOnPinch:L,onPanZoomStart:i,onPanZoom:r,onPanZoomEnd:a}):Mi({noWheelClassName:I,preventScrolling:M,d3ZoomHandler:m});l.on("wheel.zoom",U,{passive:!1});const Z=Ci({zoomPanValues:u,onDraggingChange:d,onPanZoomStart:i});c.on("start",Z);const G=Ii({zoomPanValues:u,panOnDrag:N,onPaneContextMenu:!!B,onPanZoom:r,onTransformChange:K});c.on("zoom",G);const X=ki({zoomPanValues:u,panOnDrag:N,panOnScroll:$,onPaneContextMenu:B,onPanZoomEnd:a,onDraggingChange:d});c.on("end",X);const J=Pi({zoomActivationKeyPressed:O,panOnDrag:N,zoomOnScroll:j,panOnScroll:$,zoomOnDoubleClick:H,zoomOnPinch:L,userSelectionActive:w,noPanClassName:D,noWheelClassName:I,lib:Y,connectionInProgress:Q});c.filter(J),H?l.on("dblclick.zoom",p):l.on("dblclick.zoom",null)}function g(){c.on("zoom",null)}async function v(I,D,B){const w=kt(I),$=c==null?void 0:c.constrain()(w,D,B);return $&&await b($),$}async function f(I,D){const B=kt(I);return await b(B,D),B}function x(I){if(l){const D=kt(I),B=l.property("__zoom");(B.k!==I.zoom||B.x!==I.x||B.y!==I.y)&&(c==null||c.transform(l,D,null,{sync:!0}))}}function k(){const I=l?xr(l.node()):{x:0,y:0,k:1};return{x:I.x,y:I.y,zoom:I.k}}async function S(I,D){return l?new Promise(B=>{c==null||c.interpolate((D==null?void 0:D.interpolate)==="linear"?Nt:ct).scaleTo(Pt(l,D==null?void 0:D.duration,D==null?void 0:D.ease,()=>B(!0)),I)}):!1}async function _(I,D){return l?new Promise(B=>{c==null||c.interpolate((D==null?void 0:D.interpolate)==="linear"?Nt:ct).scaleBy(Pt(l,D==null?void 0:D.duration,D==null?void 0:D.ease,()=>B(!0)),I)}):!1}function A(I){c==null||c.scaleExtent(I)}function T(I){c==null||c.translateExtent(I)}function V(I){const D=!fe(I)||I<0?0:I;c==null||c.clickDistance(D)}return{update:y,destroy:g,setViewport:f,setViewportConstrained:v,getViewport:k,scaleTo:S,scaleBy:_,setScaleExtent:A,setTranslateExtent:T,syncViewport:x,setClickDistance:V}}var Be;(function(e){e.Line="line",e.Handle="handle"})(Be||(Be={}));function _i({width:e,prevWidth:t,height:n,prevHeight:o,affectsX:s,affectsY:r}){const i=e-t,a=n-o,d=[i>0?1:i<0?-1:0,a>0?1:a<0?-1:0];return i&&s&&(d[0]=d[0]*-1),a&&r&&(d[1]=d[1]*-1),d}function vn(e){const t=e.includes("right")||e.includes("left"),n=e.includes("bottom")||e.includes("top"),o=e.includes("left"),s=e.includes("top");return{isHorizontal:t,isVertical:n,affectsX:o,affectsY:s}}function ve(e,t){return Math.max(0,t-e)}function Ee(e,t){return Math.max(0,e-t)}function rt(e,t,n){return Math.max(0,t-e,e-n)}function En(e,t){return e?!t:t}function Ai(e,t,n,o,s,r,i,a){let{affectsX:d,affectsY:u}=t;const{isHorizontal:h,isVertical:c}=t,l=h&&c,{xSnapped:m,ySnapped:p}=n,{minWidth:b,maxWidth:y,minHeight:g,maxHeight:v}=o,{x:f,y:x,width:k,height:S,aspectRatio:_}=e;let A=Math.floor(h?m-e.pointerX:0),T=Math.floor(c?p-e.pointerY:0);const V=k+(d?-A:A),I=S+(u?-T:T),D=-r[0]*k,B=-r[1]*S;let w=rt(V,b,y),$=rt(I,g,v);if(i){let P=0,M=0;d&&A<0?P=ve(f+A+D,i[0][0]):!d&&A>0&&(P=Ee(f+V+D,i[1][0])),u&&T<0?M=ve(x+T+B,i[0][1]):!u&&T>0&&(M=Ee(x+I+B,i[1][1])),w=Math.max(w,P),$=Math.max($,M)}if(a){let P=0,M=0;d&&A>0?P=Ee(f+A,a[0][0]):!d&&A<0&&(P=ve(f+V,a[1][0])),u&&T>0?M=Ee(x+T,a[0][1]):!u&&T<0&&(M=ve(x+I,a[1][1])),w=Math.max(w,P),$=Math.max($,M)}if(s){if(h){const P=rt(V/_,g,v)*_;if(w=Math.max(w,P),i){let M=0;!d&&!u||d&&!u&&l?M=Ee(x+B+V/_,i[1][1])*_:M=ve(x+B+(d?A:-A)/_,i[0][1])*_,w=Math.max(w,M)}if(a){let M=0;!d&&!u||d&&!u&&l?M=ve(x+V/_,a[1][1])*_:M=Ee(x+(d?A:-A)/_,a[0][1])*_,w=Math.max(w,M)}}if(c){const P=rt(I*_,b,y)/_;if($=Math.max($,P),i){let M=0;!d&&!u||u&&!d&&l?M=Ee(f+I*_+D,i[1][0])/_:M=ve(f+(u?T:-T)*_+D,i[0][0])/_,$=Math.max($,M)}if(a){let M=0;!d&&!u||u&&!d&&l?M=ve(f+I*_,a[1][0])/_:M=Ee(f+(u?T:-T)*_,a[0][0])/_,$=Math.max($,M)}}}T=T+(T<0?$:-$),A=A+(A<0?w:-w),s&&(l?V>I*_?T=(En(d,u)?-A:A)/_:A=(En(d,u)?-T:T)*_:h?(T=A/_,u=d):(A=T*_,d=u));const N=d?f+A:f,E=u?x+T:x;return{width:k+(d?-A:A),height:S+(u?-T:T),x:r[0]*A*(d?-1:1)+N,y:r[1]*T*(u?-1:1)+E}}const _o={width:0,height:0,x:0,y:0},zi={..._o,pointerX:0,pointerY:0,aspectRatio:1};function Ti(e,t,n){const o=t.position.x+e.position.x,s=t.position.y+e.position.y,r=e.measured.width??0,i=e.measured.height??0,a=n[0]*r,d=n[1]*i;return[[o-a,s-d],[o+r-a,s+i-d]]}function Di({domNode:e,nodeId:t,getStoreItems:n,onChange:o,onEnd:s}){const r=ae(e);let i={controlDirection:vn("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function a({controlPosition:u,boundaries:h,keepAspectRatio:c,resizeDirection:l,onResizeStart:m,onResize:p,onResizeEnd:b,shouldResize:y}){let g={..._o},v={...zi};i={boundaries:h,resizeDirection:l,keepAspectRatio:c,controlDirection:vn(u)};let f,x=null,k=[],S,_,A,T=!1;const V=Jn().on("start",I=>{const{nodeLookup:D,transform:B,snapGrid:w,snapToGrid:$,nodeOrigin:N,paneDomNode:E}=n();if(f=D.get(t),!f)return;x=(E==null?void 0:E.getBoundingClientRect())??null;const{xSnapped:P,ySnapped:M}=Ye(I.sourceEvent,{transform:B,snapGrid:w,snapToGrid:$,containerBounds:x});g={width:f.measured.width??0,height:f.measured.height??0,x:f.position.x??0,y:f.position.y??0},v={...g,pointerX:P,pointerY:M,aspectRatio:g.width/g.height},S=void 0,_=_e(f.extent)?f.extent:void 0,f.parentId&&(f.extent==="parent"||f.expandParent)&&(S=D.get(f.parentId)),S&&f.extent==="parent"&&(_=[[0,0],[S.measured.width,S.measured.height]]),k=[],A=void 0;for(const[L,j]of D)if(j.parentId===t&&(k.push({id:L,position:{...j.position},extent:j.extent}),j.extent==="parent"||j.expandParent)){const H=Ti(j,f,j.origin??N);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}m==null||m(I,{...g})}).on("drag",I=>{const{transform:D,snapGrid:B,snapToGrid:w,nodeOrigin:$}=n(),N=Ye(I.sourceEvent,{transform:D,snapGrid:B,snapToGrid:w,containerBounds:x}),E=[];if(!f)return;const{x:P,y:M,width:L,height:j}=g,H={},O=f.origin??$,{width:Y,height:K,x:Q,y:q}=Ai(v,i.controlDirection,N,i.boundaries,i.keepAspectRatio,O,_,A),R=Y!==L,F=K!==j,U=Q!==P&&R,Z=q!==M&&F;if(!U&&!Z&&!R&&!F)return;if((U||Z||O[0]===1||O[1]===1)&&(H.x=U?Q:g.x,H.y=Z?q:g.y,g.x=H.x,g.y=H.y,k.length>0)){const te=Q-P,ne=q-M;for(const re of k)re.position={x:re.position.x-te+O[0]*(Y-L),y:re.position.y-ne+O[1]*(K-j)},E.push(re)}if((R||F)&&(H.width=R&&(!i.resizeDirection||i.resizeDirection==="horizontal")?Y:g.width,H.height=F&&(!i.resizeDirection||i.resizeDirection==="vertical")?K:g.height,g.width=H.width,g.height=H.height),S&&f.expandParent){const te=O[0]*(H.width??0);H.x&&H.x<te&&(g.x=te,v.x=v.x-(H.x-te));const ne=O[1]*(H.height??0);H.y&&H.y<ne&&(g.y=ne,v.y=v.y-(H.y-ne))}const G=_i({width:g.width,prevWidth:L,height:g.height,prevHeight:j,affectsX:i.controlDirection.affectsX,affectsY:i.controlDirection.affectsY}),X={...g,direction:G};(y==null?void 0:y(I,X))!==!1&&(T=!0,p==null||p(I,X),o(H,E))}).on("end",I=>{T&&(b==null||b(I,{...g}),s==null||s({...g}),T=!1)});r.call(V)}function d(){r.on(".drag",null)}return{update:a,destroy:d}}const Li={},Sn=e=>{let t;const n=new Set,o=(h,c)=>{const l=typeof h=="function"?h(t):h;if(!Object.is(l,t)){const m=t;t=c??(typeof l!="object"||l===null)?l:Object.assign({},t,l),n.forEach(p=>p(t,m))}},s=()=>t,d={setState:o,getState:s,getInitialState:()=>u,subscribe:h=>(n.add(h),()=>n.delete(h)),destroy:()=>{(Li?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},u=t=e(o,s,d);return d},ji=e=>e?Sn(e):Sn,{useDebugValue:Hi}=br,{useSyncExternalStoreWithSelector:Ri}=wr,Bi=e=>e;function Ao(e,t=Bi,n){const o=Ri(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return Hi(o),o}const Nn=(e,t)=>{const n=ji(e),o=(s,r=t)=>Ao(n,s,r);return Object.assign(o,n),o},Vi=(e,t)=>e?Nn(e,t):Nn;function oe(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[o,s]of e)if(!Object.is(s,t.get(o)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const o of e)if(!t.has(o))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const o of n)if(!Object.prototype.hasOwnProperty.call(t,o)||!Object.is(e[o],t[o]))return!1;return!0}const mt=z.createContext(null),Fi=mt.Provider,zo=ge.error001("react");function ee(e,t){const n=z.useContext(mt);if(n===null)throw new Error(zo);return Ao(n,e,t)}function se(){const e=z.useContext(mt);if(e===null)throw new Error(zo);return z.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const Mn={display:"none"},Oi={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},To="react-flow__node-desc",Do="react-flow__edge-desc",Yi="react-flow__aria-live",Xi=e=>e.ariaLiveMessage,Wi=e=>e.ariaLabelConfig;function Gi({rfId:e}){const t=ee(Xi);return C.jsx("div",{id:`${Yi}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:Oi,children:t})}function qi({rfId:e,disableKeyboardA11y:t}){const n=ee(Wi);return C.jsxs(C.Fragment,{children:[C.jsx("div",{id:`${To}-${e}`,style:Mn,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),C.jsx("div",{id:`${Do}-${e}`,style:Mn,children:n["edge.a11yDescription.default"]}),!t&&C.jsx(Gi,{rfId:e})]})}const yt=z.forwardRef(({position:e="top-left",children:t,className:n,style:o,...s},r)=>{const i=`${e}`.split("-");return C.jsx("div",{className:ie(["react-flow__panel",n,...i]),style:o,ref:r,...s,children:t})});yt.displayName="Panel";const Cn="https://reactflow.dev?utm_source=attribution";function Ki({proOptions:e,position:t="bottom-right"}){return e!=null&&e.hideAttribution?null:C.jsx(yt,{position:t,className:"react-flow__attribution","data-message":`Please only hide this attribution when you are subscribed to React Flow Pro: ${Cn}`,children:C.jsx("a",{href:Cn,target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const Zi=e=>{const t=[],n=[];for(const[,o]of e.nodeLookup)o.selected&&t.push(o.internals.userNode);for(const[,o]of e.edgeLookup)o.selected&&n.push(o);return{selectedNodes:t,selectedEdges:n}},it=e=>e.id;function Ui(e,t){return oe(e.selectedNodes.map(it),t.selectedNodes.map(it))&&oe(e.selectedEdges.map(it),t.selectedEdges.map(it))}function Qi({onSelectionChange:e}){const t=se(),{selectedNodes:n,selectedEdges:o}=ee(Zi,Ui);return z.useEffect(()=>{const s={nodes:n,edges:o};e==null||e(s),t.getState().onSelectionChangeHandlers.forEach(r=>r(s))},[n,o,e]),null}const Ji=e=>!!e.onSelectionChangeHandlers;function ea({onSelectionChange:e}){const t=ee(Ji);return e||t?C.jsx(Qi,{onSelectionChange:e}):null}const Lo=[0,0],ta={x:0,y:0,zoom:1},na=["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"],In=[...na,"rfId"],oa=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}),kn={translateExtent:We,nodeOrigin:Lo,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function sa(e){const{setNodes:t,setEdges:n,setMinZoom:o,setMaxZoom:s,setTranslateExtent:r,setNodeExtent:i,reset:a,setDefaultNodesAndEdges:d}=ee(oa,oe),u=se();z.useEffect(()=>(d(e.defaultNodes,e.defaultEdges),()=>{h.current=kn,a()}),[]);const h=z.useRef(kn);return z.useEffect(()=>{for(const c of In){const l=e[c],m=h.current[c];l!==m&&(typeof e[c]>"u"||(c==="nodes"?t(l):c==="edges"?n(l):c==="minZoom"?o(l):c==="maxZoom"?s(l):c==="translateExtent"?r(l):c==="nodeExtent"?i(l):c==="ariaLabelConfig"?u.setState({ariaLabelConfig:qr(l)}):c==="fitView"?u.setState({fitViewQueued:l}):c==="fitViewOptions"?u.setState({fitViewOptions:l}):u.setState({[c]:l})))}h.current=e},In.map(c=>e[c])),null}function Pn(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function ra(e){var o;const[t,n]=z.useState(e==="system"?null:e);return z.useEffect(()=>{if(e!=="system"){n(e);return}const s=Pn(),r=()=>n(s!=null&&s.matches?"dark":"light");return r(),s==null||s.addEventListener("change",r),()=>{s==null||s.removeEventListener("change",r)}},[e]),t!==null?t:(o=Pn())!=null&&o.matches?"dark":"light"}const $n=typeof document<"u"?document:null;function Ze(e=null,t={target:$n,actInsideInputWithModifier:!0}){const[n,o]=z.useState(!1),s=z.useRef(!1),r=z.useRef(new Set([])),[i,a]=z.useMemo(()=>{if(e!==null){const u=(Array.isArray(e)?e:[e]).filter(c=>typeof c=="string").map(c=>c.replace("+",`
2
2
  `).replace(`
3
3
 
4
4
  `,`
@@ -1 +1 @@
1
- import{ba as L,bI as ln,a_ as A,b8 as P,aZ as W,bJ as gn,bK as dn,bL as hn,bM as z,bN as pn,bO as An,bP as N,bb as m,bg as U,bj as T,bQ as _n,be as on,bR as wn,bS as bn,a$ as V,bT as On,bU as I}from"./index-C5AvWGUU.js";var Pn="[object Symbol]";function x(n){return typeof n=="symbol"||L(n)&&ln(n)==Pn}function vn(n,r){for(var e=-1,i=n==null?0:n.length,f=Array(i);++e<i;)f[e]=r(n[e],e,n);return f}var K=P?P.prototype:void 0,B=K?K.toString:void 0;function j(n){if(typeof n=="string")return n;if(A(n))return vn(n,j)+"";if(x(n))return B?B.call(n):"";var r=n+"";return r=="0"&&1/n==-1/0?"-0":r}function yn(){}function En(n,r){for(var e=-1,i=n==null?0:n.length;++e<i&&r(n[e],e,n)!==!1;);return n}function cn(n,r,e,i){for(var f=n.length,t=e+-1;++t<f;)if(r(n[t],t,n))return t;return-1}function Tn(n){return n!==n}function Rn(n,r,e){for(var i=e-1,f=n.length;++i<f;)if(n[i]===r)return i;return-1}function In(n,r,e){return r===r?Rn(n,r,e):cn(n,Tn,e)}function Sn(n,r){var e=n==null?0:n.length;return!!e&&In(n,r,0)>-1}function M(n){return W(n)?gn(n):dn(n)}var Ln=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,xn=/^\w*$/;function $(n,r){if(A(n))return!1;var e=typeof n;return e=="number"||e=="symbol"||e=="boolean"||n==null||x(n)?!0:xn.test(n)||!Ln.test(n)||r!=null&&n in Object(r)}var Mn=500;function $n(n){var r=hn(n,function(i){return e.size===Mn&&e.clear(),i}),e=r.cache;return r}var Cn=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Dn=/\\(\\)?/g,Fn=$n(function(n){var r=[];return n.charCodeAt(0)===46&&r.push(""),n.replace(Cn,function(e,i,f,t){r.push(f?t.replace(Dn,"$1"):i||e)}),r});function Gn(n){return n==null?"":j(n)}function k(n,r){return A(n)?n:$(n,r)?[n]:Fn(Gn(n))}function R(n){if(typeof n=="string"||x(n))return n;var r=n+"";return r=="0"&&1/n==-1/0?"-0":r}function nn(n,r){r=k(r,n);for(var e=0,i=r.length;n!=null&&e<i;)n=n[R(r[e++])];return e&&e==i?n:void 0}function Nn(n,r,e){var i=n==null?void 0:nn(n,r);return i===void 0?e:i}function rn(n,r){for(var e=-1,i=r.length,f=n.length;++e<i;)n[f+e]=r[e];return n}var H=P?P.isConcatSpreadable:void 0;function mn(n){return A(n)||z(n)||!!(H&&n&&n[H])}function Hr(n,r,e,i,f){var t=-1,s=n.length;for(e||(e=mn),f||(f=[]);++t<s;){var u=n[t];e(u)?rn(f,u):i||(f[f.length]=u)}return f}function Un(n,r,e,i){var f=-1,t=n==null?0:n.length;for(i&&t&&(e=n[++f]);++f<t;)e=r(e,n[f],f,n);return e}function en(n,r){for(var e=-1,i=n==null?0:n.length,f=0,t=[];++e<i;){var s=n[e];r(s,e,n)&&(t[f++]=s)}return t}function Kn(){return[]}var Bn=Object.prototype,Hn=Bn.propertyIsEnumerable,Z=Object.getOwnPropertySymbols,Zn=Z?function(n){return n==null?[]:(n=Object(n),en(Z(n),function(r){return Hn.call(n,r)}))}:Kn;function qn(n,r,e){var i=r(n);return A(n)?i:rn(i,e(n))}function q(n){return qn(n,M,Zn)}var Yn="__lodash_hash_undefined__";function Jn(n){return this.__data__.set(n,Yn),this}function Qn(n){return this.__data__.has(n)}function v(n){var r=-1,e=n==null?0:n.length;for(this.__data__=new pn;++r<e;)this.add(n[r])}v.prototype.add=v.prototype.push=Jn;v.prototype.has=Qn;function Xn(n,r){for(var e=-1,i=n==null?0:n.length;++e<i;)if(r(n[e],e,n))return!0;return!1}function tn(n,r){return n.has(r)}var Wn=1,zn=2;function fn(n,r,e,i,f,t){var s=e&Wn,u=n.length,a=r.length;if(u!=a&&!(s&&a>u))return!1;var h=t.get(n),g=t.get(r);if(h&&g)return h==r&&g==n;var l=-1,d=!0,o=e&zn?new v:void 0;for(t.set(n,r),t.set(r,n);++l<u;){var p=n[l],_=r[l];if(i)var w=s?i(_,p,l,r,n,t):i(p,_,l,n,r,t);if(w!==void 0){if(w)continue;d=!1;break}if(o){if(!Xn(r,function(b,O){if(!tn(o,O)&&(p===b||f(p,b,e,i,t)))return o.push(O)})){d=!1;break}}else if(!(p===_||f(p,_,e,i,t))){d=!1;break}}return t.delete(n),t.delete(r),d}function Vn(n){var r=-1,e=Array(n.size);return n.forEach(function(i,f){e[++r]=[f,i]}),e}function C(n){var r=-1,e=Array(n.size);return n.forEach(function(i){e[++r]=i}),e}var jn=1,kn=2,nr="[object Boolean]",rr="[object Date]",er="[object Error]",ir="[object Map]",tr="[object Number]",fr="[object RegExp]",sr="[object Set]",ur="[object String]",ar="[object Symbol]",lr="[object ArrayBuffer]",gr="[object DataView]",Y=P?P.prototype:void 0,S=Y?Y.valueOf:void 0;function dr(n,r,e,i,f,t,s){switch(e){case gr:if(n.byteLength!=r.byteLength||n.byteOffset!=r.byteOffset)return!1;n=n.buffer,r=r.buffer;case lr:return!(n.byteLength!=r.byteLength||!t(new N(n),new N(r)));case nr:case rr:case tr:return An(+n,+r);case er:return n.name==r.name&&n.message==r.message;case fr:case ur:return n==r+"";case ir:var u=Vn;case sr:var a=i&jn;if(u||(u=C),n.size!=r.size&&!a)return!1;var h=s.get(n);if(h)return h==r;i|=kn,s.set(n,r);var g=fn(u(n),u(r),i,f,t,s);return s.delete(n),g;case ar:if(S)return S.call(n)==S.call(r)}return!1}var hr=1,pr=Object.prototype,Ar=pr.hasOwnProperty;function _r(n,r,e,i,f,t){var s=e&hr,u=q(n),a=u.length,h=q(r),g=h.length;if(a!=g&&!s)return!1;for(var l=a;l--;){var d=u[l];if(!(s?d in r:Ar.call(r,d)))return!1}var o=t.get(n),p=t.get(r);if(o&&p)return o==r&&p==n;var _=!0;t.set(n,r),t.set(r,n);for(var w=s;++l<a;){d=u[l];var b=n[d],O=r[d];if(i)var G=s?i(O,b,d,r,n,t):i(b,O,d,n,r,t);if(!(G===void 0?b===O||f(b,O,e,i,t):G)){_=!1;break}w||(w=d=="constructor")}if(_&&!w){var y=n.constructor,E=r.constructor;y!=E&&"constructor"in n&&"constructor"in r&&!(typeof y=="function"&&y instanceof y&&typeof E=="function"&&E instanceof E)&&(_=!1)}return t.delete(n),t.delete(r),_}var or=1,J="[object Arguments]",Q="[object Array]",c="[object Object]",wr=Object.prototype,X=wr.hasOwnProperty;function br(n,r,e,i,f,t){var s=A(n),u=A(r),a=s?Q:m(n),h=u?Q:m(r);a=a==J?c:a,h=h==J?c:h;var g=a==c,l=h==c,d=a==h;if(d&&U(n)){if(!U(r))return!1;s=!0,g=!1}if(d&&!g)return t||(t=new T),s||_n(n)?fn(n,r,e,i,f,t):dr(n,r,a,e,i,f,t);if(!(e&or)){var o=g&&X.call(n,"__wrapped__"),p=l&&X.call(r,"__wrapped__");if(o||p){var _=o?n.value():n,w=p?r.value():r;return t||(t=new T),f(_,w,e,i,t)}}return d?(t||(t=new T),_r(n,r,e,i,f,t)):!1}function D(n,r,e,i,f){return n===r?!0:n==null||r==null||!L(n)&&!L(r)?n!==n&&r!==r:br(n,r,e,i,D,f)}var Or=1,Pr=2;function vr(n,r,e,i){var f=e.length,t=f;if(n==null)return!t;for(n=Object(n);f--;){var s=e[f];if(s[2]?s[1]!==n[s[0]]:!(s[0]in n))return!1}for(;++f<t;){s=e[f];var u=s[0],a=n[u],h=s[1];if(s[2]){if(a===void 0&&!(u in n))return!1}else{var g=new T,l;if(!(l===void 0?D(h,a,Or|Pr,i,g):l))return!1}}return!0}function sn(n){return n===n&&!on(n)}function yr(n){for(var r=M(n),e=r.length;e--;){var i=r[e],f=n[i];r[e]=[i,f,sn(f)]}return r}function un(n,r){return function(e){return e==null?!1:e[n]===r&&(r!==void 0||n in Object(e))}}function Er(n){var r=yr(n);return r.length==1&&r[0][2]?un(r[0][0],r[0][1]):function(e){return e===n||vr(e,n,r)}}function cr(n,r){return n!=null&&r in Object(n)}function Tr(n,r,e){r=k(r,n);for(var i=-1,f=r.length,t=!1;++i<f;){var s=R(r[i]);if(!(t=n!=null&&e(n,s)))break;n=n[s]}return t||++i!=f?t:(f=n==null?0:n.length,!!f&&wn(f)&&bn(s,f)&&(A(n)||z(n)))}function Rr(n,r){return n!=null&&Tr(n,r,cr)}var Ir=1,Sr=2;function Lr(n,r){return $(n)&&sn(r)?un(R(n),r):function(e){var i=Nn(e,n);return i===void 0&&i===r?Rr(e,n):D(r,i,Ir|Sr)}}function xr(n){return function(r){return r==null?void 0:r[n]}}function Mr(n){return function(r){return nn(r,n)}}function $r(n){return $(n)?xr(R(n)):Mr(n)}function an(n){return typeof n=="function"?n:n==null?V:typeof n=="object"?A(n)?Lr(n[0],n[1]):Er(n):$r(n)}function Cr(n,r){return n&&On(n,r,M)}function Dr(n,r){return function(e,i){if(e==null)return e;if(!W(e))return n(e,i);for(var f=e.length,t=-1,s=Object(e);++t<f&&i(s[t],t,s)!==!1;);return e}}var F=Dr(Cr);function Fr(n){return typeof n=="function"?n:V}function Zr(n,r){var e=A(n)?En:F;return e(n,Fr(r))}function Gr(n,r){var e=[];return F(n,function(i,f,t){r(i,f,t)&&e.push(i)}),e}function qr(n,r){var e=A(n)?en:Gr;return e(n,an(r))}function Nr(n,r,e,i,f){return f(n,function(t,s,u){e=i?(i=!1,t):r(e,t,s,u)}),e}function Yr(n,r,e){var i=A(n)?Un:Nr,f=arguments.length<3;return i(n,an(r),e,f,F)}var mr=1/0,Ur=I&&1/C(new I([,-0]))[1]==mr?function(n){return new I(n)}:yn,Kr=200;function Jr(n,r,e){var i=-1,f=Sn,t=n.length,s=!0,u=[],a=u;if(t>=Kr){var h=r?null:Ur(n);if(h)return C(h);s=!1,f=tn,a=new v}else a=r?[]:u;n:for(;++i<t;){var g=n[i],l=r?r(g):g;if(g=g!==0?g:0,s&&l===l){for(var d=a.length;d--;)if(a[d]===l)continue n;r&&a.push(l),u.push(g)}else f(a,l,e)||(a!==u&&a.push(l),u.push(g))}return u}export{F as a,Hr as b,an as c,vn as d,rn as e,qn as f,Zn as g,En as h,x as i,q as j,M as k,Jr as l,qr as m,Zr as n,cn as o,Fr as p,Cr as q,Yr as r,Kn as s,Tr as t,k as u,R as v,nn as w,Rr as x,Gn as y};
1
+ import{ba as L,bI as ln,a_ as A,b8 as P,aZ as W,bJ as gn,bK as dn,bL as hn,bM as z,bN as pn,bO as An,bP as N,bb as m,bg as U,bj as T,bQ as _n,be as on,bR as wn,bS as bn,a$ as V,bT as On,bU as I}from"./index-9mF0_S-1.js";var Pn="[object Symbol]";function x(n){return typeof n=="symbol"||L(n)&&ln(n)==Pn}function vn(n,r){for(var e=-1,i=n==null?0:n.length,f=Array(i);++e<i;)f[e]=r(n[e],e,n);return f}var K=P?P.prototype:void 0,B=K?K.toString:void 0;function j(n){if(typeof n=="string")return n;if(A(n))return vn(n,j)+"";if(x(n))return B?B.call(n):"";var r=n+"";return r=="0"&&1/n==-1/0?"-0":r}function yn(){}function En(n,r){for(var e=-1,i=n==null?0:n.length;++e<i&&r(n[e],e,n)!==!1;);return n}function cn(n,r,e,i){for(var f=n.length,t=e+-1;++t<f;)if(r(n[t],t,n))return t;return-1}function Tn(n){return n!==n}function Rn(n,r,e){for(var i=e-1,f=n.length;++i<f;)if(n[i]===r)return i;return-1}function In(n,r,e){return r===r?Rn(n,r,e):cn(n,Tn,e)}function Sn(n,r){var e=n==null?0:n.length;return!!e&&In(n,r,0)>-1}function M(n){return W(n)?gn(n):dn(n)}var Ln=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,xn=/^\w*$/;function $(n,r){if(A(n))return!1;var e=typeof n;return e=="number"||e=="symbol"||e=="boolean"||n==null||x(n)?!0:xn.test(n)||!Ln.test(n)||r!=null&&n in Object(r)}var Mn=500;function $n(n){var r=hn(n,function(i){return e.size===Mn&&e.clear(),i}),e=r.cache;return r}var Cn=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Dn=/\\(\\)?/g,Fn=$n(function(n){var r=[];return n.charCodeAt(0)===46&&r.push(""),n.replace(Cn,function(e,i,f,t){r.push(f?t.replace(Dn,"$1"):i||e)}),r});function Gn(n){return n==null?"":j(n)}function k(n,r){return A(n)?n:$(n,r)?[n]:Fn(Gn(n))}function R(n){if(typeof n=="string"||x(n))return n;var r=n+"";return r=="0"&&1/n==-1/0?"-0":r}function nn(n,r){r=k(r,n);for(var e=0,i=r.length;n!=null&&e<i;)n=n[R(r[e++])];return e&&e==i?n:void 0}function Nn(n,r,e){var i=n==null?void 0:nn(n,r);return i===void 0?e:i}function rn(n,r){for(var e=-1,i=r.length,f=n.length;++e<i;)n[f+e]=r[e];return n}var H=P?P.isConcatSpreadable:void 0;function mn(n){return A(n)||z(n)||!!(H&&n&&n[H])}function Hr(n,r,e,i,f){var t=-1,s=n.length;for(e||(e=mn),f||(f=[]);++t<s;){var u=n[t];e(u)?rn(f,u):i||(f[f.length]=u)}return f}function Un(n,r,e,i){var f=-1,t=n==null?0:n.length;for(i&&t&&(e=n[++f]);++f<t;)e=r(e,n[f],f,n);return e}function en(n,r){for(var e=-1,i=n==null?0:n.length,f=0,t=[];++e<i;){var s=n[e];r(s,e,n)&&(t[f++]=s)}return t}function Kn(){return[]}var Bn=Object.prototype,Hn=Bn.propertyIsEnumerable,Z=Object.getOwnPropertySymbols,Zn=Z?function(n){return n==null?[]:(n=Object(n),en(Z(n),function(r){return Hn.call(n,r)}))}:Kn;function qn(n,r,e){var i=r(n);return A(n)?i:rn(i,e(n))}function q(n){return qn(n,M,Zn)}var Yn="__lodash_hash_undefined__";function Jn(n){return this.__data__.set(n,Yn),this}function Qn(n){return this.__data__.has(n)}function v(n){var r=-1,e=n==null?0:n.length;for(this.__data__=new pn;++r<e;)this.add(n[r])}v.prototype.add=v.prototype.push=Jn;v.prototype.has=Qn;function Xn(n,r){for(var e=-1,i=n==null?0:n.length;++e<i;)if(r(n[e],e,n))return!0;return!1}function tn(n,r){return n.has(r)}var Wn=1,zn=2;function fn(n,r,e,i,f,t){var s=e&Wn,u=n.length,a=r.length;if(u!=a&&!(s&&a>u))return!1;var h=t.get(n),g=t.get(r);if(h&&g)return h==r&&g==n;var l=-1,d=!0,o=e&zn?new v:void 0;for(t.set(n,r),t.set(r,n);++l<u;){var p=n[l],_=r[l];if(i)var w=s?i(_,p,l,r,n,t):i(p,_,l,n,r,t);if(w!==void 0){if(w)continue;d=!1;break}if(o){if(!Xn(r,function(b,O){if(!tn(o,O)&&(p===b||f(p,b,e,i,t)))return o.push(O)})){d=!1;break}}else if(!(p===_||f(p,_,e,i,t))){d=!1;break}}return t.delete(n),t.delete(r),d}function Vn(n){var r=-1,e=Array(n.size);return n.forEach(function(i,f){e[++r]=[f,i]}),e}function C(n){var r=-1,e=Array(n.size);return n.forEach(function(i){e[++r]=i}),e}var jn=1,kn=2,nr="[object Boolean]",rr="[object Date]",er="[object Error]",ir="[object Map]",tr="[object Number]",fr="[object RegExp]",sr="[object Set]",ur="[object String]",ar="[object Symbol]",lr="[object ArrayBuffer]",gr="[object DataView]",Y=P?P.prototype:void 0,S=Y?Y.valueOf:void 0;function dr(n,r,e,i,f,t,s){switch(e){case gr:if(n.byteLength!=r.byteLength||n.byteOffset!=r.byteOffset)return!1;n=n.buffer,r=r.buffer;case lr:return!(n.byteLength!=r.byteLength||!t(new N(n),new N(r)));case nr:case rr:case tr:return An(+n,+r);case er:return n.name==r.name&&n.message==r.message;case fr:case ur:return n==r+"";case ir:var u=Vn;case sr:var a=i&jn;if(u||(u=C),n.size!=r.size&&!a)return!1;var h=s.get(n);if(h)return h==r;i|=kn,s.set(n,r);var g=fn(u(n),u(r),i,f,t,s);return s.delete(n),g;case ar:if(S)return S.call(n)==S.call(r)}return!1}var hr=1,pr=Object.prototype,Ar=pr.hasOwnProperty;function _r(n,r,e,i,f,t){var s=e&hr,u=q(n),a=u.length,h=q(r),g=h.length;if(a!=g&&!s)return!1;for(var l=a;l--;){var d=u[l];if(!(s?d in r:Ar.call(r,d)))return!1}var o=t.get(n),p=t.get(r);if(o&&p)return o==r&&p==n;var _=!0;t.set(n,r),t.set(r,n);for(var w=s;++l<a;){d=u[l];var b=n[d],O=r[d];if(i)var G=s?i(O,b,d,r,n,t):i(b,O,d,n,r,t);if(!(G===void 0?b===O||f(b,O,e,i,t):G)){_=!1;break}w||(w=d=="constructor")}if(_&&!w){var y=n.constructor,E=r.constructor;y!=E&&"constructor"in n&&"constructor"in r&&!(typeof y=="function"&&y instanceof y&&typeof E=="function"&&E instanceof E)&&(_=!1)}return t.delete(n),t.delete(r),_}var or=1,J="[object Arguments]",Q="[object Array]",c="[object Object]",wr=Object.prototype,X=wr.hasOwnProperty;function br(n,r,e,i,f,t){var s=A(n),u=A(r),a=s?Q:m(n),h=u?Q:m(r);a=a==J?c:a,h=h==J?c:h;var g=a==c,l=h==c,d=a==h;if(d&&U(n)){if(!U(r))return!1;s=!0,g=!1}if(d&&!g)return t||(t=new T),s||_n(n)?fn(n,r,e,i,f,t):dr(n,r,a,e,i,f,t);if(!(e&or)){var o=g&&X.call(n,"__wrapped__"),p=l&&X.call(r,"__wrapped__");if(o||p){var _=o?n.value():n,w=p?r.value():r;return t||(t=new T),f(_,w,e,i,t)}}return d?(t||(t=new T),_r(n,r,e,i,f,t)):!1}function D(n,r,e,i,f){return n===r?!0:n==null||r==null||!L(n)&&!L(r)?n!==n&&r!==r:br(n,r,e,i,D,f)}var Or=1,Pr=2;function vr(n,r,e,i){var f=e.length,t=f;if(n==null)return!t;for(n=Object(n);f--;){var s=e[f];if(s[2]?s[1]!==n[s[0]]:!(s[0]in n))return!1}for(;++f<t;){s=e[f];var u=s[0],a=n[u],h=s[1];if(s[2]){if(a===void 0&&!(u in n))return!1}else{var g=new T,l;if(!(l===void 0?D(h,a,Or|Pr,i,g):l))return!1}}return!0}function sn(n){return n===n&&!on(n)}function yr(n){for(var r=M(n),e=r.length;e--;){var i=r[e],f=n[i];r[e]=[i,f,sn(f)]}return r}function un(n,r){return function(e){return e==null?!1:e[n]===r&&(r!==void 0||n in Object(e))}}function Er(n){var r=yr(n);return r.length==1&&r[0][2]?un(r[0][0],r[0][1]):function(e){return e===n||vr(e,n,r)}}function cr(n,r){return n!=null&&r in Object(n)}function Tr(n,r,e){r=k(r,n);for(var i=-1,f=r.length,t=!1;++i<f;){var s=R(r[i]);if(!(t=n!=null&&e(n,s)))break;n=n[s]}return t||++i!=f?t:(f=n==null?0:n.length,!!f&&wn(f)&&bn(s,f)&&(A(n)||z(n)))}function Rr(n,r){return n!=null&&Tr(n,r,cr)}var Ir=1,Sr=2;function Lr(n,r){return $(n)&&sn(r)?un(R(n),r):function(e){var i=Nn(e,n);return i===void 0&&i===r?Rr(e,n):D(r,i,Ir|Sr)}}function xr(n){return function(r){return r==null?void 0:r[n]}}function Mr(n){return function(r){return nn(r,n)}}function $r(n){return $(n)?xr(R(n)):Mr(n)}function an(n){return typeof n=="function"?n:n==null?V:typeof n=="object"?A(n)?Lr(n[0],n[1]):Er(n):$r(n)}function Cr(n,r){return n&&On(n,r,M)}function Dr(n,r){return function(e,i){if(e==null)return e;if(!W(e))return n(e,i);for(var f=e.length,t=-1,s=Object(e);++t<f&&i(s[t],t,s)!==!1;);return e}}var F=Dr(Cr);function Fr(n){return typeof n=="function"?n:V}function Zr(n,r){var e=A(n)?En:F;return e(n,Fr(r))}function Gr(n,r){var e=[];return F(n,function(i,f,t){r(i,f,t)&&e.push(i)}),e}function qr(n,r){var e=A(n)?en:Gr;return e(n,an(r))}function Nr(n,r,e,i,f){return f(n,function(t,s,u){e=i?(i=!1,t):r(e,t,s,u)}),e}function Yr(n,r,e){var i=A(n)?Un:Nr,f=arguments.length<3;return i(n,an(r),e,f,F)}var mr=1/0,Ur=I&&1/C(new I([,-0]))[1]==mr?function(n){return new I(n)}:yn,Kr=200;function Jr(n,r,e){var i=-1,f=Sn,t=n.length,s=!0,u=[],a=u;if(t>=Kr){var h=r?null:Ur(n);if(h)return C(h);s=!1,f=tn,a=new v}else a=r?[]:u;n:for(;++i<t;){var g=n[i],l=r?r(g):g;if(g=g!==0?g:0,s&&l===l){for(var d=a.length;d--;)if(a[d]===l)continue n;r&&a.push(l),u.push(g)}else f(a,l,e)||(a!==u&&a.push(l),u.push(g))}return u}export{F as a,Hr as b,an as c,vn as d,rn as e,qn as f,Zn as g,En as h,x as i,q as j,M as k,Jr as l,qr as m,Zr as n,cn as o,Fr as p,Cr as q,Yr as r,Kn as s,Tr as t,k as u,R as v,nn as w,Rr as x,Gn as y};
@@ -1 +1 @@
1
- import{Q as ln,S as an,T as y,V as tn,W as $,X as S,Y as _,Z as un,$ as rn,a0 as B,a1 as o,a2 as W,a3 as sn,a4 as on,a5 as fn}from"./index-C5AvWGUU.js";function cn(l){return l.innerRadius}function yn(l){return l.outerRadius}function gn(l){return l.startAngle}function dn(l){return l.endAngle}function mn(l){return l&&l.padAngle}function pn(l,h,E,q,v,A,X,a){var I=E-l,i=q-h,n=X-v,d=a-A,u=d*I-n*i;if(!(u*u<y))return u=(n*(h-A)-d*(l-v))/u,[l+u*I,h+u*i]}function K(l,h,E,q,v,A,X){var a=l-E,I=h-q,i=(X?A:-A)/B(a*a+I*I),n=i*I,d=-i*a,u=l+n,s=h+d,f=E+n,c=q+d,Y=(u+f)/2,t=(s+c)/2,m=f-u,g=c-s,R=m*m+g*g,T=v-A,P=u*c-f*s,O=(g<0?-1:1)*B(fn(0,T*T*R-P*P)),Q=(P*g-m*O)/R,V=(-P*m-g*O)/R,w=(P*g+m*O)/R,p=(-P*m+g*O)/R,x=Q-Y,e=V-t,r=w-Y,Z=p-t;return x*x+e*e>r*r+Z*Z&&(Q=w,V=p),{cx:Q,cy:V,x01:-n,y01:-d,x11:Q*(v/T-1),y11:V*(v/T-1)}}function hn(){var l=cn,h=yn,E=W(0),q=null,v=gn,A=dn,X=mn,a=null,I=ln(i);function i(){var n,d,u=+l.apply(this,arguments),s=+h.apply(this,arguments),f=v.apply(this,arguments)-an,c=A.apply(this,arguments)-an,Y=un(c-f),t=c>f;if(a||(a=n=I()),s<u&&(d=s,s=u,u=d),!(s>y))a.moveTo(0,0);else if(Y>tn-y)a.moveTo(s*$(f),s*S(f)),a.arc(0,0,s,f,c,!t),u>y&&(a.moveTo(u*$(c),u*S(c)),a.arc(0,0,u,c,f,t));else{var m=f,g=c,R=f,T=c,P=Y,O=Y,Q=X.apply(this,arguments)/2,V=Q>y&&(q?+q.apply(this,arguments):B(u*u+s*s)),w=_(un(s-u)/2,+E.apply(this,arguments)),p=w,x=w,e,r;if(V>y){var Z=sn(V/u*S(Q)),C=sn(V/s*S(Q));(P-=Z*2)>y?(Z*=t?1:-1,R+=Z,T-=Z):(P=0,R=T=(f+c)/2),(O-=C*2)>y?(C*=t?1:-1,m+=C,g-=C):(O=0,m=g=(f+c)/2)}var j=s*$(m),z=s*S(m),F=u*$(T),G=u*S(T);if(w>y){var H=s*$(g),J=s*S(g),L=u*$(R),M=u*S(R),D;if(Y<rn)if(D=pn(j,z,L,M,H,J,F,G)){var N=j-D[0],U=z-D[1],k=H-D[0],b=J-D[1],nn=1/S(on((N*k+U*b)/(B(N*N+U*U)*B(k*k+b*b)))/2),en=B(D[0]*D[0]+D[1]*D[1]);p=_(w,(u-en)/(nn-1)),x=_(w,(s-en)/(nn+1))}else p=x=0}O>y?x>y?(e=K(L,M,j,z,s,x,t),r=K(H,J,F,G,s,x,t),a.moveTo(e.cx+e.x01,e.cy+e.y01),x<w?a.arc(e.cx,e.cy,x,o(e.y01,e.x01),o(r.y01,r.x01),!t):(a.arc(e.cx,e.cy,x,o(e.y01,e.x01),o(e.y11,e.x11),!t),a.arc(0,0,s,o(e.cy+e.y11,e.cx+e.x11),o(r.cy+r.y11,r.cx+r.x11),!t),a.arc(r.cx,r.cy,x,o(r.y11,r.x11),o(r.y01,r.x01),!t))):(a.moveTo(j,z),a.arc(0,0,s,m,g,!t)):a.moveTo(j,z),!(u>y)||!(P>y)?a.lineTo(F,G):p>y?(e=K(F,G,H,J,u,-p,t),r=K(j,z,L,M,u,-p,t),a.lineTo(e.cx+e.x01,e.cy+e.y01),p<w?a.arc(e.cx,e.cy,p,o(e.y01,e.x01),o(r.y01,r.x01),!t):(a.arc(e.cx,e.cy,p,o(e.y01,e.x01),o(e.y11,e.x11),!t),a.arc(0,0,u,o(e.cy+e.y11,e.cx+e.x11),o(r.cy+r.y11,r.cx+r.x11),t),a.arc(r.cx,r.cy,p,o(r.y11,r.x11),o(r.y01,r.x01),!t))):a.arc(0,0,u,T,R,t)}if(a.closePath(),n)return a=null,n+""||null}return i.centroid=function(){var n=(+l.apply(this,arguments)+ +h.apply(this,arguments))/2,d=(+v.apply(this,arguments)+ +A.apply(this,arguments))/2-rn/2;return[$(d)*n,S(d)*n]},i.innerRadius=function(n){return arguments.length?(l=typeof n=="function"?n:W(+n),i):l},i.outerRadius=function(n){return arguments.length?(h=typeof n=="function"?n:W(+n),i):h},i.cornerRadius=function(n){return arguments.length?(E=typeof n=="function"?n:W(+n),i):E},i.padRadius=function(n){return arguments.length?(q=n==null?null:typeof n=="function"?n:W(+n),i):q},i.startAngle=function(n){return arguments.length?(v=typeof n=="function"?n:W(+n),i):v},i.endAngle=function(n){return arguments.length?(A=typeof n=="function"?n:W(+n),i):A},i.padAngle=function(n){return arguments.length?(X=typeof n=="function"?n:W(+n),i):X},i.context=function(n){return arguments.length?(a=n??null,i):a},i}export{hn as d};
1
+ import{Q as ln,S as an,T as y,V as tn,W as $,X as S,Y as _,Z as un,$ as rn,a0 as B,a1 as o,a2 as W,a3 as sn,a4 as on,a5 as fn}from"./index-9mF0_S-1.js";function cn(l){return l.innerRadius}function yn(l){return l.outerRadius}function gn(l){return l.startAngle}function dn(l){return l.endAngle}function mn(l){return l&&l.padAngle}function pn(l,h,E,q,v,A,X,a){var I=E-l,i=q-h,n=X-v,d=a-A,u=d*I-n*i;if(!(u*u<y))return u=(n*(h-A)-d*(l-v))/u,[l+u*I,h+u*i]}function K(l,h,E,q,v,A,X){var a=l-E,I=h-q,i=(X?A:-A)/B(a*a+I*I),n=i*I,d=-i*a,u=l+n,s=h+d,f=E+n,c=q+d,Y=(u+f)/2,t=(s+c)/2,m=f-u,g=c-s,R=m*m+g*g,T=v-A,P=u*c-f*s,O=(g<0?-1:1)*B(fn(0,T*T*R-P*P)),Q=(P*g-m*O)/R,V=(-P*m-g*O)/R,w=(P*g+m*O)/R,p=(-P*m+g*O)/R,x=Q-Y,e=V-t,r=w-Y,Z=p-t;return x*x+e*e>r*r+Z*Z&&(Q=w,V=p),{cx:Q,cy:V,x01:-n,y01:-d,x11:Q*(v/T-1),y11:V*(v/T-1)}}function hn(){var l=cn,h=yn,E=W(0),q=null,v=gn,A=dn,X=mn,a=null,I=ln(i);function i(){var n,d,u=+l.apply(this,arguments),s=+h.apply(this,arguments),f=v.apply(this,arguments)-an,c=A.apply(this,arguments)-an,Y=un(c-f),t=c>f;if(a||(a=n=I()),s<u&&(d=s,s=u,u=d),!(s>y))a.moveTo(0,0);else if(Y>tn-y)a.moveTo(s*$(f),s*S(f)),a.arc(0,0,s,f,c,!t),u>y&&(a.moveTo(u*$(c),u*S(c)),a.arc(0,0,u,c,f,t));else{var m=f,g=c,R=f,T=c,P=Y,O=Y,Q=X.apply(this,arguments)/2,V=Q>y&&(q?+q.apply(this,arguments):B(u*u+s*s)),w=_(un(s-u)/2,+E.apply(this,arguments)),p=w,x=w,e,r;if(V>y){var Z=sn(V/u*S(Q)),C=sn(V/s*S(Q));(P-=Z*2)>y?(Z*=t?1:-1,R+=Z,T-=Z):(P=0,R=T=(f+c)/2),(O-=C*2)>y?(C*=t?1:-1,m+=C,g-=C):(O=0,m=g=(f+c)/2)}var j=s*$(m),z=s*S(m),F=u*$(T),G=u*S(T);if(w>y){var H=s*$(g),J=s*S(g),L=u*$(R),M=u*S(R),D;if(Y<rn)if(D=pn(j,z,L,M,H,J,F,G)){var N=j-D[0],U=z-D[1],k=H-D[0],b=J-D[1],nn=1/S(on((N*k+U*b)/(B(N*N+U*U)*B(k*k+b*b)))/2),en=B(D[0]*D[0]+D[1]*D[1]);p=_(w,(u-en)/(nn-1)),x=_(w,(s-en)/(nn+1))}else p=x=0}O>y?x>y?(e=K(L,M,j,z,s,x,t),r=K(H,J,F,G,s,x,t),a.moveTo(e.cx+e.x01,e.cy+e.y01),x<w?a.arc(e.cx,e.cy,x,o(e.y01,e.x01),o(r.y01,r.x01),!t):(a.arc(e.cx,e.cy,x,o(e.y01,e.x01),o(e.y11,e.x11),!t),a.arc(0,0,s,o(e.cy+e.y11,e.cx+e.x11),o(r.cy+r.y11,r.cx+r.x11),!t),a.arc(r.cx,r.cy,x,o(r.y11,r.x11),o(r.y01,r.x01),!t))):(a.moveTo(j,z),a.arc(0,0,s,m,g,!t)):a.moveTo(j,z),!(u>y)||!(P>y)?a.lineTo(F,G):p>y?(e=K(F,G,H,J,u,-p,t),r=K(j,z,L,M,u,-p,t),a.lineTo(e.cx+e.x01,e.cy+e.y01),p<w?a.arc(e.cx,e.cy,p,o(e.y01,e.x01),o(r.y01,r.x01),!t):(a.arc(e.cx,e.cy,p,o(e.y01,e.x01),o(e.y11,e.x11),!t),a.arc(0,0,u,o(e.cy+e.y11,e.cx+e.x11),o(r.cy+r.y11,r.cx+r.x11),t),a.arc(r.cx,r.cy,p,o(r.y11,r.x11),o(r.y01,r.x01),!t))):a.arc(0,0,u,T,R,t)}if(a.closePath(),n)return a=null,n+""||null}return i.centroid=function(){var n=(+l.apply(this,arguments)+ +h.apply(this,arguments))/2,d=(+v.apply(this,arguments)+ +A.apply(this,arguments))/2-rn/2;return[$(d)*n,S(d)*n]},i.innerRadius=function(n){return arguments.length?(l=typeof n=="function"?n:W(+n),i):l},i.outerRadius=function(n){return arguments.length?(h=typeof n=="function"?n:W(+n),i):h},i.cornerRadius=function(n){return arguments.length?(E=typeof n=="function"?n:W(+n),i):E},i.padRadius=function(n){return arguments.length?(q=n==null?null:typeof n=="function"?n:W(+n),i):q},i.startAngle=function(n){return arguments.length?(v=typeof n=="function"?n:W(+n),i):v},i.endAngle=function(n){return arguments.length?(A=typeof n=="function"?n:W(+n),i):A},i.padAngle=function(n){return arguments.length?(X=typeof n=="function"?n:W(+n),i):X},i.context=function(n){return arguments.length?(a=n??null,i):a},i}export{hn as d};