@graphrefly/graphrefly 0.34.0 → 0.35.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 (333) hide show
  1. package/dist/{cascading-DKIb6Pk8.d.cts → cascading-B25wxpRa.d.cts} +3 -3
  2. package/dist/{cascading-Bg0a4VSf.d.ts → cascading-BsJ4GbnS.d.ts} +3 -3
  3. package/dist/{chunk-TZLEMGAK.js → chunk-2Y3DKIZL.js} +2 -2
  4. package/dist/chunk-3OT7K33Q.js +1 -0
  5. package/dist/chunk-53XJ2S6D.js +1 -0
  6. package/dist/chunk-5CPPC75H.js +1 -0
  7. package/dist/chunk-5KPIYVCC.js +7 -0
  8. package/dist/{chunk-GAOX6OPT.js → chunk-5XZRCS2M.js} +1 -1
  9. package/dist/{chunk-C5DINHNP.js → chunk-6G5YD37E.js} +1 -1
  10. package/dist/{chunk-WBWBY6LI.js → chunk-6SVKZ7VI.js} +1 -1
  11. package/dist/chunk-A5HZZYRK.js +1 -0
  12. package/dist/chunk-BGEY3PXH.js +1 -0
  13. package/dist/chunk-CD4CB6S7.js +1 -0
  14. package/dist/chunk-CE72X3WO.js +1 -0
  15. package/dist/chunk-CUQFO6MT.js +1 -0
  16. package/dist/chunk-D5RFJOZ2.js +1 -0
  17. package/dist/{chunk-A3GDELMY.js → chunk-E5YSBQSF.js} +7 -7
  18. package/dist/{chunk-SFIM774L.js → chunk-EUE7ELFQ.js} +1 -1
  19. package/dist/chunk-F3IGTWCQ.js +1 -0
  20. package/dist/chunk-F672GV32.js +1 -0
  21. package/dist/{chunk-GCUYSIM4.js → chunk-GWOKTENT.js} +1 -1
  22. package/dist/{chunk-4NYSEUKV.js → chunk-J6TGRQUP.js} +1 -1
  23. package/dist/{chunk-4F564IPP.js → chunk-JJTF75VS.js} +1 -1
  24. package/dist/{chunk-BY4WKPKM.js → chunk-JUJEPZOI.js} +1 -1
  25. package/dist/{chunk-65WWQ5CB.js → chunk-M5UC63ZI.js} +5 -5
  26. package/dist/chunk-MQZWA3DF.js +1 -0
  27. package/dist/chunk-MYFR67PY.js +18 -0
  28. package/dist/{chunk-KN2UMFT6.js → chunk-PCD2MU7X.js} +1 -1
  29. package/dist/{chunk-YDWTVO4E.js → chunk-PIIUJIF7.js} +1 -1
  30. package/dist/chunk-PVUTRA5K.js +5 -0
  31. package/dist/chunk-Q7EUZ6NN.js +1 -0
  32. package/dist/chunk-RLMYS3XZ.js +1 -0
  33. package/dist/chunk-RRFOCAH6.js +1 -0
  34. package/dist/{chunk-Q46YJCQH.js → chunk-T6RPUERH.js} +1 -1
  35. package/dist/{chunk-IPNJDNE7.js → chunk-T7GWBGOO.js} +1 -1
  36. package/dist/{chunk-U2T2XWDA.js → chunk-U347KVM4.js} +1 -1
  37. package/dist/chunk-UAMWD4GG.js +1 -0
  38. package/dist/chunk-VN6RDSK2.js +1 -0
  39. package/dist/{chunk-CJMFZXIZ.js → chunk-W2ZU226Q.js} +1 -1
  40. package/dist/{chunk-UF746BQ4.js → chunk-XINLP35X.js} +1 -1
  41. package/dist/{chunk-TONEKQM3.js → chunk-XMDNNSMK.js} +1 -1
  42. package/dist/{chunk-INXDSJRC.js → chunk-YOUAVGHJ.js} +1 -1
  43. package/dist/chunk-YV2A2VWG.js +1 -0
  44. package/dist/{chunk-PBN426RU.js → chunk-ZGVA2SR5.js} +1 -1
  45. package/dist/compat/index.cjs +10 -10
  46. package/dist/compat/index.d.cts +17 -14
  47. package/dist/compat/index.d.ts +17 -14
  48. package/dist/compat/index.js +1 -1
  49. package/dist/compat/jotai/index.d.cts +2 -2
  50. package/dist/compat/jotai/index.d.ts +2 -2
  51. package/dist/compat/nanostores/index.d.cts +2 -2
  52. package/dist/compat/nanostores/index.d.ts +2 -2
  53. package/dist/compat/nestjs/index.cjs +12 -12
  54. package/dist/compat/nestjs/index.d.cts +9 -6
  55. package/dist/compat/nestjs/index.d.ts +9 -6
  56. package/dist/compat/nestjs/index.js +1 -1
  57. package/dist/compat/react/index.d.cts +2 -2
  58. package/dist/compat/react/index.d.ts +2 -2
  59. package/dist/compat/solid/index.d.cts +2 -2
  60. package/dist/compat/solid/index.d.ts +2 -2
  61. package/dist/compat/svelte/index.d.cts +2 -2
  62. package/dist/compat/svelte/index.d.ts +2 -2
  63. package/dist/compat/vue/index.d.cts +2 -2
  64. package/dist/compat/vue/index.d.ts +2 -2
  65. package/dist/compat/zustand/index.cjs +7 -7
  66. package/dist/compat/zustand/index.d.cts +5 -4
  67. package/dist/compat/zustand/index.d.ts +5 -4
  68. package/dist/compat/zustand/index.js +1 -1
  69. package/dist/{composite-BPDU_XV1.d.ts → composite-CT_mApQD.d.ts} +2 -2
  70. package/dist/{composite-CmvdhTJe.d.cts → composite-_XckYx2e.d.cts} +2 -2
  71. package/dist/{content-addressed-storage-DqIWCmZG.d.cts → content-addressed-storage-4-ST1tYk.d.cts} +5 -5
  72. package/dist/{content-addressed-storage-BUiREIuj.d.ts → content-addressed-storage-DuYMjV7o.d.ts} +5 -5
  73. package/dist/core/index.d.cts +4 -4
  74. package/dist/core/index.d.ts +4 -4
  75. package/dist/extra/browser.cjs +1 -1
  76. package/dist/extra/browser.d.cts +4 -3
  77. package/dist/extra/browser.d.ts +4 -3
  78. package/dist/extra/browser.js +1 -1
  79. package/dist/extra/index.cjs +19 -19
  80. package/dist/extra/index.d.cts +13 -12
  81. package/dist/extra/index.d.ts +13 -12
  82. package/dist/extra/index.js +1 -1
  83. package/dist/extra/node.cjs +2 -3
  84. package/dist/extra/node.d.cts +3 -3
  85. package/dist/extra/node.d.ts +3 -3
  86. package/dist/extra/node.js +2 -2
  87. package/dist/extra/operators.cjs +1 -1
  88. package/dist/extra/operators.d.cts +1 -1
  89. package/dist/extra/operators.d.ts +1 -1
  90. package/dist/extra/operators.js +1 -1
  91. package/dist/extra/reactive.cjs +1 -1
  92. package/dist/extra/reactive.d.cts +4 -3
  93. package/dist/extra/reactive.d.ts +4 -3
  94. package/dist/extra/reactive.js +1 -1
  95. package/dist/extra/sources.cjs +1 -1
  96. package/dist/extra/sources.d.cts +57 -2
  97. package/dist/extra/sources.d.ts +57 -2
  98. package/dist/extra/sources.js +1 -1
  99. package/dist/extra/storage-browser.cjs +1 -1
  100. package/dist/extra/storage-browser.d.cts +8 -42
  101. package/dist/extra/storage-browser.d.ts +8 -42
  102. package/dist/extra/storage-browser.js +1 -1
  103. package/dist/extra/storage-core.cjs +1 -1
  104. package/dist/extra/storage-core.d.cts +13 -83
  105. package/dist/extra/storage-core.d.ts +13 -83
  106. package/dist/extra/storage-core.js +1 -1
  107. package/dist/extra/storage-node.cjs +1 -2
  108. package/dist/extra/storage-node.d.cts +1 -59
  109. package/dist/extra/storage-node.d.ts +1 -59
  110. package/dist/extra/storage-node.js +0 -1
  111. package/dist/extra/storage-tiers-browser.cjs +1 -0
  112. package/dist/extra/storage-tiers-browser.d.cts +49 -0
  113. package/dist/extra/storage-tiers-browser.d.ts +49 -0
  114. package/dist/extra/storage-tiers-browser.js +1 -0
  115. package/dist/extra/storage-tiers-node.cjs +1 -0
  116. package/dist/extra/storage-tiers-node.d.cts +86 -0
  117. package/dist/extra/storage-tiers-node.d.ts +86 -0
  118. package/dist/extra/storage-tiers-node.js +1 -0
  119. package/dist/extra/storage-tiers.cjs +1 -0
  120. package/dist/extra/storage-tiers.d.cts +284 -0
  121. package/dist/extra/storage-tiers.d.ts +284 -0
  122. package/dist/extra/storage-tiers.js +1 -0
  123. package/dist/{fallback-mYSd8vQo.d.ts → fallback-DuEXfA4F.d.ts} +14 -14
  124. package/dist/{fallback-9YznPvPP.d.cts → fallback-axI2cXwt.d.cts} +14 -14
  125. package/dist/graph/index.cjs +3 -3
  126. package/dist/graph/index.d.cts +6 -5
  127. package/dist/graph/index.d.ts +6 -5
  128. package/dist/graph/index.js +1 -1
  129. package/dist/{graph-BROUZPG9.d.ts → graph-Cv-8x0ZI.d.ts} +28 -16
  130. package/dist/{graph-DaoydJ_u.d.cts → graph-kTltt95s.d.cts} +28 -16
  131. package/dist/imperative-audit-ahAE65a9.d.cts +28 -0
  132. package/dist/imperative-audit-ahAE65a9.d.ts +28 -0
  133. package/dist/{index-CI5fULSz.d.ts → index-8OxXae3g.d.ts} +1 -1
  134. package/dist/{index-CQ1gt4rn.d.cts → index-9xhIaM-w.d.cts} +1 -1
  135. package/dist/{index-DhWrMTI6.d.cts → index-B3D_z0Z6.d.cts} +1 -1
  136. package/dist/{index-Ccv_61jG.d.cts → index-B3Dfl5sS.d.cts} +110 -27
  137. package/dist/{index-Dia4yc2y.d.ts → index-B4s70vYf.d.ts} +4 -4
  138. package/dist/{index-Db21wuaD.d.ts → index-B5UR87KG.d.ts} +3 -3
  139. package/dist/{index-DuvQAU02.d.ts → index-BBdwz2BW.d.ts} +2 -2
  140. package/dist/{index-B5eS17Bz.d.ts → index-BEvsFlfH.d.ts} +47 -32
  141. package/dist/{index-BUtCR0k6.d.ts → index-BF-ssbJB.d.ts} +7 -7
  142. package/dist/{index-ClKm7CFB.d.cts → index-BFuVcqL8.d.cts} +1 -1
  143. package/dist/{index-BkfL5MXh.d.cts → index-BWH17rK_.d.cts} +3 -3
  144. package/dist/{index-CD7qmvSf.d.ts → index-BZ1V5GzX.d.ts} +3 -3
  145. package/dist/{index-BDEhWLF4.d.cts → index-BhkPzu-Z.d.cts} +4 -4
  146. package/dist/{index-CNxdDb2e.d.ts → index-Bilohojo.d.ts} +3 -3
  147. package/dist/{index-zA1uVtk0.d.ts → index-BiomL7AW.d.ts} +1 -1
  148. package/dist/{index-BWiX5foT.d.ts → index-BjWZARLy.d.ts} +1 -1
  149. package/dist/{index-IxinNgAH.d.cts → index-BkbawFkI.d.cts} +16 -15
  150. package/dist/{index-RJX4snyi.d.cts → index-BlRVj-7Q.d.cts} +21 -21
  151. package/dist/index-BpFwRAf9.d.cts +26 -0
  152. package/dist/{index-Ds3Rz9m9.d.cts → index-BsZlbHM5.d.cts} +3 -3
  153. package/dist/{index-BFHpNSsV.d.ts → index-BtY2QVDf.d.cts} +8 -7
  154. package/dist/{index-BsxqmV6u.d.ts → index-BuMzxRO2.d.ts} +2 -2
  155. package/dist/{index-C5uMGVJw.d.ts → index-BwYGLgmI.d.ts} +4 -4
  156. package/dist/{index-3L3RC3VJ.d.ts → index-C40wA8zt.d.ts} +7 -7
  157. package/dist/{index-Bi4ZP6Hc.d.ts → index-C9xF16gc.d.ts} +110 -27
  158. package/dist/index-CAIhFfws.d.ts +171 -0
  159. package/dist/{index-BRisOxlx.d.ts → index-CDvC1m5p.d.ts} +1 -1
  160. package/dist/index-CGKs5ixV.d.cts +287 -0
  161. package/dist/{index-ygRFoyrN.d.ts → index-CI_yjtua.d.ts} +2 -2
  162. package/dist/{index-DxEcY7Om.d.ts → index-CIcu6fIR.d.ts} +1 -1
  163. package/dist/{index-CQtnGFrZ.d.cts → index-CfOSES72.d.cts} +7 -7
  164. package/dist/{index-Bd2AjMQY.d.ts → index-Cot94_82.d.ts} +21 -21
  165. package/dist/{index-B1hFhK1K.d.cts → index-CpZKtdMw.d.cts} +1 -1
  166. package/dist/{index-BO6t0HjV.d.cts → index-CqSJ25A9.d.cts} +1 -1
  167. package/dist/{index-Jgl7ev9I.d.cts → index-CzC0G0C3.d.cts} +9 -9
  168. package/dist/{index-p0bkNfby.d.cts → index-D6JRP-1_.d.cts} +3 -3
  169. package/dist/{index-D23g00HE.d.cts → index-D7r_vd0b.d.cts} +4 -4
  170. package/dist/{index-Cp91Sxbo.d.cts → index-D8IyqHvT.d.cts} +3 -3
  171. package/dist/{index-iKsmdnq6.d.cts → index-D9qoEOj_.d.cts} +2 -2
  172. package/dist/index-DBmBtqAN.d.ts +461 -0
  173. package/dist/{index-nP13Qe6T.d.ts → index-DFe2Pk2u.d.ts} +1 -1
  174. package/dist/{index-Cn3taOmp.d.cts → index-DKp1CIbG.d.cts} +2 -2
  175. package/dist/{index-CoR-tOZA.d.cts → index-DSD6xnbT.d.ts} +8 -7
  176. package/dist/{index-DheNs40A.d.ts → index-DXSLMoma.d.ts} +2 -2
  177. package/dist/{index-ZIQaKIdY.d.cts → index-DXZsXxtU.d.cts} +47 -32
  178. package/dist/{index-BVTjuKeP.d.cts → index-D_QQ_dTD.d.cts} +1 -1
  179. package/dist/{index-ChZvMC4M.d.cts → index-DeyzuqAi.d.cts} +7 -7
  180. package/dist/{index-Chi9IiHJ.d.ts → index-DlccEIi3.d.ts} +3 -3
  181. package/dist/{index-DR3XqZlV.d.cts → index-DmtWMP0X.d.cts} +1 -1
  182. package/dist/{index-CbCNoogR.d.ts → index-Dp69u0ym.d.ts} +16 -15
  183. package/dist/{index-b4a6Sg0R.d.ts → index-DwNNufVa.d.ts} +4 -4
  184. package/dist/{index-D80nGRb9.d.ts → index-DzYTXMBz.d.ts} +3 -3
  185. package/dist/index-DzgS5uYi.d.ts +26 -0
  186. package/dist/{index-B-KCkW4M.d.cts → index-GaW6Welt.d.cts} +4 -4
  187. package/dist/{index-DupIl9wI.d.ts → index-JYtN9uqM.d.ts} +1 -1
  188. package/dist/{index-Ced0dphF.d.ts → index-KNAMYngu.d.ts} +9 -9
  189. package/dist/{index-BpjQanLs.d.cts → index-PluovH45.d.cts} +2 -2
  190. package/dist/index-Qq-G9B6g.d.cts +171 -0
  191. package/dist/{index-yJY9thRY.d.cts → index-XxSeddWP.d.cts} +2 -2
  192. package/dist/{index-C8_bnDBZ.d.cts → index-ZhKyR8co.d.cts} +3 -3
  193. package/dist/index-hXKhbfh-.d.ts +287 -0
  194. package/dist/index-zK_mN1D-.d.cts +461 -0
  195. package/dist/index.cjs +59 -59
  196. package/dist/index.d.cts +53 -49
  197. package/dist/index.d.ts +53 -49
  198. package/dist/index.js +1 -1
  199. package/dist/{meta-BdjSt8ky.d.cts → meta-BGO6C7K9.d.cts} +1 -1
  200. package/dist/{meta-CtDjj7cU.d.ts → meta-CC6EPdpK.d.ts} +1 -1
  201. package/dist/{node-8qx0kgYt.d.cts → node-fSc-hCv8.d.cts} +1 -1
  202. package/dist/{node-8qx0kgYt.d.ts → node-fSc-hCv8.d.ts} +1 -1
  203. package/dist/{observable-B6Ba-TTI.d.cts → observable-Cqty11jG.d.cts} +1 -1
  204. package/dist/{observable-DOniYM2B.d.ts → observable-EAV_rNfM.d.ts} +1 -1
  205. package/dist/patterns/ai/browser.cjs +5 -5
  206. package/dist/patterns/ai/browser.d.cts +4 -4
  207. package/dist/patterns/ai/browser.d.ts +4 -4
  208. package/dist/patterns/ai/browser.js +1 -1
  209. package/dist/patterns/ai/index.cjs +19 -19
  210. package/dist/patterns/ai/index.d.cts +19 -17
  211. package/dist/patterns/ai/index.d.ts +19 -17
  212. package/dist/patterns/ai/index.js +1 -1
  213. package/dist/patterns/ai/node.cjs +1 -2
  214. package/dist/patterns/ai/node.d.cts +9 -9
  215. package/dist/patterns/ai/node.d.ts +9 -9
  216. package/dist/patterns/ai/node.js +1 -1
  217. package/dist/patterns/audit/index.cjs +6 -6
  218. package/dist/patterns/audit/index.d.cts +7 -5
  219. package/dist/patterns/audit/index.d.ts +7 -5
  220. package/dist/patterns/audit/index.js +1 -1
  221. package/dist/patterns/cqrs/index.cjs +7 -7
  222. package/dist/patterns/cqrs/index.d.cts +7 -4
  223. package/dist/patterns/cqrs/index.d.ts +7 -4
  224. package/dist/patterns/cqrs/index.js +1 -1
  225. package/dist/patterns/demo-shell/index.cjs +8 -8
  226. package/dist/patterns/demo-shell/index.d.cts +6 -5
  227. package/dist/patterns/demo-shell/index.d.ts +6 -5
  228. package/dist/patterns/demo-shell/index.js +1 -1
  229. package/dist/patterns/domain-templates/index.cjs +5 -5
  230. package/dist/patterns/domain-templates/index.d.cts +5 -4
  231. package/dist/patterns/domain-templates/index.d.ts +5 -4
  232. package/dist/patterns/domain-templates/index.js +1 -1
  233. package/dist/patterns/graphspec/index.cjs +20 -20
  234. package/dist/patterns/graphspec/index.d.cts +6 -5
  235. package/dist/patterns/graphspec/index.d.ts +6 -5
  236. package/dist/patterns/graphspec/index.js +1 -1
  237. package/dist/patterns/guarded-execution/index.cjs +7 -7
  238. package/dist/patterns/guarded-execution/index.d.cts +8 -6
  239. package/dist/patterns/guarded-execution/index.d.ts +8 -6
  240. package/dist/patterns/guarded-execution/index.js +1 -1
  241. package/dist/patterns/harness/index.cjs +12 -12
  242. package/dist/patterns/harness/index.d.cts +13 -10
  243. package/dist/patterns/harness/index.d.ts +13 -10
  244. package/dist/patterns/harness/index.js +1 -1
  245. package/dist/patterns/job-queue/index.cjs +7 -7
  246. package/dist/patterns/job-queue/index.d.cts +8 -4
  247. package/dist/patterns/job-queue/index.d.ts +8 -4
  248. package/dist/patterns/job-queue/index.js +1 -1
  249. package/dist/patterns/lens/index.cjs +4 -4
  250. package/dist/patterns/lens/index.d.cts +7 -6
  251. package/dist/patterns/lens/index.d.ts +7 -6
  252. package/dist/patterns/lens/index.js +1 -1
  253. package/dist/patterns/memory/index.cjs +1 -1
  254. package/dist/patterns/memory/index.d.cts +5 -4
  255. package/dist/patterns/memory/index.d.ts +5 -4
  256. package/dist/patterns/memory/index.js +1 -1
  257. package/dist/patterns/messaging/index.cjs +7 -7
  258. package/dist/patterns/messaging/index.d.cts +6 -4
  259. package/dist/patterns/messaging/index.d.ts +6 -4
  260. package/dist/patterns/messaging/index.js +1 -1
  261. package/dist/patterns/orchestration/index.cjs +7 -7
  262. package/dist/patterns/orchestration/index.d.cts +8 -5
  263. package/dist/patterns/orchestration/index.d.ts +8 -5
  264. package/dist/patterns/orchestration/index.js +1 -1
  265. package/dist/patterns/process/index.cjs +1 -0
  266. package/dist/patterns/process/index.d.cts +10 -0
  267. package/dist/patterns/process/index.d.ts +10 -0
  268. package/dist/patterns/process/index.js +1 -0
  269. package/dist/patterns/reactive-layout/index.cjs +5 -5
  270. package/dist/patterns/reactive-layout/index.d.cts +6 -5
  271. package/dist/patterns/reactive-layout/index.d.ts +6 -5
  272. package/dist/patterns/reactive-layout/index.js +1 -1
  273. package/dist/patterns/reduction/index.cjs +1 -1
  274. package/dist/patterns/reduction/index.d.cts +5 -4
  275. package/dist/patterns/reduction/index.d.ts +5 -4
  276. package/dist/patterns/reduction/index.js +1 -1
  277. package/dist/patterns/refine-loop/index.cjs +8 -8
  278. package/dist/patterns/refine-loop/index.d.cts +7 -5
  279. package/dist/patterns/refine-loop/index.d.ts +7 -5
  280. package/dist/patterns/refine-loop/index.js +1 -1
  281. package/dist/patterns/resilient-pipeline/index.cjs +1 -1
  282. package/dist/patterns/resilient-pipeline/index.d.cts +7 -6
  283. package/dist/patterns/resilient-pipeline/index.d.ts +7 -6
  284. package/dist/patterns/resilient-pipeline/index.js +1 -1
  285. package/dist/patterns/surface/index.cjs +11 -11
  286. package/dist/patterns/surface/index.d.cts +7 -6
  287. package/dist/patterns/surface/index.d.ts +7 -6
  288. package/dist/patterns/surface/index.js +1 -1
  289. package/dist/pipeline-graph-B85HUrWg.d.cts +120 -0
  290. package/dist/pipeline-graph-HOTU4UG0.d.ts +120 -0
  291. package/dist/{reactive-layout-DBJ3Vz-m.d.ts → reactive-layout-Btv0-efV.d.ts} +2 -2
  292. package/dist/{reactive-layout-Dk9AOQb_.d.cts → reactive-layout-D9zqqaqK.d.cts} +2 -2
  293. package/dist/reactive-log-ByBb8g6A.d.ts +188 -0
  294. package/dist/reactive-log-CgbNqksB.d.cts +188 -0
  295. package/dist/{reactive-map-LjwjcFaW.d.ts → reactive-map-CHyeCf4D.d.ts} +1 -1
  296. package/dist/{reactive-map-Cm89Hk0c.d.cts → reactive-map-DmgeADH8.d.cts} +1 -1
  297. package/dist/{resilience-RjDIHZNZ.d.ts → resilience-BWP2c7Af.d.cts} +27 -45
  298. package/dist/{resilience-N_VtLf7W.d.cts → resilience-Bys63Cpd.d.ts} +27 -45
  299. package/dist/resilience-OBU472D2.js +1 -0
  300. package/dist/{sugar-CQkn_rxB.d.ts → sugar-D13E2M_z.d.ts} +1 -1
  301. package/dist/{sugar-DVEYhR7a.d.cts → sugar-DgaGJcI6.d.cts} +1 -1
  302. package/dist/{topology-tree-BB6oJxMz.d.cts → topology-tree-C50l9ARE.d.cts} +1 -1
  303. package/dist/{topology-tree-CAFOG5S5.d.ts → topology-tree-CJsT24DP.d.ts} +1 -1
  304. package/dist/{types-Cp_4coR_.d.cts → types-BMSGPlpO.d.cts} +1 -1
  305. package/dist/{types-B2LfBvNc.d.ts → types-CidcBDuk.d.ts} +1 -1
  306. package/package.json +41 -1
  307. package/dist/chunk-2JO6LXFT.js +0 -7
  308. package/dist/chunk-2LZ6DL45.js +0 -1
  309. package/dist/chunk-3JXNEPCD.js +0 -2
  310. package/dist/chunk-3Y4BXFFR.js +0 -1
  311. package/dist/chunk-55T3K37W.js +0 -1
  312. package/dist/chunk-6HQ6HVTF.js +0 -1
  313. package/dist/chunk-7Q2WPFQ7.js +0 -1
  314. package/dist/chunk-FKRPIRE6.js +0 -1
  315. package/dist/chunk-HTBOCKVD.js +0 -1
  316. package/dist/chunk-I6VIH3VA.js +0 -1
  317. package/dist/chunk-IB64M7VP.js +0 -1
  318. package/dist/chunk-IJFSR4NU.js +0 -1
  319. package/dist/chunk-LOF5HSD3.js +0 -18
  320. package/dist/chunk-T2TB37TW.js +0 -1
  321. package/dist/chunk-T7EQPKOP.js +0 -1
  322. package/dist/chunk-Y63GWRHO.js +0 -5
  323. package/dist/chunk-YUBV7EEE.js +0 -1
  324. package/dist/index-C2Dey3L-.d.cts +0 -152
  325. package/dist/index-ClJUZAOr.d.cts +0 -101
  326. package/dist/index-Cq7Uqgu4.d.ts +0 -192
  327. package/dist/index-Dtpr2FIB.d.ts +0 -101
  328. package/dist/index-HvJ90_tX.d.ts +0 -152
  329. package/dist/index-wcfc7W-f.d.cts +0 -192
  330. package/dist/reactive-log-CWC7jO4J.d.cts +0 -190
  331. package/dist/reactive-log-CqaBg8nf.d.ts +0 -190
  332. package/dist/resilience-7UZHSSGC.js +0 -1
  333. /package/dist/{chunk-L3KUKDZC.js → chunk-O32GJOUJ.js} +0 -0
@@ -1 +1 @@
1
- "use strict";var ve=Object.defineProperty;var Ot=Object.getOwnPropertyDescriptor;var Mt=Object.getOwnPropertyNames;var Rt=Object.prototype.hasOwnProperty;var E=(t,e)=>()=>(t&&(e=t(t=0)),e);var Te=(t,e)=>{for(var n in e)ve(t,n,{get:e[n],enumerable:!0})},Ct=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of Mt(e))!Rt.call(t,o)&&o!==n&&ve(t,o,{get:()=>e[o],enumerable:!(r=Ot(e,o))||r.enumerable});return t};var Dt=t=>Ct(ve({},"__esModule",{value:!0}),t);function V(){return Math.trunc(performance.now()*1e6)}function se(){return Date.now()*1e6}var ie=E(()=>{"use strict"});var J,b,T,w,C,D,X,S,_,p,H,xe,It,Ne,Ft,Lt,ke,Ue,We,$e,Ee,Z=E(()=>{"use strict";J=Symbol.for("graphrefly/START"),b=Symbol.for("graphrefly/DATA"),T=Symbol.for("graphrefly/DIRTY"),w=Symbol.for("graphrefly/RESOLVED"),C=Symbol.for("graphrefly/INVALIDATE"),D=Symbol.for("graphrefly/PAUSE"),X=Symbol.for("graphrefly/RESUME"),S=Symbol.for("graphrefly/TEARDOWN"),_=Symbol.for("graphrefly/COMPLETE"),p=Symbol.for("graphrefly/ERROR"),H=Object.freeze([T]),xe=Object.freeze([w]),It=Object.freeze([C]),Ne=Object.freeze([J]),Ft=Object.freeze([_]),Lt=Object.freeze([S]),ke=Object.freeze([H]),Ue=Object.freeze([xe]),We=Object.freeze([It]),$e=Object.freeze([Ft]),Ee=Object.freeze([Lt])});function je(t){t.registerCodec(Pt)}var Pt,ze=E(()=>{"use strict";Pt={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 ae(t){if(t==null)return Bt;let{type:e,id:n,...r}=t;return{type:e??"system",id:n??"",...r}}var Bt,qe=E(()=>{"use strict";Bt={type:"system",id:""}});function Ye(){return U>0||Q}function Ke(){return U>0}function Je(t){U>0?ee.push(t):t()}function Se(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{}I.length=0,F.length=0,W.length=0}}else Gt()}}function Gt(){let t=!Q;t&&(Q=!0);let e=[],n=0;try{for(;I.length>0||F.length>0||W.length>0||t&&ee.length>0;){if(t&&ee.length>0){let i=ee.splice(0);for(let s of i)try{s()}catch(a){e.push(a)}continue}if(n+=1,n>1e3)throw I.length=0,F.length=0,W.length=0,new Error("batch drain exceeded 1000 iterations \u2014 likely a reactive cycle");let o=(I.length>0?I:F.length>0?F:W).splice(0);for(let i of o)try{i()}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 ue(t,e,n){if(e.length===0)return;if(e.length===1){let d=n(e[0][0]);if(d<3||!Ye()){t(e);return}(d>=5?W:d===4?F:I).push(()=>t(e));return}let r=e.length,o=r,i=r,s=r,a=0;for(;a<r&&n(e[a][0])<3;)a++;for(o=a;a<r&&n(e[a][0])===3;)a++;for(i=a;a<r&&n(e[a][0])===4;)a++;s=a;let u=Ye();if(o>0){let d=e.slice(0,o);t(d)}if(i>o){let d=e.slice(o,i);u?I.push(()=>t(d)):t(d)}if(s>i){let d=e.slice(i,s);u?F.push(()=>t(d)):t(d)}if(r>s){let d=e.slice(s,r);u?W.push(()=>t(d)):t(d)}}var U,Q,I,F,W,ee,Ae=E(()=>{"use strict";U=0,Q=!1,I=[],F=[],W=[],ee=[]});function Xe(t){t.registerMessageType(J,{tier:0,wireCrossing:!1}),t.registerMessageType(T,{tier:1,wireCrossing:!1}),t.registerMessageType(C,{tier:1,wireCrossing:!1,metaPassthrough:!1}),t.registerMessageType(D,{tier:2,wireCrossing:!1}),t.registerMessageType(X,{tier:2,wireCrossing:!1}),t.registerMessageType(b,{tier:3,wireCrossing:!0}),t.registerMessageType(w,{tier:3,wireCrossing:!0}),t.registerMessageType(_,{tier:4,wireCrossing:!0,metaPassthrough:!1}),t.registerMessageType(p,{tier:4,wireCrossing:!0,metaPassthrough:!1}),t.registerMessageType(S,{tier:5,wireCrossing:!0,metaPassthrough:!1})}var de,Ze=E(()=>{"use strict";Z();de=class{_messageTypes=new Map;_codecs=new Map;_onMessage;_onSubscribe;_defaultVersioning;_defaultHashFn;_inspectorEnabled=!(typeof process<"u"&&process.env?.NODE_ENV==="production");_globalInspector;_rigorRecorder;_frozen=!1;tierOf;constructor(e){this._onMessage=e.onMessage,this._onSubscribe=e.onSubscribe,this._defaultVersioning=e.defaultVersioning,this._defaultHashFn=e.defaultHashFn,this.tierOf=n=>{let r=this._messageTypes.get(n);return r!=null?r.tier:1}}get onMessage(){return this._frozen=!0,this._onMessage}get onSubscribe(){return this._frozen=!0,this._onSubscribe}set onMessage(e){this._assertUnfrozen(),this._onMessage=e}set onSubscribe(e){this._assertUnfrozen(),this._onSubscribe=e}get defaultVersioning(){return this._defaultVersioning}set defaultVersioning(e){this._assertUnfrozen(),this._defaultVersioning=e}get defaultHashFn(){return this._defaultHashFn}set defaultHashFn(e){this._assertUnfrozen(),this._defaultHashFn=e}get inspectorEnabled(){return this._inspectorEnabled}set inspectorEnabled(e){this._inspectorEnabled=e}get globalInspector(){return this._globalInspector}set globalInspector(e){this._globalInspector=e}get rigorRecorder(){return this._rigorRecorder}set rigorRecorder(e){this._rigorRecorder=e}registerMessageType(e,n){return this._assertUnfrozen(),this._messageTypes.set(e,{tier:n.tier,wireCrossing:n.wireCrossing??n.tier>=3,metaPassthrough:n.metaPassthrough??!0}),this}messageTier(e){let n=this._messageTypes.get(e);return n!=null?n.tier:1}isWireCrossing(e){let n=this._messageTypes.get(e);return n!=null?n.wireCrossing:!0}isLocalOnly(e){return!this.isWireCrossing(e)}isMetaPassthrough(e){let n=this._messageTypes.get(e);return n!=null?n.metaPassthrough:!0}isKnownMessageType(e){return this._messageTypes.has(e)}registerCodec(e){return this._assertUnfrozen(),this._codecs.set(e.name,e),this}lookupCodec(e){return this._codecs.get(e)}_isFrozen(){return this._frozen}_assertUnfrozen(){if(this._frozen)throw new Error("GraphReFlyConfig is frozen: a node has already captured this config. Register custom types and set hooks before creating any node.")}}});var $,Qe=E(()=>{"use strict";$=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 Oe(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(Oe);if(typeof t=="object"&&t!==null){let e={};for(let n of Object.keys(t).sort())e[n]=Oe(t[n]);return e}return null}function Ut(t){let e=Ht.encode(t),n=e.length,r=n*8,o=n+9+63&-64,i=new Uint8Array(o);i.set(e),i[n]=128;let s=new DataView(i.buffer);s.setUint32(o-4,r>>>0,!1),s.setUint32(o-8,Math.floor(r/4294967296)>>>0,!1);let a=1779033703,u=3144134277,d=1013904242,c=2773480762,l=1359893119,f=2600822924,g=528734635,v=1541459225,y=new Uint32Array(64),m=(x,O)=>x>>>O|x<<32-O;for(let x=0;x<o;x+=64){for(let k=0;k<16;k++)y[k]=s.getUint32(x+k*4,!1);for(let k=16;k<64;k++){let Y=y[k-15],K=y[k-2],oe=m(Y,7)^m(Y,18)^Y>>>3,we=m(K,17)^m(K,19)^K>>>10;y[k]=y[k-16]+oe+y[k-7]+we>>>0}let O=a,z=u,q=d,_e=c,R=l,ne=f,re=g,ye=v;for(let k=0;k<64;k++){let Y=m(R,6)^m(R,11)^m(R,25),K=R&ne^~R&re,oe=ye+Y+K+Vt[k]+y[k]>>>0,we=m(O,2)^m(O,13)^m(O,22),St=O&z^O&q^z&q,At=we+St>>>0;ye=re,re=ne,ne=R,R=_e+oe>>>0,_e=q,q=z,z=O,O=oe+At>>>0}a=a+O>>>0,u=u+z>>>0,d=d+q>>>0,c=c+_e>>>0,l=l+R>>>0,f=f+ne>>>0,g=g+re>>>0,v=v+ye>>>0}let h=x=>x.toString(16).padStart(8,"0");return h(a)+h(u)+h(d)+h(c)+h(l)+h(f)+h(g)+h(v)}function Me(t){let e=Oe(t??null),n=JSON.stringify(e);return Ut(n).slice(0,16)}function Wt(){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 Re(t,e,n){let r=n?.id??Wt();if(t===0)return{id:r,version:0};let i=(n?.hash??Me)(e);return{id:r,version:0,cid:i,prev:null}}function et(t,e,n){t.version+=1,"cid"in t&&(t.prev=t.cid,t.cid=n(e))}var Vt,Ht,tt=E(()=>{"use strict";Vt=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]),Ht=new TextEncoder});function ot(t){return{node:t,unsub:null,prevData:void 0,dirty:!1,involvedThisWave:!1,dataBatch:[],terminal:void 0}}function Ce(t){t.prevData=void 0,t.dirty=!1,t.involvedThisWave=!1,t.dataBatch.length=0,t.terminal=void 0}function ce(t){return t.length===0?t:typeof t[0]=="symbol"?[t]:t}function M(t,e,n){let r=st(t)?t:[],o=typeof t=="function"?t:typeof e=="function"?e:void 0,i={};return st(t)?i=(De(e)?e:n)??{}:De(t)?i=t:i=(De(e)?e:n)??{},new le(r,o,i)}var nt,rt,$t,jt,Ie,le,st,De,fe=E(()=>{"use strict";ze();qe();Ae();ie();Ze();Qe();Z();tt();nt=()=>{},rt=100;$t=(t,e,n,r)=>{n.direction==="down-in"&&t._onDepMessage(n.depIndex,e)},jt=(t,e,n,r)=>{let o=t;if(o._status==="completed"||o._status==="errored")return;let i=o._cached,s=i===void 0?[Ne]:[Ne,[b,i]];o._status==="dirty"&&s.push(H),ue(e,s,o._config.tierOf)},Ie=new de({onMessage:$t,onSubscribe:jt});Xe(Ie);je(Ie);le=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??Ie,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??Me;let o=r.versioning??this._config.defaultVersioning;this._versioningLevel=o,this._versioning=o!=null?Re(o,this._cached===void 0?void 0:this._cached,{id:r.versioningId,hash:this._hashFn}):void 0,this._deps=e.map(ot);let i={};for(let[a,u]of Object.entries(r.meta??{})){let d={initial:u,name:`${r.name??"node"}:meta:${a}`,describeKind:"state",config:this._config};r.guard!=null&&(d.guard=r.guard),i[a]=new t([],void 0,d)}Object.freeze(i),this.meta=i,this._hasMeta=Object.keys(i).length>0;let s=this;this._actions={emit(a){s._emit([[b,a]])},down(a){s._emit(ce(a))},up(a){s._emitUp(ce(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,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 i=this._cached===void 0?void 0:this._cached,s=this._versioning,a=s?.id??n?.id,u=s?.version??0,d=Re(e,i,{id:a,hash:o});d.version=u,this._versioning=d,this._versioningLevel=e}_setInspectorHook(e){return e==null?()=>{}:(this._inspectorHooks==null&&(this._inspectorHooks=new Set),this._inspectorHooks.add(e),()=>{this._inspectorHooks?.delete(e),this._inspectorHooks?.size===0&&(this._inspectorHooks=void 0)})}_pushGuard(e){return this._extraGuards==null&&(this._extraGuards=new Set),this._extraGuards.add(e),()=>{this._extraGuards?.delete(e),this._extraGuards?.size===0&&(this._extraGuards=void 0)}}allowsObserve(e){if(this._guard==null&&this._extraGuards==null)return!0;let n=ae(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=ae(e?.actor),i=e?.delivery==="signal"?"signal":"write";if(this._guard!=null&&!this._guard(o,i))throw new $({actor:o,action:i,nodeName:this.name});if(this._extraGuards!=null){for(let s of this._extraGuards)if(!s(o,i))throw new $({actor:o,action:i,nodeName:this.name})}this._lastMutation={actor:o,timestamp_ns:se()}}down(e,n){let r=ce(e);r.length!==0&&(this._checkGuard(n),this._emit(r))}emit(e,n){this._checkGuard(n),this._emit([[b,e]])}up(e,n){if(this._deps.length===0)return;let r=ce(e);if(r.length===0)return;this._checkGuard(n);let o=n??{internal:!0};this._validateUpTiers(r);for(let i of this._deps)i.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=ae(n);if(!this._guard(u,"observe"))throw new $({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)Ce(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 i;try{i=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 i=="function")try{i()}catch{}throw u}this._status==="sentinel"&&this._cached===void 0&&(this._status="pending");let a=!1;return()=>{a||(a=!0,this._sinkCount-=1,this._removeSink(e),typeof i=="function"&&i(),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,i=this._deps[r];i.unsub=nt,i.unsub=i.node.subscribe(s=>{if(i.unsub===null)return;let a=this._config.tierOf,u=!1;for(let d of s)a(d[0])>=3&&(u=!0),this._config.onMessage(this,d,{direction:"down-in",depIndex:o},this._actions);u&&this._maybeRunFnOnSettlement()}),n++}}catch(r){this._deps[n].unsub=null;for(let o=0;o<n;o++){let i=this._deps[o];if(i.unsub!=null){let s=i.unsub;i.unsub=null;try{s()}catch{}Ce(i)}}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=ot(e);if(this._deps.push(r),this._sinks==null)return n;r.dirty=!0,this._dirtyDepCount++,this._status!=="dirty"&&this._emit(ke),r.unsub=nt;try{r.unsub=e.subscribe(o=>{if(r.unsub===null)return;let i=this._config.tierOf,s=!1;for(let a of o)i(a[0])>=3&&(s=!0),this._config.onMessage(this,a,{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([[p,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([[p,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{}}Ce(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 i={kind:"dep_message",depIndex:e,message:n};for(let s of this._inspectorHooks)s(i)}if(o!==J){if(o===T){this._depDirtied(r);return}if(o===C){if(this._depInvalidated(r),this._cached===void 0)return;this._emit(We);return}if(o===D||o===X){this._emit([n]);return}if(o===S){this._emit(Ee);return}if(o===b)this._depSettledAsData(r,n[1]);else if(o===w)this._depSettledAsResolved(r);else if(o===_)this._depSettledAsTerminal(r,!0);else if(o===p)this._depSettledAsTerminal(r,n[1]);else{this._emit([n]);return}if(!this._fn){(o===b||o===w)&&this._emit([n]),(o===_||o===p)&&this._maybeAutoTerminalAfterWave();return}}}_depDirtied(e){e.dirty||(e.dirty=!0,e.involvedThisWave=!0,this._dirtyDepCount++,this._status!=="dirty"&&this._emit(ke))}_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(Ue),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([[p,e.terminal]]);return}this._autoComplete&&this._deps.every(n=>n.terminal!==void 0)&&this._emit($e)}_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([[p,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(a){this._emit([[p,this._wrapFnError("cleanup.beforeRun threw",a)]]);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 a=n[s];a!=null&&a.length>0&&(this._deps[s].prevData=a[a.length-1])}let o=this._deps.map(s=>s.terminal),i={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 a of this._inspectorHooks)a(s)}this._isExecutingFn=!0;try{let s=this._fn(n,this._actions,i);if(typeof s=="function")this._cleanup=s;else if(s!=null&&typeof s=="object"){let a=s;(typeof a.beforeRun=="function"||typeof a.deactivate=="function"||typeof a.invalidate=="function")&&(this._cleanup=s)}}catch(s){this._emit([[p,this._wrapFnError("fn threw",s)]])}finally{this._isExecutingFn=!1,this._pendingRerun?(this._pendingRerun=!1,this._rerunDepth+=1,this._rerunDepth>rt?(this._rerunDepth=0,this._emit([[p,new Error(`Node "${this.name}": _pendingRerun depth exceeded ${rt} \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"?[H,e[0]]:e;let r=!0,o=!1,i=!1,s=-1;for(let u of e){let d=n(u[0]);d<s&&(r=!1),d===3&&(o=!0),u[0]===T&&(i=!0),s=d}let a=e;if(!r){let u=e.map((d,c)=>({m:d,i:c,tier:n(d[0])}));u.sort((d,c)=>d.tier-c.tier||d.i-c.i),a=u.map(d=>d.m)}if(o&&!i&&this._status!=="dirty"){let u=0;for(;u<a.length&&n(a[u][0])===0;)u++;return u===0?[H,...a]:[...a.slice(0,u),H,...a.slice(u)]}return a}_emit(e){if(e.length===0)return;for(let a=0;a<e.length;a++){let u=e[a];if(u[0]===p&&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 a=e.filter(u=>u[0]===S||u[0]===C);if(a.length===0)return;n=a}n=this._frameBatch(n);let o=null;for(let a=0;a<n.length;a++){let u=n[a],d=u[0];if(d!==D&&d!==X){o?.push(u);continue}if(u.length<2)throw new Error(`Node "${this.name}": [[${d===D?"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 l=u[1];if(d===D)this._pauseLocks==null&&(this._pauseLocks=new Set),this._pauseLocks.add(l),this._paused=!0,this._pausable==="resumeAll"&&this._pauseBuffer==null&&(this._pauseBuffer=[]);else if(this._pauseLocks==null||!this._pauseLocks.has(l))c=!1;else if(this._pauseLocks.delete(l),this._pauseLocks.size===0){if(this._paused=!1,this._pauseBuffer!=null&&this._pauseBuffer.length>0){let f=this._pauseBuffer;this._pauseBuffer=[],this._emit(f)}this._pendingWave&&(this._pendingWave=!1,this._maybeRunFnOnSettlement())}}c?o?.push(u):o==null&&(o=n.slice(0,a))}if(o!=null){if(o.length===0)return;n=o}if(this._hasMeta&&n.some(a=>a[0]===S))for(let a of Object.keys(this.meta))try{this.meta[a]._emit(Ee)}catch{}let{finalMessages:i,equalsError:s}=this._updateState(n);if(i.length>0&&this._config.inspectorEnabled){let a=this._config.globalInspector;if(a!=null)try{a({kind:"emit",node:this,messages:i})}catch{}}if(i.length>0)if(this._paused&&this._pausable==="resumeAll"&&this._pauseBuffer!=null){let a=this._config.tierOf,u=[];for(let d of i)a(d[0])===3?this._pauseBuffer.push(d):u.push(d);u.length>0&&this._dispatchOrAccumulate(u)}else this._dispatchOrAccumulate(i);s!=null&&this._emit([[p,s]])}_updateState(e){let n=this._config.tierOf,r,o,i=-1,s=0;for(let c of e)n(c[0])===3&&s++;let a=s<=1,u=-1;if(this._versioning!=null&&s>1){for(let c=e.length-1;c>=0;c--)if(e[c][0]===b){u=c;break}}for(let c=0;c<e.length;c++){let l=e[c],f=l[0];if(f===b){if(l.length>=2){let g=!1;if(a&&this._cached!==void 0)try{g=this._equals(this._cached,l[1])}catch(v){o=this._wrapFnError("equals threw",v),i=c;break}if(g){r==null&&(r=e.slice(0,c)),r.push(xe),this._status="resolved";continue}this._cached=l[1],this._versioning!=null&&(u<0||c===u)&&et(this._versioning,l[1],this._hashFn)}this._status="settled",r?.push(l)}else if(r?.push(l),f===T)this._status="dirty";else if(f===w)this._status="resolved";else if(f===_){this._status="completed";{let g=this._config.rigorRecorder;if(g!=null)try{g.onTerminalTransition(this,"completed",this._autoComplete,this._autoError,this._deps.length>0)}catch{}}}else if(f===p){this._status="errored";{let g=this._config.rigorRecorder;if(g!=null)try{g.onTerminalTransition(this,"errored",this._autoComplete,this._autoError,this._deps.length>0)}catch{}}}else if(f===C){if(this._cached!==void 0){let v=this._config.rigorRecorder;if(v!=null)try{v.onNonVacuousInvalidate(this,this._cached)}catch{}}this._cached=void 0,this._status="dirty";let g=this._cleanup;if(typeof g=="function"){this._cleanup=void 0;try{g()}catch{}}else if(g!=null&&typeof g=="object"){let v=g.invalidate;if(typeof v=="function")try{v()}catch{}}}else f===S&&(this._resetOnTeardown&&(this._cached=void 0),this._deactivate(!0),this._status="sentinel")}let d=i>=0?r??e.slice(0,i):r??e;return o!=null?{finalMessages:d,equalsError:o}:{finalMessages:d}}_deliverToSinks=e=>{if(this._sinks==null)return;if(typeof this._sinks=="function"){this._sinks(e);return}let n=[...this._sinks];for(let r of n)r(e)};_dispatchOrAccumulate(e){if(Ke()){this._batchPendingMessages===null&&(this._batchPendingMessages=[],Je(()=>this._flushBatchPending()));for(let n of e)this._batchPendingMessages.push(n);return}ue(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);ue(this._deliverToSinks,n,this._config.tierOf)}},st=t=>Array.isArray(t),De=t=>typeof t=="object"&&t!=null&&!Array.isArray(t)});function it(t,e){return M([],{...e,initial:t})}function N(t,e){return M((r,o,i)=>t(o,i)??void 0,{describeKind:"producer",...e})}var Fe=E(()=>{"use strict";fe()});function te(t,e,n){let r=new Set;for(let o of t.split(",")){let[i,s]=o.split("/"),a=s?Number.parseInt(s,10):1;if(Number.isNaN(a)||a<1)throw new Error(`Invalid cron step: ${o}`);let u,d;if(i==="*")u=e,d=n;else if(i.includes("-")){let[c,l]=i.split("-");u=Number.parseInt(c,10),d=Number.parseInt(l,10)}else u=Number.parseInt(i,10),d=u;if(Number.isNaN(u)||Number.isNaN(d))throw new Error(`Invalid cron field: ${t}`);if(u<e||d>n)throw new Error(`Cron field out of range: ${t} (${e}-${n})`);if(u>d)throw new Error(`Invalid cron range: ${u}-${d} in ${t}`);for(let c=u;c<=d;c+=a)r.add(c)}return r}function at(t){let e=t.trim().split(/\s+/);if(e.length!==5)throw new Error(`Invalid cron: expected 5 fields, got ${e.length}`);return{minutes:te(e[0],0,59),hours:te(e[1],0,23),daysOfMonth:te(e[2],1,31),months:te(e[3],1,12),daysOfWeek:te(e[4],0,6)}}function ut(t,e){return t.minutes.has(e.getMinutes())&&t.hours.has(e.getHours())&&t.daysOfMonth.has(e.getDate())&&t.months.has(e.getMonth()+1)&&t.daysOfWeek.has(e.getDay())}var dt=E(()=>{"use strict"});var mt={};Te(mt,{NS_PER_MS:()=>P,NS_PER_SEC:()=>j,constant:()=>ct,decorrelatedJitter:()=>ht,exponential:()=>ft,fibonacci:()=>pt,linear:()=>lt,resolveBackoffPreset:()=>pe,withMaxAttempts:()=>Yt});function L(t){return t<0?0:t}function zt(t,e){return e==="none"?t:e==="full"?Math.random()*t:t/2+Math.random()*(t/2)}function qt(t,e){return t+Math.random()*(e-t)}function ct(t){let e=L(t);return()=>e}function lt(t,e){let n=L(t),r=e===void 0?n:L(e);return o=>n+r*Math.max(0,o)}function ft(t){let e=L(t?.baseNs??1e8),n=t?.factor!==void 0&&t.factor<1?1:t?.factor??2,r=L(t?.maxDelayNs??30*1e9),o=t?.jitter??"none";return i=>{let s;if(e===0)s=0;else if(n===1)s=e;else{let a=r/e,u=1;for(let d=0;d<Math.max(0,i);d++){if(u>=a){u=a;break}u*=n}s=e*u,s>r&&(s=r)}return zt(s,o)}}function pt(t=100*1e6,e=30*1e9){let n=L(t),r=L(e);function o(i){if(i<=0)return 1;let s=1,a=2;for(let u=1;u<i;u++){let d=s+a;s=a,a=d}return a}return i=>{let s=o(i)*n;return s<=r?s:r}}function ht(t=100*1e6,e=30*1e9){return(n,r,o)=>{let s=Math.min(e,(o??t)*3);return qt(t,s)}}function Yt(t,e){return(n,r,o)=>n>=e?null:t(n,r,o)}function pe(t){if(t==="constant")return ct(1*1e9);if(t==="linear")return lt(1*1e9);if(t==="exponential")return ft();if(t==="fibonacci")return pt();if(t==="decorrelatedJitter")return ht();throw new Error(`Unknown backoff preset: "${String(t)}". Use one of: constant, linear, exponential, fibonacci, decorrelatedJitter`)}var P,j,Le=E(()=>{"use strict";P=1e6,j=1e9});var B,gt=E(()=>{"use strict";B=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}}});var yt={};Te(yt,{CircuitOpenError:()=>he,RateLimiterOverflowError:()=>me,TimeoutError:()=>ge,circuitBreaker:()=>Zt,fallback:()=>sn,rateLimiter:()=>en,retry:()=>Jt,retrySource:()=>Xt,timeout:()=>an,tokenBucket:()=>_t,withBreaker:()=>Qt,withStatus:()=>tn});function G(t){return{describeKind:"derived",...t}}function Kt(t){return t<0?0:t}function be(t){return t[1]}function bt(t){if(typeof t!="number"||!Number.isFinite(t))throw new TypeError("backoff strategy must return a finite number");return t<0?0:t}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 i=r===void 0?null:typeof r=="string"?pe(r):r;return N(s=>{let a=0,u=!1,d=null,c,l=new B;function f(){c?.(),c=void 0}function g(y){if(u)return;if(a>=o){f(),s.down([[p,y]]);return}let m=i===null?0:i(a,y,d);if(m==null){f(),s.down([[p,y]]);return}let h;try{h=bt(m)}catch{f(),s.down([[p,y]]);return}d=h,a+=1,f();let x=h>0?h/1e6:1;l.start(x,()=>{u||v()})}function v(){l.cancel(),f(),c=t.subscribe(y=>{if(!u)for(let m of y){let h=m[0];if(h===T)s.down([[T]]);else if(h===b)a=0,d=null,s.emit(m[1]);else if(h===w)s.down([[w]]);else if(h===_)f(),s.down([[_]]);else if(h===p){g(be(m));return}else s.down([m])}})}return v(),()=>{u=!0,l.cancel(),f()}},{...G(),initial:t.cache})}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 i=r===void 0?null:typeof r=="string"?pe(r):r;return N(s=>{let a=0,u=!1,d=null,c,l=new B;function f(){c?.(),c=void 0}function g(y){if(u)return;if(a>=o){f(),s.down([[p,y]]);return}let m=i===null?0:i(a,y,d);if(m==null){f(),s.down([[p,y]]);return}let h;try{h=bt(m)}catch{f(),s.down([[p,y]]);return}d=h,a+=1,f();let x=h>0?h/1e6:1;l.start(x,()=>{u||v()})}function v(){l.cancel(),f();let y;try{y=t()}catch(m){g(m);return}c=y.subscribe(m=>{if(!u)for(let h of m){let x=h[0];if(x===T)s.down([[T]]);else if(x===b)a=0,d=null,s.emit(h[1]);else if(x===w)s.down([[w]]);else if(x===_)f(),s.down([[_]]);else if(x===p){g(be(h));return}else s.down([h])}})}return v(),()=>{u=!0,l.cancel(),f()}},{...G(),initial:e?.initial})}function Zt(t){let e=Math.max(1,t?.failureThreshold??5),n=Kt(t?.cooldownNs??30*1e9),r=t?.cooldown??null,o=Math.max(1,t?.halfOpenMax??1),i=t?.now??V,s="closed",a=0,u=0,d=0,c=n,l=0;function f(){if(!r)return n;let y=r(u);return y!==null?y:n}function g(){s="open",c=f(),d=i(),l=0}return{canExecute(){return s==="closed"?!0:s==="open"?i()-d>=c?(s="half-open",l=1,!0):!1:l<o?(l++,!0):!1},recordSuccess(){s==="half-open"?(s="closed",a=0,u=0):s==="closed"&&(a=0)},recordFailure(y){if(s==="half-open"){u++,g();return}s==="closed"&&(a++,a>=e&&g())},get state(){return s},get failureCount(){return a},reset(){s="closed",a=0,u=0,l=0}}}function Qt(t,e){let n=e?.onOpen??"skip";return r=>{let o=M([],(i,s)=>{function a(){o.meta.breakerState.down([[b,t.state]])}let u=r.subscribe(d=>{for(let c of d){let l=c[0];l===T?s.down([[T]]):l===b?t.canExecute()?(a(),s.emit(c[1])):(a(),n==="error"?s.down([[p,new he]]):s.down([[w]])):l===w?s.down([[w]]):l===_?(t.recordSuccess(),a(),s.down([[_]])):l===p?(t.recordFailure(be(c)),a(),s.down([c])):s.down([c])}});return a(),u},{...G(),meta:{breakerState:t.state},completeWhenDepsComplete:!1,initial:r.cache});return{node:o,breakerState:o.meta.breakerState}}}function _t(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=V();function o(i){if(e>0){let s=i-r;n=Math.min(t,n+s/1e9*e)}r=i}return{available(){return o(V()),n},tryConsume(i=1){if(i<=0)return!0;let s=V();return o(s),n>=i?(n-=i,!0):!1},putBack(i=1){i<=0||(o(V()),n=Math.min(t,n+i))}}}function en(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 i=e.onOverflow??"drop-newest",s=n*1e9/r;return N(a=>{let u=_t(n,s),d=[],c=new B,l=!1,f=1e9/s;function g(){for(;d.length>0;)if(u.tryConsume(1))a.emit(d.shift());else{c.start(Math.max(1,f/1e6),g);return}}let v=t.subscribe(y=>{for(let m of y){if(l)return;let h=m[0];if(h===T)a.down([[T]]);else if(h===b){if(o!==void 0&&d.length>=o){if(i!=="drop-newest")if(i==="drop-oldest")d.shift(),d.push(m[1]);else{l=!0,c.cancel(),d.length=0,a.down([[p,new me(o)]]);return}}else d.push(m[1]);g()}else if(h===w)a.down([[w]]);else if(h===_)l=!0,c.cancel(),d.length=0,a.down([[_]]);else if(h===p)l=!0,c.cancel(),d.length=0,a.down([m]);else if(h===S){l=!0,c.cancel(),d.length=0,a.down([m]);return}else a.down([m])}});return()=>{l=!0,c.cancel(),v()}},{...G(),initial:t.cache})}function tn(t,e){let n=e?.initialStatus??"pending",r=M([],(o,i)=>{let s=n;return r.meta.status.down([[b,n]]),r.meta.error.down([[b,null]]),t.subscribe(u=>{for(let d of u){let c=d[0];if(c===T)i.down([[T]]);else if(c===b)s==="errored"?Se(()=>{r.meta.error.down([[b,null]]),r.meta.status.down([[b,"active"]])}):r.meta.status.down([[b,"active"]]),s="active",i.emit(d[1]);else if(c===w)i.down([[w]]);else if(c===_)r.meta.status.down([[b,"completed"]]),s="completed",i.down([[_]]);else if(c===p){let l=be(d);Se(()=>{r.meta.error.down([[b,l]]),r.meta.status.down([[b,"errored"]])}),s="errored",i.down([d])}else i.down([d])}})},{...G(),meta:{status:n,error:null},completeWhenDepsComplete:!1,resubscribable:!0,initial:t.cache});return{node:r,status:r.meta.status,error:r.meta.error}}function nn(t){return t!=null&&typeof t=="object"&&"cache"in t&&typeof t.subscribe=="function"}function rn(t){return t!=null&&typeof t.then=="function"}function on(t){return t!=null&&typeof t=="object"&&typeof t[Symbol.asyncIterator]=="function"}function sn(t,e){return N(n=>{let r,o;function i(){o?.(),o=void 0,nn(e)||rn(e)||on(e)?r=Pe(e).subscribe(a=>{n.down(a)}):(n.emit(e),n.down([[_]]))}return o=t.subscribe(s=>{for(let a of s){let u=a[0];if(u===T)n.down([[T]]);else if(u===b)n.emit(a[1]);else if(u===w)n.down([[w]]);else if(u===_)n.down([[_]]);else if(u===p){i();return}else if(u===S){r?.(),n.down([a]);return}else n.down([a])}}),()=>{o?.(),r?.()}},{...G(),initial:t.cache})}function an(t,e){if(e<=0)throw new RangeError("timeoutNs must be > 0");return N(n=>{let r=!1,o=new B;function i(){let a=e/1e6;o.start(a,()=>{r||(r=!0,s(),n.down([[p,new ge(e)]]))})}let s=t.subscribe(a=>{for(let u of a){if(r)return;let d=u[0];if(d===T)n.down([[T]]);else if(d===b)i(),n.emit(u[1]);else if(d===w)n.down([[w]]);else if(d===_){o.cancel(),r=!0,n.down([[_]]);return}else if(d===p){o.cancel(),r=!0,n.down([u]);return}else if(d===S){o.cancel(),r=!0,n.down([u]);return}else n.down([u])}});return i(),()=>{r=!0,o.cancel(),s()}},{...G(),initial:t.cache})}var he,me,ge,wt=E(()=>{"use strict";Ae();ie();Z();fe();Fe();Le();vt();gt();he=class extends Error{name="CircuitOpenError";constructor(){super("Circuit breaker is open")}};me=class extends Error{name="RateLimiterOverflowError";constructor(e){super(`rateLimiter buffer overflow (maxBuffer=${e})`)}};ge=class extends Error{name="TimeoutError";constructor(e){super(`Timed out after ${e/1e6}ms`)}}});var Mn={};Te(Mn,{awaitSettled:()=>kn,cached:()=>xn,empty:()=>bn,escapeRegexChar:()=>xt,firstValueFrom:()=>Nn,firstWhere:()=>Ge,forEach:()=>wn,fromAny:()=>Pe,fromAsyncIter:()=>kt,fromCron:()=>pn,fromEvent:()=>hn,fromIter:()=>Ve,fromPromise:()=>Nt,fromRaf:()=>fn,fromTimer:()=>ln,globToRegExp:()=>un,keepalive:()=>An,matchesAnyPattern:()=>dn,never:()=>_n,nodeSignal:()=>En,of:()=>Et,reactiveCounter:()=>On,replay:()=>He,share:()=>Tn,shareReplay:()=>Sn,throwError:()=>yn,toArray:()=>vn});module.exports=Dt(Mn);function A(t){return{describeKind:"producer",...t}}function xt(t){return/[\\^$+?.()|[\]{}]/.test(t)?`\\${t}`:t}function un(t){let e="^";for(let n=0;n<t.length;n+=1){let r=t[n];if(r==="*"){t[n+1]==="*"?(e+=".*",n+=1):e+="[^/]*";continue}e+=xt(r)}return e+="$",new RegExp(e)}function dn(t,e){for(let n of e)if(n.test(t))return!0;return!1}function cn(t,e){let n=M([t],(o,i)=>{let s=o[0];if(s==null||s.length===0){i.down([[w]]);return}for(let a of s)i.emit(a)},{describeKind:"derived",initial:t.cache}),r=n.subscribe.bind(n);return n.subscribe=(o,i)=>(e(o),r(o,i)),n}function ln(t,e){let{signal:n,period:r,...o}=e??{};return N(i=>{let s=!1,a=0,u,d,c=()=>{s=!0,u!==void 0&&clearTimeout(u),d!==void 0&&clearInterval(d),n?.removeEventListener("abort",f)},l=()=>{s||(r!=null?(i.emit(a++),d=setInterval(()=>{s||i.emit(a++)},r)):(s=!0,n?.removeEventListener("abort",f),i.emit(a++),i.down([[_]])))},f=()=>{s||(c(),i.down([[p,n.reason]]))};if(n?.aborted){f();return}return u=setTimeout(l,t),n?.addEventListener("abort",f,{once:!0}),c},A(o))}function fn(t){let{signal:e,...n}=t??{};return N(r=>{let o=!1,i,s,a=!1,u=!1,d=typeof requestAnimationFrame=="function"?requestAnimationFrame:void 0,c=typeof cancelAnimationFrame=="function"?cancelAnimationFrame:void 0,l=typeof document<"u"?document:void 0,f=()=>{i!==void 0&&c&&c(i),s!==void 0&&clearTimeout(s),i=void 0,s=void 0},g=()=>{o=!0,f(),a&&(e?.removeEventListener("abort",v),a=!1),u&&l&&(l.removeEventListener("visibilitychange",h),u=!1)},v=()=>{o||(g(),r.down([[p,e.reason]]))},y=x=>{o||(r.emit(x),m())},m=()=>{o||(d&&(!l||l.visibilityState!=="hidden")?i=d(y):s=setTimeout(()=>y(performance.now()),16))},h=()=>{o||(f(),m())};return e?.aborted?(v(),g):(e?.addEventListener("abort",v,{once:!0}),a=e!==void 0,l&&d&&(l.addEventListener("visibilitychange",h),u=!0),m(),g)},A(n))}function pn(t,e){let n=at(t),{tickMs:r,output:o,...i}=e??{},s=r??6e4,a=o==="date";return N(u=>{let d=-1,c=()=>{let f=new Date,g=f.getFullYear()*1e8+(f.getMonth()+1)*1e6+f.getDate()*1e4+f.getHours()*100+f.getMinutes();g!==d&&ut(n,f)&&(d=g,u.emit(a?f:se()))};c();let l=setInterval(c,s);return()=>clearInterval(l)},{...A(i),name:i.name??`cron:${t}`})}function hn(t,e,n){let{capture:r,passive:o,once:i,...s}=n??{};return N(a=>{let u=c=>{a.emit(c)},d={capture:r,passive:o,once:i};return t.addEventListener(e,u,d),()=>t.removeEventListener(e,u,d)},A(s))}function Ve(t,e){return N(n=>{let r=!1;try{for(let o of t){if(r)return;n.emit(o)}r||n.down([[_]])}catch(o){r||n.down([[p,o]])}return()=>{r=!0}},A(e))}function mn(t){return t!=null&&typeof t.then=="function"}function Nt(t,e){let{signal:n,...r}=e??{};return N(o=>{let i=!1,s=()=>{i||(i=!0,o.down([[p,n.reason]]))};if(n?.aborted){s();return}return n?.addEventListener("abort",s,{once:!0}),Promise.resolve(t).then(a=>{i||(i=!0,n?.removeEventListener("abort",s),o.emit(a),o.down([[_]]))},a=>{i||(i=!0,n?.removeEventListener("abort",s),o.down([[p,a]]))}),()=>{i=!0,n?.removeEventListener("abort",s)}},A(r))}function kt(t,e){let{signal:n,...r}=e??{};return N(o=>{let i=new AbortController,s=()=>i.abort(n?.reason);n?.aborted?i.abort(n.reason):n?.addEventListener("abort",s,{once:!0});let a=n??i.signal,u=!1,d=t[Symbol.asyncIterator](),c=()=>{u||a.aborted||Promise.resolve(d.next()).then(l=>{if(!(u||a.aborted)){if(l.done){o.down([[_]]);return}o.emit(l.value),c()}},l=>{!u&&!a.aborted&&o.down([[p,l]])})};return c(),()=>{u=!0,n?.removeEventListener("abort",s),i.abort(),Promise.resolve(d.return?.()).catch(()=>{})}},A(r))}function gn(t){return t!=null&&typeof t=="object"&&"cache"in t&&typeof t.subscribe=="function"}function Pe(t,e){if(gn(t))return t;if(mn(t))return Nt(t,e);if(t!=null){let n=t;if(typeof n[Symbol.asyncIterator]=="function")return kt(t,e);if(typeof n[Symbol.iterator]=="function")return Ve(t,e)}return Et(t)}function Et(...t){return Ve(t,void 0)}function bn(t){return N(e=>{e.down([[_]])},A(t))}function _n(t){return N(()=>{},A(t))}function yn(t,e){return N(n=>{n.down([[p,t]])},A(e))}function wn(t,e,n){return M([t],(o,i)=>{let s=o[0];if(s!=null&&s.length>0)for(let a of s)e(a)},{describeKind:"effect",...n}).subscribe(()=>{})}function vn(t,e){return M([t],(n,r,o)=>{o.store.buf||(o.store.buf=[]);let i=o.store.buf,s=n[0];if(s!=null&&s.length>0)for(let a of s)i.push(a);if(o.terminalDeps[0]===!0){r.emit([...i]),r.down([[_]]);return}(s==null||s.length===0)&&r.down([[w]])},{describeKind:"derived",completeWhenDepsComplete:!1,...e})}function Tn(t,e){return N(n=>t.subscribe(r=>{n.down(r)}),{...A(e),initial:t.cache})}function He(t,e,n){if(e<1)throw new RangeError("replay expects bufferSize >= 1");let r=[],o=N(i=>t.subscribe(s=>{for(let a of s)a[0]===b&&(r.push(a[1]),r.length>e&&r.shift());i.down(s)}),{...A(n),initial:t.cache});return cn(o,i=>{for(let s of r)i([[b,s]])})}function xn(t,e){return He(t,1,e)}function Nn(t){return new Promise((e,n)=>{let r=!1,o=!1,i;i=t.subscribe(s=>{for(let a of s){if(r)return;if(a[0]===b){r=!0,e(a[1]),i?(i(),i=void 0):o=!0;return}if(a[0]===p){r=!0,n(a[1]),i?(i(),i=void 0):o=!0;return}if(a[0]===_){r=!0,n(new Error("completed without DATA")),i?(i(),i=void 0):o=!0;return}}}),o&&(i?.(),i=void 0)})}function Ge(t,e,n){return new Promise((r,o)=>{let i=!1,s=!1,a,u=n?.skipCurrent===!0;a=t.subscribe(d=>{for(let c of d){if(i)return;if(!(u&&c[0]===b)){if(c[0]===b){let l=c[1];if(e(l)){i=!0,r(l),a?(a(),a=void 0):s=!0;return}}if(c[0]===p){i=!0,o(c[1]),a?(a(),a=void 0):s=!0;return}if(c[0]===_){i=!0,o(new Error("completed without matching value")),a?(a(),a=void 0):s=!0;return}}}}),u=!1,s&&(a?.(),a=void 0)})}async function kn(t,e){let n=e?.predicate??(i=>i!=null),r=e?.skipCurrent;if(e?.timeoutMs==null||e.timeoutMs<=0)return await Ge(t,n,{skipCurrent:r});if(Be===void 0){let[i,s]=await Promise.all([Promise.resolve().then(()=>(wt(),yt)),Promise.resolve().then(()=>(Le(),mt))]);Be=i.timeout,Tt=s.NS_PER_MS}let o=Be(t,e.timeoutMs*Tt);return await Ge(o,n,{skipCurrent:r})}function En(t,e){let n=new AbortController,r=e?.reason??new Error("cancelled via nodeSignal"),o,i=!1,s=()=>{o?(o(),o=void 0):i=!0};return o=t.subscribe(a=>{if(!n.signal.aborted)for(let u of a){if(u[0]===b&&u[1]===!0){n.abort(r),s();return}if(u[0]===p){n.abort(u[1]),s();return}if(u[0]===_){s();return}}}),i&&(o?.(),o=void 0),{signal:n.signal,dispose:()=>{o&&(o(),o=void 0)}}}function An(t){return t.subscribe(()=>{})}function On(t){let e=it(0);return{node:e,increment(){let n=e.cache??0;return n>=t?!1:(e.down([[T],[b,n+1]]),!0)},get(){return e.cache??0},atCap(){return(e.cache??0)>=t}}}var Be,Tt,Sn,vt=E(()=>{ie();Z();fe();Fe();dt();Sn=He});vt();0&&(module.exports={awaitSettled,cached,empty,escapeRegexChar,firstValueFrom,firstWhere,forEach,fromAny,fromAsyncIter,fromCron,fromEvent,fromIter,fromPromise,fromRaf,fromTimer,globToRegExp,keepalive,matchesAnyPattern,never,nodeSignal,of,reactiveCounter,replay,share,shareReplay,throwError,toArray});
1
+ "use strict";var ve=Object.defineProperty;var Ot=Object.getOwnPropertyDescriptor;var Mt=Object.getOwnPropertyNames;var Rt=Object.prototype.hasOwnProperty;var E=(t,e)=>()=>(t&&(e=t(t=0)),e);var xe=(t,e)=>{for(var n in e)ve(t,n,{get:e[n],enumerable:!0})},Ct=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of Mt(e))!Rt.call(t,o)&&o!==n&&ve(t,o,{get:()=>e[o],enumerable:!(r=Ot(e,o))||r.enumerable});return t};var Dt=t=>Ct(ve({},"__esModule",{value:!0}),t);function H(){return Math.trunc(performance.now()*1e6)}function se(){return Date.now()*1e6}var ie=E(()=>{"use strict"});var C,g,v,w,D,I,X,A,_,p,U,Ne,It,ke,Ft,Lt,Ee,Ue,We,$e,Se,Z=E(()=>{"use strict";C=Symbol.for("graphrefly/START"),g=Symbol.for("graphrefly/DATA"),v=Symbol.for("graphrefly/DIRTY"),w=Symbol.for("graphrefly/RESOLVED"),D=Symbol.for("graphrefly/INVALIDATE"),I=Symbol.for("graphrefly/PAUSE"),X=Symbol.for("graphrefly/RESUME"),A=Symbol.for("graphrefly/TEARDOWN"),_=Symbol.for("graphrefly/COMPLETE"),p=Symbol.for("graphrefly/ERROR"),U=Object.freeze([v]),Ne=Object.freeze([w]),It=Object.freeze([D]),ke=Object.freeze([C]),Ft=Object.freeze([_]),Lt=Object.freeze([A]),Ee=Object.freeze([U]),Ue=Object.freeze([Ne]),We=Object.freeze([It]),$e=Object.freeze([Ft]),Se=Object.freeze([Lt])});function je(t){t.registerCodec(Pt)}var Pt,ze=E(()=>{"use strict";Pt={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 ae(t){if(t==null)return Bt;let{type:e,id:n,...r}=t;return{type:e??"system",id:n??"",...r}}var Bt,qe=E(()=>{"use strict";Bt={type:"system",id:""}});function Ye(){return W>0||Q}function Ke(){return W>0}function Je(t){W>0?ee.push(t):t()}function Ae(t){W+=1;let e=!1;try{t()}catch(n){throw e=!0,n}finally{if(W-=1,W===0)if(e){if(!Q){let n=ee.splice(0);for(let r of n)try{r()}catch{}F.length=0,L.length=0,$.length=0}}else Gt()}}function Gt(){let t=!Q;t&&(Q=!0);let e=[],n=0;try{for(;F.length>0||L.length>0||$.length>0||t&&ee.length>0;){if(t&&ee.length>0){let i=ee.splice(0);for(let s of i)try{s()}catch(a){e.push(a)}continue}if(n+=1,n>1e3)throw F.length=0,L.length=0,$.length=0,new Error("batch drain exceeded 1000 iterations \u2014 likely a reactive cycle");let o=(F.length>0?F:L.length>0?L:$).splice(0);for(let i of o)try{i()}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 ue(t,e,n){if(e.length===0)return;if(e.length===1){let d=n(e[0][0]);if(d<3||!Ye()){t(e);return}(d>=5?$:d===4?L:F).push(()=>t(e));return}let r=e.length,o=r,i=r,s=r,a=0;for(;a<r&&n(e[a][0])<3;)a++;for(o=a;a<r&&n(e[a][0])===3;)a++;for(i=a;a<r&&n(e[a][0])===4;)a++;s=a;let u=Ye();if(o>0){let d=e.slice(0,o);t(d)}if(i>o){let d=e.slice(o,i);u?F.push(()=>t(d)):t(d)}if(s>i){let d=e.slice(i,s);u?L.push(()=>t(d)):t(d)}if(r>s){let d=e.slice(s,r);u?$.push(()=>t(d)):t(d)}}var W,Q,F,L,$,ee,Oe=E(()=>{"use strict";W=0,Q=!1,F=[],L=[],$=[],ee=[]});function Xe(t){t.registerMessageType(C,{tier:0,wireCrossing:!1}),t.registerMessageType(v,{tier:1,wireCrossing:!1}),t.registerMessageType(D,{tier:1,wireCrossing:!1,metaPassthrough:!1}),t.registerMessageType(I,{tier:2,wireCrossing:!1}),t.registerMessageType(X,{tier:2,wireCrossing:!1}),t.registerMessageType(g,{tier:3,wireCrossing:!0}),t.registerMessageType(w,{tier:3,wireCrossing:!0}),t.registerMessageType(_,{tier:4,wireCrossing:!0,metaPassthrough:!1}),t.registerMessageType(p,{tier:4,wireCrossing:!0,metaPassthrough:!1}),t.registerMessageType(A,{tier:5,wireCrossing:!0,metaPassthrough:!1})}var de,Ze=E(()=>{"use strict";Z();de=class{_messageTypes=new Map;_codecs=new Map;_onMessage;_onSubscribe;_defaultVersioning;_defaultHashFn;_inspectorEnabled=!(typeof process<"u"&&process.env?.NODE_ENV==="production");_globalInspector;_rigorRecorder;_frozen=!1;tierOf;constructor(e){this._onMessage=e.onMessage,this._onSubscribe=e.onSubscribe,this._defaultVersioning=e.defaultVersioning,this._defaultHashFn=e.defaultHashFn,this.tierOf=n=>{let r=this._messageTypes.get(n);return r!=null?r.tier:1}}get onMessage(){return this._frozen=!0,this._onMessage}get onSubscribe(){return this._frozen=!0,this._onSubscribe}set onMessage(e){this._assertUnfrozen(),this._onMessage=e}set onSubscribe(e){this._assertUnfrozen(),this._onSubscribe=e}get defaultVersioning(){return this._defaultVersioning}set defaultVersioning(e){this._assertUnfrozen(),this._defaultVersioning=e}get defaultHashFn(){return this._defaultHashFn}set defaultHashFn(e){this._assertUnfrozen(),this._defaultHashFn=e}get inspectorEnabled(){return this._inspectorEnabled}set inspectorEnabled(e){this._inspectorEnabled=e}get globalInspector(){return this._globalInspector}set globalInspector(e){this._globalInspector=e}get rigorRecorder(){return this._rigorRecorder}set rigorRecorder(e){this._rigorRecorder=e}registerMessageType(e,n){return this._assertUnfrozen(),this._messageTypes.set(e,{tier:n.tier,wireCrossing:n.wireCrossing??n.tier>=3,metaPassthrough:n.metaPassthrough??!0}),this}messageTier(e){let n=this._messageTypes.get(e);return n!=null?n.tier:1}isWireCrossing(e){let n=this._messageTypes.get(e);return n!=null?n.wireCrossing:!0}isLocalOnly(e){return!this.isWireCrossing(e)}isMetaPassthrough(e){let n=this._messageTypes.get(e);return n!=null?n.metaPassthrough:!0}isKnownMessageType(e){return this._messageTypes.has(e)}registerCodec(e){return this._assertUnfrozen(),this._codecs.set(e.name,e),this}lookupCodec(e){return this._codecs.get(e)}_isFrozen(){return this._frozen}_assertUnfrozen(){if(this._frozen)throw new Error("GraphReFlyConfig is frozen: a node has already captured this config. Register custom types and set hooks before creating any node.")}}});var j,Qe=E(()=>{"use strict";j=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 Me(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(Me);if(typeof t=="object"&&t!==null){let e={};for(let n of Object.keys(t).sort())e[n]=Me(t[n]);return e}return null}function Ut(t){let e=Ht.encode(t),n=e.length,r=n*8,o=n+9+63&-64,i=new Uint8Array(o);i.set(e),i[n]=128;let s=new DataView(i.buffer);s.setUint32(o-4,r>>>0,!1),s.setUint32(o-8,Math.floor(r/4294967296)>>>0,!1);let a=1779033703,u=3144134277,d=1013904242,c=2773480762,l=1359893119,f=2600822924,h=528734635,T=1541459225,y=new Uint32Array(64),b=(x,O)=>x>>>O|x<<32-O;for(let x=0;x<o;x+=64){for(let k=0;k<16;k++)y[k]=s.getUint32(x+k*4,!1);for(let k=16;k<64;k++){let K=y[k-15],J=y[k-2],oe=b(K,7)^b(K,18)^K>>>3,Te=b(J,17)^b(J,19)^J>>>10;y[k]=y[k-16]+oe+y[k-7]+Te>>>0}let O=a,q=u,Y=d,ye=c,R=l,ne=f,re=h,we=T;for(let k=0;k<64;k++){let K=b(R,6)^b(R,11)^b(R,25),J=R&ne^~R&re,oe=we+K+J+Vt[k]+y[k]>>>0,Te=b(O,2)^b(O,13)^b(O,22),St=O&q^O&Y^q&Y,At=Te+St>>>0;we=re,re=ne,ne=R,R=ye+oe>>>0,ye=Y,Y=q,q=O,O=oe+At>>>0}a=a+O>>>0,u=u+q>>>0,d=d+Y>>>0,c=c+ye>>>0,l=l+R>>>0,f=f+ne>>>0,h=h+re>>>0,T=T+we>>>0}let m=x=>x.toString(16).padStart(8,"0");return m(a)+m(u)+m(d)+m(c)+m(l)+m(f)+m(h)+m(T)}function Re(t){let e=Me(t??null),n=JSON.stringify(e);return Ut(n).slice(0,16)}function Wt(){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 Ce(t,e,n){let r=n?.id??Wt();if(t===0)return{id:r,version:0};let i=(n?.hash??Re)(e);return{id:r,version:0,cid:i,prev:null}}function et(t,e,n){t.version+=1,"cid"in t&&(t.prev=t.cid,t.cid=n(e))}var Vt,Ht,tt=E(()=>{"use strict";Vt=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]),Ht=new TextEncoder});function ot(t){return{node:t,unsub:null,prevData:void 0,dirty:!1,involvedThisWave:!1,dataBatch:[],terminal:void 0}}function De(t){t.prevData=void 0,t.dirty=!1,t.involvedThisWave=!1,t.dataBatch.length=0,t.terminal=void 0}function ce(t){return t.length===0?t:typeof t[0]=="symbol"?[t]:t}function M(t,e,n){let r=st(t)?t:[],o=typeof t=="function"?t:typeof e=="function"?e:void 0,i={};return st(t)?i=(Ie(e)?e:n)??{}:Ie(t)?i=t:i=(Ie(e)?e:n)??{},new le(r,o,i)}var nt,rt,$t,jt,Fe,le,st,Ie,fe=E(()=>{"use strict";ze();qe();Oe();ie();Ze();Qe();Z();tt();nt=()=>{},rt=100;$t=(t,e,n,r)=>{n.direction==="down-in"&&t._onDepMessage(n.depIndex,e)},jt=(t,e,n,r)=>{let o=t;if(o._status==="completed"||o._status==="errored")return;let i=o._cached,s=i===void 0?[ke]:[ke,[g,i]];o._status==="dirty"&&s.push(U),ue(e,s,o._config.tierOf)},Fe=new de({onMessage:$t,onSubscribe:jt});Xe(Fe);je(Fe);le=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??Fe,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??Re;let o=r.versioning??this._config.defaultVersioning;this._versioningLevel=o,this._versioning=o!=null?Ce(o,this._cached===void 0?void 0:this._cached,{id:r.versioningId,hash:this._hashFn}):void 0,this._deps=e.map(ot);let i={};for(let[a,u]of Object.entries(r.meta??{})){let d={initial:u,name:`${r.name??"node"}:meta:${a}`,describeKind:"state",config:this._config};r.guard!=null&&(d.guard=r.guard),i[a]=new t([],void 0,d)}Object.freeze(i),this.meta=i,this._hasMeta=Object.keys(i).length>0;let s=this;this._actions={emit(a){s._emit([[g,a]])},down(a){s._emit(ce(a))},up(a){s._emitUp(ce(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,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 i=this._cached===void 0?void 0:this._cached,s=this._versioning,a=s?.id??n?.id,u=s?.version??0,d=Ce(e,i,{id:a,hash:o});d.version=u,this._versioning=d,this._versioningLevel=e}_setInspectorHook(e){return e==null?()=>{}:(this._inspectorHooks==null&&(this._inspectorHooks=new Set),this._inspectorHooks.add(e),()=>{this._inspectorHooks?.delete(e),this._inspectorHooks?.size===0&&(this._inspectorHooks=void 0)})}_pushGuard(e){return this._extraGuards==null&&(this._extraGuards=new Set),this._extraGuards.add(e),()=>{this._extraGuards?.delete(e),this._extraGuards?.size===0&&(this._extraGuards=void 0)}}allowsObserve(e){if(this._guard==null&&this._extraGuards==null)return!0;let n=ae(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=ae(e?.actor),i=e?.delivery==="signal"?"signal":"write";if(this._guard!=null&&!this._guard(o,i))throw new j({actor:o,action:i,nodeName:this.name});if(this._extraGuards!=null){for(let s of this._extraGuards)if(!s(o,i))throw new j({actor:o,action:i,nodeName:this.name})}this._lastMutation={actor:o,timestamp_ns:se()}}down(e,n){let r=ce(e);r.length!==0&&(this._checkGuard(n),this._emit(r))}emit(e,n){this._checkGuard(n),this._emit([[g,e]])}up(e,n){if(this._deps.length===0)return;let r=ce(e);if(r.length===0)return;this._checkGuard(n);let o=n??{internal:!0};this._validateUpTiers(r);for(let i of this._deps)i.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=ae(n);if(!this._guard(u,"observe"))throw new j({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)De(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 i;try{i=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 i=="function")try{i()}catch{}throw u}this._status==="sentinel"&&this._cached===void 0&&(this._status="pending");let a=!1;return()=>{a||(a=!0,this._sinkCount-=1,this._removeSink(e),typeof i=="function"&&i(),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,i=this._deps[r];i.unsub=nt,i.unsub=i.node.subscribe(s=>{if(i.unsub===null)return;let a=this._config.tierOf,u=!1;for(let d of s)a(d[0])>=3&&(u=!0),this._config.onMessage(this,d,{direction:"down-in",depIndex:o},this._actions);u&&this._maybeRunFnOnSettlement()}),n++}}catch(r){this._deps[n].unsub=null;for(let o=0;o<n;o++){let i=this._deps[o];if(i.unsub!=null){let s=i.unsub;i.unsub=null;try{s()}catch{}De(i)}}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=ot(e);if(this._deps.push(r),this._sinks==null)return n;r.dirty=!0,this._dirtyDepCount++,this._status!=="dirty"&&this._emit(Ee),r.unsub=nt;try{r.unsub=e.subscribe(o=>{if(r.unsub===null)return;let i=this._config.tierOf,s=!1;for(let a of o)i(a[0])>=3&&(s=!0),this._config.onMessage(this,a,{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([[p,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([[p,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{}}De(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 i={kind:"dep_message",depIndex:e,message:n};for(let s of this._inspectorHooks)s(i)}if(o!==C){if(o===v){this._depDirtied(r);return}if(o===D){if(this._depInvalidated(r),this._cached===void 0)return;this._emit(We);return}if(o===I||o===X){this._emit([n]);return}if(o===A){this._emit(Se);return}if(o===g)this._depSettledAsData(r,n[1]);else if(o===w)this._depSettledAsResolved(r);else if(o===_)this._depSettledAsTerminal(r,!0);else if(o===p)this._depSettledAsTerminal(r,n[1]);else{this._emit([n]);return}if(!this._fn){(o===g||o===w)&&this._emit([n]),(o===_||o===p)&&this._maybeAutoTerminalAfterWave();return}}}_depDirtied(e){e.dirty||(e.dirty=!0,e.involvedThisWave=!0,this._dirtyDepCount++,this._status!=="dirty"&&this._emit(Ee))}_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(Ue),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([[p,e.terminal]]);return}this._autoComplete&&this._deps.every(n=>n.terminal!==void 0)&&this._emit($e)}_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([[p,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(a){this._emit([[p,this._wrapFnError("cleanup.beforeRun threw",a)]]);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 a=n[s];a!=null&&a.length>0&&(this._deps[s].prevData=a[a.length-1])}let o=this._deps.map(s=>s.terminal),i={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 a of this._inspectorHooks)a(s)}this._isExecutingFn=!0;try{let s=this._fn(n,this._actions,i);if(typeof s=="function")this._cleanup=s;else if(s!=null&&typeof s=="object"){let a=s;(typeof a.beforeRun=="function"||typeof a.deactivate=="function"||typeof a.invalidate=="function")&&(this._cleanup=s)}}catch(s){this._emit([[p,this._wrapFnError("fn threw",s)]])}finally{this._isExecutingFn=!1,this._pendingRerun?(this._pendingRerun=!1,this._rerunDepth+=1,this._rerunDepth>rt?(this._rerunDepth=0,this._emit([[p,new Error(`Node "${this.name}": _pendingRerun depth exceeded ${rt} \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"?[U,e[0]]:e;let r=!0,o=!1,i=!1,s=-1;for(let u of e){let d=n(u[0]);d<s&&(r=!1),d===3&&(o=!0),u[0]===v&&(i=!0),s=d}let a=e;if(!r){let u=e.map((d,c)=>({m:d,i:c,tier:n(d[0])}));u.sort((d,c)=>d.tier-c.tier||d.i-c.i),a=u.map(d=>d.m)}if(o&&!i&&this._status!=="dirty"){let u=0;for(;u<a.length&&n(a[u][0])===0;)u++;return u===0?[U,...a]:[...a.slice(0,u),U,...a.slice(u)]}return a}_emit(e){if(e.length===0)return;for(let a=0;a<e.length;a++){let u=e[a];if(u[0]===p&&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 a=e.filter(u=>u[0]===A||u[0]===D);if(a.length===0)return;n=a}n=this._frameBatch(n);let o=null;for(let a=0;a<n.length;a++){let u=n[a],d=u[0];if(d!==I&&d!==X){o?.push(u);continue}if(u.length<2)throw new Error(`Node "${this.name}": [[${d===I?"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 l=u[1];if(d===I)this._pauseLocks==null&&(this._pauseLocks=new Set),this._pauseLocks.add(l),this._paused=!0,this._pausable==="resumeAll"&&this._pauseBuffer==null&&(this._pauseBuffer=[]);else if(this._pauseLocks==null||!this._pauseLocks.has(l))c=!1;else if(this._pauseLocks.delete(l),this._pauseLocks.size===0){if(this._paused=!1,this._pauseBuffer!=null&&this._pauseBuffer.length>0){let f=this._pauseBuffer;this._pauseBuffer=[],this._emit(f)}this._pendingWave&&(this._pendingWave=!1,this._maybeRunFnOnSettlement())}}c?o?.push(u):o==null&&(o=n.slice(0,a))}if(o!=null){if(o.length===0)return;n=o}if(this._hasMeta&&n.some(a=>a[0]===A))for(let a of Object.keys(this.meta))try{this.meta[a]._emit(Se)}catch{}let{finalMessages:i,equalsError:s}=this._updateState(n);if(i.length>0&&this._config.inspectorEnabled){let a=this._config.globalInspector;if(a!=null)try{a({kind:"emit",node:this,messages:i})}catch{}}if(i.length>0)if(this._paused&&this._pausable==="resumeAll"&&this._pauseBuffer!=null){let a=this._config.tierOf,u=[];for(let d of i)a(d[0])===3?this._pauseBuffer.push(d):u.push(d);u.length>0&&this._dispatchOrAccumulate(u)}else this._dispatchOrAccumulate(i);s!=null&&this._emit([[p,s]])}_updateState(e){let n=this._config.tierOf,r,o,i=-1,s=0;for(let c of e)n(c[0])===3&&s++;let a=s<=1,u=-1;if(this._versioning!=null&&s>1){for(let c=e.length-1;c>=0;c--)if(e[c][0]===g){u=c;break}}for(let c=0;c<e.length;c++){let l=e[c],f=l[0];if(f===g){if(l.length>=2){let h=!1;if(a&&this._cached!==void 0)try{h=this._equals(this._cached,l[1])}catch(T){o=this._wrapFnError("equals threw",T),i=c;break}if(h){r==null&&(r=e.slice(0,c)),r.push(Ne),this._status="resolved";continue}this._cached=l[1],this._versioning!=null&&(u<0||c===u)&&et(this._versioning,l[1],this._hashFn)}this._status="settled",r?.push(l)}else if(r?.push(l),f===v)this._status="dirty";else if(f===w)this._status="resolved";else if(f===_){this._status="completed";{let h=this._config.rigorRecorder;if(h!=null)try{h.onTerminalTransition(this,"completed",this._autoComplete,this._autoError,this._deps.length>0)}catch{}}}else if(f===p){this._status="errored";{let h=this._config.rigorRecorder;if(h!=null)try{h.onTerminalTransition(this,"errored",this._autoComplete,this._autoError,this._deps.length>0)}catch{}}}else if(f===D){if(this._cached!==void 0){let T=this._config.rigorRecorder;if(T!=null)try{T.onNonVacuousInvalidate(this,this._cached)}catch{}}this._cached=void 0,this._status="dirty";let h=this._cleanup;if(typeof h=="function"){this._cleanup=void 0;try{h()}catch{}}else if(h!=null&&typeof h=="object"){let T=h.invalidate;if(typeof T=="function")try{T()}catch{}}}else f===A&&(this._resetOnTeardown&&(this._cached=void 0),this._deactivate(!0),this._status="sentinel")}let d=i>=0?r??e.slice(0,i):r??e;return o!=null?{finalMessages:d,equalsError:o}:{finalMessages:d}}_deliverToSinks=e=>{if(this._sinks==null)return;if(typeof this._sinks=="function"){this._sinks(e);return}let n=[...this._sinks];for(let r of n)r(e)};_dispatchOrAccumulate(e){if(Ke()){this._batchPendingMessages===null&&(this._batchPendingMessages=[],Je(()=>this._flushBatchPending()));for(let n of e)this._batchPendingMessages.push(n);return}ue(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);ue(this._deliverToSinks,n,this._config.tierOf)}},st=t=>Array.isArray(t),Ie=t=>typeof t=="object"&&t!=null&&!Array.isArray(t)});function it(t,e){return M([],{...e,initial:t})}function N(t,e){return M((r,o,i)=>t(o,i)??void 0,{describeKind:"producer",...e})}var Le=E(()=>{"use strict";fe()});function te(t,e,n){let r=new Set;for(let o of t.split(",")){let[i,s]=o.split("/"),a=s?Number.parseInt(s,10):1;if(Number.isNaN(a)||a<1)throw new Error(`Invalid cron step: ${o}`);let u,d;if(i==="*")u=e,d=n;else if(i.includes("-")){let[c,l]=i.split("-");u=Number.parseInt(c,10),d=Number.parseInt(l,10)}else u=Number.parseInt(i,10),d=u;if(Number.isNaN(u)||Number.isNaN(d))throw new Error(`Invalid cron field: ${t}`);if(u<e||d>n)throw new Error(`Cron field out of range: ${t} (${e}-${n})`);if(u>d)throw new Error(`Invalid cron range: ${u}-${d} in ${t}`);for(let c=u;c<=d;c+=a)r.add(c)}return r}function at(t){let e=t.trim().split(/\s+/);if(e.length!==5)throw new Error(`Invalid cron: expected 5 fields, got ${e.length}`);return{minutes:te(e[0],0,59),hours:te(e[1],0,23),daysOfMonth:te(e[2],1,31),months:te(e[3],1,12),daysOfWeek:te(e[4],0,6)}}function ut(t,e){return t.minutes.has(e.getMinutes())&&t.hours.has(e.getHours())&&t.daysOfMonth.has(e.getDate())&&t.months.has(e.getMonth()+1)&&t.daysOfWeek.has(e.getDay())}var dt=E(()=>{"use strict"});var mt={};xe(mt,{NS_PER_MS:()=>B,NS_PER_SEC:()=>z,constant:()=>ct,decorrelatedJitter:()=>ht,exponential:()=>ft,fibonacci:()=>pt,linear:()=>lt,resolveBackoffPreset:()=>pe,withMaxAttempts:()=>Yt});function P(t){return t<0?0:t}function zt(t,e){return e==="none"?t:e==="full"?Math.random()*t:t/2+Math.random()*(t/2)}function qt(t,e){return t+Math.random()*(e-t)}function ct(t){let e=P(t);return()=>e}function lt(t,e){let n=P(t),r=e===void 0?n:P(e);return o=>n+r*Math.max(0,o)}function ft(t){let e=P(t?.baseNs??1e8),n=t?.factor!==void 0&&t.factor<1?1:t?.factor??2,r=P(t?.maxDelayNs??30*1e9),o=t?.jitter??"none";return i=>{let s;if(e===0)s=0;else if(n===1)s=e;else{let a=r/e,u=1;for(let d=0;d<Math.max(0,i);d++){if(u>=a){u=a;break}u*=n}s=e*u,s>r&&(s=r)}return zt(s,o)}}function pt(t=100*1e6,e=30*1e9){let n=P(t),r=P(e);function o(i){if(i<=0)return 1;let s=1,a=2;for(let u=1;u<i;u++){let d=s+a;s=a,a=d}return a}return i=>{let s=o(i)*n;return s<=r?s:r}}function ht(t=100*1e6,e=30*1e9){return(n,r,o)=>{let s=Math.min(e,(o??t)*3);return qt(t,s)}}function Yt(t,e){return(n,r,o)=>n>=e?null:t(n,r,o)}function pe(t){if(t==="constant")return ct(1*1e9);if(t==="linear")return lt(1*1e9);if(t==="exponential")return ft();if(t==="fibonacci")return pt();if(t==="decorrelatedJitter")return ht();throw new Error(`Unknown backoff preset: "${String(t)}". Use one of: constant, linear, exponential, fibonacci, decorrelatedJitter`)}var B,z,Pe=E(()=>{"use strict";B=1e6,z=1e9});var G,bt=E(()=>{"use strict";G=class{_timer;_gen=0;start(e,n){this.cancel(),this._gen+=1;let r=this._gen;this._timer=setTimeout(()=>{this._timer=void 0,r===this._gen&&n()},e)}cancel(){this._timer!==void 0&&(clearTimeout(this._timer),this._timer=void 0)}get pending(){return this._timer!==void 0}}});var yt={};xe(yt,{CircuitOpenError:()=>he,RateLimiterOverflowError:()=>me,TimeoutError:()=>be,circuitBreaker:()=>Qt,fallback:()=>an,rateLimiter:()=>tn,retry:()=>Jt,timeout:()=>un,tokenBucket:()=>_t,withBreaker:()=>en,withStatus:()=>nn});function V(t){return{describeKind:"derived",...t}}function Kt(t){return t<0?0:t}function ge(t){return t[1]}function gt(t){if(typeof t!="number"||!Number.isFinite(t))throw new TypeError("backoff strategy must return a finite number");return t<0?0:t}function Jt(t,e){return typeof t=="function"?Zt(t,e):Xt(t,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 i=r===void 0?null:typeof r=="string"?pe(r):r;return N(s=>{let a=0,u=!1,d=null,c,l=new G;function f(){c?.(),c=void 0}function h(y){if(u)return;if(a>=o){f(),s.down([[p,y]]);return}let b=i===null?0:i(a,y,d);if(b==null){f(),s.down([[p,y]]);return}let m;try{m=gt(b)}catch{f(),s.down([[p,y]]);return}d=m,a+=1,f();let x=m>0?m/1e6:1;l.start(x,()=>{u||T()})}function T(){l.cancel(),f(),c=t.subscribe(y=>{if(!u)for(let b of y){let m=b[0];if(m===v)s.down([[v]]);else if(m===g)a=0,d=null,s.emit(b[1]);else if(m===w)s.down([[w]]);else if(m===_)f(),s.down([[_]]);else if(m===p){h(ge(b));return}else s.down([b])}})}return T(),()=>{u=!0,l.cancel(),f()}},{...V(),initial:t.cache})}function Zt(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 i=r===void 0?null:typeof r=="string"?pe(r):r;return N(s=>{let a=0,u=!1,d=null,c,l=new G;function f(){c?.(),c=void 0}function h(y){if(u)return;if(a>=o){f(),s.down([[p,y]]);return}let b=i===null?0:i(a,y,d);if(b==null){f(),s.down([[p,y]]);return}let m;try{m=gt(b)}catch{f(),s.down([[p,y]]);return}d=m,a+=1,f();let x=m>0?m/1e6:1;l.start(x,()=>{u||T()})}function T(){l.cancel(),f();let y;try{y=t()}catch(b){h(b);return}c=y.subscribe(b=>{if(!u)for(let m of b){let x=m[0];if(x===v)s.down([[v]]);else if(x===g)a=0,d=null,s.emit(m[1]);else if(x===w)s.down([[w]]);else if(x===_)f(),s.down([[_]]);else if(x===p){h(ge(m));return}else s.down([m])}})}return T(),()=>{u=!0,l.cancel(),f()}},{...V(),initial:e?.initial})}function Qt(t){let e=Math.max(1,t?.failureThreshold??5),n=Kt(t?.cooldownNs??30*1e9),r=t?.cooldown??null,o=Math.max(1,t?.halfOpenMax??1),i=t?.now??H,s="closed",a=0,u=0,d=0,c=n,l=0;function f(){if(!r)return n;let y=r(u);return y!==null?y:n}function h(){s="open",c=f(),d=i(),l=0}return{canExecute(){return s==="closed"?!0:s==="open"?i()-d>=c?(s="half-open",l=1,!0):!1:l<o?(l++,!0):!1},recordSuccess(){s==="half-open"?(s="closed",a=0,u=0):s==="closed"&&(a=0)},recordFailure(y){if(s==="half-open"){u++,h();return}s==="closed"&&(a++,a>=e&&h())},get state(){return s},get failureCount(){return a},reset(){s="closed",a=0,u=0,l=0}}}function en(t,e){let n=e?.onOpen??"skip";return r=>{let o=M([],(i,s)=>{function a(){o.meta.breakerState.down([[g,t.state]])}let u=r.subscribe(d=>{for(let c of d){let l=c[0];l===v?s.down([[v]]):l===g?t.canExecute()?(a(),s.emit(c[1])):(a(),n==="error"?s.down([[p,new he]]):s.down([[w]])):l===w?s.down([[w]]):l===_?(t.recordSuccess(),a(),s.down([[_]])):l===p?(t.recordFailure(ge(c)),a(),s.down([c])):s.down([c])}});return a(),u},{...V(),meta:{breakerState:t.state},completeWhenDepsComplete:!1,initial:r.cache});return{node:o,breakerState:o.meta.breakerState}}}function _t(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=H();function o(i){if(e>0){let s=i-r;n=Math.min(t,n+s/1e9*e)}r=i}return{available(){return o(H()),n},tryConsume(i=1){if(i<=0)return!0;let s=H();return o(s),n>=i?(n-=i,!0):!1},putBack(i=1){i<=0||(o(H()),n=Math.min(t,n+i))}}}function tn(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 i=e.onOverflow??"drop-newest",s=n*1e9/r;return N(a=>{let u=_t(n,s),d=[],c=new G,l=!1,f=1e9/s;function h(){for(;d.length>0;)if(u.tryConsume(1))a.emit(d.shift());else{c.start(Math.max(1,f/1e6),h);return}}let T=t.subscribe(y=>{for(let b of y){if(l)return;let m=b[0];if(m===v)a.down([[v]]);else if(m===g){if(o!==void 0&&d.length>=o){if(i!=="drop-newest")if(i==="drop-oldest")d.shift(),d.push(b[1]);else{l=!0,c.cancel(),d.length=0,a.down([[p,new me(o)]]);return}}else d.push(b[1]);h()}else if(m===w)a.down([[w]]);else if(m===_)l=!0,c.cancel(),d.length=0,a.down([[_]]);else if(m===p)l=!0,c.cancel(),d.length=0,a.down([b]);else if(m===A){l=!0,c.cancel(),d.length=0,a.down([b]);return}else a.down([b])}});return()=>{l=!0,c.cancel(),T()}},{...V(),initial:t.cache})}function nn(t,e){let n=e?.initialStatus??"pending",r=M([],(o,i)=>{let s=n;return r.meta.status.down([[g,n]]),r.meta.error.down([[g,null]]),t.subscribe(u=>{for(let d of u){let c=d[0];if(c===v)i.down([[v]]);else if(c===g)s==="errored"?Ae(()=>{r.meta.error.down([[g,null]]),r.meta.status.down([[g,"active"]])}):r.meta.status.down([[g,"active"]]),s="active",i.emit(d[1]);else if(c===w)i.down([[w]]);else if(c===_)r.meta.status.down([[g,"completed"]]),s="completed",i.down([[_]]);else if(c===p){let l=ge(d);Ae(()=>{r.meta.error.down([[g,l]]),r.meta.status.down([[g,"errored"]])}),s="errored",i.down([d])}else i.down([d])}})},{...V(),meta:{status:n,error:null},completeWhenDepsComplete:!1,resubscribable:!0,initial:t.cache});return{node:r,status:r.meta.status,error:r.meta.error}}function rn(t){return t!=null&&typeof t=="object"&&"cache"in t&&typeof t.subscribe=="function"}function on(t){return t!=null&&typeof t.then=="function"}function sn(t){return t!=null&&typeof t=="object"&&typeof t[Symbol.asyncIterator]=="function"}function an(t,e){return N(n=>{let r,o;function i(){o?.(),o=void 0,rn(e)||on(e)||sn(e)?r=_e(e).subscribe(a=>{n.down(a)}):(n.emit(e),n.down([[_]]))}return o=t.subscribe(s=>{for(let a of s){let u=a[0];if(u===v)n.down([[v]]);else if(u===g)n.emit(a[1]);else if(u===w)n.down([[w]]);else if(u===_)n.down([[_]]);else if(u===p){i();return}else if(u===A){r?.(),n.down([a]);return}else n.down([a])}}),()=>{o?.(),r?.()}},{...V(),initial:t.cache})}function un(t,e){if(e<=0)throw new RangeError("timeoutNs must be > 0");return N(n=>{let r=!1,o=new G;function i(){let a=e/1e6;o.start(a,()=>{r||(r=!0,s(),n.down([[p,new be(e)]]))})}let s=t.subscribe(a=>{for(let u of a){if(r)return;let d=u[0];if(d===v)n.down([[v]]);else if(d===g)i(),n.emit(u[1]);else if(d===w)n.down([[w]]);else if(d===_){o.cancel(),r=!0,n.down([[_]]);return}else if(d===p){o.cancel(),r=!0,n.down([u]);return}else if(d===A){o.cancel(),r=!0,n.down([u]);return}else n.down([u])}});return i(),()=>{r=!0,o.cancel(),s()}},{...V(),initial:t.cache})}var he,me,be,wt=E(()=>{"use strict";Oe();ie();Z();fe();Le();Pe();Tt();bt();he=class extends Error{name="CircuitOpenError";constructor(){super("Circuit breaker is open")}};me=class extends Error{name="RateLimiterOverflowError";constructor(e){super(`rateLimiter buffer overflow (maxBuffer=${e})`)}};be=class extends Error{name="TimeoutError";constructor(e){super(`Timed out after ${e/1e6}ms`)}}});var Cn={};xe(Cn,{awaitSettled:()=>Sn,cached:()=>kn,defer:()=>Tn,empty:()=>_n,escapeRegexChar:()=>xt,firstValueFrom:()=>En,firstWhere:()=>Ge,forEach:()=>vn,fromAny:()=>_e,fromAsyncIter:()=>kt,fromCron:()=>hn,fromEvent:()=>mn,fromIter:()=>Ve,fromPromise:()=>Nt,fromRaf:()=>pn,fromTimer:()=>fn,globToRegExp:()=>dn,keepalive:()=>Mn,matchesAnyPattern:()=>cn,never:()=>yn,nodeSignal:()=>An,of:()=>Et,reactiveCounter:()=>Rn,replay:()=>He,share:()=>Nn,shareReplay:()=>On,throwError:()=>wn,toArray:()=>xn});module.exports=Dt(Cn);function S(t){return{describeKind:"producer",...t}}function xt(t){return/[\\^$+?.()|[\]{}]/.test(t)?`\\${t}`:t}function dn(t){let e="^";for(let n=0;n<t.length;n+=1){let r=t[n];if(r==="*"){t[n+1]==="*"?(e+=".*",n+=1):e+="[^/]*";continue}e+=xt(r)}return e+="$",new RegExp(e)}function cn(t,e){for(let n of e)if(n.test(t))return!0;return!1}function ln(t,e){let n=M([t],(o,i)=>{let s=o[0];if(s==null||s.length===0){i.down([[w]]);return}for(let a of s)i.emit(a)},{describeKind:"derived",initial:t.cache}),r=n.subscribe.bind(n);return n.subscribe=(o,i)=>(e(o),r(o,i)),n}function fn(t,e){let{signal:n,period:r,...o}=e??{};return N(i=>{let s=!1,a=0,u,d,c=()=>{s=!0,u!==void 0&&clearTimeout(u),d!==void 0&&clearInterval(d),n?.removeEventListener("abort",f)},l=()=>{s||(r!=null?(i.emit(a++),d=setInterval(()=>{s||i.emit(a++)},r)):(s=!0,n?.removeEventListener("abort",f),i.emit(a++),i.down([[_]])))},f=()=>{s||(c(),i.down([[p,n.reason]]))};if(n?.aborted){f();return}return u=setTimeout(l,t),n?.addEventListener("abort",f,{once:!0}),c},S(o))}function pn(t){let{signal:e,...n}=t??{};return N(r=>{let o=!1,i,s,a=!1,u=!1,d=typeof requestAnimationFrame=="function"?requestAnimationFrame:void 0,c=typeof cancelAnimationFrame=="function"?cancelAnimationFrame:void 0,l=typeof document<"u"?document:void 0,f=()=>{i!==void 0&&c&&c(i),s!==void 0&&clearTimeout(s),i=void 0,s=void 0},h=()=>{o=!0,f(),a&&(e?.removeEventListener("abort",T),a=!1),u&&l&&(l.removeEventListener("visibilitychange",m),u=!1)},T=()=>{o||(h(),r.down([[p,e.reason]]))},y=x=>{o||(r.emit(x),b())},b=()=>{o||(d&&(!l||l.visibilityState!=="hidden")?i=d(y):s=setTimeout(()=>y(performance.now()),16))},m=()=>{o||(f(),b())};return e?.aborted?(T(),h):(e?.addEventListener("abort",T,{once:!0}),a=e!==void 0,l&&d&&(l.addEventListener("visibilitychange",m),u=!0),b(),h)},S(n))}function hn(t,e){let n=at(t),{tickMs:r,output:o,...i}=e??{},s=r??6e4,a=o==="date";return N(u=>{let d=-1,c=()=>{let f=new Date,h=f.getFullYear()*1e8+(f.getMonth()+1)*1e6+f.getDate()*1e4+f.getHours()*100+f.getMinutes();h!==d&&ut(n,f)&&(d=h,u.emit(a?f:se()))};c();let l=setInterval(c,s);return()=>clearInterval(l)},{...S(i),name:i.name??`cron:${t}`})}function mn(t,e,n){let{capture:r,passive:o,once:i,...s}=n??{};return N(a=>{let u=c=>{a.emit(c)},d={capture:r,passive:o,once:i};return t.addEventListener(e,u,d),()=>t.removeEventListener(e,u,d)},S(s))}function Ve(t,e){return N(n=>{let r=!1;try{for(let o of t){if(r)return;n.emit(o)}r||n.down([[_]])}catch(o){r||n.down([[p,o]])}return()=>{r=!0}},S(e))}function bn(t){return t!=null&&typeof t.then=="function"}function Nt(t,e){let{signal:n,...r}=e??{};return N(o=>{let i=!1,s=()=>{i||(i=!0,o.down([[p,n.reason]]))};if(n?.aborted){s();return}return n?.addEventListener("abort",s,{once:!0}),Promise.resolve(t).then(a=>{i||(i=!0,n?.removeEventListener("abort",s),o.emit(a),o.down([[_]]))},a=>{i||(i=!0,n?.removeEventListener("abort",s),o.down([[p,a]]))}),()=>{i=!0,n?.removeEventListener("abort",s)}},S(r))}function kt(t,e){let{signal:n,...r}=e??{};return N(o=>{let i=new AbortController,s=()=>i.abort(n?.reason);n?.aborted?i.abort(n.reason):n?.addEventListener("abort",s,{once:!0});let a=n??i.signal,u=!1,d=t[Symbol.asyncIterator](),c=()=>{u||a.aborted||Promise.resolve(d.next()).then(l=>{if(!(u||a.aborted)){if(l.done){o.down([[_]]);return}o.emit(l.value),c()}},l=>{!u&&!a.aborted&&o.down([[p,l]])})};return c(),()=>{u=!0,n?.removeEventListener("abort",s),i.abort(),Promise.resolve(d.return?.()).catch(()=>{})}},S(r))}function gn(t){return t!=null&&typeof t=="object"&&"cache"in t&&typeof t.subscribe=="function"}function _e(t,e){if(gn(t))return t;if(bn(t))return Nt(t,e);if(t!=null){let n=t;if(typeof n[Symbol.asyncIterator]=="function")return kt(t,e);if(typeof n[Symbol.iterator]=="function")return Ve(t,e)}return Et(t)}function Et(...t){return Ve(t,void 0)}function _n(t){return N(e=>{e.down([[_]])},S(t))}function yn(t){return N(()=>{},S(t))}function wn(t,e){return N(n=>{n.down([[p,t]])},S(e))}function Tn(t,e){let{signal:n,...r}=e??{},o=S(r),i=o.resubscribable===void 0?{...o,resubscribable:!0}:o;return N(s=>{let a,u=!1;try{let d=t();a=_e(d,e).subscribe(l=>{if(!u)for(let f of l){let h=f[0];if(h!==C)if(h===g)s.emit(f[1]);else if(h===_){u=!0,s.down([[_]]);break}else if(h===p){u=!0,s.down([[p,f[1]]]);break}else s.down([f])}})}catch(d){let c=d===void 0?new Error("defer: thunk threw undefined"):d;s.down([[p,c]])}return()=>{u=!0,a?.()}},i)}function vn(t,e,n){return M([t],(o,i)=>{let s=o[0];if(s!=null&&s.length>0)for(let a of s)e(a)},{describeKind:"effect",...n}).subscribe(()=>{})}function xn(t,e){return M([t],(n,r,o)=>{o.store.buf||(o.store.buf=[]);let i=o.store.buf,s=n[0];if(s!=null&&s.length>0)for(let a of s)i.push(a);if(o.terminalDeps[0]===!0){r.emit([...i]),r.down([[_]]);return}(s==null||s.length===0)&&r.down([[w]])},{describeKind:"derived",completeWhenDepsComplete:!1,...e})}function Nn(t,e){return N(n=>t.subscribe(r=>{n.down(r)}),{...S(e),initial:t.cache})}function He(t,e,n){if(e<1)throw new RangeError("replay expects bufferSize >= 1");let r=[],o=N(i=>t.subscribe(s=>{for(let a of s)a[0]===g&&(r.push(a[1]),r.length>e&&r.shift());i.down(s)}),{...S(n),initial:t.cache});return ln(o,i=>{for(let s of r)i([[g,s]])})}function kn(t,e){return He(t,1,e)}function En(t){return new Promise((e,n)=>{let r=!1,o=!1,i;i=t.subscribe(s=>{for(let a of s){if(r)return;if(a[0]===g){r=!0,e(a[1]),i?(i(),i=void 0):o=!0;return}if(a[0]===p){r=!0,n(a[1]),i?(i(),i=void 0):o=!0;return}if(a[0]===_){r=!0,n(new Error("completed without DATA")),i?(i(),i=void 0):o=!0;return}}}),o&&(i?.(),i=void 0)})}function Ge(t,e,n){return new Promise((r,o)=>{let i=!1,s=!1,a,u=n?.skipCurrent===!0;a=t.subscribe(d=>{for(let c of d){if(i)return;if(!(u&&c[0]===g)){if(c[0]===g){let l=c[1];if(e(l)){i=!0,r(l),a?(a(),a=void 0):s=!0;return}}if(c[0]===p){i=!0,o(c[1]),a?(a(),a=void 0):s=!0;return}if(c[0]===_){i=!0,o(new Error("completed without matching value")),a?(a(),a=void 0):s=!0;return}}}}),u=!1,s&&(a?.(),a=void 0)})}async function Sn(t,e){let n=e?.predicate??(i=>i!=null),r=e?.skipCurrent;if(e?.timeoutMs==null||e.timeoutMs<=0)return await Ge(t,n,{skipCurrent:r});if(Be===void 0){let[i,s]=await Promise.all([Promise.resolve().then(()=>(wt(),yt)),Promise.resolve().then(()=>(Pe(),mt))]);Be=i.timeout,vt=s.NS_PER_MS}let o=Be(t,e.timeoutMs*vt);return await Ge(o,n,{skipCurrent:r})}function An(t,e){let n=new AbortController,r=e?.reason??new Error("cancelled via nodeSignal"),o,i=!1,s=()=>{o?(o(),o=void 0):i=!0};return o=t.subscribe(a=>{if(!n.signal.aborted)for(let u of a){if(u[0]===g&&u[1]===!0){n.abort(r),s();return}if(u[0]===p){n.abort(u[1]),s();return}if(u[0]===_){s();return}}}),i&&(o?.(),o=void 0),{signal:n.signal,dispose:()=>{o&&(o(),o=void 0)}}}function Mn(t){return t.subscribe(()=>{})}function Rn(t){let e=it(0);return{node:e,increment(){let n=e.cache??0;return n>=t?!1:(e.down([[v],[g,n+1]]),!0)},get(){return e.cache??0},atCap(){return(e.cache??0)>=t}}}var Be,vt,On,Tt=E(()=>{ie();Z();fe();Le();dt();On=He});Tt();0&&(module.exports={awaitSettled,cached,defer,empty,escapeRegexChar,firstValueFrom,firstWhere,forEach,fromAny,fromAsyncIter,fromCron,fromEvent,fromIter,fromPromise,fromRaf,fromTimer,globToRegExp,keepalive,matchesAnyPattern,never,nodeSignal,of,reactiveCounter,replay,share,shareReplay,throwError,toArray});
@@ -1,4 +1,4 @@
1
- import { N as NodeOptions, a as Node } from '../node-8qx0kgYt.cjs';
1
+ import { N as NodeOptions, a as Node } from '../node-fSc-hCv8.cjs';
2
2
 
3
3
  /**
4
4
  * Core reactive sources, sinks, and utilities (roadmap §2.3).
@@ -272,6 +272,61 @@ declare function never<T = never>(opts?: ExtraOpts): Node<T>;
272
272
  * @category extra
273
273
  */
274
274
  declare function throwError(err: unknown, opts?: ExtraOpts): Node<never>;
275
+ /**
276
+ * Lazily constructs a {@link Node} from a thunk that runs at **activation
277
+ * time** (first subscriber after a teardown to zero sinks), not factory time.
278
+ *
279
+ * **Resubscribable by default.** Diverges from `fromPromise` / `fromIter` /
280
+ * `fromAsyncIter` (which are single-shot — second subscriber sees the cached
281
+ * terminal value). `defer`'s contract matches RxJS `defer`: every fresh
282
+ * activation cycle re-runs the thunk. To opt out and get one-shot semantics,
283
+ * pass `{ resubscribable: false }`.
284
+ *
285
+ * **Sharing across overlapping subscribers.** The thunk only re-runs on a
286
+ * fresh activation cycle (zero → one sink). Overlapping subscribers share
287
+ * the single activation; the thunk does NOT re-run for each subscriber. If
288
+ * the thunk returns an existing `Node`, that Node is shared across activations
289
+ * — `defer` will subscribe to it on each activation but does not isolate state
290
+ * across subscribers. For per-subscriber isolation, the thunk must construct
291
+ * a fresh source (`state(...)`, `fromPromise(fetch(...))`, etc.) on each call.
292
+ *
293
+ * **Use cases:**
294
+ * - Lazy upstream construction (avoid eager evaluation of expensive factories
295
+ * at module load — the thunk runs only when something subscribes).
296
+ * - Per-activation resource construction (open a connection / file handle on
297
+ * subscribe, when paired with full teardown between sessions).
298
+ * - Bridging non-Node inputs (Promise, AsyncIterable, Iterable, scalar) into
299
+ * the graph behind a lazy boundary.
300
+ *
301
+ * The thunk's return value is bridged via {@link fromAny}. Errors thrown by
302
+ * the thunk surface as a single `[[ERROR, err]]` on the output (with `err`
303
+ * coerced to a non-`undefined` value to satisfy spec §1.3 — bare `throw` and
304
+ * `throw undefined` are wrapped in a `defer: thunk threw undefined` Error).
305
+ *
306
+ * Upstream messages are forwarded transparently (DIRTY / DATA / RESOLVED /
307
+ * COMPLETE / ERROR / INVALIDATE / PAUSE / RESUME / TEARDOWN), preserving
308
+ * batch boundaries. The producer's own `START` handshake is delivered to
309
+ * subscribers automatically; the upstream's `START` is filtered.
310
+ *
311
+ * @param thunk - Called on each activation; returns the upstream input.
312
+ * @param opts - Forwarded to `fromAny` (e.g. `signal` for async inputs).
313
+ * `signal` is only consumed by `fromAny` for async input shapes (Promise,
314
+ * AsyncIterable); it does NOT abort a Node-input or scalar-input defer.
315
+ * @returns `Node<T>` — lazy upstream-on-activation.
316
+ *
317
+ * @example
318
+ * ```ts
319
+ * import { defer } from "@graphrefly/graphrefly-ts";
320
+ *
321
+ * // Lazy fetch — runs on the first activation, NOT at factory time.
322
+ * // Each fresh activation cycle (after teardown) re-runs the thunk →
323
+ * // a new fetch. Overlapping subscribers share the single activation.
324
+ * const live = defer(() => fetch("/api/feed").then((r) => r.json()));
325
+ * ```
326
+ *
327
+ * @category extra
328
+ */
329
+ declare function defer<T>(thunk: () => NodeInput<T>, opts?: AsyncSourceOpts): Node<T>;
275
330
  /**
276
331
  * Subscribes immediately and runs `fn` for each upstream `DATA`; returns unsubscribe.
277
332
  *
@@ -526,4 +581,4 @@ type ReactiveCounterBundle = {
526
581
  */
527
582
  declare function reactiveCounter(cap: number): ReactiveCounterBundle;
528
583
 
529
- export { type AsyncSourceOpts, type EventTargetLike, type FromCronOptions, type NodeInput, type ReactiveCounterBundle, awaitSettled, cached, empty, escapeRegexChar, firstValueFrom, firstWhere, forEach, fromAny, fromAsyncIter, fromCron, fromEvent, fromIter, fromPromise, fromRaf, fromTimer, globToRegExp, keepalive, matchesAnyPattern, never, nodeSignal, of, reactiveCounter, replay, share, shareReplay, throwError, toArray };
584
+ export { type AsyncSourceOpts, type EventTargetLike, type FromCronOptions, type NodeInput, type ReactiveCounterBundle, awaitSettled, cached, defer, empty, escapeRegexChar, firstValueFrom, firstWhere, forEach, fromAny, fromAsyncIter, fromCron, fromEvent, fromIter, fromPromise, fromRaf, fromTimer, globToRegExp, keepalive, matchesAnyPattern, never, nodeSignal, of, reactiveCounter, replay, share, shareReplay, throwError, toArray };
@@ -1,4 +1,4 @@
1
- import { N as NodeOptions, a as Node } from '../node-8qx0kgYt.js';
1
+ import { N as NodeOptions, a as Node } from '../node-fSc-hCv8.js';
2
2
 
3
3
  /**
4
4
  * Core reactive sources, sinks, and utilities (roadmap §2.3).
@@ -272,6 +272,61 @@ declare function never<T = never>(opts?: ExtraOpts): Node<T>;
272
272
  * @category extra
273
273
  */
274
274
  declare function throwError(err: unknown, opts?: ExtraOpts): Node<never>;
275
+ /**
276
+ * Lazily constructs a {@link Node} from a thunk that runs at **activation
277
+ * time** (first subscriber after a teardown to zero sinks), not factory time.
278
+ *
279
+ * **Resubscribable by default.** Diverges from `fromPromise` / `fromIter` /
280
+ * `fromAsyncIter` (which are single-shot — second subscriber sees the cached
281
+ * terminal value). `defer`'s contract matches RxJS `defer`: every fresh
282
+ * activation cycle re-runs the thunk. To opt out and get one-shot semantics,
283
+ * pass `{ resubscribable: false }`.
284
+ *
285
+ * **Sharing across overlapping subscribers.** The thunk only re-runs on a
286
+ * fresh activation cycle (zero → one sink). Overlapping subscribers share
287
+ * the single activation; the thunk does NOT re-run for each subscriber. If
288
+ * the thunk returns an existing `Node`, that Node is shared across activations
289
+ * — `defer` will subscribe to it on each activation but does not isolate state
290
+ * across subscribers. For per-subscriber isolation, the thunk must construct
291
+ * a fresh source (`state(...)`, `fromPromise(fetch(...))`, etc.) on each call.
292
+ *
293
+ * **Use cases:**
294
+ * - Lazy upstream construction (avoid eager evaluation of expensive factories
295
+ * at module load — the thunk runs only when something subscribes).
296
+ * - Per-activation resource construction (open a connection / file handle on
297
+ * subscribe, when paired with full teardown between sessions).
298
+ * - Bridging non-Node inputs (Promise, AsyncIterable, Iterable, scalar) into
299
+ * the graph behind a lazy boundary.
300
+ *
301
+ * The thunk's return value is bridged via {@link fromAny}. Errors thrown by
302
+ * the thunk surface as a single `[[ERROR, err]]` on the output (with `err`
303
+ * coerced to a non-`undefined` value to satisfy spec §1.3 — bare `throw` and
304
+ * `throw undefined` are wrapped in a `defer: thunk threw undefined` Error).
305
+ *
306
+ * Upstream messages are forwarded transparently (DIRTY / DATA / RESOLVED /
307
+ * COMPLETE / ERROR / INVALIDATE / PAUSE / RESUME / TEARDOWN), preserving
308
+ * batch boundaries. The producer's own `START` handshake is delivered to
309
+ * subscribers automatically; the upstream's `START` is filtered.
310
+ *
311
+ * @param thunk - Called on each activation; returns the upstream input.
312
+ * @param opts - Forwarded to `fromAny` (e.g. `signal` for async inputs).
313
+ * `signal` is only consumed by `fromAny` for async input shapes (Promise,
314
+ * AsyncIterable); it does NOT abort a Node-input or scalar-input defer.
315
+ * @returns `Node<T>` — lazy upstream-on-activation.
316
+ *
317
+ * @example
318
+ * ```ts
319
+ * import { defer } from "@graphrefly/graphrefly-ts";
320
+ *
321
+ * // Lazy fetch — runs on the first activation, NOT at factory time.
322
+ * // Each fresh activation cycle (after teardown) re-runs the thunk →
323
+ * // a new fetch. Overlapping subscribers share the single activation.
324
+ * const live = defer(() => fetch("/api/feed").then((r) => r.json()));
325
+ * ```
326
+ *
327
+ * @category extra
328
+ */
329
+ declare function defer<T>(thunk: () => NodeInput<T>, opts?: AsyncSourceOpts): Node<T>;
275
330
  /**
276
331
  * Subscribes immediately and runs `fn` for each upstream `DATA`; returns unsubscribe.
277
332
  *
@@ -526,4 +581,4 @@ type ReactiveCounterBundle = {
526
581
  */
527
582
  declare function reactiveCounter(cap: number): ReactiveCounterBundle;
528
583
 
529
- export { type AsyncSourceOpts, type EventTargetLike, type FromCronOptions, type NodeInput, type ReactiveCounterBundle, awaitSettled, cached, empty, escapeRegexChar, firstValueFrom, firstWhere, forEach, fromAny, fromAsyncIter, fromCron, fromEvent, fromIter, fromPromise, fromRaf, fromTimer, globToRegExp, keepalive, matchesAnyPattern, never, nodeSignal, of, reactiveCounter, replay, share, shareReplay, throwError, toArray };
584
+ export { type AsyncSourceOpts, type EventTargetLike, type FromCronOptions, type NodeInput, type ReactiveCounterBundle, awaitSettled, cached, defer, empty, escapeRegexChar, firstValueFrom, firstWhere, forEach, fromAny, fromAsyncIter, fromCron, fromEvent, fromIter, fromPromise, fromRaf, fromTimer, globToRegExp, keepalive, matchesAnyPattern, never, nodeSignal, of, reactiveCounter, replay, share, shareReplay, throwError, toArray };
@@ -1 +1 @@
1
- import{A as y,B as z,C as A,c as a,d as b,e as c,f as d,g as e,h as f,i as g,j as h,k as i,l as j,m as k,n as l,o as m,p as n,q as o,r as p,s as q,t as r,u as s,v as t,w as u,x as v,y as w,z as x}from"../chunk-T7EQPKOP.js";import"../chunk-LYCLF26R.js";import"../chunk-CK2E7BTU.js";import"../chunk-QYADASLV.js";export{w as awaitSettled,t as cached,m as empty,a as escapeRegexChar,u as firstValueFrom,v as firstWhere,p as forEach,k as fromAny,j as fromAsyncIter,f as fromCron,g as fromEvent,h as fromIter,i as fromPromise,e as fromRaf,d as fromTimer,b as globToRegExp,z as keepalive,c as matchesAnyPattern,n as never,x as nodeSignal,l as of,A as reactiveCounter,s as replay,r as share,y as shareReplay,o as throwError,q as toArray};
1
+ import{A as y,B as z,C as A,D as B,c as a,d as b,e as c,f as d,g as e,h as f,i as g,j as h,k as i,l as j,m as k,n as l,o as m,p as n,q as o,r as p,s as q,t as r,u as s,v as t,w as u,x as v,y as w,z as x}from"../chunk-MQZWA3DF.js";import"../chunk-LYCLF26R.js";import"../chunk-CK2E7BTU.js";import"../chunk-QYADASLV.js";export{x as awaitSettled,u as cached,p as defer,m as empty,a as escapeRegexChar,v as firstValueFrom,w as firstWhere,q as forEach,k as fromAny,j as fromAsyncIter,f as fromCron,g as fromEvent,h as fromIter,i as fromPromise,e as fromRaf,d as fromTimer,b as globToRegExp,A as keepalive,c as matchesAnyPattern,n as never,y as nodeSignal,l as of,B as reactiveCounter,t as replay,s as share,z as shareReplay,o as throwError,r as toArray};
@@ -1 +1 @@
1
- "use strict";var K=Object.defineProperty;var Se=Object.getOwnPropertyDescriptor;var De=Object.getOwnPropertyNames;var Re=Object.prototype.hasOwnProperty;var Oe=(n,e)=>{for(var t in e)K(n,t,{get:e[t],enumerable:!0})},Ce=(n,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of De(e))!Re.call(n,s)&&s!==t&&K(n,s,{get:()=>e[s],enumerable:!(r=Se(e,s))||r.enumerable});return n};var Ie=n=>Ce(K({},"__esModule",{value:!0}),n);var Ze={};Oe(Ze,{fromIDBRequest:()=>Ye,fromIDBTransaction:()=>Ke,indexedDbStorage:()=>Xe});module.exports=Ie(Ze);var G=Symbol.for("graphrefly/START"),y=Symbol.for("graphrefly/DATA"),A=Symbol.for("graphrefly/DIRTY"),E=Symbol.for("graphrefly/RESOLVED"),M=Symbol.for("graphrefly/INVALIDATE"),S=Symbol.for("graphrefly/PAUSE"),H=Symbol.for("graphrefly/RESUME"),N=Symbol.for("graphrefly/TEARDOWN"),v=Symbol.for("graphrefly/COMPLETE"),f=Symbol.for("graphrefly/ERROR"),D=Object.freeze([A]),J=Object.freeze([E]),Fe=Object.freeze([M]),X=Object.freeze([G]),Ge=Object.freeze([v]),He=Object.freeze([N]),Z=Object.freeze([D]),le=Object.freeze([J]),ce=Object.freeze([Fe]),ue=Object.freeze([Ge]),Q=Object.freeze([He]);var Le={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)}};function he(n){n.registerCodec(Le)}var Ve={type:"system",id:""};function B(n){if(n==null)return Ve;let{type:e,id:t,...r}=n;return{type:e??"system",id:t??"",...r}}var ee=0,Pe=!1,fe=[],pe=[],ge=[],Be=[];function _e(){return ee>0||Pe}function ye(){return ee>0}function me(n){ee>0?Be.push(n):n()}function U(n,e,t){if(e.length===0)return;if(e.length===1){let l=t(e[0][0]);if(l<3||!_e()){n(e);return}(l>=5?ge:l===4?pe:fe).push(()=>n(e));return}let r=e.length,s=r,i=r,a=r,o=0;for(;o<r&&t(e[o][0])<3;)o++;for(s=o;o<r&&t(e[o][0])===3;)o++;for(i=o;o<r&&t(e[o][0])===4;)o++;a=o;let d=_e();if(s>0){let l=e.slice(0,s);n(l)}if(i>s){let l=e.slice(s,i);d?fe.push(()=>n(l)):n(l)}if(a>i){let l=e.slice(i,a);d?pe.push(()=>n(l)):n(l)}if(r>a){let l=e.slice(a,r);d?ge.push(()=>n(l)):n(l)}}function be(){return Date.now()*1e6}var W=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 ve(n){n.registerMessageType(G,{tier:0,wireCrossing:!1}),n.registerMessageType(A,{tier:1,wireCrossing:!1}),n.registerMessageType(M,{tier:1,wireCrossing:!1,metaPassthrough:!1}),n.registerMessageType(S,{tier:2,wireCrossing:!1}),n.registerMessageType(H,{tier:2,wireCrossing:!1}),n.registerMessageType(y,{tier:3,wireCrossing:!0}),n.registerMessageType(E,{tier:3,wireCrossing:!0}),n.registerMessageType(v,{tier:4,wireCrossing:!0,metaPassthrough:!1}),n.registerMessageType(f,{tier:4,wireCrossing:!0,metaPassthrough:!1}),n.registerMessageType(N,{tier:5,wireCrossing:!0,metaPassthrough:!1})}var R=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}};function te(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(te);if(typeof n=="object"&&n!==null){let e={};for(let t of Object.keys(n).sort())e[t]=te(n[t]);return e}return null}var Ue=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]),We=new TextEncoder;function je(n){let e=We.encode(n),t=e.length,r=t*8,s=t+9+63&-64,i=new Uint8Array(s);i.set(e),i[t]=128;let a=new DataView(i.buffer);a.setUint32(s-4,r>>>0,!1),a.setUint32(s-8,Math.floor(r/4294967296)>>>0,!1);let o=1779033703,d=3144134277,l=1013904242,c=2773480762,h=1359893119,p=2600822924,u=528734635,_=1541459225,k=new Uint32Array(64),b=(x,m)=>x>>>m|x<<32-m;for(let x=0;x<s;x+=64){for(let g=0;g<16;g++)k[g]=a.getUint32(x+g*4,!1);for(let g=16;g<64;g++){let I=k[g-15],F=k[g-2],P=b(I,7)^b(I,18)^I>>>3,Y=b(F,17)^b(F,19)^F>>>10;k[g]=k[g-16]+P+k[g-7]+Y>>>0}let m=o,O=d,C=l,$=c,T=h,L=p,V=u,q=_;for(let g=0;g<64;g++){let I=b(T,6)^b(T,11)^b(T,25),F=T&L^~T&V,P=q+I+F+Ue[g]+k[g]>>>0,Y=b(m,2)^b(m,13)^b(m,22),Ee=m&O^m&C^O&C,Me=Y+Ee>>>0;q=V,V=L,L=T,T=$+P>>>0,$=C,C=O,O=m,m=P+Me>>>0}o=o+m>>>0,d=d+O>>>0,l=l+C>>>0,c=c+$>>>0,h=h+T>>>0,p=p+L>>>0,u=u+V>>>0,_=_+q>>>0}let w=x=>x.toString(16).padStart(8,"0");return w(o)+w(d)+w(l)+w(c)+w(h)+w(p)+w(u)+w(_)}function ne(n){let e=te(n??null),t=JSON.stringify(e);return je(t).slice(0,16)}function ze(){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 re(n,e,t){let r=t?.id??ze();if(n===0)return{id:r,version:0};let i=(t?.hash??ne)(e);return{id:r,version:0,cid:i,prev:null}}function we(n,e,t){n.version+=1,"cid"in n&&(n.prev=n.cid,n.cid=t(e))}var xe=()=>{},Te=100;function Ne(n){return{node:n,unsub:null,prevData:void 0,dirty:!1,involvedThisWave:!1,dataBatch:[],terminal:void 0}}function se(n){n.prevData=void 0,n.dirty=!1,n.involvedThisWave=!1,n.dataBatch.length=0,n.terminal=void 0}function j(n){return n.length===0?n:typeof n[0]=="symbol"?[n]:n}var $e=(n,e,t,r)=>{t.direction==="down-in"&&n._onDepMessage(t.depIndex,e)},qe=(n,e,t,r)=>{let s=n;if(s._status==="completed"||s._status==="errored")return;let i=s._cached,a=i===void 0?[X]:[X,[y,i]];s._status==="dirty"&&a.push(D),U(e,a,s._config.tierOf)},ie=new W({onMessage:$e,onSubscribe:qe});ve(ie);he(ie);var z=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??ie,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??ne;let s=r.versioning??this._config.defaultVersioning;this._versioningLevel=s,this._versioning=s!=null?re(s,this._cached===void 0?void 0:this._cached,{id:r.versioningId,hash:this._hashFn}):void 0,this._deps=e.map(Ne);let i={};for(let[o,d]of Object.entries(r.meta??{})){let l={initial:d,name:`${r.name??"node"}:meta:${o}`,describeKind:"state",config:this._config};r.guard!=null&&(l.guard=r.guard),i[o]=new n([],void 0,l)}Object.freeze(i),this.meta=i,this._hasMeta=Object.keys(i).length>0;let a=this;this._actions={emit(o){a._emit([[y,o]])},down(o){a._emit(j(o))},up(o){a._emitUp(j(o))}},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 s=t?.hash??this._hashFn;s!==this._hashFn&&(this._hashFn=s);let i=this._cached===void 0?void 0:this._cached,a=this._versioning,o=a?.id??t?.id,d=a?.version??0,l=re(e,i,{id:o,hash:s});l.version=d,this._versioning=l,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=B(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 s=B(e?.actor),i=e?.delivery==="signal"?"signal":"write";if(this._guard!=null&&!this._guard(s,i))throw new R({actor:s,action:i,nodeName:this.name});if(this._extraGuards!=null){for(let a of this._extraGuards)if(!a(s,i))throw new R({actor:s,action:i,nodeName:this.name})}this._lastMutation={actor:s,timestamp_ns:be()}}down(e,t){let r=j(e);r.length!==0&&(this._checkGuard(t),this._emit(r))}emit(e,t){this._checkGuard(t),this._emit([[y,e]])}up(e,t){if(this._deps.length===0)return;let r=j(e);if(r.length===0)return;this._checkGuard(t);let s=t??{internal:!0};this._validateUpTiers(r);for(let i of this._deps)i.node.up?.(r,s)}_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 s=t(r[0]);if(s===3||s===4)throw new Error(`Node "${this.name}": tier-${s} 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=B(t);if(!this._guard(d,"observe"))throw new R({actor:d,action:"observe",nodeName:this.name})}let s=this._isTerminal&&this._resubscribable;if(s){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)se(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 i;try{i=this._config.onSubscribe(this,e,{sinkCount:this._sinkCount,afterTerminalReset:s},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 a=this._isTerminal;if(this._sinkCount===1&&!a)try{this._activate()}catch(d){if(this._sinkCount-=1,this._removeSink(e),this._sinkCount===0&&(this._status="sentinel"),typeof i=="function")try{i()}catch{}throw d}this._status==="sentinel"&&this._cached===void 0&&(this._status="pending");let o=!1;return()=>{o||(o=!0,this._sinkCount-=1,this._removeSink(e),typeof i=="function"&&i(),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 s=r,i=this._deps[r];i.unsub=xe,i.unsub=i.node.subscribe(a=>{if(i.unsub===null)return;let o=this._config.tierOf,d=!1;for(let l of a)o(l[0])>=3&&(d=!0),this._config.onMessage(this,l,{direction:"down-in",depIndex:s},this._actions);d&&this._maybeRunFnOnSettlement()}),t++}}catch(r){this._deps[t].unsub=null;for(let s=0;s<t;s++){let i=this._deps[s];if(i.unsub!=null){let a=i.unsub;i.unsub=null;try{a()}catch{}se(i)}}throw this._dirtyDepCount=0,r}}_addDep(e){for(let s=0;s<this._deps.length;s++)if(this._deps[s].node===e)return s;let t=this._deps.length,r=Ne(e);if(this._deps.push(r),this._sinks==null)return t;r.dirty=!0,this._dirtyDepCount++,this._status!=="dirty"&&this._emit(Z),r.unsub=xe;try{r.unsub=e.subscribe(s=>{if(r.unsub===null)return;let i=this._config.tierOf,a=!1;for(let o of s)i(o[0])>=3&&(a=!0),this._config.onMessage(this,o,{direction:"down-in",depIndex:t},this._actions);a&&this._maybeRunFnOnSettlement()})}catch(s){throw r.unsub=null,this._deps.pop(),this._dirtyDepCount--,s}return t}_deactivate(e=!1){let t=this._cleanup;if(this._cleanup=void 0,typeof t=="function")try{t()}catch(r){this._emit([[f,this._wrapFnError("cleanup threw",r)]])}else if(t!=null&&typeof t=="object"){let r=t.deactivate;if(typeof r=="function")try{r()}catch(s){this._emit([[f,this._wrapFnError("cleanup.deactivate threw",s)]])}}for(let r of this._deps){if(r.unsub!=null){let s=r.unsub;r.unsub=null;try{s()}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,t){let r=this._deps[e],s=t[0];if(this._inspectorHooks!=null){let i={kind:"dep_message",depIndex:e,message:t};for(let a of this._inspectorHooks)a(i)}if(s!==G){if(s===A){this._depDirtied(r);return}if(s===M){if(this._depInvalidated(r),this._cached===void 0)return;this._emit(ce);return}if(s===S||s===H){this._emit([t]);return}if(s===N){this._emit(Q);return}if(s===y)this._depSettledAsData(r,t[1]);else if(s===E)this._depSettledAsResolved(r);else if(s===v)this._depSettledAsTerminal(r,!0);else if(s===f)this._depSettledAsTerminal(r,t[1]);else{this._emit([t]);return}if(!this._fn){(s===y||s===E)&&this._emit([t]),(s===v||s===f)&&this._maybeAutoTerminalAfterWave();return}}}_depDirtied(e){e.dirty||(e.dirty=!0,e.involvedThisWave=!0,this._dirtyDepCount++,this._status!=="dirty"&&this._emit(Z))}_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(le),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([[f,e.terminal]]);return}this._autoComplete&&this._deps.every(t=>t.terminal!==void 0)&&this._emit(ue)}_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(a){this._emit([[f,this._wrapFnError("cleanup threw",a)]]);return}}else if(e!=null&&typeof e=="object"){let a=e.beforeRun;if(typeof a=="function"){e.beforeRun=void 0;try{a()}catch(o){this._emit([[f,this._wrapFnError("cleanup.beforeRun threw",o)]]);return}}}let t=this._deps.map(a=>a.involvedThisWave?a.dataBatch.length>0?[...a.dataBatch]:[]:void 0),r=this._deps.map(a=>a.prevData);for(let a=0;a<this._deps.length;a++){let o=t[a];o!=null&&o.length>0&&(this._deps[a].prevData=o[o.length-1])}let s=this._deps.map(a=>a.terminal),i={prevData:r,terminalDeps:s,store:this._store};if(this._hasCalledFnOnce=!0,this._clearWaveFlags(),this._inspectorHooks!=null){let a={kind:"run",batchData:t,prevData:r};for(let o of this._inspectorHooks)o(a)}this._isExecutingFn=!0;try{let a=this._fn(t,this._actions,i);if(typeof a=="function")this._cleanup=a;else if(a!=null&&typeof a=="object"){let o=a;(typeof o.beforeRun=="function"||typeof o.deactivate=="function"||typeof o.invalidate=="function")&&(this._cleanup=a)}}catch(a){this._emit([[f,this._wrapFnError("fn threw",a)]])}finally{this._isExecutingFn=!1,this._pendingRerun?(this._pendingRerun=!1,this._rerunDepth+=1,this._rerunDepth>Te?(this._rerunDepth=0,this._emit([[f,new Error(`Node "${this.name}": _pendingRerun depth exceeded ${Te} \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"?[D,e[0]]:e;let r=!0,s=!1,i=!1,a=-1;for(let d of e){let l=t(d[0]);l<a&&(r=!1),l===3&&(s=!0),d[0]===A&&(i=!0),a=l}let o=e;if(!r){let d=e.map((l,c)=>({m:l,i:c,tier:t(l[0])}));d.sort((l,c)=>l.tier-c.tier||l.i-c.i),o=d.map(l=>l.m)}if(s&&!i&&this._status!=="dirty"){let d=0;for(;d<o.length&&t(o[d][0])===0;)d++;return d===0?[D,...o]:[...o.slice(0,d),D,...o.slice(d)]}return o}_emit(e){if(e.length===0)return;for(let o=0;o<e.length;o++){let d=e[o];if(d[0]===f&&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 o=e.filter(d=>d[0]===N||d[0]===M);if(o.length===0)return;t=o}t=this._frameBatch(t);let s=null;for(let o=0;o<t.length;o++){let d=t[o],l=d[0];if(l!==S&&l!==H){s?.push(d);continue}if(d.length<2)throw new Error(`Node "${this.name}": [[${l===S?"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 h=d[1];if(l===S)this._pauseLocks==null&&(this._pauseLocks=new Set),this._pauseLocks.add(h),this._paused=!0,this._pausable==="resumeAll"&&this._pauseBuffer==null&&(this._pauseBuffer=[]);else if(this._pauseLocks==null||!this._pauseLocks.has(h))c=!1;else if(this._pauseLocks.delete(h),this._pauseLocks.size===0){if(this._paused=!1,this._pauseBuffer!=null&&this._pauseBuffer.length>0){let p=this._pauseBuffer;this._pauseBuffer=[],this._emit(p)}this._pendingWave&&(this._pendingWave=!1,this._maybeRunFnOnSettlement())}}c?s?.push(d):s==null&&(s=t.slice(0,o))}if(s!=null){if(s.length===0)return;t=s}if(this._hasMeta&&t.some(o=>o[0]===N))for(let o of Object.keys(this.meta))try{this.meta[o]._emit(Q)}catch{}let{finalMessages:i,equalsError:a}=this._updateState(t);if(i.length>0&&this._config.inspectorEnabled){let o=this._config.globalInspector;if(o!=null)try{o({kind:"emit",node:this,messages:i})}catch{}}if(i.length>0)if(this._paused&&this._pausable==="resumeAll"&&this._pauseBuffer!=null){let o=this._config.tierOf,d=[];for(let l of i)o(l[0])===3?this._pauseBuffer.push(l):d.push(l);d.length>0&&this._dispatchOrAccumulate(d)}else this._dispatchOrAccumulate(i);a!=null&&this._emit([[f,a]])}_updateState(e){let t=this._config.tierOf,r,s,i=-1,a=0;for(let c of e)t(c[0])===3&&a++;let o=a<=1,d=-1;if(this._versioning!=null&&a>1){for(let c=e.length-1;c>=0;c--)if(e[c][0]===y){d=c;break}}for(let c=0;c<e.length;c++){let h=e[c],p=h[0];if(p===y){if(h.length>=2){let u=!1;if(o&&this._cached!==void 0)try{u=this._equals(this._cached,h[1])}catch(_){s=this._wrapFnError("equals threw",_),i=c;break}if(u){r==null&&(r=e.slice(0,c)),r.push(J),this._status="resolved";continue}this._cached=h[1],this._versioning!=null&&(d<0||c===d)&&we(this._versioning,h[1],this._hashFn)}this._status="settled",r?.push(h)}else if(r?.push(h),p===A)this._status="dirty";else if(p===E)this._status="resolved";else if(p===v){this._status="completed";{let u=this._config.rigorRecorder;if(u!=null)try{u.onTerminalTransition(this,"completed",this._autoComplete,this._autoError,this._deps.length>0)}catch{}}}else if(p===f){this._status="errored";{let u=this._config.rigorRecorder;if(u!=null)try{u.onTerminalTransition(this,"errored",this._autoComplete,this._autoError,this._deps.length>0)}catch{}}}else if(p===M){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 u=this._cleanup;if(typeof u=="function"){this._cleanup=void 0;try{u()}catch{}}else if(u!=null&&typeof u=="object"){let _=u.invalidate;if(typeof _=="function")try{_()}catch{}}}else p===N&&(this._resetOnTeardown&&(this._cached=void 0),this._deactivate(!0),this._status="sentinel")}let l=i>=0?r??e.slice(0,i):r??e;return s!=null?{finalMessages:l,equalsError:s}:{finalMessages:l}}_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(ye()){this._batchPendingMessages===null&&(this._batchPendingMessages=[],me(()=>this._flushBatchPending()));for(let t of e)this._batchPendingMessages.push(t);return}U(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);U(this._deliverToSinks,t,this._config.tierOf)}},ke=n=>Array.isArray(n),oe=n=>typeof n=="object"&&n!=null&&!Array.isArray(n);function Ae(n,e,t){let r=ke(n)?n:[],s=typeof n=="function"?n:typeof e=="function"?e:void 0,i={};return ke(n)?i=(oe(e)?e:t)??{}:oe(n)?i=n:i=(oe(e)?e:t)??{},new z(r,s,i)}function ae(n,e){return Ae((r,s,i)=>n(s,i)??void 0,{describeKind:"producer",...e})}function Ye(n){return ae(e=>{let t=!1,r=()=>{n.onsuccess=null,n.onerror=null};return n.onsuccess=()=>{t||(t=!0,r(),e.down([[y,n.result],[v]]))},n.onerror=()=>{t||(t=!0,r(),e.down([[f,n.error??new Error("IndexedDB request failed")]]))},()=>{t=!0,r()}})}function Ke(n){return ae(e=>{let t=!1,r=()=>{n.oncomplete=null,n.onerror=null,n.onabort=null};return n.oncomplete=()=>{t||(t=!0,r(),e.down([[y,void 0],[v]]))},n.onerror=()=>{t||(t=!0,r(),e.down([[f,n.error??new Error("IndexedDB transaction failed")]]))},n.onabort=()=>{t||(t=!0,r(),e.down([[f,n.error??new Error("IndexedDB transaction aborted")]]))},()=>{t=!0,r()}})}function Je(n,e,t){return new Promise((r,s)=>{if(typeof indexedDB>"u"){s(new TypeError("indexedDB is not available in this environment"));return}let i=indexedDB.open(n,t);i.onupgradeneeded=()=>{let a=i.result;a.objectStoreNames.contains(e)||a.createObjectStore(e)},i.onsuccess=()=>r(i.result),i.onerror=()=>s(i.error??new Error("IndexedDB open failed"))})}function de(n,e,t,r,s){return Je(n,e,t).then(i=>new Promise((a,o)=>{let d=i.transaction(e,r),l=d.objectStore(e),c=s(l),h,p=!1,u=!1,_=()=>{!p||!u||(i.close(),a(h))};c.onsuccess=()=>{h=c.result,p=!0,_()},c.onerror=()=>{i.close(),o(c.error??new Error("IndexedDB request failed"))},d.oncomplete=()=>{if(u=!0,!p){i.close(),o(new Error("IndexedDB transaction completed without request result"));return}_()},d.onerror=()=>{i.close(),o(d.error??new Error("IndexedDB transaction failed"))},d.onabort=()=>{i.close(),o(d.error??new Error("IndexedDB transaction aborted"))}}))}function Xe(n){let{dbName:e,storeName:t}=n,r=n.version??1,s=n.key??"graphrefly_checkpoint";return{async save(i,a){await de(e,t,r,"readwrite",o=>o.put(a,s))},async load(i){let a=await de(e,t,r,"readonly",o=>o.get(s));return a==null||typeof a!="object"||Array.isArray(a)?null:a},async clear(i){await de(e,t,r,"readwrite",a=>a.delete(s))}}}0&&(module.exports={fromIDBRequest,fromIDBTransaction,indexedDbStorage});
1
+ "use strict";var K=Object.defineProperty;var Me=Object.getOwnPropertyDescriptor;var Re=Object.getOwnPropertyNames;var Se=Object.prototype.hasOwnProperty;var Oe=(n,e)=>{for(var t in e)K(n,t,{get:e[t],enumerable:!0})},De=(n,e,t,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of Re(e))!Se.call(n,r)&&r!==t&&K(n,r,{get:()=>e[r],enumerable:!(s=Me(e,r))||s.enumerable});return n};var Ce=n=>De(K({},"__esModule",{value:!0}),n);var Ke={};Oe(Ke,{fromIDBRequest:()=>qe,fromIDBTransaction:()=>Ye});module.exports=Ce(Ke);var G=Symbol.for("graphrefly/START"),g=Symbol.for("graphrefly/DATA"),k=Symbol.for("graphrefly/DIRTY"),E=Symbol.for("graphrefly/RESOLVED"),M=Symbol.for("graphrefly/INVALIDATE"),R=Symbol.for("graphrefly/PAUSE"),H=Symbol.for("graphrefly/RESUME"),N=Symbol.for("graphrefly/TEARDOWN"),v=Symbol.for("graphrefly/COMPLETE"),h=Symbol.for("graphrefly/ERROR"),S=Object.freeze([k]),J=Object.freeze([E]),Fe=Object.freeze([M]),X=Object.freeze([G]),Ie=Object.freeze([v]),Ge=Object.freeze([N]),Z=Object.freeze([S]),de=Object.freeze([J]),le=Object.freeze([Fe]),ce=Object.freeze([Ie]),Q=Object.freeze([Ge]);var He={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)}};function ue(n){n.registerCodec(He)}var Le={type:"system",id:""};function U(n){if(n==null)return Le;let{type:e,id:t,...s}=n;return{type:e??"system",id:t??"",...s}}var ee=0,Ve=!1,he=[],fe=[],pe=[],Pe=[];function _e(){return ee>0||Ve}function ge(){return ee>0}function ye(n){ee>0?Pe.push(n):n()}function B(n,e,t){if(e.length===0)return;if(e.length===1){let l=t(e[0][0]);if(l<3||!_e()){n(e);return}(l>=5?pe:l===4?fe:he).push(()=>n(e));return}let s=e.length,r=s,a=s,i=s,o=0;for(;o<s&&t(e[o][0])<3;)o++;for(r=o;o<s&&t(e[o][0])===3;)o++;for(a=o;o<s&&t(e[o][0])===4;)o++;i=o;let d=_e();if(r>0){let l=e.slice(0,r);n(l)}if(a>r){let l=e.slice(r,a);d?he.push(()=>n(l)):n(l)}if(i>a){let l=e.slice(a,i);d?fe.push(()=>n(l)):n(l)}if(s>i){let l=e.slice(i,s);d?pe.push(()=>n(l)):n(l)}}function me(){return Date.now()*1e6}var W=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 s=this._messageTypes.get(t);return s!=null?s.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 be(n){n.registerMessageType(G,{tier:0,wireCrossing:!1}),n.registerMessageType(k,{tier:1,wireCrossing:!1}),n.registerMessageType(M,{tier:1,wireCrossing:!1,metaPassthrough:!1}),n.registerMessageType(R,{tier:2,wireCrossing:!1}),n.registerMessageType(H,{tier:2,wireCrossing:!1}),n.registerMessageType(g,{tier:3,wireCrossing:!0}),n.registerMessageType(E,{tier:3,wireCrossing:!0}),n.registerMessageType(v,{tier:4,wireCrossing:!0,metaPassthrough:!1}),n.registerMessageType(h,{tier:4,wireCrossing:!0,metaPassthrough:!1}),n.registerMessageType(N,{tier:5,wireCrossing:!0,metaPassthrough:!1})}var O=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}};function te(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(te);if(typeof n=="object"&&n!==null){let e={};for(let t of Object.keys(n).sort())e[t]=te(n[t]);return e}return null}var Ue=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]),Be=new TextEncoder;function We(n){let e=Be.encode(n),t=e.length,s=t*8,r=t+9+63&-64,a=new Uint8Array(r);a.set(e),a[t]=128;let i=new DataView(a.buffer);i.setUint32(r-4,s>>>0,!1),i.setUint32(r-8,Math.floor(s/4294967296)>>>0,!1);let o=1779033703,d=3144134277,l=1013904242,c=2773480762,p=1359893119,_=2600822924,u=528734635,y=1541459225,A=new Uint32Array(64),b=(x,m)=>x>>>m|x<<32-m;for(let x=0;x<r;x+=64){for(let f=0;f<16;f++)A[f]=i.getUint32(x+f*4,!1);for(let f=16;f<64;f++){let F=A[f-15],I=A[f-2],P=b(F,7)^b(F,18)^F>>>3,Y=b(I,17)^b(I,19)^I>>>10;A[f]=A[f-16]+P+A[f-7]+Y>>>0}let m=o,D=d,C=l,$=c,T=p,L=_,V=u,q=y;for(let f=0;f<64;f++){let F=b(T,6)^b(T,11)^b(T,25),I=T&L^~T&V,P=q+F+I+Ue[f]+A[f]>>>0,Y=b(m,2)^b(m,13)^b(m,22),ke=m&D^m&C^D&C,Ee=Y+ke>>>0;q=V,V=L,L=T,T=$+P>>>0,$=C,C=D,D=m,m=P+Ee>>>0}o=o+m>>>0,d=d+D>>>0,l=l+C>>>0,c=c+$>>>0,p=p+T>>>0,_=_+L>>>0,u=u+V>>>0,y=y+q>>>0}let w=x=>x.toString(16).padStart(8,"0");return w(o)+w(d)+w(l)+w(c)+w(p)+w(_)+w(u)+w(y)}function ne(n){let e=te(n??null),t=JSON.stringify(e);return We(t).slice(0,16)}function je(){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 se(n,e,t){let s=t?.id??je();if(n===0)return{id:s,version:0};let a=(t?.hash??ne)(e);return{id:s,version:0,cid:a,prev:null}}function ve(n,e,t){n.version+=1,"cid"in n&&(n.prev=n.cid,n.cid=t(e))}var we=()=>{},xe=100;function Te(n){return{node:n,unsub:null,prevData:void 0,dirty:!1,involvedThisWave:!1,dataBatch:[],terminal:void 0}}function re(n){n.prevData=void 0,n.dirty=!1,n.involvedThisWave=!1,n.dataBatch.length=0,n.terminal=void 0}function j(n){return n.length===0?n:typeof n[0]=="symbol"?[n]:n}var ze=(n,e,t,s)=>{t.direction==="down-in"&&n._onDepMessage(t.depIndex,e)},$e=(n,e,t,s)=>{let r=n;if(r._status==="completed"||r._status==="errored")return;let a=r._cached,i=a===void 0?[X]:[X,[g,a]];r._status==="dirty"&&i.push(S),B(e,i,r._config.tierOf)},ie=new W({onMessage:ze,onSubscribe:$e});be(ie);ue(ie);var z=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,s){this._config=s.config??ie,this._config.onMessage,this._optsName=s.name,this._describeKind=s.describeKind,this._equals=s.equals??Object.is,this._resubscribable=s.resubscribable??!1,this._resetOnTeardown=s.resetOnTeardown??!1,this._autoComplete=s.completeWhenDepsComplete??!0,this._autoError=s.errorWhenDepsError??!0,this._pausable=s.pausable??!0,this._guard=s.guard,this._fn=t,this._partial=s.partial??!1,this._cached=s.initial!==void 0?s.initial:void 0,this._status=e.length===0&&t==null&&this._cached!==void 0?"settled":"sentinel",this._hashFn=s.versioningHash??this._config.defaultHashFn??ne;let r=s.versioning??this._config.defaultVersioning;this._versioningLevel=r,this._versioning=r!=null?se(r,this._cached===void 0?void 0:this._cached,{id:s.versioningId,hash:this._hashFn}):void 0,this._deps=e.map(Te);let a={};for(let[o,d]of Object.entries(s.meta??{})){let l={initial:d,name:`${s.name??"node"}:meta:${o}`,describeKind:"state",config:this._config};s.guard!=null&&(l.guard=s.guard),a[o]=new n([],void 0,l)}Object.freeze(a),this.meta=a,this._hasMeta=Object.keys(a).length>0;let i=this;this._actions={emit(o){i._emit([[g,o]])},down(o){i._emit(j(o))},up(o){i._emitUp(j(o))}},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 s=this._versioningLevel;if(s!=null&&e<=s)return;let r=t?.hash??this._hashFn;r!==this._hashFn&&(this._hashFn=r);let a=this._cached===void 0?void 0:this._cached,i=this._versioning,o=i?.id??t?.id,d=i?.version??0,l=se(e,a,{id:o,hash:r});l.version=d,this._versioning=l,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=U(e);if(this._guard!=null&&!this._guard(t,"observe"))return!1;if(this._extraGuards!=null){for(let s of this._extraGuards)if(!s(t,"observe"))return!1}return!0}_checkGuard(e){if(e?.internal)return;let t=this._guard!=null||this._extraGuards!=null,s=e?.actor!=null;if(!t&&!s)return;let r=U(e?.actor),a=e?.delivery==="signal"?"signal":"write";if(this._guard!=null&&!this._guard(r,a))throw new O({actor:r,action:a,nodeName:this.name});if(this._extraGuards!=null){for(let i of this._extraGuards)if(!i(r,a))throw new O({actor:r,action:a,nodeName:this.name})}this._lastMutation={actor:r,timestamp_ns:me()}}down(e,t){let s=j(e);s.length!==0&&(this._checkGuard(t),this._emit(s))}emit(e,t){this._checkGuard(t),this._emit([[g,e]])}up(e,t){if(this._deps.length===0)return;let s=j(e);if(s.length===0)return;this._checkGuard(t);let r=t??{internal:!0};this._validateUpTiers(s);for(let a of this._deps)a.node.up?.(s,r)}_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 s of e){let r=t(s[0]);if(r===3||r===4)throw new Error(`Node "${this.name}": tier-${r} 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=U(t);if(!this._guard(d,"observe"))throw new O({actor:d,action:"observe",nodeName:this.name})}let r=this._isTerminal&&this._resubscribable;if(r){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)re(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 a;try{a=this._config.onSubscribe(this,e,{sinkCount:this._sinkCount,afterTerminalReset:r},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 a=="function")try{a()}catch{}throw d}this._status==="sentinel"&&this._cached===void 0&&(this._status="pending");let o=!1;return()=>{o||(o=!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[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 s=0;s<e;s++){let r=s,a=this._deps[s];a.unsub=we,a.unsub=a.node.subscribe(i=>{if(a.unsub===null)return;let o=this._config.tierOf,d=!1;for(let l of i)o(l[0])>=3&&(d=!0),this._config.onMessage(this,l,{direction:"down-in",depIndex:r},this._actions);d&&this._maybeRunFnOnSettlement()}),t++}}catch(s){this._deps[t].unsub=null;for(let r=0;r<t;r++){let a=this._deps[r];if(a.unsub!=null){let i=a.unsub;a.unsub=null;try{i()}catch{}re(a)}}throw this._dirtyDepCount=0,s}}_addDep(e){for(let r=0;r<this._deps.length;r++)if(this._deps[r].node===e)return r;let t=this._deps.length,s=Te(e);if(this._deps.push(s),this._sinks==null)return t;s.dirty=!0,this._dirtyDepCount++,this._status!=="dirty"&&this._emit(Z),s.unsub=we;try{s.unsub=e.subscribe(r=>{if(s.unsub===null)return;let a=this._config.tierOf,i=!1;for(let o of r)a(o[0])>=3&&(i=!0),this._config.onMessage(this,o,{direction:"down-in",depIndex:t},this._actions);i&&this._maybeRunFnOnSettlement()})}catch(r){throw s.unsub=null,this._deps.pop(),this._dirtyDepCount--,r}return t}_deactivate(e=!1){let t=this._cleanup;if(this._cleanup=void 0,typeof t=="function")try{t()}catch(s){this._emit([[h,this._wrapFnError("cleanup threw",s)]])}else if(t!=null&&typeof t=="object"){let s=t.deactivate;if(typeof s=="function")try{s()}catch(r){this._emit([[h,this._wrapFnError("cleanup.deactivate threw",r)]])}}for(let s of this._deps){if(s.unsub!=null){let r=s.unsub;s.unsub=null;try{r()}catch{}}re(s)}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 s=this._deps[e],r=t[0];if(this._inspectorHooks!=null){let a={kind:"dep_message",depIndex:e,message:t};for(let i of this._inspectorHooks)i(a)}if(r!==G){if(r===k){this._depDirtied(s);return}if(r===M){if(this._depInvalidated(s),this._cached===void 0)return;this._emit(le);return}if(r===R||r===H){this._emit([t]);return}if(r===N){this._emit(Q);return}if(r===g)this._depSettledAsData(s,t[1]);else if(r===E)this._depSettledAsResolved(s);else if(r===v)this._depSettledAsTerminal(s,!0);else if(r===h)this._depSettledAsTerminal(s,t[1]);else{this._emit([t]);return}if(!this._fn){(r===g||r===E)&&this._emit([t]),(r===v||r===h)&&this._maybeAutoTerminalAfterWave();return}}}_depDirtied(e){e.dirty||(e.dirty=!0,e.involvedThisWave=!0,this._dirtyDepCount++,this._status!=="dirty"&&this._emit(Z))}_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(de),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([[h,e.terminal]]);return}this._autoComplete&&this._deps.every(t=>t.terminal!==void 0)&&this._emit(ce)}_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([[h,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(o){this._emit([[h,this._wrapFnError("cleanup.beforeRun threw",o)]]);return}}}let t=this._deps.map(i=>i.involvedThisWave?i.dataBatch.length>0?[...i.dataBatch]:[]:void 0),s=this._deps.map(i=>i.prevData);for(let i=0;i<this._deps.length;i++){let o=t[i];o!=null&&o.length>0&&(this._deps[i].prevData=o[o.length-1])}let r=this._deps.map(i=>i.terminal),a={prevData:s,terminalDeps:r,store:this._store};if(this._hasCalledFnOnce=!0,this._clearWaveFlags(),this._inspectorHooks!=null){let i={kind:"run",batchData:t,prevData:s};for(let o of this._inspectorHooks)o(i)}this._isExecutingFn=!0;try{let i=this._fn(t,this._actions,a);if(typeof i=="function")this._cleanup=i;else if(i!=null&&typeof i=="object"){let o=i;(typeof o.beforeRun=="function"||typeof o.deactivate=="function"||typeof o.invalidate=="function")&&(this._cleanup=i)}}catch(i){this._emit([[h,this._wrapFnError("fn threw",i)]])}finally{this._isExecutingFn=!1,this._pendingRerun?(this._pendingRerun=!1,this._rerunDepth+=1,this._rerunDepth>xe?(this._rerunDepth=0,this._emit([[h,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,t){let s=t instanceof Error?t.message:String(t);return new Error(`Node "${this.name}": ${e}: ${s}`,{cause:t})}_frameBatch(e){let t=this._config.tierOf;if(e.length===1)return t(e[0][0])===3&&this._status!=="dirty"?[S,e[0]]:e;let s=!0,r=!1,a=!1,i=-1;for(let d of e){let l=t(d[0]);l<i&&(s=!1),l===3&&(r=!0),d[0]===k&&(a=!0),i=l}let o=e;if(!s){let d=e.map((l,c)=>({m:l,i:c,tier:t(l[0])}));d.sort((l,c)=>l.tier-c.tier||l.i-c.i),o=d.map(l=>l.m)}if(r&&!a&&this._status!=="dirty"){let d=0;for(;d<o.length&&t(o[d][0])===0;)d++;return d===0?[S,...o]:[...o.slice(0,d),S,...o.slice(d)]}return o}_emit(e){if(e.length===0)return;for(let o=0;o<e.length;o++){let d=e[o];if(d[0]===h&&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 o=e.filter(d=>d[0]===N||d[0]===M);if(o.length===0)return;t=o}t=this._frameBatch(t);let r=null;for(let o=0;o<t.length;o++){let d=t[o],l=d[0];if(l!==R&&l!==H){r?.push(d);continue}if(d.length<2)throw new Error(`Node "${this.name}": [[${l===R?"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 p=d[1];if(l===R)this._pauseLocks==null&&(this._pauseLocks=new Set),this._pauseLocks.add(p),this._paused=!0,this._pausable==="resumeAll"&&this._pauseBuffer==null&&(this._pauseBuffer=[]);else if(this._pauseLocks==null||!this._pauseLocks.has(p))c=!1;else if(this._pauseLocks.delete(p),this._pauseLocks.size===0){if(this._paused=!1,this._pauseBuffer!=null&&this._pauseBuffer.length>0){let _=this._pauseBuffer;this._pauseBuffer=[],this._emit(_)}this._pendingWave&&(this._pendingWave=!1,this._maybeRunFnOnSettlement())}}c?r?.push(d):r==null&&(r=t.slice(0,o))}if(r!=null){if(r.length===0)return;t=r}if(this._hasMeta&&t.some(o=>o[0]===N))for(let o of Object.keys(this.meta))try{this.meta[o]._emit(Q)}catch{}let{finalMessages:a,equalsError:i}=this._updateState(t);if(a.length>0&&this._config.inspectorEnabled){let o=this._config.globalInspector;if(o!=null)try{o({kind:"emit",node:this,messages:a})}catch{}}if(a.length>0)if(this._paused&&this._pausable==="resumeAll"&&this._pauseBuffer!=null){let o=this._config.tierOf,d=[];for(let l of a)o(l[0])===3?this._pauseBuffer.push(l):d.push(l);d.length>0&&this._dispatchOrAccumulate(d)}else this._dispatchOrAccumulate(a);i!=null&&this._emit([[h,i]])}_updateState(e){let t=this._config.tierOf,s,r,a=-1,i=0;for(let c of e)t(c[0])===3&&i++;let o=i<=1,d=-1;if(this._versioning!=null&&i>1){for(let c=e.length-1;c>=0;c--)if(e[c][0]===g){d=c;break}}for(let c=0;c<e.length;c++){let p=e[c],_=p[0];if(_===g){if(p.length>=2){let u=!1;if(o&&this._cached!==void 0)try{u=this._equals(this._cached,p[1])}catch(y){r=this._wrapFnError("equals threw",y),a=c;break}if(u){s==null&&(s=e.slice(0,c)),s.push(J),this._status="resolved";continue}this._cached=p[1],this._versioning!=null&&(d<0||c===d)&&ve(this._versioning,p[1],this._hashFn)}this._status="settled",s?.push(p)}else if(s?.push(p),_===k)this._status="dirty";else if(_===E)this._status="resolved";else if(_===v){this._status="completed";{let u=this._config.rigorRecorder;if(u!=null)try{u.onTerminalTransition(this,"completed",this._autoComplete,this._autoError,this._deps.length>0)}catch{}}}else if(_===h){this._status="errored";{let u=this._config.rigorRecorder;if(u!=null)try{u.onTerminalTransition(this,"errored",this._autoComplete,this._autoError,this._deps.length>0)}catch{}}}else if(_===M){if(this._cached!==void 0){let y=this._config.rigorRecorder;if(y!=null)try{y.onNonVacuousInvalidate(this,this._cached)}catch{}}this._cached=void 0,this._status="dirty";let u=this._cleanup;if(typeof u=="function"){this._cleanup=void 0;try{u()}catch{}}else if(u!=null&&typeof u=="object"){let y=u.invalidate;if(typeof y=="function")try{y()}catch{}}}else _===N&&(this._resetOnTeardown&&(this._cached=void 0),this._deactivate(!0),this._status="sentinel")}let l=a>=0?s??e.slice(0,a):s??e;return r!=null?{finalMessages:l,equalsError:r}:{finalMessages:l}}_deliverToSinks=e=>{if(this._sinks==null)return;if(typeof this._sinks=="function"){this._sinks(e);return}let t=[...this._sinks];for(let s of t)s(e)};_dispatchOrAccumulate(e){if(ge()){this._batchPendingMessages===null&&(this._batchPendingMessages=[],ye(()=>this._flushBatchPending()));for(let t of e)this._batchPendingMessages.push(t);return}B(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);B(this._deliverToSinks,t,this._config.tierOf)}},Ne=n=>Array.isArray(n),oe=n=>typeof n=="object"&&n!=null&&!Array.isArray(n);function Ae(n,e,t){let s=Ne(n)?n:[],r=typeof n=="function"?n:typeof e=="function"?e:void 0,a={};return Ne(n)?a=(oe(e)?e:t)??{}:oe(n)?a=n:a=(oe(e)?e:t)??{},new z(s,r,a)}function ae(n,e){return Ae((s,r,a)=>n(r,a)??void 0,{describeKind:"producer",...e})}function qe(n){return ae(e=>{let t=!1,s=()=>{n.onsuccess=null,n.onerror=null};return n.onsuccess=()=>{t||(t=!0,s(),e.down([[g,n.result],[v]]))},n.onerror=()=>{t||(t=!0,s(),e.down([[h,n.error??new Error("IndexedDB request failed")]]))},()=>{t=!0,s()}})}function Ye(n){return ae(e=>{let t=!1,s=()=>{n.oncomplete=null,n.onerror=null,n.onabort=null};return n.oncomplete=()=>{t||(t=!0,s(),e.down([[g,void 0],[v]]))},n.onerror=()=>{t||(t=!0,s(),e.down([[h,n.error??new Error("IndexedDB transaction failed")]]))},n.onabort=()=>{t||(t=!0,s(),e.down([[h,n.error??new Error("IndexedDB transaction aborted")]]))},()=>{t=!0,s()}})}0&&(module.exports={fromIDBRequest,fromIDBTransaction});
@@ -1,27 +1,18 @@
1
- import { a as Node } from '../node-8qx0kgYt.cjs';
2
- import { StorageTier } from './storage-core.cjs';
1
+ import { a as Node } from '../node-fSc-hCv8.cjs';
3
2
 
4
3
  /**
5
- * Browser-only storage backend + IndexedDB reactive sources.
4
+ * Browser-only IndexedDB reactive sources.
6
5
  *
7
- * `indexedDbStorage` provides async {@link StorageTier} semantics backed by
8
- * IndexedDB; `fromIDBRequest` / `fromIDBTransaction` wrap raw IDB primitives
9
- * as reactive sources. Imports require the DOM lib — not safe to pull into
10
- * Node-only bundles without `lib: ["dom"]` in the consumer's tsconfig.
6
+ * `fromIDBRequest` / `fromIDBTransaction` wrap raw IDB primitives as reactive
7
+ * sources. The old `indexedDbStorage` kv adapter has been replaced by
8
+ * `indexedDbKv` in `./storage-tiers-browser.js` (Audit 4, 2026-04-24).
11
9
  *
12
- * The legacy `extra/storage.ts` barrel re-exports this module for back-compat;
13
- * browser-first consumers should import from here directly.
10
+ * Imports require the DOM lib not safe to pull into Node-only bundles
11
+ * without `lib: ["dom"]` in the consumer's tsconfig.
14
12
  *
15
13
  * @module
16
14
  */
17
15
 
18
- type IndexedDbStorageSpec = {
19
- dbName: string;
20
- storeName: string;
21
- /** Object-store key under which snapshots are written. @default `"graphrefly_checkpoint"`. */
22
- key?: string;
23
- version?: number;
24
- };
25
16
  /**
26
17
  * Wraps an `IDBRequest` as a one-shot reactive source.
27
18
  *
@@ -42,30 +33,5 @@ declare function fromIDBRequest<T>(req: IDBRequest<T>): Node<T>;
42
33
  * @category extra
43
34
  */
44
35
  declare function fromIDBTransaction(tx: IDBTransaction): Node<void>;
45
- /**
46
- * IndexedDB-backed async storage tier (browser runtime).
47
- *
48
- * All three methods return `Promise`s — pairs naturally with a warm/cold
49
- * cadence where async writes are debounced per tier via
50
- * `Graph.attachStorage`. Writes use `readwrite` transactions; reads use
51
- * `readonly`. Missing records resolve to `null`.
52
- *
53
- * @param spec - Database name, store name, optional `key` (default
54
- * `"graphrefly_checkpoint"`) and schema `version` (default `1`).
55
- * @returns Async {@link StorageTier}.
56
- *
57
- * @example
58
- * ```ts
59
- * import { indexedDbStorage, memoryStorage } from "@graphrefly/graphrefly-ts";
60
- *
61
- * graph.attachStorage([
62
- * memoryStorage(),
63
- * indexedDbStorage({ dbName: "myApp", storeName: "checkpoints" }),
64
- * ]);
65
- * ```
66
- *
67
- * @category extra
68
- */
69
- declare function indexedDbStorage(spec: IndexedDbStorageSpec): StorageTier;
70
36
 
71
- export { type IndexedDbStorageSpec, fromIDBRequest, fromIDBTransaction, indexedDbStorage };
37
+ export { fromIDBRequest, fromIDBTransaction };