@cuongtran001/kanna 1.63.0 → 1.63.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/assets/{BoardsPage-DICQ52PG.js → BoardsPage-BJalB-bc.js} +1 -1
- package/dist/client/assets/{BoardsRoutePage-CRKmSWH5.js → BoardsRoutePage-BTTjJX-Y.js} +1 -1
- package/dist/client/assets/{ChatPage-Co0Etwn3.js → ChatPage-DH8wtQyD.js} +26 -26
- package/dist/client/assets/{CronJobRow-DNErcbgF.js → CronJobRow-CPbO_jwU.js} +1 -1
- package/dist/client/assets/{CronJobsPage-C43nRU-Z.js → CronJobsPage-Ck3SNgGi.js} +1 -1
- package/dist/client/assets/{FilePreviewSheet-TusiyTzv.js → FilePreviewSheet-XEuUtDPn.js} +4 -4
- package/dist/client/assets/{FlowSurface-Cm80dvNk.js → FlowSurface-BCbeMTJe.js} +1 -1
- package/dist/client/assets/{GenUIBlock-C6x_0n1W.js → GenUIBlock-BJy_dfs-.js} +2 -2
- package/dist/client/assets/{KannaSocketProvider-P9V0NjH2.js → KannaSocketProvider-D7Lzlt35.js} +1 -1
- package/dist/client/assets/{LocalProjectsPage-Dd1olMl7.js → LocalProjectsPage-9LJkQjhT.js} +1 -1
- package/dist/client/assets/{SettingsPage-CBgdSFSe.js → SettingsPage-CKrZ6dGQ.js} +1 -1
- package/dist/client/assets/{StackBoardsRoutePage-DsncTCnt.js → StackBoardsRoutePage-t_EaFNG4.js} +1 -1
- package/dist/client/assets/{ToolCallMessage-C01I-eCr.js → ToolCallMessage-RbF9XT2B.js} +1 -1
- package/dist/client/assets/{VChartSurface-Cb6hwa68.js → VChartSurface-CKuPelsn.js} +1 -1
- package/dist/client/assets/{WorkflowsPage-lwtxVhHb.js → WorkflowsPage-B6qUmQA3.js} +1 -1
- package/dist/client/assets/{WorkflowsSection-BlybQZfD.js → WorkflowsSection-DxO0S4An.js} +1 -1
- package/dist/client/assets/{abnfDiagram-O67JEVCF-B_a9AXMB.js → abnfDiagram-YUKMZFIV-DDFdMTc_.js} +1 -1
- package/dist/client/assets/architecture-WOLXFQ4H-C0NxYiG7.js +1 -0
- package/dist/client/assets/{architectureDiagram-NJMV4G6O-DWmCLg7_.js → architectureDiagram-47P4ROYG-DCVMl_eo.js} +3 -3
- package/dist/client/assets/{blockDiagram-BEXU5L5S-4aomY5mS.js → blockDiagram-E7TT5TSB-Bk5H-yPa.js} +3 -3
- package/dist/client/assets/{c4Diagram-YGBWAQC7-D76ydxUf.js → c4Diagram-CRA5TL53-DRb3rwj0.js} +2 -2
- package/dist/client/assets/channel-UMoGGbLh.js +1 -0
- package/dist/client/assets/{chart-renderer-B64ygyZW.js → chart-renderer-DjYZvNxh.js} +1 -1
- package/dist/client/assets/{chatSounds-DNLDbhwt.js → chatSounds-FD2DQzF6.js} +1 -1
- package/dist/client/assets/chevron-left-CJ0qv9kF.js +1 -0
- package/dist/client/assets/{chunk-6AZGARVD-CnZDr4Cj.js → chunk-24IY7LWP-flnn6SWX.js} +1 -1
- package/dist/client/assets/chunk-2BW5OAIV-CAk9x6ti.js +10 -0
- package/dist/client/assets/{chunk-5V3GS4D5-BR7kgIgJ.js → chunk-3M4EKCLJ-D-sZGCtO.js} +1 -1
- package/dist/client/assets/{chunk-ZIGJFQKS-DNaCAnHq.js → chunk-3YJQHVM4-BD0QjGHE.js} +2 -2
- package/dist/client/assets/{chunk-7PRAP22T-DA2a7RLB.js → chunk-4EA7E6EY-C-3QyPC4.js} +1 -1
- package/dist/client/assets/{chunk-6K3QC6MW-DGVRzL6v.js → chunk-4S7OKTRW-BpUW13a3.js} +1 -1
- package/dist/client/assets/{chunk-ICYGCRZG-D97UeqJs.js → chunk-53FOQ5SW-5lPdGYP4.js} +1 -1
- package/dist/client/assets/{chunk-GWA4HPMP-DYjQvLPz.js → chunk-7TKQ45FW-B7U4miWo.js} +1 -1
- package/dist/client/assets/{chunk-GTNCS2PH-MNZlXrOu.js → chunk-AW2ZBBNX-C7Z9OZ45.js} +3 -3
- package/dist/client/assets/{chunk-747NJXEK-Cur1aosP.js → chunk-BP2KR52E-DAQ1pzDV.js} +1 -1
- package/dist/client/assets/{chunk-5DYCD2WN-CdfvSpXJ.js → chunk-DBDB3WZW-BuRZXbw3.js} +1 -1
- package/dist/client/assets/{chunk-MBY4JIJT-B13n2mKy.js → chunk-E2ZNV5FY-CWsTozRZ.js} +3 -3
- package/dist/client/assets/chunk-EU5HNXII-BwtAKWTK.js +213 -0
- package/dist/client/assets/{chunk-2ZTRR5NV-CnDP55cn.js → chunk-F6S3BTY2-DVWKCAHp.js} +1 -1
- package/dist/client/assets/chunk-FVRAUYC3-z2KPe-Z4.js +2 -0
- package/dist/client/assets/{chunk-742MDFTN-Caihy1xI.js → chunk-HJ2JQQFS-DHgNY4oe.js} +1 -1
- package/dist/client/assets/{chunk-NETBCI7D-BzvWYIqO.js → chunk-HTAEGDNF-Bi7Wtyof.js} +1 -1
- package/dist/client/assets/{chunk-IH6LHLGP-CvXe34hB.js → chunk-KPI5JJXK-B2ld5-w4.js} +1 -1
- package/dist/client/assets/{chunk-WEXAMYUT-CKktArnq.js → chunk-KQW6MTUR-Bg7sW3yW.js} +1 -1
- package/dist/client/assets/chunk-NGNAAXSQ-DqoPQk1a.js +136 -0
- package/dist/client/assets/{chunk-UA2S7LBM-Bf77iZxm.js → chunk-NTY3LDVX-Bvl8xsuC.js} +1 -1
- package/dist/client/assets/{chunk-OB3PAWPO-COxrdEAH.js → chunk-OB3PAWPO-mARpRU1A.js} +1 -1
- package/dist/client/assets/{chunk-UY3FDG6J-DqSM_0FB.js → chunk-OD3NTWWA-Dz9nCUGX.js} +1 -1
- package/dist/client/assets/{chunk-3Z5EZCMW-Yx4Q5AcN.js → chunk-QNH66VMT-Cb9xxTwQ.js} +1 -1
- package/dist/client/assets/{chunk-GNY47TPC-lZyp2s3D.js → chunk-SVEVUXB4-Csc8k5gP.js} +2 -2
- package/dist/client/assets/{chunk-6EIED4P4-Bp8dpTvX.js → chunk-TPMEZKFX-DIPHIqGb.js} +1 -1
- package/dist/client/assets/{chunk-6TQVIW2G-DgBX-Pv0.js → chunk-VPELOWWC-DXayM28-.js} +1 -1
- package/dist/client/assets/chunk-VPRB5NB3-DdvbFm4G.js +129 -0
- package/dist/client/assets/{chunk-I5DQTOEV-B98XA8VK.js → chunk-VTWWFHGB-SZnJiyWY.js} +1 -1
- package/dist/client/assets/{chunk-KI3K4JFJ-D5XCPRZv.js → chunk-VZTHESGH-eHyXmK8W.js} +1 -1
- package/dist/client/assets/{chunk-7INBJB4K-aVCoMKLb.js → chunk-XC4XBNZT-C7Gta1hk.js} +10 -10
- package/dist/client/assets/{chunk-XHIXRSVI-BSN7JlfK.js → chunk-YK26KJH5-DVy3MGMd.js} +1 -1
- package/dist/client/assets/{chunk-6AEJRKK7-DO1dhGbP.js → chunk-Z6ETV63D-CJv8Kmac.js} +1 -1
- package/dist/client/assets/{chunk-OUJLGHUK-DA95-S9B.js → chunk-ZO67DCNQ-BAOMIkLF.js} +1 -1
- package/dist/client/assets/{classDiagram-v2-NBCMYWYE-C0XhFBKC.js → classDiagram-v2-K4WV4PDN--EIM3jTT.js} +3 -3
- package/dist/client/assets/{clipboard.adapter-CpYfdxOc.js → clipboard.adapter-GN9nnYak.js} +1 -1
- package/dist/client/assets/{columnStyle-BS-pfo90.js → columnStyle-DjA7hA9k.js} +1 -1
- package/dist/client/assets/{createScopedStore-BFPsowk4.js → createScopedStore-BoLB9Rhc.js} +1 -1
- package/dist/client/assets/cynefin-EF2NZ3EQ-DVkJeZ8i.js +1 -0
- package/dist/client/assets/{cynefinDiagram-VND7K2PF-DPncXCvf.js → cynefinDiagram-3GCD6N5R-7ZbxUax_.js} +1 -1
- package/dist/client/assets/{dagre-6A5THRUB-Co7Xp01k.js → dagre-W4DXFKR2--Fgx23t5.js} +1 -1
- package/dist/client/assets/{diagram-22UHCM2B-DbV2Joxk.js → diagram-2UJZ2QOL-C_PHVXvF.js} +9 -9
- package/dist/client/assets/{diagram-3UASUU5V-BWCja6Yr.js → diagram-OVF4WLC6-jlwkZ7-M.js} +4 -4
- package/dist/client/assets/{diagram-CDSNMT55-Cw5KqwEG.js → diagram-PFPMY2P6-RHK5hLcM.js} +3 -3
- package/dist/client/assets/{diagram-MLGK6HIB-CpMA1Coa.js → diagram-UMYRVEAY-CZRK2Kvd.js} +1 -1
- package/dist/client/assets/{diagram-MPIPVDR6-d_hbFiNV.js → diagram-YEKJPTXX-CgUlPJbo.js} +2 -2
- package/dist/client/assets/diagram-ZIFT7M5P-DmBLxbge.js +3 -0
- package/dist/client/assets/{dist-DLd14rxw.js → dist-BdNQvasR.js} +1 -1
- package/dist/client/assets/{dist-DoC0Fm3K.js → dist-CimtOoGK.js} +1 -1
- package/dist/client/assets/{ebnfDiagram-ZINNZB2B-DfYkfziT.js → ebnfDiagram-VR2GEFS7-DbuiXobi.js} +1 -1
- package/dist/client/assets/{editor-icons-CttcWuni.js → editor-icons-CONDQZof.js} +1 -1
- package/dist/client/assets/elk-IJKZMXRS-u6wcmDiA.js +27 -0
- package/dist/client/assets/{ellipsis-BDHGURxK.js → ellipsis-Cd7sO0LO.js} +1 -1
- package/dist/client/assets/{erDiagram-OPXOYQCR-DgQKCKSy.js → erDiagram-O2IAPWRE-28xfq-CO.js} +2 -2
- package/dist/client/assets/eventmodeling-K75KTNOO-BWBlZ5cR.js +1 -0
- package/dist/client/assets/{flow-kinds-9RVGvvkd.js → flow-kinds-CW2TU_83.js} +1 -1
- package/dist/client/assets/flowDiagram-OXPTDLAJ-BohhOA9-.js +1 -0
- package/dist/client/assets/{folder-RkcfzeEB.js → folder-C7sXCaHj.js} +1 -1
- package/dist/client/assets/ganttDiagram-R7TSEDQI-BhWFgPkz.js +292 -0
- package/dist/client/assets/{genui-CR4wkCwK.js → genui-EzBIAYFE.js} +1 -1
- package/dist/client/assets/gitGraph-VSP46ZUC-1499lQAI.js +1 -0
- package/dist/client/assets/gitGraphDiagram-XJZIOB7I-BLqGp4ws.js +106 -0
- package/dist/client/assets/{globe-ZAraYMi7.js → globe-xmRpmpma.js} +1 -1
- package/dist/client/assets/{host-CSpC459v.js → host-DCaA9W-Z.js} +1 -1
- package/dist/client/assets/index-CDqjh7nt.js +26 -0
- package/dist/client/assets/{info-C7LIj64h.js → info-D4MMvZFe.js} +1 -1
- package/dist/client/assets/info-OHQRW6UA-BDFQOo4H.js +1 -0
- package/dist/client/assets/{infoDiagram-VRGFBTTK-BHpK5iC8.js → infoDiagram-5W2HQ5XZ-DMKTA8zc.js} +1 -1
- package/dist/client/assets/{input-95Sz2mQF.js → input-C4fvDiQ4.js} +1 -1
- package/dist/client/assets/{ishikawaDiagram-OU5B5YK6-C5SBM_wu.js → ishikawaDiagram-K3B6WC7H-CwjDouqD.js} +2 -2
- package/dist/client/assets/{journeyDiagram-ZHPQQLJL-QYT1qcqk.js → journeyDiagram-COXZFDF6-dYdj66tB.js} +3 -3
- package/dist/client/assets/{kanban-definition-PNTS6WVX-DR-xBtFN.js → kanban-definition-P3RFRI5V-DqYhFf23.js} +6 -6
- package/dist/client/assets/{lexicalToReact-BDa_5qRY.js → lexicalToReact-sPUyOWk6.js} +3 -3
- package/dist/client/assets/{line-Dsdv7KRC.js → line-Bu0kN2MJ.js} +1 -1
- package/dist/client/assets/{log-DTKPehdH.js → log-aTaDVF_e.js} +1 -1
- package/dist/client/assets/mermaid-parser.core-sBwmEtVp.js +4 -0
- package/dist/client/assets/mermaid.core-gRh-26W4.js +11 -0
- package/dist/client/assets/{mindmap-definition-NLK3R4M7-jUo0VKxK.js → mindmap-definition-LZFPQGKD-B6yVfjHJ.js} +3 -3
- package/dist/client/assets/{monitor-BCfDUj_v.js → monitor-_CRKcV1h.js} +1 -1
- package/dist/client/assets/packet-JDAUHWVQ-DJ9K2MA4.js +1 -0
- package/dist/client/assets/{pegDiagram-GJSIUBJH-MGiSqOj9.js → pegDiagram-BGZESJAR-ClyHpAxi.js} +1 -1
- package/dist/client/assets/{pencil-CblyZXwW.js → pencil-fNBeUUCf.js} +1 -1
- package/dist/client/assets/{pendingActionsStore-9qaSyloJ.js → pendingActionsStore-COTh4Ztq.js} +1 -1
- package/dist/client/assets/pie-XZMESJXO-CQIQasY-.js +1 -0
- package/dist/client/assets/pieDiagram-CAPJLFHJ-WFVbdtcQ.js +39 -0
- package/dist/client/assets/{play-Cbu0CZdB.js → play-BAmkJfn6.js} +1 -1
- package/dist/client/assets/{plus-CZJUl6yo.js → plus-c75CkNEO.js} +1 -1
- package/dist/client/assets/{popover-GuUsP1oe.js → popover-CHM4skzh.js} +1 -1
- package/dist/client/assets/preload-helper-DjzSQ1t3.js +1 -0
- package/dist/client/assets/{pushClient-D9iQDbZI.js → pushClient-BJH_ITRB.js} +1 -1
- package/dist/client/assets/{quadrantDiagram-O4NWA36T-BE5-2xv9.js → quadrantDiagram-GDMTTRAM-r_q6attF.js} +3 -3
- package/dist/client/assets/radar-ABXABTNO-ByfpCXh9.js +1 -0
- package/dist/client/assets/railroad-I3PHUGI6-CTUn9HhI.js +1 -0
- package/dist/client/assets/railroad-abnf-LNEFI6M7-Ct-b-y0F.js +1 -0
- package/dist/client/assets/railroad-ebnf-DWYD2UWJ-BZMYMWOe.js +1 -0
- package/dist/client/assets/railroad-peg-JR7BVNR7-Dj23PxYc.js +1 -0
- package/dist/client/assets/{railroadDiagram-XR7U4H2S-DON3aKdK.js → railroadDiagram-SM67HX2B-AOJ6ETrw.js} +1 -1
- package/dist/client/assets/{react-7j8fMtgQ.js → react-BEZnZ2sS.js} +1 -1
- package/dist/client/assets/{requirementDiagram-PLB6GJNP-DtoMdLUF.js → requirementDiagram-X7JNWC4A-Bh7hodP7.js} +4 -4
- package/dist/client/assets/runDetached-DqQ3k2ji.js +1 -0
- package/dist/client/assets/sankeyDiagram-UM26HJRW-DYEynJ9v.js +40 -0
- package/dist/client/assets/{segmented-control-Cy9rtD95.js → segmented-control-DNOwRupT.js} +1 -1
- package/dist/client/assets/{select-DqZnZy8K.js → select-dLHiAls6.js} +1 -1
- package/dist/client/assets/sequenceDiagram-ZO4K6R2Y-DvzfWWQD.js +169 -0
- package/dist/client/assets/{settings-header-button-CiwE9Cfg.js → settings-header-button-CGKCzFyk.js} +1 -1
- package/dist/client/assets/{sidebarPendingActions-DcVAcgqh.js → sidebarPendingActions-Dyp80Lv_.js} +1 -1
- package/dist/client/assets/{square-pen-BMoWvdPc.js → square-pen-B1IxmScM.js} +1 -1
- package/dist/client/assets/{state-mark-DiYY9y5l.js → state-mark-BhTZfcYe.js} +1 -1
- package/dist/client/assets/{stateDiagram-v2-GCMORJYK-B9dfuNUZ.js → stateDiagram-v2-TBUQTH76-CRVWjkEX.js} +2 -2
- package/dist/client/assets/{status-pill-CYqhEAXJ.js → status-pill-CwhJhaMy.js} +1 -1
- package/dist/client/assets/{swimlanes-2SLR337P-Doyn0_pS.js → swimlanes-N4OXWK64-CBibkObe.js} +1 -1
- package/dist/client/assets/swimlanesDiagram-K3J5GTZL-Cr216W7P.js +8 -0
- package/dist/client/assets/{terminal-CzIIZKjC.js → terminal-Bnj7qFGw.js} +1 -1
- package/dist/client/assets/{timeline-definition-EJHVYXUP-CqHWbhTY.js → timeline-definition-YOQAKGHF-71bSSqCF.js} +6 -6
- package/dist/client/assets/{timer.adapter-DDgBJONP.js → timer.adapter-DHt2zwsL.js} +1 -1
- package/dist/client/assets/{tools-BY_ZRXAf.js → tools-3gJcj3hK.js} +1 -1
- package/dist/client/assets/treeView-D4JQ5SDB-DcX7Bx0H.js +1 -0
- package/dist/client/assets/treemap-SAJKECNS-BcCHmcAX.js +1 -0
- package/dist/client/assets/{triangle-alert-vEEZ59Sw.js → triangle-alert-CWrc0CIO.js} +1 -1
- package/dist/client/assets/useAppGlobalState-DKOGrO5l.js +1 -0
- package/dist/client/assets/useKannaState-D7R_-dM6.js +5 -0
- package/dist/client/assets/{useTheme-BXQFYwx9.js → useTheme-B57LIKyx.js} +1 -1
- package/dist/client/assets/usecaseDiagram-VIAY4XPW-BTgSYvlK.js +328 -0
- package/dist/client/assets/{vennDiagram-UO4OBE2U-CQJWleWu.js → vennDiagram-BLWOH2XV-BiaO_Ibi.js} +3 -3
- package/dist/client/assets/wardley-7MLQ67FV-DOahSwbZ.js +1 -0
- package/dist/client/assets/{wardleyDiagram-VNRHLVJA-9oHTqfIO.js → wardleyDiagram-YMQ3BMBF-DGeNeGLQ.js} +4 -4
- package/dist/client/assets/xychartDiagram-TAQBALBS-CpByZdBF.js +7 -0
- package/dist/client/index.html +35 -35
- package/package.json +4 -4
- package/src/server/claude-message-normalizer.test.ts +40 -0
- package/src/server/claude-message-normalizer.ts +12 -0
- package/src/server/claude-pty/jsonl-to-event.test.ts +22 -0
- package/src/server/http-api-routes.ts +4 -4
- package/src/server/session-share/shareable-entries.ts +1 -1
- package/src/server/uploads.adapter.ts +69 -41
- package/src/server/uploads.test.ts +79 -1
- package/src/shared/claude-api-error-classification.ts +22 -0
- package/src/shared/transcript-types.ts +2 -1
- package/src/shared/types.ts +4 -0
- package/dist/client/assets/architecture-7GRP2DOG-BBwRXFv3.js +0 -1
- package/dist/client/assets/channel-uKchqF_Z.js +0 -1
- package/dist/client/assets/chevron-left-CfG-TQKa.js +0 -1
- package/dist/client/assets/chunk-3FUC2YCW-FajGLwnZ.js +0 -2
- package/dist/client/assets/chunk-7M6MHVWA-Cjqu4r1U.js +0 -213
- package/dist/client/assets/chunk-FOHPRMQF-DzxwRta7.js +0 -161
- package/dist/client/assets/chunk-O7XYJQB3-BuJf_igd.js +0 -128
- package/dist/client/assets/chunk-Z7XXMR3K-c-eB5Ea8.js +0 -10
- package/dist/client/assets/cynefin-OW5HDTMX-CF3N9j1_.js +0 -1
- package/dist/client/assets/diagram-ATOU4E4O-DGfvrVZh.js +0 -3
- package/dist/client/assets/elk-276RUBZZ-C752MQR0.js +0 -27
- package/dist/client/assets/eventmodeling-NTZA5JFV-CDy1bN6j.js +0 -1
- package/dist/client/assets/flowDiagram-KWPJA3E3-QP3skdqL.js +0 -1
- package/dist/client/assets/ganttDiagram-FUAMR5RP-BrUtQZf-.js +0 -292
- package/dist/client/assets/gitGraph-4MIJSDKK-B-rpDYbz.js +0 -1
- package/dist/client/assets/gitGraphDiagram-X574FWY7-C498HPzm.js +0 -106
- package/dist/client/assets/index-O6qfmG2f.js +0 -26
- package/dist/client/assets/info-A6RAGUB7-BlutK7BT.js +0 -1
- package/dist/client/assets/mermaid-parser.core-DPWCsFq8.js +0 -4
- package/dist/client/assets/mermaid.core-jDbZZtuE.js +0 -11
- package/dist/client/assets/packet-AYTQ26CC-DvbY8dI6.js +0 -1
- package/dist/client/assets/pie-WAS4IAKB-DWSm9SSD.js +0 -1
- package/dist/client/assets/pieDiagram-5QR66LMP-Cu_2J_zG.js +0 -39
- package/dist/client/assets/preload-helper-BZ1Pz5am.js +0 -1
- package/dist/client/assets/radar-RG4KPBEZ-BfNQUEQy.js +0 -1
- package/dist/client/assets/railroad-74A4TZTK-BaQ6U6eJ.js +0 -1
- package/dist/client/assets/railroad-abnf-HS5TGJTU-BJ3KZw7J.js +0 -1
- package/dist/client/assets/railroad-ebnf-LZEXJU2U-DA0sEq7w.js +0 -1
- package/dist/client/assets/railroad-peg-WCYAUIDC-DCmlICzO.js +0 -1
- package/dist/client/assets/runDetached-D_x7Eiol.js +0 -1
- package/dist/client/assets/sankeyDiagram-IPEJSGJF-B4Aq_m_f.js +0 -40
- package/dist/client/assets/sequenceDiagram-PO4LG4MO-nCEd15gL.js +0 -169
- package/dist/client/assets/swimlanesDiagram-TC7HE7FX-BihL4laV.js +0 -8
- package/dist/client/assets/treeView-Q6P3EWNA-BvHOzbu9.js +0 -1
- package/dist/client/assets/treemap-WGGIJYW6-oety7paS.js +0 -1
- package/dist/client/assets/useAppGlobalState-CAqGn8Ly.js +0 -1
- package/dist/client/assets/useKannaState-BUM3PsvR.js +0 -5
- package/dist/client/assets/usecaseDiagram-POWQR4AR-CHJp21mw.js +0 -328
- package/dist/client/assets/wardley-WFR3VGLG-BdwDpX_I.js +0 -1
- package/dist/client/assets/xychartDiagram-PMCCYNJV-CscFdzOK.js +0 -7
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{o as e,t}from"./rolldown-runtime-C0FnF6B9.js";import{t as n}from"./react-DiVRNtpo.js";import{t as r}from"./react-dom-CvX0TCLz.js";import{t as i}from"./jsx-runtime-BdxMnOeJ.js";import{c as a}from"./pendingActionsStore-9qaSyloJ.js";import{i as o,n as s,r as c,v as l}from"./flow-kinds-9RVGvvkd.js";import{n as u}from"./useTheme-BXQFYwx9.js";import"./genui-CR4wkCwK.js";import{C as d,S as f,T as p,_ as m,b as h,i as g,n as _,r as v,t as y,v as b,w as x,x as S,y as C}from"./src-B-DeWB10.js";import{t as w}from"./value-DcGlvoTp.js";import{t as T}from"./shim-DTZXyK8i.js";var E=e=>()=>e;function D(e,{sourceEvent:t,subject:n,target:r,identifier:i,active:a,x:o,y:s,dx:c,dy:l,dispatch:u}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:i,enumerable:!0,configurable:!0},active:{value:a,enumerable:!0,configurable:!0},x:{value:o,enumerable:!0,configurable:!0},y:{value:s,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:l,enumerable:!0,configurable:!0},_:{value:u}})}D.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function O(e){return!e.ctrlKey&&!e.button}function k(){return this.parentNode}function A(e,t){return t??{x:e.x,y:e.y}}function j(){return navigator.maxTouchPoints||`ontouchstart`in this}function M(){var e=O,t=k,n=A,r=j,i={},a=p(`start`,`drag`,`end`),o=0,s,c,l,u,g=0;function _(e){e.on(`mousedown.drag`,v).filter(r).on(`touchstart.drag`,T).on(`touchmove.drag`,M,h).on(`touchend.drag touchcancel.drag`,N).style(`touch-action`,`none`).style(`-webkit-tap-highlight-color`,`rgba(0,0,0,0)`)}function v(n,r){if(!u&&e.call(this,n,r)){var i=P(this,t.call(this,n,r),n,r,`mouse`);i&&(x(n.view).on(`mousemove.drag`,y,S).on(`mouseup.drag`,w,S),m(n.view),f(n),l=!1,s=n.clientX,c=n.clientY,i(`start`,n))}}function y(e){if(C(e),!l){var t=e.clientX-s,n=e.clientY-c;l=t*t+n*n>g}i.mouse(`drag`,e)}function w(e){x(e.view).on(`mousemove.drag mouseup.drag`,null),b(e.view,l),C(e),i.mouse(`end`,e)}function T(n,r){if(e.call(this,n,r))for(var i=n.changedTouches,a=t.call(this,n,r),o=i.length,s=0,c;s<o;++s)(c=P(this,a,n,r,i[s].identifier,i[s]))&&(f(n),c(`start`,n,i[s]))}function M(e){for(var t=e.changedTouches,n=t.length,r=0,a;r<n;++r)(a=i[t[r].identifier])&&(C(e),a(`drag`,e,t[r]))}function N(e){var t=e.changedTouches,n=t.length,r,a;for(u&&clearTimeout(u),u=setTimeout(function(){u=null},500),r=0;r<n;++r)(a=i[t[r].identifier])&&(f(e),a(`end`,e,t[r]))}function P(e,t,r,s,c,l){var u=a.copy(),f=d(l||r,t),p,m,h;if((h=n.call(e,new D(`beforestart`,{sourceEvent:r,target:_,identifier:c,active:o,x:f[0],y:f[1],dx:0,dy:0,dispatch:u}),s))!=null)return p=h.x-f[0]||0,m=h.y-f[1]||0,function n(r,a,l){var g=f,v;switch(r){case`start`:i[c]=n,v=o++;break;case`end`:delete i[c],--o;case`drag`:f=d(l||a,t),v=o}u.call(r,e,new D(r,{sourceEvent:a,subject:h,target:_,identifier:c,active:v,x:f[0]+p,y:f[1]+m,dx:f[0]-g[0],dy:f[1]-g[1],dispatch:u}),s)}}return _.filter=function(t){return arguments.length?(e=typeof t==`function`?t:E(!!t),_):e},_.container=function(e){return arguments.length?(t=typeof e==`function`?e:E(e),_):t},_.subject=function(e){return arguments.length?(n=typeof e==`function`?e:E(e),_):n},_.touchable=function(e){return arguments.length?(r=typeof e==`function`?e:E(!!e),_):r},_.on=function(){var e=a.on.apply(a,arguments);return e===a?_:e},_.clickDistance=function(e){return arguments.length?(g=(e=+e)*e,_):Math.sqrt(g)},_}var N=e(n(),1),P=e(i());function F(e){if(typeof e==`string`||typeof e==`number`)return``+e;let t=``;if(Array.isArray(e))for(let n=0,r;n<e.length;n++)(r=F(e[n]))!==``&&(t+=(t&&` `)+r);else for(let n in e)e[n]&&(t+=(t&&` `)+n);return t}var I={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:r})=>`Couldn't create edge for ${e} handle id: "${e===`source`?n:r}", 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.`},L=[[-1/0,-1/0],[1/0,1/0]],R=[`Enter`,` `,`Escape`],z={"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`},B;(function(e){e.Strict=`strict`,e.Loose=`loose`})(B||={});var V;(function(e){e.Free=`free`,e.Vertical=`vertical`,e.Horizontal=`horizontal`})(V||={});var H;(function(e){e.Partial=`partial`,e.Full=`full`})(H||={});var U={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null},W;(function(e){e.Bezier=`default`,e.Straight=`straight`,e.Step=`step`,e.SmoothStep=`smoothstep`,e.SimpleBezier=`simplebezier`})(W||={});var G;(function(e){e.Arrow=`arrow`,e.ArrowClosed=`arrowclosed`})(G||={});var K;(function(e){e.Left=`left`,e.Top=`top`,e.Right=`right`,e.Bottom=`bottom`})(K||={});var ee={[K.Left]:K.Right,[K.Right]:K.Left,[K.Top]:K.Bottom,[K.Bottom]:K.Top},te=e=>!!e&&typeof e==`object`&&`id`in e&&`source`in e&&`target`in e,ne=e=>!!e&&typeof e==`object`&&`id`in e&&`position`in e&&!(`source`in e)&&!(`target`in e),re=e=>!!e&&typeof e==`object`&&`id`in e&&`internals`in e&&!(`source`in e)&&!(`target`in e),ie=(e,t=[0,0])=>{let{width:n,height:r}=Y(e),i=e.origin??t,a=n*i[0],o=r*i[1];return{x:e.position.x-a,y:e.position.y-o}},ae=(e,t={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};let n=!1,r=e.reduce((e,r)=>{let i=typeof r==`string`,a=!t.nodeLookup&&!i?r:void 0;return t.nodeLookup&&(a=i?t.nodeLookup.get(r):re(r)?r:t.nodeLookup.get(r.id)),a?(n=!0,_e(e,xe(a,t.nodeOrigin))):e},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return n?ye(r):{x:0,y:0,width:0,height:0}},oe=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},r=!1;return e.forEach(e=>{(t.filter===void 0||t.filter(e))&&(n=_e(n,xe(e)),r=!0)}),r?ye(n):{x:0,y:0,width:0,height:0}},se=(e,t,[n,r,i]=[0,0,1],a=!1,o=!1)=>{let s=(t.x-n)/i,c=(t.y-r)/i,l=t.width/i,u=t.height/i,d=[];for(let t of e.values()){let{measured:e,selectable:n=!0,hidden:r=!1}=t;if(o&&!n||r)continue;let i=e.width??t.width??t.initialWidth??0,f=e.height??t.height??t.initialHeight??0,{x:p,y:m}=t.internals.positionAbsolute,h=Ce(s,c,l,u,p,m,i,f),g=i*f,_=a&&h>0;(!t.internals.handleBounds||_||h>=g||t.dragging)&&d.push(t)}return d},ce=(e,t)=>{let n=new Set;return e.forEach(e=>{n.add(e.id)}),t.filter(e=>n.has(e.source)||n.has(e.target))};function le(e,t){let n=new Map,r=t?.nodes?new Set(t.nodes.map(e=>e.id)):null;return e.forEach(e=>{let i;if(t?.includeHiddenNodes){let{width:t,height:n}=Y(e);i=t>0&&n>0}else i=!!(e.measured.width&&e.measured.height&&!e.hidden);i&&(!r||r.has(e.id))&&n.set(e.id,e)}),n}async function ue({nodes:e,width:t,height:n,panZoom:r,minZoom:i,maxZoom:a},o){if(e.size===0)return!0;let s=Ne(oe(le(e,o)),t,n,o?.minZoom??i,o?.maxZoom??a,o?.padding??.1);return await r.setViewport(s,{duration:o?.duration,ease:o?.ease,interpolate:o?.interpolate}),!0}function de({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:r=[0,0],nodeExtent:i,onError:a}){let o=n.get(e),s=o.parentId?n.get(o.parentId):void 0,{x:c,y:l}=s?s.internals.positionAbsolute:{x:0,y:0},u=o.origin??r,d=o.extent||i;if(o.extent===`parent`&&!o.expandParent){if(!s)a?.(`005`,I.error005());else{let{width:e,height:t}=Y(s);e&&t&&(d=[[c,l],[c+e,l+t]])}}else s&&Fe(o.extent)&&(d=[[o.extent[0][0]+c,o.extent[0][1]+l],[o.extent[1][0]+c,o.extent[1][1]+l]]);let f=Fe(d)?pe(t,d,o.measured):t;return(o.measured.width===void 0||o.measured.height===void 0)&&a?.(`015`,I.error015()),{position:{x:f.x-c+(o.measured.width??0)*u[0],y:f.y-l+(o.measured.height??0)*u[1]},positionAbsolute:f}}async function fe({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:r,onBeforeDelete:i}){let a=new Set(e.map(e=>e.id)),o=[];for(let e of n){if(e.deletable===!1)continue;let t=a.has(e.id),n=!t&&e.parentId&&o.find(t=>t.id===e.parentId);(t||n)&&o.push(e)}let s=new Set(t.map(e=>e.id)),c=r.filter(e=>e.deletable!==!1),l=ce(o,c);for(let e of c)s.has(e.id)&&!l.find(t=>t.id===e.id)&&l.push(e);if(!i)return{edges:l,nodes:o};let u=await i({nodes:o,edges:l});return typeof u==`boolean`?u?{edges:l,nodes:o}:{edges:[],nodes:[]}:u}var q=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),pe=(e={x:0,y:0},t,n)=>({x:q(e.x,t[0][0],t[1][0]-(n?.width??0)),y:q(e.y,t[0][1],t[1][1]-(n?.height??0))});function me(e,t,n){let{width:r,height:i}=Y(n),{x:a,y:o}=n.internals.positionAbsolute;return pe(e,[[a,o],[a+r,o+i]],t)}var he=(e,t,n)=>e<t?q(Math.abs(e-t),1,t)/t:e>n?-q(Math.abs(e-n),1,t)/t:0,ge=(e,t,n=15,r=40)=>[he(e.x,r,t.width-r)*n,he(e.y,r,t.height-r)*n],_e=(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)}),ve=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),ye=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),be=(e,t=[0,0])=>{let{x:n,y:r}=re(e)?e.internals.positionAbsolute:ie(e,t);return{x:n,y:r,width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}},xe=(e,t=[0,0])=>{let{x:n,y:r}=re(e)?e.internals.positionAbsolute:ie(e,t);return{x:n,y:r,x2:n+(e.measured?.width??e.width??e.initialWidth??0),y2:r+(e.measured?.height??e.height??e.initialHeight??0)}},Se=(e,t)=>ye(_e(ve(e),ve(t))),Ce=(e,t,n,r,i,a,o,s)=>{let c=Math.max(0,Math.min(e+n,i+o)-Math.max(e,i)),l=Math.max(0,Math.min(t+r,a+s)-Math.max(t,a));return Math.ceil(c*l)},we=(e,t)=>Ce(e.x,e.y,e.width,e.height,t.x,t.y,t.width,t.height),Te=e=>J(e.width)&&J(e.height)&&J(e.x)&&J(e.y),J=e=>!isNaN(e)&&isFinite(e),Ee=(e,t)=>(e,t)=>{},De=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),Oe=({x:e,y:t},[n,r,i],a=!1,o=[1,1])=>{let s={x:(e-n)/i,y:(t-r)/i};return a?De(s,o):s},ke=({x:e,y:t},[n,r,i])=>({x:e*i+n,y:t*i+r});function Ae(e,t){if(typeof e==`number`)return Math.floor((t-t/(1+e))*.5);if(typeof e==`string`&&e.endsWith(`px`)){let t=parseFloat(e);if(!Number.isNaN(t))return Math.floor(t)}if(typeof e==`string`&&e.endsWith(`%`)){let 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 je(e,t,n){if(typeof e==`string`||typeof e==`number`){let r=Ae(e,n),i=Ae(e,t);return{top:r,right:i,bottom:r,left:i,x:i*2,y:r*2}}if(typeof e==`object`){let r=Ae(e.top??e.y??0,n),i=Ae(e.bottom??e.y??0,n),a=Ae(e.left??e.x??0,t),o=Ae(e.right??e.x??0,t);return{top:r,right:o,bottom:i,left:a,x:a+o,y:r+i}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function Me(e,t,n,r,i,a){let{x:o,y:s}=ke(e,[t,n,r]),{x:c,y:l}=ke({x:e.x+e.width,y:e.y+e.height},[t,n,r]),u=i-c,d=a-l;return{left:Math.floor(o),top:Math.floor(s),right:Math.floor(u),bottom:Math.floor(d)}}var Ne=(e,t,n,r,i,a)=>{let o=je(a,t,n),s=(t-o.x)/e.width,c=(n-o.y)/e.height,l=q(Math.min(s,c),r,i),u=e.x+e.width/2,d=e.y+e.height/2,f=t/2-u*l,p=n/2-d*l,m=Me(e,f,p,l,t,n),h={left:Math.min(m.left-o.left,0),top:Math.min(m.top-o.top,0),right:Math.min(m.right-o.right,0),bottom:Math.min(m.bottom-o.bottom,0)};return{x:f-h.left+h.right,y:p-h.top+h.bottom,zoom:l}},Pe=()=>typeof navigator<`u`&&navigator?.userAgent?.indexOf(`Mac`)>=0;function Fe(e){return e!=null&&e!==`parent`}function Y(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function Ie(e){return(e.measured?.width??e.width??e.initialWidth)!==void 0&&(e.measured?.height??e.height??e.initialHeight)!==void 0}function Le(e,t={width:0,height:0},n,r,i){let a={...e},o=r.get(n);if(o){let e=o.origin||i;a.x+=o.internals.positionAbsolute.x-(t.width??0)*e[0],a.y+=o.internals.positionAbsolute.y-(t.height??0)*e[1]}return a}function Re(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function ze(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}function Be(e){return{...z,...e||{}}}function Ve(e){return e===null?null:e?`valid`:`invalid`}function He(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:i}){let{x:a,y:o}=X(e),s=Oe({x:a-(i?.left??0),y:o-(i?.top??0)},r),{x:c,y:l}=n?De(s,t):s;return{xSnapped:c,ySnapped:l,...s}}var Ue=e=>({width:e.offsetWidth,height:e.offsetHeight}),We=e=>e?.getRootNode?.()||window?.document,Ge=[`INPUT`,`SELECT`,`TEXTAREA`];function Ke(e){let t=e.composedPath?.()?.[0]||e.target;return t?.nodeType===1?Ge.includes(t.nodeName)||t.hasAttribute(`contenteditable`)||!!t.closest(`.nokey`):!1}var qe=e=>`clientX`in e,X=(e,t)=>{let n=qe(e),r=n?e.clientX:e.touches?.[0].clientX,i=n?e.clientY:e.touches?.[0].clientY;return{x:r-(t?.left??0),y:i-(t?.top??0)}},Je=(e,t,n,r,i)=>{let a=t.querySelectorAll(`.${e}`);return!a||!a.length?null:Array.from(a).map(t=>{let a=t.getBoundingClientRect();return{id:t.getAttribute(`data-handleid`),type:e,nodeId:i,position:t.getAttribute(`data-handlepos`),x:(a.left-n.left)/r,y:(a.top-n.top)/r,...Ue(t)}})};function Ye({sourceX:e,sourceY:t,targetX:n,targetY:r,sourceControlX:i,sourceControlY:a,targetControlX:o,targetControlY:s}){let c=e*.125+i*.375+o*.375+n*.125,l=t*.125+a*.375+s*.375+r*.125;return[c,l,Math.abs(c-e),Math.abs(l-t)]}function Xe(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function Ze({pos:e,x1:t,y1:n,x2:r,y2:i,c:a}){switch(e){case K.Left:return[t-Xe(t-r,a),n];case K.Right:return[t+Xe(r-t,a),n];case K.Top:return[t,n-Xe(n-i,a)];case K.Bottom:return[t,n+Xe(i-n,a)]}}function Qe({sourceX:e,sourceY:t,sourcePosition:n=K.Bottom,targetX:r,targetY:i,targetPosition:a=K.Top,curvature:o=.25}){let[s,c]=Ze({pos:n,x1:e,y1:t,x2:r,y2:i,c:o}),[l,u]=Ze({pos:a,x1:r,y1:i,x2:e,y2:t,c:o}),[d,f,p,m]=Ye({sourceX:e,sourceY:t,targetX:r,targetY:i,sourceControlX:s,sourceControlY:c,targetControlX:l,targetControlY:u});return[`M${e},${t} C${s},${c} ${l},${u} ${r},${i}`,d,f,p,m]}function $e({sourceX:e,sourceY:t,targetX:n,targetY:r}){let i=Math.abs(n-e)/2,a=n<e?n+i:n-i,o=Math.abs(r-t)/2;return[a,r<t?r+o:r-o,i,o]}function et({sourceNode:e,targetNode:t,selected:n=!1,zIndex:r=0,elevateOnSelect:i=!1,zIndexMode:a=`basic`}){return a===`manual`?r:(i&&n?r+1e3:r)+Math.max(e.parentId||i&&e.selected?e.internals.z:0,t.parentId||i&&t.selected?t.internals.z:0)}function tt({sourceNode:e,targetNode:t,width:n,height:r,transform:i}){let a=_e(xe(e),xe(t));return a.x===a.x2&&(a.x2+=1),a.y===a.y2&&(a.y2+=1),we({x:-i[0]/i[2],y:-i[1]/i[2],width:n/i[2],height:r/i[2]},ye(a))>0}var nt=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||``}-${n}${r||``}`,rt=(e,t)=>t.some(t=>t.source===e.source&&t.target===e.target&&(t.sourceHandle===e.sourceHandle||!t.sourceHandle&&!e.sourceHandle)&&(t.targetHandle===e.targetHandle||!t.targetHandle&&!e.targetHandle)),it=(e,t,n={})=>{if(!e.source||!e.target)return n.onError?.(`006`,I.error006()),t;let r=n.getEdgeId||nt,i;return i=te(e)?{...e}:{...e,id:r(e)},rt(i,t)?t:(i.sourceHandle===null&&delete i.sourceHandle,i.targetHandle===null&&delete i.targetHandle,t.concat(i))};function at({sourceX:e,sourceY:t,targetX:n,targetY:r}){let[i,a,o,s]=$e({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,i,a,o,s]}var ot={[K.Left]:{x:-1,y:0},[K.Right]:{x:1,y:0},[K.Top]:{x:0,y:-1},[K.Bottom]:{x:0,y:1}},st=({source:e,sourcePosition:t=K.Bottom,target:n})=>t===K.Left||t===K.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},ct=(e,t)=>Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2);function lt({source:e,sourcePosition:t=K.Bottom,target:n,targetPosition:r=K.Top,center:i,offset:a,stepPosition:o}){let s=ot[t],c=ot[r],l={x:e.x+s.x*a,y:e.y+s.y*a},u={x:n.x+c.x*a,y:n.y+c.y*a},d=st({source:l,sourcePosition:t,target:u}),f=d.x===0?`y`:`x`,p=d[f],m=[],h,g,_={x:0,y:0},v={x:0,y:0},[,,y,b]=$e({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(s[f]*c[f]===-1){f===`x`?(h=i.x??l.x+(u.x-l.x)*o,g=i.y??(l.y+u.y)/2):(h=i.x??(l.x+u.x)/2,g=i.y??l.y+(u.y-l.y)*o);let e=[{x:h,y:l.y},{x:h,y:u.y}],t=[{x:l.x,y:g},{x:u.x,y:g}];m=s[f]===p?f===`x`?e:t:f===`x`?t:e}else{let i=[{x:l.x,y:u.y}],o=[{x:u.x,y:l.y}];if(m=f===`x`?s.x===p?o:i:s.y===p?i:o,t===r){let t=Math.abs(e[f]-n[f]);if(t<=a){let r=Math.min(a-1,a-t);s[f]===p?_[f]=(l[f]>e[f]?-1:1)*r:v[f]=(u[f]>n[f]?-1:1)*r}}if(t!==r){let e=f===`x`?`y`:`x`,t=s[f]===c[e],n=l[e]>u[e],r=l[e]<u[e];(s[f]===1&&(!t&&n||t&&r)||s[f]!==1&&(!t&&r||t&&n))&&(m=f===`x`?i:o)}let d={x:l.x+_.x,y:l.y+_.y},y={x:u.x+v.x,y:u.y+v.y};Math.max(Math.abs(d.x-m[0].x),Math.abs(y.x-m[0].x))>=Math.max(Math.abs(d.y-m[0].y),Math.abs(y.y-m[0].y))?(h=(d.x+y.x)/2,g=m[0].y):(h=m[0].x,g=(d.y+y.y)/2)}let x={x:l.x+_.x,y:l.y+_.y},S={x:u.x+v.x,y:u.y+v.y};return[[e,...x.x!==m[0].x||x.y!==m[0].y?[x]:[],...m,...S.x!==m[m.length-1].x||S.y!==m[m.length-1].y?[S]:[],n],h,g,y,b]}function ut(e,t,n,r){let i=Math.min(ct(e,t)/2,ct(t,n)/2,r),{x:a,y:o}=t;if(e.x===a&&a===n.x||e.y===o&&o===n.y)return`L${a} ${o}`;if(e.y===o){let t=e.x<n.x?-1:1,r=e.y<n.y?1:-1;return`L ${a+i*t},${o}Q ${a},${o} ${a},${o+i*r}`}let s=e.x<n.x?1:-1;return`L ${a},${o+i*(e.y<n.y?-1:1)}Q ${a},${o} ${a+i*s},${o}`}function dt({sourceX:e,sourceY:t,sourcePosition:n=K.Bottom,targetX:r,targetY:i,targetPosition:a=K.Top,borderRadius:o=5,centerX:s,centerY:c,offset:l=20,stepPosition:u=.5}){let[d,f,p,m,h]=lt({source:{x:e,y:t},sourcePosition:n,target:{x:r,y:i},targetPosition:a,center:{x:s,y:c},offset:l,stepPosition:u}),g=`M${d[0].x} ${d[0].y}`;for(let e=1;e<d.length-1;e++)g+=ut(d[e-1],d[e],d[e+1],o);return g+=`L${d[d.length-1].x} ${d[d.length-1].y}`,[g,f,p,m,h]}function ft(e){return e&&!!(e.internals.handleBounds||e.handles?.length)&&!!(e.measured.width||e.width||e.initialWidth)}function pt(e){let{sourceNode:t,targetNode:n}=e;if(!ft(t)||!ft(n))return null;let r=t.internals.handleBounds||mt(t.handles),i=n.internals.handleBounds||mt(n.handles),a=gt(r?.source??[],e.sourceHandle),o=gt(e.connectionMode===B.Strict?i?.target??[]:(i?.target??[]).concat(i?.source??[]),e.targetHandle);if(!a||!o)return e.onError?.(`008`,I.error008(a?`target`:`source`,{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;let s=a?.position||K.Bottom,c=o?.position||K.Top,l=ht(t,a,s),u=ht(n,o,c);return{sourceX:l.x,sourceY:l.y,targetX:u.x,targetY:u.y,sourcePosition:s,targetPosition:c}}function mt(e){if(!e)return null;let t=[],n=[];for(let r of e)r.width=r.width??1,r.height=r.height??1,r.type===`source`?t.push(r):r.type===`target`&&n.push(r);return{source:t,target:n}}function ht(e,t,n=K.Left,r=!1){let i=(t?.x??0)+e.internals.positionAbsolute.x,a=(t?.y??0)+e.internals.positionAbsolute.y,{width:o,height:s}=t??Y(e);if(r)return{x:i+o/2,y:a+s/2};switch(t?.position??n){case K.Top:return{x:i+o/2,y:a};case K.Right:return{x:i+o,y:a+s/2};case K.Bottom:return{x:i+o/2,y:a+s};case K.Left:return{x:i,y:a+s/2}}}function gt(e,t){return e&&(t?e.find(e=>e.id===t):e[0])||null}function _t(e,t){return e?typeof e==`string`?e:`${t?`${t}__`:``}${Object.keys(e).sort().map(t=>`${t}=${e[t]}`).join(`&`)}`:``}function vt(e,{id:t,defaultColor:n,defaultMarkerStart:r,defaultMarkerEnd:i}){let a=new Set;return e.reduce((e,o)=>([o.markerStart||r,o.markerEnd||i].forEach(r=>{if(r&&typeof r==`object`){let i=_t(r,t);a.has(i)||(e.push({id:i,color:r.color||n,...r}),a.add(i))}}),e),[]).sort((e,t)=>e.id.localeCompare(t.id))}var yt=1e3,bt=10,xt={nodeOrigin:[0,0],nodeExtent:L,elevateNodesOnSelect:!0,zIndexMode:`basic`,defaults:{}},St={...xt,checkEquality:!0};function Ct(e,t){let n={...e};for(let e in t)t[e]!==void 0&&(n[e]=t[e]);return n}function wt(e,t,n){let r=Ct(xt,n);for(let n of e.values())if(n.parentId)kt(n,e,t,r);else{let e=pe(ie(n,r.nodeOrigin),Fe(n.extent)?n.extent:r.nodeExtent,Y(n));n.internals.positionAbsolute=e}}function Tt(e,t){if(!e.handles)return e.measured?t?.internals.handleBounds:void 0;let n=[],r=[];for(let t of e.handles){let i={id:t.id,width:t.width??1,height:t.height??1,nodeId:e.id,x:t.x,y:t.y,position:t.position,type:t.type};t.type===`source`?n.push(i):t.type===`target`&&r.push(i)}return{source:n,target:r}}function Et(e){return e===`manual`}function Dt(e,t,n,r={}){let i=Ct(St,r),a={i:0},o=new Map(t),s=i?.elevateNodesOnSelect&&!Et(i.zIndexMode)?yt:0,c=e.length>0,l=!1;t.clear(),n.clear();for(let u of e){let e=o.get(u.id);if(i.checkEquality&&u===e?.internals.userNode)t.set(u.id,e);else{let n=pe(ie(u,i.nodeOrigin),Fe(u.extent)?u.extent:i.nodeExtent,Y(u));e={...i.defaults,...u,measured:{width:u.measured?.width,height:u.measured?.height},internals:{positionAbsolute:n,handleBounds:Tt(u,e),z:At(u,s,i.zIndexMode),userNode:u}},t.set(u.id,e)}(e.measured===void 0||e.measured.width===void 0||e.measured.height===void 0)&&!e.hidden&&(c=!1),u.parentId&&kt(e,t,n,r,a),l||=u.selected??!1}return{nodesInitialized:c,hasSelectedNodes:l}}function Ot(e,t){if(!e.parentId)return;let n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function kt(e,t,n,r,i){let{elevateNodesOnSelect:a,nodeOrigin:o,nodeExtent:s,zIndexMode:c}=Ct(xt,r),l=e.parentId,u=t.get(l);if(!u){console.warn(`Parent node ${l} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}Ot(e,n),i&&!u.parentId&&u.internals.rootParentIndex===void 0&&c===`auto`&&(u.internals.rootParentIndex=++i.i,u.internals.z=u.internals.z+i.i*bt),i&&u.internals.rootParentIndex!==void 0&&(i.i=u.internals.rootParentIndex);let{x:d,y:f,z:p}=jt(e,u,o,s,a&&!Et(c)?yt:0,c),{positionAbsolute:m}=e.internals,h=d!==m.x||f!==m.y;(h||p!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:h?{x:d,y:f}:m,z:p}})}function At(e,t,n){let r=J(e.zIndex)?e.zIndex:0;return Et(n)?r:r+(e.selected?t:0)}function jt(e,t,n,r,i,a){let{x:o,y:s}=t.internals.positionAbsolute,c=Y(e),l=ie(e,n),u=Fe(e.extent)?pe(l,e.extent,c):l,d=pe({x:o+u.x,y:s+u.y},r,c);e.extent===`parent`&&(d=me(d,c,t));let f=At(e,i,a),p=t.internals.z??0;return{x:d.x,y:d.y,z:p>=f?p+1:f}}function Mt(e,t,n,r=[0,0]){let i=[],a=new Map;for(let n of e){let e=t.get(n.parentId);if(!e)continue;let r=Se(a.get(n.parentId)?.expandedRect??be(e),n.rect);a.set(n.parentId,{expandedRect:r,parent:e})}return a.size>0&&a.forEach(({expandedRect:t,parent:a},o)=>{let s=a.internals.positionAbsolute,c=Y(a),l=a.origin??r,u=t.x<s.x?Math.round(Math.abs(s.x-t.x)):0,d=t.y<s.y?Math.round(Math.abs(s.y-t.y)):0,f=Math.max(c.width,Math.round(t.width)),p=Math.max(c.height,Math.round(t.height)),m=(f-c.width)*l[0],h=(p-c.height)*l[1];(u>0||d>0||m||h)&&(i.push({id:o,type:`position`,position:{x:a.position.x-u+m,y:a.position.y-d+h}}),n.get(o)?.forEach(t=>{e.some(e=>e.id===t.id)||i.push({id:t.id,type:`position`,position:{x:t.position.x+u,y:t.position.y+d}})})),(c.width<t.width||c.height<t.height||u||d)&&i.push({id:o,type:`dimensions`,setAttributes:!0,dimensions:{width:f+(u?l[0]*u-m:0),height:p+(d?l[1]*d-h:0)}})}),i}function Nt(e,t,n,r,i,a,o){let s=r?.querySelector(`.xyflow__viewport`),c=!1;if(!s)return{changes:[],updatedInternals:c};let l=[],u=window.getComputedStyle(s),{m22:d}=new window.DOMMatrixReadOnly(u.transform),f=[];for(let r of e.values()){let e=t.get(r.id);if(!e)continue;if(e.hidden){t.set(e.id,{...e,internals:{...e.internals,handleBounds:void 0}}),c=!0;continue}let s=Ue(r.nodeElement),u=e.measured.width!==s.width||e.measured.height!==s.height;if(s.width&&s.height&&(u||!e.internals.handleBounds||r.force)){let p=r.nodeElement.getBoundingClientRect(),m=Fe(e.extent)?e.extent:a,{positionAbsolute:h}=e.internals;if(e.parentId&&e.extent===`parent`){let n=t.get(e.parentId);n&&(h=me(h,s,n))}else m&&(h=pe(h,m,s));let g={...e,measured:s,internals:{...e.internals,positionAbsolute:h,handleBounds:{source:Je(`source`,r.nodeElement,p,d,e.id),target:Je(`target`,r.nodeElement,p,d,e.id)}}};t.set(e.id,g),e.parentId&&kt(g,t,n,{nodeOrigin:i,zIndexMode:o}),c=!0,u&&(l.push({id:e.id,type:`dimensions`,dimensions:s}),e.expandParent&&e.parentId&&f.push({id:e.id,parentId:e.parentId,rect:be(g,i)}))}}if(f.length>0){let e=Mt(f,t,n,i);l.push(...e)}return{changes:l,updatedInternals:c}}async function Pt({delta:e,panZoom:t,transform:n,translateExtent:r,width:i,height:a}){if(!t||!e.x&&!e.y)return!1;let o=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[i,a]],r);return!!o&&(o.x!==n[0]||o.y!==n[1]||o.k!==n[2])}function Ft(e,t,n,r,i,a){let o=i,s=r.get(o)||new Map;r.set(o,s.set(n,t)),o=`${i}-${e}`;let c=r.get(o)||new Map;if(r.set(o,c.set(n,t)),a){o=`${i}-${e}-${a}`;let s=r.get(o)||new Map;r.set(o,s.set(n,t))}}function It(e,t,n){e.clear(),t.clear();for(let r of n){let{source:n,target:i,sourceHandle:a=null,targetHandle:o=null}=r,s={edgeId:r.id,source:n,target:i,sourceHandle:a,targetHandle:o},c=`${n}-${a}--${i}-${o}`;Ft(`source`,s,`${i}-${o}--${n}-${a}`,e,n,a),Ft(`target`,s,c,e,i,o),t.set(r.id,r)}}function Lt(e,t){if(!e.parentId)return!1;let n=t.get(e.parentId);return n?n.selected?!0:Lt(n,t):!1}function Rt(e,t,n){let r=e;do{if(r?.matches?.(t))return!0;if(r===n)return!1;r=r?.parentElement}while(r);return!1}function zt(e,t,n,r){let i=new Map;for(let[a,o]of e)if((o.selected||o.id===r)&&(!o.parentId||!Lt(o,e))&&(o.draggable||t&&o.draggable===void 0)){let t=e.get(a);t&&i.set(a,{id:a,position:t.position||{x:0,y:0},distance:{x:n.x-t.internals.positionAbsolute.x,y:n.y-t.internals.positionAbsolute.y},extent:t.extent,parentId:t.parentId,origin:t.origin,expandParent:t.expandParent,internals:{positionAbsolute:t.internals.positionAbsolute||{x:0,y:0}},measured:{width:t.measured.width??0,height:t.measured.height??0}})}return i}function Bt({nodeId:e,dragItems:t,nodeLookup:n,dragging:r=!0}){let i=[];for(let[e,a]of t){let t=n.get(e)?.internals.userNode;t&&i.push({...t,position:a.position,dragging:r})}if(!e)return[i[0],i];let a=n.get(e)?.internals.userNode;return[a?{...a,position:t.get(e)?.position||a.position,dragging:r}:i[0],i]}function Vt({dragItems:e,snapGrid:t,x:n,y:r}){let i=e.values().next().value;if(!i)return null;let a={x:n-i.distance.x,y:r-i.distance.y},o=De(a,t);return{x:o.x-a.x,y:o.y-a.y}}function Ht({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:r,onDragStop:i}){let a={x:null,y:null},o=0,s=new Map,c=!1,l={x:0,y:0},u=null,d=!1,f=null,p=!1,m=!1,h=null;function g({noDragClassName:g,handleSelector:_,domNode:v,isSelectable:y,nodeId:b,nodeClickDistance:S=0}){f=x(v);function C({x:e,y:n}){let{nodeLookup:i,nodeExtent:o,snapGrid:c,snapToGrid:l,nodeOrigin:u,onNodeDrag:d,onSelectionDrag:f,onError:p,updateNodePositions:g}=t();a={x:e,y:n};let _=!1,v=s.size>1,y=v&&o?ve(oe(s)):null,x=v&&l?Vt({dragItems:s,snapGrid:c,x:e,y:n}):null;for(let[t,r]of s){if(!i.has(t))continue;let a={x:e-r.distance.x,y:n-r.distance.y};l&&(a=x?{x:Math.round(a.x+x.x),y:Math.round(a.y+x.y)}:De(a,c));let s=null;if(v&&o&&!r.extent&&y){let{positionAbsolute:e}=r.internals,t=e.x-y.x+o[0][0],n=e.x+r.measured.width-y.x2+o[1][0],i=e.y-y.y+o[0][1],a=e.y+r.measured.height-y.y2+o[1][1];s=[[t,i],[n,a]]}let{position:d,positionAbsolute:f}=de({nodeId:t,nextPosition:a,nodeLookup:i,nodeExtent:s||o,nodeOrigin:u,onError:p});_=_||r.position.x!==d.x||r.position.y!==d.y,r.position=d,r.internals.positionAbsolute=f}if(m||=_,_&&(g(s,!0),h&&(r||d||!b&&f))){let[e,t]=Bt({nodeId:b,dragItems:s,nodeLookup:i});r?.(h,s,e,t),d?.(h,e,t),b||f?.(h,t)}}async function w(){if(!u)return;let{transform:e,panBy:n,autoPanSpeed:r,autoPanOnNodeDrag:i}=t();if(!i){c=!1,cancelAnimationFrame(o);return}let[s,d]=ge(l,u,r);(s!==0||d!==0)&&(a.x=(a.x??0)-s/e[2],a.y=(a.y??0)-d/e[2],await n({x:s,y:d})&&C(a)),o=requestAnimationFrame(w)}function T(r){let{nodeLookup:i,multiSelectionActive:o,nodesDraggable:c,transform:l,snapGrid:f,snapToGrid:p,selectNodesOnDrag:m,onNodeDragStart:h,onSelectionDragStart:g,unselectNodesAndEdges:_}=t();d=!0,(!m||!y)&&!o&&b&&(i.get(b)?.selected||_()),y&&m&&b&&e?.(b);let v=He(r.sourceEvent,{transform:l,snapGrid:f,snapToGrid:p,containerBounds:u});if(a=v,s=zt(i,c,v,b),s.size>0&&(n||h||!b&&g)){let[e,t]=Bt({nodeId:b,dragItems:s,nodeLookup:i});n?.(r.sourceEvent,s,e,t),h?.(r.sourceEvent,e,t),b||g?.(r.sourceEvent,t)}}let E=M().clickDistance(S).on(`start`,e=>{let{domNode:n,nodeDragThreshold:r,transform:i,snapGrid:o,snapToGrid:s}=t();u=n?.getBoundingClientRect()||null,p=!1,m=!1,h=e.sourceEvent,r===0&&T(e),a=He(e.sourceEvent,{transform:i,snapGrid:o,snapToGrid:s,containerBounds:u}),l=X(e.sourceEvent,u)}).on(`drag`,e=>{let{autoPanOnNodeDrag:n,transform:r,snapGrid:i,snapToGrid:o,nodeDragThreshold:f,nodeLookup:m}=t(),g=He(e.sourceEvent,{transform:r,snapGrid:i,snapToGrid:o,containerBounds:u});if(h=e.sourceEvent,(e.sourceEvent.type===`touchmove`&&e.sourceEvent.touches.length>1||b&&!m.has(b))&&(p=!0),!p){if(!c&&n&&d&&(c=!0,w()),!d){let t=X(e.sourceEvent,u),n=t.x-l.x,r=t.y-l.y;Math.sqrt(n*n+r*r)>f&&T(e)}(a.x!==g.xSnapped||a.y!==g.ySnapped)&&s&&d&&(l=X(e.sourceEvent,u),C(g))}}).on(`end`,e=>{if(!d||p){p&&s.size>0&&t().updateNodePositions(s,!1);return}if(c=!1,d=!1,cancelAnimationFrame(o),s.size>0){let{nodeLookup:n,updateNodePositions:r,onNodeDragStop:a,onSelectionDragStop:o}=t();if(m&&=(r(s,!1),!1),i||a||!b&&o){let[t,r]=Bt({nodeId:b,dragItems:s,nodeLookup:n,dragging:!1});i?.(e.sourceEvent,s,t,r),a?.(e.sourceEvent,t,r),b||o?.(e.sourceEvent,r)}}}).filter(e=>{let t=e.target;return!e.button&&(!g||!Rt(t,`.${g}`,v))&&(!_||Rt(t,_,v))});f.call(E)}function _(){f?.on(`.drag`,null)}return{update:g,destroy:_}}function Ut(e,t,n){let r=[],i={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(let e of t.values())we(i,be(e))>0&&r.push(e);return r}var Wt=250;function Gt(e,t,n,r){let i=[],a=1/0,o=Ut(e,n,t+Wt);for(let n of o){let o=[...n.internals.handleBounds?.source??[],...n.internals.handleBounds?.target??[]];for(let s of o){if(r.nodeId===s.nodeId&&r.type===s.type&&r.id===s.id)continue;let{x:o,y:c}=ht(n,s,s.position,!0),l=Math.sqrt((o-e.x)**2+(c-e.y)**2);l>t||(l<a?(i=[{...s,x:o,y:c}],a=l):l===a&&i.push({...s,x:o,y:c}))}}if(!i.length)return null;if(i.length>1){let e=r.type===`source`?`target`:`source`;return i.find(t=>t.type===e)??i[0]}return i[0]}function Kt(e,t,n,r,i,a=!1){let o=r.get(e);if(!o)return null;let s=i===`strict`?o.internals.handleBounds?.[t]:[...o.internals.handleBounds?.source??[],...o.internals.handleBounds?.target??[]],c=(n?s?.find(e=>e.id===n):s?.[0])??null;return c&&a?{...c,...ht(o,c,c.position,!0)}:c}function qt(e,t){return e||(t?.classList.contains(`target`)?`target`:t?.classList.contains(`source`)?`source`:null)}function Jt(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}var Yt=()=>!0;function Xt(e,{connectionMode:t,connectionRadius:n,handleId:r,nodeId:i,edgeUpdaterType:a,isTarget:o,domNode:s,nodeLookup:c,lib:l,autoPanOnConnect:u,flowId:d,panBy:f,cancelConnection:p,onConnectStart:m,onConnect:h,onConnectEnd:g,isValidConnection:_=Yt,onReconnectEnd:v,updateConnection:y,getTransform:b,getFromHandle:x,autoPanSpeed:S,dragThreshold:C=1,handleDomNode:w}){let T=We(e.target),E=0,D,{x:O,y:k}=X(e),A=qt(a,w),j=s?.getBoundingClientRect(),M=!1;if(!j||!A)return;let N=Kt(i,A,r,c,t);if(!N)return;let P=X(e,j),F=!1,I=null,L=!1,R=null;function z(){if(!u||!j)return;let[e,t]=ge(P,j,S);f({x:e,y:t}),E=requestAnimationFrame(z)}let B={...N,nodeId:i,type:A,position:N.position},V=c.get(i),H={inProgress:!0,isValid:null,from:ht(V,B,K.Left,!0),fromHandle:B,fromPosition:B.position,fromNode:V,to:P,toHandle:null,toPosition:ee[B.position],toNode:null,pointer:P};function U(){M=!0,y(H),m?.(e,{nodeId:i,handleId:r,handleType:A})}C===0&&U();function W(e){if(!M){let{x:t,y:n}=X(e),r=t-O,i=n-k;if(!(r*r+i*i>C*C))return;U()}if(!x()||!B){G(e);return}let a=b();P=X(e,j),D=Gt(Oe(P,a,!1,[1,1]),n,c,B),F||=(z(),!0);let s=Zt(e,{handle:D,connectionMode:t,fromNodeId:i,fromHandleId:r,fromType:o?`target`:`source`,isValidConnection:_,doc:T,lib:l,flowId:d,nodeLookup:c});R=s.handleDomNode,I=s.connection,L=Jt(!!D,s.isValid);let u=c.get(i),f=u?ht(u,B,K.Left,!0):H.from,p={...H,from:f,isValid:L,to:s.toHandle&&L?ke({x:s.toHandle.x,y:s.toHandle.y},a):P,toHandle:s.toHandle,toPosition:L&&s.toHandle?s.toHandle.position:ee[B.position],toNode:s.toHandle?c.get(s.toHandle.nodeId):null,pointer:P};y(p),H=p}function G(e){if(!(`touches`in e&&e.touches.length>0)){if(M){(D||R)&&I&&L&&h?.(I);let{inProgress:t,...n}=H,r={...n,toPosition:H.toHandle?H.toPosition:null};g?.(e,r),a&&v?.(e,r)}p(),cancelAnimationFrame(E),F=!1,L=!1,I=null,R=null,T.removeEventListener(`mousemove`,W),T.removeEventListener(`mouseup`,G),T.removeEventListener(`touchmove`,W),T.removeEventListener(`touchend`,G)}}T.addEventListener(`mousemove`,W),T.addEventListener(`mouseup`,G),T.addEventListener(`touchmove`,W),T.addEventListener(`touchend`,G)}function Zt(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:i,fromType:a,doc:o,lib:s,flowId:c,isValidConnection:l=Yt,nodeLookup:u}){let d=a===`target`,f=t?o.querySelector(`.${s}-flow__handle[data-id="${c}-${t?.nodeId}-${t?.id}-${t?.type}"]`):null,{x:p,y:m}=X(e),h=o.elementFromPoint(p,m),g=h?.classList.contains(`${s}-flow__handle`)?h:f,_={handleDomNode:g,isValid:!1,connection:null,toHandle:null};if(g){let e=qt(void 0,g),t=g.getAttribute(`data-nodeid`),a=g.getAttribute(`data-handleid`),o=g.classList.contains(`connectable`),s=g.classList.contains(`connectableend`);if(!t||!e)return _;let c={source:d?t:r,sourceHandle:d?a:i,target:d?r:t,targetHandle:d?i:a};_.connection=c,_.isValid=o&&s&&(n===B.Strict?d&&e===`source`||!d&&e===`target`:t!==r||a!==i)&&l(c),_.toHandle=Kt(t,e,a,u,n,!0)}return _}var Qt={onPointerDown:Xt,isValid:Zt};function $t({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){let i=x(e);function a({translateExtent:e,width:a,height:o,zoomStep:s=1,pannable:c=!0,zoomable:l=!0,inversePan:u=!1}){let d=e=>{if(e.sourceEvent.type!==`wheel`||!t)return;let r=n(),i=e.sourceEvent.ctrlKey&&Pe()?10:1,a=-e.sourceEvent.deltaY*(e.sourceEvent.deltaMode===1?.05:e.sourceEvent.deltaMode?1:.002)*s,o=r[2]*2**(a*i);t.scaleTo(o)},f=[0,0],p=y().on(`start`,e=>{(e.sourceEvent.type===`mousedown`||e.sourceEvent.type===`touchstart`)&&(f=[e.sourceEvent.clientX??e.sourceEvent.touches[0].clientX,e.sourceEvent.clientY??e.sourceEvent.touches[0].clientY])}).on(`zoom`,c?i=>{let s=n();if(i.sourceEvent.type!==`mousemove`&&i.sourceEvent.type!==`touchmove`||!t)return;let c=[i.sourceEvent.clientX??i.sourceEvent.touches[0].clientX,i.sourceEvent.clientY??i.sourceEvent.touches[0].clientY],l=[c[0]-f[0],c[1]-f[1]];f=c;let d=r()*Math.max(s[2],Math.log(s[2]))*(u?-1:1),p={x:s[0]-l[0]*d,y:s[1]-l[1]*d},m=[[0,0],[a,o]];t.setViewportConstrained({x:p.x,y:p.y,zoom:s[2]},m,e)}:null).on(`zoom.wheel`,l?d:null);i.call(p,{})}function o(){i.on(`zoom`,null)}return{update:a,destroy:o,pointer:d}}var en=e=>({x:e.x,y:e.y,zoom:e.k}),tn=({x:e,y:t,zoom:n})=>_.translate(e,t).scale(n),nn=(e,t)=>e.target.closest(`.${t}`),rn=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),an=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,on=(e,t=0,n=an,r=()=>{})=>{let i=typeof t==`number`&&t>0;return i||r(),i?e.transition().duration(t).ease(n).on(`end`,r):e},sn=e=>{let t=e.ctrlKey&&Pe()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function cn({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:i,panOnScrollSpeed:a,zoomOnPinch:o,onPanZoomStart:s,onPanZoom:c,onPanZoomEnd:l}){return u=>{if(nn(u,t))return u.ctrlKey&&u.preventDefault(),!1;u.preventDefault(),u.stopImmediatePropagation();let f=n.property(`__zoom`).k||1;if(u.ctrlKey&&o){let e=d(u),t=f*2**sn(u);r.scaleTo(n,t,e,u);return}let p=u.deltaMode===1?20:1,m=i===V.Vertical?0:u.deltaX*p,h=i===V.Horizontal?0:u.deltaY*p;!Pe()&&u.shiftKey&&i!==V.Vertical&&(m=u.deltaY*p,h=0),r.translateBy(n,-(m/f)*a,-(h/f)*a,{internal:!0});let g=en(n.property(`__zoom`));clearTimeout(e.panScrollTimeout),e.isPanScrolling?c?.(u,g):(e.isPanScrolling=!0,s?.(u,g)),e.panScrollTimeout=setTimeout(()=>{l?.(u,g),e.isPanScrolling=!1},150)}}function ln({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,i){let a=r.type===`wheel`,o=!t&&a&&!r.ctrlKey,s=nn(r,e);if(r.ctrlKey&&a&&s&&r.preventDefault(),o||s)return null;r.preventDefault(),n.call(this,r,i)}}function un({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{if(r.sourceEvent?.internal)return;let i=en(r.transform);e.mouseButton=r.sourceEvent?.button||0,e.isZoomingOrPanning=!0,e.prevViewport=i,r.sourceEvent?.type===`mousedown`&&t(!0),n&&n?.(r.sourceEvent,i)}}function dn({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:i}){return a=>{e.usedRightMouseButton=!!(n&&rn(t,e.mouseButton??0)),a.sourceEvent?.sync||r([a.transform.x,a.transform.y,a.transform.k]),i&&!a.sourceEvent?.internal&&i?.(a.sourceEvent,en(a.transform))}}function fn({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:r,onPanZoomEnd:i,onPaneContextMenu:a}){return o=>{if(!o.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,a&&rn(t,e.mouseButton??0)&&!e.usedRightMouseButton&&o.sourceEvent&&a(o.sourceEvent),e.usedRightMouseButton=!1,r(!1),i)){let t=en(o.transform);e.prevViewport=t,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{i?.(o.sourceEvent,t)},n?150:0)}}}function pn({panActivationKeyPressed:e,zoomActivationKeyPressed:t,zoomOnScroll:n,zoomOnPinch:r,panOnDrag:i,panOnScroll:a,zoomOnDoubleClick:o,userSelectionActive:s,noWheelClassName:c,noPanClassName:l,lib:u,connectionInProgress:d}){return f=>{let p=t||n,m=r&&f.ctrlKey,h=f.type===`wheel`;if(f.button===1&&f.type===`mousedown`&&(nn(f,`${u}-flow__node`)||nn(f,`${u}-flow__edge`)||nn(f,`${u}-flow__selection`)||nn(f,`${u}-flow__nodesselection`)))return!0;if(!i&&!p&&!a&&!o&&!r||s||d&&!h||nn(f,c)&&h||nn(f,l)&&(!h||a&&h&&!t)||!r&&f.ctrlKey&&h)return!1;if(!r&&f.type===`touchstart`&&f.touches?.length>1)return f.preventDefault(),!1;if(!p&&!a&&!m&&h||!i&&(f.type===`mousedown`||f.type===`touchstart`)||Array.isArray(i)&&!i.includes(f.button)&&f.type===`mousedown`)return!1;let g=Array.isArray(i)&&i.includes(f.button)||!f.button||f.button<=1;return(!f.ctrlKey||h||e)&&g}}function mn({domNode:e,minZoom:t,maxZoom:n,translateExtent:r,viewport:i,onPanZoom:a,onPanZoomStart:o,onPanZoomEnd:s,onDraggingChange:c}){let l={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},u=e.getBoundingClientRect(),d=[[0,0],[u.width,u.height]];(typeof ResizeObserver<`u`?new ResizeObserver(e=>{let t=e[0];t&&(d=[[0,0],[t.contentRect.width,t.contentRect.height]])}):null)?.observe(e);let f=y().extent(()=>d).scaleExtent([t,n]).translateExtent(r),p=x(e).call(f);C({x:i.x,y:i.y,zoom:q(i.zoom,t,n)},[[0,0],[u.width,u.height]],r);let m=p.on(`wheel.zoom`),h=p.on(`dblclick.zoom`);f.wheelDelta(sn);async function _(e,t){return p?new Promise(n=>{f?.interpolate(t?.interpolate===`linear`?w:g).transform(on(p,t?.duration,t?.ease,()=>n(!0)),e)}):!1}function b({noWheelClassName:e,noPanClassName:t,onPaneContextMenu:n,userSelectionActive:r,panOnScroll:i,panOnDrag:u,panOnScrollMode:d,panOnScrollSpeed:g,preventScrolling:_,zoomOnPinch:v,zoomOnScroll:y,zoomOnDoubleClick:b,panActivationKeyPressed:x=!1,zoomActivationKeyPressed:C,lib:w,onTransformChange:T,connectionInProgress:E,paneClickDistance:D,selectionOnDrag:O}){r&&!l.isZoomingOrPanning&&S();let k=i&&!C&&!r;f.clickDistance(O?1/0:!J(D)||D<0?0:D);let A=k?cn({zoomPanValues:l,noWheelClassName:e,d3Selection:p,d3Zoom:f,panOnScrollMode:d,panOnScrollSpeed:g,zoomOnPinch:v,onPanZoomStart:o,onPanZoom:a,onPanZoomEnd:s}):ln({noWheelClassName:e,preventScrolling:_,d3ZoomHandler:m});p.on(`wheel.zoom`,A,{passive:!1});let j=un({zoomPanValues:l,onDraggingChange:c,onPanZoomStart:o});f.on(`start`,j);let M=dn({zoomPanValues:l,panOnDrag:u,onPaneContextMenu:!!n,onPanZoom:a,onTransformChange:T});f.on(`zoom`,M);let N=fn({zoomPanValues:l,panOnDrag:u,panOnScroll:i,onPaneContextMenu:n,onPanZoomEnd:s,onDraggingChange:c});f.on(`end`,N);let P=pn({panActivationKeyPressed:x,zoomActivationKeyPressed:C,panOnDrag:u,zoomOnScroll:y,panOnScroll:i,zoomOnDoubleClick:b,zoomOnPinch:v,userSelectionActive:r,noPanClassName:t,noWheelClassName:e,lib:w,connectionInProgress:E});f.filter(P),b?p.on(`dblclick.zoom`,h):p.on(`dblclick.zoom`,null)}function S(){f.on(`zoom`,null)}async function C(e,t,n){let r=tn(e),i=f?.constrain()(r,t,n);return i&&await _(i),i}async function T(e,t){let n=tn(e);return await _(n,t),n}function E(e){if(p){let t=tn(e),n=p.property(`__zoom`);(n.k!==e.zoom||n.x!==e.x||n.y!==e.y)&&f?.transform(p,t,null,{sync:!0})}}function D(){let e=p?v(p.node()):{x:0,y:0,k:1};return{x:e.x,y:e.y,zoom:e.k}}async function O(e,t){return p?new Promise(n=>{f?.interpolate(t?.interpolate===`linear`?w:g).scaleTo(on(p,t?.duration,t?.ease,()=>n(!0)),e)}):!1}async function k(e,t){return p?new Promise(n=>{f?.interpolate(t?.interpolate===`linear`?w:g).scaleBy(on(p,t?.duration,t?.ease,()=>n(!0)),e)}):!1}function A(e){f?.scaleExtent(e)}function j(e){f?.translateExtent(e)}function M(e){let t=!J(e)||e<0?0:e;f?.clickDistance(t)}return{update:b,destroy:S,setViewport:T,setViewportConstrained:C,getViewport:D,scaleTo:O,scaleBy:k,setScaleExtent:A,setTranslateExtent:j,syncViewport:E,setClickDistance:M}}var hn;(function(e){e.Line=`line`,e.Handle=`handle`})(hn||={});function gn({width:e,prevWidth:t,height:n,prevHeight:r,affectsX:i,affectsY:a}){let o=e-t,s=n-r,c=[o>0?1:o<0?-1:0,s>0?1:s<0?-1:0];return o&&i&&(c[0]*=-1),s&&a&&(c[1]*=-1),c}function _n(e){return{isHorizontal:e.includes(`right`)||e.includes(`left`),isVertical:e.includes(`bottom`)||e.includes(`top`),affectsX:e.includes(`left`),affectsY:e.includes(`top`)}}function vn(e,t){return Math.max(0,t-e)}function yn(e,t){return Math.max(0,e-t)}function bn(e,t,n){return Math.max(0,t-e,e-n)}function xn(e,t){return e?!t:t}function Sn(e,t,n,r,i,a,o,s){let{affectsX:c,affectsY:l}=t,{isHorizontal:u,isVertical:d}=t,f=u&&d,{xSnapped:p,ySnapped:m}=n,{minWidth:h,maxWidth:g,minHeight:_,maxHeight:v}=r,{x:y,y:b,width:x,height:S,aspectRatio:C}=e,w=Math.floor(u?p-e.pointerX:0),T=Math.floor(d?m-e.pointerY:0),E=x+(c?-w:w),D=S+(l?-T:T),O=-a[0]*x,k=-a[1]*S,A=bn(E,h,g),j=bn(D,_,v);if(o){let e=0,t=0;c&&w<0?e=vn(y+w+O,o[0][0]):!c&&w>0&&(e=yn(y+E+O,o[1][0])),l&&T<0?t=vn(b+T+k,o[0][1]):!l&&T>0&&(t=yn(b+D+k,o[1][1])),A=Math.max(A,e),j=Math.max(j,t)}if(s){let e=0,t=0;c&&w>0?e=yn(y+w,s[0][0]):!c&&w<0&&(e=vn(y+E,s[1][0])),l&&T>0?t=yn(b+T,s[0][1]):!l&&T<0&&(t=vn(b+D,s[1][1])),A=Math.max(A,e),j=Math.max(j,t)}if(i){if(u){let e=bn(E/C,_,v)*C;if(A=Math.max(A,e),o){let e=0;e=!c&&!l||c&&!l&&f?yn(b+k+E/C,o[1][1])*C:vn(b+k+(c?w:-w)/C,o[0][1])*C,A=Math.max(A,e)}if(s){let e=0;e=!c&&!l||c&&!l&&f?vn(b+E/C,s[1][1])*C:yn(b+(c?w:-w)/C,s[0][1])*C,A=Math.max(A,e)}}if(d){let e=bn(D*C,h,g)/C;if(j=Math.max(j,e),o){let e=0;e=!c&&!l||l&&!c&&f?yn(y+D*C+O,o[1][0])/C:vn(y+(l?T:-T)*C+O,o[0][0])/C,j=Math.max(j,e)}if(s){let e=0;e=!c&&!l||l&&!c&&f?vn(y+D*C,s[1][0])/C:yn(y+(l?T:-T)*C,s[0][0])/C,j=Math.max(j,e)}}}T+=T<0?j:-j,w+=w<0?A:-A,i&&(f?E>D*C?T=(xn(c,l)?-w:w)/C:w=(xn(c,l)?-T:T)*C:u?(T=w/C,l=c):(w=T*C,c=l));let M=c?y+w:y,N=l?b+T:b;return{width:x+(c?-w:w),height:S+(l?-T:T),x:a[0]*w*(c?-1:1)+M,y:a[1]*T*(l?-1:1)+N}}var Cn={width:0,height:0,x:0,y:0},wn={...Cn,pointerX:0,pointerY:0,aspectRatio:1};function Tn(e,t,n){let r=t.position.x+e.position.x,i=t.position.y+e.position.y,a=e.measured.width??0,o=e.measured.height??0,s=n[0]*a,c=n[1]*o;return[[r-s,i-c],[r+a-s,i+o-c]]}function En({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:i}){let a=x(e),o={controlDirection:_n(`bottom-right`),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function s({controlPosition:e,boundaries:s,keepAspectRatio:c,resizeDirection:l,onResizeStart:u,onResize:d,onResizeEnd:f,shouldResize:p}){let m={...Cn},h={...wn};o={boundaries:s,resizeDirection:l,keepAspectRatio:c,controlDirection:_n(e)};let g,_=null,v=[],y,b,x,S=M().on(`start`,e=>{let{nodeLookup:r,transform:i,snapGrid:a,snapToGrid:o,nodeOrigin:s,paneDomNode:c}=n();if(g=r.get(t),!g)return;_=c?.getBoundingClientRect()??null;let{xSnapped:l,ySnapped:d}=He(e.sourceEvent,{transform:i,snapGrid:a,snapToGrid:o,containerBounds:_});m={width:g.measured.width??0,height:g.measured.height??0,x:g.position.x??0,y:g.position.y??0},h={...m,pointerX:l,pointerY:d,aspectRatio:m.width/m.height},y=void 0,b=Fe(g.extent)?g.extent:void 0,g.parentId&&(g.extent===`parent`||g.expandParent)&&(y=r.get(g.parentId)),y&&g.extent===`parent`&&(b=[[0,0],[y.measured.width,y.measured.height]]),v=[],x=void 0;for(let[e,n]of r)if(n.parentId===t&&(v.push({id:e,position:{...n.position},extent:n.extent}),n.extent===`parent`||n.expandParent)){let e=Tn(n,g,n.origin??s);x=x?[[Math.min(e[0][0],x[0][0]),Math.min(e[0][1],x[0][1])],[Math.max(e[1][0],x[1][0]),Math.max(e[1][1],x[1][1])]]:e}u?.(e,{...m})}).on(`drag`,e=>{let{transform:t,snapGrid:i,snapToGrid:a,nodeOrigin:s}=n(),c=He(e.sourceEvent,{transform:t,snapGrid:i,snapToGrid:a,containerBounds:_}),l=[];if(!g)return;let{x:u,y:f,width:S,height:C}=m,w={},T=g.origin??s,{width:E,height:D,x:O,y:k}=Sn(h,o.controlDirection,c,o.boundaries,o.keepAspectRatio,T,b,x),A=E!==S,j=D!==C,M=O!==u&&A,N=k!==f&&j;if(!M&&!N&&!A&&!j)return;let P={prevValues:{...m},startX:h.x,startY:h.y,childNodes:v.map(e=>({...e,position:{...e.position}}))};if((M||N||T[0]===1||T[1]===1)&&(w.x=M?O:m.x,w.y=N?k:m.y,m.x=w.x,m.y=w.y,v.length>0)){let e=O-u,t=k-f;for(let n of v)n.position={x:n.position.x-e+T[0]*(E-S),y:n.position.y-t+T[1]*(D-C)},l.push(n)}if((A||j)&&(w.width=A&&(!o.resizeDirection||o.resizeDirection===`horizontal`)?E:m.width,w.height=j&&(!o.resizeDirection||o.resizeDirection===`vertical`)?D:m.height,m.width=w.width,m.height=w.height),y&&g.expandParent){let e=T[0]*(w.width??0);w.x&&w.x<e&&(m.x=e,h.x-=w.x-e);let t=T[1]*(w.height??0);w.y&&w.y<t&&(m.y=t,h.y-=w.y-t)}let F=gn({width:m.width,prevWidth:S,height:m.height,prevHeight:C,affectsX:o.controlDirection.affectsX,affectsY:o.controlDirection.affectsY}),I={...m,direction:F};if(p?.(e,I)===!1){m=P.prevValues,h.x=P.startX,h.y=P.startY,v.forEach((e,t)=>{e.position=P.childNodes[t].position});return}d?.(e,I),r(w,l)}).on(`end`,e=>{f?.(e,{...m}),i?.({...m})});a.call(S)}function c(){a.on(`.drag`,null)}return{update:s,destroy:c}}var Dn=t((e=>{var t=n(),r=T();function i(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var a=typeof Object.is==`function`?Object.is:i,o=r.useSyncExternalStore,s=t.useRef,c=t.useEffect,l=t.useMemo,u=t.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,i){var d=s(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=l(function(){function e(e){if(!o){if(o=!0,s=e,e=r(e),i!==void 0&&f.hasValue){var t=f.value;if(i(t,e))return c=t}return c=e}if(t=c,a(s,e))return t;var n=r(e);return i!==void 0&&i(t,n)?(s=e,t):(s=e,c=n)}var o=!1,s,c,l=n===void 0?null:n;return[function(){return e(t())},l===null?void 0:function(){return e(l())}]},[t,n,r,i]);var p=o(e,d[0],d[1]);return c(function(){f.hasValue=!0,f.value=p},[p]),u(p),p}})),On=e(t(((e,t)=>{t.exports=Dn()}))(),1),kn=e=>{let t,n=new Set,r=(e,r)=>{let i=typeof e==`function`?e(t):e;if(!Object.is(i,t)){let e=t;t=r??(typeof i!=`object`||!i)?i:Object.assign({},t,i),n.forEach(n=>n(t,e))}},i=()=>t,a={setState:r,getState:i,getInitialState:()=>o,subscribe:e=>(n.add(e),()=>n.delete(e)),destroy:()=>{n.clear()}},o=t=e(r,i,a);return a},An=e=>e?kn(e):kn,{useDebugValue:jn}=N.default,{useSyncExternalStoreWithSelector:Mn}=On.default,Nn=e=>e;function Pn(e,t=Nn,n){let r=Mn(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return jn(r),r}var Fn=(e,t)=>{let n=An(e),r=(e,r=t)=>Pn(n,e,r);return Object.assign(r,n),r},In=(e,t)=>e?Fn(e,t):Fn;function Z(e,t){if(Object.is(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(let[n,r]of e)if(!Object.is(r,t.get(n)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}let n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(let r of n)if(!Object.prototype.hasOwnProperty.call(t,r)||!Object.is(e[r],t[r]))return!1;return!0}var Ln=e(r()),Rn=(0,N.createContext)(null),zn=Rn.Provider,Bn=I.error001(`react`);function Q(e,t){let n=(0,N.useContext)(Rn);if(n===null)throw Error(Bn);return Pn(n,e,t)}function $(){let e=(0,N.useContext)(Rn);if(e===null)throw Error(Bn);return(0,N.useMemo)(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}var Vn={display:`none`},Hn={position:`absolute`,width:1,height:1,margin:-1,border:0,padding:0,overflow:`hidden`,clip:`rect(0px, 0px, 0px, 0px)`,clipPath:`inset(100%)`},Un=`react-flow__node-desc`,Wn=`react-flow__edge-desc`,Gn=`react-flow__aria-live`,Kn=e=>e.ariaLiveMessage,qn=e=>e.ariaLabelConfig;function Jn({rfId:e}){let t=Q(Kn);return(0,P.jsx)(`div`,{id:`${Gn}-${e}`,"aria-live":`assertive`,"aria-atomic":`true`,style:Hn,children:t})}function Yn({rfId:e,disableKeyboardA11y:t}){let n=Q(qn);return(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(`div`,{id:`${Un}-${e}`,style:Vn,children:t?n[`node.a11yDescription.default`]:n[`node.a11yDescription.keyboardDisabled`]}),(0,P.jsx)(`div`,{id:`${Wn}-${e}`,style:Vn,children:n[`edge.a11yDescription.default`]}),!t&&(0,P.jsx)(Jn,{rfId:e})]})}var Xn=(0,N.forwardRef)(({position:e=`top-left`,children:t,className:n,style:r,...i},a)=>{let o=`${e}`.split(`-`);return(0,P.jsx)(`div`,{className:F([`react-flow__panel`,n,...o]),style:r,ref:a,...i,children:t})});Xn.displayName=`Panel`;var Zn=`https://reactflow.dev?utm_source=attribution`;function Qn({proOptions:e,position:t=`bottom-right`}){return(0,N.useEffect)(()=>{},[]),e?.hideAttribution?null:(0,P.jsx)(Xn,{position:t,className:`react-flow__attribution`,"data-message":`Please only hide this attribution when you are subscribed to React Flow Pro: ${Zn}`,children:(0,P.jsx)(`a`,{href:Zn,target:`_blank`,rel:`noopener noreferrer`,"aria-label":`React Flow attribution`,children:`React Flow`})})}var $n=e=>{let t=[],n=[];for(let[,n]of e.nodeLookup)n.selected&&t.push(n.internals.userNode);for(let[,t]of e.edgeLookup)t.selected&&n.push(t);return{selectedNodes:t,selectedEdges:n}},er=e=>e.id;function tr(e,t){return Z(e.selectedNodes.map(er),t.selectedNodes.map(er))&&Z(e.selectedEdges.map(er),t.selectedEdges.map(er))}function nr({onSelectionChange:e}){let t=$(),{selectedNodes:n,selectedEdges:r}=Q($n,tr);return(0,N.useEffect)(()=>{let i={nodes:n,edges:r};e?.(i),t.getState().onSelectionChangeHandlers.forEach(e=>e(i))},[n,r,e]),null}var rr=e=>!!e.onSelectionChangeHandlers;function ir({onSelectionChange:e}){let t=Q(rr);return e||t?(0,P.jsx)(nr,{onSelectionChange:e}):null}var ar=[0,0],or={x:0,y:0,zoom:1},sr=[...`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`.split(`.`),`rfId`],cr=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}),lr={translateExtent:L,nodeOrigin:ar,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:`nopan`,rfId:`1`};function ur(e){let{setNodes:t,setEdges:n,setMinZoom:r,setMaxZoom:i,setTranslateExtent:a,setNodeExtent:o,reset:s,setDefaultNodesAndEdges:c}=Q(cr,Z),l=$();(0,N.useEffect)(()=>(c(e.defaultNodes,e.defaultEdges),()=>{u.current=lr,s()}),[]);let u=(0,N.useRef)(lr);return(0,N.useEffect)(()=>{for(let s of sr){let c=e[s];c!==u.current[s]&&e[s]!==void 0&&(s===`nodes`?t(c):s===`edges`?n(c):s===`minZoom`?r(c):s===`maxZoom`?i(c):s===`translateExtent`?a(c):s===`nodeExtent`?o(c):s===`ariaLabelConfig`?l.setState({ariaLabelConfig:Be(c)}):s===`fitView`?l.setState({fitViewQueued:c}):s===`fitViewOptions`?l.setState({fitViewOptions:c}):l.setState({[s]:c}))}u.current=e},sr.map(t=>e[t])),null}function dr(){return typeof window>`u`||!window.matchMedia?null:window.matchMedia(`(prefers-color-scheme: dark)`)}function fr(e){let[t,n]=(0,N.useState)(e===`system`?null:e);return(0,N.useEffect)(()=>{if(e!==`system`){n(e);return}let t=dr(),r=()=>n(t?.matches?`dark`:`light`);return r(),t?.addEventListener(`change`,r),()=>{t?.removeEventListener(`change`,r)}},[e]),t===null?dr()?.matches?`dark`:`light`:t}var pr=typeof document<`u`?document:null;function mr(e=null,t={target:pr,actInsideInputWithModifier:!0}){let[n,r]=(0,N.useState)(!1),i=(0,N.useRef)(!1),a=(0,N.useRef)(new Set([])),[o,s]=(0,N.useMemo)(()=>{if(e!==null){let t=(Array.isArray(e)?e:[e]).filter(e=>typeof e==`string`).map(e=>e.replace(/\+/g,`
|
|
1
|
+
import{o as e,t}from"./rolldown-runtime-C0FnF6B9.js";import{t as n}from"./react-DiVRNtpo.js";import{t as r}from"./react-dom-CvX0TCLz.js";import{t as i}from"./jsx-runtime-BdxMnOeJ.js";import{c as a}from"./pendingActionsStore-COTh4Ztq.js";import{i as o,n as s,r as c,v as l}from"./flow-kinds-CW2TU_83.js";import{n as u}from"./useTheme-B57LIKyx.js";import"./genui-EzBIAYFE.js";import{C as d,S as f,T as p,_ as m,b as h,i as g,n as _,r as v,t as y,v as b,w as x,x as S,y as C}from"./src-B-DeWB10.js";import{t as w}from"./value-DcGlvoTp.js";import{t as T}from"./shim-DTZXyK8i.js";var E=e=>()=>e;function D(e,{sourceEvent:t,subject:n,target:r,identifier:i,active:a,x:o,y:s,dx:c,dy:l,dispatch:u}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:i,enumerable:!0,configurable:!0},active:{value:a,enumerable:!0,configurable:!0},x:{value:o,enumerable:!0,configurable:!0},y:{value:s,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:l,enumerable:!0,configurable:!0},_:{value:u}})}D.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function O(e){return!e.ctrlKey&&!e.button}function k(){return this.parentNode}function A(e,t){return t??{x:e.x,y:e.y}}function j(){return navigator.maxTouchPoints||`ontouchstart`in this}function M(){var e=O,t=k,n=A,r=j,i={},a=p(`start`,`drag`,`end`),o=0,s,c,l,u,g=0;function _(e){e.on(`mousedown.drag`,v).filter(r).on(`touchstart.drag`,T).on(`touchmove.drag`,M,h).on(`touchend.drag touchcancel.drag`,N).style(`touch-action`,`none`).style(`-webkit-tap-highlight-color`,`rgba(0,0,0,0)`)}function v(n,r){if(!u&&e.call(this,n,r)){var i=P(this,t.call(this,n,r),n,r,`mouse`);i&&(x(n.view).on(`mousemove.drag`,y,S).on(`mouseup.drag`,w,S),m(n.view),f(n),l=!1,s=n.clientX,c=n.clientY,i(`start`,n))}}function y(e){if(C(e),!l){var t=e.clientX-s,n=e.clientY-c;l=t*t+n*n>g}i.mouse(`drag`,e)}function w(e){x(e.view).on(`mousemove.drag mouseup.drag`,null),b(e.view,l),C(e),i.mouse(`end`,e)}function T(n,r){if(e.call(this,n,r))for(var i=n.changedTouches,a=t.call(this,n,r),o=i.length,s=0,c;s<o;++s)(c=P(this,a,n,r,i[s].identifier,i[s]))&&(f(n),c(`start`,n,i[s]))}function M(e){for(var t=e.changedTouches,n=t.length,r=0,a;r<n;++r)(a=i[t[r].identifier])&&(C(e),a(`drag`,e,t[r]))}function N(e){var t=e.changedTouches,n=t.length,r,a;for(u&&clearTimeout(u),u=setTimeout(function(){u=null},500),r=0;r<n;++r)(a=i[t[r].identifier])&&(f(e),a(`end`,e,t[r]))}function P(e,t,r,s,c,l){var u=a.copy(),f=d(l||r,t),p,m,h;if((h=n.call(e,new D(`beforestart`,{sourceEvent:r,target:_,identifier:c,active:o,x:f[0],y:f[1],dx:0,dy:0,dispatch:u}),s))!=null)return p=h.x-f[0]||0,m=h.y-f[1]||0,function n(r,a,l){var g=f,v;switch(r){case`start`:i[c]=n,v=o++;break;case`end`:delete i[c],--o;case`drag`:f=d(l||a,t),v=o}u.call(r,e,new D(r,{sourceEvent:a,subject:h,target:_,identifier:c,active:v,x:f[0]+p,y:f[1]+m,dx:f[0]-g[0],dy:f[1]-g[1],dispatch:u}),s)}}return _.filter=function(t){return arguments.length?(e=typeof t==`function`?t:E(!!t),_):e},_.container=function(e){return arguments.length?(t=typeof e==`function`?e:E(e),_):t},_.subject=function(e){return arguments.length?(n=typeof e==`function`?e:E(e),_):n},_.touchable=function(e){return arguments.length?(r=typeof e==`function`?e:E(!!e),_):r},_.on=function(){var e=a.on.apply(a,arguments);return e===a?_:e},_.clickDistance=function(e){return arguments.length?(g=(e=+e)*e,_):Math.sqrt(g)},_}var N=e(n(),1),P=e(i());function F(e){if(typeof e==`string`||typeof e==`number`)return``+e;let t=``;if(Array.isArray(e))for(let n=0,r;n<e.length;n++)(r=F(e[n]))!==``&&(t+=(t&&` `)+r);else for(let n in e)e[n]&&(t+=(t&&` `)+n);return t}var I={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:r})=>`Couldn't create edge for ${e} handle id: "${e===`source`?n:r}", 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.`},L=[[-1/0,-1/0],[1/0,1/0]],R=[`Enter`,` `,`Escape`],z={"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`},B;(function(e){e.Strict=`strict`,e.Loose=`loose`})(B||={});var V;(function(e){e.Free=`free`,e.Vertical=`vertical`,e.Horizontal=`horizontal`})(V||={});var H;(function(e){e.Partial=`partial`,e.Full=`full`})(H||={});var U={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null},W;(function(e){e.Bezier=`default`,e.Straight=`straight`,e.Step=`step`,e.SmoothStep=`smoothstep`,e.SimpleBezier=`simplebezier`})(W||={});var G;(function(e){e.Arrow=`arrow`,e.ArrowClosed=`arrowclosed`})(G||={});var K;(function(e){e.Left=`left`,e.Top=`top`,e.Right=`right`,e.Bottom=`bottom`})(K||={});var ee={[K.Left]:K.Right,[K.Right]:K.Left,[K.Top]:K.Bottom,[K.Bottom]:K.Top},te=e=>!!e&&typeof e==`object`&&`id`in e&&`source`in e&&`target`in e,ne=e=>!!e&&typeof e==`object`&&`id`in e&&`position`in e&&!(`source`in e)&&!(`target`in e),re=e=>!!e&&typeof e==`object`&&`id`in e&&`internals`in e&&!(`source`in e)&&!(`target`in e),ie=(e,t=[0,0])=>{let{width:n,height:r}=Y(e),i=e.origin??t,a=n*i[0],o=r*i[1];return{x:e.position.x-a,y:e.position.y-o}},ae=(e,t={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};let n=!1,r=e.reduce((e,r)=>{let i=typeof r==`string`,a=!t.nodeLookup&&!i?r:void 0;return t.nodeLookup&&(a=i?t.nodeLookup.get(r):re(r)?r:t.nodeLookup.get(r.id)),a?(n=!0,_e(e,xe(a,t.nodeOrigin))):e},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return n?ye(r):{x:0,y:0,width:0,height:0}},oe=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},r=!1;return e.forEach(e=>{(t.filter===void 0||t.filter(e))&&(n=_e(n,xe(e)),r=!0)}),r?ye(n):{x:0,y:0,width:0,height:0}},se=(e,t,[n,r,i]=[0,0,1],a=!1,o=!1)=>{let s=(t.x-n)/i,c=(t.y-r)/i,l=t.width/i,u=t.height/i,d=[];for(let t of e.values()){let{measured:e,selectable:n=!0,hidden:r=!1}=t;if(o&&!n||r)continue;let i=e.width??t.width??t.initialWidth??0,f=e.height??t.height??t.initialHeight??0,{x:p,y:m}=t.internals.positionAbsolute,h=Ce(s,c,l,u,p,m,i,f),g=i*f,_=a&&h>0;(!t.internals.handleBounds||_||h>=g||t.dragging)&&d.push(t)}return d},ce=(e,t)=>{let n=new Set;return e.forEach(e=>{n.add(e.id)}),t.filter(e=>n.has(e.source)||n.has(e.target))};function le(e,t){let n=new Map,r=t?.nodes?new Set(t.nodes.map(e=>e.id)):null;return e.forEach(e=>{let i;if(t?.includeHiddenNodes){let{width:t,height:n}=Y(e);i=t>0&&n>0}else i=!!(e.measured.width&&e.measured.height&&!e.hidden);i&&(!r||r.has(e.id))&&n.set(e.id,e)}),n}async function ue({nodes:e,width:t,height:n,panZoom:r,minZoom:i,maxZoom:a},o){if(e.size===0)return!0;let s=Ne(oe(le(e,o)),t,n,o?.minZoom??i,o?.maxZoom??a,o?.padding??.1);return await r.setViewport(s,{duration:o?.duration,ease:o?.ease,interpolate:o?.interpolate}),!0}function de({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:r=[0,0],nodeExtent:i,onError:a}){let o=n.get(e),s=o.parentId?n.get(o.parentId):void 0,{x:c,y:l}=s?s.internals.positionAbsolute:{x:0,y:0},u=o.origin??r,d=o.extent||i;if(o.extent===`parent`&&!o.expandParent){if(!s)a?.(`005`,I.error005());else{let{width:e,height:t}=Y(s);e&&t&&(d=[[c,l],[c+e,l+t]])}}else s&&Fe(o.extent)&&(d=[[o.extent[0][0]+c,o.extent[0][1]+l],[o.extent[1][0]+c,o.extent[1][1]+l]]);let f=Fe(d)?pe(t,d,o.measured):t;return(o.measured.width===void 0||o.measured.height===void 0)&&a?.(`015`,I.error015()),{position:{x:f.x-c+(o.measured.width??0)*u[0],y:f.y-l+(o.measured.height??0)*u[1]},positionAbsolute:f}}async function fe({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:r,onBeforeDelete:i}){let a=new Set(e.map(e=>e.id)),o=[];for(let e of n){if(e.deletable===!1)continue;let t=a.has(e.id),n=!t&&e.parentId&&o.find(t=>t.id===e.parentId);(t||n)&&o.push(e)}let s=new Set(t.map(e=>e.id)),c=r.filter(e=>e.deletable!==!1),l=ce(o,c);for(let e of c)s.has(e.id)&&!l.find(t=>t.id===e.id)&&l.push(e);if(!i)return{edges:l,nodes:o};let u=await i({nodes:o,edges:l});return typeof u==`boolean`?u?{edges:l,nodes:o}:{edges:[],nodes:[]}:u}var q=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),pe=(e={x:0,y:0},t,n)=>({x:q(e.x,t[0][0],t[1][0]-(n?.width??0)),y:q(e.y,t[0][1],t[1][1]-(n?.height??0))});function me(e,t,n){let{width:r,height:i}=Y(n),{x:a,y:o}=n.internals.positionAbsolute;return pe(e,[[a,o],[a+r,o+i]],t)}var he=(e,t,n)=>e<t?q(Math.abs(e-t),1,t)/t:e>n?-q(Math.abs(e-n),1,t)/t:0,ge=(e,t,n=15,r=40)=>[he(e.x,r,t.width-r)*n,he(e.y,r,t.height-r)*n],_e=(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)}),ve=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),ye=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),be=(e,t=[0,0])=>{let{x:n,y:r}=re(e)?e.internals.positionAbsolute:ie(e,t);return{x:n,y:r,width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}},xe=(e,t=[0,0])=>{let{x:n,y:r}=re(e)?e.internals.positionAbsolute:ie(e,t);return{x:n,y:r,x2:n+(e.measured?.width??e.width??e.initialWidth??0),y2:r+(e.measured?.height??e.height??e.initialHeight??0)}},Se=(e,t)=>ye(_e(ve(e),ve(t))),Ce=(e,t,n,r,i,a,o,s)=>{let c=Math.max(0,Math.min(e+n,i+o)-Math.max(e,i)),l=Math.max(0,Math.min(t+r,a+s)-Math.max(t,a));return Math.ceil(c*l)},we=(e,t)=>Ce(e.x,e.y,e.width,e.height,t.x,t.y,t.width,t.height),Te=e=>J(e.width)&&J(e.height)&&J(e.x)&&J(e.y),J=e=>!isNaN(e)&&isFinite(e),Ee=(e,t)=>(e,t)=>{},De=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),Oe=({x:e,y:t},[n,r,i],a=!1,o=[1,1])=>{let s={x:(e-n)/i,y:(t-r)/i};return a?De(s,o):s},ke=({x:e,y:t},[n,r,i])=>({x:e*i+n,y:t*i+r});function Ae(e,t){if(typeof e==`number`)return Math.floor((t-t/(1+e))*.5);if(typeof e==`string`&&e.endsWith(`px`)){let t=parseFloat(e);if(!Number.isNaN(t))return Math.floor(t)}if(typeof e==`string`&&e.endsWith(`%`)){let 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 je(e,t,n){if(typeof e==`string`||typeof e==`number`){let r=Ae(e,n),i=Ae(e,t);return{top:r,right:i,bottom:r,left:i,x:i*2,y:r*2}}if(typeof e==`object`){let r=Ae(e.top??e.y??0,n),i=Ae(e.bottom??e.y??0,n),a=Ae(e.left??e.x??0,t),o=Ae(e.right??e.x??0,t);return{top:r,right:o,bottom:i,left:a,x:a+o,y:r+i}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function Me(e,t,n,r,i,a){let{x:o,y:s}=ke(e,[t,n,r]),{x:c,y:l}=ke({x:e.x+e.width,y:e.y+e.height},[t,n,r]),u=i-c,d=a-l;return{left:Math.floor(o),top:Math.floor(s),right:Math.floor(u),bottom:Math.floor(d)}}var Ne=(e,t,n,r,i,a)=>{let o=je(a,t,n),s=(t-o.x)/e.width,c=(n-o.y)/e.height,l=q(Math.min(s,c),r,i),u=e.x+e.width/2,d=e.y+e.height/2,f=t/2-u*l,p=n/2-d*l,m=Me(e,f,p,l,t,n),h={left:Math.min(m.left-o.left,0),top:Math.min(m.top-o.top,0),right:Math.min(m.right-o.right,0),bottom:Math.min(m.bottom-o.bottom,0)};return{x:f-h.left+h.right,y:p-h.top+h.bottom,zoom:l}},Pe=()=>typeof navigator<`u`&&navigator?.userAgent?.indexOf(`Mac`)>=0;function Fe(e){return e!=null&&e!==`parent`}function Y(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function Ie(e){return(e.measured?.width??e.width??e.initialWidth)!==void 0&&(e.measured?.height??e.height??e.initialHeight)!==void 0}function Le(e,t={width:0,height:0},n,r,i){let a={...e},o=r.get(n);if(o){let e=o.origin||i;a.x+=o.internals.positionAbsolute.x-(t.width??0)*e[0],a.y+=o.internals.positionAbsolute.y-(t.height??0)*e[1]}return a}function Re(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function ze(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}function Be(e){return{...z,...e||{}}}function Ve(e){return e===null?null:e?`valid`:`invalid`}function He(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:i}){let{x:a,y:o}=X(e),s=Oe({x:a-(i?.left??0),y:o-(i?.top??0)},r),{x:c,y:l}=n?De(s,t):s;return{xSnapped:c,ySnapped:l,...s}}var Ue=e=>({width:e.offsetWidth,height:e.offsetHeight}),We=e=>e?.getRootNode?.()||window?.document,Ge=[`INPUT`,`SELECT`,`TEXTAREA`];function Ke(e){let t=e.composedPath?.()?.[0]||e.target;return t?.nodeType===1?Ge.includes(t.nodeName)||t.hasAttribute(`contenteditable`)||!!t.closest(`.nokey`):!1}var qe=e=>`clientX`in e,X=(e,t)=>{let n=qe(e),r=n?e.clientX:e.touches?.[0].clientX,i=n?e.clientY:e.touches?.[0].clientY;return{x:r-(t?.left??0),y:i-(t?.top??0)}},Je=(e,t,n,r,i)=>{let a=t.querySelectorAll(`.${e}`);return!a||!a.length?null:Array.from(a).map(t=>{let a=t.getBoundingClientRect();return{id:t.getAttribute(`data-handleid`),type:e,nodeId:i,position:t.getAttribute(`data-handlepos`),x:(a.left-n.left)/r,y:(a.top-n.top)/r,...Ue(t)}})};function Ye({sourceX:e,sourceY:t,targetX:n,targetY:r,sourceControlX:i,sourceControlY:a,targetControlX:o,targetControlY:s}){let c=e*.125+i*.375+o*.375+n*.125,l=t*.125+a*.375+s*.375+r*.125;return[c,l,Math.abs(c-e),Math.abs(l-t)]}function Xe(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function Ze({pos:e,x1:t,y1:n,x2:r,y2:i,c:a}){switch(e){case K.Left:return[t-Xe(t-r,a),n];case K.Right:return[t+Xe(r-t,a),n];case K.Top:return[t,n-Xe(n-i,a)];case K.Bottom:return[t,n+Xe(i-n,a)]}}function Qe({sourceX:e,sourceY:t,sourcePosition:n=K.Bottom,targetX:r,targetY:i,targetPosition:a=K.Top,curvature:o=.25}){let[s,c]=Ze({pos:n,x1:e,y1:t,x2:r,y2:i,c:o}),[l,u]=Ze({pos:a,x1:r,y1:i,x2:e,y2:t,c:o}),[d,f,p,m]=Ye({sourceX:e,sourceY:t,targetX:r,targetY:i,sourceControlX:s,sourceControlY:c,targetControlX:l,targetControlY:u});return[`M${e},${t} C${s},${c} ${l},${u} ${r},${i}`,d,f,p,m]}function $e({sourceX:e,sourceY:t,targetX:n,targetY:r}){let i=Math.abs(n-e)/2,a=n<e?n+i:n-i,o=Math.abs(r-t)/2;return[a,r<t?r+o:r-o,i,o]}function et({sourceNode:e,targetNode:t,selected:n=!1,zIndex:r=0,elevateOnSelect:i=!1,zIndexMode:a=`basic`}){return a===`manual`?r:(i&&n?r+1e3:r)+Math.max(e.parentId||i&&e.selected?e.internals.z:0,t.parentId||i&&t.selected?t.internals.z:0)}function tt({sourceNode:e,targetNode:t,width:n,height:r,transform:i}){let a=_e(xe(e),xe(t));return a.x===a.x2&&(a.x2+=1),a.y===a.y2&&(a.y2+=1),we({x:-i[0]/i[2],y:-i[1]/i[2],width:n/i[2],height:r/i[2]},ye(a))>0}var nt=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||``}-${n}${r||``}`,rt=(e,t)=>t.some(t=>t.source===e.source&&t.target===e.target&&(t.sourceHandle===e.sourceHandle||!t.sourceHandle&&!e.sourceHandle)&&(t.targetHandle===e.targetHandle||!t.targetHandle&&!e.targetHandle)),it=(e,t,n={})=>{if(!e.source||!e.target)return n.onError?.(`006`,I.error006()),t;let r=n.getEdgeId||nt,i;return i=te(e)?{...e}:{...e,id:r(e)},rt(i,t)?t:(i.sourceHandle===null&&delete i.sourceHandle,i.targetHandle===null&&delete i.targetHandle,t.concat(i))};function at({sourceX:e,sourceY:t,targetX:n,targetY:r}){let[i,a,o,s]=$e({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,i,a,o,s]}var ot={[K.Left]:{x:-1,y:0},[K.Right]:{x:1,y:0},[K.Top]:{x:0,y:-1},[K.Bottom]:{x:0,y:1}},st=({source:e,sourcePosition:t=K.Bottom,target:n})=>t===K.Left||t===K.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},ct=(e,t)=>Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2);function lt({source:e,sourcePosition:t=K.Bottom,target:n,targetPosition:r=K.Top,center:i,offset:a,stepPosition:o}){let s=ot[t],c=ot[r],l={x:e.x+s.x*a,y:e.y+s.y*a},u={x:n.x+c.x*a,y:n.y+c.y*a},d=st({source:l,sourcePosition:t,target:u}),f=d.x===0?`y`:`x`,p=d[f],m=[],h,g,_={x:0,y:0},v={x:0,y:0},[,,y,b]=$e({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(s[f]*c[f]===-1){f===`x`?(h=i.x??l.x+(u.x-l.x)*o,g=i.y??(l.y+u.y)/2):(h=i.x??(l.x+u.x)/2,g=i.y??l.y+(u.y-l.y)*o);let e=[{x:h,y:l.y},{x:h,y:u.y}],t=[{x:l.x,y:g},{x:u.x,y:g}];m=s[f]===p?f===`x`?e:t:f===`x`?t:e}else{let i=[{x:l.x,y:u.y}],o=[{x:u.x,y:l.y}];if(m=f===`x`?s.x===p?o:i:s.y===p?i:o,t===r){let t=Math.abs(e[f]-n[f]);if(t<=a){let r=Math.min(a-1,a-t);s[f]===p?_[f]=(l[f]>e[f]?-1:1)*r:v[f]=(u[f]>n[f]?-1:1)*r}}if(t!==r){let e=f===`x`?`y`:`x`,t=s[f]===c[e],n=l[e]>u[e],r=l[e]<u[e];(s[f]===1&&(!t&&n||t&&r)||s[f]!==1&&(!t&&r||t&&n))&&(m=f===`x`?i:o)}let d={x:l.x+_.x,y:l.y+_.y},y={x:u.x+v.x,y:u.y+v.y};Math.max(Math.abs(d.x-m[0].x),Math.abs(y.x-m[0].x))>=Math.max(Math.abs(d.y-m[0].y),Math.abs(y.y-m[0].y))?(h=(d.x+y.x)/2,g=m[0].y):(h=m[0].x,g=(d.y+y.y)/2)}let x={x:l.x+_.x,y:l.y+_.y},S={x:u.x+v.x,y:u.y+v.y};return[[e,...x.x!==m[0].x||x.y!==m[0].y?[x]:[],...m,...S.x!==m[m.length-1].x||S.y!==m[m.length-1].y?[S]:[],n],h,g,y,b]}function ut(e,t,n,r){let i=Math.min(ct(e,t)/2,ct(t,n)/2,r),{x:a,y:o}=t;if(e.x===a&&a===n.x||e.y===o&&o===n.y)return`L${a} ${o}`;if(e.y===o){let t=e.x<n.x?-1:1,r=e.y<n.y?1:-1;return`L ${a+i*t},${o}Q ${a},${o} ${a},${o+i*r}`}let s=e.x<n.x?1:-1;return`L ${a},${o+i*(e.y<n.y?-1:1)}Q ${a},${o} ${a+i*s},${o}`}function dt({sourceX:e,sourceY:t,sourcePosition:n=K.Bottom,targetX:r,targetY:i,targetPosition:a=K.Top,borderRadius:o=5,centerX:s,centerY:c,offset:l=20,stepPosition:u=.5}){let[d,f,p,m,h]=lt({source:{x:e,y:t},sourcePosition:n,target:{x:r,y:i},targetPosition:a,center:{x:s,y:c},offset:l,stepPosition:u}),g=`M${d[0].x} ${d[0].y}`;for(let e=1;e<d.length-1;e++)g+=ut(d[e-1],d[e],d[e+1],o);return g+=`L${d[d.length-1].x} ${d[d.length-1].y}`,[g,f,p,m,h]}function ft(e){return e&&!!(e.internals.handleBounds||e.handles?.length)&&!!(e.measured.width||e.width||e.initialWidth)}function pt(e){let{sourceNode:t,targetNode:n}=e;if(!ft(t)||!ft(n))return null;let r=t.internals.handleBounds||mt(t.handles),i=n.internals.handleBounds||mt(n.handles),a=gt(r?.source??[],e.sourceHandle),o=gt(e.connectionMode===B.Strict?i?.target??[]:(i?.target??[]).concat(i?.source??[]),e.targetHandle);if(!a||!o)return e.onError?.(`008`,I.error008(a?`target`:`source`,{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;let s=a?.position||K.Bottom,c=o?.position||K.Top,l=ht(t,a,s),u=ht(n,o,c);return{sourceX:l.x,sourceY:l.y,targetX:u.x,targetY:u.y,sourcePosition:s,targetPosition:c}}function mt(e){if(!e)return null;let t=[],n=[];for(let r of e)r.width=r.width??1,r.height=r.height??1,r.type===`source`?t.push(r):r.type===`target`&&n.push(r);return{source:t,target:n}}function ht(e,t,n=K.Left,r=!1){let i=(t?.x??0)+e.internals.positionAbsolute.x,a=(t?.y??0)+e.internals.positionAbsolute.y,{width:o,height:s}=t??Y(e);if(r)return{x:i+o/2,y:a+s/2};switch(t?.position??n){case K.Top:return{x:i+o/2,y:a};case K.Right:return{x:i+o,y:a+s/2};case K.Bottom:return{x:i+o/2,y:a+s};case K.Left:return{x:i,y:a+s/2}}}function gt(e,t){return e&&(t?e.find(e=>e.id===t):e[0])||null}function _t(e,t){return e?typeof e==`string`?e:`${t?`${t}__`:``}${Object.keys(e).sort().map(t=>`${t}=${e[t]}`).join(`&`)}`:``}function vt(e,{id:t,defaultColor:n,defaultMarkerStart:r,defaultMarkerEnd:i}){let a=new Set;return e.reduce((e,o)=>([o.markerStart||r,o.markerEnd||i].forEach(r=>{if(r&&typeof r==`object`){let i=_t(r,t);a.has(i)||(e.push({id:i,color:r.color||n,...r}),a.add(i))}}),e),[]).sort((e,t)=>e.id.localeCompare(t.id))}var yt=1e3,bt=10,xt={nodeOrigin:[0,0],nodeExtent:L,elevateNodesOnSelect:!0,zIndexMode:`basic`,defaults:{}},St={...xt,checkEquality:!0};function Ct(e,t){let n={...e};for(let e in t)t[e]!==void 0&&(n[e]=t[e]);return n}function wt(e,t,n){let r=Ct(xt,n);for(let n of e.values())if(n.parentId)kt(n,e,t,r);else{let e=pe(ie(n,r.nodeOrigin),Fe(n.extent)?n.extent:r.nodeExtent,Y(n));n.internals.positionAbsolute=e}}function Tt(e,t){if(!e.handles)return e.measured?t?.internals.handleBounds:void 0;let n=[],r=[];for(let t of e.handles){let i={id:t.id,width:t.width??1,height:t.height??1,nodeId:e.id,x:t.x,y:t.y,position:t.position,type:t.type};t.type===`source`?n.push(i):t.type===`target`&&r.push(i)}return{source:n,target:r}}function Et(e){return e===`manual`}function Dt(e,t,n,r={}){let i=Ct(St,r),a={i:0},o=new Map(t),s=i?.elevateNodesOnSelect&&!Et(i.zIndexMode)?yt:0,c=e.length>0,l=!1;t.clear(),n.clear();for(let u of e){let e=o.get(u.id);if(i.checkEquality&&u===e?.internals.userNode)t.set(u.id,e);else{let n=pe(ie(u,i.nodeOrigin),Fe(u.extent)?u.extent:i.nodeExtent,Y(u));e={...i.defaults,...u,measured:{width:u.measured?.width,height:u.measured?.height},internals:{positionAbsolute:n,handleBounds:Tt(u,e),z:At(u,s,i.zIndexMode),userNode:u}},t.set(u.id,e)}(e.measured===void 0||e.measured.width===void 0||e.measured.height===void 0)&&!e.hidden&&(c=!1),u.parentId&&kt(e,t,n,r,a),l||=u.selected??!1}return{nodesInitialized:c,hasSelectedNodes:l}}function Ot(e,t){if(!e.parentId)return;let n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function kt(e,t,n,r,i){let{elevateNodesOnSelect:a,nodeOrigin:o,nodeExtent:s,zIndexMode:c}=Ct(xt,r),l=e.parentId,u=t.get(l);if(!u){console.warn(`Parent node ${l} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}Ot(e,n),i&&!u.parentId&&u.internals.rootParentIndex===void 0&&c===`auto`&&(u.internals.rootParentIndex=++i.i,u.internals.z=u.internals.z+i.i*bt),i&&u.internals.rootParentIndex!==void 0&&(i.i=u.internals.rootParentIndex);let{x:d,y:f,z:p}=jt(e,u,o,s,a&&!Et(c)?yt:0,c),{positionAbsolute:m}=e.internals,h=d!==m.x||f!==m.y;(h||p!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:h?{x:d,y:f}:m,z:p}})}function At(e,t,n){let r=J(e.zIndex)?e.zIndex:0;return Et(n)?r:r+(e.selected?t:0)}function jt(e,t,n,r,i,a){let{x:o,y:s}=t.internals.positionAbsolute,c=Y(e),l=ie(e,n),u=Fe(e.extent)?pe(l,e.extent,c):l,d=pe({x:o+u.x,y:s+u.y},r,c);e.extent===`parent`&&(d=me(d,c,t));let f=At(e,i,a),p=t.internals.z??0;return{x:d.x,y:d.y,z:p>=f?p+1:f}}function Mt(e,t,n,r=[0,0]){let i=[],a=new Map;for(let n of e){let e=t.get(n.parentId);if(!e)continue;let r=Se(a.get(n.parentId)?.expandedRect??be(e),n.rect);a.set(n.parentId,{expandedRect:r,parent:e})}return a.size>0&&a.forEach(({expandedRect:t,parent:a},o)=>{let s=a.internals.positionAbsolute,c=Y(a),l=a.origin??r,u=t.x<s.x?Math.round(Math.abs(s.x-t.x)):0,d=t.y<s.y?Math.round(Math.abs(s.y-t.y)):0,f=Math.max(c.width,Math.round(t.width)),p=Math.max(c.height,Math.round(t.height)),m=(f-c.width)*l[0],h=(p-c.height)*l[1];(u>0||d>0||m||h)&&(i.push({id:o,type:`position`,position:{x:a.position.x-u+m,y:a.position.y-d+h}}),n.get(o)?.forEach(t=>{e.some(e=>e.id===t.id)||i.push({id:t.id,type:`position`,position:{x:t.position.x+u,y:t.position.y+d}})})),(c.width<t.width||c.height<t.height||u||d)&&i.push({id:o,type:`dimensions`,setAttributes:!0,dimensions:{width:f+(u?l[0]*u-m:0),height:p+(d?l[1]*d-h:0)}})}),i}function Nt(e,t,n,r,i,a,o){let s=r?.querySelector(`.xyflow__viewport`),c=!1;if(!s)return{changes:[],updatedInternals:c};let l=[],u=window.getComputedStyle(s),{m22:d}=new window.DOMMatrixReadOnly(u.transform),f=[];for(let r of e.values()){let e=t.get(r.id);if(!e)continue;if(e.hidden){t.set(e.id,{...e,internals:{...e.internals,handleBounds:void 0}}),c=!0;continue}let s=Ue(r.nodeElement),u=e.measured.width!==s.width||e.measured.height!==s.height;if(s.width&&s.height&&(u||!e.internals.handleBounds||r.force)){let p=r.nodeElement.getBoundingClientRect(),m=Fe(e.extent)?e.extent:a,{positionAbsolute:h}=e.internals;if(e.parentId&&e.extent===`parent`){let n=t.get(e.parentId);n&&(h=me(h,s,n))}else m&&(h=pe(h,m,s));let g={...e,measured:s,internals:{...e.internals,positionAbsolute:h,handleBounds:{source:Je(`source`,r.nodeElement,p,d,e.id),target:Je(`target`,r.nodeElement,p,d,e.id)}}};t.set(e.id,g),e.parentId&&kt(g,t,n,{nodeOrigin:i,zIndexMode:o}),c=!0,u&&(l.push({id:e.id,type:`dimensions`,dimensions:s}),e.expandParent&&e.parentId&&f.push({id:e.id,parentId:e.parentId,rect:be(g,i)}))}}if(f.length>0){let e=Mt(f,t,n,i);l.push(...e)}return{changes:l,updatedInternals:c}}async function Pt({delta:e,panZoom:t,transform:n,translateExtent:r,width:i,height:a}){if(!t||!e.x&&!e.y)return!1;let o=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[i,a]],r);return!!o&&(o.x!==n[0]||o.y!==n[1]||o.k!==n[2])}function Ft(e,t,n,r,i,a){let o=i,s=r.get(o)||new Map;r.set(o,s.set(n,t)),o=`${i}-${e}`;let c=r.get(o)||new Map;if(r.set(o,c.set(n,t)),a){o=`${i}-${e}-${a}`;let s=r.get(o)||new Map;r.set(o,s.set(n,t))}}function It(e,t,n){e.clear(),t.clear();for(let r of n){let{source:n,target:i,sourceHandle:a=null,targetHandle:o=null}=r,s={edgeId:r.id,source:n,target:i,sourceHandle:a,targetHandle:o},c=`${n}-${a}--${i}-${o}`;Ft(`source`,s,`${i}-${o}--${n}-${a}`,e,n,a),Ft(`target`,s,c,e,i,o),t.set(r.id,r)}}function Lt(e,t){if(!e.parentId)return!1;let n=t.get(e.parentId);return n?n.selected?!0:Lt(n,t):!1}function Rt(e,t,n){let r=e;do{if(r?.matches?.(t))return!0;if(r===n)return!1;r=r?.parentElement}while(r);return!1}function zt(e,t,n,r){let i=new Map;for(let[a,o]of e)if((o.selected||o.id===r)&&(!o.parentId||!Lt(o,e))&&(o.draggable||t&&o.draggable===void 0)){let t=e.get(a);t&&i.set(a,{id:a,position:t.position||{x:0,y:0},distance:{x:n.x-t.internals.positionAbsolute.x,y:n.y-t.internals.positionAbsolute.y},extent:t.extent,parentId:t.parentId,origin:t.origin,expandParent:t.expandParent,internals:{positionAbsolute:t.internals.positionAbsolute||{x:0,y:0}},measured:{width:t.measured.width??0,height:t.measured.height??0}})}return i}function Bt({nodeId:e,dragItems:t,nodeLookup:n,dragging:r=!0}){let i=[];for(let[e,a]of t){let t=n.get(e)?.internals.userNode;t&&i.push({...t,position:a.position,dragging:r})}if(!e)return[i[0],i];let a=n.get(e)?.internals.userNode;return[a?{...a,position:t.get(e)?.position||a.position,dragging:r}:i[0],i]}function Vt({dragItems:e,snapGrid:t,x:n,y:r}){let i=e.values().next().value;if(!i)return null;let a={x:n-i.distance.x,y:r-i.distance.y},o=De(a,t);return{x:o.x-a.x,y:o.y-a.y}}function Ht({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:r,onDragStop:i}){let a={x:null,y:null},o=0,s=new Map,c=!1,l={x:0,y:0},u=null,d=!1,f=null,p=!1,m=!1,h=null;function g({noDragClassName:g,handleSelector:_,domNode:v,isSelectable:y,nodeId:b,nodeClickDistance:S=0}){f=x(v);function C({x:e,y:n}){let{nodeLookup:i,nodeExtent:o,snapGrid:c,snapToGrid:l,nodeOrigin:u,onNodeDrag:d,onSelectionDrag:f,onError:p,updateNodePositions:g}=t();a={x:e,y:n};let _=!1,v=s.size>1,y=v&&o?ve(oe(s)):null,x=v&&l?Vt({dragItems:s,snapGrid:c,x:e,y:n}):null;for(let[t,r]of s){if(!i.has(t))continue;let a={x:e-r.distance.x,y:n-r.distance.y};l&&(a=x?{x:Math.round(a.x+x.x),y:Math.round(a.y+x.y)}:De(a,c));let s=null;if(v&&o&&!r.extent&&y){let{positionAbsolute:e}=r.internals,t=e.x-y.x+o[0][0],n=e.x+r.measured.width-y.x2+o[1][0],i=e.y-y.y+o[0][1],a=e.y+r.measured.height-y.y2+o[1][1];s=[[t,i],[n,a]]}let{position:d,positionAbsolute:f}=de({nodeId:t,nextPosition:a,nodeLookup:i,nodeExtent:s||o,nodeOrigin:u,onError:p});_=_||r.position.x!==d.x||r.position.y!==d.y,r.position=d,r.internals.positionAbsolute=f}if(m||=_,_&&(g(s,!0),h&&(r||d||!b&&f))){let[e,t]=Bt({nodeId:b,dragItems:s,nodeLookup:i});r?.(h,s,e,t),d?.(h,e,t),b||f?.(h,t)}}async function w(){if(!u)return;let{transform:e,panBy:n,autoPanSpeed:r,autoPanOnNodeDrag:i}=t();if(!i){c=!1,cancelAnimationFrame(o);return}let[s,d]=ge(l,u,r);(s!==0||d!==0)&&(a.x=(a.x??0)-s/e[2],a.y=(a.y??0)-d/e[2],await n({x:s,y:d})&&C(a)),o=requestAnimationFrame(w)}function T(r){let{nodeLookup:i,multiSelectionActive:o,nodesDraggable:c,transform:l,snapGrid:f,snapToGrid:p,selectNodesOnDrag:m,onNodeDragStart:h,onSelectionDragStart:g,unselectNodesAndEdges:_}=t();d=!0,(!m||!y)&&!o&&b&&(i.get(b)?.selected||_()),y&&m&&b&&e?.(b);let v=He(r.sourceEvent,{transform:l,snapGrid:f,snapToGrid:p,containerBounds:u});if(a=v,s=zt(i,c,v,b),s.size>0&&(n||h||!b&&g)){let[e,t]=Bt({nodeId:b,dragItems:s,nodeLookup:i});n?.(r.sourceEvent,s,e,t),h?.(r.sourceEvent,e,t),b||g?.(r.sourceEvent,t)}}let E=M().clickDistance(S).on(`start`,e=>{let{domNode:n,nodeDragThreshold:r,transform:i,snapGrid:o,snapToGrid:s}=t();u=n?.getBoundingClientRect()||null,p=!1,m=!1,h=e.sourceEvent,r===0&&T(e),a=He(e.sourceEvent,{transform:i,snapGrid:o,snapToGrid:s,containerBounds:u}),l=X(e.sourceEvent,u)}).on(`drag`,e=>{let{autoPanOnNodeDrag:n,transform:r,snapGrid:i,snapToGrid:o,nodeDragThreshold:f,nodeLookup:m}=t(),g=He(e.sourceEvent,{transform:r,snapGrid:i,snapToGrid:o,containerBounds:u});if(h=e.sourceEvent,(e.sourceEvent.type===`touchmove`&&e.sourceEvent.touches.length>1||b&&!m.has(b))&&(p=!0),!p){if(!c&&n&&d&&(c=!0,w()),!d){let t=X(e.sourceEvent,u),n=t.x-l.x,r=t.y-l.y;Math.sqrt(n*n+r*r)>f&&T(e)}(a.x!==g.xSnapped||a.y!==g.ySnapped)&&s&&d&&(l=X(e.sourceEvent,u),C(g))}}).on(`end`,e=>{if(!d||p){p&&s.size>0&&t().updateNodePositions(s,!1);return}if(c=!1,d=!1,cancelAnimationFrame(o),s.size>0){let{nodeLookup:n,updateNodePositions:r,onNodeDragStop:a,onSelectionDragStop:o}=t();if(m&&=(r(s,!1),!1),i||a||!b&&o){let[t,r]=Bt({nodeId:b,dragItems:s,nodeLookup:n,dragging:!1});i?.(e.sourceEvent,s,t,r),a?.(e.sourceEvent,t,r),b||o?.(e.sourceEvent,r)}}}).filter(e=>{let t=e.target;return!e.button&&(!g||!Rt(t,`.${g}`,v))&&(!_||Rt(t,_,v))});f.call(E)}function _(){f?.on(`.drag`,null)}return{update:g,destroy:_}}function Ut(e,t,n){let r=[],i={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(let e of t.values())we(i,be(e))>0&&r.push(e);return r}var Wt=250;function Gt(e,t,n,r){let i=[],a=1/0,o=Ut(e,n,t+Wt);for(let n of o){let o=[...n.internals.handleBounds?.source??[],...n.internals.handleBounds?.target??[]];for(let s of o){if(r.nodeId===s.nodeId&&r.type===s.type&&r.id===s.id)continue;let{x:o,y:c}=ht(n,s,s.position,!0),l=Math.sqrt((o-e.x)**2+(c-e.y)**2);l>t||(l<a?(i=[{...s,x:o,y:c}],a=l):l===a&&i.push({...s,x:o,y:c}))}}if(!i.length)return null;if(i.length>1){let e=r.type===`source`?`target`:`source`;return i.find(t=>t.type===e)??i[0]}return i[0]}function Kt(e,t,n,r,i,a=!1){let o=r.get(e);if(!o)return null;let s=i===`strict`?o.internals.handleBounds?.[t]:[...o.internals.handleBounds?.source??[],...o.internals.handleBounds?.target??[]],c=(n?s?.find(e=>e.id===n):s?.[0])??null;return c&&a?{...c,...ht(o,c,c.position,!0)}:c}function qt(e,t){return e||(t?.classList.contains(`target`)?`target`:t?.classList.contains(`source`)?`source`:null)}function Jt(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}var Yt=()=>!0;function Xt(e,{connectionMode:t,connectionRadius:n,handleId:r,nodeId:i,edgeUpdaterType:a,isTarget:o,domNode:s,nodeLookup:c,lib:l,autoPanOnConnect:u,flowId:d,panBy:f,cancelConnection:p,onConnectStart:m,onConnect:h,onConnectEnd:g,isValidConnection:_=Yt,onReconnectEnd:v,updateConnection:y,getTransform:b,getFromHandle:x,autoPanSpeed:S,dragThreshold:C=1,handleDomNode:w}){let T=We(e.target),E=0,D,{x:O,y:k}=X(e),A=qt(a,w),j=s?.getBoundingClientRect(),M=!1;if(!j||!A)return;let N=Kt(i,A,r,c,t);if(!N)return;let P=X(e,j),F=!1,I=null,L=!1,R=null;function z(){if(!u||!j)return;let[e,t]=ge(P,j,S);f({x:e,y:t}),E=requestAnimationFrame(z)}let B={...N,nodeId:i,type:A,position:N.position},V=c.get(i),H={inProgress:!0,isValid:null,from:ht(V,B,K.Left,!0),fromHandle:B,fromPosition:B.position,fromNode:V,to:P,toHandle:null,toPosition:ee[B.position],toNode:null,pointer:P};function U(){M=!0,y(H),m?.(e,{nodeId:i,handleId:r,handleType:A})}C===0&&U();function W(e){if(!M){let{x:t,y:n}=X(e),r=t-O,i=n-k;if(!(r*r+i*i>C*C))return;U()}if(!x()||!B){G(e);return}let a=b();P=X(e,j),D=Gt(Oe(P,a,!1,[1,1]),n,c,B),F||=(z(),!0);let s=Zt(e,{handle:D,connectionMode:t,fromNodeId:i,fromHandleId:r,fromType:o?`target`:`source`,isValidConnection:_,doc:T,lib:l,flowId:d,nodeLookup:c});R=s.handleDomNode,I=s.connection,L=Jt(!!D,s.isValid);let u=c.get(i),f=u?ht(u,B,K.Left,!0):H.from,p={...H,from:f,isValid:L,to:s.toHandle&&L?ke({x:s.toHandle.x,y:s.toHandle.y},a):P,toHandle:s.toHandle,toPosition:L&&s.toHandle?s.toHandle.position:ee[B.position],toNode:s.toHandle?c.get(s.toHandle.nodeId):null,pointer:P};y(p),H=p}function G(e){if(!(`touches`in e&&e.touches.length>0)){if(M){(D||R)&&I&&L&&h?.(I);let{inProgress:t,...n}=H,r={...n,toPosition:H.toHandle?H.toPosition:null};g?.(e,r),a&&v?.(e,r)}p(),cancelAnimationFrame(E),F=!1,L=!1,I=null,R=null,T.removeEventListener(`mousemove`,W),T.removeEventListener(`mouseup`,G),T.removeEventListener(`touchmove`,W),T.removeEventListener(`touchend`,G)}}T.addEventListener(`mousemove`,W),T.addEventListener(`mouseup`,G),T.addEventListener(`touchmove`,W),T.addEventListener(`touchend`,G)}function Zt(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:i,fromType:a,doc:o,lib:s,flowId:c,isValidConnection:l=Yt,nodeLookup:u}){let d=a===`target`,f=t?o.querySelector(`.${s}-flow__handle[data-id="${c}-${t?.nodeId}-${t?.id}-${t?.type}"]`):null,{x:p,y:m}=X(e),h=o.elementFromPoint(p,m),g=h?.classList.contains(`${s}-flow__handle`)?h:f,_={handleDomNode:g,isValid:!1,connection:null,toHandle:null};if(g){let e=qt(void 0,g),t=g.getAttribute(`data-nodeid`),a=g.getAttribute(`data-handleid`),o=g.classList.contains(`connectable`),s=g.classList.contains(`connectableend`);if(!t||!e)return _;let c={source:d?t:r,sourceHandle:d?a:i,target:d?r:t,targetHandle:d?i:a};_.connection=c,_.isValid=o&&s&&(n===B.Strict?d&&e===`source`||!d&&e===`target`:t!==r||a!==i)&&l(c),_.toHandle=Kt(t,e,a,u,n,!0)}return _}var Qt={onPointerDown:Xt,isValid:Zt};function $t({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){let i=x(e);function a({translateExtent:e,width:a,height:o,zoomStep:s=1,pannable:c=!0,zoomable:l=!0,inversePan:u=!1}){let d=e=>{if(e.sourceEvent.type!==`wheel`||!t)return;let r=n(),i=e.sourceEvent.ctrlKey&&Pe()?10:1,a=-e.sourceEvent.deltaY*(e.sourceEvent.deltaMode===1?.05:e.sourceEvent.deltaMode?1:.002)*s,o=r[2]*2**(a*i);t.scaleTo(o)},f=[0,0],p=y().on(`start`,e=>{(e.sourceEvent.type===`mousedown`||e.sourceEvent.type===`touchstart`)&&(f=[e.sourceEvent.clientX??e.sourceEvent.touches[0].clientX,e.sourceEvent.clientY??e.sourceEvent.touches[0].clientY])}).on(`zoom`,c?i=>{let s=n();if(i.sourceEvent.type!==`mousemove`&&i.sourceEvent.type!==`touchmove`||!t)return;let c=[i.sourceEvent.clientX??i.sourceEvent.touches[0].clientX,i.sourceEvent.clientY??i.sourceEvent.touches[0].clientY],l=[c[0]-f[0],c[1]-f[1]];f=c;let d=r()*Math.max(s[2],Math.log(s[2]))*(u?-1:1),p={x:s[0]-l[0]*d,y:s[1]-l[1]*d},m=[[0,0],[a,o]];t.setViewportConstrained({x:p.x,y:p.y,zoom:s[2]},m,e)}:null).on(`zoom.wheel`,l?d:null);i.call(p,{})}function o(){i.on(`zoom`,null)}return{update:a,destroy:o,pointer:d}}var en=e=>({x:e.x,y:e.y,zoom:e.k}),tn=({x:e,y:t,zoom:n})=>_.translate(e,t).scale(n),nn=(e,t)=>e.target.closest(`.${t}`),rn=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),an=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,on=(e,t=0,n=an,r=()=>{})=>{let i=typeof t==`number`&&t>0;return i||r(),i?e.transition().duration(t).ease(n).on(`end`,r):e},sn=e=>{let t=e.ctrlKey&&Pe()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function cn({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:i,panOnScrollSpeed:a,zoomOnPinch:o,onPanZoomStart:s,onPanZoom:c,onPanZoomEnd:l}){return u=>{if(nn(u,t))return u.ctrlKey&&u.preventDefault(),!1;u.preventDefault(),u.stopImmediatePropagation();let f=n.property(`__zoom`).k||1;if(u.ctrlKey&&o){let e=d(u),t=f*2**sn(u);r.scaleTo(n,t,e,u);return}let p=u.deltaMode===1?20:1,m=i===V.Vertical?0:u.deltaX*p,h=i===V.Horizontal?0:u.deltaY*p;!Pe()&&u.shiftKey&&i!==V.Vertical&&(m=u.deltaY*p,h=0),r.translateBy(n,-(m/f)*a,-(h/f)*a,{internal:!0});let g=en(n.property(`__zoom`));clearTimeout(e.panScrollTimeout),e.isPanScrolling?c?.(u,g):(e.isPanScrolling=!0,s?.(u,g)),e.panScrollTimeout=setTimeout(()=>{l?.(u,g),e.isPanScrolling=!1},150)}}function ln({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,i){let a=r.type===`wheel`,o=!t&&a&&!r.ctrlKey,s=nn(r,e);if(r.ctrlKey&&a&&s&&r.preventDefault(),o||s)return null;r.preventDefault(),n.call(this,r,i)}}function un({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{if(r.sourceEvent?.internal)return;let i=en(r.transform);e.mouseButton=r.sourceEvent?.button||0,e.isZoomingOrPanning=!0,e.prevViewport=i,r.sourceEvent?.type===`mousedown`&&t(!0),n&&n?.(r.sourceEvent,i)}}function dn({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:i}){return a=>{e.usedRightMouseButton=!!(n&&rn(t,e.mouseButton??0)),a.sourceEvent?.sync||r([a.transform.x,a.transform.y,a.transform.k]),i&&!a.sourceEvent?.internal&&i?.(a.sourceEvent,en(a.transform))}}function fn({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:r,onPanZoomEnd:i,onPaneContextMenu:a}){return o=>{if(!o.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,a&&rn(t,e.mouseButton??0)&&!e.usedRightMouseButton&&o.sourceEvent&&a(o.sourceEvent),e.usedRightMouseButton=!1,r(!1),i)){let t=en(o.transform);e.prevViewport=t,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{i?.(o.sourceEvent,t)},n?150:0)}}}function pn({panActivationKeyPressed:e,zoomActivationKeyPressed:t,zoomOnScroll:n,zoomOnPinch:r,panOnDrag:i,panOnScroll:a,zoomOnDoubleClick:o,userSelectionActive:s,noWheelClassName:c,noPanClassName:l,lib:u,connectionInProgress:d}){return f=>{let p=t||n,m=r&&f.ctrlKey,h=f.type===`wheel`;if(f.button===1&&f.type===`mousedown`&&(nn(f,`${u}-flow__node`)||nn(f,`${u}-flow__edge`)||nn(f,`${u}-flow__selection`)||nn(f,`${u}-flow__nodesselection`)))return!0;if(!i&&!p&&!a&&!o&&!r||s||d&&!h||nn(f,c)&&h||nn(f,l)&&(!h||a&&h&&!t)||!r&&f.ctrlKey&&h)return!1;if(!r&&f.type===`touchstart`&&f.touches?.length>1)return f.preventDefault(),!1;if(!p&&!a&&!m&&h||!i&&(f.type===`mousedown`||f.type===`touchstart`)||Array.isArray(i)&&!i.includes(f.button)&&f.type===`mousedown`)return!1;let g=Array.isArray(i)&&i.includes(f.button)||!f.button||f.button<=1;return(!f.ctrlKey||h||e)&&g}}function mn({domNode:e,minZoom:t,maxZoom:n,translateExtent:r,viewport:i,onPanZoom:a,onPanZoomStart:o,onPanZoomEnd:s,onDraggingChange:c}){let l={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},u=e.getBoundingClientRect(),d=[[0,0],[u.width,u.height]];(typeof ResizeObserver<`u`?new ResizeObserver(e=>{let t=e[0];t&&(d=[[0,0],[t.contentRect.width,t.contentRect.height]])}):null)?.observe(e);let f=y().extent(()=>d).scaleExtent([t,n]).translateExtent(r),p=x(e).call(f);C({x:i.x,y:i.y,zoom:q(i.zoom,t,n)},[[0,0],[u.width,u.height]],r);let m=p.on(`wheel.zoom`),h=p.on(`dblclick.zoom`);f.wheelDelta(sn);async function _(e,t){return p?new Promise(n=>{f?.interpolate(t?.interpolate===`linear`?w:g).transform(on(p,t?.duration,t?.ease,()=>n(!0)),e)}):!1}function b({noWheelClassName:e,noPanClassName:t,onPaneContextMenu:n,userSelectionActive:r,panOnScroll:i,panOnDrag:u,panOnScrollMode:d,panOnScrollSpeed:g,preventScrolling:_,zoomOnPinch:v,zoomOnScroll:y,zoomOnDoubleClick:b,panActivationKeyPressed:x=!1,zoomActivationKeyPressed:C,lib:w,onTransformChange:T,connectionInProgress:E,paneClickDistance:D,selectionOnDrag:O}){r&&!l.isZoomingOrPanning&&S();let k=i&&!C&&!r;f.clickDistance(O?1/0:!J(D)||D<0?0:D);let A=k?cn({zoomPanValues:l,noWheelClassName:e,d3Selection:p,d3Zoom:f,panOnScrollMode:d,panOnScrollSpeed:g,zoomOnPinch:v,onPanZoomStart:o,onPanZoom:a,onPanZoomEnd:s}):ln({noWheelClassName:e,preventScrolling:_,d3ZoomHandler:m});p.on(`wheel.zoom`,A,{passive:!1});let j=un({zoomPanValues:l,onDraggingChange:c,onPanZoomStart:o});f.on(`start`,j);let M=dn({zoomPanValues:l,panOnDrag:u,onPaneContextMenu:!!n,onPanZoom:a,onTransformChange:T});f.on(`zoom`,M);let N=fn({zoomPanValues:l,panOnDrag:u,panOnScroll:i,onPaneContextMenu:n,onPanZoomEnd:s,onDraggingChange:c});f.on(`end`,N);let P=pn({panActivationKeyPressed:x,zoomActivationKeyPressed:C,panOnDrag:u,zoomOnScroll:y,panOnScroll:i,zoomOnDoubleClick:b,zoomOnPinch:v,userSelectionActive:r,noPanClassName:t,noWheelClassName:e,lib:w,connectionInProgress:E});f.filter(P),b?p.on(`dblclick.zoom`,h):p.on(`dblclick.zoom`,null)}function S(){f.on(`zoom`,null)}async function C(e,t,n){let r=tn(e),i=f?.constrain()(r,t,n);return i&&await _(i),i}async function T(e,t){let n=tn(e);return await _(n,t),n}function E(e){if(p){let t=tn(e),n=p.property(`__zoom`);(n.k!==e.zoom||n.x!==e.x||n.y!==e.y)&&f?.transform(p,t,null,{sync:!0})}}function D(){let e=p?v(p.node()):{x:0,y:0,k:1};return{x:e.x,y:e.y,zoom:e.k}}async function O(e,t){return p?new Promise(n=>{f?.interpolate(t?.interpolate===`linear`?w:g).scaleTo(on(p,t?.duration,t?.ease,()=>n(!0)),e)}):!1}async function k(e,t){return p?new Promise(n=>{f?.interpolate(t?.interpolate===`linear`?w:g).scaleBy(on(p,t?.duration,t?.ease,()=>n(!0)),e)}):!1}function A(e){f?.scaleExtent(e)}function j(e){f?.translateExtent(e)}function M(e){let t=!J(e)||e<0?0:e;f?.clickDistance(t)}return{update:b,destroy:S,setViewport:T,setViewportConstrained:C,getViewport:D,scaleTo:O,scaleBy:k,setScaleExtent:A,setTranslateExtent:j,syncViewport:E,setClickDistance:M}}var hn;(function(e){e.Line=`line`,e.Handle=`handle`})(hn||={});function gn({width:e,prevWidth:t,height:n,prevHeight:r,affectsX:i,affectsY:a}){let o=e-t,s=n-r,c=[o>0?1:o<0?-1:0,s>0?1:s<0?-1:0];return o&&i&&(c[0]*=-1),s&&a&&(c[1]*=-1),c}function _n(e){return{isHorizontal:e.includes(`right`)||e.includes(`left`),isVertical:e.includes(`bottom`)||e.includes(`top`),affectsX:e.includes(`left`),affectsY:e.includes(`top`)}}function vn(e,t){return Math.max(0,t-e)}function yn(e,t){return Math.max(0,e-t)}function bn(e,t,n){return Math.max(0,t-e,e-n)}function xn(e,t){return e?!t:t}function Sn(e,t,n,r,i,a,o,s){let{affectsX:c,affectsY:l}=t,{isHorizontal:u,isVertical:d}=t,f=u&&d,{xSnapped:p,ySnapped:m}=n,{minWidth:h,maxWidth:g,minHeight:_,maxHeight:v}=r,{x:y,y:b,width:x,height:S,aspectRatio:C}=e,w=Math.floor(u?p-e.pointerX:0),T=Math.floor(d?m-e.pointerY:0),E=x+(c?-w:w),D=S+(l?-T:T),O=-a[0]*x,k=-a[1]*S,A=bn(E,h,g),j=bn(D,_,v);if(o){let e=0,t=0;c&&w<0?e=vn(y+w+O,o[0][0]):!c&&w>0&&(e=yn(y+E+O,o[1][0])),l&&T<0?t=vn(b+T+k,o[0][1]):!l&&T>0&&(t=yn(b+D+k,o[1][1])),A=Math.max(A,e),j=Math.max(j,t)}if(s){let e=0,t=0;c&&w>0?e=yn(y+w,s[0][0]):!c&&w<0&&(e=vn(y+E,s[1][0])),l&&T>0?t=yn(b+T,s[0][1]):!l&&T<0&&(t=vn(b+D,s[1][1])),A=Math.max(A,e),j=Math.max(j,t)}if(i){if(u){let e=bn(E/C,_,v)*C;if(A=Math.max(A,e),o){let e=0;e=!c&&!l||c&&!l&&f?yn(b+k+E/C,o[1][1])*C:vn(b+k+(c?w:-w)/C,o[0][1])*C,A=Math.max(A,e)}if(s){let e=0;e=!c&&!l||c&&!l&&f?vn(b+E/C,s[1][1])*C:yn(b+(c?w:-w)/C,s[0][1])*C,A=Math.max(A,e)}}if(d){let e=bn(D*C,h,g)/C;if(j=Math.max(j,e),o){let e=0;e=!c&&!l||l&&!c&&f?yn(y+D*C+O,o[1][0])/C:vn(y+(l?T:-T)*C+O,o[0][0])/C,j=Math.max(j,e)}if(s){let e=0;e=!c&&!l||l&&!c&&f?vn(y+D*C,s[1][0])/C:yn(y+(l?T:-T)*C,s[0][0])/C,j=Math.max(j,e)}}}T+=T<0?j:-j,w+=w<0?A:-A,i&&(f?E>D*C?T=(xn(c,l)?-w:w)/C:w=(xn(c,l)?-T:T)*C:u?(T=w/C,l=c):(w=T*C,c=l));let M=c?y+w:y,N=l?b+T:b;return{width:x+(c?-w:w),height:S+(l?-T:T),x:a[0]*w*(c?-1:1)+M,y:a[1]*T*(l?-1:1)+N}}var Cn={width:0,height:0,x:0,y:0},wn={...Cn,pointerX:0,pointerY:0,aspectRatio:1};function Tn(e,t,n){let r=t.position.x+e.position.x,i=t.position.y+e.position.y,a=e.measured.width??0,o=e.measured.height??0,s=n[0]*a,c=n[1]*o;return[[r-s,i-c],[r+a-s,i+o-c]]}function En({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:i}){let a=x(e),o={controlDirection:_n(`bottom-right`),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function s({controlPosition:e,boundaries:s,keepAspectRatio:c,resizeDirection:l,onResizeStart:u,onResize:d,onResizeEnd:f,shouldResize:p}){let m={...Cn},h={...wn};o={boundaries:s,resizeDirection:l,keepAspectRatio:c,controlDirection:_n(e)};let g,_=null,v=[],y,b,x,S=M().on(`start`,e=>{let{nodeLookup:r,transform:i,snapGrid:a,snapToGrid:o,nodeOrigin:s,paneDomNode:c}=n();if(g=r.get(t),!g)return;_=c?.getBoundingClientRect()??null;let{xSnapped:l,ySnapped:d}=He(e.sourceEvent,{transform:i,snapGrid:a,snapToGrid:o,containerBounds:_});m={width:g.measured.width??0,height:g.measured.height??0,x:g.position.x??0,y:g.position.y??0},h={...m,pointerX:l,pointerY:d,aspectRatio:m.width/m.height},y=void 0,b=Fe(g.extent)?g.extent:void 0,g.parentId&&(g.extent===`parent`||g.expandParent)&&(y=r.get(g.parentId)),y&&g.extent===`parent`&&(b=[[0,0],[y.measured.width,y.measured.height]]),v=[],x=void 0;for(let[e,n]of r)if(n.parentId===t&&(v.push({id:e,position:{...n.position},extent:n.extent}),n.extent===`parent`||n.expandParent)){let e=Tn(n,g,n.origin??s);x=x?[[Math.min(e[0][0],x[0][0]),Math.min(e[0][1],x[0][1])],[Math.max(e[1][0],x[1][0]),Math.max(e[1][1],x[1][1])]]:e}u?.(e,{...m})}).on(`drag`,e=>{let{transform:t,snapGrid:i,snapToGrid:a,nodeOrigin:s}=n(),c=He(e.sourceEvent,{transform:t,snapGrid:i,snapToGrid:a,containerBounds:_}),l=[];if(!g)return;let{x:u,y:f,width:S,height:C}=m,w={},T=g.origin??s,{width:E,height:D,x:O,y:k}=Sn(h,o.controlDirection,c,o.boundaries,o.keepAspectRatio,T,b,x),A=E!==S,j=D!==C,M=O!==u&&A,N=k!==f&&j;if(!M&&!N&&!A&&!j)return;let P={prevValues:{...m},startX:h.x,startY:h.y,childNodes:v.map(e=>({...e,position:{...e.position}}))};if((M||N||T[0]===1||T[1]===1)&&(w.x=M?O:m.x,w.y=N?k:m.y,m.x=w.x,m.y=w.y,v.length>0)){let e=O-u,t=k-f;for(let n of v)n.position={x:n.position.x-e+T[0]*(E-S),y:n.position.y-t+T[1]*(D-C)},l.push(n)}if((A||j)&&(w.width=A&&(!o.resizeDirection||o.resizeDirection===`horizontal`)?E:m.width,w.height=j&&(!o.resizeDirection||o.resizeDirection===`vertical`)?D:m.height,m.width=w.width,m.height=w.height),y&&g.expandParent){let e=T[0]*(w.width??0);w.x&&w.x<e&&(m.x=e,h.x-=w.x-e);let t=T[1]*(w.height??0);w.y&&w.y<t&&(m.y=t,h.y-=w.y-t)}let F=gn({width:m.width,prevWidth:S,height:m.height,prevHeight:C,affectsX:o.controlDirection.affectsX,affectsY:o.controlDirection.affectsY}),I={...m,direction:F};if(p?.(e,I)===!1){m=P.prevValues,h.x=P.startX,h.y=P.startY,v.forEach((e,t)=>{e.position=P.childNodes[t].position});return}d?.(e,I),r(w,l)}).on(`end`,e=>{f?.(e,{...m}),i?.({...m})});a.call(S)}function c(){a.on(`.drag`,null)}return{update:s,destroy:c}}var Dn=t((e=>{var t=n(),r=T();function i(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var a=typeof Object.is==`function`?Object.is:i,o=r.useSyncExternalStore,s=t.useRef,c=t.useEffect,l=t.useMemo,u=t.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,i){var d=s(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=l(function(){function e(e){if(!o){if(o=!0,s=e,e=r(e),i!==void 0&&f.hasValue){var t=f.value;if(i(t,e))return c=t}return c=e}if(t=c,a(s,e))return t;var n=r(e);return i!==void 0&&i(t,n)?(s=e,t):(s=e,c=n)}var o=!1,s,c,l=n===void 0?null:n;return[function(){return e(t())},l===null?void 0:function(){return e(l())}]},[t,n,r,i]);var p=o(e,d[0],d[1]);return c(function(){f.hasValue=!0,f.value=p},[p]),u(p),p}})),On=e(t(((e,t)=>{t.exports=Dn()}))(),1),kn=e=>{let t,n=new Set,r=(e,r)=>{let i=typeof e==`function`?e(t):e;if(!Object.is(i,t)){let e=t;t=r??(typeof i!=`object`||!i)?i:Object.assign({},t,i),n.forEach(n=>n(t,e))}},i=()=>t,a={setState:r,getState:i,getInitialState:()=>o,subscribe:e=>(n.add(e),()=>n.delete(e)),destroy:()=>{n.clear()}},o=t=e(r,i,a);return a},An=e=>e?kn(e):kn,{useDebugValue:jn}=N.default,{useSyncExternalStoreWithSelector:Mn}=On.default,Nn=e=>e;function Pn(e,t=Nn,n){let r=Mn(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return jn(r),r}var Fn=(e,t)=>{let n=An(e),r=(e,r=t)=>Pn(n,e,r);return Object.assign(r,n),r},In=(e,t)=>e?Fn(e,t):Fn;function Z(e,t){if(Object.is(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(let[n,r]of e)if(!Object.is(r,t.get(n)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}let n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(let r of n)if(!Object.prototype.hasOwnProperty.call(t,r)||!Object.is(e[r],t[r]))return!1;return!0}var Ln=e(r()),Rn=(0,N.createContext)(null),zn=Rn.Provider,Bn=I.error001(`react`);function Q(e,t){let n=(0,N.useContext)(Rn);if(n===null)throw Error(Bn);return Pn(n,e,t)}function $(){let e=(0,N.useContext)(Rn);if(e===null)throw Error(Bn);return(0,N.useMemo)(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}var Vn={display:`none`},Hn={position:`absolute`,width:1,height:1,margin:-1,border:0,padding:0,overflow:`hidden`,clip:`rect(0px, 0px, 0px, 0px)`,clipPath:`inset(100%)`},Un=`react-flow__node-desc`,Wn=`react-flow__edge-desc`,Gn=`react-flow__aria-live`,Kn=e=>e.ariaLiveMessage,qn=e=>e.ariaLabelConfig;function Jn({rfId:e}){let t=Q(Kn);return(0,P.jsx)(`div`,{id:`${Gn}-${e}`,"aria-live":`assertive`,"aria-atomic":`true`,style:Hn,children:t})}function Yn({rfId:e,disableKeyboardA11y:t}){let n=Q(qn);return(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(`div`,{id:`${Un}-${e}`,style:Vn,children:t?n[`node.a11yDescription.default`]:n[`node.a11yDescription.keyboardDisabled`]}),(0,P.jsx)(`div`,{id:`${Wn}-${e}`,style:Vn,children:n[`edge.a11yDescription.default`]}),!t&&(0,P.jsx)(Jn,{rfId:e})]})}var Xn=(0,N.forwardRef)(({position:e=`top-left`,children:t,className:n,style:r,...i},a)=>{let o=`${e}`.split(`-`);return(0,P.jsx)(`div`,{className:F([`react-flow__panel`,n,...o]),style:r,ref:a,...i,children:t})});Xn.displayName=`Panel`;var Zn=`https://reactflow.dev?utm_source=attribution`;function Qn({proOptions:e,position:t=`bottom-right`}){return(0,N.useEffect)(()=>{},[]),e?.hideAttribution?null:(0,P.jsx)(Xn,{position:t,className:`react-flow__attribution`,"data-message":`Please only hide this attribution when you are subscribed to React Flow Pro: ${Zn}`,children:(0,P.jsx)(`a`,{href:Zn,target:`_blank`,rel:`noopener noreferrer`,"aria-label":`React Flow attribution`,children:`React Flow`})})}var $n=e=>{let t=[],n=[];for(let[,n]of e.nodeLookup)n.selected&&t.push(n.internals.userNode);for(let[,t]of e.edgeLookup)t.selected&&n.push(t);return{selectedNodes:t,selectedEdges:n}},er=e=>e.id;function tr(e,t){return Z(e.selectedNodes.map(er),t.selectedNodes.map(er))&&Z(e.selectedEdges.map(er),t.selectedEdges.map(er))}function nr({onSelectionChange:e}){let t=$(),{selectedNodes:n,selectedEdges:r}=Q($n,tr);return(0,N.useEffect)(()=>{let i={nodes:n,edges:r};e?.(i),t.getState().onSelectionChangeHandlers.forEach(e=>e(i))},[n,r,e]),null}var rr=e=>!!e.onSelectionChangeHandlers;function ir({onSelectionChange:e}){let t=Q(rr);return e||t?(0,P.jsx)(nr,{onSelectionChange:e}):null}var ar=[0,0],or={x:0,y:0,zoom:1},sr=[...`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`.split(`.`),`rfId`],cr=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}),lr={translateExtent:L,nodeOrigin:ar,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:`nopan`,rfId:`1`};function ur(e){let{setNodes:t,setEdges:n,setMinZoom:r,setMaxZoom:i,setTranslateExtent:a,setNodeExtent:o,reset:s,setDefaultNodesAndEdges:c}=Q(cr,Z),l=$();(0,N.useEffect)(()=>(c(e.defaultNodes,e.defaultEdges),()=>{u.current=lr,s()}),[]);let u=(0,N.useRef)(lr);return(0,N.useEffect)(()=>{for(let s of sr){let c=e[s];c!==u.current[s]&&e[s]!==void 0&&(s===`nodes`?t(c):s===`edges`?n(c):s===`minZoom`?r(c):s===`maxZoom`?i(c):s===`translateExtent`?a(c):s===`nodeExtent`?o(c):s===`ariaLabelConfig`?l.setState({ariaLabelConfig:Be(c)}):s===`fitView`?l.setState({fitViewQueued:c}):s===`fitViewOptions`?l.setState({fitViewOptions:c}):l.setState({[s]:c}))}u.current=e},sr.map(t=>e[t])),null}function dr(){return typeof window>`u`||!window.matchMedia?null:window.matchMedia(`(prefers-color-scheme: dark)`)}function fr(e){let[t,n]=(0,N.useState)(e===`system`?null:e);return(0,N.useEffect)(()=>{if(e!==`system`){n(e);return}let t=dr(),r=()=>n(t?.matches?`dark`:`light`);return r(),t?.addEventListener(`change`,r),()=>{t?.removeEventListener(`change`,r)}},[e]),t===null?dr()?.matches?`dark`:`light`:t}var pr=typeof document<`u`?document:null;function mr(e=null,t={target:pr,actInsideInputWithModifier:!0}){let[n,r]=(0,N.useState)(!1),i=(0,N.useRef)(!1),a=(0,N.useRef)(new Set([])),[o,s]=(0,N.useMemo)(()=>{if(e!==null){let t=(Array.isArray(e)?e:[e]).filter(e=>typeof e==`string`).map(e=>e.replace(/\+/g,`
|
|
2
2
|
`).replace(`
|
|
3
3
|
|
|
4
4
|
`,`
|