@graphrefly/graphrefly 0.44.0 → 0.45.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 (420) hide show
  1. package/README.md +21 -17
  2. package/dist/compat/index.cjs +20 -10
  3. package/dist/compat/index.cjs.map +1 -0
  4. package/dist/compat/index.d.cts +1 -22
  5. package/dist/compat/index.d.ts +1 -22
  6. package/dist/compat/index.js +3 -1
  7. package/dist/compat/index.js.map +1 -0
  8. package/dist/compat/jotai/index.cjs +21 -1
  9. package/dist/compat/jotai/index.cjs.map +1 -0
  10. package/dist/compat/jotai/index.d.cts +1 -2
  11. package/dist/compat/jotai/index.d.ts +1 -2
  12. package/dist/compat/jotai/index.js +3 -1
  13. package/dist/compat/jotai/index.js.map +1 -0
  14. package/dist/compat/nanostores/index.cjs +21 -1
  15. package/dist/compat/nanostores/index.cjs.map +1 -0
  16. package/dist/compat/nanostores/index.d.cts +1 -2
  17. package/dist/compat/nanostores/index.d.ts +1 -2
  18. package/dist/compat/nanostores/index.js +3 -1
  19. package/dist/compat/nanostores/index.js.map +1 -0
  20. package/dist/compat/nestjs/index.cjs +20 -10
  21. package/dist/compat/nestjs/index.cjs.map +1 -0
  22. package/dist/compat/nestjs/index.d.cts +1 -13
  23. package/dist/compat/nestjs/index.d.ts +1 -13
  24. package/dist/compat/nestjs/index.js +3 -1
  25. package/dist/compat/nestjs/index.js.map +1 -0
  26. package/dist/compat/react/index.cjs +21 -1
  27. package/dist/compat/react/index.cjs.map +1 -0
  28. package/dist/compat/react/index.d.cts +1 -2
  29. package/dist/compat/react/index.d.ts +1 -2
  30. package/dist/compat/react/index.js +3 -1
  31. package/dist/compat/react/index.js.map +1 -0
  32. package/dist/compat/solid/index.cjs +21 -1
  33. package/dist/compat/solid/index.cjs.map +1 -0
  34. package/dist/compat/solid/index.d.cts +1 -2
  35. package/dist/compat/solid/index.d.ts +1 -2
  36. package/dist/compat/solid/index.js +3 -1
  37. package/dist/compat/solid/index.js.map +1 -0
  38. package/dist/compat/svelte/index.cjs +21 -1
  39. package/dist/compat/svelte/index.cjs.map +1 -0
  40. package/dist/compat/svelte/index.d.cts +1 -2
  41. package/dist/compat/svelte/index.d.ts +1 -2
  42. package/dist/compat/svelte/index.js +3 -1
  43. package/dist/compat/svelte/index.js.map +1 -0
  44. package/dist/compat/vue/index.cjs +21 -1
  45. package/dist/compat/vue/index.cjs.map +1 -0
  46. package/dist/compat/vue/index.d.cts +1 -3
  47. package/dist/compat/vue/index.d.ts +1 -3
  48. package/dist/compat/vue/index.js +3 -1
  49. package/dist/compat/vue/index.js.map +1 -0
  50. package/dist/compat/zustand/index.cjs +21 -3
  51. package/dist/compat/zustand/index.cjs.map +1 -0
  52. package/dist/compat/zustand/index.d.cts +1 -6
  53. package/dist/compat/zustand/index.d.ts +1 -6
  54. package/dist/compat/zustand/index.js +3 -1
  55. package/dist/compat/zustand/index.js.map +1 -0
  56. package/dist/core/index.cjs +21 -1
  57. package/dist/core/index.cjs.map +1 -0
  58. package/dist/core/index.d.cts +1 -3
  59. package/dist/core/index.d.ts +1 -3
  60. package/dist/core/index.js +3 -1
  61. package/dist/core/index.js.map +1 -0
  62. package/dist/extra/browser.cjs +21 -1
  63. package/dist/extra/browser.cjs.map +1 -0
  64. package/dist/extra/browser.d.cts +1 -4
  65. package/dist/extra/browser.d.ts +1 -4
  66. package/dist/extra/browser.js +3 -1
  67. package/dist/extra/browser.js.map +1 -0
  68. package/dist/extra/index.cjs +20 -19
  69. package/dist/extra/index.cjs.map +1 -0
  70. package/dist/extra/index.d.cts +1 -17
  71. package/dist/extra/index.d.ts +1 -17
  72. package/dist/extra/index.js +3 -1
  73. package/dist/extra/index.js.map +1 -0
  74. package/dist/extra/node.cjs +21 -2
  75. package/dist/extra/node.cjs.map +1 -0
  76. package/dist/extra/node.d.cts +1 -187
  77. package/dist/extra/node.d.ts +1 -187
  78. package/dist/extra/node.js +3 -2
  79. package/dist/extra/node.js.map +1 -0
  80. package/dist/extra/operators.cjs +21 -1
  81. package/dist/extra/operators.cjs.map +1 -0
  82. package/dist/extra/operators.d.cts +1 -958
  83. package/dist/extra/operators.d.ts +1 -958
  84. package/dist/extra/operators.js +3 -1
  85. package/dist/extra/operators.js.map +1 -0
  86. package/dist/extra/reactive.cjs +21 -1
  87. package/dist/extra/reactive.cjs.map +1 -0
  88. package/dist/extra/reactive.d.cts +1 -353
  89. package/dist/extra/reactive.d.ts +1 -353
  90. package/dist/extra/reactive.js +3 -1
  91. package/dist/extra/reactive.js.map +1 -0
  92. package/dist/extra/render/index.cjs +21 -5
  93. package/dist/extra/render/index.cjs.map +1 -0
  94. package/dist/extra/render/index.d.cts +1 -183
  95. package/dist/extra/render/index.d.ts +1 -183
  96. package/dist/extra/render/index.js +3 -1
  97. package/dist/extra/render/index.js.map +1 -0
  98. package/dist/extra/sources.cjs +21 -3
  99. package/dist/extra/sources.cjs.map +1 -0
  100. package/dist/extra/sources.d.cts +1 -584
  101. package/dist/extra/sources.d.ts +1 -584
  102. package/dist/extra/sources.js +3 -1
  103. package/dist/extra/sources.js.map +1 -0
  104. package/dist/extra/storage-browser.cjs +21 -1
  105. package/dist/extra/storage-browser.cjs.map +1 -0
  106. package/dist/extra/storage-browser.d.cts +1 -37
  107. package/dist/extra/storage-browser.d.ts +1 -37
  108. package/dist/extra/storage-browser.js +3 -1
  109. package/dist/extra/storage-browser.js.map +1 -0
  110. package/dist/extra/storage-core.cjs +21 -1
  111. package/dist/extra/storage-core.cjs.map +1 -0
  112. package/dist/extra/storage-core.d.cts +1 -28
  113. package/dist/extra/storage-core.d.ts +1 -28
  114. package/dist/extra/storage-core.js +3 -1
  115. package/dist/extra/storage-core.js.map +1 -0
  116. package/dist/extra/storage-node.cjs +20 -0
  117. package/dist/extra/storage-node.cjs.map +1 -0
  118. package/dist/extra/storage-node.d.cts +1 -2
  119. package/dist/extra/storage-node.d.ts +1 -2
  120. package/dist/extra/storage-node.js +3 -0
  121. package/dist/extra/storage-node.js.map +1 -0
  122. package/dist/extra/storage-tiers-browser.cjs +21 -1
  123. package/dist/extra/storage-tiers-browser.cjs.map +1 -0
  124. package/dist/extra/storage-tiers-browser.d.cts +1 -120
  125. package/dist/extra/storage-tiers-browser.d.ts +1 -120
  126. package/dist/extra/storage-tiers-browser.js +3 -1
  127. package/dist/extra/storage-tiers-browser.js.map +1 -0
  128. package/dist/extra/storage-tiers-node.cjs +21 -1
  129. package/dist/extra/storage-tiers-node.cjs.map +1 -0
  130. package/dist/extra/storage-tiers-node.d.cts +1 -210
  131. package/dist/extra/storage-tiers-node.d.ts +1 -210
  132. package/dist/extra/storage-tiers-node.js +3 -1
  133. package/dist/extra/storage-tiers-node.js.map +1 -0
  134. package/dist/extra/storage-tiers.cjs +21 -1
  135. package/dist/extra/storage-tiers.cjs.map +1 -0
  136. package/dist/extra/storage-tiers.d.cts +1 -412
  137. package/dist/extra/storage-tiers.d.ts +1 -412
  138. package/dist/extra/storage-tiers.js +3 -1
  139. package/dist/extra/storage-tiers.js.map +1 -0
  140. package/dist/extra/storage-wal.cjs +21 -0
  141. package/dist/extra/storage-wal.cjs.map +1 -0
  142. package/dist/extra/storage-wal.d.cts +1 -0
  143. package/dist/extra/storage-wal.d.ts +1 -0
  144. package/dist/extra/storage-wal.js +3 -0
  145. package/dist/extra/storage-wal.js.map +1 -0
  146. package/dist/graph/index.cjs +21 -7
  147. package/dist/graph/index.cjs.map +1 -0
  148. package/dist/graph/index.d.cts +1 -7
  149. package/dist/graph/index.d.ts +1 -7
  150. package/dist/graph/index.js +3 -1
  151. package/dist/graph/index.js.map +1 -0
  152. package/dist/index.cjs +20 -227
  153. package/dist/index.cjs.map +1 -0
  154. package/dist/index.d.cts +45 -95
  155. package/dist/index.d.ts +45 -95
  156. package/dist/index.js +3 -1
  157. package/dist/index.js.map +1 -0
  158. package/dist/patterns/ai/browser.cjs +20 -7
  159. package/dist/patterns/ai/browser.cjs.map +1 -0
  160. package/dist/patterns/ai/browser.d.cts +1 -127
  161. package/dist/patterns/ai/browser.d.ts +1 -127
  162. package/dist/patterns/ai/browser.js +3 -3
  163. package/dist/patterns/ai/browser.js.map +1 -0
  164. package/dist/patterns/ai/index.cjs +20 -73
  165. package/dist/patterns/ai/index.cjs.map +1 -0
  166. package/dist/patterns/ai/index.d.cts +1 -20
  167. package/dist/patterns/ai/index.d.ts +1 -20
  168. package/dist/patterns/ai/index.js +3 -1
  169. package/dist/patterns/ai/index.js.map +1 -0
  170. package/dist/patterns/ai/node.cjs +21 -1
  171. package/dist/patterns/ai/node.cjs.map +1 -0
  172. package/dist/patterns/ai/node.d.cts +1 -59
  173. package/dist/patterns/ai/node.d.ts +1 -59
  174. package/dist/patterns/ai/node.js +3 -1
  175. package/dist/patterns/ai/node.js.map +1 -0
  176. package/dist/patterns/cqrs/index.cjs +21 -3
  177. package/dist/patterns/cqrs/index.cjs.map +1 -0
  178. package/dist/patterns/cqrs/index.d.cts +1 -8
  179. package/dist/patterns/cqrs/index.d.ts +1 -8
  180. package/dist/patterns/cqrs/index.js +3 -1
  181. package/dist/patterns/cqrs/index.js.map +1 -0
  182. package/dist/patterns/demo-shell/index.cjs +21 -5
  183. package/dist/patterns/demo-shell/index.cjs.map +1 -0
  184. package/dist/patterns/demo-shell/index.d.cts +1 -7
  185. package/dist/patterns/demo-shell/index.d.ts +1 -7
  186. package/dist/patterns/demo-shell/index.js +3 -1
  187. package/dist/patterns/demo-shell/index.js.map +1 -0
  188. package/dist/patterns/domain-templates/index.cjs +21 -3
  189. package/dist/patterns/domain-templates/index.cjs.map +1 -0
  190. package/dist/patterns/domain-templates/index.d.cts +1 -6
  191. package/dist/patterns/domain-templates/index.d.ts +1 -6
  192. package/dist/patterns/domain-templates/index.js +3 -1
  193. package/dist/patterns/domain-templates/index.js.map +1 -0
  194. package/dist/patterns/graphspec/index.cjs +21 -86
  195. package/dist/patterns/graphspec/index.cjs.map +1 -0
  196. package/dist/patterns/graphspec/index.d.cts +1 -8
  197. package/dist/patterns/graphspec/index.d.ts +1 -8
  198. package/dist/patterns/graphspec/index.js +3 -1
  199. package/dist/patterns/graphspec/index.js.map +1 -0
  200. package/dist/patterns/harness/index.cjs +21 -48
  201. package/dist/patterns/harness/index.cjs.map +1 -0
  202. package/dist/patterns/harness/index.d.cts +1 -13
  203. package/dist/patterns/harness/index.d.ts +1 -13
  204. package/dist/patterns/harness/index.js +3 -1
  205. package/dist/patterns/harness/index.js.map +1 -0
  206. package/dist/patterns/inspect/index.cjs +21 -3
  207. package/dist/patterns/inspect/index.cjs.map +1 -0
  208. package/dist/patterns/inspect/index.d.cts +1 -9
  209. package/dist/patterns/inspect/index.d.ts +1 -9
  210. package/dist/patterns/inspect/index.js +3 -1
  211. package/dist/patterns/inspect/index.js.map +1 -0
  212. package/dist/patterns/job-queue/index.cjs +21 -3
  213. package/dist/patterns/job-queue/index.cjs.map +1 -0
  214. package/dist/patterns/job-queue/index.d.cts +1 -9
  215. package/dist/patterns/job-queue/index.d.ts +1 -9
  216. package/dist/patterns/job-queue/index.js +3 -1
  217. package/dist/patterns/job-queue/index.js.map +1 -0
  218. package/dist/patterns/memory/index.cjs +21 -3
  219. package/dist/patterns/memory/index.cjs.map +1 -0
  220. package/dist/patterns/memory/index.d.cts +1 -8
  221. package/dist/patterns/memory/index.d.ts +1 -8
  222. package/dist/patterns/memory/index.js +3 -1
  223. package/dist/patterns/memory/index.js.map +1 -0
  224. package/dist/patterns/messaging/index.cjs +21 -3
  225. package/dist/patterns/messaging/index.cjs.map +1 -0
  226. package/dist/patterns/messaging/index.d.cts +1 -7
  227. package/dist/patterns/messaging/index.d.ts +1 -7
  228. package/dist/patterns/messaging/index.js +3 -1
  229. package/dist/patterns/messaging/index.js.map +1 -0
  230. package/dist/patterns/orchestration/index.cjs +21 -3
  231. package/dist/patterns/orchestration/index.cjs.map +1 -0
  232. package/dist/patterns/orchestration/index.d.cts +1 -8
  233. package/dist/patterns/orchestration/index.d.ts +1 -8
  234. package/dist/patterns/orchestration/index.js +3 -1
  235. package/dist/patterns/orchestration/index.js.map +1 -0
  236. package/dist/patterns/process/index.cjs +21 -3
  237. package/dist/patterns/process/index.cjs.map +1 -0
  238. package/dist/patterns/process/index.d.cts +1 -10
  239. package/dist/patterns/process/index.d.ts +1 -10
  240. package/dist/patterns/process/index.js +3 -1
  241. package/dist/patterns/process/index.js.map +1 -0
  242. package/dist/patterns/reactive-layout/index.cjs +21 -4
  243. package/dist/patterns/reactive-layout/index.cjs.map +1 -0
  244. package/dist/patterns/reactive-layout/index.d.cts +1 -7
  245. package/dist/patterns/reactive-layout/index.d.ts +1 -7
  246. package/dist/patterns/reactive-layout/index.js +3 -1
  247. package/dist/patterns/reactive-layout/index.js.map +1 -0
  248. package/dist/patterns/reduction/index.cjs +21 -3
  249. package/dist/patterns/reduction/index.cjs.map +1 -0
  250. package/dist/patterns/reduction/index.d.cts +1 -6
  251. package/dist/patterns/reduction/index.d.ts +1 -6
  252. package/dist/patterns/reduction/index.js +3 -1
  253. package/dist/patterns/reduction/index.js.map +1 -0
  254. package/dist/patterns/surface/index.cjs +21 -13
  255. package/dist/patterns/surface/index.cjs.map +1 -0
  256. package/dist/patterns/surface/index.d.cts +1 -9
  257. package/dist/patterns/surface/index.d.ts +1 -9
  258. package/dist/patterns/surface/index.js +3 -1
  259. package/dist/patterns/surface/index.js.map +1 -0
  260. package/dist/patterns/topology-view/index.cjs +21 -0
  261. package/dist/patterns/topology-view/index.cjs.map +1 -0
  262. package/dist/patterns/topology-view/index.d.cts +1 -0
  263. package/dist/patterns/topology-view/index.d.ts +1 -0
  264. package/dist/patterns/topology-view/index.js +3 -0
  265. package/dist/patterns/topology-view/index.js.map +1 -0
  266. package/dist/testing/index.cjs +21 -0
  267. package/dist/testing/index.cjs.map +1 -0
  268. package/dist/testing/index.d.cts +1 -0
  269. package/dist/testing/index.d.ts +1 -0
  270. package/dist/testing/index.js +3 -0
  271. package/dist/testing/index.js.map +1 -0
  272. package/package.json +608 -584
  273. package/dist/backoff-HPZMEZNF.js +0 -1
  274. package/dist/cascading-BglDkMdX.d.cts +0 -199
  275. package/dist/cascading-MFgxu7Yo.d.ts +0 -199
  276. package/dist/chunk-2T7U5EU6.js +0 -1
  277. package/dist/chunk-3G5U5QNE.js +0 -5
  278. package/dist/chunk-4VVTGLXJ.js +0 -1
  279. package/dist/chunk-5M4CCMMD.js +0 -45
  280. package/dist/chunk-5QDBSZBV.js +0 -1
  281. package/dist/chunk-5XJ6B66J.js +0 -1
  282. package/dist/chunk-6QZNQS5B.js +0 -1
  283. package/dist/chunk-6X7AFUJV.js +0 -9
  284. package/dist/chunk-7K6PWTDQ.js +0 -1
  285. package/dist/chunk-7LIAPXJB.js +0 -1
  286. package/dist/chunk-7WPU3UHQ.js +0 -1
  287. package/dist/chunk-A5WCQ5NO.js +0 -1
  288. package/dist/chunk-APPIWSGD.js +0 -84
  289. package/dist/chunk-BEZWM2SY.js +0 -1
  290. package/dist/chunk-C72GO4IZ.js +0 -1
  291. package/dist/chunk-CB676TKJ.js +0 -1
  292. package/dist/chunk-CE6TI2TL.js +0 -1
  293. package/dist/chunk-CE72X3WO.js +0 -1
  294. package/dist/chunk-CK2E7BTU.js +0 -1
  295. package/dist/chunk-CLVB32RD.js +0 -1
  296. package/dist/chunk-CRVT7D2P.js +0 -1
  297. package/dist/chunk-D5RFJOZ2.js +0 -1
  298. package/dist/chunk-D7GPHKFH.js +0 -1
  299. package/dist/chunk-DHRX7JX4.js +0 -2
  300. package/dist/chunk-ESMPEKEV.js +0 -1
  301. package/dist/chunk-F672GV32.js +0 -1
  302. package/dist/chunk-FZMYDOWV.js +0 -1
  303. package/dist/chunk-GHBWHMRZ.js +0 -1
  304. package/dist/chunk-GLERH466.js +0 -1
  305. package/dist/chunk-GPW2V3RE.js +0 -1
  306. package/dist/chunk-HIDYF36O.js +0 -1
  307. package/dist/chunk-HITNVN6B.js +0 -3
  308. package/dist/chunk-HY4DJBA7.js +0 -5
  309. package/dist/chunk-KZIEYVXN.js +0 -1
  310. package/dist/chunk-L6NSJVJZ.js +0 -1
  311. package/dist/chunk-N4MQX6JU.js +0 -18
  312. package/dist/chunk-N7FHEL4D.js +0 -1
  313. package/dist/chunk-NTEURFZH.js +0 -1
  314. package/dist/chunk-OIVP6KFV.js +0 -1
  315. package/dist/chunk-OPHBU3LG.js +0 -1
  316. package/dist/chunk-OYQOZP2F.js +0 -5
  317. package/dist/chunk-PTZK576G.js +0 -1
  318. package/dist/chunk-QYADASLV.js +0 -1
  319. package/dist/chunk-ST7UXLWR.js +0 -1
  320. package/dist/chunk-SVY7VUYU.js +0 -1
  321. package/dist/chunk-TK3NWWD4.js +0 -1
  322. package/dist/chunk-TSOYJ743.js +0 -1
  323. package/dist/chunk-UNGSTR4X.js +0 -61
  324. package/dist/chunk-VIMF6LGM.js +0 -1
  325. package/dist/chunk-VJLMUKOI.js +0 -1
  326. package/dist/chunk-VN6RDSK2.js +0 -1
  327. package/dist/chunk-VV4N5P64.js +0 -1
  328. package/dist/chunk-W3I423PS.js +0 -1
  329. package/dist/chunk-WJR24TAG.js +0 -1
  330. package/dist/chunk-XTGKMHSW.js +0 -1
  331. package/dist/chunk-YBB7ZGTY.js +0 -1
  332. package/dist/chunk-Z4NPUARF.js +0 -1
  333. package/dist/chunk-ZGNQRPDT.js +0 -1
  334. package/dist/chunk-ZKPSFFKU.js +0 -1
  335. package/dist/chunk-ZLV5SQSX.js +0 -1
  336. package/dist/content-addressed-storage-4-ST1tYk.d.cts +0 -124
  337. package/dist/content-addressed-storage-DuYMjV7o.d.ts +0 -124
  338. package/dist/decay-BvOWTZ00.d.ts +0 -112
  339. package/dist/decay-CFlLvXUT.d.cts +0 -112
  340. package/dist/fallback-74oxi34l.d.cts +0 -250
  341. package/dist/fallback-DUyyBTBK.d.ts +0 -250
  342. package/dist/graph-CWvEUQAq.d.cts +0 -1861
  343. package/dist/graph-D9LFnda9.d.ts +0 -1861
  344. package/dist/index-5k1T6jl0.d.cts +0 -121
  345. package/dist/index-9770hRuQ.d.cts +0 -779
  346. package/dist/index-B-_tFaqV.d.cts +0 -468
  347. package/dist/index-B17QddL1.d.cts +0 -374
  348. package/dist/index-B1F8Enjf.d.ts +0 -704
  349. package/dist/index-B5S8ULbU.d.ts +0 -515
  350. package/dist/index-B8YnZpIR.d.ts +0 -102
  351. package/dist/index-BHskSB8v.d.ts +0 -3413
  352. package/dist/index-BIYAkbAi.d.cts +0 -26
  353. package/dist/index-BQSKmbuG.d.cts +0 -127
  354. package/dist/index-BaQaY_IQ.d.cts +0 -231
  355. package/dist/index-BmZXHqkE.d.ts +0 -36
  356. package/dist/index-BoJ5JHxI.d.ts +0 -557
  357. package/dist/index-BocU7pqs.d.ts +0 -779
  358. package/dist/index-BrPrLl4e.d.cts +0 -86
  359. package/dist/index-BxNs2HB9.d.cts +0 -1858
  360. package/dist/index-Byu-OpX_.d.ts +0 -113
  361. package/dist/index-C1T3d7V-.d.cts +0 -704
  362. package/dist/index-C5ri2Axc.d.cts +0 -301
  363. package/dist/index-C5stwKcw.d.cts +0 -44
  364. package/dist/index-C9l6OEBL.d.ts +0 -26
  365. package/dist/index-CBBLl_rc.d.ts +0 -127
  366. package/dist/index-CBGUK09R.d.ts +0 -754
  367. package/dist/index-CC-AvFTy.d.cts +0 -557
  368. package/dist/index-CJF1URuX.d.ts +0 -121
  369. package/dist/index-CK29LV56.d.cts +0 -34
  370. package/dist/index-CMh5Rz1y.d.ts +0 -385
  371. package/dist/index-CPQlGA29.d.ts +0 -34
  372. package/dist/index-CR8QpwX8.d.ts +0 -2680
  373. package/dist/index-CS0LTlB8.d.cts +0 -385
  374. package/dist/index-CSOmP7xT.d.cts +0 -291
  375. package/dist/index-CYq8vAyV.d.ts +0 -291
  376. package/dist/index-CZ3r5Rxp.d.ts +0 -374
  377. package/dist/index-CasX6Pfq.d.cts +0 -358
  378. package/dist/index-CdAlHFEt.d.ts +0 -44
  379. package/dist/index-CdTelp1M.d.ts +0 -202
  380. package/dist/index-CeFiHtAg.d.ts +0 -468
  381. package/dist/index-Cj3WohTd.d.cts +0 -202
  382. package/dist/index-Climxqsu.d.cts +0 -754
  383. package/dist/index-Co7uli2l.d.cts +0 -3413
  384. package/dist/index-CviRnE4K.d.ts +0 -45
  385. package/dist/index-Cwv0KWcU.d.cts +0 -102
  386. package/dist/index-CzLVrjxn.d.ts +0 -231
  387. package/dist/index-D0aciIex.d.cts +0 -209
  388. package/dist/index-DHen9Klo.d.ts +0 -1858
  389. package/dist/index-DV_1YuVk.d.cts +0 -221
  390. package/dist/index-Dc4AYqrJ.d.cts +0 -515
  391. package/dist/index-Dgl1HpPn.d.ts +0 -86
  392. package/dist/index-DisjX8a-.d.ts +0 -221
  393. package/dist/index-UPSiS-X7.d.cts +0 -2680
  394. package/dist/index-Yq60JP3s.d.ts +0 -209
  395. package/dist/index-ZVQhLa2i.d.cts +0 -37
  396. package/dist/index-_6ODbuOu.d.cts +0 -45
  397. package/dist/index-hcDJ8PSI.d.cts +0 -36
  398. package/dist/index-nozs3fFC.d.ts +0 -301
  399. package/dist/index-p09KSrTN.d.ts +0 -358
  400. package/dist/index-sqkqlb1p.d.ts +0 -37
  401. package/dist/index-tRCxuAXF.d.cts +0 -113
  402. package/dist/node-kK3CvTrR.d.cts +0 -1347
  403. package/dist/node-kK3CvTrR.d.ts +0 -1347
  404. package/dist/observable-DWjNfLvC.d.ts +0 -36
  405. package/dist/observable-e3eiPPFy.d.cts +0 -36
  406. package/dist/pipeline-graph-CIKhynsF.d.cts +0 -142
  407. package/dist/pipeline-graph-Sgj0gCwn.d.ts +0 -142
  408. package/dist/reactive-layout-DOTs9P3X.d.ts +0 -183
  409. package/dist/reactive-layout-DgctbqZo.d.cts +0 -183
  410. package/dist/reactive-log-BKALbfal.d.ts +0 -223
  411. package/dist/reactive-log-DIGdYqQ6.d.cts +0 -223
  412. package/dist/reactive-map-CEFGp8TK.d.cts +0 -296
  413. package/dist/reactive-map-DS_SIAxv.d.ts +0 -296
  414. package/dist/resilience-6LYQJAC5.js +0 -1
  415. package/dist/sugar-DQjFmVqb.d.cts +0 -399
  416. package/dist/sugar-fhLIE7TT.d.ts +0 -399
  417. package/dist/topology-tree-Bcz27hpF.d.cts +0 -25
  418. package/dist/topology-tree-xvaD0fOX.d.ts +0 -25
  419. package/dist/types-C0_yquda.d.cts +0 -442
  420. package/dist/types-CWFysE9E.d.ts +0 -442
@@ -1,183 +1 @@
1
- import { b as GraphDescribeOutput } from '../../graph-D9LFnda9.js';
2
- import '../../node-kK3CvTrR.js';
3
- import '../../sugar-fhLIE7TT.js';
4
- import '../storage-core.js';
5
- import '../storage-tiers.js';
6
-
7
- /**
8
- * Internal helpers shared across renderers in `extra/render/`.
9
- *
10
- * These are pure functions over `GraphDescribeOutput` — no Graph instance
11
- * dependency. Extracted from `src/graph/graph.ts` (the consolidated
12
- * ex-dumpGraph / ex-toMermaid / ex-toD2 renderers) per Tier 2.1 A2.
13
- */
14
-
15
- /** Direction options for diagram exports. */
16
- type DiagramDirection = "TD" | "LR" | "BT" | "RL";
17
-
18
- /**
19
- * Sugiyama-style layered DAG layout on an integer grid.
20
- *
21
- * Pipeline:
22
- * 1. Longest-path layer assignment (sources at layer 0).
23
- * 2. Virtual-node splitting — every edge spanning more than one layer
24
- * becomes a chain of synthetic nodes on intermediate layers. Downstream
25
- * passes treat real and virtual nodes identically; crossing
26
- * minimization therefore works on wide + deep DAGs, not only
27
- * adjacent-layer cases.
28
- * 3. Crossing minimization — barycenter heuristic with alternating up /
29
- * down sweeps plus an adjacent-transposition polish pass.
30
- * 4. Coordinate assignment — greedy median-aligned packing with collision
31
- * resolution. Straightens vertical runs of virtual nodes so long edges
32
- * become straight lines where topology allows.
33
- * 5. Orthogonal edge routing — per-gutter x-track assignment; horizontal
34
- * segments sit at endpoint centerlines, vertical segments pack into the
35
- * gutter column range without overlap. Remaining crossings are
36
- * topologically unavoidable and will render as `┼` at draw time.
37
- *
38
- * Output coordinates are cell-grid integers (LR direction). TD rendering
39
- * swaps axes at draw time — the layout is direction-agnostic by
40
- * construction.
41
- *
42
- * Used only by [to-ascii.ts](./to-ascii.ts); not part of the public
43
- * `extra/render/index.ts` surface (underscore-prefixed).
44
- */
45
- type LayoutDirection = "LR" | "TD";
46
-
47
- /**
48
- * `toAscii(g, opts?)` — stdout-native DAG flowchart renderer for a
49
- * {@link GraphDescribeOutput}.
50
- *
51
- * Zero external dependencies, graph-size independent via proper Sugiyama
52
- * (layer assignment → virtual-node splitting → barycenter crossing
53
- * minimization → median-aligned coordinate assignment → per-gutter
54
- * track-assigned orthogonal routing). See
55
- * [_layout-sugiyama.ts](./_layout-sugiyama.ts) for the layout pipeline and
56
- * [_ascii-grid.ts](./_ascii-grid.ts) for the character blitter.
57
- *
58
- * Pure function over the describe snapshot; no Graph instance dependency.
59
- *
60
- * @category extra
61
- */
62
-
63
- type ToAsciiOptions = {
64
- /**
65
- * ASCII layout direction. ASCII grid semantics are meaningful only for
66
- * `"LR"` (default) and `"TD"`.
67
- */
68
- direction?: LayoutDirection;
69
- /** Per-box label cell cap; longer labels are truncated with `…`. Default `24`. */
70
- maxLabelWidth?: number;
71
- /** Glyph set: `"unicode"` (default, box-drawing) or `"ascii"` (`-|+<>v`). */
72
- asciiCharset?: "unicode" | "ascii";
73
- /** Optional logger hook; fires with the rendered text before return. */
74
- logger?: (text: string) => void;
75
- };
76
- declare function toAscii(g: GraphDescribeOutput, opts?: ToAsciiOptions): string;
77
-
78
- /**
79
- * `toD2(g, opts?)` — render a {@link GraphDescribeOutput} as D2 diagram text.
80
- *
81
- * Pure function over the describe snapshot; no Graph instance dependency.
82
- *
83
- * @category extra
84
- */
85
-
86
- type ToD2Options = {
87
- /** Diagram direction; default `"LR"`. */
88
- direction?: DiagramDirection;
89
- };
90
- declare function toD2(g: GraphDescribeOutput, opts?: ToD2Options): string;
91
-
92
- /**
93
- * `toJson(g, opts?)` — render a {@link GraphDescribeOutput} as deterministic
94
- * JSON text with sorted keys.
95
- *
96
- * Pure function over the describe snapshot; no Graph instance dependency.
97
- *
98
- * @category extra
99
- */
100
-
101
- type ToJsonOptions = {
102
- /** Include the Edges section (default `true`). */
103
- includeEdges?: boolean;
104
- /** Include the Subgraphs section (default `true`). */
105
- includeSubgraphs?: boolean;
106
- /** JSON indent (default `2`). */
107
- indent?: number;
108
- /** Optional logger hook; fires with the rendered text before return. */
109
- logger?: (text: string) => void;
110
- };
111
- declare function toJson(g: GraphDescribeOutput, opts?: ToJsonOptions): string;
112
-
113
- /**
114
- * `toMermaid(g, opts?)` — render a {@link GraphDescribeOutput} as Mermaid
115
- * flowchart text.
116
- *
117
- * Pure function over the describe snapshot; no Graph instance dependency.
118
- * Compose with `derived` for live formatted output:
119
- *
120
- * ```ts
121
- * import { toMermaid } from "@graphrefly/graphrefly/extra/render";
122
- * import { derived } from "@graphrefly/graphrefly";
123
- *
124
- * const live = derived([graph.describe({ reactive: true }).node], ([g]) => toMermaid(g));
125
- * ```
126
- *
127
- * @category extra
128
- */
129
-
130
- type ToMermaidOptions = {
131
- /** Diagram direction; default `"LR"`. */
132
- direction?: DiagramDirection;
133
- };
134
- declare function toMermaid(g: GraphDescribeOutput, opts?: ToMermaidOptions): string;
135
-
136
- /**
137
- * `toMermaidUrl(g, opts?)` — encode a {@link GraphDescribeOutput} as a
138
- * `https://mermaid.live/edit#base64:…` deep link.
139
- *
140
- * Round-trip with the mermaid.live editor's `/edit#base64:` share format —
141
- * payload is `base64url(JSON({code, mermaid: {theme}, ...}))`. No network
142
- * calls; the payload is encoded into the URL fragment.
143
- *
144
- * @category extra
145
- */
146
-
147
- type MermaidLiveTheme = "default" | "dark" | "forest" | "neutral" | "base";
148
- type ToMermaidUrlOptions = ToMermaidOptions & {
149
- theme?: MermaidLiveTheme;
150
- autoSync?: boolean;
151
- };
152
- /**
153
- * Encode an arbitrary mermaid source string to a `mermaid.live` deep link.
154
- * Exported separately so callers that already rendered mermaid text can
155
- * upgrade to a live-editor URL without re-rendering.
156
- */
157
- declare function mermaidLiveUrl(mermaidSrc: string, opts?: {
158
- theme?: MermaidLiveTheme;
159
- autoSync?: boolean;
160
- }): string;
161
- declare function toMermaidUrl(g: GraphDescribeOutput, opts?: ToMermaidUrlOptions): string;
162
-
163
- /**
164
- * `toPretty(g, opts?)` — render a {@link GraphDescribeOutput} as
165
- * human-readable plaintext (Node list with values, plus optional Edges and
166
- * Subgraphs sections).
167
- *
168
- * Pure function over the describe snapshot; no Graph instance dependency.
169
- *
170
- * @category extra
171
- */
172
-
173
- type ToPrettyOptions = {
174
- /** Include the Edges section (default `true`). */
175
- includeEdges?: boolean;
176
- /** Include the Subgraphs section (default `true`). */
177
- includeSubgraphs?: boolean;
178
- /** Optional logger hook; fires with the rendered text before return. */
179
- logger?: (text: string) => void;
180
- };
181
- declare function toPretty(g: GraphDescribeOutput, opts?: ToPrettyOptions): string;
182
-
183
- export { type DiagramDirection, type LayoutDirection, type MermaidLiveTheme, type ToAsciiOptions, type ToD2Options, type ToJsonOptions, type ToMermaidOptions, type ToMermaidUrlOptions, type ToPrettyOptions, mermaidLiveUrl, toAscii, toD2, toJson, toMermaid, toMermaidUrl, toPretty };
1
+ export * from '@graphrefly/pure-ts/extra/render';
@@ -1 +1,3 @@
1
- import{a,b,c,d,e,f,g}from"../../chunk-3G5U5QNE.js";import"../../chunk-C72GO4IZ.js";import"../../chunk-QYADASLV.js";export{e as mermaidLiveUrl,a as toAscii,b as toD2,c as toJson,d as toMermaid,f as toMermaidUrl,g as toPretty};
1
+ // src/extra/render/index.ts
2
+ export * from "@graphrefly/pure-ts/extra/render";
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/extra/render/index.ts"],"sourcesContent":["// Phase 13.9.A shim — re-export from pure-TS sibling until\n// @graphrefly/native (napi binding) and per-milestone swap-overs land.\nexport * from \"@graphrefly/pure-ts/extra/render\";\n"],"mappings":";AAEA,cAAc;","names":[]}
@@ -1,3 +1,21 @@
1
- "use strict";var Tt=Object.defineProperty;var wr=Object.getOwnPropertyDescriptor;var Tr=Object.getOwnPropertyNames;var _r=Object.prototype.hasOwnProperty;var L=(n,e)=>()=>(n&&(e=n(n=0)),e);var _t=(n,e)=>{for(var t in e)Tt(n,t,{get:e[t],enumerable:!0})},Nr=(n,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of Tr(e))!_r.call(n,o)&&o!==t&&Tt(n,o,{get:()=>e[o],enumerable:!(r=wr(e,o))||r.enumerable});return n};var Or=n=>Nr(Tt({},"__esModule",{value:!0}),n);function K(){return Math.trunc(performance.now()*1e6)}function _e(){return Date.now()*1e6}var Ne=L(()=>{"use strict"});var ie,x,I,M,te,Y,ne,V,E,_,Oe,Nt,kr,Ot,xr,Er,kt,dn,cn,ln,xt,ue=L(()=>{"use strict";ie=Symbol.for("graphrefly/START"),x=Symbol.for("graphrefly/DATA"),I=Symbol.for("graphrefly/DIRTY"),M=Symbol.for("graphrefly/RESOLVED"),te=Symbol.for("graphrefly/INVALIDATE"),Y=Symbol.for("graphrefly/PAUSE"),ne=Symbol.for("graphrefly/RESUME"),V=Symbol.for("graphrefly/TEARDOWN"),E=Symbol.for("graphrefly/COMPLETE"),_=Symbol.for("graphrefly/ERROR"),Oe=Object.freeze([I]),Nt=Object.freeze([M]),kr=Object.freeze([te]),Ot=Object.freeze([ie]),xr=Object.freeze([E]),Er=Object.freeze([V]),kt=Object.freeze([Oe]),dn=Object.freeze([Nt]),cn=Object.freeze([kr]),ln=Object.freeze([xr]),xt=Object.freeze([Er])});function pn(n,e){let t=new TextEncoder().encode(n.name);if(t.length===0||t.length>255)throw new Error(`encodeEnvelope: codec name "${n.name}" encodes to ${t.length} bytes (must be 1\u2013255)`);let r=n.version;if(!Number.isInteger(r)||r<0||r>65535)throw new Error(`encodeEnvelope: codec.version ${r} out of u16 range (expected integer 0\u201365535)`);let o=2+t.length+2+e.length;if(o>4294967295)throw new Error(`encodeEnvelope: total envelope size ${o} exceeds 2^32-1 bytes (payload ${e.length} bytes)`);let s=new Uint8Array(o),i=0;return s[i++]=Et,s[i++]=t.length,s.set(t,i),i+=t.length,s[i++]=r>>>8&255,s[i++]=r&255,s.set(e,i),s}function hn(n,e){if(n.length<fn)throw new Error(`decodeEnvelope: bytes too short (${n.length} < ${fn})`);let t=0,r=n[t++];if(r!==Et)throw new Error(`decodeEnvelope: unsupported envelope version ${r} (expected ${Et})`);let o=n[t++];if(o===0)throw new Error("decodeEnvelope: name_len must be >= 1");if(t+o+2>n.length)throw new Error(`decodeEnvelope: envelope truncated (need ${t+o+2} bytes, have ${n.length})`);let s=new TextDecoder().decode(n.subarray(t,t+o));t+=o;let i=(n[t]<<8|n[t+1])>>>0;t+=2;let a=n.subarray(t),u=e.lookupCodec(s);if(u==null)throw new Error(`decodeEnvelope: codec "${s}" not registered (envelope codec_v=${i})`);return{codec:u,codecVersion:i,payload:a}}function mn(n){n.registerCodec(Rr)}var Rr,Et,fn,Rt=L(()=>{"use strict";Rr={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)}},Et=1,fn=4});function We(n){if(n==null)return ke;let{type:e,id:t,...r}=n;return{type:e??"system",id:t??"",...r}}var ke,St=L(()=>{"use strict";ke={type:"system",id:""}});function He(){return xe>0||Ge}function gn(){return xe>0}function Re(n){xe>0?Pe.push(n):n()}function Se(n){xe+=1;let e=!1;try{n()}catch(t){throw e=!0,t}finally{if(xe-=1,xe===0)if(e){if(!Ge){let t=Pe.splice(0);for(let r of t)try{r()}catch{}pe.length=0,he.length=0,Ee.length=0}}else Sr()}}function Sr(){let n=!Ge;n&&(Ge=!0);let e=[],t=0;try{for(;pe.length>0||he.length>0||Ee.length>0||n&&Pe.length>0;){if(n&&Pe.length>0){let s=Pe.splice(0);for(let i of s)try{i()}catch(a){e.push(a)}continue}if(t+=1,t>1e3)throw pe.length=0,he.length=0,Ee.length=0,new Error("batch drain exceeded 1000 iterations \u2014 likely a reactive cycle");let o=(pe.length>0?pe:he.length>0?he:Ee).splice(0);for(let s of o)try{s()}catch(i){e.push(i)}}}finally{n&&(Ge=!1)}if(e.length===1)throw e[0];if(e.length>1)throw new AggregateError(e,"batch drain: multiple callbacks threw")}function qe(n,e,t){if(e.length===0)return;if(e.length===1){let d=t(e[0][0]);if(d<3||!He()){n(e);return}(d>=5?Ee:d===4?he:pe).push(()=>n(e));return}let r=e.length,o=r,s=r,i=r,a=0;for(;a<r&&t(e[a][0])<3;)a++;for(o=a;a<r&&t(e[a][0])===3;)a++;for(s=a;a<r&&t(e[a][0])===4;)a++;i=a;let u=He();if(o>0){let d=e.slice(0,o);n(d)}if(s>o){let d=e.slice(o,s);u?pe.push(()=>n(d)):n(d)}if(i>s){let d=e.slice(s,i);u?he.push(()=>n(d)):n(d)}if(r>i){let d=e.slice(i,r);u?Ee.push(()=>n(d)):n(d)}}var xe,Ge,pe,he,Ee,Pe,Ke=L(()=>{"use strict";xe=0,Ge=!1,pe=[],he=[],Ee=[],Pe=[]});function bn(n){n.registerMessageType(ie,{tier:0,wireCrossing:!1}),n.registerMessageType(I,{tier:1,wireCrossing:!1}),n.registerMessageType(te,{tier:1,wireCrossing:!1,metaPassthrough:!1}),n.registerMessageType(Y,{tier:2,wireCrossing:!1}),n.registerMessageType(ne,{tier:2,wireCrossing:!1}),n.registerMessageType(x,{tier:3,wireCrossing:!0}),n.registerMessageType(M,{tier:3,wireCrossing:!0}),n.registerMessageType(E,{tier:4,wireCrossing:!0,metaPassthrough:!1}),n.registerMessageType(_,{tier:4,wireCrossing:!0,metaPassthrough:!1}),n.registerMessageType(V,{tier:5,wireCrossing:!0,metaPassthrough:!1})}var Ye,yn=L(()=>{"use strict";ue();Ye=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 Ct(n){let e=Cr.filter(t=>n({type:t,id:""},"write"));return e.length===0?"restricted":e.includes("human")&&e.includes("llm")&&e.every(t=>t==="human"||t==="llm"||t==="system")?"both":e.length===1?e[0]:e.join("+")}var Q,Cr,Je=L(()=>{"use strict";Q=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}},Cr=["human","llm","wallet","system"]});function At(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(At);if(typeof n=="object"&&n!==null){let e={};for(let t of Object.keys(n).sort())e[t]=At(n[t]);return e}return null}function Mr(n){let e=Dr.encode(n),t=e.length,r=t*8,o=t+9+63&-64,s=new Uint8Array(o);s.set(e),s[t]=128;let i=new DataView(s.buffer);i.setUint32(o-4,r>>>0,!1),i.setUint32(o-8,Math.floor(r/4294967296)>>>0,!1);let a=1779033703,u=3144134277,d=1013904242,c=2773480762,p=1359893119,f=2600822924,h=528734635,l=1541459225,g=new Uint32Array(64),m=(b,y)=>b>>>y|b<<32-y;for(let b=0;b<o;b+=64){for(let O=0;O<16;O++)g[O]=i.getUint32(b+O*4,!1);for(let O=16;O<64;O++){let P=g[O-15],A=g[O-2],C=m(P,7)^m(P,18)^P>>>3,Te=m(A,17)^m(A,19)^A>>>10;g[O]=g[O-16]+C+g[O-7]+Te>>>0}let y=a,w=u,T=d,N=c,R=p,S=f,D=h,G=l;for(let O=0;O<64;O++){let P=m(R,6)^m(R,11)^m(R,25),A=R&S^~R&D,C=G+P+A+Ar[O]+g[O]>>>0,Te=m(y,2)^m(y,13)^m(y,22),gt=y&w^y&T^w&T,ze=Te+gt>>>0;G=D,D=S,S=R,R=N+C>>>0,N=T,T=w,w=y,y=C+ze>>>0}a=a+y>>>0,u=u+w>>>0,d=d+T>>>0,c=c+N>>>0,p=p+R>>>0,f=f+S>>>0,h=h+D>>>0,l=l+G>>>0}let v=b=>b.toString(16).padStart(8,"0");return v(a)+v(u)+v(d)+v(c)+v(p)+v(f)+v(h)+v(l)}function Dt(n){let e=At(n??null),t=JSON.stringify(e);return Mr(t).slice(0,16)}function Gr(){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 Mt(n,e,t){let r=t?.id??Gr();if(n===0)return{id:r,version:0};let s=(t?.hash??Dt)(e);return{id:r,version:0,cid:s,prev:null}}function vn(n,e,t){n.version+=1,"cid"in n&&(n.prev=n.cid,n.cid=t(e))}var Ar,Dr,wn=L(()=>{"use strict";Ar=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]),Dr=new TextEncoder});function Nn(n){return{node:n,unsub:null,prevData:void 0,dirty:!1,involvedThisWave:!1,dataBatch:[],terminal:void 0}}function Gt(n){n.prevData=void 0,n.dirty=!1,n.involvedThisWave=!1,n.dataBatch.length=0,n.terminal=void 0}function Ze(n){return n.length===0?n:typeof n[0]=="symbol"?[n]:n}function W(n,e,t){let r=On(n)?n:[],o=typeof n=="function"?n:typeof e=="function"?e:void 0,s={};return On(n)?s=(Pt(e)?e:t)??{}:Pt(n)?s=n:s=(Pt(e)?e:t)??{},new z(r,o,s)}var Tn,_n,Pr,Ir,Ce,z,On,Pt,ae=L(()=>{"use strict";Rt();St();Ke();Ne();yn();Je();ue();wn();Tn=()=>{},_n=100;Pr=(n,e,t,r)=>{t.direction==="down-in"&&n._onDepMessage(t.depIndex,e)},Ir=(n,e,t,r)=>{let o=n;if(o._status==="completed"||o._status==="errored")return;let s=o._cached,i=s===void 0?[Ot]:[Ot,[x,s]];o._status==="dirty"&&i.push(Oe),qe(e,i,o._config.tierOf)},Ce=new Ye({onMessage:Pr,onSubscribe:Ir});bn(Ce);mn(Ce);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??Ce,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??Dt;let o=r.versioning??this._config.defaultVersioning;this._versioningLevel=o,this._versioning=o!=null?Mt(o,this._cached===void 0?void 0:this._cached,{id:r.versioningId,hash:this._hashFn}):void 0,this._deps=e.map(Nn);let s={};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),r.resubscribable===!0&&(d.resubscribable=!0),s[a]=new n([],void 0,d)}Object.freeze(s),this.meta=s,this._hasMeta=Object.keys(s).length>0;let i=this;this._actions={emit(a){i._emit([[x,a]])},down(a){i._emit(Ze(a))},up(a){i._emitUp(Ze(a))}},this.down=this.down.bind(this),this.up=this.up.bind(this)}get _isTerminal(){return this._status==="completed"||this._status==="errored"}get name(){return this._optsName}get status(){return this._status}get cache(){return this._cached===void 0?void 0:this._cached}get lastMutation(){return this._lastMutation}get v(){return this._versioning}hasGuard(){return this._guard!=null}_applyVersioning(e,t){if(this._isExecutingFn)throw new Error(`Node "${this.name}": _applyVersioning cannot run mid-fn \u2014 call it outside of \`_execFn\` (typically at graph setup time before the first subscribe).`);let r=this._versioningLevel;if(r!=null&&e<=r)return;let o=t?.hash??this._hashFn;o!==this._hashFn&&(this._hashFn=o);let s=this._cached===void 0?void 0:this._cached,i=this._versioning,a=i?.id??t?.id,u=i?.version??0,d=Mt(e,s,{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 t=We(e);if(this._guard!=null&&!this._guard(t,"observe"))return!1;if(this._extraGuards!=null){for(let r of this._extraGuards)if(!r(t,"observe"))return!1}return!0}_checkGuard(e){if(e?.internal)return;let t=this._guard!=null||this._extraGuards!=null,r=e?.actor!=null;if(!t&&!r)return;let o=We(e?.actor),s=e?.delivery==="signal"?"signal":"write";if(this._guard!=null&&!this._guard(o,s))throw new Q({actor:o,action:s,nodeName:this.name});if(this._extraGuards!=null){for(let i of this._extraGuards)if(!i(o,s))throw new Q({actor:o,action:s,nodeName:this.name})}this._lastMutation={actor:o,timestamp_ns:_e()}}down(e,t){let r=Ze(e);r.length!==0&&(this._checkGuard(t),this._emit(r))}emit(e,t){this._checkGuard(t),this._emit([[x,e]])}up(e,t){if(this._deps.length===0)return;let r=Ze(e);if(r.length===0)return;this._checkGuard(t);let o=t??{internal:!0};this._validateUpTiers(r);for(let s of this._deps)s.node.up?.(r,o)}_emitUp(e){if(this._deps.length!==0&&e.length!==0){this._validateUpTiers(e);for(let t of this._deps)t.node.up?.(e,{internal:!0})}}_validateUpTiers(e){let t=this._config.tierOf;for(let r of e){let o=t(r[0]);if(o===3||o===4)throw new Error(`Node "${this.name}": tier-${o} messages cannot flow up \u2014 DATA/RESOLVED/COMPLETE/ERROR are downstream-only. Use \`down(...)\` for value delivery; \`up(...)\` is for control signals (DIRTY, INVALIDATE, PAUSE, RESUME, TEARDOWN).`)}}subscribe(e,t){if(t!=null&&this._guard!=null){let u=We(t);if(!this._guard(u,"observe"))throw new Q({actor:u,action:"observe",nodeName:this.name})}let o=this._isTerminal&&this._resubscribable;if(o){this._cached=void 0,this._status="sentinel",this._store={},this._hasCalledFnOnce=!1,this._waveHasNewData=!1,this._hasNewTerminal=!1,this._paused=!1,this._pendingWave=!1,this._pendingRerun=!1,this._isExecutingFn=!1,this._rerunDepth=0,this._dirtyDepCount=0,this._pauseLocks=null,this._pauseBuffer=null;for(let u of this._deps)Gt(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 s;try{s=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 i=this._isTerminal;if(this._sinkCount===1&&!i)try{this._activate()}catch(u){if(this._sinkCount-=1,this._removeSink(e),this._sinkCount===0&&(this._status="sentinel"),typeof s=="function")try{s()}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 s=="function"&&s(),this._sinks==null&&this._deactivate())}}_removeSink(e){if(this._sinks===e)this._sinks=null;else if(this._sinks!=null&&typeof this._sinks!="function")if(this._sinks.delete(e),this._sinks.size===1){let[t]=this._sinks;this._sinks=t}else this._sinks.size===0&&(this._sinks=null)}_activate(){if(this._deps.length===0){this._fn&&this._execFn();return}this._dirtyDepCount=0;let e=this._deps.length,t=0;try{for(let r=0;r<e;r++){let o=r,s=this._deps[r];s.unsub=Tn,s.unsub=s.node.subscribe(i=>{if(s.unsub===null)return;let a=this._config.tierOf,u=!1;for(let d of i)a(d[0])>=3&&(u=!0),this._config.onMessage(this,d,{direction:"down-in",depIndex:o},this._actions);u&&this._maybeRunFnOnSettlement()}),t++}}catch(r){this._deps[t].unsub=null;for(let o=0;o<t;o++){let s=this._deps[o];if(s.unsub!=null){let i=s.unsub;s.unsub=null;try{i()}catch{}Gt(s)}}throw this._dirtyDepCount=0,r}}_addDep(e){for(let o=0;o<this._deps.length;o++)if(this._deps[o].node===e)return o;let t=this._deps.length,r=Nn(e);if(this._deps.push(r),this._sinks==null)return t;r.dirty=!0,this._dirtyDepCount++,this._status!=="dirty"&&this._emit(kt),r.unsub=Tn;try{r.unsub=e.subscribe(o=>{if(r.unsub===null)return;let s=this._config.tierOf,i=!1;for(let a of o)s(a[0])>=3&&(i=!0),this._config.onMessage(this,a,{direction:"down-in",depIndex:t},this._actions);i&&this._maybeRunFnOnSettlement()})}catch(o){throw r.unsub=null,this._deps.pop(),this._dirtyDepCount--,o}return t}_deactivate(e=!1){let t=this._cleanup;if(this._cleanup=void 0,typeof t=="function")try{t()}catch(r){this._emit([[_,this._wrapFnError("cleanup threw",r)]])}else if(t!=null&&typeof t=="object"){let r=t.deactivate;if(typeof r=="function")try{r()}catch(o){this._emit([[_,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{}}Gt(r)}this._waveHasNewData=!1,this._hasNewTerminal=!1,this._hasCalledFnOnce=!1,this._paused=!1,this._pendingWave=!1,this._pendingRerun=!1,this._rerunDepth=0,this._store={},this._dirtyDepCount=0,this._pauseLocks=null,this._pauseBuffer=null,this._fn!=null&&(this._cached=void 0),e||(this._fn!=null||this._deps.length>0)&&(!this._isTerminal||this._resubscribable)&&(this._status="sentinel")}_onDepMessage(e,t){let r=this._deps[e],o=t[0];if(this._inspectorHooks!=null){let s={kind:"dep_message",depIndex:e,message:t};for(let i of this._inspectorHooks)i(s)}if(o!==ie){if(o===I){this._depDirtied(r);return}if(o===te){if(this._depInvalidated(r),this._cached===void 0)return;this._emit(cn);return}if(o===Y||o===ne){this._emit([t]);return}if(o===V){this._emit(xt);return}if(o===x)this._depSettledAsData(r,t[1]);else if(o===M)this._depSettledAsResolved(r);else if(o===E)this._depSettledAsTerminal(r,!0);else if(o===_)this._depSettledAsTerminal(r,t[1]);else{this._emit([t]);return}if(!this._fn){(o===x||o===M)&&this._emit([t]),(o===E||o===_)&&this._maybeAutoTerminalAfterWave();return}}}_depDirtied(e){e.dirty||(e.dirty=!0,e.involvedThisWave=!0,this._dirtyDepCount++,this._status!=="dirty"&&this._emit(kt))}_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(dn),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([[_,e.terminal]]);return}this._autoComplete&&this._deps.every(t=>t.terminal!==void 0)&&this._emit(ln)}_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([[_,this._wrapFnError("cleanup threw",i)]]);return}}else if(e!=null&&typeof e=="object"){let i=e.beforeRun;if(typeof i=="function"){e.beforeRun=void 0;try{i()}catch(a){this._emit([[_,this._wrapFnError("cleanup.beforeRun threw",a)]]);return}}}let t=this._deps.map(i=>i.involvedThisWave?i.dataBatch.length>0?[...i.dataBatch]:[]:void 0),r=this._deps.map(i=>i.prevData);for(let i=0;i<this._deps.length;i++){let a=t[i];a!=null&&a.length>0&&(this._deps[i].prevData=a[a.length-1])}let o=this._deps.map(i=>i.terminal),s={prevData:r,terminalDeps:o,store:this._store};if(this._hasCalledFnOnce=!0,this._clearWaveFlags(),this._inspectorHooks!=null){let i={kind:"run",batchData:t,prevData:r};for(let a of this._inspectorHooks)a(i)}this._isExecutingFn=!0;try{let i=this._fn(t,this._actions,s);if(typeof i=="function")this._cleanup=i;else if(i!=null&&typeof i=="object"){let a=i;(typeof a.beforeRun=="function"||typeof a.deactivate=="function"||typeof a.invalidate=="function")&&(this._cleanup=i)}}catch(i){this._emit([[_,this._wrapFnError("fn threw",i)]])}finally{this._isExecutingFn=!1,this._pendingRerun?(this._pendingRerun=!1,this._rerunDepth+=1,this._rerunDepth>_n?(this._rerunDepth=0,this._emit([[_,new Error(`Node "${this.name}": _pendingRerun depth exceeded ${_n} \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"?[Oe,e[0]]:e;let r=!0,o=!1,s=!1,i=-1;for(let u of e){let d=t(u[0]);d<i&&(r=!1),d===3&&(o=!0),u[0]===I&&(s=!0),i=d}let a=e;if(!r){let u=e.map((d,c)=>({m:d,i:c,tier:t(d[0])}));u.sort((d,c)=>d.tier-c.tier||d.i-c.i),a=u.map(d=>d.m)}if(o&&!s&&this._status!=="dirty"){let u=0;for(;u<a.length&&t(a[u][0])===0;)u++;return u===0?[Oe,...a]:[...a.slice(0,u),Oe,...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]===_&&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 t=e;if(this._isTerminal&&!this._resubscribable){let a=e.filter(u=>u[0]===V||u[0]===te);if(a.length===0)return;t=a}t=this._frameBatch(t);let o=null;for(let a=0;a<t.length;a++){let u=t[a],d=u[0];if(d!==Y&&d!==ne){o?.push(u);continue}if(u.length<2)throw new Error(`Node "${this.name}": [[${d===Y?"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=u[1];if(d===Y)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 f=this._pauseBuffer;this._pauseBuffer=[],this._emit(f)}this._pendingWave&&(this._pendingWave=!1,this._maybeRunFnOnSettlement())}}c?o?.push(u):o==null&&(o=t.slice(0,a))}if(o!=null){if(o.length===0)return;t=o}if(this._hasMeta&&t.some(a=>a[0]===V))for(let a of Object.keys(this.meta))try{this.meta[a]._emit(xt)}catch{}let{finalMessages:s,equalsError:i}=this._updateState(t);if(s.length>0&&this._config.inspectorEnabled){let a=this._config.globalInspector;if(a!=null)try{a({kind:"emit",node:this,messages:s})}catch{}}if(s.length>0)if(this._paused&&this._pausable==="resumeAll"&&this._pauseBuffer!=null){let a=this._config.tierOf,u=[];for(let d of s)a(d[0])===3?this._pauseBuffer.push(d):u.push(d);u.length>0&&this._dispatchOrAccumulate(u)}else this._dispatchOrAccumulate(s);i!=null&&this._emit([[_,i]])}_updateState(e){let t=this._config.tierOf,r,o,s=-1,i=0;for(let c of e)t(c[0])===3&&i++;let a=i<=1,u=-1;if(this._versioning!=null&&i>1){for(let c=e.length-1;c>=0;c--)if(e[c][0]===x){u=c;break}}for(let c=0;c<e.length;c++){let p=e[c],f=p[0];if(f===x){if(p.length>=2){let h=!1;if(a&&this._cached!==void 0)try{h=this._equals(this._cached,p[1])}catch(l){o=this._wrapFnError("equals threw",l),s=c;break}if(h){r==null&&(r=e.slice(0,c)),r.push(Nt),this._status="resolved";continue}this._cached=p[1],this._versioning!=null&&(u<0||c===u)&&vn(this._versioning,p[1],this._hashFn)}this._status="settled",r?.push(p)}else if(r?.push(p),f===I)this._status="dirty";else if(f===M)this._status="resolved";else if(f===E){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===_){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===te){if(this._cached!==void 0){let l=this._config.rigorRecorder;if(l!=null)try{l.onNonVacuousInvalidate(this,this._cached)}catch{}}this._cached=void 0,this._status="dirty";let h=this._cleanup;if(typeof h=="function"){this._cleanup=void 0;try{h()}catch{}}else if(h!=null&&typeof h=="object"){let l=h.invalidate;if(typeof l=="function")try{l()}catch{}}}else f===V&&(this._resetOnTeardown&&(this._cached=void 0),this._deactivate(!0),this._status="sentinel")}let d=s>=0?r??e.slice(0,s):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 t=[...this._sinks];for(let r of t)r(e)};_dispatchOrAccumulate(e){if(gn()){this._batchPendingMessages===null&&(this._batchPendingMessages=[],Re(()=>this._flushBatchPending()));for(let t of e)this._batchPendingMessages.push(t);return}qe(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);qe(this._deliverToSinks,t,this._config.tierOf)}},On=n=>Array.isArray(n),Pt=n=>typeof n=="object"&&n!=null&&!Array.isArray(n)});function me(n,e){return W([],{...e,initial:n})}function j(n,e){return W((r,o,s)=>n(o,s)??void 0,{describeKind:"producer",...e})}function Xe(n,e,t){return W(n,(o,s,i)=>{let a=o.map((u,d)=>u!=null&&u.length>0?u.at(-1):i.prevData[d]);s.emit(e(a,i))},{describeKind:"derived",...t})}function kn(n,e,t){return W(n,(o,s,i)=>{let a=o.map((u,d)=>u!=null&&u.length>0?u.at(-1):i.prevData[d]);return e(a,s,i)??void 0},{describeKind:"effect",...t})}var Qe=L(()=>{"use strict";ae()});function Ie(n,e,t){let r=new Set;for(let o of n.split(",")){let[s,i]=o.split("/"),a=i?Number.parseInt(i,10):1;if(Number.isNaN(a)||a<1)throw new Error(`Invalid cron step: ${o}`);let u,d;if(s==="*")u=e,d=t;else if(s.includes("-")){let[c,p]=s.split("-");u=Number.parseInt(c,10),d=Number.parseInt(p,10)}else u=Number.parseInt(s,10),d=u;if(Number.isNaN(u)||Number.isNaN(d))throw new Error(`Invalid cron field: ${n}`);if(u<e||d>t)throw new Error(`Cron field out of range: ${n} (${e}-${t})`);if(u>d)throw new Error(`Invalid cron range: ${u}-${d} in ${n}`);for(let c=u;c<=d;c+=a)r.add(c)}return r}function xn(n){let e=n.trim().split(/\s+/);if(e.length!==5)throw new Error(`Invalid cron: expected 5 fields, got ${e.length}`);return{minutes:Ie(e[0],0,59),hours:Ie(e[1],0,23),daysOfMonth:Ie(e[2],1,31),months:Ie(e[3],1,12),daysOfWeek:Ie(e[4],0,6)}}function En(n,e){return n.minutes.has(e.getMinutes())&&n.hours.has(e.getHours())&&n.daysOfMonth.has(e.getDate())&&n.months.has(e.getMonth()+1)&&n.daysOfWeek.has(e.getDay())}var Rn=L(()=>{"use strict"});function H(n,e,t){return{[n]:!0,[`${n}_type`]:e,...t??{}}}var It=L(()=>{"use strict"});function Le(n,e,t){if(e.length===0)throw new RangeError("budgetGate requires at least one constraint");let r=e.map(h=>h.node),o=[n,...r],s=new Lt,i=!1,a=!1,u=Symbol("budget-gate"),d=new Array(e.length);function c(){return e.every((h,l)=>h.check(d[l]))}function p(h){for(;s.size>0&&c();){let l=s.shift();h.emit(l)}s.size===0&&a&&(a=!1,h.down([[M]]))}return W([],(h,l)=>{for(let m=0;m<e.length;m++)d[m]=e[m].node.cache;let g=[];for(let m=0;m<o.length;m++){let v=o[m];g.push(v.subscribe(b=>{for(let y of b)f(y,m,l)}))}return()=>{for(let m of g)m()}},{...t,describeKind:"derived",meta:H("resilience","budget_gate",t?.meta)});function f(h,l,g){let m=h[0];if(l===0){if(m===x)return c()&&s.size===0?g.emit(h[1]):(s.push(h[1]),i||(i=!0,g.up([[Y,u]]))),!0;if(m===I)return g.down([[I]]),!0;if(m===M)return s.size===0?g.down([[M]]):a=!0,!0;if(m===E||m===_){for(;s.size>0;)g.emit(s.shift());return a=!1,i&&(i=!1,g.up([[ne,u]])),g.down([h]),!0}return!1}if(m===x&&(d[l-1]=h[1]),m===x||m===M){let v=c();return v&&s.size>0?(p(g),s.size===0&&i&&(i=!1,g.up([[ne,u]]))):!v&&!i&&s.size>0&&(i=!0,g.up([[Y,u]])),!0}return m===I?!0:m===_?(g.down([h]),!0):m===E}}var Lt,Sn=L(()=>{"use strict";ue();ae();It();Lt=class{buf=[];head=0;get size(){return this.buf.length-this.head}push(e){this.buf.push(e)}shift(){if(this.head>=this.buf.length)return;let e=this.buf[this.head];return this.buf[this.head]=void 0,this.head++,this.head>32&&this.head*2>this.buf.length&&(this.buf=this.buf.slice(this.head),this.head=0),e}clear(){this.buf=[],this.head=0}}});function $t(n,e){if(e!=null&&e.length>0)return new Set(e);switch(n){case"standard":return new Set(["type","status","value","deps","meta","v"]);case"full":return null;case"spec":return new Set(["type","deps","meta","value"]);default:return new Set(["type","deps"])}}function Lr(n){return n._describeKind!=null?n._describeKind:n._deps.length>0?"derived":n._fn!=null?"producer":"state"}function Cn(n){let e=new WeakSet,t={};for(let[r,o]of An(n))t[r]=Ft(o,e);return t}function Ft(n,e){if(n==null)return n;let t=typeof n;if(t==="boolean"||t==="number"||t==="string")return n;if(t==="function")return"<function>";if(Array.isArray(n))return e.has(n)?"<cycle>":(e.add(n),n.map(r=>Ft(r,e)));if(t==="object"){let r=n;if(e.has(r))return"<cycle>";e.add(r);try{if(typeof r.subscribe=="function"&&"cache"in r)return"<Node>"}catch{return"<unserializable>"}let o={};for(let[s,i]of An(r))o[s]=Ft(i,e);return o}return"<unserializable>"}function An(n){let e=[],t;try{t=Object.keys(n)}catch{return e}for(let r of t)try{e.push([r,n[r]])}catch{e.push([r,"<unserializable>"])}return e}function oe(n,e){let t={factory:n};return e!==void 0&&(t.factoryArgs=e),t}function Fr(n){let e={};for(let[t,r]of Object.entries(n.meta))try{e[t]=r.cache}catch{}return e}function Bt(n,e,t){let r=e==null,o=!r&&e!=null?[...e].filter(c=>c.startsWith("meta.")).map(c=>c.slice(5)):null,s=r||e.has("meta")||o!=null&&o.length>0,i="state",a=[];n instanceof z&&(i=Lr(n),a=n._deps.map(c=>c.node.name??""));let u={type:i,deps:a};(r||e.has("status"))&&(u.status=n.status);let d=n instanceof z?n._guard:void 0;if(s){let c={...Fr(n)};if(d!=null&&c.access===void 0&&(c.access=Ct(d)),o!=null&&o.length>0&&!e.has("meta")){let p={};for(let f of o)f in c&&(p[f]=c[f]);u.meta=p}else u.meta=c}if(n.name!=null&&(u.name=n.name),(r||e.has("value"))&&(!t||i==="state")){n.status==="sentinel"&&(u.sentinel=!0);try{u.value=n.cache}catch{}}if((r||e.has("v"))&&n.v!=null){let c={id:n.v.id,version:n.v.version};"cid"in n.v&&(c.cid=n.v.cid,c.prev=n.v.prev),u.v=c}return(r||e.has("guard"))&&d!=null&&(u.guard=Ct(d)),(r||e.has("lastMutation"))&&n.lastMutation!=null&&(u.lastMutation=n.lastMutation),u}var Fe=L(()=>{"use strict";Je();ae()});function Dn(n){let e=new WeakSet,t=new WeakSet,r=[n],o=0;for(;r.length>0;){let s=r.pop();o+=Br(s,e,t,r)}return o}function Br(n,e,t,r){if(n==null)return 0;switch(typeof n){case"number":return U.number;case"boolean":return U.boolean;case"string":return U.string+n.length*2;case"bigint":return U.bigint+Vr(n);case"symbol":return U.symbol;case"function":return e.has(n)?0:(e.add(n),U.function);case"undefined":return 0}let s=n;if(e.has(s))return 0;e.add(s);let i=s[$r];if(typeof i=="function")try{let d=i.call(s);if(typeof d=="number"&&Number.isFinite(d))return d}catch{}if(s instanceof Date)return U.date;if(s instanceof RegExp)return U.regexp+s.source.length*2;if(s instanceof Error){let d=s.message?s.message.length*2:0,c=s.stack?s.stack.length*2:0;return U.error+d+c}if(typeof URL<"u"&&s instanceof URL)return U.url+s.href.length*2;if(typeof Promise<"u"&&s instanceof Promise)return U.promise;if(s instanceof WeakMap)return U.weakmap;if(s instanceof WeakSet)return U.weakset;if(s instanceof Map){let d=U.map;for(let[c,p]of s)d+=U.mapEntry,r.push(c),r.push(p);return d}if(s instanceof Set){let d=U.set;for(let c of s)d+=U.setEntry,r.push(c);return d}if(Array.isArray(s)){let d=U.array+s.length*8;for(let c of s)r.push(c);return d}if(s instanceof ArrayBuffer)return t.has(s)?0:(t.add(s),s.byteLength);if(ArrayBuffer.isView(s)){let d=s;return t.has(d.buffer)?48:(t.add(d.buffer),d.buffer.byteLength+48)}let a=U.object,u=Object.keys(s);for(let d of u){a+=U.string+d.length*2;try{r.push(s[d])}catch{}}return a}function Vr(n){let e=n<0n?-n:n;if(e===0n)return 0;let t=e.toString(2).length;return Math.ceil(t/32)*8}var U,$r,Mn=L(()=>{"use strict";U={object:56,array:64,string:40,number:8,boolean:4,null:0,undefined:0,symbol:40,bigint:16,function:120,map:72,set:72,mapEntry:40,setEntry:24,date:24,regexp:48,error:64,url:80,promise:48,weakmap:40,weakset:40},$r=Symbol.for("sizeof")});function Gn(n,e,t,r={}){let o=e in n.nodes,s=t in n.nodes;if(!o)return et(e,t,"no-such-from");if(!s)return et(e,t,"no-such-to");let i=r.maxDepth;if(i!=null&&(!Number.isInteger(i)||i<0))throw new Error("explainPath: maxDepth must be an integer >= 0");if(e===t){if(r.findCycle===!0){let d=jr(n,e,r);if(d!=null)return d}let u=tt(e,n.nodes[e],0,r);return nt(e,t,[u])}if(i===0)return et(e,t,"no-path");let a=Pn(n,e,t,i);return a.found?nt(e,t,In(n,a.pathOrder,r)):et(e,t,a.truncated?"max-depth-exceeded":"no-path")}function Pn(n,e,t,r){let o=new Map,s=[{path:t,depth:0}],i=new Set([t]),a=0,u=!1;for(;a<s.length;){let p=s[a++];if(p.path===e)break;if(r!=null&&p.depth>=r){let g=n.nodes[p.path];g?.deps&&g.deps.length>0&&(u=!0);continue}let f=n.nodes[p.path];if(f==null)continue;let h=f.deps??[],l=new Map;for(let g=0;g<h.length;g++){let m=h[g];if(!m)continue;let v=l.get(m);v==null&&(v=[],l.set(m,v)),v.push(g)}for(let[g,m]of l)i.has(g)||(i.add(g),o.set(g,{from:p.path,depIndices:m}),s.push({path:g,depth:p.depth+1}))}if(!o.has(e))return{found:!1,pathOrder:[],truncated:u};let d=[{path:e}],c=e;for(;c!==t;){let p=o.get(c);if(p==null)return{found:!1,pathOrder:[],truncated:!1};d[d.length-1].depIndices=p.depIndices,d.push({path:p.from}),c=p.from}return{found:!0,pathOrder:d,truncated:!1}}function jr(n,e,t){let r=n.nodes[e];if(r==null)return null;let o=r.deps??[],s=[];for(let a=0;a<o.length;a++)o[a]===e&&s.push(a);if(s.length>0){let a=tt(e,r,0,t);a.dep_index=s[0];let u=tt(e,r,1,t);return nt(e,e,[a,u])}let i=null;for(let a=0;a<o.length;a++){let u=o[a];if(!u||u===e)continue;let d=Pn(n,u,e,t.maxDepth);d.found&&(i==null||d.pathOrder.length<i.pathOrder.length)&&(i=d,i={found:!0,pathOrder:[{path:e,depIndices:[a]},...d.pathOrder],truncated:!1})}return i==null?null:nt(e,e,In(n,i.pathOrder,t))}function In(n,e,t){return e.map((r,o)=>{let s=n.nodes[r.path],i=tt(r.path,s,o,t);return r.depIndices!=null&&r.depIndices.length>0&&(i.dep_index=r.depIndices[0],r.depIndices.length>1&&(i.dep_indices=[...r.depIndices])),i})}function tt(n,e,t,r){let o={path:n,type:e.type,hop:t};e.status!==void 0&&(o.status=e.status),"value"in e&&(o.value=e.value),e.v!=null&&(o.v=e.v);let s=r.annotations?.get(n)??e.annotation;s!=null&&(o.annotation=s);let i=r.lastMutations?.get(n)??e.lastMutation;return i!=null&&(o.lastMutation=i),o}function nt(n,e,t){return Ln(n,e,!0,"ok",t)}function et(n,e,t){return Ln(n,e,!1,t,[])}function Ln(n,e,t,r,o){let s=zr(n,e,t,r,o);return{from:n,to:e,found:t,reason:r,steps:o,text:s,toJSON(){return{from:n,to:e,found:t,reason:r,steps:o}}}}function zr(n,e,t,r,o){if(!t)switch(r){case"no-such-from":return`explainPath: no node named "${n}"`;case"no-such-to":return`explainPath: no node named "${e}"`;case"max-depth-exceeded":return`explainPath: no path from "${n}" to "${e}" within maxDepth`;default:return`explainPath: no path from "${n}" to "${e}"`}let s=[`Causal path: ${n} \u2192 ${e} (${o.length} step(s))`];for(let i of o){let u=` ${i.hop===0?"\xB7":"\u2193"} ${i.path} (${i.type}${i.status?`/${i.status}`:""})`;if(s.push(u),"value"in i&&s.push(` value: ${Ur(i.value)}`),i.annotation!=null&&s.push(` annotation: ${i.annotation}`),i.lastMutation!=null){let d=i.lastMutation.actor;s.push(` actor: ${d.type}${d.id?`:${d.id}`:""}`)}}return s.join(`
2
- `)}function Ur(n){if(n===void 0)return"<sentinel>";if(n===null)return"null";if(typeof n=="string")return JSON.stringify(n);if(typeof n=="number"||typeof n=="boolean"||typeof n=="bigint")return String(n);try{let e=JSON.stringify(n);return e.length>80?`${e.slice(0,77)}...`:e}catch{return String(n)}}var Fn=L(()=>{"use strict"});function Vt(n,e){if(Object.is(n,e))return!0;if(n==null||e==null||typeof n!="object"||typeof e!="object")return!1;if(Array.isArray(n)){if(!Array.isArray(e)||n.length!==e.length)return!1;for(let s=0;s<n.length;s++)if(!Vt(n[s],e[s]))return!1;return!0}if(Array.isArray(e))return!1;let t=Object.keys(n),r=Object.keys(e);if(t.length!==r.length)return!1;let o=new Set(r);for(let s of t)if(!o.has(s)||!Vt(n[s],e[s]))return!1;return!0}function $n(n,e){return`${n}\0${e}`}function jt(n,e){let t=[],r=new Set(n.subgraphs),o=new Set(e.subgraphs),s=[];for(let m of o)r.has(m)||s.push(m);s.sort();for(let m of s)t.push({type:"subgraph-mounted",path:m});let i=new Set(Object.keys(n.nodes)),a=new Set(Object.keys(e.nodes)),u=[];for(let m of a)i.has(m)||u.push(m);u.sort();for(let m of u)t.push({type:"node-added",path:m,node:{...e.nodes[m]}});let d=[];for(let m of a){if(!i.has(m))continue;let v=n.nodes[m]?.meta,b=e.nodes[m]?.meta;v==null&&b==null||Vt(v??{},b??{})||d.push(m)}d.sort();for(let m of d)t.push({type:"node-meta-changed",path:m,prevMeta:n.nodes[m]?.meta??{},nextMeta:e.nodes[m]?.meta??{}});let c=new Map;for(let m of n.edges)c.set($n(m.from,m.to),m);let p=new Map;for(let m of e.edges)p.set($n(m.from,m.to),m);let f=[];for(let[m,v]of p)c.has(m)||f.push(v);f.sort((m,v)=>m.from<v.from?-1:m.from>v.from?1:m.to<v.to?-1:m.to>v.to?1:0);for(let m of f)t.push({type:"edge-added",from:m.from,to:m.to});let h=[];for(let[m,v]of c)p.has(m)||h.push(v);h.sort((m,v)=>m.from<v.from?-1:m.from>v.from?1:m.to<v.to?-1:m.to>v.to?1:0);for(let m of h)t.push({type:"edge-removed",from:m.from,to:m.to});let l=[];for(let m of i)a.has(m)||l.push(m);l.sort();for(let m of l)t.push({type:"node-removed",path:m});let g=[];for(let m of r)o.has(m)||g.push(m);g.sort();for(let m of g)t.push({type:"subgraph-unmounted",path:m});return{events:t,flushedAt_ns:K()}}var Bn=L(()=>{"use strict";Ne()});var de,zt=L(()=>{"use strict";de=class{_timer;_gen=0;start(e,t){this.cancel(),this._gen+=1;let r=this._gen;this._timer=setTimeout(()=>{this._timer=void 0,r===this._gen&&t()},e)}cancel(){this._timer!==void 0&&(clearTimeout(this._timer),this._timer=void 0)}get pending(){return this._timer!==void 0}}});var ge,Ut=L(()=>{"use strict";ge=class{constructor(e){this.capacity=e;if(!Number.isInteger(e)||e<=0)throw new Error(`RingBuffer capacity must be a positive integer (got ${e})`);this.buf=new Array(e)}buf;head=0;_size=0;get size(){return this._size}get maxSize(){return this.capacity}push(e){let t=(this.head+this._size)%this.capacity;this.buf[t]=e,this._size<this.capacity?this._size++:this.head=(this.head+1)%this.capacity}shift(){if(this._size===0)return;let e=this.buf[this.head];return this.buf[this.head]=void 0,this.head=(this.head+1)%this.capacity,this._size--,e}at(e){if(this._size===0)return;let t=e<0?this._size+e:e;if(!(t<0||t>=this._size))return this.buf[(this.head+t)%this.capacity]}toArray(){let e=new Array(this._size);for(let t=0;t<this._size;t++)e[t]=this.buf[(this.head+t)%this.capacity];return e}clear(){for(let e=0;e<this._size;e++)this.buf[(this.head+e)%this.capacity]=void 0;this.head=0,this._size=0}}});function Vn(n,e){let t=e?.topN??10,r=n.describe({detail:"standard"}),o=[],s=n._collectObserveTargets;typeof s=="function"&&s.call(n,"",o);let i=new Map;for(let[f,h]of o)i.set(f,h);let a=[];for(let[f,h]of Object.entries(r.nodes)){let l=i.get(f),g=l instanceof z?l:null,m=g?Dn(g.cache):0,v=g?g._sinkCount:0,b=h.deps?.length??0,y=h.type==="effect"&&v===0,w=v===0?h.type==="effect"?"orphan-effect":h.type==="derived"?"idle-derived":h.type==="producer"?"idle-producer":null:null;a.push({path:f,type:h.type,status:h.status??"unknown",valueSizeBytes:m,subscriberCount:v,depCount:b,isOrphanEffect:y,orphanKind:w})}let u=a.reduce((f,h)=>f+h.valueSizeBytes,0),d=(f,h)=>[...a].sort(h??((l,g)=>g[f]-l[f])).slice(0,t),c=a.filter(f=>f.orphanKind!=null),p=a.filter(f=>f.isOrphanEffect);return{nodeCount:a.length,edgeCount:r.edges.length,subgraphCount:r.subgraphs.length,nodes:a,totalValueSizeBytes:u,hotspots:{byValueSize:d("valueSizeBytes"),bySubscriberCount:d("subscriberCount"),byDepCount:d("depCount")},orphans:c,orphanEffects:p}}var jn=L(()=>{"use strict";ae();Mn()});function rt(n,e){let t=Math.max(16,n.size*4),r=0;for(;n.size>0;){if(r++>=t){console.error(`[Graph "${e}".destroy] disposer drain exceeded cap (${t}); ${n.size} disposer(s) discarded`),n.clear();return}let o=n.values().next();if(o.done)return;let s=o.value;n.delete(s);try{s()}catch(i){console.error(`[Graph "${e}".destroy] disposer threw:`,i)}}}function qn(n){return n!=null&&typeof n=="object"&&"cache"in n&&typeof n.subscribe=="function"&&typeof n.down=="function"}function Wr(n){if(n!=null)return qn(n)?n.cache:n}function ye(n){return n!=null&&typeof n=="object"&&"cache"in n&&typeof n.subscribe=="function"&&typeof n.down=="function"}function ce(n){return ye(n)?n.cache??"":n}function zn(n){return ye(n)?n.cache??0:n}function Un(n){return ye(n)?n.cache??!1:n}function Hr(n){let e=[];for(let t of Object.keys(n).sort()){let r=n[t].v;r!=null&&e.push(`${t} ${r.id} ${r.version}`)}return e.join(`
3
- `)}function Wn(n){if(n.version!==be)throw new Error(`unsupported snapshot version ${String(n.version)} (expected ${be})`);for(let e of["name","nodes","edges","subgraphs"])if(!(e in n))throw new Error(`snapshot missing required key "${e}"`);if(typeof n.name!="string")throw new TypeError("snapshot 'name' must be a string");if(typeof n.nodes!="object"||n.nodes===null||Array.isArray(n.nodes))throw new TypeError("snapshot 'nodes' must be an object");if(!Array.isArray(n.edges))throw new TypeError("snapshot 'edges' must be an array");if(!Array.isArray(n.subgraphs))throw new TypeError("snapshot 'subgraphs' must be an array")}function qr(n,e){let t=new WeakMap,r=(o,s)=>{if(Object.is(o,s))return!0;if(o==null||s==null||typeof o!="object"||typeof s!="object")return!1;let i=t.get(o);if(i==null&&(i=new WeakSet,t.set(o,i)),i.has(s))return!0;i.add(s);let a=o.constructor,u=s.constructor;if(a!==u)return!1;if(o instanceof Date)return o.getTime()===s.getTime();if(o instanceof RegExp)return o.source===s.source&&o.flags===s.flags;if(Array.isArray(o)){let f=s;if(o.length!==f.length)return!1;for(let h=0;h<o.length;h++)if(!r(o[h],f[h]))return!1;return!0}if(o instanceof Map){let f=s;if(o.size!==f.size)return!1;for(let[h,l]of o)if(!f.has(h)||!r(l,f.get(h)))return!1;return!0}if(o instanceof Set){let f=s;if(o.size!==f.size)return!1;for(let h of o){let l=!1;for(let g of f)if(r(h,g)){l=!0;break}if(!l)return!1}return!0}if(ArrayBuffer.isView(o)){let f=o,h=s;if(f.length!==h.length)return!1;for(let l=0;l<f.length;l++)if(f[l]!==h[l])return!1;return!0}let d=Object.keys(o),c=Object.keys(s);if(d.length!==c.length)return!1;let p=new Set(c);for(let f of d)if(!p.has(f)||!r(o[f],s[f]))return!1;return!0};return r(n,e)}function Kr(n){return n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ot(n){let e="^";for(let t=0;t<n.length;t+=1){let r=n[t];if(r==="*"){e+=".*";continue}if(r==="?"){e+=".";continue}if(r==="["){let o=n.indexOf("]",t+1);if(o<=t+1){e+="\\[";continue}let s=n.slice(t+1,o);s.startsWith("!")&&(s=`^${s.slice(1)}`),s=s.replace(/\\/g,"\\\\"),e+=`[${s}]`,t=o;continue}e+=Kr(r)}return e+="$",new RegExp(e)}function Wt(n){if(typeof n=="string")return JSON.stringify(n);if(typeof n=="number"||typeof n=="boolean"||n==null)return String(n);try{return JSON.stringify(n)}catch{return"[unserializable]"}}function Zr(n){return n==="none"?Jr:n==="ansi"||n==null?Yr:{data:n.data??"",dirty:n.dirty??"",resolved:n.resolved??"",invalidate:n.invalidate??"",pause:n.pause??"",resume:n.resume??"",complete:n.complete??"",error:n.error??"",teardown:n.teardown??"",derived:n.derived??"",path:n.path??"",reset:n.reset??""}}function Hn(n){if(n==null)return{};let e=n.detail;return e==="full"?{...n,structured:n.structured??!0,timeline:n.timeline??!0,causal:n.causal??!0,derived:n.derived??!0}:e==="minimal"?{...n,structured:n.structured??!0}:n.format==="stage-log"?{...n,structured:n.structured??!0,timeline:n.timeline??!0}:n}function Xr(n,e,t){for(let r=0;r<n.length;r++){let o=n.charCodeAt(r);if(o<32||o===127)throw new Error(`Graph "${e}": ${t} "${n}" must not contain control character (U+${o.toString(16).padStart(4,"0").toUpperCase()} at index ${r})`)}}function Ht(n,e,t){if(n==="")throw new Error(`Graph "${e}": ${t} name must be non-empty`);if(n.includes(B))throw new Error(`Graph "${e}": ${t} "${n}" must not contain '${B}' (path separator)`);if(n===ee)throw new Error(`Graph "${e}": ${t} name "${ee}" is reserved for meta companion paths`);Xr(n,e,t)}function Qr(n,e){if(n==="")throw new Error(`Graph "${e}": resolve path must be non-empty`);let t=n.split(B);for(let r of t)if(r==="")throw new Error(`Graph "${e}": resolve path has empty segment`);return t}function eo(n,e){let t=!1;for(let o of n)if(!e.isMetaPassthrough(o[0])){t=!0;break}return t?n.filter(o=>e.isMetaPassthrough(o[0])):n}function Kn(n){for(let e of n._mounts.values())Kn(e);for(let e of n._nodes.values())try{e.down([[V]],{internal:!0})}catch{}}function Yn(n,e){let t=Ae.diff(n,e),r={};for(let o of t.nodesAdded){let s=e.nodes[o];s!=null&&(r[o]=s)}return{...t,nodesAddedFull:r}}function qt(n,e,t,r={}){let o={paths:[],depths:new Map,truncated:!1};if(!e)return r.withDetail?o:[];if(!r.both&&t!=="upstream"&&t!=="downstream")throw new Error('reachable: direction must be "upstream" or "downstream"');let s=r.maxDepth;if(s!=null&&(!Number.isInteger(s)||s<0))throw new Error("reachable: maxDepth must be an integer >= 0");if(s===0)return r.withDetail?o:[];let i=new Map,a=new Map,u=new Map,d=new Map,c=new Set;for(let[y,w]of Object.entries(n.nodes)){if(!y)continue;c.add(y);let T=w.deps??[];i.set(y,T);for(let N of T)N&&(c.add(N),a.has(N)||a.set(N,new Set),a.get(N).add(y))}for(let y of n.edges){if(y==null||typeof y!="object")continue;let w=typeof y.from=="string"?y.from:"",T=typeof y.to=="string"?y.to:"";!w||!T||(c.add(w),c.add(T),d.has(w)||d.set(w,new Set),d.get(w).add(T),u.has(T)||u.set(T,new Set),u.get(T).add(w))}if(!c.has(e))return r.withDetail?o:[];let p=r.both===!0,f=y=>{if(p){let R=i.get(y)??[],S=u.get(y),D=a.get(y),G=d.get(y),O=[...R];return S&&O.push(...S),D&&O.push(...D),G&&O.push(...G),O}if(t==="upstream"){let R=i.get(y)??[],S=u.get(y);return S?[...R,...S]:R}let w=a.get(y),T=d.get(y),N=w?[...w]:[];return T&&N.push(...T),N},h=new Set([e]),l=new Map,g=[{path:e,depth:0}],m=0,v=!1;for(;m<g.length;){let y=g[m++];if(s!=null&&y.depth>=s){f(y.path).length>0&&(v=!0);continue}for(let w of f(y.path))!w||h.has(w)||(h.add(w),l.set(w,y.depth+1),g.push({path:w,depth:y.depth+1}))}let b=[...l.keys()].sort((y,w)=>y<w?-1:y>w?1:0);return r.withDetail?{paths:b,depths:l,truncated:v}:b}function to(n,e){if(n.length!==e.length)return!1;for(let t=0;t<n.length;t++){let r=n[t],o=e[t];if(r.path!==o.path||r.type!==o.type||r.status!==o.status||r.hop!==o.hop||r.dep_index!==o.dep_index||r.annotation!==o.annotation||r.value!==o.value||r.lastMutation!==o.lastMutation)return!1;let s=r.v,i=o.v;if(s!==i&&(s==null||i==null||s.id!==i.id||s.version!==i.version))return!1}return!0}var B,ee,be,Yr,Jr,Ae,Jn=L(()=>{"use strict";St();Ke();Ne();Je();ue();Fe();ae();Qe();Bn();st();zt();Ut();Rt();Fn();jn();B="::",ee="__meta__",be=1;Yr={data:"\x1B[32m",dirty:"\x1B[33m",resolved:"\x1B[36m",invalidate:"\x1B[93m",pause:"\x1B[90m",resume:"\x1B[96m",complete:"\x1B[34m",error:"\x1B[31m",teardown:"\x1B[91m",derived:"\x1B[35m",path:"\x1B[90m",reset:"\x1B[0m"},Jr={data:"",dirty:"",resolved:"",invalidate:"",pause:"",resume:"",complete:"",error:"",teardown:"",derived:"",path:"",reset:""};Ae=class n{name;opts;config;_nodes=new Map;_nodeToName=new WeakMap;_mounts=new Map;_parent=void 0;_storageDisposers=new Set;_disposers=new Set;_destroyed=!1;_topology;_topologyEmitters=new Set;_factory;_factoryArgs;constructor(e,t){if(e==="")throw new Error("Graph name must be non-empty");if(e.includes(B))throw new Error(`Graph name must not contain '${B}' (got "${e}")`);if(e===ee)throw new Error(`Graph name "${ee}" is reserved for meta companion paths`);this.name=e,this.opts=Object.freeze({...t??{}}),this.config=t?.config??Ce,this._traceRing=new ge(t?.traceCapacity??1e3),t?.versioning!=null&&this.setVersioning(t.versioning),typeof t?.factory=="string"&&(this._factory=t.factory,t.factoryArgs!==void 0&&(this._factoryArgs=t.factoryArgs))}tagFactory(e,t){return this._factory=e,this._factoryArgs=t,this}ancestors(e=!0){let t=[],r=e?this:this._parent;for(;r!=null;)t.push(r),r=r._parent;return t}get topology(){return this._topology==null&&(this._topology=j(e=>{let t=r=>{e.emit(r)};return this._topologyEmitters.add(t),()=>{this._topologyEmitters.delete(t)}},{name:`${this.name}_topology`})),this._topology}_emitTopology(e){if(!(this._topology==null||this._topologyEmitters.size===0))for(let t of this._topologyEmitters)t(e)}nameOf(e){return this._nodeToName.get(e)}add(e,t){let r=e.name,o=t?.name??r;if(o==null||o==="")throw new Error(`Graph "${this.name}": graph.add requires a non-empty name \u2014 pass via opts.name or set it on the node (e.g. state(0, { name: "x" }))`);let s=o,i=t?.annotation;if(Ht(s,this.name,"add"),this._mounts.has(s))throw new Error(`Graph "${this.name}": name "${s}" is already a mount point`);if(this._nodes.has(s))throw new Error(`Graph "${this.name}": node "${s}" already exists`);let a=this._nodeToName.get(e);if(a!==void 0)throw new Error(`Graph "${this.name}": node instance already registered as "${a}"`);return this._nodes.set(s,e),this._nodeToName.set(e,s),this._emitTopology({kind:"added",name:s,nodeKind:"node"}),i!=null&&(this._annotations.set(s,i),this.config.inspectorEnabled&&this._traceRing.push({path:s,annotation:i,timestamp_ns:K()})),e}setVersioning(e){if(e!=null)for(let t of this._nodes.values())t instanceof z&&t._applyVersioning(e)}remove(e){Ht(e,this.name,"remove");let t=this._mounts.get(e);if(t){let s={kind:"mount",nodes:[],mounts:[]},i=[];t._collectObserveTargets("",i);for(let[a,u]of i)a.includes(`${B}${ee}${B}`)||s.nodes.push(a);return s.nodes.sort(),s.mounts.push(e),s.mounts.push(...t._collectSubgraphs(`${e}${B}`)),this._mounts.delete(e),t._parent=void 0,Kn(t),this._emitTopology({kind:"removed",name:e,nodeKind:"mount",audit:s}),s}let r=this._nodes.get(e);if(!r)throw new Error(`Graph "${this.name}": unknown node or mount "${e}"`);this._nodes.delete(e),this._nodeToName.delete(r),r.down([[V]],{internal:!0});let o={kind:"node",nodes:[e],mounts:[]};return this._emitTopology({kind:"removed",name:e,nodeKind:"node",audit:o}),o}removeAll(e){let t=typeof e=="function"?e:(()=>{let s=ot(e);return i=>s.test(i)})(),r={kind:"mount",nodes:[],mounts:[]},o=[...this._nodes.keys(),...this._mounts.keys()].filter(s=>t(s));for(let s of o){let i=this.remove(s);r.nodes.push(...i.nodes),r.mounts.push(...i.mounts)}return r.nodes.sort(),r.mounts.sort(),r}[Symbol.iterator](){let e=[...this._nodes.keys()].sort(),t=this._nodes,r=0;return{[Symbol.iterator](){return this},next(){if(r>=e.length)return{value:void 0,done:!0};let o=e[r++];return{value:[o,t.get(o)],done:!1}}}}node(e){if(e==="")throw new Error(`Graph "${this.name}": node name must be non-empty`);if(e.includes(B))return this.resolve(e);let t=this._nodes.get(e);if(!t)throw new Error(`Graph "${this.name}": unknown node "${e}"`);return t}get(e){return this.node(e).cache}set(e,t,r){let o=r?.internal===!0;this.node(e).down([[x,t]],{actor:r?.actor,internal:o,delivery:"write"})}setAll(e,t){let r=Symbol.iterator in e?e:Object.entries(e);Se(()=>{for(let[o,s]of r)this.set(o,s,t)})}invalidate(e,t){let r=t?.internal===!0;this.node(e).down([[te]],{actor:t?.actor,internal:r,delivery:"write"})}error(e,t,r){let o=r?.internal===!0;this.node(e).down([[_,t]],{actor:r?.actor,internal:o,delivery:"write"})}complete(e,t){let r=t?.internal===!0;this.node(e).down([[E]],{actor:t?.actor,internal:r,delivery:"write"})}_registerSelfPruningKeepalive(e){let t,r,o=()=>{t?.(),t=void 0,r?.(),r=void 0};t=e.subscribe(s=>{for(let i of s){let a=i[0];if(a===V||a===E||a===_){o();return}}}),r=this.addDisposer(o)}_wireSignalToRemove(e,t){if(t==null)return;let r=()=>{try{this.remove(e)}catch{}};if(t.aborted){r();return}t.addEventListener("abort",r,{once:!0}),this.addDisposer(()=>t.removeEventListener("abort",r))}derived(e,t,r,o){let s=t.map(h=>this.resolve(h)),{keepAlive:i,annotation:a,equals:u,initial:d,meta:c,signal:p}=o??{},f=Xe(s,r,{name:e,...u!=null?{equals:u}:{},...d!==void 0?{initial:d}:{},...c!=null?{meta:c}:{}});return this.add(f,{name:e,...a!=null?{annotation:a}:{}}),i===!0&&this._registerSelfPruningKeepalive(f),this._wireSignalToRemove(e,p),f}effect(e,t,r,o){let s=t.map(c=>this.resolve(c)),{annotation:i,meta:a,signal:u}=o??{},d=kn(s,r,{name:e,...a!=null?{meta:a}:{}});return this.add(d,{name:e,...i!=null?{annotation:i}:{}}),this._wireSignalToRemove(e,u),d}produce(e,t,r){if(t===void 0)throw new Error(`Graph "${this.name}".produce("${e}", \u2026): source must not be \`undefined\` \u2014 undefined is the global SENTINEL (spec \xA71.1). Pass \`null\` for nullary DATA, or a Promise/AsyncIterable/Iterable for async sources.`);if(t!==null&&typeof t=="object"&&"cache"in t&&typeof t.subscribe=="function")throw new Error(`Graph "${this.name}".produce("${e}", \u2026): Node sources are rejected. For Node\u2192Node, use graph.derived(name, [path], ([v]) => v, { keepAlive: true }) \u2014 fromAny passes Nodes through verbatim and silently drops opts.`);let{annotation:o,meta:s,equals:i,signal:a}=r??{},u=le(t,{name:e,...s!=null?{meta:s}:{},...i!=null?{equals:i}:{},...a!=null?{signal:a}:{}});return this.add(u,{name:e,...o!=null?{annotation:o}:{}}),this._wireSignalToRemove(e,a),u}batch(e){Se(e)}edges(e){let t=e?.recursive===!0,r=new Map;if(!t){for(let[u,d]of this._nodes)r.set(d,u);let a=[];for(let[u,d]of this._nodes)if(d instanceof z)for(let c of d._deps){let p=r.get(c.node);p!=null&&a.push([p,u])}return a.sort((u,d)=>u[0]<d[0]?-1:u[0]>d[0]?1:u[1]<d[1]?-1:u[1]>d[1]?1:0),a}let o=[];this._collectObserveTargets("",o);let s=new Map;for(let[a,u]of o)s.set(u,a);let i=[];for(let[a,u]of o)if(u instanceof z)for(let d of u._deps){let c=s.get(d.node);c!=null&&i.push([c,a])}return i.sort((a,u)=>a[0]<u[0]?-1:a[0]>u[0]?1:a[1]<u[1]?-1:a[1]>u[1]?1:0),i}mount(e,t){if(t===void 0){let o=new n(e);return this.mount(e,o)}if(typeof t=="function"){let o=new n(e);return t(o),this.mount(e,o)}let r=t;if(Ht(e,this.name,"mount"),this._nodes.has(e))throw new Error(`Graph "${this.name}": cannot mount at "${e}" \u2014 node with that name exists`);if(this._mounts.has(e))throw new Error(`Graph "${this.name}": mount "${e}" already exists`);if(r===this)throw new Error(`Graph "${this.name}": cannot mount a graph into itself`);if(r._parent!=null)throw new Error(`Graph "${this.name}": this child graph is already mounted on "${r._parent.name}"`);for(let o=this;o!=null;o=o._parent)if(o===r)throw new Error(`Graph "${this.name}": mount("${e}", \u2026) would create a mount cycle`);return this._mounts.set(e,r),r._parent=this,this._emitTopology({kind:"added",name:e,nodeKind:"mount"}),r}resolve(e){let t=Qr(e,this.name);return this._resolveFromSegments(t)}tryResolve(e){try{return this.resolve(e)}catch{return}}_resolveFromSegments(e){let t=e;if(t[0]===this.name&&(t=t.slice(1),t.length===0))throw new Error(`Graph "${this.name}": resolve path ends at graph name only`);let r=t[0],o=t.slice(1);if(o.length===0){let a=this._nodes.get(r);if(a)return a;throw this._mounts.has(r)?new Error(`Graph "${this.name}": path ends at subgraph "${r}" \u2014 not a node (GRAPHREFLY-SPEC \xA73.5)`):new Error(`Graph "${this.name}": unknown name "${r}"`)}let s=this._nodes.get(r);if(s&&o.length>0&&o[0]===ee)return this._resolveMetaChainFromNode(s,o,t.join(B));let i=this._mounts.get(r);if(!i)throw this._nodes.has(r)?new Error(`Graph "${this.name}": "${r}" is a node; trailing path "${o.join(B)}" is invalid`):new Error(`Graph "${this.name}": unknown mount or node "${r}"`);return i.resolve(o.join(B))}_resolveMetaChainFromNode(e,t,r){let o=e,s=0,i=[...t];for(;s<i.length;){if(i[s]!==ee)throw new Error(`Graph "${this.name}": expected ${ee} segment in meta path "${r}"`);if(s+1>=i.length)throw new Error(`Graph "${this.name}": meta path requires a key after ${ee} in "${r}"`);let a=i[s+1],u=o.meta[a];if(!u)throw new Error(`Graph "${this.name}": unknown meta "${a}" in path "${r}"`);o=u,s+=2}return o}signal(e,t){if(t?.internal!==!0){for(let o of e)if(this.config.messageTier(o[0])===3)throw new Error(`Graph "${this.name}": Graph.signal() rejects tier-3 messages (DATA / RESOLVED). Broadcast is for control-plane tiers (START / DIRTY / INVALIDATE / PAUSE / RESUME / COMPLETE / ERROR / TEARDOWN). For per-node value writes, use Graph.set or graph.node(name).down(...).`)}let r=[];if(this._signalDeliver(e,t??{},new Set,r),r.length>0)throw r[0]}_signalDeliver(e,t,r,o){for(let u of this._mounts.values())u._signalDeliver(e,t,r,o);let i=t.internal===!0?{internal:!0}:{actor:t.actor,delivery:"signal"},a=eo(e,this.config);for(let u of[...this._nodes.keys()].sort()){let d=this._nodes.get(u);if(!r.has(d)){r.add(d);try{d.down(e,i)}catch(c){if(c instanceof Q)throw c;o.push(c)}a.length!==0&&this._signalMetaSubtree(d,a,r,i,o)}}}_signalMetaSubtree(e,t,r,o,s){for(let i of Object.keys(e.meta).sort()){let a=e.meta[i];if(!r.has(a)){r.add(a);try{a.down(t,o)}catch(u){if(u instanceof Q)throw u;s.push(u)}this._signalMetaSubtree(a,t,r,o,s)}}}describe(e){if(e?.reactive==="diff")return this._describeReactiveDiff(e);if(e?.reactive===!0)return this._describeReactive(e);let t=Wr(e?.actor),r=e?.filter;if(e?.detail!=null&&e?.fields!=null)throw new TypeError("Graph.describe(): pass either `detail` or `fields`, not both. `detail: 'spec'` is the canonical spec projection; use `fields` only when you need a custom subset.");let o=$t(e?.detail,e?.fields),s=e?.detail==="spec",i=o,a=[];this._collectObserveTargets("",a);let u=new Map;for(let[w,T]of a)u.set(T,w);let d=[];{let w=a.map(([,R])=>R),T=new Set(u.values()),N=0;for(;w.length>0;){let R=w.shift();if(R instanceof z)for(let S of R._deps){let D=S.node;if(u.has(D))continue;let G=D.name??"",O=G;if(!O||T.has(O))if(G){let P=2;for(;T.has(`${G}#${P}`);)P++;O=`${G}#${P}`}else for(O=`__internal__/${N++}`;T.has(O);)O=`__internal__/${N++}`;u.set(D,O),T.add(O),d.push([O,D]),w.push(D)}}}let c=[...a,...d],p={};for(let[w,T]of c){if(t!=null&&!T.allowsObserve(t))continue;let N=Bt(T,i,s),R=T instanceof z?T._deps.map(O=>u.get(O.node)??O.node.name??""):[],{name:S,...D}=N,G={...D,deps:R};if(!s){let O=this._annotations.get(w);O!=null&&(G.annotation=O)}if(r!=null)if(typeof r=="function"){let O=r;if(!(O.length>=2?O(w,G):O(G)))continue}else{let O=!0;for(let[P,A]of Object.entries(r)){let C=P==="deps_includes"?"depsIncludes":P==="meta_has"?"metaHas":P;if(C==="depsIncludes"){if(!G.deps.includes(String(A))){O=!1;break}continue}if(C==="metaHas"){if(!Object.hasOwn(G.meta??{},String(A))){O=!1;break}continue}if(G[C]!==A){O=!1;break}}if(!O)continue}p[w]=G}let f=new Set(Object.keys(p)),h=[];for(let[w,T]of c)if(T instanceof z)for(let N of T._deps){let R=u.get(N.node);R!=null&&h.push([R,w])}h.sort((w,T)=>w[0]<T[0]?-1:w[0]>T[0]?1:w[1]<T[1]?-1:w[1]>T[1]?1:0);let l=h.map(([w,T])=>({from:w,to:T}));(t!=null||r!=null)&&(l=l.filter(w=>f.has(w.from)&&f.has(w.to)));let g=this._collectSubgraphs(""),m=t!=null||r!=null?g.filter(w=>{let T=`${w}${B}`;return[...f].some(N=>N===w||N.startsWith(T))}):g,v=this,b=e;return{name:this.name,nodes:p,edges:l,subgraphs:m,...this._factory!==void 0?{factory:this._factory}:{},...this._factoryArgs!==void 0?{factoryArgs:this._factoryArgs}:{},expand(w){let T={...b};return Array.isArray(w)?(T.fields=w,T.detail=void 0):(T.detail=w,T.fields=void 0),v.describe(T)}}}_collectSubgraphs(e){let t=[];for(let r of[...this._mounts.keys()].sort()){let o=e===""?r:`${e}${r}`;t.push(o),t.push(...this._mounts.get(r)._collectSubgraphs(`${o}${B}`))}return t}resourceProfile(e){return Vn(this,e)}reachable(e,t,r={}){return r.withDetail===!0?qt(this.describe(),e,t,{...r,withDetail:!0}):qt(this.describe(),e,t,r)}explain(e,t,r){return r?.reactive===!0?this._explainReactive(e,t,r):this._explainStatic(ce(e),ce(t),{...r?.maxDepth!==void 0?{maxDepth:zn(r.maxDepth)}:{},...r?.findCycle!==void 0?{findCycle:Un(r.findCycle)}:{}})}_explainStatic(e,t,r){let o=this.describe({detail:"full"}),s=new Map(this._annotations),i=new Map;for(let[a,u]of Object.entries(o.nodes))u.lastMutation!=null&&i.set(a,u.lastMutation);return Gn(o,e,t,{...r?.maxDepth!=null?{maxDepth:r.maxDepth}:{},...r?.findCycle===!0?{findCycle:!0}:{},annotations:s,lastMutations:i})}_describeReactive(e){let t={...e,reactive:!1},r=e.reactiveName??"describe",o=0,s=me(o,{name:`${r}_version`}),i=this.observe({timeline:!0,structured:!0}),a=!1,u=!1,d=()=>{a||u||(a=!0,Re(()=>{a=!1,!u&&(o+=1,s.emit(o))}))},c=i.onEvent(b=>{let y=b.type;y!=="data"&&y!=="error"&&y!=="complete"&&y!=="teardown"||d()}),p=[],f=new WeakSet,h=b=>{if(f.has(b)||u)return;f.add(b);let y=b.topology.subscribe(w=>{for(let T of w){if(T[0]!==x)continue;let N=T[1];if(d(),N.kind==="added"&&N.nodeKind==="mount"){let R=b._mounts.get(N.name);R!=null&&h(R)}}});p.push(y);for(let w of b._mounts.keys()){let T=b._mounts.get(w);T!=null&&h(T)}};h(this);let l,g=e.actor;qn(g)&&(l=g.subscribe(b=>{let y=!1,w=!1;for(let T of b){let N=T[0];N===x?y=!0:(N===E||N===_||N===V)&&(w=!0)}y&&d(),w&&(l?.(),l=void 0,d())}));let m;try{m=Xe([s],()=>this.describe(t),{name:r,describeKind:"derived",meta:{domain:"audit",kind:"describe"},equals:(b,y)=>b===y})}catch(b){c(),l?.();for(let y of p)y();throw i.dispose(),b}let v=$e(m);return{node:m,dispose(){u=!0,c(),l?.();for(let b of p)b();p.length=0,i.dispose(),v()}}}_describeReactiveDiff(e){let t={...e,reactive:!1},r=e.reactiveName??"describe-diff",o={name:this.name,nodes:{},edges:[],subgraphs:[]},s=this.describe(t),i=jt(o,s),a=me(i,{name:r,meta:{domain:"audit",kind:"describe-diff"},equals:(f,h)=>f===h}),u=this._describeReactive({...e,reactiveName:void 0}),d=!1,c=u.node.subscribe(f=>{if(!d)for(let h of f){if(h[0]!==x)continue;let l=h[1],g=jt(s,l);s=l,g.events.length!==0&&a.emit(g)}}),p=$e(a);return{node:a,dispose(){d=!0,c(),u.dispose(),a.down([[V,"describe-diff disposed"]]),p()}}}_explainReactive(e,t,r){let o=0,s=me(o,{name:"explain_version"}),i=this.observe({timeline:!0,structured:!0}),a=!1,u=!1,d=()=>{a||u||(a=!0,Re(()=>{a=!1,!u&&(o+=1,s.emit(o))}))},c=i.onEvent(b=>{let y=b.type;y!=="data"&&y!=="error"&&y!=="complete"&&y!=="teardown"||d()}),p=[];e!=null&&ye(e)&&p.push(e),t!=null&&ye(t)&&p.push(t),r?.maxDepth!=null&&ye(r.maxDepth)&&p.push(r.maxDepth),r?.findCycle!=null&&ye(r.findCycle)&&p.push(r.findCycle);let f=()=>{for(let b of p)if(b.cache===void 0)return!1;return!0},h=()=>{let b=ce(e),y=ce(t);return{from:b,to:y,found:!1,reason:"pending",steps:[],text:"(awaiting reactive args)",toJSON:()=>({from:b,to:y,found:!1,reason:"pending",steps:[]})}},l;try{l=Xe([s],()=>{if(!f())return h();let b=ce(e),y=ce(t),w={...r?.maxDepth!==void 0?{maxDepth:zn(r.maxDepth)}:{},...r?.findCycle!==void 0?{findCycle:Un(r.findCycle)}:{}};return this._explainStatic(b,y,w)},{name:r?.name??"explain",describeKind:"derived",meta:{domain:"audit",kind:"explain_path",from:ce(e),to:ce(t)},equals:(b,y)=>b.found===y.found&&b.reason===y.reason&&b.steps.length===y.steps.length&&to(b.steps,y.steps)})}catch(b){throw c(),i.dispose(),b}let g=$e(l),m=[],v=b=>{let y;return y=b.subscribe(w=>{let T=!1,N=!1;for(let R of w){let S=R[0];S===x?T=!0:(S===E||S===_||S===V)&&(N=!0)}(T||N)&&d(),N&&y&&(y(),y=void 0)}),()=>{y&&(y(),y=void 0)}};for(let b of p)m.push(v(b));return{node:l,dispose(){u=!0,c();for(let b of m)b?.();m.length=0,i.dispose(),g()}}}_pathsMatching(e){let t=ot(e),r=[];return this._collectObserveTargets("",r),r.map(([o])=>o).filter(o=>t.test(o))}_collectObserveTargets(e,t){for(let r of[...this._mounts.keys()].sort()){let o=e===""?r:`${e}${B}${r}`;this._mounts.get(r)._collectObserveTargets(o,t)}for(let r of[...this._nodes.keys()].sort()){let o=this._nodes.get(r),s=e===""?r:`${e}${B}${r}`;t.push([s,o]),this._appendMetaObserveTargets(s,o,t)}}_appendMetaObserveTargets(e,t,r){for(let o of Object.keys(t.meta).sort()){let s=t.meta[o],i=`${e}${B}${ee}${B}${o}`;r.push([i,s]),this._appendMetaObserveTargets(i,s,r)}}observe(e,t){let r=typeof e=="string",s=Hn(r?t:e);if(s.reactive===!0)return this._observeReactive(r?e:void 0,s);let i=s.structured===!0||s.timeline===!0||s.causal===!0||s.derived===!0||s.detail==="minimal"||s.detail==="full"||s.format!=null,a=s.actor;if(r){let c=e,p=this.resolve(c);if(a!=null&&!p.allowsObserve(a))throw new Q({actor:a,action:"observe",nodeName:c});return i?this._buildStructuredObserver([[c,p]],s,"one"):{subscribe(f){return p.subscribe(f)},up(f){try{p.up?.(f)}catch(h){if(h instanceof Q)return;throw h}}}}let u=[];this._collectObserveTargets("",u),u.sort((c,p)=>c[0]<p[0]?-1:c[0]>p[0]?1:0);let d=a==null?u:u.filter(([,c])=>c.allowsObserve(a));return i?this._buildStructuredObserver(d,s,"all"):{subscribe:c=>{let p=d.map(([f,h])=>h.subscribe(l=>{c(f,l)}));return()=>{for(let f of p)f()}},up:(c,p)=>{try{this.resolve(c).up?.(p)}catch(f){if(f instanceof Q)return;throw f}}}}_observeReactive(e,t){let r=t.tiers,o=r!=null?new Set(r):null,s=t.reactiveName??"observe";return j(i=>{let a=[],u=!1,d=!1,c=()=>{if(a.length===0||d)return;let g={events:a.slice(),flushedAt_ns:K()};a.length=0,i.emit(g)},p={...t,reactive:!1,structured:!0,timeline:!0},f=e!=null?this.observe(e,p):this.observe(p),h=g=>{d||(a.push(g),!u&&(u=!0,Re(()=>{u=!1,c()})))};for(let g of f.events)h(g);let l=f.onEvent(h);return()=>{d=!0,l(),f.dispose()}},{name:s,meta:{domain:"audit",kind:"observe-reactive"}})}_buildStructuredObserver(e,t,r){let o=r==="one"?e[0]?.[0]:void 0,s=i=>{if(r==="one"&&o!=null){let c=this.resolve(o);return this._buildStructuredObserver([[o,c]],i,"one")}let a=[];this._collectObserveTargets("",a),a.sort((c,p)=>c[0]<p[0]?-1:c[0]>p[0]?1:0);let u=i.actor,d=u==null?a:a.filter(([,c])=>c.allowsObserve(u));return this._buildStructuredObserver(d,i,"all")};return this._createObserveResult(e,t,s)}_createObserveResult(e,t,r){let o=t.timeline===!0,s=t.causal===!0,i=t.derived===!0,a=t.detail==="minimal",u=this.config.inspectorEnabled,d=(s||i)&&u,c=t.maxEvents,p=c!=null&&c>0?new ge(c):null,f=[],h=new Set,l=t.tiers!=null?new Set(t.tiers):null,g={},m=new Set,v=0,b=0,y=0,w=0,T=0,N=0,R=!1,S=!1,D=0,G=new Map,O=new Map,P=new Map,A=k=>{if(!(l!=null&&!l.has(k.type))){p?p.push(k):f.push(k);for(let $ of h)$(k)}},C=k=>l==null||l.has(k),Te=()=>o?{timestamp_ns:K(),in_batch:He(),batch_id:D}:{},gt=(k,$)=>{if(!(!d||!(k instanceof z)))return k._setInspectorHook(Z=>{if(Z.kind==="dep_message")G.set(k,Z.depIndex);else if(Z.kind==="run"){let Me=Z.batchData.map((F,q)=>F!=null&&F.length>0?F.at(-1):Z.prevData[q]);O.set(k,Me);let X=Z.batchData.map(F=>F!=null?[...F]:void 0);P.set(k,X),i&&A({type:"derived",path:$,dep_values:Me,dep_batches:X,...Te()})}})},ze=k=>{let $=G.get(k),Z=O.get(k);if(!s||Z==null)return{};let X=($!=null&&$>=0&&k instanceof z?k._deps[$]:void 0)?.node,F=X?.v,q=P.get(k);return{trigger_dep_index:$,trigger_dep_name:X?.name,...F!=null?{trigger_version:{id:F.id,version:F.version}}:{},dep_values:[...Z],...q!=null?{dep_batches:q}:{}}},sn=[],an=[];for(let[k,$]of e){let Z=gt($,k);Z&&sn.push(Z),an.push($.subscribe(Me=>{D++;for(let X of Me){let F=X[0],q=Te();if(F===x){g[k]=X[1];let wt=$ instanceof z?$.lastMutation?.actor??ke:ke;A({type:"data",path:k,data:X[1],actor:wt,...q,...ze($)})}else if(a)F===I?C("dirty")&&v++:F===M?C("resolved")&&b++:F===te?C("invalidate")&&y++:F===Y?C("pause")&&w++:F===ne?C("resume")&&T++:F===V?C("teardown")&&N++:F===E&&!m.has(k)?C("complete")&&(R=!0):F===_&&C("error")&&(S=!0,m.add(k));else if(F===I)C("dirty")&&v++,A({type:"dirty",path:k,...q});else if(F===M)C("resolved")&&b++,A({type:"resolved",path:k,...q,...ze($)});else if(F===te)C("invalidate")&&y++,A({type:"invalidate",path:k,...q});else if(F===Y)C("pause")&&w++,A({type:"pause",path:k,lockId:X[1],...q});else if(F===ne)C("resume")&&T++,A({type:"resume",path:k,lockId:X[1],...q});else if(F===E)C("complete")&&!m.has(k)&&(R=!0),A({type:"complete",path:k,...q});else if(F===_){C("error")&&(S=!0,m.add(k));let wt=$ instanceof z?$.lastMutation?.actor??ke:ke;A({type:"error",path:k,data:X[1],actor:wt,...q})}else F===V&&(C("teardown")&&N++,A({type:"teardown",path:k,...q}))}}))}let bt=!1,yt=()=>{if(!bt){bt=!0;for(let k of an)k();for(let k of sn)k();for(let k of Ue)k({value:void 0,done:!0});Ue.length=0}},vt=[],Ue=[];h.add(k=>{let $=Ue.shift();$?$({value:k,done:!1}):vt.push(k)});let un={get values(){return g},get dirtyCount(){return v},get resolvedCount(){return b},get invalidateCount(){return y},get pauseCount(){return w},get resumeCount(){return T},get teardownCount(){return N},get events(){return p?p.toArray():[...f]},get anyCompletedCleanly(){return R},get anyErrored(){return S},get completedWithoutErrors(){return R&&!S},onEvent(k){return h.add(k),()=>h.delete(k)},dispose:yt,expand(k){yt();let $={...t};return typeof k=="string"?$.detail=k:Object.assign($,k),r(Hn($))},[Symbol.asyncIterator](){return{next(){return vt.length>0?Promise.resolve({value:vt.shift(),done:!1}):bt?Promise.resolve({value:void 0,done:!0}):new Promise(k=>Ue.push(k))},return(){return yt(),Promise.resolve({value:void 0,done:!0})}}}};return t.format!=null&&this._attachFormatLogger(un,t),un}_attachFormatLogger(e,t){let r=t.format;if(r==null)return;let o=t.logger??(l=>console.log(l)),s=t.includeTypes?new Set(t.includeTypes):null,i=t.excludeTypes?new Set(t.excludeTypes):null,a=s==null&&i==null?()=>!0:l=>(s==null||s.has(l))&&(i==null||!i.has(l)),u=Zr(t.theme),d=r==="stage-log"?K():0,c=l=>l==null?"":t.stageLabels?.[l]??l,p=(l,g)=>l.length>g?`${l.slice(0,g-1)}\u2026`:l,f=l=>l.type==="data"||l.type==="error"?p(Wt(l.data),120):"",h=l=>{if(r==="stage-log"){let R=(K()-d)/1e9,S=c(l.path).padEnd(9);if(l.type==="data"){let D=f(l);return`[${R.toFixed(3)}s] ${S} \u2190${D?` ${D}`:""}`}if(l.type==="error"){let D=f(l);return`[${R.toFixed(3)}s] ${S} \u2717${D?` ${D}`:""}`}return l.type==="complete"?`[${R.toFixed(3)}s] ${S} \u25A0 complete`:`[${R.toFixed(3)}s] ${S} ${l.type}`}if(r==="json")try{return JSON.stringify(l)}catch{return JSON.stringify({type:l.type,path:l.path,data:"[unserializable]"})}let g=u[l.type]??"",m=l.path?`${u.path}${l.path}${u.reset} `:"",v=l.type==="data"||l.type==="error",b=l.type==="pause"||l.type==="resume",y=v?` ${Wt(l.data)}`:b?` ${Wt(l.lockId)}`:"",w=l.type==="data"||l.type==="resolved"||l.type==="derived"?l:void 0,T=w?.trigger_dep_name!=null?` <- ${w.trigger_dep_name}`:w?.trigger_dep_index!=null?` <- #${w.trigger_dep_index}`:"",N=l.in_batch?" [batch]":"";return`${m}${g}${l.type.toUpperCase()}${u.reset}${y}${T}${N}`};e.onEvent(l=>{a(l.type)&&o(h(l),l)})}addDisposer(e){return this._disposers.add(e),()=>{this._disposers.delete(e)}}destroy(){rt(this._disposers,this.name),this.signal([[V]],{internal:!0}),rt(this._storageDisposers,this.name);for(let e of[...this._mounts.values()])e._parent=void 0,e._destroyClearOnly();this._mounts.clear(),this._nodes.clear(),this._parent=void 0,this._destroyed=!0}get destroyed(){return this._destroyed}_destroyClearOnly(){rt(this._disposers,this.name),rt(this._storageDisposers,this.name);for(let e of[...this._mounts.values()])e._parent=void 0,e._destroyClearOnly();this._mounts.clear(),this._nodes.clear(),this._parent=void 0,this._destroyed=!0}snapshot(e){let{expand:t,...r}=this.describe({detail:"full"}),o={};for(let a of Object.keys(r.nodes).sort()){let{lastMutation:u,guard:d,...c}=r.nodes[a];o[a]=c}let s=[...r.subgraphs].sort(),i={...r,version:1,nodes:o,subgraphs:s};if(e?.format==null)return i;if(e.format==="json-string")return JSON.stringify(i);if(e.format==="bytes"){if(e.codec==null)throw new Error("snapshot({format: 'bytes'}) requires a `codec` name");let a=this.config.lookupCodec(e.codec);if(a==null)throw new Error(`snapshot: codec "${e.codec}" is not registered on this graph's config. Call config.registerCodec(...) before creating nodes.`);return pn(a,a.encode(i))}throw new Error(`snapshot: unknown format "${String(e.format)}"`)}static decode(e,t){let r=t?.config??Ce,{codec:o,codecVersion:s,payload:i}=hn(e,r);return o.decode(i,s)}restore(e,t){if(Wn(e),e.name!==this.name)throw new Error(`Graph "${this.name}": restore snapshot name "${e.name}" does not match this graph`);let r=t?.only==null?null:(Array.isArray(t.only)?t.only:[t.only]).map(s=>ot(s)),o=t?.includeProducers===!0;for(let s of Object.keys(e.nodes).sort()){if(r!==null&&!r.some(a=>a.test(s)))continue;let i=e.nodes[s];if(i!==void 0){if(!("value"in i)||i.value===void 0){"value"in i&&i.value===void 0&&t?.onError?.(s,new Error(`restore: slice.value is undefined for "${s}" (undefined is the global SENTINEL; not valid DATA)`));continue}if(!(i.type==="derived"||i.type==="effect")&&!(i.type==="producer"&&!o)){if(i.v!=null){let u=this.tryResolve(s)?.v;if(u!=null&&u.id===i.v.id&&u.version===i.v.version)continue}try{this.set(s,i.value)}catch(a){t?.onError?.(s,a)}}}}}static fromSnapshot(e,t){Wn(e);let r=typeof t=="function"?t:t?.build,o=typeof t=="function"?void 0:t?.factories,s=new n(e.name);if(r)return r(s),s.restore(e),s;for(let h of[...e.subgraphs].sort((l,g)=>{let m=l.split(B).length,v=g.split(B).length;return m!==v?m-v:l<g?-1:l>g?1:0})){let l=h.split(B),g=s;for(let m of l)g._mounts.has(m)||g.mount(m,new n(m)),g=g._mounts.get(m)}let i=o?Object.entries(o).map(([h,l])=>({re:ot(h),factory:l})):[],a=h=>{for(let l of i)if(l.re.test(h))return l.factory},u=h=>{let l=h.split(B),g=l.pop();if(g==null||g.length===0)throw new Error(`invalid snapshot path "${h}"`);let m=s;for(let v of l){let b=m._mounts.get(v);if(!b)throw new Error(`unknown mount "${v}" in path "${h}"`);m=b}return[m,g]},d=Object.entries(e.nodes).filter(([h])=>!h.includes(`${B}${ee}${B}`)).sort((h,l)=>h[0]<l[0]?-1:h[0]>l[0]?1:0),c=new Map(d),p=new Map,f=!0;for(;c.size>0&&f;){f=!1;for(let[h,l]of[...c.entries()]){let g=l?.deps??[];if(!g.every(T=>p.has(T)))continue;let[m,v]=u(h),b={...l?.meta??{}},y=a(h),w;if(l?.type==="state")w=me(l.value,{meta:b});else{if(y==null)continue;w=y(v,{path:h,type:l.type,value:l.value,meta:b,deps:g,resolvedDeps:g.map(T=>p.get(T))})}m.add(w,{name:v}),p.set(h,w),c.delete(h),f=!0}}if(c.size>0){let h=[...c.keys()].sort().join(", ");throw new Error(`Graph.fromSnapshot could not reconstruct nodes without build callback: ${h}. Pass matching factories via fromSnapshot(data, { factories: { pattern: factoryFn } }).`)}return s.restore(e),s}toJSON(){return this.snapshot()}attachSnapshotStorage(e,t={}){let r=e.map(d=>({tier:d,debounceMs:Math.max(0,d.debounceMs??0),compactEvery:Math.max(1,d.compactEvery??10),timer:void 0,seq:0,lastSnapshot:void 0,lastFingerprint:"",disposed:!1,savePending:void 0}));t.autoRestore===!0&&this._cascadeRestore(e,t.onError);let o=(d,c)=>{if(d.disposed)return;let p=Hr(c.nodes);if(d.lastSnapshot!=null&&p!==""&&p===d.lastFingerprint)return;let f=d.seq+1,h=_e(),m=d.lastSnapshot==null||f%d.compactEvery===0?{name:this.name,mode:"full",snapshot:c,seq:f,timestamp_ns:h,format_version:be}:{name:this.name,mode:"diff",diff:Yn(d.lastSnapshot,c),seq:f,timestamp_ns:h,format_version:be};if(d.tier.filter&&!d.tier.filter(m))return;let v;try{v=d.tier.save(m)}catch(b){t.onError?.(b,d.tier);return}if(v&&typeof v.then=="function"){let w=(d.savePending??Promise.resolve()).then(()=>v,()=>v).then(()=>{d.disposed||(d.seq=f,d.lastSnapshot=c,d.lastFingerprint=p)},T=>{t.onError?.(T,d.tier)});d.savePending=w.finally(()=>{d.savePending===w&&(d.savePending=void 0)})}else d.seq=f,d.lastSnapshot=c,d.lastFingerprint=p},s=(d,c)=>{try{o(d,c)}catch(p){t.onError?.(p,d.tier)}},i=(d,c)=>{if(!c.some(l=>{let g=this.config.messageTier(l[0]);return g>=3&&g<5}))return;if(t.filter){let l=this.tryResolve(d);if(l==null)return;let g=Bt(l,$t("standard"));if(!t.filter(d,g))return}let f,h=()=>(f==null&&(f=this.snapshot()),f);for(let l of r)l.disposed||(l.debounceMs===0?s(l,h()):(l.timer==null&&(l.timer=new de),l.timer.start(l.debounceMs,()=>{l.disposed||s(l,this.snapshot())})))},a;if(t.paths!=null){let c=(typeof t.paths=="string"?this._pathsMatching(t.paths):t.paths).map(p=>{let f=this.tryResolve(p);return f==null?()=>{}:f.subscribe(h=>i(p,h))});a=()=>{for(let p of c)p()}}else a=this.observe().subscribe((d,c)=>i(d,c));let u=()=>{a();for(let d of r)d.disposed=!0,d.timer?.cancel();this._storageDisposers.delete(u)};return this._storageDisposers.add(u),{dispose:u}}async _cascadeRestore(e,t){for(let r of e){let o;try{o=await r.load?.()}catch(i){t?.(i,r);continue}if(o==null||typeof o!="object"||Array.isArray(o))continue;let s=o;try{if(s.mode==="full"&&s.snapshot!=null)return this.restore(s.snapshot),!0;if(s.version===be&&s.nodes!=null)return this.restore(s),!0}catch(i){t?.(i,r)}}return!1}static async fromStorage(e,t,r){for(let o of t){let s;try{s=await o.load?.()}catch(u){r?.onError?.(u,o);continue}if(s==null||typeof s!="object"||Array.isArray(s))continue;let i=s,a=i.mode==="full"&&i.snapshot!=null?i.snapshot:i.version===be&&i.nodes!=null?i:void 0;if(a!=null)try{return n.fromSnapshot(a,r)}catch(u){r?.onError?.(u,o)}}throw new Error(`Graph.fromStorage: no tier held a restorable record for "${e}" across ${t.length} tier(s)`)}_annotations=new Map;_traceRing;trace(e,t,r){if(e!=null&&t!=null){if(this.tryResolve(e)==null)return;if(this._annotations.set(e,t),this.config.inspectorEnabled){let o={path:e,annotation:t,timestamp_ns:K(),...r?.actor!=null?{actor:r.actor}:{}};this._traceRing.push(o)}return}return e!=null?this.config.inspectorEnabled?this._annotations.get(e):void 0:this.config.inspectorEnabled?this._traceRing.toArray():[]}annotation(e){return this._annotations.get(e)}clearTrace(){this._annotations.clear(),this._traceRing.clear()}pruneTrace(e){let t=this._traceRing.toArray().filter(o=>!e(o)),r=this._traceRing.size-t.length;this._traceRing.clear();for(let o of t)this._traceRing.push(o);return r}static diff(e,t){let r=new Set(Object.keys(e.nodes)),o=new Set(Object.keys(t.nodes)),s=[...o].filter(b=>!r.has(b)).sort(),i=[...r].filter(b=>!o.has(b)).sort(),a=[],u=[];for(let b of r){if(!o.has(b))continue;let y=e.nodes[b],w=t.nodes[b],T=y.v,N=w.v;T!=null&&N!=null&&T.id===N.id&&T.version!==N.version&&u.push({path:b,id:T.id,from:T.version,to:N.version});let R=T!=null&&N!=null&&T.id===N.id&&T.version===N.version;for(let S of["type","status","sentinel"]){let D=y[S],G=w[S];D!==G&&a.push({path:b,field:S,from:D,to:G})}if(!R)for(let S of["value","meta"]){let D=y[S],G=w[S];qr(D,G)||a.push({path:b,field:S,from:D,to:G})}}let d=b=>`${b.from} ${b.to}`,c=new Set(e.edges.map(d)),p=new Set(t.edges.map(d)),f=t.edges.filter(b=>!c.has(d(b))),h=e.edges.filter(b=>!p.has(d(b))),l=new Set(e.subgraphs),g=new Set(t.subgraphs),m=[...g].filter(b=>!l.has(b)).sort(),v=[...l].filter(b=>!g.has(b)).sort();return{nodesAdded:s,nodesRemoved:i,nodesChanged:a,versionChanges:u,edgesAdded:f,edgesRemoved:h,subgraphsAdded:m,subgraphsRemoved:v}}}});var Zn=L(()=>{"use strict";Jn()});var rr={};_t(rr,{NS_PER_MS:()=>fe,NS_PER_SEC:()=>se,constant:()=>Xn,decorrelatedJitter:()=>nr,exponential:()=>er,fibonacci:()=>tr,linear:()=>Qn,resolveBackoffPreset:()=>Kt,withMaxAttempts:()=>oo});function ve(n){return n<0?0:n}function no(n,e){return e==="none"?n:e==="full"?Math.random()*n:n/2+Math.random()*(n/2)}function ro(n,e){return n+Math.random()*(e-n)}function Xn(n){let e=ve(n);return()=>e}function Qn(n,e){let t=ve(n),r=e===void 0?t:ve(e);return o=>t+r*Math.max(0,o)}function er(n){let e=ve(n?.baseNs??1e8),t=n?.factor!==void 0&&n.factor<1?1:n?.factor??2,r=ve(n?.maxDelayNs??30*1e9),o=n?.jitter??"none";return s=>{let i;if(e===0)i=0;else if(t===1)i=e;else{let a=r/e,u=1;for(let d=0;d<Math.max(0,s);d++){if(u>=a){u=a;break}u*=t}i=e*u,i>r&&(i=r)}return no(i,o)}}function tr(n=100*1e6,e=30*1e9){let t=ve(n),r=ve(e);function o(s){if(s<=0)return 1;let i=1,a=2;for(let u=1;u<s;u++){let d=i+a;i=a,a=d}return a}return s=>{let i=o(s)*t;return i<=r?i:r}}function nr(n=100*1e6,e=30*1e9){return(t,r,o)=>{let i=Math.min(e,(o??n)*3);return ro(n,i)}}function oo(n,e){return(t,r,o)=>t>=e?null:n(t,r,o)}function Kt(n){if(n==="constant")return Xn(1*1e9);if(n==="linear")return Qn(1*1e9);if(n==="exponential")return er();if(n==="fibonacci")return tr();if(n==="decorrelatedJitter")return nr();throw new Error(`Unknown backoff preset: "${String(n)}". Use one of: constant, linear, exponential, fibonacci, decorrelatedJitter`)}var fe,se,Yt=L(()=>{"use strict";fe=1e6,se=1e9});function so(n){return{describeKind:"derived",...n}}function io(n,e,t){let r,o=!1,s=()=>{o||(o=!0,t())};return r=n.subscribe(i=>{let a=!1,u=!1;for(let d of i)d[0]!==ie&&(d[0]===x?e.emit(d[1]):d[0]===E?a=!0:d[0]===_?(u=!0,e.down([d])):(d[0]===I||d[0]===M)&&e.down([d]));u?(r?.(),r=void 0,s()):a&&s()}),()=>{r?.(),r=void 0}}function De(n,e,t){let r,o=!1;function s(){r?.(),r=void 0}return W([n],(i,a,u)=>{if(u.terminalDeps[0]!=null&&u.terminalDeps[0]!==!0){s();return}if(u.terminalDeps[0]===!0){o=!0,r||a.down([[E]]);return}let d=i[0];if(!(d==null||d.length===0))return s(),r=io(le(e(d[d.length-1])),a,()=>{s(),o&&a.down([[E]])}),{deactivate:()=>{s(),o=!1}}},{...so(t),completeWhenDepsComplete:!1,meta:{...oe("switchMap"),...t?.meta??{}}})}var or=L(()=>{"use strict";ue();Fe();ae();st()});var sr=L(()=>{"use strict";or()});function Be(n){return typeof n=="object"&&n!==null&&"subscribe"in n&&"down"in n}function ir(n){if(n<=0)throw new RangeError("timeoutMs must be > 0");if(n>9e6)throw new RangeError("timeoutMs must be <= 9_000_000 (\u22482.5h) to stay within safe ns arithmetic")}function ar(n,e={}){let t=new Ve(n,e);return t.tagFactory("resilientPipeline",Cn(e)),t}var Ve,ur=L(()=>{"use strict";Fe();Zn();It();sr();Xt();Ve=class extends Ae{output;status;lastError;breakerState;droppedCount;rateLimitState;constructor(e,t={}){super(t.name??"resilient_pipeline",t.graph);let r=e,o,s,i;if(t.rateLimit!=null)if(Be(t.rateLimit)){let u=r,d=t.rateLimit;r=De(d,c=>{let p={...c,maxBuffer:c.maxBuffer??1/0,meta:H("resilient","rate-limit")};return dt(u,p).node}),this.add(r,{name:"rateLimited"})}else{let u={...t.rateLimit,maxBuffer:t.rateLimit.maxBuffer??1/0,meta:H("resilient","rate-limit")},d=dt(r,u);r=d.node,o=d.droppedCount,s=d.rateLimitState,this.add(r,{name:"rateLimited"}),this.add(o,{name:"droppedCount"}),this.add(s,{name:"rateLimitState"})}if(t.budget!=null)if(Be(t.budget)){let u=r,d=t.budget;r=De(d,c=>c.length>0?Le(u,c,{meta:H("resilient","budget")}):u),this.add(r,{name:"budgetGated"})}else t.budget.length>0&&(r=Le(r,t.budget,{meta:H("resilient","budget")}),this.add(r,{name:"budgetGated"}));if(t.breaker!=null)if(Be(t.breaker)){let u=r,d=t.breaker,c=t.breakerOnOpen??"skip";r=De(d,p=>{let f=at(p);return ut(f,{onOpen:c,meta:H("resilient","breaker")})(u).node}),this.add(r,{name:"breakerWrapped"})}else{let u=at(t.breaker),d=t.breakerOnOpen??"skip",c=ut(u,{onOpen:d,meta:H("resilient","breaker")})(r);r=c.node,i=c.breakerState,this.add(r,{name:"breakerWrapped"}),this.add(i,{name:"breakerState"})}if(t.timeoutMs!=null)if(Be(t.timeoutMs)){let u=r,d=t.timeoutMs;r=De(d,c=>(ir(c),ct(u,c*1e6,{meta:H("resilient","timeout")}))),this.add(r,{name:"timeoutWrapped"})}else ir(t.timeoutMs),r=ct(r,t.timeoutMs*1e6,{meta:H("resilient","timeout")}),this.add(r,{name:"timeoutWrapped"});if(t.retry!=null)if(Be(t.retry)){let u=r,d=t.retry;r=De(d,c=>it(u,{...c,meta:H("resilient","retry")})),this.add(r,{name:"retryWrapped"})}else r=it(r,{...t.retry,meta:H("resilient","retry")}),this.add(r,{name:"retryWrapped"});t.fallback!==void 0&&(r=Zt(r,t.fallback,{meta:H("resilient","fallback")}),this.add(r,{name:"fallbackWrapped"}));let a=Jt(r,{initialStatus:t.initialStatus??"pending",meta:H("resilient","status")});this.output=a.node,this.status=a.status,this.lastError=a.error,this.breakerState=i,this.droppedCount=o,this.rateLimitState=s,this.add(this.output,{name:"output"}),this.add(this.status,{name:"status"}),this.add(this.lastError,{name:"lastError"})}}});function we(n){return{describeKind:"derived",...n}}function ao(n){return n<0?0:n}function en(n){return n[1]}function uo(n){if(typeof n!="number"||!Number.isFinite(n))throw new TypeError("backoff strategy must return a finite number");return n<0?0:n}function ft(n){let e=n?.count,t=n?.backoff;if(t!==void 0&&e===void 0)throw new RangeError("retry({ backoff }) requires explicit count to prevent unbounded retries; pass { count: <n>, backoff: ... }");let r=e!==void 0?e:0;if(r<0)throw new RangeError("retry count must be >= 0");let o=t===void 0?null:typeof t=="string"?Kt(t):t;return{maxRetries:r,strategy:o}}function cr(n){let e={};return n?.count!==void 0&&(e.count=n.count),typeof n?.backoff=="string"&&(e.backoff=n.backoff),Object.keys(e).length>0?e:void 0}function lr(n,e,t){let r=0,o=!1,s=null,i,a=new de;function u(){i?.(),i=void 0}function d(p){if(o)return;let f=n();if(r>=f.maxRetries){u(),t.down([[_,p]]);return}let h=f.strategy===null?0:f.strategy(r,p,s);if(h==null){u(),t.down([[_,p]]);return}let l;try{l=uo(h)}catch{u(),t.down([[_,p]]);return}s=l,r+=1,u();let g=l>0?l/1e6:1;a.start(g,()=>{o||c()})}function c(){a.cancel(),u();let p;try{p=e()}catch(f){d(f);return}i=p.subscribe(f=>{if(!o)for(let h of f){let l=h[0];if(l===I)t.down([[I]]);else if(l===x)r=0,s=null,t.emit(h[1]);else if(l===M)t.down([[M]]);else if(l===E)o=!0,u(),t.down([[E]]);else if(l===_){d(en(h));return}else t.down([h])}})}return c(),()=>{o=!0,a.cancel(),u()}}function it(n,e){return typeof n=="function"?lo(n,e):co(n,e)}function co(n,e){n._resubscribable===!1&&!dr.has(n)&&(dr.add(n),console.warn("retry(source, opts): source-mode requires `resubscribable: true` on the upstream node. Retries will be silent no-ops after the first ERROR. Either pass `resubscribable: true` to the source factory, OR use factory-mode retry `retry(() => buildSource(), opts)` so each attempt builds a fresh node."));let r=re(e)?void 0:e;return re(e)||ft(r),j(o=>{let s=je(e),a=lr(()=>ft(s.current()),()=>n,o);return()=>{a(),s.unsub()}},{...we(),initial:n.cache,meta:{...r?.meta??{},...oe("retry",re(e)?{reactiveOpts:!0}:cr(r))}})}function lo(n,e){let t=re(e)?void 0:e;return re(e)||ft(t),j(r=>{let o=je(e),i=lr(()=>ft(o.current()),n,r);return()=>{i(),o.unsub()}},{...we(),initial:t?.initial,meta:{...t?.meta??{},...oe("retry",re(e)?{reactiveOpts:!0}:cr(t))}})}function at(n){let e=5,t=30*1e9,r=null,o=1,s=K;function i(v){e=Math.max(1,v?.failureThreshold??5),t=ao(v?.cooldownNs??30*1e9),r=v?.cooldown??null,o=Math.max(1,v?.halfOpenMax??1),s=v?.now??K}let a="closed",u=0,d=0,c=0,p=t,f=0,h=je(n,v=>{i(v),a="closed",u=0,d=0,f=0,p=t});i(h.current()),p=t;function l(){if(!r)return t;let v=r(d);return v!==null?v:t}function g(){a="open",p=l(),c=s(),f=0}return{canExecute(){return a==="closed"?!0:a==="open"?s()-c>=p?(a="half-open",f=1,!0):!1:f<o?(f++,!0):!1},recordSuccess(){a==="half-open"?(a="closed",u=0,d=0):a==="closed"&&(u=0)},recordFailure(v){if(a==="half-open"){d++,g();return}a==="closed"&&(u++,u>=e&&g())},get state(){return a},get failureCount(){return u},reset(){a="closed",u=0,d=0,f=0},dispose(){h.unsub()}}}function ut(n,e){let t=e?.onOpen??"skip",r=e?.meta;return o=>{let s=W([],(i,a)=>{function u(){s.meta.breakerState.down([[x,n.state]])}let d=o.subscribe(c=>{for(let p of c){let f=p[0];f===I?a.down([[I]]):f===x?n.canExecute()?(u(),a.emit(p[1])):(u(),t==="error"?a.down([[_,new pt]]):a.down([[M]])):f===M?a.down([[M]]):f===E?(n.recordSuccess(),u(),a.down([[E]])):f===_?(n.recordFailure(en(p)),u(),a.down([p])):a.down([p])}});return u(),d},{...we(),meta:{...r??{},breakerState:n.state,...oe("withBreaker",{onOpen:t})},completeWhenDepsComplete:!1,initial:o.cache});return{node:s,breakerState:s.meta.breakerState}}}function Qt(n,e,t){if(n<=0)throw new RangeError("capacity must be > 0");if(e<0)throw new RangeError("refillPerSecond must be >= 0");let r=t?.clock??K,o=n,s=r();function i(a){if(e>0){let u=a-s;o=Math.min(n,o+u/1e9*e)}s=a}return{available(){return i(r()),o},tryConsume(a=1){if(a<=0)return!0;let u=r();return i(u),o>=a?(o-=a,!0):!1},putBack(a=1){a<=0||(i(r()),o=Math.min(n,o+a))}}}function fo(n,e){return n.droppedCount===e.droppedCount&&n.pendingCount===e.pendingCount&&n.paused===e.paused}function dt(n,e){let t=re(e);if(!t){let a=e;if(a.maxEvents<=0)throw new RangeError("maxEvents must be > 0");if(a.windowNs<=0)throw new RangeError("windowNs must be > 0");if(a.maxBuffer===void 0)throw new RangeError("rateLimiter requires explicit maxBuffer (use Infinity to opt in to unbounded)");if(!(a.maxBuffer===1/0)&&(!Number.isInteger(a.maxBuffer)||a.maxBuffer<1))throw new RangeError("maxBuffer must be a positive integer (or Infinity for unbounded)")}let r=t?e.cache:e,o=r?.maxBuffer,s=o===1/0,i=j(a=>{let u=r?.maxEvents??1,d=r?.windowNs??1e9,c=o??1,p=r?.onOverflow??"drop-newest",f=u*1e9/d,h=1e9/f,l=Qt(u,f),g=s?ho():po(Math.max(1,c)),m=new de,v=!1,b=0,y=i.meta.droppedCount,w=i.meta.rateLimitState,T=lt;function N(){y.emit(b);let P={droppedCount:b,pendingCount:g.size,paused:g.size>0};fo(T,P)||(T=P,w.emit(P))}T=lt,y.emit(0),w.emit(lt);let R=je(e,P=>{if(v||P==null||!(P.maxEvents>0)||!(P.windowNs>0))return;let A=P.maxBuffer;if(A===void 0)return;let C=A===1/0;if(C===s&&!(!C&&(!Number.isInteger(A)||A<1))){if(!C&&A>c){console.warn(`rateLimiter: reactive maxBuffer grow (${c} \u2192 ${A}) rejected. The pending ring buffer is allocated at construction; reactive maxBuffer is monotonically non-increasing. Recreate the rateLimiter with the larger cap if growth is required.`);return}if(u=P.maxEvents,d=P.windowNs,c=A,p=P.onOverflow??"drop-newest",f=u*1e9/d,h=1e9/f,l=Qt(u,f),!C)for(;g.size>c;)g.shift(),b+=1;N()}});function S(){for(;g.size>0;)if(l.tryConsume(1))a.emit(g.shift()),N();else{m.start(Math.max(1,h/1e6),S);return}}function D(){b+=1,N()}function G(){for(v=!0,m.cancel();g.size>0;)g.shift();b=0}let O=n.subscribe(P=>{for(let A of P){if(v)return;let C=A[0];if(C===I)a.down([[I]]);else if(C===x){if(!s&&g.size>=c)if(p==="drop-newest")D();else if(p==="drop-oldest")g.shift(),g.push(A[1]),D();else{D(),G(),a.down([[_,new ht(c)]]);return}else g.push(A[1]),N();S()}else if(C===M)a.down([[M]]);else if(C===E)G(),a.down([[E]]);else if(C===_)G(),a.down([A]);else if(C===V){G(),a.down([A]);return}else a.down([A])}});return()=>{v=!0,m.cancel(),O(),R.unsub()}},{...we(),initial:n.cache,meta:{...t?{}:e.meta??{},droppedCount:0,rateLimitState:lt,...oe("rateLimiter",t?{reactiveOpts:!0}:e)}});return{node:i,droppedCount:i.meta.droppedCount,rateLimitState:i.meta.rateLimitState}}function po(n){let e=new ge(n);return{push:t=>e.push(t),shift:()=>e.shift(),get size(){return e.size}}}function ho(){let n=[];return{push:e=>{n.push(e)},shift:()=>n.shift(),get size(){return n.length}}}function Jt(n,e){let t=e?.initialStatus??"pending",r=e?.meta,o=W([],(s,i)=>{let a=t;return o.meta.status.down([[x,t]]),o.meta.error.down([[x,null]]),n.subscribe(d=>{for(let c of d){let p=c[0];if(p===I)i.down([[I]]);else if(p===x)a==="errored"?Se(()=>{o.meta.error.down([[x,null]]),o.meta.status.down([[x,"running"]])}):o.meta.status.down([[x,"running"]]),a="running",i.emit(c[1]);else if(p===M)i.down([[M]]);else if(p===E)o.meta.status.down([[x,"completed"]]),a="completed",i.down([[E]]);else if(p===_){let f=en(c);Se(()=>{o.meta.error.down([[x,f]]),o.meta.status.down([[x,"errored"]])}),a="errored",i.down([c])}else i.down([c])}})},{...we(),meta:{...r??{},status:t,error:null,...oe("withStatus",{initialStatus:t})},completeWhenDepsComplete:!1,resubscribable:!0,initial:n.cache});return{node:o,status:o.meta.status,error:o.meta.error}}function re(n){return n!=null&&typeof n=="object"&&"cache"in n&&typeof n.subscribe=="function"}function je(n,e){if(!re(n))return{current:()=>n,unsub:()=>{}};let t=n,r=t.cache,o=t.subscribe(s=>{for(let i of s)i[0]===x&&(r=i[1],e&&e(r))});return{current:()=>r,unsub:o}}function mo(n){return n!=null&&typeof n.then=="function"}function go(n){return n!=null&&typeof n=="object"&&typeof n[Symbol.asyncIterator]=="function"}function Zt(n,e,t){let r=t?.meta;return j(o=>{let s,i;function a(){i?.(),i=void 0,re(e)||mo(e)||go(e)?s=le(e).subscribe(d=>{o.down(d);for(let c of d){let p=c[0];if(p===E||p===_||p===V){s=void 0;return}}}):(o.emit(e),o.down([[E]]))}return i=n.subscribe(u=>{for(let d of u){let c=d[0];if(c===I)o.down([[I]]);else if(c===x)o.emit(d[1]);else if(c===M)o.down([[M]]);else if(c===E)o.down([[E]]);else if(c===_){a();return}else if(c===V){s?.(),o.down([d]);return}else o.down([d])}}),()=>{i?.(),s?.()}},{...we(),initial:n.cache,meta:{...r??{},...oe("fallback")}})}function ct(n,e,t){if(!re(e)&&e<=0)throw new RangeError("timeoutNs must be > 0");let r=t?.meta,o=re(e)?{timeoutNs:"Node<number>"}:{timeoutNs:e};return j(s=>{let i=!1,a=new de,u=je(e),d=()=>{let f=u.current();return typeof f=="number"&&f>0?f:0};function c(){let f=d();if(f<=0)return;let h=f/1e6;a.start(h,()=>{i||(i=!0,p(),s.down([[_,new mt(f)]]))})}let p=n.subscribe(f=>{for(let h of f){if(i)return;let l=h[0];if(l===I)s.down([[I]]);else if(l===x)c(),s.emit(h[1]);else if(l===M)s.down([[M]]);else if(l===E){a.cancel(),i=!0,s.down([[E]]);return}else if(l===_){a.cancel(),i=!0,s.down([h]);return}else if(l===V){a.cancel(),i=!0,s.down([h]);return}else s.down([h])}});return c(),()=>{i=!0,a.cancel(),p(),u.unsub()}},{...we(),initial:n.cache,meta:{...r??{},...oe("timeout",o)}})}var dr,pt,ht,lt,mt,Xt=L(()=>{"use strict";Sn();ur();Ke();Ne();ue();Fe();ae();Qe();Yt();st();zt();Ut();dr=new WeakSet;pt=class extends Error{name="CircuitOpenError";constructor(){super("Circuit breaker is open")}};ht=class extends Error{name="RateLimiterOverflowError";constructor(e){super(`rateLimiter buffer overflow (maxBuffer=${e})`)}};lt=Object.freeze({droppedCount:0,pendingCount:0,paused:!1});mt=class extends Error{name="TimeoutError";constructor(e){super(`Timed out after ${e/1e6}ms`)}}});var fr={};_t(fr,{CircuitOpenError:()=>pt,RateLimiterOverflowError:()=>ht,ResilientPipelineGraph:()=>Ve,TimeoutError:()=>mt,budgetGate:()=>Le,circuitBreaker:()=>at,fallback:()=>Zt,rateLimiter:()=>dt,resilientPipeline:()=>ar,retry:()=>it,timeout:()=>ct,tokenBucket:()=>Qt,withBreaker:()=>ut,withStatus:()=>Jt});var pr=L(()=>{"use strict";Xt()});function J(n){return{describeKind:"producer",...n}}function mr(n){return/[\\^$+?.()|[\]{}]/.test(n)?`\\${n}`:n}function bo(n){let e="^";for(let t=0;t<n.length;t+=1){let r=n[t];if(r==="*"){n[t+1]==="*"?(e+=".*",t+=1):e+="[^/]*";continue}e+=mr(r)}return e+="$",new RegExp(e)}function yo(n,e){for(let t of e)if(t.test(n))return!0;return!1}function vo(n,e){let t=W([n],(o,s)=>{let i=o[0];if(i==null||i.length===0){s.down([[M]]);return}for(let a of i)s.emit(a)},{describeKind:"derived",initial:n.cache}),r=t.subscribe.bind(t);return t.subscribe=(o,s)=>(e(o),r(o,s)),t}function wo(n,e){let{signal:t,period:r,...o}=e??{};return j(s=>{let i=!1,a=0,u,d,c=()=>{i=!0,u!==void 0&&clearTimeout(u),d!==void 0&&clearInterval(d),t?.removeEventListener("abort",f)},p=()=>{i||(r!=null?(s.emit(a++),d=setInterval(()=>{i||s.emit(a++)},r)):(i=!0,t?.removeEventListener("abort",f),s.emit(a++),s.down([[E]])))},f=()=>{i||(c(),s.down([[_,t.reason]]))};if(t?.aborted){f();return}return u=setTimeout(p,n),t?.addEventListener("abort",f,{once:!0}),c},J(o))}function To(n){let{signal:e,...t}=n??{};return j(r=>{let o=!1,s,i,a=!1,u=!1,d=typeof requestAnimationFrame=="function"?requestAnimationFrame:void 0,c=typeof cancelAnimationFrame=="function"?cancelAnimationFrame:void 0,p=typeof document<"u"?document:void 0,f=()=>{s!==void 0&&c&&c(s),i!==void 0&&clearTimeout(i),s=void 0,i=void 0},h=()=>{o=!0,f(),a&&(e?.removeEventListener("abort",l),a=!1),u&&p&&(p.removeEventListener("visibilitychange",v),u=!1)},l=()=>{o||(h(),r.down([[_,e.reason]]))},g=b=>{o||(r.emit(b),m())},m=()=>{o||(d&&(!p||p.visibilityState!=="hidden")?s=d(g):i=setTimeout(()=>g(performance.now()),16))},v=()=>{o||(f(),m())};return e?.aborted?(l(),h):(e?.addEventListener("abort",l,{once:!0}),a=e!==void 0,p&&d&&(p.addEventListener("visibilitychange",v),u=!0),m(),h)},J(t))}function _o(n,e){let t=xn(n),{tickMs:r,output:o,...s}=e??{},i=r??6e4,a=o==="date";return j(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&&En(t,f)&&(d=h,u.emit(a?f:_e()))};c();let p=setInterval(c,i);return()=>clearInterval(p)},{...J(s),name:s.name??`cron:${n}`})}function No(n,e,t){let{capture:r,passive:o,once:s,...i}=t??{};return j(a=>{let u=c=>{a.emit(c)},d={capture:r,passive:o,once:s};return n.addEventListener(e,u,d),()=>n.removeEventListener(e,u,d)},J(i))}function rn(n,e){return j(t=>{let r=!1;try{for(let o of n){if(r)return;t.emit(o)}r||t.down([[E]])}catch(o){r||t.down([[_,o]])}return()=>{r=!0}},J(e))}function Oo(n){return n!=null&&typeof n.then=="function"}function gr(n,e){let{signal:t,...r}=e??{};return j(o=>{let s=!1,i=()=>{s||(s=!0,o.down([[_,t.reason]]))};if(t?.aborted){i();return}return t?.addEventListener("abort",i,{once:!0}),Promise.resolve(n).then(a=>{s||(s=!0,t?.removeEventListener("abort",i),o.emit(a),o.down([[E]]))},a=>{s||(s=!0,t?.removeEventListener("abort",i),o.down([[_,a]]))}),()=>{s=!0,t?.removeEventListener("abort",i)}},J(r))}function br(n,e){let{signal:t,...r}=e??{};return j(o=>{let s=new AbortController,i=()=>s.abort(t?.reason);t?.aborted?s.abort(t.reason):t?.addEventListener("abort",i,{once:!0});let a=t??s.signal,u=!1,d=n[Symbol.asyncIterator](),c=()=>{u||a.aborted||Promise.resolve(d.next()).then(p=>{if(!(u||a.aborted)){if(p.done){o.down([[E]]);return}o.emit(p.value),c()}},p=>{!u&&!a.aborted&&o.down([[_,p]])})};return c(),()=>{u=!0,t?.removeEventListener("abort",i),s.abort(),Promise.resolve(d.return?.()).catch(()=>{})}},J(r))}function ko(n){return n!=null&&typeof n=="object"&&"cache"in n&&typeof n.subscribe=="function"}function le(n,e){if(ko(n))return n;if(Oo(n))return gr(n,e);if(n!=null){let t=n;if(typeof t[Symbol.asyncIterator]=="function")return br(n,e);if(typeof t[Symbol.iterator]=="function")return rn(n,e)}return yr(n)}function yr(...n){return rn(n,void 0)}function xo(n){return j(e=>{e.down([[E]])},J(n))}function Eo(n){return j(()=>{},J(n))}function Ro(n,e){return j(t=>{t.down([[_,n]])},J(e))}function So(n,e){let{signal:t,...r}=e??{},o=J(r),s=o.resubscribable===void 0?{...o,resubscribable:!0}:o;return j(i=>{let a,u=!1;try{let d=n();a=le(d,e).subscribe(p=>{if(!u)for(let f of p){let h=f[0];if(h!==ie)if(h===x)i.emit(f[1]);else if(h===E){u=!0,i.down([[E]]);break}else if(h===_){u=!0,i.down([[_,f[1]]]);break}else i.down([f])}})}catch(d){let c=d===void 0?new Error("defer: thunk threw undefined"):d;i.down([[_,c]])}return()=>{u=!0,a?.()}},s)}function Co(n,e,t){return W([n],(o,s)=>{let i=o[0];if(i!=null&&i.length>0)for(let a of i)e(a)},{describeKind:"effect",...t}).subscribe(()=>{})}function Ao(n,e){return W([n],(t,r,o)=>{o.store.buf||(o.store.buf=[]);let s=o.store.buf,i=t[0];if(i!=null&&i.length>0)for(let a of i)s.push(a);if(o.terminalDeps[0]===!0){r.emit([...s]),r.down([[E]]);return}(i==null||i.length===0)&&r.down([[M]])},{describeKind:"derived",completeWhenDepsComplete:!1,...e})}function Do(n,e){return j(t=>n.subscribe(r=>{t.down(r)}),{...J(e),initial:n.cache})}function on(n,e,t){if(e<1)throw new RangeError("replay expects bufferSize >= 1");let r=[],o=j(s=>n.subscribe(i=>{for(let a of i)a[0]===x&&(r.push(a[1]),r.length>e&&r.shift());s.down(i)}),{...J(t),initial:n.cache});return vo(o,s=>{for(let i of r)s([[x,i]])})}function Mo(n,e){return on(n,1,e)}function Go(n){return new Promise((e,t)=>{let r=!1,o=!1,s;s=n.subscribe(i=>{for(let a of i){if(r)return;if(a[0]===x){r=!0,e(a[1]),s?(s(),s=void 0):o=!0;return}if(a[0]===_){r=!0,t(a[1]),s?(s(),s=void 0):o=!0;return}if(a[0]===E){r=!0,t(new Error("completed without DATA")),s?(s(),s=void 0):o=!0;return}}}),o&&(s?.(),s=void 0)})}function nn(n,e,t){return new Promise((r,o)=>{let s=!1,i=!1,a,u=t?.skipCurrent===!0;a=n.subscribe(d=>{for(let c of d){if(s)return;if(!(u&&c[0]===x)){if(c[0]===x){let p=c[1];if(e(p)){s=!0,r(p),a?(a(),a=void 0):i=!0;return}}if(c[0]===_){s=!0,o(c[1]),a?(a(),a=void 0):i=!0;return}if(c[0]===E){s=!0,o(new Error("completed without matching value")),a?(a(),a=void 0):i=!0;return}}}}),u=!1,i&&(a?.(),a=void 0)})}async function Po(n,e){let t=e?.predicate??(s=>s!=null),r=e?.skipCurrent;if(e?.timeoutMs==null||e.timeoutMs<=0)return await nn(n,t,{skipCurrent:r});if(tn===void 0){let[s,i]=await Promise.all([Promise.resolve().then(()=>(pr(),fr)),Promise.resolve().then(()=>(Yt(),rr))]);tn=s.timeout,hr=i.NS_PER_MS}let o=tn(n,e.timeoutMs*hr);return await nn(o,t,{skipCurrent:r})}function Io(n,e){let t=new AbortController,r=e?.reason??new Error("cancelled via nodeSignal"),o,s=!1,i=()=>{o?(o(),o=void 0):s=!0};return o=n.subscribe(a=>{if(!t.signal.aborted)for(let u of a){if(u[0]===x&&u[1]===!0){t.abort(r),i();return}if(u[0]===_){t.abort(u[1]),i();return}if(u[0]===E){i();return}}}),s&&(o?.(),o=void 0),{signal:t.signal,dispose:()=>{o&&(o(),o=void 0)}}}function $e(n){return n.subscribe(()=>{})}function Fo(n){let e=me(0);return{node:e,increment(){let t=e.cache??0;return t>=n?!1:(e.down([[I],[x,t+1]]),!0)},get(){return e.cache??0},atCap(){return(e.cache??0)>=n}}}var tn,hr,Lo,vr=L(()=>{"use strict";Ne();ue();ae();Qe();Rn();Lo=on});var $o={};_t($o,{awaitSettled:()=>Po,cached:()=>Mo,defer:()=>So,empty:()=>xo,escapeRegexChar:()=>mr,firstValueFrom:()=>Go,firstWhere:()=>nn,forEach:()=>Co,fromAny:()=>le,fromAsyncIter:()=>br,fromCron:()=>_o,fromEvent:()=>No,fromIter:()=>rn,fromPromise:()=>gr,fromRaf:()=>To,fromTimer:()=>wo,globToRegExp:()=>bo,keepalive:()=>$e,matchesAnyPattern:()=>yo,never:()=>Eo,nodeSignal:()=>Io,of:()=>yr,reactiveCounter:()=>Fo,replay:()=>on,share:()=>Do,shareReplay:()=>Lo,throwError:()=>Ro,toArray:()=>Ao});module.exports=Or($o);var st=L(()=>{vr()});st();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
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __copyProps = (to, from, except, desc) => {
7
+ if (from && typeof from === "object" || typeof from === "function") {
8
+ for (let key of __getOwnPropNames(from))
9
+ if (!__hasOwnProp.call(to, key) && key !== except)
10
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
+ }
12
+ return to;
13
+ };
14
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
15
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
16
+
17
+ // src/extra/sources.ts
18
+ var sources_exports = {};
19
+ module.exports = __toCommonJS(sources_exports);
20
+ __reExport(sources_exports, require("@graphrefly/pure-ts/extra/sources"), module.exports);
21
+ //# sourceMappingURL=sources.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/extra/sources.ts"],"sourcesContent":["// Phase 13.9.A shim — re-export from pure-TS sibling until\n// @graphrefly/native (napi binding) and per-milestone swap-overs land.\nexport * from \"@graphrefly/pure-ts/extra/sources\";\n"],"mappings":";;;;;;;;;;;;;;;;;AAAA;AAAA;AAEA,4BAAc,8CAFd;","names":[]}