@seedprotocol/publish 0.6.9 → 0.7.0

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