@graphrefly/graphrefly 0.44.0 → 0.46.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 (720) hide show
  1. package/README.md +22 -19
  2. package/dist/_internal-B23BagFd.d.cts +33 -0
  3. package/dist/_internal-B23BagFd.d.ts +33 -0
  4. package/dist/adaptive-rate-limiter-Dch_xYIi.d.cts +111 -0
  5. package/dist/adaptive-rate-limiter-Dch_xYIi.d.ts +111 -0
  6. package/dist/agents-C0Ji9ldU.d.cts +629 -0
  7. package/dist/agents-C9zexT7I.d.ts +629 -0
  8. package/dist/audit-BAXb3VOg.d.ts +246 -0
  9. package/dist/audit-C_bPfkqS.d.cts +246 -0
  10. package/dist/backoff-7KIK3WQW.js +24 -0
  11. package/dist/backoff-7KIK3WQW.js.map +1 -0
  12. package/dist/backoff-Bnb9OoPh.d.cts +6 -0
  13. package/dist/backoff-Bnb9OoPh.d.ts +6 -0
  14. package/dist/base/composition/index.cjs +811 -0
  15. package/dist/base/composition/index.cjs.map +1 -0
  16. package/dist/base/composition/index.d.cts +469 -0
  17. package/dist/base/composition/index.d.ts +469 -0
  18. package/dist/base/composition/index.js +40 -0
  19. package/dist/base/composition/index.js.map +1 -0
  20. package/dist/base/index.cjs +6336 -0
  21. package/dist/base/index.cjs.map +1 -0
  22. package/dist/base/index.d.cts +22 -0
  23. package/dist/base/index.d.ts +22 -0
  24. package/dist/base/index.js +259 -0
  25. package/dist/base/index.js.map +1 -0
  26. package/dist/base/io/index.cjs +3270 -0
  27. package/dist/base/io/index.cjs.map +1 -0
  28. package/dist/base/io/index.d.cts +2245 -0
  29. package/dist/base/io/index.d.ts +2245 -0
  30. package/dist/base/io/index.js +117 -0
  31. package/dist/base/io/index.js.map +1 -0
  32. package/dist/base/meta/index.cjs +43 -0
  33. package/dist/base/meta/index.cjs.map +1 -0
  34. package/dist/base/meta/index.d.cts +45 -0
  35. package/dist/base/meta/index.d.ts +45 -0
  36. package/dist/base/meta/index.js +13 -0
  37. package/dist/base/meta/index.js.map +1 -0
  38. package/dist/base/mutation/index.cjs +200 -0
  39. package/dist/base/mutation/index.cjs.map +1 -0
  40. package/dist/base/mutation/index.d.cts +177 -0
  41. package/dist/base/mutation/index.d.ts +177 -0
  42. package/dist/base/mutation/index.js +22 -0
  43. package/dist/base/mutation/index.js.map +1 -0
  44. package/dist/base/render/index.cjs +1120 -0
  45. package/dist/base/render/index.cjs.map +1 -0
  46. package/dist/{extra/render/index.d.ts → base/render/index.d.cts} +75 -31
  47. package/dist/{extra/render/index.d.cts → base/render/index.d.ts} +75 -31
  48. package/dist/base/render/index.js +24 -0
  49. package/dist/base/render/index.js.map +1 -0
  50. package/dist/base/sources/browser/index.cjs +172 -0
  51. package/dist/base/sources/browser/index.cjs.map +1 -0
  52. package/dist/base/sources/browser/index.d.cts +84 -0
  53. package/dist/base/sources/browser/index.d.ts +84 -0
  54. package/dist/base/sources/browser/index.js +151 -0
  55. package/dist/base/sources/browser/index.js.map +1 -0
  56. package/dist/base/sources/event/index.cjs +98 -0
  57. package/dist/base/sources/event/index.cjs.map +1 -0
  58. package/dist/base/sources/event/index.d.cts +91 -0
  59. package/dist/base/sources/event/index.d.ts +91 -0
  60. package/dist/base/sources/event/index.js +13 -0
  61. package/dist/base/sources/event/index.js.map +1 -0
  62. package/dist/base/sources/index.cjs +755 -0
  63. package/dist/base/sources/index.cjs.map +1 -0
  64. package/dist/{extra/sources.d.ts → base/sources/index.d.cts} +74 -301
  65. package/dist/{extra/sources.d.cts → base/sources/index.d.ts} +74 -301
  66. package/dist/base/sources/index.js +42 -0
  67. package/dist/base/sources/index.js.map +1 -0
  68. package/dist/base/sources/node/index.cjs +320 -0
  69. package/dist/base/sources/node/index.cjs.map +1 -0
  70. package/dist/{extra/node.d.ts → base/sources/node/index.d.cts} +35 -37
  71. package/dist/{extra/node.d.cts → base/sources/node/index.d.ts} +35 -37
  72. package/dist/base/sources/node/index.js +306 -0
  73. package/dist/base/sources/node/index.js.map +1 -0
  74. package/dist/base/utils/index.cjs +37 -0
  75. package/dist/base/utils/index.cjs.map +1 -0
  76. package/dist/base/utils/index.d.cts +37 -0
  77. package/dist/base/utils/index.d.ts +37 -0
  78. package/dist/base/utils/index.js +11 -0
  79. package/dist/base/utils/index.js.map +1 -0
  80. package/dist/base/worker/index.cjs +548 -0
  81. package/dist/base/worker/index.cjs.map +1 -0
  82. package/dist/base/worker/index.d.cts +207 -0
  83. package/dist/base/worker/index.d.ts +207 -0
  84. package/dist/base/worker/index.js +20 -0
  85. package/dist/base/worker/index.js.map +1 -0
  86. package/dist/breaker-C9skL3d8.d.ts +175 -0
  87. package/dist/breaker-ugSdq54q.d.cts +175 -0
  88. package/dist/{cascading-BglDkMdX.d.cts → cascading-CSSbKGrJ.d.ts} +3 -3
  89. package/dist/{cascading-MFgxu7Yo.d.ts → cascading-baGkiihI.d.cts} +3 -3
  90. package/dist/chunk-255UCBG4.js +58 -0
  91. package/dist/chunk-255UCBG4.js.map +1 -0
  92. package/dist/chunk-2LO3EL4W.js +1 -0
  93. package/dist/chunk-2LO3EL4W.js.map +1 -0
  94. package/dist/chunk-2OB3CEJS.js +1065 -0
  95. package/dist/chunk-2OB3CEJS.js.map +1 -0
  96. package/dist/chunk-36NMM65U.js +144 -0
  97. package/dist/chunk-36NMM65U.js.map +1 -0
  98. package/dist/chunk-3CEXCBN6.js +1 -0
  99. package/dist/chunk-3CEXCBN6.js.map +1 -0
  100. package/dist/chunk-3MUSLI6E.js +105 -0
  101. package/dist/chunk-3MUSLI6E.js.map +1 -0
  102. package/dist/chunk-3PSLNJDU.js +884 -0
  103. package/dist/chunk-3PSLNJDU.js.map +1 -0
  104. package/dist/chunk-3QZY5BI7.js +92 -0
  105. package/dist/chunk-3QZY5BI7.js.map +1 -0
  106. package/dist/chunk-42FQ27MQ.js +594 -0
  107. package/dist/chunk-42FQ27MQ.js.map +1 -0
  108. package/dist/chunk-4GYMCUDZ.js +1085 -0
  109. package/dist/chunk-4GYMCUDZ.js.map +1 -0
  110. package/dist/chunk-4S53H2KR.js +382 -0
  111. package/dist/chunk-4S53H2KR.js.map +1 -0
  112. package/dist/chunk-4XCHZRUJ.js +128 -0
  113. package/dist/chunk-4XCHZRUJ.js.map +1 -0
  114. package/dist/chunk-5THCXDWY.js +725 -0
  115. package/dist/chunk-5THCXDWY.js.map +1 -0
  116. package/dist/chunk-6XZYT4SW.js +256 -0
  117. package/dist/chunk-6XZYT4SW.js.map +1 -0
  118. package/dist/chunk-7EGRP2VX.js +76 -0
  119. package/dist/chunk-7EGRP2VX.js.map +1 -0
  120. package/dist/chunk-A7KV5UK4.js +150 -0
  121. package/dist/chunk-A7KV5UK4.js.map +1 -0
  122. package/dist/chunk-APY2SS5X.js +156 -0
  123. package/dist/chunk-APY2SS5X.js.map +1 -0
  124. package/dist/chunk-AZDQPQ3V.js +66 -0
  125. package/dist/chunk-AZDQPQ3V.js.map +1 -0
  126. package/dist/chunk-BU3SEFA5.js +90 -0
  127. package/dist/chunk-BU3SEFA5.js.map +1 -0
  128. package/dist/chunk-BXGZFGZ4.js +189 -0
  129. package/dist/chunk-BXGZFGZ4.js.map +1 -0
  130. package/dist/chunk-CGHORL6G.js +579 -0
  131. package/dist/chunk-CGHORL6G.js.map +1 -0
  132. package/dist/chunk-CXANAIZU.js +530 -0
  133. package/dist/chunk-CXANAIZU.js.map +1 -0
  134. package/dist/chunk-CZQHCKKG.js +1 -0
  135. package/dist/chunk-CZQHCKKG.js.map +1 -0
  136. package/dist/chunk-DKNHAICT.js +133 -0
  137. package/dist/chunk-DKNHAICT.js.map +1 -0
  138. package/dist/chunk-DM4OMPWK.js +584 -0
  139. package/dist/chunk-DM4OMPWK.js.map +1 -0
  140. package/dist/chunk-DMSNO6ZB.js +452 -0
  141. package/dist/chunk-DMSNO6ZB.js.map +1 -0
  142. package/dist/chunk-E5OZPDIW.js +229 -0
  143. package/dist/chunk-E5OZPDIW.js.map +1 -0
  144. package/dist/chunk-EVYY4X5A.js +509 -0
  145. package/dist/chunk-EVYY4X5A.js.map +1 -0
  146. package/dist/chunk-FDFD67UO.js +1 -0
  147. package/dist/chunk-FDFD67UO.js.map +1 -0
  148. package/dist/chunk-FMPF42Q4.js +13 -0
  149. package/dist/chunk-FMPF42Q4.js.map +1 -0
  150. package/dist/chunk-FR6RGA3B.js +1277 -0
  151. package/dist/chunk-FR6RGA3B.js.map +1 -0
  152. package/dist/chunk-FW23JYNQ.js +454 -0
  153. package/dist/chunk-FW23JYNQ.js.map +1 -0
  154. package/dist/chunk-GBCENOLN.js +1575 -0
  155. package/dist/chunk-GBCENOLN.js.map +1 -0
  156. package/dist/chunk-HL7HUJIX.js +1 -0
  157. package/dist/chunk-HL7HUJIX.js.map +1 -0
  158. package/dist/chunk-HULCUY35.js +2508 -0
  159. package/dist/chunk-HULCUY35.js.map +1 -0
  160. package/dist/chunk-IHTWQEDR.js +169 -0
  161. package/dist/chunk-IHTWQEDR.js.map +1 -0
  162. package/dist/chunk-IJRR6YAI.js +128 -0
  163. package/dist/chunk-IJRR6YAI.js.map +1 -0
  164. package/dist/chunk-JGFRAFDL.js +221 -0
  165. package/dist/chunk-JGFRAFDL.js.map +1 -0
  166. package/dist/chunk-KIIXR252.js +211 -0
  167. package/dist/chunk-KIIXR252.js.map +1 -0
  168. package/dist/chunk-KN3H5CNT.js +11 -0
  169. package/dist/chunk-KN3H5CNT.js.map +1 -0
  170. package/dist/chunk-KPG3DGLA.js +1 -0
  171. package/dist/chunk-KPG3DGLA.js.map +1 -0
  172. package/dist/chunk-KRNQ6RGQ.js +1 -0
  173. package/dist/chunk-KRNQ6RGQ.js.map +1 -0
  174. package/dist/chunk-LBAJK24K.js +1071 -0
  175. package/dist/chunk-LBAJK24K.js.map +1 -0
  176. package/dist/chunk-MLTPJMH6.js +417 -0
  177. package/dist/chunk-MLTPJMH6.js.map +1 -0
  178. package/dist/chunk-N3SZ7BMH.js +95 -0
  179. package/dist/chunk-N3SZ7BMH.js.map +1 -0
  180. package/dist/chunk-NDUD3IMO.js +540 -0
  181. package/dist/chunk-NDUD3IMO.js.map +1 -0
  182. package/dist/chunk-NY2PYHNC.js +873 -0
  183. package/dist/chunk-NY2PYHNC.js.map +1 -0
  184. package/dist/chunk-O3MT7DYI.js +225 -0
  185. package/dist/chunk-O3MT7DYI.js.map +1 -0
  186. package/dist/chunk-OCUDSN63.js +2386 -0
  187. package/dist/chunk-OCUDSN63.js.map +1 -0
  188. package/dist/chunk-OIWU3NYV.js +199 -0
  189. package/dist/chunk-OIWU3NYV.js.map +1 -0
  190. package/dist/chunk-OO5BM6CJ.js +1153 -0
  191. package/dist/chunk-OO5BM6CJ.js.map +1 -0
  192. package/dist/chunk-OQUIJT7A.js +1 -0
  193. package/dist/chunk-OQUIJT7A.js.map +1 -0
  194. package/dist/chunk-P5LBT622.js +105 -0
  195. package/dist/chunk-P5LBT622.js.map +1 -0
  196. package/dist/chunk-PKGQG5QQ.js +519 -0
  197. package/dist/chunk-PKGQG5QQ.js.map +1 -0
  198. package/dist/chunk-PKPO3JTZ.js +561 -0
  199. package/dist/chunk-PKPO3JTZ.js.map +1 -0
  200. package/dist/chunk-PL5UDIQ5.js +118 -0
  201. package/dist/chunk-PL5UDIQ5.js.map +1 -0
  202. package/dist/chunk-PZWISPIQ.js +432 -0
  203. package/dist/chunk-PZWISPIQ.js.map +1 -0
  204. package/dist/chunk-Q3EYOCZB.js +510 -0
  205. package/dist/chunk-Q3EYOCZB.js.map +1 -0
  206. package/dist/chunk-QMBYUVRL.js +15 -0
  207. package/dist/chunk-QMBYUVRL.js.map +1 -0
  208. package/dist/chunk-RAGGHLCV.js +200 -0
  209. package/dist/chunk-RAGGHLCV.js.map +1 -0
  210. package/dist/chunk-RGL53X5G.js +574 -0
  211. package/dist/chunk-RGL53X5G.js.map +1 -0
  212. package/dist/chunk-RJOG4IJU.js +1039 -0
  213. package/dist/chunk-RJOG4IJU.js.map +1 -0
  214. package/dist/chunk-SOOKUYVM.js +403 -0
  215. package/dist/chunk-SOOKUYVM.js.map +1 -0
  216. package/dist/chunk-T5BN5KG7.js +1 -0
  217. package/dist/chunk-T5BN5KG7.js.map +1 -0
  218. package/dist/chunk-TP7244Y6.js +207 -0
  219. package/dist/chunk-TP7244Y6.js.map +1 -0
  220. package/dist/chunk-TSBFTJKM.js +57 -0
  221. package/dist/chunk-TSBFTJKM.js.map +1 -0
  222. package/dist/chunk-URQ2CBBF.js +143 -0
  223. package/dist/chunk-URQ2CBBF.js.map +1 -0
  224. package/dist/chunk-W2BOPXTI.js +1 -0
  225. package/dist/chunk-W2BOPXTI.js.map +1 -0
  226. package/dist/chunk-WKSWLSCX.js +207 -0
  227. package/dist/chunk-WKSWLSCX.js.map +1 -0
  228. package/dist/chunk-Y52CS6YA.js +88 -0
  229. package/dist/chunk-Y52CS6YA.js.map +1 -0
  230. package/dist/chunk-YCBUWK77.js +92 -0
  231. package/dist/chunk-YCBUWK77.js.map +1 -0
  232. package/dist/chunk-YJ4U2D2C.js +314 -0
  233. package/dist/chunk-YJ4U2D2C.js.map +1 -0
  234. package/dist/chunk-Z4YXAUDN.js +239 -0
  235. package/dist/chunk-Z4YXAUDN.js.map +1 -0
  236. package/dist/chunk-Z6EGP5D7.js +92 -0
  237. package/dist/chunk-Z6EGP5D7.js.map +1 -0
  238. package/dist/compat/index.cjs +3100 -9
  239. package/dist/compat/index.cjs.map +1 -0
  240. package/dist/compat/index.d.cts +112 -18
  241. package/dist/compat/index.d.ts +112 -18
  242. package/dist/compat/index.js +176 -1
  243. package/dist/compat/index.js.map +1 -0
  244. package/dist/compat/jotai/index.cjs +149 -1
  245. package/dist/compat/jotai/index.cjs.map +1 -0
  246. package/dist/compat/jotai/index.d.cts +2 -2
  247. package/dist/compat/jotai/index.d.ts +2 -2
  248. package/dist/compat/jotai/index.js +8 -1
  249. package/dist/compat/jotai/index.js.map +1 -0
  250. package/dist/compat/nanostores/index.cjs +205 -1
  251. package/dist/compat/nanostores/index.cjs.map +1 -0
  252. package/dist/compat/nanostores/index.d.cts +2 -2
  253. package/dist/compat/nanostores/index.d.ts +2 -2
  254. package/dist/compat/nanostores/index.js +22 -1
  255. package/dist/compat/nanostores/index.js.map +1 -0
  256. package/dist/compat/nestjs/index.cjs +2241 -9
  257. package/dist/compat/nestjs/index.cjs.map +1 -0
  258. package/dist/compat/nestjs/index.d.cts +7 -10
  259. package/dist/compat/nestjs/index.d.ts +7 -10
  260. package/dist/compat/nestjs/index.js +78 -1
  261. package/dist/compat/nestjs/index.js.map +1 -0
  262. package/dist/compat/react/index.cjs +114 -1
  263. package/dist/compat/react/index.cjs.map +1 -0
  264. package/dist/compat/react/index.d.cts +2 -2
  265. package/dist/compat/react/index.d.ts +2 -2
  266. package/dist/compat/react/index.js +12 -1
  267. package/dist/compat/react/index.js.map +1 -0
  268. package/dist/compat/solid/index.cjs +101 -1
  269. package/dist/compat/solid/index.cjs.map +1 -0
  270. package/dist/compat/solid/index.d.cts +2 -2
  271. package/dist/compat/solid/index.d.ts +2 -2
  272. package/dist/compat/solid/index.js +12 -1
  273. package/dist/compat/solid/index.js.map +1 -0
  274. package/dist/compat/svelte/index.cjs +104 -1
  275. package/dist/compat/svelte/index.cjs.map +1 -0
  276. package/dist/compat/svelte/index.d.cts +2 -2
  277. package/dist/compat/svelte/index.d.ts +2 -2
  278. package/dist/compat/svelte/index.js +12 -1
  279. package/dist/compat/svelte/index.js.map +1 -0
  280. package/dist/compat/vue/index.cjs +119 -1
  281. package/dist/compat/vue/index.cjs.map +1 -0
  282. package/dist/compat/vue/index.d.cts +2 -2
  283. package/dist/compat/vue/index.d.ts +2 -2
  284. package/dist/compat/vue/index.js +12 -1
  285. package/dist/compat/vue/index.js.map +1 -0
  286. package/dist/compat/zustand/index.cjs +69 -3
  287. package/dist/compat/zustand/index.cjs.map +1 -0
  288. package/dist/compat/zustand/index.d.cts +2 -6
  289. package/dist/compat/zustand/index.d.ts +2 -6
  290. package/dist/compat/zustand/index.js +8 -1
  291. package/dist/compat/zustand/index.js.map +1 -0
  292. package/dist/distill-De6Rnn15.d.cts +48 -0
  293. package/dist/distill-De6Rnn15.d.ts +48 -0
  294. package/dist/external-register-CWyroXb_.d.cts +138 -0
  295. package/dist/external-register-CWyroXb_.d.ts +138 -0
  296. package/dist/{fallback-74oxi34l.d.cts → fallback-Bx46zqky.d.cts} +3 -10
  297. package/dist/{fallback-DUyyBTBK.d.ts → fallback-pIWW8A2d.d.ts} +3 -10
  298. package/dist/guarded-execution-BcdtxeBk.d.ts +207 -0
  299. package/dist/guarded-execution-C-3hnP6A.d.cts +207 -0
  300. package/dist/{index-CBGUK09R.d.ts → index-5SU_O78r.d.cts} +5 -5
  301. package/dist/{index-BmZXHqkE.d.ts → index-B6pxYJzO.d.cts} +1 -1
  302. package/dist/{index-hcDJ8PSI.d.cts → index-B6pxYJzO.d.ts} +1 -1
  303. package/dist/{index-C5stwKcw.d.cts → index-BFsng6v1.d.cts} +1 -1
  304. package/dist/{index-CdAlHFEt.d.ts → index-BFsng6v1.d.ts} +1 -1
  305. package/dist/{index-_6ODbuOu.d.cts → index-Bg-LwEt-.d.cts} +1 -1
  306. package/dist/{index-CviRnE4K.d.ts → index-Bg-LwEt-.d.ts} +1 -1
  307. package/dist/{index-CBBLl_rc.d.ts → index-Brp888t0.d.cts} +1 -1
  308. package/dist/{index-BQSKmbuG.d.cts → index-Brp888t0.d.ts} +1 -1
  309. package/dist/{index-sqkqlb1p.d.ts → index-CDfk6jHN.d.cts} +1 -1
  310. package/dist/{index-ZVQhLa2i.d.cts → index-CDfk6jHN.d.ts} +1 -1
  311. package/dist/{index-Climxqsu.d.cts → index-CEXCtYYJ.d.ts} +5 -5
  312. package/dist/index-DLAxYaN5.d.cts +169 -0
  313. package/dist/index-DLAxYaN5.d.ts +169 -0
  314. package/dist/{index-CK29LV56.d.cts → index-DeWbQzMe.d.cts} +1 -1
  315. package/dist/{index-CPQlGA29.d.ts → index-DeWbQzMe.d.ts} +1 -1
  316. package/dist/{index-BrPrLl4e.d.cts → index-dX9IzPqj.d.cts} +1 -1
  317. package/dist/{index-Dgl1HpPn.d.ts → index-dX9IzPqj.d.ts} +1 -1
  318. package/dist/index.cjs +25934 -191
  319. package/dist/index.cjs.map +1 -0
  320. package/dist/index.d.cts +58 -94
  321. package/dist/index.d.ts +58 -94
  322. package/dist/index.js +852 -1
  323. package/dist/index.js.map +1 -0
  324. package/dist/layout-types-B5aiHYgk.d.cts +72 -0
  325. package/dist/layout-types-B5aiHYgk.d.ts +72 -0
  326. package/dist/memory-composers-BryDrRBX.d.cts +529 -0
  327. package/dist/memory-composers-CVQqPYEV.d.ts +529 -0
  328. package/dist/{observable-DWjNfLvC.d.ts → observable-BXQoW1P-.d.cts} +1 -1
  329. package/dist/{observable-e3eiPPFy.d.cts → observable-BXQoW1P-.d.ts} +1 -1
  330. package/dist/{pipeline-graph-Sgj0gCwn.d.ts → pipeline-graph-Ce47CB6Y.d.cts} +13 -10
  331. package/dist/{pipeline-graph-CIKhynsF.d.cts → pipeline-graph-DXCwY9vG.d.ts} +13 -10
  332. package/dist/presets/ai/index.cjs +4377 -0
  333. package/dist/presets/ai/index.cjs.map +1 -0
  334. package/dist/presets/ai/index.d.cts +98 -0
  335. package/dist/presets/ai/index.d.ts +98 -0
  336. package/dist/presets/ai/index.js +54 -0
  337. package/dist/presets/ai/index.js.map +1 -0
  338. package/dist/presets/harness/index.cjs +5929 -0
  339. package/dist/presets/harness/index.cjs.map +1 -0
  340. package/dist/presets/harness/index.d.cts +566 -0
  341. package/dist/presets/harness/index.d.ts +566 -0
  342. package/dist/presets/harness/index.js +71 -0
  343. package/dist/presets/harness/index.js.map +1 -0
  344. package/dist/presets/index.cjs +9782 -0
  345. package/dist/presets/index.cjs.map +1 -0
  346. package/dist/presets/index.d.cts +28 -0
  347. package/dist/presets/index.d.ts +28 -0
  348. package/dist/presets/index.js +129 -0
  349. package/dist/presets/index.js.map +1 -0
  350. package/dist/presets/inspect/index.cjs +1087 -0
  351. package/dist/presets/inspect/index.cjs.map +1 -0
  352. package/dist/presets/inspect/index.d.cts +172 -0
  353. package/dist/presets/inspect/index.d.ts +172 -0
  354. package/dist/presets/inspect/index.js +21 -0
  355. package/dist/presets/inspect/index.js.map +1 -0
  356. package/dist/presets/resilience/index.cjs +1593 -0
  357. package/dist/presets/resilience/index.cjs.map +1 -0
  358. package/dist/presets/resilience/index.d.cts +205 -0
  359. package/dist/presets/resilience/index.d.ts +205 -0
  360. package/dist/presets/resilience/index.js +18 -0
  361. package/dist/presets/resilience/index.js.map +1 -0
  362. package/dist/rate-limiter-CEALq4N1.d.ts +559 -0
  363. package/dist/rate-limiter-DpVbSYdH.d.cts +559 -0
  364. package/dist/{reactive-layout-DOTs9P3X.d.ts → reactive-layout-fswlBUvX.d.cts} +19 -7
  365. package/dist/{reactive-layout-DgctbqZo.d.cts → reactive-layout-fswlBUvX.d.ts} +19 -7
  366. package/dist/retry-BDbRZ_gx.d.ts +125 -0
  367. package/dist/retry-DWuhjvsA.d.cts +125 -0
  368. package/dist/solutions/index.cjs +8200 -0
  369. package/dist/solutions/index.cjs.map +1 -0
  370. package/dist/solutions/index.d.cts +23 -0
  371. package/dist/solutions/index.d.ts +23 -0
  372. package/dist/solutions/index.js +55 -0
  373. package/dist/solutions/index.js.map +1 -0
  374. package/dist/spawnable-5mDY501F.d.cts +746 -0
  375. package/dist/spawnable-D3lR0oQu.d.ts +746 -0
  376. package/dist/status-U-rUI79b.d.cts +84 -0
  377. package/dist/status-U-rUI79b.d.ts +84 -0
  378. package/dist/timeout-U5O4ESK3.js +12 -0
  379. package/dist/timeout-U5O4ESK3.js.map +1 -0
  380. package/dist/{types-CWFysE9E.d.ts → types-BB5Lw-pB.d.cts} +3 -3
  381. package/dist/{types-C0_yquda.d.cts → types-BB5Lw-pB.d.ts} +3 -3
  382. package/dist/types-CJWIMJiZ.d.ts +548 -0
  383. package/dist/types-vCq7ShIm.d.cts +548 -0
  384. package/dist/utils/ai/browser.cjs +2169 -0
  385. package/dist/utils/ai/browser.cjs.map +1 -0
  386. package/dist/{patterns → utils}/ai/browser.d.cts +7 -5
  387. package/dist/{patterns → utils}/ai/browser.d.ts +7 -5
  388. package/dist/utils/ai/browser.js +255 -0
  389. package/dist/utils/ai/browser.js.map +1 -0
  390. package/dist/utils/ai/index.cjs +8468 -0
  391. package/dist/utils/ai/index.cjs.map +1 -0
  392. package/dist/{index-CR8QpwX8.d.ts → utils/ai/index.d.cts} +73 -976
  393. package/dist/{index-UPSiS-X7.d.cts → utils/ai/index.d.ts} +73 -976
  394. package/dist/utils/ai/index.js +173 -0
  395. package/dist/utils/ai/index.js.map +1 -0
  396. package/dist/utils/ai/node.cjs +648 -0
  397. package/dist/utils/ai/node.cjs.map +1 -0
  398. package/dist/{patterns → utils}/ai/node.d.cts +5 -7
  399. package/dist/{patterns → utils}/ai/node.d.ts +5 -7
  400. package/dist/utils/ai/node.js +84 -0
  401. package/dist/utils/ai/node.js.map +1 -0
  402. package/dist/utils/cqrs/index.cjs +1036 -0
  403. package/dist/utils/cqrs/index.cjs.map +1 -0
  404. package/dist/{index-CeFiHtAg.d.ts → utils/cqrs/index.d.cts} +7 -37
  405. package/dist/{index-B-_tFaqV.d.cts → utils/cqrs/index.d.ts} +7 -37
  406. package/dist/utils/cqrs/index.js +18 -0
  407. package/dist/utils/cqrs/index.js.map +1 -0
  408. package/dist/utils/demo-shell/index.cjs +865 -0
  409. package/dist/utils/demo-shell/index.cjs.map +1 -0
  410. package/dist/{index-B8YnZpIR.d.ts → utils/demo-shell/index.d.cts} +4 -16
  411. package/dist/{index-Cwv0KWcU.d.cts → utils/demo-shell/index.d.ts} +4 -16
  412. package/dist/utils/demo-shell/index.js +13 -0
  413. package/dist/utils/demo-shell/index.js.map +1 -0
  414. package/dist/utils/domain-templates/index.cjs +732 -0
  415. package/dist/utils/domain-templates/index.cjs.map +1 -0
  416. package/dist/{index-CzLVrjxn.d.ts → utils/domain-templates/index.d.cts} +3 -20
  417. package/dist/{index-BaQaY_IQ.d.cts → utils/domain-templates/index.d.ts} +3 -20
  418. package/dist/utils/domain-templates/index.js +17 -0
  419. package/dist/utils/domain-templates/index.js.map +1 -0
  420. package/dist/utils/graphspec/index.cjs +1174 -0
  421. package/dist/utils/graphspec/index.cjs.map +1 -0
  422. package/dist/{index-CMh5Rz1y.d.ts → utils/graphspec/index.d.cts} +106 -42
  423. package/dist/{index-CS0LTlB8.d.cts → utils/graphspec/index.d.ts} +106 -42
  424. package/dist/utils/graphspec/index.js +35 -0
  425. package/dist/utils/graphspec/index.js.map +1 -0
  426. package/dist/utils/harness/index.cjs +656 -0
  427. package/dist/utils/harness/index.cjs.map +1 -0
  428. package/dist/utils/harness/index.d.cts +542 -0
  429. package/dist/utils/harness/index.d.ts +542 -0
  430. package/dist/utils/harness/index.js +56 -0
  431. package/dist/utils/harness/index.js.map +1 -0
  432. package/dist/utils/index.cjs +17609 -0
  433. package/dist/utils/index.cjs.map +1 -0
  434. package/dist/utils/index.d.cts +96 -0
  435. package/dist/utils/index.d.ts +96 -0
  436. package/dist/utils/index.js +514 -0
  437. package/dist/utils/index.js.map +1 -0
  438. package/dist/utils/inspect/index.cjs +807 -0
  439. package/dist/utils/inspect/index.cjs.map +1 -0
  440. package/dist/utils/inspect/index.d.cts +123 -0
  441. package/dist/utils/inspect/index.d.ts +123 -0
  442. package/dist/utils/inspect/index.js +30 -0
  443. package/dist/utils/inspect/index.js.map +1 -0
  444. package/dist/utils/job-queue/index.cjs +717 -0
  445. package/dist/utils/job-queue/index.cjs.map +1 -0
  446. package/dist/{index-DisjX8a-.d.ts → utils/job-queue/index.d.cts} +5 -26
  447. package/dist/{index-DV_1YuVk.d.cts → utils/job-queue/index.d.ts} +5 -26
  448. package/dist/utils/job-queue/index.js +18 -0
  449. package/dist/utils/job-queue/index.js.map +1 -0
  450. package/dist/utils/memory/index.cjs +1451 -0
  451. package/dist/utils/memory/index.cjs.map +1 -0
  452. package/dist/{index-CZ3r5Rxp.d.ts → utils/memory/index.d.cts} +242 -34
  453. package/dist/{index-B17QddL1.d.cts → utils/memory/index.d.ts} +242 -34
  454. package/dist/utils/memory/index.js +19 -0
  455. package/dist/utils/memory/index.js.map +1 -0
  456. package/dist/utils/messaging/index.cjs +666 -0
  457. package/dist/utils/messaging/index.cjs.map +1 -0
  458. package/dist/utils/messaging/index.d.cts +562 -0
  459. package/dist/utils/messaging/index.d.ts +562 -0
  460. package/dist/utils/messaging/index.js +50 -0
  461. package/dist/utils/messaging/index.js.map +1 -0
  462. package/dist/utils/orchestration/index.cjs +876 -0
  463. package/dist/utils/orchestration/index.cjs.map +1 -0
  464. package/dist/utils/orchestration/index.d.cts +233 -0
  465. package/dist/utils/orchestration/index.d.ts +233 -0
  466. package/dist/utils/orchestration/index.js +19 -0
  467. package/dist/utils/orchestration/index.js.map +1 -0
  468. package/dist/utils/process/index.cjs +743 -0
  469. package/dist/utils/process/index.cjs.map +1 -0
  470. package/dist/{index-p09KSrTN.d.ts → utils/process/index.d.cts} +97 -44
  471. package/dist/{index-CasX6Pfq.d.cts → utils/process/index.d.ts} +97 -44
  472. package/dist/utils/process/index.js +14 -0
  473. package/dist/utils/process/index.js.map +1 -0
  474. package/dist/utils/reactive-layout/index.cjs +1607 -0
  475. package/dist/utils/reactive-layout/index.cjs.map +1 -0
  476. package/dist/{index-B5S8ULbU.d.ts → utils/reactive-layout/index.d.cts} +58 -81
  477. package/dist/{index-Dc4AYqrJ.d.cts → utils/reactive-layout/index.d.ts} +58 -81
  478. package/dist/utils/reactive-layout/index.js +52 -0
  479. package/dist/utils/reactive-layout/index.js.map +1 -0
  480. package/dist/utils/reduction/index.cjs +203 -0
  481. package/dist/utils/reduction/index.cjs.map +1 -0
  482. package/dist/{index-Byu-OpX_.d.ts → utils/reduction/index.d.cts} +6 -17
  483. package/dist/{index-tRCxuAXF.d.cts → utils/reduction/index.d.ts} +6 -17
  484. package/dist/utils/reduction/index.js +14 -0
  485. package/dist/utils/reduction/index.js.map +1 -0
  486. package/dist/utils/resilience/index.cjs +1617 -0
  487. package/dist/utils/resilience/index.cjs.map +1 -0
  488. package/dist/utils/resilience/index.d.cts +9 -0
  489. package/dist/utils/resilience/index.d.ts +9 -0
  490. package/dist/utils/resilience/index.js +44 -0
  491. package/dist/utils/resilience/index.js.map +1 -0
  492. package/dist/utils/surface/index.cjs +1070 -0
  493. package/dist/utils/surface/index.cjs.map +1 -0
  494. package/dist/{index-CYq8vAyV.d.ts → utils/surface/index.d.cts} +7 -58
  495. package/dist/{index-CSOmP7xT.d.cts → utils/surface/index.d.ts} +7 -58
  496. package/dist/utils/surface/index.js +30 -0
  497. package/dist/utils/surface/index.js.map +1 -0
  498. package/dist/utils/topology-view/index.cjs +620 -0
  499. package/dist/utils/topology-view/index.cjs.map +1 -0
  500. package/dist/utils/topology-view/index.d.cts +68 -0
  501. package/dist/utils/topology-view/index.d.ts +68 -0
  502. package/dist/utils/topology-view/index.js +11 -0
  503. package/dist/utils/topology-view/index.js.map +1 -0
  504. package/package.json +664 -584
  505. package/dist/backoff-HPZMEZNF.js +0 -1
  506. package/dist/chunk-2T7U5EU6.js +0 -1
  507. package/dist/chunk-3G5U5QNE.js +0 -5
  508. package/dist/chunk-4VVTGLXJ.js +0 -1
  509. package/dist/chunk-5M4CCMMD.js +0 -45
  510. package/dist/chunk-5QDBSZBV.js +0 -1
  511. package/dist/chunk-5XJ6B66J.js +0 -1
  512. package/dist/chunk-6QZNQS5B.js +0 -1
  513. package/dist/chunk-6X7AFUJV.js +0 -9
  514. package/dist/chunk-7K6PWTDQ.js +0 -1
  515. package/dist/chunk-7LIAPXJB.js +0 -1
  516. package/dist/chunk-7WPU3UHQ.js +0 -1
  517. package/dist/chunk-A5WCQ5NO.js +0 -1
  518. package/dist/chunk-APPIWSGD.js +0 -84
  519. package/dist/chunk-BEZWM2SY.js +0 -1
  520. package/dist/chunk-C72GO4IZ.js +0 -1
  521. package/dist/chunk-CB676TKJ.js +0 -1
  522. package/dist/chunk-CE6TI2TL.js +0 -1
  523. package/dist/chunk-CE72X3WO.js +0 -1
  524. package/dist/chunk-CK2E7BTU.js +0 -1
  525. package/dist/chunk-CLVB32RD.js +0 -1
  526. package/dist/chunk-CRVT7D2P.js +0 -1
  527. package/dist/chunk-D5RFJOZ2.js +0 -1
  528. package/dist/chunk-D7GPHKFH.js +0 -1
  529. package/dist/chunk-DHRX7JX4.js +0 -2
  530. package/dist/chunk-ESMPEKEV.js +0 -1
  531. package/dist/chunk-F672GV32.js +0 -1
  532. package/dist/chunk-FZMYDOWV.js +0 -1
  533. package/dist/chunk-GHBWHMRZ.js +0 -1
  534. package/dist/chunk-GLERH466.js +0 -1
  535. package/dist/chunk-GPW2V3RE.js +0 -1
  536. package/dist/chunk-HIDYF36O.js +0 -1
  537. package/dist/chunk-HITNVN6B.js +0 -3
  538. package/dist/chunk-HY4DJBA7.js +0 -5
  539. package/dist/chunk-KZIEYVXN.js +0 -1
  540. package/dist/chunk-L6NSJVJZ.js +0 -1
  541. package/dist/chunk-N4MQX6JU.js +0 -18
  542. package/dist/chunk-N7FHEL4D.js +0 -1
  543. package/dist/chunk-NTEURFZH.js +0 -1
  544. package/dist/chunk-OIVP6KFV.js +0 -1
  545. package/dist/chunk-OPHBU3LG.js +0 -1
  546. package/dist/chunk-OYQOZP2F.js +0 -5
  547. package/dist/chunk-PTZK576G.js +0 -1
  548. package/dist/chunk-QYADASLV.js +0 -1
  549. package/dist/chunk-ST7UXLWR.js +0 -1
  550. package/dist/chunk-SVY7VUYU.js +0 -1
  551. package/dist/chunk-TK3NWWD4.js +0 -1
  552. package/dist/chunk-TSOYJ743.js +0 -1
  553. package/dist/chunk-UNGSTR4X.js +0 -61
  554. package/dist/chunk-VIMF6LGM.js +0 -1
  555. package/dist/chunk-VJLMUKOI.js +0 -1
  556. package/dist/chunk-VN6RDSK2.js +0 -1
  557. package/dist/chunk-VV4N5P64.js +0 -1
  558. package/dist/chunk-W3I423PS.js +0 -1
  559. package/dist/chunk-WJR24TAG.js +0 -1
  560. package/dist/chunk-XTGKMHSW.js +0 -1
  561. package/dist/chunk-YBB7ZGTY.js +0 -1
  562. package/dist/chunk-Z4NPUARF.js +0 -1
  563. package/dist/chunk-ZGNQRPDT.js +0 -1
  564. package/dist/chunk-ZKPSFFKU.js +0 -1
  565. package/dist/chunk-ZLV5SQSX.js +0 -1
  566. package/dist/content-addressed-storage-4-ST1tYk.d.cts +0 -124
  567. package/dist/content-addressed-storage-DuYMjV7o.d.ts +0 -124
  568. package/dist/core/index.cjs +0 -1
  569. package/dist/core/index.d.cts +0 -3
  570. package/dist/core/index.d.ts +0 -3
  571. package/dist/core/index.js +0 -1
  572. package/dist/decay-BvOWTZ00.d.ts +0 -112
  573. package/dist/decay-CFlLvXUT.d.cts +0 -112
  574. package/dist/extra/browser.cjs +0 -1
  575. package/dist/extra/browser.d.cts +0 -4
  576. package/dist/extra/browser.d.ts +0 -4
  577. package/dist/extra/browser.js +0 -1
  578. package/dist/extra/index.cjs +0 -20
  579. package/dist/extra/index.d.cts +0 -17
  580. package/dist/extra/index.d.ts +0 -17
  581. package/dist/extra/index.js +0 -1
  582. package/dist/extra/node.cjs +0 -2
  583. package/dist/extra/node.js +0 -2
  584. package/dist/extra/operators.cjs +0 -1
  585. package/dist/extra/operators.d.cts +0 -958
  586. package/dist/extra/operators.d.ts +0 -958
  587. package/dist/extra/operators.js +0 -1
  588. package/dist/extra/reactive.cjs +0 -1
  589. package/dist/extra/reactive.d.cts +0 -353
  590. package/dist/extra/reactive.d.ts +0 -353
  591. package/dist/extra/reactive.js +0 -1
  592. package/dist/extra/render/index.cjs +0 -5
  593. package/dist/extra/render/index.js +0 -1
  594. package/dist/extra/sources.cjs +0 -3
  595. package/dist/extra/sources.js +0 -1
  596. package/dist/extra/storage-browser.cjs +0 -1
  597. package/dist/extra/storage-browser.d.cts +0 -37
  598. package/dist/extra/storage-browser.d.ts +0 -37
  599. package/dist/extra/storage-browser.js +0 -1
  600. package/dist/extra/storage-core.cjs +0 -1
  601. package/dist/extra/storage-core.d.cts +0 -28
  602. package/dist/extra/storage-core.d.ts +0 -28
  603. package/dist/extra/storage-core.js +0 -1
  604. package/dist/extra/storage-node.cjs +0 -1
  605. package/dist/extra/storage-node.d.cts +0 -2
  606. package/dist/extra/storage-node.d.ts +0 -2
  607. package/dist/extra/storage-node.js +0 -0
  608. package/dist/extra/storage-tiers-browser.cjs +0 -1
  609. package/dist/extra/storage-tiers-browser.d.cts +0 -120
  610. package/dist/extra/storage-tiers-browser.d.ts +0 -120
  611. package/dist/extra/storage-tiers-browser.js +0 -1
  612. package/dist/extra/storage-tiers-node.cjs +0 -1
  613. package/dist/extra/storage-tiers-node.d.cts +0 -210
  614. package/dist/extra/storage-tiers-node.d.ts +0 -210
  615. package/dist/extra/storage-tiers-node.js +0 -1
  616. package/dist/extra/storage-tiers.cjs +0 -1
  617. package/dist/extra/storage-tiers.d.cts +0 -412
  618. package/dist/extra/storage-tiers.d.ts +0 -412
  619. package/dist/extra/storage-tiers.js +0 -1
  620. package/dist/graph/index.cjs +0 -7
  621. package/dist/graph/index.d.cts +0 -7
  622. package/dist/graph/index.d.ts +0 -7
  623. package/dist/graph/index.js +0 -1
  624. package/dist/graph-CWvEUQAq.d.cts +0 -1861
  625. package/dist/graph-D9LFnda9.d.ts +0 -1861
  626. package/dist/index-5k1T6jl0.d.cts +0 -121
  627. package/dist/index-9770hRuQ.d.cts +0 -779
  628. package/dist/index-B1F8Enjf.d.ts +0 -704
  629. package/dist/index-BHskSB8v.d.ts +0 -3413
  630. package/dist/index-BIYAkbAi.d.cts +0 -26
  631. package/dist/index-BoJ5JHxI.d.ts +0 -557
  632. package/dist/index-BocU7pqs.d.ts +0 -779
  633. package/dist/index-BxNs2HB9.d.cts +0 -1858
  634. package/dist/index-C1T3d7V-.d.cts +0 -704
  635. package/dist/index-C5ri2Axc.d.cts +0 -301
  636. package/dist/index-C9l6OEBL.d.ts +0 -26
  637. package/dist/index-CC-AvFTy.d.cts +0 -557
  638. package/dist/index-CJF1URuX.d.ts +0 -121
  639. package/dist/index-CdTelp1M.d.ts +0 -202
  640. package/dist/index-Cj3WohTd.d.cts +0 -202
  641. package/dist/index-Co7uli2l.d.cts +0 -3413
  642. package/dist/index-D0aciIex.d.cts +0 -209
  643. package/dist/index-DHen9Klo.d.ts +0 -1858
  644. package/dist/index-Yq60JP3s.d.ts +0 -209
  645. package/dist/index-nozs3fFC.d.ts +0 -301
  646. package/dist/node-kK3CvTrR.d.cts +0 -1347
  647. package/dist/node-kK3CvTrR.d.ts +0 -1347
  648. package/dist/patterns/ai/browser.cjs +0 -8
  649. package/dist/patterns/ai/browser.js +0 -3
  650. package/dist/patterns/ai/index.cjs +0 -74
  651. package/dist/patterns/ai/index.d.cts +0 -20
  652. package/dist/patterns/ai/index.d.ts +0 -20
  653. package/dist/patterns/ai/index.js +0 -1
  654. package/dist/patterns/ai/node.cjs +0 -1
  655. package/dist/patterns/ai/node.js +0 -1
  656. package/dist/patterns/cqrs/index.cjs +0 -3
  657. package/dist/patterns/cqrs/index.d.cts +0 -8
  658. package/dist/patterns/cqrs/index.d.ts +0 -8
  659. package/dist/patterns/cqrs/index.js +0 -1
  660. package/dist/patterns/demo-shell/index.cjs +0 -5
  661. package/dist/patterns/demo-shell/index.d.cts +0 -7
  662. package/dist/patterns/demo-shell/index.d.ts +0 -7
  663. package/dist/patterns/demo-shell/index.js +0 -1
  664. package/dist/patterns/domain-templates/index.cjs +0 -3
  665. package/dist/patterns/domain-templates/index.d.cts +0 -6
  666. package/dist/patterns/domain-templates/index.d.ts +0 -6
  667. package/dist/patterns/domain-templates/index.js +0 -1
  668. package/dist/patterns/graphspec/index.cjs +0 -86
  669. package/dist/patterns/graphspec/index.d.cts +0 -8
  670. package/dist/patterns/graphspec/index.d.ts +0 -8
  671. package/dist/patterns/graphspec/index.js +0 -1
  672. package/dist/patterns/harness/index.cjs +0 -48
  673. package/dist/patterns/harness/index.d.cts +0 -13
  674. package/dist/patterns/harness/index.d.ts +0 -13
  675. package/dist/patterns/harness/index.js +0 -1
  676. package/dist/patterns/inspect/index.cjs +0 -3
  677. package/dist/patterns/inspect/index.d.cts +0 -9
  678. package/dist/patterns/inspect/index.d.ts +0 -9
  679. package/dist/patterns/inspect/index.js +0 -1
  680. package/dist/patterns/job-queue/index.cjs +0 -3
  681. package/dist/patterns/job-queue/index.d.cts +0 -9
  682. package/dist/patterns/job-queue/index.d.ts +0 -9
  683. package/dist/patterns/job-queue/index.js +0 -1
  684. package/dist/patterns/memory/index.cjs +0 -3
  685. package/dist/patterns/memory/index.d.cts +0 -8
  686. package/dist/patterns/memory/index.d.ts +0 -8
  687. package/dist/patterns/memory/index.js +0 -1
  688. package/dist/patterns/messaging/index.cjs +0 -3
  689. package/dist/patterns/messaging/index.d.cts +0 -7
  690. package/dist/patterns/messaging/index.d.ts +0 -7
  691. package/dist/patterns/messaging/index.js +0 -1
  692. package/dist/patterns/orchestration/index.cjs +0 -3
  693. package/dist/patterns/orchestration/index.d.cts +0 -8
  694. package/dist/patterns/orchestration/index.d.ts +0 -8
  695. package/dist/patterns/orchestration/index.js +0 -1
  696. package/dist/patterns/process/index.cjs +0 -3
  697. package/dist/patterns/process/index.d.cts +0 -10
  698. package/dist/patterns/process/index.d.ts +0 -10
  699. package/dist/patterns/process/index.js +0 -1
  700. package/dist/patterns/reactive-layout/index.cjs +0 -4
  701. package/dist/patterns/reactive-layout/index.d.cts +0 -7
  702. package/dist/patterns/reactive-layout/index.d.ts +0 -7
  703. package/dist/patterns/reactive-layout/index.js +0 -1
  704. package/dist/patterns/reduction/index.cjs +0 -3
  705. package/dist/patterns/reduction/index.d.cts +0 -6
  706. package/dist/patterns/reduction/index.d.ts +0 -6
  707. package/dist/patterns/reduction/index.js +0 -1
  708. package/dist/patterns/surface/index.cjs +0 -13
  709. package/dist/patterns/surface/index.d.cts +0 -9
  710. package/dist/patterns/surface/index.d.ts +0 -9
  711. package/dist/patterns/surface/index.js +0 -1
  712. package/dist/reactive-log-BKALbfal.d.ts +0 -223
  713. package/dist/reactive-log-DIGdYqQ6.d.cts +0 -223
  714. package/dist/reactive-map-CEFGp8TK.d.cts +0 -296
  715. package/dist/reactive-map-DS_SIAxv.d.ts +0 -296
  716. package/dist/resilience-6LYQJAC5.js +0 -1
  717. package/dist/sugar-DQjFmVqb.d.cts +0 -399
  718. package/dist/sugar-fhLIE7TT.d.ts +0 -399
  719. package/dist/topology-tree-Bcz27hpF.d.cts +0 -25
  720. package/dist/topology-tree-xvaD0fOX.d.ts +0 -25
@@ -1,20 +0,0 @@
1
- export { e as CapabilitiesRegistry, C as ChatMessage, L as LLMAdapter, a as LLMInvokeOptions, b as LLMResponse, M as ModelCapabilities, f as ModelFeatures, g as ModelLimits, h as ModelPricing, i as PriceBreakdown, P as PricingFn, j as PricingRegistry, R as Rate, S as StreamDelta, k as TieredRate, T as TokenUsage, c as ToolCall, d as ToolDefinition, l as composePricing, m as computePrice, n as createCapabilitiesRegistry, o as createPricingRegistry, p as pricingFor, r as registryPricing, z as zeroPrice } from '../../types-C0_yquda.cjs';
2
- export { A as AdapterProvider, b as AdapterTier, d as AllTiersExhaustedError, a as CascadeExhaustionReport, C as CascadingLlmAdapterOptions, e as CreateAdapterOptions, O as OpenAICompatAdapterOptions, f as OpenAICompatPreset, g as OpenAISdkLike, h as cascadingLlmAdapter, c as createAdapter, o as openAICompatAdapter, t as tier } from '../../cascading-BglDkMdX.cjs';
3
- export { A as AdapterStats, a as AdmissionScore3DOptions, b as AdmissionScoredOptions, c as AdmissionScores, d as AdmissionThresholds, e as AgentLoopGraph, f as AgentLoopOptions, g as AgentLoopStatus, h as AgentMemoryGraph, j as AgentMemoryOptions, k as AnthropicAdapterOptions, l as AnthropicSdkLike, B as BudgetCaps, m as BudgetExhaustedError, n as BudgetGateBundle, o as BudgetTotals, C as CallStatsEvent, p as ChatStreamGraph, q as ChatStreamOptions, r as ContentDecision, s as ContentGateOptions, t as CostMeterOptions, u as CostMeterReading, D as DryRunAdapterOptions, E as ExtractedToolCall, F as FrozenContextOptions, G as GatedStreamHandle, v as GatedStreamOptions, w as GaugesAsContextOptions, x as GoogleAdapterOptions, y as GoogleSdkLike, z as GoogleSdkRequestConfig, H as GoogleSdkRequestParams, I as GraphDefValidation, J as GraphFromSpecOptions, K as HandoffOptions, L as HttpErrorLike, M as KeywordFlag, N as KeywordFlagExtractorOptions, O as KnobsAsToolsResult, P as LLMConsolidatorOptions, Q as LLMExtractorOptions, R as LLMTimeoutError, S as McpToolSchema, T as MemoryRetrievalBundle, U as MemoryRetrievalOptions, V as MemoryTier, W as MemoryTiersBundle, X as MemoryTiersOptions, Y as MemoryWithKGOptions, Z as MemoryWithTiersOptions, _ as MemoryWithVectorsOptions, $ as OpenAIToolSchema, a0 as PromptCallOptions, a1 as PromptNodeOptions, a2 as RedactorOptions, a3 as ResilientAdapterBundle, a4 as ResilientAdapterOptions, a5 as RetrievalEntry, a6 as RetrievalPipelineOptions, a7 as RetrievalQuery, a8 as RetrievalTrace, a9 as StampedDelta, aa as StrategyOperation, ab as StrategyPlan, ac as StreamingPromptNodeHandle, ad as StreamingPromptNodeOptions, ae as SuggestStrategyOptions, af as SystemPromptHandle, ag as ToolExecutionOptions, ah as ToolRegistryGraph, ai as ToolRegistryOptions, aj as ToolResult, ak as ToolSelectorOptions, al as WithBreakerOptions, am as WithBudgetGateOptions, an as WithDryRunBundle, ao as WithDryRunOptions, ap as WithRateLimiterOptions, aq as WithRetryOptions, ar as admissionFilter3D, as as admissionScored, at as agentLoop, au as agentMemory, av as anthropicAdapter, aw as chatStream, ax as contentGate, ay as costMeterExtractor, az as dryRunAdapter, aA as frozenContext, aB as gatedStream, aC as gaugesAsContext, aD as googleAdapter, aE as graphFromSpec, aF as graphFromSpecReactive, aG as handoff, aH as keywordFlagExtractor, aI as knobsAsTools, aJ as llmConsolidator, aK as llmExtractor, aL as memoryRetrieval, aM as memoryWithKG, aN as memoryWithTiers, aO as memoryWithVectors, aP as observableAdapter, aQ as parseRateLimitFromError, aR as promptCall, aS as promptNode, aT as redactor, aU as resilientAdapter, aV as streamExtractor, aW as streamingPromptNode, aX as suggestStrategy, aY as suggestStrategyReactive, aZ as systemPromptBuilder, a_ as toolCallExtractor, a$ as toolExecution, b0 as toolRegistry, b1 as toolSelector, b2 as validateGraphDef, b3 as withBreaker, b4 as withBudgetGate, b5 as withDryRun, b6 as withRateLimiter, b7 as withRetry, b8 as withTimeout } from '../../index-UPSiS-X7.cjs';
4
- export { F as FallbackAdapterOptions, a as FallbackFixture, b as FallbackMissError, c as FallbackMissPolicy, R as ReplayCacheKeyContext, d as ReplayCacheMissError, e as ReplayCacheMode, W as WithReplayCacheOptions, f as canonicalJson, g as fallbackAdapter, w as withReplayCache } from '../../fallback-74oxi34l.cjs';
5
- export { c as CircuitOpenError } from '../../index-C1T3d7V-.cjs';
6
- export { f as DEFAULT_DECAY_RATE } from '../../decay-CFlLvXUT.cjs';
7
- import '../../node-kK3CvTrR.cjs';
8
- import '../../extra/sources.cjs';
9
- import '../../reactive-log-DIGdYqQ6.cjs';
10
- import '../../extra/storage-tiers.cjs';
11
- import '../../graph-CWvEUQAq.cjs';
12
- import '../../sugar-DQjFmVqb.cjs';
13
- import '../../extra/storage-core.cjs';
14
- import '../../index-C5ri2Axc.cjs';
15
- import '../../pipeline-graph-CIKhynsF.cjs';
16
- import '../../index-D0aciIex.cjs';
17
- import '../../index-B17QddL1.cjs';
18
- import '../../index-CS0LTlB8.cjs';
19
- import '../../content-addressed-storage-4-ST1tYk.cjs';
20
- import '../../reactive-map-CEFGp8TK.cjs';
@@ -1,20 +0,0 @@
1
- export { e as CapabilitiesRegistry, C as ChatMessage, L as LLMAdapter, a as LLMInvokeOptions, b as LLMResponse, M as ModelCapabilities, f as ModelFeatures, g as ModelLimits, h as ModelPricing, i as PriceBreakdown, P as PricingFn, j as PricingRegistry, R as Rate, S as StreamDelta, k as TieredRate, T as TokenUsage, c as ToolCall, d as ToolDefinition, l as composePricing, m as computePrice, n as createCapabilitiesRegistry, o as createPricingRegistry, p as pricingFor, r as registryPricing, z as zeroPrice } from '../../types-CWFysE9E.js';
2
- export { A as AdapterProvider, b as AdapterTier, d as AllTiersExhaustedError, a as CascadeExhaustionReport, C as CascadingLlmAdapterOptions, e as CreateAdapterOptions, O as OpenAICompatAdapterOptions, f as OpenAICompatPreset, g as OpenAISdkLike, h as cascadingLlmAdapter, c as createAdapter, o as openAICompatAdapter, t as tier } from '../../cascading-MFgxu7Yo.js';
3
- export { A as AdapterStats, a as AdmissionScore3DOptions, b as AdmissionScoredOptions, c as AdmissionScores, d as AdmissionThresholds, e as AgentLoopGraph, f as AgentLoopOptions, g as AgentLoopStatus, h as AgentMemoryGraph, j as AgentMemoryOptions, k as AnthropicAdapterOptions, l as AnthropicSdkLike, B as BudgetCaps, m as BudgetExhaustedError, n as BudgetGateBundle, o as BudgetTotals, C as CallStatsEvent, p as ChatStreamGraph, q as ChatStreamOptions, r as ContentDecision, s as ContentGateOptions, t as CostMeterOptions, u as CostMeterReading, D as DryRunAdapterOptions, E as ExtractedToolCall, F as FrozenContextOptions, G as GatedStreamHandle, v as GatedStreamOptions, w as GaugesAsContextOptions, x as GoogleAdapterOptions, y as GoogleSdkLike, z as GoogleSdkRequestConfig, H as GoogleSdkRequestParams, I as GraphDefValidation, J as GraphFromSpecOptions, K as HandoffOptions, L as HttpErrorLike, M as KeywordFlag, N as KeywordFlagExtractorOptions, O as KnobsAsToolsResult, P as LLMConsolidatorOptions, Q as LLMExtractorOptions, R as LLMTimeoutError, S as McpToolSchema, T as MemoryRetrievalBundle, U as MemoryRetrievalOptions, V as MemoryTier, W as MemoryTiersBundle, X as MemoryTiersOptions, Y as MemoryWithKGOptions, Z as MemoryWithTiersOptions, _ as MemoryWithVectorsOptions, $ as OpenAIToolSchema, a0 as PromptCallOptions, a1 as PromptNodeOptions, a2 as RedactorOptions, a3 as ResilientAdapterBundle, a4 as ResilientAdapterOptions, a5 as RetrievalEntry, a6 as RetrievalPipelineOptions, a7 as RetrievalQuery, a8 as RetrievalTrace, a9 as StampedDelta, aa as StrategyOperation, ab as StrategyPlan, ac as StreamingPromptNodeHandle, ad as StreamingPromptNodeOptions, ae as SuggestStrategyOptions, af as SystemPromptHandle, ag as ToolExecutionOptions, ah as ToolRegistryGraph, ai as ToolRegistryOptions, aj as ToolResult, ak as ToolSelectorOptions, al as WithBreakerOptions, am as WithBudgetGateOptions, an as WithDryRunBundle, ao as WithDryRunOptions, ap as WithRateLimiterOptions, aq as WithRetryOptions, ar as admissionFilter3D, as as admissionScored, at as agentLoop, au as agentMemory, av as anthropicAdapter, aw as chatStream, ax as contentGate, ay as costMeterExtractor, az as dryRunAdapter, aA as frozenContext, aB as gatedStream, aC as gaugesAsContext, aD as googleAdapter, aE as graphFromSpec, aF as graphFromSpecReactive, aG as handoff, aH as keywordFlagExtractor, aI as knobsAsTools, aJ as llmConsolidator, aK as llmExtractor, aL as memoryRetrieval, aM as memoryWithKG, aN as memoryWithTiers, aO as memoryWithVectors, aP as observableAdapter, aQ as parseRateLimitFromError, aR as promptCall, aS as promptNode, aT as redactor, aU as resilientAdapter, aV as streamExtractor, aW as streamingPromptNode, aX as suggestStrategy, aY as suggestStrategyReactive, aZ as systemPromptBuilder, a_ as toolCallExtractor, a$ as toolExecution, b0 as toolRegistry, b1 as toolSelector, b2 as validateGraphDef, b3 as withBreaker, b4 as withBudgetGate, b5 as withDryRun, b6 as withRateLimiter, b7 as withRetry, b8 as withTimeout } from '../../index-CR8QpwX8.js';
4
- export { F as FallbackAdapterOptions, a as FallbackFixture, b as FallbackMissError, c as FallbackMissPolicy, R as ReplayCacheKeyContext, d as ReplayCacheMissError, e as ReplayCacheMode, W as WithReplayCacheOptions, f as canonicalJson, g as fallbackAdapter, w as withReplayCache } from '../../fallback-DUyyBTBK.js';
5
- export { c as CircuitOpenError } from '../../index-B1F8Enjf.js';
6
- export { f as DEFAULT_DECAY_RATE } from '../../decay-BvOWTZ00.js';
7
- import '../../node-kK3CvTrR.js';
8
- import '../../extra/sources.js';
9
- import '../../reactive-log-BKALbfal.js';
10
- import '../../extra/storage-tiers.js';
11
- import '../../graph-D9LFnda9.js';
12
- import '../../sugar-fhLIE7TT.js';
13
- import '../../extra/storage-core.js';
14
- import '../../index-nozs3fFC.js';
15
- import '../../pipeline-graph-Sgj0gCwn.js';
16
- import '../../index-Yq60JP3s.js';
17
- import '../../index-CZ3r5Rxp.js';
18
- import '../../index-CMh5Rz1y.js';
19
- import '../../content-addressed-storage-DuYMjV7o.js';
20
- import '../../reactive-map-DS_SIAxv.js';
@@ -1 +0,0 @@
1
- import{$ as ma,A as N,B as O,C as P,D as Q,E as R,F as S,G as T,H as U,I as V,J as W,K as X,L as Y,M as Z,N as _,O as $,P as aa,Q as ba,R as ca,S as da,T as ea,U as fa,V as ga,W as ha,X as ia,Y as ja,Z as ka,_ as la,a as c,aa as na,b as n,ba as oa,c as o,ca as pa,d as p,e as q,f as r,g as s,h as t,i as u,j as v,k as w,l as x,m as y,n as z,o as D,p as E,q as F,r as G,u as H,v as I,w as J,x as K,y as L,z as M}from"../../chunk-UNGSTR4X.js";import"../../chunk-CE6TI2TL.js";import"../../chunk-OIVP6KFV.js";import"../../chunk-ZKPSFFKU.js";import{a as d,b as k,c as l,d as m,e as A,f as B,g as C}from"../../chunk-OYQOZP2F.js";import{a as e,g as f,h as g,i as h,j as i,k as j}from"../../chunk-OPHBU3LG.js";import"../../chunk-APPIWSGD.js";import"../../chunk-Z4NPUARF.js";import"../../chunk-KZIEYVXN.js";import"../../chunk-PTZK576G.js";import{a as b}from"../../chunk-TSOYJ743.js";import"../../chunk-N4MQX6JU.js";import{e as a}from"../../chunk-D7GPHKFH.js";import"../../chunk-WJR24TAG.js";import"../../chunk-W3I423PS.js";import"../../chunk-L6NSJVJZ.js";import"../../chunk-2T7U5EU6.js";import"../../chunk-3G5U5QNE.js";import"../../chunk-C72GO4IZ.js";import"../../chunk-HITNVN6B.js";import"../../chunk-ESMPEKEV.js";import"../../chunk-D5RFJOZ2.js";import"../../chunk-CE72X3WO.js";import"../../chunk-CLVB32RD.js";import"../../chunk-4VVTGLXJ.js";import"../../chunk-GHBWHMRZ.js";import"../../chunk-BEZWM2SY.js";import"../../chunk-YBB7ZGTY.js";import"../../chunk-CRVT7D2P.js";import"../../chunk-NTEURFZH.js";import"../../chunk-CK2E7BTU.js";import"../../chunk-QYADASLV.js";export{ga as AgentLoopGraph,A as AllTiersExhaustedError,v as BudgetExhaustedError,V as ChatStreamGraph,a as CircuitOpenError,b as DEFAULT_DECAY_RATE,i as FallbackMissError,E as LLMTimeoutError,f as ReplayCacheMissError,Z as ToolRegistryGraph,ba as admissionFilter3D,aa as admissionScored,ha as agentLoop,ia as agentMemory,d as anthropicAdapter,h as canonicalJson,B as cascadingLlmAdapter,W as chatStream,s as composePricing,p as computePrice,T as contentGate,P as costMeterExtractor,m as createAdapter,c as createCapabilitiesRegistry,q as createPricingRegistry,e as dryRunAdapter,j as fallbackAdapter,H as frozenContext,N as gatedStream,ja as gaugesAsContext,k as googleAdapter,ka as graphFromSpec,la as graphFromSpecReactive,X as handoff,Q as keywordFlagExtractor,ma as knobsAsTools,L as llmConsolidator,K as llmExtractor,fa as memoryRetrieval,da as memoryWithKG,ea as memoryWithTiers,ca as memoryWithVectors,n as observableAdapter,l as openAICompatAdapter,y as parseRateLimitFromError,t as pricingFor,J as promptCall,I as promptNode,U as redactor,r as registryPricing,G as resilientAdapter,R as streamExtractor,M as streamingPromptNode,na as suggestStrategy,oa as suggestStrategyReactive,O as systemPromptBuilder,C as tier,S as toolCallExtractor,Y as toolExecution,_ as toolRegistry,$ as toolSelector,pa as validateGraphDef,u as withBreaker,w as withBudgetGate,x as withDryRun,z as withRateLimiter,g as withReplayCache,D as withRetry,F as withTimeout,o as zeroPrice};
@@ -1 +0,0 @@
1
- "use strict";var ce=Object.defineProperty;var xt=Object.getOwnPropertyDescriptor;var At=Object.getOwnPropertyNames;var St=Object.prototype.hasOwnProperty;var k=(t,e)=>()=>(t&&(e=t(t=0)),e);var Mt=(t,e)=>{for(var n in e)ce(t,n,{get:e[n],enumerable:!0})},Nt=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of At(e))!St.call(t,o)&&o!==n&&ce(t,o,{get:()=>e[o],enumerable:!(r=xt(e,o))||r.enumerable});return t};var Et=t=>Nt(ce({},"__esModule",{value:!0}),t);function Re(){return Math.trunc(performance.now()*1e6)}function D(){return Date.now()*1e6}var Y=k(()=>{"use strict"});var G,A,O,L,I,V,$,R,S,y,H,ye,Dt,me,It,Vt,be,De,Ie,Ve,ve,X=k(()=>{"use strict";G=Symbol.for("graphrefly/START"),A=Symbol.for("graphrefly/DATA"),O=Symbol.for("graphrefly/DIRTY"),L=Symbol.for("graphrefly/RESOLVED"),I=Symbol.for("graphrefly/INVALIDATE"),V=Symbol.for("graphrefly/PAUSE"),$=Symbol.for("graphrefly/RESUME"),R=Symbol.for("graphrefly/TEARDOWN"),S=Symbol.for("graphrefly/COMPLETE"),y=Symbol.for("graphrefly/ERROR"),H=Object.freeze([O]),ye=Object.freeze([L]),Dt=Object.freeze([I]),me=Object.freeze([G]),It=Object.freeze([S]),Vt=Object.freeze([R]),be=Object.freeze([H]),De=Object.freeze([ye]),Ie=Object.freeze([Dt]),Ve=Object.freeze([It]),ve=Object.freeze([Vt])});function Ge(t){t.registerCodec(Gt)}var Gt,He=k(()=>{"use strict";Gt={name:"json",version:1,contentType:"application/json",encode(t){let e=JSON.stringify(t);return new TextEncoder().encode(e)},decode(t,e){let n=new TextDecoder().decode(t);return JSON.parse(n)}}});function Z(t){if(t==null)return Ht;let{type:e,id:n,...r}=t;return{type:e??"system",id:n??"",...r}}var Ht,Ue=k(()=>{"use strict";Ht={type:"system",id:""}});function We(){return Te>0||Ut}function $e(){return Te>0}function ze(t){Te>0?jt.push(t):t()}function Q(t,e,n){if(e.length===0)return;if(e.length===1){let c=n(e[0][0]);if(c<3||!We()){t(e);return}(c>=5?Be:c===4?Ke:je).push(()=>t(e));return}let r=e.length,o=r,i=r,d=r,s=0;for(;s<r&&n(e[s][0])<3;)s++;for(o=s;s<r&&n(e[s][0])===3;)s++;for(i=s;s<r&&n(e[s][0])===4;)s++;d=s;let a=We();if(o>0){let c=e.slice(0,o);t(c)}if(i>o){let c=e.slice(o,i);a?je.push(()=>t(c)):t(c)}if(d>i){let c=e.slice(i,d);a?Ke.push(()=>t(c)):t(c)}if(r>d){let c=e.slice(d,r);a?Be.push(()=>t(c)):t(c)}}var Te,Ut,je,Ke,Be,jt,qe=k(()=>{"use strict";Te=0,Ut=!1,je=[],Ke=[],Be=[],jt=[]});function Ye(t){t.registerMessageType(G,{tier:0,wireCrossing:!1}),t.registerMessageType(O,{tier:1,wireCrossing:!1}),t.registerMessageType(I,{tier:1,wireCrossing:!1,metaPassthrough:!1}),t.registerMessageType(V,{tier:2,wireCrossing:!1}),t.registerMessageType($,{tier:2,wireCrossing:!1}),t.registerMessageType(A,{tier:3,wireCrossing:!0}),t.registerMessageType(L,{tier:3,wireCrossing:!0}),t.registerMessageType(S,{tier:4,wireCrossing:!0,metaPassthrough:!1}),t.registerMessageType(y,{tier:4,wireCrossing:!0,metaPassthrough:!1}),t.registerMessageType(R,{tier:5,wireCrossing:!0,metaPassthrough:!1})}var ee,Je=k(()=>{"use strict";X();ee=class{_messageTypes=new Map;_codecs=new Map;_onMessage;_onSubscribe;_defaultVersioning;_defaultHashFn;_inspectorEnabled=!(typeof process<"u"&&process.env?.NODE_ENV==="production");_globalInspector;_rigorRecorder;_frozen=!1;tierOf;constructor(e){this._onMessage=e.onMessage,this._onSubscribe=e.onSubscribe,this._defaultVersioning=e.defaultVersioning,this._defaultHashFn=e.defaultHashFn,this.tierOf=n=>{let r=this._messageTypes.get(n);return r!=null?r.tier:1}}get onMessage(){return this._frozen=!0,this._onMessage}get onSubscribe(){return this._frozen=!0,this._onSubscribe}set onMessage(e){this._assertUnfrozen(),this._onMessage=e}set onSubscribe(e){this._assertUnfrozen(),this._onSubscribe=e}get defaultVersioning(){return this._defaultVersioning}set defaultVersioning(e){this._assertUnfrozen(),this._defaultVersioning=e}get defaultHashFn(){return this._defaultHashFn}set defaultHashFn(e){this._assertUnfrozen(),this._defaultHashFn=e}get inspectorEnabled(){return this._inspectorEnabled}set inspectorEnabled(e){this._inspectorEnabled=e}get globalInspector(){return this._globalInspector}set globalInspector(e){this._globalInspector=e}get rigorRecorder(){return this._rigorRecorder}set rigorRecorder(e){this._rigorRecorder=e}registerMessageType(e,n){return this._assertUnfrozen(),this._messageTypes.set(e,{tier:n.tier,wireCrossing:n.wireCrossing??n.tier>=3,metaPassthrough:n.metaPassthrough??!0}),this}messageTier(e){let n=this._messageTypes.get(e);return n!=null?n.tier:1}isWireCrossing(e){let n=this._messageTypes.get(e);return n!=null?n.wireCrossing:!0}isLocalOnly(e){return!this.isWireCrossing(e)}isMetaPassthrough(e){let n=this._messageTypes.get(e);return n!=null?n.metaPassthrough:!0}isKnownMessageType(e){return this._messageTypes.has(e)}registerCodec(e){return this._assertUnfrozen(),this._codecs.set(e.name,e),this}lookupCodec(e){return this._codecs.get(e)}_isFrozen(){return this._frozen}_assertUnfrozen(){if(this._frozen)throw new Error("GraphReFlyConfig is frozen: a node has already captured this config. Register custom types and set hooks before creating any node.")}}});var U,Xe=k(()=>{"use strict";U=class extends Error{actor;action;nodeName;constructor(e,n){super(n??`GuardDenied: action "${String(e.action)}" denied for actor type "${String(e.actor.type)}"`),this.name="GuardDenied",this.actor=e.actor,this.action=e.action,this.nodeName=e.nodeName}get node(){return this.nodeName}}});function _e(t){if(t===void 0)return null;if(typeof t=="number"){if(!Number.isFinite(t))throw new TypeError(`Cannot hash non-finite number: ${t}`);if(Number.isInteger(t)&&!Number.isSafeInteger(t))throw new TypeError(`Cannot hash integer outside safe range (|n| > 2^53-1): ${t}. Cross-language cid parity is not guaranteed for unsafe integers.`);return t}if(typeof t=="string"||typeof t=="boolean"||t===null)return t;if(Array.isArray(t))return t.map(_e);if(typeof t=="object"&&t!==null){let e={};for(let n of Object.keys(t).sort())e[n]=_e(t[n]);return e}return null}function Wt(t){let e=Bt.encode(t),n=e.length,r=n*8,o=n+9+63&-64,i=new Uint8Array(o);i.set(e),i[n]=128;let d=new DataView(i.buffer);d.setUint32(o-4,r>>>0,!1),d.setUint32(o-8,Math.floor(r/4294967296)>>>0,!1);let s=1779033703,a=3144134277,c=1013904242,l=2773480762,u=1359893119,p=2600822924,f=528734635,h=1541459225,m=new Uint32Array(64),v=(M,w)=>M>>>w|M<<32-w;for(let M=0;M<o;M+=64){for(let T=0;T<16;T++)m[T]=d.getUint32(M+T*4,!1);for(let T=16;T<64;T++){let B=m[T-15],W=m[T-2],q=v(B,7)^v(B,18)^B>>>3,de=v(W,17)^v(W,19)^W>>>10;m[T]=m[T-16]+q+m[T-7]+de>>>0}let w=s,E=a,N=c,g=l,b=u,C=p,F=f,ae=h;for(let T=0;T<64;T++){let B=v(b,6)^v(b,11)^v(b,25),W=b&C^~b&F,q=ae+B+W+Kt[T]+m[T]>>>0,de=v(w,2)^v(w,13)^v(w,22),wt=w&E^w&N^E&N,kt=de+wt>>>0;ae=F,F=C,C=b,b=g+q>>>0,g=N,N=E,E=w,w=q+kt>>>0}s=s+w>>>0,a=a+E>>>0,c=c+N>>>0,l=l+g>>>0,u=u+b>>>0,p=p+C>>>0,f=f+F>>>0,h=h+ae>>>0}let _=M=>M.toString(16).padStart(8,"0");return _(s)+_(a)+_(c)+_(l)+_(u)+_(p)+_(f)+_(h)}function we(t){let e=_e(t??null),n=JSON.stringify(e);return Wt(n).slice(0,16)}function $t(){let t=globalThis.crypto;if(t?.randomUUID)return t.randomUUID();let e=()=>Math.floor(Math.random()*4294967296).toString(16).padStart(8,"0"),n=e()+e()+e()+e();return`${n.slice(0,8)}-${n.slice(8,12)}-4${n.slice(13,16)}-${(parseInt(n.slice(16,17),16)&3|8).toString(16)}${n.slice(17,20)}-${n.slice(20,32)}`}function ke(t,e,n){let r=n?.id??$t();if(t===0)return{id:r,version:0};let i=(n?.hash??we)(e);return{id:r,version:0,cid:i,prev:null}}function Ze(t,e,n){t.version+=1,"cid"in t&&(t.prev=t.cid,t.cid=n(e))}var Kt,Bt,Qe=k(()=>{"use strict";Kt=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]),Bt=new TextEncoder});function nt(t){return{node:t,unsub:null,prevData:void 0,dirty:!1,involvedThisWave:!1,dataBatch:[],terminal:void 0}}function xe(t){t.prevData=void 0,t.dirty=!1,t.involvedThisWave=!1,t.dataBatch.length=0,t.terminal=void 0}function te(t){return t.length===0?t:typeof t[0]=="symbol"?[t]:t}function ot(t,e,n){let r=rt(t)?t:[],o=typeof t=="function"?t:typeof e=="function"?e:void 0,i={};return rt(t)?i=(Ae(e)?e:n)??{}:Ae(t)?i=t:i=(Ae(e)?e:n)??{},new ne(r,o,i)}var et,tt,zt,qt,Se,ne,rt,Ae,st=k(()=>{"use strict";He();Ue();qe();Y();Je();Xe();X();Qe();et=()=>{},tt=100;zt=(t,e,n,r)=>{n.direction==="down-in"&&t._onDepMessage(n.depIndex,e)},qt=(t,e,n,r)=>{let o=t;if(o._status==="completed"||o._status==="errored")return;let i=o._cached,d=i===void 0?[me]:[me,[A,i]];o._status==="dirty"&&d.push(H),Q(e,d,o._config.tierOf)},Se=new ee({onMessage:zt,onSubscribe:qt});Ye(Se);Ge(Se);ne=class t{_optsName;_describeKind;meta;_hasMeta;_config;_deps;_sinks=null;_sinkCount=0;_cached;_status;_cleanup;_store={};_waveHasNewData=!1;_hasNewTerminal=!1;_hasCalledFnOnce=!1;_paused=!1;_pendingWave=!1;_isExecutingFn=!1;_pendingRerun=!1;_rerunDepth=0;_dirtyDepCount=0;_batchPendingMessages=null;_pauseLocks=null;_pauseBuffer=null;_fn;_equals;_resubscribable;_resetOnTeardown;_autoComplete;_autoError;_pausable;_partial;_guard;_extraGuards;_hashFn;_versioning;_versioningLevel;_lastMutation;_inspectorHooks;_actions;constructor(e,n,r){this._config=r.config??Se,this._config.onMessage,this._optsName=r.name,this._describeKind=r.describeKind,this._equals=r.equals??Object.is,this._resubscribable=r.resubscribable??!1,this._resetOnTeardown=r.resetOnTeardown??!1,this._autoComplete=r.completeWhenDepsComplete??!0,this._autoError=r.errorWhenDepsError??!0,this._pausable=r.pausable??!0,this._guard=r.guard,this._fn=n,this._partial=r.partial??!1,this._cached=r.initial!==void 0?r.initial:void 0,this._status=e.length===0&&n==null&&this._cached!==void 0?"settled":"sentinel",this._hashFn=r.versioningHash??this._config.defaultHashFn??we;let o=r.versioning??this._config.defaultVersioning;this._versioningLevel=o,this._versioning=o!=null?ke(o,this._cached===void 0?void 0:this._cached,{id:r.versioningId,hash:this._hashFn}):void 0,this._deps=e.map(nt);let i={};for(let[s,a]of Object.entries(r.meta??{})){let c={initial:a,name:`${r.name??"node"}:meta:${s}`,describeKind:"state",config:this._config};r.guard!=null&&(c.guard=r.guard),r.resubscribable===!0&&(c.resubscribable=!0),i[s]=new t([],void 0,c)}Object.freeze(i),this.meta=i,this._hasMeta=Object.keys(i).length>0;let d=this;this._actions={emit(s){d._emit([[A,s]])},down(s){d._emit(te(s))},up(s){d._emitUp(te(s))}},this.down=this.down.bind(this),this.up=this.up.bind(this)}get _isTerminal(){return this._status==="completed"||this._status==="errored"}get name(){return this._optsName}get status(){return this._status}get cache(){return this._cached===void 0?void 0:this._cached}get lastMutation(){return this._lastMutation}get v(){return this._versioning}hasGuard(){return this._guard!=null}_applyVersioning(e,n){if(this._isExecutingFn)throw new Error(`Node "${this.name}": _applyVersioning cannot run mid-fn \u2014 call it outside of \`_execFn\` (typically at graph setup time before the first subscribe).`);let r=this._versioningLevel;if(r!=null&&e<=r)return;let o=n?.hash??this._hashFn;o!==this._hashFn&&(this._hashFn=o);let i=this._cached===void 0?void 0:this._cached,d=this._versioning,s=d?.id??n?.id,a=d?.version??0,c=ke(e,i,{id:s,hash:o});c.version=a,this._versioning=c,this._versioningLevel=e}_setInspectorHook(e){return e==null?()=>{}:(this._inspectorHooks==null&&(this._inspectorHooks=new Set),this._inspectorHooks.add(e),()=>{this._inspectorHooks?.delete(e),this._inspectorHooks?.size===0&&(this._inspectorHooks=void 0)})}_pushGuard(e){return this._extraGuards==null&&(this._extraGuards=new Set),this._extraGuards.add(e),()=>{this._extraGuards?.delete(e),this._extraGuards?.size===0&&(this._extraGuards=void 0)}}allowsObserve(e){if(this._guard==null&&this._extraGuards==null)return!0;let n=Z(e);if(this._guard!=null&&!this._guard(n,"observe"))return!1;if(this._extraGuards!=null){for(let r of this._extraGuards)if(!r(n,"observe"))return!1}return!0}_checkGuard(e){if(e?.internal)return;let n=this._guard!=null||this._extraGuards!=null,r=e?.actor!=null;if(!n&&!r)return;let o=Z(e?.actor),i=e?.delivery==="signal"?"signal":"write";if(this._guard!=null&&!this._guard(o,i))throw new U({actor:o,action:i,nodeName:this.name});if(this._extraGuards!=null){for(let d of this._extraGuards)if(!d(o,i))throw new U({actor:o,action:i,nodeName:this.name})}this._lastMutation={actor:o,timestamp_ns:D()}}down(e,n){let r=te(e);r.length!==0&&(this._checkGuard(n),this._emit(r))}emit(e,n){this._checkGuard(n),this._emit([[A,e]])}up(e,n){if(this._deps.length===0)return;let r=te(e);if(r.length===0)return;this._checkGuard(n);let o=n??{internal:!0};this._validateUpTiers(r);for(let i of this._deps)i.node.up?.(r,o)}_emitUp(e){if(this._deps.length!==0&&e.length!==0){this._validateUpTiers(e);for(let n of this._deps)n.node.up?.(e,{internal:!0})}}_validateUpTiers(e){let n=this._config.tierOf;for(let r of e){let o=n(r[0]);if(o===3||o===4)throw new Error(`Node "${this.name}": tier-${o} messages cannot flow up \u2014 DATA/RESOLVED/COMPLETE/ERROR are downstream-only. Use \`down(...)\` for value delivery; \`up(...)\` is for control signals (DIRTY, INVALIDATE, PAUSE, RESUME, TEARDOWN).`)}}subscribe(e,n){if(n!=null&&this._guard!=null){let a=Z(n);if(!this._guard(a,"observe"))throw new U({actor:a,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 a of this._deps)xe(a);if(this._partial===!1){for(let a of this._deps)if(a.prevData!==void 0||a.dataBatch.length!==0||a.terminal!==void 0||a.dirty)throw new Error(`resubscribable-reset invariant: DepRecord not fully reset for node ${this._optsName??"(anonymous)"}`)}}this._sinkCount+=1;let i;try{i=this._config.onSubscribe(this,e,{sinkCount:this._sinkCount,afterTerminalReset:o},this._actions)}catch(a){throw this._sinkCount-=1,a}this._sinks==null?this._sinks=e:typeof this._sinks=="function"?this._sinks=new Set([this._sinks,e]):this._sinks.add(e);let d=this._isTerminal;if(this._sinkCount===1&&!d)try{this._activate()}catch(a){if(this._sinkCount-=1,this._removeSink(e),this._sinkCount===0&&(this._status="sentinel"),typeof i=="function")try{i()}catch{}throw a}this._status==="sentinel"&&this._cached===void 0&&(this._status="pending");let s=!1;return()=>{s||(s=!0,this._sinkCount-=1,this._removeSink(e),typeof i=="function"&&i(),this._sinks==null&&this._deactivate())}}_removeSink(e){if(this._sinks===e)this._sinks=null;else if(this._sinks!=null&&typeof this._sinks!="function")if(this._sinks.delete(e),this._sinks.size===1){let[n]=this._sinks;this._sinks=n}else this._sinks.size===0&&(this._sinks=null)}_activate(){if(this._deps.length===0){this._fn&&this._execFn();return}this._dirtyDepCount=0;let e=this._deps.length,n=0;try{for(let r=0;r<e;r++){let o=r,i=this._deps[r];i.unsub=et,i.unsub=i.node.subscribe(d=>{if(i.unsub===null)return;let s=this._config.tierOf,a=!1;for(let c of d)s(c[0])>=3&&(a=!0),this._config.onMessage(this,c,{direction:"down-in",depIndex:o},this._actions);a&&this._maybeRunFnOnSettlement()}),n++}}catch(r){this._deps[n].unsub=null;for(let o=0;o<n;o++){let i=this._deps[o];if(i.unsub!=null){let d=i.unsub;i.unsub=null;try{d()}catch{}xe(i)}}throw this._dirtyDepCount=0,r}}_addDep(e){for(let o=0;o<this._deps.length;o++)if(this._deps[o].node===e)return o;let n=this._deps.length,r=nt(e);if(this._deps.push(r),this._sinks==null)return n;r.dirty=!0,this._dirtyDepCount++,this._status!=="dirty"&&this._emit(be),r.unsub=et;try{r.unsub=e.subscribe(o=>{if(r.unsub===null)return;let i=this._config.tierOf,d=!1;for(let s of o)i(s[0])>=3&&(d=!0),this._config.onMessage(this,s,{direction:"down-in",depIndex:n},this._actions);d&&this._maybeRunFnOnSettlement()})}catch(o){throw r.unsub=null,this._deps.pop(),this._dirtyDepCount--,o}return n}_deactivate(e=!1){let n=this._cleanup;if(this._cleanup=void 0,typeof n=="function")try{n()}catch(r){this._emit([[y,this._wrapFnError("cleanup threw",r)]])}else if(n!=null&&typeof n=="object"){let r=n.deactivate;if(typeof r=="function")try{r()}catch(o){this._emit([[y,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{}}xe(r)}this._waveHasNewData=!1,this._hasNewTerminal=!1,this._hasCalledFnOnce=!1,this._paused=!1,this._pendingWave=!1,this._pendingRerun=!1,this._rerunDepth=0,this._store={},this._dirtyDepCount=0,this._pauseLocks=null,this._pauseBuffer=null,this._fn!=null&&(this._cached=void 0),e||(this._fn!=null||this._deps.length>0)&&(!this._isTerminal||this._resubscribable)&&(this._status="sentinel")}_onDepMessage(e,n){let r=this._deps[e],o=n[0];if(this._inspectorHooks!=null){let i={kind:"dep_message",depIndex:e,message:n};for(let d of this._inspectorHooks)d(i)}if(o!==G){if(o===O){this._depDirtied(r);return}if(o===I){if(this._depInvalidated(r),this._cached===void 0)return;this._emit(Ie);return}if(o===V||o===$){this._emit([n]);return}if(o===R){this._emit(ve);return}if(o===A)this._depSettledAsData(r,n[1]);else if(o===L)this._depSettledAsResolved(r);else if(o===S)this._depSettledAsTerminal(r,!0);else if(o===y)this._depSettledAsTerminal(r,n[1]);else{this._emit([n]);return}if(!this._fn){(o===A||o===L)&&this._emit([n]),(o===S||o===y)&&this._maybeAutoTerminalAfterWave();return}}}_depDirtied(e){e.dirty||(e.dirty=!0,e.involvedThisWave=!0,this._dirtyDepCount++,this._status!=="dirty"&&this._emit(be))}_depSettledAsData(e,n){e.dirty&&(e.dirty=!1,this._dirtyDepCount--),e.involvedThisWave=!0,e.dataBatch.push(n),this._waveHasNewData=!0}_depSettledAsResolved(e){e.dirty&&(e.dirty=!1,this._dirtyDepCount--)}_depSettledAsTerminal(e,n){e.dirty&&(e.dirty=!1,this._dirtyDepCount--),e.terminal=n,e.involvedThisWave=!0,this._hasNewTerminal=!0}_depInvalidated(e){e.prevData=void 0,e.terminal=void 0,e.dataBatch.length=0,e.dirty?e.involvedThisWave=!1:(e.dirty=!0,e.involvedThisWave=!0,this._dirtyDepCount++)}_maybeRunFnOnSettlement(){if(!(this._isTerminal&&!this._resubscribable)&&!(this._dirtyDepCount>0)){if(!this._partial&&!this._hasCalledFnOnce)for(let e=0;e<this._deps.length;e++){let n=this._deps[e];if(n.dataBatch.length===0&&n.prevData===void 0&&n.terminal===void 0){this._maybeAutoTerminalAfterWave();return}}if(this._paused){this._pendingWave=!0;return}if(!this._waveHasNewData&&!this._hasNewTerminal&&this._hasCalledFnOnce){this._clearWaveFlags(),this._emit(De),this._maybeAutoTerminalAfterWave();return}this._fn&&this._execFn(),this._maybeAutoTerminalAfterWave()}}_maybeAutoTerminalAfterWave(){if(this._deps.length===0||this._isTerminal)return;let e=this._deps.find(n=>n.terminal!==void 0&&n.terminal!==!0);if(e!=null){this._autoError&&this._emit([[y,e.terminal]]);return}this._autoComplete&&this._deps.every(n=>n.terminal!==void 0)&&this._emit(Ve)}_execFn(){if(!this._fn||this._isTerminal&&!this._resubscribable)return;if(this._isExecutingFn){this._pendingRerun=!0;return}let e=this._cleanup;if(typeof e=="function"){this._cleanup=void 0;try{e()}catch(d){this._emit([[y,this._wrapFnError("cleanup threw",d)]]);return}}else if(e!=null&&typeof e=="object"){let d=e.beforeRun;if(typeof d=="function"){e.beforeRun=void 0;try{d()}catch(s){this._emit([[y,this._wrapFnError("cleanup.beforeRun threw",s)]]);return}}}let n=this._deps.map(d=>d.involvedThisWave?d.dataBatch.length>0?[...d.dataBatch]:[]:void 0),r=this._deps.map(d=>d.prevData);for(let d=0;d<this._deps.length;d++){let s=n[d];s!=null&&s.length>0&&(this._deps[d].prevData=s[s.length-1])}let o=this._deps.map(d=>d.terminal),i={prevData:r,terminalDeps:o,store:this._store};if(this._hasCalledFnOnce=!0,this._clearWaveFlags(),this._inspectorHooks!=null){let d={kind:"run",batchData:n,prevData:r};for(let s of this._inspectorHooks)s(d)}this._isExecutingFn=!0;try{let d=this._fn(n,this._actions,i);if(typeof d=="function")this._cleanup=d;else if(d!=null&&typeof d=="object"){let s=d;(typeof s.beforeRun=="function"||typeof s.deactivate=="function"||typeof s.invalidate=="function")&&(this._cleanup=d)}}catch(d){this._emit([[y,this._wrapFnError("fn threw",d)]])}finally{this._isExecutingFn=!1,this._pendingRerun?(this._pendingRerun=!1,this._rerunDepth+=1,this._rerunDepth>tt?(this._rerunDepth=0,this._emit([[y,new Error(`Node "${this.name}": _pendingRerun depth exceeded ${tt} \u2014 likely a reactive cycle`)]])):this._maybeRunFnOnSettlement()):this._rerunDepth=0,this._clearWaveFlags()}}_clearWaveFlags(){this._waveHasNewData=!1,this._hasNewTerminal=!1;for(let e of this._deps)e.involvedThisWave=!1,e.dataBatch.length=0}_wrapFnError(e,n){let r=n instanceof Error?n.message:String(n);return new Error(`Node "${this.name}": ${e}: ${r}`,{cause:n})}_frameBatch(e){let n=this._config.tierOf;if(e.length===1)return n(e[0][0])===3&&this._status!=="dirty"?[H,e[0]]:e;let r=!0,o=!1,i=!1,d=-1;for(let a of e){let c=n(a[0]);c<d&&(r=!1),c===3&&(o=!0),a[0]===O&&(i=!0),d=c}let s=e;if(!r){let a=e.map((c,l)=>({m:c,i:l,tier:n(c[0])}));a.sort((c,l)=>c.tier-l.tier||c.i-l.i),s=a.map(c=>c.m)}if(o&&!i&&this._status!=="dirty"){let a=0;for(;a<s.length&&n(s[a][0])===0;)a++;return a===0?[H,...s]:[...s.slice(0,a),H,...s.slice(a)]}return s}_emit(e){if(e.length===0)return;for(let s=0;s<e.length;s++){let a=e[s];if(a[0]===y&&a[1]===void 0)throw new TypeError('[ERROR, payload] requires a non-undefined payload (spec \xA71.2). Pass an Error object or domain tag instead \u2014 e.g. node.down([[ERROR, new Error("reason")]])')}let n=e;if(this._isTerminal&&!this._resubscribable){let s=e.filter(a=>a[0]===R||a[0]===I);if(s.length===0)return;n=s}n=this._frameBatch(n);let o=null;for(let s=0;s<n.length;s++){let a=n[s],c=a[0];if(c!==V&&c!==$){o?.push(a);continue}if(a.length<2)throw new Error(`Node "${this.name}": [[${c===V?"PAUSE":"RESUME"}]] must carry a lockId payload \u2014 bare PAUSE/RESUME is a protocol violation (C0 rule). Use \`[[PAUSE, lockId]]\` / \`[[RESUME, lockId]]\`.`);let l=!0;if(this._pausable!==!1){let u=a[1];if(c===V)this._pauseLocks==null&&(this._pauseLocks=new Set),this._pauseLocks.add(u),this._paused=!0,this._pausable==="resumeAll"&&this._pauseBuffer==null&&(this._pauseBuffer=[]);else if(this._pauseLocks==null||!this._pauseLocks.has(u))l=!1;else if(this._pauseLocks.delete(u),this._pauseLocks.size===0){if(this._paused=!1,this._pauseBuffer!=null&&this._pauseBuffer.length>0){let p=this._pauseBuffer;this._pauseBuffer=[],this._emit(p)}this._pendingWave&&(this._pendingWave=!1,this._maybeRunFnOnSettlement())}}l?o?.push(a):o==null&&(o=n.slice(0,s))}if(o!=null){if(o.length===0)return;n=o}if(this._hasMeta&&n.some(s=>s[0]===R))for(let s of Object.keys(this.meta))try{this.meta[s]._emit(ve)}catch{}let{finalMessages:i,equalsError:d}=this._updateState(n);if(i.length>0&&this._config.inspectorEnabled){let s=this._config.globalInspector;if(s!=null)try{s({kind:"emit",node:this,messages:i})}catch{}}if(i.length>0)if(this._paused&&this._pausable==="resumeAll"&&this._pauseBuffer!=null){let s=this._config.tierOf,a=[];for(let c of i)s(c[0])===3?this._pauseBuffer.push(c):a.push(c);a.length>0&&this._dispatchOrAccumulate(a)}else this._dispatchOrAccumulate(i);d!=null&&this._emit([[y,d]])}_updateState(e){let n=this._config.tierOf,r,o,i=-1,d=0;for(let l of e)n(l[0])===3&&d++;let s=d<=1,a=-1;if(this._versioning!=null&&d>1){for(let l=e.length-1;l>=0;l--)if(e[l][0]===A){a=l;break}}for(let l=0;l<e.length;l++){let u=e[l],p=u[0];if(p===A){if(u.length>=2){let f=!1;if(s&&this._cached!==void 0)try{f=this._equals(this._cached,u[1])}catch(h){o=this._wrapFnError("equals threw",h),i=l;break}if(f){r==null&&(r=e.slice(0,l)),r.push(ye),this._status="resolved";continue}this._cached=u[1],this._versioning!=null&&(a<0||l===a)&&Ze(this._versioning,u[1],this._hashFn)}this._status="settled",r?.push(u)}else if(r?.push(u),p===O)this._status="dirty";else if(p===L)this._status="resolved";else if(p===S){this._status="completed";{let f=this._config.rigorRecorder;if(f!=null)try{f.onTerminalTransition(this,"completed",this._autoComplete,this._autoError,this._deps.length>0)}catch{}}}else if(p===y){this._status="errored";{let f=this._config.rigorRecorder;if(f!=null)try{f.onTerminalTransition(this,"errored",this._autoComplete,this._autoError,this._deps.length>0)}catch{}}}else if(p===I){if(this._cached!==void 0){let h=this._config.rigorRecorder;if(h!=null)try{h.onNonVacuousInvalidate(this,this._cached)}catch{}}this._cached=void 0,this._status="dirty";let f=this._cleanup;if(typeof f=="function"){this._cleanup=void 0;try{f()}catch{}}else if(f!=null&&typeof f=="object"){let h=f.invalidate;if(typeof h=="function")try{h()}catch{}}}else p===R&&(this._resetOnTeardown&&(this._cached=void 0),this._deactivate(!0),this._status="sentinel")}let c=i>=0?r??e.slice(0,i):r??e;return o!=null?{finalMessages:c,equalsError:o}:{finalMessages:c}}_deliverToSinks=e=>{if(this._sinks==null)return;if(typeof this._sinks=="function"){this._sinks(e);return}let n=[...this._sinks];for(let r of n)r(e)};_dispatchOrAccumulate(e){if($e()){this._batchPendingMessages===null&&(this._batchPendingMessages=[],ze(()=>this._flushBatchPending()));for(let n of e)this._batchPendingMessages.push(n);return}Q(this._deliverToSinks,e,this._config.tierOf)}_flushBatchPending(){let e=this._batchPendingMessages;if(e===null||(this._batchPendingMessages=null,e.length===0))return;let n=this._frameBatch(e);Q(this._deliverToSinks,n,this._config.tierOf)}},rt=t=>Array.isArray(t),Ae=t=>typeof t=="object"&&t!=null&&!Array.isArray(t)});function re(t,e){return ot((r,o,i)=>t(o,i)??void 0,{describeKind:"producer",...e})}var it=k(()=>{"use strict";st()});function Me(t){return{describeKind:"producer",...t}}function at(t,e){return re(n=>{let r=!1;try{for(let o of t){if(r)return;n.emit(o)}r||n.down([[S]])}catch(o){r||n.down([[y,o]])}return()=>{r=!0}},Me(e))}function Yt(t){return t!=null&&typeof t.then=="function"}function Jt(t,e){let{signal:n,...r}=e??{};return re(o=>{let i=!1,d=()=>{i||(i=!0,o.down([[y,n.reason]]))};if(n?.aborted){d();return}return n?.addEventListener("abort",d,{once:!0}),Promise.resolve(t).then(s=>{i||(i=!0,n?.removeEventListener("abort",d),o.emit(s),o.down([[S]]))},s=>{i||(i=!0,n?.removeEventListener("abort",d),o.down([[y,s]]))}),()=>{i=!0,n?.removeEventListener("abort",d)}},Me(r))}function Xt(t,e){let{signal:n,...r}=e??{};return re(o=>{let i=new AbortController,d=()=>i.abort(n?.reason);n?.aborted?i.abort(n.reason):n?.addEventListener("abort",d,{once:!0});let s=n??i.signal,a=!1,c=t[Symbol.asyncIterator](),l=()=>{a||s.aborted||Promise.resolve(c.next()).then(u=>{if(!(a||s.aborted)){if(u.done){o.down([[S]]);return}o.emit(u.value),l()}},u=>{!a&&!s.aborted&&o.down([[y,u]])})};return l(),()=>{a=!0,n?.removeEventListener("abort",d),i.abort(),Promise.resolve(c.return?.()).catch(()=>{})}},Me(r))}function Zt(t){return t!=null&&typeof t=="object"&&"cache"in t&&typeof t.subscribe=="function"}function Ne(t,e){if(Zt(t))return t;if(Yt(t))return Jt(t,e);if(t!=null){let n=t;if(typeof n[Symbol.asyncIterator]=="function")return Xt(t,e);if(typeof n[Symbol.iterator]=="function")return at(t,e)}return Qt(t)}function Qt(...t){return at(t,void 0)}function oe(t){return new Promise((e,n)=>{let r=!1,o=!1,i;i=t.subscribe(d=>{for(let s of d){if(r)return;if(s[0]===A){r=!0,e(s[1]),i?(i(),i=void 0):o=!0;return}if(s[0]===y){r=!0,n(s[1]),i?(i(),i=void 0):o=!0;return}if(s[0]===S){r=!0,n(new Error("completed without DATA")),i?(i(),i=void 0):o=!0;return}}}),o&&(i?.(),i=void 0)})}var dt=k(()=>{"use strict";X();it()});var Ee=k(()=>{"use strict";dt()});var j,Ce=k(()=>{"use strict";j=class{_timer;_gen=0;start(e,n){this.cancel(),this._gen+=1;let r=this._gen;this._timer=setTimeout(()=>{this._timer=void 0,r===this._gen&&n()},e)}cancel(){this._timer!==void 0&&(clearTimeout(this._timer),this._timer=void 0)}get pending(){return this._timer!==void 0}}});var sn={};Mt(sn,{fallbackAdapter:()=>_t});module.exports=Et(sn);var K=require("node:fs"),ie=require("node:path");var Le=require("node:crypto"),x=require("node:fs"),P=require("node:path"),Ft=require("node:sqlite");function le(t){if(t===null||typeof t!="object")return t;if(Array.isArray(t))return t.map(le);let e=t,n=Object.keys(e).sort(),r={};for(let o of n)r[o]=le(e[o]);return r}function Oe(t){return JSON.stringify(le(t),void 0,0)}var Ct=new TextEncoder,Ot=new TextDecoder("utf-8",{fatal:!0}),Lt={name:"json",version:1,encode(t){return Ct.encode(Oe(t))},decode(t){return JSON.parse(Ot.decode(t))}};function Rt(){let t=new Map;return{name:"memory",read(e){let n=t.get(e);return n===void 0?void 0:new Uint8Array(n)},write(e,n){t.set(e,new Uint8Array(n))},delete(e){t.delete(e)},list(e){let n=[...t.keys()];return e?n.filter(r=>r.startsWith(e)).sort():n.sort()}}}function ue(t,e={}){let n=e.codec??Lt,r=e.name??t.name??"kv",o=e.compactEvery,i=new Map,d=0,s={name:r,debounceMs:e.debounceMs,compactEvery:o,filter:e.filter,save(c,l){if(!(e.filter&&!e.filter(c,l))&&(i.set(c,l),d+=1,o!==void 0&&d%o===0||!e.debounceMs))return a()},load(c){let l=t.read(c);if(l!==void 0)return l instanceof Uint8Array?l.length===0?void 0:n.decode(l):Promise.resolve(l).then(u=>u===void 0||u.length===0?void 0:n.decode(u))},delete(c){if(i.delete(c),!!t.delete)return t.delete(c)},list(c){return t.list?t.list(c):[]},async flush(){await a()},async rollback(){i=new Map}};function a(){if(i.size===0)return;let c=i;i=new Map;let l=[];for(let[u,p]of c){let f=n.encode(p),h=t.write(u,f);h instanceof Promise&&l.push(h)}if(l.length>0)return Promise.all(l).then(()=>{})}return s}function fe(t){return ue(Rt(),t)}function Pt(t){let e=new TextEncoder,n=new TextDecoder("utf-8",{fatal:!0}),r=i=>{let d="";for(let s of i){if(s.length===1&&/[a-zA-Z0-9_-]/.test(s)){d+=s;continue}for(let a of e.encode(s))d+=`%${a.toString(16).padStart(2,"0")}`}return(0,P.join)(t,`${d}.bin`)},o=i=>{if(!i.endsWith(".bin"))return null;let d=i.slice(0,-4),s=[],a=l=>{for(let u=0;u<l.length;u++)s.push(l.charCodeAt(u))},c=0;for(;c<d.length;){let l=d[c];if(l==="%"&&c+2<d.length){let u=d.slice(c+1,c+3);if(/^[0-9a-f]{2}$/i.test(u)){s.push(Number.parseInt(u,16)),c+=3;continue}}a(l),c+=1}try{return n.decode(new Uint8Array(s))}catch{return null}};return{name:`file:${t}`,read(i){try{let d=(0,x.readFileSync)(r(i));return new Uint8Array(d.buffer,d.byteOffset,d.byteLength)}catch{return}},write(i,d){(0,x.mkdirSync)(t,{recursive:!0});let s=r(i),a=(0,P.basename)(s),c=(0,P.dirname)(s),l=(0,P.join)(c,`.${a}.${(0,Le.randomBytes)(8).toString("hex")}.tmp`);try{(0,x.writeFileSync)(l,d),(0,x.renameSync)(l,s)}catch(u){try{(0,x.unlinkSync)(l)}catch{}throw u}},delete(i){try{(0,x.unlinkSync)(r(i))}catch(d){if(d.code!=="ENOENT")throw d}},list(i){try{let d=(0,x.readdirSync)(t),s=[];for(let a of d){if(a.startsWith("."))continue;let c=o(a);c!==null&&(i!==void 0&&!c.startsWith(i)||s.push(c))}return s.sort()}catch(d){if(d.code==="ENOENT")return[];throw d}}}}function pe(t,e){return ue(Pt(t),e)}Y();async function J(t){let e=typeof t=="string"?new TextEncoder().encode(t):t,n=await globalThis.crypto.subtle.digest("SHA-256",e),r=new Uint8Array(n),o="";for(let i=0;i<r.length;i++)o+=Fe[r[i]];return o}var Fe=new Array(256);for(let t=0;t<256;t++)Fe[t]=t.toString(16).padStart(2,"0");Y();var he=class extends Error{constructor(n,r){super(`content-addressed lookup miss in read-strict mode: ${n}`);this.key=n;this.context=r;this.name="ContentAddressedMissError"}};function ge(t){let e=new Set,n=r=>{if(r===null||typeof r!="object")return r;let o=r;if(e.has(o))return{__cycle:!0};e.add(o);try{if(Array.isArray(r))return r.map(n);let i={};for(let d of Object.keys(r).sort())i[d]=n(r[d]);return i}finally{e.delete(o)}};return JSON.stringify(n(t))}function Pe(t){let{storage:e,keyContext:n,keyPrefix:r,mode:o="read-write"}=t,i=n??(s=>s);async function d(s){let a=ge(i(s)),c=await J(a);return r?`${r}:${c}`:c}return{keyFor:d,async lookup(s){if(o==="write")return;let a=await d(s),c=await e.load(a);if(c===void 0){if(o==="read-strict")throw new he(a,s);return}return c},async store(s,a){if(o==="read")return;let c=await d(s);await e.save(c,a)},async forget(s){if(o==="read"||o==="write"||!e.delete)return;let a=await d(s);await e.delete(a)}}}Ee();function ct(t,e={}){let n=e.keyFn??(o=>String(o)),r=new Map;return o=>{let i=n(o),d=r.get(i);if(d)return d;let s=t(o),a;s!=null&&typeof s.then=="function"?a=Promise.resolve(s):s!=null&&typeof s=="object"&&"subscribe"in s&&"cache"in s?a=oe(s):s!=null&&typeof s=="object"&&Symbol.asyncIterator in s?a=(async()=>{let u=s[Symbol.asyncIterator]();try{let{value:p,done:f}=await u.next();if(f)throw new Error("singleFromAny: factory returned empty async iterable");return p}finally{await u.return?.()}})():s!=null&&typeof s=="object"&&Symbol.iterator in s?a=(async()=>{let u=s[Symbol.iterator]();try{let{value:p,done:f}=u.next();if(f)throw new Error("singleFromAny: factory returned empty iterable");return p}finally{u.return?.()}})():a=Promise.resolve(s);let c,l=()=>{r.get(i)===c&&r.delete(i)};return c=a.then(u=>(l(),u),u=>{throw l(),u}),r.set(i,c),c}}Ee();Ce();function lt(t){let{storage:e,mode:n="read-write",keyFn:r,keyPrefix:o="llm-replay"}=t,d=Pe({storage:e,keyPrefix:o,mode:n==="read-strict"?"read":n,keyContext:({messages:a,opts:c})=>{let{signal:l,keyContext:u,...p}=c??{};return{messages:a,opts:p}}});async function s(a,c){if(r){if(r.length<=1){let u={messages:a,opts:c,context:c?.keyContext},p=await r(u);return`${o}:${p}`}let l=await r(a,c);return`${o}:${l}`}return d.keyFor({messages:a,opts:c})}return{keyFor:s,async lookup(a,c){if(n!=="write"){if(r){let l=await s(a,c),u=await e.load(l);return u===void 0?void 0:u}return d.lookup({messages:a,opts:c})}},async store(a,c,l){if(n!=="read"){if(r){let u=await s(a,c);await e.save(u,l);return}await d.store({messages:a,opts:c},l)}},async forget(a,c){if(!(n==="read"||n==="write")&&e.delete){if(r){let l=await s(a,c);await e.delete(l);return}await d.forget({messages:a,opts:c})}}}}function ut(t,e,n){return{provider:n?.provider??t.provider,model:n?.model??t.model,capabilities:n?.capabilities??t.capabilities?.bind(t),invoke:e.invoke,stream:e.stream}}var ft=Symbol.for("graphrefly.adapter.middlewareLayers");function pt(t,e,n){let o=[...n?en(n):[],e];return Object.defineProperty(t,ft,{value:Object.freeze(o),enumerable:!1,writable:!1,configurable:!1}),t}function en(t){let e=t[ft];return Array.isArray(e)?e:[]}var z=class extends Error{constructor(n,r){super(`withReplayCache: no cached response for ${r} (key=${n}, mode=read-strict)`);this.key=n;this.method=r}name="ReplayCacheMissError"};function ht(t,e){let n=e.mode??"read-write",r=e.cacheStreaming??!1,o=e.captureStreamCadence??!1,i=e.replaySpeed??1,d=e.keyPrefix??"llm-replay",s=n==="read"||n==="read-strict",a=lt({storage:e.storage,mode:n==="write-only"?"write":n,keyFn:e.keyFn,keyPrefix:d}),c=p=>p<=0?Promise.resolve():new Promise(f=>{new j().start(p,()=>f())}),l=ct(async({messages:p,invokeOpts:f})=>await oe(Ne(t.invoke(p,f))),{keyFn:({_precomputedKey:p})=>p}),u=ut(t,{async invoke(p,f){let h=await a.keyFor(p,f),m=await a.lookup(p,f);if(m?.response){let _=m.response;return{..._,metadata:{..._.metadata??{},replayCache:"hit"}}}if(n==="read-strict")throw new z(h,"invoke");let v=await l({messages:p,invokeOpts:f,_precomputedKey:h});return s||await a.store(p,f,{response:v,storedAtNs:D()}),v},async*stream(p,f){if(!r){for await(let g of t.stream(p,f))yield g;return}let h=await a.keyFor(p,f),m=await a.lookup(p,f);if(m){let g=m.response;if(m.streamChunks&&m.streamCadenceMs)for(let b=0;b<m.streamChunks.length;b++){let C=m.streamCadenceMs[b]??0,F=i>0?C/i:0;F>0&&await c(F),yield{type:"token",delta:m.streamChunks[b]?.delta??""}}else g.content&&(yield{type:"token",delta:g.content});g.usage&&(yield{type:"usage",usage:g.usage}),yield{type:"finish",reason:g.finishReason??"stop"};return}if(n==="read-strict")throw new z(h,"stream");let v="",_,M,w=[],E=[],N;for await(let g of t.stream(p,f)){if(g.type==="token"&&(v+=g.delta,o)){let b=Re(),C=N===void 0?0:(b-N)/1e6;E.push(C),N=b,w.push({delta:g.delta})}g.type==="usage"&&(_=g.usage),g.type==="finish"&&(M=g.reason),yield g}if((v||_)&&!s){let b={response:{content:v,usage:_??{input:{regular:0},output:{regular:0}},finishReason:M,model:t.model??f?.model??"",provider:t.provider},storedAtNs:D(),...o?{streamChunks:w,streamCadenceMs:E}:{}};await a.store(p,f,b)}}});return pt(u,"withReplayCache",t),u}var gt=ge;Ce();function se(){let t=new Error("aborted");return t.name="AbortError",t}function yt(t,e){return t<=0?Promise.resolve():e?.aborted?Promise.reject(se()):new Promise((n,r)=>{let o=new j,i,d=()=>{o.cancel(),e&&i&&e.removeEventListener("abort",i)};o.start(t,()=>{d(),n()}),e&&(i=()=>{d(),r(se())},e.addEventListener("abort",i,{once:!0}))})}function mt(t={}){let e=t.provider??"dry-run",n=t.model??"dry-run-v1",r=t.latencyMs??0,o=Math.max(1,t.streamChunkSize??16),i=t.respond??(s=>{let a=[...s].reverse().find(c=>c.role==="user");return a?`echo: ${a.content}`:"dry-run: no user message"}),d=t.usage??((s,a)=>{let c=s.reduce((l,u)=>l+u.content.length,0);return{input:{regular:Math.ceil(c/4)},output:{regular:Math.ceil(a.length/4)}}});return{provider:e,model:n,async invoke(s,a){if(await yt(r,a?.signal),a?.signal?.aborted)throw se();let c=i(s,a),l=d(s,c);return{content:c,usage:l,finishReason:"stop",model:a?.model??n,provider:e,tier:a?.tier,metadata:{dryRun:!0}}},async*stream(s,a){let c=i(s,a),l=d(s,c),u=Math.ceil(c.length/o)||1,p=r>0?r/u:0;for(let f=0;f<c.length;f+=o){if(a?.signal?.aborted)throw se();await yt(p,a?.signal),yield{type:"token",delta:c.slice(f,f+o)}}yield{type:"usage",usage:l},yield{type:"finish",reason:"stop"}}}}function bt(t,e){return{content:"[fallback: no cached response available for this request]",usage:{input:{regular:0},output:{regular:0}},finishReason:"stop",model:e,provider:t,metadata:{degraded:!0,reason:"no-fixture"}}}function vt(t,e,n){return typeof t=="string"?{content:t,usage:{input:{regular:0},output:{regular:0}},finishReason:"stop",model:n,provider:e,metadata:{degraded:!0,reason:"respond"}}:t}async function tn(t,e){if("key"in t)return t.key;let n=gt({messages:t.messages,opts:t.invokeOpts??{}}),r=await J(n);return`${e}:${r}`}function nn(t){let e={response:t.response,storedAtNs:D()};if("key"in t&&t.stream){let n=t.stream.chunks.filter(r=>r.type==="token");return{...e,streamChunks:n.map(r=>({delta:r.delta})),streamCadenceMs:t.stream.delaysMs??n.map(()=>0)}}return e}function rn(t,e){let n=[];if(t.fixtures!=null&&n.push("fixtures"),t.fixturesStorage!=null&&n.push("fixturesStorage"),n.length>1)throw new TypeError(`fallbackAdapter: \`fixtures\` and \`fixturesStorage\` are mutually exclusive; got both ${n.join(" and ")}. Pick one source. For filesystem directories use the node subpath's \`fallbackAdapter\`.`);if(t.fixtures){let r=fe(),o=t.fixtures,i=(async()=>{for(let d of o){let s=await tn(d,e);await r.save(s,nn(d))}})();return i.catch(()=>{}),{tier:r,seedReady:i}}return t.fixturesStorage?{tier:t.fixturesStorage,seedReady:Promise.resolve()}:{tier:void 0,seedReady:Promise.resolve()}}function Tt(t={}){let e=t.provider??"fallback",n=t.model??"fallback",r=t.onMiss??"respond",o=t.keyPrefix??"fallback",i=t.record?t.record.adapter:r==="throw"?mt({provider:e,model:n,respond:()=>"[unreachable: read-strict mode throws on miss]"}):{provider:e,model:n,async invoke(l,u){let p=t.respond?t.respond(l,u):bt(e,n);return vt(p,e,n)},async*stream(l,u){let p=t.respond?t.respond(l,u):bt(e,n),f=vt(p,e,n);yield{type:"token",delta:f.content},f.usage&&(yield{type:"usage",usage:f.usage}),yield{type:"finish",reason:f.finishReason??"stop"}}},d,s=Promise.resolve();if(t.record){if(!t.record.storage)throw new TypeError("fallbackAdapter: `record.storage` is required in record mode. For filesystem `record.dir` convenience, use the node subpath's `fallbackAdapter`.");d=t.record.storage}else{let l=rn(t,o);d=l.tier??fe(),s=l.seedReady}let a=t.record?"read-write":r==="throw"?"read-strict":"read",c=ht(i,{storage:d,mode:a,keyPrefix:o,cacheStreaming:!0,captureStreamCadence:!0,replaySpeed:t.replaySpeed,...t.keyFn?{keyFn:t.keyFn}:{}});return{provider:e,model:n,capabilities:c.capabilities?.bind(c),async invoke(l,u){return await s,c.invoke(l,u)},async*stream(l,u){await s;for await(let p of c.stream(l,u))yield p}}}function on(t){if(!(0,K.existsSync)(t))return;let e=(0,K.readdirSync)(t).filter(a=>a.endsWith(".json"));if(e.length===0)return;let n=e[0],r=(0,ie.join)(t,n),o;try{o=JSON.parse((0,K.readFileSync)(r,"utf8"))}catch(a){throw new TypeError(`fallbackAdapter: ${r} is not valid JSON (${a.message}).`)}let i=o,d=i!=null&&"messages"in i,s=i==null||typeof i.response?.content!="string"||typeof i.storedAtNs!="number";if(d||s){let a=d?"`messages` at the top level means this looks hand-authored. ":"";throw new TypeError(`fallbackAdapter: ${r} is not in cache-file format. ${a}Expected \`{ response: { content, usage, ... }, storedAtNs, ... }\` (the shape \`withReplayCache\` and this adapter's \`record\` mode write). For hand-authored fixtures, use the inline \`fixtures: FallbackFixture[]\` option \u2014 the adapter hashes messages for you.`)}}function _t(t={}){let e=t.keyPrefix??"fallback",n=[];if(t.fixtures!=null&&n.push("fixtures"),t.fixturesDir!=null&&n.push("fixturesDir"),t.fixturesStorage!=null&&n.push("fixturesStorage"),n.length>1)throw new TypeError(`fallbackAdapter: \`fixtures\`, \`fixturesDir\`, and \`fixturesStorage\` are mutually exclusive; got both ${n.join(" and ")}. Pick one source.`);let r=t.fixturesStorage;if(t.fixturesDir!=null){let c=(0,ie.join)(t.fixturesDir,e);on(c),r=pe(c)}let o;if(t.record){if(t.record.storage&&t.record.dir)throw new TypeError("fallbackAdapter: `record.storage` and `record.dir` are mutually exclusive; pick one.");if(t.record.storage)o={adapter:t.record.adapter,storage:t.record.storage};else{let c=t.record.dir??t.fixturesDir;if(c==null)throw new TypeError("fallbackAdapter: record mode requires either `record.dir`, `record.storage`, or an inherited `fixturesDir`.");o={adapter:t.record.adapter,storage:pe((0,ie.join)(c,e))}}}let{fixturesDir:i,record:d,...s}=t,a={...s,...r?{fixturesStorage:r}:{},...o?{record:o}:{}};return Tt(a)}0&&(module.exports={fallbackAdapter});
@@ -1 +0,0 @@
1
- import{k as f}from"../../chunk-OPHBU3LG.js";import"../../chunk-WJR24TAG.js";import"../../chunk-ESMPEKEV.js";import{g as c}from"../../chunk-VN6RDSK2.js";import"../../chunk-D5RFJOZ2.js";import"../../chunk-CE72X3WO.js";import"../../chunk-CLVB32RD.js";import"../../chunk-4VVTGLXJ.js";import"../../chunk-GHBWHMRZ.js";import"../../chunk-CRVT7D2P.js";import"../../chunk-NTEURFZH.js";import"../../chunk-CK2E7BTU.js";import"../../chunk-QYADASLV.js";import{existsSync as u,readdirSync as k,readFileSync as h}from"fs";import{join as p}from"path";function b(e){if(!u(e))return;let i=k(e).filter(o=>o.endsWith(".json"));if(i.length===0)return;let r=i[0],a=p(e,r),t;try{t=JSON.parse(h(a,"utf8"))}catch(o){throw new TypeError(`fallbackAdapter: ${a} is not valid JSON (${o.message}).`)}let s=t,l=s!=null&&"messages"in s,d=s==null||typeof s.response?.content!="string"||typeof s.storedAtNs!="number";if(l||d){let o=l?"`messages` at the top level means this looks hand-authored. ":"";throw new TypeError(`fallbackAdapter: ${a} is not in cache-file format. ${o}Expected \`{ response: { content, usage, ... }, storedAtNs, ... }\` (the shape \`withReplayCache\` and this adapter's \`record\` mode write). For hand-authored fixtures, use the inline \`fixtures: FallbackFixture[]\` option \u2014 the adapter hashes messages for you.`)}}function x(e={}){let i=e.keyPrefix??"fallback",r=[];if(e.fixtures!=null&&r.push("fixtures"),e.fixturesDir!=null&&r.push("fixturesDir"),e.fixturesStorage!=null&&r.push("fixturesStorage"),r.length>1)throw new TypeError(`fallbackAdapter: \`fixtures\`, \`fixturesDir\`, and \`fixturesStorage\` are mutually exclusive; got both ${r.join(" and ")}. Pick one source.`);let a=e.fixturesStorage;if(e.fixturesDir!=null){let n=p(e.fixturesDir,i);b(n),a=c(n)}let t;if(e.record){if(e.record.storage&&e.record.dir)throw new TypeError("fallbackAdapter: `record.storage` and `record.dir` are mutually exclusive; pick one.");if(e.record.storage)t={adapter:e.record.adapter,storage:e.record.storage};else{let n=e.record.dir??e.fixturesDir;if(n==null)throw new TypeError("fallbackAdapter: record mode requires either `record.dir`, `record.storage`, or an inherited `fixturesDir`.");t={adapter:e.record.adapter,storage:c(p(n,i))}}}let{fixturesDir:s,record:l,...d}=e,o={...d,...a?{fixturesStorage:a}:{},...t?{record:t}:{}};return f(o)}export{x as fallbackAdapter};
@@ -1,3 +0,0 @@
1
- "use strict";var mt=Object.defineProperty;var Bn=Object.getOwnPropertyDescriptor;var Hn=Object.getOwnPropertyNames;var qn=Object.prototype.hasOwnProperty;var L=(r,e)=>()=>(r&&(e=r(r=0)),e);var Wn=(r,e)=>{for(var t in e)mt(r,t,{get:e[t],enumerable:!0})},Un=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of Hn(e))!qn.call(r,s)&&s!==t&&mt(r,s,{get:()=>e[s],enumerable:!(n=Bn(e,s))||n.enumerable});return r};var Kn=r=>Un(mt({},"__esModule",{value:!0}),r);function se(){return Math.trunc(performance.now()*1e6)}function ne(){return Date.now()*1e6}var xe=L(()=>{"use strict"});function Ht(r){return Array.isArray(r)?[...r]:[r]}function Yn(r,e){return r.has(e)||r.has("*")}function Oe(r){let e=[];return r((s,o)=>{e.push({kind:"allow",actions:new Set(Ht(s)),where:o?.where??(()=>!0)})},(s,o)=>{e.push({kind:"deny",actions:new Set(Ht(s)),where:o?.where??(()=>!0)})}),(s,o)=>{let i=!1,a=!1;for(let d of e)Yn(d.actions,o)&&d.where(s)&&(d.kind==="deny"?i=!0:a=!0);return i?!1:a}}function yt(r){let e=Jn.filter(t=>r({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 X,Jn,fe=L(()=>{"use strict";X=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}};Jn=["human","llm","wallet","system"]});function He(r){if(r==null)return Ne;let{type:e,id:t,...n}=r;return{type:e??"system",id:t??"",...n}}var Ne,qe=L(()=>{"use strict";Ne={type:"system",id:""}});function We(){return ke>0||Ge}function qt(){return ke>0}function Re(r){ke>0?Ie.push(r):r()}function ge(r){ke+=1;let e=!1;try{r()}catch(t){throw e=!0,t}finally{if(ke-=1,ke===0)if(e){if(!Ge){let t=Ie.splice(0);for(let n of t)try{n()}catch{}pe.length=0,he.length=0,Se.length=0}}else Zn()}}function Zn(){let r=!Ge;r&&(Ge=!0);let e=[],t=0;try{for(;pe.length>0||he.length>0||Se.length>0||r&&Ie.length>0;){if(r&&Ie.length>0){let o=Ie.splice(0);for(let i of o)try{i()}catch(a){e.push(a)}continue}if(t+=1,t>1e3)throw pe.length=0,he.length=0,Se.length=0,new Error("batch drain exceeded 1000 iterations \u2014 likely a reactive cycle");let s=(pe.length>0?pe:he.length>0?he:Se).splice(0);for(let o of s)try{o()}catch(i){e.push(i)}}}finally{r&&(Ge=!1)}if(e.length===1)throw e[0];if(e.length>1)throw new AggregateError(e,"batch drain: multiple callbacks threw")}function Ue(r,e,t){if(e.length===0)return;if(e.length===1){let u=t(e[0][0]);if(u<3||!We()){r(e);return}(u>=5?Se:u===4?he:pe).push(()=>r(e));return}let n=e.length,s=n,o=n,i=n,a=0;for(;a<n&&t(e[a][0])<3;)a++;for(s=a;a<n&&t(e[a][0])===3;)a++;for(o=a;a<n&&t(e[a][0])===4;)a++;i=a;let d=We();if(s>0){let u=e.slice(0,s);r(u)}if(o>s){let u=e.slice(s,o);d?pe.push(()=>r(u)):r(u)}if(i>o){let u=e.slice(o,i);d?he.push(()=>r(u)):r(u)}if(n>i){let u=e.slice(i,n);d?Se.push(()=>r(u)):r(u)}}var ke,Ge,pe,he,Se,Ie,Pe=L(()=>{"use strict";ke=0,Ge=!1,pe=[],he=[],Se=[],Ie=[]});var me,G,H,W,Q,te,oe,B,V,D,ye,Ke,Wt,Ye,Ut,Kt,Je,bt,vt,_t,Ze,ae=L(()=>{"use strict";me=Symbol.for("graphrefly/START"),G=Symbol.for("graphrefly/DATA"),H=Symbol.for("graphrefly/DIRTY"),W=Symbol.for("graphrefly/RESOLVED"),Q=Symbol.for("graphrefly/INVALIDATE"),te=Symbol.for("graphrefly/PAUSE"),oe=Symbol.for("graphrefly/RESUME"),B=Symbol.for("graphrefly/TEARDOWN"),V=Symbol.for("graphrefly/COMPLETE"),D=Symbol.for("graphrefly/ERROR"),ye=Object.freeze([H]),Ke=Object.freeze([W]),Wt=Object.freeze([Q]),Ye=Object.freeze([me]),Ut=Object.freeze([V]),Kt=Object.freeze([B]),Je=Object.freeze([ye]),bt=Object.freeze([Ke]),vt=Object.freeze([Wt]),_t=Object.freeze([Ut]),Ze=Object.freeze([Kt])});function Yt(r){r.registerMessageType(me,{tier:0,wireCrossing:!1}),r.registerMessageType(H,{tier:1,wireCrossing:!1}),r.registerMessageType(Q,{tier:1,wireCrossing:!1,metaPassthrough:!1}),r.registerMessageType(te,{tier:2,wireCrossing:!1}),r.registerMessageType(oe,{tier:2,wireCrossing:!1}),r.registerMessageType(G,{tier:3,wireCrossing:!0}),r.registerMessageType(W,{tier:3,wireCrossing:!0}),r.registerMessageType(V,{tier:4,wireCrossing:!0,metaPassthrough:!1}),r.registerMessageType(D,{tier:4,wireCrossing:!0,metaPassthrough:!1}),r.registerMessageType(B,{tier:5,wireCrossing:!0,metaPassthrough:!1})}var Xe,Jt=L(()=>{"use strict";ae();Xe=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 n=this._messageTypes.get(t);return n!=null?n.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 Xt(r,e){let t=new TextEncoder().encode(r.name);if(t.length===0||t.length>255)throw new Error(`encodeEnvelope: codec name "${r.name}" encodes to ${t.length} bytes (must be 1\u2013255)`);let n=r.version;if(!Number.isInteger(n)||n<0||n>65535)throw new Error(`encodeEnvelope: codec.version ${n} out of u16 range (expected integer 0\u201365535)`);let s=2+t.length+2+e.length;if(s>4294967295)throw new Error(`encodeEnvelope: total envelope size ${s} exceeds 2^32-1 bytes (payload ${e.length} bytes)`);let o=new Uint8Array(s),i=0;return o[i++]=wt,o[i++]=t.length,o.set(t,i),i+=t.length,o[i++]=n>>>8&255,o[i++]=n&255,o.set(e,i),o}function Qt(r,e){if(r.length<Zt)throw new Error(`decodeEnvelope: bytes too short (${r.length} < ${Zt})`);let t=0,n=r[t++];if(n!==wt)throw new Error(`decodeEnvelope: unsupported envelope version ${n} (expected ${wt})`);let s=r[t++];if(s===0)throw new Error("decodeEnvelope: name_len must be >= 1");if(t+s+2>r.length)throw new Error(`decodeEnvelope: envelope truncated (need ${t+s+2} bytes, have ${r.length})`);let o=new TextDecoder().decode(r.subarray(t,t+s));t+=s;let i=(r[t]<<8|r[t+1])>>>0;t+=2;let a=r.subarray(t),d=e.lookupCodec(o);if(d==null)throw new Error(`decodeEnvelope: codec "${o}" not registered (envelope codec_v=${i})`);return{codec:d,codecVersion:i,payload:a}}function en(r){r.registerCodec(Xn)}var Xn,wt,Zt,Tt=L(()=>{"use strict";Xn={name:"json",version:1,contentType:"application/json",encode(r){let e=JSON.stringify(r);return new TextEncoder().encode(e)},decode(r,e){let t=new TextDecoder().decode(r);return JSON.parse(t)}},wt=1,Zt=4});function Et(r){if(r===void 0)return null;if(typeof r=="number"){if(!Number.isFinite(r))throw new TypeError(`Cannot hash non-finite number: ${r}`);if(Number.isInteger(r)&&!Number.isSafeInteger(r))throw new TypeError(`Cannot hash integer outside safe range (|n| > 2^53-1): ${r}. Cross-language cid parity is not guaranteed for unsafe integers.`);return r}if(typeof r=="string"||typeof r=="boolean"||r===null)return r;if(Array.isArray(r))return r.map(Et);if(typeof r=="object"&&r!==null){let e={};for(let t of Object.keys(r).sort())e[t]=Et(r[t]);return e}return null}function tr(r){let e=er.encode(r),t=e.length,n=t*8,s=t+9+63&-64,o=new Uint8Array(s);o.set(e),o[t]=128;let i=new DataView(o.buffer);i.setUint32(s-4,n>>>0,!1),i.setUint32(s-8,Math.floor(n/4294967296)>>>0,!1);let a=1779033703,d=3144134277,u=1013904242,c=2773480762,f=1359893119,p=2600822924,h=528734635,l=1541459225,y=new Uint32Array(64),g=(v,_)=>v>>>_|v<<32-_;for(let v=0;v<s;v+=64){for(let w=0;w<16;w++)y[w]=i.getUint32(v+w*4,!1);for(let w=16;w<64;w++){let S=y[w-15],C=y[w-2],R=g(S,7)^g(S,18)^S>>>3,$=g(C,17)^g(C,19)^C>>>10;y[w]=y[w-16]+R+y[w-7]+$>>>0}let _=a,b=d,T=u,N=c,m=f,x=p,k=h,O=l;for(let w=0;w<64;w++){let S=g(m,6)^g(m,11)^g(m,25),C=m&x^~m&k,R=O+S+C+Qn[w]+y[w]>>>0,$=g(_,2)^g(_,13)^g(_,22),j=_&b^_&T^b&T,Y=$+j>>>0;O=k,k=x,x=m,m=N+R>>>0,N=T,T=b,b=_,_=R+Y>>>0}a=a+_>>>0,d=d+b>>>0,u=u+T>>>0,c=c+N>>>0,f=f+m>>>0,p=p+x>>>0,h=h+k>>>0,l=l+O>>>0}let E=v=>v.toString(16).padStart(8,"0");return E(a)+E(d)+E(u)+E(c)+E(f)+E(p)+E(h)+E(l)}function xt(r){let e=Et(r??null),t=JSON.stringify(e);return tr(t).slice(0,16)}function nr(){let r=globalThis.crypto;if(r?.randomUUID)return r.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 Ot(r,e,t){let n=t?.id??nr();if(r===0)return{id:n,version:0};let o=(t?.hash??xt)(e);return{id:n,version:0,cid:o,prev:null}}function tn(r,e,t){r.version+=1,"cid"in r&&(r.prev=r.cid,r.cid=t(e))}var Qn,er,nn=L(()=>{"use strict";Qn=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]),er=new TextEncoder});function on(r){return{node:r,unsub:null,prevData:void 0,dirty:!1,involvedThisWave:!1,dataBatch:[],terminal:void 0}}function Nt(r){r.prevData=void 0,r.dirty=!1,r.involvedThisWave=!1,r.dataBatch.length=0,r.terminal=void 0}function Qe(r){return r.length===0?r:typeof r[0]=="symbol"?[r]:r}function re(r,e,t){let n=an(r)?r:[],s=typeof r=="function"?r:typeof e=="function"?e:void 0,o={};return an(r)?o=(kt(e)?e:t)??{}:kt(r)?o=r:o=(kt(e)?e:t)??{},new F(n,s,o)}var rn,sn,rr,sr,be,F,an,kt,ve=L(()=>{"use strict";Tt();qe();Pe();xe();Jt();fe();ae();nn();rn=()=>{},sn=100;rr=(r,e,t,n)=>{t.direction==="down-in"&&r._onDepMessage(t.depIndex,e)},sr=(r,e,t,n)=>{let s=r;if(s._status==="completed"||s._status==="errored")return;let o=s._cached,i=o===void 0?[Ye]:[Ye,[G,o]];s._status==="dirty"&&i.push(ye),Ue(e,i,s._config.tierOf)},be=new Xe({onMessage:rr,onSubscribe:sr});Yt(be);en(be);F=class r{_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,n){this._config=n.config??be,this._config.onMessage,this._optsName=n.name,this._describeKind=n.describeKind,this._equals=n.equals??Object.is,this._resubscribable=n.resubscribable??!1,this._resetOnTeardown=n.resetOnTeardown??!1,this._autoComplete=n.completeWhenDepsComplete??!0,this._autoError=n.errorWhenDepsError??!0,this._pausable=n.pausable??!0,this._guard=n.guard,this._fn=t,this._partial=n.partial??!1,this._cached=n.initial!==void 0?n.initial:void 0,this._status=e.length===0&&t==null&&this._cached!==void 0?"settled":"sentinel",this._hashFn=n.versioningHash??this._config.defaultHashFn??xt;let s=n.versioning??this._config.defaultVersioning;this._versioningLevel=s,this._versioning=s!=null?Ot(s,this._cached===void 0?void 0:this._cached,{id:n.versioningId,hash:this._hashFn}):void 0,this._deps=e.map(on);let o={};for(let[a,d]of Object.entries(n.meta??{})){let u={initial:d,name:`${n.name??"node"}:meta:${a}`,describeKind:"state",config:this._config};n.guard!=null&&(u.guard=n.guard),n.resubscribable===!0&&(u.resubscribable=!0),o[a]=new r([],void 0,u)}Object.freeze(o),this.meta=o,this._hasMeta=Object.keys(o).length>0;let i=this;this._actions={emit(a){i._emit([[G,a]])},down(a){i._emit(Qe(a))},up(a){i._emitUp(Qe(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 n=this._versioningLevel;if(n!=null&&e<=n)return;let s=t?.hash??this._hashFn;s!==this._hashFn&&(this._hashFn=s);let o=this._cached===void 0?void 0:this._cached,i=this._versioning,a=i?.id??t?.id,d=i?.version??0,u=Ot(e,o,{id:a,hash:s});u.version=d,this._versioning=u,this._versioningLevel=e}_setInspectorHook(e){return e==null?()=>{}:(this._inspectorHooks==null&&(this._inspectorHooks=new Set),this._inspectorHooks.add(e),()=>{this._inspectorHooks?.delete(e),this._inspectorHooks?.size===0&&(this._inspectorHooks=void 0)})}_pushGuard(e){return this._extraGuards==null&&(this._extraGuards=new Set),this._extraGuards.add(e),()=>{this._extraGuards?.delete(e),this._extraGuards?.size===0&&(this._extraGuards=void 0)}}allowsObserve(e){if(this._guard==null&&this._extraGuards==null)return!0;let t=He(e);if(this._guard!=null&&!this._guard(t,"observe"))return!1;if(this._extraGuards!=null){for(let n of this._extraGuards)if(!n(t,"observe"))return!1}return!0}_checkGuard(e){if(e?.internal)return;let t=this._guard!=null||this._extraGuards!=null,n=e?.actor!=null;if(!t&&!n)return;let s=He(e?.actor),o=e?.delivery==="signal"?"signal":"write";if(this._guard!=null&&!this._guard(s,o))throw new X({actor:s,action:o,nodeName:this.name});if(this._extraGuards!=null){for(let i of this._extraGuards)if(!i(s,o))throw new X({actor:s,action:o,nodeName:this.name})}this._lastMutation={actor:s,timestamp_ns:ne()}}down(e,t){let n=Qe(e);n.length!==0&&(this._checkGuard(t),this._emit(n))}emit(e,t){this._checkGuard(t),this._emit([[G,e]])}up(e,t){if(this._deps.length===0)return;let n=Qe(e);if(n.length===0)return;this._checkGuard(t);let s=t??{internal:!0};this._validateUpTiers(n);for(let o of this._deps)o.node.up?.(n,s)}_emitUp(e){if(this._deps.length!==0&&e.length!==0){this._validateUpTiers(e);for(let t of this._deps)t.node.up?.(e,{internal:!0})}}_validateUpTiers(e){let t=this._config.tierOf;for(let n of e){let s=t(n[0]);if(s===3||s===4)throw new Error(`Node "${this.name}": tier-${s} messages cannot flow up \u2014 DATA/RESOLVED/COMPLETE/ERROR are downstream-only. Use \`down(...)\` for value delivery; \`up(...)\` is for control signals (DIRTY, INVALIDATE, PAUSE, RESUME, TEARDOWN).`)}}subscribe(e,t){if(t!=null&&this._guard!=null){let d=He(t);if(!this._guard(d,"observe"))throw new X({actor:d,action:"observe",nodeName:this.name})}let s=this._isTerminal&&this._resubscribable;if(s){this._cached=void 0,this._status="sentinel",this._store={},this._hasCalledFnOnce=!1,this._waveHasNewData=!1,this._hasNewTerminal=!1,this._paused=!1,this._pendingWave=!1,this._pendingRerun=!1,this._isExecutingFn=!1,this._rerunDepth=0,this._dirtyDepCount=0,this._pauseLocks=null,this._pauseBuffer=null;for(let d of this._deps)Nt(d);if(this._partial===!1){for(let d of this._deps)if(d.prevData!==void 0||d.dataBatch.length!==0||d.terminal!==void 0||d.dirty)throw new Error(`resubscribable-reset invariant: DepRecord not fully reset for node ${this._optsName??"(anonymous)"}`)}}this._sinkCount+=1;let o;try{o=this._config.onSubscribe(this,e,{sinkCount:this._sinkCount,afterTerminalReset:s},this._actions)}catch(d){throw this._sinkCount-=1,d}this._sinks==null?this._sinks=e:typeof this._sinks=="function"?this._sinks=new Set([this._sinks,e]):this._sinks.add(e);let i=this._isTerminal;if(this._sinkCount===1&&!i)try{this._activate()}catch(d){if(this._sinkCount-=1,this._removeSink(e),this._sinkCount===0&&(this._status="sentinel"),typeof o=="function")try{o()}catch{}throw d}this._status==="sentinel"&&this._cached===void 0&&(this._status="pending");let a=!1;return()=>{a||(a=!0,this._sinkCount-=1,this._removeSink(e),typeof o=="function"&&o(),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 n=0;n<e;n++){let s=n,o=this._deps[n];o.unsub=rn,o.unsub=o.node.subscribe(i=>{if(o.unsub===null)return;let a=this._config.tierOf,d=!1;for(let u of i)a(u[0])>=3&&(d=!0),this._config.onMessage(this,u,{direction:"down-in",depIndex:s},this._actions);d&&this._maybeRunFnOnSettlement()}),t++}}catch(n){this._deps[t].unsub=null;for(let s=0;s<t;s++){let o=this._deps[s];if(o.unsub!=null){let i=o.unsub;o.unsub=null;try{i()}catch{}Nt(o)}}throw this._dirtyDepCount=0,n}}_addDep(e){for(let s=0;s<this._deps.length;s++)if(this._deps[s].node===e)return s;let t=this._deps.length,n=on(e);if(this._deps.push(n),this._sinks==null)return t;n.dirty=!0,this._dirtyDepCount++,this._status!=="dirty"&&this._emit(Je),n.unsub=rn;try{n.unsub=e.subscribe(s=>{if(n.unsub===null)return;let o=this._config.tierOf,i=!1;for(let a of s)o(a[0])>=3&&(i=!0),this._config.onMessage(this,a,{direction:"down-in",depIndex:t},this._actions);i&&this._maybeRunFnOnSettlement()})}catch(s){throw n.unsub=null,this._deps.pop(),this._dirtyDepCount--,s}return t}_deactivate(e=!1){let t=this._cleanup;if(this._cleanup=void 0,typeof t=="function")try{t()}catch(n){this._emit([[D,this._wrapFnError("cleanup threw",n)]])}else if(t!=null&&typeof t=="object"){let n=t.deactivate;if(typeof n=="function")try{n()}catch(s){this._emit([[D,this._wrapFnError("cleanup.deactivate threw",s)]])}}for(let n of this._deps){if(n.unsub!=null){let s=n.unsub;n.unsub=null;try{s()}catch{}}Nt(n)}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 n=this._deps[e],s=t[0];if(this._inspectorHooks!=null){let o={kind:"dep_message",depIndex:e,message:t};for(let i of this._inspectorHooks)i(o)}if(s!==me){if(s===H){this._depDirtied(n);return}if(s===Q){if(this._depInvalidated(n),this._cached===void 0)return;this._emit(vt);return}if(s===te||s===oe){this._emit([t]);return}if(s===B){this._emit(Ze);return}if(s===G)this._depSettledAsData(n,t[1]);else if(s===W)this._depSettledAsResolved(n);else if(s===V)this._depSettledAsTerminal(n,!0);else if(s===D)this._depSettledAsTerminal(n,t[1]);else{this._emit([t]);return}if(!this._fn){(s===G||s===W)&&this._emit([t]),(s===V||s===D)&&this._maybeAutoTerminalAfterWave();return}}}_depDirtied(e){e.dirty||(e.dirty=!0,e.involvedThisWave=!0,this._dirtyDepCount++,this._status!=="dirty"&&this._emit(Je))}_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(bt),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([[D,e.terminal]]);return}this._autoComplete&&this._deps.every(t=>t.terminal!==void 0)&&this._emit(_t)}_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([[D,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([[D,this._wrapFnError("cleanup.beforeRun threw",a)]]);return}}}let t=this._deps.map(i=>i.involvedThisWave?i.dataBatch.length>0?[...i.dataBatch]:[]:void 0),n=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 s=this._deps.map(i=>i.terminal),o={prevData:n,terminalDeps:s,store:this._store};if(this._hasCalledFnOnce=!0,this._clearWaveFlags(),this._inspectorHooks!=null){let i={kind:"run",batchData:t,prevData:n};for(let a of this._inspectorHooks)a(i)}this._isExecutingFn=!0;try{let i=this._fn(t,this._actions,o);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([[D,this._wrapFnError("fn threw",i)]])}finally{this._isExecutingFn=!1,this._pendingRerun?(this._pendingRerun=!1,this._rerunDepth+=1,this._rerunDepth>sn?(this._rerunDepth=0,this._emit([[D,new Error(`Node "${this.name}": _pendingRerun depth exceeded ${sn} \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 n=t instanceof Error?t.message:String(t);return new Error(`Node "${this.name}": ${e}: ${n}`,{cause:t})}_frameBatch(e){let t=this._config.tierOf;if(e.length===1)return t(e[0][0])===3&&this._status!=="dirty"?[ye,e[0]]:e;let n=!0,s=!1,o=!1,i=-1;for(let d of e){let u=t(d[0]);u<i&&(n=!1),u===3&&(s=!0),d[0]===H&&(o=!0),i=u}let a=e;if(!n){let d=e.map((u,c)=>({m:u,i:c,tier:t(u[0])}));d.sort((u,c)=>u.tier-c.tier||u.i-c.i),a=d.map(u=>u.m)}if(s&&!o&&this._status!=="dirty"){let d=0;for(;d<a.length&&t(a[d][0])===0;)d++;return d===0?[ye,...a]:[...a.slice(0,d),ye,...a.slice(d)]}return a}_emit(e){if(e.length===0)return;for(let a=0;a<e.length;a++){let d=e[a];if(d[0]===D&&d[1]===void 0)throw new TypeError('[ERROR, payload] requires a non-undefined payload (spec \xA71.2). Pass an Error object or domain tag instead \u2014 e.g. node.down([[ERROR, new Error("reason")]])')}let t=e;if(this._isTerminal&&!this._resubscribable){let a=e.filter(d=>d[0]===B||d[0]===Q);if(a.length===0)return;t=a}t=this._frameBatch(t);let s=null;for(let a=0;a<t.length;a++){let d=t[a],u=d[0];if(u!==te&&u!==oe){s?.push(d);continue}if(d.length<2)throw new Error(`Node "${this.name}": [[${u===te?"PAUSE":"RESUME"}]] must carry a lockId payload \u2014 bare PAUSE/RESUME is a protocol violation (C0 rule). Use \`[[PAUSE, lockId]]\` / \`[[RESUME, lockId]]\`.`);let c=!0;if(this._pausable!==!1){let f=d[1];if(u===te)this._pauseLocks==null&&(this._pauseLocks=new Set),this._pauseLocks.add(f),this._paused=!0,this._pausable==="resumeAll"&&this._pauseBuffer==null&&(this._pauseBuffer=[]);else if(this._pauseLocks==null||!this._pauseLocks.has(f))c=!1;else if(this._pauseLocks.delete(f),this._pauseLocks.size===0){if(this._paused=!1,this._pauseBuffer!=null&&this._pauseBuffer.length>0){let p=this._pauseBuffer;this._pauseBuffer=[],this._emit(p)}this._pendingWave&&(this._pendingWave=!1,this._maybeRunFnOnSettlement())}}c?s?.push(d):s==null&&(s=t.slice(0,a))}if(s!=null){if(s.length===0)return;t=s}if(this._hasMeta&&t.some(a=>a[0]===B))for(let a of Object.keys(this.meta))try{this.meta[a]._emit(Ze)}catch{}let{finalMessages:o,equalsError:i}=this._updateState(t);if(o.length>0&&this._config.inspectorEnabled){let a=this._config.globalInspector;if(a!=null)try{a({kind:"emit",node:this,messages:o})}catch{}}if(o.length>0)if(this._paused&&this._pausable==="resumeAll"&&this._pauseBuffer!=null){let a=this._config.tierOf,d=[];for(let u of o)a(u[0])===3?this._pauseBuffer.push(u):d.push(u);d.length>0&&this._dispatchOrAccumulate(d)}else this._dispatchOrAccumulate(o);i!=null&&this._emit([[D,i]])}_updateState(e){let t=this._config.tierOf,n,s,o=-1,i=0;for(let c of e)t(c[0])===3&&i++;let a=i<=1,d=-1;if(this._versioning!=null&&i>1){for(let c=e.length-1;c>=0;c--)if(e[c][0]===G){d=c;break}}for(let c=0;c<e.length;c++){let f=e[c],p=f[0];if(p===G){if(f.length>=2){let h=!1;if(a&&this._cached!==void 0)try{h=this._equals(this._cached,f[1])}catch(l){s=this._wrapFnError("equals threw",l),o=c;break}if(h){n==null&&(n=e.slice(0,c)),n.push(Ke),this._status="resolved";continue}this._cached=f[1],this._versioning!=null&&(d<0||c===d)&&tn(this._versioning,f[1],this._hashFn)}this._status="settled",n?.push(f)}else if(n?.push(f),p===H)this._status="dirty";else if(p===W)this._status="resolved";else if(p===V){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(p===D){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(p===Q){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 p===B&&(this._resetOnTeardown&&(this._cached=void 0),this._deactivate(!0),this._status="sentinel")}let u=o>=0?n??e.slice(0,o):n??e;return s!=null?{finalMessages:u,equalsError:s}:{finalMessages:u}}_deliverToSinks=e=>{if(this._sinks==null)return;if(typeof this._sinks=="function"){this._sinks(e);return}let t=[...this._sinks];for(let n of t)n(e)};_dispatchOrAccumulate(e){if(qt()){this._batchPendingMessages===null&&(this._batchPendingMessages=[],Re(()=>this._flushBatchPending()));for(let t of e)this._batchPendingMessages.push(t);return}Ue(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);Ue(this._deliverToSinks,t,this._config.tierOf)}},an=r=>Array.isArray(r),kt=r=>typeof r=="object"&&r!=null&&!Array.isArray(r)});function et(r,e){if(e!=null&&e.length>0)return new Set(e);switch(r){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 or(r){return r._describeKind!=null?r._describeKind:r._deps.length>0?"derived":r._fn!=null?"producer":"state"}function Rt(r){let e=new WeakSet,t={};for(let[n,s]of dn(r))t[n]=St(s,e);return t}function St(r,e){if(r==null)return r;let t=typeof r;if(t==="boolean"||t==="number"||t==="string")return r;if(t==="function")return"<function>";if(Array.isArray(r))return e.has(r)?"<cycle>":(e.add(r),r.map(n=>St(n,e)));if(t==="object"){let n=r;if(e.has(n))return"<cycle>";e.add(n);try{if(typeof n.subscribe=="function"&&"cache"in n)return"<Node>"}catch{return"<unserializable>"}let s={};for(let[o,i]of dn(n))s[o]=St(i,e);return s}return"<unserializable>"}function dn(r){let e=[],t;try{t=Object.keys(r)}catch{return e}for(let n of t)try{e.push([n,r[n]])}catch{e.push([n,"<unserializable>"])}return e}function ir(r){let e={};for(let[t,n]of Object.entries(r.meta))try{e[t]=n.cache}catch{}return e}function At(r,e,t){let n=e==null,s=!n&&e!=null?[...e].filter(c=>c.startsWith("meta.")).map(c=>c.slice(5)):null,o=n||e.has("meta")||s!=null&&s.length>0,i="state",a=[];r instanceof F&&(i=or(r),a=r._deps.map(c=>c.node.name??""));let d={type:i,deps:a};(n||e.has("status"))&&(d.status=r.status);let u=r instanceof F?r._guard:void 0;if(o){let c={...ir(r)};if(u!=null&&c.access===void 0&&(c.access=yt(u)),s!=null&&s.length>0&&!e.has("meta")){let f={};for(let p of s)p in c&&(f[p]=c[p]);d.meta=f}else d.meta=c}if(r.name!=null&&(d.name=r.name),(n||e.has("value"))&&(!t||i==="state")){r.status==="sentinel"&&(d.sentinel=!0);try{d.value=r.cache}catch{}}if((n||e.has("v"))&&r.v!=null){let c={id:r.v.id,version:r.v.version};"cid"in r.v&&(c.cid=r.v.cid,c.prev=r.v.prev),d.v=c}return(n||e.has("guard"))&&u!=null&&(d.guard=yt(u)),(n||e.has("lastMutation"))&&r.lastMutation!=null&&(d.lastMutation=r.lastMutation),d}var Ct=L(()=>{"use strict";fe();ve()});function U(r,e){return re([],{...e,initial:r})}function de(r,e){return re((n,s,o)=>r(s,o)??void 0,{describeKind:"producer",...e})}function K(r,e,t){return re(r,(s,o,i)=>{let a=s.map((d,u)=>d!=null&&d.length>0?d.at(-1):i.prevData[u]);o.emit(e(a,i))},{describeKind:"derived",...t})}function Dt(r,e,t){return re(r,(s,o,i)=>{let a=s.map((d,u)=>d!=null&&d.length>0?d.at(-1):i.prevData[u]);return e(a,o,i)??void 0},{describeKind:"effect",...t})}var Ae=L(()=>{"use strict";ve()});function Mt(r,e){if(Object.is(r,e))return!0;if(r==null||e==null||typeof r!="object"||typeof e!="object")return!1;if(Array.isArray(r)){if(!Array.isArray(e)||r.length!==e.length)return!1;for(let o=0;o<r.length;o++)if(!Mt(r[o],e[o]))return!1;return!0}if(Array.isArray(e))return!1;let t=Object.keys(r),n=Object.keys(e);if(t.length!==n.length)return!1;let s=new Set(n);for(let o of t)if(!s.has(o)||!Mt(r[o],e[o]))return!1;return!0}function un(r,e){return`${r}\0${e}`}function Gt(r,e){let t=[],n=new Set(r.subgraphs),s=new Set(e.subgraphs),o=[];for(let g of s)n.has(g)||o.push(g);o.sort();for(let g of o)t.push({type:"subgraph-mounted",path:g});let i=new Set(Object.keys(r.nodes)),a=new Set(Object.keys(e.nodes)),d=[];for(let g of a)i.has(g)||d.push(g);d.sort();for(let g of d)t.push({type:"node-added",path:g,node:{...e.nodes[g]}});let u=[];for(let g of a){if(!i.has(g))continue;let E=r.nodes[g]?.meta,v=e.nodes[g]?.meta;E==null&&v==null||Mt(E??{},v??{})||u.push(g)}u.sort();for(let g of u)t.push({type:"node-meta-changed",path:g,prevMeta:r.nodes[g]?.meta??{},nextMeta:e.nodes[g]?.meta??{}});let c=new Map;for(let g of r.edges)c.set(un(g.from,g.to),g);let f=new Map;for(let g of e.edges)f.set(un(g.from,g.to),g);let p=[];for(let[g,E]of f)c.has(g)||p.push(E);p.sort((g,E)=>g.from<E.from?-1:g.from>E.from?1:g.to<E.to?-1:g.to>E.to?1:0);for(let g of p)t.push({type:"edge-added",from:g.from,to:g.to});let h=[];for(let[g,E]of c)f.has(g)||h.push(E);h.sort((g,E)=>g.from<E.from?-1:g.from>E.from?1:g.to<E.to?-1:g.to>E.to?1:0);for(let g of h)t.push({type:"edge-removed",from:g.from,to:g.to});let l=[];for(let g of i)a.has(g)||l.push(g);l.sort();for(let g of l)t.push({type:"node-removed",path:g});let y=[];for(let g of n)s.has(g)||y.push(g);y.sort();for(let g of y)t.push({type:"subgraph-unmounted",path:g});return{events:t,flushedAt_ns:se()}}var cn=L(()=>{"use strict";xe()});function It(r){return{describeKind:"producer",...r}}function ln(r,e){return de(t=>{let n=!1;try{for(let s of r){if(n)return;t.emit(s)}n||t.down([[V]])}catch(s){n||t.down([[D,s]])}return()=>{n=!0}},It(e))}function ar(r){return r!=null&&typeof r.then=="function"}function dr(r,e){let{signal:t,...n}=e??{};return de(s=>{let o=!1,i=()=>{o||(o=!0,s.down([[D,t.reason]]))};if(t?.aborted){i();return}return t?.addEventListener("abort",i,{once:!0}),Promise.resolve(r).then(a=>{o||(o=!0,t?.removeEventListener("abort",i),s.emit(a),s.down([[V]]))},a=>{o||(o=!0,t?.removeEventListener("abort",i),s.down([[D,a]]))}),()=>{o=!0,t?.removeEventListener("abort",i)}},It(n))}function ur(r,e){let{signal:t,...n}=e??{};return de(s=>{let o=new AbortController,i=()=>o.abort(t?.reason);t?.aborted?o.abort(t.reason):t?.addEventListener("abort",i,{once:!0});let a=t??o.signal,d=!1,u=r[Symbol.asyncIterator](),c=()=>{d||a.aborted||Promise.resolve(u.next()).then(f=>{if(!(d||a.aborted)){if(f.done){s.down([[V]]);return}s.emit(f.value),c()}},f=>{!d&&!a.aborted&&s.down([[D,f]])})};return c(),()=>{d=!0,t?.removeEventListener("abort",i),o.abort(),Promise.resolve(u.return?.()).catch(()=>{})}},It(n))}function cr(r){return r!=null&&typeof r=="object"&&"cache"in r&&typeof r.subscribe=="function"}function fn(r,e){if(cr(r))return r;if(ar(r))return dr(r,e);if(r!=null){let t=r;if(typeof t[Symbol.asyncIterator]=="function")return ur(r,e);if(typeof t[Symbol.iterator]=="function")return ln(r,e)}return lr(r)}function lr(...r){return ln(r,void 0)}function ie(r){return r.subscribe(()=>{})}var pn=L(()=>{"use strict";ae();Ae()});var Pt=L(()=>{"use strict";pn()});var tt,hn=L(()=>{"use strict";tt=class{_timer;_gen=0;start(e,t){this.cancel(),this._gen+=1;let n=this._gen;this._timer=setTimeout(()=>{this._timer=void 0,n===this._gen&&t()},e)}cancel(){this._timer!==void 0&&(clearTimeout(this._timer),this._timer=void 0)}get pending(){return this._timer!==void 0}}});var Le,gn=L(()=>{"use strict";Le=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 mn(r,e,t,n={}){let s=e in r.nodes,o=t in r.nodes;if(!s)return nt(e,t,"no-such-from");if(!o)return nt(e,t,"no-such-to");let i=n.maxDepth;if(i!=null&&(!Number.isInteger(i)||i<0))throw new Error("explainPath: maxDepth must be an integer >= 0");if(e===t){if(n.findCycle===!0){let u=fr(r,e,n);if(u!=null)return u}let d=rt(e,r.nodes[e],0,n);return st(e,t,[d])}if(i===0)return nt(e,t,"no-path");let a=yn(r,e,t,i);return a.found?st(e,t,bn(r,a.pathOrder,n)):nt(e,t,a.truncated?"max-depth-exceeded":"no-path")}function yn(r,e,t,n){let s=new Map,o=[{path:t,depth:0}],i=new Set([t]),a=0,d=!1;for(;a<o.length;){let f=o[a++];if(f.path===e)break;if(n!=null&&f.depth>=n){let y=r.nodes[f.path];y?.deps&&y.deps.length>0&&(d=!0);continue}let p=r.nodes[f.path];if(p==null)continue;let h=p.deps??[],l=new Map;for(let y=0;y<h.length;y++){let g=h[y];if(!g)continue;let E=l.get(g);E==null&&(E=[],l.set(g,E)),E.push(y)}for(let[y,g]of l)i.has(y)||(i.add(y),s.set(y,{from:f.path,depIndices:g}),o.push({path:y,depth:f.depth+1}))}if(!s.has(e))return{found:!1,pathOrder:[],truncated:d};let u=[{path:e}],c=e;for(;c!==t;){let f=s.get(c);if(f==null)return{found:!1,pathOrder:[],truncated:!1};u[u.length-1].depIndices=f.depIndices,u.push({path:f.from}),c=f.from}return{found:!0,pathOrder:u,truncated:!1}}function fr(r,e,t){let n=r.nodes[e];if(n==null)return null;let s=n.deps??[],o=[];for(let a=0;a<s.length;a++)s[a]===e&&o.push(a);if(o.length>0){let a=rt(e,n,0,t);a.dep_index=o[0];let d=rt(e,n,1,t);return st(e,e,[a,d])}let i=null;for(let a=0;a<s.length;a++){let d=s[a];if(!d||d===e)continue;let u=yn(r,d,e,t.maxDepth);u.found&&(i==null||u.pathOrder.length<i.pathOrder.length)&&(i=u,i={found:!0,pathOrder:[{path:e,depIndices:[a]},...u.pathOrder],truncated:!1})}return i==null?null:st(e,e,bn(r,i.pathOrder,t))}function bn(r,e,t){return e.map((n,s)=>{let o=r.nodes[n.path],i=rt(n.path,o,s,t);return n.depIndices!=null&&n.depIndices.length>0&&(i.dep_index=n.depIndices[0],n.depIndices.length>1&&(i.dep_indices=[...n.depIndices])),i})}function rt(r,e,t,n){let s={path:r,type:e.type,hop:t};e.status!==void 0&&(s.status=e.status),"value"in e&&(s.value=e.value),e.v!=null&&(s.v=e.v);let o=n.annotations?.get(r)??e.annotation;o!=null&&(s.annotation=o);let i=n.lastMutations?.get(r)??e.lastMutation;return i!=null&&(s.lastMutation=i),s}function st(r,e,t){return vn(r,e,!0,"ok",t)}function nt(r,e,t){return vn(r,e,!1,t,[])}function vn(r,e,t,n,s){let o=pr(r,e,t,n,s);return{from:r,to:e,found:t,reason:n,steps:s,text:o,toJSON(){return{from:r,to:e,found:t,reason:n,steps:s}}}}function pr(r,e,t,n,s){if(!t)switch(n){case"no-such-from":return`explainPath: no node named "${r}"`;case"no-such-to":return`explainPath: no node named "${e}"`;case"max-depth-exceeded":return`explainPath: no path from "${r}" to "${e}" within maxDepth`;default:return`explainPath: no path from "${r}" to "${e}"`}let o=[`Causal path: ${r} \u2192 ${e} (${s.length} step(s))`];for(let i of s){let d=` ${i.hop===0?"\xB7":"\u2193"} ${i.path} (${i.type}${i.status?`/${i.status}`:""})`;if(o.push(d),"value"in i&&o.push(` value: ${hr(i.value)}`),i.annotation!=null&&o.push(` annotation: ${i.annotation}`),i.lastMutation!=null){let u=i.lastMutation.actor;o.push(` actor: ${u.type}${u.id?`:${u.id}`:""}`)}}return o.join(`
2
- `)}function hr(r){if(r===void 0)return"<sentinel>";if(r===null)return"null";if(typeof r=="string")return JSON.stringify(r);if(typeof r=="number"||typeof r=="boolean"||typeof r=="bigint")return String(r);try{let e=JSON.stringify(r);return e.length>80?`${e.slice(0,77)}...`:e}catch{return String(r)}}var _n=L(()=>{"use strict"});function wn(r){let e=new WeakSet,t=new WeakSet,n=[r],s=0;for(;n.length>0;){let o=n.pop();s+=mr(o,e,t,n)}return s}function mr(r,e,t,n){if(r==null)return 0;switch(typeof r){case"number":return z.number;case"boolean":return z.boolean;case"string":return z.string+r.length*2;case"bigint":return z.bigint+yr(r);case"symbol":return z.symbol;case"function":return e.has(r)?0:(e.add(r),z.function);case"undefined":return 0}let o=r;if(e.has(o))return 0;e.add(o);let i=o[gr];if(typeof i=="function")try{let u=i.call(o);if(typeof u=="number"&&Number.isFinite(u))return u}catch{}if(o instanceof Date)return z.date;if(o instanceof RegExp)return z.regexp+o.source.length*2;if(o instanceof Error){let u=o.message?o.message.length*2:0,c=o.stack?o.stack.length*2:0;return z.error+u+c}if(typeof URL<"u"&&o instanceof URL)return z.url+o.href.length*2;if(typeof Promise<"u"&&o instanceof Promise)return z.promise;if(o instanceof WeakMap)return z.weakmap;if(o instanceof WeakSet)return z.weakset;if(o instanceof Map){let u=z.map;for(let[c,f]of o)u+=z.mapEntry,n.push(c),n.push(f);return u}if(o instanceof Set){let u=z.set;for(let c of o)u+=z.setEntry,n.push(c);return u}if(Array.isArray(o)){let u=z.array+o.length*8;for(let c of o)n.push(c);return u}if(o instanceof ArrayBuffer)return t.has(o)?0:(t.add(o),o.byteLength);if(ArrayBuffer.isView(o)){let u=o;return t.has(u.buffer)?48:(t.add(u.buffer),u.buffer.byteLength+48)}let a=z.object,d=Object.keys(o);for(let u of d){a+=z.string+u.length*2;try{n.push(o[u])}catch{}}return a}function yr(r){let e=r<0n?-r:r;if(e===0n)return 0;let t=e.toString(2).length;return Math.ceil(t/32)*8}var z,gr,Tn=L(()=>{"use strict";z={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},gr=Symbol.for("sizeof")});function En(r,e){let t=e?.topN??10,n=r.describe({detail:"standard"}),s=[],o=r._collectObserveTargets;typeof o=="function"&&o.call(r,"",s);let i=new Map;for(let[p,h]of s)i.set(p,h);let a=[];for(let[p,h]of Object.entries(n.nodes)){let l=i.get(p),y=l instanceof F?l:null,g=y?wn(y.cache):0,E=y?y._sinkCount:0,v=h.deps?.length??0,_=h.type==="effect"&&E===0,b=E===0?h.type==="effect"?"orphan-effect":h.type==="derived"?"idle-derived":h.type==="producer"?"idle-producer":null:null;a.push({path:p,type:h.type,status:h.status??"unknown",valueSizeBytes:g,subscriberCount:E,depCount:v,isOrphanEffect:_,orphanKind:b})}let d=a.reduce((p,h)=>p+h.valueSizeBytes,0),u=(p,h)=>[...a].sort(h??((l,y)=>y[p]-l[p])).slice(0,t),c=a.filter(p=>p.orphanKind!=null),f=a.filter(p=>p.isOrphanEffect);return{nodeCount:a.length,edgeCount:n.edges.length,subgraphCount:n.subgraphs.length,nodes:a,totalValueSizeBytes:d,hotspots:{byValueSize:u("valueSizeBytes"),bySubscriberCount:u("subscriberCount"),byDepCount:u("depCount")},orphans:c,orphanEffects:f}}var xn=L(()=>{"use strict";ve();Tn()});function ot(r,e){let t=Math.max(16,r.size*4),n=0;for(;r.size>0;){if(n++>=t){console.error(`[Graph "${e}".destroy] disposer drain exceeded cap (${t}); ${r.size} disposer(s) discarded`),r.clear();return}let s=r.values().next();if(s.done)return;let o=s.value;r.delete(o);try{o()}catch(i){console.error(`[Graph "${e}".destroy] disposer threw:`,i)}}}function Rn(r){return r!=null&&typeof r=="object"&&"cache"in r&&typeof r.subscribe=="function"&&typeof r.down=="function"}function br(r){if(r!=null)return Rn(r)?r.cache:r}function we(r){return r!=null&&typeof r=="object"&&"cache"in r&&typeof r.subscribe=="function"&&typeof r.down=="function"}function ue(r){return we(r)?r.cache??"":r}function On(r){return we(r)?r.cache??0:r}function Nn(r){return we(r)?r.cache??!1:r}function vr(r){let e=[];for(let t of Object.keys(r).sort()){let n=r[t].v;n!=null&&e.push(`${t} ${n.id} ${n.version}`)}return e.join(`
3
- `)}function kn(r){if(r.version!==_e)throw new Error(`unsupported snapshot version ${String(r.version)} (expected ${_e})`);for(let e of["name","nodes","edges","subgraphs"])if(!(e in r))throw new Error(`snapshot missing required key "${e}"`);if(typeof r.name!="string")throw new TypeError("snapshot 'name' must be a string");if(typeof r.nodes!="object"||r.nodes===null||Array.isArray(r.nodes))throw new TypeError("snapshot 'nodes' must be an object");if(!Array.isArray(r.edges))throw new TypeError("snapshot 'edges' must be an array");if(!Array.isArray(r.subgraphs))throw new TypeError("snapshot 'subgraphs' must be an array")}function _r(r,e){let t=new WeakMap,n=(s,o)=>{if(Object.is(s,o))return!0;if(s==null||o==null||typeof s!="object"||typeof o!="object")return!1;let i=t.get(s);if(i==null&&(i=new WeakSet,t.set(s,i)),i.has(o))return!0;i.add(o);let a=s.constructor,d=o.constructor;if(a!==d)return!1;if(s instanceof Date)return s.getTime()===o.getTime();if(s instanceof RegExp)return s.source===o.source&&s.flags===o.flags;if(Array.isArray(s)){let p=o;if(s.length!==p.length)return!1;for(let h=0;h<s.length;h++)if(!n(s[h],p[h]))return!1;return!0}if(s instanceof Map){let p=o;if(s.size!==p.size)return!1;for(let[h,l]of s)if(!p.has(h)||!n(l,p.get(h)))return!1;return!0}if(s instanceof Set){let p=o;if(s.size!==p.size)return!1;for(let h of s){let l=!1;for(let y of p)if(n(h,y)){l=!0;break}if(!l)return!1}return!0}if(ArrayBuffer.isView(s)){let p=s,h=o;if(p.length!==h.length)return!1;for(let l=0;l<p.length;l++)if(p[l]!==h[l])return!1;return!0}let u=Object.keys(s),c=Object.keys(o);if(u.length!==c.length)return!1;let f=new Set(c);for(let p of u)if(!f.has(p)||!n(s[p],o[p]))return!1;return!0};return n(r,e)}function wr(r){return r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function it(r){let e="^";for(let t=0;t<r.length;t+=1){let n=r[t];if(n==="*"){e+=".*";continue}if(n==="?"){e+=".";continue}if(n==="["){let s=r.indexOf("]",t+1);if(s<=t+1){e+="\\[";continue}let o=r.slice(t+1,s);o.startsWith("!")&&(o=`^${o.slice(1)}`),o=o.replace(/\\/g,"\\\\"),e+=`[${o}]`,t=s;continue}e+=wr(n)}return e+="$",new RegExp(e)}function Lt(r){if(typeof r=="string")return JSON.stringify(r);if(typeof r=="number"||typeof r=="boolean"||r==null)return String(r);try{return JSON.stringify(r)}catch{return"[unserializable]"}}function xr(r){return r==="none"?Er:r==="ansi"||r==null?Tr:{data:r.data??"",dirty:r.dirty??"",resolved:r.resolved??"",invalidate:r.invalidate??"",pause:r.pause??"",resume:r.resume??"",complete:r.complete??"",error:r.error??"",teardown:r.teardown??"",derived:r.derived??"",path:r.path??"",reset:r.reset??""}}function Sn(r){if(r==null)return{};let e=r.detail;return e==="full"?{...r,structured:r.structured??!0,timeline:r.timeline??!0,causal:r.causal??!0,derived:r.derived??!0}:e==="minimal"?{...r,structured:r.structured??!0}:r.format==="stage-log"?{...r,structured:r.structured??!0,timeline:r.timeline??!0}:r}function Or(r,e,t){for(let n=0;n<r.length;n++){let s=r.charCodeAt(n);if(s<32||s===127)throw new Error(`Graph "${e}": ${t} "${r}" must not contain control character (U+${s.toString(16).padStart(4,"0").toUpperCase()} at index ${n})`)}}function $t(r,e,t){if(r==="")throw new Error(`Graph "${e}": ${t} name must be non-empty`);if(r.includes(P))throw new Error(`Graph "${e}": ${t} "${r}" must not contain '${P}' (path separator)`);if(r===ee)throw new Error(`Graph "${e}": ${t} name "${ee}" is reserved for meta companion paths`);Or(r,e,t)}function Nr(r,e){if(r==="")throw new Error(`Graph "${e}": resolve path must be non-empty`);let t=r.split(P);for(let n of t)if(n==="")throw new Error(`Graph "${e}": resolve path has empty segment`);return t}function kr(r,e){let t=!1;for(let s of r)if(!e.isMetaPassthrough(s[0])){t=!0;break}return t?r.filter(s=>e.isMetaPassthrough(s[0])):r}function An(r){for(let e of r._mounts.values())An(e);for(let e of r._nodes.values())try{e.down([[B]],{internal:!0})}catch{}}function Cn(r,e){let t=ce.diff(r,e),n={};for(let s of t.nodesAdded){let o=e.nodes[s];o!=null&&(n[s]=o)}return{...t,nodesAddedFull:n}}function Ft(r,e,t,n={}){let s={paths:[],depths:new Map,truncated:!1};if(!e)return n.withDetail?s:[];if(!n.both&&t!=="upstream"&&t!=="downstream")throw new Error('reachable: direction must be "upstream" or "downstream"');let o=n.maxDepth;if(o!=null&&(!Number.isInteger(o)||o<0))throw new Error("reachable: maxDepth must be an integer >= 0");if(o===0)return n.withDetail?s:[];let i=new Map,a=new Map,d=new Map,u=new Map,c=new Set;for(let[_,b]of Object.entries(r.nodes)){if(!_)continue;c.add(_);let T=b.deps??[];i.set(_,T);for(let N of T)N&&(c.add(N),a.has(N)||a.set(N,new Set),a.get(N).add(_))}for(let _ of r.edges){if(_==null||typeof _!="object")continue;let b=typeof _.from=="string"?_.from:"",T=typeof _.to=="string"?_.to:"";!b||!T||(c.add(b),c.add(T),u.has(b)||u.set(b,new Set),u.get(b).add(T),d.has(T)||d.set(T,new Set),d.get(T).add(b))}if(!c.has(e))return n.withDetail?s:[];let f=n.both===!0,p=_=>{if(f){let m=i.get(_)??[],x=d.get(_),k=a.get(_),O=u.get(_),w=[...m];return x&&w.push(...x),k&&w.push(...k),O&&w.push(...O),w}if(t==="upstream"){let m=i.get(_)??[],x=d.get(_);return x?[...m,...x]:m}let b=a.get(_),T=u.get(_),N=b?[...b]:[];return T&&N.push(...T),N},h=new Set([e]),l=new Map,y=[{path:e,depth:0}],g=0,E=!1;for(;g<y.length;){let _=y[g++];if(o!=null&&_.depth>=o){p(_.path).length>0&&(E=!0);continue}for(let b of p(_.path))!b||h.has(b)||(h.add(b),l.set(b,_.depth+1),y.push({path:b,depth:_.depth+1}))}let v=[...l.keys()].sort((_,b)=>_<b?-1:_>b?1:0);return n.withDetail?{paths:v,depths:l,truncated:E}:v}function Sr(r,e){if(r.length!==e.length)return!1;for(let t=0;t<r.length;t++){let n=r[t],s=e[t];if(n.path!==s.path||n.type!==s.type||n.status!==s.status||n.hop!==s.hop||n.dep_index!==s.dep_index||n.annotation!==s.annotation||n.value!==s.value||n.lastMutation!==s.lastMutation)return!1;let o=n.v,i=s.v;if(o!==i&&(o==null||i==null||o.id!==i.id||o.version!==i.version))return!1}return!0}var P,ee,_e,Tr,Er,ce,Vt=L(()=>{"use strict";qe();Pe();xe();fe();ae();Ct();ve();Ae();cn();Pt();hn();gn();Tt();_n();xn();P="::",ee="__meta__",_e=1;Tr={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"},Er={data:"",dirty:"",resolved:"",invalidate:"",pause:"",resume:"",complete:"",error:"",teardown:"",derived:"",path:"",reset:""};ce=class r{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(P))throw new Error(`Graph name must not contain '${P}' (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??be,this._traceRing=new Le(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=[],n=e?this:this._parent;for(;n!=null;)t.push(n),n=n._parent;return t}get topology(){return this._topology==null&&(this._topology=de(e=>{let t=n=>{e.emit(n)};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 n=e.name,s=t?.name??n;if(s==null||s==="")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 o=s,i=t?.annotation;if($t(o,this.name,"add"),this._mounts.has(o))throw new Error(`Graph "${this.name}": name "${o}" is already a mount point`);if(this._nodes.has(o))throw new Error(`Graph "${this.name}": node "${o}" 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(o,e),this._nodeToName.set(e,o),this._emitTopology({kind:"added",name:o,nodeKind:"node"}),i!=null&&(this._annotations.set(o,i),this.config.inspectorEnabled&&this._traceRing.push({path:o,annotation:i,timestamp_ns:se()})),e}setVersioning(e){if(e!=null)for(let t of this._nodes.values())t instanceof F&&t._applyVersioning(e)}remove(e){$t(e,this.name,"remove");let t=this._mounts.get(e);if(t){let o={kind:"mount",nodes:[],mounts:[]},i=[];t._collectObserveTargets("",i);for(let[a,d]of i)a.includes(`${P}${ee}${P}`)||o.nodes.push(a);return o.nodes.sort(),o.mounts.push(e),o.mounts.push(...t._collectSubgraphs(`${e}${P}`)),this._mounts.delete(e),t._parent=void 0,An(t),this._emitTopology({kind:"removed",name:e,nodeKind:"mount",audit:o}),o}let n=this._nodes.get(e);if(!n)throw new Error(`Graph "${this.name}": unknown node or mount "${e}"`);this._nodes.delete(e),this._nodeToName.delete(n),n.down([[B]],{internal:!0});let s={kind:"node",nodes:[e],mounts:[]};return this._emitTopology({kind:"removed",name:e,nodeKind:"node",audit:s}),s}removeAll(e){let t=typeof e=="function"?e:(()=>{let o=it(e);return i=>o.test(i)})(),n={kind:"mount",nodes:[],mounts:[]},s=[...this._nodes.keys(),...this._mounts.keys()].filter(o=>t(o));for(let o of s){let i=this.remove(o);n.nodes.push(...i.nodes),n.mounts.push(...i.mounts)}return n.nodes.sort(),n.mounts.sort(),n}[Symbol.iterator](){let e=[...this._nodes.keys()].sort(),t=this._nodes,n=0;return{[Symbol.iterator](){return this},next(){if(n>=e.length)return{value:void 0,done:!0};let s=e[n++];return{value:[s,t.get(s)],done:!1}}}}node(e){if(e==="")throw new Error(`Graph "${this.name}": node name must be non-empty`);if(e.includes(P))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,n){let s=n?.internal===!0;this.node(e).down([[G,t]],{actor:n?.actor,internal:s,delivery:"write"})}setAll(e,t){let n=Symbol.iterator in e?e:Object.entries(e);ge(()=>{for(let[s,o]of n)this.set(s,o,t)})}invalidate(e,t){let n=t?.internal===!0;this.node(e).down([[Q]],{actor:t?.actor,internal:n,delivery:"write"})}error(e,t,n){let s=n?.internal===!0;this.node(e).down([[D,t]],{actor:n?.actor,internal:s,delivery:"write"})}complete(e,t){let n=t?.internal===!0;this.node(e).down([[V]],{actor:t?.actor,internal:n,delivery:"write"})}_registerSelfPruningKeepalive(e){let t,n,s=()=>{t?.(),t=void 0,n?.(),n=void 0};t=e.subscribe(o=>{for(let i of o){let a=i[0];if(a===B||a===V||a===D){s();return}}}),n=this.addDisposer(s)}_wireSignalToRemove(e,t){if(t==null)return;let n=()=>{try{this.remove(e)}catch{}};if(t.aborted){n();return}t.addEventListener("abort",n,{once:!0}),this.addDisposer(()=>t.removeEventListener("abort",n))}derived(e,t,n,s){let o=t.map(h=>this.resolve(h)),{keepAlive:i,annotation:a,equals:d,initial:u,meta:c,signal:f}=s??{},p=K(o,n,{name:e,...d!=null?{equals:d}:{},...u!==void 0?{initial:u}:{},...c!=null?{meta:c}:{}});return this.add(p,{name:e,...a!=null?{annotation:a}:{}}),i===!0&&this._registerSelfPruningKeepalive(p),this._wireSignalToRemove(e,f),p}effect(e,t,n,s){let o=t.map(c=>this.resolve(c)),{annotation:i,meta:a,signal:d}=s??{},u=Dt(o,n,{name:e,...a!=null?{meta:a}:{}});return this.add(u,{name:e,...i!=null?{annotation:i}:{}}),this._wireSignalToRemove(e,d),u}produce(e,t,n){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:s,meta:o,equals:i,signal:a}=n??{},d=fn(t,{name:e,...o!=null?{meta:o}:{},...i!=null?{equals:i}:{},...a!=null?{signal:a}:{}});return this.add(d,{name:e,...s!=null?{annotation:s}:{}}),this._wireSignalToRemove(e,a),d}batch(e){ge(e)}edges(e){let t=e?.recursive===!0,n=new Map;if(!t){for(let[d,u]of this._nodes)n.set(u,d);let a=[];for(let[d,u]of this._nodes)if(u instanceof F)for(let c of u._deps){let f=n.get(c.node);f!=null&&a.push([f,d])}return a.sort((d,u)=>d[0]<u[0]?-1:d[0]>u[0]?1:d[1]<u[1]?-1:d[1]>u[1]?1:0),a}let s=[];this._collectObserveTargets("",s);let o=new Map;for(let[a,d]of s)o.set(d,a);let i=[];for(let[a,d]of s)if(d instanceof F)for(let u of d._deps){let c=o.get(u.node);c!=null&&i.push([c,a])}return i.sort((a,d)=>a[0]<d[0]?-1:a[0]>d[0]?1:a[1]<d[1]?-1:a[1]>d[1]?1:0),i}mount(e,t){if(t===void 0){let s=new r(e);return this.mount(e,s)}if(typeof t=="function"){let s=new r(e);return t(s),this.mount(e,s)}let n=t;if($t(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(n===this)throw new Error(`Graph "${this.name}": cannot mount a graph into itself`);if(n._parent!=null)throw new Error(`Graph "${this.name}": this child graph is already mounted on "${n._parent.name}"`);for(let s=this;s!=null;s=s._parent)if(s===n)throw new Error(`Graph "${this.name}": mount("${e}", \u2026) would create a mount cycle`);return this._mounts.set(e,n),n._parent=this,this._emitTopology({kind:"added",name:e,nodeKind:"mount"}),n}resolve(e){let t=Nr(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 n=t[0],s=t.slice(1);if(s.length===0){let a=this._nodes.get(n);if(a)return a;throw this._mounts.has(n)?new Error(`Graph "${this.name}": path ends at subgraph "${n}" \u2014 not a node (GRAPHREFLY-SPEC \xA73.5)`):new Error(`Graph "${this.name}": unknown name "${n}"`)}let o=this._nodes.get(n);if(o&&s.length>0&&s[0]===ee)return this._resolveMetaChainFromNode(o,s,t.join(P));let i=this._mounts.get(n);if(!i)throw this._nodes.has(n)?new Error(`Graph "${this.name}": "${n}" is a node; trailing path "${s.join(P)}" is invalid`):new Error(`Graph "${this.name}": unknown mount or node "${n}"`);return i.resolve(s.join(P))}_resolveMetaChainFromNode(e,t,n){let s=e,o=0,i=[...t];for(;o<i.length;){if(i[o]!==ee)throw new Error(`Graph "${this.name}": expected ${ee} segment in meta path "${n}"`);if(o+1>=i.length)throw new Error(`Graph "${this.name}": meta path requires a key after ${ee} in "${n}"`);let a=i[o+1],d=s.meta[a];if(!d)throw new Error(`Graph "${this.name}": unknown meta "${a}" in path "${n}"`);s=d,o+=2}return s}signal(e,t){if(t?.internal!==!0){for(let s of e)if(this.config.messageTier(s[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 n=[];if(this._signalDeliver(e,t??{},new Set,n),n.length>0)throw n[0]}_signalDeliver(e,t,n,s){for(let d of this._mounts.values())d._signalDeliver(e,t,n,s);let i=t.internal===!0?{internal:!0}:{actor:t.actor,delivery:"signal"},a=kr(e,this.config);for(let d of[...this._nodes.keys()].sort()){let u=this._nodes.get(d);if(!n.has(u)){n.add(u);try{u.down(e,i)}catch(c){if(c instanceof X)throw c;s.push(c)}a.length!==0&&this._signalMetaSubtree(u,a,n,i,s)}}}_signalMetaSubtree(e,t,n,s,o){for(let i of Object.keys(e.meta).sort()){let a=e.meta[i];if(!n.has(a)){n.add(a);try{a.down(t,s)}catch(d){if(d instanceof X)throw d;o.push(d)}this._signalMetaSubtree(a,t,n,s,o)}}}describe(e){if(e?.reactive==="diff")return this._describeReactiveDiff(e);if(e?.reactive===!0)return this._describeReactive(e);let t=br(e?.actor),n=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 s=et(e?.detail,e?.fields),o=e?.detail==="spec",i=s,a=[];this._collectObserveTargets("",a);let d=new Map;for(let[b,T]of a)d.set(T,b);let u=[];{let b=a.map(([,m])=>m),T=new Set(d.values()),N=0;for(;b.length>0;){let m=b.shift();if(m instanceof F)for(let x of m._deps){let k=x.node;if(d.has(k))continue;let O=k.name??"",w=O;if(!w||T.has(w))if(O){let S=2;for(;T.has(`${O}#${S}`);)S++;w=`${O}#${S}`}else for(w=`__internal__/${N++}`;T.has(w);)w=`__internal__/${N++}`;d.set(k,w),T.add(w),u.push([w,k]),b.push(k)}}}let c=[...a,...u],f={};for(let[b,T]of c){if(t!=null&&!T.allowsObserve(t))continue;let N=At(T,i,o),m=T instanceof F?T._deps.map(w=>d.get(w.node)??w.node.name??""):[],{name:x,...k}=N,O={...k,deps:m};if(!o){let w=this._annotations.get(b);w!=null&&(O.annotation=w)}if(n!=null)if(typeof n=="function"){let w=n;if(!(w.length>=2?w(b,O):w(O)))continue}else{let w=!0;for(let[S,C]of Object.entries(n)){let R=S==="deps_includes"?"depsIncludes":S==="meta_has"?"metaHas":S;if(R==="depsIncludes"){if(!O.deps.includes(String(C))){w=!1;break}continue}if(R==="metaHas"){if(!Object.hasOwn(O.meta??{},String(C))){w=!1;break}continue}if(O[R]!==C){w=!1;break}}if(!w)continue}f[b]=O}let p=new Set(Object.keys(f)),h=[];for(let[b,T]of c)if(T instanceof F)for(let N of T._deps){let m=d.get(N.node);m!=null&&h.push([m,b])}h.sort((b,T)=>b[0]<T[0]?-1:b[0]>T[0]?1:b[1]<T[1]?-1:b[1]>T[1]?1:0);let l=h.map(([b,T])=>({from:b,to:T}));(t!=null||n!=null)&&(l=l.filter(b=>p.has(b.from)&&p.has(b.to)));let y=this._collectSubgraphs(""),g=t!=null||n!=null?y.filter(b=>{let T=`${b}${P}`;return[...p].some(N=>N===b||N.startsWith(T))}):y,E=this,v=e;return{name:this.name,nodes:f,edges:l,subgraphs:g,...this._factory!==void 0?{factory:this._factory}:{},...this._factoryArgs!==void 0?{factoryArgs:this._factoryArgs}:{},expand(b){let T={...v};return Array.isArray(b)?(T.fields=b,T.detail=void 0):(T.detail=b,T.fields=void 0),E.describe(T)}}}_collectSubgraphs(e){let t=[];for(let n of[...this._mounts.keys()].sort()){let s=e===""?n:`${e}${n}`;t.push(s),t.push(...this._mounts.get(n)._collectSubgraphs(`${s}${P}`))}return t}resourceProfile(e){return En(this,e)}reachable(e,t,n={}){return n.withDetail===!0?Ft(this.describe(),e,t,{...n,withDetail:!0}):Ft(this.describe(),e,t,n)}explain(e,t,n){return n?.reactive===!0?this._explainReactive(e,t,n):this._explainStatic(ue(e),ue(t),{...n?.maxDepth!==void 0?{maxDepth:On(n.maxDepth)}:{},...n?.findCycle!==void 0?{findCycle:Nn(n.findCycle)}:{}})}_explainStatic(e,t,n){let s=this.describe({detail:"full"}),o=new Map(this._annotations),i=new Map;for(let[a,d]of Object.entries(s.nodes))d.lastMutation!=null&&i.set(a,d.lastMutation);return mn(s,e,t,{...n?.maxDepth!=null?{maxDepth:n.maxDepth}:{},...n?.findCycle===!0?{findCycle:!0}:{},annotations:o,lastMutations:i})}_describeReactive(e){let t={...e,reactive:!1},n=e.reactiveName??"describe",s=0,o=U(s,{name:`${n}_version`}),i=this.observe({timeline:!0,structured:!0}),a=!1,d=!1,u=()=>{a||d||(a=!0,Re(()=>{a=!1,!d&&(s+=1,o.emit(s))}))},c=i.onEvent(v=>{let _=v.type;_!=="data"&&_!=="error"&&_!=="complete"&&_!=="teardown"||u()}),f=[],p=new WeakSet,h=v=>{if(p.has(v)||d)return;p.add(v);let _=v.topology.subscribe(b=>{for(let T of b){if(T[0]!==G)continue;let N=T[1];if(u(),N.kind==="added"&&N.nodeKind==="mount"){let m=v._mounts.get(N.name);m!=null&&h(m)}}});f.push(_);for(let b of v._mounts.keys()){let T=v._mounts.get(b);T!=null&&h(T)}};h(this);let l,y=e.actor;Rn(y)&&(l=y.subscribe(v=>{let _=!1,b=!1;for(let T of v){let N=T[0];N===G?_=!0:(N===V||N===D||N===B)&&(b=!0)}_&&u(),b&&(l?.(),l=void 0,u())}));let g;try{g=K([o],()=>this.describe(t),{name:n,describeKind:"derived",meta:{domain:"audit",kind:"describe"},equals:(v,_)=>v===_})}catch(v){c(),l?.();for(let _ of f)_();throw i.dispose(),v}let E=ie(g);return{node:g,dispose(){d=!0,c(),l?.();for(let v of f)v();f.length=0,i.dispose(),E()}}}_describeReactiveDiff(e){let t={...e,reactive:!1},n=e.reactiveName??"describe-diff",s={name:this.name,nodes:{},edges:[],subgraphs:[]},o=this.describe(t),i=Gt(s,o),a=U(i,{name:n,meta:{domain:"audit",kind:"describe-diff"},equals:(p,h)=>p===h}),d=this._describeReactive({...e,reactiveName:void 0}),u=!1,c=d.node.subscribe(p=>{if(!u)for(let h of p){if(h[0]!==G)continue;let l=h[1],y=Gt(o,l);o=l,y.events.length!==0&&a.emit(y)}}),f=ie(a);return{node:a,dispose(){u=!0,c(),d.dispose(),a.down([[B,"describe-diff disposed"]]),f()}}}_explainReactive(e,t,n){let s=0,o=U(s,{name:"explain_version"}),i=this.observe({timeline:!0,structured:!0}),a=!1,d=!1,u=()=>{a||d||(a=!0,Re(()=>{a=!1,!d&&(s+=1,o.emit(s))}))},c=i.onEvent(v=>{let _=v.type;_!=="data"&&_!=="error"&&_!=="complete"&&_!=="teardown"||u()}),f=[];e!=null&&we(e)&&f.push(e),t!=null&&we(t)&&f.push(t),n?.maxDepth!=null&&we(n.maxDepth)&&f.push(n.maxDepth),n?.findCycle!=null&&we(n.findCycle)&&f.push(n.findCycle);let p=()=>{for(let v of f)if(v.cache===void 0)return!1;return!0},h=()=>{let v=ue(e),_=ue(t);return{from:v,to:_,found:!1,reason:"pending",steps:[],text:"(awaiting reactive args)",toJSON:()=>({from:v,to:_,found:!1,reason:"pending",steps:[]})}},l;try{l=K([o],()=>{if(!p())return h();let v=ue(e),_=ue(t),b={...n?.maxDepth!==void 0?{maxDepth:On(n.maxDepth)}:{},...n?.findCycle!==void 0?{findCycle:Nn(n.findCycle)}:{}};return this._explainStatic(v,_,b)},{name:n?.name??"explain",describeKind:"derived",meta:{domain:"audit",kind:"explain_path",from:ue(e),to:ue(t)},equals:(v,_)=>v.found===_.found&&v.reason===_.reason&&v.steps.length===_.steps.length&&Sr(v.steps,_.steps)})}catch(v){throw c(),i.dispose(),v}let y=ie(l),g=[],E=v=>{let _;return _=v.subscribe(b=>{let T=!1,N=!1;for(let m of b){let x=m[0];x===G?T=!0:(x===V||x===D||x===B)&&(N=!0)}(T||N)&&u(),N&&_&&(_(),_=void 0)}),()=>{_&&(_(),_=void 0)}};for(let v of f)g.push(E(v));return{node:l,dispose(){d=!0,c();for(let v of g)v?.();g.length=0,i.dispose(),y()}}}_pathsMatching(e){let t=it(e),n=[];return this._collectObserveTargets("",n),n.map(([s])=>s).filter(s=>t.test(s))}_collectObserveTargets(e,t){for(let n of[...this._mounts.keys()].sort()){let s=e===""?n:`${e}${P}${n}`;this._mounts.get(n)._collectObserveTargets(s,t)}for(let n of[...this._nodes.keys()].sort()){let s=this._nodes.get(n),o=e===""?n:`${e}${P}${n}`;t.push([o,s]),this._appendMetaObserveTargets(o,s,t)}}_appendMetaObserveTargets(e,t,n){for(let s of Object.keys(t.meta).sort()){let o=t.meta[s],i=`${e}${P}${ee}${P}${s}`;n.push([i,o]),this._appendMetaObserveTargets(i,o,n)}}observe(e,t){let n=typeof e=="string",o=Sn(n?t:e);if(o.reactive===!0)return this._observeReactive(n?e:void 0,o);let i=o.structured===!0||o.timeline===!0||o.causal===!0||o.derived===!0||o.detail==="minimal"||o.detail==="full"||o.format!=null,a=o.actor;if(n){let c=e,f=this.resolve(c);if(a!=null&&!f.allowsObserve(a))throw new X({actor:a,action:"observe",nodeName:c});return i?this._buildStructuredObserver([[c,f]],o,"one"):{subscribe(p){return f.subscribe(p)},up(p){try{f.up?.(p)}catch(h){if(h instanceof X)return;throw h}}}}let d=[];this._collectObserveTargets("",d),d.sort((c,f)=>c[0]<f[0]?-1:c[0]>f[0]?1:0);let u=a==null?d:d.filter(([,c])=>c.allowsObserve(a));return i?this._buildStructuredObserver(u,o,"all"):{subscribe:c=>{let f=u.map(([p,h])=>h.subscribe(l=>{c(p,l)}));return()=>{for(let p of f)p()}},up:(c,f)=>{try{this.resolve(c).up?.(f)}catch(p){if(p instanceof X)return;throw p}}}}_observeReactive(e,t){let n=t.tiers,s=n!=null?new Set(n):null,o=t.reactiveName??"observe";return de(i=>{let a=[],d=!1,u=!1,c=()=>{if(a.length===0||u)return;let y={events:a.slice(),flushedAt_ns:se()};a.length=0,i.emit(y)},f={...t,reactive:!1,structured:!0,timeline:!0},p=e!=null?this.observe(e,f):this.observe(f),h=y=>{u||(a.push(y),!d&&(d=!0,Re(()=>{d=!1,c()})))};for(let y of p.events)h(y);let l=p.onEvent(h);return()=>{u=!0,l(),p.dispose()}},{name:o,meta:{domain:"audit",kind:"observe-reactive"}})}_buildStructuredObserver(e,t,n){let s=n==="one"?e[0]?.[0]:void 0,o=i=>{if(n==="one"&&s!=null){let c=this.resolve(s);return this._buildStructuredObserver([[s,c]],i,"one")}let a=[];this._collectObserveTargets("",a),a.sort((c,f)=>c[0]<f[0]?-1:c[0]>f[0]?1:0);let d=i.actor,u=d==null?a:a.filter(([,c])=>c.allowsObserve(d));return this._buildStructuredObserver(u,i,"all")};return this._createObserveResult(e,t,o)}_createObserveResult(e,t,n){let s=t.timeline===!0,o=t.causal===!0,i=t.derived===!0,a=t.detail==="minimal",d=this.config.inspectorEnabled,u=(o||i)&&d,c=t.maxEvents,f=c!=null&&c>0?new Le(c):null,p=[],h=new Set,l=t.tiers!=null?new Set(t.tiers):null,y={},g=new Set,E=0,v=0,_=0,b=0,T=0,N=0,m=!1,x=!1,k=0,O=new Map,w=new Map,S=new Map,C=A=>{if(!(l!=null&&!l.has(A.type))){f?f.push(A):p.push(A);for(let I of h)I(A)}},R=A=>l==null||l.has(A),$=()=>s?{timestamp_ns:se(),in_batch:We(),batch_id:k}:{},j=(A,I)=>{if(!(!u||!(A instanceof F)))return A._setInspectorHook(J=>{if(J.kind==="dep_message")O.set(A,J.depIndex);else if(J.kind==="run"){let Me=J.batchData.map((M,q)=>M!=null&&M.length>0?M.at(-1):J.prevData[q]);w.set(A,Me);let Z=J.batchData.map(M=>M!=null?[...M]:void 0);S.set(A,Z),i&&C({type:"derived",path:I,dep_values:Me,dep_batches:Z,...$()})}})},Y=A=>{let I=O.get(A),J=w.get(A);if(!o||J==null)return{};let Z=(I!=null&&I>=0&&A instanceof F?A._deps[I]:void 0)?.node,M=Z?.v,q=S.get(A);return{trigger_dep_index:I,trigger_dep_name:Z?.name,...M!=null?{trigger_version:{id:M.id,version:M.version}}:{},dep_values:[...J],...q!=null?{dep_batches:q}:{}}},Te=[],Ee=[];for(let[A,I]of e){let J=j(I,A);J&&Te.push(J),Ee.push(I.subscribe(Me=>{k++;for(let Z of Me){let M=Z[0],q=$();if(M===G){y[A]=Z[1];let gt=I instanceof F?I.lastMutation?.actor??Ne:Ne;C({type:"data",path:A,data:Z[1],actor:gt,...q,...Y(I)})}else if(a)M===H?R("dirty")&&E++:M===W?R("resolved")&&v++:M===Q?R("invalidate")&&_++:M===te?R("pause")&&b++:M===oe?R("resume")&&T++:M===B?R("teardown")&&N++:M===V&&!g.has(A)?R("complete")&&(m=!0):M===D&&R("error")&&(x=!0,g.add(A));else if(M===H)R("dirty")&&E++,C({type:"dirty",path:A,...q});else if(M===W)R("resolved")&&v++,C({type:"resolved",path:A,...q,...Y(I)});else if(M===Q)R("invalidate")&&_++,C({type:"invalidate",path:A,...q});else if(M===te)R("pause")&&b++,C({type:"pause",path:A,lockId:Z[1],...q});else if(M===oe)R("resume")&&T++,C({type:"resume",path:A,lockId:Z[1],...q});else if(M===V)R("complete")&&!g.has(A)&&(m=!0),C({type:"complete",path:A,...q});else if(M===D){R("error")&&(x=!0,g.add(A));let gt=I instanceof F?I.lastMutation?.actor??Ne:Ne;C({type:"error",path:A,data:Z[1],actor:gt,...q})}else M===B&&(R("teardown")&&N++,C({type:"teardown",path:A,...q}))}}))}let Ce=!1,De=()=>{if(!Ce){Ce=!0;for(let A of Ee)A();for(let A of Te)A();for(let A of Be)A({value:void 0,done:!0});Be.length=0}},ht=[],Be=[];h.add(A=>{let I=Be.shift();I?I({value:A,done:!1}):ht.push(A)});let Bt={get values(){return y},get dirtyCount(){return E},get resolvedCount(){return v},get invalidateCount(){return _},get pauseCount(){return b},get resumeCount(){return T},get teardownCount(){return N},get events(){return f?f.toArray():[...p]},get anyCompletedCleanly(){return m},get anyErrored(){return x},get completedWithoutErrors(){return m&&!x},onEvent(A){return h.add(A),()=>h.delete(A)},dispose:De,expand(A){De();let I={...t};return typeof A=="string"?I.detail=A:Object.assign(I,A),n(Sn(I))},[Symbol.asyncIterator](){return{next(){return ht.length>0?Promise.resolve({value:ht.shift(),done:!1}):Ce?Promise.resolve({value:void 0,done:!0}):new Promise(A=>Be.push(A))},return(){return De(),Promise.resolve({value:void 0,done:!0})}}}};return t.format!=null&&this._attachFormatLogger(Bt,t),Bt}_attachFormatLogger(e,t){let n=t.format;if(n==null)return;let s=t.logger??(l=>console.log(l)),o=t.includeTypes?new Set(t.includeTypes):null,i=t.excludeTypes?new Set(t.excludeTypes):null,a=o==null&&i==null?()=>!0:l=>(o==null||o.has(l))&&(i==null||!i.has(l)),d=xr(t.theme),u=n==="stage-log"?se():0,c=l=>l==null?"":t.stageLabels?.[l]??l,f=(l,y)=>l.length>y?`${l.slice(0,y-1)}\u2026`:l,p=l=>l.type==="data"||l.type==="error"?f(Lt(l.data),120):"",h=l=>{if(n==="stage-log"){let m=(se()-u)/1e9,x=c(l.path).padEnd(9);if(l.type==="data"){let k=p(l);return`[${m.toFixed(3)}s] ${x} \u2190${k?` ${k}`:""}`}if(l.type==="error"){let k=p(l);return`[${m.toFixed(3)}s] ${x} \u2717${k?` ${k}`:""}`}return l.type==="complete"?`[${m.toFixed(3)}s] ${x} \u25A0 complete`:`[${m.toFixed(3)}s] ${x} ${l.type}`}if(n==="json")try{return JSON.stringify(l)}catch{return JSON.stringify({type:l.type,path:l.path,data:"[unserializable]"})}let y=d[l.type]??"",g=l.path?`${d.path}${l.path}${d.reset} `:"",E=l.type==="data"||l.type==="error",v=l.type==="pause"||l.type==="resume",_=E?` ${Lt(l.data)}`:v?` ${Lt(l.lockId)}`:"",b=l.type==="data"||l.type==="resolved"||l.type==="derived"?l:void 0,T=b?.trigger_dep_name!=null?` <- ${b.trigger_dep_name}`:b?.trigger_dep_index!=null?` <- #${b.trigger_dep_index}`:"",N=l.in_batch?" [batch]":"";return`${g}${y}${l.type.toUpperCase()}${d.reset}${_}${T}${N}`};e.onEvent(l=>{a(l.type)&&s(h(l),l)})}addDisposer(e){return this._disposers.add(e),()=>{this._disposers.delete(e)}}destroy(){ot(this._disposers,this.name),this.signal([[B]],{internal:!0}),ot(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(){ot(this._disposers,this.name),ot(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,...n}=this.describe({detail:"full"}),s={};for(let a of Object.keys(n.nodes).sort()){let{lastMutation:d,guard:u,...c}=n.nodes[a];s[a]=c}let o=[...n.subgraphs].sort(),i={...n,version:1,nodes:s,subgraphs:o};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 Xt(a,a.encode(i))}throw new Error(`snapshot: unknown format "${String(e.format)}"`)}static decode(e,t){let n=t?.config??be,{codec:s,codecVersion:o,payload:i}=Qt(e,n);return s.decode(i,o)}restore(e,t){if(kn(e),e.name!==this.name)throw new Error(`Graph "${this.name}": restore snapshot name "${e.name}" does not match this graph`);let n=t?.only==null?null:(Array.isArray(t.only)?t.only:[t.only]).map(o=>it(o)),s=t?.includeProducers===!0;for(let o of Object.keys(e.nodes).sort()){if(n!==null&&!n.some(a=>a.test(o)))continue;let i=e.nodes[o];if(i!==void 0){if(!("value"in i)||i.value===void 0){"value"in i&&i.value===void 0&&t?.onError?.(o,new Error(`restore: slice.value is undefined for "${o}" (undefined is the global SENTINEL; not valid DATA)`));continue}if(!(i.type==="derived"||i.type==="effect")&&!(i.type==="producer"&&!s)){if(i.v!=null){let d=this.tryResolve(o)?.v;if(d!=null&&d.id===i.v.id&&d.version===i.v.version)continue}try{this.set(o,i.value)}catch(a){t?.onError?.(o,a)}}}}}static fromSnapshot(e,t){kn(e);let n=typeof t=="function"?t:t?.build,s=typeof t=="function"?void 0:t?.factories,o=new r(e.name);if(n)return n(o),o.restore(e),o;for(let h of[...e.subgraphs].sort((l,y)=>{let g=l.split(P).length,E=y.split(P).length;return g!==E?g-E:l<y?-1:l>y?1:0})){let l=h.split(P),y=o;for(let g of l)y._mounts.has(g)||y.mount(g,new r(g)),y=y._mounts.get(g)}let i=s?Object.entries(s).map(([h,l])=>({re:it(h),factory:l})):[],a=h=>{for(let l of i)if(l.re.test(h))return l.factory},d=h=>{let l=h.split(P),y=l.pop();if(y==null||y.length===0)throw new Error(`invalid snapshot path "${h}"`);let g=o;for(let E of l){let v=g._mounts.get(E);if(!v)throw new Error(`unknown mount "${E}" in path "${h}"`);g=v}return[g,y]},u=Object.entries(e.nodes).filter(([h])=>!h.includes(`${P}${ee}${P}`)).sort((h,l)=>h[0]<l[0]?-1:h[0]>l[0]?1:0),c=new Map(u),f=new Map,p=!0;for(;c.size>0&&p;){p=!1;for(let[h,l]of[...c.entries()]){let y=l?.deps??[];if(!y.every(T=>f.has(T)))continue;let[g,E]=d(h),v={...l?.meta??{}},_=a(h),b;if(l?.type==="state")b=U(l.value,{meta:v});else{if(_==null)continue;b=_(E,{path:h,type:l.type,value:l.value,meta:v,deps:y,resolvedDeps:y.map(T=>f.get(T))})}g.add(b,{name:E}),f.set(h,b),c.delete(h),p=!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 o.restore(e),o}toJSON(){return this.snapshot()}attachSnapshotStorage(e,t={}){let n=e.map(u=>({tier:u,debounceMs:Math.max(0,u.debounceMs??0),compactEvery:Math.max(1,u.compactEvery??10),timer:void 0,seq:0,lastSnapshot:void 0,lastFingerprint:"",disposed:!1,savePending:void 0}));t.autoRestore===!0&&this._cascadeRestore(e,t.onError);let s=(u,c)=>{if(u.disposed)return;let f=vr(c.nodes);if(u.lastSnapshot!=null&&f!==""&&f===u.lastFingerprint)return;let p=u.seq+1,h=ne(),g=u.lastSnapshot==null||p%u.compactEvery===0?{name:this.name,mode:"full",snapshot:c,seq:p,timestamp_ns:h,format_version:_e}:{name:this.name,mode:"diff",diff:Cn(u.lastSnapshot,c),seq:p,timestamp_ns:h,format_version:_e};if(u.tier.filter&&!u.tier.filter(g))return;let E;try{E=u.tier.save(g)}catch(v){t.onError?.(v,u.tier);return}if(E&&typeof E.then=="function"){let b=(u.savePending??Promise.resolve()).then(()=>E,()=>E).then(()=>{u.disposed||(u.seq=p,u.lastSnapshot=c,u.lastFingerprint=f)},T=>{t.onError?.(T,u.tier)});u.savePending=b.finally(()=>{u.savePending===b&&(u.savePending=void 0)})}else u.seq=p,u.lastSnapshot=c,u.lastFingerprint=f},o=(u,c)=>{try{s(u,c)}catch(f){t.onError?.(f,u.tier)}},i=(u,c)=>{if(!c.some(l=>{let y=this.config.messageTier(l[0]);return y>=3&&y<5}))return;if(t.filter){let l=this.tryResolve(u);if(l==null)return;let y=At(l,et("standard"));if(!t.filter(u,y))return}let p,h=()=>(p==null&&(p=this.snapshot()),p);for(let l of n)l.disposed||(l.debounceMs===0?o(l,h()):(l.timer==null&&(l.timer=new tt),l.timer.start(l.debounceMs,()=>{l.disposed||o(l,this.snapshot())})))},a;if(t.paths!=null){let c=(typeof t.paths=="string"?this._pathsMatching(t.paths):t.paths).map(f=>{let p=this.tryResolve(f);return p==null?()=>{}:p.subscribe(h=>i(f,h))});a=()=>{for(let f of c)f()}}else a=this.observe().subscribe((u,c)=>i(u,c));let d=()=>{a();for(let u of n)u.disposed=!0,u.timer?.cancel();this._storageDisposers.delete(d)};return this._storageDisposers.add(d),{dispose:d}}async _cascadeRestore(e,t){for(let n of e){let s;try{s=await n.load?.()}catch(i){t?.(i,n);continue}if(s==null||typeof s!="object"||Array.isArray(s))continue;let o=s;try{if(o.mode==="full"&&o.snapshot!=null)return this.restore(o.snapshot),!0;if(o.version===_e&&o.nodes!=null)return this.restore(o),!0}catch(i){t?.(i,n)}}return!1}static async fromStorage(e,t,n){for(let s of t){let o;try{o=await s.load?.()}catch(d){n?.onError?.(d,s);continue}if(o==null||typeof o!="object"||Array.isArray(o))continue;let i=o,a=i.mode==="full"&&i.snapshot!=null?i.snapshot:i.version===_e&&i.nodes!=null?i:void 0;if(a!=null)try{return r.fromSnapshot(a,n)}catch(d){n?.onError?.(d,s)}}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,n){if(e!=null&&t!=null){if(this.tryResolve(e)==null)return;if(this._annotations.set(e,t),this.config.inspectorEnabled){let s={path:e,annotation:t,timestamp_ns:se(),...n?.actor!=null?{actor:n.actor}:{}};this._traceRing.push(s)}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(s=>!e(s)),n=this._traceRing.size-t.length;this._traceRing.clear();for(let s of t)this._traceRing.push(s);return n}static diff(e,t){let n=new Set(Object.keys(e.nodes)),s=new Set(Object.keys(t.nodes)),o=[...s].filter(v=>!n.has(v)).sort(),i=[...n].filter(v=>!s.has(v)).sort(),a=[],d=[];for(let v of n){if(!s.has(v))continue;let _=e.nodes[v],b=t.nodes[v],T=_.v,N=b.v;T!=null&&N!=null&&T.id===N.id&&T.version!==N.version&&d.push({path:v,id:T.id,from:T.version,to:N.version});let m=T!=null&&N!=null&&T.id===N.id&&T.version===N.version;for(let x of["type","status","sentinel"]){let k=_[x],O=b[x];k!==O&&a.push({path:v,field:x,from:k,to:O})}if(!m)for(let x of["value","meta"]){let k=_[x],O=b[x];_r(k,O)||a.push({path:v,field:x,from:k,to:O})}}let u=v=>`${v.from} ${v.to}`,c=new Set(e.edges.map(u)),f=new Set(t.edges.map(u)),p=t.edges.filter(v=>!c.has(u(v))),h=e.edges.filter(v=>!f.has(u(v))),l=new Set(e.subgraphs),y=new Set(t.subgraphs),g=[...y].filter(v=>!l.has(v)).sort(),E=[...l].filter(v=>!y.has(v)).sort();return{nodesAdded:o,nodesRemoved:i,nodesChanged:a,versionChanges:d,edgesAdded:p,edgesRemoved:h,subgraphsAdded:g,subgraphsRemoved:E}}}});var $n=L(()=>{"use strict";Vt()});function Fn(r,e,t){return{[r]:!0,[`${r}_type`]:e,...t??{}}}var Vn=L(()=>{"use strict"});var Lr={};Wn(Lr,{CqrsGraph:()=>pt,cqrs:()=>Pr,cqrsEventKeyOf:()=>Mr,dispatchKeyOf:()=>Gr,sagaInvocationKeyOf:()=>Ir});module.exports=Kn(Lr);xe();fe();qe();fe();ae();Ct();ve();Ae();Pe();xe();fe();ae();Ae();Vt();Pe();ae();ve();Ae();var zt=class{_version=0;_maxSize;_buf;_head=0;_size=0;constructor(e,t){if(t!==void 0&&t<1)throw new RangeError("maxSize must be >= 1");if(this._maxSize=t,t!==void 0){if(this._buf=new Array(t),e&&e.length>0){let n=Math.min(e.length,t),s=e.length-n;for(let o=0;o<n;o++)this._buf[o]=e[s+o];this._size=n}}else this._buf=e?[...e]:[],this._size=this._buf.length}get version(){return this._version}get size(){return this._size}at(e){if(!Number.isInteger(e))return;let t=e>=0?e:this._size+e;if(!(t<0||t>=this._size))return this._maxSize!==void 0?this._buf[(this._head+t)%this._maxSize]:this._buf[t]}append(e){this._rawAppend(e),this._version+=1}appendMany(e){if(e.length===0)return;let t=this._maxSize!==void 0&&e.length>this._maxSize?e.length-this._maxSize:0;for(let n=t;n<e.length;n++)this._rawAppend(e[n]);this._version+=1}clear(){if(this._size===0)return 0;let e=this._size;if(this._maxSize===void 0)this._buf.length=0;else for(let t=0;t<e;t++)this._buf[(this._head+t)%this._maxSize]=void 0;return this._head=0,this._size=0,this._version+=1,e}trimHead(e){if(!Number.isInteger(e)||e<0)throw new RangeError(`trimHead: n must be a non-negative integer (got ${e})`);if(e===0||this._size===0)return 0;let t=Math.min(e,this._size);if(this._maxSize===void 0)this._buf.splice(0,t);else{for(let n=0;n<t;n++)this._buf[(this._head+n)%this._maxSize]=void 0;this._head=(this._head+t)%this._maxSize}return this._size-=t,this._version+=1,t}slice(e,t){if(!Number.isInteger(e)||e<0)throw new RangeError(`slice: start must be a non-negative integer (got ${e})`);if(t!==void 0&&(!Number.isInteger(t)||t<0))throw new RangeError(`slice: stop must be a non-negative integer or undefined (got ${t})`);let n=t===void 0?this._size:Math.min(Math.max(t,0),this._size),s=Math.min(e,this._size);if(s>=n)return[];let o=n-s;if(this._maxSize===void 0)return this._buf.slice(s,n);let i=new Array(o);for(let a=0;a<o;a++)i[a]=this._buf[(this._head+s+a)%this._maxSize];return i}tail(e){if(!Number.isInteger(e)||e<0)throw new RangeError(`tail: n must be a non-negative integer (got ${e})`);if(e===0||this._size===0)return[];let t=Math.min(e,this._size);return this.slice(this._size-t,this._size)}toArray(){if(this._maxSize===void 0)return[...this._buf];let e=new Array(this._size);for(let t=0;t<this._size;t++)e[t]=this._buf[(this._head+t)%this._maxSize];return e}snapshot(){return this.toArray()}restore(e){if(this._maxSize===void 0){this._buf.length=0;for(let t=0;t<e.length;t++)this._buf.push(e[t]);this._size=this._buf.length}else{let t=this._maxSize;for(let o=0;o<t;o++)this._buf[o]=void 0;this._head=0;let n=Math.min(e.length,t),s=e.length-n;for(let o=0;o<n;o++)this._buf[o]=e[s+o];this._size=n}this._version+=1}_rawAppend(e){if(this._maxSize===void 0){this._buf.push(e),this._size=this._buf.length;return}this._size<this._maxSize?(this._buf[(this._head+this._size)%this._maxSize]=e,this._size+=1):(this._buf[this._head]=e,this._head=(this._head+1)%this._maxSize)}};function $e(r){return r.subscribe(()=>{})}var Rr=64;function Fe(r,e={}){let{name:t,maxSize:n,versioning:s,guard:o,backend:i}=e,a=i??new zt(r,n),d=U(a.toArray(),{name:t,describeKind:"state",equals:(m,x)=>m===x,...s!=null?{versioning:s}:{},...o!=null?{guard:o}:{}});function u(){let m=a.toArray();ge(()=>{d.down([[H]],{internal:!0}),d.down([[G,m]],{internal:!0})})}let c=new Map,f=new Map,p=new Map;function h(m,x){return`${m}:${x===void 0?"END":x}`}function l(m){if(m.size<Rr)return;let x=m.keys().next();if(x.done)return;let k=m.get(x.value);k!==void 0&&k.dispose(),m.delete(x.value)}function y(m){let x=a.version;try{return m()}finally{a.version!==x&&u()}}function g(m){if(!Number.isInteger(m)||m<0)throw new RangeError(`tail: n must be a non-negative integer (got ${m})`);let x=c.get(m);if(x!==void 0)return c.delete(m),c.set(m,x),x.node;l(c);let k=K([d],([w])=>{let S=w;return m===0||S.length===0?[]:S.slice(Math.max(0,S.length-m))},{initial:a.tail(m),describeKind:"derived"}),O=$e(k);return c.set(m,{node:k,dispose:O}),k}function E(m,x){if(!Number.isInteger(m)||m<0)throw new RangeError(`slice: start must be a non-negative integer (got ${m})`);if(x!==void 0&&(!Number.isInteger(x)||x<0))throw new RangeError(`slice: stop must be a non-negative integer or undefined (got ${x})`);let k=h(m,x),O=f.get(k);if(O!==void 0)return f.delete(k),f.set(k,O),O.node;l(f);let w=K([d],([C])=>{let R=C;return x===void 0?R.slice(m):R.slice(m,x)},{initial:a.slice(m,x),describeKind:"derived"}),S=$e(w);return f.set(k,{node:w,dispose:S}),w}function v(m){let x=p.get(m);if(x!==void 0)return x.node;let k=K([d,m],([w,S])=>{let C=w,R=Math.max(0,Math.trunc(S??0));return C.slice(R)},{initial:[],describeKind:"derived"}),O=$e(k);return p.set(m,{node:k,dispose:O}),k}let _,b;function T(){_===void 0&&(_=re([d],(m,x,k)=>{let O=m[0],S=O!=null&&O.length>0?O.at(-1):k.prevData[0];if(S==null||S.length===0){x.down([[W]]);return}x.emit(S[S.length-1])},{name:t!=null?`${t}::lastValue`:"lastValue",describeKind:"derived",initial:a.size===0?void 0:a.at(a.size-1)}),b=K([d],([m])=>m.length>0,{name:t!=null?`${t}::hasLatest`:"hasLatest",describeKind:"derived",initial:a.size>0}),$e(_),$e(b))}let N={entries:d,get size(){return a.size},at(m){return a.at(m)},append(m){y(()=>a.append(m))},appendMany(m){m.length!==0&&y(()=>a.appendMany(m))},clear(){y(()=>a.clear())},trimHead(m){y(()=>a.trimHead(m))},withLatest(){return T(),d},get lastValue(){return T(),_},get hasLatest(){return T(),b},view(m){switch(m.kind){case"tail":return g(m.n);case"slice":return E(m.start,m.stop);case"fromCursor":return v(m.cursor)}},attach(m){let x=m.subscribe(k=>{for(let O of k)O[0]===G&&N.append(O[1])});return()=>x()},attachStorage(m){if(m.length===0)return()=>{};let x=new Map;for(let O of m)x.set(O,a.size);(async()=>{for(let O of m)if(typeof O.loadEntries=="function")try{let w=await Promise.resolve(O.loadEntries());w.entries.length>0&&a.size===0&&(a.restore(w.entries),x.set(O,w.entries.length),u());break}catch{}})();let k=d.subscribe(O=>{for(let w of O){if(w[0]!==G)continue;let S=w[1];for(let C of m){let R=x.get(C)??0;if(S.length<R){try{let j=C.appendEntries(S);j instanceof Promise&&j.catch(()=>{})}catch{}x.set(C,S.length);continue}if(S.length===R)continue;let $=S.slice(R);x.set(C,S.length);try{let j=C.appendEntries($);j instanceof Promise&&j.catch(()=>{})}catch{}}}});return()=>k()},disposeAllViews(){for(let m of c.values())m.dispose();c.clear();for(let m of f.values())m.dispose();f.clear();for(let m of p.values())m.dispose();p.clear()},dispose(){for(let m of c.values())m.dispose();c.clear();for(let m of f.values())m.dispose();f.clear();for(let m of p.values())m.dispose();p.clear()}};return N}var Ar=Oe((r,e)=>{r("observe"),r("signal"),e("write")});function dt(r){let e=Fe([],{name:r.name,maxSize:r.retainedLimit??1024,guard:r.guard??Ar,...r.versioning!=null?{versioning:r.versioning}:{}});return e.withLatest(),r.graph&&r.graph.add(e.entries,{name:r.name}),e}function jt(r){if(r===null||typeof r!="object"||Object.isFrozen(r))return r;for(let e of Object.keys(r))jt(r[e]);return Object.freeze(r)}var Dn=new WeakSet;function Mn(r){let e=r.cache,t=typeof e=="number"&&Number.isFinite(e);!t&&e!==void 0&&!Dn.has(r)&&(Dn.add(r),console.warn(`bumpCursor: cursor cache held a non-numeric value (${String(e)}); resetting to 0. Causes include: a snapshot codec round-tripping the cursor as a string / null / NaN, OR a malformed initial seed (e.g. state<number>(NaN)). Audit consumers may see colliding seq values after this point.`));let s=(t?e:0)+1;return r.down([[H],[G,s]]),s}function at(r,e,t,n,s,o){let i=e(t,n,s);if(i===void 0)return;let a=o!=null?{...i,handlerVersion:o}:i;r.append(a)}function Gn(r,e){let t=e.freeze??!0;return function(...s){let o=t?s.map(jt):s,i=ne(),a=e.seq?Mn(e.seq):void 0;try{let d=r(...o);return e.audit&&e.onSuccess&&at(e.audit,e.onSuccess,o,d,{t_ns:i,seq:a},e.handlerVersion),d}catch(d){if(e.audit&&e.onFailure){let u=d instanceof Error?d.name:typeof d;at(e.audit,e.onFailure,o,d,{t_ns:i,seq:a,errorType:u},e.handlerVersion)}throw d}}}function In(r,e){let t=e.freeze??!0;return function(...s){let o=t?s.map(jt):s,i=ne(),a,d,u=!1,c;try{ge(()=>{e.seq&&(c=Mn(e.seq));try{a=r(...o),e.audit&&e.onSuccess&&at(e.audit,e.onSuccess,o,a,{t_ns:i,seq:c},e.handlerVersion)}catch(f){throw d=f,u=!0,f}})}catch(f){if(u&&e.audit&&e.onFailure){let p=d instanceof Error?d.name:typeof d;at(e.audit,e.onFailure,o,d,{t_ns:i,seq:c,errorType:p},e.handlerVersion)}throw u?d:f}return a}}function Pn(r,e,t=0){let n=U(t,{name:e,describeKind:"state"});return r.add(n,{name:e}),n}function Ln(r,e,t,n=0){let s={},o=new ce(e);for(let i of t){let a=U(n,{name:i,describeKind:"state"});o.add(a,{name:i}),s[i]=a}return r.mount(e,o),s}$n();var le=class extends Error{constructor(e,t){super(e,t),this.name=this.constructor.name}},ut=class extends le{constructor(t,n){super(`Duplicate ${t} registration: "${n}"`);this.kind=t;this.registrationName=n}},ct=class extends le{constructor(t,n,s){super(`Command "${t}" emitted undeclared event "${n}". Declared emits: [${s.join(", ")}]`);this.commandName=t;this.eventName=n;this.declaredEmits=s}},lt=class extends le{constructor(t,n,s){super(`Optimistic concurrency conflict on aggregate "${t}": expected version ${n}, got ${s}`);this.aggregateId=t;this.expected=n;this.actual=s}},ft=class extends le{constructor(t){super(`Unknown command: "${t}". Register with command() first.`);this.commandName=t}},Ve=class extends le{constructor(t,n){super(`Command handler "${t}" threw: ${n instanceof Error?n.message:String(n)}`,{cause:n});this.commandName=t}};var ze=class extends le{constructor(t,n){super(`Projection "${t}" rebuild failed: ${n instanceof Error?n.message:String(n)}`,{cause:n});this.projectionName=t}};Vn();Pt();var Cr=Oe((r,e)=>{r("write"),r("signal"),e("observe")}),Dr=Oe((r,e)=>{r("observe"),r("signal"),e("write")}),zn=Oe((r,e)=>{r("observe"),r("signal"),e("write")});function je(r,e){return Fn("cqrs",r,e)}function jn(r){if(r===null||typeof r!="object"||Object.isFrozen(r))return r;for(let e of Object.keys(r))jn(r[e]);return Object.freeze(r)}var Mr=r=>`${r.type}::${r.aggregateId??"__default__"}`,Gr=r=>r.commandName,Ir=r=>r.eventType,pt=class extends ce{_eventLogs=new Map;_eventLogsByAggregate=new Map;_aggregateVersions=new Map;_aggregateLru=new Map;_commandRegs=new Map;_projections=new Set;_sagas=new Set;_keepaliveDisposers=[];_seq=0;_retainedLimit;_freezeCommandPayload;_freezeEventPayload;_maxAggregates;_dispatchSeqCursor;dispatches;audit;aggregateEvictions;constructor(e,t={}){super(e,t.graph),this._retainedLimit=t.retainedLimit??1024,this._freezeCommandPayload=t.freezeCommandPayload??!0,this._freezeEventPayload=t.freezeEventPayload??!0,this._maxAggregates=t.maxAggregates??1e4,this.dispatches=dt({name:"dispatches",retainedLimit:this._retainedLimit,graph:this}),this.audit=this.dispatches,this.aggregateEvictions=dt({name:"aggregateEvictions",retainedLimit:this._retainedLimit,graph:this}),this._dispatchSeqCursor=Pn(this,"dispatch_seq",0)}aggregateVersion(e,t){return this._aggregateVersions.get(`${e}::${t}`)??0}_touchAggregate(e){this._aggregateLru.delete(e),this._aggregateLru.set(e,!0)}_enforceAggregateLru(){for(;this._aggregateLru.size>this._maxAggregates;){let e=this._aggregateLru.keys().next();if(e.done)break;let t=e.value;this._aggregateLru.delete(t);let n=t.indexOf("::");if(n<0)continue;let s=t.slice(0,n),o=t.slice(n+2),i=this._aggregateVersions.get(t)??0;this._aggregateVersions.delete(t);let a=this._eventLogsByAggregate.get(s);a&&(a.delete(o),a.size===0&&this._eventLogsByAggregate.delete(s)),this.aggregateEvictions.append({aggregateId:o,type:s,lastVersion:i,t_ns:ne()})}}destroy(){for(let e of this._keepaliveDisposers)e();this._keepaliveDisposers.length=0,super.destroy()}_attachedEventTiers=[];_attachedTierDisposers=new Map;attachEventStorage(e){this._attachedEventTiers.push(e);for(let[t,n]of this._eventLogs){let s=n.log.attachStorage(e),o=this._attachedTierDisposers.get(t);o||(o=[],this._attachedTierDisposers.set(t,o)),o.push(s)}for(let[t,n]of this._eventLogsByAggregate)for(let[s,o]of n){let i=`${t}::${s}`,a=o.log.attachStorage(e),d=this._attachedTierDisposers.get(i);d||(d=[],this._attachedTierDisposers.set(i,d)),d.push(a)}return()=>{let t=this._attachedEventTiers.indexOf(e);t>=0&&this._attachedEventTiers.splice(t,1)}}_autoWireStreamStorage(e,t){if(this._attachedEventTiers.length===0)return;let n=this._attachedTierDisposers.get(e);n||(n=[],this._attachedTierDisposers.set(e,n));for(let s of this._attachedEventTiers)n.push(t.attachStorage(s))}event(e,t){if(t!==void 0)return this._ensureAggregateStream(e,t).node;let n=this._eventLogs.get(e);if(n)return n.node;let s=Fe([],{name:e,versioning:0,maxSize:this._retainedLimit});s.withLatest();let o=s.entries,i=K([o],([a])=>a,{name:e,describeKind:"state",meta:je("event",{event_name:e}),guard:zn,initial:o.cache});return this.add(i,{name:e}),this._keepaliveDisposers.push(ie(i)),this._eventLogs.set(e,{log:s,node:i}),this._autoWireStreamStorage(e,s),i}_ensureAggregateStream(e,t){this._eventLogs.has(e)||this.event(e);let n=this._eventLogsByAggregate.get(e);n||(n=new Map,this._eventLogsByAggregate.set(e,n));let s=`${e}::${t}`;this._touchAggregate(s);let o=n.get(t);if(o)return o;let i=`${e}_${t.replace(/[^a-zA-Z0-9_-]/g,"_")}`,a=Fe([],{name:i,versioning:0,maxSize:this._retainedLimit});a.withLatest();let d=a.entries,u=K([d],([h])=>h,{name:i,describeKind:"state",meta:je("event_aggregate",{event_name:e,aggregate_id:t}),guard:zn,initial:d.cache}),c=i,f=0;for(;this.nameOf(this.resolveOptional(c)??u)===c&&(f+=1,c=`${i}_${f}`,this.resolveOptional(c)!==void 0););try{this.add(u,{name:c})}catch{}this._keepaliveDisposers.push(ie(u));let p={log:a,node:u};return n.set(t,p),this._autoWireStreamStorage(`${e}::${t}`,a),this._enforceAggregateLru(),p}resolveOptional(e){try{return this.resolve(e)}catch{return}}_appendEvent(e,t,n){let s=this._eventLogs.get(e);if(s||(this.event(e),s=this._eventLogs.get(e)),s.node.status==="completed"||s.node.status==="errored")throw new Error(`Cannot dispatch to terminated event stream "${e}" (status: ${s.node.status}).`);let o,i;if(n?.aggregateId!==void 0){let c=`${e}::${n.aggregateId}`;o=(this._aggregateVersions.get(c)??0)+1,this._aggregateVersions.set(c,o),i=this._ensureAggregateStream(e,n.aggregateId)}let a=s.log.entries.v,d=this._freezeEventPayload?jn(t):t,u={type:e,payload:d,timestampNs:ne(),seq:++this._seq,...n?.aggregateId!==void 0?{aggregateId:n.aggregateId}:{},...o!==void 0?{aggregateVersion:o}:{},...n?.correlationId!==void 0?{correlationId:n.correlationId}:{},...n?.causationId!==void 0?{causationId:n.causationId}:{},...n?.metadata!==void 0?{metadata:Object.freeze({...n.metadata})}:{},...n?.handlerVersion!==void 0?{handlerVersion:n.handlerVersion}:{},...a!=null?{v0:{id:a.id,version:a.version}}:{}};return s.log.append(u),i&&i.log.append(u),u}command(e,t){if(this._commandRegs.has(e))throw new ut("command",e);let n=typeof t=="function"?{handler:t}:t,s=U(void 0,{name:e,describeKind:"state",meta:{...je("command",{command_name:e}),error:null},guard:Cr});if(this.add(s,{name:e}),this._commandRegs.set(e,{handler:n.handler,...n.emits!==void 0?{emits:n.emits}:{},...n.handlerVersion!==void 0?{handlerVersion:n.handlerVersion}:{}}),n.emits)for(let o of n.emits)this._eventLogs.has(o)||this.event(o);return s}dispatch(e,t,n){let s=this._commandRegs.get(e);if(!s)throw new ft(e);if(n?.aggregateId!==void 0&&n.expectedAggregateVersion!==void 0&&s.emits!==void 0){let u=0;for(let c of s.emits){let f=this._aggregateVersions.get(`${c}::${n.aggregateId}`);f!==void 0&&f>u&&(u=f)}if(u!==n.expectedAggregateVersion)throw new lt(n.aggregateId,n.expectedAggregateVersion,u)}let o=this.resolve(e),i=[],a=!1,d=u=>{o.emit(u,{internal:!0});try{s.handler(u,{emit:(c,f)=>{if(s.emits!==void 0&&!s.emits.includes(c))throw new ct(e,c,s.emits);i.push(c),this._appendEvent(c,f,{...n?.aggregateId!==void 0?{aggregateId:n.aggregateId}:{},...n?.correlationId!==void 0?{correlationId:n.correlationId}:{},...n?.causationId!==void 0?{causationId:n.causationId}:{},...n?.metadata!==void 0?{metadata:Object.freeze({...n.metadata})}:{},...s.handlerVersion!==void 0?{handlerVersion:s.handlerVersion}:{}})}}),o.meta.error.emit(null,{internal:!0})}catch(c){throw a=!0,c}};try{In(d,{audit:this.dispatches,seq:this._dispatchSeqCursor,freeze:this._freezeCommandPayload,onSuccess:([u],c,{t_ns:f,seq:p})=>({commandName:e,payload:u,outcome:"success",emittedEvents:[...i],t_ns:f,seq:p??0,...s.handlerVersion!==void 0?{handlerVersion:s.handlerVersion}:{}}),onFailure:([u],c,{t_ns:f,seq:p,errorType:h})=>{let l=c instanceof Ve?c:new Ve(e,c);return{commandName:e,payload:u,outcome:"failure",error:l,errorType:h,emittedEvents:[...i],t_ns:f,seq:p??0,...s.handlerVersion!==void 0?{handlerVersion:s.handlerVersion}:{}}}})(t)}catch(u){throw a&&o.meta.error.emit(u,{internal:!0}),u}}projection(e){let{name:t,events:n,reducer:s,initial:o}=e,i=e.mode??"scan",a=e.freezeInputs??!0,d=e.snapshot,u=n.map(O=>(this._eventLogs.has(O)||this.event(O),this._eventLogs.get(O).node));function c(O){O.sort((w,S)=>w.timestampNs-S.timestampNs||w.seq-S.seq||(w.aggregateId??"").localeCompare(S.aggregateId??""))}function f(O){let w=[];for(let S of O)w.push(...S);return c(w),w}let p=u.map(O=>O.cache??[]),h=f(p),l=a?Object.freeze(h):h,y=0,g=o;i==="scan"&&h.length>0&&(g=s(o,l),y=h.length);let E=i==="replay"?s(o,l):g,v=d?.saveDebounceMs??1e3,_=d?.saveEvery??1e3,b,T=0;function N(O){if(d?.save){if(T+=1,T>=_){T=0,b!==void 0&&(clearTimeout(b),b=void 0);let w=d.save(O);w instanceof Promise&&w.catch(()=>{});return}b!==void 0&&clearTimeout(b),b=setTimeout(()=>{b=void 0,T=0;let w=d.save(O);w instanceof Promise&&w.catch(()=>{})},v)}}let m=K(u,O=>{let w=f(O),S;if(i==="replay"){let C=a?Object.freeze(w):w;S=s(o,C)}else{let C=w.slice(y);y=w.length;let R=a?Object.freeze(C):C;S=s(g,R),g=S}return N(S),S},{name:t,describeKind:"derived",meta:je("projection",{projection_name:t,source_events:n}),guard:Dr,initial:E});return this.add(m,{name:t}),this._keepaliveDisposers.push(ie(m)),this._keepaliveDisposers.push(()=>{b!==void 0&&(clearTimeout(b),b=void 0)}),this._projections.add(t),{node:m,rebuild:async O=>{try{let w=O?.pageSize??1e3,S=O?.fromTier??this._attachedEventTiers[0]?.[0],C=f(u.map($=>$.cache??[])).length,R=o;if(d?.load){let $=await d.load();$!==void 0&&(R=$)}if(!S||!S.loadEntries){let $=f(u.map(Y=>Y.cache??[])),j=a?Object.freeze($):$;R=s(R,j)}else{let $=new Set(n),j,Y=!1;for(;!Y;){let Te=await S.loadEntries({cursor:j,pageSize:w}),Ee=[...Te.entries].filter(De=>$.has(De.type));c(Ee);let Ce=a?Object.freeze(Ee):Ee;R=s(R,Ce),j=Te.cursor,Y=!j||Te.entries.length===0}}if(i==="scan"){let $=f(u.map(Y=>Y.cache??[])),j=$.slice(C);if(j.length>0){let Y=a?Object.freeze(j):j;R=s(R,Y)}g=R,y=$.length}return m.emit(R,{internal:!0}),R}catch(w){throw new ze(t,w)}},reset:async()=>{try{let O=o;if(d?.load){let R=await d.load();R!==void 0&&(O=R)}let w=f(u.map(R=>R.cache??[])),S=a?Object.freeze(w):w,C=s(O,S);return i==="scan"&&(g=C,y=w.length),m.emit(C,{internal:!0}),C}catch(O){throw new ze(t,O)}}}}saga(e,t,n,s={}){let o=t.map(l=>(this._eventLogs.has(l)||this.event(l),this._eventLogs.get(l).node)),i=Ln(this,`${e}_cursor`,t,0),a=dt({name:`${e}_invocations`,retainedLimit:this._retainedLimit,graph:this}),d=s.aggregateId,u=s.errorPolicy??"advance",c=new Map;for(let l of t){let y=i[l];c.set(l,y.cache??0);let g=y.subscribe(E=>{for(let v of E)v[0]===G&&c.set(l,v[1])});this._keepaliveDisposers.push(g)}let f=Gn((l,y)=>{n(l)},{audit:a,freeze:!1,...s.handlerVersion!==void 0?{handlerVersion:s.handlerVersion}:{},onSuccess:([l,y],g,{t_ns:E})=>({eventType:y,outcome:"success",aggregateId:l.aggregateId,event:l,t_ns:E}),onFailure:([l,y],g,{t_ns:E,errorType:v})=>({eventType:y,outcome:"failure",error:g,errorType:v,aggregateId:l.aggregateId,event:l,t_ns:E})}),p={},h=re(o,(l,y)=>{let g=p.n.meta.error;for(let E=0;E<l.length;E++){let v=l[E];if(v==null||v.length===0)continue;let _=v.at(-1);if(!_)continue;let b=t[E],T=i[b],N=c.get(b)??0;if(_.length>N){let m=_.slice(N),x=N;for(let k of m){let O=k;if(d!==void 0&&O.aggregateId!==d){x+=1;continue}try{f(O,b),g.emit(null,{internal:!0}),x+=1}catch(w){if(g.emit(w,{internal:!0}),u==="hold")break;x+=1}}T.emit(x)}}},{name:e,describeKind:"effect",meta:{...je("saga",{saga_name:e,source_events:t}),error:null}});return p.n=h,this.add(h,{name:e}),this._keepaliveDisposers.push(ie(h)),this._sagas.add(e),{node:h,invocations:a,audit:a,cursors:i}}};function Pr(r,e){let t=new pt(r,e),{factory:n,factoryArgs:s,...o}=e??{};return t.tagFactory("cqrs",Rt(o)),t}0&&(module.exports={CqrsGraph,cqrs,cqrsEventKeyOf,dispatchKeyOf,sagaInvocationKeyOf});
@@ -1,8 +0,0 @@
1
- import '../../node-kK3CvTrR.cjs';
2
- import '../../index-D0aciIex.cjs';
3
- import '../../reactive-log-DIGdYqQ6.cjs';
4
- import '../../extra/storage-tiers.cjs';
5
- import '../../graph-CWvEUQAq.cjs';
6
- export { A as AggregateEvictionRecord, d as CommandActions, e as CommandHandler, f as CommandRegistration, a as CqrsEvent, C as CqrsEventMap, b as CqrsGraph, c as CqrsOptions, D as DispatchOptions, g as DispatchRecord, P as ProjectionController, h as ProjectionOptions, j as ProjectionReducer, k as ProjectionSnapshotOpts, S as SagaController, l as SagaHandler, m as SagaInvocation, n as SagaOptions, o as cqrs, p as cqrsEventKeyOf, q as dispatchKeyOf, s as sagaInvocationKeyOf } from '../../index-B-_tFaqV.cjs';
7
- import '../../sugar-DQjFmVqb.cjs';
8
- import '../../extra/storage-core.cjs';
@@ -1,8 +0,0 @@
1
- import '../../node-kK3CvTrR.js';
2
- import '../../index-Yq60JP3s.js';
3
- import '../../reactive-log-BKALbfal.js';
4
- import '../../extra/storage-tiers.js';
5
- import '../../graph-D9LFnda9.js';
6
- export { A as AggregateEvictionRecord, d as CommandActions, e as CommandHandler, f as CommandRegistration, a as CqrsEvent, C as CqrsEventMap, b as CqrsGraph, c as CqrsOptions, D as DispatchOptions, g as DispatchRecord, P as ProjectionController, h as ProjectionOptions, j as ProjectionReducer, k as ProjectionSnapshotOpts, S as SagaController, l as SagaHandler, m as SagaInvocation, n as SagaOptions, o as cqrs, p as cqrsEventKeyOf, q as dispatchKeyOf, s as sagaInvocationKeyOf } from '../../index-CeFiHtAg.js';
7
- import '../../sugar-fhLIE7TT.js';
8
- import '../../extra/storage-core.js';
@@ -1 +0,0 @@
1
- import{a,b,c,d,e}from"../../chunk-VV4N5P64.js";import"../../chunk-KZIEYVXN.js";import"../../chunk-W3I423PS.js";import"../../chunk-L6NSJVJZ.js";import"../../chunk-2T7U5EU6.js";import"../../chunk-3G5U5QNE.js";import"../../chunk-C72GO4IZ.js";import"../../chunk-HITNVN6B.js";import"../../chunk-ESMPEKEV.js";import"../../chunk-GHBWHMRZ.js";import"../../chunk-YBB7ZGTY.js";import"../../chunk-CRVT7D2P.js";import"../../chunk-NTEURFZH.js";import"../../chunk-CK2E7BTU.js";import"../../chunk-QYADASLV.js";export{d as CqrsGraph,e as cqrs,a as cqrsEventKeyOf,b as dispatchKeyOf,c as sagaInvocationKeyOf};