@graphrefly/graphrefly 0.32.0 → 0.33.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 (288) hide show
  1. package/dist/{cascading-D3sapjue.d.ts → cascading-Bg0a4VSf.d.ts} +2 -2
  2. package/dist/{cascading-BfQmSmjU.d.cts → cascading-DKIb6Pk8.d.cts} +2 -2
  3. package/dist/{chunk-4JBKKUCJ.js → chunk-2JO6LXFT.js} +1 -1
  4. package/dist/{chunk-FTA5TB2A.js → chunk-2LZ6DL45.js} +1 -1
  5. package/dist/{chunk-WQ7I7JVU.js → chunk-4F564IPP.js} +1 -1
  6. package/dist/{chunk-M2VFLRPJ.js → chunk-4NYSEUKV.js} +1 -1
  7. package/dist/{chunk-N2KKISCE.js → chunk-533RQFF6.js} +1 -1
  8. package/dist/{chunk-BU4SUZSA.js → chunk-55T3K37W.js} +1 -1
  9. package/dist/chunk-6HQ6HVTF.js +1 -0
  10. package/dist/{chunk-4VXL3UZK.js → chunk-7Q2WPFQ7.js} +1 -1
  11. package/dist/{chunk-5PBXUVHI.js → chunk-BY4WKPKM.js} +1 -1
  12. package/dist/{chunk-JYMNVEH6.js → chunk-C5DINHNP.js} +1 -1
  13. package/dist/{chunk-7QS77X6G.js → chunk-CJMFZXIZ.js} +1 -1
  14. package/dist/{chunk-W6FQIFVE.js → chunk-CLD3F4R5.js} +1 -1
  15. package/dist/chunk-DUK7LTJO.js +43 -0
  16. package/dist/{chunk-RWGJQQLT.js → chunk-FKRPIRE6.js} +1 -1
  17. package/dist/{chunk-UXEB35L4.js → chunk-GAOX6OPT.js} +1 -1
  18. package/dist/{chunk-TOCCHQI6.js → chunk-GCUYSIM4.js} +1 -1
  19. package/dist/chunk-HIJ2RKVP.js +1 -0
  20. package/dist/{chunk-XRSHMHEG.js → chunk-HTBOCKVD.js} +1 -1
  21. package/dist/{chunk-LJGPOJHS.js → chunk-IB64M7VP.js} +1 -1
  22. package/dist/{chunk-Q2SY7M7K.js → chunk-IJFSR4NU.js} +1 -1
  23. package/dist/{chunk-X4OOM6QU.js → chunk-INXDSJRC.js} +1 -1
  24. package/dist/{chunk-4YGJ7KZ6.js → chunk-IPNJDNE7.js} +1 -1
  25. package/dist/{chunk-4UUDNFYG.js → chunk-KGKJCHEK.js} +1 -1
  26. package/dist/{chunk-A4JT4SAD.js → chunk-KRH66M4O.js} +1 -1
  27. package/dist/{chunk-K54OKWNY.js → chunk-L3KUKDZC.js} +1 -1
  28. package/dist/{chunk-Y26UN6J5.js → chunk-LOF5HSD3.js} +1 -1
  29. package/dist/chunk-LYCLF26R.js +1 -0
  30. package/dist/{chunk-CZVYLXFK.js → chunk-M27MVZCP.js} +1 -1
  31. package/dist/{chunk-DWIAG62L.js → chunk-NNKJUORL.js} +1 -1
  32. package/dist/{chunk-PNTBXOQ6.js → chunk-O2WY22L7.js} +1 -1
  33. package/dist/{chunk-WF3V5X2L.js → chunk-PBN426RU.js} +1 -1
  34. package/dist/{chunk-MFNOZ5E6.js → chunk-Q46YJCQH.js} +1 -1
  35. package/dist/{chunk-KD3IYBTD.js → chunk-SFIM774L.js} +1 -1
  36. package/dist/{chunk-VXJX3ZZP.js → chunk-T2TB37TW.js} +1 -1
  37. package/dist/{chunk-UMH3HSP7.js → chunk-T7EQPKOP.js} +1 -1
  38. package/dist/{chunk-JAHAJU4G.js → chunk-TONEKQM3.js} +1 -1
  39. package/dist/{chunk-CNXUW2CU.js → chunk-TZLEMGAK.js} +1 -1
  40. package/dist/{chunk-LWGLBCMU.js → chunk-TZQPPQEQ.js} +1 -1
  41. package/dist/{chunk-7JZ3YORY.js → chunk-U2T2XWDA.js} +1 -1
  42. package/dist/{chunk-WE32AFFA.js → chunk-UF746BQ4.js} +1 -1
  43. package/dist/{chunk-7QMVU3IX.js → chunk-WBWBY6LI.js} +1 -1
  44. package/dist/{chunk-7EMUF2RY.js → chunk-Y63GWRHO.js} +1 -1
  45. package/dist/{chunk-PWKLZ2XU.js → chunk-YDWTVO4E.js} +1 -1
  46. package/dist/{chunk-EIFHFDFD.js → chunk-YUBV7EEE.js} +1 -1
  47. package/dist/chunk-Z4GXBOWO.js +61 -0
  48. package/dist/compat/index.cjs +5 -5
  49. package/dist/compat/index.d.cts +14 -14
  50. package/dist/compat/index.d.ts +14 -14
  51. package/dist/compat/index.js +1 -1
  52. package/dist/compat/jotai/index.cjs +1 -1
  53. package/dist/compat/jotai/index.d.cts +2 -2
  54. package/dist/compat/jotai/index.d.ts +2 -2
  55. package/dist/compat/jotai/index.js +1 -1
  56. package/dist/compat/nanostores/index.cjs +1 -1
  57. package/dist/compat/nanostores/index.d.cts +2 -2
  58. package/dist/compat/nanostores/index.d.ts +2 -2
  59. package/dist/compat/nanostores/index.js +1 -1
  60. package/dist/compat/nestjs/index.cjs +5 -5
  61. package/dist/compat/nestjs/index.d.cts +6 -6
  62. package/dist/compat/nestjs/index.d.ts +6 -6
  63. package/dist/compat/nestjs/index.js +1 -1
  64. package/dist/compat/react/index.d.cts +2 -2
  65. package/dist/compat/react/index.d.ts +2 -2
  66. package/dist/compat/solid/index.d.cts +2 -2
  67. package/dist/compat/solid/index.d.ts +2 -2
  68. package/dist/compat/svelte/index.d.cts +2 -2
  69. package/dist/compat/svelte/index.d.ts +2 -2
  70. package/dist/compat/vue/index.d.cts +2 -2
  71. package/dist/compat/vue/index.d.ts +2 -2
  72. package/dist/compat/zustand/index.cjs +3 -3
  73. package/dist/compat/zustand/index.d.cts +4 -4
  74. package/dist/compat/zustand/index.d.ts +4 -4
  75. package/dist/compat/zustand/index.js +1 -1
  76. package/dist/{composite-BY9hMxN7.d.ts → composite-BPDU_XV1.d.ts} +2 -2
  77. package/dist/{composite-CH0S8DFn.d.cts → composite-CmvdhTJe.d.cts} +2 -2
  78. package/dist/core/index.cjs +1 -1
  79. package/dist/core/index.d.cts +4 -4
  80. package/dist/core/index.d.ts +4 -4
  81. package/dist/core/index.js +1 -1
  82. package/dist/extra/browser.cjs +1 -1
  83. package/dist/extra/browser.d.cts +1 -1
  84. package/dist/extra/browser.d.ts +1 -1
  85. package/dist/extra/browser.js +1 -1
  86. package/dist/extra/index.cjs +16 -16
  87. package/dist/extra/index.d.cts +9 -9
  88. package/dist/extra/index.d.ts +9 -9
  89. package/dist/extra/index.js +1 -1
  90. package/dist/extra/node.cjs +1 -1
  91. package/dist/extra/node.d.cts +1 -1
  92. package/dist/extra/node.d.ts +1 -1
  93. package/dist/extra/node.js +1 -1
  94. package/dist/extra/operators.cjs +1 -1
  95. package/dist/extra/operators.d.cts +1 -1
  96. package/dist/extra/operators.d.ts +1 -1
  97. package/dist/extra/operators.js +1 -1
  98. package/dist/extra/reactive.cjs +1 -1
  99. package/dist/extra/reactive.d.cts +3 -3
  100. package/dist/extra/reactive.d.ts +3 -3
  101. package/dist/extra/reactive.js +1 -1
  102. package/dist/extra/sources.cjs +1 -1
  103. package/dist/extra/sources.d.cts +1 -1
  104. package/dist/extra/sources.d.ts +1 -1
  105. package/dist/extra/sources.js +1 -1
  106. package/dist/extra/storage-browser.cjs +1 -1
  107. package/dist/extra/storage-browser.d.cts +1 -1
  108. package/dist/extra/storage-browser.d.ts +1 -1
  109. package/dist/extra/storage-browser.js +1 -1
  110. package/dist/{fallback-Cb3GH1O7.d.cts → fallback-9YznPvPP.d.cts} +1 -1
  111. package/dist/{fallback-DRjJ_ZM8.d.ts → fallback-mYSd8vQo.d.ts} +1 -1
  112. package/dist/graph/index.cjs +4 -4
  113. package/dist/graph/index.d.cts +5 -5
  114. package/dist/graph/index.d.ts +5 -5
  115. package/dist/graph/index.js +1 -1
  116. package/dist/{graph-BOhEGJ6E.d.ts → graph-BROUZPG9.d.ts} +2 -2
  117. package/dist/{graph-CdJeX7O7.d.cts → graph-DaoydJ_u.d.cts} +2 -2
  118. package/dist/{index-CNyiYQWF.d.ts → index--BTb6HUO.d.ts} +332 -108
  119. package/dist/{index-BmZb8fNF.d.cts → index-B-KCkW4M.d.cts} +4 -4
  120. package/dist/{index-CDK5RsV5.d.cts → index-B1hFhK1K.d.cts} +1 -1
  121. package/dist/{index-C7RqYbOZ.d.ts → index-B5eS17Bz.d.ts} +7 -7
  122. package/dist/{index-DSawGt8n.d.cts → index-BDEhWLF4.d.cts} +3 -3
  123. package/dist/{index-CZUzi6Dy.d.ts → index-BFHpNSsV.d.ts} +4 -4
  124. package/dist/{index-DDo-eqQ4.d.cts → index-BO6t0HjV.d.cts} +1 -1
  125. package/dist/{index-CrC7urhX.d.ts → index-BRisOxlx.d.ts} +1 -1
  126. package/dist/{index-CHfBm51k.d.ts → index-BUtCR0k6.d.ts} +4 -4
  127. package/dist/{index-BydMDMf7.d.cts → index-BVTjuKeP.d.cts} +1 -1
  128. package/dist/{index-BX22kvjh.d.ts → index-BWiX5foT.d.ts} +1 -1
  129. package/dist/{index-Dxk-pUQI.d.ts → index-Bd2AjMQY.d.ts} +2 -2
  130. package/dist/{index-Dbmj0iYR.d.ts → index-Bi4ZP6Hc.d.ts} +2 -2
  131. package/dist/{index-j33Lfb1G.d.cts → index-BkfL5MXh.d.cts} +3 -3
  132. package/dist/{index-CnjUhRbs.d.cts → index-BpjQanLs.d.cts} +2 -2
  133. package/dist/{index-LGzAYqdR.d.ts → index-BsxqmV6u.d.ts} +2 -2
  134. package/dist/{index-CCdg0JLX.d.cts → index-C2Dey3L-.d.cts} +12 -3
  135. package/dist/{index-gXTVbSax.d.ts → index-C5uMGVJw.d.ts} +4 -4
  136. package/dist/{index-C-Gsh-0a.d.cts → index-C8_bnDBZ.d.cts} +3 -3
  137. package/dist/{index-C9qCLIN4.d.ts → index-CD7qmvSf.d.ts} +3 -3
  138. package/dist/{index-wIx1Jisk.d.ts → index-CI5fULSz.d.ts} +1 -1
  139. package/dist/{index-BUZPTPSQ.d.ts → index-CNxdDb2e.d.ts} +3 -3
  140. package/dist/{index-FBqTfL_S.d.cts → index-CQ1gt4rn.d.cts} +1 -1
  141. package/dist/{index-C22aTC1X.d.cts → index-C_cXlbu0.d.cts} +332 -108
  142. package/dist/{index-BDLy6CQ9.d.cts → index-Ccv_61jG.d.cts} +2 -2
  143. package/dist/{index-MV2yGIAq.d.ts → index-Ced0dphF.d.ts} +9 -9
  144. package/dist/{index-BzxU4yhV.d.cts → index-ChZvMC4M.d.cts} +4 -4
  145. package/dist/{index-zMQIQuDu.d.ts → index-Chi9IiHJ.d.ts} +3 -3
  146. package/dist/{index-DUkuH3jP.d.cts → index-ClJUZAOr.d.cts} +18 -3
  147. package/dist/{index-D7XxY1Ff.d.cts → index-ClKm7CFB.d.cts} +1 -1
  148. package/dist/{index-D3HcdZ4d.d.cts → index-Cn3taOmp.d.cts} +2 -2
  149. package/dist/{index-C4QTaDli.d.cts → index-CoR-tOZA.d.cts} +4 -4
  150. package/dist/{index-BpFWP7Bq.d.cts → index-Cp91Sxbo.d.cts} +5 -4
  151. package/dist/{index-DD1czHj3.d.ts → index-Cq7Uqgu4.d.ts} +2 -2
  152. package/dist/{index-EGjF6iSY.d.cts → index-D23g00HE.d.cts} +4 -4
  153. package/dist/{index-Bnmttu35.d.ts → index-D80nGRb9.d.ts} +3 -3
  154. package/dist/{index-DhlAMlm9.d.ts → index-DDf8PoPO.d.ts} +149 -52
  155. package/dist/{index-DY2QbdoP.d.cts → index-DR3XqZlV.d.cts} +1 -1
  156. package/dist/{index-BANwzwBV.d.ts → index-Db21wuaD.d.ts} +5 -4
  157. package/dist/{index-BuN2wGJs.d.cts → index-Dgcd59CJ.d.cts} +149 -52
  158. package/dist/{index-CIXaiYDE.d.cts → index-DhWrMTI6.d.cts} +1 -1
  159. package/dist/{index-Dp_pS7Bw.d.ts → index-DheNs40A.d.ts} +2 -2
  160. package/dist/{index-CVevMZ0n.d.ts → index-Dia4yc2y.d.ts} +3 -3
  161. package/dist/{index-_BXz9K7b.d.cts → index-Ds3Rz9m9.d.cts} +3 -3
  162. package/dist/{index-Ckl03Q0s.d.ts → index-Dtpr2FIB.d.ts} +18 -3
  163. package/dist/{index-ByPnK85n.d.ts → index-DupIl9wI.d.ts} +1 -1
  164. package/dist/{index-CEoU-r-g.d.ts → index-DuvQAU02.d.ts} +2 -2
  165. package/dist/{index-D0C_USMR.d.ts → index-DxEcY7Om.d.ts} +1 -1
  166. package/dist/{index-eYHRkoK-.d.ts → index-HvJ90_tX.d.ts} +12 -3
  167. package/dist/{index-LzCJ0kMT.d.cts → index-Jgl7ev9I.d.cts} +9 -9
  168. package/dist/{index-DlGaEBW5.d.cts → index-RJX4snyi.d.cts} +2 -2
  169. package/dist/{index-DNhTQReY.d.cts → index-ZIQaKIdY.d.cts} +7 -7
  170. package/dist/{index-lpGUhTBn.d.ts → index-b4a6Sg0R.d.ts} +4 -4
  171. package/dist/{index-BiGeETJs.d.cts → index-iKsmdnq6.d.cts} +2 -2
  172. package/dist/{index-CmSjld-4.d.ts → index-nP13Qe6T.d.ts} +1 -1
  173. package/dist/{index-BJDXj9Wf.d.cts → index-p0bkNfby.d.cts} +3 -3
  174. package/dist/{index-aBqZUx3B.d.cts → index-wcfc7W-f.d.cts} +2 -2
  175. package/dist/{index-BwdPDWI4.d.cts → index-yJY9thRY.d.cts} +2 -2
  176. package/dist/{index-BbcSZCAG.d.ts → index-ygRFoyrN.d.ts} +2 -2
  177. package/dist/{index-Ip3q9T9x.d.ts → index-zA1uVtk0.d.ts} +1 -1
  178. package/dist/index.cjs +48 -48
  179. package/dist/index.d.cts +44 -44
  180. package/dist/index.d.ts +44 -44
  181. package/dist/index.js +1 -1
  182. package/dist/{meta-COtmHLwT.d.cts → meta-BdjSt8ky.d.cts} +1 -1
  183. package/dist/{meta-BMwx3ExI.d.ts → meta-CtDjj7cU.d.ts} +1 -1
  184. package/dist/{node-BVV7G1bq.d.cts → node-8qx0kgYt.d.cts} +49 -1
  185. package/dist/{node-BVV7G1bq.d.ts → node-8qx0kgYt.d.ts} +49 -1
  186. package/dist/{observable-BrUAPeH_.d.cts → observable-B6Ba-TTI.d.cts} +1 -1
  187. package/dist/{observable-ITikPXz3.d.ts → observable-DOniYM2B.d.ts} +1 -1
  188. package/dist/patterns/ai/browser.cjs +4 -4
  189. package/dist/patterns/ai/browser.d.cts +4 -4
  190. package/dist/patterns/ai/browser.d.ts +4 -4
  191. package/dist/patterns/ai/browser.js +1 -1
  192. package/dist/patterns/ai/index.cjs +19 -19
  193. package/dist/patterns/ai/index.d.cts +16 -16
  194. package/dist/patterns/ai/index.d.ts +16 -16
  195. package/dist/patterns/ai/index.js +1 -1
  196. package/dist/patterns/ai/node.cjs +2 -2
  197. package/dist/patterns/ai/node.d.cts +4 -4
  198. package/dist/patterns/ai/node.d.ts +4 -4
  199. package/dist/patterns/ai/node.js +1 -1
  200. package/dist/patterns/audit/index.cjs +7 -7
  201. package/dist/patterns/audit/index.d.cts +5 -5
  202. package/dist/patterns/audit/index.d.ts +5 -5
  203. package/dist/patterns/audit/index.js +1 -1
  204. package/dist/patterns/cqrs/index.cjs +3 -3
  205. package/dist/patterns/cqrs/index.d.cts +4 -4
  206. package/dist/patterns/cqrs/index.d.ts +4 -4
  207. package/dist/patterns/cqrs/index.js +1 -1
  208. package/dist/patterns/demo-shell/index.cjs +6 -6
  209. package/dist/patterns/demo-shell/index.d.cts +5 -5
  210. package/dist/patterns/demo-shell/index.d.ts +5 -5
  211. package/dist/patterns/demo-shell/index.js +1 -1
  212. package/dist/patterns/domain-templates/index.cjs +6 -6
  213. package/dist/patterns/domain-templates/index.d.cts +4 -4
  214. package/dist/patterns/domain-templates/index.d.ts +4 -4
  215. package/dist/patterns/domain-templates/index.js +1 -1
  216. package/dist/patterns/graphspec/index.cjs +8 -8
  217. package/dist/patterns/graphspec/index.d.cts +5 -5
  218. package/dist/patterns/graphspec/index.d.ts +5 -5
  219. package/dist/patterns/graphspec/index.js +1 -1
  220. package/dist/patterns/guarded-execution/index.cjs +7 -7
  221. package/dist/patterns/guarded-execution/index.d.cts +6 -6
  222. package/dist/patterns/guarded-execution/index.d.ts +6 -6
  223. package/dist/patterns/guarded-execution/index.js +1 -1
  224. package/dist/patterns/harness/index.cjs +12 -12
  225. package/dist/patterns/harness/index.d.cts +10 -9
  226. package/dist/patterns/harness/index.d.ts +10 -9
  227. package/dist/patterns/harness/index.js +1 -1
  228. package/dist/patterns/job-queue/index.cjs +7 -7
  229. package/dist/patterns/job-queue/index.d.cts +4 -4
  230. package/dist/patterns/job-queue/index.d.ts +4 -4
  231. package/dist/patterns/job-queue/index.js +1 -1
  232. package/dist/patterns/lens/index.cjs +5 -5
  233. package/dist/patterns/lens/index.d.cts +6 -6
  234. package/dist/patterns/lens/index.d.ts +6 -6
  235. package/dist/patterns/lens/index.js +1 -1
  236. package/dist/patterns/memory/index.cjs +4 -4
  237. package/dist/patterns/memory/index.d.cts +4 -4
  238. package/dist/patterns/memory/index.d.ts +4 -4
  239. package/dist/patterns/memory/index.js +1 -1
  240. package/dist/patterns/messaging/index.cjs +4 -4
  241. package/dist/patterns/messaging/index.d.cts +4 -4
  242. package/dist/patterns/messaging/index.d.ts +4 -4
  243. package/dist/patterns/messaging/index.js +1 -1
  244. package/dist/patterns/orchestration/index.cjs +4 -4
  245. package/dist/patterns/orchestration/index.d.cts +5 -5
  246. package/dist/patterns/orchestration/index.d.ts +5 -5
  247. package/dist/patterns/orchestration/index.js +1 -1
  248. package/dist/patterns/reactive-layout/index.cjs +1 -1
  249. package/dist/patterns/reactive-layout/index.d.cts +5 -5
  250. package/dist/patterns/reactive-layout/index.d.ts +5 -5
  251. package/dist/patterns/reactive-layout/index.js +1 -1
  252. package/dist/patterns/reduction/index.cjs +1 -1
  253. package/dist/patterns/reduction/index.d.cts +4 -4
  254. package/dist/patterns/reduction/index.d.ts +4 -4
  255. package/dist/patterns/reduction/index.js +1 -1
  256. package/dist/patterns/refine-loop/index.cjs +7 -7
  257. package/dist/patterns/refine-loop/index.d.cts +5 -5
  258. package/dist/patterns/refine-loop/index.d.ts +5 -5
  259. package/dist/patterns/refine-loop/index.js +1 -1
  260. package/dist/patterns/resilient-pipeline/index.cjs +1 -1
  261. package/dist/patterns/resilient-pipeline/index.d.cts +6 -6
  262. package/dist/patterns/resilient-pipeline/index.d.ts +6 -6
  263. package/dist/patterns/resilient-pipeline/index.js +1 -1
  264. package/dist/patterns/surface/index.cjs +7 -7
  265. package/dist/patterns/surface/index.d.cts +6 -6
  266. package/dist/patterns/surface/index.d.ts +6 -6
  267. package/dist/patterns/surface/index.js +1 -1
  268. package/dist/{reactive-layout-Bq0rA2Wb.d.ts → reactive-layout-DBJ3Vz-m.d.ts} +2 -2
  269. package/dist/{reactive-layout-Dhhe54Oj.d.cts → reactive-layout-Dk9AOQb_.d.cts} +2 -2
  270. package/dist/{reactive-log-5jFeNRmd.d.cts → reactive-log-CWC7jO4J.d.cts} +1 -1
  271. package/dist/{reactive-log-BOJDCI5x.d.ts → reactive-log-CqaBg8nf.d.ts} +1 -1
  272. package/dist/{reactive-map-IJIfZxoh.d.cts → reactive-map-Cm89Hk0c.d.cts} +1 -1
  273. package/dist/{reactive-map-CtRaCddO.d.ts → reactive-map-LjwjcFaW.d.ts} +1 -1
  274. package/dist/{resilience-IVNDYORD.js → resilience-7UZHSSGC.js} +1 -1
  275. package/dist/{resilience-Q6Bt_7y0.d.cts → resilience-N_VtLf7W.d.cts} +1 -1
  276. package/dist/{resilience-CludlzcP.d.ts → resilience-RjDIHZNZ.d.ts} +1 -1
  277. package/dist/{sugar-BHbAACDG.d.ts → sugar-CQkn_rxB.d.ts} +1 -1
  278. package/dist/{sugar-CqR6DJ7v.d.cts → sugar-DVEYhR7a.d.cts} +1 -1
  279. package/dist/{topology-tree-CpSjvIXp.d.cts → topology-tree-BB6oJxMz.d.cts} +1 -1
  280. package/dist/{topology-tree-DAbCV2Yw.d.ts → topology-tree-CAFOG5S5.d.ts} +1 -1
  281. package/dist/{types-CdfO2QTt.d.ts → types-B2LfBvNc.d.ts} +16 -2
  282. package/dist/{types-BgMqbc7N.d.cts → types-Cp_4coR_.d.cts} +16 -2
  283. package/package.json +1 -1
  284. package/dist/chunk-2JNT5NDF.js +0 -61
  285. package/dist/chunk-2RH4QNDQ.js +0 -1
  286. package/dist/chunk-7AJKUA36.js +0 -1
  287. package/dist/chunk-LG73TUF4.js +0 -43
  288. package/dist/chunk-ZWETYYQG.js +0 -1
@@ -1 +1 @@
1
- "use strict";var _e=Object.defineProperty;var Ye=Object.getOwnPropertyDescriptor;var qe=Object.getOwnPropertyNames;var Ke=Object.prototype.hasOwnProperty;var Je=(n,e)=>{for(var t in e)_e(n,t,{get:e[t],enumerable:!0})},Xe=(n,e,t,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of qe(e))!Ke.call(n,r)&&r!==t&&_e(n,r,{get:()=>e[r],enumerable:!(s=Ye(e,r))||s.enumerable});return n};var Ze=n=>Xe(_e({},"__esModule",{value:!0}),n);var ut={};Je(ut,{COMPLETE:()=>A,COMPLETE_MSG:()=>me,COMPLETE_ONLY_BATCH:()=>le,DATA:()=>_,DEFAULT_ACTOR:()=>Ne,DIRTY:()=>w,DIRTY_MSG:()=>S,DIRTY_ONLY_BATCH:()=>Z,ERROR:()=>p,GraphReFlyConfig:()=>W,GuardDenied:()=>F,INVALIDATE:()=>T,INVALIDATE_MSG:()=>ye,INVALIDATE_ONLY_BATCH:()=>de,NodeImpl:()=>H,PAUSE:()=>N,RESOLVED:()=>x,RESOLVED_MSG:()=>J,RESOLVED_ONLY_BATCH:()=>ae,RESUME:()=>I,START:()=>C,START_MSG:()=>X,TEARDOWN:()=>b,TEARDOWN_MSG:()=>be,TEARDOWN_ONLY_BATCH:()=>Q,accessHintForGuard:()=>st,advanceVersion:()=>ue,autoTrackNode:()=>Be,batch:()=>Me,configure:()=>He,createVersioning:()=>te,defaultConfig:()=>G,defaultHash:()=>ee,derived:()=>Te,downWithBatch:()=>U,dynamicNode:()=>We,effect:()=>Ue,isBatching:()=>ie,isV1:()=>Re,monotonicNs:()=>ke,node:()=>L,normalizeActor:()=>Y,pipe:()=>je,policy:()=>De,policyFromRules:()=>tt,producer:()=>Pe,registerBuiltins:()=>ce,resolveDescribeFields:()=>Le,state:()=>Ve,wallClockNs:()=>oe});module.exports=Ze(ut);var Ne={type:"system",id:""};function Y(n){if(n==null)return Ne;let{type:e,id:t,...s}=n;return{type:e??"system",id:t??"",...s}}var V=0,q=!1,O=[],R=[],P=[],K=[];function ie(){return V>0||q}function Ae(){return V>0}function Ee(n){V>0?K.push(n):n()}function Me(n){V+=1;let e=!1;try{n()}catch(t){throw e=!0,t}finally{if(V-=1,V===0)if(e){if(!q){let t=K.splice(0);for(let s of t)try{s()}catch{}O.length=0,R.length=0,P.length=0}}else Qe()}}function Qe(){let n=!q;n&&(q=!0);let e=[],t=0;try{for(;O.length>0||R.length>0||P.length>0||n&&K.length>0;){if(n&&K.length>0){let o=K.splice(0);for(let a of o)try{a()}catch(i){e.push(i)}continue}if(t+=1,t>1e3)throw O.length=0,R.length=0,P.length=0,new Error("batch drain exceeded 1000 iterations \u2014 likely a reactive cycle");let r=(O.length>0?O:R.length>0?R:P).splice(0);for(let o of r)try{o()}catch(a){e.push(a)}}}finally{n&&(q=!1)}if(e.length===1)throw e[0];if(e.length>1)throw new AggregateError(e,"batch drain: multiple callbacks threw")}function U(n,e,t){if(e.length===0)return;if(e.length===1){let l=t(e[0][0]);if(l<3||!ie()){n(e);return}(l>=5?P:l===4?R:O).push(()=>n(e));return}let s=e.length,r=s,o=s,a=s,i=0;for(;i<s&&t(e[i][0])<3;)i++;for(r=i;i<s&&t(e[i][0])===3;)i++;for(o=i;i<s&&t(e[i][0])===4;)i++;a=i;let d=ie();if(r>0){let l=e.slice(0,r);n(l)}if(o>r){let l=e.slice(r,o);d?O.push(()=>n(l)):n(l)}if(a>o){let l=e.slice(o,a);d?R.push(()=>n(l)):n(l)}if(s>a){let l=e.slice(a,s);d?P.push(()=>n(l)):n(l)}}function ke(){return Math.trunc(performance.now()*1e6)}function oe(){return Date.now()*1e6}var C=Symbol.for("graphrefly/START"),_=Symbol.for("graphrefly/DATA"),w=Symbol.for("graphrefly/DIRTY"),x=Symbol.for("graphrefly/RESOLVED"),T=Symbol.for("graphrefly/INVALIDATE"),N=Symbol.for("graphrefly/PAUSE"),I=Symbol.for("graphrefly/RESUME"),b=Symbol.for("graphrefly/TEARDOWN"),A=Symbol.for("graphrefly/COMPLETE"),p=Symbol.for("graphrefly/ERROR"),S=Object.freeze([w]),J=Object.freeze([x]),ye=Object.freeze([T]),X=Object.freeze([C]),me=Object.freeze([A]),be=Object.freeze([b]),Z=Object.freeze([S]),ae=Object.freeze([J]),de=Object.freeze([ye]),le=Object.freeze([me]),Q=Object.freeze([be]);var W=class{_messageTypes=new Map;_codecs=new Map;_onMessage;_onSubscribe;_defaultVersioning;_defaultHashFn;_inspectorEnabled=!(typeof process<"u"&&process.env?.NODE_ENV==="production");_globalInspector;_frozen=!1;tierOf;constructor(e){this._onMessage=e.onMessage,this._onSubscribe=e.onSubscribe,this._defaultVersioning=e.defaultVersioning,this._defaultHashFn=e.defaultHashFn,this.tierOf=t=>{let s=this._messageTypes.get(t);return s!=null?s.tier:1}}get onMessage(){return this._frozen=!0,this._onMessage}get onSubscribe(){return this._frozen=!0,this._onSubscribe}set onMessage(e){this._assertUnfrozen(),this._onMessage=e}set onSubscribe(e){this._assertUnfrozen(),this._onSubscribe=e}get defaultVersioning(){return this._defaultVersioning}set defaultVersioning(e){this._assertUnfrozen(),this._defaultVersioning=e}get defaultHashFn(){return this._defaultHashFn}set defaultHashFn(e){this._assertUnfrozen(),this._defaultHashFn=e}get inspectorEnabled(){return this._inspectorEnabled}set inspectorEnabled(e){this._inspectorEnabled=e}get globalInspector(){return this._globalInspector}set globalInspector(e){this._globalInspector=e}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 ce(n){n.registerMessageType(C,{tier:0,wireCrossing:!1}),n.registerMessageType(w,{tier:1,wireCrossing:!1}),n.registerMessageType(T,{tier:1,wireCrossing:!1,metaPassthrough:!1}),n.registerMessageType(N,{tier:2,wireCrossing:!1}),n.registerMessageType(I,{tier:2,wireCrossing:!1}),n.registerMessageType(_,{tier:3,wireCrossing:!0}),n.registerMessageType(x,{tier:3,wireCrossing:!0}),n.registerMessageType(A,{tier:4,wireCrossing:!0,metaPassthrough:!1}),n.registerMessageType(p,{tier:4,wireCrossing:!0,metaPassthrough:!1}),n.registerMessageType(b,{tier:5,wireCrossing:!0,metaPassthrough:!1})}var F=class extends Error{actor;action;nodeName;constructor(e,t){super(t??`GuardDenied: action "${String(e.action)}" denied for actor type "${String(e.actor.type)}"`),this.name="GuardDenied",this.actor=e.actor,this.action=e.action,this.nodeName=e.nodeName}get node(){return this.nodeName}};function Se(n){return Array.isArray(n)?[...n]:[n]}function et(n,e){return n.has(e)||n.has("*")}function De(n){let e=[];return n((r,o)=>{e.push({kind:"allow",actions:new Set(Se(r)),where:o?.where??(()=>!0)})},(r,o)=>{e.push({kind:"deny",actions:new Set(Se(r)),where:o?.where??(()=>!0)})}),(r,o)=>{let a=!1,i=!1;for(let d of e)et(d.actions,o)&&d.where(r)&&(d.kind==="deny"?a=!0:i=!0);return a?!1:i}}function tt(n){return De((e,t)=>{for(let s of n){let r=s.actorType==null?null:new Set(Array.isArray(s.actorType)?s.actorType:[s.actorType]),o=s.actorId==null?null:new Set(Array.isArray(s.actorId)?s.actorId:[s.actorId]),a=Object.entries(s.claims??{}),i=d=>{if(r!==null&&!r.has(String(d.type))||o!==null&&!o.has(String(d.id??"")))return!1;for(let[l,c]of a)if(d[l]!==c)return!1;return!0};s.effect==="deny"?t(s.action,{where:i}):e(s.action,{where:i})}})}var nt=["human","llm","wallet","system"];function st(n){let e=nt.filter(t=>n({type:t,id:""},"write"));return e.length===0?"restricted":e.includes("human")&&e.includes("llm")&&e.every(t=>t==="human"||t==="llm"||t==="system")?"both":e.length===1?e[0]:e.join("+")}var rt={name:"json",version:1,contentType:"application/json",encode(n){let e=JSON.stringify(n);return new TextEncoder().encode(e)},decode(n,e){let t=new TextDecoder().decode(n);return JSON.parse(t)}};function Oe(n){n.registerCodec(rt)}function ve(n){if(n===void 0)return null;if(typeof n=="number"){if(!Number.isFinite(n))throw new TypeError(`Cannot hash non-finite number: ${n}`);if(Number.isInteger(n)&&!Number.isSafeInteger(n))throw new TypeError(`Cannot hash integer outside safe range (|n| > 2^53-1): ${n}. Cross-language cid parity is not guaranteed for unsafe integers.`);return n}if(typeof n=="string"||typeof n=="boolean"||n===null)return n;if(Array.isArray(n))return n.map(ve);if(typeof n=="object"&&n!==null){let e={};for(let t of Object.keys(n).sort())e[t]=ve(n[t]);return e}return null}var it=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),ot=new TextEncoder;function at(n){let e=ot.encode(n),t=e.length,s=t*8,r=t+9+63&-64,o=new Uint8Array(r);o.set(e),o[t]=128;let a=new DataView(o.buffer);a.setUint32(r-4,s>>>0,!1),a.setUint32(r-8,Math.floor(s/4294967296)>>>0,!1);let i=1779033703,d=3144134277,l=1013904242,c=2773480762,u=1359893119,g=2600822924,f=528734635,v=1541459225,D=new Uint32Array(64),m=(M,y)=>M>>>y|M<<32-y;for(let M=0;M<r;M+=64){for(let h=0;h<16;h++)D[h]=a.getUint32(M+h*4,!1);for(let h=16;h<64;h++){let z=D[h-15],$=D[h-2],re=m(z,7)^m(z,18)^z>>>3,ge=m($,17)^m($,19)^$>>>10;D[h]=D[h-16]+re+D[h-7]+ge>>>0}let y=i,B=d,j=l,he=c,k=u,ne=g,se=f,pe=v;for(let h=0;h<64;h++){let z=m(k,6)^m(k,11)^m(k,25),$=k&ne^~k&se,re=pe+z+$+it[h]+D[h]>>>0,ge=m(y,2)^m(y,13)^m(y,22),ze=y&B^y&j^B&j,$e=ge+ze>>>0;pe=se,se=ne,ne=k,k=he+re>>>0,he=j,j=B,B=y,y=re+$e>>>0}i=i+y>>>0,d=d+B>>>0,l=l+j>>>0,c=c+he>>>0,u=u+k>>>0,g=g+ne>>>0,f=f+se>>>0,v=v+pe>>>0}let E=M=>M.toString(16).padStart(8,"0");return E(i)+E(d)+E(l)+E(c)+E(u)+E(g)+E(f)+E(v)}function ee(n){let e=ve(n??null),t=JSON.stringify(e);return at(t).slice(0,16)}function dt(){let n=globalThis.crypto;if(n?.randomUUID)return n.randomUUID();let e=()=>Math.floor(Math.random()*4294967296).toString(16).padStart(8,"0"),t=e()+e()+e()+e();return`${t.slice(0,8)}-${t.slice(8,12)}-4${t.slice(13,16)}-${(parseInt(t.slice(16,17),16)&3|8).toString(16)}${t.slice(17,20)}-${t.slice(20,32)}`}function te(n,e,t){let s=t?.id??dt();if(n===0)return{id:s,version:0};let o=(t?.hash??ee)(e);return{id:s,version:0,cid:o,prev:null}}function ue(n,e,t){n.version+=1,"cid"in n&&(n.prev=n.cid,n.cid=t(e))}function Re(n){return"cid"in n}var Ce=()=>{},Ie=100;function Fe(n){return{node:n,unsub:null,prevData:void 0,dirty:!1,involvedThisWave:!1,dataBatch:[],terminal:void 0}}function we(n){n.prevData=void 0,n.dirty=!1,n.involvedThisWave=!1,n.dataBatch.length=0,n.terminal=void 0}function fe(n){return n.length===0?n:typeof n[0]=="symbol"?[n]:n}var lt=(n,e,t,s)=>{t.direction==="down-in"&&n._onDepMessage(t.depIndex,e)},ct=(n,e,t,s)=>{let r=n;if(r._status==="completed"||r._status==="errored")return;let o=r._cached,a=o===void 0?[X]:[X,[_,o]];r._status==="dirty"&&a.push(S),U(e,a,r._config.tierOf)},G=new W({onMessage:lt,onSubscribe:ct});ce(G);Oe(G);function He(n){if(G._isFrozen())throw new Error("configure() called after a node was created \u2014 the default GraphReFlyConfig is frozen. Call configure(...) at application startup, before any node factories run.");n(G)}var H=class n{_optsName;_describeKind;meta;_hasMeta;_config;_deps;_sinks=null;_sinkCount=0;_cached;_status;_cleanup;_store={};_waveHasNewData=!1;_hasNewTerminal=!1;_hasCalledFnOnce=!1;_paused=!1;_pendingWave=!1;_isExecutingFn=!1;_pendingRerun=!1;_rerunDepth=0;_dirtyDepCount=0;_batchPendingMessages=null;_pauseLocks=null;_pauseBuffer=null;_fn;_equals;_resubscribable;_resetOnTeardown;_autoComplete;_autoError;_pausable;_partial;_guard;_extraGuards;_hashFn;_versioning;_versioningLevel;_lastMutation;_inspectorHooks;_actions;constructor(e,t,s){this._config=s.config??G,this._config.onMessage,this._optsName=s.name,this._describeKind=s.describeKind,this._equals=s.equals??Object.is,this._resubscribable=s.resubscribable??!1,this._resetOnTeardown=s.resetOnTeardown??!1,this._autoComplete=s.completeWhenDepsComplete??!0,this._autoError=s.errorWhenDepsError??!0,this._pausable=s.pausable??!0,this._guard=s.guard,this._fn=t,this._partial=s.partial??!1,this._cached=s.initial!==void 0?s.initial:void 0,this._status=e.length===0&&t==null&&this._cached!==void 0?"settled":"sentinel",this._hashFn=s.versioningHash??this._config.defaultHashFn??ee;let r=s.versioning??this._config.defaultVersioning;this._versioningLevel=r,this._versioning=r!=null?te(r,this._cached===void 0?void 0:this._cached,{id:s.versioningId,hash:this._hashFn}):void 0,this._deps=e.map(Fe);let o={};for(let[i,d]of Object.entries(s.meta??{})){let l={initial:d,name:`${s.name??"node"}:meta:${i}`,describeKind:"state",config:this._config};s.guard!=null&&(l.guard=s.guard),o[i]=new n([],void 0,l)}Object.freeze(o),this.meta=o,this._hasMeta=Object.keys(o).length>0;let a=this;this._actions={emit(i){a._emit([[_,i]])},down(i){a._emit(fe(i))},up(i){a._emitUp(fe(i))}},this.down=this.down.bind(this),this.up=this.up.bind(this)}get _isTerminal(){return this._status==="completed"||this._status==="errored"}get name(){return this._optsName}get status(){return this._status}get cache(){return this._cached===void 0?void 0:this._cached}get lastMutation(){return this._lastMutation}get v(){return this._versioning}hasGuard(){return this._guard!=null}_applyVersioning(e,t){if(this._isExecutingFn)throw new Error(`Node "${this.name}": _applyVersioning cannot run mid-fn \u2014 call it outside of \`_execFn\` (typically at graph setup time before the first subscribe).`);let s=this._versioningLevel;if(s!=null&&e<=s)return;let r=t?.hash??this._hashFn;r!==this._hashFn&&(this._hashFn=r);let o=this._cached===void 0?void 0:this._cached,a=this._versioning,i=a?.id??t?.id,d=a?.version??0,l=te(e,o,{id:i,hash:r});l.version=d,this._versioning=l,this._versioningLevel=e}_setInspectorHook(e){return e==null?()=>{}:(this._inspectorHooks==null&&(this._inspectorHooks=new Set),this._inspectorHooks.add(e),()=>{this._inspectorHooks?.delete(e),this._inspectorHooks?.size===0&&(this._inspectorHooks=void 0)})}_pushGuard(e){return this._extraGuards==null&&(this._extraGuards=new Set),this._extraGuards.add(e),()=>{this._extraGuards?.delete(e),this._extraGuards?.size===0&&(this._extraGuards=void 0)}}allowsObserve(e){if(this._guard==null&&this._extraGuards==null)return!0;let t=Y(e);if(this._guard!=null&&!this._guard(t,"observe"))return!1;if(this._extraGuards!=null){for(let s of this._extraGuards)if(!s(t,"observe"))return!1}return!0}_checkGuard(e){if(e?.internal)return;let t=this._guard!=null||this._extraGuards!=null,s=e?.actor!=null;if(!t&&!s)return;let r=Y(e?.actor),o=e?.delivery==="signal"?"signal":"write";if(this._guard!=null&&!this._guard(r,o))throw new F({actor:r,action:o,nodeName:this.name});if(this._extraGuards!=null){for(let a of this._extraGuards)if(!a(r,o))throw new F({actor:r,action:o,nodeName:this.name})}this._lastMutation={actor:r,timestamp_ns:oe()}}down(e,t){let s=fe(e);s.length!==0&&(this._checkGuard(t),this._emit(s))}emit(e,t){this._checkGuard(t),this._emit([[_,e]])}up(e,t){if(this._deps.length===0)return;let s=fe(e);if(s.length===0)return;this._checkGuard(t);let r=t??{internal:!0};this._validateUpTiers(s);for(let o of this._deps)o.node.up?.(s,r)}_emitUp(e){if(this._deps.length!==0&&e.length!==0){this._validateUpTiers(e);for(let t of this._deps)t.node.up?.(e,{internal:!0})}}_validateUpTiers(e){let t=this._config.tierOf;for(let s of e){let r=t(s[0]);if(r===3||r===4)throw new Error(`Node "${this.name}": tier-${r} messages cannot flow up \u2014 DATA/RESOLVED/COMPLETE/ERROR are downstream-only. Use \`down(...)\` for value delivery; \`up(...)\` is for control signals (DIRTY, INVALIDATE, PAUSE, RESUME, TEARDOWN).`)}}subscribe(e,t){if(t!=null&&this._guard!=null){let d=Y(t);if(!this._guard(d,"observe"))throw new F({actor:d,action:"observe",nodeName:this.name})}let r=this._isTerminal&&this._resubscribable;if(r){this._cached=void 0,this._status="sentinel",this._store={},this._hasCalledFnOnce=!1,this._waveHasNewData=!1,this._hasNewTerminal=!1,this._paused=!1,this._pendingWave=!1,this._pendingRerun=!1,this._isExecutingFn=!1,this._rerunDepth=0,this._dirtyDepCount=0,this._pauseLocks=null,this._pauseBuffer=null;for(let d of this._deps)we(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:r},this._actions)}catch(d){throw this._sinkCount-=1,d}this._sinks==null?this._sinks=e:typeof this._sinks=="function"?this._sinks=new Set([this._sinks,e]):this._sinks.add(e);let a=this._isTerminal;if(this._sinkCount===1&&!a)try{this._activate()}catch(d){if(this._sinkCount-=1,this._removeSink(e),this._sinkCount===0&&(this._status="sentinel"),typeof o=="function")try{o()}catch{}throw d}this._status==="sentinel"&&this._cached===void 0&&(this._status="pending");let i=!1;return()=>{i||(i=!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 s=0;s<e;s++){let r=s,o=this._deps[s];o.unsub=Ce,o.unsub=o.node.subscribe(a=>{if(o.unsub===null)return;let i=this._config.tierOf,d=!1;for(let l of a)i(l[0])>=3&&(d=!0),this._config.onMessage(this,l,{direction:"down-in",depIndex:r},this._actions);d&&this._maybeRunFnOnSettlement()}),t++}}catch(s){this._deps[t].unsub=null;for(let r=0;r<t;r++){let o=this._deps[r];if(o.unsub!=null){let a=o.unsub;o.unsub=null;try{a()}catch{}we(o)}}throw this._dirtyDepCount=0,s}}_addDep(e){for(let r=0;r<this._deps.length;r++)if(this._deps[r].node===e)return r;let t=this._deps.length,s=Fe(e);if(this._deps.push(s),this._sinks==null)return t;s.dirty=!0,this._dirtyDepCount++,this._status!=="dirty"&&this._emit(Z),s.unsub=Ce;try{s.unsub=e.subscribe(r=>{if(s.unsub===null)return;let o=this._config.tierOf,a=!1;for(let i of r)o(i[0])>=3&&(a=!0),this._config.onMessage(this,i,{direction:"down-in",depIndex:t},this._actions);a&&this._maybeRunFnOnSettlement()})}catch(r){throw s.unsub=null,this._deps.pop(),this._dirtyDepCount--,r}return t}_deactivate(e=!1){let t=this._cleanup;if(this._cleanup=void 0,typeof t=="function")try{t()}catch(s){this._emit([[p,this._wrapFnError("cleanup threw",s)]])}else if(t!=null&&typeof t=="object"){let s=t.deactivate;if(typeof s=="function")try{s()}catch(r){this._emit([[p,this._wrapFnError("cleanup.deactivate threw",r)]])}}for(let s of this._deps){if(s.unsub!=null){let r=s.unsub;s.unsub=null;try{r()}catch{}}we(s)}this._waveHasNewData=!1,this._hasNewTerminal=!1,this._hasCalledFnOnce=!1,this._paused=!1,this._pendingWave=!1,this._pendingRerun=!1,this._rerunDepth=0,this._store={},this._dirtyDepCount=0,this._pauseLocks=null,this._pauseBuffer=null,this._fn!=null&&(this._cached=void 0),e||(this._fn!=null||this._deps.length>0)&&(!this._isTerminal||this._resubscribable)&&(this._status="sentinel")}_onDepMessage(e,t){let s=this._deps[e],r=t[0];if(this._inspectorHooks!=null){let o={kind:"dep_message",depIndex:e,message:t};for(let a of this._inspectorHooks)a(o)}if(r!==C){if(r===w){this._depDirtied(s);return}if(r===T){if(this._depInvalidated(s),this._cached===void 0)return;this._emit(de);return}if(r===N||r===I){this._emit([t]);return}if(r===b){this._emit(Q);return}if(r===_)this._depSettledAsData(s,t[1]);else if(r===x)this._depSettledAsResolved(s);else if(r===A)this._depSettledAsTerminal(s,!0);else if(r===p)this._depSettledAsTerminal(s,t[1]);else{this._emit([t]);return}if(!this._fn){(r===_||r===x)&&this._emit([t]),(r===A||r===p)&&this._maybeAutoTerminalAfterWave();return}}}_depDirtied(e){e.dirty||(e.dirty=!0,e.involvedThisWave=!0,this._dirtyDepCount++,this._status!=="dirty"&&this._emit(Z))}_depSettledAsData(e,t){e.dirty&&(e.dirty=!1,this._dirtyDepCount--),e.involvedThisWave=!0,e.dataBatch.push(t),this._waveHasNewData=!0}_depSettledAsResolved(e){e.dirty&&(e.dirty=!1,this._dirtyDepCount--)}_depSettledAsTerminal(e,t){e.dirty&&(e.dirty=!1,this._dirtyDepCount--),e.terminal=t,e.involvedThisWave=!0,this._hasNewTerminal=!0}_depInvalidated(e){e.prevData=void 0,e.terminal=void 0,e.dataBatch.length=0,e.dirty?e.involvedThisWave=!1:(e.dirty=!0,e.involvedThisWave=!0,this._dirtyDepCount++)}_maybeRunFnOnSettlement(){if(!(this._isTerminal&&!this._resubscribable)&&!(this._dirtyDepCount>0)){if(!this._partial&&!this._hasCalledFnOnce)for(let e=0;e<this._deps.length;e++){let t=this._deps[e];if(t.dataBatch.length===0&&t.prevData===void 0&&t.terminal===void 0){this._maybeAutoTerminalAfterWave();return}}if(this._paused){this._pendingWave=!0;return}if(!this._waveHasNewData&&!this._hasNewTerminal&&this._hasCalledFnOnce){this._clearWaveFlags(),this._emit(ae),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([[p,e.terminal]]);return}this._autoComplete&&this._deps.every(t=>t.terminal!==void 0)&&this._emit(le)}_execFn(){if(!this._fn||this._isTerminal&&!this._resubscribable)return;if(this._isExecutingFn){this._pendingRerun=!0;return}let e=this._cleanup;if(typeof e=="function"){this._cleanup=void 0;try{e()}catch(a){this._emit([[p,this._wrapFnError("cleanup threw",a)]]);return}}else if(e!=null&&typeof e=="object"){let a=e.beforeRun;if(typeof a=="function"){e.beforeRun=void 0;try{a()}catch(i){this._emit([[p,this._wrapFnError("cleanup.beforeRun threw",i)]]);return}}}let t=this._deps.map(a=>a.involvedThisWave?a.dataBatch.length>0?[...a.dataBatch]:[]:void 0),s=this._deps.map(a=>a.prevData);for(let a=0;a<this._deps.length;a++){let i=t[a];i!=null&&i.length>0&&(this._deps[a].prevData=i[i.length-1])}let r=this._deps.map(a=>a.terminal),o={prevData:s,terminalDeps:r,store:this._store};if(this._hasCalledFnOnce=!0,this._clearWaveFlags(),this._inspectorHooks!=null){let a={kind:"run",batchData:t,prevData:s};for(let i of this._inspectorHooks)i(a)}this._isExecutingFn=!0;try{let a=this._fn(t,this._actions,o);if(typeof a=="function")this._cleanup=a;else if(a!=null&&typeof a=="object"){let i=a;(typeof i.beforeRun=="function"||typeof i.deactivate=="function"||typeof i.invalidate=="function")&&(this._cleanup=a)}}catch(a){this._emit([[p,this._wrapFnError("fn threw",a)]])}finally{this._isExecutingFn=!1,this._pendingRerun?(this._pendingRerun=!1,this._rerunDepth+=1,this._rerunDepth>Ie?(this._rerunDepth=0,this._emit([[p,new Error(`Node "${this.name}": _pendingRerun depth exceeded ${Ie} \u2014 likely a reactive cycle`)]])):this._maybeRunFnOnSettlement()):this._rerunDepth=0,this._clearWaveFlags()}}_clearWaveFlags(){this._waveHasNewData=!1,this._hasNewTerminal=!1;for(let e of this._deps)e.involvedThisWave=!1,e.dataBatch.length=0}_wrapFnError(e,t){let s=t instanceof Error?t.message:String(t);return new Error(`Node "${this.name}": ${e}: ${s}`,{cause:t})}_frameBatch(e){let t=this._config.tierOf;if(e.length===1)return t(e[0][0])===3&&this._status!=="dirty"?[S,e[0]]:e;let s=!0,r=!1,o=!1,a=-1;for(let d of e){let l=t(d[0]);l<a&&(s=!1),l===3&&(r=!0),d[0]===w&&(o=!0),a=l}let i=e;if(!s){let d=e.map((l,c)=>({m:l,i:c,tier:t(l[0])}));d.sort((l,c)=>l.tier-c.tier||l.i-c.i),i=d.map(l=>l.m)}if(r&&!o&&this._status!=="dirty"){let d=0;for(;d<i.length&&t(i[d][0])===0;)d++;return d===0?[S,...i]:[...i.slice(0,d),S,...i.slice(d)]}return i}_emit(e){if(e.length===0)return;for(let i=0;i<e.length;i++){let d=e[i];if(d[0]===p&&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 i=e.filter(d=>d[0]===b||d[0]===T);if(i.length===0)return;t=i}t=this._frameBatch(t);let r=null;for(let i=0;i<t.length;i++){let d=t[i],l=d[0];if(l!==N&&l!==I){r?.push(d);continue}if(d.length<2)throw new Error(`Node "${this.name}": [[${l===N?"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 u=d[1];if(l===N)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))c=!1;else if(this._pauseLocks.delete(u),this._pauseLocks.size===0){if(this._paused=!1,this._pauseBuffer!=null&&this._pauseBuffer.length>0){let g=this._pauseBuffer;this._pauseBuffer=[],this._emit(g)}this._pendingWave&&(this._pendingWave=!1,this._maybeRunFnOnSettlement())}}c?r?.push(d):r==null&&(r=t.slice(0,i))}if(r!=null){if(r.length===0)return;t=r}if(this._hasMeta&&t.some(i=>i[0]===b))for(let i of Object.keys(this.meta))try{this.meta[i]._emit(Q)}catch{}let{finalMessages:o,equalsError:a}=this._updateState(t);if(o.length>0&&this._config.inspectorEnabled){let i=this._config.globalInspector;if(i!=null)try{i({kind:"emit",node:this,messages:o})}catch{}}if(o.length>0)if(this._paused&&this._pausable==="resumeAll"&&this._pauseBuffer!=null){let i=this._config.tierOf,d=[];for(let l of o)i(l[0])===3?this._pauseBuffer.push(l):d.push(l);d.length>0&&this._dispatchOrAccumulate(d)}else this._dispatchOrAccumulate(o);a!=null&&this._emit([[p,a]])}_updateState(e){let t=this._config.tierOf,s,r,o=-1,a=0;for(let c of e)t(c[0])===3&&a++;let i=a<=1,d=-1;if(this._versioning!=null&&a>1){for(let c=e.length-1;c>=0;c--)if(e[c][0]===_){d=c;break}}for(let c=0;c<e.length;c++){let u=e[c],g=u[0];if(g===_){if(u.length>=2){let f=!1;if(i&&this._cached!==void 0)try{f=this._equals(this._cached,u[1])}catch(v){r=this._wrapFnError("equals threw",v),o=c;break}if(f){s==null&&(s=e.slice(0,c)),s.push(J),this._status="resolved";continue}this._cached=u[1],this._versioning!=null&&(d<0||c===d)&&ue(this._versioning,u[1],this._hashFn)}this._status="settled",s?.push(u)}else if(s?.push(u),g===w)this._status="dirty";else if(g===x)this._status="resolved";else if(g===A)this._status="completed";else if(g===p)this._status="errored";else if(g===T){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 v=f.invalidate;if(typeof v=="function")try{v()}catch{}}}else g===b&&(this._resetOnTeardown&&(this._cached=void 0),this._deactivate(!0),this._status="sentinel")}let l=o>=0?s??e.slice(0,o):s??e;return r!=null?{finalMessages:l,equalsError:r}:{finalMessages:l}}_deliverToSinks=e=>{if(this._sinks==null)return;if(typeof this._sinks=="function"){this._sinks(e);return}let t=[...this._sinks];for(let s of t)s(e)};_dispatchOrAccumulate(e){if(Ae()){this._batchPendingMessages===null&&(this._batchPendingMessages=[],Ee(()=>this._flushBatchPending()));for(let t of e)this._batchPendingMessages.push(t);return}U(this._deliverToSinks,e,this._config.tierOf)}_flushBatchPending(){let e=this._batchPendingMessages;if(e===null||(this._batchPendingMessages=null,e.length===0))return;let t=this._frameBatch(e);U(this._deliverToSinks,t,this._config.tierOf)}},Ge=n=>Array.isArray(n),xe=n=>typeof n=="object"&&n!=null&&!Array.isArray(n);function L(n,e,t){let s=Ge(n)?n:[],r=typeof n=="function"?n:typeof e=="function"?e:void 0,o={};return Ge(n)?o=(xe(e)?e:t)??{}:xe(n)?o=n:o=(xe(e)?e:t)??{},new H(s,r,o)}function Le(n,e){if(e!=null&&e.length>0)return new Set(e);switch(n){case"standard":return new Set(["type","status","value","deps","meta","v"]);case"full":return null;default:return new Set(["type","deps"])}}function Ve(n,e){return L([],{...e,initial:n})}function Pe(n,e){return L((s,r,o)=>n(r,o)??void 0,{describeKind:"producer",...e})}function Te(n,e,t){return L(n,(r,o,a)=>{let i=r.map((d,l)=>d!=null&&d.length>0?d.at(-1):a.prevData[l]);o.emit(e(i,a))},{describeKind:"derived",...t})}function Ue(n,e,t){return L(n,(r,o,a)=>{let i=r.map((d,l)=>d!=null&&d.length>0?d.at(-1):a.prevData[l]);return e(i,o,a)??void 0},{describeKind:"effect",...t})}function We(n,e,t){let s=new Map;return n.forEach((r,o)=>{s.set(r,o)}),Te(n,(r,o)=>e(i=>{let d=s.get(i);if(d==null)throw new Error(`dynamicNode: untracked dep "${i.name??"<unnamed>"}"`);return r[d]},o),t)}function Be(n,e){let t,s=new Map,r=(o,a,i)=>{let d=!1,l=c=>{let u=s.get(c);if(u!==void 0){if(u<o.length){let f=o[u];return f!=null&&f.length>0?f.at(-1):i.prevData[u]}return c.cache}d=!0;let g=t._addDep(c);return s.set(c,g),c.cache};try{let c=n(l,i);d||(a.emit(c),i.store.__autoTrackLastDiscoveryError!=null&&delete i.store.__autoTrackLastDiscoveryError)}catch(c){if(!d)throw c;i.store.__autoTrackLastDiscoveryError=c}};return t=new H([],r,{describeKind:"derived",...e}),t}function je(n,...e){let t=n;for(let s of e)t=s(t);return t}0&&(module.exports={COMPLETE,COMPLETE_MSG,COMPLETE_ONLY_BATCH,DATA,DEFAULT_ACTOR,DIRTY,DIRTY_MSG,DIRTY_ONLY_BATCH,ERROR,GraphReFlyConfig,GuardDenied,INVALIDATE,INVALIDATE_MSG,INVALIDATE_ONLY_BATCH,NodeImpl,PAUSE,RESOLVED,RESOLVED_MSG,RESOLVED_ONLY_BATCH,RESUME,START,START_MSG,TEARDOWN,TEARDOWN_MSG,TEARDOWN_ONLY_BATCH,accessHintForGuard,advanceVersion,autoTrackNode,batch,configure,createVersioning,defaultConfig,defaultHash,derived,downWithBatch,dynamicNode,effect,isBatching,isV1,monotonicNs,node,normalizeActor,pipe,policy,policyFromRules,producer,registerBuiltins,resolveDescribeFields,state,wallClockNs});
1
+ "use strict";var _e=Object.defineProperty;var Ye=Object.getOwnPropertyDescriptor;var qe=Object.getOwnPropertyNames;var Ke=Object.prototype.hasOwnProperty;var Je=(n,e)=>{for(var t in e)_e(n,t,{get:e[t],enumerable:!0})},Xe=(n,e,t,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of qe(e))!Ke.call(n,r)&&r!==t&&_e(n,r,{get:()=>e[r],enumerable:!(s=Ye(e,r))||s.enumerable});return n};var Ze=n=>Xe(_e({},"__esModule",{value:!0}),n);var ut={};Je(ut,{COMPLETE:()=>A,COMPLETE_MSG:()=>me,COMPLETE_ONLY_BATCH:()=>le,DATA:()=>y,DEFAULT_ACTOR:()=>Ne,DIRTY:()=>w,DIRTY_MSG:()=>R,DIRTY_ONLY_BATCH:()=>Z,ERROR:()=>p,GraphReFlyConfig:()=>W,GuardDenied:()=>F,INVALIDATE:()=>T,INVALIDATE_MSG:()=>ye,INVALIDATE_ONLY_BATCH:()=>de,NodeImpl:()=>H,PAUSE:()=>N,RESOLVED:()=>x,RESOLVED_MSG:()=>J,RESOLVED_ONLY_BATCH:()=>ae,RESUME:()=>I,START:()=>C,START_MSG:()=>X,TEARDOWN:()=>v,TEARDOWN_MSG:()=>be,TEARDOWN_ONLY_BATCH:()=>Q,accessHintForGuard:()=>st,advanceVersion:()=>ue,autoTrackNode:()=>Be,batch:()=>ke,configure:()=>He,createVersioning:()=>te,defaultConfig:()=>G,defaultHash:()=>ee,derived:()=>Te,downWithBatch:()=>U,dynamicNode:()=>We,effect:()=>Ue,isBatching:()=>ie,isV1:()=>Oe,monotonicNs:()=>Me,node:()=>L,normalizeActor:()=>Y,pipe:()=>je,policy:()=>Se,policyFromRules:()=>tt,producer:()=>Pe,registerBuiltins:()=>ce,resolveDescribeFields:()=>Le,state:()=>Ve,wallClockNs:()=>oe});module.exports=Ze(ut);var Ne={type:"system",id:""};function Y(n){if(n==null)return Ne;let{type:e,id:t,...s}=n;return{type:e??"system",id:t??"",...s}}var V=0,q=!1,D=[],O=[],P=[],K=[];function ie(){return V>0||q}function Ae(){return V>0}function Ee(n){V>0?K.push(n):n()}function ke(n){V+=1;let e=!1;try{n()}catch(t){throw e=!0,t}finally{if(V-=1,V===0)if(e){if(!q){let t=K.splice(0);for(let s of t)try{s()}catch{}D.length=0,O.length=0,P.length=0}}else Qe()}}function Qe(){let n=!q;n&&(q=!0);let e=[],t=0;try{for(;D.length>0||O.length>0||P.length>0||n&&K.length>0;){if(n&&K.length>0){let o=K.splice(0);for(let a of o)try{a()}catch(i){e.push(i)}continue}if(t+=1,t>1e3)throw D.length=0,O.length=0,P.length=0,new Error("batch drain exceeded 1000 iterations \u2014 likely a reactive cycle");let r=(D.length>0?D:O.length>0?O:P).splice(0);for(let o of r)try{o()}catch(a){e.push(a)}}}finally{n&&(q=!1)}if(e.length===1)throw e[0];if(e.length>1)throw new AggregateError(e,"batch drain: multiple callbacks threw")}function U(n,e,t){if(e.length===0)return;if(e.length===1){let l=t(e[0][0]);if(l<3||!ie()){n(e);return}(l>=5?P:l===4?O:D).push(()=>n(e));return}let s=e.length,r=s,o=s,a=s,i=0;for(;i<s&&t(e[i][0])<3;)i++;for(r=i;i<s&&t(e[i][0])===3;)i++;for(o=i;i<s&&t(e[i][0])===4;)i++;a=i;let d=ie();if(r>0){let l=e.slice(0,r);n(l)}if(o>r){let l=e.slice(r,o);d?D.push(()=>n(l)):n(l)}if(a>o){let l=e.slice(o,a);d?O.push(()=>n(l)):n(l)}if(s>a){let l=e.slice(a,s);d?P.push(()=>n(l)):n(l)}}function Me(){return Math.trunc(performance.now()*1e6)}function oe(){return Date.now()*1e6}var C=Symbol.for("graphrefly/START"),y=Symbol.for("graphrefly/DATA"),w=Symbol.for("graphrefly/DIRTY"),x=Symbol.for("graphrefly/RESOLVED"),T=Symbol.for("graphrefly/INVALIDATE"),N=Symbol.for("graphrefly/PAUSE"),I=Symbol.for("graphrefly/RESUME"),v=Symbol.for("graphrefly/TEARDOWN"),A=Symbol.for("graphrefly/COMPLETE"),p=Symbol.for("graphrefly/ERROR"),R=Object.freeze([w]),J=Object.freeze([x]),ye=Object.freeze([T]),X=Object.freeze([C]),me=Object.freeze([A]),be=Object.freeze([v]),Z=Object.freeze([R]),ae=Object.freeze([J]),de=Object.freeze([ye]),le=Object.freeze([me]),Q=Object.freeze([be]);var W=class{_messageTypes=new Map;_codecs=new Map;_onMessage;_onSubscribe;_defaultVersioning;_defaultHashFn;_inspectorEnabled=!(typeof process<"u"&&process.env?.NODE_ENV==="production");_globalInspector;_rigorRecorder;_frozen=!1;tierOf;constructor(e){this._onMessage=e.onMessage,this._onSubscribe=e.onSubscribe,this._defaultVersioning=e.defaultVersioning,this._defaultHashFn=e.defaultHashFn,this.tierOf=t=>{let s=this._messageTypes.get(t);return s!=null?s.tier:1}}get onMessage(){return this._frozen=!0,this._onMessage}get onSubscribe(){return this._frozen=!0,this._onSubscribe}set onMessage(e){this._assertUnfrozen(),this._onMessage=e}set onSubscribe(e){this._assertUnfrozen(),this._onSubscribe=e}get defaultVersioning(){return this._defaultVersioning}set defaultVersioning(e){this._assertUnfrozen(),this._defaultVersioning=e}get defaultHashFn(){return this._defaultHashFn}set defaultHashFn(e){this._assertUnfrozen(),this._defaultHashFn=e}get inspectorEnabled(){return this._inspectorEnabled}set inspectorEnabled(e){this._inspectorEnabled=e}get globalInspector(){return this._globalInspector}set globalInspector(e){this._globalInspector=e}get rigorRecorder(){return this._rigorRecorder}set rigorRecorder(e){this._rigorRecorder=e}registerMessageType(e,t){return this._assertUnfrozen(),this._messageTypes.set(e,{tier:t.tier,wireCrossing:t.wireCrossing??t.tier>=3,metaPassthrough:t.metaPassthrough??!0}),this}messageTier(e){let t=this._messageTypes.get(e);return t!=null?t.tier:1}isWireCrossing(e){let t=this._messageTypes.get(e);return t!=null?t.wireCrossing:!0}isLocalOnly(e){return!this.isWireCrossing(e)}isMetaPassthrough(e){let t=this._messageTypes.get(e);return t!=null?t.metaPassthrough:!0}isKnownMessageType(e){return this._messageTypes.has(e)}registerCodec(e){return this._assertUnfrozen(),this._codecs.set(e.name,e),this}lookupCodec(e){return this._codecs.get(e)}_isFrozen(){return this._frozen}_assertUnfrozen(){if(this._frozen)throw new Error("GraphReFlyConfig is frozen: a node has already captured this config. Register custom types and set hooks before creating any node.")}};function ce(n){n.registerMessageType(C,{tier:0,wireCrossing:!1}),n.registerMessageType(w,{tier:1,wireCrossing:!1}),n.registerMessageType(T,{tier:1,wireCrossing:!1,metaPassthrough:!1}),n.registerMessageType(N,{tier:2,wireCrossing:!1}),n.registerMessageType(I,{tier:2,wireCrossing:!1}),n.registerMessageType(y,{tier:3,wireCrossing:!0}),n.registerMessageType(x,{tier:3,wireCrossing:!0}),n.registerMessageType(A,{tier:4,wireCrossing:!0,metaPassthrough:!1}),n.registerMessageType(p,{tier:4,wireCrossing:!0,metaPassthrough:!1}),n.registerMessageType(v,{tier:5,wireCrossing:!0,metaPassthrough:!1})}var F=class extends Error{actor;action;nodeName;constructor(e,t){super(t??`GuardDenied: action "${String(e.action)}" denied for actor type "${String(e.actor.type)}"`),this.name="GuardDenied",this.actor=e.actor,this.action=e.action,this.nodeName=e.nodeName}get node(){return this.nodeName}};function Re(n){return Array.isArray(n)?[...n]:[n]}function et(n,e){return n.has(e)||n.has("*")}function Se(n){let e=[];return n((r,o)=>{e.push({kind:"allow",actions:new Set(Re(r)),where:o?.where??(()=>!0)})},(r,o)=>{e.push({kind:"deny",actions:new Set(Re(r)),where:o?.where??(()=>!0)})}),(r,o)=>{let a=!1,i=!1;for(let d of e)et(d.actions,o)&&d.where(r)&&(d.kind==="deny"?a=!0:i=!0);return a?!1:i}}function tt(n){return Se((e,t)=>{for(let s of n){let r=s.actorType==null?null:new Set(Array.isArray(s.actorType)?s.actorType:[s.actorType]),o=s.actorId==null?null:new Set(Array.isArray(s.actorId)?s.actorId:[s.actorId]),a=Object.entries(s.claims??{}),i=d=>{if(r!==null&&!r.has(String(d.type))||o!==null&&!o.has(String(d.id??"")))return!1;for(let[l,c]of a)if(d[l]!==c)return!1;return!0};s.effect==="deny"?t(s.action,{where:i}):e(s.action,{where:i})}})}var nt=["human","llm","wallet","system"];function st(n){let e=nt.filter(t=>n({type:t,id:""},"write"));return e.length===0?"restricted":e.includes("human")&&e.includes("llm")&&e.every(t=>t==="human"||t==="llm"||t==="system")?"both":e.length===1?e[0]:e.join("+")}var rt={name:"json",version:1,contentType:"application/json",encode(n){let e=JSON.stringify(n);return new TextEncoder().encode(e)},decode(n,e){let t=new TextDecoder().decode(n);return JSON.parse(t)}};function De(n){n.registerCodec(rt)}function ve(n){if(n===void 0)return null;if(typeof n=="number"){if(!Number.isFinite(n))throw new TypeError(`Cannot hash non-finite number: ${n}`);if(Number.isInteger(n)&&!Number.isSafeInteger(n))throw new TypeError(`Cannot hash integer outside safe range (|n| > 2^53-1): ${n}. Cross-language cid parity is not guaranteed for unsafe integers.`);return n}if(typeof n=="string"||typeof n=="boolean"||n===null)return n;if(Array.isArray(n))return n.map(ve);if(typeof n=="object"&&n!==null){let e={};for(let t of Object.keys(n).sort())e[t]=ve(n[t]);return e}return null}var it=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),ot=new TextEncoder;function at(n){let e=ot.encode(n),t=e.length,s=t*8,r=t+9+63&-64,o=new Uint8Array(r);o.set(e),o[t]=128;let a=new DataView(o.buffer);a.setUint32(r-4,s>>>0,!1),a.setUint32(r-8,Math.floor(s/4294967296)>>>0,!1);let i=1779033703,d=3144134277,l=1013904242,c=2773480762,h=1359893119,g=2600822924,u=528734635,_=1541459225,S=new Uint32Array(64),b=(k,m)=>k>>>m|k<<32-m;for(let k=0;k<r;k+=64){for(let f=0;f<16;f++)S[f]=a.getUint32(k+f*4,!1);for(let f=16;f<64;f++){let z=S[f-15],$=S[f-2],re=b(z,7)^b(z,18)^z>>>3,ge=b($,17)^b($,19)^$>>>10;S[f]=S[f-16]+re+S[f-7]+ge>>>0}let m=i,B=d,j=l,fe=c,M=h,ne=g,se=u,pe=_;for(let f=0;f<64;f++){let z=b(M,6)^b(M,11)^b(M,25),$=M&ne^~M&se,re=pe+z+$+it[f]+S[f]>>>0,ge=b(m,2)^b(m,13)^b(m,22),ze=m&B^m&j^B&j,$e=ge+ze>>>0;pe=se,se=ne,ne=M,M=fe+re>>>0,fe=j,j=B,B=m,m=re+$e>>>0}i=i+m>>>0,d=d+B>>>0,l=l+j>>>0,c=c+fe>>>0,h=h+M>>>0,g=g+ne>>>0,u=u+se>>>0,_=_+pe>>>0}let E=k=>k.toString(16).padStart(8,"0");return E(i)+E(d)+E(l)+E(c)+E(h)+E(g)+E(u)+E(_)}function ee(n){let e=ve(n??null),t=JSON.stringify(e);return at(t).slice(0,16)}function dt(){let n=globalThis.crypto;if(n?.randomUUID)return n.randomUUID();let e=()=>Math.floor(Math.random()*4294967296).toString(16).padStart(8,"0"),t=e()+e()+e()+e();return`${t.slice(0,8)}-${t.slice(8,12)}-4${t.slice(13,16)}-${(parseInt(t.slice(16,17),16)&3|8).toString(16)}${t.slice(17,20)}-${t.slice(20,32)}`}function te(n,e,t){let s=t?.id??dt();if(n===0)return{id:s,version:0};let o=(t?.hash??ee)(e);return{id:s,version:0,cid:o,prev:null}}function ue(n,e,t){n.version+=1,"cid"in n&&(n.prev=n.cid,n.cid=t(e))}function Oe(n){return"cid"in n}var Ce=()=>{},Ie=100;function Fe(n){return{node:n,unsub:null,prevData:void 0,dirty:!1,involvedThisWave:!1,dataBatch:[],terminal:void 0}}function we(n){n.prevData=void 0,n.dirty=!1,n.involvedThisWave=!1,n.dataBatch.length=0,n.terminal=void 0}function he(n){return n.length===0?n:typeof n[0]=="symbol"?[n]:n}var lt=(n,e,t,s)=>{t.direction==="down-in"&&n._onDepMessage(t.depIndex,e)},ct=(n,e,t,s)=>{let r=n;if(r._status==="completed"||r._status==="errored")return;let o=r._cached,a=o===void 0?[X]:[X,[y,o]];r._status==="dirty"&&a.push(R),U(e,a,r._config.tierOf)},G=new W({onMessage:lt,onSubscribe:ct});ce(G);De(G);function He(n){if(G._isFrozen())throw new Error("configure() called after a node was created \u2014 the default GraphReFlyConfig is frozen. Call configure(...) at application startup, before any node factories run.");n(G)}var H=class n{_optsName;_describeKind;meta;_hasMeta;_config;_deps;_sinks=null;_sinkCount=0;_cached;_status;_cleanup;_store={};_waveHasNewData=!1;_hasNewTerminal=!1;_hasCalledFnOnce=!1;_paused=!1;_pendingWave=!1;_isExecutingFn=!1;_pendingRerun=!1;_rerunDepth=0;_dirtyDepCount=0;_batchPendingMessages=null;_pauseLocks=null;_pauseBuffer=null;_fn;_equals;_resubscribable;_resetOnTeardown;_autoComplete;_autoError;_pausable;_partial;_guard;_extraGuards;_hashFn;_versioning;_versioningLevel;_lastMutation;_inspectorHooks;_actions;constructor(e,t,s){this._config=s.config??G,this._config.onMessage,this._optsName=s.name,this._describeKind=s.describeKind,this._equals=s.equals??Object.is,this._resubscribable=s.resubscribable??!1,this._resetOnTeardown=s.resetOnTeardown??!1,this._autoComplete=s.completeWhenDepsComplete??!0,this._autoError=s.errorWhenDepsError??!0,this._pausable=s.pausable??!0,this._guard=s.guard,this._fn=t,this._partial=s.partial??!1,this._cached=s.initial!==void 0?s.initial:void 0,this._status=e.length===0&&t==null&&this._cached!==void 0?"settled":"sentinel",this._hashFn=s.versioningHash??this._config.defaultHashFn??ee;let r=s.versioning??this._config.defaultVersioning;this._versioningLevel=r,this._versioning=r!=null?te(r,this._cached===void 0?void 0:this._cached,{id:s.versioningId,hash:this._hashFn}):void 0,this._deps=e.map(Fe);let o={};for(let[i,d]of Object.entries(s.meta??{})){let l={initial:d,name:`${s.name??"node"}:meta:${i}`,describeKind:"state",config:this._config};s.guard!=null&&(l.guard=s.guard),o[i]=new n([],void 0,l)}Object.freeze(o),this.meta=o,this._hasMeta=Object.keys(o).length>0;let a=this;this._actions={emit(i){a._emit([[y,i]])},down(i){a._emit(he(i))},up(i){a._emitUp(he(i))}},this.down=this.down.bind(this),this.up=this.up.bind(this)}get _isTerminal(){return this._status==="completed"||this._status==="errored"}get name(){return this._optsName}get status(){return this._status}get cache(){return this._cached===void 0?void 0:this._cached}get lastMutation(){return this._lastMutation}get v(){return this._versioning}hasGuard(){return this._guard!=null}_applyVersioning(e,t){if(this._isExecutingFn)throw new Error(`Node "${this.name}": _applyVersioning cannot run mid-fn \u2014 call it outside of \`_execFn\` (typically at graph setup time before the first subscribe).`);let s=this._versioningLevel;if(s!=null&&e<=s)return;let r=t?.hash??this._hashFn;r!==this._hashFn&&(this._hashFn=r);let o=this._cached===void 0?void 0:this._cached,a=this._versioning,i=a?.id??t?.id,d=a?.version??0,l=te(e,o,{id:i,hash:r});l.version=d,this._versioning=l,this._versioningLevel=e}_setInspectorHook(e){return e==null?()=>{}:(this._inspectorHooks==null&&(this._inspectorHooks=new Set),this._inspectorHooks.add(e),()=>{this._inspectorHooks?.delete(e),this._inspectorHooks?.size===0&&(this._inspectorHooks=void 0)})}_pushGuard(e){return this._extraGuards==null&&(this._extraGuards=new Set),this._extraGuards.add(e),()=>{this._extraGuards?.delete(e),this._extraGuards?.size===0&&(this._extraGuards=void 0)}}allowsObserve(e){if(this._guard==null&&this._extraGuards==null)return!0;let t=Y(e);if(this._guard!=null&&!this._guard(t,"observe"))return!1;if(this._extraGuards!=null){for(let s of this._extraGuards)if(!s(t,"observe"))return!1}return!0}_checkGuard(e){if(e?.internal)return;let t=this._guard!=null||this._extraGuards!=null,s=e?.actor!=null;if(!t&&!s)return;let r=Y(e?.actor),o=e?.delivery==="signal"?"signal":"write";if(this._guard!=null&&!this._guard(r,o))throw new F({actor:r,action:o,nodeName:this.name});if(this._extraGuards!=null){for(let a of this._extraGuards)if(!a(r,o))throw new F({actor:r,action:o,nodeName:this.name})}this._lastMutation={actor:r,timestamp_ns:oe()}}down(e,t){let s=he(e);s.length!==0&&(this._checkGuard(t),this._emit(s))}emit(e,t){this._checkGuard(t),this._emit([[y,e]])}up(e,t){if(this._deps.length===0)return;let s=he(e);if(s.length===0)return;this._checkGuard(t);let r=t??{internal:!0};this._validateUpTiers(s);for(let o of this._deps)o.node.up?.(s,r)}_emitUp(e){if(this._deps.length!==0&&e.length!==0){this._validateUpTiers(e);for(let t of this._deps)t.node.up?.(e,{internal:!0})}}_validateUpTiers(e){let t=this._config.tierOf;for(let s of e){let r=t(s[0]);if(r===3||r===4)throw new Error(`Node "${this.name}": tier-${r} messages cannot flow up \u2014 DATA/RESOLVED/COMPLETE/ERROR are downstream-only. Use \`down(...)\` for value delivery; \`up(...)\` is for control signals (DIRTY, INVALIDATE, PAUSE, RESUME, TEARDOWN).`)}}subscribe(e,t){if(t!=null&&this._guard!=null){let d=Y(t);if(!this._guard(d,"observe"))throw new F({actor:d,action:"observe",nodeName:this.name})}let r=this._isTerminal&&this._resubscribable;if(r){this._cached=void 0,this._status="sentinel",this._store={},this._hasCalledFnOnce=!1,this._waveHasNewData=!1,this._hasNewTerminal=!1,this._paused=!1,this._pendingWave=!1,this._pendingRerun=!1,this._isExecutingFn=!1,this._rerunDepth=0,this._dirtyDepCount=0,this._pauseLocks=null,this._pauseBuffer=null;for(let d of this._deps)we(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:r},this._actions)}catch(d){throw this._sinkCount-=1,d}this._sinks==null?this._sinks=e:typeof this._sinks=="function"?this._sinks=new Set([this._sinks,e]):this._sinks.add(e);let a=this._isTerminal;if(this._sinkCount===1&&!a)try{this._activate()}catch(d){if(this._sinkCount-=1,this._removeSink(e),this._sinkCount===0&&(this._status="sentinel"),typeof o=="function")try{o()}catch{}throw d}this._status==="sentinel"&&this._cached===void 0&&(this._status="pending");let i=!1;return()=>{i||(i=!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 s=0;s<e;s++){let r=s,o=this._deps[s];o.unsub=Ce,o.unsub=o.node.subscribe(a=>{if(o.unsub===null)return;let i=this._config.tierOf,d=!1;for(let l of a)i(l[0])>=3&&(d=!0),this._config.onMessage(this,l,{direction:"down-in",depIndex:r},this._actions);d&&this._maybeRunFnOnSettlement()}),t++}}catch(s){this._deps[t].unsub=null;for(let r=0;r<t;r++){let o=this._deps[r];if(o.unsub!=null){let a=o.unsub;o.unsub=null;try{a()}catch{}we(o)}}throw this._dirtyDepCount=0,s}}_addDep(e){for(let r=0;r<this._deps.length;r++)if(this._deps[r].node===e)return r;let t=this._deps.length,s=Fe(e);if(this._deps.push(s),this._sinks==null)return t;s.dirty=!0,this._dirtyDepCount++,this._status!=="dirty"&&this._emit(Z),s.unsub=Ce;try{s.unsub=e.subscribe(r=>{if(s.unsub===null)return;let o=this._config.tierOf,a=!1;for(let i of r)o(i[0])>=3&&(a=!0),this._config.onMessage(this,i,{direction:"down-in",depIndex:t},this._actions);a&&this._maybeRunFnOnSettlement()})}catch(r){throw s.unsub=null,this._deps.pop(),this._dirtyDepCount--,r}return t}_deactivate(e=!1){let t=this._cleanup;if(this._cleanup=void 0,typeof t=="function")try{t()}catch(s){this._emit([[p,this._wrapFnError("cleanup threw",s)]])}else if(t!=null&&typeof t=="object"){let s=t.deactivate;if(typeof s=="function")try{s()}catch(r){this._emit([[p,this._wrapFnError("cleanup.deactivate threw",r)]])}}for(let s of this._deps){if(s.unsub!=null){let r=s.unsub;s.unsub=null;try{r()}catch{}}we(s)}this._waveHasNewData=!1,this._hasNewTerminal=!1,this._hasCalledFnOnce=!1,this._paused=!1,this._pendingWave=!1,this._pendingRerun=!1,this._rerunDepth=0,this._store={},this._dirtyDepCount=0,this._pauseLocks=null,this._pauseBuffer=null,this._fn!=null&&(this._cached=void 0),e||(this._fn!=null||this._deps.length>0)&&(!this._isTerminal||this._resubscribable)&&(this._status="sentinel")}_onDepMessage(e,t){let s=this._deps[e],r=t[0];if(this._inspectorHooks!=null){let o={kind:"dep_message",depIndex:e,message:t};for(let a of this._inspectorHooks)a(o)}if(r!==C){if(r===w){this._depDirtied(s);return}if(r===T){if(this._depInvalidated(s),this._cached===void 0)return;this._emit(de);return}if(r===N||r===I){this._emit([t]);return}if(r===v){this._emit(Q);return}if(r===y)this._depSettledAsData(s,t[1]);else if(r===x)this._depSettledAsResolved(s);else if(r===A)this._depSettledAsTerminal(s,!0);else if(r===p)this._depSettledAsTerminal(s,t[1]);else{this._emit([t]);return}if(!this._fn){(r===y||r===x)&&this._emit([t]),(r===A||r===p)&&this._maybeAutoTerminalAfterWave();return}}}_depDirtied(e){e.dirty||(e.dirty=!0,e.involvedThisWave=!0,this._dirtyDepCount++,this._status!=="dirty"&&this._emit(Z))}_depSettledAsData(e,t){e.dirty&&(e.dirty=!1,this._dirtyDepCount--),e.involvedThisWave=!0,e.dataBatch.push(t),this._waveHasNewData=!0}_depSettledAsResolved(e){e.dirty&&(e.dirty=!1,this._dirtyDepCount--)}_depSettledAsTerminal(e,t){e.dirty&&(e.dirty=!1,this._dirtyDepCount--),e.terminal=t,e.involvedThisWave=!0,this._hasNewTerminal=!0}_depInvalidated(e){e.prevData=void 0,e.terminal=void 0,e.dataBatch.length=0,e.dirty?e.involvedThisWave=!1:(e.dirty=!0,e.involvedThisWave=!0,this._dirtyDepCount++)}_maybeRunFnOnSettlement(){if(!(this._isTerminal&&!this._resubscribable)&&!(this._dirtyDepCount>0)){if(!this._partial&&!this._hasCalledFnOnce)for(let e=0;e<this._deps.length;e++){let t=this._deps[e];if(t.dataBatch.length===0&&t.prevData===void 0&&t.terminal===void 0){this._maybeAutoTerminalAfterWave();return}}if(this._paused){this._pendingWave=!0;return}if(!this._waveHasNewData&&!this._hasNewTerminal&&this._hasCalledFnOnce){this._clearWaveFlags(),this._emit(ae),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([[p,e.terminal]]);return}this._autoComplete&&this._deps.every(t=>t.terminal!==void 0)&&this._emit(le)}_execFn(){if(!this._fn||this._isTerminal&&!this._resubscribable)return;if(this._isExecutingFn){this._pendingRerun=!0;return}let e=this._cleanup;if(typeof e=="function"){this._cleanup=void 0;try{e()}catch(a){this._emit([[p,this._wrapFnError("cleanup threw",a)]]);return}}else if(e!=null&&typeof e=="object"){let a=e.beforeRun;if(typeof a=="function"){e.beforeRun=void 0;try{a()}catch(i){this._emit([[p,this._wrapFnError("cleanup.beforeRun threw",i)]]);return}}}let t=this._deps.map(a=>a.involvedThisWave?a.dataBatch.length>0?[...a.dataBatch]:[]:void 0),s=this._deps.map(a=>a.prevData);for(let a=0;a<this._deps.length;a++){let i=t[a];i!=null&&i.length>0&&(this._deps[a].prevData=i[i.length-1])}let r=this._deps.map(a=>a.terminal),o={prevData:s,terminalDeps:r,store:this._store};if(this._hasCalledFnOnce=!0,this._clearWaveFlags(),this._inspectorHooks!=null){let a={kind:"run",batchData:t,prevData:s};for(let i of this._inspectorHooks)i(a)}this._isExecutingFn=!0;try{let a=this._fn(t,this._actions,o);if(typeof a=="function")this._cleanup=a;else if(a!=null&&typeof a=="object"){let i=a;(typeof i.beforeRun=="function"||typeof i.deactivate=="function"||typeof i.invalidate=="function")&&(this._cleanup=a)}}catch(a){this._emit([[p,this._wrapFnError("fn threw",a)]])}finally{this._isExecutingFn=!1,this._pendingRerun?(this._pendingRerun=!1,this._rerunDepth+=1,this._rerunDepth>Ie?(this._rerunDepth=0,this._emit([[p,new Error(`Node "${this.name}": _pendingRerun depth exceeded ${Ie} \u2014 likely a reactive cycle`)]])):this._maybeRunFnOnSettlement()):this._rerunDepth=0,this._clearWaveFlags()}}_clearWaveFlags(){this._waveHasNewData=!1,this._hasNewTerminal=!1;for(let e of this._deps)e.involvedThisWave=!1,e.dataBatch.length=0}_wrapFnError(e,t){let s=t instanceof Error?t.message:String(t);return new Error(`Node "${this.name}": ${e}: ${s}`,{cause:t})}_frameBatch(e){let t=this._config.tierOf;if(e.length===1)return t(e[0][0])===3&&this._status!=="dirty"?[R,e[0]]:e;let s=!0,r=!1,o=!1,a=-1;for(let d of e){let l=t(d[0]);l<a&&(s=!1),l===3&&(r=!0),d[0]===w&&(o=!0),a=l}let i=e;if(!s){let d=e.map((l,c)=>({m:l,i:c,tier:t(l[0])}));d.sort((l,c)=>l.tier-c.tier||l.i-c.i),i=d.map(l=>l.m)}if(r&&!o&&this._status!=="dirty"){let d=0;for(;d<i.length&&t(i[d][0])===0;)d++;return d===0?[R,...i]:[...i.slice(0,d),R,...i.slice(d)]}return i}_emit(e){if(e.length===0)return;for(let i=0;i<e.length;i++){let d=e[i];if(d[0]===p&&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 i=e.filter(d=>d[0]===v||d[0]===T);if(i.length===0)return;t=i}t=this._frameBatch(t);let r=null;for(let i=0;i<t.length;i++){let d=t[i],l=d[0];if(l!==N&&l!==I){r?.push(d);continue}if(d.length<2)throw new Error(`Node "${this.name}": [[${l===N?"PAUSE":"RESUME"}]] must carry a lockId payload \u2014 bare PAUSE/RESUME is a protocol violation (C0 rule). Use \`[[PAUSE, lockId]]\` / \`[[RESUME, lockId]]\`.`);let c=!0;if(this._pausable!==!1){let h=d[1];if(l===N)this._pauseLocks==null&&(this._pauseLocks=new Set),this._pauseLocks.add(h),this._paused=!0,this._pausable==="resumeAll"&&this._pauseBuffer==null&&(this._pauseBuffer=[]);else if(this._pauseLocks==null||!this._pauseLocks.has(h))c=!1;else if(this._pauseLocks.delete(h),this._pauseLocks.size===0){if(this._paused=!1,this._pauseBuffer!=null&&this._pauseBuffer.length>0){let g=this._pauseBuffer;this._pauseBuffer=[],this._emit(g)}this._pendingWave&&(this._pendingWave=!1,this._maybeRunFnOnSettlement())}}c?r?.push(d):r==null&&(r=t.slice(0,i))}if(r!=null){if(r.length===0)return;t=r}if(this._hasMeta&&t.some(i=>i[0]===v))for(let i of Object.keys(this.meta))try{this.meta[i]._emit(Q)}catch{}let{finalMessages:o,equalsError:a}=this._updateState(t);if(o.length>0&&this._config.inspectorEnabled){let i=this._config.globalInspector;if(i!=null)try{i({kind:"emit",node:this,messages:o})}catch{}}if(o.length>0)if(this._paused&&this._pausable==="resumeAll"&&this._pauseBuffer!=null){let i=this._config.tierOf,d=[];for(let l of o)i(l[0])===3?this._pauseBuffer.push(l):d.push(l);d.length>0&&this._dispatchOrAccumulate(d)}else this._dispatchOrAccumulate(o);a!=null&&this._emit([[p,a]])}_updateState(e){let t=this._config.tierOf,s,r,o=-1,a=0;for(let c of e)t(c[0])===3&&a++;let i=a<=1,d=-1;if(this._versioning!=null&&a>1){for(let c=e.length-1;c>=0;c--)if(e[c][0]===y){d=c;break}}for(let c=0;c<e.length;c++){let h=e[c],g=h[0];if(g===y){if(h.length>=2){let u=!1;if(i&&this._cached!==void 0)try{u=this._equals(this._cached,h[1])}catch(_){r=this._wrapFnError("equals threw",_),o=c;break}if(u){s==null&&(s=e.slice(0,c)),s.push(J),this._status="resolved";continue}this._cached=h[1],this._versioning!=null&&(d<0||c===d)&&ue(this._versioning,h[1],this._hashFn)}this._status="settled",s?.push(h)}else if(s?.push(h),g===w)this._status="dirty";else if(g===x)this._status="resolved";else if(g===A){this._status="completed";{let u=this._config.rigorRecorder;if(u!=null)try{u.onTerminalTransition(this,"completed",this._autoComplete,this._autoError,this._deps.length>0)}catch{}}}else if(g===p){this._status="errored";{let u=this._config.rigorRecorder;if(u!=null)try{u.onTerminalTransition(this,"errored",this._autoComplete,this._autoError,this._deps.length>0)}catch{}}}else if(g===T){if(this._cached!==void 0){let _=this._config.rigorRecorder;if(_!=null)try{_.onNonVacuousInvalidate(this,this._cached)}catch{}}this._cached=void 0,this._status="dirty";let u=this._cleanup;if(typeof u=="function"){this._cleanup=void 0;try{u()}catch{}}else if(u!=null&&typeof u=="object"){let _=u.invalidate;if(typeof _=="function")try{_()}catch{}}}else g===v&&(this._resetOnTeardown&&(this._cached=void 0),this._deactivate(!0),this._status="sentinel")}let l=o>=0?s??e.slice(0,o):s??e;return r!=null?{finalMessages:l,equalsError:r}:{finalMessages:l}}_deliverToSinks=e=>{if(this._sinks==null)return;if(typeof this._sinks=="function"){this._sinks(e);return}let t=[...this._sinks];for(let s of t)s(e)};_dispatchOrAccumulate(e){if(Ae()){this._batchPendingMessages===null&&(this._batchPendingMessages=[],Ee(()=>this._flushBatchPending()));for(let t of e)this._batchPendingMessages.push(t);return}U(this._deliverToSinks,e,this._config.tierOf)}_flushBatchPending(){let e=this._batchPendingMessages;if(e===null||(this._batchPendingMessages=null,e.length===0))return;let t=this._frameBatch(e);U(this._deliverToSinks,t,this._config.tierOf)}},Ge=n=>Array.isArray(n),xe=n=>typeof n=="object"&&n!=null&&!Array.isArray(n);function L(n,e,t){let s=Ge(n)?n:[],r=typeof n=="function"?n:typeof e=="function"?e:void 0,o={};return Ge(n)?o=(xe(e)?e:t)??{}:xe(n)?o=n:o=(xe(e)?e:t)??{},new H(s,r,o)}function Le(n,e){if(e!=null&&e.length>0)return new Set(e);switch(n){case"standard":return new Set(["type","status","value","deps","meta","v"]);case"full":return null;default:return new Set(["type","deps"])}}function Ve(n,e){return L([],{...e,initial:n})}function Pe(n,e){return L((s,r,o)=>n(r,o)??void 0,{describeKind:"producer",...e})}function Te(n,e,t){return L(n,(r,o,a)=>{let i=r.map((d,l)=>d!=null&&d.length>0?d.at(-1):a.prevData[l]);o.emit(e(i,a))},{describeKind:"derived",...t})}function Ue(n,e,t){return L(n,(r,o,a)=>{let i=r.map((d,l)=>d!=null&&d.length>0?d.at(-1):a.prevData[l]);return e(i,o,a)??void 0},{describeKind:"effect",...t})}function We(n,e,t){let s=new Map;return n.forEach((r,o)=>{s.set(r,o)}),Te(n,(r,o)=>e(i=>{let d=s.get(i);if(d==null)throw new Error(`dynamicNode: untracked dep "${i.name??"<unnamed>"}"`);return r[d]},o),t)}function Be(n,e){let t,s=new Map,r=(o,a,i)=>{let d=!1,l=c=>{let h=s.get(c);if(h!==void 0){if(h<o.length){let u=o[h];return u!=null&&u.length>0?u.at(-1):i.prevData[h]}return c.cache}d=!0;let g=t._addDep(c);return s.set(c,g),c.cache};try{let c=n(l,i);d||(a.emit(c),i.store.__autoTrackLastDiscoveryError!=null&&delete i.store.__autoTrackLastDiscoveryError)}catch(c){if(!d)throw c;i.store.__autoTrackLastDiscoveryError=c}};return t=new H([],r,{describeKind:"derived",...e}),t}function je(n,...e){let t=n;for(let s of e)t=s(t);return t}0&&(module.exports={COMPLETE,COMPLETE_MSG,COMPLETE_ONLY_BATCH,DATA,DEFAULT_ACTOR,DIRTY,DIRTY_MSG,DIRTY_ONLY_BATCH,ERROR,GraphReFlyConfig,GuardDenied,INVALIDATE,INVALIDATE_MSG,INVALIDATE_ONLY_BATCH,NodeImpl,PAUSE,RESOLVED,RESOLVED_MSG,RESOLVED_ONLY_BATCH,RESUME,START,START_MSG,TEARDOWN,TEARDOWN_MSG,TEARDOWN_ONLY_BATCH,accessHintForGuard,advanceVersion,autoTrackNode,batch,configure,createVersioning,defaultConfig,defaultHash,derived,downWithBatch,dynamicNode,effect,isBatching,isV1,monotonicNs,node,normalizeActor,pipe,policy,policyFromRules,producer,registerBuiltins,resolveDescribeFields,state,wallClockNs});
@@ -1,4 +1,4 @@
1
- export { A as Actor, C as COMPLETE, f as COMPLETE_MSG, g as COMPLETE_ONLY_BATCH, D as DATA, h as DEFAULT_ACTOR, i as DIRTY, j as DIRTY_MSG, k as DIRTY_ONLY_BATCH, l as DepRecord, E as ERROR, F as FnCtx, m as GlobalInspectorEvent, n as GlobalInspectorHook, o as GraphReFlyConfig, G as GuardAction, p as GuardDenied, q as GuardDeniedDetails, H as HashFn, I as INVALIDATE, r as INVALIDATE_MSG, s as INVALIDATE_ONLY_BATCH, M as Message, t as MessageContext, u as MessageTypeRegistration, v as MessageTypeRegistrationInput, b as Messages, a as Node, c as NodeActions, w as NodeCtx, e as NodeDescribeKind, x as NodeFn, d as NodeFnCleanup, y as NodeGuard, z as NodeImpl, B as NodeInspectorHook, J as NodeInspectorHookEvent, N as NodeOptions, K as NodeSink, L as NodeStatus, O as NodeTransportOptions, Q as NodeVersionInfo, R as OnMessageHandler, S as OnSubscribeHandler, T as PAUSE, U as PolicyAllow, W as PolicyDeny, P as PolicyRuleData, X as RESOLVED, Y as RESOLVED_MSG, Z as RESOLVED_ONLY_BATCH, _ as RESUME, $ as START, a0 as START_MSG, a1 as SubscribeContext, a2 as TEARDOWN, a3 as TEARDOWN_MSG, a4 as TEARDOWN_ONLY_BATCH, a5 as V0, a6 as V1, V as VersioningLevel, a7 as VersioningOptions, a8 as accessHintForGuard, a9 as advanceVersion, aa as configure, ab as createVersioning, ac as defaultConfig, ad as defaultHash, ae as isV1, af as node, ag as normalizeActor, ah as policy, ai as policyFromRules, aj as registerBuiltins } from '../node-BVV7G1bq.cjs';
2
- export { b as batch, d as downWithBatch, a as isBatching, m as monotonicNs, w as wallClockNs } from '../index-BpFWP7Bq.cjs';
3
- export { D as DescribeDetail, a as DescribeField, b as DescribeNodeOutput, r as resolveDescribeFields } from '../meta-COtmHLwT.cjs';
4
- export { A as AutoTrackOptions, D as DerivedFn, a as DynamicFn, E as EffectFn, P as PipeOperator, b as ProducerFn, T as TrackFn, c as autoTrackNode, d as derived, e as dynamicNode, f as effect, p as pipe, g as producer, s as state } from '../sugar-CqR6DJ7v.cjs';
1
+ export { A as Actor, C as COMPLETE, f as COMPLETE_MSG, g as COMPLETE_ONLY_BATCH, D as DATA, h as DEFAULT_ACTOR, i as DIRTY, j as DIRTY_MSG, k as DIRTY_ONLY_BATCH, l as DepRecord, E as ERROR, F as FnCtx, m as GlobalInspectorEvent, n as GlobalInspectorHook, o as GraphReFlyConfig, G as GuardAction, p as GuardDenied, q as GuardDeniedDetails, H as HashFn, I as INVALIDATE, r as INVALIDATE_MSG, s as INVALIDATE_ONLY_BATCH, M as Message, t as MessageContext, u as MessageTypeRegistration, v as MessageTypeRegistrationInput, b as Messages, a as Node, c as NodeActions, w as NodeCtx, e as NodeDescribeKind, x as NodeFn, d as NodeFnCleanup, y as NodeGuard, z as NodeImpl, B as NodeInspectorHook, J as NodeInspectorHookEvent, N as NodeOptions, K as NodeSink, L as NodeStatus, O as NodeTransportOptions, Q as NodeVersionInfo, R as OnMessageHandler, S as OnSubscribeHandler, T as PAUSE, U as PolicyAllow, W as PolicyDeny, P as PolicyRuleData, X as RESOLVED, Y as RESOLVED_MSG, Z as RESOLVED_ONLY_BATCH, _ as RESUME, $ as RigorRecorder, a0 as START, a1 as START_MSG, a2 as SubscribeContext, a3 as TEARDOWN, a4 as TEARDOWN_MSG, a5 as TEARDOWN_ONLY_BATCH, a6 as V0, a7 as V1, V as VersioningLevel, a8 as VersioningOptions, a9 as accessHintForGuard, aa as advanceVersion, ab as configure, ac as createVersioning, ad as defaultConfig, ae as defaultHash, af as isV1, ag as node, ah as normalizeActor, ai as policy, aj as policyFromRules, ak as registerBuiltins } from '../node-8qx0kgYt.cjs';
2
+ export { b as batch, d as downWithBatch, a as isBatching, m as monotonicNs, w as wallClockNs } from '../index-Cp91Sxbo.cjs';
3
+ export { D as DescribeDetail, a as DescribeField, b as DescribeNodeOutput, r as resolveDescribeFields } from '../meta-BdjSt8ky.cjs';
4
+ export { A as AutoTrackOptions, D as DerivedFn, a as DynamicFn, E as EffectFn, P as PipeOperator, b as ProducerFn, T as TrackFn, c as autoTrackNode, d as derived, e as dynamicNode, f as effect, p as pipe, g as producer, s as state } from '../sugar-DVEYhR7a.cjs';
@@ -1,4 +1,4 @@
1
- export { A as Actor, C as COMPLETE, f as COMPLETE_MSG, g as COMPLETE_ONLY_BATCH, D as DATA, h as DEFAULT_ACTOR, i as DIRTY, j as DIRTY_MSG, k as DIRTY_ONLY_BATCH, l as DepRecord, E as ERROR, F as FnCtx, m as GlobalInspectorEvent, n as GlobalInspectorHook, o as GraphReFlyConfig, G as GuardAction, p as GuardDenied, q as GuardDeniedDetails, H as HashFn, I as INVALIDATE, r as INVALIDATE_MSG, s as INVALIDATE_ONLY_BATCH, M as Message, t as MessageContext, u as MessageTypeRegistration, v as MessageTypeRegistrationInput, b as Messages, a as Node, c as NodeActions, w as NodeCtx, e as NodeDescribeKind, x as NodeFn, d as NodeFnCleanup, y as NodeGuard, z as NodeImpl, B as NodeInspectorHook, J as NodeInspectorHookEvent, N as NodeOptions, K as NodeSink, L as NodeStatus, O as NodeTransportOptions, Q as NodeVersionInfo, R as OnMessageHandler, S as OnSubscribeHandler, T as PAUSE, U as PolicyAllow, W as PolicyDeny, P as PolicyRuleData, X as RESOLVED, Y as RESOLVED_MSG, Z as RESOLVED_ONLY_BATCH, _ as RESUME, $ as START, a0 as START_MSG, a1 as SubscribeContext, a2 as TEARDOWN, a3 as TEARDOWN_MSG, a4 as TEARDOWN_ONLY_BATCH, a5 as V0, a6 as V1, V as VersioningLevel, a7 as VersioningOptions, a8 as accessHintForGuard, a9 as advanceVersion, aa as configure, ab as createVersioning, ac as defaultConfig, ad as defaultHash, ae as isV1, af as node, ag as normalizeActor, ah as policy, ai as policyFromRules, aj as registerBuiltins } from '../node-BVV7G1bq.js';
2
- export { b as batch, d as downWithBatch, a as isBatching, m as monotonicNs, w as wallClockNs } from '../index-BANwzwBV.js';
3
- export { D as DescribeDetail, a as DescribeField, b as DescribeNodeOutput, r as resolveDescribeFields } from '../meta-BMwx3ExI.js';
4
- export { A as AutoTrackOptions, D as DerivedFn, a as DynamicFn, E as EffectFn, P as PipeOperator, b as ProducerFn, T as TrackFn, c as autoTrackNode, d as derived, e as dynamicNode, f as effect, p as pipe, g as producer, s as state } from '../sugar-BHbAACDG.js';
1
+ export { A as Actor, C as COMPLETE, f as COMPLETE_MSG, g as COMPLETE_ONLY_BATCH, D as DATA, h as DEFAULT_ACTOR, i as DIRTY, j as DIRTY_MSG, k as DIRTY_ONLY_BATCH, l as DepRecord, E as ERROR, F as FnCtx, m as GlobalInspectorEvent, n as GlobalInspectorHook, o as GraphReFlyConfig, G as GuardAction, p as GuardDenied, q as GuardDeniedDetails, H as HashFn, I as INVALIDATE, r as INVALIDATE_MSG, s as INVALIDATE_ONLY_BATCH, M as Message, t as MessageContext, u as MessageTypeRegistration, v as MessageTypeRegistrationInput, b as Messages, a as Node, c as NodeActions, w as NodeCtx, e as NodeDescribeKind, x as NodeFn, d as NodeFnCleanup, y as NodeGuard, z as NodeImpl, B as NodeInspectorHook, J as NodeInspectorHookEvent, N as NodeOptions, K as NodeSink, L as NodeStatus, O as NodeTransportOptions, Q as NodeVersionInfo, R as OnMessageHandler, S as OnSubscribeHandler, T as PAUSE, U as PolicyAllow, W as PolicyDeny, P as PolicyRuleData, X as RESOLVED, Y as RESOLVED_MSG, Z as RESOLVED_ONLY_BATCH, _ as RESUME, $ as RigorRecorder, a0 as START, a1 as START_MSG, a2 as SubscribeContext, a3 as TEARDOWN, a4 as TEARDOWN_MSG, a5 as TEARDOWN_ONLY_BATCH, a6 as V0, a7 as V1, V as VersioningLevel, a8 as VersioningOptions, a9 as accessHintForGuard, aa as advanceVersion, ab as configure, ac as createVersioning, ad as defaultConfig, ae as defaultHash, af as isV1, ag as node, ah as normalizeActor, ai as policy, aj as policyFromRules, ak as registerBuiltins } from '../node-8qx0kgYt.js';
2
+ export { b as batch, d as downWithBatch, a as isBatching, m as monotonicNs, w as wallClockNs } from '../index-Db21wuaD.js';
3
+ export { D as DescribeDetail, a as DescribeField, b as DescribeNodeOutput, r as resolveDescribeFields } from '../meta-CtDjj7cU.js';
4
+ export { A as AutoTrackOptions, D as DerivedFn, a as DynamicFn, E as EffectFn, P as PipeOperator, b as ProducerFn, T as TrackFn, c as autoTrackNode, d as derived, e as dynamicNode, f as effect, p as pipe, g as producer, s as state } from '../sugar-CQkn_rxB.js';
@@ -1 +1 @@
1
- import"../chunk-CZVYLXFK.js";import{a as X}from"../chunk-N2KKISCE.js";import{A as M,B as N,C as O,D as P,E as Q,F as R,G as S,H as T,I as U,J as V,K as W,i as v,j as w,k as x,m as y,n as z,o as A,p as B,q as C,r as D,s as E,t as F,u as G,v as H,w as I,x as J,y as K,z as L}from"../chunk-7AJKUA36.js";import{a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u}from"../chunk-CK2E7BTU.js";import"../chunk-QYADASLV.js";export{i as COMPLETE,o as COMPLETE_MSG,t as COMPLETE_ONLY_BATCH,b as DATA,v as DEFAULT_ACTOR,c as DIRTY,k as DIRTY_MSG,q as DIRTY_ONLY_BATCH,j as ERROR,C as GraphReFlyConfig,E as GuardDenied,e as INVALIDATE,m as INVALIDATE_MSG,s as INVALIDATE_ONLY_BATCH,O as NodeImpl,f as PAUSE,d as RESOLVED,l as RESOLVED_MSG,r as RESOLVED_ONLY_BATCH,g as RESUME,a as START,n as START_MSG,h as TEARDOWN,p as TEARDOWN_MSG,u as TEARDOWN_ONLY_BATCH,H as accessHintForGuard,K as advanceVersion,V as autoTrackNode,y as batch,N as configure,J as createVersioning,M as defaultConfig,I as defaultHash,S as derived,z as downWithBatch,U as dynamicNode,T as effect,x as isBatching,L as isV1,A as monotonicNs,P as node,w as normalizeActor,W as pipe,F as policy,G as policyFromRules,R as producer,D as registerBuiltins,X as resolveDescribeFields,Q as state,B as wallClockNs};
1
+ import"../chunk-M27MVZCP.js";import{a as X}from"../chunk-533RQFF6.js";import{A as M,B as N,C as O,D as P,E as Q,F as R,G as S,H as T,I as U,J as V,K as W,i as v,j as w,k as x,m as y,n as z,o as A,p as B,q as C,r as D,s as E,t as F,u as G,v as H,w as I,x as J,y as K,z as L}from"../chunk-LYCLF26R.js";import{a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u}from"../chunk-CK2E7BTU.js";import"../chunk-QYADASLV.js";export{i as COMPLETE,o as COMPLETE_MSG,t as COMPLETE_ONLY_BATCH,b as DATA,v as DEFAULT_ACTOR,c as DIRTY,k as DIRTY_MSG,q as DIRTY_ONLY_BATCH,j as ERROR,C as GraphReFlyConfig,E as GuardDenied,e as INVALIDATE,m as INVALIDATE_MSG,s as INVALIDATE_ONLY_BATCH,O as NodeImpl,f as PAUSE,d as RESOLVED,l as RESOLVED_MSG,r as RESOLVED_ONLY_BATCH,g as RESUME,a as START,n as START_MSG,h as TEARDOWN,p as TEARDOWN_MSG,u as TEARDOWN_ONLY_BATCH,H as accessHintForGuard,K as advanceVersion,V as autoTrackNode,y as batch,N as configure,J as createVersioning,M as defaultConfig,I as defaultHash,S as derived,z as downWithBatch,U as dynamicNode,T as effect,x as isBatching,L as isV1,A as monotonicNs,P as node,w as normalizeActor,W as pipe,F as policy,G as policyFromRules,R as producer,D as registerBuiltins,X as resolveDescribeFields,Q as state,B as wallClockNs};
@@ -1 +1 @@
1
- "use strict";var K=Object.defineProperty;var Re=Object.getOwnPropertyDescriptor;var Ce=Object.getOwnPropertyNames;var Ie=Object.prototype.hasOwnProperty;var Fe=(n,e)=>{for(var t in e)K(n,t,{get:e[t],enumerable:!0})},Ge=(n,e,t,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of Ce(e))!Ie.call(n,r)&&r!==t&&K(n,r,{get:()=>e[r],enumerable:!(s=Re(e,r))||s.enumerable});return n};var He=n=>Ge(K({},"__esModule",{value:!0}),n);var Ze={};Fe(Ze,{fromIDBRequest:()=>Ee,fromIDBTransaction:()=>Me,indexedDbStorage:()=>Se});module.exports=He(Ze);var G=Symbol.for("graphrefly/START"),_=Symbol.for("graphrefly/DATA"),k=Symbol.for("graphrefly/DIRTY"),E=Symbol.for("graphrefly/RESOLVED"),M=Symbol.for("graphrefly/INVALIDATE"),S=Symbol.for("graphrefly/PAUSE"),H=Symbol.for("graphrefly/RESUME"),N=Symbol.for("graphrefly/TEARDOWN"),v=Symbol.for("graphrefly/COMPLETE"),f=Symbol.for("graphrefly/ERROR"),D=Object.freeze([k]),J=Object.freeze([E]),Le=Object.freeze([M]),X=Object.freeze([G]),Ve=Object.freeze([v]),Pe=Object.freeze([N]),Z=Object.freeze([D]),le=Object.freeze([J]),ce=Object.freeze([Le]),ue=Object.freeze([Ve]),Q=Object.freeze([Pe]);var Be={name:"json",version:1,contentType:"application/json",encode(n){let e=JSON.stringify(n);return new TextEncoder().encode(e)},decode(n,e){let t=new TextDecoder().decode(n);return JSON.parse(t)}};function fe(n){n.registerCodec(Be)}var Ue={type:"system",id:""};function B(n){if(n==null)return Ue;let{type:e,id:t,...s}=n;return{type:e??"system",id:t??"",...s}}var ee=0,We=!1,he=[],pe=[],ge=[],je=[];function _e(){return ee>0||We}function ye(){return ee>0}function be(n){ee>0?je.push(n):n()}function U(n,e,t){if(e.length===0)return;if(e.length===1){let l=t(e[0][0]);if(l<3||!_e()){n(e);return}(l>=5?ge:l===4?pe:he).push(()=>n(e));return}let s=e.length,r=s,i=s,a=s,o=0;for(;o<s&&t(e[o][0])<3;)o++;for(r=o;o<s&&t(e[o][0])===3;)o++;for(i=o;o<s&&t(e[o][0])===4;)o++;a=o;let d=_e();if(r>0){let l=e.slice(0,r);n(l)}if(i>r){let l=e.slice(r,i);d?he.push(()=>n(l)):n(l)}if(a>i){let l=e.slice(i,a);d?pe.push(()=>n(l)):n(l)}if(s>a){let l=e.slice(a,s);d?ge.push(()=>n(l)):n(l)}}function me(){return Date.now()*1e6}var W=class{_messageTypes=new Map;_codecs=new Map;_onMessage;_onSubscribe;_defaultVersioning;_defaultHashFn;_inspectorEnabled=!(typeof process<"u"&&process.env?.NODE_ENV==="production");_globalInspector;_frozen=!1;tierOf;constructor(e){this._onMessage=e.onMessage,this._onSubscribe=e.onSubscribe,this._defaultVersioning=e.defaultVersioning,this._defaultHashFn=e.defaultHashFn,this.tierOf=t=>{let s=this._messageTypes.get(t);return s!=null?s.tier:1}}get onMessage(){return this._frozen=!0,this._onMessage}get onSubscribe(){return this._frozen=!0,this._onSubscribe}set onMessage(e){this._assertUnfrozen(),this._onMessage=e}set onSubscribe(e){this._assertUnfrozen(),this._onSubscribe=e}get defaultVersioning(){return this._defaultVersioning}set defaultVersioning(e){this._assertUnfrozen(),this._defaultVersioning=e}get defaultHashFn(){return this._defaultHashFn}set defaultHashFn(e){this._assertUnfrozen(),this._defaultHashFn=e}get inspectorEnabled(){return this._inspectorEnabled}set inspectorEnabled(e){this._inspectorEnabled=e}get globalInspector(){return this._globalInspector}set globalInspector(e){this._globalInspector=e}registerMessageType(e,t){return this._assertUnfrozen(),this._messageTypes.set(e,{tier:t.tier,wireCrossing:t.wireCrossing??t.tier>=3,metaPassthrough:t.metaPassthrough??!0}),this}messageTier(e){let t=this._messageTypes.get(e);return t!=null?t.tier:1}isWireCrossing(e){let t=this._messageTypes.get(e);return t!=null?t.wireCrossing:!0}isLocalOnly(e){return!this.isWireCrossing(e)}isMetaPassthrough(e){let t=this._messageTypes.get(e);return t!=null?t.metaPassthrough:!0}isKnownMessageType(e){return this._messageTypes.has(e)}registerCodec(e){return this._assertUnfrozen(),this._codecs.set(e.name,e),this}lookupCodec(e){return this._codecs.get(e)}_isFrozen(){return this._frozen}_assertUnfrozen(){if(this._frozen)throw new Error("GraphReFlyConfig is frozen: a node has already captured this config. Register custom types and set hooks before creating any node.")}};function ve(n){n.registerMessageType(G,{tier:0,wireCrossing:!1}),n.registerMessageType(k,{tier:1,wireCrossing:!1}),n.registerMessageType(M,{tier:1,wireCrossing:!1,metaPassthrough:!1}),n.registerMessageType(S,{tier:2,wireCrossing:!1}),n.registerMessageType(H,{tier:2,wireCrossing:!1}),n.registerMessageType(_,{tier:3,wireCrossing:!0}),n.registerMessageType(E,{tier:3,wireCrossing:!0}),n.registerMessageType(v,{tier:4,wireCrossing:!0,metaPassthrough:!1}),n.registerMessageType(f,{tier:4,wireCrossing:!0,metaPassthrough:!1}),n.registerMessageType(N,{tier:5,wireCrossing:!0,metaPassthrough:!1})}var O=class extends Error{actor;action;nodeName;constructor(e,t){super(t??`GuardDenied: action "${String(e.action)}" denied for actor type "${String(e.actor.type)}"`),this.name="GuardDenied",this.actor=e.actor,this.action=e.action,this.nodeName=e.nodeName}get node(){return this.nodeName}};function te(n){if(n===void 0)return null;if(typeof n=="number"){if(!Number.isFinite(n))throw new TypeError(`Cannot hash non-finite number: ${n}`);if(Number.isInteger(n)&&!Number.isSafeInteger(n))throw new TypeError(`Cannot hash integer outside safe range (|n| > 2^53-1): ${n}. Cross-language cid parity is not guaranteed for unsafe integers.`);return n}if(typeof n=="string"||typeof n=="boolean"||n===null)return n;if(Array.isArray(n))return n.map(te);if(typeof n=="object"&&n!==null){let e={};for(let t of Object.keys(n).sort())e[t]=te(n[t]);return e}return null}var ze=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]),$e=new TextEncoder;function qe(n){let e=$e.encode(n),t=e.length,s=t*8,r=t+9+63&-64,i=new Uint8Array(r);i.set(e),i[t]=128;let a=new DataView(i.buffer);a.setUint32(r-4,s>>>0,!1),a.setUint32(r-8,Math.floor(s/4294967296)>>>0,!1);let o=1779033703,d=3144134277,l=1013904242,c=2773480762,u=1359893119,h=2600822924,g=528734635,y=1541459225,A=new Uint32Array(64),m=(x,b)=>x>>>b|x<<32-b;for(let x=0;x<r;x+=64){for(let p=0;p<16;p++)A[p]=a.getUint32(x+p*4,!1);for(let p=16;p<64;p++){let I=A[p-15],F=A[p-2],P=m(I,7)^m(I,18)^I>>>3,Y=m(F,17)^m(F,19)^F>>>10;A[p]=A[p-16]+P+A[p-7]+Y>>>0}let b=o,R=d,C=l,$=c,T=u,L=h,V=g,q=y;for(let p=0;p<64;p++){let I=m(T,6)^m(T,11)^m(T,25),F=T&L^~T&V,P=q+I+F+ze[p]+A[p]>>>0,Y=m(b,2)^m(b,13)^m(b,22),De=b&R^b&C^R&C,Oe=Y+De>>>0;q=V,V=L,L=T,T=$+P>>>0,$=C,C=R,R=b,b=P+Oe>>>0}o=o+b>>>0,d=d+R>>>0,l=l+C>>>0,c=c+$>>>0,u=u+T>>>0,h=h+L>>>0,g=g+V>>>0,y=y+q>>>0}let w=x=>x.toString(16).padStart(8,"0");return w(o)+w(d)+w(l)+w(c)+w(u)+w(h)+w(g)+w(y)}function ne(n){let e=te(n??null),t=JSON.stringify(e);return qe(t).slice(0,16)}function Ye(){let n=globalThis.crypto;if(n?.randomUUID)return n.randomUUID();let e=()=>Math.floor(Math.random()*4294967296).toString(16).padStart(8,"0"),t=e()+e()+e()+e();return`${t.slice(0,8)}-${t.slice(8,12)}-4${t.slice(13,16)}-${(parseInt(t.slice(16,17),16)&3|8).toString(16)}${t.slice(17,20)}-${t.slice(20,32)}`}function se(n,e,t){let s=t?.id??Ye();if(n===0)return{id:s,version:0};let i=(t?.hash??ne)(e);return{id:s,version:0,cid:i,prev:null}}function we(n,e,t){n.version+=1,"cid"in n&&(n.prev=n.cid,n.cid=t(e))}var xe=()=>{},Te=100;function Ne(n){return{node:n,unsub:null,prevData:void 0,dirty:!1,involvedThisWave:!1,dataBatch:[],terminal:void 0}}function re(n){n.prevData=void 0,n.dirty=!1,n.involvedThisWave=!1,n.dataBatch.length=0,n.terminal=void 0}function j(n){return n.length===0?n:typeof n[0]=="symbol"?[n]:n}var Ke=(n,e,t,s)=>{t.direction==="down-in"&&n._onDepMessage(t.depIndex,e)},Je=(n,e,t,s)=>{let r=n;if(r._status==="completed"||r._status==="errored")return;let i=r._cached,a=i===void 0?[X]:[X,[_,i]];r._status==="dirty"&&a.push(D),U(e,a,r._config.tierOf)},ie=new W({onMessage:Ke,onSubscribe:Je});ve(ie);fe(ie);var z=class n{_optsName;_describeKind;meta;_hasMeta;_config;_deps;_sinks=null;_sinkCount=0;_cached;_status;_cleanup;_store={};_waveHasNewData=!1;_hasNewTerminal=!1;_hasCalledFnOnce=!1;_paused=!1;_pendingWave=!1;_isExecutingFn=!1;_pendingRerun=!1;_rerunDepth=0;_dirtyDepCount=0;_batchPendingMessages=null;_pauseLocks=null;_pauseBuffer=null;_fn;_equals;_resubscribable;_resetOnTeardown;_autoComplete;_autoError;_pausable;_partial;_guard;_extraGuards;_hashFn;_versioning;_versioningLevel;_lastMutation;_inspectorHooks;_actions;constructor(e,t,s){this._config=s.config??ie,this._config.onMessage,this._optsName=s.name,this._describeKind=s.describeKind,this._equals=s.equals??Object.is,this._resubscribable=s.resubscribable??!1,this._resetOnTeardown=s.resetOnTeardown??!1,this._autoComplete=s.completeWhenDepsComplete??!0,this._autoError=s.errorWhenDepsError??!0,this._pausable=s.pausable??!0,this._guard=s.guard,this._fn=t,this._partial=s.partial??!1,this._cached=s.initial!==void 0?s.initial:void 0,this._status=e.length===0&&t==null&&this._cached!==void 0?"settled":"sentinel",this._hashFn=s.versioningHash??this._config.defaultHashFn??ne;let r=s.versioning??this._config.defaultVersioning;this._versioningLevel=r,this._versioning=r!=null?se(r,this._cached===void 0?void 0:this._cached,{id:s.versioningId,hash:this._hashFn}):void 0,this._deps=e.map(Ne);let i={};for(let[o,d]of Object.entries(s.meta??{})){let l={initial:d,name:`${s.name??"node"}:meta:${o}`,describeKind:"state",config:this._config};s.guard!=null&&(l.guard=s.guard),i[o]=new n([],void 0,l)}Object.freeze(i),this.meta=i,this._hasMeta=Object.keys(i).length>0;let a=this;this._actions={emit(o){a._emit([[_,o]])},down(o){a._emit(j(o))},up(o){a._emitUp(j(o))}},this.down=this.down.bind(this),this.up=this.up.bind(this)}get _isTerminal(){return this._status==="completed"||this._status==="errored"}get name(){return this._optsName}get status(){return this._status}get cache(){return this._cached===void 0?void 0:this._cached}get lastMutation(){return this._lastMutation}get v(){return this._versioning}hasGuard(){return this._guard!=null}_applyVersioning(e,t){if(this._isExecutingFn)throw new Error(`Node "${this.name}": _applyVersioning cannot run mid-fn \u2014 call it outside of \`_execFn\` (typically at graph setup time before the first subscribe).`);let s=this._versioningLevel;if(s!=null&&e<=s)return;let r=t?.hash??this._hashFn;r!==this._hashFn&&(this._hashFn=r);let i=this._cached===void 0?void 0:this._cached,a=this._versioning,o=a?.id??t?.id,d=a?.version??0,l=se(e,i,{id:o,hash:r});l.version=d,this._versioning=l,this._versioningLevel=e}_setInspectorHook(e){return e==null?()=>{}:(this._inspectorHooks==null&&(this._inspectorHooks=new Set),this._inspectorHooks.add(e),()=>{this._inspectorHooks?.delete(e),this._inspectorHooks?.size===0&&(this._inspectorHooks=void 0)})}_pushGuard(e){return this._extraGuards==null&&(this._extraGuards=new Set),this._extraGuards.add(e),()=>{this._extraGuards?.delete(e),this._extraGuards?.size===0&&(this._extraGuards=void 0)}}allowsObserve(e){if(this._guard==null&&this._extraGuards==null)return!0;let t=B(e);if(this._guard!=null&&!this._guard(t,"observe"))return!1;if(this._extraGuards!=null){for(let s of this._extraGuards)if(!s(t,"observe"))return!1}return!0}_checkGuard(e){if(e?.internal)return;let t=this._guard!=null||this._extraGuards!=null,s=e?.actor!=null;if(!t&&!s)return;let r=B(e?.actor),i=e?.delivery==="signal"?"signal":"write";if(this._guard!=null&&!this._guard(r,i))throw new O({actor:r,action:i,nodeName:this.name});if(this._extraGuards!=null){for(let a of this._extraGuards)if(!a(r,i))throw new O({actor:r,action:i,nodeName:this.name})}this._lastMutation={actor:r,timestamp_ns:me()}}down(e,t){let s=j(e);s.length!==0&&(this._checkGuard(t),this._emit(s))}emit(e,t){this._checkGuard(t),this._emit([[_,e]])}up(e,t){if(this._deps.length===0)return;let s=j(e);if(s.length===0)return;this._checkGuard(t);let r=t??{internal:!0};this._validateUpTiers(s);for(let i of this._deps)i.node.up?.(s,r)}_emitUp(e){if(this._deps.length!==0&&e.length!==0){this._validateUpTiers(e);for(let t of this._deps)t.node.up?.(e,{internal:!0})}}_validateUpTiers(e){let t=this._config.tierOf;for(let s of e){let r=t(s[0]);if(r===3||r===4)throw new Error(`Node "${this.name}": tier-${r} messages cannot flow up \u2014 DATA/RESOLVED/COMPLETE/ERROR are downstream-only. Use \`down(...)\` for value delivery; \`up(...)\` is for control signals (DIRTY, INVALIDATE, PAUSE, RESUME, TEARDOWN).`)}}subscribe(e,t){if(t!=null&&this._guard!=null){let d=B(t);if(!this._guard(d,"observe"))throw new O({actor:d,action:"observe",nodeName:this.name})}let r=this._isTerminal&&this._resubscribable;if(r){this._cached=void 0,this._status="sentinel",this._store={},this._hasCalledFnOnce=!1,this._waveHasNewData=!1,this._hasNewTerminal=!1,this._paused=!1,this._pendingWave=!1,this._pendingRerun=!1,this._isExecutingFn=!1,this._rerunDepth=0,this._dirtyDepCount=0,this._pauseLocks=null,this._pauseBuffer=null;for(let d of this._deps)re(d);if(this._partial===!1){for(let d of this._deps)if(d.prevData!==void 0||d.dataBatch.length!==0||d.terminal!==void 0||d.dirty)throw new Error(`resubscribable-reset invariant: DepRecord not fully reset for node ${this._optsName??"(anonymous)"}`)}}this._sinkCount+=1;let i;try{i=this._config.onSubscribe(this,e,{sinkCount:this._sinkCount,afterTerminalReset:r},this._actions)}catch(d){throw this._sinkCount-=1,d}this._sinks==null?this._sinks=e:typeof this._sinks=="function"?this._sinks=new Set([this._sinks,e]):this._sinks.add(e);let a=this._isTerminal;if(this._sinkCount===1&&!a)try{this._activate()}catch(d){if(this._sinkCount-=1,this._removeSink(e),this._sinkCount===0&&(this._status="sentinel"),typeof i=="function")try{i()}catch{}throw d}this._status==="sentinel"&&this._cached===void 0&&(this._status="pending");let o=!1;return()=>{o||(o=!0,this._sinkCount-=1,this._removeSink(e),typeof i=="function"&&i(),this._sinks==null&&this._deactivate())}}_removeSink(e){if(this._sinks===e)this._sinks=null;else if(this._sinks!=null&&typeof this._sinks!="function")if(this._sinks.delete(e),this._sinks.size===1){let[t]=this._sinks;this._sinks=t}else this._sinks.size===0&&(this._sinks=null)}_activate(){if(this._deps.length===0){this._fn&&this._execFn();return}this._dirtyDepCount=0;let e=this._deps.length,t=0;try{for(let s=0;s<e;s++){let r=s,i=this._deps[s];i.unsub=xe,i.unsub=i.node.subscribe(a=>{if(i.unsub===null)return;let o=this._config.tierOf,d=!1;for(let l of a)o(l[0])>=3&&(d=!0),this._config.onMessage(this,l,{direction:"down-in",depIndex:r},this._actions);d&&this._maybeRunFnOnSettlement()}),t++}}catch(s){this._deps[t].unsub=null;for(let r=0;r<t;r++){let i=this._deps[r];if(i.unsub!=null){let a=i.unsub;i.unsub=null;try{a()}catch{}re(i)}}throw this._dirtyDepCount=0,s}}_addDep(e){for(let r=0;r<this._deps.length;r++)if(this._deps[r].node===e)return r;let t=this._deps.length,s=Ne(e);if(this._deps.push(s),this._sinks==null)return t;s.dirty=!0,this._dirtyDepCount++,this._status!=="dirty"&&this._emit(Z),s.unsub=xe;try{s.unsub=e.subscribe(r=>{if(s.unsub===null)return;let i=this._config.tierOf,a=!1;for(let o of r)i(o[0])>=3&&(a=!0),this._config.onMessage(this,o,{direction:"down-in",depIndex:t},this._actions);a&&this._maybeRunFnOnSettlement()})}catch(r){throw s.unsub=null,this._deps.pop(),this._dirtyDepCount--,r}return t}_deactivate(e=!1){let t=this._cleanup;if(this._cleanup=void 0,typeof t=="function")try{t()}catch(s){this._emit([[f,this._wrapFnError("cleanup threw",s)]])}else if(t!=null&&typeof t=="object"){let s=t.deactivate;if(typeof s=="function")try{s()}catch(r){this._emit([[f,this._wrapFnError("cleanup.deactivate threw",r)]])}}for(let s of this._deps){if(s.unsub!=null){let r=s.unsub;s.unsub=null;try{r()}catch{}}re(s)}this._waveHasNewData=!1,this._hasNewTerminal=!1,this._hasCalledFnOnce=!1,this._paused=!1,this._pendingWave=!1,this._pendingRerun=!1,this._rerunDepth=0,this._store={},this._dirtyDepCount=0,this._pauseLocks=null,this._pauseBuffer=null,this._fn!=null&&(this._cached=void 0),e||(this._fn!=null||this._deps.length>0)&&(!this._isTerminal||this._resubscribable)&&(this._status="sentinel")}_onDepMessage(e,t){let s=this._deps[e],r=t[0];if(this._inspectorHooks!=null){let i={kind:"dep_message",depIndex:e,message:t};for(let a of this._inspectorHooks)a(i)}if(r!==G){if(r===k){this._depDirtied(s);return}if(r===M){if(this._depInvalidated(s),this._cached===void 0)return;this._emit(ce);return}if(r===S||r===H){this._emit([t]);return}if(r===N){this._emit(Q);return}if(r===_)this._depSettledAsData(s,t[1]);else if(r===E)this._depSettledAsResolved(s);else if(r===v)this._depSettledAsTerminal(s,!0);else if(r===f)this._depSettledAsTerminal(s,t[1]);else{this._emit([t]);return}if(!this._fn){(r===_||r===E)&&this._emit([t]),(r===v||r===f)&&this._maybeAutoTerminalAfterWave();return}}}_depDirtied(e){e.dirty||(e.dirty=!0,e.involvedThisWave=!0,this._dirtyDepCount++,this._status!=="dirty"&&this._emit(Z))}_depSettledAsData(e,t){e.dirty&&(e.dirty=!1,this._dirtyDepCount--),e.involvedThisWave=!0,e.dataBatch.push(t),this._waveHasNewData=!0}_depSettledAsResolved(e){e.dirty&&(e.dirty=!1,this._dirtyDepCount--)}_depSettledAsTerminal(e,t){e.dirty&&(e.dirty=!1,this._dirtyDepCount--),e.terminal=t,e.involvedThisWave=!0,this._hasNewTerminal=!0}_depInvalidated(e){e.prevData=void 0,e.terminal=void 0,e.dataBatch.length=0,e.dirty?e.involvedThisWave=!1:(e.dirty=!0,e.involvedThisWave=!0,this._dirtyDepCount++)}_maybeRunFnOnSettlement(){if(!(this._isTerminal&&!this._resubscribable)&&!(this._dirtyDepCount>0)){if(!this._partial&&!this._hasCalledFnOnce)for(let e=0;e<this._deps.length;e++){let t=this._deps[e];if(t.dataBatch.length===0&&t.prevData===void 0&&t.terminal===void 0){this._maybeAutoTerminalAfterWave();return}}if(this._paused){this._pendingWave=!0;return}if(!this._waveHasNewData&&!this._hasNewTerminal&&this._hasCalledFnOnce){this._clearWaveFlags(),this._emit(le),this._maybeAutoTerminalAfterWave();return}this._fn&&this._execFn(),this._maybeAutoTerminalAfterWave()}}_maybeAutoTerminalAfterWave(){if(this._deps.length===0||this._isTerminal)return;let e=this._deps.find(t=>t.terminal!==void 0&&t.terminal!==!0);if(e!=null){this._autoError&&this._emit([[f,e.terminal]]);return}this._autoComplete&&this._deps.every(t=>t.terminal!==void 0)&&this._emit(ue)}_execFn(){if(!this._fn||this._isTerminal&&!this._resubscribable)return;if(this._isExecutingFn){this._pendingRerun=!0;return}let e=this._cleanup;if(typeof e=="function"){this._cleanup=void 0;try{e()}catch(a){this._emit([[f,this._wrapFnError("cleanup threw",a)]]);return}}else if(e!=null&&typeof e=="object"){let a=e.beforeRun;if(typeof a=="function"){e.beforeRun=void 0;try{a()}catch(o){this._emit([[f,this._wrapFnError("cleanup.beforeRun threw",o)]]);return}}}let t=this._deps.map(a=>a.involvedThisWave?a.dataBatch.length>0?[...a.dataBatch]:[]:void 0),s=this._deps.map(a=>a.prevData);for(let a=0;a<this._deps.length;a++){let o=t[a];o!=null&&o.length>0&&(this._deps[a].prevData=o[o.length-1])}let r=this._deps.map(a=>a.terminal),i={prevData:s,terminalDeps:r,store:this._store};if(this._hasCalledFnOnce=!0,this._clearWaveFlags(),this._inspectorHooks!=null){let a={kind:"run",batchData:t,prevData:s};for(let o of this._inspectorHooks)o(a)}this._isExecutingFn=!0;try{let a=this._fn(t,this._actions,i);if(typeof a=="function")this._cleanup=a;else if(a!=null&&typeof a=="object"){let o=a;(typeof o.beforeRun=="function"||typeof o.deactivate=="function"||typeof o.invalidate=="function")&&(this._cleanup=a)}}catch(a){this._emit([[f,this._wrapFnError("fn threw",a)]])}finally{this._isExecutingFn=!1,this._pendingRerun?(this._pendingRerun=!1,this._rerunDepth+=1,this._rerunDepth>Te?(this._rerunDepth=0,this._emit([[f,new Error(`Node "${this.name}": _pendingRerun depth exceeded ${Te} \u2014 likely a reactive cycle`)]])):this._maybeRunFnOnSettlement()):this._rerunDepth=0,this._clearWaveFlags()}}_clearWaveFlags(){this._waveHasNewData=!1,this._hasNewTerminal=!1;for(let e of this._deps)e.involvedThisWave=!1,e.dataBatch.length=0}_wrapFnError(e,t){let s=t instanceof Error?t.message:String(t);return new Error(`Node "${this.name}": ${e}: ${s}`,{cause:t})}_frameBatch(e){let t=this._config.tierOf;if(e.length===1)return t(e[0][0])===3&&this._status!=="dirty"?[D,e[0]]:e;let s=!0,r=!1,i=!1,a=-1;for(let d of e){let l=t(d[0]);l<a&&(s=!1),l===3&&(r=!0),d[0]===k&&(i=!0),a=l}let o=e;if(!s){let d=e.map((l,c)=>({m:l,i:c,tier:t(l[0])}));d.sort((l,c)=>l.tier-c.tier||l.i-c.i),o=d.map(l=>l.m)}if(r&&!i&&this._status!=="dirty"){let d=0;for(;d<o.length&&t(o[d][0])===0;)d++;return d===0?[D,...o]:[...o.slice(0,d),D,...o.slice(d)]}return o}_emit(e){if(e.length===0)return;for(let o=0;o<e.length;o++){let d=e[o];if(d[0]===f&&d[1]===void 0)throw new TypeError('[ERROR, payload] requires a non-undefined payload (spec \xA71.2). Pass an Error object or domain tag instead \u2014 e.g. node.down([[ERROR, new Error("reason")]])')}let t=e;if(this._isTerminal&&!this._resubscribable){let o=e.filter(d=>d[0]===N||d[0]===M);if(o.length===0)return;t=o}t=this._frameBatch(t);let r=null;for(let o=0;o<t.length;o++){let d=t[o],l=d[0];if(l!==S&&l!==H){r?.push(d);continue}if(d.length<2)throw new Error(`Node "${this.name}": [[${l===S?"PAUSE":"RESUME"}]] must carry a lockId payload \u2014 bare PAUSE/RESUME is a protocol violation (C0 rule). Use \`[[PAUSE, lockId]]\` / \`[[RESUME, lockId]]\`.`);let c=!0;if(this._pausable!==!1){let u=d[1];if(l===S)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))c=!1;else if(this._pauseLocks.delete(u),this._pauseLocks.size===0){if(this._paused=!1,this._pauseBuffer!=null&&this._pauseBuffer.length>0){let h=this._pauseBuffer;this._pauseBuffer=[],this._emit(h)}this._pendingWave&&(this._pendingWave=!1,this._maybeRunFnOnSettlement())}}c?r?.push(d):r==null&&(r=t.slice(0,o))}if(r!=null){if(r.length===0)return;t=r}if(this._hasMeta&&t.some(o=>o[0]===N))for(let o of Object.keys(this.meta))try{this.meta[o]._emit(Q)}catch{}let{finalMessages:i,equalsError:a}=this._updateState(t);if(i.length>0&&this._config.inspectorEnabled){let o=this._config.globalInspector;if(o!=null)try{o({kind:"emit",node:this,messages:i})}catch{}}if(i.length>0)if(this._paused&&this._pausable==="resumeAll"&&this._pauseBuffer!=null){let o=this._config.tierOf,d=[];for(let l of i)o(l[0])===3?this._pauseBuffer.push(l):d.push(l);d.length>0&&this._dispatchOrAccumulate(d)}else this._dispatchOrAccumulate(i);a!=null&&this._emit([[f,a]])}_updateState(e){let t=this._config.tierOf,s,r,i=-1,a=0;for(let c of e)t(c[0])===3&&a++;let o=a<=1,d=-1;if(this._versioning!=null&&a>1){for(let c=e.length-1;c>=0;c--)if(e[c][0]===_){d=c;break}}for(let c=0;c<e.length;c++){let u=e[c],h=u[0];if(h===_){if(u.length>=2){let g=!1;if(o&&this._cached!==void 0)try{g=this._equals(this._cached,u[1])}catch(y){r=this._wrapFnError("equals threw",y),i=c;break}if(g){s==null&&(s=e.slice(0,c)),s.push(J),this._status="resolved";continue}this._cached=u[1],this._versioning!=null&&(d<0||c===d)&&we(this._versioning,u[1],this._hashFn)}this._status="settled",s?.push(u)}else if(s?.push(u),h===k)this._status="dirty";else if(h===E)this._status="resolved";else if(h===v)this._status="completed";else if(h===f)this._status="errored";else if(h===M){this._cached=void 0,this._status="dirty";let g=this._cleanup;if(typeof g=="function"){this._cleanup=void 0;try{g()}catch{}}else if(g!=null&&typeof g=="object"){let y=g.invalidate;if(typeof y=="function")try{y()}catch{}}}else h===N&&(this._resetOnTeardown&&(this._cached=void 0),this._deactivate(!0),this._status="sentinel")}let l=i>=0?s??e.slice(0,i):s??e;return r!=null?{finalMessages:l,equalsError:r}:{finalMessages:l}}_deliverToSinks=e=>{if(this._sinks==null)return;if(typeof this._sinks=="function"){this._sinks(e);return}let t=[...this._sinks];for(let s of t)s(e)};_dispatchOrAccumulate(e){if(ye()){this._batchPendingMessages===null&&(this._batchPendingMessages=[],be(()=>this._flushBatchPending()));for(let t of e)this._batchPendingMessages.push(t);return}U(this._deliverToSinks,e,this._config.tierOf)}_flushBatchPending(){let e=this._batchPendingMessages;if(e===null||(this._batchPendingMessages=null,e.length===0))return;let t=this._frameBatch(e);U(this._deliverToSinks,t,this._config.tierOf)}},Ae=n=>Array.isArray(n),oe=n=>typeof n=="object"&&n!=null&&!Array.isArray(n);function ke(n,e,t){let s=Ae(n)?n:[],r=typeof n=="function"?n:typeof e=="function"?e:void 0,i={};return Ae(n)?i=(oe(e)?e:t)??{}:oe(n)?i=n:i=(oe(e)?e:t)??{},new z(s,r,i)}function ae(n,e){return ke((s,r,i)=>n(r,i)??void 0,{describeKind:"producer",...e})}function Ee(n){return ae(e=>{let t=!1,s=()=>{n.onsuccess=null,n.onerror=null};return n.onsuccess=()=>{t||(t=!0,s(),e.down([[_,n.result],[v]]))},n.onerror=()=>{t||(t=!0,s(),e.down([[f,n.error??new Error("IndexedDB request failed")]]))},()=>{t=!0,s()}})}function Me(n){return ae(e=>{let t=!1,s=()=>{n.oncomplete=null,n.onerror=null,n.onabort=null};return n.oncomplete=()=>{t||(t=!0,s(),e.down([[_,void 0],[v]]))},n.onerror=()=>{t||(t=!0,s(),e.down([[f,n.error??new Error("IndexedDB transaction failed")]]))},n.onabort=()=>{t||(t=!0,s(),e.down([[f,n.error??new Error("IndexedDB transaction aborted")]]))},()=>{t=!0,s()}})}function Xe(n,e,t){return new Promise((s,r)=>{if(typeof indexedDB>"u"){r(new TypeError("indexedDB is not available in this environment"));return}let i=indexedDB.open(n,t);i.onupgradeneeded=()=>{let a=i.result;a.objectStoreNames.contains(e)||a.createObjectStore(e)},i.onsuccess=()=>s(i.result),i.onerror=()=>r(i.error??new Error("IndexedDB open failed"))})}function de(n,e,t,s,r){return Xe(n,e,t).then(i=>new Promise((a,o)=>{let d=i.transaction(e,s),l=d.objectStore(e),c=r(l),u,h=!1,g=!1,y=()=>{!h||!g||(i.close(),a(u))};c.onsuccess=()=>{u=c.result,h=!0,y()},c.onerror=()=>{i.close(),o(c.error??new Error("IndexedDB request failed"))},d.oncomplete=()=>{if(g=!0,!h){i.close(),o(new Error("IndexedDB transaction completed without request result"));return}y()},d.onerror=()=>{i.close(),o(d.error??new Error("IndexedDB transaction failed"))},d.onabort=()=>{i.close(),o(d.error??new Error("IndexedDB transaction aborted"))}}))}function Se(n){let{dbName:e,storeName:t}=n,s=n.version??1,r=n.key??"graphrefly_checkpoint";return{async save(i,a){await de(e,t,s,"readwrite",o=>o.put(a,r))},async load(i){let a=await de(e,t,s,"readonly",o=>o.get(r));return a==null||typeof a!="object"||Array.isArray(a)?null:a},async clear(i){await de(e,t,s,"readwrite",a=>a.delete(r))}}}0&&(module.exports={fromIDBRequest,fromIDBTransaction,indexedDbStorage});
1
+ "use strict";var K=Object.defineProperty;var Oe=Object.getOwnPropertyDescriptor;var Ce=Object.getOwnPropertyNames;var Ie=Object.prototype.hasOwnProperty;var Fe=(n,e)=>{for(var t in e)K(n,t,{get:e[t],enumerable:!0})},Ge=(n,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of Ce(e))!Ie.call(n,s)&&s!==t&&K(n,s,{get:()=>e[s],enumerable:!(r=Oe(e,s))||r.enumerable});return n};var He=n=>Ge(K({},"__esModule",{value:!0}),n);var Ze={};Fe(Ze,{fromIDBRequest:()=>Ee,fromIDBTransaction:()=>Me,indexedDbStorage:()=>Se});module.exports=He(Ze);var G=Symbol.for("graphrefly/START"),y=Symbol.for("graphrefly/DATA"),A=Symbol.for("graphrefly/DIRTY"),E=Symbol.for("graphrefly/RESOLVED"),M=Symbol.for("graphrefly/INVALIDATE"),S=Symbol.for("graphrefly/PAUSE"),H=Symbol.for("graphrefly/RESUME"),N=Symbol.for("graphrefly/TEARDOWN"),v=Symbol.for("graphrefly/COMPLETE"),f=Symbol.for("graphrefly/ERROR"),D=Object.freeze([A]),J=Object.freeze([E]),Le=Object.freeze([M]),X=Object.freeze([G]),Ve=Object.freeze([v]),Pe=Object.freeze([N]),Z=Object.freeze([D]),le=Object.freeze([J]),ce=Object.freeze([Le]),ue=Object.freeze([Ve]),Q=Object.freeze([Pe]);var Be={name:"json",version:1,contentType:"application/json",encode(n){let e=JSON.stringify(n);return new TextEncoder().encode(e)},decode(n,e){let t=new TextDecoder().decode(n);return JSON.parse(t)}};function he(n){n.registerCodec(Be)}var Ue={type:"system",id:""};function B(n){if(n==null)return Ue;let{type:e,id:t,...r}=n;return{type:e??"system",id:t??"",...r}}var ee=0,We=!1,fe=[],pe=[],ge=[],je=[];function _e(){return ee>0||We}function ye(){return ee>0}function me(n){ee>0?je.push(n):n()}function U(n,e,t){if(e.length===0)return;if(e.length===1){let l=t(e[0][0]);if(l<3||!_e()){n(e);return}(l>=5?ge:l===4?pe:fe).push(()=>n(e));return}let r=e.length,s=r,i=r,a=r,o=0;for(;o<r&&t(e[o][0])<3;)o++;for(s=o;o<r&&t(e[o][0])===3;)o++;for(i=o;o<r&&t(e[o][0])===4;)o++;a=o;let d=_e();if(s>0){let l=e.slice(0,s);n(l)}if(i>s){let l=e.slice(s,i);d?fe.push(()=>n(l)):n(l)}if(a>i){let l=e.slice(i,a);d?pe.push(()=>n(l)):n(l)}if(r>a){let l=e.slice(a,r);d?ge.push(()=>n(l)):n(l)}}function be(){return Date.now()*1e6}var W=class{_messageTypes=new Map;_codecs=new Map;_onMessage;_onSubscribe;_defaultVersioning;_defaultHashFn;_inspectorEnabled=!(typeof process<"u"&&process.env?.NODE_ENV==="production");_globalInspector;_rigorRecorder;_frozen=!1;tierOf;constructor(e){this._onMessage=e.onMessage,this._onSubscribe=e.onSubscribe,this._defaultVersioning=e.defaultVersioning,this._defaultHashFn=e.defaultHashFn,this.tierOf=t=>{let r=this._messageTypes.get(t);return r!=null?r.tier:1}}get onMessage(){return this._frozen=!0,this._onMessage}get onSubscribe(){return this._frozen=!0,this._onSubscribe}set onMessage(e){this._assertUnfrozen(),this._onMessage=e}set onSubscribe(e){this._assertUnfrozen(),this._onSubscribe=e}get defaultVersioning(){return this._defaultVersioning}set defaultVersioning(e){this._assertUnfrozen(),this._defaultVersioning=e}get defaultHashFn(){return this._defaultHashFn}set defaultHashFn(e){this._assertUnfrozen(),this._defaultHashFn=e}get inspectorEnabled(){return this._inspectorEnabled}set inspectorEnabled(e){this._inspectorEnabled=e}get globalInspector(){return this._globalInspector}set globalInspector(e){this._globalInspector=e}get rigorRecorder(){return this._rigorRecorder}set rigorRecorder(e){this._rigorRecorder=e}registerMessageType(e,t){return this._assertUnfrozen(),this._messageTypes.set(e,{tier:t.tier,wireCrossing:t.wireCrossing??t.tier>=3,metaPassthrough:t.metaPassthrough??!0}),this}messageTier(e){let t=this._messageTypes.get(e);return t!=null?t.tier:1}isWireCrossing(e){let t=this._messageTypes.get(e);return t!=null?t.wireCrossing:!0}isLocalOnly(e){return!this.isWireCrossing(e)}isMetaPassthrough(e){let t=this._messageTypes.get(e);return t!=null?t.metaPassthrough:!0}isKnownMessageType(e){return this._messageTypes.has(e)}registerCodec(e){return this._assertUnfrozen(),this._codecs.set(e.name,e),this}lookupCodec(e){return this._codecs.get(e)}_isFrozen(){return this._frozen}_assertUnfrozen(){if(this._frozen)throw new Error("GraphReFlyConfig is frozen: a node has already captured this config. Register custom types and set hooks before creating any node.")}};function ve(n){n.registerMessageType(G,{tier:0,wireCrossing:!1}),n.registerMessageType(A,{tier:1,wireCrossing:!1}),n.registerMessageType(M,{tier:1,wireCrossing:!1,metaPassthrough:!1}),n.registerMessageType(S,{tier:2,wireCrossing:!1}),n.registerMessageType(H,{tier:2,wireCrossing:!1}),n.registerMessageType(y,{tier:3,wireCrossing:!0}),n.registerMessageType(E,{tier:3,wireCrossing:!0}),n.registerMessageType(v,{tier:4,wireCrossing:!0,metaPassthrough:!1}),n.registerMessageType(f,{tier:4,wireCrossing:!0,metaPassthrough:!1}),n.registerMessageType(N,{tier:5,wireCrossing:!0,metaPassthrough:!1})}var R=class extends Error{actor;action;nodeName;constructor(e,t){super(t??`GuardDenied: action "${String(e.action)}" denied for actor type "${String(e.actor.type)}"`),this.name="GuardDenied",this.actor=e.actor,this.action=e.action,this.nodeName=e.nodeName}get node(){return this.nodeName}};function te(n){if(n===void 0)return null;if(typeof n=="number"){if(!Number.isFinite(n))throw new TypeError(`Cannot hash non-finite number: ${n}`);if(Number.isInteger(n)&&!Number.isSafeInteger(n))throw new TypeError(`Cannot hash integer outside safe range (|n| > 2^53-1): ${n}. Cross-language cid parity is not guaranteed for unsafe integers.`);return n}if(typeof n=="string"||typeof n=="boolean"||n===null)return n;if(Array.isArray(n))return n.map(te);if(typeof n=="object"&&n!==null){let e={};for(let t of Object.keys(n).sort())e[t]=te(n[t]);return e}return null}var ze=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]),$e=new TextEncoder;function qe(n){let e=$e.encode(n),t=e.length,r=t*8,s=t+9+63&-64,i=new Uint8Array(s);i.set(e),i[t]=128;let a=new DataView(i.buffer);a.setUint32(s-4,r>>>0,!1),a.setUint32(s-8,Math.floor(r/4294967296)>>>0,!1);let o=1779033703,d=3144134277,l=1013904242,c=2773480762,h=1359893119,p=2600822924,u=528734635,_=1541459225,k=new Uint32Array(64),b=(x,m)=>x>>>m|x<<32-m;for(let x=0;x<s;x+=64){for(let g=0;g<16;g++)k[g]=a.getUint32(x+g*4,!1);for(let g=16;g<64;g++){let I=k[g-15],F=k[g-2],P=b(I,7)^b(I,18)^I>>>3,Y=b(F,17)^b(F,19)^F>>>10;k[g]=k[g-16]+P+k[g-7]+Y>>>0}let m=o,O=d,C=l,$=c,T=h,L=p,V=u,q=_;for(let g=0;g<64;g++){let I=b(T,6)^b(T,11)^b(T,25),F=T&L^~T&V,P=q+I+F+ze[g]+k[g]>>>0,Y=b(m,2)^b(m,13)^b(m,22),De=m&O^m&C^O&C,Re=Y+De>>>0;q=V,V=L,L=T,T=$+P>>>0,$=C,C=O,O=m,m=P+Re>>>0}o=o+m>>>0,d=d+O>>>0,l=l+C>>>0,c=c+$>>>0,h=h+T>>>0,p=p+L>>>0,u=u+V>>>0,_=_+q>>>0}let w=x=>x.toString(16).padStart(8,"0");return w(o)+w(d)+w(l)+w(c)+w(h)+w(p)+w(u)+w(_)}function ne(n){let e=te(n??null),t=JSON.stringify(e);return qe(t).slice(0,16)}function Ye(){let n=globalThis.crypto;if(n?.randomUUID)return n.randomUUID();let e=()=>Math.floor(Math.random()*4294967296).toString(16).padStart(8,"0"),t=e()+e()+e()+e();return`${t.slice(0,8)}-${t.slice(8,12)}-4${t.slice(13,16)}-${(parseInt(t.slice(16,17),16)&3|8).toString(16)}${t.slice(17,20)}-${t.slice(20,32)}`}function re(n,e,t){let r=t?.id??Ye();if(n===0)return{id:r,version:0};let i=(t?.hash??ne)(e);return{id:r,version:0,cid:i,prev:null}}function we(n,e,t){n.version+=1,"cid"in n&&(n.prev=n.cid,n.cid=t(e))}var xe=()=>{},Te=100;function Ne(n){return{node:n,unsub:null,prevData:void 0,dirty:!1,involvedThisWave:!1,dataBatch:[],terminal:void 0}}function se(n){n.prevData=void 0,n.dirty=!1,n.involvedThisWave=!1,n.dataBatch.length=0,n.terminal=void 0}function j(n){return n.length===0?n:typeof n[0]=="symbol"?[n]:n}var Ke=(n,e,t,r)=>{t.direction==="down-in"&&n._onDepMessage(t.depIndex,e)},Je=(n,e,t,r)=>{let s=n;if(s._status==="completed"||s._status==="errored")return;let i=s._cached,a=i===void 0?[X]:[X,[y,i]];s._status==="dirty"&&a.push(D),U(e,a,s._config.tierOf)},ie=new W({onMessage:Ke,onSubscribe:Je});ve(ie);he(ie);var z=class n{_optsName;_describeKind;meta;_hasMeta;_config;_deps;_sinks=null;_sinkCount=0;_cached;_status;_cleanup;_store={};_waveHasNewData=!1;_hasNewTerminal=!1;_hasCalledFnOnce=!1;_paused=!1;_pendingWave=!1;_isExecutingFn=!1;_pendingRerun=!1;_rerunDepth=0;_dirtyDepCount=0;_batchPendingMessages=null;_pauseLocks=null;_pauseBuffer=null;_fn;_equals;_resubscribable;_resetOnTeardown;_autoComplete;_autoError;_pausable;_partial;_guard;_extraGuards;_hashFn;_versioning;_versioningLevel;_lastMutation;_inspectorHooks;_actions;constructor(e,t,r){this._config=r.config??ie,this._config.onMessage,this._optsName=r.name,this._describeKind=r.describeKind,this._equals=r.equals??Object.is,this._resubscribable=r.resubscribable??!1,this._resetOnTeardown=r.resetOnTeardown??!1,this._autoComplete=r.completeWhenDepsComplete??!0,this._autoError=r.errorWhenDepsError??!0,this._pausable=r.pausable??!0,this._guard=r.guard,this._fn=t,this._partial=r.partial??!1,this._cached=r.initial!==void 0?r.initial:void 0,this._status=e.length===0&&t==null&&this._cached!==void 0?"settled":"sentinel",this._hashFn=r.versioningHash??this._config.defaultHashFn??ne;let s=r.versioning??this._config.defaultVersioning;this._versioningLevel=s,this._versioning=s!=null?re(s,this._cached===void 0?void 0:this._cached,{id:r.versioningId,hash:this._hashFn}):void 0,this._deps=e.map(Ne);let i={};for(let[o,d]of Object.entries(r.meta??{})){let l={initial:d,name:`${r.name??"node"}:meta:${o}`,describeKind:"state",config:this._config};r.guard!=null&&(l.guard=r.guard),i[o]=new n([],void 0,l)}Object.freeze(i),this.meta=i,this._hasMeta=Object.keys(i).length>0;let a=this;this._actions={emit(o){a._emit([[y,o]])},down(o){a._emit(j(o))},up(o){a._emitUp(j(o))}},this.down=this.down.bind(this),this.up=this.up.bind(this)}get _isTerminal(){return this._status==="completed"||this._status==="errored"}get name(){return this._optsName}get status(){return this._status}get cache(){return this._cached===void 0?void 0:this._cached}get lastMutation(){return this._lastMutation}get v(){return this._versioning}hasGuard(){return this._guard!=null}_applyVersioning(e,t){if(this._isExecutingFn)throw new Error(`Node "${this.name}": _applyVersioning cannot run mid-fn \u2014 call it outside of \`_execFn\` (typically at graph setup time before the first subscribe).`);let r=this._versioningLevel;if(r!=null&&e<=r)return;let s=t?.hash??this._hashFn;s!==this._hashFn&&(this._hashFn=s);let i=this._cached===void 0?void 0:this._cached,a=this._versioning,o=a?.id??t?.id,d=a?.version??0,l=re(e,i,{id:o,hash:s});l.version=d,this._versioning=l,this._versioningLevel=e}_setInspectorHook(e){return e==null?()=>{}:(this._inspectorHooks==null&&(this._inspectorHooks=new Set),this._inspectorHooks.add(e),()=>{this._inspectorHooks?.delete(e),this._inspectorHooks?.size===0&&(this._inspectorHooks=void 0)})}_pushGuard(e){return this._extraGuards==null&&(this._extraGuards=new Set),this._extraGuards.add(e),()=>{this._extraGuards?.delete(e),this._extraGuards?.size===0&&(this._extraGuards=void 0)}}allowsObserve(e){if(this._guard==null&&this._extraGuards==null)return!0;let t=B(e);if(this._guard!=null&&!this._guard(t,"observe"))return!1;if(this._extraGuards!=null){for(let r of this._extraGuards)if(!r(t,"observe"))return!1}return!0}_checkGuard(e){if(e?.internal)return;let t=this._guard!=null||this._extraGuards!=null,r=e?.actor!=null;if(!t&&!r)return;let s=B(e?.actor),i=e?.delivery==="signal"?"signal":"write";if(this._guard!=null&&!this._guard(s,i))throw new R({actor:s,action:i,nodeName:this.name});if(this._extraGuards!=null){for(let a of this._extraGuards)if(!a(s,i))throw new R({actor:s,action:i,nodeName:this.name})}this._lastMutation={actor:s,timestamp_ns:be()}}down(e,t){let r=j(e);r.length!==0&&(this._checkGuard(t),this._emit(r))}emit(e,t){this._checkGuard(t),this._emit([[y,e]])}up(e,t){if(this._deps.length===0)return;let r=j(e);if(r.length===0)return;this._checkGuard(t);let s=t??{internal:!0};this._validateUpTiers(r);for(let i of this._deps)i.node.up?.(r,s)}_emitUp(e){if(this._deps.length!==0&&e.length!==0){this._validateUpTiers(e);for(let t of this._deps)t.node.up?.(e,{internal:!0})}}_validateUpTiers(e){let t=this._config.tierOf;for(let r of e){let s=t(r[0]);if(s===3||s===4)throw new Error(`Node "${this.name}": tier-${s} messages cannot flow up \u2014 DATA/RESOLVED/COMPLETE/ERROR are downstream-only. Use \`down(...)\` for value delivery; \`up(...)\` is for control signals (DIRTY, INVALIDATE, PAUSE, RESUME, TEARDOWN).`)}}subscribe(e,t){if(t!=null&&this._guard!=null){let d=B(t);if(!this._guard(d,"observe"))throw new R({actor:d,action:"observe",nodeName:this.name})}let s=this._isTerminal&&this._resubscribable;if(s){this._cached=void 0,this._status="sentinel",this._store={},this._hasCalledFnOnce=!1,this._waveHasNewData=!1,this._hasNewTerminal=!1,this._paused=!1,this._pendingWave=!1,this._pendingRerun=!1,this._isExecutingFn=!1,this._rerunDepth=0,this._dirtyDepCount=0,this._pauseLocks=null,this._pauseBuffer=null;for(let d of this._deps)se(d);if(this._partial===!1){for(let d of this._deps)if(d.prevData!==void 0||d.dataBatch.length!==0||d.terminal!==void 0||d.dirty)throw new Error(`resubscribable-reset invariant: DepRecord not fully reset for node ${this._optsName??"(anonymous)"}`)}}this._sinkCount+=1;let i;try{i=this._config.onSubscribe(this,e,{sinkCount:this._sinkCount,afterTerminalReset:s},this._actions)}catch(d){throw this._sinkCount-=1,d}this._sinks==null?this._sinks=e:typeof this._sinks=="function"?this._sinks=new Set([this._sinks,e]):this._sinks.add(e);let a=this._isTerminal;if(this._sinkCount===1&&!a)try{this._activate()}catch(d){if(this._sinkCount-=1,this._removeSink(e),this._sinkCount===0&&(this._status="sentinel"),typeof i=="function")try{i()}catch{}throw d}this._status==="sentinel"&&this._cached===void 0&&(this._status="pending");let o=!1;return()=>{o||(o=!0,this._sinkCount-=1,this._removeSink(e),typeof i=="function"&&i(),this._sinks==null&&this._deactivate())}}_removeSink(e){if(this._sinks===e)this._sinks=null;else if(this._sinks!=null&&typeof this._sinks!="function")if(this._sinks.delete(e),this._sinks.size===1){let[t]=this._sinks;this._sinks=t}else this._sinks.size===0&&(this._sinks=null)}_activate(){if(this._deps.length===0){this._fn&&this._execFn();return}this._dirtyDepCount=0;let e=this._deps.length,t=0;try{for(let r=0;r<e;r++){let s=r,i=this._deps[r];i.unsub=xe,i.unsub=i.node.subscribe(a=>{if(i.unsub===null)return;let o=this._config.tierOf,d=!1;for(let l of a)o(l[0])>=3&&(d=!0),this._config.onMessage(this,l,{direction:"down-in",depIndex:s},this._actions);d&&this._maybeRunFnOnSettlement()}),t++}}catch(r){this._deps[t].unsub=null;for(let s=0;s<t;s++){let i=this._deps[s];if(i.unsub!=null){let a=i.unsub;i.unsub=null;try{a()}catch{}se(i)}}throw this._dirtyDepCount=0,r}}_addDep(e){for(let s=0;s<this._deps.length;s++)if(this._deps[s].node===e)return s;let t=this._deps.length,r=Ne(e);if(this._deps.push(r),this._sinks==null)return t;r.dirty=!0,this._dirtyDepCount++,this._status!=="dirty"&&this._emit(Z),r.unsub=xe;try{r.unsub=e.subscribe(s=>{if(r.unsub===null)return;let i=this._config.tierOf,a=!1;for(let o of s)i(o[0])>=3&&(a=!0),this._config.onMessage(this,o,{direction:"down-in",depIndex:t},this._actions);a&&this._maybeRunFnOnSettlement()})}catch(s){throw r.unsub=null,this._deps.pop(),this._dirtyDepCount--,s}return t}_deactivate(e=!1){let t=this._cleanup;if(this._cleanup=void 0,typeof t=="function")try{t()}catch(r){this._emit([[f,this._wrapFnError("cleanup threw",r)]])}else if(t!=null&&typeof t=="object"){let r=t.deactivate;if(typeof r=="function")try{r()}catch(s){this._emit([[f,this._wrapFnError("cleanup.deactivate threw",s)]])}}for(let r of this._deps){if(r.unsub!=null){let s=r.unsub;r.unsub=null;try{s()}catch{}}se(r)}this._waveHasNewData=!1,this._hasNewTerminal=!1,this._hasCalledFnOnce=!1,this._paused=!1,this._pendingWave=!1,this._pendingRerun=!1,this._rerunDepth=0,this._store={},this._dirtyDepCount=0,this._pauseLocks=null,this._pauseBuffer=null,this._fn!=null&&(this._cached=void 0),e||(this._fn!=null||this._deps.length>0)&&(!this._isTerminal||this._resubscribable)&&(this._status="sentinel")}_onDepMessage(e,t){let r=this._deps[e],s=t[0];if(this._inspectorHooks!=null){let i={kind:"dep_message",depIndex:e,message:t};for(let a of this._inspectorHooks)a(i)}if(s!==G){if(s===A){this._depDirtied(r);return}if(s===M){if(this._depInvalidated(r),this._cached===void 0)return;this._emit(ce);return}if(s===S||s===H){this._emit([t]);return}if(s===N){this._emit(Q);return}if(s===y)this._depSettledAsData(r,t[1]);else if(s===E)this._depSettledAsResolved(r);else if(s===v)this._depSettledAsTerminal(r,!0);else if(s===f)this._depSettledAsTerminal(r,t[1]);else{this._emit([t]);return}if(!this._fn){(s===y||s===E)&&this._emit([t]),(s===v||s===f)&&this._maybeAutoTerminalAfterWave();return}}}_depDirtied(e){e.dirty||(e.dirty=!0,e.involvedThisWave=!0,this._dirtyDepCount++,this._status!=="dirty"&&this._emit(Z))}_depSettledAsData(e,t){e.dirty&&(e.dirty=!1,this._dirtyDepCount--),e.involvedThisWave=!0,e.dataBatch.push(t),this._waveHasNewData=!0}_depSettledAsResolved(e){e.dirty&&(e.dirty=!1,this._dirtyDepCount--)}_depSettledAsTerminal(e,t){e.dirty&&(e.dirty=!1,this._dirtyDepCount--),e.terminal=t,e.involvedThisWave=!0,this._hasNewTerminal=!0}_depInvalidated(e){e.prevData=void 0,e.terminal=void 0,e.dataBatch.length=0,e.dirty?e.involvedThisWave=!1:(e.dirty=!0,e.involvedThisWave=!0,this._dirtyDepCount++)}_maybeRunFnOnSettlement(){if(!(this._isTerminal&&!this._resubscribable)&&!(this._dirtyDepCount>0)){if(!this._partial&&!this._hasCalledFnOnce)for(let e=0;e<this._deps.length;e++){let t=this._deps[e];if(t.dataBatch.length===0&&t.prevData===void 0&&t.terminal===void 0){this._maybeAutoTerminalAfterWave();return}}if(this._paused){this._pendingWave=!0;return}if(!this._waveHasNewData&&!this._hasNewTerminal&&this._hasCalledFnOnce){this._clearWaveFlags(),this._emit(le),this._maybeAutoTerminalAfterWave();return}this._fn&&this._execFn(),this._maybeAutoTerminalAfterWave()}}_maybeAutoTerminalAfterWave(){if(this._deps.length===0||this._isTerminal)return;let e=this._deps.find(t=>t.terminal!==void 0&&t.terminal!==!0);if(e!=null){this._autoError&&this._emit([[f,e.terminal]]);return}this._autoComplete&&this._deps.every(t=>t.terminal!==void 0)&&this._emit(ue)}_execFn(){if(!this._fn||this._isTerminal&&!this._resubscribable)return;if(this._isExecutingFn){this._pendingRerun=!0;return}let e=this._cleanup;if(typeof e=="function"){this._cleanup=void 0;try{e()}catch(a){this._emit([[f,this._wrapFnError("cleanup threw",a)]]);return}}else if(e!=null&&typeof e=="object"){let a=e.beforeRun;if(typeof a=="function"){e.beforeRun=void 0;try{a()}catch(o){this._emit([[f,this._wrapFnError("cleanup.beforeRun threw",o)]]);return}}}let t=this._deps.map(a=>a.involvedThisWave?a.dataBatch.length>0?[...a.dataBatch]:[]:void 0),r=this._deps.map(a=>a.prevData);for(let a=0;a<this._deps.length;a++){let o=t[a];o!=null&&o.length>0&&(this._deps[a].prevData=o[o.length-1])}let s=this._deps.map(a=>a.terminal),i={prevData:r,terminalDeps:s,store:this._store};if(this._hasCalledFnOnce=!0,this._clearWaveFlags(),this._inspectorHooks!=null){let a={kind:"run",batchData:t,prevData:r};for(let o of this._inspectorHooks)o(a)}this._isExecutingFn=!0;try{let a=this._fn(t,this._actions,i);if(typeof a=="function")this._cleanup=a;else if(a!=null&&typeof a=="object"){let o=a;(typeof o.beforeRun=="function"||typeof o.deactivate=="function"||typeof o.invalidate=="function")&&(this._cleanup=a)}}catch(a){this._emit([[f,this._wrapFnError("fn threw",a)]])}finally{this._isExecutingFn=!1,this._pendingRerun?(this._pendingRerun=!1,this._rerunDepth+=1,this._rerunDepth>Te?(this._rerunDepth=0,this._emit([[f,new Error(`Node "${this.name}": _pendingRerun depth exceeded ${Te} \u2014 likely a reactive cycle`)]])):this._maybeRunFnOnSettlement()):this._rerunDepth=0,this._clearWaveFlags()}}_clearWaveFlags(){this._waveHasNewData=!1,this._hasNewTerminal=!1;for(let e of this._deps)e.involvedThisWave=!1,e.dataBatch.length=0}_wrapFnError(e,t){let r=t instanceof Error?t.message:String(t);return new Error(`Node "${this.name}": ${e}: ${r}`,{cause:t})}_frameBatch(e){let t=this._config.tierOf;if(e.length===1)return t(e[0][0])===3&&this._status!=="dirty"?[D,e[0]]:e;let r=!0,s=!1,i=!1,a=-1;for(let d of e){let l=t(d[0]);l<a&&(r=!1),l===3&&(s=!0),d[0]===A&&(i=!0),a=l}let o=e;if(!r){let d=e.map((l,c)=>({m:l,i:c,tier:t(l[0])}));d.sort((l,c)=>l.tier-c.tier||l.i-c.i),o=d.map(l=>l.m)}if(s&&!i&&this._status!=="dirty"){let d=0;for(;d<o.length&&t(o[d][0])===0;)d++;return d===0?[D,...o]:[...o.slice(0,d),D,...o.slice(d)]}return o}_emit(e){if(e.length===0)return;for(let o=0;o<e.length;o++){let d=e[o];if(d[0]===f&&d[1]===void 0)throw new TypeError('[ERROR, payload] requires a non-undefined payload (spec \xA71.2). Pass an Error object or domain tag instead \u2014 e.g. node.down([[ERROR, new Error("reason")]])')}let t=e;if(this._isTerminal&&!this._resubscribable){let o=e.filter(d=>d[0]===N||d[0]===M);if(o.length===0)return;t=o}t=this._frameBatch(t);let s=null;for(let o=0;o<t.length;o++){let d=t[o],l=d[0];if(l!==S&&l!==H){s?.push(d);continue}if(d.length<2)throw new Error(`Node "${this.name}": [[${l===S?"PAUSE":"RESUME"}]] must carry a lockId payload \u2014 bare PAUSE/RESUME is a protocol violation (C0 rule). Use \`[[PAUSE, lockId]]\` / \`[[RESUME, lockId]]\`.`);let c=!0;if(this._pausable!==!1){let h=d[1];if(l===S)this._pauseLocks==null&&(this._pauseLocks=new Set),this._pauseLocks.add(h),this._paused=!0,this._pausable==="resumeAll"&&this._pauseBuffer==null&&(this._pauseBuffer=[]);else if(this._pauseLocks==null||!this._pauseLocks.has(h))c=!1;else if(this._pauseLocks.delete(h),this._pauseLocks.size===0){if(this._paused=!1,this._pauseBuffer!=null&&this._pauseBuffer.length>0){let p=this._pauseBuffer;this._pauseBuffer=[],this._emit(p)}this._pendingWave&&(this._pendingWave=!1,this._maybeRunFnOnSettlement())}}c?s?.push(d):s==null&&(s=t.slice(0,o))}if(s!=null){if(s.length===0)return;t=s}if(this._hasMeta&&t.some(o=>o[0]===N))for(let o of Object.keys(this.meta))try{this.meta[o]._emit(Q)}catch{}let{finalMessages:i,equalsError:a}=this._updateState(t);if(i.length>0&&this._config.inspectorEnabled){let o=this._config.globalInspector;if(o!=null)try{o({kind:"emit",node:this,messages:i})}catch{}}if(i.length>0)if(this._paused&&this._pausable==="resumeAll"&&this._pauseBuffer!=null){let o=this._config.tierOf,d=[];for(let l of i)o(l[0])===3?this._pauseBuffer.push(l):d.push(l);d.length>0&&this._dispatchOrAccumulate(d)}else this._dispatchOrAccumulate(i);a!=null&&this._emit([[f,a]])}_updateState(e){let t=this._config.tierOf,r,s,i=-1,a=0;for(let c of e)t(c[0])===3&&a++;let o=a<=1,d=-1;if(this._versioning!=null&&a>1){for(let c=e.length-1;c>=0;c--)if(e[c][0]===y){d=c;break}}for(let c=0;c<e.length;c++){let h=e[c],p=h[0];if(p===y){if(h.length>=2){let u=!1;if(o&&this._cached!==void 0)try{u=this._equals(this._cached,h[1])}catch(_){s=this._wrapFnError("equals threw",_),i=c;break}if(u){r==null&&(r=e.slice(0,c)),r.push(J),this._status="resolved";continue}this._cached=h[1],this._versioning!=null&&(d<0||c===d)&&we(this._versioning,h[1],this._hashFn)}this._status="settled",r?.push(h)}else if(r?.push(h),p===A)this._status="dirty";else if(p===E)this._status="resolved";else if(p===v){this._status="completed";{let u=this._config.rigorRecorder;if(u!=null)try{u.onTerminalTransition(this,"completed",this._autoComplete,this._autoError,this._deps.length>0)}catch{}}}else if(p===f){this._status="errored";{let u=this._config.rigorRecorder;if(u!=null)try{u.onTerminalTransition(this,"errored",this._autoComplete,this._autoError,this._deps.length>0)}catch{}}}else if(p===M){if(this._cached!==void 0){let _=this._config.rigorRecorder;if(_!=null)try{_.onNonVacuousInvalidate(this,this._cached)}catch{}}this._cached=void 0,this._status="dirty";let u=this._cleanup;if(typeof u=="function"){this._cleanup=void 0;try{u()}catch{}}else if(u!=null&&typeof u=="object"){let _=u.invalidate;if(typeof _=="function")try{_()}catch{}}}else p===N&&(this._resetOnTeardown&&(this._cached=void 0),this._deactivate(!0),this._status="sentinel")}let l=i>=0?r??e.slice(0,i):r??e;return s!=null?{finalMessages:l,equalsError:s}:{finalMessages:l}}_deliverToSinks=e=>{if(this._sinks==null)return;if(typeof this._sinks=="function"){this._sinks(e);return}let t=[...this._sinks];for(let r of t)r(e)};_dispatchOrAccumulate(e){if(ye()){this._batchPendingMessages===null&&(this._batchPendingMessages=[],me(()=>this._flushBatchPending()));for(let t of e)this._batchPendingMessages.push(t);return}U(this._deliverToSinks,e,this._config.tierOf)}_flushBatchPending(){let e=this._batchPendingMessages;if(e===null||(this._batchPendingMessages=null,e.length===0))return;let t=this._frameBatch(e);U(this._deliverToSinks,t,this._config.tierOf)}},ke=n=>Array.isArray(n),oe=n=>typeof n=="object"&&n!=null&&!Array.isArray(n);function Ae(n,e,t){let r=ke(n)?n:[],s=typeof n=="function"?n:typeof e=="function"?e:void 0,i={};return ke(n)?i=(oe(e)?e:t)??{}:oe(n)?i=n:i=(oe(e)?e:t)??{},new z(r,s,i)}function ae(n,e){return Ae((r,s,i)=>n(s,i)??void 0,{describeKind:"producer",...e})}function Ee(n){return ae(e=>{let t=!1,r=()=>{n.onsuccess=null,n.onerror=null};return n.onsuccess=()=>{t||(t=!0,r(),e.down([[y,n.result],[v]]))},n.onerror=()=>{t||(t=!0,r(),e.down([[f,n.error??new Error("IndexedDB request failed")]]))},()=>{t=!0,r()}})}function Me(n){return ae(e=>{let t=!1,r=()=>{n.oncomplete=null,n.onerror=null,n.onabort=null};return n.oncomplete=()=>{t||(t=!0,r(),e.down([[y,void 0],[v]]))},n.onerror=()=>{t||(t=!0,r(),e.down([[f,n.error??new Error("IndexedDB transaction failed")]]))},n.onabort=()=>{t||(t=!0,r(),e.down([[f,n.error??new Error("IndexedDB transaction aborted")]]))},()=>{t=!0,r()}})}function Xe(n,e,t){return new Promise((r,s)=>{if(typeof indexedDB>"u"){s(new TypeError("indexedDB is not available in this environment"));return}let i=indexedDB.open(n,t);i.onupgradeneeded=()=>{let a=i.result;a.objectStoreNames.contains(e)||a.createObjectStore(e)},i.onsuccess=()=>r(i.result),i.onerror=()=>s(i.error??new Error("IndexedDB open failed"))})}function de(n,e,t,r,s){return Xe(n,e,t).then(i=>new Promise((a,o)=>{let d=i.transaction(e,r),l=d.objectStore(e),c=s(l),h,p=!1,u=!1,_=()=>{!p||!u||(i.close(),a(h))};c.onsuccess=()=>{h=c.result,p=!0,_()},c.onerror=()=>{i.close(),o(c.error??new Error("IndexedDB request failed"))},d.oncomplete=()=>{if(u=!0,!p){i.close(),o(new Error("IndexedDB transaction completed without request result"));return}_()},d.onerror=()=>{i.close(),o(d.error??new Error("IndexedDB transaction failed"))},d.onabort=()=>{i.close(),o(d.error??new Error("IndexedDB transaction aborted"))}}))}function Se(n){let{dbName:e,storeName:t}=n,r=n.version??1,s=n.key??"graphrefly_checkpoint";return{async save(i,a){await de(e,t,r,"readwrite",o=>o.put(a,s))},async load(i){let a=await de(e,t,r,"readonly",o=>o.get(s));return a==null||typeof a!="object"||Array.isArray(a)?null:a},async clear(i){await de(e,t,r,"readwrite",a=>a.delete(s))}}}0&&(module.exports={fromIDBRequest,fromIDBTransaction,indexedDbStorage});
@@ -1,3 +1,3 @@
1
1
  export { IndexedDbStorageSpec, fromIDBRequest, fromIDBTransaction, indexedDbStorage } from './storage-browser.cjs';
2
- import '../node-BVV7G1bq.cjs';
2
+ import '../node-8qx0kgYt.cjs';
3
3
  import './storage-core.cjs';
@@ -1,3 +1,3 @@
1
1
  export { IndexedDbStorageSpec, fromIDBRequest, fromIDBTransaction, indexedDbStorage } from './storage-browser.js';
2
- import '../node-BVV7G1bq.js';
2
+ import '../node-8qx0kgYt.js';
3
3
  import './storage-core.js';
@@ -1 +1 @@
1
- import{a as e,b as o,c as r}from"../chunk-Q2SY7M7K.js";import"../chunk-7AJKUA36.js";import"../chunk-CK2E7BTU.js";import"../chunk-QYADASLV.js";export{e as fromIDBRequest,o as fromIDBTransaction,r as indexedDbStorage};
1
+ import{a as e,b as o,c as r}from"../chunk-IJFSR4NU.js";import"../chunk-LYCLF26R.js";import"../chunk-CK2E7BTU.js";import"../chunk-QYADASLV.js";export{e as fromIDBRequest,o as fromIDBTransaction,r as indexedDbStorage};