@graphrefly/graphrefly 0.40.0 → 0.42.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-CKFQS2CJ.js → chunk-2K5RXLAH.js} +1 -1
- package/dist/chunk-3ERTUW2J.js +45 -0
- package/dist/chunk-3K7HA4Y6.js +1 -0
- package/dist/chunk-3ZZX7M25.js +1 -0
- package/dist/chunk-4QH6VJF4.js +1 -0
- package/dist/{chunk-I2DEVPMU.js → chunk-5QRRKBUT.js} +1 -1
- package/dist/chunk-5ST42ESJ.js +1 -0
- package/dist/{chunk-FHRBBHJN.js → chunk-6YFZMUMR.js} +1 -1
- package/dist/{chunk-MNZIKXK4.js → chunk-7ARY3Y3T.js} +1 -1
- package/dist/chunk-7B7ELAT2.js +1 -0
- package/dist/{chunk-Z4F3DOWS.js → chunk-7VKFXLZQ.js} +1 -1
- package/dist/chunk-ACMJ2ZPS.js +3 -0
- package/dist/{chunk-32N3JALT.js → chunk-AGNM6RS6.js} +1 -1
- package/dist/chunk-AS3TV2TV.js +1 -0
- package/dist/{chunk-B7LCDQEV.js → chunk-CISGGAIF.js} +1 -1
- package/dist/{chunk-N43XM7BM.js → chunk-DEJTNNQC.js} +1 -1
- package/dist/{chunk-2QXRYP7Q.js → chunk-FDZAZNRO.js} +1 -1
- package/dist/{chunk-QSK3RRII.js → chunk-FUZ6S2DY.js} +1 -1
- package/dist/{chunk-LYM4PBMV.js → chunk-G5VBJ5K6.js} +1 -1
- package/dist/{chunk-6I726LZU.js → chunk-HZKW2AAB.js} +1 -1
- package/dist/{chunk-LCGAVGGV.js → chunk-IZM3UEH3.js} +3 -3
- package/dist/{chunk-2DMKW2AD.js → chunk-KCACBSJH.js} +1 -1
- package/dist/{chunk-SSCGRYJ2.js → chunk-KT5DTRBP.js} +1 -1
- package/dist/{chunk-WL6LFPJB.js → chunk-KY2LMAXU.js} +1 -1
- package/dist/{chunk-YXDRGKXP.js → chunk-LDQ3IUIP.js} +1 -1
- package/dist/chunk-LPRWATHB.js +61 -0
- package/dist/{chunk-6VWBPSSY.js → chunk-NWXQIOIB.js} +3 -3
- package/dist/{chunk-XW4YDF6G.js → chunk-Q7QQQA3I.js} +1 -1
- package/dist/chunk-VE5SIZEM.js +1 -0
- package/dist/chunk-VRALOYRD.js +1 -0
- package/dist/{chunk-XJLYLLIJ.js → chunk-WHMUB5QB.js} +1 -1
- package/dist/chunk-XLQPNNIC.js +1 -0
- package/dist/{chunk-JKBOIJ22.js → chunk-YGL7FPVQ.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-DktLSZOc.d.cts → index-2B7u2pVn.d.cts} +4 -4
- package/dist/{index-BTHOTC0Q.d.cts → index-3NmAfcH0.d.cts} +25 -7
- package/dist/{index-D1IEZUsj.d.ts → index-4Uz-e_fL.d.ts} +573 -213
- package/dist/{index-BAQrjuZF.d.ts → index-B-i4_g3k.d.ts} +2 -2
- package/dist/{index-DpiGqtrs.d.cts → index-B11anra4.d.cts} +441 -381
- package/dist/{index-WSlcjhQF.d.ts → index-B3OTH1dV.d.ts} +124 -13
- 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-BaA-xpSw.d.ts → index-BUYXac2c.d.ts} +3 -3
- package/dist/{index-DOBLxOti.d.cts → index-BVpm6noz.d.cts} +1 -1
- package/dist/{index-DhnsQfa3.d.ts → index-Bbkgpt5t.d.ts} +441 -381
- 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-BeT2r7sk.d.ts +760 -0
- package/dist/{index-da2V5vPy.d.ts → index-Bf7eqeSF.d.ts} +2 -2
- package/dist/{index-bXXLSvor.d.ts → index-Bn4zHYLj.d.ts} +4 -4
- package/dist/{index-DGTo1yka.d.cts → index-BoLv_OfD.d.cts} +2 -2
- package/dist/{index-B72TQQHd.d.cts → index-BsT7F2et.d.ts} +3 -3
- package/dist/{index-Bd91Nmf4.d.cts → index-BtAsBp8K.d.cts} +4 -4
- package/dist/{index-DgJc8Zgc.d.cts → index-C0-Jv1kP.d.cts} +81 -5
- 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-yLt-aPMp.d.ts → index-CCq87F7t.d.ts} +1 -1
- package/dist/{index-DQQCOIt8.d.cts → index-CEMx8n40.d.cts} +10 -5
- package/dist/{index-BilOa6AE.d.cts → index-CJIuLu2f.d.cts} +124 -13
- package/dist/{index-B2RUoIUz.d.ts → index-CJK1JkYy.d.ts} +1 -1
- package/dist/{index-IUCY0OFN.d.ts → index-CJQm0g38.d.ts} +25 -7
- package/dist/index-CPNSy-U0.d.cts +760 -0
- package/dist/{index-A3U3CSve.d.cts → index-CZjOhcBy.d.cts} +2 -2
- package/dist/{index-CAP3UGsq.d.ts → index-CZmcDtFn.d.ts} +1 -1
- package/dist/{index-DYTBbF8T.d.cts → index-ChOyVLKm.d.cts} +1 -1
- package/dist/{index-eaQuGJnv.d.ts → index-CpyNFqkB.d.ts} +3 -3
- package/dist/{index-BJSZxSFX.d.ts → index-CvrqGfNS.d.ts} +1 -1
- package/dist/{index-DJ_MPOJ5.d.cts → index-D-Xs74HZ.d.cts} +573 -213
- package/dist/{index-C5cQ7Gfx.d.ts → index-D6egPFAL.d.ts} +4 -4
- package/dist/{index-CD2dBMet.d.ts → index-D8l8hNXn.d.ts} +10 -5
- package/dist/{index-40ZT4MHj.d.ts → index-DBHK8O6H.d.ts} +14 -3
- package/dist/{index-DVDapw2k.d.cts → index-DBIqYS43.d.cts} +35 -21
- 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-BQ1fR4li.d.ts → index-DO9XxMzS.d.ts} +35 -21
- package/dist/{index-CQtWm7jS.d.ts → index-DQo8xBgd.d.ts} +9 -9
- package/dist/{index-DH4fm2Ck.d.ts → index-Dgs8zcj7.d.ts} +2 -2
- package/dist/{index-CtFNGe-m.d.cts → index-Dhc7a7Xo.d.cts} +2 -2
- package/dist/{index-MxYuWOrf.d.cts → index-DmAgG5CI.d.cts} +3 -3
- 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-DVAlsmEU.d.cts → index-HoU88d5U.d.cts} +3 -3
- package/dist/{index-CRm0YIzC.d.cts → index-LIpQQE9f.d.cts} +9 -9
- 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-I1cCY3ZI.d.ts → index-pT8sCpOJ.d.ts} +81 -5
- package/dist/{index-D4uimgee.d.cts → index-sl4NyzQx.d.cts} +1 -1
- package/dist/{index-tV3AA9hI.d.cts → index-tJoTcnHh.d.cts} +2 -2
- 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-WBlobVhU.d.cts} +5 -5
- package/dist/{pipeline-graph-CB4La-UW.d.ts → pipeline-graph-v8fMvqNk.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-445VFFXQ.js +1 -0
- package/dist/{sugar-BhfjgetH.d.ts → sugar-CH-2ZY90.d.ts} +1 -1
- package/dist/{sugar-DzePN5-g.d.cts → sugar-DStZfUEK.d.cts} +1 -1
- 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-2BX4NB34.js +0 -3
- package/dist/chunk-6XVD5TZV.js +0 -1
- package/dist/chunk-756D5TFD.js +0 -1
- package/dist/chunk-7Q4ZD3YW.js +0 -1
- package/dist/chunk-ECQRP2UT.js +0 -1
- package/dist/chunk-INQFTVZA.js +0 -61
- package/dist/chunk-J63M5U46.js +0 -1
- package/dist/chunk-K2Z7UENB.js +0 -1
- package/dist/chunk-OSZ22J7O.js +0 -1
- package/dist/chunk-PPUYQ66A.js +0 -1
- package/dist/chunk-RZJDIV2G.js +0 -1
- package/dist/chunk-SGS4OJGS.js +0 -1
- package/dist/chunk-SVFKHUCW.js +0 -1
- package/dist/chunk-UWA6D7UF.js +0 -3
- package/dist/chunk-VMF23LGB.js +0 -1
- package/dist/chunk-WUT362QV.js +0 -1
- package/dist/chunk-YKD7WUYJ.js +0 -43
- 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-S33JV6XC.js +0 -1
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
export { T as ToObservableOptions, t as toObservable } from '../../observable-
|
|
2
|
-
export { A as ACTOR_KEY, a as ActorExtractor, C as COMMAND_HANDLERS, b as CQRS_EVENT_HANDLERS, c as CRON_HANDLERS, d as CommandHandler, e as CommandHandlerMeta, E as EVENT_HANDLERS, f as EventHandler, g as EventHandlerMeta, G as GRAPHREFLY_REQUEST_GRAPH, h as GRAPHREFLY_ROOT_GRAPH, j as GraphCron, k as GraphCronMeta, l as GraphInterval, m as GraphIntervalMeta, n as GraphReflyCqrsOptions, o as GraphReflyEventExplorer, p as GraphReflyFeatureOptions, q as GraphReflyGuard, r as GraphReflyGuardImpl, s as GraphReflyModule, t as GraphReflyRootOptions, I as INTERVAL_HANDLERS, u as InjectCqrsGraph, v as InjectGraph, w as InjectNode, O as ObserveGateway, x as ObserveGatewayOptions, y as ObserveSSEOptions, z as ObserveSubscriptionOptions, B as ObserveWsCommand, D as ObserveWsMessage, F as OnGraphEvent, H as OnGraphEventMeta, Q as QUERY_HANDLERS, J as QueryHandler, K as QueryHandlerMeta, S as SAGA_HANDLERS, L as SagaHandler, M as SagaHandlerMeta, N as fromHeader, P as fromJwtPayload, R as getActor, T as getGraphToken, U as getNodeToken, V as observeSSE, W as observeSubscription } from '../../index-
|
|
1
|
+
export { T as ToObservableOptions, t as toObservable } from '../../observable-DLGPPtb8.cjs';
|
|
2
|
+
export { A as ACTOR_KEY, a as ActorExtractor, C as COMMAND_HANDLERS, b as CQRS_EVENT_HANDLERS, c as CRON_HANDLERS, d as CommandHandler, e as CommandHandlerMeta, E as EVENT_HANDLERS, f as EventHandler, g as EventHandlerMeta, G as GRAPHREFLY_REQUEST_GRAPH, h as GRAPHREFLY_ROOT_GRAPH, j as GraphCron, k as GraphCronMeta, l as GraphInterval, m as GraphIntervalMeta, n as GraphReflyCqrsOptions, o as GraphReflyEventExplorer, p as GraphReflyFeatureOptions, q as GraphReflyGuard, r as GraphReflyGuardImpl, s as GraphReflyModule, t as GraphReflyRootOptions, I as INTERVAL_HANDLERS, u as InjectCqrsGraph, v as InjectGraph, w as InjectNode, O as ObserveGateway, x as ObserveGatewayOptions, y as ObserveSSEOptions, z as ObserveSubscriptionOptions, B as ObserveWsCommand, D as ObserveWsMessage, F as OnGraphEvent, H as OnGraphEventMeta, Q as QUERY_HANDLERS, J as QueryHandler, K as QueryHandlerMeta, S as SAGA_HANDLERS, L as SagaHandler, M as SagaHandlerMeta, N as fromHeader, P as fromJwtPayload, R as getActor, T as getGraphToken, U as getNodeToken, V as observeSSE, W as observeSubscription } from '../../index-BtAsBp8K.cjs';
|
|
3
3
|
import 'rxjs';
|
|
4
|
-
import '../../node-
|
|
4
|
+
import '../../node-ClS5yC-B.cjs';
|
|
5
5
|
import '@nestjs/common';
|
|
6
6
|
import '@nestjs/core';
|
|
7
|
-
import '../../graph-
|
|
8
|
-
import '../../meta-
|
|
7
|
+
import '../../graph-C4SHb3Ly.cjs';
|
|
8
|
+
import '../../meta-vE8bxW1E.cjs';
|
|
9
9
|
import '../../extra/storage-core.cjs';
|
|
10
10
|
import '../../extra/storage-tiers.cjs';
|
|
11
|
-
import '../../index-
|
|
12
|
-
import '../../index-
|
|
13
|
-
import '../../reactive-log-
|
|
11
|
+
import '../../index-CEMx8n40.cjs';
|
|
12
|
+
import '../../index-DBIqYS43.cjs';
|
|
13
|
+
import '../../reactive-log-B00laMSQ.cjs';
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
export { T as ToObservableOptions, t as toObservable } from '../../observable-
|
|
2
|
-
export { A as ACTOR_KEY, a as ActorExtractor, C as COMMAND_HANDLERS, b as CQRS_EVENT_HANDLERS, c as CRON_HANDLERS, d as CommandHandler, e as CommandHandlerMeta, E as EVENT_HANDLERS, f as EventHandler, g as EventHandlerMeta, G as GRAPHREFLY_REQUEST_GRAPH, h as GRAPHREFLY_ROOT_GRAPH, j as GraphCron, k as GraphCronMeta, l as GraphInterval, m as GraphIntervalMeta, n as GraphReflyCqrsOptions, o as GraphReflyEventExplorer, p as GraphReflyFeatureOptions, q as GraphReflyGuard, r as GraphReflyGuardImpl, s as GraphReflyModule, t as GraphReflyRootOptions, I as INTERVAL_HANDLERS, u as InjectCqrsGraph, v as InjectGraph, w as InjectNode, O as ObserveGateway, x as ObserveGatewayOptions, y as ObserveSSEOptions, z as ObserveSubscriptionOptions, B as ObserveWsCommand, D as ObserveWsMessage, F as OnGraphEvent, H as OnGraphEventMeta, Q as QUERY_HANDLERS, J as QueryHandler, K as QueryHandlerMeta, S as SAGA_HANDLERS, L as SagaHandler, M as SagaHandlerMeta, N as fromHeader, P as fromJwtPayload, R as getActor, T as getGraphToken, U as getNodeToken, V as observeSSE, W as observeSubscription } from '../../index-
|
|
1
|
+
export { T as ToObservableOptions, t as toObservable } from '../../observable-BsBzUrcI.js';
|
|
2
|
+
export { A as ACTOR_KEY, a as ActorExtractor, C as COMMAND_HANDLERS, b as CQRS_EVENT_HANDLERS, c as CRON_HANDLERS, d as CommandHandler, e as CommandHandlerMeta, E as EVENT_HANDLERS, f as EventHandler, g as EventHandlerMeta, G as GRAPHREFLY_REQUEST_GRAPH, h as GRAPHREFLY_ROOT_GRAPH, j as GraphCron, k as GraphCronMeta, l as GraphInterval, m as GraphIntervalMeta, n as GraphReflyCqrsOptions, o as GraphReflyEventExplorer, p as GraphReflyFeatureOptions, q as GraphReflyGuard, r as GraphReflyGuardImpl, s as GraphReflyModule, t as GraphReflyRootOptions, I as INTERVAL_HANDLERS, u as InjectCqrsGraph, v as InjectGraph, w as InjectNode, O as ObserveGateway, x as ObserveGatewayOptions, y as ObserveSSEOptions, z as ObserveSubscriptionOptions, B as ObserveWsCommand, D as ObserveWsMessage, F as OnGraphEvent, H as OnGraphEventMeta, Q as QUERY_HANDLERS, J as QueryHandler, K as QueryHandlerMeta, S as SAGA_HANDLERS, L as SagaHandler, M as SagaHandlerMeta, N as fromHeader, P as fromJwtPayload, R as getActor, T as getGraphToken, U as getNodeToken, V as observeSSE, W as observeSubscription } from '../../index-D6egPFAL.js';
|
|
3
3
|
import 'rxjs';
|
|
4
|
-
import '../../node-
|
|
4
|
+
import '../../node-ClS5yC-B.js';
|
|
5
5
|
import '@nestjs/common';
|
|
6
6
|
import '@nestjs/core';
|
|
7
|
-
import '../../graph-
|
|
8
|
-
import '../../meta-
|
|
7
|
+
import '../../graph-7VguS7a4.js';
|
|
8
|
+
import '../../meta-BgVAsg9j.js';
|
|
9
9
|
import '../../extra/storage-core.js';
|
|
10
10
|
import '../../extra/storage-tiers.js';
|
|
11
|
-
import '../../index-
|
|
12
|
-
import '../../index-
|
|
13
|
-
import '../../reactive-log-
|
|
11
|
+
import '../../index-D8l8hNXn.js';
|
|
12
|
+
import '../../index-DO9XxMzS.js';
|
|
13
|
+
import '../../reactive-log-BezYsbA_.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{A as B,B as C,C as D,D as E,E as F,F as G,a as b,b as c,c as d,d as e,e as f,f as g,g as h,h as i,i as j,j as k,k as l,l as m,m as n,n as o,o as p,p as q,q as r,r as s,s as t,t as u,u as v,v as w,w as x,x as y,y as z,z as A}from"../../chunk-
|
|
1
|
+
import{A as B,B as C,C as D,D as E,E as F,F as G,a as b,b as c,c as d,d as e,e as f,f as g,g as h,h as i,i as j,j as k,k as l,l as m,m as n,n as o,o as p,p as q,q as r,r as s,s as t,t as u,u as v,v as w,w as x,x as y,y as z,z as A}from"../../chunk-NWXQIOIB.js";import"../../chunk-VRALOYRD.js";import"../../chunk-4I45FVQS.js";import{a}from"../../chunk-5QDBSZBV.js";import"../../chunk-3ZZX7M25.js";import"../../chunk-L6NSJVJZ.js";import"../../chunk-LDQ3IUIP.js";import"../../chunk-XLQPNNIC.js";import"../../chunk-3G5U5QNE.js";import"../../chunk-C72GO4IZ.js";import"../../chunk-ACMJ2ZPS.js";import"../../chunk-ESMPEKEV.js";import"../../chunk-2K5RXLAH.js";import"../../chunk-35JTVPOX.js";import"../../chunk-LYCLF26R.js";import"../../chunk-CK2E7BTU.js";import"../../chunk-QYADASLV.js";export{A as ACTOR_KEY,i as COMMAND_HANDLERS,j as CQRS_EVENT_HANDLERS,h as CRON_HANDLERS,s as CommandHandler,f as EVENT_HANDLERS,t as EventHandler,c as GRAPHREFLY_REQUEST_GRAPH,b as GRAPHREFLY_ROOT_GRAPH,r as GraphCron,q as GraphInterval,w as GraphReflyEventExplorer,F as GraphReflyGuard,E as GraphReflyGuardImpl,G as GraphReflyModule,g as INTERVAL_HANDLERS,n as InjectCqrsGraph,m as InjectGraph,o as InjectNode,z as ObserveGateway,p as OnGraphEvent,k as QUERY_HANDLERS,u as QueryHandler,l as SAGA_HANDLERS,v as SagaHandler,C as fromHeader,B as fromJwtPayload,D as getActor,d as getGraphToken,e as getNodeToken,x as observeSSE,y as observeSubscription,a as toObservable};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import '../../node-
|
|
2
|
-
export { N as NodeFactory, u as useStore, a as useSubscribe, b as useSubscribeRecord } from '../../index-
|
|
1
|
+
import '../../node-ClS5yC-B.cjs';
|
|
2
|
+
export { N as NodeFactory, u as useStore, a as useSubscribe, b as useSubscribeRecord } from '../../index-z96luz5O.cjs';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import '../../node-
|
|
2
|
-
export { N as NodeFactory, u as useStore, a as useSubscribe, b as useSubscribeRecord } from '../../index-
|
|
1
|
+
import '../../node-ClS5yC-B.js';
|
|
2
|
+
export { N as NodeFactory, u as useStore, a as useSubscribe, b as useSubscribeRecord } from '../../index-BG0BN3PB.js';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import '../../node-
|
|
2
|
-
export { A as Accessor, N as NodeFactory, u as useStore, a as useSubscribe, b as useSubscribeRecord } from '../../index-
|
|
1
|
+
import '../../node-ClS5yC-B.cjs';
|
|
2
|
+
export { A as Accessor, N as NodeFactory, u as useStore, a as useSubscribe, b as useSubscribeRecord } from '../../index-BVpm6noz.cjs';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import '../../node-
|
|
2
|
-
export { A as Accessor, N as NodeFactory, u as useStore, a as useSubscribe, b as useSubscribeRecord } from '../../index-
|
|
1
|
+
import '../../node-ClS5yC-B.js';
|
|
2
|
+
export { A as Accessor, N as NodeFactory, u as useStore, a as useSubscribe, b as useSubscribeRecord } from '../../index-CJK1JkYy.js';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import '../../node-
|
|
2
|
-
export { N as NodeFactory, S as SvelteReadable, a as SvelteWritable, u as useStore, b as useSubscribe, c as useSubscribeRecord } from '../../index-
|
|
1
|
+
import '../../node-ClS5yC-B.cjs';
|
|
2
|
+
export { N as NodeFactory, S as SvelteReadable, a as SvelteWritable, u as useStore, b as useSubscribe, c as useSubscribeRecord } from '../../index-hHcaFlJX.cjs';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import '../../node-
|
|
2
|
-
export { N as NodeFactory, S as SvelteReadable, a as SvelteWritable, u as useStore, b as useSubscribe, c as useSubscribeRecord } from '../../index-
|
|
1
|
+
import '../../node-ClS5yC-B.js';
|
|
2
|
+
export { N as NodeFactory, S as SvelteReadable, a as SvelteWritable, u as useStore, b as useSubscribe, c as useSubscribeRecord } from '../../index-DIOoAZUX.js';
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import 'vue';
|
|
2
|
-
import '../../node-
|
|
3
|
-
export { N as NodeFactory, u as useStore, a as useSubscribe, b as useSubscribeRecord } from '../../index-
|
|
2
|
+
import '../../node-ClS5yC-B.cjs';
|
|
3
|
+
export { N as NodeFactory, u as useStore, a as useSubscribe, b as useSubscribeRecord } from '../../index-BJX94aud.cjs';
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import 'vue';
|
|
2
|
-
import '../../node-
|
|
3
|
-
export { N as NodeFactory, u as useStore, a as useSubscribe, b as useSubscribeRecord } from '../../index-
|
|
2
|
+
import '../../node-ClS5yC-B.js';
|
|
3
|
+
export { N as NodeFactory, u as useStore, a as useSubscribe, b as useSubscribeRecord } from '../../index-CvrqGfNS.js';
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use strict";var He=Object.defineProperty;var Zt=Object.getOwnPropertyDescriptor;var Qt=Object.getOwnPropertyNames;var en=Object.prototype.hasOwnProperty;var j=(r,e)=>()=>(r&&(e=r(r=0)),e);var tn=(r,e)=>{for(var t in e)He(r,t,{get:e[t],enumerable:!0})},nn=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of Qt(e))!en.call(r,s)&&s!==t&&He(r,s,{get:()=>e[s],enumerable:!(n=Zt(e,s))||n.enumerable});return r};var rn=r=>nn(He({},"__esModule",{value:!0}),r);var pe,I,K,Y,W,J,Z,L,H,M,oe,Be,sn,ze,on,an,Ue,gt,mt,bt,We,he=j(()=>{"use strict";pe=Symbol.for("graphrefly/START"),I=Symbol.for("graphrefly/DATA"),K=Symbol.for("graphrefly/DIRTY"),Y=Symbol.for("graphrefly/RESOLVED"),W=Symbol.for("graphrefly/INVALIDATE"),J=Symbol.for("graphrefly/PAUSE"),Z=Symbol.for("graphrefly/RESUME"),L=Symbol.for("graphrefly/TEARDOWN"),H=Symbol.for("graphrefly/COMPLETE"),M=Symbol.for("graphrefly/ERROR"),oe=Object.freeze([K]),Be=Object.freeze([Y]),sn=Object.freeze([W]),ze=Object.freeze([pe]),on=Object.freeze([H]),an=Object.freeze([L]),Ue=Object.freeze([oe]),gt=Object.freeze([Be]),mt=Object.freeze([sn]),bt=Object.freeze([on]),We=Object.freeze([an])});function vt(r,e){let t=new TextEncoder().encode(r.name);if(t.length===0||t.length>255)throw new Error(`encodeEnvelope: codec name "${r.name}" encodes to ${t.length} bytes (must be 1\u2013255)`);let n=r.version;if(!Number.isInteger(n)||n<0||n>65535)throw new Error(`encodeEnvelope: codec.version ${n} out of u16 range (expected integer 0\u201365535)`);let s=2+t.length+2+e.length;if(s>4294967295)throw new Error(`encodeEnvelope: total envelope size ${s} exceeds 2^32-1 bytes (payload ${e.length} bytes)`);let o=new Uint8Array(s),i=0;return o[i++]=qe,o[i++]=t.length,o.set(t,i),i+=t.length,o[i++]=n>>>8&255,o[i++]=n&255,o.set(e,i),o}function _t(r,e){if(r.length<yt)throw new Error(`decodeEnvelope: bytes too short (${r.length} < ${yt})`);let t=0,n=r[t++];if(n!==qe)throw new Error(`decodeEnvelope: unsupported envelope version ${n} (expected ${qe})`);let s=r[t++];if(s===0)throw new Error("decodeEnvelope: name_len must be >= 1");if(t+s+2>r.length)throw new Error(`decodeEnvelope: envelope truncated (need ${t+s+2} bytes, have ${r.length})`);let o=new TextDecoder().decode(r.subarray(t,t+s));t+=s;let i=(r[t]<<8|r[t+1])>>>0;t+=2;let a=r.subarray(t),d=e.lookupCodec(o);if(d==null)throw new Error(`decodeEnvelope: codec "${o}" not registered (envelope codec_v=${i})`);return{codec:d,codecVersion:i,payload:a}}function wt(r){r.registerCodec(un)}var un,qe,yt,Ke=j(()=>{"use strict";un={name:"json",version:1,contentType:"application/json",encode(r){let e=JSON.stringify(r);return new TextEncoder().encode(e)},decode(r,e){let t=new TextDecoder().decode(r);return JSON.parse(t)}},qe=1,yt=4});function Te(r){if(r==null)return ie;let{type:e,id:t,...n}=r;return{type:e??"system",id:t??"",...n}}var ie,Ye=j(()=>{"use strict";ie={type:"system",id:""}});function Oe(){return ae>0||ge}function Tt(){return ae>0}function de(r){ae>0?me.push(r):r()}function Ot(r){ae+=1;let e=!1;try{r()}catch(t){throw e=!0,t}finally{if(ae-=1,ae===0)if(e){if(!ge){let t=me.splice(0);for(let n of t)try{n()}catch{}ee.length=0,te.length=0,ue.length=0}}else dn()}}function dn(){let r=!ge;r&&(ge=!0);let e=[],t=0;try{for(;ee.length>0||te.length>0||ue.length>0||r&&me.length>0;){if(r&&me.length>0){let o=me.splice(0);for(let i of o)try{i()}catch(a){e.push(a)}continue}if(t+=1,t>1e3)throw ee.length=0,te.length=0,ue.length=0,new Error("batch drain exceeded 1000 iterations \u2014 likely a reactive cycle");let s=(ee.length>0?ee:te.length>0?te:ue).splice(0);for(let o of s)try{o()}catch(i){e.push(i)}}}finally{r&&(ge=!1)}if(e.length===1)throw e[0];if(e.length>1)throw new AggregateError(e,"batch drain: multiple callbacks threw")}function Ne(r,e,t){if(e.length===0)return;if(e.length===1){let u=t(e[0][0]);if(u<3||!Oe()){r(e);return}(u>=5?ue:u===4?te:ee).push(()=>r(e));return}let n=e.length,s=n,o=n,i=n,a=0;for(;a<n&&t(e[a][0])<3;)a++;for(s=a;a<n&&t(e[a][0])===3;)a++;for(o=a;a<n&&t(e[a][0])===4;)a++;i=a;let d=Oe();if(s>0){let u=e.slice(0,s);r(u)}if(o>s){let u=e.slice(s,o);d?ee.push(()=>r(u)):r(u)}if(i>o){let u=e.slice(o,i);d?te.push(()=>r(u)):r(u)}if(n>i){let u=e.slice(i,n);d?ue.push(()=>r(u)):r(u)}}var ae,ge,ee,te,ue,me,Je=j(()=>{"use strict";ae=0,ge=!1,ee=[],te=[],ue=[],me=[]});function X(){return Math.trunc(performance.now()*1e6)}function xe(){return Date.now()*1e6}var ke=j(()=>{"use strict"});function Nt(r){r.registerMessageType(pe,{tier:0,wireCrossing:!1}),r.registerMessageType(K,{tier:1,wireCrossing:!1}),r.registerMessageType(W,{tier:1,wireCrossing:!1,metaPassthrough:!1}),r.registerMessageType(J,{tier:2,wireCrossing:!1}),r.registerMessageType(Z,{tier:2,wireCrossing:!1}),r.registerMessageType(I,{tier:3,wireCrossing:!0}),r.registerMessageType(Y,{tier:3,wireCrossing:!0}),r.registerMessageType(H,{tier:4,wireCrossing:!0,metaPassthrough:!1}),r.registerMessageType(M,{tier:4,wireCrossing:!0,metaPassthrough:!1}),r.registerMessageType(L,{tier:5,wireCrossing:!0,metaPassthrough:!1})}var Ee,xt=j(()=>{"use strict";he();Ee=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 n=this._messageTypes.get(t);return n!=null?n.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 Xe(r){let e=cn.filter(t=>r({type:t,id:""},"write"));return e.length===0?"restricted":e.includes("human")&&e.includes("llm")&&e.every(t=>t==="human"||t==="llm"||t==="system")?"both":e.length===1?e[0]:e.join("+")}var U,cn,Se=j(()=>{"use strict";U=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}},cn=["human","llm","wallet","system"]});function Ze(r){if(r===void 0)return null;if(typeof r=="number"){if(!Number.isFinite(r))throw new TypeError(`Cannot hash non-finite number: ${r}`);if(Number.isInteger(r)&&!Number.isSafeInteger(r))throw new TypeError(`Cannot hash integer outside safe range (|n| > 2^53-1): ${r}. Cross-language cid parity is not guaranteed for unsafe integers.`);return r}if(typeof r=="string"||typeof r=="boolean"||r===null)return r;if(Array.isArray(r))return r.map(Ze);if(typeof r=="object"&&r!==null){let e={};for(let t of Object.keys(r).sort())e[t]=Ze(r[t]);return e}return null}function pn(r){let e=fn.encode(r),t=e.length,n=t*8,s=t+9+63&-64,o=new Uint8Array(s);o.set(e),o[t]=128;let i=new DataView(o.buffer);i.setUint32(s-4,n>>>0,!1),i.setUint32(s-8,Math.floor(n/4294967296)>>>0,!1);let a=1779033703,d=3144134277,u=1013904242,l=2773480762,g=1359893119,p=2600822924,f=528734635,c=1541459225,v=new Uint32Array(64),h=(b,m)=>b>>>m|b<<32-m;for(let b=0;b<s;b+=64){for(let O=0;O<16;O++)v[O]=i.getUint32(b+O*4,!1);for(let O=16;O<64;O++){let F=v[O-15],G=v[O-2],R=h(F,7)^h(F,18)^F>>>3,se=h(G,17)^h(G,19)^G>>>10;v[O]=v[O-16]+R+v[O-7]+se>>>0}let m=a,y=d,_=u,N=l,x=g,k=p,E=f,S=c;for(let O=0;O<64;O++){let F=h(x,6)^h(x,11)^h(x,25),G=x&k^~x&E,R=S+F+G+ln[O]+v[O]>>>0,se=h(m,2)^h(m,13)^h(m,22),Ie=m&y^m&_^y&_,_e=se+Ie>>>0;S=E,E=k,k=x,x=N+R>>>0,N=_,_=y,y=m,m=R+_e>>>0}a=a+m>>>0,d=d+y>>>0,u=u+_>>>0,l=l+N>>>0,g=g+x>>>0,p=p+k>>>0,f=f+E>>>0,c=c+S>>>0}let w=b=>b.toString(16).padStart(8,"0");return w(a)+w(d)+w(u)+w(l)+w(g)+w(p)+w(f)+w(c)}function Qe(r){let e=Ze(r??null),t=JSON.stringify(e);return pn(t).slice(0,16)}function hn(){let r=globalThis.crypto;if(r?.randomUUID)return r.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 et(r,e,t){let n=t?.id??hn();if(r===0)return{id:n,version:0};let o=(t?.hash??Qe)(e);return{id:n,version:0,cid:o,prev:null}}function kt(r,e,t){r.version+=1,"cid"in r&&(r.prev=r.cid,r.cid=t(e))}var ln,fn,Et=j(()=>{"use strict";ln=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]),fn=new TextEncoder});function Rt(r){return{node:r,unsub:null,prevData:void 0,dirty:!1,involvedThisWave:!1,dataBatch:[],terminal:void 0}}function tt(r){r.prevData=void 0,r.dirty=!1,r.involvedThisWave=!1,r.dataBatch.length=0,r.terminal=void 0}function Ae(r){return r.length===0?r:typeof r[0]=="symbol"?[r]:r}function Re(r,e,t){let n=Dt(r)?r:[],s=typeof r=="function"?r:typeof e=="function"?e:void 0,o={};return Dt(r)?o=(nt(e)?e:t)??{}:nt(r)?o=r:o=(nt(e)?e:t)??{},new P(n,s,o)}var St,At,gn,mn,ce,P,Dt,nt,be=j(()=>{"use strict";Ke();Ye();Je();ke();xt();Se();he();Et();St=()=>{},At=100;gn=(r,e,t,n)=>{t.direction==="down-in"&&r._onDepMessage(t.depIndex,e)},mn=(r,e,t,n)=>{let s=r;if(s._status==="completed"||s._status==="errored")return;let o=s._cached,i=o===void 0?[ze]:[ze,[I,o]];s._status==="dirty"&&i.push(oe),Ne(e,i,s._config.tierOf)},ce=new Ee({onMessage:gn,onSubscribe:mn});Nt(ce);wt(ce);P=class r{_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,n){this._config=n.config??ce,this._config.onMessage,this._optsName=n.name,this._describeKind=n.describeKind,this._equals=n.equals??Object.is,this._resubscribable=n.resubscribable??!1,this._resetOnTeardown=n.resetOnTeardown??!1,this._autoComplete=n.completeWhenDepsComplete??!0,this._autoError=n.errorWhenDepsError??!0,this._pausable=n.pausable??!0,this._guard=n.guard,this._fn=t,this._partial=n.partial??!1,this._cached=n.initial!==void 0?n.initial:void 0,this._status=e.length===0&&t==null&&this._cached!==void 0?"settled":"sentinel",this._hashFn=n.versioningHash??this._config.defaultHashFn??Qe;let s=n.versioning??this._config.defaultVersioning;this._versioningLevel=s,this._versioning=s!=null?et(s,this._cached===void 0?void 0:this._cached,{id:n.versioningId,hash:this._hashFn}):void 0,this._deps=e.map(Rt);let o={};for(let[a,d]of Object.entries(n.meta??{})){let u={initial:d,name:`${n.name??"node"}:meta:${a}`,describeKind:"state",config:this._config};n.guard!=null&&(u.guard=n.guard),o[a]=new r([],void 0,u)}Object.freeze(o),this.meta=o,this._hasMeta=Object.keys(o).length>0;let i=this;this._actions={emit(a){i._emit([[I,a]])},down(a){i._emit(Ae(a))},up(a){i._emitUp(Ae(a))}},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 n=this._versioningLevel;if(n!=null&&e<=n)return;let s=t?.hash??this._hashFn;s!==this._hashFn&&(this._hashFn=s);let o=this._cached===void 0?void 0:this._cached,i=this._versioning,a=i?.id??t?.id,d=i?.version??0,u=et(e,o,{id:a,hash:s});u.version=d,this._versioning=u,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=Te(e);if(this._guard!=null&&!this._guard(t,"observe"))return!1;if(this._extraGuards!=null){for(let n of this._extraGuards)if(!n(t,"observe"))return!1}return!0}_checkGuard(e){if(e?.internal)return;let t=this._guard!=null||this._extraGuards!=null,n=e?.actor!=null;if(!t&&!n)return;let s=Te(e?.actor),o=e?.delivery==="signal"?"signal":"write";if(this._guard!=null&&!this._guard(s,o))throw new U({actor:s,action:o,nodeName:this.name});if(this._extraGuards!=null){for(let i of this._extraGuards)if(!i(s,o))throw new U({actor:s,action:o,nodeName:this.name})}this._lastMutation={actor:s,timestamp_ns:xe()}}down(e,t){let n=Ae(e);n.length!==0&&(this._checkGuard(t),this._emit(n))}emit(e,t){this._checkGuard(t),this._emit([[I,e]])}up(e,t){if(this._deps.length===0)return;let n=Ae(e);if(n.length===0)return;this._checkGuard(t);let s=t??{internal:!0};this._validateUpTiers(n);for(let o of this._deps)o.node.up?.(n,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 n of e){let s=t(n[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=Te(t);if(!this._guard(d,"observe"))throw new U({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)tt(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 o;try{o=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 i=this._isTerminal;if(this._sinkCount===1&&!i)try{this._activate()}catch(d){if(this._sinkCount-=1,this._removeSink(e),this._sinkCount===0&&(this._status="sentinel"),typeof o=="function")try{o()}catch{}throw d}this._status==="sentinel"&&this._cached===void 0&&(this._status="pending");let a=!1;return()=>{a||(a=!0,this._sinkCount-=1,this._removeSink(e),typeof o=="function"&&o(),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 n=0;n<e;n++){let s=n,o=this._deps[n];o.unsub=St,o.unsub=o.node.subscribe(i=>{if(o.unsub===null)return;let a=this._config.tierOf,d=!1;for(let u of i)a(u[0])>=3&&(d=!0),this._config.onMessage(this,u,{direction:"down-in",depIndex:s},this._actions);d&&this._maybeRunFnOnSettlement()}),t++}}catch(n){this._deps[t].unsub=null;for(let s=0;s<t;s++){let o=this._deps[s];if(o.unsub!=null){let i=o.unsub;o.unsub=null;try{i()}catch{}tt(o)}}throw this._dirtyDepCount=0,n}}_addDep(e){for(let s=0;s<this._deps.length;s++)if(this._deps[s].node===e)return s;let t=this._deps.length,n=Rt(e);if(this._deps.push(n),this._sinks==null)return t;n.dirty=!0,this._dirtyDepCount++,this._status!=="dirty"&&this._emit(Ue),n.unsub=St;try{n.unsub=e.subscribe(s=>{if(n.unsub===null)return;let o=this._config.tierOf,i=!1;for(let a of s)o(a[0])>=3&&(i=!0),this._config.onMessage(this,a,{direction:"down-in",depIndex:t},this._actions);i&&this._maybeRunFnOnSettlement()})}catch(s){throw n.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(n){this._emit([[M,this._wrapFnError("cleanup threw",n)]])}else if(t!=null&&typeof t=="object"){let n=t.deactivate;if(typeof n=="function")try{n()}catch(s){this._emit([[M,this._wrapFnError("cleanup.deactivate threw",s)]])}}for(let n of this._deps){if(n.unsub!=null){let s=n.unsub;n.unsub=null;try{s()}catch{}}tt(n)}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 n=this._deps[e],s=t[0];if(this._inspectorHooks!=null){let o={kind:"dep_message",depIndex:e,message:t};for(let i of this._inspectorHooks)i(o)}if(s!==pe){if(s===K){this._depDirtied(n);return}if(s===W){if(this._depInvalidated(n),this._cached===void 0)return;this._emit(mt);return}if(s===J||s===Z){this._emit([t]);return}if(s===L){this._emit(We);return}if(s===I)this._depSettledAsData(n,t[1]);else if(s===Y)this._depSettledAsResolved(n);else if(s===H)this._depSettledAsTerminal(n,!0);else if(s===M)this._depSettledAsTerminal(n,t[1]);else{this._emit([t]);return}if(!this._fn){(s===I||s===Y)&&this._emit([t]),(s===H||s===M)&&this._maybeAutoTerminalAfterWave();return}}}_depDirtied(e){e.dirty||(e.dirty=!0,e.involvedThisWave=!0,this._dirtyDepCount++,this._status!=="dirty"&&this._emit(Ue))}_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(gt),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([[M,e.terminal]]);return}this._autoComplete&&this._deps.every(t=>t.terminal!==void 0)&&this._emit(bt)}_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(i){this._emit([[M,this._wrapFnError("cleanup threw",i)]]);return}}else if(e!=null&&typeof e=="object"){let i=e.beforeRun;if(typeof i=="function"){e.beforeRun=void 0;try{i()}catch(a){this._emit([[M,this._wrapFnError("cleanup.beforeRun threw",a)]]);return}}}let t=this._deps.map(i=>i.involvedThisWave?i.dataBatch.length>0?[...i.dataBatch]:[]:void 0),n=this._deps.map(i=>i.prevData);for(let i=0;i<this._deps.length;i++){let a=t[i];a!=null&&a.length>0&&(this._deps[i].prevData=a[a.length-1])}let s=this._deps.map(i=>i.terminal),o={prevData:n,terminalDeps:s,store:this._store};if(this._hasCalledFnOnce=!0,this._clearWaveFlags(),this._inspectorHooks!=null){let i={kind:"run",batchData:t,prevData:n};for(let a of this._inspectorHooks)a(i)}this._isExecutingFn=!0;try{let i=this._fn(t,this._actions,o);if(typeof i=="function")this._cleanup=i;else if(i!=null&&typeof i=="object"){let a=i;(typeof a.beforeRun=="function"||typeof a.deactivate=="function"||typeof a.invalidate=="function")&&(this._cleanup=i)}}catch(i){this._emit([[M,this._wrapFnError("fn threw",i)]])}finally{this._isExecutingFn=!1,this._pendingRerun?(this._pendingRerun=!1,this._rerunDepth+=1,this._rerunDepth>At?(this._rerunDepth=0,this._emit([[M,new Error(`Node "${this.name}": _pendingRerun depth exceeded ${At} \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 n=t instanceof Error?t.message:String(t);return new Error(`Node "${this.name}": ${e}: ${n}`,{cause:t})}_frameBatch(e){let t=this._config.tierOf;if(e.length===1)return t(e[0][0])===3&&this._status!=="dirty"?[oe,e[0]]:e;let n=!0,s=!1,o=!1,i=-1;for(let d of e){let u=t(d[0]);u<i&&(n=!1),u===3&&(s=!0),d[0]===K&&(o=!0),i=u}let a=e;if(!n){let d=e.map((u,l)=>({m:u,i:l,tier:t(u[0])}));d.sort((u,l)=>u.tier-l.tier||u.i-l.i),a=d.map(u=>u.m)}if(s&&!o&&this._status!=="dirty"){let d=0;for(;d<a.length&&t(a[d][0])===0;)d++;return d===0?[oe,...a]:[...a.slice(0,d),oe,...a.slice(d)]}return a}_emit(e){if(e.length===0)return;for(let a=0;a<e.length;a++){let d=e[a];if(d[0]===M&&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 a=e.filter(d=>d[0]===L||d[0]===W);if(a.length===0)return;t=a}t=this._frameBatch(t);let s=null;for(let a=0;a<t.length;a++){let d=t[a],u=d[0];if(u!==J&&u!==Z){s?.push(d);continue}if(d.length<2)throw new Error(`Node "${this.name}": [[${u===J?"PAUSE":"RESUME"}]] must carry a lockId payload \u2014 bare PAUSE/RESUME is a protocol violation (C0 rule). Use \`[[PAUSE, lockId]]\` / \`[[RESUME, lockId]]\`.`);let l=!0;if(this._pausable!==!1){let g=d[1];if(u===J)this._pauseLocks==null&&(this._pauseLocks=new Set),this._pauseLocks.add(g),this._paused=!0,this._pausable==="resumeAll"&&this._pauseBuffer==null&&(this._pauseBuffer=[]);else if(this._pauseLocks==null||!this._pauseLocks.has(g))l=!1;else if(this._pauseLocks.delete(g),this._pauseLocks.size===0){if(this._paused=!1,this._pauseBuffer!=null&&this._pauseBuffer.length>0){let p=this._pauseBuffer;this._pauseBuffer=[],this._emit(p)}this._pendingWave&&(this._pendingWave=!1,this._maybeRunFnOnSettlement())}}l?s?.push(d):s==null&&(s=t.slice(0,a))}if(s!=null){if(s.length===0)return;t=s}if(this._hasMeta&&t.some(a=>a[0]===L))for(let a of Object.keys(this.meta))try{this.meta[a]._emit(We)}catch{}let{finalMessages:o,equalsError:i}=this._updateState(t);if(o.length>0&&this._config.inspectorEnabled){let a=this._config.globalInspector;if(a!=null)try{a({kind:"emit",node:this,messages:o})}catch{}}if(o.length>0)if(this._paused&&this._pausable==="resumeAll"&&this._pauseBuffer!=null){let a=this._config.tierOf,d=[];for(let u of o)a(u[0])===3?this._pauseBuffer.push(u):d.push(u);d.length>0&&this._dispatchOrAccumulate(d)}else this._dispatchOrAccumulate(o);i!=null&&this._emit([[M,i]])}_updateState(e){let t=this._config.tierOf,n,s,o=-1,i=0;for(let l of e)t(l[0])===3&&i++;let a=i<=1,d=-1;if(this._versioning!=null&&i>1){for(let l=e.length-1;l>=0;l--)if(e[l][0]===I){d=l;break}}for(let l=0;l<e.length;l++){let g=e[l],p=g[0];if(p===I){if(g.length>=2){let f=!1;if(a&&this._cached!==void 0)try{f=this._equals(this._cached,g[1])}catch(c){s=this._wrapFnError("equals threw",c),o=l;break}if(f){n==null&&(n=e.slice(0,l)),n.push(Be),this._status="resolved";continue}this._cached=g[1],this._versioning!=null&&(d<0||l===d)&&kt(this._versioning,g[1],this._hashFn)}this._status="settled",n?.push(g)}else if(n?.push(g),p===K)this._status="dirty";else if(p===Y)this._status="resolved";else if(p===H){this._status="completed";{let f=this._config.rigorRecorder;if(f!=null)try{f.onTerminalTransition(this,"completed",this._autoComplete,this._autoError,this._deps.length>0)}catch{}}}else if(p===M){this._status="errored";{let f=this._config.rigorRecorder;if(f!=null)try{f.onTerminalTransition(this,"errored",this._autoComplete,this._autoError,this._deps.length>0)}catch{}}}else if(p===W){if(this._cached!==void 0){let c=this._config.rigorRecorder;if(c!=null)try{c.onNonVacuousInvalidate(this,this._cached)}catch{}}this._cached=void 0,this._status="dirty";let f=this._cleanup;if(typeof f=="function"){this._cleanup=void 0;try{f()}catch{}}else if(f!=null&&typeof f=="object"){let c=f.invalidate;if(typeof c=="function")try{c()}catch{}}}else p===L&&(this._resetOnTeardown&&(this._cached=void 0),this._deactivate(!0),this._status="sentinel")}let u=o>=0?n??e.slice(0,o):n??e;return s!=null?{finalMessages:u,equalsError:s}:{finalMessages:u}}_deliverToSinks=e=>{if(this._sinks==null)return;if(typeof this._sinks=="function"){this._sinks(e);return}let t=[...this._sinks];for(let n of t)n(e)};_dispatchOrAccumulate(e){if(Tt()){this._batchPendingMessages===null&&(this._batchPendingMessages=[],de(()=>this._flushBatchPending()));for(let t of e)this._batchPendingMessages.push(t);return}Ne(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);Ne(this._deliverToSinks,t,this._config.tierOf)}},Dt=r=>Array.isArray(r),nt=r=>typeof r=="object"&&r!=null&&!Array.isArray(r)});function ne(r,e){return Re([],{...e,initial:r})}function rt(r,e){return Re((n,s,o)=>r(s,o)??void 0,{describeKind:"producer",...e})}function st(r,e,t){return Re(r,(s,o,i)=>{let a=s.map((d,u)=>d!=null&&d.length>0?d.at(-1):i.prevData[u]);o.emit(e(a,i))},{describeKind:"derived",...t})}var ot=j(()=>{"use strict";be()});function it(r,e){if(e!=null&&e.length>0)return new Set(e);switch(r){case"standard":return new Set(["type","status","value","deps","meta","v"]);case"full":return null;case"spec":return new Set(["type","deps","meta","value"]);default:return new Set(["type","deps"])}}function bn(r){return r._describeKind!=null?r._describeKind:r._deps.length>0?"derived":r._fn!=null?"producer":"state"}function yn(r){let e={};for(let[t,n]of Object.entries(r.meta))try{e[t]=n.cache}catch{}return e}function at(r,e,t){let n=e==null,s=!n&&e!=null?[...e].filter(l=>l.startsWith("meta.")).map(l=>l.slice(5)):null,o=n||e.has("meta")||s!=null&&s.length>0,i="state",a=[];r instanceof P&&(i=bn(r),a=r._deps.map(l=>l.node.name??""));let d={type:i,deps:a};(n||e.has("status"))&&(d.status=r.status);let u=r instanceof P?r._guard:void 0;if(o){let l={...yn(r)};if(u!=null&&l.access===void 0&&(l.access=Xe(u)),s!=null&&s.length>0&&!e.has("meta")){let g={};for(let p of s)p in l&&(g[p]=l[p]);d.meta=g}else d.meta=l}if(r.name!=null&&(d.name=r.name),(n||e.has("value"))&&(!t||i==="state")){r.status==="sentinel"&&(d.sentinel=!0);try{d.value=r.cache}catch{}}if((n||e.has("v"))&&r.v!=null){let l={id:r.v.id,version:r.v.version};"cid"in r.v&&(l.cid=r.v.cid,l.prev=r.v.prev),d.v=l}return(n||e.has("guard"))&&u!=null&&(d.guard=Xe(u)),(n||e.has("lastMutation"))&&r.lastMutation!=null&&(d.lastMutation=r.lastMutation),d}var Ct=j(()=>{"use strict";Se();be()});function De(r){return r.subscribe(()=>{})}var Gt=j(()=>{"use strict"});var Pt=j(()=>{"use strict";Gt()});var Ce,$t=j(()=>{"use strict";Ce=class{_timer;_gen=0;start(e,t){this.cancel(),this._gen+=1;let n=this._gen;this._timer=setTimeout(()=>{this._timer=void 0,n===this._gen&&t()},e)}cancel(){this._timer!==void 0&&(clearTimeout(this._timer),this._timer=void 0)}get pending(){return this._timer!==void 0}}});var ye,It=j(()=>{"use strict";ye=class{constructor(e){this.capacity=e;if(!Number.isInteger(e)||e<=0)throw new Error(`RingBuffer capacity must be a positive integer (got ${e})`);this.buf=new Array(e)}buf;head=0;_size=0;get size(){return this._size}get maxSize(){return this.capacity}push(e){let t=(this.head+this._size)%this.capacity;this.buf[t]=e,this._size<this.capacity?this._size++:this.head=(this.head+1)%this.capacity}shift(){if(this._size===0)return;let e=this.buf[this.head];return this.buf[this.head]=void 0,this.head=(this.head+1)%this.capacity,this._size--,e}at(e){if(this._size===0)return;let t=e<0?this._size+e:e;if(!(t<0||t>=this._size))return this.buf[(this.head+t)%this.capacity]}toArray(){let e=new Array(this._size);for(let t=0;t<this._size;t++)e[t]=this.buf[(this.head+t)%this.capacity];return e}clear(){for(let e=0;e<this._size;e++)this.buf[(this.head+e)%this.capacity]=void 0;this.head=0,this._size=0}}});var Ln={};tn(Ln,{create:()=>Fn});module.exports=rn(Ln);he();ot();Ye();Je();ke();Se();he();Ct();be();ot();ke();function ut(r,e){if(Object.is(r,e))return!0;if(r==null||e==null||typeof r!="object"||typeof e!="object")return!1;if(Array.isArray(r)){if(!Array.isArray(e)||r.length!==e.length)return!1;for(let o=0;o<r.length;o++)if(!ut(r[o],e[o]))return!1;return!0}if(Array.isArray(e))return!1;let t=Object.keys(r),n=Object.keys(e);if(t.length!==n.length)return!1;let s=new Set(n);for(let o of t)if(!s.has(o)||!ut(r[o],e[o]))return!1;return!0}function Mt(r,e){return`${r}\0${e}`}function dt(r,e){let t=[],n=new Set(r.subgraphs),s=new Set(e.subgraphs),o=[];for(let h of s)n.has(h)||o.push(h);o.sort();for(let h of o)t.push({type:"subgraph-mounted",path:h});let i=new Set(Object.keys(r.nodes)),a=new Set(Object.keys(e.nodes)),d=[];for(let h of a)i.has(h)||d.push(h);d.sort();for(let h of d)t.push({type:"node-added",path:h,node:{...e.nodes[h]}});let u=[];for(let h of a){if(!i.has(h))continue;let w=r.nodes[h]?.meta,b=e.nodes[h]?.meta;w==null&&b==null||ut(w??{},b??{})||u.push(h)}u.sort();for(let h of u)t.push({type:"node-meta-changed",path:h,prevMeta:r.nodes[h]?.meta??{},nextMeta:e.nodes[h]?.meta??{}});let l=new Map;for(let h of r.edges)l.set(Mt(h.from,h.to),h);let g=new Map;for(let h of e.edges)g.set(Mt(h.from,h.to),h);let p=[];for(let[h,w]of g)l.has(h)||p.push(w);p.sort((h,w)=>h.from<w.from?-1:h.from>w.from?1:h.to<w.to?-1:h.to>w.to?1:0);for(let h of p)t.push({type:"edge-added",from:h.from,to:h.to});let f=[];for(let[h,w]of l)g.has(h)||f.push(w);f.sort((h,w)=>h.from<w.from?-1:h.from>w.from?1:h.to<w.to?-1:h.to>w.to?1:0);for(let h of f)t.push({type:"edge-removed",from:h.from,to:h.to});let c=[];for(let h of i)a.has(h)||c.push(h);c.sort();for(let h of c)t.push({type:"node-removed",path:h});let v=[];for(let h of n)s.has(h)||v.push(h);v.sort();for(let h of v)t.push({type:"subgraph-unmounted",path:h});return{events:t,flushedAt_ns:X()}}Pt();$t();It();Ke();function Ft(r,e,t,n={}){let s=e in r.nodes,o=t in r.nodes;if(!s)return Me(e,t,"no-such-from");if(!o)return Me(e,t,"no-such-to");let i=n.maxDepth;if(i!=null&&(!Number.isInteger(i)||i<0))throw new Error("explainPath: maxDepth must be an integer >= 0");if(e===t){if(n.findCycle===!0){let u=vn(r,e,n);if(u!=null)return u}let d=Ge(e,r.nodes[e],0,n);return Pe(e,t,[d])}if(i===0)return Me(e,t,"no-path");let a=Lt(r,e,t,i);return a.found?Pe(e,t,jt(r,a.pathOrder,n)):Me(e,t,a.truncated?"max-depth-exceeded":"no-path")}function Lt(r,e,t,n){let s=new Map,o=[{path:t,depth:0}],i=new Set([t]),a=0,d=!1;for(;a<o.length;){let g=o[a++];if(g.path===e)break;if(n!=null&&g.depth>=n){let v=r.nodes[g.path];v?.deps&&v.deps.length>0&&(d=!0);continue}let p=r.nodes[g.path];if(p==null)continue;let f=p.deps??[],c=new Map;for(let v=0;v<f.length;v++){let h=f[v];if(!h)continue;let w=c.get(h);w==null&&(w=[],c.set(h,w)),w.push(v)}for(let[v,h]of c)i.has(v)||(i.add(v),s.set(v,{from:g.path,depIndices:h}),o.push({path:v,depth:g.depth+1}))}if(!s.has(e))return{found:!1,pathOrder:[],truncated:d};let u=[{path:e}],l=e;for(;l!==t;){let g=s.get(l);if(g==null)return{found:!1,pathOrder:[],truncated:!1};u[u.length-1].depIndices=g.depIndices,u.push({path:g.from}),l=g.from}return{found:!0,pathOrder:u,truncated:!1}}function vn(r,e,t){let n=r.nodes[e];if(n==null)return null;let s=n.deps??[],o=[];for(let a=0;a<s.length;a++)s[a]===e&&o.push(a);if(o.length>0){let a=Ge(e,n,0,t);a.dep_index=o[0];let d=Ge(e,n,1,t);return Pe(e,e,[a,d])}let i=null;for(let a=0;a<s.length;a++){let d=s[a];if(!d||d===e)continue;let u=Lt(r,d,e,t.maxDepth);u.found&&(i==null||u.pathOrder.length<i.pathOrder.length)&&(i=u,i={found:!0,pathOrder:[{path:e,depIndices:[a]},...u.pathOrder],truncated:!1})}return i==null?null:Pe(e,e,jt(r,i.pathOrder,t))}function jt(r,e,t){return e.map((n,s)=>{let o=r.nodes[n.path],i=Ge(n.path,o,s,t);return n.depIndices!=null&&n.depIndices.length>0&&(i.dep_index=n.depIndices[0],n.depIndices.length>1&&(i.dep_indices=[...n.depIndices])),i})}function Ge(r,e,t,n){let s={path:r,type:e.type,hop:t};e.status!==void 0&&(s.status=e.status),"value"in e&&(s.value=e.value),e.v!=null&&(s.v=e.v);let o=n.annotations?.get(r)??e.annotation;o!=null&&(s.annotation=o);let i=n.lastMutations?.get(r)??e.lastMutation;return i!=null&&(s.lastMutation=i),s}function Pe(r,e,t){return Vt(r,e,!0,"ok",t)}function Me(r,e,t){return Vt(r,e,!1,t,[])}function Vt(r,e,t,n,s){let o=_n(r,e,t,n,s);return{from:r,to:e,found:t,reason:n,steps:s,text:o,toJSON(){return{from:r,to:e,found:t,reason:n,steps:s}}}}function _n(r,e,t,n,s){if(!t)switch(n){case"no-such-from":return`explainPath: no node named "${r}"`;case"no-such-to":return`explainPath: no node named "${e}"`;case"max-depth-exceeded":return`explainPath: no path from "${r}" to "${e}" within maxDepth`;default:return`explainPath: no path from "${r}" to "${e}"`}let o=[`Causal path: ${r} \u2192 ${e} (${s.length} step(s))`];for(let i of s){let d=` ${i.hop===0?"\xB7":"\u2193"} ${i.path} (${i.type}${i.status?`/${i.status}`:""})`;if(o.push(d),"value"in i&&o.push(` value: ${wn(i.value)}`),i.annotation!=null&&o.push(` annotation: ${i.annotation}`),i.lastMutation!=null){let u=i.lastMutation.actor;o.push(` actor: ${u.type}${u.id?`:${u.id}`:""}`)}}return o.join(`
|
|
2
|
-
`)}function
|
|
3
|
-
`)}function qt(r){if(r.version!==le)throw new Error(`unsupported snapshot version ${String(r.version)} (expected ${le})`);for(let e of["name","nodes","edges","subgraphs"])if(!(e in r))throw new Error(`snapshot missing required key "${e}"`);if(typeof r.name!="string")throw new TypeError("snapshot 'name' must be a string");if(typeof r.nodes!="object"||r.nodes===null||Array.isArray(r.nodes))throw new TypeError("snapshot 'nodes' must be an object");if(!Array.isArray(r.edges))throw new TypeError("snapshot 'edges' must be an array");if(!Array.isArray(r.subgraphs))throw new TypeError("snapshot 'subgraphs' must be an array")}function En(r,e){let t=new WeakMap,n=(s,o)=>{if(Object.is(s,o))return!0;if(s==null||o==null||typeof s!="object"||typeof o!="object")return!1;let i=t.get(s);if(i==null&&(i=new WeakSet,t.set(s,i)),i.has(o))return!0;i.add(o);let a=s.constructor,d=o.constructor;if(a!==d)return!1;if(s instanceof Date)return s.getTime()===o.getTime();if(s instanceof RegExp)return s.source===o.source&&s.flags===o.flags;if(Array.isArray(s)){let p=o;if(s.length!==p.length)return!1;for(let f=0;f<s.length;f++)if(!n(s[f],p[f]))return!1;return!0}if(s instanceof Map){let p=o;if(s.size!==p.size)return!1;for(let[f,c]of s)if(!p.has(f)||!n(c,p.get(f)))return!1;return!0}if(s instanceof Set){let p=o;if(s.size!==p.size)return!1;for(let f of s){let c=!1;for(let v of p)if(n(f,v)){c=!0;break}if(!c)return!1}return!0}if(ArrayBuffer.isView(s)){let p=s,f=o;if(p.length!==f.length)return!1;for(let c=0;c<p.length;c++)if(p[c]!==f[c])return!1;return!0}let u=Object.keys(s),l=Object.keys(o);if(u.length!==l.length)return!1;let g=new Set(l);for(let p of u)if(!g.has(p)||!n(s[p],o[p]))return!1;return!0};return n(r,e)}function Sn(r){return r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function $e(r){let e="^";for(let t=0;t<r.length;t+=1){let n=r[t];if(n==="*"){e+=".*";continue}if(n==="?"){e+=".";continue}if(n==="["){let s=r.indexOf("]",t+1);if(s<=t+1){e+="\\[";continue}let o=r.slice(t+1,s);o.startsWith("!")&&(o=`^${o.slice(1)}`),o=o.replace(/\\/g,"\\\\"),e+=`[${o}]`,t=s;continue}e+=Sn(n)}return e+="$",new RegExp(e)}var An={data:"\x1B[32m",dirty:"\x1B[33m",resolved:"\x1B[36m",invalidate:"\x1B[93m",pause:"\x1B[90m",resume:"\x1B[96m",complete:"\x1B[34m",error:"\x1B[31m",teardown:"\x1B[91m",derived:"\x1B[35m",path:"\x1B[90m",reset:"\x1B[0m"},Rn={data:"",dirty:"",resolved:"",invalidate:"",pause:"",resume:"",complete:"",error:"",teardown:"",derived:"",path:"",reset:""};function ct(r){if(typeof r=="string")return JSON.stringify(r);if(typeof r=="number"||typeof r=="boolean"||r==null)return String(r);try{return JSON.stringify(r)}catch{return"[unserializable]"}}function Dn(r){return r==="none"?Rn:r==="ansi"||r==null?An:{data:r.data??"",dirty:r.dirty??"",resolved:r.resolved??"",invalidate:r.invalidate??"",pause:r.pause??"",resume:r.resume??"",complete:r.complete??"",error:r.error??"",teardown:r.teardown??"",derived:r.derived??"",path:r.path??"",reset:r.reset??""}}function Kt(r){if(r==null)return{};let e=r.detail;return e==="full"?{...r,structured:r.structured??!0,timeline:r.timeline??!0,causal:r.causal??!0,derived:r.derived??!0}:e==="minimal"?{...r,structured:r.structured??!0}:r.format==="stage-log"?{...r,structured:r.structured??!0,timeline:r.timeline??!0}:r}function Cn(r,e,t){for(let n=0;n<r.length;n++){let s=r.charCodeAt(n);if(s<32||s===127)throw new Error(`Graph "${e}": ${t} "${r}" must not contain control character (U+${s.toString(16).padStart(4,"0").toUpperCase()} at index ${n})`)}}function lt(r,e,t){if(r==="")throw new Error(`Graph "${e}": ${t} name must be non-empty`);if(r.includes(C))throw new Error(`Graph "${e}": ${t} "${r}" must not contain '${C}' (path separator)`);if(r===q)throw new Error(`Graph "${e}": ${t} name "${q}" is reserved for meta companion paths`);Cn(r,e,t)}function Mn(r,e){if(r==="")throw new Error(`Graph "${e}": resolve path must be non-empty`);let t=r.split(C);for(let n of t)if(n==="")throw new Error(`Graph "${e}": resolve path has empty segment`);return t}function Gn(r,e){let t=!1;for(let s of r)if(!e.isMetaPassthrough(s[0])){t=!0;break}return t?r.filter(s=>e.isMetaPassthrough(s[0])):r}function Xt(r){for(let e of r._mounts.values())Xt(e);for(let e of r._nodes.values())try{e.down([[L]],{internal:!0})}catch{}}var ve=class r{name;opts;config;_nodes=new Map;_nodeToName=new WeakMap;_mounts=new Map;_parent=void 0;_storageDisposers=new Set;_disposers=new Set;_destroyed=!1;_topology;_topologyEmitters=new Set;_factory;_factoryArgs;constructor(e,t){if(e==="")throw new Error("Graph name must be non-empty");if(e.includes(C))throw new Error(`Graph name must not contain '${C}' (got "${e}")`);if(e===q)throw new Error(`Graph name "${q}" is reserved for meta companion paths`);this.name=e,this.opts=Object.freeze({...t??{}}),this.config=t?.config??ce,this._traceRing=new ye(t?.traceCapacity??1e3),t?.versioning!=null&&this.setVersioning(t.versioning),typeof t?.factory=="string"&&(this._factory=t.factory,t.factoryArgs!==void 0&&(this._factoryArgs=t.factoryArgs))}tagFactory(e,t){return this._factory=e,this._factoryArgs=t,this}ancestors(e=!0){let t=[],n=e?this:this._parent;for(;n!=null;)t.push(n),n=n._parent;return t}get topology(){return this._topology==null&&(this._topology=rt(e=>{let t=n=>{e.emit(n)};return this._topologyEmitters.add(t),()=>{this._topologyEmitters.delete(t)}},{name:`${this.name}_topology`})),this._topology}_emitTopology(e){if(!(this._topology==null||this._topologyEmitters.size===0))for(let t of this._topologyEmitters)t(e)}nameOf(e){return this._nodeToName.get(e)}add(e,t){let n=e.name,s=t?.name??n;if(s==null||s==="")throw new Error(`Graph "${this.name}": graph.add requires a non-empty name \u2014 pass via opts.name or set it on the node (e.g. state(0, { name: "x" }))`);let o=s,i=t?.annotation;if(lt(o,this.name,"add"),this._mounts.has(o))throw new Error(`Graph "${this.name}": name "${o}" is already a mount point`);if(this._nodes.has(o))throw new Error(`Graph "${this.name}": node "${o}" already exists`);let a=this._nodeToName.get(e);if(a!==void 0)throw new Error(`Graph "${this.name}": node instance already registered as "${a}"`);return this._nodes.set(o,e),this._nodeToName.set(e,o),this._emitTopology({kind:"added",name:o,nodeKind:"node"}),i!=null&&(this._annotations.set(o,i),this.config.inspectorEnabled&&this._traceRing.push({path:o,annotation:i,timestamp_ns:X()})),e}setVersioning(e){if(e!=null)for(let t of this._nodes.values())t instanceof P&&t._applyVersioning(e)}remove(e){lt(e,this.name,"remove");let t=this._mounts.get(e);if(t){let o={kind:"mount",nodes:[],mounts:[]},i=[];t._collectObserveTargets("",i);for(let[a,d]of i)a.includes(`${C}${q}${C}`)||o.nodes.push(a);return o.nodes.sort(),o.mounts.push(e),o.mounts.push(...t._collectSubgraphs(`${e}${C}`)),this._mounts.delete(e),t._parent=void 0,Xt(t),this._emitTopology({kind:"removed",name:e,nodeKind:"mount",audit:o}),o}let n=this._nodes.get(e);if(!n)throw new Error(`Graph "${this.name}": unknown node or mount "${e}"`);this._nodes.delete(e),this._nodeToName.delete(n),n.down([[L]],{internal:!0});let s={kind:"node",nodes:[e],mounts:[]};return this._emitTopology({kind:"removed",name:e,nodeKind:"node",audit:s}),s}removeAll(e){let t=typeof e=="function"?e:(()=>{let o=$e(e);return i=>o.test(i)})(),n={kind:"mount",nodes:[],mounts:[]},s=[...this._nodes.keys(),...this._mounts.keys()].filter(o=>t(o));for(let o of s){let i=this.remove(o);n.nodes.push(...i.nodes),n.mounts.push(...i.mounts)}return n.nodes.sort(),n.mounts.sort(),n}[Symbol.iterator](){let e=[...this._nodes.keys()].sort(),t=this._nodes,n=0;return{[Symbol.iterator](){return this},next(){if(n>=e.length)return{value:void 0,done:!0};let s=e[n++];return{value:[s,t.get(s)],done:!1}}}}node(e){if(e==="")throw new Error(`Graph "${this.name}": node name must be non-empty`);if(e.includes(C))return this.resolve(e);let t=this._nodes.get(e);if(!t)throw new Error(`Graph "${this.name}": unknown node "${e}"`);return t}get(e){return this.node(e).cache}set(e,t,n){let s=n?.internal===!0;this.node(e).down([[I,t]],{actor:n?.actor,internal:s,delivery:"write"})}setAll(e,t){let n=Symbol.iterator in e?e:Object.entries(e);Ot(()=>{for(let[s,o]of n)this.set(s,o,t)})}invalidate(e,t){let n=t?.internal===!0;this.node(e).down([[W]],{actor:t?.actor,internal:n,delivery:"write"})}error(e,t,n){let s=n?.internal===!0;this.node(e).down([[M,t]],{actor:n?.actor,internal:s,delivery:"write"})}complete(e,t){let n=t?.internal===!0;this.node(e).down([[H]],{actor:t?.actor,internal:n,delivery:"write"})}edges(e){let t=e?.recursive===!0,n=new Map;if(!t){for(let[d,u]of this._nodes)n.set(u,d);let a=[];for(let[d,u]of this._nodes)if(u instanceof P)for(let l of u._deps){let g=n.get(l.node);g!=null&&a.push([g,d])}return a.sort((d,u)=>d[0]<u[0]?-1:d[0]>u[0]?1:d[1]<u[1]?-1:d[1]>u[1]?1:0),a}let s=[];this._collectObserveTargets("",s);let o=new Map;for(let[a,d]of s)o.set(d,a);let i=[];for(let[a,d]of s)if(d instanceof P)for(let u of d._deps){let l=o.get(u.node);l!=null&&i.push([l,a])}return i.sort((a,d)=>a[0]<d[0]?-1:a[0]>d[0]?1:a[1]<d[1]?-1:a[1]>d[1]?1:0),i}mount(e,t){if(t===void 0){let s=new r(e);return this.mount(e,s)}if(typeof t=="function"){let s=new r(e);return t(s),this.mount(e,s)}let n=t;if(lt(e,this.name,"mount"),this._nodes.has(e))throw new Error(`Graph "${this.name}": cannot mount at "${e}" \u2014 node with that name exists`);if(this._mounts.has(e))throw new Error(`Graph "${this.name}": mount "${e}" already exists`);if(n===this)throw new Error(`Graph "${this.name}": cannot mount a graph into itself`);if(n._parent!=null)throw new Error(`Graph "${this.name}": this child graph is already mounted on "${n._parent.name}"`);for(let s=this;s!=null;s=s._parent)if(s===n)throw new Error(`Graph "${this.name}": mount("${e}", \u2026) would create a mount cycle`);return this._mounts.set(e,n),n._parent=this,this._emitTopology({kind:"added",name:e,nodeKind:"mount"}),n}resolve(e){let t=Mn(e,this.name);return this._resolveFromSegments(t)}tryResolve(e){try{return this.resolve(e)}catch{return}}_resolveFromSegments(e){let t=e;if(t[0]===this.name&&(t=t.slice(1),t.length===0))throw new Error(`Graph "${this.name}": resolve path ends at graph name only`);let n=t[0],s=t.slice(1);if(s.length===0){let a=this._nodes.get(n);if(a)return a;throw this._mounts.has(n)?new Error(`Graph "${this.name}": path ends at subgraph "${n}" \u2014 not a node (GRAPHREFLY-SPEC \xA73.5)`):new Error(`Graph "${this.name}": unknown name "${n}"`)}let o=this._nodes.get(n);if(o&&s.length>0&&s[0]===q)return this._resolveMetaChainFromNode(o,s,t.join(C));let i=this._mounts.get(n);if(!i)throw this._nodes.has(n)?new Error(`Graph "${this.name}": "${n}" is a node; trailing path "${s.join(C)}" is invalid`):new Error(`Graph "${this.name}": unknown mount or node "${n}"`);return i.resolve(s.join(C))}_resolveMetaChainFromNode(e,t,n){let s=e,o=0,i=[...t];for(;o<i.length;){if(i[o]!==q)throw new Error(`Graph "${this.name}": expected ${q} segment in meta path "${n}"`);if(o+1>=i.length)throw new Error(`Graph "${this.name}": meta path requires a key after ${q} in "${n}"`);let a=i[o+1],d=s.meta[a];if(!d)throw new Error(`Graph "${this.name}": unknown meta "${a}" in path "${n}"`);s=d,o+=2}return s}signal(e,t){if(t?.internal!==!0){for(let s of e)if(this.config.messageTier(s[0])===3)throw new Error(`Graph "${this.name}": Graph.signal() rejects tier-3 messages (DATA / RESOLVED). Broadcast is for control-plane tiers (START / DIRTY / INVALIDATE / PAUSE / RESUME / COMPLETE / ERROR / TEARDOWN). For per-node value writes, use Graph.set or graph.node(name).down(...).`)}let n=[];if(this._signalDeliver(e,t??{},new Set,n),n.length>0)throw n[0]}_signalDeliver(e,t,n,s){for(let d of this._mounts.values())d._signalDeliver(e,t,n,s);let i=t.internal===!0?{internal:!0}:{actor:t.actor,delivery:"signal"},a=Gn(e,this.config);for(let d of[...this._nodes.keys()].sort()){let u=this._nodes.get(d);if(!n.has(u)){n.add(u);try{u.down(e,i)}catch(l){if(l instanceof U)throw l;s.push(l)}a.length!==0&&this._signalMetaSubtree(u,a,n,i,s)}}}_signalMetaSubtree(e,t,n,s,o){for(let i of Object.keys(e.meta).sort()){let a=e.meta[i];if(!n.has(a)){n.add(a);try{a.down(t,s)}catch(d){if(d instanceof U)throw d;o.push(d)}this._signalMetaSubtree(a,t,n,s,o)}}}describe(e){if(e?.reactive==="diff")return this._describeReactiveDiff(e);if(e?.reactive===!0)return this._describeReactive(e);let t=xn(e?.actor),n=e?.filter;if(e?.detail!=null&&e?.fields!=null)throw new TypeError("Graph.describe(): pass either `detail` or `fields`, not both. `detail: 'spec'` is the canonical spec projection; use `fields` only when you need a custom subset.");let s=it(e?.detail,e?.fields),o=e?.detail==="spec",i=s,a=[];this._collectObserveTargets("",a);let d=new Map;for(let[y,_]of a)d.set(_,y);let u=[];{let y=a.map(([,x])=>x),_=new Set(d.values()),N=0;for(;y.length>0;){let x=y.shift();if(x instanceof P)for(let k of x._deps){let E=k.node;if(d.has(E))continue;let S=E.name??"",O=S;if(!O||_.has(O))if(S){let F=2;for(;_.has(`${S}#${F}`);)F++;O=`${S}#${F}`}else for(O=`__internal__/${N++}`;_.has(O);)O=`__internal__/${N++}`;d.set(E,O),_.add(O),u.push([O,E]),y.push(E)}}}let l=[...a,...u],g={};for(let[y,_]of l){if(t!=null&&!_.allowsObserve(t))continue;let N=at(_,i,o),x=_ instanceof P?_._deps.map(O=>d.get(O.node)??O.node.name??""):[],{name:k,...E}=N,S={...E,deps:x};if(!o){let O=this._annotations.get(y);O!=null&&(S.annotation=O)}if(n!=null)if(typeof n=="function"){let O=n;if(!(O.length>=2?O(y,S):O(S)))continue}else{let O=!0;for(let[F,G]of Object.entries(n)){let R=F==="deps_includes"?"depsIncludes":F==="meta_has"?"metaHas":F;if(R==="depsIncludes"){if(!S.deps.includes(String(G))){O=!1;break}continue}if(R==="metaHas"){if(!Object.hasOwn(S.meta??{},String(G))){O=!1;break}continue}if(S[R]!==G){O=!1;break}}if(!O)continue}g[y]=S}let p=new Set(Object.keys(g)),f=[];for(let[y,_]of l)if(_ instanceof P)for(let N of _._deps){let x=d.get(N.node);x!=null&&f.push([x,y])}f.sort((y,_)=>y[0]<_[0]?-1:y[0]>_[0]?1:y[1]<_[1]?-1:y[1]>_[1]?1:0);let c=f.map(([y,_])=>({from:y,to:_}));(t!=null||n!=null)&&(c=c.filter(y=>p.has(y.from)&&p.has(y.to)));let v=this._collectSubgraphs(""),h=t!=null||n!=null?v.filter(y=>{let _=`${y}${C}`;return[...p].some(N=>N===y||N.startsWith(_))}):v,w=this,b=e;return{name:this.name,nodes:g,edges:c,subgraphs:h,...this._factory!==void 0?{factory:this._factory}:{},...this._factoryArgs!==void 0?{factoryArgs:this._factoryArgs}:{},expand(y){let _={...b};return Array.isArray(y)?(_.fields=y,_.detail=void 0):(_.detail=y,_.fields=void 0),w.describe(_)}}}_collectSubgraphs(e){let t=[];for(let n of[...this._mounts.keys()].sort()){let s=e===""?n:`${e}${n}`;t.push(s),t.push(...this._mounts.get(n)._collectSubgraphs(`${s}${C}`))}return t}resourceProfile(e){return Bt(this,e)}reachable(e,t,n={}){return n.withDetail===!0?Yt(this.describe(),e,t,{...n,withDetail:!0}):Yt(this.describe(),e,t,n)}explain(e,t,n){return n?.reactive===!0?this._explainReactive(e,t,n):this._explainStatic(Q(e),Q(t),{...n?.maxDepth!==void 0?{maxDepth:Ut(n.maxDepth)}:{},...n?.findCycle!==void 0?{findCycle:Wt(n.findCycle)}:{}})}_explainStatic(e,t,n){let s=this.describe({detail:"full"}),o=new Map(this._annotations),i=new Map;for(let[a,d]of Object.entries(s.nodes))d.lastMutation!=null&&i.set(a,d.lastMutation);return Ft(s,e,t,{...n?.maxDepth!=null?{maxDepth:n.maxDepth}:{},...n?.findCycle===!0?{findCycle:!0}:{},annotations:o,lastMutations:i})}_describeReactive(e){let t={...e,reactive:!1},n=e.reactiveName??"describe",s=0,o=ne(s,{name:`${n}_version`}),i=this.observe({timeline:!0,structured:!0}),a=!1,d=!1,u=()=>{a||d||(a=!0,de(()=>{a=!1,!d&&(s+=1,o.emit(s))}))},l=i.onEvent(b=>{let m=b.type;m!=="data"&&m!=="error"&&m!=="complete"&&m!=="teardown"||u()}),g=[],p=new WeakSet,f=b=>{if(p.has(b)||d)return;p.add(b);let m=b.topology.subscribe(y=>{for(let _ of y){if(_[0]!==I)continue;let N=_[1];if(u(),N.kind==="added"&&N.nodeKind==="mount"){let x=b._mounts.get(N.name);x!=null&&f(x)}}});g.push(m);for(let y of b._mounts.keys()){let _=b._mounts.get(y);_!=null&&f(_)}};f(this);let c,v=e.actor;Jt(v)&&(c=v.subscribe(b=>{let m=!1,y=!1;for(let _ of b){let N=_[0];N===I?m=!0:(N===H||N===M||N===L)&&(y=!0)}m&&u(),y&&(c?.(),c=void 0,u())}));let h;try{h=st([o],()=>this.describe(t),{name:n,describeKind:"derived",meta:{domain:"audit",kind:"describe"},equals:(b,m)=>b===m})}catch(b){l(),c?.();for(let m of g)m();throw i.dispose(),b}let w=De(h);return{node:h,dispose(){d=!0,l(),c?.();for(let b of g)b();g.length=0,i.dispose(),w()}}}_describeReactiveDiff(e){let t={...e,reactive:!1},n=e.reactiveName??"describe-diff",s={name:this.name,nodes:{},edges:[],subgraphs:[]},o=this.describe(t),i=dt(s,o),a=ne(i,{name:n,meta:{domain:"audit",kind:"describe-diff"},equals:(p,f)=>p===f}),d=this._describeReactive({...e,reactiveName:void 0}),u=!1,l=d.node.subscribe(p=>{if(!u)for(let f of p){if(f[0]!==I)continue;let c=f[1],v=dt(o,c);o=c,v.events.length!==0&&a.emit(v)}}),g=De(a);return{node:a,dispose(){u=!0,l(),d.dispose(),a.down([[L,"describe-diff disposed"]]),g()}}}_explainReactive(e,t,n){let s=0,o=ne(s,{name:"explain_version"}),i=this.observe({timeline:!0,structured:!0}),a=!1,d=!1,u=()=>{a||d||(a=!0,de(()=>{a=!1,!d&&(s+=1,o.emit(s))}))},l=i.onEvent(b=>{let m=b.type;m!=="data"&&m!=="error"&&m!=="complete"&&m!=="teardown"||u()}),g=[];e!=null&&re(e)&&g.push(e),t!=null&&re(t)&&g.push(t),n?.maxDepth!=null&&re(n.maxDepth)&&g.push(n.maxDepth),n?.findCycle!=null&&re(n.findCycle)&&g.push(n.findCycle);let p=()=>{for(let b of g)if(b.cache===void 0)return!1;return!0},f=()=>{let b=Q(e),m=Q(t);return{from:b,to:m,found:!1,reason:"pending",steps:[],text:"(awaiting reactive args)",toJSON:()=>({from:b,to:m,found:!1,reason:"pending",steps:[]})}},c;try{c=st([o],()=>{if(!p())return f();let b=Q(e),m=Q(t),y={...n?.maxDepth!==void 0?{maxDepth:Ut(n.maxDepth)}:{},...n?.findCycle!==void 0?{findCycle:Wt(n.findCycle)}:{}};return this._explainStatic(b,m,y)},{name:n?.name??"explain",describeKind:"derived",meta:{domain:"audit",kind:"explain_path",from:Q(e),to:Q(t)},equals:(b,m)=>b.found===m.found&&b.reason===m.reason&&b.steps.length===m.steps.length&&$n(b.steps,m.steps)})}catch(b){throw l(),i.dispose(),b}let v=De(c),h=[],w=b=>{let m;return m=b.subscribe(y=>{let _=!1,N=!1;for(let x of y){let k=x[0];k===I?_=!0:(k===H||k===M||k===L)&&(N=!0)}(_||N)&&u(),N&&m&&(m(),m=void 0)}),()=>{m&&(m(),m=void 0)}};for(let b of g)h.push(w(b));return{node:c,dispose(){d=!0,l();for(let b of h)b?.();h.length=0,i.dispose(),v()}}}_pathsMatching(e){let t=$e(e),n=[];return this._collectObserveTargets("",n),n.map(([s])=>s).filter(s=>t.test(s))}_collectObserveTargets(e,t){for(let n of[...this._mounts.keys()].sort()){let s=e===""?n:`${e}${C}${n}`;this._mounts.get(n)._collectObserveTargets(s,t)}for(let n of[...this._nodes.keys()].sort()){let s=this._nodes.get(n),o=e===""?n:`${e}${C}${n}`;t.push([o,s]),this._appendMetaObserveTargets(o,s,t)}}_appendMetaObserveTargets(e,t,n){for(let s of Object.keys(t.meta).sort()){let o=t.meta[s],i=`${e}${C}${q}${C}${s}`;n.push([i,o]),this._appendMetaObserveTargets(i,o,n)}}observe(e,t){let n=typeof e=="string",o=Kt(n?t:e);if(o.reactive===!0)return this._observeReactive(n?e:void 0,o);let i=o.structured===!0||o.timeline===!0||o.causal===!0||o.derived===!0||o.detail==="minimal"||o.detail==="full"||o.format!=null,a=o.actor;if(n){let l=e,g=this.resolve(l);if(a!=null&&!g.allowsObserve(a))throw new U({actor:a,action:"observe",nodeName:l});return i?this._buildStructuredObserver([[l,g]],o,"one"):{subscribe(p){return g.subscribe(p)},up(p){try{g.up?.(p)}catch(f){if(f instanceof U)return;throw f}}}}let d=[];this._collectObserveTargets("",d),d.sort((l,g)=>l[0]<g[0]?-1:l[0]>g[0]?1:0);let u=a==null?d:d.filter(([,l])=>l.allowsObserve(a));return i?this._buildStructuredObserver(u,o,"all"):{subscribe:l=>{let g=u.map(([p,f])=>f.subscribe(c=>{l(p,c)}));return()=>{for(let p of g)p()}},up:(l,g)=>{try{this.resolve(l).up?.(g)}catch(p){if(p instanceof U)return;throw p}}}}_observeReactive(e,t){let n=t.tiers,s=n!=null?new Set(n):null,o=t.reactiveName??"observe";return rt(i=>{let a=[],d=!1,u=!1,l=()=>{if(a.length===0||u)return;let v={events:a.slice(),flushedAt_ns:X()};a.length=0,i.emit(v)},g={...t,reactive:!1,structured:!0,timeline:!0},p=e!=null?this.observe(e,g):this.observe(g),f=v=>{u||(a.push(v),!d&&(d=!0,de(()=>{d=!1,l()})))};for(let v of p.events)f(v);let c=p.onEvent(f);return()=>{u=!0,c(),p.dispose()}},{name:o,meta:{domain:"audit",kind:"observe-reactive"}})}_buildStructuredObserver(e,t,n){let s=n==="one"?e[0]?.[0]:void 0,o=i=>{if(n==="one"&&s!=null){let l=this.resolve(s);return this._buildStructuredObserver([[s,l]],i,"one")}let a=[];this._collectObserveTargets("",a),a.sort((l,g)=>l[0]<g[0]?-1:l[0]>g[0]?1:0);let d=i.actor,u=d==null?a:a.filter(([,l])=>l.allowsObserve(d));return this._buildStructuredObserver(u,i,"all")};return this._createObserveResult(e,t,o)}_createObserveResult(e,t,n){let s=t.timeline===!0,o=t.causal===!0,i=t.derived===!0,a=t.detail==="minimal",d=this.config.inspectorEnabled,u=(o||i)&&d,l=t.maxEvents,g=l!=null&&l>0?new ye(l):null,p=[],f=new Set,c=t.tiers!=null?new Set(t.tiers):null,v={},h=new Set,w=0,b=0,m=0,y=0,_=0,N=0,x=!1,k=!1,E=0,S=new Map,O=new Map,F=new Map,G=T=>{if(!(c!=null&&!c.has(T.type))){g?g.push(T):p.push(T);for(let D of f)D(T)}},R=T=>c==null||c.has(T),se=()=>s?{timestamp_ns:X(),in_batch:Oe(),batch_id:E}:{},Ie=(T,D)=>{if(!(!u||!(T instanceof P)))return T._setInspectorHook(B=>{if(B.kind==="dep_message")S.set(T,B.depIndex);else if(B.kind==="run"){let fe=B.batchData.map((A,V)=>A!=null&&A.length>0?A.at(-1):B.prevData[V]);O.set(T,fe);let z=B.batchData.map(A=>A!=null?[...A]:void 0);F.set(T,z),i&&G({type:"derived",path:D,dep_values:fe,dep_batches:z,...se()})}})},_e=T=>{let D=S.get(T),B=O.get(T);if(!o||B==null)return{};let z=(D!=null&&D>=0&&T instanceof P?T._deps[D]:void 0)?.node,A=z?.v,V=F.get(T);return{trigger_dep_index:D,trigger_dep_name:z?.name,...A!=null?{trigger_version:{id:A.id,version:A.version}}:{},dep_values:[...B],...V!=null?{dep_batches:V}:{}}},ft=[],pt=[];for(let[T,D]of e){let B=Ie(D,T);B&&ft.push(B),pt.push(D.subscribe(fe=>{E++;for(let z of fe){let A=z[0],V=se();if(A===I){v[T]=z[1];let Ve=D instanceof P?D.lastMutation?.actor??ie:ie;G({type:"data",path:T,data:z[1],actor:Ve,...V,..._e(D)})}else if(a)A===K?R("dirty")&&w++:A===Y?R("resolved")&&b++:A===W?R("invalidate")&&m++:A===J?R("pause")&&y++:A===Z?R("resume")&&_++:A===L?R("teardown")&&N++:A===H&&!h.has(T)?R("complete")&&(x=!0):A===M&&R("error")&&(k=!0,h.add(T));else if(A===K)R("dirty")&&w++,G({type:"dirty",path:T,...V});else if(A===Y)R("resolved")&&b++,G({type:"resolved",path:T,...V,..._e(D)});else if(A===W)R("invalidate")&&m++,G({type:"invalidate",path:T,...V});else if(A===J)R("pause")&&y++,G({type:"pause",path:T,lockId:z[1],...V});else if(A===Z)R("resume")&&_++,G({type:"resume",path:T,lockId:z[1],...V});else if(A===H)R("complete")&&!h.has(T)&&(x=!0),G({type:"complete",path:T,...V});else if(A===M){R("error")&&(k=!0,h.add(T));let Ve=D instanceof P?D.lastMutation?.actor??ie:ie;G({type:"error",path:T,data:z[1],actor:Ve,...V})}else A===L&&(R("teardown")&&N++,G({type:"teardown",path:T,...V}))}}))}let Fe=!1,Le=()=>{if(!Fe){Fe=!0;for(let T of pt)T();for(let T of ft)T();for(let T of we)T({value:void 0,done:!0});we.length=0}},je=[],we=[];f.add(T=>{let D=we.shift();D?D({value:T,done:!1}):je.push(T)});let ht={get values(){return v},get dirtyCount(){return w},get resolvedCount(){return b},get invalidateCount(){return m},get pauseCount(){return y},get resumeCount(){return _},get teardownCount(){return N},get events(){return g?g.toArray():[...p]},get anyCompletedCleanly(){return x},get anyErrored(){return k},get completedWithoutErrors(){return x&&!k},onEvent(T){return f.add(T),()=>f.delete(T)},dispose:Le,expand(T){Le();let D={...t};return typeof T=="string"?D.detail=T:Object.assign(D,T),n(Kt(D))},[Symbol.asyncIterator](){return{next(){return je.length>0?Promise.resolve({value:je.shift(),done:!1}):Fe?Promise.resolve({value:void 0,done:!0}):new Promise(T=>we.push(T))},return(){return Le(),Promise.resolve({value:void 0,done:!0})}}}};return t.format!=null&&this._attachFormatLogger(ht,t),ht}_attachFormatLogger(e,t){let n=t.format;if(n==null)return;let s=t.logger??(c=>console.log(c)),o=t.includeTypes?new Set(t.includeTypes):null,i=t.excludeTypes?new Set(t.excludeTypes):null,a=o==null&&i==null?()=>!0:c=>(o==null||o.has(c))&&(i==null||!i.has(c)),d=Dn(t.theme),u=n==="stage-log"?X():0,l=c=>c==null?"":t.stageLabels?.[c]??c,g=(c,v)=>c.length>v?`${c.slice(0,v-1)}\u2026`:c,p=c=>c.type==="data"||c.type==="error"?g(ct(c.data),120):"",f=c=>{if(n==="stage-log"){let x=(X()-u)/1e9,k=l(c.path).padEnd(9);if(c.type==="data"){let E=p(c);return`[${x.toFixed(3)}s] ${k} \u2190${E?` ${E}`:""}`}if(c.type==="error"){let E=p(c);return`[${x.toFixed(3)}s] ${k} \u2717${E?` ${E}`:""}`}return c.type==="complete"?`[${x.toFixed(3)}s] ${k} \u25A0 complete`:`[${x.toFixed(3)}s] ${k} ${c.type}`}if(n==="json")try{return JSON.stringify(c)}catch{return JSON.stringify({type:c.type,path:c.path,data:"[unserializable]"})}let v=d[c.type]??"",h=c.path?`${d.path}${c.path}${d.reset} `:"",w=c.type==="data"||c.type==="error",b=c.type==="pause"||c.type==="resume",m=w?` ${ct(c.data)}`:b?` ${ct(c.lockId)}`:"",y=c.type==="data"||c.type==="resolved"||c.type==="derived"?c:void 0,_=y?.trigger_dep_name!=null?` <- ${y.trigger_dep_name}`:y?.trigger_dep_index!=null?` <- #${y.trigger_dep_index}`:"",N=c.in_batch?" [batch]":"";return`${h}${v}${c.type.toUpperCase()}${d.reset}${m}${_}${N}`};e.onEvent(c=>{a(c.type)&&s(f(c),c)})}addDisposer(e){return this._disposers.add(e),()=>{this._disposers.delete(e)}}destroy(){zt(this._disposers,this.name),this.signal([[L]],{internal:!0}),zt(this._storageDisposers,this.name);for(let e of[...this._mounts.values()])e._parent=void 0,e._destroyClearOnly();this._mounts.clear(),this._nodes.clear(),this._parent=void 0,this._destroyed=!0}get destroyed(){return this._destroyed}_destroyClearOnly(){for(let e of[...this._mounts.values()])e._parent=void 0,e._destroyClearOnly();this._mounts.clear(),this._nodes.clear(),this._parent=void 0,this._destroyed=!0}snapshot(e){let{expand:t,...n}=this.describe({detail:"full"}),s={};for(let a of Object.keys(n.nodes).sort()){let{lastMutation:d,guard:u,...l}=n.nodes[a];s[a]=l}let o=[...n.subgraphs].sort(),i={...n,version:1,nodes:s,subgraphs:o};if(e?.format==null)return i;if(e.format==="json-string")return JSON.stringify(i);if(e.format==="bytes"){if(e.codec==null)throw new Error("snapshot({format: 'bytes'}) requires a `codec` name");let a=this.config.lookupCodec(e.codec);if(a==null)throw new Error(`snapshot: codec "${e.codec}" is not registered on this graph's config. Call config.registerCodec(...) before creating nodes.`);return vt(a,a.encode(i))}throw new Error(`snapshot: unknown format "${String(e.format)}"`)}static decode(e,t){let n=t?.config??ce,{codec:s,codecVersion:o,payload:i}=_t(e,n);return s.decode(i,o)}restore(e,t){if(qt(e),e.name!==this.name)throw new Error(`Graph "${this.name}": restore snapshot name "${e.name}" does not match this graph`);let n=t?.only==null?null:(Array.isArray(t.only)?t.only:[t.only]).map(o=>$e(o)),s=t?.includeProducers===!0;for(let o of Object.keys(e.nodes).sort()){if(n!==null&&!n.some(a=>a.test(o)))continue;let i=e.nodes[o];if(i!==void 0){if(!("value"in i)||i.value===void 0){"value"in i&&i.value===void 0&&t?.onError?.(o,new Error(`restore: slice.value is undefined for "${o}" (undefined is the global SENTINEL; not valid DATA)`));continue}if(!(i.type==="derived"||i.type==="effect")&&!(i.type==="producer"&&!s)){if(i.v!=null){let d=this.tryResolve(o)?.v;if(d!=null&&d.id===i.v.id&&d.version===i.v.version)continue}try{this.set(o,i.value)}catch(a){t?.onError?.(o,a)}}}}}static fromSnapshot(e,t){qt(e);let n=typeof t=="function"?t:t?.build,s=typeof t=="function"?void 0:t?.factories,o=new r(e.name);if(n)return n(o),o.restore(e),o;for(let f of[...e.subgraphs].sort((c,v)=>{let h=c.split(C).length,w=v.split(C).length;return h!==w?h-w:c<v?-1:c>v?1:0})){let c=f.split(C),v=o;for(let h of c)v._mounts.has(h)||v.mount(h,new r(h)),v=v._mounts.get(h)}let i=s?Object.entries(s).map(([f,c])=>({re:$e(f),factory:c})):[],a=f=>{for(let c of i)if(c.re.test(f))return c.factory},d=f=>{let c=f.split(C),v=c.pop();if(v==null||v.length===0)throw new Error(`invalid snapshot path "${f}"`);let h=o;for(let w of c){let b=h._mounts.get(w);if(!b)throw new Error(`unknown mount "${w}" in path "${f}"`);h=b}return[h,v]},u=Object.entries(e.nodes).filter(([f])=>!f.includes(`${C}${q}${C}`)).sort((f,c)=>f[0]<c[0]?-1:f[0]>c[0]?1:0),l=new Map(u),g=new Map,p=!0;for(;l.size>0&&p;){p=!1;for(let[f,c]of[...l.entries()]){let v=c?.deps??[];if(!v.every(_=>g.has(_)))continue;let[h,w]=d(f),b={...c?.meta??{}},m=a(f),y;if(c?.type==="state")y=ne(c.value,{meta:b});else{if(m==null)continue;y=m(w,{path:f,type:c.type,value:c.value,meta:b,deps:v,resolvedDeps:v.map(_=>g.get(_))})}h.add(y,{name:w}),g.set(f,y),l.delete(f),p=!0}}if(l.size>0){let f=[...l.keys()].sort().join(", ");throw new Error(`Graph.fromSnapshot could not reconstruct nodes without build callback: ${f}. Pass matching factories via fromSnapshot(data, { factories: { pattern: factoryFn } }).`)}return o.restore(e),o}toJSON(){return this.snapshot()}attachSnapshotStorage(e,t={}){let n=e.map(u=>({tier:u,debounceMs:Math.max(0,u.debounceMs??0),compactEvery:Math.max(1,u.compactEvery??10),timer:void 0,seq:0,lastSnapshot:void 0,lastFingerprint:"",disposed:!1,savePending:void 0}));t.autoRestore===!0&&this._cascadeRestore(e,t.onError);let s=(u,l)=>{if(u.disposed)return;let g=kn(l.nodes);if(u.lastSnapshot!=null&&g!==""&&g===u.lastFingerprint)return;let p=u.seq+1,f=xe(),h=u.lastSnapshot==null||p%u.compactEvery===0?{name:this.name,mode:"full",snapshot:l,seq:p,timestamp_ns:f,format_version:le}:{name:this.name,mode:"diff",diff:Pn(u.lastSnapshot,l),seq:p,timestamp_ns:f,format_version:le};if(u.tier.filter&&!u.tier.filter(h))return;let w;try{w=u.tier.save(h)}catch(b){t.onError?.(b,u.tier);return}if(w&&typeof w.then=="function"){let y=(u.savePending??Promise.resolve()).then(()=>w,()=>w).then(()=>{u.disposed||(u.seq=p,u.lastSnapshot=l,u.lastFingerprint=g)},_=>{t.onError?.(_,u.tier)});u.savePending=y.finally(()=>{u.savePending===y&&(u.savePending=void 0)})}else u.seq=p,u.lastSnapshot=l,u.lastFingerprint=g},o=(u,l)=>{try{s(u,l)}catch(g){t.onError?.(g,u.tier)}},i=(u,l)=>{if(!l.some(c=>{let v=this.config.messageTier(c[0]);return v>=3&&v<5}))return;if(t.filter){let c=this.tryResolve(u);if(c==null)return;let v=at(c,it("standard"));if(!t.filter(u,v))return}let p,f=()=>(p==null&&(p=this.snapshot()),p);for(let c of n)c.disposed||(c.debounceMs===0?o(c,f()):(c.timer==null&&(c.timer=new Ce),c.timer.start(c.debounceMs,()=>{c.disposed||o(c,this.snapshot())})))},a;if(t.paths!=null){let l=(typeof t.paths=="string"?this._pathsMatching(t.paths):t.paths).map(g=>{let p=this.tryResolve(g);return p==null?()=>{}:p.subscribe(f=>i(g,f))});a=()=>{for(let g of l)g()}}else a=this.observe().subscribe((u,l)=>i(u,l));let d=()=>{a();for(let u of n)u.disposed=!0,u.timer?.cancel();this._storageDisposers.delete(d)};return this._storageDisposers.add(d),{dispose:d}}async _cascadeRestore(e,t){for(let n of e){let s;try{s=await n.load?.()}catch(i){t?.(i,n);continue}if(s==null||typeof s!="object"||Array.isArray(s))continue;let o=s;try{if(o.mode==="full"&&o.snapshot!=null)return this.restore(o.snapshot),!0;if(o.version===le&&o.nodes!=null)return this.restore(o),!0}catch(i){t?.(i,n)}}return!1}static async fromStorage(e,t,n){for(let s of t){let o;try{o=await s.load?.()}catch(d){n?.onError?.(d,s);continue}if(o==null||typeof o!="object"||Array.isArray(o))continue;let i=o,a=i.mode==="full"&&i.snapshot!=null?i.snapshot:i.version===le&&i.nodes!=null?i:void 0;if(a!=null)try{return r.fromSnapshot(a,n)}catch(d){n?.onError?.(d,s)}}throw new Error(`Graph.fromStorage: no tier held a restorable record for "${e}" across ${t.length} tier(s)`)}_annotations=new Map;_traceRing;trace(e,t,n){if(e!=null&&t!=null){if(this.tryResolve(e)==null)return;if(this._annotations.set(e,t),this.config.inspectorEnabled){let s={path:e,annotation:t,timestamp_ns:X(),...n?.actor!=null?{actor:n.actor}:{}};this._traceRing.push(s)}return}return e!=null?this.config.inspectorEnabled?this._annotations.get(e):void 0:this.config.inspectorEnabled?this._traceRing.toArray():[]}annotation(e){return this._annotations.get(e)}clearTrace(){this._annotations.clear(),this._traceRing.clear()}pruneTrace(e){let t=this._traceRing.toArray().filter(s=>!e(s)),n=this._traceRing.size-t.length;this._traceRing.clear();for(let s of t)this._traceRing.push(s);return n}static diff(e,t){let n=new Set(Object.keys(e.nodes)),s=new Set(Object.keys(t.nodes)),o=[...s].filter(b=>!n.has(b)).sort(),i=[...n].filter(b=>!s.has(b)).sort(),a=[],d=[];for(let b of n){if(!s.has(b))continue;let m=e.nodes[b],y=t.nodes[b],_=m.v,N=y.v;_!=null&&N!=null&&_.id===N.id&&_.version!==N.version&&d.push({path:b,id:_.id,from:_.version,to:N.version});let x=_!=null&&N!=null&&_.id===N.id&&_.version===N.version;for(let k of["type","status","sentinel"]){let E=m[k],S=y[k];E!==S&&a.push({path:b,field:k,from:E,to:S})}if(!x)for(let k of["value","meta"]){let E=m[k],S=y[k];En(E,S)||a.push({path:b,field:k,from:E,to:S})}}let u=b=>`${b.from} ${b.to}`,l=new Set(e.edges.map(u)),g=new Set(t.edges.map(u)),p=t.edges.filter(b=>!l.has(u(b))),f=e.edges.filter(b=>!g.has(u(b))),c=new Set(e.subgraphs),v=new Set(t.subgraphs),h=[...v].filter(b=>!c.has(b)).sort(),w=[...c].filter(b=>!v.has(b)).sort();return{nodesAdded:o,nodesRemoved:i,nodesChanged:a,versionChanges:d,edgesAdded:p,edgesRemoved:f,subgraphsAdded:h,subgraphsRemoved:w}}};function Pn(r,e){let t=ve.diff(r,e),n={};for(let s of t.nodesAdded){let o=e.nodes[s];o!=null&&(n[s]=o)}return{...t,nodesAddedFull:n}}function Yt(r,e,t,n={}){let s={paths:[],depths:new Map,truncated:!1};if(!e)return n.withDetail?s:[];if(!n.both&&t!=="upstream"&&t!=="downstream")throw new Error('reachable: direction must be "upstream" or "downstream"');let o=n.maxDepth;if(o!=null&&(!Number.isInteger(o)||o<0))throw new Error("reachable: maxDepth must be an integer >= 0");if(o===0)return n.withDetail?s:[];let i=new Map,a=new Map,d=new Map,u=new Map,l=new Set;for(let[m,y]of Object.entries(r.nodes)){if(!m)continue;l.add(m);let _=y.deps??[];i.set(m,_);for(let N of _)N&&(l.add(N),a.has(N)||a.set(N,new Set),a.get(N).add(m))}for(let m of r.edges){if(m==null||typeof m!="object")continue;let y=typeof m.from=="string"?m.from:"",_=typeof m.to=="string"?m.to:"";!y||!_||(l.add(y),l.add(_),u.has(y)||u.set(y,new Set),u.get(y).add(_),d.has(_)||d.set(_,new Set),d.get(_).add(y))}if(!l.has(e))return n.withDetail?s:[];let g=n.both===!0,p=m=>{if(g){let x=i.get(m)??[],k=d.get(m),E=a.get(m),S=u.get(m),O=[...x];return k&&O.push(...k),E&&O.push(...E),S&&O.push(...S),O}if(t==="upstream"){let x=i.get(m)??[],k=d.get(m);return k?[...x,...k]:x}let y=a.get(m),_=u.get(m),N=y?[...y]:[];return _&&N.push(..._),N},f=new Set([e]),c=new Map,v=[{path:e,depth:0}],h=0,w=!1;for(;h<v.length;){let m=v[h++];if(o!=null&&m.depth>=o){p(m.path).length>0&&(w=!0);continue}for(let y of p(m.path))!y||f.has(y)||(f.add(y),c.set(y,m.depth+1),v.push({path:y,depth:m.depth+1}))}let b=[...c.keys()].sort((m,y)=>m<y?-1:m>y?1:0);return n.withDetail?{paths:b,depths:c,truncated:w}:b}function $n(r,e){if(r.length!==e.length)return!1;for(let t=0;t<r.length;t++){let n=r[t],s=e[t];if(n.path!==s.path||n.type!==s.type||n.status!==s.status||n.hop!==s.hop||n.dep_index!==s.dep_index||n.annotation!==s.annotation||n.value!==s.value||n.lastMutation!==s.lastMutation)return!1;let o=n.v,i=s.v;if(o!==i&&(o==null||i==null||o.id!==i.id||o.version!==i.version))return!1}return!0}var In=()=>!1;function Fn(r){let e=new ve("zustand"),t=ne(void 0,{name:"state",equals:In});e.add(t,{name:"state"});let n=()=>t.cache,s=(a,d)=>{let u=t.cache,l=typeof a=="function"?a(u):a;t.emit(d?l:{...u,...l})},o={getState:n,setState:s,getInitialState:()=>i,subscribe:a=>{let d=!0,u=t.cache;return t.subscribe(l=>{for(let[g,p]of l)if(g===I){if(d){d=!1;continue}a(p,u),u=p}})},destroy:e.destroy.bind(e)},i=r(s,n,o);return t.emit(i),Object.assign(e,o)}0&&(module.exports={create});
|
|
1
|
+
"use strict";var He=Object.defineProperty;var rn=Object.getOwnPropertyDescriptor;var sn=Object.getOwnPropertyNames;var on=Object.prototype.hasOwnProperty;var P=(r,e)=>()=>(r&&(e=r(r=0)),e);var an=(r,e)=>{for(var t in e)He(r,t,{get:e[t],enumerable:!0})},un=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of sn(e))!on.call(r,s)&&s!==t&&He(r,s,{get:()=>e[s],enumerable:!(n=rn(e,s))||n.enumerable});return r};var dn=r=>un(He({},"__esModule",{value:!0}),r);var pe,F,K,Y,W,J,Z,j,H,M,oe,Be,cn,ze,ln,fn,Ue,gt,mt,bt,We,he=P(()=>{"use strict";pe=Symbol.for("graphrefly/START"),F=Symbol.for("graphrefly/DATA"),K=Symbol.for("graphrefly/DIRTY"),Y=Symbol.for("graphrefly/RESOLVED"),W=Symbol.for("graphrefly/INVALIDATE"),J=Symbol.for("graphrefly/PAUSE"),Z=Symbol.for("graphrefly/RESUME"),j=Symbol.for("graphrefly/TEARDOWN"),H=Symbol.for("graphrefly/COMPLETE"),M=Symbol.for("graphrefly/ERROR"),oe=Object.freeze([K]),Be=Object.freeze([Y]),cn=Object.freeze([W]),ze=Object.freeze([pe]),ln=Object.freeze([H]),fn=Object.freeze([j]),Ue=Object.freeze([oe]),gt=Object.freeze([Be]),mt=Object.freeze([cn]),bt=Object.freeze([ln]),We=Object.freeze([fn])});function vt(r,e){let t=new TextEncoder().encode(r.name);if(t.length===0||t.length>255)throw new Error(`encodeEnvelope: codec name "${r.name}" encodes to ${t.length} bytes (must be 1\u2013255)`);let n=r.version;if(!Number.isInteger(n)||n<0||n>65535)throw new Error(`encodeEnvelope: codec.version ${n} out of u16 range (expected integer 0\u201365535)`);let s=2+t.length+2+e.length;if(s>4294967295)throw new Error(`encodeEnvelope: total envelope size ${s} exceeds 2^32-1 bytes (payload ${e.length} bytes)`);let o=new Uint8Array(s),i=0;return o[i++]=qe,o[i++]=t.length,o.set(t,i),i+=t.length,o[i++]=n>>>8&255,o[i++]=n&255,o.set(e,i),o}function _t(r,e){if(r.length<yt)throw new Error(`decodeEnvelope: bytes too short (${r.length} < ${yt})`);let t=0,n=r[t++];if(n!==qe)throw new Error(`decodeEnvelope: unsupported envelope version ${n} (expected ${qe})`);let s=r[t++];if(s===0)throw new Error("decodeEnvelope: name_len must be >= 1");if(t+s+2>r.length)throw new Error(`decodeEnvelope: envelope truncated (need ${t+s+2} bytes, have ${r.length})`);let o=new TextDecoder().decode(r.subarray(t,t+s));t+=s;let i=(r[t]<<8|r[t+1])>>>0;t+=2;let a=r.subarray(t),d=e.lookupCodec(o);if(d==null)throw new Error(`decodeEnvelope: codec "${o}" not registered (envelope codec_v=${i})`);return{codec:d,codecVersion:i,payload:a}}function wt(r){r.registerCodec(pn)}var pn,qe,yt,Ke=P(()=>{"use strict";pn={name:"json",version:1,contentType:"application/json",encode(r){let e=JSON.stringify(r);return new TextEncoder().encode(e)},decode(r,e){let t=new TextDecoder().decode(r);return JSON.parse(t)}},qe=1,yt=4});function Te(r){if(r==null)return ie;let{type:e,id:t,...n}=r;return{type:e??"system",id:t??"",...n}}var ie,Ye=P(()=>{"use strict";ie={type:"system",id:""}});function Oe(){return ae>0||ge}function Tt(){return ae>0}function de(r){ae>0?me.push(r):r()}function Ot(r){ae+=1;let e=!1;try{r()}catch(t){throw e=!0,t}finally{if(ae-=1,ae===0)if(e){if(!ge){let t=me.splice(0);for(let n of t)try{n()}catch{}ee.length=0,te.length=0,ue.length=0}}else hn()}}function hn(){let r=!ge;r&&(ge=!0);let e=[],t=0;try{for(;ee.length>0||te.length>0||ue.length>0||r&&me.length>0;){if(r&&me.length>0){let o=me.splice(0);for(let i of o)try{i()}catch(a){e.push(a)}continue}if(t+=1,t>1e3)throw ee.length=0,te.length=0,ue.length=0,new Error("batch drain exceeded 1000 iterations \u2014 likely a reactive cycle");let s=(ee.length>0?ee:te.length>0?te:ue).splice(0);for(let o of s)try{o()}catch(i){e.push(i)}}}finally{r&&(ge=!1)}if(e.length===1)throw e[0];if(e.length>1)throw new AggregateError(e,"batch drain: multiple callbacks threw")}function Ne(r,e,t){if(e.length===0)return;if(e.length===1){let u=t(e[0][0]);if(u<3||!Oe()){r(e);return}(u>=5?ue:u===4?te:ee).push(()=>r(e));return}let n=e.length,s=n,o=n,i=n,a=0;for(;a<n&&t(e[a][0])<3;)a++;for(s=a;a<n&&t(e[a][0])===3;)a++;for(o=a;a<n&&t(e[a][0])===4;)a++;i=a;let d=Oe();if(s>0){let u=e.slice(0,s);r(u)}if(o>s){let u=e.slice(s,o);d?ee.push(()=>r(u)):r(u)}if(i>o){let u=e.slice(o,i);d?te.push(()=>r(u)):r(u)}if(n>i){let u=e.slice(i,n);d?ue.push(()=>r(u)):r(u)}}var ae,ge,ee,te,ue,me,Je=P(()=>{"use strict";ae=0,ge=!1,ee=[],te=[],ue=[],me=[]});function X(){return Math.trunc(performance.now()*1e6)}function xe(){return Date.now()*1e6}var ke=P(()=>{"use strict"});function Nt(r){r.registerMessageType(pe,{tier:0,wireCrossing:!1}),r.registerMessageType(K,{tier:1,wireCrossing:!1}),r.registerMessageType(W,{tier:1,wireCrossing:!1,metaPassthrough:!1}),r.registerMessageType(J,{tier:2,wireCrossing:!1}),r.registerMessageType(Z,{tier:2,wireCrossing:!1}),r.registerMessageType(F,{tier:3,wireCrossing:!0}),r.registerMessageType(Y,{tier:3,wireCrossing:!0}),r.registerMessageType(H,{tier:4,wireCrossing:!0,metaPassthrough:!1}),r.registerMessageType(M,{tier:4,wireCrossing:!0,metaPassthrough:!1}),r.registerMessageType(j,{tier:5,wireCrossing:!0,metaPassthrough:!1})}var Ee,xt=P(()=>{"use strict";he();Ee=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 n=this._messageTypes.get(t);return n!=null?n.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 Xe(r){let e=gn.filter(t=>r({type:t,id:""},"write"));return e.length===0?"restricted":e.includes("human")&&e.includes("llm")&&e.every(t=>t==="human"||t==="llm"||t==="system")?"both":e.length===1?e[0]:e.join("+")}var U,gn,Se=P(()=>{"use strict";U=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}},gn=["human","llm","wallet","system"]});function Ze(r){if(r===void 0)return null;if(typeof r=="number"){if(!Number.isFinite(r))throw new TypeError(`Cannot hash non-finite number: ${r}`);if(Number.isInteger(r)&&!Number.isSafeInteger(r))throw new TypeError(`Cannot hash integer outside safe range (|n| > 2^53-1): ${r}. Cross-language cid parity is not guaranteed for unsafe integers.`);return r}if(typeof r=="string"||typeof r=="boolean"||r===null)return r;if(Array.isArray(r))return r.map(Ze);if(typeof r=="object"&&r!==null){let e={};for(let t of Object.keys(r).sort())e[t]=Ze(r[t]);return e}return null}function yn(r){let e=bn.encode(r),t=e.length,n=t*8,s=t+9+63&-64,o=new Uint8Array(s);o.set(e),o[t]=128;let i=new DataView(o.buffer);i.setUint32(s-4,n>>>0,!1),i.setUint32(s-8,Math.floor(n/4294967296)>>>0,!1);let a=1779033703,d=3144134277,u=1013904242,l=2773480762,g=1359893119,p=2600822924,f=528734635,c=1541459225,v=new Uint32Array(64),h=(b,m)=>b>>>m|b<<32-m;for(let b=0;b<s;b+=64){for(let O=0;O<16;O++)v[O]=i.getUint32(b+O*4,!1);for(let O=16;O<64;O++){let L=v[O-15],G=v[O-2],R=h(L,7)^h(L,18)^L>>>3,se=h(G,17)^h(G,19)^G>>>10;v[O]=v[O-16]+R+v[O-7]+se>>>0}let m=a,y=d,_=u,N=l,x=g,k=p,E=f,S=c;for(let O=0;O<64;O++){let L=h(x,6)^h(x,11)^h(x,25),G=x&k^~x&E,R=S+L+G+mn[O]+v[O]>>>0,se=h(m,2)^h(m,13)^h(m,22),Ie=m&y^m&_^y&_,_e=se+Ie>>>0;S=E,E=k,k=x,x=N+R>>>0,N=_,_=y,y=m,m=R+_e>>>0}a=a+m>>>0,d=d+y>>>0,u=u+_>>>0,l=l+N>>>0,g=g+x>>>0,p=p+k>>>0,f=f+E>>>0,c=c+S>>>0}let w=b=>b.toString(16).padStart(8,"0");return w(a)+w(d)+w(u)+w(l)+w(g)+w(p)+w(f)+w(c)}function Qe(r){let e=Ze(r??null),t=JSON.stringify(e);return yn(t).slice(0,16)}function vn(){let r=globalThis.crypto;if(r?.randomUUID)return r.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 et(r,e,t){let n=t?.id??vn();if(r===0)return{id:n,version:0};let o=(t?.hash??Qe)(e);return{id:n,version:0,cid:o,prev:null}}function kt(r,e,t){r.version+=1,"cid"in r&&(r.prev=r.cid,r.cid=t(e))}var mn,bn,Et=P(()=>{"use strict";mn=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]),bn=new TextEncoder});function Rt(r){return{node:r,unsub:null,prevData:void 0,dirty:!1,involvedThisWave:!1,dataBatch:[],terminal:void 0}}function tt(r){r.prevData=void 0,r.dirty=!1,r.involvedThisWave=!1,r.dataBatch.length=0,r.terminal=void 0}function Ae(r){return r.length===0?r:typeof r[0]=="symbol"?[r]:r}function Re(r,e,t){let n=Dt(r)?r:[],s=typeof r=="function"?r:typeof e=="function"?e:void 0,o={};return Dt(r)?o=(nt(e)?e:t)??{}:nt(r)?o=r:o=(nt(e)?e:t)??{},new $(n,s,o)}var St,At,_n,wn,ce,$,Dt,nt,be=P(()=>{"use strict";Ke();Ye();Je();ke();xt();Se();he();Et();St=()=>{},At=100;_n=(r,e,t,n)=>{t.direction==="down-in"&&r._onDepMessage(t.depIndex,e)},wn=(r,e,t,n)=>{let s=r;if(s._status==="completed"||s._status==="errored")return;let o=s._cached,i=o===void 0?[ze]:[ze,[F,o]];s._status==="dirty"&&i.push(oe),Ne(e,i,s._config.tierOf)},ce=new Ee({onMessage:_n,onSubscribe:wn});Nt(ce);wt(ce);$=class r{_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,n){this._config=n.config??ce,this._config.onMessage,this._optsName=n.name,this._describeKind=n.describeKind,this._equals=n.equals??Object.is,this._resubscribable=n.resubscribable??!1,this._resetOnTeardown=n.resetOnTeardown??!1,this._autoComplete=n.completeWhenDepsComplete??!0,this._autoError=n.errorWhenDepsError??!0,this._pausable=n.pausable??!0,this._guard=n.guard,this._fn=t,this._partial=n.partial??!1,this._cached=n.initial!==void 0?n.initial:void 0,this._status=e.length===0&&t==null&&this._cached!==void 0?"settled":"sentinel",this._hashFn=n.versioningHash??this._config.defaultHashFn??Qe;let s=n.versioning??this._config.defaultVersioning;this._versioningLevel=s,this._versioning=s!=null?et(s,this._cached===void 0?void 0:this._cached,{id:n.versioningId,hash:this._hashFn}):void 0,this._deps=e.map(Rt);let o={};for(let[a,d]of Object.entries(n.meta??{})){let u={initial:d,name:`${n.name??"node"}:meta:${a}`,describeKind:"state",config:this._config};n.guard!=null&&(u.guard=n.guard),o[a]=new r([],void 0,u)}Object.freeze(o),this.meta=o,this._hasMeta=Object.keys(o).length>0;let i=this;this._actions={emit(a){i._emit([[F,a]])},down(a){i._emit(Ae(a))},up(a){i._emitUp(Ae(a))}},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 n=this._versioningLevel;if(n!=null&&e<=n)return;let s=t?.hash??this._hashFn;s!==this._hashFn&&(this._hashFn=s);let o=this._cached===void 0?void 0:this._cached,i=this._versioning,a=i?.id??t?.id,d=i?.version??0,u=et(e,o,{id:a,hash:s});u.version=d,this._versioning=u,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=Te(e);if(this._guard!=null&&!this._guard(t,"observe"))return!1;if(this._extraGuards!=null){for(let n of this._extraGuards)if(!n(t,"observe"))return!1}return!0}_checkGuard(e){if(e?.internal)return;let t=this._guard!=null||this._extraGuards!=null,n=e?.actor!=null;if(!t&&!n)return;let s=Te(e?.actor),o=e?.delivery==="signal"?"signal":"write";if(this._guard!=null&&!this._guard(s,o))throw new U({actor:s,action:o,nodeName:this.name});if(this._extraGuards!=null){for(let i of this._extraGuards)if(!i(s,o))throw new U({actor:s,action:o,nodeName:this.name})}this._lastMutation={actor:s,timestamp_ns:xe()}}down(e,t){let n=Ae(e);n.length!==0&&(this._checkGuard(t),this._emit(n))}emit(e,t){this._checkGuard(t),this._emit([[F,e]])}up(e,t){if(this._deps.length===0)return;let n=Ae(e);if(n.length===0)return;this._checkGuard(t);let s=t??{internal:!0};this._validateUpTiers(n);for(let o of this._deps)o.node.up?.(n,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 n of e){let s=t(n[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=Te(t);if(!this._guard(d,"observe"))throw new U({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)tt(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 o;try{o=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 i=this._isTerminal;if(this._sinkCount===1&&!i)try{this._activate()}catch(d){if(this._sinkCount-=1,this._removeSink(e),this._sinkCount===0&&(this._status="sentinel"),typeof o=="function")try{o()}catch{}throw d}this._status==="sentinel"&&this._cached===void 0&&(this._status="pending");let a=!1;return()=>{a||(a=!0,this._sinkCount-=1,this._removeSink(e),typeof o=="function"&&o(),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 n=0;n<e;n++){let s=n,o=this._deps[n];o.unsub=St,o.unsub=o.node.subscribe(i=>{if(o.unsub===null)return;let a=this._config.tierOf,d=!1;for(let u of i)a(u[0])>=3&&(d=!0),this._config.onMessage(this,u,{direction:"down-in",depIndex:s},this._actions);d&&this._maybeRunFnOnSettlement()}),t++}}catch(n){this._deps[t].unsub=null;for(let s=0;s<t;s++){let o=this._deps[s];if(o.unsub!=null){let i=o.unsub;o.unsub=null;try{i()}catch{}tt(o)}}throw this._dirtyDepCount=0,n}}_addDep(e){for(let s=0;s<this._deps.length;s++)if(this._deps[s].node===e)return s;let t=this._deps.length,n=Rt(e);if(this._deps.push(n),this._sinks==null)return t;n.dirty=!0,this._dirtyDepCount++,this._status!=="dirty"&&this._emit(Ue),n.unsub=St;try{n.unsub=e.subscribe(s=>{if(n.unsub===null)return;let o=this._config.tierOf,i=!1;for(let a of s)o(a[0])>=3&&(i=!0),this._config.onMessage(this,a,{direction:"down-in",depIndex:t},this._actions);i&&this._maybeRunFnOnSettlement()})}catch(s){throw n.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(n){this._emit([[M,this._wrapFnError("cleanup threw",n)]])}else if(t!=null&&typeof t=="object"){let n=t.deactivate;if(typeof n=="function")try{n()}catch(s){this._emit([[M,this._wrapFnError("cleanup.deactivate threw",s)]])}}for(let n of this._deps){if(n.unsub!=null){let s=n.unsub;n.unsub=null;try{s()}catch{}}tt(n)}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 n=this._deps[e],s=t[0];if(this._inspectorHooks!=null){let o={kind:"dep_message",depIndex:e,message:t};for(let i of this._inspectorHooks)i(o)}if(s!==pe){if(s===K){this._depDirtied(n);return}if(s===W){if(this._depInvalidated(n),this._cached===void 0)return;this._emit(mt);return}if(s===J||s===Z){this._emit([t]);return}if(s===j){this._emit(We);return}if(s===F)this._depSettledAsData(n,t[1]);else if(s===Y)this._depSettledAsResolved(n);else if(s===H)this._depSettledAsTerminal(n,!0);else if(s===M)this._depSettledAsTerminal(n,t[1]);else{this._emit([t]);return}if(!this._fn){(s===F||s===Y)&&this._emit([t]),(s===H||s===M)&&this._maybeAutoTerminalAfterWave();return}}}_depDirtied(e){e.dirty||(e.dirty=!0,e.involvedThisWave=!0,this._dirtyDepCount++,this._status!=="dirty"&&this._emit(Ue))}_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(gt),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([[M,e.terminal]]);return}this._autoComplete&&this._deps.every(t=>t.terminal!==void 0)&&this._emit(bt)}_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(i){this._emit([[M,this._wrapFnError("cleanup threw",i)]]);return}}else if(e!=null&&typeof e=="object"){let i=e.beforeRun;if(typeof i=="function"){e.beforeRun=void 0;try{i()}catch(a){this._emit([[M,this._wrapFnError("cleanup.beforeRun threw",a)]]);return}}}let t=this._deps.map(i=>i.involvedThisWave?i.dataBatch.length>0?[...i.dataBatch]:[]:void 0),n=this._deps.map(i=>i.prevData);for(let i=0;i<this._deps.length;i++){let a=t[i];a!=null&&a.length>0&&(this._deps[i].prevData=a[a.length-1])}let s=this._deps.map(i=>i.terminal),o={prevData:n,terminalDeps:s,store:this._store};if(this._hasCalledFnOnce=!0,this._clearWaveFlags(),this._inspectorHooks!=null){let i={kind:"run",batchData:t,prevData:n};for(let a of this._inspectorHooks)a(i)}this._isExecutingFn=!0;try{let i=this._fn(t,this._actions,o);if(typeof i=="function")this._cleanup=i;else if(i!=null&&typeof i=="object"){let a=i;(typeof a.beforeRun=="function"||typeof a.deactivate=="function"||typeof a.invalidate=="function")&&(this._cleanup=i)}}catch(i){this._emit([[M,this._wrapFnError("fn threw",i)]])}finally{this._isExecutingFn=!1,this._pendingRerun?(this._pendingRerun=!1,this._rerunDepth+=1,this._rerunDepth>At?(this._rerunDepth=0,this._emit([[M,new Error(`Node "${this.name}": _pendingRerun depth exceeded ${At} \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 n=t instanceof Error?t.message:String(t);return new Error(`Node "${this.name}": ${e}: ${n}`,{cause:t})}_frameBatch(e){let t=this._config.tierOf;if(e.length===1)return t(e[0][0])===3&&this._status!=="dirty"?[oe,e[0]]:e;let n=!0,s=!1,o=!1,i=-1;for(let d of e){let u=t(d[0]);u<i&&(n=!1),u===3&&(s=!0),d[0]===K&&(o=!0),i=u}let a=e;if(!n){let d=e.map((u,l)=>({m:u,i:l,tier:t(u[0])}));d.sort((u,l)=>u.tier-l.tier||u.i-l.i),a=d.map(u=>u.m)}if(s&&!o&&this._status!=="dirty"){let d=0;for(;d<a.length&&t(a[d][0])===0;)d++;return d===0?[oe,...a]:[...a.slice(0,d),oe,...a.slice(d)]}return a}_emit(e){if(e.length===0)return;for(let a=0;a<e.length;a++){let d=e[a];if(d[0]===M&&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 a=e.filter(d=>d[0]===j||d[0]===W);if(a.length===0)return;t=a}t=this._frameBatch(t);let s=null;for(let a=0;a<t.length;a++){let d=t[a],u=d[0];if(u!==J&&u!==Z){s?.push(d);continue}if(d.length<2)throw new Error(`Node "${this.name}": [[${u===J?"PAUSE":"RESUME"}]] must carry a lockId payload \u2014 bare PAUSE/RESUME is a protocol violation (C0 rule). Use \`[[PAUSE, lockId]]\` / \`[[RESUME, lockId]]\`.`);let l=!0;if(this._pausable!==!1){let g=d[1];if(u===J)this._pauseLocks==null&&(this._pauseLocks=new Set),this._pauseLocks.add(g),this._paused=!0,this._pausable==="resumeAll"&&this._pauseBuffer==null&&(this._pauseBuffer=[]);else if(this._pauseLocks==null||!this._pauseLocks.has(g))l=!1;else if(this._pauseLocks.delete(g),this._pauseLocks.size===0){if(this._paused=!1,this._pauseBuffer!=null&&this._pauseBuffer.length>0){let p=this._pauseBuffer;this._pauseBuffer=[],this._emit(p)}this._pendingWave&&(this._pendingWave=!1,this._maybeRunFnOnSettlement())}}l?s?.push(d):s==null&&(s=t.slice(0,a))}if(s!=null){if(s.length===0)return;t=s}if(this._hasMeta&&t.some(a=>a[0]===j))for(let a of Object.keys(this.meta))try{this.meta[a]._emit(We)}catch{}let{finalMessages:o,equalsError:i}=this._updateState(t);if(o.length>0&&this._config.inspectorEnabled){let a=this._config.globalInspector;if(a!=null)try{a({kind:"emit",node:this,messages:o})}catch{}}if(o.length>0)if(this._paused&&this._pausable==="resumeAll"&&this._pauseBuffer!=null){let a=this._config.tierOf,d=[];for(let u of o)a(u[0])===3?this._pauseBuffer.push(u):d.push(u);d.length>0&&this._dispatchOrAccumulate(d)}else this._dispatchOrAccumulate(o);i!=null&&this._emit([[M,i]])}_updateState(e){let t=this._config.tierOf,n,s,o=-1,i=0;for(let l of e)t(l[0])===3&&i++;let a=i<=1,d=-1;if(this._versioning!=null&&i>1){for(let l=e.length-1;l>=0;l--)if(e[l][0]===F){d=l;break}}for(let l=0;l<e.length;l++){let g=e[l],p=g[0];if(p===F){if(g.length>=2){let f=!1;if(a&&this._cached!==void 0)try{f=this._equals(this._cached,g[1])}catch(c){s=this._wrapFnError("equals threw",c),o=l;break}if(f){n==null&&(n=e.slice(0,l)),n.push(Be),this._status="resolved";continue}this._cached=g[1],this._versioning!=null&&(d<0||l===d)&&kt(this._versioning,g[1],this._hashFn)}this._status="settled",n?.push(g)}else if(n?.push(g),p===K)this._status="dirty";else if(p===Y)this._status="resolved";else if(p===H){this._status="completed";{let f=this._config.rigorRecorder;if(f!=null)try{f.onTerminalTransition(this,"completed",this._autoComplete,this._autoError,this._deps.length>0)}catch{}}}else if(p===M){this._status="errored";{let f=this._config.rigorRecorder;if(f!=null)try{f.onTerminalTransition(this,"errored",this._autoComplete,this._autoError,this._deps.length>0)}catch{}}}else if(p===W){if(this._cached!==void 0){let c=this._config.rigorRecorder;if(c!=null)try{c.onNonVacuousInvalidate(this,this._cached)}catch{}}this._cached=void 0,this._status="dirty";let f=this._cleanup;if(typeof f=="function"){this._cleanup=void 0;try{f()}catch{}}else if(f!=null&&typeof f=="object"){let c=f.invalidate;if(typeof c=="function")try{c()}catch{}}}else p===j&&(this._resetOnTeardown&&(this._cached=void 0),this._deactivate(!0),this._status="sentinel")}let u=o>=0?n??e.slice(0,o):n??e;return s!=null?{finalMessages:u,equalsError:s}:{finalMessages:u}}_deliverToSinks=e=>{if(this._sinks==null)return;if(typeof this._sinks=="function"){this._sinks(e);return}let t=[...this._sinks];for(let n of t)n(e)};_dispatchOrAccumulate(e){if(Tt()){this._batchPendingMessages===null&&(this._batchPendingMessages=[],de(()=>this._flushBatchPending()));for(let t of e)this._batchPendingMessages.push(t);return}Ne(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);Ne(this._deliverToSinks,t,this._config.tierOf)}},Dt=r=>Array.isArray(r),nt=r=>typeof r=="object"&&r!=null&&!Array.isArray(r)});function ne(r,e){return Re([],{...e,initial:r})}function rt(r,e){return Re((n,s,o)=>r(s,o)??void 0,{describeKind:"producer",...e})}function st(r,e,t){return Re(r,(s,o,i)=>{let a=s.map((d,u)=>d!=null&&d.length>0?d.at(-1):i.prevData[u]);o.emit(e(a,i))},{describeKind:"derived",...t})}var ot=P(()=>{"use strict";be()});function it(r,e){if(e!=null&&e.length>0)return new Set(e);switch(r){case"standard":return new Set(["type","status","value","deps","meta","v"]);case"full":return null;case"spec":return new Set(["type","deps","meta","value"]);default:return new Set(["type","deps"])}}function Tn(r){return r._describeKind!=null?r._describeKind:r._deps.length>0?"derived":r._fn!=null?"producer":"state"}function On(r){let e={};for(let[t,n]of Object.entries(r.meta))try{e[t]=n.cache}catch{}return e}function at(r,e,t){let n=e==null,s=!n&&e!=null?[...e].filter(l=>l.startsWith("meta.")).map(l=>l.slice(5)):null,o=n||e.has("meta")||s!=null&&s.length>0,i="state",a=[];r instanceof $&&(i=Tn(r),a=r._deps.map(l=>l.node.name??""));let d={type:i,deps:a};(n||e.has("status"))&&(d.status=r.status);let u=r instanceof $?r._guard:void 0;if(o){let l={...On(r)};if(u!=null&&l.access===void 0&&(l.access=Xe(u)),s!=null&&s.length>0&&!e.has("meta")){let g={};for(let p of s)p in l&&(g[p]=l[p]);d.meta=g}else d.meta=l}if(r.name!=null&&(d.name=r.name),(n||e.has("value"))&&(!t||i==="state")){r.status==="sentinel"&&(d.sentinel=!0);try{d.value=r.cache}catch{}}if((n||e.has("v"))&&r.v!=null){let l={id:r.v.id,version:r.v.version};"cid"in r.v&&(l.cid=r.v.cid,l.prev=r.v.prev),d.v=l}return(n||e.has("guard"))&&u!=null&&(d.guard=Xe(u)),(n||e.has("lastMutation"))&&r.lastMutation!=null&&(d.lastMutation=r.lastMutation),d}var Ct=P(()=>{"use strict";Se();be()});function ut(r,e){if(Object.is(r,e))return!0;if(r==null||e==null||typeof r!="object"||typeof e!="object")return!1;if(Array.isArray(r)){if(!Array.isArray(e)||r.length!==e.length)return!1;for(let o=0;o<r.length;o++)if(!ut(r[o],e[o]))return!1;return!0}if(Array.isArray(e))return!1;let t=Object.keys(r),n=Object.keys(e);if(t.length!==n.length)return!1;let s=new Set(n);for(let o of t)if(!s.has(o)||!ut(r[o],e[o]))return!1;return!0}function Mt(r,e){return`${r}\0${e}`}function dt(r,e){let t=[],n=new Set(r.subgraphs),s=new Set(e.subgraphs),o=[];for(let h of s)n.has(h)||o.push(h);o.sort();for(let h of o)t.push({type:"subgraph-mounted",path:h});let i=new Set(Object.keys(r.nodes)),a=new Set(Object.keys(e.nodes)),d=[];for(let h of a)i.has(h)||d.push(h);d.sort();for(let h of d)t.push({type:"node-added",path:h,node:{...e.nodes[h]}});let u=[];for(let h of a){if(!i.has(h))continue;let w=r.nodes[h]?.meta,b=e.nodes[h]?.meta;w==null&&b==null||ut(w??{},b??{})||u.push(h)}u.sort();for(let h of u)t.push({type:"node-meta-changed",path:h,prevMeta:r.nodes[h]?.meta??{},nextMeta:e.nodes[h]?.meta??{}});let l=new Map;for(let h of r.edges)l.set(Mt(h.from,h.to),h);let g=new Map;for(let h of e.edges)g.set(Mt(h.from,h.to),h);let p=[];for(let[h,w]of g)l.has(h)||p.push(w);p.sort((h,w)=>h.from<w.from?-1:h.from>w.from?1:h.to<w.to?-1:h.to>w.to?1:0);for(let h of p)t.push({type:"edge-added",from:h.from,to:h.to});let f=[];for(let[h,w]of l)g.has(h)||f.push(w);f.sort((h,w)=>h.from<w.from?-1:h.from>w.from?1:h.to<w.to?-1:h.to>w.to?1:0);for(let h of f)t.push({type:"edge-removed",from:h.from,to:h.to});let c=[];for(let h of i)a.has(h)||c.push(h);c.sort();for(let h of c)t.push({type:"node-removed",path:h});let v=[];for(let h of n)s.has(h)||v.push(h);v.sort();for(let h of v)t.push({type:"subgraph-unmounted",path:h});return{events:t,flushedAt_ns:X()}}var Gt=P(()=>{"use strict";ke()});function De(r){return r.subscribe(()=>{})}var Pt=P(()=>{"use strict"});var $t=P(()=>{"use strict";Pt()});var Ce,It=P(()=>{"use strict";Ce=class{_timer;_gen=0;start(e,t){this.cancel(),this._gen+=1;let n=this._gen;this._timer=setTimeout(()=>{this._timer=void 0,n===this._gen&&t()},e)}cancel(){this._timer!==void 0&&(clearTimeout(this._timer),this._timer=void 0)}get pending(){return this._timer!==void 0}}});var ye,Ft=P(()=>{"use strict";ye=class{constructor(e){this.capacity=e;if(!Number.isInteger(e)||e<=0)throw new Error(`RingBuffer capacity must be a positive integer (got ${e})`);this.buf=new Array(e)}buf;head=0;_size=0;get size(){return this._size}get maxSize(){return this.capacity}push(e){let t=(this.head+this._size)%this.capacity;this.buf[t]=e,this._size<this.capacity?this._size++:this.head=(this.head+1)%this.capacity}shift(){if(this._size===0)return;let e=this.buf[this.head];return this.buf[this.head]=void 0,this.head=(this.head+1)%this.capacity,this._size--,e}at(e){if(this._size===0)return;let t=e<0?this._size+e:e;if(!(t<0||t>=this._size))return this.buf[(this.head+t)%this.capacity]}toArray(){let e=new Array(this._size);for(let t=0;t<this._size;t++)e[t]=this.buf[(this.head+t)%this.capacity];return e}clear(){for(let e=0;e<this._size;e++)this.buf[(this.head+e)%this.capacity]=void 0;this.head=0,this._size=0}}});function Lt(r,e,t,n={}){let s=e in r.nodes,o=t in r.nodes;if(!s)return Me(e,t,"no-such-from");if(!o)return Me(e,t,"no-such-to");let i=n.maxDepth;if(i!=null&&(!Number.isInteger(i)||i<0))throw new Error("explainPath: maxDepth must be an integer >= 0");if(e===t){if(n.findCycle===!0){let u=Nn(r,e,n);if(u!=null)return u}let d=Ge(e,r.nodes[e],0,n);return Pe(e,t,[d])}if(i===0)return Me(e,t,"no-path");let a=jt(r,e,t,i);return a.found?Pe(e,t,Vt(r,a.pathOrder,n)):Me(e,t,a.truncated?"max-depth-exceeded":"no-path")}function jt(r,e,t,n){let s=new Map,o=[{path:t,depth:0}],i=new Set([t]),a=0,d=!1;for(;a<o.length;){let g=o[a++];if(g.path===e)break;if(n!=null&&g.depth>=n){let v=r.nodes[g.path];v?.deps&&v.deps.length>0&&(d=!0);continue}let p=r.nodes[g.path];if(p==null)continue;let f=p.deps??[],c=new Map;for(let v=0;v<f.length;v++){let h=f[v];if(!h)continue;let w=c.get(h);w==null&&(w=[],c.set(h,w)),w.push(v)}for(let[v,h]of c)i.has(v)||(i.add(v),s.set(v,{from:g.path,depIndices:h}),o.push({path:v,depth:g.depth+1}))}if(!s.has(e))return{found:!1,pathOrder:[],truncated:d};let u=[{path:e}],l=e;for(;l!==t;){let g=s.get(l);if(g==null)return{found:!1,pathOrder:[],truncated:!1};u[u.length-1].depIndices=g.depIndices,u.push({path:g.from}),l=g.from}return{found:!0,pathOrder:u,truncated:!1}}function Nn(r,e,t){let n=r.nodes[e];if(n==null)return null;let s=n.deps??[],o=[];for(let a=0;a<s.length;a++)s[a]===e&&o.push(a);if(o.length>0){let a=Ge(e,n,0,t);a.dep_index=o[0];let d=Ge(e,n,1,t);return Pe(e,e,[a,d])}let i=null;for(let a=0;a<s.length;a++){let d=s[a];if(!d||d===e)continue;let u=jt(r,d,e,t.maxDepth);u.found&&(i==null||u.pathOrder.length<i.pathOrder.length)&&(i=u,i={found:!0,pathOrder:[{path:e,depIndices:[a]},...u.pathOrder],truncated:!1})}return i==null?null:Pe(e,e,Vt(r,i.pathOrder,t))}function Vt(r,e,t){return e.map((n,s)=>{let o=r.nodes[n.path],i=Ge(n.path,o,s,t);return n.depIndices!=null&&n.depIndices.length>0&&(i.dep_index=n.depIndices[0],n.depIndices.length>1&&(i.dep_indices=[...n.depIndices])),i})}function Ge(r,e,t,n){let s={path:r,type:e.type,hop:t};e.status!==void 0&&(s.status=e.status),"value"in e&&(s.value=e.value),e.v!=null&&(s.v=e.v);let o=n.annotations?.get(r)??e.annotation;o!=null&&(s.annotation=o);let i=n.lastMutations?.get(r)??e.lastMutation;return i!=null&&(s.lastMutation=i),s}function Pe(r,e,t){return Ht(r,e,!0,"ok",t)}function Me(r,e,t){return Ht(r,e,!1,t,[])}function Ht(r,e,t,n,s){let o=xn(r,e,t,n,s);return{from:r,to:e,found:t,reason:n,steps:s,text:o,toJSON(){return{from:r,to:e,found:t,reason:n,steps:s}}}}function xn(r,e,t,n,s){if(!t)switch(n){case"no-such-from":return`explainPath: no node named "${r}"`;case"no-such-to":return`explainPath: no node named "${e}"`;case"max-depth-exceeded":return`explainPath: no path from "${r}" to "${e}" within maxDepth`;default:return`explainPath: no path from "${r}" to "${e}"`}let o=[`Causal path: ${r} \u2192 ${e} (${s.length} step(s))`];for(let i of s){let d=` ${i.hop===0?"\xB7":"\u2193"} ${i.path} (${i.type}${i.status?`/${i.status}`:""})`;if(o.push(d),"value"in i&&o.push(` value: ${kn(i.value)}`),i.annotation!=null&&o.push(` annotation: ${i.annotation}`),i.lastMutation!=null){let u=i.lastMutation.actor;o.push(` actor: ${u.type}${u.id?`:${u.id}`:""}`)}}return o.join(`
|
|
2
|
+
`)}function kn(r){if(r===void 0)return"<sentinel>";if(r===null)return"null";if(typeof r=="string")return JSON.stringify(r);if(typeof r=="number"||typeof r=="boolean"||typeof r=="bigint")return String(r);try{let e=JSON.stringify(r);return e.length>80?`${e.slice(0,77)}...`:e}catch{return String(r)}}var Bt=P(()=>{"use strict"});function zt(r){let e=new WeakSet,t=new WeakSet,n=[r],s=0;for(;n.length>0;){let o=n.pop();s+=Sn(o,e,t,n)}return s}function Sn(r,e,t,n){if(r==null)return 0;switch(typeof r){case"number":return I.number;case"boolean":return I.boolean;case"string":return I.string+r.length*2;case"bigint":return I.bigint+An(r);case"symbol":return I.symbol;case"function":return e.has(r)?0:(e.add(r),I.function);case"undefined":return 0}let o=r;if(e.has(o))return 0;e.add(o);let i=o[En];if(typeof i=="function")try{let u=i.call(o);if(typeof u=="number"&&Number.isFinite(u))return u}catch{}if(o instanceof Date)return I.date;if(o instanceof RegExp)return I.regexp+o.source.length*2;if(o instanceof Error){let u=o.message?o.message.length*2:0,l=o.stack?o.stack.length*2:0;return I.error+u+l}if(typeof URL<"u"&&o instanceof URL)return I.url+o.href.length*2;if(typeof Promise<"u"&&o instanceof Promise)return I.promise;if(o instanceof WeakMap)return I.weakmap;if(o instanceof WeakSet)return I.weakset;if(o instanceof Map){let u=I.map;for(let[l,g]of o)u+=I.mapEntry,n.push(l),n.push(g);return u}if(o instanceof Set){let u=I.set;for(let l of o)u+=I.setEntry,n.push(l);return u}if(Array.isArray(o)){let u=I.array+o.length*8;for(let l of o)n.push(l);return u}if(o instanceof ArrayBuffer)return t.has(o)?0:(t.add(o),o.byteLength);if(ArrayBuffer.isView(o)){let u=o;return t.has(u.buffer)?48:(t.add(u.buffer),u.buffer.byteLength+48)}let a=I.object,d=Object.keys(o);for(let u of d){a+=I.string+u.length*2;try{n.push(o[u])}catch{}}return a}function An(r){let e=r<0n?-r:r;if(e===0n)return 0;let t=e.toString(2).length;return Math.ceil(t/32)*8}var I,En,Ut=P(()=>{"use strict";I={object:56,array:64,string:40,number:8,boolean:4,null:0,undefined:0,symbol:40,bigint:16,function:120,map:72,set:72,mapEntry:40,setEntry:24,date:24,regexp:48,error:64,url:80,promise:48,weakmap:40,weakset:40},En=Symbol.for("sizeof")});function Wt(r,e){let t=e?.topN??10,n=r.describe({detail:"standard"}),s=[],o=r._collectObserveTargets;typeof o=="function"&&o.call(r,"",s);let i=new Map;for(let[p,f]of s)i.set(p,f);let a=[];for(let[p,f]of Object.entries(n.nodes)){let c=i.get(p),v=c instanceof $?c:null,h=v?zt(v.cache):0,w=v?v._sinkCount:0,b=f.deps?.length??0,m=f.type==="effect"&&w===0,y=w===0?f.type==="effect"?"orphan-effect":f.type==="derived"?"idle-derived":f.type==="producer"?"idle-producer":null:null;a.push({path:p,type:f.type,status:f.status??"unknown",valueSizeBytes:h,subscriberCount:w,depCount:b,isOrphanEffect:m,orphanKind:y})}let d=a.reduce((p,f)=>p+f.valueSizeBytes,0),u=(p,f)=>[...a].sort(f??((c,v)=>v[p]-c[p])).slice(0,t),l=a.filter(p=>p.orphanKind!=null),g=a.filter(p=>p.isOrphanEffect);return{nodeCount:a.length,edgeCount:n.edges.length,subgraphCount:n.subgraphs.length,nodes:a,totalValueSizeBytes:d,hotspots:{byValueSize:u("valueSizeBytes"),bySubscriberCount:u("subscriberCount"),byDepCount:u("depCount")},orphans:l,orphanEffects:g}}var qt=P(()=>{"use strict";be();Ut()});function Kt(r,e){let t=Math.max(16,r.size*4),n=0;for(;r.size>0;){if(n++>=t){console.error(`[Graph "${e}".destroy] disposer drain exceeded cap (${t}); ${r.size} disposer(s) discarded`),r.clear();return}let s=r.values().next();if(s.done)return;let o=s.value;r.delete(o);try{o()}catch(i){console.error(`[Graph "${e}".destroy] disposer threw:`,i)}}}function en(r){return r!=null&&typeof r=="object"&&"cache"in r&&typeof r.subscribe=="function"&&typeof r.down=="function"}function Rn(r){if(r!=null)return en(r)?r.cache:r}function re(r){return r!=null&&typeof r=="object"&&"cache"in r&&typeof r.subscribe=="function"&&typeof r.down=="function"}function Q(r){return re(r)?r.cache??"":r}function Yt(r){return re(r)?r.cache??0:r}function Jt(r){return re(r)?r.cache??!1:r}function Dn(r){let e=[];for(let t of Object.keys(r).sort()){let n=r[t].v;n!=null&&e.push(`${t} ${n.id} ${n.version}`)}return e.join(`
|
|
3
|
+
`)}function Xt(r){if(r.version!==le)throw new Error(`unsupported snapshot version ${String(r.version)} (expected ${le})`);for(let e of["name","nodes","edges","subgraphs"])if(!(e in r))throw new Error(`snapshot missing required key "${e}"`);if(typeof r.name!="string")throw new TypeError("snapshot 'name' must be a string");if(typeof r.nodes!="object"||r.nodes===null||Array.isArray(r.nodes))throw new TypeError("snapshot 'nodes' must be an object");if(!Array.isArray(r.edges))throw new TypeError("snapshot 'edges' must be an array");if(!Array.isArray(r.subgraphs))throw new TypeError("snapshot 'subgraphs' must be an array")}function Cn(r,e){let t=new WeakMap,n=(s,o)=>{if(Object.is(s,o))return!0;if(s==null||o==null||typeof s!="object"||typeof o!="object")return!1;let i=t.get(s);if(i==null&&(i=new WeakSet,t.set(s,i)),i.has(o))return!0;i.add(o);let a=s.constructor,d=o.constructor;if(a!==d)return!1;if(s instanceof Date)return s.getTime()===o.getTime();if(s instanceof RegExp)return s.source===o.source&&s.flags===o.flags;if(Array.isArray(s)){let p=o;if(s.length!==p.length)return!1;for(let f=0;f<s.length;f++)if(!n(s[f],p[f]))return!1;return!0}if(s instanceof Map){let p=o;if(s.size!==p.size)return!1;for(let[f,c]of s)if(!p.has(f)||!n(c,p.get(f)))return!1;return!0}if(s instanceof Set){let p=o;if(s.size!==p.size)return!1;for(let f of s){let c=!1;for(let v of p)if(n(f,v)){c=!0;break}if(!c)return!1}return!0}if(ArrayBuffer.isView(s)){let p=s,f=o;if(p.length!==f.length)return!1;for(let c=0;c<p.length;c++)if(p[c]!==f[c])return!1;return!0}let u=Object.keys(s),l=Object.keys(o);if(u.length!==l.length)return!1;let g=new Set(l);for(let p of u)if(!g.has(p)||!n(s[p],o[p]))return!1;return!0};return n(r,e)}function Mn(r){return r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function $e(r){let e="^";for(let t=0;t<r.length;t+=1){let n=r[t];if(n==="*"){e+=".*";continue}if(n==="?"){e+=".";continue}if(n==="["){let s=r.indexOf("]",t+1);if(s<=t+1){e+="\\[";continue}let o=r.slice(t+1,s);o.startsWith("!")&&(o=`^${o.slice(1)}`),o=o.replace(/\\/g,"\\\\"),e+=`[${o}]`,t=s;continue}e+=Mn(n)}return e+="$",new RegExp(e)}function ct(r){if(typeof r=="string")return JSON.stringify(r);if(typeof r=="number"||typeof r=="boolean"||r==null)return String(r);try{return JSON.stringify(r)}catch{return"[unserializable]"}}function $n(r){return r==="none"?Pn:r==="ansi"||r==null?Gn:{data:r.data??"",dirty:r.dirty??"",resolved:r.resolved??"",invalidate:r.invalidate??"",pause:r.pause??"",resume:r.resume??"",complete:r.complete??"",error:r.error??"",teardown:r.teardown??"",derived:r.derived??"",path:r.path??"",reset:r.reset??""}}function Zt(r){if(r==null)return{};let e=r.detail;return e==="full"?{...r,structured:r.structured??!0,timeline:r.timeline??!0,causal:r.causal??!0,derived:r.derived??!0}:e==="minimal"?{...r,structured:r.structured??!0}:r.format==="stage-log"?{...r,structured:r.structured??!0,timeline:r.timeline??!0}:r}function In(r,e,t){for(let n=0;n<r.length;n++){let s=r.charCodeAt(n);if(s<32||s===127)throw new Error(`Graph "${e}": ${t} "${r}" must not contain control character (U+${s.toString(16).padStart(4,"0").toUpperCase()} at index ${n})`)}}function lt(r,e,t){if(r==="")throw new Error(`Graph "${e}": ${t} name must be non-empty`);if(r.includes(C))throw new Error(`Graph "${e}": ${t} "${r}" must not contain '${C}' (path separator)`);if(r===q)throw new Error(`Graph "${e}": ${t} name "${q}" is reserved for meta companion paths`);In(r,e,t)}function Fn(r,e){if(r==="")throw new Error(`Graph "${e}": resolve path must be non-empty`);let t=r.split(C);for(let n of t)if(n==="")throw new Error(`Graph "${e}": resolve path has empty segment`);return t}function Ln(r,e){let t=!1;for(let s of r)if(!e.isMetaPassthrough(s[0])){t=!0;break}return t?r.filter(s=>e.isMetaPassthrough(s[0])):r}function tn(r){for(let e of r._mounts.values())tn(e);for(let e of r._nodes.values())try{e.down([[j]],{internal:!0})}catch{}}function jn(r,e){let t=ve.diff(r,e),n={};for(let s of t.nodesAdded){let o=e.nodes[s];o!=null&&(n[s]=o)}return{...t,nodesAddedFull:n}}function Qt(r,e,t,n={}){let s={paths:[],depths:new Map,truncated:!1};if(!e)return n.withDetail?s:[];if(!n.both&&t!=="upstream"&&t!=="downstream")throw new Error('reachable: direction must be "upstream" or "downstream"');let o=n.maxDepth;if(o!=null&&(!Number.isInteger(o)||o<0))throw new Error("reachable: maxDepth must be an integer >= 0");if(o===0)return n.withDetail?s:[];let i=new Map,a=new Map,d=new Map,u=new Map,l=new Set;for(let[m,y]of Object.entries(r.nodes)){if(!m)continue;l.add(m);let _=y.deps??[];i.set(m,_);for(let N of _)N&&(l.add(N),a.has(N)||a.set(N,new Set),a.get(N).add(m))}for(let m of r.edges){if(m==null||typeof m!="object")continue;let y=typeof m.from=="string"?m.from:"",_=typeof m.to=="string"?m.to:"";!y||!_||(l.add(y),l.add(_),u.has(y)||u.set(y,new Set),u.get(y).add(_),d.has(_)||d.set(_,new Set),d.get(_).add(y))}if(!l.has(e))return n.withDetail?s:[];let g=n.both===!0,p=m=>{if(g){let x=i.get(m)??[],k=d.get(m),E=a.get(m),S=u.get(m),O=[...x];return k&&O.push(...k),E&&O.push(...E),S&&O.push(...S),O}if(t==="upstream"){let x=i.get(m)??[],k=d.get(m);return k?[...x,...k]:x}let y=a.get(m),_=u.get(m),N=y?[...y]:[];return _&&N.push(..._),N},f=new Set([e]),c=new Map,v=[{path:e,depth:0}],h=0,w=!1;for(;h<v.length;){let m=v[h++];if(o!=null&&m.depth>=o){p(m.path).length>0&&(w=!0);continue}for(let y of p(m.path))!y||f.has(y)||(f.add(y),c.set(y,m.depth+1),v.push({path:y,depth:m.depth+1}))}let b=[...c.keys()].sort((m,y)=>m<y?-1:m>y?1:0);return n.withDetail?{paths:b,depths:c,truncated:w}:b}function Vn(r,e){if(r.length!==e.length)return!1;for(let t=0;t<r.length;t++){let n=r[t],s=e[t];if(n.path!==s.path||n.type!==s.type||n.status!==s.status||n.hop!==s.hop||n.dep_index!==s.dep_index||n.annotation!==s.annotation||n.value!==s.value||n.lastMutation!==s.lastMutation)return!1;let o=n.v,i=s.v;if(o!==i&&(o==null||i==null||o.id!==i.id||o.version!==i.version))return!1}return!0}var C,q,le,Gn,Pn,ve,nn=P(()=>{"use strict";Ye();Je();ke();Se();he();Ct();be();ot();Gt();$t();It();Ft();Ke();Bt();qt();C="::",q="__meta__",le=1;Gn={data:"\x1B[32m",dirty:"\x1B[33m",resolved:"\x1B[36m",invalidate:"\x1B[93m",pause:"\x1B[90m",resume:"\x1B[96m",complete:"\x1B[34m",error:"\x1B[31m",teardown:"\x1B[91m",derived:"\x1B[35m",path:"\x1B[90m",reset:"\x1B[0m"},Pn={data:"",dirty:"",resolved:"",invalidate:"",pause:"",resume:"",complete:"",error:"",teardown:"",derived:"",path:"",reset:""};ve=class r{name;opts;config;_nodes=new Map;_nodeToName=new WeakMap;_mounts=new Map;_parent=void 0;_storageDisposers=new Set;_disposers=new Set;_destroyed=!1;_topology;_topologyEmitters=new Set;_factory;_factoryArgs;constructor(e,t){if(e==="")throw new Error("Graph name must be non-empty");if(e.includes(C))throw new Error(`Graph name must not contain '${C}' (got "${e}")`);if(e===q)throw new Error(`Graph name "${q}" is reserved for meta companion paths`);this.name=e,this.opts=Object.freeze({...t??{}}),this.config=t?.config??ce,this._traceRing=new ye(t?.traceCapacity??1e3),t?.versioning!=null&&this.setVersioning(t.versioning),typeof t?.factory=="string"&&(this._factory=t.factory,t.factoryArgs!==void 0&&(this._factoryArgs=t.factoryArgs))}tagFactory(e,t){return this._factory=e,this._factoryArgs=t,this}ancestors(e=!0){let t=[],n=e?this:this._parent;for(;n!=null;)t.push(n),n=n._parent;return t}get topology(){return this._topology==null&&(this._topology=rt(e=>{let t=n=>{e.emit(n)};return this._topologyEmitters.add(t),()=>{this._topologyEmitters.delete(t)}},{name:`${this.name}_topology`})),this._topology}_emitTopology(e){if(!(this._topology==null||this._topologyEmitters.size===0))for(let t of this._topologyEmitters)t(e)}nameOf(e){return this._nodeToName.get(e)}add(e,t){let n=e.name,s=t?.name??n;if(s==null||s==="")throw new Error(`Graph "${this.name}": graph.add requires a non-empty name \u2014 pass via opts.name or set it on the node (e.g. state(0, { name: "x" }))`);let o=s,i=t?.annotation;if(lt(o,this.name,"add"),this._mounts.has(o))throw new Error(`Graph "${this.name}": name "${o}" is already a mount point`);if(this._nodes.has(o))throw new Error(`Graph "${this.name}": node "${o}" already exists`);let a=this._nodeToName.get(e);if(a!==void 0)throw new Error(`Graph "${this.name}": node instance already registered as "${a}"`);return this._nodes.set(o,e),this._nodeToName.set(e,o),this._emitTopology({kind:"added",name:o,nodeKind:"node"}),i!=null&&(this._annotations.set(o,i),this.config.inspectorEnabled&&this._traceRing.push({path:o,annotation:i,timestamp_ns:X()})),e}setVersioning(e){if(e!=null)for(let t of this._nodes.values())t instanceof $&&t._applyVersioning(e)}remove(e){lt(e,this.name,"remove");let t=this._mounts.get(e);if(t){let o={kind:"mount",nodes:[],mounts:[]},i=[];t._collectObserveTargets("",i);for(let[a,d]of i)a.includes(`${C}${q}${C}`)||o.nodes.push(a);return o.nodes.sort(),o.mounts.push(e),o.mounts.push(...t._collectSubgraphs(`${e}${C}`)),this._mounts.delete(e),t._parent=void 0,tn(t),this._emitTopology({kind:"removed",name:e,nodeKind:"mount",audit:o}),o}let n=this._nodes.get(e);if(!n)throw new Error(`Graph "${this.name}": unknown node or mount "${e}"`);this._nodes.delete(e),this._nodeToName.delete(n),n.down([[j]],{internal:!0});let s={kind:"node",nodes:[e],mounts:[]};return this._emitTopology({kind:"removed",name:e,nodeKind:"node",audit:s}),s}removeAll(e){let t=typeof e=="function"?e:(()=>{let o=$e(e);return i=>o.test(i)})(),n={kind:"mount",nodes:[],mounts:[]},s=[...this._nodes.keys(),...this._mounts.keys()].filter(o=>t(o));for(let o of s){let i=this.remove(o);n.nodes.push(...i.nodes),n.mounts.push(...i.mounts)}return n.nodes.sort(),n.mounts.sort(),n}[Symbol.iterator](){let e=[...this._nodes.keys()].sort(),t=this._nodes,n=0;return{[Symbol.iterator](){return this},next(){if(n>=e.length)return{value:void 0,done:!0};let s=e[n++];return{value:[s,t.get(s)],done:!1}}}}node(e){if(e==="")throw new Error(`Graph "${this.name}": node name must be non-empty`);if(e.includes(C))return this.resolve(e);let t=this._nodes.get(e);if(!t)throw new Error(`Graph "${this.name}": unknown node "${e}"`);return t}get(e){return this.node(e).cache}set(e,t,n){let s=n?.internal===!0;this.node(e).down([[F,t]],{actor:n?.actor,internal:s,delivery:"write"})}setAll(e,t){let n=Symbol.iterator in e?e:Object.entries(e);Ot(()=>{for(let[s,o]of n)this.set(s,o,t)})}invalidate(e,t){let n=t?.internal===!0;this.node(e).down([[W]],{actor:t?.actor,internal:n,delivery:"write"})}error(e,t,n){let s=n?.internal===!0;this.node(e).down([[M,t]],{actor:n?.actor,internal:s,delivery:"write"})}complete(e,t){let n=t?.internal===!0;this.node(e).down([[H]],{actor:t?.actor,internal:n,delivery:"write"})}edges(e){let t=e?.recursive===!0,n=new Map;if(!t){for(let[d,u]of this._nodes)n.set(u,d);let a=[];for(let[d,u]of this._nodes)if(u instanceof $)for(let l of u._deps){let g=n.get(l.node);g!=null&&a.push([g,d])}return a.sort((d,u)=>d[0]<u[0]?-1:d[0]>u[0]?1:d[1]<u[1]?-1:d[1]>u[1]?1:0),a}let s=[];this._collectObserveTargets("",s);let o=new Map;for(let[a,d]of s)o.set(d,a);let i=[];for(let[a,d]of s)if(d instanceof $)for(let u of d._deps){let l=o.get(u.node);l!=null&&i.push([l,a])}return i.sort((a,d)=>a[0]<d[0]?-1:a[0]>d[0]?1:a[1]<d[1]?-1:a[1]>d[1]?1:0),i}mount(e,t){if(t===void 0){let s=new r(e);return this.mount(e,s)}if(typeof t=="function"){let s=new r(e);return t(s),this.mount(e,s)}let n=t;if(lt(e,this.name,"mount"),this._nodes.has(e))throw new Error(`Graph "${this.name}": cannot mount at "${e}" \u2014 node with that name exists`);if(this._mounts.has(e))throw new Error(`Graph "${this.name}": mount "${e}" already exists`);if(n===this)throw new Error(`Graph "${this.name}": cannot mount a graph into itself`);if(n._parent!=null)throw new Error(`Graph "${this.name}": this child graph is already mounted on "${n._parent.name}"`);for(let s=this;s!=null;s=s._parent)if(s===n)throw new Error(`Graph "${this.name}": mount("${e}", \u2026) would create a mount cycle`);return this._mounts.set(e,n),n._parent=this,this._emitTopology({kind:"added",name:e,nodeKind:"mount"}),n}resolve(e){let t=Fn(e,this.name);return this._resolveFromSegments(t)}tryResolve(e){try{return this.resolve(e)}catch{return}}_resolveFromSegments(e){let t=e;if(t[0]===this.name&&(t=t.slice(1),t.length===0))throw new Error(`Graph "${this.name}": resolve path ends at graph name only`);let n=t[0],s=t.slice(1);if(s.length===0){let a=this._nodes.get(n);if(a)return a;throw this._mounts.has(n)?new Error(`Graph "${this.name}": path ends at subgraph "${n}" \u2014 not a node (GRAPHREFLY-SPEC \xA73.5)`):new Error(`Graph "${this.name}": unknown name "${n}"`)}let o=this._nodes.get(n);if(o&&s.length>0&&s[0]===q)return this._resolveMetaChainFromNode(o,s,t.join(C));let i=this._mounts.get(n);if(!i)throw this._nodes.has(n)?new Error(`Graph "${this.name}": "${n}" is a node; trailing path "${s.join(C)}" is invalid`):new Error(`Graph "${this.name}": unknown mount or node "${n}"`);return i.resolve(s.join(C))}_resolveMetaChainFromNode(e,t,n){let s=e,o=0,i=[...t];for(;o<i.length;){if(i[o]!==q)throw new Error(`Graph "${this.name}": expected ${q} segment in meta path "${n}"`);if(o+1>=i.length)throw new Error(`Graph "${this.name}": meta path requires a key after ${q} in "${n}"`);let a=i[o+1],d=s.meta[a];if(!d)throw new Error(`Graph "${this.name}": unknown meta "${a}" in path "${n}"`);s=d,o+=2}return s}signal(e,t){if(t?.internal!==!0){for(let s of e)if(this.config.messageTier(s[0])===3)throw new Error(`Graph "${this.name}": Graph.signal() rejects tier-3 messages (DATA / RESOLVED). Broadcast is for control-plane tiers (START / DIRTY / INVALIDATE / PAUSE / RESUME / COMPLETE / ERROR / TEARDOWN). For per-node value writes, use Graph.set or graph.node(name).down(...).`)}let n=[];if(this._signalDeliver(e,t??{},new Set,n),n.length>0)throw n[0]}_signalDeliver(e,t,n,s){for(let d of this._mounts.values())d._signalDeliver(e,t,n,s);let i=t.internal===!0?{internal:!0}:{actor:t.actor,delivery:"signal"},a=Ln(e,this.config);for(let d of[...this._nodes.keys()].sort()){let u=this._nodes.get(d);if(!n.has(u)){n.add(u);try{u.down(e,i)}catch(l){if(l instanceof U)throw l;s.push(l)}a.length!==0&&this._signalMetaSubtree(u,a,n,i,s)}}}_signalMetaSubtree(e,t,n,s,o){for(let i of Object.keys(e.meta).sort()){let a=e.meta[i];if(!n.has(a)){n.add(a);try{a.down(t,s)}catch(d){if(d instanceof U)throw d;o.push(d)}this._signalMetaSubtree(a,t,n,s,o)}}}describe(e){if(e?.reactive==="diff")return this._describeReactiveDiff(e);if(e?.reactive===!0)return this._describeReactive(e);let t=Rn(e?.actor),n=e?.filter;if(e?.detail!=null&&e?.fields!=null)throw new TypeError("Graph.describe(): pass either `detail` or `fields`, not both. `detail: 'spec'` is the canonical spec projection; use `fields` only when you need a custom subset.");let s=it(e?.detail,e?.fields),o=e?.detail==="spec",i=s,a=[];this._collectObserveTargets("",a);let d=new Map;for(let[y,_]of a)d.set(_,y);let u=[];{let y=a.map(([,x])=>x),_=new Set(d.values()),N=0;for(;y.length>0;){let x=y.shift();if(x instanceof $)for(let k of x._deps){let E=k.node;if(d.has(E))continue;let S=E.name??"",O=S;if(!O||_.has(O))if(S){let L=2;for(;_.has(`${S}#${L}`);)L++;O=`${S}#${L}`}else for(O=`__internal__/${N++}`;_.has(O);)O=`__internal__/${N++}`;d.set(E,O),_.add(O),u.push([O,E]),y.push(E)}}}let l=[...a,...u],g={};for(let[y,_]of l){if(t!=null&&!_.allowsObserve(t))continue;let N=at(_,i,o),x=_ instanceof $?_._deps.map(O=>d.get(O.node)??O.node.name??""):[],{name:k,...E}=N,S={...E,deps:x};if(!o){let O=this._annotations.get(y);O!=null&&(S.annotation=O)}if(n!=null)if(typeof n=="function"){let O=n;if(!(O.length>=2?O(y,S):O(S)))continue}else{let O=!0;for(let[L,G]of Object.entries(n)){let R=L==="deps_includes"?"depsIncludes":L==="meta_has"?"metaHas":L;if(R==="depsIncludes"){if(!S.deps.includes(String(G))){O=!1;break}continue}if(R==="metaHas"){if(!Object.hasOwn(S.meta??{},String(G))){O=!1;break}continue}if(S[R]!==G){O=!1;break}}if(!O)continue}g[y]=S}let p=new Set(Object.keys(g)),f=[];for(let[y,_]of l)if(_ instanceof $)for(let N of _._deps){let x=d.get(N.node);x!=null&&f.push([x,y])}f.sort((y,_)=>y[0]<_[0]?-1:y[0]>_[0]?1:y[1]<_[1]?-1:y[1]>_[1]?1:0);let c=f.map(([y,_])=>({from:y,to:_}));(t!=null||n!=null)&&(c=c.filter(y=>p.has(y.from)&&p.has(y.to)));let v=this._collectSubgraphs(""),h=t!=null||n!=null?v.filter(y=>{let _=`${y}${C}`;return[...p].some(N=>N===y||N.startsWith(_))}):v,w=this,b=e;return{name:this.name,nodes:g,edges:c,subgraphs:h,...this._factory!==void 0?{factory:this._factory}:{},...this._factoryArgs!==void 0?{factoryArgs:this._factoryArgs}:{},expand(y){let _={...b};return Array.isArray(y)?(_.fields=y,_.detail=void 0):(_.detail=y,_.fields=void 0),w.describe(_)}}}_collectSubgraphs(e){let t=[];for(let n of[...this._mounts.keys()].sort()){let s=e===""?n:`${e}${n}`;t.push(s),t.push(...this._mounts.get(n)._collectSubgraphs(`${s}${C}`))}return t}resourceProfile(e){return Wt(this,e)}reachable(e,t,n={}){return n.withDetail===!0?Qt(this.describe(),e,t,{...n,withDetail:!0}):Qt(this.describe(),e,t,n)}explain(e,t,n){return n?.reactive===!0?this._explainReactive(e,t,n):this._explainStatic(Q(e),Q(t),{...n?.maxDepth!==void 0?{maxDepth:Yt(n.maxDepth)}:{},...n?.findCycle!==void 0?{findCycle:Jt(n.findCycle)}:{}})}_explainStatic(e,t,n){let s=this.describe({detail:"full"}),o=new Map(this._annotations),i=new Map;for(let[a,d]of Object.entries(s.nodes))d.lastMutation!=null&&i.set(a,d.lastMutation);return Lt(s,e,t,{...n?.maxDepth!=null?{maxDepth:n.maxDepth}:{},...n?.findCycle===!0?{findCycle:!0}:{},annotations:o,lastMutations:i})}_describeReactive(e){let t={...e,reactive:!1},n=e.reactiveName??"describe",s=0,o=ne(s,{name:`${n}_version`}),i=this.observe({timeline:!0,structured:!0}),a=!1,d=!1,u=()=>{a||d||(a=!0,de(()=>{a=!1,!d&&(s+=1,o.emit(s))}))},l=i.onEvent(b=>{let m=b.type;m!=="data"&&m!=="error"&&m!=="complete"&&m!=="teardown"||u()}),g=[],p=new WeakSet,f=b=>{if(p.has(b)||d)return;p.add(b);let m=b.topology.subscribe(y=>{for(let _ of y){if(_[0]!==F)continue;let N=_[1];if(u(),N.kind==="added"&&N.nodeKind==="mount"){let x=b._mounts.get(N.name);x!=null&&f(x)}}});g.push(m);for(let y of b._mounts.keys()){let _=b._mounts.get(y);_!=null&&f(_)}};f(this);let c,v=e.actor;en(v)&&(c=v.subscribe(b=>{let m=!1,y=!1;for(let _ of b){let N=_[0];N===F?m=!0:(N===H||N===M||N===j)&&(y=!0)}m&&u(),y&&(c?.(),c=void 0,u())}));let h;try{h=st([o],()=>this.describe(t),{name:n,describeKind:"derived",meta:{domain:"audit",kind:"describe"},equals:(b,m)=>b===m})}catch(b){l(),c?.();for(let m of g)m();throw i.dispose(),b}let w=De(h);return{node:h,dispose(){d=!0,l(),c?.();for(let b of g)b();g.length=0,i.dispose(),w()}}}_describeReactiveDiff(e){let t={...e,reactive:!1},n=e.reactiveName??"describe-diff",s={name:this.name,nodes:{},edges:[],subgraphs:[]},o=this.describe(t),i=dt(s,o),a=ne(i,{name:n,meta:{domain:"audit",kind:"describe-diff"},equals:(p,f)=>p===f}),d=this._describeReactive({...e,reactiveName:void 0}),u=!1,l=d.node.subscribe(p=>{if(!u)for(let f of p){if(f[0]!==F)continue;let c=f[1],v=dt(o,c);o=c,v.events.length!==0&&a.emit(v)}}),g=De(a);return{node:a,dispose(){u=!0,l(),d.dispose(),a.down([[j,"describe-diff disposed"]]),g()}}}_explainReactive(e,t,n){let s=0,o=ne(s,{name:"explain_version"}),i=this.observe({timeline:!0,structured:!0}),a=!1,d=!1,u=()=>{a||d||(a=!0,de(()=>{a=!1,!d&&(s+=1,o.emit(s))}))},l=i.onEvent(b=>{let m=b.type;m!=="data"&&m!=="error"&&m!=="complete"&&m!=="teardown"||u()}),g=[];e!=null&&re(e)&&g.push(e),t!=null&&re(t)&&g.push(t),n?.maxDepth!=null&&re(n.maxDepth)&&g.push(n.maxDepth),n?.findCycle!=null&&re(n.findCycle)&&g.push(n.findCycle);let p=()=>{for(let b of g)if(b.cache===void 0)return!1;return!0},f=()=>{let b=Q(e),m=Q(t);return{from:b,to:m,found:!1,reason:"pending",steps:[],text:"(awaiting reactive args)",toJSON:()=>({from:b,to:m,found:!1,reason:"pending",steps:[]})}},c;try{c=st([o],()=>{if(!p())return f();let b=Q(e),m=Q(t),y={...n?.maxDepth!==void 0?{maxDepth:Yt(n.maxDepth)}:{},...n?.findCycle!==void 0?{findCycle:Jt(n.findCycle)}:{}};return this._explainStatic(b,m,y)},{name:n?.name??"explain",describeKind:"derived",meta:{domain:"audit",kind:"explain_path",from:Q(e),to:Q(t)},equals:(b,m)=>b.found===m.found&&b.reason===m.reason&&b.steps.length===m.steps.length&&Vn(b.steps,m.steps)})}catch(b){throw l(),i.dispose(),b}let v=De(c),h=[],w=b=>{let m;return m=b.subscribe(y=>{let _=!1,N=!1;for(let x of y){let k=x[0];k===F?_=!0:(k===H||k===M||k===j)&&(N=!0)}(_||N)&&u(),N&&m&&(m(),m=void 0)}),()=>{m&&(m(),m=void 0)}};for(let b of g)h.push(w(b));return{node:c,dispose(){d=!0,l();for(let b of h)b?.();h.length=0,i.dispose(),v()}}}_pathsMatching(e){let t=$e(e),n=[];return this._collectObserveTargets("",n),n.map(([s])=>s).filter(s=>t.test(s))}_collectObserveTargets(e,t){for(let n of[...this._mounts.keys()].sort()){let s=e===""?n:`${e}${C}${n}`;this._mounts.get(n)._collectObserveTargets(s,t)}for(let n of[...this._nodes.keys()].sort()){let s=this._nodes.get(n),o=e===""?n:`${e}${C}${n}`;t.push([o,s]),this._appendMetaObserveTargets(o,s,t)}}_appendMetaObserveTargets(e,t,n){for(let s of Object.keys(t.meta).sort()){let o=t.meta[s],i=`${e}${C}${q}${C}${s}`;n.push([i,o]),this._appendMetaObserveTargets(i,o,n)}}observe(e,t){let n=typeof e=="string",o=Zt(n?t:e);if(o.reactive===!0)return this._observeReactive(n?e:void 0,o);let i=o.structured===!0||o.timeline===!0||o.causal===!0||o.derived===!0||o.detail==="minimal"||o.detail==="full"||o.format!=null,a=o.actor;if(n){let l=e,g=this.resolve(l);if(a!=null&&!g.allowsObserve(a))throw new U({actor:a,action:"observe",nodeName:l});return i?this._buildStructuredObserver([[l,g]],o,"one"):{subscribe(p){return g.subscribe(p)},up(p){try{g.up?.(p)}catch(f){if(f instanceof U)return;throw f}}}}let d=[];this._collectObserveTargets("",d),d.sort((l,g)=>l[0]<g[0]?-1:l[0]>g[0]?1:0);let u=a==null?d:d.filter(([,l])=>l.allowsObserve(a));return i?this._buildStructuredObserver(u,o,"all"):{subscribe:l=>{let g=u.map(([p,f])=>f.subscribe(c=>{l(p,c)}));return()=>{for(let p of g)p()}},up:(l,g)=>{try{this.resolve(l).up?.(g)}catch(p){if(p instanceof U)return;throw p}}}}_observeReactive(e,t){let n=t.tiers,s=n!=null?new Set(n):null,o=t.reactiveName??"observe";return rt(i=>{let a=[],d=!1,u=!1,l=()=>{if(a.length===0||u)return;let v={events:a.slice(),flushedAt_ns:X()};a.length=0,i.emit(v)},g={...t,reactive:!1,structured:!0,timeline:!0},p=e!=null?this.observe(e,g):this.observe(g),f=v=>{u||(a.push(v),!d&&(d=!0,de(()=>{d=!1,l()})))};for(let v of p.events)f(v);let c=p.onEvent(f);return()=>{u=!0,c(),p.dispose()}},{name:o,meta:{domain:"audit",kind:"observe-reactive"}})}_buildStructuredObserver(e,t,n){let s=n==="one"?e[0]?.[0]:void 0,o=i=>{if(n==="one"&&s!=null){let l=this.resolve(s);return this._buildStructuredObserver([[s,l]],i,"one")}let a=[];this._collectObserveTargets("",a),a.sort((l,g)=>l[0]<g[0]?-1:l[0]>g[0]?1:0);let d=i.actor,u=d==null?a:a.filter(([,l])=>l.allowsObserve(d));return this._buildStructuredObserver(u,i,"all")};return this._createObserveResult(e,t,o)}_createObserveResult(e,t,n){let s=t.timeline===!0,o=t.causal===!0,i=t.derived===!0,a=t.detail==="minimal",d=this.config.inspectorEnabled,u=(o||i)&&d,l=t.maxEvents,g=l!=null&&l>0?new ye(l):null,p=[],f=new Set,c=t.tiers!=null?new Set(t.tiers):null,v={},h=new Set,w=0,b=0,m=0,y=0,_=0,N=0,x=!1,k=!1,E=0,S=new Map,O=new Map,L=new Map,G=T=>{if(!(c!=null&&!c.has(T.type))){g?g.push(T):p.push(T);for(let D of f)D(T)}},R=T=>c==null||c.has(T),se=()=>s?{timestamp_ns:X(),in_batch:Oe(),batch_id:E}:{},Ie=(T,D)=>{if(!(!u||!(T instanceof $)))return T._setInspectorHook(B=>{if(B.kind==="dep_message")S.set(T,B.depIndex);else if(B.kind==="run"){let fe=B.batchData.map((A,V)=>A!=null&&A.length>0?A.at(-1):B.prevData[V]);O.set(T,fe);let z=B.batchData.map(A=>A!=null?[...A]:void 0);L.set(T,z),i&&G({type:"derived",path:D,dep_values:fe,dep_batches:z,...se()})}})},_e=T=>{let D=S.get(T),B=O.get(T);if(!o||B==null)return{};let z=(D!=null&&D>=0&&T instanceof $?T._deps[D]:void 0)?.node,A=z?.v,V=L.get(T);return{trigger_dep_index:D,trigger_dep_name:z?.name,...A!=null?{trigger_version:{id:A.id,version:A.version}}:{},dep_values:[...B],...V!=null?{dep_batches:V}:{}}},ft=[],pt=[];for(let[T,D]of e){let B=Ie(D,T);B&&ft.push(B),pt.push(D.subscribe(fe=>{E++;for(let z of fe){let A=z[0],V=se();if(A===F){v[T]=z[1];let Ve=D instanceof $?D.lastMutation?.actor??ie:ie;G({type:"data",path:T,data:z[1],actor:Ve,...V,..._e(D)})}else if(a)A===K?R("dirty")&&w++:A===Y?R("resolved")&&b++:A===W?R("invalidate")&&m++:A===J?R("pause")&&y++:A===Z?R("resume")&&_++:A===j?R("teardown")&&N++:A===H&&!h.has(T)?R("complete")&&(x=!0):A===M&&R("error")&&(k=!0,h.add(T));else if(A===K)R("dirty")&&w++,G({type:"dirty",path:T,...V});else if(A===Y)R("resolved")&&b++,G({type:"resolved",path:T,...V,..._e(D)});else if(A===W)R("invalidate")&&m++,G({type:"invalidate",path:T,...V});else if(A===J)R("pause")&&y++,G({type:"pause",path:T,lockId:z[1],...V});else if(A===Z)R("resume")&&_++,G({type:"resume",path:T,lockId:z[1],...V});else if(A===H)R("complete")&&!h.has(T)&&(x=!0),G({type:"complete",path:T,...V});else if(A===M){R("error")&&(k=!0,h.add(T));let Ve=D instanceof $?D.lastMutation?.actor??ie:ie;G({type:"error",path:T,data:z[1],actor:Ve,...V})}else A===j&&(R("teardown")&&N++,G({type:"teardown",path:T,...V}))}}))}let Fe=!1,Le=()=>{if(!Fe){Fe=!0;for(let T of pt)T();for(let T of ft)T();for(let T of we)T({value:void 0,done:!0});we.length=0}},je=[],we=[];f.add(T=>{let D=we.shift();D?D({value:T,done:!1}):je.push(T)});let ht={get values(){return v},get dirtyCount(){return w},get resolvedCount(){return b},get invalidateCount(){return m},get pauseCount(){return y},get resumeCount(){return _},get teardownCount(){return N},get events(){return g?g.toArray():[...p]},get anyCompletedCleanly(){return x},get anyErrored(){return k},get completedWithoutErrors(){return x&&!k},onEvent(T){return f.add(T),()=>f.delete(T)},dispose:Le,expand(T){Le();let D={...t};return typeof T=="string"?D.detail=T:Object.assign(D,T),n(Zt(D))},[Symbol.asyncIterator](){return{next(){return je.length>0?Promise.resolve({value:je.shift(),done:!1}):Fe?Promise.resolve({value:void 0,done:!0}):new Promise(T=>we.push(T))},return(){return Le(),Promise.resolve({value:void 0,done:!0})}}}};return t.format!=null&&this._attachFormatLogger(ht,t),ht}_attachFormatLogger(e,t){let n=t.format;if(n==null)return;let s=t.logger??(c=>console.log(c)),o=t.includeTypes?new Set(t.includeTypes):null,i=t.excludeTypes?new Set(t.excludeTypes):null,a=o==null&&i==null?()=>!0:c=>(o==null||o.has(c))&&(i==null||!i.has(c)),d=$n(t.theme),u=n==="stage-log"?X():0,l=c=>c==null?"":t.stageLabels?.[c]??c,g=(c,v)=>c.length>v?`${c.slice(0,v-1)}\u2026`:c,p=c=>c.type==="data"||c.type==="error"?g(ct(c.data),120):"",f=c=>{if(n==="stage-log"){let x=(X()-u)/1e9,k=l(c.path).padEnd(9);if(c.type==="data"){let E=p(c);return`[${x.toFixed(3)}s] ${k} \u2190${E?` ${E}`:""}`}if(c.type==="error"){let E=p(c);return`[${x.toFixed(3)}s] ${k} \u2717${E?` ${E}`:""}`}return c.type==="complete"?`[${x.toFixed(3)}s] ${k} \u25A0 complete`:`[${x.toFixed(3)}s] ${k} ${c.type}`}if(n==="json")try{return JSON.stringify(c)}catch{return JSON.stringify({type:c.type,path:c.path,data:"[unserializable]"})}let v=d[c.type]??"",h=c.path?`${d.path}${c.path}${d.reset} `:"",w=c.type==="data"||c.type==="error",b=c.type==="pause"||c.type==="resume",m=w?` ${ct(c.data)}`:b?` ${ct(c.lockId)}`:"",y=c.type==="data"||c.type==="resolved"||c.type==="derived"?c:void 0,_=y?.trigger_dep_name!=null?` <- ${y.trigger_dep_name}`:y?.trigger_dep_index!=null?` <- #${y.trigger_dep_index}`:"",N=c.in_batch?" [batch]":"";return`${h}${v}${c.type.toUpperCase()}${d.reset}${m}${_}${N}`};e.onEvent(c=>{a(c.type)&&s(f(c),c)})}addDisposer(e){return this._disposers.add(e),()=>{this._disposers.delete(e)}}destroy(){Kt(this._disposers,this.name),this.signal([[j]],{internal:!0}),Kt(this._storageDisposers,this.name);for(let e of[...this._mounts.values()])e._parent=void 0,e._destroyClearOnly();this._mounts.clear(),this._nodes.clear(),this._parent=void 0,this._destroyed=!0}get destroyed(){return this._destroyed}_destroyClearOnly(){for(let e of[...this._mounts.values()])e._parent=void 0,e._destroyClearOnly();this._mounts.clear(),this._nodes.clear(),this._parent=void 0,this._destroyed=!0}snapshot(e){let{expand:t,...n}=this.describe({detail:"full"}),s={};for(let a of Object.keys(n.nodes).sort()){let{lastMutation:d,guard:u,...l}=n.nodes[a];s[a]=l}let o=[...n.subgraphs].sort(),i={...n,version:1,nodes:s,subgraphs:o};if(e?.format==null)return i;if(e.format==="json-string")return JSON.stringify(i);if(e.format==="bytes"){if(e.codec==null)throw new Error("snapshot({format: 'bytes'}) requires a `codec` name");let a=this.config.lookupCodec(e.codec);if(a==null)throw new Error(`snapshot: codec "${e.codec}" is not registered on this graph's config. Call config.registerCodec(...) before creating nodes.`);return vt(a,a.encode(i))}throw new Error(`snapshot: unknown format "${String(e.format)}"`)}static decode(e,t){let n=t?.config??ce,{codec:s,codecVersion:o,payload:i}=_t(e,n);return s.decode(i,o)}restore(e,t){if(Xt(e),e.name!==this.name)throw new Error(`Graph "${this.name}": restore snapshot name "${e.name}" does not match this graph`);let n=t?.only==null?null:(Array.isArray(t.only)?t.only:[t.only]).map(o=>$e(o)),s=t?.includeProducers===!0;for(let o of Object.keys(e.nodes).sort()){if(n!==null&&!n.some(a=>a.test(o)))continue;let i=e.nodes[o];if(i!==void 0){if(!("value"in i)||i.value===void 0){"value"in i&&i.value===void 0&&t?.onError?.(o,new Error(`restore: slice.value is undefined for "${o}" (undefined is the global SENTINEL; not valid DATA)`));continue}if(!(i.type==="derived"||i.type==="effect")&&!(i.type==="producer"&&!s)){if(i.v!=null){let d=this.tryResolve(o)?.v;if(d!=null&&d.id===i.v.id&&d.version===i.v.version)continue}try{this.set(o,i.value)}catch(a){t?.onError?.(o,a)}}}}}static fromSnapshot(e,t){Xt(e);let n=typeof t=="function"?t:t?.build,s=typeof t=="function"?void 0:t?.factories,o=new r(e.name);if(n)return n(o),o.restore(e),o;for(let f of[...e.subgraphs].sort((c,v)=>{let h=c.split(C).length,w=v.split(C).length;return h!==w?h-w:c<v?-1:c>v?1:0})){let c=f.split(C),v=o;for(let h of c)v._mounts.has(h)||v.mount(h,new r(h)),v=v._mounts.get(h)}let i=s?Object.entries(s).map(([f,c])=>({re:$e(f),factory:c})):[],a=f=>{for(let c of i)if(c.re.test(f))return c.factory},d=f=>{let c=f.split(C),v=c.pop();if(v==null||v.length===0)throw new Error(`invalid snapshot path "${f}"`);let h=o;for(let w of c){let b=h._mounts.get(w);if(!b)throw new Error(`unknown mount "${w}" in path "${f}"`);h=b}return[h,v]},u=Object.entries(e.nodes).filter(([f])=>!f.includes(`${C}${q}${C}`)).sort((f,c)=>f[0]<c[0]?-1:f[0]>c[0]?1:0),l=new Map(u),g=new Map,p=!0;for(;l.size>0&&p;){p=!1;for(let[f,c]of[...l.entries()]){let v=c?.deps??[];if(!v.every(_=>g.has(_)))continue;let[h,w]=d(f),b={...c?.meta??{}},m=a(f),y;if(c?.type==="state")y=ne(c.value,{meta:b});else{if(m==null)continue;y=m(w,{path:f,type:c.type,value:c.value,meta:b,deps:v,resolvedDeps:v.map(_=>g.get(_))})}h.add(y,{name:w}),g.set(f,y),l.delete(f),p=!0}}if(l.size>0){let f=[...l.keys()].sort().join(", ");throw new Error(`Graph.fromSnapshot could not reconstruct nodes without build callback: ${f}. Pass matching factories via fromSnapshot(data, { factories: { pattern: factoryFn } }).`)}return o.restore(e),o}toJSON(){return this.snapshot()}attachSnapshotStorage(e,t={}){let n=e.map(u=>({tier:u,debounceMs:Math.max(0,u.debounceMs??0),compactEvery:Math.max(1,u.compactEvery??10),timer:void 0,seq:0,lastSnapshot:void 0,lastFingerprint:"",disposed:!1,savePending:void 0}));t.autoRestore===!0&&this._cascadeRestore(e,t.onError);let s=(u,l)=>{if(u.disposed)return;let g=Dn(l.nodes);if(u.lastSnapshot!=null&&g!==""&&g===u.lastFingerprint)return;let p=u.seq+1,f=xe(),h=u.lastSnapshot==null||p%u.compactEvery===0?{name:this.name,mode:"full",snapshot:l,seq:p,timestamp_ns:f,format_version:le}:{name:this.name,mode:"diff",diff:jn(u.lastSnapshot,l),seq:p,timestamp_ns:f,format_version:le};if(u.tier.filter&&!u.tier.filter(h))return;let w;try{w=u.tier.save(h)}catch(b){t.onError?.(b,u.tier);return}if(w&&typeof w.then=="function"){let y=(u.savePending??Promise.resolve()).then(()=>w,()=>w).then(()=>{u.disposed||(u.seq=p,u.lastSnapshot=l,u.lastFingerprint=g)},_=>{t.onError?.(_,u.tier)});u.savePending=y.finally(()=>{u.savePending===y&&(u.savePending=void 0)})}else u.seq=p,u.lastSnapshot=l,u.lastFingerprint=g},o=(u,l)=>{try{s(u,l)}catch(g){t.onError?.(g,u.tier)}},i=(u,l)=>{if(!l.some(c=>{let v=this.config.messageTier(c[0]);return v>=3&&v<5}))return;if(t.filter){let c=this.tryResolve(u);if(c==null)return;let v=at(c,it("standard"));if(!t.filter(u,v))return}let p,f=()=>(p==null&&(p=this.snapshot()),p);for(let c of n)c.disposed||(c.debounceMs===0?o(c,f()):(c.timer==null&&(c.timer=new Ce),c.timer.start(c.debounceMs,()=>{c.disposed||o(c,this.snapshot())})))},a;if(t.paths!=null){let l=(typeof t.paths=="string"?this._pathsMatching(t.paths):t.paths).map(g=>{let p=this.tryResolve(g);return p==null?()=>{}:p.subscribe(f=>i(g,f))});a=()=>{for(let g of l)g()}}else a=this.observe().subscribe((u,l)=>i(u,l));let d=()=>{a();for(let u of n)u.disposed=!0,u.timer?.cancel();this._storageDisposers.delete(d)};return this._storageDisposers.add(d),{dispose:d}}async _cascadeRestore(e,t){for(let n of e){let s;try{s=await n.load?.()}catch(i){t?.(i,n);continue}if(s==null||typeof s!="object"||Array.isArray(s))continue;let o=s;try{if(o.mode==="full"&&o.snapshot!=null)return this.restore(o.snapshot),!0;if(o.version===le&&o.nodes!=null)return this.restore(o),!0}catch(i){t?.(i,n)}}return!1}static async fromStorage(e,t,n){for(let s of t){let o;try{o=await s.load?.()}catch(d){n?.onError?.(d,s);continue}if(o==null||typeof o!="object"||Array.isArray(o))continue;let i=o,a=i.mode==="full"&&i.snapshot!=null?i.snapshot:i.version===le&&i.nodes!=null?i:void 0;if(a!=null)try{return r.fromSnapshot(a,n)}catch(d){n?.onError?.(d,s)}}throw new Error(`Graph.fromStorage: no tier held a restorable record for "${e}" across ${t.length} tier(s)`)}_annotations=new Map;_traceRing;trace(e,t,n){if(e!=null&&t!=null){if(this.tryResolve(e)==null)return;if(this._annotations.set(e,t),this.config.inspectorEnabled){let s={path:e,annotation:t,timestamp_ns:X(),...n?.actor!=null?{actor:n.actor}:{}};this._traceRing.push(s)}return}return e!=null?this.config.inspectorEnabled?this._annotations.get(e):void 0:this.config.inspectorEnabled?this._traceRing.toArray():[]}annotation(e){return this._annotations.get(e)}clearTrace(){this._annotations.clear(),this._traceRing.clear()}pruneTrace(e){let t=this._traceRing.toArray().filter(s=>!e(s)),n=this._traceRing.size-t.length;this._traceRing.clear();for(let s of t)this._traceRing.push(s);return n}static diff(e,t){let n=new Set(Object.keys(e.nodes)),s=new Set(Object.keys(t.nodes)),o=[...s].filter(b=>!n.has(b)).sort(),i=[...n].filter(b=>!s.has(b)).sort(),a=[],d=[];for(let b of n){if(!s.has(b))continue;let m=e.nodes[b],y=t.nodes[b],_=m.v,N=y.v;_!=null&&N!=null&&_.id===N.id&&_.version!==N.version&&d.push({path:b,id:_.id,from:_.version,to:N.version});let x=_!=null&&N!=null&&_.id===N.id&&_.version===N.version;for(let k of["type","status","sentinel"]){let E=m[k],S=y[k];E!==S&&a.push({path:b,field:k,from:E,to:S})}if(!x)for(let k of["value","meta"]){let E=m[k],S=y[k];Cn(E,S)||a.push({path:b,field:k,from:E,to:S})}}let u=b=>`${b.from} ${b.to}`,l=new Set(e.edges.map(u)),g=new Set(t.edges.map(u)),p=t.edges.filter(b=>!l.has(u(b))),f=e.edges.filter(b=>!g.has(u(b))),c=new Set(e.subgraphs),v=new Set(t.subgraphs),h=[...v].filter(b=>!c.has(b)).sort(),w=[...c].filter(b=>!v.has(b)).sort();return{nodesAdded:o,nodesRemoved:i,nodesChanged:a,versionChanges:d,edgesAdded:p,edgesRemoved:f,subgraphsAdded:h,subgraphsRemoved:w}}}});var zn={};an(zn,{create:()=>Bn});module.exports=dn(zn);he();ot();nn();var Hn=()=>!1;function Bn(r){let e=new ve("zustand"),t=ne(void 0,{name:"state",equals:Hn});e.add(t,{name:"state"});let n=()=>t.cache,s=(a,d)=>{let u=t.cache,l=typeof a=="function"?a(u):a;t.emit(d?l:{...u,...l})},o={getState:n,setState:s,getInitialState:()=>i,subscribe:a=>{let d=!0,u=t.cache;return t.subscribe(l=>{for(let[g,p]of l)if(g===F){if(d){d=!1;continue}a(p,u),u=p}})},destroy:e.destroy.bind(e)},i=r(s,n,o);return t.emit(i),Object.assign(e,o)}0&&(module.exports={create});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import '../../graph-
|
|
2
|
-
export { S as StateCreator, a as StoreApi, c as create } from '../../index-
|
|
3
|
-
import '../../node-
|
|
4
|
-
import '../../meta-
|
|
1
|
+
import '../../graph-C4SHb3Ly.cjs';
|
|
2
|
+
export { S as StateCreator, a as StoreApi, c as create } from '../../index-f5IivDUX.cjs';
|
|
3
|
+
import '../../node-ClS5yC-B.cjs';
|
|
4
|
+
import '../../meta-vE8bxW1E.cjs';
|
|
5
5
|
import '../../extra/storage-core.cjs';
|
|
6
6
|
import '../../extra/storage-tiers.cjs';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import '../../graph-
|
|
2
|
-
export { S as StateCreator, a as StoreApi, c as create } from '../../index-
|
|
3
|
-
import '../../node-
|
|
4
|
-
import '../../meta-
|
|
1
|
+
import '../../graph-7VguS7a4.js';
|
|
2
|
+
export { S as StateCreator, a as StoreApi, c as create } from '../../index-C7O6r5fV.js';
|
|
3
|
+
import '../../node-ClS5yC-B.js';
|
|
4
|
+
import '../../meta-BgVAsg9j.js';
|
|
5
5
|
import '../../extra/storage-core.js';
|
|
6
6
|
import '../../extra/storage-tiers.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"../../chunk-
|
|
1
|
+
import{a}from"../../chunk-CISGGAIF.js";import"../../chunk-ACMJ2ZPS.js";import"../../chunk-ESMPEKEV.js";import"../../chunk-2K5RXLAH.js";import"../../chunk-35JTVPOX.js";import"../../chunk-LYCLF26R.js";import"../../chunk-CK2E7BTU.js";import"../../chunk-QYADASLV.js";export{a as create};
|
package/dist/core/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { A as Actor, C as COMPLETE, f as COMPLETE_MSG, g as COMPLETE_ONLY_BATCH, D as DATA, h as DEFAULT_ACTOR, i as DIRTY, j as DIRTY_MSG, k as DIRTY_ONLY_BATCH, l as DepRecord, E as ERROR, F as FnCtx,
|
|
2
|
-
export { b as batch, d as downWithBatch, a as isBatching, m as monotonicNs, w as wallClockNs } from '../index-
|
|
3
|
-
export { a as DescribeDetail, b as DescribeField, D as DescribeNodeOutput, f as factoryTag, p as placeholderArgs, r as resolveDescribeFields } from '../meta-
|
|
4
|
-
export { A as AutoTrackOptions, D as DerivedFn, a as DynamicFn, E as EffectFn, P as PipeOperator, b as ProducerFn, T as TrackFn, c as autoTrackNode, d as derived, e as dynamicNode, f as effect, p as pipe, g as producer, s as state } from '../sugar-
|
|
1
|
+
export { A as Actor, C as COMPLETE, f as COMPLETE_MSG, g as COMPLETE_ONLY_BATCH, D as DATA, h as DEFAULT_ACTOR, i as DIRTY, j as DIRTY_MSG, k as DIRTY_ONLY_BATCH, l as DepRecord, E as ERROR, F as FnCtx, G as GlobalInspectorEvent, m as GlobalInspectorHook, n as GraphReFlyConfig, o as GuardAction, p as GuardDenied, q as GuardDeniedDetails, H as HashFn, I as INVALIDATE, r as INVALIDATE_MSG, s as INVALIDATE_ONLY_BATCH, t as Message, u as MessageContext, v as MessageTypeRegistration, w as MessageTypeRegistrationInput, M as Messages, N as Node, c as NodeActions, x as NodeCtx, e as NodeDescribeKind, y as NodeFn, d as NodeFnCleanup, b as NodeGuard, z as NodeImpl, B as NodeInspectorHook, J as NodeInspectorHookEvent, a as NodeOptions, K as NodeSink, L as NodeStatus, O as NodeTransportOptions, P as NodeVersionInfo, Q as OnMessageHandler, R as OnSubscribeHandler, S as PAUSE, T as PolicyAllow, U as PolicyDeny, W as PolicyRuleData, X as RESOLVED, Y as RESOLVED_MSG, Z as RESOLVED_ONLY_BATCH, _ as RESUME, $ as RigorRecorder, a0 as START, a1 as START_MSG, a2 as SubscribeContext, a3 as TEARDOWN, a4 as TEARDOWN_MSG, a5 as TEARDOWN_ONLY_BATCH, a6 as V0, a7 as V1, V as VersioningLevel, a8 as VersioningOptions, a9 as accessHintForGuard, aa as advanceVersion, ab as configure, ac as createVersioning, ad as defaultConfig, ae as defaultHash, af as isV1, ag as node, ah as normalizeActor, ai as policy, aj as policyFromRules, ak as registerBuiltins } from '../node-ClS5yC-B.cjs';
|
|
2
|
+
export { b as batch, d as downWithBatch, a as isBatching, m as monotonicNs, w as wallClockNs } from '../index-DmAgG5CI.cjs';
|
|
3
|
+
export { a as DescribeDetail, b as DescribeField, D as DescribeNodeOutput, f as factoryTag, p as placeholderArgs, r as resolveDescribeFields } from '../meta-vE8bxW1E.cjs';
|
|
4
|
+
export { A as AutoTrackOptions, D as DerivedFn, a as DynamicFn, E as EffectFn, P as PipeOperator, b as ProducerFn, T as TrackFn, c as autoTrackNode, d as derived, e as dynamicNode, f as effect, p as pipe, g as producer, s as state } from '../sugar-DStZfUEK.cjs';
|