@graphrefly/graphrefly 0.28.0 → 0.30.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-D9WG1-9L.d.ts → cascading-BszPheHD.d.ts} +1 -1
- package/dist/{cascading-B-5zmAUv.d.cts → cascading-dNCtjW8j.d.cts} +1 -1
- package/dist/{chunk-OAWLCNJJ.js → chunk-2GQREQ6C.js} +1 -1
- package/dist/{chunk-DBGGMN3D.js → chunk-33FA6V4B.js} +1 -1
- package/dist/chunk-3NEPQO2E.js +43 -0
- package/dist/{chunk-UWJE5FQA.js → chunk-4C2OR2GH.js} +11 -11
- package/dist/chunk-4JJCCD5S.js +2 -0
- package/dist/{chunk-GHJJR5P4.js → chunk-4OFIQ66T.js} +1 -1
- package/dist/{chunk-PIOGHC63.js → chunk-567NWZ3T.js} +1 -1
- package/dist/chunk-5JDE5JHE.js +1 -0
- package/dist/{chunk-ETWTCCJI.js → chunk-5Z4HDCO6.js} +1 -1
- package/dist/{chunk-Y2EMPB3I.js → chunk-73Z3W2RN.js} +1 -1
- package/dist/{chunk-CRXTH3SH.js → chunk-7JDLFI6N.js} +1 -1
- package/dist/{chunk-DQA3UIQ2.js → chunk-7TDOES3L.js} +1 -1
- package/dist/{chunk-LBTDSCCO.js → chunk-AMBYCIOH.js} +1 -1
- package/dist/{chunk-D7A7DBE4.js → chunk-AUY2YKCO.js} +1 -1
- package/dist/{chunk-FNYWM6JC.js → chunk-AV3PIDFQ.js} +1 -1
- package/dist/{chunk-UMBIDLJ4.js → chunk-BA5URFYW.js} +1 -1
- package/dist/chunk-BKPLTBL5.js +1 -0
- package/dist/{chunk-UPXUCFMX.js → chunk-BZP5T4X6.js} +1 -1
- package/dist/{chunk-WQ2BN6X6.js → chunk-DDPYNMGG.js} +1 -1
- package/dist/{chunk-LQ3Y5NJS.js → chunk-GJR3P6JG.js} +1 -1
- package/dist/{chunk-3R5HFPX7.js → chunk-GLSM33ZM.js} +1 -1
- package/dist/{chunk-2FOAM3OR.js → chunk-GNCBXARM.js} +1 -1
- package/dist/{chunk-K2GNMCQT.js → chunk-ISCENNXS.js} +1 -1
- package/dist/{chunk-UPHHLMHE.js → chunk-IUK4EFCE.js} +1 -1
- package/dist/{chunk-ERLIRFPA.js → chunk-KA6MMXIY.js} +1 -1
- package/dist/{chunk-2PMCKKRK.js → chunk-KASHOCF5.js} +1 -1
- package/dist/chunk-LI3E75VE.js +64 -0
- package/dist/chunk-MGKAO4EK.js +7 -0
- package/dist/{chunk-ZV2DXV5A.js → chunk-NSG4C6BF.js} +1 -1
- package/dist/{chunk-4GKB4OUJ.js → chunk-OL33ZI6R.js} +1 -1
- package/dist/{chunk-76A3HVQE.js → chunk-P7JXGKDO.js} +1 -1
- package/dist/{chunk-U3AICJKU.js → chunk-RD52SNH2.js} +1 -1
- package/dist/{chunk-CWLN3X3N.js → chunk-SHYH5SXV.js} +1 -1
- package/dist/{chunk-VTPVOGHH.js → chunk-SLMYTGTU.js} +1 -1
- package/dist/{chunk-OYHGKYQM.js → chunk-T5SHIKJD.js} +1 -1
- package/dist/{chunk-VPYBOXVT.js → chunk-TWMEGG45.js} +1 -1
- package/dist/chunk-VIEUJSTT.js +1 -0
- package/dist/{chunk-SC3U7ETD.js → chunk-VWPRPPKR.js} +1 -1
- package/dist/chunk-W4TSQ6RJ.js +1 -0
- package/dist/{chunk-OBKQQA5I.js → chunk-WANIEEKV.js} +1 -1
- package/dist/{chunk-XAUNPIMX.js → chunk-XHVB6G6M.js} +1 -1
- package/dist/{chunk-MIQTDPY4.js → chunk-XQAXYVXX.js} +1 -1
- package/dist/{chunk-MTTAAPCK.js → chunk-Y32RJO24.js} +1 -1
- package/dist/{chunk-S35VARIR.js → chunk-Y36UZ5VS.js} +1 -1
- package/dist/compat/index.cjs +13 -12
- 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 +13 -12
- 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 +7 -6
- 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-BhbKHbOS.d.ts → composite-DGspwCqk.d.ts} +2 -2
- package/dist/{composite-B-xqw4Kk.d.cts → composite-nrRumJ7l.d.cts} +2 -2
- 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 +20 -19
- package/dist/extra/index.d.cts +9 -9
- package/dist/extra/index.d.ts +9 -9
- package/dist/extra/index.js +1 -1
- package/dist/extra/node.cjs +3 -3
- package/dist/extra/node.d.cts +1 -1
- package/dist/extra/node.d.ts +1 -1
- package/dist/extra/node.js +1 -1
- package/dist/extra/operators.cjs +1 -1
- package/dist/extra/operators.d.cts +1 -1
- package/dist/extra/operators.d.ts +1 -1
- package/dist/extra/operators.js +1 -1
- package/dist/extra/reactive.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 +1 -1
- package/dist/extra/sources.d.ts +1 -1
- 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/graph/index.cjs +7 -6
- 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-D48Qw9Cg.d.cts → graph-C4Uxwv0T.d.cts} +22 -6
- package/dist/{graph-BZGRXwOm.d.ts → graph-CWeI0aHd.d.ts} +22 -6
- package/dist/{index-u15meRxL.d.cts → index-9iguV3bF.d.cts} +2 -2
- package/dist/{index-DyxjtScX.d.cts → index-B-z8WaSd.d.cts} +2 -2
- package/dist/{index-BgyGlizc.d.ts → index-B2HBxvMb.d.ts} +4 -4
- package/dist/{index-CzobVSMr.d.ts → index-B5iVOD7w.d.ts} +2 -2
- package/dist/{index-rX8HBM5h.d.cts → index-B8Aj_z8S.d.cts} +2 -2
- package/dist/{index-D-YB-Vl3.d.ts → index-BANwzwBV.d.ts} +3 -3
- package/dist/{index-HDpJe9hX.d.ts → index-BBINVimG.d.ts} +3 -3
- package/dist/{index-8FSVk4Uf.d.ts → index-BEpRsvhg.d.ts} +4 -4
- package/dist/{index-CHEswufn.d.cts → index-BHu_Wba0.d.cts} +4 -4
- package/dist/{index-ZftwfxJM.d.ts → index-BJHQUCZx.d.ts} +7 -7
- package/dist/{index-DUqMOlKZ.d.cts → index-BS220yqj.d.cts} +7 -7
- package/dist/{index-BWJV63ti.d.ts → index-BX22kvjh.d.ts} +1 -1
- package/dist/{index-DfyOkTvs.d.ts → index-BXbQUn4n.d.ts} +2 -2
- package/dist/{index-O6TgGUBV.d.cts → index-BpFWP7Bq.d.cts} +3 -3
- package/dist/{index-BxJ86YZZ.d.cts → index-Bs3-LC83.d.cts} +3 -3
- package/dist/{index-DiOXyAwt.d.ts → index-Bvi5uJxX.d.ts} +1 -1
- package/dist/{index-Bqachn9_.d.ts → index-ByPnK85n.d.ts} +1 -1
- package/dist/{index-CRO83MmV.d.cts → index-BydMDMf7.d.cts} +1 -1
- package/dist/{index-ROpQmGjE.d.ts → index-C5Ghnp5B.d.ts} +3 -3
- package/dist/{index-umtoWT8K.d.ts → index-C6NBfXj-.d.ts} +6 -5
- package/dist/{index-pXrDMpRO.d.cts → index-C98oJsEs.d.cts} +2 -2
- package/dist/{index-B2pwesl9.d.cts → index-CDK5RsV5.d.cts} +1 -1
- package/dist/{index-Czq6ynh8.d.ts → index-CFW32Dy1.d.ts} +3 -3
- package/dist/{index-Cyojz0AE.d.cts → index-CIXaiYDE.d.cts} +1 -1
- package/dist/{index-Oi8d8w4R.d.cts → index-CRAkoq-y.d.cts} +1 -1
- package/dist/{index-CpgYhnrG.d.ts → index-Cc8VQIgL.d.ts} +2 -2
- package/dist/{index-vscRDkjW.d.cts → index-CcpEvuPl.d.cts} +2 -2
- package/dist/{index-BpA5c4G9.d.ts → index-CfFYyLR8.d.ts} +4 -4
- package/dist/{index-9oDeHH2u.d.cts → index-ClB7TCfL.d.cts} +2 -2
- package/dist/{index-BHvIquRZ.d.ts → index-ClgKmOHe.d.ts} +592 -492
- package/dist/{index-DpHe5e0Q.d.ts → index-CotRMjtJ.d.ts} +2 -2
- package/dist/{index-B1AmmSlb.d.ts → index-CrC7urhX.d.ts} +1 -1
- package/dist/{index-B0c4cmIO.d.ts → index-CvS9IuTG.d.ts} +2 -2
- package/dist/{index-rHJSKsU8.d.cts → index-Cy7eFeIX.d.cts} +2 -2
- package/dist/{index-BVHOrDwO.d.ts → index-D0C_USMR.d.ts} +1 -1
- package/dist/{index-DEwTb_fm.d.cts → index-D6ajK8Mh.d.cts} +592 -492
- package/dist/{index-DL-rYJrx.d.cts → index-D7XxY1Ff.d.cts} +1 -1
- package/dist/{index-DAlweici.d.ts → index-D9HrBx2J.d.ts} +2 -2
- package/dist/{index-fM6y00vT.d.cts → index-D9Y_u6BG.d.cts} +3 -3
- package/dist/{index-DcXZBF5a.d.cts → index-DBQUKh59.d.cts} +4 -4
- package/dist/{index-D_NwnRYS.d.cts → index-DDo-eqQ4.d.cts} +1 -1
- package/dist/{index-m-yHof5p.d.ts → index-DGb1awva.d.ts} +4 -4
- package/dist/{index-DxsnAMWD.d.cts → index-DR3gf_DG.d.cts} +9 -9
- package/dist/{index-dtN7YA2x.d.cts → index-DVNLe3pS.d.cts} +3 -3
- package/dist/{index-Btib9rsU.d.ts → index-Dljd76bC.d.ts} +275 -9
- package/dist/{index-DP4ZTkdw.d.ts → index-DnrZghBB.d.ts} +3 -3
- package/dist/{index-DaLJvH8Z.d.ts → index-Docdiu9a.d.ts} +3 -3
- package/dist/{index-BpIFjILY.d.cts → index-DylQCKEL.d.cts} +4 -4
- package/dist/{index-B_agccPe.d.cts → index-FBqTfL_S.d.cts} +1 -1
- package/dist/{index-DraikLjn.d.ts → index-FrYrV-Vf.d.ts} +2 -2
- package/dist/{index-sm373fsH.d.ts → index-IZ3l_vQ9.d.ts} +2 -2
- package/dist/{index-BwM9BEkt.d.ts → index-Ip3q9T9x.d.ts} +1 -1
- package/dist/{index-CloUk1kY.d.ts → index-RQg6lTrN.d.ts} +9 -9
- package/dist/{index-CEXXwWVH.d.cts → index-SSGqF8mI.d.cts} +2 -2
- package/dist/{index-rnwQly8X.d.cts → index-UZO988ox.d.cts} +6 -5
- package/dist/{index-C73n7lo-.d.cts → index-iBp74eGU.d.cts} +3 -3
- package/dist/{index-tbf2gKHd.d.cts → index-lKuLYmHO.d.cts} +3 -3
- package/dist/{index-CMn8S8Hw.d.ts → index-wIx1Jisk.d.ts} +1 -1
- package/dist/{index-cByzxQIC.d.cts → index-yIdWFo2b.d.cts} +4 -4
- package/dist/{index-RukJ4DLS.d.cts → index-ybtSyjWB.d.cts} +275 -9
- package/dist/index.cjs +53 -52
- package/dist/index.d.cts +42 -42
- package/dist/index.d.ts +42 -42
- package/dist/index.js +1 -1
- package/dist/{meta-CwesDrMD.d.ts → meta-BMwx3ExI.d.ts} +1 -1
- package/dist/{meta-Cgj6zeji.d.cts → meta-COtmHLwT.d.cts} +1 -1
- package/dist/{node-Cc1TniY8.d.ts → node-BVV7G1bq.d.cts} +59 -2
- package/dist/{node-Cc1TniY8.d.cts → node-BVV7G1bq.d.ts} +59 -2
- package/dist/{observable-glXQoGj2.d.cts → observable-BrUAPeH_.d.cts} +1 -1
- package/dist/{observable-Ct-gJ9jI.d.ts → observable-ITikPXz3.d.ts} +1 -1
- package/dist/patterns/ai/browser.d.cts +3 -3
- package/dist/patterns/ai/browser.d.ts +3 -3
- package/dist/patterns/ai/browser.js +1 -1
- package/dist/patterns/ai/index.cjs +25 -24
- package/dist/patterns/ai/index.d.cts +15 -15
- package/dist/patterns/ai/index.d.ts +15 -15
- package/dist/patterns/ai/index.js +1 -1
- package/dist/patterns/ai/node.d.cts +1 -1
- package/dist/patterns/ai/node.d.ts +1 -1
- package/dist/patterns/ai/node.js +1 -1
- package/dist/patterns/audit/index.cjs +7 -6
- 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 +7 -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 +8 -7
- 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 +7 -6
- 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 +26 -25
- package/dist/patterns/graphspec/index.d.cts +4 -4
- package/dist/patterns/graphspec/index.d.ts +4 -4
- package/dist/patterns/graphspec/index.js +1 -1
- package/dist/patterns/guarded-execution/index.cjs +7 -6
- 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 -10
- package/dist/patterns/harness/index.d.cts +10 -7
- package/dist/patterns/harness/index.d.ts +10 -7
- package/dist/patterns/harness/index.js +1 -1
- package/dist/patterns/job-queue/index.cjs +7 -6
- 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 +7 -6
- 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 +7 -6
- 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 +7 -6
- 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 +7 -6
- 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 +8 -7
- 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 +7 -6
- 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 +9 -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 +14 -13
- package/dist/patterns/surface/index.d.cts +5 -5
- package/dist/patterns/surface/index.d.ts +5 -5
- package/dist/patterns/surface/index.js +1 -1
- package/dist/{reactive-layout-CpYb5qLP.d.cts → reactive-layout-5oEn8lHM.d.cts} +2 -2
- package/dist/{reactive-layout-D8u4wuUR.d.ts → reactive-layout-BAr6-_o5.d.ts} +2 -2
- package/dist/{reactive-log-DPzuUDj5.d.cts → reactive-log-5jFeNRmd.d.cts} +1 -1
- package/dist/{reactive-log-YuH9VYN8.d.ts → reactive-log-BOJDCI5x.d.ts} +1 -1
- package/dist/{reactive-map-CdbNoSgP.d.ts → reactive-map-BvDrRuwt.d.ts} +1 -1
- package/dist/{reactive-map-DUeRmb9d.d.cts → reactive-map-CmlPPKHN.d.cts} +1 -1
- package/dist/{resilience-CGRzhnD3.d.ts → resilience-CludlzcP.d.ts} +1 -1
- package/dist/{resilience-Ba5-b4WD.d.cts → resilience-Q6Bt_7y0.d.cts} +1 -1
- package/dist/{resilience-QAHKANT5.js → resilience-XRUF267O.js} +1 -1
- package/dist/{sugar-BV0htudb.d.cts → sugar-BHbAACDG.d.ts} +10 -12
- package/dist/{sugar-Dtyrq2_q.d.ts → sugar-CqR6DJ7v.d.cts} +10 -12
- package/dist/{topology-tree-DROUdq5B.d.cts → topology-tree-CVREibAc.d.cts} +1 -1
- package/dist/{topology-tree-CYHOwQZ_.d.ts → topology-tree-CkjojcB6.d.ts} +1 -1
- package/package.json +1 -1
- package/dist/chunk-6V3SEX2I.js +0 -1
- package/dist/chunk-7H6LGFUG.js +0 -64
- package/dist/chunk-CKCSDI7T.js +0 -6
- package/dist/chunk-QWAPKG3O.js +0 -2
- package/dist/chunk-RHESUC3V.js +0 -43
- package/dist/chunk-V6YQICXZ.js +0 -1
- package/dist/chunk-Z4HDAS2Q.js +0 -1
- package/dist/chunk-ZB5EHBIO.js +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { L as LLMAdapter, C as ChatMessage, a as LLMInvokeOptions } from './types-u64Ose53.js';
|
|
2
|
-
import { a as CircuitBreakerOptions, e as CircuitBreaker } from './resilience-
|
|
2
|
+
import { a as CircuitBreakerOptions, e as CircuitBreaker } from './resilience-CludlzcP.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* OpenAICompatAdapter — default fetch-backed, optional SDK-backed.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { L as LLMAdapter, C as ChatMessage, a as LLMInvokeOptions } from './types-O3GzJY2U.cjs';
|
|
2
|
-
import { a as CircuitBreakerOptions, e as CircuitBreaker } from './resilience-
|
|
2
|
+
import { a as CircuitBreakerOptions, e as CircuitBreaker } from './resilience-Q6Bt_7y0.cjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* OpenAICompatAdapter — default fetch-backed, optional SDK-backed.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{E as c,m,o as u}from"./chunk-
|
|
1
|
+
import{E as c,m,o as u}from"./chunk-W4TSQ6RJ.js";import{b as f,c as h}from"./chunk-CK2E7BTU.js";var p=class{_version=0;_store=new Map;_maxSize;_defaultTtl;constructor(t={}){let{maxSize:e,defaultTtl:i}=t;if(e!==void 0&&e<1)throw new RangeError("maxSize must be >= 1");if(i!==void 0&&i<=0)throw new RangeError("defaultTtl must be positive");this._maxSize=e,this._defaultTtl=i}get version(){return this._version}get size(){return this._store.size}has(t){let e=this._store.get(t);return e===void 0?!1:this._isExpired(e)?(this._store.delete(t),this._version+=1,!1):(this._touchLru(t,e),!0)}get(t){let e=this._store.get(t);if(e!==void 0){if(this._isExpired(e)){this._store.delete(t),this._version+=1;return}return this._touchLru(t,e),e.value}}set(t,e,i){let s=this._resolveExpiresAt(i);this._store.has(t)&&this._store.delete(t),this._store.set(t,{value:e,expiresAt:s}),this._evictLruWhileOver(),this._version+=1}setMany(t,e){let i=this._resolveExpiresAt(e),s=0;try{for(let[d,n]of t)this._store.has(d)&&this._store.delete(d),this._store.set(d,{value:n,expiresAt:i}),s+=1}finally{s>0&&(this._evictLruWhileOver(),this._version+=1)}}delete(t){let e=this._store.delete(t);return e&&(this._version+=1),e}deleteMany(t){let e=0;try{for(let i of t)this._store.delete(i)&&(e+=1)}finally{e>0&&(this._version+=1)}return e}clear(){let t=this._store.size;return t===0?0:(this._store.clear(),this._version+=1,t)}pruneExpired(){let t=u(),e=0;for(let[i,s]of this._store)this._isExpired(s,t)&&(this._store.delete(i),e+=1);return e>0&&(this._version+=1),e}toMap(){let t=u(),e=new Map;for(let[i,s]of this._store)this._isExpired(s,t)||e.set(i,s.value);return e}_resolveExpiresAt(t){let e=t??this._defaultTtl;if(e!==void 0){if(!Number.isFinite(e)||e<=0)throw new RangeError(`MapBackend: ttl must be a positive finite number (got ${e})`);return u()+e*1e9}}_isExpired(t,e){return t.expiresAt===void 0?!1:(e??u())>=t.expiresAt}_touchLru(t,e){this._store.delete(t),this._store.set(t,e)}_evictLruWhileOver(){if(this._maxSize!==void 0)for(;this._store.size>this._maxSize;){let t=this._store.keys().next().value;if(t===void 0)break;this._store.delete(t)}}};function x(v={}){let{name:t,maxSize:e,defaultTtl:i,versioning:s,backend:d}=v,n=d??new p({maxSize:e,defaultTtl:i}),l=c(n.toMap(),{name:t,describeKind:"state",equals:(r,a)=>r===a,...s!=null?{versioning:s}:{}});function _(){let r=n.toMap();m(()=>{l.down([[h]]),l.down([[f,r]])})}function o(r){let a=n.version;try{return r()}finally{n.version!==a&&_()}}return{entries:l,has(r){return o(()=>n.has(r))},get(r){return o(()=>n.get(r))},set(r,a,b){o(()=>n.set(r,a,b?.ttl))},setMany(r,a){o(()=>n.setMany(r,a?.ttl))},delete(r){o(()=>n.delete(r))},deleteMany(r){o(()=>n.deleteMany(r))},clear(){o(()=>n.clear())},pruneExpired(){o(()=>n.pruneExpired())},get size(){return n.size},dispose(){}}}export{p as a,x as b};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as k}from"./chunk-
|
|
1
|
+
import{c as k}from"./chunk-5Z4HDCO6.js";import{k as h}from"./chunk-MGKAO4EK.js";import{b as I}from"./chunk-AUY2YKCO.js";import{A as p}from"./chunk-KASHOCF5.js";import{D as w,E as f,G as d,m as x}from"./chunk-W4TSQ6RJ.js";import{i as y}from"./chunk-CK2E7BTU.js";import{b as M}from"./chunk-QYADASLV.js";var C={};M(C,{MessagingHubGraph:()=>v,SubscriptionGraph:()=>T,TopicBridgeGraph:()=>g,TopicGraph:()=>l,messagingHub:()=>L,subscription:()=>G,topic:()=>P,topicBridge:()=>S});var N=2147483647;function m(n,t){if(!Number.isFinite(n)||!Number.isInteger(n)||n<0)throw new Error(`${t} must be a non-negative integer`);return n}function o(n,t){return k("messaging",n,t)}var l=class extends h{_log;events;latest;hasLatest;constructor(t,e={}){super(t,e.graph),this._log=I([],{name:"events",maxSize:e.retainedLimit}),this.events=this._log.entries,this.add(this.events,{name:"events"}),this.latest=d([this.events],([i])=>{let s=i;return s.length===0?null:s[s.length-1]},{name:"latest",describeKind:"derived",meta:o("topic_latest")}),this.add(this.latest,{name:"latest"}),this.addDisposer(p(this.latest)),this.hasLatest=d([this.events],([i])=>i.length>0,{name:"hasLatest",describeKind:"derived",meta:o("topic_has_latest")}),this.add(this.hasLatest,{name:"hasLatest"}),this.addDisposer(p(this.hasLatest)),this.addDisposer(()=>{this.events.down([[y]])}),this.addDisposer(()=>this._log.disposeAllViews())}publish(t){this._log.append(t)}retained(){return this.events.cache}},T=class extends h{source;cursor;available;topic;constructor(t,e,i={}){super(t,i.graph);let s=m(i.cursor??0,"subscription cursor");this.topic=e;let r=e.events;this.source=d([r],([u])=>u,{name:"source",describeKind:"derived",meta:o("subscription_source"),initial:r.cache}),this.add(this.source,{name:"source"}),this.cursor=f(s,{name:"cursor",describeKind:"state",meta:o("subscription_cursor")}),this.add(this.cursor,{name:"cursor"}),this.available=d([this.source,this.cursor],([u,b])=>{let a=u,c=Math.max(0,Math.trunc(b??0));return a.slice(c)},{name:"available",describeKind:"derived",meta:o("subscription_available"),initial:[]}),this.add(this.available,{name:"available"}),this.addDisposer(p(this.source)),this.addDisposer(p(this.available))}ack(t){let e=this.available.cache,i=t===void 0?e.length:m(t,"subscription ack count"),s=Math.min(i,e.length);if(s<=0)return this.cursor.cache;let r=this.cursor.cache+s;return this.cursor.emit(r),r}pull(t,e={}){let i=this.available.cache,s=t===void 0?i.length:m(t,"subscription pull limit"),r=i.slice(0,s);return e.ack&&r.length>0&&this.ack(r.length),r}},g=class extends h{_sourceSub;_target;bridgedCount;constructor(t,e,i,s={}){super(t,s.graph),this._sourceSub=G(`${t}-subscription`,e,{cursor:s.cursor}),this._target=i,this.mount("subscription",this._sourceSub),this.bridgedCount=f(0,{name:"bridgedCount",describeKind:"state",meta:o("topic_bridge_count")}),this.add(this.bridgedCount,{name:"bridgedCount"});let r=Math.max(1,m(s.maxPerPump??N,"topic bridge maxPerPump")),u=s.map??(a=>a),b=w([this._sourceSub.available],()=>{let a=this._sourceSub.pull(r,{ack:!0});if(a.length===0)return;let c=0;for(let _ of a){let O=u(_);O!==void 0&&(this._target.publish(O),c+=1)}if(c>0){let _=this.bridgedCount.cache;this.bridgedCount.emit(_+c)}},{name:"pump",describeKind:"effect",meta:o("topic_bridge_pump")});this.add(b,{name:"pump"}),this.addDisposer(p(b))}},v=class extends h{_topics=new Map;_version=0;_defaultTopicOptions;constructor(t,e={}){super(t,e.graph),this._defaultTopicOptions={...e.defaultTopicOptions??{}}}get version(){return this._version}get size(){return this._topics.size}has(t){return this._topics.has(t)}topicNames(){return this._topics.keys()}topic(t,e){let i=this._topics.get(t);if(i===void 0){let s={...this._defaultTopicOptions,...e??{}};i=new l(t,s),this._topics.set(t,i),this.mount(t,i),this._version+=1}return i}publish(t,e){this.topic(t).publish(e)}publishMany(t){x(()=>{for(let[e,i]of t)this.topic(e).publish(i)})}subscribe(t,e,i){let s=this.topic(e);return new T(t,s,i)}removeTopic(t){if(!this._topics.has(t))return!1;try{this.remove(t)}finally{this._topics.delete(t),this._version+=1}return!0}};function P(n,t){return new l(n,t)}function L(n,t){return new v(n,t)}function G(n,t,e){return new T(n,t,e)}function S(n,t,e,i){return new g(n,t,e,i)}export{l as a,T as b,g as c,v as d,P as e,L as f,G as g,S as h,C as i};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import{a as me}from"./chunk-AMBYCIOH.js";import{u as Q}from"./chunk-LI3E75VE.js";import{a as pe}from"./chunk-4OFIQ66T.js";import{e as fe}from"./chunk-VWPRPPKR.js";import{a as M}from"./chunk-33FA6V4B.js";import{b as J,d as K}from"./chunk-5Z4HDCO6.js";import{g as le,k as Y}from"./chunk-MGKAO4EK.js";import{b as A,q as G,r as ce,v as $}from"./chunk-5JDE5JHE.js";import{b as de}from"./chunk-2GQREQ6C.js";import{m as ue}from"./chunk-KASHOCF5.js";import{D as ie,E as b,G as k,H as C,o as L}from"./chunk-W4TSQ6RJ.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
|
+
|
|
3
|
+
Given an intake item, classify it and output JSON:
|
|
4
|
+
{
|
|
5
|
+
"rootCause": "composition" | "missing-fn" | "bad-docs" | "schema-gap" | "regression" | "unknown",
|
|
6
|
+
"intervention": "template" | "catalog-fn" | "docs" | "wrapper" | "schema-change" | "investigate",
|
|
7
|
+
"route": "auto-fix" | "needs-decision" | "investigation" | "backlog",
|
|
8
|
+
"priority": <number 0-100>,
|
|
9
|
+
"triageReasoning": "<one sentence>"
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
Strategy model (past effectiveness):
|
|
13
|
+
{{strategy}}
|
|
14
|
+
|
|
15
|
+
Intake item:
|
|
16
|
+
{{item}}`,Pe=`You are an implementation agent.
|
|
17
|
+
|
|
18
|
+
Given a triaged issue with root cause and intervention type, produce a fix.
|
|
19
|
+
|
|
20
|
+
Issue:
|
|
21
|
+
{{item}}
|
|
22
|
+
|
|
23
|
+
Output JSON:
|
|
24
|
+
{
|
|
25
|
+
"outcome": "success" | "failure" | "partial",
|
|
26
|
+
"detail": "<description of what was done or what failed>"
|
|
27
|
+
}`,je=`You are a QA reviewer.
|
|
28
|
+
|
|
29
|
+
Given an execution result, verify whether the fix is correct.
|
|
30
|
+
|
|
31
|
+
Execution:
|
|
32
|
+
{{execution}}
|
|
33
|
+
|
|
34
|
+
Original issue:
|
|
35
|
+
{{item}}
|
|
36
|
+
|
|
37
|
+
Output JSON:
|
|
38
|
+
{
|
|
39
|
+
"verified": true/false,
|
|
40
|
+
"findings": ["<finding1>", ...],
|
|
41
|
+
"errorClass": "self-correctable" | "structural" // only if verified=false
|
|
42
|
+
}`;function ge(t,e){let r=e??(n=>Pe.replace("{{item}}",JSON.stringify(n)));return n=>Q(t,[n],r,{name:"execute",format:"json",retries:1})}function ye(t,e){let r=e??(n=>{let[a,d]=n;return je.replace("{{execution}}",JSON.stringify(a)).replace("{{item}}",JSON.stringify(d))});return n=>Q(t,[n],r,{name:"verify",format:"json",retries:1})}var U=class extends Y{intake;queues;gates;strategy;verifyResults;totalRetries;totalReingestions;constructor(e,r,n,a,d,i,o,s){super(e),this.intake=r,this.queues=n,this.gates=a,this.strategy=d,this.verifyResults=i,this.totalRetries=o,this.totalReingestions=s}};function Fe(t,e){let r=e.adapter,n=e.maxRetries??2,a=e.retainedLimit??1e3,d=e.errorClassifier??W,i=new Map;for(let p of N)i.set(p,{...Z[p],...e.queues?.[p]});let o=new M("intake",{retainedLimit:a}),s=ee(),u=G(o.latest,s.node),f=Q(r,[u],e.triagePrompt??(p=>{let[x,R]=p;return x?Me.replace("{{strategy}}",JSON.stringify(Array.from(R.entries()))).replace("{{item}}",JSON.stringify(x)):""}),{name:"triage",format:"json",retries:1}),l=new Map;for(let p of N)l.set(p,new M(`queue/${p}`,{retainedLimit:a}));let c=G(f,u),I=C([c],([p])=>{if(p==null)return;let[x,R]=p;if(!x?.route)return;let _=R?.[0],w={...x,..._},D=l.get(w.route);D&&D.publish(w)}).subscribe(()=>{}),g=new Y("gates"),E=new Map;for(let p of N){let x=i.get(p),R=l.get(p);if(x.gated){g.add(R.latest,{name:`${p}/source`});let _=fe(g,`${p}/gate`,`${p}/source`,{maxPending:x.maxPending,startOpen:x.startOpen});E.set(p,_)}}let T=new M("retry-input",{retainedLimit:a}),h=[];for(let p of N)i.get(p).gated&&E.has(p)?h.push(E.get(p).node):h.push(l.get(p).latest);h.push(T.latest);let S=ce(...h),te=(e.executor??ge(r,e.executePrompt))(S),re=G(te,S),F=new M("verify-results",{retainedLimit:a}),ne=(e.verifier??ye(r,e.verifyPrompt))(re),xe=G(ne,re),oe=e.maxReingestions??1,Ee=Math.min(e.maxTotalRetries??n*10,100),Te=Math.min(e.maxTotalReingestions??oe*10,100),se=b(0),ae=b(0),he=ie([xe],(p,x)=>{let R=p[0];if(R==null||R.length===0)return;let _=R[R.length-1];if(_==null)return;let[w,D]=_,[B,y]=D??[null,null];if(!w||!y)return;let Re={item:y,outcome:B?.outcome??"failure",detail:B?.detail??"unknown",artifact:B?.artifact},O={item:y,execution:Re,verified:w.verified,findings:w.findings??[],errorClass:w.errorClass};if(O.verified){s.record(y.rootCause,y.intervention,!0),F.publish(O);return}let ke=O.errorClass??d({item:y,outcome:"failure",detail:O.findings.join("; ")}),q=y._retries??0;if(ke==="self-correctable"&&q<n&&J(se,Ee)){let V=K(y),H={...y,_retries:q+1,summary:`[RETRY ${q+1}/${n}] ${V} \u2014 Previous attempt failed: ${O.findings.join("; ")}`,relatedTo:[V]};T.publish(H)}else{s.record(y.rootCause,y.intervention,!1),F.publish(O);let V=K(y),H=y._reingestions??0;H<oe&&J(ae,Te)&&o.publish({source:"eval",summary:`Verification failed for: ${V}`,evidence:O.findings.join(`
|
|
43
|
+
`),affectsAreas:y.affectsAreas,affectsEvalTasks:y.affectsEvalTasks,severity:"high",relatedTo:[V],_reingestions:H+1})}}).subscribe(()=>{}),v=new U(t,o,l,E,s,F,se,ae);v.addDisposer(I),v.addDisposer(he),v.addDisposer(s.dispose),v.add(f,{name:"triage"}),v.add(te,{name:"execute"}),v.add(ne,{name:"verify"}),v.add(s.node,{name:"strategy"}),v.mount("intake",o);for(let[p,x]of l)v.mount(`queue/${p}`,x);return v.mount("gates",g),v.mount("retry-input",T),v.mount("verify-results",F),v}function De(t,e){let r=le(t,e),n={};for(let[a,d]of t.queues)n[a]=d.retained().length;return{...r,queueDepths:n,strategyEntries:t.strategy.node.cache?.size??0,totalRetries:t.totalRetries.cache??0,totalReingestions:t.totalReingestions.cache??0}}function He(t){let{best:e,score:r,status:n}=t,a=Number.isFinite(r)?r.toFixed(3):String(r);return n==="converged"?{outcome:"success",detail:`refineLoop converged at score ${a}`,artifact:e}:n==="budget"?{outcome:"partial",detail:`refineLoop hit budget at score ${a}`,artifact:e}:{outcome:"failure",detail:`refineLoop errored (status=${n})`,artifact:e}}function Qe(t){let e=t.name??"refine-executor",r=t.toOutput??He;return n=>{let a=A(n,i=>i!=null),d=$(a,i=>{let o=me(t.seedFrom(i),t.evaluator,t.strategy,{...t.refine,dataset:t.datasetFor(i),name:`${e}/inner`});return k([o.status,o.best,o.score],([s,u,f])=>{let l=s;return l!=="converged"&&l!=="budget"&&l!=="errored"?null:r({best:u,score:f,status:l})},{name:`${e}/output`})},{name:e});return A(d,i=>i!=null)}}function Ue(t){let e={"intake::latest":"INTAKE",triage:"TRIAGE",execute:"EXECUTE","verify-results::latest":"VERIFY",strategy:"STRATEGY"};for(let r of N)e[`queue/${r}::latest`]="QUEUE";for(let[r]of t.gates)e[`gates::${r}/gate`]="GATE";return e}function Be(t,e){let r=e?.logger===null?null:e?.logger??console.log,n=e?.detail??"summary",a=L(),d=[],i=[],o=Ue(t);function s(){return(L()-a)/1e9}function u(f,l,c){let m={elapsed:s(),stage:f,type:l};n!=="summary"&&(m.summary=qe(c)),n==="full"&&(m.data=c),i.push(m)}for(let[f,l]of Object.entries(o))try{let c=t.observe(f,{format:"stage-log",stageLabels:o,logger:r?m=>r(m):()=>{},includeTypes:["data","error","complete"]});c.onEvent(m=>{m.type==="data"?u(l,"data",m.data):m.type==="error"?u(l,"error",m.data):m.type==="complete"&&u(l,"complete",void 0)}),d.push(c)}catch(c){let m=c instanceof Error?c.message:String(c);u(l,"error",`observe-unavailable: ${f} \u2014 ${m}`),r&&r(`[${s().toFixed(3)}s] ${l.padEnd(9)} \u2717 observe-unavailable: ${m}`)}return{get events(){return i},dispose(){for(let f of d)f.dispose();d.length=0}}}function qe(t){if(t==null)return"null";if(typeof t=="string")return ve(t,80);if(typeof t=="number"||typeof t=="boolean"||typeof t=="bigint")return String(t);try{let e=JSON.stringify(t);return ve(e,120)}catch{return String(t)}}function ve(t,e){return t.length>e?`${t.slice(0,e-1)}\u2026`:t}export{be as a,Ne as b,Se as c,we as d,Oe as e,Ce as f,_e as g,Le as h,N as i,P as j,W as k,z as l,X as m,Z as n,ee as o,Ge as p,ge as q,ye as r,U as s,Fe as t,De as u,Qe as v,Be as w,Ye as x};
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import{a as an}from"./chunk-LQ3Y5NJS.js";import{a as Qt,b as Jt}from"./chunk-UPHHLMHE.js";import{a as $e,b as we,c as _e,d as Qe,e as Je,f as Ye,g as Ge,h as Xe,i as Se,j as Ze,k as er,l as rr}from"./chunk-4GKB4OUJ.js";import{a as en,b as rn}from"./chunk-K2GNMCQT.js";import{a as wr,b as tt}from"./chunk-5QDBSZBV.js";import{a as tr}from"./chunk-CKCSDI7T.js";import{a as Ve}from"./chunk-ESMPEKEV.js";import{a as tn,b as nn,c as on,d as sn}from"./chunk-I6VIH3VA.js";import{A as Nt,B as Ot,C as Rt,D as Mt,E as Pt,G as Ct,H as Lt,I as At,J as Bt,K as It,L as Ft,M as Wt,N as zt,O as Ht,P as Ut,Q as Kt,R as jt,S as Dt,T as qt,U as Vt,a as xe,b as Ie,c as st,d as it,e as at,f as ct,g as ut,h as dt,i as Fe,j as lt,k as ft,l as pt,m as mt,n as gt,o as Tt,p as yt,q as kt,r as We,s as bt,t as ht,u as vt,v as ge,w as wt,x as St,y as xt,z as Et}from"./chunk-Z4HDAS2Q.js";import{a as ne,b as ve,c as Er,d as Nr,e as Or,f as Rr,g as Mr,h as Pr,i as Be}from"./chunk-4VVTGLXJ.js";import{a as Yt,b as Gt}from"./chunk-PIOGHC63.js";import{a as Xt,b as Zt}from"./chunk-VTPVOGHH.js";import{a as $t,b as _t}from"./chunk-OAWLCNJJ.js";import{a as nt,b as ot}from"./chunk-D7A7DBE4.js";import{A as et,B as rt,a as Sr,b as xr,c as Cr,d as Lr,e as Ar,f as oe,g as Br,h as Ir,i as Fr,j as Wr,k as zr,l as Hr,m as Ur,n as Kr,o as jr,p as Dr,q as qr,r as Vr,s as $r,t as _r,u as Qr,v as Jr,w as Yr,x as Gr,y as Xr,z as Zr}from"./chunk-2PMCKKRK.js";import{A as G,D as re,E as B,F as W,H as he,m as j,p as V}from"./chunk-ZB5EHBIO.js";import{b as x,c as Me,d as Pe,e as Ce,f as Le,g as Ae,h as q,i as C,j as E}from"./chunk-CK2E7BTU.js";import{b as vr}from"./chunk-QYADASLV.js";var lo={};vr(lo,{CircuitOpenError:()=>_e,NS_PER_MS:()=>ne,NS_PER_SEC:()=>ve,NativeIndexBackend:()=>Yt,NativeListBackend:()=>Xt,NativeLogBackend:()=>nt,NativeMapBackend:()=>$t,NativePubSubBackend:()=>Ee,RateLimiterOverflowError:()=>Ge,ResettableTimer:()=>Ve,TimeoutError:()=>Ze,audit:()=>Pt,awaitSettled:()=>Xr,buffer:()=>Ct,bufferCount:()=>Lt,bufferTime:()=>Bt,cached:()=>Jr,cascadingCache:()=>oo,catchError:()=>Vt,checkpointToRedis:()=>Gn,checkpointToS3:()=>Yn,circuitBreaker:()=>Qe,combine:()=>yt,combineLatest:()=>jt,concat:()=>ht,concatMap:()=>St,constant:()=>Er,createTransport:()=>ie,createWatermarkController:()=>tt,csvRows:()=>An,debounce:()=>Ot,debounceTime:()=>Dt,decorrelatedJitter:()=>Mr,delay:()=>Nt,deserializeError:()=>fe,dictStorage:()=>sn,distill:()=>Jt,distinctUntilChanged:()=>gt,elementAt:()=>pt,empty:()=>jr,escapeRegexChar:()=>Cr,exhaustMap:()=>wt,exponential:()=>Or,externalBundle:()=>ze,externalProducer:()=>ae,fallback:()=>er,fibonacci:()=>Rr,filter:()=>Ie,find:()=>ft,first:()=>Fe,firstValueFrom:()=>Yr,firstWhere:()=>Gr,flatMap:()=>Et,forEach:()=>Vr,fromAny:()=>Ur,fromAsyncIter:()=>Hr,fromCSV:()=>Ln,fromClickHouseWatch:()=>Fn,fromCron:()=>Ir,fromDrizzle:()=>to,fromEvent:()=>Fr,fromHTTP:()=>sr,fromHTTPPoll:()=>Tn,fromHTTPStream:()=>gn,fromIter:()=>Wr,fromKafka:()=>Rn,fromKysely:()=>no,fromMCP:()=>bn,fromNATS:()=>Hn,fromNDJSON:()=>In,fromOTel:()=>hn,fromPrisma:()=>ro,fromPrometheus:()=>Nn,fromPromise:()=>zr,fromPulsar:()=>Wn,fromRabbitMQ:()=>Kn,fromRaf:()=>Br,fromRedisStream:()=>Pn,fromSSE:()=>mn,fromSqlite:()=>Xn,fromSqliteCursor:()=>Zn,fromStatsD:()=>Sn,fromSyslog:()=>vn,fromTimer:()=>oe,fromWebSocket:()=>or,fromWebSocketReconnect:()=>kn,fromWebhook:()=>un,globToRegExp:()=>Lr,interval:()=>Wt,keepalive:()=>et,last:()=>lt,linear:()=>Nr,lru:()=>lr,map:()=>xe,matchesAnyPattern:()=>Ar,matchesCron:()=>xr,memoryStorage:()=>on,merge:()=>We,mergeMap:()=>xt,nameToSignal:()=>de,ndjsonRows:()=>Bn,never:()=>Dr,of:()=>Kr,pairwise:()=>Tt,parseCron:()=>Sr,parsePrometheusText:()=>cr,parseStatsD:()=>En,parseSyslog:()=>wn,pausable:()=>Ht,pubsub:()=>so,race:()=>vt,rateLimiter:()=>Xe,reactiveCounter:()=>rt,reactiveIndex:()=>Gt,reactiveList:()=>Zt,reactiveLog:()=>ot,reactiveMap:()=>_t,reactiveSink:()=>U,reduce:()=>it,repeat:()=>zt,replay:()=>Qr,rescue:()=>Ut,resolveBackoffPreset:()=>Be,retry:()=>$e,retrySource:()=>we,sample:()=>Mt,scan:()=>st,serializeError:()=>le,share:()=>_r,shareReplay:()=>Zr,signalToName:()=>se,singleFromAny:()=>en,singleNodeFromAny:()=>rn,skip:()=>ct,sortJsonValue:()=>tn,stableJsonString:()=>nn,stratify:()=>an,switchMap:()=>ge,take:()=>at,takeUntil:()=>dt,takeWhile:()=>ut,tap:()=>mt,throttle:()=>Rt,throttleTime:()=>qt,throwError:()=>qr,timeout:()=>rr,toArray:()=>$r,toCSV:()=>Dn,toClickHouse:()=>qn,toFile:()=>dr,toHTTP:()=>dn,toKafka:()=>Mn,toLoki:()=>Qn,toMongo:()=>_n,toNATS:()=>Un,toObservable:()=>wr,toPostgres:()=>$n,toPulsar:()=>zn,toRabbitMQ:()=>jn,toReadableStream:()=>pn,toRedisStream:()=>Cn,toS3:()=>Vn,toSSE:()=>ln,toSSEBytes:()=>fn,toSqlite:()=>eo,toTempo:()=>Jn,toWebSocket:()=>yn,tokenBucket:()=>Ye,valve:()=>Kt,verifiable:()=>Qt,window:()=>Ft,windowCount:()=>At,windowTime:()=>It,withBreaker:()=>Je,withLatestFrom:()=>kt,withMaxAttempts:()=>Pr,withStatus:()=>Se,workerBridge:()=>pr,workerSelf:()=>mr,zip:()=>bt});function nr(e){return{describeKind:"producer",...e}}function ae(e,t){return W(n=>{let a=!0,c={emit(o){a&&n.emit(o)},error(o){a&&(a=!1,n.down([[E,o]]))},complete(){a&&(a=!1,n.down([[C]]))}},r;try{let o=e(c);r=typeof o=="function"?o:void 0}catch(o){return c.error(o),()=>{a=!1}}return()=>{a=!1;try{r?.()}catch{}}},nr(t))}function ze(e,t,n){let a=!0,c,r=0,o=0,s={},d=[],i=()=>{let l=c;c=void 0;try{l?.()}catch{}};for(let l of t){let m=n?.name?`${n.name}::${l}`:l,h=n?.channelOpts?.[l],b=W(g=>(r++,()=>{o++,r>0&&o>=r&&o>=t.length&&i()}),nr({...h,name:m}));s[l]=b,d.push(b)}let p={};for(let l of t)p[l]=m=>{a&&s[l].down([[x,m]])};p.error=l=>{a&&(a=!1,j(()=>{for(let m of d)m.down([[E,l]])}),i())},p.complete=()=>{a&&(a=!1,j(()=>{for(let l of d)l.down([[C]])}),i())};let f=e(p);return c=typeof f=="function"?f:void 0,Object.assign(s,{dispose:()=>{a&&(a=!1,j(()=>{for(let l of d)try{l.down([[C]])}catch{}}),i())}})}var He=class{ring;arr;constructor(t){t===Number.POSITIVE_INFINITY||t<=0?(this.arr=[],this.ring=null):(this.ring=new tr(t),this.arr=null)}get length(){return this.ring!=null?this.ring.size:this.arr.length}push(t){this.ring!=null?this.ring.push(t):this.arr.push(t)}shift(){return this.ring!=null?this.ring.shift():this.arr.shift()}drain(){if(this.ring!=null){let n=this.ring.toArray();return this.ring.clear(),n}let t=this.arr;return this.arr=[],t}};function Te(e){return e instanceof Error?e:new Error(String(e))}function cn(e){return e===void 0?null:typeof e=="string"?Be(e):e}function U(e,t){let{name:n,onTransportError:a,retry:c,backpressure:r,batchSize:o=Number.POSITIVE_INFINITY,flushIntervalMs:s=0,serialize:d,stopOn:i,onUpstreamMessage:p,onDispose:f,send:u,sendBatch:l,ctx:m}=t;if(!u&&!l)throw new Error("reactiveSink: `send` or `sendBatch` must be provided");let h=m,b=Math.max(1,c?.maxAttempts??1),g=cn(c?.backoff??(b>1?"exponential":void 0)),T=c?.shouldRetry??(()=>!0),y=l!==void 0||o<Number.POSITIVE_INFINITY||s>0,k=S=>n?`${n}::${S}`:void 0,v=B(void 0,{equals:()=>!1,name:k("sent")}),w=B(null,{name:k("failed")}),N=B(0,{name:k("inFlight")}),O=B(null,{name:k("errors")}),H=y?B(0,{name:k("buffered")}):void 0,z=r?B(!1,{name:k("paused")}):void 0,J=0,Y=S=>{J+=S,N.down([[x,J]])},R=S=>{try{a?.(S)}catch{}try{O.down([[x,S]])}catch{}},D=new Set,X=S=>{D.add(S);let M=()=>D.delete(S);S.then(M,M)},F=(S,M,L)=>{let I=g?g(M-1,L,null):0,K=I==null?0:typeof I=="number"&&I>0?I:0,_=Math.max(1,Math.ceil(K/1e6));return new Promise(A=>{setTimeout(()=>A(S()),_)})},$=S=>S!=null&&typeof S=="object"&&typeof S.then=="function",Z=S=>{let M;try{M=d?d(S):S}catch(A){let P=Te(A);return R({stage:"serialize",error:P,value:S}),w.down([[x,{value:S,error:P,attempts:0}]]),Promise.resolve()}let L=0,I=A=>{Y(-1);let P=Te(A);if(R({stage:"send",error:P,value:S,attempt:L}),!(L<b&&T(P,L))){w.down([[x,{value:S,error:P,attempts:L}]]);return}return F(_,L,P)},K=()=>{Y(-1),v.down([[x,S]])};function _(){L+=1,Y(1);let A;try{A=u(M,h)}catch(P){return I(P)??Promise.resolve()}return $(A)?A.then(K,P=>I(P)):(K(),Promise.resolve())}return _()},pe=r?.maxBuffer??Number.POSITIVE_INFINITY,te=new He(pe),ee,ye=!1,Ne=()=>{H?.down([[x,te.length]])},ke=S=>{z&&z.down([[x,S]])},Ke=r?.strategy??"drop-oldest",gr=(S,M)=>{let L={value:S,payload:M};if(te.length<pe)return te.push(L),Ne(),!0;if(Ke==="drop-oldest"){let K=te.shift();return te.push(L),Ne(),ke(!0),w.down([[x,{value:K.value,error:new Error("backpressure: buffer overflow \u2014 dropped oldest"),attempts:0}]]),!0}if(Ke==="drop-newest")return ke(!0),w.down([[x,{value:S,error:new Error("backpressure: buffer overflow \u2014 dropped newest"),attempts:0}]]),!1;let I=new Error("backpressure: buffer overflow");return R({stage:"send",error:I,value:S}),w.down([[x,{value:S,error:I,attempts:0}]]),ke(!0),!1},Tr=S=>{let M=0,L=S.map(A=>A.payload),I=A=>{Y(-1);let P=Te(A);if(R({stage:"send",error:P,value:S.map(Re=>Re.value),attempt:M}),!(M<b&&T(P,M))){for(let{value:Re}of S)w.down([[x,{value:Re,error:P,attempts:M}]]);return}return F(_,M,P)},K=()=>{Y(-1);for(let{value:A}of S)v.down([[x,A]])};function _(){M+=1,Y(1);let A;try{A=l(L,h)}catch(P){return I(P)??Promise.resolve()}return $(A)?A.then(K,P=>I(P)):(K(),Promise.resolve())}return _()},yr=async S=>{for(let M of S)await kr(M.value,M.payload)},kr=(S,M)=>{let L=0,I=A=>{Y(-1);let P=Te(A);if(R({stage:"send",error:P,value:S,attempt:L}),!(L<b&&T(P,L))){w.down([[x,{value:S,error:P,attempts:L}]]);return}return F(_,L,P)},K=()=>{Y(-1),v.down([[x,S]])};function _(){L+=1,Y(1);let A;try{A=u(M,h)}catch(P){return I(P)??Promise.resolve()}return $(A)?A.then(K,P=>I(P)):(K(),Promise.resolve())}return _()},me=()=>{if(ye||te.length===0)return Promise.resolve();let S=te.drain();if(Ne(),ke(!1),l!==void 0){let L=Tr(S);return X(L),L}let M=yr(S);return X(M),M},br=()=>{ee!==void 0||ye||s<=0||(ee=setTimeout(()=>{ee=void 0,me()},s))},hr=e.subscribe(S=>{for(let M of S){let L=M[0];if(L!==x)try{p?.(M)}catch{}if(L===x){let I=M[1];if(y){let K;if(d)try{K=d(I)}catch(A){let P=Te(A);R({stage:"serialize",error:P,value:I}),w.down([[x,{value:I,error:P,attempts:0}]]);continue}else K=I;if(!gr(I,K))continue;te.length>=o?me():br()}else{let K=Z(I);X(K)}}else G.messageTier(L)>=3&&y&&(ee!==void 0&&(clearTimeout(ee),ee=void 0),me())}}),je;if(i){let S=!1;je=i.subscribe(M=>{if(!S){S=!0;return}M.length>0&&!Oe&&De()})}let Oe=!1,De=()=>{if(Oe)return;Oe=!0,ee!==void 0&&(clearTimeout(ee),ee=void 0),y&&me(),ye=!0,je?.(),hr();let S=M=>{try{M.down([[q]])}catch{}};S(O),S(w),S(v),S(N),H&&S(H),z&&S(z);try{f?.()}catch{}},be={dispose:De,sent:v,failed:w,inFlight:N,errors:O};return y&&(be.buffered=H,be.flush=async()=>{ye||(await me(),await Promise.all(D))}),z&&(be.paused=z),be}function Q(e){return{describeKind:"producer",...e}}function or(e,t){let{parse:n,closeOnTeardown:a=!1,...c}=t??{};return W(r=>{let o=!0,s,d=()=>{let g=s;s=void 0,g?.()},i=g=>{o&&(o=!1,r.down([g]),d())},p=(g,T=g)=>{if(o)try{let y=g!==null&&typeof g=="object"&&"data"in g?g.data:g,k=n?n(y,T):y;r.emit(k)}catch(y){i([E,y])}},f=g=>{i([E,g])},u=()=>{i([C])};if(typeof e=="function"){try{if(s=e(p,f,u),typeof s!="function")throw new Error("fromWebSocket register contract violation: register must return cleanup callable")}catch(g){i([E,g])}return()=>{o=!1,d()}}let l=e,m=g=>p(g,g),h=g=>f(g),b=()=>u();return l.addEventListener("message",m),l.addEventListener("error",h),l.addEventListener("close",b),s=()=>{l.removeEventListener("message",m),l.removeEventListener("error",h),l.removeEventListener("close",b),a&&l.close()},()=>{o=!1,d()}},Q(c))}function un(e,t){return ae(e,t)}function sr(e,t){let{method:n="GET",headers:a,body:c,transform:r=y=>y.json(),timeoutNs:o=30*1e9,signal:s,completeAfterFetch:d=!1,refetchOnSubscribe:i=!1,...p}=t??{},f=B(0,{name:`${p.name??"http"}/fetchCount`}),u=B(0,{name:`${p.name??"http"}/lastUpdated`}),l=B(!1,{name:`${p.name??"http"}/fetched`}),m=0,h=c!==void 0?typeof c=="string"?c:JSON.stringify(c):void 0,b=y=>{let k=new AbortController,v=!0;if(s?.aborted)return v=!1,y.down([[E,s.reason??new Error("Aborted")]]),()=>{};s?.addEventListener("abort",()=>k.abort(s.reason),{once:!0});let w=setTimeout(()=>k.abort(new Error("Request timeout")),Math.ceil(o/1e6));return fetch(e,{method:n,headers:a,body:h,signal:k.signal}).then(async N=>{if(clearTimeout(w),!v)return;if(!N.ok)throw new Error(`HTTP ${N.status}: ${N.statusText}`);let O=await r(N);v&&(j(()=>{m+=1,f.down([[x,m]]),u.down([[x,V()]]),l.down([[x,!0]]),y.emit(O)}),d&&y.down([[C]]))}).catch(N=>{clearTimeout(w),v&&(N&&N.name==="AbortError"||y.down([[E,N]]))}),()=>{v=!1,k.abort()}},g=W(y=>b({emit:k=>y.emit(k),down:k=>y.down(k)}),{...Q(p),resubscribable:i});return{...Se(g),fetchCount:f,lastUpdated:u,fetched:l}}function dn(e,t,n){let{method:a="POST",headers:c={"Content-Type":"application/json"},serialize:r=m=>JSON.stringify(m),timeoutNs:o,batchFormat:s="json-array",batchSize:d,flushIntervalMs:i,retry:p,onTransportError:f}=n??{},u=async m=>{let h=o!==void 0?new AbortController:void 0,b;h&&o!==void 0&&(b=setTimeout(()=>h.abort(new Error("Request timeout")),Math.ceil(o/1e6)));try{let g=await fetch(t,{method:a,headers:c,body:m,signal:h?.signal}),T=async()=>{try{await g.arrayBuffer?.()}catch{}};if(!g.ok)throw await T(),new Error(`HTTP ${g.status}: ${g.statusText}`);await T()}finally{b!==void 0&&clearTimeout(b)}};return d!==void 0||i!==void 0?U(e,{onTransportError:f,retry:p,batchSize:d,flushIntervalMs:i,sendBatch:async m=>{let h;s==="ndjson"?h=m.map(b=>{let g=r(b);return typeof g=="string"?g:new TextDecoder().decode(g)}).join(`
|
|
2
|
-
`):h=JSON.stringify(m),await u(h)}}):U(e,{onTransportError:
|
|
1
|
+
import{a as an}from"./chunk-GJR3P6JG.js";import{a as Qt,b as Jt}from"./chunk-IUK4EFCE.js";import{a as $e,b as we,c as _e,d as Qe,e as Je,f as Ye,g as Ge,h as Xe,i as Se,j as Ze,k as er,l as rr}from"./chunk-OL33ZI6R.js";import{a as en,b as rn}from"./chunk-ISCENNXS.js";import{a as wr,b as tt}from"./chunk-5QDBSZBV.js";import{a as tr}from"./chunk-MGKAO4EK.js";import{a as Ve}from"./chunk-ESMPEKEV.js";import{a as tn,b as nn,c as on,d as sn}from"./chunk-I6VIH3VA.js";import{A as Nt,B as Ot,C as Rt,D as Mt,E as Pt,G as Ct,H as Lt,I as At,J as Bt,K as It,L as Ft,M as Wt,N as zt,O as Ht,P as Ut,Q as Kt,R as jt,S as Dt,T as qt,U as Vt,a as xe,b as Ie,c as st,d as it,e as at,f as ct,g as ut,h as dt,i as Fe,j as lt,k as pt,l as ft,m as mt,n as gt,o as Tt,p as yt,q as kt,r as We,s as bt,t as ht,u as vt,v as ge,w as wt,x as St,y as xt,z as Et}from"./chunk-5JDE5JHE.js";import{a as ne,b as ve,c as Er,d as Nr,e as Or,f as Rr,g as Mr,h as Pr,i as Be}from"./chunk-4VVTGLXJ.js";import{a as Yt,b as Gt}from"./chunk-567NWZ3T.js";import{a as Xt,b as Zt}from"./chunk-SLMYTGTU.js";import{a as $t,b as _t}from"./chunk-2GQREQ6C.js";import{a as nt,b as ot}from"./chunk-AUY2YKCO.js";import{A as et,B as rt,a as Sr,b as xr,c as Cr,d as Lr,e as Ar,f as oe,g as Br,h as Ir,i as Fr,j as Wr,k as zr,l as Hr,m as Ur,n as Kr,o as jr,p as Dr,q as qr,r as Vr,s as $r,t as _r,u as Qr,v as Jr,w as Yr,x as Gr,y as Xr,z as Zr}from"./chunk-KASHOCF5.js";import{A as G,D as re,E as B,F as W,H as he,m as j,p as V}from"./chunk-W4TSQ6RJ.js";import{b as x,c as Me,d as Pe,e as Ce,f as Le,g as Ae,h as q,i as C,j as E}from"./chunk-CK2E7BTU.js";import{b as vr}from"./chunk-QYADASLV.js";var lo={};vr(lo,{CircuitOpenError:()=>_e,NS_PER_MS:()=>ne,NS_PER_SEC:()=>ve,NativeIndexBackend:()=>Yt,NativeListBackend:()=>Xt,NativeLogBackend:()=>nt,NativeMapBackend:()=>$t,NativePubSubBackend:()=>Ee,RateLimiterOverflowError:()=>Ge,ResettableTimer:()=>Ve,TimeoutError:()=>Ze,audit:()=>Pt,awaitSettled:()=>Xr,buffer:()=>Ct,bufferCount:()=>Lt,bufferTime:()=>Bt,cached:()=>Jr,cascadingCache:()=>oo,catchError:()=>Vt,checkpointToRedis:()=>Gn,checkpointToS3:()=>Yn,circuitBreaker:()=>Qe,combine:()=>yt,combineLatest:()=>jt,concat:()=>ht,concatMap:()=>St,constant:()=>Er,createTransport:()=>ie,createWatermarkController:()=>tt,csvRows:()=>An,debounce:()=>Ot,debounceTime:()=>Dt,decorrelatedJitter:()=>Mr,delay:()=>Nt,deserializeError:()=>pe,dictStorage:()=>sn,distill:()=>Jt,distinctUntilChanged:()=>gt,elementAt:()=>ft,empty:()=>jr,escapeRegexChar:()=>Cr,exhaustMap:()=>wt,exponential:()=>Or,externalBundle:()=>ze,externalProducer:()=>ae,fallback:()=>er,fibonacci:()=>Rr,filter:()=>Ie,find:()=>pt,first:()=>Fe,firstValueFrom:()=>Yr,firstWhere:()=>Gr,flatMap:()=>Et,forEach:()=>Vr,fromAny:()=>Ur,fromAsyncIter:()=>Hr,fromCSV:()=>Ln,fromClickHouseWatch:()=>Fn,fromCron:()=>Ir,fromDrizzle:()=>to,fromEvent:()=>Fr,fromHTTP:()=>sr,fromHTTPPoll:()=>Tn,fromHTTPStream:()=>gn,fromIter:()=>Wr,fromKafka:()=>Rn,fromKysely:()=>no,fromMCP:()=>bn,fromNATS:()=>Hn,fromNDJSON:()=>In,fromOTel:()=>hn,fromPrisma:()=>ro,fromPrometheus:()=>Nn,fromPromise:()=>zr,fromPulsar:()=>Wn,fromRabbitMQ:()=>Kn,fromRaf:()=>Br,fromRedisStream:()=>Pn,fromSSE:()=>mn,fromSqlite:()=>Xn,fromSqliteCursor:()=>Zn,fromStatsD:()=>Sn,fromSyslog:()=>vn,fromTimer:()=>oe,fromWebSocket:()=>or,fromWebSocketReconnect:()=>kn,fromWebhook:()=>un,globToRegExp:()=>Lr,interval:()=>Wt,keepalive:()=>et,last:()=>lt,linear:()=>Nr,lru:()=>lr,map:()=>xe,matchesAnyPattern:()=>Ar,matchesCron:()=>xr,memoryStorage:()=>on,merge:()=>We,mergeMap:()=>xt,nameToSignal:()=>de,ndjsonRows:()=>Bn,never:()=>Dr,of:()=>Kr,pairwise:()=>Tt,parseCron:()=>Sr,parsePrometheusText:()=>cr,parseStatsD:()=>En,parseSyslog:()=>wn,pausable:()=>Ht,pubsub:()=>so,race:()=>vt,rateLimiter:()=>Xe,reactiveCounter:()=>rt,reactiveIndex:()=>Gt,reactiveList:()=>Zt,reactiveLog:()=>ot,reactiveMap:()=>_t,reactiveSink:()=>U,reduce:()=>it,repeat:()=>zt,replay:()=>Qr,rescue:()=>Ut,resolveBackoffPreset:()=>Be,retry:()=>$e,retrySource:()=>we,sample:()=>Mt,scan:()=>st,serializeError:()=>le,share:()=>_r,shareReplay:()=>Zr,signalToName:()=>se,singleFromAny:()=>en,singleNodeFromAny:()=>rn,skip:()=>ct,sortJsonValue:()=>tn,stableJsonString:()=>nn,stratify:()=>an,switchMap:()=>ge,take:()=>at,takeUntil:()=>dt,takeWhile:()=>ut,tap:()=>mt,throttle:()=>Rt,throttleTime:()=>qt,throwError:()=>qr,timeout:()=>rr,toArray:()=>$r,toCSV:()=>Dn,toClickHouse:()=>qn,toFile:()=>dr,toHTTP:()=>dn,toKafka:()=>Mn,toLoki:()=>Qn,toMongo:()=>_n,toNATS:()=>Un,toObservable:()=>wr,toPostgres:()=>$n,toPulsar:()=>zn,toRabbitMQ:()=>jn,toReadableStream:()=>fn,toRedisStream:()=>Cn,toS3:()=>Vn,toSSE:()=>ln,toSSEBytes:()=>pn,toSqlite:()=>eo,toTempo:()=>Jn,toWebSocket:()=>yn,tokenBucket:()=>Ye,valve:()=>Kt,verifiable:()=>Qt,window:()=>Ft,windowCount:()=>At,windowTime:()=>It,withBreaker:()=>Je,withLatestFrom:()=>kt,withMaxAttempts:()=>Pr,withStatus:()=>Se,workerBridge:()=>fr,workerSelf:()=>mr,zip:()=>bt});function nr(e){return{describeKind:"producer",...e}}function ae(e,t){return W(n=>{let a=!0,c={emit(o){a&&n.emit(o)},error(o){a&&(a=!1,n.down([[E,o]]))},complete(){a&&(a=!1,n.down([[C]]))}},r;try{let o=e(c);r=typeof o=="function"?o:void 0}catch(o){return c.error(o),()=>{a=!1}}return()=>{a=!1;try{r?.()}catch{}}},nr(t))}function ze(e,t,n){let a=!0,c,r=0,o=0,s={},d=[],i=()=>{let l=c;c=void 0;try{l?.()}catch{}};for(let l of t){let m=n?.name?`${n.name}::${l}`:l,h=n?.channelOpts?.[l],b=W(g=>(r++,()=>{o++,r>0&&o>=r&&o>=t.length&&i()}),nr({...h,name:m}));s[l]=b,d.push(b)}let f={};for(let l of t)f[l]=m=>{a&&s[l].down([[x,m]])};f.error=l=>{a&&(a=!1,j(()=>{for(let m of d)m.down([[E,l]])}),i())},f.complete=()=>{a&&(a=!1,j(()=>{for(let l of d)l.down([[C]])}),i())};let p=e(f);return c=typeof p=="function"?p:void 0,Object.assign(s,{dispose:()=>{a&&(a=!1,j(()=>{for(let l of d)try{l.down([[C]])}catch{}}),i())}})}var He=class{ring;arr;constructor(t){t===Number.POSITIVE_INFINITY||t<=0?(this.arr=[],this.ring=null):(this.ring=new tr(t),this.arr=null)}get length(){return this.ring!=null?this.ring.size:this.arr.length}push(t){this.ring!=null?this.ring.push(t):this.arr.push(t)}shift(){return this.ring!=null?this.ring.shift():this.arr.shift()}drain(){if(this.ring!=null){let n=this.ring.toArray();return this.ring.clear(),n}let t=this.arr;return this.arr=[],t}};function Te(e){return e instanceof Error?e:new Error(String(e))}function cn(e){return e===void 0?null:typeof e=="string"?Be(e):e}function U(e,t){let{name:n,onTransportError:a,retry:c,backpressure:r,batchSize:o=Number.POSITIVE_INFINITY,flushIntervalMs:s=0,serialize:d,stopOn:i,onUpstreamMessage:f,onDispose:p,send:u,sendBatch:l,ctx:m}=t;if(!u&&!l)throw new Error("reactiveSink: `send` or `sendBatch` must be provided");let h=m,b=Math.max(1,c?.maxAttempts??1),g=cn(c?.backoff??(b>1?"exponential":void 0)),T=c?.shouldRetry??(()=>!0),y=l!==void 0||o<Number.POSITIVE_INFINITY||s>0,k=S=>n?`${n}::${S}`:void 0,v=B(void 0,{equals:()=>!1,name:k("sent")}),w=B(null,{name:k("failed")}),N=B(0,{name:k("inFlight")}),O=B(null,{name:k("errors")}),H=y?B(0,{name:k("buffered")}):void 0,z=r?B(!1,{name:k("paused")}):void 0,J=0,Y=S=>{J+=S,N.down([[x,J]])},R=S=>{try{a?.(S)}catch{}try{O.down([[x,S]])}catch{}},D=new Set,X=S=>{D.add(S);let M=()=>D.delete(S);S.then(M,M)},F=(S,M,L)=>{let I=g?g(M-1,L,null):0,K=I==null?0:typeof I=="number"&&I>0?I:0,_=Math.max(1,Math.ceil(K/1e6));return new Promise(A=>{setTimeout(()=>A(S()),_)})},$=S=>S!=null&&typeof S=="object"&&typeof S.then=="function",Z=S=>{let M;try{M=d?d(S):S}catch(A){let P=Te(A);return R({stage:"serialize",error:P,value:S}),w.down([[x,{value:S,error:P,attempts:0}]]),Promise.resolve()}let L=0,I=A=>{Y(-1);let P=Te(A);if(R({stage:"send",error:P,value:S,attempt:L}),!(L<b&&T(P,L))){w.down([[x,{value:S,error:P,attempts:L}]]);return}return F(_,L,P)},K=()=>{Y(-1),v.down([[x,S]])};function _(){L+=1,Y(1);let A;try{A=u(M,h)}catch(P){return I(P)??Promise.resolve()}return $(A)?A.then(K,P=>I(P)):(K(),Promise.resolve())}return _()},fe=r?.maxBuffer??Number.POSITIVE_INFINITY,te=new He(fe),ee,ye=!1,Ne=()=>{H?.down([[x,te.length]])},ke=S=>{z&&z.down([[x,S]])},Ke=r?.strategy??"drop-oldest",gr=(S,M)=>{let L={value:S,payload:M};if(te.length<fe)return te.push(L),Ne(),!0;if(Ke==="drop-oldest"){let K=te.shift();return te.push(L),Ne(),ke(!0),w.down([[x,{value:K.value,error:new Error("backpressure: buffer overflow \u2014 dropped oldest"),attempts:0}]]),!0}if(Ke==="drop-newest")return ke(!0),w.down([[x,{value:S,error:new Error("backpressure: buffer overflow \u2014 dropped newest"),attempts:0}]]),!1;let I=new Error("backpressure: buffer overflow");return R({stage:"send",error:I,value:S}),w.down([[x,{value:S,error:I,attempts:0}]]),ke(!0),!1},Tr=S=>{let M=0,L=S.map(A=>A.payload),I=A=>{Y(-1);let P=Te(A);if(R({stage:"send",error:P,value:S.map(Re=>Re.value),attempt:M}),!(M<b&&T(P,M))){for(let{value:Re}of S)w.down([[x,{value:Re,error:P,attempts:M}]]);return}return F(_,M,P)},K=()=>{Y(-1);for(let{value:A}of S)v.down([[x,A]])};function _(){M+=1,Y(1);let A;try{A=l(L,h)}catch(P){return I(P)??Promise.resolve()}return $(A)?A.then(K,P=>I(P)):(K(),Promise.resolve())}return _()},yr=async S=>{for(let M of S)await kr(M.value,M.payload)},kr=(S,M)=>{let L=0,I=A=>{Y(-1);let P=Te(A);if(R({stage:"send",error:P,value:S,attempt:L}),!(L<b&&T(P,L))){w.down([[x,{value:S,error:P,attempts:L}]]);return}return F(_,L,P)},K=()=>{Y(-1),v.down([[x,S]])};function _(){L+=1,Y(1);let A;try{A=u(M,h)}catch(P){return I(P)??Promise.resolve()}return $(A)?A.then(K,P=>I(P)):(K(),Promise.resolve())}return _()},me=()=>{if(ye||te.length===0)return Promise.resolve();let S=te.drain();if(Ne(),ke(!1),l!==void 0){let L=Tr(S);return X(L),L}let M=yr(S);return X(M),M},br=()=>{ee!==void 0||ye||s<=0||(ee=setTimeout(()=>{ee=void 0,me()},s))},hr=e.subscribe(S=>{for(let M of S){let L=M[0];if(L!==x)try{f?.(M)}catch{}if(L===x){let I=M[1];if(y){let K;if(d)try{K=d(I)}catch(A){let P=Te(A);R({stage:"serialize",error:P,value:I}),w.down([[x,{value:I,error:P,attempts:0}]]);continue}else K=I;if(!gr(I,K))continue;te.length>=o?me():br()}else{let K=Z(I);X(K)}}else G.messageTier(L)>=3&&y&&(ee!==void 0&&(clearTimeout(ee),ee=void 0),me())}}),je;if(i){let S=!1;je=i.subscribe(M=>{if(!S){S=!0;return}M.length>0&&!Oe&&De()})}let Oe=!1,De=()=>{if(Oe)return;Oe=!0,ee!==void 0&&(clearTimeout(ee),ee=void 0),y&&me(),ye=!0,je?.(),hr();let S=M=>{try{M.down([[q]])}catch{}};S(O),S(w),S(v),S(N),H&&S(H),z&&S(z);try{p?.()}catch{}},be={dispose:De,sent:v,failed:w,inFlight:N,errors:O};return y&&(be.buffered=H,be.flush=async()=>{ye||(await me(),await Promise.all(D))}),z&&(be.paused=z),be}function Q(e){return{describeKind:"producer",...e}}function or(e,t){let{parse:n,closeOnTeardown:a=!1,...c}=t??{};return W(r=>{let o=!0,s,d=()=>{let g=s;s=void 0,g?.()},i=g=>{o&&(o=!1,r.down([g]),d())},f=(g,T=g)=>{if(o)try{let y=g!==null&&typeof g=="object"&&"data"in g?g.data:g,k=n?n(y,T):y;r.emit(k)}catch(y){i([E,y])}},p=g=>{i([E,g])},u=()=>{i([C])};if(typeof e=="function"){try{if(s=e(f,p,u),typeof s!="function")throw new Error("fromWebSocket register contract violation: register must return cleanup callable")}catch(g){i([E,g])}return()=>{o=!1,d()}}let l=e,m=g=>f(g,g),h=g=>p(g),b=()=>u();return l.addEventListener("message",m),l.addEventListener("error",h),l.addEventListener("close",b),s=()=>{l.removeEventListener("message",m),l.removeEventListener("error",h),l.removeEventListener("close",b),a&&l.close()},()=>{o=!1,d()}},Q(c))}function un(e,t){return ae(e,t)}function sr(e,t){let{method:n="GET",headers:a,body:c,transform:r=y=>y.json(),timeoutNs:o=30*1e9,signal:s,completeAfterFetch:d=!1,refetchOnSubscribe:i=!1,...f}=t??{},p=B(0,{name:`${f.name??"http"}/fetchCount`}),u=B(0,{name:`${f.name??"http"}/lastUpdated`}),l=B(!1,{name:`${f.name??"http"}/fetched`}),m=0,h=c!==void 0?typeof c=="string"?c:JSON.stringify(c):void 0,b=y=>{let k=new AbortController,v=!0;if(s?.aborted)return v=!1,y.down([[E,s.reason??new Error("Aborted")]]),()=>{};s?.addEventListener("abort",()=>k.abort(s.reason),{once:!0});let w=setTimeout(()=>k.abort(new Error("Request timeout")),Math.ceil(o/1e6));return fetch(e,{method:n,headers:a,body:h,signal:k.signal}).then(async N=>{if(clearTimeout(w),!v)return;if(!N.ok)throw new Error(`HTTP ${N.status}: ${N.statusText}`);let O=await r(N);v&&(j(()=>{m+=1,p.down([[x,m]]),u.down([[x,V()]]),l.down([[x,!0]]),y.emit(O)}),d&&y.down([[C]]))}).catch(N=>{clearTimeout(w),v&&(N&&N.name==="AbortError"||y.down([[E,N]]))}),()=>{v=!1,k.abort()}},g=W(y=>b({emit:k=>y.emit(k),down:k=>y.down(k)}),{...Q(f),resubscribable:i});return{...Se(g),fetchCount:p,lastUpdated:u,fetched:l}}function dn(e,t,n){let{method:a="POST",headers:c={"Content-Type":"application/json"},serialize:r=m=>JSON.stringify(m),timeoutNs:o,batchFormat:s="json-array",batchSize:d,flushIntervalMs:i,retry:f,onTransportError:p}=n??{},u=async m=>{let h=o!==void 0?new AbortController:void 0,b;h&&o!==void 0&&(b=setTimeout(()=>h.abort(new Error("Request timeout")),Math.ceil(o/1e6)));try{let g=await fetch(t,{method:a,headers:c,body:m,signal:h?.signal}),T=async()=>{try{await g.arrayBuffer?.()}catch{}};if(!g.ok)throw await T(),new Error(`HTTP ${g.status}: ${g.statusText}`);await T()}finally{b!==void 0&&clearTimeout(b)}};return d!==void 0||i!==void 0?U(e,{onTransportError:p,retry:f,batchSize:d,flushIntervalMs:i,sendBatch:async m=>{let h;s==="ndjson"?h=m.map(b=>{let g=r(b);return typeof g=="string"?g:new TextDecoder().decode(g)}).join(`
|
|
2
|
+
`):h=JSON.stringify(m),await u(h)}}):U(e,{onTransportError:p,retry:f,serialize:r,send:async m=>{await u(m)}})}function ir(e){return Symbol.keyFor(e)??e.description??"message"}function ce(e,t){return typeof e=="string"?e:t(e)}function ar(e,t){let n=`event: ${e}
|
|
3
3
|
`;if(t!==void 0){let a=t.split(/\r?\n/);for(let c of a)n+=`data: ${c}
|
|
4
4
|
`}return`${n}
|
|
5
|
-
`}function ln(e,t){let{serialize:n=l=>{if(l instanceof Error)return l.message;try{return JSON.stringify(l)}catch{return String(l)}},dataEvent:a="data",errorEvent:c="error",completeEvent:r="complete",includeResolved:o=!1,includeDirty:s=!1,keepAliveMs:d,signal:i,eventNameResolver:
|
|
5
|
+
`}function ln(e,t){let{serialize:n=l=>{if(l instanceof Error)return l.message;try{return JSON.stringify(l)}catch{return String(l)}},dataEvent:a="data",errorEvent:c="error",completeEvent:r="complete",includeResolved:o=!1,includeDirty:s=!1,keepAliveMs:d,signal:i,eventNameResolver:f=ir}=t??{},p=new TextEncoder,u;return new ReadableStream({start(l){let m=!1,h,b=()=>{},g=()=>{m||(m=!0,h!==void 0&&clearInterval(h),i?.removeEventListener("abort",y),b(),l.close())};u=g;let T=(k,v)=>{m||l.enqueue(p.encode(ar(k,v)))},y=()=>{m||g()};b=e.subscribe(k=>{for(let v of k){let w=v[0];if(!(G.isLocalOnly(w)&&!(w===Me&&s))){if(w===x){T(a,ce(v[1],n));continue}if(w===E){T(c,ce(v[1],n)),g();return}if(w===C){T(r),g();return}!o&&w===Pe||T(f(w),v.length>1?ce(v[1],n):void 0)}}}),d!==void 0&&d>0&&(h=setInterval(()=>{m||l.enqueue(p.encode(`: keepalive
|
|
6
6
|
|
|
7
|
-
`))},d)),i?.aborted?y():i?.addEventListener("abort",y,{once:!0})},cancel(){u?.()}})}function
|
|
7
|
+
`))},d)),i?.aborted?y():i?.addEventListener("abort",y,{once:!0})},cancel(){u?.()}})}function pn(e,t){let{serialize:n=u=>{if(u instanceof Error)return u.message;try{return JSON.stringify(u)}catch{return String(u)}},dataEvent:a="data",errorEvent:c="error",completeEvent:r="complete",includeResolved:o=!1,includeDirty:s=!1,keepAliveMs:d,signal:i,eventNameResolver:f=ir}=t??{},p=new TextEncoder;return W(u=>{let l=!0,m,h=(T,y)=>{l&&u.emit(p.encode(ar(T,y)))},b=()=>{l&&(l=!1,u.down([[C]]))},g=e.subscribe(T=>{if(l)for(let y of T){let k=y[0];if(!(G.isLocalOnly(k)&&!(k===Me&&s))){if(k===x){h(a,ce(y[1],n));continue}if(k===E){h(c,ce(y[1],n)),l=!1,u.down([[C]]);return}if(k===C){h(r),l=!1,u.down([[C]]);return}!o&&k===Pe||h(f(k),y.length>1?ce(y[1],n):void 0)}}});return d!==void 0&&d>0&&(m=setInterval(()=>{l&&u.emit(p.encode(`: keepalive
|
|
8
8
|
|
|
9
|
-
`))},d)),i?.aborted?b():i?.addEventListener("abort",b,{once:!0}),()=>{l=!1,m!==void 0&&clearInterval(m),i?.removeEventListener("abort",b),g()}})}function
|
|
10
|
-
`);c.emit({event:d,data:n(T),id:
|
|
11
|
-
`)){let r=c.trim();if(!r)continue;if(r.startsWith("# TYPE ")){let u=r.slice(7),l=u.indexOf(" ");l>0&&n.set(u.slice(0,l),u.slice(l+1).trim());continue}if(r.startsWith("# HELP ")){let u=r.slice(7),l=u.indexOf(" ");l>0&&a.set(u.slice(0,l),u.slice(l+1).trim());continue}if(r.startsWith("#"))continue;let o,s={},d,i,
|
|
12
|
-
`,flushIntervalMs:c=0,batchSize:r=Number.POSITIVE_INFINITY,onTransportError:o,mode:s}=n??{},i=c>0||r<Number.POSITIVE_INFINITY?U(e,{onTransportError:o,batchSize:r,flushIntervalMs:c,serialize:a,sendBatch:
|
|
13
|
-
`)?`"${e.replace(/"/g,'""')}"`:e}function Dn(e,t,n){let{columns:a,delimiter:c=",",writeHeader:r=!0,cellExtractor:o=(l,m)=>String(l[m]??""),flushIntervalMs:s=0,batchSize:d=Number.POSITIVE_INFINITY,onTransportError:i,...
|
|
9
|
+
`))},d)),i?.aborted?b():i?.addEventListener("abort",b,{once:!0}),()=>{l=!1,m!==void 0&&clearInterval(m),i?.removeEventListener("abort",b),g()}})}function fn(e){let t,n=!1;return new ReadableStream({start(a){t=e.subscribe(c=>{for(let r of c){let o=r[0];if(n)return;if(o===x)try{a.enqueue(r[1])}catch{n=!0,t?.()}else if(o===E){n=!0;try{a.error(r[1])}catch{}return}else if(o===C){n=!0;try{a.close()}catch{}return}}})},cancel(){n=!0,t?.()}})}function mn(e,t){let{parse:n=c=>c,...a}=t??{};return W(c=>{let r=!0,o=new TextDecoder,s="",d="message",i=[],f,p,u=()=>{if(i.length===0&&d==="message"&&f===void 0){i=[];return}let T=i.join(`
|
|
10
|
+
`);c.emit({event:d,data:n(T),id:f,retry:p}),d="message",i=[],f=void 0,p=void 0},l=T=>{if(T===""){u();return}if(T.startsWith(":"))return;let y=T.indexOf(":"),k=y<0?T:T.slice(0,y),v=y<0?"":T.slice(y+1);switch(v.startsWith(" ")&&(v=v.slice(1)),k){case"event":d=v;break;case"data":i.push(v);break;case"id":v.includes("\0")||(f=v);break;case"retry":{let w=Number(v);Number.isFinite(w)&&(p=w);break}}},m=(T,y)=>{if(!r)return;s+=o.decode(T,{stream:!y});let k=s.split(/\r?\n/);s=k.pop()??"";for(let v of k)l(v)},h,b;return(async()=>{try{let T=e,y=e instanceof ReadableStream?e:T&&typeof T=="object"&&T.body instanceof ReadableStream?T.body:null;if(y){for(h=y.getReader();r;){let{value:k,done:v}=await h.read();if(v)break;m(k,!1)}m(new Uint8Array,!0)}else{for(b=e[Symbol.asyncIterator]();r;){let v=await b.next();if(v.done)break;m(v.value,!1)}m(new Uint8Array,!0)}if(s.trim()){for(let k of s.split(/\r?\n/))l(k);u()}r&&c.down([[C]])}catch(T){r&&c.down([[E,T]])}})(),()=>{r=!1,h&&h.cancel().catch(()=>{}),b&&typeof b.return=="function"&&Promise.resolve(b.return()).catch(()=>{})}},Q(a))}function gn(e,t){let{method:n="GET",headers:a,body:c,signal:r,...o}=t??{};return W(s=>{let d=!0,i=new AbortController;if(r?.aborted)return s.down([[E,r.reason??new Error("Aborted")]]),()=>{};r?.addEventListener("abort",()=>i.abort(r.reason),{once:!0});let f=c!==void 0?typeof c=="string"?c:JSON.stringify(c):void 0;return(async()=>{try{let u=await fetch(e,{method:n,headers:a,body:f,signal:i.signal});if(!d)return;if(!u.ok)throw new Error(`HTTP ${u.status}: ${u.statusText}`);if(!u.body)throw new Error("HTTP response has no body");let l=u.body.getReader();for(;d;){let{value:m,done:h}=await l.read();if(h)break;m&&s.emit(m)}d&&s.down([[C]])}catch(u){if(!d||u&&u.name==="AbortError")return;s.down([[E,u]])}})(),()=>{d=!1,i.abort()}},Q(o))}function Tn(e,t){let{intervalMs:n=5e3,...a}=t??{};return ge(oe(n,{period:n}),()=>sr(e,{...a,completeAfterFetch:!0}).node)}function yn(e,t,n){let{serialize:a=g=>{if(typeof g=="string"||g instanceof Blob||g instanceof ArrayBuffer||ArrayBuffer.isView(g))return g;try{return JSON.stringify(g)}catch{return String(g)}},closeOnComplete:c=!0,closeOnError:r=!0,closeCode:o,closeReason:s,onTransportError:d,retry:i,backpressure:f,stopOn:p}=n??{},u=!1,l=g=>{if(!u){u=!0;try{t.close(o,s)}catch(T){let y=T instanceof Error?T:new Error(String(T));try{d?.({stage:"close",error:y,value:void 0,message:g})}catch{}}}},m=null,b=U(e,{onTransportError:d,serialize:g=>{let T=a(g);if(T===void 0)throw new Error("serialize returned undefined");return T},retry:i,backpressure:f,stopOn:p,onDispose:()=>{if(m){try{t.removeEventListener("close",m)}catch{}m=null}},send:g=>{t.send(g)},onUpstreamMessage:g=>{(g[0]===C&&c||g[0]===E&&r)&&l(g)}});return m=()=>{u=!0,b.dispose()},t.addEventListener("close",m),b}function kn(e,t){let{parse:n,maxRetries:a,backoff:c="exponential",closeOnTeardown:r=!0,...o}=t??{};return we(()=>or(e(),{parse:n,closeOnTeardown:r,...o}),{count:a,backoff:c})}function bn(e,t){let{method:n="notifications/message",onDisconnect:a,...c}=t??{};return ae(({emit:r,error:o})=>(e.setNotificationHandler(n,s=>r(s)),a?.(s=>o(s??new Error("MCP client disconnected"))),()=>e.setNotificationHandler(n,()=>{})),c)}function hn(e,t){return ze(({traces:a,metrics:c,logs:r,error:o})=>e({onTraces:s=>{j(()=>{for(let d of s)a(d)})},onMetrics:s=>{j(()=>{for(let d of s)c(d)})},onLogs:s=>{j(()=>{for(let d of s)r(d)})},onError:o})??void 0,["traces","metrics","logs"],t?.name?{name:t.name}:void 0)}function vn(e,t){return ae(e,t)}function wn(e){let t=e.match(/^<(\d{1,3})>\d?\s*(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s*(.*)/s);if(!t){let a=V();return{facility:1,severity:6,timestamp:new Date(Math.floor(a/1e6)).toISOString(),hostname:"-",appName:"-",procId:"-",msgId:"-",message:e.trim(),timestampNs:a}}let n=Number(t[1]);return{facility:n>>3,severity:n&7,timestamp:t[2],hostname:t[3],appName:t[4],procId:t[5],msgId:t[6],message:(t[7]??"").trim(),timestampNs:V()}}function Sn(e,t){return ae(e,t)}var xn={c:"counter",g:"gauge",ms:"timer",h:"histogram",s:"set",d:"distribution"};function En(e){let t=e.split("|"),[n,a]=(t[0]??"").split(":");if(!n||a===void 0)throw new Error(`Invalid StatsD line: ${e}`);let c=t[1]?.trim()??"c",r=xn[c]??"counter",o=r==="set"?0:Number(a),s,d={};for(let i=2;i<t.length;i++){let f=t[i].trim();if(f.startsWith("@"))s=Number(f.slice(1));else if(f.startsWith("#"))for(let p of f.slice(1).split(",")){let[u,l]=p.split(":");u&&(d[u]=l??"")}}return{name:n.trim(),value:o,type:r,sampleRate:s,tags:d,timestampNs:V()}}function Nn(e,t){let{intervalNs:n=15*1e9,headers:a,timeoutNs:c=10*1e9,signal:r,maxConsecutiveErrors:o=1}=t??{},s=Math.ceil(n/1e6),d=0;return ge(oe(0,{period:s,signal:r}),()=>W(i=>{let f=!0,p=new AbortController,u=setTimeout(()=>p.abort(new Error("Scrape timeout")),Math.ceil(c/1e6));return(async()=>{try{let m=await fetch(e,{headers:{Accept:"text/plain",...a},signal:p.signal});if(clearTimeout(u),!f)return;if(!m.ok)throw new Error(`Prometheus scrape ${m.status}: ${m.statusText}`);let h=await m.text();if(!f)return;let b=cr(h);for(let g of b)i.emit(g);d=0,i.down([[C]])}catch(m){if(clearTimeout(u),!f||m instanceof Error&&m.name==="AbortError")return;d+=1,d>=o&&i.down([[E,m]])}})(),()=>{f=!1,clearTimeout(u),p.abort()}}))}function cr(e){let t=[],n=new Map,a=new Map;for(let c of e.split(`
|
|
11
|
+
`)){let r=c.trim();if(!r)continue;if(r.startsWith("# TYPE ")){let u=r.slice(7),l=u.indexOf(" ");l>0&&n.set(u.slice(0,l),u.slice(l+1).trim());continue}if(r.startsWith("# HELP ")){let u=r.slice(7),l=u.indexOf(" ");l>0&&a.set(u.slice(0,l),u.slice(l+1).trim());continue}if(r.startsWith("#"))continue;let o,s={},d,i,f=r.indexOf("{");if(f>=0){o=r.slice(0,f);let u=r.indexOf("}",f);if(u<0)continue;let l=r.slice(f+1,u);s=On(l);let m=r.slice(u+1).trim().split(/\s+/);d=m[0]??"",i=m[1]}else{let u=r.split(/\s+/);o=u[0]??"",d=u[1]??"",i=u[2]}if(!o||!d)continue;let p=o.replace(/(_total|_count|_sum|_bucket|_created|_info)$/,"");t.push({name:o,labels:s,value:Number(d),timestampMs:i?Number(i):void 0,type:n.get(p)??n.get(o),help:a.get(p)??a.get(o),timestampNs:V()})}return t}function On(e){let t={},n=/(\w+)="((?:[^"\\]|\\.)*)"/g,a=n.exec(e);for(;a!==null;)t[a[1]]=a[2].replace(/\\(.)/g,"$1"),a=n.exec(e);return t}function Rn(e,t,n){let{fromBeginning:a=!1,deserialize:c=o=>{if(o===null)return null;try{return JSON.parse(o.toString())}catch{return o.toString()}},...r}=n??{};return W(o=>{let s=!0;return(async()=>{try{await e.subscribe({topic:t,fromBeginning:a}),await e.run({eachMessage:async({topic:i,partition:f,message:p})=>{if(!s)return;let u={};if(p.headers)for(let[l,m]of Object.entries(p.headers))m!==void 0&&(u[l]=typeof m=="string"?m:m.toString());o.emit({topic:i,partition:f,key:p.key?.toString()??null,value:c(p.value),headers:u,offset:p.offset,timestamp:p.timestamp,timestampNs:V()})}})}catch(i){s&&o.down([[E,i]])}})(),()=>{s=!1}},Q(r))}function Mn(e,t,n,a){let{serialize:c=s=>JSON.stringify(s),keyExtractor:r,onTransportError:o}=a??{};return U(e,{onTransportError:o,send:async s=>{let d=r?.(s)??null,i=c(s);await t.send({topic:n,messages:[{key:d,value:Buffer.from(i)}]})}})}function Pn(e,t,n){let{blockMs:a=5e3,startId:c="$",parse:r=s=>{for(let i=0;i<s.length;i+=2)if(s[i]==="data")try{return JSON.parse(s[i+1])}catch{return s[i+1]}let d={};for(let i=0;i<s.length;i+=2)d[s[i]]=s[i+1];return d},...o}=n??{};return W(s=>{let d=!0,i=c;return(async()=>{for(;d;)try{let p=await e.xread("BLOCK",a,"STREAMS",t,i);if(!d)return;if(p)for(let[u,l]of p)for(let[m,h]of l)i=m,s.emit({id:m,key:t,data:r(h),timestampNs:V()})}catch(p){if(!d)return;s.down([[E,p]]);return}})(),()=>{d=!1}},Q(o))}function Cn(e,t,n,a){let{serialize:c=s=>["data",JSON.stringify(s)],maxLen:r,onTransportError:o}=a??{};return U(e,{onTransportError:o,send:async s=>{let d=c(s);await(r!==void 0?t.xadd(n,"MAXLEN","~",String(r),"*",...d):t.xadd(n,"*",...d))}})}function Ln(e,t){let{delimiter:n=",",hasHeader:a=!0,columns:c,parseLine:r,...o}=t??{},s=r??(d=>ur(d,n));return W(d=>{let i=!1;return(async()=>{try{let p=c,u="";for await(let l of e){if(i)return;u+=l;let m=u.split(/\r?\n/);u=m.pop()??"";for(let h of m){if(i)return;if(!h.trim())continue;let b=s(h);if(!p&&a){p=b;continue}p||(p=b.map((T,y)=>`col${y}`));let g={};for(let T=0;T<p.length;T++)g[p[T]]=b[T]??"";d.emit(g)}}if(!i&&u.trim()){let l=s(u);if(p){let m={};for(let h=0;h<p.length;h++)m[p[h]]=l[h]??"";d.emit(m)}}i||d.down([[C]])}catch(p){i||d.down([[E,p]])}})(),()=>{i=!0}},Q(o))}function An(e,t){let{delimiter:n=",",hasHeader:a=!0,columns:c,parseLine:r,...o}=t??{},s=r??(d=>ur(d,n));return re([e],(d,i,f)=>{let p=d[0];if(p==null||p.length===0)return;let u=f.store;typeof u.buffer!="string"&&(u.buffer=""),u.headers===void 0&&c&&(u.headers=c.slice());for(let l of p){u.buffer=u.buffer+l;let m=u.buffer.split(/\r?\n/);u.buffer=m.pop()??"";for(let h of m){if(!h.trim())continue;let b=s(h);if(!u.headers&&a){u.headers=b;continue}u.headers||(u.headers=b.map((T,y)=>`col${y}`));let g={};for(let T=0;T<u.headers.length;T++)g[u.headers[T]]=b[T]??"";i.emit(g)}}},{describeKind:"derived",...o})}function Bn(e,t){return re([e],(n,a,c)=>{let r=n[0];if(r==null||r.length===0)return;let o=c.store;typeof o.buffer!="string"&&(o.buffer="");for(let s of r){o.buffer=o.buffer+s;let d=o.buffer.split(/\r?\n/);o.buffer=d.pop()??"";for(let i of d)if(i.trim())try{a.emit(JSON.parse(i))}catch(f){a.down([[E,f]]);return}}},{describeKind:"derived",...t??{}})}function ur(e,t){let n=[],a="",c=!1;for(let r=0;r<e.length;r++){let o=e[r];c?o==='"'?e[r+1]==='"'?(a+='"',r++):c=!1:a+=o:o==='"'?c=!0:o===t?(n.push(a),a=""):a+=o}return n.push(a),n}function In(e,t){return W(n=>{let a=!1;return(async()=>{try{let r="";for await(let o of e){if(a)return;r+=o;let s=r.split(/\r?\n/);r=s.pop()??"";for(let d of s){if(a)return;let i=d.trim();i&&n.emit(JSON.parse(i))}}!a&&r.trim()&&n.emit(JSON.parse(r.trim())),a||n.down([[C]])}catch(r){a||n.down([[E,r]])}})(),()=>{a=!0}},Q(t))}function Fn(e,t,n){let{intervalNs:a=5*1e9,format:c="JSONEachRow",signal:r,maxConsecutiveErrors:o=1}=n??{},s=Math.ceil(a/1e6),d=0;return ge(oe(0,{period:s,signal:r}),()=>W(i=>{let f=!0;return(async()=>{try{let u=await e.query({query:t,format:c});if(!f)return;let l=await u.json();if(!f)return;for(let m of l)i.emit(m);d=0,i.down([[C]])}catch(u){if(!f)return;d+=1,d>=o&&i.down([[E,u]])}})(),()=>{f=!1}}))}function Wn(e,t){let{autoAck:n=!0,deserialize:a=s=>{try{return JSON.parse(s.toString())}catch{return s.toString()}},onAckError:c,...r}=t??{},o=s=>{if(c)try{c(s instanceof Error?s:new Error(String(s)))}catch{}};return W(s=>{let d=!0;return(async()=>{for(;d;)try{let f=await e.receive();if(!d)return;let p={topic:f.getTopicName(),messageId:f.getMessageId().toString(),key:f.getPartitionKey(),value:a(f.getData()),properties:f.getProperties(),publishTime:f.getPublishTimestamp(),eventTime:f.getEventTimestamp(),timestampNs:V()};if(n)s.emit(p),e.acknowledge(f).catch(o);else{let u=!1,l={value:p,ack(){u||(u=!0,e.acknowledge(f).catch(o))},nack(m){if(u)return;u=!0;let h=e;try{let b=h.negativeAcknowledge?.(f);b&&typeof b.then=="function"&&b.catch(o)}catch(b){o(b)}}};s.emit(l)}}catch(f){d&&s.down([[E,f]]);return}})(),()=>{d=!1}},Q(r))}function zn(e,t,n){let{serialize:a=s=>Buffer.from(JSON.stringify(s)),keyExtractor:c,propertiesExtractor:r,onTransportError:o}=n??{};return U(e,{onTransportError:o,send:async s=>{await t.send({data:a(s),partitionKey:c?.(s),properties:r?.(s)})}})}function Hn(e,t,n){let a=new TextDecoder,{queue:c,deserialize:r=s=>{let d=a.decode(s);try{return JSON.parse(d)}catch{return d}},...o}=n??{};return W(s=>{let d=!0,i=e.subscribe(t,c?{queue:c}:void 0);return(async()=>{try{for await(let p of i){if(!d)return;let u={};if(p.headers)for(let l of p.headers.keys())u[l]=p.headers.get(l);s.emit({subject:p.subject,data:r(p.data),headers:u,reply:p.reply,sid:p.sid,timestampNs:V()})}d&&s.down([[C]])}catch(p){d&&s.down([[E,p]])}})(),()=>{d=!1}},Q(o))}function Un(e,t,n,a){let c=new TextEncoder,{serialize:r=s=>c.encode(JSON.stringify(s)),onTransportError:o}=a??{};return U(e,{onTransportError:o,send:s=>{t.publish(n,r(s))}})}function Kn(e,t,n){let{autoAck:a=!0,deserialize:c=d=>{try{return JSON.parse(d.toString())}catch{return d.toString()}},onAckError:r,...o}=n??{},s=d=>{if(r)try{r(d instanceof Error?d:new Error(String(d)))}catch{}};return W(d=>{let i=!0,f;return(async()=>{try{f=(await e.consume(t,l=>{if(!i)return;if(l===null){i&&d.down([[E,new Error("Consumer cancelled by broker")]]);return}let m={queue:t,routingKey:l.fields.routingKey,exchange:l.fields.exchange,content:c(l.content),properties:l.properties,deliveryTag:l.fields.deliveryTag,redelivered:l.fields.redelivered,timestampNs:V()};if(a){d.emit(m);try{e.ack(l)}catch(h){s(h)}}else{let h=!1,b=e,g={value:m,ack(){if(!h){h=!0;try{e.ack(l)}catch(T){s(T)}}},nack(T){if(h)return;h=!0;let y=T?.requeue;if(!b.nack){s(new Error("RabbitMQ channel does not expose `nack`; cannot negative-ack"));return}try{b.nack(l,!1,y)}catch(k){s(k)}}};d.emit(g)}},{noAck:!1})).consumerTag}catch(u){i&&d.down([[E,u]])}})(),()=>{i=!1,f!==void 0&&e.cancel(f)}},Q(o))}function jn(e,t,n,a){let{serialize:c=s=>Buffer.from(JSON.stringify(s)),routingKeyExtractor:r=()=>"",onTransportError:o}=a??{};return U(e,{onTransportError:o,send:s=>{let d=r(s),i=c(s);t.publish(n,d,i)}})}function dr(e,t,n){let{serialize:a=p=>`${JSON.stringify(p)}
|
|
12
|
+
`,flushIntervalMs:c=0,batchSize:r=Number.POSITIVE_INFINITY,onTransportError:o,mode:s}=n??{},i=c>0||r<Number.POSITIVE_INFINITY?U(e,{onTransportError:o,batchSize:r,flushIntervalMs:c,serialize:a,sendBatch:p=>{t.write(p.join(""))}}):U(e,{onTransportError:o,serialize:a,send:p=>{t.write(p)}}),f=i.dispose;return i.dispose=()=>{f();try{t.end()}catch{}},i}function Ue(e,t){return e.includes(t)||e.includes('"')||e.includes(`
|
|
13
|
+
`)?`"${e.replace(/"/g,'""')}"`:e}function Dn(e,t,n){let{columns:a,delimiter:c=",",writeHeader:r=!0,cellExtractor:o=(l,m)=>String(l[m]??""),flushIntervalMs:s=0,batchSize:d=Number.POSITIVE_INFINITY,onTransportError:i,...f}=n,p=!1;return dr(e,t,{serialize:l=>{if(!p&&r){p=!0;let m=a.map(b=>Ue(b,c)).join(c),h=a.map(b=>Ue(o(l,b),c)).join(c);return`${m}
|
|
14
14
|
${h}
|
|
15
15
|
`}return`${a.map(m=>Ue(o(l,m),c)).join(c)}
|
|
16
|
-
`},flushIntervalMs:s,batchSize:d,onTransportError:i,...
|
|
16
|
+
`},flushIntervalMs:s,batchSize:d,onTransportError:i,...f})}function qn(e,t,n,a){let{batchSize:c=1e3,flushIntervalMs:r=5e3,format:o="JSONEachRow",transform:s=i=>i,onTransportError:d}=a??{};return U(e,{onTransportError:d,batchSize:c,flushIntervalMs:r,serialize:s,sendBatch:async i=>{await t.insert({table:n,values:i,format:o})}})}function Vn(e,t,n,a){let{format:c="ndjson",keyGenerator:r=(u,l)=>{let m=Math.floor(l/1e6);return`data/${new Date(m).toISOString().replace(/[:.]/g,"-")}-${u}.${c==="ndjson"?"ndjson":"json"}`},batchSize:o=1e3,flushIntervalMs:s=1e4,transform:d=u=>u,onTransportError:i}=a??{},f=c==="ndjson"?"application/x-ndjson":"application/json",p=0;return U(e,{onTransportError:i,batchSize:o,flushIntervalMs:s,serialize:d,sendBatch:async u=>{p+=1;let l=c==="ndjson"?`${u.map(h=>JSON.stringify(h)).join(`
|
|
17
17
|
`)}
|
|
18
|
-
`:JSON.stringify(u),m=r(f,V());await t.putObject({Bucket:n,Key:m,Body:l,ContentType:p})}})}function $n(e,t,n,a){let{toSQL:c=(o,s)=>({sql:`INSERT INTO "${s.replace(/"/g,'""')}" (data) VALUES ($1)`,params:[JSON.stringify(o)]}),onTransportError:r}=a??{};return U(e,{onTransportError:r,serialize:o=>c(o,n),send:async o=>{let s=o;await t.query(s.sql,s.params)}})}function _n(e,t,n){let{toDocument:a=r=>r,onTransportError:c}=n??{};return U(e,{onTransportError:c,serialize:a,send:async r=>{await t.insertOne(r)}})}function Qn(e,t,n){let{labels:a={},toLine:c=s=>JSON.stringify(s),toLabels:r,onTransportError:o}=n??{};return U(e,{onTransportError:o,serialize:s=>({line:c(s),labels:r?{...a,...r(s)}:a}),send:async s=>{let{line:d,labels:i}=s,p=`${V()}`;await t.push({streams:[{stream:i,values:[[p,d]]}]})}})}function Jn(e,t,n){let{toResourceSpans:a=r=>[r],onTransportError:c}=n??{};return U(e,{onTransportError:c,serialize:a,send:async r=>{await t.push({resourceSpans:r})}})}function Yn(e,t,n,a){let{prefix:c="checkpoints/",debounceMs:r=500,compactEvery:o=10,onError:s}=a??{},d={debounceMs:r,compactEvery:o,save(i,p){let f=Math.floor(V()/1e6),u=`${c}${e.name}/checkpoint-${f}.json`,l;try{l=JSON.stringify(p)}catch(m){s?.(m);return}t.putObject({Bucket:n,Key:u,Body:l,ContentType:"application/json"}).catch(m=>s?.(m))},load(){return null}};return e.attachStorage([d],{onError:i=>s?.(i)})}function Gn(e,t,n){let{prefix:a="graphrefly:checkpoint:",debounceMs:c=500,compactEvery:r=10,onError:o}=n??{},s=`${a}${e.name}`,d={debounceMs:c,compactEvery:r,save(i,p){let f;try{f=JSON.stringify(p)}catch(u){o?.(u);return}t.set(s,f).catch(u=>o?.(u))},async load(){let i=await t.get(s);if(i==null)return null;try{return JSON.parse(i)}catch{return null}}};return e.attachStorage([d],{onError:i=>o?.(i)})}function Xn(e,t,n){let{mapRow:a=o=>o,params:c,...r}=n??{};return W(o=>{try{let d=e.query(t,c).map(a);o.emit(d),o.down([[C]])}catch(s){o.down([[E,s instanceof Error?s:new Error(String(s))]])}},{describeKind:"producer",completeWhenDepsComplete:!1,...r})}function Zn(e,t,n){let{mapRow:a=o=>o,params:c,...r}=n??{};return W(o=>{try{let s=e.iterate(t,c);j(()=>{for(let d of s)o.emit(a(d));o.down([[C]])})}catch(s){o.down([[E,s instanceof Error?s:new Error(String(s))]])}},{describeKind:"producer",completeWhenDepsComplete:!1,...r})}function eo(e,t,n,a){if(n.includes("\0")||n.length===0)throw new Error(`toSqlite: invalid table name: ${JSON.stringify(n)}`);let{toSQL:c=(R,D)=>({sql:`INSERT INTO "${D.replace(/"/g,'""')}" (data) VALUES (?)`,params:[JSON.stringify(R)]}),onTransportError:r,batchInsert:o=!1,maxBatchSize:s=1e3,flushIntervalMs:d=0}=a??{},i=R=>c(R,n);if(!o)return U(e,{onTransportError:r,serialize:i,send:R=>{let D=R;t.query(D.sql,D.params)}});let p=B(null),f=B(void 0,{equals:()=>!1}),u=B(null),l=B(0),m=B(0),h=R=>{try{r?.(R)}catch{}try{p.down([[x,R]])}catch{}},b=[],g=!1,T,y=!1,k=()=>m.down([[x,b.length]]),v=R=>{y||f.down([[x,R]])},w=R=>{y||u.down([[x,R]])},N=R=>{y||l.down([[x,R]])},O=R=>{y||h(R)},H=()=>{if(b.length===0||g)return;g=!0,N(1);try{t.query("BEGIN",[])}catch(F){g=!1,N(0),O({stage:"send",error:F instanceof Error?F:new Error(String(F)),value:void 0});return}let R=b;b=[],k();let D,X=0;for(let F of R)try{t.query(F.query.sql,F.query.params),X+=1}catch($){D=$ instanceof Error?$:new Error(String($));break}if(D){try{t.query("ROLLBACK",[])}catch{}O({stage:"send",error:D,value:void 0});for(let F of R)w({value:F.value,error:D,attempts:1})}else try{t.query("COMMIT",[]);for(let F of R)v(F.value)}catch(F){let $=F instanceof Error?F:new Error(String(F));O({stage:"send",error:$,value:void 0});for(let Z=0;Z<X;Z++)w({value:R[Z].value,error:$,attempts:1})}g=!1,N(0)},z=()=>{d>0&&T===void 0&&!y&&(T=setTimeout(()=>{T=void 0,H()},d))},J=e.subscribe(R=>{for(let D of R){let X=D[0];if(X===x){let F=D[1],$;try{$=i(F)}catch(Z){let pe=Z instanceof Error?Z:new Error(String(Z));h({stage:"serialize",error:pe,value:F}),u.down([[x,{value:F,error:pe,attempts:0}]]);continue}b.push({value:F,query:$}),k(),b.length>=s?H():z()}else G.messageTier(X)>=3&&H()}});return{dispose:()=>{if(!y){T!==void 0&&(clearTimeout(T),T=void 0),H(),y=!0,J();for(let R of[p,f,u,l,m])try{R.down([[q]])}catch{}}},sent:f,failed:u,inFlight:l,errors:p,buffered:m,flush:async()=>{y||H()}}}function ro(e,t){let{args:n,mapRow:a=r=>r,...c}=t??{};return W(r=>{let o=!0;return e.findMany(n).then(s=>{o&&(r.emit(s.map(a)),r.down([[C]]))}).catch(s=>{if(o)try{r.down([[E,s instanceof Error?s:new Error(String(s))]])}catch{}}),()=>{o=!1}},{...c,describeKind:"producer",completeWhenDepsComplete:!1})}function to(e,t){let{mapRow:n=c=>c,...a}=t??{};return W(c=>{let r=!0;return e.execute().then(o=>{r&&(c.emit(o.map(n)),c.down([[C]]))}).catch(o=>{if(r)try{c.down([[E,o instanceof Error?o:new Error(String(o))]])}catch{}}),()=>{r=!1}},{...a,describeKind:"producer",completeWhenDepsComplete:!1})}function no(e,t){let{mapRow:n=c=>c,...a}=t??{};return W(c=>{let r=!0;return e.execute().then(o=>{r&&(c.emit(o.map(n)),c.down([[C]]))}).catch(o=>{if(r)try{c.down([[E,o instanceof Error?o:new Error(String(o))]])}catch{}}),()=>{r=!1}},{...a,describeKind:"producer",completeWhenDepsComplete:!1})}function lr(){let e=new Map,t=null,n=null;function a(r){r.prev?r.prev.next=r.next:t=r.next,r.next?r.next.prev=r.prev:n=r.prev,r.prev=null,r.next=null}function c(r){r.next=t,r.prev=null,t&&(t.prev=r),t=r,n===null&&(n=r)}return{insert(r){if(e.has(r)){this.touch(r);return}let o={key:r,prev:null,next:null};e.set(r,o),c(o)},touch(r){let o=e.get(r);o&&(a(o),c(o))},delete(r){let o=e.get(r);o&&(a(o),e.delete(r))},evict(r){let o=[];for(let s=0;s<r&&n!==null;s++){let d=n;o.push(d.key),a(d),e.delete(d.key)}return o},size(){return e.size}}}function fr(e){return e!=null&&typeof e.then=="function"}function ue(e){fr(e)&&e.catch(()=>{})}function oo(e,t){let n=new Map,a=t?.maxSize??0,c=a>0?t?.eviction??lr():null,r=t?.writeThrough??!1;function o(i,p,f){for(let u=0;u<f;u++)try{ue(e[u].save(i,p))}catch{}}function s(i,p,f=0){for(let u=f;u<e.length;u++){let l;try{l=e[u].load(i)}catch{continue}if(fr(l)){let m=u;l.then(h=>{h!=null?(p.down([[x,h]]),o(i,h,m)):s(i,p,m+1)},()=>{s(i,p,m+1)});return}if(l!=null){p.down([[x,l]]),o(i,l,u);return}}}function d(){if(!(!c||a<=0))for(;c.size()>=a;){let i=c.evict(1);if(i.length===0)break;for(let p of i){let f=n.get(p);if(f){let u=f.cache;if(f.status!=="sentinel"&&e.length>0){let l=e.length-1;try{ue(e[l].save(p,u))}catch{}for(let m=0;m<l;m++)try{let h=e[m].clear;h&&ue(h.call(e[m],p))}catch{}}f.down([[q]])}n.delete(p)}}}return{load(i){let p=n.get(i);if(p)return c?.touch(i),p;c&&a>0&&c.size()>=a&&d();let f=B(void 0);return n.set(i,f),c?.insert(i),s(i,f),f},save(i,p){if(r)for(let u of e)try{ue(u.save(i,p))}catch{}else if(e[0])try{ue(e[0].save(i,p))}catch{}let f=n.get(i);if(f)f.down([[x,p]]),c?.touch(i);else{c&&a>0&&c.size()>=a&&d();let u=B(p);n.set(i,u),c?.insert(i)}},invalidate(i){let p=n.get(i);p&&s(i,p)},delete(i){c?.delete(i);let p=n.get(i);p&&p.down([[q]]),n.delete(i);for(let f of e)try{let u=f.clear;u&&ue(u.call(f,i))}catch{}},has(i){return n.has(i)},get size(){return n.size}}}var Ee=class{_version=0;_topics=new Set;get version(){return this._version}get topicCount(){return this._topics.size}hasTopic(t){return this._topics.has(t)}topicNames(){return this._topics.values()}createTopic(t){return this._topics.has(t)?!1:(this._topics.add(t),this._version+=1,!0)}removeTopic(t){let n=this._topics.delete(t);return n&&(this._version+=1),n}};function so(e={}){let{backend:t}=e,n=t??new Ee,a=new Map;function c(r){let o=a.get(r);return o===void 0&&(o=re({describeKind:"state"}),a.set(r,o),n.createTopic(r)),o}return{topic(r){return c(r)},publish(r,o){c(r).emit(o)},publishMany(r){j(()=>{for(let[o,s]of r)c(o).emit(s)})},removeTopic(r){let o=a.get(r);return o===void 0?!1:(a.delete(r),n.removeTopic(r),o.down([[q]]),!0)},has(r){return n.hasTopic(r)},get size(){return n.topicCount},topicNames(){return n.topicNames()}}}var io=new Map([[Ce,"INVALIDATE"],[Le,"PAUSE"],[Ae,"RESUME"],[q,"TEARDOWN"],[C,"COMPLETE"],[E,"ERROR"]]),ao=new Map([["INVALIDATE",Ce],["PAUSE",Le],["RESUME",Ae],["TEARDOWN",q],["COMPLETE",C],["ERROR",E]]);function se(e){let t=io.get(e);return t||(Symbol.keyFor(e)??"UNKNOWN")}function de(e){let t=ao.get(e);if(t)return t;if(e&&e!=="UNKNOWN")return Symbol.for(e)}function le(e){return e instanceof Error?{message:e.message,name:e.name,stack:e.stack}:{message:String(e),name:"Error"}}function fe(e){let t=new Error(e.message);return t.name=e.name,e.stack&&(t.stack=e.stack),t}function ie(e){if(typeof MessagePort<"u"&&e instanceof MessagePort)return{post(t,n){e.postMessage(t,n??[])},listen(t){let n=a=>t(a.data);return e.addEventListener("message",n),e.start(),()=>e.removeEventListener("message",n)},terminate(){e.close()}};if(typeof SharedWorker<"u"&&e instanceof SharedWorker)return ie(e.port);if(typeof Worker<"u"&&e instanceof Worker)return{post(t,n){e.postMessage(t,n??[])},listen(t){let n=a=>t(a.data);return e.addEventListener("message",n),()=>e.removeEventListener("message",n)},terminate(){e.terminate()}};if(typeof BroadcastChannel<"u"&&e instanceof BroadcastChannel)return{post(t,n){n&&n.length>0&&console.warn("[graphrefly] WorkerTransport: BroadcastChannel does not support Transferable objects. The transfer argument is ignored and objects will be cloned instead."),e.postMessage(t)},listen(t){let n=a=>t(a.data);return e.addEventListener("message",n),()=>e.removeEventListener("message",n)},terminate(){e.close()}};if(typeof ServiceWorker<"u"&&e instanceof ServiceWorker)return{post(t,n){e.postMessage(t,n??[])},listen(t){let n=a=>{a.source===e&&t(a.data)};return navigator.serviceWorker.addEventListener("message",n),()=>navigator.serviceWorker.removeEventListener("message",n)}};throw new Error("createTransport: unsupported target type. Expected Worker, SharedWorker, ServiceWorker, BroadcastChannel, or MessagePort.")}function co(e){return typeof e=="object"&&e!==null&&typeof e.post=="function"&&typeof e.listen=="function"}function pr(e,t){let n=co(e)?e:ie(e),a=t.name??"workerBridge",c=Object.entries(t.expose??{}),r=t.import??[],o=t.transfer??{},s=B("connecting",{name:`${a}::meta::status`}),d=B(null,{name:`${a}::meta::error`}),i=new Map,p=new Map;for(let T of r){let y=B(void 0,{name:`${a}::${T}`});i.set(T,y)}let f;if(c.length>0){let T=c.map(([,v])=>v),y=re(T,(v,w)=>{let N={};for(let O=0;O<c.length;O++){let[H]=c[O],z=v[O];z!=null&&z.length>0&&(N[H]=z.at(-1))}Object.keys(N).length!==0&&w.emit(N)},{name:`${a}::aggregated`});f=he([y],v=>{let w=v[0];if(w==null||Object.keys(w).length===0)return;let N=[];for(let z of Object.keys(w)){let J=o[z];J&&N.push(...J(w[z]))}let O;for(let[z,J]of c)z in w&&J.v!=null&&(O==null&&(O={}),O[z]=J.v.version);let H={t:"b",u:w,...O?{v:O}:{}};try{n.post(H,N.length>0?N:void 0)}catch(z){d.down([[x,z instanceof Error?z:new Error(String(z))]])}}).subscribe(()=>{})}let u=!1,l=n.listen(T=>{if(u)return;let y=T;switch(y.t){case"r":{j(()=>{for(let[v,w]of Object.entries(y.stores)){let N=i.get(v);N&&N.down([[x,w]])}}),s.down([[x,"connected"]]);let k={};for(let[v,w]of c)k[v]=w.cache;n.post({t:"i",stores:k});break}case"v":{let k=i.get(y.s);k&&k.down([[x,y.d]]);break}case"b":{j(()=>{for(let[k,v]of Object.entries(y.u)){let w=y.v?.[k];if(w!=null){let O=p.get(k);if(O!=null&&w<=O)continue;p.set(k,w)}let N=i.get(k);N&&N.down([[x,v]])}});break}case"e":{let k=i.get(y.s);k&&k.down([[E,fe(y.err)]]);break}case"s":{let k=de(y.sig);if(!k)break;let v=y.s==="*"?[...i.values()]:i.has(y.s)?[i.get(y.s)]:[];for(let w of v)w.down(y.d===void 0?[[k]]:[[k,y.d]]);break}}}),m=[];for(let[T,y]of c){let k=y.subscribe((v=>{if(!u)for(let w of v){let N=w[0];N!==x&&(G.isLocalOnly(N)||(N===E?n.post({t:"e",s:T,err:le(w[1])}):n.post({t:"s",s:T,sig:se(N),d:w.length>1?w[1]:void 0})))}}));m.push(k)}let h;if(t.timeoutMs!=null&&t.timeoutMs>0){let T=oe(t.timeoutMs),y=Ie(s,v=>v==="connected");h=Fe(We(xe(T,()=>"timeout"),xe(y,()=>"ready"))).subscribe(v=>{for(let w of v)w[0]===x&&w[1]==="timeout"&&(d.down([[x,new Error("Worker bridge handshake timeout")]]),b())})}function b(){if(!u){u=!0,h?.(),n.post({t:"s",s:"*",sig:se(q)}),f&&f();for(let T of m)T();m.length=0,l(),s.down([[x,"closed"]]),p.clear(),i.clear()}}let g={meta:{status:s,error:d},destroy:b};for(let[T,y]of i)g[T]=y;return g}function uo(e){return typeof e=="object"&&e!==null&&typeof e.post=="function"&&typeof e.listen=="function"}function mr(e,t){let n=uo(e)?e:ie(e),a=t.import??[],c=t.transfer??{},r=new Map,o=new Map,s={};for(let b of a){let g=B(void 0,{name:`worker::${b}`});r.set(b,g),s[b]=g}let d=t.expose(s),i=Object.entries(d),p,f=!1;if(i.length>0){let b=i.map(([,y])=>y),g=re(b,(y,k)=>{let v={};for(let w=0;w<i.length;w++){let[N]=i[w],O=y[w];O!=null&&O.length>0&&(v[N]=O.at(-1))}Object.keys(v).length!==0&&k.emit(v)},{name:"workerSelf::aggregated"});p=he([g],y=>{if(f)return;let k=y[0];if(k==null||Object.keys(k).length===0)return;let v=[];for(let O of Object.keys(k)){let H=c[O];H&&v.push(...H(k[O]))}let w;for(let[O,H]of i)O in k&&H.v!=null&&(w==null&&(w={}),w[O]=H.v.version);let N={t:"b",u:k,...w?{v:w}:{}};try{n.post(N,v.length>0?v:void 0)}catch{}}).subscribe(()=>{})}let u=[];for(let[b,g]of i){let T=g.subscribe((y=>{if(!f)for(let k of y){let v=k[0];v!==x&&(G.isLocalOnly(v)||(v===E?n.post({t:"e",s:b,err:le(k[1])}):n.post({t:"s",s:b,sig:se(v),d:k.length>1?k[1]:void 0})))}}));u.push(T)}let l=n.listen(b=>{if(f)return;let g=b;switch(g.t){case"i":{j(()=>{for(let[T,y]of Object.entries(g.stores)){let k=r.get(T);k&&k.down([[x,y]])}});break}case"v":{let T=r.get(g.s);T&&T.down([[x,g.d]]);break}case"b":{j(()=>{for(let[T,y]of Object.entries(g.u)){let k=g.v?.[T];if(k!=null){let w=o.get(T);if(w!=null&&k<=w)continue;o.set(T,k)}let v=r.get(T);v&&v.down([[x,y]])}});break}case"e":{let T=r.get(g.s);T&&T.down([[E,fe(g.err)]]);break}case"s":{let T=de(g.sig);if(!T)break;if(T===q&&g.s==="*"){h();return}let y=g.s==="*"?[...r.values()]:r.has(g.s)?[r.get(g.s)]:[];for(let k of y)k.down(g.d===void 0?[[T]]:[[T,g.d]]);break}}}),m={};for(let[b,g]of i)m[b]=g.cache;n.post({t:"r",stores:m});function h(){if(!f){f=!0,p&&p();for(let b of u)b();u.length=0,l(),n.terminate?.(),o.clear(),r.clear()}}return{destroy:h}}export{ae as a,ze as b,U as c,or as d,un as e,sr as f,dn as g,ln as h,fn as i,pn as j,mn as k,gn as l,Tn as m,yn as n,kn as o,bn as p,hn as q,vn as r,wn as s,Sn as t,En as u,Nn as v,cr as w,Rn as x,Mn as y,Pn as z,Cn as A,Ln as B,An as C,Bn as D,In as E,Fn as F,Wn as G,zn as H,Hn as I,Un as J,Kn as K,jn as L,dr as M,Dn as N,qn as O,Vn as P,$n as Q,_n as R,Qn as S,Jn as T,Yn as U,Gn as V,Xn as W,Zn as X,eo as Y,ro as Z,to as _,no as $,lr as aa,oo as ba,Ee as ca,so as da,se as ea,de as fa,le as ga,fe as ha,ie as ia,pr as ja,mr as ka,lo as la};
|
|
18
|
+
`:JSON.stringify(u),m=r(p,V());await t.putObject({Bucket:n,Key:m,Body:l,ContentType:f})}})}function $n(e,t,n,a){let{toSQL:c=(o,s)=>({sql:`INSERT INTO "${s.replace(/"/g,'""')}" (data) VALUES ($1)`,params:[JSON.stringify(o)]}),onTransportError:r}=a??{};return U(e,{onTransportError:r,serialize:o=>c(o,n),send:async o=>{let s=o;await t.query(s.sql,s.params)}})}function _n(e,t,n){let{toDocument:a=r=>r,onTransportError:c}=n??{};return U(e,{onTransportError:c,serialize:a,send:async r=>{await t.insertOne(r)}})}function Qn(e,t,n){let{labels:a={},toLine:c=s=>JSON.stringify(s),toLabels:r,onTransportError:o}=n??{};return U(e,{onTransportError:o,serialize:s=>({line:c(s),labels:r?{...a,...r(s)}:a}),send:async s=>{let{line:d,labels:i}=s,f=`${V()}`;await t.push({streams:[{stream:i,values:[[f,d]]}]})}})}function Jn(e,t,n){let{toResourceSpans:a=r=>[r],onTransportError:c}=n??{};return U(e,{onTransportError:c,serialize:a,send:async r=>{await t.push({resourceSpans:r})}})}function Yn(e,t,n,a){let{prefix:c="checkpoints/",debounceMs:r=500,compactEvery:o=10,onError:s}=a??{},d={debounceMs:r,compactEvery:o,save(i,f){let p=Math.floor(V()/1e6),u=`${c}${e.name}/checkpoint-${p}.json`,l;try{l=JSON.stringify(f)}catch(m){s?.(m);return}t.putObject({Bucket:n,Key:u,Body:l,ContentType:"application/json"}).catch(m=>s?.(m))},load(){return null}};return e.attachStorage([d],{onError:i=>s?.(i)})}function Gn(e,t,n){let{prefix:a="graphrefly:checkpoint:",debounceMs:c=500,compactEvery:r=10,onError:o}=n??{},s=`${a}${e.name}`,d={debounceMs:c,compactEvery:r,save(i,f){let p;try{p=JSON.stringify(f)}catch(u){o?.(u);return}t.set(s,p).catch(u=>o?.(u))},async load(){let i=await t.get(s);if(i==null)return null;try{return JSON.parse(i)}catch{return null}}};return e.attachStorage([d],{onError:i=>o?.(i)})}function Xn(e,t,n){let{mapRow:a=o=>o,params:c,...r}=n??{};return W(o=>{try{let d=e.query(t,c).map(a);o.emit(d),o.down([[C]])}catch(s){o.down([[E,s instanceof Error?s:new Error(String(s))]])}},{describeKind:"producer",completeWhenDepsComplete:!1,...r})}function Zn(e,t,n){let{mapRow:a=o=>o,params:c,...r}=n??{};return W(o=>{try{let s=e.iterate(t,c);j(()=>{for(let d of s)o.emit(a(d));o.down([[C]])})}catch(s){o.down([[E,s instanceof Error?s:new Error(String(s))]])}},{describeKind:"producer",completeWhenDepsComplete:!1,...r})}function eo(e,t,n,a){if(n.includes("\0")||n.length===0)throw new Error(`toSqlite: invalid table name: ${JSON.stringify(n)}`);let{toSQL:c=(R,D)=>({sql:`INSERT INTO "${D.replace(/"/g,'""')}" (data) VALUES (?)`,params:[JSON.stringify(R)]}),onTransportError:r,batchInsert:o=!1,maxBatchSize:s=1e3,flushIntervalMs:d=0}=a??{},i=R=>c(R,n);if(!o)return U(e,{onTransportError:r,serialize:i,send:R=>{let D=R;t.query(D.sql,D.params)}});let f=B(null),p=B(void 0,{equals:()=>!1}),u=B(null),l=B(0),m=B(0),h=R=>{try{r?.(R)}catch{}try{f.down([[x,R]])}catch{}},b=[],g=!1,T,y=!1,k=()=>m.down([[x,b.length]]),v=R=>{y||p.down([[x,R]])},w=R=>{y||u.down([[x,R]])},N=R=>{y||l.down([[x,R]])},O=R=>{y||h(R)},H=()=>{if(b.length===0||g)return;g=!0,N(1);try{t.query("BEGIN",[])}catch(F){g=!1,N(0),O({stage:"send",error:F instanceof Error?F:new Error(String(F)),value:void 0});return}let R=b;b=[],k();let D,X=0;for(let F of R)try{t.query(F.query.sql,F.query.params),X+=1}catch($){D=$ instanceof Error?$:new Error(String($));break}if(D){try{t.query("ROLLBACK",[])}catch{}O({stage:"send",error:D,value:void 0});for(let F of R)w({value:F.value,error:D,attempts:1})}else try{t.query("COMMIT",[]);for(let F of R)v(F.value)}catch(F){let $=F instanceof Error?F:new Error(String(F));O({stage:"send",error:$,value:void 0});for(let Z=0;Z<X;Z++)w({value:R[Z].value,error:$,attempts:1})}g=!1,N(0)},z=()=>{d>0&&T===void 0&&!y&&(T=setTimeout(()=>{T=void 0,H()},d))},J=e.subscribe(R=>{for(let D of R){let X=D[0];if(X===x){let F=D[1],$;try{$=i(F)}catch(Z){let fe=Z instanceof Error?Z:new Error(String(Z));h({stage:"serialize",error:fe,value:F}),u.down([[x,{value:F,error:fe,attempts:0}]]);continue}b.push({value:F,query:$}),k(),b.length>=s?H():z()}else G.messageTier(X)>=3&&H()}});return{dispose:()=>{if(!y){T!==void 0&&(clearTimeout(T),T=void 0),H(),y=!0,J();for(let R of[f,p,u,l,m])try{R.down([[q]])}catch{}}},sent:p,failed:u,inFlight:l,errors:f,buffered:m,flush:async()=>{y||H()}}}function ro(e,t){let{args:n,mapRow:a=r=>r,...c}=t??{};return W(r=>{let o=!0;return e.findMany(n).then(s=>{o&&(r.emit(s.map(a)),r.down([[C]]))}).catch(s=>{if(o)try{r.down([[E,s instanceof Error?s:new Error(String(s))]])}catch{}}),()=>{o=!1}},{...c,describeKind:"producer",completeWhenDepsComplete:!1})}function to(e,t){let{mapRow:n=c=>c,...a}=t??{};return W(c=>{let r=!0;return e.execute().then(o=>{r&&(c.emit(o.map(n)),c.down([[C]]))}).catch(o=>{if(r)try{c.down([[E,o instanceof Error?o:new Error(String(o))]])}catch{}}),()=>{r=!1}},{...a,describeKind:"producer",completeWhenDepsComplete:!1})}function no(e,t){let{mapRow:n=c=>c,...a}=t??{};return W(c=>{let r=!0;return e.execute().then(o=>{r&&(c.emit(o.map(n)),c.down([[C]]))}).catch(o=>{if(r)try{c.down([[E,o instanceof Error?o:new Error(String(o))]])}catch{}}),()=>{r=!1}},{...a,describeKind:"producer",completeWhenDepsComplete:!1})}function lr(){let e=new Map,t=null,n=null;function a(r){r.prev?r.prev.next=r.next:t=r.next,r.next?r.next.prev=r.prev:n=r.prev,r.prev=null,r.next=null}function c(r){r.next=t,r.prev=null,t&&(t.prev=r),t=r,n===null&&(n=r)}return{insert(r){if(e.has(r)){this.touch(r);return}let o={key:r,prev:null,next:null};e.set(r,o),c(o)},touch(r){let o=e.get(r);o&&(a(o),c(o))},delete(r){let o=e.get(r);o&&(a(o),e.delete(r))},evict(r){let o=[];for(let s=0;s<r&&n!==null;s++){let d=n;o.push(d.key),a(d),e.delete(d.key)}return o},size(){return e.size}}}function pr(e){return e!=null&&typeof e.then=="function"}function ue(e){pr(e)&&e.catch(()=>{})}function oo(e,t){let n=new Map,a=t?.maxSize??0,c=a>0?t?.eviction??lr():null,r=t?.writeThrough??!1;function o(i,f,p){for(let u=0;u<p;u++)try{ue(e[u].save(i,f))}catch{}}function s(i,f,p=0){for(let u=p;u<e.length;u++){let l;try{l=e[u].load(i)}catch{continue}if(pr(l)){let m=u;l.then(h=>{h!=null?(f.down([[x,h]]),o(i,h,m)):s(i,f,m+1)},()=>{s(i,f,m+1)});return}if(l!=null){f.down([[x,l]]),o(i,l,u);return}}}function d(){if(!(!c||a<=0))for(;c.size()>=a;){let i=c.evict(1);if(i.length===0)break;for(let f of i){let p=n.get(f);if(p){let u=p.cache;if(p.status!=="sentinel"&&e.length>0){let l=e.length-1;try{ue(e[l].save(f,u))}catch{}for(let m=0;m<l;m++)try{let h=e[m].clear;h&&ue(h.call(e[m],f))}catch{}}p.down([[q]])}n.delete(f)}}}return{load(i){let f=n.get(i);if(f)return c?.touch(i),f;c&&a>0&&c.size()>=a&&d();let p=B(void 0);return n.set(i,p),c?.insert(i),s(i,p),p},save(i,f){if(r)for(let u of e)try{ue(u.save(i,f))}catch{}else if(e[0])try{ue(e[0].save(i,f))}catch{}let p=n.get(i);if(p)p.down([[x,f]]),c?.touch(i);else{c&&a>0&&c.size()>=a&&d();let u=B(f);n.set(i,u),c?.insert(i)}},invalidate(i){let f=n.get(i);f&&s(i,f)},delete(i){c?.delete(i);let f=n.get(i);f&&f.down([[q]]),n.delete(i);for(let p of e)try{let u=p.clear;u&&ue(u.call(p,i))}catch{}},has(i){return n.has(i)},get size(){return n.size}}}var Ee=class{_version=0;_topics=new Set;get version(){return this._version}get topicCount(){return this._topics.size}hasTopic(t){return this._topics.has(t)}topicNames(){return this._topics.values()}createTopic(t){return this._topics.has(t)?!1:(this._topics.add(t),this._version+=1,!0)}removeTopic(t){let n=this._topics.delete(t);return n&&(this._version+=1),n}};function so(e={}){let{backend:t}=e,n=t??new Ee,a=new Map;function c(r){let o=a.get(r);return o===void 0&&(o=re({describeKind:"state"}),a.set(r,o),n.createTopic(r)),o}return{topic(r){return c(r)},publish(r,o){c(r).emit(o)},publishMany(r){j(()=>{for(let[o,s]of r)c(o).emit(s)})},removeTopic(r){let o=a.get(r);return o===void 0?!1:(a.delete(r),n.removeTopic(r),o.down([[q]]),!0)},has(r){return n.hasTopic(r)},get size(){return n.topicCount},topicNames(){return n.topicNames()}}}var io=new Map([[Ce,"INVALIDATE"],[Le,"PAUSE"],[Ae,"RESUME"],[q,"TEARDOWN"],[C,"COMPLETE"],[E,"ERROR"]]),ao=new Map([["INVALIDATE",Ce],["PAUSE",Le],["RESUME",Ae],["TEARDOWN",q],["COMPLETE",C],["ERROR",E]]);function se(e){let t=io.get(e);return t||(Symbol.keyFor(e)??"UNKNOWN")}function de(e){let t=ao.get(e);if(t)return t;if(e&&e!=="UNKNOWN")return Symbol.for(e)}function le(e){return e instanceof Error?{message:e.message,name:e.name,stack:e.stack}:{message:String(e),name:"Error"}}function pe(e){let t=new Error(e.message);return t.name=e.name,e.stack&&(t.stack=e.stack),t}function ie(e){if(typeof MessagePort<"u"&&e instanceof MessagePort)return{post(t,n){e.postMessage(t,n??[])},listen(t){let n=a=>t(a.data);return e.addEventListener("message",n),e.start(),()=>e.removeEventListener("message",n)},terminate(){e.close()}};if(typeof SharedWorker<"u"&&e instanceof SharedWorker)return ie(e.port);if(typeof Worker<"u"&&e instanceof Worker)return{post(t,n){e.postMessage(t,n??[])},listen(t){let n=a=>t(a.data);return e.addEventListener("message",n),()=>e.removeEventListener("message",n)},terminate(){e.terminate()}};if(typeof BroadcastChannel<"u"&&e instanceof BroadcastChannel)return{post(t,n){n&&n.length>0&&console.warn("[graphrefly] WorkerTransport: BroadcastChannel does not support Transferable objects. The transfer argument is ignored and objects will be cloned instead."),e.postMessage(t)},listen(t){let n=a=>t(a.data);return e.addEventListener("message",n),()=>e.removeEventListener("message",n)},terminate(){e.close()}};if(typeof ServiceWorker<"u"&&e instanceof ServiceWorker)return{post(t,n){e.postMessage(t,n??[])},listen(t){let n=a=>{a.source===e&&t(a.data)};return navigator.serviceWorker.addEventListener("message",n),()=>navigator.serviceWorker.removeEventListener("message",n)}};throw new Error("createTransport: unsupported target type. Expected Worker, SharedWorker, ServiceWorker, BroadcastChannel, or MessagePort.")}function co(e){return typeof e=="object"&&e!==null&&typeof e.post=="function"&&typeof e.listen=="function"}function fr(e,t){let n=co(e)?e:ie(e),a=t.name??"workerBridge",c=Object.entries(t.expose??{}),r=t.import??[],o=t.transfer??{},s=B("connecting",{name:`${a}::meta::status`}),d=B(null,{name:`${a}::meta::error`}),i=new Map,f=new Map;for(let T of r){let y=B(void 0,{name:`${a}::${T}`});i.set(T,y)}let p;if(c.length>0){let T=c.map(([,v])=>v),y=re(T,(v,w)=>{let N={};for(let O=0;O<c.length;O++){let[H]=c[O],z=v[O];z!=null&&z.length>0&&(N[H]=z.at(-1))}Object.keys(N).length!==0&&w.emit(N)},{name:`${a}::aggregated`,partial:!0});p=he([y],v=>{let w=v[0];if(w==null||Object.keys(w).length===0)return;let N=[];for(let z of Object.keys(w)){let J=o[z];J&&N.push(...J(w[z]))}let O;for(let[z,J]of c)z in w&&J.v!=null&&(O==null&&(O={}),O[z]=J.v.version);let H={t:"b",u:w,...O?{v:O}:{}};try{n.post(H,N.length>0?N:void 0)}catch(z){d.down([[x,z instanceof Error?z:new Error(String(z))]])}}).subscribe(()=>{})}let u=!1,l=n.listen(T=>{if(u)return;let y=T;switch(y.t){case"r":{j(()=>{for(let[v,w]of Object.entries(y.stores)){let N=i.get(v);N&&N.down([[x,w]])}}),s.down([[x,"connected"]]);let k={};for(let[v,w]of c)k[v]=w.cache;n.post({t:"i",stores:k});break}case"v":{let k=i.get(y.s);k&&k.down([[x,y.d]]);break}case"b":{j(()=>{for(let[k,v]of Object.entries(y.u)){let w=y.v?.[k];if(w!=null){let O=f.get(k);if(O!=null&&w<=O)continue;f.set(k,w)}let N=i.get(k);N&&N.down([[x,v]])}});break}case"e":{let k=i.get(y.s);k&&k.down([[E,pe(y.err)]]);break}case"s":{let k=de(y.sig);if(!k)break;let v=y.s==="*"?[...i.values()]:i.has(y.s)?[i.get(y.s)]:[];for(let w of v)w.down(y.d===void 0?[[k]]:[[k,y.d]]);break}}}),m=[];for(let[T,y]of c){let k=y.subscribe((v=>{if(!u)for(let w of v){let N=w[0];N!==x&&(G.isLocalOnly(N)||(N===E?n.post({t:"e",s:T,err:le(w[1])}):n.post({t:"s",s:T,sig:se(N),d:w.length>1?w[1]:void 0})))}}));m.push(k)}let h;if(t.timeoutMs!=null&&t.timeoutMs>0){let T=oe(t.timeoutMs),y=Ie(s,v=>v==="connected");h=Fe(We(xe(T,()=>"timeout"),xe(y,()=>"ready"))).subscribe(v=>{for(let w of v)w[0]===x&&w[1]==="timeout"&&(d.down([[x,new Error("Worker bridge handshake timeout")]]),b())})}function b(){if(!u){u=!0,h?.(),n.post({t:"s",s:"*",sig:se(q)}),p&&p();for(let T of m)T();m.length=0,l(),s.down([[x,"closed"]]),f.clear(),i.clear()}}let g={meta:{status:s,error:d},destroy:b};for(let[T,y]of i)g[T]=y;return g}function uo(e){return typeof e=="object"&&e!==null&&typeof e.post=="function"&&typeof e.listen=="function"}function mr(e,t){let n=uo(e)?e:ie(e),a=t.import??[],c=t.transfer??{},r=new Map,o=new Map,s={};for(let b of a){let g=B(void 0,{name:`worker::${b}`});r.set(b,g),s[b]=g}let d=t.expose(s),i=Object.entries(d),f,p=!1;if(i.length>0){let b=i.map(([,y])=>y),g=re(b,(y,k)=>{let v={};for(let w=0;w<i.length;w++){let[N]=i[w],O=y[w];O!=null&&O.length>0&&(v[N]=O.at(-1))}Object.keys(v).length!==0&&k.emit(v)},{name:"workerSelf::aggregated",partial:!0});f=he([g],y=>{if(p)return;let k=y[0];if(k==null||Object.keys(k).length===0)return;let v=[];for(let O of Object.keys(k)){let H=c[O];H&&v.push(...H(k[O]))}let w;for(let[O,H]of i)O in k&&H.v!=null&&(w==null&&(w={}),w[O]=H.v.version);let N={t:"b",u:k,...w?{v:w}:{}};try{n.post(N,v.length>0?v:void 0)}catch{}}).subscribe(()=>{})}let u=[];for(let[b,g]of i){let T=g.subscribe((y=>{if(!p)for(let k of y){let v=k[0];v!==x&&(G.isLocalOnly(v)||(v===E?n.post({t:"e",s:b,err:le(k[1])}):n.post({t:"s",s:b,sig:se(v),d:k.length>1?k[1]:void 0})))}}));u.push(T)}let l=n.listen(b=>{if(p)return;let g=b;switch(g.t){case"i":{j(()=>{for(let[T,y]of Object.entries(g.stores)){let k=r.get(T);k&&k.down([[x,y]])}});break}case"v":{let T=r.get(g.s);T&&T.down([[x,g.d]]);break}case"b":{j(()=>{for(let[T,y]of Object.entries(g.u)){let k=g.v?.[T];if(k!=null){let w=o.get(T);if(w!=null&&k<=w)continue;o.set(T,k)}let v=r.get(T);v&&v.down([[x,y]])}});break}case"e":{let T=r.get(g.s);T&&T.down([[E,pe(g.err)]]);break}case"s":{let T=de(g.sig);if(!T)break;if(T===q&&g.s==="*"){h();return}let y=g.s==="*"?[...r.values()]:r.has(g.s)?[r.get(g.s)]:[];for(let k of y)k.down(g.d===void 0?[[T]]:[[T,g.d]]);break}}}),m={};for(let[b,g]of i)m[b]=g.cache;n.post({t:"r",stores:m});function h(){if(!p){p=!0,f&&f();for(let b of u)b();u.length=0,l(),n.terminate?.(),o.clear(),r.clear()}}return{destroy:h}}export{ae as a,ze as b,U as c,or as d,un as e,sr as f,dn as g,ln as h,pn as i,fn as j,mn as k,gn as l,Tn as m,yn as n,kn as o,bn as p,hn as q,vn as r,wn as s,Sn as t,En as u,Nn as v,cr as w,Rn as x,Mn as y,Pn as z,Cn as A,Ln as B,An as C,Bn as D,In as E,Fn as F,Wn as G,zn as H,Hn as I,Un as J,Kn as K,jn as L,dr as M,Dn as N,qn as O,Vn as P,$n as Q,_n as R,Qn as S,Jn as T,Yn as U,Gn as V,Xn as W,Zn as X,eo as Y,ro as Z,to as _,no as $,lr as aa,oo as ba,Ee as ca,so as da,se as ea,de as fa,le as ga,pe as ha,ie as ia,fr as ja,mr as ka,lo as la};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as G}from"./chunk-5Z4HDCO6.js";import{k as z}from"./chunk-MGKAO4EK.js";import{D as H,E as M,G as N,o as R}from"./chunk-W4TSQ6RJ.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
|
+
`?S="hard-break":S="text",n!==null&&S===n?p+=i:(n!==null&&(u.push(p),s.push(n==="text"&&w),r.push(n)),p=i,n=S)}n!==null&&(u.push(p),s.push(n==="text"&&w),r.push(n)),m.push({texts:u,isWordLike:s,kinds:r})}return m}function V(t,c,m,f,h){let w=D(t);if(w.length===0)return[];let u=O(w),s=new Intl.Segmenter(void 0,{granularity:"grapheme"}),r=[],p=[],n=[];for(let g of u)for(let o=0;o<g.texts.length;o++)r.push(g.texts[o]),p.push(g.kinds[o]),n.push(g.isWordLike[o]);let i=[],S=[],B=[];for(let g=0;g<r.length;g++){let o=r[g],y=p[g],I=n[g];if(y==="text"&&!I&&i.length>0&&S[S.length-1]==="text"&&o.length===1&&(F.has(o)||E.has(o))){i[i.length-1]+=o;continue}if(o==="-"&&i.length>0&&S[S.length-1]==="text"&&B[B.length-1]){i[i.length-1]+=o;continue}i.push(o),S.push(y),B.push(I)}let l=f.get(c);l||(l=new Map,f.set(c,l));function b(g){let o=l.get(g);if(o===void 0){h&&(h.misses+=1);let y=m.measureSegment(g,c).width;o=Number.isFinite(y)&&y>=0?y:0,l.set(g,o)}else h&&(h.hits+=1);return o}let d=[];for(let g=0;g<i.length;g++){let o=i[g],y=S[g];if(y!=="text"){d.push({text:o,width:y==="space"?b(" ")*o.length:0,kind:y,graphemeWidths:null});continue}if(q(o)){let a="";for(let x of s.segment(o)){let k=x.segment;if(a.length>0&&E.has(k)){a+=k;continue}if(a.length>0){let L=b(a);d.push({text:a,width:L,kind:"text",graphemeWidths:null})}a=k}if(a.length>0){let x=b(a);d.push({text:a,width:x,kind:"text",graphemeWidths:null})}continue}let I=b(o),e=null;if(B[g]&&o.length>1){let a=[];for(let x of s.segment(o))a.push(b(x.segment));a.length>1&&(e=a)}d.push({text:o,width:I,kind:"text",graphemeWidths:e})}return d}function J(t,c,m,f,h){if(t.length===0)return{lines:[],lineCount:0};let w=[],u=0,s=!1,r=0,p=0,n=0,i=0,S=-1,B=0,l=h.get(f);l||(l=new Map,h.set(f,l));let b=l.get("-");b===void 0&&(b=m.measureSegment("-",f).width,l.set("-",b));function d(e=n,a=i,x=u){let k="";for(let L=r;L<e;L++){let W=t[L];if(!(W.kind==="soft-hyphen"||W.kind==="hard-break"))if(L===r&&p>0&&W.graphemeWidths){let P=[...new Intl.Segmenter(void 0,{granularity:"grapheme"}).segment(W.text)].map(K=>K.segment);k+=P.slice(p).join("")}else k+=W.text}if(a>0&&e<t.length){let L=t[e],v=[...new Intl.Segmenter(void 0,{granularity:"grapheme"}).segment(L.text)].map(K=>K.segment),P=r===e?p:0;k+=v.slice(P,a).join("")}e>0&&t[e-1]?.kind==="soft-hyphen"&&!(r===e&&p>0)&&(k+="-"),w.push({text:k,width:x,startSegment:r,startGrapheme:p,endSegment:e,endGrapheme:a}),u=0,s=!1,S=-1,B=0}function g(e){return e==="space"||e==="zero-width-break"||e==="soft-hyphen"}function o(e,a,x){s=!0,r=e,p=a,n=e+1,i=0,u=x}function y(e,a,x){s=!0,r=e,p=a,n=e,i=a+1,u=x}for(let e=0;e<t.length;e++){let a=t[e];if(a.kind==="hard-break"){s?d():w.push({text:"",width:0,startSegment:e,startGrapheme:0,endSegment:e,endGrapheme:0}),r=e+1,p=0;continue}let x=a.width;if(!s){x>c&&a.graphemeWidths?I(e,0,a.graphemeWidths):o(e,0,x),g(a.kind)&&(S=e+1,B=a.kind==="space"?u-x:u);continue}let k=u+x;if(k>c+.005){if(g(a.kind)){u+=x,n=e+1,i=0,d(e+1,0,a.kind==="space"?u-x:u);continue}if(S>=0){d(S,0,B),e--;continue}if(x>c&&a.graphemeWidths){d(),I(e,0,a.graphemeWidths);continue}d(),e--;continue}u=k,n=e+1,i=0,g(a.kind)&&(S=e+1,B=a.kind==="space"?u-x:u)}return s&&d(),{lines:w,lineCount:w.length};function I(e,a,x){for(let k=a;k<x.length;k++){let L=x[k];if(!s){y(e,k,L);continue}u+L>c+.005?(d(),y(e,k,L)):(u+=L,n=e,i=k+1)}s&&n===e&&i===x.length&&(n=e+1,i=0)}}function A(t){return t==="space"||t==="zero-width-break"||t==="soft-hyphen"}var T=null;function _(){return T===null&&(T=new Intl.Segmenter(void 0,{granularity:"grapheme"})),T}function j(t,c,m){if(c===0&&m<0)return t.text;let f=[..._().segment(t.text)].map(w=>w.segment),h=m<0?f.length:m;return f.slice(c,h).join("")}function C(t,c,m,f,h,w){let u="";for(let s=c;s<f;s++){let r=t[s];r.kind==="soft-hyphen"||r.kind==="hard-break"||(s===c&&m>0?u+=j(r,m,-1):u+=r.text)}if(h>0&&f<t.length){let s=t[f];u+=j(s,c===f?m:0,h)}return w&&(u+="-"),u}function $(t){if(!t?.adapter||!t.font)return 0;let c=t.cache;if(c){let m=c.get(t.font);m||(m=new Map,c.set(t.font,m));let f=m.get("-");return f===void 0&&(f=t.adapter.measureSegment("-",t.font).width,m.set("-",f)),f}return t.adapter.measureSegment("-",t.font).width}function te(t,c,m,f){let h=c.segmentIndex,w=c.graphemeIndex;if(h>=t.length)return null;if(w===0){for(;h<t.length;){let e=t[h];if(e.kind==="hard-break")return{text:"",width:0,start:{segmentIndex:c.segmentIndex,graphemeIndex:0},end:{segmentIndex:h+1,graphemeIndex:0}};if(e.kind==="space"||e.kind==="zero-width-break"||e.kind==="soft-hyphen"){h+=1;continue}break}if(h>=t.length)return null}let u=$(f),s=h,r=h===c.segmentIndex?w:0,p=0,n=s,i=0,S=!1,B=-1,l=0,b=0,d=!1,g=(e,a,x,k)=>{B=e,l=a,b=x,d=k==="soft-hyphen"},o=(e,a,x)=>{for(let k=a;k<x.length;k++){let L=x[k];if(!S){p=L,n=e,i=k+1,S=!0;continue}if(p+L>m+.005)return!0;p+=L,n=e,i=k+1}return n===e&&i===x.length&&(n=e+1,i=0),!1};if(r>0&&s<t.length){let e=t[s];if(e.graphemeWidths){if(o(s,r,e.graphemeWidths))return{text:C(t,s,r,n,i,!1),width:p,start:{segmentIndex:s,graphemeIndex:r},end:{segmentIndex:n,graphemeIndex:i}};h=n}}for(;h<t.length;){let e=t[h];if(e.kind==="hard-break"){if(S){let k=n>0&&t[n-1]?.kind==="soft-hyphen";return{text:C(t,s,r,n,i,k),width:p+(k?u:0),start:{segmentIndex:s,graphemeIndex:r},end:{segmentIndex:n,graphemeIndex:i}}}return{text:"",width:0,start:{segmentIndex:s,graphemeIndex:r},end:{segmentIndex:h+1,graphemeIndex:0}}}let a=e.width;if(!S){if(a>m&&e.graphemeWidths){if(o(h,0,e.graphemeWidths))return{text:C(t,s,r,n,i,!1),width:p,start:{segmentIndex:s,graphemeIndex:r},end:{segmentIndex:n,graphemeIndex:i}};h=n;continue}p=a,n=h+1,i=0,S=!0,A(e.kind)&&g(h+1,0,e.kind==="space"?p-a:p,e.kind),h+=1;continue}let x=p+a;if(x>m+.005){if(A(e.kind)){n=h+1,i=0;let L=e.kind==="soft-hyphen",W=e.kind==="space"?p:p+(L?u:0);return{text:C(t,s,r,n,i,L),width:W,start:{segmentIndex:s,graphemeIndex:r},end:{segmentIndex:n,graphemeIndex:i}}}return B>=0?{text:C(t,s,r,B,l,d),width:b+(d?u:0),start:{segmentIndex:s,graphemeIndex:r},end:{segmentIndex:B,graphemeIndex:l}}:a>m&&e.graphemeWidths?{text:C(t,s,r,n,i,!1),width:p,start:{segmentIndex:s,graphemeIndex:r},end:{segmentIndex:n,graphemeIndex:i}}:{text:C(t,s,r,n,i,!1),width:p,start:{segmentIndex:s,graphemeIndex:r},end:{segmentIndex:n,graphemeIndex:i}}}p=x,n=h+1,i=0,A(e.kind)&&g(h+1,0,e.kind==="space"?p-a:p,e.kind),h+=1}if(!S)return null;let y=n>0&&t[n-1]?.kind==="soft-hyphen";return{text:C(t,s,r,n,i,y),width:p+(y?u:0),start:{segmentIndex:s,graphemeIndex:r},end:{segmentIndex:n,graphemeIndex:i}}}function ne(t,c,m=0){let f=[t];for(let h=0;h<c.length;h++){let w=c[h],u=[];for(let s=0;s<f.length;s++){let r=f[s];if(w.right<=r.left||w.left>=r.right){u.push(r);continue}w.left>r.left&&u.push({left:r.left,right:w.left}),w.right<r.right&&u.push({left:w.right,right:r.right})}f=u}return m>0?f.filter(h=>h.right-h.left>=m):f}function Q(t,c,m){let f=[],h=new Intl.Segmenter(void 0,{granularity:"grapheme"});for(let w=0;w<t.lines.length;w++){let u=t.lines[w],s=w*m,r=0;for(let p=u.startSegment;p<c.length;p++){let n=c[p];if(n.kind==="soft-hyphen"||n.kind==="hard-break"){if(p>=u.endSegment&&u.endGrapheme===0)break;continue}let i=[...h.segment(n.text)].map(l=>l.segment);if(i.length===0)continue;let S=p===u.startSegment?u.startGrapheme:0,B;if(p<u.endSegment)B=i.length;else if(p===u.endSegment&&u.endGrapheme>0)B=u.endGrapheme;else break;for(let l=S;l<B;l++){let b=n.graphemeWidths?n.graphemeWidths[l]:n.width/i.length;f.push({x:r,y:s,width:b,height:m,line:w}),r+=b}}}return f}function re(t){let{adapter:c,name:m="reactive-layout"}=t,f=new z(m),h=new Map,w=M(t.text??"",{name:"text"}),u=M(t.font??"16px sans-serif",{name:"font"}),s=M(t.lineHeight??20,{name:"line-height"}),r=M(Math.max(0,t.maxWidth??800),{name:"max-width"});function p(l,b){if(l===null||b===null)return l===b;if(l.length!==b.length)return!1;for(let d=0;d<l.length;d++)if(l[d]!==b[d])return!1;return!0}let n=H([w,u],(l,b,d)=>{let g=l[0],o=g!=null&&g.length>0?g.at(-1):d.prevData[0],y=l[1],I=y!=null&&y.length>0?y.at(-1):d.prevData[1],e=R(),a={hits:0,misses:0},x=V(o,I,c,h,a),k=R()-e,L=a.hits+a.misses,W=L===0?1:a.hits/L,v=n.meta;v&&(G(v["cache-hit-rate"],W),G(v["segment-count"],x.length),G(v["layout-time-ns"],k)),b.emit(x);let P=()=>{h.clear(),c.clearCache?.()};return{deactivate:P,invalidate:P}},{name:"segments",describeKind:"derived",meta:{"cache-hit-rate":0,"segment-count":0,"layout-time-ns":0},equals:(l,b)=>{let d=l,g=b;if(d==null||g==null)return d===g;if(d.length!==g.length)return!1;for(let o=0;o<d.length;o++){let y=d[o],I=g[o];if(y.text!==I.text||y.width!==I.width||y.kind!==I.kind||!p(y.graphemeWidths??null,I.graphemeWidths??null))return!1}return!0}}),i=N([n,r,u],([l,b,d])=>J(l,b,c,d,h),{name:"line-breaks",equals:(l,b)=>{let d=l,g=b;if(d==null||g==null)return d===g;if(d.lineCount!==g.lineCount)return!1;for(let o=0;o<d.lines.length;o++){let y=d.lines[o],I=g.lines[o];if(y.text!==I.text||y.width!==I.width||y.startSegment!==I.startSegment||y.startGrapheme!==I.startGrapheme||y.endSegment!==I.endSegment||y.endGrapheme!==I.endGrapheme)return!1}return!0}}),S=N([i,s],([l,b])=>l.lineCount*b,{name:"height"}),B=N([i,n,s],([l,b,d])=>Q(l,b,d),{name:"char-positions",equals:(l,b)=>{let d=l,g=b;if(d==null||g==null)return d===g;if(d.length!==g.length)return!1;for(let o=0;o<d.length;o++)if(d[o].x!==g[o].x||d[o].y!==g[o].y||d[o].width!==g[o].width)return!1;return!0}});return f.add(w,{name:"text"}),f.add(u,{name:"font"}),f.add(s,{name:"line-height"}),f.add(r,{name:"max-width"}),f.add(n,{name:"segments"}),f.add(i,{name:"line-breaks"}),f.add(S,{name:"height"}),f.add(B,{name:"char-positions"}),{graph:f,setText:l=>f.set("text",l),setFont:l=>f.set("font",l),setLineHeight:l=>f.set("line-height",l),setMaxWidth:l=>f.set("max-width",Math.max(0,l)),segments:n,lineBreaks:i,height:S,charPositions:B}}export{V as a,J as b,te as c,ne as d,Q as e,re as f};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{k as C}from"./chunk-MGKAO4EK.js";import{E as w,G as E,o as x}from"./chunk-W4TSQ6RJ.js";import{b as z}from"./chunk-QYADASLV.js";var F={};z(F,{collection:()=>G,decay:()=>K,knowledgeGraph:()=>O,lightCollection:()=>S,vectorIndex:()=>L});function K(s,a,l,r=0){if(!Number.isFinite(s))return r;if(!Number.isFinite(a)||a<=0||!Number.isFinite(l)||l<=0)return Math.max(r,s);let y=s*Math.exp(-l*a);return Math.max(r,y)}function V(s){if(s!==void 0&&s<1)throw new RangeError("maxSize must be >= 1")}function M(s){return new Map(s)}function T(s){return s.cache??new Map}function N(s){return s.cache??[]}function I(s,a){let l=Math.max(s.length,a.length),r=0,y=0,p=0;for(let o=0;o<l;o+=1){let n=s[o]??0,e=a[o]??0;r+=n*e,y+=n*n,p+=e*e}return y===0||p===0?0:r/Math.sqrt(y*p)}function S(s={}){let a=s.maxSize,l=s.policy??"fifo";V(a);let r=w(new Map,{name:s.name,describeKind:"state"});function y(o){if(a!==void 0)for(;o.size>a;){let n;for(let e of o.values()){if(!n){n=e;continue}let i=l==="lru"?e.lastAccessNs:e.createdAtNs,t=l==="lru"?n.lastAccessNs:n.createdAtNs;i<t&&(n=e)}if(!n)break;o.delete(n.id)}}function p(o){r.emit(o)}return{entries:r,upsert(o,n){let e=x(),i=T(r),t=i.get(o),m=M(i);m.set(o,{id:o,value:n,createdAtNs:t?.createdAtNs??e,lastAccessNs:e}),y(m),p(m)},remove(o){let n=M(T(r));n.delete(o)&&p(n)},clear(){T(r).size!==0&&p(new Map)},get(o){let n=T(r),e=n.get(o);if(e){if(l==="lru"){let i=x(),t=M(n);t.set(o,{...e,lastAccessNs:i}),p(t)}return e.value}},has(o){return T(r).has(o)}}}function G(s,a={}){let l=a.maxSize,r=a.policy??"lru",y=a.decayRate??0,p=a.minScore??0,o=a.score??(()=>1);V(l);let n=new C(s),e=w(new Map,{name:"items",describeKind:"state"}),i=E([e],([c])=>{let d=c??new Map,u=x(),h=[...d.values()].map(f=>{let b=(u-f.lastAccessNs)/1e9;return{...f,score:K(f.baseScore,b,y,p)}});return h.sort((f,b)=>b.score-f.score||b.lastAccessNs-f.lastAccessNs),h},{name:"ranked",describeKind:"derived"}),t=E([e],([c])=>(c??new Map).size,{name:"size",describeKind:"derived",initial:0});i.subscribe(()=>{}),t.subscribe(()=>{}),n.add(e,{name:"items"}),n.add(i,{name:"ranked"}),n.add(t,{name:"size"});function m(c,d){let u=(d-c.lastAccessNs)/1e9;return K(c.baseScore,u,y,p)}function v(c){if(l!==void 0)for(;c.size>l;){let d=x(),u,h=Number.POSITIVE_INFINITY;for(let f of c.values()){let b=m(f,d);if(b<h){u=f,h=b;continue}if(b===h&&u){let A=r==="lru"?f.lastAccessNs:f.createdAtNs,R=r==="lru"?u.lastAccessNs:u.createdAtNs;A<R&&(u=f)}}if(!u)break;c.delete(u.id)}}function g(c){e.emit(c)}return Object.assign(n,{upsert(c,d,u){let h=x(),f=T(e),b=f.get(c),A=u?.score??o(d),R=M(f);R.set(c,{id:c,value:d,baseScore:A,createdAtNs:b?.createdAtNs??h,lastAccessNs:h}),v(R),g(R)},remove(c){let d=M(T(e));d.delete(c)&&g(d)},clear(){T(e).size!==0&&g(new Map)},getItem(c){let d=T(e),u=d.get(c);if(u){if(r==="lru"){let h=M(d);h.set(c,{...u,lastAccessNs:x()}),g(h)}return u}}})}function L(s={}){let a=s.backend??"flat",l=s.dimension,r;if(a==="hnsw"&&(r=s.hnswFactory?.(),!r))throw new Error('vectorIndex backend "hnsw" requires an optional dependency adapter; install your HNSW package and provide `hnswFactory`.');let y=w(new Map,{describeKind:"state",name:"vector-index"});function p(n){if(l!==void 0&&n.length!==l)throw new RangeError(`vector dimension mismatch: expected ${l}, got ${n.length}`)}function o(n){y.emit(n)}return{backend:a,entries:y,upsert(n,e,i){p(e);let t=M(T(y));t.set(n,{id:n,vector:[...e],meta:i}),a==="hnsw"&&r.upsert(n,e,i),o(t)},remove(n){let e=M(T(y));e.delete(n)&&(a==="hnsw"&&r.remove(n),o(e))},clear(){T(y).size!==0&&(a==="hnsw"&&r.clear(),o(new Map))},search(n,e=5){return p(n),e<=0?[]:a==="hnsw"?r.search(n,e):[...T(y).values()].map(t=>({id:t.id,score:I(n,t.vector),meta:t.meta})).sort((t,m)=>m.score-t.score).slice(0,e)}}}function O(s){let a=new C(s),l=w(new Map,{name:"entities",describeKind:"state"}),r=w([],{name:"edges",describeKind:"state"}),y=E([r],([e])=>{let i=e??[],t=new Map;for(let m of i){let v=t.get(m.from)??[];t.set(m.from,Object.freeze([...v,m]))}return t},{name:"adjacency",describeKind:"derived",initial:new Map});y.subscribe(()=>{}),a.add(l,{name:"entities"}),a.add(r,{name:"edges"}),a.add(y,{name:"adjacency"});function p(e){l.emit(e)}function o(e){r.emit(e)}return Object.assign(a,{upsertEntity(e,i){let t=M(T(l));t.set(e,i),p(t)},removeEntity(e){let i=M(T(l)),t=i.delete(e),m=N(r),v=m.filter(g=>g.from!==e&&g.to!==e);!t&&v.length===m.length||(p(i),o(v))},link(e,i,t,m=1){let v=`${e}\0${i}\0${t}`,g=N(r),k=new Set(g.map(d=>`${d.from}\0${d.to}\0${d.relation}`)),c=[...g];if(k.has(v))for(let d=0;d<c.length;d+=1){let u=c[d];if(u.from===e&&u.to===i&&u.relation===t){c[d]={...u,weight:m};break}}else c.push({from:e,to:i,relation:t,weight:m});o(c)},unlink(e,i,t){let m=N(r),v=m.filter(g=>t===void 0?!(g.from===e&&g.to===i):!(g.from===e&&g.to===i&&g.relation===t));v.length!==m.length&&o(v)},related(e,i){return N(r).filter(t=>(t.from===e||t.to===e)&&(i===void 0||t.relation===i))}})}export{K as a,S as b,G as c,L as d,O as e,F as f};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{E as v,G as w,m as h}from"./chunk-
|
|
1
|
+
import{E as v,G as w,m as h}from"./chunk-W4TSQ6RJ.js";import{b as m,c as V}from"./chunk-CK2E7BTU.js";function x(s,e){if(s===e)return 0;let r=typeof s;if(r===typeof e&&(r==="number"||r==="string"||r==="boolean"||r==="bigint")){let i=s,n=e;return i<n?-1:i>n?1:0}return String(s).localeCompare(String(e))}function k(s,e){let r=x(s[0],e[0]);return r!==0?r:x(s[1],e[1])}function g(s){return[s.secondary,s.primary]}function y(s,e){let r=g(e),o=0,i=s.length;for(;o<i;){let n=o+i>>1;k(r,g(s[n]))>0?o=n+1:i=n}return o}var b=class{_version=0;_buf=[];_byPrimary=new Map;get version(){return this._version}get size(){return this._buf.length}has(e){return this._byPrimary.has(e)}get(e){return this._byPrimary.get(e)?.value}upsert(e,r,o,i){let n=this._byPrimary.get(e),a={primary:e,secondary:r,value:o};if(n!==void 0&&i?.equals?.(n,a))return!1;if(n!==void 0){let p=y(this._buf,n);this._buf.splice(p,1)}let d=y(this._buf,a);return this._buf.splice(d,0,a),this._byPrimary.set(e,a),this._version+=1,n===void 0}upsertMany(e,r){let o=0;try{for(let i of e){let n=this._byPrimary.get(i.primary),a={primary:i.primary,secondary:i.secondary,value:i.value};if(n!==void 0&&r?.equals?.(n,a))continue;if(n!==void 0){let p=y(this._buf,n);this._buf.splice(p,1)}let d=y(this._buf,a);this._buf.splice(d,0,a),this._byPrimary.set(i.primary,a),o+=1}}finally{o>0&&(this._version+=1)}return o}delete(e){let r=this._byPrimary.get(e);if(r===void 0)return!1;let o=y(this._buf,r);return this._buf.splice(o,1),this._byPrimary.delete(e),this._version+=1,!0}deleteMany(e){let r=0;try{for(let o of e){let i=this._byPrimary.get(o);if(i===void 0)continue;let n=y(this._buf,i);this._buf.splice(n,1),this._byPrimary.delete(o),r+=1}}finally{r>0&&(this._version+=1)}return r}clear(){let e=this._buf.length;return e===0?0:(this._buf.length=0,this._byPrimary.clear(),this._version+=1,e)}toArray(){return[...this._buf]}toPrimaryMap(){let e=new Map;for(let r of this._buf)e.set(r.primary,r.value);return e}};function R(s){return s.subscribe(()=>{})}function U(s={}){let{name:e,versioning:r,equals:o,backend:i}=s,n=i??new b;function a(t){return t?.equals!==void 0||o===void 0?t:{...t,equals:o}}let d=v([],{name:e,describeKind:"state",equals:(t,u)=>t===u,...r!=null?{versioning:r}:{}}),p=w([d],([t])=>{let u=t,l=new Map;for(let f of u)l.set(f.primary,f.value);return l},{initial:n.toPrimaryMap(),describeKind:"derived"}),_=R(p),K=!1;function I(){let t=n.toArray();h(()=>{d.down([[V]]),d.down([[m,t]])})}function c(t){let u=n.version;try{return t()}finally{n.version!==u&&I()}}return{ordered:d,byPrimary:p,has(t){return n.has(t)},get(t){return n.get(t)},get size(){return n.size},upsert(t,u,l,f){return c(()=>n.upsert(t,u,l,a(f)))},upsertMany(t,u){let l=[...t];l.length!==0&&c(()=>n.upsertMany(l,a(u)))},delete(t){c(()=>n.delete(t))},deleteMany(t){let u=[...t];u.length!==0&&c(()=>n.deleteMany(u))},clear(){c(()=>n.clear())},dispose(){K||(K=!0,_())}}}export{b as a,U as b};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as P}from"./chunk-4VVTGLXJ.js";import{m as y}from"./chunk-KASHOCF5.js";import{D as N,F as w,G as W,o as k}from"./chunk-W4TSQ6RJ.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 J(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 Q(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 X(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 Z(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 $(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 ee(d,i){return M(d,1,i)}function ne(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 te(d,i,u){return M(S(d,i,u),1,u)}function oe(d,i,u){return M(V(d,i,u),1,u)}function re(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 se(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 ie(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 K(...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 ue(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 fe(...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 de(...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 le(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 ae(...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 ce(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 Te(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 pe(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,E)=>{if(s=O,E.terminalDeps[0]!=null&&E.terminalDeps[0]!==!0){f(),n.length=0;return}if(E.terminalDeps[0]===!0){r=!0,l();return}let x=h[0];if(!(x==null||x.length===0)){for(let v of x)T(v);return{deactivate:()=>{f(),n.length=0,r=!1}}}},{...c(e),completeWhenDepsComplete:!1})}function q(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 E(v){o<n?h(v):f.push(v)}function x(){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){x();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)E(U);return{deactivate:()=>{x(),r=!1}}}},{...c(e),completeWhenDepsComplete:!1})}var me=q;function be(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 _(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 j(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 E(){l!==void 0&&(clearTimeout(l),l=void 0)}let x=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),E(),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)&&(E(),f.down([g]))});return()=>{x(),E()}},c(n))}function we(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 Ne(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 he(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 ve(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 ge(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 Oe(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 Ee(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 xe(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 Re(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 De(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 ye(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 ke(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 Ie(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 Ue=K,Me=_,Ce=j,Ae=L;export{J as a,S as b,Q as c,X as d,M as e,V as f,Z as g,$ as h,ee as i,ne as j,te as k,oe as l,re as m,se as n,ie as o,K as p,ue as q,fe as r,de as s,le as t,ae as u,ce as v,Te as w,pe as x,q as y,me as z,be as A,_ as B,j as C,we as D,Ne as E,he as F,ve as G,ge as H,Oe as I,Ee as J,xe as K,Re as L,De as M,ye as N,ke as O,L as P,Ie as Q,Ue as R,Me as S,Ce as T,Ae as U};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{A as u,n as i}from"./chunk-
|
|
1
|
+
import{A as u,n as i}from"./chunk-W4TSQ6RJ.js";import{b as t,c as o}from"./chunk-CK2E7BTU.js";function s(r,n){r!=null&&i(e=>r.down(e),[[t,n]],u.tierOf)}function p(r,n){let e=r.cache??0;return e>=n?!1:(r.down([[o],[t,e+1]]),!0)}function g(r,n,e){return{[r]:!0,[`${r}_type`]:n,...e??{}}}function l(r){return r.relatedTo?.[0]??r.summary}export{s as a,p as b,g as c,l as d};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as $}from"./chunk-
|
|
1
|
+
import{a as $}from"./chunk-33FA6V4B.js";import{c as O}from"./chunk-5Z4HDCO6.js";import{a as C}from"./chunk-GNCBXARM.js";import{k as A}from"./chunk-MGKAO4EK.js";import{b as x}from"./chunk-AUY2YKCO.js";import{A as R}from"./chunk-KASHOCF5.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-W4TSQ6RJ.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};
|