@hashgraphonline/standards-sdk 0.1.144 → 0.1.146-feat-rb-inscriber.canary.5cd93f8.85

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 (433) hide show
  1. package/dist/cjs/hcs-10/base-client.d.ts.map +1 -1
  2. package/dist/cjs/hcs-10/sdk.d.ts +8 -0
  3. package/dist/cjs/hcs-10/sdk.d.ts.map +1 -1
  4. package/dist/cjs/hcs-11/client.d.ts +2 -2
  5. package/dist/cjs/hcs-11/client.d.ts.map +1 -1
  6. package/dist/cjs/hcs-11/person-builder.d.ts +1 -0
  7. package/dist/cjs/hcs-11/person-builder.d.ts.map +1 -1
  8. package/dist/cjs/hcs-11/types.d.ts +1 -0
  9. package/dist/cjs/hcs-11/types.d.ts.map +1 -1
  10. package/dist/cjs/hcs-12/rendering/resource-manager.d.ts.map +1 -1
  11. package/dist/cjs/hcs-14/issuers/hiero.d.ts.map +1 -1
  12. package/dist/cjs/hcs-15/browser.d.ts +2 -0
  13. package/dist/cjs/hcs-15/browser.d.ts.map +1 -1
  14. package/dist/cjs/hcs-15/sdk.d.ts +7 -1
  15. package/dist/cjs/hcs-15/sdk.d.ts.map +1 -1
  16. package/dist/cjs/hcs-15/tx.d.ts +4 -0
  17. package/dist/cjs/hcs-15/tx.d.ts.map +1 -1
  18. package/dist/cjs/hcs-15/types.d.ts +16 -1
  19. package/dist/cjs/hcs-15/types.d.ts.map +1 -1
  20. package/dist/cjs/hcs-16/browser.d.ts +11 -2
  21. package/dist/cjs/hcs-16/browser.d.ts.map +1 -1
  22. package/dist/cjs/hcs-16/sdk.d.ts +62 -1
  23. package/dist/cjs/hcs-16/sdk.d.ts.map +1 -1
  24. package/dist/cjs/hcs-16/tx.d.ts +21 -3
  25. package/dist/cjs/hcs-16/tx.d.ts.map +1 -1
  26. package/dist/cjs/hcs-17/base-client.d.ts +1 -0
  27. package/dist/cjs/hcs-17/base-client.d.ts.map +1 -1
  28. package/dist/cjs/hcs-17/sdk.d.ts.map +1 -1
  29. package/dist/cjs/hcs-17/tx.d.ts +2 -0
  30. package/dist/cjs/hcs-17/tx.d.ts.map +1 -1
  31. package/dist/cjs/hcs-17/types.d.ts +4 -0
  32. package/dist/cjs/hcs-17/types.d.ts.map +1 -1
  33. package/dist/cjs/hcs-7/types.d.ts +4 -4
  34. package/dist/cjs/index.d.ts.map +1 -1
  35. package/dist/cjs/inscribe/inscriber.d.ts +89 -0
  36. package/dist/cjs/inscribe/inscriber.d.ts.map +1 -1
  37. package/dist/cjs/services/registry-broker/client/base-client.d.ts +14 -1
  38. package/dist/cjs/services/registry-broker/client/base-client.d.ts.map +1 -1
  39. package/dist/cjs/services/registry-broker/client/feedback.d.ts +2 -0
  40. package/dist/cjs/services/registry-broker/client/feedback.d.ts.map +1 -0
  41. package/dist/cjs/services/registry-broker/hol-chat-ops.d.ts +24 -0
  42. package/dist/cjs/services/registry-broker/hol-chat-ops.d.ts.map +1 -0
  43. package/dist/cjs/services/registry-broker/index.d.ts +1 -0
  44. package/dist/cjs/services/registry-broker/index.d.ts.map +1 -1
  45. package/dist/cjs/services/registry-broker/private-key-signer.d.ts +1 -0
  46. package/dist/cjs/services/registry-broker/private-key-signer.d.ts.map +1 -1
  47. package/dist/cjs/services/registry-broker/schemas.d.ts +1001 -577
  48. package/dist/cjs/services/registry-broker/schemas.d.ts.map +1 -1
  49. package/dist/cjs/services/registry-broker/types.d.ts +20 -1
  50. package/dist/cjs/services/registry-broker/types.d.ts.map +1 -1
  51. package/dist/cjs/standards-sdk.cjs +3 -3
  52. package/dist/cjs/standards-sdk.cjs.map +1 -1
  53. package/dist/cjs/utils/crypto-abstraction.d.ts.map +1 -1
  54. package/dist/cjs/utils/crypto-env.d.ts.map +1 -1
  55. package/dist/cjs/utils/dynamic-import.d.ts +5 -1
  56. package/dist/cjs/utils/dynamic-import.d.ts.map +1 -1
  57. package/dist/cjs/utils/hash-adapter.d.ts.map +1 -1
  58. package/dist/es/hcs-10/base-client.d.ts.map +1 -1
  59. package/dist/es/hcs-10/sdk.d.ts +8 -0
  60. package/dist/es/hcs-10/sdk.d.ts.map +1 -1
  61. package/dist/es/hcs-11/client.d.ts +2 -2
  62. package/dist/es/hcs-11/client.d.ts.map +1 -1
  63. package/dist/es/hcs-11/person-builder.d.ts +1 -0
  64. package/dist/es/hcs-11/person-builder.d.ts.map +1 -1
  65. package/dist/es/hcs-11/types.d.ts +1 -0
  66. package/dist/es/hcs-11/types.d.ts.map +1 -1
  67. package/dist/es/hcs-12/rendering/resource-manager.d.ts.map +1 -1
  68. package/dist/es/hcs-14/issuers/hiero.d.ts.map +1 -1
  69. package/dist/es/hcs-15/browser.d.ts +2 -0
  70. package/dist/es/hcs-15/browser.d.ts.map +1 -1
  71. package/dist/es/hcs-15/sdk.d.ts +7 -1
  72. package/dist/es/hcs-15/sdk.d.ts.map +1 -1
  73. package/dist/es/hcs-15/tx.d.ts +4 -0
  74. package/dist/es/hcs-15/tx.d.ts.map +1 -1
  75. package/dist/es/hcs-15/types.d.ts +16 -1
  76. package/dist/es/hcs-15/types.d.ts.map +1 -1
  77. package/dist/es/hcs-16/browser.d.ts +11 -2
  78. package/dist/es/hcs-16/browser.d.ts.map +1 -1
  79. package/dist/es/hcs-16/sdk.d.ts +62 -1
  80. package/dist/es/hcs-16/sdk.d.ts.map +1 -1
  81. package/dist/es/hcs-16/tx.d.ts +21 -3
  82. package/dist/es/hcs-16/tx.d.ts.map +1 -1
  83. package/dist/es/hcs-17/base-client.d.ts +1 -0
  84. package/dist/es/hcs-17/base-client.d.ts.map +1 -1
  85. package/dist/es/hcs-17/sdk.d.ts.map +1 -1
  86. package/dist/es/hcs-17/tx.d.ts +2 -0
  87. package/dist/es/hcs-17/tx.d.ts.map +1 -1
  88. package/dist/es/hcs-17/types.d.ts +4 -0
  89. package/dist/es/hcs-17/types.d.ts.map +1 -1
  90. package/dist/es/hcs-7/types.d.ts +4 -4
  91. package/dist/es/index.d.ts.map +1 -1
  92. package/dist/es/inscribe/inscriber.d.ts +89 -0
  93. package/dist/es/inscribe/inscriber.d.ts.map +1 -1
  94. package/dist/es/services/registry-broker/client/base-client.d.ts +14 -1
  95. package/dist/es/services/registry-broker/client/base-client.d.ts.map +1 -1
  96. package/dist/es/services/registry-broker/client/feedback.d.ts +2 -0
  97. package/dist/es/services/registry-broker/client/feedback.d.ts.map +1 -0
  98. package/dist/es/services/registry-broker/hol-chat-ops.d.ts +24 -0
  99. package/dist/es/services/registry-broker/hol-chat-ops.d.ts.map +1 -0
  100. package/dist/es/services/registry-broker/index.d.ts +1 -0
  101. package/dist/es/services/registry-broker/index.d.ts.map +1 -1
  102. package/dist/es/services/registry-broker/private-key-signer.d.ts +1 -0
  103. package/dist/es/services/registry-broker/private-key-signer.d.ts.map +1 -1
  104. package/dist/es/services/registry-broker/schemas.d.ts +1001 -577
  105. package/dist/es/services/registry-broker/schemas.d.ts.map +1 -1
  106. package/dist/es/services/registry-broker/types.d.ts +20 -1
  107. package/dist/es/services/registry-broker/types.d.ts.map +1 -1
  108. package/dist/es/standards-sdk.es.js +146 -131
  109. package/dist/es/standards-sdk.es10.js +70 -90
  110. package/dist/es/standards-sdk.es10.js.map +1 -1
  111. package/dist/es/standards-sdk.es100.js +229 -26
  112. package/dist/es/standards-sdk.es100.js.map +1 -1
  113. package/dist/es/standards-sdk.es101.js +109 -228
  114. package/dist/es/standards-sdk.es101.js.map +1 -1
  115. package/dist/es/standards-sdk.es102.js +15 -94
  116. package/dist/es/standards-sdk.es102.js.map +1 -1
  117. package/dist/es/standards-sdk.es103.js +80 -30
  118. package/dist/es/standards-sdk.es103.js.map +1 -1
  119. package/dist/es/standards-sdk.es104.js +27 -80
  120. package/dist/es/standards-sdk.es104.js.map +1 -1
  121. package/dist/es/standards-sdk.es105.js +136 -25
  122. package/dist/es/standards-sdk.es105.js.map +1 -1
  123. package/dist/es/standards-sdk.es106.js +27 -140
  124. package/dist/es/standards-sdk.es106.js.map +1 -1
  125. package/dist/es/standards-sdk.es107.js +20 -27
  126. package/dist/es/standards-sdk.es107.js.map +1 -1
  127. package/dist/es/standards-sdk.es108.js +156 -18
  128. package/dist/es/standards-sdk.es108.js.map +1 -1
  129. package/dist/es/standards-sdk.es109.js +198 -148
  130. package/dist/es/standards-sdk.es109.js.map +1 -1
  131. package/dist/es/standards-sdk.es11.js +121 -45
  132. package/dist/es/standards-sdk.es11.js.map +1 -1
  133. package/dist/es/standards-sdk.es110.js +747 -166
  134. package/dist/es/standards-sdk.es110.js.map +1 -1
  135. package/dist/es/standards-sdk.es111.js +9 -786
  136. package/dist/es/standards-sdk.es111.js.map +1 -1
  137. package/dist/es/standards-sdk.es112.js +567 -13
  138. package/dist/es/standards-sdk.es112.js.map +1 -1
  139. package/dist/es/standards-sdk.es113.js +576 -541
  140. package/dist/es/standards-sdk.es113.js.map +1 -1
  141. package/dist/es/standards-sdk.es114.js +12 -601
  142. package/dist/es/standards-sdk.es114.js.map +1 -1
  143. package/dist/es/standards-sdk.es115.js +2 -13
  144. package/dist/es/standards-sdk.es115.js.map +1 -1
  145. package/dist/es/standards-sdk.es116.js +87 -2
  146. package/dist/es/standards-sdk.es116.js.map +1 -1
  147. package/dist/es/standards-sdk.es117.js +37 -80
  148. package/dist/es/standards-sdk.es117.js.map +1 -1
  149. package/dist/es/standards-sdk.es118.js +2 -39
  150. package/dist/es/standards-sdk.es118.js.map +1 -1
  151. package/dist/es/standards-sdk.es119.js +231 -2
  152. package/dist/es/standards-sdk.es119.js.map +1 -1
  153. package/dist/es/standards-sdk.es12.js +60 -159
  154. package/dist/es/standards-sdk.es12.js.map +1 -1
  155. package/dist/es/standards-sdk.es120.js +1110 -193
  156. package/dist/es/standards-sdk.es120.js.map +1 -1
  157. package/dist/es/standards-sdk.es121.js +225 -1059
  158. package/dist/es/standards-sdk.es121.js.map +1 -1
  159. package/dist/es/standards-sdk.es122.js +419 -303
  160. package/dist/es/standards-sdk.es122.js.map +1 -1
  161. package/dist/es/standards-sdk.es123.js +351 -418
  162. package/dist/es/standards-sdk.es123.js.map +1 -1
  163. package/dist/es/standards-sdk.es124.js +1109 -347
  164. package/dist/es/standards-sdk.es124.js.map +1 -1
  165. package/dist/es/standards-sdk.es125.js +182 -854
  166. package/dist/es/standards-sdk.es125.js.map +1 -1
  167. package/dist/es/standards-sdk.es126.js +1512 -153
  168. package/dist/es/standards-sdk.es126.js.map +1 -1
  169. package/dist/es/standards-sdk.es127.js +157 -1547
  170. package/dist/es/standards-sdk.es127.js.map +1 -1
  171. package/dist/es/standards-sdk.es128.js +192 -162
  172. package/dist/es/standards-sdk.es128.js.map +1 -1
  173. package/dist/es/standards-sdk.es129.js +61 -164
  174. package/dist/es/standards-sdk.es129.js.map +1 -1
  175. package/dist/es/standards-sdk.es13.js +200 -60
  176. package/dist/es/standards-sdk.es13.js.map +1 -1
  177. package/dist/es/standards-sdk.es130.js +102 -85
  178. package/dist/es/standards-sdk.es130.js.map +1 -1
  179. package/dist/es/standards-sdk.es131.js +222 -96
  180. package/dist/es/standards-sdk.es131.js.map +1 -1
  181. package/dist/es/standards-sdk.es132.js +153 -220
  182. package/dist/es/standards-sdk.es132.js.map +1 -1
  183. package/dist/es/standards-sdk.es133.js +104 -162
  184. package/dist/es/standards-sdk.es133.js.map +1 -1
  185. package/dist/es/standards-sdk.es134.js +296 -92
  186. package/dist/es/standards-sdk.es134.js.map +1 -1
  187. package/dist/es/standards-sdk.es135.js +432 -294
  188. package/dist/es/standards-sdk.es135.js.map +1 -1
  189. package/dist/es/standards-sdk.es136.js +14 -363
  190. package/dist/es/standards-sdk.es136.js.map +1 -1
  191. package/dist/es/standards-sdk.es137.js +79 -15
  192. package/dist/es/standards-sdk.es137.js.map +1 -1
  193. package/dist/es/standards-sdk.es138.js +79 -59
  194. package/dist/es/standards-sdk.es138.js.map +1 -1
  195. package/dist/es/standards-sdk.es139.js +53 -80
  196. package/dist/es/standards-sdk.es139.js.map +1 -1
  197. package/dist/es/standards-sdk.es14.js +149 -178
  198. package/dist/es/standards-sdk.es14.js.map +1 -1
  199. package/dist/es/standards-sdk.es140.js +1 -1
  200. package/dist/es/standards-sdk.es142.js +1 -1
  201. package/dist/es/standards-sdk.es143.js +1 -1
  202. package/dist/es/standards-sdk.es144.js +30 -28
  203. package/dist/es/standards-sdk.es144.js.map +1 -1
  204. package/dist/es/standards-sdk.es145.js +34 -138
  205. package/dist/es/standards-sdk.es145.js.map +1 -1
  206. package/dist/es/standards-sdk.es146.js +28 -42
  207. package/dist/es/standards-sdk.es146.js.map +1 -1
  208. package/dist/es/standards-sdk.es147.js +105 -12256
  209. package/dist/es/standards-sdk.es147.js.map +1 -1
  210. package/dist/es/standards-sdk.es148.js +40 -15
  211. package/dist/es/standards-sdk.es148.js.map +1 -1
  212. package/dist/es/standards-sdk.es149.js +959 -56
  213. package/dist/es/standards-sdk.es149.js.map +1 -1
  214. package/dist/es/standards-sdk.es15.js +152 -151
  215. package/dist/es/standards-sdk.es15.js.map +1 -1
  216. package/dist/es/standards-sdk.es150.js +12264 -57
  217. package/dist/es/standards-sdk.es150.js.map +1 -1
  218. package/dist/es/standards-sdk.es151.js +51 -167
  219. package/dist/es/standards-sdk.es151.js.map +1 -1
  220. package/dist/es/standards-sdk.es152.js +70 -308
  221. package/dist/es/standards-sdk.es152.js.map +1 -1
  222. package/dist/es/standards-sdk.es153.js +13 -342
  223. package/dist/es/standards-sdk.es153.js.map +1 -1
  224. package/dist/es/standards-sdk.es154.js +129 -410
  225. package/dist/es/standards-sdk.es154.js.map +1 -1
  226. package/dist/es/standards-sdk.es155.js +200 -209
  227. package/dist/es/standards-sdk.es155.js.map +1 -1
  228. package/dist/es/standards-sdk.es156.js +334 -64
  229. package/dist/es/standards-sdk.es156.js.map +1 -1
  230. package/dist/es/standards-sdk.es157.js +453 -871
  231. package/dist/es/standards-sdk.es157.js.map +1 -1
  232. package/dist/es/standards-sdk.es158.js +314 -222
  233. package/dist/es/standards-sdk.es158.js.map +1 -1
  234. package/dist/es/standards-sdk.es159.js +60 -228
  235. package/dist/es/standards-sdk.es159.js.map +1 -1
  236. package/dist/es/standards-sdk.es16.js +917 -136
  237. package/dist/es/standards-sdk.es16.js.map +1 -1
  238. package/dist/es/standards-sdk.es160.js +242 -0
  239. package/dist/es/standards-sdk.es160.js.map +1 -0
  240. package/dist/es/standards-sdk.es161.js +247 -0
  241. package/dist/es/standards-sdk.es161.js.map +1 -0
  242. package/dist/es/standards-sdk.es17.js +23 -944
  243. package/dist/es/standards-sdk.es17.js.map +1 -1
  244. package/dist/es/standards-sdk.es18.js +2422 -24
  245. package/dist/es/standards-sdk.es18.js.map +1 -1
  246. package/dist/es/standards-sdk.es19.js +817 -2071
  247. package/dist/es/standards-sdk.es19.js.map +1 -1
  248. package/dist/es/standards-sdk.es2.js +654 -189
  249. package/dist/es/standards-sdk.es2.js.map +1 -1
  250. package/dist/es/standards-sdk.es20.js +205 -1091
  251. package/dist/es/standards-sdk.es20.js.map +1 -1
  252. package/dist/es/standards-sdk.es21.js +858 -221
  253. package/dist/es/standards-sdk.es21.js.map +1 -1
  254. package/dist/es/standards-sdk.es22.js +179 -903
  255. package/dist/es/standards-sdk.es22.js.map +1 -1
  256. package/dist/es/standards-sdk.es23.js +164 -179
  257. package/dist/es/standards-sdk.es23.js.map +1 -1
  258. package/dist/es/standards-sdk.es24.js +62 -118
  259. package/dist/es/standards-sdk.es24.js.map +1 -1
  260. package/dist/es/standards-sdk.es25.js +377 -52
  261. package/dist/es/standards-sdk.es25.js.map +1 -1
  262. package/dist/es/standards-sdk.es26.js +36 -394
  263. package/dist/es/standards-sdk.es26.js.map +1 -1
  264. package/dist/es/standards-sdk.es27.js +901 -50
  265. package/dist/es/standards-sdk.es27.js.map +1 -1
  266. package/dist/es/standards-sdk.es28.js +134 -902
  267. package/dist/es/standards-sdk.es28.js.map +1 -1
  268. package/dist/es/standards-sdk.es29.js +7 -134
  269. package/dist/es/standards-sdk.es29.js.map +1 -1
  270. package/dist/es/standards-sdk.es3.js +63 -680
  271. package/dist/es/standards-sdk.es3.js.map +1 -1
  272. package/dist/es/standards-sdk.es30.js +344 -7
  273. package/dist/es/standards-sdk.es30.js.map +1 -1
  274. package/dist/es/standards-sdk.es31.js +302 -287
  275. package/dist/es/standards-sdk.es31.js.map +1 -1
  276. package/dist/es/standards-sdk.es32.js +94 -322
  277. package/dist/es/standards-sdk.es32.js.map +1 -1
  278. package/dist/es/standards-sdk.es33.js +458 -101
  279. package/dist/es/standards-sdk.es33.js.map +1 -1
  280. package/dist/es/standards-sdk.es34.js +132 -451
  281. package/dist/es/standards-sdk.es34.js.map +1 -1
  282. package/dist/es/standards-sdk.es35.js +216 -130
  283. package/dist/es/standards-sdk.es35.js.map +1 -1
  284. package/dist/es/standards-sdk.es36.js +273 -195
  285. package/dist/es/standards-sdk.es36.js.map +1 -1
  286. package/dist/es/standards-sdk.es37.js +148 -87
  287. package/dist/es/standards-sdk.es37.js.map +1 -1
  288. package/dist/es/standards-sdk.es38.js +183 -320
  289. package/dist/es/standards-sdk.es38.js.map +1 -1
  290. package/dist/es/standards-sdk.es39.js +238 -161
  291. package/dist/es/standards-sdk.es39.js.map +1 -1
  292. package/dist/es/standards-sdk.es4.js +425 -63
  293. package/dist/es/standards-sdk.es4.js.map +1 -1
  294. package/dist/es/standards-sdk.es40.js +136 -254
  295. package/dist/es/standards-sdk.es40.js.map +1 -1
  296. package/dist/es/standards-sdk.es41.js +225 -176
  297. package/dist/es/standards-sdk.es41.js.map +1 -1
  298. package/dist/es/standards-sdk.es42.js +199 -261
  299. package/dist/es/standards-sdk.es42.js.map +1 -1
  300. package/dist/es/standards-sdk.es43.js +237 -199
  301. package/dist/es/standards-sdk.es43.js.map +1 -1
  302. package/dist/es/standards-sdk.es44.js +209 -201
  303. package/dist/es/standards-sdk.es44.js.map +1 -1
  304. package/dist/es/standards-sdk.es45.js +305 -201
  305. package/dist/es/standards-sdk.es45.js.map +1 -1
  306. package/dist/es/standards-sdk.es46.js +371 -261
  307. package/dist/es/standards-sdk.es46.js.map +1 -1
  308. package/dist/es/standards-sdk.es47.js +316 -371
  309. package/dist/es/standards-sdk.es47.js.map +1 -1
  310. package/dist/es/standards-sdk.es48.js +404 -336
  311. package/dist/es/standards-sdk.es48.js.map +1 -1
  312. package/dist/es/standards-sdk.es49.js +83 -449
  313. package/dist/es/standards-sdk.es49.js.map +1 -1
  314. package/dist/es/standards-sdk.es5.js +232 -354
  315. package/dist/es/standards-sdk.es5.js.map +1 -1
  316. package/dist/es/standards-sdk.es50.js +179 -89
  317. package/dist/es/standards-sdk.es50.js.map +1 -1
  318. package/dist/es/standards-sdk.es51.js +231 -165
  319. package/dist/es/standards-sdk.es51.js.map +1 -1
  320. package/dist/es/standards-sdk.es52.js +25 -262
  321. package/dist/es/standards-sdk.es52.js.map +1 -1
  322. package/dist/es/standards-sdk.es53.js +56 -26
  323. package/dist/es/standards-sdk.es53.js.map +1 -1
  324. package/dist/es/standards-sdk.es54.js +12 -57
  325. package/dist/es/standards-sdk.es54.js.map +1 -1
  326. package/dist/es/standards-sdk.es55.js +49 -12
  327. package/dist/es/standards-sdk.es55.js.map +1 -1
  328. package/dist/es/standards-sdk.es56.js +115 -43
  329. package/dist/es/standards-sdk.es56.js.map +1 -1
  330. package/dist/es/standards-sdk.es57.js +42 -115
  331. package/dist/es/standards-sdk.es57.js.map +1 -1
  332. package/dist/es/standards-sdk.es58.js +52 -43
  333. package/dist/es/standards-sdk.es58.js.map +1 -1
  334. package/dist/es/standards-sdk.es59.js +36 -50
  335. package/dist/es/standards-sdk.es59.js.map +1 -1
  336. package/dist/es/standards-sdk.es6.js +125 -246
  337. package/dist/es/standards-sdk.es6.js.map +1 -1
  338. package/dist/es/standards-sdk.es60.js +207 -39
  339. package/dist/es/standards-sdk.es60.js.map +1 -1
  340. package/dist/es/standards-sdk.es61.js +24 -200
  341. package/dist/es/standards-sdk.es61.js.map +1 -1
  342. package/dist/es/standards-sdk.es62.js +87 -25
  343. package/dist/es/standards-sdk.es62.js.map +1 -1
  344. package/dist/es/standards-sdk.es63.js +3 -51
  345. package/dist/es/standards-sdk.es63.js.map +1 -1
  346. package/dist/es/standards-sdk.es64.js +100 -3
  347. package/dist/es/standards-sdk.es64.js.map +1 -1
  348. package/dist/es/standards-sdk.es65.js +61 -62
  349. package/dist/es/standards-sdk.es65.js.map +1 -1
  350. package/dist/es/standards-sdk.es66.js +17 -98
  351. package/dist/es/standards-sdk.es66.js.map +1 -1
  352. package/dist/es/standards-sdk.es67.js +77 -19
  353. package/dist/es/standards-sdk.es67.js.map +1 -1
  354. package/dist/es/standards-sdk.es68.js +458 -77
  355. package/dist/es/standards-sdk.es68.js.map +1 -1
  356. package/dist/es/standards-sdk.es69.js +106 -240
  357. package/dist/es/standards-sdk.es69.js.map +1 -1
  358. package/dist/es/standards-sdk.es7.js +28 -183
  359. package/dist/es/standards-sdk.es7.js.map +1 -1
  360. package/dist/es/standards-sdk.es70.js +170 -286
  361. package/dist/es/standards-sdk.es70.js.map +1 -1
  362. package/dist/es/standards-sdk.es71.js +71 -207
  363. package/dist/es/standards-sdk.es71.js.map +1 -1
  364. package/dist/es/standards-sdk.es72.js +71 -72
  365. package/dist/es/standards-sdk.es72.js.map +1 -1
  366. package/dist/es/standards-sdk.es73.js +143 -71
  367. package/dist/es/standards-sdk.es73.js.map +1 -1
  368. package/dist/es/standards-sdk.es74.js +62 -136
  369. package/dist/es/standards-sdk.es74.js.map +1 -1
  370. package/dist/es/standards-sdk.es75.js +380 -45
  371. package/dist/es/standards-sdk.es75.js.map +1 -1
  372. package/dist/es/standards-sdk.es76.js +222 -130
  373. package/dist/es/standards-sdk.es76.js.map +1 -1
  374. package/dist/es/standards-sdk.es77.js +320 -444
  375. package/dist/es/standards-sdk.es77.js.map +1 -1
  376. package/dist/es/standards-sdk.es78.js +88 -370
  377. package/dist/es/standards-sdk.es78.js.map +1 -1
  378. package/dist/es/standards-sdk.es79.js +125 -89
  379. package/dist/es/standards-sdk.es79.js.map +1 -1
  380. package/dist/es/standards-sdk.es8.js +80 -29
  381. package/dist/es/standards-sdk.es8.js.map +1 -1
  382. package/dist/es/standards-sdk.es80.js +8 -125
  383. package/dist/es/standards-sdk.es80.js.map +1 -1
  384. package/dist/es/standards-sdk.es81.js +45 -6
  385. package/dist/es/standards-sdk.es81.js.map +1 -1
  386. package/dist/es/standards-sdk.es82.js +98 -44
  387. package/dist/es/standards-sdk.es82.js.map +1 -1
  388. package/dist/es/standards-sdk.es83.js +331 -84
  389. package/dist/es/standards-sdk.es83.js.map +1 -1
  390. package/dist/es/standards-sdk.es84.js +93 -160
  391. package/dist/es/standards-sdk.es84.js.map +1 -1
  392. package/dist/es/standards-sdk.es85.js +55 -275
  393. package/dist/es/standards-sdk.es85.js.map +1 -1
  394. package/dist/es/standards-sdk.es86.js +43 -55
  395. package/dist/es/standards-sdk.es86.js.map +1 -1
  396. package/dist/es/standards-sdk.es87.js +145 -22
  397. package/dist/es/standards-sdk.es87.js.map +1 -1
  398. package/dist/es/standards-sdk.es88.js +34 -47
  399. package/dist/es/standards-sdk.es88.js.map +1 -1
  400. package/dist/es/standards-sdk.es89.js +22 -57
  401. package/dist/es/standards-sdk.es89.js.map +1 -1
  402. package/dist/es/standards-sdk.es9.js +104 -80
  403. package/dist/es/standards-sdk.es9.js.map +1 -1
  404. package/dist/es/standards-sdk.es90.js +23 -28
  405. package/dist/es/standards-sdk.es90.js.map +1 -1
  406. package/dist/es/standards-sdk.es91.js +238 -23
  407. package/dist/es/standards-sdk.es91.js.map +1 -1
  408. package/dist/es/standards-sdk.es92.js +265 -152
  409. package/dist/es/standards-sdk.es92.js.map +1 -1
  410. package/dist/es/standards-sdk.es93.js +95 -68
  411. package/dist/es/standards-sdk.es93.js.map +1 -1
  412. package/dist/es/standards-sdk.es94.js +124 -136
  413. package/dist/es/standards-sdk.es94.js.map +1 -1
  414. package/dist/es/standards-sdk.es95.js +42 -138
  415. package/dist/es/standards-sdk.es95.js.map +1 -1
  416. package/dist/es/standards-sdk.es96.js +259 -42
  417. package/dist/es/standards-sdk.es96.js.map +1 -1
  418. package/dist/es/standards-sdk.es97.js +82 -243
  419. package/dist/es/standards-sdk.es97.js.map +1 -1
  420. package/dist/es/standards-sdk.es98.js +48 -47
  421. package/dist/es/standards-sdk.es98.js.map +1 -1
  422. package/dist/es/standards-sdk.es99.js +29 -100
  423. package/dist/es/standards-sdk.es99.js.map +1 -1
  424. package/dist/es/utils/crypto-abstraction.d.ts.map +1 -1
  425. package/dist/es/utils/crypto-env.d.ts.map +1 -1
  426. package/dist/es/utils/dynamic-import.d.ts +5 -1
  427. package/dist/es/utils/dynamic-import.d.ts.map +1 -1
  428. package/dist/es/utils/hash-adapter.d.ts.map +1 -1
  429. package/package.json +9 -7
  430. package/dist/cjs/patches/topic-autorenew-patch.d.ts +0 -2
  431. package/dist/cjs/patches/topic-autorenew-patch.d.ts.map +0 -1
  432. package/dist/es/patches/topic-autorenew-patch.d.ts +0 -2
  433. package/dist/es/patches/topic-autorenew-patch.d.ts.map +0 -1
@@ -1,220 +1,685 @@
1
- const accountIdPattern = /^\d+\.\d+\.\d+$/u;
2
- const prototypeMarker = Symbol.for("standards-sdk.topic-auto-renew.patch");
3
- const accountMarker = Symbol.for("standards-sdk.account-id.patch");
4
- const nodeRequire = getNodeRequire();
5
- if (nodeRequire) {
6
- bootstrap(nodeRequire);
7
- } else {
8
- Reflect.set(globalThis, "__standardsSdkTopicAutoRenewPatched", false);
9
- }
10
- function bootstrap(requireFn) {
11
- const accountModule = safeRequire(
12
- requireFn,
13
- "@hashgraph/sdk/lib/account/AccountId.cjs"
14
- );
15
- const topicModule = safeRequire(
16
- requireFn,
17
- "@hashgraph/sdk/lib/topic/TopicCreateTransaction.cjs"
18
- );
19
- const sdkModule = safeRequire(requireFn, "@hashgraph/sdk");
20
- const candidates = [];
21
- if (accountModule?.default && topicModule?.default) {
22
- candidates.push({
23
- accountId: accountModule.default,
24
- topic: topicModule.default
25
- });
1
+ import { Logger } from "./standards-sdk.es105.js";
2
+ import { sleep } from "./standards-sdk.es115.js";
3
+ class HCS {
4
+ constructor() {
5
+ this.modelViewerLoaded = false;
6
+ this.modelViewerLoading = null;
7
+ this.config = {
8
+ cdnUrl: "https://kiloscribe.com/api/inscription-cdn/",
9
+ network: "mainnet",
10
+ retryAttempts: 3,
11
+ retryBackoff: 300,
12
+ debug: false,
13
+ showLoadingIndicator: false,
14
+ loadingCallbackName: null
15
+ };
16
+ this.configMapping = {
17
+ hcsCdnUrl: "cdnUrl",
18
+ hcsNetwork: "network",
19
+ hcsRetryAttempts: "retryAttempts",
20
+ hcsRetryBackoff: "retryBackoff",
21
+ hcsDebug: "debug",
22
+ hcsShowLoadingIndicator: "showLoadingIndicator",
23
+ hcsLoadingCallbackName: "loadingCallbackName"
24
+ };
25
+ this.LoadedScripts = {};
26
+ this.LoadedWasm = {};
27
+ this.LoadedImages = {};
28
+ this.LoadedVideos = {};
29
+ this.LoadedAudios = {};
30
+ this.LoadedAudioUrls = {};
31
+ this.LoadedGLBs = {};
32
+ this.scriptLoadedEvent = new Event("HCSScriptLoaded");
33
+ this.loadQueue = [];
34
+ this.isProcessingQueue = false;
35
+ try {
36
+ this.logger = Logger.getInstance({
37
+ module: "HCS-3",
38
+ level: this.config.debug ? "debug" : "error"
39
+ });
40
+ } catch (e) {
41
+ this.logger = this.createFallbackLogger();
42
+ }
26
43
  }
27
- if (sdkModule) {
28
- candidates.push({
29
- accountId: sdkModule.AccountId ?? sdkModule.default?.AccountId,
30
- topic: sdkModule.TopicCreateTransaction ?? sdkModule.default?.TopicCreateTransaction
31
- });
44
+ createFallbackLogger() {
45
+ const fallbackLogger = {
46
+ debug: (...args) => this.config.debug && console.debug("[HCS-3]", ...args),
47
+ info: (...args) => this.config.debug && console.info("[HCS-3]", ...args),
48
+ warn: (...args) => console.warn("[HCS-3]", ...args),
49
+ error: (...args) => console.error("[HCS-3]", ...args),
50
+ setLogLevel: (level) => {
51
+ this.config.debug = level === "debug";
52
+ }
53
+ };
54
+ return fallbackLogger;
32
55
  }
33
- for (const candidate of candidates) {
34
- patchTopicModule(candidate.topic, candidate.accountId);
56
+ log(...args) {
57
+ if (args.length === 0) {
58
+ this.logger.debug("");
59
+ } else if (args.length === 1) {
60
+ this.logger.debug(String(args[0]));
61
+ } else {
62
+ const message = String(args[0]);
63
+ const data = args.slice(1);
64
+ this.logger.debug(message, data);
65
+ }
35
66
  }
36
- Reflect.set(globalThis, "__standardsSdkTopicAutoRenewPatched", true);
37
- }
38
- function getNodeRequire() {
39
- const moduleConstructor = getModuleConstructor();
40
- if (moduleConstructor?.createRequire) {
41
- try {
42
- return moduleConstructor.createRequire(import.meta.url);
43
- } catch {
44
- return null;
67
+ error(...args) {
68
+ if (args.length === 0) {
69
+ this.logger.error("");
70
+ } else if (args.length === 1) {
71
+ this.logger.error(String(args[0]));
72
+ } else {
73
+ const message = String(args[0]);
74
+ const data = args.slice(1);
75
+ this.logger.error(message, data);
45
76
  }
46
77
  }
47
- if (typeof require === "function") {
48
- return require;
78
+ loadConfigFromHTML() {
79
+ const configScript = document.querySelector(
80
+ "script[data-hcs-config]"
81
+ );
82
+ if (configScript) {
83
+ Object.keys(this.configMapping).forEach((dataAttr) => {
84
+ if (configScript.dataset[dataAttr]) {
85
+ const configKey = this.configMapping[dataAttr];
86
+ let value = configScript.dataset[dataAttr];
87
+ if (value === "true") value = true;
88
+ if (value === "false") value = false;
89
+ if (!isNaN(Number(value)) && value !== "") value = Number(value);
90
+ this.config[configKey] = value;
91
+ }
92
+ });
93
+ this.logger.setLogLevel(this.config.debug ? "debug" : "error");
94
+ }
95
+ this.log("Loaded config:", this.config);
49
96
  }
50
- return null;
51
- }
52
- function getModuleConstructor() {
53
- try {
54
- if (typeof module !== "undefined" && module?.createRequire) {
55
- return module;
97
+ updateLoadingStatus(id, status) {
98
+ if (this.LoadedScripts[id] === "loaded") {
99
+ return;
100
+ }
101
+ if (this.config.showLoadingIndicator) {
102
+ console.log("[HCS Loading] " + id + " : " + status);
103
+ }
104
+ this.LoadedScripts[id] = status;
105
+ if (this.config.loadingCallbackName && typeof window[this.config.loadingCallbackName] === "function") {
106
+ const callback = window[this.config.loadingCallbackName];
107
+ if (typeof callback === "function") {
108
+ callback(id, status);
109
+ }
56
110
  }
57
- } catch {
58
111
  }
59
- try {
60
- if (typeof require === "function") {
61
- const requiredModule = require("module");
62
- if (requiredModule?.createRequire) {
63
- return requiredModule;
112
+ async fetchWithRetry(url, retries = this.config.retryAttempts, backoff = this.config.retryBackoff) {
113
+ try {
114
+ const response = await fetch(url);
115
+ if (!response.ok) {
116
+ throw new Error("HTTP error! status: " + response.status);
117
+ }
118
+ return response;
119
+ } catch (error) {
120
+ if (retries > 0) {
121
+ this.log(
122
+ "Retrying fetch for " + url + " Attempts left: " + (retries - 1)
123
+ );
124
+ await this.sleep(backoff);
125
+ return this.fetchWithRetry(url, retries - 1, backoff * 2);
64
126
  }
127
+ throw error;
65
128
  }
66
- } catch {
67
129
  }
68
- return null;
69
- }
70
- function safeRequire(requireFn, moduleId) {
71
- try {
72
- return requireFn(moduleId);
73
- } catch {
74
- return null;
130
+ sleep(ms) {
131
+ return sleep(ms);
75
132
  }
76
- }
77
- function patchTopicModule(topicCtor, accountCtor) {
78
- if (!topicCtor || !accountCtor) {
79
- return;
80
- }
81
- patchAccountId(accountCtor);
82
- const prototype = topicCtor.prototype;
83
- if (Reflect.get(prototype, prototypeMarker)) {
84
- return;
85
- }
86
- const originalSet = prototype.setAutoRenewAccountId;
87
- const originalFreeze = prototype.freezeWith;
88
- prototype.setAutoRenewAccountId = function setAutoRenewAccountIdPatched(autoRenewAccountId) {
89
- const resolved = resolveAccountId(autoRenewAccountId, accountCtor);
90
- if (resolved) {
91
- requireNotFrozen(this);
92
- this._autoRenewAccountId = resolved;
93
- return this;
94
- }
95
- return originalSet.call(
96
- this,
97
- autoRenewAccountId
133
+ isDuplicate(topicId) {
134
+ return !!this.LoadedScripts[topicId];
135
+ }
136
+ async retrieveHCS1Data(topicId, cdnUrl = this.config.cdnUrl, network = this.config.network) {
137
+ const cleanNetwork = network.replace(/['"]+/g, "");
138
+ const response = await this.fetchWithRetry(
139
+ cdnUrl + topicId + "?network=" + cleanNetwork
98
140
  );
99
- };
100
- prototype.freezeWith = function freezeWithPatched(client) {
101
- if (!this.getAutoRenewAccountId || typeof this.getAutoRenewAccountId !== "function") {
102
- return originalFreeze.call(this, client);
103
- }
104
- const current = this.getAutoRenewAccountId();
105
- if (!current) {
106
- const transactionAccountId = this.transactionId?.accountId;
107
- const operatorAccountId = client?.operatorAccountId;
108
- const resolved = resolveAccountId(transactionAccountId, accountCtor) ?? resolveAccountId(operatorAccountId, accountCtor);
109
- if (resolved) {
110
- this._autoRenewAccountId = resolved;
111
- }
112
- }
113
- return originalFreeze.call(this, client);
114
- };
115
- Reflect.set(prototype, prototypeMarker, true);
116
- }
117
- function patchAccountId(accountCtor) {
118
- if (Reflect.get(accountCtor, accountMarker)) {
119
- return;
120
- }
121
- const originalFromString = accountCtor.fromString.bind(accountCtor);
122
- accountCtor.fromString = function accountIdFromStringPatched(value) {
123
- if (typeof value === "string") {
124
- return originalFromString(value);
125
- }
126
- const extracted = extractAccountIdString(value);
127
- if (extracted) {
128
- return originalFromString(extracted);
129
- }
130
- if (isProtoAccountId(value)) {
131
- const shard = toNumericString(value.shard);
132
- const realm = toNumericString(value.realm);
133
- const num = toNumericString(value.num);
134
- if (shard && realm && num) {
135
- return originalFromString(`${shard}.${realm}.${num}`);
136
- }
137
- }
138
- return originalFromString(value);
139
- };
140
- Reflect.set(accountCtor, accountMarker, true);
141
- }
142
- function resolveAccountId(value, accountCtor) {
143
- if (value instanceof accountCtor) {
144
- return value;
141
+ return await response.blob();
145
142
  }
146
- if (typeof value === "string" && accountIdPattern.test(value)) {
147
- return accountCtor.fromString(value);
143
+ async loadScript(scriptElement) {
144
+ const src = scriptElement.getAttribute("data-src");
145
+ const scriptId = scriptElement.getAttribute("data-script-id");
146
+ const topicId = src?.split("/").pop();
147
+ const type = scriptElement.getAttribute("type");
148
+ const isRequired = scriptElement.hasAttribute("data-required");
149
+ const isModule = scriptElement.getAttribute("type") === "module";
150
+ if (this.isDuplicate(topicId || "")) {
151
+ return;
152
+ }
153
+ this.updateLoadingStatus(scriptId, "loading");
154
+ try {
155
+ const cdnUrl = scriptElement.getAttribute("data-cdn-url") || this.config.cdnUrl;
156
+ const network = scriptElement.getAttribute("data-network") || this.config.network;
157
+ const blob = await this.retrieveHCS1Data(topicId, cdnUrl, network);
158
+ if (type === "wasm") {
159
+ const arrayBuffer = await blob.arrayBuffer();
160
+ const wasmModule = await WebAssembly.compile(arrayBuffer);
161
+ this.LoadedWasm[scriptId] = await WebAssembly.instantiate(wasmModule, {
162
+ env: {},
163
+ ...scriptElement.dataset
164
+ });
165
+ this.updateLoadingStatus(scriptId, "loaded");
166
+ window.dispatchEvent(this.scriptLoadedEvent);
167
+ this.log("Loaded wasm: " + scriptId);
168
+ } else {
169
+ const content = await blob.text();
170
+ const script = document.createElement("script");
171
+ script.textContent = content;
172
+ script.className = "hcs-inline-script";
173
+ if (scriptId) {
174
+ script.setAttribute("data-loaded-script-id", scriptId);
175
+ }
176
+ if (isModule) {
177
+ script.type = "module";
178
+ const moduleBlob = new Blob([content], {
179
+ type: "application/javascript"
180
+ });
181
+ script.src = URL.createObjectURL(moduleBlob);
182
+ }
183
+ document.body.appendChild(script);
184
+ this.updateLoadingStatus(scriptId, "loaded");
185
+ window.dispatchEvent(this.scriptLoadedEvent);
186
+ this.log("Loaded script: " + scriptId);
187
+ script.onerror = (error) => {
188
+ this.error("Failed to load " + type + ": " + scriptId, error);
189
+ this.updateLoadingStatus(scriptId, "failed");
190
+ if (isRequired) {
191
+ throw error;
192
+ }
193
+ };
194
+ }
195
+ } catch (error) {
196
+ this.error("Failed to load " + type + ": " + scriptId, error);
197
+ this.updateLoadingStatus(scriptId, "failed");
198
+ if (isRequired) {
199
+ throw error;
200
+ }
201
+ }
148
202
  }
149
- const normalized = normalizeAutoRenewValue(value);
150
- if (normalized) {
151
- return accountCtor.fromString(normalized);
203
+ async loadModuleExports(scriptId) {
204
+ const script = document.querySelector(
205
+ 'script[data-loaded-script-id="' + scriptId + '"]'
206
+ );
207
+ if (!script) {
208
+ throw new Error("Module script with id " + scriptId + " not found");
209
+ }
210
+ const scriptSrc = script.getAttribute("src");
211
+ if (!scriptSrc) {
212
+ throw new Error("Module script " + scriptId + " has no src attribute");
213
+ }
214
+ try {
215
+ const importModule = new Function("url", "return import(url)");
216
+ return await importModule(scriptSrc);
217
+ } catch (error) {
218
+ this.error("Failed to import module", error);
219
+ throw error;
220
+ }
152
221
  }
153
- return null;
154
- }
155
- function normalizeAutoRenewValue(value) {
156
- if (typeof value === "string" && accountIdPattern.test(value)) {
157
- return value;
222
+ async loadStylesheet(linkElement) {
223
+ const src = linkElement.getAttribute("data-src");
224
+ const stylesheetId = linkElement.getAttribute("data-script-id");
225
+ const topicId = src?.split("/").pop();
226
+ const isRequired = linkElement.hasAttribute("data-required");
227
+ if (this.isDuplicate(topicId || "")) {
228
+ return;
229
+ }
230
+ this.updateLoadingStatus(stylesheetId, "loading");
231
+ try {
232
+ const cdnUrl = linkElement.getAttribute("data-cdn-url") || this.config.cdnUrl;
233
+ const network = linkElement.getAttribute("data-network") || this.config.network;
234
+ const blob = await this.retrieveHCS1Data(topicId, cdnUrl, network);
235
+ const cssContent = await blob.text();
236
+ const style = document.createElement("style");
237
+ style.textContent = cssContent;
238
+ document.head.appendChild(style);
239
+ this.updateLoadingStatus(stylesheetId, "loaded");
240
+ window.dispatchEvent(this.scriptLoadedEvent);
241
+ this.log("Loaded and inlined stylesheet: " + stylesheetId);
242
+ } catch (error) {
243
+ this.error("Failed to load stylesheet: " + stylesheetId, error);
244
+ this.updateLoadingStatus(stylesheetId, "failed");
245
+ if (isRequired) {
246
+ throw error;
247
+ }
248
+ }
158
249
  }
159
- const extracted = extractAccountIdString(value);
160
- if (extracted) {
161
- return extracted;
250
+ async loadImage(imageElement) {
251
+ const src = imageElement.getAttribute("data-src");
252
+ const topicId = src?.split("/").pop();
253
+ this.log("Loading image: " + topicId);
254
+ this.updateLoadingStatus("Image: " + topicId, "loaded");
255
+ try {
256
+ const cdnUrl = imageElement.getAttribute("data-cdn-url") || this.config.cdnUrl;
257
+ const network = imageElement.getAttribute("data-network") || this.config.network;
258
+ const blob = await this.retrieveHCS1Data(topicId, cdnUrl, network);
259
+ const objectURL = URL.createObjectURL(blob);
260
+ imageElement.src = objectURL;
261
+ this.LoadedImages[topicId] = objectURL;
262
+ this.updateLoadingStatus("Image: " + topicId, "loaded");
263
+ this.log("Loaded image: " + topicId);
264
+ } catch (error) {
265
+ this.error("Failed to load image: " + topicId, error);
266
+ this.updateLoadingStatus("Image: " + topicId, "failed");
267
+ }
162
268
  }
163
- if (isProtoAccountId(value)) {
164
- const shard = toNumericString(value.shard);
165
- const realm = toNumericString(value.realm);
166
- const num = toNumericString(value.num);
167
- if (shard && realm && num) {
168
- const composed = `${shard}.${realm}.${num}`;
169
- if (accountIdPattern.test(composed)) {
170
- return composed;
269
+ async loadMedia(mediaElement, mediaType) {
270
+ const src = mediaElement.getAttribute("data-src");
271
+ const topicId = src?.split("/").pop();
272
+ this.log("Loading " + mediaType + ": " + topicId);
273
+ this.updateLoadingStatus(mediaType + ": " + topicId, "loading");
274
+ try {
275
+ const cdnUrl = mediaElement.getAttribute("data-cdn-url") || this.config.cdnUrl;
276
+ const network = mediaElement.getAttribute("data-network") || this.config.network;
277
+ const blob = await this.retrieveHCS1Data(topicId, cdnUrl, network);
278
+ const objectURL = URL.createObjectURL(blob);
279
+ mediaElement.src = objectURL;
280
+ if (mediaType === "video") {
281
+ this.LoadedVideos[topicId] = objectURL;
282
+ } else {
283
+ this.LoadedAudioUrls[topicId] = objectURL;
171
284
  }
285
+ this.updateLoadingStatus(mediaType + ": " + topicId, "loaded");
286
+ this.log("Loaded " + mediaType + ": " + topicId);
287
+ } catch (error) {
288
+ this.error("Failed to load " + mediaType + ": " + topicId, error);
289
+ this.updateLoadingStatus(mediaType + ": " + topicId, "failed");
172
290
  }
173
291
  }
174
- return null;
175
- }
176
- function extractAccountIdString(value) {
177
- if (typeof value !== "object" || value === null) {
178
- return null;
292
+ async loadModelViewer() {
293
+ if (this.modelViewerLoading) return this.modelViewerLoading;
294
+ if (this.modelViewerLoaded) return Promise.resolve();
295
+ this.modelViewerLoading = new Promise((resolve) => {
296
+ const modelViewerScript = document.createElement("script");
297
+ modelViewerScript.setAttribute("data-src", "hcs://1/0.0.7293044");
298
+ modelViewerScript.setAttribute("data-script-id", "model-viewer");
299
+ modelViewerScript.setAttribute("type", "module");
300
+ window.addEventListener(
301
+ "HCSScriptLoaded",
302
+ () => {
303
+ this.modelViewerLoaded = true;
304
+ resolve();
305
+ },
306
+ { once: true }
307
+ );
308
+ this.loadScript(modelViewerScript);
309
+ });
310
+ return this.modelViewerLoading;
179
311
  }
180
- const candidate = value;
181
- const method = candidate.toString;
182
- if (typeof method !== "function") {
183
- return null;
312
+ async loadGLB(glbElement) {
313
+ await this.loadModelViewer();
314
+ const src = glbElement.getAttribute("data-src");
315
+ const topicId = src?.split("/").pop();
316
+ this.log("Loading GLB: " + topicId);
317
+ this.updateLoadingStatus("GLB: " + topicId, "loading");
318
+ try {
319
+ const cdnUrl = glbElement.getAttribute("data-cdn-url") || this.config.cdnUrl;
320
+ const network = glbElement.getAttribute("data-network") || this.config.network;
321
+ let modelViewer;
322
+ if (glbElement.tagName.toLowerCase() !== "model-viewer") {
323
+ modelViewer = document.createElement("model-viewer");
324
+ Array.from(glbElement.attributes).forEach((attr) => {
325
+ modelViewer.setAttribute(attr.name, attr.value);
326
+ });
327
+ modelViewer.setAttribute("camera-controls", "");
328
+ modelViewer.setAttribute("auto-rotate", "");
329
+ modelViewer.setAttribute("ar", "");
330
+ glbElement.parentNode?.replaceChild(modelViewer, glbElement);
331
+ } else {
332
+ modelViewer = glbElement;
333
+ }
334
+ const blob = await this.retrieveHCS1Data(topicId, cdnUrl, network);
335
+ const objectURL = URL.createObjectURL(blob);
336
+ modelViewer.setAttribute("src", objectURL);
337
+ this.LoadedGLBs[topicId] = objectURL;
338
+ this.updateLoadingStatus("GLB: " + topicId, "loaded");
339
+ this.log("Loaded GLB: " + topicId);
340
+ } catch (error) {
341
+ this.error("Failed to load GLB: " + topicId, error);
342
+ this.updateLoadingStatus("GLB: " + topicId, "failed");
343
+ }
184
344
  }
185
- const result = method.call(value);
186
- if (typeof result !== "string") {
187
- return null;
345
+ async loadResource(element, type, order) {
346
+ return new Promise((resolve) => {
347
+ this.loadQueue.push({ element, type, order, resolve });
348
+ this.processQueue();
349
+ });
188
350
  }
189
- return accountIdPattern.test(result) ? result : null;
190
- }
191
- function isProtoAccountId(value) {
192
- if (typeof value !== "object" || value === null) {
193
- return false;
351
+ async processQueue() {
352
+ if (this.isProcessingQueue) return;
353
+ this.isProcessingQueue = true;
354
+ while (this.loadQueue.length > 0) {
355
+ const item = this.loadQueue.shift();
356
+ try {
357
+ if (item.type === "script") {
358
+ await this.loadScript(item.element);
359
+ } else if (item.type === "image") {
360
+ await this.loadImage(item.element);
361
+ } else if (item.type === "video" || item.type === "audio") {
362
+ await this.loadMedia(item.element, item.type);
363
+ } else if (item.type === "glb") {
364
+ await this.loadGLB(item.element);
365
+ } else if (item.type === "css") {
366
+ await this.loadStylesheet(item.element);
367
+ }
368
+ item.resolve();
369
+ } catch (error) {
370
+ this.error("Error processing queue item:", error);
371
+ if (item.type === "script" && item.element.hasAttribute("data-required")) {
372
+ break;
373
+ }
374
+ }
375
+ }
376
+ this.isProcessingQueue = false;
194
377
  }
195
- const candidate = value;
196
- return hasToString(candidate.shard) && hasToString(candidate.realm) && hasToString(candidate.num);
197
- }
198
- function hasToString(value) {
199
- return typeof value === "object" && value !== null && typeof value.toString === "function";
200
- }
201
- function toNumericString(value) {
202
- if (typeof value === "number" && Number.isFinite(value)) {
203
- return String(Math.trunc(value));
378
+ async replaceHCSInStyle(styleContent) {
379
+ let newContent = styleContent;
380
+ let startIndex = newContent.indexOf("hcs://");
381
+ while (startIndex !== -1) {
382
+ let endIndex = startIndex;
383
+ while (endIndex < newContent.length && !["'", '"', " ", ")"].includes(newContent[endIndex])) {
384
+ endIndex++;
385
+ }
386
+ const hcsUrl = newContent.substring(startIndex, endIndex);
387
+ const topicId = hcsUrl.split("/").pop();
388
+ try {
389
+ const cdnUrl = this.config.cdnUrl;
390
+ const network = this.config.network;
391
+ const blob = await this.retrieveHCS1Data(topicId, cdnUrl, network);
392
+ const objectURL = URL.createObjectURL(blob);
393
+ newContent = newContent.substring(0, startIndex) + objectURL + newContent.substring(endIndex);
394
+ this.LoadedImages[topicId] = objectURL;
395
+ this.log("Replaced CSS HCS URL: " + hcsUrl + " with " + objectURL);
396
+ } catch (error) {
397
+ this.error("Failed to load CSS image: " + topicId, error);
398
+ }
399
+ startIndex = newContent.indexOf("hcs://", startIndex + 1);
400
+ }
401
+ return newContent;
204
402
  }
205
- if (typeof value === "bigint") {
206
- return value.toString();
403
+ async processInlineStyles() {
404
+ const elementsWithStyle = document.querySelectorAll('[style*="hcs://"]');
405
+ this.log(
406
+ "Found " + elementsWithStyle.length + " elements with HCS style references"
407
+ );
408
+ for (const element of Array.from(elementsWithStyle)) {
409
+ const style = element.getAttribute("style");
410
+ if (style) {
411
+ this.log("Processing style: " + style);
412
+ const newStyle = await this.replaceHCSInStyle(style);
413
+ if (style !== newStyle) {
414
+ element.setAttribute("style", newStyle);
415
+ this.log("Updated style to: " + newStyle);
416
+ }
417
+ }
418
+ }
419
+ const styleTags = document.querySelectorAll("style");
420
+ for (const styleTag of Array.from(styleTags)) {
421
+ if (styleTag.textContent?.includes("hcs://")) {
422
+ const newContent = await this.replaceHCSInStyle(styleTag.textContent);
423
+ if (styleTag.textContent !== newContent) {
424
+ styleTag.textContent = newContent;
425
+ }
426
+ }
427
+ }
428
+ }
429
+ async init() {
430
+ this.loadConfigFromHTML();
431
+ return new Promise((resolve) => {
432
+ const initializeObserver = async () => {
433
+ const scriptElements = document.querySelectorAll(
434
+ 'script[data-src^="hcs://"]'
435
+ );
436
+ const imageElements = document.querySelectorAll(
437
+ 'img[data-src^="hcs://"], img[src^="hcs://"]'
438
+ );
439
+ const videoElements = document.querySelectorAll(
440
+ 'video[data-src^="hcs://"], video[src^="hcs://"]'
441
+ );
442
+ const audioElements = document.querySelectorAll(
443
+ 'audio[data-src^="hcs://"], audio[src^="hcs://"]'
444
+ );
445
+ const glbElements = document.querySelectorAll(
446
+ 'model-viewer[data-src^="hcs://"]'
447
+ );
448
+ const cssElements = document.querySelectorAll(
449
+ 'link[data-src^="hcs://"]'
450
+ );
451
+ document.querySelectorAll('[src^="hcs://"]').forEach((element) => {
452
+ const src = element.getAttribute("src");
453
+ if (src) {
454
+ element.setAttribute("data-src", src);
455
+ element.removeAttribute("src");
456
+ }
457
+ });
458
+ await this.processInlineStyles();
459
+ const loadPromises = [];
460
+ [
461
+ { elements: scriptElements, type: "script" },
462
+ { elements: imageElements, type: "image" },
463
+ { elements: videoElements, type: "video" },
464
+ { elements: audioElements, type: "audio" },
465
+ { elements: glbElements, type: "glb" },
466
+ { elements: cssElements, type: "css" }
467
+ ].forEach(({ elements, type }) => {
468
+ elements.forEach((element) => {
469
+ const order = parseInt(element.getAttribute("data-load-order") || "") || Infinity;
470
+ loadPromises.push(
471
+ this.loadResource(
472
+ element,
473
+ type,
474
+ order
475
+ )
476
+ );
477
+ });
478
+ });
479
+ await Promise.all(loadPromises);
480
+ const observer = new MutationObserver((mutations) => {
481
+ mutations.forEach((mutation) => {
482
+ mutation.addedNodes.forEach((node) => {
483
+ if (node.nodeType === Node.ELEMENT_NODE) {
484
+ const element = node;
485
+ if (element.getAttribute("style")?.includes("hcs://")) {
486
+ this.processInlineStyles();
487
+ }
488
+ if (element.tagName.toLowerCase() === "style" && element.textContent?.includes("hcs://")) {
489
+ this.processInlineStyles();
490
+ }
491
+ if (element.getAttribute("src")?.startsWith("hcs://")) {
492
+ const src = element.getAttribute("src");
493
+ element.setAttribute("data-src", src);
494
+ element.removeAttribute("src");
495
+ const tagName = element.tagName.toLowerCase();
496
+ switch (tagName) {
497
+ case "img":
498
+ this.loadResource(element, "image", Infinity);
499
+ break;
500
+ case "video":
501
+ this.loadResource(element, "video", Infinity);
502
+ break;
503
+ case "audio":
504
+ this.loadResource(element, "audio", Infinity);
505
+ break;
506
+ case "script":
507
+ this.loadResource(element, "script", Infinity);
508
+ break;
509
+ }
510
+ }
511
+ if (element.matches('script[data-src^="hcs://"]')) {
512
+ this.loadResource(element, "script", Infinity);
513
+ } else if (element.matches('img[data-src^="hcs://"]')) {
514
+ this.loadResource(element, "image", Infinity);
515
+ } else if (element.matches('video[data-src^="hcs://"]')) {
516
+ this.loadResource(element, "video", Infinity);
517
+ } else if (element.matches('audio[data-src^="hcs://"]')) {
518
+ this.loadResource(element, "audio", Infinity);
519
+ } else if (element.matches('model-viewer[data-src^="hcs://"]')) {
520
+ this.loadResource(element, "glb", Infinity);
521
+ } else if (element.matches('link[data-src^="hcs://"]')) {
522
+ this.loadResource(element, "css", Infinity);
523
+ }
524
+ const childrenWithHCS = element.querySelectorAll(
525
+ '[data-src^="hcs://"], [src^="hcs://"]'
526
+ );
527
+ childrenWithHCS.forEach((child) => {
528
+ const childElement = child;
529
+ const tagName = childElement.tagName.toLowerCase();
530
+ const src = childElement.getAttribute("src");
531
+ if (src?.startsWith("hcs://")) {
532
+ childElement.setAttribute("data-src", src);
533
+ childElement.removeAttribute("src");
534
+ }
535
+ switch (tagName) {
536
+ case "script":
537
+ this.loadResource(childElement, "script", Infinity);
538
+ break;
539
+ case "img":
540
+ this.loadResource(childElement, "image", Infinity);
541
+ break;
542
+ case "video":
543
+ this.loadResource(childElement, "video", Infinity);
544
+ break;
545
+ case "audio":
546
+ this.loadResource(childElement, "audio", Infinity);
547
+ break;
548
+ case "model-viewer":
549
+ this.loadResource(childElement, "glb", Infinity);
550
+ break;
551
+ case "link":
552
+ this.loadResource(childElement, "css", Infinity);
553
+ break;
554
+ }
555
+ });
556
+ }
557
+ });
558
+ if (mutation.type === "attributes") {
559
+ const element = mutation.target;
560
+ if (mutation.attributeName === "style" && element.getAttribute("style")?.includes("hcs://")) {
561
+ this.processInlineStyles();
562
+ } else if (mutation.attributeName === "src") {
563
+ const src = element.getAttribute("src");
564
+ if (src?.startsWith("hcs://")) {
565
+ element.setAttribute("data-src", src);
566
+ element.removeAttribute("src");
567
+ const type = element.tagName.toLowerCase();
568
+ if (["img", "video", "audio"].includes(type)) {
569
+ this.loadResource(element, type, Infinity);
570
+ }
571
+ }
572
+ }
573
+ }
574
+ });
575
+ });
576
+ if (document.body) {
577
+ observer.observe(document.body, {
578
+ childList: true,
579
+ subtree: true,
580
+ attributes: true,
581
+ attributeFilter: ["style", "src", "data-src"]
582
+ });
583
+ } else {
584
+ document.addEventListener("DOMContentLoaded", () => {
585
+ observer.observe(document.body, {
586
+ childList: true,
587
+ subtree: true,
588
+ attributes: true,
589
+ attributeFilter: ["style", "src", "data-src"]
590
+ });
591
+ });
592
+ }
593
+ resolve();
594
+ };
595
+ if (document.readyState === "loading") {
596
+ document.addEventListener("DOMContentLoaded", initializeObserver);
597
+ } else {
598
+ initializeObserver();
599
+ }
600
+ });
207
601
  }
208
- if (hasToString(value)) {
209
- const result = value.toString();
210
- if (/^\d+$/u.test(result)) {
211
- return result;
602
+ async preloadImage(topicId) {
603
+ this.log("Loading image:" + topicId);
604
+ this.updateLoadingStatus("image: " + topicId, "loading");
605
+ const blob = await this.retrieveHCS1Data(topicId);
606
+ const objectURL = URL.createObjectURL(blob);
607
+ this.LoadedImages[topicId] = objectURL;
608
+ this.updateLoadingStatus("image: " + topicId, "loaded");
609
+ return objectURL;
610
+ }
611
+ async preloadAudio(topicId) {
612
+ const audioElement = document.createElement("audio");
613
+ audioElement.setAttribute("data-topic-id", topicId);
614
+ audioElement.setAttribute("data-src", "hcs://1/" + topicId);
615
+ document.body.appendChild(audioElement);
616
+ await this.loadMedia(audioElement, "audio");
617
+ const cachedAudio = document.querySelector(
618
+ 'audio[data-topic-id="' + topicId + '"]'
619
+ );
620
+ if (cachedAudio) {
621
+ this.LoadedAudioUrls[topicId] = cachedAudio.src;
622
+ } else {
623
+ console.error("Failed to preload audio: " + topicId);
624
+ }
625
+ return this.LoadedAudioUrls[topicId];
626
+ }
627
+ async playAudio(topicId, volume = 1) {
628
+ const audioUrl = this.LoadedAudioUrls[topicId];
629
+ if (audioUrl) {
630
+ const audio = new Audio(audioUrl);
631
+ audio.volume = volume;
632
+ this.LoadedAudios[topicId] = audio;
633
+ audio.play().catch((error) => {
634
+ console.error("Failed to play audio:", error);
635
+ });
636
+ audio.addEventListener("ended", () => {
637
+ audio.remove();
638
+ delete this.LoadedAudios[topicId];
639
+ });
640
+ } else {
641
+ console.error("Audio not preloaded: " + topicId);
642
+ }
643
+ }
644
+ async pauseAudio(topicId) {
645
+ const audioElement = document.querySelector(
646
+ 'audio[data-topic-id="' + topicId + '"]'
647
+ );
648
+ if (audioElement) {
649
+ console.log("found element", audioElement);
650
+ audioElement.pause();
651
+ this.LoadedAudios[topicId]?.pause();
652
+ } else {
653
+ this.LoadedAudios[topicId]?.pause();
654
+ }
655
+ }
656
+ async loadAndPlayAudio(topicId, autoplay = false, volume = 1) {
657
+ let existingAudioElement = document.querySelector(
658
+ 'audio[data-topic-id="' + topicId + '"]'
659
+ );
660
+ if (existingAudioElement) {
661
+ existingAudioElement.volume = volume;
662
+ await existingAudioElement.play();
663
+ } else {
664
+ const audioElement = document.createElement("audio");
665
+ audioElement.volume = volume;
666
+ if (autoplay) {
667
+ audioElement.setAttribute("autoplay", "autoplay");
668
+ }
669
+ audioElement.setAttribute("data-topic-id", topicId);
670
+ audioElement.setAttribute("data-src", "hcs://1/" + topicId);
671
+ document.body.appendChild(audioElement);
672
+ await this.loadMedia(audioElement, "audio");
673
+ existingAudioElement = document.querySelector(
674
+ 'audio[data-topic-id="' + topicId + '"]'
675
+ );
676
+ if (!autoplay) {
677
+ await existingAudioElement.play();
678
+ }
212
679
  }
213
680
  }
214
- return null;
215
- }
216
- function requireNotFrozen(target) {
217
- const candidate = target;
218
- candidate._requireNotFrozen?.();
219
681
  }
682
+ export {
683
+ HCS
684
+ };
220
685
  //# sourceMappingURL=standards-sdk.es2.js.map