@abtnode/blocklet-services 1.16.44-beta-20250512-155818-937e465d → 1.16.44-beta-20250516-225119-c0b5ec8d

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 (268) 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/user-util.js +1 -1
  23. package/dist/assets/{AdapterDayjs-BD9H1lZ-.js → AdapterDayjs-YbaNvT9I.js} +1 -1
  24. package/dist/assets/{ArrowDropDown-BrO-zDlb.js → ArrowDropDown-xgs4N3Rf.js} +1 -1
  25. package/dist/assets/{CheckCircle-Ds4QI0ey.js → CheckCircle-JXD6tKIa.js} +1 -1
  26. package/dist/assets/{ChevronLeft-CnQaQ-rc.js → ChevronLeft-D0eko_T8.js} +1 -1
  27. package/dist/assets/{ChevronRight-a_2_x6Ew.js → ChevronRight-CQY9Ni7X.js} +1 -1
  28. package/dist/assets/{Community-DW6DJTIs.js → Community-BCL2L7ib.js} +1 -1
  29. package/dist/assets/{DeleteOutline-CFN4r-OG.js → DeleteOutline-BEGOj_wq.js} +1 -1
  30. package/dist/assets/{Done-DqSE6KPe.js → Done-BUJJNjlP.js} +1 -1
  31. package/dist/assets/{Download-C_LRKzbG.js → Download-DdZEsxmZ.js} +1 -1
  32. package/dist/assets/{Edit-CbR4eoK8.js → Edit-vxeVwrqO.js} +1 -1
  33. package/dist/assets/{EditIcon-DxUWMw59.js → EditIcon-Dffk7mPL.js} +1 -1
  34. package/dist/assets/{Email-DWueGk7t.js → Email-CdSNK0eA.js} +1 -1
  35. package/dist/assets/{Error-jEHdDLNk.js → Error-C-RD4e9g.js} +1 -1
  36. package/dist/assets/{ExpandLess-CkoEHpgk.js → ExpandLess-CmqG9SE7.js} +1 -1
  37. package/dist/assets/{Google-DHEolkW-.js → Google-B7PA4qF8.js} +1 -1
  38. package/dist/assets/{Holiday-Dwvo6QkZ.js → Holiday-enHMZqEf.js} +1 -1
  39. package/dist/assets/{InfoOutlined-DkG0jjos.js → InfoOutlined-BIr5nkjV.js} +1 -1
  40. package/dist/assets/{Launch-B-2Jomi6.js → Launch-KvZQI_SA.js} +1 -1
  41. package/dist/assets/{LaunchOutlined-CXNijfqX.js → LaunchOutlined-ClxZU_tj.js} +1 -1
  42. package/dist/assets/{Location-DUEOr9J2.js → Location-By12Z3Te.js} +1 -1
  43. package/dist/assets/{LockIcon-Cjg8jV1E.js → LockIcon-98CKEIBe.js} +1 -1
  44. package/dist/assets/{Meeting-CJaI_cKm.js → Meeting-CLeFWDkY.js} +1 -1
  45. package/dist/assets/{MoreHoriz-B6KdR0Y8.js → MoreHoriz-H8rabTmY.js} +1 -1
  46. package/dist/assets/{OffSick-C9VqqjrN.js → OffSick-dUm363rs.js} +1 -1
  47. package/dist/assets/{Phone-DcHUzCa-.js → Phone--BSu-btI.js} +1 -1
  48. package/dist/assets/{PlayArrow-BToG9L6q.js → PlayArrow-CmxnItFZ.js} +1 -1
  49. package/dist/assets/{QuestionMarkCircle-BPVDAm8U.js → QuestionMarkCircle-DTf-Tya5.js} +1 -1
  50. package/dist/assets/{ServerLogo-s6cfhx92.js → ServerLogo-CEsILJl5.js} +1 -1
  51. package/dist/assets/{Timezone-B-Ho_Uno.js → Timezone-YZ0dMUEr.js} +1 -1
  52. package/dist/assets/{TuneOutlined-BR2H7Mxj.js → TuneOutlined-DmhFMgM-.js} +1 -1
  53. package/dist/assets/{ViewList-D8vtMKQz.js → ViewList-DXk3qGFU.js} +1 -1
  54. package/dist/assets/{WorkingRemotely-lJ6DUMCR.js → WorkingRemotely-BX7rgbEY.js} +1 -1
  55. package/dist/assets/{access-control-CCSlKYYz.js → access-control-DfNk54C9.js} +1 -1
  56. package/dist/assets/{actions-BjTeIzgS.js → actions-V9hjjowb.js} +1 -1
  57. package/dist/assets/{add-component-core-C7-Epxoj.js → add-component-core-Dx4Ojnmk.js} +16 -16
  58. package/dist/assets/add-resource-CxXfKLfm.js +1 -0
  59. package/dist/assets/addon-DtaZ0TB3.js +14 -0
  60. package/dist/assets/{advanced-tG5IRVhQ.js → advanced-Ddtt8Hj-.js} +1 -1
  61. package/dist/assets/appearance-BrPMC4u8.js +1 -0
  62. package/dist/assets/ar-2yn9i2dw.js +7 -0
  63. package/dist/assets/audit-logs-D9m5k0JB.js +35 -0
  64. package/dist/assets/{authorize-DNTNbUhI.js → authorize-T5C3DfFM.js} +1 -1
  65. package/dist/assets/{base32-_zEVBJUg.js → base32-BPfgmw66.js} +1 -1
  66. package/dist/assets/blocklet-default-logo-Bspnu_ws.png +0 -0
  67. package/dist/assets/{branding-hDeNkLC2.js → branding-BVm4-_4U.js} +2 -2
  68. package/dist/assets/{branding-By8KDk5Q.js → branding-hFlZ2gIT.js} +2 -2
  69. package/dist/assets/{bundle-avatar-DYTLzqlT.js → bundle-avatar-BEofqN1I.js} +1 -1
  70. package/dist/assets/button-m03GMAJs.js +1 -0
  71. package/dist/assets/click-to-copy-DmYkL7Ui.js +1 -0
  72. package/dist/assets/{collapse-QV_2gdtM.js → collapse-FsvH0gRe.js} +1 -1
  73. package/dist/assets/complete-DwnM8k9G.js +39 -0
  74. package/dist/assets/{component-Blsql2u0.js → component-s7RjpIXH.js} +8 -8
  75. package/dist/assets/{config-LE_EJolF.js → config-Dl_53WnU.js} +1 -1
  76. package/dist/assets/{config-D6r2ZAFY.js → config-bdYGvEMY.js} +2 -2
  77. package/dist/assets/{config-navigation-B0nu0al4.js → config-navigation-bI89qiN3.js} +3 -3
  78. package/dist/assets/config-space-D1h9DQze.js +1 -0
  79. package/dist/assets/confirm-zdbJI4Oz.js +7 -0
  80. package/dist/assets/{connect-Cu2Ssv5A.js → connect-B2amNptu.js} +1 -1
  81. package/dist/assets/connect-BTGTAWj-.js +5 -0
  82. package/dist/assets/connect-to-DrS33AaQ.js +1 -0
  83. package/dist/assets/{content-layout-BzF-fNQz.js → content-layout--sy9JlYZ.js} +1 -1
  84. package/dist/assets/dashboard-u-oRSlsi.js +239 -0
  85. package/dist/assets/de-CEKbJD3-.js +7 -0
  86. package/dist/assets/delete-confirm-CUNBU1J1.js +1 -0
  87. package/dist/assets/{did-address-DjwPl1uy.js → did-address-BI9LYTx-.js} +1 -1
  88. package/dist/assets/domain-ER_Bg0qe.js +9 -0
  89. package/dist/assets/domain-action-card-CYBXEnlZ.js +28 -0
  90. package/dist/assets/domains-CBYb9WvZ.js +1 -0
  91. package/dist/assets/dot-BB5occkV.js +7 -0
  92. package/dist/assets/{email-BZVu6WP-.js → email-BmZcVM-V.js} +2 -2
  93. package/dist/assets/{empty-spinner-n0_Ehns5.js → empty-spinner-BZw_ShnT.js} +1 -1
  94. package/dist/assets/{es-BuUaHPig.js → es-dvMygD-W.js} +3 -3
  95. package/dist/assets/{exchange-passport-8jdiPDph.js → exchange-passport-B5vniH8u.js} +1 -1
  96. package/dist/assets/fr-BvFd5xp9.js +7 -0
  97. package/dist/assets/{fuel-Dx_cnsCl.js → fuel-DW3R8bWE.js} +1 -1
  98. package/dist/assets/{gen-access-key-CqKmmKML.js → gen-access-key-h48ZchOb.js} +1 -1
  99. package/dist/assets/get-safe-url-BcH2iukm.js +1 -0
  100. package/dist/assets/get-safe-url-OaLLn0UN.js +1 -0
  101. package/dist/assets/hi-C51yBXa5.js +5 -0
  102. package/dist/assets/{home-DzCwBE8F.js → home-CJ28zTIJ.js} +1 -1
  103. package/dist/assets/id-B1Mq_eQI.js +7 -0
  104. package/dist/assets/{iframe-DW7zzzTG.js → iframe-D0kv9-rE.js} +1 -1
  105. package/dist/assets/index-8eXqqyHQ.js +5 -0
  106. package/dist/assets/index-BGat0zzz.js +284 -0
  107. package/dist/assets/index-BXdw6keY.js +1 -0
  108. package/dist/assets/{index-BDYaw77z.js → index-BdH_4Yfe.js} +1 -1
  109. package/dist/assets/{index-C5SsKJ2n.js → index-C0te7llT.js} +18 -14
  110. package/dist/assets/index-C1rBJXFe.js +1 -0
  111. package/dist/assets/index-C3bbolus.js +113 -0
  112. package/dist/assets/{index-BYCeMwoO.js → index-C849wD9b.js} +1 -1
  113. package/dist/assets/{index-Bju4sfVL.js → index-CJpkpFKR.js} +2 -2
  114. package/dist/assets/index-CNauVjuD.js +99 -0
  115. package/dist/assets/{index-Btl_rz0J.js → index-CSbITcwB.js} +17 -17
  116. package/dist/assets/{index-DcUhenm6.js → index-CmQOzzP8.js} +1 -1
  117. package/dist/assets/{index-HU4yqI-9.js → index-D-X7HfwW.js} +1 -1
  118. package/dist/assets/{index-CPfvVvHv.js → index-D-mbJPLJ.js} +12 -12
  119. package/dist/assets/{index-enM9Y412.js → index-D3iGbfL9.js} +1 -1
  120. package/dist/assets/index-D70ICXrC.js +1 -0
  121. package/dist/assets/{index-DefO2n6z.js → index-DRCFOq4H.js} +58 -58
  122. package/dist/assets/{index-B8r-LrrM.js → index-DbsXFWms.js} +1 -1
  123. package/dist/assets/{index-BIPRCLBG.js → index-DoCu_ga_.js} +2 -2
  124. package/dist/assets/index-DwnC6XvN.js +6 -0
  125. package/dist/assets/{index-ftkgQlGr.js → index-DwswX2WL.js} +1 -1
  126. package/dist/assets/index-Up0XQY6f.js +55 -0
  127. package/dist/assets/index-VzeamwDR.js +241 -0
  128. package/dist/assets/index-nBzxkc-e.js +4 -0
  129. package/dist/assets/{index-SzdSxpkq.js → index-tD3kWii2.js} +4 -4
  130. package/dist/assets/{invitation-1bsb30Yz.js → invitation-CLUn7Gd4.js} +4 -4
  131. package/dist/assets/invite-B1zBa8Gp.js +1 -0
  132. package/dist/assets/issue-passport-5n5uQFFQ.js +1 -0
  133. package/dist/assets/item-BCYQnjF7.js +2 -0
  134. package/dist/assets/ja-CCKVmbEX.js +7 -0
  135. package/dist/assets/ko-A_w8tIEg.js +7 -0
  136. package/dist/assets/{landing-page-Due4o1uF.js → landing-page-CUrvCtHZ.js} +1 -1
  137. package/dist/assets/{launch-result-message-DIYoykBK.js → launch-result-message-Eea5FZDm.js} +1 -1
  138. package/dist/assets/{layout-D93HKT6w.js → layout-Bs_rMuQ9.js} +2 -2
  139. package/dist/assets/list-CFP3MiEI.js +2 -0
  140. package/dist/assets/list-M2tV_ZYf.js +236 -0
  141. package/dist/assets/list-header-DNFbdM3a.js +1 -0
  142. package/dist/assets/localization-Cl5vfs2R.js +1 -0
  143. package/dist/assets/{log--AX8zo75.js → log-CcpvITx1.js} +2 -3
  144. package/dist/assets/logger-BYg6vYBA.js +1 -0
  145. package/dist/assets/{login-WRcteY7r.js → login-4G5grSod.js} +1 -1
  146. package/dist/assets/login-oauth-callback-DMou-vp-.js +1 -0
  147. package/dist/assets/{logo-uploader-CQCy6MG3.js → logo-uploader-Bf6myR3q.js} +3 -3
  148. package/dist/assets/{lost-passport-kJX7pEJj.js → lost-passport-DWc6Kq0b.js} +2 -2
  149. package/dist/assets/{open-window--2G6Qjbq.js → open-window-CuyFfntO.js} +1 -1
  150. package/dist/assets/overview-vcNUrQdk.js +85 -0
  151. package/dist/assets/{page-header-xyZktwBS.js → page-header-DpNvpd52.js} +4 -4
  152. package/dist/assets/{passport-item-CIvCqz_R.js → passport-item-IDGIDfr4.js} +1 -1
  153. package/dist/assets/{permission-BH1TY_tz.js → permission-Cnn9EYOW.js} +1 -1
  154. package/dist/assets/preferences-Cqm2olsT.js +1 -0
  155. package/dist/assets/profile-embed-CcuuyEXm.js +1 -0
  156. package/dist/assets/pt-7HHecjdA.js +5 -0
  157. package/dist/assets/publish-resource-DGUHUINH.js +1 -0
  158. package/dist/assets/{react-beautiful-dnd.esm-7PS2VwOi.js → react-beautiful-dnd.esm-cfY5JZV6.js} +1 -1
  159. package/dist/assets/ru-Bw8FVC4M.js +5 -0
  160. package/dist/assets/runtime-efQyx-LE.js +1 -0
  161. package/dist/assets/sdk-CXaHNlMH.js +1 -0
  162. package/dist/assets/{section-Cv4udilp.js → section-C1TPQFRq.js} +1 -1
  163. package/dist/assets/{security-DM8MeY05.js → security-DFjq-0Qw.js} +4 -4
  164. package/dist/assets/{session-CHdTc1We.js → session-B2z_IWIe.js} +1 -1
  165. package/dist/assets/setup-CLYOmcmD.js +30 -0
  166. package/dist/assets/{shorten-label-Cng55547.js → shorten-label-Bf7YQUd6.js} +1 -1
  167. package/dist/assets/{simple-select-CP_Svi_D.js → simple-select-DwWEI_ZU.js} +1 -1
  168. package/dist/assets/{slicedToArray-C7EPqaHf.js → slicedToArray-BSaY8ui4.js} +1 -1
  169. package/dist/assets/{spaces-BVG-t3ND.js → spaces-DMMN97uo.js} +1 -1
  170. package/dist/assets/{start-CIjuDAiX.js → start-xHz18_Rr.js} +3 -3
  171. package/dist/assets/{starting-progress-CiLZpNpg.js → starting-progress-DeFtXRb_.js} +1 -1
  172. package/dist/assets/status-y-bc7cex.js +1 -0
  173. package/dist/assets/{step-actions-CeJCmiCS.js → step-actions-Btu6D6gk.js} +1 -1
  174. package/dist/assets/{studio-DikseKRr.js → studio-CiFHrC57.js} +1 -1
  175. package/dist/assets/{switch-control-C5i52ixk.js → switch-control-DnNP5DPe.js} +1 -1
  176. package/dist/assets/table-tips-hNIkakER.js +1 -0
  177. package/dist/assets/th-DyW-mYrC.js +5 -0
  178. package/dist/assets/traffic-BIrotm6H.js +35 -0
  179. package/dist/assets/{transfer-CTEHVklh.js → transfer-BeJGTbo1.js} +1 -1
  180. package/dist/assets/{unsubscribe-Bi2IV-2n.js → unsubscribe-Bjxnpv_W.js} +1 -1
  181. package/dist/assets/{use-blocklet-logo-BEy8Tnso.js → use-blocklet-logo-BoFa24A6.js} +1 -1
  182. package/dist/assets/{use-mobile-Boa_xu9A.js → use-mobile-JEGQfLZ2.js} +1 -1
  183. package/dist/assets/{use-mobile-DyX6Fl8Z.js → use-mobile-ZAS6Si4t.js} +1 -1
  184. package/dist/assets/useAsync-DnXpD472.js +1 -0
  185. package/dist/assets/{useLocalStorage-DVnkpneF.js → useLocalStorage-BRd3tKN9.js} +1 -1
  186. package/dist/assets/user-center-DI0NPFtg.js +76 -0
  187. package/dist/assets/{util-MKllNgBs.js → util-C3FgySYN.js} +1 -1
  188. package/dist/assets/{util-CEAObyfj.js → util-CVjZG67N.js} +1 -1
  189. package/dist/assets/{vendor-arcblock-uz9DVywv.js → vendor-arcblock-DPRICUXM.js} +109 -109
  190. package/dist/assets/{vendor-hooks-rDgu5KV9.js → vendor-hooks-Zkb4Ilbj.js} +1 -1
  191. package/dist/assets/{vendor-mui-core-D_bnq77o.js → vendor-mui-core-Bh-qMRq3.js} +1 -1
  192. package/dist/assets/{vendor-mui-x-R-0SFz4c.js → vendor-mui-x-CQTjfcpn.js} +1 -1
  193. package/dist/assets/{vendor-ux-did-connect-DHrruicZ.js → vendor-ux-did-connect-Ck9lzrbN.js} +73 -73
  194. package/dist/assets/vi-bzer6J4H.js +5 -0
  195. package/dist/assets/wrap-locale-COcPskJ7.js +1 -0
  196. package/dist/assets/zh-Cti0XXui.js +8 -0
  197. package/dist/assets/zh-tw-BLcDG99i.js +7 -0
  198. package/dist/images/all-done-dark.svg +68 -0
  199. package/dist/images/all-done-light.svg +60 -0
  200. package/dist/index.html +5 -5
  201. package/dist/service-worker.js +1 -1
  202. package/package.json +48 -47
  203. package/dist/assets/add-resource-CJHw7ea0.js +0 -1
  204. package/dist/assets/addon--u4EErgw.js +0 -14
  205. package/dist/assets/appearance-bRLsRDs2.js +0 -1
  206. package/dist/assets/ar-Blzb8h2o.js +0 -7
  207. package/dist/assets/audit-logs-B3-Fo3nR.js +0 -35
  208. package/dist/assets/button-D8hoY4xw.js +0 -1
  209. package/dist/assets/click-to-copy-CFiGx48J.js +0 -1
  210. package/dist/assets/complete-6R-n_Ra9.js +0 -45
  211. package/dist/assets/config-space-d34Deg7R.js +0 -1
  212. package/dist/assets/confirm-DjTZImyg.js +0 -7
  213. package/dist/assets/connect-K4ZmMu4L.js +0 -5
  214. package/dist/assets/connect-to-BG15Vnyg.js +0 -1
  215. package/dist/assets/dashboard-BIOpvfj3.js +0 -239
  216. package/dist/assets/de-BxI5dM9K.js +0 -7
  217. package/dist/assets/delete-confirm-BzuBR6TW.js +0 -1
  218. package/dist/assets/domain-action-card-Bcs_GWxq.js +0 -24
  219. package/dist/assets/domain-wh85yL2O.js +0 -9
  220. package/dist/assets/domains-bzKFbARj.js +0 -1
  221. package/dist/assets/dot-C4hULxc0.js +0 -7
  222. package/dist/assets/format-error-BrmqJs5a.js +0 -2
  223. package/dist/assets/fr-DezMACmP.js +0 -7
  224. package/dist/assets/get-safe-url-B5RJTMjC.js +0 -1
  225. package/dist/assets/get-safe-url-Bk6PlU7n.js +0 -1
  226. package/dist/assets/hi-ClbEozhq.js +0 -5
  227. package/dist/assets/id-CXYm-1K3.js +0 -7
  228. package/dist/assets/index-8CHxrfFP.js +0 -1
  229. package/dist/assets/index-B9nvthxv.js +0 -4
  230. package/dist/assets/index-C-A13dEh.js +0 -141
  231. package/dist/assets/index-Cc-e6lxg.js +0 -1
  232. package/dist/assets/index-DjEDWgGs.js +0 -6
  233. package/dist/assets/index-Du38Vjy4.js +0 -241
  234. package/dist/assets/index-Dyl-XQ73.js +0 -99
  235. package/dist/assets/index-Jnk92KZC.js +0 -284
  236. package/dist/assets/index-USO5zFMh.js +0 -55
  237. package/dist/assets/index-ioZVVJtg.js +0 -113
  238. package/dist/assets/invite-CALl83Zc.js +0 -1
  239. package/dist/assets/issue-passport-BcStTsbv.js +0 -1
  240. package/dist/assets/item-Bk_1JLeG.js +0 -2
  241. package/dist/assets/ja-B5V7b8Cm.js +0 -7
  242. package/dist/assets/ko-DP9up1nF.js +0 -7
  243. package/dist/assets/list-D96_O-GY.js +0 -2
  244. package/dist/assets/list-header-HqBQs1yn.js +0 -1
  245. package/dist/assets/list-rt6nku1-.js +0 -236
  246. package/dist/assets/localization-BUDtnbyU.js +0 -1
  247. package/dist/assets/logger-BLZgTs_U.js +0 -1
  248. package/dist/assets/login-oauth-callback-DZaPZfnA.js +0 -1
  249. package/dist/assets/overview-CpKMiGEK.js +0 -85
  250. package/dist/assets/preferences-CfmnTXfl.js +0 -1
  251. package/dist/assets/profile-embed-ZtzRYgXv.js +0 -1
  252. package/dist/assets/pt-CG45pWr4.js +0 -5
  253. package/dist/assets/publish-resource-CCa5xfwz.js +0 -1
  254. package/dist/assets/ru-0VhRQc7t.js +0 -5
  255. package/dist/assets/runtime-eXYlg9Cz.js +0 -1
  256. package/dist/assets/sdk-9eXJSWHG.js +0 -1
  257. package/dist/assets/setup-BEsU41BB.js +0 -30
  258. package/dist/assets/status-CUMJd-nJ.js +0 -1
  259. package/dist/assets/th-DwH8cjcw.js +0 -5
  260. package/dist/assets/traffic-B5x_6GvF.js +0 -35
  261. package/dist/assets/useAsync-C8ydfEEr.js +0 -1
  262. package/dist/assets/useAsync-CMWsznMW.js +0 -1
  263. package/dist/assets/user-center-DcXdjtRX.js +0 -76
  264. package/dist/assets/vi-CcmTJggB.js +0 -5
  265. package/dist/assets/wrap-locale-B9TkXFQe.js +0 -1
  266. package/dist/assets/zh-C2MKZFZw.js +0 -8
  267. package/dist/assets/zh-tw-mW-UVEHx.js +0 -7
  268. 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-CSbITcwB.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-DRCFOq4H.js","assets/index-DOq-_YXu.css","assets/index-DVQCgvFb.js","assets/index-AgKpYdvC.css"])))=>i.map(i=>d[i]);
2
+ import{r as g,f as Tt,l as ct,L as ye,g as Un,u as Vn,i as Fn,j as jt}from"./vendor-react-DEoibe3W.js";import{a9 as Se,j as e,v as Me,aa as c,bc as $t,H as s,ad as je,I as de,T as L,s as Hn,c6 as Wo,D as at,ah as ve,at as Jn,bR as Ke,ak as dt,bs as et,bw as tt,y as K,ab as we,P as Bo,G as Mo,w as Pt,a8 as Uo,M as Vo,q as fe,X as Gn,aj as Fo,t as Ho,bU as Xn,N as Xe,z as Jo,O as se,al as Re,as as Go,L as Xo,A as _t,b5 as Yo,bJ as Qo,bx as Yn,e as Zo,ap as Qn,b_ as Zn,af as Kn,U as Ko,W as ot,bE as es,bF as ts,c7 as os,c8 as ns,bn as wt,bo as ss,bq as rs,bu as ls,bv as kt}from"./vendor-mui-core-Bh-qMRq3.js";import{z as ge,C as De,ad as is,a5 as cs,f as vo,ae as Ro,a9 as as}from"./index-DRCFOq4H.js";import{r as Ie,j as Q,a as Z,bt as en,h as ds,B as Ee,b6 as tn,W as on,b3 as nn,an as us,bu as ps,a6 as qt,Z as M,a2 as hs,I as ue,bv as fs,b9 as bs,b as Be,al as ut,b4 as ms,ar as sn}from"./vendor-ux-did-connect-Ck9lzrbN.js";import{M as pt,c as he,j as xs,Q as gs,_ as rn,V as qe,p as js}from"./vendor-arcblock-DPRICUXM.js";import{d as ks}from"./Error-C-RD4e9g.js";import{C as ht}from"./confirm-zdbJI4Oz.js";import{u as Ve}from"./session-B2z_IWIe.js";import{W as Ct}from"./did-address-BI9LYTx-.js";import{E as Ye}from"./empty-spinner-BZw_ShnT.js";import{B as Et}from"./bundle-avatar-BEofqN1I.js";import{S as Ce}from"./shorten-label-Bf7YQUd6.js";import{L as Lt}from"./list-header-DNFbdM3a.js";import{$ as ys,A as pe,J as Nt,E as ln}from"./vendor-utils-rHXShPKm.js";import{d as vs}from"./Download-DdZEsxmZ.js";import{C as cn}from"./click-to-copy-DmYkL7Ui.js";import{Q as Rs}from"./QuestionMarkCircle-DTf-Tya5.js";import{u as ws}from"./vendor-hooks-Zkb4Ilbj.js";import{_ as _e}from"./useSetState-CWq0AVWn.js";import{c as At}from"./index-DVQCgvFb.js";import{E as zt}from"./index-C849wD9b.js";import"./api-BjteVZFg.js";import{d as Cs}from"./ChevronRight-CQY9Ni7X.js";import{T as Ss,a as Ds}from"./vendor-mui-x-CQTjfcpn.js";import{d as nt}from"./DeleteOutline-BEGOj_wq.js";import{D as wo,C as Co,P as So}from"./react-beautiful-dnd.esm-cfY5JZV6.js";import{c as Is,A as an,u as dn,S as Ts,a as $s,b as Ps,e as _s,U as qs,f as yt,g as un,n as Es,h as Ls,i as Do,k as Ns,l as As}from"./item-BCYQnjF7.js";import{d as zs}from"./ArrowDropDown-xgs4N3Rf.js";import{f as xe}from"./index-8eXqqyHQ.js";import{d as pn}from"./Launch-KvZQI_SA.js";import{d as hn}from"./Done-BUJJNjlP.js";import{D as Os}from"./delete-confirm-CUNBU1J1.js";import{g as fn}from"./get-safe-url-OaLLn0UN.js";import{M as Ws}from"./index-DbsXFWms.js";import{r as Bs}from"./index-BdH_4Yfe.js";import"./lottie-web-jYmAQWuC.js";import"./raf-schd.esm-B3j6BePR.js";var Ot={},Ms=Se;Object.defineProperty(Ot,"__esModule",{value:!0});var bn=Ot.default=void 0,Us=Ms(Ie()),Vs=e;bn=Ot.default=(0,Us.default)((0,Vs.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 Wt={},Fs=Se;Object.defineProperty(Wt,"__esModule",{value:!0});var mn=Wt.default=void 0,Hs=Fs(Ie()),Js=e;mn=Wt.default=(0,Hs.default)((0,Js.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 Bt={},Gs=Se;Object.defineProperty(Bt,"__esModule",{value:!0});var xn=Bt.default=void 0,Xs=Gs(Ie()),Ys=e;xn=Bt.default=(0,Xs.default)((0,Ys.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 Mt({did:t,projectId:o,title:n,logo:l,describe:i}){const r=`${`${Q.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${t}/${o}/logo/upload`}/${l}`,[u,p]=g.useState(!1),d=Me(b=>b.breakpoints.down("md"));return e.jsxs(c,{sx:{display:"flex",flexDirection:"row",color:u?"primary.main":"grey.900",gap:1},onPointerEnter:()=>p(!0),onPointerLeave:()=>p(!1),children:[e.jsx($t,{sx:{borderRadius:1},src:r}),e.jsxs(c,{children:[e.jsx(Ce,{hiddenTip:!0,maxLength:"24",sx:{fontSize:"14px",fontWeight:"500",color:d?"primary.main":""},children:n||"/"}),e.jsx(Ce,{hiddenTip:!0,maxLength:"58",sx:{fontSize:"12px",color:d||u?"primary.main":"grey.700"},children:i||"/"})]})]})}Mt.propTypes={projectId:s.string.isRequired,did:s.string.isRequired,title:s.string.isRequired,logo:s.string.isRequired,describe:s.string.isRequired};function Ut({initUrl:t}){const o=Tt(),n=(t==null?void 0:t.searchParams.get("tenantScope"))||"",{t:l,locale:i}=Z(),{api:a}=ge(),{api:r}=Ve(),[u,p]=g.useState(!0),{blocklet:d}=De(),[b,j]=g.useState(null),[x,h]=g.useState(!1),f=Me(T=>T.breakpoints.down("xl")),v=Me(T=>T.breakpoints.down("md")),{componentDid:R=""}=ct(),[m,y]=g.useState(null),D=`publish-${d.meta.did}`,C=en(D),[P,I]=g.useState({searchText:C.searchText||"",pageSize:C.rowsPerPage||10,page:1}),E=()=>{a.getProjects({input:{did:d.meta.did,componentDid:R,tenantScope:n}}).then(T=>{const $=(T==null?void 0:T.projects)||[];p(!1),y($)}).catch(T=>{p(!1),M.error(T.message)})},z=()=>{o(`${Q.UNOWNED_DID}/create/none`,{replace:!0})},N=T=>{j(T)},Y=()=>{p(!1),h(!0)},U=()=>{h(!1),j(null)},w=T=>{M.error(T.message),h(!1),j(null)},k=T=>{if(!(T!=null&&T.deleted)){M.error("Delete project failed");return}E(),h(!1),j(null)};g.useEffect(()=>{E()},[]);const S=g.useMemo(()=>{var $;if(!P.searchText)return m;let T=($=P.searchText)==null?void 0:$.trim();return T?(T=ds.toAddress(T).toLocaleLowerCase(),m.filter(V=>V.blockletTitle.toLowerCase().includes(T)||V.blockletDid.toLowerCase().includes(T))):m},[m,P.searchText]);if(!m&&u)return e.jsx(c,{sx:{display:"flex",justifyContent:"center",alignItems:"center",marginTop:"40px"},children:e.jsx(Ye,{})});if(!m)return null;if(!m.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:l("blocklet.publish.blockletEmptyTip")}),e.jsx(c,{sx:{fontSize:14,color:"text.secondary",mb:3},children:l("blocklet.publish.createBlockletTip")}),e.jsx(Ee,{onClick:z,variant:"contained",children:l("blocklet.publish.createBlocklet")})]});const W=[{label:"Blocklet",name:"blockletTitle",minWidth:160,options:{customBodyRenderLite:T=>{const $=m[T];return e.jsx(ye,{to:`${$.id}`,children:e.jsx(Mt,{did:d.meta.did,projectId:$.id,logo:$.blockletLogo,title:$.blockletTitle,describe:$.blockletDescription})})}}},{label:"Version",name:"blockletVersion",options:{searchable:!1,customBodyRender:T=>T?e.jsx(tn,{type:"success",children:T}):""}},{label:"DID",name:"blockletDid",options:{customBodyRender:T=>T?e.jsx(Ct,{size:14,compact:!0,responsive:!1,did:T}):null}},f||R?null:{label:l("common.createdBy"),name:"createdBy",options:{customBodyRender:T=>T?e.jsx(Ct,{onClick:()=>{o(`/.well-known/service/admin/members?did=${T}`)},style:{cursor:"pointer"},size:14,compact:!0,copyable:!1,showQrcode:!1,responsive:!1,did:T}):null}},f||R?null:{label:l("common.scope"),name:"componentDid",options:{customBodyRender:T=>{const $=(d.children||[]).find(V=>V.meta.did===T);return $?e.jsxs(c,{display:"flex",alignItems:"center",justifyContent:"flex-start",children:[e.jsx(Et,{size:14,blocklet:$,ancestors:[d]}),e.jsx(c,{ml:.5,sx:{ml:.5,color:"text.primary",fontSize:14},children:$.meta.title})]},T):""}}},f||n?null:{label:l("blocklet.publish.tenantScope"),name:"tenantScope",options:{customBodyRender:T=>e.jsx(c,{ml:.5,sx:{ml:.5,color:"text.primary",fontSize:14},children:e.jsx(Ce,{children:T})})}},{label:l("common.updatedAt"),name:"updatedAt",options:{searchable:!1,customBodyRender:T=>e.jsx(on,{value:Number(T),locale:i})}},{label:l("common.actions"),name:"actions",options:{searchable:!1,customBodyRenderLite:T=>{const $=m[T];return e.jsxs(c,{display:"flex",children:[e.jsx(ye,{to:`${$.id}/new-release/${$.lastReleaseId}`,children:e.jsx(je,{title:l("blocklet.publish.createRelease"),placement:"top",children:e.jsx(de,{color:"primary","aria-label":"create",children:e.jsx(bn,{style:{fontSize:18}})})})}),!!$.lastReleaseId&&e.jsx(je,{title:l("blocklet.publish.viewLastRelease",{name:$.blockletTitle}),placement:"top",children:e.jsx(de,{color:"secondary","aria-label":"create",children:e.jsx(ye,{style:{display:"flex"},to:`${$.id}/view/${$.lastReleaseId}`,children:e.jsx(mn,{sx:{fontSize:18}})})})}),e.jsx(je,{title:l("blocklet.publish.delete",{name:$.blockletTitle}),placement:"top",children:e.jsx(de,{color:"primary","aria-label":"delete",onClick:()=>N($),children:e.jsx(nn,{sx:{fontSize:18}})})})]})}}}].filter(Boolean),B=({page:T,rowsPerPage:$,searchText:V})=>{P.pageSize!==$?I(F=>({...F,searchText:"",pageSize:$,page:1})):P.page!==T+1?I(F=>({...F,searchText:"",page:T+1})):P.searchText!==V&&I(F=>({...F,searchText:V,page:1}))},G=x?e.jsx(us,{open:!0,popup:!0,onClose:U,action:"check-has-project-id",locale:i,checkFn:r.get,saveConnect:!1,forceConnected:!1,checkTimeout:5*60*1e3,onSuccess:k,onError:w,extraParams:{projectId:b.id,did:d.meta.did,name:b.blockletTitle},messages:{title:l("blocklet.publish.deleteProject.title",{name:b.blockletTitle}),scan:l("blocklet.publish.deleteProject.scan",{name:b.blockletTitle}),confirm:l("blocklet.publish.deleteProject.confirm"),success:l("blocklet.publish.deleteProject.success")}}):null;return e.jsxs(Qs,{children:[e.jsx(Lt,{sx:{mb:2},left:e.jsxs(c,{display:"flex",flexDirection:"row",alignItems:"center",children:[e.jsx(c,{sx:{fontSize:"1.2rem",fontWeight:"bold"},children:l("common.blockletStudio")}),e.jsx(je,{title:l("blocklet.publish.createBlockletTip"),arrow:!0,placement:"right",children:e.jsx(xn,{sx:{opacity:.6,fontSize:"1.1em",ml:1}})})]}),actions:e.jsxs(e.Fragment,{children:[e.jsx(ps,{options:{searchPlaceholder:l("blocklet.list.searchPlaceholder"),searchDebounceTime:600,searchAlwaysOpen:v},search:P.searchText,searchText:P.searchText,searchTextUpdate:T=>I($=>({...$,searchText:T})),searchClose:()=>I(T=>({...T,searchText:""})),onSearchOpen:()=>{}}),e.jsxs(Ee,{onClick:z,variant:"contained",children:[e.jsx(pt,{style:{fontSize:"1.3em",marginRight:4}}),l("blocklet.publish.createBlocklet")]})]})}),e.jsx(qt,{className:"main-table",locale:i,data:S,columns:W,options:{search:!1,sort:!1,download:!1,filter:!1,print:!1,viewColumns:!1,searchAlwaysOpen:!0,rowsPerPageOptions:[10,20,50,100]},durable:D,onChange:B}),b&&e.jsx(ht,{title:`${l("common.delete")} ${b.blockletTitle}`,description:l("blocklet.publish.deleteProject.description"),confirm:l("common.confirm"),onConfirm:Y,onCancel:()=>j(null),children:e.jsx(c,{sx:{marginTop:2},children:[l("blocklet.publish.deleteProject.tip1"),l("blocklet.publish.deleteProject.tip2"),l("blocklet.publish.deleteProject.tip3")].map(T=>e.jsxs(c,{sx:{display:"flex",marginTop:1,flexDirection:"row",alignItems:"flex-start"},children:[e.jsx(ks,{color:"warning",sx:{marginRight:1,fontSize:20,marginTop:"2px"}}),e.jsx(L,{component:"span",variant:"inherit",color:"text.secondary",children:T})]}))})}),G]})}const Qs=Hn(c)`
3
+ ${({theme:t})=>t.breakpoints.down("md")} {
4
+ .MuiTableRow-root {
5
+ border-color: ${({theme:t})=>t.palette.divider};
6
+ }
7
+ }
8
+ `;Ut.propTypes={initUrl:s.object};Ut.defaultProps={initUrl:null};var Vt={},Zs=Se;Object.defineProperty(Vt,"__esModule",{value:!0});var gn=Vt.default=void 0,Ks=Zs(Ie()),Io=e;gn=Vt.default=(0,Ks.default)([(0,Io.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,Io.jsx)("path",{d:"m17 14 5-5-1.41-1.41L18 10.17V3h-2v7.17l-2.59-2.58L12 9z"},"1")],"InstallDesktop");const er=(t,o)=>{if(!t)return"";try{return o?JSON.parse(t)[o]:JSON.parse(t)}catch{}return t},jn=er;function tr(){var w;const{t,locale:o}=Z(),{projectId:n}=ct(),{api:l}=ge(),[i,a]=g.useState(!0),{blocklet:r}=De(),u=Me(k=>k.breakpoints.down("md")),[p,d]=g.useState(null),[b,j]=g.useState(null),[x,h]=g.useState(null),f=(w=window.env)==null?void 0:w.serverEndpoint,v=`releases-${r.meta.did}-${n}`,R=en(v),[m,y]=g.useState({searchText:R.searchText||"",pageSize:R.rowsPerPage||10,page:1}),D=()=>{l.getReleases({input:{did:r.meta.did,projectId:n}}).then(k=>{const S=(k==null?void 0:k.releases)||[];a(!1),d(S)}).catch(k=>{a(!1),M.error(k.message)})},C=()=>{l.doBatchQuery({getProject:{input:{did:r.meta.did,projectId:n}},getReleases:{input:{did:r.meta.did,projectId:n}}}).then(k=>{j(k.getProject.project||{}),d(k.getReleases.releases||[]),a(!1)}).catch(k=>{a(!1),M.error(k.message)})};g.useEffect(()=>{C()},[]);const[P,I]=g.useState(""),E=()=>{a(!1);const k=x.id;l.deleteRelease({input:{did:r.meta.did,projectId:n,releaseId:k}}).then(()=>{a(!1),D(),M.success(t("common.removeSuccess")),h(null)}).catch(S=>{a(!1),M.error(S.message)})},z=k=>{h(k)};if(!p&&i)return e.jsx(c,{sx:{display:"flex",justifyContent:"center",alignItems:"center",marginTop:"40px"},children:e.jsx(Ye,{})});if(!p)return null;const N=e.jsxs(Wo,{className:"breadcrumbs","aria-label":"breadcrumb",children:[e.jsx(ye,{to:"..",children:t("common.blockletStudio")}),e.jsx(L,{color:"text.primary",children:e.jsx(Ce,{maxLength:u?6:30,children:b.blockletTitle})})]});if(!p.length)return e.jsxs(e.Fragment,{children:[N,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(ye,{to:"create/none",children:e.jsx(Ee,{variant:"contained",children:t("blocklet.publish.createRelease")})})]})]});const Y=[{label:t("common.version"),name:"blockletVersion",minWidth:160,options:{customBodyRenderLite:k=>{const S=p[k];return e.jsx(ye,{to:`view/${S.id}`,children:e.jsx(Mt,{did:r.meta.did,projectId:b.id,logo:S.blockletLogo,title:S.blockletVersion,describe:S.blockletTitle})})}}},{label:t("blocklet.publish.releaseNote"),name:"note",options:{customBodyRenderLite:k=>{const S=p[k];return e.jsx(L,{className:"note",children:jn(S.note,"note")})}}},{label:t("common.status"),name:"status",options:{customBodyRender:k=>e.jsx(tn,{type:k==="published"?"success":"warning",children:k==="published"?"Released":ys(k)})}},{label:t("common.lastPublishedAt"),name:"updatedAt",options:{customBodyRenderLite:k=>{const S=p[k];return S.status!==he.PROJECT.RELEASE_STATUS.published?"":e.jsx(on,{value:Number(S.updatedAt),locale:o})}}},{label:t("common.actions"),name:"actions",options:{customBodyRenderLite:k=>{var $;const S=p[k];let W="",B="";const G=S.status==="published";if(G){const V=pe(f,`/api/project/${r.meta.did}/${b.id}/${b.lastReleaseId}/release/blocklet.json`),F=new URL(f);F.pathname=pe(F.pathname,"/launch-blocklet/agreement"),F.searchParams.set("blocklet_meta_url",V),W=F.href,B=pe(`${Q.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${r.meta.did}/${b.id}/${b.lastReleaseId}/download/${(b.lastReleaseFiles||[])[0]}`)}const T=($=b.blockletComponents)!=null&&$.some(V=>V.included)||S.uploadedResource?"pack":"resource";return e.jsxs(c,{display:"flex",alignItems:"center",children:[G&&T==="pack"&&e.jsx(je,{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:W,target:"_blank",rel:"noreferrer",children:e.jsx(gn,{sx:{fontSize:18}})})})}),G&&e.jsx(je,{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:B,children:e.jsx(vs,{sx:{fontSize:18}})})})}),e.jsx(je,{title:t("blocklet.publish.delete",{name:b.blockletTitle}),placement:"top",children:e.jsx(de,{color:"primary","aria-label":"delete",onClick:()=>z(S),children:e.jsx(nn,{sx:{fontSize:18}})})})]})}}}],U=({page:k,rowsPerPage:S,searchText:W})=>{m.pageSize!==S?y(B=>({...B,searchText:"",pageSize:S,page:1})):m.page!==k+1?y(B=>({...B,searchText:"",page:k+1})):m.searchText!==W&&y(B=>({...B,searchText:W,page:1}))};return e.jsxs(or,{children:[e.jsx(Lt,{sx:{mb:2},left:N,actions:e.jsxs(e.Fragment,{children:[e.jsx(Ee,{variant:"outlined",onClick:()=>{const k=pe(f,`/api/project/${r.meta.did}/${n}/blocklet.json`);I(k)},children:t("blocklet.publish.copyInstallUrl")}),e.jsx(ye,{to:"new-release/none",children:e.jsxs(Ee,{variant:"contained",children:[e.jsx(pt,{style:{fontSize:"1.3em",marginRight:4}}),t("blocklet.publish.createRelease")]})})]})}),e.jsx(at,{fullWidth:!0,maxWidth:"sm",open:P,onClose:()=>I(""),children:e.jsxs(c,{sx:{py:5,px:4,wordBreak:"break-all"},children:[e.jsx(L,{variant:"h6",sx:{mb:2},children:t("blocklet.publish.installResourceTip")}),e.jsx(cn,{children:P}),e.jsxs(L,{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(qt,{className:"main-table",verticalKeyWidth:100,locale:o,data:p,columns:Y,durable:v,options:{sort:!1,download:!1,filter:!1,print:!1,search:!1},onChange:U}),x&&e.jsx(ht,{title:t(`${t("common.delete")} ${x.blockletVersion}`),description:t("blocklet.publish.deleteReleaseTip"),confirm:t("common.confirm"),onConfirm:E,onCancel:()=>h(null)})]})}const or=ve(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 Ft={},nr=Se;Object.defineProperty(Ft,"__esModule",{value:!0});var kn=Ft.default=void 0,sr=nr(Ie()),rr=e;kn=Ft.default=(0,sr.default)((0,rr.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(Jn,{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:kn};function Ht({value:t,app:o,onChange:n,onChangeBlockletResourceType:l,disabled:i,resourceRelateComponents:a,projectType:r,dependentComponentsMode:u,blockletResourceType:p}){const{t:d,locale:b}=Z(),j=u==="readonly",x=g.useMemo(()=>{const D=t.reduce((C,P)=>(C[P.did]=P.included,C),{});return(o.children||[]).filter(C=>j?a[C.meta.did]||D[C.meta.did]:!0)},[o.children,t,a,j]),h=g.useMemo(()=>x.map(D=>t.find(P=>P.did===D.meta.did)||{did:D.meta.did}),[x,t]),f=h.reduce((D,C)=>(D[C.did]=Nt(C,["required","included"]),D),{}),v=D=>{const C=h.map(P=>{if(P.did===D){const I=!P.included;return{...P,included:I,required:I}}return P});n(C)},R=D=>{const C=h.map(P=>P.did===D?{...P,required:!P.required}:P);n(C)},m=D=>{l(D.target.checked?"resource":"")},y=[{label:d("common.name"),name:"meta.title",width:200,options:{customBodyRenderLite:D=>{var I;const C=x[D],P=(I=f[C.meta.did])==null?void 0:I.included;return e.jsxs(c,{display:"flex",alignItems:"center",children:[e.jsx(Et,{size:24,blocklet:C,ancestors:[o]}),e.jsx(c,{ml:"4px",className:At("text",{excluded:!P}),children:e.jsx(c,{children:C.meta.title})})]})}}},{label:d("blocklet.publish.componentIncluded"),width:100,options:{customBodyRenderLite:D=>{var E;const C=x[D],P=a[C.meta.did],I=!!((E=f[C.meta.did])!=null&&E.included);return e.jsx(Ke,{size:"small",checked:P||I,onClick:()=>v(C.meta.did),disabled:j||P||i})}}},{label:d("blocklet.publish.componentForceRequired"),width:100,options:{customBodyRenderLite:D=>{var z,N;const C=x[D],P=a[C.meta.did],I=!!((z=f[C.meta.did])!=null&&z.included),E=!!((N=f[C.meta.did])!=null&&N.required);return e.jsx(Ke,{size:"small",checked:P||E&&I,onClick:()=>R(C.meta.did),disabled:j||P||i||!I})}}}];return e.jsx(lr,{children:x!=null&&x.length?e.jsxs(e.Fragment,{children:[e.jsxs(dt,{severity:"info",style:{width:"100%"},children:[e.jsx(c,{display:"flex",alignItems:"center",rel:"noreferrer",ml:"13px",children:d(r==="pack"?"blocklet.publish.packTip":"blocklet.publish.resourceTip")}),e.jsxs(c,{component:"label",style:{cursor:"pointer"},children:[e.jsx(Ke,{size:"small",style:{marginLeft:"0px"},disabled:i,checked:p==="resource",onChange:m}),d("blocklet.publish.forceResourceBlocklet")]})]}),e.jsx(qt,{className:"main-table",verticalKeyWidth:100,locale:b,data:x,columns:y,options:{sort:!1,download:!1,filter:!1,print:!1,search:!1,rowsPerPage:50}})]}):e.jsx(Ue,{Icon:zt,children:d("blocklet.publish.blockletEmptyTip")})})}Ht.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};Ht.defaultProps={value:[],onChange:()=>{},onChangeBlockletResourceType:()=>{},disabled:!1,dependentComponentsMode:"auto",blockletResourceType:"",resourceRelateComponents:{}};const lr=ve(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 ir=(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 l=n.includeEmptyLines?/^/gm:/^(?!\s*$)/gm;return t.replace(l,n.indent.repeat(o))};const To=is,$o=/\s+at.*(?:\(|\s)(.*)\)?/,cr=/^(?:(?:(?:node|(?:internal\/[\w/]*|.*node_modules\/(?:babel-polyfill|pirates)\/.*)?\w+)\.js:\d+:\d+)|native)/,ar=typeof To.homedir>"u"?"":To.homedir();var dr=(t,o)=>(o=Object.assign({pretty:!1},o),t.replace(/\\/g,"/").split(`
51
+ `).filter(n=>{const l=n.match($o);if(l===null||!l[1])return!0;const i=l[1];return i.includes(".app/Contents/Resources/electron.asar")||i.includes(".app/Contents/Resources/default_app.asar")?!1:!cr.test(i)}).filter(n=>n.trim()!=="").map(n=>o.pretty?n.replace($o,(l,i)=>l.replace(i,i.replace(ar,"~"))):n).join(`
52
+ `));const ur=ir,pr=dr,hr=t=>t.replace(/\s+at .*aggregate-error\/index.js:\d+:\d+\)?/g,"");let fr=class extends Error{constructor(o){if(!Array.isArray(o))throw new TypeError(`Expected input to be an Array, got ${typeof o}`);o=[...o].map(l=>l instanceof Error?l:l!==null&&typeof l=="object"?Object.assign(new Error(l.message),l):new Error(l));let n=o.map(l=>typeof l.stack=="string"?hr(pr(l.stack)):String(l)).join(`
53
+ `);n=`
54
+ `+ur(n,4),super(n),this.name="AggregateError",Object.defineProperty(this,"_errors",{value:o})}*[Symbol.iterator](){for(const o of this._errors)yield o}};var br=fr;const mr=br;var xr=async(t,o,{concurrency:n=1/0,stopOnError:l=!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 r=[],u=[],p=t[Symbol.iterator]();let d=!1,b=!1,j=0,x=0;const h=()=>{if(d)return;const f=p.next(),v=x;if(x++,f.done){b=!0,j===0&&(!l&&u.length!==0?a(new mr(u)):i(r));return}j++,(async()=>{try{const R=await f.value;r[v]=await o(R,v),j--,h()}catch(R){l?(d=!0,a(R)):(u.push(R),j--,h())}})()};for(let f=0;f<n&&(h(),!b);f++);});const gr=xr;var jr=(t,o)=>gr(t,n=>n(),o);const st=Un(jr);function kr(t,o){const n=new Set(o||[]),l=[];function i(a){n.has(a==null?void 0:a.id)&&l.push(a==null?void 0:a.id),a!=null&&a.children&&a.children.forEach(i)}return(t||[]).forEach(i),l}function Jt({src:t,alt:o,...n}){const[l,i]=g.useState(!1),a=g.useRef(null);return g.useEffect(()=>{if(!("IntersectionObserver"in window))return i(!0),()=>{};const r=new IntersectionObserver(u=>{u.forEach(p=>{p.isIntersecting&&(i(!0),r.disconnect())})},{threshold:.1});return a.current&&r.observe(a.current),()=>{r.disconnect()}},[]),e.jsx("img",{ref:a,src:l?t:void 0,alt:o,...n})}Jt.propTypes={src:s.string.isRequired,alt:s.string};Jt.defaultProps={alt:""};function Gt({data:t,lazy:o,...n}){return!t||!t.length?null:e.jsx(yr,{...n,children:t.map(l=>e.jsx("a",{href:l.url,target:"_blank",rel:"noreferrer",children:o?e.jsx(Jt,{src:l.url,alt:l.alt||""}):e.jsx("img",{src:l.url,alt:l.alt||""})},l.url))})}Gt.propTypes={data:s.arrayOf(s.shape({url:s.string,alt:s.string})),lazy:s.bool};Gt.defaultProps={data:[],lazy:!1};const yr=ve(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
+ `,vt=(t,o)=>{const n=[...t];for(;n.length>0;){const l=n.shift();if(l.id===o)return l;l.children&&n.push(...l.children)}return[]};function Xt({icon:t}){return t?hs(t)?e.jsx("img",{className:"resource-icon",src:t,alt:"icon"}):e.jsx(ue,{className:"resource-icon",icon:t}):null}Xt.propTypes={icon:s.string};Xt.defaultProps={icon:""};function Yt({disabled:t,data:o,onChange:n,value:l}){const i=l;function a(h,f=[]){return f.push(h.id),h.children&&h.children.forEach(v=>a(v,f)),f}const r=h=>a(vt(o,h)),u=(h,f=[])=>{const v=vt(o,h);return v.parent?(f.push(v.parent),u(v.parent,f)):f};function p(h,f){const v=r(h.id),R=v.indexOf(h.id);return v.splice(R,1),v.every(m=>i.concat(f).includes(m))}const d=(h,f)=>{h.stopPropagation();const v=r(f),R=u(f);if(i.includes(f)){const m=i.filter(y=>!v.concat(R).includes(y));n(m)}else{const m=v;for(let y=0;y<R.length;++y)p(vt(o,R[y]),m)&&m.push(R[y]);n([...i].concat(m))}},b=h=>{h.stopPropagation()},j=o.some(h=>{var f;return((f=h.children)==null?void 0:f.length)>0}),x=h=>{var y;const f=i.indexOf(h.id)!==-1,v=Array.isArray(h.children),R=r(h.id),m=v&&!f&&i.some(D=>R.includes(D));return e.jsx(Ss,{nodeId:h.id,label:e.jsx(et,{onClick:b,control:e.jsx(Ke,{size:"small",checked:f,indeterminate:m,tabIndex:-1,disableRipple:!0,onClick:D=>d(D,h.id),disabled:h.disabled||t}),label:e.jsxs(c,{className:"content",children:[e.jsxs(c,{display:"flex",alignItems:"center",children:[h.icon&&e.jsx(Xt,{icon:h.icon}),e.jsx(c,{className:"name",children:h.name}),h.url&&e.jsx("a",{href:h.url,target:"_blank",rel:"noreferrer",className:"link",children:e.jsx(gs,{className:"link-icon"})})]}),!!h.description&&e.jsx(c,{className:"description",children:h.description}),!!((y=h.images)!=null&&y.length)&&e.jsx(Gt,{className:"images",data:h.images,lazy:!0})]})}),children:v?h.children.map(x):null},h.id)};return e.jsx(vr,{className:At(!j&&"no-children"),multiSelect:!0,defaultCollapseIcon:e.jsx(xs,{}),defaultExpandIcon:e.jsx(Cs,{}),selected:i,children:o.map(h=>x(h))})}Yt.propTypes={data:s.array,value:s.array,onChange:s.func,disabled:s.bool};Yt.defaultProps={data:[],value:[],onChange:()=>{},disabled:!1};const vr=ve(Ds)`
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
+ `,Po={},Rr=(t,o,{key:n,cacheTime:l=1e3*3}={})=>{const i=n+JSON.stringify({params:o}),a=Po[i];if(a&&a.timestamp>Date.now()-l)return a.promise;const r=t(...o);return Po[i]={promise:r,timestamp:Date.now()},r},yn=Rr,vn=(t,o)=>(t.forEach(n=>{o&&(n.parent=o),(n.children||[]).forEach(l=>{l.parent=n.id,vn(l.children||[],l.id)})}),t),Rn=(t,o,n,l,i)=>{const{exportApi:a="/"}=(t==null?void 0:t.meta.resource)||{},r=new URL(pe("http://127.0.0.1",t==null?void 0:t.mountPoint,a||"/").replace(/\/+/g,"/"));return r.searchParams.set("projectId",o),r.searchParams.set("releaseId",n),r.searchParams.set("local",l),i&&r.searchParams.set("resourcesParams",i.searchParams.get("resourcesParams")),`${r.pathname}${r.search}`},wr=async({api:t,appDid:o,component:n,projectId:l,releaseId:i,locale:a,initUrl:r,resources:u})=>{let p;if(r&&r.searchParams.get("resourcesParams"))try{p=JSON.parse(r.searchParams.get("resourcesParams"))}catch(d){M.error(d.message);return}await ln.post(Rn(n,l,i,a,r),{resources:u,projectId:l,releaseId:i,locale:a,...p?{resourcesParams:p}:{}},{headers:{"x-csrf-token":fs()},timeout:10*60*1e3}),await t.updateSelectedResources({input:{did:o,projectId:l,releaseId:i,componentDid:n.meta.did,resources:u}})},Cr=(t,o)=>{if(!t)return{};const n=o.reduce((i,a)=>(i[a]=!0,i),{}),l=(i,a)=>(i.forEach(r=>{var u;n[r.id]&&((u=r.dependentComponents)!=null&&u.length)&&r.dependentComponents.forEach(p=>{a[p]=!0}),r.children&&l(r.children,a)}),a);return l(t,{})};function Qt({app:t,component:o,projectId:n,release:l,loading:i,error:a,saveSelectedEventsRef:r,readOnly:u,componentDid:p,initialResources:d={},setResourceComponentsMap:b,selectedResourceIds:j,setSelectedResourceIds:x,showTree:h,initUrl:f}){var U;const{t:v,locale:R}=Z(),{api:m}=ge(),[y,D]=_e({}),C=g.useRef({}),P=g.useRef(!1),I=l.id;C.current.projectId=n,C.current.releaseId=I;const E=(w,k,S)=>{if(!k)return;const W=Cr(k,S);b==null||b({[w]:Object.keys(W)})},z=w=>{r.current[o.meta.did]={resources:w,component:o},x({[o.meta.did]:w}),E(o.meta.did,y[o.meta.did],w)},N=g.useCallback(async w=>{var k;try{const S=await yn(ln.get,[Rn(w,n,I,R,f),{timeout:6e4}],{key:"getResources"});return vn(((k=S==null?void 0:S.data)==null?void 0:k.resources)||[])}catch{return[]}},[n,I,R,f]);g.useEffect(()=>{y[o==null?void 0:o.meta.did]||N(o).then(w=>{D({[o==null?void 0:o.meta.did]:w})}).catch(w=>{M.error(w.message)})},[o,D,y,N]),g.useEffect(()=>{I&&n&&!P.current&&st(t.children.map(w=>async()=>{var k,S;if(!(p&&p!==w.meta.did)&&!(!(w!=null&&w.mountPoint)||!cs.hasStartEngine(w==null?void 0:w.meta)||!((S=(k=w==null?void 0:w.meta)==null?void 0:k.resource)!=null&&S.exportApi)))try{const W=await N(w);D({[w==null?void 0:w.meta.did]:W});const B=await m.getSelectedResources({input:{did:t.meta.did,projectId:n,releaseId:I,componentDid:w.meta.did}}),G=(B==null?void 0:B.resources)||[];G!=null&&G.length&&(x({[w.meta.did]:kr(W,G)}),E(w.meta.did,W,G),u||(r.current[w==null?void 0:w.meta.did]={resources:G,component:w}))}catch(W){M.error(W.message)}}),{concurrency:2}).then(()=>{P.current=!0})},[I,n,u,R,f,D]),g.useEffect(()=>{d&&Object.keys(d).length&&st(t.children.map(async w=>{const k=d[w.meta.did];if(k!=null&&k.length){const S=await N(w);x({[w.meta.did]:k}),E(w.meta.did,S,k),u||(r.current[w==null?void 0:w.meta.did]={resources:k,component:w})}}))},[t,d,u]);let Y=null;return(!o||!((U=y[o.meta.did])!=null&&U.length))&&(Y=e.jsx(Ue,{Icon:zt,children:v("blocklet.publish.resourceEmptyTip",{name:vo.getDisplayName(o)})})),(o==null?void 0:o.status)!=="running"&&(Y=e.jsx(Ue,{children:v("blocklet.publish.componentNotRunning",{name:vo.getDisplayName(o)})})),e.jsxs(e.Fragment,{children:[e.jsx(Sr,{className:At(a&&"error"),children:h&&e.jsx(c,{pb:2,width:"100%",children:Y||e.jsx(Yt,{data:y[o.meta.did]||[],value:j[o.meta.did]||[],onChange:z,disabled:i||u})})}),!!a&&e.jsx(c,{color:"error.main",mt:1,fontSize:14,children:a})]})}Qt.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.array.isRequired,setSelectedResourceIds:s.func.isRequired,showTree:s.bool.isRequired};Qt.defaultProps={error:"",release:{id:""},initUrl:null,initialResources:{},setResourceComponentsMap:()=>{},componentDid:""};const Sr=ve(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 Zt={},Dr=Se;Object.defineProperty(Zt,"__esModule",{value:!0});var St=Zt.default=void 0,Ir=Dr(Ie()),Tr=e;St=Zt.default=(0,Ir.default)((0,Tr.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 _o="lastWantToConnectStoreId";function $r(t){var u,p;const[o,n]=g.useState(null),{session:l}=Ve(),i=g.useCallback(d=>{n(d),localStorage.setItem(_o,d==null?void 0:d.id)},[n]),a=g.useMemo(()=>{var x,h,f,v;const d=localStorage.getItem(_o),b=d?(((x=t==null?void 0:t.settings)==null?void 0:x.storeList)||[]).find(R=>R.id===d):null;if(b)return b;let j=(((h=t==null?void 0:t.settings)==null?void 0:h.storeList)||[]).find(R=>{var m;return!(R.id!==Q.BLOCKLET_STORE.id||R.scope&&R.scope!=="studio"&&R.scope!==((m=l==null?void 0:l.user)==null?void 0:m.did))});return j||(j=(v=(f=t==null?void 0:t.settings)==null?void 0:f.storeList)==null?void 0:v[0]),j},[(u=t==null?void 0:t.settings)==null?void 0:u.storeList,(p=l==null?void 0:l.user)==null?void 0:p.did]);return[o||a||{},i]}const Rt={};async function Kt(t,{interval:o=1e3,maxDuration:n=120*1e3,intervalFirst:l=4e3,timerKey:i=""}){Rt[i]&&clearTimeout(Rt[i]),await new Promise(u=>setTimeout(u,l));const a=Date.now(),r=async(u,p)=>{try{const d=await t();u(d)}catch(d){Date.now()-a>n?p(d):i?Rt[i]=setTimeout(()=>r(u,p),o):setTimeout(()=>r(u,p),o)}};return new Promise(r)}function Pr(){return Math.random().toString(36).slice(2)+Math.random().toString(36).slice(2)+`${Date.now()}`.slice(-6)}function _r(t,{did:o,projectId:n,messageId:l}){return Kt(async()=>{var a;const i=await t.getProject({input:{did:o,projectId:n,messageId:l}});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 qr(t,{did:o,projectId:n,storeId:l}){return Kt(async()=>{var r,u;const i=await t.getProject({input:{did:o,projectId:n,messageId:""}});if(!((u=(r=i==null?void 0:i.project)==null?void 0:r.connectedStores)!=null&&u.length))throw new Error("Connected store not found");if(!i.project.connectedStores.find(p=>p.storeId===l))throw new Error("Connected store not found")},{timerKey:`connect-store-${l}`})}function Er(t,{did:o,projectId:n,endpointId:l}){return Kt(async()=>{var r,u;const i=await t.getProject({input:{did:o,projectId:n,messageId:""}});if(!((u=(r=i==null?void 0:i.project)==null?void 0:r.connectedEndpoints)!=null&&u.length))throw new Error("Connected endpoint not found");if(!i.project.connectedEndpoints.find(p=>p.endpointId===l))throw new Error("Connected endpoint not found")},{timerKey:`connect-store-${l}`})}const Lr=({fromBlocklet:t,nodeInfo:o,blocklet:n,userDid:l})=>{var r,u;const i=t?(r=n==null?void 0:n.meta)==null?void 0:r.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(p=>p.protected||!p.scope||p.scope==="studio"||p.scope===l),{teamDid:i,storeList:a}},eo=Lr;function to({blocklet:t,store:o={},onChangeStore:n,onClick:l,disabled:i,loading:a,componentDid:r}){var w,k,S;const{t:u}=Z(),{session:p}=Ve(),{api:d,info:b,inService:j}=ge(),x=De(),[h,f]=g.useState(!1),v=g.useRef(null),[R,m]=g.useState(!1),[y,D]=g.useState(null),C=W=>{n(W),f(!1)},P=()=>{f(!h)},I=W=>{v.current&&v.current.contains(W.target)||f(!1)},E=()=>{m(!0)},z=()=>{m(!1)},N=async()=>{var W;if(y)try{await d.deleteBlockletStore({input:{teamDid:t.meta.did,url:y.url,projectId:"",scope:y.scope||"studio"}}),await((W=x==null?void 0:x.actions)==null?void 0:W.refreshBlocklet())}catch(B){M.error(`Remove Blocklet Store Error: ${xe(B)}`)}finally{D(null)}},{storeList:Y}=eo({fromBlocklet:j,blocklet:t,nodeInfo:b,componentDid:r,userDid:(w=p==null?void 0:p.user)==null?void 0:w.did}),U=(k=t==null?void 0:t.meta)==null?void 0:k.did;return e.jsxs(e.Fragment,{children:[e.jsxs(tt,{disabled:i,ref:v,variant:"contained",color:"primary","aria-label":"Button group with connect store",children:[e.jsxs(K,{onClick:l,children:[a&&e.jsx(we,{size:14,sx:{mr:.5}}),`${u("common.connect")} ${o.name||""}`]}),e.jsx(K,{size:"small","aria-controls":h?"split-button-menu":void 0,"aria-expanded":h?"true":void 0,"aria-label":"select merge strategy","aria-haspopup":"menu",onClick:P,children:e.jsx(zs,{})})]}),e.jsx(Bo,{sx:{zIndex:10},open:h,anchorEl:v.current,placement:"bottom-end",role:void 0,transition:!0,disablePortal:!0,children:({TransitionProps:W})=>e.jsx(Mo,{...W,style:{transformOrigin:"center top"},children:e.jsx(Pt,{children:e.jsx(Uo,{onClickAway:I,children:e.jsxs(Vo,{id:"split-button-menu",autoFocusItem:!0,sx:{maxHeight:300,overflowY:"auto",zIndex:10},children:[Y==null?void 0:Y.map(B=>{var G;return e.jsxs(fe,{selected:B.id===(o==null?void 0:o.id),sx:{height:56},onClick:()=>C(B),children:[e.jsxs(c,{children:[e.jsx(Ce,{sx:{fontSize:"16px"},maxLength:24,children:B.name}),e.jsx(Ce,{sx:{fontSize:"13px",opacity:.6},maxLength:30,children:B.url})]}),Is({store:B,userDid:(G=p==null?void 0:p.user)==null?void 0:G.did})&&e.jsx(de,{sx:{ml:1},onClick:T=>{T.preventDefault(),T.stopPropagation(),D(B)},children:e.jsx(ue,{icon:"ic:outline-delete"})})]},B.url)}),e.jsx(Gn,{}),e.jsxs(fe,{onClick:E,children:[e.jsx(pt,{font:!0}),e.jsx(L,{variant:"inherit",children:u("store.blockletRegistry.addRegistry")})]})]})})})})}),R&&e.jsx(an,{hiddenChildren:!0,open:!0,onClose:z,teamDid:U,storeList:Y,scope:"studio",onAdd:(S=x==null?void 0:x.actions)==null?void 0:S.refreshBlocklet}),y&&e.jsx(ht,{displayError:!0,title:`${u("common.delete")} ${y.name}`,description:u("blocklet.publish.deleteStoreTip",{name:y.name}),confirm:u("common.confirm"),onConfirm:N,onCancel:()=>D(null)})]})}to.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};to.defaultProps={store:null,blocklet:null};const Nr=(t,o,n)=>{const l=`${Q.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${o.meta.did}/${n}/logo/upload`,i=`${Q.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${o.meta.did}/${n}/screenshot/upload`,a=t!=null&&t.blockletLogo?`${l}/${t.blockletLogo}`:`${Q.WELLKNOWN_SERVICE_PATH_PREFIX}/static/images/logo.png`,r=((t==null?void 0:t.blockletScreenshots)||[]).filter(Boolean).map(u=>`${i}/${u}`);return{logoUrl:a,screenshotUrls:r,uploadLogoPrefix:l,uploadScreenshotPrefix:i}},wn=Nr,Ar=t=>{const o=t.includes("youtube.com")||t.includes("youtu.be"),n=t.includes("vimeo.com");return o||n};function ft({url:t,style:o,controls:n,modestbranding:l}){var u;const{t:i}=Z(),a=t.includes("youtube.com")||t.includes("youtu.be"),r=t.includes("vimeo.com");if(a){const p=((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/${p}?modestbranding=${l}&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(r){const p=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/${p}`,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(L,{variant:"body1",sx:{opacity:.5},children:i("studio.videoDialogNoSrc")})]})})}ft.propTypes={url:s.string.isRequired,style:s.object,controls:s.number,modestbranding:s.number};ft.defaultProps={style:{},controls:1,modestbranding:1};function Cn({setParams:t,onClose:o,params:n}){const{t:l}=Z(),[i,a]=g.useState(""),r=i&&n.blockletVideos.includes(i),u=Ar(i),p=()=>{t(d=>{const b=[...d.blockletVideos];return b.push(i),{...d,blockletVideos:b}}),o()};return e.jsxs(at,{open:!0,fullWidth:!0,maxWidth:"sm",children:[e.jsx(Fo,{children:l("studio.videoDialogTitle")}),e.jsxs(Ho,{children:[e.jsx(Xn,{fullWidth:!0,value:i,onChange:d=>a(d.target.value),placeholder:l("studio.videoInputLabel"),endAdornment:i?e.jsx(Xe,{position:"end",children:e.jsx(de,{onClick:()=>a(""),children:e.jsx(bs,{})})}):null,error:r}),r&&e.jsx(L,{variant:"body2",color:"error",children:l("studio.duplicateVideo")}),e.jsx(ft,{url:i,style:{marginTop:"20px",borderRadius:"4px"}})]}),e.jsxs(Jo,{children:[e.jsx(K,{onClick:()=>o(),children:l("studio.cancel")}),e.jsx(K,{disabled:!u||r,onClick:p,children:l("studio.confirm")})]})]})}Cn.propTypes={onClose:s.func.isRequired,params:s.object.isRequired,setParams:s.func.isRequired};function Dt({errors:t,storeList:o,...n}){const{t:l}=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(L,{variant:"caption",sx:{fontWeight:"bold",position:"absolute",top:-10,left:12,backgroundColor:"white",px:1,width:"fit-content"},children:l("blocklet.publish.storeRule.warning")}),t&&Object.entries(t).map(([i,a])=>{const r=Object.values(a),u=o.find(p=>p.url===i);return r.length>0&&e.jsxs(c,{children:[e.jsx(je,{title:i,children:e.jsx(c,{component:"span",sx:{cursor:"pointer"},children:u.name})}),r.map(p=>e.jsx(c,{component:"li",ml:2,breakWords:!0,children:p},p))]},i)})]})}Dt.propTypes={errors:s.object.isRequired,storeList:s.array.isRequired};const qo=g.lazy(()=>rn(()=>import("./index-CSbITcwB.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13])).then(t=>({default:t.Uploader})));function Sn({projectId:t,readOnly:o,loading:n,blocklet:l,params:i,setParams:a,paramsErrTip:r,setParamsErrTip:u,warning:p,setLoading:d,initUrl:b,initLogoUrl:j,setInitLogoUrl:x,componentDid:h}){const{t:f,locale:v}=Z(),{api:R}=ge(),m=Tt(),y=g.useRef(null),D=g.useRef(null),[C,P]=$r(l),[I,E]=g.useState(!1),z=dn({messageType:"connect-store-message",onOpen:()=>d(!0),onClose:()=>d(!1)}),N=async q=>{const X=setTimeout(()=>{d(!1)},2e4),J=await _r(R,q);d(!1),clearTimeout(X),window.parent.postMessage({event:"studioDialog.connected",componentDid:h},"*"),m(window.location.pathname.replace(`${Q.UNOWNED_DID}/create`,`${J}/create`),{replace:!0})},Y=()=>{if(!i.blockletTitle){M.error(f("blocklet.publish.errorTip.noTitle"));return}if(!(C!=null&&C.url)){M.error(f("blocklet.publish.noStoreSelected"));return}const q=Pr();z(async(X,J)=>{var ee,re,ae;try{const oe=await R.connectByStudio({input:{did:(ee=l==null?void 0:l.meta)==null?void 0:ee.did,blockletTitle:i==null?void 0:i.blockletTitle,storeUrl:C.url,storeId:C.id,storeName:C.name,type:((re=i==null?void 0:i.blockletComponents)==null?void 0:re.length)>0?"pack":"resource",componentDid:h,messageId:q,tenantScope:(b==null?void 0:b.searchParams.get("tenantScope"))||""}});if(!(oe!=null&&oe.url)){M.error("failed to connect to store");return}J(oe.url),N({did:(ae=l==null?void 0:l.meta)==null?void 0:ae.did,projectId:"",messageId:q})}catch(oe){const le=xe(oe);M.error(le),d(!1)}})},{logoUrl:U,screenshotUrls:w,uploadLogoPrefix:k,uploadScreenshotPrefix:S}=wn(i,l,t),{logoErrors:W,screenshotErrors:B,storeList:G,hasLogoWarning:T,hasScreenshotWarning:$}=p,V=()=>o?!1:!t||t===Q.UNOWNED_DID?(M.error(f("blocklet.publish.errorTip.noFirstDid")),!1):!0,F=q=>{if(!q.destination)return;const X=Array.from(i.blockletScreenshots),[J]=X.splice(q.source.index,1);X.splice(q.destination.index,0,J),a(ee=>({...ee,blockletScreenshots:X}))},te=q=>{if(!q.destination)return;const X=Array.from(i.blockletVideos),[J]=X.splice(q.source.index,1);X.splice(q.destination.index,0,J),a(ee=>({...ee,blockletVideos:X}))};return e.jsxs(zr,{children:[e.jsx(c,{display:"flex",className:"section",children:e.jsxs(c,{sx:{flex:1},children:[e.jsx(se,{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:q=>{u({blockletTitle:""}),a({blockletTitle:q.target.value})},error:!!r.blockletTitle,helperText:r.blockletTitle||""}),e.jsx(se,{required:!0,label:"Blocklet DID",fullWidth:!0,readonly:!0,disabled:!0,autoComplete:"off",variant:"outlined",InputProps:{"data-cy":"export-blocklet-did",endAdornment:t===Q.UNOWNED_DID&&e.jsx(Xe,{position:"end",children:e.jsx(to,{blocklet:l,store:C,componentDid:h,onChangeStore:P,disabled:!i.blockletTitle||o||n,loading:n,onClick:Y})})},error:!!r.projectId,helperText:r.projectId||"",value:t===Q.UNOWNED_DID?"":`did:abt:${t}`,sx:{mt:3}}),e.jsx(se,{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:q=>{u({blockletDescription:""}),a({blockletDescription:q.target.value})},error:!!r.blockletDescription,helperText:r.blockletDescription||"",sx:{mt:3}}),e.jsx(se,{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:q=>{q.target.value&&!/^(http|https):\/\//.test(q.target.value)?u({blockletHomepage:f("blocklet.publish.errorTip.invalidUrl")}):u({blockletHomepage:""}),a({blockletHomepage:q.target.value})},error:!!r.blockletHomepage,helperText:r.blockletHomepage||"",sx:{mt:3}}),e.jsx(se,{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:q=>{q.target.value&&!/^(http|https):\/\//.test(q.target.value)?u({blockletCommunity:f("blocklet.publish.errorTip.invalidUrl")}):u({blockletCommunity:""}),a({blockletCommunity:q.target.value})},error:!!r.blockletCommunity,helperText:r.blockletCommunity||"",sx:{mt:3}}),e.jsx(se,{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:q=>{q.target.value&&!/^(http|https):\/\//.test(q.target.value)&&!/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/.test(q.target.value)?u({blockletSupport:f("blocklet.publish.errorTip.invalidUrlOrEmail")}):u({blockletSupport:""}),a({blockletSupport:q.target.value})},error:!!r.blockletSupport,helperText:r.blockletSupport||"",sx:{mt:3}}),e.jsx(se,{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:q=>{q.target.value&&!/^(git|https|svn)/.test(q.target.value)?u({blockletRepository:f("blocklet.publish.errorTip.invalidUrl")}):u({blockletRepository:""}),a({blockletRepository:q.target.value})},error:!!r.blockletRepository,helperText:r.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(Re,{direction:"column",spacing:1,sx:{mr:2,width:"160px"},children:[e.jsx(L,{variant:"subtitle1",sx:{fontWeight:"bold"},children:f("common.logo")}),e.jsxs(Re,{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($t,{variant:"square",sx:{width:80,height:80},alt:"Blocklet Logo",src:j||U,onClick:()=>{var q;V()&&((q=y.current)==null||q.open())}})})]}),T&&e.jsx(Dt,{errors:W,storeList:G,mt:3}),e.jsxs(c,{display:"flex",mt:3,flexDirection:"row",flexWrap:"wrap",children:[e.jsxs(Re,{direction:"column",spacing:1,sx:{mr:2,width:"160px"},children:[e.jsx(L,{variant:"subtitle1",sx:{fontWeight:"bold"},children:f("common.screenshot")}),e.jsxs(Re,{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(wo,{onDragEnd:o?void 0:F,children:e.jsx(Co,{droppableId:"screenshots",direction:"horizontal",isDropDisabled:o,children:(q,X)=>e.jsxs(c,{display:"flex",alignItems:"center",sx:{flex:1,flexWrap:"wrap",minHeight:160,background:X.isDraggingOver?"grey.100":"transparent",transition:"background-color 0.2s ease",border:X.isDraggingOver?"2px dashed #999":"none",borderRadius:"4px"},ref:q.innerRef,...q.droppableProps,children:[w.map((J,ee)=>e.jsx(So,{draggableId:J,index:ee,isDragDisabled:o,children:(re,ae)=>e.jsxs(c,{ref:re.innerRef,...re.draggableProps,className:"screenshot",sx:{transform:ae.isDragging?"scale(1.05)":"none",boxShadow:ae.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:J}),!o&&e.jsx(de,{...re.dragHandleProps,className:"action",style:{right:40,zIndex:10,color:"#fff"},children:e.jsx(St,{})}),!o&&e.jsx(de,{className:"action",onClick:()=>{a(oe=>{const le=[...oe.blockletScreenshots];return le.splice(ee,1),{...oe,blockletScreenshots:le}})},children:e.jsx(nt,{})})]})},J)),q.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 J;V()&&((J=D.current)==null||J.open())},children:"+"})]})})})]}),$&&e.jsx(Dt,{errors:B,storeList:G}),e.jsxs(c,{display:"flex",mt:3,flexDirection:"row",flexWrap:"wrap",children:[e.jsxs(Re,{direction:"column",spacing:1,sx:{mr:2,width:"160px"},children:[e.jsx(L,{variant:"subtitle1",sx:{fontWeight:"bold"},children:f("studio.video")}),e.jsxs(Re,{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(wo,{onDragEnd:o?void 0:te,children:e.jsx(Co,{droppableId:"videos",direction:"horizontal",isDropDisabled:o,children:(q,X)=>e.jsxs(c,{display:"flex",alignItems:"center",sx:{flex:1,flexWrap:"wrap",minHeight:160,background:X.isDraggingOver?"#f5f5f5":"transparent",transition:"background-color 0.2s ease",border:X.isDraggingOver?"2px dashed #999":"none",borderRadius:"4px"},ref:q.innerRef,...q.droppableProps,children:[i.blockletVideos.map((J,ee)=>e.jsx(So,{draggableId:J,index:ee,isDragDisabled:o,children:(re,ae)=>e.jsxs(c,{ref:re.innerRef,...re.draggableProps,className:"screenshot",sx:{transform:ae.isDragging?"scale(1.05)":"none",boxShadow:ae.isDragging?"0 5px 10px rgba(0,0,0,0.15)":"none",transition:"transform 0.2s ease, box-shadow 0.2s ease"},children:[e.jsx(ft,{url:J,style:{pointerEvents:ae.isDragging?"none":"auto"}}),!o&&e.jsx(de,{...re.dragHandleProps,className:"action",style:{right:40,zIndex:10,color:"#fff"},children:e.jsx(St,{})}),!o&&e.jsx(de,{className:"action",onClick:()=>{a(oe=>{const le=[...oe.blockletVideos];return le.splice(ee,1),{...oe,blockletVideos:le}})},children:e.jsx(nt,{})})]})},J)),q.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:()=>{V()&&E(!0)},children:"+"})]})})})]})]})}),e.jsxs(g.Suspense,{fallback:e.jsx(Ye,{}),children:[e.jsx(qo,{ref:y,locale:v,popup:!0,onUploadFinish:q=>{var X;a({blockletLogo:q.data.filename}),x(""),(X=y.current)==null||X.close()},plugins:["ImageEditor"],installerProps:{disabled:!0},apiPathProps:{uploader:k,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"),I&&e.jsx(Cn,{onClose:()=>E(!1),params:i,setParams:a}),e.jsx(qo,{ref:D,locale:v,popup:!0,onUploadFinish:q=>{var X;a(J=>{var re;const ee=J.blockletScreenshots||[];return ee.push((re=q.data)==null?void 0:re.filename),{...J,blockletScreenshots:ee}}),(X=D.current)==null||X.close()},installerProps:{disabled:!0},plugins:["ImageEditor"],apiPathProps:{uploader:S,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")]})]})}Sn.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.isRequired,componentDid:s.isRequired,initLogoUrl:s.string.isRequired,setInitLogoUrl:s.func.isRequired};const zr=ve.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 oo={},Or=Se;Object.defineProperty(oo,"__esModule",{value:!0});var Dn=oo.default=void 0,Wr=Or(Ie()),Br=e;Dn=oo.default=(0,Wr.default)((0,Br.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 Mr=(t,o,n,l)=>{const i=t?[...t]:[],a=((o==null?void 0:o.children)||[]).reduce((r,u)=>(r[u.meta.did]=!0,r),{});return Object.keys(n).forEach(r=>{if(!a[r])return;let u=!1;l||i.forEach(p=>{p.did===r&&(p.included=!0,p.required=!0,u=!0)}),u||i.push({did:r,included:!0,required:!0})}),i},Ur=async t=>{if(typeof t!="string")throw new Error("URL must be a string");try{const o=t.split("/").pop().split("?")[0],l=await(await fetch(t)).blob();return new File([l],o,{type:l.type})}catch{throw new Error("Failed to convert Logo URL to file")}};function*Vr(t,o){let n=0;for(;n<t.size;)yield t.slice(n,n+o),n+=o}const Fr=async({did:t,projectId:o,uploadType:n="logo",imageUrl:l})=>{const i=await Ur(l);new FormData().append("file",i);const r={uploaderId:"Uploader",relativePath:encodeURIComponent(i.name),name:encodeURIComponent(i.name),type:i.type},p=(await Ro.post(pe(Q.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(r).map(x=>`${x} ${btoa(r[x])}`).join(",")}})).headers.location,d=2*1024*1024;let b=0,j="";for(const x of Vr(i,d)){const h=await Ro.patch(pe(Q.WELLKNOWN_SERVICE_PATH_PREFIX,p),x,{headers:{"Tus-Resumable":"1.0.0","Upload-Offset":b,"Content-Type":"application/offset+octet-stream"}});b+=x.size,j=h.data.filename}return j},In=({params:t,projectId:o,status:n,t:l})=>{const i=[];return t.blockletTitle||i.push({param:"blockletTitle",message:l("blocklet.publish.errorTip.noTitle")}),(!o||o===Q.UNOWNED_DID)&&i.push({param:"projectId",message:l("blocklet.publish.errorTip.noDid")}),t.blockletVersion?Be.valid(t.blockletVersion)||i.push({param:"blockletVersion",message:l("blocklet.publish.errorTip.inValidVersion")}):i.push({param:"blockletVersion",message:l("blocklet.publish.errorTip.noVersion")}),n===he.PROJECT.RELEASE_STATUS.published&&(t.blockletDescription||i.push({param:"blockletDescription",message:l("blocklet.publish.errorTip.noDescription")}),t.note||i.push({param:"note",message:l("blocklet.publish.errorTip.noNote")})),i.length?i:null},Hr=({params:t,step:o,t:n,projectId:l})=>{if(o===0){if(!t.blockletTitle)return n("blocklet.publish.errorTip.noTitle");if(!l||l===Q.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(!Be.valid(t.blockletVersion))return n("blocklet.publish.errorTip.inValidVersion");if(!t.note)return n("blocklet.publish.errorTip.noNote")}return""};function no({blocklet:t,releaseId:o,connectedStores:n,projectId:l,releaseType:i,publishedStoreIds:a,onPublish:r,onDelete:u,warning:p,projectType:d,componentDid:b,onOpenConnectStore:j,behavior:x,onSelectConnectStore:h}){var P,I;const{t:f}=Z(),{actions:{refreshBlocklet:v}}=De(),{session:R}=Ve(),{storeList:m}=eo({fromBlocklet:!0,blocklet:t,componentDid:b,userDid:(P=R==null?void 0:R.user)==null?void 0:P.did}),y=g.useMemo(()=>n!=null&&n.length?n==null?void 0:n.reduce((E,z)=>(E[z.storeId]=z,E),{}):{},[n]),D=(I=t==null?void 0:t.meta)==null?void 0:I.did,C={};return Object.entries((p==null?void 0:p.logoErrors)||{}).forEach(([E,z])=>{const N=Object.values(z);N.length>0&&(C[E]=N)}),Object.entries((p==null?void 0:p.screenshotErrors)||{}).forEach(([E,z])=>{const N=Object.values(z);N.length>0&&(C[E]=C[E]?[...C[E],...N]:N)}),e.jsxs(e.Fragment,{children:[x==="connect"&&!!(m!=null&&m.length)&&e.jsx(dt,{severity:"info",style:{width:"100%"},children:e.jsxs(c,{color:Go[400],component:"a",href:d==="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:[f(d==="pack"?"blocklet.publish.whyCantSeeInStore":"blocklet.publish.whyCantSeeResourceBlockletInStore"),e.jsx(pn,{sx:{marginLeft:1}})]})}),e.jsx(Xo,{children:m==null?void 0:m.map(E=>e.jsx(_t,{"data-cy":"store-switch",children:e.jsx(Yo,{children:e.jsx(Ts,{behavior:x,onSelectConnectStore:h,releaseId:o,projectId:l,releaseType:i,kind:"publish",teamDid:D,warningList:C[E.url],store:E,published:(a==null?void 0:a.indexOf(E.id))>-1,connectedStore:y[E.id],onPublish:r,onDelete:u,scope:E.scope||"studio",onOpenConnectStore:j})})},E.url))}),e.jsx(an,{teamDid:D,storeList:m,scope:"studio",onAdd:v})]})}no.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};no.defaultProps={projectType:"",componentDid:"",publishedStoreIds:[],onPublish:()=>{},onDelete:()=>{},warning:{},onOpenConnectStore:()=>{},onSelectConnectStore:()=>{},behavior:"connect"};const Jr=Qo(t=>({addMenuItemRoot:{marginTop:"8px",justifyContent:"center",color:t.palette.primary.main,lineHeight:"3.2"}}));function so({disabled:t,endpointList:o,teamDid:n,onAdd:l,hiddenChildren:i,open:a,onClose:r}){const{api:u}=ge(),[p,d]=g.useState(!1),[b,j]=g.useState(!0),[x,h]=g.useState(!1),[f,v]=g.useState(""),[R,m]=g.useState(""),{t:y}=Z(),D=Jr(),C=()=>{v(""),h(!1),r()},P=async()=>{d(!0);try{const{decoded:I}=as(f,o);await u.addUploadEndpoint({input:{teamDid:n,url:I}}),l(I),C()}catch(I){const E=`${y("blocklet.publish.endpoint.addFailed")} ${xe(I)}`;m(E)}finally{d(!1)}};return e.jsxs(e.Fragment,{children:[!i&&e.jsxs(_t,{button:!0,disabled:t,className:D.addMenuItemRoot,onClick:()=>{h(!0)},children:[e.jsx(pt,{font:!0}),e.jsx(L,{variant:"inherit",children:y("blocklet.publish.endpoint.addEndpoint")})]}),e.jsxs(ut,{title:y("blocklet.publish.endpoint.addEndpoint"),fullWidth:!0,maxWidth:"md",open:a||x,onClose:C,PaperProps:{style:{minHeight:"auto"}},actions:e.jsxs(e.Fragment,{children:[e.jsx(Ee,{onClick:I=>{I.stopPropagation(),C()},color:"inherit",children:y("common.cancel")}),e.jsxs(Ee,{onClick:I=>{I.stopPropagation(),P()},color:"primary","data-cy":"install-blocklet-next-step",disabled:p||!f||b,variant:"contained",autoFocus:!0,children:[p&&e.jsx(we,{size:16}),y("common.confirm")]})]}),children:[e.jsx("div",{style:{paddingTop:12,overflowY:"hidden"},children:e.jsx(Yn,{component:"div",children:e.jsx(L,{component:"div",children:e.jsx(se,{label:y("blocklet.publish.endpoint.addEndpoint"),autoComplete:"off",variant:"outlined",name:"url","data-cy":"add-blocklet-endpoint-url",fullWidth:!0,value:f,onChange:I=>{m(null);let E=!1;I.target.value.trim()||(E=!0),I.target.value.trim()||m(y("blocklet.publish.endpoint.urlEmpty")),v(I.target.value),j(E)},disabled:p,onKeyPress:I=>{I.key==="Enter"&&(I.preventDefault(),I.target.value.trim()?P():m(y("blocklet.publish.endpoint.urlEmpty")))}})})})}),!!R&&e.jsx(dt,{severity:"error",style:{width:"100%"},children:R})]})]})}so.propTypes={teamDid:s.string.isRequired,disabled:s.bool,endpointList:s.array,onAdd:s.func,hiddenChildren:s.bool,open:s.bool,onClose:s.func};so.defaultProps={disabled:!1,endpointList:[],onAdd:()=>{},hiddenChildren:!1,open:!1,onClose:()=>{}};function ro({endpoint:t,teamDid:o,onDelete:n,projectId:l="",children:i}){const{api:a}=ge(),{t:r}=Z(),u=Zo(),p=De(),[d,b]=g.useState(!1),[j,x]=g.useState(null),h=()=>{b(!1),x(null)},f=async()=>{var m;try{b(!0),await a.deleteUploadEndpoint({input:{teamDid:o,did:t.id,projectId:l}}),await((m=p==null?void 0:p.actions)==null?void 0:m.refreshBlocklet()),n==null||n()}catch(y){M.error(`${r("blocklet.publish.endpoint.deleteFailed")}: ${xe(y)}`)}finally{b(!1),x(null)}},v={keyName:t.url,title:r("blocklet.publish.endpoint.deleteEndpoint"),description:r("blocklet.publish.endpoint.deleteDesc",{name:`<b>${t.url}</b>`,color:u.palette.error.main}),confirmPlaceholder:r("blocklet.publish.endpoint.confirmDesc",{name:t.url}),confirm:r("common.delConfirm"),cancel:r("common.cancel"),onConfirm:f,onCancel:h},R=m=>{t.protected||(m.stopPropagation(),x(v))};return e.jsxs(e.Fragment,{children:[i?e.jsx(c,{component:"span",onClick:R,children:i}):e.jsx(K,{"data-cy":"endpoint-action-delete",color:"primary",disabled:d,onClick:R,size:"small",children:e.jsx(nt,{sx:{zoom:.95}})}),j?e.jsx(Os,{keyName:j.keyName,title:j.title,description:j.description,confirmPlaceholder:j.confirmPlaceholder,confirm:j.confirm,cancel:j.cancel,params:j.params,onConfirm:j.onConfirm,onCancel:j.onCancel}):null]})}ro.propTypes={endpoint:s.object.isRequired,teamDid:s.string.isRequired,onDelete:s.func,projectId:s.string,children:s.node};ro.defaultProps={onDelete:"",projectId:"",children:null};function lo({connectedEndpoint:t,onDisconnect:o,onDelete:n,endpoint:l,teamDid:i,projectId:a}){const[r,u]=g.useState(null),p=!!r,{t:d}=Z(),[b,j]=g.useState(!1),x=m=>{m.stopPropagation(),window.open(fn(`${pe(l.url)}`,{allowDomains:null}))},h=m=>{u(m.currentTarget)},f=()=>{u(null)},v=()=>{j(!1),o()},R=[{label:d("blocklet.publish.endpoint.visitEndpoint"),action:x,icon:pn},{label:d("common.disconnect"),action:()=>{f(),j(!0)},icon:$s,hidden:!t}];return e.jsxs(e.Fragment,{children:[e.jsx(K,{ref:r,color:"primary",onClick:h,size:"small",children:e.jsx(ms,{sx:{zoom:.95}})}),e.jsxs(Qn,{anchorEl:r,open:p,onClose:f,anchorOrigin:{vertical:"bottom",horizontal:"center"},transformOrigin:{vertical:"top",horizontal:"center"},children:[R.map(m=>m.hidden?null:e.jsxs(fe,{dense:!0,onClick:m.action,disabled:m.disabled,children:[m.icon&&e.jsx(m.icon,{color:"action",sx:{marginRight:1}}),e.jsx(c,{color:"action",children:m.label})]},m.label)),e.jsx(ro,{endpoint:l,teamDid:i,onDelete:n,projectId:a,children:e.jsxs(fe,{dense:!0,disabled:l.protected,children:[e.jsx(nt,{sx:{color:l.protected?"action":"error.main",marginRight:1}}),e.jsx(c,{color:l.protected?"action":"error.main",children:d("common.delete")})]})})]}),b&&e.jsx(ht,{displayError:!0,title:`${d("common.disconnect")} ${l.appName}`,description:d("blocklet.publish.endpoint.disconnectEndpointTip",{url:l.url}),confirm:d("common.confirm"),onConfirm:v,onCancel:()=>j(!1)})]})}lo.propTypes={connectedEndpoint:s.object.isRequired,onDisconnect:s.func,onDelete:s.func,endpoint:s.object.isRequired,teamDid:s.string.isRequired,projectId:s.string};lo.defaultProps={projectId:"",onDelete:()=>{},onDisconnect:()=>{}};function rt({developerUrl:t,developerDid:o,sx:n,...l}){return e.jsx($t,{sx:{width:24,height:24,...n},src:pe(new URL(t).origin,`/.well-known/service/user/avatar/${o}?imageFilter=resize&w=120&h=120`),...l})}rt.propTypes={developerDid:s.string.isRequired,developerUrl:s.string.isRequired,sx:s.object};rt.defaultProps={sx:{}};function io({endpoint:t,published:o}){const{t:n}=Z(),l=()=>{window.open(fn(`${pe(t.url)}`,{allowDomains:null}))};return e.jsxs(c,{children:[e.jsx(L,{variant:"subtitle2",children:n(o?"blocklet.publish.endpoint.publishToEndpointSuccess":"blocklet.publish.endpoint.uploadToEndpointSuccess",{name:t.appName})}),e.jsx(K,{size:"small",sx:{mt:1},onClick:l,variant:"contained",color:"success",children:n("common.visitTarget",{name:t.appName})})]})}io.propTypes={endpoint:s.object.isRequired,published:s.bool.isRequired};io.defaultProps={};const Gr=Qo(()=>({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"}})),Eo=Zn(({className:t,...o})=>e.jsx(je,{...o,classes:{popper:t}}))(({theme:t})=>({[`& .${Kn.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 co({teamDid:t,projectId:o,releaseId:n,endpoint:l,warningList:i,onDelete:a,published:r,onPublish:u,connectedEndpoint:p,onOpenConnectEndpoint:d}){const b=Gr(),{t:j}=Z(),{api:x}=ge(),[h,f]=g.useState(!1),v=dn({messageType:"connect-endpoint-message",onOpen:()=>f(!0),onClose:()=>f(!1)}),R=!!p,m=()=>{v(async(I,E)=>{try{const z=await x.connectToEndpoint({input:{did:t,endpointId:l.id,projectId:o}});if(!(z!=null&&z.url)){M.error("failed to connect to endpoint");return}E(z.url),await d({did:t,projectId:o,endpointId:l.id}),f(!1)}catch(z){const N=xe(z);M.error(N),f(!1)}})},y=async()=>{try{await x.disconnectFromEndpoint({input:{did:t,endpointId:l.id,projectId:o}}),a()}catch(I){M.error(xe(I))}},D=()=>{f(!0),x.publishToEndpoint({input:{did:t,endpointId:l.id,projectId:o,releaseId:n}}).then(()=>{M.success(e.jsx(io,{endpoint:l,published:!0}),{duration:1e4}),u==null||u(null)}).catch(I=>{M.error(xe(I)),u==null||u(I)}).finally(()=>{f(!1)})};g.useEffect(()=>{R&&f(!1)},[R]);const C=i.length>0,P=e.jsxs(K,{sx:{paddingLeft:2,paddingRight:2,fontSize:15,width:130,height:"100%"},disabled:C,onClick:D,children:[h?e.jsx(we,{sx:{marginRight:1},size:16}):e.jsx(Ps,{sx:{marginRight:1,fontSize:20}}),j("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(L,{component:"span",className:b.title,variant:"subtitle1",children:l.appName})}),e.jsx(L,{className:b.url,component:"span",variant:"inherit",children:`${l.url}`})]}),e.jsxs(c,{className:b.actions,children:[p&&e.jsx(Eo,{placement:"top",title:e.jsxs(c,{children:[e.jsx(L,{component:"span",variant:"caption",sx:{opacity:.7},children:j("blocklet.publish.developerInfo")}),e.jsxs(c,{sx:{display:"flex",flexDirection:"row",alignItems:"center",gap:1,mt:1},children:[e.jsx(rt,{developerUrl:l.url,developerDid:p.developerDid,sx:{width:42,height:42}}),e.jsxs(c,{sx:{flex:1},children:[e.jsx(L,{component:"span",variant:"subtitle1",children:p.developerName}),e.jsx(Ct,{size:14,copyable:!0,compact:!0,responsive:!1,did:p.developerDid})]})]})]}),children:e.jsx(c,{children:e.jsx(rt,{developerUrl:l.url,developerDid:p.developerDid,sx:{marginRight:1,cursor:"help"}})})}),e.jsxs(tt,{disabled:h,variant:"outlined",sx:{height:38},size:"small",children:[!R&&e.jsxs(K,{sx:{paddingLeft:2,paddingRight:2,fontSize:15,width:130},onClick:m,children:[h?e.jsx(we,{sx:{marginRight:1},size:16}):e.jsx(_s,{sx:{marginRight:1}}),j("common.connect")]}),R&&r&&e.jsxs(K,{disabled:!0,sx:{paddingLeft:2,paddingRight:2,fontSize:15,width:130},children:[h?e.jsx(we,{sx:{marginRight:1},size:16}):e.jsx(hn,{sx:{marginRight:1}}),j("common.uploaded")]}),R&&!r&&(C?e.jsx(Eo,{title:e.jsxs(c,{children:[e.jsx(c,{sx:{color:"error.main",mb:.5},children:j("blocklet.publish.storeRule.warning")}),i.map((I,E)=>e.jsxs(c,{sx:{color:"error.main"},children:[E+1,". ",I]},I))]}),children:e.jsx("div",{children:P})}):P),e.jsx(lo,{projectId:o,endpoint:l,teamDid:t,connectedEndpoint:p,onDisconnect:y,onDelete:a})]})]})]})}co.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};co.defaultProps={published:!1,connectedEndpoint:null,projectId:"",warningList:[],releaseId:"",onDelete:()=>{},onOpenConnectEndpoint:()=>{},onPublish:()=>{}};function ao({releaseId:t,blocklet:o,connectedEndpoints:n,projectId:l,publishedEndpointIds:i,onPublish:a,onDelete:r,warning:u,onOpenConnectEndpoint:p}){var R,m;const{actions:{refreshBlocklet:d}}=De(),{session:b}=Ve(),{t:j}=Z(),x=(((R=o==null?void 0:o.settings)==null?void 0:R.endpointList)||[]).filter(y=>{var D;return y.scope===((D=b==null?void 0:b.user)==null?void 0:D.did)}),h=g.useMemo(()=>n!=null&&n.length?n==null?void 0:n.reduce((y,D)=>(y[D.endpointId]=D,y),{}):{},[n]),f=(m=o==null?void 0:o.meta)==null?void 0:m.did,v={};return Object.entries((u==null?void 0:u.logoErrors)||{}).forEach(([y,D])=>{const C=Object.values(D);C.length>0&&(v[y]=C)}),Object.entries((u==null?void 0:u.screenshotErrors)||{}).forEach(([y,D])=>{const C=Object.values(D);C.length>0&&(v[y]=v[y]?[...v[y],...C]:C)}),e.jsxs(e.Fragment,{children:[!!(x!=null&&x.length)&&e.jsx(dt,{severity:"info",style:{width:"100%"},children:e.jsx(c,{color:Go[400],children:j("blocklet.publish.endpoint.uploadToEndpoint")})}),e.jsx(Xo,{sx:{flex:1},children:x==null?void 0:x.map(y=>e.jsx(_t,{"data-cy":"endpoint-switch",children:e.jsx(Yo,{children:e.jsx(co,{releaseId:t,projectId:l,teamDid:f,warningList:v[y.url],endpoint:y,published:(i==null?void 0:i.indexOf(y.id))>-1,connectedEndpoint:h[y.id],onPublish:a,onDelete:r,onOpenConnectEndpoint:p})})},y.url))}),e.jsx(so,{teamDid:f,endpointList:x,onAdd:d})]})}ao.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)};ao.defaultProps={publishedEndpointIds:[],onPublish:()=>{},onDelete:()=>{},warning:{},onOpenConnectEndpoint:()=>{}};function Tn({did:t,params:o,setParams:n,projectId:l,open:i,onClose:a}){const{t:r}=Z(),[u,p]=g.useState(!1),{api:d}=ge(),[b,j]=g.useState(!1),[x,h]=g.useState(!1),f=()=>{j(o.autoUpload),h(o.possibleSameStore),p(!1),a(!1)},v=async()=>{p(!0);try{await d.updateProject({input:{did:t,projectId:l,blockletTitle:o.blockletTitle||"",blockletDescription:o.blockletDescription||"",blockletIntroduction:o.blockletIntroduction||"",autoUpload:!!b,possibleSameStore:!!x}}),n({autoUpload:b,possibleSameStore:x}),a(!1)}catch(m){M.error(m.message)}p(!1)};g.useEffect(()=>{j(o.autoUpload),h(o.possibleSameStore)},[o]);const R=!!(l&&l!==Q.UNOWNED_DID);return e.jsx(ut,{title:r("blocklet.publish.projectSettings"),disableEscapeKeyDown:!0,disablePortal:!1,fullWidth:!0,open:i,onClose:f,actions:e.jsxs(e.Fragment,{children:[e.jsx(K,{onClick:m=>{m.stopPropagation(),a()},color:"inherit",children:r("common.cancel")}),R&&e.jsxs(K,{onClick:m=>{m.stopPropagation(),v()},color:"primary","data-cy":"install-blocklet-next-step",disabled:u,variant:"contained",autoFocus:!0,children:[u&&e.jsx(we,{size:16}),r("common.confirm")]})]}),children:R?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(L,{variant:"body1",sx:{flex:1},children:r("blocklet.publish.autoUploadTip")}),e.jsx(qe,{checked:b,onChange:(m,y)=>j(y)})]}),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(L,{variant:"body1",sx:{flex:1},children:r("blocklet.publish.possibleSameStoreTip")}),e.jsx(qe,{checked:x,onChange:(m,y)=>h(y)})]})]}):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(L,{variant:"body1",sx:{flex:1},children:r("blocklet.publish.needProjectId")})]})})}Tn.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 $n({downloadUrl:t,installUrl:o,handleSetTip:n,isPack:l,disabled:i}){const{t:a}=Z(),[r,u]=g.useState(!1),p=g.useRef(null),d=()=>{u(!r)},b=j=>{p.current&&p.current.contains(j.target)||u(!1)};return e.jsxs(e.Fragment,{children:[e.jsx(K,{disabled:i,ref:p,onClick:d,children:e.jsx(c,{component:ue,sx:{fontSize:18},icon:"bxs:download"})}),e.jsx(Bo,{sx:{zIndex:10},open:r,anchorEl:p.current,placement:"bottom-end",role:void 0,transition:!0,disablePortal:!0,children:({TransitionProps:j})=>e.jsx(Mo,{...j,style:{transformOrigin:"center top"},children:e.jsx(Pt,{children:e.jsx(Uo,{onClickAway:b,children:e.jsxs(Vo,{id:"split-button-menu",autoFocusItem:!0,sx:{maxHeight:300,overflowY:"auto",zIndex:10},children:[l&&e.jsx(c,{component:"a",href:o,target:"_blank",rel:"noreferrer",sx:{textDecoration:"none"},children:e.jsxs(fe,{sx:{color:"#333"},children:[e.jsx(c,{component:ue,sx:{mr:1},icon:"ic:round-install-desktop"}),e.jsx(L,{variant:"inherit",children:a("blocklet.publish.installToThisServer")})]})}),e.jsxs(fe,{onClick:n,children:[e.jsx(c,{component:ue,sx:{mr:1},icon:"iconamoon:copy"}),e.jsx(L,{variant:"inherit",children:a("blocklet.publish.copyInstallUrl")})]}),e.jsx(c,{component:"a",href:t,target:"_blank",rel:"noreferrer",sx:{textDecoration:"none"},children:e.jsxs(fe,{sx:{color:"#333"},children:[e.jsx(c,{component:ue,sx:{mr:1},icon:"ph:download"}),e.jsx(L,{variant:"inherit",children:a("common.download")})]})})]})})})})})]})}$n.propTypes={disabled:s.bool.isRequired,isPack:s.bool.isRequired,downloadUrl:s.string.isRequired,installUrl:s.string.isRequired,handleSetTip:s.func.isRequired};var Oo;const Lo=(Oo=window.env)==null?void 0:Oo.serverEndpoint;function Pn({projectId:t,params:o,setParamsErrTip:n,initUrl:l,setParams:i,mode:a,loading:r,blocklet:u,release:p,isPublished:d,releaseId:b,getData:j,getRelease:x,paramsErrTip:h,warning:f,componentDid:v,resourceRelateComponents:R,disabledSelectComponents:m,saveSelectedEventsRef:y,hasSelectedResources:D,initLogoUrl:C,setLoading:P,releaseUsedLast:I,setReleaseUsedLast:E,projectType:z}){var Ne;const{t:N,locale:Y}=Z(),U=[{label:e.jsx(c,{textAlign:"center",width:"100%",children:N("blocklet.publish.store")}),value:"store"},{label:e.jsx(c,{textAlign:"center",width:"100%",children:N("blocklet.publish.endpoint.tab")}),value:"endpoint"}],[w,k]=g.useState(U[0].value),{api:S}=ge(),W=Tt(),[B,G]=g.useState(!1),[T,$]=g.useState(!1),[V,F]=g.useState(),te=Me(ne=>ne.breakpoints.down("md")),q=g.useMemo(()=>{var ne;return o!=null&&o.blockletResourceType?o==null?void 0:o.blockletResourceType:((ne=o==null?void 0:o.blockletComponents)==null?void 0:ne.length)>0?(o==null?void 0:o.blockletComponents.find(O=>O.included))?"resource":"pack":"resource"},[o==null?void 0:o.blockletComponents,o==null?void 0:o.blockletResourceType]),X=()=>{window.parent.postMessage({event:"studioDialog.uploaded",componentDid:v},"*"),x()},J=async ne=>{var Ae,ze,He,Oe;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 Te=In({params:o,hasSelectedResources:D,projectId:t,status:ne,t:N});if(Te){M.error(Te.map(H=>H.message).join("; ")),n(Te.reduce((H,ce)=>({...H,[ce.param]:ce.message}),{}));return}const O={...o};if(O.blockletComponents=Mr(O.blockletComponents,u,R,m),O.blockletVersion=Be.valid(O.blockletVersion),!O.blockletVersion){M.error("Invalid Blocklet Version"),n({blockletVersion:"Invalid Blocklet Version"});return}if(C)try{const H=await Fr({did:u.meta.did,projectId:t,imageUrl:C});O.blockletLogo=H,i({blockletLogo:H})}catch(H){M.error(H.message);return}if(o.resourceFromSelect){O.uploadedResource="";try{const H=Object.keys(y.current);await st(H.map(ce=>()=>{const Je=y.current[ce];return wr({api:S,locale:Y,projectId:t,releaseId:I?"":b,appDid:u.meta.did,component:Je.component,resources:Je.resources,initUrl:l})}),{concurrency:2})}catch(H){M.error(((He=(ze=(Ae=H==null?void 0:H.response)==null?void 0:Ae.data)==null?void 0:ze.error)==null?void 0:He.message)||H.message),n({blockletResource:"Invalid save the resource"});return}}else(Oe=o.blockletDocker)!=null&&Oe.dockerImage||(O.blockletComponents=[]);O.blockletTitle=(O.blockletTitle||"").trim(),O.blockletDescription=(O.blockletDescription||"").trim(),O.blockletSupport=(O.blockletSupport||"").trim(),O.blockletHomepage=(O.blockletHomepage||"").trim(),O.blockletCommunity=(O.blockletCommunity||"").trim(),O.blockletRepository=(O.blockletRepository||"").trim(),O.blockletIntroduction=(O.blockletIntroduction||"").trim(),O.note=(O.note||"").trim(),O.blockletComponents=((O==null?void 0:O.blockletComponents)||[]).filter(H=>H.included).map(H=>Nt(H,["did","required"])).map(JSON.stringify),O.contentType!=="docker"&&(O.blockletDocker={dockerImage:"",dockerCommand:"",dockerArgs:[],dockerEnvs:[]}),O.blockletDocker.dockerImage=O.blockletDocker.dockerImage||"",O.blockletDocker.dockerArgs.length>0&&O.blockletDocker.dockerArgs.forEach(H=>{H.proxyBehavior=H.proxyBehavior||"service"});try{await S.createRelease({input:{...O,note:JSON.stringify({note:O.note}),did:u.meta.did,projectId:t,releaseId:I?"":b,status:ne}}),ne==="draft"?M.success(N("blocklet.publish.saveDraftSuccess")):(E(!1),M.success(N("blocklet.publish.createReleaseSuccess")),window.parent.postMessage({event:"studioDialog.released",componentDid:v},"*")),n({blockletResource:"",blockletTitle:"",blockletDescription:"",blockletVersion:"",blockletLogo:"",projectId:"",blockletIntroduction:"",note:""})}catch(H){const ce=xe(H);M.error(ce),(/resource/.test(ce)||/zip/.test(ce))&&n({blockletResource:ce});return}const Fe=await S.getProject({input:{did:u.meta.did,projectId:t}}),ie=Fe.project.lastReleaseId;o.autoUpload&&await st(Fe.project.connectedStores.map(H=>async()=>{try{const ce=await S.publishToStore({input:{did:u.meta.did,storeId:H.storeId,storeName:H.storeName,projectId:t,releaseId:ie,type:q}});M.success(e.jsx(qs,{storeName:H.storeName,storeUrl:H.storeUrl,developerDid:H.developerDid,did:u.meta.did,published:ce.url==="published"}),{duration:1e4})}catch(ce){M.error(xe(ce))}}),{concurrency:4}),X==null||X(),W(`../${t}/view/${ie}`,{replace:!0})},ee=ne=>(P(!0),J(ne).finally(()=>{P(!1)})),re=async ne=>{await qr(S,ne),j()},ae=async ne=>{await Er(S,ne),j()},oe=()=>{$(!0)},le=pe(Lo,`/api/project/${u.meta.did}/${t}/${b}/release/blocklet.json`),Le=new URL(Lo);Le.pathname=pe(Le.pathname,"/launch-blocklet/agreement"),Le.searchParams.set("blocklet_meta_url",le);const ke=Le.href,Qe=()=>F(le);return e.jsxs(e.Fragment,{children:[e.jsx(Xr,{className:"sticky-header",children:e.jsx(Lt,{left:e.jsxs(Wo,{className:"breadcrumbs","aria-label":"breadcrumb",children:[e.jsx(ye,{to:"../",children:N("common.blockletStudio")}),t===Q.UNOWNED_DID?e.jsx(L,{color:"text.primary",children:e.jsx(Ce,{maxLength:te?6:30,children:(o==null?void 0:o.blockletTitle)||"Blocklet"})}):e.jsx(ye,{to:`../${t}`,children:e.jsx(Ce,{maxLength:te?6:30,children:(o==null?void 0:o.blockletTitle)||"Blocklet"})}),e.jsx(L,{color:"text.primary",children:a==="create"?N("common.create"):(o==null?void 0:o.blockletVersion)||N("common.edit")})]}),actions:e.jsxs(e.Fragment,{children:[!d&&e.jsxs(tt,{disabled:r,variant:"contained",children:[e.jsxs(K,{variant:"contained",onClick:()=>ee(he.PROJECT.RELEASE_STATUS.published),children:[r&&e.jsx(we,{size:14,sx:{mr:.5},color:"inherit"}),N("blocklet.publish.createRelease")]}),e.jsx(K,{variant:"contained",onClick:oe,children:e.jsx(ue,{icon:"mage:settings-fill",fontSize:"16px"})})]}),d&&e.jsxs(e.Fragment,{children:[e.jsx(at,{fullWidth:!0,maxWidth:"sm",open:V,onClose:()=>F(""),children:e.jsxs(c,{sx:{py:5,px:4,wordBreak:"break-all"},children:[e.jsx(L,{variant:"h6",sx:{mb:2},children:N("blocklet.publish.installResourceTip")}),e.jsx(cn,{children:V}),e.jsxs(L,{sx:{mt:2},children:[N("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:N("blocklet.publish.installResourceHelp")})]})]})}),e.jsxs(tt,{disabled:r,variant:"contained",children:[e.jsxs(K,{onClick:()=>G(!0),children:[r?e.jsx(we,{size:14,sx:{mr:1},color:"inherit"}):e.jsx(Dn,{sx:{fontSize:"1.3em",mr:1}}),N(te?"common.upload":"blocklet.publish.connectOrUpload")]}),e.jsx($n,{isPack:q==="pack",downloadUrl:pe(`${Q.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${u.meta.did}/${t}/${b}/download/${(p.files||[])[0]}`),installUrl:ke,handleSetTip:Qe}),e.jsx(K,{onClick:oe,children:e.jsx(ue,{icon:"mage:settings-fill",fontSize:"16px"})})]})]})]})})}),e.jsx(ut,{title:N("blocklet.publish.connectOrUpload"),disableEscapeKeyDown:!0,disablePortal:!1,fullWidth:!0,open:B,onClose:()=>G(!1),children:e.jsxs(c,{children:[e.jsx(c,{mt:-2,mb:2,children:e.jsx(sn,{tabs:U,current:w,onChange:k})}),w==="store"&&e.jsx(no,{projectType:z,blocklet:u,releaseType:q,projectId:t,releaseId:b,componentDid:v,warning:f,onPublish:X,onOpenConnectStore:re,onDelete:j,connectedStores:o.connectedStores||[],publishedStoreIds:p==null?void 0:p.publishedStoreIds}),w==="endpoint"&&e.jsx(Re,{minHeight:400,children:e.jsx(ao,{blocklet:u,releaseType:q,projectId:t,releaseId:b,warning:f,publishedEndpointIds:[],connectedEndpoints:o.connectedEndpoints||[],onPublish:X,onOpenConnectEndpoint:ae,onDelete:j})})]})}),e.jsx(Tn,{did:(Ne=u==null?void 0:u.meta)==null?void 0:Ne.did,params:o,projectId:t,open:T,setParams:i,onClose:()=>$(!1)})]})}Pn.propTypes={projectId:s.string.isRequired,params:s.object.isRequired,mode:s.string.isRequired,loading:s.bool.isRequired,blocklet:s.object.isRequired,release:s.object.isRequired,isPublished:s.bool.isRequired,releaseId:s.string.isRequired,getData:s.func.isRequired,getRelease:s.func.isRequired,componentDid:s.string.isRequired,resourceRelateComponents:s.object.isRequired,disabledSelectComponents:s.bool.isRequired,saveSelectedEventsRef:s.object.isRequired,hasSelectedResources:s.bool.isRequired,initLogoUrl:s.string.isRequired,setLoading:s.func.isRequired,releaseUsedLast:s.bool.isRequired,setReleaseUsedLast:s.func.isRequired,projectType:s.string.isRequired,setParamsErrTip:s.func.isRequired,warning:s.object.isRequired,setParams:s.func.isRequired,initUrl:s.object.isRequired,paramsErrTip:s.object.isRequired};const Xr=ve.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 _n({text:t}){const{palette:o}=Zo();return t?e.jsx(Ws,{style:{backgroundColor:o.background.default,color:o.text.primary},wrapperElement:{"data-color-mode":"light"},source:js.sanitize(t),rehypePlugins:[[Bs,{target:"_blank"}]]}):e.jsx(Ue,{Icon:zt})}_n.propTypes={text:s.string.isRequired};function qn({params:t,setParams:o,paramsErrTip:n,loading:l,setParamsErrTip:i,readOnly:a}){var b;const{t:r}=Z(),[u,p]=g.useState(a?"preview":"write"),d=(j,x)=>{p(x)};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(L,{variant:"h6",fontWeight:"bold",sx:{},children:r("common.introduction")}),e.jsxs(Ko,{value:u,onChange:d,"aria-label":"wrapped label tabs example",children:[e.jsx(ot,{value:"write",label:"Write"}),e.jsx(ot,{value:"preview",label:"Preview"})]})]}),e.jsx(c,{display:u==="write"?"block":"none",sx:{width:"100%",marginTop:3},children:e.jsx(se,{disabled:l||a,sx:{border:"none"},placeholder:`Blocklet ${r("common.introduction")}`,InputProps:{"data-cy":"export-blocklet-introduction",readOnly:a,endAdornment:e.jsxs(Xe,{position:"end",children:[((b=t==null?void 0:t.blockletIntroduction)==null?void 0:b.length)||0," / ",he.PROJECT.MAX_INTRO_LENGTH]})},autoComplete:"off",variant:"outlined",fullWidth:!0,multiline:!0,minRows:4,value:t.blockletIntroduction||"",onChange:j=>{i({blockletIntroduction:""}),o({blockletIntroduction:j.target.value.slice(0,he.PROJECT.MAX_INTRO_LENGTH)})},error:!!n.blockletIntroduction,helperText:n.blockletIntroduction||""})}),e.jsx(c,{display:u==="preview"?"block":"none",mt:3,children:e.jsx(_n,{text:t.blockletIntroduction||""})})]})}qn.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 uo={},Yr=Se;Object.defineProperty(uo,"__esModule",{value:!0});var It=uo.default=void 0,Qr=Yr(Ie()),No=e;It=uo.default=(0,Qr.default)([(0,No.jsx)("circle",{cx:"12",cy:"19",r:"2"},"0"),(0,No.jsx)("path",{d:"M10 3h4v12h-4z"},"1")],"PriorityHigh");function po({step:t,ok:o,active:n,error:l,warning:i}){let a="grey.500",r=t+1;return o&&(r=e.jsx(hn,{sx:{fontSize:18,margin:0},color:"white"})),l||!o&&n>t?(a="error.main",r=e.jsx(It,{sx:{fontSize:18,margin:0},color:"white"})):i?(a="warning.main",r=e.jsx(It,{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:r})}po.propTypes={step:s.number,ok:s.bool,active:s.number,error:s.string,warning:s.bool};po.defaultProps={step:0,ok:!1,active:0,error:"",warning:!1};function En({steps:t,activeStep:o,setActiveStep:n,hasSelectedResources:l,params:i,loading:a,paramsErrTip:r,warning:u,viewMode:p,projectId:d}){const{t:b}=Z(),j=()=>{n(v=>v+1)},x=()=>{n(v=>v-1)},h=v=>v===0?(r==null?void 0:r.blockletTitle)||(r==null?void 0:r.projectId)||(r==null?void 0:r.blockletDescription)||(r==null?void 0:r.blockletHomepage)||(r==null?void 0:r.blockletSupport)||(r==null?void 0:r.blockletCommunity)||(r==null?void 0:r.blockletRepository):v===2?(r==null?void 0:r.blockletResource)||(r==null?void 0:r.blockletDocker)||(r==null?void 0:r.dockerImageName):v>=4?(r==null?void 0:r.blockletVersion)||(r==null?void 0:r.note):"",f=p||In({hasSelectedResources:l,params:i,projectId:d,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(es,{activeStep:o,orientation:"vertical",children:t.map((v,R)=>{const m={},y=a||!Hr({hasSelectedResources:l,params:i,projectId:d,step:R,t:b}),D=a?"":h(R);return D&&(m.optional=e.jsx(L,{variant:"caption",color:"error",sx:{wordBreak:"break-word"},children:D}),m.error=!0),e.jsxs(ts,{children:[e.jsx(os,{icon:e.jsx(po,{error:D,warning:R===0?u.hasWarning:!1,active:f?99:o,step:R,ok:y}),sx:{cursor:"pointer",color:D?"error.main":"inherit"},disabled:!1,onClick:()=>n(R),...m,children:e.jsx(L,{fontSize:"14px",fontWeight:"500",color:D||!y&&o>R?"error.main":"inherit",children:v.label})}),e.jsxs(ns,{children:[e.jsx(L,{fontSize:12,children:v.description}),!f&&e.jsx(c,{sx:{mb:2},children:e.jsxs("div",{children:[R<t.length-1&&e.jsx(K,{variant:"contained",onClick:j,sx:{mt:1,mr:1},disabled:D||!y,children:b("common.continue")}),R>0&&e.jsx(K,{disabled:R===0,onClick:x,sx:{mt:1,mr:1},children:b("common.back")})]})})]})]},v.label)})}),o>=t.length-1&&e.jsx(Pt,{square:!0,elevation:0,sx:{p:3},children:e.jsx(L,{fontSize:12,sx:{opacity:.5},children:"Click right top button to release"})})]})}En.propTypes={steps:s.array.isRequired,activeStep:s.number.isRequired,setActiveStep:s.func.isRequired,params:s.object.isRequired,viewMode:s.string.isRequired,loading:s.bool.isRequired,projectId:s.string.isRequired,hasSelectedResources:s.bool.isRequired,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};const Zr=[".zip",".gz"],Kr=1024*1024*100,el=g.lazy(()=>rn(()=>import("./index-CSbITcwB.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13])).then(t=>({default:t.Uploader})));function ho({app:t,projectId:o,readOnly:n,params:l,setParams:i,setParamsErrTip:a,error:r}){const{t:u,locale:p}=Z(),d=g.useRef(null),b=()=>n?!1:!o||o===Q.UNOWNED_DID?(M.error(u("blocklet.publish.errorTip.noFirstDid")),!1):!0,j=`${Q.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${t.meta.did}/${o}/resource/upload`;return e.jsxs(c,{sx:{mt:3},children:[e.jsx(L,{gutterBottom:!0,children:u("blocklet.publish.resourceUpload")}),e.jsxs(Re,{direction:"row",alignItems:"center",spacing:1,sx:{flex:1,cursor:n?"default":"pointer"},children:[!!l.uploadedResource&&e.jsx(L,{component:"a",href:`${j}/params.uploadedResource`,children:l.uploadedResource}),!n&&e.jsx(K,{variant:"outlined",size:"small",onClick:()=>{var x;b()&&((x=d.current)==null||x.open())},children:l.uploadedResource?u("common.change"):u("common.upload")})]}),e.jsx(g.Suspense,{fallback:e.jsx(Ye,{}),children:e.jsx(el,{ref:d,locale:p,popup:!0,onUploadFinish:x=>{var h;i({uploadedResource:x.data.filename}),a({blockletResource:""}),(h=d.current)==null||h.close()},plugins:["ImageEditor"],installerProps:{disabled:!0},apiPathProps:{uploader:j,disableMediaKitPrefix:!0,disableMediaKitStatus:!0},coreProps:{restrictions:{allowedFileExts:Zr,maxFileSize:Kr,maxNumberOfFiles:1}}},"uploader-resource")}),!!r&&e.jsx(c,{color:"error.main",mt:1,fontSize:14,children:r})]})}ho.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};ho.defaultProps={};function lt({readOnly:t,params:o,setParams:n,paramsErrTip:l,setParamsErrTip:i,loading:a}){var u;const{t:r}=Z();return e.jsx(c,{display:"flex",mt:3,className:"section",children:e.jsxs(c,{sx:{flex:1},children:[e.jsx(se,{required:!0,disabled:a||t,label:`Blocklet ${r("common.version")}`,placeholder:`Blocklet ${r("common.version")}`,InputProps:{"data-cy":"blocklet-version",readOnly:t},autoComplete:"off",variant:"outlined",fullWidth:!0,value:o.blockletVersion||"",onChange:p=>{i({blockletVersion:""}),n({blockletVersion:p.target.value})},error:!!l.blockletVersion,helperText:l.blockletVersion||""}),e.jsx(se,{label:r("blocklet.publish.releaseNote"),autoComplete:"off",disabled:a||t,variant:"outlined",InputProps:{"data-cy":"release-note",readOnly:t,endAdornment:e.jsxs(Xe,{position:"end",children:[((u=o==null?void 0:o.note)==null?void 0:u.length)||0," / ",he.PROJECT.MAX_NOTE_LENGTH]})},fullWidth:!0,multiline:!0,minRows:4,required:!0,value:o.note||"",onChange:p=>{i({note:""}),n({note:p.target.value.slice(0,he.PROJECT.MAX_NOTE_LENGTH)})},error:!!l.note,helperText:l.note||"",sx:{mt:3}})]})})}lt.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};lt.defaultProps={};function Ln(t){for(const o in t)typeof t[o]=="string"?t[o]=t[o].replace(/\\\\/g,"\\"):typeof t[o]=="object"&&t[o]!==null&&Ln(t[o]);return t}function it({index:t,item:o,dockerParams:n,setDockerParams:l,dataKey:i,t:a,readOnly:r}){const u=(o==null?void 0:o.value)||"",[p,d]=g.useState(!1),b=()=>{var U;(U=n[i])==null||U.splice(t,1),l({...n,[i]:[...n[i]]})},j=(U,w)=>{var k;(k=n[i])!=null&&k[t]&&(w?(n[i][t].custom=n[i][t].value,n[i][t].value=`$${yt(o.key)}`):(n[i][t].value=n[i][t].custom||"",n[i][t].custom="")),l({...n,[i]:[...n[i]]})},x=(U,w)=>{var S;const k=((S=n[i][t])==null?void 0:S.value)||"";n[i][t]={...n[i][t],secure:w,value:w&&k===he.BLOCKLET_AUTOMATIC_ENV_VALUE?"":k},l({...n,[i]:[...n[i]]})},h=(U,w)=>{n[i][t]={...n[i][t],shared:w},l({...n,[i]:[...n[i]]})},f=(U,w)=>{var S;const k=((S=n[i][t])==null?void 0:S.value)||"";n[i][t]={...n[i][t],required:w,value:w&&k===he.BLOCKLET_AUTOMATIC_ENV_VALUE?"":k},l({...n,[i]:[...n[i]]})},v=(U,w)=>{n[i][t]={...n[i][t],value:w?he.BLOCKLET_AUTOMATIC_ENV_VALUE:"",secure:!1,required:!1},l({...n,[i]:[...n[i]]})},R=U=>{n[i][t]={...n[i][t],description:U.target.value},l({...n,[i]:[...n[i]]})},m=U=>{const w=U.target.value==="web"?"web":"docker";w==="web"&&n.dockerArgs.forEach(W=>{W.type="docker"});const S=`/${n.dockerImage.replace(/\W/g,"-")}-${t}`;n.dockerArgs[t]={...n.dockerArgs[t],type:w,path:w==="docker"?S:"/",protocol:"http",prefix:w==="docker"?S:"/",name:"publicUrl",port:"BLOCKLET_PORT"},l({...n,dockerArgs:[...n.dockerArgs]})},y=U=>{n.dockerArgs[t]={...n.dockerArgs[t],proxyBehavior:U.target.value==="direct"?"direct":"service"},l({...n,dockerArgs:[...n.dockerArgs]})},D=U=>{const w=U.target.value;n[i][t]={...n[i][t],prefix:w,path:w==="*"?"/":w},l({...n,[i]:[...n[i]]})},C=U=>{var w;(w=n[i])!=null&&w[t]&&(n[i][t].value=U.target.value),l({...n,[i]:[...n[i]]})},P=u===`$${yt(o.key)}`||o.custom,I=i==="dockerArgs"&&!un[o.key],E=Es[o.key],z=i==="dockerEnvs",N=o.key==="--publish";let Y=o.key;return N&&o.type==="web"?Y="--publish (Web)":z&&(Y=`--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(L,{sx:{textOverflow:"ellipsis",width:"100%",overflow:"hidden"},children:Y})}),e.jsxs(c,{sx:{display:"flex",flexDirection:"column",gap:1,flex:1},children:[e.jsx(se,{disabled:r||P||I||o.value===he.BLOCKLET_AUTOMATIC_ENV_VALUE,placeholder:"",value:P?`$${yt(o.key)}`:u,sx:{flex:1},InputProps:{endAdornment:e.jsxs(Xe,{position:"end",sx:{zoom:.9},children:[(!(E||I)||z||N)&&e.jsx(de,{onClick:()=>d(!0),children:e.jsx(ue,{icon:"icon-park-outline:setting-config"})}),!r&&e.jsx(de,{onClick:b,color:I?"error":"default",children:e.jsx(ue,{icon:"ic:round-delete"})})]})},error:I,onChange:C}),I&&e.jsx(L,{variant:"caption",color:"error",children:a("blocklet.publish.docker.noAllowTheArg")}),o.key==="--publish"&&e.jsx(L,{variant:"caption",color:"text.secondary",children:a("blocklet.publish.docker.publishTips")}),o.key==="--volume"&&Ls[o.key](u)&&e.jsx(L,{variant:"caption",color:"error",children:a("blocklet.publish.docker.volumeTips")})]}),p&&e.jsx(ut,{open:!0,fullWidth:!0,maxWidth:"sm",PaperProps:{style:{minHeight:0}},title:a(z?"blocklet.publish.docker.modifyEnv":"blocklet.publish.docker.modifyParam"),onClose:()=>d(!1),children:e.jsxs(c,{sx:{display:"flex",flexDirection:"column",gap:1,paddingBottom:2},children:[E||I||z?null:e.jsxs(c,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(L,{children:a("blocklet.publish.docker.needCustomInput")}),e.jsx(qe,{disabled:r,checked:P,onChange:j,sx:{zoom:.9}})]}),z&&e.jsxs(c,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(L,{children:a("blocklet.publish.docker.shared")}),e.jsx(qe,{disabled:r,checked:o.shared,onChange:h,sx:{zoom:.9}})]}),z&&e.jsxs(c,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(L,{children:a("blocklet.publish.docker.required")}),e.jsx(qe,{disabled:r,checked:o.required,onChange:f,sx:{zoom:.9}})]}),z&&e.jsxs(c,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(L,{children:a("blocklet.publish.docker.secure")}),e.jsx(qe,{disabled:r,checked:o.secure,onChange:x,sx:{zoom:.9}})]}),z&&e.jsxs(c,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(L,{children:a("blocklet.publish.docker.autoGenerated")}),e.jsx(qe,{disabled:r,checked:o.value===he.BLOCKLET_AUTOMATIC_ENV_VALUE,onChange:v,sx:{zoom:.9}})]}),z&&e.jsxs(c,{sx:{mt:1,width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(L,{sx:{flex:1},children:a("blocklet.publish.docker.description")}),e.jsx(se,{disabled:r,value:o.description,onChange:R,sx:{flex:1},label:a("blocklet.publish.docker.description")})]}),N&&e.jsxs(c,{sx:{mt:1,width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(L,{sx:{flex:1},children:a("blocklet.publish.docker.portType")}),e.jsxs(wt,{value:o.type||"docker",onChange:m,children:[e.jsx(fe,{value:"docker",children:"Docker"}),e.jsx(fe,{value:"web",children:"Web"})]})]}),N&&o.type==="web"&&e.jsxs(c,{sx:{mt:1,width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(L,{sx:{flex:1},children:a("blocklet.publish.docker.proxyBehavior")}),e.jsxs(wt,{value:o.proxyBehavior||"service",onChange:y,children:[e.jsx(fe,{value:"service",children:a("blocklet.publish.docker.serviceProxy")}),e.jsx(fe,{value:"direct",children:a("blocklet.publish.docker.directProxy")})]})]}),N&&o.type==="web"&&e.jsxs(c,{sx:{mt:1,width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(L,{sx:{flex:1},children:a("blocklet.publish.docker.prefix")}),e.jsx(se,{disabled:r,value:o.prefix,onChange:D,sx:{flex:1},label:a("blocklet.publish.docker.prefix")})]})]})})]})}it.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};it.defaultProps={};const tl=`
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 fo({readOnly:t,paramsErrTip:o,setParamsErrTip:n,error:l,params:i,setParams:a}){const{t:r}=Z(),[u,p]=g.useState("dockerParams"),[d,b]=g.useState(""),[j,x]=g.useState(!1),[h,f]=g.useState("--volume"),[v,R]=g.useState(""),[m,y]=g.useState(Do(d)),D=m.dockerArgs||[],C=m.dockerEnvs||[],P=m.dockerImage||"",I=m.dockerCommand||"",E=k=>{const{value:S}=k.target;b(S)};g.useEffect(()=>{i.blockletDocker&&i.blockletDocker.dockerImage&&!P&&y(i.blockletDocker)},[i,P,y]);const z=k=>{const S=Do(k.target.value);y(W=>{const B=W.dockerArgs.find($=>$.key==="--publish"&&$.type==="web");let G=!1;const T=$=>{$.type="web",$.path=B.path||"/",$.protocol=B.protocol||"http",$.prefix=B.prefix||"/",$.name=B.name||"publicUrl",$.port=B.port||"BLOCKLET_PORT"};if(S.dockerArgs.forEach($=>{const V=W.dockerArgs.find(F=>F.key===$.key);V&&(Object.entries(V).forEach(([F,te])=>{te!=null&&F!=="value"&&($[F]=te)}),$.proxyBehavior=$.proxyBehavior||"server",$.key==="--publish"&&$.type==="web"&&(G?$.type="docker":(T($),G=!0)))}),B&&!S.dockerArgs.find(V=>V.key==="--publish"&&V.type==="web")){const V=S.dockerArgs.find(F=>F.key==="--publish"&&F.value===B.value);V?T(V):(G=!1,S.dockerArgs.forEach(F=>{F.key==="--publish"&&!G&&(T(F),G=!0)}))}return S.dockerEnvs.forEach($=>{const V=W.dockerEnvs.find(F=>F.key===$.key);V&&Object.entries(V).forEach(([F,te])=>{te!=null&&F!=="value"&&($[F]=te)})}),S})},N=()=>{if(x(!1),h==="--env"){y({...m,dockerEnvs:[...C,{key:v,value:"",custom:"",secure:!1,shared:!1,required:!1,description:v}]}),R("");return}y({...m,dockerArgs:[...D,{key:h,value:"",type:"docker",name:"",path:"",prefix:"",protocol:""}]})},Y=()=>{x(!1),R("")},U=k=>{const{value:S}=k.target;y({...m,dockerImage:S}),S.indexOf(" ")>-1?n({...o,dockerImageName:r("blocklet.publish.docker.dockerImageNameError")}):n({...o,dockerImageName:""})},w=k=>{const{value:S}=k.target;y({...m,dockerCommand:S});try{As(S),n({...o,dockerCMD:""})}catch{n({...o,dockerCMD:r("blocklet.publish.docker.dockerCMDError")})}};return g.useEffect(()=>{u==="dockerCommand"&&b(Ns(m))},[m,u]),g.useEffect(()=>{a(k=>({...k,blockletDocker:{dockerImage:m.dockerImage,dockerCommand:m.dockerCommand,dockerArgs:m.dockerArgs,dockerEnvs:m.dockerEnvs}}))},[m,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(Ko,{value:u,onChange:(k,S)=>p(S),children:[e.jsx(ot,{value:"dockerParams",label:r("blocklet.publish.docker.dockerParams")}),e.jsx(ot,{value:"dockerCommand",label:r("blocklet.publish.docker.dockerCommand")})]})}),u==="dockerCommand"&&e.jsx(se,{disabled:t,label:r("blocklet.publish.docker.pleaseInputDockerCommand"),placeholder:tl,InputProps:{"data-cy":"blocklet-docker-command",readOnly:t},autoComplete:"off",variant:"outlined",fullWidth:!0,multiline:!0,spellCheck:!1,minRows:10,value:d,onChange:E,onBlur:z}),u==="dockerParams"&&e.jsxs(c,{sx:{display:"flex",flexDirection:"column",gap:2},children:[e.jsx(se,{disabled:t,label:r("blocklet.publish.docker.dockerImageName"),placeholder:"Example: docker.io/postgrest/postgrest:latest",value:P,sx:{flex:1},color:o.dockerImageName?"error":"primary",error:!!o.dockerImageName,helperText:o.dockerImageName||"",onChange:U}),e.jsx(se,{disabled:t,label:`Docker CMD (${r("common.optional")})`,placeholder:"Docker CMD",value:I,sx:{flex:1},color:o.dockerCMD?"error":"primary",error:!!o.dockerCMD,helperText:o.dockerCMD||"",onChange:w}),e.jsx(c,{sx:{height:4}}),D.map((k,S)=>e.jsx(it,{index:S,item:k,dockerParams:m,setDockerParams:y,dataKey:"dockerArgs",t:r,readOnly:t},`${k.key}-${S}`)),C.map((k,S)=>e.jsx(it,{index:S,item:k,dockerParams:m,setDockerParams:y,dataKey:"dockerEnvs",t:r,readOnly:t},`${k.key}-${S}`)),!t&&e.jsxs(c,{sx:{display:"flex",flexDirection:"row",gap:2,alignItems:"center"},children:[e.jsx(c,{sx:{flex:1}}),e.jsx(K,{onClick:()=>x(!0),children:r("blocklet.publish.docker.addItem")})]})]})]}),!!l&&e.jsx(c,{color:"error.main",mt:1,fontSize:14,children:l}),j&&e.jsxs(at,{fullWidth:!0,open:!0,children:[e.jsx(Fo,{children:r("blocklet.publish.docker.addItem")}),e.jsx(Ho,{children:e.jsxs(ss,{sx:{mt:1,width:"100%",minWidth:480,maxWidth:"100%"},children:[e.jsx(wt,{labelId:"demo-simple-select-helper-label",id:"demo-simple-select-helper",value:h,sx:{width:"100%"},onChange:k=>f(k.target.value),children:Object.keys(un).map(k=>e.jsx(fe,{value:k,children:k}))}),h==="--publish"&&e.jsx(L,{variant:"caption",color:"text.secondary",children:r("blocklet.publish.docker.publishTips")}),h==="--volume"&&e.jsx(L,{variant:"caption",color:"text.secondary",children:r("blocklet.publish.docker.volumeTips")}),h==="--env"&&e.jsxs(c,{sx:{mt:3,width:"100%"},children:[e.jsx(se,{value:v,onChange:k=>R(k.target.value),sx:{width:"100%"},label:r("blocklet.publish.docker.envKey")}),e.jsx(rs,{children:r("blocklet.publish.docker.dockerArgValue")})]})]})}),e.jsxs(Jo,{children:[e.jsx(K,{onClick:Y,children:r("common.cancel")}),e.jsx(K,{onClick:N,children:r("common.confirm")})]})]})]})}fo.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};fo.defaultProps={};const ol=({tabs:t,blocklet:o,ancestors:n=[]})=>{const l=o.meta.did;t.push({label:e.jsxs(c,{display:"flex",alignItems:"center",justifyContent:"flex-start",children:[e.jsx(Et,{size:24,blocklet:o,ancestors:n}),e.jsx(c,{ml:"4px",className:"text",children:e.jsx(c,{children:o.meta.title})})]},l),value:l})},Ao=(t,o)=>{const n=Nt(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(l=>({...l,included:!0})):n.blockletComponents=(o.children||[]).map(l=>({did:l.meta.did,included:!1,required:!1})),n},nl={0:"branding",1:"introduction",2:"resources",3:"blocklets",4:"version"},zo={branding:0,introduction:1,resources:2,blocklets:3,version:4};function bo({initUrl:t,...o}){var xo,go;const{projectId:n,mode:l,releaseId:i,componentDid:a=""}=ct(),{t:r,locale:u}=Z(),{blocklet:p}=De(),[d,b]=_e({blockletScreenshots:[],blockletVideos:[],publishedStoreIds:[],connectedStores:[],uploadedResource:"",contentType:"blocklet",blockletResourceType:"",blockletSupport:"",blockletCommunity:"",blockletHomepage:"",blockletRepository:"",blockletDocker:{dockerImage:"",dockerArgs:[],dockerEnvs:[]}}),[j,x]=_e({}),[h,f]=_e({}),[v,R]=g.useState(!1),[m,y]=_e(null),{api:D}=ge(),C=Me(_=>_.breakpoints.down("md")),[P,I]=g.useState({}),[E,z]=g.useState(!1),N=g.useRef({}),[Y,U]=_e({}),[w,k]=g.useState(""),[S,W]=_e({}),B=t==null?void 0:t.searchParams.get("dependentComponentsMode"),G=B==="readonly",{session:T}=Ve(),{storeList:$}=eo({fromBlocklet:!0,blocklet:p,componentDid:a,userDid:(xo=T==null?void 0:T.user)==null?void 0:xo.did}),[V,F]=g.useState([]);g.useEffect(()=>{Array.isArray($)&&$.length>0&&Promise.all($.map(async _=>({...(await(await fetch(`${_.url}/__blocklet__.js?type=json`)).json()).preferences,storeInfo:_}))).then(_=>{F(_)})},[$.length]),g.useEffect(()=>{const _={},A={},{logoUrl:be,screenshotUrls:$e}=wn(d,p,n);Promise.all(V.map(async me=>{const{maxImageCount:We,minImageCount:bt,logoImageType:Pe,imageMinHeight:jo,imageMinWidth:ko}=me,Ze=Array.isArray(Pe)?Pe:Pe.split(",");_[me.storeInfo.url]||(_[me.storeInfo.url]={}),A[me.storeInfo.url]||(A[me.storeInfo.url]={});const mt=A[me.storeInfo.url],zn=_[me.storeInfo.url];Number(We)<=$e.length&&(mt.maxImageCount=r("blocklet.publish.storeRule.maxImageCount",{max:We,count:$e.length,unit:We>1?r("blocklet.publish.storeRule.screenshots"):r("blocklet.publish.storeRule.screenshot")})),Number(me.minImageCount)>$e.length&&(mt.minImageCount=r("blocklet.publish.storeRule.minImageCount",{min:bt,count:$e.length,unit:bt>1?r("blocklet.publish.storeRule.screenshots"):r("blocklet.publish.storeRule.screenshot")}));const yo=be?be.split(".").pop():"";yo&&!(Ze.includes("jpg")?[...Ze,"jpeg"]:Ze).includes(yo)&&(zn.logoFormat=r("blocklet.publish.storeRule.logoFormat",{format:Ze.join(",")})),await Promise.all($e.map((On,xt)=>{const gt=new Image;return gt.src=On,new Promise(Wn=>{gt.onload=()=>{const{width:Bn,height:Mn}=gt;if(Bn<Number(ko)||Mn<Number(jo)){let Ge="";switch(xt+1){case 1:Ge=r("blocklet.publish.storeRule.first");break;case 2:Ge=r("blocklet.publish.storeRule.second");break;case 3:Ge=r("blocklet.publish.storeRule.third");break;default:Ge=`${xt+1}`;break}mt[`imageSize-${xt+1}`]=r("blocklet.publish.storeRule.minImageSize",{width:ko,height:jo,name:Ge})}Wn()}})}))})).then(()=>{const me=Object.values(_).some(Pe=>Object.values(Pe).length>0),We=Object.values(A).some(Pe=>Object.values(Pe).length>0);f({logoErrors:_,screenshotErrors:A,storeList:$,hasWarning:me||We,hasLogoWarning:me,hasScreenshotWarning:We})})},[d,p.did,n,V,r]);const te=g.useMemo(()=>{const _={};return Object.keys(S).forEach(A=>{const be=S[A];be&&be.forEach($e=>{_[$e]=!0})}),_},[S]),q=g.useCallback(_=>{G&&b({blockletComponents:[]}),W(_)},[G,W,b]),X=g.useCallback((..._)=>{U(..._),x({blockletResource:"",blockletDocker:""})},[]),J=i==="none"?(d==null?void 0:d.lastReleaseId)||"":i,[ee,re]=g.useState(l==="new-release"?4:0),ae=t==null?void 0:t.searchParams.get("resourcesTitle"),oe=t==null?void 0:t.searchParams.get("componentsTitle"),le=[{label:r("blocklet.publish.branding"),description:r("blocklet.publish.steps.branding")},{label:r("common.introduction"),description:r("blocklet.publish.steps.introduction")},{label:ae||r("blocklet.publish.resourceTitle"),description:r("blocklet.publish.steps.resources")},{label:oe||r("common.components"),description:r("blocklet.publish.steps.blocklets")},{label:r("blocklet.publish.versionTitle"),description:r("blocklet.publish.steps.version")}],Le=le[ee]||le[le.length-1],ke=nl[ee];g.useEffect(()=>{n&&x({projectId:""})},[n,x]);const Qe=g.useMemo(()=>{var _;return(d==null?void 0:d.blockletResourceType)==="resource"?"resource":(_=d==null?void 0:d.blockletComponents)!=null&&_.some(A=>A.included)||Object.keys(te).length||d!=null&&d.uploadedResource?"pack":"resource"},[d==null?void 0:d.blockletComponents,d==null?void 0:d.uploadedResource,te,d==null?void 0:d.blockletResourceType]),Ne=[],ne=((p==null?void 0:p.children)||[]).filter(_=>{var A;return(A=_.meta.resource)==null?void 0:A.exportApi}).filter(_=>!a||_.meta.did===a);ne.forEach(_=>{ol({tabs:Ne,blocklet:_,t:r,ancestors:[p]})});const[Te,O]=g.useState((go=Ne[0])==null?void 0:go.value),Fe=!E&&(m==null?void 0:m.status)==="published",ie=Fe,Ae=ws(()=>{if(!t)return;k(t.searchParams.get("logo")),b(A=>{var be;return{...A,blockletTitle:(A==null?void 0:A.blockletTitle)||t.searchParams.get("title"),blockletDescription:(A==null?void 0:A.blockletDescription)||t.searchParams.get("description"),blockletIntroduction:(A==null?void 0:A.blockletIntroduction)||t.searchParams.get("introduction")||t.searchParams.get("description"),blockletComponents:(be=A==null?void 0:A.blockletComponents)!=null&&be.length?A==null?void 0:A.blockletComponents:JSON.parse(t.searchParams.get("components")||"[]"),note:(A==null?void 0:A.note)||t.searchParams.get("note")||"No note"}});const _=t.searchParams.get("resources");try{const A=JSON.parse(_);I(A)}catch{}}),ze=async()=>{if(J)try{const _=await D.getRelease({input:{did:p.meta.did,projectId:n,releaseId:J}});if(R(!1),!_.release){M.error("Release not found");return}_.release.note=jn(_.release.note,"note"),_.release=Ln(_.release),l!=="view"&&(_.release.note=""),b(A=>Ao({...A,..._.release,blockletVersion:l==="create"||l==="new-release"?Be.inc(_.release.blockletVersion,"patch"):_.release.blockletVersion},p)),y(_.release)}catch(_){R(!1),M.error(xe(_))}},He=async()=>{if(n===Q.UNOWNED_DID){b({blockletVersion:"0.0.1",blockletTitle:""});return}if(!n){M.error(r("blocklet.publish.errorTip.noDid"));return}try{const A=(await yn(D.getProject,[{input:{did:p.meta.did,projectId:n}}],{key:"getProject"})).project||{};A.blockletVersion?(l==="create"||l==="new-release")&&Be.valid(A.blockletVersion)&&(A.blockletVersion=Be.inc(A.blockletVersion,"patch")):A.blockletVersion="0.0.1";const be=Ao(A,p);b(be),A.lastReleaseId||Ae()}catch(_){M.error(xe(_))}},Oe=g.useCallback(async()=>{R(!0);try{if(l==="view"){if(!J){M.error("Empty release id");return}await He(),await ze();return}await He(),J&&(z(!0),await ze())}finally{R(!1)}},[l,J]),H=_=>{b({blockletComponents:_})},ce=_=>{b({blockletResourceType:_})};g.useEffect(()=>{Oe()},[Oe]),g.useEffect(()=>{n===Q.UNOWNED_DID&&(l==="create"||l==="new-release")&&t&&Ae()},[n,t,l,Ae]),g.useEffect(()=>{d.contentType==="docker"?b({resourceFromSelect:!1}):d.contentType==="blocklet"?b({resourceFromSelect:!0}):d.contentType==="upload"&&b({resourceFromSelect:!1})},[d.contentType,b]);const Je=g.useMemo(()=>!!Object.keys(Y).find(_=>!!Y[_].length),[Y]);if(!d&&v)return e.jsx(Ye,{});if(!d)return null;const mo=ne.find(_=>_.meta.did===Te),An=_=>{O(_)};return e.jsxs(sl,{...o,children:[e.jsx(Pn,{blocklet:p,release:m,getData:Oe,getRelease:ze,mode:l,params:d,setParams:b,setParamsErrTip:x,warning:h,readOnly:ie,isPublished:Fe,loading:v,setLoading:R,initLogoUrl:w,releaseId:J,projectId:n,projectType:Qe,resourceComponents:ne,resourceComponentsMap:S,resourceRelateComponents:te,resourceItem:mo,saveSelectedEventsRef:N,hasSelectedResources:Je,releaseUsedLast:E,setReleaseUsedLast:z,setRelease:y,paramsErrTip:j}),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:C?"column":"row",children:[!C&&e.jsx(En,{steps:le,loading:v,viewMode:l==="view",params:d,hasSelectedResources:Je||d.uploadedResource,paramsErrTip:j,warning:h,activeStep:ee,setActiveStep:re,projectId:n,resourcesUrlTitle:ae,componentsUrlTitle:oe}),e.jsxs(c,{flex:"1",maxWidth:"720px",children:[!C&&ke!=="introduction"&&e.jsxs(L,{variant:"h6",fontWeight:"bold",display:"flex",flexDirection:"row",alignItems:"center",children:[Le.label,ke==="branding"&&e.jsx(je,{title:r("blocklet.publish.brandingHelp"),placement:"right",children:e.jsx(c,{component:"a",target:"_blank",href:`https://www.arcblock.io/docs/blocklet-store/${u}/blocklet-detail-page`,sx:{paddingTop:1,marginLeft:1},style:{color:"gray"},children:e.jsx(Rs,{})})})]}),(C||ke==="branding")&&e.jsx(c,{flexDirection:"column",children:e.jsx(Sn,{projectId:n,setParams:b,setParamsErrTip:x,warning:h,params:d,componentDid:a,blocklet:p,initUrl:t,loading:v,setLoading:R,paramsErrTip:j,readOnly:ie,initLogoUrl:w,setInitLogoUrl:k})}),C&&e.jsx(c,{flexDirection:"column",children:e.jsx(lt,{loading:v,params:d,paramsErrTip:j,setParams:b,setParamsErrTip:x,readOnly:ie})}),(C||ke==="introduction")&&e.jsx(c,{display:"flex",flexDirection:"column",sx:{mt:C?5:0,width:"100%"},children:e.jsx(qn,{loading:v,readOnly:ie,params:d,setParams:b,paramsErrTip:j,setParamsErrTip:x})}),C&&e.jsx(L,{variant:"h6",fontWeight:"bold",mt:5,children:le[zo.resources].label}),e.jsx(c,{sx:{maxWidth:720},display:C||ke==="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(ls,{onChange:_=>b({contentType:_.target.value}),children:[e.jsx(et,{value:"blocklet",disabled:ie,control:e.jsx(kt,{size:"small",checked:d.contentType==="blocklet"}),label:r("blocklet.publish.resourceSelect")}),e.jsx(et,{value:"upload",disabled:ie,control:e.jsx(kt,{size:"small",checked:d.contentType==="upload"}),label:r("blocklet.publish.resourceUpload")}),e.jsx(et,{value:"docker",disabled:ie,control:e.jsx(kt,{size:"small",checked:d.contentType==="docker"}),label:r("blocklet.publish.resourceDocker")})]}),e.jsxs(c,{display:d.contentType==="blocklet"?"block":"none",children:[!a&&e.jsx(sn,{tabs:Ne,current:Te,onChange:An,sx:{ml:-2,mt:2,maxWidth:C?window.innerWidth-24:"100%"}}),e.jsx(Qt,{loading:v,initialResources:P,saveSelectedEventsRef:N,selectedResourceIds:Y,setSelectedResourceIds:X,setResourceComponentsMap:q,error:j.blockletResource,app:p,readOnly:ie,component:mo,componentDid:a,initUrl:t,params:d,showTree:d.contentType==="blocklet",setParams:b,projectId:n===Q.UNOWNED_DID?"":n,releaseUsedLast:E,release:{...m,id:J}})]}),d.contentType==="upload"&&e.jsx(ho,{app:p,readOnly:ie,projectId:n===Q.UNOWNED_DID?"":n,params:d,error:j.blockletResource,setParams:b,setParamsErrTip:x}),d.contentType==="docker"&&e.jsx(fo,{app:p,readOnly:ie,projectId:n===Q.UNOWNED_DID?"":n,params:d,error:j.blockletResource,setParams:b,setParamsErrTip:x,paramsErrTip:j})]})})}),C&&e.jsx(L,{variant:"h6",fontWeight:"bold",mt:5,children:le[zo.blocklets].label}),(C||ke==="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(Ht,{projectType:Qe,disabled:v||ie,app:p,value:(d==null?void 0:d.blockletComponents)||[],blockletResourceType:(d==null?void 0:d.blockletResourceType)||"",onChange:H,onChangeBlockletResourceType:ce,resourceRelateComponents:te,dependentComponentsMode:B})})})}),!C&&ke==="version"&&e.jsx(c,{flexDirection:"column",children:e.jsx(lt,{loading:v,params:d,paramsErrTip:j,setParams:b,setParamsErrTip:x,readOnly:ie})})]})]})]})]})}bo.propTypes={initUrl:s.object};bo.defaultProps={initUrl:null};const sl=ve.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 Nn({padding:t,initUrl:o}){const{blocklet:n}=De(),l=Vn(),{componentDid:i}=ct();if(g.useEffect(()=>{if(i&&window.parent){const r=`${l.pathname}${l.search}`;window.parent.postMessage({event:"popstate",page:"publish",componentDid:i,path:r},"*")}},[i,l]),!n)return null;const a={};return t&&(a.padding=t),e.jsx(rl,{style:a,children:e.jsxs(Fn,{children:[e.jsx(jt,{path:"/",element:e.jsx(Ut,{initUrl:o})}),e.jsx(jt,{path:"/:projectId",element:e.jsx(tr,{})}),e.jsx(jt,{path:"/:projectId/:mode/:releaseId",element:e.jsx(bo,{initUrl:o})})]})})}Nn.propTypes={padding:s.oneOfType([s.string,s.number]),initUrl:s.object};Nn.defaultProps={padding:"",initUrl:null};const rl=ve(c)`
238
+ a {
239
+ color: ${({theme:t})=>t.palette.primary.main};
240
+ }
241
+ `;export{Nn as default};
@@ -0,0 +1,4 @@
1
+ import{j as t,ab as S,aa as c,H as d,ah as g}from"./vendor-mui-core-Bh-qMRq3.js";import{r as y}from"./vendor-react-DEoibe3W.js";import{b1 as v,C as w,B as m}from"./vendor-ux-did-connect-Ck9lzrbN.js";import{P}from"./page-header-DpNvpd52.js";import{C as T}from"./index-DRCFOq4H.js";import{u as B}from"./config-space-D1h9DQze.js";import{C as E,D as b,a as D}from"./connect-to-DrS33AaQ.js";import{S as u}from"./step-actions-Btu6D6gk.js";import{S as N}from"./layout-Bs_rMuQ9.js";import"./vendor-utils-rHXShPKm.js";import"./vendor-hooks-Zkb4Ilbj.js";import"./lottie-web-jYmAQWuC.js";import"./vendor-arcblock-DPRICUXM.js";import"./spaces-DMMN97uo.js";import"./api-BjteVZFg.js";import"./index-8eXqqyHQ.js";import"./DeleteOutline-BEGOj_wq.js";import"./use-mobile-JEGQfLZ2.js";import"./content-layout--sy9JlYZ.js";function l({onNext:a,onPrevious:x}){var n,r,p;const{t:i}=y.useContext(v),{blocklet:e}=T(),{spaceGateway:f,settingStorageEndpoint:C,updateSpaceGateway:j,hasStorageEndpoint:h,loading:o,storageEndpoint:s}=B();return o?t.jsx(w,{relative:"parent",children:t.jsx(S,{})}):t.jsxs(G,{children:[t.jsx("div",{className:"header",children:t.jsx(P,{title:i("setup.didSpace.title"),subTitle:i("setup.didSpace.subTitle"),onClickBack:x})}),t.jsx(c,{sx:{width:"100%",maxWidth:"720px"},children:h?t.jsx(E,{spaceGateway:f,settingStorageEndpoint:C}):t.jsx(b,{})}),((n=e==null?void 0:e.capabilities)==null?void 0:n.didSpace)&&t.jsx(c,{display:"flex",alignItems:"center",justifyContent:"center",paddingTop:"24px",children:t.jsx(D,{onConnect:j,storageEndpoint:s})}),((r=e==null?void 0:e.capabilities)==null?void 0:r.didSpace)==="required"&&t.jsx(u,{mt:8,children:t.jsx(m,{loading:o,variant:"contained",disabled:o||!s,onClick:()=>a(),children:i("setup.continue")})}),((p=e==null?void 0:e.capabilities)==null?void 0:p.didSpace)==="optional"&&t.jsx(u,{blocklet:e,onStartNow:()=>a("complete"),children:t.jsx(m,{className:"start-now",loading:o,variant:"contained",disabled:o,onClick:()=>a(),children:i(s?"setup.continue":"setup.skip")})})]})}l.propTypes={onNext:d.func,onPrevious:d.func};l.defaultProps={onNext:()=>{},onPrevious:()=>{}};const G=g(N)`
2
+ height: 100%;
3
+ overflow-y: auto;
4
+ `;export{l as default};