@graphrefly/graphrefly 0.36.0 → 0.38.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.
Files changed (249) hide show
  1. package/dist/{chunk-J6TGRQUP.js → chunk-2YFDSYEF.js} +1 -1
  2. package/dist/{chunk-JUJEPZOI.js → chunk-4BDQXBXE.js} +1 -1
  3. package/dist/chunk-5BGFS2XH.js +1 -0
  4. package/dist/chunk-6773HURD.js +1 -0
  5. package/dist/{chunk-AQC53OWG.js → chunk-6KZZ6XQE.js} +1 -1
  6. package/dist/{chunk-5CPPC75H.js → chunk-6VFC334U.js} +1 -1
  7. package/dist/{chunk-KUVDFOJH.js → chunk-7KZZLWZ6.js} +1 -1
  8. package/dist/{chunk-Q7EUZ6NN.js → chunk-B5S7KTGP.js} +1 -1
  9. package/dist/chunk-CMTN3KPT.js +80 -0
  10. package/dist/chunk-DQJLC6YY.js +1 -0
  11. package/dist/chunk-DSOVKKTI.js +1 -0
  12. package/dist/chunk-FAYEMS5M.js +1 -0
  13. package/dist/chunk-FWGIZP3W.js +1 -0
  14. package/dist/{chunk-5Z3AFBN7.js → chunk-G7JN6LCB.js} +1 -1
  15. package/dist/{chunk-PCD2MU7X.js → chunk-IBGE62GZ.js} +1 -1
  16. package/dist/{chunk-MYFR67PY.js → chunk-K5C67OGE.js} +1 -1
  17. package/dist/chunk-KJEAIIIY.js +43 -0
  18. package/dist/chunk-LV3ACS5J.js +1 -0
  19. package/dist/{chunk-7LYIKMW5.js → chunk-NBGPXQSP.js} +1 -1
  20. package/dist/chunk-NN3QPJ6U.js +1 -0
  21. package/dist/{chunk-T6RPUERH.js → chunk-NSAZ6PR6.js} +1 -1
  22. package/dist/{chunk-KCE6WWJE.js → chunk-NV63VQHI.js} +1 -1
  23. package/dist/{chunk-PYEIPRSZ.js → chunk-O245YLM5.js} +1 -1
  24. package/dist/{chunk-K5ZXJPWU.js → chunk-O2BLVQU4.js} +1 -1
  25. package/dist/chunk-PHXZRR6C.js +1 -0
  26. package/dist/{chunk-I57VSGRB.js → chunk-POCWFIJ7.js} +1 -1
  27. package/dist/{chunk-TQSTS3BY.js → chunk-QEVSIVSF.js} +1 -1
  28. package/dist/chunk-QMC2PLNM.js +7 -0
  29. package/dist/chunk-QOJFR6GS.js +1 -0
  30. package/dist/{chunk-MQZWA3DF.js → chunk-RZ5HKPGI.js} +1 -1
  31. package/dist/{chunk-XINLP35X.js → chunk-SFK7MN7S.js} +1 -1
  32. package/dist/{chunk-YOUAVGHJ.js → chunk-SP5O2MIX.js} +1 -1
  33. package/dist/chunk-TB7JKSVS.js +61 -0
  34. package/dist/{chunk-6G5YD37E.js → chunk-TMVY7OWG.js} +1 -1
  35. package/dist/{chunk-F36TA3ET.js → chunk-UAXFKMAG.js} +1 -1
  36. package/dist/{chunk-AACJX2L7.js → chunk-UVLZX2OU.js} +1 -1
  37. package/dist/chunk-XIMFHEKV.js +1 -0
  38. package/dist/{chunk-LO3LO2TO.js → chunk-XLMYQB6F.js} +1 -1
  39. package/dist/{chunk-44QWWUA3.js → chunk-XLYF4LBH.js} +1 -1
  40. package/dist/compat/index.cjs +9 -9
  41. package/dist/compat/index.d.cts +7 -7
  42. package/dist/compat/index.d.ts +7 -7
  43. package/dist/compat/index.js +1 -1
  44. package/dist/compat/nestjs/index.cjs +9 -9
  45. package/dist/compat/nestjs/index.d.cts +5 -5
  46. package/dist/compat/nestjs/index.d.ts +5 -5
  47. package/dist/compat/nestjs/index.js +1 -1
  48. package/dist/compat/zustand/index.cjs +7 -7
  49. package/dist/compat/zustand/index.d.cts +3 -3
  50. package/dist/compat/zustand/index.d.ts +3 -3
  51. package/dist/compat/zustand/index.js +1 -1
  52. package/dist/{composite-_XckYx2e.d.cts → composite-CgG0MqHm.d.cts} +8 -1
  53. package/dist/{composite-CT_mApQD.d.ts → composite-DTOlDuch.d.ts} +8 -1
  54. package/dist/core/index.cjs +1 -1
  55. package/dist/core/index.d.cts +2 -2
  56. package/dist/core/index.d.ts +2 -2
  57. package/dist/core/index.js +1 -1
  58. package/dist/extra/index.cjs +19 -19
  59. package/dist/extra/index.d.cts +5 -5
  60. package/dist/extra/index.d.ts +5 -5
  61. package/dist/extra/index.js +1 -1
  62. package/dist/extra/node.cjs +2 -2
  63. package/dist/extra/node.d.cts +107 -1
  64. package/dist/extra/node.d.ts +107 -1
  65. package/dist/extra/node.js +2 -2
  66. package/dist/extra/operators.cjs +1 -1
  67. package/dist/extra/operators.js +1 -1
  68. package/dist/extra/reactive.d.cts +1 -1
  69. package/dist/extra/reactive.d.ts +1 -1
  70. package/dist/extra/reactive.js +1 -1
  71. package/dist/extra/sources.cjs +1 -1
  72. package/dist/extra/sources.js +1 -1
  73. package/dist/extra/storage-tiers-browser.d.cts +76 -5
  74. package/dist/extra/storage-tiers-browser.d.ts +76 -5
  75. package/dist/extra/storage-tiers-node.d.cts +137 -13
  76. package/dist/extra/storage-tiers-node.d.ts +137 -13
  77. package/dist/extra/storage-tiers.d.cts +151 -23
  78. package/dist/extra/storage-tiers.d.ts +151 -23
  79. package/dist/graph/index.cjs +7 -7
  80. package/dist/graph/index.d.cts +4 -4
  81. package/dist/graph/index.d.ts +4 -4
  82. package/dist/graph/index.js +1 -1
  83. package/dist/{graph-Cv-8x0ZI.d.ts → graph-BjW1taJl.d.ts} +243 -11
  84. package/dist/{graph-kTltt95s.d.cts → graph-CHsVwf9S.d.cts} +243 -11
  85. package/dist/{index-CZAixNU3.d.ts → index-5dNRlW7J.d.ts} +3 -3
  86. package/dist/{index-DtSVSKnd.d.ts → index-AUqWe_fX.d.ts} +7 -4
  87. package/dist/{index-DLyQC5Ww.d.ts → index-B-ORMr3k.d.ts} +2 -2
  88. package/dist/{index-C4ig7whw.d.cts → index-B2IUcH13.d.cts} +2 -2
  89. package/dist/{index-KeBhbNg3.d.ts → index-BFaALJxR.d.ts} +2 -2
  90. package/dist/{index-CsD0fqnO.d.ts → index-BI1wMfyc.d.ts} +2 -2
  91. package/dist/{index-DxxvGTXp.d.ts → index-BUFCHvOR.d.ts} +2 -2
  92. package/dist/{index-HCp5ua_i.d.cts → index-BWUMIt7J.d.cts} +3 -3
  93. package/dist/{index-DHv2M7s8.d.cts → index-BaSy4L6w.d.cts} +37 -17
  94. package/dist/{index-BhkPzu-Z.d.cts → index-BgzPO43H.d.cts} +2 -2
  95. package/dist/{index-BsZlbHM5.d.cts → index-BhzwpIJc.d.cts} +1 -1
  96. package/dist/{index-BC-xjOrd.d.cts → index-BkQqf1EF.d.cts} +80 -7
  97. package/dist/{index-BBdwz2BW.d.ts → index-BmWuVdER.d.ts} +2 -2
  98. package/dist/{index-CVhBdCMf.d.ts → index-Bn0uZEL4.d.ts} +2 -2
  99. package/dist/{index-33mF4XyU.d.cts → index-BpMZzX9P.d.cts} +2 -2
  100. package/dist/{index-ZhKyR8co.d.cts → index-Bpr0Pwgl.d.cts} +2 -2
  101. package/dist/{index-2URa-V4S.d.cts → index-BqcgiSQg.d.cts} +2 -2
  102. package/dist/{index-DzYTXMBz.d.ts → index-BsZk9T8y.d.ts} +1 -1
  103. package/dist/{index-CvUrRb4m.d.cts → index-BsgxnHN8.d.cts} +2 -2
  104. package/dist/index-Bub6x_D4.d.cts +427 -0
  105. package/dist/{index-BZ1V5GzX.d.ts → index-BwOsJfLJ.d.ts} +2 -2
  106. package/dist/{index-BuMzxRO2.d.ts → index-Byp771zP.d.ts} +1 -1
  107. package/dist/{index-DKp1CIbG.d.cts → index-C-3UXnHT.d.cts} +1 -1
  108. package/dist/{index-GaW6Welt.d.cts → index-C56XZiDe.d.cts} +2 -2
  109. package/dist/{index-k67aNfqC.d.cts → index-CAV-3RpJ.d.cts} +2 -2
  110. package/dist/{index-DmtWMP0X.d.cts → index-CAbHN_rP.d.cts} +1 -1
  111. package/dist/{index-BTJxM-wZ.d.ts → index-CEVzBWeB.d.ts} +2 -2
  112. package/dist/{index-BVNGEX7d.d.cts → index-CM-i58FY.d.cts} +2 -2
  113. package/dist/{index-EfPb77rT.d.cts → index-CQsqqEVz.d.cts} +1 -1
  114. package/dist/{index-Cot94_82.d.ts → index-CijfwEWx.d.ts} +2 -2
  115. package/dist/{index-PluovH45.d.cts → index-Ckil6miL.d.cts} +2 -2
  116. package/dist/{index-XxSeddWP.d.cts → index-CpdnP-0y.d.cts} +1 -1
  117. package/dist/{index-Pu1Wa7en.d.ts → index-CrlHFsiT.d.ts} +37 -17
  118. package/dist/{index-BWH17rK_.d.cts → index-Czk3r0yA.d.cts} +37 -3
  119. package/dist/{index-BlRVj-7Q.d.cts → index-D-B7U42V.d.cts} +2 -2
  120. package/dist/{index-B4s70vYf.d.ts → index-D-HZ7sP4.d.ts} +2 -2
  121. package/dist/{index-Cjrpx2Mg.d.cts → index-D7-RSD93.d.cts} +2 -2
  122. package/dist/{index-kBUQj-rT.d.ts → index-D9vBTuzo.d.ts} +2 -2
  123. package/dist/{index-DzCQt2FJ.d.cts → index-DJNAWzcH.d.cts} +2 -2
  124. package/dist/{index-DSSsxS7B.d.ts → index-DJVQ-t07.d.ts} +2 -2
  125. package/dist/{index-BwYGLgmI.d.ts → index-DKrIuF-r.d.ts} +2 -2
  126. package/dist/{index-DXSLMoma.d.ts → index-DOU1Ee_k.d.ts} +1 -1
  127. package/dist/{index-DlccEIi3.d.ts → index-DTDVDzhA.d.ts} +37 -3
  128. package/dist/{index-B5UR87KG.d.ts → index-DY2f2b9z.d.ts} +4 -2
  129. package/dist/{index-D8IyqHvT.d.cts → index-DeSsvHDD.d.cts} +4 -2
  130. package/dist/index-Di7OdwlO.d.ts +427 -0
  131. package/dist/{index-isdlyeeO.d.ts → index-DqICM_I7.d.ts} +80 -7
  132. package/dist/{index-DFe2Pk2u.d.ts → index-ML6vHKXK.d.ts} +1 -1
  133. package/dist/{index-RJIY7QVW.d.cts → index-UsU9ptzs.d.cts} +7 -4
  134. package/dist/{index-jA_OwwNg.d.ts → index-Vz7KPfgz.d.ts} +1 -1
  135. package/dist/index.cjs +50 -50
  136. package/dist/index.d.cts +32 -32
  137. package/dist/index.d.ts +32 -32
  138. package/dist/index.js +1 -1
  139. package/dist/meta-BYqlATmg.d.ts +98 -0
  140. package/dist/meta-DreaEM_a.d.cts +98 -0
  141. package/dist/patterns/ai/browser.cjs +2 -2
  142. package/dist/patterns/ai/browser.js +1 -1
  143. package/dist/patterns/ai/index.cjs +21 -21
  144. package/dist/patterns/ai/index.d.cts +9 -9
  145. package/dist/patterns/ai/index.d.ts +9 -9
  146. package/dist/patterns/ai/index.js +1 -1
  147. package/dist/patterns/ai/node.js +1 -1
  148. package/dist/patterns/audit/index.cjs +7 -7
  149. package/dist/patterns/audit/index.d.cts +5 -5
  150. package/dist/patterns/audit/index.d.ts +5 -5
  151. package/dist/patterns/audit/index.js +1 -1
  152. package/dist/patterns/cqrs/index.cjs +7 -7
  153. package/dist/patterns/cqrs/index.d.cts +4 -4
  154. package/dist/patterns/cqrs/index.d.ts +4 -4
  155. package/dist/patterns/cqrs/index.js +1 -1
  156. package/dist/patterns/demo-shell/index.cjs +8 -8
  157. package/dist/patterns/demo-shell/index.d.cts +4 -4
  158. package/dist/patterns/demo-shell/index.d.ts +4 -4
  159. package/dist/patterns/demo-shell/index.js +1 -1
  160. package/dist/patterns/domain-templates/index.cjs +7 -7
  161. package/dist/patterns/domain-templates/index.d.cts +3 -3
  162. package/dist/patterns/domain-templates/index.d.ts +3 -3
  163. package/dist/patterns/domain-templates/index.js +1 -1
  164. package/dist/patterns/graphspec/index.cjs +21 -21
  165. package/dist/patterns/graphspec/index.d.cts +3 -3
  166. package/dist/patterns/graphspec/index.d.ts +3 -3
  167. package/dist/patterns/graphspec/index.js +1 -1
  168. package/dist/patterns/guarded-execution/index.cjs +7 -7
  169. package/dist/patterns/guarded-execution/index.d.cts +6 -6
  170. package/dist/patterns/guarded-execution/index.d.ts +6 -6
  171. package/dist/patterns/guarded-execution/index.js +1 -1
  172. package/dist/patterns/harness/index.cjs +12 -12
  173. package/dist/patterns/harness/index.d.cts +8 -8
  174. package/dist/patterns/harness/index.d.ts +8 -8
  175. package/dist/patterns/harness/index.js +1 -1
  176. package/dist/patterns/job-queue/index.cjs +7 -7
  177. package/dist/patterns/job-queue/index.d.cts +4 -4
  178. package/dist/patterns/job-queue/index.d.ts +4 -4
  179. package/dist/patterns/job-queue/index.js +1 -1
  180. package/dist/patterns/lens/index.cjs +7 -7
  181. package/dist/patterns/lens/index.d.cts +4 -4
  182. package/dist/patterns/lens/index.d.ts +4 -4
  183. package/dist/patterns/lens/index.js +1 -1
  184. package/dist/patterns/memory/index.cjs +7 -7
  185. package/dist/patterns/memory/index.d.cts +6 -4
  186. package/dist/patterns/memory/index.d.ts +6 -4
  187. package/dist/patterns/memory/index.js +1 -1
  188. package/dist/patterns/messaging/index.cjs +7 -7
  189. package/dist/patterns/messaging/index.d.cts +4 -4
  190. package/dist/patterns/messaging/index.d.ts +4 -4
  191. package/dist/patterns/messaging/index.js +1 -1
  192. package/dist/patterns/orchestration/index.cjs +7 -7
  193. package/dist/patterns/orchestration/index.d.cts +4 -4
  194. package/dist/patterns/orchestration/index.d.ts +4 -4
  195. package/dist/patterns/orchestration/index.js +1 -1
  196. package/dist/patterns/process/index.cjs +1 -1
  197. package/dist/patterns/process/index.d.cts +5 -5
  198. package/dist/patterns/process/index.d.ts +5 -5
  199. package/dist/patterns/process/index.js +1 -1
  200. package/dist/patterns/reactive-layout/index.cjs +8 -8
  201. package/dist/patterns/reactive-layout/index.d.cts +4 -4
  202. package/dist/patterns/reactive-layout/index.d.ts +4 -4
  203. package/dist/patterns/reactive-layout/index.js +1 -1
  204. package/dist/patterns/reduction/index.cjs +7 -7
  205. package/dist/patterns/reduction/index.d.cts +3 -3
  206. package/dist/patterns/reduction/index.d.ts +3 -3
  207. package/dist/patterns/reduction/index.js +1 -1
  208. package/dist/patterns/refine-loop/index.cjs +8 -8
  209. package/dist/patterns/refine-loop/index.d.cts +5 -5
  210. package/dist/patterns/refine-loop/index.d.ts +5 -5
  211. package/dist/patterns/refine-loop/index.js +1 -1
  212. package/dist/patterns/resilient-pipeline/index.cjs +1 -1
  213. package/dist/patterns/resilient-pipeline/index.d.cts +4 -4
  214. package/dist/patterns/resilient-pipeline/index.d.ts +4 -4
  215. package/dist/patterns/resilient-pipeline/index.js +1 -1
  216. package/dist/patterns/surface/index.cjs +14 -14
  217. package/dist/patterns/surface/index.d.cts +4 -4
  218. package/dist/patterns/surface/index.d.ts +4 -4
  219. package/dist/patterns/surface/index.js +1 -1
  220. package/dist/{pipeline-graph-DdBoRu37.d.ts → pipeline-graph-9JBbmRxA.d.ts} +2 -2
  221. package/dist/{pipeline-graph-BlLBWSZ2.d.cts → pipeline-graph-DuHpXSOn.d.cts} +2 -2
  222. package/dist/{reactive-layout-D9zqqaqK.d.cts → reactive-layout-BMLDB4Vd.d.cts} +1 -1
  223. package/dist/{reactive-layout-Btv0-efV.d.ts → reactive-layout-D-tRiNhg.d.ts} +1 -1
  224. package/dist/{reactive-log-jirQsxMY.d.ts → reactive-log-BgWSA1fg.d.ts} +28 -1
  225. package/dist/{reactive-log-ScpWyqny.d.cts → reactive-log-C3IMAGpT.d.cts} +28 -1
  226. package/dist/resilience-LGBK236C.js +1 -0
  227. package/dist/{topology-tree-CJsT24DP.d.ts → topology-tree-D47-nI6Z.d.ts} +1 -1
  228. package/dist/{topology-tree-C50l9ARE.d.cts → topology-tree-jrZue3ao.d.cts} +1 -1
  229. package/package.json +1 -1
  230. package/dist/chunk-3U7IIQB2.js +0 -1
  231. package/dist/chunk-533RQFF6.js +0 -1
  232. package/dist/chunk-5CZ3KIRJ.js +0 -1
  233. package/dist/chunk-5KPIYVCC.js +0 -7
  234. package/dist/chunk-5RTZ6DXG.js +0 -1
  235. package/dist/chunk-A5HZZYRK.js +0 -1
  236. package/dist/chunk-CGA5RXO6.js +0 -1
  237. package/dist/chunk-DBPFMCVH.js +0 -1
  238. package/dist/chunk-GWOKTENT.js +0 -1
  239. package/dist/chunk-JJTF75VS.js +0 -1
  240. package/dist/chunk-KL7CILPL.js +0 -1
  241. package/dist/chunk-M27MVZCP.js +0 -1
  242. package/dist/chunk-N2GCKKKH.js +0 -43
  243. package/dist/chunk-QKUWS7CO.js +0 -80
  244. package/dist/chunk-YBA5N4XY.js +0 -61
  245. package/dist/index-CI_yjtua.d.ts +0 -139
  246. package/dist/index-D9qoEOj_.d.cts +0 -139
  247. package/dist/meta-BGO6C7K9.d.cts +0 -41
  248. package/dist/meta-CC6EPdpK.d.ts +0 -41
  249. package/dist/resilience-OBU472D2.js +0 -1
@@ -1,9 +1,9 @@
1
1
  import '../../node-fSc-hCv8.cjs';
2
2
  import '../../extra/sources.cjs';
3
- import '../../graph-kTltt95s.cjs';
4
- import '../../index-33mF4XyU.cjs';
5
- export { A as AnalyzeEvent, B as BlindVariationContext, d as BlindVariationOptions, C as ConvergenceOptions, D as DatasetItem, e as DecideEvent, f as ErrorCritiqueContext, g as ErrorCritiqueOptions, a as EvalResult, h as EvaluateEvent, E as Evaluator, F as Feedback, G as GenerateEvent, I as Iteration, j as RefineLoopGraph, b as RefineLoopOptions, c as RefineStatus, R as RefineStrategy, k as blindVariation, l as errorCritique, r as refineLoop } from '../../index-CvUrRb4m.cjs';
6
- import '../../meta-BGO6C7K9.cjs';
3
+ import '../../graph-CHsVwf9S.cjs';
4
+ import '../../index-BpMZzX9P.cjs';
5
+ export { A as AnalyzeEvent, B as BlindVariationContext, d as BlindVariationOptions, C as ConvergenceOptions, D as DatasetItem, e as DecideEvent, f as ErrorCritiqueContext, g as ErrorCritiqueOptions, a as EvalResult, h as EvaluateEvent, E as Evaluator, F as Feedback, G as GenerateEvent, I as Iteration, j as RefineLoopGraph, b as RefineLoopOptions, c as RefineStatus, R as RefineStrategy, k as blindVariation, l as errorCritique, r as refineLoop } from '../../index-BsgxnHN8.cjs';
6
+ import '../../meta-DreaEM_a.cjs';
7
7
  import '../../extra/storage-core.cjs';
8
8
  import '../../extra/storage-tiers.cjs';
9
- import '../../reactive-log-ScpWyqny.cjs';
9
+ import '../../reactive-log-C3IMAGpT.cjs';
@@ -1,9 +1,9 @@
1
1
  import '../../node-fSc-hCv8.js';
2
2
  import '../../extra/sources.js';
3
- import '../../graph-Cv-8x0ZI.js';
4
- import '../../index-DxxvGTXp.js';
5
- export { A as AnalyzeEvent, B as BlindVariationContext, d as BlindVariationOptions, C as ConvergenceOptions, D as DatasetItem, e as DecideEvent, f as ErrorCritiqueContext, g as ErrorCritiqueOptions, a as EvalResult, h as EvaluateEvent, E as Evaluator, F as Feedback, G as GenerateEvent, I as Iteration, j as RefineLoopGraph, b as RefineLoopOptions, c as RefineStatus, R as RefineStrategy, k as blindVariation, l as errorCritique, r as refineLoop } from '../../index-CsD0fqnO.js';
6
- import '../../meta-CC6EPdpK.js';
3
+ import '../../graph-BjW1taJl.js';
4
+ import '../../index-BUFCHvOR.js';
5
+ export { A as AnalyzeEvent, B as BlindVariationContext, d as BlindVariationOptions, C as ConvergenceOptions, D as DatasetItem, e as DecideEvent, f as ErrorCritiqueContext, g as ErrorCritiqueOptions, a as EvalResult, h as EvaluateEvent, E as Evaluator, F as Feedback, G as GenerateEvent, I as Iteration, j as RefineLoopGraph, b as RefineLoopOptions, c as RefineStatus, R as RefineStrategy, k as blindVariation, l as errorCritique, r as refineLoop } from '../../index-BI1wMfyc.js';
6
+ import '../../meta-BYqlATmg.js';
7
7
  import '../../extra/storage-core.js';
8
8
  import '../../extra/storage-tiers.js';
9
- import '../../reactive-log-jirQsxMY.js';
9
+ import '../../reactive-log-BgWSA1fg.js';
@@ -1 +1 @@
1
- import{a,b,c}from"../../chunk-PYEIPRSZ.js";import"../../chunk-AQC53OWG.js";import"../../chunk-O32GJOUJ.js";import"../../chunk-M27MVZCP.js";import"../../chunk-T6RPUERH.js";import"../../chunk-KUVDFOJH.js";import"../../chunk-5KPIYVCC.js";import"../../chunk-SGS4OJGS.js";import"../../chunk-ESMPEKEV.js";import"../../chunk-533RQFF6.js";import"../../chunk-JJTF75VS.js";import"../../chunk-4VVTGLXJ.js";import"../../chunk-MQZWA3DF.js";import"../../chunk-LYCLF26R.js";import"../../chunk-CK2E7BTU.js";import"../../chunk-QYADASLV.js";export{b as blindVariation,c as errorCritique,a as refineLoop};
1
+ import{a,b,c}from"../../chunk-O245YLM5.js";import"../../chunk-6KZZ6XQE.js";import"../../chunk-O32GJOUJ.js";import"../../chunk-NSAZ6PR6.js";import"../../chunk-PHXZRR6C.js";import"../../chunk-QMC2PLNM.js";import"../../chunk-SGS4OJGS.js";import"../../chunk-ESMPEKEV.js";import"../../chunk-6773HURD.js";import"../../chunk-4VVTGLXJ.js";import"../../chunk-DQJLC6YY.js";import"../../chunk-7KZZLWZ6.js";import"../../chunk-RZ5HKPGI.js";import"../../chunk-LYCLF26R.js";import"../../chunk-CK2E7BTU.js";import"../../chunk-QYADASLV.js";export{b as blindVariation,c as errorCritique,a as refineLoop};
@@ -1 +1 @@
1
- "use strict";var pe=Object.defineProperty;var bt=Object.getOwnPropertyDescriptor;var gt=Object.getOwnPropertyNames;var yt=Object.prototype.hasOwnProperty;var k=(t,e)=>()=>(t&&(e=t(t=0)),e);var _t=(t,e)=>{for(var n in e)pe(t,n,{get:e[n],enumerable:!0})},wt=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of gt(e))!yt.call(t,o)&&o!==n&&pe(t,o,{get:()=>e[o],enumerable:!(r=bt(e,o))||r.enumerable});return t};var Tt=t=>wt(pe({},"__esModule",{value:!0}),t);function D(t){return t<0?0:t}function vt(t,e){return e==="none"?t:e==="full"?Math.random()*t:t/2+Math.random()*(t/2)}function xt(t,e){return t+Math.random()*(e-t)}function Nt(t){let e=D(t);return()=>e}function kt(t,e){let n=D(t),r=e===void 0?n:D(e);return o=>n+r*Math.max(0,o)}function Et(t){let e=D(t?.baseNs??1e8),n=t?.factor!==void 0&&t.factor<1?1:t?.factor??2,r=D(t?.maxDelayNs??30*1e9),o=t?.jitter??"none";return a=>{let s;if(e===0)s=0;else if(n===1)s=e;else{let i=r/e,u=1;for(let d=0;d<Math.max(0,a);d++){if(u>=i){u=i;break}u*=n}s=e*u,s>r&&(s=r)}return vt(s,o)}}function St(t=100*1e6,e=30*1e9){let n=D(t),r=D(e);function o(a){if(a<=0)return 1;let s=1,i=2;for(let u=1;u<a;u++){let d=s+i;s=i,i=d}return i}return a=>{let s=o(a)*n;return s<=r?s:r}}function Ot(t=100*1e6,e=30*1e9){return(n,r,o)=>{let s=Math.min(e,(o??t)*3);return xt(t,s)}}function he(t){if(t==="constant")return Nt(1*1e9);if(t==="linear")return kt(1*1e9);if(t==="exponential")return Et();if(t==="fibonacci")return St();if(t==="decorrelatedJitter")return Ot();throw new Error(`Unknown backoff preset: "${String(t)}". Use one of: constant, linear, exponential, fibonacci, decorrelatedJitter`)}var A,F,me=k(()=>{"use strict";A=1e6,F=1e9});function Fe(){return H>0||Z}function Ie(){return H>0}function Le(t){H>0?Q.push(t):t()}function be(t){H+=1;let e=!1;try{t()}catch(n){throw e=!0,n}finally{if(H-=1,H===0)if(e){if(!Z){let n=Q.splice(0);for(let r of n)try{r()}catch{}I.length=0,L.length=0,U.length=0}}else Rt()}}function Rt(){let t=!Z;t&&(Z=!0);let e=[],n=0;try{for(;I.length>0||L.length>0||U.length>0||t&&Q.length>0;){if(t&&Q.length>0){let a=Q.splice(0);for(let s of a)try{s()}catch(i){e.push(i)}continue}if(n+=1,n>1e3)throw I.length=0,L.length=0,U.length=0,new Error("batch drain exceeded 1000 iterations \u2014 likely a reactive cycle");let o=(I.length>0?I:L.length>0?L:U).splice(0);for(let a of o)try{a()}catch(s){e.push(s)}}}finally{t&&(Z=!1)}if(e.length===1)throw e[0];if(e.length>1)throw new AggregateError(e,"batch drain: multiple callbacks threw")}function re(t,e,n){if(e.length===0)return;if(e.length===1){let d=n(e[0][0]);if(d<3||!Fe()){t(e);return}(d>=5?U:d===4?L:I).push(()=>t(e));return}let r=e.length,o=r,a=r,s=r,i=0;for(;i<r&&n(e[i][0])<3;)i++;for(o=i;i<r&&n(e[i][0])===3;)i++;for(a=i;i<r&&n(e[i][0])===4;)i++;s=i;let u=Fe();if(o>0){let d=e.slice(0,o);t(d)}if(a>o){let d=e.slice(o,a);u?I.push(()=>t(d)):t(d)}if(s>a){let d=e.slice(a,s);u?L.push(()=>t(d)):t(d)}if(r>s){let d=e.slice(s,r);u?U.push(()=>t(d)):t(d)}}var H,Z,I,L,U,Q,ge=k(()=>{"use strict";H=0,Z=!1,I=[],L=[],U=[],Q=[]});function W(){return Math.trunc(performance.now()*1e6)}function Pe(){return Date.now()*1e6}var ye=k(()=>{"use strict"});var $,y,v,T,P,O,C,S,w,b,j,_e,At,we,Mt,Ct,Te,Be,Ge,Ve,ve,z=k(()=>{"use strict";$=Symbol.for("graphrefly/START"),y=Symbol.for("graphrefly/DATA"),v=Symbol.for("graphrefly/DIRTY"),T=Symbol.for("graphrefly/RESOLVED"),P=Symbol.for("graphrefly/INVALIDATE"),O=Symbol.for("graphrefly/PAUSE"),C=Symbol.for("graphrefly/RESUME"),S=Symbol.for("graphrefly/TEARDOWN"),w=Symbol.for("graphrefly/COMPLETE"),b=Symbol.for("graphrefly/ERROR"),j=Object.freeze([v]),_e=Object.freeze([T]),At=Object.freeze([P]),we=Object.freeze([$]),Mt=Object.freeze([w]),Ct=Object.freeze([S]),Te=Object.freeze([j]),Be=Object.freeze([_e]),Ge=Object.freeze([At]),Ve=Object.freeze([Mt]),ve=Object.freeze([Ct])});function He(t){t.registerCodec(Dt)}var Dt,Ue=k(()=>{"use strict";Dt={name:"json",version:1,contentType:"application/json",encode(t){let e=JSON.stringify(t);return new TextEncoder().encode(e)},decode(t,e){let n=new TextDecoder().decode(t);return JSON.parse(n)}}});function oe(t){if(t==null)return Ft;let{type:e,id:n,...r}=t;return{type:e??"system",id:n??"",...r}}var Ft,We=k(()=>{"use strict";Ft={type:"system",id:""}});function $e(t){t.registerMessageType($,{tier:0,wireCrossing:!1}),t.registerMessageType(v,{tier:1,wireCrossing:!1}),t.registerMessageType(P,{tier:1,wireCrossing:!1,metaPassthrough:!1}),t.registerMessageType(O,{tier:2,wireCrossing:!1}),t.registerMessageType(C,{tier:2,wireCrossing:!1}),t.registerMessageType(y,{tier:3,wireCrossing:!0}),t.registerMessageType(T,{tier:3,wireCrossing:!0}),t.registerMessageType(w,{tier:4,wireCrossing:!0,metaPassthrough:!1}),t.registerMessageType(b,{tier:4,wireCrossing:!0,metaPassthrough:!1}),t.registerMessageType(S,{tier:5,wireCrossing:!0,metaPassthrough:!1})}var se,je=k(()=>{"use strict";z();se=class{_messageTypes=new Map;_codecs=new Map;_onMessage;_onSubscribe;_defaultVersioning;_defaultHashFn;_inspectorEnabled=!(typeof process<"u"&&process.env?.NODE_ENV==="production");_globalInspector;_rigorRecorder;_frozen=!1;tierOf;constructor(e){this._onMessage=e.onMessage,this._onSubscribe=e.onSubscribe,this._defaultVersioning=e.defaultVersioning,this._defaultHashFn=e.defaultHashFn,this.tierOf=n=>{let r=this._messageTypes.get(n);return r!=null?r.tier:1}}get onMessage(){return this._frozen=!0,this._onMessage}get onSubscribe(){return this._frozen=!0,this._onSubscribe}set onMessage(e){this._assertUnfrozen(),this._onMessage=e}set onSubscribe(e){this._assertUnfrozen(),this._onSubscribe=e}get defaultVersioning(){return this._defaultVersioning}set defaultVersioning(e){this._assertUnfrozen(),this._defaultVersioning=e}get defaultHashFn(){return this._defaultHashFn}set defaultHashFn(e){this._assertUnfrozen(),this._defaultHashFn=e}get inspectorEnabled(){return this._inspectorEnabled}set inspectorEnabled(e){this._inspectorEnabled=e}get globalInspector(){return this._globalInspector}set globalInspector(e){this._globalInspector=e}get rigorRecorder(){return this._rigorRecorder}set rigorRecorder(e){this._rigorRecorder=e}registerMessageType(e,n){return this._assertUnfrozen(),this._messageTypes.set(e,{tier:n.tier,wireCrossing:n.wireCrossing??n.tier>=3,metaPassthrough:n.metaPassthrough??!0}),this}messageTier(e){let n=this._messageTypes.get(e);return n!=null?n.tier:1}isWireCrossing(e){let n=this._messageTypes.get(e);return n!=null?n.wireCrossing:!0}isLocalOnly(e){return!this.isWireCrossing(e)}isMetaPassthrough(e){let n=this._messageTypes.get(e);return n!=null?n.metaPassthrough:!0}isKnownMessageType(e){return this._messageTypes.has(e)}registerCodec(e){return this._assertUnfrozen(),this._codecs.set(e.name,e),this}lookupCodec(e){return this._codecs.get(e)}_isFrozen(){return this._frozen}_assertUnfrozen(){if(this._frozen)throw new Error("GraphReFlyConfig is frozen: a node has already captured this config. Register custom types and set hooks before creating any node.")}}});var q,ze=k(()=>{"use strict";q=class extends Error{actor;action;nodeName;constructor(e,n){super(n??`GuardDenied: action "${String(e.action)}" denied for actor type "${String(e.actor.type)}"`),this.name="GuardDenied",this.actor=e.actor,this.action=e.action,this.nodeName=e.nodeName}get node(){return this.nodeName}}});function xe(t){if(t===void 0)return null;if(typeof t=="number"){if(!Number.isFinite(t))throw new TypeError(`Cannot hash non-finite number: ${t}`);if(Number.isInteger(t)&&!Number.isSafeInteger(t))throw new TypeError(`Cannot hash integer outside safe range (|n| > 2^53-1): ${t}. Cross-language cid parity is not guaranteed for unsafe integers.`);return t}if(typeof t=="string"||typeof t=="boolean"||t===null)return t;if(Array.isArray(t))return t.map(xe);if(typeof t=="object"&&t!==null){let e={};for(let n of Object.keys(t).sort())e[n]=xe(t[n]);return e}return null}function Pt(t){let e=Lt.encode(t),n=e.length,r=n*8,o=n+9+63&-64,a=new Uint8Array(o);a.set(e),a[n]=128;let s=new DataView(a.buffer);s.setUint32(o-4,r>>>0,!1),s.setUint32(o-8,Math.floor(r/4294967296)>>>0,!1);let i=1779033703,u=3144134277,d=1013904242,c=2773480762,f=1359893119,g=2600822924,p=528734635,_=1541459225,h=new Uint32Array(64),l=(x,E)=>x>>>E|x<<32-E;for(let x=0;x<o;x+=64){for(let N=0;N<16;N++)h[N]=s.getUint32(x+N*4,!1);for(let N=16;N<64;N++){let J=h[N-15],X=h[N-2],ne=l(J,7)^l(J,18)^J>>>3,fe=l(X,17)^l(X,19)^X>>>10;h[N]=h[N-16]+ne+h[N-7]+fe>>>0}let E=i,K=u,Y=d,ce=c,M=f,ee=g,te=p,le=_;for(let N=0;N<64;N++){let J=l(M,6)^l(M,11)^l(M,25),X=M&ee^~M&te,ne=le+J+X+It[N]+h[N]>>>0,fe=l(E,2)^l(E,13)^l(E,22),ht=E&K^E&Y^K&Y,mt=fe+ht>>>0;le=te,te=ee,ee=M,M=ce+ne>>>0,ce=Y,Y=K,K=E,E=ne+mt>>>0}i=i+E>>>0,u=u+K>>>0,d=d+Y>>>0,c=c+ce>>>0,f=f+M>>>0,g=g+ee>>>0,p=p+te>>>0,_=_+le>>>0}let m=x=>x.toString(16).padStart(8,"0");return m(i)+m(u)+m(d)+m(c)+m(f)+m(g)+m(p)+m(_)}function Ne(t){let e=xe(t??null),n=JSON.stringify(e);return Pt(n).slice(0,16)}function Bt(){let t=globalThis.crypto;if(t?.randomUUID)return t.randomUUID();let e=()=>Math.floor(Math.random()*4294967296).toString(16).padStart(8,"0"),n=e()+e()+e()+e();return`${n.slice(0,8)}-${n.slice(8,12)}-4${n.slice(13,16)}-${(parseInt(n.slice(16,17),16)&3|8).toString(16)}${n.slice(17,20)}-${n.slice(20,32)}`}function ke(t,e,n){let r=n?.id??Bt();if(t===0)return{id:r,version:0};let a=(n?.hash??Ne)(e);return{id:r,version:0,cid:a,prev:null}}function qe(t,e,n){t.version+=1,"cid"in t&&(t.prev=t.cid,t.cid=n(e))}var It,Lt,Ke=k(()=>{"use strict";It=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),Lt=new TextEncoder});function Xe(t){return{node:t,unsub:null,prevData:void 0,dirty:!1,involvedThisWave:!1,dataBatch:[],terminal:void 0}}function Ee(t){t.prevData=void 0,t.dirty=!1,t.involvedThisWave=!1,t.dataBatch.length=0,t.terminal=void 0}function ie(t){return t.length===0?t:typeof t[0]=="symbol"?[t]:t}function B(t,e,n){let r=Ze(t)?t:[],o=typeof t=="function"?t:typeof e=="function"?e:void 0,a={};return Ze(t)?a=(Se(e)?e:n)??{}:Se(t)?a=t:a=(Se(e)?e:n)??{},new ae(r,o,a)}var Ye,Je,Gt,Vt,Oe,ae,Ze,Se,ue=k(()=>{"use strict";Ue();We();ge();ye();je();ze();z();Ke();Ye=()=>{},Je=100;Gt=(t,e,n,r)=>{n.direction==="down-in"&&t._onDepMessage(n.depIndex,e)},Vt=(t,e,n,r)=>{let o=t;if(o._status==="completed"||o._status==="errored")return;let a=o._cached,s=a===void 0?[we]:[we,[y,a]];o._status==="dirty"&&s.push(j),re(e,s,o._config.tierOf)},Oe=new se({onMessage:Gt,onSubscribe:Vt});$e(Oe);He(Oe);ae=class t{_optsName;_describeKind;meta;_hasMeta;_config;_deps;_sinks=null;_sinkCount=0;_cached;_status;_cleanup;_store={};_waveHasNewData=!1;_hasNewTerminal=!1;_hasCalledFnOnce=!1;_paused=!1;_pendingWave=!1;_isExecutingFn=!1;_pendingRerun=!1;_rerunDepth=0;_dirtyDepCount=0;_batchPendingMessages=null;_pauseLocks=null;_pauseBuffer=null;_fn;_equals;_resubscribable;_resetOnTeardown;_autoComplete;_autoError;_pausable;_partial;_guard;_extraGuards;_hashFn;_versioning;_versioningLevel;_lastMutation;_inspectorHooks;_actions;constructor(e,n,r){this._config=r.config??Oe,this._config.onMessage,this._optsName=r.name,this._describeKind=r.describeKind,this._equals=r.equals??Object.is,this._resubscribable=r.resubscribable??!1,this._resetOnTeardown=r.resetOnTeardown??!1,this._autoComplete=r.completeWhenDepsComplete??!0,this._autoError=r.errorWhenDepsError??!0,this._pausable=r.pausable??!0,this._guard=r.guard,this._fn=n,this._partial=r.partial??!1,this._cached=r.initial!==void 0?r.initial:void 0,this._status=e.length===0&&n==null&&this._cached!==void 0?"settled":"sentinel",this._hashFn=r.versioningHash??this._config.defaultHashFn??Ne;let o=r.versioning??this._config.defaultVersioning;this._versioningLevel=o,this._versioning=o!=null?ke(o,this._cached===void 0?void 0:this._cached,{id:r.versioningId,hash:this._hashFn}):void 0,this._deps=e.map(Xe);let a={};for(let[i,u]of Object.entries(r.meta??{})){let d={initial:u,name:`${r.name??"node"}:meta:${i}`,describeKind:"state",config:this._config};r.guard!=null&&(d.guard=r.guard),a[i]=new t([],void 0,d)}Object.freeze(a),this.meta=a,this._hasMeta=Object.keys(a).length>0;let s=this;this._actions={emit(i){s._emit([[y,i]])},down(i){s._emit(ie(i))},up(i){s._emitUp(ie(i))}},this.down=this.down.bind(this),this.up=this.up.bind(this)}get _isTerminal(){return this._status==="completed"||this._status==="errored"}get name(){return this._optsName}get status(){return this._status}get cache(){return this._cached===void 0?void 0:this._cached}get lastMutation(){return this._lastMutation}get v(){return this._versioning}hasGuard(){return this._guard!=null}_applyVersioning(e,n){if(this._isExecutingFn)throw new Error(`Node "${this.name}": _applyVersioning cannot run mid-fn \u2014 call it outside of \`_execFn\` (typically at graph setup time before the first subscribe).`);let r=this._versioningLevel;if(r!=null&&e<=r)return;let o=n?.hash??this._hashFn;o!==this._hashFn&&(this._hashFn=o);let a=this._cached===void 0?void 0:this._cached,s=this._versioning,i=s?.id??n?.id,u=s?.version??0,d=ke(e,a,{id:i,hash:o});d.version=u,this._versioning=d,this._versioningLevel=e}_setInspectorHook(e){return e==null?()=>{}:(this._inspectorHooks==null&&(this._inspectorHooks=new Set),this._inspectorHooks.add(e),()=>{this._inspectorHooks?.delete(e),this._inspectorHooks?.size===0&&(this._inspectorHooks=void 0)})}_pushGuard(e){return this._extraGuards==null&&(this._extraGuards=new Set),this._extraGuards.add(e),()=>{this._extraGuards?.delete(e),this._extraGuards?.size===0&&(this._extraGuards=void 0)}}allowsObserve(e){if(this._guard==null&&this._extraGuards==null)return!0;let n=oe(e);if(this._guard!=null&&!this._guard(n,"observe"))return!1;if(this._extraGuards!=null){for(let r of this._extraGuards)if(!r(n,"observe"))return!1}return!0}_checkGuard(e){if(e?.internal)return;let n=this._guard!=null||this._extraGuards!=null,r=e?.actor!=null;if(!n&&!r)return;let o=oe(e?.actor),a=e?.delivery==="signal"?"signal":"write";if(this._guard!=null&&!this._guard(o,a))throw new q({actor:o,action:a,nodeName:this.name});if(this._extraGuards!=null){for(let s of this._extraGuards)if(!s(o,a))throw new q({actor:o,action:a,nodeName:this.name})}this._lastMutation={actor:o,timestamp_ns:Pe()}}down(e,n){let r=ie(e);r.length!==0&&(this._checkGuard(n),this._emit(r))}emit(e,n){this._checkGuard(n),this._emit([[y,e]])}up(e,n){if(this._deps.length===0)return;let r=ie(e);if(r.length===0)return;this._checkGuard(n);let o=n??{internal:!0};this._validateUpTiers(r);for(let a of this._deps)a.node.up?.(r,o)}_emitUp(e){if(this._deps.length!==0&&e.length!==0){this._validateUpTiers(e);for(let n of this._deps)n.node.up?.(e,{internal:!0})}}_validateUpTiers(e){let n=this._config.tierOf;for(let r of e){let o=n(r[0]);if(o===3||o===4)throw new Error(`Node "${this.name}": tier-${o} messages cannot flow up \u2014 DATA/RESOLVED/COMPLETE/ERROR are downstream-only. Use \`down(...)\` for value delivery; \`up(...)\` is for control signals (DIRTY, INVALIDATE, PAUSE, RESUME, TEARDOWN).`)}}subscribe(e,n){if(n!=null&&this._guard!=null){let u=oe(n);if(!this._guard(u,"observe"))throw new q({actor:u,action:"observe",nodeName:this.name})}let o=this._isTerminal&&this._resubscribable;if(o){this._cached=void 0,this._status="sentinel",this._store={},this._hasCalledFnOnce=!1,this._waveHasNewData=!1,this._hasNewTerminal=!1,this._paused=!1,this._pendingWave=!1,this._pendingRerun=!1,this._isExecutingFn=!1,this._rerunDepth=0,this._dirtyDepCount=0,this._pauseLocks=null,this._pauseBuffer=null;for(let u of this._deps)Ee(u);if(this._partial===!1){for(let u of this._deps)if(u.prevData!==void 0||u.dataBatch.length!==0||u.terminal!==void 0||u.dirty)throw new Error(`resubscribable-reset invariant: DepRecord not fully reset for node ${this._optsName??"(anonymous)"}`)}}this._sinkCount+=1;let a;try{a=this._config.onSubscribe(this,e,{sinkCount:this._sinkCount,afterTerminalReset:o},this._actions)}catch(u){throw this._sinkCount-=1,u}this._sinks==null?this._sinks=e:typeof this._sinks=="function"?this._sinks=new Set([this._sinks,e]):this._sinks.add(e);let s=this._isTerminal;if(this._sinkCount===1&&!s)try{this._activate()}catch(u){if(this._sinkCount-=1,this._removeSink(e),this._sinkCount===0&&(this._status="sentinel"),typeof a=="function")try{a()}catch{}throw u}this._status==="sentinel"&&this._cached===void 0&&(this._status="pending");let i=!1;return()=>{i||(i=!0,this._sinkCount-=1,this._removeSink(e),typeof a=="function"&&a(),this._sinks==null&&this._deactivate())}}_removeSink(e){if(this._sinks===e)this._sinks=null;else if(this._sinks!=null&&typeof this._sinks!="function")if(this._sinks.delete(e),this._sinks.size===1){let[n]=this._sinks;this._sinks=n}else this._sinks.size===0&&(this._sinks=null)}_activate(){if(this._deps.length===0){this._fn&&this._execFn();return}this._dirtyDepCount=0;let e=this._deps.length,n=0;try{for(let r=0;r<e;r++){let o=r,a=this._deps[r];a.unsub=Ye,a.unsub=a.node.subscribe(s=>{if(a.unsub===null)return;let i=this._config.tierOf,u=!1;for(let d of s)i(d[0])>=3&&(u=!0),this._config.onMessage(this,d,{direction:"down-in",depIndex:o},this._actions);u&&this._maybeRunFnOnSettlement()}),n++}}catch(r){this._deps[n].unsub=null;for(let o=0;o<n;o++){let a=this._deps[o];if(a.unsub!=null){let s=a.unsub;a.unsub=null;try{s()}catch{}Ee(a)}}throw this._dirtyDepCount=0,r}}_addDep(e){for(let o=0;o<this._deps.length;o++)if(this._deps[o].node===e)return o;let n=this._deps.length,r=Xe(e);if(this._deps.push(r),this._sinks==null)return n;r.dirty=!0,this._dirtyDepCount++,this._status!=="dirty"&&this._emit(Te),r.unsub=Ye;try{r.unsub=e.subscribe(o=>{if(r.unsub===null)return;let a=this._config.tierOf,s=!1;for(let i of o)a(i[0])>=3&&(s=!0),this._config.onMessage(this,i,{direction:"down-in",depIndex:n},this._actions);s&&this._maybeRunFnOnSettlement()})}catch(o){throw r.unsub=null,this._deps.pop(),this._dirtyDepCount--,o}return n}_deactivate(e=!1){let n=this._cleanup;if(this._cleanup=void 0,typeof n=="function")try{n()}catch(r){this._emit([[b,this._wrapFnError("cleanup threw",r)]])}else if(n!=null&&typeof n=="object"){let r=n.deactivate;if(typeof r=="function")try{r()}catch(o){this._emit([[b,this._wrapFnError("cleanup.deactivate threw",o)]])}}for(let r of this._deps){if(r.unsub!=null){let o=r.unsub;r.unsub=null;try{o()}catch{}}Ee(r)}this._waveHasNewData=!1,this._hasNewTerminal=!1,this._hasCalledFnOnce=!1,this._paused=!1,this._pendingWave=!1,this._pendingRerun=!1,this._rerunDepth=0,this._store={},this._dirtyDepCount=0,this._pauseLocks=null,this._pauseBuffer=null,this._fn!=null&&(this._cached=void 0),e||(this._fn!=null||this._deps.length>0)&&(!this._isTerminal||this._resubscribable)&&(this._status="sentinel")}_onDepMessage(e,n){let r=this._deps[e],o=n[0];if(this._inspectorHooks!=null){let a={kind:"dep_message",depIndex:e,message:n};for(let s of this._inspectorHooks)s(a)}if(o!==$){if(o===v){this._depDirtied(r);return}if(o===P){if(this._depInvalidated(r),this._cached===void 0)return;this._emit(Ge);return}if(o===O||o===C){this._emit([n]);return}if(o===S){this._emit(ve);return}if(o===y)this._depSettledAsData(r,n[1]);else if(o===T)this._depSettledAsResolved(r);else if(o===w)this._depSettledAsTerminal(r,!0);else if(o===b)this._depSettledAsTerminal(r,n[1]);else{this._emit([n]);return}if(!this._fn){(o===y||o===T)&&this._emit([n]),(o===w||o===b)&&this._maybeAutoTerminalAfterWave();return}}}_depDirtied(e){e.dirty||(e.dirty=!0,e.involvedThisWave=!0,this._dirtyDepCount++,this._status!=="dirty"&&this._emit(Te))}_depSettledAsData(e,n){e.dirty&&(e.dirty=!1,this._dirtyDepCount--),e.involvedThisWave=!0,e.dataBatch.push(n),this._waveHasNewData=!0}_depSettledAsResolved(e){e.dirty&&(e.dirty=!1,this._dirtyDepCount--)}_depSettledAsTerminal(e,n){e.dirty&&(e.dirty=!1,this._dirtyDepCount--),e.terminal=n,e.involvedThisWave=!0,this._hasNewTerminal=!0}_depInvalidated(e){e.prevData=void 0,e.terminal=void 0,e.dataBatch.length=0,e.dirty?e.involvedThisWave=!1:(e.dirty=!0,e.involvedThisWave=!0,this._dirtyDepCount++)}_maybeRunFnOnSettlement(){if(!(this._isTerminal&&!this._resubscribable)&&!(this._dirtyDepCount>0)){if(!this._partial&&!this._hasCalledFnOnce)for(let e=0;e<this._deps.length;e++){let n=this._deps[e];if(n.dataBatch.length===0&&n.prevData===void 0&&n.terminal===void 0){this._maybeAutoTerminalAfterWave();return}}if(this._paused){this._pendingWave=!0;return}if(!this._waveHasNewData&&!this._hasNewTerminal&&this._hasCalledFnOnce){this._clearWaveFlags(),this._emit(Be),this._maybeAutoTerminalAfterWave();return}this._fn&&this._execFn(),this._maybeAutoTerminalAfterWave()}}_maybeAutoTerminalAfterWave(){if(this._deps.length===0||this._isTerminal)return;let e=this._deps.find(n=>n.terminal!==void 0&&n.terminal!==!0);if(e!=null){this._autoError&&this._emit([[b,e.terminal]]);return}this._autoComplete&&this._deps.every(n=>n.terminal!==void 0)&&this._emit(Ve)}_execFn(){if(!this._fn||this._isTerminal&&!this._resubscribable)return;if(this._isExecutingFn){this._pendingRerun=!0;return}let e=this._cleanup;if(typeof e=="function"){this._cleanup=void 0;try{e()}catch(s){this._emit([[b,this._wrapFnError("cleanup threw",s)]]);return}}else if(e!=null&&typeof e=="object"){let s=e.beforeRun;if(typeof s=="function"){e.beforeRun=void 0;try{s()}catch(i){this._emit([[b,this._wrapFnError("cleanup.beforeRun threw",i)]]);return}}}let n=this._deps.map(s=>s.involvedThisWave?s.dataBatch.length>0?[...s.dataBatch]:[]:void 0),r=this._deps.map(s=>s.prevData);for(let s=0;s<this._deps.length;s++){let i=n[s];i!=null&&i.length>0&&(this._deps[s].prevData=i[i.length-1])}let o=this._deps.map(s=>s.terminal),a={prevData:r,terminalDeps:o,store:this._store};if(this._hasCalledFnOnce=!0,this._clearWaveFlags(),this._inspectorHooks!=null){let s={kind:"run",batchData:n,prevData:r};for(let i of this._inspectorHooks)i(s)}this._isExecutingFn=!0;try{let s=this._fn(n,this._actions,a);if(typeof s=="function")this._cleanup=s;else if(s!=null&&typeof s=="object"){let i=s;(typeof i.beforeRun=="function"||typeof i.deactivate=="function"||typeof i.invalidate=="function")&&(this._cleanup=s)}}catch(s){this._emit([[b,this._wrapFnError("fn threw",s)]])}finally{this._isExecutingFn=!1,this._pendingRerun?(this._pendingRerun=!1,this._rerunDepth+=1,this._rerunDepth>Je?(this._rerunDepth=0,this._emit([[b,new Error(`Node "${this.name}": _pendingRerun depth exceeded ${Je} \u2014 likely a reactive cycle`)]])):this._maybeRunFnOnSettlement()):this._rerunDepth=0,this._clearWaveFlags()}}_clearWaveFlags(){this._waveHasNewData=!1,this._hasNewTerminal=!1;for(let e of this._deps)e.involvedThisWave=!1,e.dataBatch.length=0}_wrapFnError(e,n){let r=n instanceof Error?n.message:String(n);return new Error(`Node "${this.name}": ${e}: ${r}`,{cause:n})}_frameBatch(e){let n=this._config.tierOf;if(e.length===1)return n(e[0][0])===3&&this._status!=="dirty"?[j,e[0]]:e;let r=!0,o=!1,a=!1,s=-1;for(let u of e){let d=n(u[0]);d<s&&(r=!1),d===3&&(o=!0),u[0]===v&&(a=!0),s=d}let i=e;if(!r){let u=e.map((d,c)=>({m:d,i:c,tier:n(d[0])}));u.sort((d,c)=>d.tier-c.tier||d.i-c.i),i=u.map(d=>d.m)}if(o&&!a&&this._status!=="dirty"){let u=0;for(;u<i.length&&n(i[u][0])===0;)u++;return u===0?[j,...i]:[...i.slice(0,u),j,...i.slice(u)]}return i}_emit(e){if(e.length===0)return;for(let i=0;i<e.length;i++){let u=e[i];if(u[0]===b&&u[1]===void 0)throw new TypeError('[ERROR, payload] requires a non-undefined payload (spec \xA71.2). Pass an Error object or domain tag instead \u2014 e.g. node.down([[ERROR, new Error("reason")]])')}let n=e;if(this._isTerminal&&!this._resubscribable){let i=e.filter(u=>u[0]===S||u[0]===P);if(i.length===0)return;n=i}n=this._frameBatch(n);let o=null;for(let i=0;i<n.length;i++){let u=n[i],d=u[0];if(d!==O&&d!==C){o?.push(u);continue}if(u.length<2)throw new Error(`Node "${this.name}": [[${d===O?"PAUSE":"RESUME"}]] must carry a lockId payload \u2014 bare PAUSE/RESUME is a protocol violation (C0 rule). Use \`[[PAUSE, lockId]]\` / \`[[RESUME, lockId]]\`.`);let c=!0;if(this._pausable!==!1){let f=u[1];if(d===O)this._pauseLocks==null&&(this._pauseLocks=new Set),this._pauseLocks.add(f),this._paused=!0,this._pausable==="resumeAll"&&this._pauseBuffer==null&&(this._pauseBuffer=[]);else if(this._pauseLocks==null||!this._pauseLocks.has(f))c=!1;else if(this._pauseLocks.delete(f),this._pauseLocks.size===0){if(this._paused=!1,this._pauseBuffer!=null&&this._pauseBuffer.length>0){let g=this._pauseBuffer;this._pauseBuffer=[],this._emit(g)}this._pendingWave&&(this._pendingWave=!1,this._maybeRunFnOnSettlement())}}c?o?.push(u):o==null&&(o=n.slice(0,i))}if(o!=null){if(o.length===0)return;n=o}if(this._hasMeta&&n.some(i=>i[0]===S))for(let i of Object.keys(this.meta))try{this.meta[i]._emit(ve)}catch{}let{finalMessages:a,equalsError:s}=this._updateState(n);if(a.length>0&&this._config.inspectorEnabled){let i=this._config.globalInspector;if(i!=null)try{i({kind:"emit",node:this,messages:a})}catch{}}if(a.length>0)if(this._paused&&this._pausable==="resumeAll"&&this._pauseBuffer!=null){let i=this._config.tierOf,u=[];for(let d of a)i(d[0])===3?this._pauseBuffer.push(d):u.push(d);u.length>0&&this._dispatchOrAccumulate(u)}else this._dispatchOrAccumulate(a);s!=null&&this._emit([[b,s]])}_updateState(e){let n=this._config.tierOf,r,o,a=-1,s=0;for(let c of e)n(c[0])===3&&s++;let i=s<=1,u=-1;if(this._versioning!=null&&s>1){for(let c=e.length-1;c>=0;c--)if(e[c][0]===y){u=c;break}}for(let c=0;c<e.length;c++){let f=e[c],g=f[0];if(g===y){if(f.length>=2){let p=!1;if(i&&this._cached!==void 0)try{p=this._equals(this._cached,f[1])}catch(_){o=this._wrapFnError("equals threw",_),a=c;break}if(p){r==null&&(r=e.slice(0,c)),r.push(_e),this._status="resolved";continue}this._cached=f[1],this._versioning!=null&&(u<0||c===u)&&qe(this._versioning,f[1],this._hashFn)}this._status="settled",r?.push(f)}else if(r?.push(f),g===v)this._status="dirty";else if(g===T)this._status="resolved";else if(g===w){this._status="completed";{let p=this._config.rigorRecorder;if(p!=null)try{p.onTerminalTransition(this,"completed",this._autoComplete,this._autoError,this._deps.length>0)}catch{}}}else if(g===b){this._status="errored";{let p=this._config.rigorRecorder;if(p!=null)try{p.onTerminalTransition(this,"errored",this._autoComplete,this._autoError,this._deps.length>0)}catch{}}}else if(g===P){if(this._cached!==void 0){let _=this._config.rigorRecorder;if(_!=null)try{_.onNonVacuousInvalidate(this,this._cached)}catch{}}this._cached=void 0,this._status="dirty";let p=this._cleanup;if(typeof p=="function"){this._cleanup=void 0;try{p()}catch{}}else if(p!=null&&typeof p=="object"){let _=p.invalidate;if(typeof _=="function")try{_()}catch{}}}else g===S&&(this._resetOnTeardown&&(this._cached=void 0),this._deactivate(!0),this._status="sentinel")}let d=a>=0?r??e.slice(0,a):r??e;return o!=null?{finalMessages:d,equalsError:o}:{finalMessages:d}}_deliverToSinks=e=>{if(this._sinks==null)return;if(typeof this._sinks=="function"){this._sinks(e);return}let n=[...this._sinks];for(let r of n)r(e)};_dispatchOrAccumulate(e){if(Ie()){this._batchPendingMessages===null&&(this._batchPendingMessages=[],Le(()=>this._flushBatchPending()));for(let n of e)this._batchPendingMessages.push(n);return}re(this._deliverToSinks,e,this._config.tierOf)}_flushBatchPending(){let e=this._batchPendingMessages;if(e===null||(this._batchPendingMessages=null,e.length===0))return;let n=this._frameBatch(e);re(this._deliverToSinks,n,this._config.tierOf)}},Ze=t=>Array.isArray(t),Se=t=>typeof t=="object"&&t!=null&&!Array.isArray(t)});function R(t,e){return B((r,o,a)=>t(o,a)??void 0,{describeKind:"producer",...e})}var Re=k(()=>{"use strict";ue()});function Ae(t){return{describeKind:"producer",...t}}function Qe(t,e){return R(n=>{let r=!1;try{for(let o of t){if(r)return;n.emit(o)}r||n.down([[w]])}catch(o){r||n.down([[b,o]])}return()=>{r=!0}},Ae(e))}function Ht(t){return t!=null&&typeof t.then=="function"}function Ut(t,e){let{signal:n,...r}=e??{};return R(o=>{let a=!1,s=()=>{a||(a=!0,o.down([[b,n.reason]]))};if(n?.aborted){s();return}return n?.addEventListener("abort",s,{once:!0}),Promise.resolve(t).then(i=>{a||(a=!0,n?.removeEventListener("abort",s),o.emit(i),o.down([[w]]))},i=>{a||(a=!0,n?.removeEventListener("abort",s),o.down([[b,i]]))}),()=>{a=!0,n?.removeEventListener("abort",s)}},Ae(r))}function Wt(t,e){let{signal:n,...r}=e??{};return R(o=>{let a=new AbortController,s=()=>a.abort(n?.reason);n?.aborted?a.abort(n.reason):n?.addEventListener("abort",s,{once:!0});let i=n??a.signal,u=!1,d=t[Symbol.asyncIterator](),c=()=>{u||i.aborted||Promise.resolve(d.next()).then(f=>{if(!(u||i.aborted)){if(f.done){o.down([[w]]);return}o.emit(f.value),c()}},f=>{!u&&!i.aborted&&o.down([[b,f]])})};return c(),()=>{u=!0,n?.removeEventListener("abort",s),a.abort(),Promise.resolve(d.return?.()).catch(()=>{})}},Ae(r))}function $t(t){return t!=null&&typeof t=="object"&&"cache"in t&&typeof t.subscribe=="function"}function et(t,e){if($t(t))return t;if(Ht(t))return Ut(t,e);if(t!=null){let n=t;if(typeof n[Symbol.asyncIterator]=="function")return Wt(t,e);if(typeof n[Symbol.iterator]=="function")return Qe(t,e)}return jt(t)}function jt(...t){return Qe(t,void 0)}var tt=k(()=>{"use strict";z();Re()});var G,nt=k(()=>{"use strict";G=class{_timer;_gen=0;start(e,n){this.cancel(),this._gen+=1;let r=this._gen;this._timer=setTimeout(()=>{this._timer=void 0,r===this._gen&&n()},e)}cancel(){this._timer!==void 0&&(clearTimeout(this._timer),this._timer=void 0)}get pending(){return this._timer!==void 0}}});function V(t){return{describeKind:"derived",...t}}function zt(t){return t<0?0:t}function de(t){return t[1]}function rt(t){if(typeof t!="number"||!Number.isFinite(t))throw new TypeError("backoff strategy must return a finite number");return t<0?0:t}function ot(t,e){return typeof t=="function"?Kt(t,e):qt(t,e)}function qt(t,e){let n=e?.count,r=e?.backoff,o=n!==void 0?n:r===void 0?0:2147483647;if(o<0)throw new RangeError("retry count must be >= 0");let a=r===void 0?null:typeof r=="string"?he(r):r;return R(s=>{let i=0,u=!1,d=null,c,f=new G;function g(){c?.(),c=void 0}function p(h){if(u)return;if(i>=o){g(),s.down([[b,h]]);return}let l=a===null?0:a(i,h,d);if(l==null){g(),s.down([[b,h]]);return}let m;try{m=rt(l)}catch{g(),s.down([[b,h]]);return}d=m,i+=1,g();let x=m>0?m/1e6:1;f.start(x,()=>{u||_()})}function _(){f.cancel(),g(),c=t.subscribe(h=>{if(!u)for(let l of h){let m=l[0];if(m===v)s.down([[v]]);else if(m===y)i=0,d=null,s.emit(l[1]);else if(m===T)s.down([[T]]);else if(m===w)g(),s.down([[w]]);else if(m===b){p(de(l));return}else s.down([l])}})}return _(),()=>{u=!0,f.cancel(),g()}},{...V(),initial:t.cache})}function Kt(t,e){let n=e?.count,r=e?.backoff,o=n!==void 0?n:r===void 0?0:2147483647;if(o<0)throw new RangeError("retry count must be >= 0");let a=r===void 0?null:typeof r=="string"?he(r):r;return R(s=>{let i=0,u=!1,d=null,c,f=new G;function g(){c?.(),c=void 0}function p(h){if(u)return;if(i>=o){g(),s.down([[b,h]]);return}let l=a===null?0:a(i,h,d);if(l==null){g(),s.down([[b,h]]);return}let m;try{m=rt(l)}catch{g(),s.down([[b,h]]);return}d=m,i+=1,g();let x=m>0?m/1e6:1;f.start(x,()=>{u||_()})}function _(){f.cancel(),g();let h;try{h=t()}catch(l){p(l);return}c=h.subscribe(l=>{if(!u)for(let m of l){let x=m[0];if(x===v)s.down([[v]]);else if(x===y)i=0,d=null,s.emit(m[1]);else if(x===T)s.down([[T]]);else if(x===w)g(),s.down([[w]]);else if(x===b){p(de(m));return}else s.down([m])}})}return _(),()=>{u=!0,f.cancel(),g()}},{...V(),initial:e?.initial})}function st(t){let e=Math.max(1,t?.failureThreshold??5),n=zt(t?.cooldownNs??30*1e9),r=t?.cooldown??null,o=Math.max(1,t?.halfOpenMax??1),a=t?.now??W,s="closed",i=0,u=0,d=0,c=n,f=0;function g(){if(!r)return n;let h=r(u);return h!==null?h:n}function p(){s="open",c=g(),d=a(),f=0}return{canExecute(){return s==="closed"?!0:s==="open"?a()-d>=c?(s="half-open",f=1,!0):!1:f<o?(f++,!0):!1},recordSuccess(){s==="half-open"?(s="closed",i=0,u=0):s==="closed"&&(i=0)},recordFailure(h){if(s==="half-open"){u++,p();return}s==="closed"&&(i++,i>=e&&p())},get state(){return s},get failureCount(){return i},reset(){s="closed",i=0,u=0,f=0}}}function it(t,e){let n=e?.onOpen??"skip";return r=>{let o=B([],(a,s)=>{function i(){o.meta.breakerState.down([[y,t.state]])}let u=r.subscribe(d=>{for(let c of d){let f=c[0];f===v?s.down([[v]]):f===y?t.canExecute()?(i(),s.emit(c[1])):(i(),n==="error"?s.down([[b,new Me]]):s.down([[T]])):f===T?s.down([[T]]):f===w?(t.recordSuccess(),i(),s.down([[w]])):f===b?(t.recordFailure(de(c)),i(),s.down([c])):s.down([c])}});return i(),u},{...V(),meta:{breakerState:t.state},completeWhenDepsComplete:!1,initial:r.cache});return{node:o,breakerState:o.meta.breakerState}}}function Yt(t,e){if(t<=0)throw new RangeError("capacity must be > 0");if(e<0)throw new RangeError("refillPerSecond must be >= 0");let n=t,r=W();function o(a){if(e>0){let s=a-r;n=Math.min(t,n+s/1e9*e)}r=a}return{available(){return o(W()),n},tryConsume(a=1){if(a<=0)return!0;let s=W();return o(s),n>=a?(n-=a,!0):!1},putBack(a=1){a<=0||(o(W()),n=Math.min(t,n+a))}}}function at(t,e){let{maxEvents:n,windowNs:r}=e;if(n<=0)throw new RangeError("maxEvents must be > 0");if(r<=0)throw new RangeError("windowNs must be > 0");let o=e.maxBuffer;if(o!==void 0&&o<1)throw new RangeError("maxBuffer must be >= 1");let a=e.onOverflow??"drop-newest",s=n*1e9/r;return R(i=>{let u=Yt(n,s),d=[],c=new G,f=!1,g=1e9/s;function p(){for(;d.length>0;)if(u.tryConsume(1))i.emit(d.shift());else{c.start(Math.max(1,g/1e6),p);return}}let _=t.subscribe(h=>{for(let l of h){if(f)return;let m=l[0];if(m===v)i.down([[v]]);else if(m===y){if(o!==void 0&&d.length>=o){if(a!=="drop-newest")if(a==="drop-oldest")d.shift(),d.push(l[1]);else{f=!0,c.cancel(),d.length=0,i.down([[b,new Ce(o)]]);return}}else d.push(l[1]);p()}else if(m===T)i.down([[T]]);else if(m===w)f=!0,c.cancel(),d.length=0,i.down([[w]]);else if(m===b)f=!0,c.cancel(),d.length=0,i.down([l]);else if(m===S){f=!0,c.cancel(),d.length=0,i.down([l]);return}else i.down([l])}});return()=>{f=!0,c.cancel(),_()}},{...V(),initial:t.cache})}function ut(t,e){let n=e?.initialStatus??"pending",r=B([],(o,a)=>{let s=n;return r.meta.status.down([[y,n]]),r.meta.error.down([[y,null]]),t.subscribe(u=>{for(let d of u){let c=d[0];if(c===v)a.down([[v]]);else if(c===y)s==="errored"?be(()=>{r.meta.error.down([[y,null]]),r.meta.status.down([[y,"active"]])}):r.meta.status.down([[y,"active"]]),s="active",a.emit(d[1]);else if(c===T)a.down([[T]]);else if(c===w)r.meta.status.down([[y,"completed"]]),s="completed",a.down([[w]]);else if(c===b){let f=de(d);be(()=>{r.meta.error.down([[y,f]]),r.meta.status.down([[y,"errored"]])}),s="errored",a.down([d])}else a.down([d])}})},{...V(),meta:{status:n,error:null},completeWhenDepsComplete:!1,resubscribable:!0,initial:t.cache});return{node:r,status:r.meta.status,error:r.meta.error}}function Jt(t){return t!=null&&typeof t=="object"&&"cache"in t&&typeof t.subscribe=="function"}function Xt(t){return t!=null&&typeof t.then=="function"}function Zt(t){return t!=null&&typeof t=="object"&&typeof t[Symbol.asyncIterator]=="function"}function dt(t,e){return R(n=>{let r,o;function a(){o?.(),o=void 0,Jt(e)||Xt(e)||Zt(e)?r=et(e).subscribe(i=>{n.down(i)}):(n.emit(e),n.down([[w]]))}return o=t.subscribe(s=>{for(let i of s){let u=i[0];if(u===v)n.down([[v]]);else if(u===y)n.emit(i[1]);else if(u===T)n.down([[T]]);else if(u===w)n.down([[w]]);else if(u===b){a();return}else if(u===S){r?.(),n.down([i]);return}else n.down([i])}}),()=>{o?.(),r?.()}},{...V(),initial:t.cache})}function ct(t,e){if(e<=0)throw new RangeError("timeoutNs must be > 0");return R(n=>{let r=!1,o=new G;function a(){let i=e/1e6;o.start(i,()=>{r||(r=!0,s(),n.down([[b,new De(e)]]))})}let s=t.subscribe(i=>{for(let u of i){if(r)return;let d=u[0];if(d===v)n.down([[v]]);else if(d===y)a(),n.emit(u[1]);else if(d===T)n.down([[T]]);else if(d===w){o.cancel(),r=!0,n.down([[w]]);return}else if(d===b){o.cancel(),r=!0,n.down([u]);return}else if(d===S){o.cancel(),r=!0,n.down([u]);return}else n.down([u])}});return a(),()=>{r=!0,o.cancel(),s()}},{...V(),initial:t.cache})}var Me,Ce,De,lt=k(()=>{"use strict";ge();ye();z();ue();Re();me();tt();nt();Me=class extends Error{name="CircuitOpenError";constructor(){super("Circuit breaker is open")}};Ce=class extends Error{name="RateLimiterOverflowError";constructor(e){super(`rateLimiter buffer overflow (maxBuffer=${e})`)}};De=class extends Error{name="TimeoutError";constructor(e){super(`Timed out after ${e/1e6}ms`)}}});var tn={};_t(tn,{NS_PER_MS:()=>A,NS_PER_SEC:()=>F,resilientPipeline:()=>en});module.exports=Tt(tn);me();lt();z();ue();function ft(t,e,n){return{[t]:!0,[`${t}_type`]:e,...n??{}}}function Qt(t,e){return ft("reduction",t,e)}function pt(t,e,n){if(e.length===0)throw new RangeError("budgetGate requires at least one constraint");let r=e.map(p=>p.node),o=[t,...r],a=[],s=!1,i=!1,u=Symbol("budget-gate"),d=new Array(e.length);function c(){return e.every((p,_)=>p.check(d[_]))}function f(p){for(;a.length>0&&c();){let _=a[0];a=a.slice(1),p.emit(_)}a.length===0&&i&&(i=!1,p.down([[T]]))}return B([],(p,_)=>{for(let l=0;l<e.length;l++)d[l]=e[l].node.cache;let h=[];for(let l=0;l<o.length;l++){let m=o[l];h.push(m.subscribe(x=>{for(let E of x)g(E,l,_)}))}return()=>{for(let l of h)l()}},{...n,describeKind:"derived",meta:Qt("budget_gate",n?.meta)});function g(p,_,h){let l=p[0];if(_===0){if(l===y)return c()&&a.length===0?h.emit(p[1]):(a.push(p[1]),s||(s=!0,h.up([[O,u]]))),!0;if(l===v)return h.down([[v]]),!0;if(l===T)return a.length===0?h.down([[T]]):i=!0,!0;if(l===w||l===b){for(let m of a)h.emit(m);return a=[],i=!1,s&&(s=!1,h.up([[C,u]])),h.down([p]),!0}return!1}return l===y&&(d[_-1]=p[1]),l===y||l===T?(c()&&a.length>0?(f(h),a.length===0&&s&&(s=!1,h.up([[C,u]]))):!c()&&!s&&a.length>0&&(s=!0,h.up([[O,u]])),!0):l===v?!0:l===b?(h.down([p]),!0):l===w}}function en(t,e={}){let n=t;e.rateLimit!=null&&(n=at(n,e.rateLimit)),e.budget!=null&&e.budget.length>0&&(n=pt(n,e.budget));let r;if(e.breaker!=null){let a=st(e.breaker),s=e.breakerOnOpen??"skip",i=it(a,{onOpen:s})(n);n=i.node,r=i.breakerState}if(e.timeoutMs!=null){if(e.timeoutMs<=0)throw new RangeError("timeoutMs must be > 0");if(e.timeoutMs>9e6)throw new RangeError("timeoutMs must be <= 9_000_000 (\u22482.5h) to stay within safe ns arithmetic");n=ct(n,e.timeoutMs*1e6)}e.retry!=null&&(n=ot(n,e.retry)),e.fallback!==void 0&&(n=dt(n,e.fallback));let o=ut(n,{initialStatus:e.initialStatus??"pending"});return{node:o.node,status:o.status,error:o.error,breakerState:r}}0&&(module.exports={NS_PER_MS,NS_PER_SEC,resilientPipeline});
1
+ "use strict";var he=Object.defineProperty;var _t=Object.getOwnPropertyDescriptor;var wt=Object.getOwnPropertyNames;var vt=Object.prototype.hasOwnProperty;var N=(t,e)=>()=>(t&&(e=t(t=0)),e);var Tt=(t,e)=>{for(var n in e)he(t,n,{get:e[n],enumerable:!0})},xt=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of wt(e))!vt.call(t,o)&&o!==n&&he(t,o,{get:()=>e[o],enumerable:!(r=_t(e,o))||r.enumerable});return t};var kt=t=>xt(he({},"__esModule",{value:!0}),t);function I(t){return t<0?0:t}function Nt(t,e){return e==="none"?t:e==="full"?Math.random()*t:t/2+Math.random()*(t/2)}function Et(t,e){return t+Math.random()*(e-t)}function St(t){let e=I(t);return()=>e}function Rt(t,e){let n=I(t),r=e===void 0?n:I(e);return o=>n+r*Math.max(0,o)}function Ot(t){let e=I(t?.baseNs??1e8),n=t?.factor!==void 0&&t.factor<1?1:t?.factor??2,r=I(t?.maxDelayNs??30*1e9),o=t?.jitter??"none";return a=>{let s;if(e===0)s=0;else if(n===1)s=e;else{let i=r/e,u=1;for(let c=0;c<Math.max(0,a);c++){if(u>=i){u=i;break}u*=n}s=e*u,s>r&&(s=r)}return Nt(s,o)}}function At(t=100*1e6,e=30*1e9){let n=I(t),r=I(e);function o(a){if(a<=0)return 1;let s=1,i=2;for(let u=1;u<a;u++){let c=s+i;s=i,i=c}return i}return a=>{let s=o(a)*n;return s<=r?s:r}}function Mt(t=100*1e6,e=30*1e9){return(n,r,o)=>{let s=Math.min(e,(o??t)*3);return Et(t,s)}}function me(t){if(t==="constant")return St(1*1e9);if(t==="linear")return Rt(1*1e9);if(t==="exponential")return Ot();if(t==="fibonacci")return At();if(t==="decorrelatedJitter")return Mt();throw new Error(`Unknown backoff preset: "${String(t)}". Use one of: constant, linear, exponential, fibonacci, decorrelatedJitter`)}var A,F,ge=N(()=>{"use strict";A=1e6,F=1e9});function Fe(){return U>0||Q}function Le(){return U>0}function Pe(t){U>0?ee.push(t):t()}function be(t){U+=1;let e=!1;try{t()}catch(n){throw e=!0,n}finally{if(U-=1,U===0)if(e){if(!Q){let n=ee.splice(0);for(let r of n)try{r()}catch{}L.length=0,P.length=0,W.length=0}}else Ct()}}function Ct(){let t=!Q;t&&(Q=!0);let e=[],n=0;try{for(;L.length>0||P.length>0||W.length>0||t&&ee.length>0;){if(t&&ee.length>0){let a=ee.splice(0);for(let s of a)try{s()}catch(i){e.push(i)}continue}if(n+=1,n>1e3)throw L.length=0,P.length=0,W.length=0,new Error("batch drain exceeded 1000 iterations \u2014 likely a reactive cycle");let o=(L.length>0?L:P.length>0?P:W).splice(0);for(let a of o)try{a()}catch(s){e.push(s)}}}finally{t&&(Q=!1)}if(e.length===1)throw e[0];if(e.length>1)throw new AggregateError(e,"batch drain: multiple callbacks threw")}function oe(t,e,n){if(e.length===0)return;if(e.length===1){let c=n(e[0][0]);if(c<3||!Fe()){t(e);return}(c>=5?W:c===4?P:L).push(()=>t(e));return}let r=e.length,o=r,a=r,s=r,i=0;for(;i<r&&n(e[i][0])<3;)i++;for(o=i;i<r&&n(e[i][0])===3;)i++;for(a=i;i<r&&n(e[i][0])===4;)i++;s=i;let u=Fe();if(o>0){let c=e.slice(0,o);t(c)}if(a>o){let c=e.slice(o,a);u?L.push(()=>t(c)):t(c)}if(s>a){let c=e.slice(a,s);u?P.push(()=>t(c)):t(c)}if(r>s){let c=e.slice(s,r);u?W.push(()=>t(c)):t(c)}}var U,Q,L,P,W,ee,ye=N(()=>{"use strict";U=0,Q=!1,L=[],P=[],W=[],ee=[]});function $(){return Math.trunc(performance.now()*1e6)}function Be(){return Date.now()*1e6}var _e=N(()=>{"use strict"});var j,y,T,v,B,R,C,S,w,g,z,we,Dt,ve,It,Ft,Te,Ge,Ve,He,xe,q=N(()=>{"use strict";j=Symbol.for("graphrefly/START"),y=Symbol.for("graphrefly/DATA"),T=Symbol.for("graphrefly/DIRTY"),v=Symbol.for("graphrefly/RESOLVED"),B=Symbol.for("graphrefly/INVALIDATE"),R=Symbol.for("graphrefly/PAUSE"),C=Symbol.for("graphrefly/RESUME"),S=Symbol.for("graphrefly/TEARDOWN"),w=Symbol.for("graphrefly/COMPLETE"),g=Symbol.for("graphrefly/ERROR"),z=Object.freeze([T]),we=Object.freeze([v]),Dt=Object.freeze([B]),ve=Object.freeze([j]),It=Object.freeze([w]),Ft=Object.freeze([S]),Te=Object.freeze([z]),Ge=Object.freeze([we]),Ve=Object.freeze([Dt]),He=Object.freeze([It]),xe=Object.freeze([Ft])});var K,Ue=N(()=>{"use strict";K=class extends Error{actor;action;nodeName;constructor(e,n){super(n??`GuardDenied: action "${String(e.action)}" denied for actor type "${String(e.actor.type)}"`),this.name="GuardDenied",this.actor=e.actor,this.action=e.action,this.nodeName=e.nodeName}get node(){return this.nodeName}}});function We(t){t.registerCodec(Lt)}var Lt,$e=N(()=>{"use strict";Lt={name:"json",version:1,contentType:"application/json",encode(t){let e=JSON.stringify(t);return new TextEncoder().encode(e)},decode(t,e){let n=new TextDecoder().decode(t);return JSON.parse(n)}}});function se(t){if(t==null)return Pt;let{type:e,id:n,...r}=t;return{type:e??"system",id:n??"",...r}}var Pt,je=N(()=>{"use strict";Pt={type:"system",id:""}});function ze(t){t.registerMessageType(j,{tier:0,wireCrossing:!1}),t.registerMessageType(T,{tier:1,wireCrossing:!1}),t.registerMessageType(B,{tier:1,wireCrossing:!1,metaPassthrough:!1}),t.registerMessageType(R,{tier:2,wireCrossing:!1}),t.registerMessageType(C,{tier:2,wireCrossing:!1}),t.registerMessageType(y,{tier:3,wireCrossing:!0}),t.registerMessageType(v,{tier:3,wireCrossing:!0}),t.registerMessageType(w,{tier:4,wireCrossing:!0,metaPassthrough:!1}),t.registerMessageType(g,{tier:4,wireCrossing:!0,metaPassthrough:!1}),t.registerMessageType(S,{tier:5,wireCrossing:!0,metaPassthrough:!1})}var ie,qe=N(()=>{"use strict";q();ie=class{_messageTypes=new Map;_codecs=new Map;_onMessage;_onSubscribe;_defaultVersioning;_defaultHashFn;_inspectorEnabled=!(typeof process<"u"&&process.env?.NODE_ENV==="production");_globalInspector;_rigorRecorder;_frozen=!1;tierOf;constructor(e){this._onMessage=e.onMessage,this._onSubscribe=e.onSubscribe,this._defaultVersioning=e.defaultVersioning,this._defaultHashFn=e.defaultHashFn,this.tierOf=n=>{let r=this._messageTypes.get(n);return r!=null?r.tier:1}}get onMessage(){return this._frozen=!0,this._onMessage}get onSubscribe(){return this._frozen=!0,this._onSubscribe}set onMessage(e){this._assertUnfrozen(),this._onMessage=e}set onSubscribe(e){this._assertUnfrozen(),this._onSubscribe=e}get defaultVersioning(){return this._defaultVersioning}set defaultVersioning(e){this._assertUnfrozen(),this._defaultVersioning=e}get defaultHashFn(){return this._defaultHashFn}set defaultHashFn(e){this._assertUnfrozen(),this._defaultHashFn=e}get inspectorEnabled(){return this._inspectorEnabled}set inspectorEnabled(e){this._inspectorEnabled=e}get globalInspector(){return this._globalInspector}set globalInspector(e){this._globalInspector=e}get rigorRecorder(){return this._rigorRecorder}set rigorRecorder(e){this._rigorRecorder=e}registerMessageType(e,n){return this._assertUnfrozen(),this._messageTypes.set(e,{tier:n.tier,wireCrossing:n.wireCrossing??n.tier>=3,metaPassthrough:n.metaPassthrough??!0}),this}messageTier(e){let n=this._messageTypes.get(e);return n!=null?n.tier:1}isWireCrossing(e){let n=this._messageTypes.get(e);return n!=null?n.wireCrossing:!0}isLocalOnly(e){return!this.isWireCrossing(e)}isMetaPassthrough(e){let n=this._messageTypes.get(e);return n!=null?n.metaPassthrough:!0}isKnownMessageType(e){return this._messageTypes.has(e)}registerCodec(e){return this._assertUnfrozen(),this._codecs.set(e.name,e),this}lookupCodec(e){return this._codecs.get(e)}_isFrozen(){return this._frozen}_assertUnfrozen(){if(this._frozen)throw new Error("GraphReFlyConfig is frozen: a node has already captured this config. Register custom types and set hooks before creating any node.")}}});function ke(t){if(t===void 0)return null;if(typeof t=="number"){if(!Number.isFinite(t))throw new TypeError(`Cannot hash non-finite number: ${t}`);if(Number.isInteger(t)&&!Number.isSafeInteger(t))throw new TypeError(`Cannot hash integer outside safe range (|n| > 2^53-1): ${t}. Cross-language cid parity is not guaranteed for unsafe integers.`);return t}if(typeof t=="string"||typeof t=="boolean"||t===null)return t;if(Array.isArray(t))return t.map(ke);if(typeof t=="object"&&t!==null){let e={};for(let n of Object.keys(t).sort())e[n]=ke(t[n]);return e}return null}function Vt(t){let e=Gt.encode(t),n=e.length,r=n*8,o=n+9+63&-64,a=new Uint8Array(o);a.set(e),a[n]=128;let s=new DataView(a.buffer);s.setUint32(o-4,r>>>0,!1),s.setUint32(o-8,Math.floor(r/4294967296)>>>0,!1);let i=1779033703,u=3144134277,c=1013904242,d=2773480762,f=1359893119,b=2600822924,p=528734635,_=1541459225,h=new Uint32Array(64),l=(x,E)=>x>>>E|x<<32-E;for(let x=0;x<o;x+=64){for(let k=0;k<16;k++)h[k]=s.getUint32(x+k*4,!1);for(let k=16;k<64;k++){let X=h[k-15],Z=h[k-2],re=l(X,7)^l(X,18)^X>>>3,pe=l(Z,17)^l(Z,19)^Z>>>10;h[k]=h[k-16]+re+h[k-7]+pe>>>0}let E=i,Y=u,J=c,le=d,M=f,te=b,ne=p,fe=_;for(let k=0;k<64;k++){let X=l(M,6)^l(M,11)^l(M,25),Z=M&te^~M&ne,re=fe+X+Z+Bt[k]+h[k]>>>0,pe=l(E,2)^l(E,13)^l(E,22),bt=E&Y^E&J^Y&J,yt=pe+bt>>>0;fe=ne,ne=te,te=M,M=le+re>>>0,le=J,J=Y,Y=E,E=re+yt>>>0}i=i+E>>>0,u=u+Y>>>0,c=c+J>>>0,d=d+le>>>0,f=f+M>>>0,b=b+te>>>0,p=p+ne>>>0,_=_+fe>>>0}let m=x=>x.toString(16).padStart(8,"0");return m(i)+m(u)+m(c)+m(d)+m(f)+m(b)+m(p)+m(_)}function Ne(t){let e=ke(t??null),n=JSON.stringify(e);return Vt(n).slice(0,16)}function Ht(){let t=globalThis.crypto;if(t?.randomUUID)return t.randomUUID();let e=()=>Math.floor(Math.random()*4294967296).toString(16).padStart(8,"0"),n=e()+e()+e()+e();return`${n.slice(0,8)}-${n.slice(8,12)}-4${n.slice(13,16)}-${(parseInt(n.slice(16,17),16)&3|8).toString(16)}${n.slice(17,20)}-${n.slice(20,32)}`}function Ee(t,e,n){let r=n?.id??Ht();if(t===0)return{id:r,version:0};let a=(n?.hash??Ne)(e);return{id:r,version:0,cid:a,prev:null}}function Ke(t,e,n){t.version+=1,"cid"in t&&(t.prev=t.cid,t.cid=n(e))}var Bt,Gt,Ye=N(()=>{"use strict";Bt=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),Gt=new TextEncoder});function Ze(t){return{node:t,unsub:null,prevData:void 0,dirty:!1,involvedThisWave:!1,dataBatch:[],terminal:void 0}}function Se(t){t.prevData=void 0,t.dirty=!1,t.involvedThisWave=!1,t.dataBatch.length=0,t.terminal=void 0}function ae(t){return t.length===0?t:typeof t[0]=="symbol"?[t]:t}function G(t,e,n){let r=Qe(t)?t:[],o=typeof t=="function"?t:typeof e=="function"?e:void 0,a={};return Qe(t)?a=(Re(e)?e:n)??{}:Re(t)?a=t:a=(Re(e)?e:n)??{},new ue(r,o,a)}var Je,Xe,Ut,Wt,Oe,ue,Qe,Re,ce=N(()=>{"use strict";$e();je();ye();_e();qe();Ue();q();Ye();Je=()=>{},Xe=100;Ut=(t,e,n,r)=>{n.direction==="down-in"&&t._onDepMessage(n.depIndex,e)},Wt=(t,e,n,r)=>{let o=t;if(o._status==="completed"||o._status==="errored")return;let a=o._cached,s=a===void 0?[ve]:[ve,[y,a]];o._status==="dirty"&&s.push(z),oe(e,s,o._config.tierOf)},Oe=new ie({onMessage:Ut,onSubscribe:Wt});ze(Oe);We(Oe);ue=class t{_optsName;_describeKind;meta;_hasMeta;_config;_deps;_sinks=null;_sinkCount=0;_cached;_status;_cleanup;_store={};_waveHasNewData=!1;_hasNewTerminal=!1;_hasCalledFnOnce=!1;_paused=!1;_pendingWave=!1;_isExecutingFn=!1;_pendingRerun=!1;_rerunDepth=0;_dirtyDepCount=0;_batchPendingMessages=null;_pauseLocks=null;_pauseBuffer=null;_fn;_equals;_resubscribable;_resetOnTeardown;_autoComplete;_autoError;_pausable;_partial;_guard;_extraGuards;_hashFn;_versioning;_versioningLevel;_lastMutation;_inspectorHooks;_actions;constructor(e,n,r){this._config=r.config??Oe,this._config.onMessage,this._optsName=r.name,this._describeKind=r.describeKind,this._equals=r.equals??Object.is,this._resubscribable=r.resubscribable??!1,this._resetOnTeardown=r.resetOnTeardown??!1,this._autoComplete=r.completeWhenDepsComplete??!0,this._autoError=r.errorWhenDepsError??!0,this._pausable=r.pausable??!0,this._guard=r.guard,this._fn=n,this._partial=r.partial??!1,this._cached=r.initial!==void 0?r.initial:void 0,this._status=e.length===0&&n==null&&this._cached!==void 0?"settled":"sentinel",this._hashFn=r.versioningHash??this._config.defaultHashFn??Ne;let o=r.versioning??this._config.defaultVersioning;this._versioningLevel=o,this._versioning=o!=null?Ee(o,this._cached===void 0?void 0:this._cached,{id:r.versioningId,hash:this._hashFn}):void 0,this._deps=e.map(Ze);let a={};for(let[i,u]of Object.entries(r.meta??{})){let c={initial:u,name:`${r.name??"node"}:meta:${i}`,describeKind:"state",config:this._config};r.guard!=null&&(c.guard=r.guard),a[i]=new t([],void 0,c)}Object.freeze(a),this.meta=a,this._hasMeta=Object.keys(a).length>0;let s=this;this._actions={emit(i){s._emit([[y,i]])},down(i){s._emit(ae(i))},up(i){s._emitUp(ae(i))}},this.down=this.down.bind(this),this.up=this.up.bind(this)}get _isTerminal(){return this._status==="completed"||this._status==="errored"}get name(){return this._optsName}get status(){return this._status}get cache(){return this._cached===void 0?void 0:this._cached}get lastMutation(){return this._lastMutation}get v(){return this._versioning}hasGuard(){return this._guard!=null}_applyVersioning(e,n){if(this._isExecutingFn)throw new Error(`Node "${this.name}": _applyVersioning cannot run mid-fn \u2014 call it outside of \`_execFn\` (typically at graph setup time before the first subscribe).`);let r=this._versioningLevel;if(r!=null&&e<=r)return;let o=n?.hash??this._hashFn;o!==this._hashFn&&(this._hashFn=o);let a=this._cached===void 0?void 0:this._cached,s=this._versioning,i=s?.id??n?.id,u=s?.version??0,c=Ee(e,a,{id:i,hash:o});c.version=u,this._versioning=c,this._versioningLevel=e}_setInspectorHook(e){return e==null?()=>{}:(this._inspectorHooks==null&&(this._inspectorHooks=new Set),this._inspectorHooks.add(e),()=>{this._inspectorHooks?.delete(e),this._inspectorHooks?.size===0&&(this._inspectorHooks=void 0)})}_pushGuard(e){return this._extraGuards==null&&(this._extraGuards=new Set),this._extraGuards.add(e),()=>{this._extraGuards?.delete(e),this._extraGuards?.size===0&&(this._extraGuards=void 0)}}allowsObserve(e){if(this._guard==null&&this._extraGuards==null)return!0;let n=se(e);if(this._guard!=null&&!this._guard(n,"observe"))return!1;if(this._extraGuards!=null){for(let r of this._extraGuards)if(!r(n,"observe"))return!1}return!0}_checkGuard(e){if(e?.internal)return;let n=this._guard!=null||this._extraGuards!=null,r=e?.actor!=null;if(!n&&!r)return;let o=se(e?.actor),a=e?.delivery==="signal"?"signal":"write";if(this._guard!=null&&!this._guard(o,a))throw new K({actor:o,action:a,nodeName:this.name});if(this._extraGuards!=null){for(let s of this._extraGuards)if(!s(o,a))throw new K({actor:o,action:a,nodeName:this.name})}this._lastMutation={actor:o,timestamp_ns:Be()}}down(e,n){let r=ae(e);r.length!==0&&(this._checkGuard(n),this._emit(r))}emit(e,n){this._checkGuard(n),this._emit([[y,e]])}up(e,n){if(this._deps.length===0)return;let r=ae(e);if(r.length===0)return;this._checkGuard(n);let o=n??{internal:!0};this._validateUpTiers(r);for(let a of this._deps)a.node.up?.(r,o)}_emitUp(e){if(this._deps.length!==0&&e.length!==0){this._validateUpTiers(e);for(let n of this._deps)n.node.up?.(e,{internal:!0})}}_validateUpTiers(e){let n=this._config.tierOf;for(let r of e){let o=n(r[0]);if(o===3||o===4)throw new Error(`Node "${this.name}": tier-${o} messages cannot flow up \u2014 DATA/RESOLVED/COMPLETE/ERROR are downstream-only. Use \`down(...)\` for value delivery; \`up(...)\` is for control signals (DIRTY, INVALIDATE, PAUSE, RESUME, TEARDOWN).`)}}subscribe(e,n){if(n!=null&&this._guard!=null){let u=se(n);if(!this._guard(u,"observe"))throw new K({actor:u,action:"observe",nodeName:this.name})}let o=this._isTerminal&&this._resubscribable;if(o){this._cached=void 0,this._status="sentinel",this._store={},this._hasCalledFnOnce=!1,this._waveHasNewData=!1,this._hasNewTerminal=!1,this._paused=!1,this._pendingWave=!1,this._pendingRerun=!1,this._isExecutingFn=!1,this._rerunDepth=0,this._dirtyDepCount=0,this._pauseLocks=null,this._pauseBuffer=null;for(let u of this._deps)Se(u);if(this._partial===!1){for(let u of this._deps)if(u.prevData!==void 0||u.dataBatch.length!==0||u.terminal!==void 0||u.dirty)throw new Error(`resubscribable-reset invariant: DepRecord not fully reset for node ${this._optsName??"(anonymous)"}`)}}this._sinkCount+=1;let a;try{a=this._config.onSubscribe(this,e,{sinkCount:this._sinkCount,afterTerminalReset:o},this._actions)}catch(u){throw this._sinkCount-=1,u}this._sinks==null?this._sinks=e:typeof this._sinks=="function"?this._sinks=new Set([this._sinks,e]):this._sinks.add(e);let s=this._isTerminal;if(this._sinkCount===1&&!s)try{this._activate()}catch(u){if(this._sinkCount-=1,this._removeSink(e),this._sinkCount===0&&(this._status="sentinel"),typeof a=="function")try{a()}catch{}throw u}this._status==="sentinel"&&this._cached===void 0&&(this._status="pending");let i=!1;return()=>{i||(i=!0,this._sinkCount-=1,this._removeSink(e),typeof a=="function"&&a(),this._sinks==null&&this._deactivate())}}_removeSink(e){if(this._sinks===e)this._sinks=null;else if(this._sinks!=null&&typeof this._sinks!="function")if(this._sinks.delete(e),this._sinks.size===1){let[n]=this._sinks;this._sinks=n}else this._sinks.size===0&&(this._sinks=null)}_activate(){if(this._deps.length===0){this._fn&&this._execFn();return}this._dirtyDepCount=0;let e=this._deps.length,n=0;try{for(let r=0;r<e;r++){let o=r,a=this._deps[r];a.unsub=Je,a.unsub=a.node.subscribe(s=>{if(a.unsub===null)return;let i=this._config.tierOf,u=!1;for(let c of s)i(c[0])>=3&&(u=!0),this._config.onMessage(this,c,{direction:"down-in",depIndex:o},this._actions);u&&this._maybeRunFnOnSettlement()}),n++}}catch(r){this._deps[n].unsub=null;for(let o=0;o<n;o++){let a=this._deps[o];if(a.unsub!=null){let s=a.unsub;a.unsub=null;try{s()}catch{}Se(a)}}throw this._dirtyDepCount=0,r}}_addDep(e){for(let o=0;o<this._deps.length;o++)if(this._deps[o].node===e)return o;let n=this._deps.length,r=Ze(e);if(this._deps.push(r),this._sinks==null)return n;r.dirty=!0,this._dirtyDepCount++,this._status!=="dirty"&&this._emit(Te),r.unsub=Je;try{r.unsub=e.subscribe(o=>{if(r.unsub===null)return;let a=this._config.tierOf,s=!1;for(let i of o)a(i[0])>=3&&(s=!0),this._config.onMessage(this,i,{direction:"down-in",depIndex:n},this._actions);s&&this._maybeRunFnOnSettlement()})}catch(o){throw r.unsub=null,this._deps.pop(),this._dirtyDepCount--,o}return n}_deactivate(e=!1){let n=this._cleanup;if(this._cleanup=void 0,typeof n=="function")try{n()}catch(r){this._emit([[g,this._wrapFnError("cleanup threw",r)]])}else if(n!=null&&typeof n=="object"){let r=n.deactivate;if(typeof r=="function")try{r()}catch(o){this._emit([[g,this._wrapFnError("cleanup.deactivate threw",o)]])}}for(let r of this._deps){if(r.unsub!=null){let o=r.unsub;r.unsub=null;try{o()}catch{}}Se(r)}this._waveHasNewData=!1,this._hasNewTerminal=!1,this._hasCalledFnOnce=!1,this._paused=!1,this._pendingWave=!1,this._pendingRerun=!1,this._rerunDepth=0,this._store={},this._dirtyDepCount=0,this._pauseLocks=null,this._pauseBuffer=null,this._fn!=null&&(this._cached=void 0),e||(this._fn!=null||this._deps.length>0)&&(!this._isTerminal||this._resubscribable)&&(this._status="sentinel")}_onDepMessage(e,n){let r=this._deps[e],o=n[0];if(this._inspectorHooks!=null){let a={kind:"dep_message",depIndex:e,message:n};for(let s of this._inspectorHooks)s(a)}if(o!==j){if(o===T){this._depDirtied(r);return}if(o===B){if(this._depInvalidated(r),this._cached===void 0)return;this._emit(Ve);return}if(o===R||o===C){this._emit([n]);return}if(o===S){this._emit(xe);return}if(o===y)this._depSettledAsData(r,n[1]);else if(o===v)this._depSettledAsResolved(r);else if(o===w)this._depSettledAsTerminal(r,!0);else if(o===g)this._depSettledAsTerminal(r,n[1]);else{this._emit([n]);return}if(!this._fn){(o===y||o===v)&&this._emit([n]),(o===w||o===g)&&this._maybeAutoTerminalAfterWave();return}}}_depDirtied(e){e.dirty||(e.dirty=!0,e.involvedThisWave=!0,this._dirtyDepCount++,this._status!=="dirty"&&this._emit(Te))}_depSettledAsData(e,n){e.dirty&&(e.dirty=!1,this._dirtyDepCount--),e.involvedThisWave=!0,e.dataBatch.push(n),this._waveHasNewData=!0}_depSettledAsResolved(e){e.dirty&&(e.dirty=!1,this._dirtyDepCount--)}_depSettledAsTerminal(e,n){e.dirty&&(e.dirty=!1,this._dirtyDepCount--),e.terminal=n,e.involvedThisWave=!0,this._hasNewTerminal=!0}_depInvalidated(e){e.prevData=void 0,e.terminal=void 0,e.dataBatch.length=0,e.dirty?e.involvedThisWave=!1:(e.dirty=!0,e.involvedThisWave=!0,this._dirtyDepCount++)}_maybeRunFnOnSettlement(){if(!(this._isTerminal&&!this._resubscribable)&&!(this._dirtyDepCount>0)){if(!this._partial&&!this._hasCalledFnOnce)for(let e=0;e<this._deps.length;e++){let n=this._deps[e];if(n.dataBatch.length===0&&n.prevData===void 0&&n.terminal===void 0){this._maybeAutoTerminalAfterWave();return}}if(this._paused){this._pendingWave=!0;return}if(!this._waveHasNewData&&!this._hasNewTerminal&&this._hasCalledFnOnce){this._clearWaveFlags(),this._emit(Ge),this._maybeAutoTerminalAfterWave();return}this._fn&&this._execFn(),this._maybeAutoTerminalAfterWave()}}_maybeAutoTerminalAfterWave(){if(this._deps.length===0||this._isTerminal)return;let e=this._deps.find(n=>n.terminal!==void 0&&n.terminal!==!0);if(e!=null){this._autoError&&this._emit([[g,e.terminal]]);return}this._autoComplete&&this._deps.every(n=>n.terminal!==void 0)&&this._emit(He)}_execFn(){if(!this._fn||this._isTerminal&&!this._resubscribable)return;if(this._isExecutingFn){this._pendingRerun=!0;return}let e=this._cleanup;if(typeof e=="function"){this._cleanup=void 0;try{e()}catch(s){this._emit([[g,this._wrapFnError("cleanup threw",s)]]);return}}else if(e!=null&&typeof e=="object"){let s=e.beforeRun;if(typeof s=="function"){e.beforeRun=void 0;try{s()}catch(i){this._emit([[g,this._wrapFnError("cleanup.beforeRun threw",i)]]);return}}}let n=this._deps.map(s=>s.involvedThisWave?s.dataBatch.length>0?[...s.dataBatch]:[]:void 0),r=this._deps.map(s=>s.prevData);for(let s=0;s<this._deps.length;s++){let i=n[s];i!=null&&i.length>0&&(this._deps[s].prevData=i[i.length-1])}let o=this._deps.map(s=>s.terminal),a={prevData:r,terminalDeps:o,store:this._store};if(this._hasCalledFnOnce=!0,this._clearWaveFlags(),this._inspectorHooks!=null){let s={kind:"run",batchData:n,prevData:r};for(let i of this._inspectorHooks)i(s)}this._isExecutingFn=!0;try{let s=this._fn(n,this._actions,a);if(typeof s=="function")this._cleanup=s;else if(s!=null&&typeof s=="object"){let i=s;(typeof i.beforeRun=="function"||typeof i.deactivate=="function"||typeof i.invalidate=="function")&&(this._cleanup=s)}}catch(s){this._emit([[g,this._wrapFnError("fn threw",s)]])}finally{this._isExecutingFn=!1,this._pendingRerun?(this._pendingRerun=!1,this._rerunDepth+=1,this._rerunDepth>Xe?(this._rerunDepth=0,this._emit([[g,new Error(`Node "${this.name}": _pendingRerun depth exceeded ${Xe} \u2014 likely a reactive cycle`)]])):this._maybeRunFnOnSettlement()):this._rerunDepth=0,this._clearWaveFlags()}}_clearWaveFlags(){this._waveHasNewData=!1,this._hasNewTerminal=!1;for(let e of this._deps)e.involvedThisWave=!1,e.dataBatch.length=0}_wrapFnError(e,n){let r=n instanceof Error?n.message:String(n);return new Error(`Node "${this.name}": ${e}: ${r}`,{cause:n})}_frameBatch(e){let n=this._config.tierOf;if(e.length===1)return n(e[0][0])===3&&this._status!=="dirty"?[z,e[0]]:e;let r=!0,o=!1,a=!1,s=-1;for(let u of e){let c=n(u[0]);c<s&&(r=!1),c===3&&(o=!0),u[0]===T&&(a=!0),s=c}let i=e;if(!r){let u=e.map((c,d)=>({m:c,i:d,tier:n(c[0])}));u.sort((c,d)=>c.tier-d.tier||c.i-d.i),i=u.map(c=>c.m)}if(o&&!a&&this._status!=="dirty"){let u=0;for(;u<i.length&&n(i[u][0])===0;)u++;return u===0?[z,...i]:[...i.slice(0,u),z,...i.slice(u)]}return i}_emit(e){if(e.length===0)return;for(let i=0;i<e.length;i++){let u=e[i];if(u[0]===g&&u[1]===void 0)throw new TypeError('[ERROR, payload] requires a non-undefined payload (spec \xA71.2). Pass an Error object or domain tag instead \u2014 e.g. node.down([[ERROR, new Error("reason")]])')}let n=e;if(this._isTerminal&&!this._resubscribable){let i=e.filter(u=>u[0]===S||u[0]===B);if(i.length===0)return;n=i}n=this._frameBatch(n);let o=null;for(let i=0;i<n.length;i++){let u=n[i],c=u[0];if(c!==R&&c!==C){o?.push(u);continue}if(u.length<2)throw new Error(`Node "${this.name}": [[${c===R?"PAUSE":"RESUME"}]] must carry a lockId payload \u2014 bare PAUSE/RESUME is a protocol violation (C0 rule). Use \`[[PAUSE, lockId]]\` / \`[[RESUME, lockId]]\`.`);let d=!0;if(this._pausable!==!1){let f=u[1];if(c===R)this._pauseLocks==null&&(this._pauseLocks=new Set),this._pauseLocks.add(f),this._paused=!0,this._pausable==="resumeAll"&&this._pauseBuffer==null&&(this._pauseBuffer=[]);else if(this._pauseLocks==null||!this._pauseLocks.has(f))d=!1;else if(this._pauseLocks.delete(f),this._pauseLocks.size===0){if(this._paused=!1,this._pauseBuffer!=null&&this._pauseBuffer.length>0){let b=this._pauseBuffer;this._pauseBuffer=[],this._emit(b)}this._pendingWave&&(this._pendingWave=!1,this._maybeRunFnOnSettlement())}}d?o?.push(u):o==null&&(o=n.slice(0,i))}if(o!=null){if(o.length===0)return;n=o}if(this._hasMeta&&n.some(i=>i[0]===S))for(let i of Object.keys(this.meta))try{this.meta[i]._emit(xe)}catch{}let{finalMessages:a,equalsError:s}=this._updateState(n);if(a.length>0&&this._config.inspectorEnabled){let i=this._config.globalInspector;if(i!=null)try{i({kind:"emit",node:this,messages:a})}catch{}}if(a.length>0)if(this._paused&&this._pausable==="resumeAll"&&this._pauseBuffer!=null){let i=this._config.tierOf,u=[];for(let c of a)i(c[0])===3?this._pauseBuffer.push(c):u.push(c);u.length>0&&this._dispatchOrAccumulate(u)}else this._dispatchOrAccumulate(a);s!=null&&this._emit([[g,s]])}_updateState(e){let n=this._config.tierOf,r,o,a=-1,s=0;for(let d of e)n(d[0])===3&&s++;let i=s<=1,u=-1;if(this._versioning!=null&&s>1){for(let d=e.length-1;d>=0;d--)if(e[d][0]===y){u=d;break}}for(let d=0;d<e.length;d++){let f=e[d],b=f[0];if(b===y){if(f.length>=2){let p=!1;if(i&&this._cached!==void 0)try{p=this._equals(this._cached,f[1])}catch(_){o=this._wrapFnError("equals threw",_),a=d;break}if(p){r==null&&(r=e.slice(0,d)),r.push(we),this._status="resolved";continue}this._cached=f[1],this._versioning!=null&&(u<0||d===u)&&Ke(this._versioning,f[1],this._hashFn)}this._status="settled",r?.push(f)}else if(r?.push(f),b===T)this._status="dirty";else if(b===v)this._status="resolved";else if(b===w){this._status="completed";{let p=this._config.rigorRecorder;if(p!=null)try{p.onTerminalTransition(this,"completed",this._autoComplete,this._autoError,this._deps.length>0)}catch{}}}else if(b===g){this._status="errored";{let p=this._config.rigorRecorder;if(p!=null)try{p.onTerminalTransition(this,"errored",this._autoComplete,this._autoError,this._deps.length>0)}catch{}}}else if(b===B){if(this._cached!==void 0){let _=this._config.rigorRecorder;if(_!=null)try{_.onNonVacuousInvalidate(this,this._cached)}catch{}}this._cached=void 0,this._status="dirty";let p=this._cleanup;if(typeof p=="function"){this._cleanup=void 0;try{p()}catch{}}else if(p!=null&&typeof p=="object"){let _=p.invalidate;if(typeof _=="function")try{_()}catch{}}}else b===S&&(this._resetOnTeardown&&(this._cached=void 0),this._deactivate(!0),this._status="sentinel")}let c=a>=0?r??e.slice(0,a):r??e;return o!=null?{finalMessages:c,equalsError:o}:{finalMessages:c}}_deliverToSinks=e=>{if(this._sinks==null)return;if(typeof this._sinks=="function"){this._sinks(e);return}let n=[...this._sinks];for(let r of n)r(e)};_dispatchOrAccumulate(e){if(Le()){this._batchPendingMessages===null&&(this._batchPendingMessages=[],Pe(()=>this._flushBatchPending()));for(let n of e)this._batchPendingMessages.push(n);return}oe(this._deliverToSinks,e,this._config.tierOf)}_flushBatchPending(){let e=this._batchPendingMessages;if(e===null||(this._batchPendingMessages=null,e.length===0))return;let n=this._frameBatch(e);oe(this._deliverToSinks,n,this._config.tierOf)}},Qe=t=>Array.isArray(t),Re=t=>typeof t=="object"&&t!=null&&!Array.isArray(t)});function D(t,e){let n={factory:t};return e!==void 0&&(n.factoryArgs=e),n}var et=N(()=>{"use strict"});function O(t,e){return G((r,o,a)=>t(o,a)??void 0,{describeKind:"producer",...e})}var Ae=N(()=>{"use strict";ce()});function Me(t){return{describeKind:"producer",...t}}function tt(t,e){return O(n=>{let r=!1;try{for(let o of t){if(r)return;n.emit(o)}r||n.down([[w]])}catch(o){r||n.down([[g,o]])}return()=>{r=!0}},Me(e))}function $t(t){return t!=null&&typeof t.then=="function"}function jt(t,e){let{signal:n,...r}=e??{};return O(o=>{let a=!1,s=()=>{a||(a=!0,o.down([[g,n.reason]]))};if(n?.aborted){s();return}return n?.addEventListener("abort",s,{once:!0}),Promise.resolve(t).then(i=>{a||(a=!0,n?.removeEventListener("abort",s),o.emit(i),o.down([[w]]))},i=>{a||(a=!0,n?.removeEventListener("abort",s),o.down([[g,i]]))}),()=>{a=!0,n?.removeEventListener("abort",s)}},Me(r))}function zt(t,e){let{signal:n,...r}=e??{};return O(o=>{let a=new AbortController,s=()=>a.abort(n?.reason);n?.aborted?a.abort(n.reason):n?.addEventListener("abort",s,{once:!0});let i=n??a.signal,u=!1,c=t[Symbol.asyncIterator](),d=()=>{u||i.aborted||Promise.resolve(c.next()).then(f=>{if(!(u||i.aborted)){if(f.done){o.down([[w]]);return}o.emit(f.value),d()}},f=>{!u&&!i.aborted&&o.down([[g,f]])})};return d(),()=>{u=!0,n?.removeEventListener("abort",s),a.abort(),Promise.resolve(c.return?.()).catch(()=>{})}},Me(r))}function qt(t){return t!=null&&typeof t=="object"&&"cache"in t&&typeof t.subscribe=="function"}function nt(t,e){if(qt(t))return t;if($t(t))return jt(t,e);if(t!=null){let n=t;if(typeof n[Symbol.asyncIterator]=="function")return zt(t,e);if(typeof n[Symbol.iterator]=="function")return tt(t,e)}return Kt(t)}function Kt(...t){return tt(t,void 0)}var rt=N(()=>{"use strict";q();Ae()});var V,ot=N(()=>{"use strict";V=class{_timer;_gen=0;start(e,n){this.cancel(),this._gen+=1;let r=this._gen;this._timer=setTimeout(()=>{this._timer=void 0,r===this._gen&&n()},e)}cancel(){this._timer!==void 0&&(clearTimeout(this._timer),this._timer=void 0)}get pending(){return this._timer!==void 0}}});function H(t){return{describeKind:"derived",...t}}function Yt(t){return t<0?0:t}function de(t){return t[1]}function st(t){if(typeof t!="number"||!Number.isFinite(t))throw new TypeError("backoff strategy must return a finite number");return t<0?0:t}function it(t,e){return typeof t=="function"?Xt(t,e):Jt(t,e)}function at(t){let e={};return t?.count!==void 0&&(e.count=t.count),typeof t?.backoff=="string"&&(e.backoff=t.backoff),Object.keys(e).length>0?e:void 0}function Jt(t,e){let n=e?.count,r=e?.backoff,o=n!==void 0?n:r===void 0?0:2147483647;if(o<0)throw new RangeError("retry count must be >= 0");let a=r===void 0?null:typeof r=="string"?me(r):r;return O(s=>{let i=0,u=!1,c=null,d,f=new V;function b(){d?.(),d=void 0}function p(h){if(u)return;if(i>=o){b(),s.down([[g,h]]);return}let l=a===null?0:a(i,h,c);if(l==null){b(),s.down([[g,h]]);return}let m;try{m=st(l)}catch{b(),s.down([[g,h]]);return}c=m,i+=1,b();let x=m>0?m/1e6:1;f.start(x,()=>{u||_()})}function _(){f.cancel(),b(),d=t.subscribe(h=>{if(!u)for(let l of h){let m=l[0];if(m===T)s.down([[T]]);else if(m===y)i=0,c=null,s.emit(l[1]);else if(m===v)s.down([[v]]);else if(m===w)b(),s.down([[w]]);else if(m===g){p(de(l));return}else s.down([l])}})}return _(),()=>{u=!0,f.cancel(),b()}},{...H(),initial:t.cache,meta:{...D("retry",at(e))}})}function Xt(t,e){let n=e?.count,r=e?.backoff,o=n!==void 0?n:r===void 0?0:2147483647;if(o<0)throw new RangeError("retry count must be >= 0");let a=r===void 0?null:typeof r=="string"?me(r):r;return O(s=>{let i=0,u=!1,c=null,d,f=new V;function b(){d?.(),d=void 0}function p(h){if(u)return;if(i>=o){b(),s.down([[g,h]]);return}let l=a===null?0:a(i,h,c);if(l==null){b(),s.down([[g,h]]);return}let m;try{m=st(l)}catch{b(),s.down([[g,h]]);return}c=m,i+=1,b();let x=m>0?m/1e6:1;f.start(x,()=>{u||_()})}function _(){f.cancel(),b();let h;try{h=t()}catch(l){p(l);return}d=h.subscribe(l=>{if(!u)for(let m of l){let x=m[0];if(x===T)s.down([[T]]);else if(x===y)i=0,c=null,s.emit(m[1]);else if(x===v)s.down([[v]]);else if(x===w)b(),s.down([[w]]);else if(x===g){p(de(m));return}else s.down([m])}})}return _(),()=>{u=!0,f.cancel(),b()}},{...H(),initial:e?.initial,meta:{...D("retry",at(e))}})}function ut(t){let e=Math.max(1,t?.failureThreshold??5),n=Yt(t?.cooldownNs??30*1e9),r=t?.cooldown??null,o=Math.max(1,t?.halfOpenMax??1),a=t?.now??$,s="closed",i=0,u=0,c=0,d=n,f=0;function b(){if(!r)return n;let h=r(u);return h!==null?h:n}function p(){s="open",d=b(),c=a(),f=0}return{canExecute(){return s==="closed"?!0:s==="open"?a()-c>=d?(s="half-open",f=1,!0):!1:f<o?(f++,!0):!1},recordSuccess(){s==="half-open"?(s="closed",i=0,u=0):s==="closed"&&(i=0)},recordFailure(h){if(s==="half-open"){u++,p();return}s==="closed"&&(i++,i>=e&&p())},get state(){return s},get failureCount(){return i},reset(){s="closed",i=0,u=0,f=0}}}function ct(t,e){let n=e?.onOpen??"skip";return r=>{let o=G([],(a,s)=>{function i(){o.meta.breakerState.down([[y,t.state]])}let u=r.subscribe(c=>{for(let d of c){let f=d[0];f===T?s.down([[T]]):f===y?t.canExecute()?(i(),s.emit(d[1])):(i(),n==="error"?s.down([[g,new Ce]]):s.down([[v]])):f===v?s.down([[v]]):f===w?(t.recordSuccess(),i(),s.down([[w]])):f===g?(t.recordFailure(de(d)),i(),s.down([d])):s.down([d])}});return i(),u},{...H(),meta:{breakerState:t.state,...D("withBreaker",{onOpen:n})},completeWhenDepsComplete:!1,initial:r.cache});return{node:o,breakerState:o.meta.breakerState}}}function Zt(t,e){if(t<=0)throw new RangeError("capacity must be > 0");if(e<0)throw new RangeError("refillPerSecond must be >= 0");let n=t,r=$();function o(a){if(e>0){let s=a-r;n=Math.min(t,n+s/1e9*e)}r=a}return{available(){return o($()),n},tryConsume(a=1){if(a<=0)return!0;let s=$();return o(s),n>=a?(n-=a,!0):!1},putBack(a=1){a<=0||(o($()),n=Math.min(t,n+a))}}}function dt(t,e){let{maxEvents:n,windowNs:r}=e;if(n<=0)throw new RangeError("maxEvents must be > 0");if(r<=0)throw new RangeError("windowNs must be > 0");let o=e.maxBuffer;if(o!==void 0&&o<1)throw new RangeError("maxBuffer must be >= 1");let a=e.onOverflow??"drop-newest",s=n*1e9/r;return O(i=>{let u=Zt(n,s),c=[],d=new V,f=!1,b=1e9/s;function p(){for(;c.length>0;)if(u.tryConsume(1))i.emit(c.shift());else{d.start(Math.max(1,b/1e6),p);return}}let _=t.subscribe(h=>{for(let l of h){if(f)return;let m=l[0];if(m===T)i.down([[T]]);else if(m===y){if(o!==void 0&&c.length>=o){if(a!=="drop-newest")if(a==="drop-oldest")c.shift(),c.push(l[1]);else{f=!0,d.cancel(),c.length=0,i.down([[g,new De(o)]]);return}}else c.push(l[1]);p()}else if(m===v)i.down([[v]]);else if(m===w)f=!0,d.cancel(),c.length=0,i.down([[w]]);else if(m===g)f=!0,d.cancel(),c.length=0,i.down([l]);else if(m===S){f=!0,d.cancel(),c.length=0,i.down([l]);return}else i.down([l])}});return()=>{f=!0,d.cancel(),_()}},{...H(),initial:t.cache,meta:{...D("rateLimiter",e)}})}function lt(t,e){let n=e?.initialStatus??"pending",r=G([],(o,a)=>{let s=n;return r.meta.status.down([[y,n]]),r.meta.error.down([[y,null]]),t.subscribe(u=>{for(let c of u){let d=c[0];if(d===T)a.down([[T]]);else if(d===y)s==="errored"?be(()=>{r.meta.error.down([[y,null]]),r.meta.status.down([[y,"active"]])}):r.meta.status.down([[y,"active"]]),s="active",a.emit(c[1]);else if(d===v)a.down([[v]]);else if(d===w)r.meta.status.down([[y,"completed"]]),s="completed",a.down([[w]]);else if(d===g){let f=de(c);be(()=>{r.meta.error.down([[y,f]]),r.meta.status.down([[y,"errored"]])}),s="errored",a.down([c])}else a.down([c])}})},{...H(),meta:{status:n,error:null,...D("withStatus",{initialStatus:n})},completeWhenDepsComplete:!1,resubscribable:!0,initial:t.cache});return{node:r,status:r.meta.status,error:r.meta.error}}function Qt(t){return t!=null&&typeof t=="object"&&"cache"in t&&typeof t.subscribe=="function"}function en(t){return t!=null&&typeof t.then=="function"}function tn(t){return t!=null&&typeof t=="object"&&typeof t[Symbol.asyncIterator]=="function"}function ft(t,e){return O(n=>{let r,o;function a(){o?.(),o=void 0,Qt(e)||en(e)||tn(e)?r=nt(e).subscribe(i=>{n.down(i)}):(n.emit(e),n.down([[w]]))}return o=t.subscribe(s=>{for(let i of s){let u=i[0];if(u===T)n.down([[T]]);else if(u===y)n.emit(i[1]);else if(u===v)n.down([[v]]);else if(u===w)n.down([[w]]);else if(u===g){a();return}else if(u===S){r?.(),n.down([i]);return}else n.down([i])}}),()=>{o?.(),r?.()}},{...H(),initial:t.cache,meta:{...D("fallback")}})}function pt(t,e){if(e<=0)throw new RangeError("timeoutNs must be > 0");return O(n=>{let r=!1,o=new V;function a(){let i=e/1e6;o.start(i,()=>{r||(r=!0,s(),n.down([[g,new Ie(e)]]))})}let s=t.subscribe(i=>{for(let u of i){if(r)return;let c=u[0];if(c===T)n.down([[T]]);else if(c===y)a(),n.emit(u[1]);else if(c===v)n.down([[v]]);else if(c===w){o.cancel(),r=!0,n.down([[w]]);return}else if(c===g){o.cancel(),r=!0,n.down([u]);return}else if(c===S){o.cancel(),r=!0,n.down([u]);return}else n.down([u])}});return a(),()=>{r=!0,o.cancel(),s()}},{...H(),initial:t.cache,meta:{...D("timeout",{timeoutNs:e})}})}var Ce,De,Ie,ht=N(()=>{"use strict";ye();_e();q();et();ce();Ae();ge();rt();ot();Ce=class extends Error{name="CircuitOpenError";constructor(){super("Circuit breaker is open")}};De=class extends Error{name="RateLimiterOverflowError";constructor(e){super(`rateLimiter buffer overflow (maxBuffer=${e})`)}};Ie=class extends Error{name="TimeoutError";constructor(e){super(`Timed out after ${e/1e6}ms`)}}});var on={};Tt(on,{NS_PER_MS:()=>A,NS_PER_SEC:()=>F,resilientPipeline:()=>rn});module.exports=kt(on);ge();ht();q();ce();function mt(t,e,n){return{[t]:!0,[`${t}_type`]:e,...n??{}}}function nn(t,e){return mt("reduction",t,e)}function gt(t,e,n){if(e.length===0)throw new RangeError("budgetGate requires at least one constraint");let r=e.map(p=>p.node),o=[t,...r],a=[],s=!1,i=!1,u=Symbol("budget-gate"),c=new Array(e.length);function d(){return e.every((p,_)=>p.check(c[_]))}function f(p){for(;a.length>0&&d();){let _=a[0];a=a.slice(1),p.emit(_)}a.length===0&&i&&(i=!1,p.down([[v]]))}return G([],(p,_)=>{for(let l=0;l<e.length;l++)c[l]=e[l].node.cache;let h=[];for(let l=0;l<o.length;l++){let m=o[l];h.push(m.subscribe(x=>{for(let E of x)b(E,l,_)}))}return()=>{for(let l of h)l()}},{...n,describeKind:"derived",meta:nn("budget_gate",n?.meta)});function b(p,_,h){let l=p[0];if(_===0){if(l===y)return d()&&a.length===0?h.emit(p[1]):(a.push(p[1]),s||(s=!0,h.up([[R,u]]))),!0;if(l===T)return h.down([[T]]),!0;if(l===v)return a.length===0?h.down([[v]]):i=!0,!0;if(l===w||l===g){for(let m of a)h.emit(m);return a=[],i=!1,s&&(s=!1,h.up([[C,u]])),h.down([p]),!0}return!1}return l===y&&(c[_-1]=p[1]),l===y||l===v?(d()&&a.length>0?(f(h),a.length===0&&s&&(s=!1,h.up([[C,u]]))):!d()&&!s&&a.length>0&&(s=!0,h.up([[R,u]])),!0):l===T?!0:l===g?(h.down([p]),!0):l===w}}function rn(t,e={}){let n=t;e.rateLimit!=null&&(n=dt(n,e.rateLimit)),e.budget!=null&&e.budget.length>0&&(n=gt(n,e.budget));let r;if(e.breaker!=null){let a=ut(e.breaker),s=e.breakerOnOpen??"skip",i=ct(a,{onOpen:s})(n);n=i.node,r=i.breakerState}if(e.timeoutMs!=null){if(e.timeoutMs<=0)throw new RangeError("timeoutMs must be > 0");if(e.timeoutMs>9e6)throw new RangeError("timeoutMs must be <= 9_000_000 (\u22482.5h) to stay within safe ns arithmetic");n=pt(n,e.timeoutMs*1e6)}e.retry!=null&&(n=it(n,e.retry)),e.fallback!==void 0&&(n=ft(n,e.fallback));let o=lt(n,{initialStatus:e.initialStatus??"pending"});return{node:o.node,status:o.status,error:o.error,breakerState:r}}0&&(module.exports={NS_PER_MS,NS_PER_SEC,resilientPipeline});
@@ -1,8 +1,8 @@
1
1
  import '../../node-fSc-hCv8.cjs';
2
2
  export { N as NS_PER_MS, c as NS_PER_SEC } from '../../resilience-BWP2c7Af.cjs';
3
- import '../../index-XxSeddWP.cjs';
4
- export { R as ResilientPipelineBundle, a as ResilientPipelineOptions, r as resilientPipeline } from '../../index-BsZlbHM5.cjs';
5
- import '../../graph-kTltt95s.cjs';
6
- import '../../meta-BGO6C7K9.cjs';
3
+ import '../../index-CpdnP-0y.cjs';
4
+ export { R as ResilientPipelineBundle, a as ResilientPipelineOptions, r as resilientPipeline } from '../../index-BhzwpIJc.cjs';
5
+ import '../../graph-CHsVwf9S.cjs';
6
+ import '../../meta-DreaEM_a.cjs';
7
7
  import '../../extra/storage-core.cjs';
8
8
  import '../../extra/storage-tiers.cjs';
@@ -1,8 +1,8 @@
1
1
  import '../../node-fSc-hCv8.js';
2
2
  export { N as NS_PER_MS, c as NS_PER_SEC } from '../../resilience-Bys63Cpd.js';
3
- import '../../index-DXSLMoma.js';
4
- export { R as ResilientPipelineBundle, a as ResilientPipelineOptions, r as resilientPipeline } from '../../index-DzYTXMBz.js';
5
- import '../../graph-Cv-8x0ZI.js';
6
- import '../../meta-CC6EPdpK.js';
3
+ import '../../index-DOU1Ee_k.js';
4
+ export { R as ResilientPipelineBundle, a as ResilientPipelineOptions, r as resilientPipeline } from '../../index-BsZk9T8y.js';
5
+ import '../../graph-BjW1taJl.js';
6
+ import '../../meta-BYqlATmg.js';
7
7
  import '../../extra/storage-core.js';
8
8
  import '../../extra/storage-tiers.js';
@@ -1 +1 @@
1
- import{a as c}from"../../chunk-TQSTS3BY.js";import"../../chunk-LO3LO2TO.js";import"../../chunk-O32GJOUJ.js";import"../../chunk-A5HZZYRK.js";import"../../chunk-TZQPPQEQ.js";import"../../chunk-5KPIYVCC.js";import"../../chunk-SGS4OJGS.js";import"../../chunk-ESMPEKEV.js";import"../../chunk-533RQFF6.js";import"../../chunk-JJTF75VS.js";import{a,b}from"../../chunk-4VVTGLXJ.js";import"../../chunk-MQZWA3DF.js";import"../../chunk-LYCLF26R.js";import"../../chunk-CK2E7BTU.js";import"../../chunk-QYADASLV.js";export{a as NS_PER_MS,b as NS_PER_SEC,c as resilientPipeline};
1
+ import{a as c}from"../../chunk-QEVSIVSF.js";import"../../chunk-XLMYQB6F.js";import"../../chunk-O32GJOUJ.js";import"../../chunk-XIMFHEKV.js";import"../../chunk-QMC2PLNM.js";import"../../chunk-SGS4OJGS.js";import"../../chunk-ESMPEKEV.js";import"../../chunk-6773HURD.js";import{a,b}from"../../chunk-4VVTGLXJ.js";import"../../chunk-DQJLC6YY.js";import"../../chunk-TZQPPQEQ.js";import"../../chunk-RZ5HKPGI.js";import"../../chunk-LYCLF26R.js";import"../../chunk-CK2E7BTU.js";import"../../chunk-QYADASLV.js";export{a as NS_PER_MS,b as NS_PER_SEC,c as resilientPipeline};