@graphrefly/graphrefly 0.28.0 → 0.30.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 (284) hide show
  1. package/dist/{cascading-D9WG1-9L.d.ts → cascading-BszPheHD.d.ts} +1 -1
  2. package/dist/{cascading-B-5zmAUv.d.cts → cascading-dNCtjW8j.d.cts} +1 -1
  3. package/dist/{chunk-OAWLCNJJ.js → chunk-2GQREQ6C.js} +1 -1
  4. package/dist/{chunk-DBGGMN3D.js → chunk-33FA6V4B.js} +1 -1
  5. package/dist/chunk-3NEPQO2E.js +43 -0
  6. package/dist/{chunk-UWJE5FQA.js → chunk-4C2OR2GH.js} +11 -11
  7. package/dist/chunk-4JJCCD5S.js +2 -0
  8. package/dist/{chunk-GHJJR5P4.js → chunk-4OFIQ66T.js} +1 -1
  9. package/dist/{chunk-PIOGHC63.js → chunk-567NWZ3T.js} +1 -1
  10. package/dist/chunk-5JDE5JHE.js +1 -0
  11. package/dist/{chunk-ETWTCCJI.js → chunk-5Z4HDCO6.js} +1 -1
  12. package/dist/{chunk-Y2EMPB3I.js → chunk-73Z3W2RN.js} +1 -1
  13. package/dist/{chunk-CRXTH3SH.js → chunk-7JDLFI6N.js} +1 -1
  14. package/dist/{chunk-DQA3UIQ2.js → chunk-7TDOES3L.js} +1 -1
  15. package/dist/{chunk-LBTDSCCO.js → chunk-AMBYCIOH.js} +1 -1
  16. package/dist/{chunk-D7A7DBE4.js → chunk-AUY2YKCO.js} +1 -1
  17. package/dist/{chunk-FNYWM6JC.js → chunk-AV3PIDFQ.js} +1 -1
  18. package/dist/{chunk-UMBIDLJ4.js → chunk-BA5URFYW.js} +1 -1
  19. package/dist/chunk-BKPLTBL5.js +1 -0
  20. package/dist/{chunk-UPXUCFMX.js → chunk-BZP5T4X6.js} +1 -1
  21. package/dist/{chunk-WQ2BN6X6.js → chunk-DDPYNMGG.js} +1 -1
  22. package/dist/{chunk-LQ3Y5NJS.js → chunk-GJR3P6JG.js} +1 -1
  23. package/dist/{chunk-3R5HFPX7.js → chunk-GLSM33ZM.js} +1 -1
  24. package/dist/{chunk-2FOAM3OR.js → chunk-GNCBXARM.js} +1 -1
  25. package/dist/{chunk-K2GNMCQT.js → chunk-ISCENNXS.js} +1 -1
  26. package/dist/{chunk-UPHHLMHE.js → chunk-IUK4EFCE.js} +1 -1
  27. package/dist/{chunk-ERLIRFPA.js → chunk-KA6MMXIY.js} +1 -1
  28. package/dist/{chunk-2PMCKKRK.js → chunk-KASHOCF5.js} +1 -1
  29. package/dist/chunk-LI3E75VE.js +64 -0
  30. package/dist/chunk-MGKAO4EK.js +7 -0
  31. package/dist/{chunk-ZV2DXV5A.js → chunk-NSG4C6BF.js} +1 -1
  32. package/dist/{chunk-4GKB4OUJ.js → chunk-OL33ZI6R.js} +1 -1
  33. package/dist/{chunk-76A3HVQE.js → chunk-P7JXGKDO.js} +1 -1
  34. package/dist/{chunk-U3AICJKU.js → chunk-RD52SNH2.js} +1 -1
  35. package/dist/{chunk-CWLN3X3N.js → chunk-SHYH5SXV.js} +1 -1
  36. package/dist/{chunk-VTPVOGHH.js → chunk-SLMYTGTU.js} +1 -1
  37. package/dist/{chunk-OYHGKYQM.js → chunk-T5SHIKJD.js} +1 -1
  38. package/dist/{chunk-VPYBOXVT.js → chunk-TWMEGG45.js} +1 -1
  39. package/dist/chunk-VIEUJSTT.js +1 -0
  40. package/dist/{chunk-SC3U7ETD.js → chunk-VWPRPPKR.js} +1 -1
  41. package/dist/chunk-W4TSQ6RJ.js +1 -0
  42. package/dist/{chunk-OBKQQA5I.js → chunk-WANIEEKV.js} +1 -1
  43. package/dist/{chunk-XAUNPIMX.js → chunk-XHVB6G6M.js} +1 -1
  44. package/dist/{chunk-MIQTDPY4.js → chunk-XQAXYVXX.js} +1 -1
  45. package/dist/{chunk-MTTAAPCK.js → chunk-Y32RJO24.js} +1 -1
  46. package/dist/{chunk-S35VARIR.js → chunk-Y36UZ5VS.js} +1 -1
  47. package/dist/compat/index.cjs +13 -12
  48. package/dist/compat/index.d.cts +14 -14
  49. package/dist/compat/index.d.ts +14 -14
  50. package/dist/compat/index.js +1 -1
  51. package/dist/compat/jotai/index.cjs +1 -1
  52. package/dist/compat/jotai/index.d.cts +2 -2
  53. package/dist/compat/jotai/index.d.ts +2 -2
  54. package/dist/compat/jotai/index.js +1 -1
  55. package/dist/compat/nanostores/index.cjs +1 -1
  56. package/dist/compat/nanostores/index.d.cts +2 -2
  57. package/dist/compat/nanostores/index.d.ts +2 -2
  58. package/dist/compat/nanostores/index.js +1 -1
  59. package/dist/compat/nestjs/index.cjs +13 -12
  60. package/dist/compat/nestjs/index.d.cts +6 -6
  61. package/dist/compat/nestjs/index.d.ts +6 -6
  62. package/dist/compat/nestjs/index.js +1 -1
  63. package/dist/compat/react/index.d.cts +2 -2
  64. package/dist/compat/react/index.d.ts +2 -2
  65. package/dist/compat/solid/index.d.cts +2 -2
  66. package/dist/compat/solid/index.d.ts +2 -2
  67. package/dist/compat/svelte/index.d.cts +2 -2
  68. package/dist/compat/svelte/index.d.ts +2 -2
  69. package/dist/compat/vue/index.d.cts +2 -2
  70. package/dist/compat/vue/index.d.ts +2 -2
  71. package/dist/compat/zustand/index.cjs +7 -6
  72. package/dist/compat/zustand/index.d.cts +4 -4
  73. package/dist/compat/zustand/index.d.ts +4 -4
  74. package/dist/compat/zustand/index.js +1 -1
  75. package/dist/{composite-BhbKHbOS.d.ts → composite-DGspwCqk.d.ts} +2 -2
  76. package/dist/{composite-B-xqw4Kk.d.cts → composite-nrRumJ7l.d.cts} +2 -2
  77. package/dist/core/index.cjs +1 -1
  78. package/dist/core/index.d.cts +4 -4
  79. package/dist/core/index.d.ts +4 -4
  80. package/dist/core/index.js +1 -1
  81. package/dist/extra/browser.cjs +1 -1
  82. package/dist/extra/browser.d.cts +1 -1
  83. package/dist/extra/browser.d.ts +1 -1
  84. package/dist/extra/browser.js +1 -1
  85. package/dist/extra/index.cjs +20 -19
  86. package/dist/extra/index.d.cts +9 -9
  87. package/dist/extra/index.d.ts +9 -9
  88. package/dist/extra/index.js +1 -1
  89. package/dist/extra/node.cjs +3 -3
  90. package/dist/extra/node.d.cts +1 -1
  91. package/dist/extra/node.d.ts +1 -1
  92. package/dist/extra/node.js +1 -1
  93. package/dist/extra/operators.cjs +1 -1
  94. package/dist/extra/operators.d.cts +1 -1
  95. package/dist/extra/operators.d.ts +1 -1
  96. package/dist/extra/operators.js +1 -1
  97. package/dist/extra/reactive.cjs +1 -1
  98. package/dist/extra/reactive.d.cts +3 -3
  99. package/dist/extra/reactive.d.ts +3 -3
  100. package/dist/extra/reactive.js +1 -1
  101. package/dist/extra/sources.cjs +1 -1
  102. package/dist/extra/sources.d.cts +1 -1
  103. package/dist/extra/sources.d.ts +1 -1
  104. package/dist/extra/sources.js +1 -1
  105. package/dist/extra/storage-browser.cjs +1 -1
  106. package/dist/extra/storage-browser.d.cts +1 -1
  107. package/dist/extra/storage-browser.d.ts +1 -1
  108. package/dist/extra/storage-browser.js +1 -1
  109. package/dist/graph/index.cjs +7 -6
  110. package/dist/graph/index.d.cts +5 -5
  111. package/dist/graph/index.d.ts +5 -5
  112. package/dist/graph/index.js +1 -1
  113. package/dist/{graph-D48Qw9Cg.d.cts → graph-C4Uxwv0T.d.cts} +22 -6
  114. package/dist/{graph-BZGRXwOm.d.ts → graph-CWeI0aHd.d.ts} +22 -6
  115. package/dist/{index-u15meRxL.d.cts → index-9iguV3bF.d.cts} +2 -2
  116. package/dist/{index-DyxjtScX.d.cts → index-B-z8WaSd.d.cts} +2 -2
  117. package/dist/{index-BgyGlizc.d.ts → index-B2HBxvMb.d.ts} +4 -4
  118. package/dist/{index-CzobVSMr.d.ts → index-B5iVOD7w.d.ts} +2 -2
  119. package/dist/{index-rX8HBM5h.d.cts → index-B8Aj_z8S.d.cts} +2 -2
  120. package/dist/{index-D-YB-Vl3.d.ts → index-BANwzwBV.d.ts} +3 -3
  121. package/dist/{index-HDpJe9hX.d.ts → index-BBINVimG.d.ts} +3 -3
  122. package/dist/{index-8FSVk4Uf.d.ts → index-BEpRsvhg.d.ts} +4 -4
  123. package/dist/{index-CHEswufn.d.cts → index-BHu_Wba0.d.cts} +4 -4
  124. package/dist/{index-ZftwfxJM.d.ts → index-BJHQUCZx.d.ts} +7 -7
  125. package/dist/{index-DUqMOlKZ.d.cts → index-BS220yqj.d.cts} +7 -7
  126. package/dist/{index-BWJV63ti.d.ts → index-BX22kvjh.d.ts} +1 -1
  127. package/dist/{index-DfyOkTvs.d.ts → index-BXbQUn4n.d.ts} +2 -2
  128. package/dist/{index-O6TgGUBV.d.cts → index-BpFWP7Bq.d.cts} +3 -3
  129. package/dist/{index-BxJ86YZZ.d.cts → index-Bs3-LC83.d.cts} +3 -3
  130. package/dist/{index-DiOXyAwt.d.ts → index-Bvi5uJxX.d.ts} +1 -1
  131. package/dist/{index-Bqachn9_.d.ts → index-ByPnK85n.d.ts} +1 -1
  132. package/dist/{index-CRO83MmV.d.cts → index-BydMDMf7.d.cts} +1 -1
  133. package/dist/{index-ROpQmGjE.d.ts → index-C5Ghnp5B.d.ts} +3 -3
  134. package/dist/{index-umtoWT8K.d.ts → index-C6NBfXj-.d.ts} +6 -5
  135. package/dist/{index-pXrDMpRO.d.cts → index-C98oJsEs.d.cts} +2 -2
  136. package/dist/{index-B2pwesl9.d.cts → index-CDK5RsV5.d.cts} +1 -1
  137. package/dist/{index-Czq6ynh8.d.ts → index-CFW32Dy1.d.ts} +3 -3
  138. package/dist/{index-Cyojz0AE.d.cts → index-CIXaiYDE.d.cts} +1 -1
  139. package/dist/{index-Oi8d8w4R.d.cts → index-CRAkoq-y.d.cts} +1 -1
  140. package/dist/{index-CpgYhnrG.d.ts → index-Cc8VQIgL.d.ts} +2 -2
  141. package/dist/{index-vscRDkjW.d.cts → index-CcpEvuPl.d.cts} +2 -2
  142. package/dist/{index-BpA5c4G9.d.ts → index-CfFYyLR8.d.ts} +4 -4
  143. package/dist/{index-9oDeHH2u.d.cts → index-ClB7TCfL.d.cts} +2 -2
  144. package/dist/{index-BHvIquRZ.d.ts → index-ClgKmOHe.d.ts} +592 -492
  145. package/dist/{index-DpHe5e0Q.d.ts → index-CotRMjtJ.d.ts} +2 -2
  146. package/dist/{index-B1AmmSlb.d.ts → index-CrC7urhX.d.ts} +1 -1
  147. package/dist/{index-B0c4cmIO.d.ts → index-CvS9IuTG.d.ts} +2 -2
  148. package/dist/{index-rHJSKsU8.d.cts → index-Cy7eFeIX.d.cts} +2 -2
  149. package/dist/{index-BVHOrDwO.d.ts → index-D0C_USMR.d.ts} +1 -1
  150. package/dist/{index-DEwTb_fm.d.cts → index-D6ajK8Mh.d.cts} +592 -492
  151. package/dist/{index-DL-rYJrx.d.cts → index-D7XxY1Ff.d.cts} +1 -1
  152. package/dist/{index-DAlweici.d.ts → index-D9HrBx2J.d.ts} +2 -2
  153. package/dist/{index-fM6y00vT.d.cts → index-D9Y_u6BG.d.cts} +3 -3
  154. package/dist/{index-DcXZBF5a.d.cts → index-DBQUKh59.d.cts} +4 -4
  155. package/dist/{index-D_NwnRYS.d.cts → index-DDo-eqQ4.d.cts} +1 -1
  156. package/dist/{index-m-yHof5p.d.ts → index-DGb1awva.d.ts} +4 -4
  157. package/dist/{index-DxsnAMWD.d.cts → index-DR3gf_DG.d.cts} +9 -9
  158. package/dist/{index-dtN7YA2x.d.cts → index-DVNLe3pS.d.cts} +3 -3
  159. package/dist/{index-Btib9rsU.d.ts → index-Dljd76bC.d.ts} +275 -9
  160. package/dist/{index-DP4ZTkdw.d.ts → index-DnrZghBB.d.ts} +3 -3
  161. package/dist/{index-DaLJvH8Z.d.ts → index-Docdiu9a.d.ts} +3 -3
  162. package/dist/{index-BpIFjILY.d.cts → index-DylQCKEL.d.cts} +4 -4
  163. package/dist/{index-B_agccPe.d.cts → index-FBqTfL_S.d.cts} +1 -1
  164. package/dist/{index-DraikLjn.d.ts → index-FrYrV-Vf.d.ts} +2 -2
  165. package/dist/{index-sm373fsH.d.ts → index-IZ3l_vQ9.d.ts} +2 -2
  166. package/dist/{index-BwM9BEkt.d.ts → index-Ip3q9T9x.d.ts} +1 -1
  167. package/dist/{index-CloUk1kY.d.ts → index-RQg6lTrN.d.ts} +9 -9
  168. package/dist/{index-CEXXwWVH.d.cts → index-SSGqF8mI.d.cts} +2 -2
  169. package/dist/{index-rnwQly8X.d.cts → index-UZO988ox.d.cts} +6 -5
  170. package/dist/{index-C73n7lo-.d.cts → index-iBp74eGU.d.cts} +3 -3
  171. package/dist/{index-tbf2gKHd.d.cts → index-lKuLYmHO.d.cts} +3 -3
  172. package/dist/{index-CMn8S8Hw.d.ts → index-wIx1Jisk.d.ts} +1 -1
  173. package/dist/{index-cByzxQIC.d.cts → index-yIdWFo2b.d.cts} +4 -4
  174. package/dist/{index-RukJ4DLS.d.cts → index-ybtSyjWB.d.cts} +275 -9
  175. package/dist/index.cjs +53 -52
  176. package/dist/index.d.cts +42 -42
  177. package/dist/index.d.ts +42 -42
  178. package/dist/index.js +1 -1
  179. package/dist/{meta-CwesDrMD.d.ts → meta-BMwx3ExI.d.ts} +1 -1
  180. package/dist/{meta-Cgj6zeji.d.cts → meta-COtmHLwT.d.cts} +1 -1
  181. package/dist/{node-Cc1TniY8.d.ts → node-BVV7G1bq.d.cts} +59 -2
  182. package/dist/{node-Cc1TniY8.d.cts → node-BVV7G1bq.d.ts} +59 -2
  183. package/dist/{observable-glXQoGj2.d.cts → observable-BrUAPeH_.d.cts} +1 -1
  184. package/dist/{observable-Ct-gJ9jI.d.ts → observable-ITikPXz3.d.ts} +1 -1
  185. package/dist/patterns/ai/browser.d.cts +3 -3
  186. package/dist/patterns/ai/browser.d.ts +3 -3
  187. package/dist/patterns/ai/browser.js +1 -1
  188. package/dist/patterns/ai/index.cjs +25 -24
  189. package/dist/patterns/ai/index.d.cts +15 -15
  190. package/dist/patterns/ai/index.d.ts +15 -15
  191. package/dist/patterns/ai/index.js +1 -1
  192. package/dist/patterns/ai/node.d.cts +1 -1
  193. package/dist/patterns/ai/node.d.ts +1 -1
  194. package/dist/patterns/ai/node.js +1 -1
  195. package/dist/patterns/audit/index.cjs +7 -6
  196. package/dist/patterns/audit/index.d.cts +5 -5
  197. package/dist/patterns/audit/index.d.ts +5 -5
  198. package/dist/patterns/audit/index.js +1 -1
  199. package/dist/patterns/cqrs/index.cjs +7 -6
  200. package/dist/patterns/cqrs/index.d.cts +4 -4
  201. package/dist/patterns/cqrs/index.d.ts +4 -4
  202. package/dist/patterns/cqrs/index.js +1 -1
  203. package/dist/patterns/demo-shell/index.cjs +8 -7
  204. package/dist/patterns/demo-shell/index.d.cts +5 -5
  205. package/dist/patterns/demo-shell/index.d.ts +5 -5
  206. package/dist/patterns/demo-shell/index.js +1 -1
  207. package/dist/patterns/domain-templates/index.cjs +7 -6
  208. package/dist/patterns/domain-templates/index.d.cts +4 -4
  209. package/dist/patterns/domain-templates/index.d.ts +4 -4
  210. package/dist/patterns/domain-templates/index.js +1 -1
  211. package/dist/patterns/graphspec/index.cjs +26 -25
  212. package/dist/patterns/graphspec/index.d.cts +4 -4
  213. package/dist/patterns/graphspec/index.d.ts +4 -4
  214. package/dist/patterns/graphspec/index.js +1 -1
  215. package/dist/patterns/guarded-execution/index.cjs +7 -6
  216. package/dist/patterns/guarded-execution/index.d.cts +6 -6
  217. package/dist/patterns/guarded-execution/index.d.ts +6 -6
  218. package/dist/patterns/guarded-execution/index.js +1 -1
  219. package/dist/patterns/harness/index.cjs +11 -10
  220. package/dist/patterns/harness/index.d.cts +10 -7
  221. package/dist/patterns/harness/index.d.ts +10 -7
  222. package/dist/patterns/harness/index.js +1 -1
  223. package/dist/patterns/job-queue/index.cjs +7 -6
  224. package/dist/patterns/job-queue/index.d.cts +4 -4
  225. package/dist/patterns/job-queue/index.d.ts +4 -4
  226. package/dist/patterns/job-queue/index.js +1 -1
  227. package/dist/patterns/lens/index.cjs +7 -6
  228. package/dist/patterns/lens/index.d.cts +6 -6
  229. package/dist/patterns/lens/index.d.ts +6 -6
  230. package/dist/patterns/lens/index.js +1 -1
  231. package/dist/patterns/memory/index.cjs +7 -6
  232. package/dist/patterns/memory/index.d.cts +4 -4
  233. package/dist/patterns/memory/index.d.ts +4 -4
  234. package/dist/patterns/memory/index.js +1 -1
  235. package/dist/patterns/messaging/index.cjs +7 -6
  236. package/dist/patterns/messaging/index.d.cts +4 -4
  237. package/dist/patterns/messaging/index.d.ts +4 -4
  238. package/dist/patterns/messaging/index.js +1 -1
  239. package/dist/patterns/orchestration/index.cjs +7 -6
  240. package/dist/patterns/orchestration/index.d.cts +5 -5
  241. package/dist/patterns/orchestration/index.d.ts +5 -5
  242. package/dist/patterns/orchestration/index.js +1 -1
  243. package/dist/patterns/reactive-layout/index.cjs +8 -7
  244. package/dist/patterns/reactive-layout/index.d.cts +5 -5
  245. package/dist/patterns/reactive-layout/index.d.ts +5 -5
  246. package/dist/patterns/reactive-layout/index.js +1 -1
  247. package/dist/patterns/reduction/index.cjs +7 -6
  248. package/dist/patterns/reduction/index.d.cts +4 -4
  249. package/dist/patterns/reduction/index.d.ts +4 -4
  250. package/dist/patterns/reduction/index.js +1 -1
  251. package/dist/patterns/refine-loop/index.cjs +9 -8
  252. package/dist/patterns/refine-loop/index.d.cts +5 -5
  253. package/dist/patterns/refine-loop/index.d.ts +5 -5
  254. package/dist/patterns/refine-loop/index.js +1 -1
  255. package/dist/patterns/resilient-pipeline/index.cjs +1 -1
  256. package/dist/patterns/resilient-pipeline/index.d.cts +6 -6
  257. package/dist/patterns/resilient-pipeline/index.d.ts +6 -6
  258. package/dist/patterns/resilient-pipeline/index.js +1 -1
  259. package/dist/patterns/surface/index.cjs +14 -13
  260. package/dist/patterns/surface/index.d.cts +5 -5
  261. package/dist/patterns/surface/index.d.ts +5 -5
  262. package/dist/patterns/surface/index.js +1 -1
  263. package/dist/{reactive-layout-CpYb5qLP.d.cts → reactive-layout-5oEn8lHM.d.cts} +2 -2
  264. package/dist/{reactive-layout-D8u4wuUR.d.ts → reactive-layout-BAr6-_o5.d.ts} +2 -2
  265. package/dist/{reactive-log-DPzuUDj5.d.cts → reactive-log-5jFeNRmd.d.cts} +1 -1
  266. package/dist/{reactive-log-YuH9VYN8.d.ts → reactive-log-BOJDCI5x.d.ts} +1 -1
  267. package/dist/{reactive-map-CdbNoSgP.d.ts → reactive-map-BvDrRuwt.d.ts} +1 -1
  268. package/dist/{reactive-map-DUeRmb9d.d.cts → reactive-map-CmlPPKHN.d.cts} +1 -1
  269. package/dist/{resilience-CGRzhnD3.d.ts → resilience-CludlzcP.d.ts} +1 -1
  270. package/dist/{resilience-Ba5-b4WD.d.cts → resilience-Q6Bt_7y0.d.cts} +1 -1
  271. package/dist/{resilience-QAHKANT5.js → resilience-XRUF267O.js} +1 -1
  272. package/dist/{sugar-BV0htudb.d.cts → sugar-BHbAACDG.d.ts} +10 -12
  273. package/dist/{sugar-Dtyrq2_q.d.ts → sugar-CqR6DJ7v.d.cts} +10 -12
  274. package/dist/{topology-tree-DROUdq5B.d.cts → topology-tree-CVREibAc.d.cts} +1 -1
  275. package/dist/{topology-tree-CYHOwQZ_.d.ts → topology-tree-CkjojcB6.d.ts} +1 -1
  276. package/package.json +1 -1
  277. package/dist/chunk-6V3SEX2I.js +0 -1
  278. package/dist/chunk-7H6LGFUG.js +0 -64
  279. package/dist/chunk-CKCSDI7T.js +0 -6
  280. package/dist/chunk-QWAPKG3O.js +0 -2
  281. package/dist/chunk-RHESUC3V.js +0 -43
  282. package/dist/chunk-V6YQICXZ.js +0 -1
  283. package/dist/chunk-Z4HDAS2Q.js +0 -1
  284. package/dist/chunk-ZB5EHBIO.js +0 -1
@@ -1,43 +0,0 @@
1
- import{C as U}from"./chunk-7H6LGFUG.js";import{a as le}from"./chunk-GHJJR5P4.js";import{e as de}from"./chunk-SC3U7ETD.js";import{a as $}from"./chunk-DBGGMN3D.js";import{b as V,d as q}from"./chunk-ETWTCCJI.js";import{f as ae,j as H}from"./chunk-CKCSDI7T.js";import{q as P,r as ie,v as ue}from"./chunk-Z4HDAS2Q.js";import{b as ce}from"./chunk-OAWLCNJJ.js";import{m as se}from"./chunk-2PMCKKRK.js";import{D as oe,E as M,G as O,H as w,o as A}from"./chunk-ZB5EHBIO.js";import{b as Te}from"./chunk-QYADASLV.js";var $e={};Te($e,{DEFAULT_DECAY_RATE:()=>K,DEFAULT_QUEUE_CONFIGS:()=>W,DEFAULT_SEVERITY_WEIGHTS:()=>Y,HarnessGraph:()=>F,QUEUE_NAMES:()=>x,affectedTaskFilter:()=>be,beforeAfterCompare:()=>xe,codeChangeBridge:()=>Ie,createIntakeBridge:()=>Ee,defaultErrorClassifier:()=>J,evalIntakeBridge:()=>ke,evalSource:()=>Re,harnessLoop:()=>_e,harnessProfile:()=>Ge,harnessTrace:()=>Me,notifyEffect:()=>Ne,priorityScore:()=>Se,strategyKey:()=>j,strategyModel:()=>z});function Ee(t,e,n,a){return w([t],([i])=>{if(i==null)return;let f=n(i);for(let o of f)e.publish(o)},{name:a?.name??"intake-bridge"})}function ke(t,e,n){let a=n?.defaultSeverity??"medium";return w([t],([i])=>{if(i==null)return;let f=Array.isArray(i)?i:[i];for(let o of f)for(let r of o.tasks)if(!(r.valid&&r.judge_scores?.every(s=>s.pass))){if(!r.valid&&(!r.judge_scores||r.judge_scores.length===0)){e.publish({source:"eval",summary:`Task ${r.task_id} invalid (model: ${o.model})`,evidence:`Run ${o.run_id}: task produced invalid output`,affectsAreas:["graphspec"],affectsEvalTasks:[r.task_id],severity:a});continue}if(r.judge_scores)for(let s of r.judge_scores)s.pass||e.publish({source:"eval",summary:`${r.task_id}: ${s.claim} (model: ${o.model})`,evidence:s.reasoning,affectsAreas:["graphspec"],affectsEvalTasks:[r.task_id],severity:a})}},{name:n?.name??"eval-intake-bridge"})}function Re(t,e){return ue(t,()=>se(e()))}function xe(t,e){return O([t,e],([n,a])=>{let i=n,f=a,o=new Map(i.tasks.map(c=>[c.task_id,c])),r=new Map(f.tasks.map(c=>[c.task_id,c])),s=new Set([...o.keys(),...r.keys()]),u=[],p=[],d=[];for(let c of s){let g=o.get(c),b=r.get(c),k=g?.valid??!1,T=b?.valid??!1,E=g?.judge_scores?g.judge_scores.filter(C=>C.pass).length:void 0,R=b?.judge_scores?b.judge_scores.filter(C=>C.pass).length:void 0,I=E!==void 0&&R!==void 0?R-E:void 0;u.push({taskId:c,before:k,after:T,scoreDiff:I}),k&&!T&&p.push(c),!k&&T&&d.push(c)}return{newFailures:p,resolved:d,taskDeltas:u,overallImproved:d.length>p.length}},{name:"eval-delta"})}function be(t,e){let n=e==null?null:Array.isArray(e)?M(e):e,a=[t];return n&&a.push(n),O(a,i=>{let f=i[0],o=n?new Set(i[1]):null,r=new Set;for(let s of f)for(let u of s.affectsEvalTasks??[])(o==null||o.has(u))&&r.add(u);return[...r].sort()},{name:"affected-task-filter"})}function Ie(t,e,n,a){let i=a?.defaultSeverity??"high";function f(r){let s=[];for(let u of r.lintErrors??[])s.push({source:"code-change",summary:`Lint: ${u.rule} in ${u.file}:${u.line}`,evidence:u.message,affectsAreas:[u.file],severity:i});for(let u of r.testFailures??[])s.push({source:"test",summary:`Test failure: ${u.testId}`,evidence:u.message,affectsAreas:[u.file],affectsEvalTasks:[u.testId],severity:i});return s}let o=n??f;return w([t],([r])=>{if(r!=null)for(let s of o(r))e.publish(s)},{name:a?.name??"code-change-bridge"})}function Ne(t,e,n){return w([t.latest],([a])=>{a!=null&&e(a)},{name:n?.name??"notify-effect"})}var x=["auto-fix","needs-decision","investigation","backlog"];function j(t,e){return`${t}\u2192${e}`}function J(t){let e=t.detail.toLowerCase();return e.includes("parse")||e.includes("json")||e.includes("config")||e.includes("validation")||e.includes("syntax")?"self-correctable":"structural"}var Y={critical:100,high:70,medium:40,low:10},K=Math.LN2/(168*3600),W={"auto-fix":{gated:!1},"needs-decision":{gated:!0},investigation:{gated:!0},backlog:{gated:!1,startOpen:!1}};function z(){let t=ce({name:"strategy-entries"}),e=O([t.entries],([o])=>{let r=o;return new Map(r)},{name:"strategy-model",equals:(o,r)=>{let s=o,u=r;if(s.size!==u.size)return!1;for(let[p,d]of s){let c=u.get(p);if(!c||d.attempts!==c.attempts||d.successes!==c.successes)return!1}return!0}});function n(o,r,s){let u=j(o,r),p=t.get(u),d=(p?.attempts??0)+1,c=(p?.successes??0)+(s?1:0);t.set(u,{rootCause:o,intervention:r,attempts:d,successes:c,successRate:c/d})}function a(o,r){return t.get(j(o,r))}let i=e.subscribe(()=>{});function f(){i()}return{node:e,record:n,lookup:a,dispose:f}}function Se(t,e,n,a,i){let f={...Y,...i?.severityWeights},o=i?.decayRate??K,r=i?.effectivenessThreshold??.7,s=i?.effectivenessBoost??15,u=[t,e,n];return a&&u.push(a),O(u,p=>{let d=p[0],c=p[1],g=p[2],b=a?p[3]:0,k=f[d.severity??"medium"],T=(A()-g)/1e9,E=le(k,T,o,0),R=j(d.rootCause,d.intervention),I=c.get(R);return I&&I.successRate>=r&&(E+=s),E+=b*20,E},{name:"priority-score"})}var we=`You are a triage classifier for a reactive collaboration harness.
2
-
3
- Given an intake item, classify it and output JSON:
4
- {
5
- "rootCause": "composition" | "missing-fn" | "bad-docs" | "schema-gap" | "regression" | "unknown",
6
- "intervention": "template" | "catalog-fn" | "docs" | "wrapper" | "schema-change" | "investigate",
7
- "route": "auto-fix" | "needs-decision" | "investigation" | "backlog",
8
- "priority": <number 0-100>,
9
- "triageReasoning": "<one sentence>"
10
- }
11
-
12
- Strategy model (past effectiveness):
13
- {{strategy}}
14
-
15
- Intake item:
16
- {{item}}`,Ce=`You are an implementation agent.
17
-
18
- Given a triaged issue with root cause and intervention type, produce a fix.
19
-
20
- Issue:
21
- {{item}}
22
-
23
- Output JSON:
24
- {
25
- "outcome": "success" | "failure" | "partial",
26
- "detail": "<description of what was done or what failed>"
27
- }`,Oe=`You are a QA reviewer.
28
-
29
- Given an execution result, verify whether the fix is correct.
30
-
31
- Execution:
32
- {{execution}}
33
-
34
- Original issue:
35
- {{item}}
36
-
37
- Output JSON:
38
- {
39
- "verified": true/false,
40
- "findings": ["<finding1>", ...],
41
- "errorClass": "self-correctable" | "structural" // only if verified=false
42
- }`,F=class extends H{intake;queues;gates;strategy;verifyResults;totalRetries;totalReingestions;constructor(e,n,a,i,f,o,r,s){super(e),this.intake=n,this.queues=a,this.gates=i,this.strategy=f,this.verifyResults=o,this.totalRetries=r,this.totalReingestions=s}};function _e(t,e){let n=e.adapter,a=e.maxRetries??2,i=e.retainedLimit??1e3,f=e.errorClassifier??J,o=new Map;for(let l of x)o.set(l,{...W[l],...e.queues?.[l]});let r=new $("intake",{retainedLimit:i}),s=z(),u=P(r.latest,s.node),p=U(n,[u],e.triagePrompt??(l=>{let[m,h]=l;return m?we.replace("{{strategy}}",JSON.stringify(Array.from(h.entries()))).replace("{{item}}",JSON.stringify(m)):""}),{name:"triage",format:"json",retries:1}),d=new Map;for(let l of x)d.set(l,new $(`queue/${l}`,{retainedLimit:i}));let c=P(p,u),b=w([c],([l])=>{if(l==null)return;let[m,h]=l;if(!m||!m.route)return;let N={...h?.[0],...m},L=d.get(N.route);L&&L.publish(N)}).subscribe(()=>{}),k=new H("gates"),T=new Map;for(let l of x){let m=o.get(l),h=d.get(l);if(m.gated){k.add(h.latest,{name:`${l}/source`});let _=de(k,`${l}/gate`,`${l}/source`,{maxPending:m.maxPending,startOpen:m.startOpen});T.set(l,_)}}let E=new $("retry-input",{retainedLimit:i}),R=[];for(let l of x)o.get(l).gated&&T.has(l)?R.push(T.get(l).node):R.push(d.get(l).latest);R.push(E.latest);let I=ie(...R),C=U(n,[I],e.executePrompt??(l=>Ce.replace("{{item}}",JSON.stringify(l))),{name:"execute",format:"json",retries:1}),X=P(C,I),D=new $("verify-results",{retainedLimit:i}),Z=U(n,[X],e.verifyPrompt??(l=>{let[m,h]=l;return Oe.replace("{{execution}}",JSON.stringify(m)).replace("{{item}}",JSON.stringify(h))}),{name:"verify",format:"json",retries:1}),pe=P(Z,X),ee=e.maxReingestions??1,ge=Math.min(e.maxTotalRetries??a*10,100),me=Math.min(e.maxTotalReingestions??ee*10,100),te=M(0),re=M(0),ye=oe([pe],(l,m)=>{let h=l[0];if(h==null||h.length===0)return;let _=h[h.length-1];if(_==null)return;let[N,L]=_,[ne,y]=L??[null,null];if(!N||!y)return;let ve={item:y,outcome:ne?.outcome??"failure",detail:ne?.detail??"unknown"},S={item:y,execution:ve,verified:N.verified,findings:N.findings??[],errorClass:N.errorClass};if(S.verified){s.record(y.rootCause,y.intervention,!0),D.publish(S);return}let he=S.errorClass??f({item:y,outcome:"failure",detail:S.findings.join("; ")}),B=y._retries??0;if(he==="self-correctable"&&B<a&&V(te,ge)){let G=q(y),Q={...y,_retries:B+1,summary:`[RETRY ${B+1}/${a}] ${G} \u2014 Previous attempt failed: ${S.findings.join("; ")}`,relatedTo:[G]};E.publish(Q)}else{s.record(y.rootCause,y.intervention,!1),D.publish(S);let G=q(y),Q=y._reingestions??0;Q<ee&&V(re,me)&&r.publish({source:"eval",summary:`Verification failed for: ${G}`,evidence:S.findings.join(`
43
- `),affectsAreas:y.affectsAreas,affectsEvalTasks:y.affectsEvalTasks,severity:"high",relatedTo:[G],_reingestions:Q+1})}}).subscribe(()=>{}),v=new F(t,r,d,T,s,D,te,re);v.addDisposer(b),v.addDisposer(ye),v.addDisposer(s.dispose),v.add(p,{name:"triage"}),v.add(C,{name:"execute"}),v.add(Z,{name:"verify"}),v.add(s.node,{name:"strategy"}),v.mount("intake",r);for(let[l,m]of d)v.mount(`queue/${l}`,m);return v.mount("gates",k),v.mount("retry-input",E),v.mount("verify-results",D),v}function Ge(t,e){let n=ae(t,e),a={};for(let[i,f]of t.queues)a[i]=f.retained().length;return{...n,queueDepths:a,strategyEntries:t.strategy.node.cache?.size??0,totalRetries:t.totalRetries.cache??0,totalReingestions:t.totalReingestions.cache??0}}function Ae(t){let e={"intake::latest":"INTAKE",triage:"TRIAGE",execute:"EXECUTE","verify-results::latest":"VERIFY",strategy:"STRATEGY"};for(let n of x)e[`queue/${n}::latest`]="QUEUE";for(let[n]of t.gates)e[`gates::${n}/gate`]="GATE";return e}function Me(t,e){let n=e?.logger===null?null:e?.logger??console.log,a=e?.detail??"summary",i=A(),f=[],o=[],r=Ae(t);function s(){return(A()-i)/1e9}function u(p,d,c){let g={elapsed:s(),stage:p,type:d};a!=="summary"&&(g.summary=Pe(c)),a==="full"&&(g.data=c),o.push(g)}for(let[p,d]of Object.entries(r))try{let c=t.observe(p,{format:"stage-log",stageLabels:r,logger:n?g=>n(g):()=>{},includeTypes:["data","error","complete"]});c.onEvent(g=>{g.type==="data"?u(d,"data",g.data):g.type==="error"?u(d,"error",g.data):g.type==="complete"&&u(d,"complete",void 0)}),f.push(c)}catch(c){let g=c instanceof Error?c.message:String(c);u(d,"error",`observe-unavailable: ${p} \u2014 ${g}`),n&&n(`[${s().toFixed(3)}s] ${d.padEnd(9)} \u2717 observe-unavailable: ${g}`)}return{get events(){return o},dispose(){for(let p of f)p.dispose();f.length=0}}}function Pe(t){if(t==null)return"null";if(typeof t=="string")return fe(t,80);if(typeof t=="number"||typeof t=="boolean"||typeof t=="bigint")return String(t);try{let e=JSON.stringify(t);return fe(e,120)}catch{return String(t)}}function fe(t,e){return t.length>e?`${t.slice(0,e-1)}\u2026`:t}export{Ee as a,ke as b,Re as c,xe as d,be as e,Ie as f,Ne as g,x as h,j as i,J as j,Y as k,K as l,W as m,z as n,Se as o,F as p,_e as q,Ge as r,Me as s,$e as t};
@@ -1 +0,0 @@
1
- import{a as O,b as H,c as W,d as j,e as E,f as et}from"./chunk-QWAPKG3O.js";import{a as N}from"./chunk-ETWTCCJI.js";import{j as T}from"./chunk-CKCSDI7T.js";import{D as I,E as y,G as L,o as S}from"./chunk-ZB5EHBIO.js";import{b as tt}from"./chunk-QYADASLV.js";var ot={};tt(ot,{CanvasMeasureAdapter:()=>$,CliMeasureAdapter:()=>D,ImageSizeAdapter:()=>J,NodeCanvasMeasureAdapter:()=>q,PrecomputedAdapter:()=>V,SvgBoundsAdapter:()=>z,analyzeAndMeasure:()=>O,carveTextLineSlots:()=>j,circleIntervalForBand:()=>U,computeBlockFlow:()=>K,computeCharPositions:()=>E,computeFlowLines:()=>Z,computeLineBreaks:()=>H,computeTotalHeight:()=>_,layoutNextLine:()=>W,measureBlock:()=>X,measureBlocks:()=>Y,reactiveBlockLayout:()=>at,reactiveFlowLayout:()=>it,reactiveLayout:()=>et,rectIntervalForBand:()=>Q});function nt(t){return t>=768&&t<=879||t>=1155&&t<=1161||t>=1425&&t<=1469||t>=1552&&t<=1562||t>=1611&&t<=1631||t>=1648&&t===1648||t>=1750&&t<=1756||t>=1759&&t<=1764||t>=1767&&t<=1768||t>=1770&&t<=1773||t>=1840&&t<=1866||t>=1958&&t<=1968||t>=2304&&t<=2307||t>=2362&&t<=2383||t>=2385&&t<=2391||t>=2402&&t<=2403||t>=2433&&t<=2435||t>=2492&&t<=2509||t>=2561&&t<=2563||t>=2620&&t<=2641||t>=2672&&t<=2673||t>=2677&&t===2677||t>=3633&&t===3633||t>=3636&&t<=3642||t>=3655&&t<=3662||t>=3761&&t===3761||t>=3764&&t<=3772||t>=3784&&t<=3790||t>=7616&&t<=7679||t>=8400&&t<=8447||t>=65024&&t<=65039||t>=65056&&t<=65071||t===8205?0:t>=4352&&t<=4447||t>=8986&&t<=8987||t>=9001&&t<=9002||t>=9193&&t<=9203||t>=9208&&t<=9210||t>=9725&&t<=9726||t>=9748&&t<=9749||t>=9800&&t<=9811||t===9855||t===9875||t===9889||t>=9898&&t<=9899||t>=9917&&t<=9918||t>=9924&&t<=9925||t===9934||t===9940||t===9962||t>=9970&&t<=9971||t===9973||t===9978||t===9981||t===9986||t===9989||t>=9992&&t<=9997||t===9999||t>=10067&&t<=10069||t===10071||t>=10133&&t<=10135||t===10160||t===10175||t>=10548&&t<=10549||t>=11013&&t<=11015||t>=11035&&t<=11036||t===11088||t===11093||t>=11904&&t<=12350||t>=12352&&t<=12447||t>=12448&&t<=12543||t>=12549&&t<=12591||t>=12593&&t<=12686||t>=12688&&t<=12771||t>=12784&&t<=12830||t>=12832&&t<=12871||t>=12880&&t<=19903||t>=19968&&t<=40959||t>=43360&&t<=43388||t>=44032&&t<=55203||t>=63744&&t<=64255||t>=65040&&t<=65049||t>=65072&&t<=65131||t>=65281&&t<=65376||t>=65504&&t<=65510||t>=126980&&t===126980||t===127183||t>=127344&&t<=127345||t===127358||t===127359||t===127374||t>=127377&&t<=127386||t>=127456&&t<=127487||t>=127488&&t<=127490||t===127514||t===127535||t>=127538&&t<=127546||t>=127568&&t<=127569||t>=127744&&t<=129535||t>=129536&&t<=129791||t>=129792&&t<=130047||t>=131072&&t<=196605||t>=196608&&t<=262141?2:1}function rt(t){let e=0;for(let n of t)e+=nt(n.codePointAt(0));return e}var D=class{cellPx;constructor(e){this.cellPx=e?.cellPx??8}measureSegment(e,n){return{width:rt(e)*this.cellPx}}},G=class extends Error{name="KeyError"},V=class{metrics;fallback;constructor(e){this.metrics=e.metrics;let n=e.fallback??"per-char";if(n!=="per-char"&&n!=="error")throw new Error(`fallback must be 'per-char' or 'error', got ${JSON.stringify(e.fallback)}`);this.fallback=n}measureSegment(e,n){let i=this.metrics[n];if(i){let a=i[e];if(a!==void 0)return{width:a}}if(this.fallback==="error")throw new G(`PrecomputedAdapter: no metrics for segment ${JSON.stringify(e)} in font ${JSON.stringify(n)}`);let r=0;if(i)for(let a of e){let l=i[a];l!==void 0&&(r+=l)}return{width:r}}},$=class{ctx=null;currentFont="";emojiCorrection;constructor(e){this.emojiCorrection=e?.emojiCorrection??1}getContext(){if(!this.ctx){if(typeof OffscreenCanvas>"u")throw new Error("CanvasMeasureAdapter requires a browser environment with OffscreenCanvas support. Use CliMeasureAdapter or NodeCanvasMeasureAdapter for Node.js.");let n=new OffscreenCanvas(0,0).getContext("2d");if(!n)throw new Error("CanvasMeasureAdapter: failed to get 2d context");this.ctx=n}return this.ctx}measureSegment(e,n){let i=this.getContext();n!==this.currentFont&&(i.font=n,this.currentFont=n);let r=i.measureText(e).width;return this.emojiCorrection!==1&&new RegExp("\\p{Emoji_Presentation}","u").test(e)&&(r*=this.emojiCorrection),{width:r}}clearCache(){this.currentFont=""}},q=class{ctx=null;currentFont="";canvasModule;constructor(e){this.canvasModule=e}getContext(){if(!this.ctx){let n=this.canvasModule.createCanvas(0,0).getContext("2d");if(!n)throw new Error("NodeCanvasMeasureAdapter: failed to get 2d context");this.ctx=n}return this.ctx}measureSegment(e,n){let i=this.getContext();return n!==this.currentFont&&(i.font=n,this.currentFont=n),{width:i.measureText(e).width}}clearCache(){this.currentFont=""}},z=class{measureSvg(e){let n=e.match(/viewBox\s*=\s*["']([^"']+)["']/);if(n){let a=n[1].trim().split(/[\s,]+/);if(a.length>=4){let l=Number.parseFloat(a[2]),o=Number.parseFloat(a[3]);if(Number.isFinite(l)&&Number.isFinite(o)&&l>0&&o>0)return{width:l,height:o};throw new Error("SvgBoundsAdapter: viewBox width/height are missing, non-finite, or not positive")}}let i=e.match(/<svg[^>]*\bwidth\s*=\s*["']?([\d.]+)/),r=e.match(/<svg[^>]*\bheight\s*=\s*["']?([\d.]+)/);if(i&&r){let a=Number.parseFloat(i[1]),l=Number.parseFloat(r[1]);if(Number.isFinite(a)&&Number.isFinite(l)&&a>0&&l>0)return{width:a,height:l};throw new Error("SvgBoundsAdapter: svg width/height attributes are non-finite or not positive")}throw new Error("SvgBoundsAdapter: cannot determine dimensions \u2014 SVG has no viewBox or width/height attributes")}},J=class{sizes;constructor(e){this.sizes=new Map(Object.entries(e))}measureImage(e){let n=this.sizes.get(e);if(!n)throw new Error(`ImageSizeAdapter: no dimensions registered for ${JSON.stringify(e)}`);return{width:n.width,height:n.height}}};function X(t,e,n,i,r,a,l){switch(t.type){case"text":{let o=t.font??r,x=t.lineHeight??a,h=O(t.text,o,n.text,i),w=H(h,e,n.text,o,i),v=E(w,h,x),B=w.lineCount*x,u=0;for(let d of w.lines)d.width>u&&(u=d.width);return{index:l,type:"text",width:Math.min(u,e),height:B,textSegments:h,textLineBreaks:w,textCharPositions:v}}case"image":{let o,x;if(t.naturalWidth!=null&&t.naturalHeight!=null)o=t.naturalWidth,x=t.naturalHeight;else if(n.image){let h=n.image.measureImage(t.src);o=h.width,x=h.height}else throw new Error(`Image block at index ${l} has no naturalWidth/naturalHeight and no ImageMeasurer adapter`);return o>e&&(x=x*e/o,o=e),{index:l,type:"image",width:o,height:x}}case"svg":{let o,x;if(t.viewBox)o=t.viewBox.width,x=t.viewBox.height;else if(n.svg){let h=n.svg.measureSvg(t.content);o=h.width,x=h.height}else throw new Error(`SVG block at index ${l} has no viewBox and no SvgMeasurer adapter`);return o>e&&(x=x*e/o,o=e),{index:l,type:"svg",width:o,height:x}}}}function Y(t,e,n,i,r,a){return t.map((l,o)=>X(l,e,n,i,r,a,o))}function K(t,e){let n=[],i=0;for(let r=0;r<t.length;r++){let a=t[r];n.push({...a,x:0,y:i}),i+=a.height+(r<t.length-1?e:0)}return n}function _(t){if(t.length===0)return 0;let e=t[t.length-1];return e.y+e.height}function at(t){let{adapters:e,name:n="reactive-block-layout",defaultFont:i="16px sans-serif",defaultLineHeight:r=20}=t,a=new T(n),l=new Map,o=y(t.blocks??[],{name:"blocks"}),x=y(Math.max(0,t.maxWidth??800),{name:"max-width"}),h=y(t.gap??0,{name:"gap"}),w=I([o,x],(u,d,s)=>{let p=u[0]!=null&&u[0].length>0?u[0].at(-1):s.prevData[0],f=u[1]!=null&&u[1].length>0?u[1].at(-1):s.prevData[1],g=S(),m=Y(p,f,e,l,i,r),b=S()-g,c=w.meta;c&&(N(c["block-count"],m.length),N(c["layout-time-ns"],b)),d.emit(m);let C=()=>{l.clear(),e.text.clearCache?.()};return{deactivate:C,invalidate:C}},{name:"measured-blocks",describeKind:"derived",meta:{"block-count":0,"layout-time-ns":0},equals:(u,d)=>{let s=u,p=d;if(s==null||p==null)return s===p;if(s.length!==p.length)return!1;for(let f=0;f<s.length;f++){let g=s[f],m=p[f];if(g.type!==m.type||g.width!==m.width||g.height!==m.height||g.index!==m.index)return!1}return!0}}),v=L([w,h],([u,d])=>K(u,d),{name:"block-flow",equals:(u,d)=>{let s=u,p=d;if(s==null||p==null)return s===p;if(s.length!==p.length)return!1;for(let f=0;f<s.length;f++){let g=s[f],m=p[f];if(g.x!==m.x||g.y!==m.y||g.width!==m.width||g.height!==m.height)return!1}return!0}}),B=L([v],([u])=>_(u),{name:"total-height"});return a.add(o,{name:"blocks"}),a.add(x,{name:"max-width"}),a.add(h,{name:"gap"}),a.add(w,{name:"measured-blocks"}),a.add(v,{name:"block-flow"}),a.add(B,{name:"total-height"}),{graph:a,setBlocks:u=>a.set("blocks",u),setMaxWidth:u=>a.set("max-width",Math.max(0,u)),setGap:u=>a.set("gap",u),measuredBlocks:w,blockFlow:v,totalHeight:B}}function U(t,e,n){let i=t.hPad??0,r=t.vPad??0,a=e-r,l=n+r;if(a>=t.cy+t.r||l<=t.cy-t.r)return null;let o=t.cy>=a&&t.cy<=l?0:t.cy<a?a-t.cy:t.cy-l;if(o>=t.r)return null;let x=Math.sqrt(t.r*t.r-o*o);return{left:t.cx-x-i,right:t.cx+x+i}}function Q(t,e,n){let i=t.hPad??0,r=t.vPad??0;return n<=t.y-r||e>=t.y+t.h+r?null:{left:t.x-i,right:t.x+t.w+i}}function st(t,e,n){return t.kind==="circle"?U(t,e,n):Q(t,e,n)}function Z(t,e,n,i,r,a,l){let o=l?.paragraphSpacing??r,x=[],h={segmentIndex:0,graphemeIndex:0};if(t.length===0||n.count<=0||r<=0)return{lines:x,cursor:h};let w=e.paddingX??0,v=e.paddingY??0,B=Math.max(0,e.width-w*2),u=Math.max(0,e.height-v*2),d=n.gap*Math.max(0,n.count-1),s=Math.max(0,(B-d)/n.count);if(s<=0)return{lines:x,cursor:h};t:for(let p=0;p<n.count;p++){let f=w+p*(s+n.gap),g=f+s,m=v;for(;m+r<=v+u;){let b=m+r,c=[];for(let k=0;k<i.length;k++){let M=st(i[k],m,b);M!==null&&c.push(M)}let C=j({left:f,right:g},c,a);if(C.length===0){m+=r;continue}let F=!1;for(let k=0;k<C.length;k++){let M=C[k],R=M.right-M.left,P=W(t,h,R);if(P===null)return{lines:x,cursor:h};if(P.text.length===0&&P.width===0){h=P.end,F=!0;break}x.push({x:M.left,y:m,width:P.width,slotWidth:R,text:P.text,columnIndex:p,flushToRight:M.right<g-.5}),h=P.end}if(F){m+=o;continue}if(m+=r,h.segmentIndex>=t.length)break t}if(h.segmentIndex>=t.length)break}return{lines:x,cursor:h}}function it(t){let{adapter:e,name:n="reactive-flow-layout",minSlotWidth:i=20}=t,r=new T(n),a=new Map,l=y(t.text??"",{name:"text"}),o=y(t.font??"16px sans-serif",{name:"font"}),x=y(t.lineHeight??20,{name:"line-height"}),h=y(t.container??{width:800,height:600,paddingX:0,paddingY:0},{name:"container"}),w=y(t.columns??{count:1,gap:0},{name:"columns"}),v=y(t.obstacles??[],{name:"obstacles"}),B=y(t.paragraphSpacing??null,{name:"paragraph-spacing"}),u=I([l,o],(s,p,f)=>{let g=s[0],m=g!=null&&g.length>0?g.at(-1):f.prevData[0],b=s[1],c=b!=null&&b.length>0?b.at(-1):f.prevData[1],C=O(m,c,e,a);p.emit(C);let F=()=>{a.clear(),e.clearCache?.()};return{deactivate:F,invalidate:F}},{name:"segments",describeKind:"derived"}),d=L([u,h,w,v,x,B],([s,p,f,g,m,b])=>{let c=s,C=S(),F=b??m,{lines:k,cursor:M}=Z(c,p,f,g,m,i,{paragraphSpacing:F}),R=S()-C,P=Math.max(0,c.length-M.segmentIndex),A=d.meta;return A&&(N(A["line-count"],k.length),N(A["layout-time-ns"],R),N(A["overflow-segments"],P)),k},{name:"flow-lines",meta:{"line-count":0,"layout-time-ns":0,"overflow-segments":0},equals:(s,p)=>{let f=s,g=p;if(f.length!==g.length)return!1;for(let m=0;m<f.length;m++){let b=f[m],c=g[m];if(b.x!==c.x||b.y!==c.y||b.width!==c.width||b.slotWidth!==c.slotWidth||b.text!==c.text||b.columnIndex!==c.columnIndex||b.flushToRight!==c.flushToRight)return!1}return!0}});return r.add(l,{name:"text"}),r.add(o,{name:"font"}),r.add(x,{name:"line-height"}),r.add(h,{name:"container"}),r.add(w,{name:"columns"}),r.add(v,{name:"obstacles"}),r.add(B,{name:"paragraph-spacing"}),r.add(u,{name:"segments"}),r.add(d,{name:"flow-lines"}),{graph:r,setText:s=>r.set("text",s),setFont:s=>r.set("font",s),setLineHeight:s=>r.set("line-height",s),setContainer:s=>r.set("container",s),setColumns:s=>r.set("columns",s),setObstacles:s=>r.set("obstacles",s),setParagraphSpacing:s=>r.set("paragraph-spacing",s),segments:u,flowLines:d}}export{D as a,V as b,$ as c,q as d,z as e,J as f,X as g,Y as h,K as i,_ as j,at as k,U as l,Q as m,Z as n,it as o,ot as p};
@@ -1 +0,0 @@
1
- import{a as P}from"./chunk-4VVTGLXJ.js";import{m as y}from"./chunk-2PMCKKRK.js";import{D as N,F as w,G as W,o as k}from"./chunk-ZB5EHBIO.js";import{a as C,b as p,c as A,d as m,i as a,j as b}from"./chunk-CK2E7BTU.js";function c(d){return{describeKind:"derived",...d}}function H(d,i,u){return N([d],(t,e)=>{let n=t[0];if(n==null||n.length===0){e.down([[m]]);return}for(let o of n)e.emit(i(o))},c(u))}function B(d,i,u){return N([d],(t,e)=>{let n=t[0];if(n==null||n.length===0){e.down([[m]]);return}let o=!1;for(let r of n)i(r)&&(e.emit(r),o=!0);o||e.down([[m]])},c(u))}function J(d,i,u,t){return N([d],(e,n,o)=>{"acc"in o.store||(o.store.acc=u);let r=e[0];if(r==null||r.length===0){n.down([[m]]);return}for(let s of r)o.store.acc=i(o.store.acc,s),n.emit(o.store.acc)},{...c(t),initial:u,resetOnTeardown:!0})}function Q(d,i,u,t){return N([d],(e,n,o)=>{if("acc"in o.store||(o.store.acc=u),o.terminalDeps[0]===!0){n.emit(o.store.acc),n.down([[a]]);return}let r=e[0];if(r==null||r.length===0){n.down([[m]]);return}for(let s of r)o.store.acc=i(o.store.acc,s)},{...c(t),completeWhenDepsComplete:!1})}function M(d,i,u){return i<=0?N([d],(t,e,n)=>{n.store.completed||(n.store.completed=!0,e.down([[a]]))},{...c(u),completeWhenDepsComplete:!1}):N([d],(t,e,n)=>{if("taken"in n.store||(n.store.taken=0),n.store.done){e.down([[m]]);return}if(n.terminalDeps[0]===!0){n.store.done=!0,e.down([[a]]);return}let o=t[0];if(o==null||o.length===0){e.down([[m]]);return}for(let r of o)if(n.store.taken++,e.emit(r),n.store.taken>=i){n.store.done=!0,e.down([[a]]);return}},{...c(u),completeWhenDepsComplete:!1})}function S(d,i,u){return N([d],(t,e,n)=>{"skipped"in n.store||(n.store.skipped=0);let o=t[0];if(o==null||o.length===0){e.down([[m]]);return}let r=!1;for(let s of o)n.store.skipped++,n.store.skipped<=i||(e.emit(s),r=!0);r||e.down([[m]])},c(u))}function X(d,i,u){return N([d],(t,e,n)=>{if(n.store.done){e.down([[m]]);return}let o=t[0];if(o==null||o.length===0){e.down([[m]]);return}for(let r of o){if(!i(r)){n.store.done=!0,e.down([[a]]);return}e.emit(r)}},{...c(u),completeWhenDepsComplete:!1})}function Z(d,i,u){let t=u?.predicate??(o=>o[0]===p),{predicate:e,...n}=u??{};return w(o=>{let r=!1,s=d.subscribe(l=>{if(!r)for(let T of l){if(r)return;T[0]===p?o.emit(T[1]):(T[0]===a||T[0]===b)&&(r=!0,o.down([T]))}}),f=i.subscribe(l=>{if(!r)for(let T of l){if(r)return;if(t(T)){r=!0,o.down([[a]]);return}}});return()=>{s(),f()}},c(n))}function $(d,i){return M(d,1,i)}function ee(d,i){let{defaultValue:u,...t}=i??{},e=i!=null&&Object.hasOwn(i,"defaultValue");return N([d],(n,o,r)=>{if(r.terminalDeps[0]===!0){r.store.has?o.emit(r.store.latest):e&&o.emit(u),o.down([[a]]);return}let s=n[0];if(s==null||s.length===0){o.down([[m]]);return}r.store.latest=s.at(-1),r.store.has=!0},{...c(t),completeWhenDepsComplete:!1})}function ne(d,i,u){return M(B(d,i,u),1,u)}function te(d,i,u){return M(S(d,i,u),1,u)}function oe(d,i,u){if(typeof i=="function")return N([d],(e,n)=>{let o=e[0];if(o==null||o.length===0){n.down([[m]]);return}for(let r of o)i(r),n.emit(r)},c(u));let t=i;return N([d],(e,n,o)=>{if(o.terminalDeps[0]!==void 0){o.terminalDeps[0]===!0?(t.complete?.(),n.down([[a]])):(t.error?.(o.terminalDeps[0]),n.down([[b,o.terminalDeps[0]]]));return}let r=e[0];if(r==null||r.length===0){n.down([[m]]);return}for(let s of r)t.data?.(s),n.emit(s)},{...c(u),completeWhenDepsComplete:!1})}function re(d,i=Object.is,u){return N([d],(t,e,n)=>{let o=t[0];if(o==null||o.length===0){e.down([[m]]);return}let r=!1;for(let s of o)n.store.hasPrev&&i(n.store.prev,s)||(n.store.prev=s,n.store.hasPrev=!0,e.emit(s),r=!0);r||e.down([[m]])},c(u))}function se(d,i){return N([d],(u,t,e)=>{let n=u[0];if(n==null||n.length===0){t.down([[m]]);return}let o=!1;for(let r of n)if(!e.store.hasPrev)e.store.prev=r,e.store.hasPrev=!0;else{let s=[e.store.prev,r];e.store.prev=r,t.emit(s),o=!0}o||t.down([[m]])},c(i))}function V(...d){let i=[...d];return W(i,u=>u,{...c(),equals:(u,t)=>{if(u.length!==t.length)return!1;for(let e=0;e<u.length;e++)if(!Object.is(u[e],t[e]))return!1;return!0}})}function ie(d,i,u){return N([d,i],(t,e,n)=>{let o=t[0],r=t[1],s=r!=null&&r.length>0?r.at(-1):n.prevData[1];if(o!=null&&o.length>0){if(!(r!=null&&r.length>0)&&n.prevData[1]===void 0){e.down([[m]]);return}for(let f of o)e.emit([f,s])}else e.down([[m]])},c(u))}function ue(...d){return d.length===0?w(i=>{i.down([[a]])},c()):w(i=>{let u=d.length,t=0,e=[];for(let n of d){let o=n.subscribe(r=>{for(let s of r)s[0]===p?i.emit(s[1]):s[0]===a?(t+=1,t>=u&&i.down([[a]])):s[0]===b&&i.down([s])});e.push(o)}return()=>{for(let n of e)n()}},c())}function fe(...d){let i=d.length;return i===0?w(u=>{u.emit([]),u.down([[a]])},c()):w(u=>{let t=Array.from({length:i},()=>[]),e=i;function n(){for(;t.every(r=>r.length>0);){let r=t.map(s=>s.shift());u.emit(r)}}let o=[];for(let r=0;r<i;r++){let s=r,f=d[r].subscribe(l=>{for(let T of l)T[0]===p?(t[s].push(T[1]),n()):T[0]===a?(e-=1,(e===0||t[s].length===0)&&u.down([[a]])):T[0]===b&&u.down([T])});o.push(f)}return()=>{for(let r of o)r()}},c())}function de(d,i,u){return w(t=>{let e=0,n=[],o,r;return r=i.subscribe(s=>{for(let f of s)e===0?f[0]===p?n.push(f[1]):f[0]===b&&t.down([f]):f[0]===p?t.emit(f[1]):(f[0]===a||f[0]===b)&&t.down([f])}),o=d.subscribe(s=>{for(let f of s)if(e===0)if(f[0]===p)t.emit(f[1]);else if(f[0]===a){e=1;for(let l of n)t.emit(l);n.length=0}else f[0]===b&&t.down([f])}),()=>{o?.(),r?.()}},c(u))}function le(...d){return d.length===0?w(i=>{i.down([[a]])},c()):d.length===1?N([d[0]],(i,u)=>{let t=i[0];if(t==null||t.length===0){u.down([[m]]);return}for(let e of t)u.emit(e)},c()):w(i=>{let u=null,t=[];for(let e=0;e<d.length;e++){let n=e,o=d[e].subscribe(r=>{for(let s of r){if(u!==null&&n!==u)return;s[0]===p?(u===null&&(u=n),i.emit(s[1])):(s[0]===a||s[0]===b)&&(u===null||n===u)&&i.down([s])}});t.push(o)}return()=>{for(let e of t)e()}},c())}function I(d,i,u){let t,e=!1,n=()=>{e||(e=!0,u())};return t=d.subscribe(o=>{let r=!1,s=!1;for(let f of o)f[0]!==C&&(f[0]===p?i.emit(f[1]):f[0]===a?r=!0:f[0]===b?(s=!0,i.down([f])):(f[0]===A||f[0]===m)&&i.down([f]));s?(t?.(),t=void 0,n()):r&&n()}),()=>{t?.(),t=void 0}}function ae(d,i,u){let t,e=!1;function n(){t?.(),t=void 0}return N([d],(o,r,s)=>{if(s.terminalDeps[0]!=null&&s.terminalDeps[0]!==!0){n();return}if(s.terminalDeps[0]===!0){e=!0,t||r.down([[a]]);return}let f=o[0];if(!(f==null||f.length===0))return n(),t=I(y(i(f[f.length-1])),r,()=>{n(),e&&r.down([[a]])}),{deactivate:()=>{n(),e=!1}}},{...c(u),completeWhenDepsComplete:!1})}function ce(d,i,u){let t,e=!1;function n(){t?.(),t=void 0}return N([d],(o,r,s)=>{if(s.terminalDeps[0]!=null&&s.terminalDeps[0]!==!0){n();return}if(s.terminalDeps[0]===!0){e=!0,t||r.down([[a]]);return}let f=o[0];if(!(f==null||f.length===0))return t===void 0?t=I(y(i(f[0])),r,()=>{n(),e&&r.down([[a]])}):r.down([[m]]),{deactivate:()=>{n(),e=!1}}},{...c(u),completeWhenDepsComplete:!1})}function Te(d,i,u){let{maxBuffer:t,...e}=u??{},n=[],o,r=!1,s;function f(){o?.(),o=void 0}function l(){if(!s||o!==void 0)return;if(n.length===0){r&&s.down([[a]]);return}let h=n.shift();o=I(y(i(h)),s,()=>{f(),l()})}function T(h){t&&t>0&&n.length>=t&&n.shift(),n.push(h),l()}return N([d],(h,O,E)=>{if(s=O,E.terminalDeps[0]!=null&&E.terminalDeps[0]!==!0){f(),n.length=0;return}if(E.terminalDeps[0]===!0){r=!0,l();return}let x=h[0];if(!(x==null||x.length===0)){for(let v of x)T(v);return{deactivate:()=>{f(),n.length=0,r=!1}}}},{...c(e),completeWhenDepsComplete:!1})}function K(d,i,u){let{concurrent:t,...e}=u??{},n=t!=null&&t>0?t:Number.POSITIVE_INFINITY,o=0,r=!1,s=new Set,f=[],l;function T(){r&&o===0&&f.length===0&&l&&l.down([[a]])}function h(v){if(!l)return;o++;let g;g=I(y(i(v)),l,()=>{g&&s.delete(g),o--,O(),T()}),s.add(g)}function O(){for(;f.length>0&&o<n;)h(f.shift())}function E(v){o<n?h(v):f.push(v)}function x(){for(let v of s)v();s.clear(),o=0,f.length=0}return N([d],(v,g,D)=>{if(l=g,D.terminalDeps[0]!=null&&D.terminalDeps[0]!==!0){x();return}if(D.terminalDeps[0]===!0){r=!0,T();return}let R=v[0];if(!(R==null||R.length===0)){for(let U of R)E(U);return{deactivate:()=>{x(),r=!1}}}},{...c(e),completeWhenDepsComplete:!1})}var pe=K;function me(d,i,u){return w(t=>{let e=new Set;function n(){for(let r of e)clearTimeout(r);e.clear()}let o=d.subscribe(r=>{for(let s of r)if(s[0]===p){let f=setTimeout(()=>{e.delete(f),t.emit(s[1])},i);e.add(f)}else if(s[0]===a){let f=setTimeout(()=>{e.delete(f),t.down([[a]])},i);e.add(f)}else s[0]===b&&(n(),t.down([s]))});return()=>{o(),n()}},c(u))}function q(d,i,u){return w(t=>{let e,n;function o(){e!==void 0&&(clearTimeout(e),e=void 0)}let r=d.subscribe(s=>{for(let f of s)f[0]===p?(o(),n=f[1],e=setTimeout(()=>{e=void 0,t.emit(n)},i)):f[0]===a?(e!==void 0&&(o(),t.emit(n)),t.down([[a]])):f[0]===b&&(o(),t.down([f]))});return()=>{r(),o()}},c(u))}function _(d,i,u){let{leading:t,trailing:e,...n}=u??{},o=t!==!1,r=e===!0,s=i*1e6;return w(f=>{let l,T=-1/0,h,O=!1;function E(){l!==void 0&&(clearTimeout(l),l=void 0)}let x=d.subscribe(v=>{for(let g of v)if(g[0]===p){let D=g[1],R=k();if(o&&R-T>=s)T=R,f.emit(D),E(),r&&(l=setTimeout(()=>{l=void 0,O&&(T=k(),f.emit(h),O=!1)},i));else if(r&&(h=D,O=!0,l===void 0)){let U=(R-T)/1e6;l=setTimeout(()=>{l=void 0,O&&(T=k(),f.emit(h),O=!1)},Math.max(0,i-U))}}else(g[0]===a||g[0]===b)&&(E(),f.down([g]))});return()=>{x(),E()}},c(n))}function be(d,i,u){return w(t=>{let e,n=!1,o=!1,r=d.subscribe(f=>{if(!n)for(let l of f){if(n)return;l[0]===p?e={v:l[1]}:l[0]===b?(n=!0,t.down([l])):l[0]===a&&(o=!0,e=void 0)}}),s=i.subscribe(f=>{if(!n)for(let l of f){if(n)return;l[0]===p?e!==void 0&&!o&&t.emit(e.v):l[0]===b?(n=!0,t.down([l])):l[0]===a&&(n=!0,t.down([[a]]))}});return()=>{r(),s()}},c(u))}function we(d,i,u){return w(t=>{let e,n,o=!1;function r(){e!==void 0&&(clearTimeout(e),e=void 0)}let s=d.subscribe(f=>{for(let l of f)l[0]===p?(n=l[1],o=!0,r(),e=setTimeout(()=>{e=void 0,o&&(o=!1,t.emit(n))},i)):(l[0]===a||l[0]===b)&&(r(),t.down([l]))});return()=>{s(),r()}},c(u))}function Ne(d,i,u){let{with:t,...e}=u??{},n=t??new Error("timeout");return w(o=>{let r;function s(){clearTimeout(r),r=setTimeout(()=>{r=void 0,o.down([[b,n]])},i)}s();let f=d.subscribe(l=>{for(let T of l)T[0]===p?(s(),o.emit(T[1])):(T[0]===a||T[0]===b)&&(clearTimeout(r),o.down([T]))});return()=>{f(),clearTimeout(r)}},c(e))}function he(d,i,u){return w(t=>{let e=[],n=d.subscribe(r=>{for(let s of r)s[0]===p?e.push(s[1]):s[0]===a?(e.length>0&&t.emit([...e]),e.length=0,t.down([[a]])):s[0]===b&&t.down([s])}),o=i.subscribe(r=>{for(let s of r)s[0]===p?e.length>0&&(t.emit([...e]),e.length=0):s[0]===a?t.down([[a]]):s[0]===b&&t.down([s])});return()=>{n(),o(),e.length=0}},c(u))}function ve(d,i,u){if(i<=0)throw new RangeError("bufferCount expects count > 0");return w(t=>{let e=[],n=d.subscribe(o=>{for(let r of o)r[0]===p?(e.push(r[1]),e.length>=i&&t.emit(e.splice(0,e.length))):r[0]===a?(e.length>0&&t.emit([...e]),e.length=0,t.down([[a]])):r[0]===b&&t.down([r])});return()=>{n(),e.length=0}},c(u))}function ge(d,i,u){if(i<=0)throw new RangeError("windowCount expects count > 0");return w(t=>{let e,n=0;function o(){let s=w(f=>(e=f.down.bind(f),()=>{e=void 0}),c());n=0,t.emit(s)}let r=d.subscribe(s=>{for(let f of s)f[0]===p?(e||o(),e?.([[p,f[1]]]),n+=1,n>=i&&(e?.([[a]]),e=void 0)):f[0]===a?(e?.([[a]]),e=void 0,t.down([[a]])):f[0]===b&&(e?.([f]),e=void 0,t.down([f]))});return()=>{r(),e?.([[a]]),e=void 0}},c(u))}function Oe(d,i,u){return w(t=>{let e=[],n=setInterval(()=>{e.length>0&&(t.emit([...e]),e.length=0)},i),o=d.subscribe(r=>{for(let s of r)s[0]===p?e.push(s[1]):s[0]===a?(clearInterval(n),e.length>0&&t.emit([...e]),e.length=0,t.down([[a]])):s[0]===b&&(clearInterval(n),t.down([s]))});return()=>{o(),clearInterval(n),e.length=0}},c(u))}function Ee(d,i,u){return w(t=>{let e;function n(){e?.([[a]]),e=void 0}function o(){let f=w(l=>(e=l.down.bind(l),()=>{e=void 0}),c());t.emit(f)}o();let r=setInterval(()=>{n(),o()},i),s=d.subscribe(f=>{for(let l of f)l[0]===p?e?.([[p,l[1]]]):l[0]===a?(clearInterval(r),n(),t.down([[a]])):l[0]===b&&(clearInterval(r),e?.([l]),n(),t.down([l]))});return()=>{s(),clearInterval(r),n()}},c(u))}function xe(d,i,u){return w(t=>{let e;function n(){e?.([[a]]),e=void 0}function o(){let f=w(l=>(e=l.down.bind(l),()=>{e=void 0}),c());t.emit(f)}let r=d.subscribe(f=>{for(let l of f)l[0]===p?(e||o(),e?.([[p,l[1]]])):l[0]===a?(n(),t.down([[a]])):l[0]===b&&(e?.([l]),e=void 0,t.down([l]))}),s=i.subscribe(f=>{for(let l of f)l[0]===p&&(n(),o())});return()=>{r(),s(),n()}},c(u))}function Re(d,i){return w((u,t)=>{"n"in t.store||(t.store.n=0);let e=setInterval(()=>{u.emit(t.store.n),t.store.n=t.store.n+1},d);return()=>clearInterval(e)},c(i))}function De(d,i,u){if(i<=0)throw new RangeError("repeat expects count > 0");return w(t=>{let e=i,n,o=()=>{n?.(),n=d.subscribe(r=>{let s=!1,f=[];for(let l of r)l[0]===a?s=!0:f.push(l);f.length>0&&t.down(f),s&&(n?.(),n=void 0,e-=1,e>0?o():t.down([[a]]))})};return o(),()=>{n?.()}},c(u))}function ye(d,i){return N([d],(u,t)=>{let e=u[0];if(e==null||e.length===0){t.down([[m]]);return}for(let n of e)t.emit(n)},c(i))}function j(d,i,u){return w(t=>{let e=d.subscribe(n=>{for(let o of n)if(o[0]===p)t.emit(o[1]);else if(o[0]===b)try{t.emit(i(o[1]))}catch(r){t.down([[b,r]])}else o[0]===a&&t.down([[a]])});return()=>{e()}},c(u))}function ke(d,i,u){return N([d,i],(t,e,n)=>{let o=t[1];if(!(o!=null&&o.length>0?o.at(-1):n.prevData[1])){e.down([[m]]);return}let s=t[0];if(s!=null&&s.length>0){for(let f of s)e.emit(f);return}if(o!=null&&o.length>0&&n.prevData[0]!==void 0){e.emit(n.prevData[0]);return}e.down([[m]])},c(u))}var Ie=V,Ue=q,Me=_,Ce=j;export{H as a,B as b,J as c,Q as d,M as e,S as f,X as g,Z as h,$ as i,ee as j,ne as k,te as l,oe as m,re as n,se as o,V as p,ie as q,ue as r,fe as s,de as t,le as u,ae as v,ce as w,Te as x,K as y,pe as z,me as A,q as B,_ as C,be as D,we as E,Ne as F,he as G,ve as H,ge as I,Oe as J,Ee as K,xe as L,Re as M,De as N,ye as O,j as P,ke as Q,Ie as R,Ue as S,Me as T,Ce as U};
@@ -1 +0,0 @@
1
- import{a as Y,b,c as S,d as v,e as C,f as k,g as L,h as A,i as D,j as _,k as P,l as he,n as se,q as ie,r as fe,s as pe,t as _e,u as re}from"./chunk-CK2E7BTU.js";var Oe={name:"json",version:1,contentType:"application/json",encode(t){let e=JSON.stringify(t);return new TextEncoder().encode(e)},decode(t,e){let n=new TextDecoder().decode(t);return JSON.parse(n)}};function ze(t){return{name:"dag-cbor",version:1,contentType:"application/dag-cbor",encode:e=>t.encode(e),decode:(e,n)=>t.decode(e)}}function je(t,e){return{name:"dag-cbor-zstd",version:1,contentType:"application/dag-cbor+zstd",encode:n=>e.compressSync(t.encode(n)),decode:(n,s)=>t.decode(e.decompressSync(n))}}var oe=1,ge=4;function qe(t,e){let n=new TextEncoder().encode(t.name);if(n.length===0||n.length>255)throw new Error(`encodeEnvelope: codec name "${t.name}" encodes to ${n.length} bytes (must be 1\u2013255)`);let s=t.version;if(!Number.isInteger(s)||s<0||s>65535)throw new Error(`encodeEnvelope: codec.version ${s} out of u16 range (expected integer 0\u201365535)`);let i=2+n.length+2+e.length;if(i>4294967295)throw new Error(`encodeEnvelope: total envelope size ${i} exceeds 2^32-1 bytes (payload ${e.length} bytes)`);let r=new Uint8Array(i),o=0;return r[o++]=oe,r[o++]=n.length,r.set(n,o),o+=n.length,r[o++]=s>>>8&255,r[o++]=s&255,r.set(e,o),r}function Ke(t,e){if(t.length<ge)throw new Error(`decodeEnvelope: bytes too short (${t.length} < ${ge})`);let n=0,s=t[n++];if(s!==oe)throw new Error(`decodeEnvelope: unsupported envelope version ${s} (expected ${oe})`);let i=t[n++];if(i===0)throw new Error("decodeEnvelope: name_len must be >= 1");if(n+i+2>t.length)throw new Error(`decodeEnvelope: envelope truncated (need ${n+i+2} bytes, have ${t.length})`);let r=new TextDecoder().decode(t.subarray(n,n+i));n+=i;let o=(t[n]<<8|t[n+1])>>>0;n+=2;let a=t.subarray(n),d=e.lookupCodec(r);if(d==null)throw new Error(`decodeEnvelope: codec "${r}" not registered (envelope codec_v=${o})`);return{codec:d,codecVersion:o,payload:a}}function ye(t){t.registerCodec(Oe)}function Ye(t){if(t.length===0)throw new Error("WAL is empty \u2014 need at least one full snapshot");let e=t[0];if(e.mode!=="full")throw new Error("WAL must start with a full record carrying a baseline snapshot");let n=JSON.parse(JSON.stringify(e.snapshot)),s=e.seq;for(let i=1;i<t.length;i++){let r=t[i];if(r.seq<=s)throw new Error(`WAL chain broken at index ${i}: seq=${r.seq} must exceed prev seq=${s}`);if(r.mode==="full"){n=JSON.parse(JSON.stringify(r.snapshot)),s=r.seq;continue}let o=r.diff;for(let d of o.nodesRemoved)delete n.nodes[d];let a=o.nodesAddedFull;if(a!=null)for(let[d,l]of Object.entries(a))n.nodes[d]=JSON.parse(JSON.stringify(l));for(let d of o.nodesChanged){let l=n.nodes[d.path];l!=null&&(l[d.field]=d.to)}s=r.seq}return n}var Re={type:"system",id:""};function J(t){if(t==null)return Re;let{type:e,id:n,...s}=t;return{type:e??"system",id:n??"",...s}}var O=0,U=!1,E=[],M=[],R=[],W=[];function me(){return O>0||U}function be(){return O>0}function ve(t){O>0?W.push(t):t()}function Ze(t){O+=1;let e=!1;try{t()}catch(n){throw e=!0,n}finally{if(O-=1,O===0)if(e){if(!U){let n=W.splice(0);for(let s of n)try{s()}catch{}E.length=0,M.length=0,R.length=0}}else Fe()}}function Fe(){let t=!U;t&&(U=!0);let e=[],n=0;try{for(;E.length>0||M.length>0||R.length>0||t&&W.length>0;){if(t&&W.length>0){let r=W.splice(0);for(let o of r)try{o()}catch(a){e.push(a)}continue}if(n+=1,n>1e3)throw E.length=0,M.length=0,R.length=0,new Error("batch drain exceeded 1000 iterations \u2014 likely a reactive cycle");let i=(E.length>0?E:M.length>0?M:R).splice(0);for(let r of i)try{r()}catch(o){e.push(o)}}}finally{t&&(U=!1)}if(e.length===1)throw e[0];if(e.length>1)throw new AggregateError(e,"batch drain: multiple callbacks threw")}function X(t,e,n){if(e.length===0)return;if(e.length===1){let l=n(e[0][0]);if(l<3||!me()){t(e);return}(l>=5?R:l===4?M:E).push(()=>t(e));return}let s=e.length,i=s,r=s,o=s,a=0;for(;a<s&&n(e[a][0])<3;)a++;for(i=a;a<s&&n(e[a][0])===3;)a++;for(r=a;a<s&&n(e[a][0])===4;)a++;o=a;let d=me();if(i>0){let l=e.slice(0,i);t(l)}if(r>i){let l=e.slice(i,r);d?E.push(()=>t(l)):t(l)}if(o>r){let l=e.slice(r,o);d?M.push(()=>t(l)):t(l)}if(s>o){let l=e.slice(o,s);d?R.push(()=>t(l)):t(l)}}function en(){return Math.trunc(performance.now()*1e6)}function we(){return Date.now()*1e6}var Z=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=n=>{let s=this._messageTypes.get(n);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,n){return this._assertUnfrozen(),this._messageTypes.set(e,{tier:n.tier,wireCrossing:n.wireCrossing??n.tier>=3,metaPassthrough:n.metaPassthrough??!0}),this}messageTier(e){let n=this._messageTypes.get(e);return n!=null?n.tier:1}isWireCrossing(e){let n=this._messageTypes.get(e);return n!=null?n.wireCrossing:!0}isLocalOnly(e){return!this.isWireCrossing(e)}isMetaPassthrough(e){let n=this._messageTypes.get(e);return n!=null?n.metaPassthrough:!0}isKnownMessageType(e){return this._messageTypes.has(e)}registerCodec(e){return this._assertUnfrozen(),this._codecs.set(e.name,e),this}lookupCodec(e){return this._codecs.get(e)}_isFrozen(){return this._frozen}_assertUnfrozen(){if(this._frozen)throw new Error("GraphReFlyConfig is frozen: a node has already captured this config. Register custom types and set hooks before creating any node.")}};function xe(t){t.registerMessageType(Y,{tier:0,wireCrossing:!1}),t.registerMessageType(S,{tier:1,wireCrossing:!1}),t.registerMessageType(C,{tier:1,wireCrossing:!1,metaPassthrough:!1}),t.registerMessageType(k,{tier:2,wireCrossing:!1}),t.registerMessageType(L,{tier:2,wireCrossing:!1}),t.registerMessageType(b,{tier:3,wireCrossing:!0}),t.registerMessageType(v,{tier:3,wireCrossing:!0}),t.registerMessageType(D,{tier:4,wireCrossing:!0,metaPassthrough:!1}),t.registerMessageType(_,{tier:4,wireCrossing:!0,metaPassthrough:!1}),t.registerMessageType(A,{tier:5,wireCrossing:!0,metaPassthrough:!1})}var F=class extends Error{actor;action;nodeName;constructor(e,n){super(n??`GuardDenied: action "${String(e.action)}" denied for actor type "${String(e.actor.type)}"`),this.name="GuardDenied",this.actor=e.actor,this.action=e.action,this.nodeName=e.nodeName}get node(){return this.nodeName}};function Te(t){return Array.isArray(t)?[...t]:[t]}function Ge(t,e){return t.has(e)||t.has("*")}function Ie(t){let e=[];return t((i,r)=>{e.push({kind:"allow",actions:new Set(Te(i)),where:r?.where??(()=>!0)})},(i,r)=>{e.push({kind:"deny",actions:new Set(Te(i)),where:r?.where??(()=>!0)})}),(i,r)=>{let o=!1,a=!1;for(let d of e)Ge(d.actions,r)&&d.where(i)&&(d.kind==="deny"?o=!0:a=!0);return o?!1:a}}function rn(t){return Ie((e,n)=>{for(let s of t){let i=s.actorType==null?null:new Set(Array.isArray(s.actorType)?s.actorType:[s.actorType]),r=s.actorId==null?null:new Set(Array.isArray(s.actorId)?s.actorId:[s.actorId]),o=Object.entries(s.claims??{}),a=d=>{if(i!==null&&!i.has(String(d.type))||r!==null&&!r.has(String(d.id??"")))return!1;for(let[l,c]of o)if(d[l]!==c)return!1;return!0};s.effect==="deny"?n(s.action,{where:a}):e(s.action,{where:a})}})}var He=["human","llm","wallet","system"];function on(t){let e=He.filter(n=>t({type:n,id:""},"write"));return e.length===0?"restricted":e.includes("human")&&e.includes("llm")&&e.every(n=>n==="human"||n==="llm"||n==="system")?"both":e.length===1?e[0]:e.join("+")}function ae(t){if(t===void 0)return null;if(typeof t=="number"){if(!Number.isFinite(t))throw new TypeError(`Cannot hash non-finite number: ${t}`);if(Number.isInteger(t)&&!Number.isSafeInteger(t))throw new TypeError(`Cannot hash integer outside safe range (|n| > 2^53-1): ${t}. Cross-language cid parity is not guaranteed for unsafe integers.`);return t}if(typeof t=="string"||typeof t=="boolean"||t===null)return t;if(Array.isArray(t))return t.map(ae);if(typeof t=="object"&&t!==null){let e={};for(let n of Object.keys(t).sort())e[n]=ae(t[n]);return e}return null}var Ve=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]),Le=new TextEncoder;function Pe(t){let e=Le.encode(t),n=e.length,s=n*8,i=n+9+63&-64,r=new Uint8Array(i);r.set(e),r[n]=128;let o=new DataView(r.buffer);o.setUint32(i-4,s>>>0,!1),o.setUint32(i-8,Math.floor(s/4294967296)>>>0,!1);let a=1779033703,d=3144134277,l=1013904242,c=2773480762,u=1359893119,h=2600822924,p=528734635,g=1541459225,N=new Uint32Array(64),m=(x,y)=>x>>>y|x<<32-y;for(let x=0;x<i;x+=64){for(let f=0;f<16;f++)N[f]=o.getUint32(x+f*4,!1);for(let f=16;f<64;f++){let H=N[f-15],V=N[f-2],K=m(H,7)^m(H,18)^H>>>3,te=m(V,17)^m(V,19)^V>>>10;N[f]=N[f-16]+K+N[f-7]+te>>>0}let y=a,G=d,I=l,ee=c,T=u,j=h,q=p,ne=g;for(let f=0;f<64;f++){let H=m(T,6)^m(T,11)^m(T,25),V=T&j^~T&q,K=ne+H+V+Ve[f]+N[f]>>>0,te=m(y,2)^m(y,13)^m(y,22),Ce=y&G^y&I^G&I,De=te+Ce>>>0;ne=q,q=j,j=T,T=ee+K>>>0,ee=I,I=G,G=y,y=K+De>>>0}a=a+y>>>0,d=d+G>>>0,l=l+I>>>0,c=c+ee>>>0,u=u+T>>>0,h=h+j>>>0,p=p+q>>>0,g=g+ne>>>0}let w=x=>x.toString(16).padStart(8,"0");return w(a)+w(d)+w(l)+w(c)+w(u)+w(h)+w(p)+w(g)}function de(t){let e=ae(t??null),n=JSON.stringify(e);return Pe(n).slice(0,16)}function Ue(){let t=globalThis.crypto;if(t?.randomUUID)return t.randomUUID();let e=()=>Math.floor(Math.random()*4294967296).toString(16).padStart(8,"0"),n=e()+e()+e()+e();return`${n.slice(0,8)}-${n.slice(8,12)}-4${n.slice(13,16)}-${(parseInt(n.slice(16,17),16)&3|8).toString(16)}${n.slice(17,20)}-${n.slice(20,32)}`}function le(t,e,n){let s=n?.id??Ue();if(t===0)return{id:s,version:0};let r=(n?.hash??de)(e);return{id:s,version:0,cid:r,prev:null}}function Ne(t,e,n){t.version+=1,"cid"in t&&(t.prev=t.cid,t.cid=n(e))}function dn(t){return"cid"in t}var ke=()=>{},Ae=100;function Ee(t){return{node:t,unsub:null,prevData:void 0,dirty:!1,involvedThisWave:!1,dataBatch:[],terminal:void 0}}function ce(t){t.prevData=void 0,t.dirty=!1,t.involvedThisWave=!1,t.dataBatch.length=0,t.terminal=void 0}function Q(t){return t.length===0?t:typeof t[0]=="symbol"?[t]:t}var We=(t,e,n,s)=>{n.direction==="down-in"&&t._onDepMessage(n.depIndex,e)},Be=(t,e,n,s)=>{let i=t;if(i._status==="completed"||i._status==="errored")return;let r=i._cached,o=r===void 0?[se]:[se,[b,r]];i._status==="dirty"&&o.push(P),X(e,o,i._config.tierOf)},B=new Z({onMessage:We,onSubscribe:Be});xe(B);ye(B);function mn(t){if(B._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.");t(B)}var $=class t{_optsName;_describeKind;meta;_hasMeta;_config;_deps;_sinks=null;_sinkCount=0;_cached;_status;_cleanup;_store={};_waveHasNewData=!1;_hasNewTerminal=!1;_hasCalledFnOnce=!1;_paused=!1;_pendingWave=!1;_isExecutingFn=!1;_pendingRerun=!1;_rerunDepth=0;_dirtyDepCount=0;_batchPendingMessages=null;_pauseLocks=null;_pauseBuffer=null;_fn;_equals;_resubscribable;_resetOnTeardown;_autoComplete;_autoError;_pausable;_guard;_extraGuards;_hashFn;_versioning;_versioningLevel;_lastMutation;_inspectorHooks;_actions;constructor(e,n,s){this._config=s.config??B,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=n,this._cached=s.initial!==void 0?s.initial:void 0,this._status=e.length===0&&n==null&&this._cached!==void 0?"settled":"sentinel",this._hashFn=s.versioningHash??this._config.defaultHashFn??de;let i=s.versioning??this._config.defaultVersioning;this._versioningLevel=i,this._versioning=i!=null?le(i,this._cached===void 0?void 0:this._cached,{id:s.versioningId,hash:this._hashFn}):void 0,this._deps=e.map(Ee);let r={};for(let[a,d]of Object.entries(s.meta??{})){let l={initial:d,name:`${s.name??"node"}:meta:${a}`,describeKind:"state",config:this._config};s.guard!=null&&(l.guard=s.guard),r[a]=new t([],void 0,l)}Object.freeze(r),this.meta=r,this._hasMeta=Object.keys(r).length>0;let o=this;this._actions={emit(a){o._emit([[b,a]])},down(a){o._emit(Q(a))},up(a){o._emitUp(Q(a))}},this.down=this.down.bind(this),this.up=this.up.bind(this)}get _isTerminal(){return this._status==="completed"||this._status==="errored"}get name(){return this._optsName}get status(){return this._status}get cache(){return this._cached===void 0?void 0:this._cached}get lastMutation(){return this._lastMutation}get v(){return this._versioning}hasGuard(){return this._guard!=null}_applyVersioning(e,n){if(this._isExecutingFn)throw new Error(`Node "${this.name}": _applyVersioning cannot run mid-fn \u2014 call it outside of \`_execFn\` (typically at graph setup time before the first subscribe).`);let s=this._versioningLevel;if(s!=null&&e<=s)return;let i=n?.hash??this._hashFn;i!==this._hashFn&&(this._hashFn=i);let r=this._cached===void 0?void 0:this._cached,o=this._versioning,a=o?.id??n?.id,d=o?.version??0,l=le(e,r,{id:a,hash:i});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 n=J(e);if(this._guard!=null&&!this._guard(n,"observe"))return!1;if(this._extraGuards!=null){for(let s of this._extraGuards)if(!s(n,"observe"))return!1}return!0}_checkGuard(e){if(e?.internal)return;let n=this._guard!=null||this._extraGuards!=null,s=e?.actor!=null;if(!n&&!s)return;let i=J(e?.actor),r=e?.delivery==="signal"?"signal":"write";if(this._guard!=null&&!this._guard(i,r))throw new F({actor:i,action:r,nodeName:this.name});if(this._extraGuards!=null){for(let o of this._extraGuards)if(!o(i,r))throw new F({actor:i,action:r,nodeName:this.name})}this._lastMutation={actor:i,timestamp_ns:we()}}down(e,n){let s=Q(e);s.length!==0&&(this._checkGuard(n),this._emit(s))}emit(e,n){this._checkGuard(n),this._emit([[b,e]])}up(e,n){if(this._deps.length===0)return;let s=Q(e);if(s.length===0)return;this._checkGuard(n);let i=n??{internal:!0};this._validateUpTiers(s);for(let r of this._deps)r.node.up?.(s,i)}_emitUp(e){if(this._deps.length!==0&&e.length!==0){this._validateUpTiers(e);for(let n of this._deps)n.node.up?.(e,{internal:!0})}}_validateUpTiers(e){let n=this._config.tierOf;for(let s of e){let i=n(s[0]);if(i===3||i===4)throw new Error(`Node "${this.name}": tier-${i} messages cannot flow up \u2014 DATA/RESOLVED/COMPLETE/ERROR are downstream-only. Use \`down(...)\` for value delivery; \`up(...)\` is for control signals (DIRTY, INVALIDATE, PAUSE, RESUME, TEARDOWN).`)}}subscribe(e,n){if(n!=null&&this._guard!=null){let d=J(n);if(!this._guard(d,"observe"))throw new F({actor:d,action:"observe",nodeName:this.name})}let i=this._isTerminal&&this._resubscribable;if(i){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)ce(d)}this._sinkCount+=1;let r;try{r=this._config.onSubscribe(this,e,{sinkCount:this._sinkCount,afterTerminalReset:i},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 o=this._isTerminal;if(this._sinkCount===1&&!o)try{this._activate()}catch(d){if(this._sinkCount-=1,this._removeSink(e),this._sinkCount===0&&(this._status="sentinel"),typeof r=="function")try{r()}catch{}throw d}this._status==="sentinel"&&this._cached===void 0&&(this._status="pending");let a=!1;return()=>{a||(a=!0,this._sinkCount-=1,this._removeSink(e),typeof r=="function"&&r(),this._sinks==null&&this._deactivate())}}_removeSink(e){if(this._sinks===e)this._sinks=null;else if(this._sinks!=null&&typeof this._sinks!="function")if(this._sinks.delete(e),this._sinks.size===1){let[n]=this._sinks;this._sinks=n}else this._sinks.size===0&&(this._sinks=null)}_activate(){if(this._deps.length===0){this._fn&&this._execFn();return}this._dirtyDepCount=0;let e=this._deps.length,n=0;try{for(let s=0;s<e;s++){let i=s,r=this._deps[s];r.unsub=ke,r.unsub=r.node.subscribe(o=>{if(r.unsub===null)return;let a=this._config.tierOf,d=!1;for(let l of o)a(l[0])>=3&&(d=!0),this._config.onMessage(this,l,{direction:"down-in",depIndex:i},this._actions);d&&this._maybeRunFnOnSettlement()}),n++}}catch(s){this._deps[n].unsub=null;for(let i=0;i<n;i++){let r=this._deps[i];if(r.unsub!=null){let o=r.unsub;r.unsub=null;try{o()}catch{}ce(r)}}throw this._dirtyDepCount=0,s}}_addDep(e){for(let i=0;i<this._deps.length;i++)if(this._deps[i].node===e)return i;let n=this._deps.length,s=Ee(e);if(this._deps.push(s),this._sinks==null)return n;s.dirty=!0,this._dirtyDepCount++,this._status!=="dirty"&&this._emit(ie),s.unsub=ke;try{s.unsub=e.subscribe(i=>{if(s.unsub===null)return;let r=this._config.tierOf,o=!1;for(let a of i)r(a[0])>=3&&(o=!0),this._config.onMessage(this,a,{direction:"down-in",depIndex:n},this._actions);o&&this._maybeRunFnOnSettlement()})}catch(i){throw s.unsub=null,this._deps.pop(),this._dirtyDepCount--,i}return n}_deactivate(e=!1){let n=this._cleanup;if(this._cleanup=void 0,typeof n=="function")try{n()}catch(s){this._emit([[_,this._wrapFnError("cleanup threw",s)]])}else if(n!=null&&typeof n=="object"){let s=n.deactivate;if(typeof s=="function")try{s()}catch(i){this._emit([[_,this._wrapFnError("cleanup.deactivate threw",i)]])}}for(let s of this._deps){if(s.unsub!=null){let i=s.unsub;s.unsub=null;try{i()}catch{}}ce(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,n){let s=this._deps[e],i=n[0];if(this._inspectorHooks!=null){let r={kind:"dep_message",depIndex:e,message:n};for(let o of this._inspectorHooks)o(r)}if(i!==Y){if(i===S){this._depDirtied(s);return}if(i===C){this._depInvalidated(s),this._emit(pe);return}if(i===k||i===L){this._emit([n]);return}if(i===A){this._emit(re);return}if(i===b)this._depSettledAsData(s,n[1]);else if(i===v)this._depSettledAsResolved(s);else if(i===D)this._depSettledAsTerminal(s,!0);else if(i===_)this._depSettledAsTerminal(s,n[1]);else{this._emit([n]);return}if(!this._fn){(i===b||i===v)&&this._emit([n]),(i===D||i===_)&&this._maybeAutoTerminalAfterWave();return}}}_depDirtied(e){e.dirty||(e.dirty=!0,e.involvedThisWave=!0,this._dirtyDepCount++,this._status!=="dirty"&&this._emit(ie))}_depSettledAsData(e,n){e.dirty&&(e.dirty=!1,this._dirtyDepCount--),e.involvedThisWave=!0,e.dataBatch.push(n),this._waveHasNewData=!0}_depSettledAsResolved(e){e.dirty&&(e.dirty=!1,this._dirtyDepCount--)}_depSettledAsTerminal(e,n){e.dirty&&(e.dirty=!1,this._dirtyDepCount--),e.terminal=n,e.involvedThisWave=!0,this._hasNewTerminal=!0}_depInvalidated(e){e.prevData=void 0,e.terminal=void 0,e.dataBatch.length=0,e.dirty?e.involvedThisWave=!1:(e.dirty=!0,e.involvedThisWave=!0,this._dirtyDepCount++)}_maybeRunFnOnSettlement(){if(!(this._isTerminal&&!this._resubscribable)&&!(this._dirtyDepCount>0)){if(this._paused){this._pendingWave=!0;return}if(!this._waveHasNewData&&!this._hasNewTerminal&&this._hasCalledFnOnce){this._clearWaveFlags(),this._emit(fe),this._maybeAutoTerminalAfterWave();return}this._fn&&this._execFn(),this._maybeAutoTerminalAfterWave()}}_maybeAutoTerminalAfterWave(){if(this._deps.length===0||this._isTerminal)return;let e=this._deps.find(n=>n.terminal!==void 0&&n.terminal!==!0);if(e!=null){this._autoError&&this._emit([[_,e.terminal]]);return}this._autoComplete&&this._deps.every(n=>n.terminal!==void 0)&&this._emit(_e)}_execFn(){if(!this._fn||this._isTerminal&&!this._resubscribable)return;if(this._isExecutingFn){this._pendingRerun=!0;return}let e=this._cleanup;if(typeof e=="function"){this._cleanup=void 0;try{e()}catch(o){this._emit([[_,this._wrapFnError("cleanup threw",o)]]);return}}else if(e!=null&&typeof e=="object"){let o=e.beforeRun;if(typeof o=="function"){e.beforeRun=void 0;try{o()}catch(a){this._emit([[_,this._wrapFnError("cleanup.beforeRun threw",a)]]);return}}}let n=this._deps.map(o=>o.involvedThisWave?o.dataBatch.length>0?[...o.dataBatch]:[]:void 0),s=this._deps.map(o=>o.prevData);for(let o=0;o<this._deps.length;o++){let a=n[o];a!=null&&a.length>0&&(this._deps[o].prevData=a[a.length-1])}let i=this._deps.map(o=>o.terminal),r={prevData:s,terminalDeps:i,store:this._store};if(this._hasCalledFnOnce=!0,this._clearWaveFlags(),this._inspectorHooks!=null){let o={kind:"run",batchData:n,prevData:s};for(let a of this._inspectorHooks)a(o)}this._isExecutingFn=!0;try{let o=this._fn(n,this._actions,r);if(typeof o=="function")this._cleanup=o;else if(o!=null&&typeof o=="object"){let a=o;(typeof a.beforeRun=="function"||typeof a.deactivate=="function"||typeof a.invalidate=="function")&&(this._cleanup=o)}}catch(o){this._emit([[_,this._wrapFnError("fn threw",o)]])}finally{this._isExecutingFn=!1,this._pendingRerun?(this._pendingRerun=!1,this._rerunDepth+=1,this._rerunDepth>Ae?(this._rerunDepth=0,this._emit([[_,new Error(`Node "${this.name}": _pendingRerun depth exceeded ${Ae} \u2014 likely a reactive cycle`)]])):this._maybeRunFnOnSettlement()):this._rerunDepth=0,this._clearWaveFlags()}}_clearWaveFlags(){this._waveHasNewData=!1,this._hasNewTerminal=!1;for(let e of this._deps)e.involvedThisWave=!1,e.dataBatch.length=0}_wrapFnError(e,n){let s=n instanceof Error?n.message:String(n);return new Error(`Node "${this.name}": ${e}: ${s}`,{cause:n})}_frameBatch(e){let n=this._config.tierOf;if(e.length===1)return n(e[0][0])===3&&this._status!=="dirty"?[P,e[0]]:e;let s=!0,i=!1,r=!1,o=-1;for(let d of e){let l=n(d[0]);l<o&&(s=!1),l===3&&(i=!0),d[0]===S&&(r=!0),o=l}let a=e;if(!s){let d=e.map((l,c)=>({m:l,i:c,tier:n(l[0])}));d.sort((l,c)=>l.tier-c.tier||l.i-c.i),a=d.map(l=>l.m)}if(i&&!r&&this._status!=="dirty"){let d=0;for(;d<a.length&&n(a[d][0])===0;)d++;return d===0?[P,...a]:[...a.slice(0,d),P,...a.slice(d)]}return a}_emit(e){if(e.length===0)return;let n=e;if(this._isTerminal&&!this._resubscribable){let a=e.filter(d=>d[0]===A||d[0]===C);if(a.length===0)return;n=a}n=this._frameBatch(n);let i=null;for(let a=0;a<n.length;a++){let d=n[a],l=d[0];if(l!==k&&l!==L){i?.push(d);continue}if(d.length<2)throw new Error(`Node "${this.name}": [[${l===k?"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===k)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?i?.push(d):i==null&&(i=n.slice(0,a))}if(i!=null){if(i.length===0)return;n=i}if(this._hasMeta&&n.some(a=>a[0]===A))for(let a of Object.keys(this.meta))try{this.meta[a]._emit(re)}catch{}let{finalMessages:r,equalsError:o}=this._updateState(n);if(r.length>0&&this._config.inspectorEnabled){let a=this._config.globalInspector;if(a!=null)try{a({kind:"emit",node:this,messages:r})}catch{}}if(r.length>0)if(this._paused&&this._pausable==="resumeAll"&&this._pauseBuffer!=null){let a=this._config.tierOf,d=[];for(let l of r){let c=a(l[0]);c<3||c===5?d.push(l):this._pauseBuffer.push(l)}d.length>0&&this._dispatchOrAccumulate(d)}else this._dispatchOrAccumulate(r);o!=null&&this._emit([[_,o]])}_updateState(e){let n=this._config.tierOf,s,i,r=-1,o=0;for(let c of e)n(c[0])===3&&o++;let a=o<=1,d=-1;if(this._versioning!=null&&o>1){for(let c=e.length-1;c>=0;c--)if(e[c][0]===b){d=c;break}}for(let c=0;c<e.length;c++){let u=e[c],h=u[0];if(h===b){if(u.length>=2){let p=!1;if(a&&this._cached!==void 0)try{p=this._equals(this._cached,u[1])}catch(g){i=this._wrapFnError("equals threw",g),r=c;break}if(p){s==null&&(s=e.slice(0,c)),s.push(he),this._status="resolved";continue}this._cached=u[1],this._versioning!=null&&(d<0||c===d)&&Ne(this._versioning,u[1],this._hashFn)}this._status="settled",s?.push(u)}else if(s?.push(u),h===S)this._status="dirty";else if(h===v)this._status="resolved";else if(h===D)this._status="completed";else if(h===_)this._status="errored";else if(h===C){this._cached=void 0,this._status="dirty";let p=this._cleanup;if(typeof p=="function"){this._cleanup=void 0;try{p()}catch{}}else if(p!=null&&typeof p=="object"){let g=p.invalidate;if(typeof g=="function")try{g()}catch{}}}else h===A&&(this._resetOnTeardown&&(this._cached=void 0),this._deactivate(!0),this._status="sentinel")}let l=r>=0?s??e.slice(0,r):s??e;return i!=null?{finalMessages:l,equalsError:i}:{finalMessages:l}}_deliverToSinks=e=>{if(this._sinks==null)return;if(typeof this._sinks=="function"){this._sinks(e);return}let n=[...this._sinks];for(let s of n)s(e)};_dispatchOrAccumulate(e){if(be()){this._batchPendingMessages===null&&(this._batchPendingMessages=[],ve(()=>this._flushBatchPending()));for(let n of e)this._batchPendingMessages.push(n);return}X(this._deliverToSinks,e,this._config.tierOf)}_flushBatchPending(){let e=this._batchPendingMessages;if(e===null||(this._batchPendingMessages=null,e.length===0))return;let n=this._frameBatch(e);X(this._deliverToSinks,n,this._config.tierOf)}},Me=t=>Array.isArray(t),ue=t=>typeof t=="object"&&t!=null&&!Array.isArray(t);function z(t,e,n){let s=Me(t)?t:[],i=typeof t=="function"?t:typeof e=="function"?e:void 0,r={};return Me(t)?r=(ue(e)?e:n)??{}:ue(t)?r=t:r=(ue(e)?e:n)??{},new $(s,i,r)}function Se(t,e,n){return n?!1:t.some((s,i)=>!(s!=null&&s.length>0)&&e.prevData[i]===void 0)}function xn(t,e){return z([],{...e,initial:t})}function Tn(t,e){return z((s,i,r)=>t(i,r)??void 0,{describeKind:"producer",...e})}function $e(t,e,n){let s=n?.partial??!1;return z(t,(r,o,a)=>{if(Se(r,a,s)){o.down([[v]]);return}let d=r.map((l,c)=>l!=null&&l.length>0?l.at(-1):a.prevData[c]);o.emit(e(d,a))},{describeKind:"derived",...n})}function Nn(t,e,n){let s=n?.partial??!1;return z(t,(r,o,a)=>{if(Se(r,a,s)){o.down([[v]]);return}let d=r.map((l,c)=>l!=null&&l.length>0?l.at(-1):a.prevData[c]);return e(d,o,a)??void 0},{describeKind:"effect",...n})}function kn(t,e,n){let s=new Map;return t.forEach((i,r)=>{s.set(i,r)}),$e(t,(i,r)=>e(a=>{let d=s.get(a);if(d==null)throw new Error(`dynamicNode: untracked dep "${a.name??"<unnamed>"}"`);return i[d]},r),n)}function An(t,e){let n,s=new Map,i=e?.partial??!1,r=(o,a,d)=>{let l=!1,c=u=>{let h=s.get(u);if(h!==void 0){if(h<o.length){let g=o[h];return g!=null&&g.length>0?g.at(-1):d.prevData[h]}return u.cache}l=!0;let p=n._addDep(u);return s.set(u,p),u.cache};if(!i&&s.size>0){for(let[,u]of s)if(u<o.length){let h=o[u];if(!(h!=null&&h.length>0)&&d.prevData[u]===void 0){a.down([[v]]);return}}}try{let u=t(c,d);l||(a.emit(u),d.store.__autoTrackLastDiscoveryError!=null&&delete d.store.__autoTrackLastDiscoveryError)}catch(u){if(!l)throw u;d.store.__autoTrackLastDiscoveryError=u}};return n=new $([],r,{describeKind:"derived",...e}),n}function En(t,...e){let n=t;for(let s of e)n=s(n);return n}export{Oe as a,ze as b,je as c,oe as d,qe as e,Ke as f,ye as g,Ye as h,Re as i,J as j,me as k,ve as l,Ze as m,X as n,en as o,we as p,Z as q,xe as r,F as s,Ie as t,rn as u,on as v,de as w,le as x,Ne as y,dn as z,B as A,mn as B,$ as C,z as D,xn as E,Tn as F,$e as G,Nn as H,kn as I,An as J,En as K};