@abtnode/webapp 1.16.29-beta-bb5685f8 → 1.16.29-beta-44e63d18

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 (212) hide show
  1. package/blocklet.js +1 -1
  2. package/blocklet.yml +1 -1
  3. package/dist/assets/{Add-C0jlH_zP.js → Add-CtWL6e1q.js} +1 -1
  4. package/dist/assets/{ArrowDropDown-DrehtX2f.js → ArrowDropDown-DV5W7OwL.js} +1 -1
  5. package/dist/assets/{Autocomplete-CdIGu-2l.js → Autocomplete-DyU5KK53.js} +1 -1
  6. package/dist/assets/{Breadcrumbs-Oi4z-7JU.js → Breadcrumbs-BMUTpqOP.js} +1 -1
  7. package/dist/assets/{ButtonGroup-NvrTYf1s.js → ButtonGroup-CkKt07uc.js} +1 -1
  8. package/dist/assets/{CheckCircle-uTfAh2GX.js → CheckCircle-CstzeHGf.js} +1 -1
  9. package/dist/assets/{ChevronLeft-C-HoTf-Q.js → ChevronLeft-ChWv_0Iv.js} +1 -1
  10. package/dist/assets/{ChevronRight-c5xZzIfK.js → ChevronRight-B2EtVjwt.js} +1 -1
  11. package/dist/assets/{Close-C5A1sroQ.js → Close-CyRwkk-q.js} +1 -1
  12. package/dist/assets/Delete-DvKqIX20.js +1 -0
  13. package/dist/assets/{DeleteOutline-DuzabIUt.js → DeleteOutline-CddvKtlT.js} +1 -1
  14. package/dist/assets/DeleteOutline-DZhkyDfV.js +1 -0
  15. package/dist/assets/{Done-MfHSISFV.js → Done-BQwAUEUo.js} +1 -1
  16. package/dist/assets/{Edit-Cn_G48ZU.js → Edit-CARh1zds.js} +1 -1
  17. package/dist/assets/{EditIcon-B1ovGBjD.js → EditIcon-C_npOrmv.js} +1 -1
  18. package/dist/assets/{FilterList-DiA-6Il8.js → FilterList-BvE0UAo0.js} +5 -5
  19. package/dist/assets/{Google-DQdWmIOC.js → Google-ZjI0DrLI.js} +1 -1
  20. package/dist/assets/{Https-BRpH0Ae8.js → Https-6N1TcHuj.js} +1 -1
  21. package/dist/assets/{InputAdornment-CDb1Pg-S.js → InputAdornment-7qAmlR7q.js} +1 -1
  22. package/dist/assets/{InputLabel-Xa0HFZxn.js → InputLabel-BTEO1M40.js} +1 -1
  23. package/dist/assets/{LastPage-BtCi2wuv.js → LastPage-GiOUS0-i.js} +1 -1
  24. package/dist/assets/{Launch-BRBdnw92.js → Launch-BNP89Oc8.js} +1 -1
  25. package/dist/assets/{Link-B8edwUNQ.js → Link-DPfyUdIn.js} +1 -1
  26. package/dist/assets/{LoadingButton-UpGMfSHA.js → LoadingButton-DQPvdwNz.js} +1 -1
  27. package/dist/assets/{LockIcon-Bs5dBhg9.js → LockIcon-DsRpj_gz.js} +1 -1
  28. package/dist/assets/{Loop-QRcaFYyu.js → Loop-CqukocCd.js} +1 -1
  29. package/dist/assets/{MoreVert-0x6ZKOOm.js → MoreVert-dIXJT0E2.js} +1 -1
  30. package/dist/assets/{Pagination-BWwDGBkP.js → Pagination-Xjpbun1V.js} +1 -1
  31. package/dist/assets/{Public-DBy7o1UF.js → Public-jBeoVLdm.js} +1 -1
  32. package/dist/assets/{SchemaReference.es-p0gT2gqO.js → SchemaReference.es-DmsnLofb.js} +1 -1
  33. package/dist/assets/{Search-DwG5nouB.js → Search-CXF_z21D.js} +1 -1
  34. package/dist/assets/{Select-CjUz8jvK.js → Select-Ck-rwnxI.js} +2 -2
  35. package/dist/assets/{Skeleton-CDB0GyGY.js → Skeleton-bh5z66KF.js} +5 -5
  36. package/dist/assets/{Slider-DwYIlYBn.js → Slider-mP-9Rabl.js} +1 -1
  37. package/dist/assets/{Stepper-antHQYRF.js → Stepper-3wmaNEG9.js} +1 -1
  38. package/dist/assets/{TextField-WEzwgjP0.js → TextField-Cb0I13kb.js} +1 -1
  39. package/dist/assets/{ToggleButtonGroup-dJuSsWUY.js → ToggleButtonGroup-GwWpjRQx.js} +1 -1
  40. package/dist/assets/{ViewList-BAMGdQxk.js → ViewList-Bf6MkAgw.js} +1 -1
  41. package/dist/assets/{actions-BbcoFZjT.js → actions-D2Nr19i-.js} +1 -1
  42. package/dist/assets/actions-D4SIeJQs.js +11 -0
  43. package/dist/assets/{agreement-CiDOtCXU.js → agreement-B52xwcRE.js} +1 -1
  44. package/dist/assets/api-BkA5hx89.js +1 -0
  45. package/dist/assets/app-avatar-ClIQjaP-.js +1 -0
  46. package/dist/assets/ar-DdaiKEoW.js +1 -0
  47. package/dist/assets/{audit-logs-C-4-t6rX.js → audit-logs-CAczoYFX.js} +1 -1
  48. package/dist/assets/blocklet-DbOAUQG9.js +1 -0
  49. package/dist/assets/{brace-fold.es-CGT1cM_X.js → brace-fold.es-D4FLzACD.js} +1 -1
  50. package/dist/assets/{bundle-avatar-BRoQ90__.js → bundle-avatar-CGsU-HbI.js} +1 -1
  51. package/dist/assets/{chart-DnmL96Rh.js → chart-og0vxN0J.js} +2 -2
  52. package/dist/assets/{click-to-copy-Pr-Zbrif.js → click-to-copy-DKenG9LX.js} +1 -1
  53. package/dist/assets/{closebrackets.es-DsNYy4i3.js → closebrackets.es-B9xGBc1l.js} +1 -1
  54. package/dist/assets/{codemirror.es-DwAzghgf.js → codemirror.es-DnfFbgQm.js} +1 -1
  55. package/dist/assets/{comment.es-DhPl6sms.js → comment.es-DcJgW-0Z.js} +1 -1
  56. package/dist/assets/{config-navigation-DAD-pXS6.js → config-navigation-CrhKH9Mi.js} +1 -1
  57. package/dist/assets/de-PoTDtu-y.js +1 -0
  58. package/dist/assets/{delete-confirm-C2q7Vvj-.js → delete-confirm-DX-XHcl9.js} +1 -1
  59. package/dist/assets/{detail-BTV64Agz.js → detail-ADHPCJ2i.js} +3 -3
  60. package/dist/assets/{dialog.es-Bbrn4b99.js → dialog.es-9xd4UJpC.js} +1 -1
  61. package/dist/assets/{download-B9hXOuXD.js → download-Bg-C4aNR.js} +5 -5
  62. package/dist/assets/es-D79-uip0.js +1 -0
  63. package/dist/assets/{foldgutter.es-BJubswZD.js → foldgutter.es-C7HbANvK.js} +1 -1
  64. package/dist/assets/fr-Dgc_te8c.js +1 -0
  65. package/dist/assets/getValidReactChildren-ClGStIXY.js +1 -0
  66. package/dist/assets/hi-BndsdrdI.js +1 -0
  67. package/dist/assets/{hint.es-C-RplnH-.js → hint.es-CG2lL-pn.js} +1 -1
  68. package/dist/assets/{hint.es2-CNgpWTT8.js → hint.es2-OvG49YiM.js} +1 -1
  69. package/dist/assets/id-8ozDjIcf.js +1 -0
  70. package/dist/assets/{iframe-z1F3R-br.js → iframe-xnXRzLO_.js} +1 -1
  71. package/dist/assets/{index-C_LsHXyQ.js → index-6AreGVDd.js} +1 -1
  72. package/dist/assets/index-AEn2e-Qa.js +288 -0
  73. package/dist/assets/{index-3GrPYR-0.js → index-B1TlfhV-.js} +1 -1
  74. package/dist/assets/{index-GDpPN-gh.js → index-B4dfyqei.js} +1 -1
  75. package/dist/assets/{index-DOduirD-.js → index-B97h6iDo.js} +1 -1
  76. package/dist/assets/{index-P3idGO87.js → index-BC3241Rp.js} +1 -1
  77. package/dist/assets/index-BH4drhf0.js +11 -0
  78. package/dist/assets/index-BPdt_6z_.js +302 -0
  79. package/dist/assets/{index-BniMuAse.js → index-BSCYY90A.js} +1 -1
  80. package/dist/assets/{index-CdfKqS5O.js → index-BWIy-1uj.js} +1 -1
  81. package/dist/assets/{index-n9PgzTmH.js → index-BijlUenA.js} +1 -1
  82. package/dist/assets/index-Bj9cH_TN.js +58 -0
  83. package/dist/assets/index-BkRPFnv6.js +912 -0
  84. package/dist/assets/{index-BYxffRHK.js → index-Bz7VE6Lo.js} +1 -1
  85. package/dist/assets/{index-BKYjcIDk.js → index-C9Z58DAP.js} +1 -1
  86. package/dist/assets/{index-Amewrci5.js → index-CMXoms2z.js} +1 -1
  87. package/dist/assets/{index-7QaQQyyg.js → index-CTYM657U.js} +1 -1
  88. package/dist/assets/{index-Ddq4jr_U.js → index-CXlxAjbt.js} +207 -207
  89. package/dist/assets/index-CYxeq-8x.js +1 -0
  90. package/dist/assets/{index-BeATEtzy.js → index-Cb6algTF.js} +1 -1
  91. package/dist/assets/{index-D5kwWkvv.js → index-CbAiaQ3F.js} +9 -9
  92. package/dist/assets/{index-B-ejgY6o.js → index-Cj_T0gK-.js} +1 -1
  93. package/dist/assets/index-D2iFVes6.js +9 -0
  94. package/dist/assets/{index-eBDS1eXE.js → index-D4bAAnjl.js} +1 -1
  95. package/dist/assets/index-D7vDNazA.js +21 -0
  96. package/dist/assets/{index-DqaA-1j3.js → index-DLx4dGje.js} +8 -8
  97. package/dist/assets/{index-DcDo8U3a.js → index-DS3w7X0-.js} +1 -1
  98. package/dist/assets/{index-Bd27-rFC.js → index-DUQBU3A3.js} +1 -1
  99. package/dist/assets/{index-DdpOtHIy.js → index-DjIprepw.js} +1 -1
  100. package/dist/assets/{index-BDKa_BY3.js → index-Dk1ISn-T.js} +13 -13
  101. package/dist/assets/{index-nRTaNnQw.js → index-Dl1gEDFs.js} +1 -1
  102. package/dist/assets/{index-C2d2WkHe.js → index-DlMosniW.js} +4 -4
  103. package/dist/assets/{index-BuCL0HpY.js → index-Dr_hAN7j.js} +1 -1
  104. package/dist/assets/{index-BNcfbTbf.js → index-DsrFOtgZ.js} +1 -1
  105. package/dist/assets/{index-9TIeU8eV.js → index-Dw6RXFE7.js} +5 -5
  106. package/dist/assets/{index-DKWkPDvp.js → index-EsfHMeNl.js} +2 -2
  107. package/dist/assets/{index-KpJXpdYI.js → index-HICQj4hv.js} +1 -1
  108. package/dist/assets/{index-D-5tSEIi.js → index-KEDAiU9B.js} +8 -8
  109. package/dist/assets/{index-CgtLAydP.js → index-WTVw0qkz.js} +1 -1
  110. package/dist/assets/index-ZG7jWpak.js +1 -0
  111. package/dist/assets/{index-BJgIXaX1.js → index-g_cLscfb.js} +2 -2
  112. package/dist/assets/{index-qxGoRIpD.js → index-mnqV3Gg1.js} +1 -1
  113. package/dist/assets/{index-Dx7GtFO4.js → index-oDvmOv_q.js} +1 -1
  114. package/dist/assets/{index-HfmVdk5l.js → index-vr3RQzyc.js} +1 -1
  115. package/dist/assets/{index-DmQo-C54.js → index-yN879Jjz.js} +3 -3
  116. package/dist/assets/{index.es-mE5_ixZH.js → index.es-B4FMDGXT.js} +1 -1
  117. package/dist/assets/{index.esm-fGXhVzzq.js → index.esm-BSlWfzeP.js} +1 -1
  118. package/dist/assets/{info-addon.es-BvVuxhQQ.js → info-addon.es-CmaDZTYX.js} +1 -1
  119. package/dist/assets/{info.es-MM55o9RA.js → info.es-CqlQtF1J.js} +1 -1
  120. package/dist/assets/{install-from-url-D0Mot9As.js → install-from-url-D85z_2dU.js} +1 -1
  121. package/dist/assets/{invitation-DQ7pnJkF.js → invitation-CzzPC7mZ.js} +7 -7
  122. package/dist/assets/{is-path-prefix-equal-DMaJOeQN.js → is-path-prefix-equal-C8x0wuLM.js} +1 -1
  123. package/dist/assets/{isEqual-BQFT4gzY.js → isEqual-Bj8gRbdE.js} +1 -1
  124. package/dist/assets/{item-C7ih-Gxw.js → item-C2-H33Xq.js} +10 -10
  125. package/dist/assets/ja-CcDxF9sH.js +1 -0
  126. package/dist/assets/{javascript.es-BiK5ETle.js → javascript.es-Bt0QmNDU.js} +1 -1
  127. package/dist/assets/{jump-to-line.es-xLmM6XQj.js → jump-to-line.es-ByoMAIJw.js} +1 -1
  128. package/dist/assets/{jump.es-BK7Mo0mV.js → jump.es-CzKPCQ7C.js} +1 -1
  129. package/dist/assets/ko-Cru7cB1S.js +1 -0
  130. package/dist/assets/{line-DRJUtJJ7.js → line-CcgTKGkN.js} +4 -4
  131. package/dist/assets/{lint.es-CP-Ar6xo.js → lint.es-BcV0qHVh.js} +1 -1
  132. package/dist/assets/{lint.es2-WhVmGalN.js → lint.es2-B6j7CgmH.js} +1 -1
  133. package/dist/assets/{lint.es3-DAPaYml5.js → lint.es3-BI3Fnjz7.js} +1 -1
  134. package/dist/assets/{list-header-Dyo4DcEh.js → list-header-r2MrC8R7.js} +1 -1
  135. package/dist/assets/{log-Dg18Gkt2.js → log-B2SpWU1b.js} +1 -1
  136. package/dist/assets/{lottie-Bqw4aFON.js → lottie-DRE-Y506.js} +1 -1
  137. package/dist/assets/{matchbrackets.es-DVUMeePc.js → matchbrackets.es-CZaojsDe.js} +1 -1
  138. package/dist/assets/{memory-BLxwSKAa.js → memory-CLeQ9wj3.js} +1 -1
  139. package/dist/assets/{mode.es-DvtWXSbp.js → mode.es-BKxduziR.js} +1 -1
  140. package/dist/assets/{mode.es2-yGA392Ce.js → mode.es2-oYgJRmpO.js} +1 -1
  141. package/dist/assets/{mode.es3-bF1o4S_X.js → mode.es3-C6VF1A5H.js} +1 -1
  142. package/dist/assets/{onlineParser.es-D8oRG-7l.js → onlineParser.es-DjQRxwyL.js} +1 -1
  143. package/dist/assets/{overview-e30PAYmB.js → overview-RIv7gMxd.js} +2 -2
  144. package/dist/assets/pt-VKJn0kQ2.js +1 -0
  145. package/dist/assets/{react-Dixc1jm3.js → react-CtfovMFE.js} +3 -3
  146. package/dist/assets/{redux-Cw-bFLc5.js → redux-n2Ud4s7O.js} +1 -1
  147. package/dist/assets/{resource-dialog-C522yqNu.js → resource-dialog-CCYYxNig.js} +2 -2
  148. package/dist/assets/ru-D9UjS3E5.js +1 -0
  149. package/dist/assets/{runtime-D6nwOziK.js → runtime-DMZBU3fd.js} +1 -1
  150. package/dist/assets/{search.es-Cd0QD07l.js → search.es-ktV_4nJp.js} +1 -1
  151. package/dist/assets/{searchcursor.es-Bfc4-LPG.js → searchcursor.es-DsxyEmEP.js} +1 -1
  152. package/dist/assets/service-Q8384W7b.js +1 -0
  153. package/dist/assets/{shorten-label-DlpxUgCq.js → shorten-label-CrSVX0AE.js} +1 -1
  154. package/dist/assets/{show-hint.es-CN7yg_JP.js → show-hint.es-Br8tdMLx.js} +1 -1
  155. package/dist/assets/{slicedToArray-CiZnKyCy.js → slicedToArray-D1x3Qiie.js} +1 -1
  156. package/dist/assets/{spaces-Ca83-jCl.js → spaces-BE4uA08l.js} +1 -1
  157. package/dist/assets/{sublime.es-DgFQ3pas.js → sublime.es-CRbP9ior.js} +1 -1
  158. package/dist/assets/{switch-control-67XrThc4.js → switch-control-CtSMa6CL.js} +1 -1
  159. package/dist/assets/{table-icons-CRJe_3MP.js → table-icons-DmUMJib8.js} +2 -2
  160. package/dist/assets/{tag-DAjEEpCa.js → tag-Ch_ov9cM.js} +1 -1
  161. package/dist/assets/{team-CyhoyJ9a.js → team-Dg-GIRHy.js} +1 -1
  162. package/dist/assets/th-Bdgg14ky.js +1 -0
  163. package/dist/assets/toUpper-BB8gVufE.js +1 -0
  164. package/dist/assets/{traffic-DeHbNL-I.js → traffic-gisgr_Kk.js} +5 -5
  165. package/dist/assets/{url-evaluation-CbzEvBzd.js → url-evaluation-DS-mv3rc.js} +4 -4
  166. package/dist/assets/{url-join-DIhz1PVb.js → url-join-CRuOScTr.js} +1 -1
  167. package/dist/assets/{use-blocklet-info-for-connect-did-spaces-DuQNnaZW.js → use-blocklet-info-for-connect-did-spaces-BbKNcBiN.js} +1 -1
  168. package/dist/assets/useLocalStorage-D6Mk1Qod.js +1 -0
  169. package/dist/assets/{util-9vU2zZs2.js → util-Chab15Qm.js} +1 -1
  170. package/dist/assets/vi-CluOygTN.js +1 -0
  171. package/dist/assets/{wait-container-oqsX_-iJ.js → wait-container-BPRlQTFB.js} +3 -3
  172. package/dist/assets/withStyles-D96lNAEp.js +1 -0
  173. package/dist/assets/wrap-locale-4RphGrjp.js +1 -0
  174. package/dist/assets/zh-D5LYaM2r.js +2 -0
  175. package/dist/assets/zh-tw-DWxvyN7A.js +1 -0
  176. package/dist/index.html +1 -1
  177. package/dist/service-worker.js +1 -1
  178. package/package.json +1 -1
  179. package/dist/assets/Delete-BqtdSlNQ.js +0 -1
  180. package/dist/assets/DeleteOutline-DWh2h-xw.js +0 -1
  181. package/dist/assets/actions-Axwta7IP.js +0 -11
  182. package/dist/assets/api-DgUgGcaK.js +0 -1
  183. package/dist/assets/app-avatar-DSkk2bqr.js +0 -1
  184. package/dist/assets/ar-XdwzyXYH.js +0 -1
  185. package/dist/assets/blocklet-CbzARbti.js +0 -1
  186. package/dist/assets/de-BhcSSVI_.js +0 -1
  187. package/dist/assets/es-CE8qLgeN.js +0 -1
  188. package/dist/assets/fr-IbaIGGgw.js +0 -1
  189. package/dist/assets/getValidReactChildren-CqAGVe_y.js +0 -1
  190. package/dist/assets/hi-LDjl5wGc.js +0 -1
  191. package/dist/assets/id-DduzF3jK.js +0 -1
  192. package/dist/assets/index-C6YaOYlB.js +0 -11
  193. package/dist/assets/index-CSEZ2el2.js +0 -231
  194. package/dist/assets/index-CSOdd_os.js +0 -1
  195. package/dist/assets/index-Csvz8Imb.js +0 -9
  196. package/dist/assets/index-DkP2dxtw.js +0 -302
  197. package/dist/assets/index-DyoBof3A.js +0 -58
  198. package/dist/assets/index-WbmzOgUa.js +0 -21
  199. package/dist/assets/index-_bmSdh1U.js +0 -911
  200. package/dist/assets/ja-CQab-CnH.js +0 -1
  201. package/dist/assets/ko-BwMl9-je.js +0 -1
  202. package/dist/assets/pt-CKVSjj07.js +0 -1
  203. package/dist/assets/ru-BYWTtj7Q.js +0 -1
  204. package/dist/assets/service-DgYqociD.js +0 -1
  205. package/dist/assets/th-TJjvBNbR.js +0 -1
  206. package/dist/assets/toUpper-CYBV7cHO.js +0 -1
  207. package/dist/assets/useLocalStorage-BRZrZD2R.js +0 -1
  208. package/dist/assets/vi-DGeyTUFq.js +0 -1
  209. package/dist/assets/withStyles-CBM6laCD.js +0 -1
  210. package/dist/assets/wrap-locale-BFSbv413.js +0 -1
  211. package/dist/assets/zh-CPeMUIOU.js +0 -2
  212. package/dist/assets/zh-tw-C76dFi4k.js +0 -1
@@ -1,4 +1,4 @@
1
- import{bK as zo,j as e,aK as qt,aL as _t,q as z,O as y,ax as ve,P as r,A,bk as J,r as f,f as Ce,bo as Je,b as X,M as O,J as dt,U as Mt,cc as Oe,n as F,K as Z,gJ as Vo,bG as Me,aV as ue,aU as gt,aC as Ft,a2 as $,D as xt,F as D,bm as qo,Y as Ke,$ as Wn,a_ as _o,fF as Wo,fG as Ho,C as re,fa as Yo,y as po,av as pt,a1 as we,x as Gt,hx as Jo,hy as Ko,B as ne,ba as uo,H as Wt,hz as Qo,m as ee,a3 as Zo,eB as Xo,W as mo,Z as fo,ak as $o,w as es,Q as He,V as ts,hA as ho,S as ge,az as ns,aA as os,aB as ss,i as yt,hB as rs,cF as is,bf as as,h8 as ls,hC as cs,ay as Hn,cD as ds,ad as Fe,aJ as go,bI as Ht,ce as ps,hD as us,b5 as ms,z as fs,aW as zt,T as hs,aN as Ye,at as Nt,dG as gs,bp as xo,aF as xs,fR as Pe,dO as ys,hE as Cs,gi as Yn,hF as Jn,gk as Kn,aX as js,G as at,gm as vs,bH as Ss}from"./index-Ddq4jr_U.js";import{d as Rs}from"./Add-C0jlH_zP.js";import{a as bs,R as ct,F as Es,L as Ts,d as Yt,b as Jt}from"./line-DRJUtJJ7.js";import{C as ws,A as Ps,d as Is}from"./agreement-CiDOtCXU.js";import{E as ks}from"./index-n9PgzTmH.js";import{b as Us,a as Ds,c as Bs,u as Kt,R as Ns}from"./actions-Axwta7IP.js";import{S as As}from"./switch-control-67XrThc4.js";import{u as Ls}from"./detail-BTV64Agz.js";import{d as yo}from"./Edit-Cn_G48ZU.js";import{T as Os}from"./index-C_LsHXyQ.js";import{T as Ms,M as Fs,t as Gs}from"./table-icons-CRJe_3MP.js";import{C as Qn}from"./click-to-copy-Pr-Zbrif.js";import{T as K}from"./TextField-WEzwgjP0.js";import{d as Qt}from"./Link-B8edwUNQ.js";import{c as zs,C as Vs,a as qs,b as _s,D as Ws,A as Hs,B as Ys,d as Js,S as Ks}from"./item-C7ih-Gxw.js";import{u as Qs,a as Zs,P as Co,L as Zn,A as Xs,S as $s}from"./index-BeATEtzy.js";import{u as jo,t as er}from"./toUpper-CYBV7cHO.js";import{u as ie}from"./blocklet-CbzARbti.js";import{c as tr,d as nr,a as or,e as sr,f as rr,g as Xn,h as ir,i as $n}from"./spaces-Ca83-jCl.js";import{d as ar}from"./EditIcon-B1ovGBjD.js";import{d as lr}from"./Done-MfHSISFV.js";import{C as cr}from"./Google-DQdWmIOC.js";import{I as dr,B as pr}from"./install-from-url-D0Mot9As.js";import{a as eo}from"./api-DgUgGcaK.js";import{v as vo,a as ut}from"./util-9vU2zZs2.js";import{P as ur,u as mr}from"./use-blocklet-info-for-connect-did-spaces-DuQNnaZW.js";import{D as fr}from"./DeleteOutline-DWh2h-xw.js";import{S as to}from"./index-BJgIXaX1.js";import{d as hr}from"./ArrowDropDown-DrehtX2f.js";import{_ as gr}from"./useLocalStorage-BRZrZD2R.js";import{d as xr}from"./LockIcon-Bs5dBhg9.js";import{d as Ct}from"./Delete-BqtdSlNQ.js";import{d as So}from"./Launch-BRBdnw92.js";import{C as yr}from"./delete-confirm-C2q7Vvj-.js";import{W as Qe}from"./tag-DAjEEpCa.js";import{d as Cr}from"./is-path-prefix-equal-DMaJOeQN.js";import{R as jr,b as no,B as Ro}from"./url-evaluation-CbzEvBzd.js";import{B as vr}from"./bundle-avatar-BRoQ90__.js";import{A as bo}from"./actions-BbcoFZjT.js";import{I as At}from"./index-HfmVdk5l.js";import{a as Sr}from"./index-CSOdd_os.js";import{u as Rr}from"./team-CyhoyJ9a.js";import"./ButtonGroup-NvrTYf1s.js";import"./getValidReactChildren-CqAGVe_y.js";import"./index-Bd27-rFC.js";import"./index-P3idGO87.js";import"./url-join-DIhz1PVb.js";import"./MoreVert-0x6ZKOOm.js";import"./app-avatar-DSkk2bqr.js";import"./Breadcrumbs-Oi4z-7JU.js";import"./FilterList-DiA-6Il8.js";import"./Select-CjUz8jvK.js";import"./InputLabel-Xa0HFZxn.js";import"./LastPage-BtCi2wuv.js";import"./slicedToArray-CiZnKyCy.js";import"./Search-DwG5nouB.js";import"./ChevronLeft-C-HoTf-Q.js";import"./ChevronRight-c5xZzIfK.js";import"./DeleteOutline-DuzabIUt.js";import"./redux-Cw-bFLc5.js";import"./Skeleton-CDB0GyGY.js";import"./InputAdornment-CDb1Pg-S.js";import"./memoize-one.esm-BdPwpGay.js";import"./index-Csvz8Imb.js";import"./preact.module-B1z5cdvs.js";import"./Close-C5A1sroQ.js";import"./lottie-Bqw4aFON.js";import"./Stepper-antHQYRF.js";import"./index-3GrPYR-0.js";import"./shorten-label-DlpxUgCq.js";const br=zo(e.jsx("path",{d:"M14.17 5 19 9.83V19H5V5zm0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V9.83c0-.53-.21-1.04-.59-1.41l-4.83-4.83c-.37-.38-.88-.59-1.41-.59M7 15h10v2H7zm0-4h10v2H7zm0-4h7v2H7z"}),"TextSnippetOutlined");var Zt={},Er=_t;Object.defineProperty(Zt,"__esModule",{value:!0});var Eo=Zt.default=void 0,Tr=Er(qt()),wr=e;Eo=Zt.default=(0,Tr.default)((0,wr.jsx)("path",{d:"M21 10.12h-6.78l2.74-2.82c-2.73-2.7-7.15-2.8-9.88-.1-2.73 2.71-2.73 7.08 0 9.79s7.15 2.71 9.88 0C18.32 15.65 19 14.08 19 12.1h2c0 1.98-.88 4.55-2.64 6.29-3.51 3.48-9.21 3.48-12.72 0-3.5-3.47-3.53-9.11-.02-12.58s9.14-3.47 12.65 0L21 3zM12.5 8v4.25l3.5 2.08-.72 1.21L11 13V8z"}),"Update");function Xt({children:t,...o}){const{t:s}=z(),{updateAutoCheckUpdate:a,autoCheckUpdate:n}=Ls(),i=async()=>{try{const l=!(n!=null&&n.enabled);await a({enabled:l}),A.success(s(l?"storage.spaces.autoCheckUpdate.enabled":"storage.spaces.autoCheckUpdate.disabled"))}catch(l){A.error(l.message)}},m=!!(n!=null&&n.enabled);return e.jsxs(y,{display:"flex",flexDirection:"row",alignItems:"center",children:[t,e.jsx(ve,{title:s("storage.spaces.autoCheckUpdate.title"),arrow:!0,placement:"right",children:e.jsx("div",{children:e.jsx(As,{checked:m,onChange:i,name:"enableWelcomePage",style:{...o.style,zoom:.8}})})})]})}Xt.propTypes={children:r.any};Xt.defaultProps={children:null};const Pr=(t,o)=>{let{description:s}=t;return(Object.values(X.CHAIN_PROP_MAP).includes(t.key)||O.isEnvShareable(t))&&(s?s=`${s} (${o("blocklet.config.sharedToAllComponents")})`:s=o("blocklet.config.sharedToAllComponents")),s&&e.jsx("div",{style:{marginLeft:12},children:s})},Lt=(t,o,s=[])=>!(s!=null&&s.length)&&!t.custom&&!["CHAIN_ID","CHAIN_HOST"].includes(t.key)&&!o.meta.environments.find(a=>a.name===t.key)&&o.children.every(a=>!a.meta.environments.find(n=>n.name===t.key))?!0:t.custom;function mt({blocklet:t,ancestors:o}){const s=J(),{inService:a}=s,{t:n}=f.useContext(Ce),i=[...o.map(c=>c.meta.did),t.meta.did],m=()=>A.success(n("blocklet.config.changedTip")),l=c=>Lt(c,t,o);if(Je(t.status)||t.status==="unknown"&&Je(t.status))return null;const u=async c=>{if(!c.key.trim()||!c.value.trim()){A.error(n("blocklet.config.environment.keyValueRequired"));return}if(c.key.startsWith("BLOCKLET_")||c.key.startsWith("COMPONENT_")){A.error(n("blocklet.config.environment.invalidKey"));return}c.custom=!0;try{const v=await s.api.configBlocklet({input:{did:i,configs:[c]}});m(v.blocklet)}catch(v){A.error(Z(v))}},h=async(c,v)=>{if(c.required&&(!c.key.trim()||!c.value.trim())){A.error(n("blocklet.config.environment.keyValueRequired"));return}if(c.key.startsWith("BLOCKLET_")&&!X.BLOCKLET_CONFIGURABLE_KEY[c.key]){A.error(n("blocklet.config.environment.invalidKey"));return}if(c.key===X.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_CLUSTER_SIZE){const T=Vo(c);if(T){A.error(T);return}}const j=[{...c,value:c.secure&&c.value==="__encrypted__"?"":c.value}];if(c.key!==v.key){if(!Lt(c,t,o)){A.error("Only key of custom env can be changed");return}j.push({key:v.key,custom:!0})}try{const T=await s.api.configBlocklet({input:{did:i,configs:j}});m(T.blocklet)}catch(T){A.error(Z(T))}},g=async c=>{if(c.required){A.error(n("blocklet.config.environment.deleteForbidden"));return}if(!Lt(c,t,o)){A.error("Only key of custom env can be changed");return}try{const v=await s.api.configBlocklet({input:{did:i,configs:[{key:c.key,custom:!0}]}});m(v.blocklet)}catch(v){A.error(Z(v))}},p=(t.configs||[]).filter(c=>!X.BLOCKLET_CONFIGURABLE_KEY[c.key]),S=O.getSharedConfigObj(o[0],t),d=O.getComponentMissingConfigs(t,o[0]),R=p.map(c=>({...c,value:Object.values(X.CHAIN_PROP_MAP).includes(c.key)&&Object.keys(S).includes(c.key)?S[c.key]:S[c.key]||c.value})),C=R.some(c=>c.key&&c.key.startsWith("BWA_")),x={onRowAdd:u,onRowUpdate:h,onRowDelete:g,isDeletable:l},b=()=>[{title:n("common.key"),field:"key",initialEditValue:"Key",width:"30%",render:c=>e.jsx(Qn,{value:c.value,style:{color:c.required&&!c.value?"#ff4436":"#222222",fontWeight:c.required?"bold":"normal"},children:c.key}),editComponent:c=>{const{value:v,rowData:j,onChange:T}=c;return e.jsx(oo,{children:e.jsx(K,{fullWidth:!0,size:"small",disabled:l(j)===!1,value:v,onChange:I=>T(I.target.value),variant:"outlined",label:"Key",placeholder:n("blocklet.config.environment.key"),margin:"dense",autoFocus:!0})})}},{title:n("common.value"),field:"value",initialEditValue:"Value",width:"calc((100% - (96px + 30%)) / 1)",render:c=>c.value?c.secure?"******":e.jsx(Qn,{unstyled:!0,value:c.value,style:{wordBreak:"break-all"},children:c.value}):null,editComponent:c=>{const{value:v,rowData:j,onChange:T}=c;return e.jsxs(oo,{children:[e.jsx(K,{fullWidth:!0,size:"small",value:v==="__encrypted__"?"":v,onChange:I=>T(I.target.value),variant:"outlined",label:n("common.value"),placeholder:n("blocklet.config.environment.value"),margin:"dense",autoFocus:!0}),Pr(j,n)]})}}];return e.jsxs(Ir,{children:[!!d.length&&e.jsx(dt,{severity:"error",style:{marginTop:24},children:n("blocklet.config.missingRequired")}),C&&e.jsx(dt,{severity:"info",children:n("blocklet.config.environment.tip")}),e.jsx(Mt,{permission:a?"":"mutate_blocklets",role:a?Oe:[],children:c=>e.jsx(Ms,{className:"config-table",children:e.jsx(Fs,{title:e.jsx("h4",{children:n("common.environment")}),columns:b(),icons:{...Us,...Gs},options:{emptyRowsWhenPaging:!1,actionsColumnIndex:-1,tableLayout:"auto",maxBodyHeight:"100%",paging:!1,search:!1},localization:{header:{actions:n("common.actions")},body:{emptyDataSourceMessage:n("common.noData")}},data:R,editable:c?x:{}})})})]})}mt.propTypes={blocklet:r.object.isRequired,ancestors:r.array};mt.defaultProps={ancestors:[]};const Ir=F.div`
1
+ import{bM as zo,j as e,aK as Vt,aL as _t,q as z,O as y,ax as ve,P as r,A,bn as J,r as f,f as Ce,bq as Je,b as X,M as O,J as dt,U as Mt,ce as Oe,n as F,K as Z,gS as qo,bI as Me,aY as ue,aX as gt,aC as Ft,a2 as $,D as xt,F as D,aP as Vo,Y as Ke,$ as Wn,b1 as _o,fP as Wo,fQ as Ho,C as re,fb as Yo,y as po,av as pt,a1 as we,x as Gt,hG as Jo,hH as Ko,B as ne,bd as uo,H as Wt,hI as Qo,m as ee,a3 as Zo,eC as Xo,W as mo,Z as fo,ak as $o,w as es,Q as He,V as ts,hJ as ho,S as ge,az as ns,aA as os,aB as ss,i as yt,aN as rs,cG as is,bi as as,hh as ls,hK as cs,ay as Hn,cE as ds,ad as Fe,aJ as go,bK as Ht,cg as ps,hL as us,b8 as ms,z as fs,aZ as zt,T as hs,aQ as Ye,at as Nt,dH as gs,br as xo,aF as xs,f_ as Pe,dP as ys,hM as Cs,gr as Yn,hN as Jn,gt as Kn,a_ as js,G as at,gv as vs,bJ as Ss}from"./index-CXlxAjbt.js";import{d as bs}from"./Add-CtWL6e1q.js";import{a as Rs,R as ct,F as Es,L as Ts,d as Yt,b as Jt}from"./line-CcgTKGkN.js";import{C as ws,A as Ps,d as Is}from"./agreement-B52xwcRE.js";import{E as ks}from"./index-BijlUenA.js";import{b as Us,a as Ds,c as Bs,u as Kt,e as Ns}from"./actions-D4SIeJQs.js";import{S as As}from"./switch-control-CtSMa6CL.js";import{u as Ls}from"./detail-ADHPCJ2i.js";import{d as yo}from"./Edit-CARh1zds.js";import{T as Os}from"./index-6AreGVDd.js";import{T as Ms,M as Fs,t as Gs}from"./table-icons-DmUMJib8.js";import{C as Qn}from"./click-to-copy-DKenG9LX.js";import{T as K}from"./TextField-Cb0I13kb.js";import{d as Qt}from"./Link-DPfyUdIn.js";import{c as zs,C as qs,a as Vs,b as _s,D as Ws,A as Hs,B as Ys,d as Js,S as Ks}from"./item-C2-H33Xq.js";import{u as Qs,a as Zs,P as Co,L as Zn,A as Xs,S as $s}from"./index-Cb6algTF.js";import{u as jo,t as er}from"./toUpper-BB8gVufE.js";import{u as ie}from"./blocklet-DbOAUQG9.js";import{c as tr,d as nr,a as or,e as sr,f as rr,g as Xn,h as ir,i as $n}from"./spaces-BE4uA08l.js";import{d as ar}from"./EditIcon-C_npOrmv.js";import{d as lr}from"./Done-BQwAUEUo.js";import{C as cr}from"./Google-ZjI0DrLI.js";import{I as dr,B as pr}from"./install-from-url-D85z_2dU.js";import{a as eo}from"./api-BkA5hx89.js";import{v as vo,a as ut}from"./util-Chab15Qm.js";import{P as ur,u as mr}from"./use-blocklet-info-for-connect-did-spaces-BbKNcBiN.js";import{D as fr}from"./DeleteOutline-DZhkyDfV.js";import{S as to}from"./index-g_cLscfb.js";import{d as hr}from"./ArrowDropDown-DV5W7OwL.js";import{_ as gr}from"./useLocalStorage-D6Mk1Qod.js";import{d as xr}from"./LockIcon-DsRpj_gz.js";import{d as Ct}from"./Delete-DvKqIX20.js";import{d as So}from"./Launch-BNP89Oc8.js";import{C as yr}from"./delete-confirm-DX-XHcl9.js";import{W as Qe}from"./tag-Ch_ov9cM.js";import{d as Cr}from"./is-path-prefix-equal-C8x0wuLM.js";import{R as jr,b as no,B as bo}from"./url-evaluation-DS-mv3rc.js";import{B as vr}from"./bundle-avatar-CGsU-HbI.js";import{A as Ro}from"./actions-D2Nr19i-.js";import{I as At}from"./index-vr3RQzyc.js";import{a as Sr}from"./index-CYxeq-8x.js";import{u as br}from"./team-Dg-GIRHy.js";import"./ButtonGroup-CkKt07uc.js";import"./getValidReactChildren-ClGStIXY.js";import"./index-DUQBU3A3.js";import"./index-BC3241Rp.js";import"./url-join-CRuOScTr.js";import"./MoreVert-dIXJT0E2.js";import"./app-avatar-ClIQjaP-.js";import"./Breadcrumbs-BMUTpqOP.js";import"./FilterList-BvE0UAo0.js";import"./Select-Ck-rwnxI.js";import"./InputLabel-BTEO1M40.js";import"./LastPage-GiOUS0-i.js";import"./slicedToArray-D1x3Qiie.js";import"./Search-CXF_z21D.js";import"./ChevronLeft-ChWv_0Iv.js";import"./ChevronRight-B2EtVjwt.js";import"./DeleteOutline-CddvKtlT.js";import"./redux-n2Ud4s7O.js";import"./Skeleton-bh5z66KF.js";import"./InputAdornment-7qAmlR7q.js";import"./memoize-one.esm-BdPwpGay.js";import"./index-D2iFVes6.js";import"./index-ZG7jWpak.js";import"./preact.module-B1z5cdvs.js";import"./Close-CyRwkk-q.js";import"./lottie-DRE-Y506.js";import"./Stepper-3wmaNEG9.js";import"./index-B1TlfhV-.js";import"./shorten-label-CrSVX0AE.js";const Rr=zo(e.jsx("path",{d:"M14.17 5 19 9.83V19H5V5zm0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V9.83c0-.53-.21-1.04-.59-1.41l-4.83-4.83c-.37-.38-.88-.59-1.41-.59M7 15h10v2H7zm0-4h10v2H7zm0-4h7v2H7z"}),"TextSnippetOutlined");var Zt={},Er=_t;Object.defineProperty(Zt,"__esModule",{value:!0});var Eo=Zt.default=void 0,Tr=Er(Vt()),wr=e;Eo=Zt.default=(0,Tr.default)((0,wr.jsx)("path",{d:"M21 10.12h-6.78l2.74-2.82c-2.73-2.7-7.15-2.8-9.88-.1-2.73 2.71-2.73 7.08 0 9.79s7.15 2.71 9.88 0C18.32 15.65 19 14.08 19 12.1h2c0 1.98-.88 4.55-2.64 6.29-3.51 3.48-9.21 3.48-12.72 0-3.5-3.47-3.53-9.11-.02-12.58s9.14-3.47 12.65 0L21 3zM12.5 8v4.25l3.5 2.08-.72 1.21L11 13V8z"}),"Update");function Xt({children:t,...o}){const{t:s}=z(),{updateAutoCheckUpdate:a,autoCheckUpdate:n}=Ls(),i=async()=>{try{const l=!(n!=null&&n.enabled);await a({enabled:l}),A.success(s(l?"storage.spaces.autoCheckUpdate.enabled":"storage.spaces.autoCheckUpdate.disabled"))}catch(l){A.error(l.message)}},m=!!(n!=null&&n.enabled);return e.jsxs(y,{display:"flex",flexDirection:"row",alignItems:"center",children:[t,e.jsx(ve,{title:s("storage.spaces.autoCheckUpdate.title"),arrow:!0,placement:"right",children:e.jsx("div",{children:e.jsx(As,{checked:m,onChange:i,name:"enableWelcomePage",style:{...o.style,zoom:.8}})})})]})}Xt.propTypes={children:r.any};Xt.defaultProps={children:null};const Pr=(t,o)=>{let{description:s}=t;return(Object.values(X.CHAIN_PROP_MAP).includes(t.key)||O.isEnvShareable(t))&&(s?s=`${s} (${o("blocklet.config.sharedToAllComponents")})`:s=o("blocklet.config.sharedToAllComponents")),s&&e.jsx("div",{style:{marginLeft:12},children:s})},Lt=(t,o,s=[])=>!(s!=null&&s.length)&&!t.custom&&!["CHAIN_ID","CHAIN_HOST"].includes(t.key)&&!o.meta.environments.find(a=>a.name===t.key)&&o.children.every(a=>!a.meta.environments.find(n=>n.name===t.key))?!0:t.custom;function mt({blocklet:t,ancestors:o}){const s=J(),{inService:a}=s,{t:n}=f.useContext(Ce),i=[...o.map(c=>c.meta.did),t.meta.did],m=()=>A.success(n("blocklet.config.changedTip")),l=c=>Lt(c,t,o);if(Je(t.status)||t.status==="unknown"&&Je(t.status))return null;const u=async c=>{if(!c.key.trim()||!c.value.trim()){A.error(n("blocklet.config.environment.keyValueRequired"));return}if(c.key.startsWith("BLOCKLET_")||c.key.startsWith("COMPONENT_")){A.error(n("blocklet.config.environment.invalidKey"));return}c.custom=!0;try{const v=await s.api.configBlocklet({input:{did:i,configs:[c]}});m(v.blocklet)}catch(v){A.error(Z(v))}},h=async(c,v)=>{if(c.required&&(!c.key.trim()||!c.value.trim())){A.error(n("blocklet.config.environment.keyValueRequired"));return}if(c.key.startsWith("BLOCKLET_")&&!X.BLOCKLET_CONFIGURABLE_KEY[c.key]){A.error(n("blocklet.config.environment.invalidKey"));return}if(c.key===X.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_CLUSTER_SIZE){const T=qo(c);if(T){A.error(T);return}}const j=[{...c,value:c.secure&&c.value==="__encrypted__"?"":c.value}];if(c.key!==v.key){if(!Lt(c,t,o)){A.error("Only key of custom env can be changed");return}j.push({key:v.key,custom:!0})}try{const T=await s.api.configBlocklet({input:{did:i,configs:j}});m(T.blocklet)}catch(T){A.error(Z(T))}},g=async c=>{if(c.required){A.error(n("blocklet.config.environment.deleteForbidden"));return}if(!Lt(c,t,o)){A.error("Only key of custom env can be changed");return}try{const v=await s.api.configBlocklet({input:{did:i,configs:[{key:c.key,custom:!0}]}});m(v.blocklet)}catch(v){A.error(Z(v))}},p=(t.configs||[]).filter(c=>!X.BLOCKLET_CONFIGURABLE_KEY[c.key]),S=O.getSharedConfigObj(o[0],t),d=O.getComponentMissingConfigs(t,o[0]),b=p.map(c=>({...c,value:Object.values(X.CHAIN_PROP_MAP).includes(c.key)&&Object.keys(S).includes(c.key)?S[c.key]:S[c.key]||c.value})),C=b.some(c=>c.key&&c.key.startsWith("BWA_")),x={onRowAdd:u,onRowUpdate:h,onRowDelete:g,isDeletable:l},R=()=>[{title:n("common.key"),field:"key",initialEditValue:"Key",width:"30%",render:c=>e.jsx(Qn,{value:c.value,style:{color:c.required&&!c.value?"#ff4436":"#222222",fontWeight:c.required?"bold":"normal"},children:c.key}),editComponent:c=>{const{value:v,rowData:j,onChange:T}=c;return e.jsx(oo,{children:e.jsx(K,{fullWidth:!0,size:"small",disabled:l(j)===!1,value:v,onChange:I=>T(I.target.value),variant:"outlined",label:"Key",placeholder:n("blocklet.config.environment.key"),margin:"dense",autoFocus:!0})})}},{title:n("common.value"),field:"value",initialEditValue:"Value",width:"calc((100% - (96px + 30%)) / 1)",render:c=>c.value?c.secure?"******":e.jsx(Qn,{unstyled:!0,value:c.value,style:{wordBreak:"break-all"},children:c.value}):null,editComponent:c=>{const{value:v,rowData:j,onChange:T}=c;return e.jsxs(oo,{children:[e.jsx(K,{fullWidth:!0,size:"small",value:v==="__encrypted__"?"":v,onChange:I=>T(I.target.value),variant:"outlined",label:n("common.value"),placeholder:n("blocklet.config.environment.value"),margin:"dense",autoFocus:!0}),Pr(j,n)]})}}];return e.jsxs(Ir,{children:[!!d.length&&e.jsx(dt,{severity:"error",style:{marginTop:24},children:n("blocklet.config.missingRequired")}),C&&e.jsx(dt,{severity:"info",children:n("blocklet.config.environment.tip")}),e.jsx(Mt,{permission:a?"":"mutate_blocklets",role:a?Oe:[],children:c=>e.jsx(Ms,{className:"config-table",children:e.jsx(Fs,{title:e.jsx("h4",{children:n("common.environment")}),columns:R(),icons:{...Us,...Gs},options:{emptyRowsWhenPaging:!1,actionsColumnIndex:-1,tableLayout:"auto",maxBodyHeight:"100%",paging:!1,search:!1},localization:{header:{actions:n("common.actions")},body:{emptyDataSourceMessage:n("common.noData")}},data:b,editable:c?x:{}})})})]})}mt.propTypes={blocklet:r.object.isRequired,ancestors:r.array};mt.defaultProps={ancestors:[]};const Ir=F.div`
2
2
  .config-table {
3
3
  margin-bottom: 24px;
4
4
  position: relative;
@@ -52,7 +52,7 @@ import{bK as zo,j as e,aK as qt,aL as _t,q as z,O as y,ax as ve,P as r,A,bk as J
52
52
  }
53
53
  `,oo=F.div`
54
54
  height: 60px;
55
- `;function jt({blocklet:t,ancestors:o,hasPermission:s,...a}){const{t:n}=z(),{api:i}=J(),m=!o.length,l=m?t.meta.did:o.map(C=>C.meta.did)[0],[u,h]=f.useState(""),[g,p]=f.useState(""),S=u||!s;if(!l||t.status==="unknown"&&Je(t.status))return null;const d=async C=>{h(!0);try{const x={rootDid:l,mountPoint:ue(C)};return m||(x.did=t.meta.did),await i.updateComponentMountPoint({input:x}),h(!1),!0}catch(x){throw h(!1),x.message=Z(x),A.error(x.message),x}},R=C=>{p(n("common.slugifyHint",{value:gt(C)}))};return e.jsx(Br,{component:"div",...a,children:e.jsx(y,{mt:3,children:e.jsx(bs,{label:n("blocklet.component.mountPoint"),style:{marginTop:-24},disabled:u||S,loading:u,required:!0,initialValue:t.mountPoint,onSubmit:d,onChange:R,helperText:g,formatterBeforeSubmit:C=>ue(C)})})})}const kr=Me(jt,"mutate_blocklets"),Ur=Me(jt,"",Oe);function Dr(t){const{inService:o}=J();return o?e.jsx(Ur,{...t}):e.jsx(kr,{...t})}jt.propTypes={blocklet:r.object.isRequired,ancestors:r.array,hasPermission:r.bool};jt.defaultProps={ancestors:[],hasPermission:!1};const Br=F.div``;function vt({open:t,onClose:o,hiddenChildren:s,blocklet:a,ancestors:n,children:i}){const[m,l]=f.useState(!1),{t:u}=z(),h=!!n.length,[g,p]=f.useState(Ft.hasMountPoint(a==null?void 0:a.meta)?"settings":"environments"),S=h?O.getDisplayName(a,!0):u("blocklet.component.container");if(Je(a.status)||a.status==="unknown"&&Je(a.status))return null;const d=()=>{o==null||o(),l(!1)},R=T=>{T.stopPropagation(),l(!0)},C={settings:Ft.hasMountPoint(a.meta)&&{label:u("blocklet.component.setting"),value:"settings",component:e.jsx(Dr,{blocklet:a,ancestors:n})},environments:{label:u("common.environment"),value:"environments",component:e.jsx(mt,{blocklet:a,ancestors:n})}},x=Object.values(C).filter(Boolean),b=x.map(({label:T,value:I})=>({label:T,value:I})),c=T=>{p(T)},v=C[g]||x[0];let j=null;return s||(j=typeof i=="function"?i({open:R}):e.jsx($,{onClick:R,"data-cy":"action-config-component",children:e.jsx(yo,{})})),e.jsxs(e.Fragment,{children:[j,(t||m)&&e.jsx(Nr,{open:!0,fullWidth:!0,maxWidth:"md",title:S,onClose:d,PaperProps:{style:{minHeight:"auto"}},children:h?e.jsxs(y,{mt:1,children:[e.jsx(Os,{tabs:b,current:g,onChange:c,scrollButtons:"auto"}),v.component]}):e.jsx(mt,{blocklet:a,ancestors:n})})]})}vt.propTypes={blocklet:r.object.isRequired,ancestors:r.array,children:r.any,open:r.bool,onClose:r.func,hiddenChildren:r.bool};vt.defaultProps={ancestors:[],children:null,open:!1,onClose:null,hiddenChildren:!1};const Nr=F(xt)`
55
+ `;function jt({blocklet:t,ancestors:o,hasPermission:s,...a}){const{t:n}=z(),{api:i}=J(),m=!o.length,l=m?t.meta.did:o.map(C=>C.meta.did)[0],[u,h]=f.useState(""),[g,p]=f.useState(""),S=u||!s;if(!l||t.status==="unknown"&&Je(t.status))return null;const d=async C=>{h(!0);try{const x={rootDid:l,mountPoint:ue(C)};return m||(x.did=t.meta.did),await i.updateComponentMountPoint({input:x}),h(!1),!0}catch(x){throw h(!1),x.message=Z(x),A.error(x.message),x}},b=C=>{p(n("common.slugifyHint",{value:gt(C)}))};return e.jsx(Br,{component:"div",...a,children:e.jsx(y,{mt:3,children:e.jsx(Rs,{label:n("blocklet.component.mountPoint"),style:{marginTop:-24},disabled:u||S,loading:u,required:!0,initialValue:t.mountPoint,onSubmit:d,onChange:b,helperText:g,formatterBeforeSubmit:C=>ue(C)})})})}const kr=Me(jt,"mutate_blocklets"),Ur=Me(jt,"",Oe);function Dr(t){const{inService:o}=J();return o?e.jsx(Ur,{...t}):e.jsx(kr,{...t})}jt.propTypes={blocklet:r.object.isRequired,ancestors:r.array,hasPermission:r.bool};jt.defaultProps={ancestors:[],hasPermission:!1};const Br=F.div``;function vt({open:t,onClose:o,hiddenChildren:s,blocklet:a,ancestors:n,children:i}){const[m,l]=f.useState(!1),{t:u}=z(),h=!!n.length,[g,p]=f.useState(Ft.hasMountPoint(a==null?void 0:a.meta)?"settings":"environments"),S=h?O.getDisplayName(a,!0):u("blocklet.component.container");if(Je(a.status)||a.status==="unknown"&&Je(a.status))return null;const d=()=>{o==null||o(),l(!1)},b=T=>{T.stopPropagation(),l(!0)},C={settings:Ft.hasMountPoint(a.meta)&&{label:u("blocklet.component.setting"),value:"settings",component:e.jsx(Dr,{blocklet:a,ancestors:n})},environments:{label:u("common.environment"),value:"environments",component:e.jsx(mt,{blocklet:a,ancestors:n})}},x=Object.values(C).filter(Boolean),R=x.map(({label:T,value:I})=>({label:T,value:I})),c=T=>{p(T)},v=C[g]||x[0];let j=null;return s||(j=typeof i=="function"?i({open:b}):e.jsx($,{onClick:b,"data-cy":"action-config-component",children:e.jsx(yo,{})})),e.jsxs(e.Fragment,{children:[j,(t||m)&&e.jsx(Nr,{open:!0,fullWidth:!0,maxWidth:"md",title:S,onClose:d,PaperProps:{style:{minHeight:"auto"}},children:h?e.jsxs(y,{mt:1,children:[e.jsx(Os,{tabs:R,current:g,onChange:c,scrollButtons:"auto"}),v.component]}):e.jsx(mt,{blocklet:a,ancestors:n})})]})}vt.propTypes={blocklet:r.object.isRequired,ancestors:r.array,children:r.any,open:r.bool,onClose:r.func,hiddenChildren:r.bool};vt.defaultProps={ancestors:[],children:null,open:!1,onClose:null,hiddenChildren:!1};const Nr=F(xt)`
56
56
  .MuiDialogContent-root {
57
57
  padding-top: 0;
58
58
  margin-top: -32px;
@@ -63,7 +63,7 @@ import{bK as zo,j as e,aK as qt,aL as _t,q as z,O as y,ax as ve,P as r,A,bk as J
63
63
  .ux-dialog_right {
64
64
  padding-right: 20px;
65
65
  }
66
- `,{NODE_MODES:so}=D,Ar=({mode:t,previousMode:o}={})=>t===so.SERVERLESS||o===so.SERVERLESS;var To={isInServerlessMode:Ar};function Lr(){const[t,o]=f.useState(null),{blocklet:s}=ie();return f.useEffect(()=>{o(tr(s))},[s]),{storageEndpoint:t}}const wo=f.createContext({}),{Provider:Or,Consumer:Qa}=wo;function $t({children:t}){const[o,s]=f.useState(!1),[a,n]=f.useState(null),{blocklet:i,actions:{refreshBlocklet:m}}=ie(),{storageEndpoint:l}=Lr(),{api:u}=J();qo(async()=>{try{if(s(!0),Wn.isEmpty(l)){n(null);return}const d=await nr(l);n(d)}catch(d){console.error(d),A.error(d.message)}finally{s(!1)}},[l]);const h=()=>{n(null),m()},g=async d=>{n(d),await p(d.endpoint),m()},p=async d=>{await u.configBlocklet({input:{did:[i.meta.did],configs:[{key:X.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_SPACE_ENDPOINT,value:d}]}}),m()};f.useEffect(()=>{async function d(){if(!a)return;const R=await or(a.endpoint,a.name),C=Wn.merge(a,{name:R});n(C)}d()},[]);const S=!!(l&&a);return e.jsx(Or,{value:{loading:o,spaceGateway:a,deleteSpaceGateway:h,updateSpaceGateway:g,storageEndpoint:l,settingStorageEndpoint:p,hasStorageEndpoint:S},children:t})}$t.propTypes={children:Ke.node.isRequired};$t.defaultProps={};function en(){return f.useContext(wo)}const tn={description:r.string,editing:r.bool,onChange:r.func,required:r.bool,value:r.any,componentProps:r.object,render:r.func,renderFormItem:r.func};function nn({editing:t,value:o,onChange:s}){const[a,n]=f.useState(!1),i=f.useRef(),m=f.useRef(o);f.useEffect(()=>{let p=null;return t&&(p=setTimeout(()=>{n(!0)},50)),()=>{clearTimeout(p)}},[t]);const l=p=>{m.current=p,s(p)},u=()=>{n(!1),s(m.current)},h=e.jsx(y,{className:"form-item-input slot",px:1,children:e.jsxs(y,{display:"flex",alignItems:"center",children:[o,o!=="auto"&&e.jsx("div",{style:{marginLeft:4,backgroundColor:o,width:"1em",height:"1em",borderRadius:"0.2em"}})]})}),g=e.jsxs(y,{display:"flex",flexGrow:1,alignItems:"center",height:"40px",onKeyDown:u,children:[e.jsx(y,{display:"flex",alignItems:"center",onClick:()=>n(!0),children:e.jsx("div",{ref:i,style:{flexShrink:0,marginLeft:"8px",backgroundColor:o,width:"32px",height:"32px",boxSizing:"border-box",borderRadius:"8px",border:"1px solid #eee",cursor:o==="auto"?"default":"pointer"}})}),e.jsx(_o,{open:a,anchorEl:i.current,onClose:()=>n(!1),anchorOrigin:{vertical:"bottom",horizontal:"center"},transformOrigin:{vertical:"top",horizontal:"center"},children:e.jsx(cr,{color:o,onChange:p=>l(p.hex)})})]});return t?g:h}nn.propTypes=tn;function on({editing:t,description:o,value:s,onChange:a,componentProps:n,...i}){const{placeholder:m}=n,l=f.useRef(s),u=g=>{g.key==="Enter"&&a(l.current,"confirm")},h=g=>{l.current=g,a(g)};return t?e.jsx(K,{style:{flex:1},fullWidth:!0,value:s,onChange:g=>{g.persist(),h(g.target.value)},autoFocus:!0,size:"small",variant:"outlined",placeholder:o||m,onKeyDown:u,...i}):e.jsx(y,{px:1,className:"form-item-input slot",children:s})}on.propTypes=tn;on.defaultProps={componentProps:{}};function sn({editing:t,value:o,onChange:s,componentProps:a,...n}){const{blocklet:i}=a,m=o==="auto"?Wo.getPassportColorFromDid(i.appDid):o;return e.jsxs(y,{display:"flex",alignItems:"center",children:[e.jsx("div",{style:{width:96,marginRight:12},dangerouslySetInnerHTML:{__html:Ho({title:"Owner",issuer:O.getDisplayName(i),issuerDid:i.appDid,ownerName:"Your Name",ownerDid:i.appDid,preferredColor:o||"auto"})}}),e.jsx(nn,{...n,editing:t,value:t?m:o,onChange:s,componentProps:a})]})}sn.propTypes={...tn,componentProps:r.shape({blocklet:r.object.isRequired}).isRequired};sn.defaultProps={};const Mr={input:on,color:nn,passport:sn,uploader:t=>e.jsx(Ts,{...t.componentProps})};function Fr(t,{editing:o=!1}){const{componentType:s="input",render:a,renderFormItem:n}=t;return o&&n?n:!o&&a?a:Mr[s==null?void 0:s.toLowerCase()]}function rn({schema:t,loading:o,value:s,defaultValue:a,onChange:n,style:i,disabled:m}){const l=Object.prototype.toString.call(s)==="[object Object]",[u,h]=f.useState(null),[g,p]=f.useState(l?s:a),S=f.useRef();function d(x,b,c){const{key:v,secure:j}=x,I=g[v]!==b,U={...g,[v]:b};I&&p(U),n({[v]:b},{allValues:U,action:c,currentItem:x}),c==="confirm"&&j&&p({...g,[v]:"__encrypted__"}),["confirm","cancel"].includes(c)?R(null):R(x)}function R(x){if(x){S.current=g[x.key],h(x);return}S.current=null,h(null)}function C(x,{editing:b=!1}){const{key:c}=x,v=l?s[c]:g[c];return v==="__encrypted__"?b?"":"******":v}return e.jsx(Gr,{className:"form",style:i,children:t==null?void 0:t.map(x=>{const{key:b,description:c,required:v,solo:j=!1,hidden:T=!1,componentProps:I={}}=x;if(T)return null;const U=!!(u&&b===u.key),L=C(x,{editing:U}),k=Fr(x,{editing:U}),M={inputProps:{"data-cy":"schema-form-item-component"},key:b,description:c,editing:U,value:L,onChange:(B,V="change")=>d(x,B,V),componentProps:I};return e.jsxs(y,{className:"form-item",children:[!j&&e.jsxs(y,{className:"form-item-label",style:{color:v&&!L?"#ff0000":"#333"},children:[c,v&&e.jsx(ct,{})]}),e.jsxs(y,{className:"form-item-body",children:[e.jsx(y,{className:"form-item-input",sx:{textAlign:j?"center":"left"},children:e.jsx(k,{...M})}),!j&&e.jsx(y,{className:"form-item-action",children:U?e.jsxs(e.Fragment,{children:[e.jsx($,{"data-cy":"schema-form-item-confirm",onClick:()=>{d(x,L,"confirm")},disabled:m||o,size:"large",children:o?e.jsx(re,{size:24}):e.jsx(lr,{})}),e.jsx($,{"data-cy":"schema-form-item-cancel",onClick:()=>{d(x,S.current,"cancel")},disabled:m||o,size:"large",children:e.jsx(Yo,{})})]}):e.jsx($,{"data-cy":"schema-form-item-edit",onClick:()=>{d(x,g[b],"edit")},disabled:m||u,size:"large",children:e.jsx(ar,{})})})]})]},b)})})}rn.propTypes={schema:r.array.isRequired,loading:r.bool,onChange:r.func.isRequired,value:r.object,defaultValue:r.object,style:r.object,disabled:r.bool};rn.defaultProps={loading:!1,value:void 0,defaultValue:{},style:{},disabled:!1};const Gr=F(Es)``;function an({meta:t,onCancel:o,mode:s,handlePaySuccess:a}){const{t:n,locale:i}=z(),{info:m}=J(),l=po(m),[u,h]=f.useState(null),g=new URL(t==null?void 0:t.registryUrl).origin,p=O.getDisplayName({meta:t}),S=async(R,C)=>{const x=({downloadTokenList:v})=>{a({downloadTokenList:v})},b=v=>{A.error(v),o(v)};function c(v){return Ko(()=>eo.get(v).then(async({data:j})=>{const T=j==null?void 0:j.downloadTokenList;if(j.status==="succeed"){if(T&&T.length)await x({downloadTokenList:T});else return await b(n("blocklet.component.missDownloadTokenTip")),!0;return!0}return j.status==="error"?(console.error("vc error: ",j),await b(j==null?void 0:j.error),!0):!1}),{interval:1e3})}if(s==="purchase"&&u){const{statusUrl:v}=Jo(u);await c(v)}else await x({downloadTokenList:R.downloadTokenList&&C(R.downloadTokenList)})};if(f.useEffect(()=>{if(s==="purchase"){const R=new URL(g);R.pathname="/api/did/verify-purchase-blocklet/token",R.searchParams.set("serverDid",m.did),R.searchParams.set("blockletDid",t==null?void 0:t.did);try{eo.get(R.href).then(({data:C})=>{const x=`${C.url}`;h(x)})}catch(C){console.error("get next workflow url error: ",C)}}return()=>{h(null)}},[s]),s==="purchase"&&!u)return"";const d={verify:{action:"verify-purchase-blocklet",checkFn:pt.create({baseURL:g}).get,extraParams:{serverDid:m.did,blockletDid:t==null?void 0:t.did},messages:{title:n("store.purchase.verify.auth.title",{name:p}),scan:n("store.purchase.verify.auth.scan"),confirm:n("store.purchase.verify.auth.confirm"),success:n("store.purchase.verify.auth.success")}},purchase:{action:"acquire-asset",checkFn:pt.create({baseURL:we(g,"/store")}).get,extraParams:{factory:t.nftFactory,nw:u},messages:{title:n("store.purchase.auth.title",{name:p}),scan:n("store.purchase.auth.scan"),confirm:n("store.purchase.auth.confirm"),success:e.jsxs(e.Fragment,{children:[e.jsx("p",{children:n("store.purchase.auth.success")}),e.jsx("p",{children:n("blocklet.component.purchaseComponentSecondCheckTip")})]})}}};return e.jsx(Gt,{open:!0,locale:i,popup:!1,saveConnect:!1,className:"connect",baseUrl:g,onSuccess:S,cancelWhenScanned:o,onClose:o,checkTimeout:60*5e3,webWalletUrl:l,disableClose:!0,showDownload:!1,...d[s]})}an.propTypes={...zs,handlePaySuccess:r.func,mode:r.oneOf(["verify","purchase"]).isRequired};an.defaultProps={handlePaySuccess:()=>{}};const ln=f.forwardRef(({mode:t,...o},s)=>{const[a,n]=f.useState(t!=="both"?t:"verify"),[i,m]=f.useState(t!=="both"?2:1),l=h=>{h!==a&&n(h)},u=()=>{a&&i!==2&&m(2)};return f.useImperativeHandle(s,()=>({onNext:u,getCurrentStep:()=>i})),i===1?e.jsx("div",{style:{maxWidth:520},children:e.jsx(Vs,{action:a,onNext:null,onSelect:l})}):e.jsx(an,{...o,mode:a})});ln.propTypes={mode:r.oneOf(["both","verify","purchase"]).isRequired,ref:r.any};ln.defaultProps={ref:{}};const zr=ln;function Vr({...t}){return e.jsx(ne,{className:"bottom-button",variant:"contained",color:"primary",...t})}function cn({key:t}={key:"sm"}){const o=uo();return Wt(o.breakpoints.down(t))}function dn({blocklet:t,onStartNow:o,children:s,disabled:a}){const{t:n}=z(),i=cn();return!t||Qo(t.meta)?e.jsx(qr,{children:s}):e.jsxs(_r,{isMobile:i,children:[e.jsx(Vr,{className:"start-now",variant:"contained",color:"primary",disabled:a,onClick:()=>o(),children:n("setup.startNow")}),e.jsx(y,{display:"flex",alignItems:"center",children:s})]})}dn.propTypes={blocklet:r.object,onStartNow:r.func,children:r.any,disabled:r.bool};dn.defaultProps={blocklet:null,onStartNow:()=>{},children:null,disabled:!1};const qr=F(y)`
66
+ `,{NODE_MODES:so}=D,Ar=({mode:t,previousMode:o}={})=>t===so.SERVERLESS||o===so.SERVERLESS;var To={isInServerlessMode:Ar};function Lr(){const[t,o]=f.useState(null),{blocklet:s}=ie();return f.useEffect(()=>{o(tr(s))},[s]),{storageEndpoint:t}}const wo=f.createContext({}),{Provider:Or,Consumer:Za}=wo;function $t({children:t}){const[o,s]=f.useState(!1),[a,n]=f.useState(null),{blocklet:i,actions:{refreshBlocklet:m}}=ie(),{storageEndpoint:l}=Lr(),{api:u}=J();Vo(async()=>{try{if(s(!0),Wn.isEmpty(l)){n(null);return}const d=await nr(l);n(d)}catch(d){console.error(d),A.error(d.message)}finally{s(!1)}},[l]);const h=()=>{n(null),m()},g=async d=>{n(d),await p(d.endpoint),m()},p=async d=>{await u.configBlocklet({input:{did:[i.meta.did],configs:[{key:X.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_SPACE_ENDPOINT,value:d}]}}),m()};f.useEffect(()=>{async function d(){if(!a)return;const b=await or(a.endpoint,a.name),C=Wn.merge(a,{name:b});n(C)}d()},[]);const S=!!(l&&a);return e.jsx(Or,{value:{loading:o,spaceGateway:a,deleteSpaceGateway:h,updateSpaceGateway:g,storageEndpoint:l,settingStorageEndpoint:p,hasStorageEndpoint:S},children:t})}$t.propTypes={children:Ke.node.isRequired};$t.defaultProps={};function en(){return f.useContext(wo)}const tn={description:r.string,editing:r.bool,onChange:r.func,required:r.bool,value:r.any,componentProps:r.object,render:r.func,renderFormItem:r.func};function nn({editing:t,value:o,onChange:s}){const[a,n]=f.useState(!1),i=f.useRef(),m=f.useRef(o);f.useEffect(()=>{let p=null;return t&&(p=setTimeout(()=>{n(!0)},50)),()=>{clearTimeout(p)}},[t]);const l=p=>{m.current=p,s(p)},u=()=>{n(!1),s(m.current)},h=e.jsx(y,{className:"form-item-input slot",px:1,children:e.jsxs(y,{display:"flex",alignItems:"center",children:[o,o!=="auto"&&e.jsx("div",{style:{marginLeft:4,backgroundColor:o,width:"1em",height:"1em",borderRadius:"0.2em"}})]})}),g=e.jsxs(y,{display:"flex",flexGrow:1,alignItems:"center",height:"40px",onKeyDown:u,children:[e.jsx(y,{display:"flex",alignItems:"center",onClick:()=>n(!0),children:e.jsx("div",{ref:i,style:{flexShrink:0,marginLeft:"8px",backgroundColor:o,width:"32px",height:"32px",boxSizing:"border-box",borderRadius:"8px",border:"1px solid #eee",cursor:o==="auto"?"default":"pointer"}})}),e.jsx(_o,{open:a,anchorEl:i.current,onClose:()=>n(!1),anchorOrigin:{vertical:"bottom",horizontal:"center"},transformOrigin:{vertical:"top",horizontal:"center"},children:e.jsx(cr,{color:o,onChange:p=>l(p.hex)})})]});return t?g:h}nn.propTypes=tn;function on({editing:t,description:o,value:s,onChange:a,componentProps:n,...i}){const{placeholder:m}=n,l=f.useRef(s),u=g=>{g.key==="Enter"&&a(l.current,"confirm")},h=g=>{l.current=g,a(g)};return t?e.jsx(K,{style:{flex:1},fullWidth:!0,value:s,onChange:g=>{g.persist(),h(g.target.value)},autoFocus:!0,size:"small",variant:"outlined",placeholder:o||m,onKeyDown:u,...i}):e.jsx(y,{px:1,className:"form-item-input slot",children:s})}on.propTypes=tn;on.defaultProps={componentProps:{}};function sn({editing:t,value:o,onChange:s,componentProps:a,...n}){const{blocklet:i}=a,m=o==="auto"?Wo.getPassportColorFromDid(i.appDid):o;return e.jsxs(y,{display:"flex",alignItems:"center",children:[e.jsx("div",{style:{width:96,marginRight:12},dangerouslySetInnerHTML:{__html:Ho({title:"Owner",issuer:O.getDisplayName(i),issuerDid:i.appDid,ownerName:"Your Name",ownerDid:i.appDid,preferredColor:o||"auto"})}}),e.jsx(nn,{...n,editing:t,value:t?m:o,onChange:s,componentProps:a})]})}sn.propTypes={...tn,componentProps:r.shape({blocklet:r.object.isRequired}).isRequired};sn.defaultProps={};const Mr={input:on,color:nn,passport:sn,uploader:t=>e.jsx(Ts,{...t.componentProps})};function Fr(t,{editing:o=!1}){const{componentType:s="input",render:a,renderFormItem:n}=t;return o&&n?n:!o&&a?a:Mr[s==null?void 0:s.toLowerCase()]}function rn({schema:t,loading:o,value:s,defaultValue:a,onChange:n,style:i,disabled:m}){const l=Object.prototype.toString.call(s)==="[object Object]",[u,h]=f.useState(null),[g,p]=f.useState(l?s:a),S=f.useRef();function d(x,R,c){const{key:v,secure:j}=x,I=g[v]!==R,U={...g,[v]:R};I&&p(U),n({[v]:R},{allValues:U,action:c,currentItem:x}),c==="confirm"&&j&&p({...g,[v]:"__encrypted__"}),["confirm","cancel"].includes(c)?b(null):b(x)}function b(x){if(x){S.current=g[x.key],h(x);return}S.current=null,h(null)}function C(x,{editing:R=!1}){const{key:c}=x,v=l?s[c]:g[c];return v==="__encrypted__"?R?"":"******":v}return e.jsx(Gr,{className:"form",style:i,children:t==null?void 0:t.map(x=>{const{key:R,description:c,required:v,solo:j=!1,hidden:T=!1,componentProps:I={}}=x;if(T)return null;const U=!!(u&&R===u.key),L=C(x,{editing:U}),k=Fr(x,{editing:U}),M={inputProps:{"data-cy":"schema-form-item-component"},key:R,description:c,editing:U,value:L,onChange:(B,q="change")=>d(x,B,q),componentProps:I};return e.jsxs(y,{className:"form-item",children:[!j&&e.jsxs(y,{className:"form-item-label",style:{color:v&&!L?"#ff0000":"#333"},children:[c,v&&e.jsx(ct,{})]}),e.jsxs(y,{className:"form-item-body",children:[e.jsx(y,{className:"form-item-input",sx:{textAlign:j?"center":"left"},children:e.jsx(k,{...M})}),!j&&e.jsx(y,{className:"form-item-action",children:U?e.jsxs(e.Fragment,{children:[e.jsx($,{"data-cy":"schema-form-item-confirm",onClick:()=>{d(x,L,"confirm")},disabled:m||o,size:"large",children:o?e.jsx(re,{size:24}):e.jsx(lr,{})}),e.jsx($,{"data-cy":"schema-form-item-cancel",onClick:()=>{d(x,S.current,"cancel")},disabled:m||o,size:"large",children:e.jsx(Yo,{})})]}):e.jsx($,{"data-cy":"schema-form-item-edit",onClick:()=>{d(x,g[R],"edit")},disabled:m||u,size:"large",children:e.jsx(ar,{})})})]})]},R)})})}rn.propTypes={schema:r.array.isRequired,loading:r.bool,onChange:r.func.isRequired,value:r.object,defaultValue:r.object,style:r.object,disabled:r.bool};rn.defaultProps={loading:!1,value:void 0,defaultValue:{},style:{},disabled:!1};const Gr=F(Es)``;function an({meta:t,onCancel:o,mode:s,handlePaySuccess:a}){const{t:n,locale:i}=z(),{info:m}=J(),l=po(m),[u,h]=f.useState(null),g=new URL(t==null?void 0:t.registryUrl).origin,p=O.getDisplayName({meta:t}),S=async(b,C)=>{const x=({downloadTokenList:v})=>{a({downloadTokenList:v})},R=v=>{A.error(v),o(v)};function c(v){return Ko(()=>eo.get(v).then(async({data:j})=>{const T=j==null?void 0:j.downloadTokenList;if(j.status==="succeed"){if(T&&T.length)await x({downloadTokenList:T});else return await R(n("blocklet.component.missDownloadTokenTip")),!0;return!0}return j.status==="error"?(console.error("vc error: ",j),await R(j==null?void 0:j.error),!0):!1}),{interval:1e3})}if(s==="purchase"&&u){const{statusUrl:v}=Jo(u);await c(v)}else await x({downloadTokenList:b.downloadTokenList&&C(b.downloadTokenList)})};if(f.useEffect(()=>{if(s==="purchase"){const b=new URL(g);b.pathname="/api/did/verify-purchase-blocklet/token",b.searchParams.set("serverDid",m.did),b.searchParams.set("blockletDid",t==null?void 0:t.did);try{eo.get(b.href).then(({data:C})=>{const x=`${C.url}`;h(x)})}catch(C){console.error("get next workflow url error: ",C)}}return()=>{h(null)}},[s]),s==="purchase"&&!u)return"";const d={verify:{action:"verify-purchase-blocklet",checkFn:pt.create({baseURL:g}).get,extraParams:{serverDid:m.did,blockletDid:t==null?void 0:t.did},messages:{title:n("store.purchase.verify.auth.title",{name:p}),scan:n("store.purchase.verify.auth.scan"),confirm:n("store.purchase.verify.auth.confirm"),success:n("store.purchase.verify.auth.success")}},purchase:{action:"acquire-asset",checkFn:pt.create({baseURL:we(g,"/store")}).get,extraParams:{factory:t.nftFactory,nw:u},messages:{title:n("store.purchase.auth.title",{name:p}),scan:n("store.purchase.auth.scan"),confirm:n("store.purchase.auth.confirm"),success:e.jsxs(e.Fragment,{children:[e.jsx("p",{children:n("store.purchase.auth.success")}),e.jsx("p",{children:n("blocklet.component.purchaseComponentSecondCheckTip")})]})}}};return e.jsx(Gt,{open:!0,locale:i,popup:!1,saveConnect:!1,className:"connect",baseUrl:g,onSuccess:S,cancelWhenScanned:o,onClose:o,checkTimeout:60*5e3,webWalletUrl:l,disableClose:!0,showDownload:!1,...d[s]})}an.propTypes={...zs,handlePaySuccess:r.func,mode:r.oneOf(["verify","purchase"]).isRequired};an.defaultProps={handlePaySuccess:()=>{}};const ln=f.forwardRef(({mode:t,...o},s)=>{const[a,n]=f.useState(t!=="both"?t:"verify"),[i,m]=f.useState(t!=="both"?2:1),l=h=>{h!==a&&n(h)},u=()=>{a&&i!==2&&m(2)};return f.useImperativeHandle(s,()=>({onNext:u,getCurrentStep:()=>i})),i===1?e.jsx("div",{style:{maxWidth:520},children:e.jsx(qs,{action:a,onNext:null,onSelect:l})}):e.jsx(an,{...o,mode:a})});ln.propTypes={mode:r.oneOf(["both","verify","purchase"]).isRequired,ref:r.any};ln.defaultProps={ref:{}};const zr=ln;function qr({...t}){return e.jsx(ne,{className:"bottom-button",variant:"contained",color:"primary",...t})}function cn({key:t}={key:"sm"}){const o=uo();return Wt(o.breakpoints.down(t))}function dn({blocklet:t,onStartNow:o,children:s,disabled:a}){const{t:n}=z(),i=cn();return!t||Qo(t.meta)?e.jsx(Vr,{children:s}):e.jsxs(_r,{isMobile:i,children:[e.jsx(qr,{className:"start-now",variant:"contained",color:"primary",disabled:a,onClick:()=>o(),children:n("setup.startNow")}),e.jsx(y,{display:"flex",alignItems:"center",children:s})]})}dn.propTypes={blocklet:r.object,onStartNow:r.func,children:r.any,disabled:r.bool};dn.defaultProps={blocklet:null,onStartNow:()=>{},children:null,disabled:!1};const Vr=F(y)`
67
67
  width: 100%;
68
68
  margin-top: auto;
69
69
  padding-top: 24px;
@@ -161,12 +161,12 @@ import{bK as zo,j as e,aK as qt,aL as _t,q as z,O as y,ax as ve,P as r,A,bk as J
161
161
  visibility: visible;
162
162
  }
163
163
  }
164
- `;function Hr(){const{t}=z(),{spaceGateway:o,settingStorageEndpoint:s}=en();return e.jsxs(y,{display:"flex",flexDirection:"column",children:[e.jsx(y,{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",marginBottom:"12px",children:e.jsx(ee,{fontSize:"1.2rem",fontWeight:"bold",children:t("storage.spaces.connected.title")})}),e.jsx(y,{children:e.jsx(un,{style:{marginTop:"12px"},spaceGateway:o,connected:!0,onDisconnect:()=>s(null)},o.endpoint)})]})}function mn({onConnect:t,...o}){const{blocklet:s}=ie(),{info:a}=J(),{t:n,locale:i}=z(),[m,l]=f.useState(""),[u,h]=f.useState(!1),[g,p]=f.useState(!1),[S,d]=f.useState(""),R=mr({blocklet:s}),C=po(a),{storageEndpoint:x}=en(),[b,c]=f.useState({open:!1,action:"connect-to-did-spaces",checkTimeout:1e3*300,prefix:"/api/did",checkFn:pt.create({baseURL:we(window.location.origin,$o())}).get,messages:{title:n("storage.spaces.provideNFT.title",{appName:R.appName},i),scan:n("storage.spaces.provideNFT.scan",{appName:R.appName},i),confirm:"",success:e.jsx(ee,{gutterBottom:!0,children:n("storage.spaces.provideNFT.success")})},onClose:()=>{c(k=>({...k,open:!1}))}}),[v,j]=f.useState({open:!1,action:"one-click-authorization",checkTimeout:1e3*300,messages:{title:n("storage.spaces.authorize.title",{appName:R.appName},i),scan:n("storage.spaces.authorize.scan",{appName:R.appName},i),confirm:"",success:e.jsx(ee,{gutterBottom:!0,children:n("storage.spaces.authorize.success")})},onClose:()=>{j(k=>({...k,open:!1}))}}),T=async({did:k,name:M,endpoint:B})=>{const V=await Xn(B);if(!await $n(V)){A.error(n("storage.spaces.gateway.add.invalidUrl"));return}const Q={name:M,did:k,url:V,endpoint:B};await t(Q),A.success(n("storage.spaces.connectedWithName",{name:Q.name}))},I=(k,M)=>{setTimeout(async()=>{if(j(Q=>({...Q,open:!1})),l(null),c(Q=>({...Q,open:!1})),!He(k.spaceGateway)){await T(M(k.spaceGateway));return}const B=M(k.endpoint),V=k.space?M(k.space):{};await T({endpoint:B,did:rr(B),name:"DID Space",...V})},0)},U=()=>{c(k=>({...k,open:!0,extraParams:{appPid:s.appPid,referrer:window.location.href}}))},L=async()=>{try{h(!0);const k=await Xn(m),M=ir(k),B=new URL(k).searchParams.get("spaceDid");if(!await $n(M))throw new Error(n("storage.spaces.gateway.add.invalidUrl"));j(V=>({...V,open:!0,prefix:we(M,"space/api/did"),baseUrl:new URL(M).origin,checkFn:pt.create({baseURL:we(M,"space")}).get,extraParams:{appDid:R.appDid,appName:R.appName,appDescription:R.appDescription,scopes:R.scopes,appUrl:R.appUrl,referrer:R.referrer,nodeDid:a.did,spaceDid:B}})),p(!1)}catch(k){const M=`${n("storage.spaces.gateway.add.failed",i)}: ${Z(k)}`;d(M)}finally{h(!1)}};return e.jsxs(y,{children:[e.jsx(to,{color:"primary",style:{textTransform:"none !important",fontSize:"1rem"},size:"small",onClick:U,variant:"outlined",menu:[e.jsx(to.Item,{sx:{textTransform:"none"},onClick:()=>p(!0),size:"small",...o,children:n(x?"storage.spaces.connect.useSpaceGatewayReconnect":"storage.spaces.connect.useSpaceGateway")},"1")],children:e.jsx(ee,{sx:{fontWeight:"bold",textTransform:"none"},children:n(x?"storage.spaces.connect.useWalletReconnect":"storage.spaces.connect.useWallet")})}),e.jsx(Gt,{forceConnected:!1,saveConnect:!1,prefix:b.prefix,open:b.open,popup:!0,action:b.action,webWalletUrl:C,baseUrl:b.baseUrl,checkFn:b.checkFn,onSuccess:I,onClose:b.onClose,checkTimeout:b.checkTimeout,extraParams:b.extraParams,messages:b.messages,locale:i}),e.jsx(Gt,{forceConnected:!1,saveConnect:!1,prefix:v.prefix,open:v.open,popup:!0,action:v.action,baseUrl:v.baseUrl,checkFn:v.checkFn,onSuccess:I,onClose:v.onClose,checkTimeout:v.checkTimeout,extraParams:v.extraParams,messages:v.messages,locale:i}),e.jsxs(xt,{title:n("storage.spaces.gateway.add.title"),fullWidth:!0,maxWidth:"md",open:g,onClose:()=>p(!1),PaperProps:{style:{minHeight:"auto"}},actions:e.jsxs(e.Fragment,{children:[e.jsx(ne,{onClick:k=>{k.stopPropagation(),p(!1)},color:"inherit",children:n("common.cancel")}),e.jsxs(ne,{onClick:L,color:"primary",disabled:u||!m,variant:"contained",autoFocus:!0,children:[u&&e.jsx(re,{size:16}),n("common.confirm")]})]}),children:[e.jsx("div",{style:{paddingTop:12,overflowY:"hidden"},children:e.jsx(es,{component:"div",children:e.jsx(ee,{component:"div",children:e.jsx(K,{label:n("storage.spaces.gateway.add.label"),autoComplete:"off",variant:"outlined",name:"url",fullWidth:!0,value:m,onChange:k=>{d(null),l(k.target.value)},disabled:u,onKeyPress:async k=>{k.key==="Enter"&&await L()},autoFocus:!0})})})}),!!S&&e.jsx(dt,{severity:"error",style:{width:"100%"},children:S})]})]})}mn.propTypes={onConnect:Ke.func};mn.defaultProps={onConnect:()=>{}};function fn({blockletMeta:t,onEndpointUpdate:o}){var l;const s=cn(),{blocklet:a}=ie(),{updateSpaceGateway:n,loading:i,hasStorageEndpoint:m}=en();return f.useEffect(()=>{o==null||o()},[a]),i?e.jsx(ts,{relative:"parent",children:e.jsx(re,{})}):e.jsxs(Yr,{children:[e.jsx(y,{width:s?"360px":"720px",children:m?e.jsx(Hr,{}):e.jsx(Io,{})}),((l=t==null?void 0:t.capabilities)==null?void 0:l.didSpace)==="required"&&e.jsx(dn,{mt:8,children:e.jsx(mn,{onConnect:n})})]})}fn.propTypes={blockletMeta:r.any.isRequired,onEndpointUpdate:Ke.func};fn.defaultProps={onEndpointUpdate:()=>{}};const Yr=F(ws)`
164
+ `;function Hr(){const{t}=z(),{spaceGateway:o,settingStorageEndpoint:s}=en();return e.jsxs(y,{display:"flex",flexDirection:"column",children:[e.jsx(y,{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",marginBottom:"12px",children:e.jsx(ee,{fontSize:"1.2rem",fontWeight:"bold",children:t("storage.spaces.connected.title")})}),e.jsx(y,{children:e.jsx(un,{style:{marginTop:"12px"},spaceGateway:o,connected:!0,onDisconnect:()=>s(null)},o.endpoint)})]})}function mn({onConnect:t,...o}){const{blocklet:s}=ie(),{info:a}=J(),{t:n,locale:i}=z(),[m,l]=f.useState(""),[u,h]=f.useState(!1),[g,p]=f.useState(!1),[S,d]=f.useState(""),b=mr({blocklet:s}),C=po(a),{storageEndpoint:x}=en(),[R,c]=f.useState({open:!1,action:"connect-to-did-spaces",checkTimeout:1e3*300,prefix:"/api/did",checkFn:pt.create({baseURL:we(window.location.origin,$o())}).get,messages:{title:n("storage.spaces.provideNFT.title",{appName:b.appName},i),scan:n("storage.spaces.provideNFT.scan",{appName:b.appName},i),confirm:"",success:e.jsx(ee,{gutterBottom:!0,children:n("storage.spaces.provideNFT.success")})},onClose:()=>{c(k=>({...k,open:!1}))}}),[v,j]=f.useState({open:!1,action:"one-click-authorization",checkTimeout:1e3*300,messages:{title:n("storage.spaces.authorize.title",{appName:b.appName},i),scan:n("storage.spaces.authorize.scan",{appName:b.appName},i),confirm:"",success:e.jsx(ee,{gutterBottom:!0,children:n("storage.spaces.authorize.success")})},onClose:()=>{j(k=>({...k,open:!1}))}}),T=async({did:k,name:M,endpoint:B})=>{const q=await Xn(B);if(!await $n(q)){A.error(n("storage.spaces.gateway.add.invalidUrl"));return}const Q={name:M,did:k,url:q,endpoint:B};await t(Q),A.success(n("storage.spaces.connectedWithName",{name:Q.name}))},I=(k,M)=>{setTimeout(async()=>{if(j(Q=>({...Q,open:!1})),l(null),c(Q=>({...Q,open:!1})),!He(k.spaceGateway)){await T(M(k.spaceGateway));return}const B=M(k.endpoint),q=k.space?M(k.space):{};await T({endpoint:B,did:rr(B),name:"DID Space",...q})},0)},U=()=>{c(k=>({...k,open:!0,extraParams:{appPid:s.appPid,referrer:window.location.href}}))},L=async()=>{try{h(!0);const k=await Xn(m),M=ir(k),B=new URL(k).searchParams.get("spaceDid");if(!await $n(M))throw new Error(n("storage.spaces.gateway.add.invalidUrl"));j(q=>({...q,open:!0,prefix:we(M,"space/api/did"),baseUrl:new URL(M).origin,checkFn:pt.create({baseURL:we(M,"space")}).get,extraParams:{appDid:b.appDid,appName:b.appName,appDescription:b.appDescription,scopes:b.scopes,appUrl:b.appUrl,referrer:b.referrer,nodeDid:a.did,spaceDid:B}})),p(!1)}catch(k){const M=`${n("storage.spaces.gateway.add.failed",i)}: ${Z(k)}`;d(M)}finally{h(!1)}};return e.jsxs(y,{children:[e.jsx(to,{color:"primary",style:{textTransform:"none !important",fontSize:"1rem"},size:"small",onClick:U,variant:"outlined",menu:[e.jsx(to.Item,{sx:{textTransform:"none"},onClick:()=>p(!0),size:"small",...o,children:n(x?"storage.spaces.connect.useSpaceGatewayReconnect":"storage.spaces.connect.useSpaceGateway")},"1")],children:e.jsx(ee,{sx:{fontWeight:"bold",textTransform:"none"},children:n(x?"storage.spaces.connect.useWalletReconnect":"storage.spaces.connect.useWallet")})}),e.jsx(Gt,{forceConnected:!1,saveConnect:!1,prefix:R.prefix,open:R.open,popup:!0,action:R.action,webWalletUrl:C,baseUrl:R.baseUrl,checkFn:R.checkFn,onSuccess:I,onClose:R.onClose,checkTimeout:R.checkTimeout,extraParams:R.extraParams,messages:R.messages,locale:i}),e.jsx(Gt,{forceConnected:!1,saveConnect:!1,prefix:v.prefix,open:v.open,popup:!0,action:v.action,baseUrl:v.baseUrl,checkFn:v.checkFn,onSuccess:I,onClose:v.onClose,checkTimeout:v.checkTimeout,extraParams:v.extraParams,messages:v.messages,locale:i}),e.jsxs(xt,{title:n("storage.spaces.gateway.add.title"),fullWidth:!0,maxWidth:"md",open:g,onClose:()=>p(!1),PaperProps:{style:{minHeight:"auto"}},actions:e.jsxs(e.Fragment,{children:[e.jsx(ne,{onClick:k=>{k.stopPropagation(),p(!1)},color:"inherit",children:n("common.cancel")}),e.jsxs(ne,{onClick:L,color:"primary",disabled:u||!m,variant:"contained",autoFocus:!0,children:[u&&e.jsx(re,{size:16}),n("common.confirm")]})]}),children:[e.jsx("div",{style:{paddingTop:12,overflowY:"hidden"},children:e.jsx(es,{component:"div",children:e.jsx(ee,{component:"div",children:e.jsx(K,{label:n("storage.spaces.gateway.add.label"),autoComplete:"off",variant:"outlined",name:"url",fullWidth:!0,value:m,onChange:k=>{d(null),l(k.target.value)},disabled:u,onKeyPress:async k=>{k.key==="Enter"&&await L()},autoFocus:!0})})})}),!!S&&e.jsx(dt,{severity:"error",style:{width:"100%"},children:S})]})]})}mn.propTypes={onConnect:Ke.func};mn.defaultProps={onConnect:()=>{}};function fn({blockletMeta:t,onEndpointUpdate:o}){var l;const s=cn(),{blocklet:a}=ie(),{updateSpaceGateway:n,loading:i,hasStorageEndpoint:m}=en();return f.useEffect(()=>{o==null||o()},[a]),i?e.jsx(ts,{relative:"parent",children:e.jsx(re,{})}):e.jsxs(Yr,{children:[e.jsx(y,{width:s?"360px":"720px",children:m?e.jsx(Hr,{}):e.jsx(Io,{})}),((l=t==null?void 0:t.capabilities)==null?void 0:l.didSpace)==="required"&&e.jsx(dn,{mt:8,children:e.jsx(mn,{onConnect:n})})]})}fn.propTypes={blockletMeta:r.any.isRequired,onEndpointUpdate:Ke.func};fn.defaultProps={onEndpointUpdate:()=>{}};const Yr=F(ws)`
165
165
  height: 100%;
166
166
  overflow-y: auto;
167
167
  padding-bottom: 32px;
168
168
  overflow-x: hidden;
169
- `;function hn({onChange:t,loading:o,children:s,extra:a,stores:n,storageKey:i}){const{t:m}=z(),{info:l,inService:u}=J(),{blocklet:h}=ie(),[g,p]=f.useState(!1),S=f.useRef(null),[d,R]=f.useState(),[C,x]=gr(i||"tmp"),[b,c]=i?[C,x]:[d,R],{storeList:v,teamDid:j}=ho({fromBlocklet:u,blocklet:h,nodeInfo:l}),T=jo([...n.map(U=>({...U,protected:!0})),...v],"url"),I=b&&T.find(U=>b===U.url)||T[0];return e.jsxs(e.Fragment,{children:[e.jsxs(Jr,{children:[e.jsx(ne,{ref:S,color:"primary","data-cy":"add-component-select-store",endIcon:e.jsx(hr,{color:"primary"}),onClick:()=>{p(!0)},style:{padding:"0 2px"},children:e.jsx(ee,{color:"primary",children:I.name})}),e.jsx(ee,{color:"primary",children:a})]}),e.jsxs(K,{id:"mui-registry-select",select:!0,autoComplete:"off",variant:"outlined",name:"did",helperText:m("blocklet.component.selectRegistryTip"),"data-cy":"component-registry-select",fullWidth:!0,value:I,autoFocus:!0,onChange:U=>{const L=U.target.value;c(L.url),t(L)},SelectProps:{open:g,MenuProps:{anchorEl:S.current},renderValue:U=>U==null?void 0:U.name,onClose:()=>{p(!1)}},style:{display:"none"},margin:"normal",children:[T==null?void 0:T.map(U=>e.jsx(ge,{sx:{width:"400px",maxWidth:"90vw"},value:U,"data-cy":U.url,children:e.jsx(qs,{teamDid:j,store:U,onDelete:()=>{var L;b===U.url&&c((L=T[0])==null?void 0:L.url)}})},U.url)),!To.isInServerlessMode(l)&&e.jsx(_s,{disabled:o,storeList:T,teamDid:j,onAdd:U=>{c(U)}})]}),s({currentRegistry:I})]})}hn.propTypes={onChange:r.func,loading:r.bool,children:r.any.isRequired,extra:r.node,storageKey:r.string,stores:r.arrayOf(r.shape({name:r.string.isRequired,url:r.string.isRequired}))};hn.defaultProps={onChange:()=>{},loading:!1,extra:"",stores:[],storageKey:""};const Jr=F.div`
169
+ `;function hn({onChange:t,loading:o,children:s,extra:a,stores:n,storageKey:i}){const{t:m}=z(),{info:l,inService:u}=J(),{blocklet:h}=ie(),[g,p]=f.useState(!1),S=f.useRef(null),[d,b]=f.useState(),[C,x]=gr(i||"tmp"),[R,c]=i?[C,x]:[d,b],{storeList:v,teamDid:j}=ho({fromBlocklet:u,blocklet:h,nodeInfo:l}),T=jo([...n.map(U=>({...U,protected:!0})),...v],"url"),I=R&&T.find(U=>R===U.url)||T[0];return e.jsxs(e.Fragment,{children:[e.jsxs(Jr,{children:[e.jsx(ne,{ref:S,color:"primary","data-cy":"add-component-select-store",endIcon:e.jsx(hr,{color:"primary"}),onClick:()=>{p(!0)},style:{padding:"0 2px"},children:e.jsx(ee,{color:"primary",children:I.name})}),e.jsx(ee,{color:"primary",children:a})]}),e.jsxs(K,{id:"mui-registry-select",select:!0,autoComplete:"off",variant:"outlined",name:"did",helperText:m("blocklet.component.selectRegistryTip"),"data-cy":"component-registry-select",fullWidth:!0,value:I,autoFocus:!0,onChange:U=>{const L=U.target.value;c(L.url),t(L)},SelectProps:{open:g,MenuProps:{anchorEl:S.current},renderValue:U=>U==null?void 0:U.name,onClose:()=>{p(!1)}},style:{display:"none"},margin:"normal",children:[T==null?void 0:T.map(U=>e.jsx(ge,{sx:{width:"400px",maxWidth:"90vw"},value:U,"data-cy":U.url,children:e.jsx(Vs,{teamDid:j,store:U,onDelete:()=>{var L;R===U.url&&c((L=T[0])==null?void 0:L.url)}})},U.url)),!To.isInServerlessMode(l)&&e.jsx(_s,{disabled:o,storeList:T,teamDid:j,onAdd:U=>{c(U)}})]}),s({currentRegistry:I})]})}hn.propTypes={onChange:r.func,loading:r.bool,children:r.any.isRequired,extra:r.node,storageKey:r.string,stores:r.arrayOf(r.shape({name:r.string.isRequired,url:r.string.isRequired}))};hn.defaultProps={onChange:()=>{},loading:!1,extra:"",stores:[],storageKey:""};const Jr=F.div`
170
170
  display: flex;
171
171
  justify-content: space-between;
172
172
  align-items: center;
@@ -177,7 +177,7 @@ import{bK as zo,j as e,aK as qt,aL as _t,q as z,O as y,ax as ve,P as r,A,bk as J
177
177
  color: ${t=>t.theme.palette.common.black};
178
178
  // font-weight: bold;
179
179
  }
180
- `;var gn={},Kr=_t;Object.defineProperty(gn,"__esModule",{value:!0});var Uo=gn.default=void 0,Qr=Kr(qt()),Zr=e;Uo=gn.default=(0,Qr.default)((0,Zr.jsx)("path",{d:"M16 18v2H8v-2zM11 7.99V16h2V7.99h3L12 4 8 7.99z"}),"Upgrade");const Xr=(t,o)=>we(o,`/blocklets/${t.did}`),ro=({blocklet:t,attribute:o,value:s})=>t._formatted?t._formatted[o]:s,$r=t=>t.inStore&&O.isFreeBlocklet(t)===!1;function xn({blocklet:t,blocklets:o,handleButtonClick:s,endpoint:a}){const{t:n}=z();let i=we(a,ss(t.did,t.logo||""));try{const C=new URL(i);C.searchParams.set("v",t.version||+new Date),i=C.href}catch{}const[m,l]=f.useState(!1),u=C=>C.currentTarget.contains(C.target)?!0:(C.preventDefault(),!1),h=async C=>{C.preventDefault(),C.stopPropagation();try{l(!0),await s({meta:t,registryUrl:a,blocklets:o})}catch(x){A.error(x.message)}finally{l(!1)}},{blocklet:g}=ie(),p=()=>((g==null?void 0:g.children)||[]).find(b=>b.meta.bundleDid===t.did).meta.version,d=(()=>{const C=((g==null?void 0:g.children)||[]).find(x=>x.meta.bundleDid===t.did);if(C){try{const x=C.meta.version,b=t.version;if(rs.gt(b,x))return"upgrade"}catch{return"install"}return"disable"}return"install"})();let R=n("blocklet.component.choose");return d==="upgrade"?R=n("blocklet.component.upgrade"):d==="disable"?R=n("blocklet.component.installed"):$r(t)&&(R=n("common.purchase")),e.jsx(yt,{href:Xr(t,a),style:{color:"initial",textDecoration:"none"},onClick:u,target:"_blank",children:e.jsx(ei,{title:ro({blocklet:t,attribute:"title",value:t.title||t.name}),did:t.did,description:ro({blocklet:t,attribute:"description",value:t.description}),cover:t.logo?i:"",version:t.version,button:e.jsx("div",{style:{display:"flex",alignItems:"center"},children:e.jsx(Hs,{children:e.jsxs(ne,{onClick:h,size:"small",disabled:m||d==="disable",variant:"outlined",color:"primary","data-cy":"install-blocklet",title:d==="upgrade"?`${p()} -> ${t.version}`:"",children:[m?e.jsxs(e.Fragment,{children:[e.jsx(re,{size:16,style:{marginRight:3}}),R]}):R,d==="upgrade"?e.jsx(Uo,{style:{fontSize:"1.2rem"}}):null]},t.did)})})})})}xn.propTypes={blocklet:r.object.isRequired,blocklets:r.array,handleButtonClick:r.func,endpoint:r.string};xn.defaultProps={handleButtonClick:null,endpoint:"",blocklets:[]};function yn({handleButtonClick:t,handleSearchSelect:o,storeUrl:s,handleBlockletRender:a,extraFilter:n,serverVersion:i,resourceType:m,resourceDid:l,showResourcesSwitch:u,showCategory:h,...g}){const{locale:p}=z(),[S,d]=f.useState(!1),[R,C]=f.useState({}),x=c=>{C(c)},b=s;return f.useEffect(()=>{C({showResources:!0,resourceType:m,resourceDid:l})},[b,m,l]),f.useEffect(()=>{d(!0),C({showResources:!0,resourceType:m,resourceDid:l})},[]),e.jsx(ns,{FallbackComponent:os,resetKeys:[b],children:e.jsx("div",{...g,children:S&&e.jsx(Ws,{showCategory:h,showResourcesSwitch:u,blockletRender:c=>{const v={...c,handleButtonClick:t,endpoint:b};return a({...c,defaultRender:e.jsx(xn,{...v})})},baseSearch:!0,endpoint:b,locale:p,onFilterChange:x,onSearchSelect:o,filters:R,extraFilter:n,serverVersion:i,fetchCategoryDelay:500})})})}yn.propTypes={storeUrl:r.string.isRequired,handleButtonClick:r.func,handleSearchSelect:r.func,handleBlockletRender:r.func,extraFilter:r.func,serverVersion:r.string,resourceType:r.string,resourceDid:r.string,showResourcesSwitch:r.bool,showCategory:r.bool};yn.defaultProps={handleButtonClick:null,handleSearchSelect:null,handleBlockletRender:null,extraFilter:void 0,serverVersion:"",resourceType:"",resourceDid:"",showResourcesSwitch:!0,showCategory:!0};const ei=F(Ys)`
180
+ `;var gn={},Kr=_t;Object.defineProperty(gn,"__esModule",{value:!0});var Uo=gn.default=void 0,Qr=Kr(Vt()),Zr=e;Uo=gn.default=(0,Qr.default)((0,Zr.jsx)("path",{d:"M16 18v2H8v-2zM11 7.99V16h2V7.99h3L12 4 8 7.99z"}),"Upgrade");const Xr=(t,o)=>we(o,`/blocklets/${t.did}`),ro=({blocklet:t,attribute:o,value:s})=>t._formatted?t._formatted[o]:s,$r=t=>t.inStore&&O.isFreeBlocklet(t)===!1;function xn({blocklet:t,blocklets:o,handleButtonClick:s,endpoint:a}){const{t:n}=z();let i=we(a,ss(t.did,t.logo||""));try{const C=new URL(i);C.searchParams.set("v",t.version||+new Date),i=C.href}catch{}const[m,l]=f.useState(!1),u=C=>C.currentTarget.contains(C.target)?!0:(C.preventDefault(),!1),h=async C=>{C.preventDefault(),C.stopPropagation();try{l(!0),await s({meta:t,registryUrl:a,blocklets:o})}catch(x){A.error(x.message)}finally{l(!1)}},{blocklet:g}=ie(),p=()=>((g==null?void 0:g.children)||[]).find(R=>R.meta.bundleDid===t.did).meta.version,d=(()=>{const C=((g==null?void 0:g.children)||[]).find(x=>x.meta.bundleDid===t.did);if(C){try{const x=C.meta.version,R=t.version;if(rs.gt(R,x))return"upgrade"}catch{return"install"}return"disable"}return"install"})();let b=n("blocklet.component.choose");return d==="upgrade"?b=n("blocklet.component.upgrade"):d==="disable"?b=n("blocklet.component.installed"):$r(t)&&(b=n("common.purchase")),e.jsx(yt,{href:Xr(t,a),style:{color:"initial",textDecoration:"none"},onClick:u,target:"_blank",children:e.jsx(ei,{title:ro({blocklet:t,attribute:"title",value:t.title||t.name}),did:t.did,description:ro({blocklet:t,attribute:"description",value:t.description}),cover:t.logo?i:"",version:t.version,button:e.jsx("div",{style:{display:"flex",alignItems:"center"},children:e.jsx(Hs,{children:e.jsxs(ne,{onClick:h,size:"small",disabled:m||d==="disable",variant:"outlined",color:"primary","data-cy":"install-blocklet",title:d==="upgrade"?`${p()} -> ${t.version}`:"",children:[m?e.jsxs(e.Fragment,{children:[e.jsx(re,{size:16,style:{marginRight:3}}),b]}):b,d==="upgrade"?e.jsx(Uo,{style:{fontSize:"1.2rem"}}):null]},t.did)})})})})}xn.propTypes={blocklet:r.object.isRequired,blocklets:r.array,handleButtonClick:r.func,endpoint:r.string};xn.defaultProps={handleButtonClick:null,endpoint:"",blocklets:[]};function yn({handleButtonClick:t,handleSearchSelect:o,storeUrl:s,handleBlockletRender:a,extraFilter:n,serverVersion:i,resourceType:m,resourceDid:l,showResourcesSwitch:u,showCategory:h,...g}){const{locale:p}=z(),[S,d]=f.useState(!1),[b,C]=f.useState({}),x=c=>{C(c)},R=s;return f.useEffect(()=>{C({showResources:!0,resourceType:m,resourceDid:l})},[R,m,l]),f.useEffect(()=>{d(!0),C({showResources:!0,resourceType:m,resourceDid:l})},[]),e.jsx(ns,{FallbackComponent:os,resetKeys:[R],children:e.jsx("div",{...g,children:S&&e.jsx(Ws,{showCategory:h,showResourcesSwitch:u,blockletRender:c=>{const v={...c,handleButtonClick:t,endpoint:R};return a({...c,defaultRender:e.jsx(xn,{...v})})},baseSearch:!0,endpoint:R,locale:p,onFilterChange:x,onSearchSelect:o,filters:b,extraFilter:n,serverVersion:i,fetchCategoryDelay:500})})})}yn.propTypes={storeUrl:r.string.isRequired,handleButtonClick:r.func,handleSearchSelect:r.func,handleBlockletRender:r.func,extraFilter:r.func,serverVersion:r.string,resourceType:r.string,resourceDid:r.string,showResourcesSwitch:r.bool,showCategory:r.bool};yn.defaultProps={handleButtonClick:null,handleSearchSelect:null,handleBlockletRender:null,extraFilter:void 0,serverVersion:"",resourceType:"",resourceDid:"",showResourcesSwitch:!0,showCategory:!0};const ei=F(Ys)`
181
181
  .ms-highlight {
182
182
  color: ${t=>t.theme.palette.primary.main};
183
183
  }
@@ -319,7 +319,7 @@ import{bK as zo,j as e,aK as qt,aL as _t,q as z,O as y,ax as ve,P as r,A,bk as J
319
319
  & .connect {
320
320
  background: white;
321
321
  }
322
- `,oi=Cn,si=t=>t.inStore&&O.isFreeBlocklet(t)===!1,ri=t=>{var o;return[X.BLOCKLET_APP_SPACE_REQUIREMENT.REQUIRED,X.BLOCKLET_APP_SPACE_REQUIREMENT.REQUIRED_ON_SETUP].includes((o=t==null?void 0:t.capabilities)==null?void 0:o.didSpace)},Ot=t=>{var o,s;return((s=(o=t==null?void 0:t.configs)==null?void 0:o.find(a=>a.key===X.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_SPACE_ENDPOINT))==null?void 0:s.value)||null},ii=t=>(t.environments||[]).some(o=>o.required),ao=(t,o)=>t==null?void 0:t.some(s=>s.required&&!o[s.key]),ai=({params:t,blocklet:o,t:s})=>{const a=t.title||t.name;return a?((o==null?void 0:o.children)||[]).find(i=>i.meta.bundleDid===t.bundleDid)?s("blocklet.component.upgradeNext",{name:a}):s("blocklet.component.addNext",{name:a}):s("common.next")},lo=({componentDid:t,timeout:o=1e3,manual:s=!1}={})=>{setTimeout(()=>{window.parent.postMessage({event:"component.installed",componentDid:t,manual:s},"*")},o)};function jn({onClose:t,mode:o,stores:s,resourceType:a,resourceDid:n,storageKey:i,inDialog:m,selectedMeta:l,storeUrl:u,showResourcesSwitch:h,showFromUrl:g,enableRunBackground:p,showCategory:S}){var Ln,On,Mn,$e,Fn,et,Gn;const{t:d,locale:R}=z(),[C,x]=f.useState(!1),[b,c]=f.useState(null),[v,j]=f.useState(""),[T,I]=f.useState(""),{api:U,ws:{useSubscription:L},inService:k,info:M}=J(),{blocklet:B,actions:{refreshBlocklet:V}}=ie(),[Q,Ie]=f.useState(null),[te,de]=f.useState(!1),Se={bundleDid:"",componentDid:"",componentName:"",pathPrefix:"",name:"",title:"",configsList:[],configsValue:{},hasMissRequiredConfigs:!1,hasEnvironmentsStep:!1,hasRequiredEnvironments:!1,requirePurchase:!1,didSpaceIsRequiredSetup:null,installResultProps:{},purchaseResultProps:{},showFromUrlDialog:!1},[P,ke]=f.useState(Se),[me,Ze]=f.useState(0),q=f.useRef({}),w=f.useRef({}),_=f.useRef({}),oe=Wt(E=>E.breakpoints.down("md")),xe=as(),[se,Ge]=f.useState(!0),{meta:Y}=q.current,H=E=>ke(N=>({...N,...E}));f.useEffect(()=>{if(P.pathPrefix){const{errMsg:E}=An({...P,pathPrefix:P.pathPrefix,locale:R});j(E)}},[P.pathPrefix]),f.useEffect(()=>{me===0&&ke(Se)},[me]);const Re=()=>{const E=Ot(B)??"";H({didSpaceEndpoint:E})},ze=()=>{var E;return(E=q==null?void 0:q.current)!=null&&E.meta?O.getDisplayName(q.current):""},Ue=E=>{const N=G=>{H({installResultProps:{variant:"error",title:ze(),subTitle:E,footer:e.jsx(ne,{className:"bottom-button",disabled:G,"data-cy":"retry-install-component",onClick:async()=>{N(!0),await Nn(q.current.installInput)},children:e.jsxs(y,{display:"flex",alignItems:"center",children:[G&&e.jsx(re,{size:16,style:{marginRight:8}}),d("common.retry")]})})}})};N()},Tt=E=>N=>{var G,W;(((G=N==null?void 0:N.meta)==null?void 0:G.did)||(N==null?void 0:N.meta))===((W=B==null?void 0:B.meta)==null?void 0:W.did)&&E(N)};L(X.BlockletEvents.statusChange,Tt(E=>{switch(E.status){case X.BlockletStatus.upgrading:H({installResultProps:{variant:"success",title:ze(),subTitle:d("blocklet.component.installSuccessTip")}}),lo({componentDid:xe.componentDid});break}const N=Ot(B);H(G=>({...G,didSpaceEndpoint:N}))}),[(Ln=B==null?void 0:B.meta)==null?void 0:Ln.did]),L(X.BlockletEvents.downloadFailed,Tt(()=>{Ue(d("blocklet.component.installComponentError"))}),[(On=B==null?void 0:B.meta)==null?void 0:On.did]),L(X.BlockletEvents.installFailed,Tt(()=>{Ue(d("blocklet.component.installComponentError"))}),[(Mn=B==null?void 0:B.meta)==null?void 0:Mn.did]);const pe=[],wt=()=>{x(!1),ke({}),q.current={},t()},Xe=E=>((B==null?void 0:B.children)||[]).some(N=>N.meta.did===E),Nn=async E=>{var Be,Ne;const{pathPrefix:N,bundleDid:G,title:W,componentName:be="",componentDid:De=""}=P,Ee=((Be=q.current)==null?void 0:Be.meta)||{},{configs:ye=[],registryUrl:je,inStore:qe,inputUrl:_e,dist:It}=Ee,We=(Ne=q.current)==null?void 0:Ne.downloadTokenList,le=qe?Hn(je,G,It):_e;x(!0);const tt={rootDid:B.meta.did,url:le,mountPoint:N?ue(N):`/${ue(Ee.title||Ee.name)}`,title:W,name:be,did:De,onlyRequired:!se,...P.hasEnvironmentsStep&&ye.length>0?{configs:ye.map(he=>({...he,value:P.configsValue[he.key]||""}))}:{},...We?{downloadTokenList:We}:{},...E};try{if(await U.installComponent({input:tt}),je){const{teamDid:he,storeList:Ae}=ho({fromBlocklet:k,nodeInfo:M,blocklet:B}),{isNew:kt,decoded:nt}=ds(je,Ae);kt&&await U.addBlockletStore({input:{teamDid:he,url:nt}})}H({installResultProps:{}}),V({showError:!1,attachRuntimeInfo:!1})}catch(he){const Ae=Z(he);A.error(Ae),console.error("installComponent error: ",he),Ue(Ae)}finally{x(!1),q.current.installInput=tt}},An=E=>({errMsg:vo({params:{...E,did:E.bundleDid},blocklets:[B],blocklet:B,locale:R})}),fe=async E=>{var G,W;const{errMsg:N}=An({...P,locale:R});j(N),me===pe.length-2&&await Nn(E),(W=(G=w.current)==null?void 0:G.setActiveStepByIndex)==null||W.call(G,be=>be+1)},Ve=()=>{var E,N;(N=(E=w.current)==null?void 0:E.setActiveStepByIndex)==null||N.call(E,G=>G-1)},Lo=()=>{const{pathPrefix:E,bundleDid:N,title:G,componentName:W="",componentDid:be=""}=P,{meta:De={}}=q.current||{},{registryUrl:Ee,inStore:ye,inputUrl:je,dist:qe}=De,_e=ye?Hn(Ee,N,qe):je;Ie({meta:De,installOpts:{type:"component",rootDid:B.meta.did,mountPoint:E,url:_e,title:G,name:W,did:be}})},Oo=E=>{de(!1),H({purchaseResultProps:{variant:"error",title:ze(),subTitle:E,style:{paddingTop:120},footer:e.jsx(ne,{className:"bottom-button","data-cy":"retry-purchase-component",onClick:()=>{H({purchaseResultProps:{}})},children:d("common.retry")})}})},Mo=({downloadTokenList:E})=>{q.current.downloadTokenList=E,de(!1),fe()},Pt=({chooseParams:E=q.current,componentDid:N,isInit:G=!1})=>{var nt,zn,Vn,qn;const{meta:W,registryUrl:be,inStore:De,inputUrl:Ee}=E,{did:ye,title:je,name:qe}=W,_e=(((nt=B.settings)==null?void 0:nt.children)||[]).filter(ce=>ce.status==="deleted"&&ce.meta.bundleDid===ye),It=N||"",We=(zn=W.environments)==null?void 0:zn.map(ce=>{const{name:Ut,validation:ot,...st}=ce,Dt={validation:ls(ot)?"":ot};return{...st,key:Ut,...Dt}});q.current={...E,meta:{...W,configs:We,registryUrl:be,inStore:De,inputUrl:Ee}};let le={};if(G){const ce=[B],Ut=We||[],ot=[],st=jo(cs([...Ut,...ot]),"key").filter(Le=>!!Le.key).sort((Le,rt)=>Le.required&&!rt.required?-1:rt.required&&!Le.required?1:0),Dt=O.getSharedConfigObj(ce[0],{configs:st}),Bt={},_n=st.map(Le=>{const{default:rt,key:it,...Go}=Le;return Bt[it]=Dt[it]||rt,{...Go,key:it,hidden:!!X.BLOCKLET_CONFIGURABLE_KEY[it]}});le={...le,configsList:_n,configsValue:Bt,hasMissRequiredConfigs:ao(_n,Bt)}}const tt=B.children.some(ce=>ce.mountPoint==="/"),Be=_e.find(ce=>ce.meta.bundleDid===ye),Ne=B.children.find(ce=>ce.meta.bundleDid===ye);le.title=je||"",Be?le={...le,pathPrefix:Be.mountPoint||"",componentName:Be.meta.name,hasEnvironmentsStep:!1}:Ne?le={...le,pathPrefix:Ne.mountPoint||"",componentName:Ne.meta.name,hasEnvironmentsStep:!1}:le={...le,pathPrefix:tt?`/${ue(je)||ue(qe)}`.toLowerCase():"/",componentName:"",hasEnvironmentsStep:((qn=(Vn=q.current.meta)==null?void 0:Vn.environments)==null?void 0:qn.length)>0};const he=si(q.current.meta),Ae=ri(q.current.meta),kt=Ot(B);H({bundleDid:ye,componentDid:It,...le,hasRequiredEnvironments:ii(q.current.meta),requirePurchase:he,didSpaceIsRequiredSetup:Ae,didSpaceEndpoint:kt}),G&&he&&Lo()};f.useEffect(()=>{!l||me!==0||!B||(Pt({chooseParams:{blocklets:[l],meta:l,registryUrl:u||l.homepage,inStore:!0},isInit:!0}),H({showFromUrlDialog:!1}),fe())},[l,me,B]),pe.push({key:"selectComponent",name:d("blocklet.component.selectComponent"),body:e.jsxs(Te,{sx:{width:400},component:"div",children:[g&&P.showFromUrlDialog&&e.jsx(dr,{mode:"component",onCancel:()=>{H({showFromUrlDialog:!1})},onSuccess:({meta:E,inputUrl:N,inStore:G,registryUrl:W})=>{Pt({chooseParams:{meta:E,inputUrl:N,inStore:G,registryUrl:W},isInit:!0}),H({showFromUrlDialog:!1}),fe()},handleText:{title:d("blocklet.component.addComponentTip.fromUrl"),confirm:d("blocklet.component.choose")}}),e.jsx(hn,{stores:s,extra:To.isInServerlessMode(M)?null:g?e.jsxs(ne,{variant:"text",color:"primary","data-cy":"add-component-from-url",onClick:()=>{H({showFromUrlDialog:!0})},style:{padding:"0 2px"},children:[e.jsx(Qt,{style:{fontSize:20,marginRight:4}})," ",d("blocklet.component.addComponentTip.fromUrl")," "]}):null,loading:C,onChange:()=>{ke({}),q.current={}},storageKey:i,children:({currentRegistry:E})=>e.jsx(yn,{showResourcesSwitch:h,showCategory:S,serverVersion:M==null?void 0:M.version,style:oe?{height:"calc(100vh - 56px - 80px - 32px - 40px )"}:{height:"calc(100% - 40px)"},storeUrl:E.url,resourceType:a,resourceDid:n,handleButtonClick:N=>{Pt({chooseParams:{...N,inStore:!0},isInit:!0})},handleBlockletRender:({blocklet:N,defaultRender:G})=>{const W=(P==null?void 0:P.bundleDid)&&(P==null?void 0:P.bundleDid)===(N==null?void 0:N.did);return e.jsxs(ci,{children:[W&&e.jsx("div",{className:"check-container",children:e.jsx(fo,{className:"check-icon"})}),e.jsx("div",{className:W?"choose-blocklet":"",style:{marginLeft:16},children:G})]})}})})]}),cancel:o==="embed"?void 0:d("common.cancel"),confirm:ai({params:P,blocklet:B,t:d}),onCancel:wt,onConfirm:()=>{fe()}}),pe.push({key:"agreement",name:d("launchBlocklet.introduction"),body:e.jsxs(Te,{component:"div",className:"agreement-wrapper",children:[e.jsx(Co,{title:d("launchBlocklet.introduction"),subTitle:d("blocklet.component.addComponentTip.introduction")}),e.jsx(Ps,{meta:Y,onClickNext:fe,installRelated:se,onChangeInstallRelated:Ge,handleDescEle:e.jsx("p",{children:d("blocklet.component.addComponentTip.belowInformation")})})]}),cancel:l?void 0:d("common.pre"),confirm:d("launchBlocklet.next"),onCancel:l?wt:Ve,onConfirm:()=>{de(!1),fe()}}),Y&&P.requirePurchase&&pe.push({key:"purchase",name:e.jsxs(e.Fragment,{children:[d("common.verifyNFT"),e.jsx(ct,{})]}),body:e.jsxs(Te,{component:"div",className:"flex-align-center",style:{flexDirection:"column"},children:[!(((Fn=($e=_.current)==null?void 0:$e.getCurrentStep)==null?void 0:Fn.call($e))===2||te)&&e.jsx(lt,{title:d("common.verifyNFT"),subTitle:d("blocklet.component.addComponentTip.verifyNFT")}),He(P.purchaseResultProps)?Q&&e.jsx(zr,{ref:_,meta:Q.meta,mode:P.componentDid?"verify":"both",onCancel:Oo,installOpts:Q.installOpts,handlePaySuccess:Mo}):e.jsx("div",{className:"flex-align-center flex-justify-center",children:e.jsx(Zn,{...P.purchaseResultProps})})]}),disabled:((Gn=(et=_.current)==null?void 0:et.getCurrentStep)==null?void 0:Gn.call(et))===2||te,cancel:d("common.pre"),confirm:d("common.next"),onConfirm:()=>{typeof _.current.onNext=="function"&&(_.current.onNext(),de(!0))},onCancel:()=>{Ve()}}),O.hasStartEngine(Y)&&!Xe(Y.did)&&pe.push({key:"config",name:d("common.config"),error:v,body:e.jsxs(Te,{component:"div",children:[e.jsx(lt,{title:d("common.config"),subTitle:d("blocklet.component.addComponentTip.config")}),e.jsx(K,{label:d("blocklet.component.mountPoint"),autoComplete:"off",variant:"outlined",name:"pathPrefix",inputProps:{"data-cy":"mount-point-input"},fullWidth:!0,helperText:T||d("blocklet.component.mountPointTip"),style:{marginBottom:32},margin:"normal",value:P.pathPrefix,onChange:E=>{const N=E.target.value;H({pathPrefix:N}),I(d("common.slugifyHint",{value:gt(N)}))}}),!!v&&e.jsx(dt,{severity:"error",style:{width:"100%",marginTop:8},children:v})]}),cancel:d("common.pre"),confirm:d("common.next"),onCancel:Ve,onConfirm:()=>{fe()}}),Y&&!Xe(Y.did)&&(P!=null&&P.hasEnvironmentsStep)&&pe.push({key:"environment",name:e.jsxs(e.Fragment,{children:[d("common.environment")," ",P.hasRequiredEnvironments&&e.jsx(ct,{})]}),disabled:!!b||(P==null?void 0:P.hasMissRequiredConfigs),body:()=>e.jsxs(Te,{component:"div",children:[e.jsx(lt,{title:d("common.environment"),subTitle:d("blocklet.component.addComponentTip.environment")}),e.jsx(rn,{style:{marginTop:-12,width:"100%"},schema:P.configsList,defaultValue:P.configsValue,onChange:(E,{action:N,currentItem:G,allValues:W})=>{N==="confirm"&&H({hasMissRequiredConfigs:ao(P.configsList,W),configsValue:W}),N==="edit"?c(G):["cancel","confirm"].includes(N)&&c(null)}})]}),cancel:d("common.pre"),confirm:d("common.next"),onCancel:Ve,onConfirm:fe}),Y&&!Xe(Y.did)&&(P!=null&&P.didSpaceIsRequiredSetup)&&pe.push({key:"didSpace",name:e.jsxs(e.Fragment,{children:[d("blocklet.component.didSpaceConfig")," ",P.didSpaceIsRequiredSetup==="required"&&e.jsx(ct,{})]}),disabled:(P==null?void 0:P.didSpaceIsRequiredSetup)&&!P.didSpaceEndpoint,body:()=>e.jsx($t,{children:e.jsxs(Te,{component:"div",children:[e.jsx(lt,{title:d("blocklet.component.didSpaceConfig"),subTitle:d("blocklet.component.didSpaceConfigTip")}),e.jsx(y,{sx:{mt:"36px","& > div":{maxWidth:"unset !important","& .MuiAutocomplete-root":{maxWidth:"unset !important"}}},children:e.jsx(fn,{blockletMeta:q.current.meta,onNext:()=>{fe()},onEndpointUpdate:Re})})]})}),cancel:d("common.pre"),confirm:d("common.next"),onCancel:Ve,onConfirm:fe}),pe.push({key:"install",name:Xe(Y==null?void 0:Y.did)?d("common.upgrade"):d("common.install"),disabled:p?!1:He(P.installResultProps),loading:p?!1:He(P.installResultProps),body:e.jsx(Te,{component:"div",className:"flex-justify-center flex-align-center",style:{flexDirection:"column"},children:He(P.installResultProps)?e.jsx(Xs,{message:e.jsx(di,{children:d(p?"blocklet.component.installingCanCloseWindowTip":"blocklet.component.installingTip")}),increaseSpeed:.3,messageLoop:!1}):e.jsx("div",{style:{marginTop:120},children:e.jsx(Zn,{...P.installResultProps})})}),confirm:d("common.complete"),onConfirm:()=>{lo({timeout:0,componentDid:xe.componentDid,manual:!0}),wt(),setTimeout(()=>{const E=document.getElementsByClassName("dashboard-main")[0];E&&(E.scrollTop=E.scrollHeight)},200)}});const ae=pe[me]||{},Fo=()=>C||ae.error||!P.bundleDid?!0:me>1?!P.pathPrefix:!1;return B?e.jsxs(li,{sx:{width:"100%",height:oe?window.innerHeight:m?"72vh":"100vh"},children:[e.jsx($s,{steps:pe,mode:"memory",children:e.jsx(oi,{ref:w,meta:Y,isMobile:oe,onStepChange:E=>{Ze(E)}})}),e.jsxs(y,{className:"action-bar",children:[ae.cancel&&e.jsx(ne,{onClick:E=>{E.stopPropagation(),ae.onCancel()},disabled:me===pe.length-2&&C,color:"inherit",children:ae.cancel||d("common.cancel")}),ae.confirm&&e.jsx(ne,{onClick:E=>{E.stopPropagation(),ae.onConfirm()},color:"primary","data-cy":"submit-confirm-next",disabled:C||(typeof ae.disabled=="boolean"?ae.disabled:Fo()),variant:"contained",autoFocus:!0,title:ae.confirm,style:{marginLeft:8,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",minWidth:"140px",maxWidth:"280px",textAlign:"center"},children:e.jsxs(y,{display:"flex",alignItems:"center",children:[(typeof ae.loading=="boolean"?ae.loading:C)&&e.jsx(re,{style:{marginRight:8},size:16}),ae.confirm]})})]})]}):null}jn.propTypes={onClose:r.func,mode:r.oneOf(["normal","embed"]),inDialog:r.bool,stores:r.arrayOf(r.string),storeUrl:r.string,resourceType:r.string,resourceDid:r.string,storageKey:r.string,selectedMeta:r.object,showResourcesSwitch:r.bool,showFromUrl:r.bool,enableRunBackground:r.bool,showCategory:r.bool};jn.defaultProps={onClose:()=>{},mode:"normal",stores:[],storeUrl:"",resourceType:"",resourceDid:"",storageKey:"",inDialog:!0,selectedMeta:null,showResourcesSwitch:!0,showFromUrl:!0,enableRunBackground:!0,showCategory:!0};const li=F(y)`
322
+ `,oi=Cn,si=t=>t.inStore&&O.isFreeBlocklet(t)===!1,ri=t=>{var o;return[X.BLOCKLET_APP_SPACE_REQUIREMENT.REQUIRED,X.BLOCKLET_APP_SPACE_REQUIREMENT.REQUIRED_ON_SETUP].includes((o=t==null?void 0:t.capabilities)==null?void 0:o.didSpace)},Ot=t=>{var o,s;return((s=(o=t==null?void 0:t.configs)==null?void 0:o.find(a=>a.key===X.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_SPACE_ENDPOINT))==null?void 0:s.value)||null},ii=t=>(t.environments||[]).some(o=>o.required),ao=(t,o)=>t==null?void 0:t.some(s=>s.required&&!o[s.key]),ai=({params:t,blocklet:o,t:s})=>{const a=t.title||t.name;return a?((o==null?void 0:o.children)||[]).find(i=>i.meta.bundleDid===t.bundleDid)?s("blocklet.component.upgradeNext",{name:a}):s("blocklet.component.addNext",{name:a}):s("common.next")},lo=({componentDid:t,timeout:o=1e3,manual:s=!1}={})=>{setTimeout(()=>{window.parent.postMessage({event:"component.installed",componentDid:t,manual:s},"*")},o)};function jn({onClose:t,mode:o,stores:s,resourceType:a,resourceDid:n,storageKey:i,inDialog:m,selectedMeta:l,storeUrl:u,showResourcesSwitch:h,showFromUrl:g,enableRunBackground:p,showCategory:S}){var Ln,On,Mn,$e,Fn,et,Gn;const{t:d,locale:b}=z(),[C,x]=f.useState(!1),[R,c]=f.useState(null),[v,j]=f.useState(""),[T,I]=f.useState(""),{api:U,ws:{useSubscription:L},inService:k,info:M}=J(),{blocklet:B,actions:{refreshBlocklet:q}}=ie(),[Q,Ie]=f.useState(null),[te,de]=f.useState(!1),Se={bundleDid:"",componentDid:"",componentName:"",pathPrefix:"",name:"",title:"",configsList:[],configsValue:{},hasMissRequiredConfigs:!1,hasEnvironmentsStep:!1,hasRequiredEnvironments:!1,requirePurchase:!1,didSpaceIsRequiredSetup:null,installResultProps:{},purchaseResultProps:{},showFromUrlDialog:!1},[P,ke]=f.useState(Se),[me,Ze]=f.useState(0),V=f.useRef({}),w=f.useRef({}),_=f.useRef({}),oe=Wt(E=>E.breakpoints.down("md")),xe=as(),[se,Ge]=f.useState(!0),{meta:Y}=V.current,H=E=>ke(N=>({...N,...E}));f.useEffect(()=>{if(P.pathPrefix){const{errMsg:E}=An({...P,pathPrefix:P.pathPrefix,locale:b});j(E)}},[P.pathPrefix]),f.useEffect(()=>{me===0&&ke(Se)},[me]);const be=()=>{const E=Ot(B)??"";H({didSpaceEndpoint:E})},ze=()=>{var E;return(E=V==null?void 0:V.current)!=null&&E.meta?O.getDisplayName(V.current):""},Ue=E=>{const N=G=>{H({installResultProps:{variant:"error",title:ze(),subTitle:E,footer:e.jsx(ne,{className:"bottom-button",disabled:G,"data-cy":"retry-install-component",onClick:async()=>{N(!0),await Nn(V.current.installInput)},children:e.jsxs(y,{display:"flex",alignItems:"center",children:[G&&e.jsx(re,{size:16,style:{marginRight:8}}),d("common.retry")]})})}})};N()},Tt=E=>N=>{var G,W;(((G=N==null?void 0:N.meta)==null?void 0:G.did)||(N==null?void 0:N.meta))===((W=B==null?void 0:B.meta)==null?void 0:W.did)&&E(N)};L(X.BlockletEvents.statusChange,Tt(E=>{switch(E.status){case X.BlockletStatus.upgrading:H({installResultProps:{variant:"success",title:ze(),subTitle:d("blocklet.component.installSuccessTip")}}),lo({componentDid:xe.componentDid});break}const N=Ot(B);H(G=>({...G,didSpaceEndpoint:N}))}),[(Ln=B==null?void 0:B.meta)==null?void 0:Ln.did]),L(X.BlockletEvents.downloadFailed,Tt(()=>{Ue(d("blocklet.component.installComponentError"))}),[(On=B==null?void 0:B.meta)==null?void 0:On.did]),L(X.BlockletEvents.installFailed,Tt(()=>{Ue(d("blocklet.component.installComponentError"))}),[(Mn=B==null?void 0:B.meta)==null?void 0:Mn.did]);const pe=[],wt=()=>{x(!1),ke({}),V.current={},t()},Xe=E=>((B==null?void 0:B.children)||[]).some(N=>N.meta.did===E),Nn=async E=>{var Be,Ne;const{pathPrefix:N,bundleDid:G,title:W,componentName:Re="",componentDid:De=""}=P,Ee=((Be=V.current)==null?void 0:Be.meta)||{},{configs:ye=[],registryUrl:je,inStore:Ve,inputUrl:_e,dist:It}=Ee,We=(Ne=V.current)==null?void 0:Ne.downloadTokenList,le=Ve?Hn(je,G,It):_e;x(!0);const tt={rootDid:B.meta.did,url:le,mountPoint:N?ue(N):`/${ue(Ee.title||Ee.name)}`,title:W,name:Re,did:De,onlyRequired:!se,...P.hasEnvironmentsStep&&ye.length>0?{configs:ye.map(he=>({...he,value:P.configsValue[he.key]||""}))}:{},...We?{downloadTokenList:We}:{},...E};try{if(await U.installComponent({input:tt}),je){const{teamDid:he,storeList:Ae}=ho({fromBlocklet:k,nodeInfo:M,blocklet:B}),{isNew:kt,decoded:nt}=ds(je,Ae);kt&&await U.addBlockletStore({input:{teamDid:he,url:nt}})}H({installResultProps:{}}),q({showError:!1,attachRuntimeInfo:!1})}catch(he){const Ae=Z(he);A.error(Ae),console.error("installComponent error: ",he),Ue(Ae)}finally{x(!1),V.current.installInput=tt}},An=E=>({errMsg:vo({params:{...E,did:E.bundleDid},blocklets:[B],blocklet:B,locale:b})}),fe=async E=>{var G,W;const{errMsg:N}=An({...P,locale:b});j(N),me===pe.length-2&&await Nn(E),(W=(G=w.current)==null?void 0:G.setActiveStepByIndex)==null||W.call(G,Re=>Re+1)},qe=()=>{var E,N;(N=(E=w.current)==null?void 0:E.setActiveStepByIndex)==null||N.call(E,G=>G-1)},Lo=()=>{const{pathPrefix:E,bundleDid:N,title:G,componentName:W="",componentDid:Re=""}=P,{meta:De={}}=V.current||{},{registryUrl:Ee,inStore:ye,inputUrl:je,dist:Ve}=De,_e=ye?Hn(Ee,N,Ve):je;Ie({meta:De,installOpts:{type:"component",rootDid:B.meta.did,mountPoint:E,url:_e,title:G,name:W,did:Re}})},Oo=E=>{de(!1),H({purchaseResultProps:{variant:"error",title:ze(),subTitle:E,style:{paddingTop:120},footer:e.jsx(ne,{className:"bottom-button","data-cy":"retry-purchase-component",onClick:()=>{H({purchaseResultProps:{}})},children:d("common.retry")})}})},Mo=({downloadTokenList:E})=>{V.current.downloadTokenList=E,de(!1),fe()},Pt=({chooseParams:E=V.current,componentDid:N,isInit:G=!1})=>{var nt,zn,qn,Vn;const{meta:W,registryUrl:Re,inStore:De,inputUrl:Ee}=E,{did:ye,title:je,name:Ve}=W,_e=(((nt=B.settings)==null?void 0:nt.children)||[]).filter(ce=>ce.status==="deleted"&&ce.meta.bundleDid===ye),It=N||"",We=(zn=W.environments)==null?void 0:zn.map(ce=>{const{name:Ut,validation:ot,...st}=ce,Dt={validation:ls(ot)?"":ot};return{...st,key:Ut,...Dt}});V.current={...E,meta:{...W,configs:We,registryUrl:Re,inStore:De,inputUrl:Ee}};let le={};if(G){const ce=[B],Ut=We||[],ot=[],st=jo(cs([...Ut,...ot]),"key").filter(Le=>!!Le.key).sort((Le,rt)=>Le.required&&!rt.required?-1:rt.required&&!Le.required?1:0),Dt=O.getSharedConfigObj(ce[0],{configs:st}),Bt={},_n=st.map(Le=>{const{default:rt,key:it,...Go}=Le;return Bt[it]=Dt[it]||rt,{...Go,key:it,hidden:!!X.BLOCKLET_CONFIGURABLE_KEY[it]}});le={...le,configsList:_n,configsValue:Bt,hasMissRequiredConfigs:ao(_n,Bt)}}const tt=B.children.some(ce=>ce.mountPoint==="/"),Be=_e.find(ce=>ce.meta.bundleDid===ye),Ne=B.children.find(ce=>ce.meta.bundleDid===ye);le.title=je||"",Be?le={...le,pathPrefix:Be.mountPoint||"",componentName:Be.meta.name,hasEnvironmentsStep:!1}:Ne?le={...le,pathPrefix:Ne.mountPoint||"",componentName:Ne.meta.name,hasEnvironmentsStep:!1}:le={...le,pathPrefix:tt?`/${ue(je)||ue(Ve)}`.toLowerCase():"/",componentName:"",hasEnvironmentsStep:((Vn=(qn=V.current.meta)==null?void 0:qn.environments)==null?void 0:Vn.length)>0};const he=si(V.current.meta),Ae=ri(V.current.meta),kt=Ot(B);H({bundleDid:ye,componentDid:It,...le,hasRequiredEnvironments:ii(V.current.meta),requirePurchase:he,didSpaceIsRequiredSetup:Ae,didSpaceEndpoint:kt}),G&&he&&Lo()};f.useEffect(()=>{!l||me!==0||!B||(Pt({chooseParams:{blocklets:[l],meta:l,registryUrl:u||l.homepage,inStore:!0},isInit:!0}),H({showFromUrlDialog:!1}),fe())},[l,me,B]),pe.push({key:"selectComponent",name:d("blocklet.component.selectComponent"),body:e.jsxs(Te,{sx:{width:400},component:"div",children:[g&&P.showFromUrlDialog&&e.jsx(dr,{mode:"component",onCancel:()=>{H({showFromUrlDialog:!1})},onSuccess:({meta:E,inputUrl:N,inStore:G,registryUrl:W})=>{Pt({chooseParams:{meta:E,inputUrl:N,inStore:G,registryUrl:W},isInit:!0}),H({showFromUrlDialog:!1}),fe()},handleText:{title:d("blocklet.component.addComponentTip.fromUrl"),confirm:d("blocklet.component.choose")}}),e.jsx(hn,{stores:s,extra:To.isInServerlessMode(M)?null:g?e.jsxs(ne,{variant:"text",color:"primary","data-cy":"add-component-from-url",onClick:()=>{H({showFromUrlDialog:!0})},style:{padding:"0 2px"},children:[e.jsx(Qt,{style:{fontSize:20,marginRight:4}})," ",d("blocklet.component.addComponentTip.fromUrl")," "]}):null,loading:C,onChange:()=>{ke({}),V.current={}},storageKey:i,children:({currentRegistry:E})=>e.jsx(yn,{showResourcesSwitch:h,showCategory:S,serverVersion:M==null?void 0:M.version,style:oe?{height:"calc(100vh - 56px - 80px - 32px - 40px )"}:{height:"calc(100% - 40px)"},storeUrl:E.url,resourceType:a,resourceDid:n,handleButtonClick:N=>{Pt({chooseParams:{...N,inStore:!0},isInit:!0})},handleBlockletRender:({blocklet:N,defaultRender:G})=>{const W=(P==null?void 0:P.bundleDid)&&(P==null?void 0:P.bundleDid)===(N==null?void 0:N.did);return e.jsxs(ci,{children:[W&&e.jsx("div",{className:"check-container",children:e.jsx(fo,{className:"check-icon"})}),e.jsx("div",{className:W?"choose-blocklet":"",style:{marginLeft:16},children:G})]})}})})]}),cancel:o==="embed"?void 0:d("common.cancel"),confirm:ai({params:P,blocklet:B,t:d}),onCancel:wt,onConfirm:()=>{fe()}}),pe.push({key:"agreement",name:d("launchBlocklet.introduction"),body:e.jsxs(Te,{component:"div",className:"agreement-wrapper",children:[e.jsx(Co,{title:d("launchBlocklet.introduction"),subTitle:d("blocklet.component.addComponentTip.introduction")}),e.jsx(Ps,{meta:Y,onClickNext:fe,installRelated:se,onChangeInstallRelated:Ge,handleDescEle:e.jsx("p",{children:d("blocklet.component.addComponentTip.belowInformation")})})]}),cancel:l?void 0:d("common.pre"),confirm:d("launchBlocklet.next"),onCancel:l?wt:qe,onConfirm:()=>{de(!1),fe()}}),Y&&P.requirePurchase&&pe.push({key:"purchase",name:e.jsxs(e.Fragment,{children:[d("common.verifyNFT"),e.jsx(ct,{})]}),body:e.jsxs(Te,{component:"div",className:"flex-align-center",style:{flexDirection:"column"},children:[!(((Fn=($e=_.current)==null?void 0:$e.getCurrentStep)==null?void 0:Fn.call($e))===2||te)&&e.jsx(lt,{title:d("common.verifyNFT"),subTitle:d("blocklet.component.addComponentTip.verifyNFT")}),He(P.purchaseResultProps)?Q&&e.jsx(zr,{ref:_,meta:Q.meta,mode:P.componentDid?"verify":"both",onCancel:Oo,installOpts:Q.installOpts,handlePaySuccess:Mo}):e.jsx("div",{className:"flex-align-center flex-justify-center",children:e.jsx(Zn,{...P.purchaseResultProps})})]}),disabled:((Gn=(et=_.current)==null?void 0:et.getCurrentStep)==null?void 0:Gn.call(et))===2||te,cancel:d("common.pre"),confirm:d("common.next"),onConfirm:()=>{typeof _.current.onNext=="function"&&(_.current.onNext(),de(!0))},onCancel:()=>{qe()}}),O.hasStartEngine(Y)&&!Xe(Y.did)&&pe.push({key:"config",name:d("common.config"),error:v,body:e.jsxs(Te,{component:"div",children:[e.jsx(lt,{title:d("common.config"),subTitle:d("blocklet.component.addComponentTip.config")}),e.jsx(K,{label:d("blocklet.component.mountPoint"),autoComplete:"off",variant:"outlined",name:"pathPrefix",inputProps:{"data-cy":"mount-point-input"},fullWidth:!0,helperText:T||d("blocklet.component.mountPointTip"),style:{marginBottom:32},margin:"normal",value:P.pathPrefix,onChange:E=>{const N=E.target.value;H({pathPrefix:N}),I(d("common.slugifyHint",{value:gt(N)}))}}),!!v&&e.jsx(dt,{severity:"error",style:{width:"100%",marginTop:8},children:v})]}),cancel:d("common.pre"),confirm:d("common.next"),onCancel:qe,onConfirm:()=>{fe()}}),Y&&!Xe(Y.did)&&(P!=null&&P.hasEnvironmentsStep)&&pe.push({key:"environment",name:e.jsxs(e.Fragment,{children:[d("common.environment")," ",P.hasRequiredEnvironments&&e.jsx(ct,{})]}),disabled:!!R||(P==null?void 0:P.hasMissRequiredConfigs),body:()=>e.jsxs(Te,{component:"div",children:[e.jsx(lt,{title:d("common.environment"),subTitle:d("blocklet.component.addComponentTip.environment")}),e.jsx(rn,{style:{marginTop:-12,width:"100%"},schema:P.configsList,defaultValue:P.configsValue,onChange:(E,{action:N,currentItem:G,allValues:W})=>{N==="confirm"&&H({hasMissRequiredConfigs:ao(P.configsList,W),configsValue:W}),N==="edit"?c(G):["cancel","confirm"].includes(N)&&c(null)}})]}),cancel:d("common.pre"),confirm:d("common.next"),onCancel:qe,onConfirm:fe}),Y&&!Xe(Y.did)&&(P!=null&&P.didSpaceIsRequiredSetup)&&pe.push({key:"didSpace",name:e.jsxs(e.Fragment,{children:[d("blocklet.component.didSpaceConfig")," ",P.didSpaceIsRequiredSetup==="required"&&e.jsx(ct,{})]}),disabled:(P==null?void 0:P.didSpaceIsRequiredSetup)&&!P.didSpaceEndpoint,body:()=>e.jsx($t,{children:e.jsxs(Te,{component:"div",children:[e.jsx(lt,{title:d("blocklet.component.didSpaceConfig"),subTitle:d("blocklet.component.didSpaceConfigTip")}),e.jsx(y,{sx:{mt:"36px","& > div":{maxWidth:"unset !important","& .MuiAutocomplete-root":{maxWidth:"unset !important"}}},children:e.jsx(fn,{blockletMeta:V.current.meta,onNext:()=>{fe()},onEndpointUpdate:be})})]})}),cancel:d("common.pre"),confirm:d("common.next"),onCancel:qe,onConfirm:fe}),pe.push({key:"install",name:Xe(Y==null?void 0:Y.did)?d("common.upgrade"):d("common.install"),disabled:p?!1:He(P.installResultProps),loading:p?!1:He(P.installResultProps),body:e.jsx(Te,{component:"div",className:"flex-justify-center flex-align-center",style:{flexDirection:"column"},children:He(P.installResultProps)?e.jsx(Xs,{message:e.jsx(di,{children:d(p?"blocklet.component.installingCanCloseWindowTip":"blocklet.component.installingTip")}),increaseSpeed:.3,messageLoop:!1}):e.jsx("div",{style:{marginTop:120},children:e.jsx(Zn,{...P.installResultProps})})}),confirm:d("common.complete"),onConfirm:()=>{lo({timeout:0,componentDid:xe.componentDid,manual:!0}),wt(),setTimeout(()=>{const E=document.getElementsByClassName("dashboard-main")[0];E&&(E.scrollTop=E.scrollHeight)},200)}});const ae=pe[me]||{},Fo=()=>C||ae.error||!P.bundleDid?!0:me>1?!P.pathPrefix:!1;return B?e.jsxs(li,{sx:{width:"100%",height:oe?window.innerHeight:m?"72vh":"100vh"},children:[e.jsx($s,{steps:pe,mode:"memory",children:e.jsx(oi,{ref:w,meta:Y,isMobile:oe,onStepChange:E=>{Ze(E)}})}),e.jsxs(y,{className:"action-bar",children:[ae.cancel&&e.jsx(ne,{onClick:E=>{E.stopPropagation(),ae.onCancel()},disabled:me===pe.length-2&&C,color:"inherit",children:ae.cancel||d("common.cancel")}),ae.confirm&&e.jsx(ne,{onClick:E=>{E.stopPropagation(),ae.onConfirm()},color:"primary","data-cy":"submit-confirm-next",disabled:C||(typeof ae.disabled=="boolean"?ae.disabled:Fo()),variant:"contained",autoFocus:!0,title:ae.confirm,style:{marginLeft:8,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",minWidth:"140px",maxWidth:"280px",textAlign:"center"},children:e.jsxs(y,{display:"flex",alignItems:"center",children:[(typeof ae.loading=="boolean"?ae.loading:C)&&e.jsx(re,{style:{marginRight:8},size:16}),ae.confirm]})})]})]}):null}jn.propTypes={onClose:r.func,mode:r.oneOf(["normal","embed"]),inDialog:r.bool,stores:r.arrayOf(r.string),storeUrl:r.string,resourceType:r.string,resourceDid:r.string,storageKey:r.string,selectedMeta:r.object,showResourcesSwitch:r.bool,showFromUrl:r.bool,enableRunBackground:r.bool,showCategory:r.bool};jn.defaultProps={onClose:()=>{},mode:"normal",stores:[],storeUrl:"",resourceType:"",resourceDid:"",storageKey:"",inDialog:!0,selectedMeta:null,showResourcesSwitch:!0,showFromUrl:!0,enableRunBackground:!0,showCategory:!0};const li=F(y)`
323
323
  .action-bar {
324
324
  display: flex;
325
325
  justify-content: flex-end;
@@ -391,15 +391,15 @@ import{bK as zo,j as e,aK as qt,aL as _t,q as z,O as y,ax as ve,P as r,A,bk as J
391
391
  `;function St({blocklet:t,showDialog:o,setShowDialog:s,selectedMeta:a}){const{t:n}=z(),i=Wt(u=>u.breakpoints.down("md")),{inService:m}=J(),l=()=>{s(!1)};return o?e.jsx(pi,{title:n("blocklet.component.addWithName",{name:O.getDisplayName(t)}),maxWidth:!1,fullWidth:!1,PaperProps:{style:i?{width:"100%",height:window.innerHeight}:{maxWidth:1350,minWidth:930,width:"80%"}},onClose:(u,h)=>{h!=="backdropClick"&&l()},showCloseButton:!0,disableEscapeKeyDown:!0,open:!0,children:e.jsx(jn,{selectedMeta:a,onClose:l,storageKey:m?Js:Ks})}):null}St.propTypes={selectedMeta:r.object,showDialog:r.bool.isRequired,setShowDialog:r.func.isRequired,blocklet:r.object.isRequired};St.defaultProps={selectedMeta:null};const pi=F(xt)`
392
392
  .MuiDialogContent-root {
393
393
  }
394
- `;function vn({blocklet:t,children:o}){const{t:s}=z(),[a,n]=f.useState(!1),i=m=>{m.stopPropagation(),n(!0)};return e.jsxs(e.Fragment,{children:[typeof o=="function"?o({open:i}):e.jsxs(ge,{onClick:i,className:"component-action","data-cy":"action-add-component",children:[e.jsx(Qt,{style:{fontSize:18,marginRight:5}}),s("blocklet.component.add")]}),e.jsx(St,{showDialog:a,setShowDialog:n,blocklet:t})]})}vn.propTypes={children:r.any,blocklet:r.object.isRequired};vn.defaultProps={children:null};const ui=t=>t.children.filter(o=>o.meta.interfaces.find(s=>s.type===X.BLOCKLET_INTERFACE_TYPE_WEB));function Rt({params:t,setParams:o,setError:s,serviceTypes:a}){const{t:n}=z(),{blocklet:i}=ie(),m=i.meta.did,l=ui(i),[u,h]=f.useState([]),g={301:n("common.redirectPermanently"),302:n("common.redirectTemporary"),307:n("common.redirectTemporary"),308:n("common.redirectPermanently")};return f.useEffect(()=>{if(t.type===D.ROUTING_RULE_TYPES.COMPONENT&&t.componentId){const p=l.find(R=>R.meta.did===t.componentId),S=O.findWebInterface(p.meta),d=(Array.isArray(S==null?void 0:S.pageGroups)?S.pageGroups:[]).map(R=>({value:R,label:`${R} pages`}));d.length&&d.unshift({value:"",label:"All pages"}),h(d),t.pageGroup&&d.find(R=>R.value===t.pageGroup)===!1&&o({...t,pageGroups:""})}},[t.componentId,t.type]),e.jsxs(e.Fragment,{children:[e.jsx(K,{select:!0,label:n("router.domain.add.type"),autoComplete:"off",variant:"outlined",name:"type","data-cy":"domain-add-type",fullWidth:!0,value:t.type,onChange:p=>{s(""),o({...t,type:p.target.value,did:p.target.value===D.ROUTING_RULE_TYPES.BLOCKLET?m:"",__disableConfirm:!1})},style:{marginBottom:32},SelectProps:{},children:a.map(({name:p,value:S})=>e.jsx(ge,{value:S,children:p},S))}),t.type===D.ROUTING_RULE_TYPES.REDIRECT&&[e.jsx(K,{select:!0,label:n("router.domain.add.redirect"),autoComplete:"off",variant:"outlined",name:"type",fullWidth:!0,value:t.redirectCode,onChange:p=>o({...t,redirectCode:p.target.value}),style:{marginBottom:32},SelectProps:{},children:Object.keys(g).map(p=>e.jsx(ge,{value:p,children:`${g[p]} - ${p}`},p))},"redirectCode"),e.jsx(K,{label:n("common.redirectUrl"),autoComplete:"off",variant:"outlined",name:"url",inputProps:{"data-cy":"redirect-url-input"},fullWidth:!0,value:t.url,helperText:n("router.urlHelperText"),style:{marginBottom:32},onChange:p=>{o({...t,url:p.target.value,__disableConfirm:!p.target.value.trim()}),p.target.value.trim()?s(""):s(n("router.validation.redirectUrlRequired"))}},"redirectUrl")],t.type===D.ROUTING_RULE_TYPES.COMPONENT&&[e.jsx(K,{select:!0,label:n("router.domain.add.component"),autoComplete:"off",variant:"outlined","data-cy":"select-component-input",name:"componentId",fullWidth:!0,value:t.componentId,onChange:p=>{o({...t,componentId:p.target.value})},style:{marginBottom:32},SelectProps:{},children:l.map(p=>e.jsx(ge,{value:p.meta.did,selected:p.meta.did===t.componentId,children:O.getDisplayName(p,!0)},p.meta.did))},"componentId"),u.length?e.jsx(K,{select:!0,label:n("router.domain.add.pageGroup"),autoComplete:"off",variant:"outlined",name:"pageGroup","data-cy":"route-group-input",fullWidth:!0,value:t.pageGroup,helperText:n("router.domain.add.pageGroupTip"),style:{marginBottom:32},onChange:p=>{o({...t,pageGroup:p.target.value})},SelectProps:{},children:u.map(p=>e.jsx(ge,{value:p.value,selected:p.value===t.pageGroup,children:p.label},p.label))},"pageGroup"):null].filter(Boolean),t.type===D.ROUTING_RULE_TYPES.GENERAL_REWRITE&&e.jsx(K,{label:n("common.rewriteUrl"),autoComplete:"off",variant:"outlined",name:"url","data-cy":"rewrite-url-input",fullWidth:!0,value:t.url,helperText:n("router.urlHelperText"),style:{marginBottom:32},onChange:p=>{const S=p.target.value.trim();o({...t,url:p.target.value,__disableConfirm:!S}),s(S?"":n("router.validation.rewriteUrlRequired"))}},"url"),t.type===D.ROUTING_RULE_TYPES.DIRECT_RESPONSE&&[e.jsx(K,{select:!0,label:n("router.rule.add.responseType"),autoComplete:"off",variant:"outlined",name:"responseType",fullWidth:!0,value:t.responseType,onChange:p=>o({...t,responseType:p.target.value}),style:{marginBottom:32},SelectProps:{},children:D.ROUTING_RESPONSE_TYPES.map(p=>e.jsx(ge,{value:p.value,children:p.text},p.value))},"responseType"),e.jsx(K,{label:n("router.rule.add.responseBody"),autoComplete:"off",variant:"outlined",name:"responseBody","data-cy":"response-body-input",fullWidth:!0,multiline:!0,minRows:3,value:t.responseBody,helperText:n("router.rule.add.responseBodyTip"),style:{marginBottom:32},onChange:p=>{const S=p.target.value.trim();o({...t,responseBody:p.target.value,__disableConfirm:!S}),s(S?"":n("router.rule.add.responseBodyRequired"))}},"response-body")]]})}Rt.propTypes={params:r.object,serviceTypes:r.array,setParams:r.func,setError:r.func};Rt.defaultProps={params:{},serviceTypes:[{name:"Redirect",value:D.ROUTING_RULE_TYPES.REDIRECT},{name:"Default - User will see the 404 page",value:D.ROUTING_RULE_TYPES.NONE},{name:"Rewrite - Route traffic without redirect",value:D.ROUTING_RULE_TYPES.GENERAL_REWRITE},{name:"Response - Response with provided content",value:D.ROUTING_RULE_TYPES.DIRECT_RESPONSE},{name:"Component - Pass traffic to blocklet component",value:D.ROUTING_RULE_TYPES.COMPONENT}],setParams:()=>{},setError:()=>{}};function Sn({children:t,hiddenChildren:o,open:s,onClose:a}){const{t:n}=z(),{api:i}=J(),{blocklet:m}=ie(),[l,u]=f.useState(!1),[h,g]=f.useState(!1),p=m.meta.did,S=m.site.id,d=()=>{a==null||a(),u(!1),g(!1)},R=async c=>{try{const v=await ut(c,n);if(v)throw v;u(!0);const j={from:{pathPrefix:ue(c.pathPrefix)},to:{type:c.type}};c.type===D.ROUTING_RULE_TYPES.REDIRECT&&(j.to.url=c.url.trim(),j.to.redirectCode=c.redirectCode),c.type===D.ROUTING_RULE_TYPES.COMPONENT&&(j.to.did=p,j.to.componentId=c.componentId,j.to.pageGroup=c.pageGroup),c.type===D.ROUTING_RULE_TYPES.GENERAL_REWRITE&&(j.to.url=ue(c.url)),c.type===D.ROUTING_RULE_TYPES.DIRECT_RESPONSE&&(j.to.response={status:200,contentType:c.responseType,body:c.responseBody}),await i.addRoutingRule({input:{id:S,rule:j,teamDid:p}})}catch(v){A.error(v.message)}finally{u(!1),g(!1)}},C={title:n("router.rule.add.title"),description:(c,v,j)=>{const T=I=>{if(j(null),ut(I,n)){v({...I,__disableConfirm:!0});return}v({...I})};return e.jsxs(ee,{component:"div",children:[e.jsx(K,{label:n("router.rule.add.pathPrefix"),autoComplete:"off",variant:"outlined",name:"pathPrefix",inputProps:{"data-cy":"path-prefix-input"},fullWidth:!0,autoFocus:!0,helperText:c.pathPrefixHint||n("router.rule.add.pathPrefixTip"),style:{marginBottom:32},margin:"dense",value:c.pathPrefix,onChange:I=>{let U=!1;const L=vo({params:{...c,pathPrefix:I.target.value},blocklets:[m]});j(L),c.type===D.ROUTING_RULE_TYPES.BLOCKLET&&L&&(U=!0),c.type===D.ROUTING_RULE_TYPES.REDIRECT&&!c.url&&(U=!0),c.type===D.ROUTING_RULE_TYPES.GENERAL_REWRITE&&!c.url&&(U=!0),c.type===D.ROUTING_RULE_TYPES.DIRECT_RESPONSE&&(!c.responseType||!c.responseBody)&&(U=!0),I.target.value.trim()||(U=!0,j(n("router.validation.pathPrefixRequired"))),U||j("");const k=n("common.slugifyHint",{value:gt(I.target.value)});v({...c,pathPrefix:I.target.value,pathPrefixHint:k,__disableConfirm:U})}}),e.jsx(Rt,{params:c,setParams:T,setError:j})]})},confirm:n("router.rule.add.confirm"),cancel:n("common.cancel"),params:{did:"",pathPrefix:"",type:D.ROUTING_RULE_TYPES.REDIRECT,componentId:"",pageGroup:"",redirectCode:302,responseType:"text/plain",responseBody:"",__disableConfirm:!0},onConfirm:R,onCancel:d},x=c=>{c.stopPropagation(),g(!0)};let b=null;return o||(b=typeof t=="function"?t({open:x}):e.jsxs(ge,{onClick:x,className:"rule-action","data-cy":"action-add-rule",children:[l?e.jsx(re,{size:16}):e.jsx(Qt,{style:{fontSize:18,marginRight:5}}),n("router.rule.add.title")]})),e.jsxs(e.Fragment,{children:[b,(s||h)&&e.jsx(Fe,{title:C.title,description:C.description,confirm:C.confirm,cancel:C.cancel,params:C.params,onConfirm:C.onConfirm,onCancel:C.onCancel,color:"primary"})]})}Sn.propTypes={children:r.any,onClose:r.func,hiddenChildren:r.bool,open:r.bool};Sn.defaultProps={children:null,open:!1,onClose:null,hiddenChildren:!1};function Rn({id:t,from:o,children:s}){const{t:a}=z(),{api:n}=J(),{blocklet:i}=ie(),[m,l]=f.useState(!1),[u,h]=f.useState(null),g=i.meta.did,p=i.site.id,S=o.pathPrefix,d=()=>{l(!1),h(null)},R=async()=>{l(!0);try{await n.deleteRoutingRule({input:{id:p,ruleId:t,teamDid:g}})}catch(b){A.error(b.message)}finally{h(null),l(!1)}},C={keyName:S,title:a("router.rule.delete.title"),description:a("router.rule.delete.description",{name:`<b>${S}</b>`}),confirmPlaceholder:a("router.rule.delete.confirm_desc",{name:S}),confirm:a("common.delConfirm"),cancel:a("router.rule.delete.cancel"),onConfirm:R,onCancel:d},x=b=>{b.stopPropagation(),h(C)};return e.jsxs(e.Fragment,{children:[typeof s=="function"?s({loading:m,open:x}):e.jsxs(ge,{onClick:x,className:"rule-action","data-cy":"action-delete-rule",children:[m?e.jsx(re,{size:16}):e.jsx(Ct,{style:{fontSize:18,marginRight:5}}),a("router.rule.delete.title")]}),u&&e.jsx(yr,{keyName:u.keyName,title:u.title,description:u.description,confirmPlaceholder:u.confirmPlaceholder,confirm:u.confirm,cancel:u.cancel,params:u.params,onConfirm:u.onConfirm,onCancel:u.onCancel})]})}Rn.propTypes={id:r.string.isRequired,from:r.object.isRequired,children:r.any};Rn.defaultProps={children:null};function bn({id:t,from:o,to:s,children:a}){var c,v;const{t:n}=z(),{api:i}=J(),{blocklet:m}=ie(),[l,u]=f.useState(!1),[h,g]=f.useState(null),p=m.meta.did,S=m.site.id,d=o.pathPrefix,R=()=>{u(!1),g(null)},C=async j=>{try{const T=await ut(j,n);if(T)throw T;u(!0);const I={id:t,from:{pathPrefix:ue(j.pathPrefix)},to:{type:j.type}};j.type===D.ROUTING_RULE_TYPES.REDIRECT&&(I.to.url=j.url,I.to.redirectCode=j.redirectCode),j.type===D.ROUTING_RULE_TYPES.COMPONENT&&(I.to.did=p,I.to.componentId=j.componentId,I.to.pageGroup=j.pageGroup),j.type===D.ROUTING_RULE_TYPES.GENERAL_REWRITE&&(I.to.url=ue(j.url)),j.type===D.ROUTING_RULE_TYPES.DIRECT_RESPONSE&&(I.to.response={status:200,contentType:j.responseType,body:j.responseBody}),await i.updateRoutingRule({input:{id:S,rule:I,teamDid:p}})}catch(T){A.error(T.message)}finally{u(!1),g(null)}},x={title:n("router.rule.update.title"),description:(j,T,I)=>{const U=L=>{if(ut(L,n)){T({...L,__disableConfirm:!0});return}T({...L})};return e.jsxs(ee,{component:"div",children:[e.jsx(K,{label:n("router.rule.add.pathPrefix"),autoComplete:"off",variant:"outlined",name:"pathPrefix",inputProps:{"data-cy":"path-prefix-input"},fullWidth:!0,autoFocus:!0,helperText:j.helperText||n("router.rule.add.pathPrefixTip"),style:{marginBottom:32},margin:"dense",value:j.pathPrefix,onChange:L=>{let k=!1;j.type===D.ROUTING_RULE_TYPES.REDIRECT&&!j.url&&(k=!0),j.type===D.ROUTING_RULE_TYPES.GENERAL_REWRITE&&!j.url&&(k=!0),j.type===D.ROUTING_RULE_TYPES.DIRECT_RESPONSE&&(!j.responseType||!j.responseBody)&&(k=!0),L.target.value.trim()||(k=!0,I(n("router.validation.pathPrefixRequired"))),k||I("");const M=n("common.slugifyHint",{value:gt(L.target.value)});T({...j,pathPrefix:L.target.value,helperText:M,__disableConfirm:k})}}),e.jsx(Rt,{params:j,setParams:U,setError:I})]})},confirm:n("router.rule.update.confirm"),cancel:n("router.rule.update.cancel"),color:"primary",params:{did:s.did||"",pathPrefix:d==="/"?d:d.replace(/^\/+/,"").replace(/\/+$/,""),type:s.type||D.ROUTING_RULE_TYPES.BLOCKLET,redirectCode:s.redirectCode||302,componentId:s.componentId||"",pageGroup:s.pageGroup||"",url:s.url||"",responseType:((c=s.response)==null?void 0:c.contentType)||"",responseBody:(((v=s.response)==null?void 0:v.body)||"").replace(/\\"/g,'"'),__disableConfirm:!1},onConfirm:C,onCancel:R},b=j=>{j.stopPropagation(),g(x)};return e.jsxs(e.Fragment,{children:[typeof a=="function"?a({loading:l,open:b}):e.jsxs(ge,{onClick:b,className:"rule-action","data-cy":"action-update-rule",children:[l?e.jsx(re,{size:16}):e.jsx(yo,{style:{fontSize:18,marginRight:5}}),n("router.rule.update.title")]}),h&&e.jsx(Fe,{title:h.title,description:h.description,confirm:h.confirm,color:h.color,cancel:h.cancel,params:h.params,onConfirm:h.onConfirm,onCancel:h.onCancel})]})}bn.propTypes={id:r.string.isRequired,from:r.object.isRequired,to:r.object.isRequired,children:r.any};bn.defaultProps={children:null};function En(t){const{locale:o}=z(),{blocklet:s,recommendedDomain:a}=ie(),n=go(a,t.from.pathPrefix,Ht(s,o));return e.jsxs(y,{display:"flex",alignItems:"center",children:[e.jsx(y,{component:"a",sx:{display:{xs:"flex",md:"none"}},target:"_blank",href:n,rel:"noopener noreferrer",title:n,children:e.jsx($,{size:"small",children:e.jsx(So,{})})}),e.jsx(bn,{...t,children:({open:i})=>e.jsx($,{size:"small",onClick:i,disabled:t.isProtected,"data-cy":"action-update-rule",children:e.jsx(Yt,{})})}),e.jsx(Rn,{...t,children:({open:i})=>e.jsx($,{size:"small",onClick:i,disabled:t.isProtected,"data-cy":"action-delete-rule",children:e.jsx(Ct,{})})})]})}En.propTypes={isProtected:r.bool};En.defaultProps={isProtected:!1};function Do({group:t,...o}){return t?e.jsx(Qe,{type:"reverse",...o,children:t}):null}Do.propTypes={group:r.string.isRequired};function ft({domain:t,isHttps:o,toUrl:s}){const a=o?"https":"http";let n=s;return ms(n)||(n=`${a}://${t}${s}`),e.jsx(yt,{href:n,target:"_blank",style:{fontSize:14},underline:"hover",children:s},n)}ft.propTypes={domain:r.string.isRequired,toUrl:r.string.isRequired,isHttps:r.bool};ft.defaultProps={isHttps:!1};function bt({hasPermission:t}){const{t:o,locale:s}=z(),a=uo(),{blocklet:n,recommendedDomain:i}=ie();return n.site.rules.filter(l=>l.to.type!==D.ROUTING_RULE_TYPES.BLOCKLET).map(l=>{var p;let u=null,h=null;l.to.type===D.ROUTING_RULE_TYPES.NONE?u="404":l.to.type===D.ROUTING_RULE_TYPES.REDIRECT?u=l.to.redirectCode:l.to.type===D.ROUTING_RULE_TYPES.GENERAL_REWRITE?u="R":l.to.type===D.ROUTING_RULE_TYPES.DIRECT_RESPONSE?u=e.jsx(br,{sx:{color:"text.secondary",fontSize:"45px"}}):l.to.type===D.ROUTING_RULE_TYPES.COMPONENT&&(h=n.children.find(S=>S.meta.did===l.to.componentId),u="C");const g=l.isProtected?e.jsx(ve,{title:o("blocklet.router.urlLockTooltip"),placement:"top",children:e.jsx("span",{children:e.jsx($,{disabled:!0,size:"small",style:{pointerEvents:"auto",paddingTop:0,paddingBottom:0,margin:"12px 0"},children:e.jsx(xr,{style:{fill:a.palette.text.disabled}})})})}):e.jsx(En,{...l});return[e.jsxs(y,{display:"flex",py:2,className:"component-item",justifyContent:"space-between",alignItems:"center",children:[e.jsxs(y,{width:{xs:300,md:400},display:"flex",alignItems:"center",children:[e.jsx(y,{className:"component-item__indent",width:28}),typeof u=="object"?u:e.jsx(ps,{children:u}),e.jsxs(y,{sx:{ml:2,flex:1,wordBreak:"break-word"},children:[e.jsxs(y,{style:{color:"#222",fontSize:16},children:[l.to.type===D.ROUTING_RULE_TYPES.NONE&&o("common.page404"),l.to.type===D.ROUTING_RULE_TYPES.REDIRECT&&o("common.redirect"),l.to.type===D.ROUTING_RULE_TYPES.GENERAL_REWRITE&&o("common.rewrite"),l.to.type===D.ROUTING_RULE_TYPES.DIRECT_RESPONSE&&((p=D.ROUTING_RESPONSE_TYPES.find(S=>S.value===l.to.response.contentType))==null?void 0:p.text),l.to.type===D.ROUTING_RULE_TYPES.COMPONENT&&O.getDisplayName(h,!0)]}),e.jsxs(y,{display:"flex",alignItems:"center",children:[l.to.type===D.ROUTING_RULE_TYPES.REDIRECT&&e.jsx(ft,{domain:i,toUrl:l.to.url}),l.to.type===D.ROUTING_RULE_TYPES.GENERAL_REWRITE&&e.jsx(ft,{domain:i,toUrl:l.to.url}),l.to.type===D.ROUTING_RULE_TYPES.COMPONENT&&e.jsx(Do,{group:l.to.pageGroup})]})]})]}),e.jsx(y,{px:2,sx:{display:{xs:"none",md:"flex"}},alignItems:"center",flexGrow:"1",children:e.jsx(yt,{href:go(i,l.from.pathPrefix,Ht(n,s)),target:"_blank",style:{fontSize:16},underline:"hover",children:us(l.from.pathPrefix,"/")||"/"})},l.from.pathPrefix),e.jsx(y,{children:t&&e.jsx("div",{style:{textAlign:"right"},children:g})},"actions")]},"rule"),e.jsx(Jt,{},"divider")]})}bt.propTypes={hasPermission:r.bool};bt.defaultProps={hasPermission:!1};const mi=Me(bt,"mutate_blocklets"),fi=Me(bt,"",Oe);function hi(t){const{inService:o}=J();return o?e.jsx(fi,{...t}):e.jsx(mi,{...t})}function gi({blocklet:t,scrollToComponent:o}={blocklet:null,scrollToComponent:!1}){const s=fs(),{t:a}=z(),n=f.useRef(null),i=f.useMemo(()=>{if(!t||!t.optionalComponents)return null;const m=new URLSearchParams(window.location.search),l=m.get("install-component");if(l){n.current=l,m.delete("install-component"),s(m.toString());const u=t.optionalComponents.find(g=>g.meta.did===l);if(!u)return A.success(a("notification.installComponentError",{did:l})),null;const{meta:h}=u;if(o){const g=document.getElementById(`optional-component-${l}`),p=document.querySelector(".dashboard-main");if(g){const S=g.getBoundingClientRect(),d=p.getBoundingClientRect();p.scrollTo({top:S.top-d.top+p.scrollTop,behavior:"smooth"})}}return h}return null},[t,s,a,o]);return f.useEffect(()=>{var m;n.current&&window.opener&&window.opener.postMessage({blocklet:t,kind:"component-installer"},(m=window.blocklet)==null?void 0:m.appUrl)},[t]),i}function Tn({component:t,remove:o,disabled:s,tip:a,showConfirm:n,hideBtn:i,onCancel:m}){const{t:l}=f.useContext(Ce),[u,h]=f.useState(!1),[g,p]=f.useState(null),S=async b=>{h(!0),await o(b.component,b.removeType),h(!1),p(null)},d=s||u,R=()=>{p({title:`${l("common.delete")} ${t.meta.title||t.meta.name}`,description:(b,c)=>e.jsxs(ee,{component:"div",children:[e.jsx(ee,{gutterBottom:!0,children:l("blocklet.action.removeComponentDescription")}),e.jsxs(jr,{name:"removeType",value:b.removeType,onChange:v=>c({...b,removeType:v.target.value}),children:[e.jsx(zt,{value:"keepData",control:e.jsx(no,{}),label:l("blocklet.action.removeComponentKeepData")}),e.jsx(zt,{value:"complete",control:e.jsx(no,{}),label:l("blocklet.action.removeComponentComplete")})]})]}),confirm:l("common.confirm"),cancel:l("common.cancel"),params:{component:t,removeType:"keepData"},onConfirm:S,onCancel:()=>{p(null),m()}})};f.useEffect(()=>{n?R():(h(!1),p(null))},[n]);const C=e.jsx(xi,{size:"small",disabled:d,onClick:()=>R,"data-cy":"delete-component-btn",children:e.jsx(Ct,{disabled:d})}),x=e.jsx(ve,{title:a||l("common.delete"),children:e.jsx("span",{children:C})});return e.jsxs(e.Fragment,{children:[!i&&x,g&&e.jsx(Fe,{title:g.title,description:g.description,confirm:g.confirm,cancel:g.cancel,params:g.params,onConfirm:g.onConfirm,onCancel:g.onCancel})]})}Tn.propTypes={component:r.object.isRequired,remove:r.func,onCancel:r.func,disabled:r.bool,showConfirm:r.bool,hideBtn:r.bool,tip:r.string};Tn.defaultProps={remove:async()=>{},disabled:!1,showConfirm:!1,hideBtn:!1,onCancel:()=>{},tip:""};const xi=F($)`
394
+ `;function vn({blocklet:t,children:o}){const{t:s}=z(),[a,n]=f.useState(!1),i=m=>{m.stopPropagation(),n(!0)};return e.jsxs(e.Fragment,{children:[typeof o=="function"?o({open:i}):e.jsxs(ge,{onClick:i,className:"component-action","data-cy":"action-add-component",children:[e.jsx(Qt,{style:{fontSize:18,marginRight:5}}),s("blocklet.component.add")]}),e.jsx(St,{showDialog:a,setShowDialog:n,blocklet:t})]})}vn.propTypes={children:r.any,blocklet:r.object.isRequired};vn.defaultProps={children:null};const ui=t=>t.children.filter(o=>o.meta.interfaces.find(s=>s.type===X.BLOCKLET_INTERFACE_TYPE_WEB));function bt({params:t,setParams:o,setError:s,serviceTypes:a}){const{t:n}=z(),{blocklet:i}=ie(),m=i.meta.did,l=ui(i),[u,h]=f.useState([]),g={301:n("common.redirectPermanently"),302:n("common.redirectTemporary"),307:n("common.redirectTemporary"),308:n("common.redirectPermanently")};return f.useEffect(()=>{if(t.type===D.ROUTING_RULE_TYPES.COMPONENT&&t.componentId){const p=l.find(b=>b.meta.did===t.componentId),S=O.findWebInterface(p.meta),d=(Array.isArray(S==null?void 0:S.pageGroups)?S.pageGroups:[]).map(b=>({value:b,label:`${b} pages`}));d.length&&d.unshift({value:"",label:"All pages"}),h(d),t.pageGroup&&d.find(b=>b.value===t.pageGroup)===!1&&o({...t,pageGroups:""})}},[t.componentId,t.type]),e.jsxs(e.Fragment,{children:[e.jsx(K,{select:!0,label:n("router.domain.add.type"),autoComplete:"off",variant:"outlined",name:"type","data-cy":"domain-add-type",fullWidth:!0,value:t.type,onChange:p=>{s(""),o({...t,type:p.target.value,did:p.target.value===D.ROUTING_RULE_TYPES.BLOCKLET?m:"",__disableConfirm:!1})},style:{marginBottom:32},SelectProps:{},children:a.map(({name:p,value:S})=>e.jsx(ge,{value:S,children:p},S))}),t.type===D.ROUTING_RULE_TYPES.REDIRECT&&[e.jsx(K,{select:!0,label:n("router.domain.add.redirect"),autoComplete:"off",variant:"outlined",name:"type",fullWidth:!0,value:t.redirectCode,onChange:p=>o({...t,redirectCode:p.target.value}),style:{marginBottom:32},SelectProps:{},children:Object.keys(g).map(p=>e.jsx(ge,{value:p,children:`${g[p]} - ${p}`},p))},"redirectCode"),e.jsx(K,{label:n("common.redirectUrl"),autoComplete:"off",variant:"outlined",name:"url",inputProps:{"data-cy":"redirect-url-input"},fullWidth:!0,value:t.url,helperText:n("router.urlHelperText"),style:{marginBottom:32},onChange:p=>{o({...t,url:p.target.value,__disableConfirm:!p.target.value.trim()}),p.target.value.trim()?s(""):s(n("router.validation.redirectUrlRequired"))}},"redirectUrl")],t.type===D.ROUTING_RULE_TYPES.COMPONENT&&[e.jsx(K,{select:!0,label:n("router.domain.add.component"),autoComplete:"off",variant:"outlined","data-cy":"select-component-input",name:"componentId",fullWidth:!0,value:t.componentId,onChange:p=>{o({...t,componentId:p.target.value})},style:{marginBottom:32},SelectProps:{},children:l.map(p=>e.jsx(ge,{value:p.meta.did,selected:p.meta.did===t.componentId,children:O.getDisplayName(p,!0)},p.meta.did))},"componentId"),u.length?e.jsx(K,{select:!0,label:n("router.domain.add.pageGroup"),autoComplete:"off",variant:"outlined",name:"pageGroup","data-cy":"route-group-input",fullWidth:!0,value:t.pageGroup,helperText:n("router.domain.add.pageGroupTip"),style:{marginBottom:32},onChange:p=>{o({...t,pageGroup:p.target.value})},SelectProps:{},children:u.map(p=>e.jsx(ge,{value:p.value,selected:p.value===t.pageGroup,children:p.label},p.label))},"pageGroup"):null].filter(Boolean),t.type===D.ROUTING_RULE_TYPES.GENERAL_REWRITE&&e.jsx(K,{label:n("common.rewriteUrl"),autoComplete:"off",variant:"outlined",name:"url","data-cy":"rewrite-url-input",fullWidth:!0,value:t.url,helperText:n("router.urlHelperText"),style:{marginBottom:32},onChange:p=>{const S=p.target.value.trim();o({...t,url:p.target.value,__disableConfirm:!S}),s(S?"":n("router.validation.rewriteUrlRequired"))}},"url"),t.type===D.ROUTING_RULE_TYPES.DIRECT_RESPONSE&&[e.jsx(K,{select:!0,label:n("router.rule.add.responseType"),autoComplete:"off",variant:"outlined",name:"responseType",fullWidth:!0,value:t.responseType,onChange:p=>o({...t,responseType:p.target.value}),style:{marginBottom:32},SelectProps:{},children:D.ROUTING_RESPONSE_TYPES.map(p=>e.jsx(ge,{value:p.value,children:p.text},p.value))},"responseType"),e.jsx(K,{label:n("router.rule.add.responseBody"),autoComplete:"off",variant:"outlined",name:"responseBody","data-cy":"response-body-input",fullWidth:!0,multiline:!0,minRows:3,value:t.responseBody,helperText:n("router.rule.add.responseBodyTip"),style:{marginBottom:32},onChange:p=>{const S=p.target.value.trim();o({...t,responseBody:p.target.value,__disableConfirm:!S}),s(S?"":n("router.rule.add.responseBodyRequired"))}},"response-body")]]})}bt.propTypes={params:r.object,serviceTypes:r.array,setParams:r.func,setError:r.func};bt.defaultProps={params:{},serviceTypes:[{name:"Redirect",value:D.ROUTING_RULE_TYPES.REDIRECT},{name:"Default - User will see the 404 page",value:D.ROUTING_RULE_TYPES.NONE},{name:"Rewrite - Route traffic without redirect",value:D.ROUTING_RULE_TYPES.GENERAL_REWRITE},{name:"Response - Response with provided content",value:D.ROUTING_RULE_TYPES.DIRECT_RESPONSE},{name:"Component - Pass traffic to blocklet component",value:D.ROUTING_RULE_TYPES.COMPONENT}],setParams:()=>{},setError:()=>{}};function Sn({children:t,hiddenChildren:o,open:s,onClose:a}){const{t:n}=z(),{api:i}=J(),{blocklet:m}=ie(),[l,u]=f.useState(!1),[h,g]=f.useState(!1),p=m.meta.did,S=m.site.id,d=()=>{a==null||a(),u(!1),g(!1)},b=async c=>{try{const v=await ut(c,n);if(v)throw v;u(!0);const j={from:{pathPrefix:ue(c.pathPrefix)},to:{type:c.type}};c.type===D.ROUTING_RULE_TYPES.REDIRECT&&(j.to.url=c.url.trim(),j.to.redirectCode=c.redirectCode),c.type===D.ROUTING_RULE_TYPES.COMPONENT&&(j.to.did=p,j.to.componentId=c.componentId,j.to.pageGroup=c.pageGroup),c.type===D.ROUTING_RULE_TYPES.GENERAL_REWRITE&&(j.to.url=ue(c.url)),c.type===D.ROUTING_RULE_TYPES.DIRECT_RESPONSE&&(j.to.response={status:200,contentType:c.responseType,body:c.responseBody}),await i.addRoutingRule({input:{id:S,rule:j,teamDid:p}})}catch(v){A.error(v.message)}finally{u(!1),g(!1)}},C={title:n("router.rule.add.title"),description:(c,v,j)=>{const T=I=>{if(j(null),ut(I,n)){v({...I,__disableConfirm:!0});return}v({...I})};return e.jsxs(ee,{component:"div",children:[e.jsx(K,{label:n("router.rule.add.pathPrefix"),autoComplete:"off",variant:"outlined",name:"pathPrefix",inputProps:{"data-cy":"path-prefix-input"},fullWidth:!0,autoFocus:!0,helperText:c.pathPrefixHint||n("router.rule.add.pathPrefixTip"),style:{marginBottom:32},margin:"dense",value:c.pathPrefix,onChange:I=>{let U=!1;const L=vo({params:{...c,pathPrefix:I.target.value},blocklets:[m]});j(L),c.type===D.ROUTING_RULE_TYPES.BLOCKLET&&L&&(U=!0),c.type===D.ROUTING_RULE_TYPES.REDIRECT&&!c.url&&(U=!0),c.type===D.ROUTING_RULE_TYPES.GENERAL_REWRITE&&!c.url&&(U=!0),c.type===D.ROUTING_RULE_TYPES.DIRECT_RESPONSE&&(!c.responseType||!c.responseBody)&&(U=!0),I.target.value.trim()||(U=!0,j(n("router.validation.pathPrefixRequired"))),U||j("");const k=n("common.slugifyHint",{value:gt(I.target.value)});v({...c,pathPrefix:I.target.value,pathPrefixHint:k,__disableConfirm:U})}}),e.jsx(bt,{params:c,setParams:T,setError:j})]})},confirm:n("router.rule.add.confirm"),cancel:n("common.cancel"),params:{did:"",pathPrefix:"",type:D.ROUTING_RULE_TYPES.REDIRECT,componentId:"",pageGroup:"",redirectCode:302,responseType:"text/plain",responseBody:"",__disableConfirm:!0},onConfirm:b,onCancel:d},x=c=>{c.stopPropagation(),g(!0)};let R=null;return o||(R=typeof t=="function"?t({open:x}):e.jsxs(ge,{onClick:x,className:"rule-action","data-cy":"action-add-rule",children:[l?e.jsx(re,{size:16}):e.jsx(Qt,{style:{fontSize:18,marginRight:5}}),n("router.rule.add.title")]})),e.jsxs(e.Fragment,{children:[R,(s||h)&&e.jsx(Fe,{title:C.title,description:C.description,confirm:C.confirm,cancel:C.cancel,params:C.params,onConfirm:C.onConfirm,onCancel:C.onCancel,color:"primary"})]})}Sn.propTypes={children:r.any,onClose:r.func,hiddenChildren:r.bool,open:r.bool};Sn.defaultProps={children:null,open:!1,onClose:null,hiddenChildren:!1};function bn({id:t,from:o,children:s}){const{t:a}=z(),{api:n}=J(),{blocklet:i}=ie(),[m,l]=f.useState(!1),[u,h]=f.useState(null),g=i.meta.did,p=i.site.id,S=o.pathPrefix,d=()=>{l(!1),h(null)},b=async()=>{l(!0);try{await n.deleteRoutingRule({input:{id:p,ruleId:t,teamDid:g}})}catch(R){A.error(R.message)}finally{h(null),l(!1)}},C={keyName:S,title:a("router.rule.delete.title"),description:a("router.rule.delete.description",{name:`<b>${S}</b>`}),confirmPlaceholder:a("router.rule.delete.confirm_desc",{name:S}),confirm:a("common.delConfirm"),cancel:a("router.rule.delete.cancel"),onConfirm:b,onCancel:d},x=R=>{R.stopPropagation(),h(C)};return e.jsxs(e.Fragment,{children:[typeof s=="function"?s({loading:m,open:x}):e.jsxs(ge,{onClick:x,className:"rule-action","data-cy":"action-delete-rule",children:[m?e.jsx(re,{size:16}):e.jsx(Ct,{style:{fontSize:18,marginRight:5}}),a("router.rule.delete.title")]}),u&&e.jsx(yr,{keyName:u.keyName,title:u.title,description:u.description,confirmPlaceholder:u.confirmPlaceholder,confirm:u.confirm,cancel:u.cancel,params:u.params,onConfirm:u.onConfirm,onCancel:u.onCancel})]})}bn.propTypes={id:r.string.isRequired,from:r.object.isRequired,children:r.any};bn.defaultProps={children:null};function Rn({id:t,from:o,to:s,children:a}){var c,v;const{t:n}=z(),{api:i}=J(),{blocklet:m}=ie(),[l,u]=f.useState(!1),[h,g]=f.useState(null),p=m.meta.did,S=m.site.id,d=o.pathPrefix,b=()=>{u(!1),g(null)},C=async j=>{try{const T=await ut(j,n);if(T)throw T;u(!0);const I={id:t,from:{pathPrefix:ue(j.pathPrefix)},to:{type:j.type}};j.type===D.ROUTING_RULE_TYPES.REDIRECT&&(I.to.url=j.url,I.to.redirectCode=j.redirectCode),j.type===D.ROUTING_RULE_TYPES.COMPONENT&&(I.to.did=p,I.to.componentId=j.componentId,I.to.pageGroup=j.pageGroup),j.type===D.ROUTING_RULE_TYPES.GENERAL_REWRITE&&(I.to.url=ue(j.url)),j.type===D.ROUTING_RULE_TYPES.DIRECT_RESPONSE&&(I.to.response={status:200,contentType:j.responseType,body:j.responseBody}),await i.updateRoutingRule({input:{id:S,rule:I,teamDid:p}})}catch(T){A.error(T.message)}finally{u(!1),g(null)}},x={title:n("router.rule.update.title"),description:(j,T,I)=>{const U=L=>{if(ut(L,n)){T({...L,__disableConfirm:!0});return}T({...L})};return e.jsxs(ee,{component:"div",children:[e.jsx(K,{label:n("router.rule.add.pathPrefix"),autoComplete:"off",variant:"outlined",name:"pathPrefix",inputProps:{"data-cy":"path-prefix-input"},fullWidth:!0,autoFocus:!0,helperText:j.helperText||n("router.rule.add.pathPrefixTip"),style:{marginBottom:32},margin:"dense",value:j.pathPrefix,onChange:L=>{let k=!1;j.type===D.ROUTING_RULE_TYPES.REDIRECT&&!j.url&&(k=!0),j.type===D.ROUTING_RULE_TYPES.GENERAL_REWRITE&&!j.url&&(k=!0),j.type===D.ROUTING_RULE_TYPES.DIRECT_RESPONSE&&(!j.responseType||!j.responseBody)&&(k=!0),L.target.value.trim()||(k=!0,I(n("router.validation.pathPrefixRequired"))),k||I("");const M=n("common.slugifyHint",{value:gt(L.target.value)});T({...j,pathPrefix:L.target.value,helperText:M,__disableConfirm:k})}}),e.jsx(bt,{params:j,setParams:U,setError:I})]})},confirm:n("router.rule.update.confirm"),cancel:n("router.rule.update.cancel"),color:"primary",params:{did:s.did||"",pathPrefix:d==="/"?d:d.replace(/^\/+/,"").replace(/\/+$/,""),type:s.type||D.ROUTING_RULE_TYPES.BLOCKLET,redirectCode:s.redirectCode||302,componentId:s.componentId||"",pageGroup:s.pageGroup||"",url:s.url||"",responseType:((c=s.response)==null?void 0:c.contentType)||"",responseBody:(((v=s.response)==null?void 0:v.body)||"").replace(/\\"/g,'"'),__disableConfirm:!1},onConfirm:C,onCancel:b},R=j=>{j.stopPropagation(),g(x)};return e.jsxs(e.Fragment,{children:[typeof a=="function"?a({loading:l,open:R}):e.jsxs(ge,{onClick:R,className:"rule-action","data-cy":"action-update-rule",children:[l?e.jsx(re,{size:16}):e.jsx(yo,{style:{fontSize:18,marginRight:5}}),n("router.rule.update.title")]}),h&&e.jsx(Fe,{title:h.title,description:h.description,confirm:h.confirm,color:h.color,cancel:h.cancel,params:h.params,onConfirm:h.onConfirm,onCancel:h.onCancel})]})}Rn.propTypes={id:r.string.isRequired,from:r.object.isRequired,to:r.object.isRequired,children:r.any};Rn.defaultProps={children:null};function En(t){const{locale:o}=z(),{blocklet:s,recommendedDomain:a}=ie(),n=go(a,t.from.pathPrefix,Ht(s,o));return e.jsxs(y,{display:"flex",alignItems:"center",children:[e.jsx(y,{component:"a",sx:{display:{xs:"flex",md:"none"}},target:"_blank",href:n,rel:"noopener noreferrer",title:n,children:e.jsx($,{size:"small",children:e.jsx(So,{})})}),e.jsx(Rn,{...t,children:({open:i})=>e.jsx($,{size:"small",onClick:i,disabled:t.isProtected,"data-cy":"action-update-rule",children:e.jsx(Yt,{})})}),e.jsx(bn,{...t,children:({open:i})=>e.jsx($,{size:"small",onClick:i,disabled:t.isProtected,"data-cy":"action-delete-rule",children:e.jsx(Ct,{})})})]})}En.propTypes={isProtected:r.bool};En.defaultProps={isProtected:!1};function Do({group:t,...o}){return t?e.jsx(Qe,{type:"reverse",...o,children:t}):null}Do.propTypes={group:r.string.isRequired};function ft({domain:t,isHttps:o,toUrl:s}){const a=o?"https":"http";let n=s;return ms(n)||(n=`${a}://${t}${s}`),e.jsx(yt,{href:n,target:"_blank",style:{fontSize:14},underline:"hover",children:s},n)}ft.propTypes={domain:r.string.isRequired,toUrl:r.string.isRequired,isHttps:r.bool};ft.defaultProps={isHttps:!1};function Rt({hasPermission:t}){const{t:o,locale:s}=z(),a=uo(),{blocklet:n,recommendedDomain:i}=ie();return n.site.rules.filter(l=>l.to.type!==D.ROUTING_RULE_TYPES.BLOCKLET).map(l=>{var p;let u=null,h=null;l.to.type===D.ROUTING_RULE_TYPES.NONE?u="404":l.to.type===D.ROUTING_RULE_TYPES.REDIRECT?u=l.to.redirectCode:l.to.type===D.ROUTING_RULE_TYPES.GENERAL_REWRITE?u="R":l.to.type===D.ROUTING_RULE_TYPES.DIRECT_RESPONSE?u=e.jsx(Rr,{sx:{color:"text.secondary",fontSize:"45px"}}):l.to.type===D.ROUTING_RULE_TYPES.COMPONENT&&(h=n.children.find(S=>S.meta.did===l.to.componentId),u="C");const g=l.isProtected?e.jsx(ve,{title:o("blocklet.router.urlLockTooltip"),placement:"top",children:e.jsx("span",{children:e.jsx($,{disabled:!0,size:"small",style:{pointerEvents:"auto",paddingTop:0,paddingBottom:0,margin:"12px 0"},children:e.jsx(xr,{style:{fill:a.palette.text.disabled}})})})}):e.jsx(En,{...l});return[e.jsxs(y,{display:"flex",py:2,className:"component-item",justifyContent:"space-between",alignItems:"center",children:[e.jsxs(y,{width:{xs:300,md:400},display:"flex",alignItems:"center",children:[e.jsx(y,{className:"component-item__indent",width:28}),typeof u=="object"?u:e.jsx(ps,{children:u}),e.jsxs(y,{sx:{ml:2,flex:1,wordBreak:"break-word"},children:[e.jsxs(y,{style:{color:"#222",fontSize:16},children:[l.to.type===D.ROUTING_RULE_TYPES.NONE&&o("common.page404"),l.to.type===D.ROUTING_RULE_TYPES.REDIRECT&&o("common.redirect"),l.to.type===D.ROUTING_RULE_TYPES.GENERAL_REWRITE&&o("common.rewrite"),l.to.type===D.ROUTING_RULE_TYPES.DIRECT_RESPONSE&&((p=D.ROUTING_RESPONSE_TYPES.find(S=>S.value===l.to.response.contentType))==null?void 0:p.text),l.to.type===D.ROUTING_RULE_TYPES.COMPONENT&&O.getDisplayName(h,!0)]}),e.jsxs(y,{display:"flex",alignItems:"center",children:[l.to.type===D.ROUTING_RULE_TYPES.REDIRECT&&e.jsx(ft,{domain:i,toUrl:l.to.url}),l.to.type===D.ROUTING_RULE_TYPES.GENERAL_REWRITE&&e.jsx(ft,{domain:i,toUrl:l.to.url}),l.to.type===D.ROUTING_RULE_TYPES.COMPONENT&&e.jsx(Do,{group:l.to.pageGroup})]})]})]}),e.jsx(y,{px:2,sx:{display:{xs:"none",md:"flex"}},alignItems:"center",flexGrow:"1",children:e.jsx(yt,{href:go(i,l.from.pathPrefix,Ht(n,s)),target:"_blank",style:{fontSize:16},underline:"hover",children:us(l.from.pathPrefix,"/")||"/"})},l.from.pathPrefix),e.jsx(y,{children:t&&e.jsx("div",{style:{textAlign:"right"},children:g})},"actions")]},"rule"),e.jsx(Jt,{},"divider")]})}Rt.propTypes={hasPermission:r.bool};Rt.defaultProps={hasPermission:!1};const mi=Me(Rt,"mutate_blocklets"),fi=Me(Rt,"",Oe);function hi(t){const{inService:o}=J();return o?e.jsx(fi,{...t}):e.jsx(mi,{...t})}function gi({blocklet:t,scrollToComponent:o}={blocklet:null,scrollToComponent:!1}){const s=fs(),{t:a}=z(),n=f.useRef(null),i=f.useMemo(()=>{if(!t||!t.optionalComponents)return null;const m=new URLSearchParams(window.location.search),l=m.get("install-component");if(l){n.current=l,m.delete("install-component"),s(m.toString());const u=t.optionalComponents.find(g=>g.meta.did===l);if(!u)return A.success(a("notification.installComponentError",{did:l})),null;const{meta:h}=u;if(o){const g=document.getElementById(`optional-component-${l}`),p=document.querySelector(".dashboard-main");if(g){const S=g.getBoundingClientRect(),d=p.getBoundingClientRect();p.scrollTo({top:S.top-d.top+p.scrollTop,behavior:"smooth"})}}return h}return null},[t,s,a,o]);return f.useEffect(()=>{var m;n.current&&window.opener&&window.opener.postMessage({blocklet:t,kind:"component-installer"},(m=window.blocklet)==null?void 0:m.appUrl)},[t]),i}function Tn({component:t,remove:o,disabled:s,tip:a,showConfirm:n,hideBtn:i,onCancel:m}){const{t:l}=f.useContext(Ce),[u,h]=f.useState(!1),[g,p]=f.useState(null),S=async R=>{h(!0),await o(R.component,R.removeType),h(!1),p(null)},d=s||u,b=()=>{p({title:`${l("common.delete")} ${t.meta.title||t.meta.name}`,description:(R,c)=>e.jsxs(ee,{component:"div",children:[e.jsx(ee,{gutterBottom:!0,children:l("blocklet.action.removeComponentDescription")}),e.jsxs(jr,{name:"removeType",value:R.removeType,onChange:v=>c({...R,removeType:v.target.value}),children:[e.jsx(zt,{value:"keepData",control:e.jsx(no,{}),label:l("blocklet.action.removeComponentKeepData")}),e.jsx(zt,{value:"complete",control:e.jsx(no,{}),label:l("blocklet.action.removeComponentComplete")})]})]}),confirm:l("common.confirm"),cancel:l("common.cancel"),params:{component:t,removeType:"keepData"},onConfirm:S,onCancel:()=>{p(null),m()}})};f.useEffect(()=>{n?b():(h(!1),p(null))},[n]);const C=e.jsx(xi,{size:"small",disabled:d,onClick:()=>b,"data-cy":"delete-component-btn",children:e.jsx(Ct,{disabled:d})}),x=e.jsx(ve,{title:a||l("common.delete"),children:e.jsx("span",{children:C})});return e.jsxs(e.Fragment,{children:[!i&&x,g&&e.jsx(Fe,{title:g.title,description:g.description,confirm:g.confirm,cancel:g.cancel,params:g.params,onConfirm:g.onConfirm,onCancel:g.onCancel})]})}Tn.propTypes={component:r.object.isRequired,remove:r.func,onCancel:r.func,disabled:r.bool,showConfirm:r.bool,hideBtn:r.bool,tip:r.string};Tn.defaultProps={remove:async()=>{},disabled:!1,showConfirm:!1,hideBtn:!1,onCancel:()=>{},tip:""};const xi=F($)`
395
395
  &.Mui-disabled {
396
396
  opacity: 0.5;
397
397
  }
398
- `;function wn({component:t,onStart:o,onStop:s,disabled:a,tip:n}){const{t:i}=f.useContext(Ce),[m,l]=f.useState(!1),[u,h]=f.useState(),g=async()=>{l(!0);try{await o(t)}catch(x){A.error(x.message)}l(!1)},p=async()=>{l(!0);try{await s(t)}catch(x){A.error(x.message)}l(!1)},S=a||m,d=["starting","running","stopping"].includes(t.status),R=d?Ds:Bs,C=e.jsx(yi,{disabled:S,onClick:()=>{var x;d?h({title:`${i("common.stop")} ${(x=t==null?void 0:t.meta)==null?void 0:x.title}`,description:i("blocklet.action.stopComponentDescription"),confirm:i("blocklet.action.confirmStop"),cancel:i("common.cancel"),onConfirm:()=>(h(null),p()),onCancel:()=>h(null)}):g()},"data-cy":`${d?"stop":"start"}-component-btn`,children:e.jsx(R,{disabled:S})});return[e.jsx(ve,{title:n||i(`common.${d?"stop":"start"}`),children:e.jsx("span",{children:C})},"btn"),u&&e.jsx(Fe,{title:u.title,description:u.description,confirm:u.confirm,cancel:u.cancel,params:u.params,onConfirm:u.onConfirm,onCancel:u.onCancel},"connect")]}wn.propTypes={component:r.object.isRequired,onStart:r.func,onStop:r.func,disabled:r.bool,tip:r.string};wn.defaultProps={onStart:async()=>{},onStop:async()=>{},disabled:!1,tip:""};const yi=F($)`
398
+ `;function wn({component:t,onStart:o,onStop:s,disabled:a,tip:n}){const{t:i}=f.useContext(Ce),[m,l]=f.useState(!1),[u,h]=f.useState(),g=async()=>{l(!0);try{await o(t)}catch(x){A.error(x.message)}l(!1)},p=async()=>{l(!0);try{await s(t)}catch(x){A.error(x.message)}l(!1)},S=a||m,d=["starting","running","stopping"].includes(t.status),b=d?Ds:Bs,C=e.jsx(yi,{disabled:S,onClick:()=>{var x;d?h({title:`${i("common.stop")} ${(x=t==null?void 0:t.meta)==null?void 0:x.title}`,description:i("blocklet.action.stopComponentDescription"),confirm:i("blocklet.action.confirmStop"),cancel:i("common.cancel"),onConfirm:()=>(h(null),p()),onCancel:()=>h(null)}):g()},"data-cy":`${d?"stop":"start"}-component-btn`,children:e.jsx(b,{disabled:S})});return[e.jsx(ve,{title:n||i(`common.${d?"stop":"start"}`),children:e.jsx("span",{children:C})},"btn"),u&&e.jsx(Fe,{title:u.title,description:u.description,confirm:u.confirm,cancel:u.cancel,params:u.params,onConfirm:u.onConfirm,onCancel:u.onCancel},"connect")]}wn.propTypes={component:r.object.isRequired,onStart:r.func,onStop:r.func,disabled:r.bool,tip:r.string};wn.defaultProps={onStart:async()=>{},onStop:async()=>{},disabled:!1,tip:""};const yi=F($)`
399
399
  &.Mui-disabled {
400
400
  opacity: 0.5;
401
401
  }
402
- `;function Pn({sourceInfo:t,blocklet:o}){var a;const{t:s}=f.useContext(Ce);return e.jsxs(y,{display:"flex",alignItems:"center",children:[e.jsx(hs,{type:"success",children:er(t.source)},"source"),t.source==="registry"&&e.jsx(yt,{href:we(t.deployedFrom,"blocklets",((a=o==null?void 0:o.meta)==null?void 0:a.bundleDid)||""),target:"_blank",className:"page-link",underline:"hover",style:{display:"flex",alignItems:"center",marginLeft:8},children:s("blocklet.overview.viewInStore")})]})}Pn.propTypes={sourceInfo:r.shape({source:r.string,deployedFrom:r.string}),blocklet:r.object};Pn.defaultProps={sourceInfo:{},blocklet:{}};var In={},Ci=_t;Object.defineProperty(In,"__esModule",{value:!0});var Bo=In.default=void 0,ji=Ci(qt()),vi=e;Bo=In.default=(0,ji.default)((0,vi.jsx)("path",{d:"m4 12 1.41 1.41L11 7.83V20h2V7.83l5.58 5.59L20 12l-8-8z"}),"ArrowUpward");function Et({blocklet:t,checkUpgrade:o,hasPermission:s,...a}){const{api:n}=J(),{t:i}=f.useContext(Ce),[m,l]=f.useState(!1),[u,h]=f.useState(""),[g,p]=f.useState(null),[S,d]=f.useState(null);f.useEffect(()=>{p(null),o&&(t.mode,X.BLOCKLET_MODES.DEVELOPMENT)},[t,o]);const R=()=>{l(!1),d(null)},C=async()=>{l(!0);try{const b={did:t.meta.did,version:g.version,storeUrl:g.registryUrl||""};await Ye(2e3),await n.upgradeBlocklet({input:b})}catch(b){A.error(`Blocklet upgrade failed: ${Z(b)}`)}finally{l(!1),d(null)}},x={title:`${i("common.upgrade")} ${i("common.blocklet")} ${O.getDisplayName(t)}`,description:i("blocklet.action.upgradeDescription"),confirm:i("blocklet.action.confirmUpgrade"),cancel:i("common.cancel"),onConfirm:C,onCancel:R};return s&&g&&!O.isInProgress(t.status)?e.jsxs(e.Fragment,{children:[e.jsx(Qe,{...a,children:t.meta.version}),e.jsx(ve,{title:i("common.updateAvailable",{version:g.version}),children:e.jsx($,{size:"small",style:{marginLeft:8},disabled:m,onClick:()=>d(x),children:m?e.jsx(re,{size:16}):e.jsx(Bo,{style:{fontSize:16,color:"red"}})})}),!!u&&e.jsx(A,{variant:"error",message:u,onClose:()=>h("")}),S&&e.jsx(Fe,{title:S.title,description:S.description,confirm:S.confirm,cancel:S.cancel,params:S.params,onConfirm:S.onConfirm,onCancel:S.onCancel})]}):e.jsx(Qe,{...a,children:t.meta.version})}Et.propTypes={blocklet:r.object.isRequired,checkUpgrade:r.bool,hasPermission:r.bool};Et.defaultProps={checkUpgrade:!1,hasPermission:!1};const Si=Me(Et,"mutate_blocklets"),Ri=Me(Et,"",Oe);function bi(t){const{inService:o}=J();return o?e.jsx(Ri,{...t}):e.jsx(Si,{...t})}const Ei=t=>{var o;return!((o=t==null?void 0:t.meta)!=null&&o.group)},Ti=(t,o)=>t?[{name:o("common.name"),value:t.displayName},{name:o("common.description"),value:t.description},{name:o("common.version"),value:e.jsx(Qe,{children:t.version})}]:[],wi=t=>{const{source:o,deployedFrom:s,bundleSource:a}=t;return o?{source:o,deployedFrom:s}:a?a.url?{source:"url",deployedFrom:s||Array.isArray(a.url)?a.url[0]:a.url}:a.store?{source:"registry",deployedFrom:s||Array.isArray(a.store)?a.store[0]:a.store}:{}:{source:"upload",deployedFrom:s}},Pi=(t,o)=>{const s=t.split("/").slice(1);let a=o,n=0;const i=[];for(;a&&n<s.length;){const m=a.children.find(l=>l.meta.did===s[n]);a=m,n++,m&&i.push(m.meta.title)}return i.join(" / ")};function kn({blocklet:t,depth:o,componentInfo:s,app:a,onClose:n}){var d,R;const{t:i,locale:m}=f.useContext(Ce),{deletingBlocklets:l}=Kt();let{status:u}=t;o===1&&l.includes(t.meta.did)&&(u="deleting");const h=`/${t.mountPoint||"/"}`.replace(/\/+/g,"/"),g=C=>C.map(x=>x.name===i("common.did")||x.name===i("blocklet.appId")?e.jsx(At,{valueComponent:"div",nameWidth:120,name:x.name,nameFormatter:()=>x.name,children:x.value},x.name):e.jsx(At,{valueComponent:"div",nameWidth:120,name:x.name,children:x.value},x.name)),p=s?wi(s):{},S=s?[{name:i("common.name"),value:O.getDisplayName(s,!0)},{name:i("common.version"),value:e.jsx(bi,{blocklet:s,checkUpgrade:!1})},{name:i("common.status"),value:e.jsx(Ro,{isResource:Ei(t),status:u,source:s.source,progress:t.progress})},t.status==="running"?{name:i("blocklet.startedAt"),value:Nt(t.startedAt,m)}:null,t.status!=="running"?{name:i("blocklet.stoppedAt"),value:Nt(t.stoppedAt,m)}:null,t.installedAt?{name:i("blocklet.installedAt"),value:Nt(t.installedAt,m)}:null,O.hasStartEngine(t.meta)?{name:i("common.mountPoint"),value:h}:null,s.meta.group?{name:i("common.group"),value:e.jsx(Qe,{type:"success",children:s.meta.group})}:null,{name:i("blocklet.overview.source"),value:e.jsx(Pn,{sourceInfo:p,blocklet:t})},{name:i("blocklet.overview.deployedFrom"),value:p.deployedFrom||"-"},{name:i("common.did"),value:e.jsx(mo,{did:s.meta.did,showQrcode:!0})},{name:i("common.author"),value:gs(s.meta.author)},{name:i("common.engine"),value:Ti(s.engine,i).map(({name:C,value:x})=>e.jsx(At,{style:{marginBottom:4},nameWidth:120,name:C,children:x},C))},(d=t.dependents)!=null&&d.length?{name:i("common.dependents"),value:e.jsx(y,{children:t.dependents.map(C=>e.jsx(y,{children:`${Pi(C.id,a)} ${C.required?`(${i("common.required")})`:""}`},C.id))})}:null,(R=t.meta.resources)!=null&&R.length?{name:i("common.resource"),value:t.meta.resources.join(", ")}:null].filter(Boolean):[];return s?e.jsx(xt,{open:!0,title:i("common.componentBasicInfo"),showCloseButton:!0,fullWidth:!0,maxWidth:"md",onClose:()=>{n(null)},children:e.jsx(y,{paddingBottom:1.5,children:g(S)},"dialog-wrapper")},"base-info-dialog"):null}kn.propTypes={blocklet:r.object.isRequired,depth:r.number,app:r.object,componentInfo:r.object,onClose:r.func.isRequired};kn.defaultProps={depth:0,app:null,componentInfo:null};F(xo)`
402
+ `;function Pn({sourceInfo:t,blocklet:o}){var a;const{t:s}=f.useContext(Ce);return e.jsxs(y,{display:"flex",alignItems:"center",children:[e.jsx(hs,{type:"success",children:er(t.source)},"source"),t.source==="registry"&&e.jsx(yt,{href:we(t.deployedFrom,"blocklets",((a=o==null?void 0:o.meta)==null?void 0:a.bundleDid)||""),target:"_blank",className:"page-link",underline:"hover",style:{display:"flex",alignItems:"center",marginLeft:8},children:s("blocklet.overview.viewInStore")})]})}Pn.propTypes={sourceInfo:r.shape({source:r.string,deployedFrom:r.string}),blocklet:r.object};Pn.defaultProps={sourceInfo:{},blocklet:{}};var In={},Ci=_t;Object.defineProperty(In,"__esModule",{value:!0});var Bo=In.default=void 0,ji=Ci(Vt()),vi=e;Bo=In.default=(0,ji.default)((0,vi.jsx)("path",{d:"m4 12 1.41 1.41L11 7.83V20h2V7.83l5.58 5.59L20 12l-8-8z"}),"ArrowUpward");function Et({blocklet:t,checkUpgrade:o,hasPermission:s,...a}){const{api:n}=J(),{t:i}=f.useContext(Ce),[m,l]=f.useState(!1),[u,h]=f.useState(""),[g,p]=f.useState(null),[S,d]=f.useState(null);f.useEffect(()=>{p(null),o&&(t.mode,X.BLOCKLET_MODES.DEVELOPMENT)},[t,o]);const b=()=>{l(!1),d(null)},C=async()=>{l(!0);try{const R={did:t.meta.did,version:g.version,storeUrl:g.registryUrl||""};await Ye(2e3),await n.upgradeBlocklet({input:R})}catch(R){A.error(`Blocklet upgrade failed: ${Z(R)}`)}finally{l(!1),d(null)}},x={title:`${i("common.upgrade")} ${i("common.blocklet")} ${O.getDisplayName(t)}`,description:i("blocklet.action.upgradeDescription"),confirm:i("blocklet.action.confirmUpgrade"),cancel:i("common.cancel"),onConfirm:C,onCancel:b};return s&&g&&!O.isInProgress(t.status)?e.jsxs(e.Fragment,{children:[e.jsx(Qe,{...a,children:t.meta.version}),e.jsx(ve,{title:i("common.updateAvailable",{version:g.version}),children:e.jsx($,{size:"small",style:{marginLeft:8},disabled:m,onClick:()=>d(x),children:m?e.jsx(re,{size:16}):e.jsx(Bo,{style:{fontSize:16,color:"red"}})})}),!!u&&e.jsx(A,{variant:"error",message:u,onClose:()=>h("")}),S&&e.jsx(Fe,{title:S.title,description:S.description,confirm:S.confirm,cancel:S.cancel,params:S.params,onConfirm:S.onConfirm,onCancel:S.onCancel})]}):e.jsx(Qe,{...a,children:t.meta.version})}Et.propTypes={blocklet:r.object.isRequired,checkUpgrade:r.bool,hasPermission:r.bool};Et.defaultProps={checkUpgrade:!1,hasPermission:!1};const Si=Me(Et,"mutate_blocklets"),bi=Me(Et,"",Oe);function Ri(t){const{inService:o}=J();return o?e.jsx(bi,{...t}):e.jsx(Si,{...t})}const Ei=t=>{var o;return!((o=t==null?void 0:t.meta)!=null&&o.group)},Ti=(t,o)=>t?[{name:o("common.name"),value:t.displayName},{name:o("common.description"),value:t.description},{name:o("common.version"),value:e.jsx(Qe,{children:t.version})}]:[],wi=t=>{const{source:o,deployedFrom:s,bundleSource:a}=t;return o?{source:o,deployedFrom:s}:a?a.url?{source:"url",deployedFrom:s||Array.isArray(a.url)?a.url[0]:a.url}:a.store?{source:"registry",deployedFrom:s||Array.isArray(a.store)?a.store[0]:a.store}:{}:{source:"upload",deployedFrom:s}},Pi=(t,o)=>{const s=t.split("/").slice(1);let a=o,n=0;const i=[];for(;a&&n<s.length;){const m=a.children.find(l=>l.meta.did===s[n]);a=m,n++,m&&i.push(m.meta.title)}return i.join(" / ")};function kn({blocklet:t,depth:o,componentInfo:s,app:a,onClose:n}){var d,b;const{t:i,locale:m}=f.useContext(Ce),{deletingBlocklets:l}=Kt();let{status:u}=t;o===1&&l.includes(t.meta.did)&&(u="deleting");const h=`/${t.mountPoint||"/"}`.replace(/\/+/g,"/"),g=C=>C.map(x=>x.name===i("common.did")||x.name===i("blocklet.appId")?e.jsx(At,{valueComponent:"div",nameWidth:120,name:x.name,nameFormatter:()=>x.name,children:x.value},x.name):e.jsx(At,{valueComponent:"div",nameWidth:120,name:x.name,children:x.value},x.name)),p=s?wi(s):{},S=s?[{name:i("common.name"),value:O.getDisplayName(s,!0)},{name:i("common.version"),value:e.jsx(Ri,{blocklet:s,checkUpgrade:!1})},{name:i("common.status"),value:e.jsx(bo,{isResource:Ei(t),status:u,source:s.source,progress:t.progress})},t.status==="running"?{name:i("blocklet.startedAt"),value:Nt(t.startedAt,m)}:null,t.status!=="running"?{name:i("blocklet.stoppedAt"),value:Nt(t.stoppedAt,m)}:null,t.installedAt?{name:i("blocklet.installedAt"),value:Nt(t.installedAt,m)}:null,O.hasStartEngine(t.meta)?{name:i("common.mountPoint"),value:h}:null,s.meta.group?{name:i("common.group"),value:e.jsx(Qe,{type:"success",children:s.meta.group})}:null,{name:i("blocklet.overview.source"),value:e.jsx(Pn,{sourceInfo:p,blocklet:t})},{name:i("blocklet.overview.deployedFrom"),value:p.deployedFrom||"-"},{name:i("common.did"),value:e.jsx(mo,{did:s.meta.did,showQrcode:!0})},{name:i("common.author"),value:gs(s.meta.author)},{name:i("common.engine"),value:Ti(s.engine,i).map(({name:C,value:x})=>e.jsx(At,{style:{marginBottom:4},nameWidth:120,name:C,children:x},C))},(d=t.dependents)!=null&&d.length?{name:i("common.dependents"),value:e.jsx(y,{children:t.dependents.map(C=>e.jsx(y,{children:`${Pi(C.id,a)} ${C.required?`(${i("common.required")})`:""}`},C.id))})}:null,(b=t.meta.resources)!=null&&b.length?{name:i("common.resource"),value:t.meta.resources.join(", ")}:null].filter(Boolean):[];return s?e.jsx(xt,{open:!0,title:i("common.componentBasicInfo"),showCloseButton:!0,fullWidth:!0,maxWidth:"md",onClose:()=>{n(null)},children:e.jsx(y,{paddingBottom:1.5,children:g(S)},"dialog-wrapper")},"base-info-dialog"):null}kn.propTypes={blocklet:r.object.isRequired,depth:r.number,app:r.object,componentInfo:r.object,onClose:r.func.isRequired};kn.defaultProps={depth:0,app:null,componentInfo:null};F(xo)`
403
403
  .BaseBadge-badge {
404
404
  top: ${t=>t.top*8||6}px;
405
405
  right: ${t=>t.right*8||6}px;
@@ -421,7 +421,7 @@ import{bK as zo,j as e,aK as qt,aL as _t,q as z,O as y,ax as ve,P as r,A,bk as J
421
421
  margin-left: 4px;
422
422
  transform: translateY(-1px);
423
423
  }
424
- `;function No({blocklet:t,ancestors:o,mountPoint:s,href:a}){const[n,i]=f.useState(!1),[m,l]=f.useState(!1),[u,h]=f.useState(!1),[g,p]=f.useState(s),{api:S}=J(),d=!o.length,R=d?t.meta.did:o.map(c=>c.meta.did)[0];f.useEffect(()=>{l(!1),i(!1),h(!1)},[s]);const C=()=>{i(!1),l(!1),p(s)},x=async c=>{c.preventDefault(),h(!0),i(!1);try{const v={rootDid:R,mountPoint:ue(g)};d||(v.did=t.meta.did),await S.updateComponentMountPoint({input:v})}catch(v){throw h(!1),v.message=Z(v),A.error(v.message),v}},b=m?e.jsxs(y,{sx:{ml:1},children:[e.jsx($,{size:"medium",onMouseEnter:()=>i(!0),onMouseLeave:()=>i(!1),"data-cy":"edit-mount-point-submit",onClick:x,children:e.jsx(y,{component:Pe,icon:"material-symbols:done",sx:{color:"primary.main",transition:"0.3s opacity"}})}),e.jsx($,{size:"medium",onMouseEnter:()=>i(!0),onMouseLeave:()=>i(!1),onClick:C,children:e.jsx(y,{component:Pe,icon:"iconoir:cancel",sx:{color:"primary.main",transition:"0.3s opacity"}})})]}):e.jsx($,{size:"medium",onMouseEnter:()=>i(!0),onMouseLeave:()=>i(!1),onClick:()=>l(!0),children:e.jsx(y,{component:Pe,"data-cy":"edit-mount-point",icon:"lets-icons:edit-light",sx:{opacity:n?1:0,color:"primary.main",transition:"0.3s opacity"}})});return e.jsxs(y,{sx:{display:{xs:"none",md:"flex"}},alignItems:"center",flexGrow:"1",children:[m?e.jsx("form",{onSubmit:x,children:e.jsx(K,{style:{flex:1},fullWidth:!0,"data-cy":"edit-mount-point-input",value:g,onChange:c=>p(c.target.value),autoFocus:!0,size:"small",variant:"outlined",placeholder:s})}):e.jsx(y,{component:"a",target:"_blank",href:a,rel:"noopener noreferrer",title:a,onMouseEnter:()=>i(!0),onMouseLeave:()=>i(!1),children:e.jsx(y,{maxWidth:400,sx:{color:"secondary.main",fontSize:16,px:2},overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis",children:xs(s)})}),u?e.jsx(re,{size:20,sx:{ml:1}}):b]},s)}No.propTypes={mountPoint:r.string.isRequired,href:r.string.isRequired,blocklet:r.object.isRequired,ancestors:r.array.isRequired};const Ii=t=>{var o;return!((o=t==null?void 0:t.meta)!=null&&o.group)},co=(t,o)=>{const s=t.split("/").slice(1);let a=o,n=0;const i=[];for(;a&&n<s.length;){const m=a.children.find(l=>l.meta.did===s[n]);a=m,n++,m&&i.push(m.meta.title)}return i.join(" / ")};function ht({blocklet:t,ancestors:o,depth:s,onRemove:a,onStart:n,onStop:i,onRestart:m,getComponentUrl:l,app:u}){var V,Q,Ie;const{t:h}=f.useContext(Ce),[g,p]=f.useState(),[S,d]=f.useState(!1),[R,C]=f.useState(!1),[x,b]=f.useState(null),[c,v]=f.useState(!1),{deletingBlocklets:j}=Kt();let{status:T}=t;s===1&&j.includes(t.meta.did)&&(T="deleting");const I=`/${t.mountPoint||"/"}`.replace(/\/+/g,"/"),U=l(I),L=O.isInProgress(u.status),k=O.isInProgress(t.status);let M="";if(L||k||s===1&&j.includes(t.meta.did))M=h("blocklet.component.tip.stopBlocklet");else if((V=t.dependents)!=null&&V.length){const te=t.dependents.filter(de=>de.required);if(te.length){const de=te.map(Se=>co(Se.id,u));M=h("blocklet.component.tip.requiredBy",{name:de.join(", ")})}}const B=async(...te)=>{C(!0);try{await a(...te)}catch{}C(!1),d(!1)};return e.jsxs(e.Fragment,{children:[e.jsxs(Un,{display:"flex",py:2,className:"component-item",justifyContent:"flex-start",alignItems:"center",children:[e.jsxs(y,{pl:2,width:{xs:300,md:400},display:"flex",alignItems:"center",children:[e.jsx(vr,{blocklet:t,ancestors:o}),e.jsxs(y,{ml:"16px",children:[e.jsxs(y,{className:"component-header",onClick:()=>p(t),children:[e.jsx(y,{className:"component-name",children:O.getDisplayName(t,!0)}),e.jsx(y,{className:"component-version",children:(Q=t==null?void 0:t.meta)==null?void 0:Q.version})]}),e.jsxs(y,{display:"flex",alignItems:"center",sx:{mt:"2px",ml:-.5},children:[T!=="unknown"&&e.jsx(Ro,{style:{marginLeft:4},status:T,source:t.source,progress:t.progress}),e.jsx(pr,{style:{marginLeft:4},mode:t.mode||""}),!!((Ie=t.dependents)!=null&&Ie.length)&&e.jsx(ve,{title:[`${h("common.dependents")}: `,t.dependents.map(te=>e.jsx(y,{pl:1,children:`${co(te.id,u)} ${te.required?`(${h("common.required")})`:""}`},te.id))],children:e.jsx(y,{display:"flex",color:"primary.main",ml:1,children:e.jsx(Pe,{icon:"octicon:package-dependents-16"})})})]})]})]},t),Ft.hasMountPoint(t.meta)&&e.jsx(No,{blocklet:t,ancestors:o,mountPoint:I,href:U},I),e.jsx("div",{style:{flex:1}}),e.jsxs(y,{display:"flex",alignItems:"center",children:[O.hasStartEngine(t.meta)&&e.jsx(ve,{title:h("common.visit"),children:e.jsx(y,{component:"a",sx:{display:{xs:"flex",md:"none"}},target:"_blank",href:U,rel:"noopener noreferrer",children:e.jsx($,{size:"small",children:e.jsx(So,{})})})}),e.jsx(wn,{blocklet:u,component:t,onStart:n,onStop:i,disabled:!["starting","stopping"].includes(u.status)&&O.isInProgress(u.status)}),e.jsx(Vt,{color:"error",badgeContent:"",variant:"dot",invisible:!O.getComponentMissingConfigs(t,o[0]).length,children:e.jsx(bo,{"data-cy":"component-actions",actions:[O.hasStartEngine(t.meta)||Ii(t)?{icon:e.jsx(Cr,{}),text:h("common.detail"),onClick:()=>{p(t)}}:null,{icon:e.jsx(Ns,{}),text:h("common.restart"),onClick:()=>{b({title:`${h("common.restart")} ${t.meta.title}`,description:h("blocklet.action.restartDescription"),confirm:h("blocklet.action.confirmRestart"),cancel:h("common.cancel"),onConfirm:async()=>{C(!0),await m(t),C(!1)},onCancel:()=>b(null)})},disabled:R||L||k||t.status!=="running"},{icon:e.jsx(Ct,{}),text:h("common.delete"),onClick:()=>{d(!0)},disabled:L||k||!!M,tip:M},{separator:!0},{icon:e.jsx(Yt,{}),onClick:()=>{v(!0)},text:e.jsx(Vt,{color:"error",badgeContent:"",variant:"dot",invisible:!O.getComponentMissingConfigs(t,o[0]).length,children:e.jsx(y,{sx:{width:"100%"},children:h("common.config")})}),disabled:L||k}].filter(Boolean)})})]},"actions")]},"group-not-gateway-box"),e.jsx(Jt,{},"line"),e.jsx(kn,{componentInfo:g,onClose:p,blocklet:t,app:u,depth:s}),e.jsx(Tn,{blocklet:u,component:t,remove:B,onCancel:()=>d(!1),hideBtn:!0,showConfirm:S},"delete-component"),x&&e.jsx(Fe,{title:x.title,description:x.description,confirm:x.confirm,cancel:x.cancel,params:x.params,onConfirm:x.onConfirm,onCancel:x.onCancel},"confirm-setting"),c&&e.jsx(vt,{open:!0,hiddenChildren:!0,onClose:()=>v(!1),blocklet:t,ancestors:o})]})}ht.propTypes={blocklet:r.object.isRequired,ancestors:r.array,depth:r.number,onRemove:r.func,onStart:r.func,onStop:r.func,onRestart:r.func,getComponentUrl:r.func,app:r.object};ht.defaultProps={ancestors:[],depth:0,onRemove:()=>{},onStart:()=>{},onStop:()=>{},onRestart:()=>{},getComponentUrl:()=>window.location.origin,app:null};const Vt=F(xo)`
424
+ `;function No({blocklet:t,ancestors:o,mountPoint:s,href:a}){const[n,i]=f.useState(!1),[m,l]=f.useState(!1),[u,h]=f.useState(!1),[g,p]=f.useState(s),{api:S}=J(),d=!o.length,b=d?t.meta.did:o.map(c=>c.meta.did)[0];f.useEffect(()=>{l(!1),i(!1),h(!1)},[s]);const C=()=>{i(!1),l(!1),p(s)},x=async c=>{c.preventDefault(),h(!0),i(!1);try{const v={rootDid:b,mountPoint:ue(g)};d||(v.did=t.meta.did),await S.updateComponentMountPoint({input:v})}catch(v){throw h(!1),v.message=Z(v),A.error(v.message),v}},R=m?e.jsxs(y,{sx:{ml:1},children:[e.jsx($,{size:"medium",onMouseEnter:()=>i(!0),onMouseLeave:()=>i(!1),"data-cy":"edit-mount-point-submit",onClick:x,children:e.jsx(y,{component:Pe,icon:"material-symbols:done",sx:{color:"primary.main",transition:"0.3s opacity"}})}),e.jsx($,{size:"medium",onMouseEnter:()=>i(!0),onMouseLeave:()=>i(!1),onClick:C,children:e.jsx(y,{component:Pe,icon:"iconoir:cancel",sx:{color:"primary.main",transition:"0.3s opacity"}})})]}):e.jsx($,{size:"medium",onMouseEnter:()=>i(!0),onMouseLeave:()=>i(!1),onClick:()=>l(!0),children:e.jsx(y,{component:Pe,"data-cy":"edit-mount-point",icon:"lets-icons:edit-light",sx:{opacity:n?1:0,color:"primary.main",transition:"0.3s opacity"}})});return e.jsxs(y,{sx:{display:{xs:"none",md:"flex"}},alignItems:"center",flexGrow:"1",children:[m?e.jsx("form",{onSubmit:x,children:e.jsx(K,{style:{flex:1},fullWidth:!0,"data-cy":"edit-mount-point-input",value:g,onChange:c=>p(c.target.value),autoFocus:!0,size:"small",variant:"outlined",placeholder:s})}):e.jsx(y,{component:"a",target:"_blank",href:a,rel:"noopener noreferrer",title:a,onMouseEnter:()=>i(!0),onMouseLeave:()=>i(!1),children:e.jsx(y,{maxWidth:400,sx:{color:"secondary.main",fontSize:16,px:2},overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis",children:xs(s)})}),u?e.jsx(re,{size:20,sx:{ml:1}}):R]},s)}No.propTypes={mountPoint:r.string.isRequired,href:r.string.isRequired,blocklet:r.object.isRequired,ancestors:r.array.isRequired};const Ii=t=>{var o;return!((o=t==null?void 0:t.meta)!=null&&o.group)},co=(t,o)=>{const s=t.split("/").slice(1);let a=o,n=0;const i=[];for(;a&&n<s.length;){const m=a.children.find(l=>l.meta.did===s[n]);a=m,n++,m&&i.push(m.meta.title)}return i.join(" / ")};function ht({blocklet:t,ancestors:o,depth:s,onRemove:a,onStart:n,onStop:i,onRestart:m,getComponentUrl:l,app:u}){var q,Q,Ie;const{t:h}=f.useContext(Ce),[g,p]=f.useState(),[S,d]=f.useState(!1),[b,C]=f.useState(!1),[x,R]=f.useState(null),[c,v]=f.useState(!1),{deletingBlocklets:j}=Kt();let{status:T}=t;s===1&&j.includes(t.meta.did)&&(T="deleting");const I=`/${t.mountPoint||"/"}`.replace(/\/+/g,"/"),U=l(I),L=O.isInProgress(u.status),k=O.isInProgress(t.status);let M="";if(L||k||s===1&&j.includes(t.meta.did))M=h("blocklet.component.tip.stopBlocklet");else if((q=t.dependents)!=null&&q.length){const te=t.dependents.filter(de=>de.required);if(te.length){const de=te.map(Se=>co(Se.id,u));M=h("blocklet.component.tip.requiredBy",{name:de.join(", ")})}}const B=async(...te)=>{C(!0);try{await a(...te)}catch{}C(!1),d(!1)};return e.jsxs(e.Fragment,{children:[e.jsxs(Un,{display:"flex",py:2,className:"component-item",justifyContent:"flex-start",alignItems:"center",children:[e.jsxs(y,{pl:2,width:{xs:300,md:400},display:"flex",alignItems:"center",children:[e.jsx(vr,{blocklet:t,ancestors:o}),e.jsxs(y,{ml:"16px",children:[e.jsxs(y,{className:"component-header",onClick:()=>p(t),children:[e.jsx(y,{className:"component-name",children:O.getDisplayName(t,!0)}),e.jsx(y,{className:"component-version",children:(Q=t==null?void 0:t.meta)==null?void 0:Q.version})]}),e.jsxs(y,{display:"flex",alignItems:"center",sx:{mt:"2px",ml:-.5},children:[T!=="unknown"&&e.jsx(bo,{style:{marginLeft:4},status:T,source:t.source,progress:t.progress}),e.jsx(pr,{style:{marginLeft:4},mode:t.mode||""}),!!((Ie=t.dependents)!=null&&Ie.length)&&e.jsx(ve,{title:[`${h("common.dependents")}: `,t.dependents.map(te=>e.jsx(y,{pl:1,children:`${co(te.id,u)} ${te.required?`(${h("common.required")})`:""}`},te.id))],children:e.jsx(y,{display:"flex",color:"primary.main",ml:1,children:e.jsx(Pe,{icon:"octicon:package-dependents-16"})})})]})]})]},t),Ft.hasMountPoint(t.meta)&&e.jsx(No,{blocklet:t,ancestors:o,mountPoint:I,href:U},I),e.jsx("div",{style:{flex:1}}),e.jsxs(y,{display:"flex",alignItems:"center",children:[O.hasStartEngine(t.meta)&&e.jsx(ve,{title:h("common.visit"),children:e.jsx(y,{component:"a",sx:{display:{xs:"flex",md:"none"}},target:"_blank",href:U,rel:"noopener noreferrer",children:e.jsx($,{size:"small",children:e.jsx(So,{})})})}),e.jsx(wn,{blocklet:u,component:t,onStart:n,onStop:i,disabled:!["starting","stopping"].includes(u.status)&&O.isInProgress(u.status)}),e.jsx(qt,{color:"error",badgeContent:"",variant:"dot",invisible:!O.getComponentMissingConfigs(t,o[0]).length,children:e.jsx(Ro,{"data-cy":"component-actions",actions:[O.hasStartEngine(t.meta)||Ii(t)?{icon:e.jsx(Cr,{}),text:h("common.detail"),onClick:()=>{p(t)}}:null,{icon:e.jsx(Ns,{}),text:h("common.restart"),onClick:()=>{R({title:`${h("common.restart")} ${t.meta.title}`,description:h("blocklet.action.restartDescription"),confirm:h("blocklet.action.confirmRestart"),cancel:h("common.cancel"),onConfirm:async()=>{C(!0),await m(t),C(!1)},onCancel:()=>R(null)})},disabled:b||L||k||t.status!=="running"},{icon:e.jsx(Ct,{}),text:h("common.delete"),onClick:()=>{d(!0)},disabled:L||k||!!M,tip:M},{separator:!0},{icon:e.jsx(Yt,{}),onClick:()=>{v(!0)},text:e.jsx(qt,{color:"error",badgeContent:"",variant:"dot",invisible:!O.getComponentMissingConfigs(t,o[0]).length,children:e.jsx(y,{sx:{width:"100%"},children:h("common.config")})}),disabled:L||k}].filter(Boolean)})})]},"actions")]},"group-not-gateway-box"),e.jsx(Jt,{},"line"),e.jsx(kn,{componentInfo:g,onClose:p,blocklet:t,app:u,depth:s}),e.jsx(Tn,{blocklet:u,component:t,remove:B,onCancel:()=>d(!1),hideBtn:!0,showConfirm:S},"delete-component"),x&&e.jsx(Fe,{title:x.title,description:x.description,confirm:x.confirm,cancel:x.cancel,params:x.params,onConfirm:x.onConfirm,onCancel:x.onCancel},"confirm-setting"),c&&e.jsx(vt,{open:!0,hiddenChildren:!0,onClose:()=>v(!1),blocklet:t,ancestors:o})]})}ht.propTypes={blocklet:r.object.isRequired,ancestors:r.array,depth:r.number,onRemove:r.func,onStart:r.func,onStop:r.func,onRestart:r.func,getComponentUrl:r.func,app:r.object};ht.defaultProps={ancestors:[],depth:0,onRemove:()=>{},onStart:()=>{},onStop:()=>{},onRestart:()=>{},getComponentUrl:()=>window.location.origin,app:null};const qt=F(xo)`
425
425
  .BaseBadge-badge {
426
426
  top: ${t=>t.top*8||6}px;
427
427
  right: ${t=>t.right*8||6}px;
@@ -489,7 +489,7 @@ import{bK as zo,j as e,aK as qt,aL as _t,q as z,O as y,ax as ve,P as r,A,bk as J
489
489
  margin-left: 4px;
490
490
  transform: translateY(-1px);
491
491
  }
492
- `;function Bn({blocklet:t,onUpdate:o,getComponentUrl:s,...a}){var q;const{t:n}=f.useContext(Ce),{api:i,inService:m,info:l}=J(),{addDeletingDid:u,removeDeletingDid:h,matchDeletingDid:g}=Kt(),[p,S]=f.useState(!1),[d,R]=f.useState(null),[C,x]=f.useState(null),[b,c]=f.useState(!1),[v,j]=f.useState(!1),[T,I]=f.useState(!1),[U,L]=f.useState(null),k=t&&t.structVersion!==D.APP_STRUCT_VERSION,[M,B]=f.useState(!1),V=[...t.children];t.meta.group!=="gateway"&&V.unshift(t),g(V.map(w=>w.meta.did));const Q=async()=>{if(!p){S(!0);try{const{updateId:w,updateList:_}=(await i.checkComponentsForUpdates({input:{did:t.meta.did}})).preUpdateInfo||{};if(S(!1),!w){A.info(n("blocklet.component.noUpdate"));return}const oe=[];O.forEachChildSync(t,(se,{id:Ge,ancestors:Y})=>{const H=_.find(Re=>Re.id===Ge);if(H){const Re=Y.slice(1).concat(se).map(Ue=>Ue.meta.title||Ue.meta.name).join(" / "),ze=(Y[1]||se).meta.did;oe.push({groupId:ze,name:Re,version:se.meta.version,newVersion:H.meta.version})}});const xe={};oe.forEach(se=>{xe[se.groupId]?se.disabled=!0:xe[se.groupId]=!0}),R({params:{updateId:w},list:oe,checks:xe,hasChecks:!0})}catch(w){S(!1),A.error(Z(w))}}},Ie=async()=>{if(!p)try{S(!0);const w=Object.keys(d.checks).filter(oe=>d.checks[oe]),_={updateId:d.params.updateId,rootDid:t.meta.did,selectedComponents:w};await i.upgradeComponents({input:_}),S(!1),R(null),B(null)}catch(w){S(!1),A.error(Z(w))}},te=async(w,_)=>{u(w.meta.did);try{await i.deleteComponent({input:{did:w.meta.did,keepData:_==="keepData",rootDid:t.meta.did}}),await Ye(800)}catch(oe){A.error(Z(oe)),h(w.meta.did)}},de=async w=>{try{await i.startBlocklet({input:{did:t.meta.did,componentDids:[w.meta.did]}}),await Ye(800)}catch(_){A.error(Z(_))}},Se=async w=>{try{await i.stopBlocklet({input:{did:t.meta.did,componentDids:[w.meta.did]}}),await Ye(800)}catch(_){A.error(Z(_))}},P=async w=>{try{await i.restartBlocklet({input:{did:t.meta.did,componentDids:[w.meta.did]}}),await Ye(800)}catch(_){A.error(Z(_))}},ke=(w,_)=>{const{checked:oe}=w.target;R(xe=>{const se=Object.entries(xe.checks).reduce((Y,[H,Re])=>(Y[H]=_===H?oe:Re,Y),{}),Ge=Object.values(se).includes(!0);return{...xe,checks:se,hasChecks:Ge}})};Cs(Q);const me=gi({blocklet:t,scrollToComponent:!0}),Ze=U||me;return e.jsxs(Ui,{component:"div",...a,children:[e.jsxs(Di,{display:"flex",children:[e.jsxs(Bi,{flexDirection:"row",className:"title",display:"flex",alignItems:"center",children:[V!=null&&V.length?`${n("common.components")} (${V.length})`:`${n("common.components")}`,!k&&e.jsx(Mt,{permission:m?"":"mutate_blocklets",role:m?Oe:[],children:e.jsx(Xt,{children:e.jsx(Vt,{top:1.2,right:.4,color:"error",badgeContent:"",variant:"dot",invisible:!M,children:e.jsxs(ne,{disabled:p||O.isInProgress(t.status),color:"secondary",onClick:()=>{Q()},"data-cy":"check-for-updates",children:[e.jsx(y,{ml:.5,mr:.5,display:"flex",children:p?e.jsx(re,{size:16}):e.jsx(Eo,{style:{fontSize:"1em"}})}),n("blocklet.component.checkUpdateTitle")]})})})})]}),e.jsx(Mt,{permission:m?"":"mutate_blocklets",role:m?Oe:[],children:e.jsxs(y,{display:"flex",alignItems:"center",children:[!k&&e.jsx(vn,{blocklet:t,serverVersion:l.version,children:({open:w})=>e.jsxs(ne,{disabled:p||O.isInProgress(t.status),variant:"text",color:"primary","data-cy":"add-component",className:"sm-hide-icon",onClick:w,children:[e.jsx(Rs,{style:{fontSize:"1.3em",marginRight:4}}),n("blocklet.component.add")]})}),e.jsx(bo,{"data-cy":"component-actions",actions:[{icon:e.jsx(Pe,{icon:"fluent:link-20-filled"}),onClick:()=>j(!0),text:n("router.rule.add.title"),disabled:p||O.isInProgress(t.status)},!k&&{icon:e.jsx(Yt,{}),text:`${n("blocklet.component.container")}`,onClick:()=>I(!0)}].filter(Boolean)})]})})]}),V!=null&&V.length?e.jsxs(e.Fragment,{children:[e.jsxs(y,{mt:2,children:[t.meta.group!=="gateway"&&e.jsx(ht,{blocklet:t,app:t,onRemove:te,onStart:de,onStop:Se,onRestart:P,getComponentUrl:s},`0-${t.meta.did}`),t.children.map(w=>e.jsx(ht,{depth:1,blocklet:w,ancestors:[t],app:t,onRemove:te,onStart:de,onStop:Se,onRestart:P,getComponentUrl:s},`1-${w.meta.did}`))]},`top-blocklet-${t.meta.did}`),(q=t.optionalComponents)==null?void 0:q.map(w=>e.jsx(Un,{children:e.jsx(Dn,{setInstallComponentMeta:L,...w})},w.meta.did))]}):e.jsx(y,{mt:8,children:e.jsx(ks,{children:n("blocklet.component.noComponent")})}),!!t.site.rules.length&&e.jsx(y,{sx:{mt:0,".component-item__indent":{pl:2,width:0}},children:e.jsx(hi,{})}),!!d&&e.jsx(Yn,{open:!0,fullWidth:!0,children:e.jsxs(y,{paddingY:1.5,children:[e.jsx(Jn,{children:n("blocklet.component.updateTitle")}),e.jsx(y,{component:Kn,py:4,children:d.list.map(w=>e.jsxs(y,{display:"flex",alignItems:"center",children:[e.jsx(js,{checked:d.checks[w.groupId],onChange:_=>ke(_,w.groupId),style:{marginLeft:w.disabled?16:0},defaultChecked:!0,disabled:w.disabled}),e.jsxs(y,{flexGrow:1,mt:3,children:[e.jsx(y,{item:!0,xs:8,children:w.name}),w.version&&e.jsxs(at,{fontSize:"h6.fontSize",container:!0,spacing:2,alignItems:"center",children:[e.jsx(at,{item:!0,xs:3,children:w.version}),e.jsx(at,{item:!0,xs:1,children:e.jsx(Is,{style:{fontSize:"0.9em"}})}),e.jsx(at,{item:!0,xs:3,children:e.jsx(y,{color:"secondary.main",children:w.newVersion})})]})]},`${w.name}-${w.newVersion}`)]},w.name))}),e.jsxs(vs,{style:{padding:"8px 24px 24px"},children:[e.jsx(ne,{onClick:()=>{R(null)},children:n("common.cancel")}),e.jsxs(ne,{onClick:w=>{w.stopPropagation(),Ie()},color:"primary",disabled:p||!d.hasChecks,variant:"contained",autoFocus:!0,children:[p&&e.jsx(re,{size:16}),n("common.update")]})]})]})}),!!C&&e.jsx(Yn,{open:!0,fullWidth:!0,onClose:()=>x(!1),children:e.jsxs(y,{paddingY:1.5,children:[e.jsx(Jn,{children:n("common.configuration")}),e.jsx(Kn,{children:e.jsx(y,{py:2,children:e.jsx(zt,{control:e.jsx(Sr,{checked:b,onChange:w=>c(!!w.target.checked)}),label:n("blocklet.component.showContainer")})})})]})}),e.jsx(St,{selectedMeta:Ze,blocklet:t,showDialog:!!Ze,setShowDialog:()=>L(null)}),v&&e.jsx(Sn,{hiddenChildren:!0,open:!0,onClose:()=>j(!1)}),T&&e.jsx(vt,{open:!0,onClose:()=>I(!1),hiddenChildren:!0,blocklet:t,ancestors:[]})]})}Bn.propTypes={blocklet:r.object.isRequired,onUpdate:r.func,getComponentUrl:r.func};Bn.defaultProps={onUpdate:()=>{},getComponentUrl:()=>window.location.origin};const Ui=F.div`
492
+ `;function Bn({blocklet:t,onUpdate:o,getComponentUrl:s,...a}){var V;const{t:n}=f.useContext(Ce),{api:i,inService:m,info:l}=J(),{addDeletingDid:u,removeDeletingDid:h,matchDeletingDid:g}=Kt(),[p,S]=f.useState(!1),[d,b]=f.useState(null),[C,x]=f.useState(null),[R,c]=f.useState(!1),[v,j]=f.useState(!1),[T,I]=f.useState(!1),[U,L]=f.useState(null),k=t&&t.structVersion!==D.APP_STRUCT_VERSION,[M,B]=f.useState(!1),q=[...t.children];t.meta.group!=="gateway"&&q.unshift(t),g(q.map(w=>w.meta.did));const Q=async()=>{if(!p){S(!0);try{const{updateId:w,updateList:_}=(await i.checkComponentsForUpdates({input:{did:t.meta.did}})).preUpdateInfo||{};if(S(!1),!w){A.info(n("blocklet.component.noUpdate"));return}const oe=[];O.forEachChildSync(t,(se,{id:Ge,ancestors:Y})=>{const H=_.find(be=>be.id===Ge);if(H){const be=Y.slice(1).concat(se).map(Ue=>Ue.meta.title||Ue.meta.name).join(" / "),ze=(Y[1]||se).meta.did;oe.push({groupId:ze,name:be,version:se.meta.version,newVersion:H.meta.version})}});const xe={};oe.forEach(se=>{xe[se.groupId]?se.disabled=!0:xe[se.groupId]=!0}),b({params:{updateId:w},list:oe,checks:xe,hasChecks:!0})}catch(w){S(!1),A.error(Z(w))}}},Ie=async()=>{if(!p)try{S(!0);const w=Object.keys(d.checks).filter(oe=>d.checks[oe]),_={updateId:d.params.updateId,rootDid:t.meta.did,selectedComponents:w};await i.upgradeComponents({input:_}),S(!1),b(null),B(null)}catch(w){S(!1),A.error(Z(w))}},te=async(w,_)=>{u(w.meta.did);try{await i.deleteComponent({input:{did:w.meta.did,keepData:_==="keepData",rootDid:t.meta.did}}),await Ye(800)}catch(oe){A.error(Z(oe)),h(w.meta.did)}},de=async w=>{try{await i.startBlocklet({input:{did:t.meta.did,componentDids:[w.meta.did]}}),await Ye(800)}catch(_){A.error(Z(_))}},Se=async w=>{try{await i.stopBlocklet({input:{did:t.meta.did,componentDids:[w.meta.did]}}),await Ye(800)}catch(_){A.error(Z(_))}},P=async w=>{try{await i.restartBlocklet({input:{did:t.meta.did,componentDids:[w.meta.did]}}),await Ye(800)}catch(_){A.error(Z(_))}},ke=(w,_)=>{const{checked:oe}=w.target;b(xe=>{const se=Object.entries(xe.checks).reduce((Y,[H,be])=>(Y[H]=_===H?oe:be,Y),{}),Ge=Object.values(se).includes(!0);return{...xe,checks:se,hasChecks:Ge}})};Cs(Q);const me=gi({blocklet:t,scrollToComponent:!0}),Ze=U||me;return e.jsxs(Ui,{component:"div",...a,children:[e.jsxs(Di,{display:"flex",children:[e.jsxs(Bi,{flexDirection:"row",className:"title",display:"flex",alignItems:"center",children:[q!=null&&q.length?`${n("common.components")} (${q.length})`:`${n("common.components")}`,!k&&e.jsx(Mt,{permission:m?"":"mutate_blocklets",role:m?Oe:[],children:e.jsx(Xt,{children:e.jsx(qt,{top:1.2,right:.4,color:"error",badgeContent:"",variant:"dot",invisible:!M,children:e.jsxs(ne,{disabled:p||O.isInProgress(t.status),color:"secondary",onClick:()=>{Q()},"data-cy":"check-for-updates",children:[e.jsx(y,{ml:.5,mr:.5,display:"flex",children:p?e.jsx(re,{size:16}):e.jsx(Eo,{style:{fontSize:"1em"}})}),n("blocklet.component.checkUpdateTitle")]})})})})]}),e.jsx(Mt,{permission:m?"":"mutate_blocklets",role:m?Oe:[],children:e.jsxs(y,{display:"flex",alignItems:"center",children:[!k&&e.jsx(vn,{blocklet:t,serverVersion:l.version,children:({open:w})=>e.jsxs(ne,{disabled:p||O.isInProgress(t.status),variant:"text",color:"primary","data-cy":"add-component",className:"sm-hide-icon",onClick:w,children:[e.jsx(bs,{style:{fontSize:"1.3em",marginRight:4}}),n("blocklet.component.add")]})}),e.jsx(Ro,{"data-cy":"component-actions",actions:[{icon:e.jsx(Pe,{icon:"fluent:link-20-filled"}),onClick:()=>j(!0),text:n("router.rule.add.title"),disabled:p||O.isInProgress(t.status)},!k&&{icon:e.jsx(Yt,{}),text:`${n("blocklet.component.container")}`,onClick:()=>I(!0)}].filter(Boolean)})]})})]}),q!=null&&q.length?e.jsxs(e.Fragment,{children:[e.jsxs(y,{mt:2,children:[t.meta.group!=="gateway"&&e.jsx(ht,{blocklet:t,app:t,onRemove:te,onStart:de,onStop:Se,onRestart:P,getComponentUrl:s},`0-${t.meta.did}`),t.children.map(w=>e.jsx(ht,{depth:1,blocklet:w,ancestors:[t],app:t,onRemove:te,onStart:de,onStop:Se,onRestart:P,getComponentUrl:s},`1-${w.meta.did}`))]},`top-blocklet-${t.meta.did}`),(V=t.optionalComponents)==null?void 0:V.map(w=>e.jsx(Un,{children:e.jsx(Dn,{setInstallComponentMeta:L,...w})},w.meta.did))]}):e.jsx(y,{mt:8,children:e.jsx(ks,{children:n("blocklet.component.noComponent")})}),!!t.site.rules.length&&e.jsx(y,{sx:{mt:0,".component-item__indent":{pl:2,width:0}},children:e.jsx(hi,{})}),!!d&&e.jsx(Yn,{open:!0,fullWidth:!0,children:e.jsxs(y,{paddingY:1.5,children:[e.jsx(Jn,{children:n("blocklet.component.updateTitle")}),e.jsx(y,{component:Kn,py:4,children:d.list.map(w=>e.jsxs(y,{display:"flex",alignItems:"center",children:[e.jsx(js,{checked:d.checks[w.groupId],onChange:_=>ke(_,w.groupId),style:{marginLeft:w.disabled?16:0},defaultChecked:!0,disabled:w.disabled}),e.jsxs(y,{flexGrow:1,mt:3,children:[e.jsx(y,{item:!0,xs:8,children:w.name}),w.version&&e.jsxs(at,{fontSize:"h6.fontSize",container:!0,spacing:2,alignItems:"center",children:[e.jsx(at,{item:!0,xs:3,children:w.version}),e.jsx(at,{item:!0,xs:1,children:e.jsx(Is,{style:{fontSize:"0.9em"}})}),e.jsx(at,{item:!0,xs:3,children:e.jsx(y,{color:"secondary.main",children:w.newVersion})})]})]},`${w.name}-${w.newVersion}`)]},w.name))}),e.jsxs(vs,{style:{padding:"8px 24px 24px"},children:[e.jsx(ne,{onClick:()=>{b(null)},children:n("common.cancel")}),e.jsxs(ne,{onClick:w=>{w.stopPropagation(),Ie()},color:"primary",disabled:p||!d.hasChecks,variant:"contained",autoFocus:!0,children:[p&&e.jsx(re,{size:16}),n("common.update")]})]})]})}),!!C&&e.jsx(Yn,{open:!0,fullWidth:!0,onClose:()=>x(!1),children:e.jsxs(y,{paddingY:1.5,children:[e.jsx(Jn,{children:n("common.configuration")}),e.jsx(Kn,{children:e.jsx(y,{py:2,children:e.jsx(zt,{control:e.jsx(Sr,{checked:R,onChange:w=>c(!!w.target.checked)}),label:n("blocklet.component.showContainer")})})})]})}),e.jsx(St,{selectedMeta:Ze,blocklet:t,showDialog:!!Ze,setShowDialog:()=>L(null)}),v&&e.jsx(Sn,{hiddenChildren:!0,open:!0,onClose:()=>j(!1)}),T&&e.jsx(vt,{open:!0,onClose:()=>I(!1),hiddenChildren:!0,blocklet:t,ancestors:[]})]})}Bn.propTypes={blocklet:r.object.isRequired,onUpdate:r.func,getComponentUrl:r.func};Bn.defaultProps={onUpdate:()=>{},getComponentUrl:()=>window.location.origin};const Ui=F.div`
493
493
  .title {
494
494
  font-size: 1.2rem;
495
495
  font-weight: bold;
@@ -527,4 +527,4 @@ import{bK as zo,j as e,aK as qt,aL as _t,q as z,O as y,ax as ve,P as r,A,bk as J
527
527
  width: 100%;
528
528
  justify-content: space-between;
529
529
  }
530
- `;function Ao(t){const{locale:o}=f.useContext(Ce),{blocklet:s,recommendedDomain:a}=Rr(),n=i=>Ss({blocklet:s,domain:{value:a},mountPoint:i,params:Ht(s,o)});return e.jsx(Bn,{blocklet:s,getComponentUrl:n,...t})}Ao.propTypes={};Ao.defaultProps={};export{Ao as default};
530
+ `;function Ao(t){const{locale:o}=f.useContext(Ce),{blocklet:s,recommendedDomain:a}=br(),n=i=>Ss({blocklet:s,domain:{value:a},mountPoint:i,params:Ht(s,o)});return e.jsx(Bn,{blocklet:s,getComponentUrl:n,...t})}Ao.propTypes={};Ao.defaultProps={};export{Ao as default};
@@ -1,4 +1,4 @@
1
- import{g as ze,X as We,n as P,O as S,Y as V,j as e,Z as ke,r as x,P as T,q as A,$ as he,a0 as ye,a1 as j,a2 as ee,a3 as Ge,A as M,K as Y,h as He,H as te,a4 as qe,m as $,T as Ve,a5 as Ye,a6 as Qe,B as U,D as Ke,C as be,w as Je,J as ve,a7 as Xe,a8 as Ze,a9 as et,u as I,f as tt,aa as W,t as Z,E as st,ab as se,z as Se,v as oe,ac as ot,W as re,i as je,x as Ce,y as Q,ad as rt,ae as nt,af as Pe,ag as at,b as B,ah as it,N as lt,ai as ct,Q as dt,aj as pt,ak as Re,al as Te,am as Ee,an as De,ao as Be,ap as N,aq as Ue,ar as Oe,as as _e,at as mt}from"./index-Ddq4jr_U.js";import{P as G,L as ht,A as ut,S as Ae,a as Fe}from"./index-BeATEtzy.js";import{A as ft,D as ne,u as xt,W as gt,P as wt,L as Le,d as $e,a as Ne}from"./wait-container-oqsX_-iJ.js";import{_ as ue}from"./useLocalStorage-BRZrZD2R.js";import{d as kt}from"./Launch-BRBdnw92.js";import{D as yt}from"./DeleteOutline-DWh2h-xw.js";import{g as bt,i as vt}from"./spaces-Ca83-jCl.js";import{T as St}from"./TextField-WEzwgjP0.js";import{i as fe}from"./isEqual-BQFT4gzY.js";import{d as jt}from"./MoreVert-0x6ZKOOm.js";import{E as Ct}from"./index-n9PgzTmH.js";import"./url-join-DIhz1PVb.js";import"./Skeleton-CDB0GyGY.js";import"./Close-C5A1sroQ.js";import"./lottie-Bqw4aFON.js";import"./DeleteOutline-DuzabIUt.js";import"./api-DgUgGcaK.js";import"./Select-CjUz8jvK.js";import"./InputLabel-Xa0HFZxn.js";var Pt=We;function Rt(t){return Pt(t).toLowerCase()}var Tt=Rt;const Et=ze(Tt);function ae({children:t,selected:r}){return e.jsxs(Dt,{children:[t,e.jsx(S,{className:`selected-container ${r?"selected":""}`,children:e.jsx(ke,{className:"selected-icon"})})]})}const Dt=P(S)`
1
+ import{g as ze,X as We,n as P,O as S,Y as V,j as e,Z as ke,r as x,P as T,q as A,$ as he,a0 as ye,a1 as j,a2 as ee,a3 as Ge,A as M,K as Y,h as He,H as te,a4 as qe,m as $,T as Ve,a5 as Ye,a6 as Qe,B as U,D as Ke,C as be,w as Je,J as ve,a7 as Xe,a8 as Ze,a9 as et,u as I,f as tt,aa as W,t as Z,E as st,ab as se,z as Se,v as oe,ac as ot,W as re,i as je,x as Ce,y as Q,ad as rt,ae as nt,af as Pe,ag as at,b as B,ah as it,N as lt,ai as ct,Q as dt,aj as pt,ak as Re,al as Te,am as Ee,an as De,ao as Be,ap as N,aq as Ue,ar as Oe,as as _e,at as mt}from"./index-CXlxAjbt.js";import{P as G,L as ht,A as ut,S as Ae,a as Fe}from"./index-Cb6algTF.js";import{A as ft,D as ne,u as xt,W as gt,P as wt,L as Le,d as $e,a as Ne}from"./wait-container-BPRlQTFB.js";import{_ as ue}from"./useLocalStorage-D6Mk1Qod.js";import{d as kt}from"./Launch-BNP89Oc8.js";import{D as yt}from"./DeleteOutline-DZhkyDfV.js";import{g as bt,i as vt}from"./spaces-BE4uA08l.js";import{T as St}from"./TextField-Cb0I13kb.js";import{i as fe}from"./isEqual-Bj8gRbdE.js";import{d as jt}from"./MoreVert-dIXJT0E2.js";import{E as Ct}from"./index-BijlUenA.js";import"./url-join-CRuOScTr.js";import"./Skeleton-bh5z66KF.js";import"./Close-CyRwkk-q.js";import"./lottie-DRE-Y506.js";import"./DeleteOutline-CddvKtlT.js";import"./api-BkA5hx89.js";import"./Select-Ck-rwnxI.js";import"./InputLabel-BTEO1M40.js";var Pt=We;function Rt(t){return Pt(t).toLowerCase()}var Tt=Rt;const Et=ze(Tt);function ae({children:t,selected:r}){return e.jsxs(Dt,{children:[t,e.jsx(S,{className:`selected-container ${r?"selected":""}`,children:e.jsx(ke,{className:"selected-icon"})})]})}const Dt=P(S)`
2
2
  position: relative;
3
3
 
4
4
  .selected-container {