@graphrefly/graphrefly 0.37.0 → 0.39.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/budget-gate-CmmVtasH.d.ts +115 -0
- package/dist/budget-gate-DiP_nK0n.d.cts +115 -0
- package/dist/{cascading-BsJ4GbnS.d.ts → cascading-BzuxW0_w.d.cts} +2 -2
- package/dist/{cascading-B25wxpRa.d.cts → cascading-g2_rhhaM.d.ts} +2 -2
- package/dist/chunk-35JTVPOX.js +1 -0
- package/dist/chunk-3G5U5QNE.js +5 -0
- package/dist/chunk-4I45FVQS.js +1 -0
- package/dist/chunk-5LK7XMEV.js +1 -0
- package/dist/chunk-5XRI6RM3.js +1 -0
- package/dist/chunk-73PBQNST.js +1 -0
- package/dist/chunk-7JRF5YEK.js +3 -0
- package/dist/{chunk-YVYSO5CW.js → chunk-7NZMZJMW.js} +1 -1
- package/dist/chunk-7QFRK3N3.js +84 -0
- package/dist/{chunk-K6ZFJ473.js → chunk-7SD73DS6.js} +1 -1
- package/dist/{chunk-LOQRPP4Y.js → chunk-A6ZSKGUG.js} +1 -1
- package/dist/{chunk-KUVDFOJH.js → chunk-AU7YTQX7.js} +1 -1
- package/dist/chunk-C72GO4IZ.js +1 -0
- package/dist/{chunk-Q7EUZ6NN.js → chunk-CGDMTXSY.js} +1 -1
- package/dist/chunk-D27JNOLZ.js +1 -0
- package/dist/chunk-D47YVDR5.js +1 -0
- package/dist/chunk-EWF7KCDJ.js +61 -0
- package/dist/{chunk-PCD2MU7X.js → chunk-GEAO3TL3.js} +1 -1
- package/dist/chunk-GX5LSSRE.js +1 -0
- package/dist/{chunk-2C4NESZE.js → chunk-HAWKGIXM.js} +1 -1
- package/dist/chunk-HX3EGQ5Z.js +1 -0
- package/dist/{chunk-MQZWA3DF.js → chunk-IA7DUNGB.js} +1 -1
- package/dist/{chunk-MYFR67PY.js → chunk-INH6FS2G.js} +2 -2
- package/dist/chunk-INHC33EH.js +1 -0
- package/dist/chunk-IUB4NYI2.js +1 -0
- package/dist/{chunk-TFK4P4CX.js → chunk-JNMC2WJ6.js} +1 -1
- package/dist/{chunk-TLS7M7H4.js → chunk-KD4NHLMU.js} +1 -1
- package/dist/chunk-L6NSJVJZ.js +1 -0
- package/dist/chunk-L7WY6TZS.js +1 -0
- package/dist/chunk-LQNOXGET.js +1 -0
- package/dist/chunk-MC4UYY2X.js +1 -0
- package/dist/{chunk-U3COB5WU.js → chunk-N7UIBZCW.js} +1 -1
- package/dist/chunk-NQI2C36M.js +1 -0
- package/dist/chunk-R75BMDLA.js +1 -0
- package/dist/chunk-RF3QZP6D.js +1 -0
- package/dist/{chunk-MC5LZG3U.js → chunk-S2U57TFC.js} +1 -1
- package/dist/{chunk-QP5TH523.js → chunk-SC7BQDNP.js} +1 -1
- package/dist/{chunk-5CPPC75H.js → chunk-TFPZLQ5H.js} +1 -1
- package/dist/chunk-VJJLIEAL.js +1 -0
- package/dist/chunk-WHIZM6JV.js +1 -0
- package/dist/chunk-XEUANKBO.js +43 -0
- package/dist/chunk-XQ55HO5N.js +1 -0
- package/dist/chunk-ZJ7SM3G2.js +1 -0
- package/dist/{chunk-T4U24DXX.js → chunk-ZOX3LBRV.js} +1 -1
- package/dist/compat/index.cjs +9 -13
- 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 +8 -12
- 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 -7
- 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/{composite-_XckYx2e.d.cts → composite-CKd0e2vz.d.cts} +10 -3
- package/dist/{composite-CT_mApQD.d.ts → composite-DGatA-JK.d.ts} +10 -3
- package/dist/core/index.cjs +1 -1
- package/dist/core/index.d.cts +4 -4
- package/dist/core/index.d.ts +4 -4
- package/dist/core/index.js +1 -1
- package/dist/extra/browser.d.cts +1 -1
- package/dist/extra/browser.d.ts +1 -1
- package/dist/extra/index.cjs +17 -21
- package/dist/extra/index.d.cts +11 -9
- package/dist/extra/index.d.ts +11 -9
- package/dist/extra/index.js +1 -1
- package/dist/extra/node.cjs +2 -2
- package/dist/extra/node.d.cts +108 -2
- package/dist/extra/node.d.ts +108 -2
- package/dist/extra/node.js +2 -2
- 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.cjs +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.cjs +5 -0
- package/dist/extra/render/index.d.cts +183 -0
- package/dist/extra/render/index.d.ts +183 -0
- package/dist/extra/render/index.js +1 -0
- package/dist/extra/sources.cjs +1 -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/extra/storage-tiers-browser.d.cts +76 -5
- package/dist/extra/storage-tiers-browser.d.ts +76 -5
- package/dist/extra/storage-tiers-node.d.cts +137 -13
- package/dist/extra/storage-tiers-node.d.ts +137 -13
- package/dist/extra/storage-tiers.d.cts +151 -23
- package/dist/extra/storage-tiers.d.ts +151 -23
- package/dist/{fallback-axI2cXwt.d.cts → fallback-8JYU8tlT.d.cts} +1 -1
- package/dist/{fallback-DuEXfA4F.d.ts → fallback-CMZl39L5.d.ts} +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-YQXDndFy.d.ts → graph-30XSgtVX.d.ts} +287 -104
- package/dist/{graph-CaNXUc3c.d.cts → graph-BUwMAxJI.d.cts} +287 -104
- package/dist/{index-CIcu6fIR.d.ts → index-2n8Eai6M.d.ts} +1 -1
- package/dist/{index-BmLkcDlj.d.ts → index-89FczVZ_.d.ts} +47 -71
- package/dist/{index-Ci358GSC.d.cts → index-8R1vzNOx.d.cts} +9 -9
- package/dist/{index-CDvC1m5p.d.ts → index-B2RUoIUz.d.ts} +1 -1
- package/dist/{index-DuhOdNyg.d.ts → index-B41Asm7D.d.ts} +10 -8
- package/dist/{index-CKcnuQ2c.d.ts → index-B9fmw5n2.d.ts} +4 -6
- package/dist/{index-0qOD-421.d.ts → index-BAlaVimV.d.ts} +9 -9
- package/dist/{index-Ae6L8liv.d.ts → index-BC9VybQs.d.ts} +41 -48
- package/dist/{index-CUTHDZ7Q.d.ts → index-BEHmxORq.d.ts} +11 -11
- package/dist/{index-C_qi0WlF.d.cts → index-BJ26eEjs.d.cts} +26 -19
- package/dist/{index-BiomL7AW.d.ts → index-BJSZxSFX.d.ts} +1 -1
- package/dist/{index-DCAuN9u5.d.cts → index-BKMdnYnk.d.ts} +75 -39
- package/dist/{index-DfAo9WKr.d.ts → index-BM9szD8n.d.cts} +14 -6
- package/dist/{index-CajEOoAN.d.ts → index-BUPVld1w.d.ts} +2 -2
- package/dist/{index-C-pFD_FV.d.ts → index-BXd6OMEy.d.ts} +3 -3
- package/dist/index-BhUaMYm_.d.ts +113 -0
- package/dist/{index-DAKm44My.d.cts → index-BndG0cpK.d.cts} +3 -3
- package/dist/{index-Bpzw8hx3.d.ts → index-Br3WnqEn.d.ts} +84 -9
- package/dist/{index-D6tRNEKz.d.cts → index-BskfDoZ_.d.ts} +14 -6
- package/dist/{index-9mbs_PIG.d.ts → index-C19qqa38.d.ts} +4 -4
- package/dist/{index-fHKHdAso.d.ts → index-C7VV_qOs.d.ts} +4 -4
- package/dist/{index-CLPQyYY5.d.cts → index-CIRG8Hxp.d.cts} +11 -11
- package/dist/{index-B3D_z0Z6.d.cts → index-CL7oilfm.d.cts} +1 -1
- package/dist/{index-BOfHwQc1.d.ts → index-CPhBvRJU.d.ts} +1 -1
- package/dist/{index-B9qJmmv3.d.cts → index-CWHtYmSh.d.cts} +1 -1
- package/dist/{index-D_d1erkR.d.ts → index-Cey6VTnX.d.ts} +8 -5
- package/dist/{resilience-BWP2c7Af.d.cts → index-CmqiJZKM.d.ts} +141 -23
- package/dist/{index-JYtN9uqM.d.ts → index-CoM4rzyB.d.ts} +1 -1
- package/dist/{index-DTYIRT_v.d.cts → index-CpLpJb6A.d.cts} +8 -5
- package/dist/{index-BjWZARLy.d.ts → index-Ctb7_2sG.d.ts} +1 -1
- package/dist/index-CusEP3Sv.d.ts +210 -0
- package/dist/{resilience-Bys63Cpd.d.ts → index-CwP_KAMS.d.cts} +141 -23
- package/dist/{index-BFuVcqL8.d.cts → index-D3ayz3hy.d.cts} +1 -1
- package/dist/{index-CrpjECS6.d.cts → index-DCbE8fFM.d.cts} +3 -3
- package/dist/{index-D_DThl_J.d.cts → index-DIHcMLr6.d.cts} +1 -1
- package/dist/index-DINuaZlJ.d.cts +210 -0
- package/dist/{index-9xhIaM-w.d.cts → index-DOBLxOti.d.cts} +1 -1
- package/dist/index-DQUVq1_d.d.ts +374 -0
- package/dist/{index-B1IcU--K.d.cts → index-DTtBpuQy.d.cts} +4 -6
- package/dist/{index-D_QQ_dTD.d.cts → index-DYTBbF8T.d.cts} +1 -1
- package/dist/{index-DqtXA3yX.d.cts → index-DlgHqQxW.d.cts} +84 -9
- package/dist/{index-D1E1tqHT.d.ts → index-DlrWu9Hs.d.cts} +75 -39
- package/dist/{index-DcWbx58m.d.cts → index-DoYc8BWK.d.cts} +41 -48
- package/dist/{index-D0ZxFXYl.d.ts → index-DszPlZzK.d.ts} +3 -3
- package/dist/{index-BECJ8M0T.d.cts → index-DyM4tFAe.d.cts} +10 -8
- package/dist/{index-D11pGlaI.d.cts → index-FVoPvhAu.d.cts} +4 -4
- package/dist/{index-BwtIbzSV.d.cts → index-H_I66pav.d.cts} +2 -2
- package/dist/{index-e1m3ZHgc.d.cts → index-IwFqHxCs.d.cts} +2 -2
- package/dist/index-K-vl_c6A.d.cts +113 -0
- package/dist/{index-C4N-dg5U.d.cts → index-KlZ_ZUip.d.cts} +2 -2
- package/dist/index-L8XI8Zql.d.cts +374 -0
- package/dist/{index-D8IyqHvT.d.cts → index-MxYuWOrf.d.cts} +6 -4
- package/dist/{index-CpZKtdMw.d.cts → index-PgwvGWa1.d.cts} +1 -1
- package/dist/{index-B46GWgk3.d.ts → index-PlJ3MraE.d.ts} +1 -1
- package/dist/{index-DPqR3wdW.d.ts → index-PqbnoScQ.d.ts} +3 -3
- package/dist/{index-CU3z8Cel.d.cts → index-PsVHpPwP.d.cts} +3 -3
- package/dist/{index-C0tga1_x.d.ts → index-WyFKER-c.d.ts} +2 -2
- package/dist/{index-B5UR87KG.d.ts → index-eaQuGJnv.d.ts} +6 -4
- package/dist/{index-CzIWlnPp.d.ts → index-iTX5IqSP.d.ts} +140 -9
- package/dist/{index-CRycrNfn.d.ts → index-jKLph6cu.d.ts} +2 -2
- package/dist/{index-BhLA9feT.d.ts → index-jr6PuSBt.d.ts} +26 -19
- package/dist/{index-4IwO4mH2.d.cts → index-mNwgxC21.d.cts} +140 -9
- package/dist/{index-CkN8CZlT.d.cts → index-pVDQcbar.d.cts} +47 -71
- package/dist/{index-D6pwWiOc.d.cts → index-xZYcDqFH.d.cts} +4 -4
- package/dist/{index-8OxXae3g.d.ts → index-yLt-aPMp.d.ts} +1 -1
- package/dist/{index-CqSJ25A9.d.cts → index-z8WFPVI8.d.cts} +1 -1
- package/dist/index.cjs +64 -60
- package/dist/index.d.cts +48 -47
- package/dist/index.d.ts +48 -47
- package/dist/index.js +1 -1
- package/dist/meta-Ct9nqQS5.d.cts +102 -0
- package/dist/meta-D8OyedKp.d.ts +102 -0
- package/dist/{node-fSc-hCv8.d.cts → node-BYInONRr.d.cts} +3 -3
- package/dist/{node-fSc-hCv8.d.ts → node-BYInONRr.d.ts} +3 -3
- package/dist/{observable-Cqty11jG.d.cts → observable-DMIlYJV1.d.cts} +1 -1
- package/dist/{observable-EAV_rNfM.d.ts → observable-DO8DDEzv.d.ts} +1 -1
- package/dist/patterns/ai/browser.cjs +5 -5
- 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 -21
- 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.cjs +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/audit/index.cjs +3 -7
- package/dist/patterns/audit/index.d.cts +6 -6
- package/dist/patterns/audit/index.d.ts +6 -6
- package/dist/patterns/audit/index.js +1 -1
- package/dist/patterns/cqrs/index.cjs +3 -7
- 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 -8
- 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 -7
- 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 +38 -38
- 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/guarded-execution/index.cjs +3 -7
- package/dist/patterns/guarded-execution/index.d.cts +7 -7
- package/dist/patterns/guarded-execution/index.d.ts +7 -7
- package/dist/patterns/guarded-execution/index.js +1 -1
- package/dist/patterns/harness/index.cjs +8 -12
- package/dist/patterns/harness/index.d.cts +12 -12
- package/dist/patterns/harness/index.d.ts +12 -12
- package/dist/patterns/harness/index.js +1 -1
- package/dist/patterns/job-queue/index.cjs +3 -7
- 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/lens/index.cjs +3 -7
- package/dist/patterns/lens/index.d.cts +6 -6
- package/dist/patterns/lens/index.d.ts +6 -6
- package/dist/patterns/lens/index.js +1 -1
- package/dist/patterns/memory/index.cjs +3 -7
- package/dist/patterns/memory/index.d.cts +7 -5
- package/dist/patterns/memory/index.d.ts +7 -5
- package/dist/patterns/memory/index.js +1 -1
- package/dist/patterns/messaging/index.cjs +3 -7
- 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 -7
- package/dist/patterns/orchestration/index.d.cts +8 -8
- package/dist/patterns/orchestration/index.d.ts +8 -8
- 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 -8
- 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 -7
- 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/refine-loop/index.cjs +5 -9
- package/dist/patterns/refine-loop/index.d.cts +6 -6
- package/dist/patterns/refine-loop/index.d.ts +6 -6
- package/dist/patterns/refine-loop/index.js +1 -1
- package/dist/patterns/resilient-pipeline/index.cjs +1 -1
- package/dist/patterns/resilient-pipeline/index.d.cts +4 -8
- package/dist/patterns/resilient-pipeline/index.d.ts +4 -8
- package/dist/patterns/resilient-pipeline/index.js +1 -1
- package/dist/patterns/surface/index.cjs +13 -17
- 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-BrrYGjuZ.d.cts → pipeline-graph-BQPr2Lqs.d.cts} +34 -17
- package/dist/{pipeline-graph-DX2Twdj-.d.ts → pipeline-graph-D8vKcO_p.d.ts} +34 -17
- package/dist/{reactive-layout-DrGjuwyC.d.cts → reactive-layout-8CSc0tiA.d.cts} +2 -2
- package/dist/{reactive-layout-BDdngW56.d.ts → reactive-layout-DkTXxtSy.d.ts} +2 -2
- package/dist/{reactive-log-jirQsxMY.d.ts → reactive-log-BlAsPLl2.d.ts} +30 -3
- package/dist/{reactive-log-ScpWyqny.d.cts → reactive-log-_zeEnB9H.d.cts} +30 -3
- package/dist/{reactive-map-DmgeADH8.d.cts → reactive-map-B2qfD3hb.d.cts} +1 -1
- package/dist/{reactive-map-CHyeCf4D.d.ts → reactive-map-jFIsE6Kt.d.ts} +1 -1
- package/dist/resilience-HTF2LBRS.js +1 -0
- package/dist/{sugar-D13E2M_z.d.ts → sugar-BhfjgetH.d.ts} +1 -1
- package/dist/{sugar-DgaGJcI6.d.cts → sugar-DzePN5-g.d.cts} +1 -1
- package/dist/{topology-tree-BkhmMg2a.d.cts → topology-tree-B5Ngw3j0.d.cts} +1 -1
- package/dist/{topology-tree-BI665P0L.d.ts → topology-tree-BtvbgMXJ.d.ts} +1 -1
- package/dist/{types-BMSGPlpO.d.cts → types-1Dhoi7HM.d.cts} +1 -1
- package/dist/{types-CidcBDuk.d.ts → types-39jk0kaV.d.ts} +1 -1
- package/package.json +11 -1
- package/dist/chunk-4EATTNAE.js +0 -1
- package/dist/chunk-533RQFF6.js +0 -1
- package/dist/chunk-6SVKZ7VI.js +0 -1
- package/dist/chunk-A5HZZYRK.js +0 -1
- package/dist/chunk-B4L5X2QO.js +0 -7
- package/dist/chunk-C5CBVOCB.js +0 -1
- package/dist/chunk-CZIQ6JCE.js +0 -1
- package/dist/chunk-FJ6IEMOS.js +0 -1
- package/dist/chunk-FMI4CWFL.js +0 -1
- package/dist/chunk-G6Q3DUMJ.js +0 -1
- package/dist/chunk-GDDPCDLG.js +0 -1
- package/dist/chunk-GFOT6UBB.js +0 -1
- package/dist/chunk-JJTF75VS.js +0 -1
- package/dist/chunk-K2WYIVHM.js +0 -1
- package/dist/chunk-KTWBUJO5.js +0 -61
- package/dist/chunk-M27MVZCP.js +0 -1
- package/dist/chunk-NKKUUKPD.js +0 -43
- package/dist/chunk-O32GJOUJ.js +0 -1
- package/dist/chunk-QKBCTKH7.js +0 -1
- package/dist/chunk-QWVQIL3T.js +0 -1
- package/dist/chunk-UODQF4EY.js +0 -1
- package/dist/chunk-WGST56ZH.js +0 -80
- package/dist/chunk-WSLN4JFO.js +0 -1
- package/dist/chunk-XIJKEXWR.js +0 -1
- package/dist/imperative-audit-ahAE65a9.d.cts +0 -28
- package/dist/imperative-audit-ahAE65a9.d.ts +0 -28
- package/dist/index-BCq12BqB.d.ts +0 -139
- package/dist/index-BokynmA4.d.cts +0 -186
- package/dist/index-DXz9uwcs.d.ts +0 -186
- package/dist/index-DbWwMWiB.d.cts +0 -139
- package/dist/meta-BGO6C7K9.d.cts +0 -41
- package/dist/meta-CC6EPdpK.d.ts +0 -41
- package/dist/resilience-OBU472D2.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{b as Re,i as Pe}from"./chunk-IUB4NYI2.js";import{a as Ne}from"./chunk-SGS4OJGS.js";import{x as fe}from"./chunk-L7WY6TZS.js";import{a as Z,b as le,i as Oe}from"./chunk-4VVTGLXJ.js";import{f as pe}from"./chunk-IA7DUNGB.js";import{A as ee,D as be,E as U,F as B,m as J,p as D}from"./chunk-LYCLF26R.js";import{b as E,c as ye,d as ke,h as de,i as P,j as x}from"./chunk-CK2E7BTU.js";function Ce(r){return{describeKind:"producer",...r}}function oe(r,n){return B(i=>{let s=!0,u={emit(t){s&&i.emit(t)},error(t){s&&(s=!1,i.down([[x,t]]))},complete(){s&&(s=!1,i.down([[P]]))}},o;try{let t=r(u);o=typeof t=="function"?t:void 0}catch(t){return u.error(t),()=>{s=!1}}return()=>{s=!1;try{o?.()}catch{}}},Ce(n))}function Me(r,n,i){let s=!0,u,o=0,t=0,e={},a=[],c=()=>{let l=u;u=void 0;try{l?.()}catch{}};for(let l of n){let m=i?.name?`${i.name}::${l}`:l,g=i?.channelOpts?.[l],y=B(T=>(o++,()=>{t++,o>0&&t>=o&&t>=n.length&&c()}),Ce({...g,name:m}));e[l]=y,a.push(y)}let f={};for(let l of n)f[l]=m=>{s&&e[l].down([[E,m]])};f.error=l=>{s&&(s=!1,J(()=>{for(let m of a)m.down([[x,l]])}),c())},f.complete=()=>{s&&(s=!1,J(()=>{for(let l of a)l.down([[P]])}),c())};let p=r(f);return u=typeof p=="function"?p:void 0,Object.assign(e,{dispose:()=>{s&&(s=!1,J(()=>{for(let l of a)try{l.down([[P]])}catch{}}),c())}})}var he=class{ring;arr;constructor(n){n===Number.POSITIVE_INFINITY||n<=0?(this.arr=[],this.ring=null):(this.ring=new Ne(n),this.arr=null)}get length(){return this.ring!=null?this.ring.size:this.arr.length}push(n){this.ring!=null?this.ring.push(n):this.arr.push(n)}shift(){return this.ring!=null?this.ring.shift():this.arr.shift()}drain(){if(this.ring!=null){let i=this.ring.toArray();return this.ring.clear(),i}let n=this.arr;return this.arr=[],n}};function se(r){return r instanceof Error?r:new Error(String(r))}function De(r){return r===void 0?null:typeof r=="string"?Oe(r):r}function z(r,n){let{name:i,onTransportError:s,retry:u,backpressure:o,batchSize:t=Number.POSITIVE_INFINITY,flushIntervalMs:e=0,serialize:a,stopOn:c,onUpstreamMessage:f,onDispose:p,send:d,sendBatch:l,ctx:m}=n;if(!d&&!l)throw new Error("reactiveSink: `send` or `sendBatch` must be provided");let g=m,y=Math.max(1,u?.maxAttempts??1),T=De(u?.backoff??(y>1?"exponential":void 0)),h=u?.shouldRetry??(()=>!0),b=l!==void 0||t<Number.POSITIVE_INFINITY||e>0,w=k=>i?`${i}::${k}`:void 0,v=U(void 0,{equals:()=>!1,name:w("sent")}),S=U(null,{name:w("failed")}),L=U(0,{name:w("inFlight")}),F=U(null,{name:w("errors")}),K=b?U(0,{name:w("buffered")}):void 0,Y=o?U(!1,{name:w("paused")}):void 0,ie=0,Q=k=>{ie+=k,L.down([[E,ie]])},O=k=>{try{s?.(k)}catch{}try{F.down([[E,k]])}catch{}},q=new Set,V=k=>{q.add(k);let N=()=>q.delete(k);k.then(N,N)},I=(k,N,C)=>{let A=T?T(N-1,C,null):0,H=A==null?0:typeof A=="number"&&A>0?A:0,j=Math.max(1,Math.ceil(H/1e6));return new Promise(M=>{setTimeout(()=>M(k()),j)})},$=k=>k!=null&&typeof k=="object"&&typeof k.then=="function",_=k=>{let N;try{N=a?a(k):k}catch(M){let R=se(M);return O({stage:"serialize",error:R,value:k}),S.down([[E,{value:k,error:R,attempts:0}]]),Promise.resolve()}let C=0,A=M=>{Q(-1);let R=se(M);if(O({stage:"send",error:R,value:k,attempt:C}),!(C<y&&h(R,C))){S.down([[E,{value:k,error:R,attempts:C}]]);return}return I(j,C,R)},H=()=>{Q(-1),v.down([[E,k]])};function j(){C+=1,Q(1);let M;try{M=d(N,g)}catch(R){return A(R)??Promise.resolve()}return $(M)?M.then(H,R=>A(R)):(H(),Promise.resolve())}return j()},te=o?.maxBuffer??Number.POSITIVE_INFINITY,X=new he(te),G,ae=!1,me=()=>{K?.down([[E,X.length]])},ue=k=>{Y&&Y.down([[E,k]])},we=o?.strategy??"drop-oldest",Be=(k,N)=>{let C={value:k,payload:N};if(X.length<te)return X.push(C),me(),!0;if(we==="drop-oldest"){let H=X.shift();return X.push(C),me(),ue(!0),S.down([[E,{value:H.value,error:new Error("backpressure: buffer overflow \u2014 dropped oldest"),attempts:0}]]),!0}if(we==="drop-newest")return ue(!0),S.down([[E,{value:k,error:new Error("backpressure: buffer overflow \u2014 dropped newest"),attempts:0}]]),!1;let A=new Error("backpressure: buffer overflow");return O({stage:"send",error:A,value:k}),S.down([[E,{value:k,error:A,attempts:0}]]),ue(!0),!1},Fe=k=>{let N=0,C=k.map(M=>M.payload),A=M=>{Q(-1);let R=se(M);if(O({stage:"send",error:R,value:k.map(ge=>ge.value),attempt:N}),!(N<y&&h(R,N))){for(let{value:ge}of k)S.down([[E,{value:ge,error:R,attempts:N}]]);return}return I(j,N,R)},H=()=>{Q(-1);for(let{value:M}of k)v.down([[E,M]])};function j(){N+=1,Q(1);let M;try{M=l(C,g)}catch(R){return A(R)??Promise.resolve()}return $(M)?M.then(H,R=>A(R)):(H(),Promise.resolve())}return j()},He=async k=>{for(let N of k)await ze(N.value,N.payload)},ze=(k,N)=>{let C=0,A=M=>{Q(-1);let R=se(M);if(O({stage:"send",error:R,value:k,attempt:C}),!(C<y&&h(R,C))){S.down([[E,{value:k,error:R,attempts:C}]]);return}return I(j,C,R)},H=()=>{Q(-1),v.down([[E,k]])};function j(){C+=1,Q(1);let M;try{M=d(N,g)}catch(R){return A(R)??Promise.resolve()}return $(M)?M.then(H,R=>A(R)):(H(),Promise.resolve())}return j()},ne=()=>{if(ae||X.length===0)return Promise.resolve();let k=X.drain();if(me(),ue(!1),l!==void 0){let C=Fe(k);return V(C),C}let N=He(k);return V(N),N},qe=()=>{G!==void 0||ae||e<=0||(G=setTimeout(()=>{G=void 0,ne()},e))},Ue=r.subscribe(k=>{for(let N of k){let C=N[0];if(C!==E)try{f?.(N)}catch{}if(C===E){let A=N[1];if(b){let H;if(a)try{H=a(A)}catch(M){let R=se(M);O({stage:"serialize",error:R,value:A}),S.down([[E,{value:A,error:R,attempts:0}]]);continue}else H=A;if(!Be(A,H))continue;X.length>=t?ne():qe()}else{let H=_(A);V(H)}}else ee.messageTier(C)>=3&&b&&(G!==void 0&&(clearTimeout(G),G=void 0),ne())}}),Se;if(c){let k=!1;Se=c.subscribe(N=>{if(!k){k=!0;return}N.length>0&&!Te&&Ee()})}let Te=!1,Ee=()=>{if(Te)return;Te=!0,G!==void 0&&(clearTimeout(G),G=void 0),b&&ne(),ae=!0,Se?.(),Ue();let k=N=>{try{N.down([[de]])}catch{}};k(F),k(S),k(v),k(L),K&&k(K),Y&&k(Y);try{p?.()}catch{}},ce={dispose:Ee,sent:v,failed:S,inFlight:L,errors:F};return b&&(ce.buffered=K,ce.flush=async()=>{ae||(await ne(),await Promise.all(q))}),Y&&(ce.paused=Y),ce}function W(r){return{describeKind:"producer",...r}}function Ke(r,n){let{parse:i,closeOnTeardown:s=!1,...u}=n??{};return B(o=>{let t=!0,e,a=()=>{let T=e;e=void 0,T?.()},c=T=>{t&&(t=!1,o.down([T]),a())},f=(T,h=T)=>{if(t)try{let b=T!==null&&typeof T=="object"&&"data"in T?T.data:T,w=i?i(b,h):b;o.emit(w)}catch(b){c([x,b])}},p=T=>{c([x,T])},d=()=>{c([P])};if(typeof r=="function"){try{if(e=r(f,p,d),typeof e!="function")throw new Error("fromWebSocket register contract violation: register must return cleanup callable")}catch(T){c([x,T])}return()=>{t=!1,a()}}let l=r,m=T=>f(T,T),g=T=>p(T),y=()=>d();return l.addEventListener("message",m),l.addEventListener("error",g),l.addEventListener("close",y),e=()=>{l.removeEventListener("message",m),l.removeEventListener("error",g),l.removeEventListener("close",y),s&&l.close()},()=>{t=!1,a()}},W(u))}function Tr(r,n){return oe(r,n)}function $e(r,n){let{method:i="GET",headers:s,body:u,transform:o=b=>b.json(),timeoutNs:t=30*1e9,signal:e,completeAfterFetch:a=!1,refetchOnSubscribe:c=!1,...f}=n??{},p=U(0,{name:`${f.name??"http"}/fetchCount`}),d=U(0,{name:`${f.name??"http"}/lastUpdated`}),l=U(!1,{name:`${f.name??"http"}/fetched`}),m=0,g=u!==void 0?typeof u=="string"?u:JSON.stringify(u):void 0,y=b=>{let w=new AbortController,v=!0;if(e?.aborted)return v=!1,b.down([[x,e.reason??new Error("Aborted")]]),()=>{};e?.addEventListener("abort",()=>w.abort(e.reason),{once:!0});let S=setTimeout(()=>w.abort(new Error("Request timeout")),Math.ceil(t/1e6));return fetch(r,{method:i,headers:s,body:g,signal:w.signal}).then(async L=>{if(clearTimeout(S),!v)return;if(!L.ok)throw new Error(`HTTP ${L.status}: ${L.statusText}`);let F=await o(L);v&&(J(()=>{m+=1,p.down([[E,m]]),d.down([[E,D()]]),l.down([[E,!0]]),b.emit(F)}),a&&b.down([[P]]))}).catch(L=>{clearTimeout(S),v&&(L&&L.name==="AbortError"||b.down([[x,L]]))}),()=>{v=!1,w.abort()}},T=B(b=>y({emit:w=>b.emit(w),down:w=>b.down(w)}),{...W(f),resubscribable:c});return{...Pe(T),fetchCount:p,lastUpdated:d,fetched:l}}function gr(r,n,i){let{method:s="POST",headers:u={"Content-Type":"application/json"},serialize:o=m=>JSON.stringify(m),timeoutNs:t,batchFormat:e="json-array",batchSize:a,flushIntervalMs:c,retry:f,onTransportError:p}=i??{},d=async m=>{let g=t!==void 0?new AbortController:void 0,y;g&&t!==void 0&&(y=setTimeout(()=>g.abort(new Error("Request timeout")),Math.ceil(t/1e6)));try{let T=await fetch(n,{method:s,headers:u,body:m,signal:g?.signal}),h=async()=>{try{await T.arrayBuffer?.()}catch{}};if(!T.ok)throw await h(),new Error(`HTTP ${T.status}: ${T.statusText}`);await h()}finally{y!==void 0&&clearTimeout(y)}};return a!==void 0||c!==void 0?z(r,{onTransportError:p,retry:f,batchSize:a,flushIntervalMs:c,sendBatch:async m=>{let g;e==="ndjson"?g=m.map(y=>{let T=o(y);return typeof T=="string"?T:new TextDecoder().decode(T)}).join(`
|
|
2
2
|
`):g=JSON.stringify(m),await d(g)}}):z(r,{onTransportError:p,retry:f,serialize:o,send:async m=>{await d(m)}})}function Ae(r){return Symbol.keyFor(r)??r.description??"message"}function re(r,n){return typeof r=="string"?r:n(r)}function Le(r,n){let i=`event: ${r}
|
|
3
3
|
`;if(n!==void 0){let s=n.split(/\r?\n/);for(let u of s)i+=`data: ${u}
|
|
4
4
|
`}return`${i}
|
|
@@ -7,7 +7,7 @@ import{a as Ne,h as Re}from"./chunk-A5HZZYRK.js";import{a as Pe}from"./chunk-SGS
|
|
|
7
7
|
`))},a)),c?.aborted?b():c?.addEventListener("abort",b,{once:!0})},cancel(){d?.()}})}function kr(r,n){let{serialize:i=d=>{if(d instanceof Error)return d.message;try{return JSON.stringify(d)}catch{return String(d)}},dataEvent:s="data",errorEvent:u="error",completeEvent:o="complete",includeResolved:t=!1,includeDirty:e=!1,keepAliveMs:a,signal:c,eventNameResolver:f=Ae}=n??{},p=new TextEncoder;return B(d=>{let l=!0,m,g=(h,b)=>{l&&d.emit(p.encode(Le(h,b)))},y=()=>{l&&(l=!1,d.down([[P]]))},T=r.subscribe(h=>{if(l)for(let b of h){let w=b[0];if(!(ee.isLocalOnly(w)&&!(w===ye&&e))){if(w===E){g(s,re(b[1],i));continue}if(w===x){g(u,re(b[1],i)),l=!1,d.down([[P]]);return}if(w===P){g(o),l=!1,d.down([[P]]);return}!t&&w===ke||g(f(w),b.length>1?re(b[1],i):void 0)}}});return a!==void 0&&a>0&&(m=setInterval(()=>{l&&d.emit(p.encode(`: keepalive
|
|
8
8
|
|
|
9
9
|
`))},a)),c?.aborted?y():c?.addEventListener("abort",y,{once:!0}),()=>{l=!1,m!==void 0&&clearInterval(m),c?.removeEventListener("abort",y),T()}})}function br(r){let n,i=!1;return new ReadableStream({start(s){n=r.subscribe(u=>{for(let o of u){let t=o[0];if(i)return;if(t===E)try{s.enqueue(o[1])}catch{i=!0,n?.()}else if(t===x){i=!0;try{s.error(o[1])}catch{}return}else if(t===P){i=!0;try{s.close()}catch{}return}}})},cancel(){i=!0,n?.()}})}async function*je(r,n){let i=n?.parse??(v=>v),s=n?.signal,u=new TextDecoder,o="",t="message",e=[],a,c,f=[],p=()=>{if(e.length===0&&t==="message"&&a===void 0){e=[];return}let v=e.join(`
|
|
10
|
-
`);f.push({event:t,data:i(v),id:a,retry:c}),t="message",e=[],a=void 0,c=void 0},d=v=>{if(v===""){p();return}if(v.startsWith(":"))return;let S=v.indexOf(":"),L=S<0?v:v.slice(0,S),F=S<0?"":v.slice(S+1);switch(F.startsWith(" ")&&(F=F.slice(1)),L){case"event":t=F;break;case"data":e.push(F);break;case"id":F.includes("\0")||(a=F);break;case"retry":{let K=Number(F);Number.isFinite(K)&&(c=K);break}}},l=(v,S)=>{o+=u.decode(v,{stream:!S});let L=o.split(/\r?\n/);o=L.pop()??"";for(let F of L)d(F)},m=r,g=r instanceof ReadableStream?r:m&&typeof m=="object"&&m.body instanceof ReadableStream?m.body:null,y,T,h=!1,b=()=>{h||(h=!0,y&&y.cancel().catch(()=>{}),T&&typeof T.return=="function"&&Promise.resolve(T.return()).catch(()=>{}))},w=()=>{b()};if(s){if(s.aborted)return;s.addEventListener("abort",w,{once:!0})}try{if(g){for(y=g.getReader();!s?.aborted;){let{value:v,done:S}=await y.read();if(S)break;for(l(v,!1);f.length>0;)yield f.shift()}l(new Uint8Array,!0)}else{for(T=r[Symbol.asyncIterator]();!s?.aborted;){let S=await T.next();if(S.done)break;for(l(S.value,!1);f.length>0;)yield f.shift()}l(new Uint8Array,!0)}if(o.trim()){for(let v of o.split(/\r?\n/))d(v);p()}for(;f.length>0;)yield f.shift()}finally{s&&s.removeEventListener("abort",w),b()}}function hr(r,n){let{parse:i,...s}=n??{};return B(u=>{let o=!0,t=new AbortController;return(async()=>{try{for await(let a of je(r,{parse:i,signal:t.signal})){if(!o)return;u.emit(a)}o&&u.down([[P]])}catch(a){o&&u.down([[x,a]])}})(),()=>{o=!1,t.abort()}},W(s))}function vr(r,n){let{method:i="GET",headers:s,body:u,signal:o,...t}=n??{};return B(e=>{let a=!0,c=new AbortController;if(o?.aborted)return e.down([[x,o.reason??new Error("Aborted")]]),()=>{};o?.addEventListener("abort",()=>c.abort(o.reason),{once:!0});let f=u!==void 0?typeof u=="string"?u:JSON.stringify(u):void 0;return(async()=>{try{let d=await fetch(r,{method:i,headers:s,body:f,signal:c.signal});if(!a)return;if(!d.ok)throw new Error(`HTTP ${d.status}: ${d.statusText}`);if(!d.body)throw new Error("HTTP response has no body");let l=d.body.getReader();for(;a;){let{value:m,done:g}=await l.read();if(g)break;m&&e.emit(m)}a&&e.down([[P]])}catch(d){if(!a||d&&d.name==="AbortError")return;e.down([[x,d]])}})(),()=>{a=!1,c.abort()}},W(t))}function wr(r,n){let{intervalMs:i=5e3,...s}=n??{};return fe(pe(i,{period:i}),()=>$e(r,{...s,completeAfterFetch:!0}).node)}function Sr(r,n,i){let{serialize:s=T=>{if(typeof T=="string"||T instanceof Blob||T instanceof ArrayBuffer||ArrayBuffer.isView(T))return T;try{return JSON.stringify(T)}catch{return String(T)}},closeOnComplete:u=!0,closeOnError:o=!0,closeCode:t,closeReason:e,onTransportError:a,retry:c,backpressure:f,stopOn:p}=i??{},d=!1,l=T=>{if(!d){d=!0;try{n.close(t,e)}catch(h){let b=h instanceof Error?h:new Error(String(h));try{a?.({stage:"close",error:b,value:void 0,message:T})}catch{}}}},m=null,y=z(r,{onTransportError:a,serialize:T=>{let h=s(T);if(h===void 0)throw new Error("serialize returned undefined");return h},retry:c,backpressure:f,stopOn:p,onDispose:()=>{if(m){try{n.removeEventListener("close",m)}catch{}m=null}},send:T=>{n.send(T)},onUpstreamMessage:T=>{(T[0]===P&&u||T[0]===x&&o)&&l(T)}});return m=()=>{d=!0,y.dispose()},n.addEventListener("close",m),y}function Er(r,n){let{parse:i,maxRetries:s,backoff:u="exponential",closeOnTeardown:o=!0,...t}=n??{};return
|
|
10
|
+
`);f.push({event:t,data:i(v),id:a,retry:c}),t="message",e=[],a=void 0,c=void 0},d=v=>{if(v===""){p();return}if(v.startsWith(":"))return;let S=v.indexOf(":"),L=S<0?v:v.slice(0,S),F=S<0?"":v.slice(S+1);switch(F.startsWith(" ")&&(F=F.slice(1)),L){case"event":t=F;break;case"data":e.push(F);break;case"id":F.includes("\0")||(a=F);break;case"retry":{let K=Number(F);Number.isFinite(K)&&(c=K);break}}},l=(v,S)=>{o+=u.decode(v,{stream:!S});let L=o.split(/\r?\n/);o=L.pop()??"";for(let F of L)d(F)},m=r,g=r instanceof ReadableStream?r:m&&typeof m=="object"&&m.body instanceof ReadableStream?m.body:null,y,T,h=!1,b=()=>{h||(h=!0,y&&y.cancel().catch(()=>{}),T&&typeof T.return=="function"&&Promise.resolve(T.return()).catch(()=>{}))},w=()=>{b()};if(s){if(s.aborted)return;s.addEventListener("abort",w,{once:!0})}try{if(g){for(y=g.getReader();!s?.aborted;){let{value:v,done:S}=await y.read();if(S)break;for(l(v,!1);f.length>0;)yield f.shift()}l(new Uint8Array,!0)}else{for(T=r[Symbol.asyncIterator]();!s?.aborted;){let S=await T.next();if(S.done)break;for(l(S.value,!1);f.length>0;)yield f.shift()}l(new Uint8Array,!0)}if(o.trim()){for(let v of o.split(/\r?\n/))d(v);p()}for(;f.length>0;)yield f.shift()}finally{s&&s.removeEventListener("abort",w),b()}}function hr(r,n){let{parse:i,...s}=n??{};return B(u=>{let o=!0,t=new AbortController;return(async()=>{try{for await(let a of je(r,{parse:i,signal:t.signal})){if(!o)return;u.emit(a)}o&&u.down([[P]])}catch(a){o&&u.down([[x,a]])}})(),()=>{o=!1,t.abort()}},W(s))}function vr(r,n){let{method:i="GET",headers:s,body:u,signal:o,...t}=n??{};return B(e=>{let a=!0,c=new AbortController;if(o?.aborted)return e.down([[x,o.reason??new Error("Aborted")]]),()=>{};o?.addEventListener("abort",()=>c.abort(o.reason),{once:!0});let f=u!==void 0?typeof u=="string"?u:JSON.stringify(u):void 0;return(async()=>{try{let d=await fetch(r,{method:i,headers:s,body:f,signal:c.signal});if(!a)return;if(!d.ok)throw new Error(`HTTP ${d.status}: ${d.statusText}`);if(!d.body)throw new Error("HTTP response has no body");let l=d.body.getReader();for(;a;){let{value:m,done:g}=await l.read();if(g)break;m&&e.emit(m)}a&&e.down([[P]])}catch(d){if(!a||d&&d.name==="AbortError")return;e.down([[x,d]])}})(),()=>{a=!1,c.abort()}},W(t))}function wr(r,n){let{intervalMs:i=5e3,...s}=n??{};return fe(pe(i,{period:i}),()=>$e(r,{...s,completeAfterFetch:!0}).node)}function Sr(r,n,i){let{serialize:s=T=>{if(typeof T=="string"||T instanceof Blob||T instanceof ArrayBuffer||ArrayBuffer.isView(T))return T;try{return JSON.stringify(T)}catch{return String(T)}},closeOnComplete:u=!0,closeOnError:o=!0,closeCode:t,closeReason:e,onTransportError:a,retry:c,backpressure:f,stopOn:p}=i??{},d=!1,l=T=>{if(!d){d=!0;try{n.close(t,e)}catch(h){let b=h instanceof Error?h:new Error(String(h));try{a?.({stage:"close",error:b,value:void 0,message:T})}catch{}}}},m=null,y=z(r,{onTransportError:a,serialize:T=>{let h=s(T);if(h===void 0)throw new Error("serialize returned undefined");return h},retry:c,backpressure:f,stopOn:p,onDispose:()=>{if(m){try{n.removeEventListener("close",m)}catch{}m=null}},send:T=>{n.send(T)},onUpstreamMessage:T=>{(T[0]===P&&u||T[0]===x&&o)&&l(T)}});return m=()=>{d=!0,y.dispose()},n.addEventListener("close",m),y}function Er(r,n){let{parse:i,maxRetries:s,backoff:u="exponential",closeOnTeardown:o=!0,...t}=n??{};return Re(()=>Ke(r(),{parse:i,closeOnTeardown:o,...t}),{count:s,backoff:u})}function xr(r,n){let{method:i="notifications/message",onDisconnect:s,...u}=n??{};return oe(({emit:o,error:t})=>(r.setNotificationHandler(i,e=>o(e)),s?.(e=>t(e??new Error("MCP client disconnected"))),()=>r.setNotificationHandler(i,()=>{})),u)}function Or(r,n){return Me(({traces:s,metrics:u,logs:o,error:t})=>r({onTraces:e=>{J(()=>{for(let a of e)s(a)})},onMetrics:e=>{J(()=>{for(let a of e)u(a)})},onLogs:e=>{J(()=>{for(let a of e)o(a)})},onError:t})??void 0,["traces","metrics","logs"],n?.name?{name:n.name}:void 0)}function Nr(r,n){return oe(r,n)}function Rr(r){let n=r.match(/^<(\d{1,3})>\d?\s*(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s*(.*)/s);if(!n){let s=D();return{facility:1,severity:6,timestamp:new Date(Math.floor(s/1e6)).toISOString(),hostname:"-",appName:"-",procId:"-",msgId:"-",message:r.trim(),timestampNs:s}}let i=Number(n[1]);return{facility:i>>3,severity:i&7,timestamp:n[2],hostname:n[3],appName:n[4],procId:n[5],msgId:n[6],message:(n[7]??"").trim(),timestampNs:D()}}function Pr(r,n){return oe(r,n)}var We={c:"counter",g:"gauge",ms:"timer",h:"histogram",s:"set",d:"distribution"};function Cr(r){let n=r.split("|"),[i,s]=(n[0]??"").split(":");if(!i||s===void 0)throw new Error(`Invalid StatsD line: ${r}`);let u=n[1]?.trim()??"c",o=We[u]??"counter",t=o==="set"?0:Number(s),e,a={};for(let c=2;c<n.length;c++){let f=n[c].trim();if(f.startsWith("@"))e=Number(f.slice(1));else if(f.startsWith("#"))for(let p of f.slice(1).split(",")){let[d,l]=p.split(":");d&&(a[d]=l??"")}}return{name:i.trim(),value:t,type:o,sampleRate:e,tags:a,timestampNs:D()}}function Mr(r,n){let{intervalNs:i=15*1e9,headers:s,timeoutNs:u=10*1e9,signal:o,maxConsecutiveErrors:t=1}=n??{},e=Math.ceil(i/1e6),a=0;return fe(pe(0,{period:e,signal:o}),()=>B(c=>{let f=!0,p=new AbortController,d=setTimeout(()=>p.abort(new Error("Scrape timeout")),Math.ceil(u/1e6));return(async()=>{try{let m=await fetch(r,{headers:{Accept:"text/plain",...s},signal:p.signal});if(clearTimeout(d),!f)return;if(!m.ok)throw new Error(`Prometheus scrape ${m.status}: ${m.statusText}`);let g=await m.text();if(!f)return;let y=Qe(g);for(let T of y)c.emit(T);a=0,c.down([[P]])}catch(m){if(clearTimeout(d),!f||m instanceof Error&&m.name==="AbortError")return;a+=1,a>=t&&c.down([[x,m]])}})(),()=>{f=!1,clearTimeout(d),p.abort()}}))}function Qe(r){let n=[],i=new Map,s=new Map;for(let u of r.split(`
|
|
11
11
|
`)){let o=u.trim();if(!o)continue;if(o.startsWith("# TYPE ")){let d=o.slice(7),l=d.indexOf(" ");l>0&&i.set(d.slice(0,l),d.slice(l+1).trim());continue}if(o.startsWith("# HELP ")){let d=o.slice(7),l=d.indexOf(" ");l>0&&s.set(d.slice(0,l),d.slice(l+1).trim());continue}if(o.startsWith("#"))continue;let t,e={},a,c,f=o.indexOf("{");if(f>=0){t=o.slice(0,f);let d=o.indexOf("}",f);if(d<0)continue;let l=o.slice(f+1,d);e=Je(l);let m=o.slice(d+1).trim().split(/\s+/);a=m[0]??"",c=m[1]}else{let d=o.split(/\s+/);t=d[0]??"",a=d[1]??"",c=d[2]}if(!t||!a)continue;let p=t.replace(/(_total|_count|_sum|_bucket|_created|_info)$/,"");n.push({name:t,labels:e,value:Number(a),timestampMs:c?Number(c):void 0,type:i.get(p)??i.get(t),help:s.get(p)??s.get(t),timestampNs:D()})}return n}function Je(r){let n={},i=/(\w+)="((?:[^"\\]|\\.)*)"/g,s=i.exec(r);for(;s!==null;)n[s[1]]=s[2].replace(/\\(.)/g,"$1"),s=i.exec(r);return n}function Ar(r,n,i){let{fromBeginning:s=!1,deserialize:u=t=>{if(t===null)return null;try{return JSON.parse(t.toString())}catch{return t.toString()}},...o}=i??{};return B(t=>{let e=!0;return(async()=>{try{await r.subscribe({topic:n,fromBeginning:s}),await r.run({eachMessage:async({topic:c,partition:f,message:p})=>{if(!e)return;let d={};if(p.headers)for(let[l,m]of Object.entries(p.headers))m!==void 0&&(d[l]=typeof m=="string"?m:m.toString());t.emit({topic:c,partition:f,key:p.key?.toString()??null,value:u(p.value),headers:d,offset:p.offset,timestamp:p.timestamp,timestampNs:D()})}})}catch(c){e&&t.down([[x,c]])}})(),()=>{e=!1}},W(o))}function Lr(r,n,i,s){let{serialize:u=e=>JSON.stringify(e),keyExtractor:o,onTransportError:t}=s??{};return z(r,{onTransportError:t,send:async e=>{let a=o?.(e)??null,c=u(e);await n.send({topic:i,messages:[{key:a,value:Buffer.from(c)}]})}})}function Ir(r,n,i){let{blockMs:s=5e3,startId:u="$",parse:o=e=>{for(let c=0;c<e.length;c+=2)if(e[c]==="data")try{return JSON.parse(e[c+1])}catch{return e[c+1]}let a={};for(let c=0;c<e.length;c+=2)a[e[c]]=e[c+1];return a},...t}=i??{};return B(e=>{let a=!0,c=u;return(async()=>{for(;a;)try{let p=await r.xread("BLOCK",s,"STREAMS",n,c);if(!a)return;if(p)for(let[d,l]of p)for(let[m,g]of l)c=m,e.emit({id:m,key:n,data:o(g),timestampNs:D()})}catch(p){if(!a)return;e.down([[x,p]]);return}})(),()=>{a=!1}},W(t))}function Br(r,n,i,s){let{serialize:u=e=>["data",JSON.stringify(e)],maxLen:o,onTransportError:t}=s??{};return z(r,{onTransportError:t,send:async e=>{let a=u(e);await(o!==void 0?n.xadd(i,"MAXLEN","~",String(o),"*",...a):n.xadd(i,"*",...a))}})}function Fr(r,n){let{delimiter:i=",",hasHeader:s=!0,columns:u,parseLine:o,...t}=n??{},e=o??(a=>Ie(a,i));return B(a=>{let c=!1;return(async()=>{try{let p=u,d="";for await(let l of r){if(c)return;d+=l;let m=d.split(/\r?\n/);d=m.pop()??"";for(let g of m){if(c)return;if(!g.trim())continue;let y=e(g);if(!p&&s){p=y;continue}p||(p=y.map((h,b)=>`col${b}`));let T={};for(let h=0;h<p.length;h++)T[p[h]]=y[h]??"";a.emit(T)}}if(!c&&d.trim()){let l=e(d);if(p){let m={};for(let g=0;g<p.length;g++)m[p[g]]=l[g]??"";a.emit(m)}}c||a.down([[P]])}catch(p){c||a.down([[x,p]])}})(),()=>{c=!0}},W(t))}function Hr(r,n){let{delimiter:i=",",hasHeader:s=!0,columns:u,parseLine:o,...t}=n??{},e=o??(a=>Ie(a,i));return be([r],(a,c,f)=>{let p=a[0];if(p==null||p.length===0)return;let d=f.store;typeof d.buffer!="string"&&(d.buffer=""),d.headers===void 0&&u&&(d.headers=u.slice());for(let l of p){d.buffer=d.buffer+l;let m=d.buffer.split(/\r?\n/);d.buffer=m.pop()??"";for(let g of m){if(!g.trim())continue;let y=e(g);if(!d.headers&&s){d.headers=y;continue}d.headers||(d.headers=y.map((h,b)=>`col${b}`));let T={};for(let h=0;h<d.headers.length;h++)T[d.headers[h]]=y[h]??"";c.emit(T)}}},{describeKind:"derived",...t})}function zr(r,n){return be([r],(i,s,u)=>{let o=i[0];if(o==null||o.length===0)return;let t=u.store;typeof t.buffer!="string"&&(t.buffer="");for(let e of o){t.buffer=t.buffer+e;let a=t.buffer.split(/\r?\n/);t.buffer=a.pop()??"";for(let c of a)if(c.trim())try{s.emit(JSON.parse(c))}catch(f){s.down([[x,f]]);return}}},{describeKind:"derived",...n??{}})}function Ie(r,n){let i=[],s="",u=!1;for(let o=0;o<r.length;o++){let t=r[o];u?t==='"'?r[o+1]==='"'?(s+='"',o++):u=!1:s+=t:t==='"'?u=!0:t===n?(i.push(s),s=""):s+=t}return i.push(s),i}function qr(r,n){return B(i=>{let s=!1;return(async()=>{try{let o="";for await(let t of r){if(s)return;o+=t;let e=o.split(/\r?\n/);o=e.pop()??"";for(let a of e){if(s)return;let c=a.trim();c&&i.emit(JSON.parse(c))}}!s&&o.trim()&&i.emit(JSON.parse(o.trim())),s||i.down([[P]])}catch(o){s||i.down([[x,o]])}})(),()=>{s=!0}},W(n))}function Ur(r,n,i){let{intervalNs:s=5*1e9,format:u="JSONEachRow",signal:o,maxConsecutiveErrors:t=1}=i??{},e=Math.ceil(s/1e6),a=0;return fe(pe(0,{period:e,signal:o}),()=>B(c=>{let f=!0;return(async()=>{try{let d=await r.query({query:n,format:u});if(!f)return;let l=await d.json();if(!f)return;for(let m of l)c.emit(m);a=0,c.down([[P]])}catch(d){if(!f)return;a+=1,a>=t&&c.down([[x,d]])}})(),()=>{f=!1}}))}function Dr(r,n){let{autoAck:i=!0,deserialize:s=e=>{try{return JSON.parse(e.toString())}catch{return e.toString()}},onAckError:u,...o}=n??{},t=e=>{if(u)try{u(e instanceof Error?e:new Error(String(e)))}catch{}};return B(e=>{let a=!0;return(async()=>{for(;a;)try{let f=await r.receive();if(!a)return;let p={topic:f.getTopicName(),messageId:f.getMessageId().toString(),key:f.getPartitionKey(),value:s(f.getData()),properties:f.getProperties(),publishTime:f.getPublishTimestamp(),eventTime:f.getEventTimestamp(),timestampNs:D()};if(i)e.emit(p),r.acknowledge(f).catch(t);else{let d=!1,l={value:p,ack(){d||(d=!0,r.acknowledge(f).catch(t))},nack(m){if(d)return;d=!0;let g=r;try{let y=g.negativeAcknowledge?.(f);y&&typeof y.then=="function"&&y.catch(t)}catch(y){t(y)}}};e.emit(l)}}catch(f){a&&e.down([[x,f]]);return}})(),()=>{a=!1}},W(o))}function Kr(r,n,i){let{serialize:s=e=>Buffer.from(JSON.stringify(e)),keyExtractor:u,propertiesExtractor:o,onTransportError:t}=i??{};return z(r,{onTransportError:t,send:async e=>{await n.send({data:s(e),partitionKey:u?.(e),properties:o?.(e)})}})}function $r(r,n,i){let s=new TextDecoder,{queue:u,deserialize:o=e=>{let a=s.decode(e);try{return JSON.parse(a)}catch{return a}},...t}=i??{};return B(e=>{let a=!0,c=r.subscribe(n,u?{queue:u}:void 0);return(async()=>{try{for await(let p of c){if(!a)return;let d={};if(p.headers)for(let l of p.headers.keys())d[l]=p.headers.get(l);e.emit({subject:p.subject,data:o(p.data),headers:d,reply:p.reply,sid:p.sid,timestampNs:D()})}a&&e.down([[P]])}catch(p){a&&e.down([[x,p]])}})(),()=>{a=!1}},W(t))}function jr(r,n,i,s){let u=new TextEncoder,{serialize:o=e=>u.encode(JSON.stringify(e)),onTransportError:t}=s??{};return z(r,{onTransportError:t,send:e=>{n.publish(i,o(e))}})}function Wr(r,n,i){let{autoAck:s=!0,deserialize:u=a=>{try{return JSON.parse(a.toString())}catch{return a.toString()}},onAckError:o,...t}=i??{},e=a=>{if(o)try{o(a instanceof Error?a:new Error(String(a)))}catch{}};return B(a=>{let c=!0,f;return(async()=>{try{f=(await r.consume(n,l=>{if(!c)return;if(l===null){c&&a.down([[x,new Error("Consumer cancelled by broker")]]);return}let m={queue:n,routingKey:l.fields.routingKey,exchange:l.fields.exchange,content:u(l.content),properties:l.properties,deliveryTag:l.fields.deliveryTag,redelivered:l.fields.redelivered,timestampNs:D()};if(s){a.emit(m);try{r.ack(l)}catch(g){e(g)}}else{let g=!1,y=r,T={value:m,ack(){if(!g){g=!0;try{r.ack(l)}catch(h){e(h)}}},nack(h){if(g)return;g=!0;let b=h?.requeue;if(!y.nack){e(new Error("RabbitMQ channel does not expose `nack`; cannot negative-ack"));return}try{y.nack(l,!1,b)}catch(w){e(w)}}};a.emit(T)}},{noAck:!1})).consumerTag}catch(d){c&&a.down([[x,d]])}})(),()=>{c=!1,f!==void 0&&r.cancel(f)}},W(t))}function Qr(r,n,i,s){let{serialize:u=e=>Buffer.from(JSON.stringify(e)),routingKeyExtractor:o=()=>"",onTransportError:t}=s??{};return z(r,{onTransportError:t,send:e=>{let a=o(e),c=u(e);n.publish(i,a,c)}})}function Ve(r,n,i){let{serialize:s=p=>`${JSON.stringify(p)}
|
|
12
12
|
`,flushIntervalMs:u=0,batchSize:o=Number.POSITIVE_INFINITY,onTransportError:t,mode:e}=i??{},c=u>0||o<Number.POSITIVE_INFINITY?z(r,{onTransportError:t,batchSize:o,flushIntervalMs:u,serialize:s,sendBatch:p=>{n.write(p.join(""))}}):z(r,{onTransportError:t,serialize:s,send:p=>{n.write(p)}}),f=c.dispose;return c.dispose=()=>{f();try{n.end()}catch{}},c}function ve(r,n){return r.includes(n)||r.includes('"')||r.includes(`
|
|
13
13
|
`)?`"${r.replace(/"/g,'""')}"`:r}function Jr(r,n,i){let{columns:s,delimiter:u=",",writeHeader:o=!0,cellExtractor:t=(l,m)=>String(l[m]??""),flushIntervalMs:e=0,batchSize:a=Number.POSITIVE_INFINITY,onTransportError:c,...f}=i,p=!1;return Ve(r,n,{serialize:l=>{if(!p&&o){p=!0;let m=s.map(y=>ve(y,u)).join(u),g=s.map(y=>ve(t(l,y),u)).join(u);return`${m}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as O,b as H,c as j,d as E,e as W,f as ne}from"./chunk-SC7BQDNP.js";import{a as N}from"./chunk-D27JNOLZ.js";import{a as X}from"./chunk-C72GO4IZ.js";import{i as T}from"./chunk-7JRF5YEK.js";import{D as I,E as y,G as L,o as S}from"./chunk-LYCLF26R.js";import{b as te}from"./chunk-QYADASLV.js";var ie={};te(ie,{CanvasMeasureAdapter:()=>$,CliMeasureAdapter:()=>D,ImageSizeAdapter:()=>J,NodeCanvasMeasureAdapter:()=>q,PrecomputedAdapter:()=>V,SvgBoundsAdapter:()=>z,analyzeAndMeasure:()=>O,carveTextLineSlots:()=>E,circleIntervalForBand:()=>Q,computeBlockFlow:()=>_,computeCharPositions:()=>W,computeFlowLines:()=>ee,computeLineBreaks:()=>H,computeTotalHeight:()=>U,layoutNextLine:()=>j,measureBlock:()=>Y,measureBlocks:()=>K,reactiveBlockLayout:()=>re,reactiveFlowLayout:()=>se,reactiveLayout:()=>ne,rectIntervalForBand:()=>Z});var D=class{cellPx;constructor(t){this.cellPx=t?.cellPx??8}measureSegment(t,n){return{width:X(t)*this.cellPx}}},G=class extends Error{name="KeyError"},V=class{metrics;fallback;constructor(t){this.metrics=t.metrics;let n=t.fallback??"per-char";if(n!=="per-char"&&n!=="error")throw new Error(`fallback must be 'per-char' or 'error', got ${JSON.stringify(t.fallback)}`);this.fallback=n}measureSegment(t,n){let i=this.metrics[n];if(i){let o=i[t];if(o!==void 0)return{width:o}}if(this.fallback==="error")throw new G(`PrecomputedAdapter: no metrics for segment ${JSON.stringify(t)} in font ${JSON.stringify(n)}`);let r=0;if(i)for(let o of t){let l=i[o];l!==void 0&&(r+=l)}return{width:r}}},$=class{ctx=null;currentFont="";emojiCorrection;constructor(t){this.emojiCorrection=t?.emojiCorrection??1}getContext(){if(!this.ctx){if(typeof OffscreenCanvas>"u")throw new Error("CanvasMeasureAdapter requires a browser environment with OffscreenCanvas support. Use CliMeasureAdapter or NodeCanvasMeasureAdapter for Node.js.");let n=new OffscreenCanvas(0,0).getContext("2d");if(!n)throw new Error("CanvasMeasureAdapter: failed to get 2d context");this.ctx=n}return this.ctx}measureSegment(t,n){let i=this.getContext();n!==this.currentFont&&(i.font=n,this.currentFont=n);let r=i.measureText(t).width;return this.emojiCorrection!==1&&new RegExp("\\p{Emoji_Presentation}","u").test(t)&&(r*=this.emojiCorrection),{width:r}}clearCache(){this.currentFont=""}},q=class{ctx=null;currentFont="";canvasModule;constructor(t){this.canvasModule=t}getContext(){if(!this.ctx){let n=this.canvasModule.createCanvas(0,0).getContext("2d");if(!n)throw new Error("NodeCanvasMeasureAdapter: failed to get 2d context");this.ctx=n}return this.ctx}measureSegment(t,n){let i=this.getContext();return n!==this.currentFont&&(i.font=n,this.currentFont=n),{width:i.measureText(t).width}}clearCache(){this.currentFont=""}},z=class{measureSvg(t){let n=t.match(/viewBox\s*=\s*["']([^"']+)["']/);if(n){let o=n[1].trim().split(/[\s,]+/);if(o.length>=4){let l=Number.parseFloat(o[2]),a=Number.parseFloat(o[3]);if(Number.isFinite(l)&&Number.isFinite(a)&&l>0&&a>0)return{width:l,height:a};throw new Error("SvgBoundsAdapter: viewBox width/height are missing, non-finite, or not positive")}}let i=t.match(/<svg[^>]*\bwidth\s*=\s*["']?([\d.]+)/),r=t.match(/<svg[^>]*\bheight\s*=\s*["']?([\d.]+)/);if(i&&r){let o=Number.parseFloat(i[1]),l=Number.parseFloat(r[1]);if(Number.isFinite(o)&&Number.isFinite(l)&&o>0&&l>0)return{width:o,height:l};throw new Error("SvgBoundsAdapter: svg width/height attributes are non-finite or not positive")}throw new Error("SvgBoundsAdapter: cannot determine dimensions \u2014 SVG has no viewBox or width/height attributes")}},J=class{sizes;constructor(t){this.sizes=new Map(Object.entries(t))}measureImage(t){let n=this.sizes.get(t);if(!n)throw new Error(`ImageSizeAdapter: no dimensions registered for ${JSON.stringify(t)}`);return{width:n.width,height:n.height}}};function Y(e,t,n,i,r,o,l){switch(e.type){case"text":{let a=e.font??r,m=e.lineHeight??o,d=O(e.text,a,n.text,i),w=H(d,t,n.text,a,i),v=W(w,d,m),B=w.lineCount*m,c=0;for(let x of w.lines)x.width>c&&(c=x.width);return{index:l,type:"text",width:Math.min(c,t),height:B,textSegments:d,textLineBreaks:w,textCharPositions:v}}case"image":{let a,m;if(e.naturalWidth!=null&&e.naturalHeight!=null)a=e.naturalWidth,m=e.naturalHeight;else if(n.image){let d=n.image.measureImage(e.src);a=d.width,m=d.height}else throw new Error(`Image block at index ${l} has no naturalWidth/naturalHeight and no ImageMeasurer adapter`);return a>t&&(m=m*t/a,a=t),{index:l,type:"image",width:a,height:m}}case"svg":{let a,m;if(e.viewBox)a=e.viewBox.width,m=e.viewBox.height;else if(n.svg){let d=n.svg.measureSvg(e.content);a=d.width,m=d.height}else throw new Error(`SVG block at index ${l} has no viewBox and no SvgMeasurer adapter`);return a>t&&(m=m*t/a,a=t),{index:l,type:"svg",width:a,height:m}}}}function K(e,t,n,i,r,o){return e.map((l,a)=>Y(l,t,n,i,r,o,a))}function _(e,t){let n=[],i=0;for(let r=0;r<e.length;r++){let o=e[r];n.push({...o,x:0,y:i}),i+=o.height+(r<e.length-1?t:0)}return n}function U(e){if(e.length===0)return 0;let t=e[e.length-1];return t.y+t.height}function re(e){let{adapters:t,name:n="reactive-block-layout",defaultFont:i="16px sans-serif",defaultLineHeight:r=20}=e,o=new T(n),l=new Map,a=y(e.blocks??[],{name:"blocks"}),m=y(Math.max(0,e.maxWidth??800),{name:"max-width"}),d=y(e.gap??0,{name:"gap"}),w=I([a,m],(c,x,s)=>{let p=c[0]!=null&&c[0].length>0?c[0].at(-1):s.prevData[0],h=c[1]!=null&&c[1].length>0?c[1].at(-1):s.prevData[1],g=S(),u=K(p,h,t,l,i,r),f=S()-g,b=w.meta;b&&(N(b["block-count"],u.length),N(b["layout-time-ns"],f)),x.emit(u);let C=()=>{l.clear(),t.text.clearCache?.()};return{deactivate:C,invalidate:C}},{name:"measured-blocks",describeKind:"derived",meta:{"block-count":0,"layout-time-ns":0},equals:(c,x)=>{let s=c,p=x;if(s==null||p==null)return s===p;if(s.length!==p.length)return!1;for(let h=0;h<s.length;h++){let g=s[h],u=p[h];if(g.type!==u.type||g.width!==u.width||g.height!==u.height||g.index!==u.index)return!1}return!0}}),v=L([w,d],([c,x])=>_(c,x),{name:"block-flow",equals:(c,x)=>{let s=c,p=x;if(s==null||p==null)return s===p;if(s.length!==p.length)return!1;for(let h=0;h<s.length;h++){let g=s[h],u=p[h];if(g.x!==u.x||g.y!==u.y||g.width!==u.width||g.height!==u.height)return!1}return!0}}),B=L([v],([c])=>U(c),{name:"total-height"});return o.add(a,{name:"blocks"}),o.add(m,{name:"max-width"}),o.add(d,{name:"gap"}),o.add(w,{name:"measured-blocks"}),o.add(v,{name:"block-flow"}),o.add(B,{name:"total-height"}),{graph:o,setBlocks:c=>o.set("blocks",c),setMaxWidth:c=>o.set("max-width",Math.max(0,c)),setGap:c=>o.set("gap",c),measuredBlocks:w,blockFlow:v,totalHeight:B}}function Q(e,t,n){let i=e.hPad??0,r=e.vPad??0,o=t-r,l=n+r;if(o>=e.cy+e.r||l<=e.cy-e.r)return null;let a=e.cy>=o&&e.cy<=l?0:e.cy<o?o-e.cy:e.cy-l;if(a>=e.r)return null;let m=Math.sqrt(e.r*e.r-a*a);return{left:e.cx-m-i,right:e.cx+m+i}}function Z(e,t,n){let i=e.hPad??0,r=e.vPad??0;return n<=e.y-r||t>=e.y+e.h+r?null:{left:e.x-i,right:e.x+e.w+i}}function oe(e,t,n){return e.kind==="circle"?Q(e,t,n):Z(e,t,n)}function ee(e,t,n,i,r,o,l){let a=l?.paragraphSpacing??r,m=[],d={segmentIndex:0,graphemeIndex:0};if(e.length===0||n.count<=0||r<=0)return{lines:m,cursor:d};let w=t.paddingX??0,v=t.paddingY??0,B=Math.max(0,t.width-w*2),c=Math.max(0,t.height-v*2),x=n.gap*Math.max(0,n.count-1),s=Math.max(0,(B-x)/n.count);if(s<=0)return{lines:m,cursor:d};e:for(let p=0;p<n.count;p++){let h=w+p*(s+n.gap),g=h+s,u=v;for(;u+r<=v+c;){let f=u+r,b=[];for(let k=0;k<i.length;k++){let M=oe(i[k],u,f);M!==null&&b.push(M)}let C=E({left:h,right:g},b,o);if(C.length===0){u+=r;continue}let P=!1;for(let k=0;k<C.length;k++){let M=C[k],R=M.right-M.left,F=j(e,d,R);if(F===null)return{lines:m,cursor:d};if(F.text.length===0&&F.width===0){d=F.end,P=!0;break}m.push({x:M.left,y:u,width:F.width,slotWidth:R,text:F.text,columnIndex:p,flushToRight:M.right<g-.5}),d=F.end}if(P){u+=a;continue}if(u+=r,d.segmentIndex>=e.length)break e}if(d.segmentIndex>=e.length)break}return{lines:m,cursor:d}}function se(e){let{adapter:t,name:n="reactive-flow-layout",minSlotWidth:i=20}=e,r=new T(n),o=new Map,l=y(e.text??"",{name:"text"}),a=y(e.font??"16px sans-serif",{name:"font"}),m=y(e.lineHeight??20,{name:"line-height"}),d=y(e.container??{width:800,height:600,paddingX:0,paddingY:0},{name:"container"}),w=y(e.columns??{count:1,gap:0},{name:"columns"}),v=y(e.obstacles??[],{name:"obstacles"}),B=y(e.paragraphSpacing??null,{name:"paragraph-spacing"}),c=I([l,a],(s,p,h)=>{let g=s[0],u=g!=null&&g.length>0?g.at(-1):h.prevData[0],f=s[1],b=f!=null&&f.length>0?f.at(-1):h.prevData[1],C=O(u,b,t,o);p.emit(C);let P=()=>{o.clear(),t.clearCache?.()};return{deactivate:P,invalidate:P}},{name:"segments",describeKind:"derived"}),x=L([c,d,w,v,m,B],([s,p,h,g,u,f])=>{let b=s,C=S(),P=f??u,{lines:k,cursor:M}=ee(b,p,h,g,u,i,{paragraphSpacing:P}),R=S()-C,F=Math.max(0,b.length-M.segmentIndex),A=x.meta;return A&&(N(A["line-count"],k.length),N(A["layout-time-ns"],R),N(A["overflow-segments"],F)),k},{name:"flow-lines",meta:{"line-count":0,"layout-time-ns":0,"overflow-segments":0},equals:(s,p)=>{let h=s,g=p;if(h.length!==g.length)return!1;for(let u=0;u<h.length;u++){let f=h[u],b=g[u];if(f.x!==b.x||f.y!==b.y||f.width!==b.width||f.slotWidth!==b.slotWidth||f.text!==b.text||f.columnIndex!==b.columnIndex||f.flushToRight!==b.flushToRight)return!1}return!0}});return r.add(l,{name:"text"}),r.add(a,{name:"font"}),r.add(m,{name:"line-height"}),r.add(d,{name:"container"}),r.add(w,{name:"columns"}),r.add(v,{name:"obstacles"}),r.add(B,{name:"paragraph-spacing"}),r.add(c,{name:"segments"}),r.add(x,{name:"flow-lines"}),{graph:r,setText:s=>r.set("text",s),setFont:s=>r.set("font",s),setLineHeight:s=>r.set("line-height",s),setContainer:s=>r.set("container",s),setColumns:s=>r.set("columns",s),setObstacles:s=>r.set("obstacles",s),setParagraphSpacing:s=>r.set("paragraph-spacing",s),segments:c,flowLines:x}}export{D as a,V as b,$ as c,q as d,z as e,J as f,Y as g,K as h,_ as i,U as j,re as k,Q as l,Z as m,ee as n,se as o,ie as p};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as K}from"./chunk-L6NSJVJZ.js";import{a as Y}from"./chunk-SGS4OJGS.js";import{a as _}from"./chunk-ESMPEKEV.js";import{a as A,b as M,i as q}from"./chunk-4VVTGLXJ.js";import{c as N}from"./chunk-35JTVPOX.js";import{m as $}from"./chunk-IA7DUNGB.js";import{D as E,F as B,m as D,o as I}from"./chunk-LYCLF26R.js";import{b as w,c as y,d as h,f as F,g as P,h as C,i as T,j as k}from"./chunk-CK2E7BTU.js";var V=class{buf=[];head=0;get size(){return this.buf.length-this.head}push(t){this.buf.push(t)}shift(){if(this.head>=this.buf.length)return;let t=this.buf[this.head];return this.buf[this.head]=void 0,this.head++,this.head>32&&this.head*2>this.buf.length&&(this.buf=this.buf.slice(this.head),this.head=0),t}clear(){this.buf=[],this.head=0}};function ee(e,t,n){if(t.length===0)throw new RangeError("budgetGate requires at least one constraint");let r=t.map(c=>c.node),s=[e,...r],d=new V,o=!1,i=!1,u=Symbol("budget-gate"),f=new Array(t.length);function p(){return t.every((c,m)=>c.check(f[m]))}function a(c){for(;d.size>0&&p();){let m=d.shift();c.emit(m)}d.size===0&&i&&(i=!1,c.down([[h]]))}return E([],(c,m)=>{for(let l=0;l<t.length;l++)f[l]=t[l].node.cache;let b=[];for(let l=0;l<s.length;l++){let v=s[l];b.push(v.subscribe(z=>{for(let S of z)g(S,l,m)}))}return()=>{for(let l of b)l()}},{...n,describeKind:"derived",meta:K("resilience","budget_gate",n?.meta)});function g(c,m,b){let l=c[0];if(m===0){if(l===w)return p()&&d.size===0?b.emit(c[1]):(d.push(c[1]),o||(o=!0,b.up([[F,u]]))),!0;if(l===y)return b.down([[y]]),!0;if(l===h)return d.size===0?b.down([[h]]):i=!0,!0;if(l===T||l===k){for(;d.size>0;)b.emit(d.shift());return i=!1,o&&(o=!1,b.up([[P,u]])),b.down([c]),!0}return!1}if(l===w&&(f[m-1]=c[1]),l===w||l===h){let v=p();return v&&d.size>0?(a(b),d.size===0&&o&&(o=!1,b.up([[P,u]]))):!v&&!o&&d.size>0&&(o=!0,b.up([[F,u]])),!0}return l===y?!0:l===k?(b.down([c]),!0):l===T}}function R(e){return{describeKind:"derived",...e}}function te(e){return e<0?0:e}function j(e){return e[1]}function ne(e){if(typeof e!="number"||!Number.isFinite(e))throw new TypeError("backoff strategy must return a finite number");return e<0?0:e}function Q(e){let t=e?.count,n=e?.backoff;if(n!==void 0&&t===void 0)throw new RangeError("retry({ backoff }) requires explicit count to prevent unbounded retries; pass { count: <n>, backoff: ... }");let r=t!==void 0?t:0;if(r<0)throw new RangeError("retry count must be >= 0");let s=n===void 0?null:typeof n=="string"?q(n):n;return{maxRetries:r,strategy:s}}function J(e){let t={};return e?.count!==void 0&&(t.count=e.count),typeof e?.backoff=="string"&&(t.backoff=e.backoff),Object.keys(t).length>0?t:void 0}function X(e,t,n){let r=0,s=!1,d=null,o,i=new _;function u(){o?.(),o=void 0}function f(a){if(s)return;if(r>=e.maxRetries){u(),n.down([[k,a]]);return}let g=e.strategy===null?0:e.strategy(r,a,d);if(g==null){u(),n.down([[k,a]]);return}let c;try{c=ne(g)}catch{u(),n.down([[k,a]]);return}d=c,r+=1,u();let m=c>0?c/1e6:1;i.start(m,()=>{s||p()})}function p(){i.cancel(),u();let a;try{a=t()}catch(g){f(g);return}o=a.subscribe(g=>{if(!s)for(let c of g){let m=c[0];if(m===y)n.down([[y]]);else if(m===w)r=0,d=null,n.emit(c[1]);else if(m===h)n.down([[h]]);else if(m===T)u(),n.down([[T]]);else if(m===k){f(j(c));return}else n.down([c])}})}return p(),()=>{s=!0,i.cancel(),u()}}function Oe(e,t){return typeof e=="function"?oe(e,t):re(e,t)}function re(e,t){let n=Q(t);return B(r=>X(n,()=>e,r),{...R(),initial:e.cache,meta:{...N("retry",J(t))}})}function oe(e,t){let n=Q(t);return B(r=>X(n,e,r),{...R(),initial:t?.initial,meta:{...N("retry",J(t))}})}var W=class extends Error{name="CircuitOpenError";constructor(){super("Circuit breaker is open")}};function xe(e){let t=Math.max(1,e?.failureThreshold??5),n=te(e?.cooldownNs??30*1e9),r=e?.cooldown??null,s=Math.max(1,e?.halfOpenMax??1),d=e?.now??I,o="closed",i=0,u=0,f=0,p=n,a=0;function g(){if(!r)return n;let b=r(u);return b!==null?b:n}function c(){o="open",p=g(),f=d(),a=0}return{canExecute(){return o==="closed"?!0:o==="open"?d()-f>=p?(o="half-open",a=1,!0):!1:a<s?(a++,!0):!1},recordSuccess(){o==="half-open"?(o="closed",i=0,u=0):o==="closed"&&(i=0)},recordFailure(b){if(o==="half-open"){u++,c();return}o==="closed"&&(i++,i>=t&&c())},get state(){return o},get failureCount(){return i},reset(){o="closed",i=0,u=0,a=0}}}function Be(e,t){let n=t?.onOpen??"skip";return r=>{let s=E([],(d,o)=>{function i(){s.meta.breakerState.down([[w,e.state]])}let u=r.subscribe(f=>{for(let p of f){let a=p[0];a===y?o.down([[y]]):a===w?e.canExecute()?(i(),o.emit(p[1])):(i(),n==="error"?o.down([[k,new W]]):o.down([[h]])):a===h?o.down([[h]]):a===T?(e.recordSuccess(),i(),o.down([[T]])):a===k?(e.recordFailure(j(p)),i(),o.down([p])):o.down([p])}});return i(),u},{...R(),meta:{breakerState:e.state,...N("withBreaker",{onOpen:n})},completeWhenDepsComplete:!1,initial:r.cache});return{node:s,breakerState:s.meta.breakerState}}}function ie(e,t,n){if(e<=0)throw new RangeError("capacity must be > 0");if(t<0)throw new RangeError("refillPerSecond must be >= 0");let r=n?.clock??I,s=e,d=r();function o(i){if(t>0){let u=i-d;s=Math.min(e,s+u/1e9*t)}d=i}return{available(){return o(r()),s},tryConsume(i=1){if(i<=0)return!0;let u=r();return o(u),s>=i?(s-=i,!0):!1},putBack(i=1){i<=0||(o(r()),s=Math.min(e,s+i))}}}var G=class extends Error{name="RateLimiterOverflowError";constructor(t){super(`rateLimiter buffer overflow (maxBuffer=${t})`)}};function Se(e,t){let{maxEvents:n,windowNs:r}=t;if(n<=0)throw new RangeError("maxEvents must be > 0");if(r<=0)throw new RangeError("windowNs must be > 0");let s=t.maxBuffer;if(s===void 0)throw new RangeError("rateLimiter requires explicit maxBuffer (use Infinity to opt in to unbounded)");let d=s===1/0;if(!d&&(!Number.isInteger(s)||s<1))throw new RangeError("maxBuffer must be a positive integer (or Infinity for unbounded)");let o=t.onOverflow??"drop-newest",i=n*1e9/r,u=B(f=>{let p=ie(n,i),a=d?se():ue(s),g=new _,c=!1,m=0,b=1e9/i,l=u.meta.droppedCount;function v(){l.emit(m)}l.cache!==0&&v();function z(){for(;a.size>0;)if(p.tryConsume(1))f.emit(a.shift());else{g.start(Math.max(1,b/1e6),z);return}}function S(){m+=1,v()}function L(){for(c=!0,g.cancel();a.size>0;)a.shift();m=0}let Z=e.subscribe(H=>{for(let O of H){if(c)return;let x=O[0];if(x===y)f.down([[y]]);else if(x===w){if(!d&&a.size>=s)if(o==="drop-newest")S();else if(o==="drop-oldest")a.shift(),a.push(O[1]),S();else{S(),L(),f.down([[k,new G(s)]]);return}else a.push(O[1]);z()}else if(x===h)f.down([[h]]);else if(x===T)L(),f.down([[T]]);else if(x===k)L(),f.down([O]);else if(x===C){L(),f.down([O]);return}else f.down([O])}});return()=>{c=!0,g.cancel(),Z()}},{...R(),initial:e.cache,meta:{droppedCount:0,...N("rateLimiter",t)}});return{node:u,droppedCount:u.meta.droppedCount}}function ue(e){let t=new Y(e);return{push:n=>t.push(n),shift:()=>t.shift(),get size(){return t.size}}}function se(){let e=[];return{push:t=>{e.push(t)},shift:()=>e.shift(),get size(){return e.length}}}function Ce(e,t){let n=t?.initialStatus??"pending",r=E([],(s,d)=>{let o=n;return r.meta.status.down([[w,n]]),r.meta.error.down([[w,null]]),e.subscribe(u=>{for(let f of u){let p=f[0];if(p===y)d.down([[y]]);else if(p===w)o==="errored"?D(()=>{r.meta.error.down([[w,null]]),r.meta.status.down([[w,"running"]])}):r.meta.status.down([[w,"running"]]),o="running",d.emit(f[1]);else if(p===h)d.down([[h]]);else if(p===T)r.meta.status.down([[w,"completed"]]),o="completed",d.down([[T]]);else if(p===k){let a=j(f);D(()=>{r.meta.error.down([[w,a]]),r.meta.status.down([[w,"errored"]])}),o="errored",d.down([f])}else d.down([f])}})},{...R(),meta:{status:n,error:null,...N("withStatus",{initialStatus:n})},completeWhenDepsComplete:!1,resubscribable:!0,initial:e.cache});return{node:r,status:r.meta.status,error:r.meta.error}}var U=class extends Error{name="TimeoutError";constructor(t){super(`Timed out after ${t/1e6}ms`)}};function de(e){return e!=null&&typeof e=="object"&&"cache"in e&&typeof e.subscribe=="function"}function fe(e){return e!=null&&typeof e.then=="function"}function ae(e){return e!=null&&typeof e=="object"&&typeof e[Symbol.asyncIterator]=="function"}function Ee(e,t){return B(n=>{let r,s;function d(){s?.(),s=void 0,de(t)||fe(t)||ae(t)?r=$(t).subscribe(i=>{n.down(i);for(let u of i){let f=u[0];if(f===T||f===k||f===C){r=void 0;return}}}):(n.emit(t),n.down([[T]]))}return s=e.subscribe(o=>{for(let i of o){let u=i[0];if(u===y)n.down([[y]]);else if(u===w)n.emit(i[1]);else if(u===h)n.down([[h]]);else if(u===T)n.down([[T]]);else if(u===k){d();return}else if(u===C){r?.(),n.down([i]);return}else n.down([i])}}),()=>{s?.(),r?.()}},{...R(),initial:e.cache,meta:{...N("fallback")}})}function Ae(e,t){if(t<=0)throw new RangeError("timeoutNs must be > 0");return B(n=>{let r=!1,s=new _;function d(){let i=t/1e6;s.start(i,()=>{r||(r=!0,o(),n.down([[k,new U(t)]]))})}let o=e.subscribe(i=>{for(let u of i){if(r)return;let f=u[0];if(f===y)n.down([[y]]);else if(f===w)d(),n.emit(u[1]);else if(f===h)n.down([[h]]);else if(f===T){s.cancel(),r=!0,n.down([[T]]);return}else if(f===k){s.cancel(),r=!0,n.down([u]);return}else if(f===C){s.cancel(),r=!0,n.down([u]);return}else n.down([u])}});return d(),()=>{r=!0,s.cancel(),o()}},{...R(),initial:e.cache,meta:{...N("timeout",{timeoutNs:t})}})}export{ee as a,Oe as b,W as c,xe as d,Be as e,ie as f,G as g,Se as h,Ce as i,U as j,Ee as k,Ae as l};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as v}from"./chunk-KRH66M4O.js";import{i as y}from"./chunk-CLD3F4R5.js";import{G as x}from"./chunk-
|
|
1
|
+
import{b as v}from"./chunk-KRH66M4O.js";import{i as y}from"./chunk-CLD3F4R5.js";import{G as x}from"./chunk-S2U57TFC.js";import{d as S}from"./chunk-VJLMUKOI.js";import{d as O}from"./chunk-VIMF6LGM.js";import{d as k}from"./chunk-6QZNQS5B.js";import{d as A}from"./chunk-GPW2V3RE.js";import{b as N}from"./chunk-ZOX3LBRV.js";import{E as b,J as g,m as _}from"./chunk-LYCLF26R.js";import{b as a,c as p,i as h,j as m}from"./chunk-CK2E7BTU.js";import{b as f}from"./chunk-QYADASLV.js";var j={};f(j,{jotai:()=>v,nanostores:()=>y,nestjs:()=>x,react:()=>S,signals:()=>T,solid:()=>O,svelte:()=>k,vue:()=>A,zustand:()=>N});var T={};f(T,{Signal:()=>q});var s=[];function i(n){let e=n.cache;return n.subscribe(o=>{for(let[d,r]of o)d===a&&(e=r)})(),e}var u=class{_node;_equals;constructor(e,t){this._equals=t?.equals??Object.is,this._node=b(e,{...t,resubscribable:!0,resetOnTeardown:!0})}get(){let e=s[s.length-1];return e?(this._node.status==="sentinel"&&i(this._node),e(this._node)):this._node.status==="sentinel"?i(this._node):this._node.cache}set(e){this._equals(this.get(),e)||_(()=>{this._node.down([[p],[a,e]])})}},l=class{_node;constructor(e,t){this._node=g(o=>{s.push(o);try{return e()}finally{s.pop()}},{...t,describeKind:"derived",resubscribable:!0,resetOnTeardown:!0})}get(){let e=s[s.length-1];return e?(this._node.status==="sentinel"&&i(this._node),e(this._node)):this._node.status==="sentinel"?i(this._node):this._node.cache}},q={State:u,Computed:l,sub:(n,e)=>{let t=typeof e=="function"?{data:e,error:void 0,complete:void 0}:e,o=!0;return n._node.subscribe(d=>{for(let[r,c]of d){if(r===a){if(o){o=!1;continue}t.data?.(c)}r===m&&t.error?.(c),r===h&&t.complete?.()}})}};export{T as a,j as b};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{f as F,g as j,h as A}from"./chunk-
|
|
1
|
+
import{f as F,g as j,h as A}from"./chunk-7QFRK3N3.js";import{h as b,i as x}from"./chunk-7JRF5YEK.js";import{p as _}from"./chunk-LYCLF26R.js";import{b as C,d as $,i as T,j as N}from"./chunk-CK2E7BTU.js";import{b as J}from"./chunk-QYADASLV.js";var Y={};J(Y,{SNAPSHOT_WIRE_VERSION:()=>v,SurfaceError:()=>o,asSurfaceError:()=>K,createGraph:()=>R,deleteSnapshot:()=>L,diffSnapshots:()=>V,listSnapshots:()=>W,restoreSnapshot:()=>U,runReduction:()=>D,saveSnapshot:()=>M});var o=class extends Error{code;details;constructor(t,r,n){super(r),this.name="SurfaceError",this.code=t,n!==void 0&&(this.details=n)}toJSON(){let t={code:this.code,message:this.message};if(this.details!==void 0){let r=q(this.details);r!==void 0&&(t.details=r)}return t}};function q(e){try{return JSON.parse(JSON.stringify(e))}catch{return}}function K(e,t="internal-error"){if(e instanceof o)return e;let r=e instanceof Error?e.message:String(e);return new o(t,r)}function R(e,t){let r=j(e);if(!r.valid)throw new o("invalid-spec",`GraphSpec validation failed:
|
|
2
2
|
${r.errors.join(`
|
|
3
3
|
`)}`,{errors:r.errors});let n=t?.catalog??{},s=F(e,n);if(!s.valid)throw new o("catalog-error",`Catalog validation failed:
|
|
4
4
|
${s.errors.join(`
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function e(n,r,t){return{[n]:!0,[`${n}_type`]:r,...t??{}}}export{e as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as B}from"./chunk-4VVTGLXJ.js";import{c as h}from"./chunk-35JTVPOX.js";import{m as k}from"./chunk-IA7DUNGB.js";import{D as N,F as w,G as P,o as U}from"./chunk-LYCLF26R.js";import{a as A,b as p,c as W,d as m,i as a,j as b}from"./chunk-CK2E7BTU.js";function c(d){return{describeKind:"derived",...d}}function S(d){return{describeKind:"derived",partial:!0,...d}}function Z(d,i,s){return N([d],(t,e)=>{let n=t[0];if(n==null||n.length===0){e.down([[m]]);return}for(let o of n)e.emit(i(o))},{...c(s),meta:{...h("map"),...s?.meta??{}}})}function V(d,i,s){return N([d],(t,e)=>{let n=t[0];if(n==null||n.length===0){e.down([[m]]);return}let o=!1;for(let r of n)i(r)&&(e.emit(r),o=!0);o||e.down([[m]])},{...c(s),meta:{...h("filter"),...s?.meta??{}}})}function $(d,i,s,t){return N([d],(e,n,o)=>{"acc"in o.store||(o.store.acc=s);let r=e[0];if(r==null||r.length===0){n.down([[m]]);return}for(let u of r)o.store.acc=i(o.store.acc,u),n.emit(o.store.acc)},{...c(t),initial:s,resetOnTeardown:!0,meta:{...h("scan",{initial:s}),...t?.meta??{}}})}function ee(d,i,s,t){return N([d],(e,n,o)=>{if("acc"in o.store||(o.store.acc=s),o.terminalDeps[0]===!0){n.emit(o.store.acc),n.down([[a]]);return}let r=e[0];if(r==null||r.length===0){n.down([[m]]);return}for(let u of r)o.store.acc=i(o.store.acc,u)},{...c(t),completeWhenDepsComplete:!1,meta:{...h("reduce",{initial:s}),...t?.meta??{}}})}function C(d,i,s){return i<=0?N([d],(t,e,n)=>{n.store.completed||(n.store.completed=!0,e.down([[a]]))},{...c(s),completeWhenDepsComplete:!1,meta:{...h("take",{count:i}),...s?.meta??{}}}):N([d],(t,e,n)=>{if("taken"in n.store||(n.store.taken=0),n.store.done){e.down([[m]]);return}if(n.terminalDeps[0]===!0){n.store.done=!0,e.down([[a]]);return}let o=t[0];if(o==null||o.length===0){e.down([[m]]);return}for(let r of o)if(n.store.taken++,e.emit(r),n.store.taken>=i){n.store.done=!0,e.down([[a]]);return}},{...c(s),completeWhenDepsComplete:!1,meta:{...h("take",{count:i}),...s?.meta??{}}})}function K(d,i,s){return N([d],(t,e,n)=>{"skipped"in n.store||(n.store.skipped=0);let o=t[0];if(o==null||o.length===0){e.down([[m]]);return}let r=!1;for(let u of o)n.store.skipped++,n.store.skipped<=i||(e.emit(u),r=!0);r||e.down([[m]])},c(s))}function ne(d,i,s){return N([d],(t,e,n)=>{if(n.store.done){e.down([[m]]);return}let o=t[0];if(o==null||o.length===0){e.down([[m]]);return}for(let r of o){if(!i(r)){n.store.done=!0,e.down([[a]]);return}e.emit(r)}},{...c(s),completeWhenDepsComplete:!1})}function te(d,i,s){let t=s?.predicate??(o=>o[0]===p),{predicate:e,...n}=s??{};return w(o=>{let r=!1,u=d.subscribe(l=>{if(!r)for(let T of l){if(r)return;T[0]===p?o.emit(T[1]):(T[0]===a||T[0]===b)&&(r=!0,o.down([T]))}}),f=i.subscribe(l=>{if(!r)for(let T of l){if(r)return;if(t(T)){r=!0,o.down([[a]]);return}}});return()=>{u(),f()}},c(n))}function oe(d,i){return C(d,1,i)}function re(d,i){let{defaultValue:s,...t}=i??{},e=i!=null&&Object.hasOwn(i,"defaultValue");return N([d],(n,o,r)=>{if(r.terminalDeps[0]===!0){r.store.has?o.emit(r.store.latest):e&&o.emit(s),o.down([[a]]);return}let u=n[0];if(u==null||u.length===0){o.down([[m]]);return}r.store.latest=u.at(-1),r.store.has=!0},{...c(t),completeWhenDepsComplete:!1})}function se(d,i,s){return C(V(d,i,s),1,s)}function ie(d,i,s){return C(K(d,i,s),1,s)}function ue(d,i,s){if(typeof i=="function")return N([d],(e,n)=>{let o=e[0];if(o==null||o.length===0){n.down([[m]]);return}for(let r of o)i(r),n.emit(r)},{...c(s),meta:{...h("tap"),...s?.meta??{}}});let t=i;return N([d],(e,n,o)=>{if(o.terminalDeps[0]!==void 0){o.terminalDeps[0]===!0?(t.complete?.(),n.down([[a]])):(t.error?.(o.terminalDeps[0]),n.down([[b,o.terminalDeps[0]]]));return}let r=e[0];if(r==null||r.length===0){n.down([[m]]);return}for(let u of r)t.data?.(u),n.emit(u)},{...c(s),completeWhenDepsComplete:!1,meta:{...h("tap"),...s?.meta??{}}})}function q(d,i,s){let t=s?.where??(n=>n!=null),e=!1;return N([d],(n,o)=>{let r=n[0];if(r==null||r.length===0){o.down([[m]]);return}for(let u of r)!e&&t(u)&&(e=!0,i(u)),o.emit(u)},c(s))}var fe=q;function de(d,i=Object.is,s){return N([d],(t,e,n)=>{let o=t[0];if(o==null||o.length===0){e.down([[m]]);return}let r=!1;for(let u of o)n.store.hasPrev&&i(n.store.prev,u)||(n.store.prev=u,n.store.hasPrev=!0,e.emit(u),r=!0);r||e.down([[m]])},{...c(s),meta:{...h("distinctUntilChanged"),...s?.meta??{}}})}function le(d,i){return N([d],(s,t,e)=>{let n=s[0];if(n==null||n.length===0){t.down([[m]]);return}let o=!1;for(let r of n)if(!e.store.hasPrev)e.store.prev=r,e.store.hasPrev=!0;else{let u=[e.store.prev,r];e.store.prev=r,t.emit(u),o=!0}o||t.down([[m]])},c(i))}function F(...d){let i=[...d];return P(i,s=>s,{...c(),equals:(s,t)=>{if(s.length!==t.length)return!1;for(let e=0;e<s.length;e++)if(!Object.is(s[e],t[e]))return!1;return!0}})}function ae(d,i,s){return N([d,i],(t,e,n)=>{let o=t[0],r=t[1],u=r!=null&&r.length>0?r.at(-1):n.prevData[1];if(o!=null&&o.length>0){if(!(r!=null&&r.length>0)&&n.prevData[1]===void 0){e.down([[m]]);return}for(let f of o)e.emit([f,u])}else e.down([[m]])},{...S(s),meta:{...h("withLatestFrom"),...s?.meta??{}}})}function ce(...d){return d.length===0?w(i=>{i.down([[a]])},{...c(),meta:{...h("merge")}}):w(i=>{let s=d.length,t=0,e=[];for(let n of d){let o=n.subscribe(r=>{for(let u of r)u[0]===p?i.emit(u[1]):u[0]===a?(t+=1,t>=s&&i.down([[a]])):u[0]===b&&i.down([u])});e.push(o)}return()=>{for(let n of e)n()}},{...c(),meta:{...h("merge")}})}function Te(...d){let i=d.length;return i===0?w(s=>{s.emit([]),s.down([[a]])},c()):w(s=>{let t=Array.from({length:i},()=>[]),e=i;function n(){for(;t.every(r=>r.length>0);){let r=t.map(u=>u.shift());s.emit(r)}}let o=[];for(let r=0;r<i;r++){let u=r,f=d[r].subscribe(l=>{for(let T of l)T[0]===p?(t[u].push(T[1]),n()):T[0]===a?(e-=1,(e===0||t[u].length===0)&&s.down([[a]])):T[0]===b&&s.down([T])});o.push(f)}return()=>{for(let r of o)r()}},c())}function pe(d,i,s){return w(t=>{let e=0,n=[],o,r;return r=i.subscribe(u=>{for(let f of u)e===0?f[0]===p?n.push(f[1]):f[0]===b&&t.down([f]):f[0]===p?t.emit(f[1]):(f[0]===a||f[0]===b)&&t.down([f])}),o=d.subscribe(u=>{for(let f of u)if(e===0)if(f[0]===p)t.emit(f[1]);else if(f[0]===a){e=1;for(let l of n)t.emit(l);n.length=0}else f[0]===b&&t.down([f])}),()=>{o?.(),r?.()}},c(s))}function me(...d){return d.length===0?w(i=>{i.down([[a]])},c()):d.length===1?N([d[0]],(i,s)=>{let t=i[0];if(t==null||t.length===0){s.down([[m]]);return}for(let e of t)s.emit(e)},c()):w(i=>{let s=null,t=[];for(let e=0;e<d.length;e++){let n=e,o=d[e].subscribe(r=>{for(let u of r){if(s!==null&&n!==s)return;u[0]===p?(s===null&&(s=n),i.emit(u[1])):(u[0]===a||u[0]===b)&&(s===null||n===s)&&i.down([u])}});t.push(o)}return()=>{for(let e of t)e()}},c())}function I(d,i,s){let t,e=!1,n=()=>{e||(e=!0,s())};return t=d.subscribe(o=>{let r=!1,u=!1;for(let f of o)f[0]!==A&&(f[0]===p?i.emit(f[1]):f[0]===a?r=!0:f[0]===b?(u=!0,i.down([f])):(f[0]===W||f[0]===m)&&i.down([f]));u?(t?.(),t=void 0,n()):r&&n()}),()=>{t?.(),t=void 0}}function be(d,i,s){let t,e=!1;function n(){t?.(),t=void 0}return N([d],(o,r,u)=>{if(u.terminalDeps[0]!=null&&u.terminalDeps[0]!==!0){n();return}if(u.terminalDeps[0]===!0){e=!0,t||r.down([[a]]);return}let f=o[0];if(!(f==null||f.length===0))return n(),t=I(k(i(f[f.length-1])),r,()=>{n(),e&&r.down([[a]])}),{deactivate:()=>{n(),e=!1}}},{...c(s),completeWhenDepsComplete:!1,meta:{...h("switchMap"),...s?.meta??{}}})}function we(d,i,s){let t,e=!1;function n(){t?.(),t=void 0}return N([d],(o,r,u)=>{if(u.terminalDeps[0]!=null&&u.terminalDeps[0]!==!0){n();return}if(u.terminalDeps[0]===!0){e=!0,t||r.down([[a]]);return}let f=o[0];if(!(f==null||f.length===0))return t===void 0?t=I(k(i(f[0])),r,()=>{n(),e&&r.down([[a]])}):r.down([[m]]),{deactivate:()=>{n(),e=!1}}},{...c(s),completeWhenDepsComplete:!1})}function Ne(d,i,s){let{maxBuffer:t,...e}=s??{},n=[],o,r=!1,u;function f(){o?.(),o=void 0}function l(){if(!u||o!==void 0)return;if(n.length===0){r&&u.down([[a]]);return}let v=n.shift();o=I(k(i(v)),u,()=>{f(),l()})}function T(v){t&&t>0&&n.length>=t&&n.shift(),n.push(v),l()}return N([d],(v,x,E)=>{if(u=x,E.terminalDeps[0]!=null&&E.terminalDeps[0]!==!0){f(),n.length=0;return}if(E.terminalDeps[0]===!0){r=!0,l();return}let R=v[0];if(!(R==null||R.length===0)){for(let g of R)T(g);return{deactivate:()=>{f(),n.length=0,r=!1}}}},{...c(e),completeWhenDepsComplete:!1})}function L(d,i,s){let{concurrent:t,...e}=s??{},n=t!=null&&t>0?t:Number.POSITIVE_INFINITY,o=0,r=!1,u=new Set,f=[],l;function T(){r&&o===0&&f.length===0&&l&&l.down([[a]])}function v(g){if(!l)return;o++;let O;O=I(k(i(g)),l,()=>{O&&u.delete(O),o--,x(),T()}),u.add(O)}function x(){for(;f.length>0&&o<n;)v(f.shift())}function E(g){o<n?v(g):f.push(g)}function R(){for(let g of u)g();u.clear(),o=0,f.length=0}return N([d],(g,O,y)=>{if(l=O,y.terminalDeps[0]!=null&&y.terminalDeps[0]!==!0){R();return}if(y.terminalDeps[0]===!0){r=!0,T();return}let D=g[0];if(!(D==null||D.length===0)){for(let M of D)E(M);return{deactivate:()=>{R(),r=!1}}}},{...c(e),completeWhenDepsComplete:!1})}var he=L;function ve(d,i,s){return w(t=>{let e=new Set;function n(){for(let r of e)clearTimeout(r);e.clear()}let o=d.subscribe(r=>{for(let u of r)if(u[0]===p){let f=setTimeout(()=>{e.delete(f),t.emit(u[1])},i);e.add(f)}else if(u[0]===a){let f=setTimeout(()=>{e.delete(f),t.down([[a]])},i);e.add(f)}else u[0]===b&&(n(),t.down([u]))});return()=>{o(),n()}},c(s))}function _(d,i,s){return w(t=>{let e,n;function o(){e!==void 0&&(clearTimeout(e),e=void 0)}let r=d.subscribe(u=>{for(let f of u)f[0]===p?(o(),n=f[1],e=setTimeout(()=>{e=void 0,t.emit(n)},i)):f[0]===a?(e!==void 0&&(o(),t.emit(n)),t.down([[a]])):f[0]===b&&(o(),t.down([f]))});return()=>{r(),o()}},{...c(s),meta:{...h("debounce",{ms:i}),...s?.meta??{}}})}function j(d,i,s){let{leading:t,trailing:e,...n}=s??{},o=t!==!1,r=e===!0,u=i*1e6;return w(f=>{let l,T=-1/0,v,x=!1;function E(){l!==void 0&&(clearTimeout(l),l=void 0)}let R=d.subscribe(g=>{for(let O of g)if(O[0]===p){let y=O[1],D=U();if(o&&D-T>=u)T=D,f.emit(y),E(),r&&(l=setTimeout(()=>{l=void 0,x&&(T=U(),f.emit(v),x=!1)},i));else if(r&&(v=y,x=!0,l===void 0)){let M=(D-T)/1e6;l=setTimeout(()=>{l=void 0,x&&(T=U(),f.emit(v),x=!1)},Math.max(0,i-M))}}else(O[0]===a||O[0]===b)&&(E(),f.down([O]))});return()=>{R(),E()}},{...c(n),meta:{...h("throttle",{ms:i,leading:o,trailing:r}),...n.meta??{}}})}function ge(d,i,s){return w(t=>{let e,n=!1,o=!1,r=d.subscribe(f=>{if(!n)for(let l of f){if(n)return;l[0]===p?e={v:l[1]}:l[0]===b?(n=!0,t.down([l])):l[0]===a&&(o=!0,e=void 0)}}),u=i.subscribe(f=>{if(!n)for(let l of f){if(n)return;l[0]===p?e!==void 0&&!o&&t.emit(e.v):l[0]===b?(n=!0,t.down([l])):l[0]===a&&(n=!0,t.down([[a]]))}});return()=>{r(),u()}},c(s))}function Oe(d,i,s){return w(t=>{let e,n,o=!1;function r(){e!==void 0&&(clearTimeout(e),e=void 0)}let u=d.subscribe(f=>{for(let l of f)l[0]===p?(n=l[1],o=!0,r(),e=setTimeout(()=>{e=void 0,o&&(o=!1,t.emit(n))},i)):(l[0]===a||l[0]===b)&&(r(),t.down([l]))});return()=>{u(),r()}},c(s))}function xe(d,i,s){let{with:t,...e}=s??{},n=t??new Error("timeout");return w(o=>{let r;function u(){clearTimeout(r),r=setTimeout(()=>{r=void 0,o.down([[b,n]])},i)}u();let f=d.subscribe(l=>{for(let T of l)T[0]===p?(u(),o.emit(T[1])):(T[0]===a||T[0]===b)&&(clearTimeout(r),o.down([T]))});return()=>{f(),clearTimeout(r)}},c(e))}function Ee(d,i,s){return w(t=>{let e=[],n=d.subscribe(r=>{for(let u of r)u[0]===p?e.push(u[1]):u[0]===a?(e.length>0&&t.emit([...e]),e.length=0,t.down([[a]])):u[0]===b&&t.down([u])}),o=i.subscribe(r=>{for(let u of r)u[0]===p?e.length>0&&(t.emit([...e]),e.length=0):u[0]===a?t.down([[a]]):u[0]===b&&t.down([u])});return()=>{n(),o(),e.length=0}},c(s))}function Re(d,i,s){if(i<=0)throw new RangeError("bufferCount expects count > 0");return w(t=>{let e=[],n=d.subscribe(o=>{for(let r of o)r[0]===p?(e.push(r[1]),e.length>=i&&t.emit(e.splice(0,e.length))):r[0]===a?(e.length>0&&t.emit([...e]),e.length=0,t.down([[a]])):r[0]===b&&t.down([r])});return()=>{n(),e.length=0}},c(s))}function De(d,i,s){if(i<=0)throw new RangeError("windowCount expects count > 0");return w(t=>{let e,n=0;function o(){let u=w(f=>(e=f.down.bind(f),()=>{e=void 0}),c());n=0,t.emit(u)}let r=d.subscribe(u=>{for(let f of u)f[0]===p?(e||o(),e?.([[p,f[1]]]),n+=1,n>=i&&(e?.([[a]]),e=void 0)):f[0]===a?(e?.([[a]]),e=void 0,t.down([[a]])):f[0]===b&&(e?.([f]),e=void 0,t.down([f]))});return()=>{r(),e?.([[a]]),e=void 0}},c(s))}function ye(d,i,s){return w(t=>{let e=[],n=setInterval(()=>{e.length>0&&(t.emit([...e]),e.length=0)},i),o=d.subscribe(r=>{for(let u of r)u[0]===p?e.push(u[1]):u[0]===a?(clearInterval(n),e.length>0&&t.emit([...e]),e.length=0,t.down([[a]])):u[0]===b&&(clearInterval(n),t.down([u]))});return()=>{o(),clearInterval(n),e.length=0}},{...c(s),meta:{...h("bufferTime",{ms:i}),...s?.meta??{}}})}function ke(d,i,s){return w(t=>{let e;function n(){e?.([[a]]),e=void 0}function o(){let f=w(l=>(e=l.down.bind(l),()=>{e=void 0}),c());t.emit(f)}o();let r=setInterval(()=>{n(),o()},i),u=d.subscribe(f=>{for(let l of f)l[0]===p?e?.([[p,l[1]]]):l[0]===a?(clearInterval(r),n(),t.down([[a]])):l[0]===b&&(clearInterval(r),e?.([l]),n(),t.down([l]))});return()=>{u(),clearInterval(r),n()}},c(s))}function Ue(d,i,s){return w(t=>{let e;function n(){e?.([[a]]),e=void 0}function o(){let f=w(l=>(e=l.down.bind(l),()=>{e=void 0}),c());t.emit(f)}let r=d.subscribe(f=>{for(let l of f)l[0]===p?(e||o(),e?.([[p,l[1]]])):l[0]===a?(n(),t.down([[a]])):l[0]===b&&(e?.([l]),e=void 0,t.down([l]))}),u=i.subscribe(f=>{for(let l of f)l[0]===p&&(n(),o())});return()=>{r(),u(),n()}},c(s))}function Ie(d,i){return w((s,t)=>{"n"in t.store||(t.store.n=0);let e=setInterval(()=>{s.emit(t.store.n),t.store.n=t.store.n+1},d);return()=>clearInterval(e)},c(i))}function Me(d,i,s){if(i<=0)throw new RangeError("repeat expects count > 0");return w(t=>{let e=i,n,o=()=>{n?.(),n=d.subscribe(r=>{let u=!1,f=[];for(let l of r)l[0]===a?u=!0:f.push(l);f.length>0&&t.down(f),u&&(n?.(),n=void 0,e-=1,e>0?o():t.down([[a]]))})};return o(),()=>{n?.()}},c(s))}function Ce(d,i){return N([d],(s,t)=>{let e=s[0];if(e==null||e.length===0){t.down([[m]]);return}for(let n of e)t.emit(n)},c(i))}function Y(d,i,s){return w(t=>{let e=d.subscribe(n=>{for(let o of n)if(o[0]===p)t.emit(o[1]);else if(o[0]===b)try{t.emit(i(o[1]))}catch(r){t.down([[b,r]])}else o[0]===a&&t.down([[a]])});return()=>{e()}},c(s))}function Ae(d,i,s){return N([d,i],(t,e,n)=>{let o=t[1];if(!(o!=null&&o.length>0?o.at(-1):n.prevData[1])){e.down([[m]]);return}let u=t[0];if(u!=null&&u.length>0){for(let f of u)e.emit(f);return}if(o!=null&&o.length>0&&n.prevData[0]!==void 0){e.emit(n.prevData[0]);return}e.down([[m]])},S(s))}var We=F,Pe=_,Be=j,Se=Y;export{Z as a,V as b,$ as c,ee as d,C as e,K as f,ne as g,te as h,oe as i,re as j,se as k,ie as l,ue as m,q as n,fe as o,de as p,le as q,F as r,ae as s,ce as t,Te as u,pe as v,me as w,be as x,we as y,Ne as z,L as A,he as B,ve as C,_ as D,j as E,ge as F,Oe as G,xe as H,Ee as I,Re as J,De as K,ye as L,ke as M,Ue as N,Ie as O,Me as P,Ce as Q,Y as R,Ae as S,We as T,Pe as U,Be as V,Se as W};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as T}from"./chunk-VJJLIEAL.js";import{a as F}from"./chunk-L6NSJVJZ.js";import{i as y}from"./chunk-7JRF5YEK.js";import{t as I}from"./chunk-L7WY6TZS.js";import{C as h}from"./chunk-IA7DUNGB.js";import{D as v,E as x,G as S,H as E,m as _}from"./chunk-LYCLF26R.js";import{b as R,i as O,j as k}from"./chunk-CK2E7BTU.js";import{b as A}from"./chunk-QYADASLV.js";var M={};A(M,{feedback:()=>G,funnel:()=>$,scorer:()=>q});function N(e,n){return F("reduction",e,n)}function $(e,n,t,l){if(n.length===0)throw new RangeError("funnel requires at least one source");if(t.length===0)throw new RangeError("funnel requires at least one stage");let r=new y(e,l),m=n.length===1?n[0]:I(...n);r.add(m,{name:"merged"});let a="merged";for(let c=0;c<t.length;c++){let o=t[c],s=new y(o.name);o.build(s);try{s.resolve("input")}catch{throw new Error(`funnel stage "${o.name}" must define an "input" node`)}try{s.resolve("output")}catch{throw new Error(`funnel stage "${o.name}" must define an "output" node`)}r.mount(o.name,s);let i=r.resolve(a),u=`${o.name}::input`,p=r.resolve(u),f=`__bridge_${a}\u2192${o.name}_input`,b=E([i],([d])=>{p.emit(d)},{name:f});r.add(b,{name:f}),r.addDisposer(h(b)),a=`${o.name}::output`}return r}function G(e,n,t,l){let r=l?.maxIterations??10,m=`__feedback_${n}`,a=x(0,{meta:N("feedback_counter",{maxIterations:r,feedbackFrom:n,feedbackTo:t})});e.add(a,{name:m});let c=e.resolve(n),o=e.resolve(t),s=`__feedback_effect_${n}`,i=v([],(u,p)=>{let f=c.subscribe(b=>{for(let d of b){let g=d[0];if(g===R){let w=d[1];if(w==null)return;_(()=>{T(a,r)&&o.emit(w)})}else if(g===O||g===k){let w=g===k&&d.length>1?[k,d[1]]:[g];a.down([w])}}});return()=>f()},{name:s,describeKind:"effect",meta:{...N("feedback_effect",{feedbackFrom:n,feedbackTo:t}),_internal:!0}});return e.add(i,{name:s}),e.addDisposer(h(i)),e}function q(e,n,t){if(e.length===0)throw new RangeError("scorer requires at least one source");if(e.length!==n.length)throw new RangeError("scorer requires the same number of sources and weights");let l=[...e,...n],r=e.length,m=t?.scoreFns;return S(l,a=>{let c=a.slice(0,r),o=a.slice(r),s=[],i=0;for(let u=0;u<r;u++){let p=c[u]??0,f=o[u]??0,d=(m?.[u]?m[u](p):p)*f;s.push(d),i+=d}return{value:c,score:i,breakdown:s}},{...t?{equals:t.equals,resubscribable:t.resubscribable,resetOnTeardown:t.resetOnTeardown}:{},describeKind:"derived",meta:N("scorer",t?.meta)})}export{$ as a,G as b,q as c,M as d};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as l,b as s,d,e as m,h as f,i as b,k as c,l as p}from"./chunk-IUB4NYI2.js";import{a as n,b as o}from"./chunk-4VVTGLXJ.js";import{b as S}from"./chunk-QYADASLV.js";var R={};S(R,{NS_PER_MS:()=>n,NS_PER_SEC:()=>o,resilientPipeline:()=>O});function O(k,e={}){let t=k;if(e.rateLimit!=null){let r={...e.rateLimit,maxBuffer:e.rateLimit.maxBuffer??1/0};t=f(t,r).node}e.budget!=null&&e.budget.length>0&&(t=l(t,e.budget));let a;if(e.breaker!=null){let r=d(e.breaker),y=e.breakerOnOpen??"skip",u=m(r,{onOpen:y})(t);t=u.node,a=u.breakerState}if(e.timeoutMs!=null){if(e.timeoutMs<=0)throw new RangeError("timeoutMs must be > 0");if(e.timeoutMs>9e6)throw new RangeError("timeoutMs must be <= 9_000_000 (\u22482.5h) to stay within safe ns arithmetic");t=p(t,e.timeoutMs*1e6)}e.retry!=null&&(t=s(t,e.retry)),e.fallback!==void 0&&(t=c(t,e.fallback));let i=b(t,{initialStatus:e.initialStatus??"pending"});return{node:i.node,status:i.status,error:i.error,breakerState:a}}export{O as a,R as b};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{a as M}from"./chunk-L6NSJVJZ.js";import{i as l}from"./chunk-7JRF5YEK.js";import{b as S}from"./chunk-AU7YTQX7.js";import{C as o}from"./chunk-IA7DUNGB.js";import{D as P,E as v,G as _,m as N}from"./chunk-LYCLF26R.js";import{b as L,i as I}from"./chunk-CK2E7BTU.js";import{b as C}from"./chunk-QYADASLV.js";var U={};C(U,{MessagingHubGraph:()=>w,SubscriptionGraph:()=>T,TopicBridgeGraph:()=>y,TopicGraph:()=>m,TopicRegistry:()=>O,messagingHub:()=>H,subscription:()=>D,topic:()=>z,topicBridge:()=>F});var R=256;function c(i,e){if(!Number.isFinite(i)||!Number.isInteger(i)||i<0)throw new Error(`${e} must be a non-negative integer`);return i}function a(i,e){return M("messaging",i,e)}var B=1024,m=class extends l{_log;events;latest;hasLatest;constructor(e,s={}){super(e,s.graph),this._log=S([],{name:"events",maxSize:s.retainedLimit??B}),this._log.withLatest(),this.events=this._log.entries,this.add(this.events,{name:"events"}),this.latest=_([this.events],([t])=>{let n=t;return n.length===0?null:n[n.length-1]},{name:"latest",describeKind:"derived",meta:a("topic_latest")}),this.add(this.latest,{name:"latest"}),this.addDisposer(o(this.latest)),this.hasLatest=_([this.events],([t])=>t.length>0,{name:"hasLatest",describeKind:"derived",meta:a("topic_has_latest")}),this.add(this.hasLatest,{name:"hasLatest"}),this.addDisposer(o(this.hasLatest)),this.addDisposer(()=>{this.events.down([[I]])}),this.addDisposer(()=>this._log.disposeAllViews())}publish(e){if(e===void 0)throw new TypeError(`TopicGraph "${this.name}": publish(undefined) is not allowed (spec \xA75.12 SENTINEL).`);this._log.append(e)}attachEventStorage(e){return this._log.attachStorage(e)}retained(){return this.events.cache}get _logBundle(){return this._log}},T=class extends l{cursor;available;topic;_disposed=!1;constructor(e,s,t={}){super(e,t.graph),this.topic=s;let n;if(t.from!==void 0?t.from==="retained"?n=0:t.from==="now"?n=s.events.cache.length:n=c(t.from,"subscription from"):n=c(t.cursor??0,"subscription cursor"),this.cursor=v(n,{name:"cursor",describeKind:"state",meta:a("subscription_cursor")}),this.add(this.cursor,{name:"cursor"}),this.available=s._logBundle.view({kind:"fromCursor",cursor:this.cursor}),this.add(this.available,{name:"available"}),this.addDisposer(o(this.available)),t.advanceOn!==void 0){let r=t.advanceOn,b=!1,d=P([r],()=>{if(!b){b=!0;return}if(this._disposed)return;let p=this.available.cache;if(p.length===0)return;let g=this.cursor.cache+p.length;this.cursor.emit(g)},{name:"advancePump",describeKind:"effect",meta:a("subscription_advance_pump")});this.add(d,{name:"advancePump"}),this.addDisposer(o(d))}}ack(e){if(this._disposed)return this.cursor.cache;let s=this.available.cache,t=e===void 0?s.length:c(e,"subscription ack count"),n=Math.min(t,s.length);if(n<=0)return this.cursor.cache;let r=this.cursor.cache+n;return this.cursor.emit(r),r}pull(e){if(this._disposed)return[];let s=this.available.cache,t=e===void 0?s.length:c(e,"subscription pull limit");return s.slice(0,t)}pullAndAck(e){if(this._disposed)return{items:[],cursor:this.cursor.cache};let s=this.available.cache,t=e===void 0?s.length:c(e,"subscription pullAndAck limit"),n=s.slice(0,t);if(n.length===0)return{items:n,cursor:this.cursor.cache};let r=this.cursor.cache+n.length;return this.cursor.emit(r),{items:n,cursor:r}}dispose(){this._disposed||(this._disposed=!0,this.cursor.down([[I]]),this.destroy())}},y=class extends l{_sourceSub;bridgedCount;output;constructor(e,s,t,n={}){super(e,n.graph),this._sourceSub=D(`${e}-subscription`,s,{cursor:n.cursor}),this.mount("subscription",this._sourceSub);let r=Math.max(1,c(n.maxPerPump??R,"topic bridge maxPerPump")),b=n.map??(u=>u);this.output=_([this._sourceSub.available],([u])=>{let f=u,h=[],k=Math.min(f.length,r);for(let x=0;x<k;x++){let A=b(f[x]);A!==void 0&&h.push(A)}return h},{name:"output",describeKind:"derived",meta:a("topic_bridge_output",{targetRef:t.name}),initial:[]}),this.add(this.output,{name:"output"}),this.addDisposer(o(this.output)),this.bridgedCount=v(0,{name:"bridgedCount",describeKind:"state",meta:a("topic_bridge_count")}),this.add(this.bridgedCount,{name:"bridgedCount"}),this.addDisposer(o(this.bridgedCount));let d=this.output,p=this._sourceSub,g=this.bridgedCount,G=P([d],()=>{let u=d.cache;if(u.length===0)return;let f=p.available.cache.length,h=Math.min(f,r);if(h>0){p.ack(h);let k=g.cache??0;g.emit(k+u.length)}},{name:"ackPump",describeKind:"effect",meta:a("topic_bridge_ack_pump")});this.add(G,{name:"ackPump"}),this.addDisposer(o(G));let E=K(this.output,t);this.addDisposer(E)}};function K(i,e){return i.subscribe(s=>{for(let t of s){if(t[0]!==L)continue;let n=t[1];n.length!==0&&N(()=>{for(let r of n)e.publish(r)})}})}var O=class{_map=new Map;version;constructor(e){this.version=e}get size(){return this._map.size}has(e){return this._map.has(e)}get(e){return this._map.get(e)}set(e,s){this._map.set(e,s)}delete(e){return this._map.delete(e)}keys(){return this._map.keys()}},w=class extends l{_registry;version;_defaultTopicOptions;constructor(e,s={}){super(e,s.graph);let t=v(0,{name:"version",describeKind:"state",meta:a("hub_version")});this.add(t,{name:"version"}),this.version=t,this._registry=new O(t),this._defaultTopicOptions={...s.defaultTopicOptions??{}}}get size(){return this._registry.size}has(e){return this._registry.has(e)}topicNames(){return this._registry.keys()}topic(e,s){let t=this._registry.get(e);if(t===void 0){let n={...this._defaultTopicOptions,...s??{}};t=new m(e,n),this._registry.set(e,t),this.mount(e,t);let r=this.version.cache??0;this.version.emit(r+1)}return t}publish(e,s){this.topic(e).publish(s)}publishMany(e){N(()=>{for(let[s,t]of e)this.topic(s).publish(t)})}subscribe(e,s,t){let n=this.topic(s);return new T(e,n,t)}removeTopic(e){if(!this._registry.has(e))return!1;try{this.remove(e)}finally{this._registry.delete(e);let s=this.version.cache??0;this.version.emit(s+1)}return!0}};function z(i,e){return new m(i,e)}function H(i,e){return new w(i,e)}function D(i,e,s){return new T(i,e,s)}function F(i,e,s,t){return new y(i,e,s,t)}export{m as a,T as b,y as c,O as d,w as e,z as f,H as g,D as h,F as i,U as j};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as $,g as _}from"./chunk-VJJLIEAL.js";import{a as L}from"./chunk-L6NSJVJZ.js";import{i as F}from"./chunk-7JRF5YEK.js";import{b as z}from"./chunk-35JTVPOX.js";import{D as j,E as G,G as D,m as E,p as B}from"./chunk-LYCLF26R.js";import{b as P,d as S,i as I,j as K}from"./chunk-CK2E7BTU.js";import{b as ie}from"./chunk-QYADASLV.js";var se={};ie(se,{PipelineGraph:()=>x,decisionKeyOf:()=>q,pipelineGraph:()=>W});function N(y,t){return L("orchestration",y,t)}var q=y=>y.action,x=class extends F{constructor(t,i){super(t,i)}task(t,i,e={}){let a=(e.deps??[]).map(c=>this._resolveStep(c)),p=D(a,i,{name:t,describeKind:"derived",meta:N("task",e.meta)});return this.add(p,{name:t}),p}classify(t,i,e,a={}){let p=this._resolveStep(i),c=D([p],([d])=>{try{return{tag:e(d),value:d}}catch(f){return{tag:"error",value:d,error:f}}},{name:t,describeKind:"derived",meta:N("classify",a.meta)});return this.add(c,{name:t}),c}combine(t,i,e={}){let a=Object.keys(i),p=a.map(d=>this._resolveStep(i[d])),c=D(p,d=>{let f={};for(let s=0;s<a.length;s++)f[a[s]]=d[s];return f},{name:t,describeKind:"derived",meta:N("combine",e.meta)});return this.add(c,{name:t}),c}approvalGate(t,i,e={}){let a=e.maxPending??1e3;if(a<1&&a!==Number.POSITIVE_INFINITY)throw new RangeError("approvalGate: maxPending must be >= 1");let p=e.startOpen??!1;typeof i!="string"&&this.nameOf(i)===void 0&&this.add(i,{name:`${t}/source`});let c=this._resolveStep(i),d=new F(`${t}_state`),f=G([],{name:"pending",equals:()=>!1}),s=G(p,{name:"isOpen"}),R=D([f],([n])=>n.length,{name:"count"}),T=G(0,{name:"droppedCount"}),u=$({name:"decisions",retainedLimit:1024,graph:d});d.add(f,{name:"pending"}),d.add(s,{name:"isOpen"}),d.add(R,{name:"count"}),d.add(T,{name:"droppedCount"}),this.mount(`${t}_state`,d);let l=[],v=!1,k=!1,w=p,M=s.subscribe(n=>{for(let o of n)o[0]===P&&(w=o[1])});this.addDisposer(M);function A(){f.emit([...l])}function C(n,o,r){u.append({action:n,t_ns:B(),...o!==void 0?{items:o,count:o.length}:{},...r!==void 0?{unflushed:r}:{},...e.handlerVersion!=null?{handlerVersion:e.handlerVersion}:{}})}function U(n){if(l.push(n),l.length>a){let o=l.shift();T.emit(T.cache+1),C("drop",[o])}A()}function O(n){let o=l.splice(0,n);return A(),o}let b=j([c],(n,o,r)=>{let h=r.terminalDeps[0];if(h!==void 0){v=!0;let g=l.length;l=[],A(),C("teardown",void 0,g),o.down(h===!0?[[I]]:[[K,h]]);return}let m=n[0];if(m==null||m.length===0){o.down([[S]]);return}for(let g of m)w?o.emit(g):(U(g),o.down([[S]]))},{name:t,describeKind:"derived",meta:N("approval_gate",e.meta)});if(this.add(b,{name:t}),e.approver!=null){e.approver.cache&&(s.emit(!0),w=!0,e.onceOnly&&(k=!0));let o=e.approver.subscribe(r=>{for(let h of r){if(h[0]!==P)continue;let m=!!h[1];if(m&&!w){if(e.onceOnly){if(k)continue;k=!0}E(()=>{s.emit(!0);let g=O(l.length);C("open",g);for(let te of g){if(v)break;b.emit(te)}})}else if(!m&&w){if(e.onceOnly&&k)continue;E(()=>{s.emit(!1),C("close")})}}});this.addDisposer(o)}let V=n=>{if(v)throw new Error(`approvalGate: ${n}() called after the gate was torn down`)},Y=(n=1)=>{V("approve");let o=O(n);for(let r of o){if(v)break;b.emit(r)}},H=(n=1)=>{V("reject"),O(n)},J=(n,o=1)=>{V("modify");let r=[...l],h=O(o);for(let m=0;m<h.length&&!v;m++)b.emit(n(h[m],m,r))},Q=()=>{V("open"),s.emit(!0);let n=O(l.length);for(let o of n){if(v)break;b.emit(o)}},X=()=>{V("close"),!(e.onceOnly&&k)&&s.emit(!1)},Z=_(Y,{audit:u,freeze:!1,onSuccess:(n,o,r)=>({action:"approve",count:n[0]??1,t_ns:r.t_ns,...e.handlerVersion!=null?{handlerVersion:e.handlerVersion}:{}}),onFailure:(n,o,r)=>({action:"drop",t_ns:r.t_ns,errorType:r.errorType,...e.handlerVersion!=null?{handlerVersion:e.handlerVersion}:{}})}),ee=_(H,{audit:u,freeze:!1,onSuccess:(n,o,r)=>({action:"reject",count:n[0]??1,t_ns:r.t_ns,...e.handlerVersion!=null?{handlerVersion:e.handlerVersion}:{}}),onFailure:(n,o,r)=>({action:"drop",t_ns:r.t_ns,errorType:r.errorType,...e.handlerVersion!=null?{handlerVersion:e.handlerVersion}:{}})}),ne=_(J,{audit:u,freeze:!1,onSuccess:(n,o,r)=>({action:"modify",count:n[1]??1,t_ns:r.t_ns,...e.handlerVersion!=null?{handlerVersion:e.handlerVersion}:{}}),onFailure:(n,o,r)=>({action:"drop",t_ns:r.t_ns,errorType:r.errorType,...e.handlerVersion!=null?{handlerVersion:e.handlerVersion}:{}})}),re=_(Q,{audit:u,freeze:!1,onSuccess:(n,o,r)=>({action:"open",t_ns:r.t_ns,...e.handlerVersion!=null?{handlerVersion:e.handlerVersion}:{}}),onFailure:(n,o,r)=>({action:"drop",t_ns:r.t_ns,errorType:r.errorType,...e.handlerVersion!=null?{handlerVersion:e.handlerVersion}:{}})}),oe=_(X,{audit:u,freeze:!1,onSuccess:(n,o,r)=>({action:"close",t_ns:r.t_ns,...e.handlerVersion!=null?{handlerVersion:e.handlerVersion}:{}}),onFailure:(n,o,r)=>({action:"drop",t_ns:r.t_ns,errorType:r.errorType,...e.handlerVersion!=null?{handlerVersion:e.handlerVersion}:{}})});return this.addDisposer(R.subscribe(()=>{})),{node:b,pending:f,count:R,isOpen:s,droppedCount:T,decisions:u,audit:u,approve:Z,reject:ee,modify:ne,open:re,close:oe}}approval(t,i,e,a={}){return this.approvalGate(t,i,{...a,approver:e,maxPending:1})}catch(t,i,e,a={}){let p=this._resolveStep(i),c=a.on??"errored",d=j([p],(f,s,R)=>{let T=R.terminalDeps[0];if(T!==void 0){let l=T===!0?{kind:"completed"}:{kind:"errored",error:T};if(c==="terminal"||c===l.kind){s.emit(e(l,s));return}s.down(l.kind==="completed"?[[I]]:[[K,l.error]]);return}let u=f[0];if(u==null||u.length===0){s.down([[S]]);return}for(let l of u)s.emit(l)},{name:t,describeKind:"derived",completeWhenDepsComplete:a.completeWhenDepsComplete??!(c==="completed"||c==="terminal"),errorWhenDepsError:!(c==="errored"||c==="terminal"),meta:N("catch",a.meta)});return this.add(d,{name:t}),d}_resolveStep(t){if(typeof t=="string")return this.resolve(t);if(this.nameOf(t)===void 0)throw new Error(`PipelineGraph "${this.name}": Node dep is not registered. Pass a string path or call graph.add(node) first.`);return t}};function W(y,t){let i=new x(y,t),{factory:e,factoryArgs:a,...p}=t??{};return i.tagFactory("pipelineGraph",z(p)),i}export{q as a,x as b,W as c,se as d};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as V,b as N,c as _,d as j,f as L,g as M}from"./chunk-3G5U5QNE.js";import{b as D,c as x,d as $,e as R,f as A,g as S,h as F,i as y,j as T,k as P}from"./chunk-7JRF5YEK.js";import{a as m,b as g,c as k,d as v,e as O,f as E,g as G,h as C}from"./chunk-LYCLF26R.js";import{b as u}from"./chunk-CK2E7BTU.js";import{b as W}from"./chunk-QYADASLV.js";var K={};W(K,{ENVELOPE_VERSION:()=>v,GRAPH_META_SEGMENT:()=>S,Graph:()=>y,JsonCodec:()=>m,SIZEOF_OVERHEAD:()=>x,SIZEOF_SYMBOL:()=>$,SNAPSHOT_VERSION:()=>F,createDagCborCodec:()=>g,createDagCborZstdCodec:()=>k,decodeEnvelope:()=>E,diffForWAL:()=>T,encodeEnvelope:()=>O,explainPath:()=>D,graphProfile:()=>A,reachable:()=>P,registerBuiltinCodecs:()=>G,replayWAL:()=>C,sizeof:()=>R,validateGraphObservability:()=>I,watchTopologyTree:()=>w});function w(s,n){let o=new Map,d=(i,p)=>{if(o.has(i))return;let c={off:()=>{},prefix:p};o.set(i,c);let f=i.topology.subscribe(l=>{for(let r of l){if(r[0]!==u)continue;let e=r[1];if(n(e,i,p),e.kind==="added"&&e.nodeKind==="mount"){let t=i._mounts.get(e.name);if(t instanceof y){let a=`${p}${e.name}::`;d(t,a)}}else if(e.kind==="removed"&&e.nodeKind==="mount"){let t=`${p}${e.name}::`;for(let[a,h]of Array.from(o.entries()))a!==s&&h.prefix.startsWith(t)&&(h.off(),o.delete(a))}}});c.off=f;for(let[l,r]of i._mounts)if(r instanceof y){let e=`${p}${l}::`;d(r,e)}};return d(s,""),()=>{for(let i of o.values())i.off();o.clear()}}var H={json:s=>_(s),pretty:s=>M(s),mermaid:s=>j(s),"mermaid-url":s=>L(s),d2:s=>N(s),ascii:s=>V(s)};function I(s,n={}){let o=[],d=n.requireFound??!0;if(n.skipDescribe!==!0)try{let r=s.describe(),e=new Set(Object.keys(r.nodes)),t=[];for(let[a,h]of Object.entries(r.nodes))for(let b of h.deps)b!==""&&!e.has(b)&&t.push(`${a} \u2192 ${b}`);for(let a of r.edges)e.has(a.from)||t.push(`edge.from: ${a.from}`),e.has(a.to)||t.push(`edge.to: ${a.to}`);t.length>0?o.push({kind:"describe",ok:!1,reason:`describe() has ${t.length} dangling pointer(s); nodes \u2289 deps`,danglingDeps:t}):o.push({kind:"describe",ok:!0,nodeCount:e.size,edgeCount:r.edges.length})}catch(r){o.push({kind:"describe",ok:!1,reason:`describe() threw: ${r instanceof Error?r.message:String(r)}`})}if((n.formats?.length??0)>0){let r=s.describe();for(let e of n.formats)try{let t=H[e](r);typeof t!="string"||t.length===0?o.push({kind:"describe-format",ok:!1,format:e,reason:`${e} renderer returned empty or non-string output`}):o.push({kind:"describe-format",ok:!0,format:e,length:t.length})}catch(t){o.push({kind:"describe-format",ok:!1,format:e,reason:t instanceof Error?t.message:String(t)})}}for(let r of n.paths??[])try{s.resolve(r),o.push({kind:"observe",ok:!0,path:r})}catch(e){o.push({kind:"observe",ok:!1,path:r,reason:e instanceof Error?e.message:String(e)})}for(let[r,e]of n.pairs??[])try{let t=s.explain(r,e);d&&t.found===!1?o.push({kind:"explain",ok:!1,from:r,to:e,reason:`explain(${r} \u2192 ${e}) found no path${t.reason?`: ${t.reason}`:""}`}):o.push({kind:"explain",ok:!0,from:r,to:e,found:t.found,steps:t.steps.length})}catch(t){o.push({kind:"explain",ok:!1,from:r,to:e,reason:t instanceof Error?t.message:String(t)})}let i=o.filter(r=>!r.ok),p=i.length===0,c=n.paths?.length??0,f=n.pairs?.length??0,l=n.formats?.length??0;return{ok:p,checks:o,failures:i,summary(){let r=[n.skipDescribe===!0?null:"describe",l>0?`${l} format${l===1?"":"s"}`:null,c>0?`${c} observe path${c===1?"":"s"}`:null,f>0?`${f} explain pair${f===1?"":"s"}`:null].filter(t=>t!=null),e=r.length>0?r.join(", "):"describe-only";return p?`validateGraphObservability: OK (${e})`:`validateGraphObservability: ${i.length} failure(s) across ${e}`}}}export{w as a,I as b,K as c};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as dr,b as fr}from"./chunk-WHIZM6JV.js";import{a as pe}from"./chunk-ZJ7SM3G2.js";import{$ as sr,A as It,B as Lt,C as Ct,D as jt,E as Vt,F as Pt,G as At,H as zt,I as Kt,J as Dt,K as Ut,L as _t,M as $t,N as Ft,O as Ht,P as Gt,Q as qt,R as Jt,S as Qt,T as Xt,U as Yt,V as Zt,W as er,X as nr,Y as tr,Z as rr,_ as or,a as bn,aa as ir,b as yn,ba as mr,c as ct,d as dt,e as ft,f as ut,g as pt,h as lt,i as mt,j as gt,k as bt,l as yt,m as kt,n as ht,o as vt,p as xt,q as Tt,r as wt,s as Et,t as Nt,u as Mt,v as St,w as Rt,x as Bt,y as Ot,z as Wt}from"./chunk-INH6FS2G.js";import{a as Y,b as ee,c as ne,d as te,e as re,f as oe,g as se,h as ie,i as ae,j as ce,k as de,l as fe}from"./chunk-IUB4NYI2.js";import{b as ur,c as pr,d as lr,e as hr,f as vr}from"./chunk-CGDMTXSY.js";import{a as Cr}from"./chunk-7NZMZJMW.js";import{a as ke,b as tn}from"./chunk-5QDBSZBV.js";import{a as an,b as cn,c as dn,d as fn,e as un,f as pn,g as ln,h as mn,i as gn}from"./chunk-VJJLIEAL.js";import{a as xe}from"./chunk-L6NSJVJZ.js";import{a as ue}from"./chunk-7JRF5YEK.js";import{a as Z}from"./chunk-ESMPEKEV.js";import{a as wr,b as Er,c as Nr,d as Mr,e as Sr,f as Rr,g as Br,h as Or,i as Wr,j as Ir,k as Lr}from"./chunk-D5RFJOZ2.js";import{a as xr,b as Tr}from"./chunk-CE72X3WO.js";import{A as Kn,B as Dn,C as Un,D as _n,E as $n,F as Fn,G as Hn,I as Gn,J as qn,K as Jn,L as Qn,M as Xn,N as Yn,O as Zn,P as et,Q as nt,R as tt,S as rt,T as ot,U as st,V as it,W as at,a as U,b as J,c as kn,d as hn,e as vn,f as xn,g as Tn,h as wn,i as Q,j as En,k as Nn,l as Mn,m as Sn,n as Rn,o as Bn,p as On,q as Wn,r as In,s as Ln,t as X,u as Cn,v as jn,w as Vn,x as Pn,y as An,z as zn}from"./chunk-L7WY6TZS.js";import{c as Te,d as we,e as Ee,f as Ne,g as Me,h as Se,i as Re}from"./chunk-4VVTGLXJ.js";import{a as gr,b as br}from"./chunk-NNKJUORL.js";import{a as yr,b as kr}from"./chunk-KGKJCHEK.js";import{a as ar,b as cr}from"./chunk-TZQPPQEQ.js";import{a as rn,b as on,c as sn}from"./chunk-AU7YTQX7.js";import{A as Ye,B as Ze,C as en,D as nn,a as he,b as ve,c as Be,d as Oe,e as We,f as q,g as Ie,h as Le,i as Ce,j as je,k as Ve,l as Pe,m as Ae,n as ze,o as Ke,p as De,q as Ue,r as _e,s as $e,t as Fe,u as He,v as Ge,w as qe,x as Je,y as Qe,z as Xe}from"./chunk-IA7DUNGB.js";import{A as K,D as C,E as O,H as D,m as W}from"./chunk-LYCLF26R.js";import{b as h,e as $,f as F,g as H,h as S,i as G,j as B}from"./chunk-CK2E7BTU.js";import{b as ye}from"./chunk-QYADASLV.js";var Dr={};ye(Dr,{CircuitOpenError:()=>ne,ContentAddressedMissError:()=>ur,DEFAULT_AUDIT_GUARD:()=>cn,NS_PER_MS:()=>NS_PER_MS,NS_PER_SEC:()=>NS_PER_SEC,NativeIndexBackend:()=>gr,NativeListBackend:()=>yr,NativeLogBackend:()=>rn,NativeMapBackend:()=>ar,NativePubSubBackend:()=>_,RateLimiterOverflowError:()=>se,ResettableTimer:()=>Z,TimeoutError:()=>ce,appendAudit:()=>un,appendLogStorage:()=>Sr,audit:()=>Hn,awaitSettled:()=>Xe,budgetGate:()=>Y,buffer:()=>Gn,bufferCount:()=>qn,bufferTime:()=>Qn,bumpCursor:()=>fn,cached:()=>qe,canonicalJson:()=>pr,cascadingCache:()=>jr,catchError:()=>at,checkpointToRedis:()=>er,checkpointToS3:()=>Zt,circuitBreaker:()=>te,combine:()=>In,combineLatest:()=>ot,concat:()=>jn,concatMap:()=>zn,constant:()=>Te,contentAddressedStorage:()=>lr,createAuditLog:()=>dn,createTransport:()=>L,createWatermarkController:()=>tn,csvRows:()=>jt,debounce:()=>_n,debounceTime:()=>st,decay:()=>pe,decorrelatedJitter:()=>Me,defer:()=>_e,delay:()=>Un,deserializeError:()=>A,dictKv:()=>Ir,dictSnapshot:()=>Lr,distill:()=>fr,distinctUntilChanged:()=>On,domainMeta:()=>xe,elementAt:()=>Mn,empty:()=>Ke,escapeRegexChar:()=>Be,exhaustMap:()=>An,exponential:()=>Ee,externalBundle:()=>yn,externalProducer:()=>bn,fallback:()=>de,fibonacci:()=>Ne,filter:()=>J,find:()=>Nn,first:()=>Q,firstValueFrom:()=>Je,firstWhere:()=>Qe,flatMap:()=>Dn,forEach:()=>$e,fromAny:()=>Ae,fromAsyncIter:()=>Pe,fromCSV:()=>Ct,fromClickHouseWatch:()=>At,fromCron:()=>Le,fromDrizzle:()=>sr,fromEvent:()=>Ce,fromHTTP:()=>ut,fromHTTPPoll:()=>ht,fromHTTPStream:()=>kt,fromIter:()=>je,fromKafka:()=>Ot,fromKysely:()=>ir,fromMCP:()=>Tt,fromNATS:()=>Dt,fromNDJSON:()=>Pt,fromOTel:()=>wt,fromPrisma:()=>or,fromPrometheus:()=>Rt,fromPromise:()=>Ve,fromPulsar:()=>zt,fromRabbitMQ:()=>_t,fromRaf:()=>Ie,fromRedisStream:()=>It,fromSSE:()=>yt,fromSqlite:()=>nr,fromSqliteCursor:()=>tr,fromStatsD:()=>Mt,fromSyslog:()=>Et,fromTimer:()=>q,fromWebSocket:()=>dt,fromWebSocketReconnect:()=>xt,fromWebhook:()=>ft,globToRegExp:()=>Oe,interval:()=>Zn,jsonCodec:()=>wr,jsonCodecFor:()=>Er,keepalive:()=>en,kvStorage:()=>Rr,last:()=>En,lightMutation:()=>pn,linear:()=>we,lru:()=>le,makeHttpError:()=>mr,map:()=>U,matchesAnyPattern:()=>We,matchesCron:()=>ve,memoryAppendLog:()=>Or,memoryBackend:()=>Nr,memoryKv:()=>Wr,memorySnapshot:()=>Br,merge:()=>X,mergeMap:()=>Kn,mergeReactiveLogs:()=>sn,nameToSignal:()=>V,ndjsonRows:()=>Vt,never:()=>De,nodeSignal:()=>Ye,of:()=>ze,onFirstData:()=>Rn,pairwise:()=>Wn,parseCron:()=>he,parsePrometheusText:()=>Bt,parseSSEStream:()=>bt,parseStatsD:()=>St,parseSyslog:()=>Nt,pausable:()=>nt,pubsub:()=>Vr,race:()=>Vn,rateLimiter:()=>ie,reactiveCounter:()=>nn,reactiveIndex:()=>br,reactiveList:()=>kr,reactiveLog:()=>on,reactiveMap:()=>cr,reactiveSink:()=>ct,reduce:()=>hn,registerCursor:()=>mn,registerCursorMap:()=>gn,repeat:()=>et,replay:()=>Ge,rescue:()=>tt,resolveBackoffPreset:()=>Re,retry:()=>ee,sample:()=>Fn,scan:()=>kn,serializeError:()=>P,share:()=>He,shareReplay:()=>Ze,signalToName:()=>I,singleFromAny:()=>hr,singleNodeFromAny:()=>vr,skip:()=>xn,snapshotStorage:()=>Mr,sortJsonValue:()=>xr,stableJsonString:()=>Tr,stratify:()=>Cr,switchMap:()=>Pn,take:()=>vn,takeUntil:()=>wn,takeWhile:()=>Tn,tap:()=>Sn,tapFirst:()=>Bn,throttle:()=>$n,throttleTime:()=>it,throwError:()=>Ue,timeout:()=>fe,toArray:()=>Fe,toCSV:()=>Ht,toClickHouse:()=>Gt,toFile:()=>Ft,toHTTP:()=>pt,toKafka:()=>Wt,toLoki:()=>Xt,toMongo:()=>Qt,toNATS:()=>Ut,toObservable:()=>ke,toPostgres:()=>Jt,toPulsar:()=>Kt,toRabbitMQ:()=>$t,toReadableStream:()=>gt,toRedisStream:()=>Lt,toS3:()=>qt,toSSE:()=>lt,toSSEBytes:()=>mt,toSqlite:()=>rr,toTempo:()=>Yt,toWebSocket:()=>vt,tokenBucket:()=>oe,topologyDiff:()=>ue,tryIncrementBounded:()=>an,valve:()=>rt,verifiable:()=>dr,window:()=>Yn,windowCount:()=>Jn,windowTime:()=>Xn,withBreaker:()=>re,withLatestFrom:()=>Ln,withMaxAttempts:()=>Se,withStatus:()=>ae,workerBridge:()=>ge,workerSelf:()=>be,wrapMutation:()=>ln,zip:()=>Cn});function le(){let e=new Map,r=null,n=null;function p(t){t.prev?t.prev.next=t.next:r=t.next,t.next?t.next.prev=t.prev:n=t.prev,t.prev=null,t.next=null}function l(t){t.next=r,t.prev=null,r&&(r.prev=t),r=t,n===null&&(n=t)}return{insert(t){if(e.has(t)){this.touch(t);return}let f={key:t,prev:null,next:null};e.set(t,f),l(f)},touch(t){let f=e.get(t);f&&(p(f),l(f))},delete(t){let f=e.get(t);f&&(p(f),e.delete(t))},evict(t){let f=[];for(let v=0;v<t&&n!==null;v++){let N=n;f.push(N.key),p(N),e.delete(N.key)}return f},size(){return e.size}}}function me(e){return e!=null&&typeof e.then=="function"}function j(e){me(e)&&e.catch(()=>{})}function jr(e,r){let n=new Map,p=r?.maxSize??0,l=p>0?r?.eviction??le():null,t=r?.writeThrough??!1;function f(o,u,m){for(let g=0;g<m;g++)try{j(e[g].save(o,u))}catch{}}function v(o,u,m=0){for(let g=m;g<e.length;g++){let w;try{w=e[g].load(o)}catch{continue}if(me(w)){let T=g;w.then(M=>{M!==void 0?(u.down([[h,M]]),f(o,M,T)):v(o,u,T+1)},()=>{v(o,u,T+1)});return}if(w!==void 0){u.down([[h,w]]),f(o,w,g);return}}}function N(){if(!(!l||p<=0))for(;l.size()>=p;){let o=l.evict(1);if(o.length===0)break;for(let u of o){let m=n.get(u);if(m){let g=m.cache;if(m.status!=="sentinel"&&e.length>0){let w=e.length-1;try{j(e[w].save(u,g))}catch{}for(let T=0;T<w;T++)try{let M=e[T].delete;M&&j(M.call(e[T],u))}catch{}}m.down([[S]])}n.delete(u)}}}return{load(o){let u=n.get(o);if(u)return l?.touch(o),u;l&&p>0&&l.size()>=p&&N();let m=O(void 0);return n.set(o,m),l?.insert(o),v(o,m),m},save(o,u){if(t)for(let g of e)try{j(g.save(o,u))}catch{}else if(e[0])try{j(e[0].save(o,u))}catch{}let m=n.get(o);if(m)m.down([[h,u]]),l?.touch(o);else{l&&p>0&&l.size()>=p&&N();let g=O(u);n.set(o,g),l?.insert(o)}},invalidate(o){let u=n.get(o);u&&v(o,u)},delete(o){l?.delete(o);let u=n.get(o);u&&u.down([[S]]),n.delete(o);for(let m of e)try{let g=m.delete;g&&j(g.call(m,o))}catch{}},has(o){return n.has(o)},get size(){return n.size}}}var _=class{_version=0;_topics=new Set;get version(){return this._version}get topicCount(){return this._topics.size}hasTopic(r){return this._topics.has(r)}topicNames(){return this._topics.values()}createTopic(r){return this._topics.has(r)?!1:(this._topics.add(r),this._version+=1,!0)}removeTopic(r){let n=this._topics.delete(r);return n&&(this._version+=1),n}};function Vr(e={}){let{backend:r}=e,n=r??new _,p=new Map;function l(t){let f=p.get(t);return f===void 0&&(f=C({describeKind:"state"}),p.set(t,f),n.createTopic(t)),f}return{topic(t){return l(t)},publish(t,f){l(t).emit(f)},publishMany(t){W(()=>{for(let[f,v]of t)l(f).emit(v)})},removeTopic(t){let f=p.get(t);return f===void 0?!1:(p.delete(t),n.removeTopic(t),f.down([[S]]),!0)},has(t){return n.hasTopic(t)},get size(){return n.topicCount},topicNames(){return n.topicNames()}}}var Pr=new Map([[$,"INVALIDATE"],[F,"PAUSE"],[H,"RESUME"],[S,"TEARDOWN"],[G,"COMPLETE"],[B,"ERROR"]]),Ar=new Map([["INVALIDATE",$],["PAUSE",F],["RESUME",H],["TEARDOWN",S],["COMPLETE",G],["ERROR",B]]);function I(e){let r=Pr.get(e);return r||(Symbol.keyFor(e)??"UNKNOWN")}function V(e){let r=Ar.get(e);if(r)return r;if(e&&e!=="UNKNOWN")return Symbol.for(e)}function P(e){return e instanceof Error?{message:e.message,name:e.name,stack:e.stack}:{message:String(e),name:"Error"}}function A(e){let r=new Error(e.message);return r.name=e.name,e.stack&&(r.stack=e.stack),r}function L(e){if(typeof MessagePort<"u"&&e instanceof MessagePort)return{post(r,n){e.postMessage(r,n??[])},listen(r){let n=p=>r(p.data);return e.addEventListener("message",n),e.start(),()=>e.removeEventListener("message",n)},terminate(){e.close()}};if(typeof SharedWorker<"u"&&e instanceof SharedWorker)return L(e.port);if(typeof Worker<"u"&&e instanceof Worker)return{post(r,n){e.postMessage(r,n??[])},listen(r){let n=p=>r(p.data);return e.addEventListener("message",n),()=>e.removeEventListener("message",n)},terminate(){e.terminate()}};if(typeof BroadcastChannel<"u"&&e instanceof BroadcastChannel)return{post(r,n){n&&n.length>0&&console.warn("[graphrefly] WorkerTransport: BroadcastChannel does not support Transferable objects. The transfer argument is ignored and objects will be cloned instead."),e.postMessage(r)},listen(r){let n=p=>r(p.data);return e.addEventListener("message",n),()=>e.removeEventListener("message",n)},terminate(){e.close()}};if(typeof ServiceWorker<"u"&&e instanceof ServiceWorker)return{post(r,n){e.postMessage(r,n??[])},listen(r){let n=p=>{p.source===e&&r(p.data)};return navigator.serviceWorker.addEventListener("message",n),()=>navigator.serviceWorker.removeEventListener("message",n)}};throw new Error("createTransport: unsupported target type. Expected Worker, SharedWorker, ServiceWorker, BroadcastChannel, or MessagePort.")}function zr(e){return typeof e=="object"&&e!==null&&typeof e.post=="function"&&typeof e.listen=="function"}function ge(e,r){let n=zr(e)?e:L(e),p=r.name??"workerBridge",l=Object.entries(r.expose??{}),t=r.import??[],f=r.transfer??{},v=O("connecting",{name:`${p}::meta::status`}),N=O(null,{name:`${p}::meta::error`}),o=new Map,u=new Map;for(let c of t){let a=O(void 0,{name:`${p}::${c}`});o.set(c,a)}let m;if(l.length>0){let c=l.map(([,d])=>d),a=C(c,(d,i)=>{let k={};for(let y=0;y<l.length;y++){let[R]=l[y],E=d[y];E!=null&&E.length>0&&(k[R]=E.at(-1))}Object.keys(k).length!==0&&i.emit(k)},{name:`${p}::aggregated`,partial:!0});m=D([a],d=>{let i=d[0];if(i==null||Object.keys(i).length===0)return;let k=[];for(let E of Object.keys(i)){let z=f[E];z&&k.push(...z(i[E]))}let y;for(let[E,z]of l)E in i&&z.v!=null&&(y==null&&(y={}),y[E]=z.v.version);let R={t:"b",u:i,...y?{v:y}:{}};try{n.post(R,k.length>0?k:void 0)}catch(E){N.down([[h,E instanceof Error?E:new Error(String(E))]])}}).subscribe(()=>{})}let g=!1,w=n.listen(c=>{if(g)return;let a=c;switch(a.t){case"r":{W(()=>{for(let[d,i]of Object.entries(a.stores)){let k=o.get(d);k&&k.down([[h,i]])}}),v.down([[h,"connected"]]);let s={};for(let[d,i]of l)s[d]=i.cache;n.post({t:"i",stores:s});break}case"v":{let s=o.get(a.s);s&&s.down([[h,a.d]]);break}case"b":{W(()=>{for(let[s,d]of Object.entries(a.u)){let i=a.v?.[s];if(i!=null){let y=u.get(s);if(y!=null&&i<=y)continue;u.set(s,i)}let k=o.get(s);k&&k.down([[h,d]])}});break}case"e":{let s=o.get(a.s);s&&s.down([[B,A(a.err)]]);break}case"s":{let s=V(a.sig);if(!s)break;let d=a.s==="*"?[...o.values()]:o.has(a.s)?[o.get(a.s)]:[];for(let i of d)i.down(a.d===void 0?[[s]]:[[s,a.d]]);break}}}),T=[];for(let[c,a]of l){let s=a.subscribe((d=>{if(!g)for(let i of d){let k=i[0];k!==h&&(K.isLocalOnly(k)||(k===B?n.post({t:"e",s:c,err:P(i[1])}):n.post({t:"s",s:c,sig:I(k),d:i.length>1?i[1]:void 0})))}}));T.push(s)}let M;if(r.timeoutMs!=null&&r.timeoutMs>0){let c=q(r.timeoutMs),a=J(v,d=>d==="connected");M=Q(X(U(c,()=>"timeout"),U(a,()=>"ready"))).subscribe(d=>{for(let i of d)i[0]===h&&i[1]==="timeout"&&(N.down([[h,new Error("Worker bridge handshake timeout")]]),x())})}function x(){if(!g){g=!0,M?.(),n.post({t:"s",s:"*",sig:I(S)}),m&&m();for(let c of T)c();T.length=0,w(),v.down([[h,"closed"]]),u.clear(),o.clear()}}let b={meta:{status:v,error:N},destroy:x};for(let[c,a]of o)b[c]=a;return b}function Kr(e){return typeof e=="object"&&e!==null&&typeof e.post=="function"&&typeof e.listen=="function"}function be(e,r){let n=Kr(e)?e:L(e),p=r.import??[],l=r.transfer??{},t=new Map,f=new Map,v={};for(let x of p){let b=O(void 0,{name:`worker::${x}`});t.set(x,b),v[x]=b}let N=r.expose(v),o=Object.entries(N),u,m=!1;if(o.length>0){let x=o.map(([,a])=>a),b=C(x,(a,s)=>{let d={};for(let i=0;i<o.length;i++){let[k]=o[i],y=a[i];y!=null&&y.length>0&&(d[k]=y.at(-1))}Object.keys(d).length!==0&&s.emit(d)},{name:"workerSelf::aggregated",partial:!0});u=D([b],a=>{if(m)return;let s=a[0];if(s==null||Object.keys(s).length===0)return;let d=[];for(let y of Object.keys(s)){let R=l[y];R&&d.push(...R(s[y]))}let i;for(let[y,R]of o)y in s&&R.v!=null&&(i==null&&(i={}),i[y]=R.v.version);let k={t:"b",u:s,...i?{v:i}:{}};try{n.post(k,d.length>0?d:void 0)}catch{}}).subscribe(()=>{})}let g=[];for(let[x,b]of o){let c=b.subscribe((a=>{if(!m)for(let s of a){let d=s[0];d!==h&&(K.isLocalOnly(d)||(d===B?n.post({t:"e",s:x,err:P(s[1])}):n.post({t:"s",s:x,sig:I(d),d:s.length>1?s[1]:void 0})))}}));g.push(c)}let w=n.listen(x=>{if(m)return;let b=x;switch(b.t){case"i":{W(()=>{for(let[c,a]of Object.entries(b.stores)){let s=t.get(c);s&&s.down([[h,a]])}});break}case"v":{let c=t.get(b.s);c&&c.down([[h,b.d]]);break}case"b":{W(()=>{for(let[c,a]of Object.entries(b.u)){let s=b.v?.[c];if(s!=null){let i=f.get(c);if(i!=null&&s<=i)continue;f.set(c,s)}let d=t.get(c);d&&d.down([[h,a]])}});break}case"e":{let c=t.get(b.s);c&&c.down([[B,A(b.err)]]);break}case"s":{let c=V(b.sig);if(!c)break;if(c===S&&b.s==="*"){M();return}let a=b.s==="*"?[...t.values()]:t.has(b.s)?[t.get(b.s)]:[];for(let s of a)s.down(b.d===void 0?[[c]]:[[c,b.d]]);break}}}),T={};for(let[x,b]of o)T[x]=b.cache;n.post({t:"r",stores:T});function M(){if(!m){m=!0,u&&u();for(let x of g)x();g.length=0,w(),n.terminate?.(),f.clear(),t.clear()}}return{destroy:M}}export{le as a,jr as b,_ as c,Vr as d,I as e,V as f,P as g,A as h,L as i,ge as j,be as k,Dr as l};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{e as ce}from"./chunk-
|
|
1
|
+
import{e as ce}from"./chunk-XQ55HO5N.js";import{a as se,b as P}from"./chunk-5QDBSZBV.js";import{i as L}from"./chunk-7JRF5YEK.js";import{f as ae,h as ie}from"./chunk-IA7DUNGB.js";import{i as ne,j as U}from"./chunk-LYCLF26R.js";import{b,h as _,i as T,j as W}from"./chunk-CK2E7BTU.js";import{b as Oe,c as re,d as te,e as oe}from"./chunk-QYADASLV.js";var ke={};Oe(ke,{ACTOR_KEY:()=>F,COMMAND_HANDLERS:()=>A,CQRS_EVENT_HANDLERS:()=>S,CRON_HANDLERS:()=>D,CommandHandler:()=>me,EVENT_HANDLERS:()=>G,EventHandler:()=>ve,GRAPHREFLY_REQUEST_GRAPH:()=>R,GRAPHREFLY_ROOT_GRAPH:()=>v,GraphCron:()=>fe,GraphInterval:()=>he,GraphReflyEventExplorer:()=>x,GraphReflyGuard:()=>Re,GraphReflyGuardImpl:()=>I,GraphReflyModule:()=>Q,INTERVAL_HANDLERS:()=>O,InjectCqrsGraph:()=>de,InjectGraph:()=>ue,InjectNode:()=>pe,ObserveGateway:()=>B,OnGraphEvent:()=>le,QUERY_HANDLERS:()=>H,QueryHandler:()=>ye,SAGA_HANDLERS:()=>N,SagaHandler:()=>ge,fromHeader:()=>Ee,fromJwtPayload:()=>V,getActor:()=>we,getGraphToken:()=>m,getNodeToken:()=>y,observeSSE:()=>Me,observeSubscription:()=>Ce,toObservable:()=>se});import{Inject as j}from"@nestjs/common";var v=Symbol.for("graphrefly:root-graph");var R=Symbol.for("graphrefly:request-graph");function m(s){return Symbol.for(`graphrefly:graph:${s}`)}function y(s){return Symbol.for(`graphrefly:node:${s}`)}var G=new Map,O=new Map,D=new Map,A=new Map,S=new Map,H=new Map,N=new Map;function ue(s){return s==="request"?j(R):j(s?m(s):v)}function de(s){return j(m(s))}function pe(s){return j(y(s))}function le(s){return(e,r)=>{let t=r.name;r.addInitializer(function(){let o=this.constructor,n=G.get(o)??[];n.push({nodeName:s,methodKey:t}),G.set(o,n)})}}function he(s){return(e,r)=>{let t=r.name;r.addInitializer(function(){let o=this.constructor,n=O.get(o)??[];n.push({ms:s,methodKey:t}),O.set(o,n)})}}function fe(s){return(e,r)=>{let t=r.name;r.addInitializer(function(){let o=this.constructor,n=D.get(o)??[];n.push({expr:s,methodKey:t}),D.set(o,n)})}}function me(s,e){return(r,t)=>{let o=t.name;t.addInitializer(function(){let n=this.constructor,a=A.get(n)??[];a.push({cqrsName:s,commandName:e,methodKey:o}),A.set(n,a)})}}function ve(s,e){return(r,t)=>{let o=t.name;t.addInitializer(function(){let n=this.constructor,a=S.get(n)??[];a.push({cqrsName:s,eventName:e,methodKey:o}),S.set(n,a)})}}function ye(s,e){return(r,t)=>{let o=t.name;t.addInitializer(function(){let n=this.constructor,a=H.get(n)??[];a.push({cqrsName:s,projectionName:e,methodKey:o}),H.set(n,a)})}}function ge(s,e,r){return(t,o)=>{let n=o.name;o.addInitializer(function(){let a=this.constructor,c=N.get(a)??[];c.push({cqrsName:s,eventNames:r,sagaName:e,methodKey:n}),N.set(a,c)})}}var be=0,x=class{constructor(e,r){this.graph=e;this.moduleRef=r}disposers=[];scheduleNodeNames=[];onModuleInit(){this.wireEvents(),this.wireIntervals(),this.wireCrons(),this.wireCqrsCommands(),this.wireCqrsEvents(),this.wireCqrsQueries(),this.wireCqrsSagas()}onModuleDestroy(){for(let e of this.disposers)e();this.disposers.length=0;for(let e of this.scheduleNodeNames)try{this.graph.remove(e)}catch{}this.scheduleNodeNames.length=0}wireEvents(){for(let[e,r]of G){let t=this.resolveInstance(e);if(t)for(let o of r)this.wireEventHandler(t,o)}}wireEventHandler(e,r){let t=e[r.methodKey];if(typeof t!="function")return;let o=t.bind(e),a=this.observeNode(r.nodeName).subscribe(c=>{for(let l of c)l[0]===b&&o(l[1])});this.disposers.push(a)}wireIntervals(){for(let[e,r]of O){let t=this.resolveInstance(e);if(t)for(let o of r)this.wireIntervalHandler(t,e,o)}}wireIntervalHandler(e,r,t){let o=e[t.methodKey];if(typeof o!="function")return;let n=o.bind(e),c=`__schedule__.${r.name??"anonymous"}.${String(t.methodKey)}.${be++}`,l=ae(t.ms,{period:t.ms,name:c});this.graph.add(l),this.scheduleNodeNames.push(c);let p=this.observeNode(c).subscribe(u=>{for(let d of u)d[0]===b&&n(d[1])});this.disposers.push(p)}wireCrons(){for(let[e,r]of D){let t=this.resolveInstance(e);if(t)for(let o of r)this.wireCronHandler(t,e,o)}}wireCronHandler(e,r,t){let o=e[t.methodKey];if(typeof o!="function")return;let n=o.bind(e),c=`__schedule__.${r.name??"anonymous"}.${String(t.methodKey)}.${be++}`,l=ie(t.expr,{name:c});this.graph.add(l),this.scheduleNodeNames.push(c);let p=this.observeNode(c).subscribe(u=>{for(let d of u)d[0]===b&&n(d[1])});this.disposers.push(p)}wireCqrsCommands(){for(let[e,r]of A){let t=this.resolveInstance(e);if(t)for(let o of r)this.wireCqrsCommand(t,o)}}wireCqrsCommand(e,r){let t=e[r.methodKey];if(typeof t!="function")return;let o=t.bind(e),n=this.resolveCqrsGraph(r.cqrsName);n&&n.command(r.commandName,o)}wireCqrsEvents(){for(let[e,r]of S){let t=this.resolveInstance(e);if(t)for(let o of r)this.wireCqrsEventHandler(t,o)}}wireCqrsEventHandler(e,r){let t=e[r.methodKey];if(typeof t!="function")return;let o=t.bind(e),n=this.resolveCqrsGraph(r.cqrsName);if(!n)return;n.event(r.eventName);let c=n.resolve(r.eventName).cache,l=c&&c.length>0?c[c.length-1].seq:0,p=this.observeNodeOn(n,r.eventName).subscribe(u=>{for(let d of u)if(d[0]===b){let g=d[1];for(let i of g)i.seq>l&&(o(i),l=i.seq)}});this.disposers.push(p)}wireCqrsQueries(){for(let[e,r]of H){let t=this.resolveInstance(e);if(t)for(let o of r)this.wireCqrsQuery(t,o)}}wireCqrsQuery(e,r){let t=e[r.methodKey];if(typeof t!="function")return;let o=t.bind(e),n=this.resolveCqrsGraph(r.cqrsName);if(!n)return;let c=this.observeNodeOn(n,r.projectionName).subscribe(l=>{for(let f of l)f[0]===b&&o(f[1])});this.disposers.push(c)}wireCqrsSagas(){for(let[e,r]of N){let t=this.resolveInstance(e);if(t)for(let o of r)this.wireCqrsSaga(t,o)}}wireCqrsSaga(e,r){let t=e[r.methodKey];if(typeof t!="function")return;let o=t.bind(e),n=this.resolveCqrsGraph(r.cqrsName);n&&n.saga(r.sagaName,r.eventNames,o)}observeNode(e){return this.graph.observe(e)}observeNodeOn(e,r){return e.observe(r)}resolveCqrsGraph(e){try{return this.moduleRef.get(m(e),{strict:!1})}catch{return console.warn(`[GraphReFly] CqrsGraph "${e}" not found in DI \u2014 did you import GraphReflyModule.forCqrs({ name: "${e}" })?`),null}}resolveInstance(e){try{return this.moduleRef.get(e,{strict:!1})}catch{return null}}};function Me(s,e,r){let{actor:t,serialize:o=De,keepAliveMs:n,signal:a}=r??{},c=new TextEncoder,l,f=r?.highWaterMark!=null,p,u,d=[],g=!1;return new ReadableStream({start(i){let h,w=()=>{},M=()=>{if(!g){g=!0,h!==void 0&&clearInterval(h),a?.removeEventListener("abort",K),w(),p?.dispose(),u?.(),u=void 0;for(let k of d)i.enqueue(k.frame);d.length=0,i.close()}};l=M;let K=()=>M(),ee=s.observe(e,{actor:t});f&&(p=P(k=>ee.up(k),{highWaterMark:r.highWaterMark,lowWaterMark:r.lowWaterMark??Math.floor(r.highWaterMark/2)})),w=ee.subscribe(k=>{for(let $ of k){if(g)return;let q=$[0];if(q===b){let C=c.encode(Y("data",o($[1])));f?(d.push({frame:C,counted:!0}),p.onEnqueue(),u?.(),u=void 0):i.enqueue(C)}else if(q===W){let C=c.encode(Y("error",o($[1])));f?(d.push({frame:C,counted:!1}),u?.(),u=void 0):i.enqueue(C),M();return}else if(q===T||q===_){if(q===T){let C=c.encode(Y("complete"));f?(d.push({frame:C,counted:!1}),u?.(),u=void 0):i.enqueue(C)}M();return}}}),n!==void 0&&n>0&&(h=setInterval(()=>{g||(f?(d.push({frame:c.encode(`: keepalive
|
|
2
2
|
|
|
3
3
|
`),counted:!1}),u?.(),u=void 0):i.enqueue(c.encode(`: keepalive
|
|
4
4
|
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as G}from"./chunk-
|
|
1
|
+
import{a as G}from"./chunk-D27JNOLZ.js";import{i as z}from"./chunk-7JRF5YEK.js";import{D as H,E as M,G as N,o as R}from"./chunk-LYCLF26R.js";function q(t){for(let c of t){let m=c.codePointAt(0);if(m>=19968&&m<=40959||m>=13312&&m<=19903||m>=12288&&m<=12351||m>=12352&&m<=12447||m>=12448&&m<=12543||m>=44032&&m<=55215||m>=65280&&m<=65519)return!0}return!1}var E=new Set(["\uFF0C","\uFF0E","\uFF01","\uFF1A","\uFF1B","\uFF1F","\u3001","\u3002","\u30FB","\uFF09","\u3015","\u3009","\u300B","\u300D","\u300F","\u3011"]),F=new Set([".",",","!","?",":",";",")","]","}","%",'"',"\u201D","\u2019","\xBB","\u203A","\u2026"]);function D(t){return t.replace(/[\t\n\r\f ]+/g," ").replace(/^ | $/g,"")}function O(t){let c=new Intl.Segmenter(void 0,{granularity:"word"}),m=[];for(let f of c.segment(t)){let h=f.segment,w=f.isWordLike??!1,u=[],s=[],r=[],p="",n=null;for(let i of h){let S;i===" "?S="space":i==="\u200B"?S="zero-width-break":i==="\xAD"?S="soft-hyphen":i===`
|
|
2
2
|
`?S="hard-break":S="text",n!==null&&S===n?p+=i:(n!==null&&(u.push(p),s.push(n==="text"&&w),r.push(n)),p=i,n=S)}n!==null&&(u.push(p),s.push(n==="text"&&w),r.push(n)),m.push({texts:u,isWordLike:s,kinds:r})}return m}function V(t,c,m,f,h){let w=D(t);if(w.length===0)return[];let u=O(w),s=new Intl.Segmenter(void 0,{granularity:"grapheme"}),r=[],p=[],n=[];for(let g of u)for(let o=0;o<g.texts.length;o++)r.push(g.texts[o]),p.push(g.kinds[o]),n.push(g.isWordLike[o]);let i=[],S=[],B=[];for(let g=0;g<r.length;g++){let o=r[g],y=p[g],I=n[g];if(y==="text"&&!I&&i.length>0&&S[S.length-1]==="text"&&o.length===1&&(F.has(o)||E.has(o))){i[i.length-1]+=o;continue}if(o==="-"&&i.length>0&&S[S.length-1]==="text"&&B[B.length-1]){i[i.length-1]+=o;continue}i.push(o),S.push(y),B.push(I)}let l=f.get(c);l||(l=new Map,f.set(c,l));function b(g){let o=l.get(g);if(o===void 0){h&&(h.misses+=1);let y=m.measureSegment(g,c).width;o=Number.isFinite(y)&&y>=0?y:0,l.set(g,o)}else h&&(h.hits+=1);return o}let d=[];for(let g=0;g<i.length;g++){let o=i[g],y=S[g];if(y!=="text"){d.push({text:o,width:y==="space"?b(" ")*o.length:0,kind:y,graphemeWidths:null});continue}if(q(o)){let a="";for(let x of s.segment(o)){let k=x.segment;if(a.length>0&&E.has(k)){a+=k;continue}if(a.length>0){let L=b(a);d.push({text:a,width:L,kind:"text",graphemeWidths:null})}a=k}if(a.length>0){let x=b(a);d.push({text:a,width:x,kind:"text",graphemeWidths:null})}continue}let I=b(o),e=null;if(B[g]&&o.length>1){let a=[];for(let x of s.segment(o))a.push(b(x.segment));a.length>1&&(e=a)}d.push({text:o,width:I,kind:"text",graphemeWidths:e})}return d}function J(t,c,m,f,h){if(t.length===0)return{lines:[],lineCount:0};let w=[],u=0,s=!1,r=0,p=0,n=0,i=0,S=-1,B=0,l=h.get(f);l||(l=new Map,h.set(f,l));let b=l.get("-");b===void 0&&(b=m.measureSegment("-",f).width,l.set("-",b));function d(e=n,a=i,x=u){let k="";for(let L=r;L<e;L++){let W=t[L];if(!(W.kind==="soft-hyphen"||W.kind==="hard-break"))if(L===r&&p>0&&W.graphemeWidths){let P=[...new Intl.Segmenter(void 0,{granularity:"grapheme"}).segment(W.text)].map(K=>K.segment);k+=P.slice(p).join("")}else k+=W.text}if(a>0&&e<t.length){let L=t[e],v=[...new Intl.Segmenter(void 0,{granularity:"grapheme"}).segment(L.text)].map(K=>K.segment),P=r===e?p:0;k+=v.slice(P,a).join("")}e>0&&t[e-1]?.kind==="soft-hyphen"&&!(r===e&&p>0)&&(k+="-"),w.push({text:k,width:x,startSegment:r,startGrapheme:p,endSegment:e,endGrapheme:a}),u=0,s=!1,S=-1,B=0}function g(e){return e==="space"||e==="zero-width-break"||e==="soft-hyphen"}function o(e,a,x){s=!0,r=e,p=a,n=e+1,i=0,u=x}function y(e,a,x){s=!0,r=e,p=a,n=e,i=a+1,u=x}for(let e=0;e<t.length;e++){let a=t[e];if(a.kind==="hard-break"){s?d():w.push({text:"",width:0,startSegment:e,startGrapheme:0,endSegment:e,endGrapheme:0}),r=e+1,p=0;continue}let x=a.width;if(!s){x>c&&a.graphemeWidths?I(e,0,a.graphemeWidths):o(e,0,x),g(a.kind)&&(S=e+1,B=a.kind==="space"?u-x:u);continue}let k=u+x;if(k>c+.005){if(g(a.kind)){u+=x,n=e+1,i=0,d(e+1,0,a.kind==="space"?u-x:u);continue}if(S>=0){d(S,0,B),e--;continue}if(x>c&&a.graphemeWidths){d(),I(e,0,a.graphemeWidths);continue}d(),e--;continue}u=k,n=e+1,i=0,g(a.kind)&&(S=e+1,B=a.kind==="space"?u-x:u)}return s&&d(),{lines:w,lineCount:w.length};function I(e,a,x){for(let k=a;k<x.length;k++){let L=x[k];if(!s){y(e,k,L);continue}u+L>c+.005?(d(),y(e,k,L)):(u+=L,n=e,i=k+1)}s&&n===e&&i===x.length&&(n=e+1,i=0)}}function A(t){return t==="space"||t==="zero-width-break"||t==="soft-hyphen"}var T=null;function _(){return T===null&&(T=new Intl.Segmenter(void 0,{granularity:"grapheme"})),T}function j(t,c,m){if(c===0&&m<0)return t.text;let f=[..._().segment(t.text)].map(w=>w.segment),h=m<0?f.length:m;return f.slice(c,h).join("")}function C(t,c,m,f,h,w){let u="";for(let s=c;s<f;s++){let r=t[s];r.kind==="soft-hyphen"||r.kind==="hard-break"||(s===c&&m>0?u+=j(r,m,-1):u+=r.text)}if(h>0&&f<t.length){let s=t[f];u+=j(s,c===f?m:0,h)}return w&&(u+="-"),u}function $(t){if(!t?.adapter||!t.font)return 0;let c=t.cache;if(c){let m=c.get(t.font);m||(m=new Map,c.set(t.font,m));let f=m.get("-");return f===void 0&&(f=t.adapter.measureSegment("-",t.font).width,m.set("-",f)),f}return t.adapter.measureSegment("-",t.font).width}function te(t,c,m,f){let h=c.segmentIndex,w=c.graphemeIndex;if(h>=t.length)return null;if(w===0){for(;h<t.length;){let e=t[h];if(e.kind==="hard-break")return{text:"",width:0,start:{segmentIndex:c.segmentIndex,graphemeIndex:0},end:{segmentIndex:h+1,graphemeIndex:0}};if(e.kind==="space"||e.kind==="zero-width-break"||e.kind==="soft-hyphen"){h+=1;continue}break}if(h>=t.length)return null}let u=$(f),s=h,r=h===c.segmentIndex?w:0,p=0,n=s,i=0,S=!1,B=-1,l=0,b=0,d=!1,g=(e,a,x,k)=>{B=e,l=a,b=x,d=k==="soft-hyphen"},o=(e,a,x)=>{for(let k=a;k<x.length;k++){let L=x[k];if(!S){p=L,n=e,i=k+1,S=!0;continue}if(p+L>m+.005)return!0;p+=L,n=e,i=k+1}return n===e&&i===x.length&&(n=e+1,i=0),!1};if(r>0&&s<t.length){let e=t[s];if(e.graphemeWidths){if(o(s,r,e.graphemeWidths))return{text:C(t,s,r,n,i,!1),width:p,start:{segmentIndex:s,graphemeIndex:r},end:{segmentIndex:n,graphemeIndex:i}};h=n}}for(;h<t.length;){let e=t[h];if(e.kind==="hard-break"){if(S){let k=n>0&&t[n-1]?.kind==="soft-hyphen";return{text:C(t,s,r,n,i,k),width:p+(k?u:0),start:{segmentIndex:s,graphemeIndex:r},end:{segmentIndex:n,graphemeIndex:i}}}return{text:"",width:0,start:{segmentIndex:s,graphemeIndex:r},end:{segmentIndex:h+1,graphemeIndex:0}}}let a=e.width;if(!S){if(a>m&&e.graphemeWidths){if(o(h,0,e.graphemeWidths))return{text:C(t,s,r,n,i,!1),width:p,start:{segmentIndex:s,graphemeIndex:r},end:{segmentIndex:n,graphemeIndex:i}};h=n;continue}p=a,n=h+1,i=0,S=!0,A(e.kind)&&g(h+1,0,e.kind==="space"?p-a:p,e.kind),h+=1;continue}let x=p+a;if(x>m+.005){if(A(e.kind)){n=h+1,i=0;let L=e.kind==="soft-hyphen",W=e.kind==="space"?p:p+(L?u:0);return{text:C(t,s,r,n,i,L),width:W,start:{segmentIndex:s,graphemeIndex:r},end:{segmentIndex:n,graphemeIndex:i}}}return B>=0?{text:C(t,s,r,B,l,d),width:b+(d?u:0),start:{segmentIndex:s,graphemeIndex:r},end:{segmentIndex:B,graphemeIndex:l}}:a>m&&e.graphemeWidths?{text:C(t,s,r,n,i,!1),width:p,start:{segmentIndex:s,graphemeIndex:r},end:{segmentIndex:n,graphemeIndex:i}}:{text:C(t,s,r,n,i,!1),width:p,start:{segmentIndex:s,graphemeIndex:r},end:{segmentIndex:n,graphemeIndex:i}}}p=x,n=h+1,i=0,A(e.kind)&&g(h+1,0,e.kind==="space"?p-a:p,e.kind),h+=1}if(!S)return null;let y=n>0&&t[n-1]?.kind==="soft-hyphen";return{text:C(t,s,r,n,i,y),width:p+(y?u:0),start:{segmentIndex:s,graphemeIndex:r},end:{segmentIndex:n,graphemeIndex:i}}}function ne(t,c,m=0){let f=[t];for(let h=0;h<c.length;h++){let w=c[h],u=[];for(let s=0;s<f.length;s++){let r=f[s];if(w.right<=r.left||w.left>=r.right){u.push(r);continue}w.left>r.left&&u.push({left:r.left,right:w.left}),w.right<r.right&&u.push({left:w.right,right:r.right})}f=u}return m>0?f.filter(h=>h.right-h.left>=m):f}function Q(t,c,m){let f=[],h=new Intl.Segmenter(void 0,{granularity:"grapheme"});for(let w=0;w<t.lines.length;w++){let u=t.lines[w],s=w*m,r=0;for(let p=u.startSegment;p<c.length;p++){let n=c[p];if(n.kind==="soft-hyphen"||n.kind==="hard-break"){if(p>=u.endSegment&&u.endGrapheme===0)break;continue}let i=[...h.segment(n.text)].map(l=>l.segment);if(i.length===0)continue;let S=p===u.startSegment?u.startGrapheme:0,B;if(p<u.endSegment)B=i.length;else if(p===u.endSegment&&u.endGrapheme>0)B=u.endGrapheme;else break;for(let l=S;l<B;l++){let b=n.graphemeWidths?n.graphemeWidths[l]:n.width/i.length;f.push({x:r,y:s,width:b,height:m,line:w}),r+=b}}}return f}function re(t){let{adapter:c,name:m="reactive-layout"}=t,f=new z(m),h=new Map,w=M(t.text??"",{name:"text"}),u=M(t.font??"16px sans-serif",{name:"font"}),s=M(t.lineHeight??20,{name:"line-height"}),r=M(Math.max(0,t.maxWidth??800),{name:"max-width"});function p(l,b){if(l===null||b===null)return l===b;if(l.length!==b.length)return!1;for(let d=0;d<l.length;d++)if(l[d]!==b[d])return!1;return!0}let n=H([w,u],(l,b,d)=>{let g=l[0],o=g!=null&&g.length>0?g.at(-1):d.prevData[0],y=l[1],I=y!=null&&y.length>0?y.at(-1):d.prevData[1],e=R(),a={hits:0,misses:0},x=V(o,I,c,h,a),k=R()-e,L=a.hits+a.misses,W=L===0?1:a.hits/L,v=n.meta;v&&(G(v["cache-hit-rate"],W),G(v["segment-count"],x.length),G(v["layout-time-ns"],k)),b.emit(x);let P=()=>{h.clear(),c.clearCache?.()};return{deactivate:P,invalidate:P}},{name:"segments",describeKind:"derived",meta:{"cache-hit-rate":0,"segment-count":0,"layout-time-ns":0},equals:(l,b)=>{let d=l,g=b;if(d==null||g==null)return d===g;if(d.length!==g.length)return!1;for(let o=0;o<d.length;o++){let y=d[o],I=g[o];if(y.text!==I.text||y.width!==I.width||y.kind!==I.kind||!p(y.graphemeWidths??null,I.graphemeWidths??null))return!1}return!0}}),i=N([n,r,u],([l,b,d])=>J(l,b,c,d,h),{name:"line-breaks",equals:(l,b)=>{let d=l,g=b;if(d==null||g==null)return d===g;if(d.lineCount!==g.lineCount)return!1;for(let o=0;o<d.lines.length;o++){let y=d.lines[o],I=g.lines[o];if(y.text!==I.text||y.width!==I.width||y.startSegment!==I.startSegment||y.startGrapheme!==I.startGrapheme||y.endSegment!==I.endSegment||y.endGrapheme!==I.endGrapheme)return!1}return!0}}),S=N([i,s],([l,b])=>l.lineCount*b,{name:"height"}),B=N([i,n,s],([l,b,d])=>Q(l,b,d),{name:"char-positions",equals:(l,b)=>{let d=l,g=b;if(d==null||g==null)return d===g;if(d.length!==g.length)return!1;for(let o=0;o<d.length;o++)if(d[o].x!==g[o].x||d[o].y!==g[o].y||d[o].width!==g[o].width)return!1;return!0}});return f.add(w,{name:"text"}),f.add(u,{name:"font"}),f.add(s,{name:"line-height"}),f.add(r,{name:"max-width"}),f.add(n,{name:"segments"}),f.add(i,{name:"line-breaks"}),f.add(S,{name:"height"}),f.add(B,{name:"char-positions"}),{graph:f,setText:l=>f.set("text",l),setFont:l=>f.set("font",l),setLineHeight:l=>f.set("line-height",l),setMaxWidth:l=>f.set("max-width",Math.max(0,l)),segments:n,lineBreaks:i,height:S,charPositions:B}}export{V as a,J as b,te as c,ne as d,Q as e,re as f};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as D,c as j,d as V,e as $}from"./chunk-
|
|
1
|
+
import{a as D,c as j,d as V,e as $}from"./chunk-CGDMTXSY.js";import{a as v}from"./chunk-ESMPEKEV.js";import{i as S}from"./chunk-D5RFJOZ2.js";import{n as T}from"./chunk-L7WY6TZS.js";import{m as R,x as N}from"./chunk-IA7DUNGB.js";import{G as K,o as b,p as L}from"./chunk-LYCLF26R.js";import{j as O}from"./chunk-CK2E7BTU.js";function w(){let e=new Error("aborted");return e.name="AbortError",e}function W(e,r){return e<=0?Promise.resolve():r?.aborted?Promise.reject(w()):new Promise((t,s)=>{let p=new v,u,y=()=>{p.cancel(),r&&u&&r.removeEventListener("abort",u)};p.start(e,()=>{y(),t()}),r&&(u=()=>{y(),s(w())},r.addEventListener("abort",u,{once:!0}))})}function U(e={}){let r=e.provider??"dry-run",t=e.model??"dry-run-v1",s=e.latencyMs??0,p=Math.max(1,e.streamChunkSize??16),u=e.respond??(d=>{let o=[...d].reverse().find(n=>n.role==="user");return o?`echo: ${o.content}`:"dry-run: no user message"}),y=e.usage??((d,o)=>{let n=d.reduce((a,l)=>a+l.content.length,0);return{input:{regular:Math.ceil(n/4)},output:{regular:Math.ceil(o.length/4)}}});return{provider:r,model:t,async invoke(d,o){if(await W(s,o?.signal),o?.signal?.aborted)throw w();let n=u(d,o),a=y(d,n);return{content:n,usage:a,finishReason:"stop",model:o?.model??t,provider:r,tier:o?.tier,metadata:{dryRun:!0}}},async*stream(d,o){let n=u(d,o),a=y(d,n),l=Math.ceil(n.length/p)||1,i=s>0?s/l:0;for(let c=0;c<n.length;c+=p){if(o?.signal?.aborted)throw w();await W(i,o?.signal),yield{type:"token",delta:n.slice(c,c+p)}}yield{type:"usage",usage:a},yield{type:"finish",reason:"stop"}}}}function _(e){let{storage:r,mode:t="read-write",keyFn:s,keyPrefix:p="llm-replay"}=e,y=V({storage:r,keyPrefix:p,mode:t==="read-strict"?"read":t,keyContext:({messages:o,opts:n})=>{let{signal:a,keyContext:l,...i}=n??{};return{messages:o,opts:i}}});async function d(o,n){if(s){if(s.length<=1){let l={messages:o,opts:n,context:n?.keyContext},i=await s(l);return`${p}:${i}`}let a=await s(o,n);return`${p}:${a}`}return y.keyFor({messages:o,opts:n})}return{keyFor:d,async lookup(o,n){if(t!=="write"){if(s){let a=await d(o,n),l=await r.load(a);return l===void 0?void 0:l}return y.lookup({messages:o,opts:n})}},async store(o,n,a){if(t!=="read"){if(s){let l=await d(o,n);await r.save(l,a);return}await y.store({messages:o,opts:n},a)}},async forget(o,n){if(!(t==="read"||t==="write")&&r.delete){if(s){let a=await d(o,n);await r.delete(a);return}await y.forget({messages:o,opts:n})}}}}function z(e,r,t){return{provider:t?.provider??e.provider,model:t?.model??e.model,capabilities:t?.capabilities??e.capabilities?.bind(e),invoke:r.invoke,stream:r.stream}}function ce(e,r){let{onResp:t,onError:s,name:p}=r;if(e!=null&&typeof e.then=="function"){let n=e;return s?n.then(t).catch(a=>{throw s(a),a}):n.then(t)}if(e!=null&&typeof e=="object"&&"content"in e)return t(e);let u=R(e);if(s){let n=!1;u.subscribe(a=>{for(let l of a){if(n)return;l[0]===O&&(n=!0,s(l[1]))}})}let y,d=!1,o=T(u,n=>{y=t(n),d=!0});return K([o],([n])=>n==null?null:d?y:t(n),{name:p??"adapt/invokeTap"})}function pe(e){let r=e.endNs??b();return{timestamp:r,wallClock:e.startWallClockNs??L(),provider:e.provider,model:e.model,tier:e.tier,usage:e.usage,latencyMs:Math.max(0,(r-e.startNs)/1e6),method:e.method,...e.error?{error:e.error}:{}}}function ye(){return{input:{regular:0},output:{regular:0}}}var G=Symbol.for("graphrefly.adapter.middlewareLayers");function J(e,r,t){let p=[...t?Q(t):[],r];return Object.defineProperty(e,G,{value:Object.freeze(p),enumerable:!1,writable:!1,configurable:!1}),e}function Q(e){let r=e[G];return Array.isArray(r)?r:[]}var M=class extends Error{constructor(t,s){super(`withReplayCache: no cached response for ${s} (key=${t}, mode=read-strict)`);this.key=t;this.method=s}name="ReplayCacheMissError"};function q(e,r){let t=r.mode??"read-write",s=r.cacheStreaming??!1,p=r.captureStreamCadence??!1,u=r.replaySpeed??1,y=r.keyPrefix??"llm-replay",d=t==="read"||t==="read-strict",o=_({storage:r.storage,mode:t==="write-only"?"write":t,keyFn:r.keyFn,keyPrefix:y}),n=i=>i<=0?Promise.resolve():new Promise(c=>{new v().start(i,()=>c())}),a=$(async({messages:i,invokeOpts:c})=>await N(R(e.invoke(i,c))),{keyFn:({_precomputedKey:i})=>i}),l=z(e,{async invoke(i,c){let C=await o.keyFor(i,c),f=await o.lookup(i,c);if(f?.response){let k=f.response;return{...k,metadata:{...k.metadata??{},replayCache:"hit"}}}if(t==="read-strict")throw new M(C,"invoke");let h=await a({messages:i,invokeOpts:c,_precomputedKey:C});return d||await o.store(i,c,{response:h,storedAtNs:L()}),h},async*stream(i,c){if(!s){for await(let m of e.stream(i,c))yield m;return}let C=await o.keyFor(i,c),f=await o.lookup(i,c);if(f){let m=f.response;if(f.streamChunks&&f.streamCadenceMs)for(let g=0;g<f.streamChunks.length;g++){let A=f.streamCadenceMs[g]??0,E=u>0?A/u:0;E>0&&await n(E),yield{type:"token",delta:f.streamChunks[g]?.delta??""}}else m.content&&(yield{type:"token",delta:m.content});m.usage&&(yield{type:"usage",usage:m.usage}),yield{type:"finish",reason:m.finishReason??"stop"};return}if(t==="read-strict")throw new M(C,"stream");let h="",k,P,F=[],I=[],x;for await(let m of e.stream(i,c)){if(m.type==="token"&&(h+=m.delta,p)){let g=b(),A=x===void 0?0:(g-x)/1e6;I.push(A),x=g,F.push({delta:m.delta})}m.type==="usage"&&(k=m.usage),m.type==="finish"&&(P=m.reason),yield m}if((h||k)&&!d){let g={response:{content:h,usage:k??{input:{regular:0},output:{regular:0}},finishReason:P,model:e.model??c?.model??"",provider:e.provider},storedAtNs:L(),...p?{streamChunks:F,streamCadenceMs:I}:{}};await o.store(i,c,g)}}});return J(l,"withReplayCache",e),l}var B=j;var Ae=M;function H(e,r){return{content:"[fallback: no cached response available for this request]",usage:{input:{regular:0},output:{regular:0}},finishReason:"stop",model:r,provider:e,metadata:{degraded:!0,reason:"no-fixture"}}}function Y(e,r,t){return typeof e=="string"?{content:e,usage:{input:{regular:0},output:{regular:0}},finishReason:"stop",model:t,provider:r,metadata:{degraded:!0,reason:"respond"}}:e}async function X(e,r){if("key"in e)return e.key;let t=B({messages:e.messages,opts:e.invokeOpts??{}}),s=await D(t);return`${r}:${s}`}function Z(e){let r={response:e.response,storedAtNs:L()};if("key"in e&&e.stream){let t=e.stream.chunks.filter(s=>s.type==="token");return{...r,streamChunks:t.map(s=>({delta:s.delta})),streamCadenceMs:e.stream.delaysMs??t.map(()=>0)}}return r}function ee(e,r){let t=[];if(e.fixtures!=null&&t.push("fixtures"),e.fixturesStorage!=null&&t.push("fixturesStorage"),t.length>1)throw new TypeError(`fallbackAdapter: \`fixtures\` and \`fixturesStorage\` are mutually exclusive; got both ${t.join(" and ")}. Pick one source. For filesystem directories use the node subpath's \`fallbackAdapter\`.`);if(e.fixtures){let s=S(),p=e.fixtures,u=(async()=>{for(let y of p){let d=await X(y,r);await s.save(d,Z(y))}})();return u.catch(()=>{}),{tier:s,seedReady:u}}return e.fixturesStorage?{tier:e.fixturesStorage,seedReady:Promise.resolve()}:{tier:void 0,seedReady:Promise.resolve()}}function Se(e={}){let r=e.provider??"fallback",t=e.model??"fallback",s=e.onMiss??"respond",p=e.keyPrefix??"fallback",u=e.record?e.record.adapter:s==="throw"?U({provider:r,model:t,respond:()=>"[unreachable: read-strict mode throws on miss]"}):{provider:r,model:t,async invoke(a,l){let i=e.respond?e.respond(a,l):H(r,t);return Y(i,r,t)},async*stream(a,l){let i=e.respond?e.respond(a,l):H(r,t),c=Y(i,r,t);yield{type:"token",delta:c.content},c.usage&&(yield{type:"usage",usage:c.usage}),yield{type:"finish",reason:c.finishReason??"stop"}}},y,d=Promise.resolve();if(e.record){if(!e.record.storage)throw new TypeError("fallbackAdapter: `record.storage` is required in record mode. For filesystem `record.dir` convenience, use the node subpath's `fallbackAdapter`.");y=e.record.storage}else{let a=ee(e,p);y=a.tier??S(),d=a.seedReady}let o=e.record?"read-write":s==="throw"?"read-strict":"read",n=q(u,{storage:y,mode:o,keyPrefix:p,cacheStreaming:!0,captureStreamCadence:!0,replaySpeed:e.replaySpeed,...e.keyFn?{keyFn:e.keyFn}:{}});return{provider:r,model:t,capabilities:n.capabilities?.bind(n),async invoke(a,l){return await d,n.invoke(a,l)},async*stream(a,l){await d;for await(let i of n.stream(a,l))yield i}}}export{U as a,z as b,ce as c,pe as d,ye as e,J as f,M as g,q as h,B as i,Ae as j,Se as k};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as x}from"./chunk-7JRF5YEK.js";import{b as y}from"./chunk-AU7YTQX7.js";import{E as T,m as A,p as f,t as b}from"./chunk-LYCLF26R.js";import{b as m,c as R}from"./chunk-CK2E7BTU.js";function N(r,e){let t=r.cache??0;return t>=e?!1:(r.down([[R],[m,t+1]]),!0)}var M=b((r,e)=>{r("observe"),r("signal"),e("write")});function q(r){let e=y([],{name:r.name,maxSize:r.retainedLimit??1024,guard:r.guard??M,...r.versioning!=null?{versioning:r.versioning}:{}});return e.withLatest(),r.graph&&r.graph.add(e.entries,{name:r.name}),e}function p(r){if(r===null||typeof r!="object"||Object.isFrozen(r))return r;for(let e of Object.keys(r))p(r[e]);return Object.freeze(r)}function w(r){let e=r.cache,u=(typeof e=="number"&&Number.isFinite(e)?e:0)+1;return r.down([[R],[m,u]]),u}function g(r,e,t,u,i,s){let o=e(t,u,i);if(o===void 0)return;let a=s!=null?{...o,handlerVersion:s}:o;r.append(a)}function z(r,e){let t=e.freeze??!0;return function(...i){let s=t?i.map(p):i,o=f(),a=e.seq?w(e.seq):void 0;try{let n=r(...s);return e.onSuccess&&g(e.audit,e.onSuccess,s,n,{t_ns:o,seq:a},e.handlerVersion),n}catch(n){if(e.onFailure){let d=n instanceof Error?n.name:typeof n;g(e.audit,e.onFailure,s,n,{t_ns:o,seq:a,errorType:d},e.handlerVersion)}throw n}}}function G(r,e){let t=e.freeze??!0;return function(...i){let s=t?i.map(p):i,o=f(),a,n,d=!1,l;try{A(()=>{e.seq&&(l=w(e.seq));try{a=r(...s),e.onSuccess&&g(e.audit,e.onSuccess,s,a,{t_ns:o,seq:l},e.handlerVersion)}catch(c){throw n=c,d=!0,c}})}catch(c){if(d&&e.onFailure){let h=n instanceof Error?n.name:typeof n;g(e.audit,e.onFailure,s,n,{t_ns:o,seq:l,errorType:h},e.handlerVersion)}throw d?n:c}return a}}function V(r,e,t=0){let u=T(t,{name:e,describeKind:"state"});return r.add(u,{name:e}),u}function _(r,e,t,u=0){let i={},s=new x(e);for(let o of t){let a=T(u,{name:o,describeKind:"state"});s.add(a,{name:o}),i[o]=a}return r.mount(e,s),i}export{N as a,M as b,q as c,w as d,g as e,z as f,G as g,V as h,_ as i};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as I,x as w}from"./chunk-L7WY6TZS.js";import{c as O}from"./chunk-35JTVPOX.js";import{b as E}from"./chunk-TZQPPQEQ.js";import{m as d,s as g}from"./chunk-IA7DUNGB.js";import{E as R,G as V,m as h}from"./chunk-LYCLF26R.js";import{b}from"./chunk-CK2E7BTU.js";function C(o){return typeof o=="object"&&o!==null&&"cache"in o&&typeof o.subscribe=="function"}function H(o,a,e){let r=d(o),t=r.v!=null,p=R(e?.initialVerified??null,{meta:{...O("verifiable"),...t?{sourceVersion:null}:{}}}),x=e?.trigger!==void 0&&e.trigger!==null,s=null;if(x&&e?.autoVerify?s=I(d(e.trigger),r):x?s=d(e.trigger):e?.autoVerify&&(s=r),s!==null){let y;if(s===r)y=w(r,c=>a(c));else{let c=r.cache;r.subscribe(f=>{for(let M of f)M[0]===b&&(c=M[1])}),y=w(s,()=>a(c))}g(y,c=>{h(()=>{if(p.down([[b,c]]),t){let f=r.v;f!=null&&p.meta.sourceVersion.down([[b,{id:f.id,version:f.version}]])}})})}return{node:r,verified:p,trigger:s}}function B(o){o.subscribe(()=>{})}function v(o){return o instanceof Map?o:new Map}function S(o,a){if(!Array.isArray(a.upsert))throw new TypeError("distill extraction requires upsert: Array<{ key, value }>");h(()=>{for(let{key:e,value:r}of a.upsert)o.set(e,r);for(let e of a.remove??[])o.delete(e)})}function J(o,a,e){let r=d(o),t=E(e.mapOptions??{}),p=e.budget??2e3,s=e.context!==void 0&&e.context!==null?d(e.context):R(null),y=v(t.entries.cache);t.entries.subscribe(i=>{for(let u of i)u[0]===b&&(y=v(u[1]))});let c=d(a(r,t.entries));if(g(c,i=>{S(t,i)}),e.evict){let i=new Map,u=V([t.entries],([l])=>{let m=[],N=v(l);for(let n of i.keys())N.has(n)||(i.get(n)(),i.delete(n));for(let[n,T]of N){let k=e.evict(n,T);if(C(k)){if(!i.has(n)){let D=g(k,z=>{z===!0&&t.has(n)&&t.delete(n)});i.set(n,D)}continue}if(typeof k=="boolean"){k&&m.push(n);continue}throw new TypeError("distill evict() must return boolean or Node<boolean>")}return m});g(u,l=>{for(let m of l)t.delete(m)})}let f=e.consolidateTrigger!==void 0&&e.consolidateTrigger!==null;if(e.consolidate&&f){let i=d(e.consolidateTrigger),u=w(i,()=>e.consolidate(y));g(u,l=>{S(t,l)})}let M=V([t.entries,s],([i,u])=>{let l=[...v(i).entries()].map(([n,T])=>({key:n,value:T,score:e.score(T,u),cost:e.cost(T)}));l.sort((n,T)=>T.score-n.score);let m=[],N=p;for(let n of l)n.cost<=N&&(m.push({key:n.key,value:n.value,score:n.score}),N-=n.cost);return m},{meta:{...O("distill",{budget:p})}}),A=V([t.entries],([i])=>v(i).size);return B(M),B(A),{store:t,compact:M,size:A}}export{H as a,J as b};
|