@abtnode/blocklet-services 1.17.4-beta-20251201-225048-b1682a09 → 1.17.4-beta-20251202-122551-267b614d

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 (211) hide show
  1. package/api/routes/user.js +2 -0
  2. package/api/services/notification/queue.js +190 -102
  3. package/api/socket/channel/did.js +80 -34
  4. package/api/util/user-util.js +6 -1
  5. package/dist/assets/{AdapterDayjs-OZNn2tpO.js → AdapterDayjs-BuAhqT20.js} +1 -1
  6. package/dist/assets/{Google-PoHjNVzr.js → Google-Dp7qGnxg.js} +1 -1
  7. package/dist/assets/{access-control-BpDf5eCc.js → access-control-B9EJ5tQF.js} +1 -1
  8. package/dist/assets/{actions-CIp6hu8_.js → actions-DhSvOHy-.js} +1 -1
  9. package/dist/assets/{add-component-core-DZMleaf7.js → add-component-core-VVqL08Uq.js} +21 -21
  10. package/dist/assets/{add-resource-fReirUEj.js → add-resource-DPXu2LFD.js} +1 -1
  11. package/dist/assets/{addon-CD2tT3Vk.js → addon-DimuRKXu.js} +1 -1
  12. package/dist/assets/{advanced-D_HYmeDL.js → advanced-C-M8n1zk.js} +1 -1
  13. package/dist/assets/{aigne-DKzLdZPY.js → aigne-Blnb_Xmg.js} +1 -1
  14. package/dist/assets/{appearance-DoI_K1yx.js → appearance-DcbXeaDh.js} +1 -1
  15. package/dist/assets/ar-C89Z16Ql.js +7 -0
  16. package/dist/assets/{arrow-down.svg-mj2eIUoA.js → arrow-down.svg-CNh-MHKv.js} +1 -1
  17. package/dist/assets/{audit-logs-CBeb46aa.js → audit-logs-D0mYj6Ut.js} +1 -1
  18. package/dist/assets/{authorize-BQTDaD7S.js → authorize-CZdmLVec.js} +1 -1
  19. package/dist/assets/{base-chart-DvlyWvB2.js → base-chart-DJyGks5q.js} +1 -1
  20. package/dist/assets/{base32-AX-I0UaR.js → base32-CnxuWLTI.js} +1 -1
  21. package/dist/assets/{bind-account--wlCwoIh.js → bind-account-GnACtKqD.js} +1 -1
  22. package/dist/assets/{branding-Sd6X0YqE.js → branding-CFP8OuF1.js} +1 -1
  23. package/dist/assets/branding-CihykCDo.js +1 -0
  24. package/dist/assets/{branding-CMNxsyrp.js → branding-DmNLEN0a.js} +4 -4
  25. package/dist/assets/{bundle-avatar-DACPWlAj.js → bundle-avatar-D3mFZG-3.js} +1 -1
  26. package/dist/assets/button-pTTwNqRf.js +1 -0
  27. package/dist/assets/{click-to-copy-DZ_4RDjR.js → click-to-copy-CAd3nEo4.js} +1 -1
  28. package/dist/assets/{collapse-CHg4yEHL.js → collapse-CzqKk-Uw.js} +1 -1
  29. package/dist/assets/{complete-BIrSCTBJ.js → complete-BDYaBiHT.js} +1 -1
  30. package/dist/assets/{component-BrH7uZv7.js → component-D_iXTtDp.js} +2 -2
  31. package/dist/assets/{config-BbbJtsEK.js → config--X9TgCMx.js} +1 -1
  32. package/dist/assets/{config-C0IukdMa.js → config-C_UzRk_x.js} +3 -3
  33. package/dist/assets/{config-navigation-CPqSm2b8.js → config-navigation-zOEBEK_N.js} +2 -2
  34. package/dist/assets/{config-space-B6ikfnoY.js → config-space-D1vOxWrR.js} +1 -1
  35. package/dist/assets/{config-BlvlFPnu.js → config-xLf7B5vm.js} +1 -1
  36. package/dist/assets/{confirm-Dge1BR0a.js → confirm-CC1M9sYT.js} +1 -1
  37. package/dist/assets/{connect-DwftqrTP.js → connect-4mXUuWwC.js} +1 -1
  38. package/dist/assets/{connect-DwfU2nBg.js → connect-BpoYmTzp.js} +1 -1
  39. package/dist/assets/{connect-to-D3Fxg-mH.js → connect-to-YDMOcSyq.js} +1 -1
  40. package/dist/assets/{content-layout-RghQFMLL.js → content-layout-B-2tfq3i.js} +1 -1
  41. package/dist/assets/{create-passport-svg-BZVXsAoP.js → create-passport-svg-BLBQxsEK.js} +1 -1
  42. package/dist/assets/{createClass-dlbhjEVd.js → createClass-mqcDPFI4.js} +1 -1
  43. package/dist/assets/{dashboard-BZMyxtap.js → dashboard-DeaTlS85.js} +2 -2
  44. package/dist/assets/de-BsCDrfBl.js +7 -0
  45. package/dist/assets/{delete-confirm-CaK42Rqi.js → delete-confirm-DF03c_mf.js} +1 -1
  46. package/dist/assets/{did-address-CihvGtuj.js → did-address-BOsJWqi1.js} +1 -1
  47. package/dist/assets/{domain-DZhOKUFR.js → domain-DdkBc4bt.js} +1 -1
  48. package/dist/assets/{domain-action-card-KBcfeUDt.js → domain-action-card-B8tM4_TO.js} +1 -1
  49. package/dist/assets/domains-CdpvlDLA.js +1 -0
  50. package/dist/assets/{email-mM-fSS-l.js → email-DOKW1a_7.js} +1 -1
  51. package/dist/assets/{empty-spinner-2ylB84wv.js → empty-spinner-G6osPzkH.js} +1 -1
  52. package/dist/assets/engine-BsqbrwXE.js +1 -0
  53. package/dist/assets/es-BJh_XsEm.js +9 -0
  54. package/dist/assets/{exchange-passport-CL0-QMoV.js → exchange-passport-Dnbu3e66.js} +1 -1
  55. package/dist/assets/{form-BQvsWiOt.js → form-mmswDYpL.js} +1 -1
  56. package/dist/assets/form-text-input-BFJU5Psq.js +11 -0
  57. package/dist/assets/{form-wrapper-CqFSijKV.js → form-wrapper-CU8kJXy5.js} +1 -1
  58. package/dist/assets/fr-DRJMwn7V.js +7 -0
  59. package/dist/assets/{fuel-BpMa6xEp.js → fuel-CpCUHgkW.js} +1 -1
  60. package/dist/assets/{gen-access-key-BLtBtR5W.js → gen-access-key-OHc0npoi.js} +1 -1
  61. package/dist/assets/{gen-simple-access-key-9tFWfYxA.js → gen-simple-access-key-C6tIufX7.js} +1 -1
  62. package/dist/assets/get-safe-url-DUB5fSqh.js +1 -0
  63. package/dist/assets/hi-h-9Yl5g9.js +5 -0
  64. package/dist/assets/{home-BG4Bn0-p.js → home-BFI-HNBw.js} +1 -1
  65. package/dist/assets/id-BDWggRsa.js +7 -0
  66. package/dist/assets/{iframe-BjsS1KQR.js → iframe-DB0OcQ6i.js} +1 -1
  67. package/dist/assets/{index-B00Da_zr.js → index-3hHmW6B5.js} +1 -1
  68. package/dist/assets/{index-DsQDfClt.js → index-7uZYu-Ep.js} +1 -1
  69. package/dist/assets/{index-bbu7QFpz.js → index-BIJNkmLb.js} +1 -1
  70. package/dist/assets/{index-sfOXn4Gu.js → index-BMkJtBkv.js} +2 -2
  71. package/dist/assets/{index-C40tsw4I.js → index-Bj8J6jnM.js} +1 -1
  72. package/dist/assets/{index-D6MFQa2J.js → index-Bksy_mMO.js} +1 -1
  73. package/dist/assets/{index-B8mnhcds.js → index-Bns8G6yV.js} +2 -2
  74. package/dist/assets/{index-DEDj0oVc.js → index-BphmxdkH.js} +1 -1
  75. package/dist/assets/index-BsP0-mXD.js +124 -0
  76. package/dist/assets/{index-B8uWH9ks.js → index-BuIBrsUM.js} +1 -1
  77. package/dist/assets/index-Bw9XS3Zt.js +7 -0
  78. package/dist/assets/{index-CxJOg5jI.js → index-C3BK6ln_.js} +1 -1
  79. package/dist/assets/{index-B9Igf2rm.js → index-C3cD5fjJ.js} +1 -1
  80. package/dist/assets/{index-h0Os_ox8.js → index-CDE0c6ul.js} +1 -1
  81. package/dist/assets/{index-BmuOS9l2.js → index-CDFYQ7q2.js} +1 -1
  82. package/dist/assets/{index-5hr4oNRS.js → index-CEyMJtzZ.js} +3 -3
  83. package/dist/assets/{index-KUb_kVWp.js → index-CHbWK92_.js} +2 -2
  84. package/dist/assets/{index-BF7MtybM.js → index-Ca4Ccmqm.js} +1 -1
  85. package/dist/assets/{index-lFDZOk_k.js → index-CeWTwSLE.js} +66 -66
  86. package/dist/assets/{index-B4Q4y_7n.js → index-CtouYMiN.js} +1 -1
  87. package/dist/assets/{index-D9UpcFKi.js → index-D0pDhWRx.js} +1 -1
  88. package/dist/assets/{index-BVYUGxzR.js → index-D8w8SYuc.js} +1 -1
  89. package/dist/assets/{index-Cy73v3o9.js → index-DUFdTykg.js} +1 -1
  90. package/dist/assets/{index-BIlfbBZ2.js → index-DWuLUiY3.js} +1 -1
  91. package/dist/assets/index-Duwa2sz8.js +1 -0
  92. package/dist/assets/{index-CO3X6G_g.js → index-Dx6HKVtJ.js} +1 -1
  93. package/dist/assets/{index-yGC4DbEU.js → index-Dy3yCmIK.js} +1 -1
  94. package/dist/assets/{index-BUomsang.js → index-V1TR40-z.js} +1 -1
  95. package/dist/assets/{index-BoeLorfn.js → index-WCk612vr.js} +1 -1
  96. package/dist/assets/{index-BzCDxVOL.js → index-Xg-It3qI.js} +1 -1
  97. package/dist/assets/{index-CgTWMV4T.js → index-ohq48KFN.js} +1 -1
  98. package/dist/assets/{index-V83VNrab.js → index-wS_uPsSR.js} +1 -1
  99. package/dist/assets/{invitation-LJOuA09f.js → invitation-BqyhoSaQ.js} +1 -1
  100. package/dist/assets/{invitations-DtmYY9Tr.js → invitations-Dmx5LkD1.js} +1 -1
  101. package/dist/assets/{invite-DrIYCYzj.js → invite-E-ZdmNWy.js} +1 -1
  102. package/dist/assets/{isURL-fcz3vuMN.js → isURL-HS60va5G.js} +1 -1
  103. package/dist/assets/{issue-passport-Dv9gH2LH.js → issue-passport-DhA2Aw2n.js} +1 -1
  104. package/dist/assets/{item-weuCOdTL.js → item-B8ah25gH.js} +1 -1
  105. package/dist/assets/ja-R9EF3xbB.js +9 -0
  106. package/dist/assets/ko-C_QLPZyk.js +9 -0
  107. package/dist/assets/{landing-page-Djj9jDve.js → landing-page-DQBBERn_.js} +1 -1
  108. package/dist/assets/{launch-result-message-AcBN2VCj.js → launch-result-message-CO-R7GIB.js} +1 -1
  109. package/dist/assets/{layout-0zU7a-3v.js → layout-DUsIwJhf.js} +1 -1
  110. package/dist/assets/{list-DXe9E4ws.js → list-C6OYD0M-.js} +3 -3
  111. package/dist/assets/{list-Co62gn7d.js → list-CLMUEykk.js} +1 -1
  112. package/dist/assets/{list-header-CA-QkwGq.js → list-header-Cv_gaaAc.js} +1 -1
  113. package/dist/assets/localization-CutEJG9u.js +1 -0
  114. package/dist/assets/{log-BCC7blv9.js → log-CaIfb_mj.js} +1 -1
  115. package/dist/assets/logger-CjpdOowp.js +1 -0
  116. package/dist/assets/{login-DlWL3WVr.js → login-N9lwWO_e.js} +1 -1
  117. package/dist/assets/{login-oauth-callback-CQFS2s22.js → login-oauth-callback-U2rdasmV.js} +1 -1
  118. package/dist/assets/{logo-uploader-Dz85eY-W.js → logo-uploader-BgXq5jHQ.js} +1 -1
  119. package/dist/assets/{lost-passport-pRlBbp2M.js → lost-passport-CPwExoAp.js} +1 -1
  120. package/dist/assets/{observability-Bzq6nAvX.js → observability-SEfRhcXj.js} +1 -1
  121. package/dist/assets/{open-window-X4W6wF0y.js → open-window-BPgl9r9H.js} +1 -1
  122. package/dist/assets/{over-due-invoice-payment-CvKa0suc.js → over-due-invoice-payment-Hi-FNl9O.js} +1 -1
  123. package/dist/assets/{overview-d6xffU9N.js → overview-DPJo9CyG.js} +2 -2
  124. package/dist/assets/{page-header-B4MDj6gy.js → page-header-BkgoSN-0.js} +1 -1
  125. package/dist/assets/{passport-DHiNUeVn.js → passport-DMZiwbhL.js} +1 -1
  126. package/dist/assets/{passport-item-BkmVlAdr.js → passport-item-yqBy6NcY.js} +1 -1
  127. package/dist/assets/{permission-B3_OQqtH.js → permission-CiiVpApl.js} +1 -1
  128. package/dist/assets/{playground-C71u8_tm.js → playground-Bo63Spph.js} +1 -1
  129. package/dist/assets/preferences-YgFBqLbX.js +1 -0
  130. package/dist/assets/profile-embed-C35dSucs.js +1 -0
  131. package/dist/assets/pt-DpYO8djd.js +5 -0
  132. package/dist/assets/{publish-resource-Aoo5xCZX.js → publish-resource-DUDgKqzf.js} +1 -1
  133. package/dist/assets/{react-beautiful-dnd.esm--C1KYPc1.js → react-beautiful-dnd.esm-Clor-N66.js} +1 -1
  134. package/dist/assets/{react-stripe.esm-DlJMzZK2.js → react-stripe.esm-C-04j7I2.js} +1 -1
  135. package/dist/assets/{required-glXJjYm5.js → required-Btg6mEmX.js} +1 -1
  136. package/dist/assets/ru-DkZtar3s.js +5 -0
  137. package/dist/assets/{runtime-xK-SJ1cq.js → runtime-B_yu4wL5.js} +1 -1
  138. package/dist/assets/sdk-D9qYMy_G.js +1 -0
  139. package/dist/assets/{section-4gVAq_Fp.js → section-Cyr0YvGa.js} +1 -1
  140. package/dist/assets/{security-B3q0KDVH.js → security-YhrYNktK.js} +1 -1
  141. package/dist/assets/{session-DR7jqIW5.js → session-CJQ7HeL8.js} +1 -1
  142. package/dist/assets/{setup-CPrn9v2_.js → setup-DVxC6L1D.js} +1 -1
  143. package/dist/assets/{shorten-label-Cf--RqV-.js → shorten-label-D6jbe4l0.js} +1 -1
  144. package/dist/assets/{simple-select-SyYgbCc2.js → simple-select-BW6-FLlf.js} +1 -1
  145. package/dist/assets/{spaces-C_pXJSzm.js → spaces-DB-xtAK9.js} +1 -1
  146. package/dist/assets/{start-BUxgx8Ah.js → start-CnOduVio.js} +1 -1
  147. package/dist/assets/{starting-progress-BP_Sqg1X.js → starting-progress-Qp2T3eDZ.js} +1 -1
  148. package/dist/assets/{status-CE6iXPs_.js → status-B2iiuI6t.js} +1 -1
  149. package/dist/assets/{step-actions-tRQyAl6A.js → step-actions-D7ku0W0o.js} +1 -1
  150. package/dist/assets/{studio-bbXFMut7.js → studio-DtnYEBjZ.js} +1 -1
  151. package/dist/assets/switch-CjOUxynL.js +1 -0
  152. package/dist/assets/{switch-control-DdOZdvsu.js → switch-control-BFsTsyuN.js} +1 -1
  153. package/dist/assets/{table-tips-cVuoMOXE.js → table-tips-EHWVzPWe.js} +1 -1
  154. package/dist/assets/{team-KWOyNaWn.js → team-CKeHAIQC.js} +1 -1
  155. package/dist/assets/th-04iX5CrT.js +5 -0
  156. package/dist/assets/{traffic-ChddnVTm.js → traffic-NcU-KhYi.js} +1 -1
  157. package/dist/assets/{transfer-CcCi6t4X.js → transfer-CB2s8PFZ.js} +1 -1
  158. package/dist/assets/{unsubscribe-Bp5VQCnR.js → unsubscribe-a8AJuSFd.js} +1 -1
  159. package/dist/assets/{use-app-logo-hGlkw2d_.js → use-app-logo-D38VoM1R.js} +1 -1
  160. package/dist/assets/{use-mobile-BpPz1bKz.js → use-mobile-C5RjvO7g.js} +1 -1
  161. package/dist/assets/{use-mobile-DoKVMODs.js → use-mobile-ajdJIsoX.js} +1 -1
  162. package/dist/assets/{use-server-logo-UGU40YsW.js → use-server-logo-D4Yh4atf.js} +1 -1
  163. package/dist/assets/{use-window-close-CbUhh9L6.js → use-window-close-Bo92fPIm.js} +1 -1
  164. package/dist/assets/{useAsyncRetry-DHTJ61Jg.js → useAsyncRetry-a2Wewn3F.js} +1 -1
  165. package/dist/assets/{useLocalStorage-UFpv-3wa.js → useLocalStorage-BBhMedc2.js} +1 -1
  166. package/dist/assets/{user-center-CXduwafJ.js → user-center-BNMJJTvG.js} +2 -2
  167. package/dist/assets/{user-follower-CmGz7Inx.js → user-follower-BXm4RUI2.js} +1 -1
  168. package/dist/assets/{util-MbDHkO8z.js → util-DPC-rfKa.js} +1 -1
  169. package/dist/assets/{util-D-cKMKUM.js → util-MwdZAHoO.js} +1 -1
  170. package/dist/assets/{vendor-arcblock-3xKfH3F1.js → vendor-arcblock-BL_VyzmH.js} +1 -1
  171. package/dist/assets/{vendor-mui-core-DHT36AZL.js → vendor-mui-core-BPQ6AEW_.js} +2 -2
  172. package/dist/assets/{vendor-mui-x-B4OOX5Es.js → vendor-mui-x-CWNb8fsW.js} +1 -1
  173. package/dist/assets/{vendor-ux-sqP3hEhY.js → vendor-ux-D507n6h6.js} +1 -1
  174. package/dist/assets/vi-kOP0E9Ga.js +5 -0
  175. package/dist/assets/{wait-connect-DDyEqw4h.js → wait-connect-Of13xq9u.js} +1 -1
  176. package/dist/assets/{wizard-B588KidT.js → wizard-BXTkkerl.js} +1 -1
  177. package/dist/assets/{wizard-components-DP7Z_TTm.js → wizard-components-BZ6jYzgt.js} +1 -1
  178. package/dist/assets/wrap-locale-CPp4ppiN.js +1 -0
  179. package/dist/assets/{zh-C_L8CY4f.js → zh-8l1HXCDx.js} +1 -1
  180. package/dist/assets/{zh-98nxdLeR.js → zh-DZI4Yy2m.js} +3 -3
  181. package/dist/assets/{zh-tw-BdDE7n5E.js → zh-tw-BLapUUeq.js} +2 -2
  182. package/dist/index.html +1 -1
  183. package/dist/service-worker.js +1 -1
  184. package/package.json +23 -23
  185. package/dist/assets/ar-BJZY7v5z.js +0 -7
  186. package/dist/assets/branding-Bs3FNZ79.js +0 -1
  187. package/dist/assets/button-8Nchte_6.js +0 -1
  188. package/dist/assets/de-BF0NHTXz.js +0 -7
  189. package/dist/assets/domains-Dr63r27w.js +0 -1
  190. package/dist/assets/engine-BCYKeHn7.js +0 -1
  191. package/dist/assets/es-Dv2m4LXp.js +0 -9
  192. package/dist/assets/form-text-input-CBL3JAev.js +0 -11
  193. package/dist/assets/fr-BGhg9oO3.js +0 -7
  194. package/dist/assets/get-safe-url-CxrqaBih.js +0 -1
  195. package/dist/assets/hi-CPfDhW8g.js +0 -5
  196. package/dist/assets/id-9TUzKF6k.js +0 -7
  197. package/dist/assets/index-88gdbkao.js +0 -1
  198. package/dist/assets/index-B6-5SXSy.js +0 -7
  199. package/dist/assets/index-CNE3uN5c.js +0 -124
  200. package/dist/assets/ja-DT5bRsBF.js +0 -9
  201. package/dist/assets/ko-CJn9PyPz.js +0 -9
  202. package/dist/assets/localization-CufkU3et.js +0 -1
  203. package/dist/assets/logger-DQUu6ucJ.js +0 -1
  204. package/dist/assets/preferences-D321ZAU1.js +0 -1
  205. package/dist/assets/profile-embed-Ba3F6nXm.js +0 -1
  206. package/dist/assets/pt-K9FK6Ube.js +0 -5
  207. package/dist/assets/ru-C_RwukUu.js +0 -5
  208. package/dist/assets/sdk-DAuiCSLy.js +0 -1
  209. package/dist/assets/th-Bhii_FfA.js +0 -5
  210. package/dist/assets/vi-DVF2tjOG.js +0 -5
  211. package/dist/assets/wrap-locale-CFMie_Pc.js +0 -1
@@ -1 +1 @@
1
- import{J as A,j as e,ak as t,a6 as E,Q as l,b3 as W,T as o,b4 as z,am as I,b5 as R,b6 as L,a5 as O,a3 as T,a$ as f,b1 as F}from"./vendor-mui-core-DHT36AZL.js";import{r as x}from"./vendor-react-CUXIiAnY.js";import{l as D}from"./vendor-hooks-fhL5FJET.js";import{C as b}from"./vendor-utils-BSZ4yJws.js";import{a as B,c as u,t as H,H as U,M,d as K}from"./index-lFDZOk_k.js";import{K as p}from"./landing-page-Djj9jDve.js";import{V as Q,M as y}from"./vendor-ux-sqP3hEhY.js";import{W as V}from"./did-address-CihvGtuj.js";import"./vendor-arcblock-3xKfH3F1.js";import"./lottie-web-4koyQiv_.js";function re(){const{searchParams:r}=new URL(window.location.href),{session:d}=B(),{t:c}=Q(),m=r.get("client_id"),_=r.get("scope")||"profile:read",[g,w]=x.useState(_.split(" ").filter(Boolean)),v=A("(max-width: 600px)"),k=b(window.location.origin,u.WELLKNOWN_SERVICE_PATH_PREFIX,"/oauth/authorize"),C=x.useCallback(i=>i?i.startsWith("http")?i:`${b(u.WELLKNOWN_SERVICE_PATH_PREFIX,"/api/media/upload",window.blocklet.appPid)}/${i}`:"",[]),[h,j]=D({client:null,loading:!0});x.useEffect(()=>{(async()=>{const{data:n}=await K.get("/oauth/client",{params:{clientId:m}});j({client:n,loading:!1})})()},[m,j]);const S=i=>{i!=="profile:read"&&w(n=>n.includes(i)?n.filter(P=>P!==i):[...n,i])};if(h.loading||!d?.user)return e.jsx(p,{did:window.blocklet?.appPid,standalone:!0,children:e.jsx(t,{sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"100%"},children:e.jsx(E,{})})});if(!h.client)return e.jsx(p,{did:window.blocklet?.appPid,standalone:!0,children:e.jsx(t,{sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"100%"},children:e.jsx(H,{style:{backgroundColor:"transparent"},status:"error",title:c("notFoundOauthClient"),extra:e.jsx(l,{variant:"outlined",color:"primary",size:"small",startIcon:e.jsx(W,{}),href:"/",style:{borderRadius:4},children:c("connectCli.home")})})})});const{client:s}=h,{user:a}=d,N=(s.scope||"").split(" ");return e.jsxs(p,{did:window.blocklet?.appPid,standalone:!0,children:[e.jsx(U,{children:e.jsxs("title",{children:[c("oauth.authorize")," | ",window.blocklet?.appName]})}),e.jsx(M,{hideCloseButton:!0,children:e.jsxs(t,{sx:{display:"flex",flexDirection:"column",p:{xs:2,lg:3,xl:4},pt:{xs:3,xl:4},bgcolor:"background.paper"},className:"page-authorize",children:[e.jsxs(t,{sx:{textAlign:"center",mb:2},children:[e.jsxs(t,{sx:{display:"flex",alignItems:"center",justifyContent:"center",mb:2},children:[e.jsx(y,{src:window.blocklet?.appLogo,alt:"Server",width:48,height:48}),e.jsxs(t,{sx:{mx:2,display:"flex",alignItems:"center","& .dot":{width:8,height:8,borderRadius:"50%",bgcolor:"divider",mx:.5}},children:[e.jsx(t,{className:"dot"}),e.jsx(t,{className:"dot"}),e.jsx(t,{className:"dot"})]}),e.jsx(y,{src:C(s.logo_uri),alt:s.client_name,width:48,height:48})]}),e.jsxs(o,{sx:{mb:1,fontSize:"1.2rem","& .app-name":{color:"primary.main"}},children:["Authorize ",e.jsx("span",{className:"app-name",children:s.client_name})]})]}),e.jsxs(t,{sx:{display:"flex",alignItems:"center",width:"100%",overflow:"hidden",mb:3,p:2,border:"1px solid",borderColor:"divider",borderRadius:1},className:"info",children:[e.jsx(z,{src:a.avatar,style:{width:48,height:48,backgroundColor:"transparent",marginRight:16}}),e.jsxs(t,{sx:{flex:1,overflow:"hidden"},children:[e.jsx(I,{title:a.fullName,children:e.jsx(t,{className:"name",sx:{flex:1,overflow:"hidden",textOverflow:"ellipsis"},children:a.fullName})}),e.jsx(t,{className:"did",children:e.jsx(V,{compact:!0,responsive:!1,did:a.did,showQrcode:!v})})]})]}),e.jsxs(o,{variant:"subtitle1",sx:{mb:2,fontWeight:500},children:["Allow ",s.client_name," to do the following on your behalf:"]}),e.jsxs(t,{sx:{border:"1px solid",borderColor:"divider",borderRadius:2,overflow:"hidden"},children:[e.jsx(t,{sx:{p:2},children:e.jsx(R,{children:Object.entries(u.OAUTH_SCOPES).filter(([i])=>N.includes(i)).map(([i,n])=>e.jsx(L,{control:e.jsx(O,{checked:g.includes(i),onChange:()=>S(i),disabled:i==="profile:read"||["blocklet:read","blocklet:write"].includes(i)&&!["owner","admin","member"].includes(a.role),color:"primary",sx:{"&.Mui-checked":{color:"success.main"}}}),label:e.jsx(t,{children:e.jsx(o,{variant:"body1",sx:{fontWeight:500},children:n})}),sx:{mb:0}},i))})}),(s.tos_uri||s.policy_uri)&&e.jsxs(e.Fragment,{children:[e.jsx(T,{}),e.jsx(t,{sx:{height:1,bgcolor:"divider"}}),e.jsx(t,{sx:{p:2,color:"text.secondary"},children:e.jsxs(o,{variant:"body2",children:["By authorize the access, you also agree with the"," ",!!s.tos_uri&&e.jsx(f,{href:s.tos_uri,target:"_blank",children:"Terms of Use"}),!!s.tos_uri&&!!s.policy_uri&&" and ",!!s.policy_uri&&e.jsx(f,{href:s.policy_uri,target:"_blank",children:"Privacy Policy"})]})})]})]}),e.jsxs("form",{method:"POST",action:k,children:[r.get("client_id")&&e.jsx("input",{type:"hidden",name:"client_id",value:r.get("client_id")}),r.get("response_type")&&e.jsx("input",{type:"hidden",name:"response_type",value:r.get("response_type")}),r.get("redirect_uri")&&e.jsx("input",{type:"hidden",name:"redirect_uri",value:r.get("redirect_uri")}),r.get("code_challenge")&&e.jsx("input",{type:"hidden",name:"code_challenge",value:r.get("code_challenge")}),r.get("code_challenge_method")&&e.jsx("input",{type:"hidden",name:"code_challenge_method",value:r.get("code_challenge_method")}),r.get("state")&&e.jsx("input",{type:"hidden",name:"state",value:r.get("state")}),e.jsx("input",{type:"hidden",name:"scope",value:g.join(" ")}),e.jsx(t,{sx:{mt:"auto",pt:3},children:e.jsxs(F,{direction:"row",spacing:2,children:[e.jsx(l,{variant:"outlined",size:"large",fullWidth:!0,type:"submit",name:"action",value:"deny",children:"Cancel"}),e.jsx(l,{variant:"contained",size:"large",fullWidth:!0,type:"submit",name:"action",value:"allow",children:"Authorize"})]})}),r.get("redirect_uri")&&e.jsxs(t,{sx:{mt:3,textAlign:"center"},children:[e.jsx(o,{variant:"body2",sx:{color:"text.secondary"},children:"You will be redirected to"}),e.jsx(o,{variant:"body2",sx:{color:"text.secondary",wordBreak:"break-all"},children:r.get("redirect_uri")})]}),e.jsx(t,{sx:{mt:2,textAlign:"center"},children:e.jsxs(o,{variant:"body2",children:["Not you?"," ",e.jsx(l,{variant:"text",color:"primary",onClick:()=>d.switchDid(),sx:{p:0,minWidth:"auto",textTransform:"none",verticalAlign:"baseline",fontWeight:"inherit",fontSize:"inherit","&:hover":{background:"none",textDecoration:"underline"}},children:"Use another account"})]})})]})]})})]})}export{re as default};
1
+ import{J as A,j as e,ak as t,a6 as E,Q as l,b3 as W,T as o,b4 as z,am as I,b5 as R,b6 as L,a5 as O,a3 as T,a$ as f,b1 as F}from"./vendor-mui-core-BPQ6AEW_.js";import{r as x}from"./vendor-react-CUXIiAnY.js";import{l as D}from"./vendor-hooks-fhL5FJET.js";import{C as b}from"./vendor-utils-BSZ4yJws.js";import{a as B,c as u,t as H,H as U,M,d as K}from"./index-CeWTwSLE.js";import{K as p}from"./landing-page-DQBBERn_.js";import{V as Q,M as y}from"./vendor-ux-D507n6h6.js";import{W as V}from"./did-address-BOsJWqi1.js";import"./vendor-arcblock-BL_VyzmH.js";import"./lottie-web-4koyQiv_.js";function re(){const{searchParams:r}=new URL(window.location.href),{session:d}=B(),{t:c}=Q(),m=r.get("client_id"),_=r.get("scope")||"profile:read",[g,w]=x.useState(_.split(" ").filter(Boolean)),v=A("(max-width: 600px)"),k=b(window.location.origin,u.WELLKNOWN_SERVICE_PATH_PREFIX,"/oauth/authorize"),C=x.useCallback(i=>i?i.startsWith("http")?i:`${b(u.WELLKNOWN_SERVICE_PATH_PREFIX,"/api/media/upload",window.blocklet.appPid)}/${i}`:"",[]),[h,j]=D({client:null,loading:!0});x.useEffect(()=>{(async()=>{const{data:n}=await K.get("/oauth/client",{params:{clientId:m}});j({client:n,loading:!1})})()},[m,j]);const S=i=>{i!=="profile:read"&&w(n=>n.includes(i)?n.filter(P=>P!==i):[...n,i])};if(h.loading||!d?.user)return e.jsx(p,{did:window.blocklet?.appPid,standalone:!0,children:e.jsx(t,{sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"100%"},children:e.jsx(E,{})})});if(!h.client)return e.jsx(p,{did:window.blocklet?.appPid,standalone:!0,children:e.jsx(t,{sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"100%"},children:e.jsx(H,{style:{backgroundColor:"transparent"},status:"error",title:c("notFoundOauthClient"),extra:e.jsx(l,{variant:"outlined",color:"primary",size:"small",startIcon:e.jsx(W,{}),href:"/",style:{borderRadius:4},children:c("connectCli.home")})})})});const{client:s}=h,{user:a}=d,N=(s.scope||"").split(" ");return e.jsxs(p,{did:window.blocklet?.appPid,standalone:!0,children:[e.jsx(U,{children:e.jsxs("title",{children:[c("oauth.authorize")," | ",window.blocklet?.appName]})}),e.jsx(M,{hideCloseButton:!0,children:e.jsxs(t,{sx:{display:"flex",flexDirection:"column",p:{xs:2,lg:3,xl:4},pt:{xs:3,xl:4},bgcolor:"background.paper"},className:"page-authorize",children:[e.jsxs(t,{sx:{textAlign:"center",mb:2},children:[e.jsxs(t,{sx:{display:"flex",alignItems:"center",justifyContent:"center",mb:2},children:[e.jsx(y,{src:window.blocklet?.appLogo,alt:"Server",width:48,height:48}),e.jsxs(t,{sx:{mx:2,display:"flex",alignItems:"center","& .dot":{width:8,height:8,borderRadius:"50%",bgcolor:"divider",mx:.5}},children:[e.jsx(t,{className:"dot"}),e.jsx(t,{className:"dot"}),e.jsx(t,{className:"dot"})]}),e.jsx(y,{src:C(s.logo_uri),alt:s.client_name,width:48,height:48})]}),e.jsxs(o,{sx:{mb:1,fontSize:"1.2rem","& .app-name":{color:"primary.main"}},children:["Authorize ",e.jsx("span",{className:"app-name",children:s.client_name})]})]}),e.jsxs(t,{sx:{display:"flex",alignItems:"center",width:"100%",overflow:"hidden",mb:3,p:2,border:"1px solid",borderColor:"divider",borderRadius:1},className:"info",children:[e.jsx(z,{src:a.avatar,style:{width:48,height:48,backgroundColor:"transparent",marginRight:16}}),e.jsxs(t,{sx:{flex:1,overflow:"hidden"},children:[e.jsx(I,{title:a.fullName,children:e.jsx(t,{className:"name",sx:{flex:1,overflow:"hidden",textOverflow:"ellipsis"},children:a.fullName})}),e.jsx(t,{className:"did",children:e.jsx(V,{compact:!0,responsive:!1,did:a.did,showQrcode:!v})})]})]}),e.jsxs(o,{variant:"subtitle1",sx:{mb:2,fontWeight:500},children:["Allow ",s.client_name," to do the following on your behalf:"]}),e.jsxs(t,{sx:{border:"1px solid",borderColor:"divider",borderRadius:2,overflow:"hidden"},children:[e.jsx(t,{sx:{p:2},children:e.jsx(R,{children:Object.entries(u.OAUTH_SCOPES).filter(([i])=>N.includes(i)).map(([i,n])=>e.jsx(L,{control:e.jsx(O,{checked:g.includes(i),onChange:()=>S(i),disabled:i==="profile:read"||["blocklet:read","blocklet:write"].includes(i)&&!["owner","admin","member"].includes(a.role),color:"primary",sx:{"&.Mui-checked":{color:"success.main"}}}),label:e.jsx(t,{children:e.jsx(o,{variant:"body1",sx:{fontWeight:500},children:n})}),sx:{mb:0}},i))})}),(s.tos_uri||s.policy_uri)&&e.jsxs(e.Fragment,{children:[e.jsx(T,{}),e.jsx(t,{sx:{height:1,bgcolor:"divider"}}),e.jsx(t,{sx:{p:2,color:"text.secondary"},children:e.jsxs(o,{variant:"body2",children:["By authorize the access, you also agree with the"," ",!!s.tos_uri&&e.jsx(f,{href:s.tos_uri,target:"_blank",children:"Terms of Use"}),!!s.tos_uri&&!!s.policy_uri&&" and ",!!s.policy_uri&&e.jsx(f,{href:s.policy_uri,target:"_blank",children:"Privacy Policy"})]})})]})]}),e.jsxs("form",{method:"POST",action:k,children:[r.get("client_id")&&e.jsx("input",{type:"hidden",name:"client_id",value:r.get("client_id")}),r.get("response_type")&&e.jsx("input",{type:"hidden",name:"response_type",value:r.get("response_type")}),r.get("redirect_uri")&&e.jsx("input",{type:"hidden",name:"redirect_uri",value:r.get("redirect_uri")}),r.get("code_challenge")&&e.jsx("input",{type:"hidden",name:"code_challenge",value:r.get("code_challenge")}),r.get("code_challenge_method")&&e.jsx("input",{type:"hidden",name:"code_challenge_method",value:r.get("code_challenge_method")}),r.get("state")&&e.jsx("input",{type:"hidden",name:"state",value:r.get("state")}),e.jsx("input",{type:"hidden",name:"scope",value:g.join(" ")}),e.jsx(t,{sx:{mt:"auto",pt:3},children:e.jsxs(F,{direction:"row",spacing:2,children:[e.jsx(l,{variant:"outlined",size:"large",fullWidth:!0,type:"submit",name:"action",value:"deny",children:"Cancel"}),e.jsx(l,{variant:"contained",size:"large",fullWidth:!0,type:"submit",name:"action",value:"allow",children:"Authorize"})]})}),r.get("redirect_uri")&&e.jsxs(t,{sx:{mt:3,textAlign:"center"},children:[e.jsx(o,{variant:"body2",sx:{color:"text.secondary"},children:"You will be redirected to"}),e.jsx(o,{variant:"body2",sx:{color:"text.secondary",wordBreak:"break-all"},children:r.get("redirect_uri")})]}),e.jsx(t,{sx:{mt:2,textAlign:"center"},children:e.jsxs(o,{variant:"body2",children:["Not you?"," ",e.jsx(l,{variant:"text",color:"primary",onClick:()=>d.switchDid(),sx:{p:0,minWidth:"auto",textTransform:"none",verticalAlign:"baseline",fontWeight:"inherit",fontSize:"inherit","&:hover":{background:"none",textDecoration:"underline"}},children:"Use another account"})]})})]})]})})]})}export{re as default};
@@ -1 +1 @@
1
- import{r as p}from"./vendor-react-CUXIiAnY.js";import{D as L,j as f,b7 as T,T as j,ak as k,W as t}from"./vendor-mui-core-DHT36AZL.js";import{E as C}from"./index-DA2Pny4B.js";import{a as D}from"./vendor-utils-BSZ4yJws.js";const A=a=>{const h=new Date(Math.min(...a)),r=(new Date(Math.max(...a))-h)/(1e3*60);return u=>{if(r<=10){const c=(a.length-a.length%r)/r;return u%c===0}const d=(a.length-a.length%6)/6;return u%d===0}};function S({title:a="",total:h=0,history:s=[],valueFn:b=n=>n,xAxisFormat:r=n=>n,visualMapPieces:u=[],markLineData:v={},extraInfo:d=null,empty:w=null,onHover:c=()=>{},hoverIndex:i=null}){const n=L(),o=p.useRef(null),y=p.useMemo(()=>D(s)?[]:s.map(e=>r(e.date)),[s,r]);p.useEffect(()=>{if(!o.current||i?.ref===o)return;const e=o.current.getEchartsInstance(),l=i?.seriesIndex,x=y.findIndex(g=>g===i?.dataValue);i&&x!==-1?e.dispatchAction({type:"showTip",seriesIndex:l,dataIndex:x}):(e.dispatchAction({type:"hideTip"}),e.dispatchAction({type:"showTip",seriesIndex:0,dataIndex:-1}))},[i?.dataIndex]);const m=p.useCallback(()=>{c?.(null)},[c]);if(p.useEffect(()=>{if(o.current){const e=o.current.getEchartsInstance(),l=e.getDom();return l.addEventListener("mouseleave",m),()=>{l.removeEventListener("mouseleave",m),e.dispose()}}},[m]),D(s))return w||null;const E=Math.max(...s.map(e=>e.value),h||0,0),M={tooltip:{trigger:"axis",formatter(e){const l=e[0].data,x=b(l),{seriesIndex:g,dataIndex:I}=e[0];return c?.({seriesIndex:g,dataIndex:I,dataValue:y[I],ref:i?.ref||o}),`${e[0].name}: <b>${x}</b>`},backgroundColor:n.palette.background.paper,borderColor:n.palette.divider,textStyle:{color:n.palette.text.primary},extraCssText:`box-shadow: ${n.shadows[2]}; border-radius: 4px;`},grid:{top:"48px",left:"16px",right:"16px",bottom:"0px",containLabel:!0},xAxis:{type:"category",boundaryGap:!1,data:y,axisTick:{show:!1},splitLine:{show:!1},axisLabel:{interval:A(s.map(e=>new Date(e.date)))}},yAxis:{type:"value",axisTick:{show:!1},splitLine:{show:!1},min:0,max:E,interval:Math.ceil(E/2),axisLabel:{formatter:b,padding:[5,0,0,0]}},visualMap:{show:!1,type:"piecewise",dimension:1,seriesIndex:0,pieces:u},series:[{name:`${a} Usage`,type:"line",smooth:!0,symbol:"none",lineStyle:{color:n.palette.primary.main,width:2.5},areaStyle:{},itemStyle:{},emphasis:{disabled:!0},data:s.map(e=>e.value),markLine:v}]};return f.jsxs(T,{sx:{p:1,position:"relative"},children:[f.jsx(j,{sx:{fontSize:"16px",fontWeight:"bold",color:"text.secondary",position:"absolute",top:8,left:16,zIndex:10},children:a}),f.jsx(C,{ref:o,option:M,style:{width:"100%",height:"200px"},onEvents:{globalout:m}}),d&&f.jsx(k,{sx:{color:"text.secondary",ml:2,mt:1,fontSize:12},children:d})]})}S.propTypes={title:t.string,total:t.number,history:t.array,valueFn:t.func,xAxisFormat:t.func,visualMapPieces:t.array,markLineData:t.object,extraInfo:t.node,empty:t.node,onHover:t.func,hoverIndex:t.object};export{S as B};
1
+ import{r as p}from"./vendor-react-CUXIiAnY.js";import{D as L,j as f,b7 as T,T as j,ak as k,W as t}from"./vendor-mui-core-BPQ6AEW_.js";import{E as C}from"./index-DA2Pny4B.js";import{a as D}from"./vendor-utils-BSZ4yJws.js";const A=a=>{const h=new Date(Math.min(...a)),r=(new Date(Math.max(...a))-h)/(1e3*60);return u=>{if(r<=10){const c=(a.length-a.length%r)/r;return u%c===0}const d=(a.length-a.length%6)/6;return u%d===0}};function S({title:a="",total:h=0,history:s=[],valueFn:b=n=>n,xAxisFormat:r=n=>n,visualMapPieces:u=[],markLineData:v={},extraInfo:d=null,empty:w=null,onHover:c=()=>{},hoverIndex:i=null}){const n=L(),o=p.useRef(null),y=p.useMemo(()=>D(s)?[]:s.map(e=>r(e.date)),[s,r]);p.useEffect(()=>{if(!o.current||i?.ref===o)return;const e=o.current.getEchartsInstance(),l=i?.seriesIndex,x=y.findIndex(g=>g===i?.dataValue);i&&x!==-1?e.dispatchAction({type:"showTip",seriesIndex:l,dataIndex:x}):(e.dispatchAction({type:"hideTip"}),e.dispatchAction({type:"showTip",seriesIndex:0,dataIndex:-1}))},[i?.dataIndex]);const m=p.useCallback(()=>{c?.(null)},[c]);if(p.useEffect(()=>{if(o.current){const e=o.current.getEchartsInstance(),l=e.getDom();return l.addEventListener("mouseleave",m),()=>{l.removeEventListener("mouseleave",m),e.dispose()}}},[m]),D(s))return w||null;const E=Math.max(...s.map(e=>e.value),h||0,0),M={tooltip:{trigger:"axis",formatter(e){const l=e[0].data,x=b(l),{seriesIndex:g,dataIndex:I}=e[0];return c?.({seriesIndex:g,dataIndex:I,dataValue:y[I],ref:i?.ref||o}),`${e[0].name}: <b>${x}</b>`},backgroundColor:n.palette.background.paper,borderColor:n.palette.divider,textStyle:{color:n.palette.text.primary},extraCssText:`box-shadow: ${n.shadows[2]}; border-radius: 4px;`},grid:{top:"48px",left:"16px",right:"16px",bottom:"0px",containLabel:!0},xAxis:{type:"category",boundaryGap:!1,data:y,axisTick:{show:!1},splitLine:{show:!1},axisLabel:{interval:A(s.map(e=>new Date(e.date)))}},yAxis:{type:"value",axisTick:{show:!1},splitLine:{show:!1},min:0,max:E,interval:Math.ceil(E/2),axisLabel:{formatter:b,padding:[5,0,0,0]}},visualMap:{show:!1,type:"piecewise",dimension:1,seriesIndex:0,pieces:u},series:[{name:`${a} Usage`,type:"line",smooth:!0,symbol:"none",lineStyle:{color:n.palette.primary.main,width:2.5},areaStyle:{},itemStyle:{},emphasis:{disabled:!0},data:s.map(e=>e.value),markLine:v}]};return f.jsxs(T,{sx:{p:1,position:"relative"},children:[f.jsx(j,{sx:{fontSize:"16px",fontWeight:"bold",color:"text.secondary",position:"absolute",top:8,left:16,zIndex:10},children:a}),f.jsx(C,{ref:o,option:M,style:{width:"100%",height:"200px"},onEvents:{globalout:m}}),d&&f.jsx(k,{sx:{color:"text.secondary",ml:2,mt:1,fontSize:12},children:d})]})}S.propTypes={title:t.string,total:t.number,history:t.array,valueFn:t.func,xAxisFormat:t.func,visualMapPieces:t.array,markLineData:t.object,extraInfo:t.node,empty:t.node,onHover:t.func,hoverIndex:t.object};export{S as B};
@@ -1 +1 @@
1
- import{r as x}from"./vendor-ux-sqP3hEhY.js";import{e as m}from"./vendor-react-CUXIiAnY.js";class w{constructor(e,r,o){this.name=e,this.prefix=r,this.baseEncode=o}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class g{constructor(e,r,o){if(this.name=e,this.prefix=r,r.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=r.codePointAt(0),this.baseDecode=o}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return l(this,e)}}class y{constructor(e){this.decoders=e}or(e){return l(this,e)}decode(e){const r=e[0],o=this.decoders[r];if(o)return o.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const l=(t,e)=>new y({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}});class E{constructor(e,r,o,s){this.name=e,this.prefix=r,this.baseEncode=o,this.baseDecode=s,this.encoder=new w(e,r,o),this.decoder=new g(e,r,s)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const A=({name:t,prefix:e,encode:r,decode:o})=>new E(t,e,r,o),C=(t,e,r,o)=>{const s={};for(let p=0;p<e.length;++p)s[e[p]]=p;let i=t.length;for(;t[i-1]==="=";)--i;const a=new Uint8Array(i*r/8|0);let n=0,c=0,h=0;for(let p=0;p<i;++p){const u=s[t[p]];if(u===void 0)throw new SyntaxError(`Non-${o} character`);c=c<<r|u,n+=r,n>=8&&(n-=8,a[h++]=255&c>>n)}if(n>=r||255&c<<8-n)throw new SyntaxError("Unexpected end of data");return a},P=(t,e,r)=>{const o=e[e.length-1]==="=",s=(1<<r)-1;let i="",a=0,n=0;for(let c=0;c<t.length;++c)for(n=n<<8|t[c],a+=8;a>r;)a-=r,i+=e[s&n>>a];if(a&&(i+=e[s&n<<r-a]),o)for(;i.length*r&7;)i+="=";return i},d=({name:t,prefix:e,bitsPerChar:r,alphabet:o})=>A({prefix:e,name:t,encode(s){return P(s,o,r)},decode(s){return C(s,o,r,t)}}),$=d({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),v=d({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),S=d({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),U=d({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),q=d({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),B=d({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),O=d({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),j=d({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),k=d({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),D=Object.freeze(Object.defineProperty({__proto__:null,base32:$,base32hex:q,base32hexpad:O,base32hexpadupper:j,base32hexupper:B,base32pad:S,base32padupper:U,base32upper:v,base32z:k},Symbol.toStringTag,{value:"Module"})),N=m(D);var f,b;function R(){if(b)return f;b=1;const{toBuffer:t,toAddress:e,toBase58:r,toHex:o}=x(),{base32:s}=N;return f={encode:n=>{if(!n)return n;const c=t(e(n));return s.encode(c)},decode:n=>{if(!n)return n;const c=s.decode(n),h=r(c);return h.length>30?h:o(c)}},f}export{R as r};
1
+ import{r as x}from"./vendor-ux-D507n6h6.js";import{e as m}from"./vendor-react-CUXIiAnY.js";class w{constructor(e,r,o){this.name=e,this.prefix=r,this.baseEncode=o}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class g{constructor(e,r,o){if(this.name=e,this.prefix=r,r.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=r.codePointAt(0),this.baseDecode=o}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return l(this,e)}}class y{constructor(e){this.decoders=e}or(e){return l(this,e)}decode(e){const r=e[0],o=this.decoders[r];if(o)return o.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const l=(t,e)=>new y({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}});class E{constructor(e,r,o,s){this.name=e,this.prefix=r,this.baseEncode=o,this.baseDecode=s,this.encoder=new w(e,r,o),this.decoder=new g(e,r,s)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const A=({name:t,prefix:e,encode:r,decode:o})=>new E(t,e,r,o),C=(t,e,r,o)=>{const s={};for(let p=0;p<e.length;++p)s[e[p]]=p;let i=t.length;for(;t[i-1]==="=";)--i;const a=new Uint8Array(i*r/8|0);let n=0,c=0,h=0;for(let p=0;p<i;++p){const u=s[t[p]];if(u===void 0)throw new SyntaxError(`Non-${o} character`);c=c<<r|u,n+=r,n>=8&&(n-=8,a[h++]=255&c>>n)}if(n>=r||255&c<<8-n)throw new SyntaxError("Unexpected end of data");return a},P=(t,e,r)=>{const o=e[e.length-1]==="=",s=(1<<r)-1;let i="",a=0,n=0;for(let c=0;c<t.length;++c)for(n=n<<8|t[c],a+=8;a>r;)a-=r,i+=e[s&n>>a];if(a&&(i+=e[s&n<<r-a]),o)for(;i.length*r&7;)i+="=";return i},d=({name:t,prefix:e,bitsPerChar:r,alphabet:o})=>A({prefix:e,name:t,encode(s){return P(s,o,r)},decode(s){return C(s,o,r,t)}}),$=d({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),v=d({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),S=d({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),U=d({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),q=d({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),B=d({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),O=d({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),j=d({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),k=d({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),D=Object.freeze(Object.defineProperty({__proto__:null,base32:$,base32hex:q,base32hexpad:O,base32hexpadupper:j,base32hexupper:B,base32pad:S,base32padupper:U,base32upper:v,base32z:k},Symbol.toStringTag,{value:"Module"})),N=m(D);var f,b;function R(){if(b)return f;b=1;const{toBuffer:t,toAddress:e,toBase58:r,toHex:o}=x(),{base32:s}=N;return f={encode:n=>{if(!n)return n;const c=t(e(n));return s.encode(c)},decode:n=>{if(!n)return n;const c=s.decode(n),h=r(c);return h.length>30?h:o(c)}},f}export{R as r};
@@ -1 +1 @@
1
- import{j as e,ak as l,aX as B,T as f,D as H,n as D,am as $,W as u}from"./vendor-mui-core-DHT36AZL.js";import{ac as O,a as P,a9 as U,v as I,aP as F}from"./index-lFDZOk_k.js";import{V as Z,U as k,s as Q,e as X}from"./vendor-ux-sqP3hEhY.js";import{a as Y}from"./page-header-B4MDj6gy.js";import{r as x}from"./vendor-react-CUXIiAnY.js";import{S as W}from"./button-8Nchte_6.js";import{S as _}from"./layout-0zU7a-3v.js";import{S as G}from"./step-actions-tRQyAl6A.js";import"./vendor-arcblock-3xKfH3F1.js";import"./vendor-utils-BSZ4yJws.js";import"./vendor-hooks-fhL5FJET.js";import"./lottie-web-4koyQiv_.js";import"./content-layout-RghQFMLL.js";import"./use-mobile-BpPz1bKz.js";const J={width:24,height:24,body:'<path fill="currentColor" d="M17 17q.625 0 1.063-.438T18.5 15.5q0-.625-.438-1.063T17 14q-.625 0-1.063.438T15.5 15.5q0 .625.438 1.063T17 17Zm0 3q.775 0 1.425-.363t1.05-.962q-.55-.325-1.175-.5T17 18q-.675 0-1.3.175t-1.175.5q.4.6 1.05.963T17 20Zm0 2q-2.075 0-3.538-1.463T12 17q0-2.075 1.463-3.538T17 12q2.075 0 3.538 1.463T22 17q0 2.075-1.463 3.538T17 22Zm-5 0q-3.475-.875-5.738-3.988T4 11.1V5l8-3l8 3v5.675q-.65-.325-1.463-.5T17 10q-2.9 0-4.95 2.05T10 17q0 1.55.588 2.8t1.487 2.175q-.025 0-.037.013T12 22Z"/>'},K={width:24,height:24,body:'<path fill="currentColor" d="M7 15q1.25 0 2.125-.875T10 12q0-1.25-.875-2.125T7 9q-1.25 0-2.125.875T4 12q0 1.25.875 2.125T7 15Zm0 3q-2.5 0-4.25-1.75T1 12q0-2.5 1.75-4.25T7 6q2.025 0 3.538 1.15T12.65 10h8.375L23 11.975l-3.5 4L17 14l-2 2l-2-2h-.35q-.625 1.8-2.175 2.9T7 18Z"/>'},ee={width:24,height:24,body:'<path fill="currentColor" d="M4 20q-.825 0-1.413-.588T2 18V6q0-.825.588-1.413T4 4h16q.825 0 1.413.588T22 6v12q0 .825-.588 1.413T20 20H4Zm8-7L4 8v10h16V8l-8 5Zm0-2l8-5H4l8 5ZM4 8V6v12V8Z"/>'},te={width:24,height:24,body:'<path fill="currentColor" d="M6 20q-1.65 0-2.825-1.175T2 16V8q0-1.65 1.175-2.825T6 4h12q1.65 0 2.825 1.175T22 8v8q0 1.65-1.175 2.825T18 20H6ZM6 8h12q.55 0 1.05.125t.95.4V8q0-.825-.588-1.413T18 6H6q-.825 0-1.413.588T4 8v.525q.45-.275.95-.4T6 8Zm-1.85 3.25l11.125 2.7q.225.05.45 0t.425-.2l3.475-2.9q-.275-.375-.7-.613T18 10H6q-.65 0-1.137.338t-.713.912Z"/>'},z=n=>({wallet:{icon:te,label:n("setup.connectAccount.wallet"),description:n("setup.connectAccount.walletDesc"),isDefault:!1,priority:1},passkey:{icon:K,label:n("setup.connectAccount.passkey"),description:n("setup.connectAccount.passkeyDesc"),isDefault:!1,priority:2},email:{icon:ee,label:n("setup.connectAccount.email"),description:n("setup.connectAccount.emailDesc"),isDefault:!0,priority:3}});function M({type:n,account:b=null,onBind:s,bindButton:g=null,loading:q=!1,recommended:o=!1}){const{t:m}=Z(),a=z(m)[n],h=!!b,i=H();return e.jsx(l,{sx:{mb:2,p:{xs:1.5,sm:2},border:1,borderColor:o?D(i.palette.primary.main,.2):"divider",borderRadius:1,bgcolor:o?D(i.palette.primary.main,.08):"background.paper"},children:e.jsxs(l,{sx:{display:"flex",alignItems:{xs:"flex-start",sm:"center"},justifyContent:"space-between",flexDirection:{xs:"column",sm:"row"},gap:{xs:1.5,sm:2}},children:[e.jsxs(l,{sx:{display:"flex",alignItems:"center",gap:1.5,width:{xs:"100%",sm:"auto"}},children:[e.jsx(k,{icon:a.icon,style:{fontSize:"20px"}}),e.jsxs(l,{sx:{flex:1,minWidth:0},children:[e.jsxs(l,{sx:{display:"flex",alignItems:"center",gap:1,flexWrap:"wrap"},children:[e.jsx(f,{variant:"subtitle2",sx:{fontWeight:500,fontSize:{xs:"0.875rem",sm:"1rem"}},children:a.label}),h&&c("mobile"),o&&e.jsx(f,{variant:"caption",sx:{color:"warning.main",fontWeight:500,fontSize:"0.7rem"},children:m("setup.connectAccount.recommended")})]}),e.jsx(l,{sx:{mt:.5},children:v(b)})]})]}),a.isDefault?c():e.jsx(l,{sx:{width:{xs:"100%",sm:"auto"},display:"flex",justifyContent:"center"},children:h?c():g||e.jsx(W,{variant:"outlined",size:"small",onClick:()=>s(n),disabled:q,fullWidth:{xs:!0,sm:!1},sx:{borderColor:"primary.main",height:"32px !important",minWidth:{xs:"100%",sm:"60px"},fontSize:{xs:"0.875rem",sm:"0.8125rem"}},children:m("setup.connectAccount.connect")})})]})});function v(d){return h?d.displayName===d.did?e.jsx(X,{did:d.did,showQrcode:!0}):e.jsx(f,{variant:"body2",color:"text.secondary",sx:{fontFamily:"monospace",mt:.5},children:d.displayName}):e.jsx(f,{variant:"body2",color:"text.secondary",sx:{mt:.5},children:a.description})}function c(d){const p=d==="mobile";return e.jsx(l,{sx:{minWidth:p?"auto":{xs:"100%",sm:"60px"},display:p?{xs:"flex",md:"none"}:{xs:"none",md:"flex"},alignItems:"center",justifyContent:"center"},children:e.jsx($,{title:m("setup.connectAccount.connected"),placement:"top",children:e.jsx(k,{icon:F,style:{color:i.palette.success.main,fontSize:p?"18px":"24px"}})})})}}M.propTypes={type:u.string.isRequired,account:u.object,onBind:u.func.isRequired,bindButton:u.node,loading:u.bool,recommended:u.bool};function se({onNext:n=()=>{},onPrevious:b=()=>{}}){const{t:s}=Z(),{blocklet:g}=O(),[q,o]=x.useState(!1),[m,a]=x.useState(!1),[h,i]=x.useState(null),{api:v,session:c}=P(),d=x.useRef(null),p=()=>{const t=c.user?.connectedAccounts||[],r={};return t.forEach(j=>{const{provider:S,userInfo:E,did:T,id:L}=j;S==="email"?r.email={did:T,displayName:L?.replace("email|","")||c.user?.email,...j}:S==="wallet"?r.wallet={did:T,displayName:T,...j}:S==="passkey"&&(r.passkey={did:T,displayName:E?.name||T,...j})}),r},[y,N]=x.useState(p());x.useEffect(()=>{N(p())},[c]);const R=t=>{i(t),o(!0),t==="wallet"?a(!0):t==="passkey"&&d.current.click()},w=()=>{c.refresh(),o(!1),a(!1),i(null)},C=z(s),V=Object.keys(C).filter(r=>!y[r]&&!C[r].isDefault).slice(0,2),A=Object.values(y).filter(Boolean).length;return e.jsxs(_,{children:[e.jsx("div",{className:"header",children:e.jsx(Y,{title:s("setup.connectAccount.title"),onClickBack:b})}),e.jsxs(l,{className:"form-container",sx:{maxWidth:"700px",px:{xs:1,sm:0},width:"100%"},children:[Object.entries(C).filter(([t])=>y[t]||t!=="email").sort(([,t],[,r])=>t.priority-r.priority).map(([t])=>e.jsx(M,{type:t,account:y[t],onBind:R,bindButton:t==="passkey"?e.jsx(U,{behavior:"only-new",action:"connect",sx:{height:"32px",minWidth:{xs:"100%",sm:"60px"},border:"1px solid",borderColor:"primary.main","& .MuiTypography-root":{color:"primary.main",textAlign:"center",fontSize:{xs:"0.875rem",sm:"0.8125rem"}},"& > div:first-child":{display:"none"},"& > svg":{display:"none !important"}},createButtonText:s("setup.connectAccount.connect"),createMode:"connect",onConnect:()=>{o(!0),i("passkey")},onSuccess:()=>{w()},onError:()=>{o(!1),i(null)},dense:!0},"passkey"):null,loading:q&&h===t,recommended:V.includes(t)},t)),A===1?!!y.email&&e.jsx(B,{severity:"warning",sx:{mt:-1},children:e.jsx(f,{variant:"body2",sx:{fontSize:{xs:"0.8rem",sm:"0.875rem"}},children:s("setup.connectAccount.securityTip")})}):e.jsx(B,{severity:"success",sx:{mb:{xs:2,sm:3}},icon:e.jsx(k,{icon:J}),children:e.jsx(f,{variant:"body2",sx:{fontSize:{xs:"0.8rem",sm:"0.875rem"}},children:s("setup.connectAccount.statusSuccess",{count:A})})}),e.jsx(I,{popup:!0,open:m,action:"bind-wallet",checkFn:v.get,checkTimeout:10*60*1e3,webWalletUrl:Q(),onClose:()=>{a(!1),o(!1),i(null)},onSuccess:()=>{w()},locale:"zh",messages:{title:s("setup.connect.title"),scan:s("setup.connect.scan"),confirm:s("setup.connect.confirm"),success:s("setup.connect.success")},extraParams:{previousUserDid:c.user?.did,skipMigrateAccount:!0,isService:!0}})]}),e.jsx(G,{blocklet:g,children:e.jsx(W,{variant:"contained",onClick:()=>n(),disabled:q,sx:{minWidth:{xs:100,sm:120}},children:A>0?s("setup.continue"):s("setup.connectAccount.skipBinding")})})]})}se.propTypes={onNext:u.func,onPrevious:u.func};export{se as default};
1
+ import{j as e,ak as l,aX as B,T as f,D as H,n as D,am as $,W as u}from"./vendor-mui-core-BPQ6AEW_.js";import{ac as O,a as P,a9 as U,v as I,aP as F}from"./index-CeWTwSLE.js";import{V as Z,U as k,s as Q,e as X}from"./vendor-ux-D507n6h6.js";import{a as Y}from"./page-header-BkgoSN-0.js";import{r as x}from"./vendor-react-CUXIiAnY.js";import{S as W}from"./button-pTTwNqRf.js";import{S as _}from"./layout-DUsIwJhf.js";import{S as G}from"./step-actions-D7ku0W0o.js";import"./vendor-arcblock-BL_VyzmH.js";import"./vendor-utils-BSZ4yJws.js";import"./vendor-hooks-fhL5FJET.js";import"./lottie-web-4koyQiv_.js";import"./content-layout-B-2tfq3i.js";import"./use-mobile-C5RjvO7g.js";const J={width:24,height:24,body:'<path fill="currentColor" d="M17 17q.625 0 1.063-.438T18.5 15.5q0-.625-.438-1.063T17 14q-.625 0-1.063.438T15.5 15.5q0 .625.438 1.063T17 17Zm0 3q.775 0 1.425-.363t1.05-.962q-.55-.325-1.175-.5T17 18q-.675 0-1.3.175t-1.175.5q.4.6 1.05.963T17 20Zm0 2q-2.075 0-3.538-1.463T12 17q0-2.075 1.463-3.538T17 12q2.075 0 3.538 1.463T22 17q0 2.075-1.463 3.538T17 22Zm-5 0q-3.475-.875-5.738-3.988T4 11.1V5l8-3l8 3v5.675q-.65-.325-1.463-.5T17 10q-2.9 0-4.95 2.05T10 17q0 1.55.588 2.8t1.487 2.175q-.025 0-.037.013T12 22Z"/>'},K={width:24,height:24,body:'<path fill="currentColor" d="M7 15q1.25 0 2.125-.875T10 12q0-1.25-.875-2.125T7 9q-1.25 0-2.125.875T4 12q0 1.25.875 2.125T7 15Zm0 3q-2.5 0-4.25-1.75T1 12q0-2.5 1.75-4.25T7 6q2.025 0 3.538 1.15T12.65 10h8.375L23 11.975l-3.5 4L17 14l-2 2l-2-2h-.35q-.625 1.8-2.175 2.9T7 18Z"/>'},ee={width:24,height:24,body:'<path fill="currentColor" d="M4 20q-.825 0-1.413-.588T2 18V6q0-.825.588-1.413T4 4h16q.825 0 1.413.588T22 6v12q0 .825-.588 1.413T20 20H4Zm8-7L4 8v10h16V8l-8 5Zm0-2l8-5H4l8 5ZM4 8V6v12V8Z"/>'},te={width:24,height:24,body:'<path fill="currentColor" d="M6 20q-1.65 0-2.825-1.175T2 16V8q0-1.65 1.175-2.825T6 4h12q1.65 0 2.825 1.175T22 8v8q0 1.65-1.175 2.825T18 20H6ZM6 8h12q.55 0 1.05.125t.95.4V8q0-.825-.588-1.413T18 6H6q-.825 0-1.413.588T4 8v.525q.45-.275.95-.4T6 8Zm-1.85 3.25l11.125 2.7q.225.05.45 0t.425-.2l3.475-2.9q-.275-.375-.7-.613T18 10H6q-.65 0-1.137.338t-.713.912Z"/>'},z=n=>({wallet:{icon:te,label:n("setup.connectAccount.wallet"),description:n("setup.connectAccount.walletDesc"),isDefault:!1,priority:1},passkey:{icon:K,label:n("setup.connectAccount.passkey"),description:n("setup.connectAccount.passkeyDesc"),isDefault:!1,priority:2},email:{icon:ee,label:n("setup.connectAccount.email"),description:n("setup.connectAccount.emailDesc"),isDefault:!0,priority:3}});function M({type:n,account:b=null,onBind:s,bindButton:g=null,loading:q=!1,recommended:o=!1}){const{t:m}=Z(),a=z(m)[n],h=!!b,i=H();return e.jsx(l,{sx:{mb:2,p:{xs:1.5,sm:2},border:1,borderColor:o?D(i.palette.primary.main,.2):"divider",borderRadius:1,bgcolor:o?D(i.palette.primary.main,.08):"background.paper"},children:e.jsxs(l,{sx:{display:"flex",alignItems:{xs:"flex-start",sm:"center"},justifyContent:"space-between",flexDirection:{xs:"column",sm:"row"},gap:{xs:1.5,sm:2}},children:[e.jsxs(l,{sx:{display:"flex",alignItems:"center",gap:1.5,width:{xs:"100%",sm:"auto"}},children:[e.jsx(k,{icon:a.icon,style:{fontSize:"20px"}}),e.jsxs(l,{sx:{flex:1,minWidth:0},children:[e.jsxs(l,{sx:{display:"flex",alignItems:"center",gap:1,flexWrap:"wrap"},children:[e.jsx(f,{variant:"subtitle2",sx:{fontWeight:500,fontSize:{xs:"0.875rem",sm:"1rem"}},children:a.label}),h&&c("mobile"),o&&e.jsx(f,{variant:"caption",sx:{color:"warning.main",fontWeight:500,fontSize:"0.7rem"},children:m("setup.connectAccount.recommended")})]}),e.jsx(l,{sx:{mt:.5},children:v(b)})]})]}),a.isDefault?c():e.jsx(l,{sx:{width:{xs:"100%",sm:"auto"},display:"flex",justifyContent:"center"},children:h?c():g||e.jsx(W,{variant:"outlined",size:"small",onClick:()=>s(n),disabled:q,fullWidth:{xs:!0,sm:!1},sx:{borderColor:"primary.main",height:"32px !important",minWidth:{xs:"100%",sm:"60px"},fontSize:{xs:"0.875rem",sm:"0.8125rem"}},children:m("setup.connectAccount.connect")})})]})});function v(d){return h?d.displayName===d.did?e.jsx(X,{did:d.did,showQrcode:!0}):e.jsx(f,{variant:"body2",color:"text.secondary",sx:{fontFamily:"monospace",mt:.5},children:d.displayName}):e.jsx(f,{variant:"body2",color:"text.secondary",sx:{mt:.5},children:a.description})}function c(d){const p=d==="mobile";return e.jsx(l,{sx:{minWidth:p?"auto":{xs:"100%",sm:"60px"},display:p?{xs:"flex",md:"none"}:{xs:"none",md:"flex"},alignItems:"center",justifyContent:"center"},children:e.jsx($,{title:m("setup.connectAccount.connected"),placement:"top",children:e.jsx(k,{icon:F,style:{color:i.palette.success.main,fontSize:p?"18px":"24px"}})})})}}M.propTypes={type:u.string.isRequired,account:u.object,onBind:u.func.isRequired,bindButton:u.node,loading:u.bool,recommended:u.bool};function se({onNext:n=()=>{},onPrevious:b=()=>{}}){const{t:s}=Z(),{blocklet:g}=O(),[q,o]=x.useState(!1),[m,a]=x.useState(!1),[h,i]=x.useState(null),{api:v,session:c}=P(),d=x.useRef(null),p=()=>{const t=c.user?.connectedAccounts||[],r={};return t.forEach(j=>{const{provider:S,userInfo:E,did:T,id:L}=j;S==="email"?r.email={did:T,displayName:L?.replace("email|","")||c.user?.email,...j}:S==="wallet"?r.wallet={did:T,displayName:T,...j}:S==="passkey"&&(r.passkey={did:T,displayName:E?.name||T,...j})}),r},[y,N]=x.useState(p());x.useEffect(()=>{N(p())},[c]);const R=t=>{i(t),o(!0),t==="wallet"?a(!0):t==="passkey"&&d.current.click()},w=()=>{c.refresh(),o(!1),a(!1),i(null)},C=z(s),V=Object.keys(C).filter(r=>!y[r]&&!C[r].isDefault).slice(0,2),A=Object.values(y).filter(Boolean).length;return e.jsxs(_,{children:[e.jsx("div",{className:"header",children:e.jsx(Y,{title:s("setup.connectAccount.title"),onClickBack:b})}),e.jsxs(l,{className:"form-container",sx:{maxWidth:"700px",px:{xs:1,sm:0},width:"100%"},children:[Object.entries(C).filter(([t])=>y[t]||t!=="email").sort(([,t],[,r])=>t.priority-r.priority).map(([t])=>e.jsx(M,{type:t,account:y[t],onBind:R,bindButton:t==="passkey"?e.jsx(U,{behavior:"only-new",action:"connect",sx:{height:"32px",minWidth:{xs:"100%",sm:"60px"},border:"1px solid",borderColor:"primary.main","& .MuiTypography-root":{color:"primary.main",textAlign:"center",fontSize:{xs:"0.875rem",sm:"0.8125rem"}},"& > div:first-child":{display:"none"},"& > svg":{display:"none !important"}},createButtonText:s("setup.connectAccount.connect"),createMode:"connect",onConnect:()=>{o(!0),i("passkey")},onSuccess:()=>{w()},onError:()=>{o(!1),i(null)},dense:!0},"passkey"):null,loading:q&&h===t,recommended:V.includes(t)},t)),A===1?!!y.email&&e.jsx(B,{severity:"warning",sx:{mt:-1},children:e.jsx(f,{variant:"body2",sx:{fontSize:{xs:"0.8rem",sm:"0.875rem"}},children:s("setup.connectAccount.securityTip")})}):e.jsx(B,{severity:"success",sx:{mb:{xs:2,sm:3}},icon:e.jsx(k,{icon:J}),children:e.jsx(f,{variant:"body2",sx:{fontSize:{xs:"0.8rem",sm:"0.875rem"}},children:s("setup.connectAccount.statusSuccess",{count:A})})}),e.jsx(I,{popup:!0,open:m,action:"bind-wallet",checkFn:v.get,checkTimeout:10*60*1e3,webWalletUrl:Q(),onClose:()=>{a(!1),o(!1),i(null)},onSuccess:()=>{w()},locale:"zh",messages:{title:s("setup.connect.title"),scan:s("setup.connect.scan"),confirm:s("setup.connect.confirm"),success:s("setup.connect.success")},extraParams:{previousUserDid:c.user?.did,skipMigrateAccount:!0,isService:!0}})]}),e.jsx(G,{blocklet:g,children:e.jsx(W,{variant:"contained",onClick:()=>n(),disabled:q,sx:{minWidth:{xs:100,sm:120}},children:A>0?s("setup.continue"):s("setup.connectAccount.skipBinding")})})]})}se.propTypes={onNext:u.func,onPrevious:u.func};export{se as default};
@@ -1,5 +1,5 @@
1
1
  const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=[window.__toCdnUrl("assets/vendor-ux-DYcPPYq2.css"),window.__toCdnUrl("assets/index-DrVXX4fX.css"),window.__toCdnUrl("assets/index-B5LvOF-F.css")])))=>i.map(i=>d[i]);
2
- import{V as fe,_ as be}from"./vendor-ux-sqP3hEhY.js";import{j as e,b1 as U,T as E,ak as x,b4 as je,am as Y,I as A,bX as J,Y as se,at as ve,bC as ye,$ as we,bw as Ce,A as Z,aJ as Se,bY as Ie,R as ke,Q as W,W as k}from"./vendor-mui-core-DHT36AZL.js";import{c as D}from"./index-lFDZOk_k.js";import{E as N}from"./empty-spinner-2ylB84wv.js";import{k as Pe,u as Re}from"./vendor-hooks-fhL5FJET.js";import{r as m}from"./vendor-react-CUXIiAnY.js";import{D as Q,C as G,P as ee}from"./react-beautiful-dnd.esm--C1KYPc1.js";import{S as F}from"./studio-bbXFMut7.js";import"./vendor-utils-BSZ4yJws.js";import"./lottie-web-4koyQiv_.js";import"./vendor-arcblock-3xKfH3F1.js";import"./raf-schd.esm-JNUhxcps.js";import"./index-BzCDxVOL.js";var I={},te;function Ee(){if(te)return I;te=1,Object.defineProperty(I,"__esModule",{value:!0}),I.getVideoId=b,I.getEmbedUrl=c,I.getVideoCoverUrl=P,I.getVideoCheckUrl=y,I.getYoutubeId=r,I.getVimeoId=a,I.isVideoUrl=w;function r(s){const t=s.trim();return t.includes("youtu.be/")?t.split("youtu.be/")[1]?.split("?")[0]:t.includes("/embed/")?t.split("/embed/")[1]?.split("?")[0]:t.includes("youtube.com/watch")?new URL(t).searchParams.get("v"):t.includes("youtube.com/shorts/")?t.split("/shorts/")[1]?.split("?")[0]:""}function a(s){const t=s.trim();return t.includes("/embed/")?t.split("/embed/")[1]?.split("?")[0]:t.includes("vimeo.com/video/")?t.split("/video/")[1]?.split("?")[0]:t.includes("vimeo.com/channels/")?t.split("/channels/")[1]?.split("/")[1]?.split("?")[0]:t.includes("vimeo.com/groups/")?t.split("/groups/")[1]?.split("/")[1]?.split("?")[0]:t.includes("vimeo.com/")?t.split("vimeo.com/")[1]?.split("?")[0]:""}const p={};function b(s){const t=s.trim();return!t||!/^https?:\/\/.+\..+/.test(t)?[]:(p[t]||(p[t]=(()=>{const u=new URL(t);return u.host.includes("youtube.com")||u.host.includes("youtu.be")?[r(t),"youtube"]:u.host.includes("vimeo.com")?[a(t),"vimeo"]:[]})()),p[t])}const n={};function c(s,{modestbranding:t=1,controls:u=0,autoplay:g=0}={}){const j=s.trim();if(!j)return"";if(n[j]!==void 0)return n[j];const[O,l]=b(j);return l==="youtube"?n[j]=`https://www.youtube.com/embed/${O}?modestbranding=${t}&controls=${u}&autoplay=${g}`:l==="vimeo"?n[j]=`https://player.vimeo.com/video/${O}?autoplay=${g}`:n[j]="",n[j]}const d={};function P(s){const t=s.trim();if(!t)return"";if(d[t]!==void 0)return d[t];const[u,g]=b(t);return g==="youtube"?d[t]=`https://img.youtube.com/vi/${u}/mqdefault.jpg`:g==="vimeo"?d[t]=`https://i.vimeocdn.com/${u}/1000x563`:d[t]="",d[t]}function y(s){const t=s.trim();if(!t)return"";const[u,g]=b(t);return g==="youtube"?`https://www.youtube.com/oembed?url=https://www.youtube.com/watch?v=${u}&format=json`:g==="vimeo"?`https://vimeo.com/api/oembed.json?url=https://vimeo.com/${u}`:""}function w(s){const t=s.trim();return b(t).length>0}return I}var q=Ee();const re=m.lazy(()=>be(()=>import("./index-B8mnhcds.js"),__vite__mapDeps([0,1,2]),import.meta.url).then(r=>({default:r.Uploader}))),Oe=`${D.WELLKNOWN_SERVICE_PATH_PREFIX}/api/studio/logo/upload`,Ve=`${D.WELLKNOWN_SERVICE_PATH_PREFIX}/api/studio/screenshots/upload`,Le=`${D.WELLKNOWN_SERVICE_PATH_PREFIX}/api/studio/logo`,_=`${D.WELLKNOWN_SERVICE_PATH_PREFIX}/api/studio/screenshots`,De=`${D.WELLKNOWN_SERVICE_PATH_PREFIX}/api/studio/videos`,oe=5,ie=3;function Xe(){const{t:r,locale:a}=fe(),[p,b]=m.useState(!1),[n,c]=m.useState(!1),[d,P]=m.useState([]),[y,w]=m.useState([]),[s,t]=m.useState(""),[u,g]=m.useState(""),[j,O]=m.useState(Date.now()),l=Pe(async()=>{const i=await(await fetch(_)).json();return P(i.screenshots||[]),w(i.videos?.filter(h=>!!h)||[]),i}),f=m.useRef(null),C=m.useRef(null);if(l.loading&&!l.data)return e.jsx(F,{children:e.jsx(N,{size:40})});if(l.error)return e.jsx(F,{children:e.jsx(U,{direction:"column",spacing:1,sx:{mb:3},children:e.jsx(E,{sx:{color:"error.main",fontWeight:"bold"},children:l.error.message})})});const T=async o=>{const i=o.filter(h=>!!h);w(i),await fetch(De,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({videos:i})})},le=async o=>{const i=Array.from(y),[h]=i.splice(o.source.index,1);i.splice(o.destination.index,0,h),await T(i)},ce=async o=>{const i=Array.from(d),[h]=i.splice(o.source.index,1);i.splice(o.destination.index,0,h),P(i),await fetch(`${_}/reorder`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({screenshots:i})})},H=async o=>{o.destination&&(o.source.droppableId==="screenshots"?await ce(o):o.source.droppableId==="videos"&&await le(o),l.runAsync())},B=o=>{g(o.trim()),c(!0)},K=async(o,i="")=>{let h=[];i?h=o?y.map(v=>v===i?o.trim():v):y.filter(v=>v!==i):o&&(h=[...y,o.trim()]),g(""),c(!1),(o||i)&&await T(h),l.runAsync()},de=o=>{b(!0),t(o)},M=()=>{b(!1),t("")};function ue(){const o=[{label:r("studio.type"),value:"png, jpg, webp, svg"},{label:r("studio.ratio"),value:"256x256"},{label:r("studio.size"),value:"<500KB"}],i=[{label:r("studio.tip"),value:r("studio.change")}];return e.jsx($,{title:r("common.logo"),rules:o,tips:i,children:e.jsx(x,{sx:{flex:1,cursor:"pointer"},children:e.jsx(je,{variant:"square",sx:{width:128,height:128},alt:"Blocklet Logo",src:`${Le}?t=${j}`,onClick:()=>f.current?.open()})})})}function pe(){const o=[{label:r("studio.ratio"),value:"16 / 9"},{label:r("studio.count"),value:`1~${oe}`},{label:r("studio.size"),value:"<5MB"}],i=[{label:r("studio.tip"),value:r("studio.orderTipLong")}];return e.jsx($,{title:r("common.screenshot"),tips:i,rules:o,children:e.jsx(Q,{onDragEnd:H,children:e.jsx(G,{droppableId:"screenshots",direction:"horizontal",children:(v,V)=>e.jsxs(x,{ref:v.innerRef,...v.droppableProps,sx:{display:"flex",alignItems:"center",flex:1,mt:1,flexWrap:"wrap",minHeight:225,background:V.isDraggingOver?"#f5f5f5":"transparent",transition:"background-color 0.2s ease",border:V.isDraggingOver?"2px dashed #999":"none",borderRadius:"4px"},children:[d.map((S,z)=>e.jsx(ee,{draggableId:S,index:z,children:(R,L)=>{const X=`${_}/${S}`;return e.jsxs(x,{ref:R.innerRef,...R.draggableProps,...R.dragHandleProps,className:"image-wrapper",sx:{transform:L.isDragging?"scale(1.05)":"none",boxShadow:L.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,onClick:()=>de(S),style:{cursor:"pointer"}}),e.jsx(Y,{title:r("studio.deleteTooltip"),children:e.jsx(A,{className:"action",style:{top:10,color:"white",background:"red"},onClick:async()=>{await fetch(X,{method:"DELETE"}),l.runAsync()},children:e.jsx(J,{})})})]})}},S)),v.placeholder,d.length<oe&&h()]})})})});function h(){return e.jsx(x,{onClick:()=>C.current?.open(),sx:{display:"flex",justifyContent:"center",alignItems:"center",mb:2,width:400,height:225,fontSize:40,background:"#eee",cursor:"pointer",color:"#999"},children:"+"})}}function he(){const o=[{label:r("studio.count"),value:`1~${ie}`},{label:r("studio.videoType"),value:e.jsxs(e.Fragment,{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"})]})}],i=[{label:`${r("studio.tip")}`,value:r("studio.videoTipLong")}];return e.jsxs($,{title:r("studio.video"),tips:i,rules:o,children:[e.jsx(Q,{onDragEnd:H,children:e.jsx(G,{droppableId:"videos",direction:"horizontal",children:(v,V)=>e.jsxs(x,{ref:v.innerRef,...v.droppableProps,sx:{display:"flex",alignItems:"center",flex:1,mt:1,flexWrap:"wrap",minHeight:225,background:V.isDraggingOver?"#f5f5f5":"transparent",transition:"background-color 0.2s ease",border:V.isDraggingOver?"2px dashed #999":"none",borderRadius:"4px"},children:[y.map((S,z)=>e.jsx(ee,{draggableId:S,index:z,children:(R,L)=>e.jsxs(x,{ref:R.innerRef,...R.draggableProps,...R.dragHandleProps,className:"image-wrapper",sx:{transform:L.isDragging?"scale(1.05)":"none",boxShadow:L.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:"videos",src:q.getVideoCoverUrl(S),onClick:()=>B(S),style:{cursor:"pointer"}}),e.jsx(x,{sx:{position:"absolute",cursor:"pointer",fontSize:"3rem"},onClick:()=>B(S),children:e.jsx(ae,{})}),e.jsx(Y,{title:r("studio.deleteTooltip"),children:e.jsx(A,{className:"action",style:{top:10,color:"white",background:"red"},onClick:()=>K(null,S),children:e.jsx(J,{})})})]})},S)),v.placeholder,y.length<ie&&h()]})})}),n&&e.jsx(ne,{t:r,handleOperateVideo:K,defaultUrl:u,videos:y})]});function h(){return e.jsx(x,{onClick:()=>c(!0),sx:{display:"flex",justifyContent:"center",alignItems:"center",mb:2,width:400,height:225,fontSize:40,background:"#eee",cursor:"pointer",color:"#999"},children:"+"})}}function me(){return e.jsx(se,{open:p,onClose:M,maxWidth:"xl",slotProps:{paper:{style:{backgroundColor:"transparent",boxShadow:"none"}}},children:e.jsx("img",{src:`${_}/${s}`,alt:"Screenshot Full",style:{maxWidth:"90vw",maxHeight:"90vh",objectFit:"contain"},onClick:M})})}function xe(){return e.jsxs(m.Suspense,{fallback:e.jsx(N,{size:40}),children:[e.jsx(re,{ref:f,locale:a,popup:!0,onUploadFinish:()=>{f.current?.close(),O(Date.now()),l.runAsync()},plugins:["ImageEditor"],installerProps:{disabled:!0},apiPathProps:{uploader:Oe,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"),e.jsx(re,{ref:C,locale:a,popup:!0,onUploadFinish:()=>{C.current?.close(),l.runAsync()},installerProps:{disabled:!0},plugins:["ImageEditor"],apiPathProps:{uploader:Ve,disableMediaKitPrefix:!0,disableMediaKitStatus:!0},coreProps:{restrictions:{allowedFileTypes:["image/*","image/svg+xml"],maxFileSize:1024*1024*5,maxNumberOfFiles:5-d.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")]})}const ge=`https://www.arcblock.io/docs/blocklet-store/${a}/supplying-images`;return e.jsx(F,{children:e.jsxs(Te,{children:[e.jsxs(U,{direction:"column",spacing:1,sx:{mb:3},children:[e.jsx(E,{variant:"h5",sx:{fontWeight:"bold"},children:r("studio.title",{title:l.data?.title})}),e.jsxs(E,{variant:"body2",sx:{color:"text.secondary"},children:[r("studio.description")," ",e.jsx("a",{href:ge,target:"_blank",rel:"noreferrer",children:r("studio.documentation")})]})]}),ue(),pe(),he(),me(),xe()]})})}function $({title:r,rules:a,tips:p,children:b}){return e.jsxs(x,{sx:{display:"flex",flexDirection:"column",mb:4},children:[e.jsxs(U,{direction:"column",spacing:1,sx:{mb:2},children:[e.jsx(E,{variant:"h6",sx:{fontWeight:"bold"},children:r}),e.jsx(U,{direction:"row",spacing:2,sx:{fontSize:"13px",opacity:.8},children:a.map(c=>n(c.label,c.value))}),p.map(c=>e.jsx(x,{sx:{fontSize:"13px",opacity:.8},children:n(c.label,c.value)}))]}),b]});function n(c,d){return e.jsxs(x,{component:"span",children:[e.jsxs(x,{component:"span",sx:{color:"#555",mr:.5},children:[c,":"]}),e.jsx(x,{component:"span",sx:{color:"#007ec6"},children:d})]})}}$.propTypes={title:k.string.isRequired,rules:k.array.isRequired,tips:k.array.isRequired,children:k.node.isRequired};function ne({handleOperateVideo:r,t:a,defaultUrl:p="",videos:b}){const[n,c]=m.useState(p),[d,P]=m.useState(!1),[y,w]=m.useState(!1),s=m.useRef(n),t=n!==p&&b.includes(n),u=!n&&p,g=!t&&(n&&n!==s.current||d),j=!!navigator.clipboard?.readText,{run:O}=Re(l,{wait:500,leading:!0});return e.jsxs(se,{open:!0,fullWidth:!0,maxWidth:"sm",children:[e.jsx(ye,{children:a(p?"studio.videoDialogEditTitle":"studio.videoDialogTitle")}),e.jsxs(we,{children:[e.jsx(Ce,{fullWidth:!0,value:n,onChange:f=>{const C=f.target.value.trim();c(C),C?O(C):w(!1)},placeholder:a("studio.videoInputLabel"),endAdornment:n?e.jsx(Z,{position:"end",children:e.jsx(A,{onClick:()=>{c(""),l("")},children:e.jsx(Se,{})})}):j&&e.jsx(Z,{position:"end",children:e.jsx(A,{onClick:async()=>{try{const f=(await navigator.clipboard.readText()||"").trim();c(f),l(f)}catch(f){console.error(f)}},children:e.jsx(Ie,{})})})}),e.jsxs(x,{sx:{mb:2,mt:.5},children:[t&&e.jsx(E,{variant:"body2",color:"error",children:a("studio.duplicateVideo")}),!t&&y&&e.jsx(E,{variant:"body2",color:"error",children:a("studio.videoDialogNoSrc")})]}),s.current?e.jsx("iframe",{width:"100%",height:"315",title:`video-${s.current}`,src:q.getEmbedUrl(s.current),allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share",allowFullScreen:!0,border:"1px solid #eee"}):e.jsx(x,{sx:{display:"flex",justifyContent:"center",alignItems:"center",height:315,width:"100%",border:"1px solid #eee"},children:d?e.jsx(N,{size:40}):e.jsx(E,{variant:"h5",sx:{color:"text.secondary"},children:e.jsx(ae,{})})})]}),e.jsxs(ke,{children:[e.jsx(W,{onClick:()=>r(),children:a("studio.cancel")}),u&&e.jsx(W,{variant:"contained",color:"error",onClick:()=>r(null,p),children:a("studio.delete")}),g&&e.jsx(W,{variant:"contained",onClick:()=>l(n),disabled:!n||d,children:a("studio.preview")}),!u&&!g&&e.jsx(W,{variant:"contained",onClick:()=>r(s.current),disabled:!s.current||p===s.current||t,children:a("studio.confirm")})]})]});function l(f){s.current="";const C=q.getVideoCheckUrl(f);w(f?!C:!1),C&&(P(!0),fetch(C).then(T=>{T.ok?(s.current=f,w(!1)):w(!0)}).catch(()=>{w(!0)}).finally(()=>P(!1)))}}ne.propTypes={handleOperateVideo:k.func.isRequired,t:k.func.isRequired,defaultUrl:k.string,videos:k.array.isRequired};function ae(){return e.jsxs("svg",{viewBox:"0 0 56 56",fill:"none",xmlns:"http://www.w3.org/2000/svg",height:48,width:48,children:[e.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M28 56C43.464 56 56 43.464 56 28C56 12.536 43.464 0 28 0C12.536 0 0 12.536 0 28C0 43.464 12.536 56 28 56Z",fill:"black","fill-opacity":"0.54"}),e.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M39.6667 28L21 17.5V38.5L39.6667 28Z",fill:"white"})]})}const Te=ve.div`
2
+ import{V as fe,_ as be}from"./vendor-ux-D507n6h6.js";import{j as e,b1 as U,T as E,ak as x,b4 as je,am as Y,I as A,bX as J,Y as se,at as ve,bC as ye,$ as we,bw as Ce,A as Z,aJ as Se,bY as Ie,R as ke,Q as W,W as k}from"./vendor-mui-core-BPQ6AEW_.js";import{c as D}from"./index-CeWTwSLE.js";import{E as N}from"./empty-spinner-G6osPzkH.js";import{k as Pe,u as Re}from"./vendor-hooks-fhL5FJET.js";import{r as m}from"./vendor-react-CUXIiAnY.js";import{D as Q,C as G,P as ee}from"./react-beautiful-dnd.esm-Clor-N66.js";import{S as F}from"./studio-DtnYEBjZ.js";import"./vendor-utils-BSZ4yJws.js";import"./lottie-web-4koyQiv_.js";import"./vendor-arcblock-BL_VyzmH.js";import"./raf-schd.esm-JNUhxcps.js";import"./index-Xg-It3qI.js";var I={},te;function Ee(){if(te)return I;te=1,Object.defineProperty(I,"__esModule",{value:!0}),I.getVideoId=b,I.getEmbedUrl=c,I.getVideoCoverUrl=P,I.getVideoCheckUrl=y,I.getYoutubeId=r,I.getVimeoId=a,I.isVideoUrl=w;function r(s){const t=s.trim();return t.includes("youtu.be/")?t.split("youtu.be/")[1]?.split("?")[0]:t.includes("/embed/")?t.split("/embed/")[1]?.split("?")[0]:t.includes("youtube.com/watch")?new URL(t).searchParams.get("v"):t.includes("youtube.com/shorts/")?t.split("/shorts/")[1]?.split("?")[0]:""}function a(s){const t=s.trim();return t.includes("/embed/")?t.split("/embed/")[1]?.split("?")[0]:t.includes("vimeo.com/video/")?t.split("/video/")[1]?.split("?")[0]:t.includes("vimeo.com/channels/")?t.split("/channels/")[1]?.split("/")[1]?.split("?")[0]:t.includes("vimeo.com/groups/")?t.split("/groups/")[1]?.split("/")[1]?.split("?")[0]:t.includes("vimeo.com/")?t.split("vimeo.com/")[1]?.split("?")[0]:""}const p={};function b(s){const t=s.trim();return!t||!/^https?:\/\/.+\..+/.test(t)?[]:(p[t]||(p[t]=(()=>{const u=new URL(t);return u.host.includes("youtube.com")||u.host.includes("youtu.be")?[r(t),"youtube"]:u.host.includes("vimeo.com")?[a(t),"vimeo"]:[]})()),p[t])}const n={};function c(s,{modestbranding:t=1,controls:u=0,autoplay:g=0}={}){const j=s.trim();if(!j)return"";if(n[j]!==void 0)return n[j];const[O,l]=b(j);return l==="youtube"?n[j]=`https://www.youtube.com/embed/${O}?modestbranding=${t}&controls=${u}&autoplay=${g}`:l==="vimeo"?n[j]=`https://player.vimeo.com/video/${O}?autoplay=${g}`:n[j]="",n[j]}const d={};function P(s){const t=s.trim();if(!t)return"";if(d[t]!==void 0)return d[t];const[u,g]=b(t);return g==="youtube"?d[t]=`https://img.youtube.com/vi/${u}/mqdefault.jpg`:g==="vimeo"?d[t]=`https://i.vimeocdn.com/${u}/1000x563`:d[t]="",d[t]}function y(s){const t=s.trim();if(!t)return"";const[u,g]=b(t);return g==="youtube"?`https://www.youtube.com/oembed?url=https://www.youtube.com/watch?v=${u}&format=json`:g==="vimeo"?`https://vimeo.com/api/oembed.json?url=https://vimeo.com/${u}`:""}function w(s){const t=s.trim();return b(t).length>0}return I}var q=Ee();const re=m.lazy(()=>be(()=>import("./index-Bns8G6yV.js"),__vite__mapDeps([0,1,2]),import.meta.url).then(r=>({default:r.Uploader}))),Oe=`${D.WELLKNOWN_SERVICE_PATH_PREFIX}/api/studio/logo/upload`,Ve=`${D.WELLKNOWN_SERVICE_PATH_PREFIX}/api/studio/screenshots/upload`,Le=`${D.WELLKNOWN_SERVICE_PATH_PREFIX}/api/studio/logo`,_=`${D.WELLKNOWN_SERVICE_PATH_PREFIX}/api/studio/screenshots`,De=`${D.WELLKNOWN_SERVICE_PATH_PREFIX}/api/studio/videos`,oe=5,ie=3;function Xe(){const{t:r,locale:a}=fe(),[p,b]=m.useState(!1),[n,c]=m.useState(!1),[d,P]=m.useState([]),[y,w]=m.useState([]),[s,t]=m.useState(""),[u,g]=m.useState(""),[j,O]=m.useState(Date.now()),l=Pe(async()=>{const i=await(await fetch(_)).json();return P(i.screenshots||[]),w(i.videos?.filter(h=>!!h)||[]),i}),f=m.useRef(null),C=m.useRef(null);if(l.loading&&!l.data)return e.jsx(F,{children:e.jsx(N,{size:40})});if(l.error)return e.jsx(F,{children:e.jsx(U,{direction:"column",spacing:1,sx:{mb:3},children:e.jsx(E,{sx:{color:"error.main",fontWeight:"bold"},children:l.error.message})})});const T=async o=>{const i=o.filter(h=>!!h);w(i),await fetch(De,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({videos:i})})},le=async o=>{const i=Array.from(y),[h]=i.splice(o.source.index,1);i.splice(o.destination.index,0,h),await T(i)},ce=async o=>{const i=Array.from(d),[h]=i.splice(o.source.index,1);i.splice(o.destination.index,0,h),P(i),await fetch(`${_}/reorder`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({screenshots:i})})},H=async o=>{o.destination&&(o.source.droppableId==="screenshots"?await ce(o):o.source.droppableId==="videos"&&await le(o),l.runAsync())},B=o=>{g(o.trim()),c(!0)},K=async(o,i="")=>{let h=[];i?h=o?y.map(v=>v===i?o.trim():v):y.filter(v=>v!==i):o&&(h=[...y,o.trim()]),g(""),c(!1),(o||i)&&await T(h),l.runAsync()},de=o=>{b(!0),t(o)},M=()=>{b(!1),t("")};function ue(){const o=[{label:r("studio.type"),value:"png, jpg, webp, svg"},{label:r("studio.ratio"),value:"256x256"},{label:r("studio.size"),value:"<500KB"}],i=[{label:r("studio.tip"),value:r("studio.change")}];return e.jsx($,{title:r("common.logo"),rules:o,tips:i,children:e.jsx(x,{sx:{flex:1,cursor:"pointer"},children:e.jsx(je,{variant:"square",sx:{width:128,height:128},alt:"Blocklet Logo",src:`${Le}?t=${j}`,onClick:()=>f.current?.open()})})})}function pe(){const o=[{label:r("studio.ratio"),value:"16 / 9"},{label:r("studio.count"),value:`1~${oe}`},{label:r("studio.size"),value:"<5MB"}],i=[{label:r("studio.tip"),value:r("studio.orderTipLong")}];return e.jsx($,{title:r("common.screenshot"),tips:i,rules:o,children:e.jsx(Q,{onDragEnd:H,children:e.jsx(G,{droppableId:"screenshots",direction:"horizontal",children:(v,V)=>e.jsxs(x,{ref:v.innerRef,...v.droppableProps,sx:{display:"flex",alignItems:"center",flex:1,mt:1,flexWrap:"wrap",minHeight:225,background:V.isDraggingOver?"#f5f5f5":"transparent",transition:"background-color 0.2s ease",border:V.isDraggingOver?"2px dashed #999":"none",borderRadius:"4px"},children:[d.map((S,z)=>e.jsx(ee,{draggableId:S,index:z,children:(R,L)=>{const X=`${_}/${S}`;return e.jsxs(x,{ref:R.innerRef,...R.draggableProps,...R.dragHandleProps,className:"image-wrapper",sx:{transform:L.isDragging?"scale(1.05)":"none",boxShadow:L.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,onClick:()=>de(S),style:{cursor:"pointer"}}),e.jsx(Y,{title:r("studio.deleteTooltip"),children:e.jsx(A,{className:"action",style:{top:10,color:"white",background:"red"},onClick:async()=>{await fetch(X,{method:"DELETE"}),l.runAsync()},children:e.jsx(J,{})})})]})}},S)),v.placeholder,d.length<oe&&h()]})})})});function h(){return e.jsx(x,{onClick:()=>C.current?.open(),sx:{display:"flex",justifyContent:"center",alignItems:"center",mb:2,width:400,height:225,fontSize:40,background:"#eee",cursor:"pointer",color:"#999"},children:"+"})}}function he(){const o=[{label:r("studio.count"),value:`1~${ie}`},{label:r("studio.videoType"),value:e.jsxs(e.Fragment,{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"})]})}],i=[{label:`${r("studio.tip")}`,value:r("studio.videoTipLong")}];return e.jsxs($,{title:r("studio.video"),tips:i,rules:o,children:[e.jsx(Q,{onDragEnd:H,children:e.jsx(G,{droppableId:"videos",direction:"horizontal",children:(v,V)=>e.jsxs(x,{ref:v.innerRef,...v.droppableProps,sx:{display:"flex",alignItems:"center",flex:1,mt:1,flexWrap:"wrap",minHeight:225,background:V.isDraggingOver?"#f5f5f5":"transparent",transition:"background-color 0.2s ease",border:V.isDraggingOver?"2px dashed #999":"none",borderRadius:"4px"},children:[y.map((S,z)=>e.jsx(ee,{draggableId:S,index:z,children:(R,L)=>e.jsxs(x,{ref:R.innerRef,...R.draggableProps,...R.dragHandleProps,className:"image-wrapper",sx:{transform:L.isDragging?"scale(1.05)":"none",boxShadow:L.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:"videos",src:q.getVideoCoverUrl(S),onClick:()=>B(S),style:{cursor:"pointer"}}),e.jsx(x,{sx:{position:"absolute",cursor:"pointer",fontSize:"3rem"},onClick:()=>B(S),children:e.jsx(ae,{})}),e.jsx(Y,{title:r("studio.deleteTooltip"),children:e.jsx(A,{className:"action",style:{top:10,color:"white",background:"red"},onClick:()=>K(null,S),children:e.jsx(J,{})})})]})},S)),v.placeholder,y.length<ie&&h()]})})}),n&&e.jsx(ne,{t:r,handleOperateVideo:K,defaultUrl:u,videos:y})]});function h(){return e.jsx(x,{onClick:()=>c(!0),sx:{display:"flex",justifyContent:"center",alignItems:"center",mb:2,width:400,height:225,fontSize:40,background:"#eee",cursor:"pointer",color:"#999"},children:"+"})}}function me(){return e.jsx(se,{open:p,onClose:M,maxWidth:"xl",slotProps:{paper:{style:{backgroundColor:"transparent",boxShadow:"none"}}},children:e.jsx("img",{src:`${_}/${s}`,alt:"Screenshot Full",style:{maxWidth:"90vw",maxHeight:"90vh",objectFit:"contain"},onClick:M})})}function xe(){return e.jsxs(m.Suspense,{fallback:e.jsx(N,{size:40}),children:[e.jsx(re,{ref:f,locale:a,popup:!0,onUploadFinish:()=>{f.current?.close(),O(Date.now()),l.runAsync()},plugins:["ImageEditor"],installerProps:{disabled:!0},apiPathProps:{uploader:Oe,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"),e.jsx(re,{ref:C,locale:a,popup:!0,onUploadFinish:()=>{C.current?.close(),l.runAsync()},installerProps:{disabled:!0},plugins:["ImageEditor"],apiPathProps:{uploader:Ve,disableMediaKitPrefix:!0,disableMediaKitStatus:!0},coreProps:{restrictions:{allowedFileTypes:["image/*","image/svg+xml"],maxFileSize:1024*1024*5,maxNumberOfFiles:5-d.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")]})}const ge=`https://www.arcblock.io/docs/blocklet-store/${a}/supplying-images`;return e.jsx(F,{children:e.jsxs(Te,{children:[e.jsxs(U,{direction:"column",spacing:1,sx:{mb:3},children:[e.jsx(E,{variant:"h5",sx:{fontWeight:"bold"},children:r("studio.title",{title:l.data?.title})}),e.jsxs(E,{variant:"body2",sx:{color:"text.secondary"},children:[r("studio.description")," ",e.jsx("a",{href:ge,target:"_blank",rel:"noreferrer",children:r("studio.documentation")})]})]}),ue(),pe(),he(),me(),xe()]})})}function $({title:r,rules:a,tips:p,children:b}){return e.jsxs(x,{sx:{display:"flex",flexDirection:"column",mb:4},children:[e.jsxs(U,{direction:"column",spacing:1,sx:{mb:2},children:[e.jsx(E,{variant:"h6",sx:{fontWeight:"bold"},children:r}),e.jsx(U,{direction:"row",spacing:2,sx:{fontSize:"13px",opacity:.8},children:a.map(c=>n(c.label,c.value))}),p.map(c=>e.jsx(x,{sx:{fontSize:"13px",opacity:.8},children:n(c.label,c.value)}))]}),b]});function n(c,d){return e.jsxs(x,{component:"span",children:[e.jsxs(x,{component:"span",sx:{color:"#555",mr:.5},children:[c,":"]}),e.jsx(x,{component:"span",sx:{color:"#007ec6"},children:d})]})}}$.propTypes={title:k.string.isRequired,rules:k.array.isRequired,tips:k.array.isRequired,children:k.node.isRequired};function ne({handleOperateVideo:r,t:a,defaultUrl:p="",videos:b}){const[n,c]=m.useState(p),[d,P]=m.useState(!1),[y,w]=m.useState(!1),s=m.useRef(n),t=n!==p&&b.includes(n),u=!n&&p,g=!t&&(n&&n!==s.current||d),j=!!navigator.clipboard?.readText,{run:O}=Re(l,{wait:500,leading:!0});return e.jsxs(se,{open:!0,fullWidth:!0,maxWidth:"sm",children:[e.jsx(ye,{children:a(p?"studio.videoDialogEditTitle":"studio.videoDialogTitle")}),e.jsxs(we,{children:[e.jsx(Ce,{fullWidth:!0,value:n,onChange:f=>{const C=f.target.value.trim();c(C),C?O(C):w(!1)},placeholder:a("studio.videoInputLabel"),endAdornment:n?e.jsx(Z,{position:"end",children:e.jsx(A,{onClick:()=>{c(""),l("")},children:e.jsx(Se,{})})}):j&&e.jsx(Z,{position:"end",children:e.jsx(A,{onClick:async()=>{try{const f=(await navigator.clipboard.readText()||"").trim();c(f),l(f)}catch(f){console.error(f)}},children:e.jsx(Ie,{})})})}),e.jsxs(x,{sx:{mb:2,mt:.5},children:[t&&e.jsx(E,{variant:"body2",color:"error",children:a("studio.duplicateVideo")}),!t&&y&&e.jsx(E,{variant:"body2",color:"error",children:a("studio.videoDialogNoSrc")})]}),s.current?e.jsx("iframe",{width:"100%",height:"315",title:`video-${s.current}`,src:q.getEmbedUrl(s.current),allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share",allowFullScreen:!0,border:"1px solid #eee"}):e.jsx(x,{sx:{display:"flex",justifyContent:"center",alignItems:"center",height:315,width:"100%",border:"1px solid #eee"},children:d?e.jsx(N,{size:40}):e.jsx(E,{variant:"h5",sx:{color:"text.secondary"},children:e.jsx(ae,{})})})]}),e.jsxs(ke,{children:[e.jsx(W,{onClick:()=>r(),children:a("studio.cancel")}),u&&e.jsx(W,{variant:"contained",color:"error",onClick:()=>r(null,p),children:a("studio.delete")}),g&&e.jsx(W,{variant:"contained",onClick:()=>l(n),disabled:!n||d,children:a("studio.preview")}),!u&&!g&&e.jsx(W,{variant:"contained",onClick:()=>r(s.current),disabled:!s.current||p===s.current||t,children:a("studio.confirm")})]})]});function l(f){s.current="";const C=q.getVideoCheckUrl(f);w(f?!C:!1),C&&(P(!0),fetch(C).then(T=>{T.ok?(s.current=f,w(!1)):w(!0)}).catch(()=>{w(!0)}).finally(()=>P(!1)))}}ne.propTypes={handleOperateVideo:k.func.isRequired,t:k.func.isRequired,defaultUrl:k.string,videos:k.array.isRequired};function ae(){return e.jsxs("svg",{viewBox:"0 0 56 56",fill:"none",xmlns:"http://www.w3.org/2000/svg",height:48,width:48,children:[e.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M28 56C43.464 56 56 43.464 56 28C56 12.536 43.464 0 28 0C12.536 0 0 12.536 0 28C0 43.464 12.536 56 28 56Z",fill:"black","fill-opacity":"0.54"}),e.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M39.6667 28L21 17.5V38.5L39.6667 28Z",fill:"white"})]})}const Te=ve.div`
3
3
  margin-top: 24px;
4
4
  .image-wrapper {
5
5
  margin-bottom: 16px;
@@ -0,0 +1 @@
1
+ import{j as t,ak as r,W as p}from"./vendor-mui-core-BPQ6AEW_.js";import m from"./branding-DmNLEN0a.js";import{Y as o}from"./index-CeWTwSLE.js";import"./vendor-react-CUXIiAnY.js";import"./vendor-ux-D507n6h6.js";import"./vendor-utils-BSZ4yJws.js";import"./vendor-hooks-fhL5FJET.js";import"./lottie-web-4koyQiv_.js";import"./sanitize-Bm63FeNh.js";import"./omit-W13eVnqC.js";import"./index-BsA1v5Kx.js";import"./form-text-input-BFJU5Psq.js";import"./required-Btg6mEmX.js";import"./form-wrapper-CU8kJXy5.js";import"./edit.svg-Dz9cVo7r.js";import"./permission-CiiVpApl.js";import"./session-CJQ7HeL8.js";import"./use-app-logo-D38VoM1R.js";import"./logo-uploader-BgXq5jHQ.js";import"./section-Cyr0YvGa.js";import"./vendor-arcblock-BL_VyzmH.js";function s({blocklet:i}){return t.jsx(r,{sx:{width:"100%","& .section-left":{width:340},"& .section":{gap:3}},children:t.jsx(m,{blocklet:i,showFields:[o.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_NAME,o.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_DESCRIPTION,o.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_LOGO]})})}s.propTypes={blocklet:p.object.isRequired};export{s as default};