@graphrefly/graphrefly 0.29.0 → 0.31.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{cascading-CcAgRacD.d.cts → cascading-BfQmSmjU.d.cts} +22 -3
- package/dist/{cascading-Bp99ckMJ.d.ts → cascading-D3sapjue.d.ts} +22 -3
- package/dist/{chunk-JYOUF6UQ.js → chunk-3JRKP4BH.js} +1 -1
- package/dist/{chunk-GJR3P6JG.js → chunk-3Q2WXM6X.js} +1 -1
- package/dist/chunk-4KAUNEKV.js +3 -0
- package/dist/{chunk-SLMYTGTU.js → chunk-4UUDNFYG.js} +1 -1
- package/dist/chunk-4VXL3UZK.js +1 -0
- package/dist/{chunk-AV3PIDFQ.js → chunk-4ZPO2EL5.js} +1 -1
- package/dist/{chunk-VWPRPPKR.js → chunk-5LJAQTSS.js} +1 -1
- package/dist/{chunk-W4TSQ6RJ.js → chunk-7AJKUA36.js} +1 -1
- package/dist/{chunk-RD52SNH2.js → chunk-7EJTWGKW.js} +1 -1
- package/dist/{chunk-GNCBXARM.js → chunk-7EQPXQ7H.js} +1 -1
- package/dist/chunk-7QMVU3IX.js +1 -0
- package/dist/{chunk-BA5URFYW.js → chunk-A4JT4SAD.js} +1 -1
- package/dist/chunk-ASDKRNOJ.js +60 -0
- package/dist/{chunk-Y32RJO24.js → chunk-CZVYLXFK.js} +1 -1
- package/dist/{chunk-567NWZ3T.js → chunk-DWIAG62L.js} +1 -1
- package/dist/{chunk-Y53B6NS4.js → chunk-EBQ6FXKW.js} +1 -1
- package/dist/chunk-FTA5TB2A.js +1 -0
- package/dist/{chunk-E3AXATVZ.js → chunk-GF5T7PGC.js} +1 -1
- package/dist/{chunk-HSIEYSDY.js → chunk-I4U3TPK2.js} +1 -1
- package/dist/{chunk-AMG5VBHW.js → chunk-JMGGCSIC.js} +1 -1
- package/dist/chunk-JXRZXP3N.js +1 -0
- package/dist/{chunk-5Z4HDCO6.js → chunk-K54OKWNY.js} +1 -1
- package/dist/{chunk-63FFOHLA.js → chunk-KN4Q5MQO.js} +1 -1
- package/dist/chunk-LWGLBCMU.js +1 -0
- package/dist/{chunk-TWMEGG45.js → chunk-N2KKISCE.js} +1 -1
- package/dist/{chunk-4OFIQ66T.js → chunk-OKQUPJRY.js} +1 -1
- package/dist/chunk-PNTBXOQ6.js +5 -0
- package/dist/chunk-PSQNYY72.js +7 -0
- package/dist/{chunk-22F4K3G7.js → chunk-PZP4MEXK.js} +1 -1
- package/dist/{chunk-7TDOES3L.js → chunk-Q2SY7M7K.js} +1 -1
- package/dist/{chunk-OL33ZI6R.js → chunk-RWGJQQLT.js} +1 -1
- package/dist/chunk-SGS4OJGS.js +1 -0
- package/dist/chunk-UMH3HSP7.js +1 -0
- package/dist/{chunk-BZP5T4X6.js → chunk-W6FQIFVE.js} +1 -1
- package/dist/{chunk-A7IAQQ63.js → chunk-WLPVGXQ6.js} +1 -1
- package/dist/chunk-WQ7I7JVU.js +1 -0
- package/dist/{chunk-LGSNR4LU.js → chunk-WYJTXYWX.js} +1 -1
- package/dist/{chunk-PGMUCUHG.js → chunk-X2VHDT26.js} +1 -1
- package/dist/{chunk-PCZ35NXD.js → chunk-XEFAMCEA.js} +1 -1
- package/dist/{chunk-AUY2YKCO.js → chunk-XRSHMHEG.js} +1 -1
- package/dist/chunk-Y26UN6J5.js +18 -0
- package/dist/{chunk-BKPLTBL5.js → chunk-YQJPYEAL.js} +1 -1
- package/dist/{chunk-UVJQ35G2.js → chunk-YZ6VYLFD.js} +1 -1
- package/dist/{chunk-4JJCCD5S.js → chunk-YZKGGMPT.js} +1 -1
- package/dist/chunk-Z3UWIJ3A.js +1 -0
- package/dist/{chunk-CSJE2EKV.js → chunk-ZM7C2FUM.js} +1 -1
- package/dist/compat/index.cjs +1 -1
- package/dist/compat/index.d.cts +14 -14
- package/dist/compat/index.d.ts +14 -14
- package/dist/compat/index.js +1 -1
- package/dist/compat/jotai/index.cjs +1 -1
- package/dist/compat/jotai/index.d.cts +2 -2
- package/dist/compat/jotai/index.d.ts +2 -2
- package/dist/compat/jotai/index.js +1 -1
- package/dist/compat/nanostores/index.cjs +1 -1
- package/dist/compat/nanostores/index.d.cts +2 -2
- package/dist/compat/nanostores/index.d.ts +2 -2
- package/dist/compat/nanostores/index.js +1 -1
- package/dist/compat/nestjs/index.cjs +5 -5
- package/dist/compat/nestjs/index.d.cts +6 -6
- package/dist/compat/nestjs/index.d.ts +6 -6
- 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 +1 -1
- 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-BL-llbnE.d.ts → composite-BY9hMxN7.d.ts} +2 -2
- package/dist/{composite-Dze--DaA.d.cts → composite-CH0S8DFn.d.cts} +2 -2
- package/dist/content-addressed-storage-BUiREIuj.d.ts +124 -0
- package/dist/content-addressed-storage-DqIWCmZG.d.cts +124 -0
- 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.cjs +1 -1
- package/dist/extra/browser.d.cts +1 -1
- package/dist/extra/browser.d.ts +1 -1
- package/dist/extra/browser.js +1 -1
- package/dist/extra/index.cjs +18 -18
- package/dist/extra/index.d.cts +12 -11
- package/dist/extra/index.d.ts +12 -11
- package/dist/extra/index.js +1 -1
- package/dist/extra/node.cjs +2 -2
- package/dist/extra/node.d.cts +1 -1
- package/dist/extra/node.d.ts +1 -1
- package/dist/extra/node.js +1 -1
- package/dist/extra/operators.cjs +1 -1
- package/dist/extra/operators.d.cts +42 -2
- package/dist/extra/operators.d.ts +42 -2
- 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/sources.cjs +1 -1
- package/dist/extra/sources.d.cts +63 -3
- package/dist/extra/sources.d.ts +63 -3
- package/dist/extra/sources.js +1 -1
- package/dist/extra/storage-browser.cjs +1 -1
- package/dist/extra/storage-browser.d.cts +1 -1
- package/dist/extra/storage-browser.d.ts +1 -1
- package/dist/extra/storage-browser.js +1 -1
- package/dist/{fallback-BaTS7vVY.d.cts → fallback-Cb3GH1O7.d.cts} +6 -14
- package/dist/{fallback-eOm3LNxP.d.ts → fallback-DRjJ_ZM8.d.ts} +6 -14
- package/dist/graph/index.cjs +4 -4
- 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-DgohqXK-.d.cts → graph-C4Uxwv0T.d.cts} +2 -2
- package/dist/{graph-Qjg9gWHI.d.ts → graph-CWeI0aHd.d.ts} +2 -2
- package/dist/{index-DX8xS-yB.d.cts → index-9iguV3bF.d.cts} +2 -2
- package/dist/{index-BanNUILp.d.cts → index-B-z8WaSd.d.cts} +2 -2
- package/dist/{index-C66RJiX8.d.ts → index-B5iVOD7w.d.ts} +2 -2
- package/dist/{index-CcWOJ6F0.d.ts → index-BANwzwBV.d.ts} +3 -3
- package/dist/{index-CiaVoZGo.d.ts → index-BBINVimG.d.ts} +3 -3
- package/dist/{index-B-gqvYel.d.ts → index-BEpRsvhg.d.ts} +4 -4
- package/dist/{index-C8RfjffH.d.ts → index-BMe3pCom.d.cts} +3 -3
- package/dist/{index-gsT79Xu9.d.ts → index-BX22kvjh.d.ts} +1 -1
- package/dist/{index-CA1Cu7Ud.d.ts → index-BXzl1NDD.d.ts} +6 -6
- package/dist/{index-BqZ6vB2A.d.ts → index-Bd6oFZqO.d.ts} +230 -122
- package/dist/{index-kykKWwV-.d.cts → index-BpFWP7Bq.d.cts} +3 -3
- package/dist/{index-iKkyJosF.d.cts → index-Bs3-LC83.d.cts} +3 -3
- package/dist/{index-CJ45TW-h.d.ts → index-Bvi5uJxX.d.ts} +1 -1
- package/dist/{index-IMAHq-ia.d.ts → index-ByPnK85n.d.ts} +1 -1
- package/dist/{index-CABbltIu.d.cts → index-BydMDMf7.d.cts} +1 -1
- package/dist/{index-D5XJ2tSx.d.ts → index-C5Ghnp5B.d.ts} +3 -3
- package/dist/{index-BiyjsZ0m.d.ts → index-C6NBfXj-.d.ts} +3 -3
- package/dist/{index-D9HKAH_-.d.cts → index-C98oJsEs.d.cts} +2 -2
- package/dist/{index-CHEBsnYv.d.cts → index-CDK5RsV5.d.cts} +1 -1
- package/dist/{index-DJ5oNBc8.d.ts → index-CFW32Dy1.d.ts} +3 -3
- package/dist/{index-D80do5jX.d.cts → index-CIXaiYDE.d.cts} +1 -1
- package/dist/{index-2BVuRCI4.d.ts → index-CJymKyzT.d.ts} +86 -11
- package/dist/{index-H_oxVec5.d.cts → index-CRAkoq-y.d.cts} +1 -1
- package/dist/{index-DiZejfCI.d.cts → index-CZChc85Q.d.cts} +230 -122
- package/dist/{index-DDy8eeXS.d.ts → index-CcS0t-l2.d.ts} +3 -3
- package/dist/{index-B2PRuolf.d.cts → index-CcpEvuPl.d.cts} +2 -2
- package/dist/{index-DwjJGKxV.d.ts → index-CfFYyLR8.d.ts} +3 -3
- package/dist/{index-A65LZhoM.d.ts → index-CotRMjtJ.d.ts} +2 -2
- package/dist/{index-BQaEnxBf.d.ts → index-CrC7urhX.d.ts} +1 -1
- package/dist/{index-DuB5aO4-.d.ts → index-CvS9IuTG.d.ts} +2 -2
- package/dist/{index-BUi57v_p.d.ts → index-CwhcFzTA.d.ts} +4 -4
- package/dist/{index-BUVtw1Ay.d.cts → index-Cy7eFeIX.d.cts} +2 -2
- package/dist/{index-C08QPDcV.d.cts → index-D-kHVedZ.d.cts} +3 -3
- package/dist/{index-Ct5CWc4E.d.ts → index-D0C_USMR.d.ts} +1 -1
- package/dist/{index-y1RllPn4.d.cts → index-D7XxY1Ff.d.cts} +1 -1
- package/dist/{index-BJqt9EwW.d.ts → index-D9HrBx2J.d.ts} +2 -2
- package/dist/{index-DP0_O3ls.d.cts → index-D9Y_u6BG.d.cts} +3 -3
- package/dist/{index-DoWMs-Kk.d.cts → index-DBQUKh59.d.cts} +4 -4
- package/dist/{index-dig-r2tQ.d.cts → index-DD7RhHNJ.d.cts} +6 -6
- package/dist/{index-U1nir7MX.d.cts → index-DDo-eqQ4.d.cts} +1 -1
- package/dist/{index-2NvguqQA.d.ts → index-DGb1awva.d.ts} +4 -4
- package/dist/{index-i99Ka8s7.d.cts → index-DR3gf_DG.d.cts} +9 -9
- package/dist/{index-DBe_8XW5.d.cts → index-DVNLe3pS.d.cts} +3 -3
- package/dist/{index-DknyJ2Fu.d.cts → index-Dm3_D5Ta.d.cts} +4 -4
- package/dist/{index-DCeTyFlB.d.ts → index-DnrZghBB.d.ts} +2 -2
- package/dist/{index-Byh-xTyp.d.ts → index-Docdiu9a.d.ts} +3 -3
- package/dist/{index-BTSkeCZs.d.cts → index-DxMS0cHM.d.ts} +3 -3
- package/dist/{index-D38duMCv.d.cts → index-DylQCKEL.d.cts} +3 -3
- package/dist/{index-jleeotBT.d.cts → index-FBqTfL_S.d.cts} +1 -1
- package/dist/{index-Vg7tORgk.d.ts → index-FrYrV-Vf.d.ts} +2 -2
- package/dist/{index-BSfwiy5B.d.ts → index-IZ3l_vQ9.d.ts} +2 -2
- package/dist/{index-CX2tFJL1.d.ts → index-Ip3q9T9x.d.ts} +1 -1
- package/dist/{index-CI0yDnLp.d.ts → index-RQg6lTrN.d.ts} +9 -9
- package/dist/{index-vgcLF5TH.d.cts → index-SSGqF8mI.d.cts} +2 -2
- package/dist/{index-CJZKZoo4.d.cts → index-UZO988ox.d.cts} +3 -3
- package/dist/{index-BKjT5DiZ.d.cts → index-gJQqJTKx.d.cts} +86 -11
- package/dist/{index-BayHDRx6.d.cts → index-iBp74eGU.d.cts} +3 -3
- package/dist/{index-BuVidq3D.d.cts → index-lKuLYmHO.d.cts} +2 -2
- package/dist/{index-BM8BU4q6.d.ts → index-wIx1Jisk.d.ts} +1 -1
- package/dist/{index-B-8FCEua.d.cts → index-yIdWFo2b.d.cts} +4 -4
- package/dist/index.cjs +99 -121
- package/dist/index.d.cts +47 -46
- package/dist/index.d.ts +47 -46
- package/dist/index.js +1 -1
- package/dist/{meta-CckhhFRd.d.ts → meta-BMwx3ExI.d.ts} +1 -1
- package/dist/{meta-CX7YsOzp.d.cts → meta-COtmHLwT.d.cts} +1 -1
- package/dist/{node-Dd6wHSib.d.cts → node-BVV7G1bq.d.cts} +24 -0
- package/dist/{node-Dd6wHSib.d.ts → node-BVV7G1bq.d.ts} +24 -0
- package/dist/{observable-kwzpLvbi.d.cts → observable-BrUAPeH_.d.cts} +1 -1
- package/dist/{observable-BZJgo616.d.ts → observable-ITikPXz3.d.ts} +1 -1
- package/dist/patterns/ai/browser.cjs +5 -22
- 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 +27 -44
- package/dist/patterns/ai/index.d.cts +17 -15
- package/dist/patterns/ai/index.d.ts +17 -15
- package/dist/patterns/ai/index.js +1 -1
- package/dist/patterns/ai/node.cjs +2 -2
- package/dist/patterns/ai/node.d.cts +5 -4
- package/dist/patterns/ai/node.d.ts +5 -4
- package/dist/patterns/ai/node.js +1 -1
- package/dist/patterns/audit/index.cjs +3 -3
- package/dist/patterns/audit/index.d.cts +5 -5
- package/dist/patterns/audit/index.d.ts +5 -5
- package/dist/patterns/audit/index.js +1 -1
- package/dist/patterns/cqrs/index.cjs +6 -6
- package/dist/patterns/cqrs/index.d.cts +4 -4
- package/dist/patterns/cqrs/index.d.ts +4 -4
- package/dist/patterns/cqrs/index.js +1 -1
- package/dist/patterns/demo-shell/index.cjs +1 -1
- 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 +4 -4
- 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 +6 -6
- 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 +7 -7
- package/dist/patterns/guarded-execution/index.d.cts +6 -6
- package/dist/patterns/guarded-execution/index.d.ts +6 -6
- package/dist/patterns/guarded-execution/index.js +1 -1
- package/dist/patterns/harness/index.cjs +11 -11
- package/dist/patterns/harness/index.d.cts +9 -9
- package/dist/patterns/harness/index.d.ts +9 -9
- package/dist/patterns/harness/index.js +1 -1
- package/dist/patterns/job-queue/index.cjs +5 -5
- package/dist/patterns/job-queue/index.d.cts +4 -4
- package/dist/patterns/job-queue/index.d.ts +4 -4
- package/dist/patterns/job-queue/index.js +1 -1
- package/dist/patterns/lens/index.cjs +5 -5
- 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 +4 -4
- package/dist/patterns/memory/index.d.cts +4 -4
- package/dist/patterns/memory/index.d.ts +4 -4
- package/dist/patterns/memory/index.js +1 -1
- package/dist/patterns/messaging/index.cjs +5 -5
- package/dist/patterns/messaging/index.d.cts +4 -4
- package/dist/patterns/messaging/index.d.ts +4 -4
- package/dist/patterns/messaging/index.js +1 -1
- package/dist/patterns/orchestration/index.cjs +1 -1
- package/dist/patterns/orchestration/index.d.cts +5 -5
- package/dist/patterns/orchestration/index.d.ts +5 -5
- package/dist/patterns/orchestration/index.js +1 -1
- package/dist/patterns/reactive-layout/index.cjs +1 -1
- 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 +5 -5
- 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 +8 -8
- package/dist/patterns/refine-loop/index.d.cts +5 -5
- package/dist/patterns/refine-loop/index.d.ts +5 -5
- 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 +6 -6
- package/dist/patterns/resilient-pipeline/index.d.ts +6 -6
- package/dist/patterns/resilient-pipeline/index.js +1 -1
- package/dist/patterns/surface/index.cjs +7 -7
- 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/{reactive-layout-PiFwVaWS.d.cts → reactive-layout-5oEn8lHM.d.cts} +2 -2
- package/dist/{reactive-layout-BkBwVvwm.d.ts → reactive-layout-BAr6-_o5.d.ts} +2 -2
- package/dist/{reactive-log-BiVoSxke.d.cts → reactive-log-5jFeNRmd.d.cts} +1 -1
- package/dist/{reactive-log-1QTyx10a.d.ts → reactive-log-BOJDCI5x.d.ts} +1 -1
- package/dist/{reactive-map-CwO_COHy.d.cts → reactive-map-CtRaCddO.d.ts} +60 -2
- package/dist/{reactive-map-FeuTVAJb.d.ts → reactive-map-IJIfZxoh.d.cts} +60 -2
- package/dist/{resilience-CBfYJW5C.d.ts → resilience-CludlzcP.d.ts} +1 -1
- package/dist/{resilience-XRUF267O.js → resilience-IVNDYORD.js} +1 -1
- package/dist/{resilience-uBz4yvYB.d.cts → resilience-Q6Bt_7y0.d.cts} +1 -1
- package/dist/{sugar-CY-MCfZ9.d.ts → sugar-BHbAACDG.d.ts} +1 -1
- package/dist/{sugar-DHttV0LX.d.cts → sugar-CqR6DJ7v.d.cts} +1 -1
- package/dist/{topology-tree-CVjt2gp7.d.cts → topology-tree-CVREibAc.d.cts} +1 -1
- package/dist/{topology-tree-one6oSKY.d.ts → topology-tree-CkjojcB6.d.ts} +1 -1
- package/dist/{types-O3GzJY2U.d.cts → types-BgMqbc7N.d.cts} +41 -14
- package/dist/{types-u64Ose53.d.ts → types-CdfO2QTt.d.ts} +41 -14
- package/package.json +1 -1
- package/dist/chunk-22SVXUPB.js +0 -64
- package/dist/chunk-2GQREQ6C.js +0 -1
- package/dist/chunk-4V4C7K56.js +0 -1
- package/dist/chunk-5JDE5JHE.js +0 -1
- package/dist/chunk-7JDLFI6N.js +0 -1
- package/dist/chunk-ISCENNXS.js +0 -1
- package/dist/chunk-KASHOCF5.js +0 -1
- package/dist/chunk-LVGBLZM2.js +0 -1
- package/dist/chunk-MGKAO4EK.js +0 -7
- package/dist/chunk-NSG4C6BF.js +0 -23
- package/dist/chunk-VGTCGNRX.js +0 -18
- package/dist/chunk-WM7H7WTY.js +0 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as E}from"./chunk-ESMPEKEV.js";import{a as B,b as R,i as _}from"./chunk-4VVTGLXJ.js";import{m as I}from"./chunk-
|
|
1
|
+
import{a as E}from"./chunk-ESMPEKEV.js";import{a as B,b as R,i as _}from"./chunk-4VVTGLXJ.js";import{m as I}from"./chunk-UMH3HSP7.js";import{D as P,F as g,m as L,o as O}from"./chunk-7AJKUA36.js";import{b,c as k,d as y,h as C,i as h,j as T}from"./chunk-CK2E7BTU.js";function S(e){return{describeKind:"derived",...e}}function V(e){return e<0?0:e}function M(e){return e[1]}function W(e){if(typeof e!="number"||!Number.isFinite(e))throw new TypeError("backoff strategy must return a finite number");return e<0?0:e}function Z(e,s){let r=s?.count,n=s?.backoff,l=r!==void 0?r:n===void 0?0:2147483647;if(l<0)throw new RangeError("retry count must be >= 0");let u=n===void 0?null:typeof n=="string"?_(n):n;return g(t=>{let o=0,c=!1,i=null,f,a=new E;function w(){f?.(),f=void 0}function N(p){if(c)return;if(o>=l){w(),t.down([[T,p]]);return}let m=u===null?0:u(o,p,i);if(m==null){w(),t.down([[T,p]]);return}let d;try{d=W(m)}catch{w(),t.down([[T,p]]);return}i=d,o+=1,w();let v=d>0?d/1e6:1;a.start(v,()=>{c||x()})}function x(){a.cancel(),w(),f=e.subscribe(p=>{if(!c)for(let m of p){let d=m[0];if(d===k)t.down([[k]]);else if(d===b)o=0,i=null,t.emit(m[1]);else if(d===y)t.down([[y]]);else if(d===h)w(),t.down([[h]]);else if(d===T){N(M(m));return}else t.down([m])}})}return x(),()=>{c=!0,a.cancel(),w()}},{...S(),initial:e.cache})}function ee(e,s){let r=s?.count,n=s?.backoff,l=r!==void 0?r:n===void 0?0:2147483647;if(l<0)throw new RangeError("retry count must be >= 0");let u=n===void 0?null:typeof n=="string"?_(n):n;return g(t=>{let o=0,c=!1,i=null,f,a=new E;function w(){f?.(),f=void 0}function N(p){if(c)return;if(o>=l){w(),t.down([[T,p]]);return}let m=u===null?0:u(o,p,i);if(m==null){w(),t.down([[T,p]]);return}let d;try{d=W(m)}catch{w(),t.down([[T,p]]);return}i=d,o+=1,w();let v=d>0?d/1e6:1;a.start(v,()=>{c||x()})}function x(){a.cancel(),w();let p;try{p=e()}catch(m){N(m);return}f=p.subscribe(m=>{if(!c)for(let d of m){let v=d[0];if(v===k)t.down([[k]]);else if(v===b)o=0,i=null,t.emit(d[1]);else if(v===y)t.down([[y]]);else if(v===h)w(),t.down([[h]]);else if(v===T){N(M(d));return}else t.down([d])}})}return x(),()=>{c=!0,a.cancel(),w()}},{...S(),initial:s?.initial})}var A=class extends Error{name="CircuitOpenError";constructor(){super("Circuit breaker is open")}};function te(e){let s=Math.max(1,e?.failureThreshold??5),r=V(e?.cooldownNs??30*1e9),n=e?.cooldown??null,l=Math.max(1,e?.halfOpenMax??1),u=e?.now??O,t="closed",o=0,c=0,i=0,f=r,a=0;function w(){if(!n)return r;let p=n(c);return p!==null?p:r}function N(){t="open",f=w(),i=u(),a=0}return{canExecute(){return t==="closed"?!0:t==="open"?u()-i>=f?(t="half-open",a=1,!0):!1:a<l?(a++,!0):!1},recordSuccess(){t==="half-open"?(t="closed",o=0,c=0):t==="closed"&&(o=0)},recordFailure(p){if(t==="half-open"){c++,N();return}t==="closed"&&(o++,o>=s&&N())},get state(){return t},get failureCount(){return o},reset(){t="closed",o=0,c=0,a=0}}}function ne(e,s){let r=s?.onOpen??"skip";return n=>{let l=P([],(u,t)=>{function o(){l.meta.breakerState.down([[b,e.state]])}let c=n.subscribe(i=>{for(let f of i){let a=f[0];a===k?t.down([[k]]):a===b?e.canExecute()?(o(),t.emit(f[1])):(o(),r==="error"?t.down([[T,new A]]):t.down([[y]])):a===y?t.down([[y]]):a===h?(e.recordSuccess(),o(),t.down([[h]])):a===T?(e.recordFailure(M(f)),o(),t.down([f])):t.down([f])}});return o(),c},{...S(),meta:{breakerState:e.state},completeWhenDepsComplete:!1,initial:n.cache});return{node:l,breakerState:l.meta.breakerState}}}function U(e,s){if(e<=0)throw new RangeError("capacity must be > 0");if(s<0)throw new RangeError("refillPerSecond must be >= 0");let r=e,n=O();function l(u){if(s>0){let t=u-n;r=Math.min(e,r+t/1e9*s)}n=u}return{available(){return l(O()),r},tryConsume(u=1){if(u<=0)return!0;let t=O();return l(t),r>=u?(r-=u,!0):!1},putBack(u=1){u<=0||(l(O()),r=Math.min(e,r+u))}}}var D=class extends Error{name="RateLimiterOverflowError";constructor(s){super(`rateLimiter buffer overflow (maxBuffer=${s})`)}};function re(e,s){let{maxEvents:r,windowNs:n}=s;if(r<=0)throw new RangeError("maxEvents must be > 0");if(n<=0)throw new RangeError("windowNs must be > 0");let l=s.maxBuffer;if(l!==void 0&&l<1)throw new RangeError("maxBuffer must be >= 1");let u=s.onOverflow??"drop-newest",t=r*1e9/n;return g(o=>{let c=U(r,t),i=[],f=new E,a=!1,w=1e9/t;function N(){for(;i.length>0;)if(c.tryConsume(1))o.emit(i.shift());else{f.start(Math.max(1,w/1e6),N);return}}let x=e.subscribe(p=>{for(let m of p){if(a)return;let d=m[0];if(d===k)o.down([[k]]);else if(d===b){if(l!==void 0&&i.length>=l){if(u!=="drop-newest")if(u==="drop-oldest")i.shift(),i.push(m[1]);else{a=!0,f.cancel(),i.length=0,o.down([[T,new D(l)]]);return}}else i.push(m[1]);N()}else if(d===y)o.down([[y]]);else if(d===h)a=!0,f.cancel(),i.length=0,o.down([[h]]);else if(d===T)a=!0,f.cancel(),i.length=0,o.down([m]);else if(d===C){a=!0,f.cancel(),i.length=0,o.down([m]);return}else o.down([m])}});return()=>{a=!0,f.cancel(),x()}},{...S(),initial:e.cache})}function oe(e,s){let r=s?.initialStatus??"pending",n=P([],(l,u)=>{let t=r;return n.meta.status.down([[b,r]]),n.meta.error.down([[b,null]]),e.subscribe(c=>{for(let i of c){let f=i[0];if(f===k)u.down([[k]]);else if(f===b)t==="errored"?L(()=>{n.meta.error.down([[b,null]]),n.meta.status.down([[b,"active"]])}):n.meta.status.down([[b,"active"]]),t="active",u.emit(i[1]);else if(f===y)u.down([[y]]);else if(f===h)n.meta.status.down([[b,"completed"]]),t="completed",u.down([[h]]);else if(f===T){let a=M(i);L(()=>{n.meta.error.down([[b,a]]),n.meta.status.down([[b,"errored"]])}),t="errored",u.down([i])}else u.down([i])}})},{...S(),meta:{status:r,error:null},completeWhenDepsComplete:!1,resubscribable:!0,initial:e.cache});return{node:n,status:n.meta.status,error:n.meta.error}}var F=class extends Error{name="TimeoutError";constructor(s){super(`Timed out after ${s/1e6}ms`)}};function j(e){return e!=null&&typeof e=="object"&&"cache"in e&&typeof e.subscribe=="function"}function K(e){return e!=null&&typeof e.then=="function"}function $(e){return e!=null&&typeof e=="object"&&typeof e[Symbol.asyncIterator]=="function"}function ie(e,s){return g(r=>{let n,l;function u(){l?.(),l=void 0,j(s)||K(s)||$(s)?n=I(s).subscribe(o=>{r.down(o)}):(r.emit(s),r.down([[h]]))}return l=e.subscribe(t=>{for(let o of t){let c=o[0];if(c===k)r.down([[k]]);else if(c===b)r.emit(o[1]);else if(c===y)r.down([[y]]);else if(c===h)r.down([[h]]);else if(c===T){u();return}else if(c===C){n?.(),r.down([o]);return}else r.down([o])}}),()=>{l?.(),n?.()}},{...S(),initial:e.cache})}function se(e,s){if(s<=0)throw new RangeError("timeoutNs must be > 0");return g(r=>{let n=!1,l=new E;function u(){let o=s/1e6;l.start(o,()=>{n||(n=!0,t(),r.down([[T,new F(s)]]))})}let t=e.subscribe(o=>{for(let c of o){if(n)return;let i=c[0];if(i===k)r.down([[k]]);else if(i===b)u(),r.emit(c[1]);else if(i===y)r.down([[y]]);else if(i===h){l.cancel(),n=!0,r.down([[h]]);return}else if(i===T){l.cancel(),n=!0,r.down([c]);return}else if(i===C){l.cancel(),n=!0,r.down([c]);return}else r.down([c])}});return u(),()=>{n=!0,l.cancel(),t()}},{...S(),initial:e.cache})}export{Z as a,ee as b,A as c,te as d,ne as e,U as f,D as g,re as h,oe as i,F as j,ie as k,se as l};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var t=class{constructor(i){this.capacity=i;if(!Number.isInteger(i)||i<=0)throw new Error(`RingBuffer capacity must be a positive integer (got ${i})`);this.buf=new Array(i)}buf;head=0;_size=0;get size(){return this._size}get maxSize(){return this.capacity}push(i){let e=(this.head+this._size)%this.capacity;this.buf[e]=i,this._size<this.capacity?this._size++:this.head=(this.head+1)%this.capacity}shift(){if(this._size===0)return;let i=this.buf[this.head];return this.buf[this.head]=void 0,this.head=(this.head+1)%this.capacity,this._size--,i}at(i){if(this._size===0)return;let e=i<0?this._size+i:i;if(!(e<0||e>=this._size))return this.buf[(this.head+e)%this.capacity]}toArray(){let i=new Array(this._size);for(let e=0;e<this._size;e++)i[e]=this.buf[(this.head+e)%this.capacity];return i}clear(){for(let i=0;i<this._size;i++)this.buf[(this.head+i)%this.capacity]=void 0;this.head=0,this._size=0}};export{t as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{D as N,E as A,F as p,p as C}from"./chunk-7AJKUA36.js";import{b as v,c as S,d as x,i as T,j as b}from"./chunk-CK2E7BTU.js";function y(e,n,t){let u=new Set;for(let o of e.split(",")){let[r,i]=o.split("/"),s=i?Number.parseInt(i,10):1;if(Number.isNaN(s)||s<1)throw new Error(`Invalid cron step: ${o}`);let a,d;if(r==="*")a=n,d=t;else if(r.includes("-")){let[f,c]=r.split("-");a=Number.parseInt(f,10),d=Number.parseInt(c,10)}else a=Number.parseInt(r,10),d=a;if(Number.isNaN(a)||Number.isNaN(d))throw new Error(`Invalid cron field: ${e}`);if(a<n||d>t)throw new Error(`Cron field out of range: ${e} (${n}-${t})`);if(a>d)throw new Error(`Invalid cron range: ${a}-${d} in ${e}`);for(let f=a;f<=d;f+=s)u.add(f)}return u}function I(e){let n=e.trim().split(/\s+/);if(n.length!==5)throw new Error(`Invalid cron: expected 5 fields, got ${n.length}`);return{minutes:y(n[0],0,59),hours:y(n[1],0,23),daysOfMonth:y(n[2],1,31),months:y(n[3],1,12),daysOfWeek:y(n[4],0,6)}}function L(e,n){return e.minutes.has(n.getMinutes())&&e.hours.has(n.getHours())&&e.daysOfMonth.has(n.getDate())&&e.months.has(n.getMonth()+1)&&e.daysOfWeek.has(n.getDay())}function m(e){return{describeKind:"producer",...e}}function $(e){return/[\\^$+?.()|[\]{}]/.test(e)?`\\${e}`:e}function J(e){let n="^";for(let t=0;t<e.length;t+=1){let u=e[t];if(u==="*"){e[t+1]==="*"?(n+=".*",t+=1):n+="[^/]*";continue}n+=$(u)}return n+="$",new RegExp(n)}function Q(e,n){for(let t of n)if(t.test(e))return!0;return!1}function _(e,n){let t=N([e],(o,r)=>{let i=o[0];if(i==null||i.length===0){r.down([[x]]);return}for(let s of i)r.emit(s)},{describeKind:"derived",initial:e.cache}),u=t.subscribe.bind(t);return t.subscribe=(o,r)=>(n(o),u(o,r)),t}function X(e,n){let{signal:t,period:u,...o}=n??{};return p(r=>{let i=!1,s=0,a,d,f=()=>{i=!0,a!==void 0&&clearTimeout(a),d!==void 0&&clearInterval(d),t?.removeEventListener("abort",l)},c=()=>{i||(u!=null?(r.emit(s++),d=setInterval(()=>{i||r.emit(s++)},u)):(i=!0,t?.removeEventListener("abort",l),r.emit(s++),r.down([[T]])))},l=()=>{i||(f(),r.down([[b,t.reason]]))};if(t?.aborted){l();return}return a=setTimeout(c,e),t?.addEventListener("abort",l,{once:!0}),f},m(o))}function Z(e){let{signal:n,...t}=e??{};return p(u=>{let o=!1,r,i,s=!1,a=!1,d=typeof requestAnimationFrame=="function"?requestAnimationFrame:void 0,f=typeof cancelAnimationFrame=="function"?cancelAnimationFrame:void 0,c=typeof document<"u"?document:void 0,l=()=>{r!==void 0&&f&&f(r),i!==void 0&&clearTimeout(i),r=void 0,i=void 0},h=()=>{o=!0,l(),s&&(n?.removeEventListener("abort",w),s=!1),a&&c&&(c.removeEventListener("visibilitychange",O),a=!1)},w=()=>{o||(h(),u.down([[b,n.reason]]))},k=F=>{o||(u.emit(F),g())},g=()=>{o||(d&&(!c||c.visibilityState!=="hidden")?r=d(k):i=setTimeout(()=>k(performance.now()),16))},O=()=>{o||(l(),g())};return n?.aborted?(w(),h):(n?.addEventListener("abort",w,{once:!0}),s=n!==void 0,c&&d&&(c.addEventListener("visibilitychange",O),a=!0),g(),h)},m(t))}function ee(e,n){let t=I(e),{tickMs:u,output:o,...r}=n??{},i=u??6e4,s=o==="date";return p(a=>{let d=-1,f=()=>{let l=new Date,h=l.getFullYear()*1e8+(l.getMonth()+1)*1e6+l.getDate()*1e4+l.getHours()*100+l.getMinutes();h!==d&&L(t,l)&&(d=h,a.emit(s?l:C()))};f();let c=setInterval(f,i);return()=>clearInterval(c)},{...m(r),name:r.name??`cron:${e}`})}function ne(e,n,t){let{capture:u,passive:o,once:r,...i}=t??{};return p(s=>{let a=f=>{s.emit(f)},d={capture:u,passive:o,once:r};return e.addEventListener(n,a,d),()=>e.removeEventListener(n,a,d)},m(i))}function M(e,n){return p(t=>{let u=!1;try{for(let o of e){if(u)return;t.emit(o)}u||t.down([[T]])}catch(o){u||t.down([[b,o]])}return()=>{u=!0}},m(n))}function K(e){return e!=null&&typeof e.then=="function"}function W(e,n){let{signal:t,...u}=n??{};return p(o=>{let r=!1,i=()=>{r||(r=!0,o.down([[b,t.reason]]))};if(t?.aborted){i();return}return t?.addEventListener("abort",i,{once:!0}),Promise.resolve(e).then(s=>{r||(r=!0,t?.removeEventListener("abort",i),o.emit(s),o.down([[T]]))},s=>{r||(r=!0,t?.removeEventListener("abort",i),o.down([[b,s]]))}),()=>{r=!0,t?.removeEventListener("abort",i)}},m(u))}function q(e,n){let{signal:t,...u}=n??{};return p(o=>{let r=new AbortController,i=()=>r.abort(t?.reason);t?.aborted?r.abort(t.reason):t?.addEventListener("abort",i,{once:!0});let s=t??r.signal,a=!1,d=e[Symbol.asyncIterator](),f=()=>{a||s.aborted||Promise.resolve(d.next()).then(c=>{if(!(a||s.aborted)){if(c.done){o.down([[T]]);return}o.emit(c.value),f()}},c=>{!a&&!s.aborted&&o.down([[b,c]])})};return f(),()=>{a=!0,t?.removeEventListener("abort",i),r.abort(),Promise.resolve(d.return?.()).catch(()=>{})}},m(u))}function H(e){return e!=null&&typeof e=="object"&&"cache"in e&&typeof e.subscribe=="function"}function te(e,n){if(H(e))return e;if(K(e))return W(e,n);if(e!=null){let t=e;if(typeof t[Symbol.asyncIterator]=="function")return q(e,n);if(typeof t[Symbol.iterator]=="function")return M(e,n)}return U(e)}function U(...e){return M(e,void 0)}function re(e){return p(n=>{n.down([[T]])},m(e))}function oe(e){return p(()=>{},m(e))}function ie(e,n){return p(t=>{t.down([[b,e]])},m(n))}function se(e,n,t){return N([e],(o,r)=>{let i=o[0];if(i!=null&&i.length>0)for(let s of i)n(s)},{describeKind:"effect",...t}).subscribe(()=>{})}function ue(e,n){return N([e],(t,u,o)=>{o.store.buf||(o.store.buf=[]);let r=o.store.buf,i=t[0];if(i!=null&&i.length>0)for(let s of i)r.push(s);if(o.terminalDeps[0]===!0){u.emit([...r]),u.down([[T]]);return}(i==null||i.length===0)&&u.down([[x]])},{describeKind:"derived",completeWhenDepsComplete:!1,...n})}function ae(e,n){return p(t=>e.subscribe(u=>{t.down(u)}),{...m(n),initial:e.cache})}function D(e,n,t){if(n<1)throw new RangeError("replay expects bufferSize >= 1");let u=[],o=p(r=>e.subscribe(i=>{for(let s of i)s[0]===v&&(u.push(s[1]),u.length>n&&u.shift());r.down(i)}),{...m(t),initial:e.cache});return _(o,r=>{for(let i of u)r([[v,i]])})}function de(e,n){return D(e,1,n)}function fe(e){return new Promise((n,t)=>{let u=!1,o=!1,r;r=e.subscribe(i=>{for(let s of i){if(u)return;if(s[0]===v){u=!0,n(s[1]),r?(r(),r=void 0):o=!0;return}if(s[0]===b){u=!0,t(s[1]),r?(r(),r=void 0):o=!0;return}if(s[0]===T){u=!0,t(new Error("completed without DATA")),r?(r(),r=void 0):o=!0;return}}}),o&&(r?.(),r=void 0)})}function P(e,n,t){return new Promise((u,o)=>{let r=!1,i=!1,s,a=t?.skipCurrent===!0;s=e.subscribe(d=>{for(let f of d){if(r)return;if(!(a&&f[0]===v)){if(f[0]===v){let c=f[1];if(n(c)){r=!0,u(c),s?(s(),s=void 0):i=!0;return}}if(f[0]===b){r=!0,o(f[1]),s?(s(),s=void 0):i=!0;return}if(f[0]===T){r=!0,o(new Error("completed without matching value")),s?(s(),s=void 0):i=!0;return}}}}),a=!1,i&&(s?.(),s=void 0)})}var E,R;async function ce(e,n){let t=n?.predicate??(r=>r!=null),u=n?.skipCurrent;if(n?.timeoutMs==null||n.timeoutMs<=0)return await P(e,t,{skipCurrent:u});if(E===void 0){let[r,i]=await Promise.all([import("./resilience-IVNDYORD.js"),import("./backoff-HPZMEZNF.js")]);E=r.timeout,R=i.NS_PER_MS}let o=E(e,n.timeoutMs*R);return await P(o,t,{skipCurrent:u})}function le(e,n){let t=new AbortController,u=n?.reason??new Error("cancelled via nodeSignal"),o,r=!1,i=()=>{o?(o(),o=void 0):r=!0};return o=e.subscribe(s=>{if(!t.signal.aborted)for(let a of s){if(a[0]===v&&a[1]===!0){t.abort(u),i();return}if(a[0]===b){t.abort(a[1]),i();return}if(a[0]===T){i();return}}}),r&&(o?.(),o=void 0),{signal:t.signal,dispose:()=>{o&&(o(),o=void 0)}}}var pe=D;function me(e){return e.subscribe(()=>{})}function be(e){let n=A(0);return{node:n,increment(){let t=n.cache??0;return t>=e?!1:(n.down([[S],[v,t+1]]),!0)},get(){return n.cache??0},atCap(){return(n.cache??0)>=e}}}export{I as a,L as b,$ as c,J as d,Q as e,X as f,Z as g,ee as h,ne as i,M as j,W as k,q as l,te as m,U as n,re as o,oe as p,ie as q,se as r,ue as s,ae as t,D as u,de as v,fe as w,P as x,ce as y,le as z,pe as A,me as B,be as C};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{E as p,I as A,m as l}from"./chunk-
|
|
1
|
+
import{E as p,I as A,m as l}from"./chunk-7AJKUA36.js";import{b as c,j as N}from"./chunk-CK2E7BTU.js";import{b as x}from"./chunk-QYADASLV.js";var B={};x(B,{action:()=>M,atom:()=>S,computed:()=>k,getValue:()=>_,map:()=>R,onMount:()=>w,onStart:()=>v,onStop:()=>g});var T=new WeakMap,f=new WeakMap;function d(e,t){let o=t.get(e);if(o)for(let n of o)n()}function m(e,t={}){let o=0;return{...t,get:()=>b(e),subscribe:a=>{o===0&&d(e,T),o++;let r=e.subscribe(s=>{for(let[i,u]of s)i===c&&a(u)});return()=>{r(),o--,o===0&&d(e,f)}},listen:a=>{o===0&&d(e,T),o++;let r=!0,s=e.subscribe(i=>{for(let[u,C]of i)if(u===c){if(r){r=!1;continue}a(C)}});return()=>{s(),o--,o===0&&d(e,f)}},_node:e}}function y(e){let t=e.cache,o;if(e.subscribe(a=>{for(let[r,s]of a)r===c&&(t=s),r===N&&(o=s)})(),o)throw o;return t}function b(e){return e.status==="sentinel"?y(e):e.cache}function S(e){let t=p(e,{resubscribable:!0,resetOnTeardown:!0});return m(t,{set:o=>t.emit(o)})}function k(e,t){let o=Array.isArray(e)?e:[e],n=o.map(r=>r._node),a=A(n,r=>{let s=o.map(i=>{let u=i._node;return u.status==="sentinel"&&y(u),r(u)});return t(...s)},{resubscribable:!0,resetOnTeardown:!0,equals:Object.is});return m(a)}function R(e){let t=p(e,{resubscribable:!0,resetOnTeardown:!0,equals:()=>!1});return m(t,{set:o=>t.emit(o),setKey:(o,n)=>{let a=b(t);t.emit({...a,[o]:n})}})}function _(e){return e.get()}function v(e,t){let o=e._node,n=T.get(o);n||(n=new Set,T.set(o,n)),n.add(t)}function g(e,t){let o=e._node,n=f.get(o);n||(n=new Set,f.set(o,n)),n.add(t)}function w(e,t){v(e,()=>{let o=t();typeof o=="function"&&g(e,o)})}function M(e,t,o){return(...n)=>{let a;return l(()=>{a=o(...n)}),a}}export{S as a,k as b,R as c,_ as d,v as e,g as f,w as g,M as h,B as i};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{e as P}from"./chunk-
|
|
1
|
+
import{e as P}from"./chunk-YZ6VYLFD.js";import{c as S}from"./chunk-K54OKWNY.js";import{a as w}from"./chunk-7EQPXQ7H.js";import{b as _}from"./chunk-LWGLBCMU.js";import{j as O,l as R}from"./chunk-PSQNYY72.js";import{B as T}from"./chunk-UMH3HSP7.js";import{E as k,G as x,o as H}from"./chunk-7AJKUA36.js";import{b as M}from"./chunk-QYADASLV.js";var B={};M(B,{LensGraph:()=>C,graphLens:()=>N,watchTopologyTree:()=>w});function v(e){return S("lens",e)}function E(e){let t=Object.keys(e.nodes),o=new Map,n=new Map;for(let s of t){let a=e.nodes[s]?.deps??[];o.set(s,a);for(let h of a)n.has(h)||n.set(h,new Set),n.get(h).add(s)}let r=[],c=[];for(let s of t)(o.get(s)??[]).length===0&&r.push(s),n.has(s)||c.push(s);r.sort(),c.sort();let p=e.edges.length,f=0,m=1,g=2,d=new Map;for(let s of t)d.set(s,f);let y=!1,l=new Map,u=s=>{let a=d.get(s)??f;if(a===m)return y=!0,0;if(a===g)return l.get(s)??0;d.set(s,m);let h=0,b=n.get(s);if(b!=null)for(let F of b){let G=u(F);G+1>h&&(h=G+1)}return d.set(s,g),l.set(s,h),h},i=0;for(let s of r){let a=u(s);a>i&&(i=a)}for(let s of t)d.get(s)===f&&u(s);return{nodeCount:t.length,edgeCount:p,subgraphCount:e.subgraphs.length,sources:r,sinks:c,depth:i,hasCycles:y}}function $(e){let t=[];for(let[o,n]of Object.entries(e.nodes)){if(n.status!=="errored")continue;let r={path:o,status:"errored"},c=R(e,o,"upstream",{});for(let p of c)if(p!==o&&e.nodes[p]?.status==="errored"){r.upstreamCause=p;break}t.push(r)}return t.sort((o,n)=>o.path<n.path?-1:o.path>n.path?1:0),{ok:t.length===0,problems:t}}function q(e,t){return e.nodeCount===t.nodeCount&&e.edgeCount===t.edgeCount&&e.subgraphCount===t.subgraphCount&&e.depth===t.depth&&e.hasCycles===t.hasCycles&&D(e.sources,t.sources)&&D(e.sinks,t.sinks)}function L(e,t){if(e.ok!==t.ok||e.problems.length!==t.problems.length)return!1;for(let o=0;o<e.problems.length;o++){let n=e.problems[o],r=t.problems[o];if(n.path!==r.path||n.status!==r.status||n.upstreamCause!==r.upstreamCause)return!1}return!0}function D(e,t){if(e.length!==t.length)return!1;for(let o=0;o<e.length;o++)if(e[o]!==t[o])return!1;return!0}var C=class extends O{stats;health;flow;_target;constructor(t,o={}){super(o.name??`${t.name}_lens`,o.graph),this._target=t;let n=0,r=0,c=k(0,{name:"stats_tick"}),p=k(0,{name:"health_tick"});this.add(c,{name:"stats_tick"}),this.add(p,{name:"health_tick"});let f={name:"flow"};o.maxFlowPaths!=null&&(f.maxSize=o.maxFlowPaths),this.flow=_(f),this.add(this.flow.entries,{name:"flow"});let m=o.pathFilter,g=w(t,(l,u,i)=>{if(n+=1,c.emit(n),r+=1,p.emit(r),l.kind==="removed")if(l.nodeKind==="node"){let s=`${i}${l.name}`;this.flow.delete(s)}else{let s=`${i}${l.name}::`,a=[];for(let h of l.audit.nodes){let b=h===""?`${i}${l.name}`:`${s}${h}`;a.push(b)}a.length>0&&this.flow.deleteMany(a)}});this.addDisposer(g);let d=t.observe({timeline:!0,structured:!0}),y=d.onEvent(l=>{let u=l.type;if((u==="error"||u==="complete"||u==="data"||u==="teardown")&&(r+=1,p.emit(r)),u==="data"){let i=l.path??"";if(!i||m!=null&&!m(i))return;let s=this.flow.get(i),a=s!=null?s.count+1:1;this.flow.set(i,{path:i,count:a,lastUpdate_ns:H()})}});this.addDisposer(()=>{y(),d.dispose()}),this.stats=x([c],()=>E(t.describe({detail:"minimal"})),{name:"stats",describeKind:"derived",equals:q,meta:v("stats")}),this.add(this.stats,{name:"stats"}),this.addDisposer(T(this.stats)),this.health=x([p],()=>$(t.describe({detail:"standard"})),{name:"health",describeKind:"derived",equals:L,meta:v("health")}),this.add(this.health,{name:"health"}),this.addDisposer(T(this.health))}why(t,o,n){let r=P(this._target,t,o,n);return this.addDisposer(r.dispose),r}get target(){return this._target}};function N(e,t){return new C(e,t)}export{C as a,N as b,B as c};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as P}from"./chunk-4VVTGLXJ.js";import{m as y}from"./chunk-UMH3HSP7.js";import{D as N,F as w,G as W,o as k}from"./chunk-7AJKUA36.js";import{a as C,b as p,c as A,d as m,i as a,j as b}from"./chunk-CK2E7BTU.js";function c(d){return{describeKind:"derived",...d}}function B(d){return{describeKind:"derived",partial:!0,...d}}function Q(d,i,u){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(u))}function S(d,i,u){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(u))}function X(d,i,u,t){return N([d],(e,n,o)=>{"acc"in o.store||(o.store.acc=u);let r=e[0];if(r==null||r.length===0){n.down([[m]]);return}for(let s of r)o.store.acc=i(o.store.acc,s),n.emit(o.store.acc)},{...c(t),initial:u,resetOnTeardown:!0})}function Z(d,i,u,t){return N([d],(e,n,o)=>{if("acc"in o.store||(o.store.acc=u),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 s of r)o.store.acc=i(o.store.acc,s)},{...c(t),completeWhenDepsComplete:!1})}function M(d,i,u){return i<=0?N([d],(t,e,n)=>{n.store.completed||(n.store.completed=!0,e.down([[a]]))},{...c(u),completeWhenDepsComplete:!1}):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(u),completeWhenDepsComplete:!1})}function V(d,i,u){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 s of o)n.store.skipped++,n.store.skipped<=i||(e.emit(s),r=!0);r||e.down([[m]])},c(u))}function $(d,i,u){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(u),completeWhenDepsComplete:!1})}function ee(d,i,u){let t=u?.predicate??(o=>o[0]===p),{predicate:e,...n}=u??{};return w(o=>{let r=!1,s=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()=>{s(),f()}},c(n))}function ne(d,i){return M(d,1,i)}function te(d,i){let{defaultValue:u,...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(u),o.down([[a]]);return}let s=n[0];if(s==null||s.length===0){o.down([[m]]);return}r.store.latest=s.at(-1),r.store.has=!0},{...c(t),completeWhenDepsComplete:!1})}function oe(d,i,u){return M(S(d,i,u),1,u)}function re(d,i,u){return M(V(d,i,u),1,u)}function se(d,i,u){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(u));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 s of r)t.data?.(s),n.emit(s)},{...c(u),completeWhenDepsComplete:!1})}function K(d,i,u){let t=u?.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 s of r)!e&&t(s)&&(e=!0,i(s)),o.emit(s)},c(u))}var ie=K;function ue(d,i=Object.is,u){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 s of o)n.store.hasPrev&&i(n.store.prev,s)||(n.store.prev=s,n.store.hasPrev=!0,e.emit(s),r=!0);r||e.down([[m]])},c(u))}function fe(d,i){return N([d],(u,t,e)=>{let n=u[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 s=[e.store.prev,r];e.store.prev=r,t.emit(s),o=!0}o||t.down([[m]])},c(i))}function q(...d){let i=[...d];return W(i,u=>u,{...c(),equals:(u,t)=>{if(u.length!==t.length)return!1;for(let e=0;e<u.length;e++)if(!Object.is(u[e],t[e]))return!1;return!0}})}function de(d,i,u){return N([d,i],(t,e,n)=>{let o=t[0],r=t[1],s=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,s])}else e.down([[m]])},B(u))}function le(...d){return d.length===0?w(i=>{i.down([[a]])},c()):w(i=>{let u=d.length,t=0,e=[];for(let n of d){let o=n.subscribe(r=>{for(let s of r)s[0]===p?i.emit(s[1]):s[0]===a?(t+=1,t>=u&&i.down([[a]])):s[0]===b&&i.down([s])});e.push(o)}return()=>{for(let n of e)n()}},c())}function ae(...d){let i=d.length;return i===0?w(u=>{u.emit([]),u.down([[a]])},c()):w(u=>{let t=Array.from({length:i},()=>[]),e=i;function n(){for(;t.every(r=>r.length>0);){let r=t.map(s=>s.shift());u.emit(r)}}let o=[];for(let r=0;r<i;r++){let s=r,f=d[r].subscribe(l=>{for(let T of l)T[0]===p?(t[s].push(T[1]),n()):T[0]===a?(e-=1,(e===0||t[s].length===0)&&u.down([[a]])):T[0]===b&&u.down([T])});o.push(f)}return()=>{for(let r of o)r()}},c())}function ce(d,i,u){return w(t=>{let e=0,n=[],o,r;return r=i.subscribe(s=>{for(let f of s)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(s=>{for(let f of s)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(u))}function Te(...d){return d.length===0?w(i=>{i.down([[a]])},c()):d.length===1?N([d[0]],(i,u)=>{let t=i[0];if(t==null||t.length===0){u.down([[m]]);return}for(let e of t)u.emit(e)},c()):w(i=>{let u=null,t=[];for(let e=0;e<d.length;e++){let n=e,o=d[e].subscribe(r=>{for(let s of r){if(u!==null&&n!==u)return;s[0]===p?(u===null&&(u=n),i.emit(s[1])):(s[0]===a||s[0]===b)&&(u===null||n===u)&&i.down([s])}});t.push(o)}return()=>{for(let e of t)e()}},c())}function I(d,i,u){let t,e=!1,n=()=>{e||(e=!0,u())};return t=d.subscribe(o=>{let r=!1,s=!1;for(let f of o)f[0]!==C&&(f[0]===p?i.emit(f[1]):f[0]===a?r=!0:f[0]===b?(s=!0,i.down([f])):(f[0]===A||f[0]===m)&&i.down([f]));s?(t?.(),t=void 0,n()):r&&n()}),()=>{t?.(),t=void 0}}function pe(d,i,u){let t,e=!1;function n(){t?.(),t=void 0}return N([d],(o,r,s)=>{if(s.terminalDeps[0]!=null&&s.terminalDeps[0]!==!0){n();return}if(s.terminalDeps[0]===!0){e=!0,t||r.down([[a]]);return}let f=o[0];if(!(f==null||f.length===0))return n(),t=I(y(i(f[f.length-1])),r,()=>{n(),e&&r.down([[a]])}),{deactivate:()=>{n(),e=!1}}},{...c(u),completeWhenDepsComplete:!1})}function me(d,i,u){let t,e=!1;function n(){t?.(),t=void 0}return N([d],(o,r,s)=>{if(s.terminalDeps[0]!=null&&s.terminalDeps[0]!==!0){n();return}if(s.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(y(i(f[0])),r,()=>{n(),e&&r.down([[a]])}):r.down([[m]]),{deactivate:()=>{n(),e=!1}}},{...c(u),completeWhenDepsComplete:!1})}function be(d,i,u){let{maxBuffer:t,...e}=u??{},n=[],o,r=!1,s;function f(){o?.(),o=void 0}function l(){if(!s||o!==void 0)return;if(n.length===0){r&&s.down([[a]]);return}let h=n.shift();o=I(y(i(h)),s,()=>{f(),l()})}function T(h){t&&t>0&&n.length>=t&&n.shift(),n.push(h),l()}return N([d],(h,O,x)=>{if(s=O,x.terminalDeps[0]!=null&&x.terminalDeps[0]!==!0){f(),n.length=0;return}if(x.terminalDeps[0]===!0){r=!0,l();return}let E=h[0];if(!(E==null||E.length===0)){for(let v of E)T(v);return{deactivate:()=>{f(),n.length=0,r=!1}}}},{...c(e),completeWhenDepsComplete:!1})}function _(d,i,u){let{concurrent:t,...e}=u??{},n=t!=null&&t>0?t:Number.POSITIVE_INFINITY,o=0,r=!1,s=new Set,f=[],l;function T(){r&&o===0&&f.length===0&&l&&l.down([[a]])}function h(v){if(!l)return;o++;let g;g=I(y(i(v)),l,()=>{g&&s.delete(g),o--,O(),T()}),s.add(g)}function O(){for(;f.length>0&&o<n;)h(f.shift())}function x(v){o<n?h(v):f.push(v)}function E(){for(let v of s)v();s.clear(),o=0,f.length=0}return N([d],(v,g,D)=>{if(l=g,D.terminalDeps[0]!=null&&D.terminalDeps[0]!==!0){E();return}if(D.terminalDeps[0]===!0){r=!0,T();return}let R=v[0];if(!(R==null||R.length===0)){for(let U of R)x(U);return{deactivate:()=>{E(),r=!1}}}},{...c(e),completeWhenDepsComplete:!1})}var we=_;function Ne(d,i,u){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 s of r)if(s[0]===p){let f=setTimeout(()=>{e.delete(f),t.emit(s[1])},i);e.add(f)}else if(s[0]===a){let f=setTimeout(()=>{e.delete(f),t.down([[a]])},i);e.add(f)}else s[0]===b&&(n(),t.down([s]))});return()=>{o(),n()}},c(u))}function j(d,i,u){return w(t=>{let e,n;function o(){e!==void 0&&(clearTimeout(e),e=void 0)}let r=d.subscribe(s=>{for(let f of s)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(u))}function F(d,i,u){let{leading:t,trailing:e,...n}=u??{},o=t!==!1,r=e===!0,s=i*1e6;return w(f=>{let l,T=-1/0,h,O=!1;function x(){l!==void 0&&(clearTimeout(l),l=void 0)}let E=d.subscribe(v=>{for(let g of v)if(g[0]===p){let D=g[1],R=k();if(o&&R-T>=s)T=R,f.emit(D),x(),r&&(l=setTimeout(()=>{l=void 0,O&&(T=k(),f.emit(h),O=!1)},i));else if(r&&(h=D,O=!0,l===void 0)){let U=(R-T)/1e6;l=setTimeout(()=>{l=void 0,O&&(T=k(),f.emit(h),O=!1)},Math.max(0,i-U))}}else(g[0]===a||g[0]===b)&&(x(),f.down([g]))});return()=>{E(),x()}},c(n))}function he(d,i,u){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)}}),s=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(),s()}},c(u))}function ve(d,i,u){return w(t=>{let e,n,o=!1;function r(){e!==void 0&&(clearTimeout(e),e=void 0)}let s=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()=>{s(),r()}},c(u))}function ge(d,i,u){let{with:t,...e}=u??{},n=t??new Error("timeout");return w(o=>{let r;function s(){clearTimeout(r),r=setTimeout(()=>{r=void 0,o.down([[b,n]])},i)}s();let f=d.subscribe(l=>{for(let T of l)T[0]===p?(s(),o.emit(T[1])):(T[0]===a||T[0]===b)&&(clearTimeout(r),o.down([T]))});return()=>{f(),clearTimeout(r)}},c(e))}function Oe(d,i,u){return w(t=>{let e=[],n=d.subscribe(r=>{for(let s of r)s[0]===p?e.push(s[1]):s[0]===a?(e.length>0&&t.emit([...e]),e.length=0,t.down([[a]])):s[0]===b&&t.down([s])}),o=i.subscribe(r=>{for(let s of r)s[0]===p?e.length>0&&(t.emit([...e]),e.length=0):s[0]===a?t.down([[a]]):s[0]===b&&t.down([s])});return()=>{n(),o(),e.length=0}},c(u))}function xe(d,i,u){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(u))}function Ee(d,i,u){if(i<=0)throw new RangeError("windowCount expects count > 0");return w(t=>{let e,n=0;function o(){let s=w(f=>(e=f.down.bind(f),()=>{e=void 0}),c());n=0,t.emit(s)}let r=d.subscribe(s=>{for(let f of s)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(u))}function Re(d,i,u){return w(t=>{let e=[],n=setInterval(()=>{e.length>0&&(t.emit([...e]),e.length=0)},i),o=d.subscribe(r=>{for(let s of r)s[0]===p?e.push(s[1]):s[0]===a?(clearInterval(n),e.length>0&&t.emit([...e]),e.length=0,t.down([[a]])):s[0]===b&&(clearInterval(n),t.down([s]))});return()=>{o(),clearInterval(n),e.length=0}},c(u))}function De(d,i,u){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),s=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()=>{s(),clearInterval(r),n()}},c(u))}function ye(d,i,u){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]))}),s=i.subscribe(f=>{for(let l of f)l[0]===p&&(n(),o())});return()=>{r(),s(),n()}},c(u))}function ke(d,i){return w((u,t)=>{"n"in t.store||(t.store.n=0);let e=setInterval(()=>{u.emit(t.store.n),t.store.n=t.store.n+1},d);return()=>clearInterval(e)},c(i))}function Ie(d,i,u){if(i<=0)throw new RangeError("repeat expects count > 0");return w(t=>{let e=i,n,o=()=>{n?.(),n=d.subscribe(r=>{let s=!1,f=[];for(let l of r)l[0]===a?s=!0:f.push(l);f.length>0&&t.down(f),s&&(n?.(),n=void 0,e-=1,e>0?o():t.down([[a]]))})};return o(),()=>{n?.()}},c(u))}function Ue(d,i){return N([d],(u,t)=>{let e=u[0];if(e==null||e.length===0){t.down([[m]]);return}for(let n of e)t.emit(n)},c(i))}function L(d,i,u){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(u))}function Me(d,i,u){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 s=t[0];if(s!=null&&s.length>0){for(let f of s)e.emit(f);return}if(o!=null&&o.length>0&&n.prevData[0]!==void 0){e.emit(n.prevData[0]);return}e.down([[m]])},B(u))}var Ce=q,Ae=j,We=F,Pe=L;export{Q as a,S as b,X as c,Z as d,M as e,V as f,$ as g,ee as h,ne as i,te as j,oe as k,re as l,se as m,K as n,ie as o,ue as p,fe as q,q as r,de as s,le as t,ae as u,ce as v,Te as w,pe as x,me as y,be as z,_ as A,we as B,Ne as C,j as D,F as E,he as F,ve as G,ge as H,Oe as I,xe as J,Ee as K,Re as L,De as M,ye as N,ke as O,Ie as P,Ue as Q,L as R,Me as S,Ce as T,Ae as U,We as V,Pe as W};
|
|
@@ -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-XEFAMCEA.js";import{h as b,j as x}from"./chunk-PSQNYY72.js";import{p as _}from"./chunk-7AJKUA36.js";import{b as $,d as T,i as v,j as N}from"./chunk-CK2E7BTU.js";import{b as K}from"./chunk-QYADASLV.js";var Y={};K(Y,{SNAPSHOT_WIRE_VERSION:()=>k,SurfaceError:()=>o,asSurfaceError:()=>D,createGraph:()=>R,deleteSnapshot:()=>H,diffSnapshots:()=>W,listSnapshots:()=>L,restoreSnapshot:()=>V,runReduction:()=>M,saveSnapshot:()=>U});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 D(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(`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as me}from"./chunk-
|
|
1
|
+
import{a as me}from"./chunk-4KAUNEKV.js";import{u as Q}from"./chunk-ASDKRNOJ.js";import{a as pe}from"./chunk-OKQUPJRY.js";import{e as fe}from"./chunk-5LJAQTSS.js";import{a as M}from"./chunk-EBQ6FXKW.js";import{b as J,d as K}from"./chunk-K54OKWNY.js";import{b as de}from"./chunk-LWGLBCMU.js";import{f as le,j as Y}from"./chunk-PSQNYY72.js";import{b as A,s as G,t as ce,x as $}from"./chunk-WQ7I7JVU.js";import{m as ue}from"./chunk-UMH3HSP7.js";import{D as ie,E as b,G as k,H as C,o as L}from"./chunk-7AJKUA36.js";import{b as Ie}from"./chunk-QYADASLV.js";var Ye={};Ie(Ye,{DEFAULT_DECAY_RATE:()=>X,DEFAULT_QUEUE_CONFIGS:()=>Z,DEFAULT_SEVERITY_WEIGHTS:()=>z,HarnessGraph:()=>U,QUEUE_NAMES:()=>N,affectedTaskFilter:()=>Oe,beforeAfterCompare:()=>we,codeChangeBridge:()=>Ce,createIntakeBridge:()=>be,defaultErrorClassifier:()=>W,defaultLlmExecutor:()=>ge,defaultLlmVerifier:()=>ye,evalIntakeBridge:()=>Ne,evalSource:()=>Se,evalVerifier:()=>Le,harnessLoop:()=>Fe,harnessProfile:()=>De,harnessTrace:()=>Be,notifyEffect:()=>_e,priorityScore:()=>Ge,refineExecutor:()=>Qe,strategyKey:()=>P,strategyModel:()=>ee});function be(t,e,r,n){return C([t],([a])=>{if(a==null)return;let d=r(a);for(let i of d)e.publish(i)},{name:n?.name??"intake-bridge"})}function Ne(t,e,r){let n=r?.defaultSeverity??"medium";return C([t],([a])=>{if(a==null)return;let d=Array.isArray(a)?a:[a];for(let i of d)for(let o of i.tasks)if(!(o.valid&&o.judge_scores?.every(s=>s.pass))){if(!o.valid&&(!o.judge_scores||o.judge_scores.length===0)){e.publish({source:"eval",summary:`Task ${o.task_id} invalid (model: ${i.model})`,evidence:`Run ${i.run_id}: task produced invalid output`,affectsAreas:["graphspec"],affectsEvalTasks:[o.task_id],severity:n});continue}if(o.judge_scores)for(let s of o.judge_scores)s.pass||e.publish({source:"eval",summary:`${o.task_id}: ${s.claim} (model: ${i.model})`,evidence:s.reasoning,affectsAreas:["graphspec"],affectsEvalTasks:[o.task_id],severity:n})}},{name:r?.name??"eval-intake-bridge"})}function Se(t,e){return $(t,()=>ue(e()))}function we(t,e){return k([t,e],([r,n])=>{let a=r,d=n,i=new Map(a.tasks.map(c=>[c.task_id,c])),o=new Map(d.tasks.map(c=>[c.task_id,c])),s=new Set([...i.keys(),...o.keys()]),u=[],f=[],l=[];for(let c of s){let m=i.get(c),I=o.get(c),g=m?.valid??!1,E=I?.valid??!1,T=m?.judge_scores?m.judge_scores.filter(j=>j.pass).length:void 0,h=I?.judge_scores?I.judge_scores.filter(j=>j.pass).length:void 0,S=T!==void 0&&h!==void 0?h-T:void 0;u.push({taskId:c,before:g,after:E,scoreDiff:S}),g&&!E&&f.push(c),!g&&E&&l.push(c)}return{newFailures:f,resolved:l,taskDeltas:u,overallImproved:l.length>f.length}},{name:"eval-delta"})}function Oe(t,e){let r=e==null?null:Array.isArray(e)?b(e):e,n=[t];return r&&n.push(r),k(n,a=>{let d=a[0],i=r?new Set(a[1]):null,o=new Set;for(let s of d)for(let u of s.affectsEvalTasks??[])(i==null||i.has(u))&&o.add(u);return[...o].sort()},{name:"affected-task-filter"})}function Ce(t,e,r,n){let a=n?.defaultSeverity??"high";function d(o){let s=[];for(let u of o.lintErrors??[])s.push({source:"code-change",summary:`Lint: ${u.rule} in ${u.file}:${u.line}`,evidence:u.message,affectsAreas:[u.file],severity:a});for(let u of o.testFailures??[])s.push({source:"test",summary:`Test failure: ${u.testId}`,evidence:u.message,affectsAreas:[u.file],affectsEvalTasks:[u.testId],severity:a});return s}let i=r??d;return C([t],([o])=>{if(o!=null)for(let s of i(o))e.publish(s)},{name:n?.name??"code-change-bridge"})}function _e(t,e,r){return C([t.latest],([n])=>{n!=null&&e(n)},{name:r?.name??"notify-effect"})}function Ae(t){if(t.length===0)return Number.NEGATIVE_INFINITY;let e=0;for(let r of t)e+=r.score;return e/t.length}function $e(t){let{passCount:e,total:r,meanScore:n,threshold:a,missingArtifact:d}=t,i=Number.isFinite(n)?n.toFixed(3):String(n),o=!d&&r>0&&n>=a,s=d?["EXECUTE stage did not emit an artifact; cannot verify reactively"]:o?[`${e}/${r} eval tasks passed; mean score ${i} \u2265 ${a}`]:r===0?["No eval tasks were selected for this item \u2014 cannot verify"]:[`${e}/${r} eval tasks passed; mean score ${i} < threshold ${a}`];return o?{verified:!0,findings:s}:{verified:!1,findings:s,errorClass:"structural"}}function Ve(t){return t.artifact}function Le(t){let e=t.name??"eval-verifier",r=t.threshold??.5,n=t.toOutput??$e,a=t.extractArtifact??Ve;return d=>{let i=A(d,s=>s!=null&&s[0]!=null&&s[1]!=null),o=$(i,([s,u])=>{let f=a(s,u);if(f==null)return b(n({scores:[],meanScore:Number.NEGATIVE_INFINITY,passCount:0,total:0,threshold:r,missingArtifact:!0}));let l=b([f],{name:`${e}/candidates`}),c=b(t.datasetFor(u),{name:`${e}/dataset`}),m=t.evaluator(l,c);return k([m],([I])=>{let g=I;if(g==null)return null;let E=Ae(g),T=g.filter(h=>h.score>=r).length;return n({scores:g,meanScore:E,passCount:T,total:g.length,threshold:r})},{name:`${e}/output`})},{name:e});return A(o,s=>s!=null)}}var N=["auto-fix","needs-decision","investigation","backlog"];function P(t,e){return`${t}\u2192${e}`}function W(t){let e=t.detail.toLowerCase();return e.includes("parse")||e.includes("json")||e.includes("config")||e.includes("validation")||e.includes("syntax")?"self-correctable":"structural"}var z={critical:100,high:70,medium:40,low:10},X=Math.LN2/(168*3600),Z={"auto-fix":{gated:!1},"needs-decision":{gated:!0},investigation:{gated:!0},backlog:{gated:!1,startOpen:!1}};function ee(){let t=de({name:"strategy-entries"}),e=k([t.entries],([i])=>{let o=i;return new Map(o)},{name:"strategy-model",equals:(i,o)=>{let s=i,u=o;if(s.size!==u.size)return!1;for(let[f,l]of s){let c=u.get(f);if(!c||l.attempts!==c.attempts||l.successes!==c.successes)return!1}return!0}});function r(i,o,s){let u=P(i,o),f=t.get(u),l=(f?.attempts??0)+1,c=(f?.successes??0)+(s?1:0);t.set(u,{rootCause:i,intervention:o,attempts:l,successes:c,successRate:c/l})}function n(i,o){return t.get(P(i,o))}let a=e.subscribe(()=>{});function d(){a()}return{node:e,record:r,lookup:n,dispose:d}}function Ge(t,e,r,n,a){let d={...z,...a?.severityWeights},i=a?.decayRate??X,o=a?.effectivenessThreshold??.7,s=a?.effectivenessBoost??15,u=[t,e,r];return n&&u.push(n),k(u,f=>{let l=f[0],c=f[1],m=f[2],I=n?f[3]:0,g=d[l.severity??"medium"],E=(L()-m)/1e9,T=pe(g,E,i,0),h=P(l.rootCause,l.intervention),S=c.get(h);return S&&S.successRate>=o&&(T+=s),T+=I*20,T},{name:"priority-score"})}var Me=`You are a triage classifier for a reactive collaboration harness.
|
|
2
2
|
|
|
3
3
|
Given an intake item, classify it and output JSON:
|
|
4
4
|
{
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{b as q}from"./chunk-
|
|
1
|
+
import{b as q}from"./chunk-JMGGCSIC.js";import{g as W,j as D}from"./chunk-PSQNYY72.js";import{E as M,F as A,G as L,H as T}from"./chunk-7AJKUA36.js";import{b as Q}from"./chunk-QYADASLV.js";var ie={};Q(ie,{compileSpec:()=>ne,decompileGraph:()=>se,extractFnFactory:()=>z,extractSourceFactory:()=>U,generateCatalogPrompt:()=>V,isRichFnEntry:()=>_,isRichSourceEntry:()=>J,llmCompose:()=>ae,llmRefine:()=>H,specDiff:()=>re,validateSpec:()=>E,validateSpecAgainstCatalog:()=>I});function _(a){return typeof a=="object"&&a!==null&&"factory"in a}function J(a){return typeof a=="object"&&a!==null&&"factory"in a}function z(a){return _(a)?a.factory:a}function U(a){return J(a)?a.factory:a}function V(a){let o=[];if(a.fns){let n=new Map;for(let[p,i]of Object.entries(a.fns)){let l=_(i)?i.tags?.[0]??"Other":"Other";n.has(l)||n.set(l,[]),n.get(l).push(X(p,i))}for(let[p,i]of n)o.push(`${p}:
|
|
2
2
|
${i.join(`
|
|
3
3
|
`)}`)}if(a.sources){let n=[];for(let[p,i]of Object.entries(a.sources))n.push(Z(p,i));n.length>0&&o.push(`Sources:
|
|
4
4
|
${n.join(`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{E as S,G as g,m as x}from"./chunk-
|
|
1
|
+
import{E as S,G as g,m as x}from"./chunk-7AJKUA36.js";import{b as z,c as w}from"./chunk-CK2E7BTU.js";var p=class{_version=0;_maxSize;_buf;_head=0;_size=0;constructor(n,i){if(i!==void 0&&i<1)throw new RangeError("maxSize must be >= 1");if(this._maxSize=i,i!==void 0){if(this._buf=new Array(i),n&&n.length>0){let r=Math.min(n.length,i),h=n.length-r;for(let l=0;l<r;l++)this._buf[l]=n[h+l];this._size=r}}else this._buf=n?[...n]:[],this._size=this._buf.length}get version(){return this._version}get size(){return this._size}at(n){if(!Number.isInteger(n))return;let i=n>=0?n:this._size+n;if(!(i<0||i>=this._size))return this._maxSize!==void 0?this._buf[(this._head+i)%this._maxSize]:this._buf[i]}append(n){this._rawAppend(n),this._version+=1}appendMany(n){if(n.length===0)return;let i=this._maxSize!==void 0&&n.length>this._maxSize?n.length-this._maxSize:0;for(let r=i;r<n.length;r++)this._rawAppend(n[r]);this._version+=1}clear(){if(this._size===0)return 0;let n=this._size;if(this._maxSize===void 0)this._buf.length=0;else for(let i=0;i<n;i++)this._buf[(this._head+i)%this._maxSize]=void 0;return this._head=0,this._size=0,this._version+=1,n}trimHead(n){if(!Number.isInteger(n)||n<0)throw new RangeError(`trimHead: n must be a non-negative integer (got ${n})`);if(n===0||this._size===0)return 0;let i=Math.min(n,this._size);if(this._maxSize===void 0)this._buf.splice(0,i);else{for(let r=0;r<i;r++)this._buf[(this._head+r)%this._maxSize]=void 0;this._head=(this._head+i)%this._maxSize}return this._size-=i,this._version+=1,i}slice(n,i){if(!Number.isInteger(n)||n<0)throw new RangeError(`slice: start must be a non-negative integer (got ${n})`);if(i!==void 0&&(!Number.isInteger(i)||i<0))throw new RangeError(`slice: stop must be a non-negative integer or undefined (got ${i})`);let r=i===void 0?this._size:Math.min(Math.max(i,0),this._size),h=Math.min(n,this._size);if(h>=r)return[];let l=r-h;if(this._maxSize===void 0)return this._buf.slice(h,r);let s=new Array(l);for(let u=0;u<l;u++)s[u]=this._buf[(this._head+h+u)%this._maxSize];return s}tail(n){if(!Number.isInteger(n)||n<0)throw new RangeError(`tail: n must be a non-negative integer (got ${n})`);if(n===0||this._size===0)return[];let i=Math.min(n,this._size);return this.slice(this._size-i,this._size)}toArray(){if(this._maxSize===void 0)return[...this._buf];let n=new Array(this._size);for(let i=0;i<this._size;i++)n[i]=this._buf[(this._head+i)%this._maxSize];return n}_rawAppend(n){if(this._maxSize===void 0){this._buf.push(n),this._size=this._buf.length;return}this._size<this._maxSize?(this._buf[(this._head+this._size)%this._maxSize]=n,this._size+=1):(this._buf[this._head]=n,this._head=(this._head+1)%this._maxSize)}};function A(_){return _.subscribe(()=>{})}var E=64;function L(_,n={}){let{name:i,maxSize:r,versioning:h,backend:l}=n,s=l??new p(_,r),u=S(s.toArray(),{name:i,describeKind:"state",equals:(e,t)=>e===t,...h!=null?{versioning:h}:{}});function M(){let e=s.toArray();x(()=>{u.down([[w]]),u.down([[z,e]])})}let d=new Map,a=new Map;function v(e,t){return`${e}:${t===void 0?"END":t}`}function y(e){if(e.size<E)return;let t=e.keys().next();if(t.done)return;let o=e.get(t.value);o!==void 0&&o.dispose(),e.delete(t.value)}function b(e){let t=s.version;try{return e()}finally{s.version!==t&&M()}}return{entries:u,get size(){return s.size},at(e){return s.at(e)},append(e){b(()=>s.append(e))},appendMany(e){e.length!==0&&b(()=>s.appendMany(e))},clear(){b(()=>s.clear())},trimHead(e){b(()=>s.trimHead(e))},tail(e){if(!Number.isInteger(e)||e<0)throw new RangeError(`tail: n must be a non-negative integer (got ${e})`);let t=d.get(e);if(t!==void 0)return d.delete(e),d.set(e,t),t.node;y(d);let o=g([u],([m])=>{let c=m;return e===0||c.length===0?[]:c.slice(Math.max(0,c.length-e))},{initial:s.tail(e),describeKind:"derived"}),f=A(o);return d.set(e,{node:o,dispose:f}),o},slice(e,t){if(!Number.isInteger(e)||e<0)throw new RangeError(`slice: start must be a non-negative integer (got ${e})`);if(t!==void 0&&(!Number.isInteger(t)||t<0))throw new RangeError(`slice: stop must be a non-negative integer or undefined (got ${t})`);let o=v(e,t),f=a.get(o);if(f!==void 0)return a.delete(o),a.set(o,f),f.node;y(a);let m=g([u],([k])=>{let T=k;return t===void 0?T.slice(e):T.slice(e,t)},{initial:s.slice(e,t),describeKind:"derived"}),c=A(m);return a.set(o,{node:m,dispose:c}),m},disposeTail(e){let t=d.get(e);return t===void 0?!1:(t.dispose(),d.delete(e),!0)},disposeSlice(e,t){let o=v(e,t),f=a.get(o);return f===void 0?!1:(f.dispose(),a.delete(o),!0)},disposeAllViews(){for(let e of d.values())e.dispose();d.clear();for(let e of a.values())e.dispose();a.clear()},dispose(){for(let e of d.values())e.dispose();d.clear();for(let e of a.values())e.dispose();a.clear()}}}export{p as a,L as b};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import{b as Ne,i as Re}from"./chunk-RWGJQQLT.js";import{a as Pe}from"./chunk-SGS4OJGS.js";import{x as fe}from"./chunk-WQ7I7JVU.js";import{a as Z,b as de,i as Oe}from"./chunk-4VVTGLXJ.js";import{f as pe}from"./chunk-UMH3HSP7.js";import{A as ee,D as be,E as U,F as B,m as _,p as D}from"./chunk-7AJKUA36.js";import{b as E,c as ye,d as ke,h as le,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=[],l=()=>{let d=u;u=void 0;try{d?.()}catch{}};for(let d of n){let p=i?.name?`${i.name}::${d}`:d,g=i?.channelOpts?.[d],y=B(T=>(o++,()=>{t++,o>0&&t>=o&&t>=n.length&&l()}),Ce({...g,name:p}));e[d]=y,a.push(y)}let m={};for(let d of n)m[d]=p=>{s&&e[d].down([[E,p]])};m.error=d=>{s&&(s=!1,_(()=>{for(let p of a)p.down([[x,d]])}),l())},m.complete=()=>{s&&(s=!1,_(()=>{for(let d of a)d.down([[P]])}),l())};let f=r(m);return u=typeof f=="function"?f:void 0,Object.assign(e,{dispose:()=>{s&&(s=!1,_(()=>{for(let d of a)try{d.down([[P]])}catch{}}),l())}})}var he=class{ring;arr;constructor(n){n===Number.POSITIVE_INFINITY||n<=0?(this.arr=[],this.ring=null):(this.ring=new Pe(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:l,onUpstreamMessage:m,onDispose:f,send:c,sendBatch:d,ctx:p}=n;if(!c&&!d)throw new Error("reactiveSink: `send` or `sendBatch` must be provided");let g=p,y=Math.max(1,u?.maxAttempts??1),T=De(u?.backoff??(y>1?"exponential":void 0)),h=u?.shouldRetry??(()=>!0),b=d!==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,G=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,J=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,$=Math.max(1,Math.ceil(H/1e6));return new Promise(M=>{setTimeout(()=>M(k()),$)})},W=k=>k!=null&&typeof k=="object"&&typeof k.then=="function",V=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($,C,R)},H=()=>{Q(-1),v.down([[E,k]])};function $(){C+=1,Q(1);let M;try{M=c(N,g)}catch(R){return A(R)??Promise.resolve()}return W(M)?M.then(H,R=>A(R)):(H(),Promise.resolve())}return $()},te=o?.maxBuffer??Number.POSITIVE_INFINITY,X=new he(te),Y,ae=!1,me=()=>{K?.down([[E,X.length]])},ue=k=>{G&&G.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($,N,R)},H=()=>{Q(-1);for(let{value:M}of k)v.down([[E,M]])};function $(){N+=1,Q(1);let M;try{M=d(C,g)}catch(R){return A(R)??Promise.resolve()}return W(M)?M.then(H,R=>A(R)):(H(),Promise.resolve())}return $()},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($,C,R)},H=()=>{Q(-1),v.down([[E,k]])};function $(){C+=1,Q(1);let M;try{M=c(N,g)}catch(R){return A(R)??Promise.resolve()}return W(M)?M.then(H,R=>A(R)):(H(),Promise.resolve())}return $()},ne=()=>{if(ae||X.length===0)return Promise.resolve();let k=X.drain();if(me(),ue(!1),d!==void 0){let C=Fe(k);return J(C),C}let N=He(k);return J(N),N},qe=()=>{Y!==void 0||ae||e<=0||(Y=setTimeout(()=>{Y=void 0,ne()},e))},Ue=r.subscribe(k=>{for(let N of k){let C=N[0];if(C!==E)try{m?.(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=V(A);J(H)}}else ee.messageTier(C)>=3&&b&&(Y!==void 0&&(clearTimeout(Y),Y=void 0),ne())}}),Se;if(l){let k=!1;Se=l.subscribe(N=>{if(!k){k=!0;return}N.length>0&&!Te&&Ee()})}let Te=!1,Ee=()=>{if(Te)return;Te=!0,Y!==void 0&&(clearTimeout(Y),Y=void 0),b&&ne(),ae=!0,Se?.(),Ue();let k=N=>{try{N.down([[le]])}catch{}};k(F),k(S),k(v),k(L),K&&k(K),G&&k(G);try{f?.()}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))}),G&&(ce.paused=G),ce}function j(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?.()},l=T=>{t&&(t=!1,o.down([T]),a())},m=(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){l([x,b])}},f=T=>{l([x,T])},c=()=>{l([P])};if(typeof r=="function"){try{if(e=r(m,f,c),typeof e!="function")throw new Error("fromWebSocket register contract violation: register must return cleanup callable")}catch(T){l([x,T])}return()=>{t=!1,a()}}let d=r,p=T=>m(T,T),g=T=>f(T),y=()=>c();return d.addEventListener("message",p),d.addEventListener("error",g),d.addEventListener("close",y),e=()=>{d.removeEventListener("message",p),d.removeEventListener("error",g),d.removeEventListener("close",y),s&&d.close()},()=>{t=!1,a()}},j(u))}function Tr(r,n){return oe(r,n)}function We(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:l=!1,...m}=n??{},f=U(0,{name:`${m.name??"http"}/fetchCount`}),c=U(0,{name:`${m.name??"http"}/lastUpdated`}),d=U(!1,{name:`${m.name??"http"}/fetched`}),p=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&&(_(()=>{p+=1,f.down([[E,p]]),c.down([[E,D()]]),d.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)}),{...j(m),resubscribable:l});return{...Re(T),fetchCount:f,lastUpdated:c,fetched:d}}function gr(r,n,i){let{method:s="POST",headers:u={"Content-Type":"application/json"},serialize:o=p=>JSON.stringify(p),timeoutNs:t,batchFormat:e="json-array",batchSize:a,flushIntervalMs:l,retry:m,onTransportError:f}=i??{},c=async p=>{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:p,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||l!==void 0?z(r,{onTransportError:f,retry:m,batchSize:a,flushIntervalMs:l,sendBatch:async p=>{let g;e==="ndjson"?g=p.map(y=>{let T=o(y);return typeof T=="string"?T:new TextDecoder().decode(T)}).join(`
|
|
2
|
+
`):g=JSON.stringify(p),await c(g)}}):z(r,{onTransportError:f,retry:m,serialize:o,send:async p=>{await c(p)}})}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
|
+
`;if(n!==void 0){let s=n.split(/\r?\n/);for(let u of s)i+=`data: ${u}
|
|
4
|
+
`}return`${i}
|
|
5
|
+
`}function yr(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:l,eventNameResolver:m=Ae}=n??{},f=new TextEncoder,c;return new ReadableStream({start(d){let p=!1,g,y=()=>{},T=()=>{p||(p=!0,g!==void 0&&clearInterval(g),l?.removeEventListener("abort",b),y(),d.close())};c=T;let h=(w,v)=>{p||d.enqueue(f.encode(Le(w,v)))},b=()=>{p||T()};y=r.subscribe(w=>{for(let v of w){let S=v[0];if(!(ee.isLocalOnly(S)&&!(S===ye&&e))){if(S===E){h(s,re(v[1],i));continue}if(S===x){h(u,re(v[1],i)),T();return}if(S===P){h(o),T();return}!t&&S===ke||h(m(S),v.length>1?re(v[1],i):void 0)}}}),a!==void 0&&a>0&&(g=setInterval(()=>{p||d.enqueue(f.encode(`: keepalive
|
|
6
|
+
|
|
7
|
+
`))},a)),l?.aborted?b():l?.addEventListener("abort",b,{once:!0})},cancel(){c?.()}})}function kr(r,n){let{serialize:i=c=>{if(c instanceof Error)return c.message;try{return JSON.stringify(c)}catch{return String(c)}},dataEvent:s="data",errorEvent:u="error",completeEvent:o="complete",includeResolved:t=!1,includeDirty:e=!1,keepAliveMs:a,signal:l,eventNameResolver:m=Ae}=n??{},f=new TextEncoder;return B(c=>{let d=!0,p,g=(h,b)=>{d&&c.emit(f.encode(Le(h,b)))},y=()=>{d&&(d=!1,c.down([[P]]))},T=r.subscribe(h=>{if(d)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)),d=!1,c.down([[P]]);return}if(w===P){g(o),d=!1,c.down([[P]]);return}!t&&w===ke||g(m(w),b.length>1?re(b[1],i):void 0)}}});return a!==void 0&&a>0&&(p=setInterval(()=>{d&&c.emit(f.encode(`: keepalive
|
|
8
|
+
|
|
9
|
+
`))},a)),l?.aborted?y():l?.addEventListener("abort",y,{once:!0}),()=>{d=!1,p!==void 0&&clearInterval(p),l?.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*$e(r,n){let i=n?.parse??(v=>v),s=n?.signal,u=new TextDecoder,o="",t="message",e=[],a,l,m=[],f=()=>{if(e.length===0&&t==="message"&&a===void 0){e=[];return}let v=e.join(`
|
|
10
|
+
`);m.push({event:t,data:i(v),id:a,retry:l}),t="message",e=[],a=void 0,l=void 0},c=v=>{if(v===""){f();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)&&(l=K);break}}},d=(v,S)=>{o+=u.decode(v,{stream:!S});let L=o.split(/\r?\n/);o=L.pop()??"";for(let F of L)c(F)},p=r,g=r instanceof ReadableStream?r:p&&typeof p=="object"&&p.body instanceof ReadableStream?p.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(d(v,!1);m.length>0;)yield m.shift()}d(new Uint8Array,!0)}else{for(T=r[Symbol.asyncIterator]();!s?.aborted;){let S=await T.next();if(S.done)break;for(d(S.value,!1);m.length>0;)yield m.shift()}d(new Uint8Array,!0)}if(o.trim()){for(let v of o.split(/\r?\n/))c(v);f()}for(;m.length>0;)yield m.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 $e(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()}},j(s))}function vr(r,n){let{method:i="GET",headers:s,body:u,signal:o,...t}=n??{};return B(e=>{let a=!0,l=new AbortController;if(o?.aborted)return e.down([[x,o.reason??new Error("Aborted")]]),()=>{};o?.addEventListener("abort",()=>l.abort(o.reason),{once:!0});let m=u!==void 0?typeof u=="string"?u:JSON.stringify(u):void 0;return(async()=>{try{let c=await fetch(r,{method:i,headers:s,body:m,signal:l.signal});if(!a)return;if(!c.ok)throw new Error(`HTTP ${c.status}: ${c.statusText}`);if(!c.body)throw new Error("HTTP response has no body");let d=c.body.getReader();for(;a;){let{value:p,done:g}=await d.read();if(g)break;p&&e.emit(p)}a&&e.down([[P]])}catch(c){if(!a||c&&c.name==="AbortError")return;e.down([[x,c]])}})(),()=>{a=!1,l.abort()}},j(t))}function wr(r,n){let{intervalMs:i=5e3,...s}=n??{};return fe(pe(i,{period:i}),()=>We(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:l,backpressure:m,stopOn:f}=i??{},c=!1,d=T=>{if(!c){c=!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{}}}},p=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:l,backpressure:m,stopOn:f,onDispose:()=>{if(p){try{n.removeEventListener("close",p)}catch{}p=null}},send:T=>{n.send(T)},onUpstreamMessage:T=>{(T[0]===P&&u||T[0]===x&&o)&&d(T)}});return p=()=>{c=!0,y.dispose()},n.addEventListener("close",p),y}function Er(r,n){let{parse:i,maxRetries:s,backoff:u="exponential",closeOnTeardown:o=!0,...t}=n??{};return Ne(()=>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=>{_(()=>{for(let a of e)s(a)})},onMetrics:e=>{_(()=>{for(let a of e)u(a)})},onLogs:e=>{_(()=>{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 je={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=je[u]??"counter",t=o==="set"?0:Number(s),e,a={};for(let l=2;l<n.length;l++){let m=n[l].trim();if(m.startsWith("@"))e=Number(m.slice(1));else if(m.startsWith("#"))for(let f of m.slice(1).split(",")){let[c,d]=f.split(":");c&&(a[c]=d??"")}}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(l=>{let m=!0,f=new AbortController,c=setTimeout(()=>f.abort(new Error("Scrape timeout")),Math.ceil(u/1e6));return(async()=>{try{let p=await fetch(r,{headers:{Accept:"text/plain",...s},signal:f.signal});if(clearTimeout(c),!m)return;if(!p.ok)throw new Error(`Prometheus scrape ${p.status}: ${p.statusText}`);let g=await p.text();if(!m)return;let y=Qe(g);for(let T of y)l.emit(T);a=0,l.down([[P]])}catch(p){if(clearTimeout(c),!m||p instanceof Error&&p.name==="AbortError")return;a+=1,a>=t&&l.down([[x,p]])}})(),()=>{m=!1,clearTimeout(c),f.abort()}}))}function Qe(r){let n=[],i=new Map,s=new Map;for(let u of r.split(`
|
|
11
|
+
`)){let o=u.trim();if(!o)continue;if(o.startsWith("# TYPE ")){let c=o.slice(7),d=c.indexOf(" ");d>0&&i.set(c.slice(0,d),c.slice(d+1).trim());continue}if(o.startsWith("# HELP ")){let c=o.slice(7),d=c.indexOf(" ");d>0&&s.set(c.slice(0,d),c.slice(d+1).trim());continue}if(o.startsWith("#"))continue;let t,e={},a,l,m=o.indexOf("{");if(m>=0){t=o.slice(0,m);let c=o.indexOf("}",m);if(c<0)continue;let d=o.slice(m+1,c);e=_e(d);let p=o.slice(c+1).trim().split(/\s+/);a=p[0]??"",l=p[1]}else{let c=o.split(/\s+/);t=c[0]??"",a=c[1]??"",l=c[2]}if(!t||!a)continue;let f=t.replace(/(_total|_count|_sum|_bucket|_created|_info)$/,"");n.push({name:t,labels:e,value:Number(a),timestampMs:l?Number(l):void 0,type:i.get(f)??i.get(t),help:s.get(f)??s.get(t),timestampNs:D()})}return n}function _e(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:l,partition:m,message:f})=>{if(!e)return;let c={};if(f.headers)for(let[d,p]of Object.entries(f.headers))p!==void 0&&(c[d]=typeof p=="string"?p:p.toString());t.emit({topic:l,partition:m,key:f.key?.toString()??null,value:u(f.value),headers:c,offset:f.offset,timestamp:f.timestamp,timestampNs:D()})}})}catch(l){e&&t.down([[x,l]])}})(),()=>{e=!1}},j(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,l=u(e);await n.send({topic:i,messages:[{key:a,value:Buffer.from(l)}]})}})}function Ir(r,n,i){let{blockMs:s=5e3,startId:u="$",parse:o=e=>{for(let l=0;l<e.length;l+=2)if(e[l]==="data")try{return JSON.parse(e[l+1])}catch{return e[l+1]}let a={};for(let l=0;l<e.length;l+=2)a[e[l]]=e[l+1];return a},...t}=i??{};return B(e=>{let a=!0,l=u;return(async()=>{for(;a;)try{let f=await r.xread("BLOCK",s,"STREAMS",n,l);if(!a)return;if(f)for(let[c,d]of f)for(let[p,g]of d)l=p,e.emit({id:p,key:n,data:o(g),timestampNs:D()})}catch(f){if(!a)return;e.down([[x,f]]);return}})(),()=>{a=!1}},j(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 l=!1;return(async()=>{try{let f=u,c="";for await(let d of r){if(l)return;c+=d;let p=c.split(/\r?\n/);c=p.pop()??"";for(let g of p){if(l)return;if(!g.trim())continue;let y=e(g);if(!f&&s){f=y;continue}f||(f=y.map((h,b)=>`col${b}`));let T={};for(let h=0;h<f.length;h++)T[f[h]]=y[h]??"";a.emit(T)}}if(!l&&c.trim()){let d=e(c);if(f){let p={};for(let g=0;g<f.length;g++)p[f[g]]=d[g]??"";a.emit(p)}}l||a.down([[P]])}catch(f){l||a.down([[x,f]])}})(),()=>{l=!0}},j(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,l,m)=>{let f=a[0];if(f==null||f.length===0)return;let c=m.store;typeof c.buffer!="string"&&(c.buffer=""),c.headers===void 0&&u&&(c.headers=u.slice());for(let d of f){c.buffer=c.buffer+d;let p=c.buffer.split(/\r?\n/);c.buffer=p.pop()??"";for(let g of p){if(!g.trim())continue;let y=e(g);if(!c.headers&&s){c.headers=y;continue}c.headers||(c.headers=y.map((h,b)=>`col${b}`));let T={};for(let h=0;h<c.headers.length;h++)T[c.headers[h]]=y[h]??"";l.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 l of a)if(l.trim())try{s.emit(JSON.parse(l))}catch(m){s.down([[x,m]]);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 l=a.trim();l&&i.emit(JSON.parse(l))}}!s&&o.trim()&&i.emit(JSON.parse(o.trim())),s||i.down([[P]])}catch(o){s||i.down([[x,o]])}})(),()=>{s=!0}},j(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(l=>{let m=!0;return(async()=>{try{let c=await r.query({query:n,format:u});if(!m)return;let d=await c.json();if(!m)return;for(let p of d)l.emit(p);a=0,l.down([[P]])}catch(c){if(!m)return;a+=1,a>=t&&l.down([[x,c]])}})(),()=>{m=!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 m=await r.receive();if(!a)return;let f={topic:m.getTopicName(),messageId:m.getMessageId().toString(),key:m.getPartitionKey(),value:s(m.getData()),properties:m.getProperties(),publishTime:m.getPublishTimestamp(),eventTime:m.getEventTimestamp(),timestampNs:D()};if(i)e.emit(f),r.acknowledge(m).catch(t);else{let c=!1,d={value:f,ack(){c||(c=!0,r.acknowledge(m).catch(t))},nack(p){if(c)return;c=!0;let g=r;try{let y=g.negativeAcknowledge?.(m);y&&typeof y.then=="function"&&y.catch(t)}catch(y){t(y)}}};e.emit(d)}}catch(m){a&&e.down([[x,m]]);return}})(),()=>{a=!1}},j(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 Wr(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,l=r.subscribe(n,u?{queue:u}:void 0);return(async()=>{try{for await(let f of l){if(!a)return;let c={};if(f.headers)for(let d of f.headers.keys())c[d]=f.headers.get(d);e.emit({subject:f.subject,data:o(f.data),headers:c,reply:f.reply,sid:f.sid,timestampNs:D()})}a&&e.down([[P]])}catch(f){a&&e.down([[x,f]])}})(),()=>{a=!1}},j(t))}function $r(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 jr(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 l=!0,m;return(async()=>{try{m=(await r.consume(n,d=>{if(!l)return;if(d===null){l&&a.down([[x,new Error("Consumer cancelled by broker")]]);return}let p={queue:n,routingKey:d.fields.routingKey,exchange:d.fields.exchange,content:u(d.content),properties:d.properties,deliveryTag:d.fields.deliveryTag,redelivered:d.fields.redelivered,timestampNs:D()};if(s){a.emit(p);try{r.ack(d)}catch(g){e(g)}}else{let g=!1,y=r,T={value:p,ack(){if(!g){g=!0;try{r.ack(d)}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(d,!1,b)}catch(w){e(w)}}};a.emit(T)}},{noAck:!1})).consumerTag}catch(c){l&&a.down([[x,c]])}})(),()=>{l=!1,m!==void 0&&r.cancel(m)}},j(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),l=u(e);n.publish(i,a,l)}})}function Je(r,n,i){let{serialize:s=f=>`${JSON.stringify(f)}
|
|
12
|
+
`,flushIntervalMs:u=0,batchSize:o=Number.POSITIVE_INFINITY,onTransportError:t,mode:e}=i??{},l=u>0||o<Number.POSITIVE_INFINITY?z(r,{onTransportError:t,batchSize:o,flushIntervalMs:u,serialize:s,sendBatch:f=>{n.write(f.join(""))}}):z(r,{onTransportError:t,serialize:s,send:f=>{n.write(f)}}),m=l.dispose;return l.dispose=()=>{m();try{n.end()}catch{}},l}function ve(r,n){return r.includes(n)||r.includes('"')||r.includes(`
|
|
13
|
+
`)?`"${r.replace(/"/g,'""')}"`:r}function _r(r,n,i){let{columns:s,delimiter:u=",",writeHeader:o=!0,cellExtractor:t=(d,p)=>String(d[p]??""),flushIntervalMs:e=0,batchSize:a=Number.POSITIVE_INFINITY,onTransportError:l,...m}=i,f=!1;return Je(r,n,{serialize:d=>{if(!f&&o){f=!0;let p=s.map(y=>ve(y,u)).join(u),g=s.map(y=>ve(t(d,y),u)).join(u);return`${p}
|
|
14
|
+
${g}
|
|
15
|
+
`}return`${s.map(p=>ve(t(d,p),u)).join(u)}
|
|
16
|
+
`},flushIntervalMs:e,batchSize:a,onTransportError:l,...m})}function Jr(r,n,i,s){let{batchSize:u=1e3,flushIntervalMs:o=5e3,format:t="JSONEachRow",transform:e=l=>l,onTransportError:a}=s??{};return z(r,{onTransportError:a,batchSize:u,flushIntervalMs:o,serialize:e,sendBatch:async l=>{await n.insert({table:i,values:l,format:t})}})}function Vr(r,n,i,s){let{format:u="ndjson",keyGenerator:o=(c,d)=>{let p=Math.floor(d/1e6);return`data/${new Date(p).toISOString().replace(/[:.]/g,"-")}-${c}.${u==="ndjson"?"ndjson":"json"}`},batchSize:t=1e3,flushIntervalMs:e=1e4,transform:a=c=>c,onTransportError:l}=s??{},m=u==="ndjson"?"application/x-ndjson":"application/json",f=0;return z(r,{onTransportError:l,batchSize:t,flushIntervalMs:e,serialize:a,sendBatch:async c=>{f+=1;let d=u==="ndjson"?`${c.map(g=>JSON.stringify(g)).join(`
|
|
17
|
+
`)}
|
|
18
|
+
`:JSON.stringify(c),p=o(f,D());await n.putObject({Bucket:i,Key:p,Body:d,ContentType:m})}})}function Yr(r,n,i,s){let{toSQL:u=(t,e)=>({sql:`INSERT INTO "${e.replace(/"/g,'""')}" (data) VALUES ($1)`,params:[JSON.stringify(t)]}),onTransportError:o}=s??{};return z(r,{onTransportError:o,serialize:t=>u(t,i),send:async t=>{let e=t;await n.query(e.sql,e.params)}})}function Gr(r,n,i){let{toDocument:s=o=>o,onTransportError:u}=i??{};return z(r,{onTransportError:u,serialize:s,send:async o=>{await n.insertOne(o)}})}function Xr(r,n,i){let{labels:s={},toLine:u=e=>JSON.stringify(e),toLabels:o,onTransportError:t}=i??{};return z(r,{onTransportError:t,serialize:e=>({line:u(e),labels:o?{...s,...o(e)}:s}),send:async e=>{let{line:a,labels:l}=e,m=`${D()}`;await n.push({streams:[{stream:l,values:[[m,a]]}]})}})}function Zr(r,n,i){let{toResourceSpans:s=o=>[o],onTransportError:u}=i??{};return z(r,{onTransportError:u,serialize:s,send:async o=>{await n.push({resourceSpans:o})}})}function et(r,n,i,s){let{prefix:u="checkpoints/",debounceMs:o=500,compactEvery:t=10,onError:e}=s??{},a={debounceMs:o,compactEvery:t,save(l,m){let f=Math.floor(D()/1e6),c=`${u}${r.name}/checkpoint-${f}.json`,d;try{d=JSON.stringify(m)}catch(p){e?.(p);return}n.putObject({Bucket:i,Key:c,Body:d,ContentType:"application/json"}).catch(p=>e?.(p))},load(){return null}};return r.attachStorage([a],{onError:l=>e?.(l)})}function rt(r,n,i){let{prefix:s="graphrefly:checkpoint:",debounceMs:u=500,compactEvery:o=10,onError:t}=i??{},e=`${s}${r.name}`,a={debounceMs:u,compactEvery:o,save(l,m){let f;try{f=JSON.stringify(m)}catch(c){t?.(c);return}n.set(e,f).catch(c=>t?.(c))},async load(){let l=await n.get(e);if(l==null)return null;try{return JSON.parse(l)}catch{return null}}};return r.attachStorage([a],{onError:l=>t?.(l)})}function tt(r,n,i){let{mapRow:s=t=>t,params:u,...o}=i??{};return B(t=>{try{let a=r.query(n,u).map(s);t.emit(a),t.down([[P]])}catch(e){t.down([[x,e instanceof Error?e:new Error(String(e))]])}},{describeKind:"producer",completeWhenDepsComplete:!1,...o})}function nt(r,n,i){let{mapRow:s=t=>t,params:u,...o}=i??{};return B(t=>{try{let e=r.iterate(n,u);_(()=>{for(let a of e)t.emit(s(a));t.down([[P]])})}catch(e){t.down([[x,e instanceof Error?e:new Error(String(e))]])}},{describeKind:"producer",completeWhenDepsComplete:!1,...o})}function ot(r,n,i,s){if(i.includes("\0")||i.length===0)throw new Error(`toSqlite: invalid table name: ${JSON.stringify(i)}`);let{toSQL:u=(O,q)=>({sql:`INSERT INTO "${q.replace(/"/g,'""')}" (data) VALUES (?)`,params:[JSON.stringify(O)]}),onTransportError:o,batchInsert:t=!1,maxBatchSize:e=1e3,flushIntervalMs:a=0}=s??{},l=O=>u(O,i);if(!t)return z(r,{onTransportError:o,serialize:l,send:O=>{let q=O;n.query(q.sql,q.params)}});let m=U(null),f=U(void 0,{equals:()=>!1}),c=U(null),d=U(0),p=U(0),g=O=>{try{o?.(O)}catch{}try{m.down([[E,O]])}catch{}},y=[],T=!1,h,b=!1,w=()=>p.down([[E,y.length]]),v=O=>{b||f.down([[E,O]])},S=O=>{b||c.down([[E,O]])},L=O=>{b||d.down([[E,O]])},F=O=>{b||g(O)},K=()=>{if(y.length===0||T)return;T=!0,L(1);try{n.query("BEGIN",[])}catch(I){T=!1,L(0),F({stage:"send",error:I instanceof Error?I:new Error(String(I)),value:void 0});return}let O=y;y=[],w();let q,J=0;for(let I of O)try{n.query(I.query.sql,I.query.params),J+=1}catch(W){q=W instanceof Error?W:new Error(String(W));break}if(q){try{n.query("ROLLBACK",[])}catch{}F({stage:"send",error:q,value:void 0});for(let I of O)S({value:I.value,error:q,attempts:1})}else try{n.query("COMMIT",[]);for(let I of O)v(I.value)}catch(I){let W=I instanceof Error?I:new Error(String(I));F({stage:"send",error:W,value:void 0});for(let V=0;V<J;V++)S({value:O[V].value,error:W,attempts:1})}T=!1,L(0)},G=()=>{a>0&&h===void 0&&!b&&(h=setTimeout(()=>{h=void 0,K()},a))},ie=r.subscribe(O=>{for(let q of O){let J=q[0];if(J===E){let I=q[1],W;try{W=l(I)}catch(V){let te=V instanceof Error?V:new Error(String(V));g({stage:"serialize",error:te,value:I}),c.down([[E,{value:I,error:te,attempts:0}]]);continue}y.push({value:I,query:W}),w(),y.length>=e?K():G()}else ee.messageTier(J)>=3&&K()}});return{dispose:()=>{if(!b){h!==void 0&&(clearTimeout(h),h=void 0),K(),b=!0,ie();for(let O of[m,f,c,d,p])try{O.down([[le]])}catch{}}},sent:f,failed:c,inFlight:d,errors:m,buffered:p,flush:async()=>{b||K()}}}function st(r,n){let{args:i,mapRow:s=o=>o,...u}=n??{};return B(o=>{let t=!0;return r.findMany(i).then(e=>{t&&(o.emit(e.map(s)),o.down([[P]]))}).catch(e=>{if(t)try{o.down([[x,e instanceof Error?e:new Error(String(e))]])}catch{}}),()=>{t=!1}},{...u,describeKind:"producer",completeWhenDepsComplete:!1})}function it(r,n){let{mapRow:i=u=>u,...s}=n??{};return B(u=>{let o=!0;return r.execute().then(t=>{o&&(u.emit(t.map(i)),u.down([[P]]))}).catch(t=>{if(o)try{u.down([[x,t instanceof Error?t:new Error(String(t))]])}catch{}}),()=>{o=!1}},{...s,describeKind:"producer",completeWhenDepsComplete:!1})}function at(r,n){let{mapRow:i=u=>u,...s}=n??{};return B(u=>{let o=!0;return r.execute().then(t=>{o&&(u.emit(t.map(i)),u.down([[P]]))}).catch(t=>{if(o)try{u.down([[x,t instanceof Error?t:new Error(String(t))]])}catch{}}),()=>{o=!1}},{...s,describeKind:"producer",completeWhenDepsComplete:!1})}async function ct(r,n){let i;try{i=await r.text()}catch{i=""}let s=n??"HTTP",u=new Error(`${s} API ${r.status}: ${r.statusText}${i?` \u2014 ${i}`:""}`);return u.status=r.status,u.headers=r.headers,u}export{oe as a,Me as b,z as c,Ke as d,Tr as e,We as f,gr as g,yr as h,kr as i,br as j,$e as k,hr as l,vr as m,wr as n,Sr as o,Er as p,xr as q,Or as r,Nr as s,Rr as t,Pr as u,Cr as v,Mr as w,Qe as x,Ar as y,Lr as z,Ir as A,Br as B,Fr as C,Hr as D,zr as E,qr as F,Ur as G,Dr as H,Kr as I,Wr as J,$r as K,jr as L,Qr as M,Je as N,_r as O,Jr as P,Vr as Q,Yr as R,Gr as S,Xr as T,Zr as U,et as V,rt as W,tt as X,nt as Y,ot as Z,st as _,it as $,at as aa,ct as ba};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as O,b as H,c as j,d as E,e as W,f as ne}from"./chunk-
|
|
1
|
+
import{a as O,b as H,c as j,d as E,e as W,f as ne}from"./chunk-YZKGGMPT.js";import{a as N}from"./chunk-K54OKWNY.js";import{a as X,j as T}from"./chunk-PSQNYY72.js";import{D as I,E as y,G as L,o as S}from"./chunk-7AJKUA36.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};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as $}from"./chunk-
|
|
1
|
+
import{a as $}from"./chunk-EBQ6FXKW.js";import{c as O}from"./chunk-K54OKWNY.js";import{a as C}from"./chunk-7EQPXQ7H.js";import{b as x}from"./chunk-XRSHMHEG.js";import{j as A}from"./chunk-PSQNYY72.js";import{B as R}from"./chunk-UMH3HSP7.js";import{C as T,E as N,G as E,o as b,p as w,u as P,w as S}from"./chunk-7AJKUA36.js";import{b as v}from"./chunk-CK2E7BTU.js";import{b as M}from"./chunk-QYADASLV.js";var J={};M(J,{AuditTrailGraph:()=>k,PolicyEnforcerGraph:()=>G,auditTrail:()=>z,complianceSnapshot:()=>F,policyEnforcer:()=>K,reactiveExplainPath:()=>q});function V(i,t){return O("audit",i,t)}var L=new Set(["data","error","complete","teardown"]),k=class extends A{entries;count;_log;_target;constructor(t,n){super(n.name??`${t.name}_audit`,n.graph),this._target=t,this._log=x([],{name:"entries",...n.maxSize!=null?{maxSize:n.maxSize}:{}}),this.entries=this._log.entries,this.add(this.entries,{name:"entries"}),this.count=E([this.entries],([c])=>c.length,{name:"count",describeKind:"derived",meta:V("count")}),this.add(this.count,{name:"count"}),this.addDisposer(R(this.count));let o=n.includeTypes!=null?new Set(n.includeTypes):L,u=n.filter,a=0,h=t.observe({timeline:!0,structured:!0}),m=h.onEvent(c=>{if(c.type==="derived")return;let e=c.type;if(!o.has(e))return;let d=c.path??"",r={seq:a++,timestamp_ns:c.timestamp_ns??b(),wall_clock_ns:w(),path:d,type:e},f=(d?D(t,d):void 0)?.lastMutation;f!=null&&(r.actor=f.actor),e==="data"&&(r.value=c.data),e==="error"&&(r.error=c.data);let l=d?U(t,d):void 0;l!=null&&(r.annotation=l),!(u!=null&&!u(r))&&this._log.append(r)});this.addDisposer(()=>{m(),h.dispose()}),this.addDisposer(()=>this._log.disposeAllViews())}all(){return this.entries.cache??[]}byNode(t){return this.all().filter(n=>n.path===t)}byActor(t){return this.all().filter(n=>n.actor?.id===t)}byActorType(t){return this.all().filter(n=>n.actor?.type===t)}byTimeRange(t,n){return this.all().filter(o=>!(o.timestamp_ns<t||n!=null&&o.timestamp_ns>=n))}get target(){return this._target}};function z(i,t={}){return new k(i,t)}var G=class extends A{policies;violations;violationCount;_target;_mode;_currentGuard;constructor(t,n,o){super(o.name??`${t.name}_policy`,o.graph),this._target=t,this._mode=o.mode??"audit";let u=I(n)?n:N(n,{name:"policies"});this.policies=u,this.add(this.policies,{name:"policies"}),this.violations=new $("violations",{retainedLimit:o.violationsLimit??1e3}),this.mount("violations",this.violations),this.violationCount=E([this.violations.events],([e])=>e.length,{name:"violationCount",describeKind:"derived",meta:V("policy_violation_count")}),this.add(this.violationCount,{name:"violationCount"}),this.addDisposer(R(this.violationCount));let h=u.cache??[];this._currentGuard=P(h);let m=u.subscribe(e=>{for(let d of e)d[0]===v&&(h=d[1]??[],this._currentGuard=P(h))});this.addDisposer(m);let c=o.paths!=null?[...o.paths]:j(t);if(this._mode==="enforce"){let e=new Map,d=r=>{if(e.has(r))return;let s=D(t,r);if(!(s instanceof T))return;let f=(l,p)=>{let y=this._currentGuard(l,p);return y||this._publishViolation(l,p,r,"blocked"),y};e.set(r,s._pushGuard(f))};for(let r of c)d(r);if(o.paths==null){let r=C(t,(s,f,l)=>{if(s.kind==="added")if(s.nodeKind==="node")d(`${l}${s.name}`);else{let p=f._mounts.get(s.name);if(!(p instanceof A))return;let y=`${l}${s.name}::`,_=j(p);for(let g of _)d(g===""?`${l}${s.name}`:`${y}${g}`)}else if(s.kind==="removed")if(s.nodeKind==="node"){let p=`${l}${s.name}`,y=e.get(p);y!=null&&(y(),e.delete(p))}else{let p=`${l}${s.name}`,y=`${p}::`;for(let[_,g]of e)(_===p||_.startsWith(y))&&(g(),e.delete(_))}});this.addDisposer(r)}else{let r=t.topology.subscribe(s=>{for(let f of s){if(f[0]!==v)continue;let l=f[1];if(l.kind!=="removed"||l.nodeKind!=="node")continue;let p=e.get(l.name);p!=null&&(p(),e.delete(l.name))}});this.addDisposer(r)}this.addDisposer(()=>{for(let r of e.values())r();e.clear()})}else{let e=t.observe({timeline:!0,structured:!0}),d=e.onEvent(r=>{if(r.type!=="data"&&r.type!=="error")return;let s=r.path??"";if(!s||o.paths!=null&&!o.paths.includes(s))return;let f=r.actor??D(t,s)?.lastMutation?.actor;if(f==null)return;let l="write";this._currentGuard(f,l)||this._publishViolation(f,l,s,"observed")});this.addDisposer(()=>{d(),e.dispose()})}}_publishViolation(t,n,o,u){this.violations.publish({timestamp_ns:b(),wall_clock_ns:w(),path:o,actor:t,action:n,mode:this._mode,result:u})}all(){return this.violations.retained()}get mode(){return this._mode}get target(){return this._target}};function K(i,t,n={}){return new G(i,t,n)}function q(i,t,n,o){return i.explain(t,n,{reactive:!0,...o})}function F(i,t={}){let n={format_version:1,timestamp_ns:b(),wall_clock_ns:w(),graph:i.snapshot()};if(t.actor!=null&&(n.actor=t.actor),t.audit!=null){let u=[...t.audit.all()];n.audit={count:u.length,entries:u}}if(t.policies!=null){let u=t.policies.policies.cache??[];n.policies={mode:t.policies.mode,rules:u,violations:[...t.policies.all()]}}let o=B(n);return{...n,fingerprint:o}}function I(i){return typeof i=="object"&&i!==null&&"subscribe"in i}function D(i,t){try{return i.node(t)}catch{return}}function U(i,t){try{return i.annotation(t)}catch{return}}function j(i){let t=i.describe({detail:"minimal"});return Object.keys(t.nodes)}function B(i){return S(JSON.stringify(H(i)))}function H(i){let t=new Set,n=o=>{if(o===void 0)return{__undefined:!0};if(o===null)return null;let u=typeof o;if(u==="bigint")return{__bigint:o.toString()};if(u!=="object")return o;let a=o;if(t.has(a))return{__circular:!0};t.add(a);try{if(Array.isArray(a))return a.map(n);if(a instanceof Date)return{__date:a.toISOString()};if(a instanceof RegExp)return{__regexp:{source:a.source,flags:a.flags}};if(a instanceof Map)return{__map:[...a.entries()].map(([c,e])=>[n(c),n(e)])};if(a instanceof Set)return{__set:[...a].map(n)};if(ArrayBuffer.isView(a)){let m=a,c=new Array(m.length);for(let e=0;e<m.length;e++)c[e]=m[e]??0;return{__typed_array:{ctor:a.constructor.name,data:c}}}let h={};for(let m of Object.keys(a).sort())h[m]=n(a[m]);return h}finally{t.delete(a)}};return n(i)}export{k as a,z as b,G as c,K as d,q as e,F as f,J as g};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as G}from"./chunk-
|
|
1
|
+
import{a as G}from"./chunk-K54OKWNY.js";import{j as z}from"./chunk-PSQNYY72.js";import{D as H,E as M,G as N,o as R}from"./chunk-7AJKUA36.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};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as R}from"./chunk-K54OKWNY.js";import{b as N}from"./chunk-XRSHMHEG.js";import{j as k}from"./chunk-PSQNYY72.js";import{B as g}from"./chunk-UMH3HSP7.js";import{D as T,E as S,G as y,m as q,p as w,t as u}from"./chunk-7AJKUA36.js";import{b as A}from"./chunk-QYADASLV.js";var P={};A(P,{CqrsGraph:()=>h,MemoryEventStore:()=>_,cqrs:()=>O});var j=u((i,e)=>{i("write"),i("signal"),e("observe")}),D=u((i,e)=>{i("observe"),i("signal"),e("write")}),H=u((i,e)=>{i("observe"),i("signal"),e("write")});function m(i,e){return R("cqrs",i,e)}var _=class{_store=new Map;persist(e){let t=this._store.get(e.type);t||(t=[],this._store.set(e.type,t)),t.push(e)}loadEvents(e,t){let n=this._store.get(e)??[],r=t?.timestampNs,s=t?.seq,o=r==null?[...n]:n.filter(d=>d.timestampNs>r||d.timestampNs===r&&d.seq>(s??-1)),a=o.length>0?o[o.length-1]:void 0;return{events:o,cursor:a?{timestampNs:a.timestampNs,seq:a.seq}:t}}clear(){this._store.clear()}},h=class extends k{_eventLogs=new Map;_commandHandlers=new Map;_projections=new Set;_sagas=new Set;_keepaliveDisposers=[];_eventStore;_seq=0;constructor(e,t={}){super(e,t.graph)}destroy(){for(let e of this._keepaliveDisposers)e();this._keepaliveDisposers.length=0,super.destroy()}event(e){let t=this._eventLogs.get(e);if(t)return t.node;let n=N([],{name:e,versioning:0}),r=n.entries,s=y([r],([o])=>o,{name:e,describeKind:"state",meta:m("event",{event_name:e}),guard:H,initial:r.cache});return this.add(s,{name:e}),this._keepaliveDisposers.push(g(s)),this._eventLogs.set(e,{log:n,node:s}),s}_appendEvent(e,t){let n=this._eventLogs.get(e);if(n||(this.event(e),n=this._eventLogs.get(e)),n.node.status==="completed"||n.node.status==="errored")throw new Error(`Cannot dispatch to terminated event stream "${e}" (status: ${n.node.status}).`);let r=n.log.entries.v,s={type:e,payload:t,timestampNs:w(),seq:++this._seq,...r!=null?{v0:{id:r.id,version:r.version}}:{}};n.log.append(s),this._eventStore&&this._eventStore.persist(s)}command(e,t){let n=S(void 0,{name:e,describeKind:"state",meta:{...m("command",{command_name:e}),error:null},guard:j});return this.add(n,{name:e}),this._commandHandlers.set(e,t),n}dispatch(e,t){let n=this._commandHandlers.get(e);if(!n)throw new Error(`Unknown command: "${e}". Register with .command() first.`);let r=this.resolve(e);q(()=>{r.emit(t,{internal:!0});try{n(t,{emit:(s,o)=>this._appendEvent(s,o)}),r.meta.error.emit(null,{internal:!0})}catch(s){throw r.meta.error.emit(s,{internal:!0}),s}})}projection(e,t,n,r){let s=t.map(a=>(this._eventLogs.has(a)||this.event(a),this._eventLogs.get(a).node)),o=y(s,a=>{let d=[];for(let v of a){let p=v;d.push(...p)}return d.sort((v,p)=>v.timestampNs-p.timestampNs||v.seq-p.seq),n(r,d)},{name:e,describeKind:"derived",meta:m("projection",{projection_name:e,source_events:t}),guard:D,initial:r});return this.add(o,{name:e}),this._keepaliveDisposers.push(g(o)),this._projections.add(e),o}saga(e,t,n){let r=t.map(d=>(this._eventLogs.has(d)||this.event(d),this._eventLogs.get(d).node)),s=new Map,o={},a=T(r,(d,v)=>{let p=o.n.meta.error;for(let c=0;c<d.length;c++){let E=d[c];if(E==null||E.length===0)continue;let l=E.at(-1);if(!l)continue;let f=t[c],C=s.get(f)??0;if(l.length>C){let b=l.slice(C);for(let L of b)try{n(L),p.emit(null,{internal:!0})}catch(x){p.emit(x,{internal:!0})}s.set(f,l.length)}}},{name:e,describeKind:"effect",meta:{...m("saga",{saga_name:e,source_events:t}),error:null}});return o.n=a,this.add(a,{name:e}),this._keepaliveDisposers.push(g(a)),this._sagas.add(e),a}useEventStore(e){this._eventStore=e}async rebuildProjection(e,t,n){if(!this._eventStore)throw new Error("No event store wired. Call useEventStore() first.");let r=[];for(let s of e){let o=await this._eventStore.loadEvents(s);r.push(...o.events)}return r.sort((s,o)=>s.timestampNs-o.timestampNs||s.seq-o.seq),t(n,r)}};function O(i,e){return new h(i,e)}export{_ as a,h as b,O as c,P as d};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as f}from"./chunk-
|
|
1
|
+
import{c as f}from"./chunk-JMGGCSIC.js";import{a as l,d as o,e as d,h as s,i as m,k as b,l as c}from"./chunk-RWGJQQLT.js";import{a as r,b as u}from"./chunk-4VVTGLXJ.js";import{b as y}from"./chunk-QYADASLV.js";var R={};y(R,{NS_PER_MS:()=>r,NS_PER_SEC:()=>u,resilientPipeline:()=>O});function O(p,e={}){let t=p;e.rateLimit!=null&&(t=s(t,e.rateLimit)),e.budget!=null&&e.budget.length>0&&(t=f(t,e.budget));let n;if(e.breaker!=null){let k=o(e.breaker),S=e.breakerOnOpen??"skip",a=d(k,{onOpen:S})(t);t=a.node,n=a.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=c(t,e.timeoutMs*1e6)}e.retry!=null&&(t=l(t,e.retry)),e.fallback!==void 0&&(t=b(t,e.fallback));let i=m(t,{initialStatus:e.initialStatus??"pending"});return{node:i.node,status:i.status,error:i.error,breakerState:n}}export{O as a,R as b};
|