@abtnode/blocklet-services 1.16.43-beta-20250424-125523-08a65a5c → 1.16.43-beta-20250425-130658-8da18f4d

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 (203) hide show
  1. package/api/routes/user-session.js +5 -5
  2. package/api/routes/user.js +2 -2
  3. package/api/services/auth/session.js +23 -35
  4. package/api/util/attach-shared-utils.js +2 -2
  5. package/dist/assets/{AdapterDayjs-DT-SVlwP.js → AdapterDayjs-6a0bjomM.js} +1 -1
  6. package/dist/assets/{ArrowDropDown-D0s0w2rW.js → ArrowDropDown-DiAXbLgf.js} +1 -1
  7. package/dist/assets/{CheckCircle-BMPTHnwd.js → CheckCircle-BOBzbtP2.js} +1 -1
  8. package/dist/assets/{ChevronLeft-BV65HBup.js → ChevronLeft-JDNo_7RB.js} +1 -1
  9. package/dist/assets/{ChevronRight-CSrWhu1k.js → ChevronRight-Cfe-QLJe.js} +1 -1
  10. package/dist/assets/{Community-B6sqs6QK.js → Community-DZCTPNMP.js} +1 -1
  11. package/dist/assets/{DeleteOutline-BwlJCwaD.js → DeleteOutline-DW9Kk9LF.js} +1 -1
  12. package/dist/assets/{Done-ClKUqna8.js → Done-CAPpWSLt.js} +1 -1
  13. package/dist/assets/{Download-DydXtD3g.js → Download-BFPjDYTH.js} +1 -1
  14. package/dist/assets/{Edit-Cydc64DB.js → Edit-D6qkTeBz.js} +1 -1
  15. package/dist/assets/{EditIcon-B3vzcBhw.js → EditIcon-Bi2cR-_u.js} +1 -1
  16. package/dist/assets/{Email-DscM5ZVr.js → Email-Dz2Eyqu0.js} +1 -1
  17. package/dist/assets/{Error-BUxloyCF.js → Error-SwROBcf8.js} +1 -1
  18. package/dist/assets/{ExpandLess-D3psCjh2.js → ExpandLess-BpA2naWp.js} +1 -1
  19. package/dist/assets/{Google-nw2S1BAe.js → Google-C5jm8HrI.js} +1 -1
  20. package/dist/assets/{Holiday-COvP72sQ.js → Holiday-Lc6woG1j.js} +1 -1
  21. package/dist/assets/{InfoOutlined-K2cm3ASV.js → InfoOutlined-B-fGWta1.js} +1 -1
  22. package/dist/assets/{Launch-DSlNzUJo.js → Launch-GqtcaQf1.js} +1 -1
  23. package/dist/assets/{LaunchOutlined-DB41H1FZ.js → LaunchOutlined-D7W2P0hG.js} +1 -1
  24. package/dist/assets/{Location-DSdE-EW4.js → Location-B8EOY3d0.js} +1 -1
  25. package/dist/assets/{LockIcon-Yic1ETPw.js → LockIcon-fuTfhB_G.js} +1 -1
  26. package/dist/assets/{Meeting-DlfumstQ.js → Meeting-Epdyx36z.js} +1 -1
  27. package/dist/assets/{MoreHoriz-BWdkQIhx.js → MoreHoriz-3W8Fr_ZL.js} +1 -1
  28. package/dist/assets/{OffSick-CG2hJbSq.js → OffSick-VYgugWxu.js} +1 -1
  29. package/dist/assets/{Phone-DkIl-1KJ.js → Phone-KP65huHK.js} +1 -1
  30. package/dist/assets/{PlayArrow-DfQEcw-G.js → PlayArrow-Cja7S4vv.js} +1 -1
  31. package/dist/assets/{QuestionMarkCircle-TVw9KuLr.js → QuestionMarkCircle-p6m3avKp.js} +1 -1
  32. package/dist/assets/{ServerLogo-DQ3yw9lw.js → ServerLogo-Bssx1Eou.js} +1 -1
  33. package/dist/assets/{Timezone-B77bSXNW.js → Timezone-Ce4E1Xey.js} +1 -1
  34. package/dist/assets/{TuneOutlined-8KrrUCQF.js → TuneOutlined-B3W8vgdw.js} +1 -1
  35. package/dist/assets/{ViewList-Bql1EC1c.js → ViewList-BRsEAVjL.js} +1 -1
  36. package/dist/assets/{WorkingRemotely-DNUERtUR.js → WorkingRemotely-CXFJ6pz8.js} +1 -1
  37. package/dist/assets/{access-control-Bcd_n74E.js → access-control-hoDAWTTL.js} +1 -1
  38. package/dist/assets/{actions-f0wKxzR1.js → actions-BPVh6JdI.js} +1 -1
  39. package/dist/assets/{add-component-core-BUAlsG4_.js → add-component-core-BXXPrLkI.js} +1 -1
  40. package/dist/assets/{add-resource-Djfsmv61.js → add-resource-DSoZMbAG.js} +1 -1
  41. package/dist/assets/{addon-BkBy38_b.js → addon-CY4PNd8X.js} +1 -1
  42. package/dist/assets/{advanced-BPM38tnR.js → advanced-BV9dnonO.js} +1 -1
  43. package/dist/assets/{appearance-DUNDV_8X.js → appearance-DbKPqE0i.js} +1 -1
  44. package/dist/assets/{ar-wbCXBm9M.js → ar-CmhpkjwX.js} +1 -1
  45. package/dist/assets/{ar-BNaEJSr3.js → ar-mN5tHF4O.js} +1 -1
  46. package/dist/assets/{audit-logs-ClIsZeWB.js → audit-logs-CY7CyxpG.js} +1 -1
  47. package/dist/assets/{authorize-Czqr5dx0.js → authorize-CLUD6O4F.js} +1 -1
  48. package/dist/assets/{base32-CXHhcaAE.js → base32-bFQC4m_a.js} +1 -1
  49. package/dist/assets/{branding-CDVXldZI.js → branding-LKt9TBDZ.js} +1 -1
  50. package/dist/assets/{branding-Dr6iifVv.js → branding-psyKu6rz.js} +2 -2
  51. package/dist/assets/{bundle-avatar-CXZCyfoQ.js → bundle-avatar-CNkSW5-i.js} +1 -1
  52. package/dist/assets/button-BXbVAdLT.js +1 -0
  53. package/dist/assets/{click-to-copy-CYn1U-tf.js → click-to-copy-CSwrPBKm.js} +1 -1
  54. package/dist/assets/{complete-C-F4GC22.js → complete-B8igFASe.js} +1 -1
  55. package/dist/assets/{component-DsEe2qX3.js → component-RJz0SwId.js} +1 -1
  56. package/dist/assets/{config-DYPbZpg_.js → config-C2EcTJzj.js} +1 -1
  57. package/dist/assets/{config-A_My2cMO.js → config-CqUiFvo_.js} +1 -1
  58. package/dist/assets/{config-navigation-Bi-pxL5K.js → config-navigation-D8u4Wwi0.js} +3 -3
  59. package/dist/assets/{config-space-DVjhjgJC.js → config-space-BytYjhBd.js} +1 -1
  60. package/dist/assets/{confirm-BshZuFnD.js → confirm-qekNSA6N.js} +1 -1
  61. package/dist/assets/{connect-BPsVsyF2.js → connect-BPW0KY4c.js} +1 -1
  62. package/dist/assets/{connect-DQxK32G8.js → connect-DZqNlu4F.js} +1 -1
  63. package/dist/assets/{connect-to-DXXf0Nkb.js → connect-to-BcxM4POV.js} +1 -1
  64. package/dist/assets/{content-layout-AHDEW7YQ.js → content-layout-BPaAeaMQ.js} +1 -1
  65. package/dist/assets/{dashboard-CCzZLCC4.js → dashboard-DrtJT0zg.js} +3 -3
  66. package/dist/assets/{de-BsZVQmUM.js → de-BP5gdcKp.js} +1 -1
  67. package/dist/assets/{de-8GAnQkrt.js → de-Doy9B4I7.js} +1 -1
  68. package/dist/assets/{delete-confirm-DuoSMgmG.js → delete-confirm-DEV7zNkl.js} +1 -1
  69. package/dist/assets/{did-address-Cg-ez88b.js → did-address-DZ4aPkg2.js} +1 -1
  70. package/dist/assets/domain-CcBq0Tmt.js +9 -0
  71. package/dist/assets/domain-action-card-B5PD8_Bw.js +24 -0
  72. package/dist/assets/domains-CGsSPrGB.js +1 -0
  73. package/dist/assets/{dot-tsWWWiOg.js → dot-BE1YP292.js} +1 -1
  74. package/dist/assets/{email-DWoydsl3.js → email-BWcxSNWH.js} +1 -1
  75. package/dist/assets/{empty-spinner-D_1iEwTc.js → empty-spinner-DmDm8XzF.js} +1 -1
  76. package/dist/assets/{es-ntlJbt-a.js → es-CBFvWN06.js} +1 -1
  77. package/dist/assets/{es-DsjXdm2X.js → es-CruF8tDk.js} +1 -1
  78. package/dist/assets/{exchange-passport-DysHnVpr.js → exchange-passport-Bw0lAjY5.js} +1 -1
  79. package/dist/assets/{fr-B-64BlVz.js → fr-Bajh_D8H.js} +1 -1
  80. package/dist/assets/{fr-Bv4B0MVB.js → fr-CmHa1dCv.js} +1 -1
  81. package/dist/assets/{fuel-TLPi2Hr-.js → fuel-DBFO1voi.js} +1 -1
  82. package/dist/assets/{gen-access-key-D4caSeDS.js → gen-access-key-BW8kZ1Xs.js} +1 -1
  83. package/dist/assets/{get-safe-url-Bz4L9R5-.js → get-safe-url-BZgGKuU5.js} +1 -1
  84. package/dist/assets/{get-safe-url-Dex6FTwp.js → get-safe-url-C0AtthsC.js} +1 -1
  85. package/dist/assets/hi-CWyDCXYI.js +5 -0
  86. package/dist/assets/{hi-CY-kyCxp.js → hi-DOsApYK0.js} +1 -1
  87. package/dist/assets/{home-CBFACtB_.js → home-CTPoo1SY.js} +1 -1
  88. package/dist/assets/{id-DZBgOnwF.js → id-3xH3q-wr.js} +1 -1
  89. package/dist/assets/{id-BT_84X-S.js → id-BderyGO5.js} +1 -1
  90. package/dist/assets/{iframe-B4jzt2b3.js → iframe--qNemH7W.js} +1 -1
  91. package/dist/assets/{index-BG5LYRZd.js → index-BT0GBmWF.js} +1 -1
  92. package/dist/assets/index-BUb5Yjs_.js +224 -0
  93. package/dist/assets/{index-DomukIqT.js → index-BoJFRi1m.js} +1 -1
  94. package/dist/assets/index-BtWj67HV.js +99 -0
  95. package/dist/assets/{index-CGe7n5Gc.js → index-BvQykj-W.js} +2 -2
  96. package/dist/assets/{index-NRj7GpkA.js → index-C5yNf__V.js} +1 -1
  97. package/dist/assets/{index-CVvs-hHV.js → index-CGJUebpH.js} +15 -15
  98. package/dist/assets/{index-BowdADDJ.js → index-CHbpkZwO.js} +1 -1
  99. package/dist/assets/{index-MbAvBCGD.js → index-COd4R-rR.js} +1 -1
  100. package/dist/assets/{index-3r4UtN8A.js → index-CXuahOvP.js} +1 -1
  101. package/dist/assets/{index-BXkEM7e9.js → index-CY6pLbAD.js} +1 -1
  102. package/dist/assets/{index-ARVZ7FJv.js → index-Ci9HJ6Iv.js} +1 -1
  103. package/dist/assets/{index-DPpP2Hz6.js → index-CnjT4Zv0.js} +1 -1
  104. package/dist/assets/{index-B0-4M8vb.js → index-D5iB7faJ.js} +1 -1
  105. package/dist/assets/{index-Cks6t9cs.js → index-DKhrYmrN.js} +1 -1
  106. package/dist/assets/{index-DO1hKTlI.js → index-DLBv7Dtg.js} +1 -1
  107. package/dist/assets/{index-C3f1mXja.js → index-DS-sLY6b.js} +3 -3
  108. package/dist/assets/{index-CU8fxqsS.js → index-Dv_p9rOk.js} +1 -1
  109. package/dist/assets/{index-Bdp7LpPc.js → index-SDdS_qt8.js} +1 -1
  110. package/dist/assets/{index-CSARD20E.js → index-d728JwfZ.js} +1 -1
  111. package/dist/assets/{index-BplAimRX.js → index-eeIdp1fF.js} +2 -2
  112. package/dist/assets/{index-DKq7-33g.js → index-lI6b97z3.js} +2 -2
  113. package/dist/assets/{index-BOEhBltr.js → index-u9S0L-Rf.js} +1 -1
  114. package/dist/assets/{invitation-7bE4cIXB.js → invitation-DRfkSNu9.js} +1 -1
  115. package/dist/assets/{invite-COQN-rNg.js → invite-t5XgIivH.js} +1 -1
  116. package/dist/assets/{issue-passport-11S7tmQW.js → issue-passport-Cn04_O-m.js} +1 -1
  117. package/dist/assets/{item-BeeQ2vgS.js → item-cpKk__48.js} +1 -1
  118. package/dist/assets/{ja-BMmtgJml.js → ja-99RIjwwl.js} +1 -1
  119. package/dist/assets/{ja-8jRYJGVw.js → ja-Dlm9gbED.js} +1 -1
  120. package/dist/assets/{ko-ChmGYnnx.js → ko-8oFi6wHH.js} +1 -1
  121. package/dist/assets/{ko-C4pbuwv8.js → ko-JYKwx9PY.js} +1 -1
  122. package/dist/assets/{landing-page-DfhVYZ3b.js → landing-page-CaOceQxT.js} +1 -1
  123. package/dist/assets/{launch-result-message-CCo4xyOd.js → launch-result-message-C9huWJUf.js} +1 -1
  124. package/dist/assets/{layout-DToDlHEw.js → layout-DTFm6q61.js} +1 -1
  125. package/dist/assets/{list-ChvGKHw5.js → list-CMmXasDM.js} +1 -1
  126. package/dist/assets/{list-header-C7I2nEkf.js → list-header-CgF1S4js.js} +1 -1
  127. package/dist/assets/localization-Bp5pyrsz.js +1 -0
  128. package/dist/assets/{log-DwhNr5TA.js → log-CYW8Ap44.js} +1 -1
  129. package/dist/assets/{logger-DwVuCvCH.js → logger-BbYYsfRo.js} +1 -1
  130. package/dist/assets/{login-_FUfsuwA.js → login-GHsnMk-9.js} +1 -1
  131. package/dist/assets/{login-oauth-callback-BfAWMSC0.js → login-oauth-callback-B2HyhVt7.js} +1 -1
  132. package/dist/assets/{logo-uploader-CYJXgjdA.js → logo-uploader-ly-3UjHj.js} +3 -3
  133. package/dist/assets/{lost-passport-bl0QaFCp.js → lost-passport-BduGI9L4.js} +1 -1
  134. package/dist/assets/{open-window-BTH_1q7i.js → open-window-Cw3Ugf66.js} +1 -1
  135. package/dist/assets/{overview-D4gQwSex.js → overview-C101Lhxl.js} +1 -1
  136. package/dist/assets/{page-header-DWEFpJCI.js → page-header-Bk-0dymm.js} +1 -1
  137. package/dist/assets/{passport-item-Z9x6DkU5.js → passport-item-BUfjEppi.js} +1 -1
  138. package/dist/assets/{permission-CDRSpazM.js → permission-C_VicyW0.js} +1 -1
  139. package/dist/assets/{preferences-Dck4NebC.js → preferences-C_nxZvVu.js} +1 -1
  140. package/dist/assets/{profile-embed-CJdf2c_q.js → profile-embed-CgXxt11D.js} +1 -1
  141. package/dist/assets/pt-BgyGyT44.js +5 -0
  142. package/dist/assets/{pt-DjThuHre.js → pt-ChXuTrrd.js} +1 -1
  143. package/dist/assets/publish-resource-DBfSpWOt.js +1 -0
  144. package/dist/assets/{react-beautiful-dnd.esm-CP-WHcip.js → react-beautiful-dnd.esm-kaYRX6nt.js} +1 -1
  145. package/dist/assets/{relative-time-4f6xdgg-.js → relative-time-CuIhVa08.js} +1 -1
  146. package/dist/assets/ru-CEVWIKf9.js +5 -0
  147. package/dist/assets/{ru-CI1dkyMC.js → ru-IkTTTY0K.js} +1 -1
  148. package/dist/assets/{runtime-r0b7mSwp.js → runtime-Pqx3AapT.js} +1 -1
  149. package/dist/assets/sdk-guHRt_DC.js +1 -0
  150. package/dist/assets/{security-CLc8EI2b.js → security-BSs6l8nY.js} +4 -4
  151. package/dist/assets/{session-CmpGpqja.js → session-BoLXmmdy.js} +1 -1
  152. package/dist/assets/{setup-C0tLi0hm.js → setup-BK8QRxSP.js} +3 -3
  153. package/dist/assets/{shorten-label-CE57Fd6E.js → shorten-label-DFzv9EKX.js} +1 -1
  154. package/dist/assets/{simple-select-rdkVpCfB.js → simple-select-DlrdVbaI.js} +1 -1
  155. package/dist/assets/{slicedToArray-BBoi0da6.js → slicedToArray-CPl5_eGD.js} +1 -1
  156. package/dist/assets/{spaces-Cf25Nw85.js → spaces-FInvGagn.js} +1 -1
  157. package/dist/assets/{start-CrRC75qe.js → start-e5k6uJu1.js} +1 -1
  158. package/dist/assets/{status-BSBLuo2u.js → status-uX3_TUfC.js} +1 -1
  159. package/dist/assets/{step-actions-YXGJQMCB.js → step-actions-5JhpbsMf.js} +1 -1
  160. package/dist/assets/{studio-wUJ0pUIv.js → studio-gQoPFCFH.js} +1 -1
  161. package/dist/assets/{switch-control-D0bd_WCg.js → switch-control-1DAS0xgi.js} +1 -1
  162. package/dist/assets/{th-4Bnumejd.js → th-OF8xr--T.js} +1 -1
  163. package/dist/assets/th-y94pKVk7.js +5 -0
  164. package/dist/assets/{traffic-BhA3A82Z.js → traffic-CLSnYOIK.js} +1 -1
  165. package/dist/assets/{transfer-BmP7JwN2.js → transfer-Dh9v20QV.js} +1 -1
  166. package/dist/assets/{unsubscribe-zK0TSWH3.js → unsubscribe-BiCDicGU.js} +1 -1
  167. package/dist/assets/{use-app-logo-DAnHvb1d.js → use-app-logo-Cc5WhrJy.js} +1 -1
  168. package/dist/assets/{use-mobile-CwehvZ0f.js → use-mobile-C_flBrm-.js} +1 -1
  169. package/dist/assets/{use-mobile-KRs0Yv73.js → use-mobile-DlKplWTG.js} +1 -1
  170. package/dist/assets/{useLocalStorage-CNdV3Qx_.js → useLocalStorage-BxIzITf9.js} +1 -1
  171. package/dist/assets/{user-center-CTXkd8hW.js → user-center-1qavaXbB.js} +1 -1
  172. package/dist/assets/{util-DrL3FFCf.js → util-BrciyiqD.js} +1 -1
  173. package/dist/assets/util-Ce3AQBfV.js +1 -0
  174. package/dist/assets/{vendor-arcblock-JGYMkSwE.js → vendor-arcblock-BUng-RXZ.js} +4 -4
  175. package/dist/assets/{vendor-mui-core-8zafwTFh.js → vendor-mui-core-CQ38ohp2.js} +20 -20
  176. package/dist/assets/{vendor-mui-x-Df6DxoLi.js → vendor-mui-x-B0hsmEJ3.js} +1 -1
  177. package/dist/assets/{vendor-ux-did-connect-D2f9rdKK.js → vendor-ux-did-connect-CsNUdA6Y.js} +4 -4
  178. package/dist/assets/{vi-Bc6q0tph.js → vi-DCBJBc4G.js} +1 -1
  179. package/dist/assets/vi-Dw7W2UPp.js +5 -0
  180. package/dist/assets/wrap-locale-Bc5OA7-R.js +1 -0
  181. package/dist/assets/{zh-_GYrLCB8.js → zh-BRAYg0sY.js} +1 -1
  182. package/dist/assets/{zh-DZlGQAU9.js → zh-Dag6w2Z7.js} +1 -1
  183. package/dist/assets/{zh-tw-Be5lgYGX.js → zh-tw-CMYkmBeh.js} +1 -1
  184. package/dist/assets/{zh-tw-CLcDyLaC.js → zh-tw-D5-DkgwC.js} +1 -1
  185. package/dist/index.html +4 -4
  186. package/dist/service-worker.js +1 -1
  187. package/package.json +29 -29
  188. package/dist/assets/button-n0UOGLKx.js +0 -1
  189. package/dist/assets/domain-B57opALw.js +0 -9
  190. package/dist/assets/domain-action-card-DGNzWGpO.js +0 -24
  191. package/dist/assets/domains-DSFXU6AI.js +0 -1
  192. package/dist/assets/hi-DIf_hqVB.js +0 -5
  193. package/dist/assets/index-Birdle6P.js +0 -224
  194. package/dist/assets/index-DEAA6iri.js +0 -92
  195. package/dist/assets/localization-DfJCYesK.js +0 -1
  196. package/dist/assets/pt-CMeQ7KWn.js +0 -5
  197. package/dist/assets/publish-resource-CaRrvCS8.js +0 -1
  198. package/dist/assets/ru-8cWKcW3b.js +0 -5
  199. package/dist/assets/sdk-fuEXLKzh.js +0 -1
  200. package/dist/assets/th-DYYGBboI.js +0 -5
  201. package/dist/assets/util-C4Ha7L5d.js +0 -1
  202. package/dist/assets/vi-CfH0km8q.js +0 -5
  203. package/dist/assets/wrap-locale-5dMXj7tV.js +0 -1
@@ -0,0 +1,224 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-DS-sLY6b.js","assets/vendor-ux-did-connect-CsNUdA6Y.js","assets/vendor-react-DEoibe3W.js","assets/vendor-utils-BNHJB5U7.js","assets/vendor-mui-core-CQ38ohp2.js","assets/vendor-hooks-DftG_2gV.js","assets/lottie-web-jYmAQWuC.js","assets/vendor-ux-did-connect-DpSGLE7B.css","assets/vendor-arcblock-BUng-RXZ.js","assets/index-YbJjfDTR.js","assets/index-CGJUebpH.js","assets/index-B1ljmpu4.css","assets/index-DVQCgvFb.js","assets/index-AgKpYdvC.css"])))=>i.map(i=>d[i]);
2
+ import{r as x,f as Tt,l as ct,L as ke,g as Wn,u as Mn,i as Un,j as jt}from"./vendor-react-DEoibe3W.js";import{a8 as we,j as e,v as We,a9 as c,bc as Pt,H as s,ac as je,I as ce,T as E,c4 as Oo,D as at,ag as ye,at as Vn,bS as Ke,aj as dt,bs as et,bw as tt,y as K,aa as Re,P as Bo,G as Wo,w as _t,a6 as Mo,M as Uo,q as fe,X as Fn,ai as Vo,t as Fo,bV as Hn,N as Je,z as Ho,O as ne,ak as ve,as as Go,L as Jo,A as $t,b5 as Xo,bK as Yo,bx as Gn,e as Jn,ap as Xn,b$ as Yn,ae as Qn,U as Qo,W as ot,bF as Zn,bG as Kn,c5 as es,c6 as ts,bn as Ct,bo as os,bq as ns,bu as ss,bv as kt}from"./vendor-mui-core-CQ38ohp2.js";import{z as ge,C as Se,af as rs,a7 as ls,f as yo,ag as vo,ab as is}from"./index-CGJUebpH.js";import{r as De,j as Y,u as Q,bt as Zo,f as cs,B as qe,b6 as Ko,V as en,b4 as tn,an as as,bu as ds,a5 as qt,Y as W,a1 as us,I as ae,bv as ps,b9 as hs,a as Be,al as ut,b5 as fs,ar as on}from"./vendor-ux-did-connect-CsNUdA6Y.js";import{K as pt,c as he,q as ms,P as bs,_ as nn,Q as $e,p as xs}from"./vendor-arcblock-BUng-RXZ.js";import{d as gs}from"./Error-SwROBcf8.js";import{C as ht}from"./confirm-qekNSA6N.js";import{u as Ue}from"./session-BoLXmmdy.js";import{W as wt}from"./did-address-DZ4aPkg2.js";import{E as Xe}from"./empty-spinner-DmDm8XzF.js";import{B as Et}from"./bundle-avatar-CNkSW5-i.js";import{S as Ce}from"./shorten-label-DFzv9EKX.js";import{L as Lt}from"./list-header-CgF1S4js.js";import{Z as js,y as de,I as Nt,D as sn}from"./vendor-utils-BNHJB5U7.js";import{d as ks}from"./Download-BFPjDYTH.js";import{C as rn}from"./click-to-copy-CSwrPBKm.js";import{Q as ys}from"./QuestionMarkCircle-p6m3avKp.js";import{u as vs}from"./vendor-hooks-DftG_2gV.js";import{_ as _e}from"./useSetState-CWq0AVWn.js";import{c as At}from"./index-DVQCgvFb.js";import{E as zt}from"./index-DKhrYmrN.js";import"./api-BrU7j0QA.js";import{d as Rs}from"./ChevronRight-Cfe-QLJe.js";import{T as Cs,a as ws}from"./vendor-mui-x-B0hsmEJ3.js";import{d as nt}from"./DeleteOutline-DW9Kk9LF.js";import{D as Ro,C as Co,P as wo}from"./react-beautiful-dnd.esm-kaYRX6nt.js";import{c as Ss,A as ln,u as cn,S as Ds,a as Is,b as Ts,e as Ps,U as _s,f as yt,g as an,n as $s,h as qs,i as So,k as Es,l as Ls}from"./item-cpKk__48.js";import{d as Ns}from"./ArrowDropDown-DiAXbLgf.js";import{f as xe}from"./format-error-BrmqJs5a.js";import{d as dn}from"./Launch-GqtcaQf1.js";import{d as un}from"./Done-CAPpWSLt.js";import{D as As}from"./delete-confirm-DEV7zNkl.js";import{g as pn}from"./get-safe-url-BZgGKuU5.js";import{M as zs}from"./index-CHbpkZwO.js";import{r as Os}from"./index-SDdS_qt8.js";import"./lottie-web-jYmAQWuC.js";import"./raf-schd.esm-B3j6BePR.js";var Ot={},Bs=we;Object.defineProperty(Ot,"__esModule",{value:!0});var hn=Ot.default=void 0,Ws=Bs(De()),Ms=e;hn=Ot.default=(0,Ws.default)((0,Ms.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 Bt={},Us=we;Object.defineProperty(Bt,"__esModule",{value:!0});var fn=Bt.default=void 0,Vs=Us(De()),Fs=e;fn=Bt.default=(0,Vs.default)((0,Fs.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 Wt={},Hs=we;Object.defineProperty(Wt,"__esModule",{value:!0});var mn=Wt.default=void 0,Gs=Hs(De()),Js=e;mn=Wt.default=(0,Gs.default)((0,Js.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=`${`${Y.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${t}/${o}/logo/upload`}/${l}`,[u,a]=x.useState(!1),f=We(b=>b.breakpoints.down("md"));return e.jsxs(c,{sx:{display:"flex",flexDirection:"row",color:u?"primary.main":"grey.900",gap:1},onPointerEnter:()=>a(!0),onPointerLeave:()=>a(!1),children:[e.jsx(Pt,{sx:{borderRadius:1},src:r}),e.jsxs(c,{children:[e.jsx(Ce,{hiddenTip:!0,maxLength:"24",sx:{fontSize:"14px",fontWeight:"500",color:f?"primary.main":""},children:n||"/"}),e.jsx(Ce,{hiddenTip:!0,maxLength:"58",sx:{fontSize:"12px",color:f||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}=Q(),{api:d}=ge(),{api:r}=Ue(),[u,a]=x.useState(!0),{blocklet:f}=Se(),[b,j]=x.useState(null),[y,h]=x.useState(!1),p=We(S=>S.breakpoints.down("xl")),v=We(S=>S.breakpoints.down("md")),{componentDid:C=""}=ct(),[m,k]=x.useState(null),w=`publish-${f.meta.did}`,T=Zo(w),[P,I]=x.useState({searchText:T.searchText||"",pageSize:T.rowsPerPage||10,page:1}),L=()=>{d.getProjects({input:{did:f.meta.did,componentDid:C,tenantScope:n}}).then(S=>{const A=(S==null?void 0:S.projects)||[];a(!1),k(A)}).catch(S=>{a(!1),W.error(S.message)})},z=()=>{o(`${Y.UNOWNED_DID}/create/none`,{replace:!0})},q=S=>{j(S)},Z=()=>{a(!1),h(!0)},U=()=>{h(!1),j(null)},R=S=>{W.error(S.message),h(!1),j(null)},g=S=>{if(!(S!=null&&S.deleted)){W.error("Delete project failed");return}L(),h(!1),j(null)};x.useEffect(()=>{L()},[]);const D=x.useMemo(()=>{var A;if(!P.searchText)return m;let S=(A=P.searchText)==null?void 0:A.trim();return S?(S=cs.toAddress(S).toLocaleLowerCase(),m.filter(H=>H.blockletTitle.toLowerCase().includes(S)||H.blockletDid.toLowerCase().includes(S))):m},[m,P.searchText]);if(!m&&u)return e.jsx(c,{sx:{display:"flex",justifyContent:"center",alignItems:"center",marginTop:"40px"},children:e.jsx(Xe,{})});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(qe,{onClick:z,variant:"contained",children:l("blocklet.publish.createBlocklet")})]});const M=[{label:"Blocklet",name:"blockletTitle",minWidth:160,options:{customBodyRenderLite:S=>{const A=m[S];return e.jsx(ke,{to:`${A.id}`,children:e.jsx(Mt,{did:f.meta.did,projectId:A.id,logo:A.blockletLogo,title:A.blockletTitle,describe:A.blockletDescription})})}}},{label:"Version",name:"blockletVersion",options:{searchable:!1,customBodyRender:S=>S?e.jsx(Ko,{type:"success",children:S}):""}},{label:"DID",name:"blockletDid",options:{customBodyRender:S=>S?e.jsx(wt,{size:14,compact:!0,responsive:!1,did:S}):null}},p||C?null:{label:l("common.createdBy"),name:"createdBy",options:{customBodyRender:S=>S?e.jsx(wt,{onClick:()=>{o(`/.well-known/service/admin/members?did=${S}`)},style:{cursor:"pointer"},size:14,compact:!0,copyable:!1,showQrcode:!1,responsive:!1,did:S}):null}},p||C?null:{label:l("common.scope"),name:"componentDid",options:{customBodyRender:S=>{const A=(f.children||[]).find(H=>H.meta.did===S);return A?e.jsxs(c,{display:"flex",alignItems:"center",justifyContent:"flex-start",children:[e.jsx(Et,{size:14,blocklet:A,ancestors:[f]}),e.jsx(c,{ml:.5,sx:{ml:.5,color:"text.primary",fontSize:14},children:A.meta.title})]},S):""}}},p||n?null:{label:l("blocklet.publish.tenantScope"),name:"tenantScope",options:{customBodyRender:S=>e.jsx(c,{ml:.5,sx:{ml:.5,color:"text.primary",fontSize:14},children:e.jsx(Ce,{children:S})})}},{label:l("common.updatedAt"),name:"updatedAt",options:{searchable:!1,customBodyRender:S=>e.jsx(en,{value:Number(S),locale:i})}},{label:l("common.actions"),name:"actions",options:{searchable:!1,customBodyRenderLite:S=>{const A=m[S];return e.jsxs(c,{display:"flex",children:[e.jsx(ke,{to:`${A.id}/new-release/${A.lastReleaseId}`,children:e.jsx(je,{title:l("blocklet.publish.createRelease"),placement:"top",children:e.jsx(ce,{color:"primary","aria-label":"create",children:e.jsx(hn,{style:{fontSize:18}})})})}),!!A.lastReleaseId&&e.jsx(je,{title:l("blocklet.publish.viewLastRelease",{name:A.blockletTitle}),placement:"top",children:e.jsx(ce,{color:"secondary","aria-label":"create",children:e.jsx(ke,{style:{display:"flex"},to:`${A.id}/view/${A.lastReleaseId}`,children:e.jsx(fn,{sx:{fontSize:18}})})})}),e.jsx(je,{title:l("blocklet.publish.delete",{name:A.blockletTitle}),placement:"top",children:e.jsx(ce,{color:"primary","aria-label":"delete",onClick:()=>q(A),children:e.jsx(tn,{sx:{fontSize:18}})})})]})}}}].filter(Boolean),O=({page:S,rowsPerPage:A,searchText:H})=>{P.pageSize!==A?I(J=>({...J,searchText:"",pageSize:A,page:1})):P.page!==S+1?I(J=>({...J,searchText:"",page:S+1})):P.searchText!==H&&I(J=>({...J,searchText:H,page:1}))},G=y?e.jsx(as,{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:g,onError:R,extraParams:{projectId:b.id,did:f.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(c,{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(mn,{sx:{opacity:.6,fontSize:"1.1em",ml:1}})})]}),actions:e.jsxs(e.Fragment,{children:[e.jsx(ds,{options:{searchPlaceholder:l("blocklet.list.searchPlaceholder"),searchDebounceTime:600,searchAlwaysOpen:v},search:P.searchText,searchText:P.searchText,searchTextUpdate:S=>I(A=>({...A,searchText:S})),searchClose:()=>I(S=>({...S,searchText:""})),onSearchOpen:()=>{}}),e.jsxs(qe,{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:D,columns:M,options:{search:!1,sort:!1,download:!1,filter:!1,print:!1,viewColumns:!1,searchAlwaysOpen:!0,rowsPerPageOptions:[10,20,50,100]},durable:w,onChange:O}),b&&e.jsx(ht,{title:`${l("common.delete")} ${b.blockletTitle}`,description:l("blocklet.publish.deleteProject.description"),confirm:l("common.confirm"),onConfirm:Z,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(S=>e.jsxs(c,{sx:{display:"flex",marginTop:1,flexDirection:"row",alignItems:"flex-start"},children:[e.jsx(gs,{color:"warning",sx:{marginRight:1,fontSize:20,marginTop:"2px"}}),e.jsx(E,{component:"span",variant:"inherit",color:"text.secondary",children:S})]}))})}),G]})}Ut.propTypes={initUrl:s.object};Ut.defaultProps={initUrl:null};var Vt={},Xs=we;Object.defineProperty(Vt,"__esModule",{value:!0});var bn=Vt.default=void 0,Ys=Xs(De()),Do=e;bn=Vt.default=(0,Ys.default)([(0,Do.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,Do.jsx)("path",{d:"m17 14 5-5-1.41-1.41L18 10.17V3h-2v7.17l-2.59-2.58L12 9z"},"1")],"InstallDesktop");const Qs=(t,o)=>{if(!t)return"";try{return o?JSON.parse(t)[o]:JSON.parse(t)}catch{}return t},xn=Qs;function Zs(){var R;const{t,locale:o}=Q(),{projectId:n}=ct(),{api:l}=ge(),[i,d]=x.useState(!0),{blocklet:r}=Se(),u=We(g=>g.breakpoints.down("md")),[a,f]=x.useState(null),[b,j]=x.useState(null),[y,h]=x.useState(null),p=(R=window.env)==null?void 0:R.serverEndpoint,v=`releases-${r.meta.did}-${n}`,C=Zo(v),[m,k]=x.useState({searchText:C.searchText||"",pageSize:C.rowsPerPage||10,page:1}),w=()=>{l.getReleases({input:{did:r.meta.did,projectId:n}}).then(g=>{const D=(g==null?void 0:g.releases)||[];d(!1),f(D)}).catch(g=>{d(!1),W.error(g.message)})},T=()=>{l.doBatchQuery({getProject:{input:{did:r.meta.did,projectId:n}},getReleases:{input:{did:r.meta.did,projectId:n}}}).then(g=>{j(g.getProject.project||{}),f(g.getReleases.releases||[]),d(!1)}).catch(g=>{d(!1),W.error(g.message)})};x.useEffect(()=>{T()},[]);const[P,I]=x.useState(""),L=()=>{d(!1);const g=y.id;l.deleteRelease({input:{did:r.meta.did,projectId:n,releaseId:g}}).then(()=>{d(!1),w(),W.success(t("common.removeSuccess")),h(null)}).catch(D=>{d(!1),W.error(D.message)})},z=g=>{h(g)};if(!a&&i)return e.jsx(c,{sx:{display:"flex",justifyContent:"center",alignItems:"center",marginTop:"40px"},children:e.jsx(Xe,{})});if(!a)return null;const q=e.jsxs(Oo,{className:"breadcrumbs","aria-label":"breadcrumb",children:[e.jsx(ke,{to:"..",children:t("common.blockletStudio")}),e.jsx(E,{color:"text.primary",children:e.jsx(Ce,{maxLength:u?6:30,children:b.blockletTitle})})]});if(!a.length)return e.jsxs(e.Fragment,{children:[q,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(ke,{to:"create/none",children:e.jsx(qe,{variant:"contained",children:t("blocklet.publish.createRelease")})})]})]});const Z=[{label:t("common.version"),name:"blockletVersion",minWidth:160,options:{customBodyRenderLite:g=>{const D=a[g];return e.jsx(ke,{to:`view/${D.id}`,children:e.jsx(Mt,{did:r.meta.did,projectId:b.id,logo:D.blockletLogo,title:D.blockletVersion,describe:D.blockletTitle})})}}},{label:t("blocklet.publish.releaseNote"),name:"note",options:{customBodyRenderLite:g=>{const D=a[g];return e.jsx(E,{className:"note",children:xn(D.note,"note")})}}},{label:t("common.status"),name:"status",options:{customBodyRender:g=>e.jsx(Ko,{type:g==="published"?"success":"warning",children:g==="published"?"Released":js(g)})}},{label:t("common.lastPublishedAt"),name:"updatedAt",options:{customBodyRenderLite:g=>{const D=a[g];return D.status!==he.PROJECT.RELEASE_STATUS.published?"":e.jsx(en,{value:Number(D.updatedAt),locale:o})}}},{label:t("common.actions"),name:"actions",options:{customBodyRenderLite:g=>{var A;const D=a[g];let M="",O="";const G=D.status==="published";if(G){const H=de(p,`/api/project/${r.meta.did}/${b.id}/${b.lastReleaseId}/release/blocklet.json`),J=new URL(p);J.pathname=de(J.pathname,"/launch-blocklet/agreement"),J.searchParams.set("blocklet_meta_url",H),M=J.href,O=de(`${Y.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${r.meta.did}/${b.id}/${b.lastReleaseId}/download/${(b.lastReleaseFiles||[])[0]}`)}const S=(A=b.blockletComponents)!=null&&A.some(H=>H.included)||D.uploadedResource?"pack":"resource";return e.jsxs(c,{display:"flex",alignItems:"center",children:[G&&S==="pack"&&e.jsx(je,{title:t("blocklet.publish.install",{name:b.blockletTitle}),placement:"top",children:e.jsx(ce,{color:"secondary","aria-label":"create",children:e.jsx("a",{style:{display:"flex"},href:M,target:"_blank",rel:"noreferrer",children:e.jsx(bn,{sx:{fontSize:18}})})})}),G&&e.jsx(je,{title:t("blocklet.publish.download",{name:b.blockletTitle}),placement:"top",children:e.jsx(ce,{color:"primary","aria-label":"download",children:e.jsx("a",{style:{display:"flex"},href:O,children:e.jsx(ks,{sx:{fontSize:18}})})})}),e.jsx(je,{title:t("blocklet.publish.delete",{name:b.blockletTitle}),placement:"top",children:e.jsx(ce,{color:"primary","aria-label":"delete",onClick:()=>z(D),children:e.jsx(tn,{sx:{fontSize:18}})})})]})}}}],U=({page:g,rowsPerPage:D,searchText:M})=>{m.pageSize!==D?k(O=>({...O,searchText:"",pageSize:D,page:1})):m.page!==g+1?k(O=>({...O,searchText:"",page:g+1})):m.searchText!==M&&k(O=>({...O,searchText:M,page:1}))};return e.jsxs(Ks,{children:[e.jsx(Lt,{sx:{mb:2},left:q,actions:e.jsxs(e.Fragment,{children:[e.jsx(qe,{variant:"outlined",onClick:()=>{const g=de(p,`/api/project/${r.meta.did}/${n}/blocklet.json`);I(g)},children:t("blocklet.publish.copyInstallUrl")}),e.jsx(ke,{to:"new-release/none",children:e.jsxs(qe,{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(E,{variant:"h6",sx:{mb:2},children:t("blocklet.publish.installResourceTip")}),e.jsx(rn,{children:P}),e.jsxs(E,{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:a,columns:Z,durable:v,options:{sort:!1,download:!1,filter:!1,print:!1,search:!1},onChange:U}),y&&e.jsx(ht,{title:t(`${t("common.delete")} ${y.blockletVersion}`),description:t("blocklet.publish.deleteReleaseTip"),confirm:t("common.confirm"),onConfirm:L,onCancel:()=>h(null)})]})}const Ks=ye(c)`
3
+ .main-table > div:first-child {
4
+ display: none;
5
+ }
6
+ .note {
7
+ word-break: break-all;
8
+ white-space: pre-line;
9
+ }
10
+ `;var Ft={},er=we;Object.defineProperty(Ft,"__esModule",{value:!0});var gn=Ft.default=void 0,tr=er(De()),or=e;gn=Ft.default=(0,tr.default)((0,or.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 Me({children:t,Icon:o}){return e.jsxs(Vn,{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})]})}Me.propTypes={children:s.node.isRequired,Icon:s.elementType};Me.defaultProps={Icon:gn};function Ht({value:t,app:o,onChange:n,onChangeBlockletResourceType:l,disabled:i,resourceRelateComponents:d,projectType:r,dependentComponentsMode:u,blockletResourceType:a}){const{t:f,locale:b}=Q(),j=u==="readonly",y=x.useMemo(()=>{const w=t.reduce((T,P)=>(T[P.did]=P.included,T),{});return(o.children||[]).filter(T=>j?d[T.meta.did]||w[T.meta.did]:!0)},[o.children,t,d,j]),h=x.useMemo(()=>y.map(w=>t.find(P=>P.did===w.meta.did)||{did:w.meta.did}),[y,t]),p=h.reduce((w,T)=>(w[T.did]=Nt(T,["required","included"]),w),{}),v=w=>{const T=h.map(P=>{if(P.did===w){const I=!P.included;return{...P,included:I,required:I}}return P});n(T)},C=w=>{const T=h.map(P=>P.did===w?{...P,required:!P.required}:P);n(T)},m=w=>{l(w.target.checked?"resource":"")},k=[{label:f("common.name"),name:"meta.title",width:200,options:{customBodyRenderLite:w=>{var I;const T=y[w],P=(I=p[T.meta.did])==null?void 0:I.included;return e.jsxs(c,{display:"flex",alignItems:"center",children:[e.jsx(Et,{size:24,blocklet:T,ancestors:[o]}),e.jsx(c,{ml:"4px",className:At("text",{excluded:!P}),children:e.jsx(c,{children:T.meta.title})})]})}}},{label:f("blocklet.publish.componentIncluded"),width:100,options:{customBodyRenderLite:w=>{var L;const T=y[w],P=d[T.meta.did],I=!!((L=p[T.meta.did])!=null&&L.included);return e.jsx(Ke,{size:"small",checked:P||I,onClick:()=>v(T.meta.did),disabled:j||P||i})}}},{label:f("blocklet.publish.componentForceRequired"),width:100,options:{customBodyRenderLite:w=>{var z,q;const T=y[w],P=d[T.meta.did],I=!!((z=p[T.meta.did])!=null&&z.included),L=!!((q=p[T.meta.did])!=null&&q.required);return e.jsx(Ke,{size:"small",checked:P||L&&I,onClick:()=>C(T.meta.did),disabled:j||P||i||!I})}}}];return e.jsx(nr,{children:y!=null&&y.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:f(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:a==="resource",onChange:m}),f("blocklet.publish.forceResourceBlocklet")]})]}),e.jsx(qt,{className:"main-table",verticalKeyWidth:100,locale:b,data:y,columns:k,options:{sort:!1,download:!1,filter:!1,print:!1,search:!1,rowsPerPage:50}})]}):e.jsx(Me,{Icon:zt,children:f("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 nr=ye(c)`
11
+ .main-table {
12
+ .text.excluded {
13
+ color: #999;
14
+ }
15
+ width: 400px;
16
+ ${({theme:t})=>t.breakpoints.down("md")} {
17
+ width: 100%;
18
+ }
19
+ > div:first-child {
20
+ display: none;
21
+ }
22
+ .MuiTableCell-head {
23
+ padding-top: 0;
24
+ padding-bottom: 0;
25
+ }
26
+ .MuiTableCell-body {
27
+ padding-top: 6px;
28
+ padding-bottom: 6px;
29
+ }
30
+ .datatable-footer {
31
+ display: none;
32
+ }
33
+ }
34
+ `;var sr=(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 Io=rs,To=/\s+at.*(?:\(|\s)(.*)\)?/,rr=/^(?:(?:(?:node|(?:internal\/[\w/]*|.*node_modules\/(?:babel-polyfill|pirates)\/.*)?\w+)\.js:\d+:\d+)|native)/,lr=typeof Io.homedir>"u"?"":Io.homedir();var ir=(t,o)=>(o=Object.assign({pretty:!1},o),t.replace(/\\/g,"/").split(`
35
+ `).filter(n=>{const l=n.match(To);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:!rr.test(i)}).filter(n=>n.trim()!=="").map(n=>o.pretty?n.replace(To,(l,i)=>l.replace(i,i.replace(lr,"~"))):n).join(`
36
+ `));const cr=sr,ar=ir,dr=t=>t.replace(/\s+at .*aggregate-error\/index.js:\d+:\d+\)?/g,"");let ur=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"?dr(ar(l.stack)):String(l)).join(`
37
+ `);n=`
38
+ `+cr(n,4),super(n),this.name="AggregateError",Object.defineProperty(this,"_errors",{value:o})}*[Symbol.iterator](){for(const o of this._errors)yield o}};var pr=ur;const hr=pr;var fr=async(t,o,{concurrency:n=1/0,stopOnError:l=!0}={})=>new Promise((i,d)=>{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=[],a=t[Symbol.iterator]();let f=!1,b=!1,j=0,y=0;const h=()=>{if(f)return;const p=a.next(),v=y;if(y++,p.done){b=!0,j===0&&(!l&&u.length!==0?d(new hr(u)):i(r));return}j++,(async()=>{try{const C=await p.value;r[v]=await o(C,v),j--,h()}catch(C){l?(f=!0,d(C)):(u.push(C),j--,h())}})()};for(let p=0;p<n&&(h(),!b);p++);});const mr=fr;var br=(t,o)=>mr(t,n=>n(),o);const st=Wn(br);function xr(t,o){const n=new Set(o||[]),l=[];function i(d){n.has(d==null?void 0:d.id)&&l.push(d==null?void 0:d.id),d!=null&&d.children&&d.children.forEach(i)}return(t||[]).forEach(i),l}function Gt({src:t,alt:o,...n}){const[l,i]=x.useState(!1),d=x.useRef(null);return x.useEffect(()=>{if(!("IntersectionObserver"in window))return i(!0),()=>{};const r=new IntersectionObserver(u=>{u.forEach(a=>{a.isIntersecting&&(i(!0),r.disconnect())})},{threshold:.1});return d.current&&r.observe(d.current),()=>{r.disconnect()}},[]),e.jsx("img",{ref:d,src:l?t:void 0,alt:o,...n})}Gt.propTypes={src:s.string.isRequired,alt:s.string};Gt.defaultProps={alt:""};function Jt({data:t,lazy:o,...n}){return!t||!t.length?null:e.jsx(gr,{...n,children:t.map(l=>e.jsx("a",{href:l.url,target:"_blank",rel:"noreferrer",children:o?e.jsx(Gt,{src:l.url,alt:l.alt||""}):e.jsx("img",{src:l.url,alt:l.alt||""})},l.url))})}Jt.propTypes={data:s.arrayOf(s.shape({url:s.string,alt:s.string})),lazy:s.bool};Jt.defaultProps={data:[],lazy:!1};const gr=ye(c)`
39
+ display: flex;
40
+ justify-content: flex-start;
41
+ flex-wrap: wrap;
42
+ margin-bottom: -12px;
43
+ a {
44
+ display: flex;
45
+ }
46
+ img {
47
+ height: 128px;
48
+ cursor: pointer;
49
+ margin-right: 12px;
50
+ margin-bottom: 12px;
51
+ }
52
+ `,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?us(t)?e.jsx("img",{className:"resource-icon",src:t,alt:"icon"}):e.jsx(ae,{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 d(h,p=[]){return p.push(h.id),h.children&&h.children.forEach(v=>d(v,p)),p}const r=h=>d(vt(o,h)),u=(h,p=[])=>{const v=vt(o,h);return v.parent?(p.push(v.parent),u(v.parent,p)):p};function a(h,p){const v=r(h.id),C=v.indexOf(h.id);return v.splice(C,1),v.every(m=>i.concat(p).includes(m))}const f=(h,p)=>{h.stopPropagation();const v=r(p),C=u(p);if(i.includes(p)){const m=i.filter(k=>!v.concat(C).includes(k));n(m)}else{const m=v;for(let k=0;k<C.length;++k)a(vt(o,C[k]),m)&&m.push(C[k]);n([...i].concat(m))}},b=h=>{h.stopPropagation()},j=o.some(h=>{var p;return((p=h.children)==null?void 0:p.length)>0}),y=h=>{var k;const p=i.indexOf(h.id)!==-1,v=Array.isArray(h.children),C=r(h.id),m=v&&!p&&i.some(w=>C.includes(w));return e.jsx(Cs,{nodeId:h.id,label:e.jsx(et,{onClick:b,control:e.jsx(Ke,{size:"small",checked:p,indeterminate:m,tabIndex:-1,disableRipple:!0,onClick:w=>f(w,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(bs,{className:"link-icon"})})]}),!!h.description&&e.jsx(c,{className:"description",children:h.description}),!!((k=h.images)!=null&&k.length)&&e.jsx(Jt,{className:"images",data:h.images,lazy:!0})]})}),children:v?h.children.map(y):null},h.id)};return e.jsx(jr,{className:At(!j&&"no-children"),multiSelect:!0,defaultCollapseIcon:e.jsx(ms,{}),defaultExpandIcon:e.jsx(Rs,{}),selected:i,children:o.map(h=>y(h))})}Yt.propTypes={data:s.array,value:s.array,onChange:s.func,disabled:s.bool};Yt.defaultProps={data:[],value:[],onChange:()=>{},disabled:!1};const jr=ye(ws)`
53
+ &.no-children {
54
+ .MuiTreeItem-content {
55
+ padding: 0;
56
+ .MuiTreeItem-iconContainer {
57
+ display: none;
58
+ }
59
+ .MuiTreeItem-label {
60
+ padding-left: 0;
61
+ }
62
+ }
63
+ }
64
+ .MuiTreeItem-content {
65
+ align-items: flex-start;
66
+ .MuiTreeItem-iconContainer {
67
+ transform: translateY(10px);
68
+ }
69
+ &.Mui-selected {
70
+ background-color: transparent;
71
+ }
72
+ }
73
+ .MuiTreeItem-label {
74
+ cursor: default;
75
+ }
76
+ .MuiFormControlLabel-root {
77
+ align-items: flex-start;
78
+ }
79
+ .content {
80
+ padding-top: 6px;
81
+ }
82
+ .name {
83
+ font-size: 16px;
84
+ font-weight: 700;
85
+ }
86
+ .resource-icon {
87
+ margin-right: 2px;
88
+ font-size: 16px;
89
+ }
90
+ img.resource-icon {
91
+ width: 1rem;
92
+ height: 1rem;
93
+ }
94
+ .link {
95
+ margin-left: 8px;
96
+ font-size: 16px;
97
+ color: ${({theme:t})=>t.palette.primary.main};
98
+ display: flex;
99
+ }
100
+ .link-icon {
101
+ font-size: inherit;
102
+ }
103
+ .description {
104
+ font-size: 14px;
105
+ color: ${({theme:t})=>t.palette.text.secondary};
106
+ }
107
+ `,Po={},kr=(t,o,{key:n,cacheTime:l=1e3*3}={})=>{const i=n+JSON.stringify({params:o}),d=Po[i];if(d&&d.timestamp>Date.now()-l)return d.promise;const r=t(...o);return Po[i]={promise:r,timestamp:Date.now()},r},jn=kr,kn=(t,o)=>(t.forEach(n=>{o&&(n.parent=o),(n.children||[]).forEach(l=>{l.parent=n.id,kn(l.children||[],l.id)})}),t),yn=(t,o,n,l,i)=>{const{exportApi:d="/"}=(t==null?void 0:t.meta.resource)||{},r=new URL(de("http://127.0.0.1",t==null?void 0:t.mountPoint,d||"/").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}`},yr=async({api:t,appDid:o,component:n,projectId:l,releaseId:i,locale:d,initUrl:r,resources:u})=>{let a;if(r&&r.searchParams.get("resourcesParams"))try{a=JSON.parse(r.searchParams.get("resourcesParams"))}catch(f){W.error(f.message);return}await sn.post(yn(n,l,i,d,r),{resources:u,projectId:l,releaseId:i,locale:d,...a?{resourcesParams:a}:{}},{headers:{"x-csrf-token":ps()},timeout:10*60*1e3}),await t.updateSelectedResources({input:{did:o,projectId:l,releaseId:i,componentDid:n.meta.did,resources:u}})},vr=(t,o)=>{if(!t)return{};const n=o.reduce((i,d)=>(i[d]=!0,i),{}),l=(i,d)=>(i.forEach(r=>{var u;n[r.id]&&((u=r.dependentComponents)!=null&&u.length)&&r.dependentComponents.forEach(a=>{d[a]=!0}),r.children&&l(r.children,d)}),d);return l(t,{})};function Qt({app:t,component:o,projectId:n,release:l,loading:i,error:d,saveSelectedEventsRef:r,readOnly:u,componentDid:a,initialResources:f={},setResourceComponentsMap:b,selectedResourceIds:j,setSelectedResourceIds:y,showTree:h,initUrl:p}){var U;const{t:v,locale:C}=Q(),{api:m}=ge(),[k,w]=_e({}),T=x.useRef({}),P=x.useRef(!1),I=l.id;T.current.projectId=n,T.current.releaseId=I;const L=(R,g,D)=>{if(!g)return;const M=vr(g,D);b==null||b({[R]:Object.keys(M)})},z=R=>{r.current[o.meta.did]={resources:R,component:o},y({[o.meta.did]:R}),L(o.meta.did,k[o.meta.did],R)},q=x.useCallback(async R=>{var g;try{const D=await jn(sn.get,[yn(R,n,I,C,p),{timeout:6e4}],{key:"getResources"});return kn(((g=D==null?void 0:D.data)==null?void 0:g.resources)||[])}catch{return[]}},[n,I,C,p]);x.useEffect(()=>{k[o==null?void 0:o.meta.did]||q(o).then(R=>{w({[o==null?void 0:o.meta.did]:R})}).catch(R=>{W.error(R.message)})},[o,w,k,q]),x.useEffect(()=>{I&&n&&!P.current&&st(t.children.map(R=>async()=>{var g,D;if(!(a&&a!==R.meta.did)&&!(!(R!=null&&R.mountPoint)||!ls.hasStartEngine(R==null?void 0:R.meta)||!((D=(g=R==null?void 0:R.meta)==null?void 0:g.resource)!=null&&D.exportApi)))try{const M=await q(R);w({[R==null?void 0:R.meta.did]:M});const O=await m.getSelectedResources({input:{did:t.meta.did,projectId:n,releaseId:I,componentDid:R.meta.did}}),G=(O==null?void 0:O.resources)||[];G!=null&&G.length&&(y({[R.meta.did]:xr(M,G)}),L(R.meta.did,M,G),u||(r.current[R==null?void 0:R.meta.did]={resources:G,component:R}))}catch(M){W.error(M.message)}}),{concurrency:2}).then(()=>{P.current=!0})},[I,n,u,C,p,w]),x.useEffect(()=>{f&&Object.keys(f).length&&st(t.children.map(async R=>{const g=f[R.meta.did];if(g!=null&&g.length){const D=await q(R);y({[R.meta.did]:g}),L(R.meta.did,D,g),u||(r.current[R==null?void 0:R.meta.did]={resources:g,component:R})}}))},[t,f,u]);let Z=null;return(!o||!((U=k[o.meta.did])!=null&&U.length))&&(Z=e.jsx(Me,{Icon:zt,children:v("blocklet.publish.resourceEmptyTip",{name:yo.getDisplayName(o)})})),(o==null?void 0:o.status)!=="running"&&(Z=e.jsx(Me,{children:v("blocklet.publish.componentNotRunning",{name:yo.getDisplayName(o)})})),e.jsxs(e.Fragment,{children:[e.jsx(Rr,{className:At(d&&"error"),children:h&&e.jsx(c,{pb:2,width:"100%",children:Z||e.jsx(Yt,{data:k[o.meta.did]||[],value:j[o.meta.did]||[],onChange:z,disabled:i||u})})}),!!d&&e.jsx(c,{color:"error.main",mt:1,fontSize:14,children:d})]})}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 Rr=ye(c)`
108
+ border: 1px solid #ccc;
109
+ max-height: 600px;
110
+ width: 100%;
111
+ &.error {
112
+ border-color: ${t=>t.theme.palette.error.main};
113
+ }
114
+ border-radius: 4px;
115
+ padding: 16px;
116
+ padding-bottom: 0px;
117
+ overflow-y: auto;
118
+ .footer {
119
+ border-top: 1px solid #ddd;
120
+ display: flex;
121
+ padding: 12px 0;
122
+ margin-top: 12px;
123
+ position: sticky;
124
+ bottom: 0;
125
+ background: #fff;
126
+ z-index: 10;
127
+ }
128
+ `;var Zt={},Cr=we;Object.defineProperty(Zt,"__esModule",{value:!0});var St=Zt.default=void 0,wr=Cr(De()),Sr=e;St=Zt.default=(0,wr.default)((0,Sr.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 Dr(t){var u,a;const[o,n]=x.useState(null),{session:l}=Ue(),i=x.useCallback(f=>{n(f),localStorage.setItem(_o,f==null?void 0:f.id)},[n]),d=x.useMemo(()=>{var y,h,p,v;const f=localStorage.getItem(_o),b=f?(((y=t==null?void 0:t.settings)==null?void 0:y.storeList)||[]).find(C=>C.id===f):null;if(b)return b;let j=(((h=t==null?void 0:t.settings)==null?void 0:h.storeList)||[]).find(C=>{var m;return!(C.id!==Y.BLOCKLET_STORE.id||C.scope&&C.scope!=="studio"&&C.scope!==((m=l==null?void 0:l.user)==null?void 0:m.did))});return j||(j=(v=(p=t==null?void 0:t.settings)==null?void 0:p.storeList)==null?void 0:v[0]),j},[(u=t==null?void 0:t.settings)==null?void 0:u.storeList,(a=l==null?void 0:l.user)==null?void 0:a.did]);return[o||d||{},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 d=Date.now(),r=async(u,a)=>{try{const f=await t();u(f)}catch(f){Date.now()-d>n?a(f):i?Rt[i]=setTimeout(()=>r(u,a),o):setTimeout(()=>r(u,a),o)}};return new Promise(r)}function Ir(){return Math.random().toString(36).slice(2)+Math.random().toString(36).slice(2)+`${Date.now()}`.slice(-6)}function Tr(t,{did:o,projectId:n,messageId:l}){return Kt(async()=>{var d;const i=await t.getProject({input:{did:o,projectId:n,messageId:l}});if(!((d=i==null?void 0:i.project)!=null&&d.blockletDid))throw new Error("Connected store not found");return i.project.blockletDid},{timerKey:"connect-studio"})}function Pr(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(a=>a.storeId===l))throw new Error("Connected store not found")},{timerKey:`connect-store-${l}`})}function _r(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(a=>a.endpointId===l))throw new Error("Connected endpoint not found")},{timerKey:`connect-store-${l}`})}const $r=({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 d=t?((u=n==null?void 0:n.settings)==null?void 0:u.storeList)||[]:(o==null?void 0:o.blockletRegistryList)||[];return Array.isArray(d)||(d=[]),d=d.filter(a=>a.protected||!a.scope||a.scope==="studio"||a.scope===l),{teamDid:i,storeList:d}},eo=$r;function to({blocklet:t,store:o={},onChangeStore:n,onClick:l,disabled:i,loading:d,componentDid:r}){var R,g,D;const{t:u}=Q(),{session:a}=Ue(),{api:f,info:b,inService:j}=ge(),y=Se(),[h,p]=x.useState(!1),v=x.useRef(null),[C,m]=x.useState(!1),[k,w]=x.useState(null),T=M=>{n(M),p(!1)},P=()=>{p(!h)},I=M=>{v.current&&v.current.contains(M.target)||p(!1)},L=()=>{m(!0)},z=()=>{m(!1)},q=async()=>{var M;if(k)try{await f.deleteBlockletStore({input:{teamDid:t.meta.did,url:k.url,projectId:"",scope:k.scope||"studio"}}),await((M=y==null?void 0:y.actions)==null?void 0:M.refreshBlocklet())}catch(O){W.error(`Remove Blocklet Store Error: ${xe(O)}`)}finally{w(null)}},{storeList:Z}=eo({fromBlocklet:j,blocklet:t,nodeInfo:b,componentDid:r,userDid:(R=a==null?void 0:a.user)==null?void 0:R.did}),U=(g=t==null?void 0:t.meta)==null?void 0:g.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:[d&&e.jsx(Re,{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(Ns,{})})]}),e.jsx(Bo,{sx:{zIndex:10},open:h,anchorEl:v.current,placement:"bottom-end",role:void 0,transition:!0,disablePortal:!0,children:({TransitionProps:M})=>e.jsx(Wo,{...M,style:{transformOrigin:"center top"},children:e.jsx(_t,{children:e.jsx(Mo,{onClickAway:I,children:e.jsxs(Uo,{id:"split-button-menu",autoFocusItem:!0,sx:{maxHeight:300,overflowY:"auto",zIndex:10},children:[Z==null?void 0:Z.map(O=>{var G;return e.jsxs(fe,{selected:O.id===(o==null?void 0:o.id),sx:{height:56},onClick:()=>T(O),children:[e.jsxs(c,{children:[e.jsx(Ce,{sx:{fontSize:"16px"},maxLength:24,children:O.name}),e.jsx(Ce,{sx:{fontSize:"13px",opacity:.6},maxLength:30,children:O.url})]}),Ss({store:O,userDid:(G=a==null?void 0:a.user)==null?void 0:G.did})&&e.jsx(ce,{sx:{ml:1},onClick:S=>{S.preventDefault(),S.stopPropagation(),w(O)},children:e.jsx(ae,{icon:"ic:outline-delete"})})]},O.url)}),e.jsx(Fn,{}),e.jsxs(fe,{onClick:L,children:[e.jsx(pt,{font:!0}),e.jsx(E,{variant:"inherit",children:u("store.blockletRegistry.addRegistry")})]})]})})})})}),C&&e.jsx(ln,{hiddenChildren:!0,open:!0,onClose:z,teamDid:U,storeList:Z,scope:"studio",onAdd:(D=y==null?void 0:y.actions)==null?void 0:D.refreshBlocklet}),k&&e.jsx(ht,{displayError:!0,title:`${u("common.delete")} ${k.name}`,description:u("blocklet.publish.deleteStoreTip",{name:k.name}),confirm:u("common.confirm"),onConfirm:q,onCancel:()=>w(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 qr=(t,o,n)=>{const l=`${Y.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${o.meta.did}/${n}/logo/upload`,i=`${Y.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${o.meta.did}/${n}/screenshot/upload`,d=t!=null&&t.blockletLogo?`${l}/${t.blockletLogo}`:`${Y.WELLKNOWN_SERVICE_PATH_PREFIX}/static/images/logo.png`,r=((t==null?void 0:t.blockletScreenshots)||[]).filter(Boolean).map(u=>`${i}/${u}`);return{logoUrl:d,screenshotUrls:r,uploadLogoPrefix:l,uploadScreenshotPrefix:i}},vn=qr,Er=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}=Q(),d=t.includes("youtube.com")||t.includes("youtu.be"),r=t.includes("vimeo.com");if(d){const a=((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/${a}?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 a=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/${a}`,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(ae,{icon:"carbon:video-off",style:{fontSize:40,marginBottom:"10px",opacity:.5}}),e.jsx(E,{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 Rn({setParams:t,onClose:o,params:n}){const{t:l}=Q(),[i,d]=x.useState(""),r=i&&n.blockletVideos.includes(i),u=Er(i),a=()=>{t(f=>{const b=[...f.blockletVideos];return b.push(i),{...f,blockletVideos:b}}),o()};return e.jsxs(at,{open:!0,fullWidth:!0,maxWidth:"sm",children:[e.jsx(Vo,{children:l("studio.videoDialogTitle")}),e.jsxs(Fo,{children:[e.jsx(Hn,{fullWidth:!0,value:i,onChange:f=>d(f.target.value),placeholder:l("studio.videoInputLabel"),endAdornment:i?e.jsx(Je,{position:"end",children:e.jsx(ce,{onClick:()=>d(""),children:e.jsx(hs,{})})}):null,error:r}),r&&e.jsx(E,{variant:"body2",color:"error",children:l("studio.duplicateVideo")}),e.jsx(ft,{url:i,style:{marginTop:"20px",borderRadius:"4px"}})]}),e.jsxs(Ho,{children:[e.jsx(K,{onClick:()=>o(),children:l("studio.cancel")}),e.jsx(K,{disabled:!u||r,onClick:a,children:l("studio.confirm")})]})]})}Rn.propTypes={onClose:s.func.isRequired,params:s.object.isRequired,setParams:s.func.isRequired};function Dt({errors:t,storeList:o,...n}){const{t:l}=Q();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(E,{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,d])=>{const r=Object.values(d),u=o.find(a=>a.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(a=>e.jsx(c,{component:"li",ml:2,breakWords:!0,children:a},a))]},i)})]})}Dt.propTypes={errors:s.object.isRequired,storeList:s.array.isRequired};const $o=x.lazy(()=>nn(()=>import("./index-DS-sLY6b.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13])).then(t=>({default:t.Uploader})));function Cn({projectId:t,readOnly:o,loading:n,blocklet:l,params:i,setParams:d,paramsErrTip:r,setParamsErrTip:u,warning:a,setLoading:f,initUrl:b,initLogoUrl:j,setInitLogoUrl:y,componentDid:h}){const{t:p,locale:v}=Q(),{api:C}=ge(),m=Tt(),k=x.useRef(null),w=x.useRef(null),[T,P]=Dr(l),[I,L]=x.useState(!1),z=cn({messageType:"connect-store-message",onOpen:()=>f(!0),onClose:()=>f(!1)}),q=async $=>{const V=setTimeout(()=>{f(!1)},2e4),X=await Tr(C,$);f(!1),clearTimeout(V),window.parent.postMessage({event:"studioDialog.connected",componentDid:h},"*"),m(window.location.pathname.replace(`${Y.UNOWNED_DID}/create`,`${X}/create`),{replace:!0})},Z=()=>{if(!i.blockletTitle){W.error(p("blocklet.publish.errorTip.noTitle"));return}if(!(T!=null&&T.url)){W.error(p("blocklet.publish.noStoreSelected"));return}const $=Ir();z(async(V,X)=>{var te,oe,ie;try{const ee=await C.connectByStudio({input:{did:(te=l==null?void 0:l.meta)==null?void 0:te.did,blockletTitle:i==null?void 0:i.blockletTitle,storeUrl:T.url,storeId:T.id,storeName:T.name,type:((oe=i==null?void 0:i.blockletComponents)==null?void 0:oe.length)>0?"pack":"resource",componentDid:h,messageId:$,tenantScope:(b==null?void 0:b.searchParams.get("tenantScope"))||""}});if(!(ee!=null&&ee.url)){W.error("failed to connect to store");return}X(ee.url),q({did:(ie=l==null?void 0:l.meta)==null?void 0:ie.did,projectId:"",messageId:$})}catch(ee){const ue=xe(ee);W.error(ue),f(!1)}})},{logoUrl:U,screenshotUrls:R,uploadLogoPrefix:g,uploadScreenshotPrefix:D}=vn(i,l,t),{logoErrors:M,screenshotErrors:O,storeList:G,hasLogoWarning:S,hasScreenshotWarning:A}=a,H=()=>o?!1:!t||t===Y.UNOWNED_DID?(W.error(p("blocklet.publish.errorTip.noFirstDid")),!1):!0,J=$=>{if(!$.destination)return;const V=Array.from(i.blockletScreenshots),[X]=V.splice($.source.index,1);V.splice($.destination.index,0,X),d(te=>({...te,blockletScreenshots:V}))},Ie=$=>{if(!$.destination)return;const V=Array.from(i.blockletVideos),[X]=V.splice($.source.index,1);V.splice($.destination.index,0,X),d(te=>({...te,blockletVideos:V}))};return e.jsxs(Lr,{children:[e.jsx(c,{display:"flex",className:"section",children:e.jsxs(c,{sx:{flex:1},children:[e.jsx(ne,{disabled:n||o,label:`Blocklet ${p("common.title")}`,placeholder:`Blocklet ${p("common.title")}`,InputProps:{"data-cy":"blocklet-title",readOnly:o},autoComplete:"off",variant:"outlined",fullWidth:!0,required:!0,value:i.blockletTitle||"",onChange:$=>{u({blockletTitle:""}),d({blockletTitle:$.target.value})},error:!!r.blockletTitle,helperText:r.blockletTitle||""}),e.jsx(ne,{required:!0,label:"Blocklet DID",fullWidth:!0,readonly:!0,disabled:!0,autoComplete:"off",variant:"outlined",InputProps:{"data-cy":"export-blocklet-did",endAdornment:t===Y.UNOWNED_DID&&e.jsx(Je,{position:"end",children:e.jsx(to,{blocklet:l,store:T,componentDid:h,onChangeStore:P,disabled:!i.blockletTitle||o||n,loading:n,onClick:Z})})},error:!!r.projectId,helperText:r.projectId||"",value:t===Y.UNOWNED_DID?"":`did:abt:${t}`,sx:{mt:3}}),e.jsx(ne,{disabled:n||o,label:`Blocklet ${p("common.description")}`,placeholder:`Blocklet ${p("common.description")}`,InputProps:{"data-cy":"blocklet-description",readOnly:o},required:!0,autoComplete:"off",variant:"outlined",fullWidth:!0,value:i.blockletDescription||"",onChange:$=>{u({blockletDescription:""}),d({blockletDescription:$.target.value})},error:!!r.blockletDescription,helperText:r.blockletDescription||"",sx:{mt:3}}),e.jsx(ne,{disabled:n||o,label:`Blocklet ${p("common.homepageTip")}`,placeholder:`Blocklet ${p("common.homepageTip")}`,InputProps:{"data-cy":"blocklet-homepage",readOnly:o},autoComplete:"off",variant:"outlined",fullWidth:!0,value:i.blockletHomepage||"",onChange:$=>{$.target.value&&!/^(http|https):\/\//.test($.target.value)?u({blockletHomepage:p("blocklet.publish.errorTip.invalidUrl")}):u({blockletHomepage:""}),d({blockletHomepage:$.target.value})},error:!!r.blockletHomepage,helperText:r.blockletHomepage||"",sx:{mt:3}}),e.jsx(ne,{disabled:n||o,label:`Blocklet ${p("common.community")}`,placeholder:`Blocklet ${p("common.community")}`,InputProps:{"data-cy":"blocklet-community",readOnly:o},autoComplete:"off",variant:"outlined",fullWidth:!0,value:i.blockletCommunity||"",onChange:$=>{$.target.value&&!/^(http|https):\/\//.test($.target.value)?u({blockletCommunity:p("blocklet.publish.errorTip.invalidUrl")}):u({blockletCommunity:""}),d({blockletCommunity:$.target.value})},error:!!r.blockletCommunity,helperText:r.blockletCommunity||"",sx:{mt:3}}),e.jsx(ne,{disabled:n||o,label:`Blocklet ${p("common.support")}`,placeholder:`Blocklet ${p("common.support")}`,InputProps:{"data-cy":"blocklet-support",readOnly:o},autoComplete:"off",variant:"outlined",fullWidth:!0,value:i.blockletSupport||"",onChange:$=>{$.target.value&&!/^(http|https):\/\//.test($.target.value)&&!/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/.test($.target.value)?u({blockletSupport:p("blocklet.publish.errorTip.invalidUrlOrEmail")}):u({blockletSupport:""}),d({blockletSupport:$.target.value})},error:!!r.blockletSupport,helperText:r.blockletSupport||"",sx:{mt:3}}),e.jsx(ne,{disabled:n||o,label:`Blocklet ${p("common.repository")}`,placeholder:`Blocklet ${p("common.repository")}`,InputProps:{"data-cy":"blocklet-repository",readOnly:o},autoComplete:"off",variant:"outlined",fullWidth:!0,value:i.blockletRepository||"",onChange:$=>{$.target.value&&!/^(git|https|svn)/.test($.target.value)?u({blockletRepository:p("blocklet.publish.errorTip.invalidUrl")}):u({blockletRepository:""}),d({blockletRepository:$.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(ve,{direction:"column",spacing:1,sx:{mr:2,width:"160px"},children:[e.jsx(E,{variant:"subtitle1",sx:{fontWeight:"bold"},children:p("common.logo")}),e.jsxs(ve,{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:"#555"},children:[p("studio.type"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"#007ec6"},children:"png, jpg, webp, svg"})]})}),e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"#555"},children:[p("studio.ratio"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"#007ec6"},children:"256x256"})]})}),e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"#555"},children:[p("studio.size"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"#007ec6"},children:"<500Kb"})]})})]})]}),e.jsx(c,{sx:{flex:1,cursor:o?"default":"pointer",display:"flex",alignItems:"flex-end"},children:e.jsx(Pt,{variant:"square",sx:{width:80,height:80},alt:"Blocklet Logo",src:j||U,onClick:()=>{var $;H()&&(($=k.current)==null||$.open())}})})]}),S&&e.jsx(Dt,{errors:M,storeList:G,mt:3}),e.jsxs(c,{display:"flex",mt:3,flexDirection:"row",flexWrap:"wrap",children:[e.jsxs(ve,{direction:"column",spacing:1,sx:{mr:2,width:"160px"},children:[e.jsx(E,{variant:"subtitle1",sx:{fontWeight:"bold"},children:p("common.screenshot")}),e.jsxs(ve,{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:"#555"},children:[p("studio.ratio"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"#007ec6"},children:"16 / 9"})]})}),e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"#555"},children:[p("studio.count"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"#007ec6"},children:"1~5"})]})}),e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"#555"},children:[p("studio.size"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"#007ec6"},children:"<5MB"})]})}),!o&&e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"#555"},children:[p("studio.order"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"#007ec6"},children:p("studio.orderTip")})]})})]})]}),e.jsx(Ro,{onDragEnd:o?void 0:J,children:e.jsx(Co,{droppableId:"screenshots",direction:"horizontal",isDropDisabled:o,children:($,V)=>e.jsxs(c,{display:"flex",alignItems:"center",sx:{flex:1,flexWrap:"wrap",minHeight:160,background:V.isDraggingOver?"#f5f5f5":"transparent",transition:"background-color 0.2s ease",border:V.isDraggingOver?"2px dashed #999":"none",borderRadius:"4px"},ref:$.innerRef,...$.droppableProps,children:[R.map((X,te)=>e.jsx(wo,{draggableId:X,index:te,isDragDisabled:o,children:(oe,ie)=>e.jsxs(c,{ref:oe.innerRef,...oe.draggableProps,className:"screenshot",sx:{transform:ie.isDragging?"scale(1.05)":"none",boxShadow:ie.isDragging?"0 5px 10px rgba(0,0,0,0.15)":"none",transition:"transform 0.2s ease, box-shadow 0.2s ease"},children:[e.jsx("img",{alt:"screenshot",src:X}),!o&&e.jsx(ce,{...oe.dragHandleProps,className:"action",style:{right:40,zIndex:10,color:"#fff"},children:e.jsx(St,{})}),!o&&e.jsx(ce,{className:"action",onClick:()=>{d(ee=>{const ue=[...ee.blockletScreenshots];return ue.splice(te,1),{...ee,blockletScreenshots:ue}})},children:e.jsx(nt,{})})]})},X)),$.placeholder,R.length<5&&e.jsx(c,{sx:{width:240,height:135,background:"#eee",cursor:o?"default":"pointer",color:"#999",mb:2},display:"flex",justifyContent:"center",alignItems:"center",fontSize:40,onClick:()=>{var X;H()&&((X=w.current)==null||X.open())},children:"+"})]})})})]}),A&&e.jsx(Dt,{errors:O,storeList:G}),e.jsxs(c,{display:"flex",mt:3,flexDirection:"row",flexWrap:"wrap",children:[e.jsxs(ve,{direction:"column",spacing:1,sx:{mr:2,width:"160px"},children:[e.jsx(E,{variant:"subtitle1",sx:{fontWeight:"bold"},children:p("studio.video")}),e.jsxs(ve,{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:"#555"},children:[p("studio.videoType"),":"," "]}),e.jsxs(c,{component:"span",sx:{color:"#007ec6"},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:"#555"},children:[p("studio.count"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"#007ec6"},children:"1~3"})]})}),!o&&e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"#555"},children:[p("studio.order"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"#007ec6"},children:p("studio.orderTip")})]})})]})]}),e.jsx(Ro,{onDragEnd:o?void 0:Ie,children:e.jsx(Co,{droppableId:"videos",direction:"horizontal",isDropDisabled:o,children:($,V)=>e.jsxs(c,{display:"flex",alignItems:"center",sx:{flex:1,flexWrap:"wrap",minHeight:160,background:V.isDraggingOver?"#f5f5f5":"transparent",transition:"background-color 0.2s ease",border:V.isDraggingOver?"2px dashed #999":"none",borderRadius:"4px"},ref:$.innerRef,...$.droppableProps,children:[i.blockletVideos.map((X,te)=>e.jsx(wo,{draggableId:X,index:te,isDragDisabled:o,children:(oe,ie)=>e.jsxs(c,{ref:oe.innerRef,...oe.draggableProps,className:"screenshot",sx:{transform:ie.isDragging?"scale(1.05)":"none",boxShadow:ie.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:X,style:{pointerEvents:ie.isDragging?"none":"auto"}}),!o&&e.jsx(ce,{...oe.dragHandleProps,className:"action",style:{right:40,zIndex:10,color:"#fff"},children:e.jsx(St,{})}),!o&&e.jsx(ce,{className:"action",onClick:()=>{d(ee=>{const ue=[...ee.blockletVideos];return ue.splice(te,1),{...ee,blockletVideos:ue}})},children:e.jsx(nt,{})})]})},X)),$.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:()=>{H()&&L(!0)},children:"+"})]})})})]})]})}),e.jsxs(x.Suspense,{fallback:e.jsx(Xe,{}),children:[e.jsx($o,{ref:k,locale:v,popup:!0,onUploadFinish:$=>{var V;d({blockletLogo:$.data.filename}),y(""),(V=k.current)==null||V.close()},plugins:["ImageEditor"],installerProps:{disabled:!0},apiPathProps:{uploader:g,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(Rn,{onClose:()=>L(!1),params:i,setParams:d}),e.jsx($o,{ref:w,locale:v,popup:!0,onUploadFinish:$=>{var V;d(X=>{var oe;const te=X.blockletScreenshots||[];return te.push((oe=$.data)==null?void 0:oe.filename),{...X,blockletScreenshots:te}}),(V=w.current)==null||V.close()},installerProps:{disabled:!0},plugins:["ImageEditor"],apiPathProps:{uploader:D,disableMediaKitPrefix:!0,disableMediaKitStatus:!0},coreProps:{restrictions:{allowedFileTypes:["image/*","image/svg+xml"],maxFileSize:1024*1024*5,maxNumberOfFiles:5-R.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")]})]})}Cn.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 Lr=ye.div`
129
+ margin-top: 24px;
130
+ .screenshot {
131
+ margin-bottom: 16px;
132
+ max-width: 240px;
133
+ max-height: 135px;
134
+ width: 240px;
135
+ height: 135px;
136
+ overflow: hidden;
137
+ display: flex;
138
+ align-items: center;
139
+ justify-content: center;
140
+ background-color: #eee;
141
+ margin-right: 16px;
142
+ position: relative;
143
+ .action {
144
+ visibility: hidden;
145
+ position: absolute;
146
+ width: 42px;
147
+ height: 42px;
148
+ right: 6px;
149
+ top: 6px;
150
+ border-radius: 4px;
151
+ background-color: rgba(0, 0, 0, 1);
152
+ color: rgba(255, 255, 255, 1);
153
+ }
154
+ &:hover .action {
155
+ visibility: visible;
156
+ }
157
+ }
158
+ .screenshot img {
159
+ width: 100%; /* 图像宽度填充容器 */
160
+ height: auto; /* 图像高度自适应 */
161
+ }
162
+ `;var oo={},Nr=we;Object.defineProperty(oo,"__esModule",{value:!0});var wn=oo.default=void 0,Ar=Nr(De()),zr=e;wn=oo.default=(0,Ar.default)((0,zr.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 Or=(t,o,n,l)=>{const i=t?[...t]:[],d=((o==null?void 0:o.children)||[]).reduce((r,u)=>(r[u.meta.did]=!0,r),{});return Object.keys(n).forEach(r=>{if(!d[r])return;let u=!1;l||i.forEach(a=>{a.did===r&&(a.included=!0,a.required=!0,u=!0)}),u||i.push({did:r,included:!0,required:!0})}),i},Br=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*Wr(t,o){let n=0;for(;n<t.size;)yield t.slice(n,n+o),n+=o}const Mr=async({did:t,projectId:o,uploadType:n="logo",imageUrl:l})=>{const i=await Br(l);new FormData().append("file",i);const r={uploaderId:"Uploader",relativePath:encodeURIComponent(i.name),name:encodeURIComponent(i.name),type:i.type},a=(await vo.post(de(Y.WELLKNOWN_SERVICE_PATH_PREFIX,"/api/project",t,o,n,"upload"),null,{headers:{"Tus-Resumable":"1.0.0","Upload-Length":i.size,"X-Uploader-File-Ext":i.name.split(".").pop(),"Upload-Metadata":Object.keys(r).map(y=>`${y} ${btoa(r[y])}`).join(",")}})).headers.location,f=2*1024*1024;let b=0,j="";for(const y of Wr(i,f)){const h=await vo.patch(de(Y.WELLKNOWN_SERVICE_PATH_PREFIX,a),y,{headers:{"Tus-Resumable":"1.0.0","Upload-Offset":b,"Content-Type":"application/offset+octet-stream"}});b+=y.size,j=h.data.filename}return j},Sn=({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===Y.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},Ur=({params:t,step:o,t:n,projectId:l})=>{if(o===0){if(!t.blockletTitle)return n("blocklet.publish.errorTip.noTitle");if(!l||l===Y.UNOWNED_DID)return n("blocklet.publish.errorTip.noDid");if(!t.blockletDescription)return n("blocklet.publish.errorTip.noDescription")}if(o>=4){if(!t.blockletVersion)return n("blocklet.publish.errorTip.noVersion");if(!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:d,onPublish:r,onDelete:u,warning:a,projectType:f,componentDid:b,onOpenConnectStore:j,behavior:y,onSelectConnectStore:h}){var P,I;const{t:p}=Q(),{actions:{refreshBlocklet:v}}=Se(),{session:C}=Ue(),{storeList:m}=eo({fromBlocklet:!0,blocklet:t,componentDid:b,userDid:(P=C==null?void 0:C.user)==null?void 0:P.did}),k=x.useMemo(()=>n!=null&&n.length?n==null?void 0:n.reduce((L,z)=>(L[z.storeId]=z,L),{}):{},[n]),w=(I=t==null?void 0:t.meta)==null?void 0:I.did,T={};return Object.entries((a==null?void 0:a.logoErrors)||{}).forEach(([L,z])=>{const q=Object.values(z);q.length>0&&(T[L]=q)}),Object.entries((a==null?void 0:a.screenshotErrors)||{}).forEach(([L,z])=>{const q=Object.values(z);q.length>0&&(T[L]=T[L]?[...T[L],...q]:q)}),e.jsxs(e.Fragment,{children:[y==="connect"&&!!(m!=null&&m.length)&&e.jsx(dt,{severity:"info",style:{width:"100%"},children:e.jsxs(c,{color:Go[400],component:"a",href:f==="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:[p(f==="pack"?"blocklet.publish.whyCantSeeInStore":"blocklet.publish.whyCantSeeResourceBlockletInStore"),e.jsx(dn,{sx:{marginLeft:1}})]})}),e.jsx(Jo,{children:m==null?void 0:m.map(L=>e.jsx($t,{"data-cy":"store-switch",children:e.jsx(Xo,{children:e.jsx(Ds,{behavior:y,onSelectConnectStore:h,releaseId:o,projectId:l,releaseType:i,kind:"publish",teamDid:w,warningList:T[L.url],store:L,published:(d==null?void 0:d.indexOf(L.id))>-1,connectedStore:k[L.id],onPublish:r,onDelete:u,scope:L.scope||"studio",onOpenConnectStore:j})})},L.url))}),e.jsx(ln,{teamDid:w,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 Vr=Yo(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:d,onClose:r}){const{api:u}=ge(),[a,f]=x.useState(!1),[b,j]=x.useState(!0),[y,h]=x.useState(!1),[p,v]=x.useState(""),[C,m]=x.useState(""),{t:k}=Q(),w=Vr(),T=()=>{v(""),h(!1),r()},P=async()=>{f(!0);try{const{decoded:I}=is(p,o);await u.addUploadEndpoint({input:{teamDid:n,url:I}}),l(I),T()}catch(I){const L=`${k("blocklet.publish.endpoint.addFailed")} ${xe(I)}`;m(L)}finally{f(!1)}};return e.jsxs(e.Fragment,{children:[!i&&e.jsxs($t,{button:!0,disabled:t,className:w.addMenuItemRoot,onClick:()=>{h(!0)},children:[e.jsx(pt,{font:!0}),e.jsx(E,{variant:"inherit",children:k("blocklet.publish.endpoint.addEndpoint")})]}),e.jsxs(ut,{title:k("blocklet.publish.endpoint.addEndpoint"),fullWidth:!0,maxWidth:"md",open:d||y,onClose:T,PaperProps:{style:{minHeight:"auto"}},actions:e.jsxs(e.Fragment,{children:[e.jsx(qe,{onClick:I=>{I.stopPropagation(),T()},color:"inherit",children:k("common.cancel")}),e.jsxs(qe,{onClick:I=>{I.stopPropagation(),P()},color:"primary","data-cy":"install-blocklet-next-step",disabled:a||!p||b,variant:"contained",autoFocus:!0,children:[a&&e.jsx(Re,{size:16}),k("common.confirm")]})]}),children:[e.jsx("div",{style:{paddingTop:12,overflowY:"hidden"},children:e.jsx(Gn,{component:"div",children:e.jsx(E,{component:"div",children:e.jsx(ne,{label:k("blocklet.publish.endpoint.addEndpoint"),autoComplete:"off",variant:"outlined",name:"url","data-cy":"add-blocklet-endpoint-url",fullWidth:!0,value:p,onChange:I=>{m(null);let L=!1;I.target.value.trim()||(L=!0),I.target.value.trim()||m(k("blocklet.publish.endpoint.urlEmpty")),v(I.target.value),j(L)},disabled:a,onKeyPress:I=>{I.key==="Enter"&&(I.preventDefault(),I.target.value.trim()?P():m(k("blocklet.publish.endpoint.urlEmpty")))}})})})}),!!C&&e.jsx(dt,{severity:"error",style:{width:"100%"},children:C})]})]})}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:d}=ge(),{t:r}=Q(),u=Jn(),a=Se(),[f,b]=x.useState(!1),[j,y]=x.useState(null),h=()=>{b(!1),y(null)},p=async()=>{var m;try{b(!0),await d.deleteUploadEndpoint({input:{teamDid:o,did:t.id,projectId:l}}),await((m=a==null?void 0:a.actions)==null?void 0:m.refreshBlocklet()),n==null||n()}catch(k){W.error(`${r("blocklet.publish.endpoint.deleteFailed")}: ${xe(k)}`)}finally{b(!1),y(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:p,onCancel:h},C=m=>{t.protected||(m.stopPropagation(),y(v))};return e.jsxs(e.Fragment,{children:[i?e.jsx(c,{component:"span",onClick:C,children:i}):e.jsx(K,{"data-cy":"endpoint-action-delete",color:"primary",disabled:f,onClick:C,size:"small",children:e.jsx(nt,{sx:{zoom:.95}})}),j?e.jsx(As,{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:d}){const[r,u]=x.useState(null),a=!!r,{t:f}=Q(),[b,j]=x.useState(!1),y=m=>{m.stopPropagation(),window.open(pn(`${de(l.url)}`,{allowDomains:null}))},h=m=>{u(m.currentTarget)},p=()=>{u(null)},v=()=>{j(!1),o()},C=[{label:f("blocklet.publish.endpoint.visitEndpoint"),action:y,icon:dn},{label:f("common.disconnect"),action:()=>{p(),j(!0)},icon:Is,hidden:!t}];return e.jsxs(e.Fragment,{children:[e.jsx(K,{ref:r,color:"primary",onClick:h,size:"small",children:e.jsx(fs,{sx:{zoom:.95}})}),e.jsxs(Xn,{anchorEl:r,open:a,onClose:p,anchorOrigin:{vertical:"bottom",horizontal:"center"},transformOrigin:{vertical:"top",horizontal:"center"},children:[C.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:d,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:f("common.delete")})]})})]}),b&&e.jsx(ht,{displayError:!0,title:`${f("common.disconnect")} ${l.appName}`,description:f("blocklet.publish.endpoint.disconnectEndpointTip",{url:l.url}),confirm:f("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(Pt,{sx:{width:24,height:24,...n},src:de(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}=Q(),l=()=>{window.open(pn(`${de(t.url)}`,{allowDomains:null}))};return e.jsxs(c,{children:[e.jsx(E,{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 Fr=Yo(()=>({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"}})),qo=Yn(({className:t,...o})=>e.jsx(je,{...o,classes:{popper:t}}))(({theme:t})=>({[`& .${Qn.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:d,published:r,onPublish:u,connectedEndpoint:a,onOpenConnectEndpoint:f}){const b=Fr(),{t:j}=Q(),{api:y}=ge(),[h,p]=x.useState(!1),v=cn({messageType:"connect-endpoint-message",onOpen:()=>p(!0),onClose:()=>p(!1)}),C=!!a,m=()=>{v(async(I,L)=>{try{const z=await y.connectToEndpoint({input:{did:t,endpointId:l.id,projectId:o}});if(!(z!=null&&z.url)){W.error("failed to connect to endpoint");return}L(z.url),await f({did:t,projectId:o,endpointId:l.id}),p(!1)}catch(z){const q=xe(z);W.error(q),p(!1)}})},k=async()=>{try{await y.disconnectFromEndpoint({input:{did:t,endpointId:l.id,projectId:o}}),d()}catch(I){W.error(xe(I))}},w=()=>{p(!0),y.publishToEndpoint({input:{did:t,endpointId:l.id,projectId:o,releaseId:n}}).then(()=>{W.success(e.jsx(io,{endpoint:l,published:!0}),{duration:1e4}),u==null||u(null)}).catch(I=>{W.error(xe(I)),u==null||u(I)}).finally(()=>{p(!1)})};x.useEffect(()=>{C&&p(!1)},[C]);const T=i.length>0,P=e.jsxs(K,{sx:{paddingLeft:2,paddingRight:2,fontSize:15,width:130,height:"100%"},disabled:T,onClick:w,children:[h?e.jsx(Re,{sx:{marginRight:1},size:16}):e.jsx(Ts,{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(E,{component:"span",className:b.title,variant:"subtitle1",children:l.appName})}),e.jsx(E,{className:b.url,component:"span",variant:"inherit",children:`${l.url}`})]}),e.jsxs(c,{className:b.actions,children:[a&&e.jsx(qo,{placement:"top",title:e.jsxs(c,{children:[e.jsx(E,{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:a.developerDid,sx:{width:42,height:42}}),e.jsxs(c,{sx:{flex:1},children:[e.jsx(E,{component:"span",variant:"subtitle1",children:a.developerName}),e.jsx(wt,{size:14,copyable:!0,compact:!0,responsive:!1,did:a.developerDid})]})]})]}),children:e.jsx(c,{children:e.jsx(rt,{developerUrl:l.url,developerDid:a.developerDid,sx:{marginRight:1,cursor:"help"}})})}),e.jsxs(tt,{disabled:h,variant:"outlined",sx:{height:38},size:"small",children:[!C&&e.jsxs(K,{sx:{paddingLeft:2,paddingRight:2,fontSize:15,width:130},onClick:m,children:[h?e.jsx(Re,{sx:{marginRight:1},size:16}):e.jsx(Ps,{sx:{marginRight:1}}),j("common.connect")]}),C&&r&&e.jsxs(K,{disabled:!0,sx:{paddingLeft:2,paddingRight:2,fontSize:15,width:130},children:[h?e.jsx(Re,{sx:{marginRight:1},size:16}):e.jsx(un,{sx:{marginRight:1}}),j("common.uploaded")]}),C&&!r&&(T?e.jsx(qo,{title:e.jsxs(c,{children:[e.jsx(c,{sx:{color:"error.main",mb:.5},children:j("blocklet.publish.storeRule.warning")}),i.map((I,L)=>e.jsxs(c,{sx:{color:"error.main"},children:[L+1,". ",I]},I))]}),children:e.jsx("div",{children:P})}):P),e.jsx(lo,{projectId:o,endpoint:l,teamDid:t,connectedEndpoint:a,onDisconnect:k,onDelete:d})]})]})]})}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:d,onDelete:r,warning:u,onOpenConnectEndpoint:a}){var C,m;const{actions:{refreshBlocklet:f}}=Se(),{session:b}=Ue(),{t:j}=Q(),y=(((C=o==null?void 0:o.settings)==null?void 0:C.endpointList)||[]).filter(k=>{var w;return k.scope===((w=b==null?void 0:b.user)==null?void 0:w.did)}),h=x.useMemo(()=>n!=null&&n.length?n==null?void 0:n.reduce((k,w)=>(k[w.endpointId]=w,k),{}):{},[n]),p=(m=o==null?void 0:o.meta)==null?void 0:m.did,v={};return Object.entries((u==null?void 0:u.logoErrors)||{}).forEach(([k,w])=>{const T=Object.values(w);T.length>0&&(v[k]=T)}),Object.entries((u==null?void 0:u.screenshotErrors)||{}).forEach(([k,w])=>{const T=Object.values(w);T.length>0&&(v[k]=v[k]?[...v[k],...T]:T)}),e.jsxs(e.Fragment,{children:[!!(y!=null&&y.length)&&e.jsx(dt,{severity:"info",style:{width:"100%"},children:e.jsx(c,{color:Go[400],children:j("blocklet.publish.endpoint.uploadToEndpoint")})}),e.jsx(Jo,{sx:{flex:1},children:y==null?void 0:y.map(k=>e.jsx($t,{"data-cy":"endpoint-switch",children:e.jsx(Xo,{children:e.jsx(co,{releaseId:t,projectId:l,teamDid:p,warningList:v[k.url],endpoint:k,published:(i==null?void 0:i.indexOf(k.id))>-1,connectedEndpoint:h[k.id],onPublish:d,onDelete:r,onOpenConnectEndpoint:a})})},k.url))}),e.jsx(so,{teamDid:p,endpointList:y,onAdd:f})]})}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 Dn({did:t,params:o,setParams:n,projectId:l,open:i,onClose:d}){const{t:r}=Q(),[u,a]=x.useState(!1),{api:f}=ge(),[b,j]=x.useState(!1),[y,h]=x.useState(!1),p=()=>{j(o.autoUpload),h(o.possibleSameStore),a(!1),d(!1)},v=async()=>{a(!0);try{await f.updateProject({input:{did:t,projectId:l,blockletTitle:o.blockletTitle||"",blockletDescription:o.blockletDescription||"",blockletIntroduction:o.blockletIntroduction||"",autoUpload:!!b,possibleSameStore:!!y}}),n({autoUpload:b,possibleSameStore:y}),d(!1)}catch(m){W.error(m.message)}a(!1)};x.useEffect(()=>{j(o.autoUpload),h(o.possibleSameStore)},[o]);const C=!!(l&&l!==Y.UNOWNED_DID);return e.jsx(ut,{title:r("blocklet.publish.projectSettings"),disableEscapeKeyDown:!0,disablePortal:!1,fullWidth:!0,open:i,onClose:p,actions:e.jsxs(e.Fragment,{children:[e.jsx(K,{onClick:m=>{m.stopPropagation(),d()},color:"inherit",children:r("common.cancel")}),C&&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(Re,{size:16}),r("common.confirm")]})]}),children:C?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:ae,icon:"ph:upload",sx:{fontSize:24,mr:2}}),e.jsx(E,{variant:"body1",sx:{flex:1},children:r("blocklet.publish.autoUploadTip")}),e.jsx($e,{checked:b,onChange:(m,k)=>j(k)})]}),e.jsxs(c,{component:"label",sx:{display:"flex",flexDirection:"row",alignItems:"center"},children:[e.jsx(c,{component:ae,icon:"fluent-mdl2:merge-duplicate",sx:{fontSize:24,mr:2}}),e.jsx(E,{variant:"body1",sx:{flex:1},children:r("blocklet.publish.possibleSameStoreTip")}),e.jsx($e,{checked:y,onChange:(m,k)=>h(k)})]})]}):e.jsxs(c,{sx:{display:"flex",flexDirection:"column",alignItems:"center"},children:[e.jsx(c,{component:ae,icon:"ph:empty",sx:{fontSize:40,mb:3,opacity:.6}}),e.jsx(E,{variant:"body1",sx:{flex:1},children:r("blocklet.publish.needProjectId")})]})})}Dn.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 In({downloadUrl:t,installUrl:o,handleSetTip:n,isPack:l,disabled:i}){const{t:d}=Q(),[r,u]=x.useState(!1),a=x.useRef(null),f=()=>{u(!r)},b=j=>{a.current&&a.current.contains(j.target)||u(!1)};return e.jsxs(e.Fragment,{children:[e.jsx(K,{disabled:i,ref:a,onClick:f,children:e.jsx(c,{component:ae,sx:{fontSize:18},icon:"bxs:download"})}),e.jsx(Bo,{sx:{zIndex:10},open:r,anchorEl:a.current,placement:"bottom-end",role:void 0,transition:!0,disablePortal:!0,children:({TransitionProps:j})=>e.jsx(Wo,{...j,style:{transformOrigin:"center top"},children:e.jsx(_t,{children:e.jsx(Mo,{onClickAway:b,children:e.jsxs(Uo,{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:ae,sx:{mr:1},icon:"ic:round-install-desktop"}),e.jsx(E,{variant:"inherit",children:d("blocklet.publish.installToThisServer")})]})}),e.jsxs(fe,{onClick:n,children:[e.jsx(c,{component:ae,sx:{mr:1},icon:"iconamoon:copy"}),e.jsx(E,{variant:"inherit",children:d("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:ae,sx:{mr:1},icon:"ph:download"}),e.jsx(E,{variant:"inherit",children:d("common.download")})]})})]})})})})})]})}In.propTypes={disabled:s.bool.isRequired,isPack:s.bool.isRequired,downloadUrl:s.string.isRequired,installUrl:s.string.isRequired,handleSetTip:s.func.isRequired};var zo;const Eo=(zo=window.env)==null?void 0:zo.serverEndpoint;function Tn({projectId:t,params:o,setParamsErrTip:n,initUrl:l,setParams:i,mode:d,loading:r,blocklet:u,release:a,isPublished:f,releaseId:b,getData:j,getRelease:y,paramsErrTip:h,warning:p,componentDid:v,resourceRelateComponents:C,disabledSelectComponents:m,saveSelectedEventsRef:k,hasSelectedResources:w,initLogoUrl:T,setLoading:P,releaseUsedLast:I,setReleaseUsedLast:L,projectType:z}){var Ee;const{t:q,locale:Z}=Q(),U=[{label:e.jsx(c,{textAlign:"center",width:"100%",children:q("blocklet.publish.store")}),value:"store"},{label:e.jsx(c,{textAlign:"center",width:"100%",children:q("blocklet.publish.endpoint.tab")}),value:"endpoint"}],[R,g]=x.useState(U[0].value),{api:D}=ge(),M=Tt(),[O,G]=x.useState(!1),[S,A]=x.useState(!1),[H,J]=x.useState(),Ie=We(se=>se.breakpoints.down("md")),$=x.useMemo(()=>{var se;return o!=null&&o.blockletResourceType?o==null?void 0:o.blockletResourceType:((se=o==null?void 0:o.blockletComponents)==null?void 0:se.length)>0?(o==null?void 0:o.blockletComponents.find(B=>B.included))?"resource":"pack":"resource"},[o==null?void 0:o.blockletComponents,o==null?void 0:o.blockletResourceType]),V=()=>{window.parent.postMessage({event:"studioDialog.uploaded",componentDid:v},"*"),y()},X=async se=>{var Ae,Fe,ze,Qe;if(h!=null&&h.blockletHomepage||h!=null&&h.blockletSupport||h!=null&&h.blockletCommunity){W.error((h==null?void 0:h.blockletHomepage)||(h==null?void 0:h.blockletSupport)||(h==null?void 0:h.blockletCommunity));return}const Le=Sn({params:o,hasSelectedResources:w,projectId:t,status:se,t:q});if(Le){W.error(Le.map(F=>F.message).join("; ")),n(Le.reduce((F,re)=>({...F,[re.param]:re.message}),{}));return}const B={...o};if(B.blockletComponents=Or(B.blockletComponents,u,C,m),B.blockletVersion=Be.valid(B.blockletVersion),!B.blockletVersion){W.error("Invalid Blocklet Version"),n({blockletVersion:"Invalid Blocklet Version"});return}if(T)try{const F=await Mr({did:u.meta.did,projectId:t,imageUrl:T});B.blockletLogo=F,i({blockletLogo:F})}catch(F){W.error(F.message);return}if(o.resourceFromSelect){B.uploadedResource="";try{const F=Object.keys(k.current);await st(F.map(re=>()=>{const He=k.current[re];return yr({api:D,locale:Z,projectId:t,releaseId:I?"":b,appDid:u.meta.did,component:He.component,resources:He.resources,initUrl:l})}),{concurrency:2})}catch(F){W.error(((ze=(Fe=(Ae=F==null?void 0:F.response)==null?void 0:Ae.data)==null?void 0:Fe.error)==null?void 0:ze.message)||F.message),n({blockletResource:"Invalid save the resource"});return}}else(Qe=o.blockletDocker)!=null&&Qe.dockerImage||(B.blockletComponents=[]);B.blockletTitle=(B.blockletTitle||"").trim(),B.blockletDescription=(B.blockletDescription||"").trim(),B.blockletSupport=(B.blockletSupport||"").trim(),B.blockletHomepage=(B.blockletHomepage||"").trim(),B.blockletCommunity=(B.blockletCommunity||"").trim(),B.blockletRepository=(B.blockletRepository||"").trim(),B.blockletIntroduction=(B.blockletIntroduction||"").trim(),B.note=(B.note||"").trim(),B.blockletComponents=((B==null?void 0:B.blockletComponents)||[]).filter(F=>F.included).map(F=>Nt(F,["did","required"])).map(JSON.stringify),B.contentType!=="docker"&&(B.blockletDocker={dockerImage:"",dockerCommand:"",dockerArgs:[],dockerEnvs:[]}),B.blockletDocker.dockerImage=B.blockletDocker.dockerImage||"",B.blockletDocker.dockerArgs.length>0&&B.blockletDocker.dockerArgs.forEach(F=>{F.proxyBehavior=F.proxyBehavior||"service"});try{await D.createRelease({input:{...B,note:JSON.stringify({note:B.note}),did:u.meta.did,projectId:t,releaseId:I?"":b,status:se}}),se==="draft"?W.success(q("blocklet.publish.saveDraftSuccess")):(L(!1),W.success(q("blocklet.publish.createReleaseSuccess")),window.parent.postMessage({event:"studioDialog.released",componentDid:v},"*")),n({blockletResource:"",blockletTitle:"",blockletDescription:"",blockletVersion:"",blockletLogo:"",projectId:"",blockletIntroduction:"",note:""})}catch(F){const re=xe(F);W.error(re),(/resource/.test(re)||/zip/.test(re))&&n({blockletResource:re});return}const le=await D.getProject({input:{did:u.meta.did,projectId:t}}),Ne=le.project.lastReleaseId;o.autoUpload&&await st(le.project.connectedStores.map(F=>async()=>{try{const re=await D.publishToStore({input:{did:u.meta.did,storeId:F.storeId,storeName:F.storeName,projectId:t,releaseId:Ne,type:$}});W.success(e.jsx(_s,{storeName:F.storeName,storeUrl:F.storeUrl,developerDid:F.developerDid,did:u.meta.did,published:re.url==="published"}),{duration:1e4})}catch(re){W.error(xe(re))}}),{concurrency:4}),V==null||V(),M(`../${t}/view/${Ne}`,{replace:!0})},te=se=>(P(!0),X(se).finally(()=>{P(!1)})),oe=async se=>{await Pr(D,se),j()},ie=async se=>{await _r(D,se),j()},ee=()=>{A(!0)},ue=de(Eo,`/api/project/${u.meta.did}/${t}/${b}/release/blocklet.json`),pe=new URL(Eo);pe.pathname=de(pe.pathname,"/launch-blocklet/agreement"),pe.searchParams.set("blocklet_meta_url",ue);const Ye=pe.href,Ve=()=>J(ue);return e.jsxs(e.Fragment,{children:[e.jsx(Hr,{className:"sticky-header",children:e.jsx(Lt,{left:e.jsxs(Oo,{className:"breadcrumbs","aria-label":"breadcrumb",children:[e.jsx(ke,{to:"../",children:q("common.blockletStudio")}),t===Y.UNOWNED_DID?e.jsx(E,{color:"text.primary",children:e.jsx(Ce,{maxLength:Ie?6:30,children:(o==null?void 0:o.blockletTitle)||"Blocklet"})}):e.jsx(ke,{to:`../${t}`,children:e.jsx(Ce,{maxLength:Ie?6:30,children:(o==null?void 0:o.blockletTitle)||"Blocklet"})}),e.jsx(E,{color:"text.primary",children:d==="create"?q("common.create"):(o==null?void 0:o.blockletVersion)||q("common.edit")})]}),actions:e.jsxs(e.Fragment,{children:[!f&&e.jsxs(tt,{disabled:r,variant:"contained",children:[e.jsxs(K,{variant:"contained",onClick:()=>te(he.PROJECT.RELEASE_STATUS.published),children:[r&&e.jsx(Re,{size:14,sx:{mr:.5},color:"inherit"}),q("blocklet.publish.createRelease")]}),e.jsx(K,{variant:"contained",onClick:ee,children:e.jsx(ae,{icon:"mage:settings-fill",fontSize:"16px"})})]}),f&&e.jsxs(e.Fragment,{children:[e.jsx(at,{fullWidth:!0,maxWidth:"sm",open:H,onClose:()=>J(""),children:e.jsxs(c,{sx:{py:5,px:4,wordBreak:"break-all"},children:[e.jsx(E,{variant:"h6",sx:{mb:2},children:q("blocklet.publish.installResourceTip")}),e.jsx(rn,{children:H}),e.jsxs(E,{sx:{mt:2},children:[q("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:q("blocklet.publish.installResourceHelp")})]})]})}),e.jsxs(tt,{disabled:r,variant:"contained",children:[e.jsxs(K,{onClick:()=>G(!0),children:[r?e.jsx(Re,{size:14,sx:{mr:1},color:"inherit"}):e.jsx(wn,{sx:{fontSize:"1.3em",mr:1}}),q(Ie?"common.upload":"blocklet.publish.connectOrUpload")]}),e.jsx(In,{isPack:$==="pack",downloadUrl:de(`${Y.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${u.meta.did}/${t}/${b}/download/${(a.files||[])[0]}`),installUrl:Ye,handleSetTip:Ve}),e.jsx(K,{onClick:ee,children:e.jsx(ae,{icon:"mage:settings-fill",fontSize:"16px"})})]})]})]})})}),e.jsx(ut,{title:q("blocklet.publish.connectOrUpload"),disableEscapeKeyDown:!0,disablePortal:!1,fullWidth:!0,open:O,onClose:()=>G(!1),children:e.jsxs(c,{children:[e.jsx(c,{mt:-2,mb:2,children:e.jsx(on,{tabs:U,current:R,onChange:g})}),R==="store"&&e.jsx(no,{projectType:z,blocklet:u,releaseType:$,projectId:t,releaseId:b,componentDid:v,warning:p,onPublish:V,onOpenConnectStore:oe,onDelete:j,connectedStores:o.connectedStores||[],publishedStoreIds:a==null?void 0:a.publishedStoreIds}),R==="endpoint"&&e.jsx(ve,{minHeight:400,children:e.jsx(ao,{blocklet:u,releaseType:$,projectId:t,releaseId:b,warning:p,publishedEndpointIds:[],connectedEndpoints:o.connectedEndpoints||[],onPublish:V,onOpenConnectEndpoint:ie,onDelete:j})})]})}),e.jsx(Dn,{did:(Ee=u==null?void 0:u.meta)==null?void 0:Ee.did,params:o,projectId:t,open:S,setParams:i,onClose:()=>A(!1)})]})}Tn.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 Hr=ye.div`
163
+ .sticky-header {
164
+ margin-top: -12px;
165
+ padding: 12px 0;
166
+ position: sticky;
167
+ top: 0;
168
+ z-index: 99;
169
+ display: flex;
170
+ align-items: center;
171
+ justify-content: space-between;
172
+ background-color: #fff;
173
+ padding-bottom: 12px;
174
+ border-bottom: ${({theme:t})=>`1px solid ${t.palette.divider}`};
175
+ }
176
+ `;function Pn({text:t}){return t?e.jsx(zs,{wrapperElement:{"data-color-mode":"light"},source:xs.sanitize(t),rehypePlugins:[[Os,{target:"_blank"}]]}):e.jsx(Me,{Icon:zt})}Pn.propTypes={text:s.string.isRequired};function _n({params:t,setParams:o,paramsErrTip:n,loading:l,setParamsErrTip:i,readOnly:d}){var b;const{t:r}=Q(),[u,a]=x.useState(d?"preview":"write"),f=(j,y)=>{a(y)};return e.jsxs(c,{sx:{border:"1px solid #fff",width:"100%",borderRadius:2},children:[e.jsxs(c,{sx:{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center"},children:[e.jsx(E,{variant:"h6",fontWeight:"bold",sx:{},children:r("common.introduction")}),e.jsxs(Qo,{value:u,onChange:f,"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(ne,{disabled:l||d,sx:{border:"none"},placeholder:`Blocklet ${r("common.introduction")}`,InputProps:{"data-cy":"export-blocklet-introduction",readOnly:d,endAdornment:e.jsxs(Je,{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(Pn,{text:t.blockletIntroduction||""})})]})}_n.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={},Gr=we;Object.defineProperty(uo,"__esModule",{value:!0});var It=uo.default=void 0,Jr=Gr(De()),Lo=e;It=uo.default=(0,Jr.default)([(0,Lo.jsx)("circle",{cx:"12",cy:"19",r:"2"},"0"),(0,Lo.jsx)("path",{d:"M10 3h4v12h-4z"},"1")],"PriorityHigh");function po({step:t,ok:o,active:n,error:l,warning:i}){let d="grey.500",r=t+1;return o&&(r=e.jsx(un,{sx:{fontSize:18,margin:0},color:"white"})),l||!o&&n>t?(d="error.main",r=e.jsx(It,{sx:{fontSize:18,margin:0},color:"white"})):i?(d="warning.main",r=e.jsx(It,{sx:{fontSize:18,margin:0},color:"white"})):n>=t&&(d="primary.main"),e.jsx(c,{width:24,height:24,bgcolor:d,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 $n({steps:t,activeStep:o,setActiveStep:n,hasSelectedResources:l,params:i,loading:d,paramsErrTip:r,warning:u,viewMode:a,projectId:f}){const{t:b}=Q(),j=()=>{n(v=>v+1)},y=()=>{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):"",p=a||Sn({hasSelectedResources:l,params:i,projectId:f,t:b})===null;return e.jsxs(c,{sx:{width:300,maxWidth:300,minWidth:300,padding:2,border:"1px solid #ccc",borderRadius:2},children:[e.jsx(Zn,{activeStep:o,orientation:"vertical",children:t.map((v,C)=>{const m={},k=d||!Ur({hasSelectedResources:l,params:i,projectId:f,step:C,t:b}),w=d?"":h(C);return w&&(m.optional=e.jsx(E,{variant:"caption",color:"error",sx:{wordBreak:"break-word"},children:w}),m.error=!0),e.jsxs(Kn,{children:[e.jsx(es,{icon:e.jsx(po,{error:w,warning:C===0?u.hasWarning:!1,active:p?99:o,step:C,ok:k}),sx:{cursor:"pointer",color:w?"error.main":"inherit"},disabled:!1,onClick:()=>n(C),...m,children:e.jsx(E,{fontSize:"14px",fontWeight:"500",color:w||!k&&o>C?"error.main":"inherit",children:v.label})}),e.jsxs(ts,{children:[e.jsx(E,{fontSize:12,children:v.description}),!p&&e.jsx(c,{sx:{mb:2},children:e.jsxs("div",{children:[C<t.length-1&&e.jsx(K,{variant:"contained",onClick:j,sx:{mt:1,mr:1},disabled:w||!k,children:b("common.continue")}),C>0&&e.jsx(K,{disabled:C===0,onClick:y,sx:{mt:1,mr:1},children:b("common.back")})]})})]})]},v.label)})}),o>=t.length-1&&e.jsx(_t,{square:!0,elevation:0,sx:{p:3},children:e.jsx(E,{fontSize:12,sx:{opacity:.5},children:"Click right top button to release"})})]})}$n.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 Xr=[".zip",".gz"],Yr=1024*1024*100,Qr=x.lazy(()=>nn(()=>import("./index-DS-sLY6b.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:d,error:r}){const{t:u,locale:a}=Q(),f=x.useRef(null),b=()=>n?!1:!o||o===Y.UNOWNED_DID?(W.error(u("blocklet.publish.errorTip.noFirstDid")),!1):!0,j=`${Y.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${t.meta.did}/${o}/resource/upload`;return e.jsxs(c,{sx:{mt:3},children:[e.jsx(E,{gutterBottom:!0,children:u("blocklet.publish.resourceUpload")}),e.jsxs(ve,{direction:"row",alignItems:"center",spacing:1,sx:{flex:1,cursor:n?"default":"pointer"},children:[!!l.uploadedResource&&e.jsx(E,{component:"a",href:`${j}/params.uploadedResource`,children:l.uploadedResource}),!n&&e.jsx(K,{variant:"outlined",size:"small",onClick:()=>{var y;b()&&((y=f.current)==null||y.open())},children:l.uploadedResource?u("common.change"):u("common.upload")})]}),e.jsx(x.Suspense,{fallback:e.jsx(Xe,{}),children:e.jsx(Qr,{ref:f,locale:a,popup:!0,onUploadFinish:y=>{var h;i({uploadedResource:y.data.filename}),d({blockletResource:""}),(h=f.current)==null||h.close()},plugins:["ImageEditor"],installerProps:{disabled:!0},apiPathProps:{uploader:j,disableMediaKitPrefix:!0,disableMediaKitStatus:!0},coreProps:{restrictions:{allowedFileExts:Xr,maxFileSize:Yr,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:d}){var u;const{t:r}=Q();return e.jsx(c,{display:"flex",mt:3,className:"section",children:e.jsxs(c,{sx:{flex:1},children:[e.jsx(ne,{required:!0,disabled:d||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:a=>{i({blockletVersion:""}),n({blockletVersion:a.target.value})},error:!!l.blockletVersion,helperText:l.blockletVersion||""}),e.jsx(ne,{label:r("blocklet.publish.releaseNote"),autoComplete:"off",disabled:d||t,variant:"outlined",InputProps:{"data-cy":"release-note",readOnly:t,endAdornment:e.jsxs(Je,{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:a=>{i({note:""}),n({note:a.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 qn(t){for(const o in t)typeof t[o]=="string"?t[o]=t[o].replace(/\\\\/g,"\\"):typeof t[o]=="object"&&t[o]!==null&&qn(t[o]);return t}function it({index:t,item:o,dockerParams:n,setDockerParams:l,dataKey:i,t:d,readOnly:r}){const u=(o==null?void 0:o.value)||"",[a,f]=x.useState(!1),b=()=>{var U;(U=n[i])==null||U.splice(t,1),l({...n,[i]:[...n[i]]})},j=(U,R)=>{var g;(g=n[i])!=null&&g[t]&&(R?(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]]})},y=(U,R)=>{var D;const g=((D=n[i][t])==null?void 0:D.value)||"";n[i][t]={...n[i][t],secure:R,value:R&&g===he.BLOCKLET_AUTOMATIC_ENV_VALUE?"":g},l({...n,[i]:[...n[i]]})},h=(U,R)=>{n[i][t]={...n[i][t],shared:R},l({...n,[i]:[...n[i]]})},p=(U,R)=>{var D;const g=((D=n[i][t])==null?void 0:D.value)||"";n[i][t]={...n[i][t],required:R,value:R&&g===he.BLOCKLET_AUTOMATIC_ENV_VALUE?"":g},l({...n,[i]:[...n[i]]})},v=(U,R)=>{n[i][t]={...n[i][t],value:R?he.BLOCKLET_AUTOMATIC_ENV_VALUE:"",secure:!1,required:!1},l({...n,[i]:[...n[i]]})},C=U=>{n[i][t]={...n[i][t],description:U.target.value},l({...n,[i]:[...n[i]]})},m=U=>{const R=U.target.value==="web"?"web":"docker";R==="web"&&n.dockerArgs.forEach(M=>{M.type="docker"});const D=`/${n.dockerImage.replace(/\W/g,"-")}-${t}`;n.dockerArgs[t]={...n.dockerArgs[t],type:R,path:R==="docker"?D:"/",protocol:"http",prefix:R==="docker"?D:"/",name:"publicUrl",port:"BLOCKLET_PORT"},l({...n,dockerArgs:[...n.dockerArgs]})},k=U=>{n.dockerArgs[t]={...n.dockerArgs[t],proxyBehavior:U.target.value==="direct"?"direct":"service"},l({...n,dockerArgs:[...n.dockerArgs]})},w=U=>{const R=U.target.value;n[i][t]={...n[i][t],prefix:R,path:R==="*"?"/":R},l({...n,[i]:[...n[i]]})},T=U=>{var R;(R=n[i])!=null&&R[t]&&(n[i][t].value=U.target.value),l({...n,[i]:[...n[i]]})},P=u===`$${yt(o.key)}`||o.custom,I=i==="dockerArgs"&&!an[o.key],L=$s[o.key],z=i==="dockerEnvs",q=o.key==="--publish";let Z=o.key;return q&&o.type==="web"?Z="--publish (Web)":z&&(Z=`--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(E,{sx:{textOverflow:"ellipsis",width:"100%",overflow:"hidden"},children:Z})}),e.jsxs(c,{sx:{display:"flex",flexDirection:"column",gap:1,flex:1},children:[e.jsx(ne,{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(Je,{position:"end",sx:{zoom:.9},children:[(!(L||I)||z||q)&&e.jsx(ce,{onClick:()=>f(!0),children:e.jsx(ae,{icon:"icon-park-outline:setting-config"})}),!r&&e.jsx(ce,{onClick:b,color:I?"error":"default",children:e.jsx(ae,{icon:"ic:round-delete"})})]})},error:I,onChange:T}),I&&e.jsx(E,{variant:"caption",color:"error",children:d("blocklet.publish.docker.noAllowTheArg")}),o.key==="--publish"&&e.jsx(E,{variant:"caption",color:"text.secondary",children:d("blocklet.publish.docker.publishTips")}),o.key==="--volume"&&qs[o.key](u)&&e.jsx(E,{variant:"caption",color:"error",children:d("blocklet.publish.docker.volumeTips")})]}),a&&e.jsx(ut,{open:!0,fullWidth:!0,maxWidth:"sm",PaperProps:{style:{minHeight:0}},title:d(z?"blocklet.publish.docker.modifyEnv":"blocklet.publish.docker.modifyParam"),onClose:()=>f(!1),children:e.jsxs(c,{sx:{display:"flex",flexDirection:"column",gap:1,paddingBottom:2},children:[L||I||z?null:e.jsxs(c,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(E,{children:d("blocklet.publish.docker.needCustomInput")}),e.jsx($e,{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(E,{children:d("blocklet.publish.docker.shared")}),e.jsx($e,{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(E,{children:d("blocklet.publish.docker.required")}),e.jsx($e,{disabled:r,checked:o.required,onChange:p,sx:{zoom:.9}})]}),z&&e.jsxs(c,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(E,{children:d("blocklet.publish.docker.secure")}),e.jsx($e,{disabled:r,checked:o.secure,onChange:y,sx:{zoom:.9}})]}),z&&e.jsxs(c,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(E,{children:d("blocklet.publish.docker.autoGenerated")}),e.jsx($e,{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(E,{sx:{flex:1},children:d("blocklet.publish.docker.description")}),e.jsx(ne,{disabled:r,value:o.description,onChange:C,sx:{flex:1},label:d("blocklet.publish.docker.description")})]}),q&&e.jsxs(c,{sx:{mt:1,width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(E,{sx:{flex:1},children:d("blocklet.publish.docker.portType")}),e.jsxs(Ct,{value:o.type||"docker",onChange:m,children:[e.jsx(fe,{value:"docker",children:"Docker"}),e.jsx(fe,{value:"web",children:"Web"})]})]}),q&&o.type==="web"&&e.jsxs(c,{sx:{mt:1,width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(E,{sx:{flex:1},children:d("blocklet.publish.docker.proxyBehavior")}),e.jsxs(Ct,{value:o.proxyBehavior||"service",onChange:k,children:[e.jsx(fe,{value:"service",children:d("blocklet.publish.docker.serviceProxy")}),e.jsx(fe,{value:"direct",children:d("blocklet.publish.docker.directProxy")})]})]}),q&&o.type==="web"&&e.jsxs(c,{sx:{mt:1,width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(E,{sx:{flex:1},children:d("blocklet.publish.docker.prefix")}),e.jsx(ne,{disabled:r,value:o.prefix,onChange:w,sx:{flex:1},label:d("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 Zr=`
177
+ docker run --name postgrest
178
+ -p 3000:3000
179
+ -e PGRST_DB_URI="postgres://username:password@host:port/database"
180
+ -e PGRST_DB_SCHEMA="public"
181
+ -e PGRST_DB_ANON_ROLE="anon"
182
+ postgrest/postgrest
183
+ `.trim();function fo({readOnly:t,paramsErrTip:o,setParamsErrTip:n,error:l,params:i,setParams:d}){const{t:r}=Q(),[u,a]=x.useState("dockerParams"),[f,b]=x.useState(""),[j,y]=x.useState(!1),[h,p]=x.useState("--volume"),[v,C]=x.useState(""),[m,k]=x.useState(So(f)),w=m.dockerArgs||[],T=m.dockerEnvs||[],P=m.dockerImage||"",I=m.dockerCommand||"",L=g=>{const{value:D}=g.target;b(D)};x.useEffect(()=>{i.blockletDocker&&i.blockletDocker.dockerImage&&!P&&k(i.blockletDocker)},[i,P,k]);const z=g=>{const D=So(g.target.value);k(M=>{let O,G=!1;return D.dockerArgs.forEach(S=>{const A=M.dockerArgs.find(H=>H.key===S.key);A&&(Object.entries(A).forEach(([H,J])=>{J!=null&&H!=="value"&&(S[H]=J)}),S.proxyBehavior=S.proxyBehavior||"server",S.type==="web"&&(S.path="/",S.protocol="http",S.prefix="/",S.name="publicUrl",S.port="BLOCKLET_PORT",G=!0),!O&&S.key==="--publish"&&(O=S))}),!G&&O&&(O.type="web",O.path="/",O.protocol="http",O.prefix="/",O.name="publicUrl",O.port="BLOCKLET_PORT"),D.dockerEnvs.forEach(S=>{const A=M.dockerEnvs.find(H=>H.key===S.key);A&&Object.entries(A).forEach(([H,J])=>{J!=null&&H!=="value"&&(S[H]=J)})}),D})},q=()=>{if(y(!1),h==="--env"){k({...m,dockerEnvs:[...T,{key:v,value:"",custom:"",secure:!1,shared:!1,required:!1,description:v}]}),C("");return}k({...m,dockerArgs:[...w,{key:h,value:"",type:"docker",name:"",path:"",prefix:"",protocol:""}]})},Z=()=>{y(!1),C("")},U=g=>{const{value:D}=g.target;k({...m,dockerImage:D}),D.indexOf(" ")>-1?n({...o,dockerImageName:r("blocklet.publish.docker.dockerImageNameError")}):n({...o,dockerImageName:""})},R=g=>{const{value:D}=g.target;k({...m,dockerCommand:D});try{Ls(D),n({...o,dockerCMD:""})}catch{n({...o,dockerCMD:r("blocklet.publish.docker.dockerCMDError")})}};return x.useEffect(()=>{u==="dockerCommand"&&b(Es(m))},[m,u]),x.useEffect(()=>{d(g=>({...g,blockletDocker:{dockerImage:m.dockerImage,dockerCommand:m.dockerCommand,dockerArgs:m.dockerArgs,dockerEnvs:m.dockerEnvs}}))},[m,d]),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(Qo,{value:u,onChange:(g,D)=>a(D),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(ne,{disabled:t,label:r("blocklet.publish.docker.pleaseInputDockerCommand"),placeholder:Zr,InputProps:{"data-cy":"blocklet-docker-command",readOnly:t},autoComplete:"off",variant:"outlined",fullWidth:!0,multiline:!0,spellCheck:!1,minRows:10,value:f,onChange:L,onBlur:z}),u==="dockerParams"&&e.jsxs(c,{sx:{display:"flex",flexDirection:"column",gap:2},children:[e.jsx(ne,{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(ne,{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:R}),e.jsx(c,{sx:{height:4}}),w.map((g,D)=>e.jsx(it,{index:D,item:g,dockerParams:m,setDockerParams:k,dataKey:"dockerArgs",t:r,readOnly:t},`${g.key}-${D}`)),T.map((g,D)=>e.jsx(it,{index:D,item:g,dockerParams:m,setDockerParams:k,dataKey:"dockerEnvs",t:r,readOnly:t},`${g.key}-${D}`)),!t&&e.jsxs(c,{sx:{display:"flex",flexDirection:"row",gap:2,alignItems:"center"},children:[e.jsx(c,{sx:{flex:1}}),e.jsx(K,{onClick:()=>y(!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(Vo,{children:r("blocklet.publish.docker.addItem")}),e.jsx(Fo,{children:e.jsxs(os,{sx:{mt:1,width:"100%",minWidth:480,maxWidth:"100%"},children:[e.jsx(Ct,{labelId:"demo-simple-select-helper-label",id:"demo-simple-select-helper",value:h,sx:{width:"100%"},onChange:g=>p(g.target.value),children:Object.keys(an).map(g=>e.jsx(fe,{value:g,children:g}))}),h==="--publish"&&e.jsx(E,{variant:"caption",color:"text.secondary",children:r("blocklet.publish.docker.publishTips")}),h==="--volume"&&e.jsx(E,{variant:"caption",color:"text.secondary",children:r("blocklet.publish.docker.volumeTips")}),h==="--env"&&e.jsxs(c,{sx:{mt:3,width:"100%"},children:[e.jsx(ne,{value:v,onChange:g=>C(g.target.value),sx:{width:"100%"},label:r("blocklet.publish.docker.envKey")}),e.jsx(ns,{children:r("blocklet.publish.docker.dockerArgValue")})]})]})}),e.jsxs(Ho,{children:[e.jsx(K,{onClick:Z,children:r("common.cancel")}),e.jsx(K,{onClick:q,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 Kr=({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})},No=(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},el={0:"branding",1:"introduction",2:"resources",3:"blocklets",4:"version"},Ao={branding:0,introduction:1,resources:2,blocklets:3,version:4};function mo({initUrl:t,...o}){var bo,xo;const{projectId:n,mode:l,releaseId:i,componentDid:d=""}=ct(),{t:r}=Q(),{blocklet:u}=Se(),[a,f]=_e({blockletScreenshots:[],blockletVideos:[],publishedStoreIds:[],connectedStores:[],uploadedResource:"",contentType:"blocklet",blockletResourceType:"",blockletSupport:"",blockletCommunity:"",blockletHomepage:"",blockletRepository:"",blockletDocker:{dockerImage:"",dockerArgs:[],dockerEnvs:[]}}),[b,j]=_e({}),[y,h]=_e({}),[p,v]=x.useState(!1),[C,m]=_e(null),{api:k}=ge(),w=We(_=>_.breakpoints.down("md")),[T,P]=x.useState({}),[I,L]=x.useState(!1),z=x.useRef({}),[q,Z]=_e({}),[U,R]=x.useState(""),[g,D]=_e({}),M=t==null?void 0:t.searchParams.get("dependentComponentsMode"),O=M==="readonly",{session:G}=Ue(),{storeList:S}=eo({fromBlocklet:!0,blocklet:u,componentDid:d,userDid:(bo=G==null?void 0:G.user)==null?void 0:bo.did}),[A,H]=x.useState([]);x.useEffect(()=>{Array.isArray(S)&&S.length>0&&Promise.all(S.map(async _=>({...(await(await fetch(`${_.url}/__blocklet__.js?type=json`)).json()).preferences,storeInfo:_}))).then(_=>{H(_)})},[S.length]),x.useEffect(()=>{const _={},N={},{logoUrl:me,screenshotUrls:Te}=vn(a,u,n);Promise.all(A.map(async be=>{const{maxImageCount:Oe,minImageCount:mt,logoImageType:Pe,imageMinHeight:go,imageMinWidth:jo}=be,Ze=Array.isArray(Pe)?Pe:Pe.split(",");_[be.storeInfo.url]||(_[be.storeInfo.url]={}),N[be.storeInfo.url]||(N[be.storeInfo.url]={});const bt=N[be.storeInfo.url],Nn=_[be.storeInfo.url];Number(Oe)<=Te.length&&(bt.maxImageCount=r("blocklet.publish.storeRule.maxImageCount",{max:Oe,count:Te.length,unit:Oe>1?r("blocklet.publish.storeRule.screenshots"):r("blocklet.publish.storeRule.screenshot")})),Number(be.minImageCount)>Te.length&&(bt.minImageCount=r("blocklet.publish.storeRule.minImageCount",{min:mt,count:Te.length,unit:mt>1?r("blocklet.publish.storeRule.screenshots"):r("blocklet.publish.storeRule.screenshot")}));const ko=me?me.split(".").pop():"";ko&&!(Ze.includes("jpg")?[...Ze,"jpeg"]:Ze).includes(ko)&&(Nn.logoFormat=r("blocklet.publish.storeRule.logoFormat",{format:Ze.join(",")})),await Promise.all(Te.map((An,xt)=>{const gt=new Image;return gt.src=An,new Promise(zn=>{gt.onload=()=>{const{width:On,height:Bn}=gt;if(On<Number(jo)||Bn<Number(go)){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}bt[`imageSize-${xt+1}`]=r("blocklet.publish.storeRule.minImageSize",{width:jo,height:go,name:Ge})}zn()}})}))})).then(()=>{const be=Object.values(_).some(Pe=>Object.values(Pe).length>0),Oe=Object.values(N).some(Pe=>Object.values(Pe).length>0);h({logoErrors:_,screenshotErrors:N,storeList:S,hasWarning:be||Oe,hasLogoWarning:be,hasScreenshotWarning:Oe})})},[a,u.did,n,A,r]);const J=x.useMemo(()=>{const _={};return Object.keys(g).forEach(N=>{const me=g[N];me&&me.forEach(Te=>{_[Te]=!0})}),_},[g]),Ie=x.useCallback(_=>{O&&f({blockletComponents:[]}),D(_)},[O,D,f]),$=x.useCallback((..._)=>{Z(..._),j({blockletResource:"",blockletDocker:""})},[]),V=i==="none"?(a==null?void 0:a.lastReleaseId)||"":i,[X,te]=x.useState(l==="new-release"?4:0),oe=t==null?void 0:t.searchParams.get("resourcesTitle"),ie=t==null?void 0:t.searchParams.get("componentsTitle"),ee=[{label:r("blocklet.publish.branding"),description:r("blocklet.publish.steps.branding")},{label:r("common.introduction"),description:r("blocklet.publish.steps.introduction")},{label:oe||r("blocklet.publish.resourceTitle"),description:r("blocklet.publish.steps.resources")},{label:ie||r("common.components"),description:r("blocklet.publish.steps.blocklets")},{label:r("blocklet.publish.versionTitle"),description:r("blocklet.publish.steps.version")}],ue=ee[X]||ee[ee.length-1],pe=el[X];x.useEffect(()=>{n&&j({projectId:""})},[n,j]);const Ye=x.useMemo(()=>{var _;return(a==null?void 0:a.blockletResourceType)==="resource"?"resource":(_=a==null?void 0:a.blockletComponents)!=null&&_.some(N=>N.included)||Object.keys(J).length||a!=null&&a.uploadedResource?"pack":"resource"},[a==null?void 0:a.blockletComponents,a==null?void 0:a.uploadedResource,J,a==null?void 0:a.blockletResourceType]),Ve=[],Ee=((u==null?void 0:u.children)||[]).filter(_=>{var N;return(N=_.meta.resource)==null?void 0:N.exportApi}).filter(_=>!d||_.meta.did===d);Ee.forEach(_=>{Kr({tabs:Ve,blocklet:_,t:r,ancestors:[u]})});const[se,Le]=x.useState((xo=Ve[0])==null?void 0:xo.value),B=!I&&(C==null?void 0:C.status)==="published",le=B,Ne=vs(()=>{if(!t)return;R(t.searchParams.get("logo")),f(N=>{var me;return{...N,blockletTitle:(N==null?void 0:N.blockletTitle)||t.searchParams.get("title"),blockletDescription:(N==null?void 0:N.blockletDescription)||t.searchParams.get("description"),blockletIntroduction:(N==null?void 0:N.blockletIntroduction)||t.searchParams.get("introduction")||t.searchParams.get("description"),blockletComponents:(me=N==null?void 0:N.blockletComponents)!=null&&me.length?N==null?void 0:N.blockletComponents:JSON.parse(t.searchParams.get("components")||"[]"),note:(N==null?void 0:N.note)||t.searchParams.get("note")||"No note"}});const _=t.searchParams.get("resources");try{const N=JSON.parse(_);P(N)}catch{}}),Ae=async()=>{if(V)try{const _=await k.getRelease({input:{did:u.meta.did,projectId:n,releaseId:V}});if(v(!1),!_.release){W.error("Release not found");return}_.release.note=xn(_.release.note,"note"),_.release=qn(_.release),l!=="view"&&(_.release.note=""),f(N=>No({...N,..._.release,blockletVersion:l==="create"||l==="new-release"?Be.inc(_.release.blockletVersion,"patch"):_.release.blockletVersion},u)),m(_.release)}catch(_){v(!1),W.error(xe(_))}},Fe=async()=>{if(n===Y.UNOWNED_DID){f({blockletVersion:"0.0.1",blockletTitle:""});return}if(!n){W.error(r("blocklet.publish.errorTip.noDid"));return}try{const N=(await jn(k.getProject,[{input:{did:u.meta.did,projectId:n}}],{key:"getProject"})).project||{};N.blockletVersion?(l==="create"||l==="new-release")&&Be.valid(N.blockletVersion)&&(N.blockletVersion=Be.inc(N.blockletVersion,"patch")):N.blockletVersion="0.0.1";const me=No(N,u);f(me),N.lastReleaseId||Ne()}catch(_){W.error(xe(_))}},ze=x.useCallback(async()=>{v(!0);try{if(l==="view"){if(!V){W.error("Empty release id");return}await Fe(),await Ae();return}await Fe(),V&&(L(!0),await Ae())}finally{v(!1)}},[l,V]),Qe=_=>{f({blockletComponents:_})},F=_=>{f({blockletResourceType:_})};x.useEffect(()=>{ze()},[ze]),x.useEffect(()=>{n===Y.UNOWNED_DID&&(l==="create"||l==="new-release")&&t&&Ne()},[n,t,l,Ne]),x.useEffect(()=>{a.contentType==="docker"?f({resourceFromSelect:!1}):a.contentType==="blocklet"?f({resourceFromSelect:!0}):a.contentType==="upload"&&f({resourceFromSelect:!1})},[a.contentType,f]);const re=x.useMemo(()=>!!Object.keys(q).find(_=>!!q[_].length),[q]);if(!a&&p)return e.jsx(Xe,{});if(!a)return null;const He=Ee.find(_=>_.meta.did===se),Ln=_=>{Le(_)};return e.jsxs(tl,{...o,children:[e.jsx(Tn,{blocklet:u,release:C,getData:ze,getRelease:Ae,mode:l,params:a,setParams:f,setParamsErrTip:j,warning:y,readOnly:le,isPublished:B,loading:p,setLoading:v,initLogoUrl:U,releaseId:V,projectId:n,projectType:Ye,resourceComponents:Ee,resourceComponentsMap:g,resourceRelateComponents:J,resourceItem:He,saveSelectedEventsRef:z,hasSelectedResources:re,releaseUsedLast:I,setReleaseUsedLast:L,setRelease:m,paramsErrTip:b}),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:w?"column":"row",children:[!w&&e.jsx($n,{steps:ee,loading:p,viewMode:l==="view",params:a,hasSelectedResources:re||a.uploadedResource,paramsErrTip:b,warning:y,activeStep:X,setActiveStep:te,projectId:n,resourcesUrlTitle:oe,componentsUrlTitle:ie}),e.jsxs(c,{flex:"1",maxWidth:"720px",children:[!w&&pe!=="introduction"&&e.jsxs(E,{variant:"h6",fontWeight:"bold",display:"flex",flexDirection:"row",alignItems:"center",children:[ue.label,pe==="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/en/blocklet-detail-page",sx:{paddingTop:1,marginLeft:1},style:{color:"gray"},children:e.jsx(ys,{})})})]}),(w||pe==="branding")&&e.jsx(c,{flexDirection:"column",children:e.jsx(Cn,{projectId:n,setParams:f,setParamsErrTip:j,warning:y,params:a,componentDid:d,blocklet:u,initUrl:t,loading:p,setLoading:v,paramsErrTip:b,readOnly:le,initLogoUrl:U,setInitLogoUrl:R})}),w&&e.jsx(c,{flexDirection:"column",children:e.jsx(lt,{loading:p,params:a,paramsErrTip:b,setParams:f,setParamsErrTip:j,readOnly:le})}),(w||pe==="introduction")&&e.jsx(c,{display:"flex",flexDirection:"column",sx:{mt:w?5:0,width:"100%"},children:e.jsx(_n,{loading:p,readOnly:le,params:a,setParams:f,paramsErrTip:b,setParamsErrTip:j})}),w&&e.jsx(E,{variant:"h6",fontWeight:"bold",mt:5,children:ee[Ao.resources].label}),e.jsx(c,{sx:{maxWidth:720},display:w||pe==="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(ss,{onChange:_=>f({contentType:_.target.value}),children:[e.jsx(et,{value:"blocklet",disabled:le,control:e.jsx(kt,{size:"small",checked:a.contentType==="blocklet"}),label:r("blocklet.publish.resourceSelect")}),e.jsx(et,{value:"upload",disabled:le,control:e.jsx(kt,{size:"small",checked:a.contentType==="upload"}),label:r("blocklet.publish.resourceUpload")}),e.jsx(et,{value:"docker",disabled:le,control:e.jsx(kt,{size:"small",checked:a.contentType==="docker"}),label:r("blocklet.publish.resourceDocker")})]}),e.jsxs(c,{display:a.contentType==="blocklet"?"block":"none",children:[!d&&e.jsx(on,{tabs:Ve,current:se,onChange:Ln,sx:{ml:-2,mt:2,maxWidth:w?window.innerWidth-24:"100%"}}),e.jsx(Qt,{loading:p,initialResources:T,saveSelectedEventsRef:z,selectedResourceIds:q,setSelectedResourceIds:$,setResourceComponentsMap:Ie,error:b.blockletResource,app:u,readOnly:le,component:He,componentDid:d,initUrl:t,params:a,showTree:a.contentType==="blocklet",setParams:f,projectId:n===Y.UNOWNED_DID?"":n,releaseUsedLast:I,release:{...C,id:V}})]}),a.contentType==="upload"&&e.jsx(ho,{app:u,readOnly:le,projectId:n===Y.UNOWNED_DID?"":n,params:a,error:b.blockletResource,setParams:f,setParamsErrTip:j}),a.contentType==="docker"&&e.jsx(fo,{app:u,readOnly:le,projectId:n===Y.UNOWNED_DID?"":n,params:a,error:b.blockletResource,setParams:f,setParamsErrTip:j,paramsErrTip:b})]})})}),w&&e.jsx(E,{variant:"h6",fontWeight:"bold",mt:5,children:ee[Ao.blocklets].label}),(w||pe==="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:Ye,disabled:p||le,app:u,value:(a==null?void 0:a.blockletComponents)||[],blockletResourceType:(a==null?void 0:a.blockletResourceType)||"",onChange:Qe,onChangeBlockletResourceType:F,resourceRelateComponents:J,dependentComponentsMode:M})})})}),!w&&pe==="version"&&e.jsx(c,{flexDirection:"column",children:e.jsx(lt,{loading:p,params:a,paramsErrTip:b,setParams:f,setParamsErrTip:j,readOnly:le})})]})]})]})]})}mo.propTypes={initUrl:s.object};mo.defaultProps={initUrl:null};const tl=ye.div`
184
+ .section {
185
+ &.full-width {
186
+ max-width: 100%;
187
+ }
188
+ .MuiTypography-h3 {
189
+ font-size: 1.1rem;
190
+ font-weight: 700;
191
+ }
192
+ .left {
193
+ flex-shrink: 0;
194
+ width: 140px;
195
+ }
196
+ .MuiTabs-indicator {
197
+ display: none;
198
+ }
199
+ .MuiTypography-subtitle1 {
200
+ width: 120px;
201
+ font-weight: 700;
202
+ font-size: 1rem;
203
+ ${({theme:t})=>t.breakpoints.down("sm")} {
204
+ width: 80px;
205
+ }
206
+ }
207
+ }
208
+ .MuiButtonBase-root {
209
+ a {
210
+ color: inherit;
211
+ }
212
+ }
213
+ .MuiInputBase-multiline .MuiInputAdornment-positionEnd {
214
+ align-self: flex-end;
215
+ .MuiTypography-root {
216
+ font-size: 0.8rem;
217
+ }
218
+ font-size: 0.8rem;
219
+ }
220
+ `;function En({padding:t,initUrl:o}){const{blocklet:n}=Se(),l=Mn(),{componentDid:i}=ct();if(x.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 d={};return t&&(d.padding=t),e.jsx(ol,{style:d,children:e.jsxs(Un,{children:[e.jsx(jt,{path:"/",element:e.jsx(Ut,{initUrl:o})}),e.jsx(jt,{path:"/:projectId",element:e.jsx(Zs,{})}),e.jsx(jt,{path:"/:projectId/:mode/:releaseId",element:e.jsx(mo,{initUrl:o})})]})})}En.propTypes={padding:s.oneOfType([s.string,s.number]),initUrl:s.object};En.defaultProps={padding:"",initUrl:null};const ol=ye(c)`
221
+ a {
222
+ color: ${({theme:t})=>t.palette.primary.main};
223
+ }
224
+ `;export{En as default};
@@ -1 +1 @@
1
- import{r as P,b as J,g as W}from"./vendor-react-DEoibe3W.js";import{H as x,j as i,ao as B,s as _,w as ee,a9 as U,T as w,y as te}from"./vendor-mui-core-8zafwTFh.js";import{f as E,u as H}from"./vendor-hooks-DftG_2gV.js";import{j as ne,i as v,I as se}from"./vendor-ux-did-connect-D2f9rdKK.js";import{z as O,x as re,y as z}from"./vendor-utils-BNHJB5U7.js";const Be=e=>{if(!e||!e.length)return[];const t=[];let o=null,s=[];if(e.forEach(n=>{var y,f,p,h;if(!n.activity||!n.activity.type||!o){o&&(s.length===1?t.push(s[0]):(o.items=s,t.push(o))),n.activity&&n.activity.type?(o=n,s=[n]):(t.push(n),o=null,s=[]);return}const r=s[0].activity,a=r.type,c=(y=r.target)==null?void 0:y.type,l=(f=r.target)==null?void 0:f.id,u=n.activity.type,d=(p=n.activity.target)==null?void 0:p.type,g=(h=n.activity.target)==null?void 0:h.id;if(a&&u&&a===u&&(!r.target&&!n.activity.target||r.target&&n.activity.target&&c===d&&l===g))s.push(n);else{if(s.length===1)t.push(s[0]);else{const T=Object.assign({},o,{items:s});t.push(T)}o=n,s=[n]}}),o)if(s.length===1)t.push(s[0]);else{const n=Object.assign({},o,{items:s});t.push(n)}return t},oe=e=>!O(e.activity)&&!!e.activity.type&&!!e.activity.actor,ze=e=>oe(e)&&!!e.actorInfo&&!!e.actorInfo.did,ie=e=>{if(!e)return null;const{meta:t,target:o}=e;return{metaLink:t==null?void 0:t.id,targetLink:o==null?void 0:o.id}},S={COMMENT:"comment",LIKE:"like",FOLLOW:"follow",TIPS:"tips",MENTION:"mention",ASSIGN:"assign"},ae={[S.COMMENT]:(e,t)=>t>1?i.jsxs(i.Fragment,{children:["left ",t," comments on your ",e]}):i.jsxs(i.Fragment,{children:["commented on your ",e]}),[S.LIKE]:e=>i.jsxs(i.Fragment,{children:["liked your ",e]}),[S.FOLLOW]:()=>i.jsx(i.Fragment,{children:"followed you"}),[S.TIPS]:e=>i.jsxs(i.Fragment,{children:["gave tips to your ",e]}),[S.MENTION]:e=>i.jsxs(i.Fragment,{children:["mentioned you in ",e]}),[S.ASSIGN]:()=>i.jsx(i.Fragment,{children:"assigned you a task"})},b=P.memo(function({user:t,color:o=v.textBase}){const s=re(z(ne.WELLKNOWN_SERVICE_PATH_PREFIX,"user"),{did:t.did});return i.jsx(B,{href:s,color:o,fontWeight:600,target:"_blank",sx:{textDecoration:"none"},onClick:n=>{n.customPreventRedirect=!0},children:t.fullName||"System"})});b.propTypes={user:x.shape({did:x.string.isRequired,fullName:x.string.isRequired}).isRequired,color:x.string};b.displayName="UserLink";function $e({activity:e,users:t,actors:o,extra:s={},mountPoint:n=""}){const{type:r,target:a}=e||{},{type:c}=a||{},{linkColor:l=v.textBase}=s||{},u=E(()=>{if(!Array.isArray(t))return new Map;const p=new Map;return t.forEach(h=>{h!=null&&h.did&&!p.has(h.did)&&p.set(h.did,h)}),p},[t]),d=E(()=>Array.isArray(o)?o.map(p=>p?u.get(p)||{did:p,fullName:"System"}:null):[],[o,u]),g=H(()=>{if(!Array.isArray(d)||d.length===0)return null;if(d.length===1)return i.jsx(b,{user:d[0],color:l});const p=d.slice(0,-1),h=d[d.length-1];if(d.length===2)return i.jsxs(i.Fragment,{children:[i.jsx(b,{user:p[0],color:l})," and ",i.jsx(b,{user:h,color:l})]});const T=d.length>3,F=T?d.slice(0,2):p;return i.jsxs(i.Fragment,{children:[F.map((I,Z)=>i.jsxs(J.Fragment,{children:[i.jsx(b,{user:I,color:l}),Z<F.length-1?", ":""]},I.did)),T?`, and ${d.length-2} others`:i.jsxs(i.Fragment,{children:[", and ",i.jsx(b,{user:h,color:l})]})]})}),m=H(()=>{const p=ae[r];return p?p(c,t.length):null}),y=E(()=>{const p=g(),h=m();return!p||!h?null:i.jsxs(i.Fragment,{children:[p," ",h]})},[r,c,d,g,m]),f=E(()=>{if(!e)return null;const p=ie(e);return p!=null&&p.targetLink?z(n,p.targetLink):null},[e,n]);return!r||O(a)?null:i.jsxs(i.Fragment,{children:[y," ",i.jsx(B,{href:f,color:v.primaryBase,target:"_blank",sx:{textDecoration:"none"},onClick:p=>{p.customPreventRedirect=!0},children:a.name})]})}const le={width:24,height:24,body:'<path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M17 7L7 17M8 7h9v9"/>'};$.propTypes={meta:x.object.isRequired};const ce=_(ee)(({theme:e})=>({maxWidth:320,display:"flex",flexDirection:"column",gap:e.spacing(1.5),padding:e.spacing(2),marginTop:e.spacing(1),borderRadius:e.spacing(1),border:`1px solid ${v.dividerColor}`,boxShadow:"none"})),de=_(U)(({theme:e})=>({display:"flex",justifyContent:"flex-start",alignItems:"center",gap:e.spacing(1),marginBottom:e.spacing(1)})),pe=_(U)({display:"flex",justifyContent:"space-between",alignItems:"center"});function $({meta:e}){const{amount:t,symbol:o,chainId:s}=e,n=()=>{window.open(`https://explorer.arcblock.io/chain/${s}`,"_blank")};return i.jsxs(ce,{children:[i.jsxs(de,{children:[i.jsx("img",{alt:"ArcBlock Beta",src:"https://bbqat7g5cg33cyr4pdrd6foycgzfb5xxeh2se7gcqkq.did.abtnet.io/payment-kit/methods/arcblock.png",width:32,height:32,style:{borderRadius:16}}),i.jsx(w,{variant:"h5",color:v.textBase,children:"ArcBlock"})]}),i.jsxs(pe,{children:[i.jsxs(U,{display:"flex",alignItems:"baseline",gap:1,children:[i.jsxs(w,{component:"span",variant:"h5",color:v.textBase,fontWeight:"bold",children:["+ ",t]}),i.jsx(w,{component:"span",variant:"subtitle2",color:v.textSubtitle,children:o})]}),i.jsx(te,{variant:"outlined",size:"small",color:"secondary",endIcon:i.jsx(se,{icon:le}),onClick:n,sx:{borderRadius:4},children:"View on Chain"})]})]})}q.propTypes={meta:x.object.isRequired,type:x.string.isRequired,hideTips:x.bool,sx:x.object};q.defaultProps={hideTips:!1,sx:{}};function q({meta:e,type:t,hideTips:o=!1,sx:s}){return O(e)?null:t==="tips"&&!o?i.jsx($,{meta:e}):i.jsx(w,{variant:"subtitle2",fontSize:16,component:"p",sx:s,color:v.textSubtitle,children:e.content})}var ue=P;function he(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var M=he(ue);function j(){return j=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var o=arguments[t];for(var s in o)Object.prototype.hasOwnProperty.call(o,s)&&(e[s]=o[s])}return e},j.apply(this,arguments)}function fe(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,C(e,t)}function C(e,t){return C=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(s,n){return s.__proto__=n,s},C(e,t)}function me(e,t){if(e==null)return{};var o={},s=Object.keys(e),n,r;for(r=0;r<s.length;r++)n=s[r],!(t.indexOf(n)>=0)&&(o[n]=e[n]);return o}var A={position:"absolute",bottom:0,left:0,height:0,overflow:"hidden","padding-top":0,"padding-bottom":0,border:"none"},ge=["box-sizing","width","font-size","font-weight","font-family","font-style","letter-spacing","text-indent","white-space","word-break","overflow-wrap","padding-left","padding-right"];function ye(e,t){if(!e||typeof e!="object")return e;var o={};return Object.keys(e).forEach(function(s){t.indexOf(s)>-1||(o[s]=e[s])}),o}var xe=["component","className","unsafeHTML"];function V(e,t){if(t!=="letters"&&t!=="words")throw new Error("Unsupported options basedOn: "+t);if(e.nodeType===Node.TEXT_NODE){var o=document.createDocumentFragment(),s;switch(t){case"words":s=e.textContent.split(/\b|(?=\W)/);break;case"letters":s=Array.from(e.textContent);break}s.forEach(function(c){o.appendChild(ve(c))}),e.parentNode.replaceChild(o,e)}else if(e.nodeType===Node.ELEMENT_NODE)for(var n=[].slice.call(e.childNodes),r=n.length,a=0;a<r;a++)V(n[a],t)}function ve(e){var t=document.createElement("span");return t.className="LinesEllipsis-unit",t.textContent=e,t}function R(e){e.parentNode.replaceChild(document.createTextNode(e.textContent),e)}function G(e,t){if(!(!t.contains(e)||e===t)){for(;e.nextElementSibling;)e.parentNode.removeChild(e.nextElementSibling);G(e.parentNode,t)}}function be(e){for(var t=e;t=t.parentNode;)if(/p|div|main|section|h\d|ul|ol|li/.test(t.tagName.toLowerCase()))return t}function N(e){return!!(e.offsetHeight&&(e.offsetWidth||/\S/.test(e.textContent)))}var K={component:"div",unsafeHTML:"",maxLine:1,ellipsis:"…",ellipsisHTML:void 0,className:"",basedOn:void 0,onReflow:function(){},winWidth:void 0},Se=Object.keys(K),Y=function(e){fe(t,e);function t(s){var n;return n=e.call(this,s)||this,n.state={html:s.unsafeHTML,clamped:!1},n.canvas=null,n.maxLine=0,n.nlUnits=[],n}var o=t.prototype;return o.componentDidMount=function(){this.initCanvas(),this.reflow(this.props)},o.componentDidUpdate=function(n){n.winWidth!==this.props.winWidth&&this.copyStyleToCanvas(),this.props!==n&&this.reflow(this.props)},o.componentWillUnmount=function(){this.canvas.parentNode.removeChild(this.canvas),this.canvas=null},o.setState=function(n,r){return typeof n.clamped<"u"&&(this.clamped=n.clamped),e.prototype.setState.call(this,n,r)},o.initCanvas=function(){if(!this.canvas){var n=this.canvas=document.createElement("div");n.className="LinesEllipsis-canvas "+this.props.className,n.setAttribute("aria-hidden","true"),this.copyStyleToCanvas(),Object.keys(A).forEach(function(r){n.style[r]=A[r]}),document.body.appendChild(n)}},o.copyStyleToCanvas=function(){var n=this,r=window.getComputedStyle(this.target);ge.forEach(function(a){n.canvas.style[a]=r[a]})},o.reflow=function(n){this.maxLine=+n.maxLine||1,this.canvas.innerHTML=n.unsafeHTML;var r=n.basedOn||(/^[\x00-\x7F]+$/.test(n.unsafeHTML)?"words":"letters");V(this.canvas,r);var a=this.putEllipsis(this.calcIndexes()),c={clamped:a,html:this.canvas.innerHTML};this.setState(c,n.onReflow.bind(this,c))},o.calcIndexes=function(){var n=[0],r=this.nlUnits=Array.from(this.canvas.querySelectorAll(".LinesEllipsis-unit")),a=r.length;if(!r.length)return n;var c=r.find(N);if(!c)return n;for(var l=1,u=c.offsetTop,d=1;d<a&&!(N(r[d])&&r[d].offsetTop-u>1&&(l++,n.push(d),u=r[d].offsetTop,l>this.maxLine));d++);return n},o.putEllipsis=function(n){if(n.length<=this.maxLine)return!1;this.nlUnits=this.nlUnits.slice(0,n[this.maxLine]);var r=this.nlUnits.pop(),a=this.makeEllipsisSpan();do G(r,this.canvas),be(r).appendChild(a),r=this.nlUnits.pop();while(r&&(!N(r)||a.offsetHeight>r.offsetHeight||a.offsetTop>r.offsetTop));return r&&R(r),this.nlUnits.forEach(R),!0},o.makeEllipsisSpan=function(){var n=this.props,r=n.ellipsisHTML,a=n.ellipsis,c=document.createElement("span");c.appendChild(document.createElement("wbr"));var l=document.createElement("span");return l.className="LinesEllipsis-ellipsis",r?l.innerHTML=r:l.textContent=a,c.appendChild(l),c},o.isClamped=function(){return this.clamped},o.render=function(){var n=this,r=this.state,a=r.html,c=r.clamped,l=this.props,u=l.component,d=l.className,g=l.unsafeHTML,m=me(l,xe);return M.default.createElement(u,j({className:"LinesEllipsis "+(c?"LinesEllipsis--clamped":"")+" "+d,ref:function(f){return n.target=f}},ye(m,Se)),M.default.createElement("div",{dangerouslySetInnerHTML:{__html:c?a:g}}))},t}(M.default.Component);Y.defaultProps=K;var Le=Y;const qe=W(Le),Te=e=>{const t="explorer.arcblockio.cn";return e&&{beta:"beta.abtnetwork.io",main:"main.abtnetwork.io"}[e]||t},Ee=e=>{try{return new URL(e).host}catch{return e}};var Ve={getChainHost:Te,getUrlHost:Ee},Ge={linkStyle:{color:"#2754C5",fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif",fontSize:"14px",textDecoration:"underline"},actionsStyle:{margin:"20px -8px 0px"},actionStyle:{color:"#4598fa",fontSize:14,border:"1px solid #4598fa",display:"inline-block",borderRadius:"4px",margin:"8px",marginTop:"8px",marginBottom:"8px",marginLeft:"8px",marginRight:"8px"},assetStyle:{backgroundColor:"#f6f6f6",borderRadius:"8px",padding:"8px"},remarkStyle:{color:"#9397a1",fontSize:"12px",margin:0,whiteSpace:"pre-line!important"},summaryStyle:{color:"#49c3ad",fontWeight:700},titleStyle:{marginBottom:"6px"},severityColorMap:{normal:"#C4C5CA",success:"#25C99B",error:"#F16E6E",warning:"#DE9E37"},attachmentsStyle:{borderLeft:"2px solid transparent",paddingLeft:"20px"},h1Style:{color:"#333",fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif",fontSize:"24px",fontWeight:"bold",margin:"40px 0",padding:"0"},footerStyle:{color:"#898989",fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif",fontSize:"12px",lineHeight:"22px",margin:0}},we={year:{long:"year",short:"y"},day:{long:"day",short:"d"},hour:{long:"hour",short:"h"},minute:{long:"minute",short:"m"},second:{long:"second",short:"s"},millisecond:{long:"millisecond",short:"ms"},microsecond:{long:"microsecond",short:"µs"},nanosecond:{long:"nanosecond",short:"ns"}},Me={year:{long:"年",short:"年"},day:{long:"天",short:"天"},hour:{long:"小时",short:"小时"},minute:{long:"分钟",short:"分"},second:{long:"秒钟",short:"秒"},millisecond:{long:"毫秒",short:"毫秒"},microsecond:{long:"微秒",short:"微秒"},nanosecond:{long:"纳秒",short:"纳秒"}};const k=new Map,Ne=(e,t)=>{k.set(e,t)},je=(e="en_US")=>k.get(e)||k.get("en_US");var X={registerLang:Ne,getLang:je},Ce=e=>{if(typeof e!="number")throw new TypeError("Expected a number");const t=e>0?Math.floor:Math.ceil;return{days:t(e/864e5),hours:t(e/36e5)%24,minutes:t(e/6e4)%60,seconds:t(e/1e3)%60,milliseconds:t(e)%1e3,microseconds:t(e*1e3)%1e3,nanoseconds:t(e*1e6)%1e3}};const ke=Ce,{getLang:L}=X,_e=(e,t)=>t===1?e:`${e}s`,Ue=1e-7;var Oe=(e,t={})=>{if(!Number.isFinite(e))throw new TypeError("Expected a finite number");t.colonNotation&&(t.compact=!1,t.formatSubMilliseconds=!1,t.separateMilliseconds=!1,t.verbose=!1),t.compact&&(t.secondsDecimalDigits=0,t.millisecondsDecimalDigits=0);const o=L(t.locale),s=[],n=(c,l)=>{const u=Math.floor(c*10**l+Ue);return(Math.round(u)/10**l).toFixed(l)},r=(c,l,u)=>{if((s.length===0||!t.colonNotation)&&c===0&&!(t.colonNotation&&l==="minute"))return;const{long:d}=o[l]||L("en_US")[l],{short:g}=o[l]||L("en_US")[l];let m=(u||c||"0").toString(),y,f;if(t.colonNotation){y=s.length>0?":":"",f="";const p=m.includes(".")?m.split(".")[0].length:m.length,h=s.length>0?2:1;m="0".repeat(Math.max(0,h-p))+m}else y="",t.locale==="zh_CN"?Object.values(a).filter(p=>p>0).length>1?!a.days&&!a.hours&&a.minutes&&t.compact?f=d:f=g:a.minutes?f=d:f=g:f=t.verbose?` ${_e(d,c)}`:g;s.push(y+m+f)},a=ke(e);if(r(Math.trunc(a.days/365),"year"),r(a.days%365,"day"),r(a.hours,"hour"),r(a.minutes,"minute"),t.separateMilliseconds||t.formatSubMilliseconds||!t.colonNotation&&e<1e3)if(r(a.seconds,"second"),t.formatSubMilliseconds)r(a.milliseconds,"millisecond"),r(a.microseconds,"microsecond"),r(a.nanoseconds,"nanosecond");else{const c=a.milliseconds+a.microseconds/1e3+a.nanoseconds/1e6,l=typeof t.millisecondsDecimalDigits=="number"?t.millisecondsDecimalDigits:0,u=c>=1?Math.round(c):Math.ceil(c),d=l?c.toFixed(l):u;r(Number.parseFloat(d,10),"millisecond",d)}else{const c=e/1e3%60,l=typeof t.secondsDecimalDigits=="number"?t.secondsDecimalDigits:1,u=n(c,l),d=t.keepDecimalsOnWholeSeconds?u:u.replace(/\.0+$/,"");r(Number.parseFloat(d,10),"second",d)}if(s.length===0){const c=(o.millisecond||L("en_US").millisecond).long,l=(o.millisecond||L("en_US").millisecond).short;return t.locale==="zh_CN"?`0${t.verbose?`${c}`:l}`:`0${t.verbose?` ${c}s`:l}`}if(t.compact)return s[0];if(typeof t.unitCount=="number"){const c=t.colonNotation?"":" ";return s.slice(0,Math.max(t.unitCount,1)).join(c)}return t.colonNotation?s.join(""):s.join(" ")};const De=we,Fe=Me,{registerLang:D}=X,Q=Oe;D("en_US",De);D("zh_CN",Fe);Q.registerLang=D;var Ie=Q;const Ke=W(Ie);export{qe as H,q as M,ze as a,Ve as c,le as d,ie as g,oe as i,Be as m,Ke as p,Ge as s,$e as u};
1
+ import{r as P,b as J,g as W}from"./vendor-react-DEoibe3W.js";import{H as x,j as i,ao as B,s as _,w as ee,a9 as U,T as w,y as te}from"./vendor-mui-core-CQ38ohp2.js";import{f as E,u as H}from"./vendor-hooks-DftG_2gV.js";import{j as ne,i as v,I as se}from"./vendor-ux-did-connect-CsNUdA6Y.js";import{z as O,x as re,y as z}from"./vendor-utils-BNHJB5U7.js";const Be=e=>{if(!e||!e.length)return[];const t=[];let o=null,s=[];if(e.forEach(n=>{var y,f,p,h;if(!n.activity||!n.activity.type||!o){o&&(s.length===1?t.push(s[0]):(o.items=s,t.push(o))),n.activity&&n.activity.type?(o=n,s=[n]):(t.push(n),o=null,s=[]);return}const r=s[0].activity,a=r.type,c=(y=r.target)==null?void 0:y.type,l=(f=r.target)==null?void 0:f.id,u=n.activity.type,d=(p=n.activity.target)==null?void 0:p.type,g=(h=n.activity.target)==null?void 0:h.id;if(a&&u&&a===u&&(!r.target&&!n.activity.target||r.target&&n.activity.target&&c===d&&l===g))s.push(n);else{if(s.length===1)t.push(s[0]);else{const T=Object.assign({},o,{items:s});t.push(T)}o=n,s=[n]}}),o)if(s.length===1)t.push(s[0]);else{const n=Object.assign({},o,{items:s});t.push(n)}return t},oe=e=>!O(e.activity)&&!!e.activity.type&&!!e.activity.actor,ze=e=>oe(e)&&!!e.actorInfo&&!!e.actorInfo.did,ie=e=>{if(!e)return null;const{meta:t,target:o}=e;return{metaLink:t==null?void 0:t.id,targetLink:o==null?void 0:o.id}},S={COMMENT:"comment",LIKE:"like",FOLLOW:"follow",TIPS:"tips",MENTION:"mention",ASSIGN:"assign"},ae={[S.COMMENT]:(e,t)=>t>1?i.jsxs(i.Fragment,{children:["left ",t," comments on your ",e]}):i.jsxs(i.Fragment,{children:["commented on your ",e]}),[S.LIKE]:e=>i.jsxs(i.Fragment,{children:["liked your ",e]}),[S.FOLLOW]:()=>i.jsx(i.Fragment,{children:"followed you"}),[S.TIPS]:e=>i.jsxs(i.Fragment,{children:["gave tips to your ",e]}),[S.MENTION]:e=>i.jsxs(i.Fragment,{children:["mentioned you in ",e]}),[S.ASSIGN]:()=>i.jsx(i.Fragment,{children:"assigned you a task"})},b=P.memo(function({user:t,color:o=v.textBase}){const s=re(z(ne.WELLKNOWN_SERVICE_PATH_PREFIX,"user"),{did:t.did});return i.jsx(B,{href:s,color:o,fontWeight:600,target:"_blank",sx:{textDecoration:"none"},onClick:n=>{n.customPreventRedirect=!0},children:t.fullName||"System"})});b.propTypes={user:x.shape({did:x.string.isRequired,fullName:x.string.isRequired}).isRequired,color:x.string};b.displayName="UserLink";function $e({activity:e,users:t,actors:o,extra:s={},mountPoint:n=""}){const{type:r,target:a}=e||{},{type:c}=a||{},{linkColor:l=v.textBase}=s||{},u=E(()=>{if(!Array.isArray(t))return new Map;const p=new Map;return t.forEach(h=>{h!=null&&h.did&&!p.has(h.did)&&p.set(h.did,h)}),p},[t]),d=E(()=>Array.isArray(o)?o.map(p=>p?u.get(p)||{did:p,fullName:"System"}:null):[],[o,u]),g=H(()=>{if(!Array.isArray(d)||d.length===0)return null;if(d.length===1)return i.jsx(b,{user:d[0],color:l});const p=d.slice(0,-1),h=d[d.length-1];if(d.length===2)return i.jsxs(i.Fragment,{children:[i.jsx(b,{user:p[0],color:l})," and ",i.jsx(b,{user:h,color:l})]});const T=d.length>3,F=T?d.slice(0,2):p;return i.jsxs(i.Fragment,{children:[F.map((I,Z)=>i.jsxs(J.Fragment,{children:[i.jsx(b,{user:I,color:l}),Z<F.length-1?", ":""]},I.did)),T?`, and ${d.length-2} others`:i.jsxs(i.Fragment,{children:[", and ",i.jsx(b,{user:h,color:l})]})]})}),m=H(()=>{const p=ae[r];return p?p(c,t.length):null}),y=E(()=>{const p=g(),h=m();return!p||!h?null:i.jsxs(i.Fragment,{children:[p," ",h]})},[r,c,d,g,m]),f=E(()=>{if(!e)return null;const p=ie(e);return p!=null&&p.targetLink?z(n,p.targetLink):null},[e,n]);return!r||O(a)?null:i.jsxs(i.Fragment,{children:[y," ",i.jsx(B,{href:f,color:v.primaryBase,target:"_blank",sx:{textDecoration:"none"},onClick:p=>{p.customPreventRedirect=!0},children:a.name})]})}const le={width:24,height:24,body:'<path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M17 7L7 17M8 7h9v9"/>'};$.propTypes={meta:x.object.isRequired};const ce=_(ee)(({theme:e})=>({maxWidth:320,display:"flex",flexDirection:"column",gap:e.spacing(1.5),padding:e.spacing(2),marginTop:e.spacing(1),borderRadius:e.spacing(1),border:`1px solid ${v.dividerColor}`,boxShadow:"none"})),de=_(U)(({theme:e})=>({display:"flex",justifyContent:"flex-start",alignItems:"center",gap:e.spacing(1),marginBottom:e.spacing(1)})),pe=_(U)({display:"flex",justifyContent:"space-between",alignItems:"center"});function $({meta:e}){const{amount:t,symbol:o,chainId:s}=e,n=()=>{window.open(`https://explorer.arcblock.io/chain/${s}`,"_blank")};return i.jsxs(ce,{children:[i.jsxs(de,{children:[i.jsx("img",{alt:"ArcBlock Beta",src:"https://bbqat7g5cg33cyr4pdrd6foycgzfb5xxeh2se7gcqkq.did.abtnet.io/payment-kit/methods/arcblock.png",width:32,height:32,style:{borderRadius:16}}),i.jsx(w,{variant:"h5",color:v.textBase,children:"ArcBlock"})]}),i.jsxs(pe,{children:[i.jsxs(U,{display:"flex",alignItems:"baseline",gap:1,children:[i.jsxs(w,{component:"span",variant:"h5",color:v.textBase,fontWeight:"bold",children:["+ ",t]}),i.jsx(w,{component:"span",variant:"subtitle2",color:v.textSubtitle,children:o})]}),i.jsx(te,{variant:"outlined",size:"small",color:"secondary",endIcon:i.jsx(se,{icon:le}),onClick:n,sx:{borderRadius:4},children:"View on Chain"})]})]})}q.propTypes={meta:x.object.isRequired,type:x.string.isRequired,hideTips:x.bool,sx:x.object};q.defaultProps={hideTips:!1,sx:{}};function q({meta:e,type:t,hideTips:o=!1,sx:s}){return O(e)?null:t==="tips"&&!o?i.jsx($,{meta:e}):i.jsx(w,{variant:"subtitle2",fontSize:16,component:"p",sx:s,color:v.textSubtitle,children:e.content})}var ue=P;function he(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var M=he(ue);function j(){return j=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var o=arguments[t];for(var s in o)Object.prototype.hasOwnProperty.call(o,s)&&(e[s]=o[s])}return e},j.apply(this,arguments)}function fe(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,C(e,t)}function C(e,t){return C=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(s,n){return s.__proto__=n,s},C(e,t)}function me(e,t){if(e==null)return{};var o={},s=Object.keys(e),n,r;for(r=0;r<s.length;r++)n=s[r],!(t.indexOf(n)>=0)&&(o[n]=e[n]);return o}var A={position:"absolute",bottom:0,left:0,height:0,overflow:"hidden","padding-top":0,"padding-bottom":0,border:"none"},ge=["box-sizing","width","font-size","font-weight","font-family","font-style","letter-spacing","text-indent","white-space","word-break","overflow-wrap","padding-left","padding-right"];function ye(e,t){if(!e||typeof e!="object")return e;var o={};return Object.keys(e).forEach(function(s){t.indexOf(s)>-1||(o[s]=e[s])}),o}var xe=["component","className","unsafeHTML"];function V(e,t){if(t!=="letters"&&t!=="words")throw new Error("Unsupported options basedOn: "+t);if(e.nodeType===Node.TEXT_NODE){var o=document.createDocumentFragment(),s;switch(t){case"words":s=e.textContent.split(/\b|(?=\W)/);break;case"letters":s=Array.from(e.textContent);break}s.forEach(function(c){o.appendChild(ve(c))}),e.parentNode.replaceChild(o,e)}else if(e.nodeType===Node.ELEMENT_NODE)for(var n=[].slice.call(e.childNodes),r=n.length,a=0;a<r;a++)V(n[a],t)}function ve(e){var t=document.createElement("span");return t.className="LinesEllipsis-unit",t.textContent=e,t}function R(e){e.parentNode.replaceChild(document.createTextNode(e.textContent),e)}function G(e,t){if(!(!t.contains(e)||e===t)){for(;e.nextElementSibling;)e.parentNode.removeChild(e.nextElementSibling);G(e.parentNode,t)}}function be(e){for(var t=e;t=t.parentNode;)if(/p|div|main|section|h\d|ul|ol|li/.test(t.tagName.toLowerCase()))return t}function N(e){return!!(e.offsetHeight&&(e.offsetWidth||/\S/.test(e.textContent)))}var K={component:"div",unsafeHTML:"",maxLine:1,ellipsis:"…",ellipsisHTML:void 0,className:"",basedOn:void 0,onReflow:function(){},winWidth:void 0},Se=Object.keys(K),Y=function(e){fe(t,e);function t(s){var n;return n=e.call(this,s)||this,n.state={html:s.unsafeHTML,clamped:!1},n.canvas=null,n.maxLine=0,n.nlUnits=[],n}var o=t.prototype;return o.componentDidMount=function(){this.initCanvas(),this.reflow(this.props)},o.componentDidUpdate=function(n){n.winWidth!==this.props.winWidth&&this.copyStyleToCanvas(),this.props!==n&&this.reflow(this.props)},o.componentWillUnmount=function(){this.canvas.parentNode.removeChild(this.canvas),this.canvas=null},o.setState=function(n,r){return typeof n.clamped<"u"&&(this.clamped=n.clamped),e.prototype.setState.call(this,n,r)},o.initCanvas=function(){if(!this.canvas){var n=this.canvas=document.createElement("div");n.className="LinesEllipsis-canvas "+this.props.className,n.setAttribute("aria-hidden","true"),this.copyStyleToCanvas(),Object.keys(A).forEach(function(r){n.style[r]=A[r]}),document.body.appendChild(n)}},o.copyStyleToCanvas=function(){var n=this,r=window.getComputedStyle(this.target);ge.forEach(function(a){n.canvas.style[a]=r[a]})},o.reflow=function(n){this.maxLine=+n.maxLine||1,this.canvas.innerHTML=n.unsafeHTML;var r=n.basedOn||(/^[\x00-\x7F]+$/.test(n.unsafeHTML)?"words":"letters");V(this.canvas,r);var a=this.putEllipsis(this.calcIndexes()),c={clamped:a,html:this.canvas.innerHTML};this.setState(c,n.onReflow.bind(this,c))},o.calcIndexes=function(){var n=[0],r=this.nlUnits=Array.from(this.canvas.querySelectorAll(".LinesEllipsis-unit")),a=r.length;if(!r.length)return n;var c=r.find(N);if(!c)return n;for(var l=1,u=c.offsetTop,d=1;d<a&&!(N(r[d])&&r[d].offsetTop-u>1&&(l++,n.push(d),u=r[d].offsetTop,l>this.maxLine));d++);return n},o.putEllipsis=function(n){if(n.length<=this.maxLine)return!1;this.nlUnits=this.nlUnits.slice(0,n[this.maxLine]);var r=this.nlUnits.pop(),a=this.makeEllipsisSpan();do G(r,this.canvas),be(r).appendChild(a),r=this.nlUnits.pop();while(r&&(!N(r)||a.offsetHeight>r.offsetHeight||a.offsetTop>r.offsetTop));return r&&R(r),this.nlUnits.forEach(R),!0},o.makeEllipsisSpan=function(){var n=this.props,r=n.ellipsisHTML,a=n.ellipsis,c=document.createElement("span");c.appendChild(document.createElement("wbr"));var l=document.createElement("span");return l.className="LinesEllipsis-ellipsis",r?l.innerHTML=r:l.textContent=a,c.appendChild(l),c},o.isClamped=function(){return this.clamped},o.render=function(){var n=this,r=this.state,a=r.html,c=r.clamped,l=this.props,u=l.component,d=l.className,g=l.unsafeHTML,m=me(l,xe);return M.default.createElement(u,j({className:"LinesEllipsis "+(c?"LinesEllipsis--clamped":"")+" "+d,ref:function(f){return n.target=f}},ye(m,Se)),M.default.createElement("div",{dangerouslySetInnerHTML:{__html:c?a:g}}))},t}(M.default.Component);Y.defaultProps=K;var Le=Y;const qe=W(Le),Te=e=>{const t="explorer.arcblockio.cn";return e&&{beta:"beta.abtnetwork.io",main:"main.abtnetwork.io"}[e]||t},Ee=e=>{try{return new URL(e).host}catch{return e}};var Ve={getChainHost:Te,getUrlHost:Ee},Ge={linkStyle:{color:"#2754C5",fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif",fontSize:"14px",textDecoration:"underline"},actionsStyle:{margin:"20px -8px 0px"},actionStyle:{color:"#4598fa",fontSize:14,border:"1px solid #4598fa",display:"inline-block",borderRadius:"4px",margin:"8px",marginTop:"8px",marginBottom:"8px",marginLeft:"8px",marginRight:"8px"},assetStyle:{backgroundColor:"#f6f6f6",borderRadius:"8px",padding:"8px"},remarkStyle:{color:"#9397a1",fontSize:"12px",margin:0,whiteSpace:"pre-line!important"},summaryStyle:{color:"#49c3ad",fontWeight:700},titleStyle:{marginBottom:"6px"},severityColorMap:{normal:"#C4C5CA",success:"#25C99B",error:"#F16E6E",warning:"#DE9E37"},attachmentsStyle:{borderLeft:"2px solid transparent",paddingLeft:"20px"},h1Style:{color:"#333",fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif",fontSize:"24px",fontWeight:"bold",margin:"40px 0",padding:"0"},footerStyle:{color:"#898989",fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif",fontSize:"12px",lineHeight:"22px",margin:0}},we={year:{long:"year",short:"y"},day:{long:"day",short:"d"},hour:{long:"hour",short:"h"},minute:{long:"minute",short:"m"},second:{long:"second",short:"s"},millisecond:{long:"millisecond",short:"ms"},microsecond:{long:"microsecond",short:"µs"},nanosecond:{long:"nanosecond",short:"ns"}},Me={year:{long:"年",short:"年"},day:{long:"天",short:"天"},hour:{long:"小时",short:"小时"},minute:{long:"分钟",short:"分"},second:{long:"秒钟",short:"秒"},millisecond:{long:"毫秒",short:"毫秒"},microsecond:{long:"微秒",short:"微秒"},nanosecond:{long:"纳秒",short:"纳秒"}};const k=new Map,Ne=(e,t)=>{k.set(e,t)},je=(e="en_US")=>k.get(e)||k.get("en_US");var X={registerLang:Ne,getLang:je},Ce=e=>{if(typeof e!="number")throw new TypeError("Expected a number");const t=e>0?Math.floor:Math.ceil;return{days:t(e/864e5),hours:t(e/36e5)%24,minutes:t(e/6e4)%60,seconds:t(e/1e3)%60,milliseconds:t(e)%1e3,microseconds:t(e*1e3)%1e3,nanoseconds:t(e*1e6)%1e3}};const ke=Ce,{getLang:L}=X,_e=(e,t)=>t===1?e:`${e}s`,Ue=1e-7;var Oe=(e,t={})=>{if(!Number.isFinite(e))throw new TypeError("Expected a finite number");t.colonNotation&&(t.compact=!1,t.formatSubMilliseconds=!1,t.separateMilliseconds=!1,t.verbose=!1),t.compact&&(t.secondsDecimalDigits=0,t.millisecondsDecimalDigits=0);const o=L(t.locale),s=[],n=(c,l)=>{const u=Math.floor(c*10**l+Ue);return(Math.round(u)/10**l).toFixed(l)},r=(c,l,u)=>{if((s.length===0||!t.colonNotation)&&c===0&&!(t.colonNotation&&l==="minute"))return;const{long:d}=o[l]||L("en_US")[l],{short:g}=o[l]||L("en_US")[l];let m=(u||c||"0").toString(),y,f;if(t.colonNotation){y=s.length>0?":":"",f="";const p=m.includes(".")?m.split(".")[0].length:m.length,h=s.length>0?2:1;m="0".repeat(Math.max(0,h-p))+m}else y="",t.locale==="zh_CN"?Object.values(a).filter(p=>p>0).length>1?!a.days&&!a.hours&&a.minutes&&t.compact?f=d:f=g:a.minutes?f=d:f=g:f=t.verbose?` ${_e(d,c)}`:g;s.push(y+m+f)},a=ke(e);if(r(Math.trunc(a.days/365),"year"),r(a.days%365,"day"),r(a.hours,"hour"),r(a.minutes,"minute"),t.separateMilliseconds||t.formatSubMilliseconds||!t.colonNotation&&e<1e3)if(r(a.seconds,"second"),t.formatSubMilliseconds)r(a.milliseconds,"millisecond"),r(a.microseconds,"microsecond"),r(a.nanoseconds,"nanosecond");else{const c=a.milliseconds+a.microseconds/1e3+a.nanoseconds/1e6,l=typeof t.millisecondsDecimalDigits=="number"?t.millisecondsDecimalDigits:0,u=c>=1?Math.round(c):Math.ceil(c),d=l?c.toFixed(l):u;r(Number.parseFloat(d,10),"millisecond",d)}else{const c=e/1e3%60,l=typeof t.secondsDecimalDigits=="number"?t.secondsDecimalDigits:1,u=n(c,l),d=t.keepDecimalsOnWholeSeconds?u:u.replace(/\.0+$/,"");r(Number.parseFloat(d,10),"second",d)}if(s.length===0){const c=(o.millisecond||L("en_US").millisecond).long,l=(o.millisecond||L("en_US").millisecond).short;return t.locale==="zh_CN"?`0${t.verbose?`${c}`:l}`:`0${t.verbose?` ${c}s`:l}`}if(t.compact)return s[0];if(typeof t.unitCount=="number"){const c=t.colonNotation?"":" ";return s.slice(0,Math.max(t.unitCount,1)).join(c)}return t.colonNotation?s.join(""):s.join(" ")};const De=we,Fe=Me,{registerLang:D}=X,Q=Oe;D("en_US",De);D("zh_CN",Fe);Q.registerLang=D;var Ie=Q;const Ke=W(Ie);export{qe as H,q as M,ze as a,Ve as c,le as d,ie as g,oe as i,Be as m,Ke as p,Ge as s,$e as u};