@graphrefly/graphrefly 0.38.0 → 0.40.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 (321) hide show
  1. package/dist/budget-gate-CmmVtasH.d.ts +115 -0
  2. package/dist/budget-gate-DiP_nK0n.d.cts +115 -0
  3. package/dist/{cascading-BsJ4GbnS.d.ts → cascading-BNfxffgc.d.ts} +2 -2
  4. package/dist/{cascading-B25wxpRa.d.cts → cascading-Cxs1eztH.d.cts} +2 -2
  5. package/dist/chunk-2BX4NB34.js +3 -0
  6. package/dist/{chunk-6VFC334U.js → chunk-2DMKW2AD.js} +1 -1
  7. package/dist/{chunk-4BDQXBXE.js → chunk-2QXRYP7Q.js} +1 -1
  8. package/dist/chunk-32N3JALT.js +1 -0
  9. package/dist/chunk-35JTVPOX.js +1 -0
  10. package/dist/chunk-3G5U5QNE.js +5 -0
  11. package/dist/{chunk-PHXZRR6C.js → chunk-4I45FVQS.js} +1 -1
  12. package/dist/{chunk-B5S7KTGP.js → chunk-6I726LZU.js} +1 -1
  13. package/dist/{chunk-NV63VQHI.js → chunk-6VWBPSSY.js} +1 -1
  14. package/dist/chunk-6XVD5TZV.js +1 -0
  15. package/dist/chunk-756D5TFD.js +1 -0
  16. package/dist/{chunk-DSOVKKTI.js → chunk-7Q4ZD3YW.js} +1 -1
  17. package/dist/{chunk-TMVY7OWG.js → chunk-B7LCDQEV.js} +1 -1
  18. package/dist/chunk-C72GO4IZ.js +1 -0
  19. package/dist/{chunk-RZ5HKPGI.js → chunk-CKFQS2CJ.js} +1 -1
  20. package/dist/chunk-D27JNOLZ.js +1 -0
  21. package/dist/chunk-ECQRP2UT.js +1 -0
  22. package/dist/{chunk-6773HURD.js → chunk-FHRBBHJN.js} +1 -1
  23. package/dist/{chunk-UVLZX2OU.js → chunk-I2DEVPMU.js} +1 -1
  24. package/dist/chunk-INQFTVZA.js +61 -0
  25. package/dist/{chunk-6KZZ6XQE.js → chunk-J63M5U46.js} +1 -1
  26. package/dist/{chunk-POCWFIJ7.js → chunk-JKBOIJ22.js} +1 -1
  27. package/dist/chunk-K2Z7UENB.js +1 -0
  28. package/dist/chunk-L6NSJVJZ.js +1 -0
  29. package/dist/{chunk-K5C67OGE.js → chunk-LCGAVGGV.js} +2 -2
  30. package/dist/chunk-LYM4PBMV.js +1 -0
  31. package/dist/{chunk-O2BLVQU4.js → chunk-MNZIKXK4.js} +1 -1
  32. package/dist/chunk-N43XM7BM.js +1 -0
  33. package/dist/{chunk-FWGIZP3W.js → chunk-OSZ22J7O.js} +1 -1
  34. package/dist/{chunk-FAYEMS5M.js → chunk-PPUYQ66A.js} +1 -1
  35. package/dist/{chunk-SP5O2MIX.js → chunk-QSK3RRII.js} +1 -1
  36. package/dist/chunk-RZJDIV2G.js +1 -0
  37. package/dist/chunk-SSCGRYJ2.js +1 -0
  38. package/dist/chunk-SVFKHUCW.js +1 -0
  39. package/dist/chunk-TSOYJ743.js +1 -0
  40. package/dist/{chunk-O245YLM5.js → chunk-UWA6D7UF.js} +1 -1
  41. package/dist/chunk-VMF23LGB.js +1 -0
  42. package/dist/chunk-WL6LFPJB.js +1 -0
  43. package/dist/chunk-WUT362QV.js +1 -0
  44. package/dist/chunk-XJLYLLIJ.js +1 -0
  45. package/dist/{chunk-IBGE62GZ.js → chunk-XW4YDF6G.js} +1 -1
  46. package/dist/chunk-YKD7WUYJ.js +43 -0
  47. package/dist/{chunk-7KZZLWZ6.js → chunk-YXDRGKXP.js} +1 -1
  48. package/dist/chunk-Z4F3DOWS.js +84 -0
  49. package/dist/compat/index.cjs +9 -13
  50. package/dist/compat/index.d.cts +16 -16
  51. package/dist/compat/index.d.ts +16 -16
  52. package/dist/compat/index.js +1 -1
  53. package/dist/compat/jotai/index.d.cts +2 -2
  54. package/dist/compat/jotai/index.d.ts +2 -2
  55. package/dist/compat/nanostores/index.d.cts +2 -2
  56. package/dist/compat/nanostores/index.d.ts +2 -2
  57. package/dist/compat/nestjs/index.cjs +7 -11
  58. package/dist/compat/nestjs/index.d.cts +8 -8
  59. package/dist/compat/nestjs/index.d.ts +8 -8
  60. package/dist/compat/nestjs/index.js +1 -1
  61. package/dist/compat/react/index.d.cts +2 -2
  62. package/dist/compat/react/index.d.ts +2 -2
  63. package/dist/compat/solid/index.d.cts +2 -2
  64. package/dist/compat/solid/index.d.ts +2 -2
  65. package/dist/compat/svelte/index.d.cts +2 -2
  66. package/dist/compat/svelte/index.d.ts +2 -2
  67. package/dist/compat/vue/index.d.cts +2 -2
  68. package/dist/compat/vue/index.d.ts +2 -2
  69. package/dist/compat/zustand/index.cjs +3 -7
  70. package/dist/compat/zustand/index.d.cts +4 -4
  71. package/dist/compat/zustand/index.d.ts +4 -4
  72. package/dist/compat/zustand/index.js +1 -1
  73. package/dist/core/index.cjs +1 -1
  74. package/dist/core/index.d.cts +4 -4
  75. package/dist/core/index.d.ts +4 -4
  76. package/dist/core/index.js +1 -1
  77. package/dist/{composite-DTOlDuch.d.ts → decay-BnrlbxSv.d.ts} +39 -3
  78. package/dist/{composite-CgG0MqHm.d.cts → decay-C25AyNAj.d.cts} +39 -3
  79. package/dist/extra/browser.d.cts +1 -1
  80. package/dist/extra/browser.d.ts +1 -1
  81. package/dist/extra/index.cjs +16 -20
  82. package/dist/extra/index.d.cts +11 -9
  83. package/dist/extra/index.d.ts +11 -9
  84. package/dist/extra/index.js +1 -1
  85. package/dist/extra/node.cjs +2 -2
  86. package/dist/extra/node.d.cts +1 -1
  87. package/dist/extra/node.d.ts +1 -1
  88. package/dist/extra/node.js +1 -1
  89. package/dist/extra/operators.cjs +1 -1
  90. package/dist/extra/operators.d.cts +1 -1
  91. package/dist/extra/operators.d.ts +1 -1
  92. package/dist/extra/operators.js +1 -1
  93. package/dist/extra/reactive.cjs +1 -1
  94. package/dist/extra/reactive.d.cts +3 -3
  95. package/dist/extra/reactive.d.ts +3 -3
  96. package/dist/extra/reactive.js +1 -1
  97. package/dist/extra/render/index.cjs +5 -0
  98. package/dist/extra/render/index.d.cts +183 -0
  99. package/dist/extra/render/index.d.ts +183 -0
  100. package/dist/extra/render/index.js +1 -0
  101. package/dist/extra/sources.cjs +1 -1
  102. package/dist/extra/sources.d.cts +1 -1
  103. package/dist/extra/sources.d.ts +1 -1
  104. package/dist/extra/sources.js +1 -1
  105. package/dist/extra/storage-browser.d.cts +1 -1
  106. package/dist/extra/storage-browser.d.ts +1 -1
  107. package/dist/{fallback-axI2cXwt.d.cts → fallback-8JYU8tlT.d.cts} +1 -1
  108. package/dist/{fallback-DuEXfA4F.d.ts → fallback-CMZl39L5.d.ts} +1 -1
  109. package/dist/graph/index.cjs +7 -7
  110. package/dist/graph/index.d.cts +5 -5
  111. package/dist/graph/index.d.ts +5 -5
  112. package/dist/graph/index.js +1 -1
  113. package/dist/{graph-BjW1taJl.d.ts → graph-BkIkog4h.d.ts} +76 -100
  114. package/dist/{graph-CHsVwf9S.d.cts → graph-E6likq7w.d.cts} +76 -100
  115. package/dist/{index-CIcu6fIR.d.ts → index-2n8Eai6M.d.ts} +1 -1
  116. package/dist/{index-BwOsJfLJ.d.ts → index-3k4Gg6-n.d.ts} +3 -3
  117. package/dist/{index-BUFCHvOR.d.ts → index-40ZT4MHj.d.ts} +3 -3
  118. package/dist/index-8s-Qm-gz.d.ts +218 -0
  119. package/dist/index-A3U3CSve.d.cts +113 -0
  120. package/dist/{index-CDvC1m5p.d.ts → index-B2RUoIUz.d.ts} +1 -1
  121. package/dist/{index-Byp771zP.d.ts → index-B6iTqKtJ.d.ts} +2 -2
  122. package/dist/{index-D-B7U42V.d.cts → index-B72TQQHd.d.cts} +2 -2
  123. package/dist/{resilience-Bys63Cpd.d.ts → index-BAQrjuZF.d.ts} +202 -26
  124. package/dist/{index-BiomL7AW.d.ts → index-BJSZxSFX.d.ts} +1 -1
  125. package/dist/index-BQ1fR4li.d.ts +210 -0
  126. package/dist/{index-D7-RSD93.d.cts → index-BTHOTC0Q.d.cts} +4 -4
  127. package/dist/{index-CEVzBWeB.d.ts → index-BaA-xpSw.d.ts} +26 -19
  128. package/dist/{index-CAV-3RpJ.d.cts → index-Bd91Nmf4.d.cts} +4 -4
  129. package/dist/{index-BI1wMfyc.d.ts → index-BgjS2b8N.d.ts} +3 -3
  130. package/dist/{index-Bpr0Pwgl.d.cts → index-BiHUBEKq.d.cts} +3 -3
  131. package/dist/{index-UsU9ptzs.d.cts → index-BilOa6AE.d.cts} +55 -9
  132. package/dist/{index-DJVQ-t07.d.ts → index-BmSQLAZo.d.cts} +41 -48
  133. package/dist/{index-DTDVDzhA.d.ts → index-C-dkXOpB.d.cts} +56 -54
  134. package/dist/{index-B-ORMr3k.d.ts → index-C5cQ7Gfx.d.ts} +4 -4
  135. package/dist/{index-ML6vHKXK.d.ts → index-C6ZUaos7.d.ts} +1 -1
  136. package/dist/{index-Vz7KPfgz.d.ts → index-CAP3UGsq.d.ts} +1 -1
  137. package/dist/{index-BFaALJxR.d.ts → index-CD2dBMet.d.ts} +10 -8
  138. package/dist/index-CGhMJNHb.d.cts +128 -0
  139. package/dist/{index-B3D_z0Z6.d.cts → index-CL7oilfm.d.cts} +1 -1
  140. package/dist/{index-Bn0uZEL4.d.ts → index-CQtWm7jS.d.ts} +9 -9
  141. package/dist/{index-CM-i58FY.d.cts → index-CRm0YIzC.d.cts} +9 -9
  142. package/dist/index-CUIkE1l9.d.cts +230 -0
  143. package/dist/{index-CijfwEWx.d.ts → index-Cczxgd2D.d.ts} +2 -2
  144. package/dist/{index-CAbHN_rP.d.cts → index-CgnCFhr2.d.cts} +1 -1
  145. package/dist/{index-B2IUcH13.d.cts → index-Ck35nA-T.d.ts} +41 -48
  146. package/dist/{index-BpMZzX9P.d.cts → index-Cnr1WrlX.d.cts} +3 -3
  147. package/dist/{index-JYtN9uqM.d.ts → index-CoM4rzyB.d.ts} +1 -1
  148. package/dist/{index-Ckil6miL.d.cts → index-CtFNGe-m.d.cts} +2 -2
  149. package/dist/{index-BjWZARLy.d.ts → index-Ctb7_2sG.d.ts} +1 -1
  150. package/dist/index-CuPUehFa.d.cts +218 -0
  151. package/dist/index-D1Gc7wV5.d.ts +230 -0
  152. package/dist/{index-DqICM_I7.d.ts → index-D1IEZUsj.d.ts} +67 -9
  153. package/dist/{index-BFuVcqL8.d.cts → index-D3ayz3hy.d.cts} +1 -1
  154. package/dist/{index-CQsqqEVz.d.cts → index-D4uimgee.d.cts} +1 -1
  155. package/dist/{resilience-BWP2c7Af.d.cts → index-DGTo1yka.d.cts} +202 -26
  156. package/dist/{index-BmWuVdER.d.ts → index-DH4fm2Ck.d.ts} +2 -2
  157. package/dist/{index-BkQqf1EF.d.cts → index-DJ_MPOJ5.d.cts} +67 -9
  158. package/dist/{index-9xhIaM-w.d.cts → index-DOBLxOti.d.cts} +1 -1
  159. package/dist/{index-BqcgiSQg.d.cts → index-DQQCOIt8.d.cts} +10 -8
  160. package/dist/{index-DJNAWzcH.d.cts → index-DVAlsmEU.d.cts} +26 -19
  161. package/dist/index-DVDapw2k.d.cts +210 -0
  162. package/dist/{index-D_QQ_dTD.d.cts → index-DYTBbF8T.d.cts} +1 -1
  163. package/dist/{index-BgzPO43H.d.cts → index-DgJc8Zgc.d.cts} +6 -6
  164. package/dist/{index-Czk3r0yA.d.cts → index-DhLyOHYZ.d.ts} +56 -54
  165. package/dist/{index-CrlHFsiT.d.ts → index-DhnsQfa3.d.ts} +100 -118
  166. package/dist/{index-Bub6x_D4.d.cts → index-DktLSZOc.d.cts} +37 -90
  167. package/dist/{index-BaSy4L6w.d.cts → index-DpiGqtrs.d.cts} +100 -118
  168. package/dist/{index-D-HZ7sP4.d.ts → index-I1cCY3ZI.d.ts} +6 -6
  169. package/dist/{index-D9vBTuzo.d.ts → index-IUCY0OFN.d.ts} +4 -4
  170. package/dist/{index-DeSsvHDD.d.cts → index-MxYuWOrf.d.cts} +3 -3
  171. package/dist/index-N2MAxt7_.d.ts +128 -0
  172. package/dist/{index-CpZKtdMw.d.cts → index-PgwvGWa1.d.cts} +1 -1
  173. package/dist/{index-AUqWe_fX.d.ts → index-WSlcjhQF.d.ts} +55 -9
  174. package/dist/{index-Di7OdwlO.d.ts → index-bXXLSvor.d.ts} +37 -90
  175. package/dist/index-da2V5vPy.d.ts +113 -0
  176. package/dist/{index-DY2f2b9z.d.ts → index-eaQuGJnv.d.ts} +3 -3
  177. package/dist/{index-BsgxnHN8.d.cts → index-t6L2qpHh.d.cts} +3 -3
  178. package/dist/{index-C-3UXnHT.d.cts → index-tV3AA9hI.d.cts} +2 -2
  179. package/dist/{index-8OxXae3g.d.ts → index-yLt-aPMp.d.ts} +1 -1
  180. package/dist/{index-CqSJ25A9.d.cts → index-z8WFPVI8.d.cts} +1 -1
  181. package/dist/index.cjs +63 -59
  182. package/dist/index.d.cts +48 -47
  183. package/dist/index.d.ts +48 -47
  184. package/dist/index.js +1 -1
  185. package/dist/{meta-DreaEM_a.d.cts → meta-Ct9nqQS5.d.cts} +11 -7
  186. package/dist/{meta-BYqlATmg.d.ts → meta-D8OyedKp.d.ts} +11 -7
  187. package/dist/{node-fSc-hCv8.d.cts → node-BYInONRr.d.cts} +3 -3
  188. package/dist/{node-fSc-hCv8.d.ts → node-BYInONRr.d.ts} +3 -3
  189. package/dist/{observable-Cqty11jG.d.cts → observable-DMIlYJV1.d.cts} +1 -1
  190. package/dist/{observable-EAV_rNfM.d.ts → observable-DO8DDEzv.d.ts} +1 -1
  191. package/dist/patterns/ai/browser.cjs +5 -5
  192. package/dist/patterns/ai/browser.d.cts +4 -4
  193. package/dist/patterns/ai/browser.d.ts +4 -4
  194. package/dist/patterns/ai/browser.js +1 -1
  195. package/dist/patterns/ai/index.cjs +16 -20
  196. package/dist/patterns/ai/index.d.cts +17 -17
  197. package/dist/patterns/ai/index.d.ts +17 -17
  198. package/dist/patterns/ai/index.js +1 -1
  199. package/dist/patterns/ai/node.cjs +1 -1
  200. package/dist/patterns/ai/node.d.cts +4 -4
  201. package/dist/patterns/ai/node.d.ts +4 -4
  202. package/dist/patterns/ai/node.js +1 -1
  203. package/dist/patterns/audit/index.cjs +3 -7
  204. package/dist/patterns/audit/index.d.cts +6 -6
  205. package/dist/patterns/audit/index.d.ts +6 -6
  206. package/dist/patterns/audit/index.js +1 -1
  207. package/dist/patterns/cqrs/index.cjs +3 -7
  208. package/dist/patterns/cqrs/index.d.cts +6 -6
  209. package/dist/patterns/cqrs/index.d.ts +6 -6
  210. package/dist/patterns/cqrs/index.js +1 -1
  211. package/dist/patterns/demo-shell/index.cjs +5 -8
  212. package/dist/patterns/demo-shell/index.d.cts +5 -5
  213. package/dist/patterns/demo-shell/index.d.ts +5 -5
  214. package/dist/patterns/demo-shell/index.js +1 -1
  215. package/dist/patterns/domain-templates/index.cjs +3 -7
  216. package/dist/patterns/domain-templates/index.d.cts +4 -4
  217. package/dist/patterns/domain-templates/index.d.ts +4 -4
  218. package/dist/patterns/domain-templates/index.js +1 -1
  219. package/dist/patterns/graphspec/index.cjs +37 -37
  220. package/dist/patterns/graphspec/index.d.cts +5 -5
  221. package/dist/patterns/graphspec/index.d.ts +5 -5
  222. package/dist/patterns/graphspec/index.js +1 -1
  223. package/dist/patterns/guarded-execution/index.cjs +3 -7
  224. package/dist/patterns/guarded-execution/index.d.cts +7 -7
  225. package/dist/patterns/guarded-execution/index.d.ts +7 -7
  226. package/dist/patterns/guarded-execution/index.js +1 -1
  227. package/dist/patterns/harness/index.cjs +8 -12
  228. package/dist/patterns/harness/index.d.cts +12 -12
  229. package/dist/patterns/harness/index.d.ts +12 -12
  230. package/dist/patterns/harness/index.js +1 -1
  231. package/dist/patterns/job-queue/index.cjs +3 -7
  232. package/dist/patterns/job-queue/index.d.cts +6 -6
  233. package/dist/patterns/job-queue/index.d.ts +6 -6
  234. package/dist/patterns/job-queue/index.js +1 -1
  235. package/dist/patterns/lens/index.cjs +3 -7
  236. package/dist/patterns/lens/index.d.cts +5 -6
  237. package/dist/patterns/lens/index.d.ts +5 -6
  238. package/dist/patterns/lens/index.js +1 -1
  239. package/dist/patterns/memory/index.cjs +3 -7
  240. package/dist/patterns/memory/index.d.cts +6 -6
  241. package/dist/patterns/memory/index.d.ts +6 -6
  242. package/dist/patterns/memory/index.js +1 -1
  243. package/dist/patterns/messaging/index.cjs +3 -7
  244. package/dist/patterns/messaging/index.d.cts +5 -5
  245. package/dist/patterns/messaging/index.d.ts +5 -5
  246. package/dist/patterns/messaging/index.js +1 -1
  247. package/dist/patterns/orchestration/index.cjs +3 -7
  248. package/dist/patterns/orchestration/index.d.cts +8 -8
  249. package/dist/patterns/orchestration/index.d.ts +8 -8
  250. package/dist/patterns/orchestration/index.js +1 -1
  251. package/dist/patterns/process/index.cjs +1 -1
  252. package/dist/patterns/process/index.d.cts +7 -7
  253. package/dist/patterns/process/index.d.ts +7 -7
  254. package/dist/patterns/process/index.js +1 -1
  255. package/dist/patterns/reactive-layout/index.cjs +4 -8
  256. package/dist/patterns/reactive-layout/index.d.cts +5 -5
  257. package/dist/patterns/reactive-layout/index.d.ts +5 -5
  258. package/dist/patterns/reactive-layout/index.js +1 -1
  259. package/dist/patterns/reduction/index.cjs +3 -7
  260. package/dist/patterns/reduction/index.d.cts +4 -4
  261. package/dist/patterns/reduction/index.d.ts +4 -4
  262. package/dist/patterns/reduction/index.js +1 -1
  263. package/dist/patterns/refine-loop/index.cjs +5 -9
  264. package/dist/patterns/refine-loop/index.d.cts +6 -6
  265. package/dist/patterns/refine-loop/index.d.ts +6 -6
  266. package/dist/patterns/refine-loop/index.js +1 -1
  267. package/dist/patterns/resilient-pipeline/index.cjs +3 -1
  268. package/dist/patterns/resilient-pipeline/index.d.cts +6 -6
  269. package/dist/patterns/resilient-pipeline/index.d.ts +6 -6
  270. package/dist/patterns/resilient-pipeline/index.js +1 -1
  271. package/dist/patterns/surface/index.cjs +12 -16
  272. package/dist/patterns/surface/index.d.cts +6 -6
  273. package/dist/patterns/surface/index.d.ts +6 -6
  274. package/dist/patterns/surface/index.js +1 -1
  275. package/dist/{pipeline-graph-9JBbmRxA.d.ts → pipeline-graph-CB4La-UW.d.ts} +34 -17
  276. package/dist/{pipeline-graph-DuHpXSOn.d.cts → pipeline-graph-MWrQZXCq.d.cts} +34 -17
  277. package/dist/{reactive-layout-BMLDB4Vd.d.cts → reactive-layout-BtZfUKuL.d.cts} +2 -2
  278. package/dist/{reactive-layout-D-tRiNhg.d.ts → reactive-layout-KJj4E2dT.d.ts} +2 -2
  279. package/dist/{reactive-log-BgWSA1fg.d.ts → reactive-log-BlAsPLl2.d.ts} +2 -2
  280. package/dist/{reactive-log-C3IMAGpT.d.cts → reactive-log-_zeEnB9H.d.cts} +2 -2
  281. package/dist/{reactive-map-DmgeADH8.d.cts → reactive-map-6P_k3AQM.d.cts} +2 -2
  282. package/dist/{reactive-map-CHyeCf4D.d.ts → reactive-map-CjXByDV-.d.ts} +2 -2
  283. package/dist/resilience-S33JV6XC.js +1 -0
  284. package/dist/{sugar-D13E2M_z.d.ts → sugar-BhfjgetH.d.ts} +1 -1
  285. package/dist/{sugar-DgaGJcI6.d.cts → sugar-DzePN5-g.d.cts} +1 -1
  286. package/dist/{topology-tree-jrZue3ao.d.cts → topology-tree-3LBKFsUo.d.cts} +1 -1
  287. package/dist/{topology-tree-D47-nI6Z.d.ts → topology-tree-mF7Emqzm.d.ts} +1 -1
  288. package/dist/{types-BMSGPlpO.d.cts → types-1Dhoi7HM.d.cts} +1 -1
  289. package/dist/{types-CidcBDuk.d.ts → types-39jk0kaV.d.ts} +1 -1
  290. package/package.json +11 -1
  291. package/dist/chunk-2YFDSYEF.js +0 -1
  292. package/dist/chunk-5BGFS2XH.js +0 -1
  293. package/dist/chunk-CMTN3KPT.js +0 -80
  294. package/dist/chunk-DQJLC6YY.js +0 -1
  295. package/dist/chunk-G7JN6LCB.js +0 -1
  296. package/dist/chunk-KJEAIIIY.js +0 -43
  297. package/dist/chunk-LV3ACS5J.js +0 -1
  298. package/dist/chunk-NBGPXQSP.js +0 -1
  299. package/dist/chunk-NN3QPJ6U.js +0 -1
  300. package/dist/chunk-NSAZ6PR6.js +0 -1
  301. package/dist/chunk-O32GJOUJ.js +0 -1
  302. package/dist/chunk-QEVSIVSF.js +0 -1
  303. package/dist/chunk-QMC2PLNM.js +0 -7
  304. package/dist/chunk-QOJFR6GS.js +0 -1
  305. package/dist/chunk-SFK7MN7S.js +0 -1
  306. package/dist/chunk-TB7JKSVS.js +0 -61
  307. package/dist/chunk-UAXFKMAG.js +0 -1
  308. package/dist/chunk-XIMFHEKV.js +0 -1
  309. package/dist/chunk-XLMYQB6F.js +0 -1
  310. package/dist/chunk-XLYF4LBH.js +0 -1
  311. package/dist/imperative-audit-ahAE65a9.d.cts +0 -28
  312. package/dist/imperative-audit-ahAE65a9.d.ts +0 -28
  313. package/dist/index-5dNRlW7J.d.ts +0 -135
  314. package/dist/index-BWUMIt7J.d.cts +0 -135
  315. package/dist/index-BhzwpIJc.d.cts +0 -105
  316. package/dist/index-BsZk9T8y.d.ts +0 -105
  317. package/dist/index-C56XZiDe.d.cts +0 -163
  318. package/dist/index-CpdnP-0y.d.cts +0 -186
  319. package/dist/index-DKrIuF-r.d.ts +0 -163
  320. package/dist/index-DOU1Ee_k.d.ts +0 -186
  321. package/dist/resilience-LGBK236C.js +0 -1
@@ -1,9 +1,9 @@
1
- import '../../node-fSc-hCv8.js';
1
+ import '../../node-BYInONRr.js';
2
2
  import '../../extra/sources.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';
3
+ import '../../graph-BkIkog4h.js';
4
+ import '../../index-40ZT4MHj.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-BgjS2b8N.js';
6
+ import '../../meta-D8OyedKp.js';
7
7
  import '../../extra/storage-core.js';
8
8
  import '../../extra/storage-tiers.js';
9
- import '../../reactive-log-BgWSA1fg.js';
9
+ import '../../reactive-log-BlAsPLl2.js';
@@ -1 +1 @@
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
+ import{a,b,c}from"../../chunk-UWA6D7UF.js";import"../../chunk-J63M5U46.js";import"../../chunk-ECQRP2UT.js";import"../../chunk-3G5U5QNE.js";import"../../chunk-C72GO4IZ.js";import"../../chunk-4I45FVQS.js";import"../../chunk-L6NSJVJZ.js";import"../../chunk-2BX4NB34.js";import"../../chunk-SGS4OJGS.js";import"../../chunk-ESMPEKEV.js";import"../../chunk-FHRBBHJN.js";import"../../chunk-4VVTGLXJ.js";import"../../chunk-35JTVPOX.js";import"../../chunk-YXDRGKXP.js";import"../../chunk-CKFQS2CJ.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,3 @@
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
+ "use strict";var it=Object.defineProperty;var Fn=Object.getOwnPropertyDescriptor;var Bn=Object.getOwnPropertyNames;var Vn=Object.prototype.hasOwnProperty;var B=(n,e)=>()=>(n&&(e=n(n=0)),e);var jn=(n,e)=>{for(var t in e)it(n,t,{get:e[t],enumerable:!0})},zn=(n,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of Bn(e))!Vn.call(n,o)&&o!==t&&it(n,o,{get:()=>e[o],enumerable:!(r=Fn(e,o))||r.enumerable});return n};var Un=n=>zn(it({},"__esModule",{value:!0}),n);function at(n){let e=Wn.filter(t=>n({type:t,id:""},"write"));return e.length===0?"restricted":e.includes("human")&&e.includes("llm")&&e.every(t=>t==="human"||t==="llm"||t==="system")?"both":e.length===1?e[0]:e.join("+")}var J,Wn,Ie=B(()=>{"use strict";J=class extends Error{actor;action;nodeName;constructor(e,t){super(t??`GuardDenied: action "${String(e.action)}" denied for actor type "${String(e.actor.type)}"`),this.name="GuardDenied",this.actor=e.actor,this.action=e.action,this.nodeName=e.nodeName}get node(){return this.nodeName}},Wn=["human","llm","wallet","system"]});function Yt(n,e){let t=new TextEncoder().encode(n.name);if(t.length===0||t.length>255)throw new Error(`encodeEnvelope: codec name "${n.name}" encodes to ${t.length} bytes (must be 1\u2013255)`);let r=n.version;if(!Number.isInteger(r)||r<0||r>65535)throw new Error(`encodeEnvelope: codec.version ${r} out of u16 range (expected integer 0\u201365535)`);let o=2+t.length+2+e.length;if(o>4294967295)throw new Error(`encodeEnvelope: total envelope size ${o} exceeds 2^32-1 bytes (payload ${e.length} bytes)`);let s=new Uint8Array(o),i=0;return s[i++]=ut,s[i++]=t.length,s.set(t,i),i+=t.length,s[i++]=r>>>8&255,s[i++]=r&255,s.set(e,i),s}function Jt(n,e){if(n.length<qt)throw new Error(`decodeEnvelope: bytes too short (${n.length} < ${qt})`);let t=0,r=n[t++];if(r!==ut)throw new Error(`decodeEnvelope: unsupported envelope version ${r} (expected ${ut})`);let o=n[t++];if(o===0)throw new Error("decodeEnvelope: name_len must be >= 1");if(t+o+2>n.length)throw new Error(`decodeEnvelope: envelope truncated (need ${t+o+2} bytes, have ${n.length})`);let s=new TextDecoder().decode(n.subarray(t,t+o));t+=o;let i=(n[t]<<8|n[t+1])>>>0;t+=2;let a=n.subarray(t),d=e.lookupCodec(s);if(d==null)throw new Error(`decodeEnvelope: codec "${s}" not registered (envelope codec_v=${i})`);return{codec:d,codecVersion:i,payload:a}}function Zt(n){n.registerCodec(Hn)}var Hn,ut,qt,dt=B(()=>{"use strict";Hn={name:"json",version:1,contentType:"application/json",encode(n){let e=JSON.stringify(n);return new TextEncoder().encode(e)},decode(n,e){let t=new TextDecoder().decode(n);return JSON.parse(t)}},ut=1,qt=4});function Le(n){if(n==null)return ye;let{type:e,id:t,...r}=n;return{type:e??"system",id:t??"",...r}}var ye,ct=B(()=>{"use strict";ye={type:"system",id:""}});function $e(){return ve>0||Re}function Xt(){return ve>0}function Te(n){ve>0?Se.push(n):n()}function Ce(n){ve+=1;let e=!1;try{n()}catch(t){throw e=!0,t}finally{if(ve-=1,ve===0)if(e){if(!Re){let t=Se.splice(0);for(let r of t)try{r()}catch{}de.length=0,ce.length=0,we.length=0}}else Kn()}}function Kn(){let n=!Re;n&&(Re=!0);let e=[],t=0;try{for(;de.length>0||ce.length>0||we.length>0||n&&Se.length>0;){if(n&&Se.length>0){let s=Se.splice(0);for(let i of s)try{i()}catch(a){e.push(a)}continue}if(t+=1,t>1e3)throw de.length=0,ce.length=0,we.length=0,new Error("batch drain exceeded 1000 iterations \u2014 likely a reactive cycle");let o=(de.length>0?de:ce.length>0?ce:we).splice(0);for(let s of o)try{s()}catch(i){e.push(i)}}}finally{n&&(Re=!1)}if(e.length===1)throw e[0];if(e.length>1)throw new AggregateError(e,"batch drain: multiple callbacks threw")}function Fe(n,e,t){if(e.length===0)return;if(e.length===1){let u=t(e[0][0]);if(u<3||!$e()){n(e);return}(u>=5?we:u===4?ce:de).push(()=>n(e));return}let r=e.length,o=r,s=r,i=r,a=0;for(;a<r&&t(e[a][0])<3;)a++;for(o=a;a<r&&t(e[a][0])===3;)a++;for(s=a;a<r&&t(e[a][0])===4;)a++;i=a;let d=$e();if(o>0){let u=e.slice(0,o);n(u)}if(s>o){let u=e.slice(o,s);d?de.push(()=>n(u)):n(u)}if(i>s){let u=e.slice(s,i);d?ce.push(()=>n(u)):n(u)}if(r>i){let u=e.slice(i,r);d?we.push(()=>n(u)):n(u)}}var ve,Re,de,ce,we,Se,Be=B(()=>{"use strict";ve=0,Re=!1,de=[],ce=[],we=[],Se=[]});function Z(){return Math.trunc(performance.now()*1e6)}function Ve(){return Date.now()*1e6}var Ae=B(()=>{"use strict"});var oe,R,M,D,ee,H,te,$,S,k,_e,lt,qn,ft,Yn,Jn,pt,Qt,en,tn,ht,se=B(()=>{"use strict";oe=Symbol.for("graphrefly/START"),R=Symbol.for("graphrefly/DATA"),M=Symbol.for("graphrefly/DIRTY"),D=Symbol.for("graphrefly/RESOLVED"),ee=Symbol.for("graphrefly/INVALIDATE"),H=Symbol.for("graphrefly/PAUSE"),te=Symbol.for("graphrefly/RESUME"),$=Symbol.for("graphrefly/TEARDOWN"),S=Symbol.for("graphrefly/COMPLETE"),k=Symbol.for("graphrefly/ERROR"),_e=Object.freeze([M]),lt=Object.freeze([D]),qn=Object.freeze([ee]),ft=Object.freeze([oe]),Yn=Object.freeze([S]),Jn=Object.freeze([$]),pt=Object.freeze([_e]),Qt=Object.freeze([lt]),en=Object.freeze([qn]),tn=Object.freeze([Yn]),ht=Object.freeze([Jn])});function nn(n){n.registerMessageType(oe,{tier:0,wireCrossing:!1}),n.registerMessageType(M,{tier:1,wireCrossing:!1}),n.registerMessageType(ee,{tier:1,wireCrossing:!1,metaPassthrough:!1}),n.registerMessageType(H,{tier:2,wireCrossing:!1}),n.registerMessageType(te,{tier:2,wireCrossing:!1}),n.registerMessageType(R,{tier:3,wireCrossing:!0}),n.registerMessageType(D,{tier:3,wireCrossing:!0}),n.registerMessageType(S,{tier:4,wireCrossing:!0,metaPassthrough:!1}),n.registerMessageType(k,{tier:4,wireCrossing:!0,metaPassthrough:!1}),n.registerMessageType($,{tier:5,wireCrossing:!0,metaPassthrough:!1})}var je,rn=B(()=>{"use strict";se();je=class{_messageTypes=new Map;_codecs=new Map;_onMessage;_onSubscribe;_defaultVersioning;_defaultHashFn;_inspectorEnabled=!(typeof process<"u"&&process.env?.NODE_ENV==="production");_globalInspector;_rigorRecorder;_frozen=!1;tierOf;constructor(e){this._onMessage=e.onMessage,this._onSubscribe=e.onSubscribe,this._defaultVersioning=e.defaultVersioning,this._defaultHashFn=e.defaultHashFn,this.tierOf=t=>{let r=this._messageTypes.get(t);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,t){return this._assertUnfrozen(),this._messageTypes.set(e,{tier:t.tier,wireCrossing:t.wireCrossing??t.tier>=3,metaPassthrough:t.metaPassthrough??!0}),this}messageTier(e){let t=this._messageTypes.get(e);return t!=null?t.tier:1}isWireCrossing(e){let t=this._messageTypes.get(e);return t!=null?t.wireCrossing:!0}isLocalOnly(e){return!this.isWireCrossing(e)}isMetaPassthrough(e){let t=this._messageTypes.get(e);return t!=null?t.metaPassthrough:!0}isKnownMessageType(e){return this._messageTypes.has(e)}registerCodec(e){return this._assertUnfrozen(),this._codecs.set(e.name,e),this}lookupCodec(e){return this._codecs.get(e)}_isFrozen(){return this._frozen}_assertUnfrozen(){if(this._frozen)throw new Error("GraphReFlyConfig is frozen: a node has already captured this config. Register custom types and set hooks before creating any node.")}}});function mt(n){if(n===void 0)return null;if(typeof n=="number"){if(!Number.isFinite(n))throw new TypeError(`Cannot hash non-finite number: ${n}`);if(Number.isInteger(n)&&!Number.isSafeInteger(n))throw new TypeError(`Cannot hash integer outside safe range (|n| > 2^53-1): ${n}. Cross-language cid parity is not guaranteed for unsafe integers.`);return n}if(typeof n=="string"||typeof n=="boolean"||n===null)return n;if(Array.isArray(n))return n.map(mt);if(typeof n=="object"&&n!==null){let e={};for(let t of Object.keys(n).sort())e[t]=mt(n[t]);return e}return null}function Qn(n){let e=Xn.encode(n),t=e.length,r=t*8,o=t+9+63&-64,s=new Uint8Array(o);s.set(e),s[t]=128;let i=new DataView(s.buffer);i.setUint32(o-4,r>>>0,!1),i.setUint32(o-8,Math.floor(r/4294967296)>>>0,!1);let a=1779033703,d=3144134277,u=1013904242,c=2773480762,f=1359893119,m=2600822924,p=528734635,l=1541459225,g=new Uint32Array(64),h=(y,b)=>y>>>b|y<<32-b;for(let y=0;y<o;y+=64){for(let O=0;O<16;O++)g[O]=i.getUint32(y+O*4,!1);for(let O=16;O<64;O++){let z=g[O-15],F=g[O-2],P=h(z,7)^h(z,18)^z>>>3,be=h(F,17)^h(F,19)^F>>>10;g[O]=g[O-16]+P+g[O-7]+be>>>0}let b=a,v=d,w=u,_=c,x=f,E=m,C=p,A=l;for(let O=0;O<64;O++){let z=h(x,6)^h(x,11)^h(x,25),F=x&E^~x&C,P=A+z+F+Zn[O]+g[O]>>>0,be=h(b,2)^h(b,13)^h(b,22),tt=b&v^b&w^v&w,Ge=be+tt>>>0;A=C,C=E,E=x,x=_+P>>>0,_=w,w=v,v=b,b=P+Ge>>>0}a=a+b>>>0,d=d+v>>>0,u=u+w>>>0,c=c+_>>>0,f=f+x>>>0,m=m+E>>>0,p=p+C>>>0,l=l+A>>>0}let T=y=>y.toString(16).padStart(8,"0");return T(a)+T(d)+T(u)+T(c)+T(f)+T(m)+T(p)+T(l)}function gt(n){let e=mt(n??null),t=JSON.stringify(e);return Qn(t).slice(0,16)}function er(){let n=globalThis.crypto;if(n?.randomUUID)return n.randomUUID();let e=()=>Math.floor(Math.random()*4294967296).toString(16).padStart(8,"0"),t=e()+e()+e()+e();return`${t.slice(0,8)}-${t.slice(8,12)}-4${t.slice(13,16)}-${(parseInt(t.slice(16,17),16)&3|8).toString(16)}${t.slice(17,20)}-${t.slice(20,32)}`}function bt(n,e,t){let r=t?.id??er();if(n===0)return{id:r,version:0};let s=(t?.hash??gt)(e);return{id:r,version:0,cid:s,prev:null}}function on(n,e,t){n.version+=1,"cid"in n&&(n.prev=n.cid,n.cid=t(e))}var Zn,Xn,sn=B(()=>{"use strict";Zn=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]),Xn=new TextEncoder});function dn(n){return{node:n,unsub:null,prevData:void 0,dirty:!1,involvedThisWave:!1,dataBatch:[],terminal:void 0}}function yt(n){n.prevData=void 0,n.dirty=!1,n.involvedThisWave=!1,n.dataBatch.length=0,n.terminal=void 0}function ze(n){return n.length===0?n:typeof n[0]=="symbol"?[n]:n}function ne(n,e,t){let r=cn(n)?n:[],o=typeof n=="function"?n:typeof e=="function"?e:void 0,s={};return cn(n)?s=(vt(e)?e:t)??{}:vt(n)?s=n:s=(vt(e)?e:t)??{},new V(r,o,s)}var an,un,tr,nr,Ne,V,cn,vt,ie=B(()=>{"use strict";dt();ct();Be();Ae();rn();Ie();se();sn();an=()=>{},un=100;tr=(n,e,t,r)=>{t.direction==="down-in"&&n._onDepMessage(t.depIndex,e)},nr=(n,e,t,r)=>{let o=n;if(o._status==="completed"||o._status==="errored")return;let s=o._cached,i=s===void 0?[ft]:[ft,[R,s]];o._status==="dirty"&&i.push(_e),Fe(e,i,o._config.tierOf)},Ne=new je({onMessage:tr,onSubscribe:nr});nn(Ne);Zt(Ne);V=class n{_optsName;_describeKind;meta;_hasMeta;_config;_deps;_sinks=null;_sinkCount=0;_cached;_status;_cleanup;_store={};_waveHasNewData=!1;_hasNewTerminal=!1;_hasCalledFnOnce=!1;_paused=!1;_pendingWave=!1;_isExecutingFn=!1;_pendingRerun=!1;_rerunDepth=0;_dirtyDepCount=0;_batchPendingMessages=null;_pauseLocks=null;_pauseBuffer=null;_fn;_equals;_resubscribable;_resetOnTeardown;_autoComplete;_autoError;_pausable;_partial;_guard;_extraGuards;_hashFn;_versioning;_versioningLevel;_lastMutation;_inspectorHooks;_actions;constructor(e,t,r){this._config=r.config??Ne,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=t,this._partial=r.partial??!1,this._cached=r.initial!==void 0?r.initial:void 0,this._status=e.length===0&&t==null&&this._cached!==void 0?"settled":"sentinel",this._hashFn=r.versioningHash??this._config.defaultHashFn??gt;let o=r.versioning??this._config.defaultVersioning;this._versioningLevel=o,this._versioning=o!=null?bt(o,this._cached===void 0?void 0:this._cached,{id:r.versioningId,hash:this._hashFn}):void 0,this._deps=e.map(dn);let s={};for(let[a,d]of Object.entries(r.meta??{})){let u={initial:d,name:`${r.name??"node"}:meta:${a}`,describeKind:"state",config:this._config};r.guard!=null&&(u.guard=r.guard),s[a]=new n([],void 0,u)}Object.freeze(s),this.meta=s,this._hasMeta=Object.keys(s).length>0;let i=this;this._actions={emit(a){i._emit([[R,a]])},down(a){i._emit(ze(a))},up(a){i._emitUp(ze(a))}},this.down=this.down.bind(this),this.up=this.up.bind(this)}get _isTerminal(){return this._status==="completed"||this._status==="errored"}get name(){return this._optsName}get status(){return this._status}get cache(){return this._cached===void 0?void 0:this._cached}get lastMutation(){return this._lastMutation}get v(){return this._versioning}hasGuard(){return this._guard!=null}_applyVersioning(e,t){if(this._isExecutingFn)throw new Error(`Node "${this.name}": _applyVersioning cannot run mid-fn \u2014 call it outside of \`_execFn\` (typically at graph setup time before the first subscribe).`);let r=this._versioningLevel;if(r!=null&&e<=r)return;let o=t?.hash??this._hashFn;o!==this._hashFn&&(this._hashFn=o);let s=this._cached===void 0?void 0:this._cached,i=this._versioning,a=i?.id??t?.id,d=i?.version??0,u=bt(e,s,{id:a,hash:o});u.version=d,this._versioning=u,this._versioningLevel=e}_setInspectorHook(e){return e==null?()=>{}:(this._inspectorHooks==null&&(this._inspectorHooks=new Set),this._inspectorHooks.add(e),()=>{this._inspectorHooks?.delete(e),this._inspectorHooks?.size===0&&(this._inspectorHooks=void 0)})}_pushGuard(e){return this._extraGuards==null&&(this._extraGuards=new Set),this._extraGuards.add(e),()=>{this._extraGuards?.delete(e),this._extraGuards?.size===0&&(this._extraGuards=void 0)}}allowsObserve(e){if(this._guard==null&&this._extraGuards==null)return!0;let t=Le(e);if(this._guard!=null&&!this._guard(t,"observe"))return!1;if(this._extraGuards!=null){for(let r of this._extraGuards)if(!r(t,"observe"))return!1}return!0}_checkGuard(e){if(e?.internal)return;let t=this._guard!=null||this._extraGuards!=null,r=e?.actor!=null;if(!t&&!r)return;let o=Le(e?.actor),s=e?.delivery==="signal"?"signal":"write";if(this._guard!=null&&!this._guard(o,s))throw new J({actor:o,action:s,nodeName:this.name});if(this._extraGuards!=null){for(let i of this._extraGuards)if(!i(o,s))throw new J({actor:o,action:s,nodeName:this.name})}this._lastMutation={actor:o,timestamp_ns:Ve()}}down(e,t){let r=ze(e);r.length!==0&&(this._checkGuard(t),this._emit(r))}emit(e,t){this._checkGuard(t),this._emit([[R,e]])}up(e,t){if(this._deps.length===0)return;let r=ze(e);if(r.length===0)return;this._checkGuard(t);let o=t??{internal:!0};this._validateUpTiers(r);for(let s of this._deps)s.node.up?.(r,o)}_emitUp(e){if(this._deps.length!==0&&e.length!==0){this._validateUpTiers(e);for(let t of this._deps)t.node.up?.(e,{internal:!0})}}_validateUpTiers(e){let t=this._config.tierOf;for(let r of e){let o=t(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,t){if(t!=null&&this._guard!=null){let d=Le(t);if(!this._guard(d,"observe"))throw new J({actor:d,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 d of this._deps)yt(d);if(this._partial===!1){for(let d of this._deps)if(d.prevData!==void 0||d.dataBatch.length!==0||d.terminal!==void 0||d.dirty)throw new Error(`resubscribable-reset invariant: DepRecord not fully reset for node ${this._optsName??"(anonymous)"}`)}}this._sinkCount+=1;let s;try{s=this._config.onSubscribe(this,e,{sinkCount:this._sinkCount,afterTerminalReset:o},this._actions)}catch(d){throw this._sinkCount-=1,d}this._sinks==null?this._sinks=e:typeof this._sinks=="function"?this._sinks=new Set([this._sinks,e]):this._sinks.add(e);let i=this._isTerminal;if(this._sinkCount===1&&!i)try{this._activate()}catch(d){if(this._sinkCount-=1,this._removeSink(e),this._sinkCount===0&&(this._status="sentinel"),typeof s=="function")try{s()}catch{}throw d}this._status==="sentinel"&&this._cached===void 0&&(this._status="pending");let a=!1;return()=>{a||(a=!0,this._sinkCount-=1,this._removeSink(e),typeof s=="function"&&s(),this._sinks==null&&this._deactivate())}}_removeSink(e){if(this._sinks===e)this._sinks=null;else if(this._sinks!=null&&typeof this._sinks!="function")if(this._sinks.delete(e),this._sinks.size===1){let[t]=this._sinks;this._sinks=t}else this._sinks.size===0&&(this._sinks=null)}_activate(){if(this._deps.length===0){this._fn&&this._execFn();return}this._dirtyDepCount=0;let e=this._deps.length,t=0;try{for(let r=0;r<e;r++){let o=r,s=this._deps[r];s.unsub=an,s.unsub=s.node.subscribe(i=>{if(s.unsub===null)return;let a=this._config.tierOf,d=!1;for(let u of i)a(u[0])>=3&&(d=!0),this._config.onMessage(this,u,{direction:"down-in",depIndex:o},this._actions);d&&this._maybeRunFnOnSettlement()}),t++}}catch(r){this._deps[t].unsub=null;for(let o=0;o<t;o++){let s=this._deps[o];if(s.unsub!=null){let i=s.unsub;s.unsub=null;try{i()}catch{}yt(s)}}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 t=this._deps.length,r=dn(e);if(this._deps.push(r),this._sinks==null)return t;r.dirty=!0,this._dirtyDepCount++,this._status!=="dirty"&&this._emit(pt),r.unsub=an;try{r.unsub=e.subscribe(o=>{if(r.unsub===null)return;let s=this._config.tierOf,i=!1;for(let a of o)s(a[0])>=3&&(i=!0),this._config.onMessage(this,a,{direction:"down-in",depIndex:t},this._actions);i&&this._maybeRunFnOnSettlement()})}catch(o){throw r.unsub=null,this._deps.pop(),this._dirtyDepCount--,o}return t}_deactivate(e=!1){let t=this._cleanup;if(this._cleanup=void 0,typeof t=="function")try{t()}catch(r){this._emit([[k,this._wrapFnError("cleanup threw",r)]])}else if(t!=null&&typeof t=="object"){let r=t.deactivate;if(typeof r=="function")try{r()}catch(o){this._emit([[k,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{}}yt(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,t){let r=this._deps[e],o=t[0];if(this._inspectorHooks!=null){let s={kind:"dep_message",depIndex:e,message:t};for(let i of this._inspectorHooks)i(s)}if(o!==oe){if(o===M){this._depDirtied(r);return}if(o===ee){if(this._depInvalidated(r),this._cached===void 0)return;this._emit(en);return}if(o===H||o===te){this._emit([t]);return}if(o===$){this._emit(ht);return}if(o===R)this._depSettledAsData(r,t[1]);else if(o===D)this._depSettledAsResolved(r);else if(o===S)this._depSettledAsTerminal(r,!0);else if(o===k)this._depSettledAsTerminal(r,t[1]);else{this._emit([t]);return}if(!this._fn){(o===R||o===D)&&this._emit([t]),(o===S||o===k)&&this._maybeAutoTerminalAfterWave();return}}}_depDirtied(e){e.dirty||(e.dirty=!0,e.involvedThisWave=!0,this._dirtyDepCount++,this._status!=="dirty"&&this._emit(pt))}_depSettledAsData(e,t){e.dirty&&(e.dirty=!1,this._dirtyDepCount--),e.involvedThisWave=!0,e.dataBatch.push(t),this._waveHasNewData=!0}_depSettledAsResolved(e){e.dirty&&(e.dirty=!1,this._dirtyDepCount--)}_depSettledAsTerminal(e,t){e.dirty&&(e.dirty=!1,this._dirtyDepCount--),e.terminal=t,e.involvedThisWave=!0,this._hasNewTerminal=!0}_depInvalidated(e){e.prevData=void 0,e.terminal=void 0,e.dataBatch.length=0,e.dirty?e.involvedThisWave=!1:(e.dirty=!0,e.involvedThisWave=!0,this._dirtyDepCount++)}_maybeRunFnOnSettlement(){if(!(this._isTerminal&&!this._resubscribable)&&!(this._dirtyDepCount>0)){if(!this._partial&&!this._hasCalledFnOnce)for(let e=0;e<this._deps.length;e++){let t=this._deps[e];if(t.dataBatch.length===0&&t.prevData===void 0&&t.terminal===void 0){this._maybeAutoTerminalAfterWave();return}}if(this._paused){this._pendingWave=!0;return}if(!this._waveHasNewData&&!this._hasNewTerminal&&this._hasCalledFnOnce){this._clearWaveFlags(),this._emit(Qt),this._maybeAutoTerminalAfterWave();return}this._fn&&this._execFn(),this._maybeAutoTerminalAfterWave()}}_maybeAutoTerminalAfterWave(){if(this._deps.length===0||this._isTerminal)return;let e=this._deps.find(t=>t.terminal!==void 0&&t.terminal!==!0);if(e!=null){this._autoError&&this._emit([[k,e.terminal]]);return}this._autoComplete&&this._deps.every(t=>t.terminal!==void 0)&&this._emit(tn)}_execFn(){if(!this._fn||this._isTerminal&&!this._resubscribable)return;if(this._isExecutingFn){this._pendingRerun=!0;return}let e=this._cleanup;if(typeof e=="function"){this._cleanup=void 0;try{e()}catch(i){this._emit([[k,this._wrapFnError("cleanup threw",i)]]);return}}else if(e!=null&&typeof e=="object"){let i=e.beforeRun;if(typeof i=="function"){e.beforeRun=void 0;try{i()}catch(a){this._emit([[k,this._wrapFnError("cleanup.beforeRun threw",a)]]);return}}}let t=this._deps.map(i=>i.involvedThisWave?i.dataBatch.length>0?[...i.dataBatch]:[]:void 0),r=this._deps.map(i=>i.prevData);for(let i=0;i<this._deps.length;i++){let a=t[i];a!=null&&a.length>0&&(this._deps[i].prevData=a[a.length-1])}let o=this._deps.map(i=>i.terminal),s={prevData:r,terminalDeps:o,store:this._store};if(this._hasCalledFnOnce=!0,this._clearWaveFlags(),this._inspectorHooks!=null){let i={kind:"run",batchData:t,prevData:r};for(let a of this._inspectorHooks)a(i)}this._isExecutingFn=!0;try{let i=this._fn(t,this._actions,s);if(typeof i=="function")this._cleanup=i;else if(i!=null&&typeof i=="object"){let a=i;(typeof a.beforeRun=="function"||typeof a.deactivate=="function"||typeof a.invalidate=="function")&&(this._cleanup=i)}}catch(i){this._emit([[k,this._wrapFnError("fn threw",i)]])}finally{this._isExecutingFn=!1,this._pendingRerun?(this._pendingRerun=!1,this._rerunDepth+=1,this._rerunDepth>un?(this._rerunDepth=0,this._emit([[k,new Error(`Node "${this.name}": _pendingRerun depth exceeded ${un} \u2014 likely a reactive cycle`)]])):this._maybeRunFnOnSettlement()):this._rerunDepth=0,this._clearWaveFlags()}}_clearWaveFlags(){this._waveHasNewData=!1,this._hasNewTerminal=!1;for(let e of this._deps)e.involvedThisWave=!1,e.dataBatch.length=0}_wrapFnError(e,t){let r=t instanceof Error?t.message:String(t);return new Error(`Node "${this.name}": ${e}: ${r}`,{cause:t})}_frameBatch(e){let t=this._config.tierOf;if(e.length===1)return t(e[0][0])===3&&this._status!=="dirty"?[_e,e[0]]:e;let r=!0,o=!1,s=!1,i=-1;for(let d of e){let u=t(d[0]);u<i&&(r=!1),u===3&&(o=!0),d[0]===M&&(s=!0),i=u}let a=e;if(!r){let d=e.map((u,c)=>({m:u,i:c,tier:t(u[0])}));d.sort((u,c)=>u.tier-c.tier||u.i-c.i),a=d.map(u=>u.m)}if(o&&!s&&this._status!=="dirty"){let d=0;for(;d<a.length&&t(a[d][0])===0;)d++;return d===0?[_e,...a]:[...a.slice(0,d),_e,...a.slice(d)]}return a}_emit(e){if(e.length===0)return;for(let a=0;a<e.length;a++){let d=e[a];if(d[0]===k&&d[1]===void 0)throw new TypeError('[ERROR, payload] requires a non-undefined payload (spec \xA71.2). Pass an Error object or domain tag instead \u2014 e.g. node.down([[ERROR, new Error("reason")]])')}let t=e;if(this._isTerminal&&!this._resubscribable){let a=e.filter(d=>d[0]===$||d[0]===ee);if(a.length===0)return;t=a}t=this._frameBatch(t);let o=null;for(let a=0;a<t.length;a++){let d=t[a],u=d[0];if(u!==H&&u!==te){o?.push(d);continue}if(d.length<2)throw new Error(`Node "${this.name}": [[${u===H?"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=d[1];if(u===H)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 m=this._pauseBuffer;this._pauseBuffer=[],this._emit(m)}this._pendingWave&&(this._pendingWave=!1,this._maybeRunFnOnSettlement())}}c?o?.push(d):o==null&&(o=t.slice(0,a))}if(o!=null){if(o.length===0)return;t=o}if(this._hasMeta&&t.some(a=>a[0]===$))for(let a of Object.keys(this.meta))try{this.meta[a]._emit(ht)}catch{}let{finalMessages:s,equalsError:i}=this._updateState(t);if(s.length>0&&this._config.inspectorEnabled){let a=this._config.globalInspector;if(a!=null)try{a({kind:"emit",node:this,messages:s})}catch{}}if(s.length>0)if(this._paused&&this._pausable==="resumeAll"&&this._pauseBuffer!=null){let a=this._config.tierOf,d=[];for(let u of s)a(u[0])===3?this._pauseBuffer.push(u):d.push(u);d.length>0&&this._dispatchOrAccumulate(d)}else this._dispatchOrAccumulate(s);i!=null&&this._emit([[k,i]])}_updateState(e){let t=this._config.tierOf,r,o,s=-1,i=0;for(let c of e)t(c[0])===3&&i++;let a=i<=1,d=-1;if(this._versioning!=null&&i>1){for(let c=e.length-1;c>=0;c--)if(e[c][0]===R){d=c;break}}for(let c=0;c<e.length;c++){let f=e[c],m=f[0];if(m===R){if(f.length>=2){let p=!1;if(a&&this._cached!==void 0)try{p=this._equals(this._cached,f[1])}catch(l){o=this._wrapFnError("equals threw",l),s=c;break}if(p){r==null&&(r=e.slice(0,c)),r.push(lt),this._status="resolved";continue}this._cached=f[1],this._versioning!=null&&(d<0||c===d)&&on(this._versioning,f[1],this._hashFn)}this._status="settled",r?.push(f)}else if(r?.push(f),m===M)this._status="dirty";else if(m===D)this._status="resolved";else if(m===S){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(m===k){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(m===ee){if(this._cached!==void 0){let l=this._config.rigorRecorder;if(l!=null)try{l.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 l=p.invalidate;if(typeof l=="function")try{l()}catch{}}}else m===$&&(this._resetOnTeardown&&(this._cached=void 0),this._deactivate(!0),this._status="sentinel")}let u=s>=0?r??e.slice(0,s):r??e;return o!=null?{finalMessages:u,equalsError:o}:{finalMessages:u}}_deliverToSinks=e=>{if(this._sinks==null)return;if(typeof this._sinks=="function"){this._sinks(e);return}let t=[...this._sinks];for(let r of t)r(e)};_dispatchOrAccumulate(e){if(Xt()){this._batchPendingMessages===null&&(this._batchPendingMessages=[],Te(()=>this._flushBatchPending()));for(let t of e)this._batchPendingMessages.push(t);return}Fe(this._deliverToSinks,e,this._config.tierOf)}_flushBatchPending(){let e=this._batchPendingMessages;if(e===null||(this._batchPendingMessages=null,e.length===0))return;let t=this._frameBatch(e);Fe(this._deliverToSinks,t,this._config.tierOf)}},cn=n=>Array.isArray(n),vt=n=>typeof n=="object"&&n!=null&&!Array.isArray(n)});function Tt(n,e){if(e!=null&&e.length>0)return new Set(e);switch(n){case"standard":return new Set(["type","status","value","deps","meta","v"]);case"full":return null;case"spec":return new Set(["type","deps","meta","value"]);default:return new Set(["type","deps"])}}function rr(n){return n._describeKind!=null?n._describeKind:n._deps.length>0?"derived":n._fn!=null?"producer":"state"}function _t(n){let e=new WeakSet,t={};for(let[r,o]of ln(n))t[r]=wt(o,e);return t}function wt(n,e){if(n==null)return n;let t=typeof n;if(t==="boolean"||t==="number"||t==="string")return n;if(t==="function")return"<function>";if(Array.isArray(n))return e.has(n)?"<cycle>":(e.add(n),n.map(r=>wt(r,e)));if(t==="object"){let r=n;if(e.has(r))return"<cycle>";e.add(r);try{if(typeof r.subscribe=="function"&&"cache"in r)return"<Node>"}catch{return"<unserializable>"}let o={};for(let[s,i]of ln(r))o[s]=wt(i,e);return o}return"<unserializable>"}function ln(n){let e=[],t;try{t=Object.keys(n)}catch{return e}for(let r of t)try{e.push([r,n[r]])}catch{e.push([r,"<unserializable>"])}return e}function X(n,e){let t={factory:n};return e!==void 0&&(t.factoryArgs=e),t}function or(n){let e={};for(let[t,r]of Object.entries(n.meta))try{e[t]=r.cache}catch{}return e}function Nt(n,e,t){let r=e==null,o=!r&&e!=null?[...e].filter(c=>c.startsWith("meta.")).map(c=>c.slice(5)):null,s=r||e.has("meta")||o!=null&&o.length>0,i="state",a=[];n instanceof V&&(i=rr(n),a=n._deps.map(c=>c.node.name??""));let d={type:i,deps:a};(r||e.has("status"))&&(d.status=n.status);let u=n instanceof V?n._guard:void 0;if(s){let c={...or(n)};if(u!=null&&c.access===void 0&&(c.access=at(u)),o!=null&&o.length>0&&!e.has("meta")){let f={};for(let m of o)m in c&&(f[m]=c[m]);d.meta=f}else d.meta=c}if(n.name!=null&&(d.name=n.name),(r||e.has("value"))&&(!t||i==="state")){n.status==="sentinel"&&(d.sentinel=!0);try{d.value=n.cache}catch{}}if((r||e.has("v"))&&n.v!=null){let c={id:n.v.id,version:n.v.version};"cid"in n.v&&(c.cid=n.v.cid,c.prev=n.v.prev),d.v=c}return(r||e.has("guard"))&&u!=null&&(d.guard=at(u)),(r||e.has("lastMutation"))&&n.lastMutation!=null&&(d.lastMutation=n.lastMutation),d}var De=B(()=>{"use strict";Ie();ie()});function le(n){return n<0?0:n}function sr(n,e){return e==="none"?n:e==="full"?Math.random()*n:n/2+Math.random()*(n/2)}function ir(n,e){return n+Math.random()*(e-n)}function ar(n){let e=le(n);return()=>e}function ur(n,e){let t=le(n),r=e===void 0?t:le(e);return o=>t+r*Math.max(0,o)}function dr(n){let e=le(n?.baseNs??1e8),t=n?.factor!==void 0&&n.factor<1?1:n?.factor??2,r=le(n?.maxDelayNs??30*1e9),o=n?.jitter??"none";return s=>{let i;if(e===0)i=0;else if(t===1)i=e;else{let a=r/e,d=1;for(let u=0;u<Math.max(0,s);u++){if(d>=a){d=a;break}d*=t}i=e*d,i>r&&(i=r)}return sr(i,o)}}function cr(n=100*1e6,e=30*1e9){let t=le(n),r=le(e);function o(s){if(s<=0)return 1;let i=1,a=2;for(let d=1;d<s;d++){let u=i+a;i=a,a=u}return a}return s=>{let i=o(s)*t;return i<=r?i:r}}function lr(n=100*1e6,e=30*1e9){return(t,r,o)=>{let i=Math.min(e,(o??n)*3);return ir(n,i)}}function fn(n){if(n==="constant")return ar(1*1e9);if(n==="linear")return ur(1*1e9);if(n==="exponential")return dr();if(n==="fibonacci")return cr();if(n==="decorrelatedJitter")return lr();throw new Error(`Unknown backoff preset: "${String(n)}". Use one of: constant, linear, exponential, fibonacci, decorrelatedJitter`)}var re,fe,Ot=B(()=>{"use strict";re=1e6,fe=1e9});function U(n,e,t){return{[n]:!0,[`${n}_type`]:e,...t??{}}}var kt=B(()=>{"use strict"});function Oe(n,e){return ne([],{...e,initial:n})}function K(n,e){return ne((r,o,s)=>n(o,s)??void 0,{describeKind:"producer",...e})}function xt(n,e,t){return ne(n,(o,s,i)=>{let a=o.map((d,u)=>d!=null&&d.length>0?d.at(-1):i.prevData[u]);s.emit(e(a,i))},{describeKind:"derived",...t})}var Ue=B(()=>{"use strict";ie()});function Et(n){return{describeKind:"producer",...n}}function pn(n,e){return K(t=>{let r=!1;try{for(let o of n){if(r)return;t.emit(o)}r||t.down([[S]])}catch(o){r||t.down([[k,o]])}return()=>{r=!0}},Et(e))}function fr(n){return n!=null&&typeof n.then=="function"}function pr(n,e){let{signal:t,...r}=e??{};return K(o=>{let s=!1,i=()=>{s||(s=!0,o.down([[k,t.reason]]))};if(t?.aborted){i();return}return t?.addEventListener("abort",i,{once:!0}),Promise.resolve(n).then(a=>{s||(s=!0,t?.removeEventListener("abort",i),o.emit(a),o.down([[S]]))},a=>{s||(s=!0,t?.removeEventListener("abort",i),o.down([[k,a]]))}),()=>{s=!0,t?.removeEventListener("abort",i)}},Et(r))}function hr(n,e){let{signal:t,...r}=e??{};return K(o=>{let s=new AbortController,i=()=>s.abort(t?.reason);t?.aborted?s.abort(t.reason):t?.addEventListener("abort",i,{once:!0});let a=t??s.signal,d=!1,u=n[Symbol.asyncIterator](),c=()=>{d||a.aborted||Promise.resolve(u.next()).then(f=>{if(!(d||a.aborted)){if(f.done){o.down([[S]]);return}o.emit(f.value),c()}},f=>{!d&&!a.aborted&&o.down([[k,f]])})};return c(),()=>{d=!0,t?.removeEventListener("abort",i),s.abort(),Promise.resolve(u.return?.()).catch(()=>{})}},Et(r))}function mr(n){return n!=null&&typeof n=="object"&&"cache"in n&&typeof n.subscribe=="function"}function We(n,e){if(mr(n))return n;if(fr(n))return pr(n,e);if(n!=null){let t=n;if(typeof t[Symbol.asyncIterator]=="function")return hr(n,e);if(typeof t[Symbol.iterator]=="function")return pn(n,e)}return gr(n)}function gr(...n){return pn(n,void 0)}function He(n){return n.subscribe(()=>{})}var hn=B(()=>{"use strict";se();Ue()});var Ke=B(()=>{"use strict";hn()});function qe(n,e,t){if(e.length===0)throw new RangeError("budgetGate requires at least one constraint");let r=e.map(p=>p.node),o=[n,...r],s=new Rt,i=!1,a=!1,d=Symbol("budget-gate"),u=new Array(e.length);function c(){return e.every((p,l)=>p.check(u[l]))}function f(p){for(;s.size>0&&c();){let l=s.shift();p.emit(l)}s.size===0&&a&&(a=!1,p.down([[D]]))}return ne([],(p,l)=>{for(let h=0;h<e.length;h++)u[h]=e[h].node.cache;let g=[];for(let h=0;h<o.length;h++){let T=o[h];g.push(T.subscribe(y=>{for(let b of y)m(b,h,l)}))}return()=>{for(let h of g)h()}},{...t,describeKind:"derived",meta:U("resilience","budget_gate",t?.meta)});function m(p,l,g){let h=p[0];if(l===0){if(h===R)return c()&&s.size===0?g.emit(p[1]):(s.push(p[1]),i||(i=!0,g.up([[H,d]]))),!0;if(h===M)return g.down([[M]]),!0;if(h===D)return s.size===0?g.down([[D]]):a=!0,!0;if(h===S||h===k){for(;s.size>0;)g.emit(s.shift());return a=!1,i&&(i=!1,g.up([[te,d]])),g.down([p]),!0}return!1}if(h===R&&(u[l-1]=p[1]),h===R||h===D){let T=c();return T&&s.size>0?(f(g),s.size===0&&i&&(i=!1,g.up([[te,d]]))):!T&&!i&&s.size>0&&(i=!0,g.up([[H,d]])),!0}return h===M?!0:h===k?(g.down([p]),!0):h===S}}var Rt,mn=B(()=>{"use strict";se();ie();kt();Rt=class{buf=[];head=0;get size(){return this.buf.length-this.head}push(e){this.buf.push(e)}shift(){if(this.head>=this.buf.length)return;let e=this.buf[this.head];return this.buf[this.head]=void 0,this.head++,this.head>32&&this.head*2>this.buf.length&&(this.buf=this.buf.slice(this.head),this.head=0),e}clear(){this.buf=[],this.head=0}}});var ae,St=B(()=>{"use strict";ae=class{_timer;_gen=0;start(e,t){this.cancel(),this._gen+=1;let r=this._gen;this._timer=setTimeout(()=>{this._timer=void 0,r===this._gen&&t()},e)}cancel(){this._timer!==void 0&&(clearTimeout(this._timer),this._timer=void 0)}get pending(){return this._timer!==void 0}}});var pe,Ct=B(()=>{"use strict";pe=class{constructor(e){this.capacity=e;if(!Number.isInteger(e)||e<=0)throw new Error(`RingBuffer capacity must be a positive integer (got ${e})`);this.buf=new Array(e)}buf;head=0;_size=0;get size(){return this._size}get maxSize(){return this.capacity}push(e){let t=(this.head+this._size)%this.capacity;this.buf[t]=e,this._size<this.capacity?this._size++:this.head=(this.head+1)%this.capacity}shift(){if(this._size===0)return;let e=this.buf[this.head];return this.buf[this.head]=void 0,this.head=(this.head+1)%this.capacity,this._size--,e}at(e){if(this._size===0)return;let t=e<0?this._size+e:e;if(!(t<0||t>=this._size))return this.buf[(this.head+t)%this.capacity]}toArray(){let e=new Array(this._size);for(let t=0;t<this._size;t++)e[t]=this.buf[(this.head+t)%this.capacity];return e}clear(){for(let e=0;e<this._size;e++)this.buf[(this.head+e)%this.capacity]=void 0;this.head=0,this._size=0}}});function he(n){return{describeKind:"derived",...n}}function vr(n){return n<0?0:n}function Gt(n){return n[1]}function wr(n){if(typeof n!="number"||!Number.isFinite(n))throw new TypeError("backoff strategy must return a finite number");return n<0?0:n}function gn(n){let e=n?.count,t=n?.backoff;if(t!==void 0&&e===void 0)throw new RangeError("retry({ backoff }) requires explicit count to prevent unbounded retries; pass { count: <n>, backoff: ... }");let r=e!==void 0?e:0;if(r<0)throw new RangeError("retry count must be >= 0");let o=t===void 0?null:typeof t=="string"?fn(t):t;return{maxRetries:r,strategy:o}}function bn(n){let e={};return n?.count!==void 0&&(e.count=n.count),typeof n?.backoff=="string"&&(e.backoff=n.backoff),Object.keys(e).length>0?e:void 0}function yn(n,e,t){let r=0,o=!1,s=null,i,a=new ae;function d(){i?.(),i=void 0}function u(f){if(o)return;if(r>=n.maxRetries){d(),t.down([[k,f]]);return}let m=n.strategy===null?0:n.strategy(r,f,s);if(m==null){d(),t.down([[k,f]]);return}let p;try{p=wr(m)}catch{d(),t.down([[k,f]]);return}s=p,r+=1,d();let l=p>0?p/1e6:1;a.start(l,()=>{o||c()})}function c(){a.cancel(),d();let f;try{f=e()}catch(m){u(m);return}i=f.subscribe(m=>{if(!o)for(let p of m){let l=p[0];if(l===M)t.down([[M]]);else if(l===R)r=0,s=null,t.emit(p[1]);else if(l===D)t.down([[D]]);else if(l===S)d(),t.down([[S]]);else if(l===k){u(Gt(p));return}else t.down([p])}})}return c(),()=>{o=!0,a.cancel(),d()}}function Pt(n,e){return typeof n=="function"?_r(n,e):Tr(n,e)}function Tr(n,e){let t=gn(e);return K(r=>yn(t,()=>n,r),{...he(),initial:n.cache,meta:{...e?.meta??{},...X("retry",bn(e))}})}function _r(n,e){let t=gn(e);return K(r=>yn(t,n,r),{...he(),initial:e?.initial,meta:{...e?.meta??{},...X("retry",bn(e))}})}function It(n){let e=Math.max(1,n?.failureThreshold??5),t=vr(n?.cooldownNs??30*1e9),r=n?.cooldown??null,o=Math.max(1,n?.halfOpenMax??1),s=n?.now??Z,i="closed",a=0,d=0,u=0,c=t,f=0;function m(){if(!r)return t;let g=r(d);return g!==null?g:t}function p(){i="open",c=m(),u=s(),f=0}return{canExecute(){return i==="closed"?!0:i==="open"?s()-u>=c?(i="half-open",f=1,!0):!1:f<o?(f++,!0):!1},recordSuccess(){i==="half-open"?(i="closed",a=0,d=0):i==="closed"&&(a=0)},recordFailure(g){if(i==="half-open"){d++,p();return}i==="closed"&&(a++,a>=e&&p())},get state(){return i},get failureCount(){return a},reset(){i="closed",a=0,d=0,f=0}}}function Lt(n,e){let t=e?.onOpen??"skip",r=e?.meta;return o=>{let s=ne([],(i,a)=>{function d(){s.meta.breakerState.down([[R,n.state]])}let u=o.subscribe(c=>{for(let f of c){let m=f[0];m===M?a.down([[M]]):m===R?n.canExecute()?(d(),a.emit(f[1])):(d(),t==="error"?a.down([[k,new At]]):a.down([[D]])):m===D?a.down([[D]]):m===S?(n.recordSuccess(),d(),a.down([[S]])):m===k?(n.recordFailure(Gt(f)),d(),a.down([f])):a.down([f])}});return d(),u},{...he(),meta:{...r??{},breakerState:n.state,...X("withBreaker",{onOpen:t})},completeWhenDepsComplete:!1,initial:o.cache});return{node:s,breakerState:s.meta.breakerState}}}function Nr(n,e,t){if(n<=0)throw new RangeError("capacity must be > 0");if(e<0)throw new RangeError("refillPerSecond must be >= 0");let r=t?.clock??Z,o=n,s=r();function i(a){if(e>0){let d=a-s;o=Math.min(n,o+d/1e9*e)}s=a}return{available(){return i(r()),o},tryConsume(a=1){if(a<=0)return!0;let d=r();return i(d),o>=a?(o-=a,!0):!1},putBack(a=1){a<=0||(i(r()),o=Math.min(n,o+a))}}}function Or(n,e){return n.droppedCount===e.droppedCount&&n.pendingCount===e.pendingCount&&n.paused===e.paused}function $t(n,e){let{maxEvents:t,windowNs:r}=e;if(t<=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)throw new RangeError("rateLimiter requires explicit maxBuffer (use Infinity to opt in to unbounded)");let s=o===1/0;if(!s&&(!Number.isInteger(o)||o<1))throw new RangeError("maxBuffer must be a positive integer (or Infinity for unbounded)");let i=e.onOverflow??"drop-newest",a=t*1e9/r,d=K(u=>{let c=Nr(t,a),f=s?xr():kr(o),m=new ae,p=!1,l=0,g=1e9/a,h=d.meta.droppedCount,T=d.meta.rateLimitState,y=Ye;function b(){h.emit(l);let E={droppedCount:l,pendingCount:f.size,paused:f.size>0};Or(y,E)||(y=E,T.emit(E))}y=Ye,h.emit(0),T.emit(Ye);function v(){for(;f.size>0;)if(c.tryConsume(1))u.emit(f.shift()),b();else{m.start(Math.max(1,g/1e6),v);return}}function w(){l+=1,b()}function _(){for(p=!0,m.cancel();f.size>0;)f.shift();l=0}let x=n.subscribe(E=>{for(let C of E){if(p)return;let A=C[0];if(A===M)u.down([[M]]);else if(A===R){if(!s&&f.size>=o)if(i==="drop-newest")w();else if(i==="drop-oldest")f.shift(),f.push(C[1]),w();else{w(),_(),u.down([[k,new Dt(o)]]);return}else f.push(C[1]),b();v()}else if(A===D)u.down([[D]]);else if(A===S)_(),u.down([[S]]);else if(A===k)_(),u.down([C]);else if(A===$){_(),u.down([C]);return}else u.down([C])}});return()=>{p=!0,m.cancel(),x()}},{...he(),initial:n.cache,meta:{...e.meta??{},droppedCount:0,rateLimitState:Ye,...X("rateLimiter",e)}});return{node:d,droppedCount:d.meta.droppedCount,rateLimitState:d.meta.rateLimitState}}function kr(n){let e=new pe(n);return{push:t=>e.push(t),shift:()=>e.shift(),get size(){return e.size}}}function xr(){let n=[];return{push:e=>{n.push(e)},shift:()=>n.shift(),get size(){return n.length}}}function vn(n,e){let t=e?.initialStatus??"pending",r=e?.meta,o=ne([],(s,i)=>{let a=t;return o.meta.status.down([[R,t]]),o.meta.error.down([[R,null]]),n.subscribe(u=>{for(let c of u){let f=c[0];if(f===M)i.down([[M]]);else if(f===R)a==="errored"?Ce(()=>{o.meta.error.down([[R,null]]),o.meta.status.down([[R,"running"]])}):o.meta.status.down([[R,"running"]]),a="running",i.emit(c[1]);else if(f===D)i.down([[D]]);else if(f===S)o.meta.status.down([[R,"completed"]]),a="completed",i.down([[S]]);else if(f===k){let m=Gt(c);Ce(()=>{o.meta.error.down([[R,m]]),o.meta.status.down([[R,"errored"]])}),a="errored",i.down([c])}else i.down([c])}})},{...he(),meta:{...r??{},status:t,error:null,...X("withStatus",{initialStatus:t})},completeWhenDepsComplete:!1,resubscribable:!0,initial:n.cache});return{node:o,status:o.meta.status,error:o.meta.error}}function Er(n){return n!=null&&typeof n=="object"&&"cache"in n&&typeof n.subscribe=="function"}function Rr(n){return n!=null&&typeof n.then=="function"}function Sr(n){return n!=null&&typeof n=="object"&&typeof n[Symbol.asyncIterator]=="function"}function wn(n,e,t){let r=t?.meta;return K(o=>{let s,i;function a(){i?.(),i=void 0,Er(e)||Rr(e)||Sr(e)?s=We(e).subscribe(u=>{o.down(u);for(let c of u){let f=c[0];if(f===S||f===k||f===$){s=void 0;return}}}):(o.emit(e),o.down([[S]]))}return i=n.subscribe(d=>{for(let u of d){let c=u[0];if(c===M)o.down([[M]]);else if(c===R)o.emit(u[1]);else if(c===D)o.down([[D]]);else if(c===S)o.down([[S]]);else if(c===k){a();return}else if(c===$){s?.(),o.down([u]);return}else o.down([u])}}),()=>{i?.(),s?.()}},{...he(),initial:n.cache,meta:{...r??{},...X("fallback")}})}function Ft(n,e,t){if(e<=0)throw new RangeError("timeoutNs must be > 0");let r=t?.meta;return K(o=>{let s=!1,i=new ae;function a(){let u=e/1e6;i.start(u,()=>{s||(s=!0,d(),o.down([[k,new Mt(e)]]))})}let d=n.subscribe(u=>{for(let c of u){if(s)return;let f=c[0];if(f===M)o.down([[M]]);else if(f===R)a(),o.emit(c[1]);else if(f===D)o.down([[D]]);else if(f===S){i.cancel(),s=!0,o.down([[S]]);return}else if(f===k){i.cancel(),s=!0,o.down([c]);return}else if(f===$){i.cancel(),s=!0,o.down([c]);return}else o.down([c])}});return a(),()=>{s=!0,i.cancel(),d()}},{...he(),initial:n.cache,meta:{...r??{},...X("timeout",{timeoutNs:e})}})}var At,Dt,Ye,Mt,Tn=B(()=>{"use strict";mn();Be();Ae();se();De();ie();Ue();Ot();Ke();St();Ct();At=class extends Error{name="CircuitOpenError";constructor(){super("Circuit breaker is open")}};Dt=class extends Error{name="RateLimiterOverflowError";constructor(e){super(`rateLimiter buffer overflow (maxBuffer=${e})`)}};Ye=Object.freeze({droppedCount:0,pendingCount:0,paused:!1});Mt=class extends Error{name="TimeoutError";constructor(e){super(`Timed out after ${e/1e6}ms`)}}});var _n=B(()=>{"use strict";Tn()});var qr={};jn(qr,{NS_PER_MS:()=>re,NS_PER_SEC:()=>fe,ResilientPipelineGraph:()=>et,factoryTag:()=>X,placeholderArgs:()=>_t,resilientPipeline:()=>Kr});module.exports=Un(qr);De();Ot();kt();se();De();ie();Ke();function br(n){return{describeKind:"derived",...n}}function yr(n,e,t){let r,o=!1,s=()=>{o||(o=!0,t())};return r=n.subscribe(i=>{let a=!1,d=!1;for(let u of i)u[0]!==oe&&(u[0]===R?e.emit(u[1]):u[0]===S?a=!0:u[0]===k?(d=!0,e.down([u])):(u[0]===M||u[0]===D)&&e.down([u]));d?(r?.(),r=void 0,s()):a&&s()}),()=>{r?.(),r=void 0}}function ke(n,e,t){let r,o=!1;function s(){r?.(),r=void 0}return ne([n],(i,a,d)=>{if(d.terminalDeps[0]!=null&&d.terminalDeps[0]!==!0){s();return}if(d.terminalDeps[0]===!0){o=!0,r||a.down([[S]]);return}let u=i[0];if(!(u==null||u.length===0))return s(),r=yr(We(e(u[u.length-1])),a,()=>{s(),o&&a.down([[S]])}),{deactivate:()=>{s(),o=!1}}},{...br(t),completeWhenDepsComplete:!1,meta:{...X("switchMap"),...t?.meta??{}}})}_n();var j={object:56,array:64,string:40,number:8,boolean:4,null:0,undefined:0,symbol:40,bigint:16,function:120,map:72,set:72,mapEntry:40,setEntry:24,date:24,regexp:48,error:64,url:80,promise:48,weakmap:40,weakset:40},Cr=Symbol.for("sizeof");function Nn(n){let e=new WeakSet,t=new WeakSet,r=[n],o=0;for(;r.length>0;){let s=r.pop();o+=Ar(s,e,t,r)}return o}function Ar(n,e,t,r){if(n==null)return 0;switch(typeof n){case"number":return j.number;case"boolean":return j.boolean;case"string":return j.string+n.length*2;case"bigint":return j.bigint+Dr(n);case"symbol":return j.symbol;case"function":return e.has(n)?0:(e.add(n),j.function);case"undefined":return 0}let s=n;if(e.has(s))return 0;e.add(s);let i=s[Cr];if(typeof i=="function")try{let u=i.call(s);if(typeof u=="number"&&Number.isFinite(u))return u}catch{}if(s instanceof Date)return j.date;if(s instanceof RegExp)return j.regexp+s.source.length*2;if(s instanceof Error){let u=s.message?s.message.length*2:0,c=s.stack?s.stack.length*2:0;return j.error+u+c}if(typeof URL<"u"&&s instanceof URL)return j.url+s.href.length*2;if(typeof Promise<"u"&&s instanceof Promise)return j.promise;if(s instanceof WeakMap)return j.weakmap;if(s instanceof WeakSet)return j.weakset;if(s instanceof Map){let u=j.map;for(let[c,f]of s)u+=j.mapEntry,r.push(c),r.push(f);return u}if(s instanceof Set){let u=j.set;for(let c of s)u+=j.setEntry,r.push(c);return u}if(Array.isArray(s)){let u=j.array+s.length*8;for(let c of s)r.push(c);return u}if(s instanceof ArrayBuffer)return t.has(s)?0:(t.add(s),s.byteLength);if(ArrayBuffer.isView(s)){let u=s;return t.has(u.buffer)?48:(t.add(u.buffer),u.buffer.byteLength+48)}let a=j.object,d=Object.keys(s);for(let u of d){a+=j.string+u.length*2;try{r.push(s[u])}catch{}}return a}function Dr(n){let e=n<0n?-n:n;if(e===0n)return 0;let t=e.toString(2).length;return Math.ceil(t/32)*8}function On(n,e,t,r={}){let o=e in n.nodes,s=t in n.nodes;if(!o)return Je(e,t,"no-such-from");if(!s)return Je(e,t,"no-such-to");let i=r.maxDepth;if(i!=null&&(!Number.isInteger(i)||i<0))throw new Error("explainPath: maxDepth must be an integer >= 0");if(e===t){if(r.findCycle===!0){let u=Mr(n,e,r);if(u!=null)return u}let d=Ze(e,n.nodes[e],0,r);return Xe(e,t,[d])}if(i===0)return Je(e,t,"no-path");let a=kn(n,e,t,i);return a.found?Xe(e,t,xn(n,a.pathOrder,r)):Je(e,t,a.truncated?"max-depth-exceeded":"no-path")}function kn(n,e,t,r){let o=new Map,s=[{path:t,depth:0}],i=new Set([t]),a=0,d=!1;for(;a<s.length;){let f=s[a++];if(f.path===e)break;if(r!=null&&f.depth>=r){let g=n.nodes[f.path];g?.deps&&g.deps.length>0&&(d=!0);continue}let m=n.nodes[f.path];if(m==null)continue;let p=m.deps??[],l=new Map;for(let g=0;g<p.length;g++){let h=p[g];if(!h)continue;let T=l.get(h);T==null&&(T=[],l.set(h,T)),T.push(g)}for(let[g,h]of l)i.has(g)||(i.add(g),o.set(g,{from:f.path,depIndices:h}),s.push({path:g,depth:f.depth+1}))}if(!o.has(e))return{found:!1,pathOrder:[],truncated:d};let u=[{path:e}],c=e;for(;c!==t;){let f=o.get(c);if(f==null)return{found:!1,pathOrder:[],truncated:!1};u[u.length-1].depIndices=f.depIndices,u.push({path:f.from}),c=f.from}return{found:!0,pathOrder:u,truncated:!1}}function Mr(n,e,t){let r=n.nodes[e];if(r==null)return null;let o=r.deps??[],s=[];for(let a=0;a<o.length;a++)o[a]===e&&s.push(a);if(s.length>0){let a=Ze(e,r,0,t);a.dep_index=s[0];let d=Ze(e,r,1,t);return Xe(e,e,[a,d])}let i=null;for(let a=0;a<o.length;a++){let d=o[a];if(!d||d===e)continue;let u=kn(n,d,e,t.maxDepth);u.found&&(i==null||u.pathOrder.length<i.pathOrder.length)&&(i=u,i={found:!0,pathOrder:[{path:e,depIndices:[a]},...u.pathOrder],truncated:!1})}return i==null?null:Xe(e,e,xn(n,i.pathOrder,t))}function xn(n,e,t){return e.map((r,o)=>{let s=n.nodes[r.path],i=Ze(r.path,s,o,t);return r.depIndices!=null&&r.depIndices.length>0&&(i.dep_index=r.depIndices[0],r.depIndices.length>1&&(i.dep_indices=[...r.depIndices])),i})}function Ze(n,e,t,r){let o={path:n,type:e.type,hop:t};e.status!==void 0&&(o.status=e.status),"value"in e&&(o.value=e.value),e.v!=null&&(o.v=e.v);let s=r.annotations?.get(n)??e.annotation;s!=null&&(o.annotation=s);let i=r.lastMutations?.get(n)??e.lastMutation;return i!=null&&(o.lastMutation=i),o}function Xe(n,e,t){return En(n,e,!0,"ok",t)}function Je(n,e,t){return En(n,e,!1,t,[])}function En(n,e,t,r,o){let s=Gr(n,e,t,r,o);return{from:n,to:e,found:t,reason:r,steps:o,text:s,toJSON(){return{from:n,to:e,found:t,reason:r,steps:o}}}}function Gr(n,e,t,r,o){if(!t)switch(r){case"no-such-from":return`explainPath: no node named "${n}"`;case"no-such-to":return`explainPath: no node named "${e}"`;case"max-depth-exceeded":return`explainPath: no path from "${n}" to "${e}" within maxDepth`;default:return`explainPath: no path from "${n}" to "${e}"`}let s=[`Causal path: ${n} \u2192 ${e} (${o.length} step(s))`];for(let i of o){let d=` ${i.hop===0?"\xB7":"\u2193"} ${i.path} (${i.type}${i.status?`/${i.status}`:""})`;if(s.push(d),"value"in i&&s.push(` value: ${Pr(i.value)}`),i.annotation!=null&&s.push(` annotation: ${i.annotation}`),i.lastMutation!=null){let u=i.lastMutation.actor;s.push(` actor: ${u.type}${u.id?`:${u.id}`:""}`)}}return s.join(`
2
+ `)}function Pr(n){if(n===void 0)return"<sentinel>";if(n===null)return"null";if(typeof n=="string")return JSON.stringify(n);if(typeof n=="number"||typeof n=="boolean"||typeof n=="bigint")return String(n);try{let e=JSON.stringify(n);return e.length>80?`${e.slice(0,77)}...`:e}catch{return String(n)}}ct();Be();Ae();Ie();se();De();ie();Ue();Ae();function Bt(n,e){if(Object.is(n,e))return!0;if(n==null||e==null||typeof n!="object"||typeof e!="object")return!1;if(Array.isArray(n)){if(!Array.isArray(e)||n.length!==e.length)return!1;for(let s=0;s<n.length;s++)if(!Bt(n[s],e[s]))return!1;return!0}if(Array.isArray(e))return!1;let t=Object.keys(n),r=Object.keys(e);if(t.length!==r.length)return!1;let o=new Set(r);for(let s of t)if(!o.has(s)||!Bt(n[s],e[s]))return!1;return!0}function Rn(n,e){return`${n}\0${e}`}function Vt(n,e){let t=[],r=new Set(n.subgraphs),o=new Set(e.subgraphs),s=[];for(let h of o)r.has(h)||s.push(h);s.sort();for(let h of s)t.push({type:"subgraph-mounted",path:h});let i=new Set(Object.keys(n.nodes)),a=new Set(Object.keys(e.nodes)),d=[];for(let h of a)i.has(h)||d.push(h);d.sort();for(let h of d)t.push({type:"node-added",path:h,node:{...e.nodes[h]}});let u=[];for(let h of a){if(!i.has(h))continue;let T=n.nodes[h]?.meta,y=e.nodes[h]?.meta;T==null&&y==null||Bt(T??{},y??{})||u.push(h)}u.sort();for(let h of u)t.push({type:"node-meta-changed",path:h,prevMeta:n.nodes[h]?.meta??{},nextMeta:e.nodes[h]?.meta??{}});let c=new Map;for(let h of n.edges)c.set(Rn(h.from,h.to),h);let f=new Map;for(let h of e.edges)f.set(Rn(h.from,h.to),h);let m=[];for(let[h,T]of f)c.has(h)||m.push(T);m.sort((h,T)=>h.from<T.from?-1:h.from>T.from?1:h.to<T.to?-1:h.to>T.to?1:0);for(let h of m)t.push({type:"edge-added",from:h.from,to:h.to});let p=[];for(let[h,T]of c)f.has(h)||p.push(T);p.sort((h,T)=>h.from<T.from?-1:h.from>T.from?1:h.to<T.to?-1:h.to>T.to?1:0);for(let h of p)t.push({type:"edge-removed",from:h.from,to:h.to});let l=[];for(let h of i)a.has(h)||l.push(h);l.sort();for(let h of l)t.push({type:"node-removed",path:h});let g=[];for(let h of r)o.has(h)||g.push(h);g.sort();for(let h of g)t.push({type:"subgraph-unmounted",path:h});return{events:t,flushedAt_ns:Z()}}Ke();St();Ct();dt();ie();function Sn(n,e){let t=e?.topN??10,r=n.describe({detail:"standard"}),o=[],s=n._collectObserveTargets;typeof s=="function"&&s.call(n,"",o);let i=new Map;for(let[m,p]of o)i.set(m,p);let a=[];for(let[m,p]of Object.entries(r.nodes)){let l=i.get(m),g=l instanceof V?l:null,h=g?Nn(g.cache):0,T=g?g._sinkCount:0,y=p.deps?.length??0,b=p.type==="effect"&&T===0,v=T===0?p.type==="effect"?"orphan-effect":p.type==="derived"?"idle-derived":p.type==="producer"?"idle-producer":null:null;a.push({path:m,type:p.type,status:p.status??"unknown",valueSizeBytes:h,subscriberCount:T,depCount:y,isOrphanEffect:b,orphanKind:v})}let d=a.reduce((m,p)=>m+p.valueSizeBytes,0),u=(m,p)=>[...a].sort(p??((l,g)=>g[m]-l[m])).slice(0,t),c=a.filter(m=>m.orphanKind!=null),f=a.filter(m=>m.isOrphanEffect);return{nodeCount:a.length,edgeCount:r.edges.length,subgraphCount:r.subgraphs.length,nodes:a,totalValueSizeBytes:d,hotspots:{byValueSize:u("valueSizeBytes"),bySubscriberCount:u("subscriberCount"),byDepCount:u("depCount")},orphans:c,orphanEffects:f}}var L="::",Q="__meta__",me=1;function Cn(n,e){let t=Math.max(16,n.size*4),r=0;for(;n.size>0;){if(r++>=t){console.error(`[Graph "${e}".destroy] disposer drain exceeded cap (${t}); ${n.size} disposer(s) discarded`),n.clear();return}let o=n.values().next();if(o.done)return;let s=o.value;n.delete(s);try{s()}catch(i){console.error(`[Graph "${e}".destroy] disposer threw:`,i)}}}function Pn(n){return n!=null&&typeof n=="object"&&"cache"in n&&typeof n.subscribe=="function"&&typeof n.down=="function"}function Ir(n){if(n!=null)return Pn(n)?n.cache:n}function ge(n){return n!=null&&typeof n=="object"&&"cache"in n&&typeof n.subscribe=="function"&&typeof n.down=="function"}function ue(n){return ge(n)?n.cache??"":n}function An(n){return ge(n)?n.cache??0:n}function Dn(n){return ge(n)?n.cache??!1:n}function Lr(n){let e=[];for(let t of Object.keys(n).sort()){let r=n[t].v;r!=null&&e.push(`${t} ${r.id} ${r.version}`)}return e.join(`
3
+ `)}function Mn(n){if(n.version!==me)throw new Error(`unsupported snapshot version ${String(n.version)} (expected ${me})`);for(let e of["name","nodes","edges","subgraphs"])if(!(e in n))throw new Error(`snapshot missing required key "${e}"`);if(typeof n.name!="string")throw new TypeError("snapshot 'name' must be a string");if(typeof n.nodes!="object"||n.nodes===null||Array.isArray(n.nodes))throw new TypeError("snapshot 'nodes' must be an object");if(!Array.isArray(n.edges))throw new TypeError("snapshot 'edges' must be an array");if(!Array.isArray(n.subgraphs))throw new TypeError("snapshot 'subgraphs' must be an array")}function $r(n,e){let t=new WeakMap,r=(o,s)=>{if(Object.is(o,s))return!0;if(o==null||s==null||typeof o!="object"||typeof s!="object")return!1;let i=t.get(o);if(i==null&&(i=new WeakSet,t.set(o,i)),i.has(s))return!0;i.add(s);let a=o.constructor,d=s.constructor;if(a!==d)return!1;if(o instanceof Date)return o.getTime()===s.getTime();if(o instanceof RegExp)return o.source===s.source&&o.flags===s.flags;if(Array.isArray(o)){let m=s;if(o.length!==m.length)return!1;for(let p=0;p<o.length;p++)if(!r(o[p],m[p]))return!1;return!0}if(o instanceof Map){let m=s;if(o.size!==m.size)return!1;for(let[p,l]of o)if(!m.has(p)||!r(l,m.get(p)))return!1;return!0}if(o instanceof Set){let m=s;if(o.size!==m.size)return!1;for(let p of o){let l=!1;for(let g of m)if(r(p,g)){l=!0;break}if(!l)return!1}return!0}if(ArrayBuffer.isView(o)){let m=o,p=s;if(m.length!==p.length)return!1;for(let l=0;l<m.length;l++)if(m[l]!==p[l])return!1;return!0}let u=Object.keys(o),c=Object.keys(s);if(u.length!==c.length)return!1;let f=new Set(c);for(let m of u)if(!f.has(m)||!r(o[m],s[m]))return!1;return!0};return r(n,e)}function Fr(n){return n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Qe(n){let e="^";for(let t=0;t<n.length;t+=1){let r=n[t];if(r==="*"){e+=".*";continue}if(r==="?"){e+=".";continue}if(r==="["){let o=n.indexOf("]",t+1);if(o<=t+1){e+="\\[";continue}let s=n.slice(t+1,o);s.startsWith("!")&&(s=`^${s.slice(1)}`),s=s.replace(/\\/g,"\\\\"),e+=`[${s}]`,t=o;continue}e+=Fr(r)}return e+="$",new RegExp(e)}var Br={data:"\x1B[32m",dirty:"\x1B[33m",resolved:"\x1B[36m",invalidate:"\x1B[93m",pause:"\x1B[90m",resume:"\x1B[96m",complete:"\x1B[34m",error:"\x1B[31m",teardown:"\x1B[91m",derived:"\x1B[35m",path:"\x1B[90m",reset:"\x1B[0m"},Vr={data:"",dirty:"",resolved:"",invalidate:"",pause:"",resume:"",complete:"",error:"",teardown:"",derived:"",path:"",reset:""};function jt(n){if(typeof n=="string")return JSON.stringify(n);if(typeof n=="number"||typeof n=="boolean"||n==null)return String(n);try{return JSON.stringify(n)}catch{return"[unserializable]"}}function jr(n){return n==="none"?Vr:n==="ansi"||n==null?Br:{data:n.data??"",dirty:n.dirty??"",resolved:n.resolved??"",invalidate:n.invalidate??"",pause:n.pause??"",resume:n.resume??"",complete:n.complete??"",error:n.error??"",teardown:n.teardown??"",derived:n.derived??"",path:n.path??"",reset:n.reset??""}}function Gn(n){if(n==null)return{};let e=n.detail;return e==="full"?{...n,structured:n.structured??!0,timeline:n.timeline??!0,causal:n.causal??!0,derived:n.derived??!0}:e==="minimal"?{...n,structured:n.structured??!0}:n.format==="stage-log"?{...n,structured:n.structured??!0,timeline:n.timeline??!0}:n}function zr(n,e,t){for(let r=0;r<n.length;r++){let o=n.charCodeAt(r);if(o<32||o===127)throw new Error(`Graph "${e}": ${t} "${n}" must not contain control character (U+${o.toString(16).padStart(4,"0").toUpperCase()} at index ${r})`)}}function zt(n,e,t){if(n==="")throw new Error(`Graph "${e}": ${t} name must be non-empty`);if(n.includes(L))throw new Error(`Graph "${e}": ${t} "${n}" must not contain '${L}' (path separator)`);if(n===Q)throw new Error(`Graph "${e}": ${t} name "${Q}" is reserved for meta companion paths`);zr(n,e,t)}function Ur(n,e){if(n==="")throw new Error(`Graph "${e}": resolve path must be non-empty`);let t=n.split(L);for(let r of t)if(r==="")throw new Error(`Graph "${e}": resolve path has empty segment`);return t}function Wr(n,e){let t=!1;for(let o of n)if(!e.isMetaPassthrough(o[0])){t=!0;break}return t?n.filter(o=>e.isMetaPassthrough(o[0])):n}function In(n){for(let e of n._mounts.values())In(e);for(let e of n._nodes.values())try{e.down([[$]],{internal:!0})}catch{}}var xe=class n{name;opts;config;_nodes=new Map;_nodeToName=new WeakMap;_mounts=new Map;_parent=void 0;_storageDisposers=new Set;_disposers=new Set;_destroyed=!1;_topology;_topologyEmitters=new Set;_factory;_factoryArgs;constructor(e,t){if(e==="")throw new Error("Graph name must be non-empty");if(e.includes(L))throw new Error(`Graph name must not contain '${L}' (got "${e}")`);if(e===Q)throw new Error(`Graph name "${Q}" is reserved for meta companion paths`);this.name=e,this.opts=Object.freeze({...t??{}}),this.config=t?.config??Ne,this._traceRing=new pe(t?.traceCapacity??1e3),t?.versioning!=null&&this.setVersioning(t.versioning),typeof t?.factory=="string"&&(this._factory=t.factory,t.factoryArgs!==void 0&&(this._factoryArgs=t.factoryArgs))}tagFactory(e,t){return this._factory=e,this._factoryArgs=t,this}ancestors(e=!0){let t=[],r=e?this:this._parent;for(;r!=null;)t.push(r),r=r._parent;return t}get topology(){return this._topology==null&&(this._topology=K(e=>{let t=r=>{e.emit(r)};return this._topologyEmitters.add(t),()=>{this._topologyEmitters.delete(t)}},{name:`${this.name}_topology`})),this._topology}_emitTopology(e){if(!(this._topology==null||this._topologyEmitters.size===0))for(let t of this._topologyEmitters)t(e)}nameOf(e){return this._nodeToName.get(e)}add(e,t){let r=e.name,o=t?.name??r;if(o==null||o==="")throw new Error(`Graph "${this.name}": graph.add requires a non-empty name \u2014 pass via opts.name or set it on the node (e.g. state(0, { name: "x" }))`);let s=o,i=t?.annotation;if(zt(s,this.name,"add"),this._mounts.has(s))throw new Error(`Graph "${this.name}": name "${s}" is already a mount point`);if(this._nodes.has(s))throw new Error(`Graph "${this.name}": node "${s}" already exists`);let a=this._nodeToName.get(e);if(a!==void 0)throw new Error(`Graph "${this.name}": node instance already registered as "${a}"`);return this._nodes.set(s,e),this._nodeToName.set(e,s),this._emitTopology({kind:"added",name:s,nodeKind:"node"}),i!=null&&(this._annotations.set(s,i),this.config.inspectorEnabled&&this._traceRing.push({path:s,annotation:i,timestamp_ns:Z()})),e}setVersioning(e){if(e!=null)for(let t of this._nodes.values())t instanceof V&&t._applyVersioning(e)}remove(e){zt(e,this.name,"remove");let t=this._mounts.get(e);if(t){let s={kind:"mount",nodes:[],mounts:[]},i=[];t._collectObserveTargets("",i);for(let[a,d]of i)a.includes(`${L}${Q}${L}`)||s.nodes.push(a);return s.nodes.sort(),s.mounts.push(e),s.mounts.push(...t._collectSubgraphs(`${e}${L}`)),this._mounts.delete(e),t._parent=void 0,In(t),this._emitTopology({kind:"removed",name:e,nodeKind:"mount",audit:s}),s}let r=this._nodes.get(e);if(!r)throw new Error(`Graph "${this.name}": unknown node or mount "${e}"`);this._nodes.delete(e),this._nodeToName.delete(r),r.down([[$]],{internal:!0});let o={kind:"node",nodes:[e],mounts:[]};return this._emitTopology({kind:"removed",name:e,nodeKind:"node",audit:o}),o}removeAll(e){let t=typeof e=="function"?e:(()=>{let s=Qe(e);return i=>s.test(i)})(),r={kind:"mount",nodes:[],mounts:[]},o=[...this._nodes.keys(),...this._mounts.keys()].filter(s=>t(s));for(let s of o){let i=this.remove(s);r.nodes.push(...i.nodes),r.mounts.push(...i.mounts)}return r.nodes.sort(),r.mounts.sort(),r}[Symbol.iterator](){let e=[...this._nodes.keys()].sort(),t=this._nodes,r=0;return{[Symbol.iterator](){return this},next(){if(r>=e.length)return{value:void 0,done:!0};let o=e[r++];return{value:[o,t.get(o)],done:!1}}}}node(e){if(e==="")throw new Error(`Graph "${this.name}": node name must be non-empty`);if(e.includes(L))return this.resolve(e);let t=this._nodes.get(e);if(!t)throw new Error(`Graph "${this.name}": unknown node "${e}"`);return t}get(e){return this.node(e).cache}set(e,t,r){let o=r?.internal===!0;this.node(e).down([[R,t]],{actor:r?.actor,internal:o,delivery:"write"})}setAll(e,t){let r=Symbol.iterator in e?e:Object.entries(e);Ce(()=>{for(let[o,s]of r)this.set(o,s,t)})}invalidate(e,t){let r=t?.internal===!0;this.node(e).down([[ee]],{actor:t?.actor,internal:r,delivery:"write"})}error(e,t,r){let o=r?.internal===!0;this.node(e).down([[k,t]],{actor:r?.actor,internal:o,delivery:"write"})}complete(e,t){let r=t?.internal===!0;this.node(e).down([[S]],{actor:t?.actor,internal:r,delivery:"write"})}edges(e){let t=e?.recursive===!0,r=new Map;if(!t){for(let[d,u]of this._nodes)r.set(u,d);let a=[];for(let[d,u]of this._nodes)if(u instanceof V)for(let c of u._deps){let f=r.get(c.node);f!=null&&a.push([f,d])}return a.sort((d,u)=>d[0]<u[0]?-1:d[0]>u[0]?1:d[1]<u[1]?-1:d[1]>u[1]?1:0),a}let o=[];this._collectObserveTargets("",o);let s=new Map;for(let[a,d]of o)s.set(d,a);let i=[];for(let[a,d]of o)if(d instanceof V)for(let u of d._deps){let c=s.get(u.node);c!=null&&i.push([c,a])}return i.sort((a,d)=>a[0]<d[0]?-1:a[0]>d[0]?1:a[1]<d[1]?-1:a[1]>d[1]?1:0),i}mount(e,t){if(t===void 0){let o=new n(e);return this.mount(e,o)}if(typeof t=="function"){let o=new n(e);return t(o),this.mount(e,o)}let r=t;if(zt(e,this.name,"mount"),this._nodes.has(e))throw new Error(`Graph "${this.name}": cannot mount at "${e}" \u2014 node with that name exists`);if(this._mounts.has(e))throw new Error(`Graph "${this.name}": mount "${e}" already exists`);if(r===this)throw new Error(`Graph "${this.name}": cannot mount a graph into itself`);if(r._parent!=null)throw new Error(`Graph "${this.name}": this child graph is already mounted on "${r._parent.name}"`);for(let o=this;o!=null;o=o._parent)if(o===r)throw new Error(`Graph "${this.name}": mount("${e}", \u2026) would create a mount cycle`);return this._mounts.set(e,r),r._parent=this,this._emitTopology({kind:"added",name:e,nodeKind:"mount"}),r}resolve(e){let t=Ur(e,this.name);return this._resolveFromSegments(t)}tryResolve(e){try{return this.resolve(e)}catch{return}}_resolveFromSegments(e){let t=e;if(t[0]===this.name&&(t=t.slice(1),t.length===0))throw new Error(`Graph "${this.name}": resolve path ends at graph name only`);let r=t[0],o=t.slice(1);if(o.length===0){let a=this._nodes.get(r);if(a)return a;throw this._mounts.has(r)?new Error(`Graph "${this.name}": path ends at subgraph "${r}" \u2014 not a node (GRAPHREFLY-SPEC \xA73.5)`):new Error(`Graph "${this.name}": unknown name "${r}"`)}let s=this._nodes.get(r);if(s&&o.length>0&&o[0]===Q)return this._resolveMetaChainFromNode(s,o,t.join(L));let i=this._mounts.get(r);if(!i)throw this._nodes.has(r)?new Error(`Graph "${this.name}": "${r}" is a node; trailing path "${o.join(L)}" is invalid`):new Error(`Graph "${this.name}": unknown mount or node "${r}"`);return i.resolve(o.join(L))}_resolveMetaChainFromNode(e,t,r){let o=e,s=0,i=[...t];for(;s<i.length;){if(i[s]!==Q)throw new Error(`Graph "${this.name}": expected ${Q} segment in meta path "${r}"`);if(s+1>=i.length)throw new Error(`Graph "${this.name}": meta path requires a key after ${Q} in "${r}"`);let a=i[s+1],d=o.meta[a];if(!d)throw new Error(`Graph "${this.name}": unknown meta "${a}" in path "${r}"`);o=d,s+=2}return o}signal(e,t){if(t?.internal!==!0){for(let o of e)if(this.config.messageTier(o[0])===3)throw new Error(`Graph "${this.name}": Graph.signal() rejects tier-3 messages (DATA / RESOLVED). Broadcast is for control-plane tiers (START / DIRTY / INVALIDATE / PAUSE / RESUME / COMPLETE / ERROR / TEARDOWN). For per-node value writes, use Graph.set or graph.node(name).down(...).`)}let r=[];if(this._signalDeliver(e,t??{},new Set,r),r.length>0)throw r[0]}_signalDeliver(e,t,r,o){for(let d of this._mounts.values())d._signalDeliver(e,t,r,o);let i=t.internal===!0?{internal:!0}:{actor:t.actor,delivery:"signal"},a=Wr(e,this.config);for(let d of[...this._nodes.keys()].sort()){let u=this._nodes.get(d);if(!r.has(u)){r.add(u);try{u.down(e,i)}catch(c){if(c instanceof J)throw c;o.push(c)}a.length!==0&&this._signalMetaSubtree(u,a,r,i,o)}}}_signalMetaSubtree(e,t,r,o,s){for(let i of Object.keys(e.meta).sort()){let a=e.meta[i];if(!r.has(a)){r.add(a);try{a.down(t,o)}catch(d){if(d instanceof J)throw d;s.push(d)}this._signalMetaSubtree(a,t,r,o,s)}}}describe(e){if(e?.reactive==="diff")return this._describeReactiveDiff(e);if(e?.reactive===!0)return this._describeReactive(e);let t=Ir(e?.actor),r=e?.filter;if(e?.detail!=null&&e?.fields!=null)throw new TypeError("Graph.describe(): pass either `detail` or `fields`, not both. `detail: 'spec'` is the canonical spec projection; use `fields` only when you need a custom subset.");let o=Tt(e?.detail,e?.fields),s=e?.detail==="spec",i=o,a=[];this._collectObserveTargets("",a);let d=new Map;for(let[v,w]of a)d.set(w,v);let u=[];{let v=a.map(([,x])=>x),w=new Set(d.values()),_=0;for(;v.length>0;){let x=v.shift();if(x instanceof V)for(let E of x._deps){let C=E.node;if(d.has(C))continue;let A=C.name??"",O=A;if(!O||w.has(O))if(A){let z=2;for(;w.has(`${A}#${z}`);)z++;O=`${A}#${z}`}else for(O=`__internal__/${_++}`;w.has(O);)O=`__internal__/${_++}`;d.set(C,O),w.add(O),u.push([O,C]),v.push(C)}}}let c=[...a,...u],f={};for(let[v,w]of c){if(t!=null&&!w.allowsObserve(t))continue;let _=Nt(w,i,s),x=w instanceof V?w._deps.map(O=>d.get(O.node)??O.node.name??""):[],{name:E,...C}=_,A={...C,deps:x};if(!s){let O=this._annotations.get(v);O!=null&&(A.annotation=O)}if(r!=null)if(typeof r=="function"){let O=r;if(!(O.length>=2?O(v,A):O(A)))continue}else{let O=!0;for(let[z,F]of Object.entries(r)){let P=z==="deps_includes"?"depsIncludes":z==="meta_has"?"metaHas":z;if(P==="depsIncludes"){if(!A.deps.includes(String(F))){O=!1;break}continue}if(P==="metaHas"){if(!Object.hasOwn(A.meta??{},String(F))){O=!1;break}continue}if(A[P]!==F){O=!1;break}}if(!O)continue}f[v]=A}let m=new Set(Object.keys(f)),p=[];for(let[v,w]of c)if(w instanceof V)for(let _ of w._deps){let x=d.get(_.node);x!=null&&p.push([x,v])}p.sort((v,w)=>v[0]<w[0]?-1:v[0]>w[0]?1:v[1]<w[1]?-1:v[1]>w[1]?1:0);let l=p.map(([v,w])=>({from:v,to:w}));(t!=null||r!=null)&&(l=l.filter(v=>m.has(v.from)&&m.has(v.to)));let g=this._collectSubgraphs(""),h=t!=null||r!=null?g.filter(v=>{let w=`${v}${L}`;return[...m].some(_=>_===v||_.startsWith(w))}):g,T=this,y=e;return{name:this.name,nodes:f,edges:l,subgraphs:h,...this._factory!==void 0?{factory:this._factory}:{},...this._factoryArgs!==void 0?{factoryArgs:this._factoryArgs}:{},expand(v){let w={...y};return Array.isArray(v)?(w.fields=v,w.detail=void 0):(w.detail=v,w.fields=void 0),T.describe(w)}}}_collectSubgraphs(e){let t=[];for(let r of[...this._mounts.keys()].sort()){let o=e===""?r:`${e}${r}`;t.push(o),t.push(...this._mounts.get(r)._collectSubgraphs(`${o}${L}`))}return t}resourceProfile(e){return Sn(this,e)}reachable(e,t,r={}){return r.withDetail===!0?Ut(this.describe(),e,t,{...r,withDetail:!0}):Ut(this.describe(),e,t,r)}explain(e,t,r){return r?.reactive===!0?this._explainReactive(e,t,r):this._explainStatic(ue(e),ue(t),{...r?.maxDepth!==void 0?{maxDepth:An(r.maxDepth)}:{},...r?.findCycle!==void 0?{findCycle:Dn(r.findCycle)}:{}})}_explainStatic(e,t,r){let o=this.describe({detail:"full"}),s=new Map(this._annotations),i=new Map;for(let[a,d]of Object.entries(o.nodes))d.lastMutation!=null&&i.set(a,d.lastMutation);return On(o,e,t,{...r?.maxDepth!=null?{maxDepth:r.maxDepth}:{},...r?.findCycle===!0?{findCycle:!0}:{},annotations:s,lastMutations:i})}_describeReactive(e){let t={...e,reactive:!1},r=e.reactiveName??"describe",o=0,s=Oe(o,{name:`${r}_version`}),i=this.observe({timeline:!0,structured:!0}),a=!1,d=!1,u=()=>{a||d||(a=!0,Te(()=>{a=!1,!d&&(o+=1,s.emit(o))}))},c=i.onEvent(y=>{let b=y.type;b!=="data"&&b!=="error"&&b!=="complete"&&b!=="teardown"||u()}),f=[],m=new WeakSet,p=y=>{if(m.has(y)||d)return;m.add(y);let b=y.topology.subscribe(v=>{for(let w of v){if(w[0]!==R)continue;let _=w[1];if(u(),_.kind==="added"&&_.nodeKind==="mount"){let x=y._mounts.get(_.name);x!=null&&p(x)}}});f.push(b);for(let v of y._mounts.keys()){let w=y._mounts.get(v);w!=null&&p(w)}};p(this);let l,g=e.actor;Pn(g)&&(l=g.subscribe(y=>{let b=!1,v=!1;for(let w of y){let _=w[0];_===R?b=!0:(_===S||_===k||_===$)&&(v=!0)}b&&u(),v&&(l?.(),l=void 0,u())}));let h;try{h=xt([s],()=>this.describe(t),{name:r,describeKind:"derived",meta:{domain:"audit",kind:"describe"},equals:(y,b)=>y===b})}catch(y){c(),l?.();for(let b of f)b();throw i.dispose(),y}let T=He(h);return{node:h,dispose(){d=!0,c(),l?.();for(let y of f)y();f.length=0,i.dispose(),T()}}}_describeReactiveDiff(e){let t={...e,reactive:!1},r=e.reactiveName??"describe-diff",o={name:this.name,nodes:{},edges:[],subgraphs:[]},s=this.describe(t),i=Vt(o,s),a=Oe(i,{name:r,meta:{domain:"audit",kind:"describe-diff"},equals:(m,p)=>m===p}),d=this._describeReactive({...e,reactiveName:void 0}),u=!1,c=d.node.subscribe(m=>{if(!u)for(let p of m){if(p[0]!==R)continue;let l=p[1],g=Vt(s,l);s=l,g.events.length!==0&&a.emit(g)}}),f=He(a);return{node:a,dispose(){u=!0,c(),d.dispose(),a.down([[$,"describe-diff disposed"]]),f()}}}_explainReactive(e,t,r){let o=0,s=Oe(o,{name:"explain_version"}),i=this.observe({timeline:!0,structured:!0}),a=!1,d=!1,u=()=>{a||d||(a=!0,Te(()=>{a=!1,!d&&(o+=1,s.emit(o))}))},c=i.onEvent(y=>{let b=y.type;b!=="data"&&b!=="error"&&b!=="complete"&&b!=="teardown"||u()}),f=[];e!=null&&ge(e)&&f.push(e),t!=null&&ge(t)&&f.push(t),r?.maxDepth!=null&&ge(r.maxDepth)&&f.push(r.maxDepth),r?.findCycle!=null&&ge(r.findCycle)&&f.push(r.findCycle);let m=()=>{for(let y of f)if(y.cache===void 0)return!1;return!0},p=()=>{let y=ue(e),b=ue(t);return{from:y,to:b,found:!1,reason:"pending",steps:[],text:"(awaiting reactive args)",toJSON:()=>({from:y,to:b,found:!1,reason:"pending",steps:[]})}},l;try{l=xt([s],()=>{if(!m())return p();let y=ue(e),b=ue(t),v={...r?.maxDepth!==void 0?{maxDepth:An(r.maxDepth)}:{},...r?.findCycle!==void 0?{findCycle:Dn(r.findCycle)}:{}};return this._explainStatic(y,b,v)},{name:r?.name??"explain",describeKind:"derived",meta:{domain:"audit",kind:"explain_path",from:ue(e),to:ue(t)},equals:(y,b)=>y.found===b.found&&y.reason===b.reason&&y.steps.length===b.steps.length&&Hr(y.steps,b.steps)})}catch(y){throw c(),i.dispose(),y}let g=He(l),h=[],T=y=>{let b;return b=y.subscribe(v=>{let w=!1,_=!1;for(let x of v){let E=x[0];E===R?w=!0:(E===S||E===k||E===$)&&(_=!0)}(w||_)&&u(),_&&b&&(b(),b=void 0)}),()=>{b&&(b(),b=void 0)}};for(let y of f)h.push(T(y));return{node:l,dispose(){d=!0,c();for(let y of h)y?.();h.length=0,i.dispose(),g()}}}_pathsMatching(e){let t=Qe(e),r=[];return this._collectObserveTargets("",r),r.map(([o])=>o).filter(o=>t.test(o))}_collectObserveTargets(e,t){for(let r of[...this._mounts.keys()].sort()){let o=e===""?r:`${e}${L}${r}`;this._mounts.get(r)._collectObserveTargets(o,t)}for(let r of[...this._nodes.keys()].sort()){let o=this._nodes.get(r),s=e===""?r:`${e}${L}${r}`;t.push([s,o]),this._appendMetaObserveTargets(s,o,t)}}_appendMetaObserveTargets(e,t,r){for(let o of Object.keys(t.meta).sort()){let s=t.meta[o],i=`${e}${L}${Q}${L}${o}`;r.push([i,s]),this._appendMetaObserveTargets(i,s,r)}}observe(e,t){let r=typeof e=="string",s=Gn(r?t:e);if(s.reactive===!0)return this._observeReactive(r?e:void 0,s);let i=s.structured===!0||s.timeline===!0||s.causal===!0||s.derived===!0||s.detail==="minimal"||s.detail==="full"||s.format!=null,a=s.actor;if(r){let c=e,f=this.resolve(c);if(a!=null&&!f.allowsObserve(a))throw new J({actor:a,action:"observe",nodeName:c});return i?this._buildStructuredObserver([[c,f]],s,"one"):{subscribe(m){return f.subscribe(m)},up(m){try{f.up?.(m)}catch(p){if(p instanceof J)return;throw p}}}}let d=[];this._collectObserveTargets("",d),d.sort((c,f)=>c[0]<f[0]?-1:c[0]>f[0]?1:0);let u=a==null?d:d.filter(([,c])=>c.allowsObserve(a));return i?this._buildStructuredObserver(u,s,"all"):{subscribe:c=>{let f=u.map(([m,p])=>p.subscribe(l=>{c(m,l)}));return()=>{for(let m of f)m()}},up:(c,f)=>{try{this.resolve(c).up?.(f)}catch(m){if(m instanceof J)return;throw m}}}}_observeReactive(e,t){let r=t.tiers,o=r!=null?new Set(r):null,s=t.reactiveName??"observe";return K(i=>{let a=[],d=!1,u=!1,c=()=>{if(a.length===0||u)return;let g={events:a.slice(),flushedAt_ns:Z()};a.length=0,i.emit(g)},f={...t,reactive:!1,structured:!0,timeline:!0},m=e!=null?this.observe(e,f):this.observe(f),p=g=>{u||(a.push(g),!d&&(d=!0,Te(()=>{d=!1,c()})))};for(let g of m.events)p(g);let l=m.onEvent(p);return()=>{u=!0,l(),m.dispose()}},{name:s,meta:{domain:"audit",kind:"observe-reactive"}})}_buildStructuredObserver(e,t,r){let o=r==="one"?e[0]?.[0]:void 0,s=i=>{if(r==="one"&&o!=null){let c=this.resolve(o);return this._buildStructuredObserver([[o,c]],i,"one")}let a=[];this._collectObserveTargets("",a),a.sort((c,f)=>c[0]<f[0]?-1:c[0]>f[0]?1:0);let d=i.actor,u=d==null?a:a.filter(([,c])=>c.allowsObserve(d));return this._buildStructuredObserver(u,i,"all")};return this._createObserveResult(e,t,s)}_createObserveResult(e,t,r){let o=t.timeline===!0,s=t.causal===!0,i=t.derived===!0,a=t.detail==="minimal",d=this.config.inspectorEnabled,u=(s||i)&&d,c=t.maxEvents,f=c!=null&&c>0?new pe(c):null,m=[],p=new Set,l=t.tiers!=null?new Set(t.tiers):null,g={},h=new Set,T=0,y=0,b=0,v=0,w=0,_=0,x=!1,E=!1,C=0,A=new Map,O=new Map,z=new Map,F=N=>{if(!(l!=null&&!l.has(N.type))){f?f.push(N):m.push(N);for(let I of p)I(N)}},P=N=>l==null||l.has(N),be=()=>o?{timestamp_ns:Z(),in_batch:$e(),batch_id:C}:{},tt=(N,I)=>{if(!(!u||!(N instanceof V)))return N._setInspectorHook(q=>{if(q.kind==="dep_message")A.set(N,q.depIndex);else if(q.kind==="run"){let Ee=q.batchData.map((G,W)=>G!=null&&G.length>0?G.at(-1):q.prevData[W]);O.set(N,Ee);let Y=q.batchData.map(G=>G!=null?[...G]:void 0);z.set(N,Y),i&&F({type:"derived",path:I,dep_values:Ee,dep_batches:Y,...be()})}})},Ge=N=>{let I=A.get(N),q=O.get(N);if(!s||q==null)return{};let Y=(I!=null&&I>=0&&N instanceof V?N._deps[I]:void 0)?.node,G=Y?.v,W=z.get(N);return{trigger_dep_index:I,trigger_dep_name:Y?.name,...G!=null?{trigger_version:{id:G.id,version:G.version}}:{},dep_values:[...q],...W!=null?{dep_batches:W}:{}}},Wt=[],Ht=[];for(let[N,I]of e){let q=tt(I,N);q&&Wt.push(q),Ht.push(I.subscribe(Ee=>{C++;for(let Y of Ee){let G=Y[0],W=be();if(G===R){g[N]=Y[1];let st=I instanceof V?I.lastMutation?.actor??ye:ye;F({type:"data",path:N,data:Y[1],actor:st,...W,...Ge(I)})}else if(a)G===M?P("dirty")&&T++:G===D?P("resolved")&&y++:G===ee?P("invalidate")&&b++:G===H?P("pause")&&v++:G===te?P("resume")&&w++:G===$?P("teardown")&&_++:G===S&&!h.has(N)?P("complete")&&(x=!0):G===k&&P("error")&&(E=!0,h.add(N));else if(G===M)P("dirty")&&T++,F({type:"dirty",path:N,...W});else if(G===D)P("resolved")&&y++,F({type:"resolved",path:N,...W,...Ge(I)});else if(G===ee)P("invalidate")&&b++,F({type:"invalidate",path:N,...W});else if(G===H)P("pause")&&v++,F({type:"pause",path:N,lockId:Y[1],...W});else if(G===te)P("resume")&&w++,F({type:"resume",path:N,lockId:Y[1],...W});else if(G===S)P("complete")&&!h.has(N)&&(x=!0),F({type:"complete",path:N,...W});else if(G===k){P("error")&&(E=!0,h.add(N));let st=I instanceof V?I.lastMutation?.actor??ye:ye;F({type:"error",path:N,data:Y[1],actor:st,...W})}else G===$&&(P("teardown")&&_++,F({type:"teardown",path:N,...W}))}}))}let nt=!1,rt=()=>{if(!nt){nt=!0;for(let N of Ht)N();for(let N of Wt)N();for(let N of Pe)N({value:void 0,done:!0});Pe.length=0}},ot=[],Pe=[];p.add(N=>{let I=Pe.shift();I?I({value:N,done:!1}):ot.push(N)});let Kt={get values(){return g},get dirtyCount(){return T},get resolvedCount(){return y},get invalidateCount(){return b},get pauseCount(){return v},get resumeCount(){return w},get teardownCount(){return _},get events(){return f?f.toArray():[...m]},get anyCompletedCleanly(){return x},get anyErrored(){return E},get completedWithoutErrors(){return x&&!E},onEvent(N){return p.add(N),()=>p.delete(N)},dispose:rt,expand(N){rt();let I={...t};return typeof N=="string"?I.detail=N:Object.assign(I,N),r(Gn(I))},[Symbol.asyncIterator](){return{next(){return ot.length>0?Promise.resolve({value:ot.shift(),done:!1}):nt?Promise.resolve({value:void 0,done:!0}):new Promise(N=>Pe.push(N))},return(){return rt(),Promise.resolve({value:void 0,done:!0})}}}};return t.format!=null&&this._attachFormatLogger(Kt,t),Kt}_attachFormatLogger(e,t){let r=t.format;if(r==null)return;let o=t.logger??(l=>console.log(l)),s=t.includeTypes?new Set(t.includeTypes):null,i=t.excludeTypes?new Set(t.excludeTypes):null,a=s==null&&i==null?()=>!0:l=>(s==null||s.has(l))&&(i==null||!i.has(l)),d=jr(t.theme),u=r==="stage-log"?Z():0,c=l=>l==null?"":t.stageLabels?.[l]??l,f=(l,g)=>l.length>g?`${l.slice(0,g-1)}\u2026`:l,m=l=>l.type==="data"||l.type==="error"?f(jt(l.data),120):"",p=l=>{if(r==="stage-log"){let x=(Z()-u)/1e9,E=c(l.path).padEnd(9);if(l.type==="data"){let C=m(l);return`[${x.toFixed(3)}s] ${E} \u2190${C?` ${C}`:""}`}if(l.type==="error"){let C=m(l);return`[${x.toFixed(3)}s] ${E} \u2717${C?` ${C}`:""}`}return l.type==="complete"?`[${x.toFixed(3)}s] ${E} \u25A0 complete`:`[${x.toFixed(3)}s] ${E} ${l.type}`}if(r==="json")try{return JSON.stringify(l)}catch{return JSON.stringify({type:l.type,path:l.path,data:"[unserializable]"})}let g=d[l.type]??"",h=l.path?`${d.path}${l.path}${d.reset} `:"",T=l.type==="data"||l.type==="error",y=l.type==="pause"||l.type==="resume",b=T?` ${jt(l.data)}`:y?` ${jt(l.lockId)}`:"",v=l.type==="data"||l.type==="resolved"||l.type==="derived"?l:void 0,w=v?.trigger_dep_name!=null?` <- ${v.trigger_dep_name}`:v?.trigger_dep_index!=null?` <- #${v.trigger_dep_index}`:"",_=l.in_batch?" [batch]":"";return`${h}${g}${l.type.toUpperCase()}${d.reset}${b}${w}${_}`};e.onEvent(l=>{a(l.type)&&o(p(l),l)})}addDisposer(e){return this._disposers.add(e),()=>{this._disposers.delete(e)}}destroy(){Cn(this._disposers,this.name),this.signal([[$]],{internal:!0}),Cn(this._storageDisposers,this.name);for(let e of[...this._mounts.values()])e._parent=void 0,e._destroyClearOnly();this._mounts.clear(),this._nodes.clear(),this._parent=void 0,this._destroyed=!0}get destroyed(){return this._destroyed}_destroyClearOnly(){for(let e of[...this._mounts.values()])e._parent=void 0,e._destroyClearOnly();this._mounts.clear(),this._nodes.clear(),this._parent=void 0,this._destroyed=!0}snapshot(e){let{expand:t,...r}=this.describe({detail:"full"}),o={};for(let a of Object.keys(r.nodes).sort()){let{lastMutation:d,guard:u,...c}=r.nodes[a];o[a]=c}let s=[...r.subgraphs].sort(),i={...r,version:1,nodes:o,subgraphs:s};if(e?.format==null)return i;if(e.format==="json-string")return JSON.stringify(i);if(e.format==="bytes"){if(e.codec==null)throw new Error("snapshot({format: 'bytes'}) requires a `codec` name");let a=this.config.lookupCodec(e.codec);if(a==null)throw new Error(`snapshot: codec "${e.codec}" is not registered on this graph's config. Call config.registerCodec(...) before creating nodes.`);return Yt(a,a.encode(i))}throw new Error(`snapshot: unknown format "${String(e.format)}"`)}static decode(e,t){let r=t?.config??Ne,{codec:o,codecVersion:s,payload:i}=Jt(e,r);return o.decode(i,s)}restore(e,t){if(Mn(e),e.name!==this.name)throw new Error(`Graph "${this.name}": restore snapshot name "${e.name}" does not match this graph`);let r=t?.only==null?null:(Array.isArray(t.only)?t.only:[t.only]).map(s=>Qe(s)),o=t?.includeProducers===!0;for(let s of Object.keys(e.nodes).sort()){if(r!==null&&!r.some(a=>a.test(s)))continue;let i=e.nodes[s];if(i!==void 0){if(!("value"in i)||i.value===void 0){"value"in i&&i.value===void 0&&t?.onError?.(s,new Error(`restore: slice.value is undefined for "${s}" (undefined is the global SENTINEL; not valid DATA)`));continue}if(!(i.type==="derived"||i.type==="effect")&&!(i.type==="producer"&&!o)){if(i.v!=null){let d=this.tryResolve(s)?.v;if(d!=null&&d.id===i.v.id&&d.version===i.v.version)continue}try{this.set(s,i.value)}catch(a){t?.onError?.(s,a)}}}}}static fromSnapshot(e,t){Mn(e);let r=typeof t=="function"?t:t?.build,o=typeof t=="function"?void 0:t?.factories,s=new n(e.name);if(r)return r(s),s.restore(e),s;for(let p of[...e.subgraphs].sort((l,g)=>{let h=l.split(L).length,T=g.split(L).length;return h!==T?h-T:l<g?-1:l>g?1:0})){let l=p.split(L),g=s;for(let h of l)g._mounts.has(h)||g.mount(h,new n(h)),g=g._mounts.get(h)}let i=o?Object.entries(o).map(([p,l])=>({re:Qe(p),factory:l})):[],a=p=>{for(let l of i)if(l.re.test(p))return l.factory},d=p=>{let l=p.split(L),g=l.pop();if(g==null||g.length===0)throw new Error(`invalid snapshot path "${p}"`);let h=s;for(let T of l){let y=h._mounts.get(T);if(!y)throw new Error(`unknown mount "${T}" in path "${p}"`);h=y}return[h,g]},u=Object.entries(e.nodes).filter(([p])=>!p.includes(`${L}${Q}${L}`)).sort((p,l)=>p[0]<l[0]?-1:p[0]>l[0]?1:0),c=new Map(u),f=new Map,m=!0;for(;c.size>0&&m;){m=!1;for(let[p,l]of[...c.entries()]){let g=l?.deps??[];if(!g.every(w=>f.has(w)))continue;let[h,T]=d(p),y={...l?.meta??{}},b=a(p),v;if(l?.type==="state")v=Oe(l.value,{meta:y});else{if(b==null)continue;v=b(T,{path:p,type:l.type,value:l.value,meta:y,deps:g,resolvedDeps:g.map(w=>f.get(w))})}h.add(v,{name:T}),f.set(p,v),c.delete(p),m=!0}}if(c.size>0){let p=[...c.keys()].sort().join(", ");throw new Error(`Graph.fromSnapshot could not reconstruct nodes without build callback: ${p}. Pass matching factories via fromSnapshot(data, { factories: { pattern: factoryFn } }).`)}return s.restore(e),s}toJSON(){return this.snapshot()}attachSnapshotStorage(e,t={}){let r=e.map(u=>({tier:u,debounceMs:Math.max(0,u.debounceMs??0),compactEvery:Math.max(1,u.compactEvery??10),timer:void 0,seq:0,lastSnapshot:void 0,lastFingerprint:"",disposed:!1,savePending:void 0}));t.autoRestore===!0&&this._cascadeRestore(e,t.onError);let o=(u,c)=>{if(u.disposed)return;let f=Lr(c.nodes);if(u.lastSnapshot!=null&&f!==""&&f===u.lastFingerprint)return;let m=u.seq+1,p=Ve(),h=u.lastSnapshot==null||m%u.compactEvery===0?{name:this.name,mode:"full",snapshot:c,seq:m,timestamp_ns:p,format_version:me}:{name:this.name,mode:"diff",diff:Ln(u.lastSnapshot,c),seq:m,timestamp_ns:p,format_version:me};if(u.tier.filter&&!u.tier.filter(h))return;let T;try{T=u.tier.save(h)}catch(y){t.onError?.(y,u.tier);return}if(T&&typeof T.then=="function"){let v=(u.savePending??Promise.resolve()).then(()=>T,()=>T).then(()=>{u.disposed||(u.seq=m,u.lastSnapshot=c,u.lastFingerprint=f)},w=>{t.onError?.(w,u.tier)});u.savePending=v.finally(()=>{u.savePending===v&&(u.savePending=void 0)})}else u.seq=m,u.lastSnapshot=c,u.lastFingerprint=f},s=(u,c)=>{try{o(u,c)}catch(f){t.onError?.(f,u.tier)}},i=(u,c)=>{if(!c.some(l=>{let g=this.config.messageTier(l[0]);return g>=3&&g<5}))return;if(t.filter){let l=this.tryResolve(u);if(l==null)return;let g=Nt(l,Tt("standard"));if(!t.filter(u,g))return}let m,p=()=>(m==null&&(m=this.snapshot()),m);for(let l of r)l.disposed||(l.debounceMs===0?s(l,p()):(l.timer==null&&(l.timer=new ae),l.timer.start(l.debounceMs,()=>{l.disposed||s(l,this.snapshot())})))},a;if(t.paths!=null){let c=(typeof t.paths=="string"?this._pathsMatching(t.paths):t.paths).map(f=>{let m=this.tryResolve(f);return m==null?()=>{}:m.subscribe(p=>i(f,p))});a=()=>{for(let f of c)f()}}else a=this.observe().subscribe((u,c)=>i(u,c));let d=()=>{a();for(let u of r)u.disposed=!0,u.timer?.cancel();this._storageDisposers.delete(d)};return this._storageDisposers.add(d),{dispose:d}}async _cascadeRestore(e,t){for(let r of e){let o;try{o=await r.load?.()}catch(i){t?.(i,r);continue}if(o==null||typeof o!="object"||Array.isArray(o))continue;let s=o;try{if(s.mode==="full"&&s.snapshot!=null)return this.restore(s.snapshot),!0;if(s.version===me&&s.nodes!=null)return this.restore(s),!0}catch(i){t?.(i,r)}}return!1}static async fromStorage(e,t,r){for(let o of t){let s;try{s=await o.load?.()}catch(d){r?.onError?.(d,o);continue}if(s==null||typeof s!="object"||Array.isArray(s))continue;let i=s,a=i.mode==="full"&&i.snapshot!=null?i.snapshot:i.version===me&&i.nodes!=null?i:void 0;if(a!=null)try{return n.fromSnapshot(a,r)}catch(d){r?.onError?.(d,o)}}throw new Error(`Graph.fromStorage: no tier held a restorable record for "${e}" across ${t.length} tier(s)`)}_annotations=new Map;_traceRing;trace(e,t,r){if(e!=null&&t!=null){if(this.tryResolve(e)==null)return;if(this._annotations.set(e,t),this.config.inspectorEnabled){let o={path:e,annotation:t,timestamp_ns:Z(),...r?.actor!=null?{actor:r.actor}:{}};this._traceRing.push(o)}return}return e!=null?this.config.inspectorEnabled?this._annotations.get(e):void 0:this.config.inspectorEnabled?this._traceRing.toArray():[]}annotation(e){return this._annotations.get(e)}clearTrace(){this._annotations.clear(),this._traceRing.clear()}pruneTrace(e){let t=this._traceRing.toArray().filter(o=>!e(o)),r=this._traceRing.size-t.length;this._traceRing.clear();for(let o of t)this._traceRing.push(o);return r}static diff(e,t){let r=new Set(Object.keys(e.nodes)),o=new Set(Object.keys(t.nodes)),s=[...o].filter(y=>!r.has(y)).sort(),i=[...r].filter(y=>!o.has(y)).sort(),a=[],d=[];for(let y of r){if(!o.has(y))continue;let b=e.nodes[y],v=t.nodes[y],w=b.v,_=v.v;w!=null&&_!=null&&w.id===_.id&&w.version!==_.version&&d.push({path:y,id:w.id,from:w.version,to:_.version});let x=w!=null&&_!=null&&w.id===_.id&&w.version===_.version;for(let E of["type","status","sentinel"]){let C=b[E],A=v[E];C!==A&&a.push({path:y,field:E,from:C,to:A})}if(!x)for(let E of["value","meta"]){let C=b[E],A=v[E];$r(C,A)||a.push({path:y,field:E,from:C,to:A})}}let u=y=>`${y.from} ${y.to}`,c=new Set(e.edges.map(u)),f=new Set(t.edges.map(u)),m=t.edges.filter(y=>!c.has(u(y))),p=e.edges.filter(y=>!f.has(u(y))),l=new Set(e.subgraphs),g=new Set(t.subgraphs),h=[...g].filter(y=>!l.has(y)).sort(),T=[...l].filter(y=>!g.has(y)).sort();return{nodesAdded:s,nodesRemoved:i,nodesChanged:a,versionChanges:d,edgesAdded:m,edgesRemoved:p,subgraphsAdded:h,subgraphsRemoved:T}}};function Ln(n,e){let t=xe.diff(n,e),r={};for(let o of t.nodesAdded){let s=e.nodes[o];s!=null&&(r[o]=s)}return{...t,nodesAddedFull:r}}function Ut(n,e,t,r={}){let o={paths:[],depths:new Map,truncated:!1};if(!e)return r.withDetail?o:[];if(!r.both&&t!=="upstream"&&t!=="downstream")throw new Error('reachable: direction must be "upstream" or "downstream"');let s=r.maxDepth;if(s!=null&&(!Number.isInteger(s)||s<0))throw new Error("reachable: maxDepth must be an integer >= 0");if(s===0)return r.withDetail?o:[];let i=new Map,a=new Map,d=new Map,u=new Map,c=new Set;for(let[b,v]of Object.entries(n.nodes)){if(!b)continue;c.add(b);let w=v.deps??[];i.set(b,w);for(let _ of w)_&&(c.add(_),a.has(_)||a.set(_,new Set),a.get(_).add(b))}for(let b of n.edges){if(b==null||typeof b!="object")continue;let v=typeof b.from=="string"?b.from:"",w=typeof b.to=="string"?b.to:"";!v||!w||(c.add(v),c.add(w),u.has(v)||u.set(v,new Set),u.get(v).add(w),d.has(w)||d.set(w,new Set),d.get(w).add(v))}if(!c.has(e))return r.withDetail?o:[];let f=r.both===!0,m=b=>{if(f){let x=i.get(b)??[],E=d.get(b),C=a.get(b),A=u.get(b),O=[...x];return E&&O.push(...E),C&&O.push(...C),A&&O.push(...A),O}if(t==="upstream"){let x=i.get(b)??[],E=d.get(b);return E?[...x,...E]:x}let v=a.get(b),w=u.get(b),_=v?[...v]:[];return w&&_.push(...w),_},p=new Set([e]),l=new Map,g=[{path:e,depth:0}],h=0,T=!1;for(;h<g.length;){let b=g[h++];if(s!=null&&b.depth>=s){m(b.path).length>0&&(T=!0);continue}for(let v of m(b.path))!v||p.has(v)||(p.add(v),l.set(v,b.depth+1),g.push({path:v,depth:b.depth+1}))}let y=[...l.keys()].sort((b,v)=>b<v?-1:b>v?1:0);return r.withDetail?{paths:y,depths:l,truncated:T}:y}function Hr(n,e){if(n.length!==e.length)return!1;for(let t=0;t<n.length;t++){let r=n[t],o=e[t];if(r.path!==o.path||r.type!==o.type||r.status!==o.status||r.hop!==o.hop||r.dep_index!==o.dep_index||r.annotation!==o.annotation||r.value!==o.value||r.lastMutation!==o.lastMutation)return!1;let s=r.v,i=o.v;if(s!==i&&(s==null||i==null||s.id!==i.id||s.version!==i.version))return!1}return!0}function Me(n){return typeof n=="object"&&n!==null&&"subscribe"in n&&"down"in n}function $n(n){if(n<=0)throw new RangeError("timeoutMs must be > 0");if(n>9e6)throw new RangeError("timeoutMs must be <= 9_000_000 (\u22482.5h) to stay within safe ns arithmetic")}var et=class extends xe{output;status;lastError;breakerState;droppedCount;rateLimitState;constructor(e,t={}){super(t.name??"resilient_pipeline",t.graph);let r=e,o,s,i;if(t.rateLimit!=null)if(Me(t.rateLimit)){let d=r,u=t.rateLimit;r=ke(u,c=>{let f={...c,maxBuffer:c.maxBuffer??1/0,meta:U("resilient","rate-limit")};return $t(d,f).node}),this.add(r,{name:"rateLimited"})}else{let d={...t.rateLimit,maxBuffer:t.rateLimit.maxBuffer??1/0,meta:U("resilient","rate-limit")},u=$t(r,d);r=u.node,o=u.droppedCount,s=u.rateLimitState,this.add(r,{name:"rateLimited"}),this.add(o,{name:"droppedCount"}),this.add(s,{name:"rateLimitState"})}if(t.budget!=null)if(Me(t.budget)){let d=r,u=t.budget;r=ke(u,c=>c.length>0?qe(d,c,{meta:U("resilient","budget")}):d),this.add(r,{name:"budgetGated"})}else t.budget.length>0&&(r=qe(r,t.budget,{meta:U("resilient","budget")}),this.add(r,{name:"budgetGated"}));if(t.breaker!=null)if(Me(t.breaker)){let d=r,u=t.breaker,c=t.breakerOnOpen??"skip";r=ke(u,f=>{let m=It(f);return Lt(m,{onOpen:c,meta:U("resilient","breaker")})(d).node}),this.add(r,{name:"breakerWrapped"})}else{let d=It(t.breaker),u=t.breakerOnOpen??"skip",c=Lt(d,{onOpen:u,meta:U("resilient","breaker")})(r);r=c.node,i=c.breakerState,this.add(r,{name:"breakerWrapped"}),this.add(i,{name:"breakerState"})}if(t.timeoutMs!=null)if(Me(t.timeoutMs)){let d=r,u=t.timeoutMs;r=ke(u,c=>($n(c),Ft(d,c*1e6,{meta:U("resilient","timeout")}))),this.add(r,{name:"timeoutWrapped"})}else $n(t.timeoutMs),r=Ft(r,t.timeoutMs*1e6,{meta:U("resilient","timeout")}),this.add(r,{name:"timeoutWrapped"});if(t.retry!=null)if(Me(t.retry)){let d=r,u=t.retry;r=ke(u,c=>Pt(d,{...c,meta:U("resilient","retry")})),this.add(r,{name:"retryWrapped"})}else r=Pt(r,{...t.retry,meta:U("resilient","retry")}),this.add(r,{name:"retryWrapped"});t.fallback!==void 0&&(r=wn(r,t.fallback,{meta:U("resilient","fallback")}),this.add(r,{name:"fallbackWrapped"}));let a=vn(r,{initialStatus:t.initialStatus??"pending",meta:U("resilient","status")});this.output=a.node,this.status=a.status,this.lastError=a.error,this.breakerState=i,this.droppedCount=o,this.rateLimitState=s,this.add(this.output,{name:"output"}),this.add(this.status,{name:"status"}),this.add(this.lastError,{name:"lastError"})}};function Kr(n,e={}){let t=new et(n,e);return t.tagFactory("resilientPipeline",_t(e)),t}0&&(module.exports={NS_PER_MS,NS_PER_SEC,ResilientPipelineGraph,factoryTag,placeholderArgs,resilientPipeline});
@@ -1,8 +1,8 @@
1
- import '../../node-fSc-hCv8.cjs';
2
- export { N as NS_PER_MS, c as NS_PER_SEC } from '../../resilience-BWP2c7Af.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';
1
+ export { f as factoryTag, p as placeholderArgs } from '../../meta-Ct9nqQS5.cjs';
2
+ import '../../node-BYInONRr.cjs';
3
+ export { b as CircuitBreakerOptions, C as CircuitState, F as FallbackInput, N as NS_PER_MS, d as NS_PER_SEC, a as RateLimiterOptions, R as RateLimiterState, c as RetryOptions, S as StatusValue } from '../../index-DGTo1yka.cjs';
4
+ import '../../graph-E6likq7w.cjs';
5
+ export { B as BudgetConstraint } from '../../budget-gate-DiP_nK0n.cjs';
6
+ export { N as NodeOrValue, R as ResilientPipelineGraph, a as ResilientPipelineOptions, r as resilientPipeline } from '../../index-CUIkE1l9.cjs';
7
7
  import '../../extra/storage-core.cjs';
8
8
  import '../../extra/storage-tiers.cjs';
@@ -1,8 +1,8 @@
1
- import '../../node-fSc-hCv8.js';
2
- export { N as NS_PER_MS, c as NS_PER_SEC } from '../../resilience-Bys63Cpd.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';
1
+ export { f as factoryTag, p as placeholderArgs } from '../../meta-D8OyedKp.js';
2
+ import '../../node-BYInONRr.js';
3
+ export { b as CircuitBreakerOptions, C as CircuitState, F as FallbackInput, N as NS_PER_MS, d as NS_PER_SEC, a as RateLimiterOptions, R as RateLimiterState, c as RetryOptions, S as StatusValue } from '../../index-BAQrjuZF.js';
4
+ import '../../graph-BkIkog4h.js';
5
+ export { B as BudgetConstraint } from '../../budget-gate-CmmVtasH.js';
6
+ export { N as NodeOrValue, R as ResilientPipelineGraph, a as ResilientPipelineOptions, r as resilientPipeline } from '../../index-D1Gc7wV5.js';
7
7
  import '../../extra/storage-core.js';
8
8
  import '../../extra/storage-tiers.js';
@@ -1 +1 @@
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};
1
+ import{a as e,b as f}from"../../chunk-SVFKHUCW.js";import"../../chunk-ECQRP2UT.js";import"../../chunk-3G5U5QNE.js";import"../../chunk-C72GO4IZ.js";import"../../chunk-RZJDIV2G.js";import"../../chunk-L6NSJVJZ.js";import"../../chunk-2BX4NB34.js";import"../../chunk-SGS4OJGS.js";import"../../chunk-ESMPEKEV.js";import"../../chunk-FHRBBHJN.js";import{a as c,b as d}from"../../chunk-4VVTGLXJ.js";import{b as a,c as b}from"../../chunk-35JTVPOX.js";import"../../chunk-CKFQS2CJ.js";import"../../chunk-LYCLF26R.js";import"../../chunk-CK2E7BTU.js";import"../../chunk-QYADASLV.js";export{c as NS_PER_MS,d as NS_PER_SEC,e as ResilientPipelineGraph,b as factoryTag,a as placeholderArgs,f as resilientPipeline};