@abtnode/blocklet-services 1.16.44-beta-20250513-030435-c2d99062 → 1.16.44-beta-20250518-020443-77ba168f

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 (264) hide show
  1. package/api/index.js +3 -1
  2. package/api/libs/connect/session.js +22 -9
  3. package/api/libs/image.js +1 -2
  4. package/api/libs/open-graph/index.js +1 -2
  5. package/api/libs/push-kit/index.js +1 -0
  6. package/api/middlewares/check-federated-cors-call.js +2 -2
  7. package/api/middlewares/check-permission.js +10 -3
  8. package/api/routes/blocklet.js +1 -1
  9. package/api/routes/csp-proxy.js +67 -0
  10. package/api/routes/federated.js +30 -25
  11. package/api/routes/oauth/client.js +2 -2
  12. package/api/routes/openembed.js +1 -1
  13. package/api/routes/user-session.js +1 -2
  14. package/api/routes/user.js +9 -6
  15. package/api/services/auth/connect/connect-to-did-spaces-for-user.js +1 -1
  16. package/api/services/auth/connect/pre-setup.js +2 -1
  17. package/api/services/auth/connect/setup.js +31 -4
  18. package/api/services/image/index.js +1 -1
  19. package/api/services/notification/queue.js +27 -4
  20. package/api/socket/channel/did.js +14 -7
  21. package/api/util/federated.js +5 -1
  22. package/api/util/index.js +6 -0
  23. package/api/util/user-util.js +1 -1
  24. package/dist/assets/{AdapterDayjs-BD9H1lZ-.js → AdapterDayjs-YbaNvT9I.js} +1 -1
  25. package/dist/assets/{ArrowDropDown-BrO-zDlb.js → ArrowDropDown-xgs4N3Rf.js} +1 -1
  26. package/dist/assets/{CheckCircle-Ds4QI0ey.js → CheckCircle-JXD6tKIa.js} +1 -1
  27. package/dist/assets/{ChevronLeft-CnQaQ-rc.js → ChevronLeft-D0eko_T8.js} +1 -1
  28. package/dist/assets/{ChevronRight-a_2_x6Ew.js → ChevronRight-CQY9Ni7X.js} +1 -1
  29. package/dist/assets/{Community-DW6DJTIs.js → Community-BCL2L7ib.js} +1 -1
  30. package/dist/assets/{DeleteOutline-CFN4r-OG.js → DeleteOutline-BEGOj_wq.js} +1 -1
  31. package/dist/assets/{Done-DqSE6KPe.js → Done-BUJJNjlP.js} +1 -1
  32. package/dist/assets/{Download-C_LRKzbG.js → Download-DdZEsxmZ.js} +1 -1
  33. package/dist/assets/{Edit-CbR4eoK8.js → Edit-vxeVwrqO.js} +1 -1
  34. package/dist/assets/{EditIcon-DxUWMw59.js → EditIcon-Dffk7mPL.js} +1 -1
  35. package/dist/assets/{Email-DWueGk7t.js → Email-CdSNK0eA.js} +1 -1
  36. package/dist/assets/{Error-jEHdDLNk.js → Error-C-RD4e9g.js} +1 -1
  37. package/dist/assets/{ExpandLess-CkoEHpgk.js → ExpandLess-CmqG9SE7.js} +1 -1
  38. package/dist/assets/{Google-DHEolkW-.js → Google-B7PA4qF8.js} +1 -1
  39. package/dist/assets/{Holiday-Dwvo6QkZ.js → Holiday-enHMZqEf.js} +1 -1
  40. package/dist/assets/{InfoOutlined-DkG0jjos.js → InfoOutlined-BIr5nkjV.js} +1 -1
  41. package/dist/assets/{Launch-B-2Jomi6.js → Launch-KvZQI_SA.js} +1 -1
  42. package/dist/assets/{LaunchOutlined-CXNijfqX.js → LaunchOutlined-ClxZU_tj.js} +1 -1
  43. package/dist/assets/{Location-DUEOr9J2.js → Location-By12Z3Te.js} +1 -1
  44. package/dist/assets/{LockIcon-Cjg8jV1E.js → LockIcon-98CKEIBe.js} +1 -1
  45. package/dist/assets/{Meeting-CJaI_cKm.js → Meeting-CLeFWDkY.js} +1 -1
  46. package/dist/assets/{MoreHoriz-B6KdR0Y8.js → MoreHoriz-H8rabTmY.js} +1 -1
  47. package/dist/assets/{OffSick-C9VqqjrN.js → OffSick-dUm363rs.js} +1 -1
  48. package/dist/assets/{Phone-DcHUzCa-.js → Phone--BSu-btI.js} +1 -1
  49. package/dist/assets/{PlayArrow-BToG9L6q.js → PlayArrow-CmxnItFZ.js} +1 -1
  50. package/dist/assets/{QuestionMarkCircle-BPVDAm8U.js → QuestionMarkCircle-DTf-Tya5.js} +1 -1
  51. package/dist/assets/{ServerLogo-s6cfhx92.js → ServerLogo-CEsILJl5.js} +1 -1
  52. package/dist/assets/{Timezone-B-Ho_Uno.js → Timezone-YZ0dMUEr.js} +1 -1
  53. package/dist/assets/{TuneOutlined-BR2H7Mxj.js → TuneOutlined-DmhFMgM-.js} +1 -1
  54. package/dist/assets/{ViewList-D8vtMKQz.js → ViewList-DXk3qGFU.js} +1 -1
  55. package/dist/assets/{WorkingRemotely-lJ6DUMCR.js → WorkingRemotely-BX7rgbEY.js} +1 -1
  56. package/dist/assets/{access-control-Din7doVd.js → access-control-DupKwlXi.js} +1 -1
  57. package/dist/assets/{actions-BjTeIzgS.js → actions-V9hjjowb.js} +1 -1
  58. package/dist/assets/{add-component-core-5x4gTem5.js → add-component-core-hWyA0oyr.js} +16 -16
  59. package/dist/assets/add-resource-BE6wXeqY.js +1 -0
  60. package/dist/assets/addon-DtaZ0TB3.js +14 -0
  61. package/dist/assets/{advanced-CN6mCSES.js → advanced-EG10mbK7.js} +1 -1
  62. package/dist/assets/appearance-Czknho-C.js +1 -0
  63. package/dist/assets/ar-2yn9i2dw.js +7 -0
  64. package/dist/assets/audit-logs-WqpwTrlM.js +35 -0
  65. package/dist/assets/{authorize-D2LCmekq.js → authorize-DEmcifx9.js} +1 -1
  66. package/dist/assets/{base32-_zEVBJUg.js → base32-BPfgmw66.js} +1 -1
  67. package/dist/assets/blocklet-default-logo-Bspnu_ws.png +0 -0
  68. package/dist/assets/{branding-CwhhJRKu.js → branding-CJx0esf8.js} +2 -2
  69. package/dist/assets/{branding-B6AmOMI6.js → branding-DFhJVvNX.js} +2 -2
  70. package/dist/assets/{bundle-avatar-CDJRatFg.js → bundle-avatar-BbIyJr7P.js} +1 -1
  71. package/dist/assets/button-m03GMAJs.js +1 -0
  72. package/dist/assets/click-to-copy-DmYkL7Ui.js +1 -0
  73. package/dist/assets/{collapse-QV_2gdtM.js → collapse-FsvH0gRe.js} +1 -1
  74. package/dist/assets/complete-C834qh46.js +39 -0
  75. package/dist/assets/{component-Cb3m5qUw.js → component-BK7TQ5JB.js} +8 -8
  76. package/dist/assets/{config-kGXJEkFJ.js → config-Cc-40NNR.js} +2 -2
  77. package/dist/assets/{config-LE_EJolF.js → config-Dl_53WnU.js} +1 -1
  78. package/dist/assets/{config-navigation-CKVyFhfH.js → config-navigation-DH93rn-r.js} +3 -3
  79. package/dist/assets/config-space-CxEu1ku3.js +1 -0
  80. package/dist/assets/confirm-DFwkkng7.js +7 -0
  81. package/dist/assets/{connect-HAC-YfHh.js → connect-CX2tLgwf.js} +1 -1
  82. package/dist/assets/{connect-BMn4CxDk.js → connect-tnlrEGOa.js} +1 -1
  83. package/dist/assets/connect-to-jqzhxL2-.js +1 -0
  84. package/dist/assets/{content-layout-BzF-fNQz.js → content-layout--sy9JlYZ.js} +1 -1
  85. package/dist/assets/dashboard-Dc5xtJBc.js +239 -0
  86. package/dist/assets/de-CEKbJD3-.js +7 -0
  87. package/dist/assets/delete-confirm-cVLum8Er.js +1 -0
  88. package/dist/assets/{did-address-DjwPl1uy.js → did-address-BI9LYTx-.js} +1 -1
  89. package/dist/assets/domain-7fDuc1TD.js +9 -0
  90. package/dist/assets/domain-action-card-CoP_GfSR.js +28 -0
  91. package/dist/assets/domains-CGg1il1q.js +1 -0
  92. package/dist/assets/{dot-BA3EvSrh.js → dot-BB5occkV.js} +2 -2
  93. package/dist/assets/{email-CHR0EOis.js → email-9P_7A90f.js} +2 -2
  94. package/dist/assets/{empty-spinner-n0_Ehns5.js → empty-spinner-BZw_ShnT.js} +1 -1
  95. package/dist/assets/{es-BuUaHPig.js → es-dvMygD-W.js} +3 -3
  96. package/dist/assets/{exchange-passport-D0iIXJxD.js → exchange-passport-CfsGf2j7.js} +1 -1
  97. package/dist/assets/fr-BvFd5xp9.js +7 -0
  98. package/dist/assets/{fuel-nMTHNcy-.js → fuel-DOrn9jKI.js} +1 -1
  99. package/dist/assets/{gen-access-key-DH4wNzRm.js → gen-access-key-Ddbn2A92.js} +1 -1
  100. package/dist/assets/get-safe-url-BcH2iukm.js +1 -0
  101. package/dist/assets/get-safe-url-OaLLn0UN.js +1 -0
  102. package/dist/assets/hi-C51yBXa5.js +5 -0
  103. package/dist/assets/{home-DzCwBE8F.js → home-CJ28zTIJ.js} +1 -1
  104. package/dist/assets/id-B1Mq_eQI.js +7 -0
  105. package/dist/assets/{iframe-DW7zzzTG.js → iframe-D0kv9-rE.js} +1 -1
  106. package/dist/assets/index-8eXqqyHQ.js +5 -0
  107. package/dist/assets/{index-BuXc3Oag.js → index-BBKe69-Z.js} +2 -2
  108. package/dist/assets/index-BEVde8cE.js +1 -0
  109. package/dist/assets/index-BQ8PIDUu.js +99 -0
  110. package/dist/assets/index-BXdw6keY.js +1 -0
  111. package/dist/assets/{index-BDYaw77z.js → index-BdH_4Yfe.js} +1 -1
  112. package/dist/assets/{index-B_-kynzD.js → index-Bi8r1T8R.js} +17 -17
  113. package/dist/assets/{index-CIkPfxzG.js → index-BiIZw9KG.js} +58 -58
  114. package/dist/assets/index-BmR2oN4p.js +113 -0
  115. package/dist/assets/{index-BCtmnJeV.js → index-BoYbZj00.js} +18 -14
  116. package/dist/assets/index-C26jJx3Z.js +55 -0
  117. package/dist/assets/index-C2sWzOOC.js +4 -0
  118. package/dist/assets/{index-BYCeMwoO.js → index-C849wD9b.js} +1 -1
  119. package/dist/assets/{index-BLGGjT7N.js → index-CeU2W9XY.js} +8 -8
  120. package/dist/assets/{index-DcUhenm6.js → index-CmQOzzP8.js} +1 -1
  121. package/dist/assets/{index-CPfvVvHv.js → index-D-mbJPLJ.js} +12 -12
  122. package/dist/assets/{index-enM9Y412.js → index-D3iGbfL9.js} +1 -1
  123. package/dist/assets/index-DK8EXxrQ.js +6 -0
  124. package/dist/assets/index-DPmpjBeE.js +241 -0
  125. package/dist/assets/{index-B8r-LrrM.js → index-DbsXFWms.js} +1 -1
  126. package/dist/assets/{index-CxwBhS0_.js → index-DfO-sKO8.js} +1 -1
  127. package/dist/assets/{index-BIPRCLBG.js → index-DoCu_ga_.js} +2 -2
  128. package/dist/assets/{index-ftkgQlGr.js → index-DwswX2WL.js} +1 -1
  129. package/dist/assets/{index-BA8C83iz.js → index-DxVAvQEw.js} +4 -4
  130. package/dist/assets/index-d-GNQQ24.js +1 -0
  131. package/dist/assets/{invitation-DzT9Qa0A.js → invitation-DmNSx8lT.js} +4 -4
  132. package/dist/assets/invite-BRV4-5NB.js +1 -0
  133. package/dist/assets/issue-passport-DVYjG5SL.js +1 -0
  134. package/dist/assets/item-F_qGx0RW.js +2 -0
  135. package/dist/assets/ja-CCKVmbEX.js +7 -0
  136. package/dist/assets/ko-A_w8tIEg.js +7 -0
  137. package/dist/assets/{landing-page-Due4o1uF.js → landing-page-CUrvCtHZ.js} +1 -1
  138. package/dist/assets/{launch-result-message-DIYoykBK.js → launch-result-message-Eea5FZDm.js} +1 -1
  139. package/dist/assets/{layout-BcLfVSqs.js → layout-Dkaou_pj.js} +2 -2
  140. package/dist/assets/list-CUP3NH6M.js +236 -0
  141. package/dist/assets/list-Dq129hfR.js +2 -0
  142. package/dist/assets/list-header-DNFbdM3a.js +1 -0
  143. package/dist/assets/localization-Cl5vfs2R.js +1 -0
  144. package/dist/assets/{log-Iko0jLNA.js → log-C_uY3dq9.js} +2 -3
  145. package/dist/assets/logger-BYg6vYBA.js +1 -0
  146. package/dist/assets/{login-4Yq_pPSw.js → login-D8Wk5up1.js} +1 -1
  147. package/dist/assets/login-oauth-callback-DMou-vp-.js +1 -0
  148. package/dist/assets/{logo-uploader-Cnkdgyfv.js → logo-uploader-CHTXjHOW.js} +3 -3
  149. package/dist/assets/{lost-passport-D5jMtgH_.js → lost-passport-DlnOD9y-.js} +2 -2
  150. package/dist/assets/{open-window--2G6Qjbq.js → open-window-CuyFfntO.js} +1 -1
  151. package/dist/assets/overview-B451HiB6.js +85 -0
  152. package/dist/assets/{page-header-xyZktwBS.js → page-header-DpNvpd52.js} +4 -4
  153. package/dist/assets/{passport-item-DH3_49G1.js → passport-item-BWCHjFYy.js} +1 -1
  154. package/dist/assets/{permission-BH1TY_tz.js → permission-Cnn9EYOW.js} +1 -1
  155. package/dist/assets/preferences-Cqm2olsT.js +1 -0
  156. package/dist/assets/profile-embed-CcuuyEXm.js +1 -0
  157. package/dist/assets/pt-7HHecjdA.js +5 -0
  158. package/dist/assets/publish-resource-BdSfAE92.js +1 -0
  159. package/dist/assets/{react-beautiful-dnd.esm-7PS2VwOi.js → react-beautiful-dnd.esm-cfY5JZV6.js} +1 -1
  160. package/dist/assets/ru-Bw8FVC4M.js +5 -0
  161. package/dist/assets/runtime-BKK1_RAt.js +1 -0
  162. package/dist/assets/sdk-CXaHNlMH.js +1 -0
  163. package/dist/assets/{section-Cv4udilp.js → section-C1TPQFRq.js} +1 -1
  164. package/dist/assets/{security-CX01lhxW.js → security-C8vye2TA.js} +4 -4
  165. package/dist/assets/{session-CHdTc1We.js → session-B2z_IWIe.js} +1 -1
  166. package/dist/assets/setup-CS2QWFMb.js +30 -0
  167. package/dist/assets/{shorten-label-Cng55547.js → shorten-label-Bf7YQUd6.js} +1 -1
  168. package/dist/assets/{simple-select-CP_Svi_D.js → simple-select-DwWEI_ZU.js} +1 -1
  169. package/dist/assets/{slicedToArray-C7EPqaHf.js → slicedToArray-BSaY8ui4.js} +1 -1
  170. package/dist/assets/{spaces-BVG-t3ND.js → spaces-DMMN97uo.js} +1 -1
  171. package/dist/assets/{start-CMRQU8Px.js → start-6o3_Gxa0.js} +3 -3
  172. package/dist/assets/{starting-progress-CiLZpNpg.js → starting-progress-DeFtXRb_.js} +1 -1
  173. package/dist/assets/status-C73nIKwK.js +1 -0
  174. package/dist/assets/{step-actions-BfGTFkaB.js → step-actions-CqbOBcvS.js} +1 -1
  175. package/dist/assets/{studio-DikseKRr.js → studio-CiFHrC57.js} +1 -1
  176. package/dist/assets/{switch-control-C5i52ixk.js → switch-control-DnNP5DPe.js} +1 -1
  177. package/dist/assets/table-tips-hNIkakER.js +1 -0
  178. package/dist/assets/th-DyW-mYrC.js +5 -0
  179. package/dist/assets/traffic-B7XP49Y5.js +35 -0
  180. package/dist/assets/{transfer-BnR8fjLW.js → transfer-BfUTfR-d.js} +1 -1
  181. package/dist/assets/{unsubscribe-rUE2LcLN.js → unsubscribe-Bf4dBSoS.js} +1 -1
  182. package/dist/assets/{use-blocklet-logo-Phq7jasP.js → use-blocklet-logo-Bv56-gH-.js} +1 -1
  183. package/dist/assets/{use-mobile-Boa_xu9A.js → use-mobile-JEGQfLZ2.js} +1 -1
  184. package/dist/assets/{use-mobile-DyX6Fl8Z.js → use-mobile-ZAS6Si4t.js} +1 -1
  185. package/dist/assets/{useAsync-DV3NyLhI.js → useAsync-DnXpD472.js} +1 -1
  186. package/dist/assets/{useLocalStorage-DVnkpneF.js → useLocalStorage-BRd3tKN9.js} +1 -1
  187. package/dist/assets/user-center-Ck0gNc-m.js +76 -0
  188. package/dist/assets/{util-CEAObyfj.js → util-CVjZG67N.js} +1 -1
  189. package/dist/assets/{util-Btd7aQEC.js → util-DWicJSOi.js} +1 -1
  190. package/dist/assets/{vendor-arcblock-uz9DVywv.js → vendor-arcblock-DPRICUXM.js} +109 -109
  191. package/dist/assets/{vendor-hooks-rDgu5KV9.js → vendor-hooks-Zkb4Ilbj.js} +1 -1
  192. package/dist/assets/{vendor-mui-core-D_bnq77o.js → vendor-mui-core-Bh-qMRq3.js} +1 -1
  193. package/dist/assets/{vendor-mui-x-R-0SFz4c.js → vendor-mui-x-CQTjfcpn.js} +1 -1
  194. package/dist/assets/{vendor-ux-did-connect-DHrruicZ.js → vendor-ux-did-connect-Ck9lzrbN.js} +73 -73
  195. package/dist/assets/vi-bzer6J4H.js +5 -0
  196. package/dist/assets/wrap-locale-HcPVeI43.js +1 -0
  197. package/dist/assets/zh-Cti0XXui.js +8 -0
  198. package/dist/assets/zh-tw-BLcDG99i.js +7 -0
  199. package/dist/images/all-done-dark.svg +68 -0
  200. package/dist/images/all-done-light.svg +60 -0
  201. package/dist/index.html +5 -5
  202. package/dist/service-worker.js +1 -1
  203. package/package.json +48 -47
  204. package/dist/assets/add-resource-BrZnm53f.js +0 -1
  205. package/dist/assets/addon--u4EErgw.js +0 -14
  206. package/dist/assets/appearance-Bowm1Shj.js +0 -1
  207. package/dist/assets/ar-Blzb8h2o.js +0 -7
  208. package/dist/assets/audit-logs-DczjqamJ.js +0 -35
  209. package/dist/assets/button-D8hoY4xw.js +0 -1
  210. package/dist/assets/click-to-copy-CFiGx48J.js +0 -1
  211. package/dist/assets/complete-CKhw9u_z.js +0 -45
  212. package/dist/assets/config-space-CogRdhoQ.js +0 -1
  213. package/dist/assets/confirm-SdqBW-ti.js +0 -7
  214. package/dist/assets/connect-to-eNQDY2rc.js +0 -1
  215. package/dist/assets/dashboard-BYxl5V9e.js +0 -239
  216. package/dist/assets/de-BxI5dM9K.js +0 -7
  217. package/dist/assets/delete-confirm-CKF_eljP.js +0 -1
  218. package/dist/assets/domain-DotN6lCb.js +0 -9
  219. package/dist/assets/domain-action-card-DHH9PLRG.js +0 -24
  220. package/dist/assets/domains-BV2pykxi.js +0 -1
  221. package/dist/assets/format-error-BrmqJs5a.js +0 -2
  222. package/dist/assets/fr-DezMACmP.js +0 -7
  223. package/dist/assets/get-safe-url-B5RJTMjC.js +0 -1
  224. package/dist/assets/get-safe-url-Bk6PlU7n.js +0 -1
  225. package/dist/assets/hi-ClbEozhq.js +0 -5
  226. package/dist/assets/id-CXYm-1K3.js +0 -7
  227. package/dist/assets/index-8CHxrfFP.js +0 -1
  228. package/dist/assets/index-B54lTbup.js +0 -99
  229. package/dist/assets/index-BCNchyGN.js +0 -141
  230. package/dist/assets/index-BJxv6GA4.js +0 -4
  231. package/dist/assets/index-CYeNo51G.js +0 -113
  232. package/dist/assets/index-CfxcUIhC.js +0 -1
  233. package/dist/assets/index-Ctzl9JDw.js +0 -55
  234. package/dist/assets/index-D7eC9ptO.js +0 -6
  235. package/dist/assets/index-D9KfgDPN.js +0 -241
  236. package/dist/assets/invite-CQPeUOT4.js +0 -1
  237. package/dist/assets/issue-passport-BYhvmLsl.js +0 -1
  238. package/dist/assets/item-D942q-4T.js +0 -2
  239. package/dist/assets/ja-B5V7b8Cm.js +0 -7
  240. package/dist/assets/ko-DP9up1nF.js +0 -7
  241. package/dist/assets/list-BiJWMg_P.js +0 -236
  242. package/dist/assets/list-DKUSPdB6.js +0 -2
  243. package/dist/assets/list-header-HqBQs1yn.js +0 -1
  244. package/dist/assets/localization-BUDtnbyU.js +0 -1
  245. package/dist/assets/logger-BLZgTs_U.js +0 -1
  246. package/dist/assets/login-oauth-callback-DZaPZfnA.js +0 -1
  247. package/dist/assets/overview-CaQ-tV1t.js +0 -85
  248. package/dist/assets/preferences-CfmnTXfl.js +0 -1
  249. package/dist/assets/profile-embed-ZtzRYgXv.js +0 -1
  250. package/dist/assets/pt-CG45pWr4.js +0 -5
  251. package/dist/assets/publish-resource-BtFRgv4P.js +0 -1
  252. package/dist/assets/ru-0VhRQc7t.js +0 -5
  253. package/dist/assets/runtime-B0207zk1.js +0 -1
  254. package/dist/assets/sdk-9eXJSWHG.js +0 -1
  255. package/dist/assets/setup-DIAgbS7c.js +0 -30
  256. package/dist/assets/status-DSQPLYSp.js +0 -1
  257. package/dist/assets/th-DwH8cjcw.js +0 -5
  258. package/dist/assets/traffic-ClE631in.js +0 -35
  259. package/dist/assets/user-center-D25Vw-wP.js +0 -76
  260. package/dist/assets/vi-CcmTJggB.js +0 -5
  261. package/dist/assets/wrap-locale-CPW6a0PM.js +0 -1
  262. package/dist/assets/zh-C2MKZFZw.js +0 -8
  263. package/dist/assets/zh-tw-mW-UVEHx.js +0 -7
  264. package/dist/images/all-done.png +0 -0
@@ -0,0 +1,241 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-Bi8r1T8R.js","assets/vendor-ux-did-connect-Ck9lzrbN.js","assets/vendor-react-DEoibe3W.js","assets/vendor-utils-rHXShPKm.js","assets/vendor-mui-core-Bh-qMRq3.js","assets/vendor-hooks-Zkb4Ilbj.js","assets/lottie-web-jYmAQWuC.js","assets/vendor-ux-did-connect-DpSGLE7B.css","assets/vendor-arcblock-DPRICUXM.js","assets/index-Bs1kxR8_.js","assets/index-BiIZw9KG.js","assets/index-DOq-_YXu.css","assets/index-DVQCgvFb.js","assets/index-AgKpYdvC.css"])))=>i.map(i=>d[i]);
2
+ import{r as j,f as Et,l as ut,L as we,g as Hn,u as Jn,i as Gn,j as wt}from"./vendor-react-DEoibe3W.js";import{a9 as Ie,j as e,v as Ve,aa as c,bc as Lt,H as s,ad as ye,I as de,T as N,s as Xn,c6 as Jo,D as pt,ah as Re,at as Yn,bR as ot,ak as ht,bs as nt,bw as st,y as ee,ab as Se,P as Go,G as Xo,w as qt,a8 as Yo,M as Qo,q as be,X as Qn,aj as Zo,t as Ko,bU as Zn,N as Ye,z as en,O as re,al as Ce,as as tn,L as on,A as Nt,b5 as nn,bJ as sn,bx as Kn,e as rn,ap as es,b_ as ts,af as os,U as ln,W as rt,bE as ns,bF as ss,c7 as rs,c8 as ls,bn as It,bo as is,bq as cs,bu as as,bv as Rt}from"./vendor-mui-core-Bh-qMRq3.js";import{z as ke,C as Te,ad as ds,a5 as us,f as Io,ae as To,a9 as ps,af as hs,ag as fs,ah as bs}from"./index-BiIZw9KG.js";import{r as $e,j as Y,a as Z,bt as cn,h as ms,B as Le,b6 as an,W as dn,b3 as un,an as xs,bu as gs,a6 as At,Z as M,a2 as js,I as ue,bv as ks,b9 as ys,b as Me,al as ft,b4 as vs,ar as pn}from"./vendor-ux-did-connect-Ck9lzrbN.js";import{M as bt,c as fe,j as ws,Q as Rs,_ as hn,V as Ee,p as Cs}from"./vendor-arcblock-DPRICUXM.js";import{d as Ss}from"./Error-C-RD4e9g.js";import{C as mt}from"./confirm-DFwkkng7.js";import{u as Fe}from"./session-B2z_IWIe.js";import{W as Tt}from"./did-address-BI9LYTx-.js";import{E as Qe}from"./empty-spinner-BZw_ShnT.js";import{B as zt}from"./bundle-avatar-BbIyJr7P.js";import{S as De}from"./shorten-label-Bf7YQUd6.js";import{L as Ot}from"./list-header-DNFbdM3a.js";import{$ as Ds,A as pe,J as Wt,E as fn}from"./vendor-utils-rHXShPKm.js";import{d as Is}from"./Download-DdZEsxmZ.js";import{C as bn}from"./click-to-copy-DmYkL7Ui.js";import{Q as Ts}from"./QuestionMarkCircle-DTf-Tya5.js";import{x as $s,u as Ps}from"./vendor-hooks-Zkb4Ilbj.js";import{_ as Xe}from"./useSetState-CWq0AVWn.js";import{c as Bt}from"./index-DVQCgvFb.js";import{d as Mt}from"./Launch-KvZQI_SA.js";import{E as Vt}from"./index-C849wD9b.js";import"./api-BjteVZFg.js";import{d as _s}from"./ChevronRight-CQY9Ni7X.js";import{T as Es,a as Ls}from"./vendor-mui-x-CQTjfcpn.js";import{d as lt}from"./DeleteOutline-BEGOj_wq.js";import{D as $o,C as Po,P as _o}from"./react-beautiful-dnd.esm-cfY5JZV6.js";import{c as qs,A as mn,u as xn,S as Ns,a as As,b as zs,e as Os,U as Ws,f as Ct,g as gn,n as Bs,h as Ms,i as Eo,k as Vs,l as Us}from"./item-F_qGx0RW.js";import{d as Fs}from"./ArrowDropDown-xgs4N3Rf.js";import{f as je}from"./index-8eXqqyHQ.js";import{d as jn}from"./Done-BUJJNjlP.js";import{D as Hs}from"./delete-confirm-cVLum8Er.js";import{g as kn}from"./get-safe-url-BcH2iukm.js";import{M as Js}from"./index-DbsXFWms.js";import{r as Gs}from"./index-BdH_4Yfe.js";import"./lottie-web-jYmAQWuC.js";import"./raf-schd.esm-B3j6BePR.js";var Ut={},Xs=Ie;Object.defineProperty(Ut,"__esModule",{value:!0});var yn=Ut.default=void 0,Ys=Xs($e()),Qs=e;yn=Ut.default=(0,Ys.default)((0,Qs.jsx)("path",{d:"M19 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2m-2 10h-4v4h-2v-4H7v-2h4V7h2v4h4z"}),"AddBox");var Ft={},Zs=Ie;Object.defineProperty(Ft,"__esModule",{value:!0});var vn=Ft.default=void 0,Ks=Zs($e()),er=e;vn=Ft.default=(0,Ks.default)((0,er.jsx)("path",{d:"M14 2H6c-1.1 0-2 .9-2 2v16c0 1.1.89 2 1.99 2H15v-8h5V8zm-1 7V3.5L18.5 9zm4 12.66V16h5.66v2h-2.24l2.95 2.95-1.41 1.41L19 19.41v2.24h-2z"}),"FileOpen");var Ht={},tr=Ie;Object.defineProperty(Ht,"__esModule",{value:!0});var wn=Ht.default=void 0,or=tr($e()),nr=e;wn=Ht.default=(0,or.default)((0,nr.jsx)("path",{d:"M11 18h2v-2h-2zm1-16C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8m0-14c-2.21 0-4 1.79-4 4h2c0-1.1.9-2 2-2s2 .9 2 2c0 2-3 1.75-3 5h2c0-2.25 3-2.5 3-5 0-2.21-1.79-4-4-4"}),"HelpOutlineOutlined");function Jt({did:t,projectId:o,title:n,logo:r,describe:i}){const l=`${`${Y.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${t}/${o}/logo/upload`}/${r}`,[u,d]=j.useState(!1),x=Ve(b=>b.breakpoints.down("md"));return e.jsxs(c,{sx:{display:"flex",flexDirection:"row",color:u?"primary.main":"grey.900",gap:1},onPointerEnter:()=>d(!0),onPointerLeave:()=>d(!1),children:[e.jsx(Lt,{sx:{borderRadius:1},src:l}),e.jsxs(c,{children:[e.jsx(De,{hiddenTip:!0,maxLength:"24",sx:{fontSize:"14px",fontWeight:"500",color:x?"primary.main":""},children:n||"/"}),e.jsx(De,{hiddenTip:!0,maxLength:"58",sx:{fontSize:"12px",color:x||u?"primary.main":"grey.700"},children:i||"/"})]})]})}Jt.propTypes={projectId:s.string.isRequired,did:s.string.isRequired,title:s.string.isRequired,logo:s.string.isRequired,describe:s.string.isRequired};function Gt({initUrl:t}){const o=Et(),n=(t==null?void 0:t.searchParams.get("tenantScope"))||"",{t:r,locale:i}=Z(),{api:a}=ke(),{api:l}=Fe(),[u,d]=j.useState(!0),{blocklet:x}=Te(),[b,p]=j.useState(null),[h,m]=j.useState(!1),f=Ve(C=>C.breakpoints.down("xl")),y=Ve(C=>C.breakpoints.down("md")),{componentDid:v=""}=ut(),[g,k]=j.useState(null),S=`publish-${x.meta.did}`,R=cn(S),[T,D]=j.useState({searchText:R.searchText||"",pageSize:R.rowsPerPage||10,page:1}),B=()=>{a.getProjects({input:{did:x.meta.did,componentDid:v,tenantScope:n}}).then(C=>{const _=(C==null?void 0:C.projects)||[];d(!1),k(_)}).catch(C=>{d(!1),M.error(C.message)})},$=()=>{o(`${Y.UNOWNED_DID}/create/none/0.0.0`,{replace:!0})},z=C=>{p(C)},J=()=>{d(!1),m(!0)},U=()=>{m(!1),p(null)},w=C=>{M.error(C.message),m(!1),p(null)},I=C=>{if(!(C!=null&&C.deleted)){M.error("Delete project failed");return}B(),m(!1),p(null)};j.useEffect(()=>{B()},[]);const q=j.useMemo(()=>{var _;if(!T.searchText)return g;let C=(_=T.searchText)==null?void 0:_.trim();return C?(C=ms.toAddress(C).toLocaleLowerCase(),g.filter(G=>G.blockletTitle.toLowerCase().includes(C)||G.blockletDid.toLowerCase().includes(C))):g},[g,T.searchText]);if(!g&&u)return e.jsx(c,{sx:{display:"flex",justifyContent:"center",alignItems:"center",marginTop:"40px"},children:e.jsx(Qe,{})});if(!g)return null;if(!g.length)return e.jsxs(c,{display:"flex",flexDirection:"column",alignItems:"center",pt:10,children:[e.jsx(c,{sx:{fontSize:20,fontWeight:"bold",mb:3},children:r("blocklet.publish.blockletEmptyTip")}),e.jsx(c,{sx:{fontSize:14,color:"text.secondary",mb:3},children:r("blocklet.publish.createBlockletTip")}),e.jsx(Le,{onClick:$,variant:"contained",children:r("blocklet.publish.createBlocklet")})]});const P=[{label:"Blocklet",name:"blockletTitle",minWidth:160,options:{customBodyRenderLite:C=>{const _=g[C];return e.jsx(we,{to:`${_.id}`,children:e.jsx(Jt,{did:x.meta.did,projectId:_.id,logo:_.blockletLogo,title:_.blockletTitle,describe:_.blockletDescription})})}}},{label:"Version",name:"blockletVersion",options:{searchable:!1,customBodyRender:C=>C?e.jsx(an,{type:"success",children:C}):""}},{label:"DID",name:"blockletDid",options:{customBodyRender:C=>C?e.jsx(Tt,{size:14,compact:!0,responsive:!1,did:C}):null}},f||v?null:{label:r("common.createdBy"),name:"createdBy",options:{customBodyRender:C=>C?e.jsx(Tt,{onClick:()=>{o(`/.well-known/service/admin/members?did=${C}`)},style:{cursor:"pointer"},size:14,compact:!0,copyable:!1,showQrcode:!1,responsive:!1,did:C}):null}},f||v?null:{label:r("common.scope"),name:"componentDid",options:{customBodyRender:C=>{const _=(x.children||[]).find(G=>G.meta.did===C);return _?e.jsxs(c,{display:"flex",alignItems:"center",justifyContent:"flex-start",children:[e.jsx(zt,{size:14,blocklet:_,ancestors:[x]}),e.jsx(c,{ml:.5,sx:{ml:.5,color:"text.primary",fontSize:14},children:_.meta.title})]},C):""}}},f||n?null:{label:r("blocklet.publish.tenantScope"),name:"tenantScope",options:{customBodyRender:C=>e.jsx(c,{ml:.5,sx:{ml:.5,color:"text.primary",fontSize:14},children:e.jsx(De,{children:C})})}},{label:r("common.updatedAt"),name:"updatedAt",options:{searchable:!1,customBodyRender:C=>e.jsx(dn,{value:Number(C),locale:i})}},{label:r("common.actions"),name:"actions",options:{searchable:!1,customBodyRenderLite:C=>{const _=g[C];return e.jsxs(c,{display:"flex",children:[e.jsx(we,{to:`${_.id}/new-release/${_.lastReleaseId}`,children:e.jsx(ye,{title:r("blocklet.publish.createRelease"),placement:"top",children:e.jsx(de,{color:"primary","aria-label":"create",children:e.jsx(yn,{style:{fontSize:18}})})})}),!!_.lastReleaseId&&e.jsx(ye,{title:r("blocklet.publish.viewLastRelease",{name:_.blockletTitle}),placement:"top",children:e.jsx(de,{color:"secondary","aria-label":"create",children:e.jsx(we,{style:{display:"flex"},to:`${_.id}/view/${_.lastReleaseId}/${_.blockletVersion}`,children:e.jsx(vn,{sx:{fontSize:18}})})})}),e.jsx(ye,{title:r("blocklet.publish.delete",{name:_.blockletTitle}),placement:"top",children:e.jsx(de,{color:"primary","aria-label":"delete",onClick:()=>z(_),children:e.jsx(un,{sx:{fontSize:18}})})})]})}}}].filter(Boolean),A=({page:C,rowsPerPage:_,searchText:G})=>{T.pageSize!==_?D(F=>({...F,searchText:"",pageSize:_,page:1})):T.page!==C+1?D(F=>({...F,searchText:"",page:C+1})):T.searchText!==G&&D(F=>({...F,searchText:G,page:1}))},H=h?e.jsx(xs,{open:!0,popup:!0,onClose:U,action:"check-has-project-id",locale:i,checkFn:l.get,saveConnect:!1,forceConnected:!1,checkTimeout:5*60*1e3,onSuccess:I,onError:w,extraParams:{projectId:b.id,did:x.meta.did,name:b.blockletTitle},messages:{title:r("blocklet.publish.deleteProject.title",{name:b.blockletTitle}),scan:r("blocklet.publish.deleteProject.scan",{name:b.blockletTitle}),confirm:r("blocklet.publish.deleteProject.confirm"),success:r("blocklet.publish.deleteProject.success")}}):null;return e.jsxs(sr,{children:[e.jsx(Ot,{sx:{mb:2},left:e.jsxs(c,{display:"flex",flexDirection:"row",alignItems:"center",children:[e.jsx(c,{sx:{fontSize:"1.2rem",fontWeight:"bold"},children:r("common.blockletStudio")}),e.jsx(ye,{title:r("blocklet.publish.createBlockletTip"),arrow:!0,placement:"right",children:e.jsx(wn,{sx:{opacity:.6,fontSize:"1.1em",ml:1}})})]}),actions:e.jsxs(e.Fragment,{children:[e.jsx(gs,{options:{searchPlaceholder:r("blocklet.list.searchPlaceholder"),searchDebounceTime:600,searchAlwaysOpen:y},search:T.searchText,searchText:T.searchText,searchTextUpdate:C=>D(_=>({..._,searchText:C})),searchClose:()=>D(C=>({...C,searchText:""})),onSearchOpen:()=>{}}),e.jsxs(Le,{onClick:$,variant:"contained",children:[e.jsx(bt,{style:{fontSize:"1.3em",marginRight:4}}),r("blocklet.publish.createBlocklet")]})]})}),e.jsx(At,{className:"main-table",locale:i,data:q,columns:P,options:{search:!1,sort:!1,download:!1,filter:!1,print:!1,viewColumns:!1,searchAlwaysOpen:!0,rowsPerPageOptions:[10,20,50,100]},durable:S,onChange:A}),b&&e.jsx(mt,{title:`${r("common.delete")} ${b.blockletTitle}`,description:r("blocklet.publish.deleteProject.description"),confirm:r("common.confirm"),onConfirm:J,onCancel:()=>p(null),children:e.jsx(c,{sx:{marginTop:2},children:[r("blocklet.publish.deleteProject.tip1"),r("blocklet.publish.deleteProject.tip2"),r("blocklet.publish.deleteProject.tip3")].map(C=>e.jsxs(c,{sx:{display:"flex",marginTop:1,flexDirection:"row",alignItems:"flex-start"},children:[e.jsx(Ss,{color:"warning",sx:{marginRight:1,fontSize:20,marginTop:"2px"}}),e.jsx(N,{component:"span",variant:"inherit",color:"text.secondary",children:C})]}))})}),H]})}const sr=Xn(c)`
3
+ ${({theme:t})=>t.breakpoints.down("md")} {
4
+ .MuiTableRow-root {
5
+ border-color: ${({theme:t})=>t.palette.divider};
6
+ }
7
+ }
8
+ `;Gt.propTypes={initUrl:s.object};Gt.defaultProps={initUrl:null};var Xt={},rr=Ie;Object.defineProperty(Xt,"__esModule",{value:!0});var Rn=Xt.default=void 0,lr=rr($e()),Lo=e;Rn=Xt.default=(0,lr.default)([(0,Lo.jsx)("path",{d:"M20 17H4V5h8V3H4c-1.11 0-2 .89-2 2v12c0 1.1.89 2 2 2h4v2h8v-2h4c1.1 0 2-.9 2-2v-3h-2z"},"0"),(0,Lo.jsx)("path",{d:"m17 14 5-5-1.41-1.41L18 10.17V3h-2v7.17l-2.59-2.58L12 9z"},"1")],"InstallDesktop");const ir=(t,o)=>{if(!t)return"";try{return o?JSON.parse(t)[o]:JSON.parse(t)}catch{}return t},Cn=ir;function cr(){var I,q;const{t,locale:o}=Z(),{projectId:n}=ut(),{api:r}=ke(),[i,a]=j.useState(!0),{blocklet:l}=Te(),u=Ve(P=>P.breakpoints.down("md")),[d,x]=j.useState(null),[b,p]=j.useState(null),[h,m]=j.useState(null),f=(I=window.env)==null?void 0:I.serverEndpoint,y=`releases-${l.meta.did}-${n}`,v=cn(y),[g,k]=j.useState({searchText:v.searchText||"",pageSize:v.rowsPerPage||10,page:1}),S=()=>{r.getReleases({input:{did:l.meta.did,projectId:n}}).then(P=>{const A=(P==null?void 0:P.releases)||[];a(!1),x(A)}).catch(P=>{a(!1),M.error(P.message)})},R=()=>{r.doBatchQuery({getProject:{input:{did:l.meta.did,projectId:n}},getReleases:{input:{did:l.meta.did,projectId:n}}}).then(P=>{p(P.getProject.project||{}),x(P.getReleases.releases||[]),a(!1)}).catch(P=>{a(!1),M.error(P.message)})};j.useEffect(()=>{R()},[]);const[T,D]=j.useState(""),B=()=>{a(!1);const P=h.id;r.deleteRelease({input:{did:l.meta.did,projectId:n,releaseId:P}}).then(()=>{a(!1),S(),M.success(t("common.removeSuccess")),m(null)}).catch(A=>{a(!1),M.error(A.message)})},$=P=>{m(P)};if(!d&&i)return e.jsx(c,{sx:{display:"flex",justifyContent:"center",alignItems:"center",marginTop:"40px"},children:e.jsx(Qe,{})});if(!d)return null;const z=e.jsxs(Jo,{className:"breadcrumbs","aria-label":"breadcrumb",children:[e.jsx(we,{to:"..",children:t("common.blockletStudio")}),e.jsx(N,{color:"text.primary",children:e.jsx(De,{maxLength:u?6:30,children:b.blockletTitle})})]});if(!d.length)return e.jsxs(e.Fragment,{children:[z,e.jsxs(c,{display:"flex",flexDirection:"column",alignItems:"center",pt:10,children:[e.jsx(c,{sx:{fontSize:20,fontWeight:"bold",mb:3},children:t("blocklet.publish.releaseEmptyTip")}),e.jsx(c,{sx:{fontSize:14,color:"text.secondary",mb:3},children:t("blocklet.publish.createReleaseTip")}),e.jsx(we,{to:"create/none",children:e.jsx(Le,{variant:"contained",children:t("blocklet.publish.createRelease")})})]})]});const J=[{label:t("common.version"),name:"blockletVersion",minWidth:160,options:{customBodyRenderLite:P=>{const A=d[P];return e.jsx(we,{to:`view/${A.id}/${A.blockletVersion}`,children:e.jsx(Jt,{did:l.meta.did,projectId:b.id,logo:A.blockletLogo,title:A.blockletVersion,describe:A.blockletTitle})})}}},{label:t("blocklet.publish.releaseNote"),name:"note",options:{customBodyRenderLite:P=>{const A=d[P];return e.jsx(N,{className:"note",children:Cn(A.note,"note")})}}},{label:t("common.status"),name:"status",options:{customBodyRender:P=>e.jsx(an,{type:P==="published"?"success":"warning",children:P==="published"?"Released":Ds(P)})}},{label:t("common.lastPublishedAt"),name:"updatedAt",options:{customBodyRenderLite:P=>{const A=d[P];return A.status!==fe.PROJECT.RELEASE_STATUS.published?"":e.jsx(dn,{value:Number(A.updatedAt),locale:o})}}},{label:t("common.actions"),name:"actions",options:{customBodyRenderLite:P=>{var F;const A=d[P];let H="",C="";const _=A.status==="published";if(_){const K=pe(f,`/api/project/${l.meta.did}/${b.id}/${b.lastReleaseId}/release/blocklet.json`),E=new URL(f);E.pathname=pe(E.pathname,"/launch-blocklet/agreement"),E.searchParams.set("blocklet_meta_url",K),H=E.href,C=pe(`${Y.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${l.meta.did}/${b.id}/${b.lastReleaseId}/download/${(b.lastReleaseFiles||[])[0]}`)}const G=(F=b.blockletComponents)!=null&&F.some(K=>K.included)||A.uploadedResource?"pack":"resource";return e.jsxs(c,{display:"flex",alignItems:"center",children:[_&&G==="pack"&&e.jsx(ye,{title:t("blocklet.publish.install",{name:b.blockletTitle}),placement:"top",children:e.jsx(de,{color:"secondary","aria-label":"create",children:e.jsx("a",{style:{display:"flex"},href:H,target:"_blank",rel:"noreferrer",children:e.jsx(Rn,{sx:{fontSize:18}})})})}),_&&e.jsx(ye,{title:t("blocklet.publish.download",{name:b.blockletTitle}),placement:"top",children:e.jsx(de,{color:"primary","aria-label":"download",children:e.jsx("a",{style:{display:"flex"},href:C,children:e.jsx(Is,{sx:{fontSize:18}})})})}),e.jsx(ye,{title:t("blocklet.publish.delete",{name:b.blockletTitle}),placement:"top",children:e.jsx(de,{color:"primary","aria-label":"delete",onClick:()=>$(A),children:e.jsx(un,{sx:{fontSize:18}})})})]})}}}],U=({page:P,rowsPerPage:A,searchText:H})=>{g.pageSize!==A?k(C=>({...C,searchText:"",pageSize:A,page:1})):g.page!==P+1?k(C=>({...C,searchText:"",page:P+1})):g.searchText!==H&&k(C=>({...C,searchText:H,page:1}))},w=((q=d==null?void 0:d[0])==null?void 0:q.blockletVersion)||"0.0.0";return e.jsxs(ar,{children:[e.jsx(Ot,{sx:{mb:2},left:z,actions:e.jsxs(e.Fragment,{children:[e.jsx(Le,{variant:"outlined",onClick:()=>{const P=pe(f,`/api/project/${l.meta.did}/${n}/blocklet.json`);D(P)},children:t("blocklet.publish.copyInstallUrl")}),e.jsx(we,{to:`new-release/none/${w}`,children:e.jsxs(Le,{variant:"contained",children:[e.jsx(bt,{style:{fontSize:"1.3em",marginRight:4}}),t("blocklet.publish.createRelease")]})})]})}),e.jsx(pt,{fullWidth:!0,maxWidth:"sm",open:T,onClose:()=>D(""),children:e.jsxs(c,{sx:{py:5,px:4,wordBreak:"break-all"},children:[e.jsx(N,{variant:"h6",sx:{mb:2},children:t("blocklet.publish.installResourceTip")}),e.jsx(bn,{children:T}),e.jsxs(N,{sx:{mt:2},children:[t("blocklet.publish.installResourceTip2"),e.jsx("a",{style:{marginLeft:4},href:"https://www.arcblock.io/docs/blocklet-developer/how-to-use-install-url",target:"_blank",rel:"noreferrer",children:t("blocklet.publish.installResourceHelp")})]})]})}),e.jsx(At,{className:"main-table",verticalKeyWidth:100,locale:o,data:d,columns:J,durable:y,options:{sort:!1,download:!1,filter:!1,print:!1,search:!1},onChange:U}),h&&e.jsx(mt,{title:t(`${t("common.delete")} ${h.blockletVersion}`),description:t("blocklet.publish.deleteReleaseTip"),confirm:t("common.confirm"),onConfirm:B,onCancel:()=>m(null)})]})}const ar=Re(c)`
9
+ .main-table > div:first-child {
10
+ display: none;
11
+ }
12
+ .note {
13
+ word-break: break-all;
14
+ white-space: pre-line;
15
+ }
16
+ ${({theme:t})=>t.breakpoints.down("md")} {
17
+ .MuiTableRow-root {
18
+ border-color: ${({theme:t})=>t.palette.divider};
19
+ }
20
+ }
21
+ `;var Yt={},dr=Ie;Object.defineProperty(Yt,"__esModule",{value:!0});var Sn=Yt.default=void 0,ur=dr($e()),pr=e;Sn=Yt.default=(0,ur.default)((0,pr.jsx)("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.42 0-8-3.58-8-8 0-1.85.63-3.55 1.69-4.9L16.9 18.31C15.55 19.37 13.85 20 12 20m6.31-3.1L7.1 5.69C8.45 4.63 10.15 4 12 4c4.42 0 8 3.58 8 8 0 1.85-.63 3.55-1.69 4.9"}),"DoDisturbAlt");function Ue({children:t,Icon:o}){return e.jsxs(Yn,{sx:{display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",paddingTop:"10px",margin:"10px 0px"},children:[e.jsx(c,{sx:{opacity:.3,fontSize:32},children:e.jsx(o,{})}),e.jsx(c,{sx:{mb:2,opacity:.7,fontSize:"small",color:"action"},children:t})]})}Ue.propTypes={children:s.node.isRequired,Icon:s.elementType};Ue.defaultProps={Icon:Sn};function Qt({value:t,app:o,onChange:n,onChangeBlockletResourceType:r,disabled:i,resourceRelateComponents:a,projectType:l,dependentComponentsMode:u,blockletResourceType:d}){const{t:x,locale:b}=Z(),p=u==="readonly",h=j.useMemo(()=>{const S=t.reduce((R,T)=>(R[T.did]=T.included,R),{});return(o.children||[]).filter(R=>p?a[R.meta.did]||S[R.meta.did]:!0)},[o.children,t,a,p]),m=j.useMemo(()=>h.map(S=>t.find(T=>T.did===S.meta.did)||{did:S.meta.did}),[h,t]),f=m.reduce((S,R)=>(S[R.did]=Wt(R,["required","included"]),S),{}),y=S=>{const R=m.map(T=>{if(T.did===S){const D=!T.included;return{...T,included:D,required:D}}return T});n(R)},v=S=>{const R=m.map(T=>T.did===S?{...T,required:!T.required}:T);n(R)},g=S=>{r(S.target.checked?"resource":"")},k=[{label:x("common.name"),name:"meta.title",width:200,options:{customBodyRenderLite:S=>{var D;const R=h[S],T=(D=f[R.meta.did])==null?void 0:D.included;return e.jsxs(c,{display:"flex",alignItems:"center",children:[e.jsx(zt,{size:24,blocklet:R,ancestors:[o]}),e.jsx(c,{ml:"4px",className:Bt("text",{excluded:!T}),children:e.jsx(c,{children:R.meta.title})})]})}}},{label:x("blocklet.publish.componentIncluded"),width:100,options:{customBodyRenderLite:S=>{var B;const R=h[S],T=a[R.meta.did],D=!!((B=f[R.meta.did])!=null&&B.included);return e.jsx(ot,{size:"small",checked:T||D,onClick:()=>y(R.meta.did),disabled:p||T||i})}}},{label:x("blocklet.publish.componentForceRequired"),width:100,options:{customBodyRenderLite:S=>{var $,z;const R=h[S],T=a[R.meta.did],D=!!(($=f[R.meta.did])!=null&&$.included),B=!!((z=f[R.meta.did])!=null&&z.required);return e.jsx(ot,{size:"small",checked:T||B&&D,onClick:()=>v(R.meta.did),disabled:p||T||i||!D})}}}];return e.jsx(hr,{children:h!=null&&h.length?e.jsxs(e.Fragment,{children:[e.jsxs(ht,{severity:"info",style:{width:"100%"},children:[e.jsxs(c,{display:"flex",alignItems:"center",rel:"noreferrer",ml:"13px",children:[x(l==="pack"?"blocklet.publish.packTip":"blocklet.publish.resourceTip"),e.jsx(c,{component:"a",target:"_blank",href:l==="pack"?"https://www.arcblock.io/docs/blocklet-developer/en/5PXToZve-5IXAN1bc8rkpxAc":"https://www.arcblock.io/docs/blocklet-developer/en/hB5VWLfg9VnbWsL1JGLuLUfW",children:e.jsx(Mt,{sx:{marginLeft:1}})})]}),e.jsxs(c,{component:"label",style:{cursor:"pointer"},children:[e.jsx(ot,{size:"small",style:{marginLeft:"0px"},disabled:i,checked:d==="resource",onChange:g}),x("blocklet.publish.forceResourceBlocklet")]})]}),e.jsx(At,{className:"main-table",verticalKeyWidth:100,locale:b,data:h,columns:k,options:{sort:!1,download:!1,filter:!1,print:!1,search:!1,rowsPerPage:50}})]}):e.jsx(Ue,{Icon:Vt,children:x("blocklet.publish.blockletEmptyTip")})})}Qt.propTypes={app:s.object.isRequired,value:s.arrayOf(s.shape({did:s.string.isRequired,required:s.bool,included:s.bool})),onChange:s.func,onChangeBlockletResourceType:s.func,disabled:s.bool,dependentComponentsMode:s.string,resourceRelateComponents:s.object,blockletResourceType:s.string,projectType:s.string.isRequired};Qt.defaultProps={value:[],onChange:()=>{},onChangeBlockletResourceType:()=>{},disabled:!1,dependentComponentsMode:"auto",blockletResourceType:"",resourceRelateComponents:{}};const hr=Re(c)`
22
+ .main-table {
23
+ .text.excluded {
24
+ color: ${({theme:t})=>t.palette.grey[400]};
25
+ }
26
+ width: 400px;
27
+ ${({theme:t})=>t.breakpoints.down("md")} {
28
+ width: 100%;
29
+ }
30
+ > div:first-child {
31
+ display: none;
32
+ }
33
+ .MuiTableCell-head {
34
+ padding-top: 0;
35
+ padding-bottom: 0;
36
+ }
37
+ .MuiTableCell-body {
38
+ padding-top: 6px;
39
+ padding-bottom: 6px;
40
+ }
41
+ .datatable-footer {
42
+ display: none;
43
+ }
44
+ ${({theme:t})=>t.breakpoints.down("md")} {
45
+ .MuiTableRow-root {
46
+ border-color: ${({theme:t})=>t.palette.divider};
47
+ }
48
+ }
49
+ }
50
+ `;var fr=(t,o=1,n)=>{if(n={indent:" ",includeEmptyLines:!1,...n},typeof t!="string")throw new TypeError(`Expected \`input\` to be a \`string\`, got \`${typeof t}\``);if(typeof o!="number")throw new TypeError(`Expected \`count\` to be a \`number\`, got \`${typeof o}\``);if(typeof n.indent!="string")throw new TypeError(`Expected \`options.indent\` to be a \`string\`, got \`${typeof n.indent}\``);if(o===0)return t;const r=n.includeEmptyLines?/^/gm:/^(?!\s*$)/gm;return t.replace(r,n.indent.repeat(o))};const qo=ds,No=/\s+at.*(?:\(|\s)(.*)\)?/,br=/^(?:(?:(?:node|(?:internal\/[\w/]*|.*node_modules\/(?:babel-polyfill|pirates)\/.*)?\w+)\.js:\d+:\d+)|native)/,mr=typeof qo.homedir>"u"?"":qo.homedir();var xr=(t,o)=>(o=Object.assign({pretty:!1},o),t.replace(/\\/g,"/").split(`
51
+ `).filter(n=>{const r=n.match(No);if(r===null||!r[1])return!0;const i=r[1];return i.includes(".app/Contents/Resources/electron.asar")||i.includes(".app/Contents/Resources/default_app.asar")?!1:!br.test(i)}).filter(n=>n.trim()!=="").map(n=>o.pretty?n.replace(No,(r,i)=>r.replace(i,i.replace(mr,"~"))):n).join(`
52
+ `));const gr=fr,jr=xr,kr=t=>t.replace(/\s+at .*aggregate-error\/index.js:\d+:\d+\)?/g,"");let yr=class extends Error{constructor(o){if(!Array.isArray(o))throw new TypeError(`Expected input to be an Array, got ${typeof o}`);o=[...o].map(r=>r instanceof Error?r:r!==null&&typeof r=="object"?Object.assign(new Error(r.message),r):new Error(r));let n=o.map(r=>typeof r.stack=="string"?kr(jr(r.stack)):String(r)).join(`
53
+ `);n=`
54
+ `+gr(n,4),super(n),this.name="AggregateError",Object.defineProperty(this,"_errors",{value:o})}*[Symbol.iterator](){for(const o of this._errors)yield o}};var vr=yr;const wr=vr;var Rr=async(t,o,{concurrency:n=1/0,stopOnError:r=!0}={})=>new Promise((i,a)=>{if(typeof o!="function")throw new TypeError("Mapper function is required");if(!((Number.isSafeInteger(n)||n===1/0)&&n>=1))throw new TypeError(`Expected \`concurrency\` to be an integer from 1 and up or \`Infinity\`, got \`${n}\` (${typeof n})`);const l=[],u=[],d=t[Symbol.iterator]();let x=!1,b=!1,p=0,h=0;const m=()=>{if(x)return;const f=d.next(),y=h;if(h++,f.done){b=!0,p===0&&(!r&&u.length!==0?a(new wr(u)):i(l));return}p++,(async()=>{try{const v=await f.value;l[y]=await o(v,y),p--,m()}catch(v){r?(x=!0,a(v)):(u.push(v),p--,m())}})()};for(let f=0;f<n&&(m(),!b);f++);});const Cr=Rr;var Sr=(t,o)=>Cr(t,n=>n(),o);const it=Hn(Sr);function Dr(t,o){const n=new Set(o||[]),r=[];function i(a){n.has(a==null?void 0:a.id)&&r.push(a==null?void 0:a.id),a!=null&&a.children&&a.children.forEach(i)}return(t||[]).forEach(i),r}function Zt({src:t,alt:o,...n}){const[r,i]=j.useState(!1),a=j.useRef(null);return j.useEffect(()=>{if(!("IntersectionObserver"in window))return i(!0),()=>{};const l=new IntersectionObserver(u=>{u.forEach(d=>{d.isIntersecting&&(i(!0),l.disconnect())})},{threshold:.1});return a.current&&l.observe(a.current),()=>{l.disconnect()}},[]),e.jsx("img",{ref:a,src:r?t:void 0,alt:o,...n})}Zt.propTypes={src:s.string.isRequired,alt:s.string};Zt.defaultProps={alt:""};function Kt({data:t,lazy:o,...n}){return!t||!t.length?null:e.jsx(Ir,{...n,children:t.map(r=>e.jsx("a",{href:r.url,target:"_blank",rel:"noreferrer",children:o?e.jsx(Zt,{src:r.url,alt:r.alt||""}):e.jsx("img",{src:r.url,alt:r.alt||""})},r.url))})}Kt.propTypes={data:s.arrayOf(s.shape({url:s.string,alt:s.string})),lazy:s.bool};Kt.defaultProps={data:[],lazy:!1};const Ir=Re(c)`
55
+ display: flex;
56
+ justify-content: flex-start;
57
+ flex-wrap: wrap;
58
+ margin-bottom: -12px;
59
+ a {
60
+ display: flex;
61
+ }
62
+ img {
63
+ height: 128px;
64
+ cursor: pointer;
65
+ margin-right: 12px;
66
+ margin-bottom: 12px;
67
+ }
68
+ `,St=(t,o)=>{const n=[...t];for(;n.length>0;){const r=n.shift();if(r.id===o)return r;r.children&&n.push(...r.children)}return[]};function eo({icon:t}){return t?js(t)?e.jsx("img",{className:"resource-icon",src:t,alt:"icon"}):e.jsx(ue,{className:"resource-icon",icon:t}):null}eo.propTypes={icon:s.string};eo.defaultProps={icon:""};function to({disabled:t,data:o,onChange:n,value:r}){const i=r;function a(m,f=[]){return f.push(m.id),m.children&&m.children.forEach(y=>a(y,f)),f}const l=m=>a(St(o,m)),u=(m,f=[])=>{const y=St(o,m);return y.parent?(f.push(y.parent),u(y.parent,f)):f};function d(m,f){const y=l(m.id),v=y.indexOf(m.id);return y.splice(v,1),y.every(g=>i.concat(f).includes(g))}const x=(m,f)=>{m.stopPropagation();const y=l(f),v=u(f);if(i.includes(f)){const g=i.filter(k=>!y.concat(v).includes(k));n(g)}else{const g=y;for(let k=0;k<v.length;++k)d(St(o,v[k]),g)&&g.push(v[k]);n([...i].concat(g))}},b=m=>{m.stopPropagation()},p=o.some(m=>{var f;return((f=m.children)==null?void 0:f.length)>0}),h=m=>{var k;const f=i.indexOf(m.id)!==-1,y=Array.isArray(m.children),v=l(m.id),g=y&&!f&&i.some(S=>v.includes(S));return e.jsx(Es,{nodeId:m.id,label:e.jsx(nt,{onClick:b,control:e.jsx(ot,{size:"small",checked:f,indeterminate:g,tabIndex:-1,disableRipple:!0,onClick:S=>x(S,m.id),disabled:m.disabled||t}),label:e.jsxs(c,{className:"content",children:[e.jsxs(c,{display:"flex",alignItems:"center",children:[m.icon&&e.jsx(eo,{icon:m.icon}),e.jsx(c,{className:"name",children:m.name}),m.url&&e.jsx("a",{href:m.url,target:"_blank",rel:"noreferrer",className:"link",children:e.jsx(Rs,{className:"link-icon"})})]}),!!m.description&&e.jsx(c,{className:"description",children:m.description}),!!((k=m.images)!=null&&k.length)&&e.jsx(Kt,{className:"images",data:m.images,lazy:!0})]})}),children:y?m.children.map(h):null},m.id)};return e.jsx(Tr,{className:Bt(!p&&"no-children"),multiSelect:!0,defaultCollapseIcon:e.jsx(ws,{}),defaultExpandIcon:e.jsx(_s,{}),selected:i,children:o.map(m=>h(m))})}to.propTypes={data:s.array,value:s.array,onChange:s.func,disabled:s.bool};to.defaultProps={data:[],value:[],onChange:()=>{},disabled:!1};const Tr=Re(Ls)`
69
+ &.no-children {
70
+ .MuiTreeItem-content {
71
+ padding: 0;
72
+ .MuiTreeItem-iconContainer {
73
+ display: none;
74
+ }
75
+ .MuiTreeItem-label {
76
+ padding-left: 0;
77
+ }
78
+ }
79
+ }
80
+ .MuiTreeItem-content {
81
+ align-items: flex-start;
82
+ .MuiTreeItem-iconContainer {
83
+ transform: translateY(10px);
84
+ }
85
+ &.Mui-selected {
86
+ background-color: transparent;
87
+ }
88
+ }
89
+ .MuiTreeItem-label {
90
+ cursor: default;
91
+ }
92
+ .MuiFormControlLabel-root {
93
+ align-items: flex-start;
94
+ }
95
+ .content {
96
+ padding-top: 6px;
97
+ }
98
+ .name {
99
+ font-size: 16px;
100
+ font-weight: 700;
101
+ }
102
+ .resource-icon {
103
+ margin-right: 2px;
104
+ font-size: 16px;
105
+ }
106
+ img.resource-icon {
107
+ width: 1rem;
108
+ height: 1rem;
109
+ }
110
+ .link {
111
+ margin-left: 8px;
112
+ font-size: 16px;
113
+ color: ${({theme:t})=>t.palette.primary.main};
114
+ display: flex;
115
+ }
116
+ .link-icon {
117
+ font-size: inherit;
118
+ }
119
+ .description {
120
+ font-size: 14px;
121
+ color: ${({theme:t})=>t.palette.text.secondary};
122
+ }
123
+ `,Ao={},$r=(t,o,{key:n,cacheTime:r=1e3*3}={})=>{const i=n+JSON.stringify({params:o}),a=Ao[i];if(a&&a.timestamp>Date.now()-r)return a.promise;const l=t(...o);return Ao[i]={promise:l,timestamp:Date.now()},l},Dn=$r,In=(t,o)=>(t.forEach(n=>{o&&(n.parent=o),(n.children||[]).forEach(r=>{r.parent=n.id,In(r.children||[],r.id)})}),t),Tn=(t,o,n,r,i)=>{const{exportApi:a="/"}=(t==null?void 0:t.meta.resource)||{},l=new URL(pe("http://127.0.0.1",t==null?void 0:t.mountPoint,a||"/").replace(/\/+/g,"/"));return l.searchParams.set("projectId",o),l.searchParams.set("releaseId",n),l.searchParams.set("local",r),i&&l.searchParams.set("resourcesParams",i.searchParams.get("resourcesParams")),`${l.pathname}${l.search}`},Pr=async({api:t,appDid:o,component:n,projectId:r,releaseId:i,locale:a,initUrl:l,resources:u})=>{let d;if(l&&l.searchParams.get("resourcesParams"))try{d=JSON.parse(l.searchParams.get("resourcesParams"))}catch(x){M.error(x.message);return}await fn.post(Tn(n,r,i,a,l),{resources:u,projectId:r,releaseId:i,locale:a,...d?{resourcesParams:d}:{}},{headers:{"x-csrf-token":ks()},timeout:10*60*1e3}),await t.updateSelectedResources({input:{did:o,projectId:r,releaseId:"",componentDid:n.meta.did,resources:u}})},_r=(t,o)=>{if(!t)return{};const n=o.reduce((i,a)=>(i[a]=!0,i),{}),r=(i,a)=>(i.forEach(l=>{var u;n[l.id]&&((u=l.dependentComponents)!=null&&u.length)&&l.dependentComponents.forEach(d=>{a[d]=!0}),l.children&&r(l.children,a)}),a);return r(t,{})};function oo({app:t,component:o,projectId:n,release:r,loading:i,error:a,saveSelectedEventsRef:l,readOnly:u,componentDid:d,initialResources:x={},setResourceComponentsMap:b,selectedResourceIds:p,setSelectedResourceIds:h,showTree:m,initUrl:f}){var U;const{t:y,locale:v}=Z(),{api:g}=ke(),[k,S]=Xe({}),R=j.useRef({}),T=j.useRef(!1),D=r.id;R.current.projectId=n,R.current.releaseId=D;const B=(w,I,q)=>{if(!I)return;const P=_r(I,q);b==null||b({[w]:Object.keys(P)})},$=w=>{l.current[o.meta.did]={resources:w,component:o},h({[o.meta.did]:w}),B(o.meta.did,k[o.meta.did],w)},z=j.useCallback(async w=>{var I;try{const q=await Dn(fn.get,[Tn(w,n,D,v,f),{timeout:6e4}],{key:"getResources"});return In(((I=q==null?void 0:q.data)==null?void 0:I.resources)||[])}catch{return[]}},[n,D,v,f]);j.useEffect(()=>{k[o==null?void 0:o.meta.did]||z(o).then(w=>{S({[o==null?void 0:o.meta.did]:w})}).catch(w=>{M.error(w.message)})},[o,S,k,z]),j.useEffect(()=>{D&&n&&!T.current&&it(t.children.map(w=>async()=>{var I,q;if(!(d&&d!==w.meta.did)&&!(!(w!=null&&w.mountPoint)||!us.hasStartEngine(w==null?void 0:w.meta)||!((q=(I=w==null?void 0:w.meta)==null?void 0:I.resource)!=null&&q.exportApi)))try{const P=await z(w);S({[w==null?void 0:w.meta.did]:P});const A=await g.getSelectedResources({input:{did:t.meta.did,projectId:n,releaseId:D,componentDid:w.meta.did}}),H=(A==null?void 0:A.resources)||[];H!=null&&H.length&&(h({[w.meta.did]:Dr(P,H)}),B(w.meta.did,P,H),u||(l.current[w==null?void 0:w.meta.did]={resources:H,component:w}))}catch(P){M.error(P.message)}}),{concurrency:2}).then(()=>{T.current=!0})},[D,n,u,v,f,S]),j.useEffect(()=>{x&&Object.keys(x).length&&it(t.children.map(async w=>{const I=x[w.meta.did];if(I!=null&&I.length){const q=await z(w);h({[w.meta.did]:I}),B(w.meta.did,q,I),u||(l.current[w==null?void 0:w.meta.did]={resources:I,component:w})}}))},[t,x,u]);let J=null;return(!o||!((U=k[o.meta.did])!=null&&U.length))&&(J=e.jsx(Ue,{Icon:Vt,children:y("blocklet.publish.resourceEmptyTip",{name:Io.getDisplayName(o)})})),(o==null?void 0:o.status)!=="running"&&(J=e.jsx(Ue,{children:y("blocklet.publish.componentNotRunning",{name:Io.getDisplayName(o)})})),e.jsxs(e.Fragment,{children:[e.jsx(Er,{className:Bt(a&&"error"),children:m&&e.jsx(c,{pb:2,width:"100%",children:J||e.jsx(to,{data:k[o.meta.did]||[],value:p[o.meta.did]||[],onChange:$,disabled:i||u})})}),!!a&&e.jsx(c,{color:"error.main",mt:1,fontSize:14,children:a})]})}oo.propTypes={component:s.object.isRequired,app:s.object.isRequired,projectId:s.string.isRequired,error:s.string,saveSelectedEventsRef:s.object.isRequired,readOnly:s.bool.isRequired,loading:s.bool.isRequired,release:s.shape({id:s.string.isRequired,status:s.string}),initialResources:s.object,initUrl:s.object,setResourceComponentsMap:s.func,componentDid:s.string,selectedResourceIds:s.object.isRequired,setSelectedResourceIds:s.func.isRequired,showTree:s.bool.isRequired};oo.defaultProps={error:"",release:{id:""},initUrl:null,initialResources:{},setResourceComponentsMap:()=>{},componentDid:""};const Er=Re(c)`
124
+ border: 1px solid;
125
+ border-color: ${({theme:t})=>t.palette.divider};
126
+ max-height: 600px;
127
+ width: 100%;
128
+ &.error {
129
+ border-color: ${({theme:t})=>t.palette.error.main};
130
+ }
131
+ border-radius: 4px;
132
+ padding: 16px;
133
+ padding-bottom: 0px;
134
+ overflow-y: auto;
135
+ .footer {
136
+ border-top: 1px solid #ddd;
137
+ display: flex;
138
+ padding: 12px 0;
139
+ margin-top: 12px;
140
+ position: sticky;
141
+ bottom: 0;
142
+ background: #fff;
143
+ z-index: 10;
144
+ }
145
+ `;var no={},Lr=Ie;Object.defineProperty(no,"__esModule",{value:!0});var $t=no.default=void 0,qr=Lr($e()),Nr=e;$t=no.default=(0,qr.default)((0,Nr.jsx)("path",{d:"M11 18c0 1.1-.9 2-2 2s-2-.9-2-2 .9-2 2-2 2 .9 2 2m-2-8c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m0-6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m6 4c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2m0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2"}),"DragIndicator");const zo="lastWantToConnectStoreId";function Ar(t){var u,d;const[o,n]=j.useState(null),{session:r}=Fe(),i=j.useCallback(x=>{n(x),localStorage.setItem(zo,x==null?void 0:x.id)},[n]),a=j.useMemo(()=>{var h,m,f,y;const x=localStorage.getItem(zo),b=x?(((h=t==null?void 0:t.settings)==null?void 0:h.storeList)||[]).find(v=>v.id===x):null;if(b)return b;let p=(((m=t==null?void 0:t.settings)==null?void 0:m.storeList)||[]).find(v=>{var g;return!(v.id!==Y.BLOCKLET_STORE.id||v.scope&&v.scope!=="studio"&&v.scope!==((g=r==null?void 0:r.user)==null?void 0:g.did))});return p||(p=(y=(f=t==null?void 0:t.settings)==null?void 0:f.storeList)==null?void 0:y[0]),p},[(u=t==null?void 0:t.settings)==null?void 0:u.storeList,(d=r==null?void 0:r.user)==null?void 0:d.did]);return[o||a||{},i]}const Dt={};async function so(t,{interval:o=1e3,maxDuration:n=120*1e3,intervalFirst:r=4e3,timerKey:i=""}){Dt[i]&&clearTimeout(Dt[i]),await new Promise(u=>setTimeout(u,r));const a=Date.now(),l=async(u,d)=>{try{const x=await t();u(x)}catch(x){Date.now()-a>n?d(x):i?Dt[i]=setTimeout(()=>l(u,d),o):setTimeout(()=>l(u,d),o)}};return new Promise(l)}function zr(){return Math.random().toString(36).slice(2)+Math.random().toString(36).slice(2)+`${Date.now()}`.slice(-6)}function Or(t,{did:o,projectId:n,messageId:r}){return so(async()=>{var a;const i=await t.getProject({input:{did:o,projectId:n,messageId:r}});if(!((a=i==null?void 0:i.project)!=null&&a.blockletDid))throw new Error("Connected store not found");return i.project.blockletDid},{timerKey:"connect-studio"})}function Wr(t,{did:o,projectId:n,storeId:r}){return so(async()=>{var l,u;const i=await t.getProject({input:{did:o,projectId:n,messageId:""}});if(!((u=(l=i==null?void 0:i.project)==null?void 0:l.connectedStores)!=null&&u.length))throw new Error("Connected store not found");if(!i.project.connectedStores.find(d=>d.storeId===r))throw new Error("Connected store not found")},{timerKey:`connect-store-${r}`})}function Br(t,{did:o,projectId:n,endpointId:r}){return so(async()=>{var l,u;const i=await t.getProject({input:{did:o,projectId:n,messageId:""}});if(!((u=(l=i==null?void 0:i.project)==null?void 0:l.connectedEndpoints)!=null&&u.length))throw new Error("Connected endpoint not found");if(!i.project.connectedEndpoints.find(d=>d.endpointId===r))throw new Error("Connected endpoint not found")},{timerKey:`connect-store-${r}`})}const Mr=({fromBlocklet:t,nodeInfo:o,blocklet:n,userDid:r})=>{var l,u;const i=t?(l=n==null?void 0:n.meta)==null?void 0:l.did:o==null?void 0:o.did;let a=t?((u=n==null?void 0:n.settings)==null?void 0:u.storeList)||[]:(o==null?void 0:o.blockletRegistryList)||[];return Array.isArray(a)||(a=[]),a=a.filter(d=>d.protected||!d.scope||d.scope==="studio"||d.scope===r),{teamDid:i,storeList:a}},ro=Mr;function lo({blocklet:t,store:o={},onChangeStore:n,onClick:r,disabled:i,loading:a,componentDid:l}){var w,I,q;const{t:u}=Z(),{session:d}=Fe(),{api:x,info:b,inService:p}=ke(),h=Te(),[m,f]=j.useState(!1),y=j.useRef(null),[v,g]=j.useState(!1),[k,S]=j.useState(null),R=P=>{n(P),f(!1)},T=()=>{f(!m)},D=P=>{y.current&&y.current.contains(P.target)||f(!1)},B=()=>{g(!0)},$=()=>{g(!1)},z=async()=>{var P;if(k)try{await x.deleteBlockletStore({input:{teamDid:t.meta.did,url:k.url,projectId:"",scope:k.scope||"studio"}}),await((P=h==null?void 0:h.actions)==null?void 0:P.refreshBlocklet())}catch(A){M.error(`Remove Blocklet Store Error: ${je(A)}`)}finally{S(null)}},{storeList:J}=ro({fromBlocklet:p,blocklet:t,nodeInfo:b,componentDid:l,userDid:(w=d==null?void 0:d.user)==null?void 0:w.did}),U=(I=t==null?void 0:t.meta)==null?void 0:I.did;return e.jsxs(e.Fragment,{children:[e.jsxs(st,{disabled:i,ref:y,variant:"contained",color:"primary","aria-label":"Button group with connect store",children:[e.jsxs(ee,{onClick:r,children:[a&&e.jsx(Se,{size:14,sx:{mr:.5}}),`${u("common.connect")} ${o.name||""}`]}),e.jsx(ee,{size:"small","aria-controls":m?"split-button-menu":void 0,"aria-expanded":m?"true":void 0,"aria-label":"select merge strategy","aria-haspopup":"menu",onClick:T,children:e.jsx(Fs,{})})]}),e.jsx(Go,{sx:{zIndex:10},open:m,anchorEl:y.current,placement:"bottom-end",role:void 0,transition:!0,disablePortal:!0,children:({TransitionProps:P})=>e.jsx(Xo,{...P,style:{transformOrigin:"center top"},children:e.jsx(qt,{children:e.jsx(Yo,{onClickAway:D,children:e.jsxs(Qo,{id:"split-button-menu",autoFocusItem:!0,sx:{maxHeight:300,overflowY:"auto",zIndex:10},children:[J==null?void 0:J.map(A=>{var H;return e.jsxs(be,{selected:A.id===(o==null?void 0:o.id),sx:{height:56},onClick:()=>R(A),children:[e.jsxs(c,{children:[e.jsx(De,{sx:{fontSize:"16px"},maxLength:24,children:A.name}),e.jsx(De,{sx:{fontSize:"13px",opacity:.6},maxLength:30,children:A.url})]}),qs({store:A,userDid:(H=d==null?void 0:d.user)==null?void 0:H.did})&&e.jsx(de,{sx:{ml:1},onClick:C=>{C.preventDefault(),C.stopPropagation(),S(A)},children:e.jsx(ue,{icon:"ic:outline-delete"})})]},A.url)}),e.jsx(Qn,{}),e.jsxs(be,{onClick:B,children:[e.jsx(bt,{font:!0}),e.jsx(N,{variant:"inherit",children:u("store.blockletRegistry.addRegistry")})]})]})})})})}),v&&e.jsx(mn,{hiddenChildren:!0,open:!0,onClose:$,teamDid:U,storeList:J,scope:"studio",onAdd:(q=h==null?void 0:h.actions)==null?void 0:q.refreshBlocklet}),k&&e.jsx(mt,{displayError:!0,title:`${u("common.delete")} ${k.name}`,description:u("blocklet.publish.deleteStoreTip",{name:k.name}),confirm:u("common.confirm"),onConfirm:z,onCancel:()=>S(null)})]})}lo.propTypes={store:s.object,blocklet:s.object,onChangeStore:s.func.isRequired,onClick:s.func.isRequired,loading:s.bool.isRequired,disabled:s.bool.isRequired,componentDid:s.string.isRequired,projectType:s.string.isRequired,getData:s.func.isRequired};lo.defaultProps={store:null,blocklet:null};const Vr=(t,o,n)=>{const r=`${Y.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${o.meta.did}/${n}/logo/upload`,i=`${Y.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${o.meta.did}/${n}/screenshot/upload`,a=t!=null&&t.blockletLogo?`${r}/${t.blockletLogo}`:`${Y.WELLKNOWN_SERVICE_PATH_PREFIX}/static/images/logo.png`,l=((t==null?void 0:t.blockletScreenshots)||[]).filter(Boolean).map(u=>`${i}/${u}`);return{logoUrl:a,screenshotUrls:l,uploadLogoPrefix:r,uploadScreenshotPrefix:i}},$n=Vr,Ur=t=>{const o=t.includes("youtube.com")||t.includes("youtu.be"),n=t.includes("vimeo.com");return o||n};function xt({url:t,style:o,controls:n,modestbranding:r}){var u;const{t:i}=Z(),a=t.includes("youtube.com")||t.includes("youtu.be"),l=t.includes("vimeo.com");if(a){const d=((u=t.split("v=")[1])==null?void 0:u.split("&")[0])||t.split("/").pop();return e.jsx("div",{style:{position:"relative",width:"100%",paddingTop:"56.25%",pointerEvents:(o==null?void 0:o.pointerEvents)||"auto"},children:e.jsx("iframe",{src:`https://www.youtube.com/embed/${d}?modestbranding=${r}&controls=${n}&rel=0`,title:"YouTube video player",style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",border:"none",...o},allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0})})}if(l){const d=t.split("/").pop();return e.jsx("div",{style:{position:"relative",width:"100%",paddingTop:"56.25%",pointerEvents:o.pointerEvents||"auto"},children:e.jsx("iframe",{src:`https://player.vimeo.com/video/${d}`,title:"Vimeo video player",style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",border:"none",...o},allow:"autoplay; fullscreen; picture-in-picture",allowFullScreen:!0})})}return e.jsx(c,{style:{position:"relative",width:"100%",paddingTop:"56.25%"},children:e.jsxs(c,{style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",border:"none",backgroundColor:"rgba(0, 0, 0, 0.04)",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",...o},allow:"autoplay; fullscreen; picture-in-picture",allowFullScreen:!0,children:[e.jsx(ue,{icon:"carbon:video-off",style:{fontSize:40,marginBottom:"10px",opacity:.5}}),e.jsx(N,{variant:"body1",sx:{opacity:.5},children:i("studio.videoDialogNoSrc")})]})})}xt.propTypes={url:s.string.isRequired,style:s.object,controls:s.number,modestbranding:s.number};xt.defaultProps={style:{},controls:1,modestbranding:1};function Pn({setParams:t,onClose:o,params:n}){const{t:r}=Z(),[i,a]=j.useState(""),l=i&&n.blockletVideos.includes(i),u=Ur(i),d=()=>{t(x=>{const b=[...x.blockletVideos];return b.push(i),{...x,blockletVideos:b}}),o()};return e.jsxs(pt,{open:!0,fullWidth:!0,maxWidth:"sm",children:[e.jsx(Zo,{children:r("studio.videoDialogTitle")}),e.jsxs(Ko,{children:[e.jsx(Zn,{fullWidth:!0,value:i,onChange:x=>a(x.target.value),placeholder:r("studio.videoInputLabel"),endAdornment:i?e.jsx(Ye,{position:"end",children:e.jsx(de,{onClick:()=>a(""),children:e.jsx(ys,{})})}):null,error:l}),l&&e.jsx(N,{variant:"body2",color:"error",children:r("studio.duplicateVideo")}),e.jsx(xt,{url:i,style:{marginTop:"20px",borderRadius:"4px"}})]}),e.jsxs(en,{children:[e.jsx(ee,{onClick:()=>o(),children:r("studio.cancel")}),e.jsx(ee,{disabled:!u||l,onClick:d,children:r("studio.confirm")})]})]})}Pn.propTypes={onClose:s.func.isRequired,params:s.object.isRequired,setParams:s.func.isRequired};function Pt({errors:t,storeList:o,...n}){const{t:r}=Z();return e.jsxs(c,{...n,color:"warning.main",fontSize:"14px",sx:{border:"1px solid rgba(214, 164, 64, 0.34)",borderRadius:"4px",py:2,px:1.5,position:"relative"},children:[e.jsx(N,{variant:"caption",sx:{fontWeight:"bold",position:"absolute",top:-10,left:12,backgroundColor:"white",px:1,width:"fit-content"},children:r("blocklet.publish.storeRule.warning")}),t&&Object.entries(t).map(([i,a])=>{const l=Object.values(a),u=o.find(d=>d.url===i);return l.length>0&&e.jsxs(c,{children:[e.jsx(ye,{title:i,children:e.jsx(c,{component:"span",sx:{cursor:"pointer"},children:u.name})}),l.map(d=>e.jsx(c,{component:"li",ml:2,sx:{wordBreak:!0},children:d},d))]},i)})]})}Pt.propTypes={errors:s.object.isRequired,storeList:s.array.isRequired};const Oo=j.lazy(()=>hn(()=>import("./index-Bi8r1T8R.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13])).then(t=>({default:t.Uploader})));function io({projectId:t,readOnly:o,loading:n,blocklet:r,params:i,setParams:a,paramsErrTip:l,setParamsErrTip:u,warning:d,setLoading:x,initUrl:b,initLogoUrl:p,setInitLogoUrl:h,componentDid:m}){const{t:f,locale:y}=Z(),{api:v}=ke(),g=Et(),k=j.useRef(null),S=j.useRef(null),[R,T]=Ar(r),[D,B]=j.useState(!1),$=xn({messageType:"connect-store-message",onOpen:()=>x(!0),onClose:()=>x(!1)}),z=async E=>{const Q=setTimeout(()=>{x(!1)},2e4),X=await Or(v,E);x(!1),clearTimeout(Q),window.parent.postMessage({event:"studioDialog.connected",componentDid:m},"*"),g(window.location.pathname.replace(`${Y.UNOWNED_DID}/create`,`${X}/create`),{replace:!0})},J=()=>{if(!i.blockletTitle){M.error(f("blocklet.publish.errorTip.noTitle"));return}if(!(R!=null&&R.url)){M.error(f("blocklet.publish.noStoreSelected"));return}const E=zr();$(async(Q,X)=>{var oe,le,te;try{const ne=await v.connectByStudio({input:{did:(oe=r==null?void 0:r.meta)==null?void 0:oe.did,blockletTitle:i==null?void 0:i.blockletTitle,storeUrl:R.url,storeId:R.id,storeName:R.name,type:((le=i==null?void 0:i.blockletComponents)==null?void 0:le.length)>0?"pack":"resource",componentDid:m,messageId:E,tenantScope:(b==null?void 0:b.searchParams.get("tenantScope"))||""}});if(!(ne!=null&&ne.url)){M.error("failed to connect to store");return}X(ne.url),z({did:(te=r==null?void 0:r.meta)==null?void 0:te.did,projectId:"",messageId:E})}catch(ne){const ae=je(ne);M.error(ae),x(!1)}})},{logoUrl:U,screenshotUrls:w,uploadLogoPrefix:I,uploadScreenshotPrefix:q}=$n(i,r,t),{logoErrors:P,screenshotErrors:A,storeList:H,hasLogoWarning:C,hasScreenshotWarning:_}=d,G=()=>o?!1:!t||t===Y.UNOWNED_DID?(M.error(f("blocklet.publish.errorTip.noFirstDid")),!1):!0,F=E=>{if(!E.destination)return;const Q=Array.from(i.blockletScreenshots),[X]=Q.splice(E.source.index,1);Q.splice(E.destination.index,0,X),a(oe=>({...oe,blockletScreenshots:Q}))},K=E=>{if(!E.destination)return;const Q=Array.from(i.blockletVideos),[X]=Q.splice(E.source.index,1);Q.splice(E.destination.index,0,X),a(oe=>({...oe,blockletVideos:Q}))};return e.jsxs(Fr,{children:[e.jsx(c,{display:"flex",className:"section",children:e.jsxs(c,{sx:{flex:1},children:[e.jsx(re,{disabled:n||o,label:`Blocklet ${f("common.title")}`,placeholder:`Blocklet ${f("common.title")}`,InputProps:{"data-cy":"blocklet-title",readOnly:o},autoComplete:"off",variant:"outlined",fullWidth:!0,required:!0,value:i.blockletTitle||"",onChange:E=>{u({blockletTitle:""}),a({blockletTitle:E.target.value})},error:!!l.blockletTitle,helperText:l.blockletTitle||""}),e.jsx(re,{required:!0,label:"Blocklet DID",fullWidth:!0,readonly:!0,disabled:!0,autoComplete:"off",variant:"outlined",InputProps:{"data-cy":"export-blocklet-did",endAdornment:t===Y.UNOWNED_DID&&e.jsx(Ye,{position:"end",children:e.jsx(lo,{blocklet:r,store:R,componentDid:m,onChangeStore:T,disabled:!i.blockletTitle||o||n,loading:n,onClick:J})})},error:!!l.projectId,helperText:l.projectId||"",value:t===Y.UNOWNED_DID?"":`did:abt:${t}`,sx:{mt:3}}),e.jsx(re,{disabled:n||o,label:`Blocklet ${f("common.description")}`,placeholder:`Blocklet ${f("common.description")}`,InputProps:{"data-cy":"blocklet-description",readOnly:o},required:!0,autoComplete:"off",variant:"outlined",fullWidth:!0,value:i.blockletDescription||"",onChange:E=>{u({blockletDescription:""}),a({blockletDescription:E.target.value.slice(0,159)})},error:!!l.blockletDescription,helperText:l.blockletDescription||"",sx:{mt:3}}),e.jsx(re,{disabled:n||o,label:`Blocklet ${f("common.homepageTip")}`,placeholder:`Blocklet ${f("common.homepageTip")}`,InputProps:{"data-cy":"blocklet-homepage",readOnly:o},autoComplete:"off",variant:"outlined",fullWidth:!0,value:i.blockletHomepage||"",onChange:E=>{E.target.value&&!/^(http|https):\/\//.test(E.target.value)?u({blockletHomepage:f("blocklet.publish.errorTip.invalidUrl")}):u({blockletHomepage:""}),a({blockletHomepage:E.target.value})},error:!!l.blockletHomepage,helperText:l.blockletHomepage||"",sx:{mt:3}}),e.jsx(re,{disabled:n||o,label:`Blocklet ${f("common.community")}`,placeholder:`Blocklet ${f("common.community")}`,InputProps:{"data-cy":"blocklet-community",readOnly:o},autoComplete:"off",variant:"outlined",fullWidth:!0,value:i.blockletCommunity||"",onChange:E=>{E.target.value&&!/^(http|https):\/\//.test(E.target.value)?u({blockletCommunity:f("blocklet.publish.errorTip.invalidUrl")}):u({blockletCommunity:""}),a({blockletCommunity:E.target.value})},error:!!l.blockletCommunity,helperText:l.blockletCommunity||"",sx:{mt:3}}),e.jsx(re,{disabled:n||o,label:`Blocklet ${f("common.support")}`,placeholder:`Blocklet ${f("common.support")}`,InputProps:{"data-cy":"blocklet-support",readOnly:o},autoComplete:"off",variant:"outlined",fullWidth:!0,value:i.blockletSupport||"",onChange:E=>{E.target.value&&!/^(http|https):\/\//.test(E.target.value)&&!/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/.test(E.target.value)?u({blockletSupport:f("blocklet.publish.errorTip.invalidUrlOrEmail")}):u({blockletSupport:""}),a({blockletSupport:E.target.value})},error:!!l.blockletSupport,helperText:l.blockletSupport||"",sx:{mt:3}}),e.jsx(re,{disabled:n||o,label:`Blocklet ${f("common.repository")}`,placeholder:`Blocklet ${f("common.repository")}`,InputProps:{"data-cy":"blocklet-repository",readOnly:o},autoComplete:"off",variant:"outlined",fullWidth:!0,value:i.blockletRepository||"",onChange:E=>{E.target.value&&!/^(git|https|svn)/.test(E.target.value)?u({blockletRepository:f("blocklet.publish.errorTip.invalidUrl")}):u({blockletRepository:""}),a({blockletRepository:E.target.value})},error:!!l.blockletRepository,helperText:l.blockletRepository||"",sx:{mt:3}})]})}),e.jsx(c,{display:"flex",mt:3,className:"section full-width",children:e.jsxs(c,{flex:1,overflow:"hidden",children:[e.jsxs(c,{display:"flex",flexDirection:"row",flexWrap:"wrap",children:[e.jsxs(Ce,{direction:"column",spacing:1,sx:{mr:2,width:"160px"},children:[e.jsx(N,{variant:"subtitle1",sx:{fontWeight:"bold"},children:f("common.logo")}),e.jsxs(Ce,{direction:"column",alignItems:"flex-start",spacing:1,sx:{opacity:.8,fontSize:"12px"},children:[e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"text.secondary"},children:[f("studio.type"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"secondary.main"},children:"png, jpg, webp, svg"})]})}),e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"text.secondary"},children:[f("studio.ratio"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"secondary.main"},children:"256x256"})]})}),e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"text.secondary"},children:[f("studio.size"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"secondary.main"},children:"<500Kb"})]})})]})]}),e.jsx(c,{sx:{flex:1,cursor:o?"default":"pointer",display:"flex",alignItems:"flex-end"},children:e.jsx(Lt,{variant:"square",sx:{width:80,height:80},alt:"Blocklet Logo",src:p||U,onClick:()=>{var E;G()&&((E=k.current)==null||E.open())}})})]}),C&&e.jsx(Pt,{errors:P,storeList:H,mt:3}),e.jsxs(c,{display:"flex",mt:3,flexDirection:"row",flexWrap:"wrap",children:[e.jsxs(Ce,{direction:"column",spacing:1,sx:{mr:2,width:"160px"},children:[e.jsx(N,{variant:"subtitle1",sx:{fontWeight:"bold"},children:f("common.screenshot")}),e.jsxs(Ce,{direction:"column",alignItems:"flex-start",spacing:1,sx:{opacity:.8,fontSize:"12px"},children:[e.jsx(c,{sx:{border:"none"},variant:"outlined",size:"small",children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"text.secondary"},children:[f("studio.ratio"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"secondary.main"},children:"16 / 9"})]})}),e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"text.secondary"},children:[f("studio.count"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"secondary.main"},children:"1~5"})]})}),e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"text.secondary"},children:[f("studio.size"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"secondary.main"},children:"<5MB"})]})}),!o&&e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"text.secondary"},children:[f("studio.order"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"secondary.main"},children:f("studio.orderTip")})]})})]})]}),e.jsx($o,{onDragEnd:o?void 0:F,children:e.jsx(Po,{droppableId:"screenshots",direction:"horizontal",isDropDisabled:o,children:(E,Q)=>e.jsxs(c,{display:"flex",alignItems:"center",sx:{flex:1,flexWrap:"wrap",minHeight:160,background:Q.isDraggingOver?"grey.100":"transparent",transition:"background-color 0.2s ease",border:Q.isDraggingOver?"2px dashed #999":"none",borderRadius:"4px"},ref:E.innerRef,...E.droppableProps,children:[w.map((X,oe)=>e.jsx(_o,{draggableId:X,index:oe,isDragDisabled:o,children:(le,te)=>e.jsxs(c,{ref:le.innerRef,...le.draggableProps,className:"screenshot",sx:{transform:te.isDragging?"scale(1.05)":"none",boxShadow:te.isDragging?"0 5px 10px rgba(0,0,0,0.15)":"none",transition:"transform 0.2s ease, box-shadow 0.2s ease"},children:[e.jsx("img",{alt:"screenshot",src:X}),!o&&e.jsx(de,{...le.dragHandleProps,className:"action",style:{right:40,zIndex:10,color:"#fff"},children:e.jsx($t,{})}),!o&&e.jsx(de,{className:"action",onClick:()=>{a(ne=>{const ae=[...ne.blockletScreenshots];return ae.splice(oe,1),{...ne,blockletScreenshots:ae}})},children:e.jsx(lt,{})})]})},X)),E.placeholder,w.length<5&&e.jsx(c,{sx:{width:240,height:135,background:"#eee",cursor:o?"default":"pointer",color:"#999",mb:2},display:"flex",justifyContent:"center",alignItems:"center",fontSize:40,onClick:()=>{var X;G()&&((X=S.current)==null||X.open())},children:"+"})]})})})]}),_&&e.jsx(Pt,{errors:A,storeList:H}),e.jsxs(c,{display:"flex",mt:3,flexDirection:"row",flexWrap:"wrap",children:[e.jsxs(Ce,{direction:"column",spacing:1,sx:{mr:2,width:"160px"},children:[e.jsx(N,{variant:"subtitle1",sx:{fontWeight:"bold"},children:f("studio.video")}),e.jsxs(Ce,{direction:"column",alignItems:"flex-start",spacing:1,sx:{opacity:.8,fontSize:"12px"},children:[e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"text.secondary"},children:[f("studio.videoType"),":"," "]}),e.jsxs(c,{component:"span",sx:{color:"secondary.main"},children:[e.jsx("a",{href:"https://www.youtube.com/",target:"_blank",rel:"noreferrer",children:"Youtube"}),","," ",e.jsx("a",{href:"https://vimeo.com/",target:"_blank",rel:"noreferrer",children:"Vimeo"})]})]})}),e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"text.secondary"},children:[f("studio.count"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"secondary.main"},children:"1~3"})]})}),!o&&e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"text.secondary"},children:[f("studio.order"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"secondary.main"},children:f("studio.orderTip")})]})})]})]}),e.jsx($o,{onDragEnd:o?void 0:K,children:e.jsx(Po,{droppableId:"videos",direction:"horizontal",isDropDisabled:o,children:(E,Q)=>e.jsxs(c,{display:"flex",alignItems:"center",sx:{flex:1,flexWrap:"wrap",minHeight:160,background:Q.isDraggingOver?"#f5f5f5":"transparent",transition:"background-color 0.2s ease",border:Q.isDraggingOver?"2px dashed #999":"none",borderRadius:"4px"},ref:E.innerRef,...E.droppableProps,children:[i.blockletVideos.map((X,oe)=>e.jsx(_o,{draggableId:X,index:oe,isDragDisabled:o,children:(le,te)=>e.jsxs(c,{ref:le.innerRef,...le.draggableProps,className:"screenshot",sx:{transform:te.isDragging?"scale(1.05)":"none",boxShadow:te.isDragging?"0 5px 10px rgba(0,0,0,0.15)":"none",transition:"transform 0.2s ease, box-shadow 0.2s ease"},children:[e.jsx(xt,{url:X,style:{pointerEvents:te.isDragging?"none":"auto"}}),!o&&e.jsx(de,{...le.dragHandleProps,className:"action",style:{right:40,zIndex:10,color:"#fff"},children:e.jsx($t,{})}),!o&&e.jsx(de,{className:"action",onClick:()=>{a(ne=>{const ae=[...ne.blockletVideos];return ae.splice(oe,1),{...ne,blockletVideos:ae}})},children:e.jsx(lt,{})})]})},X)),E.placeholder,i.blockletVideos.length<3&&e.jsx(c,{sx:{width:240,height:135,background:"#eee",cursor:o?"default":"pointer",color:"#999",mb:2},display:"flex",justifyContent:"center",alignItems:"center",fontSize:40,onClick:()=>{G()&&B(!0)},children:"+"})]})})})]})]})}),e.jsxs(j.Suspense,{fallback:e.jsx(Qe,{}),children:[e.jsx(Oo,{ref:k,locale:y,popup:!0,onUploadFinish:E=>{var Q;a({blockletLogo:E.data.filename}),h(""),(Q=k.current)==null||Q.close()},plugins:["ImageEditor"],installerProps:{disabled:!0},apiPathProps:{uploader:I,disableMediaKitPrefix:!0,disableMediaKitStatus:!0},coreProps:{restrictions:{allowedFileTypes:["image/png","image/jpeg","image/webp","image/svg+xml"],maxFileSize:1024*1024*.5,maxNumberOfFiles:1}},dashboardProps:{autoOpen:"imageEditor"},imageEditorProps:{actions:{revert:!0,rotate:!0,granularRotate:!0,flip:!0,zoomIn:!0,zoomOut:!0,cropSquare:!1,cropWidescreen:!1,cropWidescreenVertical:!1},cropperOptions:{autoCrop:!0,aspectRatio:1,initialAspectRatio:1,autoCropArea:1,croppedCanvasOptions:{minWidth:256,minHeight:256}}}},"uploader-logo"),D&&e.jsx(Pn,{onClose:()=>B(!1),params:i,setParams:a}),e.jsx(Oo,{ref:S,locale:y,popup:!0,onUploadFinish:E=>{var Q;a(X=>{var le;const oe=X.blockletScreenshots||[];return oe.push((le=E.data)==null?void 0:le.filename),{...X,blockletScreenshots:oe}}),(Q=S.current)==null||Q.close()},installerProps:{disabled:!0},plugins:["ImageEditor"],apiPathProps:{uploader:q,disableMediaKitPrefix:!0,disableMediaKitStatus:!0},coreProps:{restrictions:{allowedFileTypes:["image/*","image/svg+xml"],maxFileSize:1024*1024*5,maxNumberOfFiles:5-w.length}},imageEditorProps:{actions:{revert:!0,rotate:!0,granularRotate:!0,flip:!0,zoomIn:!0,zoomOut:!0,cropSquare:!1,cropWidescreen:!1,cropWidescreenVertical:!1},cropperOptions:{autoCrop:!0,autoCropArea:1,aspectRatio:16/9,initialAspectRatio:16/9,croppedCanvasOptions:{minWidth:1280,minHeight:720,maxWidth:1280*2,maxHeight:720*2}}}},"uploader-screenshot")]})]})}io.propTypes={projectId:s.string.isRequired,readOnly:s.bool.isRequired,params:s.object.isRequired,setParams:s.func.isRequired,paramsErrTip:s.object.isRequired,setParamsErrTip:s.func.isRequired,warning:s.object.isRequired,loading:s.bool.isRequired,blocklet:s.object.isRequired,setLoading:s.func.isRequired,initUrl:s.object,componentDid:s.string,initLogoUrl:s.string.isRequired,setInitLogoUrl:s.func.isRequired};io.defaultProps={initUrl:null,componentDid:""};const Fr=Re.div`
146
+ margin-top: 24px;
147
+ .screenshot {
148
+ margin-bottom: 16px;
149
+ max-width: 240px;
150
+ max-height: 135px;
151
+ width: 240px;
152
+ height: 135px;
153
+ overflow: hidden;
154
+ display: flex;
155
+ align-items: center;
156
+ justify-content: center;
157
+ background-color: #eee;
158
+ margin-right: 16px;
159
+ position: relative;
160
+ .action {
161
+ visibility: hidden;
162
+ position: absolute;
163
+ width: 42px;
164
+ height: 42px;
165
+ right: 6px;
166
+ top: 6px;
167
+ border-radius: 4px;
168
+ background-color: rgba(0, 0, 0, 1);
169
+ color: rgba(255, 255, 255, 1);
170
+ }
171
+ &:hover .action {
172
+ visibility: visible;
173
+ }
174
+ }
175
+ .screenshot img {
176
+ width: 100%; /* 图像宽度填充容器 */
177
+ height: auto; /* 图像高度自适应 */
178
+ }
179
+ `;var co={},Hr=Ie;Object.defineProperty(co,"__esModule",{value:!0});var _n=co.default=void 0,Jr=Hr($e()),Gr=e;_n=co.default=(0,Jr.default)((0,Gr.jsx)("path",{d:"M19.35 10.04C18.67 6.59 15.64 4 12 4 9.11 4 6.6 5.64 5.35 8.04 2.34 8.36 0 10.91 0 14c0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5 0-2.64-2.05-4.78-4.65-4.96M14 13v4h-4v-4H7l4.65-4.65c.2-.2.51-.2.71 0L17 13z"}),"CloudUploadRounded");const Xr=(t,o,n,r)=>{const i=t?[...t]:[],a=((o==null?void 0:o.children)||[]).reduce((l,u)=>(l[u.meta.did]=!0,l),{});return Object.keys(n).forEach(l=>{if(!a[l])return;let u=!1;r||i.forEach(d=>{d.did===l&&(d.included=!0,d.required=!0,u=!0)}),u||i.push({did:l,included:!0,required:!0})}),i},Yr=async t=>{if(typeof t!="string")throw new Error("URL must be a string");try{const o=t.split("/").pop().split("?")[0],r=await(await fetch(t)).blob();return new File([r],o,{type:r.type})}catch{throw new Error("Failed to convert Logo URL to file")}};function*Qr(t,o){let n=0;for(;n<t.size;)yield t.slice(n,n+o),n+=o}const Zr=async({did:t,projectId:o,uploadType:n="logo",imageUrl:r})=>{const i=await Yr(r);new FormData().append("file",i);const l={uploaderId:"Uploader",relativePath:encodeURIComponent(i.name),name:encodeURIComponent(i.name),type:i.type},d=(await To.post(pe(Y.WELLKNOWN_SERVICE_PATH_PREFIX,"/api/project",t,o,n,"upload"),null,{headers:{"Tus-Resumable":"1.0.0","Upload-Length":i.size,"X-Uploader-File-Ext":i.name.split(".").pop(),"Upload-Metadata":Object.keys(l).map(h=>`${h} ${btoa(l[h])}`).join(",")}})).headers.location,x=2*1024*1024;let b=0,p="";for(const h of Qr(i,x)){const m=await To.patch(pe(Y.WELLKNOWN_SERVICE_PATH_PREFIX,d),h,{headers:{"Tus-Resumable":"1.0.0","Upload-Offset":b,"Content-Type":"application/offset+octet-stream"}});b+=h.size,p=m.data.filename}return p},En=({params:t,projectId:o,status:n,t:r})=>{const i=[];return t.blockletTitle||i.push({param:"blockletTitle",message:r("blocklet.publish.errorTip.noTitle")}),(!o||o===Y.UNOWNED_DID)&&i.push({param:"projectId",message:r("blocklet.publish.errorTip.noDid")}),t.blockletVersion?Me.valid(t.blockletVersion)||i.push({param:"blockletVersion",message:r("blocklet.publish.errorTip.inValidVersion")}):i.push({param:"blockletVersion",message:r("blocklet.publish.errorTip.noVersion")}),n===fe.PROJECT.RELEASE_STATUS.published&&(t.blockletDescription||i.push({param:"blockletDescription",message:r("blocklet.publish.errorTip.noDescription")}),t.note||i.push({param:"note",message:r("blocklet.publish.errorTip.noNote")})),i.length?i:null},Kr=({params:t,step:o,t:n,projectId:r})=>{if(o===0){if(!t.blockletTitle)return n("blocklet.publish.errorTip.noTitle");if(!r||r===Y.UNOWNED_DID)return n("blocklet.publish.errorTip.noDid");if(!t.blockletDescription)return n("blocklet.publish.errorTip.noDescription")}if(o>=4){if(!t.blockletVersion)return n("blocklet.publish.errorTip.noVersion");if(!Me.valid(t.blockletVersion))return n("blocklet.publish.errorTip.inValidVersion");if(!t.note)return n("blocklet.publish.errorTip.noNote")}return""};function ao({blocklet:t,releaseId:o,connectedStores:n,projectId:r,releaseType:i,publishedStoreIds:a,onPublish:l,onDelete:u,warning:d,projectType:x,componentDid:b,onOpenConnectStore:p,behavior:h,version:m,onSelectConnectStore:f}){var D,B;const{t:y}=Z(),{actions:{refreshBlocklet:v}}=Te(),{session:g}=Fe(),{storeList:k}=ro({fromBlocklet:!0,blocklet:t,componentDid:b,userDid:(D=g==null?void 0:g.user)==null?void 0:D.did}),S=j.useMemo(()=>n!=null&&n.length?n==null?void 0:n.reduce(($,z)=>($[z.storeId]=z,$),{}):{},[n]),R=(B=t==null?void 0:t.meta)==null?void 0:B.did,T={};return Object.entries((d==null?void 0:d.logoErrors)||{}).forEach(([$,z])=>{const J=Object.values(z);J.length>0&&(T[$]=J)}),Object.entries((d==null?void 0:d.screenshotErrors)||{}).forEach(([$,z])=>{const J=Object.values(z);J.length>0&&(T[$]=T[$]?[...T[$],...J]:J)}),e.jsxs(e.Fragment,{children:[h==="connect"&&!!(k!=null&&k.length)&&e.jsx(ht,{severity:"info",style:{width:"100%"},children:e.jsxs(c,{color:tn[400],component:"a",href:x==="pack"?"https://www.arcblock.io/docs/blocklet-developer/en/5PXToZve-5IXAN1bc8rkpxAc":"https://www.arcblock.io/docs/blocklet-developer/en/hB5VWLfg9VnbWsL1JGLuLUfW",target:"_blank",display:"flex",alignItems:"center",rel:"noreferrer",children:[y(x==="pack"?"blocklet.publish.whyCantSeeInStore":"blocklet.publish.whyCantSeeResourceBlockletInStore"),e.jsx(Mt,{sx:{marginLeft:1}})]})}),e.jsx(on,{children:k==null?void 0:k.map($=>e.jsx(Nt,{"data-cy":"store-switch",children:e.jsx(nn,{children:e.jsx(Ns,{behavior:h,onSelectConnectStore:f,releaseId:o,projectId:r,releaseType:i,kind:"publish",teamDid:R,warningList:T[$.url],store:$,version:m,published:(a==null?void 0:a.indexOf($.id))>-1,connectedStore:S[$.id],onPublish:l,onDelete:u,scope:$.scope||"studio",onOpenConnectStore:p})})},$.url))}),e.jsx(mn,{teamDid:R,storeList:k,scope:"studio",onAdd:v})]})}ao.propTypes={blocklet:s.object.isRequired,projectId:s.string.isRequired,releaseId:s.string.isRequired,releaseType:s.string.isRequired,onPublish:s.func,onDelete:s.func,publishedStoreIds:s.arrayOf(s.string),connectedStores:s.arrayOf(s.object).isRequired,projectType:s.string,componentDid:s.string,warning:s.object,onOpenConnectStore:s.func,onSelectConnectStore:s.func,behavior:s.string,version:s.string.isRequired};ao.defaultProps={projectType:"",componentDid:"",publishedStoreIds:[],onPublish:()=>{},onDelete:()=>{},warning:{},onOpenConnectStore:()=>{},onSelectConnectStore:()=>{},behavior:"connect"};const el=sn(t=>({addMenuItemRoot:{marginTop:"8px",justifyContent:"center",color:t.palette.primary.main,lineHeight:"3.2"}}));function uo({disabled:t,endpointList:o,teamDid:n,onAdd:r,hiddenChildren:i,open:a,onClose:l}){const{api:u}=ke(),[d,x]=j.useState(!1),[b,p]=j.useState(!0),[h,m]=j.useState(!1),[f,y]=j.useState(""),[v,g]=j.useState(""),{t:k}=Z(),S=el(),R=()=>{y(""),m(!1),l()},T=async()=>{x(!0);try{const{decoded:D}=ps(f,o);await u.addUploadEndpoint({input:{teamDid:n,url:D}}),r(D),R()}catch(D){const B=`${k("blocklet.publish.endpoint.addFailed")} ${je(D)}`;g(B)}finally{x(!1)}};return e.jsxs(e.Fragment,{children:[!i&&e.jsxs(Nt,{button:!0,disabled:t,className:S.addMenuItemRoot,onClick:()=>{m(!0)},children:[e.jsx(bt,{font:!0}),e.jsx(N,{variant:"inherit",children:k("blocklet.publish.endpoint.addEndpoint")})]}),e.jsxs(ft,{title:k("blocklet.publish.endpoint.addEndpoint"),fullWidth:!0,maxWidth:"md",open:a||h,onClose:R,PaperProps:{style:{minHeight:"auto"}},actions:e.jsxs(e.Fragment,{children:[e.jsx(Le,{onClick:D=>{D.stopPropagation(),R()},color:"inherit",children:k("common.cancel")}),e.jsxs(Le,{onClick:D=>{D.stopPropagation(),T()},color:"primary","data-cy":"install-blocklet-next-step",disabled:d||!f||b,variant:"contained",autoFocus:!0,children:[d&&e.jsx(Se,{size:16}),k("common.confirm")]})]}),children:[e.jsx("div",{style:{paddingTop:12,overflowY:"hidden"},children:e.jsx(Kn,{component:"div",children:e.jsx(N,{component:"div",children:e.jsx(re,{label:k("blocklet.publish.endpoint.addEndpoint"),autoComplete:"off",variant:"outlined",name:"url","data-cy":"add-blocklet-endpoint-url",fullWidth:!0,value:f,onChange:D=>{g(null);let B=!1;D.target.value.trim()||(B=!0),D.target.value.trim()||g(k("blocklet.publish.endpoint.urlEmpty")),y(D.target.value),p(B)},disabled:d,onKeyPress:D=>{D.key==="Enter"&&(D.preventDefault(),D.target.value.trim()?T():g(k("blocklet.publish.endpoint.urlEmpty")))}})})})}),!!v&&e.jsx(ht,{severity:"error",style:{width:"100%"},children:v})]})]})}uo.propTypes={teamDid:s.string.isRequired,disabled:s.bool,endpointList:s.array,onAdd:s.func,hiddenChildren:s.bool,open:s.bool,onClose:s.func};uo.defaultProps={disabled:!1,endpointList:[],onAdd:()=>{},hiddenChildren:!1,open:!1,onClose:()=>{}};function po({endpoint:t,teamDid:o,onDelete:n,projectId:r="",children:i}){const{api:a}=ke(),{t:l}=Z(),u=rn(),d=Te(),[x,b]=j.useState(!1),[p,h]=j.useState(null),m=()=>{b(!1),h(null)},f=async()=>{var g;try{b(!0),await a.deleteUploadEndpoint({input:{teamDid:o,did:t.id,projectId:r}}),await((g=d==null?void 0:d.actions)==null?void 0:g.refreshBlocklet()),n==null||n()}catch(k){M.error(`${l("blocklet.publish.endpoint.deleteFailed")}: ${je(k)}`)}finally{b(!1),h(null)}},y={keyName:t.url,title:l("blocklet.publish.endpoint.deleteEndpoint"),description:l("blocklet.publish.endpoint.deleteDesc",{name:`<b>${t.url}</b>`,color:u.palette.error.main}),confirmPlaceholder:l("blocklet.publish.endpoint.confirmDesc",{name:t.url}),confirm:l("common.delConfirm"),cancel:l("common.cancel"),onConfirm:f,onCancel:m},v=g=>{t.protected||(g.stopPropagation(),h(y))};return e.jsxs(e.Fragment,{children:[i?e.jsx(c,{component:"span",onClick:v,children:i}):e.jsx(ee,{"data-cy":"endpoint-action-delete",color:"primary",disabled:x,onClick:v,size:"small",children:e.jsx(lt,{sx:{zoom:.95}})}),p?e.jsx(Hs,{keyName:p.keyName,title:p.title,description:p.description,confirmPlaceholder:p.confirmPlaceholder,confirm:p.confirm,cancel:p.cancel,params:p.params,onConfirm:p.onConfirm,onCancel:p.onCancel}):null]})}po.propTypes={endpoint:s.object.isRequired,teamDid:s.string.isRequired,onDelete:s.func,projectId:s.string,children:s.node};po.defaultProps={onDelete:"",projectId:"",children:null};function ho({connectedEndpoint:t,onDisconnect:o,onDelete:n,endpoint:r,teamDid:i,projectId:a}){const[l,u]=j.useState(null),d=!!l,{t:x}=Z(),[b,p]=j.useState(!1),h=g=>{g.stopPropagation(),window.open(kn(`${pe(r.url)}`,{allowDomains:null}))},m=g=>{u(g.currentTarget)},f=()=>{u(null)},y=()=>{p(!1),o()},v=[{label:x("blocklet.publish.endpoint.visitEndpoint"),action:h,icon:Mt},{label:x("common.disconnect"),action:()=>{f(),p(!0)},icon:As,hidden:!t}];return e.jsxs(e.Fragment,{children:[e.jsx(ee,{ref:l,color:"primary",onClick:m,size:"small",children:e.jsx(vs,{sx:{zoom:.95}})}),e.jsxs(es,{anchorEl:l,open:d,onClose:f,anchorOrigin:{vertical:"bottom",horizontal:"center"},transformOrigin:{vertical:"top",horizontal:"center"},children:[v.map(g=>g.hidden?null:e.jsxs(be,{dense:!0,onClick:g.action,disabled:g.disabled,children:[g.icon&&e.jsx(g.icon,{color:"action",sx:{marginRight:1}}),e.jsx(c,{color:"action",children:g.label})]},g.label)),e.jsx(po,{endpoint:r,teamDid:i,onDelete:n,projectId:a,children:e.jsxs(be,{dense:!0,disabled:r.protected,children:[e.jsx(lt,{sx:{color:r.protected?"action":"error.main",marginRight:1}}),e.jsx(c,{color:r.protected?"action":"error.main",children:x("common.delete")})]})})]}),b&&e.jsx(mt,{displayError:!0,title:`${x("common.disconnect")} ${r.appName}`,description:x("blocklet.publish.endpoint.disconnectEndpointTip",{url:r.url}),confirm:x("common.confirm"),onConfirm:y,onCancel:()=>p(!1)})]})}ho.propTypes={connectedEndpoint:s.object.isRequired,onDisconnect:s.func,onDelete:s.func,endpoint:s.object.isRequired,teamDid:s.string.isRequired,projectId:s.string};ho.defaultProps={projectId:"",onDelete:()=>{},onDisconnect:()=>{}};function ct({developerUrl:t,developerDid:o,sx:n,...r}){return e.jsx(Lt,{sx:{width:24,height:24,...n},src:pe(new URL(t).origin,`/.well-known/service/user/avatar/${o}?imageFilter=resize&w=120&h=120`),...r})}ct.propTypes={developerDid:s.string.isRequired,developerUrl:s.string.isRequired,sx:s.object};ct.defaultProps={sx:{}};function fo({endpoint:t,published:o}){const{t:n}=Z(),r=()=>{window.open(kn(`${pe(t.url)}`,{allowDomains:null}))};return e.jsxs(c,{children:[e.jsx(N,{variant:"subtitle2",children:n(o?"blocklet.publish.endpoint.publishToEndpointSuccess":"blocklet.publish.endpoint.uploadToEndpointSuccess",{name:t.appName})}),e.jsx(ee,{size:"small",sx:{mt:1},onClick:r,variant:"contained",color:"success",children:n("common.visitTarget",{name:t.appName})})]})}fo.propTypes={endpoint:s.object.isRequired,published:s.bool.isRequired};fo.defaultProps={};const tl=sn(()=>({buttonText:{textTransform:"none !important"},iconRoot:{minWidth:24},box:{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",overflow:"hidden",width:"100%"},menuName:{flexShrink:1,display:"flex",flexDirection:"column",overflow:"hidden",flex:1},actions:{flex:1,display:"flex",flexDirection:"row",justifyContent:"flex-end",alignItems:"center"},title:{fontSize:16,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},url:{fontSize:14,opacity:.5,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},buttonLine:{height:"100%",width:"1px",backgroundColor:"#e0e0e0"}})),Wo=ts(({className:t,...o})=>e.jsx(ye,{...o,classes:{popper:t}}))(({theme:t})=>({[`& .${os.tooltip}`]:{backgroundColor:"#fff",color:"rgba(0, 0, 0, 0.87)",borderRadius:8,padding:t.spacing(2),fontSize:t.typography.pxToRem(12),border:"1px solid rgba(0,0,0,0.08)",boxShadow:"0px 4px 8px rgba(0, 0, 0, 0.05)"}}));function bo({teamDid:t,projectId:o,releaseId:n,endpoint:r,warningList:i,onDelete:a,published:l,onPublish:u,connectedEndpoint:d,onOpenConnectEndpoint:x}){const b=tl(),{t:p}=Z(),{api:h}=ke(),[m,f]=j.useState(!1),y=xn({messageType:"connect-endpoint-message",onOpen:()=>f(!0),onClose:()=>f(!1)}),v=!!d,g=()=>{y(async(D,B)=>{try{const $=await h.connectToEndpoint({input:{did:t,endpointId:r.id,projectId:o}});if(!($!=null&&$.url)){M.error("failed to connect to endpoint");return}B($.url),await x({did:t,projectId:o,endpointId:r.id}),f(!1)}catch($){const z=je($);M.error(z),f(!1)}})},k=async()=>{try{await h.disconnectFromEndpoint({input:{did:t,endpointId:r.id,projectId:o}}),a()}catch(D){M.error(je(D))}},S=()=>{f(!0),h.publishToEndpoint({input:{did:t,endpointId:r.id,projectId:o,releaseId:n}}).then(()=>{M.success(e.jsx(fo,{endpoint:r,published:!0}),{duration:1e4}),u==null||u(null)}).catch(D=>{M.error(je(D)),u==null||u(D)}).finally(()=>{f(!1)})};j.useEffect(()=>{v&&f(!1)},[v]);const R=i.length>0,T=e.jsxs(ee,{sx:{paddingLeft:2,paddingRight:2,fontSize:15,width:130,height:"100%"},disabled:R,onClick:S,children:[m?e.jsx(Se,{sx:{marginRight:1},size:16}):e.jsx(zs,{sx:{marginRight:1,fontSize:20}}),p("common.upload")]});return e.jsxs(c,{className:b.box,children:[e.jsxs(c,{className:b.menuName,children:[e.jsx(c,{sx:{display:"flex",flexDirection:"row"},children:e.jsx(N,{component:"span",className:b.title,variant:"subtitle1",children:r.appName})}),e.jsx(N,{className:b.url,component:"span",variant:"inherit",children:`${r.url}`})]}),e.jsxs(c,{className:b.actions,children:[d&&e.jsx(Wo,{placement:"top",title:e.jsxs(c,{children:[e.jsx(N,{component:"span",variant:"caption",sx:{opacity:.7},children:p("blocklet.publish.developerInfo")}),e.jsxs(c,{sx:{display:"flex",flexDirection:"row",alignItems:"center",gap:1,mt:1},children:[e.jsx(ct,{developerUrl:r.url,developerDid:d.developerDid,sx:{width:42,height:42}}),e.jsxs(c,{sx:{flex:1},children:[e.jsx(N,{component:"span",variant:"subtitle1",children:d.developerName}),e.jsx(Tt,{size:14,copyable:!0,compact:!0,responsive:!1,did:d.developerDid})]})]})]}),children:e.jsx(c,{children:e.jsx(ct,{developerUrl:r.url,developerDid:d.developerDid,sx:{marginRight:1,cursor:"help"}})})}),e.jsxs(st,{disabled:m,variant:"outlined",sx:{height:38},size:"small",children:[!v&&e.jsxs(ee,{sx:{paddingLeft:2,paddingRight:2,fontSize:15,width:130},onClick:g,children:[m?e.jsx(Se,{sx:{marginRight:1},size:16}):e.jsx(Os,{sx:{marginRight:1}}),p("common.connect")]}),v&&l&&e.jsxs(ee,{disabled:!0,sx:{paddingLeft:2,paddingRight:2,fontSize:15,width:130},children:[m?e.jsx(Se,{sx:{marginRight:1},size:16}):e.jsx(jn,{sx:{marginRight:1}}),p("common.uploaded")]}),v&&!l&&(R?e.jsx(Wo,{title:e.jsxs(c,{children:[e.jsx(c,{sx:{color:"error.main",mb:.5},children:p("blocklet.publish.storeRule.warning")}),i.map((D,B)=>e.jsxs(c,{sx:{color:"error.main"},children:[B+1,". ",D]},D))]}),children:e.jsx("div",{children:T})}):T),e.jsx(ho,{projectId:o,endpoint:r,teamDid:t,connectedEndpoint:d,onDisconnect:k,onDelete:a})]})]})]})}bo.propTypes={teamDid:s.string.isRequired,published:s.bool,connectedEndpoint:s.shape({endpointId:s.string,accessKeyId:s.string,accessKeySecret:s.string,createdBy:s.string,developerDid:s.string,developerName:s.string,developerEmail:s.string}),warningList:s.array,projectId:s.string,releaseId:s.string,endpoint:s.shape({id:s.string.isRequired,appName:s.string,url:s.string.isRequired,endpoint:s.string.isRequired,protected:s.bool,connected:s.bool}).isRequired,onDelete:s.func,onOpenConnectEndpoint:s.func,onPublish:s.func};bo.defaultProps={published:!1,connectedEndpoint:null,projectId:"",warningList:[],releaseId:"",onDelete:()=>{},onOpenConnectEndpoint:()=>{},onPublish:()=>{}};function mo({releaseId:t,blocklet:o,connectedEndpoints:n,projectId:r,publishedEndpointIds:i,onPublish:a,onDelete:l,warning:u,onOpenConnectEndpoint:d}){var v,g;const{actions:{refreshBlocklet:x}}=Te(),{session:b}=Fe(),{t:p}=Z(),h=(((v=o==null?void 0:o.settings)==null?void 0:v.endpointList)||[]).filter(k=>{var S;return k.scope===((S=b==null?void 0:b.user)==null?void 0:S.did)}),m=j.useMemo(()=>n!=null&&n.length?n==null?void 0:n.reduce((k,S)=>(k[S.endpointId]=S,k),{}):{},[n]),f=(g=o==null?void 0:o.meta)==null?void 0:g.did,y={};return Object.entries((u==null?void 0:u.logoErrors)||{}).forEach(([k,S])=>{const R=Object.values(S);R.length>0&&(y[k]=R)}),Object.entries((u==null?void 0:u.screenshotErrors)||{}).forEach(([k,S])=>{const R=Object.values(S);R.length>0&&(y[k]=y[k]?[...y[k],...R]:R)}),e.jsxs(e.Fragment,{children:[!!(h!=null&&h.length)&&e.jsx(ht,{severity:"info",style:{width:"100%"},children:e.jsx(c,{color:tn[400],children:p("blocklet.publish.endpoint.uploadToEndpoint")})}),e.jsx(on,{sx:{flex:1},children:h==null?void 0:h.map(k=>e.jsx(Nt,{"data-cy":"endpoint-switch",children:e.jsx(nn,{children:e.jsx(bo,{releaseId:t,projectId:r,teamDid:f,warningList:y[k.url],endpoint:k,published:(i==null?void 0:i.indexOf(k.id))>-1,connectedEndpoint:m[k.id],onPublish:a,onDelete:l,onOpenConnectEndpoint:d})})},k.url))}),e.jsx(uo,{teamDid:f,endpointList:h,onAdd:x})]})}mo.propTypes={releaseId:s.string.isRequired,blocklet:s.object.isRequired,projectId:s.string.isRequired,warning:s.object,onPublish:s.func,onOpenConnectEndpoint:s.func,onDelete:s.func,connectedEndpoints:s.arrayOf(s.object).isRequired,publishedEndpointIds:s.arrayOf(s.string)};mo.defaultProps={publishedEndpointIds:[],onPublish:()=>{},onDelete:()=>{},warning:{},onOpenConnectEndpoint:()=>{}};function Ln({did:t,params:o,setParams:n,projectId:r,open:i,onClose:a}){const{t:l}=Z(),[u,d]=j.useState(!1),{api:x}=ke(),[b,p]=j.useState(!1),[h,m]=j.useState(!1),f=()=>{p(o.autoUpload),m(o.possibleSameStore),d(!1),a(!1)},y=async()=>{d(!0);try{await x.updateProject({input:{did:t,projectId:r,blockletTitle:o.blockletTitle||"",blockletDescription:o.blockletDescription||"",blockletIntroduction:o.blockletIntroduction||"",autoUpload:!!b,possibleSameStore:!!h}}),n({autoUpload:b,possibleSameStore:h}),a(!1)}catch(g){M.error(g.message)}d(!1)};j.useEffect(()=>{p(o.autoUpload),m(o.possibleSameStore)},[o]);const v=!!(r&&r!==Y.UNOWNED_DID);return e.jsx(ft,{title:l("blocklet.publish.projectSettings"),disableEscapeKeyDown:!0,disablePortal:!1,fullWidth:!0,open:i,onClose:f,actions:e.jsxs(e.Fragment,{children:[e.jsx(ee,{onClick:g=>{g.stopPropagation(),a()},color:"inherit",children:l("common.cancel")}),v&&e.jsxs(ee,{onClick:g=>{g.stopPropagation(),y()},color:"primary","data-cy":"install-blocklet-next-step",disabled:u,variant:"contained",autoFocus:!0,children:[u&&e.jsx(Se,{size:16}),l("common.confirm")]})]}),children:v?e.jsxs(c,{component:"label",sx:{display:"flex",flexDirection:"column",gap:2},children:[e.jsxs(c,{sx:{display:"flex",flexDirection:"row",alignItems:"center"},children:[e.jsx(c,{component:ue,icon:"ph:upload",sx:{fontSize:24,mr:2}}),e.jsx(N,{variant:"body1",sx:{flex:1},children:l("blocklet.publish.autoUploadTip")}),e.jsx(Ee,{checked:b,onChange:(g,k)=>p(k)})]}),e.jsxs(c,{component:"label",sx:{display:"flex",flexDirection:"row",alignItems:"center"},children:[e.jsx(c,{component:ue,icon:"fluent-mdl2:merge-duplicate",sx:{fontSize:24,mr:2}}),e.jsx(N,{variant:"body1",sx:{flex:1},children:l("blocklet.publish.possibleSameStoreTip")}),e.jsx(Ee,{checked:h,onChange:(g,k)=>m(k)})]})]}):e.jsxs(c,{sx:{display:"flex",flexDirection:"column",alignItems:"center"},children:[e.jsx(c,{component:ue,icon:"ph:empty",sx:{fontSize:40,mb:3,opacity:.6}}),e.jsx(N,{variant:"body1",sx:{flex:1},children:l("blocklet.publish.needProjectId")})]})})}Ln.propTypes={did:s.string.isRequired,params:s.object.isRequired,open:s.bool.isRequired,onClose:s.func.isRequired,setParams:s.func.isRequired,projectId:s.string.isRequired};function qn({downloadUrl:t,installUrl:o,handleSetTip:n,isPack:r,disabled:i}){const{t:a}=Z(),[l,u]=j.useState(!1),d=j.useRef(null),x=()=>{u(!l)},b=p=>{d.current&&d.current.contains(p.target)||u(!1)};return e.jsxs(e.Fragment,{children:[e.jsx(ee,{disabled:i,ref:d,onClick:x,children:e.jsx(c,{component:ue,sx:{fontSize:18},icon:"bxs:download"})}),e.jsx(Go,{sx:{zIndex:10},open:l,anchorEl:d.current,placement:"bottom-end",role:void 0,transition:!0,disablePortal:!0,children:({TransitionProps:p})=>e.jsx(Xo,{...p,style:{transformOrigin:"center top"},children:e.jsx(qt,{children:e.jsx(Yo,{onClickAway:b,children:e.jsxs(Qo,{id:"split-button-menu",autoFocusItem:!0,sx:{maxHeight:300,overflowY:"auto",zIndex:10},children:[r&&e.jsx(c,{component:"a",href:o,target:"_blank",rel:"noreferrer",sx:{textDecoration:"none"},children:e.jsxs(be,{sx:{color:"#333"},children:[e.jsx(c,{component:ue,sx:{mr:1},icon:"ic:round-install-desktop"}),e.jsx(N,{variant:"inherit",children:a("blocklet.publish.installToThisServer")})]})}),e.jsxs(be,{onClick:n,children:[e.jsx(c,{component:ue,sx:{mr:1},icon:"iconamoon:copy"}),e.jsx(N,{variant:"inherit",children:a("blocklet.publish.copyInstallUrl")})]}),e.jsx(c,{component:"a",href:t,target:"_blank",rel:"noreferrer",sx:{textDecoration:"none"},children:e.jsxs(be,{sx:{color:"#333"},children:[e.jsx(c,{component:ue,sx:{mr:1},icon:"ph:download"}),e.jsx(N,{variant:"inherit",children:a("common.download")})]})})]})})})})})]})}qn.propTypes={disabled:s.bool.isRequired,isPack:s.bool.isRequired,downloadUrl:s.string.isRequired,installUrl:s.string.isRequired,handleSetTip:s.func.isRequired};var Ho;const Bo=(Ho=window.env)==null?void 0:Ho.serverEndpoint;function xo({projectId:t,params:o,setParamsErrTip:n,initUrl:r,setParams:i,mode:a,loading:l,blocklet:u,release:d,releaseId:x,getData:b,getRelease:p,paramsErrTip:h,warning:m,componentDid:f,resourceRelateComponents:y,disabledSelectComponents:v,saveSelectedEventsRef:g,hasSelectedResources:k,initLogoUrl:S,setLoading:R,clearHistoryParams:T,projectType:D,readOnly:B}){var ve;const{t:$,locale:z}=Z(),J=[{label:e.jsx(c,{textAlign:"center",width:"100%",children:$("blocklet.publish.store")}),value:"store"},{label:e.jsx(c,{textAlign:"center",width:"100%",children:$("blocklet.publish.endpoint.tab")}),value:"endpoint"}],[U,w]=j.useState(J[0].value),{api:I}=ke(),q=Et(),[P,A]=j.useState(!1),[H,C]=j.useState(!1),[_,G]=j.useState(),F=Ve(ie=>ie.breakpoints.down("md")),K=j.useMemo(()=>{var ie;return o!=null&&o.blockletResourceType?o==null?void 0:o.blockletResourceType:((ie=o==null?void 0:o.blockletComponents)==null?void 0:ie.length)>0?(o==null?void 0:o.blockletComponents.find(W=>W.included))?"resource":"pack":"resource"},[o==null?void 0:o.blockletComponents,o==null?void 0:o.blockletResourceType]),E=()=>{window.parent.postMessage({event:"studioDialog.uploaded",componentDid:f},"*"),p()},Q=async ie=>{var He,et,ce,Ae;if(h!=null&&h.blockletHomepage||h!=null&&h.blockletSupport||h!=null&&h.blockletCommunity){M.error((h==null?void 0:h.blockletHomepage)||(h==null?void 0:h.blockletSupport)||(h==null?void 0:h.blockletCommunity));return}const he=En({params:o,hasSelectedResources:k,projectId:t,status:ie,t:$});if(he){M.error(he.map(V=>V.message).join("; ")),n(he.reduce((V,se)=>({...V,[se.param]:se.message}),{}));return}const W={...o};if(W.blockletComponents=Xr(W.blockletComponents,u,y,v),W.blockletVersion=Me.valid(W.blockletVersion),!W.blockletVersion){M.error("Invalid Blocklet Version"),n({blockletVersion:"Invalid Blocklet Version"});return}if(S)try{const V=await Zr({did:u.meta.did,projectId:t,imageUrl:S});W.blockletLogo=V,i({blockletLogo:V})}catch(V){M.error(V.message);return}if(o.resourceFromSelect){W.uploadedResource="";try{const V=Object.keys(g.current);await it(V.map(se=>()=>{const me=g.current[se];return Pr({api:I,locale:z,projectId:t,releaseId:x,appDid:u.meta.did,component:me.component,resources:me.resources,initUrl:r})}),{concurrency:2})}catch(V){M.error(((ce=(et=(He=V==null?void 0:V.response)==null?void 0:He.data)==null?void 0:et.error)==null?void 0:ce.message)||V.message),n({blockletResource:"Invalid save the resource"});return}}else(Ae=o.blockletDocker)!=null&&Ae.dockerImage||(W.blockletComponents=[]);W.blockletTitle=(W.blockletTitle||"").trim(),W.blockletDescription=(W.blockletDescription||"").trim(),W.blockletSupport=(W.blockletSupport||"").trim(),W.blockletHomepage=(W.blockletHomepage||"").trim(),W.blockletCommunity=(W.blockletCommunity||"").trim(),W.blockletRepository=(W.blockletRepository||"").trim(),W.blockletIntroduction=(W.blockletIntroduction||"").trim(),W.note=(W.note||"").trim(),W.blockletComponents=((W==null?void 0:W.blockletComponents)||[]).filter(V=>V.included).map(V=>Wt(V,["did","required"])).map(JSON.stringify),W.contentType!=="docker"&&(W.blockletDocker={dockerImage:"",dockerCommand:"",dockerArgs:[],dockerEnvs:[]}),W.blockletDocker.dockerImage=W.blockletDocker.dockerImage||"",W.blockletDocker.dockerArgs.length>0&&W.blockletDocker.dockerArgs.forEach(V=>{V.proxyBehavior=V.proxyBehavior||"service"});try{await I.createRelease({input:{...W,note:JSON.stringify({note:W.note}),did:u.meta.did,projectId:t,releaseId:"",status:ie}}),T(),M.success($("blocklet.publish.createReleaseSuccess")),window.parent.postMessage({event:"studioDialog.released",componentDid:f},"*"),n({blockletResource:"",blockletTitle:"",blockletDescription:"",blockletVersion:"",blockletLogo:"",projectId:"",blockletIntroduction:"",note:""})}catch(V){const se=je(V);M.error(se),(/resource/.test(se)||/zip/.test(se))&&n({blockletResource:se});return}const qe=await I.getProject({input:{did:u.meta.did,projectId:t}}),Ne=qe.project.lastReleaseId;o.autoUpload&&await it(qe.project.connectedStores.map(V=>async()=>{try{const se=m.logoErrors[V.storeUrl];if(se){const Pe=Object.keys(se).find(ze=>!!se[ze]);if(Pe){M.warning($("blocklet.publish.autoPublishErrorTip",{storeName:V.storeName,error:se[Pe]}));return}}const me=m.screenshotErrors[V.storeUrl];if(me){const Pe=Object.keys(me).find(ze=>!!me[ze]);if(Pe){M.warning($("blocklet.publish.autoPublishErrorTip",{storeName:V.storeName,error:me[Pe]}));return}}const gt=await I.publishToStore({input:{did:u.meta.did,storeId:V.storeId,storeName:V.storeName,projectId:t,releaseId:Ne,type:K}});M.success(e.jsx(Ws,{storeName:V.storeName,storeUrl:V.storeUrl,developerDid:V.developerDid,did:t,published:gt.url==="published",version:W.blockletVersion}),{duration:1e4})}catch(se){M.error(je(se))}}),{concurrency:4}),E==null||E(),q(`../${t}/view/${Ne}/${W.blockletVersion}`,{replace:!0})},X=ie=>(R(!0),Q(ie).finally(()=>{R(!1)})),oe=async ie=>{await Wr(I,ie),b()},le=async ie=>{await Br(I,ie),b()},te=()=>{C(!0)},ne=pe(Bo,`/api/project/${u.meta.did}/${t}/${x}/release/blocklet.json`),ae=new URL(Bo);ae.pathname=pe(ae.pathname,"/launch-blocklet/agreement"),ae.searchParams.set("blocklet_meta_url",ne);const Ze=ae.href,Ke=()=>G(ne);return e.jsxs(e.Fragment,{children:[e.jsx(ol,{className:"sticky-header",children:e.jsx(Ot,{left:e.jsxs(Jo,{className:"breadcrumbs","aria-label":"breadcrumb",children:[e.jsx(we,{to:"../",children:$("common.blockletStudio")}),t===Y.UNOWNED_DID?e.jsx(N,{color:"text.primary",children:e.jsx(De,{maxLength:F?6:30,children:(o==null?void 0:o.blockletTitle)||"Blocklet"})}):e.jsx(we,{to:`../${t}`,children:e.jsx(De,{maxLength:F?6:30,children:(o==null?void 0:o.blockletTitle)||"Blocklet"})}),e.jsx(N,{color:"text.primary",children:a==="create"?$("common.create"):(o==null?void 0:o.blockletVersion)||$("common.edit")})]}),actions:e.jsxs(e.Fragment,{children:[!B&&e.jsxs(st,{disabled:l,variant:"contained",children:[e.jsxs(ee,{variant:"contained",onClick:()=>X(fe.PROJECT.RELEASE_STATUS.published),children:[l&&e.jsx(Se,{size:14,sx:{mr:.5},color:"inherit"}),$("blocklet.publish.createRelease")]}),e.jsx(ee,{variant:"contained",onClick:te,children:e.jsx(ue,{icon:"mage:settings-fill",fontSize:"16px"})})]}),B&&e.jsxs(e.Fragment,{children:[e.jsx(pt,{fullWidth:!0,maxWidth:"sm",open:_,onClose:()=>G(""),children:e.jsxs(c,{sx:{py:5,px:4,wordBreak:"break-all"},children:[e.jsx(N,{variant:"h6",sx:{mb:2},children:$("blocklet.publish.installResourceTip")}),e.jsx(bn,{children:_}),e.jsxs(N,{sx:{mt:2},children:[$("blocklet.publish.installResourceTip2"),e.jsx("a",{style:{marginLeft:4},href:"https://www.arcblock.io/docs/blocklet-developer/how-to-use-install-url",target:"_blank",rel:"noreferrer",children:$("blocklet.publish.installResourceHelp")})]})]})}),e.jsxs(st,{disabled:l,variant:"contained",children:[e.jsxs(ee,{onClick:()=>A(!0),children:[l?e.jsx(Se,{size:14,sx:{mr:1},color:"inherit"}):e.jsx(_n,{sx:{fontSize:"1.3em",mr:1}}),$(F?"common.upload":"blocklet.publish.connectOrUpload")]}),e.jsx(qn,{isPack:K==="pack",downloadUrl:pe(`${Y.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${u.meta.did}/${t}/${x}/download/${((d==null?void 0:d.files)||[])[0]}`),installUrl:Ze,handleSetTip:Ke}),e.jsx(ee,{onClick:te,children:e.jsx(ue,{icon:"mage:settings-fill",fontSize:"16px"})})]})]})]})})}),e.jsx(ft,{title:$("blocklet.publish.connectOrUpload"),disableEscapeKeyDown:!0,disablePortal:!1,fullWidth:!0,open:P,onClose:()=>A(!1),children:e.jsxs(c,{children:[e.jsx(c,{mt:-2,mb:2,children:e.jsx(pn,{tabs:J,current:U,onChange:w})}),U==="store"&&e.jsx(ao,{projectType:D,blocklet:u,version:o.blockletVersion,releaseType:K,projectId:t,releaseId:x,componentDid:f,warning:m,onPublish:E,onOpenConnectStore:oe,onDelete:b,connectedStores:o.connectedStores||[],publishedStoreIds:d==null?void 0:d.publishedStoreIds}),U==="endpoint"&&e.jsx(Ce,{minHeight:400,children:e.jsx(mo,{blocklet:u,releaseType:K,projectId:t,releaseId:x,warning:m,publishedEndpointIds:[],connectedEndpoints:o.connectedEndpoints||[],onPublish:E,onOpenConnectEndpoint:le,onDelete:b})})]})}),e.jsx(Ln,{did:(ve=u==null?void 0:u.meta)==null?void 0:ve.did,params:o,projectId:t,open:H,setParams:i,onClose:()=>C(!1)})]})}xo.propTypes={projectId:s.string.isRequired,params:s.object.isRequired,mode:s.string.isRequired,loading:s.bool.isRequired,blocklet:s.object.isRequired,release:s.object,releaseId:s.string.isRequired,getData:s.func.isRequired,getRelease:s.func.isRequired,componentDid:s.string,resourceRelateComponents:s.object.isRequired,disabledSelectComponents:s.bool,saveSelectedEventsRef:s.object.isRequired,hasSelectedResources:s.bool.isRequired,initLogoUrl:s.string.isRequired,setLoading:s.func.isRequired,projectType:s.string.isRequired,setParamsErrTip:s.func.isRequired,warning:s.object.isRequired,setParams:s.func.isRequired,initUrl:s.object,paramsErrTip:s.object.isRequired,clearHistoryParams:s.func.isRequired,readOnly:s.bool.isRequired};xo.defaultProps={disabledSelectComponents:!1,componentDid:"",release:null,initUrl:null};const ol=Re.div`
180
+ .sticky-header {
181
+ margin-top: -12px;
182
+ padding: 12px 0;
183
+ position: sticky;
184
+ top: 0;
185
+ z-index: 99;
186
+ display: flex;
187
+ align-items: center;
188
+ justify-content: space-between;
189
+ background-color: #fff;
190
+ padding-bottom: 12px;
191
+ border-bottom: ${({theme:t})=>`1px solid ${t.palette.divider}`};
192
+ }
193
+ `;function Nn({text:t}){const{palette:o}=rn();return t?e.jsx(Js,{style:{backgroundColor:o.background.default,color:o.text.primary},wrapperElement:{"data-color-mode":"light"},source:Cs.sanitize(t),rehypePlugins:[[Gs,{target:"_blank"}]]}):e.jsx(Ue,{Icon:Vt})}Nn.propTypes={text:s.string.isRequired};function An({params:t,setParams:o,paramsErrTip:n,loading:r,setParamsErrTip:i,readOnly:a}){var b;const{t:l}=Z(),[u,d]=j.useState(a?"preview":"write"),x=(p,h)=>{d(h)};return e.jsxs(c,{sx:{border:"1px solid transparent",borderRadius:2},children:[e.jsxs(c,{sx:{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center"},children:[e.jsx(N,{variant:"h6",fontWeight:"bold",sx:{},children:l("common.introduction")}),e.jsxs(ln,{value:u,onChange:x,"aria-label":"wrapped label tabs example",children:[e.jsx(rt,{value:"write",label:"Write"}),e.jsx(rt,{value:"preview",label:"Preview"})]})]}),e.jsx(c,{display:u==="write"?"block":"none",sx:{width:"100%",marginTop:3},children:e.jsx(re,{disabled:r||a,sx:{border:"none"},placeholder:`Blocklet ${l("common.introduction")}`,InputProps:{"data-cy":"export-blocklet-introduction",readOnly:a,endAdornment:e.jsxs(Ye,{position:"end",children:[((b=t==null?void 0:t.blockletIntroduction)==null?void 0:b.length)||0," / ",fe.PROJECT.MAX_INTRO_LENGTH]})},autoComplete:"off",variant:"outlined",fullWidth:!0,multiline:!0,minRows:4,value:t.blockletIntroduction||"",onChange:p=>{i({blockletIntroduction:""}),o({blockletIntroduction:p.target.value.slice(0,fe.PROJECT.MAX_INTRO_LENGTH)})},error:!!n.blockletIntroduction,helperText:n.blockletIntroduction||""})}),e.jsx(c,{display:u==="preview"?"block":"none",mt:3,children:e.jsx(Nn,{text:t.blockletIntroduction||""})})]})}An.propTypes={params:s.object.isRequired,setParams:s.func.isRequired,paramsErrTip:s.object.isRequired,setParamsErrTip:s.func.isRequired,readOnly:s.bool.isRequired,loading:s.bool.isRequired};var go={},nl=Ie;Object.defineProperty(go,"__esModule",{value:!0});var _t=go.default=void 0,sl=nl($e()),Mo=e;_t=go.default=(0,sl.default)([(0,Mo.jsx)("circle",{cx:"12",cy:"19",r:"2"},"0"),(0,Mo.jsx)("path",{d:"M10 3h4v12h-4z"},"1")],"PriorityHigh");function jo({step:t,ok:o,active:n,error:r,warning:i}){let a="grey.500",l=t+1;return o&&(l=e.jsx(jn,{sx:{fontSize:18,margin:0},color:"white"})),r||!o&&n>t?(a="error.main",l=e.jsx(_t,{sx:{fontSize:18,margin:0},color:"white"})):i?(a="warning.main",l=e.jsx(_t,{sx:{fontSize:18,margin:0},color:"white"})):n>=t&&(a="primary.main"),e.jsx(c,{width:24,height:24,bgcolor:a,borderRadius:"100%",color:"white",display:"flex",justifyContent:"center",fontWeight:"bold",fontSize:14,alignItems:"center",children:l})}jo.propTypes={step:s.number,ok:s.bool,active:s.number,error:s.string,warning:s.bool};jo.defaultProps={step:0,ok:!1,active:0,error:"",warning:!1};function ko({steps:t,activeStep:o,setActiveStep:n,hasSelectedResources:r,params:i,loading:a,paramsErrTip:l,warning:u,viewMode:d,projectId:x}){const{t:b}=Z(),p=()=>{n(y=>y+1)},h=()=>{n(y=>y-1)},m=y=>y===0?(l==null?void 0:l.blockletTitle)||(l==null?void 0:l.projectId)||(l==null?void 0:l.blockletDescription)||(l==null?void 0:l.blockletHomepage)||(l==null?void 0:l.blockletSupport)||(l==null?void 0:l.blockletCommunity)||(l==null?void 0:l.blockletRepository):y===2?(l==null?void 0:l.blockletResource)||(l==null?void 0:l.blockletDocker)||(l==null?void 0:l.dockerImageName):y>=4?(l==null?void 0:l.blockletVersion)||(l==null?void 0:l.note):"",f=d||En({hasSelectedResources:r,params:i,projectId:x,t:b})===null;return e.jsxs(c,{sx:{width:300,maxWidth:300,minWidth:300,padding:2,border:"1px solid",borderColor:"divider",borderRadius:1},children:[e.jsx(ns,{activeStep:o,orientation:"vertical",children:t.map((y,v)=>{const g={},k=a||!Kr({hasSelectedResources:r,params:i,projectId:x,step:v,t:b}),S=a?"":m(v);return S&&(g.optional=e.jsx(N,{variant:"caption",color:"error",sx:{wordBreak:"break-word"},children:S}),g.error=!0),e.jsxs(ss,{children:[e.jsx(rs,{icon:e.jsx(jo,{error:S,warning:v===0?u.hasWarning:!1,active:f?99:o,step:v,ok:k}),sx:{cursor:"pointer",color:S?"error.main":"inherit"},disabled:!1,onClick:()=>n(v),...g,children:e.jsx(N,{fontSize:"14px",fontWeight:"500",color:S||!k&&o>v?"error.main":"inherit",children:y.label})}),e.jsxs(ls,{children:[e.jsx(N,{fontSize:12,children:y.description}),!f&&e.jsx(c,{sx:{mb:2},children:e.jsxs("div",{children:[v<t.length-1&&e.jsx(ee,{variant:"contained",onClick:p,sx:{mt:1,mr:1},disabled:S||!k,children:b("common.continue")}),v>0&&e.jsx(ee,{disabled:v===0,onClick:h,sx:{mt:1,mr:1},children:b("common.back")})]})})]})]},y.label)})}),o>=t.length-1&&e.jsx(qt,{square:!0,elevation:0,sx:{p:3},children:e.jsx(N,{fontSize:12,sx:{opacity:.5},children:"Click right top button to release"})})]})}ko.propTypes={steps:s.array.isRequired,activeStep:s.number.isRequired,setActiveStep:s.func.isRequired,params:s.object.isRequired,viewMode:s.oneOfType([s.string,s.bool]),loading:s.bool.isRequired,projectId:s.string.isRequired,hasSelectedResources:s.oneOfType([s.string,s.bool]),warning:s.object.isRequired,paramsErrTip:s.shape({projectId:s.string,blockletVersion:s.string,blockletTitle:s.string,blockletDescription:s.string,note:s.string,blockletResource:s.string,blockletHomepage:s.string,blockletSupport:s.string,blockletCommunity:s.string,blockletRepository:s.string,blockletDocker:s.object,dockerImageName:s.string}).isRequired};ko.defaultProps={hasSelectedResources:!1,viewMode:""};const rl=[".zip",".gz"],ll=1024*1024*100,il=j.lazy(()=>hn(()=>import("./index-Bi8r1T8R.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13])).then(t=>({default:t.Uploader})));function yo({app:t,projectId:o,readOnly:n,params:r,setParams:i,setParamsErrTip:a,error:l}){const{t:u,locale:d}=Z(),x=j.useRef(null),b=()=>n?!1:!o||o===Y.UNOWNED_DID?(M.error(u("blocklet.publish.errorTip.noFirstDid")),!1):!0,p=`${Y.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${t.meta.did}/${o}/resource/upload`;return e.jsxs(c,{sx:{mt:3},children:[e.jsx(N,{gutterBottom:!0,children:u("blocklet.publish.resourceUpload")}),e.jsxs(Ce,{direction:"row",alignItems:"center",spacing:1,sx:{flex:1,cursor:n?"default":"pointer"},children:[!!r.uploadedResource&&e.jsx(N,{component:"a",href:`${p}/params.uploadedResource`,children:r.uploadedResource}),!n&&e.jsx(ee,{variant:"outlined",size:"small",onClick:()=>{var h;b()&&((h=x.current)==null||h.open())},children:r.uploadedResource?u("common.change"):u("common.upload")})]}),e.jsx(j.Suspense,{fallback:e.jsx(Qe,{}),children:e.jsx(il,{ref:x,locale:d,popup:!0,onUploadFinish:h=>{var m;i({uploadedResource:h.data.filename}),a({blockletResource:""}),(m=x.current)==null||m.close()},plugins:["ImageEditor"],installerProps:{disabled:!0},apiPathProps:{uploader:p,disableMediaKitPrefix:!0,disableMediaKitStatus:!0},coreProps:{restrictions:{allowedFileExts:rl,maxFileSize:ll,maxNumberOfFiles:1}}},"uploader-resource")}),!!l&&e.jsx(c,{color:"error.main",mt:1,fontSize:14,children:l})]})}yo.propTypes={app:s.object.isRequired,projectId:s.string.isRequired,readOnly:s.bool.isRequired,params:s.object.isRequired,setParams:s.func.isRequired,error:s.string.isRequired,setParamsErrTip:s.func.isRequired};yo.defaultProps={};function at({readOnly:t,params:o,setParams:n,paramsErrTip:r,setParamsErrTip:i,loading:a}){var u;const{t:l}=Z();return e.jsx(c,{display:"flex",mt:3,className:"section",children:e.jsxs(c,{sx:{flex:1},children:[e.jsx(re,{required:!0,disabled:a||t,label:`Blocklet ${l("common.version")}`,placeholder:`Blocklet ${l("common.version")}`,InputProps:{"data-cy":"blocklet-version",readOnly:t},autoComplete:"off",variant:"outlined",fullWidth:!0,value:o.blockletVersion||"",onChange:d=>{i({blockletVersion:""}),n({blockletVersion:d.target.value})},error:!!r.blockletVersion,helperText:r.blockletVersion||""}),e.jsx(re,{label:l("blocklet.publish.releaseNote"),autoComplete:"off",disabled:a||t,variant:"outlined",InputProps:{"data-cy":"release-note",readOnly:t,endAdornment:e.jsxs(Ye,{position:"end",children:[((u=o==null?void 0:o.note)==null?void 0:u.length)||0," / ",fe.PROJECT.MAX_NOTE_LENGTH]})},fullWidth:!0,multiline:!0,minRows:4,required:!0,value:o.note||"",onChange:d=>{i({note:""}),n({note:d.target.value.slice(0,fe.PROJECT.MAX_NOTE_LENGTH)})},error:!!r.note,helperText:r.note||"",sx:{mt:3}})]})})}at.propTypes={readOnly:s.bool.isRequired,params:s.object.isRequired,setParams:s.func.isRequired,paramsErrTip:s.object.isRequired,setParamsErrTip:s.func.isRequired,loading:s.bool.isRequired};at.defaultProps={};function zn(t){for(const o in t)typeof t[o]=="string"?t[o]=t[o].replace(/\\\\/g,"\\"):typeof t[o]=="object"&&t[o]!==null&&zn(t[o]);return t}function dt({index:t,item:o,dockerParams:n,setDockerParams:r,dataKey:i,t:a,readOnly:l}){const u=(o==null?void 0:o.value)||"",[d,x]=j.useState(!1),b=()=>{var U;(U=n[i])==null||U.splice(t,1),r({...n,[i]:[...n[i]]})},p=(U,w)=>{var I;(I=n[i])!=null&&I[t]&&(w?(n[i][t].custom=n[i][t].value,n[i][t].value=`$${Ct(o.key)}`):(n[i][t].value=n[i][t].custom||"",n[i][t].custom="")),r({...n,[i]:[...n[i]]})},h=(U,w)=>{var q;const I=((q=n[i][t])==null?void 0:q.value)||"";n[i][t]={...n[i][t],secure:w,value:w&&I===fe.BLOCKLET_AUTOMATIC_ENV_VALUE?"":I},r({...n,[i]:[...n[i]]})},m=(U,w)=>{n[i][t]={...n[i][t],shared:w},r({...n,[i]:[...n[i]]})},f=(U,w)=>{var q;const I=((q=n[i][t])==null?void 0:q.value)||"";n[i][t]={...n[i][t],required:w,value:w&&I===fe.BLOCKLET_AUTOMATIC_ENV_VALUE?"":I},r({...n,[i]:[...n[i]]})},y=(U,w)=>{n[i][t]={...n[i][t],value:w?fe.BLOCKLET_AUTOMATIC_ENV_VALUE:"",secure:!1,required:!1},r({...n,[i]:[...n[i]]})},v=U=>{n[i][t]={...n[i][t],description:U.target.value},r({...n,[i]:[...n[i]]})},g=U=>{const w=U.target.value==="web"?"web":"docker";w==="web"&&n.dockerArgs.forEach(P=>{P.type="docker"});const q=`/${n.dockerImage.replace(/\W/g,"-")}-${t}`;n.dockerArgs[t]={...n.dockerArgs[t],type:w,path:w==="docker"?q:"/",protocol:"http",prefix:w==="docker"?q:"/",name:"publicUrl",port:"BLOCKLET_PORT"},r({...n,dockerArgs:[...n.dockerArgs]})},k=U=>{n.dockerArgs[t]={...n.dockerArgs[t],proxyBehavior:U.target.value==="direct"?"direct":"service"},r({...n,dockerArgs:[...n.dockerArgs]})},S=U=>{const w=U.target.value;n[i][t]={...n[i][t],prefix:w,path:w==="*"?"/":w},r({...n,[i]:[...n[i]]})},R=U=>{var w;(w=n[i])!=null&&w[t]&&(n[i][t].value=U.target.value),r({...n,[i]:[...n[i]]})},T=u===`$${Ct(o.key)}`||o.custom,D=i==="dockerArgs"&&!gn[o.key],B=Bs[o.key],$=i==="dockerEnvs",z=o.key==="--publish";let J=o.key;return z&&o.type==="web"?J="--publish (Web)":$&&(J=`--env ${o.key}`),e.jsxs(c,{sx:{display:"flex",flexDirection:"row",gap:2,alignItems:"center"},children:[e.jsx(c,{sx:{width:250},children:e.jsx(N,{sx:{textOverflow:"ellipsis",width:"100%",overflow:"hidden"},children:J})}),e.jsxs(c,{sx:{display:"flex",flexDirection:"column",gap:1,flex:1},children:[e.jsx(re,{disabled:l||T||D||o.value===fe.BLOCKLET_AUTOMATIC_ENV_VALUE,placeholder:"",value:T?`$${Ct(o.key)}`:u,sx:{flex:1},InputProps:{endAdornment:e.jsxs(Ye,{position:"end",sx:{zoom:.9},children:[(!(B||D)||$||z)&&e.jsx(de,{onClick:()=>x(!0),children:e.jsx(ue,{icon:"icon-park-outline:setting-config"})}),!l&&e.jsx(de,{onClick:b,color:D?"error":"default",children:e.jsx(ue,{icon:"ic:round-delete"})})]})},error:D,onChange:R}),D&&e.jsx(N,{variant:"caption",color:"error",children:a("blocklet.publish.docker.noAllowTheArg")}),o.key==="--publish"&&e.jsx(N,{variant:"caption",color:"text.secondary",children:a("blocklet.publish.docker.publishTips")}),o.key==="--volume"&&Ms[o.key](u)&&e.jsx(N,{variant:"caption",color:"error",children:a("blocklet.publish.docker.volumeTips")})]}),d&&e.jsx(ft,{open:!0,fullWidth:!0,maxWidth:"sm",PaperProps:{style:{minHeight:0}},title:a($?"blocklet.publish.docker.modifyEnv":"blocklet.publish.docker.modifyParam"),onClose:()=>x(!1),children:e.jsxs(c,{sx:{display:"flex",flexDirection:"column",gap:1,paddingBottom:2},children:[B||D||$?null:e.jsxs(c,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(N,{children:a("blocklet.publish.docker.needCustomInput")}),e.jsx(Ee,{disabled:l,checked:T,onChange:p,sx:{zoom:.9}})]}),$&&e.jsxs(c,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(N,{children:a("blocklet.publish.docker.shared")}),e.jsx(Ee,{disabled:l,checked:o.shared,onChange:m,sx:{zoom:.9}})]}),$&&e.jsxs(c,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(N,{children:a("blocklet.publish.docker.required")}),e.jsx(Ee,{disabled:l,checked:o.required,onChange:f,sx:{zoom:.9}})]}),$&&e.jsxs(c,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(N,{children:a("blocklet.publish.docker.secure")}),e.jsx(Ee,{disabled:l,checked:o.secure,onChange:h,sx:{zoom:.9}})]}),$&&e.jsxs(c,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(N,{children:a("blocklet.publish.docker.autoGenerated")}),e.jsx(Ee,{disabled:l,checked:o.value===fe.BLOCKLET_AUTOMATIC_ENV_VALUE,onChange:y,sx:{zoom:.9}})]}),$&&e.jsxs(c,{sx:{mt:1,width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(N,{sx:{flex:1},children:a("blocklet.publish.docker.description")}),e.jsx(re,{disabled:l,value:o.description,onChange:v,sx:{flex:1},label:a("blocklet.publish.docker.description")})]}),z&&e.jsxs(c,{sx:{mt:1,width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(N,{sx:{flex:1},children:a("blocklet.publish.docker.portType")}),e.jsxs(It,{value:o.type||"docker",onChange:g,children:[e.jsx(be,{value:"docker",children:"Docker"}),e.jsx(be,{value:"web",children:"Web"})]})]}),z&&o.type==="web"&&e.jsxs(c,{sx:{mt:1,width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(N,{sx:{flex:1},children:a("blocklet.publish.docker.proxyBehavior")}),e.jsxs(It,{value:o.proxyBehavior||"service",onChange:k,children:[e.jsx(be,{value:"service",children:a("blocklet.publish.docker.serviceProxy")}),e.jsx(be,{value:"direct",children:a("blocklet.publish.docker.directProxy")})]})]}),z&&o.type==="web"&&e.jsxs(c,{sx:{mt:1,width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(N,{sx:{flex:1},children:a("blocklet.publish.docker.prefix")}),e.jsx(re,{disabled:l,value:o.prefix,onChange:S,sx:{flex:1},label:a("blocklet.publish.docker.prefix")})]})]})})]})}dt.propTypes={dockerParams:s.object.isRequired,setDockerParams:s.func.isRequired,dataKey:s.string.isRequired,item:s.object.isRequired,t:s.func.isRequired,readOnly:s.bool.isRequired,index:s.number.isRequired};dt.defaultProps={};const cl=`
194
+ docker run --name postgrest
195
+ -p 3000:3000
196
+ -e PGRST_DB_URI="postgres://username:password@host:port/database"
197
+ -e PGRST_DB_SCHEMA="public"
198
+ -e PGRST_DB_ANON_ROLE="anon"
199
+ postgrest/postgrest
200
+ `.trim();function vo({readOnly:t,paramsErrTip:o,setParamsErrTip:n,error:r,params:i,setParams:a}){const{t:l}=Z(),[u,d]=j.useState("dockerCommand"),[x,b]=j.useState(""),[p,h]=j.useState(!1),[m,f]=j.useState("--volume"),[y,v]=j.useState(""),[g,k]=j.useState(Eo(x)),S=g.dockerArgs||[],R=g.dockerEnvs||[],T=g.dockerImage||"",D=g.dockerCommand||"",B=I=>{const{value:q}=I.target;b(q)};j.useEffect(()=>{i.blockletDocker&&i.blockletDocker.dockerImage&&!T&&k(i.blockletDocker)},[i,T,k]);const $=I=>{const q=Eo(I.target.value);k(P=>{const A=P.dockerArgs.find(_=>_.key==="--publish"&&_.type==="web");let H=!1;const C=_=>{_.type="web",_.path=A.path||"/",_.protocol=A.protocol||"http",_.prefix=A.prefix||"/",_.name=A.name||"publicUrl",_.port=A.port||"BLOCKLET_PORT"};if(q.dockerArgs.forEach(_=>{const G=P.dockerArgs.find(F=>F.key===_.key);G&&(Object.entries(G).forEach(([F,K])=>{K!=null&&F!=="value"&&(_[F]=K)}),_.proxyBehavior=_.proxyBehavior||"server",_.key==="--publish"&&_.type==="web"&&(H?_.type="docker":(C(_),H=!0)))}),A&&!q.dockerArgs.find(G=>G.key==="--publish"&&G.type==="web")){const G=q.dockerArgs.find(F=>F.key==="--publish"&&F.value===A.value);G?C(G):(H=!1,q.dockerArgs.forEach(F=>{F.key==="--publish"&&!H&&(C(F),H=!0)}))}return q.dockerEnvs.forEach(_=>{const G=P.dockerEnvs.find(F=>F.key===_.key);G&&Object.entries(G).forEach(([F,K])=>{K!=null&&F!=="value"&&(_[F]=K)})}),q})},z=()=>{if(h(!1),m==="--env"){k({...g,dockerEnvs:[...R,{key:y,value:"",custom:"",secure:!1,shared:!1,required:!1,description:y}]}),v("");return}k({...g,dockerArgs:[...S,{key:m,value:"",type:"docker",name:"",path:"",prefix:"",protocol:""}]})},J=()=>{h(!1),v("")},U=I=>{const{value:q}=I.target;k({...g,dockerImage:q}),q.indexOf(" ")>-1?n({...o,dockerImageName:l("blocklet.publish.docker.dockerImageNameError")}):n({...o,dockerImageName:""})},w=I=>{const{value:q}=I.target;k({...g,dockerCommand:q});try{Us(q),n({...o,dockerCMD:""})}catch{n({...o,dockerCMD:l("blocklet.publish.docker.dockerCMDError")})}};return j.useEffect(()=>{u==="dockerCommand"&&b(Vs(g))},[g,u]),j.useEffect(()=>{a(I=>({...I,blockletDocker:{dockerImage:g.dockerImage,dockerCommand:g.dockerCommand,dockerArgs:g.dockerArgs,dockerEnvs:g.dockerEnvs}}))},[g,a]),e.jsxs(c,{sx:{mt:3},children:[e.jsxs(c,{sx:{width:"100%",display:"flex",flexDirection:"column",gap:2},children:[e.jsx(c,{sx:{borderBottom:1,borderColor:"divider",mb:2},children:e.jsxs(ln,{value:u,onChange:(I,q)=>d(q),children:[e.jsx(rt,{value:"dockerCommand",label:l("blocklet.publish.docker.dockerCommand")}),e.jsx(rt,{value:"dockerParams",label:l("blocklet.publish.docker.dockerParams")})]})}),u==="dockerCommand"&&e.jsxs(c,{children:[e.jsx(re,{disabled:t,label:l("blocklet.publish.docker.pleaseInputDockerCommand"),placeholder:cl,InputProps:{"data-cy":"blocklet-docker-command",readOnly:t},autoComplete:"off",variant:"outlined",fullWidth:!0,multiline:!0,spellCheck:!1,minRows:10,value:x,onChange:B,onBlur:$}),e.jsxs(c,{sx:{display:"flex",flexDirection:"row",gap:2,alignItems:"center"},children:[e.jsx(c,{flex:1}),e.jsx(ee,{sx:{mt:2},variant:"contained",onClick:()=>d("dockerParams"),children:l("blocklet.publish.docker.nextTab")})]})]}),u==="dockerParams"&&e.jsxs(c,{sx:{display:"flex",flexDirection:"column",gap:2},children:[e.jsx(re,{disabled:t,label:l("blocklet.publish.docker.dockerImageName"),placeholder:"Example: docker.io/postgrest/postgrest:latest",value:T,sx:{flex:1},color:o.dockerImageName?"error":"primary",error:!!o.dockerImageName,helperText:o.dockerImageName||"",onChange:U}),e.jsx(re,{disabled:t,label:`Docker CMD (${l("common.optional")})`,placeholder:"Docker CMD",value:D,sx:{flex:1},color:o.dockerCMD?"error":"primary",error:!!o.dockerCMD,helperText:o.dockerCMD||"",onChange:w}),e.jsx(c,{sx:{height:4}}),S.map((I,q)=>e.jsx(dt,{index:q,item:I,dockerParams:g,setDockerParams:k,dataKey:"dockerArgs",t:l,readOnly:t},`${I.key}-${q}`)),R.map((I,q)=>e.jsx(dt,{index:q,item:I,dockerParams:g,setDockerParams:k,dataKey:"dockerEnvs",t:l,readOnly:t},`${I.key}-${q}`)),!t&&e.jsxs(c,{sx:{display:"flex",flexDirection:"row",gap:2,alignItems:"center"},children:[e.jsx(c,{sx:{flex:1}}),e.jsx(ee,{onClick:()=>h(!0),children:l("blocklet.publish.docker.addItem")})]})]})]}),!!r&&e.jsx(c,{color:"error.main",mt:1,fontSize:14,children:r}),p&&e.jsxs(pt,{fullWidth:!0,open:!0,children:[e.jsx(Zo,{children:l("blocklet.publish.docker.addItem")}),e.jsx(Ko,{children:e.jsxs(is,{sx:{mt:1,width:"100%",minWidth:480,maxWidth:"100%"},children:[e.jsx(It,{labelId:"demo-simple-select-helper-label",id:"demo-simple-select-helper",value:m,sx:{width:"100%"},onChange:I=>f(I.target.value),children:Object.keys(gn).map(I=>e.jsx(be,{value:I,children:I}))}),m==="--publish"&&e.jsx(N,{variant:"caption",color:"text.secondary",children:l("blocklet.publish.docker.publishTips")}),m==="--volume"&&e.jsx(N,{variant:"caption",color:"text.secondary",children:l("blocklet.publish.docker.volumeTips")}),m==="--env"&&e.jsxs(c,{sx:{mt:3,width:"100%"},children:[e.jsx(re,{value:y,onChange:I=>v(I.target.value),sx:{width:"100%"},label:l("blocklet.publish.docker.envKey")}),e.jsx(cs,{children:l("blocklet.publish.docker.dockerArgValue")})]})]})}),e.jsxs(en,{children:[e.jsx(ee,{onClick:J,children:l("common.cancel")}),e.jsx(ee,{onClick:z,children:l("common.confirm")})]})]})]})}vo.propTypes={readOnly:s.bool.isRequired,params:s.object.isRequired,setParams:s.func.isRequired,error:s.string.isRequired,setParamsErrTip:s.func.isRequired,paramsErrTip:s.func.isRequired};vo.defaultProps={};function Vo(t,o,{ttl:n=1e3*60*60,skipStorage:r=!1,onUpdate:i=()=>{}}={}){const[a,l]=$s(o),u=j.useRef(null),d=j.useRef(i);j.useEffect(()=>{if(r)return;const b=hs(t);b&&(l(b),u.current=b),d.current(b)},[t,l,r]);const x=j.useCallback(b=>{l(p=>{const h=typeof b=="function"?b(p):{...p,...b};return fs(t,h,n,100),h})},[t,n,l]);return{state:a,setState:r?l:x,historyStateRef:u,removeStorage:()=>{bs(t)}}}const al=({tabs:t,blocklet:o,ancestors:n=[]})=>{const r=o.meta.did;t.push({label:e.jsxs(c,{display:"flex",alignItems:"center",justifyContent:"flex-start",children:[e.jsx(zt,{size:24,blocklet:o,ancestors:n}),e.jsx(c,{ml:"4px",className:"text",children:e.jsx(c,{children:o.meta.title})})]},r),value:r})},Uo=(t,o)=>{const n=Wt(t,["blockletVersion","blockletTitle","blockletDescription","blockletLogo","blockletIntroduction","blockletVideos","blockletScreenshots","blockletResourceType","blockletSupport","blockletHomepage","blockletCommunity","blockletRepository","blockletDocker","contentType","connectedStores","blockletComponents","lastReleaseId","uploadedResource","autoUpload","possibleSameStore","note","connectedEndpoints"]);return n.blockletComponents?n.blockletComponents=n.blockletComponents.map(r=>({...r,included:!0})):n.blockletComponents=(o.children||[]).map(r=>({did:r.meta.did,included:!1,required:!1})),n},dl={0:"branding",1:"introduction",2:"resources",3:"blocklets",4:"version"},Fo={branding:0,introduction:1,resources:2,blocklets:3,version:4};function wo({initUrl:t,...o}){var Co,So;const{projectId:n,mode:r,releaseId:i,lastVersion:a,componentDid:l=""}=ut(),u=n===Y.UNOWNED_DID||r==="view",{t:d,locale:x}=Z(),{blocklet:b}=Te(),{state:p,setState:h,historyStateRef:m,removeStorage:f}=Vo(`blocklet-studio-params-${n}-${a}`,{blockletScreenshots:[],blockletVideos:[],publishedStoreIds:[],connectedStores:[],uploadedResource:"",contentType:"blocklet",blockletResourceType:"",blockletSupport:"",blockletCommunity:"",blockletHomepage:"",blockletRepository:"",blockletDocker:{dockerImage:"",dockerArgs:[],dockerEnvs:[]}},{skipStorage:u}),[y,v]=Xe({}),[g,k]=Xe({}),S=j.useRef(""),[R,T]=j.useState(!1),[D,B]=Xe(null),{api:$}=ke(),z=Ve(L=>L.breakpoints.down("md")),[J,U]=j.useState({}),w=j.useRef({}),{state:I,setState:q}=Vo(`blocklet-studio-selectedResourceIds-${n}-${a}`,{},{skipStorage:n===Y.UNOWNED_DID||r==="view"}),[P,A]=j.useState(""),[H,C]=Xe({}),_=t==null?void 0:t.searchParams.get("dependentComponentsMode"),G=_==="readonly",{session:F}=Fe(),{storeList:K}=ro({fromBlocklet:!0,blocklet:b,componentDid:l,userDid:(Co=F==null?void 0:F.user)==null?void 0:Co.did}),[E,Q]=j.useState([]);j.useEffect(()=>{Array.isArray(K)&&K.length>0&&Promise.all(K.map(async L=>({...(await(await fetch(`${L.url}/__blocklet__.js?type=json`)).json()).preferences,storeInfo:L}))).then(L=>{Q(L)})},[K.length]),j.useEffect(()=>{const L={},O={},{logoUrl:xe,screenshotUrls:_e}=$n(p,b,n);Promise.all(E.map(async ge=>{const{maxImageCount:Oe,minImageCount:jt,logoImageType:We,imageMinHeight:Je,imageMinWidth:Be}=ge,tt=Array.isArray(We)?We:We.split(",");L[ge.storeInfo.url]||(L[ge.storeInfo.url]={}),O[ge.storeInfo.url]||(O[ge.storeInfo.url]={});const kt=O[ge.storeInfo.url],Bn=L[ge.storeInfo.url];Number(Oe)<=_e.length&&(kt.maxImageCount=d("blocklet.publish.storeRule.maxImageCount",{max:Oe,count:_e.length,unit:Oe>1?d("blocklet.publish.storeRule.screenshots"):d("blocklet.publish.storeRule.screenshot")})),Number(ge.minImageCount)>_e.length&&(kt.minImageCount=d("blocklet.publish.storeRule.minImageCount",{min:jt,count:_e.length,unit:jt>1?d("blocklet.publish.storeRule.screenshots"):d("blocklet.publish.storeRule.screenshot")}));const Do=xe?xe.split(".").pop():"";Do&&!(tt.includes("jpg")?[...tt,"jpeg"]:tt).includes(Do)&&(Bn.logoFormat=d("blocklet.publish.storeRule.logoFormat",{format:tt.join(",")})),await Promise.all(_e.map((Mn,yt)=>{const vt=new Image;return vt.src=Mn,new Promise(Vn=>{vt.onload=()=>{const{width:Un,height:Fn}=vt;if(Un<Number(Be)||Fn<Number(Je)){let Ge="";switch(yt+1){case 1:Ge=d("blocklet.publish.storeRule.first");break;case 2:Ge=d("blocklet.publish.storeRule.second");break;case 3:Ge=d("blocklet.publish.storeRule.third");break;default:Ge=`${yt+1}`;break}kt[`imageSize-${yt+1}`]=d("blocklet.publish.storeRule.minImageSize",{width:Be,height:Je,name:Ge})}Vn()}})}))})).then(()=>{const ge=Object.values(L).some(Be=>Object.values(Be).length>0),Oe=Object.values(O).some(Be=>Object.values(Be).length>0),We={logoErrors:L,screenshotErrors:O,storeList:K,hasWarning:ge||Oe,hasLogoWarning:ge,hasScreenshotWarning:Oe},Je=JSON.stringify(We);Je!==S.current&&(k(We),S.current=Je)})},[p,b.did,n,E,d]);const X=j.useMemo(()=>{const L={};return Object.keys(H).forEach(O=>{const xe=H[O];xe&&xe.forEach(_e=>{L[_e]=!0})}),L},[H]),oe=j.useCallback(L=>{G&&h({blockletComponents:[]}),C(L)},[G,C,h]),le=j.useCallback((...L)=>{q(...L),v({blockletResource:"",blockletDocker:""})},[]),te=i==="none"?(p==null?void 0:p.lastReleaseId)||"":i,[ne,ae]=j.useState(r==="new-release"?4:0),Ze=t==null?void 0:t.searchParams.get("resourcesTitle"),Ke=t==null?void 0:t.searchParams.get("componentsTitle"),ve=[{label:d("blocklet.publish.branding"),description:d("blocklet.publish.steps.branding")},{label:d("common.introduction"),description:d("blocklet.publish.steps.introduction")},{label:Ze||d("blocklet.publish.resourceTitle"),description:d("blocklet.publish.steps.resources")},{label:Ke||d("common.components"),description:d("blocklet.publish.steps.blocklets")},{label:d("blocklet.publish.versionTitle"),description:d("blocklet.publish.steps.version")}],ie=ve[ne]||ve[ve.length-1],he=dl[ne];j.useEffect(()=>{n&&v({projectId:""})},[n,v]);const W=j.useMemo(()=>{var L;return(p==null?void 0:p.blockletResourceType)==="resource"?"resource":(L=p==null?void 0:p.blockletComponents)!=null&&L.some(O=>O.included)||Object.keys(X).length||p!=null&&p.uploadedResource?"pack":"resource"},[p==null?void 0:p.blockletComponents,p==null?void 0:p.uploadedResource,X,p==null?void 0:p.blockletResourceType]),qe=[],Ne=((b==null?void 0:b.children)||[]).filter(L=>{var O;return(O=L.meta.resource)==null?void 0:O.exportApi}).filter(L=>!l||L.meta.did===l);Ne.forEach(L=>{al({tabs:qe,blocklet:L,t:d,ancestors:[b]})});const[He,et]=j.useState((So=qe[0])==null?void 0:So.value),ce=r==="view",Ae=Ps(()=>{if(!t)return;A(t.searchParams.get("logo")),h(O=>{var xe;return{...O,blockletTitle:(O==null?void 0:O.blockletTitle)||t.searchParams.get("title"),blockletDescription:(O==null?void 0:O.blockletDescription)||t.searchParams.get("description"),blockletIntroduction:(O==null?void 0:O.blockletIntroduction)||t.searchParams.get("introduction")||t.searchParams.get("description"),blockletComponents:(xe=O==null?void 0:O.blockletComponents)!=null&&xe.length?O==null?void 0:O.blockletComponents:JSON.parse(t.searchParams.get("components")||"[]"),note:(O==null?void 0:O.note)||t.searchParams.get("note")||"No note"}});const L=t.searchParams.get("resources");try{const O=JSON.parse(L);U(O)}catch{}}),V=async()=>{if(te)try{const L=await $.getRelease({input:{did:b.meta.did,projectId:n,releaseId:te}});if(T(!1),!L.release){M.error("Release not found");return}L.release.note=Cn(L.release.note,"note"),L.release=zn(L.release),r!=="view"&&(L.release.note=""),h(O=>({...Uo({...O,...L.release,blockletVersion:r==="create"||r==="new-release"?Me.inc(L.release.blockletVersion,"patch"):L.release.blockletVersion},b)})),B(L.release)}catch(L){T(!1),M.error(je(L))}},se=async()=>{if(n===Y.UNOWNED_DID){h({blockletVersion:"0.0.1",blockletTitle:""});return}if(!n){M.error(d("blocklet.publish.errorTip.noDid"));return}try{const O=(await Dn($.getProject,[{input:{did:b.meta.did,projectId:n}}],{key:"getProject"})).project||{};O.blockletVersion?(r==="create"||r==="new-release")&&Me.valid(O.blockletVersion)&&(O.blockletVersion=Me.inc(O.blockletVersion,"patch")):O.blockletVersion="0.0.1";const xe=Uo(O,b);h({...xe}),O.lastReleaseId||Ae()}catch(L){M.error(je(L))}},me=j.useCallback(async()=>{if(!R){T(!0);try{if(r==="view"){if(!te){M.error("Empty release id");return}await se(),await V();return}await se(),te&&await V()}finally{r!=="view"&&h(L=>({...L,...m.current})),T(!1)}}},[r,te]),gt=L=>{h({blockletComponents:L})},Pe=L=>{h({blockletResourceType:L})};j.useEffect(()=>{me()},[me]),j.useEffect(()=>{n===Y.UNOWNED_DID&&(r==="create"||r==="new-release")&&t&&Ae()},[n,t,r,Ae]),j.useEffect(()=>{p.contentType==="docker"?h({resourceFromSelect:!1}):p.contentType==="blocklet"?h({resourceFromSelect:!0}):p.contentType==="upload"&&h({resourceFromSelect:!1})},[p.contentType,h]);const ze=j.useMemo(()=>!!Object.keys(I).find(L=>!!I[L].length),[I]);if(!p&&R)return e.jsx(Qe,{});if(!p)return null;const Ro=Ne.find(L=>L.meta.did===He),Wn=L=>{et(L)};return e.jsxs(ul,{...o,children:[e.jsx(xo,{blocklet:b,release:D,getData:me,getRelease:V,mode:r,params:p,setParams:h,setParamsErrTip:v,warning:g,readOnly:ce,loading:R,setLoading:T,initLogoUrl:P,releaseId:te,projectId:n,projectType:W,resourceComponents:Ne,resourceComponentsMap:H,resourceRelateComponents:X,resourceItem:Ro,saveSelectedEventsRef:w,hasSelectedResources:ze,setRelease:B,paramsErrTip:y,clearHistoryParams:f}),e.jsxs(c,{display:"flex",flexDirection:"column",sx:{width:"100%"},children:[e.jsx(c,{pt:3}),e.jsxs(c,{sx:{gap:3},display:"flex",flexDirection:z?"column":"row",children:[!z&&e.jsx(ko,{steps:ve,loading:R,viewMode:r==="view",params:p,hasSelectedResources:ze||p.uploadedResource,paramsErrTip:y,warning:g,activeStep:ne,setActiveStep:ae,projectId:n,resourcesUrlTitle:Ze,componentsUrlTitle:Ke}),e.jsxs(c,{flex:"1",maxWidth:"720px",children:[!z&&he!=="introduction"&&e.jsxs(N,{variant:"h6",fontWeight:"bold",display:"flex",flexDirection:"row",alignItems:"center",children:[ie.label,he==="branding"&&e.jsx(ye,{title:d("blocklet.publish.brandingHelp"),placement:"right",children:e.jsx(c,{component:"a",target:"_blank",href:`https://www.arcblock.io/docs/blocklet-store/${x}/blocklet-detail-page`,sx:{paddingTop:1,marginLeft:1},style:{color:"gray"},children:e.jsx(Ts,{})})})]}),(z||he==="branding")&&e.jsx(c,{flexDirection:"column",children:e.jsx(io,{projectId:n,setParams:h,setParamsErrTip:v,warning:g,params:p,componentDid:l,blocklet:b,initUrl:t,loading:R,setLoading:T,paramsErrTip:y,readOnly:ce,initLogoUrl:P,setInitLogoUrl:A})}),z&&e.jsx(c,{flexDirection:"column",children:e.jsx(at,{loading:R,params:p,paramsErrTip:y,setParams:h,setParamsErrTip:v,readOnly:ce})}),(z||he==="introduction")&&e.jsx(c,{display:"flex",flexDirection:"column",sx:{mt:z?5:0,width:"100%"},children:e.jsx(An,{loading:R,readOnly:ce,params:p,setParams:h,paramsErrTip:y,setParamsErrTip:v})}),z&&e.jsx(N,{variant:"h6",fontWeight:"bold",mt:5,children:ve[Fo.resources].label}),e.jsx(c,{sx:{maxWidth:720},display:z||he==="resources"?"flex":"none",flexDirection:"column",children:e.jsx(c,{display:"flex",mt:3,className:"section full-width",children:e.jsxs(c,{sx:{flex:1},children:[e.jsxs(as,{onChange:L=>h({contentType:L.target.value}),children:[e.jsx(nt,{value:"blocklet",disabled:ce,control:e.jsx(Rt,{size:"small",checked:p.contentType==="blocklet"}),label:d("blocklet.publish.resourceSelect")}),e.jsx(nt,{value:"upload",disabled:ce,control:e.jsx(Rt,{size:"small",checked:p.contentType==="upload"}),label:d("blocklet.publish.resourceUpload")}),e.jsx(nt,{value:"docker",disabled:ce,control:e.jsx(Rt,{size:"small",checked:p.contentType==="docker"}),label:d("blocklet.publish.resourceDocker")})]}),e.jsxs(c,{display:p.contentType==="blocklet"?"block":"none",children:[!l&&e.jsx(pn,{tabs:qe,current:He,onChange:Wn,sx:{ml:-2,mt:2,maxWidth:z?window.innerWidth-24:"100%"}}),e.jsx(oo,{loading:R,initialResources:J,saveSelectedEventsRef:w,selectedResourceIds:I,setSelectedResourceIds:le,setResourceComponentsMap:oe,error:y.blockletResource,app:b,readOnly:ce,component:Ro,componentDid:l,initUrl:t,params:p,showTree:p.contentType==="blocklet",setParams:h,projectId:n===Y.UNOWNED_DID?"":n,release:{...D,id:te}})]}),p.contentType==="upload"&&e.jsx(yo,{app:b,readOnly:ce,projectId:n===Y.UNOWNED_DID?"":n,params:p,error:y.blockletResource,setParams:h,setParamsErrTip:v}),p.contentType==="docker"&&e.jsx(vo,{app:b,readOnly:ce,projectId:n===Y.UNOWNED_DID?"":n,params:p,error:y.blockletResource,setParams:h,setParamsErrTip:v,paramsErrTip:y})]})})}),z&&e.jsx(N,{variant:"h6",fontWeight:"bold",mt:5,children:ve[Fo.blocklets].label}),(z||he==="blocklets")&&e.jsx(c,{flexDirection:"column",children:e.jsx(c,{display:"flex",mt:3,className:"section full-width",children:e.jsx(c,{sx:{flex:1},children:e.jsx(Qt,{projectType:W,disabled:R||ce,app:b,value:(p==null?void 0:p.blockletComponents)||[],blockletResourceType:(p==null?void 0:p.blockletResourceType)||"",onChange:gt,onChangeBlockletResourceType:Pe,resourceRelateComponents:X,dependentComponentsMode:_})})})}),!z&&he==="version"&&e.jsx(c,{flexDirection:"column",children:e.jsx(at,{loading:R,params:p,paramsErrTip:y,setParams:h,setParamsErrTip:v,readOnly:ce})})]})]})]})]})}wo.propTypes={initUrl:s.object};wo.defaultProps={initUrl:null};const ul=Re.div`
201
+ .section {
202
+ &.full-width {
203
+ max-width: 100%;
204
+ }
205
+ .MuiTypography-h3 {
206
+ font-size: 1.1rem;
207
+ font-weight: 700;
208
+ }
209
+ .left {
210
+ flex-shrink: 0;
211
+ width: 140px;
212
+ }
213
+ .MuiTabs-indicator {
214
+ display: none;
215
+ }
216
+ .MuiTypography-subtitle1 {
217
+ width: 120px;
218
+ font-weight: 700;
219
+ font-size: 1rem;
220
+ ${({theme:t})=>t.breakpoints.down("sm")} {
221
+ width: 80px;
222
+ }
223
+ }
224
+ }
225
+ .MuiButtonBase-root {
226
+ a {
227
+ color: inherit;
228
+ }
229
+ }
230
+ .MuiInputBase-multiline .MuiInputAdornment-positionEnd {
231
+ align-self: flex-end;
232
+ .MuiTypography-root {
233
+ font-size: 0.8rem;
234
+ }
235
+ font-size: 0.8rem;
236
+ }
237
+ `;function On({padding:t,initUrl:o}){const{blocklet:n}=Te(),r=Jn(),{componentDid:i}=ut();if(j.useEffect(()=>{if(i&&window.parent){const l=`${r.pathname}${r.search}`;window.parent.postMessage({event:"popstate",page:"publish",componentDid:i,path:l},"*")}},[i,r]),!n)return null;const a={};return t&&(a.padding=t),e.jsx(pl,{style:a,children:e.jsxs(Gn,{children:[e.jsx(wt,{path:"/",element:e.jsx(Gt,{initUrl:o})}),e.jsx(wt,{path:"/:projectId",element:e.jsx(cr,{})}),e.jsx(wt,{path:"/:projectId/:mode/:releaseId/:lastVersion",element:e.jsx(wo,{initUrl:o})})]})})}On.propTypes={padding:s.oneOfType([s.string,s.number]),initUrl:s.object};On.defaultProps={padding:"",initUrl:null};const pl=Re(c)`
238
+ a {
239
+ color: ${({theme:t})=>t.palette.primary.main};
240
+ }
241
+ `;export{On as default};