@graphrefly/graphrefly 0.41.0 → 0.43.0
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/{cascading-Cxs1eztH.d.cts → cascading-CH-_VwG9.d.cts} +2 -2
- package/dist/{cascading-BNfxffgc.d.ts → cascading-OgKQZjsa.d.ts} +2 -2
- package/dist/chunk-3XDYJRYU.js +1 -0
- package/dist/{chunk-AI7QC7J6.js → chunk-4YAN45KM.js} +1 -1
- package/dist/chunk-626TESAC.js +3 -0
- package/dist/chunk-6HOSXQKF.js +1 -0
- package/dist/{chunk-G3M3IMEV.js → chunk-CUNIRONA.js} +1 -1
- package/dist/chunk-EBW4V6JN.js +1 -0
- package/dist/chunk-FDQGFWLF.js +1 -0
- package/dist/{chunk-33N4TU3X.js → chunk-FG4TKHMC.js} +1 -1
- package/dist/{chunk-YQRN4CIV.js → chunk-I7IGYPSL.js} +1 -1
- package/dist/chunk-INQD2KRQ.js +1 -0
- package/dist/{chunk-7PQLZMOG.js → chunk-JNWRYDJN.js} +1 -1
- package/dist/{chunk-TT4C7DXW.js → chunk-JQFH2DV6.js} +1 -1
- package/dist/{chunk-M3FQSXEW.js → chunk-K2Q24F5T.js} +1 -1
- package/dist/chunk-KVV66NN2.js +1 -0
- package/dist/chunk-NON4NLIC.js +45 -0
- package/dist/{chunk-CYOSWFT2.js → chunk-O2BLLH7M.js} +3 -3
- package/dist/{chunk-OV5AA6HJ.js → chunk-OCKEEPRJ.js} +1 -1
- package/dist/{chunk-X7QKTXXC.js → chunk-OFZG3TB3.js} +3 -3
- package/dist/chunk-OYJKFY7V.js +1 -0
- package/dist/{chunk-SC27WTSG.js → chunk-P6C4WHZO.js} +1 -1
- package/dist/{chunk-VV62MIG4.js → chunk-PT7W5FCD.js} +1 -1
- package/dist/{chunk-UISPDFJ3.js → chunk-Q4U3A3L5.js} +1 -1
- package/dist/chunk-QE4IGY7I.js +61 -0
- package/dist/{chunk-5VEZLQFN.js → chunk-QYVXF7GW.js} +1 -1
- package/dist/{chunk-ZAJ7J7TO.js → chunk-S3EEIPO7.js} +1 -1
- package/dist/{chunk-GI4Q7PNY.js → chunk-SUWT3ZON.js} +1 -1
- package/dist/{chunk-CGNOWGV6.js → chunk-TPKQW72B.js} +1 -1
- package/dist/{chunk-L77I47VU.js → chunk-V5A7M7RJ.js} +1 -1
- package/dist/chunk-VNC3TMVY.js +1 -0
- package/dist/{chunk-AK5RHMC5.js → chunk-VOPGGIL7.js} +1 -1
- package/dist/chunk-VQ4A6T2A.js +1 -0
- package/dist/{chunk-KNVCCBIU.js → chunk-XG62INFA.js} +1 -1
- package/dist/{chunk-F7VUYPP6.js → chunk-Y4NI3X7O.js} +1 -1
- package/dist/compat/index.cjs +5 -5
- package/dist/compat/index.d.cts +16 -16
- package/dist/compat/index.d.ts +16 -16
- package/dist/compat/index.js +1 -1
- package/dist/compat/jotai/index.d.cts +2 -2
- package/dist/compat/jotai/index.d.ts +2 -2
- package/dist/compat/nanostores/index.d.cts +2 -2
- package/dist/compat/nanostores/index.d.ts +2 -2
- package/dist/compat/nestjs/index.cjs +5 -5
- package/dist/compat/nestjs/index.d.cts +8 -8
- package/dist/compat/nestjs/index.d.ts +8 -8
- package/dist/compat/nestjs/index.js +1 -1
- package/dist/compat/react/index.d.cts +2 -2
- package/dist/compat/react/index.d.ts +2 -2
- package/dist/compat/solid/index.d.cts +2 -2
- package/dist/compat/solid/index.d.ts +2 -2
- package/dist/compat/svelte/index.d.cts +2 -2
- package/dist/compat/svelte/index.d.ts +2 -2
- package/dist/compat/vue/index.d.cts +2 -2
- package/dist/compat/vue/index.d.ts +2 -2
- package/dist/compat/zustand/index.cjs +3 -3
- package/dist/compat/zustand/index.d.cts +4 -4
- package/dist/compat/zustand/index.d.ts +4 -4
- package/dist/compat/zustand/index.js +1 -1
- package/dist/core/index.d.cts +4 -4
- package/dist/core/index.d.ts +4 -4
- package/dist/{decay-C25AyNAj.d.cts → decay-2ZukgQ4o.d.cts} +2 -2
- package/dist/{decay-BnrlbxSv.d.ts → decay-CdEBmDIs.d.ts} +2 -2
- package/dist/extra/browser.d.cts +1 -1
- package/dist/extra/browser.d.ts +1 -1
- package/dist/extra/index.cjs +14 -14
- package/dist/extra/index.d.cts +10 -11
- package/dist/extra/index.d.ts +10 -11
- package/dist/extra/index.js +1 -1
- package/dist/extra/node.cjs +2 -2
- package/dist/extra/node.d.cts +1 -1
- package/dist/extra/node.d.ts +1 -1
- package/dist/extra/node.js +1 -1
- package/dist/extra/operators.cjs +1 -1
- package/dist/extra/operators.d.cts +1 -1
- package/dist/extra/operators.d.ts +1 -1
- package/dist/extra/operators.js +1 -1
- package/dist/extra/reactive.d.cts +3 -3
- package/dist/extra/reactive.d.ts +3 -3
- package/dist/extra/reactive.js +1 -1
- package/dist/extra/render/index.d.cts +3 -3
- package/dist/extra/render/index.d.ts +3 -3
- package/dist/extra/sources.cjs +3 -1
- package/dist/extra/sources.d.cts +1 -1
- package/dist/extra/sources.d.ts +1 -1
- package/dist/extra/sources.js +1 -1
- package/dist/extra/storage-browser.d.cts +1 -1
- package/dist/extra/storage-browser.d.ts +1 -1
- package/dist/{fallback-CMZl39L5.d.ts → fallback-CqYVLL6X.d.ts} +1 -1
- package/dist/{fallback-8JYU8tlT.d.cts → fallback-Ctlj2tMY.d.cts} +1 -1
- package/dist/graph/index.cjs +7 -7
- package/dist/graph/index.d.cts +5 -5
- package/dist/graph/index.d.ts +5 -5
- package/dist/graph/index.js +1 -1
- package/dist/{graph-BkIkog4h.d.ts → graph-7VguS7a4.d.ts} +3 -3
- package/dist/{graph-E6likq7w.d.cts → graph-C4SHb3Ly.d.cts} +3 -3
- package/dist/{index-DgJc8Zgc.d.cts → index-0rKFCVFp.d.cts} +90 -5
- package/dist/{index-BAQrjuZF.d.ts → index-B-i4_g3k.d.ts} +2 -2
- package/dist/{index-DpiGqtrs.d.cts → index-B5iz82A3.d.cts} +441 -381
- package/dist/{index-Bd91Nmf4.d.cts → index-BAOD98JD.d.cts} +4 -4
- package/dist/{index-2n8Eai6M.d.ts → index-BG0BN3PB.d.ts} +1 -1
- package/dist/{index-z8WFPVI8.d.cts → index-BJX94aud.d.cts} +1 -1
- package/dist/{index-DhLyOHYZ.d.ts → index-BP8a88zx.d.ts} +11 -4
- package/dist/{index-Cnr1WrlX.d.cts → index-BTQtTb_H.d.cts} +14 -3
- package/dist/{index-DOBLxOti.d.cts → index-BVpm6noz.d.cts} +1 -1
- package/dist/{index-Cczxgd2D.d.ts → index-Bc41FuHp.d.cts} +3 -3
- package/dist/{index-BiHUBEKq.d.cts → index-BdGtBX-X.d.cts} +3 -3
- package/dist/{index-da2V5vPy.d.ts → index-Bf7eqeSF.d.ts} +2 -2
- package/dist/{index-DuRsN9ae.d.cts → index-BiX1Nkgx.d.cts} +383 -18
- package/dist/{index-DGTo1yka.d.cts → index-BoLv_OfD.d.cts} +2 -2
- package/dist/{index-DVAlsmEU.d.cts → index-BojK2fwH.d.cts} +3 -3
- package/dist/{index-B72TQQHd.d.cts → index-BsT7F2et.d.ts} +3 -3
- package/dist/{index-DGD4_fj6.d.cts → index-BwLvVVsy.d.cts} +8 -5
- package/dist/{index-CQtWm7jS.d.ts → index-C59mYFKp.d.ts} +9 -9
- package/dist/{index-C6ZUaos7.d.ts → index-C7O6r5fV.d.ts} +1 -1
- package/dist/{index-CL7oilfm.d.cts → index-C9kSENB4.d.cts} +1 -1
- package/dist/{index-DVDapw2k.d.cts → index-C9pjcz3l.d.cts} +35 -36
- package/dist/{index-CG33HeBW.d.ts → index-CAC_rNzm.d.ts} +8 -5
- package/dist/{index-yLt-aPMp.d.ts → index-CCq87F7t.d.ts} +1 -1
- package/dist/{index-D4uimgee.d.cts → index-CDXc9zKM.d.cts} +1 -1
- package/dist/{index-B2RUoIUz.d.ts → index-CJK1JkYy.d.ts} +1 -1
- package/dist/{index-DktLSZOc.d.cts → index-CLon-IWF.d.cts} +4 -4
- package/dist/{index-DQQCOIt8.d.cts → index-COD1kVoS.d.cts} +10 -5
- package/dist/{index-bXXLSvor.d.ts → index-CPT7C_f1.d.ts} +4 -4
- package/dist/{index-CD2dBMet.d.ts → index-CQG3D1cp.d.ts} +10 -5
- package/dist/{index-BQ1fR4li.d.ts → index-CZQXo5tH.d.ts} +35 -36
- package/dist/{index-A3U3CSve.d.cts → index-CZjOhcBy.d.cts} +2 -2
- package/dist/{index-DYTBbF8T.d.cts → index-ChOyVLKm.d.cts} +1 -1
- package/dist/{index-BJSZxSFX.d.ts → index-CvrqGfNS.d.ts} +1 -1
- package/dist/{index-DhnsQfa3.d.ts → index-D-AEQVLo.d.ts} +441 -381
- package/dist/{index-CAP3UGsq.d.ts → index-D4Y1cMG0.d.ts} +1 -1
- package/dist/{index-40ZT4MHj.d.ts → index-DBHK8O6H.d.ts} +14 -3
- package/dist/{index-3k4Gg6-n.d.ts → index-DBevwHj_.d.ts} +3 -3
- package/dist/{index-Ctb7_2sG.d.ts → index-DIOoAZUX.d.ts} +1 -1
- package/dist/{index-WSlcjhQF.d.ts → index-DSZ3ZCHF.d.ts} +124 -13
- package/dist/{index-DH4fm2Ck.d.ts → index-Dgs8zcj7.d.ts} +2 -2
- package/dist/{index-BaA-xpSw.d.ts → index-Dh_HJ82K.d.ts} +3 -3
- package/dist/{index-CtFNGe-m.d.cts → index-Dhc7a7Xo.d.cts} +2 -2
- package/dist/{index-CoM4rzyB.d.ts → index-Dmqp7KjD.d.ts} +1 -1
- package/dist/{index-B6iTqKtJ.d.ts → index-Dn-wI9g4.d.ts} +2 -2
- package/dist/{index-C-dkXOpB.d.cts → index-Du7u1lSf.d.cts} +11 -4
- package/dist/{index-DfOK_oL5.d.ts → index-DwigL4lY.d.ts} +383 -18
- package/dist/index-DyR7eU5S.d.cts +779 -0
- package/dist/index-JZUPJIJy.d.ts +779 -0
- package/dist/{index-I1cCY3ZI.d.ts → index-K0_0eR8g.d.ts} +90 -5
- package/dist/{index-BilOa6AE.d.cts → index-O16yXPK4.d.cts} +124 -13
- package/dist/{index-CRm0YIzC.d.cts → index-O7fucFrU.d.cts} +9 -9
- package/dist/{index-MxYuWOrf.d.cts → index-RV_yDjOX.d.cts} +3 -3
- package/dist/{index-C5cQ7Gfx.d.ts → index-cm1GNcWE.d.ts} +4 -4
- package/dist/{index-CgnCFhr2.d.cts → index-f5IivDUX.d.cts} +1 -1
- package/dist/{index-PgwvGWa1.d.cts → index-hHcaFlJX.d.cts} +1 -1
- package/dist/{index-tV3AA9hI.d.cts → index-tJoTcnHh.d.cts} +2 -2
- package/dist/{index-eaQuGJnv.d.ts → index-wAzD9yVj.d.ts} +3 -3
- package/dist/{index-D3ayz3hy.d.cts → index-z96luz5O.d.cts} +1 -1
- package/dist/index.cjs +48 -48
- package/dist/index.d.cts +45 -50
- package/dist/index.d.ts +45 -50
- package/dist/index.js +1 -1
- package/dist/{meta-D8OyedKp.d.ts → meta-BgVAsg9j.d.ts} +1 -1
- package/dist/{meta-Ct9nqQS5.d.cts → meta-vE8bxW1E.d.cts} +1 -1
- package/dist/{node-BYInONRr.d.cts → node-ClS5yC-B.d.cts} +1 -1
- package/dist/{node-BYInONRr.d.ts → node-ClS5yC-B.d.ts} +1 -1
- package/dist/{observable-DO8DDEzv.d.ts → observable-BsBzUrcI.d.ts} +1 -1
- package/dist/{observable-DMIlYJV1.d.cts → observable-DLGPPtb8.d.cts} +1 -1
- package/dist/patterns/ai/browser.d.cts +4 -4
- package/dist/patterns/ai/browser.d.ts +4 -4
- package/dist/patterns/ai/browser.js +1 -1
- package/dist/patterns/ai/index.cjs +17 -17
- package/dist/patterns/ai/index.d.cts +17 -17
- package/dist/patterns/ai/index.d.ts +17 -17
- package/dist/patterns/ai/index.js +1 -1
- package/dist/patterns/ai/node.d.cts +4 -4
- package/dist/patterns/ai/node.d.ts +4 -4
- package/dist/patterns/ai/node.js +1 -1
- package/dist/patterns/cqrs/index.cjs +3 -3
- package/dist/patterns/cqrs/index.d.cts +6 -6
- package/dist/patterns/cqrs/index.d.ts +6 -6
- package/dist/patterns/cqrs/index.js +1 -1
- package/dist/patterns/demo-shell/index.cjs +5 -5
- package/dist/patterns/demo-shell/index.d.cts +5 -5
- package/dist/patterns/demo-shell/index.d.ts +5 -5
- package/dist/patterns/demo-shell/index.js +1 -1
- package/dist/patterns/domain-templates/index.cjs +3 -3
- package/dist/patterns/domain-templates/index.d.cts +4 -4
- package/dist/patterns/domain-templates/index.d.ts +4 -4
- package/dist/patterns/domain-templates/index.js +1 -1
- package/dist/patterns/graphspec/index.cjs +12 -12
- package/dist/patterns/graphspec/index.d.cts +5 -5
- package/dist/patterns/graphspec/index.d.ts +5 -5
- package/dist/patterns/graphspec/index.js +1 -1
- package/dist/patterns/harness/index.cjs +10 -8
- package/dist/patterns/harness/index.d.cts +11 -12
- package/dist/patterns/harness/index.d.ts +11 -12
- package/dist/patterns/harness/index.js +1 -1
- package/dist/patterns/inspect/index.cjs +3 -0
- package/dist/patterns/inspect/index.d.cts +9 -0
- package/dist/patterns/inspect/index.d.ts +9 -0
- package/dist/patterns/inspect/index.js +1 -0
- package/dist/patterns/job-queue/index.cjs +3 -3
- package/dist/patterns/job-queue/index.d.cts +6 -6
- package/dist/patterns/job-queue/index.d.ts +6 -6
- package/dist/patterns/job-queue/index.js +1 -1
- package/dist/patterns/memory/index.cjs +3 -3
- package/dist/patterns/memory/index.d.cts +6 -6
- package/dist/patterns/memory/index.d.ts +6 -6
- package/dist/patterns/memory/index.js +1 -1
- package/dist/patterns/messaging/index.cjs +3 -3
- package/dist/patterns/messaging/index.d.cts +5 -5
- package/dist/patterns/messaging/index.d.ts +5 -5
- package/dist/patterns/messaging/index.js +1 -1
- package/dist/patterns/orchestration/index.cjs +3 -3
- package/dist/patterns/orchestration/index.d.cts +7 -7
- package/dist/patterns/orchestration/index.d.ts +7 -7
- package/dist/patterns/orchestration/index.js +1 -1
- package/dist/patterns/process/index.cjs +1 -1
- package/dist/patterns/process/index.d.cts +7 -7
- package/dist/patterns/process/index.d.ts +7 -7
- package/dist/patterns/process/index.js +1 -1
- package/dist/patterns/reactive-layout/index.cjs +4 -4
- package/dist/patterns/reactive-layout/index.d.cts +5 -5
- package/dist/patterns/reactive-layout/index.d.ts +5 -5
- package/dist/patterns/reactive-layout/index.js +1 -1
- package/dist/patterns/reduction/index.cjs +3 -3
- package/dist/patterns/reduction/index.d.cts +4 -4
- package/dist/patterns/reduction/index.d.ts +4 -4
- package/dist/patterns/reduction/index.js +1 -1
- package/dist/patterns/surface/index.cjs +8 -8
- package/dist/patterns/surface/index.d.cts +6 -6
- package/dist/patterns/surface/index.d.ts +6 -6
- package/dist/patterns/surface/index.js +1 -1
- package/dist/{pipeline-graph-MWrQZXCq.d.cts → pipeline-graph-DPqKDk59.d.cts} +5 -5
- package/dist/{pipeline-graph-CB4La-UW.d.ts → pipeline-graph-loP57TBA.d.ts} +5 -5
- package/dist/{reactive-layout-BtZfUKuL.d.cts → reactive-layout-Dsvob4zD.d.cts} +2 -2
- package/dist/{reactive-layout-KJj4E2dT.d.ts → reactive-layout-v7KPvxoc.d.ts} +2 -2
- package/dist/{reactive-log-_zeEnB9H.d.cts → reactive-log-B00laMSQ.d.cts} +1 -1
- package/dist/{reactive-log-BlAsPLl2.d.ts → reactive-log-BezYsbA_.d.ts} +1 -1
- package/dist/{reactive-map-6P_k3AQM.d.cts → reactive-map-48mnZ-nu.d.cts} +1 -1
- package/dist/{reactive-map-CjXByDV-.d.ts → reactive-map-BVVPdvmi.d.ts} +1 -1
- package/dist/resilience-YIWPK4YC.js +1 -0
- package/dist/{sugar-DzePN5-g.d.cts → sugar-DLwvMr3F.d.ts} +24 -4
- package/dist/{sugar-BhfjgetH.d.ts → sugar-DyVGtczU.d.cts} +24 -4
- package/dist/{topology-tree-mF7Emqzm.d.ts → topology-tree-BNGvuG82.d.ts} +1 -1
- package/dist/{topology-tree-3LBKFsUo.d.cts → topology-tree-BSdfSwMi.d.cts} +1 -1
- package/dist/{types-1Dhoi7HM.d.cts → types-B1jDWVsM.d.cts} +1 -1
- package/dist/{types-39jk0kaV.d.ts → types-DkzUUs0H.d.ts} +1 -1
- package/package.json +11 -51
- package/dist/budget-gate-CmmVtasH.d.ts +0 -115
- package/dist/budget-gate-DiP_nK0n.d.cts +0 -115
- package/dist/chunk-2W553JJC.js +0 -1
- package/dist/chunk-4MKL6Q3K.js +0 -1
- package/dist/chunk-5B3JDG5F.js +0 -1
- package/dist/chunk-5QSXEMXG.js +0 -1
- package/dist/chunk-5TEFC2ZX.js +0 -1
- package/dist/chunk-5TOPVRN6.js +0 -1
- package/dist/chunk-EC2WNSZ7.js +0 -1
- package/dist/chunk-ELAASRBT.js +0 -3
- package/dist/chunk-H5SCWHWP.js +0 -1
- package/dist/chunk-OLIKJUKI.js +0 -1
- package/dist/chunk-POXANAJ6.js +0 -3
- package/dist/chunk-RSMEXK53.js +0 -43
- package/dist/chunk-SGS4OJGS.js +0 -1
- package/dist/chunk-URJ2VFNC.js +0 -1
- package/dist/chunk-VXPLLA4P.js +0 -1
- package/dist/chunk-WZYB3JQS.js +0 -1
- package/dist/chunk-Z6X7B6A4.js +0 -61
- package/dist/index-8s-Qm-gz.d.ts +0 -218
- package/dist/index-BgjS2b8N.d.ts +0 -366
- package/dist/index-BmSQLAZo.d.cts +0 -244
- package/dist/index-CGhMJNHb.d.cts +0 -128
- package/dist/index-CUIkE1l9.d.cts +0 -230
- package/dist/index-Ck35nA-T.d.ts +0 -244
- package/dist/index-CuPUehFa.d.cts +0 -218
- package/dist/index-D1Gc7wV5.d.ts +0 -230
- package/dist/index-N2MAxt7_.d.ts +0 -128
- package/dist/index-t6L2qpHh.d.cts +0 -366
- package/dist/patterns/audit/index.cjs +0 -3
- package/dist/patterns/audit/index.d.cts +0 -8
- package/dist/patterns/audit/index.d.ts +0 -8
- package/dist/patterns/audit/index.js +0 -1
- package/dist/patterns/guarded-execution/index.cjs +0 -3
- package/dist/patterns/guarded-execution/index.d.cts +0 -9
- package/dist/patterns/guarded-execution/index.d.ts +0 -9
- package/dist/patterns/guarded-execution/index.js +0 -1
- package/dist/patterns/lens/index.cjs +0 -3
- package/dist/patterns/lens/index.d.cts +0 -7
- package/dist/patterns/lens/index.d.ts +0 -7
- package/dist/patterns/lens/index.js +0 -1
- package/dist/patterns/refine-loop/index.cjs +0 -5
- package/dist/patterns/refine-loop/index.d.cts +0 -9
- package/dist/patterns/refine-loop/index.d.ts +0 -9
- package/dist/patterns/refine-loop/index.js +0 -1
- package/dist/patterns/resilient-pipeline/index.cjs +0 -3
- package/dist/patterns/resilient-pipeline/index.d.cts +0 -8
- package/dist/patterns/resilient-pipeline/index.d.ts +0 -8
- package/dist/patterns/resilient-pipeline/index.js +0 -1
- package/dist/resilience-JISHQD2F.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var pe=Object.defineProperty;var at=Object.getOwnPropertyDescriptor;var dt=Object.getOwnPropertyNames;var ut=Object.prototype.hasOwnProperty;var L=(n,e)=>()=>(n&&(e=n(n=0)),e);var ct=(n,e)=>{for(var t in e)pe(n,t,{get:e[t],enumerable:!0})},lt=(n,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of dt(e))!ut.call(n,s)&&s!==t&&pe(n,s,{get:()=>e[s],enumerable:!(r=at(e,s))||r.enumerable});return n};var ft=n=>lt(pe({},"__esModule",{value:!0}),n);function j(){return Date.now()*1e6}var ge=L(()=>{"use strict"});var q,N,P,I,B,U,te,z,R,v,K,me,ht,ye,pt,gt,_e,De,Le,Fe,be,Y=L(()=>{"use strict";q=Symbol.for("graphrefly/START"),N=Symbol.for("graphrefly/DATA"),P=Symbol.for("graphrefly/DIRTY"),I=Symbol.for("graphrefly/RESOLVED"),B=Symbol.for("graphrefly/INVALIDATE"),U=Symbol.for("graphrefly/PAUSE"),te=Symbol.for("graphrefly/RESUME"),z=Symbol.for("graphrefly/TEARDOWN"),R=Symbol.for("graphrefly/COMPLETE"),v=Symbol.for("graphrefly/ERROR"),K=Object.freeze([P]),me=Object.freeze([I]),ht=Object.freeze([B]),ye=Object.freeze([q]),pt=Object.freeze([R]),gt=Object.freeze([z]),_e=Object.freeze([K]),De=Object.freeze([me]),Le=Object.freeze([ht]),Fe=Object.freeze([pt]),be=Object.freeze([gt])});function Pe(){return J>0||ne}function Ie(){return J>0}function Ve(n){J>0?re.push(n):n()}function ze(n){J+=1;let e=!1;try{n()}catch(t){throw e=!0,t}finally{if(J-=1,J===0)if(e){if(!ne){let t=re.splice(0);for(let r of t)try{r()}catch{}W.length=0,$.length=0,X.length=0}}else mt()}}function mt(){let n=!ne;n&&(ne=!0);let e=[],t=0;try{for(;W.length>0||$.length>0||X.length>0||n&&re.length>0;){if(n&&re.length>0){let i=re.splice(0);for(let a of i)try{a()}catch(o){e.push(o)}continue}if(t+=1,t>1e3)throw W.length=0,$.length=0,X.length=0,new Error("batch drain exceeded 1000 iterations \u2014 likely a reactive cycle");let s=(W.length>0?W:$.length>0?$:X).splice(0);for(let i of s)try{i()}catch(a){e.push(a)}}}finally{n&&(ne=!1)}if(e.length===1)throw e[0];if(e.length>1)throw new AggregateError(e,"batch drain: multiple callbacks threw")}function de(n,e,t){if(e.length===0)return;if(e.length===1){let l=t(e[0][0]);if(l<3||!Pe()){n(e);return}(l>=5?X:l===4?$:W).push(()=>n(e));return}let r=e.length,s=r,i=r,a=r,o=0;for(;o<r&&t(e[o][0])<3;)o++;for(s=o;o<r&&t(e[o][0])===3;)o++;for(i=o;o<r&&t(e[o][0])===4;)o++;a=o;let d=Pe();if(s>0){let l=e.slice(0,s);n(l)}if(i>s){let l=e.slice(s,i);d?W.push(()=>n(l)):n(l)}if(a>i){let l=e.slice(i,a);d?$.push(()=>n(l)):n(l)}if(r>a){let l=e.slice(a,r);d?X.push(()=>n(l)):n(l)}}var J,ne,W,$,X,re,Te=L(()=>{"use strict";J=0,ne=!1,W=[],$=[],X=[],re=[]});function Ge(n){return Array.isArray(n)?[...n]:[n]}function yt(n,e){return n.has(e)||n.has("*")}function He(n){let e=[];return n((s,i)=>{e.push({kind:"allow",actions:new Set(Ge(s)),where:i?.where??(()=>!0)})},(s,i)=>{e.push({kind:"deny",actions:new Set(Ge(s)),where:i?.where??(()=>!0)})}),(s,i)=>{let a=!1,o=!1;for(let d of e)yt(d.actions,i)&&d.where(s)&&(d.kind==="deny"?a=!0:o=!0);return a?!1:o}}var Z,ve=L(()=>{"use strict";Z=class extends Error{actor;action;nodeName;constructor(e,t){super(t??`GuardDenied: action "${String(e.action)}" denied for actor type "${String(e.actor.type)}"`),this.name="GuardDenied",this.actor=e.actor,this.action=e.action,this.nodeName=e.nodeName}get node(){return this.nodeName}}});function Be(n){n.registerCodec(_t)}var _t,Ue=L(()=>{"use strict";_t={name:"json",version:1,contentType:"application/json",encode(n){let e=JSON.stringify(n);return new TextEncoder().encode(e)},decode(n,e){let t=new TextDecoder().decode(n);return JSON.parse(t)}}});function ue(n){if(n==null)return bt;let{type:e,id:t,...r}=n;return{type:e??"system",id:t??"",...r}}var bt,We=L(()=>{"use strict";bt={type:"system",id:""}});function $e(n){n.registerMessageType(q,{tier:0,wireCrossing:!1}),n.registerMessageType(P,{tier:1,wireCrossing:!1}),n.registerMessageType(B,{tier:1,wireCrossing:!1,metaPassthrough:!1}),n.registerMessageType(U,{tier:2,wireCrossing:!1}),n.registerMessageType(te,{tier:2,wireCrossing:!1}),n.registerMessageType(N,{tier:3,wireCrossing:!0}),n.registerMessageType(I,{tier:3,wireCrossing:!0}),n.registerMessageType(R,{tier:4,wireCrossing:!0,metaPassthrough:!1}),n.registerMessageType(v,{tier:4,wireCrossing:!0,metaPassthrough:!1}),n.registerMessageType(z,{tier:5,wireCrossing:!0,metaPassthrough:!1})}var ce,je=L(()=>{"use strict";Y();ce=class{_messageTypes=new Map;_codecs=new Map;_onMessage;_onSubscribe;_defaultVersioning;_defaultHashFn;_inspectorEnabled=!(typeof process<"u"&&process.env?.NODE_ENV==="production");_globalInspector;_rigorRecorder;_frozen=!1;tierOf;constructor(e){this._onMessage=e.onMessage,this._onSubscribe=e.onSubscribe,this._defaultVersioning=e.defaultVersioning,this._defaultHashFn=e.defaultHashFn,this.tierOf=t=>{let r=this._messageTypes.get(t);return r!=null?r.tier:1}}get onMessage(){return this._frozen=!0,this._onMessage}get onSubscribe(){return this._frozen=!0,this._onSubscribe}set onMessage(e){this._assertUnfrozen(),this._onMessage=e}set onSubscribe(e){this._assertUnfrozen(),this._onSubscribe=e}get defaultVersioning(){return this._defaultVersioning}set defaultVersioning(e){this._assertUnfrozen(),this._defaultVersioning=e}get defaultHashFn(){return this._defaultHashFn}set defaultHashFn(e){this._assertUnfrozen(),this._defaultHashFn=e}get inspectorEnabled(){return this._inspectorEnabled}set inspectorEnabled(e){this._inspectorEnabled=e}get globalInspector(){return this._globalInspector}set globalInspector(e){this._globalInspector=e}get rigorRecorder(){return this._rigorRecorder}set rigorRecorder(e){this._rigorRecorder=e}registerMessageType(e,t){return this._assertUnfrozen(),this._messageTypes.set(e,{tier:t.tier,wireCrossing:t.wireCrossing??t.tier>=3,metaPassthrough:t.metaPassthrough??!0}),this}messageTier(e){let t=this._messageTypes.get(e);return t!=null?t.tier:1}isWireCrossing(e){let t=this._messageTypes.get(e);return t!=null?t.wireCrossing:!0}isLocalOnly(e){return!this.isWireCrossing(e)}isMetaPassthrough(e){let t=this._messageTypes.get(e);return t!=null?t.metaPassthrough:!0}isKnownMessageType(e){return this._messageTypes.has(e)}registerCodec(e){return this._assertUnfrozen(),this._codecs.set(e.name,e),this}lookupCodec(e){return this._codecs.get(e)}_isFrozen(){return this._frozen}_assertUnfrozen(){if(this._frozen)throw new Error("GraphReFlyConfig is frozen: a node has already captured this config. Register custom types and set hooks before creating any node.")}}});function we(n){if(n===void 0)return null;if(typeof n=="number"){if(!Number.isFinite(n))throw new TypeError(`Cannot hash non-finite number: ${n}`);if(Number.isInteger(n)&&!Number.isSafeInteger(n))throw new TypeError(`Cannot hash integer outside safe range (|n| > 2^53-1): ${n}. Cross-language cid parity is not guaranteed for unsafe integers.`);return n}if(typeof n=="string"||typeof n=="boolean"||n===null)return n;if(Array.isArray(n))return n.map(we);if(typeof n=="object"&&n!==null){let e={};for(let t of Object.keys(n).sort())e[t]=we(n[t]);return e}return null}function wt(n){let e=vt.encode(n),t=e.length,r=t*8,s=t+9+63&-64,i=new Uint8Array(s);i.set(e),i[t]=128;let a=new DataView(i.buffer);a.setUint32(s-4,r>>>0,!1),a.setUint32(s-8,Math.floor(r/4294967296)>>>0,!1);let o=1779033703,d=3144134277,l=1013904242,p=2773480762,y=1359893119,_=2600822924,T=528734635,k=1541459225,A=new Uint32Array(64),M=(O,x)=>O>>>x|O<<32-x;for(let O=0;O<s;O+=64){for(let h=0;h<16;h++)A[h]=a.getUint32(O+h*4,!1);for(let h=16;h<64;h++){let m=A[h-15],b=A[h-2],w=M(m,7)^M(m,18)^m>>>3,D=M(b,17)^M(b,19)^b>>>10;A[h]=A[h-16]+w+A[h-7]+D>>>0}let x=o,C=d,F=l,V=p,c=y,g=_,u=T,f=k;for(let h=0;h<64;h++){let m=M(c,6)^M(c,11)^M(c,25),b=c&g^~c&u,w=f+m+b+Tt[h]+A[h]>>>0,D=M(x,2)^M(x,13)^M(x,22),E=x&C^x&F^C&F,G=D+E>>>0;f=u,u=g,g=c,c=V+w>>>0,V=F,F=C,C=x,x=w+G>>>0}o=o+x>>>0,d=d+C>>>0,l=l+F>>>0,p=p+V>>>0,y=y+c>>>0,_=_+g>>>0,T=T+u>>>0,k=k+f>>>0}let S=O=>O.toString(16).padStart(8,"0");return S(o)+S(d)+S(l)+S(p)+S(y)+S(_)+S(T)+S(k)}function xe(n){let e=we(n??null),t=JSON.stringify(e);return wt(t).slice(0,16)}function xt(){let n=globalThis.crypto;if(n?.randomUUID)return n.randomUUID();let e=()=>Math.floor(Math.random()*4294967296).toString(16).padStart(8,"0"),t=e()+e()+e()+e();return`${t.slice(0,8)}-${t.slice(8,12)}-4${t.slice(13,16)}-${(parseInt(t.slice(16,17),16)&3|8).toString(16)}${t.slice(17,20)}-${t.slice(20,32)}`}function Ne(n,e,t){let r=t?.id??xt();if(n===0)return{id:r,version:0};let i=(t?.hash??xe)(e);return{id:r,version:0,cid:i,prev:null}}function qe(n,e,t){n.version+=1,"cid"in n&&(n.prev=n.cid,n.cid=t(e))}var Tt,vt,Ke=L(()=>{"use strict";Tt=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),vt=new TextEncoder});function Xe(n){return{node:n,unsub:null,prevData:void 0,dirty:!1,involvedThisWave:!1,dataBatch:[],terminal:void 0}}function ke(n){n.prevData=void 0,n.dirty=!1,n.involvedThisWave=!1,n.dataBatch.length=0,n.terminal=void 0}function le(n){return n.length===0?n:typeof n[0]=="symbol"?[n]:n}function Q(n,e,t){let r=Ze(n)?n:[],s=typeof n=="function"?n:typeof e=="function"?e:void 0,i={};return Ze(n)?i=(Ae(e)?e:t)??{}:Ae(n)?i=n:i=(Ae(e)?e:t)??{},new fe(r,s,i)}var Ye,Je,Nt,kt,Ee,fe,Ze,Ae,Se=L(()=>{"use strict";Ue();We();Te();ge();je();ve();Y();Ke();Ye=()=>{},Je=100;Nt=(n,e,t,r)=>{t.direction==="down-in"&&n._onDepMessage(t.depIndex,e)},kt=(n,e,t,r)=>{let s=n;if(s._status==="completed"||s._status==="errored")return;let i=s._cached,a=i===void 0?[ye]:[ye,[N,i]];s._status==="dirty"&&a.push(K),de(e,a,s._config.tierOf)},Ee=new ce({onMessage:Nt,onSubscribe:kt});$e(Ee);Be(Ee);fe=class n{_optsName;_describeKind;meta;_hasMeta;_config;_deps;_sinks=null;_sinkCount=0;_cached;_status;_cleanup;_store={};_waveHasNewData=!1;_hasNewTerminal=!1;_hasCalledFnOnce=!1;_paused=!1;_pendingWave=!1;_isExecutingFn=!1;_pendingRerun=!1;_rerunDepth=0;_dirtyDepCount=0;_batchPendingMessages=null;_pauseLocks=null;_pauseBuffer=null;_fn;_equals;_resubscribable;_resetOnTeardown;_autoComplete;_autoError;_pausable;_partial;_guard;_extraGuards;_hashFn;_versioning;_versioningLevel;_lastMutation;_inspectorHooks;_actions;constructor(e,t,r){this._config=r.config??Ee,this._config.onMessage,this._optsName=r.name,this._describeKind=r.describeKind,this._equals=r.equals??Object.is,this._resubscribable=r.resubscribable??!1,this._resetOnTeardown=r.resetOnTeardown??!1,this._autoComplete=r.completeWhenDepsComplete??!0,this._autoError=r.errorWhenDepsError??!0,this._pausable=r.pausable??!0,this._guard=r.guard,this._fn=t,this._partial=r.partial??!1,this._cached=r.initial!==void 0?r.initial:void 0,this._status=e.length===0&&t==null&&this._cached!==void 0?"settled":"sentinel",this._hashFn=r.versioningHash??this._config.defaultHashFn??xe;let s=r.versioning??this._config.defaultVersioning;this._versioningLevel=s,this._versioning=s!=null?Ne(s,this._cached===void 0?void 0:this._cached,{id:r.versioningId,hash:this._hashFn}):void 0,this._deps=e.map(Xe);let i={};for(let[o,d]of Object.entries(r.meta??{})){let l={initial:d,name:`${r.name??"node"}:meta:${o}`,describeKind:"state",config:this._config};r.guard!=null&&(l.guard=r.guard),i[o]=new n([],void 0,l)}Object.freeze(i),this.meta=i,this._hasMeta=Object.keys(i).length>0;let a=this;this._actions={emit(o){a._emit([[N,o]])},down(o){a._emit(le(o))},up(o){a._emitUp(le(o))}},this.down=this.down.bind(this),this.up=this.up.bind(this)}get _isTerminal(){return this._status==="completed"||this._status==="errored"}get name(){return this._optsName}get status(){return this._status}get cache(){return this._cached===void 0?void 0:this._cached}get lastMutation(){return this._lastMutation}get v(){return this._versioning}hasGuard(){return this._guard!=null}_applyVersioning(e,t){if(this._isExecutingFn)throw new Error(`Node "${this.name}": _applyVersioning cannot run mid-fn \u2014 call it outside of \`_execFn\` (typically at graph setup time before the first subscribe).`);let r=this._versioningLevel;if(r!=null&&e<=r)return;let s=t?.hash??this._hashFn;s!==this._hashFn&&(this._hashFn=s);let i=this._cached===void 0?void 0:this._cached,a=this._versioning,o=a?.id??t?.id,d=a?.version??0,l=Ne(e,i,{id:o,hash:s});l.version=d,this._versioning=l,this._versioningLevel=e}_setInspectorHook(e){return e==null?()=>{}:(this._inspectorHooks==null&&(this._inspectorHooks=new Set),this._inspectorHooks.add(e),()=>{this._inspectorHooks?.delete(e),this._inspectorHooks?.size===0&&(this._inspectorHooks=void 0)})}_pushGuard(e){return this._extraGuards==null&&(this._extraGuards=new Set),this._extraGuards.add(e),()=>{this._extraGuards?.delete(e),this._extraGuards?.size===0&&(this._extraGuards=void 0)}}allowsObserve(e){if(this._guard==null&&this._extraGuards==null)return!0;let t=ue(e);if(this._guard!=null&&!this._guard(t,"observe"))return!1;if(this._extraGuards!=null){for(let r of this._extraGuards)if(!r(t,"observe"))return!1}return!0}_checkGuard(e){if(e?.internal)return;let t=this._guard!=null||this._extraGuards!=null,r=e?.actor!=null;if(!t&&!r)return;let s=ue(e?.actor),i=e?.delivery==="signal"?"signal":"write";if(this._guard!=null&&!this._guard(s,i))throw new Z({actor:s,action:i,nodeName:this.name});if(this._extraGuards!=null){for(let a of this._extraGuards)if(!a(s,i))throw new Z({actor:s,action:i,nodeName:this.name})}this._lastMutation={actor:s,timestamp_ns:j()}}down(e,t){let r=le(e);r.length!==0&&(this._checkGuard(t),this._emit(r))}emit(e,t){this._checkGuard(t),this._emit([[N,e]])}up(e,t){if(this._deps.length===0)return;let r=le(e);if(r.length===0)return;this._checkGuard(t);let s=t??{internal:!0};this._validateUpTiers(r);for(let i of this._deps)i.node.up?.(r,s)}_emitUp(e){if(this._deps.length!==0&&e.length!==0){this._validateUpTiers(e);for(let t of this._deps)t.node.up?.(e,{internal:!0})}}_validateUpTiers(e){let t=this._config.tierOf;for(let r of e){let s=t(r[0]);if(s===3||s===4)throw new Error(`Node "${this.name}": tier-${s} messages cannot flow up \u2014 DATA/RESOLVED/COMPLETE/ERROR are downstream-only. Use \`down(...)\` for value delivery; \`up(...)\` is for control signals (DIRTY, INVALIDATE, PAUSE, RESUME, TEARDOWN).`)}}subscribe(e,t){if(t!=null&&this._guard!=null){let d=ue(t);if(!this._guard(d,"observe"))throw new Z({actor:d,action:"observe",nodeName:this.name})}let s=this._isTerminal&&this._resubscribable;if(s){this._cached=void 0,this._status="sentinel",this._store={},this._hasCalledFnOnce=!1,this._waveHasNewData=!1,this._hasNewTerminal=!1,this._paused=!1,this._pendingWave=!1,this._pendingRerun=!1,this._isExecutingFn=!1,this._rerunDepth=0,this._dirtyDepCount=0,this._pauseLocks=null,this._pauseBuffer=null;for(let d of this._deps)ke(d);if(this._partial===!1){for(let d of this._deps)if(d.prevData!==void 0||d.dataBatch.length!==0||d.terminal!==void 0||d.dirty)throw new Error(`resubscribable-reset invariant: DepRecord not fully reset for node ${this._optsName??"(anonymous)"}`)}}this._sinkCount+=1;let i;try{i=this._config.onSubscribe(this,e,{sinkCount:this._sinkCount,afterTerminalReset:s},this._actions)}catch(d){throw this._sinkCount-=1,d}this._sinks==null?this._sinks=e:typeof this._sinks=="function"?this._sinks=new Set([this._sinks,e]):this._sinks.add(e);let a=this._isTerminal;if(this._sinkCount===1&&!a)try{this._activate()}catch(d){if(this._sinkCount-=1,this._removeSink(e),this._sinkCount===0&&(this._status="sentinel"),typeof i=="function")try{i()}catch{}throw d}this._status==="sentinel"&&this._cached===void 0&&(this._status="pending");let o=!1;return()=>{o||(o=!0,this._sinkCount-=1,this._removeSink(e),typeof i=="function"&&i(),this._sinks==null&&this._deactivate())}}_removeSink(e){if(this._sinks===e)this._sinks=null;else if(this._sinks!=null&&typeof this._sinks!="function")if(this._sinks.delete(e),this._sinks.size===1){let[t]=this._sinks;this._sinks=t}else this._sinks.size===0&&(this._sinks=null)}_activate(){if(this._deps.length===0){this._fn&&this._execFn();return}this._dirtyDepCount=0;let e=this._deps.length,t=0;try{for(let r=0;r<e;r++){let s=r,i=this._deps[r];i.unsub=Ye,i.unsub=i.node.subscribe(a=>{if(i.unsub===null)return;let o=this._config.tierOf,d=!1;for(let l of a)o(l[0])>=3&&(d=!0),this._config.onMessage(this,l,{direction:"down-in",depIndex:s},this._actions);d&&this._maybeRunFnOnSettlement()}),t++}}catch(r){this._deps[t].unsub=null;for(let s=0;s<t;s++){let i=this._deps[s];if(i.unsub!=null){let a=i.unsub;i.unsub=null;try{a()}catch{}ke(i)}}throw this._dirtyDepCount=0,r}}_addDep(e){for(let s=0;s<this._deps.length;s++)if(this._deps[s].node===e)return s;let t=this._deps.length,r=Xe(e);if(this._deps.push(r),this._sinks==null)return t;r.dirty=!0,this._dirtyDepCount++,this._status!=="dirty"&&this._emit(_e),r.unsub=Ye;try{r.unsub=e.subscribe(s=>{if(r.unsub===null)return;let i=this._config.tierOf,a=!1;for(let o of s)i(o[0])>=3&&(a=!0),this._config.onMessage(this,o,{direction:"down-in",depIndex:t},this._actions);a&&this._maybeRunFnOnSettlement()})}catch(s){throw r.unsub=null,this._deps.pop(),this._dirtyDepCount--,s}return t}_deactivate(e=!1){let t=this._cleanup;if(this._cleanup=void 0,typeof t=="function")try{t()}catch(r){this._emit([[v,this._wrapFnError("cleanup threw",r)]])}else if(t!=null&&typeof t=="object"){let r=t.deactivate;if(typeof r=="function")try{r()}catch(s){this._emit([[v,this._wrapFnError("cleanup.deactivate threw",s)]])}}for(let r of this._deps){if(r.unsub!=null){let s=r.unsub;r.unsub=null;try{s()}catch{}}ke(r)}this._waveHasNewData=!1,this._hasNewTerminal=!1,this._hasCalledFnOnce=!1,this._paused=!1,this._pendingWave=!1,this._pendingRerun=!1,this._rerunDepth=0,this._store={},this._dirtyDepCount=0,this._pauseLocks=null,this._pauseBuffer=null,this._fn!=null&&(this._cached=void 0),e||(this._fn!=null||this._deps.length>0)&&(!this._isTerminal||this._resubscribable)&&(this._status="sentinel")}_onDepMessage(e,t){let r=this._deps[e],s=t[0];if(this._inspectorHooks!=null){let i={kind:"dep_message",depIndex:e,message:t};for(let a of this._inspectorHooks)a(i)}if(s!==q){if(s===P){this._depDirtied(r);return}if(s===B){if(this._depInvalidated(r),this._cached===void 0)return;this._emit(Le);return}if(s===U||s===te){this._emit([t]);return}if(s===z){this._emit(be);return}if(s===N)this._depSettledAsData(r,t[1]);else if(s===I)this._depSettledAsResolved(r);else if(s===R)this._depSettledAsTerminal(r,!0);else if(s===v)this._depSettledAsTerminal(r,t[1]);else{this._emit([t]);return}if(!this._fn){(s===N||s===I)&&this._emit([t]),(s===R||s===v)&&this._maybeAutoTerminalAfterWave();return}}}_depDirtied(e){e.dirty||(e.dirty=!0,e.involvedThisWave=!0,this._dirtyDepCount++,this._status!=="dirty"&&this._emit(_e))}_depSettledAsData(e,t){e.dirty&&(e.dirty=!1,this._dirtyDepCount--),e.involvedThisWave=!0,e.dataBatch.push(t),this._waveHasNewData=!0}_depSettledAsResolved(e){e.dirty&&(e.dirty=!1,this._dirtyDepCount--)}_depSettledAsTerminal(e,t){e.dirty&&(e.dirty=!1,this._dirtyDepCount--),e.terminal=t,e.involvedThisWave=!0,this._hasNewTerminal=!0}_depInvalidated(e){e.prevData=void 0,e.terminal=void 0,e.dataBatch.length=0,e.dirty?e.involvedThisWave=!1:(e.dirty=!0,e.involvedThisWave=!0,this._dirtyDepCount++)}_maybeRunFnOnSettlement(){if(!(this._isTerminal&&!this._resubscribable)&&!(this._dirtyDepCount>0)){if(!this._partial&&!this._hasCalledFnOnce)for(let e=0;e<this._deps.length;e++){let t=this._deps[e];if(t.dataBatch.length===0&&t.prevData===void 0&&t.terminal===void 0){this._maybeAutoTerminalAfterWave();return}}if(this._paused){this._pendingWave=!0;return}if(!this._waveHasNewData&&!this._hasNewTerminal&&this._hasCalledFnOnce){this._clearWaveFlags(),this._emit(De),this._maybeAutoTerminalAfterWave();return}this._fn&&this._execFn(),this._maybeAutoTerminalAfterWave()}}_maybeAutoTerminalAfterWave(){if(this._deps.length===0||this._isTerminal)return;let e=this._deps.find(t=>t.terminal!==void 0&&t.terminal!==!0);if(e!=null){this._autoError&&this._emit([[v,e.terminal]]);return}this._autoComplete&&this._deps.every(t=>t.terminal!==void 0)&&this._emit(Fe)}_execFn(){if(!this._fn||this._isTerminal&&!this._resubscribable)return;if(this._isExecutingFn){this._pendingRerun=!0;return}let e=this._cleanup;if(typeof e=="function"){this._cleanup=void 0;try{e()}catch(a){this._emit([[v,this._wrapFnError("cleanup threw",a)]]);return}}else if(e!=null&&typeof e=="object"){let a=e.beforeRun;if(typeof a=="function"){e.beforeRun=void 0;try{a()}catch(o){this._emit([[v,this._wrapFnError("cleanup.beforeRun threw",o)]]);return}}}let t=this._deps.map(a=>a.involvedThisWave?a.dataBatch.length>0?[...a.dataBatch]:[]:void 0),r=this._deps.map(a=>a.prevData);for(let a=0;a<this._deps.length;a++){let o=t[a];o!=null&&o.length>0&&(this._deps[a].prevData=o[o.length-1])}let s=this._deps.map(a=>a.terminal),i={prevData:r,terminalDeps:s,store:this._store};if(this._hasCalledFnOnce=!0,this._clearWaveFlags(),this._inspectorHooks!=null){let a={kind:"run",batchData:t,prevData:r};for(let o of this._inspectorHooks)o(a)}this._isExecutingFn=!0;try{let a=this._fn(t,this._actions,i);if(typeof a=="function")this._cleanup=a;else if(a!=null&&typeof a=="object"){let o=a;(typeof o.beforeRun=="function"||typeof o.deactivate=="function"||typeof o.invalidate=="function")&&(this._cleanup=a)}}catch(a){this._emit([[v,this._wrapFnError("fn threw",a)]])}finally{this._isExecutingFn=!1,this._pendingRerun?(this._pendingRerun=!1,this._rerunDepth+=1,this._rerunDepth>Je?(this._rerunDepth=0,this._emit([[v,new Error(`Node "${this.name}": _pendingRerun depth exceeded ${Je} \u2014 likely a reactive cycle`)]])):this._maybeRunFnOnSettlement()):this._rerunDepth=0,this._clearWaveFlags()}}_clearWaveFlags(){this._waveHasNewData=!1,this._hasNewTerminal=!1;for(let e of this._deps)e.involvedThisWave=!1,e.dataBatch.length=0}_wrapFnError(e,t){let r=t instanceof Error?t.message:String(t);return new Error(`Node "${this.name}": ${e}: ${r}`,{cause:t})}_frameBatch(e){let t=this._config.tierOf;if(e.length===1)return t(e[0][0])===3&&this._status!=="dirty"?[K,e[0]]:e;let r=!0,s=!1,i=!1,a=-1;for(let d of e){let l=t(d[0]);l<a&&(r=!1),l===3&&(s=!0),d[0]===P&&(i=!0),a=l}let o=e;if(!r){let d=e.map((l,p)=>({m:l,i:p,tier:t(l[0])}));d.sort((l,p)=>l.tier-p.tier||l.i-p.i),o=d.map(l=>l.m)}if(s&&!i&&this._status!=="dirty"){let d=0;for(;d<o.length&&t(o[d][0])===0;)d++;return d===0?[K,...o]:[...o.slice(0,d),K,...o.slice(d)]}return o}_emit(e){if(e.length===0)return;for(let o=0;o<e.length;o++){let d=e[o];if(d[0]===v&&d[1]===void 0)throw new TypeError('[ERROR, payload] requires a non-undefined payload (spec \xA71.2). Pass an Error object or domain tag instead \u2014 e.g. node.down([[ERROR, new Error("reason")]])')}let t=e;if(this._isTerminal&&!this._resubscribable){let o=e.filter(d=>d[0]===z||d[0]===B);if(o.length===0)return;t=o}t=this._frameBatch(t);let s=null;for(let o=0;o<t.length;o++){let d=t[o],l=d[0];if(l!==U&&l!==te){s?.push(d);continue}if(d.length<2)throw new Error(`Node "${this.name}": [[${l===U?"PAUSE":"RESUME"}]] must carry a lockId payload \u2014 bare PAUSE/RESUME is a protocol violation (C0 rule). Use \`[[PAUSE, lockId]]\` / \`[[RESUME, lockId]]\`.`);let p=!0;if(this._pausable!==!1){let y=d[1];if(l===U)this._pauseLocks==null&&(this._pauseLocks=new Set),this._pauseLocks.add(y),this._paused=!0,this._pausable==="resumeAll"&&this._pauseBuffer==null&&(this._pauseBuffer=[]);else if(this._pauseLocks==null||!this._pauseLocks.has(y))p=!1;else if(this._pauseLocks.delete(y),this._pauseLocks.size===0){if(this._paused=!1,this._pauseBuffer!=null&&this._pauseBuffer.length>0){let _=this._pauseBuffer;this._pauseBuffer=[],this._emit(_)}this._pendingWave&&(this._pendingWave=!1,this._maybeRunFnOnSettlement())}}p?s?.push(d):s==null&&(s=t.slice(0,o))}if(s!=null){if(s.length===0)return;t=s}if(this._hasMeta&&t.some(o=>o[0]===z))for(let o of Object.keys(this.meta))try{this.meta[o]._emit(be)}catch{}let{finalMessages:i,equalsError:a}=this._updateState(t);if(i.length>0&&this._config.inspectorEnabled){let o=this._config.globalInspector;if(o!=null)try{o({kind:"emit",node:this,messages:i})}catch{}}if(i.length>0)if(this._paused&&this._pausable==="resumeAll"&&this._pauseBuffer!=null){let o=this._config.tierOf,d=[];for(let l of i)o(l[0])===3?this._pauseBuffer.push(l):d.push(l);d.length>0&&this._dispatchOrAccumulate(d)}else this._dispatchOrAccumulate(i);a!=null&&this._emit([[v,a]])}_updateState(e){let t=this._config.tierOf,r,s,i=-1,a=0;for(let p of e)t(p[0])===3&&a++;let o=a<=1,d=-1;if(this._versioning!=null&&a>1){for(let p=e.length-1;p>=0;p--)if(e[p][0]===N){d=p;break}}for(let p=0;p<e.length;p++){let y=e[p],_=y[0];if(_===N){if(y.length>=2){let T=!1;if(o&&this._cached!==void 0)try{T=this._equals(this._cached,y[1])}catch(k){s=this._wrapFnError("equals threw",k),i=p;break}if(T){r==null&&(r=e.slice(0,p)),r.push(me),this._status="resolved";continue}this._cached=y[1],this._versioning!=null&&(d<0||p===d)&&qe(this._versioning,y[1],this._hashFn)}this._status="settled",r?.push(y)}else if(r?.push(y),_===P)this._status="dirty";else if(_===I)this._status="resolved";else if(_===R){this._status="completed";{let T=this._config.rigorRecorder;if(T!=null)try{T.onTerminalTransition(this,"completed",this._autoComplete,this._autoError,this._deps.length>0)}catch{}}}else if(_===v){this._status="errored";{let T=this._config.rigorRecorder;if(T!=null)try{T.onTerminalTransition(this,"errored",this._autoComplete,this._autoError,this._deps.length>0)}catch{}}}else if(_===B){if(this._cached!==void 0){let k=this._config.rigorRecorder;if(k!=null)try{k.onNonVacuousInvalidate(this,this._cached)}catch{}}this._cached=void 0,this._status="dirty";let T=this._cleanup;if(typeof T=="function"){this._cleanup=void 0;try{T()}catch{}}else if(T!=null&&typeof T=="object"){let k=T.invalidate;if(typeof k=="function")try{k()}catch{}}}else _===z&&(this._resetOnTeardown&&(this._cached=void 0),this._deactivate(!0),this._status="sentinel")}let l=i>=0?r??e.slice(0,i):r??e;return s!=null?{finalMessages:l,equalsError:s}:{finalMessages:l}}_deliverToSinks=e=>{if(this._sinks==null)return;if(typeof this._sinks=="function"){this._sinks(e);return}let t=[...this._sinks];for(let r of t)r(e)};_dispatchOrAccumulate(e){if(Ie()){this._batchPendingMessages===null&&(this._batchPendingMessages=[],Ve(()=>this._flushBatchPending()));for(let t of e)this._batchPendingMessages.push(t);return}de(this._deliverToSinks,e,this._config.tierOf)}_flushBatchPending(){let e=this._batchPendingMessages;if(e===null||(this._batchPendingMessages=null,e.length===0))return;let t=this._frameBatch(e);de(this._deliverToSinks,t,this._config.tierOf)}},Ze=n=>Array.isArray(n),Ae=n=>typeof n=="object"&&n!=null&&!Array.isArray(n)});function Re(n,e){return Q([],{...e,initial:n})}function se(n,e){return Q((r,s,i)=>n(s,i)??void 0,{describeKind:"producer",...e})}function oe(n,e,t){return Q(n,(s,i,a)=>{let o=s.map((d,l)=>d!=null&&d.length>0?d.at(-1):a.prevData[l]);i.emit(e(o,a))},{describeKind:"derived",...t})}var Me=L(()=>{"use strict";Se()});function he(n){return{describeKind:"producer",...n}}function Qe(n,e){let{signal:t,period:r,...s}=e??{};return se(i=>{let a=!1,o=0,d,l,p=()=>{a=!0,d!==void 0&&clearTimeout(d),l!==void 0&&clearInterval(l),t?.removeEventListener("abort",_)},y=()=>{a||(r!=null?(i.emit(o++),l=setInterval(()=>{a||i.emit(o++)},r)):(a=!0,t?.removeEventListener("abort",_),i.emit(o++),i.down([[R]])))},_=()=>{a||(p(),i.down([[v,t.reason]]))};if(t?.aborted){_();return}return d=setTimeout(y,n),t?.addEventListener("abort",_,{once:!0}),p},he(s))}function et(n,e){return se(t=>{let r=!1;try{for(let s of n){if(r)return;t.emit(s)}r||t.down([[R]])}catch(s){r||t.down([[v,s]])}return()=>{r=!0}},he(e))}function At(n){return n!=null&&typeof n.then=="function"}function Et(n,e){let{signal:t,...r}=e??{};return se(s=>{let i=!1,a=()=>{i||(i=!0,s.down([[v,t.reason]]))};if(t?.aborted){a();return}return t?.addEventListener("abort",a,{once:!0}),Promise.resolve(n).then(o=>{i||(i=!0,t?.removeEventListener("abort",a),s.emit(o),s.down([[R]]))},o=>{i||(i=!0,t?.removeEventListener("abort",a),s.down([[v,o]]))}),()=>{i=!0,t?.removeEventListener("abort",a)}},he(r))}function St(n,e){let{signal:t,...r}=e??{};return se(s=>{let i=new AbortController,a=()=>i.abort(t?.reason);t?.aborted?i.abort(t.reason):t?.addEventListener("abort",a,{once:!0});let o=t??i.signal,d=!1,l=n[Symbol.asyncIterator](),p=()=>{d||o.aborted||Promise.resolve(l.next()).then(y=>{if(!(d||o.aborted)){if(y.done){s.down([[R]]);return}s.emit(y.value),p()}},y=>{!d&&!o.aborted&&s.down([[v,y]])})};return p(),()=>{d=!0,t?.removeEventListener("abort",a),i.abort(),Promise.resolve(l.return?.()).catch(()=>{})}},he(r))}function Rt(n){return n!=null&&typeof n=="object"&&"cache"in n&&typeof n.subscribe=="function"}function tt(n,e){if(Rt(n))return n;if(At(n))return Et(n,e);if(n!=null){let t=n;if(typeof t[Symbol.asyncIterator]=="function")return St(n,e);if(typeof t[Symbol.iterator]=="function")return et(n,e)}return Mt(n)}function Mt(...n){return et(n,void 0)}var nt=L(()=>{"use strict";Y();Me()});var rt=L(()=>{"use strict";nt()});var Pt={};ct(Pt,{processInstanceKeyOf:()=>Dt,processManager:()=>Ft});module.exports=ft(Pt);ge();Y();ve();Te();Y();Se();Me();var Oe=class{_version=0;_maxSize;_buf;_head=0;_size=0;constructor(e,t){if(t!==void 0&&t<1)throw new RangeError("maxSize must be >= 1");if(this._maxSize=t,t!==void 0){if(this._buf=new Array(t),e&&e.length>0){let r=Math.min(e.length,t),s=e.length-r;for(let i=0;i<r;i++)this._buf[i]=e[s+i];this._size=r}}else this._buf=e?[...e]:[],this._size=this._buf.length}get version(){return this._version}get size(){return this._size}at(e){if(!Number.isInteger(e))return;let t=e>=0?e:this._size+e;if(!(t<0||t>=this._size))return this._maxSize!==void 0?this._buf[(this._head+t)%this._maxSize]:this._buf[t]}append(e){this._rawAppend(e),this._version+=1}appendMany(e){if(e.length===0)return;let t=this._maxSize!==void 0&&e.length>this._maxSize?e.length-this._maxSize:0;for(let r=t;r<e.length;r++)this._rawAppend(e[r]);this._version+=1}clear(){if(this._size===0)return 0;let e=this._size;if(this._maxSize===void 0)this._buf.length=0;else for(let t=0;t<e;t++)this._buf[(this._head+t)%this._maxSize]=void 0;return this._head=0,this._size=0,this._version+=1,e}trimHead(e){if(!Number.isInteger(e)||e<0)throw new RangeError(`trimHead: n must be a non-negative integer (got ${e})`);if(e===0||this._size===0)return 0;let t=Math.min(e,this._size);if(this._maxSize===void 0)this._buf.splice(0,t);else{for(let r=0;r<t;r++)this._buf[(this._head+r)%this._maxSize]=void 0;this._head=(this._head+t)%this._maxSize}return this._size-=t,this._version+=1,t}slice(e,t){if(!Number.isInteger(e)||e<0)throw new RangeError(`slice: start must be a non-negative integer (got ${e})`);if(t!==void 0&&(!Number.isInteger(t)||t<0))throw new RangeError(`slice: stop must be a non-negative integer or undefined (got ${t})`);let r=t===void 0?this._size:Math.min(Math.max(t,0),this._size),s=Math.min(e,this._size);if(s>=r)return[];let i=r-s;if(this._maxSize===void 0)return this._buf.slice(s,r);let a=new Array(i);for(let o=0;o<i;o++)a[o]=this._buf[(this._head+s+o)%this._maxSize];return a}tail(e){if(!Number.isInteger(e)||e<0)throw new RangeError(`tail: n must be a non-negative integer (got ${e})`);if(e===0||this._size===0)return[];let t=Math.min(e,this._size);return this.slice(this._size-t,this._size)}toArray(){if(this._maxSize===void 0)return[...this._buf];let e=new Array(this._size);for(let t=0;t<this._size;t++)e[t]=this._buf[(this._head+t)%this._maxSize];return e}snapshot(){return this.toArray()}restore(e){if(this._maxSize===void 0){this._buf.length=0;for(let t=0;t<e.length;t++)this._buf.push(e[t]);this._size=this._buf.length}else{let t=this._maxSize;for(let i=0;i<t;i++)this._buf[i]=void 0;this._head=0;let r=Math.min(e.length,t),s=e.length-r;for(let i=0;i<r;i++)this._buf[i]=e[s+i];this._size=r}this._version+=1}_rawAppend(e){if(this._maxSize===void 0){this._buf.push(e),this._size=this._buf.length;return}this._size<this._maxSize?(this._buf[(this._head+this._size)%this._maxSize]=e,this._size+=1):(this._buf[this._head]=e,this._head=(this._head+1)%this._maxSize)}};function ie(n){return n.subscribe(()=>{})}var Ot=64;function st(n,e={}){let{name:t,maxSize:r,versioning:s,guard:i,backend:a}=e,o=a??new Oe(n,r),d=Re(o.toArray(),{name:t,describeKind:"state",equals:(c,g)=>c===g,...s!=null?{versioning:s}:{},...i!=null?{guard:i}:{}});function l(){let c=o.toArray();ze(()=>{d.down([[P]],{internal:!0}),d.down([[N,c]],{internal:!0})})}let p=new Map,y=new Map,_=new Map;function T(c,g){return`${c}:${g===void 0?"END":g}`}function k(c){if(c.size<Ot)return;let g=c.keys().next();if(g.done)return;let u=c.get(g.value);u!==void 0&&u.dispose(),c.delete(g.value)}function A(c){let g=o.version;try{return c()}finally{o.version!==g&&l()}}function M(c){if(!Number.isInteger(c)||c<0)throw new RangeError(`tail: n must be a non-negative integer (got ${c})`);let g=p.get(c);if(g!==void 0)return p.delete(c),p.set(c,g),g.node;k(p);let u=oe([d],([h])=>{let m=h;return c===0||m.length===0?[]:m.slice(Math.max(0,m.length-c))},{initial:o.tail(c),describeKind:"derived"}),f=ie(u);return p.set(c,{node:u,dispose:f}),u}function S(c,g){if(!Number.isInteger(c)||c<0)throw new RangeError(`slice: start must be a non-negative integer (got ${c})`);if(g!==void 0&&(!Number.isInteger(g)||g<0))throw new RangeError(`slice: stop must be a non-negative integer or undefined (got ${g})`);let u=T(c,g),f=y.get(u);if(f!==void 0)return y.delete(u),y.set(u,f),f.node;k(y);let h=oe([d],([b])=>{let w=b;return g===void 0?w.slice(c):w.slice(c,g)},{initial:o.slice(c,g),describeKind:"derived"}),m=ie(h);return y.set(u,{node:h,dispose:m}),h}function O(c){let g=_.get(c);if(g!==void 0)return g.node;let u=oe([d,c],([h,m])=>{let b=h,w=Math.max(0,Math.trunc(m??0));return b.slice(w)},{initial:[],describeKind:"derived"}),f=ie(u);return _.set(c,{node:u,dispose:f}),u}let x,C;function F(){x===void 0&&(x=Q([d],(c,g,u)=>{let f=c[0],m=f!=null&&f.length>0?f.at(-1):u.prevData[0];if(m==null||m.length===0){g.down([[I]]);return}g.emit(m[m.length-1])},{name:t!=null?`${t}::lastValue`:"lastValue",describeKind:"derived",initial:o.size===0?void 0:o.at(o.size-1)}),C=oe([d],([c])=>c.length>0,{name:t!=null?`${t}::hasLatest`:"hasLatest",describeKind:"derived",initial:o.size>0}),ie(x),ie(C))}let V={entries:d,get size(){return o.size},at(c){return o.at(c)},append(c){A(()=>o.append(c))},appendMany(c){c.length!==0&&A(()=>o.appendMany(c))},clear(){A(()=>o.clear())},trimHead(c){A(()=>o.trimHead(c))},withLatest(){return F(),d},get lastValue(){return F(),x},get hasLatest(){return F(),C},view(c){switch(c.kind){case"tail":return M(c.n);case"slice":return S(c.start,c.stop);case"fromCursor":return O(c.cursor)}},attach(c){let g=c.subscribe(u=>{for(let f of u)f[0]===N&&V.append(f[1])});return()=>g()},attachStorage(c){if(c.length===0)return()=>{};let g=new Map;for(let f of c)g.set(f,o.size);(async()=>{for(let f of c)if(typeof f.loadEntries=="function")try{let h=await Promise.resolve(f.loadEntries());h.entries.length>0&&o.size===0&&(o.restore(h.entries),g.set(f,h.entries.length),l());break}catch{}})();let u=d.subscribe(f=>{for(let h of f){if(h[0]!==N)continue;let m=h[1];for(let b of c){let w=g.get(b)??0;if(m.length<w){try{let E=b.appendEntries(m);E instanceof Promise&&E.catch(()=>{})}catch{}g.set(b,m.length);continue}if(m.length===w)continue;let D=m.slice(w);g.set(b,m.length);try{let E=b.appendEntries(D);E instanceof Promise&&E.catch(()=>{})}catch{}}}});return()=>u()},disposeAllViews(){for(let c of p.values())c.dispose();p.clear();for(let c of y.values())c.dispose();y.clear();for(let c of _.values())c.dispose();_.clear()},dispose(){for(let c of p.values())c.dispose();p.clear();for(let c of y.values())c.dispose();y.clear();for(let c of _.values())c.dispose();_.clear()}};return V}var Ct=He((n,e)=>{n("observe"),n("signal"),e("write")});function ot(n){let e=st([],{name:n.name,maxSize:n.retainedLimit??1024,guard:n.guard??Ct,...n.versioning!=null?{versioning:n.versioning}:{}});return e.withLatest(),n.graph&&n.graph.add(e.entries,{name:n.name}),e}rt();var Dt=n=>n.correlationId;function it(n){if(n==null)return Promise.resolve(void 0);let e=tt(n);return new Promise((t,r)=>{let s=!1,i,a=()=>{i&&i()};i=e.subscribe(o=>{if(!s)for(let d of o){if(d[0]===N){s=!0,Promise.resolve().then(a),t(d[1]);return}if(d[0]===v){s=!0,Promise.resolve().then(a),r(d[1]);return}if(d[0]===R){s=!0,Promise.resolve().then(a),t(void 0);return}}})})}async function Lt(n,e,t,r,s){let i;for(let a=0;a<=r;a++){if(a>0){let o=s[Math.min(a-1,s.length-1)]??0;o>0&&await new Promise(d=>setTimeout(d,o))}try{return await it(n(e,t))}catch(o){i=o}}return{outcome:"failure",error:i}}function Ft(n,e,t){let r=t.retryMax??0,s=t.backoffMs??[0],i=1024,a=new Map,o=new Set,d=new Map,l=ot({name:`${e}_process_instances`,retainedLimit:i,graph:n}),p=0;function y(){return++p}function _(u,f,h){T(u,f,h,void 0)}function T(u,f,h,m){let b=j(),w={correlationId:u,state:f,status:h,startedAt:d.get(u)??b,updatedAt:b,t_ns:b,seq:y(),...t.handlerVersion!==void 0?{handlerVersion:t.handlerVersion}:{},...m!==void 0?{reason:m}:{}};l.append(w)}let k=`_process_${e}_started`;n.event(k),t.persistence?.eventStorage&&n.attachEventStorage(t.persistence.eventStorage);async function A(u,f,h,m){if(o.delete(u),a.delete(u),d.delete(u),t.compensate)try{await it(t.compensate(f,h)),T(u,f,"compensated",m)}catch{_(u,f,"errored")}else _(u,f,"errored")}async function M(u,f){if(o.has(u)){if(f.outcome==="failure"){let h=a.get(u)??t.initial;await A(u,h,f.error);return}if(f.outcome==="success"){if(a.set(u,f.state),f.emit)for(let h of f.emit)try{n._appendEvent(h.type,h.payload,{correlationId:u,aggregateId:u})}catch{}if(_(u,f.state,"running"),t.isTerminal?.(f.state)){o.delete(u),a.delete(u),d.delete(u),_(u,f.state,"terminated");return}if(f.schedule){let{afterMs:h,eventType:m}=f.schedule,b,w=Qe(h),D=E=>{for(let G of E)if(G[0]===N){if(b?b():queueMicrotask(()=>b?.()),!o.has(u))return;let ee=a.get(u);if(ee===void 0)return;let H=t.steps[m];if(!H)return;let ae={type:m,payload:null,timestampNs:j(),seq:Number.NaN,correlationId:u,aggregateId:u};O(u,H,ee,ae)}};b=w.subscribe(D)}return}if(f.outcome==="terminate"){if(a.set(u,f.state),f.emit)for(let h of f.emit)try{n._appendEvent(h.type,h.payload,{correlationId:u,aggregateId:u})}catch{}o.delete(u),a.delete(u),d.delete(u),_(u,f.state,"terminated")}}}let S=new Map;function O(u,f,h,m){let w=(S.get(u)??Promise.resolve()).then(async()=>{let D=a.get(u);if(D===void 0||!o.has(u))return;let E;try{E=await Lt(f,D,m,r,s)}catch(G){await A(u,a.get(u)??t.initial,G);return}await M(u,E)});S.set(u,w),w.finally(()=>{S.get(u)===w&&S.delete(u)})}let x=!1,C=[];for(let u of t.watching){let f=n.event(u),h=0;h=(f.cache??[]).length;let b=f.subscribe(w=>{for(let D of w){if(D[0]!==N)continue;let E=D[1];if(E.length<=h)continue;let G=E.slice(h);h=E.length;for(let ee of G){let H=ee.correlationId;if(H===void 0||!o.has(H))continue;let ae=t.steps[u];if(!ae)continue;let Ce=a.get(H);Ce!==void 0&&O(H,ae,Ce,ee)}}});C.push(b)}function F(u,f){if(x||o.has(u))return;let h=j();d.set(u,h),a.set(u,t.initial),o.add(u);try{n._appendEvent(k,f??null,{correlationId:u,aggregateId:u})}catch{}_(u,t.initial,"running")}function V(u,f){if(x||!o.has(u))return;let h=a.get(u)??t.initial;A(u,h,new Error(`cancelled: ${f??"no reason given"}`),f)}function c(u){return a.get(u)}function g(){if(!x){x=!0;for(let u of C)try{u()}catch{}C.length=0}}return{instances:l,audit:l,start:F,cancel:V,getState:c,dispose:g}}0&&(module.exports={processInstanceKeyOf,processManager});
|
|
1
|
+
"use strict";var ye=Object.defineProperty;var ft=Object.getOwnPropertyDescriptor;var ht=Object.getOwnPropertyNames;var pt=Object.prototype.hasOwnProperty;var L=(n,e)=>()=>(n&&(e=n(n=0)),e);var gt=(n,e)=>{for(var t in e)ye(n,t,{get:e[t],enumerable:!0})},mt=(n,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of ht(e))!pt.call(n,s)&&s!==t&&ye(n,s,{get:()=>e[s],enumerable:!(r=ft(e,s))||r.enumerable});return n};var yt=n=>mt(ye({},"__esModule",{value:!0}),n);function B(){return Date.now()*1e6}var ue=L(()=>{"use strict"});var K,N,F,I,U,$,te,z,M,w,Y,_e,_t,be,bt,Tt,Te,De,Le,Fe,ve,W=L(()=>{"use strict";K=Symbol.for("graphrefly/START"),N=Symbol.for("graphrefly/DATA"),F=Symbol.for("graphrefly/DIRTY"),I=Symbol.for("graphrefly/RESOLVED"),U=Symbol.for("graphrefly/INVALIDATE"),$=Symbol.for("graphrefly/PAUSE"),te=Symbol.for("graphrefly/RESUME"),z=Symbol.for("graphrefly/TEARDOWN"),M=Symbol.for("graphrefly/COMPLETE"),w=Symbol.for("graphrefly/ERROR"),Y=Object.freeze([F]),_e=Object.freeze([I]),_t=Object.freeze([U]),be=Object.freeze([K]),bt=Object.freeze([M]),Tt=Object.freeze([z]),Te=Object.freeze([Y]),De=Object.freeze([_e]),Le=Object.freeze([_t]),Fe=Object.freeze([bt]),ve=Object.freeze([Tt])});function Pe(){return J>0||ne}function Ie(){return J>0}function Ve(n){J>0?re.push(n):n()}function ze(n){J+=1;let e=!1;try{n()}catch(t){throw e=!0,t}finally{if(J-=1,J===0)if(e){if(!ne){let t=re.splice(0);for(let r of t)try{r()}catch{}j.length=0,q.length=0,X.length=0}}else vt()}}function vt(){let n=!ne;n&&(ne=!0);let e=[],t=0;try{for(;j.length>0||q.length>0||X.length>0||n&&re.length>0;){if(n&&re.length>0){let i=re.splice(0);for(let a of i)try{a()}catch(o){e.push(o)}continue}if(t+=1,t>1e3)throw j.length=0,q.length=0,X.length=0,new Error("batch drain exceeded 1000 iterations \u2014 likely a reactive cycle");let s=(j.length>0?j:q.length>0?q:X).splice(0);for(let i of s)try{i()}catch(a){e.push(a)}}}finally{n&&(ne=!1)}if(e.length===1)throw e[0];if(e.length>1)throw new AggregateError(e,"batch drain: multiple callbacks threw")}function ce(n,e,t){if(e.length===0)return;if(e.length===1){let l=t(e[0][0]);if(l<3||!Pe()){n(e);return}(l>=5?X:l===4?q:j).push(()=>n(e));return}let r=e.length,s=r,i=r,a=r,o=0;for(;o<r&&t(e[o][0])<3;)o++;for(s=o;o<r&&t(e[o][0])===3;)o++;for(i=o;o<r&&t(e[o][0])===4;)o++;a=o;let d=Pe();if(s>0){let l=e.slice(0,s);n(l)}if(i>s){let l=e.slice(s,i);d?j.push(()=>n(l)):n(l)}if(a>i){let l=e.slice(i,a);d?q.push(()=>n(l)):n(l)}if(r>a){let l=e.slice(a,r);d?X.push(()=>n(l)):n(l)}}var J,ne,j,q,X,re,we=L(()=>{"use strict";J=0,ne=!1,j=[],q=[],X=[],re=[]});function Ge(n){return Array.isArray(n)?[...n]:[n]}function wt(n,e){return n.has(e)||n.has("*")}function He(n){let e=[];return n((s,i)=>{e.push({kind:"allow",actions:new Set(Ge(s)),where:i?.where??(()=>!0)})},(s,i)=>{e.push({kind:"deny",actions:new Set(Ge(s)),where:i?.where??(()=>!0)})}),(s,i)=>{let a=!1,o=!1;for(let d of e)wt(d.actions,i)&&d.where(s)&&(d.kind==="deny"?a=!0:o=!0);return a?!1:o}}var Q,xe=L(()=>{"use strict";Q=class extends Error{actor;action;nodeName;constructor(e,t){super(t??`GuardDenied: action "${String(e.action)}" denied for actor type "${String(e.actor.type)}"`),this.name="GuardDenied",this.actor=e.actor,this.action=e.action,this.nodeName=e.nodeName}get node(){return this.nodeName}}});function Be(n){n.registerCodec(xt)}var xt,Ue=L(()=>{"use strict";xt={name:"json",version:1,contentType:"application/json",encode(n){let e=JSON.stringify(n);return new TextEncoder().encode(e)},decode(n,e){let t=new TextDecoder().decode(n);return JSON.parse(t)}}});function le(n){if(n==null)return Nt;let{type:e,id:t,...r}=n;return{type:e??"system",id:t??"",...r}}var Nt,$e=L(()=>{"use strict";Nt={type:"system",id:""}});function We(n){n.registerMessageType(K,{tier:0,wireCrossing:!1}),n.registerMessageType(F,{tier:1,wireCrossing:!1}),n.registerMessageType(U,{tier:1,wireCrossing:!1,metaPassthrough:!1}),n.registerMessageType($,{tier:2,wireCrossing:!1}),n.registerMessageType(te,{tier:2,wireCrossing:!1}),n.registerMessageType(N,{tier:3,wireCrossing:!0}),n.registerMessageType(I,{tier:3,wireCrossing:!0}),n.registerMessageType(M,{tier:4,wireCrossing:!0,metaPassthrough:!1}),n.registerMessageType(w,{tier:4,wireCrossing:!0,metaPassthrough:!1}),n.registerMessageType(z,{tier:5,wireCrossing:!0,metaPassthrough:!1})}var fe,je=L(()=>{"use strict";W();fe=class{_messageTypes=new Map;_codecs=new Map;_onMessage;_onSubscribe;_defaultVersioning;_defaultHashFn;_inspectorEnabled=!(typeof process<"u"&&process.env?.NODE_ENV==="production");_globalInspector;_rigorRecorder;_frozen=!1;tierOf;constructor(e){this._onMessage=e.onMessage,this._onSubscribe=e.onSubscribe,this._defaultVersioning=e.defaultVersioning,this._defaultHashFn=e.defaultHashFn,this.tierOf=t=>{let r=this._messageTypes.get(t);return r!=null?r.tier:1}}get onMessage(){return this._frozen=!0,this._onMessage}get onSubscribe(){return this._frozen=!0,this._onSubscribe}set onMessage(e){this._assertUnfrozen(),this._onMessage=e}set onSubscribe(e){this._assertUnfrozen(),this._onSubscribe=e}get defaultVersioning(){return this._defaultVersioning}set defaultVersioning(e){this._assertUnfrozen(),this._defaultVersioning=e}get defaultHashFn(){return this._defaultHashFn}set defaultHashFn(e){this._assertUnfrozen(),this._defaultHashFn=e}get inspectorEnabled(){return this._inspectorEnabled}set inspectorEnabled(e){this._inspectorEnabled=e}get globalInspector(){return this._globalInspector}set globalInspector(e){this._globalInspector=e}get rigorRecorder(){return this._rigorRecorder}set rigorRecorder(e){this._rigorRecorder=e}registerMessageType(e,t){return this._assertUnfrozen(),this._messageTypes.set(e,{tier:t.tier,wireCrossing:t.wireCrossing??t.tier>=3,metaPassthrough:t.metaPassthrough??!0}),this}messageTier(e){let t=this._messageTypes.get(e);return t!=null?t.tier:1}isWireCrossing(e){let t=this._messageTypes.get(e);return t!=null?t.wireCrossing:!0}isLocalOnly(e){return!this.isWireCrossing(e)}isMetaPassthrough(e){let t=this._messageTypes.get(e);return t!=null?t.metaPassthrough:!0}isKnownMessageType(e){return this._messageTypes.has(e)}registerCodec(e){return this._assertUnfrozen(),this._codecs.set(e.name,e),this}lookupCodec(e){return this._codecs.get(e)}_isFrozen(){return this._frozen}_assertUnfrozen(){if(this._frozen)throw new Error("GraphReFlyConfig is frozen: a node has already captured this config. Register custom types and set hooks before creating any node.")}}});function Ne(n){if(n===void 0)return null;if(typeof n=="number"){if(!Number.isFinite(n))throw new TypeError(`Cannot hash non-finite number: ${n}`);if(Number.isInteger(n)&&!Number.isSafeInteger(n))throw new TypeError(`Cannot hash integer outside safe range (|n| > 2^53-1): ${n}. Cross-language cid parity is not guaranteed for unsafe integers.`);return n}if(typeof n=="string"||typeof n=="boolean"||n===null)return n;if(Array.isArray(n))return n.map(Ne);if(typeof n=="object"&&n!==null){let e={};for(let t of Object.keys(n).sort())e[t]=Ne(n[t]);return e}return null}function At(n){let e=Et.encode(n),t=e.length,r=t*8,s=t+9+63&-64,i=new Uint8Array(s);i.set(e),i[t]=128;let a=new DataView(i.buffer);a.setUint32(s-4,r>>>0,!1),a.setUint32(s-8,Math.floor(r/4294967296)>>>0,!1);let o=1779033703,d=3144134277,l=1013904242,p=2773480762,y=1359893119,b=2600822924,_=528734635,k=1541459225,E=new Uint32Array(64),C=(O,x)=>O>>>x|O<<32-x;for(let O=0;O<s;O+=64){for(let h=0;h<16;h++)E[h]=a.getUint32(O+h*4,!1);for(let h=16;h<64;h++){let m=E[h-15],T=E[h-2],v=C(m,7)^C(m,18)^m>>>3,R=C(T,17)^C(T,19)^T>>>10;E[h]=E[h-16]+v+E[h-7]+R>>>0}let x=o,D=d,P=l,V=p,c=y,g=b,u=_,f=k;for(let h=0;h<64;h++){let m=C(c,6)^C(c,11)^C(c,25),T=c&g^~c&u,v=f+m+T+kt[h]+E[h]>>>0,R=C(x,2)^C(x,13)^C(x,22),A=x&D^x&P^D&P,G=R+A>>>0;f=u,u=g,g=c,c=V+v>>>0,V=P,P=D,D=x,x=v+G>>>0}o=o+x>>>0,d=d+D>>>0,l=l+P>>>0,p=p+V>>>0,y=y+c>>>0,b=b+g>>>0,_=_+u>>>0,k=k+f>>>0}let S=O=>O.toString(16).padStart(8,"0");return S(o)+S(d)+S(l)+S(p)+S(y)+S(b)+S(_)+S(k)}function ke(n){let e=Ne(n??null),t=JSON.stringify(e);return At(t).slice(0,16)}function St(){let n=globalThis.crypto;if(n?.randomUUID)return n.randomUUID();let e=()=>Math.floor(Math.random()*4294967296).toString(16).padStart(8,"0"),t=e()+e()+e()+e();return`${t.slice(0,8)}-${t.slice(8,12)}-4${t.slice(13,16)}-${(parseInt(t.slice(16,17),16)&3|8).toString(16)}${t.slice(17,20)}-${t.slice(20,32)}`}function Ee(n,e,t){let r=t?.id??St();if(n===0)return{id:r,version:0};let i=(t?.hash??ke)(e);return{id:r,version:0,cid:i,prev:null}}function qe(n,e,t){n.version+=1,"cid"in n&&(n.prev=n.cid,n.cid=t(e))}var kt,Et,Ke=L(()=>{"use strict";kt=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),Et=new TextEncoder});function Xe(n){return{node:n,unsub:null,prevData:void 0,dirty:!1,involvedThisWave:!1,dataBatch:[],terminal:void 0}}function Ae(n){n.prevData=void 0,n.dirty=!1,n.involvedThisWave=!1,n.dataBatch.length=0,n.terminal=void 0}function he(n){return n.length===0?n:typeof n[0]=="symbol"?[n]:n}function Z(n,e,t){let r=Qe(n)?n:[],s=typeof n=="function"?n:typeof e=="function"?e:void 0,i={};return Qe(n)?i=(Se(e)?e:t)??{}:Se(n)?i=n:i=(Se(e)?e:t)??{},new pe(r,s,i)}var Ye,Je,Rt,Mt,Re,pe,Qe,Se,Me=L(()=>{"use strict";Ue();$e();we();ue();je();xe();W();Ke();Ye=()=>{},Je=100;Rt=(n,e,t,r)=>{t.direction==="down-in"&&n._onDepMessage(t.depIndex,e)},Mt=(n,e,t,r)=>{let s=n;if(s._status==="completed"||s._status==="errored")return;let i=s._cached,a=i===void 0?[be]:[be,[N,i]];s._status==="dirty"&&a.push(Y),ce(e,a,s._config.tierOf)},Re=new fe({onMessage:Rt,onSubscribe:Mt});We(Re);Be(Re);pe=class n{_optsName;_describeKind;meta;_hasMeta;_config;_deps;_sinks=null;_sinkCount=0;_cached;_status;_cleanup;_store={};_waveHasNewData=!1;_hasNewTerminal=!1;_hasCalledFnOnce=!1;_paused=!1;_pendingWave=!1;_isExecutingFn=!1;_pendingRerun=!1;_rerunDepth=0;_dirtyDepCount=0;_batchPendingMessages=null;_pauseLocks=null;_pauseBuffer=null;_fn;_equals;_resubscribable;_resetOnTeardown;_autoComplete;_autoError;_pausable;_partial;_guard;_extraGuards;_hashFn;_versioning;_versioningLevel;_lastMutation;_inspectorHooks;_actions;constructor(e,t,r){this._config=r.config??Re,this._config.onMessage,this._optsName=r.name,this._describeKind=r.describeKind,this._equals=r.equals??Object.is,this._resubscribable=r.resubscribable??!1,this._resetOnTeardown=r.resetOnTeardown??!1,this._autoComplete=r.completeWhenDepsComplete??!0,this._autoError=r.errorWhenDepsError??!0,this._pausable=r.pausable??!0,this._guard=r.guard,this._fn=t,this._partial=r.partial??!1,this._cached=r.initial!==void 0?r.initial:void 0,this._status=e.length===0&&t==null&&this._cached!==void 0?"settled":"sentinel",this._hashFn=r.versioningHash??this._config.defaultHashFn??ke;let s=r.versioning??this._config.defaultVersioning;this._versioningLevel=s,this._versioning=s!=null?Ee(s,this._cached===void 0?void 0:this._cached,{id:r.versioningId,hash:this._hashFn}):void 0,this._deps=e.map(Xe);let i={};for(let[o,d]of Object.entries(r.meta??{})){let l={initial:d,name:`${r.name??"node"}:meta:${o}`,describeKind:"state",config:this._config};r.guard!=null&&(l.guard=r.guard),i[o]=new n([],void 0,l)}Object.freeze(i),this.meta=i,this._hasMeta=Object.keys(i).length>0;let a=this;this._actions={emit(o){a._emit([[N,o]])},down(o){a._emit(he(o))},up(o){a._emitUp(he(o))}},this.down=this.down.bind(this),this.up=this.up.bind(this)}get _isTerminal(){return this._status==="completed"||this._status==="errored"}get name(){return this._optsName}get status(){return this._status}get cache(){return this._cached===void 0?void 0:this._cached}get lastMutation(){return this._lastMutation}get v(){return this._versioning}hasGuard(){return this._guard!=null}_applyVersioning(e,t){if(this._isExecutingFn)throw new Error(`Node "${this.name}": _applyVersioning cannot run mid-fn \u2014 call it outside of \`_execFn\` (typically at graph setup time before the first subscribe).`);let r=this._versioningLevel;if(r!=null&&e<=r)return;let s=t?.hash??this._hashFn;s!==this._hashFn&&(this._hashFn=s);let i=this._cached===void 0?void 0:this._cached,a=this._versioning,o=a?.id??t?.id,d=a?.version??0,l=Ee(e,i,{id:o,hash:s});l.version=d,this._versioning=l,this._versioningLevel=e}_setInspectorHook(e){return e==null?()=>{}:(this._inspectorHooks==null&&(this._inspectorHooks=new Set),this._inspectorHooks.add(e),()=>{this._inspectorHooks?.delete(e),this._inspectorHooks?.size===0&&(this._inspectorHooks=void 0)})}_pushGuard(e){return this._extraGuards==null&&(this._extraGuards=new Set),this._extraGuards.add(e),()=>{this._extraGuards?.delete(e),this._extraGuards?.size===0&&(this._extraGuards=void 0)}}allowsObserve(e){if(this._guard==null&&this._extraGuards==null)return!0;let t=le(e);if(this._guard!=null&&!this._guard(t,"observe"))return!1;if(this._extraGuards!=null){for(let r of this._extraGuards)if(!r(t,"observe"))return!1}return!0}_checkGuard(e){if(e?.internal)return;let t=this._guard!=null||this._extraGuards!=null,r=e?.actor!=null;if(!t&&!r)return;let s=le(e?.actor),i=e?.delivery==="signal"?"signal":"write";if(this._guard!=null&&!this._guard(s,i))throw new Q({actor:s,action:i,nodeName:this.name});if(this._extraGuards!=null){for(let a of this._extraGuards)if(!a(s,i))throw new Q({actor:s,action:i,nodeName:this.name})}this._lastMutation={actor:s,timestamp_ns:B()}}down(e,t){let r=he(e);r.length!==0&&(this._checkGuard(t),this._emit(r))}emit(e,t){this._checkGuard(t),this._emit([[N,e]])}up(e,t){if(this._deps.length===0)return;let r=he(e);if(r.length===0)return;this._checkGuard(t);let s=t??{internal:!0};this._validateUpTiers(r);for(let i of this._deps)i.node.up?.(r,s)}_emitUp(e){if(this._deps.length!==0&&e.length!==0){this._validateUpTiers(e);for(let t of this._deps)t.node.up?.(e,{internal:!0})}}_validateUpTiers(e){let t=this._config.tierOf;for(let r of e){let s=t(r[0]);if(s===3||s===4)throw new Error(`Node "${this.name}": tier-${s} messages cannot flow up \u2014 DATA/RESOLVED/COMPLETE/ERROR are downstream-only. Use \`down(...)\` for value delivery; \`up(...)\` is for control signals (DIRTY, INVALIDATE, PAUSE, RESUME, TEARDOWN).`)}}subscribe(e,t){if(t!=null&&this._guard!=null){let d=le(t);if(!this._guard(d,"observe"))throw new Q({actor:d,action:"observe",nodeName:this.name})}let s=this._isTerminal&&this._resubscribable;if(s){this._cached=void 0,this._status="sentinel",this._store={},this._hasCalledFnOnce=!1,this._waveHasNewData=!1,this._hasNewTerminal=!1,this._paused=!1,this._pendingWave=!1,this._pendingRerun=!1,this._isExecutingFn=!1,this._rerunDepth=0,this._dirtyDepCount=0,this._pauseLocks=null,this._pauseBuffer=null;for(let d of this._deps)Ae(d);if(this._partial===!1){for(let d of this._deps)if(d.prevData!==void 0||d.dataBatch.length!==0||d.terminal!==void 0||d.dirty)throw new Error(`resubscribable-reset invariant: DepRecord not fully reset for node ${this._optsName??"(anonymous)"}`)}}this._sinkCount+=1;let i;try{i=this._config.onSubscribe(this,e,{sinkCount:this._sinkCount,afterTerminalReset:s},this._actions)}catch(d){throw this._sinkCount-=1,d}this._sinks==null?this._sinks=e:typeof this._sinks=="function"?this._sinks=new Set([this._sinks,e]):this._sinks.add(e);let a=this._isTerminal;if(this._sinkCount===1&&!a)try{this._activate()}catch(d){if(this._sinkCount-=1,this._removeSink(e),this._sinkCount===0&&(this._status="sentinel"),typeof i=="function")try{i()}catch{}throw d}this._status==="sentinel"&&this._cached===void 0&&(this._status="pending");let o=!1;return()=>{o||(o=!0,this._sinkCount-=1,this._removeSink(e),typeof i=="function"&&i(),this._sinks==null&&this._deactivate())}}_removeSink(e){if(this._sinks===e)this._sinks=null;else if(this._sinks!=null&&typeof this._sinks!="function")if(this._sinks.delete(e),this._sinks.size===1){let[t]=this._sinks;this._sinks=t}else this._sinks.size===0&&(this._sinks=null)}_activate(){if(this._deps.length===0){this._fn&&this._execFn();return}this._dirtyDepCount=0;let e=this._deps.length,t=0;try{for(let r=0;r<e;r++){let s=r,i=this._deps[r];i.unsub=Ye,i.unsub=i.node.subscribe(a=>{if(i.unsub===null)return;let o=this._config.tierOf,d=!1;for(let l of a)o(l[0])>=3&&(d=!0),this._config.onMessage(this,l,{direction:"down-in",depIndex:s},this._actions);d&&this._maybeRunFnOnSettlement()}),t++}}catch(r){this._deps[t].unsub=null;for(let s=0;s<t;s++){let i=this._deps[s];if(i.unsub!=null){let a=i.unsub;i.unsub=null;try{a()}catch{}Ae(i)}}throw this._dirtyDepCount=0,r}}_addDep(e){for(let s=0;s<this._deps.length;s++)if(this._deps[s].node===e)return s;let t=this._deps.length,r=Xe(e);if(this._deps.push(r),this._sinks==null)return t;r.dirty=!0,this._dirtyDepCount++,this._status!=="dirty"&&this._emit(Te),r.unsub=Ye;try{r.unsub=e.subscribe(s=>{if(r.unsub===null)return;let i=this._config.tierOf,a=!1;for(let o of s)i(o[0])>=3&&(a=!0),this._config.onMessage(this,o,{direction:"down-in",depIndex:t},this._actions);a&&this._maybeRunFnOnSettlement()})}catch(s){throw r.unsub=null,this._deps.pop(),this._dirtyDepCount--,s}return t}_deactivate(e=!1){let t=this._cleanup;if(this._cleanup=void 0,typeof t=="function")try{t()}catch(r){this._emit([[w,this._wrapFnError("cleanup threw",r)]])}else if(t!=null&&typeof t=="object"){let r=t.deactivate;if(typeof r=="function")try{r()}catch(s){this._emit([[w,this._wrapFnError("cleanup.deactivate threw",s)]])}}for(let r of this._deps){if(r.unsub!=null){let s=r.unsub;r.unsub=null;try{s()}catch{}}Ae(r)}this._waveHasNewData=!1,this._hasNewTerminal=!1,this._hasCalledFnOnce=!1,this._paused=!1,this._pendingWave=!1,this._pendingRerun=!1,this._rerunDepth=0,this._store={},this._dirtyDepCount=0,this._pauseLocks=null,this._pauseBuffer=null,this._fn!=null&&(this._cached=void 0),e||(this._fn!=null||this._deps.length>0)&&(!this._isTerminal||this._resubscribable)&&(this._status="sentinel")}_onDepMessage(e,t){let r=this._deps[e],s=t[0];if(this._inspectorHooks!=null){let i={kind:"dep_message",depIndex:e,message:t};for(let a of this._inspectorHooks)a(i)}if(s!==K){if(s===F){this._depDirtied(r);return}if(s===U){if(this._depInvalidated(r),this._cached===void 0)return;this._emit(Le);return}if(s===$||s===te){this._emit([t]);return}if(s===z){this._emit(ve);return}if(s===N)this._depSettledAsData(r,t[1]);else if(s===I)this._depSettledAsResolved(r);else if(s===M)this._depSettledAsTerminal(r,!0);else if(s===w)this._depSettledAsTerminal(r,t[1]);else{this._emit([t]);return}if(!this._fn){(s===N||s===I)&&this._emit([t]),(s===M||s===w)&&this._maybeAutoTerminalAfterWave();return}}}_depDirtied(e){e.dirty||(e.dirty=!0,e.involvedThisWave=!0,this._dirtyDepCount++,this._status!=="dirty"&&this._emit(Te))}_depSettledAsData(e,t){e.dirty&&(e.dirty=!1,this._dirtyDepCount--),e.involvedThisWave=!0,e.dataBatch.push(t),this._waveHasNewData=!0}_depSettledAsResolved(e){e.dirty&&(e.dirty=!1,this._dirtyDepCount--)}_depSettledAsTerminal(e,t){e.dirty&&(e.dirty=!1,this._dirtyDepCount--),e.terminal=t,e.involvedThisWave=!0,this._hasNewTerminal=!0}_depInvalidated(e){e.prevData=void 0,e.terminal=void 0,e.dataBatch.length=0,e.dirty?e.involvedThisWave=!1:(e.dirty=!0,e.involvedThisWave=!0,this._dirtyDepCount++)}_maybeRunFnOnSettlement(){if(!(this._isTerminal&&!this._resubscribable)&&!(this._dirtyDepCount>0)){if(!this._partial&&!this._hasCalledFnOnce)for(let e=0;e<this._deps.length;e++){let t=this._deps[e];if(t.dataBatch.length===0&&t.prevData===void 0&&t.terminal===void 0){this._maybeAutoTerminalAfterWave();return}}if(this._paused){this._pendingWave=!0;return}if(!this._waveHasNewData&&!this._hasNewTerminal&&this._hasCalledFnOnce){this._clearWaveFlags(),this._emit(De),this._maybeAutoTerminalAfterWave();return}this._fn&&this._execFn(),this._maybeAutoTerminalAfterWave()}}_maybeAutoTerminalAfterWave(){if(this._deps.length===0||this._isTerminal)return;let e=this._deps.find(t=>t.terminal!==void 0&&t.terminal!==!0);if(e!=null){this._autoError&&this._emit([[w,e.terminal]]);return}this._autoComplete&&this._deps.every(t=>t.terminal!==void 0)&&this._emit(Fe)}_execFn(){if(!this._fn||this._isTerminal&&!this._resubscribable)return;if(this._isExecutingFn){this._pendingRerun=!0;return}let e=this._cleanup;if(typeof e=="function"){this._cleanup=void 0;try{e()}catch(a){this._emit([[w,this._wrapFnError("cleanup threw",a)]]);return}}else if(e!=null&&typeof e=="object"){let a=e.beforeRun;if(typeof a=="function"){e.beforeRun=void 0;try{a()}catch(o){this._emit([[w,this._wrapFnError("cleanup.beforeRun threw",o)]]);return}}}let t=this._deps.map(a=>a.involvedThisWave?a.dataBatch.length>0?[...a.dataBatch]:[]:void 0),r=this._deps.map(a=>a.prevData);for(let a=0;a<this._deps.length;a++){let o=t[a];o!=null&&o.length>0&&(this._deps[a].prevData=o[o.length-1])}let s=this._deps.map(a=>a.terminal),i={prevData:r,terminalDeps:s,store:this._store};if(this._hasCalledFnOnce=!0,this._clearWaveFlags(),this._inspectorHooks!=null){let a={kind:"run",batchData:t,prevData:r};for(let o of this._inspectorHooks)o(a)}this._isExecutingFn=!0;try{let a=this._fn(t,this._actions,i);if(typeof a=="function")this._cleanup=a;else if(a!=null&&typeof a=="object"){let o=a;(typeof o.beforeRun=="function"||typeof o.deactivate=="function"||typeof o.invalidate=="function")&&(this._cleanup=a)}}catch(a){this._emit([[w,this._wrapFnError("fn threw",a)]])}finally{this._isExecutingFn=!1,this._pendingRerun?(this._pendingRerun=!1,this._rerunDepth+=1,this._rerunDepth>Je?(this._rerunDepth=0,this._emit([[w,new Error(`Node "${this.name}": _pendingRerun depth exceeded ${Je} \u2014 likely a reactive cycle`)]])):this._maybeRunFnOnSettlement()):this._rerunDepth=0,this._clearWaveFlags()}}_clearWaveFlags(){this._waveHasNewData=!1,this._hasNewTerminal=!1;for(let e of this._deps)e.involvedThisWave=!1,e.dataBatch.length=0}_wrapFnError(e,t){let r=t instanceof Error?t.message:String(t);return new Error(`Node "${this.name}": ${e}: ${r}`,{cause:t})}_frameBatch(e){let t=this._config.tierOf;if(e.length===1)return t(e[0][0])===3&&this._status!=="dirty"?[Y,e[0]]:e;let r=!0,s=!1,i=!1,a=-1;for(let d of e){let l=t(d[0]);l<a&&(r=!1),l===3&&(s=!0),d[0]===F&&(i=!0),a=l}let o=e;if(!r){let d=e.map((l,p)=>({m:l,i:p,tier:t(l[0])}));d.sort((l,p)=>l.tier-p.tier||l.i-p.i),o=d.map(l=>l.m)}if(s&&!i&&this._status!=="dirty"){let d=0;for(;d<o.length&&t(o[d][0])===0;)d++;return d===0?[Y,...o]:[...o.slice(0,d),Y,...o.slice(d)]}return o}_emit(e){if(e.length===0)return;for(let o=0;o<e.length;o++){let d=e[o];if(d[0]===w&&d[1]===void 0)throw new TypeError('[ERROR, payload] requires a non-undefined payload (spec \xA71.2). Pass an Error object or domain tag instead \u2014 e.g. node.down([[ERROR, new Error("reason")]])')}let t=e;if(this._isTerminal&&!this._resubscribable){let o=e.filter(d=>d[0]===z||d[0]===U);if(o.length===0)return;t=o}t=this._frameBatch(t);let s=null;for(let o=0;o<t.length;o++){let d=t[o],l=d[0];if(l!==$&&l!==te){s?.push(d);continue}if(d.length<2)throw new Error(`Node "${this.name}": [[${l===$?"PAUSE":"RESUME"}]] must carry a lockId payload \u2014 bare PAUSE/RESUME is a protocol violation (C0 rule). Use \`[[PAUSE, lockId]]\` / \`[[RESUME, lockId]]\`.`);let p=!0;if(this._pausable!==!1){let y=d[1];if(l===$)this._pauseLocks==null&&(this._pauseLocks=new Set),this._pauseLocks.add(y),this._paused=!0,this._pausable==="resumeAll"&&this._pauseBuffer==null&&(this._pauseBuffer=[]);else if(this._pauseLocks==null||!this._pauseLocks.has(y))p=!1;else if(this._pauseLocks.delete(y),this._pauseLocks.size===0){if(this._paused=!1,this._pauseBuffer!=null&&this._pauseBuffer.length>0){let b=this._pauseBuffer;this._pauseBuffer=[],this._emit(b)}this._pendingWave&&(this._pendingWave=!1,this._maybeRunFnOnSettlement())}}p?s?.push(d):s==null&&(s=t.slice(0,o))}if(s!=null){if(s.length===0)return;t=s}if(this._hasMeta&&t.some(o=>o[0]===z))for(let o of Object.keys(this.meta))try{this.meta[o]._emit(ve)}catch{}let{finalMessages:i,equalsError:a}=this._updateState(t);if(i.length>0&&this._config.inspectorEnabled){let o=this._config.globalInspector;if(o!=null)try{o({kind:"emit",node:this,messages:i})}catch{}}if(i.length>0)if(this._paused&&this._pausable==="resumeAll"&&this._pauseBuffer!=null){let o=this._config.tierOf,d=[];for(let l of i)o(l[0])===3?this._pauseBuffer.push(l):d.push(l);d.length>0&&this._dispatchOrAccumulate(d)}else this._dispatchOrAccumulate(i);a!=null&&this._emit([[w,a]])}_updateState(e){let t=this._config.tierOf,r,s,i=-1,a=0;for(let p of e)t(p[0])===3&&a++;let o=a<=1,d=-1;if(this._versioning!=null&&a>1){for(let p=e.length-1;p>=0;p--)if(e[p][0]===N){d=p;break}}for(let p=0;p<e.length;p++){let y=e[p],b=y[0];if(b===N){if(y.length>=2){let _=!1;if(o&&this._cached!==void 0)try{_=this._equals(this._cached,y[1])}catch(k){s=this._wrapFnError("equals threw",k),i=p;break}if(_){r==null&&(r=e.slice(0,p)),r.push(_e),this._status="resolved";continue}this._cached=y[1],this._versioning!=null&&(d<0||p===d)&&qe(this._versioning,y[1],this._hashFn)}this._status="settled",r?.push(y)}else if(r?.push(y),b===F)this._status="dirty";else if(b===I)this._status="resolved";else if(b===M){this._status="completed";{let _=this._config.rigorRecorder;if(_!=null)try{_.onTerminalTransition(this,"completed",this._autoComplete,this._autoError,this._deps.length>0)}catch{}}}else if(b===w){this._status="errored";{let _=this._config.rigorRecorder;if(_!=null)try{_.onTerminalTransition(this,"errored",this._autoComplete,this._autoError,this._deps.length>0)}catch{}}}else if(b===U){if(this._cached!==void 0){let k=this._config.rigorRecorder;if(k!=null)try{k.onNonVacuousInvalidate(this,this._cached)}catch{}}this._cached=void 0,this._status="dirty";let _=this._cleanup;if(typeof _=="function"){this._cleanup=void 0;try{_()}catch{}}else if(_!=null&&typeof _=="object"){let k=_.invalidate;if(typeof k=="function")try{k()}catch{}}}else b===z&&(this._resetOnTeardown&&(this._cached=void 0),this._deactivate(!0),this._status="sentinel")}let l=i>=0?r??e.slice(0,i):r??e;return s!=null?{finalMessages:l,equalsError:s}:{finalMessages:l}}_deliverToSinks=e=>{if(this._sinks==null)return;if(typeof this._sinks=="function"){this._sinks(e);return}let t=[...this._sinks];for(let r of t)r(e)};_dispatchOrAccumulate(e){if(Ie()){this._batchPendingMessages===null&&(this._batchPendingMessages=[],Ve(()=>this._flushBatchPending()));for(let t of e)this._batchPendingMessages.push(t);return}ce(this._deliverToSinks,e,this._config.tierOf)}_flushBatchPending(){let e=this._batchPendingMessages;if(e===null||(this._batchPendingMessages=null,e.length===0))return;let t=this._frameBatch(e);ce(this._deliverToSinks,t,this._config.tierOf)}},Qe=n=>Array.isArray(n),Se=n=>typeof n=="object"&&n!=null&&!Array.isArray(n)});function se(n,e){return Z([],{...e,initial:n})}function oe(n,e){return Z((r,s,i)=>n(s,i)??void 0,{describeKind:"producer",...e})}function ie(n,e,t){return Z(n,(s,i,a)=>{let o=s.map((d,l)=>d!=null&&d.length>0?d.at(-1):a.prevData[l]);i.emit(e(o,a))},{describeKind:"derived",...t})}var ge=L(()=>{"use strict";Me()});function me(n){return{describeKind:"producer",...n}}function Ze(n,e){let{signal:t,period:r,...s}=e??{};return oe(i=>{let a=!1,o=0,d,l,p=()=>{a=!0,d!==void 0&&clearTimeout(d),l!==void 0&&clearInterval(l),t?.removeEventListener("abort",b)},y=()=>{a||(r!=null?(i.emit(o++),l=setInterval(()=>{a||i.emit(o++)},r)):(a=!0,t?.removeEventListener("abort",b),i.emit(o++),i.down([[M]])))},b=()=>{a||(p(),i.down([[w,t.reason]]))};if(t?.aborted){b();return}return d=setTimeout(y,n),t?.addEventListener("abort",b,{once:!0}),p},me(s))}function et(n,e){return oe(t=>{let r=!1;try{for(let s of n){if(r)return;t.emit(s)}r||t.down([[M]])}catch(s){r||t.down([[w,s]])}return()=>{r=!0}},me(e))}function Ct(n){return n!=null&&typeof n.then=="function"}function Ot(n,e){let{signal:t,...r}=e??{};return oe(s=>{let i=!1,a=()=>{i||(i=!0,s.down([[w,t.reason]]))};if(t?.aborted){a();return}return t?.addEventListener("abort",a,{once:!0}),Promise.resolve(n).then(o=>{i||(i=!0,t?.removeEventListener("abort",a),s.emit(o),s.down([[M]]))},o=>{i||(i=!0,t?.removeEventListener("abort",a),s.down([[w,o]]))}),()=>{i=!0,t?.removeEventListener("abort",a)}},me(r))}function Dt(n,e){let{signal:t,...r}=e??{};return oe(s=>{let i=new AbortController,a=()=>i.abort(t?.reason);t?.aborted?i.abort(t.reason):t?.addEventListener("abort",a,{once:!0});let o=t??i.signal,d=!1,l=n[Symbol.asyncIterator](),p=()=>{d||o.aborted||Promise.resolve(l.next()).then(y=>{if(!(d||o.aborted)){if(y.done){s.down([[M]]);return}s.emit(y.value),p()}},y=>{!d&&!o.aborted&&s.down([[w,y]])})};return p(),()=>{d=!0,t?.removeEventListener("abort",a),i.abort(),Promise.resolve(l.return?.()).catch(()=>{})}},me(r))}function Lt(n){return n!=null&&typeof n=="object"&&"cache"in n&&typeof n.subscribe=="function"}function tt(n,e){if(Lt(n))return n;if(Ct(n))return Ot(n,e);if(n!=null){let t=n;if(typeof t[Symbol.asyncIterator]=="function")return Dt(n,e);if(typeof t[Symbol.iterator]=="function")return et(n,e)}return Ft(n)}function Ft(...n){return et(n,void 0)}var nt=L(()=>{"use strict";W();ge()});var rt=L(()=>{"use strict";nt()});var Bt={};gt(Bt,{processInstanceKeyOf:()=>zt,processManager:()=>Ht});module.exports=yt(Bt);ue();W();ue();xe();W();ge();we();W();Me();ge();var Ce=class{_version=0;_maxSize;_buf;_head=0;_size=0;constructor(e,t){if(t!==void 0&&t<1)throw new RangeError("maxSize must be >= 1");if(this._maxSize=t,t!==void 0){if(this._buf=new Array(t),e&&e.length>0){let r=Math.min(e.length,t),s=e.length-r;for(let i=0;i<r;i++)this._buf[i]=e[s+i];this._size=r}}else this._buf=e?[...e]:[],this._size=this._buf.length}get version(){return this._version}get size(){return this._size}at(e){if(!Number.isInteger(e))return;let t=e>=0?e:this._size+e;if(!(t<0||t>=this._size))return this._maxSize!==void 0?this._buf[(this._head+t)%this._maxSize]:this._buf[t]}append(e){this._rawAppend(e),this._version+=1}appendMany(e){if(e.length===0)return;let t=this._maxSize!==void 0&&e.length>this._maxSize?e.length-this._maxSize:0;for(let r=t;r<e.length;r++)this._rawAppend(e[r]);this._version+=1}clear(){if(this._size===0)return 0;let e=this._size;if(this._maxSize===void 0)this._buf.length=0;else for(let t=0;t<e;t++)this._buf[(this._head+t)%this._maxSize]=void 0;return this._head=0,this._size=0,this._version+=1,e}trimHead(e){if(!Number.isInteger(e)||e<0)throw new RangeError(`trimHead: n must be a non-negative integer (got ${e})`);if(e===0||this._size===0)return 0;let t=Math.min(e,this._size);if(this._maxSize===void 0)this._buf.splice(0,t);else{for(let r=0;r<t;r++)this._buf[(this._head+r)%this._maxSize]=void 0;this._head=(this._head+t)%this._maxSize}return this._size-=t,this._version+=1,t}slice(e,t){if(!Number.isInteger(e)||e<0)throw new RangeError(`slice: start must be a non-negative integer (got ${e})`);if(t!==void 0&&(!Number.isInteger(t)||t<0))throw new RangeError(`slice: stop must be a non-negative integer or undefined (got ${t})`);let r=t===void 0?this._size:Math.min(Math.max(t,0),this._size),s=Math.min(e,this._size);if(s>=r)return[];let i=r-s;if(this._maxSize===void 0)return this._buf.slice(s,r);let a=new Array(i);for(let o=0;o<i;o++)a[o]=this._buf[(this._head+s+o)%this._maxSize];return a}tail(e){if(!Number.isInteger(e)||e<0)throw new RangeError(`tail: n must be a non-negative integer (got ${e})`);if(e===0||this._size===0)return[];let t=Math.min(e,this._size);return this.slice(this._size-t,this._size)}toArray(){if(this._maxSize===void 0)return[...this._buf];let e=new Array(this._size);for(let t=0;t<this._size;t++)e[t]=this._buf[(this._head+t)%this._maxSize];return e}snapshot(){return this.toArray()}restore(e){if(this._maxSize===void 0){this._buf.length=0;for(let t=0;t<e.length;t++)this._buf.push(e[t]);this._size=this._buf.length}else{let t=this._maxSize;for(let i=0;i<t;i++)this._buf[i]=void 0;this._head=0;let r=Math.min(e.length,t),s=e.length-r;for(let i=0;i<r;i++)this._buf[i]=e[s+i];this._size=r}this._version+=1}_rawAppend(e){if(this._maxSize===void 0){this._buf.push(e),this._size=this._buf.length;return}this._size<this._maxSize?(this._buf[(this._head+this._size)%this._maxSize]=e,this._size+=1):(this._buf[this._head]=e,this._head=(this._head+1)%this._maxSize)}};function ae(n){return n.subscribe(()=>{})}var Pt=64;function st(n,e={}){let{name:t,maxSize:r,versioning:s,guard:i,backend:a}=e,o=a??new Ce(n,r),d=se(o.toArray(),{name:t,describeKind:"state",equals:(c,g)=>c===g,...s!=null?{versioning:s}:{},...i!=null?{guard:i}:{}});function l(){let c=o.toArray();ze(()=>{d.down([[F]],{internal:!0}),d.down([[N,c]],{internal:!0})})}let p=new Map,y=new Map,b=new Map;function _(c,g){return`${c}:${g===void 0?"END":g}`}function k(c){if(c.size<Pt)return;let g=c.keys().next();if(g.done)return;let u=c.get(g.value);u!==void 0&&u.dispose(),c.delete(g.value)}function E(c){let g=o.version;try{return c()}finally{o.version!==g&&l()}}function C(c){if(!Number.isInteger(c)||c<0)throw new RangeError(`tail: n must be a non-negative integer (got ${c})`);let g=p.get(c);if(g!==void 0)return p.delete(c),p.set(c,g),g.node;k(p);let u=ie([d],([h])=>{let m=h;return c===0||m.length===0?[]:m.slice(Math.max(0,m.length-c))},{initial:o.tail(c),describeKind:"derived"}),f=ae(u);return p.set(c,{node:u,dispose:f}),u}function S(c,g){if(!Number.isInteger(c)||c<0)throw new RangeError(`slice: start must be a non-negative integer (got ${c})`);if(g!==void 0&&(!Number.isInteger(g)||g<0))throw new RangeError(`slice: stop must be a non-negative integer or undefined (got ${g})`);let u=_(c,g),f=y.get(u);if(f!==void 0)return y.delete(u),y.set(u,f),f.node;k(y);let h=ie([d],([T])=>{let v=T;return g===void 0?v.slice(c):v.slice(c,g)},{initial:o.slice(c,g),describeKind:"derived"}),m=ae(h);return y.set(u,{node:h,dispose:m}),h}function O(c){let g=b.get(c);if(g!==void 0)return g.node;let u=ie([d,c],([h,m])=>{let T=h,v=Math.max(0,Math.trunc(m??0));return T.slice(v)},{initial:[],describeKind:"derived"}),f=ae(u);return b.set(c,{node:u,dispose:f}),u}let x,D;function P(){x===void 0&&(x=Z([d],(c,g,u)=>{let f=c[0],m=f!=null&&f.length>0?f.at(-1):u.prevData[0];if(m==null||m.length===0){g.down([[I]]);return}g.emit(m[m.length-1])},{name:t!=null?`${t}::lastValue`:"lastValue",describeKind:"derived",initial:o.size===0?void 0:o.at(o.size-1)}),D=ie([d],([c])=>c.length>0,{name:t!=null?`${t}::hasLatest`:"hasLatest",describeKind:"derived",initial:o.size>0}),ae(x),ae(D))}let V={entries:d,get size(){return o.size},at(c){return o.at(c)},append(c){E(()=>o.append(c))},appendMany(c){c.length!==0&&E(()=>o.appendMany(c))},clear(){E(()=>o.clear())},trimHead(c){E(()=>o.trimHead(c))},withLatest(){return P(),d},get lastValue(){return P(),x},get hasLatest(){return P(),D},view(c){switch(c.kind){case"tail":return C(c.n);case"slice":return S(c.start,c.stop);case"fromCursor":return O(c.cursor)}},attach(c){let g=c.subscribe(u=>{for(let f of u)f[0]===N&&V.append(f[1])});return()=>g()},attachStorage(c){if(c.length===0)return()=>{};let g=new Map;for(let f of c)g.set(f,o.size);(async()=>{for(let f of c)if(typeof f.loadEntries=="function")try{let h=await Promise.resolve(f.loadEntries());h.entries.length>0&&o.size===0&&(o.restore(h.entries),g.set(f,h.entries.length),l());break}catch{}})();let u=d.subscribe(f=>{for(let h of f){if(h[0]!==N)continue;let m=h[1];for(let T of c){let v=g.get(T)??0;if(m.length<v){try{let A=T.appendEntries(m);A instanceof Promise&&A.catch(()=>{})}catch{}g.set(T,m.length);continue}if(m.length===v)continue;let R=m.slice(v);g.set(T,m.length);try{let A=T.appendEntries(R);A instanceof Promise&&A.catch(()=>{})}catch{}}}});return()=>u()},disposeAllViews(){for(let c of p.values())c.dispose();p.clear();for(let c of y.values())c.dispose();y.clear();for(let c of b.values())c.dispose();b.clear()},dispose(){for(let c of p.values())c.dispose();p.clear();for(let c of y.values())c.dispose();y.clear();for(let c of b.values())c.dispose();b.clear()}};return V}var It=He((n,e)=>{n("observe"),n("signal"),e("write")});function at(n){let e=st([],{name:n.name,maxSize:n.retainedLimit??1024,guard:n.guard??It,...n.versioning!=null?{versioning:n.versioning}:{}});return e.withLatest(),n.graph&&n.graph.add(e.entries,{name:n.name}),e}function dt(n){if(n===null||typeof n!="object"||Object.isFrozen(n))return n;for(let e of Object.keys(n))dt(n[e]);return Object.freeze(n)}var ot=new WeakSet;function Vt(n){let e=n.cache,t=typeof e=="number"&&Number.isFinite(e);!t&&e!==void 0&&!ot.has(n)&&(ot.add(n),console.warn(`bumpCursor: cursor cache held a non-numeric value (${String(e)}); resetting to 0. Causes include: a snapshot codec round-tripping the cursor as a string / null / NaN, OR a malformed initial seed (e.g. state<number>(NaN)). Audit consumers may see colliding seq values after this point.`));let s=(t?e:0)+1;return n.down([[F],[N,s]]),s}function it(n,e,t,r,s,i){let a=e(t,r,s);if(a===void 0)return;let o=i!=null?{...a,handlerVersion:i}:a;n.append(o)}function ut(n,e){let t=e.freeze??!0;return function(...s){let i=t?s.map(dt):s,a=B(),o=e.seq?Vt(e.seq):void 0;try{let d=n(...i);return e.audit&&e.onSuccess&&it(e.audit,e.onSuccess,i,d,{t_ns:a,seq:o},e.handlerVersion),d}catch(d){if(e.audit&&e.onFailure){let l=d instanceof Error?d.name:typeof d;it(e.audit,e.onFailure,i,d,{t_ns:a,seq:o,errorType:l},e.handlerVersion)}throw d}}}function ct(n,e,t=0){let r=se(t,{name:e,describeKind:"state"});return n.add(r,{name:e}),r}rt();var zt=n=>n.correlationId;function lt(n){if(n==null)return Promise.resolve(void 0);let e=tt(n);return new Promise((t,r)=>{let s=!1,i,a=()=>{i&&i()};i=e.subscribe(o=>{if(!s)for(let d of o){if(d[0]===N){s=!0,Promise.resolve().then(a),t(d[1]);return}if(d[0]===w){s=!0,Promise.resolve().then(a),r(d[1]);return}if(d[0]===M){s=!0,Promise.resolve().then(a),t(void 0);return}}})})}async function Gt(n,e,t,r,s){let i;for(let a=0;a<=r;a++){if(a>0){let o=s[Math.min(a-1,s.length-1)]??0;o>0&&await new Promise(d=>setTimeout(d,o))}try{return await lt(n(e,t))}catch(o){i=o}}return{outcome:"failure",error:i}}function Ht(n,e,t){let r=t.retryMax??0,s=t.backoffMs??[0],i=1024,a=new Map,o=new Set,d=new Map,l=`${e}_process_instances`,p=`${e}_process_seq`;if(n.tryResolve(l)!==void 0||n.tryResolve(p)!==void 0)throw new Error(`processManager: name "${e}" is already in use on this CQRS graph (collides on "${l}" / "${p}"). Pick a different name or destroy the previous CQRS graph before re-creating the manager.`);let y=at({name:l,retainedLimit:i,graph:n}),b=ct(n,p,0),_=ut(()=>{},{audit:y,seq:b,freeze:!0,...t.handlerVersion!==void 0?{handlerVersion:t.handlerVersion}:{},onSuccess:([u,f,h,m],T,{t_ns:v,seq:R})=>({correlationId:u,state:f,status:h,startedAt:d.get(u)??v,updatedAt:v,t_ns:v,seq:R??0,...m!==void 0?{reason:m}:{}})}),k=`_process_${e}_started`;n.event(k),t.persistence?.eventStorage&&n.attachEventStorage(t.persistence.eventStorage);async function E(u,f,h,m){if(o.delete(u),a.delete(u),d.delete(u),t.compensate)try{await lt(t.compensate(f,h)),_(u,f,"compensated",m)}catch{_(u,f,"errored",void 0)}else _(u,f,"errored",void 0)}async function C(u,f){if(o.has(u)){if(f.outcome==="failure"){let h=a.get(u)??t.initial;await E(u,h,f.error);return}if(f.outcome==="success"){if(a.set(u,f.state),f.emit)for(let h of f.emit)try{n._appendEvent(h.type,h.payload,{correlationId:u,aggregateId:u})}catch{}if(_(u,f.state,"running",void 0),t.isTerminal?.(f.state)){o.delete(u),a.delete(u),d.delete(u),_(u,f.state,"terminated",void 0);return}if(f.schedule){let{afterMs:h,eventType:m}=f.schedule,T,v=Ze(h),R=A=>{for(let G of A)if(G[0]===N){if(T?T():queueMicrotask(()=>T?.()),!o.has(u))return;let ee=a.get(u);if(ee===void 0)return;let H=t.steps[m];if(!H)return;let de={type:m,payload:null,timestampNs:B(),seq:Number.NaN,correlationId:u,aggregateId:u};O(u,H,ee,de)}};T=v.subscribe(R)}return}if(f.outcome==="terminate"){if(a.set(u,f.state),f.emit)for(let h of f.emit)try{n._appendEvent(h.type,h.payload,{correlationId:u,aggregateId:u})}catch{}o.delete(u),a.delete(u),d.delete(u),_(u,f.state,"terminated",void 0)}}}let S=new Map;function O(u,f,h,m){let v=(S.get(u)??Promise.resolve()).then(async()=>{let R=a.get(u);if(R===void 0||!o.has(u))return;let A;try{A=await Gt(f,R,m,r,s)}catch(G){await E(u,a.get(u)??t.initial,G);return}await C(u,A)});S.set(u,v),v.finally(()=>{S.get(u)===v&&S.delete(u)})}let x=!1,D=[];for(let u of t.watching){let f=n.event(u),h=0;h=(f.cache??[]).length;let T=f.subscribe(v=>{for(let R of v){if(R[0]!==N)continue;let A=R[1];if(A.length<=h)continue;let G=A.slice(h);h=A.length;for(let ee of G){let H=ee.correlationId;if(H===void 0||!o.has(H))continue;let de=t.steps[u];if(!de)continue;let Oe=a.get(H);Oe!==void 0&&O(H,de,Oe,ee)}}});D.push(T)}function P(u,f){if(x||o.has(u))return;let h=B();d.set(u,h),a.set(u,t.initial),o.add(u);try{n._appendEvent(k,f??null,{correlationId:u,aggregateId:u})}catch{}_(u,t.initial,"running",void 0)}function V(u,f){if(x||!o.has(u))return;let h=a.get(u)??t.initial;E(u,h,new Error(`cancelled: ${f??"no reason given"}`),f)}function c(u){return a.get(u)}function g(){if(!x){x=!0;for(let u of D)try{u()}catch{}D.length=0}}return{instances:y,audit:y,start:P,cancel:V,getState:c,dispose:g}}0&&(module.exports={processInstanceKeyOf,processManager});
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import '../../index-
|
|
2
|
-
import '../../reactive-log-
|
|
1
|
+
import '../../index-C9pjcz3l.cjs';
|
|
2
|
+
import '../../reactive-log-B00laMSQ.cjs';
|
|
3
3
|
import '../../extra/sources.cjs';
|
|
4
4
|
import '../../extra/storage-tiers.cjs';
|
|
5
|
-
import '../../index-
|
|
6
|
-
export { P as ProcessCompensate, a as ProcessInstance, b as ProcessManagerOpts, c as ProcessManagerResult, d as ProcessSchedule, e as ProcessStep, f as ProcessStepResult, p as processInstanceKeyOf, g as processManager } from '../../index-
|
|
7
|
-
import '../../node-
|
|
8
|
-
import '../../graph-
|
|
9
|
-
import '../../meta-
|
|
5
|
+
import '../../index-COD1kVoS.cjs';
|
|
6
|
+
export { P as ProcessCompensate, a as ProcessInstance, b as ProcessManagerOpts, c as ProcessManagerResult, d as ProcessSchedule, e as ProcessStep, f as ProcessStepResult, p as processInstanceKeyOf, g as processManager } from '../../index-BojK2fwH.cjs';
|
|
7
|
+
import '../../node-ClS5yC-B.cjs';
|
|
8
|
+
import '../../graph-C4SHb3Ly.cjs';
|
|
9
|
+
import '../../meta-vE8bxW1E.cjs';
|
|
10
10
|
import '../../extra/storage-core.cjs';
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import '../../index-
|
|
2
|
-
import '../../reactive-log-
|
|
1
|
+
import '../../index-CZQXo5tH.js';
|
|
2
|
+
import '../../reactive-log-BezYsbA_.js';
|
|
3
3
|
import '../../extra/sources.js';
|
|
4
4
|
import '../../extra/storage-tiers.js';
|
|
5
|
-
import '../../index-
|
|
6
|
-
export { P as ProcessCompensate, a as ProcessInstance, b as ProcessManagerOpts, c as ProcessManagerResult, d as ProcessSchedule, e as ProcessStep, f as ProcessStepResult, p as processInstanceKeyOf, g as processManager } from '../../index-
|
|
7
|
-
import '../../node-
|
|
8
|
-
import '../../graph-
|
|
9
|
-
import '../../meta-
|
|
5
|
+
import '../../index-CQG3D1cp.js';
|
|
6
|
+
export { P as ProcessCompensate, a as ProcessInstance, b as ProcessManagerOpts, c as ProcessManagerResult, d as ProcessSchedule, e as ProcessStep, f as ProcessStepResult, p as processInstanceKeyOf, g as processManager } from '../../index-Dh_HJ82K.js';
|
|
7
|
+
import '../../node-ClS5yC-B.js';
|
|
8
|
+
import '../../graph-7VguS7a4.js';
|
|
9
|
+
import '../../meta-BgVAsg9j.js';
|
|
10
10
|
import '../../extra/storage-core.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a,b}from"../../chunk-
|
|
1
|
+
import{a,b}from"../../chunk-INQD2KRQ.js";import"../../chunk-FDQGFWLF.js";import"../../chunk-626TESAC.js";import"../../chunk-ESMPEKEV.js";import"../../chunk-35JTVPOX.js";import"../../chunk-JQFH2DV6.js";import"../../chunk-V5A7M7RJ.js";import"../../chunk-LYCLF26R.js";import"../../chunk-CK2E7BTU.js";import"../../chunk-QYADASLV.js";export{a as processInstanceKeyOf,b as processManager};
|