@hashgraphonline/standards-sdk 0.1.143-feat-solana-register.canary.1c6f446.78 → 0.1.144-feat-solana-register.canary.d5edcec.80

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 (340) hide show
  1. package/dist/cjs/hcs-10/sdk.d.ts.map +1 -1
  2. package/dist/cjs/hcs-14/issuers/hiero.d.ts.map +1 -1
  3. package/dist/cjs/index.d.ts.map +1 -1
  4. package/dist/cjs/services/registry-broker/schemas.d.ts +153 -153
  5. package/dist/cjs/standards-sdk.cjs +2 -2
  6. package/dist/cjs/standards-sdk.cjs.map +1 -1
  7. package/dist/cjs/utils/dynamic-import.d.ts +5 -1
  8. package/dist/cjs/utils/dynamic-import.d.ts.map +1 -1
  9. package/dist/es/hcs-10/sdk.d.ts.map +1 -1
  10. package/dist/es/hcs-14/issuers/hiero.d.ts.map +1 -1
  11. package/dist/es/index.d.ts.map +1 -1
  12. package/dist/es/services/registry-broker/schemas.d.ts +153 -153
  13. package/dist/es/standards-sdk.es.js +134 -135
  14. package/dist/es/standards-sdk.es.js.map +1 -1
  15. package/dist/es/standards-sdk.es10.js +70 -90
  16. package/dist/es/standards-sdk.es10.js.map +1 -1
  17. package/dist/es/standards-sdk.es100.js +229 -27
  18. package/dist/es/standards-sdk.es100.js.map +1 -1
  19. package/dist/es/standards-sdk.es101.js +109 -228
  20. package/dist/es/standards-sdk.es101.js.map +1 -1
  21. package/dist/es/standards-sdk.es102.js +15 -94
  22. package/dist/es/standards-sdk.es102.js.map +1 -1
  23. package/dist/es/standards-sdk.es103.js +80 -30
  24. package/dist/es/standards-sdk.es103.js.map +1 -1
  25. package/dist/es/standards-sdk.es104.js +27 -80
  26. package/dist/es/standards-sdk.es104.js.map +1 -1
  27. package/dist/es/standards-sdk.es105.js +136 -25
  28. package/dist/es/standards-sdk.es105.js.map +1 -1
  29. package/dist/es/standards-sdk.es106.js +27 -140
  30. package/dist/es/standards-sdk.es106.js.map +1 -1
  31. package/dist/es/standards-sdk.es107.js +20 -27
  32. package/dist/es/standards-sdk.es107.js.map +1 -1
  33. package/dist/es/standards-sdk.es108.js +156 -18
  34. package/dist/es/standards-sdk.es108.js.map +1 -1
  35. package/dist/es/standards-sdk.es109.js +198 -148
  36. package/dist/es/standards-sdk.es109.js.map +1 -1
  37. package/dist/es/standards-sdk.es11.js +121 -45
  38. package/dist/es/standards-sdk.es11.js.map +1 -1
  39. package/dist/es/standards-sdk.es110.js +747 -167
  40. package/dist/es/standards-sdk.es110.js.map +1 -1
  41. package/dist/es/standards-sdk.es111.js +9 -786
  42. package/dist/es/standards-sdk.es111.js.map +1 -1
  43. package/dist/es/standards-sdk.es112.js +567 -13
  44. package/dist/es/standards-sdk.es112.js.map +1 -1
  45. package/dist/es/standards-sdk.es113.js +576 -541
  46. package/dist/es/standards-sdk.es113.js.map +1 -1
  47. package/dist/es/standards-sdk.es114.js +12 -601
  48. package/dist/es/standards-sdk.es114.js.map +1 -1
  49. package/dist/es/standards-sdk.es115.js +2 -13
  50. package/dist/es/standards-sdk.es115.js.map +1 -1
  51. package/dist/es/standards-sdk.es116.js +87 -2
  52. package/dist/es/standards-sdk.es116.js.map +1 -1
  53. package/dist/es/standards-sdk.es117.js +37 -84
  54. package/dist/es/standards-sdk.es117.js.map +1 -1
  55. package/dist/es/standards-sdk.es118.js +2 -40
  56. package/dist/es/standards-sdk.es118.js.map +1 -1
  57. package/dist/es/standards-sdk.es119.js +231 -2
  58. package/dist/es/standards-sdk.es119.js.map +1 -1
  59. package/dist/es/standards-sdk.es12.js +60 -159
  60. package/dist/es/standards-sdk.es12.js.map +1 -1
  61. package/dist/es/standards-sdk.es120.js +1110 -201
  62. package/dist/es/standards-sdk.es120.js.map +1 -1
  63. package/dist/es/standards-sdk.es121.js +225 -1059
  64. package/dist/es/standards-sdk.es121.js.map +1 -1
  65. package/dist/es/standards-sdk.es122.js +419 -303
  66. package/dist/es/standards-sdk.es122.js.map +1 -1
  67. package/dist/es/standards-sdk.es123.js +351 -418
  68. package/dist/es/standards-sdk.es123.js.map +1 -1
  69. package/dist/es/standards-sdk.es124.js +872 -347
  70. package/dist/es/standards-sdk.es124.js.map +1 -1
  71. package/dist/es/standards-sdk.es125.js +182 -854
  72. package/dist/es/standards-sdk.es125.js.map +1 -1
  73. package/dist/es/standards-sdk.es126.js +1512 -153
  74. package/dist/es/standards-sdk.es126.js.map +1 -1
  75. package/dist/es/standards-sdk.es127.js +157 -1547
  76. package/dist/es/standards-sdk.es127.js.map +1 -1
  77. package/dist/es/standards-sdk.es128.js +192 -162
  78. package/dist/es/standards-sdk.es128.js.map +1 -1
  79. package/dist/es/standards-sdk.es129.js +61 -164
  80. package/dist/es/standards-sdk.es129.js.map +1 -1
  81. package/dist/es/standards-sdk.es13.js +200 -60
  82. package/dist/es/standards-sdk.es13.js.map +1 -1
  83. package/dist/es/standards-sdk.es130.js +102 -85
  84. package/dist/es/standards-sdk.es130.js.map +1 -1
  85. package/dist/es/standards-sdk.es131.js +222 -96
  86. package/dist/es/standards-sdk.es131.js.map +1 -1
  87. package/dist/es/standards-sdk.es132.js +153 -220
  88. package/dist/es/standards-sdk.es132.js.map +1 -1
  89. package/dist/es/standards-sdk.es133.js +104 -162
  90. package/dist/es/standards-sdk.es133.js.map +1 -1
  91. package/dist/es/standards-sdk.es134.js +296 -92
  92. package/dist/es/standards-sdk.es134.js.map +1 -1
  93. package/dist/es/standards-sdk.es135.js +432 -294
  94. package/dist/es/standards-sdk.es135.js.map +1 -1
  95. package/dist/es/standards-sdk.es136.js +14 -461
  96. package/dist/es/standards-sdk.es136.js.map +1 -1
  97. package/dist/es/standards-sdk.es137.js +79 -15
  98. package/dist/es/standards-sdk.es137.js.map +1 -1
  99. package/dist/es/standards-sdk.es138.js +77 -71
  100. package/dist/es/standards-sdk.es138.js.map +1 -1
  101. package/dist/es/standards-sdk.es139.js +152 -80
  102. package/dist/es/standards-sdk.es139.js.map +1 -1
  103. package/dist/es/standards-sdk.es14.js +149 -178
  104. package/dist/es/standards-sdk.es14.js.map +1 -1
  105. package/dist/es/standards-sdk.es140.js +7 -159
  106. package/dist/es/standards-sdk.es140.js.map +1 -1
  107. package/dist/es/standards-sdk.es141.js +86 -7
  108. package/dist/es/standards-sdk.es141.js.map +1 -1
  109. package/dist/es/standards-sdk.es142.js +44 -65
  110. package/dist/es/standards-sdk.es142.js.map +1 -1
  111. package/dist/es/standards-sdk.es143.js +30 -65
  112. package/dist/es/standards-sdk.es143.js.map +1 -1
  113. package/dist/es/standards-sdk.es144.js +34 -30
  114. package/dist/es/standards-sdk.es144.js.map +1 -1
  115. package/dist/es/standards-sdk.es145.js +28 -34
  116. package/dist/es/standards-sdk.es145.js.map +1 -1
  117. package/dist/es/standards-sdk.es146.js +138 -28
  118. package/dist/es/standards-sdk.es146.js.map +1 -1
  119. package/dist/es/standards-sdk.es147.js +37 -133
  120. package/dist/es/standards-sdk.es147.js.map +1 -1
  121. package/dist/es/standards-sdk.es148.js +12280 -33
  122. package/dist/es/standards-sdk.es148.js.map +1 -1
  123. package/dist/es/standards-sdk.es149.js +1 -1
  124. package/dist/es/standards-sdk.es15.js +152 -151
  125. package/dist/es/standards-sdk.es15.js.map +1 -1
  126. package/dist/es/standards-sdk.es150.js +12 -12284
  127. package/dist/es/standards-sdk.es150.js.map +1 -1
  128. package/dist/es/standards-sdk.es151.js +54 -15
  129. package/dist/es/standards-sdk.es151.js.map +1 -1
  130. package/dist/es/standards-sdk.es152.js +72 -160
  131. package/dist/es/standards-sdk.es152.js.map +1 -1
  132. package/dist/es/standards-sdk.es153.js +139 -289
  133. package/dist/es/standards-sdk.es153.js.map +1 -1
  134. package/dist/es/standards-sdk.es154.js +274 -298
  135. package/dist/es/standards-sdk.es154.js.map +1 -1
  136. package/dist/es/standards-sdk.es155.js +262 -369
  137. package/dist/es/standards-sdk.es155.js.map +1 -1
  138. package/dist/es/standards-sdk.es156.js +316 -194
  139. package/dist/es/standards-sdk.es156.js.map +1 -1
  140. package/dist/es/standards-sdk.es157.js +319 -64
  141. package/dist/es/standards-sdk.es157.js.map +1 -1
  142. package/dist/es/standards-sdk.es158.js +69 -49
  143. package/dist/es/standards-sdk.es158.js.map +1 -1
  144. package/dist/es/standards-sdk.es159.js +222 -65
  145. package/dist/es/standards-sdk.es159.js.map +1 -1
  146. package/dist/es/standards-sdk.es16.js +917 -136
  147. package/dist/es/standards-sdk.es16.js.map +1 -1
  148. package/dist/es/standards-sdk.es160.js +223 -218
  149. package/dist/es/standards-sdk.es160.js.map +1 -1
  150. package/dist/es/standards-sdk.es17.js +23 -948
  151. package/dist/es/standards-sdk.es17.js.map +1 -1
  152. package/dist/es/standards-sdk.es18.js +2422 -24
  153. package/dist/es/standards-sdk.es18.js.map +1 -1
  154. package/dist/es/standards-sdk.es19.js +818 -2092
  155. package/dist/es/standards-sdk.es19.js.map +1 -1
  156. package/dist/es/standards-sdk.es2.js +654 -189
  157. package/dist/es/standards-sdk.es2.js.map +1 -1
  158. package/dist/es/standards-sdk.es20.js +205 -1092
  159. package/dist/es/standards-sdk.es20.js.map +1 -1
  160. package/dist/es/standards-sdk.es21.js +858 -221
  161. package/dist/es/standards-sdk.es21.js.map +1 -1
  162. package/dist/es/standards-sdk.es22.js +179 -903
  163. package/dist/es/standards-sdk.es22.js.map +1 -1
  164. package/dist/es/standards-sdk.es23.js +164 -179
  165. package/dist/es/standards-sdk.es23.js.map +1 -1
  166. package/dist/es/standards-sdk.es24.js +62 -118
  167. package/dist/es/standards-sdk.es24.js.map +1 -1
  168. package/dist/es/standards-sdk.es25.js +377 -57
  169. package/dist/es/standards-sdk.es25.js.map +1 -1
  170. package/dist/es/standards-sdk.es26.js +36 -394
  171. package/dist/es/standards-sdk.es26.js.map +1 -1
  172. package/dist/es/standards-sdk.es27.js +901 -50
  173. package/dist/es/standards-sdk.es27.js.map +1 -1
  174. package/dist/es/standards-sdk.es28.js +134 -922
  175. package/dist/es/standards-sdk.es28.js.map +1 -1
  176. package/dist/es/standards-sdk.es29.js +7 -134
  177. package/dist/es/standards-sdk.es29.js.map +1 -1
  178. package/dist/es/standards-sdk.es3.js +63 -680
  179. package/dist/es/standards-sdk.es3.js.map +1 -1
  180. package/dist/es/standards-sdk.es30.js +344 -7
  181. package/dist/es/standards-sdk.es30.js.map +1 -1
  182. package/dist/es/standards-sdk.es31.js +302 -287
  183. package/dist/es/standards-sdk.es31.js.map +1 -1
  184. package/dist/es/standards-sdk.es32.js +94 -322
  185. package/dist/es/standards-sdk.es32.js.map +1 -1
  186. package/dist/es/standards-sdk.es33.js +458 -101
  187. package/dist/es/standards-sdk.es33.js.map +1 -1
  188. package/dist/es/standards-sdk.es34.js +132 -451
  189. package/dist/es/standards-sdk.es34.js.map +1 -1
  190. package/dist/es/standards-sdk.es35.js +216 -130
  191. package/dist/es/standards-sdk.es35.js.map +1 -1
  192. package/dist/es/standards-sdk.es36.js +273 -196
  193. package/dist/es/standards-sdk.es36.js.map +1 -1
  194. package/dist/es/standards-sdk.es37.js +148 -87
  195. package/dist/es/standards-sdk.es37.js.map +1 -1
  196. package/dist/es/standards-sdk.es38.js +183 -320
  197. package/dist/es/standards-sdk.es38.js.map +1 -1
  198. package/dist/es/standards-sdk.es39.js +238 -161
  199. package/dist/es/standards-sdk.es39.js.map +1 -1
  200. package/dist/es/standards-sdk.es4.js +425 -63
  201. package/dist/es/standards-sdk.es4.js.map +1 -1
  202. package/dist/es/standards-sdk.es40.js +136 -254
  203. package/dist/es/standards-sdk.es40.js.map +1 -1
  204. package/dist/es/standards-sdk.es41.js +225 -176
  205. package/dist/es/standards-sdk.es41.js.map +1 -1
  206. package/dist/es/standards-sdk.es42.js +199 -261
  207. package/dist/es/standards-sdk.es42.js.map +1 -1
  208. package/dist/es/standards-sdk.es43.js +237 -199
  209. package/dist/es/standards-sdk.es43.js.map +1 -1
  210. package/dist/es/standards-sdk.es44.js +209 -201
  211. package/dist/es/standards-sdk.es44.js.map +1 -1
  212. package/dist/es/standards-sdk.es45.js +305 -201
  213. package/dist/es/standards-sdk.es45.js.map +1 -1
  214. package/dist/es/standards-sdk.es46.js +371 -261
  215. package/dist/es/standards-sdk.es46.js.map +1 -1
  216. package/dist/es/standards-sdk.es47.js +316 -372
  217. package/dist/es/standards-sdk.es47.js.map +1 -1
  218. package/dist/es/standards-sdk.es48.js +404 -336
  219. package/dist/es/standards-sdk.es48.js.map +1 -1
  220. package/dist/es/standards-sdk.es49.js +83 -449
  221. package/dist/es/standards-sdk.es49.js.map +1 -1
  222. package/dist/es/standards-sdk.es5.js +232 -354
  223. package/dist/es/standards-sdk.es5.js.map +1 -1
  224. package/dist/es/standards-sdk.es50.js +179 -89
  225. package/dist/es/standards-sdk.es50.js.map +1 -1
  226. package/dist/es/standards-sdk.es51.js +231 -165
  227. package/dist/es/standards-sdk.es51.js.map +1 -1
  228. package/dist/es/standards-sdk.es52.js +25 -262
  229. package/dist/es/standards-sdk.es52.js.map +1 -1
  230. package/dist/es/standards-sdk.es53.js +56 -26
  231. package/dist/es/standards-sdk.es53.js.map +1 -1
  232. package/dist/es/standards-sdk.es54.js +12 -57
  233. package/dist/es/standards-sdk.es54.js.map +1 -1
  234. package/dist/es/standards-sdk.es55.js +49 -12
  235. package/dist/es/standards-sdk.es55.js.map +1 -1
  236. package/dist/es/standards-sdk.es56.js +115 -43
  237. package/dist/es/standards-sdk.es56.js.map +1 -1
  238. package/dist/es/standards-sdk.es57.js +42 -115
  239. package/dist/es/standards-sdk.es57.js.map +1 -1
  240. package/dist/es/standards-sdk.es58.js +52 -43
  241. package/dist/es/standards-sdk.es58.js.map +1 -1
  242. package/dist/es/standards-sdk.es59.js +36 -50
  243. package/dist/es/standards-sdk.es59.js.map +1 -1
  244. package/dist/es/standards-sdk.es6.js +125 -246
  245. package/dist/es/standards-sdk.es6.js.map +1 -1
  246. package/dist/es/standards-sdk.es60.js +207 -39
  247. package/dist/es/standards-sdk.es60.js.map +1 -1
  248. package/dist/es/standards-sdk.es61.js +24 -201
  249. package/dist/es/standards-sdk.es61.js.map +1 -1
  250. package/dist/es/standards-sdk.es62.js +87 -25
  251. package/dist/es/standards-sdk.es62.js.map +1 -1
  252. package/dist/es/standards-sdk.es63.js +3 -51
  253. package/dist/es/standards-sdk.es63.js.map +1 -1
  254. package/dist/es/standards-sdk.es64.js +100 -3
  255. package/dist/es/standards-sdk.es64.js.map +1 -1
  256. package/dist/es/standards-sdk.es65.js +61 -62
  257. package/dist/es/standards-sdk.es65.js.map +1 -1
  258. package/dist/es/standards-sdk.es66.js +17 -98
  259. package/dist/es/standards-sdk.es66.js.map +1 -1
  260. package/dist/es/standards-sdk.es67.js +77 -19
  261. package/dist/es/standards-sdk.es67.js.map +1 -1
  262. package/dist/es/standards-sdk.es68.js +458 -77
  263. package/dist/es/standards-sdk.es68.js.map +1 -1
  264. package/dist/es/standards-sdk.es69.js +106 -240
  265. package/dist/es/standards-sdk.es69.js.map +1 -1
  266. package/dist/es/standards-sdk.es7.js +28 -183
  267. package/dist/es/standards-sdk.es7.js.map +1 -1
  268. package/dist/es/standards-sdk.es70.js +170 -286
  269. package/dist/es/standards-sdk.es70.js.map +1 -1
  270. package/dist/es/standards-sdk.es71.js +71 -207
  271. package/dist/es/standards-sdk.es71.js.map +1 -1
  272. package/dist/es/standards-sdk.es72.js +71 -72
  273. package/dist/es/standards-sdk.es72.js.map +1 -1
  274. package/dist/es/standards-sdk.es73.js +143 -71
  275. package/dist/es/standards-sdk.es73.js.map +1 -1
  276. package/dist/es/standards-sdk.es74.js +62 -136
  277. package/dist/es/standards-sdk.es74.js.map +1 -1
  278. package/dist/es/standards-sdk.es75.js +380 -45
  279. package/dist/es/standards-sdk.es75.js.map +1 -1
  280. package/dist/es/standards-sdk.es76.js +222 -130
  281. package/dist/es/standards-sdk.es76.js.map +1 -1
  282. package/dist/es/standards-sdk.es77.js +320 -444
  283. package/dist/es/standards-sdk.es77.js.map +1 -1
  284. package/dist/es/standards-sdk.es78.js +88 -371
  285. package/dist/es/standards-sdk.es78.js.map +1 -1
  286. package/dist/es/standards-sdk.es79.js +125 -89
  287. package/dist/es/standards-sdk.es79.js.map +1 -1
  288. package/dist/es/standards-sdk.es8.js +80 -29
  289. package/dist/es/standards-sdk.es8.js.map +1 -1
  290. package/dist/es/standards-sdk.es80.js +8 -125
  291. package/dist/es/standards-sdk.es80.js.map +1 -1
  292. package/dist/es/standards-sdk.es81.js +45 -6
  293. package/dist/es/standards-sdk.es81.js.map +1 -1
  294. package/dist/es/standards-sdk.es82.js +98 -44
  295. package/dist/es/standards-sdk.es82.js.map +1 -1
  296. package/dist/es/standards-sdk.es83.js +331 -84
  297. package/dist/es/standards-sdk.es83.js.map +1 -1
  298. package/dist/es/standards-sdk.es84.js +93 -160
  299. package/dist/es/standards-sdk.es84.js.map +1 -1
  300. package/dist/es/standards-sdk.es85.js +55 -275
  301. package/dist/es/standards-sdk.es85.js.map +1 -1
  302. package/dist/es/standards-sdk.es86.js +43 -55
  303. package/dist/es/standards-sdk.es86.js.map +1 -1
  304. package/dist/es/standards-sdk.es87.js +145 -44
  305. package/dist/es/standards-sdk.es87.js.map +1 -1
  306. package/dist/es/standards-sdk.es88.js +30 -113
  307. package/dist/es/standards-sdk.es88.js.map +1 -1
  308. package/dist/es/standards-sdk.es89.js +22 -59
  309. package/dist/es/standards-sdk.es89.js.map +1 -1
  310. package/dist/es/standards-sdk.es9.js +104 -80
  311. package/dist/es/standards-sdk.es9.js.map +1 -1
  312. package/dist/es/standards-sdk.es90.js +23 -28
  313. package/dist/es/standards-sdk.es90.js.map +1 -1
  314. package/dist/es/standards-sdk.es91.js +238 -23
  315. package/dist/es/standards-sdk.es91.js.map +1 -1
  316. package/dist/es/standards-sdk.es92.js +267 -225
  317. package/dist/es/standards-sdk.es92.js.map +1 -1
  318. package/dist/es/standards-sdk.es93.js +95 -220
  319. package/dist/es/standards-sdk.es93.js.map +1 -1
  320. package/dist/es/standards-sdk.es94.js +124 -136
  321. package/dist/es/standards-sdk.es94.js.map +1 -1
  322. package/dist/es/standards-sdk.es95.js +42 -138
  323. package/dist/es/standards-sdk.es95.js.map +1 -1
  324. package/dist/es/standards-sdk.es96.js +259 -43
  325. package/dist/es/standards-sdk.es96.js.map +1 -1
  326. package/dist/es/standards-sdk.es97.js +82 -245
  327. package/dist/es/standards-sdk.es97.js.map +1 -1
  328. package/dist/es/standards-sdk.es98.js +49 -50
  329. package/dist/es/standards-sdk.es98.js.map +1 -1
  330. package/dist/es/standards-sdk.es99.js +29 -100
  331. package/dist/es/standards-sdk.es99.js.map +1 -1
  332. package/dist/es/utils/dynamic-import.d.ts +5 -1
  333. package/dist/es/utils/dynamic-import.d.ts.map +1 -1
  334. package/package.json +4 -4
  335. package/dist/cjs/patches/topic-autorenew-patch.d.ts +0 -2
  336. package/dist/cjs/patches/topic-autorenew-patch.d.ts.map +0 -1
  337. package/dist/es/patches/topic-autorenew-patch.d.ts +0 -2
  338. package/dist/es/patches/topic-autorenew-patch.d.ts.map +0 -1
  339. package/dist/es/standards-sdk.es161.js +0 -247
  340. package/dist/es/standards-sdk.es161.js.map +0 -1
@@ -1,409 +1,477 @@
1
- class BlockStateManager {
2
- constructor(logger) {
3
- this.blockStates = /* @__PURE__ */ new Map();
4
- this.stateListeners = /* @__PURE__ */ new Map();
5
- this.messageHandlers = /* @__PURE__ */ new Map();
6
- this.schemas = /* @__PURE__ */ new Map();
7
- this.persistentBlocks = /* @__PURE__ */ new Set();
8
- this.unusedBlocks = /* @__PURE__ */ new Set();
9
- this.maxBlockStates = 1e3;
1
+ import { WasmExecutor } from "./standards-sdk.es51.js";
2
+ import { HashLinkScanner } from "./standards-sdk.es49.js";
3
+ import { HashLinkResolver } from "./standards-sdk.es50.js";
4
+ class BlockRenderer {
5
+ constructor(logger, gutenbergBridge, templateEngine, stateManager) {
6
+ this.MAX_DEPTH = 10;
10
7
  this.logger = logger;
8
+ this.gutenbergBridge = gutenbergBridge;
9
+ this.templateEngine = templateEngine;
10
+ this.stateManager = stateManager;
11
+ this.hashLinkScanner = new HashLinkScanner(logger);
11
12
  }
12
13
  /**
13
- * Create isolated state for a block instance
14
+ * Render a block
14
15
  */
15
- createBlockState(blockId, initialState) {
16
- this.logger.debug("Creating block state", { blockId });
17
- if (this.schemas.has(blockId)) {
18
- this.validateState(blockId, initialState);
19
- }
20
- while (this.blockStates.size >= this.maxBlockStates) {
21
- if (this.unusedBlocks.size > 0) {
22
- this.cleanupUnusedStates();
23
- } else {
24
- this.evictOldestBlock();
16
+ async render(block, options = {}) {
17
+ try {
18
+ this.currentBlock = block;
19
+ this.currentOptions = options;
20
+ if (options.assembly) {
21
+ this.assembly = options.assembly;
25
22
  }
26
- }
27
- this.blockStates.set(blockId, { ...initialState });
28
- this.logger.debug("Block state created", {
29
- blockId,
30
- stateKeys: Object.keys(initialState)
31
- });
32
- }
33
- /**
34
- * Get current state for a block
35
- */
36
- getBlockState(blockId) {
37
- if (!this.blockStates.has(blockId)) {
38
- return null;
39
- }
40
- return { ...this.blockStates.get(blockId) };
41
- }
42
- /**
43
- * Check if block state exists
44
- */
45
- hasBlockState(blockId) {
46
- return this.blockStates.has(blockId);
47
- }
48
- /**
49
- * Update block state and emit events
50
- */
51
- updateBlockState(blockId, updates) {
52
- if (!this.blockStates.has(blockId)) {
53
- throw new Error(`Block state not found: ${blockId}`);
54
- }
55
- const oldState = { ...this.blockStates.get(blockId) };
56
- const newState = { ...oldState, ...updates };
57
- if (this.schemas.has(blockId)) {
58
- this.validateState(blockId, newState);
59
- }
60
- this.blockStates.set(blockId, newState);
61
- const listeners = this.stateListeners.get(blockId) || [];
62
- for (const listener of listeners) {
63
- try {
64
- listener(newState, oldState, blockId);
65
- } catch (error) {
66
- this.logger.error("State change listener error", { blockId, error });
23
+ if (options.actionRegistry) {
24
+ this.actionRegistry = options.actionRegistry;
67
25
  }
68
- }
69
- this.logger.debug("Block state updated", { blockId, updates });
70
- }
71
- /**
72
- * Destroy block state and cleanup
73
- */
74
- destroyBlockState(blockId) {
75
- this.logger.debug("Destroying block state", { blockId });
76
- this.blockStates.delete(blockId);
77
- this.stateListeners.delete(blockId);
78
- this.messageHandlers.delete(blockId);
79
- this.schemas.delete(blockId);
80
- this.persistentBlocks.delete(blockId);
81
- this.unusedBlocks.delete(blockId);
82
- this.logger.debug("Block state destroyed", { blockId });
83
- }
84
- /**
85
- * Listen for state changes on a block
86
- */
87
- onStateChange(blockId, listener) {
88
- if (!this.stateListeners.has(blockId)) {
89
- this.stateListeners.set(blockId, []);
90
- }
91
- this.stateListeners.get(blockId).push(listener);
92
- }
93
- /**
94
- * Remove state change listener
95
- */
96
- removeStateChangeListener(blockId, listener) {
97
- const listeners = this.stateListeners.get(blockId);
98
- if (listeners) {
99
- const index = listeners.indexOf(listener);
100
- if (index > -1) {
101
- listeners.splice(index, 1);
26
+ if (options.network && !this.wasmExecutor) {
27
+ this.wasmExecutor = new WasmExecutor(this.logger, options.network);
102
28
  }
29
+ if (options.initialState) {
30
+ this.stateManager.setBlockState(block.id, options.initialState);
31
+ }
32
+ let state = this.stateManager.getBlockState(block.id) || {
33
+ attributes: {},
34
+ actionResults: {}
35
+ };
36
+ if (!state.attributes || typeof state.attributes !== "object") {
37
+ this.logger.warn("Invalid state structure, fixing...", { state });
38
+ state = {
39
+ attributes: state || {},
40
+ actionResults: {}
41
+ };
42
+ }
43
+ let actions = {};
44
+ let attributes = block.attributes || {};
45
+ if (this.assembly) {
46
+ const assemblyBlock = this.assembly.state?.blocks?.find(
47
+ (b) => b.block_t_id === block.id || b.block_t_id === block.t_id
48
+ );
49
+ if (assemblyBlock) {
50
+ actions = assemblyBlock.actions || {};
51
+ attributes = {
52
+ ...assemblyBlock.attributes,
53
+ ...attributes
54
+ };
55
+ }
56
+ }
57
+ const defaultAttributes = {};
58
+ if (block.attributes) {
59
+ Object.entries(block.attributes).forEach(
60
+ ([key, attrDef]) => {
61
+ if (attrDef && typeof attrDef === "object" && "default" in attrDef) {
62
+ defaultAttributes[key] = attrDef.default;
63
+ }
64
+ }
65
+ );
66
+ }
67
+ const mergedAttributes = { ...defaultAttributes };
68
+ if (attributes && typeof attributes === "object") {
69
+ Object.entries(attributes).forEach(([key, value]) => {
70
+ if (typeof value !== "object" || value === null) {
71
+ mergedAttributes[key] = value;
72
+ }
73
+ });
74
+ }
75
+ if (state.attributes && typeof state.attributes === "object") {
76
+ Object.entries(state.attributes).forEach(([key, value]) => {
77
+ if (typeof value !== "object" || value === null) {
78
+ mergedAttributes[key] = value;
79
+ }
80
+ });
81
+ }
82
+ state.attributes = { ...mergedAttributes };
83
+ this.stateManager.setBlockState(block.id, state);
84
+ const templateContext = {
85
+ attributes: mergedAttributes,
86
+ actions,
87
+ blockId: block.id,
88
+ actionResults: state.actionResults || {}
89
+ };
90
+ this.logger.debug("Template context", {
91
+ blockId: block.id,
92
+ attributes: templateContext.attributes,
93
+ hasActions: !!actions,
94
+ actionKeys: Object.keys(actions),
95
+ rawState: state,
96
+ mergedAttributes
97
+ });
98
+ let html = await this.templateEngine.render(
99
+ block.template || "",
100
+ templateContext
101
+ );
102
+ if (this.shouldProcessHashLinks(options)) {
103
+ html = await this.processHashLinks(html, block, options);
104
+ }
105
+ if (options.container && typeof window !== "undefined") {
106
+ const container = typeof options.container === "string" ? document.querySelector(options.container) : options.container;
107
+ if (container instanceof HTMLElement) {
108
+ container.innerHTML = html;
109
+ if (block.styles) {
110
+ this.applyStyles(block.id, block.styles);
111
+ }
112
+ this.setupEventHandlers(container, block.id);
113
+ return {
114
+ element: container,
115
+ html,
116
+ cleanup: () => this.cleanup(block.id)
117
+ };
118
+ }
119
+ }
120
+ return { html };
121
+ } catch (error) {
122
+ this.logger.error("Block render failed", {
123
+ blockId: block.id,
124
+ error
125
+ });
126
+ throw error;
103
127
  }
104
128
  }
105
129
  /**
106
- * Listen for messages sent to a block
130
+ * Apply block styles
107
131
  */
108
- onBlockMessage(blockId, handler) {
109
- if (!this.messageHandlers.has(blockId)) {
110
- this.messageHandlers.set(blockId, []);
132
+ applyStyles(blockId, styles) {
133
+ if (typeof document === "undefined") return;
134
+ const styleId = `hashlink-styles-${blockId}`;
135
+ let styleElement = document.getElementById(styleId);
136
+ if (!styleElement) {
137
+ styleElement = document.createElement("style");
138
+ styleElement.id = styleId;
139
+ document.head.appendChild(styleElement);
111
140
  }
112
- this.messageHandlers.get(blockId).push(handler);
141
+ styleElement.textContent = styles;
113
142
  }
114
143
  /**
115
- * Send message from one block to another
144
+ * Setup event handlers for block
116
145
  */
117
- sendBlockMessage(fromBlock, toBlock, type, payload) {
118
- const message = {
119
- type,
120
- payload,
121
- fromBlock,
122
- toBlock
123
- };
124
- const handlers = this.messageHandlers.get(toBlock) || [];
125
- for (const handler of handlers) {
126
- try {
127
- handler(message);
128
- } catch (error) {
129
- this.logger.error("Block message handler error", {
130
- fromBlock,
131
- toBlock,
132
- type,
133
- error
146
+ setupEventHandlers(container, blockId) {
147
+ this.stateManager.onStateChange(blockId, (state) => {
148
+ this.updateBlockUI(container, state);
149
+ });
150
+ container.querySelectorAll("[data-action]").forEach((element) => {
151
+ element.addEventListener("click", async (e) => {
152
+ e.preventDefault();
153
+ const actionTopicId = element.dataset.action;
154
+ const paramsStr = element.dataset.params;
155
+ this.logger.debug("Action button clicked", {
156
+ actionTopicId,
157
+ paramsStr,
158
+ hasAction: !!actionTopicId
134
159
  });
135
- }
136
- }
137
- this.logger.debug("Block message sent", { fromBlock, toBlock, type });
138
- }
139
- /**
140
- * Broadcast message to all blocks
141
- */
142
- broadcastMessage(type, payload) {
143
- for (const blockId of this.blockStates.keys()) {
144
- const handlers = this.messageHandlers.get(blockId) || [];
145
- const message = {
146
- type,
147
- payload,
148
- fromBlock: "system",
149
- toBlock: blockId
150
- };
151
- for (const handler of handlers) {
152
- try {
153
- handler(message);
154
- } catch (error) {
155
- this.logger.error("Broadcast message handler error", {
156
- blockId,
157
- type,
158
- error
159
- });
160
+ if (actionTopicId) {
161
+ await this.executeAction(blockId, actionTopicId, paramsStr);
160
162
  }
161
- }
162
- }
163
- this.logger.debug("Message broadcasted", {
164
- type,
165
- blockCount: this.blockStates.size
163
+ });
166
164
  });
167
165
  }
168
166
  /**
169
- * Bind action result to block state
167
+ * Update the block display by re-rendering with new state
170
168
  */
171
- async bindActionResult(blockId, actionName, result, binding) {
172
- if (!this.blockStates.has(blockId)) {
173
- throw new Error(`Block state not found: ${blockId}`);
174
- }
175
- const currentState = this.getBlockState(blockId);
176
- let newState;
169
+ async updateBlockDisplay(blockId, newState) {
177
170
  try {
178
- if (result.success && binding.onSuccess) {
179
- newState = binding.onSuccess(currentState, result);
180
- } else if (!result.success && binding.onError) {
181
- newState = binding.onError(currentState, result);
182
- } else {
171
+ this.logger.debug("updateBlockDisplay called", { blockId, newState });
172
+ const blockElement = document.querySelector(
173
+ `[data-block-id="${blockId}"]`
174
+ );
175
+ if (!blockElement || !blockElement.parentElement) {
176
+ this.logger.warn("Block element not found for re-render", { blockId });
183
177
  return;
184
178
  }
185
- if (newState) {
186
- this.updateBlockState(blockId, newState);
179
+ const container = blockElement.parentElement;
180
+ if (this.currentBlock && this.currentBlock.id === blockId && this.currentOptions) {
181
+ const updatedOptions = {
182
+ ...this.currentOptions,
183
+ container,
184
+ initialState: newState
185
+ };
186
+ const renderResult = await this.render(
187
+ this.currentBlock,
188
+ updatedOptions
189
+ );
190
+ this.logger.debug("Block re-rendered with updated state", {
191
+ blockId,
192
+ newState
193
+ });
194
+ } else {
187
195
  }
188
- this.logger.debug("Action result bound to state", {
189
- blockId,
190
- actionName,
191
- success: result.success
192
- });
193
196
  } catch (error) {
194
- this.logger.error("Action result binding failed", {
197
+ this.logger.error("Failed to re-render block", {
195
198
  blockId,
196
- actionName,
197
- error
199
+ error: error.message
198
200
  });
199
- throw error;
200
- }
201
- }
202
- /**
203
- * Persist block state to storage
204
- */
205
- async persistBlockState(blockId) {
206
- if (!this.storageBackend) {
207
- this.logger.warn("No storage backend configured");
208
- this.persistentBlocks.add(blockId);
209
- return;
210
- }
211
- if (!this.blockStates.has(blockId)) {
212
- throw new Error(`Block state not found: ${blockId}`);
213
- }
214
- try {
215
- const state = this.blockStates.get(blockId);
216
- await this.storageBackend.setItem(blockId, JSON.stringify(state));
217
- this.persistentBlocks.add(blockId);
218
- this.logger.debug("Block state persisted", { blockId });
219
- } catch (error) {
220
- this.logger.error("Failed to persist block state", { blockId, error });
221
201
  }
222
202
  }
223
203
  /**
224
- * Restore block state from storage
204
+ * Execute a WASM action
225
205
  */
226
- async restoreBlockState(blockId) {
227
- if (!this.storageBackend) {
228
- this.logger.warn("No storage backend configured");
229
- return;
230
- }
206
+ async executeAction(blockId, actionTopicId, paramsStr) {
231
207
  try {
232
- const stored = await this.storageBackend.getItem(blockId);
233
- if (stored) {
234
- const state = JSON.parse(stored);
235
- this.blockStates.set(blockId, state);
236
- this.persistentBlocks.add(blockId);
237
- this.logger.debug("Block state restored", { blockId });
208
+ this.logger.debug("Executing action", { blockId, actionTopicId });
209
+ let params = {};
210
+ if (paramsStr) {
211
+ try {
212
+ params = JSON.parse(paramsStr);
213
+ } catch (e) {
214
+ this.logger.warn("Failed to parse action params", { paramsStr });
215
+ }
216
+ }
217
+ const currentState = this.stateManager.getBlockState(blockId) || {
218
+ attributes: {},
219
+ actionResults: {}
220
+ };
221
+ if (this.wasmExecutor && this.actionRegistry) {
222
+ this.logger.debug("Looking up action in registry", { actionTopicId });
223
+ const action = await this.actionRegistry.getActionByTopicId(actionTopicId);
224
+ this.logger.debug("Action lookup result", {
225
+ found: !!action,
226
+ actionTopicId,
227
+ actionData: action
228
+ });
229
+ if (!action) {
230
+ throw new Error(`Action not found: ${actionTopicId}`);
231
+ }
232
+ this.logger.debug("Executing WASM", {
233
+ actionData: action,
234
+ params,
235
+ state: currentState.attributes
236
+ });
237
+ const result = await this.wasmExecutor.execute(action, {
238
+ method: "POST",
239
+ params,
240
+ state: currentState.attributes
241
+ });
242
+ this.logger.debug("WASM execution result", { result });
243
+ if (result.success && result.data) {
244
+ const operation = params.operation || "default";
245
+ let wasmData = result.data;
246
+ if (wasmData.success && wasmData.data) {
247
+ wasmData = wasmData.data;
248
+ }
249
+ const newState = {
250
+ ...currentState,
251
+ attributes: {
252
+ ...currentState.attributes,
253
+ ...wasmData
254
+ },
255
+ actionResults: {
256
+ ...currentState.actionResults,
257
+ [operation]: wasmData
258
+ }
259
+ };
260
+ this.stateManager.updateBlockState(blockId, newState);
261
+ await this.updateBlockDisplay(blockId, newState);
262
+ } else {
263
+ this.logger.error("Action execution failed", { result });
264
+ }
265
+ } else {
266
+ this.stateManager.sendMessage(blockId, "action", {
267
+ action: actionTopicId,
268
+ params
269
+ });
238
270
  }
239
271
  } catch (error) {
240
- this.logger.error("Failed to restore block state", { blockId, error });
272
+ this.logger.error("Failed to execute action", {
273
+ blockId,
274
+ actionTopicId,
275
+ error: error.message
276
+ });
277
+ this.stateManager.sendMessage(blockId, "action-error", {
278
+ action: actionTopicId,
279
+ error: error.message
280
+ });
241
281
  }
242
282
  }
243
283
  /**
244
- * Check if block state is persistent
245
- */
246
- isPersistent(blockId) {
247
- return this.persistentBlocks.has(blockId);
248
- }
249
- /**
250
- * Set storage backend
284
+ * Update block UI on state change
251
285
  */
252
- setStorageBackend(backend) {
253
- this.storageBackend = backend;
254
- }
255
- /**
256
- * Set validation schema for a block
257
- */
258
- setBlockStateSchema(blockId, schema) {
259
- this.schemas.set(blockId, schema);
260
- this.logger.debug("Block state schema set", { blockId });
261
- }
262
- /**
263
- * Set maximum number of block states
264
- */
265
- setMaxBlockStates(max) {
266
- this.maxBlockStates = max;
267
- }
268
- /**
269
- * Get active block count
270
- */
271
- getActiveBlockCount() {
272
- return this.blockStates.size;
286
+ updateBlockUI(container, state) {
287
+ Object.entries(state).forEach(([key, value]) => {
288
+ const elements = container.querySelectorAll(`[data-bind="${key}"]`);
289
+ elements.forEach((element) => {
290
+ if (element instanceof HTMLElement) {
291
+ element.textContent = String(value);
292
+ }
293
+ });
294
+ });
273
295
  }
274
296
  /**
275
- * Mark block as unused for cleanup
297
+ * Cleanup block resources
276
298
  */
277
- markBlockUnused(blockId) {
278
- this.unusedBlocks.add(blockId);
299
+ cleanup(blockId) {
300
+ const styleElement = document.getElementById(`hashlink-styles-${blockId}`);
301
+ if (styleElement) {
302
+ styleElement.remove();
303
+ }
304
+ this.stateManager.removeBlockState(blockId);
279
305
  }
280
306
  /**
281
- * Clean up unused block states
307
+ * Check if HashLink processing should be enabled
282
308
  */
283
- cleanupUnusedStates() {
284
- for (const blockId of this.unusedBlocks) {
285
- this.destroyBlockState(blockId);
309
+ shouldProcessHashLinks(options) {
310
+ const depth = options.depth || 0;
311
+ const maxDepth = options.maxDepth || this.MAX_DEPTH;
312
+ if (depth >= maxDepth) {
313
+ this.logger.warn(
314
+ "Max render depth reached, skipping HashLink processing",
315
+ {
316
+ depth,
317
+ maxDepth
318
+ }
319
+ );
320
+ return false;
286
321
  }
287
- this.unusedBlocks.clear();
288
- this.logger.debug("Unused states cleaned up");
322
+ return !!(options.network && (options.blockLoader || this.blockLoader));
289
323
  }
290
324
  /**
291
- * Evict oldest non-persistent block to make room
325
+ * Initialize HashLink resolver if needed
292
326
  */
293
- evictOldestBlock() {
294
- for (const blockId of this.blockStates.keys()) {
295
- if (!this.persistentBlocks.has(blockId)) {
296
- this.destroyBlockState(blockId);
297
- this.logger.debug("Evicted block to make room", { blockId });
298
- return;
327
+ ensureHashLinkResolver(options) {
328
+ if (!this.hashLinkResolver && options.network) {
329
+ this.blockLoader = options.blockLoader || this.blockLoader;
330
+ this.hrlResolver = options.hrlResolver || this.hrlResolver;
331
+ if (this.blockLoader && this.hrlResolver) {
332
+ this.hashLinkResolver = new HashLinkResolver(
333
+ this.logger,
334
+ this.blockLoader,
335
+ this.hrlResolver,
336
+ options.network
337
+ );
299
338
  }
300
339
  }
301
- this.logger.warn("Cannot evict blocks - all are persistent");
302
- }
303
- /**
304
- * Get listener count for a block (for testing)
305
- */
306
- getListenerCount(blockId) {
307
- const stateListeners = this.stateListeners.get(blockId)?.length || 0;
308
- const messageHandlers = this.messageHandlers.get(blockId)?.length || 0;
309
- return stateListeners + messageHandlers;
310
340
  }
311
341
  /**
312
- * Validate state against schema
342
+ * Process HashLinks in rendered HTML
313
343
  */
314
- validateState(blockId, state) {
315
- const schema = this.schemas.get(blockId);
316
- if (!schema) return;
317
- if (schema.type === "object") {
318
- if (typeof state !== "object" || state === null) {
319
- throw new Error("State validation failed: expected object");
344
+ async processHashLinks(html, parentBlock, options) {
345
+ this.ensureHashLinkResolver(options);
346
+ if (!this.hashLinkResolver) {
347
+ this.logger.warn("HashLink resolver not available, skipping processing");
348
+ return html;
349
+ }
350
+ this.hashLinkResolver.pushRenderStack(parentBlock.id);
351
+ try {
352
+ const references = await this.hashLinkScanner.scanTemplate(html);
353
+ if (references.length === 0) {
354
+ return html;
320
355
  }
321
- if (schema.required) {
322
- for (const prop of schema.required) {
323
- if (!(prop in state)) {
324
- throw new Error(
325
- `State validation failed: missing required property '${prop}'`
326
- );
327
- }
356
+ this.logger.debug("Processing HashLinks", {
357
+ parentBlockId: parentBlock.id,
358
+ referenceCount: references.length
359
+ });
360
+ const parentContext = {
361
+ blockId: parentBlock.id,
362
+ depth: (options.depth || 0) + 1,
363
+ parentContext: options.parentContext,
364
+ attributes: options.initialState?.attributes || {},
365
+ actions: {},
366
+ assembly: this.assembly,
367
+ maxDepth: options.maxDepth || this.MAX_DEPTH
368
+ };
369
+ if (this.assembly) {
370
+ const assemblyBlock = this.assembly.state?.blocks?.find(
371
+ (b) => b.block_t_id === parentBlock.id || b.block_t_id === parentBlock.t_id
372
+ );
373
+ if (assemblyBlock?.actions) {
374
+ parentContext.actions = assemblyBlock.actions;
328
375
  }
329
376
  }
330
- if (schema.properties) {
331
- for (const [prop, propSchema] of Object.entries(schema.properties)) {
332
- if (prop in state) {
333
- const value = state[prop];
334
- const expectedType = propSchema.type;
335
- if (expectedType === "string" && typeof value !== "string") {
336
- throw new Error(
337
- `State validation failed: property '${prop}' must be string`
338
- );
339
- }
340
- if (expectedType === "number" && typeof value !== "number") {
341
- throw new Error(
342
- `State validation failed: property '${prop}' must be number`
377
+ let processedHtml = html;
378
+ for (let i = 0; i < references.length; i++) {
379
+ const ref = references[i];
380
+ try {
381
+ const resolved = await this.hashLinkResolver.resolveReference(
382
+ ref,
383
+ parentContext
384
+ );
385
+ if (resolved.error) {
386
+ this.logger.error("Failed to resolve HashLink", {
387
+ uri: ref.uri,
388
+ error: resolved.error
389
+ });
390
+ const errorHtml = `<!-- HashLink Error: ${resolved.error} -->`;
391
+ processedHtml = processedHtml.replace(ref.placeholder, errorHtml);
392
+ continue;
393
+ }
394
+ let childHtml;
395
+ if (resolved.definition) {
396
+ const childBlock = {
397
+ id: resolved.blockId,
398
+ template: resolved.template || "",
399
+ attributes: resolved.definition.attributes,
400
+ p: "hcs-12",
401
+ op: "register",
402
+ name: resolved.definition.name,
403
+ version: "1.0.0",
404
+ title: resolved.definition.title,
405
+ description: resolved.definition.description
406
+ };
407
+ const childState = {
408
+ attributes: resolved.attributes,
409
+ actionResults: {}
410
+ };
411
+ const childTemplateContext = {
412
+ attributes: resolved.attributes,
413
+ actions: resolved.actions,
414
+ blockId: resolved.blockId,
415
+ actionResults: {}
416
+ };
417
+ if (resolved.template) {
418
+ childHtml = await this.templateEngine.render(
419
+ resolved.template,
420
+ childTemplateContext
343
421
  );
344
- }
345
- if (expectedType === "number" && propSchema.minimum !== void 0) {
346
- if (value < propSchema.minimum) {
347
- throw new Error(
348
- `State validation failed: property '${prop}' below minimum`
422
+ const childOptions = {
423
+ ...options,
424
+ depth: parentContext.depth,
425
+ parentContext,
426
+ initialState: childState
427
+ };
428
+ if (this.shouldProcessHashLinks(childOptions)) {
429
+ childHtml = await this.processHashLinks(
430
+ childHtml,
431
+ childBlock,
432
+ childOptions
349
433
  );
350
434
  }
435
+ } else {
436
+ childHtml = "<!-- Block has no template -->";
351
437
  }
438
+ } else if (resolved.template) {
439
+ childHtml = resolved.template;
440
+ } else {
441
+ childHtml = "<!-- Empty block -->";
442
+ }
443
+ if (ref.loading === "lazy") {
444
+ childHtml = this.wrapLazyLoad(childHtml, ref);
352
445
  }
446
+ processedHtml = processedHtml.replace(ref.placeholder, childHtml);
447
+ } catch (error) {
448
+ this.logger.error("Error processing HashLink", {
449
+ uri: ref.uri,
450
+ error: error.message
451
+ });
452
+ const errorHtml = `<!-- HashLink Error: ${error.message} -->`;
453
+ processedHtml = processedHtml.replace(ref.placeholder, errorHtml);
353
454
  }
354
455
  }
456
+ return processedHtml;
457
+ } finally {
458
+ this.hashLinkResolver.popRenderStack(parentBlock.id);
355
459
  }
356
460
  }
357
461
  /**
358
- * Set block state (alias for updateBlockState)
359
- */
360
- setBlockState(blockId, state) {
361
- if (!this.blockStates.has(blockId)) {
362
- this.createBlockState(blockId, state);
363
- } else {
364
- this.updateBlockState(blockId, state);
365
- }
366
- }
367
- /**
368
- * Remove block state
462
+ * Wrap content for lazy loading
369
463
  */
370
- removeBlockState(blockId) {
371
- this.blockStates.delete(blockId);
372
- this.stateListeners.delete(blockId);
373
- this.messageHandlers.delete(blockId);
374
- this.persistentBlocks.delete(blockId);
375
- this.schemas.delete(blockId);
376
- if (this.storageBackend) {
377
- this.storageBackend.removeItem(blockId).catch((error) => {
378
- this.logger.error("Failed to remove persisted state", {
379
- blockId,
380
- error
381
- });
382
- });
383
- }
384
- this.logger.debug("Block state removed", { blockId });
385
- }
386
- /**
387
- * Send message to a block
388
- */
389
- sendMessage(blockId, type, data, fromBlock = "system") {
390
- const handlers = this.messageHandlers.get(blockId) || [];
391
- const message = {
392
- type,
393
- payload: data,
394
- fromBlock,
395
- toBlock: blockId
396
- };
397
- for (const handler of handlers) {
398
- try {
399
- handler(message);
400
- } catch (error) {
401
- this.logger.error("Message handler error", { blockId, type, error });
402
- }
403
- }
464
+ wrapLazyLoad(html, ref) {
465
+ const wrapperId = `lazy-${ref.uri.replace(/[^a-zA-Z0-9]/g, "-")}`;
466
+ return `
467
+ <div id="${wrapperId}" class="hashlink-lazy-container" data-hashlink-lazy="${ref.uri}">
468
+ <div class="hashlink-lazy-placeholder">Loading...</div>
469
+ <template class="hashlink-lazy-content">${html}</template>
470
+ </div>
471
+ `;
404
472
  }
405
473
  }
406
474
  export {
407
- BlockStateManager
475
+ BlockRenderer
408
476
  };
409
477
  //# sourceMappingURL=standards-sdk.es48.js.map