@seedprotocol/publish 0.6.9 → 0.6.10

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 (312) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/README.md +1 -1
  3. package/dist/{chainConfig-CA1Hrrjg.js → chainConfig-DWzoOtkS.js} +394 -328
  4. package/dist/chainConfig-DWzoOtkS.js.map +1 -0
  5. package/dist/config.d.ts +5 -4
  6. package/dist/config.d.ts.map +1 -1
  7. package/dist/ensureAutomationSessionKey-h3zOmDr5.js +84 -0
  8. package/dist/ensureAutomationSessionKey-h3zOmDr5.js.map +1 -0
  9. package/dist/{ensureModularPublishBootstrap-DGBKVGg5.js → ensureModularPublishBootstrap-BImiIFJe.js} +9 -10
  10. package/dist/{ensureModularPublishBootstrap-5HJDqJJM.js.map → ensureModularPublishBootstrap-BImiIFJe.js.map} +1 -1
  11. package/dist/{ensureSmartWalletThenPublish-Bm58tc-b.js → ensureSmartWalletThenPublish-DuOYPJFd.js} +9 -10
  12. package/dist/{ensureSmartWalletThenPublish-Bm58tc-b.js.map → ensureSmartWalletThenPublish-DuOYPJFd.js.map} +1 -1
  13. package/dist/errors.d.ts +9 -0
  14. package/dist/errors.d.ts.map +1 -1
  15. package/dist/helpers/abi/executor.d.ts +12 -0
  16. package/dist/helpers/abi/executor.d.ts.map +1 -1
  17. package/dist/helpers/abi/factory.d.ts +11 -0
  18. package/dist/helpers/abi/factory.d.ts.map +1 -1
  19. package/dist/helpers/abi/seedExecutorRouter.d.ts +9 -1
  20. package/dist/helpers/abi/seedExecutorRouter.d.ts.map +1 -1
  21. package/dist/helpers/adapters/thirdwebAccount.d.ts.map +1 -1
  22. package/dist/helpers/chainClient.d.ts +18 -2
  23. package/dist/helpers/chainClient.d.ts.map +1 -1
  24. package/dist/helpers/contracts/index.d.ts +9 -0
  25. package/dist/helpers/contracts/index.d.ts.map +1 -1
  26. package/dist/helpers/describeRevert.d.ts +3 -2
  27. package/dist/helpers/describeRevert.d.ts.map +1 -1
  28. package/dist/helpers/enrollPublishAutomation.d.ts +2 -2
  29. package/dist/helpers/enrollPublishAutomation.d.ts.map +1 -1
  30. package/dist/helpers/ensureAutomationSessionKey.d.ts.map +1 -1
  31. package/dist/helpers/ensureExecutorModule.d.ts +28 -5
  32. package/dist/helpers/ensureExecutorModule.d.ts.map +1 -1
  33. package/dist/helpers/executorModuleReadiness.d.ts +15 -1
  34. package/dist/helpers/executorModuleReadiness.d.ts.map +1 -1
  35. package/dist/helpers/gasLog.d.ts +8 -0
  36. package/dist/helpers/gasLog.d.ts.map +1 -0
  37. package/dist/helpers/seedPaymaster.d.ts +27 -0
  38. package/dist/helpers/seedPaymaster.d.ts.map +1 -0
  39. package/dist/helpers/thirdweb.d.ts.map +1 -1
  40. package/dist/index.d.ts +3 -3
  41. package/dist/index.d.ts.map +1 -1
  42. package/dist/index.js +271 -272
  43. package/dist/index.js.map +1 -1
  44. package/dist/{managedAccountAdmin-B64V1rlU.js → managedAccountAdmin-B4HkLWWE.js} +9 -10
  45. package/dist/{managedAccountAdmin-B64V1rlU.js.map → managedAccountAdmin-B4HkLWWE.js.map} +1 -1
  46. package/dist/{publishAuthorization-CxBkijU6.js → publishAuthorization-DgDI4zor.js} +1104 -1018
  47. package/dist/publishAuthorization-DgDI4zor.js.map +1 -0
  48. package/dist/{publishThirdwebClient-CBD9sKJR.js → publishThirdwebClient-CO18ST7C.js} +2 -2
  49. package/dist/{publishThirdwebClient-CBD9sKJR.js.map → publishThirdwebClient-CO18ST7C.js.map} +1 -1
  50. package/dist/{resolveRevokeAccount-CehU81k6.js → resolveRevokeAccount-DsNod8ti.js} +11 -11
  51. package/dist/{resolveRevokeAccount-B5iXpuRT.js.map → resolveRevokeAccount-DsNod8ti.js.map} +1 -1
  52. package/dist/thirdweb.d.ts +2 -1
  53. package/dist/thirdweb.d.ts.map +1 -1
  54. package/dist/thirdweb.js +147 -148
  55. package/dist/thirdweb.js.map +1 -1
  56. package/dist/{worker-2dUZSapK.js → worker-CN7zg73B.js} +2 -2
  57. package/dist/{worker-2dUZSapK.js.map → worker-CN7zg73B.js.map} +1 -1
  58. package/package.json +6 -6
  59. package/dist/chainConfig-3sSqEVQh.js +0 -1433
  60. package/dist/chainConfig-3sSqEVQh.js.map +0 -1
  61. package/dist/chainConfig-3wlYarAG.js +0 -1433
  62. package/dist/chainConfig-3wlYarAG.js.map +0 -1
  63. package/dist/chainConfig-BRcsMopd.js +0 -1442
  64. package/dist/chainConfig-BRcsMopd.js.map +0 -1
  65. package/dist/chainConfig-BYm5OXpk.js +0 -1433
  66. package/dist/chainConfig-BYm5OXpk.js.map +0 -1
  67. package/dist/chainConfig-CA1Hrrjg.js.map +0 -1
  68. package/dist/chainConfig-CYy0XJ0M.js +0 -1283
  69. package/dist/chainConfig-CYy0XJ0M.js.map +0 -1
  70. package/dist/chainConfig-CfVGYAsY.js +0 -1311
  71. package/dist/chainConfig-CfVGYAsY.js.map +0 -1
  72. package/dist/chainConfig-DDA4YmAB.js +0 -1424
  73. package/dist/chainConfig-DDA4YmAB.js.map +0 -1
  74. package/dist/config-BA9la8B6.js +0 -941
  75. package/dist/config-BA9la8B6.js.map +0 -1
  76. package/dist/config-BqguD2Tt.js +0 -806
  77. package/dist/config-BqguD2Tt.js.map +0 -1
  78. package/dist/config-CPBd5C_b.js +0 -1201
  79. package/dist/config-CPBd5C_b.js.map +0 -1
  80. package/dist/config-DkIapO94.js +0 -955
  81. package/dist/config-DkIapO94.js.map +0 -1
  82. package/dist/config-EQZZNH9H.js +0 -955
  83. package/dist/config-EQZZNH9H.js.map +0 -1
  84. package/dist/config-qjpaJcBA.js +0 -947
  85. package/dist/config-qjpaJcBA.js.map +0 -1
  86. package/dist/deploy-BJYwLfz-.js +0 -15
  87. package/dist/deploy-BJYwLfz-.js.map +0 -1
  88. package/dist/enrollPublishAutomation-DYQMoylY.js +0 -3422
  89. package/dist/enrollPublishAutomation-DYQMoylY.js.map +0 -1
  90. package/dist/ensureAutomationSessionKey-BMHLKfjj.js +0 -85
  91. package/dist/ensureAutomationSessionKey-BMHLKfjj.js.map +0 -1
  92. package/dist/ensureAutomationSessionKey-BZ9_3FMW.js +0 -86
  93. package/dist/ensureAutomationSessionKey-BZ9_3FMW.js.map +0 -1
  94. package/dist/ensureAutomationSessionKey-Bq0PaTYE.js +0 -84
  95. package/dist/ensureAutomationSessionKey-Bq0PaTYE.js.map +0 -1
  96. package/dist/ensureAutomationSessionKey-Bw74ZSGI.js +0 -85
  97. package/dist/ensureAutomationSessionKey-Bw74ZSGI.js.map +0 -1
  98. package/dist/ensureAutomationSessionKey-C8D7BFjU.js +0 -85
  99. package/dist/ensureAutomationSessionKey-C8D7BFjU.js.map +0 -1
  100. package/dist/ensureAutomationSessionKey-CClLVX2w.js +0 -85
  101. package/dist/ensureAutomationSessionKey-CClLVX2w.js.map +0 -1
  102. package/dist/ensureAutomationSessionKey-CNNN1jBQ.js +0 -85
  103. package/dist/ensureAutomationSessionKey-CNNN1jBQ.js.map +0 -1
  104. package/dist/ensureAutomationSessionKey-CeUbjcCl.js +0 -85
  105. package/dist/ensureAutomationSessionKey-CeUbjcCl.js.map +0 -1
  106. package/dist/ensureAutomationSessionKey-D8Gki6U6.js +0 -85
  107. package/dist/ensureAutomationSessionKey-D8Gki6U6.js.map +0 -1
  108. package/dist/ensureAutomationSessionKey-DEH7nwUc.js +0 -86
  109. package/dist/ensureAutomationSessionKey-DEH7nwUc.js.map +0 -1
  110. package/dist/ensureAutomationSessionKey-DKriW4Hr.js +0 -85
  111. package/dist/ensureAutomationSessionKey-DKriW4Hr.js.map +0 -1
  112. package/dist/ensureAutomationSessionKey-Dhvbii2M.js +0 -86
  113. package/dist/ensureAutomationSessionKey-Dhvbii2M.js.map +0 -1
  114. package/dist/ensureAutomationSessionKey-Dyfk8qVp.js +0 -85
  115. package/dist/ensureAutomationSessionKey-Dyfk8qVp.js.map +0 -1
  116. package/dist/ensureModularPublishBootstrap-5HJDqJJM.js +0 -24
  117. package/dist/ensureModularPublishBootstrap-BW8jKN_A.js +0 -24
  118. package/dist/ensureModularPublishBootstrap-BW8jKN_A.js.map +0 -1
  119. package/dist/ensureModularPublishBootstrap-BhYNmLzT.js +0 -24
  120. package/dist/ensureModularPublishBootstrap-BhYNmLzT.js.map +0 -1
  121. package/dist/ensureModularPublishBootstrap-Bsw1xSCt.js +0 -24
  122. package/dist/ensureModularPublishBootstrap-Bsw1xSCt.js.map +0 -1
  123. package/dist/ensureModularPublishBootstrap-Btih5xbB.js +0 -129
  124. package/dist/ensureModularPublishBootstrap-Btih5xbB.js.map +0 -1
  125. package/dist/ensureModularPublishBootstrap-C8wdnH1P.js +0 -128
  126. package/dist/ensureModularPublishBootstrap-C8wdnH1P.js.map +0 -1
  127. package/dist/ensureModularPublishBootstrap-CI4U08Gc.js +0 -129
  128. package/dist/ensureModularPublishBootstrap-CI4U08Gc.js.map +0 -1
  129. package/dist/ensureModularPublishBootstrap-CcU-hXll.js +0 -128
  130. package/dist/ensureModularPublishBootstrap-CcU-hXll.js.map +0 -1
  131. package/dist/ensureModularPublishBootstrap-CdrykHAi.js +0 -24
  132. package/dist/ensureModularPublishBootstrap-CdrykHAi.js.map +0 -1
  133. package/dist/ensureModularPublishBootstrap-DGBKVGg5.js.map +0 -1
  134. package/dist/ensureModularPublishBootstrap-DaREOqSc.js +0 -129
  135. package/dist/ensureModularPublishBootstrap-DaREOqSc.js.map +0 -1
  136. package/dist/ensureModularPublishBootstrap-DxIG-LUP.js +0 -24
  137. package/dist/ensureModularPublishBootstrap-DxIG-LUP.js.map +0 -1
  138. package/dist/ensureModularPublishBootstrap-Jm1AAqBo.js +0 -127
  139. package/dist/ensureModularPublishBootstrap-Jm1AAqBo.js.map +0 -1
  140. package/dist/ensureSessionKey-D2Lq-56x.js +0 -363
  141. package/dist/ensureSessionKey-D2Lq-56x.js.map +0 -1
  142. package/dist/ensureSmartWalletThenPublish-BFPugsKJ.js +0 -48
  143. package/dist/ensureSmartWalletThenPublish-BFPugsKJ.js.map +0 -1
  144. package/dist/ensureSmartWalletThenPublish-BSYzckyS.js +0 -49
  145. package/dist/ensureSmartWalletThenPublish-BSYzckyS.js.map +0 -1
  146. package/dist/ensureSmartWalletThenPublish-Bf8FN1un.js +0 -49
  147. package/dist/ensureSmartWalletThenPublish-Bf8FN1un.js.map +0 -1
  148. package/dist/ensureSmartWalletThenPublish-Bl415Ss6.js +0 -48
  149. package/dist/ensureSmartWalletThenPublish-Bl415Ss6.js.map +0 -1
  150. package/dist/ensureSmartWalletThenPublish-Bmm5Fpat.js +0 -49
  151. package/dist/ensureSmartWalletThenPublish-Bmm5Fpat.js.map +0 -1
  152. package/dist/ensureSmartWalletThenPublish-CE7acryB.js +0 -49
  153. package/dist/ensureSmartWalletThenPublish-CE7acryB.js.map +0 -1
  154. package/dist/ensureSmartWalletThenPublish-D5GSZRyZ.js +0 -48
  155. package/dist/ensureSmartWalletThenPublish-D5GSZRyZ.js.map +0 -1
  156. package/dist/ensureSmartWalletThenPublish-DAomriGc.js +0 -48
  157. package/dist/ensureSmartWalletThenPublish-DAomriGc.js.map +0 -1
  158. package/dist/ensureSmartWalletThenPublish-DaZf3q5S.js +0 -48
  159. package/dist/ensureSmartWalletThenPublish-DaZf3q5S.js.map +0 -1
  160. package/dist/ensureSmartWalletThenPublish-Dta2AOyJ.js +0 -48
  161. package/dist/ensureSmartWalletThenPublish-Dta2AOyJ.js.map +0 -1
  162. package/dist/ensureSmartWalletThenPublish-ekb0xJRn.js +0 -48
  163. package/dist/ensureSmartWalletThenPublish-ekb0xJRn.js.map +0 -1
  164. package/dist/ensureSmartWalletThenPublish-v5fhvKxZ.js +0 -48
  165. package/dist/ensureSmartWalletThenPublish-v5fhvKxZ.js.map +0 -1
  166. package/dist/errors-Du3LNbJN.js +0 -70
  167. package/dist/errors-Du3LNbJN.js.map +0 -1
  168. package/dist/errors-PZAaDlkq.js +0 -79
  169. package/dist/errors-PZAaDlkq.js.map +0 -1
  170. package/dist/helpers/adapters/managedAccountTxSender.d.ts +0 -21
  171. package/dist/helpers/adapters/managedAccountTxSender.d.ts.map +0 -1
  172. package/dist/helpers/modularAccount/abi.d.ts +0 -173
  173. package/dist/helpers/modularAccount/abi.d.ts.map +0 -1
  174. package/dist/helpers/modularAccount/deploy.d.ts +0 -13
  175. package/dist/helpers/modularAccount/deploy.d.ts.map +0 -1
  176. package/dist/helpers/modularAccount/eip712.d.ts +0 -30
  177. package/dist/helpers/modularAccount/eip712.d.ts.map +0 -1
  178. package/dist/helpers/modularAccount/encode.d.ts +0 -16
  179. package/dist/helpers/modularAccount/encode.d.ts.map +0 -1
  180. package/dist/helpers/modularAccount/ensureModule.d.ts +0 -10
  181. package/dist/helpers/modularAccount/ensureModule.d.ts.map +0 -1
  182. package/dist/helpers/modularAccount/ensureSessionKey.d.ts +0 -25
  183. package/dist/helpers/modularAccount/ensureSessionKey.d.ts.map +0 -1
  184. package/dist/helpers/modularAccount/index.d.ts +0 -9
  185. package/dist/helpers/modularAccount/index.d.ts.map +0 -1
  186. package/dist/helpers/modularAccount/permissions.d.ts +0 -32
  187. package/dist/helpers/modularAccount/permissions.d.ts.map +0 -1
  188. package/dist/helpers/modularAccount/reads.d.ts +0 -28
  189. package/dist/helpers/modularAccount/reads.d.ts.map +0 -1
  190. package/dist/helpers/thirdwebEnrollPublishAutomation.d.ts +0 -31
  191. package/dist/helpers/thirdwebEnrollPublishAutomation.d.ts.map +0 -1
  192. package/dist/helpers/thirdwebModularBootstrap.d.ts +0 -8
  193. package/dist/helpers/thirdwebModularBootstrap.d.ts.map +0 -1
  194. package/dist/helpers/transformPayloadToIntegerIds.d.ts +0 -34
  195. package/dist/helpers/transformPayloadToIntegerIds.d.ts.map +0 -1
  196. package/dist/managedAccountAdmin-BVLGWpEb.js +0 -29
  197. package/dist/managedAccountAdmin-BVLGWpEb.js.map +0 -1
  198. package/dist/managedAccountAdmin-Bje6X8Ds.js +0 -29
  199. package/dist/managedAccountAdmin-Bje6X8Ds.js.map +0 -1
  200. package/dist/managedAccountAdmin-C84-IlQ9.js +0 -29
  201. package/dist/managedAccountAdmin-C84-IlQ9.js.map +0 -1
  202. package/dist/managedAccountAdmin-DJMw6UH6.js +0 -29
  203. package/dist/managedAccountAdmin-DJMw6UH6.js.map +0 -1
  204. package/dist/managedAccountAdmin-DhCRBoPX.js +0 -29
  205. package/dist/managedAccountAdmin-DhCRBoPX.js.map +0 -1
  206. package/dist/managedAccountAdmin-NXD66lP5.js +0 -29
  207. package/dist/managedAccountAdmin-NXD66lP5.js.map +0 -1
  208. package/dist/publishAuthorization-B0G1em4a.js +0 -3695
  209. package/dist/publishAuthorization-B0G1em4a.js.map +0 -1
  210. package/dist/publishAuthorization-B1BVVfp0.js +0 -3604
  211. package/dist/publishAuthorization-B1BVVfp0.js.map +0 -1
  212. package/dist/publishAuthorization-BEqRnP2h.js +0 -3925
  213. package/dist/publishAuthorization-BEqRnP2h.js.map +0 -1
  214. package/dist/publishAuthorization-Bltn3y_K.js +0 -3599
  215. package/dist/publishAuthorization-Bltn3y_K.js.map +0 -1
  216. package/dist/publishAuthorization-By2Tt9kW.js +0 -3912
  217. package/dist/publishAuthorization-By2Tt9kW.js.map +0 -1
  218. package/dist/publishAuthorization-CSN2FsQk.js +0 -3479
  219. package/dist/publishAuthorization-CSN2FsQk.js.map +0 -1
  220. package/dist/publishAuthorization-CxBkijU6.js.map +0 -1
  221. package/dist/publishAuthorization-CxWY7lAQ.js +0 -3706
  222. package/dist/publishAuthorization-CxWY7lAQ.js.map +0 -1
  223. package/dist/publishAuthorization-DEriY_jm.js +0 -3687
  224. package/dist/publishAuthorization-DEriY_jm.js.map +0 -1
  225. package/dist/publishAuthorization-DfAQs1sN.js +0 -3707
  226. package/dist/publishAuthorization-DfAQs1sN.js.map +0 -1
  227. package/dist/publishAuthorization-DgdmgLTa.js +0 -3520
  228. package/dist/publishAuthorization-DgdmgLTa.js.map +0 -1
  229. package/dist/publishAuthorization-DjVrnMC0.js +0 -3925
  230. package/dist/publishAuthorization-DjVrnMC0.js.map +0 -1
  231. package/dist/publishAuthorization-DqhhCAhd.js +0 -3652
  232. package/dist/publishAuthorization-DqhhCAhd.js.map +0 -1
  233. package/dist/publishThirdwebClient-BdgkcqM7.js +0 -18
  234. package/dist/publishThirdwebClient-BdgkcqM7.js.map +0 -1
  235. package/dist/publishThirdwebClient-BkmDN480.js +0 -18
  236. package/dist/publishThirdwebClient-BkmDN480.js.map +0 -1
  237. package/dist/publishThirdwebClient-BnDhP3N-.js +0 -18
  238. package/dist/publishThirdwebClient-BnDhP3N-.js.map +0 -1
  239. package/dist/publishThirdwebClient-CQ29pzG2.js +0 -18
  240. package/dist/publishThirdwebClient-CQ29pzG2.js.map +0 -1
  241. package/dist/publishThirdwebClient-CZIVmr9Z.js +0 -18
  242. package/dist/publishThirdwebClient-CZIVmr9Z.js.map +0 -1
  243. package/dist/publishThirdwebClient-Ce7iBIsj.js +0 -18
  244. package/dist/publishThirdwebClient-Ce7iBIsj.js.map +0 -1
  245. package/dist/publishThirdwebClient-DroRrOFQ.js +0 -18
  246. package/dist/publishThirdwebClient-DroRrOFQ.js.map +0 -1
  247. package/dist/publishThirdwebClient-DzXFjQ7L.js +0 -18
  248. package/dist/publishThirdwebClient-DzXFjQ7L.js.map +0 -1
  249. package/dist/publishThirdwebClient-Dzb2vcEs.js +0 -18
  250. package/dist/publishThirdwebClient-Dzb2vcEs.js.map +0 -1
  251. package/dist/publishThirdwebClient-i8P7fivi.js +0 -18
  252. package/dist/publishThirdwebClient-i8P7fivi.js.map +0 -1
  253. package/dist/publishWalletRegistry-Cugh691z.js +0 -37
  254. package/dist/publishWalletRegistry-Cugh691z.js.map +0 -1
  255. package/dist/resolveRevokeAccount-B5iXpuRT.js +0 -38
  256. package/dist/resolveRevokeAccount-B7ImSb4Y.js +0 -38
  257. package/dist/resolveRevokeAccount-B7ImSb4Y.js.map +0 -1
  258. package/dist/resolveRevokeAccount-BEhKQBTm.js +0 -38
  259. package/dist/resolveRevokeAccount-BEhKQBTm.js.map +0 -1
  260. package/dist/resolveRevokeAccount-BM1j2l5Q.js +0 -38
  261. package/dist/resolveRevokeAccount-BM1j2l5Q.js.map +0 -1
  262. package/dist/resolveRevokeAccount-BtVG0xxc.js +0 -38
  263. package/dist/resolveRevokeAccount-BtVG0xxc.js.map +0 -1
  264. package/dist/resolveRevokeAccount-CJZZdBcQ.js +0 -39
  265. package/dist/resolveRevokeAccount-CJZZdBcQ.js.map +0 -1
  266. package/dist/resolveRevokeAccount-CaIMuCee.js +0 -39
  267. package/dist/resolveRevokeAccount-CaIMuCee.js.map +0 -1
  268. package/dist/resolveRevokeAccount-CehU81k6.js.map +0 -1
  269. package/dist/resolveRevokeAccount-Cg4TQgnd.js +0 -38
  270. package/dist/resolveRevokeAccount-Cg4TQgnd.js.map +0 -1
  271. package/dist/resolveRevokeAccount-DHnxtEIj.js +0 -39
  272. package/dist/resolveRevokeAccount-DHnxtEIj.js.map +0 -1
  273. package/dist/resolveRevokeAccount-DJKfLlyK.js +0 -38
  274. package/dist/resolveRevokeAccount-DJKfLlyK.js.map +0 -1
  275. package/dist/resolveRevokeAccount-S-2WXkNh.js +0 -38
  276. package/dist/resolveRevokeAccount-S-2WXkNh.js.map +0 -1
  277. package/dist/resolveRevokeAccount-mzR11KJ4.js +0 -38
  278. package/dist/resolveRevokeAccount-mzR11KJ4.js.map +0 -1
  279. package/dist/resolveRevokeAccount-yWARIv9i.js +0 -38
  280. package/dist/resolveRevokeAccount-yWARIv9i.js.map +0 -1
  281. package/dist/seedSigner-CFzMD7Rb.js +0 -66
  282. package/dist/seedSigner-CFzMD7Rb.js.map +0 -1
  283. package/dist/thirdweb-BoksPRz3.js +0 -194
  284. package/dist/thirdweb-BoksPRz3.js.map +0 -1
  285. package/dist/thirdwebAccount-C2iOcp4_.js +0 -59
  286. package/dist/thirdwebAccount-C2iOcp4_.js.map +0 -1
  287. package/dist/worker-B1PcFPLi.js +0 -69
  288. package/dist/worker-B1PcFPLi.js.map +0 -1
  289. package/dist/worker-B8gN5WTx.js +0 -69
  290. package/dist/worker-B8gN5WTx.js.map +0 -1
  291. package/dist/worker-BCG1r0AS.js +0 -69
  292. package/dist/worker-BCG1r0AS.js.map +0 -1
  293. package/dist/worker-BgErCNTb.js +0 -69
  294. package/dist/worker-BgErCNTb.js.map +0 -1
  295. package/dist/worker-C07rPV2G.js +0 -69
  296. package/dist/worker-C07rPV2G.js.map +0 -1
  297. package/dist/worker-C9Za_dlQ.js +0 -69
  298. package/dist/worker-C9Za_dlQ.js.map +0 -1
  299. package/dist/worker-CEgulQnm.js +0 -69
  300. package/dist/worker-CEgulQnm.js.map +0 -1
  301. package/dist/worker-C_TL94He.js +0 -69
  302. package/dist/worker-C_TL94He.js.map +0 -1
  303. package/dist/worker-CbtzcKG6.js +0 -69
  304. package/dist/worker-CbtzcKG6.js.map +0 -1
  305. package/dist/worker-DBC_g-3I.js +0 -69
  306. package/dist/worker-DBC_g-3I.js.map +0 -1
  307. package/dist/worker-DHUm-TeQ.js +0 -69
  308. package/dist/worker-DHUm-TeQ.js.map +0 -1
  309. package/dist/worker-DypHzXgH.js +0 -69
  310. package/dist/worker-DypHzXgH.js.map +0 -1
  311. package/dist/worker-ZL4Wg19t.js +0 -69
  312. package/dist/worker-ZL4Wg19t.js.map +0 -1
@@ -1,31 +1,30 @@
1
1
  import { t as e } from "./rolldown-runtime-Dy4uBu1J.js";
2
- import { B as t, D as n, E as r, F as i, G as a, I as o, J as s, L as c, M as l, N as u, P as d, Q as f, R as p, T as m, U as h, W as g, X as _, Y as v, Z as y, _ as b, a as x, at as S, c as ee, ct as C, dt as w, f as T, ft as te, gt as ne, h as re, ht as ie, it as ae, k as oe, lt as se, mt as ce, nt as le, o as E, ot as ue, q as de, r as fe, rt as pe, st as me, t as D, tt as he, u as ge, ut as _e, v as ve, vt as ye, yt as be, z as xe } from "./chainConfig-BYm5OXpk.js";
3
- import { a as Se, o as Ce, r as O, s as we, t as Te } from "./errors-Du3LNbJN.js";
4
- import { t as k } from "./publishThirdwebClient-BnDhP3N-.js";
5
- import { BaseArweaveClient as Ee, BaseDb as A, BaseFileManager as j, INTERNAL_DATA_TYPES as De, Item as M, ModelPropertyDataTypes as Oe, applyPropertyAttestationUidsFromPublish as ke, arweaveL1FinalizeJobs as Ae, assertLocalDbChain as je, getCorrectId as Me, getEasSchemaForItemProperty as Ne, getItemPropertiesFromEas as Pe, getRelatedItemsForPublish as Fe, getSegmentedItemProperties as Ie, getUploadPipelineTransactionStatus as Le, htmlEmbeddedImageCoPublish as Re, isItemOwned as ze, isPublishedSeedRef as Be, itemHasPublishUploadCandidates as Ve, listRelationEasPropertyName as He, normalizeDataType as Ue, normalizeRelationPropertyValue as We, prepareHtmlEmbeddedImagesForPublish as Ge, publishProcesses as N, resolvePublishPayloadValues as Ke, resolveSeedIdsFromRefString as qe, rewriteHtmlEmbeddedImagesOnDisk as Je, setSchemaUidForModel as Ye, setSchemaUidForSchemaDefinition as P, updateVersionUid as Xe, validateItemForPublish as Ze } from "@seedprotocol/sdk";
6
- import { BaseError as Qe, decodeAbiParameters as $e, decodeErrorResult as et, encodeAbiParameters as tt, parseEther as nt, parseEventLogs as rt, toFunctionSelector as it, zeroAddress as at } from "viem";
7
- import { deploySmartAccount as ot, getContract as st, sendTransaction as ct } from "thirdweb";
8
- import { ethers as F, keccak256 as lt, toUtf8Bytes as ut } from "ethers";
9
- import { PUBLISH_AUTHORIZATION_DEFAULT_EXPIRATION_SECS as dt, PUBLISH_AUTHORIZATION_SCHEMA_DEF as ft, PUBLISH_AUTHORIZATION_SCHEMA_DEF as pt, PUBLISH_AUTHORIZATION_SCHEMA_NAME as mt, PUBLISH_AUTHORIZATION_SCHEMA_NAME as ht, PUBLISH_AUTHORIZATION_SCOPES as gt, PUBLISH_AUTHORIZATION_SCOPES as _t, assessPublishAuthorization as vt, decodePublishAuthorizationData as yt, getPublishAuthorizationFromEas as bt, isValidEasAttestationUid as xt, normalizeBytes32Hex as St } from "@seedprotocol/eas";
10
- import { createContext as Ct, useContext as wt, useEffect as Tt, useRef as Et, useState as Dt } from "react";
11
- import Ot from "arweave";
12
- import { NO_EXPIRATION as kt, SchemaEncoder as At, SchemaRegistry as jt, ZERO_ADDRESS as Mt, ZERO_BYTES32 as Nt } from "@ethereum-attestation-service/eas-sdk";
13
- import { assign as I, createActor as Pt, enqueueActions as Ft, fromCallback as It, fromPromise as L, setup as Lt } from "xstate";
2
+ import { At as t, B as n, Ct as r, D as i, Dt as a, Et as o, F as s, G as c, H as l, I as u, J as d, K as f, L as p, O as m, Ot as h, P as g, Q as _, R as v, St as y, V as b, X as x, Y as ee, Z as te, _ as S, _t as ne, a as re, at as ie, b as ae, bt as oe, c as se, ct as ce, dt as C, et as le, f as ue, ft as de, h as fe, ht as pe, it as me, j as he, jt as ge, k as _e, lt as ve, mt as w, o as T, ot as ye, q as be, r as xe, rt as Se, st as Ce, t as E, u as we, ut as Te, v as D, wt as Ee, xt as De, y as O, yt as Oe, z as ke } from "./chainConfig-DWzoOtkS.js";
3
+ import { t as k } from "./publishThirdwebClient-CO18ST7C.js";
4
+ import { BaseArweaveClient as Ae, BaseDb as A, BaseFileManager as j, INTERNAL_DATA_TYPES as je, Item as M, ModelPropertyDataTypes as Me, applyPropertyAttestationUidsFromPublish as Ne, arweaveL1FinalizeJobs as Pe, assertLocalDbChain as Fe, getCorrectId as Ie, getEasSchemaForItemProperty as Le, getItemPropertiesFromEas as Re, getRelatedItemsForPublish as ze, getSegmentedItemProperties as Be, getUploadPipelineTransactionStatus as Ve, htmlEmbeddedImageCoPublish as He, isItemOwned as Ue, isPublishedSeedRef as We, itemHasPublishUploadCandidates as Ge, listRelationEasPropertyName as Ke, normalizeDataType as qe, normalizeRelationPropertyValue as Je, prepareHtmlEmbeddedImagesForPublish as Ye, publishProcesses as N, resolvePublishPayloadValues as Xe, resolveSeedIdsFromRefString as Ze, rewriteHtmlEmbeddedImagesOnDisk as Qe, setSchemaUidForModel as $e, setSchemaUidForSchemaDefinition as et, updateVersionUid as tt, validateItemForPublish as nt } from "@seedprotocol/sdk";
5
+ import { BaseError as rt, decodeAbiParameters as it, decodeErrorResult as at, isAddressEqual as ot, parseEther as st, parseEventLogs as P, toFunctionSelector as ct, zeroAddress as lt } from "viem";
6
+ import { deploySmartAccount as ut, getContract as dt } from "thirdweb";
7
+ import { ethers as F, keccak256 as ft, toUtf8Bytes as pt } from "ethers";
8
+ import { PUBLISH_AUTHORIZATION_DEFAULT_EXPIRATION_SECS as mt, PUBLISH_AUTHORIZATION_SCHEMA_DEF as ht, PUBLISH_AUTHORIZATION_SCHEMA_DEF as gt, PUBLISH_AUTHORIZATION_SCHEMA_NAME as _t, PUBLISH_AUTHORIZATION_SCHEMA_NAME as vt, PUBLISH_AUTHORIZATION_SCOPES as yt, PUBLISH_AUTHORIZATION_SCOPES as bt, assessPublishAuthorization as xt, decodePublishAuthorizationData as St, getPublishAuthorizationFromEas as Ct, isValidEasAttestationUid as wt, normalizeBytes32Hex as Tt } from "@seedprotocol/eas";
9
+ import { createContext as Et, useContext as Dt, useEffect as Ot, useRef as kt, useState as At } from "react";
10
+ import jt from "arweave";
11
+ import { NO_EXPIRATION as Mt, SchemaEncoder as Nt, SchemaRegistry as Pt, ZERO_ADDRESS as Ft, ZERO_BYTES32 as It } from "@ethereum-attestation-service/eas-sdk";
12
+ import { assign as I, createActor as Lt, enqueueActions as Rt, fromCallback as zt, fromPromise as L, setup as Bt } from "xstate";
14
13
  import R from "debug";
15
- import { and as Rt, desc as zt, eq as z } from "drizzle-orm";
16
- import { createWallet as Bt, inAppWallet as Vt } from "thirdweb/wallets";
17
- import { useActiveAccount as Ht } from "thirdweb/react";
18
- import { getInstalledModules as Ut, installModule as Wt } from "thirdweb/modules";
14
+ import { and as Vt, desc as Ht, eq as z } from "drizzle-orm";
15
+ import { createWallet as Ut, inAppWallet as Wt } from "thirdweb/wallets";
16
+ import { useActiveAccount as Gt } from "thirdweb/react";
17
+ import { estimateUserOpGas as Kt, getPaymasterAndData as qt } from "thirdweb/wallets/smart";
19
18
  //#region src/react/PublishConfigContext.tsx
20
- var Gt = Ct(null);
21
- function Kt() {
22
- let e = wt(Gt);
19
+ var Jt = Et(null);
20
+ function Yt() {
21
+ let e = Dt(Jt);
23
22
  if (!e) throw Error("usePublishConfig: PublishConfig is missing. Pass config to PublishProvider or call initPublish() before render.");
24
23
  return e;
25
24
  }
26
25
  //#endregion
27
26
  //#region src/helpers/describeRevert.ts
28
- var qt = [
27
+ var Xt = [
29
28
  {
30
29
  type: "error",
31
30
  name: "PublishIndexOutOfBounds",
@@ -181,26 +180,26 @@ var qt = [
181
180
  type: "uint256"
182
181
  }]
183
182
  },
184
- ..._e,
185
- ...te
183
+ ...y,
184
+ ...Ee
186
185
  ];
187
- function Jt(e) {
188
- if (e instanceof Qe) return e.walk((e) => {
186
+ function Zt(e) {
187
+ if (e instanceof rt) return e.walk((e) => {
189
188
  let t = e.data;
190
189
  return typeof t == "string" && t.startsWith("0x") && t.length > 2;
191
190
  })?.data;
192
191
  }
193
- function Yt(e) {
194
- if (Jt(e)) return !0;
195
- let t = e instanceof Qe ? `${e.shortMessage} ${e.details}` : String(e);
192
+ function Qt(e) {
193
+ if (Zt(e)) return !0;
194
+ let t = e instanceof rt ? `${e.shortMessage} ${e.details}` : String(e);
196
195
  return /revert/i.test(t);
197
196
  }
198
- var Xt = "reverted with no data. The target likely has no matching function or the account cannot run executor calls";
199
- function Zt(e, t = Xt) {
197
+ var $t = "reverted with no data. The target likely has no matching function or the account cannot run executor calls";
198
+ function en(e, t = $t) {
200
199
  if (!e || e === "0x") return t;
201
200
  try {
202
- let t = et({
203
- abi: qt,
201
+ let t = at({
202
+ abi: Xt,
204
203
  data: e
205
204
  }), n = t.args?.length ? `(${t.args.map(String).join(", ")})` : "";
206
205
  return `reverted with ${t.errorName}${n}`;
@@ -208,34 +207,34 @@ function Zt(e, t = Xt) {
208
207
  return `reverted with data ${e}`;
209
208
  }
210
209
  }
211
- function Qt(e, t) {
212
- return t && t !== "0x" ? `The publish UserOp in transaction ${e} ${Zt(t)}.` : `The publish UserOp in transaction ${e} failed with no revert reason. That usually means it ran out of gas (the bundler's gas estimate was too low), not that the publish data is wrong. To confirm, run \`npx hardhat seed:explain-userop --network <network> --tx ${e}\` in seed-protocol.`;
210
+ function tn(e, t) {
211
+ return t && t !== "0x" ? `The publish UserOp in transaction ${e} ${en(t)}.` : `The publish UserOp in transaction ${e} failed with no revert reason. That usually means it ran out of gas (the bundler's gas estimate was too low), not that the publish data is wrong. To confirm, run \`npx hardhat seed:explain-userop --network <network> --tx ${e}\` in seed-protocol.`;
213
212
  }
214
- function $t(e) {
213
+ function nn(e) {
215
214
  let { txHash: t, revertData: n, sender: r, cause: i } = e, a = !!n && n !== "0x";
216
- return new O(Qt(t, n), a ? "USEROP_REVERTED" : "USEROP_FAILED_NO_REASON", r, i);
215
+ return new w(tn(t, n), a ? "USEROP_REVERTED" : "USEROP_FAILED_NO_REASON", r, i);
217
216
  }
218
- function en(e) {
217
+ function rn(e) {
219
218
  let t = [];
220
219
  for (let n = e; n && t.length < 6; n = n.cause) t.push(n);
221
220
  return t;
222
221
  }
223
- var tn;
224
- function nn(e) {
225
- return tn ??= new Map(qt.filter((e) => e.type === "error").map((e) => [it(`${e.name}(${e.inputs.map((e) => e.type).join(",")})`), e.name])), tn.get(e.toLowerCase());
222
+ var an;
223
+ function on(e) {
224
+ return an ??= new Map(Xt.filter((e) => e.type === "error").map((e) => [ct(`${e.name}(${e.inputs.map((e) => e.type).join(",")})`), e.name])), an.get(e.toLowerCase());
226
225
  }
227
- function rn(e, t) {
228
- for (let n of en(e)) {
226
+ function sn(e, t) {
227
+ for (let n of rn(e)) {
229
228
  let r = String(n.message ?? "").match(/UserOp failed at txHash: (0x[0-9a-f]{64})/i);
230
- if (r) return $t({
229
+ if (r) return nn({
231
230
  txHash: r[1],
232
231
  sender: t,
233
232
  cause: e
234
233
  });
235
234
  let i = n.signature;
236
235
  if (n.name === "AbiErrorSignatureNotFoundError" && typeof i == "string") {
237
- let n = nn(i);
238
- if (n) return new O(`The publish transaction reverted with ${n} (its arguments were not decoded).`, "USEROP_REVERTED", t, e);
236
+ let n = on(i);
237
+ if (n) return new w(`The publish transaction reverted with ${n} (its arguments were not decoded).`, "USEROP_REVERTED", t, e);
239
238
  }
240
239
  }
241
240
  return e;
@@ -243,22 +242,22 @@ function rn(e, t) {
243
242
  //#endregion
244
243
  //#region src/helpers/blockchain.ts
245
244
  var B = () => {
246
- let e = Ee.getArweaveJsApiConfig(), t = Ot;
245
+ let e = Ae.getArweaveJsApiConfig(), t = jt;
247
246
  return Object.keys(t).includes("default") && t.default ? t.default.init(e) : t.init(e);
248
247
  };
249
248
  //#endregion
250
249
  //#region src/helpers/schemaRegistry.ts
251
250
  async function V(e) {
252
- return he(e);
251
+ return Se(e);
253
252
  }
254
- function an(e) {
255
- return de(e);
253
+ function cn(e) {
254
+ return d(e);
256
255
  }
257
256
  //#endregion
258
257
  //#region src/helpers/nameSchemaAttestation.ts
259
- var on = "0x0000000000000000000000000000000000000000";
260
- function sn(e) {
261
- let n = new At("bytes32 schemaId,string name").encodeData([{
258
+ var ln = "0x0000000000000000000000000000000000000000";
259
+ function un(e) {
260
+ let t = new Nt("bytes32 schemaId,string name").encodeData([{
262
261
  name: "schemaId",
263
262
  value: e.schemaUid,
264
263
  type: "bytes32"
@@ -267,34 +266,34 @@ function sn(e) {
267
266
  value: e.schemaName,
268
267
  type: "string"
269
268
  }]);
270
- return t({
271
- schema: ce,
269
+ return l({
270
+ schema: o,
272
271
  data: {
273
- recipient: on,
274
- expirationTime: BigInt(kt),
272
+ recipient: ln,
273
+ expirationTime: BigInt(Mt),
275
274
  revocable: !0,
276
- refUID: Nt,
277
- data: n,
275
+ refUID: It,
276
+ data: t,
278
277
  value: 0n
279
278
  }
280
279
  });
281
280
  }
282
281
  //#endregion
283
282
  //#region src/services/publish/helpers/ensureEasSchemas.ts
284
- var H = "0x0000000000000000000000000000000000000000", U = !0, cn = "bytes32 schemaId,string name", ln = "bytes32 version", un = /* @__PURE__ */ new Set();
285
- function dn(e) {
283
+ var H = "0x0000000000000000000000000000000000000000", U = !0, dn = "bytes32 schemaId,string name", fn = "bytes32 version", pn = /* @__PURE__ */ new Set();
284
+ function mn(e) {
286
285
  return e.replace(/([a-z])([A-Z])/g, "$1_$2").toLowerCase();
287
286
  }
288
- async function fn(e) {
289
- let { itemRelationProperties: t, itemImageProperties: n, itemListProperties: r } = await Ie(e), i = /* @__PURE__ */ new Set();
287
+ async function hn(e) {
288
+ let { itemRelationProperties: t, itemImageProperties: n, itemListProperties: r } = await Be(e), i = /* @__PURE__ */ new Set();
290
289
  e.modelName && i.add(e.modelName);
291
290
  for (let e of t) {
292
291
  let t = e.propertyDef?.ref;
293
292
  t && i.add(t);
294
293
  }
295
294
  for (let e of n) {
296
- let t = Ue(e.propertyDef?.dataType);
297
- t === Oe.File ? i.add("File") : t === Oe.Html ? i.add("Html") : i.add("Image");
295
+ let t = qe(e.propertyDef?.dataType);
296
+ t === Me.File ? i.add("File") : t === Me.Html ? i.add("Html") : i.add("Image");
298
297
  }
299
298
  for (let e of r) {
300
299
  let t = e.propertyDef?.ref;
@@ -302,65 +301,65 @@ async function fn(e) {
302
301
  }
303
302
  return i;
304
303
  }
305
- async function pn(e, t) {
304
+ async function gn(e, t) {
306
305
  let n = await e.sendTransaction(t);
307
306
  await C(n.transactionHash);
308
307
  }
309
- function mn(e) {
310
- let t = Ue(e);
311
- return De[t]?.eas ?? "string";
308
+ function _n(e) {
309
+ let t = qe(e);
310
+ return je[t]?.eas ?? "string";
312
311
  }
313
- function hn(e, t) {
312
+ function vn(e, t) {
314
313
  if (e) throw Error(`schema "${t}" is not registered; automation keys can't register schemas. Call ensureEasSchemasForItem with the owner wallet first.`);
315
314
  }
316
- async function gn() {
317
- let e = fe().id;
318
- if (un.has(e)) return;
319
- let t = jt.getSchemaUID(ln, H, U), n = [[cn, ce], [ln, t]], r = [];
315
+ async function yn() {
316
+ let e = xe().id;
317
+ if (pn.has(e)) return;
318
+ let t = Pt.getSchemaUID(fn, H, U), n = [[dn, o], [fn, t]], r = [];
320
319
  for (let [e, t] of n) await V(t) || r.push(`"${e}" (${t})`);
321
320
  if (r.length > 0) throw Error(`Seed base schema${r.length > 1 ? "s" : ""} ${r.join(" and ")} not registered on chain ${e}. The protocol registers base schemas for each supported chain (seed-protocol: bun run seed:ensure-schemas).`);
322
- un.add(e);
321
+ pn.add(e);
323
322
  }
324
- async function _n(e, t) {
323
+ async function bn(e, t) {
325
324
  if (typeof t?.blockSchemaRegistration == "boolean") return t.blockSchemaRegistration;
326
325
  let n = t?.managedAddress?.trim();
327
- if (!n || !m(e)) return !1;
328
- let { isAutomationSessionActive: r } = await import("./ensureAutomationSessionKey-CClLVX2w.js").then((e) => e.n);
326
+ if (!n || !i(e)) return !1;
327
+ let { isAutomationSessionActive: r } = await import("./ensureAutomationSessionKey-h3zOmDr5.js").then((e) => e.n);
329
328
  return r(n, e.signer.address);
330
329
  }
331
- async function vn(e, t, n) {
332
- await yn(e, t, n);
330
+ async function xn(e, t, n) {
331
+ await Sn(e, t, n);
333
332
  }
334
- async function yn(e, t, r) {
335
- let i = await _n(t, r), a = m(t) ? t.txSender : n(t) ? t : (() => {
333
+ async function Sn(e, t, n) {
334
+ let r = await bn(t, n), a = i(t) ? t.txSender : _e(t) ? t : (() => {
336
335
  throw Error("@seedprotocol/publish: ensureEasSchemasForItem requires a PublishWallet or SeedTxSender");
337
336
  })();
338
- await gn();
339
- let { itemBasicProperties: o, itemRelationProperties: s, itemImageProperties: c, itemListProperties: l } = await Ie(e), u = [
337
+ await yn();
338
+ let { itemBasicProperties: o, itemRelationProperties: s, itemImageProperties: c, itemListProperties: l } = await Be(e), u = [
340
339
  ...o,
341
340
  ...s,
342
341
  ...c,
343
342
  ...l
344
- ], d = /* @__PURE__ */ new Set(), f = await fn(e), p = /* @__PURE__ */ new Set();
343
+ ], d = /* @__PURE__ */ new Set(), f = await hn(e), p = /* @__PURE__ */ new Set();
345
344
  for (let e of f) {
346
- let t = `bytes32 ${dn(e)}`, n = jt.getSchemaUID(t, H, U);
345
+ let t = `bytes32 ${mn(e)}`, n = Pt.getSchemaUID(t, H, U);
347
346
  if (await V(n)) {
348
- Ye({
347
+ $e({
349
348
  modelName: e,
350
349
  schemaUid: n
351
350
  });
352
351
  continue;
353
352
  }
354
353
  if (p.has(n)) {
355
- Ye({
354
+ $e({
356
355
  modelName: e,
357
356
  schemaUid: n
358
357
  });
359
358
  continue;
360
359
  }
361
- hn(i, t);
360
+ vn(r, t);
362
361
  try {
363
- await pn(a, an({
362
+ await gn(a, cn({
364
363
  schema: t,
365
364
  resolverAddress: H,
366
365
  revocable: U
@@ -369,46 +368,46 @@ async function yn(e, t, r) {
369
368
  throw Error(`Failed to register EAS schema for model ${e}: ${t instanceof Error ? t.message : String(t)}`);
370
369
  }
371
370
  try {
372
- await pn(a, sn({
371
+ await gn(a, un({
373
372
  schemaUid: n,
374
- schemaName: dn(e)
373
+ schemaName: mn(e)
375
374
  }));
376
375
  } catch (t) {
377
376
  throw Error(`Failed to name EAS schema for model ${e}: ${t instanceof Error ? t.message : String(t)}`);
378
377
  }
379
- p.add(n), Ye({
378
+ p.add(n), $e({
380
379
  modelName: e,
381
380
  schemaUid: n
382
381
  });
383
382
  }
384
- let h = "string storage_transaction_id", g = jt.getSchemaUID(h, H, U);
385
- if (await V(g)) P({
386
- text: h,
387
- schemaUid: g
383
+ let m = "string storage_transaction_id", h = Pt.getSchemaUID(m, H, U);
384
+ if (await V(h)) et({
385
+ text: m,
386
+ schemaUid: h
388
387
  });
389
- else if (!d.has(g) && (f.has("Image") || f.has("File") || f.has("Html"))) {
390
- hn(i, h);
388
+ else if (!d.has(h) && (f.has("Image") || f.has("File") || f.has("Html"))) {
389
+ vn(r, m);
391
390
  try {
392
- await pn(a, an({
393
- schema: h,
391
+ await gn(a, cn({
392
+ schema: m,
394
393
  resolverAddress: H,
395
394
  revocable: U
396
- })), await pn(a, sn({
397
- schemaUid: g,
395
+ })), await gn(a, un({
396
+ schemaUid: h,
398
397
  schemaName: "storage_transaction_id"
399
398
  }));
400
399
  } catch (e) {
401
400
  throw Error(`Failed to register EAS schema for storageTransactionId: ${e instanceof Error ? e.message : String(e)}`);
402
401
  }
403
- d.add(g), P({
404
- text: h,
405
- schemaUid: g
402
+ d.add(h), et({
403
+ text: m,
404
+ schemaUid: h
406
405
  });
407
406
  }
408
407
  for (let e of u) {
409
408
  if (!e.propertyDef) continue;
410
- let t = mn(e.propertyDef.dataType), n = e, r = He(e.propertyName, e.propertyDef), o = r ?? (n.storagePropertyName && n.storagePropertyName.length > 0 ? n.storagePropertyName : e.propertyName), s = dn(o), c = `${t} ${s}`;
411
- if (r && !s.endsWith("_ids")) throw Error(`Refusing to register "${c}" for list-relation property ${e.propertyName}: list relations attest as <singular>_<ref>_ids.`);
409
+ let t = _n(e.propertyDef.dataType), n = e, i = Ke(e.propertyName, e.propertyDef), o = i ?? (n.storagePropertyName && n.storagePropertyName.length > 0 ? n.storagePropertyName : e.propertyName), s = mn(o), c = `${t} ${s}`;
410
+ if (i && !s.endsWith("_ids")) throw Error(`Refusing to register "${c}" for list-relation property ${e.propertyName}: list relations attest as <singular>_<ref>_ids.`);
412
411
  let l = [
413
412
  "string",
414
413
  "address",
@@ -421,39 +420,39 @@ async function yn(e, t, r) {
421
420
  "uint64",
422
421
  "uint128",
423
422
  "uint256"
424
- ].includes(t) ? t : void 0, u = await Ne({
425
- schemaUid: r ? void 0 : e.schemaUid,
423
+ ].includes(t) ? t : void 0, u = await Le({
424
+ schemaUid: i ? void 0 : e.schemaUid,
426
425
  propertyName: o,
427
426
  easDataType: l
428
427
  });
429
428
  if (u) {
430
429
  let e = await V(u.id);
431
430
  if (e && e.schema === c) {
432
- P({
431
+ et({
433
432
  text: c,
434
433
  schemaUid: u.id
435
434
  });
436
435
  continue;
437
436
  }
438
437
  }
439
- let f = jt.getSchemaUID(c, H, U);
438
+ let f = Pt.getSchemaUID(c, H, U);
440
439
  if (await V(f)) {
441
- P({
440
+ et({
442
441
  text: c,
443
442
  schemaUid: f
444
443
  });
445
444
  continue;
446
445
  }
447
446
  if (d.has(f)) {
448
- P({
447
+ et({
449
448
  text: c,
450
449
  schemaUid: f
451
450
  });
452
451
  continue;
453
452
  }
454
- hn(i, c);
453
+ vn(r, c);
455
454
  try {
456
- await pn(a, an({
455
+ await gn(a, cn({
457
456
  schema: c,
458
457
  resolverAddress: H,
459
458
  revocable: U
@@ -462,27 +461,27 @@ async function yn(e, t, r) {
462
461
  throw Error(`Failed to register EAS schema for property ${e.propertyName}: ${t instanceof Error ? t.message : String(t)}`);
463
462
  }
464
463
  try {
465
- await pn(a, sn({
464
+ await gn(a, un({
466
465
  schemaUid: f,
467
466
  schemaName: s
468
467
  }));
469
468
  } catch (t) {
470
469
  throw Error(`Failed to name EAS schema for property ${e.propertyName}: ${t instanceof Error ? t.message : String(t)}`);
471
470
  }
472
- d.add(f), P({
471
+ d.add(f), et({
473
472
  text: c,
474
473
  schemaUid: f
475
474
  });
476
475
  }
477
- let _ = await Fe(e);
478
- for (let e of _) await yn(e, t, {
479
- managedAddress: r?.managedAddress,
480
- blockSchemaRegistration: i
476
+ let g = await ze(e);
477
+ for (let e of g) await Sn(e, t, {
478
+ managedAddress: n?.managedAddress,
479
+ blockSchemaRegistration: r
481
480
  });
482
481
  }
483
482
  //#endregion
484
483
  //#region src/services/publish/actors/utils.ts
485
- var W = "0x" + "0".repeat(64), bn = async (e) => {
484
+ var W = "0x" + "0".repeat(64), Cn = async (e) => {
486
485
  let t;
487
486
  try {
488
487
  t = await M.find({ seedLocalId: e });
@@ -497,7 +496,7 @@ var W = "0x" + "0".repeat(64), bn = async (e) => {
497
496
  }, 200);
498
497
  });
499
498
  };
500
- function xn(e) {
499
+ function wn(e) {
501
500
  if (!e || typeof e != "object") return;
502
501
  let t = e;
503
502
  if (Array.isArray(t.data_root)) return {
@@ -512,7 +511,7 @@ function xn(e) {
512
511
  }))
513
512
  };
514
513
  }
515
- function Sn(e) {
514
+ function Tn(e) {
516
515
  return {
517
516
  data_root: Array.from(e.data_root),
518
517
  chunks: e.chunks.map((e) => ({
@@ -527,14 +526,14 @@ function Sn(e) {
527
526
  }
528
527
  //#endregion
529
528
  //#region src/services/publish/actors/createArweaveTransactions.ts
530
- var Cn = L(async ({ input: { context: e } }) => {
529
+ var En = L(async ({ input: { context: e } }) => {
531
530
  let { item: t } = e;
532
- t.getPublishUploads || (t = await bn(t.seedLocalId));
531
+ t.getPublishUploads || (t = await Cn(t.seedLocalId));
533
532
  let n = {};
534
533
  e.arweaveUploadTags?.length && (n.arweaveUploadTags = e.arweaveUploadTags);
535
534
  let r = e.htmlEmbeddedDeferredHtmlSeedLocalIds;
536
535
  r?.length && (n.deferHtmlStorageSeedLocalIds = r);
537
- let i = await t.getPublishUploads(Object.keys(n).length ? n : void 0), a = E(), o = e.signArweaveTransactions ?? a.signArweaveTransactions, s = e.arweaveJwk ?? a.arweaveJwk, c = i.map((e) => ({
536
+ let i = await t.getPublishUploads(Object.keys(n).length ? n : void 0), a = T(), o = e.signArweaveTransactions ?? a.signArweaveTransactions, s = e.arweaveJwk ?? a.arweaveJwk, c = i.map((e) => ({
538
537
  versionLocalId: e.versionLocalId,
539
538
  itemPropertyName: e.itemPropertyName,
540
539
  transactionJson: e.transactionToSign.toJSON()
@@ -550,7 +549,7 @@ var Cn = L(async ({ input: { context: e } }) => {
550
549
  l.push({
551
550
  transaction: {
552
551
  ...i,
553
- chunks: r.chunks ? Sn(r.chunks) : void 0
552
+ chunks: r.chunks ? Tn(r.chunks) : void 0
554
553
  },
555
554
  versionId: n.versionLocalId,
556
555
  modelName: n.itemPropertyName
@@ -560,7 +559,7 @@ var Cn = L(async ({ input: { context: e } }) => {
560
559
  let u = B();
561
560
  return {
562
561
  arweaveTransactions: l.map((e) => {
563
- let { chunks: t, ...n } = e.transaction, r = { ...n }, i = xn(t);
562
+ let { chunks: t, ...n } = e.transaction, r = { ...n }, i = wn(t);
564
563
  return i && (r.chunks = i), {
565
564
  transaction: u.transactions.fromRaw(r),
566
565
  versionId: e.versionId,
@@ -569,14 +568,14 @@ var Cn = L(async ({ input: { context: e } }) => {
569
568
  }),
570
569
  publishUploads: i
571
570
  };
572
- }), wn = L(async ({ input: { context: e } }) => {
571
+ }), Dn = L(async ({ input: { context: e } }) => {
573
572
  let { item: t } = e;
574
- t.getPublishUploads || (t = await bn(t.seedLocalId));
573
+ t.getPublishUploads || (t = await Cn(t.seedLocalId));
575
574
  let n = {};
576
575
  e.arweaveUploadTags?.length && (n.arweaveUploadTags = e.arweaveUploadTags);
577
576
  let r = e.htmlEmbeddedDeferredHtmlSeedLocalIds;
578
577
  r?.length && (n.onlyHtmlStorageSeedLocalIds = r, n.skipRelationRecursion = !0);
579
- let i = await t.getPublishUploads(Object.keys(n).length ? n : void 0), a = E(), o = e.signArweaveTransactions ?? a.signArweaveTransactions, s = e.arweaveJwk ?? a.arweaveJwk, c = i.map((e) => ({
578
+ let i = await t.getPublishUploads(Object.keys(n).length ? n : void 0), a = T(), o = e.signArweaveTransactions ?? a.signArweaveTransactions, s = e.arweaveJwk ?? a.arweaveJwk, c = i.map((e) => ({
580
579
  versionLocalId: e.versionLocalId,
581
580
  itemPropertyName: e.itemPropertyName,
582
581
  transactionJson: e.transactionToSign.toJSON()
@@ -592,7 +591,7 @@ var Cn = L(async ({ input: { context: e } }) => {
592
591
  l.push({
593
592
  transaction: {
594
593
  ...i,
595
- chunks: r.chunks ? Sn(r.chunks) : void 0
594
+ chunks: r.chunks ? Tn(r.chunks) : void 0
596
595
  },
597
596
  versionId: n.versionLocalId,
598
597
  modelName: n.itemPropertyName
@@ -602,7 +601,7 @@ var Cn = L(async ({ input: { context: e } }) => {
602
601
  let u = B();
603
602
  return {
604
603
  arweaveTransactions: l.map((e) => {
605
- let { chunks: t, ...n } = e.transaction, r = { ...n }, i = xn(t);
604
+ let { chunks: t, ...n } = e.transaction, r = { ...n }, i = wn(t);
606
605
  return i && (r.chunks = i), {
607
606
  transaction: u.transactions.fromRaw(r),
608
607
  versionId: e.versionId,
@@ -611,13 +610,13 @@ var Cn = L(async ({ input: { context: e } }) => {
611
610
  }),
612
611
  publishUploads: i
613
612
  };
614
- }), Tn = L(async ({ input: { context: e } }) => {
613
+ }), On = L(async ({ input: { context: e } }) => {
615
614
  let t = e.htmlEmbeddedDataUriPolicy ?? "materialize";
616
- return { deferredHtmlSeedLocalIds: (await Ge(e.item, t)).deferredHtmlSeedLocalIds };
615
+ return { deferredHtmlSeedLocalIds: (await Ye(e.item, t)).deferredHtmlSeedLocalIds };
617
616
  });
618
617
  //#endregion
619
618
  //#region src/services/publish/actors/rewritingHtmlEmbedded.ts
620
- function En(e, t) {
619
+ function kn(e, t) {
621
620
  let n = [], r = Math.min(e?.length ?? 0, t?.length ?? 0);
622
621
  for (let i = 0; i < r; i++) {
623
622
  let r = e[i], a = t[i], o = r.transaction?.id;
@@ -629,10 +628,10 @@ function En(e, t) {
629
628
  }
630
629
  return n;
631
630
  }
632
- var Dn = L(async ({ input: { context: e } }) => {
633
- let t = En(e.htmlEmbeddedPhase1ArweaveTransactions, e.htmlEmbeddedPhase1PublishUploads);
634
- await Je(e.item.seedLocalId, t);
635
- }), On = (e, t, n) => {
631
+ var An = L(async ({ input: { context: e } }) => {
632
+ let t = kn(e.htmlEmbeddedPhase1ArweaveTransactions, e.htmlEmbeddedPhase1PublishUploads);
633
+ await Qe(e.item.seedLocalId, t);
634
+ }), jn = (e, t, n) => {
636
635
  let r = [];
637
636
  return e && r.push({
638
637
  name: "Content-SHA-256",
@@ -641,10 +640,10 @@ var Dn = L(async ({ input: { context: e } }) => {
641
640
  name: "Content-Type",
642
641
  value: t
643
642
  }), n?.length && r.push(...n), r;
644
- }, kn = async (e) => {
643
+ }, Mn = async (e) => {
645
644
  let t = (e instanceof Uint8Array, new Uint8Array(e)), n = await crypto.subtle.digest("SHA-256", t);
646
645
  return Array.from(new Uint8Array(n)).map((e) => e.toString(16).padStart(2, "0")).join("");
647
- }, An = {
646
+ }, Nn = {
648
647
  png: "image/png",
649
648
  jpg: "image/jpeg",
650
649
  jpeg: "image/jpeg",
@@ -655,10 +654,10 @@ var Dn = L(async ({ input: { context: e } }) => {
655
654
  htm: "text/html",
656
655
  json: "application/json",
657
656
  txt: "text/plain"
658
- }, jn = (e) => {
657
+ }, Pn = (e) => {
659
658
  let t = e.split(".").pop()?.toLowerCase();
660
- return t ? An[t] : void 0;
661
- }, Mn = async (e) => typeof Blob < "u" && e instanceof Blob ? new Uint8Array(await e.arrayBuffer()) : new Uint8Array(e), Nn = (e) => {
659
+ return t ? Nn[t] : void 0;
660
+ }, Fn = async (e) => typeof Blob < "u" && e instanceof Blob ? new Uint8Array(await e.arrayBuffer()) : new Uint8Array(e), In = (e) => {
662
661
  switch (e) {
663
662
  case "Image": return j.getFilesPath("images");
664
663
  case "File": return j.getFilesPath("files");
@@ -666,9 +665,9 @@ var Dn = L(async ({ input: { context: e } }) => {
666
665
  case "Json": return j.getFilesPath("json");
667
666
  default: return j.getFilesPath("images");
668
667
  }
669
- }, Pn = /^data:(image\/[a-zA-Z0-9.+-]+);base64,([\s\S]*)$/i;
670
- function Fn(e) {
671
- let t = Pn.exec((e ?? "").trim());
668
+ }, Ln = /^data:(image\/[a-zA-Z0-9.+-]+);base64,([\s\S]*)$/i;
669
+ function Rn(e) {
670
+ let t = Ln.exec((e ?? "").trim());
672
671
  if (!t) return null;
673
672
  try {
674
673
  let e = t[1].toLowerCase().trim(), n = t[2].replace(/\s/g, "");
@@ -680,7 +679,7 @@ function Fn(e) {
680
679
  return null;
681
680
  }
682
681
  }
683
- var In = async (e, t, n, r) => {
682
+ var zn = async (e, t, n, r) => {
684
683
  let i = r?.arweaveUploadTags, a = e.itemProperty, o = [];
685
684
  for (let t of e.childProperties) {
686
685
  let e = t.localStoragePath;
@@ -693,9 +692,9 @@ var In = async (e, t, n, r) => {
693
692
  if ((!o || o.length === 0) && n?.localStoragePath) {
694
693
  let e = n.localStoragePath;
695
694
  if (e && !e.endsWith("undefined") && await j.pathExists(e)) try {
696
- s = await Mn(await j.readFileAsBuffer(e));
695
+ s = await Fn(await j.readFileAsBuffer(e));
697
696
  } catch {
698
- s = await Mn((await j.getFs()).readFileSync(e));
697
+ s = await Fn((await j.getFs()).readFileSync(e));
699
698
  }
700
699
  }
701
700
  if (o.length > 0) {
@@ -712,40 +711,40 @@ var In = async (e, t, n, r) => {
712
711
  s = typeof document < "u" ? new TextEncoder().encode(t) : new Uint8Array(Buffer.from(t));
713
712
  }
714
713
  if (!s) return t;
715
- let c = new Uint8Array(s), l = await kn(c), u;
716
- o.length === 0 && n?.localStoragePath ? u = jn(n.localStoragePath) : o.length > 0 && (u = "application/octet-stream");
714
+ let c = new Uint8Array(s), l = await Mn(c), u;
715
+ o.length === 0 && n?.localStoragePath ? u = Pn(n.localStoragePath) : o.length > 0 && (u = "application/octet-stream");
717
716
  let d = n ? n.localId : a.localId, f = n ? n.propertyName : a.propertyName;
718
717
  return t.push({
719
718
  data: c,
720
719
  contentHash: l,
721
720
  contentType: u,
722
- tags: On(l, u, i),
721
+ tags: jn(l, u, i),
723
722
  itemPropertyName: f,
724
723
  itemPropertyLocalId: d,
725
724
  seedLocalId: a.seedLocalId,
726
725
  versionLocalId: a.versionLocalId
727
726
  }), t;
728
- }, Ln = async (e, t) => {
727
+ }, Bn = async (e, t) => {
729
728
  let n = [], r = t?.arweaveUploadTags;
730
729
  for (let i of e) {
731
730
  let e = i.getService().getSnapshot(), a = "context" in e ? e.context : null;
732
731
  if (!a) continue;
733
732
  let o = a.propertyValue, s = a.refResolvedValue;
734
733
  if (!s) continue;
735
- let { localId: c } = Me(o ?? "");
734
+ let { localId: c } = Ie(o ?? "");
736
735
  if (!c) continue;
737
736
  let l = i.propertyDef?.refValueType ?? i.propertyDef?.dataType ?? "Image";
738
- if (l === Oe.Html) {
737
+ if (l === Me.Html) {
739
738
  if (t?.deferHtmlStorageSeedLocalIds?.includes(c) || t?.onlyHtmlStorageSeedLocalIds?.length && !t.onlyHtmlStorageSeedLocalIds.includes(c)) continue;
740
739
  } else if (t?.onlyHtmlStorageSeedLocalIds?.length) continue;
741
- let u = `${Nn(l)}/${s}`;
740
+ let u = `${In(l)}/${s}`;
742
741
  if (!await j.pathExists(u)) continue;
743
- let d = await Mn(await j.readFileAsBuffer(u)), f = await kn(d), p = jn(s);
742
+ let d = await Fn(await j.readFileAsBuffer(u)), f = await Mn(d), p = Pn(s);
744
743
  n.push({
745
744
  data: d,
746
745
  contentHash: f,
747
746
  contentType: p,
748
- tags: On(f, p, r),
747
+ tags: jn(f, p, r),
749
748
  itemPropertyName: i.propertyName,
750
749
  itemPropertyLocalId: i.localId,
751
750
  seedLocalId: c,
@@ -754,10 +753,10 @@ var In = async (e, t, n, r) => {
754
753
  }
755
754
  return n;
756
755
  };
757
- async function Rn(e, t, n) {
756
+ async function Vn(e, t, n) {
758
757
  let r = A.getAppDb();
759
758
  if (!r || n?.onlyHtmlStorageSeedLocalIds?.length) return t;
760
- let i = await r.select().from(Re).where(z(Re.parentSeedLocalId, e.seedLocalId)), a = new Set(t.map((e) => e.seedLocalId));
759
+ let i = await r.select().from(He).where(z(He.parentSeedLocalId, e.seedLocalId)), a = new Set(t.map((e) => e.seedLocalId));
761
760
  for (let e of i) {
762
761
  if (a.has(e.imageSeedLocalId)) continue;
763
762
  let r = await M.find({
@@ -765,14 +764,14 @@ async function Rn(e, t, n) {
765
764
  modelName: "Image"
766
765
  });
767
766
  if (!r) continue;
768
- let i = r.internalProperties.storageTransactionId ?? r.allProperties.storageTransactionId, o = i?.getService().getSnapshot(), s = o && "context" in o ? o.context : void 0, c = Fn(typeof s?.propertyValue == "string" ? s.propertyValue ?? "" : ""), l = [];
767
+ let i = r.internalProperties.storageTransactionId ?? r.allProperties.storageTransactionId, o = i?.getService().getSnapshot(), s = o && "context" in o ? o.context : void 0, c = Rn(typeof s?.propertyValue == "string" ? s.propertyValue ?? "" : ""), l = [];
769
768
  if (c && i && i.localId && i.versionLocalId) {
770
- let e = await kn(c.bytes);
769
+ let e = await Mn(c.bytes);
771
770
  l = [{
772
771
  data: c.bytes,
773
772
  contentHash: e,
774
773
  contentType: c.mimeType,
775
- tags: On(e, c.mimeType, n?.arweaveUploadTags),
774
+ tags: jn(e, c.mimeType, n?.arweaveUploadTags),
776
775
  itemPropertyName: i.propertyName,
777
776
  itemPropertyLocalId: i.localId,
778
777
  seedLocalId: r.seedLocalId,
@@ -783,35 +782,35 @@ async function Rn(e, t, n) {
783
782
  }
784
783
  return t;
785
784
  }
786
- var zn = async (e, t = [], n, r) => {
787
- let { itemUploadProperties: i, itemRelationProperties: a, itemImageProperties: o } = await Ie(e);
785
+ var Hn = async (e, t = [], n, r) => {
786
+ let { itemUploadProperties: i, itemRelationProperties: a, itemImageProperties: o } = await Be(e);
788
787
  if (!n && r?.onlyHtmlStorageSeedLocalIds?.length) {
789
- let e = await Ln(o, r);
788
+ let e = await Bn(o, r);
790
789
  return t.push(...e), t;
791
790
  }
792
- for (let e of i) t = await In(e, t, n, r);
793
- let s = await Ln(o, r);
794
- if (t.push(...s), !n && !r?.onlyHtmlStorageSeedLocalIds?.length && (t = await Rn(e, t, r)), r?.skipRelationRecursion) return t;
791
+ for (let e of i) t = await zn(e, t, n, r);
792
+ let s = await Bn(o, r);
793
+ if (t.push(...s), !n && !r?.onlyHtmlStorageSeedLocalIds?.length && (t = await Vn(e, t, r)), r?.skipRelationRecursion) return t;
795
794
  for (let e of a) {
796
795
  let n = e.getService().getSnapshot(), i = "context" in n ? n.context : null;
797
796
  if (!i) continue;
798
797
  let a = i.propertyValue;
799
798
  if (!a || e.uid) continue;
800
- let { seedLocalId: o, seedUid: s } = qe(We(a) ?? "");
799
+ let { seedLocalId: o, seedUid: s } = Ze(Je(a) ?? "");
801
800
  if (!o && !s) throw Error(`Invalid relation value for ${e.propertyName}: expected local seed id or 0x uid`);
802
801
  let c = await M.find({
803
802
  seedLocalId: o,
804
803
  seedUid: s
805
804
  });
806
805
  if (!c) {
807
- if (Be(a)) continue;
806
+ if (We(a)) continue;
808
807
  throw Error(`No relatedItem found for ${e.propertyName}`);
809
808
  }
810
- t = await zn(c, t, e, r);
809
+ t = await Hn(c, t, e, r);
811
810
  }
812
811
  return t;
813
- }, Bn = 3, Vn = new TextEncoder().encode("seed-recovery"), Hn = 32, Un = 18446744073709551615n;
814
- function Wn(e, t, n) {
812
+ }, Un = 3, Wn = new TextEncoder().encode("seed-recovery"), Gn = 32, Kn = 18446744073709551615n;
813
+ function qn(e, t, n) {
815
814
  let r = F.solidityPackedKeccak256([
816
815
  "uint256",
817
816
  "address",
@@ -819,20 +818,20 @@ function Wn(e, t, n) {
819
818
  ], [
820
819
  BigInt(t),
821
820
  e,
822
- n & Un
821
+ n & Kn
823
822
  ]);
824
823
  return F.getBytes(r);
825
824
  }
826
- function Gn(e) {
825
+ function Jn(e) {
827
826
  if (e.length === 0) return new Uint8Array([0]);
828
- if (e.length !== Hn) throw Error(`ANS-104 target/anchor must be empty or ${Hn} bytes, got ${e.length}`);
827
+ if (e.length !== Gn) throw Error(`ANS-104 target/anchor must be empty or ${Gn} bytes, got ${e.length}`);
829
828
  let t = /* @__PURE__ */ new Uint8Array(33);
830
829
  return t[0] = 1, t.set(e, 1), t;
831
830
  }
832
- function Kn(e) {
831
+ function Yn(e) {
833
832
  return typeof e == "object" && !!e && "privateKey" in e && typeof e.privateKey == "string";
834
833
  }
835
- function qn(e, t, n) {
834
+ function Xn(e, t, n) {
836
835
  let r = e >= 0 ? e << 1 : ~e << 1 | 1, i = n;
837
836
  do {
838
837
  let e = r & 127;
@@ -840,10 +839,10 @@ function qn(e, t, n) {
840
839
  } while (r);
841
840
  return i - n;
842
841
  }
843
- var Jn = (e) => {
842
+ var Zn = (e) => {
844
843
  if (!e?.length) return /* @__PURE__ */ new Uint8Array();
845
844
  let t = new TextEncoder(), n = /* @__PURE__ */ new Uint8Array(16), r = [], i = (e) => {
846
- let t = qn(e, n, 0);
845
+ let t = Xn(e, n, 0);
847
846
  r.push(n.slice(0, t));
848
847
  };
849
848
  i(e.length);
@@ -855,35 +854,35 @@ var Jn = (e) => {
855
854
  let a = r.reduce((e, t) => e + t.length, 0), o = new Uint8Array(a), s = 0;
856
855
  for (let e of r) o.set(e, s), s += e.length;
857
856
  return o;
858
- }, Yn = (e) => {
857
+ }, Qn = (e) => {
859
858
  let t = /* @__PURE__ */ new Uint8Array(8), n = new DataView(t.buffer);
860
859
  return n.setUint32(0, e & 4294967295, !0), n.setUint32(4, Math.floor(e / 4294967296), !0), t;
861
860
  };
862
- async function Xn(e) {
861
+ async function $n(e) {
863
862
  return new Uint8Array(await crypto.subtle.digest("SHA-384", e));
864
863
  }
865
- function Zn(e, t) {
864
+ function er(e, t) {
866
865
  let n = new Uint8Array(e.length + t.length);
867
866
  return n.set(e, 0), n.set(t, e.length), n;
868
867
  }
869
- async function Qn(e) {
868
+ async function tr(e) {
870
869
  let t = new TextEncoder();
871
870
  if (Array.isArray(e)) {
872
- let n = await Xn(Zn(t.encode("list"), t.encode(e.length.toString())));
871
+ let n = await $n(er(t.encode("list"), t.encode(e.length.toString())));
873
872
  for (let t of e) {
874
- let e = await Qn(t);
875
- n = await Xn(Zn(n, e));
873
+ let e = await tr(t);
874
+ n = await $n(er(n, e));
876
875
  }
877
876
  return n;
878
877
  }
879
- return Xn(Zn(await Xn(Zn(t.encode("blob"), t.encode(e.byteLength.toString()))), await Xn(e)));
878
+ return $n(er(await $n(er(t.encode("blob"), t.encode(e.byteLength.toString()))), await $n(e)));
880
879
  }
881
- async function $n(e, t, n, r, i) {
880
+ async function nr(e, t, n, r, i) {
882
881
  let a = new TextEncoder();
883
- return Qn([
882
+ return tr([
884
883
  a.encode("dataitem"),
885
884
  a.encode("1"),
886
- a.encode(Bn.toString()),
885
+ a.encode(Un.toString()),
887
886
  e,
888
887
  t,
889
888
  n,
@@ -891,11 +890,11 @@ async function $n(e, t, n, r, i) {
891
890
  i
892
891
  ]);
893
892
  }
894
- function er(e, t, n, r, i) {
895
- let a = Jn(t), o = Yn(t.length), s = Yn(a.length), c = [
893
+ function rr(e, t, n, r, i) {
894
+ let a = Zn(t), o = Qn(t.length), s = Qn(a.length), c = [
896
895
  e,
897
- Gn(r),
898
- Gn(i),
896
+ Jn(r),
897
+ Jn(i),
899
898
  o,
900
899
  s,
901
900
  a,
@@ -904,25 +903,25 @@ function er(e, t, n, r, i) {
904
903
  for (let e of c) u.set(e, d), d += e.length;
905
904
  return u;
906
905
  }
907
- async function tr(e, t) {
906
+ async function ir(e, t) {
908
907
  let n = /* @__PURE__ */ new Uint8Array(2);
909
- new DataView(n.buffer).setUint16(0, Bn, !0);
908
+ new DataView(n.buffer).setUint16(0, Un, !0);
910
909
  let r = 67 + t.length, i = new Uint8Array(r);
911
910
  i.set(n, 0), i.set(e, 2), i.set(t, 67);
912
911
  let a = await crypto.subtle.digest("SHA-256", new Uint8Array(e));
913
912
  return {
914
- id: sr(new Uint8Array(a)),
913
+ id: ur(new Uint8Array(a)),
915
914
  raw: i
916
915
  };
917
916
  }
918
- var nr = async (e, t, n, r = /* @__PURE__ */ new Uint8Array()) => {
919
- let i = F.SigningKey.computePublicKey(t.privateKey, !1), a = F.getBytes(i), o = Jn(n), s = /* @__PURE__ */ new Uint8Array(), c = await $n(a, s, r, o, e);
920
- return tr(F.getBytes(await t.signMessage(c)), er(a, n, e, s, r));
921
- }, rr = async (e, t, n, r = /* @__PURE__ */ new Uint8Array()) => {
922
- let i = F.hexlify(Vn), a = await t.signMessage({ message: { raw: i } }), o = F.hashMessage(Vn), s = F.SigningKey.recoverPublicKey(o, a), c = F.getBytes(s), l = Jn(n), u = /* @__PURE__ */ new Uint8Array(), d = await $n(c, u, r, l, e), f = F.hexlify(d), p = await t.signMessage({ message: { raw: f } });
923
- return tr(F.getBytes(p), er(c, n, e, u, r));
917
+ var ar = async (e, t, n, r = /* @__PURE__ */ new Uint8Array()) => {
918
+ let i = F.SigningKey.computePublicKey(t.privateKey, !1), a = F.getBytes(i), o = Zn(n), s = /* @__PURE__ */ new Uint8Array(), c = await nr(a, s, r, o, e);
919
+ return ir(F.getBytes(await t.signMessage(c)), rr(a, n, e, s, r));
920
+ }, or = async (e, t, n, r = /* @__PURE__ */ new Uint8Array()) => {
921
+ let i = F.hexlify(Wn), a = await t.signMessage({ message: { raw: i } }), o = F.hashMessage(Wn), s = F.SigningKey.recoverPublicKey(o, a), c = F.getBytes(s), l = Zn(n), u = /* @__PURE__ */ new Uint8Array(), d = await nr(c, u, r, l, e), f = F.hexlify(d), p = await t.signMessage({ message: { raw: f } });
922
+ return ir(F.getBytes(p), rr(c, n, e, u, r));
924
923
  };
925
- function ir(e) {
924
+ function sr(e) {
926
925
  if (e.length < 133) return null;
927
926
  let t = e[132];
928
927
  if (t !== 0 && t !== 1) return null;
@@ -935,8 +934,8 @@ function ir(e) {
935
934
  let a = i === 1;
936
935
  return a && e.length < r + 33 ? null : r + (a ? 33 : 1);
937
936
  }
938
- function ar(e) {
939
- let t = ir(e);
937
+ function cr(e) {
938
+ let t = sr(e);
940
939
  if (t == null) return null;
941
940
  let n = e[132] === 1, r = n ? e.slice(133, 165) : /* @__PURE__ */ new Uint8Array(), i = 132 + (n ? 33 : 1);
942
941
  return {
@@ -945,58 +944,58 @@ function ar(e) {
945
944
  tagsStart: t
946
945
  };
947
946
  }
948
- async function or(e) {
949
- let t = ar(e);
947
+ async function lr(e) {
948
+ let t = cr(e);
950
949
  if (t == null) return !1;
951
950
  let { rawTarget: n, rawAnchor: r, tagsStart: i } = t, a = i + 16;
952
951
  if (e.length < a) return !1;
953
952
  let o = new DataView(e.buffer, e.byteOffset, e.byteLength);
954
- if (o.getUint16(0, !0) !== Bn) return !1;
953
+ if (o.getUint16(0, !0) !== Un) return !1;
955
954
  let s = e.slice(2, 67), c = e.slice(67, 132), l = Number(o.getUint32(i + 8, !0) + o.getUint32(i + 12, !0) * 4294967296), u = i + 16 + l;
956
955
  if (e.length < u) return !1;
957
956
  let d = e.slice(i + 16, u), f = e.slice(u);
958
957
  try {
959
- let e = await $n(c, n, r, d, f), t = F.hashMessage(e), i = F.hexlify(s), a = F.SigningKey.recoverPublicKey(t, i), o = F.getBytes(a);
958
+ let e = await nr(c, n, r, d, f), t = F.hashMessage(e), i = F.hexlify(s), a = F.SigningKey.recoverPublicKey(t, i), o = F.getBytes(a);
960
959
  return o.length === c.length && o.every((e, t) => e === c[t]);
961
960
  } catch {
962
961
  return !1;
963
962
  }
964
963
  }
965
- var sr = (e) => {
964
+ var ur = (e) => {
966
965
  let t = "";
967
966
  for (let n of e) t += String.fromCharCode(n);
968
967
  return btoa(t).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
969
- }, cr = R("seedProtocol:createArweaveDataItems");
970
- async function lr(e, t, n) {
971
- let r, i;
968
+ }, dr = R("seedProtocol:createArweaveDataItems");
969
+ async function fr(e, t, n) {
970
+ let r, a;
972
971
  if (t) r = (await t(e)).map((e) => ({
973
972
  transaction: { id: e.transaction.id },
974
973
  versionId: e.versionId,
975
974
  modelName: e.modelName
976
975
  }));
977
976
  else if (n) {
978
- let t = [], a = Date.now();
977
+ let t = [], o = Date.now();
979
978
  for (let r = 0; r < e.length; r++) {
980
- let i = e[r], o = i.tags, s = /* @__PURE__ */ new Uint8Array(8);
981
- crypto.getRandomValues(s);
982
- let c = (new DataView(s.buffer).getBigUint64(0, !1) ^ BigInt(r)) & 18446744073709551615n, l;
983
- if (Kn(n)) {
984
- let e = Wn(n.address, a, c);
985
- l = await nr(i.data, n, o, e);
979
+ let a = e[r], s = a.tags, c = /* @__PURE__ */ new Uint8Array(8);
980
+ crypto.getRandomValues(c);
981
+ let l = (new DataView(c.buffer).getBigUint64(0, !1) ^ BigInt(r)) & 18446744073709551615n, u;
982
+ if (Yn(n)) {
983
+ let e = qn(n.address, o, l);
984
+ u = await ar(a.data, n, s, e);
986
985
  } else {
987
- let e = m(n) ? n.signer : n, t = Wn(e.address, a, c);
988
- l = await rr(i.data, e, o, t);
986
+ let e = i(n) ? n.signer : n, t = qn(e.address, o, l);
987
+ u = await or(a.data, e, s, t);
989
988
  }
990
- if (!await or(l.raw)) throw cr("DataItem verification failed: id=%s modelName=%s", l.id, i.itemPropertyName), Error(`DataItem signature verification failed for ${i.itemPropertyName}. The signing key may not match the owner, or the payload may have been modified.`);
991
- t.push(l);
989
+ if (!await lr(u.raw)) throw dr("DataItem verification failed: id=%s modelName=%s", u.id, a.itemPropertyName), Error(`DataItem signature verification failed for ${a.itemPropertyName}. The signing key may not match the owner, or the payload may have been modified.`);
990
+ t.push(u);
992
991
  }
993
- i = t, r = t.map((t, n) => ({
992
+ a = t, r = t.map((t, n) => ({
994
993
  transaction: { id: t.id },
995
994
  versionId: e[n]?.versionLocalId,
996
995
  modelName: e[n]?.itemPropertyName
997
996
  }));
998
997
  } else throw Error("@seedprotocol/publish: useArweaveBundler requires signDataItems or dataItemSigner (pass at createPublish or in PublishProvider config)");
999
- let a = e.map((e) => ({
998
+ let o = e.map((e) => ({
1000
999
  itemPropertyName: e.itemPropertyName,
1001
1000
  itemPropertyLocalId: e.itemPropertyLocalId,
1002
1001
  seedLocalId: e.seedLocalId,
@@ -1005,51 +1004,51 @@ async function lr(e, t, n) {
1005
1004
  }));
1006
1005
  return {
1007
1006
  arweaveTransactions: r,
1008
- publishUploads: a,
1009
- signedDataItems: i
1007
+ publishUploads: o,
1008
+ signedDataItems: a
1010
1009
  };
1011
1010
  }
1012
- var ur = L(async ({ input: { context: e } }) => {
1011
+ var pr = L(async ({ input: { context: e } }) => {
1013
1012
  let { item: t } = e;
1014
- t.getPublishUploads || (t = await bn(t.seedLocalId));
1013
+ t.getPublishUploads || (t = await Cn(t.seedLocalId));
1015
1014
  let n = {};
1016
1015
  e.arweaveUploadTags?.length && (n.arweaveUploadTags = e.arweaveUploadTags);
1017
1016
  let r = e.htmlEmbeddedDeferredHtmlSeedLocalIds;
1018
1017
  r?.length && (n.deferHtmlStorageSeedLocalIds = r);
1019
- let i = await zn(t, [], void 0, Object.keys(n).length ? n : void 0), a = E();
1020
- return lr(i, e.signDataItems ?? a.signDataItems, e.dataItemSigner ?? a.dataItemSigner);
1018
+ let i = await Hn(t, [], void 0, Object.keys(n).length ? n : void 0), a = T();
1019
+ return fr(i, e.signDataItems ?? a.signDataItems, e.dataItemSigner ?? a.dataItemSigner);
1021
1020
  });
1022
1021
  //#endregion
1023
1022
  //#region src/services/publish/actors/createArweaveDataItemsPhase2.ts
1024
- async function dr(e) {
1023
+ async function mr(e) {
1025
1024
  let { item: t } = e;
1026
- t.getPublishUploads || (t = await bn(t.seedLocalId));
1025
+ t.getPublishUploads || (t = await Cn(t.seedLocalId));
1027
1026
  let n = {};
1028
1027
  e.arweaveUploadTags?.length && (n.arweaveUploadTags = e.arweaveUploadTags);
1029
1028
  let r = e.htmlEmbeddedDeferredHtmlSeedLocalIds;
1030
1029
  r?.length && (n.onlyHtmlStorageSeedLocalIds = r, n.skipRelationRecursion = !0);
1031
- let i = await zn(t, [], void 0, Object.keys(n).length ? n : void 0), a = E(), o = e.signDataItems ?? a.signDataItems, s = e.dataItemSigner ?? a.dataItemSigner;
1030
+ let i = await Hn(t, [], void 0, Object.keys(n).length ? n : void 0), a = T(), o = e.signDataItems ?? a.signDataItems, s = e.dataItemSigner ?? a.dataItemSigner;
1032
1031
  return i.length === 0 ? {
1033
1032
  arweaveTransactions: [],
1034
1033
  publishUploads: [],
1035
1034
  signedDataItems: void 0
1036
- } : lr(i, o, s);
1035
+ } : fr(i, o, s);
1037
1036
  }
1038
- var fr = L(async ({ input: { context: e } }) => dr(e)), pr = 8192;
1039
- function mr(e) {
1037
+ var hr = L(async ({ input: { context: e } }) => mr(e)), gr = 8192;
1038
+ function _r(e) {
1040
1039
  let t = new Uint8Array(e), n = "";
1041
- for (let e = 0; e < t.length; e += pr) {
1042
- let r = t.subarray(e, Math.min(e + pr, t.length));
1040
+ for (let e = 0; e < t.length; e += gr) {
1041
+ let r = t.subarray(e, Math.min(e + gr, t.length));
1043
1042
  n += String.fromCharCode.apply(null, r);
1044
1043
  }
1045
1044
  return btoa(n);
1046
1045
  }
1047
- async function hr(e) {
1046
+ async function vr(e) {
1048
1047
  let t = [];
1049
1048
  for (let [n, r] of e.entries()) {
1050
1049
  let e = r;
1051
1050
  if (typeof e == "object" && e && "arrayBuffer" in e) {
1052
- let r = mr(await e.arrayBuffer()), i = e;
1051
+ let r = _r(await e.arrayBuffer()), i = e;
1053
1052
  t.push({
1054
1053
  name: n,
1055
1054
  value: r,
@@ -1063,19 +1062,19 @@ async function hr(e) {
1063
1062
  }
1064
1063
  return t;
1065
1064
  }
1066
- function gr(e, t, n) {
1065
+ function yr(e, t, n) {
1067
1066
  let r = ["Upload server returned ", String(e)], i = t && typeof t == "object" && "message" in t ? String(t.message) : t && typeof t == "object" && "error" in t ? String(t.error) : null;
1068
1067
  return i ? r.push(`: ${i}`) : n && r.push(` (${n})`), r.join("");
1069
1068
  }
1070
- function _r(e) {
1069
+ function br(e) {
1071
1070
  if (!e) return "Upload server unavailable. Please try again or check your connection.";
1072
1071
  let t = e.toLowerCase();
1073
1072
  return /other side closed|econnreset|socket hang up|connection closed/i.test(t) ? "Upload server closed the connection. It may be busy or the request may be too large—try again." : /etimedout|timeout/i.test(t) ? "Upload request timed out. Please try again." : /enotfound|getaddrinfo|dns/i.test(t) ? "Upload server could not be reached. Check the upload URL and your network." : "Upload failed. Please try again or check the upload server.";
1074
1073
  }
1075
- async function vr(e, t, n) {
1074
+ async function xr(e, t, n) {
1076
1075
  let r = typeof window < "u" ? window.Main : void 0;
1077
1076
  if (r?.uploadArweaveStart) {
1078
- let n = await hr(t);
1077
+ let n = await vr(t);
1079
1078
  return r.uploadArweaveStart(e, n);
1080
1079
  }
1081
1080
  let i = await fetch(e, {
@@ -1089,7 +1088,7 @@ async function vr(e, t, n) {
1089
1088
  }
1090
1089
  //#endregion
1091
1090
  //#region src/services/publish/actors/sendReimbursementRequest.ts
1092
- var yr = L(async ({ input: { context: e, event: t } }) => {
1091
+ var Sr = L(async ({ input: { context: e, event: t } }) => {
1093
1092
  let { arweaveTransactions: n = [], transactionKeys: r, reimbursementTransactionId: i } = e;
1094
1093
  if (i) return { transactionId: i };
1095
1094
  let a = n.map(({ transaction: e }) => e), o = new FormData();
@@ -1101,15 +1100,15 @@ var yr = L(async ({ input: { context: e, event: t } }) => {
1101
1100
  let s = new Blob([JSON.stringify(r)], { type: "application/json" });
1102
1101
  o.append(`${e.id}-json`, s, `${e.id}-json`);
1103
1102
  }
1104
- let { uploadApiBaseUrl: s } = E(), { status: c, body: l, message: u } = await vr(`${s}/api/upload/arweave/start`, o, s);
1103
+ let { uploadApiBaseUrl: s } = T(), { status: c, body: l, message: u } = await xr(`${s}/api/upload/arweave/start`, o, s);
1105
1104
  if (c >= 300 || c < 200) {
1106
1105
  let e = c === 0 ? u : null;
1107
1106
  e && console.error("[upload]", e);
1108
- let t = c === 0 ? _r(e) : gr(c, l, r);
1107
+ let t = c === 0 ? br(e) : yr(c, l, r);
1109
1108
  throw Error(t);
1110
1109
  }
1111
1110
  return l;
1112
- }), br = L(async ({ input: { context: e, event: t } }) => {
1111
+ }), Cr = L(async ({ input: { context: e, event: t } }) => {
1113
1112
  let { requestResponse: n, reimbursementTransactionId: r } = e;
1114
1113
  if (!n) throw Error("No request response");
1115
1114
  if (!r) throw Error("No reimbursement transaction id");
@@ -1126,12 +1125,12 @@ var yr = L(async ({ input: { context: e, event: t } }) => {
1126
1125
  }, 5e3);
1127
1126
  });
1128
1127
  }), G = R("seedProtocol:services:publish:actors");
1129
- function xr(e) {
1128
+ function wr(e) {
1130
1129
  if (e instanceof Uint8Array) return e;
1131
1130
  if (e instanceof ArrayBuffer) return new Uint8Array(e);
1132
1131
  throw Error("Transaction data must be Uint8Array or ArrayBuffer for upload resume");
1133
1132
  }
1134
- var Sr = It(({ sendBack: e, input: t }) => {
1133
+ var Tr = zt(({ sendBack: e, input: t }) => {
1135
1134
  let n = t.context, r = (n.arweaveTransactions ?? []).map(({ transaction: e }) => e), i = B(), a = n.uploaderState && typeof n.currentTransactionIndex == "number", o = a ? n.currentTransactionIndex : 0;
1136
1135
  (async () => {
1137
1136
  let t = r.length;
@@ -1142,7 +1141,7 @@ var Sr = It(({ sendBack: e, input: t }) => {
1142
1141
  if (!await i.transactions.verify(l)) throw Error("Transaction verification failed");
1143
1142
  let u, d = n.uploaderState;
1144
1143
  if (a && s === o && d) {
1145
- let e = l.data, t = e instanceof Uint8Array ? e : xr(e);
1144
+ let e = l.data, t = e instanceof Uint8Array ? e : wr(e);
1146
1145
  u = await i.transactions.getUploader(d, t);
1147
1146
  } else u = await i.transactions.getUploader(l, l.data);
1148
1147
  for (; !u.isComplete;) {
@@ -1171,20 +1170,20 @@ var Sr = It(({ sendBack: e, input: t }) => {
1171
1170
  error: t
1172
1171
  });
1173
1172
  });
1174
- }), Cr = 12e4, wr = Function("s", "return import(s)"), Tr = null, Er = async () => {
1175
- if (Tr) return Tr;
1173
+ }), Er = 12e4, Dr = Function("s", "return import(s)"), Or = null, kr = async () => {
1174
+ if (Or) return Or;
1176
1175
  if (typeof window < "u") return null;
1177
1176
  try {
1178
- let e = await wr(`node:${["fs", "promises"].join("/")}`);
1179
- return Tr = {
1177
+ let e = await Dr(`node:${["fs", "promises"].join("/")}`);
1178
+ return Or = {
1180
1179
  readFile: e.readFile,
1181
1180
  stat: e.stat
1182
- }, Tr;
1181
+ }, Or;
1183
1182
  } catch {
1184
1183
  return null;
1185
1184
  }
1186
- }, Dr = It(({ sendBack: e, input: { context: t } }) => {
1187
- let { signedDataItems: n } = t, { uploadApiBaseUrl: r, useArweaveBundler: i } = E();
1185
+ }, Ar = zt(({ sendBack: e, input: { context: t } }) => {
1186
+ let { signedDataItems: n } = t, { uploadApiBaseUrl: r, useArweaveBundler: i } = T();
1188
1187
  if (!i || !r) {
1189
1188
  e({
1190
1189
  type: "uploadError",
@@ -1209,7 +1208,7 @@ var Sr = It(({ sendBack: e, input: t }) => {
1209
1208
  return r[t] = a, a.length;
1210
1209
  }
1211
1210
  if (n.filename != null) {
1212
- let e = await Er();
1211
+ let e = await kr();
1213
1212
  if (!e) throw Error("DataItem.filename requires Node.js fs access. In browser runtime, provide DataItem.raw or DataItem.getRaw().");
1214
1213
  return (await e.stat(n.filename)).size;
1215
1214
  }
@@ -1233,7 +1232,7 @@ var Sr = It(({ sendBack: e, input: t }) => {
1233
1232
  continue;
1234
1233
  }
1235
1234
  if (a.filename != null) {
1236
- let e = await Er();
1235
+ let e = await kr();
1237
1236
  if (!e) throw Error("DataItem.filename requires Node.js fs access. In browser runtime, provide DataItem.raw or DataItem.getRaw().");
1238
1237
  let t = await e.readFile(a.filename);
1239
1238
  c.writeUInt32BE(t.length, l), l += 4, t.copy(c, l), l += t.length;
@@ -1241,7 +1240,7 @@ var Sr = It(({ sendBack: e, input: t }) => {
1241
1240
  }
1242
1241
  throw Error("Cannot get raw bytes from DataItem");
1243
1242
  }
1244
- let u = new AbortController(), d = setTimeout(() => u.abort(), Cr), f;
1243
+ let u = new AbortController(), d = setTimeout(() => u.abort(), Er), f;
1245
1244
  try {
1246
1245
  f = await fetch(a, {
1247
1246
  method: "POST",
@@ -1250,7 +1249,7 @@ var Sr = It(({ sendBack: e, input: t }) => {
1250
1249
  signal: u.signal
1251
1250
  });
1252
1251
  } catch (e) {
1253
- throw clearTimeout(d), e instanceof Error && e.name === "AbortError" ? Error(`Arweave batch upload timed out after ${Cr / 1e3}s (upload API did not respond). Check uploadApiBaseUrl and network.`) : e;
1252
+ throw clearTimeout(d), e instanceof Error && e.name === "AbortError" ? Error(`Arweave batch upload timed out after ${Er / 1e3}s (upload API did not respond). Check uploadApiBaseUrl and network.`) : e;
1254
1253
  }
1255
1254
  if (clearTimeout(d), !f.ok) throw Error(`Batch upload failed: ${f.status}`);
1256
1255
  let p = await f.json().catch(() => ({})), m = typeof p.failed == "number" ? p.failed : 0;
@@ -1265,50 +1264,108 @@ var Sr = It(({ sendBack: e, input: t }) => {
1265
1264
  type: "uploadError",
1266
1265
  error: t
1267
1266
  }));
1268
- }), Or = /* @__PURE__ */ e({
1269
- ExternalWalletsForDeploy: () => Hr,
1270
- appMetadata: () => Gr,
1271
- deployManagedAccountViaFactory: () => Wr,
1272
- deploySmartWalletContract: () => Ur,
1273
- getConnectedAccount: () => qr,
1274
- getConnectedManagedAccountAddress: () => Kr,
1275
- getConnectedModularAccount: () => Jr,
1276
- getManagedAccountWallet: () => Qr,
1277
- getModularAccountWallet: () => ei,
1278
- getSharedPublishInAppWalletStorage: () => Mr,
1279
- getSmartWalletAddressForAdmin: () => Rr,
1280
- getWalletsForConnectButton: () => ti,
1281
- isSmartWalletDeployed: () => zr,
1282
- pollSmartWalletDeployed: () => Br,
1283
- resolveSmartWalletForPublish: () => Vr,
1284
- syncPublishInAppAuthToken: () => Nr,
1285
- useActiveSmartWalletContract: () => Lr,
1286
- useLocalWalletAccount: () => Ir,
1287
- wallets: () => Fr
1288
- }), kr = R("permaPress:helpers:thirdweb"), Ar = "seedProtocol:inAppPublish:", jr = null;
1289
- function Mr() {
1290
- return jr ||= {
1291
- getItem: async (e) => typeof window > "u" ? null : localStorage.getItem(Ar + e),
1267
+ }), jr = 12000n;
1268
+ function Mr(e) {
1269
+ return "paymasterAndData" in e && e.paymasterAndData ? e.paymasterAndData : "0x";
1270
+ }
1271
+ function Nr(e, t, n) {
1272
+ return async (r) => {
1273
+ if (D("paymaster hook called (userOp from thirdweb; callGasLimit is tx.gas or 0)", {
1274
+ sender: r.sender,
1275
+ chainId: t.id,
1276
+ bundlerUrl: n ?? "(thirdweb default)",
1277
+ entryPoint: "initCode" in r ? "v0.6" : "v0.7",
1278
+ ...S(r)
1279
+ }), !("initCode" in r)) throw Error("@seedprotocol/publish: the managed account sent an EntryPoint v0.7 UserOp; its sponsored gas handling only supports EntryPoint v0.6.");
1280
+ let i = typeof e == "function" ? e() : e, a = await qt({
1281
+ userOp: r,
1282
+ client: i,
1283
+ chain: t
1284
+ });
1285
+ D("1/3 paymaster sponsored (limits here are ignored)", S(a));
1286
+ let o = {
1287
+ ...r,
1288
+ paymasterAndData: Mr(a)
1289
+ }, s = await Kt({
1290
+ userOp: o,
1291
+ options: {
1292
+ client: i,
1293
+ chain: t,
1294
+ bundlerUrl: n
1295
+ }
1296
+ });
1297
+ D("2/3 bundler estimate (callGasLimit includes thirdweb's +50k)", S(s));
1298
+ let c = s.callGasLimit * jr / 10000n;
1299
+ o.callGasLimit = r.callGasLimit > c ? r.callGasLimit : c, o.verificationGasLimit = s.verificationGasLimit, o.preVerificationGas = s.preVerificationGas, D("raised limits sent to the paymaster for signing", {
1300
+ ...S(o),
1301
+ headroomBps: jr,
1302
+ raisedEstimate: c,
1303
+ txGas: r.callGasLimit
1304
+ });
1305
+ let l = await qt({
1306
+ userOp: o,
1307
+ client: i,
1308
+ chain: t
1309
+ });
1310
+ if (D("3/3 paymaster signed", S(l)), l.callGasLimit && l.verificationGasLimit && l.preVerificationGas) return D("returning to thirdweb: the PAYMASTER's own limits (its signature covers them)", {
1311
+ ...S(l),
1312
+ requestedCallGasLimit: o.callGasLimit
1313
+ }), l;
1314
+ let u = {
1315
+ paymasterAndData: Mr(l),
1316
+ callGasLimit: o.callGasLimit,
1317
+ verificationGasLimit: o.verificationGasLimit,
1318
+ preVerificationGas: o.preVerificationGas
1319
+ };
1320
+ return D("returning to thirdweb: our raised limits (thirdweb should send exactly these)", S(u)), u;
1321
+ };
1322
+ }
1323
+ //#endregion
1324
+ //#region src/helpers/thirdweb.ts
1325
+ var Pr = /* @__PURE__ */ e({
1326
+ ExternalWalletsForDeploy: () => Jr,
1327
+ appMetadata: () => Zr,
1328
+ deployManagedAccountViaFactory: () => Xr,
1329
+ deploySmartWalletContract: () => Yr,
1330
+ getConnectedAccount: () => $r,
1331
+ getConnectedManagedAccountAddress: () => Qr,
1332
+ getConnectedModularAccount: () => ei,
1333
+ getManagedAccountWallet: () => ii,
1334
+ getModularAccountWallet: () => oi,
1335
+ getSharedPublishInAppWalletStorage: () => Rr,
1336
+ getSmartWalletAddressForAdmin: () => Wr,
1337
+ getWalletsForConnectButton: () => si,
1338
+ isSmartWalletDeployed: () => Gr,
1339
+ pollSmartWalletDeployed: () => Kr,
1340
+ resolveSmartWalletForPublish: () => qr,
1341
+ syncPublishInAppAuthToken: () => zr,
1342
+ useActiveSmartWalletContract: () => Ur,
1343
+ useLocalWalletAccount: () => Hr,
1344
+ wallets: () => Vr
1345
+ }), Fr = R("permaPress:helpers:thirdweb"), Ir = "seedProtocol:inAppPublish:", Lr = null;
1346
+ function Rr() {
1347
+ return Lr ||= {
1348
+ getItem: async (e) => typeof window > "u" ? null : localStorage.getItem(Ir + e),
1292
1349
  setItem: async (e, t) => {
1293
- typeof window > "u" || localStorage.setItem(Ar + e, t);
1350
+ typeof window > "u" || localStorage.setItem(Ir + e, t);
1294
1351
  },
1295
1352
  removeItem: async (e) => {
1296
- typeof window > "u" || localStorage.removeItem(Ar + e);
1353
+ typeof window > "u" || localStorage.removeItem(Ir + e);
1297
1354
  }
1298
- }, jr;
1355
+ }, Lr;
1299
1356
  }
1300
- function Nr() {
1357
+ function zr() {
1301
1358
  if (typeof window > "u") return {
1302
1359
  syncedBareToPrefixed: !1,
1303
1360
  syncedPrefixedToBare: !1
1304
1361
  };
1305
- let { thirdwebClientId: e } = E();
1362
+ let { thirdwebClientId: e } = T();
1306
1363
  if (!e) return {
1307
1364
  syncedBareToPrefixed: !1,
1308
1365
  syncedPrefixedToBare: !1
1309
1366
  };
1310
1367
  try {
1311
- let t = `walletToken-${e}`, n = `${Ar}${t}`, r = localStorage.getItem(t), i = localStorage.getItem(n), a = !1, o = !1;
1368
+ let t = `walletToken-${e}`, n = `${Ir}${t}`, r = localStorage.getItem(t), i = localStorage.getItem(n), a = !1, o = !1;
1312
1369
  return r && !i && (localStorage.setItem(n, r), a = !0), i && !r && (localStorage.setItem(t, i), o = !0), i && r && r !== i && (localStorage.setItem(t, i), o = !0), {
1313
1370
  syncedBareToPrefixed: a,
1314
1371
  syncedPrefixedToBare: o
@@ -1320,102 +1377,102 @@ function Nr() {
1320
1377
  };
1321
1378
  }
1322
1379
  }
1323
- async function Pr(e = b()) {
1324
- Nr();
1325
- let t = Qr();
1380
+ async function Br(e = O()) {
1381
+ zr();
1382
+ let t = ii();
1326
1383
  return await t.autoConnect({
1327
1384
  client: k(),
1328
1385
  chain: e
1329
1386
  }), t;
1330
1387
  }
1331
- var Fr = [Bt("io.metamask")], Ir = () => {
1332
- let [e, t] = Dt(null);
1333
- return Bt("io.metamask"), Et(!1), Tt(() => {}, []), e;
1334
- }, Lr = () => {
1335
- let e = Ht(), [t, n] = Dt(null);
1336
- return Tt(() => {
1337
- e && e.address && n(st({
1388
+ var Vr = [Ut("io.metamask")], Hr = () => {
1389
+ let [e, t] = At(null);
1390
+ return Ut("io.metamask"), kt(!1), Ot(() => {}, []), e;
1391
+ }, Ur = () => {
1392
+ let e = Gt(), [t, n] = At(null);
1393
+ return Ot(() => {
1394
+ e && e.address && n(dt({
1338
1395
  client: k(),
1339
- chain: b(),
1396
+ chain: O(),
1340
1397
  address: e.address
1341
1398
  }));
1342
1399
  }, [e]), t;
1343
1400
  };
1344
- async function Rr(e, t = "0x") {
1345
- return y(e, t);
1401
+ async function Wr(e, t = "0x") {
1402
+ return _(e, t);
1346
1403
  }
1347
- async function zr(e) {
1348
- return ue(e);
1404
+ async function Gr(e) {
1405
+ return ce(e);
1349
1406
  }
1350
- async function Br(e, t, n) {
1351
- return me(e, t, n);
1407
+ async function Kr(e, t, n) {
1408
+ return ve(e, t, n);
1352
1409
  }
1353
- async function Vr(e) {
1410
+ async function qr(e) {
1354
1411
  if (!e) return { needsDeploy: !0 };
1355
- if (await zr(e.address)) return {
1412
+ if (await Gr(e.address)) return {
1356
1413
  address: e.address,
1357
1414
  account: e
1358
1415
  };
1359
- let t = await Rr(e.address);
1360
- return await zr(t) ? {
1416
+ let t = await Wr(e.address);
1417
+ return await Gr(t) ? {
1361
1418
  address: t,
1362
1419
  account: e
1363
1420
  } : { needsDeploy: !0 };
1364
1421
  }
1365
- var Hr = [Bt("io.metamask"), Bt("me.rainbow")], Ur = async (e) => {
1366
- let t = st({
1422
+ var Jr = [Ut("io.metamask"), Ut("me.rainbow")], Yr = async (e) => {
1423
+ let t = dt({
1367
1424
  client: k(),
1368
- chain: b(),
1425
+ chain: O(),
1369
1426
  address: e.address
1370
- }), n = await ot({
1427
+ }), n = await ut({
1371
1428
  smartAccount: e,
1372
- chain: b(),
1429
+ chain: O(),
1373
1430
  client: k(),
1374
1431
  accountContract: t
1375
1432
  });
1376
- return kr("deploySmartAccount result:", n), n;
1433
+ return Fr("deploySmartAccount result:", n), n;
1377
1434
  };
1378
- async function Wr(e) {
1379
- let { asThirdwebPublishWallet: t } = await import("./chainConfig-BYm5OXpk.js").then((e) => e.g), n = t(e.signingAccount), r = xe(e.adminAddress, e.data ?? "0x");
1435
+ async function Xr(e) {
1436
+ let { asThirdwebPublishWallet: t } = await import("./chainConfig-DWzoOtkS.js").then((e) => e.g), n = t(e.signingAccount), r = b(e.adminAddress, e.data ?? "0x");
1380
1437
  await n.txSender.sendTransaction(r);
1381
1438
  }
1382
- var Gr = {
1439
+ var Zr = {
1383
1440
  name: "Seed Protocol",
1384
1441
  description: "Seed Protocol",
1385
1442
  url: "https://seedprotocol.io"
1386
1443
  };
1387
- async function Kr(e = b()) {
1388
- let t = (await Pr(e)).getAccount();
1444
+ async function Qr(e = O()) {
1445
+ let t = (await Br(e)).getAccount();
1389
1446
  if (!t) throw Error("Failed to get managed account");
1390
1447
  return t.address;
1391
1448
  }
1392
- async function qr() {
1449
+ async function $r() {
1393
1450
  try {
1394
- let e = ei();
1451
+ let e = oi();
1395
1452
  return await e.autoConnect({
1396
1453
  client: k(),
1397
- chain: b()
1454
+ chain: O()
1398
1455
  }), e.getAccount() ?? null;
1399
1456
  } catch {
1400
1457
  return null;
1401
1458
  }
1402
1459
  }
1403
- async function Jr() {
1404
- return qr();
1460
+ async function ei() {
1461
+ return $r();
1405
1462
  }
1406
- function Yr(e) {
1407
- let t = b(e).id, n = e.managedAccountFactoryAddress ?? ne[t];
1463
+ function ti(e) {
1464
+ let t = O(e).id, n = e.managedAccountFactoryAddress ?? h[t];
1408
1465
  if (!n) throw Error(`@seedprotocol/publish: no ManagedAccount factory is known for chain ${t}. Pass managedAccountFactoryAddress in publish config, or use the EOA / direct EAS path.`);
1409
1466
  return n;
1410
1467
  }
1411
- var Xr = [
1468
+ var ni = [
1412
1469
  "farcaster",
1413
1470
  "email",
1414
1471
  "passkey",
1415
1472
  "phone"
1416
- ], Zr = null, Qr = (e) => {
1417
- let t = e ?? x(), n = b(t ?? void 0), r = t ? Yr(t) : ee(), { bundlerUrl: i, sponsorGas: a } = ge(t);
1418
- if (!i && ve(n)) throw Error(`@seedprotocol/publish: chain ${n.id} is local, so Thirdweb's hosted bundler cannot reach it. Set PublishConfig.thirdweb.bundlerUrl to the chain's bundler (seedTwinConfig does this for the twin).`);
1473
+ ], ri = null, ii = (e) => {
1474
+ let t = e ?? re(), n = O(t ?? void 0), r = t ? ti(t) : se(), { bundlerUrl: i, sponsorGas: a } = we(t);
1475
+ if (!i && ae(n)) throw Error(`@seedprotocol/publish: chain ${n.id} is local, so Thirdweb's hosted bundler cannot reach it. Set PublishConfig.thirdweb.bundlerUrl to the chain's bundler (seedTwinConfig does this for the twin).`);
1419
1476
  let o = [
1420
1477
  n.id,
1421
1478
  n.rpc,
@@ -1423,100 +1480,183 @@ var Xr = [
1423
1480
  i ?? "",
1424
1481
  a
1425
1482
  ].join("|").toLowerCase();
1426
- return Zr?.key !== o && (Zr = {
1483
+ return ri?.key !== o && (D("managed wallet built", {
1484
+ chainId: n.id,
1485
+ sponsorGas: a,
1486
+ bundlerUrl: i ?? "(thirdweb default)",
1487
+ paymasterHook: a ? "installed" : "none (thirdweb estimates callGasLimit itself)"
1488
+ }), ri = {
1427
1489
  key: o,
1428
- wallet: Vt({
1429
- storage: Mr(),
1430
- auth: { options: [...Xr] },
1490
+ wallet: Wt({
1491
+ storage: Rr(),
1492
+ auth: { options: [...ni] },
1431
1493
  executionMode: {
1432
1494
  mode: "EIP4337",
1433
1495
  smartAccount: {
1434
1496
  chain: n,
1435
1497
  factoryAddress: r,
1436
1498
  sponsorGas: a,
1437
- ...i ? { overrides: { bundlerUrl: i } } : {}
1499
+ ...i || a ? { overrides: {
1500
+ ...i ? { bundlerUrl: i } : {},
1501
+ ...a ? { paymaster: Nr(k, n, i) } : {}
1502
+ } } : {}
1438
1503
  }
1439
1504
  }
1440
1505
  })
1441
- }), Zr.wallet;
1442
- }, $r = null, ei = (e) => {
1443
- let t = e ?? x(), { modularWalletMode: n, sponsorGas: r } = ge(t);
1506
+ }), ri.wallet;
1507
+ }, ai = null, oi = (e) => {
1508
+ let t = e ?? re(), { modularWalletMode: n, sponsorGas: r } = we(t);
1444
1509
  if (n === "EIP7702") {
1445
- let e = b(t ?? void 0);
1446
- if (ve(e)) throw Error(`@seedprotocol/publish: chain ${e.id} is local, and Thirdweb's EIP-7702 mode needs its hosted bundler, which cannot reach it. Set PublishConfig.thirdweb.modularWalletMode to 'EOA' and fund the in-app EOA (seedTwinConfig does this for the twin).`);
1510
+ let e = O(t ?? void 0);
1511
+ if (ae(e)) throw Error(`@seedprotocol/publish: chain ${e.id} is local, and Thirdweb's EIP-7702 mode needs its hosted bundler, which cannot reach it. Set PublishConfig.thirdweb.modularWalletMode to 'EOA' and fund the in-app EOA (seedTwinConfig does this for the twin).`);
1447
1512
  }
1448
1513
  let i = `${n}|${r}`;
1449
- return $r?.key !== i && ($r = {
1514
+ return ai?.key !== i && (ai = {
1450
1515
  key: i,
1451
- wallet: Vt({
1452
- storage: Mr(),
1453
- auth: { options: [...Xr] },
1516
+ wallet: Wt({
1517
+ storage: Rr(),
1518
+ auth: { options: [...ni] },
1454
1519
  executionMode: n === "EOA" ? { mode: "EOA" } : {
1455
1520
  mode: "EIP7702",
1456
1521
  sponsorGas: r
1457
1522
  }
1458
1523
  })
1459
- }), $r.wallet;
1460
- }, ti = (e) => {
1461
- let t = e ?? x() ?? void 0;
1462
- return t?.useModularExecutor ? [ei(t)] : [Qr(t)];
1463
- }, ni = () => `The executor module could not be installed on your publishing account on ${D()}. Reconnect and try again, or contact support if this persists.`;
1464
- async function ri(e, t, n) {
1465
- let { modularAccountModuleContract: r } = n;
1466
- if (!r || !await ue(e)) return;
1467
- let i = await pe(e);
1468
- if (i) {
1469
- await ii(e, i.executor, r);
1470
- return;
1524
+ }), ai.wallet;
1525
+ }, si = (e) => {
1526
+ let t = e ?? re() ?? void 0;
1527
+ return t?.useModularExecutor ? [oi(t)] : [ii(t)];
1528
+ }, ci = "This ManagedAccount predates the Seed executor router extension, so the Seed executor cannot act for it and publish automation is not available for this account.", li = "The Seed executor is not installed for this ManagedAccount, so automation session keys cannot publish through it. The account admin installs it (installSeedExecutor), which enrollPublishAutomation does.", ui = "The Seed executor module is configured with a different EAS contract for this ManagedAccount than publish config. Automation session keys cannot change it.", di = "Could not read the Seed executor module state for this ManagedAccount.";
1529
+ function fi() {
1530
+ let e = T().modularAccountModuleContract?.trim();
1531
+ if (!e || !/^0x[0-9a-fA-F]{40}$/.test(e)) throw Error("@seedprotocol/publish: publish automation requires PublishConfig.modularAccountModuleContract (executor module).");
1532
+ return e;
1533
+ }
1534
+ async function pi(e) {
1535
+ return await ie(e) === null;
1536
+ }
1537
+ async function mi(e, t = {}) {
1538
+ let n = fi(), r = e, i, a;
1539
+ if (t.installedEas) i = !0, a = t.installedEas;
1540
+ else try {
1541
+ i = await Te(() => te(n, r), Boolean, { attempts: t.readAttempts ?? 1 }), a = i ? await x(n, r) : lt;
1542
+ } catch (t) {
1543
+ throw new w(di, "AUTOMATION_UNSUPPORTED_ACCOUNT", e, t);
1471
1544
  }
1472
- let a = st({
1473
- client: k(),
1474
- chain: b(),
1475
- address: e
1545
+ if (!i) {
1546
+ let t = await pi(r) ? ci : li;
1547
+ throw new w(t, "AUTOMATION_UNSUPPORTED_ACCOUNT", e);
1548
+ }
1549
+ let o = T().easContractAddress?.toLowerCase();
1550
+ if (o && a.toLowerCase() !== o) throw new w(ui, "AUTOMATION_UNSUPPORTED_ACCOUNT", e);
1551
+ }
1552
+ function hi(e) {
1553
+ let t = e instanceof rt ? `${e.shortMessage} ${e.details} ${e.message}` : String(e);
1554
+ return /insufficient funds|insufficient balance/i.test(t);
1555
+ }
1556
+ async function gi(e) {
1557
+ let { managedAddress: t, tx: n, action: r, code: i = "AUTOMATION_PREFLIGHT_FAILED", requireSimulation: a = !0 } = e, o = (e) => Ce().call({
1558
+ account: t,
1559
+ to: n.to,
1560
+ data: n.data,
1561
+ value: n.value,
1562
+ ...e ? { stateOverride: [{
1563
+ address: t,
1564
+ balance: st("1000")
1565
+ }] } : {}
1476
1566
  });
1477
1567
  try {
1478
- let e = await Ut({ contract: a }), n = r.toLowerCase();
1479
- if (e.some((e) => e.implementation?.toLowerCase() === n)) return;
1480
- let i = Wt({
1481
- contract: a,
1482
- moduleContract: r,
1483
- data: tt([{ type: "address" }], [E().easContractAddress])
1484
- }), o = await ct({
1485
- transaction: i,
1486
- account: t
1487
- });
1488
- await C(o.transactionHash);
1489
- } catch (t) {
1490
- if (Ce(t)) return;
1491
- throw new O(ni(), "EXECUTOR_MODULE_NOT_INSTALLED", e, t);
1568
+ try {
1569
+ await o(!1);
1570
+ } catch (e) {
1571
+ if (!hi(e)) throw e;
1572
+ await o(!0);
1573
+ }
1574
+ } catch (e) {
1575
+ let n = Qt(e);
1576
+ if (!n && !a) return;
1577
+ let o = n ? en(Zt(e)) : "could not be simulated";
1578
+ throw new w(`Simulated ${r} from ${t} ${o}; nothing was sent.`, i, t, e);
1492
1579
  }
1493
1580
  }
1494
- async function ii(e, t, n) {
1495
- if (t.toLowerCase() !== n.trim().toLowerCase()) throw new O(`Your publishing account's Seed executor is ${t}, but publish config sets modularAccountModuleContract to ${n}. Point modularAccountModuleContract at the account's executor.`, "EXECUTOR_MODULE_NOT_INSTALLED", e);
1581
+ //#endregion
1582
+ //#region src/helpers/ensureExecutorModule.ts
1583
+ var _i = () => `The executor module could not be installed on your publishing account on ${E()}. Reconnect and try again, or contact support if this persists.`;
1584
+ async function vi(e, t, n) {
1585
+ let { modularAccountModuleContract: r } = n;
1586
+ if (!r || !await ce(e)) return { status: "skipped" };
1587
+ let i = await ie(e);
1588
+ return i ? yi(e, i.executor, r) : { status: "skipped" };
1589
+ }
1590
+ async function yi(e, t, n) {
1591
+ if (t.toLowerCase() !== n.trim().toLowerCase()) throw new w(`Your publishing account's Seed executor is ${t}, but publish config sets modularAccountModuleContract to ${n}. Point modularAccountModuleContract at the account's executor.`, "EXECUTOR_MODULE_NOT_INSTALLED", e);
1592
+ let r = e, i, a, o;
1496
1593
  try {
1497
- if (await le(e, t)) return;
1498
- let { getManagedAccountAdmin: n } = await import("./managedAccountAdmin-B64V1rlU.js").then((e) => e.n), r = await re(await n(e)).txSender.sendTransaction(g(e));
1499
- await C(r.transactionHash);
1594
+ if (await me(r, t)) return { status: "already-installed" };
1595
+ let { getManagedAccountAdmin: n } = await import("./managedAccountAdmin-B4HkLWWE.js").then((e) => e.n), s = fe(await n(e));
1596
+ i = s.txSender.address;
1597
+ let c = await s.txSender.sendTransaction(f(r));
1598
+ o = c.transactionHash;
1599
+ try {
1600
+ a = await C(c.transactionHash);
1601
+ } catch (e) {
1602
+ if (!(e instanceof pe)) throw e;
1603
+ }
1500
1604
  } catch (t) {
1501
- throw t instanceof O ? t : new O(ni(), "EXECUTOR_MODULE_NOT_INSTALLED", e, t);
1605
+ throw t instanceof w ? t : new w(_i(), "EXECUTOR_MODULE_NOT_INSTALLED", e, t);
1606
+ }
1607
+ let s = a && bi(a, r, t);
1608
+ if (s) return {
1609
+ status: "installed",
1610
+ eas: s,
1611
+ transactionHash: o
1612
+ };
1613
+ let c = await xi(r, i);
1614
+ if (c === "already-installed") return { status: "already-installed" };
1615
+ throw new w(`installSeedExecutor in transaction ${o} did not install the Seed executor on ${e}${c ? `: ${c}` : ""}.`, "EXECUTOR_MODULE_NOT_INSTALLED", e);
1616
+ }
1617
+ function bi(e, t, n) {
1618
+ if (P({
1619
+ abi: oe,
1620
+ eventName: "SeedExecutorInstalled",
1621
+ logs: e.logs,
1622
+ strict: !1
1623
+ }).some((e) => ot(e.address, t) && e.args.executor && ot(e.args.executor, n))) return P({
1624
+ abi: y,
1625
+ eventName: "ModuleInitialized",
1626
+ logs: e.logs,
1627
+ strict: !1
1628
+ }).find((e) => ot(e.address, n) && e.args.account && ot(e.args.account, t))?.args.eas;
1629
+ }
1630
+ async function xi(e, t) {
1631
+ try {
1632
+ await gi({
1633
+ managedAddress: t,
1634
+ tx: f(e),
1635
+ action: "installSeedExecutor",
1636
+ requireSimulation: !1
1637
+ });
1638
+ return;
1639
+ } catch (e) {
1640
+ let t = en(Zt(e instanceof w ? e.underlyingCause : e));
1641
+ return t === "reverted with SeedExecutorAlreadyInstalled" ? "already-installed" : t;
1502
1642
  }
1503
1643
  }
1504
1644
  //#endregion
1505
1645
  //#region src/helpers/ensureManagedAccountReady.ts
1506
- var ai = () => `Could not connect the managed publishing account on ${D()}. Reconnect with the same sign-in method and try again.`, oi = () => `Your publishing smart account is not deployed on ${D()} yet. Complete wallet setup, enable autoDeployManagedAccount in config if appropriate, then try again.`, si = () => `The managed account could not be confirmed on ${D()} after deployment. Wait a moment and retry, or check your network connection.`, ci = () => `Automatic deployment of the managed publishing account failed on ${D()}. Retry or deploy the account through your wallet provider.`;
1507
- async function li() {
1508
- let { useModularExecutor: e } = E();
1646
+ var Si = () => `Could not connect the managed publishing account on ${E()}. Reconnect with the same sign-in method and try again.`, Ci = () => `Your publishing smart account is not deployed on ${E()} yet. Complete wallet setup, enable autoDeployManagedAccount in config if appropriate, then try again.`, wi = () => `The managed account could not be confirmed on ${E()} after deployment. Wait a moment and retry, or check your network connection.`, Ti = () => `Automatic deployment of the managed publishing account failed on ${E()}. Retry or deploy the account through your wallet provider.`;
1647
+ async function Ei() {
1648
+ let { useModularExecutor: e } = T();
1509
1649
  if (!e) return { kind: "skip" };
1510
1650
  let t;
1511
1651
  try {
1512
- t = await Kr(b());
1652
+ t = await Qr(O());
1513
1653
  } catch (e) {
1514
1654
  return {
1515
1655
  kind: "unavailable",
1516
1656
  cause: e
1517
1657
  };
1518
1658
  }
1519
- return await zr(t) ? {
1659
+ return await Gr(t) ? {
1520
1660
  kind: "ready",
1521
1661
  managedAddress: t
1522
1662
  } : {
@@ -1524,87 +1664,87 @@ async function li() {
1524
1664
  managedAddress: t
1525
1665
  };
1526
1666
  }
1527
- async function ui() {
1528
- Nr();
1529
- let e = Qr();
1667
+ async function Di() {
1668
+ zr();
1669
+ let e = ii();
1530
1670
  await e.autoConnect({
1531
1671
  client: k(),
1532
- chain: b()
1672
+ chain: O()
1533
1673
  });
1534
1674
  let t = e.getAccount();
1535
- if (!t) throw new O(ai(), "MANAGED_ACCOUNT_UNAVAILABLE");
1675
+ if (!t) throw new w(Si(), "MANAGED_ACCOUNT_UNAVAILABLE");
1536
1676
  return t;
1537
1677
  }
1538
- var di = 9e4;
1539
- async function fi(e) {
1678
+ var Oi = 9e4;
1679
+ async function ki(e) {
1540
1680
  let t;
1541
1681
  try {
1542
- await Promise.race([Ur(e), new Promise((e, n) => {
1543
- t = setTimeout(() => n(/* @__PURE__ */ Error(`Managed account deploy timed out after ${di / 1e3}s`)), di);
1682
+ await Promise.race([Yr(e), new Promise((e, n) => {
1683
+ t = setTimeout(() => n(/* @__PURE__ */ Error(`Managed account deploy timed out after ${Oi / 1e3}s`)), Oi);
1544
1684
  })]);
1545
1685
  } finally {
1546
1686
  t != null && clearTimeout(t);
1547
1687
  }
1548
1688
  }
1549
- async function pi(e) {
1550
- let t = E(), n = await ui(), { fromThirdwebAccount: r } = await import("./chainConfig-BYm5OXpk.js").then((e) => e.g), i = {
1689
+ async function Ai(e) {
1690
+ let t = T(), n = await Di(), { fromThirdwebAccount: r } = await import("./chainConfig-DWzoOtkS.js").then((e) => e.g), i = {
1551
1691
  managedAddress: e,
1552
1692
  managedSigningAccount: r(n)
1553
1693
  };
1554
1694
  try {
1555
1695
  if (t.deployManagedAccount) await t.deployManagedAccount(i);
1556
1696
  else {
1557
- let e = await Jr();
1697
+ let e = await ei();
1558
1698
  if (e) {
1559
- let t = ei();
1699
+ let t = oi();
1560
1700
  await t.autoConnect({
1561
1701
  client: k(),
1562
- chain: b()
1563
- }), await Wr({
1702
+ chain: O()
1703
+ }), await Xr({
1564
1704
  adminAddress: t.getAdminAccount?.()?.address ?? e.address,
1565
1705
  signingAccount: e
1566
1706
  });
1567
- } else await fi(n);
1707
+ } else await ki(n);
1568
1708
  }
1569
1709
  } catch (t) {
1570
- if (await Br(e, /UserOp|user operation/i.test(we(t)) ? 15 : 5)) return;
1571
- throw new O(ci(), "MANAGED_ACCOUNT_NOT_DEPLOYED", e, t);
1710
+ if (await Kr(e, /UserOp|user operation/i.test(Oe(t)) ? 15 : 5)) return;
1711
+ throw new w(Ti(), "MANAGED_ACCOUNT_NOT_DEPLOYED", e, t);
1572
1712
  }
1573
- if (!await Br(e)) throw new O(si(), "MANAGED_ACCOUNT_NOT_DEPLOYED", e);
1713
+ if (!await Kr(e)) throw new w(wi(), "MANAGED_ACCOUNT_NOT_DEPLOYED", e);
1574
1714
  }
1575
- async function mi() {
1576
- let e = E();
1715
+ async function ji() {
1716
+ let e = T();
1577
1717
  if (!e.useModularExecutor) throw Error("runModularExecutorPublishPrep: useModularExecutor is false");
1578
- let t = await li();
1718
+ let t = await Ei();
1579
1719
  if (t.kind === "unavailable") return {
1580
1720
  ok: !1,
1581
- error: new O(ai(), "MANAGED_ACCOUNT_UNAVAILABLE", void 0, t.cause)
1721
+ error: new w(Si(), "MANAGED_ACCOUNT_UNAVAILABLE", void 0, t.cause)
1582
1722
  };
1583
1723
  if (t.kind === "not_deployed") {
1584
1724
  if (e.autoDeployManagedAccount) {
1585
1725
  try {
1586
- await pi(t.managedAddress);
1726
+ await Ai(t.managedAddress);
1587
1727
  } catch (e) {
1588
1728
  return {
1589
1729
  ok: !1,
1590
- error: Se(e) ? e : new O(ci(), "MANAGED_ACCOUNT_NOT_DEPLOYED", t.managedAddress, e)
1730
+ error: ne(e) ? e : new w(Ti(), "MANAGED_ACCOUNT_NOT_DEPLOYED", t.managedAddress, e)
1591
1731
  };
1592
1732
  }
1593
- if (t = await li(), t.kind !== "ready") return {
1733
+ if (t = await Ei(), t.kind !== "ready") return {
1594
1734
  ok: !1,
1595
- error: new O(si(), "MANAGED_ACCOUNT_NOT_DEPLOYED", t.kind === "not_deployed" ? t.managedAddress : void 0)
1735
+ error: new w(wi(), "MANAGED_ACCOUNT_NOT_DEPLOYED", t.kind === "not_deployed" ? t.managedAddress : void 0)
1596
1736
  };
1597
1737
  } else return {
1598
1738
  ok: !1,
1599
- error: new O(oi(), "MANAGED_ACCOUNT_NOT_DEPLOYED", t.managedAddress)
1739
+ error: new w(Ci(), "MANAGED_ACCOUNT_NOT_DEPLOYED", t.managedAddress)
1600
1740
  };
1601
1741
  }
1602
1742
  if (t.kind === "ready") {
1603
1743
  if (e.modularAccountModuleContract) try {
1604
- let n = await ui();
1605
- await ri(t.managedAddress, n, e);
1744
+ let n = await Di();
1745
+ await vi(t.managedAddress, n, e);
1606
1746
  } catch (e) {
1607
- console.warn(`[@seedprotocol/publish] Executor module setup failed on ${D()}; publishing continues, but publish automation needs it.`, e);
1747
+ console.warn(`[@seedprotocol/publish] Executor module setup failed on ${E()}; publishing continues, but publish automation needs it.`, e);
1608
1748
  }
1609
1749
  return {
1610
1750
  ok: !0,
@@ -1614,90 +1754,36 @@ async function mi() {
1614
1754
  throw Error("runModularExecutorPublishPrep: unexpected readiness state");
1615
1755
  }
1616
1756
  //#endregion
1617
- //#region src/helpers/executorModuleReadiness.ts
1618
- var hi = "This ManagedAccount predates the Seed executor router extension, so the Seed executor cannot act for it and publish automation is not available for this account.", gi = "The Seed executor is not installed for this ManagedAccount, so automation session keys cannot publish through it. The account admin installs it (installSeedExecutor), which enrollPublishAutomation does.", _i = "The Seed executor module is configured with a different EAS contract for this ManagedAccount than publish config. Automation session keys cannot change it.", vi = "Could not read the Seed executor module state for this ManagedAccount.";
1619
- function yi() {
1620
- let e = E().modularAccountModuleContract?.trim();
1621
- if (!e || !/^0x[0-9a-fA-F]{40}$/.test(e)) throw Error("@seedprotocol/publish: publish automation requires PublishConfig.modularAccountModuleContract (executor module).");
1622
- return e;
1623
- }
1624
- async function bi(e) {
1625
- return await pe(e) === null;
1626
- }
1627
- async function xi(e) {
1628
- let t = yi(), n = e, r, i;
1629
- try {
1630
- r = await _(t, n), i = r ? await v(t, n) : at;
1631
- } catch (t) {
1632
- throw new O(vi, "AUTOMATION_UNSUPPORTED_ACCOUNT", e, t);
1633
- }
1634
- if (!r) {
1635
- let t = await bi(n) ? hi : gi;
1636
- throw new O(t, "AUTOMATION_UNSUPPORTED_ACCOUNT", e);
1637
- }
1638
- let a = E().easContractAddress?.toLowerCase();
1639
- if (a && i.toLowerCase() !== a) throw new O(_i, "AUTOMATION_UNSUPPORTED_ACCOUNT", e);
1640
- }
1641
- function Si(e) {
1642
- let t = e instanceof Qe ? `${e.shortMessage} ${e.details} ${e.message}` : String(e);
1643
- return /insufficient funds|insufficient balance/i.test(t);
1644
- }
1645
- async function Ci(e) {
1646
- let { managedAddress: t, tx: n, action: r, code: i = "AUTOMATION_PREFLIGHT_FAILED", requireSimulation: a = !0 } = e, o = (e) => S().call({
1647
- account: t,
1648
- to: n.to,
1649
- data: n.data,
1650
- value: n.value,
1651
- ...e ? { stateOverride: [{
1652
- address: t,
1653
- balance: nt("1000")
1654
- }] } : {}
1655
- });
1656
- try {
1657
- try {
1658
- await o(!1);
1659
- } catch (e) {
1660
- if (!Si(e)) throw e;
1661
- await o(!0);
1662
- }
1663
- } catch (e) {
1664
- let n = Yt(e);
1665
- if (!n && !a) return;
1666
- let o = n ? Zt(Jt(e)) : "could not be simulated";
1667
- throw new O(`Simulated ${r} from ${t} ${o}; nothing was sent.`, i, t, e);
1668
- }
1669
- }
1670
- //#endregion
1671
1757
  //#region src/helpers/resolvePublishWallet.ts
1672
- function wi(e) {
1673
- if (m(e.wallet)) return e.wallet;
1674
- if (m(e.account)) return e.account;
1675
- let t = oe();
1758
+ function Mi(e) {
1759
+ if (i(e.wallet)) return e.wallet;
1760
+ if (i(e.account)) return e.account;
1761
+ let t = he();
1676
1762
  if (t) return t;
1677
1763
  throw Error("@seedprotocol/publish: no PublishWallet available. Pass fromEthersWallet / fromEip1193Provider / fromThirdwebAccount, or call setPublishWallet / useSeedWallet.");
1678
1764
  }
1679
1765
  //#endregion
1680
1766
  //#region src/services/publish/actors/persistSeedUid.ts
1681
- var Ti = R("seedProtocol:services:publish:actors:persistSeedUid"), Ei = "0x" + "0".repeat(64), Di = 15e3;
1682
- function Oi(e, t) {
1683
- let n = e.seedLocalId, r = n ? t.find((e) => e?.localId === n) : void 0, i = r?.seedUid && r.seedUid !== Ei ? r.seedUid : t[0]?.seedUid;
1684
- i && i !== Ei && (e.seedUid = i);
1767
+ var Ni = R("seedProtocol:services:publish:actors:persistSeedUid"), Pi = "0x" + "0".repeat(64), Fi = 15e3;
1768
+ function Ii(e, t) {
1769
+ let n = e.seedLocalId, r = n ? t.find((e) => e?.localId === n) : void 0, i = r?.seedUid && r.seedUid !== Pi ? r.seedUid : t[0]?.seedUid;
1770
+ i && i !== Pi && (e.seedUid = i);
1685
1771
  }
1686
- async function ki(e, t, n) {
1772
+ async function Li(e, t, n) {
1687
1773
  let r = e.persistSeedUid;
1688
1774
  if (typeof r != "function") return;
1689
- let i = new Promise((e, t) => setTimeout(() => t(/* @__PURE__ */ Error("persistSeedUid timed out")), Di));
1775
+ let i = new Promise((e, t) => setTimeout(() => t(/* @__PURE__ */ Error("persistSeedUid timed out")), Fi));
1690
1776
  try {
1691
1777
  await Promise.race([r.call(e, t, n), i]);
1692
1778
  } catch (e) {
1693
- Ti("persistSeedUid failed (attestations already on-chain):", e);
1779
+ Ni("persistSeedUid failed (attestations already on-chain):", e);
1694
1780
  }
1695
1781
  }
1696
1782
  //#endregion
1697
1783
  //#region src/services/publish/helpers/verifyArweaveTransactionsExist.ts
1698
- async function Ai(e) {
1784
+ async function Ri(e) {
1699
1785
  if (e.length === 0) return;
1700
- let { arweaveUploadVerificationBaseUrl: t } = E(), n = await Promise.all(e.map((e) => Le(t, e)));
1786
+ let { arweaveUploadVerificationBaseUrl: t } = T(), n = await Promise.all(e.map((e) => Ve(t, e)));
1701
1787
  for (let t = 0; t < e.length; t++) {
1702
1788
  let r = e[t], i = n[t];
1703
1789
  if (i) {
@@ -1714,36 +1800,36 @@ async function Ai(e) {
1714
1800
  function K(e) {
1715
1801
  return e == null || e === "" ? W : ("0x" + (e.startsWith("0x") ? e.slice(2) : e).replace(/[^0-9a-fA-F]/g, "0").padStart(64, "0").slice(-64)).toLowerCase();
1716
1802
  }
1717
- function ji(e, t, n) {
1803
+ function zi(e, t, n) {
1718
1804
  if (!t || !e.logs?.length) return;
1719
- let r = K(t);
1720
- if (r === W) return;
1721
- let i = n ? se : w;
1805
+ let i = K(t);
1806
+ if (i === W) return;
1807
+ let a = n ? De : r;
1722
1808
  try {
1723
- let t = rt({
1724
- abi: i,
1809
+ let t = P({
1810
+ abi: a,
1725
1811
  eventName: "CreatedAttestation",
1726
1812
  logs: e.logs,
1727
1813
  strict: !1
1728
1814
  });
1729
1815
  for (let e of t) {
1730
1816
  let t = e.args?.result;
1731
- if (t?.attestationUid && K(t.schemaUid) === r) {
1817
+ if (t?.attestationUid && K(t.schemaUid) === i) {
1732
1818
  let e = t.attestationUid;
1733
1819
  return e && K(e) !== W ? e : void 0;
1734
1820
  }
1735
1821
  }
1736
1822
  } catch {}
1737
1823
  }
1738
- function Mi(e, t, n, r) {
1739
- let i = t.toLowerCase(), a = e.logs?.filter((e) => e.address && e.address.toLowerCase() === i);
1740
- if (!a?.length) return {};
1824
+ function Bi(e, t, n, i) {
1825
+ let a = t.toLowerCase(), o = e.logs?.filter((e) => e.address && e.address.toLowerCase() === a);
1826
+ if (!o?.length) return {};
1741
1827
  try {
1742
- if (r) {
1743
- let e = rt({
1744
- abi: se,
1828
+ if (i) {
1829
+ let e = P({
1830
+ abi: De,
1745
1831
  eventName: "SeedPublished",
1746
- logs: a,
1832
+ logs: o,
1747
1833
  strict: !1
1748
1834
  })[0];
1749
1835
  if (!e) return {};
@@ -1753,55 +1839,55 @@ function Mi(e, t, n, r) {
1753
1839
  versionUid: t?.versionUid && K(t.versionUid) !== W ? t.versionUid : void 0
1754
1840
  };
1755
1841
  }
1756
- let e = rt({
1757
- abi: w,
1842
+ let e = P({
1843
+ abi: r,
1758
1844
  eventName: "SeedPublished",
1759
- logs: a,
1845
+ logs: o,
1760
1846
  strict: !1
1761
1847
  })[0];
1762
1848
  if (!e) return {};
1763
1849
  let t = e.args?.returnedDataFromEAS;
1764
1850
  if (!t || t === "0x") return {};
1765
- let i = $e([{ type: "bytes32[]" }], t)[0];
1766
- if (!i?.length) return {};
1767
- let o = n, s = i[o], c = i[o + 1];
1851
+ let a = it([{ type: "bytes32[]" }], t)[0];
1852
+ if (!a?.length) return {};
1853
+ let s = n, c = a[s], l = a[s + 1];
1768
1854
  return {
1769
- seedUid: s && s !== W ? s : i.length === 1 && i[0] && i[0] !== W ? i[0] : void 0,
1770
- versionUid: c && c !== W ? c : void 0
1855
+ seedUid: c && c !== W ? c : a.length === 1 && a[0] && a[0] !== W ? a[0] : void 0,
1856
+ versionUid: l && l !== W ? l : void 0
1771
1857
  };
1772
1858
  } catch {
1773
1859
  return {};
1774
1860
  }
1775
1861
  }
1776
- function Ni(e, t, n, r) {
1777
- return Mi(e, t, n, r).seedUid;
1862
+ function Vi(e, t, n, r) {
1863
+ return Bi(e, t, n, r).seedUid;
1778
1864
  }
1779
- function Pi(e, t, n) {
1865
+ function Hi(e, t, n) {
1780
1866
  if (!t || !e.logs?.length) return;
1781
- let r = K(t);
1782
- if (r === W) return;
1783
- let i = n ? se : w;
1867
+ let i = K(t);
1868
+ if (i === W) return;
1869
+ let a = n ? De : r;
1784
1870
  try {
1785
- let t = rt({
1786
- abi: i,
1871
+ let t = P({
1872
+ abi: a,
1787
1873
  eventName: "CreatedAttestation",
1788
1874
  logs: e.logs,
1789
1875
  strict: !1
1790
1876
  });
1791
1877
  for (let e of t) {
1792
1878
  let t = e.args?.result;
1793
- if (t?.attestationUid && K(t.schemaUid) === r) {
1879
+ if (t?.attestationUid && K(t.schemaUid) === i) {
1794
1880
  let e = t.attestationUid;
1795
1881
  return e && K(e) !== W ? e : void 0;
1796
1882
  }
1797
1883
  }
1798
1884
  } catch {}
1799
1885
  }
1800
- function Fi(e, t) {
1886
+ function Ui(e, t) {
1801
1887
  if (!e.logs?.length) return [];
1802
- let n = t ? se : w;
1888
+ let n = t ? De : r;
1803
1889
  try {
1804
- let t = rt({
1890
+ let t = P({
1805
1891
  abi: n,
1806
1892
  eventName: "CreatedAttestation",
1807
1893
  logs: e.logs,
@@ -1823,26 +1909,26 @@ function Fi(e, t) {
1823
1909
  return [];
1824
1910
  }
1825
1911
  }
1826
- function Ii(e, t) {
1827
- let n = t.toLowerCase(), r = e.logs?.filter((e) => e.address && e.address.toLowerCase() === n);
1828
- if (!r?.length) return [];
1912
+ function Wi(e, t) {
1913
+ let n = t.toLowerCase(), i = e.logs?.filter((e) => e.address && e.address.toLowerCase() === n);
1914
+ if (!i?.length) return [];
1829
1915
  try {
1830
- let e = rt({
1831
- abi: w,
1916
+ let e = P({
1917
+ abi: r,
1832
1918
  eventName: "SeedPublished",
1833
- logs: r,
1919
+ logs: i,
1834
1920
  strict: !1
1835
1921
  })[0];
1836
1922
  if (!e) return [];
1837
1923
  let t = e.args?.returnedDataFromEAS;
1838
- return !t || t === "0x" ? [] : $e([{ type: "bytes32[]" }], t)[0] ?? [];
1924
+ return !t || t === "0x" ? [] : it([{ type: "bytes32[]" }], t)[0] ?? [];
1839
1925
  } catch {
1840
1926
  return [];
1841
1927
  }
1842
1928
  }
1843
- function Li(e, t, n) {
1929
+ function Gi(e, t, n) {
1844
1930
  if (!n.length) return [];
1845
- let r = Ii(e, t), i = n.length;
1931
+ let r = Wi(e, t), i = n.length;
1846
1932
  if (r.length < i) return [];
1847
1933
  let a = [];
1848
1934
  for (let e = 0; e < i; e++) {
@@ -1854,32 +1940,32 @@ function Li(e, t, n) {
1854
1940
  }
1855
1941
  return a;
1856
1942
  }
1857
- function Ri(e) {
1858
- let t = Fi(e.receipt, e.useModularExecutor);
1943
+ function Ki(e) {
1944
+ let t = Ui(e.receipt, e.useModularExecutor);
1859
1945
  if (t.length) return t;
1860
- let n = i(e.receipt, e.easContractAddress);
1946
+ let n = p(e.receipt, e.easContractAddress);
1861
1947
  return n.length ? n.map((e) => ({
1862
1948
  schemaUid: e.schemaUid,
1863
1949
  attestationUid: e.uid
1864
- })) : e.useModularExecutor ? [] : Li(e.receipt, e.contractAddressForEvents, e.listOfAttestations ?? []);
1950
+ })) : e.useModularExecutor ? [] : Gi(e.receipt, e.contractAddressForEvents, e.listOfAttestations ?? []);
1865
1951
  }
1866
1952
  //#endregion
1867
1953
  //#region src/services/publish/helpers/receiptAttestationMs.ts
1868
1954
  async function q(e) {
1869
1955
  let t = e?.blockNumber;
1870
- return t == null ? Date.now() : await ae(t) ?? Date.now();
1956
+ return t == null ? Date.now() : await ye(t) ?? Date.now();
1871
1957
  }
1872
1958
  //#endregion
1873
1959
  //#region src/services/publish/actors/publishRequestNormalize.ts
1874
- var zi = 64, J = (e) => {
1875
- if (e == null) return "0x" + "0".repeat(zi);
1876
- if (typeof e == "string") return "0x" + (e.startsWith("0x") ? e.slice(2) : e).replace(/[^0-9a-fA-F]/g, "0").padStart(zi, "0").slice(-64);
1960
+ var qi = 64, J = (e) => {
1961
+ if (e == null) return "0x" + "0".repeat(qi);
1962
+ if (typeof e == "string") return "0x" + (e.startsWith("0x") ? e.slice(2) : e).replace(/[^0-9a-fA-F]/g, "0").padStart(qi, "0").slice(-64);
1877
1963
  if (e instanceof Uint8Array || typeof ArrayBuffer < "u" && e instanceof ArrayBuffer) {
1878
1964
  let t = e instanceof Uint8Array ? e : new Uint8Array(e);
1879
- return "0x" + Array.from(t).map((e) => e.toString(16).padStart(2, "0")).join("").padStart(zi, "0").slice(-64);
1965
+ return "0x" + Array.from(t).map((e) => e.toString(16).padStart(2, "0")).join("").padStart(qi, "0").slice(-64);
1880
1966
  }
1881
- return "0x" + "0".repeat(zi);
1882
- }, Bi = (e) => {
1967
+ return "0x" + "0".repeat(qi);
1968
+ }, Ji = (e) => {
1883
1969
  if (e == null || typeof e == "string" && (e === "" || e === "0x")) return "0x";
1884
1970
  if (typeof e == "string") {
1885
1971
  let t = (e.startsWith("0x") ? e.slice(2) : e).replace(/[^0-9a-fA-F]/g, "0");
@@ -1891,25 +1977,25 @@ var zi = 64, J = (e) => {
1891
1977
  }
1892
1978
  return "0x";
1893
1979
  };
1894
- function Vi(e) {
1980
+ function Yi(e) {
1895
1981
  let t = new Set(e.map((e) => e?.localId).filter((e) => !!e));
1896
1982
  return e.some((e) => (e?.listOfAttestations ?? []).some((e) => {
1897
1983
  let n = e;
1898
1984
  return n._unresolvedValue && t.has(n._unresolvedValue) ? !0 : Array.isArray(n._rawListIdsForResolve) ? n._rawListIdsForResolve.some((e) => e && t.has(String(e).trim())) : !1;
1899
1985
  }));
1900
1986
  }
1901
- function Hi(e, t) {
1987
+ function Xi(e, t) {
1902
1988
  return (e ?? []).filter((e) => e.publishLocalId && t.has(e.publishLocalId));
1903
1989
  }
1904
- var Ui = {
1905
- recipient: Mt,
1990
+ var Zi = {
1991
+ recipient: Ft,
1906
1992
  expirationTime: BigInt(0),
1907
1993
  revocable: !0,
1908
1994
  refUID: W,
1909
1995
  data: W,
1910
1996
  value: BigInt(0)
1911
1997
  };
1912
- function Wi(e) {
1998
+ function Qi(e) {
1913
1999
  let t = (e?.listOfAttestations ?? []).map((e) => {
1914
2000
  let t = Array.isArray(e?.data) ? e.data : [];
1915
2001
  return {
@@ -1917,7 +2003,7 @@ function Wi(e) {
1917
2003
  data: t.map((e) => ({
1918
2004
  ...e,
1919
2005
  refUID: J(e?.refUID),
1920
- data: Bi(e?.data),
2006
+ data: Ji(e?.data),
1921
2007
  expirationTime: e?.expirationTime == null ? BigInt(0) : BigInt(e.expirationTime),
1922
2008
  value: e?.value == null ? BigInt(0) : BigInt(e.value)
1923
2009
  })),
@@ -1938,7 +2024,7 @@ function Wi(e) {
1938
2024
  propertiesToUpdate: n
1939
2025
  };
1940
2026
  }
1941
- function Gi(e, t) {
2027
+ function $i(e, t) {
1942
2028
  for (let n of e) for (let e of n?.propertiesToUpdate ?? []) {
1943
2029
  let n = e?.publishLocalId, r = J(e?.propertySchemaUid);
1944
2030
  if (!n || !r) continue;
@@ -1946,16 +2032,16 @@ function Gi(e, t) {
1946
2032
  if (!i?.listOfAttestations) continue;
1947
2033
  let a = i.listOfAttestations.find((e) => J(e?.schema)?.toLowerCase() === r?.toLowerCase());
1948
2034
  a && (!Array.isArray(a.data) || a.data.length === 0) && (a.data = [{
1949
- ...Ui,
2035
+ ...Zi,
1950
2036
  refUID: W
1951
2037
  }]);
1952
2038
  }
1953
2039
  }
1954
2040
  //#endregion
1955
2041
  //#region src/services/arweaveL1Finalize/enqueue.ts
1956
- var Ki = "pending_l1";
1957
- async function qi(e) {
1958
- let { useArweaveBundler: t } = E();
2042
+ var ea = "pending_l1";
2043
+ async function ta(e) {
2044
+ let { useArweaveBundler: t } = T();
1959
2045
  if (!t) return;
1960
2046
  let n = e.arweaveTransactions ?? [], r = e.publishUploads ?? [];
1961
2047
  if (n.length === 0 || n.length !== r.length) return;
@@ -1967,12 +2053,12 @@ async function qi(e) {
1967
2053
  if (!o) continue;
1968
2054
  let s = t.transaction?.id;
1969
2055
  if (s && typeof s == "string") try {
1970
- await i.insert(Ae).values({
2056
+ await i.insert(Pe).values({
1971
2057
  seedLocalId: o.seedLocalId,
1972
2058
  dataItemId: s,
1973
2059
  versionLocalId: o.versionLocalId ?? null,
1974
2060
  itemPropertyName: o.itemPropertyName ?? null,
1975
- phase: Ki,
2061
+ phase: ea,
1976
2062
  createdAt: a,
1977
2063
  updatedAt: a
1978
2064
  }).onConflictDoNothing();
@@ -1981,54 +2067,54 @@ async function qi(e) {
1981
2067
  }
1982
2068
  //#endregion
1983
2069
  //#region src/helpers/ensureManagedAccountEasConfigured.ts
1984
- var Ji = () => `Could not verify or set the EAS contract address on your publishing account on ${D()}.`, Yi = "ManagedAccount EAS pointer does not match publish config. Configure EAS with the user’s ManagedAccount wallet before automation publish (session keys cannot call setEas).", Xi = (e) => `Your publishing account's Seed extension uses EAS ${e}, but publish config sets easContractAddress to a different contract. The extension's EAS is fixed at deployment; fix easContractAddress.`;
1985
- function Zi(e) {
2070
+ var na = () => `Could not verify or set the EAS contract address on your publishing account on ${E()}.`, ra = "ManagedAccount EAS pointer does not match publish config. Configure EAS with the user’s ManagedAccount wallet before automation publish (session keys cannot call setEas).", ia = (e) => `Your publishing account's Seed extension uses EAS ${e}, but publish config sets easContractAddress to a different contract. The extension's EAS is fixed at deployment; fix easContractAddress.`;
2071
+ function aa(e) {
1986
2072
  return e.toLowerCase();
1987
2073
  }
1988
- function Qi(e) {
1989
- let { easContractAddress: t } = E(), n = Zi(t);
1990
- if (!n || n === Zi(at)) throw new O("Publish config is missing a valid easContractAddress.", "MANAGED_ACCOUNT_SET_EAS_FAILED", e);
2074
+ function oa(e) {
2075
+ let { easContractAddress: t } = T(), n = aa(t);
2076
+ if (!n || n === aa(lt)) throw new w("Publish config is missing a valid easContractAddress.", "MANAGED_ACCOUNT_SET_EAS_FAILED", e);
1991
2077
  return n;
1992
2078
  }
1993
- async function $i(e) {
2079
+ async function sa(e) {
1994
2080
  try {
1995
- let t = await f(e);
1996
- return Zi(typeof t == "string" ? t : String(t));
2081
+ let t = await le(e);
2082
+ return aa(typeof t == "string" ? t : String(t));
1997
2083
  } catch (t) {
1998
- throw new O(Ji(), "MANAGED_ACCOUNT_SET_EAS_FAILED", e, t);
2084
+ throw new w(na(), "MANAGED_ACCOUNT_SET_EAS_FAILED", e, t);
1999
2085
  }
2000
2086
  }
2001
- async function ea(e) {
2002
- let t = Qi(e);
2003
- if (await $i(e) !== t) throw new O(Yi, "MANAGED_ACCOUNT_SET_EAS_FAILED", e);
2087
+ async function ca(e) {
2088
+ let t = oa(e);
2089
+ if (await sa(e) !== t) throw new w(ra, "MANAGED_ACCOUNT_SET_EAS_FAILED", e);
2004
2090
  }
2005
- async function ta(e, t) {
2006
- let r = Qi(e), i = await $i(e);
2007
- if (i !== r) {
2008
- if (i !== Zi(at)) throw new O(Xi(i), "MANAGED_ACCOUNT_SET_EAS_FAILED", e);
2091
+ async function la(e, t) {
2092
+ let n = oa(e), r = await sa(e);
2093
+ if (r !== n) {
2094
+ if (r !== aa(lt)) throw new w(ia(r), "MANAGED_ACCOUNT_SET_EAS_FAILED", e);
2009
2095
  try {
2010
- let r = typeof t == "function" ? await t() : t, i = m(r) ? r.txSender : n(r) ? r : (() => {
2096
+ let n = typeof t == "function" ? await t() : t, r = i(n) ? n.txSender : _e(n) ? n : (() => {
2011
2097
  throw Error("@seedprotocol/publish: ensureManagedAccountEasConfigured requires PublishWallet or SeedTxSender");
2012
- })(), { easContractAddress: a } = E(), o = s(e, a), c = await i.sendTransaction(o);
2013
- await C(c.transactionHash);
2098
+ })(), { easContractAddress: a } = T(), o = ee(e, a), s = await r.sendTransaction(o);
2099
+ await C(s.transactionHash);
2014
2100
  } catch (t) {
2015
- throw new O(Ji(), "MANAGED_ACCOUNT_SET_EAS_FAILED", e, t);
2101
+ throw new w(na(), "MANAGED_ACCOUNT_SET_EAS_FAILED", e, t);
2016
2102
  }
2017
2103
  }
2018
2104
  }
2019
2105
  //#endregion
2020
2106
  //#region src/services/publish/actors/createAttestations.ts
2021
- var na = R("seedProtocol:services:publish:actors");
2022
- function ra(e) {
2107
+ var ua = R("seedProtocol:services:publish:actors");
2108
+ function da(e) {
2023
2109
  return !!e && /^0x[0-9a-fA-F]{40}$/.test(e.trim());
2024
2110
  }
2025
- function ia(e) {
2111
+ function fa(e) {
2026
2112
  let { useModularExecutor: t, publisherAddress: n, modularAccountModuleContract: r, managedAddress: i, routeToExecutorModule: a } = e;
2027
2113
  if (t) {
2028
2114
  if (!i) throw Error("resolvePublishRouting: managedAddress is required when useModularExecutor is true");
2029
2115
  let e = r?.trim();
2030
2116
  if (a) {
2031
- if (!ra(e)) throw Error("resolvePublishRouting: modularAccountModuleContract is required when routeToExecutorModule is true");
2117
+ if (!da(e)) throw Error("resolvePublishRouting: modularAccountModuleContract is required when routeToExecutorModule is true");
2032
2118
  return {
2033
2119
  txTargetAddress: e,
2034
2120
  contractAddressForEvents: e
@@ -2044,27 +2130,27 @@ function ia(e) {
2044
2130
  contractAddressForEvents: n
2045
2131
  };
2046
2132
  }
2047
- async function aa(e) {
2133
+ async function pa(e) {
2048
2134
  let { receipt: t, seedLocalId: n, versionSchemaUid: r, contractAddressForEvents: i, listOfAttestationsCount: a, useModularExecutor: o, publisherAddress: s } = e;
2049
2135
  if (!n) return;
2050
- let c = Pi(t, r, o) ?? Mi(t, i, a, o).versionUid, l = c ? J(c) : void 0;
2136
+ let c = Hi(t, r, o) ?? Bi(t, i, a, o).versionUid, l = c ? J(c) : void 0;
2051
2137
  if (!l || l === W) return;
2052
2138
  let u = await q(t);
2053
- await Xe({
2139
+ await tt({
2054
2140
  seedLocalId: n,
2055
2141
  versionUid: l,
2056
2142
  publisher: s,
2057
2143
  attestationCreatedAt: u
2058
2144
  });
2059
2145
  }
2060
- function oa(e, t) {
2146
+ function ma(e, t) {
2061
2147
  return !e || !t ? !1 : J(e).toLowerCase() === J(t).toLowerCase();
2062
2148
  }
2063
- function sa(e, t, n) {
2064
- return !n || t >= e.length ? t : oa(e[t]?.schemaUid, n) ? t + 1 : t;
2149
+ function ha(e, t, n) {
2150
+ return !n || t >= e.length ? t : ma(e[t]?.schemaUid, n) ? t + 1 : t;
2065
2151
  }
2066
- async function ca(e) {
2067
- let { receipt: t, normalizedRequests: n, useModularExecutor: r, contractAddressForEvents: i } = e, { easContractAddress: a } = E(), o = Ri({
2152
+ async function ga(e) {
2153
+ let { receipt: t, normalizedRequests: n, useModularExecutor: r, contractAddressForEvents: i } = e, { easContractAddress: a } = T(), o = Ki({
2068
2154
  receipt: t,
2069
2155
  useModularExecutor: r,
2070
2156
  easContractAddress: a,
@@ -2072,17 +2158,17 @@ async function ca(e) {
2072
2158
  listOfAttestations: n.flatMap((e) => e.listOfAttestations ?? [])
2073
2159
  });
2074
2160
  if (!o.length) {
2075
- na("persistPropertyMetadataUidsFromContractReceipt: no property attestation pairs");
2161
+ ua("persistPropertyMetadataUidsFromContractReceipt: no property attestation pairs");
2076
2162
  return;
2077
2163
  }
2078
2164
  let s = await q(t), c = 0;
2079
2165
  for (let e of n) {
2080
2166
  let n = e.listOfAttestations ?? [];
2081
- if ((!e.seedUid || J(e.seedUid) === W) && (c = sa(o, c, e.seedSchemaUid)), c = sa(o, c, e.versionSchemaUid), !n.length) continue;
2167
+ if ((!e.seedUid || J(e.seedUid) === W) && (c = ha(o, c, e.seedSchemaUid)), c = ha(o, c, e.versionSchemaUid), !n.length) continue;
2082
2168
  let a = n.length, l = o.slice(c, c + a);
2083
2169
  if (c += a, !l.length) continue;
2084
2170
  let u = Math.min(l.length, a), d = e.versionUid && J(e.versionUid) !== W ? J(e.versionUid) : void 0;
2085
- d ||= Pi(t, e.versionSchemaUid, r) ?? Mi(t, i, a, r).versionUid, await ke({
2171
+ d ||= Hi(t, e.versionSchemaUid, r) ?? Bi(t, i, a, r).versionUid, await Ne({
2086
2172
  seedLocalId: e.localId,
2087
2173
  attestationCreatedAtMs: s ?? null,
2088
2174
  versionUid: d && J(d) !== W ? J(d) : null,
@@ -2094,62 +2180,62 @@ async function ca(e) {
2094
2180
  });
2095
2181
  }
2096
2182
  }
2097
- var la = L(async ({ input: { context: e } }) => {
2098
- let { address: t, account: n, wallet: r } = e, i = e.arweaveTransactions ?? [], o = e.publishUploads ?? [], { item: s } = e, { modularAccountModuleContract: c, useModularExecutor: l } = E();
2183
+ var _a = L(async ({ input: { context: e } }) => {
2184
+ let { address: t, account: n, wallet: r } = e, i = e.arweaveTransactions ?? [], a = e.publishUploads ?? [], { item: o } = e, { modularAccountModuleContract: s, useModularExecutor: l } = T();
2099
2185
  if (!t || typeof t != "string" || !t.trim()) throw Error("No wallet address for publish. Connect a wallet and try again.");
2100
2186
  if (!r && !n) throw Error("Wallet session is missing. Reconnect your wallet and retry the publish.");
2101
- if (!l && !await ue(t)) throw Error("EOA publishing must use the direct EAS path (multiPublish requires a deployed publisher contract). If you see this, attestation routing is misconfigured.");
2102
- if (!s?.seedLocalId) throw Error("Attestation recovery failed: Item data is missing. Delete this publish record and try a full publish from the beginning.");
2103
- if (typeof s.getPublishUploads != "function" && (s = await bn(s.seedLocalId)), i.length !== o.length) throw Error("Attestation recovery failed: Arweave transaction data is missing or incomplete. Delete this publish record and try a full publish from the beginning.");
2104
- let u = ia({
2187
+ if (!l && !await ce(t)) throw Error("EOA publishing must use the direct EAS path (multiPublish requires a deployed publisher contract). If you see this, attestation routing is misconfigured.");
2188
+ if (!o?.seedLocalId) throw Error("Attestation recovery failed: Item data is missing. Delete this publish record and try a full publish from the beginning.");
2189
+ if (typeof o.getPublishUploads != "function" && (o = await Cn(o.seedLocalId)), i.length !== a.length) throw Error("Attestation recovery failed: Arweave transaction data is missing or incomplete. Delete this publish record and try a full publish from the beginning.");
2190
+ let u = fa({
2105
2191
  useModularExecutor: !1,
2106
2192
  publisherAddress: t
2107
- }), d = wi(e), f = !1;
2108
- await vn(s, d, { managedAddress: t });
2193
+ }), d = Mi(e), f = !1;
2194
+ await xn(o, d, { managedAddress: t });
2109
2195
  let p = i.map((e, t) => {
2110
2196
  let n = e.transaction?.id;
2111
2197
  if (!n || typeof n != "string") throw Error("Attestation recovery failed: Arweave transaction data did not survive restore. Delete this publish record and try a full publish from the beginning.");
2112
- let r = o[t];
2198
+ let r = a[t];
2113
2199
  if (!r) throw Error("Publish upload index mismatch");
2114
2200
  return {
2115
2201
  ...r,
2116
2202
  txId: n
2117
2203
  };
2118
2204
  });
2119
- await Ai(p.map((e) => e.txId));
2120
- let m = await s.getPublishPayload(p, { publishMode: e.publishMode ?? "patch" }), g = Array.isArray(m) ? m : [m];
2205
+ await Ri(p.map((e) => e.txId));
2206
+ let m = await o.getPublishPayload(p, { publishMode: e.publishMode ?? "patch" }), h = Array.isArray(m) ? m : [m];
2121
2207
  if (l) {
2122
2208
  let e = d?.signer?.address, n = !1;
2123
2209
  if (t && e) {
2124
- let { isAutomationSessionActive: r } = await import("./ensureAutomationSessionKey-CClLVX2w.js").then((e) => e.n);
2210
+ let { isAutomationSessionActive: r } = await import("./ensureAutomationSessionKey-h3zOmDr5.js").then((e) => e.n);
2125
2211
  n = await r(t, e);
2126
2212
  }
2127
2213
  if (n) {
2128
- let e = c?.trim();
2129
- if (!ra(e)) throw Error("@seedprotocol/publish: automation publish requires PublishConfig.modularAccountModuleContract (executor module). Session keys are module-only and cannot call the ManagedAccount directly.");
2130
- u = ia({
2214
+ let e = s?.trim();
2215
+ if (!da(e)) throw Error("@seedprotocol/publish: automation publish requires PublishConfig.modularAccountModuleContract (executor module). Session keys are module-only and cannot call the ManagedAccount directly.");
2216
+ u = fa({
2131
2217
  useModularExecutor: l,
2132
2218
  publisherAddress: t,
2133
2219
  modularAccountModuleContract: e,
2134
2220
  managedAddress: t,
2135
2221
  routeToExecutorModule: !0
2136
- }), f = !0, await xi(t);
2222
+ }), f = !0, await mi(t);
2137
2223
  } else {
2138
- let e = await mi();
2224
+ let e = await ji();
2139
2225
  if (!e.ok) throw e.error;
2140
- u = ia({
2226
+ u = fa({
2141
2227
  useModularExecutor: l,
2142
2228
  publisherAddress: t,
2143
- modularAccountModuleContract: c,
2229
+ modularAccountModuleContract: s,
2144
2230
  managedAddress: e.managedAddress
2145
2231
  });
2146
- let { ensureModularPublishBootstrap: n } = await import("./ensureModularPublishBootstrap-BW8jKN_A.js").then((e) => e.n), { fromThirdwebAccount: r } = await import("./chainConfig-BYm5OXpk.js").then((e) => e.g);
2232
+ let { ensureModularPublishBootstrap: n } = await import("./ensureModularPublishBootstrap-BImiIFJe.js").then((e) => e.n), { fromThirdwebAccount: r } = await import("./chainConfig-DWzoOtkS.js").then((e) => e.g);
2147
2233
  d = r(await n(e.managedAddress));
2148
2234
  }
2149
- } else await ta(t, d);
2150
- let _ = async (e) => {
2151
- let n = u.txTargetAddress, r = f ? h(n, e, 5000000n) : a(n, e, 5000000n);
2152
- await Ci(f ? {
2235
+ } else await la(t, d);
2236
+ let g = async (e) => {
2237
+ let n = u.txTargetAddress, r = f ? c(n, e, 5000000n) : be(n, e, 5000000n);
2238
+ await gi(f ? {
2153
2239
  managedAddress: t,
2154
2240
  tx: r,
2155
2241
  action: "multiPublish via the executor module"
@@ -2163,24 +2249,24 @@ var la = L(async ({ input: { context: e } }) => {
2163
2249
  try {
2164
2250
  return await d.txSender.sendTransaction(r);
2165
2251
  } catch (e) {
2166
- throw rn(e, d.txSender.address);
2252
+ throw sn(e, d.txSender.address);
2167
2253
  }
2168
- }, v = g.length > 1 && Vi(g), y, b = null, x = [];
2169
- if (v) {
2170
- let e = structuredClone(g), n = {};
2254
+ }, _ = h.length > 1 && Yi(h), v, y = null, b = [];
2255
+ if (_) {
2256
+ let e = structuredClone(h), n = {};
2171
2257
  for (let r = 0; r < e.length; r++) {
2172
- e = await Ke(e, n);
2173
- let i = e[r], a = /* @__PURE__ */ new Set([i.localId]), o = Wi({
2258
+ e = await Xe(e, n);
2259
+ let i = e[r], a = /* @__PURE__ */ new Set([i.localId]), o = Qi({
2174
2260
  ...i,
2175
- propertiesToUpdate: Hi(i.propertiesToUpdate, a)
2261
+ propertiesToUpdate: Xi(i.propertiesToUpdate, a)
2176
2262
  }), s = /* @__PURE__ */ new Map([[o.localId, o]]);
2177
- Gi([o], s);
2178
- let c = await _([o]), d = await C(c.transactionHash);
2263
+ $i([o], s);
2264
+ let c = await g([o]), d = await C(c.transactionHash);
2179
2265
  if (!d) throw Error("Failed to send transaction");
2180
- b = d;
2266
+ y = d;
2181
2267
  let f = o?.listOfAttestations?.length ?? 0;
2182
- for (let e of Fi(d, l)) e.attestationUid && x.push(e.attestationUid);
2183
- await aa({
2268
+ for (let e of Ui(d, l)) e.attestationUid && b.push(e.attestationUid);
2269
+ await pa({
2184
2270
  receipt: d,
2185
2271
  seedLocalId: i.localId,
2186
2272
  versionSchemaUid: o.versionSchemaUid,
@@ -2191,13 +2277,13 @@ var la = L(async ({ input: { context: e } }) => {
2191
2277
  });
2192
2278
  let p = !o.seedUid || J(o.seedUid) === W, m = o?.seedSchemaUid;
2193
2279
  if (p) {
2194
- let t = ji(d, m, l) ?? Ni(d, u.contractAddressForEvents, f, l);
2280
+ let t = zi(d, m, l) ?? Vi(d, u.contractAddressForEvents, f, l);
2195
2281
  t && (n[i.localId] = t, e[r] = {
2196
2282
  ...e[r],
2197
2283
  seedUid: t
2198
- }, x.push(t));
2284
+ }, b.push(t));
2199
2285
  }
2200
- await ca({
2286
+ await ga({
2201
2287
  receipt: d,
2202
2288
  normalizedRequests: [o],
2203
2289
  useModularExecutor: l,
@@ -2208,19 +2294,19 @@ var la = L(async ({ input: { context: e } }) => {
2208
2294
  let e = t?.localId, r = t?.seedUid;
2209
2295
  e && r && J(r) !== W && (n[e] = J(r));
2210
2296
  }
2211
- y = (await Ke(structuredClone(g), n)).map((e) => Wi({
2297
+ v = (await Xe(structuredClone(h), n)).map((e) => Qi({
2212
2298
  ...e,
2213
2299
  seedUid: n[e.localId] ?? e.seedUid
2214
2300
  }));
2215
2301
  } else {
2216
- let e = g.map((e) => Wi(e));
2217
- Gi(e, new Map(e.map((e) => [e?.localId, e])));
2218
- let n = Array.isArray(m) ? e : [e[0]], r = await _(n), i = await C(r.transactionHash);
2302
+ let e = h.map((e) => Qi(e));
2303
+ $i(e, new Map(e.map((e) => [e?.localId, e])));
2304
+ let n = Array.isArray(m) ? e : [e[0]], r = await g(n), i = await C(r.transactionHash);
2219
2305
  if (!i) throw Error("Failed to send transaction");
2220
- b = i;
2221
- for (let e of Fi(i, l)) e.attestationUid && x.push(e.attestationUid);
2222
- let a = e.find((e) => e?.localId === s.seedLocalId) ?? e[0];
2223
- await aa({
2306
+ y = i;
2307
+ for (let e of Ui(i, l)) e.attestationUid && b.push(e.attestationUid);
2308
+ let a = e.find((e) => e?.localId === o.seedLocalId) ?? e[0];
2309
+ await pa({
2224
2310
  receipt: i,
2225
2311
  seedLocalId: a?.localId,
2226
2312
  versionSchemaUid: a?.versionSchemaUid,
@@ -2228,62 +2314,62 @@ var la = L(async ({ input: { context: e } }) => {
2228
2314
  listOfAttestationsCount: a?.listOfAttestations?.length ?? 0,
2229
2315
  useModularExecutor: l,
2230
2316
  publisherAddress: t
2231
- }), await ca({
2317
+ }), await ga({
2232
2318
  receipt: i,
2233
2319
  normalizedRequests: n,
2234
2320
  useModularExecutor: l,
2235
2321
  contractAddressForEvents: u.contractAddressForEvents
2236
2322
  });
2237
- let o = e[0], c = o?.seedUid, d = c === W || !c, f = o?.listOfAttestations?.length ?? 0, p = o?.seedSchemaUid, h = d ? ji(i, p, l) ?? Ni(i, u.contractAddressForEvents, f, l) : void 0;
2238
- h && x.push(h), y = h && e.length > 0 ? [{
2323
+ let s = e[0], c = s?.seedUid, d = c === W || !c, f = s?.listOfAttestations?.length ?? 0, p = s?.seedSchemaUid, _ = d ? zi(i, p, l) ?? Vi(i, u.contractAddressForEvents, f, l) : void 0;
2324
+ _ && b.push(_), v = _ && e.length > 0 ? [{
2239
2325
  ...e[0],
2240
- seedUid: h
2326
+ seedUid: _
2241
2327
  }, ...e.slice(1)] : e;
2242
2328
  }
2243
- Oi(s, y);
2244
- let S = s, ee = y.find((e) => e?.localId === s.seedLocalId)?.seedUid;
2245
- ee && ee !== W && await ki(S, t, b ? await q(b) : void 0), na("requestData", m), qi(e);
2329
+ Ii(o, v);
2330
+ let x = o, ee = v.find((e) => e?.localId === o.seedLocalId)?.seedUid;
2331
+ ee && ee !== W && await Li(x, t, y ? await q(y) : void 0), ua("requestData", m), ta(e);
2246
2332
  try {
2247
2333
  let { clearHtmlEmbeddedImageCoPublishRows: e } = await import("@seedprotocol/sdk");
2248
- await e(s.seedLocalId);
2334
+ await e(o.seedLocalId);
2249
2335
  } catch {}
2250
- let { collectPublishedBatch: w } = await import("./collectBatchUids-CnIe9jUB.js").then((e) => e.t), T = y.find((e) => e?.localId === s.seedLocalId) ?? y[0];
2251
- for (let e of y) e?.seedUid && x.push(String(e.seedUid)), e?.versionUid && x.push(String(e.versionUid));
2336
+ let { collectPublishedBatch: te } = await import("./collectBatchUids-CnIe9jUB.js").then((e) => e.t), S = v.find((e) => e?.localId === o.seedLocalId) ?? v[0];
2337
+ for (let e of v) e?.seedUid && b.push(String(e.seedUid)), e?.versionUid && b.push(String(e.versionUid));
2252
2338
  return {
2253
2339
  easPayload: m,
2254
- publishedBatch: T?.seedUid ? w({
2255
- seedUid: String(T.seedUid),
2256
- versionUid: T.versionUid ? String(T.versionUid) : void 0,
2257
- extraUids: x
2340
+ publishedBatch: S?.seedUid ? te({
2341
+ seedUid: String(S.seedUid),
2342
+ versionUid: S.versionUid ? String(S.versionUid) : void 0,
2343
+ extraUids: b
2258
2344
  }) : null
2259
2345
  };
2260
- }), ua = R("seedProtocol:services:publish:verifyAttestations"), da = "0x" + "0".repeat(64), fa = 64, pa = (e) => e == null ? "0x" + "0".repeat(fa) : typeof e == "string" ? "0x" + (e.startsWith("0x") ? e.slice(2) : e).replace(/[^0-9a-fA-F]/g, "0").padStart(fa, "0").slice(-64) : "0x" + "0".repeat(fa), ma = 5e3, ha = 6;
2261
- async function ga({ normalizedRequests: e, item: t }) {
2346
+ }), va = R("seedProtocol:services:publish:verifyAttestations"), ya = "0x" + "0".repeat(64), ba = 64, xa = (e) => e == null ? "0x" + "0".repeat(ba) : typeof e == "string" ? "0x" + (e.startsWith("0x") ? e.slice(2) : e).replace(/[^0-9a-fA-F]/g, "0").padStart(ba, "0").slice(-64) : "0x" + "0".repeat(ba), Sa = 5e3, Ca = 6;
2347
+ async function wa({ normalizedRequests: e, item: t }) {
2262
2348
  let n = t.seedLocalId;
2263
2349
  for (let t of e) {
2264
- if (t.listOfAttestations.length === 0 || t.versionUid === da) continue;
2265
- let e = t.listOfAttestations.map((e) => pa(e.schema).toLowerCase()), r = [], i;
2266
- for (let e = 1; e <= ha; e++) try {
2267
- e > 1 && await new Promise((e) => setTimeout(e, ma)), r = await Pe({ versionUids: [t.versionUid] });
2350
+ if (t.listOfAttestations.length === 0 || t.versionUid === ya) continue;
2351
+ let e = t.listOfAttestations.map((e) => xa(e.schema).toLowerCase()), r = [], i;
2352
+ for (let e = 1; e <= Ca; e++) try {
2353
+ e > 1 && await new Promise((e) => setTimeout(e, Sa)), r = await Re({ versionUids: [t.versionUid] });
2268
2354
  break;
2269
2355
  } catch (t) {
2270
- if (i = t, ua("verifyAttestations attempt %d failed:", e, t), e === ha) throw ua("verifyAttestations: giving up after %d attempts", ha), i;
2356
+ if (i = t, va("verifyAttestations attempt %d failed:", e, t), e === Ca) throw va("verifyAttestations: giving up after %d attempts", Ca), i;
2271
2357
  }
2272
- let a = r.map((e) => e.schemaId ? pa(e.schemaId).toLowerCase() : "").filter(Boolean), o = new Set(a);
2273
- if (e.filter((e) => !o.has(e)).length > 0) throw new Te(`Publish verification failed: Seed and Version attestations were created, but property/metadata attestations are missing or incomplete. Expected ${e.length} property attestations for schema(s) ${e.join(", ")}; found ${a.length}. Use PublishManager.retryAttestations('${n}') to retry.`, n, e, a, "METADATA_PROPERTIES_MISSING");
2358
+ let a = r.map((e) => e.schemaId ? xa(e.schemaId).toLowerCase() : "").filter(Boolean), o = new Set(a);
2359
+ if (e.filter((e) => !o.has(e)).length > 0) throw new de(`Publish verification failed: Seed and Version attestations were created, but property/metadata attestations are missing or incomplete. Expected ${e.length} property attestations for schema(s) ${e.join(", ")}; found ${a.length}. Use PublishManager.retryAttestations('${n}') to retry.`, n, e, a, "METADATA_PROPERTIES_MISSING");
2274
2360
  }
2275
2361
  }
2276
2362
  //#endregion
2277
2363
  //#region src/services/publish/actors/createAttestationsDirectToEas.ts
2278
- var _a = R("seedProtocol:services:publish:createAttestationsDirectToEas"), va = 64, Y = (e) => {
2279
- if (e == null) return "0x" + "0".repeat(va);
2280
- if (typeof e == "string") return "0x" + (e.startsWith("0x") ? e.slice(2) : e).replace(/[^0-9a-fA-F]/g, "0").padStart(va, "0").slice(-64);
2364
+ var Ta = R("seedProtocol:services:publish:createAttestationsDirectToEas"), Ea = 64, Y = (e) => {
2365
+ if (e == null) return "0x" + "0".repeat(Ea);
2366
+ if (typeof e == "string") return "0x" + (e.startsWith("0x") ? e.slice(2) : e).replace(/[^0-9a-fA-F]/g, "0").padStart(Ea, "0").slice(-64);
2281
2367
  if (e instanceof Uint8Array || typeof ArrayBuffer < "u" && e instanceof ArrayBuffer) {
2282
2368
  let t = e instanceof Uint8Array ? e : new Uint8Array(e);
2283
- return "0x" + Array.from(t).map((e) => e.toString(16).padStart(2, "0")).join("").padStart(va, "0").slice(-64);
2369
+ return "0x" + Array.from(t).map((e) => e.toString(16).padStart(2, "0")).join("").padStart(Ea, "0").slice(-64);
2284
2370
  }
2285
- return "0x" + "0".repeat(va);
2286
- }, ya = (e) => {
2371
+ return "0x" + "0".repeat(Ea);
2372
+ }, Da = (e) => {
2287
2373
  if (e == null || typeof e == "string" && (e === "" || e === "0x")) return "0x";
2288
2374
  if (typeof e == "string") {
2289
2375
  let t = (e.startsWith("0x") ? e.slice(2) : e).replace(/[^0-9a-fA-F]/g, "0");
@@ -2294,7 +2380,7 @@ var _a = R("seedProtocol:services:publish:createAttestationsDirectToEas"), va =
2294
2380
  return "0x" + Array.from(t).map((e) => e.toString(16).padStart(2, "0")).join("");
2295
2381
  }
2296
2382
  return "0x";
2297
- }, ba = async (e) => {
2383
+ }, Oa = async (e) => {
2298
2384
  let t;
2299
2385
  try {
2300
2386
  t = await M.find({ seedLocalId: e });
@@ -2308,26 +2394,26 @@ var _a = R("seedProtocol:services:publish:createAttestationsDirectToEas"), va =
2308
2394
  } catch {}
2309
2395
  }, 200);
2310
2396
  });
2311
- }, xa = L(async ({ input: { context: e, event: t } }) => {
2312
- let { address: n, account: r, wallet: a } = e, s = e.arweaveTransactions ?? [], f = e.publishUploads ?? [], { item: p } = e;
2397
+ }, ka = L(async ({ input: { context: e, event: t } }) => {
2398
+ let { address: n, account: r, wallet: i } = e, a = e.arweaveTransactions ?? [], o = e.publishUploads ?? [], { item: c } = e;
2313
2399
  if (!n || typeof n != "string" || !n.trim()) throw Error("No wallet address for publish. Connect a wallet and try again.");
2314
- if (!a && !r) throw Error("Wallet session is missing. Reconnect your wallet and retry the publish.");
2315
- if (!p?.seedLocalId) throw Error("Attestation recovery failed: Item data is missing. Delete this publish record and try a full publish from the beginning.");
2316
- if (typeof p.getPublishUploads != "function" && (p = await ba(p.seedLocalId)), s.length !== f.length) throw Error("Attestation recovery failed: Arweave transaction data is missing or incomplete. Delete this publish record and try a full publish from the beginning.");
2317
- let m = wi(e), h = m.txSender;
2318
- await vn(p, m, { managedAddress: n });
2319
- let g = s.map((e, t) => {
2400
+ if (!i && !r) throw Error("Wallet session is missing. Reconnect your wallet and retry the publish.");
2401
+ if (!c?.seedLocalId) throw Error("Attestation recovery failed: Item data is missing. Delete this publish record and try a full publish from the beginning.");
2402
+ if (typeof c.getPublishUploads != "function" && (c = await Oa(c.seedLocalId)), a.length !== o.length) throw Error("Attestation recovery failed: Arweave transaction data is missing or incomplete. Delete this publish record and try a full publish from the beginning.");
2403
+ let l = Mi(e), d = l.txSender;
2404
+ await xn(c, l, { managedAddress: n });
2405
+ let f = a.map((e, t) => {
2320
2406
  let n = e.transaction?.id;
2321
2407
  if (!n || typeof n != "string") throw Error("Attestation recovery failed: Arweave transaction data did not survive restore. Delete this publish record and try a full publish from the beginning.");
2322
- let r = f[t];
2408
+ let r = o[t];
2323
2409
  if (!r) throw Error("Publish upload index mismatch");
2324
2410
  return {
2325
2411
  ...r,
2326
2412
  txId: n
2327
2413
  };
2328
2414
  });
2329
- await Ai(g.map((e) => e.txId));
2330
- let _ = await p.getPublishPayload(g, { publishMode: e.publishMode ?? "patch" }), v = (Array.isArray(_) ? _ : [_]).map((e) => {
2415
+ await Ri(f.map((e) => e.txId));
2416
+ let m = await c.getPublishPayload(f, { publishMode: e.publishMode ?? "patch" }), h = (Array.isArray(m) ? m : [m]).map((e) => {
2331
2417
  let t = (e?.listOfAttestations ?? []).map((e) => {
2332
2418
  let t = Array.isArray(e?.data) ? e.data : [];
2333
2419
  return {
@@ -2335,7 +2421,7 @@ var _a = R("seedProtocol:services:publish:createAttestationsDirectToEas"), va =
2335
2421
  data: t.map((e) => ({
2336
2422
  ...e,
2337
2423
  refUID: Y(e?.refUID),
2338
- data: ya(e?.data)
2424
+ data: Da(e?.data)
2339
2425
  })),
2340
2426
  ...typeof e?._propertyName == "string" && e._propertyName !== "" ? { _propertyName: e._propertyName } : {},
2341
2427
  ...typeof e?._propertyNameForSchema == "string" && e._propertyNameForSchema !== "" ? { _propertyNameForSchema: e._propertyNameForSchema } : {}
@@ -2353,126 +2439,126 @@ var _a = R("seedProtocol:services:publish:createAttestationsDirectToEas"), va =
2353
2439
  listOfAttestations: t,
2354
2440
  propertiesToUpdate: n
2355
2441
  };
2356
- }), y = new Map(v.map((e) => [e.localId, e])), b = {
2357
- recipient: Mt,
2442
+ }), _ = new Map(h.map((e) => [e.localId, e])), y = {
2443
+ recipient: Ft,
2358
2444
  expirationTime: BigInt(0),
2359
2445
  revocable: !0,
2360
- refUID: l,
2361
- data: l,
2446
+ refUID: g,
2447
+ data: g,
2362
2448
  value: BigInt(0)
2363
2449
  };
2364
- for (let e of v) for (let t of e.propertiesToUpdate ?? []) {
2450
+ for (let e of h) for (let t of e.propertiesToUpdate ?? []) {
2365
2451
  let e = t.publishLocalId, n = Y(t.propertySchemaUid);
2366
2452
  if (!e || !n) continue;
2367
- let r = y.get(e);
2453
+ let r = _.get(e);
2368
2454
  if (!r?.listOfAttestations) continue;
2369
2455
  let i = r.listOfAttestations.find((e) => Y(e?.schema)?.toLowerCase() === n?.toLowerCase());
2370
2456
  i && (!Array.isArray(i.data) || i.data.length === 0) && (i.data = [{
2371
- ...b,
2372
- refUID: l
2457
+ ...y,
2458
+ refUID: g
2373
2459
  }]);
2374
2460
  }
2375
- let x = Date.now(), S = [];
2376
- for (let e = 0; e < v.length; e++) {
2377
- let t = v[e], r = t.seedUid, a = t.versionUid;
2378
- if (r === l) {
2379
- let e = o({
2461
+ let b = Date.now(), x = [];
2462
+ for (let e = 0; e < h.length; e++) {
2463
+ let t = h[e], r = t.seedUid, i = t.versionUid;
2464
+ if (r === g) {
2465
+ let e = v({
2380
2466
  schema: t.seedSchemaUid,
2381
2467
  data: {
2382
- refUID: l,
2383
- data: u(t.seedSchemaUid),
2468
+ refUID: g,
2469
+ data: s(t.seedSchemaUid),
2384
2470
  revocable: t.seedIsRevocable
2385
2471
  }
2386
- }), n = await h.sendTransaction(e), i = await C(n.transactionHash);
2472
+ }), n = await d.sendTransaction(e), i = await C(n.transactionHash);
2387
2473
  if (!i) throw Error("Failed to create Seed attestation");
2388
- x = await q(i);
2389
- let { easContractAddress: a } = E(), s = d(i, a);
2390
- if (!s || s === l) throw Error("Failed to get Seed UID from attestation receipt");
2391
- r = s, t.seedUid = s, S.push(s), _a("created Seed attestation", r);
2392
- } else r !== l && S.push(r);
2393
- if (r !== l && a === l) {
2394
- let e = o({
2474
+ b = await q(i);
2475
+ let { easContractAddress: a } = T(), o = u(i, a);
2476
+ if (!o || o === g) throw Error("Failed to get Seed UID from attestation receipt");
2477
+ r = o, t.seedUid = o, x.push(o), Ta("created Seed attestation", r);
2478
+ } else r !== g && x.push(r);
2479
+ if (r !== g && i === g) {
2480
+ let e = v({
2395
2481
  schema: t.versionSchemaUid,
2396
2482
  data: {
2397
2483
  refUID: r,
2398
- data: u(t.versionSchemaUid),
2484
+ data: s(t.versionSchemaUid),
2399
2485
  revocable: !0
2400
2486
  }
2401
- }), i = await h.sendTransaction(e), s = await C(i.transactionHash);
2402
- if (!s) throw Error("Failed to create Version attestation");
2403
- x = await q(s);
2404
- let { easContractAddress: c } = E(), f = d(s, c);
2405
- if (!f || f === l) throw Error("Failed to get Version UID from attestation receipt");
2406
- a = f, t.versionUid = f, S.push(f), await Xe({
2487
+ }), a = await d.sendTransaction(e), o = await C(a.transactionHash);
2488
+ if (!o) throw Error("Failed to create Version attestation");
2489
+ b = await q(o);
2490
+ let { easContractAddress: c } = T(), l = u(o, c);
2491
+ if (!l || l === g) throw Error("Failed to get Version UID from attestation receipt");
2492
+ i = l, t.versionUid = l, x.push(l), await tt({
2407
2493
  seedLocalId: t.localId,
2408
- versionUid: f,
2494
+ versionUid: l,
2409
2495
  publisher: n,
2410
- attestationCreatedAt: x
2411
- }), _a("created Version attestation", a);
2412
- } else a !== l && S.push(a);
2413
- for (let e of t.listOfAttestations) for (let t of e.data) t.refUID = a;
2496
+ attestationCreatedAt: b
2497
+ }), Ta("created Version attestation", i);
2498
+ } else i !== g && x.push(i);
2499
+ for (let e of t.listOfAttestations) for (let t of e.data) t.refUID = i;
2414
2500
  for (let e of t.propertiesToUpdate ?? []) {
2415
- let t = y.get(e.publishLocalId);
2501
+ let t = _.get(e.publishLocalId);
2416
2502
  if (!t?.listOfAttestations) continue;
2417
2503
  let n = Y(e.propertySchemaUid), i = t.listOfAttestations.find((e) => Y(e?.schema)?.toLowerCase() === n?.toLowerCase());
2418
- i?.data?.[0] && (i.data[0].data = u(r));
2504
+ i?.data?.[0] && (i.data[0].data = s(r));
2419
2505
  }
2420
- let s = t.listOfAttestations.map((e) => ({
2506
+ let a = t.listOfAttestations.map((e) => ({
2421
2507
  schema: e.schema,
2422
2508
  data: e.data.map((e) => ({
2423
- recipient: e.recipient ?? Mt,
2509
+ recipient: e.recipient ?? Ft,
2424
2510
  expirationTime: e.expirationTime ?? 0n,
2425
2511
  revocable: e.revocable ?? !0,
2426
- refUID: e.refUID ?? l,
2512
+ refUID: e.refUID ?? g,
2427
2513
  data: e.data ?? "0x",
2428
2514
  value: e.value ?? 0n
2429
2515
  }))
2430
2516
  }));
2431
- if (s.length > 0) {
2432
- let n = c(s), r = await h.sendTransaction(n), o = await C(r.transactionHash);
2517
+ if (a.length > 0) {
2518
+ let n = ke(a), r = await d.sendTransaction(n), o = await C(r.transactionHash);
2433
2519
  if (!o) throw Error("Failed to create property attestations");
2434
- x = await q(o), _a("created property attestations for request", e);
2435
- let { easContractAddress: u } = E(), d = i(o, u);
2436
- for (let e of d) e.uid && S.push(e.uid);
2437
- let f = t.listOfAttestations, p = d.length === f.length;
2438
- await ke({
2520
+ b = await q(o), Ta("created property attestations for request", e);
2521
+ let { easContractAddress: s } = T(), c = p(o, s);
2522
+ for (let e of c) e.uid && x.push(e.uid);
2523
+ let l = t.listOfAttestations, u = c.length === l.length;
2524
+ await Ne({
2439
2525
  seedLocalId: t.localId,
2440
- attestationCreatedAtMs: x ?? null,
2441
- versionUid: a === l ? null : a,
2442
- pairs: d.map((e, t) => ({
2526
+ attestationCreatedAtMs: b ?? null,
2527
+ versionUid: i === g ? null : i,
2528
+ pairs: c.map((e, t) => ({
2443
2529
  schemaUid: e.schemaUid,
2444
2530
  attestationUid: e.uid,
2445
- propertyName: p && typeof f[t]?._propertyName == "string" && f[t]._propertyName !== "" ? f[t]._propertyName : void 0
2531
+ propertyName: u && typeof l[t]?._propertyName == "string" && l[t]._propertyName !== "" ? l[t]._propertyName : void 0
2446
2532
  }))
2447
2533
  });
2448
2534
  }
2449
2535
  }
2450
- Oi(p, v);
2451
- let ee = p;
2452
- v[0]?.seedUid && v[0].seedUid !== l && await ki(ee, n, x);
2536
+ Ii(c, h);
2537
+ let ee = c;
2538
+ h[0]?.seedUid && h[0].seedUid !== g && await Li(ee, n, b);
2453
2539
  try {
2454
- await ga({
2455
- normalizedRequests: v,
2456
- item: p
2540
+ await wa({
2541
+ normalizedRequests: h,
2542
+ item: c
2457
2543
  });
2458
2544
  } catch (e) {
2459
- throw e instanceof Te || _a("verifyAttestations failed (non-verification error):", e), e;
2545
+ throw e instanceof de || Ta("verifyAttestations failed (non-verification error):", e), e;
2460
2546
  }
2461
- _a("direct EAS publish complete"), qi(e);
2547
+ Ta("direct EAS publish complete"), ta(e);
2462
2548
  try {
2463
2549
  let { clearHtmlEmbeddedImageCoPublishRows: e } = await import("@seedprotocol/sdk");
2464
- await e(p.seedLocalId);
2550
+ await e(c.seedLocalId);
2465
2551
  } catch {}
2466
- let { collectPublishedBatch: w } = await import("./collectBatchUids-CnIe9jUB.js").then((e) => e.t), T = v.find((e) => e?.localId === p.seedLocalId) ?? v[0];
2552
+ let { collectPublishedBatch: te } = await import("./collectBatchUids-CnIe9jUB.js").then((e) => e.t), S = h.find((e) => e?.localId === c.seedLocalId) ?? h[0];
2467
2553
  return {
2468
- easPayload: _,
2469
- publishedBatch: T?.seedUid ? w({
2470
- seedUid: String(T.seedUid),
2471
- versionUid: T.versionUid ? String(T.versionUid) : void 0,
2472
- extraUids: S
2554
+ easPayload: m,
2555
+ publishedBatch: S?.seedUid ? te({
2556
+ seedUid: String(S.seedUid),
2557
+ versionUid: S.versionUid ? String(S.versionUid) : void 0,
2558
+ extraUids: x
2473
2559
  }) : null
2474
2560
  };
2475
- }), Sa = async (e) => {
2561
+ }), Aa = async (e) => {
2476
2562
  let t;
2477
2563
  try {
2478
2564
  t = await M.find({ seedLocalId: e });
@@ -2485,21 +2571,21 @@ var _a = R("seedProtocol:services:publish:createAttestationsDirectToEas"), va =
2485
2571
  }, 200);
2486
2572
  });
2487
2573
  };
2488
- async function Ca(e) {
2489
- let t = typeof e.getPublishUploads == "function" ? e : await Sa(e.seedLocalId);
2490
- return await Ve(t);
2574
+ async function ja(e) {
2575
+ let t = typeof e.getPublishUploads == "function" ? e : await Aa(e.seedLocalId);
2576
+ return await Ge(t);
2491
2577
  }
2492
2578
  //#endregion
2493
2579
  //#region src/services/publish/actors/checking.ts
2494
2580
  var X = /* @__PURE__ */ new Set();
2495
- async function wa(e) {
2496
- let t = E();
2497
- return t.useDirectEas ? "directEas" : t.useModularExecutor || await ue(e) ? "multiPublish" : "directEas";
2581
+ async function Ma(e) {
2582
+ let t = T();
2583
+ return t.useDirectEas ? "directEas" : t.useModularExecutor || await ce(e) ? "multiPublish" : "directEas";
2498
2584
  }
2499
- var Ta = It(({ sendBack: e, input: { context: t } }) => {
2585
+ var Na = zt(({ sendBack: e, input: { context: t } }) => {
2500
2586
  let { item: n, account: r, wallet: i, publishMode: a, address: o } = t;
2501
2587
  return (async () => {
2502
- if (!await ze(n)) {
2588
+ if (!await Ue(n)) {
2503
2589
  e({ type: "notOwner" });
2504
2590
  return;
2505
2591
  }
@@ -2509,10 +2595,10 @@ var Ta = It(({ sendBack: e, input: { context: t } }) => {
2509
2595
  }
2510
2596
  X.add(n.seedLocalId);
2511
2597
  try {
2512
- await je(), await T();
2598
+ await Fe(), await ue();
2513
2599
  let t = i ?? r;
2514
- t && await vn(n, t, { managedAddress: typeof o == "string" ? o : void 0 });
2515
- let s = await Ze(n, [], { publishMode: a ?? "patch" });
2600
+ t && await xn(n, t, { managedAddress: typeof o == "string" ? o : void 0 });
2601
+ let s = await nt(n, [], { publishMode: a ?? "patch" });
2516
2602
  if (!s.isValid) {
2517
2603
  X.delete(n.seedLocalId), e({
2518
2604
  type: "validationFailed",
@@ -2529,15 +2615,15 @@ var Ta = It(({ sendBack: e, input: { context: t } }) => {
2529
2615
  }
2530
2616
  let c;
2531
2617
  try {
2532
- c = await wa(o.trim());
2618
+ c = await Ma(o.trim());
2533
2619
  } catch (t) {
2534
2620
  X.delete(n.seedLocalId), e({
2535
2621
  type: "checkingFailed",
2536
- error: Error(`Could not verify whether the publisher is a deployed contract on ${D()}. Check your RPC connection and retry.`, { cause: t })
2622
+ error: Error(`Could not verify whether the publisher is a deployed contract on ${E()}. Check your RPC connection and retry.`, { cause: t })
2537
2623
  });
2538
2624
  return;
2539
2625
  }
2540
- let l = await Ca(n), u = E().useArweaveBundler, d = { attestationStrategy: c };
2626
+ let l = await ja(n), u = T().useArweaveBundler, d = { attestationStrategy: c };
2541
2627
  e(l ? u ? {
2542
2628
  type: "validPublishProcessBundler",
2543
2629
  ...d
@@ -2562,38 +2648,38 @@ var Ta = It(({ sendBack: e, input: { context: t } }) => {
2562
2648
  }), () => {
2563
2649
  X.delete(n.seedLocalId);
2564
2650
  };
2565
- }), { SUCCESS: Ea, FAILURE: Z } = be;
2566
- function Da(e) {
2651
+ }), { SUCCESS: Pa, FAILURE: Z } = ge;
2652
+ function Fa(e) {
2567
2653
  let t = e.attestationStrategy;
2568
- return t === "directEas" || t !== "multiPublish" && E().useDirectEas;
2654
+ return t === "directEas" || t !== "multiPublish" && T().useDirectEas;
2569
2655
  }
2570
- function Oa(e) {
2656
+ function Ia(e) {
2571
2657
  let t = e.attestationStrategy;
2572
- return t === "multiPublish" || t !== "directEas" && !E().useDirectEas;
2658
+ return t === "multiPublish" || t !== "directEas" && !T().useDirectEas;
2573
2659
  }
2574
2660
  function Q(e) {
2575
2661
  let t = e;
2576
2662
  return t.error ?? t.data;
2577
2663
  }
2578
- var ka = Lt({
2664
+ var La = Bt({
2579
2665
  types: {
2580
2666
  context: {},
2581
2667
  input: {}
2582
2668
  },
2583
2669
  actors: {
2584
- createArweaveTransactions: Cn,
2585
- createArweaveTransactionsPhase2: wn,
2586
- createArweaveDataItems: ur,
2587
- createArweaveDataItemsPhase2: fr,
2588
- sendReimbursementRequest: yr,
2589
- pollForConfirmation: br,
2590
- uploadData: Sr,
2591
- uploadViaBundler: Dr,
2592
- createAttestations: la,
2593
- createAttestationsDirectToEas: xa,
2594
- checking: Ta,
2595
- preparingHtmlEmbedded: Tn,
2596
- rewritingHtmlEmbedded: Dn
2670
+ createArweaveTransactions: En,
2671
+ createArweaveTransactionsPhase2: Dn,
2672
+ createArweaveDataItems: pr,
2673
+ createArweaveDataItemsPhase2: hr,
2674
+ sendReimbursementRequest: Sr,
2675
+ pollForConfirmation: Cr,
2676
+ uploadData: Tr,
2677
+ uploadViaBundler: Ar,
2678
+ createAttestations: _a,
2679
+ createAttestationsDirectToEas: ka,
2680
+ checking: Na,
2681
+ preparingHtmlEmbedded: On,
2682
+ rewritingHtmlEmbedded: An
2597
2683
  },
2598
2684
  actions: {
2599
2685
  handleError: ({ event: e }) => {
@@ -2714,7 +2800,7 @@ var ka = Lt({
2714
2800
  actions: I({ attestationStrategy: ({ event: e }) => e.attestationStrategy })
2715
2801
  },
2716
2802
  skipArweave: [{
2717
- guard: ({ context: e }) => Da(e),
2803
+ guard: ({ context: e }) => Fa(e),
2718
2804
  target: "creatingAttestationsDirectToEas",
2719
2805
  actions: I({
2720
2806
  arweaveTransactions: () => [],
@@ -2722,7 +2808,7 @@ var ka = Lt({
2722
2808
  attestationStrategy: ({ event: e }) => e.attestationStrategy
2723
2809
  })
2724
2810
  }, {
2725
- guard: ({ context: e }) => Oa(e),
2811
+ guard: ({ context: e }) => Ia(e),
2726
2812
  target: "creatingAttestations",
2727
2813
  actions: I({
2728
2814
  arweaveTransactions: () => [],
@@ -2740,7 +2826,7 @@ var ka = Lt({
2740
2826
  src: "preparingHtmlEmbedded",
2741
2827
  input: ({ context: e }) => ({ context: e }),
2742
2828
  onDone: [{
2743
- guard: () => E().useArweaveBundler,
2829
+ guard: () => T().useArweaveBundler,
2744
2830
  target: "creatingArweaveDataItems",
2745
2831
  actions: I({ htmlEmbeddedDeferredHtmlSeedLocalIds: ({ event: e }) => e.output.deferredHtmlSeedLocalIds })
2746
2832
  }, {
@@ -2826,7 +2912,7 @@ var ka = Lt({
2826
2912
  on: {
2827
2913
  uploadComplete: [
2828
2914
  {
2829
- guard: ({ context: e }) => Da(e),
2915
+ guard: ({ context: e }) => Fa(e),
2830
2916
  target: "creatingAttestationsDirectToEas",
2831
2917
  actions: I({
2832
2918
  completionPercentage: 100,
@@ -2845,7 +2931,7 @@ var ka = Lt({
2845
2931
  })
2846
2932
  },
2847
2933
  {
2848
- guard: ({ context: e }) => Oa(e),
2934
+ guard: ({ context: e }) => Ia(e),
2849
2935
  target: "creatingAttestations",
2850
2936
  actions: I({
2851
2937
  completionPercentage: 100,
@@ -2888,7 +2974,7 @@ var ka = Lt({
2888
2974
  uploadingViaBundlerPhase2: {
2889
2975
  on: {
2890
2976
  uploadComplete: [{
2891
- guard: ({ context: e }) => Da(e),
2977
+ guard: ({ context: e }) => Fa(e),
2892
2978
  target: "creatingAttestationsDirectToEas",
2893
2979
  actions: I({
2894
2980
  completionPercentage: 100,
@@ -2896,7 +2982,7 @@ var ka = Lt({
2896
2982
  arweaveUploadData: () => void 0
2897
2983
  })
2898
2984
  }, {
2899
- guard: ({ context: e }) => Oa(e),
2985
+ guard: ({ context: e }) => Ia(e),
2900
2986
  target: "creatingAttestations",
2901
2987
  actions: I({
2902
2988
  completionPercentage: 100,
@@ -2925,7 +3011,7 @@ var ka = Lt({
2925
3011
  }) },
2926
3012
  uploadComplete: [
2927
3013
  {
2928
- guard: ({ context: e }) => Da(e),
3014
+ guard: ({ context: e }) => Fa(e),
2929
3015
  target: "creatingAttestationsDirectToEas",
2930
3016
  actions: I({ completionPercentage: 100 })
2931
3017
  },
@@ -2938,7 +3024,7 @@ var ka = Lt({
2938
3024
  })
2939
3025
  },
2940
3026
  {
2941
- guard: ({ context: e }) => Oa(e),
3027
+ guard: ({ context: e }) => Ia(e),
2942
3028
  target: "creatingAttestations",
2943
3029
  actions: I({ completionPercentage: 100 })
2944
3030
  }
@@ -2957,10 +3043,10 @@ var ka = Lt({
2957
3043
  src: "rewritingHtmlEmbedded",
2958
3044
  input: ({ context: e }) => ({ context: e }),
2959
3045
  onDone: [{
2960
- guard: () => !E().useArweaveBundler,
3046
+ guard: () => !T().useArweaveBundler,
2961
3047
  target: "creatingArweaveTransactionsPhase2"
2962
3048
  }, {
2963
- guard: () => E().useArweaveBundler,
3049
+ guard: () => T().useArweaveBundler,
2964
3050
  target: "creatingArweaveDataItemsPhase2"
2965
3051
  }],
2966
3052
  onError: {
@@ -2996,11 +3082,11 @@ var ka = Lt({
2996
3082
  currentTransactionIndex: ({ event: e }) => e.currentTransactionIndex
2997
3083
  }) },
2998
3084
  uploadComplete: [{
2999
- guard: ({ context: e }) => Da(e),
3085
+ guard: ({ context: e }) => Fa(e),
3000
3086
  target: "creatingAttestationsDirectToEas",
3001
3087
  actions: I({ completionPercentage: 100 })
3002
3088
  }, {
3003
- guard: ({ context: e }) => Oa(e),
3089
+ guard: ({ context: e }) => Ia(e),
3004
3090
  target: "creatingAttestations",
3005
3091
  actions: I({
3006
3092
  completionPercentage: 100,
@@ -3025,7 +3111,7 @@ var ka = Lt({
3025
3111
  event: t
3026
3112
  }),
3027
3113
  onDone: {
3028
- target: Ea,
3114
+ target: Pa,
3029
3115
  actions: I({
3030
3116
  easPayload: ({ event: e }) => e.output?.easPayload,
3031
3117
  publishedBatch: ({ event: e }) => e.output?.publishedBatch ?? null
@@ -3047,7 +3133,7 @@ var ka = Lt({
3047
3133
  event: t
3048
3134
  }),
3049
3135
  onDone: {
3050
- target: Ea,
3136
+ target: Pa,
3051
3137
  actions: I({
3052
3138
  easPayload: ({ event: e }) => e.output?.easPayload,
3053
3139
  publishedBatch: ({ event: e }) => e.output?.publishedBatch ?? null
@@ -3068,7 +3154,7 @@ var ka = Lt({
3068
3154
  },
3069
3155
  type: "final"
3070
3156
  },
3071
- [Ea]: {
3157
+ [Pa]: {
3072
3158
  entry: ({ context: e }) => {
3073
3159
  let t = e.publishedBatch, n = e.onPublished;
3074
3160
  if (!n || !t?.seedUid) return;
@@ -3089,96 +3175,96 @@ var ka = Lt({
3089
3175
  type: "final"
3090
3176
  }
3091
3177
  }
3092
- }), Aa = I(({ context: e, event: t }) => {
3178
+ }), Ra = I(({ context: e, event: t }) => {
3093
3179
  let n = t, r = n.publishProcesses ?? /* @__PURE__ */ new Map(), i = n.subscriptions ?? /* @__PURE__ */ new Map();
3094
3180
  return {
3095
3181
  publishProcesses: new Map(r),
3096
3182
  subscriptions: new Map(i)
3097
3183
  };
3098
- }), ja = null;
3099
- function Ma(e) {
3100
- ja = e;
3184
+ }), za = null;
3185
+ function Ba(e) {
3186
+ za = e;
3101
3187
  }
3102
- function Na() {
3103
- return ja;
3188
+ function Va() {
3189
+ return za;
3104
3190
  }
3105
3191
  //#endregion
3106
3192
  //#region src/services/publishManager/actors/subscribe.ts
3107
- var Pa = R("seedProtocol:services:PublishManager:actors:subscribe");
3108
- function Fa(e) {
3193
+ var Ha = R("seedProtocol:services:PublishManager:actors:subscribe");
3194
+ function Ua(e) {
3109
3195
  let t = e.value;
3110
3196
  return typeof t == "string" ? t : t && typeof t == "object" ? Object.keys(t)[0] ?? "" : "";
3111
3197
  }
3112
- function Ia(e) {
3113
- return ie.includes(e);
3114
- }
3115
- var La = It(({ receive: e, input: { publishProcess: t, seedLocalId: n } }) => {
3116
- let r = Na(), i = null, a = () => {
3117
- i != null && (clearInterval(i), i = null);
3118
- }, o = (e) => {
3119
- let o = Fa(e);
3120
- Ia(o) && i == null && r ? i = setInterval(() => {
3198
+ function Wa(e) {
3199
+ return a.includes(e);
3200
+ }
3201
+ var Ga = zt(({ receive: e, input: { publishProcess: n, seedLocalId: r } }) => {
3202
+ let i = Va(), a = null, o = () => {
3203
+ a != null && (clearInterval(a), a = null);
3204
+ }, s = (e) => {
3205
+ let s = Ua(e);
3206
+ Wa(s) && a == null && i ? a = setInterval(() => {
3121
3207
  try {
3122
- let e = t.getSnapshot();
3208
+ let e = n.getSnapshot();
3123
3209
  if (e.status === "done") {
3124
- a();
3210
+ o();
3125
3211
  return;
3126
3212
  }
3127
- if (!Ia(Fa(e))) {
3128
- a();
3213
+ if (!Wa(Ua(e))) {
3214
+ o();
3129
3215
  return;
3130
3216
  }
3131
3217
  } catch {
3132
3218
  return;
3133
3219
  }
3134
- r?.savePublish(n, t);
3135
- }, ye) : Ia(o) || a();
3136
- }, s = t.subscribe(async (e) => {
3137
- Pa("Publish state:", e.value), r && (e.status === "done" ? (a(), r.savePublish(n, t, { triggerPublishDone: !0 })) : (r.savePublish(n, t), o(e)));
3220
+ i?.savePublish(r, n);
3221
+ }, t) : Wa(s) || o();
3222
+ }, c = n.subscribe(async (e) => {
3223
+ Ha("Publish state:", e.value), i && (e.status === "done" ? (o(), i.savePublish(r, n, { triggerPublishDone: !0 })) : (i.savePublish(r, n), s(e)));
3138
3224
  });
3139
3225
  e(({ type: e }) => {
3140
- e === "UNSUBSCRIBE" && (Pa("Received UNSUBSCRIBE event"), a(), s.unsubscribe(), r?.removeSubscription(n));
3226
+ e === "UNSUBSCRIBE" && (Ha("Received UNSUBSCRIBE event"), o(), c.unsubscribe(), i?.removeSubscription(r));
3141
3227
  });
3142
- }), Ra = /* @__PURE__ */ new Map(), za = 1;
3143
- function Ba(e) {
3144
- let t = za++;
3145
- return Ra.set(t, e), t;
3228
+ }), Ka = /* @__PURE__ */ new Map(), qa = 1;
3229
+ function Ja(e) {
3230
+ let t = qa++;
3231
+ return Ka.set(t, e), t;
3146
3232
  }
3147
- function Va(e, t) {
3233
+ function Ya(e, t) {
3148
3234
  if (e == null) return;
3149
- let n = Ra.get(e);
3150
- n && (Ra.delete(e), n(t));
3235
+ let n = Ka.get(e);
3236
+ n && (Ka.delete(e), n(t));
3151
3237
  }
3152
3238
  //#endregion
3153
3239
  //#region src/services/publishManager/actions/createPublish.ts
3154
- function Ha(e) {
3240
+ function Xa(e) {
3155
3241
  if (e) {
3156
- if (m(e)) return e;
3157
- if (r(e)) {
3158
- let t = oe();
3242
+ if (i(e)) return e;
3243
+ if (m(e)) {
3244
+ let t = he();
3159
3245
  if (t && t.signer.address.toLowerCase() === e.address.toLowerCase()) return t;
3160
3246
  throw Error("@seedprotocol/publish: createPublish requires a PublishWallet (signer + txSender). Use fromEthersWallet, fromEip1193Provider, or fromThirdwebAccount.");
3161
3247
  }
3162
3248
  throw Error("@seedprotocol/publish: createPublish account must be a PublishWallet. Thirdweb Account must be wrapped with fromThirdwebAccount from @seedprotocol/publish/thirdweb.");
3163
3249
  }
3164
3250
  }
3165
- function Ua(e) {
3251
+ function Za(e) {
3166
3252
  if (e) {
3167
3253
  if (e instanceof F.Wallet) return e;
3168
- if (m(e)) return e.signer;
3169
- if (r(e)) return e;
3254
+ if (i(e)) return e.signer;
3255
+ if (m(e)) return e;
3170
3256
  }
3171
3257
  }
3172
- var Wa = Ft(({ event: e, enqueue: t }) => {
3258
+ var Qa = Rt(({ event: e, enqueue: t }) => {
3173
3259
  let { item: n, address: r, account: i, options: a, createToken: o } = e;
3174
3260
  if (!(r != null && typeof r == "string" && r.trim().length > 0)) {
3175
- console.warn("[createPublish] No valid wallet address; skipping spawn."), Va(o, void 0);
3261
+ console.warn("[createPublish] No valid wallet address; skipping spawn."), Ya(o, void 0);
3176
3262
  return;
3177
3263
  }
3178
3264
  t.assign(({ context: e, spawn: t }) => {
3179
3265
  let { publishProcesses: s } = e;
3180
- if (s && s.has(n.seedLocalId)) return console.warn(`Publish process with seedLocalId "${n.seedLocalId}" already exists.`), Va(o, void 0), e;
3181
- let c = typeof crypto < "u" && typeof crypto.randomUUID == "function" ? crypto.randomUUID() : `run_${Date.now()}_${Math.random().toString(36).slice(2, 11)}`, l = E(), u = [...l.arweaveUploadTags ?? [], ...a?.arweaveUploadTags ?? []], d = Ha(i) ?? oe() ?? void 0, f = t(ka, { input: {
3266
+ if (s && s.has(n.seedLocalId)) return console.warn(`Publish process with seedLocalId "${n.seedLocalId}" already exists.`), Ya(o, void 0), e;
3267
+ let c = typeof crypto < "u" && typeof crypto.randomUUID == "function" ? crypto.randomUUID() : `run_${Date.now()}_${Math.random().toString(36).slice(2, 11)}`, l = T(), u = [...l.arweaveUploadTags ?? [], ...a?.arweaveUploadTags ?? []], d = Xa(i) ?? he() ?? void 0, f = t(La, { input: {
3182
3268
  item: n,
3183
3269
  address: r,
3184
3270
  wallet: d,
@@ -3186,7 +3272,7 @@ var Wa = Ft(({ event: e, enqueue: t }) => {
3186
3272
  modelName: n.modelName,
3187
3273
  schemaId: n.schemaUid,
3188
3274
  signDataItems: a?.signDataItems,
3189
- dataItemSigner: Ua(a?.dataItemSigner),
3275
+ dataItemSigner: Za(a?.dataItemSigner),
3190
3276
  signArweaveTransactions: a?.signArweaveTransactions,
3191
3277
  arweaveJwk: a?.arweaveJwk,
3192
3278
  publishMode: a?.publishMode ?? "patch",
@@ -3197,7 +3283,7 @@ var Wa = Ft(({ event: e, enqueue: t }) => {
3197
3283
  } });
3198
3284
  s.set(n.seedLocalId, f);
3199
3285
  let p = new Map(e.settledPublishes);
3200
- return p.delete(n.seedLocalId), Va(o, f), {
3286
+ return p.delete(n.seedLocalId), Ya(o, f), {
3201
3287
  ...e,
3202
3288
  publishProcesses: s,
3203
3289
  settledPublishes: p
@@ -3206,7 +3292,7 @@ var Wa = Ft(({ event: e, enqueue: t }) => {
3206
3292
  let { subscriptions: r, publishProcesses: i } = e, a = i.get(n.seedLocalId);
3207
3293
  if (!a) return console.warn(`Publish process with seedLocalId "${n.seedLocalId}" does not exist.`), e;
3208
3294
  if (r.has(n.seedLocalId)) return console.warn(`Subscription with seedLocalId "${n.seedLocalId}" already exists.`), e;
3209
- let o = t(La, { input: {
3295
+ let o = t(Ga, { input: {
3210
3296
  publishProcess: a,
3211
3297
  seedLocalId: n.seedLocalId
3212
3298
  } });
@@ -3215,47 +3301,47 @@ var Wa = Ft(({ event: e, enqueue: t }) => {
3215
3301
  subscriptions: new Map(r)
3216
3302
  };
3217
3303
  });
3218
- }), Ga = ({ context: e, event: t }) => {
3219
- let { seedLocalId: n, account: r } = t, i = e.publishProcesses.get(n);
3220
- if (!i) {
3304
+ }), $a = ({ context: e, event: t }) => {
3305
+ let { seedLocalId: n, account: r } = t, a = e.publishProcesses.get(n);
3306
+ if (!a) {
3221
3307
  console.warn(`Publish process with seedLocalId "${n}" does not exist.`);
3222
3308
  return;
3223
3309
  }
3224
- let a = r == null ? oe() ?? void 0 : m(r) ? r : void 0;
3225
- r != null && !a && console.warn("[retryAttestations] account must be a PublishWallet. Use fromThirdwebAccount / fromEip1193Provider / fromEthersWallet."), i.send({
3310
+ let o = r == null ? he() ?? void 0 : i(r) ? r : void 0;
3311
+ r != null && !o && console.warn("[retryAttestations] account must be a PublishWallet. Use fromThirdwebAccount / fromEip1193Provider / fromEthersWallet."), a.send({
3226
3312
  type: "retry",
3227
- account: a,
3228
- wallet: a
3313
+ account: o,
3314
+ wallet: o
3229
3315
  });
3230
3316
  };
3231
3317
  //#endregion
3232
3318
  //#region src/services/publishManager/actions/stopScopedOrStandaloneChild.ts
3233
- function Ka(e, t, n) {
3319
+ function eo(e, t, n) {
3234
3320
  t._parent === e ? n.stopChild(t) : t.stop();
3235
3321
  }
3236
3322
  //#endregion
3237
3323
  //#region src/services/publishManager/actors/savePublish.ts
3238
- var qa = R("seedProtocol:services:PublishManager:actors:savePublish"), Ja = /* @__PURE__ */ new Map();
3239
- function Ya(e, t) {
3240
- let n = (Ja.get(e) ?? Promise.resolve()).then(t);
3241
- return Ja.set(e, n.catch(() => {})), n;
3324
+ var to = R("seedProtocol:services:PublishManager:actors:savePublish"), no = /* @__PURE__ */ new Map();
3325
+ function ro(e, t) {
3326
+ let n = (no.get(e) ?? Promise.resolve()).then(t);
3327
+ return no.set(e, n.catch(() => {})), n;
3242
3328
  }
3243
- function Xa(e) {
3329
+ function io(e) {
3244
3330
  return e === "completed" || e === "failed" || e === "interrupted";
3245
3331
  }
3246
- function Za(e) {
3332
+ function ao(e) {
3247
3333
  return e.status === "done" ? e.value === "success" ? "completed" : e.value === "failure" ? "failed" : "completed" : "in_progress";
3248
3334
  }
3249
- var Qa = 500, $a = 2e3, eo = 100;
3250
- function to(e) {
3335
+ var oo = 500, so = 2e3, co = 100;
3336
+ function lo(e) {
3251
3337
  return JSON.stringify(e, (e, t) => typeof t == "bigint" ? t.toString() : t);
3252
3338
  }
3253
- function no(e) {
3339
+ function uo(e) {
3254
3340
  if (typeof e != "object" || !e) return;
3255
3341
  let t = e, n = t.snapshot, r = (t.context ?? n?.context)?.publishRunId;
3256
3342
  return typeof r == "string" && r.length > 0 ? r : void 0;
3257
3343
  }
3258
- function ro(e) {
3344
+ function fo(e) {
3259
3345
  if (e instanceof Error) return e.message;
3260
3346
  if (typeof e == "object") {
3261
3347
  let t = e.message;
@@ -3263,21 +3349,21 @@ function ro(e) {
3263
3349
  }
3264
3350
  return String(e);
3265
3351
  }
3266
- function io(e) {
3352
+ function po(e) {
3267
3353
  if (typeof e != "object" || !e) return;
3268
3354
  let t = e.code;
3269
- return typeof t == "string" && t.length > 0 ? t.slice(0, eo) : void 0;
3355
+ return typeof t == "string" && t.length > 0 ? t.slice(0, co) : void 0;
3270
3356
  }
3271
- function ao(e, t) {
3357
+ function mo(e, t) {
3272
3358
  if (!e?.error || t !== "failed" && t !== "in_progress") return {};
3273
- let n = e.error, r = ro(n)?.slice(0, Qa), i = e.errorStep, a = io(n), o;
3274
- if (n instanceof Error && n.stack) o = n.stack.slice(0, $a);
3359
+ let n = e.error, r = fo(n)?.slice(0, oo), i = e.errorStep, a = po(n), o;
3360
+ if (n instanceof Error && n.stack) o = n.stack.slice(0, so);
3275
3361
  else if (typeof n == "object" && n) try {
3276
- o = JSON.stringify(n).slice(0, $a);
3362
+ o = JSON.stringify(n).slice(0, so);
3277
3363
  } catch {
3278
- o = String(n).slice(0, $a);
3364
+ o = String(n).slice(0, so);
3279
3365
  }
3280
- else n != null && (o = String(n).slice(0, $a));
3366
+ else n != null && (o = String(n).slice(0, so));
3281
3367
  return {
3282
3368
  ...r === void 0 ? {} : { errorMessage: r },
3283
3369
  errorStep: i,
@@ -3285,14 +3371,14 @@ function ao(e, t) {
3285
3371
  errorCode: a ?? null
3286
3372
  };
3287
3373
  }
3288
- function oo(e) {
3289
- return Ya(e, async () => {
3374
+ function ho(e) {
3375
+ return ro(e, async () => {
3290
3376
  let t = A.getAppDb();
3291
3377
  if (!t) {
3292
- qa("markInProgressPublishInterrupted: DB not ready, skipping");
3378
+ to("markInProgressPublishInterrupted: DB not ready, skipping");
3293
3379
  return;
3294
3380
  }
3295
- let n = await t.select().from(N).where(Rt(z(N.seedLocalId, e), z(N.status, "in_progress"))).orderBy(zt(N.updatedAt)).limit(1);
3381
+ let n = await t.select().from(N).where(Vt(z(N.seedLocalId, e), z(N.status, "in_progress"))).orderBy(Ht(N.updatedAt)).limit(1);
3296
3382
  if (n.length === 0) return;
3297
3383
  let r = Date.now();
3298
3384
  await t.update(N).set({
@@ -3306,20 +3392,20 @@ function oo(e) {
3306
3392
  }).where(z(N.id, n[0].id));
3307
3393
  });
3308
3394
  }
3309
- var so = It(({ sendBack: e, input: { persistedSnapshot: t, seedLocalId: n, triggerPublishDone: r } }) => {
3310
- qa("savePublish seedLocalId", n);
3395
+ var go = zt(({ sendBack: e, input: { persistedSnapshot: t, seedLocalId: n, triggerPublishDone: r } }) => {
3396
+ to("savePublish seedLocalId", n);
3311
3397
  let i = t;
3312
- Ya(n, async () => {
3398
+ ro(n, async () => {
3313
3399
  let a = A.getAppDb();
3314
3400
  if (!a) {
3315
- qa("savePublish: DB not ready, skipping"), e({
3401
+ to("savePublish: DB not ready, skipping"), e({
3316
3402
  type: "SAVE_PUBLISH_DONE",
3317
3403
  seedLocalId: n,
3318
3404
  triggerPublishDone: r
3319
3405
  });
3320
3406
  return;
3321
3407
  }
3322
- let o = await a.select().from(N).where(Rt(z(N.seedLocalId, n), z(N.status, "in_progress"))).orderBy(zt(N.updatedAt)).limit(1), s = typeof t == "string" ? t : to(t), c = Za(i), l = Date.now(), u = ao(i.context, c);
3408
+ let o = await a.select().from(N).where(Vt(z(N.seedLocalId, n), z(N.status, "in_progress"))).orderBy(Ht(N.updatedAt)).limit(1), s = typeof t == "string" ? t : lo(t), c = ao(i), l = Date.now(), u = mo(i.context, c);
3323
3409
  if (o.length > 0) {
3324
3410
  let e = o[0];
3325
3411
  await a.update(N).set({
@@ -3330,12 +3416,12 @@ var so = It(({ sendBack: e, input: { persistedSnapshot: t, seedLocalId: n, trigg
3330
3416
  ...u
3331
3417
  }).where(z(N.id, e.id));
3332
3418
  } else {
3333
- let e = no(i);
3419
+ let e = uo(i);
3334
3420
  if (e != null && c === "in_progress" && i.status !== "done") {
3335
- let t = (await a.select().from(N).where(z(N.seedLocalId, n)).orderBy(zt(N.startedAt)).limit(1))[0];
3336
- if (t && Xa(t.status)) try {
3337
- if (no(JSON.parse(t.persistedSnapshot)) === e) {
3338
- qa("savePublish: skip stale insert — same publishRunId as latest terminal row", n, e);
3421
+ let t = (await a.select().from(N).where(z(N.seedLocalId, n)).orderBy(Ht(N.startedAt)).limit(1))[0];
3422
+ if (t && io(t.status)) try {
3423
+ if (uo(JSON.parse(t.persistedSnapshot)) === e) {
3424
+ to("savePublish: skip stale insert — same publishRunId as latest terminal row", n, e);
3339
3425
  return;
3340
3426
  }
3341
3427
  } catch {}
@@ -3360,15 +3446,15 @@ var so = It(({ sendBack: e, input: { persistedSnapshot: t, seedLocalId: n, trigg
3360
3446
  triggerPublishDone: r
3361
3447
  });
3362
3448
  }).catch((t) => {
3363
- qa("savePublish error", t), e({
3449
+ to("savePublish error", t), e({
3364
3450
  type: "SAVE_PUBLISH_DONE",
3365
3451
  seedLocalId: n,
3366
3452
  triggerPublishDone: r
3367
3453
  });
3368
3454
  });
3369
- }), co = Ft(({ context: e, event: t, enqueue: n, self: r }) => {
3455
+ }), _o = Rt(({ context: e, event: t, enqueue: n, self: r }) => {
3370
3456
  let { publishProcesses: i, subscriptions: a } = e, { seedLocalId: o } = t;
3371
- oo(o).catch((e) => {
3457
+ ho(o).catch((e) => {
3372
3458
  console.warn(`[stopPublish] Failed to mark publish_processes row interrupted for "${o}":`, e);
3373
3459
  });
3374
3460
  let s = i.get(o);
@@ -3376,9 +3462,9 @@ var so = It(({ sendBack: e, input: { persistedSnapshot: t, seedLocalId: n, trigg
3376
3462
  console.warn(`Publish process with seedLocalId "${o}" does not exist.`);
3377
3463
  return;
3378
3464
  }
3379
- Ka(r, s, n);
3465
+ eo(r, s, n);
3380
3466
  let c = a.get(o);
3381
- c && Ka(r, c, n);
3467
+ c && eo(r, c, n);
3382
3468
  let l = new Map(i);
3383
3469
  l.delete(o);
3384
3470
  let u = new Map(a);
@@ -3386,16 +3472,16 @@ var so = It(({ sendBack: e, input: { persistedSnapshot: t, seedLocalId: n, trigg
3386
3472
  publishProcesses: l,
3387
3473
  subscriptions: u
3388
3474
  });
3389
- }), lo = R("seedProtocol:PublishManager:index"), uo = Ft(({ context: e, enqueue: t, self: n }) => {
3390
- lo("Stopping all actors..."), e.publishProcesses.forEach((e) => {
3391
- Ka(n, e, t);
3475
+ }), vo = R("seedProtocol:PublishManager:index"), yo = Rt(({ context: e, enqueue: t, self: n }) => {
3476
+ vo("Stopping all actors..."), e.publishProcesses.forEach((e) => {
3477
+ eo(n, e, t);
3392
3478
  }), e.subscriptions.forEach((e) => {
3393
- Ka(n, e, t);
3479
+ eo(n, e, t);
3394
3480
  }), t.assign({
3395
3481
  publishProcesses: /* @__PURE__ */ new Map(),
3396
3482
  subscriptions: /* @__PURE__ */ new Map()
3397
3483
  });
3398
- }), fo = Ft(({ context: e, event: t, enqueue: n }) => {
3484
+ }), bo = Rt(({ context: e, event: t, enqueue: n }) => {
3399
3485
  let { seedLocalId: r } = t, i = e.publishProcesses.get(r);
3400
3486
  if (!i) {
3401
3487
  console.warn(`Publish process with seedLocalId "${r}" does not exist.`);
@@ -3411,35 +3497,35 @@ var so = It(({ sendBack: e, input: { persistedSnapshot: t, seedLocalId: n, trigg
3411
3497
  publishProcesses: o,
3412
3498
  subscriptions: s
3413
3499
  });
3414
- }), po = I(({ context: e, event: t }) => {
3500
+ }), xo = I(({ context: e, event: t }) => {
3415
3501
  let { subscriptions: n } = e, { seedLocalId: r, newSubscription: i } = t;
3416
3502
  return i && n.set(r, i), { subscriptions: new Map(n) };
3417
- }), mo = ["signedDataItems", "arweaveUploadData"];
3418
- function ho(e) {
3503
+ }), So = ["signedDataItems", "arweaveUploadData"];
3504
+ function Co(e) {
3419
3505
  if (typeof e != "object" || !e) return e;
3420
3506
  let t = { ...e };
3421
- for (let e of mo) delete t[e];
3507
+ for (let e of So) delete t[e];
3422
3508
  return t;
3423
3509
  }
3424
- function go(e) {
3510
+ function wo(e) {
3425
3511
  if (typeof e != "object" || !e) return e;
3426
3512
  let t = e, n = { ...t };
3427
- t.context != null && typeof t.context == "object" && (n.context = ho(t.context));
3513
+ t.context != null && typeof t.context == "object" && (n.context = Co(t.context));
3428
3514
  let r = t.snapshot;
3429
3515
  if (typeof r == "object" && r) {
3430
3516
  let e = r, t = { ...e };
3431
- e.context != null && typeof e.context == "object" && (t.context = ho(e.context)), n.snapshot = t;
3517
+ e.context != null && typeof e.context == "object" && (t.context = Co(e.context)), n.snapshot = t;
3432
3518
  }
3433
3519
  return n;
3434
3520
  }
3435
- function _o(e) {
3521
+ function To(e) {
3436
3522
  try {
3437
- return go(e.getPersistedSnapshot?.() ?? e.getSnapshot());
3523
+ return wo(e.getPersistedSnapshot?.() ?? e.getSnapshot());
3438
3524
  } catch {
3439
3525
  let t = e.getSnapshot(), n = t.context;
3440
- if (!n?.item) return go(t);
3526
+ if (!n?.item) return wo(t);
3441
3527
  let r = n.item;
3442
- return go({
3528
+ return wo({
3443
3529
  ...t,
3444
3530
  context: {
3445
3531
  ...n,
@@ -3452,13 +3538,13 @@ function _o(e) {
3452
3538
  });
3453
3539
  }
3454
3540
  }
3455
- var vo = I(({ context: e, event: t, spawn: n }) => {
3541
+ var Eo = I(({ context: e, event: t, spawn: n }) => {
3456
3542
  let { publishProcesses: r } = e, { seedLocalId: i, publishProcess: a, triggerPublishDone: o } = t;
3457
3543
  if (!a) return e;
3458
3544
  let s = new Map(r);
3459
3545
  s.set(i, a);
3460
- let c = _o(a);
3461
- return n(so, {
3546
+ let c = To(a);
3547
+ return n(go, {
3462
3548
  id: `savePublish_${i}_${Date.now()}`,
3463
3549
  input: {
3464
3550
  persistedSnapshot: c,
@@ -3466,7 +3552,7 @@ var vo = I(({ context: e, event: t, spawn: n }) => {
3466
3552
  triggerPublishDone: o
3467
3553
  }
3468
3554
  }), { publishProcesses: s };
3469
- }), yo = I(({ context: e, event: t }) => {
3555
+ }), Do = I(({ context: e, event: t }) => {
3470
3556
  let { publishProcesses: n, subscriptions: r, settledPublishes: i } = e, a = t.seedLocalId, o = r.get(a);
3471
3557
  o && o.send({ type: "UNSUBSCRIBE" });
3472
3558
  let s = n.get(a), c = new Map(n);
@@ -3479,17 +3565,17 @@ var vo = I(({ context: e, event: t, spawn: n }) => {
3479
3565
  subscriptions: l,
3480
3566
  settledPublishes: u
3481
3567
  };
3482
- }), bo = I(({ context: e, event: t }) => {
3568
+ }), Oo = I(({ context: e, event: t }) => {
3483
3569
  let { subscriptions: n } = e, r = t.seedLocalId, i = new Map(n);
3484
3570
  return i.delete(r), { subscriptions: i };
3485
- }), xo = 6e4, So = 2e3;
3486
- function Co(e, t) {
3571
+ }), ko = 6e4, Ao = 2e3;
3572
+ function jo(e, t) {
3487
3573
  let n = typeof process < "u" ? process.env[e] : void 0;
3488
3574
  if (n == null || n === "") return t;
3489
3575
  let r = Number(n);
3490
3576
  return Number.isFinite(r) && r >= 0 ? r : t;
3491
3577
  }
3492
- async function wo(e, t) {
3578
+ async function Mo(e, t) {
3493
3579
  let n = Date.now() + e;
3494
3580
  for (; Date.now() < n;) {
3495
3581
  try {
@@ -3499,12 +3585,12 @@ async function wo(e, t) {
3499
3585
  }
3500
3586
  return !1;
3501
3587
  }
3502
- function To(e) {
3588
+ function No(e) {
3503
3589
  let t = e.value;
3504
3590
  return typeof t == "string" ? t : t && typeof t == "object" ? Object.keys(t)[0] ?? "" : "";
3505
3591
  }
3506
- function Eo(e) {
3507
- let t = To(e);
3592
+ function Po(e) {
3593
+ let t = No(e);
3508
3594
  if (t === "pollingForConfirmation" && (!e.context?.reimbursementTransactionId || !e.context?.requestResponse)) return !1;
3509
3595
  if (t === "uploadingData") {
3510
3596
  let t = e.context?.arweaveTransactions, n = e.context?.publishUploads;
@@ -3512,13 +3598,13 @@ function Eo(e) {
3512
3598
  }
3513
3599
  return !0;
3514
3600
  }
3515
- function Do(e) {
3601
+ function Fo(e) {
3516
3602
  return typeof e == "object" && !!e && "xstate$$type" in e && e.xstate$$type === 1 && typeof e.id == "string";
3517
3603
  }
3518
- function Oo(e, t, n) {
3604
+ function Io(e, t, n) {
3519
3605
  e.context = e.context ?? {};
3520
3606
  let r = e.context.item;
3521
- if (Do(r)) {
3607
+ if (Fo(r)) {
3522
3608
  e.context.item = {
3523
3609
  seedLocalId: t,
3524
3610
  modelName: e.context.modelName ?? n.modelName ?? "",
@@ -3533,10 +3619,10 @@ function Oo(e, t, n) {
3533
3619
  schemaId: r?.schemaId ?? e.context.schemaId ?? n.schemaId ?? void 0
3534
3620
  };
3535
3621
  }
3536
- var ko = It(({ sendBack: e, input: { context: t } }) => {
3622
+ var Lo = zt(({ sendBack: e, input: { context: t } }) => {
3537
3623
  let n = async () => {
3538
3624
  let e = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Map();
3539
- if (!await wo(Co("SEED_PUBLISH_RESTORE_WAIT_MS", xo), Co("SEED_PUBLISH_RESTORE_POLL_MS", So))) return {
3625
+ if (!await Mo(jo("SEED_PUBLISH_RESTORE_WAIT_MS", ko), jo("SEED_PUBLISH_RESTORE_POLL_MS", Ao))) return {
3540
3626
  newPublishProcesses: e,
3541
3627
  newSubscriptions: t
3542
3628
  };
@@ -3557,12 +3643,12 @@ var ko = It(({ sendBack: e, input: { context: t } }) => {
3557
3643
  }
3558
3644
  if (r.status === "done") continue;
3559
3645
  let i = r.context?.item?.seedLocalId ?? n.seedLocalId;
3560
- if (!i || !Eo(r)) continue;
3561
- Oo(r, i, n);
3562
- let a = Pt(ka, {
3646
+ if (!i || !Po(r)) continue;
3647
+ Io(r, i, n);
3648
+ let a = Lt(La, {
3563
3649
  snapshot: r,
3564
3650
  input: void 0
3565
- }), o = Pt(La, { input: {
3651
+ }), o = Lt(Ga, { input: {
3566
3652
  publishProcess: a,
3567
3653
  seedLocalId: i
3568
3654
  } });
@@ -3591,32 +3677,32 @@ var ko = It(({ sendBack: e, input: { context: t } }) => {
3591
3677
  subscriptions: n
3592
3678
  });
3593
3679
  });
3594
- }), Ao = I(({ context: e, event: t }) => ({ pendingCreates: [...e.pendingCreates ?? [], t] })), jo = Ft(({ context: e, enqueue: t }) => {
3680
+ }), Ro = I(({ context: e, event: t }) => ({ pendingCreates: [...e.pendingCreates ?? [], t] })), zo = Rt(({ context: e, enqueue: t }) => {
3595
3681
  let n = e.pendingCreates ?? [];
3596
3682
  if (n.length !== 0) {
3597
3683
  t.assign({ pendingCreates: [] });
3598
3684
  for (let e of n) t.raise(e);
3599
3685
  }
3600
- }), Mo = R("seedProtocol:PublishManager:index"), No = Lt({
3686
+ }), Bo = R("seedProtocol:PublishManager:index"), Vo = Bt({
3601
3687
  types: {
3602
3688
  context: {},
3603
3689
  input: {},
3604
3690
  events: {}
3605
3691
  },
3606
- actors: { restoreFromDb: ko },
3692
+ actors: { restoreFromDb: Lo },
3607
3693
  actions: {
3608
- assignRestoreFromDb: Aa,
3609
- createPublish: Wa,
3610
- queueCreatePublish: Ao,
3611
- drainPendingCreates: jo,
3612
- addSubscription: po,
3613
- requestSavePublish: vo,
3614
- publishDone: yo,
3615
- removeSubscription: bo,
3616
- retryAttestations: Ga,
3617
- stopPublish: co,
3618
- stopAll: uo,
3619
- query: fo
3694
+ assignRestoreFromDb: Ra,
3695
+ createPublish: Qa,
3696
+ queueCreatePublish: Ro,
3697
+ drainPendingCreates: zo,
3698
+ addSubscription: xo,
3699
+ requestSavePublish: Eo,
3700
+ publishDone: Do,
3701
+ removeSubscription: Oo,
3702
+ retryAttestations: $a,
3703
+ stopPublish: _o,
3704
+ stopAll: yo,
3705
+ query: bo
3620
3706
  }
3621
3707
  }).createMachine({
3622
3708
  id: "publishManager",
@@ -3660,24 +3746,24 @@ var ko = It(({ sendBack: e, input: { context: t } }) => {
3660
3746
  }
3661
3747
  }
3662
3748
  }
3663
- }), $ = Pt(No, { input: {
3749
+ }), $ = Lt(Vo, { input: {
3664
3750
  publishProcesses: /* @__PURE__ */ new Map(),
3665
3751
  subscriptions: /* @__PURE__ */ new Map(),
3666
3752
  pendingCreates: [],
3667
3753
  settledPublishes: /* @__PURE__ */ new Map()
3668
- } }), Po = !1;
3669
- function Fo() {
3670
- if (!Po) {
3754
+ } }), Ho = !1;
3755
+ function Uo() {
3756
+ if (!Ho) {
3671
3757
  try {
3672
3758
  $.start();
3673
3759
  } catch (e) {
3674
3760
  let t = e instanceof Error ? e.message : String(e);
3675
3761
  if (!/already started/i.test(t)) throw e;
3676
3762
  }
3677
- Po = !0;
3763
+ Ho = !0;
3678
3764
  }
3679
3765
  }
3680
- Ma({
3766
+ Ba({
3681
3767
  savePublish: (e, t, n) => {
3682
3768
  $.send({
3683
3769
  type: "REQUEST_SAVE_PUBLISH",
@@ -3699,24 +3785,24 @@ Ma({
3699
3785
  });
3700
3786
  }
3701
3787
  });
3702
- var Io = $.subscribe((e) => {
3703
- Mo("PublishManager snapshot:", e);
3788
+ var Wo = $.subscribe((e) => {
3789
+ Bo("PublishManager snapshot:", e);
3704
3790
  });
3705
- typeof document < "u" && (Fo(), window.addEventListener("load", () => {
3706
- Mo("PublishManager started");
3791
+ typeof document < "u" && (Uo(), window.addEventListener("load", () => {
3792
+ Bo("PublishManager started");
3707
3793
  }), window.addEventListener("beforeunload", () => {
3708
- Io.unsubscribe(), $.stop();
3794
+ Wo.unsubscribe(), $.stop();
3709
3795
  }));
3710
- var Lo = {
3796
+ var Go = {
3711
3797
  getService: () => $,
3712
- ready: () => (Fo(), $.getSnapshot().value === "active" ? Promise.resolve() : new Promise((e) => {
3798
+ ready: () => (Uo(), $.getSnapshot().value === "active" ? Promise.resolve() : new Promise((e) => {
3713
3799
  let t = $.subscribe((n) => {
3714
3800
  n.value === "active" && (t.unsubscribe(), e());
3715
3801
  });
3716
3802
  $.getSnapshot().value === "active" && (t.unsubscribe(), e());
3717
3803
  })),
3718
3804
  createPublish: (e, t, n, r) => new Promise((i) => {
3719
- let a = Ba(i);
3805
+ let a = Ja(i);
3720
3806
  $.send({
3721
3807
  type: "CREATE_PUBLISH",
3722
3808
  item: e,
@@ -3761,26 +3847,26 @@ var Lo = {
3761
3847
  };
3762
3848
  //#endregion
3763
3849
  //#region src/helpers/approvedTargetsForAutomationPublish.ts
3764
- function Ro() {
3765
- let e = E().modularAccountModuleContract?.trim();
3850
+ function Ko() {
3851
+ let e = T().modularAccountModuleContract?.trim();
3766
3852
  if (!e || !/^0x[0-9a-fA-F]{40}$/.test(e)) throw Error("@seedprotocol/publish: session keys require PublishConfig.modularAccountModuleContract (their only approved target is the Seed executor module).");
3767
3853
  return [e.toLowerCase()];
3768
3854
  }
3769
3855
  //#endregion
3770
3856
  //#region src/helpers/automationSessionKeyPermissions.ts
3771
- var zo = "publish,revoke";
3772
- function Bo(e) {
3857
+ var qo = "publish,revoke";
3858
+ function Jo(e) {
3773
3859
  let t = {
3774
- approvedTargets: Ro(),
3860
+ approvedTargets: Ko(),
3775
3861
  nativeTokenLimitPerTransaction: 0
3776
3862
  };
3777
3863
  return typeof e?.expiresAt == "number" && e.expiresAt > 0 && (t.expiresAt = Math.trunc(e.expiresAt)), t;
3778
3864
  }
3779
- function Vo(e, t = zo) {
3865
+ function Yo(e, t = qo) {
3780
3866
  let n = `${[...e.approvedTargets].map((e) => e.toLowerCase()).sort().join(",")}|${e.nativeTokenLimitPerTransaction}|${e.expiresAt ?? 0}|${t.trim()}`;
3781
- return lt(ut(n));
3867
+ return ft(pt(n));
3782
3868
  }
3783
- function Ho(e) {
3869
+ function Xo(e) {
3784
3870
  let t = {
3785
3871
  approvedTargets: e.approvedTargets,
3786
3872
  nativeTokenLimitPerTransaction: e.nativeTokenLimitPerTransaction
@@ -3792,37 +3878,37 @@ function Ho(e) {
3792
3878
  }
3793
3879
  //#endregion
3794
3880
  //#region src/services/publishAuthorization/index.ts
3795
- var Uo = "0x0000000000000000000000000000000000000000", Wo = !0, Go = "0x0000000000000000000000000000000000000000";
3796
- function Ko(e) {
3797
- if (m(e)) return e.txSender;
3798
- if (n(e)) return e;
3881
+ var Zo = "0x0000000000000000000000000000000000000000", Qo = !0, $o = "0x0000000000000000000000000000000000000000";
3882
+ function es(e) {
3883
+ if (i(e)) return e.txSender;
3884
+ if (_e(e)) return e;
3799
3885
  throw Error("@seedprotocol/publish: publish authorization write APIs require a PublishWallet or SeedTxSender");
3800
3886
  }
3801
- async function qo(e, t) {
3887
+ async function ts(e, t) {
3802
3888
  let n = await e.sendTransaction(t);
3803
3889
  return C(n.transactionHash);
3804
3890
  }
3805
- function Jo(e, t) {
3891
+ function ns(e, t) {
3806
3892
  let n = t.trim();
3807
3893
  if (!/^0x[0-9a-fA-F]{40}$/.test(n)) throw Error(`@seedprotocol/publish: ${e} must be a valid address`);
3808
3894
  return n;
3809
3895
  }
3810
- function Yo() {
3811
- return jt.getSchemaUID(ft, Uo, Wo);
3896
+ function rs() {
3897
+ return Pt.getSchemaUID(ht, Zo, Qo);
3812
3898
  }
3813
- async function Xo(e) {
3814
- let t = Ko(e), n = Yo();
3815
- return await V(n) || (await qo(t, an({
3816
- schema: ft,
3817
- resolverAddress: Uo,
3818
- revocable: Wo
3819
- })), await qo(t, sn({
3899
+ async function is(e) {
3900
+ let t = es(e), n = rs();
3901
+ return await V(n) || (await ts(t, cn({
3902
+ schema: ht,
3903
+ resolverAddress: Zo,
3904
+ revocable: Qo
3905
+ })), await ts(t, un({
3820
3906
  schemaUid: n,
3821
- schemaName: mt
3907
+ schemaName: _t
3822
3908
  }))), n;
3823
3909
  }
3824
- function Zo(e) {
3825
- return new At(ft).encodeData([
3910
+ function as(e) {
3911
+ return new Nt(ht).encodeData([
3826
3912
  {
3827
3913
  name: "identity",
3828
3914
  value: e.identity,
@@ -3855,64 +3941,64 @@ function Zo(e) {
3855
3941
  },
3856
3942
  {
3857
3943
  name: "permissionsHash",
3858
- value: St(e.permissionsHash),
3944
+ value: Tt(e.permissionsHash),
3859
3945
  type: "bytes32"
3860
3946
  }
3861
3947
  ]);
3862
3948
  }
3863
- async function Qo(e) {
3864
- let t = Ko(e.wallet), n = e.ensureSchema === !1 ? Yo() : await Xo(e.wallet), r = Jo("identity", e.identity), i = Jo("sessionKey", e.sessionKey), a = e.app?.trim() ? Jo("app", e.app) : Go, s = e.grantedAt ?? Math.floor(Date.now() / 1e3), c = typeof e.expiresAt == "number" && e.expiresAt > 0 ? Math.trunc(e.expiresAt) : 0, l = e.scopes ?? gt, u = St(e.permissionsHash ?? Vo(Bo({ expiresAt: c > 0 ? c : void 0 }), l === gt ? "publish,revoke" : l));
3865
- if (u === Nt) throw Error("@seedprotocol/publish: attestPublishAuthorization requires a non-zero permissionsHash");
3866
- let f = typeof e.expirationTime == "number" && e.expirationTime > 0 ? e.expirationTime : c > 0 ? c : s + dt, p = Zo({
3949
+ async function os(e) {
3950
+ let t = es(e.wallet), n = e.ensureSchema === !1 ? rs() : await is(e.wallet), r = ns("identity", e.identity), i = ns("sessionKey", e.sessionKey), a = e.app?.trim() ? ns("app", e.app) : $o, o = e.grantedAt ?? Math.floor(Date.now() / 1e3), s = typeof e.expiresAt == "number" && e.expiresAt > 0 ? Math.trunc(e.expiresAt) : 0, c = e.scopes ?? yt, l = Tt(e.permissionsHash ?? Yo(Jo({ expiresAt: s > 0 ? s : void 0 }), c === yt ? "publish,revoke" : c));
3951
+ if (l === It) throw Error("@seedprotocol/publish: attestPublishAuthorization requires a non-zero permissionsHash");
3952
+ let d = typeof e.expirationTime == "number" && e.expirationTime > 0 ? e.expirationTime : s > 0 ? s : o + mt, f = as({
3867
3953
  identity: r,
3868
3954
  sessionKey: i,
3869
3955
  app: a,
3870
- scopes: l,
3871
- grantedAt: s,
3872
- expiresAt: c,
3873
- permissionsHash: u
3874
- }), m = await qo(t, o({
3956
+ scopes: c,
3957
+ grantedAt: o,
3958
+ expiresAt: s,
3959
+ permissionsHash: l
3960
+ }), p = await ts(t, v({
3875
3961
  schema: n,
3876
3962
  data: {
3877
3963
  recipient: i,
3878
- expirationTime: BigInt(f),
3964
+ expirationTime: BigInt(d),
3879
3965
  revocable: !0,
3880
- refUID: Nt,
3881
- data: p,
3966
+ refUID: It,
3967
+ data: f,
3882
3968
  value: 0n
3883
3969
  }
3884
3970
  }));
3885
- if (!m) throw Error("@seedprotocol/publish: attestPublishAuthorization failed — no receipt");
3886
- let { easContractAddress: h } = E(), g = d(m, h);
3887
- if (!g || !xt(g)) throw Error("@seedprotocol/publish: attestPublishAuthorization failed — could not parse attestation UID");
3971
+ if (!p) throw Error("@seedprotocol/publish: attestPublishAuthorization failed — no receipt");
3972
+ let { easContractAddress: m } = T(), h = u(p, m);
3973
+ if (!h || !wt(h)) throw Error("@seedprotocol/publish: attestPublishAuthorization failed — could not parse attestation UID");
3888
3974
  return {
3889
- uid: g,
3975
+ uid: h,
3890
3976
  schemaUid: n,
3891
- permissionsHash: u,
3892
- grantedAt: s,
3893
- expiresAt: c,
3894
- expirationTime: f
3977
+ permissionsHash: l,
3978
+ grantedAt: o,
3979
+ expiresAt: s,
3980
+ expirationTime: d
3895
3981
  };
3896
3982
  }
3897
- async function $o(e) {
3898
- let t = Ko(e.wallet), n = e.schemaUid ?? Yo(), r = St(e.uid);
3899
- if (!xt(r)) throw Error("@seedprotocol/publish: revokePublishAuthorization requires a valid attestation uid");
3900
- if (!await qo(t, p([{
3901
- schema: n,
3902
- data: [{ uid: r }]
3983
+ async function ss(e) {
3984
+ let t = es(e.wallet), r = e.schemaUid ?? rs(), i = Tt(e.uid);
3985
+ if (!wt(i)) throw Error("@seedprotocol/publish: revokePublishAuthorization requires a valid attestation uid");
3986
+ if (!await ts(t, n([{
3987
+ schema: r,
3988
+ data: [{ uid: i }]
3903
3989
  }]))) throw Error("@seedprotocol/publish: revokePublishAuthorization failed — no receipt");
3904
3990
  }
3905
- async function es(e) {
3906
- let t = (await bt({
3991
+ async function cs(e) {
3992
+ let t = (await Ct({
3907
3993
  identities: e.identities,
3908
3994
  excludeRevoked: !1
3909
3995
  })).find((t) => t.id?.toLowerCase() === e.uid.toLowerCase());
3910
3996
  if (!t) return null;
3911
- let n = yt(t.decodedDataJson ?? "[]"), r = typeof t.expirationTime == "number" ? t.expirationTime : typeof t.expirationTime == "string" ? Number(t.expirationTime) : null;
3997
+ let n = St(t.decodedDataJson ?? "[]"), r = typeof t.expirationTime == "number" ? t.expirationTime : typeof t.expirationTime == "string" ? Number(t.expirationTime) : null;
3912
3998
  return {
3913
3999
  uid: t.id,
3914
4000
  decoded: n,
3915
- assess: vt({
4001
+ assess: xt({
3916
4002
  decoded: n,
3917
4003
  expirationTime: r
3918
4004
  }),
@@ -3920,6 +4006,6 @@ async function es(e) {
3920
4006
  };
3921
4007
  }
3922
4008
  //#endregion
3923
- export { Gt as $, Kr as A, Nr as B, pi as C, Wr as D, Gr as E, Rr as F, Wn as G, Lr as H, ti as I, sn as J, or as K, zr as L, Qr as M, ei as N, Ur as O, Mr as P, $t as Q, Br as R, mi as S, Hr as T, Ir as U, Or as V, Fr as W, an as X, V as Y, B as Z, ea as _, Qo as a, Ci as b, Yo as c, Bo as d, Kt as et, Vo as f, ka as g, Lo as h, es as i, Jr as j, qr as k, $o as l, Ro as m, ht as n, Zo as o, Ho as p, vn as q, _t as r, Xo as s, pt as t, zo as u, ta as v, ri as w, li as x, xi as y, Vr as z };
4009
+ export { B as $, Qr as A, zr as B, mi as C, Xr as D, Zr as E, Wr as F, jr as G, Ur as H, si as I, lr as J, Nr as K, Gr as L, ii as M, oi as N, Yr as O, Rr as P, cn as Q, Kr as R, vi as S, Jr as T, Hr as U, Pr as V, Vr as W, un as X, xn as Y, V as Z, ca as _, os as a, ji as b, rs as c, Jo as d, nn as et, Yo as f, La as g, Go as h, cs as i, ei as j, $r as k, ss as l, Ko as m, vt as n, Yt as nt, as as o, Xo as p, qn as q, bt as r, is as s, gt as t, Jt as tt, qo as u, la as v, gi as w, Ai as x, Ei as y, qr as z };
3924
4010
 
3925
- //# sourceMappingURL=publishAuthorization-CxBkijU6.js.map
4011
+ //# sourceMappingURL=publishAuthorization-DgDI4zor.js.map