@abtnode/webapp 1.16.45-beta-20250609-111118-0d252ebe → 1.16.45-beta-20250612-231219-481217be

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 (223) hide show
  1. package/blocklet.js +1 -1
  2. package/blocklet.yml +1 -1
  3. package/dist/assets/{AdapterDayjs-BqwbfR-J.js → AdapterDayjs-cAovH2Wn.js} +1 -1
  4. package/dist/assets/{Add-CSGWebd7.js → Add-CDNZP3_0.js} +1 -1
  5. package/dist/assets/{ArrowDropDown-BCCxOUNE.js → ArrowDropDown-DX4axGQA.js} +1 -1
  6. package/dist/assets/{Autocomplete-BRFoT1-d.js → Autocomplete-DpJFKWid.js} +1 -1
  7. package/dist/assets/{Breadcrumbs-B-xYTnoc.js → Breadcrumbs-DvU47lY-.js} +1 -1
  8. package/dist/assets/{ButtonGroup-ClVwTb7r.js → ButtonGroup-pRTDFJWg.js} +1 -1
  9. package/dist/assets/{CSSTransition-DpoNbm4c.js → CSSTransition-DwzJ0puV.js} +1 -1
  10. package/dist/assets/{CallMerge-weq4zXp-.js → CallMerge-C0f2EMe_.js} +1 -1
  11. package/dist/assets/{CardContent-CTAfwoUe.js → CardContent-0awZM1Ns.js} +1 -1
  12. package/dist/assets/{ChevronLeft-DQK-aqqz.js → ChevronLeft-ud_S8L4-.js} +1 -1
  13. package/dist/assets/{ChevronRight-BtkdX9A9.js → ChevronRight-B_-R2Sts.js} +1 -1
  14. package/dist/assets/{Clear-D0I7uWhD.js → Clear-B9P4WqAY.js} +1 -1
  15. package/dist/assets/{Close-6CxneLlA.js → Close-D_k500g1.js} +1 -1
  16. package/dist/assets/{Community-v2_SoLAO.js → Community-C1YZ_Fzm.js} +1 -1
  17. package/dist/assets/{Delete-P4B2dduO.js → Delete-CvkgpWXX.js} +1 -1
  18. package/dist/assets/{DeleteOutline-EQ9bHspP.js → DeleteOutline-C6-UDibg.js} +1 -1
  19. package/dist/assets/{Done-2EsU1aO2.js → Done-oo1eX6tp.js} +1 -1
  20. package/dist/assets/{Edit-frf3Fbx4.js → Edit-D2-hkmp_.js} +1 -1
  21. package/dist/assets/{ErrorOutline-a1DnwqoR.js → ErrorOutline-zNHQAP0N.js} +1 -1
  22. package/dist/assets/{HelpOutline-CBv7x3VM.js → HelpOutline-Dnfzivtx.js} +1 -1
  23. package/dist/assets/{Holiday-CM3JD4xm.js → Holiday-CiEfpBY3.js} +1 -1
  24. package/dist/assets/{Launch-B7fv6nTK.js → Launch-DVq2r1vu.js} +1 -1
  25. package/dist/assets/{Link-CiUEO3cQ.js → Link-CHQGWtG9.js} +1 -1
  26. package/dist/assets/{ListItemButton-ByIRcZGW.js → ListItemButton-LswuUKPc.js} +1 -1
  27. package/dist/assets/{ListSubheader-Yn3XMnVm.js → ListSubheader-Dqc3XTI_.js} +1 -1
  28. package/dist/assets/{LoadingButton-B3es9INs.js → LoadingButton-BlJTr1LL.js} +1 -1
  29. package/dist/assets/{LockIcon-C1gL9Uz4.js → LockIcon-DvcB90iN.js} +1 -1
  30. package/dist/assets/{Meeting-BkxfSXYG.js → Meeting-Bt1FEapI.js} +1 -1
  31. package/dist/assets/{MoreHoriz-3d6Yp_t-.js → MoreHoriz-CQaja3QI.js} +1 -1
  32. package/dist/assets/{MoreVert-C_Ck3fn9.js → MoreVert-Ca16Cnof.js} +1 -1
  33. package/dist/assets/{OffSick-Z9k6qoex.js → OffSick-HYKiIDQw.js} +1 -1
  34. package/dist/assets/{OpenInNew-D79h4Iot.js → OpenInNew-CysIURb4.js} +1 -1
  35. package/dist/assets/{Public-BtS6bdiD.js → Public-D4TSC2Ib.js} +1 -1
  36. package/dist/assets/{Refresh-C1kA8imS.js → Refresh-BNaUmDFT.js} +1 -1
  37. package/dist/assets/{SchemaReference.es-Dfqhb0uS.js → SchemaReference.es-GR-_9bfJ.js} +1 -1
  38. package/dist/assets/{Search-CUm1f8xo.js → Search-BqZFZ5g2.js} +1 -1
  39. package/dist/assets/{Slider-B0hY7ZYB.js → Slider-DkRYH92J.js} +1 -1
  40. package/dist/assets/{Stepper-CEe-v4P_.js → Stepper-DEgX4GTY.js} +1 -1
  41. package/dist/assets/{Switch-D3iZUzda.js → Switch-SGjalYgz.js} +1 -1
  42. package/dist/assets/{TableRow-CQ8RBtid.js → TableRow-D2EIvRB_.js} +1 -1
  43. package/dist/assets/{TableSearch-Uk9kIt7i.js → TableSearch-CAvitNOv.js} +1 -1
  44. package/dist/assets/{ToggleButtonGroup-BrZT8OFC.js → ToggleButtonGroup-BUQPuDr0.js} +1 -1
  45. package/dist/assets/{Verified-DjfvSM3n.js → Verified-CLwd2p1i.js} +1 -1
  46. package/dist/assets/{VerifiedUser-CGB9pAg5.js → VerifiedUser-BlbKkPqo.js} +1 -1
  47. package/dist/assets/{ViewColumn-CcQluqhl.js → ViewColumn-CxnzgopE.js} +1 -1
  48. package/dist/assets/{ViewList-CPkfx4gI.js → ViewList-Dq8vu1UD.js} +1 -1
  49. package/dist/assets/{WorkingRemotely-BMx519Rn.js → WorkingRemotely-C4WjSs8k.js} +1 -1
  50. package/dist/assets/{_createAggregator-Dp2y-Mf_.js → _createAggregator-C775jKSl.js} +1 -1
  51. package/dist/assets/{actions-C8ldDfDc.js → actions-CWQtNrcD.js} +1 -1
  52. package/dist/assets/{actions-CvZtuIOm.js → actions-Dq6DDwe2.js} +1 -1
  53. package/dist/assets/{agreement-4TUvZhY3.js → agreement-DCQc_rAP.js} +1 -1
  54. package/dist/assets/api-DwcaKz2E.js +1 -0
  55. package/dist/assets/{appearance-CztLZ35g.js → appearance-Bp-lCdSt.js} +1 -1
  56. package/dist/assets/ar-D9QEDjY-.js +7 -0
  57. package/dist/assets/{audit-logs-vnwtSLPp.js → audit-logs-CjK3Z08k.js} +1 -1
  58. package/dist/assets/{base-chart-tXWghrta.js → base-chart-YZwnGzYD.js} +1 -1
  59. package/dist/assets/{blocklet-SKmr21o8.js → blocklet-3SnK_ln7.js} +1 -1
  60. package/dist/assets/{brace-fold.es-C8hYDu8C.js → brace-fold.es-BNQlG2nr.js} +1 -1
  61. package/dist/assets/{chain-Cw3CxpIJ.js → chain-B90dDCGq.js} +1 -1
  62. package/dist/assets/{click-to-copy-BBcwV5Sv.js → click-to-copy-a5cMFI-_.js} +1 -1
  63. package/dist/assets/cloneDeep-BmfjF8bM.js +1 -0
  64. package/dist/assets/{closebrackets.es-n7j2YaKC.js → closebrackets.es-CXG4Cd3e.js} +1 -1
  65. package/dist/assets/{codemirror.es-q3z3D3fp.js → codemirror.es-B3B1JR3x.js} +1 -1
  66. package/dist/assets/{collapse-Cy01Qhtt.js → collapse-C2nB1Q0B.js} +1 -1
  67. package/dist/assets/{comment.es-CZaW3Zjc.js → comment.es-BzZcNo5B.js} +1 -1
  68. package/dist/assets/{config-navigation-B4iEyuxN.js → config-navigation-BN6zZFyV.js} +3 -3
  69. package/dist/assets/{connect-to-BbdcjX_x.js → connect-to-CmhbEEvA.js} +1 -1
  70. package/dist/assets/{de-Dv_ApqsF.js → de-BOa43YBF.js} +2 -2
  71. package/dist/assets/{delete-confirm-qy4uClf5.js → delete-confirm-m56IXxYG.js} +1 -1
  72. package/dist/assets/{detail-C_SIxTEY.js → detail-BlHIoIDp.js} +3 -3
  73. package/dist/assets/{dialog.es-BEBI39yG.js → dialog.es-C42Mil04.js} +1 -1
  74. package/dist/assets/{domains-Bql4UA4y.js → domains-CeBkVCNd.js} +2 -2
  75. package/dist/assets/{download-DdDp7qNF.js → download-Bh0sNo9s.js} +1 -1
  76. package/dist/assets/emotion-react.browser.esm-CorLywyT.js +1 -0
  77. package/dist/assets/es-A3ma-OJp.js +9 -0
  78. package/dist/assets/{foldgutter.es-XJVlfA9j.js → foldgutter.es-Jx2Yn3Ns.js} +1 -1
  79. package/dist/assets/fr-I3xKp6I5.js +7 -0
  80. package/dist/assets/{get-safe-url-BHhOK-87.js → get-safe-url-CXFJ7HE5.js} +1 -1
  81. package/dist/assets/{get-safe-url-ZQAisLez.js → get-safe-url-t5_KGb1I.js} +1 -1
  82. package/dist/assets/getValidReactChildren-DuVu0i0i.js +1 -0
  83. package/dist/assets/{hi-Dqbq8i5Y.js → hi-DacRhM8A.js} +1 -1
  84. package/dist/assets/{hint.es-BXYnqh_9.js → hint.es-BoFboqfs.js} +1 -1
  85. package/dist/assets/{hint.es2-mCmWTcSI.js → hint.es2-C9gyljNf.js} +1 -1
  86. package/dist/assets/{id-Bxr8o3Uo.js → id-B7LQAHL7.js} +3 -3
  87. package/dist/assets/{iframe-CVde2I2R.js → iframe-AXVHNW_k.js} +1 -1
  88. package/dist/assets/{index-DzK6OW-H.js → index-4WVfl35V.js} +1 -1
  89. package/dist/assets/{index-DzWDWvao.js → index-B-k7ViK0.js} +1 -1
  90. package/dist/assets/{index-B37Lr7Hg.js → index-B0jcX1RF.js} +1 -1
  91. package/dist/assets/{index-DzcmC4If.js → index-B2F1vMBv.js} +4 -4
  92. package/dist/assets/{index-BkStkax6.js → index-B7K9oQOc.js} +2 -2
  93. package/dist/assets/{index-DNFAdenj.js → index-BA9uj90I.js} +1 -1
  94. package/dist/assets/{index-CIeEDIRZ.js → index-BBjq0j2v.js} +1 -1
  95. package/dist/assets/{index-CEr4LN-P.js → index-BEKDshjS.js} +1 -1
  96. package/dist/assets/{index-Cm6VrPFr.js → index-BGgjrqZC.js} +1 -1
  97. package/dist/assets/{index-BUWOtFDP.js → index-BHBEV8r4.js} +1 -1
  98. package/dist/assets/{index-DTb1YjkO.js → index-BXOD69ua.js} +83 -83
  99. package/dist/assets/{index-CCGiAGPb.js → index-BY88k43C.js} +1 -1
  100. package/dist/assets/{index-CFc2cpAq.js → index-BZeeqqFX.js} +1 -1
  101. package/dist/assets/{index-uw3m84Z2.js → index-Ba15C891.js} +1 -1
  102. package/dist/assets/{index-BKpBz5IS.js → index-BbubXXOK.js} +1 -1
  103. package/dist/assets/{index-omP-_XYV.js → index-C0MwD3ew.js} +1 -1
  104. package/dist/assets/{index-BublfAf3.js → index-CEuPYhl0.js} +1 -1
  105. package/dist/assets/{index-BQOOINkR.js → index-CGpLBTuz.js} +1 -1
  106. package/dist/assets/{index-B6YLm2gY.js → index-CJTCcEXc.js} +1 -1
  107. package/dist/assets/{index-Dg-nEXIR.js → index-CTMjLXVv.js} +1 -1
  108. package/dist/assets/{index-DM5TK3mI.js → index-Ca4fyQU9.js} +1 -1
  109. package/dist/assets/{index-wKRUqEyT.js → index-Cim0AD_y.js} +2 -2
  110. package/dist/assets/{index-D3OlVE0m.js → index-CknB_y2G.js} +1 -1
  111. package/dist/assets/index-Clkrz3Dv.js +41 -0
  112. package/dist/assets/{index-C_5on_zt.js → index-CpywGtnH.js} +1 -1
  113. package/dist/assets/{index-DdAt9jDT.js → index-Cs16EI2i.js} +1 -1
  114. package/dist/assets/{index-BDHvuJA-.js → index-CwcDS29n.js} +5 -5
  115. package/dist/assets/index-D1tieyaZ.js +1 -0
  116. package/dist/assets/{index-Ds-ruyy-.js → index-DDI2W4Tb.js} +1 -1
  117. package/dist/assets/{index-ChSMfUDl.js → index-DGqCsVmc.js} +10 -10
  118. package/dist/assets/{index-DsdaIM1E.js → index-DKeeqPhh.js} +4 -4
  119. package/dist/assets/{index-CViyZjZs.js → index-DNdIaDLR.js} +1 -1
  120. package/dist/assets/{index-DVT--CtL.js → index-DQvxOUyW.js} +3 -3
  121. package/dist/assets/{index-BILcrV-b.js → index-DV2t0rB2.js} +1 -1
  122. package/dist/assets/{index-DTnnZgV3.js → index-DVVxcn_U.js} +1 -1
  123. package/dist/assets/index-DW-mbKeK.js +236 -0
  124. package/dist/assets/{index-BWpZKV7G.js → index-DXbn94TQ.js} +3 -3
  125. package/dist/assets/{index-B6gCUDLy.js → index-Dd8tfIXz.js} +1 -1
  126. package/dist/assets/{index-C562LNdR.js → index-DdwYTOhS.js} +9 -9
  127. package/dist/assets/{index-BLrsx8oH.js → index-DfVhmhNU.js} +1 -1
  128. package/dist/assets/{index-DnLtwT4P.js → index-Dhx2XMvi.js} +1 -1
  129. package/dist/assets/{index-CPBAco4X.js → index-MCMqKG1X.js} +1 -1
  130. package/dist/assets/{index-ooFvSbXR.js → index-NOETvacG.js} +1 -1
  131. package/dist/assets/{index-DRvnuna9.js → index-Vj6hcvqX.js} +1 -1
  132. package/dist/assets/{index-CyCivdc5.js → index-VoBTA_fx.js} +1 -1
  133. package/dist/assets/{index-CZplOWEN.js → index-gYWDzVZB.js} +1 -1
  134. package/dist/assets/{index-C-QDjEC-.js → index-kMvGy1BT.js} +1 -1
  135. package/dist/assets/{index.esm-CB-7UGfI.js → index.esm-S1RHFvfU.js} +1 -1
  136. package/dist/assets/{info-addon.es-DKtNhOCh.js → info-addon.es-BrPERxwM.js} +1 -1
  137. package/dist/assets/{info.es-B7YFO8O9.js → info.es-BG627Djn.js} +1 -1
  138. package/dist/assets/{install-from-url-B9F0r0Uk.js → install-from-url-Kt3o4LBx.js} +1 -1
  139. package/dist/assets/{invitation-BAovnHWT.js → invitation-w4SAH9iP.js} +1 -1
  140. package/dist/assets/is-path-prefix-equal-B5zOew9j.js +1 -0
  141. package/dist/assets/item-B-caRYba.js +277 -0
  142. package/dist/assets/{ja-CJfcqkdo.js → ja-DRQ4Eecl.js} +3 -1
  143. package/dist/assets/{javascript.es-e4wfmIpw.js → javascript.es-BEqQG-X0.js} +1 -1
  144. package/dist/assets/{jump-to-line.es-D1zAOCng.js → jump-to-line.es-K-qNaz4d.js} +1 -1
  145. package/dist/assets/{jump.es-CR1apnMt.js → jump.es-TG1mfYt_.js} +1 -1
  146. package/dist/assets/{ko-BxAazRix.js → ko-CzL3UzwL.js} +3 -1
  147. package/dist/assets/{lint.es-po0cvpDF.js → lint.es-CXlTl58k.js} +1 -1
  148. package/dist/assets/{lint.es2-CIRlGKEU.js → lint.es2-6L_OlSQy.js} +1 -1
  149. package/dist/assets/{lint.es3-CC5QXby4.js → lint.es3-D-7-u1za.js} +1 -1
  150. package/dist/assets/{list-header-D5Klosqn.js → list-header-B8ysM0r4.js} +1 -1
  151. package/dist/assets/{log-DvWjHRjx.js → log-0actLjpa.js} +1 -1
  152. package/dist/assets/{lottie-react.esm-CzS4D97g.js → lottie-react.esm-PsK3z7dD.js} +1 -1
  153. package/dist/assets/{matchbrackets.es-Bh__cUPA.js → matchbrackets.es-DvOANBOF.js} +1 -1
  154. package/dist/assets/{memory-VuyFpRX6.js → memory-Dk-Khjf8.js} +1 -1
  155. package/dist/assets/{metric-sJIuzFdD.js → metric-7dzLcQP8.js} +1 -1
  156. package/dist/assets/{mode.es-b4PvmWPj.js → mode.es-BCPKj5xj.js} +1 -1
  157. package/dist/assets/{mode.es2-B8UlLCtX.js → mode.es2-DcHabWZq.js} +1 -1
  158. package/dist/assets/{mode.es3-CQ9X5NiW.js → mode.es3-DepgrqKR.js} +1 -1
  159. package/dist/assets/omit-BIY56Vm3.js +1 -0
  160. package/dist/assets/{onlineParser.es-mNPHWPcl.js → onlineParser.es-F2aU-24r.js} +1 -1
  161. package/dist/assets/{overview-DptGQrLC.js → overview-D99x1C_L.js} +1 -1
  162. package/dist/assets/{permission-DtbkcHFU.js → permission-BwU5vqVv.js} +1 -1
  163. package/dist/assets/{preference-BIxg48qT.js → preference-B-a8y1-u.js} +3 -3
  164. package/dist/assets/{pt-FpFCyI6v.js → pt-CHKumXYv.js} +3 -3
  165. package/dist/assets/{raf-schd.esm-CyR0PsG3.js → raf-schd.esm-CfDeV_Tv.js} +1 -1
  166. package/dist/assets/refType-RuhvdYnQ.js +1 -0
  167. package/dist/assets/{resource-dialog-DSlsEDCi.js → resource-dialog-B3xpsyIT.js} +5 -5
  168. package/dist/assets/{ru-BuGIFp9h.js → ru-CvkEKhgU.js} +1 -1
  169. package/dist/assets/{runtime-BqyrQzUD.js → runtime-C94CoEdP.js} +1 -1
  170. package/dist/assets/{schema-BD6PrmCO.js → schema-D29PP22L.js} +1 -1
  171. package/dist/assets/sdk-CJFYaDBM.js +1 -0
  172. package/dist/assets/{search.es-BjwGHA7G.js → search.es-Dtiay1-p.js} +1 -1
  173. package/dist/assets/{searchcursor.es-CbJCToER.js → searchcursor.es-B5hHQBpu.js} +1 -1
  174. package/dist/assets/{service-BV2uNns2.js → service-Dwje1JT3.js} +1 -1
  175. package/dist/assets/{shorten-label-BOckTQ1X.js → shorten-label-C3V2RyR1.js} +1 -1
  176. package/dist/assets/{show-hint.es-q9IMwctI.js → show-hint.es-IwvOaNo4.js} +1 -1
  177. package/dist/assets/{simple-select-Dtd0a5G_.js → simple-select-C-hoC-G2.js} +1 -1
  178. package/dist/assets/{spaces-Bqb0c1IC.js → spaces-BqxfgJ6Q.js} +1 -1
  179. package/dist/assets/{status-CoaEXqC8.js → status-YpqmLpg4.js} +1 -1
  180. package/dist/assets/{status-DAsfcIss.js → status-uT90przA.js} +1 -1
  181. package/dist/assets/{sublime.es-Di_Rzzft.js → sublime.es-D6Ae2P0m.js} +1 -1
  182. package/dist/assets/{switch-control-uwHD90eP.js → switch-control-6V55bVbg.js} +1 -1
  183. package/dist/assets/{table-icons-CMF2B4vQ.js → table-icons-DA0sv0Eq.js} +1 -1
  184. package/dist/assets/{team-DbBAK1Lw.js → team-CKufRu0w.js} +1 -1
  185. package/dist/assets/{th-BafLD2wR.js → th-B2BUfjNJ.js} +1 -1
  186. package/dist/assets/{toLower-Bk4Y66nU.js → toLower-J0GcLV1u.js} +1 -1
  187. package/dist/assets/toUpper-CkfbCBIC.js +1 -0
  188. package/dist/assets/{traffic-C8Jrp6CL.js → traffic-D56Ew432.js} +1 -1
  189. package/dist/assets/{url-evaluation-DQ262LSg.js → url-evaluation-D9TCPMS4.js} +1 -1
  190. package/dist/assets/{url-join-IGglLOtK.js → url-join-C88wtrgy.js} +1 -1
  191. package/dist/assets/{use-mobile-YvhVWxe8.js → use-mobile-5Zh9Oud5.js} +1 -1
  192. package/dist/assets/{use-mobile-BoYyduuc.js → use-mobile-C9rByBew.js} +1 -1
  193. package/dist/assets/{useAsync-DbB0tJq1.js → useAsync-DPy_pDJm.js} +1 -1
  194. package/dist/assets/{useAsyncRetry-BLg3v7lI.js → useAsyncRetry-oFyp9pPD.js} +1 -1
  195. package/dist/assets/{useLocalStorage-DQZ59j66.js → useLocalStorage-osYXE-mL.js} +1 -1
  196. package/dist/assets/{useThemeProps-CtXzBlYo.js → useThemeProps-C_6zzxTC.js} +1 -1
  197. package/dist/assets/{util-CUC0Xf5B.js → util-MD5zwT5R.js} +1 -1
  198. package/dist/assets/{vi-BMZxxaJ2.js → vi-BykmwIAT.js} +3 -3
  199. package/dist/assets/{wait-container-GoGxY2Kf.js → wait-container-BbGRQLG4.js} +1 -1
  200. package/dist/assets/{withStyles-_FcG1bkA.js → withStyles-DL-NFbaE.js} +1 -1
  201. package/dist/assets/wrap-locale-BRogPOgW.js +1 -0
  202. package/dist/assets/{zh-DusA4qAT.js → zh-CbCaOuAd.js} +3 -1
  203. package/dist/assets/{zh-tw-BO-QhSNP.js → zh-tw-C9JfiCVV.js} +3 -1
  204. package/dist/index.html +1 -1
  205. package/dist/service-worker.js +1 -1
  206. package/package.json +1 -1
  207. package/dist/assets/api-gAVz4YtD.js +0 -1
  208. package/dist/assets/ar-0ZkmCCuq.js +0 -7
  209. package/dist/assets/cloneDeep-CP0xacDT.js +0 -1
  210. package/dist/assets/emotion-react.browser.esm--gIypTeg.js +0 -1
  211. package/dist/assets/es-D_uF0siv.js +0 -7
  212. package/dist/assets/fr-DVFSQfDp.js +0 -7
  213. package/dist/assets/getValidReactChildren-B-b9MOMT.js +0 -1
  214. package/dist/assets/index-Boprg64p.js +0 -236
  215. package/dist/assets/index-DrBxStif.js +0 -41
  216. package/dist/assets/index-s1CQJTjJ.js +0 -1
  217. package/dist/assets/is-path-prefix-equal-C80Jhu_q.js +0 -1
  218. package/dist/assets/item-CrnjScjy.js +0 -277
  219. package/dist/assets/omit-BEDWXxvr.js +0 -1
  220. package/dist/assets/refType-J5vgZzDX.js +0 -1
  221. package/dist/assets/sdk-gxKU3x6m.js +0 -1
  222. package/dist/assets/toUpper-FI4Si1KF.js +0 -1
  223. package/dist/assets/wrap-locale-B35eVgy7.js +0 -1
@@ -1,4 +1,4 @@
1
- import{bW as Bo,j as t,f7 as Oo,hL as $o,l2 as Mo,aP as Wt,aQ as Gt,m as G,bq as H,K as y,aB as Ce,P as i,y as L,al as ft,r as f,e as ve,bE as qe,b as Y,H as B,V as $t,bD as He,t as K,n as $,X as ie,l3 as Ao,a4 as Z,aZ as ao,k as te,D as ht,b5 as qo,gK as Wo,gL as Go,e3 as zo,C as ue,fQ as Fo,w as Vo,az as Wn,a2 as gt,v as Yo,l4 as Ko,l5 as Ho,B as ae,l6 as Qo,Y as Zo,Z as Xo,l7 as lo,br as co,Q as ye,dH as Jo,dU as er,aD as tr,aE as nr,aF as or,aH as Q,aS as rr,cR as sr,E as uo,bp as ir,$ as ar,M as at,aG as po,b1 as zt,l8 as lr,b2 as je,aC as Gn,cP as cr,k0 as dr,A as U,ae as We,aO as mo,bV as Ft,cz as ur,g as xt,l9 as pr,bd as mr,x as fo,aY as Mt,T as fr,aW as Ke,R as Ut,W as hr,bF as ho,gJ as gr,cu as xr,aK as yr,bw as Cr,aV as jr,ep as vr,fZ as zn,la as Fn,h9 as Vn,U as Yn,G as lt,cO as br,ha as Rr,bU as Sr,k1 as wr}from"./index-DTb1YjkO.js";import{d as Er}from"./Add-CSGWebd7.js";import{E as Tr}from"./index-omP-_XYV.js";import{e as Pr,f as kr,g as _r,u as Vt,a as Ir}from"./actions-CvZtuIOm.js";import{S as Dr}from"./switch-control-uwHD90eP.js";import{u as pe}from"./blocklet-SKmr21o8.js";import{P as At,w as yt}from"./permission-DtbkcHFU.js";import{d as go}from"./Edit-frf3Fbx4.js";import{T as Ur,M as Nr,t as Lr}from"./table-icons-CMF2B4vQ.js";import{s as Br,R as dt,F as Or,L as $r,d as Mr,B as Ar}from"./preference-BIxg48qT.js";import{C as Kn}from"./click-to-copy-BBcwV5Sv.js";import{d as Yt}from"./Link-CiUEO3cQ.js";import{c as qr,C as Wr,b as Gr,s as xo,e as zr,z as Fr,d as yo,a as Vr,A as Yr,B as Kr,f as Hr,S as Qr}from"./item-CrnjScjy.js";import{u as Zr,a as Xr,P as Co,L as Hn,A as Jr,S as es}from"./index-CViyZjZs.js";import{u as ts,C as ns,D as os,a as rs,b as ss}from"./connect-to-BbdcjX_x.js";import{C as is,u as as,A as ls}from"./agreement-4TUvZhY3.js";import{d as cs}from"./Done-2EsU1aO2.js";import{A as ds,a as us,d as ps,b as ms}from"./collapse-Cy01Qhtt.js";import{C as fs,L as hs}from"./LockIcon-C1gL9Uz4.js";import{I as gs,a as xs,f as ys,B as Cs}from"./install-from-url-B9F0r0Uk.js";import{a as Qn}from"./api-gAVz4YtD.js";import{v as jo,e as js,a as ut}from"./util-CUC0Xf5B.js";import{u as vo}from"./use-mobile-BoYyduuc.js";import{d as vs}from"./ArrowDropDown-BCCxOUNE.js";import{_ as bs}from"./useLocalStorage-DQZ59j66.js";import{d as Ct}from"./Delete-P4B2dduO.js";import{d as bo}from"./Launch-B7fv6nTK.js";import{D as Rs}from"./delete-confirm-qy4uClf5.js";import{W as Qe,R as Ss,a as Zn}from"./url-evaluation-DQ262LSg.js";import{B as Ro}from"./status-CoaEXqC8.js";import{A as So}from"./actions-C8ldDfDc.js";import{I as Nt}from"./index-BLrsx8oH.js";import{t as ws}from"./toUpper-FI4Si1KF.js";import{S as Es}from"./Switch-D3iZUzda.js";import{a as Ts}from"./team-DbBAK1Lw.js";import"./MoreVert-C_Ck3fn9.js";import"./get-safe-url-BHhOK-87.js";import"./ButtonGroup-ClVwTb7r.js";import"./getValidReactChildren-B-b9MOMT.js";import"./index-C_5on_zt.js";import"./raf-schd.esm-CyR0PsG3.js";import"./index-DRvnuna9.js";import"./ViewColumn-CcQluqhl.js";import"./CSSTransition-DpoNbm4c.js";import"./index-DzK6OW-H.js";import"./Clear-D0I7uWhD.js";import"./ChevronRight-BtkdX9A9.js";import"./ChevronLeft-DQK-aqqz.js";import"./Search-CUm1f8xo.js";import"./omit-BEDWXxvr.js";import"./index-CEr4LN-P.js";import"./index-B6YLm2gY.js";import"./iframe-CVde2I2R.js";import"./Autocomplete-BRFoT1-d.js";import"./ListSubheader-Yn3XMnVm.js";import"./Verified-DjfvSM3n.js";import"./VerifiedUser-CGB9pAg5.js";import"./DeleteOutline-EQ9bHspP.js";import"./url-join-IGglLOtK.js";import"./Close-6CxneLlA.js";import"./index-BkStkax6.js";import"./OpenInNew-D79h4Iot.js";import"./index-BJHGOv7L.js";import"./index-BojVbZw0.js";import"./HelpOutline-CBv7x3VM.js";import"./index-DnLtwT4P.js";import"./spaces-Bqb0c1IC.js";import"./index-D3OlVE0m.js";import"./cloneDeep-CP0xacDT.js";import"./schema-BD6PrmCO.js";import"./ListItemButton-ByIRcZGW.js";import"./Stepper-CEe-v4P_.js";import"./is-path-prefix-equal-C80Jhu_q.js";import"./MoreHoriz-3d6Yp_t-.js";const Ps=Bo(t.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");function Xn(e,o){var n={};return o=Oo(o),$o(e,function(a,r,s){Mo(n,r,o(a,r,s))}),n}var Kt={},ks=Gt;Object.defineProperty(Kt,"__esModule",{value:!0});var wo=Kt.default=void 0,_s=ks(Wt()),Is=t;wo=Kt.default=(0,_s.default)((0,Is.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");var Ht={},Ds=Gt;Object.defineProperty(Ht,"__esModule",{value:!0});var Qt=Ht.default=void 0,Us=Ds(Wt()),Ns=t;Qt=Ht.default=(0,Us.default)((0,Ns.jsx)("path",{d:"M3 17v2h6v-2zM3 5v2h10V5zm10 16v-2h8v-2h-8v-2h-2v6zM7 9v2H3v2h4v2h2V9zm14 4v-2H11v2zm-6-4h2V7h4V5h-4V3h-2z"}),"TuneOutlined");function Zt({children:e,...o}){var x;const{t:n}=G(),{api:a}=H(),{blocklet:r}=pe(),s=(x=r==null?void 0:r.settings)==null?void 0:x.autoCheckUpdate,h=async g=>{await a.updateAutoCheckUpdate({input:{did:r.meta.did,autoCheckUpdate:g}})},c=async()=>{try{const g=!(s!=null&&s.enabled);await h({enabled:g}),L.success(n(g?"storage.spaces.autoCheckUpdate.enabled":"storage.spaces.autoCheckUpdate.disabled"))}catch(g){L.error(g.message)}},p=!!(s!=null&&s.enabled);return t.jsxs(y,{display:"flex",flexDirection:"row",alignItems:"center",children:[e,t.jsx(Ce,{title:n("storage.spaces.autoCheckUpdate.title"),arrow:!0,placement:"right",children:t.jsx("div",{children:t.jsx(Dr,{checked:p,onChange:c,name:"enableWelcomePage",style:{...o.style,zoom:.8}})})})]})}Zt.propTypes={children:i.any};Zt.defaultProps={children:null};function Jn(e){function o({sx:n,...a}){return t.jsx(e,{...a,sx:{color:"text.primary",...n}})}return o}const Ls={...Xn(Lr,Jn),...Xn(Pr,Jn)},Bs=(e,o)=>{let{description:n}=e;return(Object.values(Y.CHAIN_PROP_MAP).includes(e.key)||B.isEnvShareable(e))&&(n?n=`${n} (${o("blocklet.config.sharedToAllComponents")})`:n=o("blocklet.config.sharedToAllComponents")),n&&t.jsx("div",{style:{marginLeft:12},children:n})},Lt=(e,o,n=[])=>!(n!=null&&n.length)&&!e.custom&&!["CHAIN_ID","CHAIN_HOST"].includes(e.key)&&!o.meta.environments.find(a=>a.name===e.key)&&o.children.every(a=>!a.meta.environments.find(r=>r.name===e.key))?!0:e.custom,eo=e=>[Y.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_CLUSTER_SIZE].includes(e)?!0:!(e.startsWith("BLOCKLET_")||e.startsWith("COMPONENT_")),Bt=e=>[Y.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_CLUSTER_SIZE].includes(e)===!1;function Xt({blocklet:e,ancestors:o}){const n=H(),{palette:a}=ft(),{inService:r}=n,{t:s}=f.useContext(ve),h=[...o.map(m=>m.meta.did),e.meta.did],c=()=>L.success(s("blocklet.config.changedTip")),p=m=>Lt(m,e,o);if(qe(e.status)||e.status==="unknown"&&qe(e.status))return null;const x=m=>new Promise(async(u,v)=>{if(!m.key.trim()||!m.value.trim()){L.error(s("blocklet.config.environment.keyValueRequired")),v();return}if(eo(m.key)===!1){L.error(s("blocklet.config.environment.invalidKey")),v();return}m.custom=Bt(m.key);try{const w=await n.api.configBlocklet({input:{did:h,configs:[m]}});c(w.blocklet),u()}catch(w){L.error(ie(w)),v()}}),g=(m,u)=>new Promise(async(v,w)=>{if(m.required&&(!m.key.trim()||!m.value.trim())){L.error(s("blocklet.config.environment.keyValueRequired")),w();return}if(eo(m.key)===!1){L.error(s("blocklet.config.environment.invalidKey")),w();return}if(m.key===Y.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_CLUSTER_SIZE){const N=Ao(m);if(N){L.error(N),w();return}}const j=[{...m,value:m.secure&&m.value==="__encrypted__"?"":m.value}];if(m.key!==u.key){if(!Lt(m,e,o)){L.error("Only key of custom env can be changed"),w();return}j.push({key:u.key,custom:Bt(m.key)})}try{const N=await n.api.configBlocklet({input:{did:h,configs:j}});c(N.blocklet),v()}catch(N){L.error(ie(N)),w()}}),l=m=>new Promise(async(u,v)=>{if(m.required){L.error(s("blocklet.config.environment.deleteForbidden")),v();return}if(!Lt(m,e,o)){L.error("Only key of custom env can be changed"),v();return}try{const w=await n.api.configBlocklet({input:{did:h,configs:[{key:m.key,custom:Bt(m.key)}]}});c(w.blocklet),u()}catch(w){L.error(ie(w)),v()}}),b=(e.configs||[]).filter(m=>!Y.BLOCKLET_CONFIGURABLE_KEY[m.key]||[Y.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_CLUSTER_SIZE].includes(m.key)),d=B.getSharedConfigObj(o[0],e),T=B.getComponentMissingConfigs(e,o[0]),S=b.map(m=>({...m,value:Object.values(Y.CHAIN_PROP_MAP).includes(m.key)&&Object.keys(d).includes(m.key)?d[m.key]:d[m.key]||m.value})),R=S.some(m=>m.key&&m.key.startsWith("BWA_")),k={onRowAdd:x,onRowUpdate:g,onRowDelete:l,isDeletable:p},C=()=>[{title:s("common.key"),field:"key",initialEditValue:"",width:"30%",render:m=>t.jsx(Kn,{value:m.value,style:{color:m.required&&!m.value?a.error.main:a.text.primary,fontWeight:m.required?"bold":"normal"},children:m.key}),editComponent:m=>{const{value:u,rowData:v,onChange:w}=m;return t.jsx(to,{children:t.jsx(K,{fullWidth:!0,size:"small",disabled:p(v)===!1,value:Br.escapeTag(u),onChange:j=>w(j.target.value),variant:"outlined",label:"Key",placeholder:s("blocklet.config.environment.key"),margin:"dense",autoFocus:!0})})}},{title:s("common.value"),field:"value",initialEditValue:"",width:"calc((100% - (96px + 30%)) / 1)",render:m=>m.value?m.secure?"******":t.jsx(Kn,{unstyled:!0,value:m.value,style:{wordBreak:"break-all"},children:m.value}):null,editComponent:m=>{const{value:u,rowData:v,onChange:w}=m;return t.jsxs(to,{children:[t.jsx(K,{fullWidth:!0,size:"small",value:u==="__encrypted__"?"":u,onChange:j=>w(j.target.value),variant:"outlined",label:s("common.value"),placeholder:s("blocklet.config.environment.value"),margin:"dense"}),Bs(v,s)]})}}];return t.jsxs(Os,{children:[!!T.length&&t.jsx($t,{severity:"error",style:{marginTop:24},children:s("blocklet.config.missingRequired")}),R&&t.jsx($t,{severity:"info",children:s("blocklet.config.environment.tip")}),t.jsx(At,{permission:r?"":"mutate_blocklets",role:r?He:[],children:m=>t.jsx(Ur,{className:"config-table",children:t.jsx(Nr,{title:t.jsx(y,{fontWeight:"bold",children:s("common.environments")}),columns:C(),icons:Ls,options:{emptyRowsWhenPaging:!1,actionsColumnIndex:-1,tableLayout:"auto",maxBodyHeight:"100%",paging:!1,search:!1,actionsCellStyle:{padding:"0",textAlign:"right",width:"80px"}},localization:{header:{actions:s("common.actions")},body:{emptyDataSourceMessage:s("common.noData")}},data:S,editable:m?k:{}})})})]})}Xt.propTypes={blocklet:i.object.isRequired,ancestors:i.array};Xt.defaultProps={ancestors:[]};const Os=$.div`
1
+ import{bW as Bo,j as t,f7 as Oo,hM as $o,l3 as Mo,aP as Wt,aQ as Gt,m as G,bq as H,K as y,aB as Ce,P as i,y as L,al as ft,r as f,e as ve,bE as qe,b as Y,H as B,V as $t,bD as He,t as K,n as $,X as ie,l4 as Ao,a4 as Z,aZ as ao,k as te,D as ht,b5 as qo,gL as Wo,gM as Go,e3 as Fo,C as ue,fQ as zo,w as Vo,az as Wn,a2 as gt,v as Yo,l5 as Ko,l6 as Ho,B as ae,l7 as Qo,Y as Zo,Z as Xo,l8 as lo,br as co,Q as ye,dH as Jo,dU as er,aD as tr,aE as nr,aF as or,aH as Q,aS as rr,cR as sr,E as uo,bp as ir,$ as ar,M as at,aG as po,b1 as Ft,l9 as lr,b2 as je,aC as Gn,cP as cr,k1 as dr,A as U,ae as We,aO as mo,bV as zt,cz as ur,g as xt,la as pr,bd as mr,x as fo,aY as Mt,T as fr,aW as Ke,R as Ut,W as hr,bF as ho,gK as gr,cu as xr,aK as yr,bw as Cr,aV as jr,ep as vr,fW as Fn,lb as zn,ha as Vn,U as Yn,G as lt,cO as br,hb as Rr,bU as Sr,k2 as wr}from"./index-BXOD69ua.js";import{d as Er}from"./Add-CDNZP3_0.js";import{E as Tr}from"./index-C0MwD3ew.js";import{e as Pr,f as kr,g as _r,u as Vt,a as Ir}from"./actions-Dq6DDwe2.js";import{S as Dr}from"./switch-control-6V55bVbg.js";import{u as pe}from"./blocklet-3SnK_ln7.js";import{P as At,w as yt}from"./permission-BwU5vqVv.js";import{d as go}from"./Edit-D2-hkmp_.js";import{T as Ur,M as Nr,t as Lr}from"./table-icons-DA0sv0Eq.js";import{s as Br,R as dt,F as Or,L as $r,d as Mr,B as Ar}from"./preference-B-a8y1-u.js";import{C as Kn}from"./click-to-copy-a5cMFI-_.js";import{d as Yt}from"./Link-CHQGWtG9.js";import{c as qr,C as Wr,b as Gr,s as xo,e as Fr,j as zr,d as yo,a as Vr,A as Yr,B as Kr,f as Hr,S as Qr}from"./item-B-caRYba.js";import{u as Zr,a as Xr,P as Co,L as Hn,A as Jr,S as es}from"./index-DNdIaDLR.js";import{u as ts,C as ns,D as os,a as rs,b as ss}from"./connect-to-CmhbEEvA.js";import{C as is,u as as,A as ls}from"./agreement-DCQc_rAP.js";import{d as cs}from"./Done-oo1eX6tp.js";import{A as ds,a as us,d as ps,b as ms}from"./collapse-C2nB1Q0B.js";import{C as fs,L as hs}from"./LockIcon-DvcB90iN.js";import{I as gs,a as xs,f as ys,B as Cs}from"./install-from-url-Kt3o4LBx.js";import{a as Qn}from"./api-DwcaKz2E.js";import{v as jo,e as js,a as ut}from"./util-MD5zwT5R.js";import{u as vo}from"./use-mobile-C9rByBew.js";import{d as vs}from"./ArrowDropDown-DX4axGQA.js";import{_ as bs}from"./useLocalStorage-osYXE-mL.js";import{d as Ct}from"./Delete-CvkgpWXX.js";import{d as bo}from"./Launch-DVq2r1vu.js";import{D as Rs}from"./delete-confirm-m56IXxYG.js";import{W as Qe,R as Ss,a as Zn}from"./url-evaluation-D9TCPMS4.js";import{B as Ro}from"./status-YpqmLpg4.js";import{A as So}from"./actions-CWQtNrcD.js";import{I as Nt}from"./index-DfVhmhNU.js";import{t as ws}from"./toUpper-CkfbCBIC.js";import{S as Es}from"./Switch-SGjalYgz.js";import{a as Ts}from"./team-CKufRu0w.js";import"./MoreVert-Ca16Cnof.js";import"./get-safe-url-t5_KGb1I.js";import"./ButtonGroup-pRTDFJWg.js";import"./getValidReactChildren-DuVu0i0i.js";import"./index-CpywGtnH.js";import"./raf-schd.esm-CfDeV_Tv.js";import"./index-Vj6hcvqX.js";import"./ViewColumn-CxnzgopE.js";import"./CSSTransition-DwzJ0puV.js";import"./index-4WVfl35V.js";import"./Clear-B9P4WqAY.js";import"./ChevronRight-B_-R2Sts.js";import"./ChevronLeft-ud_S8L4-.js";import"./Search-BqZFZ5g2.js";import"./omit-BIY56Vm3.js";import"./index-BEKDshjS.js";import"./index-CJTCcEXc.js";import"./iframe-AXVHNW_k.js";import"./Autocomplete-DpJFKWid.js";import"./ListSubheader-Dqc3XTI_.js";import"./Verified-CLwd2p1i.js";import"./VerifiedUser-BlbKkPqo.js";import"./DeleteOutline-C6-UDibg.js";import"./url-join-C88wtrgy.js";import"./Close-D_k500g1.js";import"./index-B7K9oQOc.js";import"./OpenInNew-CysIURb4.js";import"./index-BJHGOv7L.js";import"./index-BojVbZw0.js";import"./HelpOutline-Dnfzivtx.js";import"./index-Dhx2XMvi.js";import"./spaces-BqxfgJ6Q.js";import"./index-CknB_y2G.js";import"./cloneDeep-BmfjF8bM.js";import"./schema-D29PP22L.js";import"./ListItemButton-LswuUKPc.js";import"./Stepper-DEgX4GTY.js";import"./is-path-prefix-equal-B5zOew9j.js";import"./MoreHoriz-CQaja3QI.js";const Ps=Bo(t.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");function Xn(e,o){var n={};return o=Oo(o),$o(e,function(a,r,s){Mo(n,r,o(a,r,s))}),n}var Kt={},ks=Gt;Object.defineProperty(Kt,"__esModule",{value:!0});var wo=Kt.default=void 0,_s=ks(Wt()),Is=t;wo=Kt.default=(0,_s.default)((0,Is.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");var Ht={},Ds=Gt;Object.defineProperty(Ht,"__esModule",{value:!0});var Qt=Ht.default=void 0,Us=Ds(Wt()),Ns=t;Qt=Ht.default=(0,Us.default)((0,Ns.jsx)("path",{d:"M3 17v2h6v-2zM3 5v2h10V5zm10 16v-2h8v-2h-8v-2h-2v6zM7 9v2H3v2h4v2h2V9zm14 4v-2H11v2zm-6-4h2V7h4V5h-4V3h-2z"}),"TuneOutlined");function Zt({children:e,...o}){var x;const{t:n}=G(),{api:a}=H(),{blocklet:r}=pe(),s=(x=r==null?void 0:r.settings)==null?void 0:x.autoCheckUpdate,h=async g=>{await a.updateAutoCheckUpdate({input:{did:r.meta.did,autoCheckUpdate:g}})},c=async()=>{try{const g=!(s!=null&&s.enabled);await h({enabled:g}),L.success(n(g?"storage.spaces.autoCheckUpdate.enabled":"storage.spaces.autoCheckUpdate.disabled"))}catch(g){L.error(g.message)}},p=!!(s!=null&&s.enabled);return t.jsxs(y,{display:"flex",flexDirection:"row",alignItems:"center",children:[e,t.jsx(Ce,{title:n("storage.spaces.autoCheckUpdate.title"),arrow:!0,placement:"right",children:t.jsx("div",{children:t.jsx(Dr,{checked:p,onChange:c,name:"enableWelcomePage",style:{...o.style,zoom:.8}})})})]})}Zt.propTypes={children:i.any};Zt.defaultProps={children:null};function Jn(e){function o({sx:n,...a}){return t.jsx(e,{...a,sx:{color:"text.primary",...n}})}return o}const Ls={...Xn(Lr,Jn),...Xn(Pr,Jn)},Bs=(e,o)=>{let{description:n}=e;return(Object.values(Y.CHAIN_PROP_MAP).includes(e.key)||B.isEnvShareable(e))&&(n?n=`${n} (${o("blocklet.config.sharedToAllComponents")})`:n=o("blocklet.config.sharedToAllComponents")),n&&t.jsx("div",{style:{marginLeft:12},children:n})},Lt=(e,o,n=[])=>!(n!=null&&n.length)&&!e.custom&&!["CHAIN_ID","CHAIN_HOST"].includes(e.key)&&!o.meta.environments.find(a=>a.name===e.key)&&o.children.every(a=>!a.meta.environments.find(r=>r.name===e.key))?!0:e.custom,eo=e=>[Y.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_CLUSTER_SIZE].includes(e)?!0:!(e.startsWith("BLOCKLET_")||e.startsWith("COMPONENT_")),Bt=e=>[Y.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_CLUSTER_SIZE].includes(e)===!1;function Xt({blocklet:e,ancestors:o}){const n=H(),{palette:a}=ft(),{inService:r}=n,{t:s}=f.useContext(ve),h=[...o.map(m=>m.meta.did),e.meta.did],c=()=>L.success(s("blocklet.config.changedTip")),p=m=>Lt(m,e,o);if(qe(e.status)||e.status==="unknown"&&qe(e.status))return null;const x=m=>new Promise(async(u,v)=>{if(!m.key.trim()||!m.value.trim()){L.error(s("blocklet.config.environment.keyValueRequired")),v();return}if(eo(m.key)===!1){L.error(s("blocklet.config.environment.invalidKey")),v();return}m.custom=Bt(m.key);try{const w=await n.api.configBlocklet({input:{did:h,configs:[m]}});c(w.blocklet),u()}catch(w){L.error(ie(w)),v()}}),g=(m,u)=>new Promise(async(v,w)=>{if(m.required&&(!m.key.trim()||!m.value.trim())){L.error(s("blocklet.config.environment.keyValueRequired")),w();return}if(eo(m.key)===!1){L.error(s("blocklet.config.environment.invalidKey")),w();return}if(m.key===Y.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_CLUSTER_SIZE){const N=Ao(m);if(N){L.error(N),w();return}}const j=[{...m,value:m.secure&&m.value==="__encrypted__"?"":m.value}];if(m.key!==u.key){if(!Lt(m,e,o)){L.error("Only key of custom env can be changed"),w();return}j.push({key:u.key,custom:Bt(m.key)})}try{const N=await n.api.configBlocklet({input:{did:h,configs:j}});c(N.blocklet),v()}catch(N){L.error(ie(N)),w()}}),l=m=>new Promise(async(u,v)=>{if(m.required){L.error(s("blocklet.config.environment.deleteForbidden")),v();return}if(!Lt(m,e,o)){L.error("Only key of custom env can be changed"),v();return}try{const w=await n.api.configBlocklet({input:{did:h,configs:[{key:m.key,custom:Bt(m.key)}]}});c(w.blocklet),u()}catch(w){L.error(ie(w)),v()}}),b=(e.configs||[]).filter(m=>!Y.BLOCKLET_CONFIGURABLE_KEY[m.key]||[Y.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_CLUSTER_SIZE].includes(m.key)),d=B.getSharedConfigObj(o[0],e),T=B.getComponentMissingConfigs(e,o[0]),S=b.map(m=>({...m,value:Object.values(Y.CHAIN_PROP_MAP).includes(m.key)&&Object.keys(d).includes(m.key)?d[m.key]:d[m.key]||m.value})),R=S.some(m=>m.key&&m.key.startsWith("BWA_")),k={onRowAdd:x,onRowUpdate:g,onRowDelete:l,isDeletable:p},C=()=>[{title:s("common.key"),field:"key",initialEditValue:"",width:"30%",render:m=>t.jsx(Kn,{value:m.value,style:{color:m.required&&!m.value?a.error.main:a.text.primary,fontWeight:m.required?"bold":"normal"},children:m.key}),editComponent:m=>{const{value:u,rowData:v,onChange:w}=m;return t.jsx(to,{children:t.jsx(K,{fullWidth:!0,size:"small",disabled:p(v)===!1,value:Br.escapeTag(u),onChange:j=>w(j.target.value),variant:"outlined",label:"Key",placeholder:s("blocklet.config.environment.key"),margin:"dense",autoFocus:!0})})}},{title:s("common.value"),field:"value",initialEditValue:"",width:"calc((100% - (96px + 30%)) / 1)",render:m=>m.value?m.secure?"******":t.jsx(Kn,{unstyled:!0,value:m.value,style:{wordBreak:"break-all"},children:m.value}):null,editComponent:m=>{const{value:u,rowData:v,onChange:w}=m;return t.jsxs(to,{children:[t.jsx(K,{fullWidth:!0,size:"small",value:u==="__encrypted__"?"":u,onChange:j=>w(j.target.value),variant:"outlined",label:s("common.value"),placeholder:s("blocklet.config.environment.value"),margin:"dense"}),Bs(v,s)]})}}];return t.jsxs(Os,{children:[!!T.length&&t.jsx($t,{severity:"error",style:{marginTop:24},children:s("blocklet.config.missingRequired")}),R&&t.jsx($t,{severity:"info",children:s("blocklet.config.environment.tip")}),t.jsx(At,{permission:r?"":"mutate_blocklets",role:r?He:[],children:m=>t.jsx(Ur,{className:"config-table",children:t.jsx(Nr,{title:t.jsx(y,{fontWeight:"bold",children:s("common.environments")}),columns:C(),icons:Ls,options:{emptyRowsWhenPaging:!1,actionsColumnIndex:-1,tableLayout:"auto",maxBodyHeight:"100%",paging:!1,search:!1,actionsCellStyle:{padding:"0",textAlign:"right",width:"80px"}},localization:{header:{actions:s("common.actions")},body:{emptyDataSourceMessage:s("common.noData")}},data:S,editable:m?k:{}})})})]})}Xt.propTypes={blocklet:i.object.isRequired,ancestors:i.array};Xt.defaultProps={ancestors:[]};const Os=$.div`
2
2
  .config-table {
3
3
  margin-bottom: 24px;
4
4
  position: relative;
@@ -65,7 +65,7 @@ import{bW as Bo,j as t,f7 as Oo,hL as $o,l2 as Mo,aP as Wt,aQ as Gt,m as G,bq as
65
65
  .ux-dialog_closeButton {
66
66
  margin: 0;
67
67
  }
68
- `,Jt={description:i.string,editing:i.bool,onChange:i.func,required:i.bool,value:i.any,componentProps:i.object,render:i.func,renderFormItem:i.func};function en({editing:e,value:o,onChange:n}){const[a,r]=f.useState(!1),s=f.useRef(),h=f.useRef(o);f.useEffect(()=>{let l=null;return e&&(l=setTimeout(()=>{r(!0)},50)),()=>{clearTimeout(l)}},[e]);const c=l=>{h.current=l,n(l)},p=()=>{r(!1),n(h.current)},x=t.jsx(y,{className:"form-item-input slot",px:1,children:t.jsxs(y,{display:"flex",alignItems:"center",children:[o,o!=="auto"&&t.jsx("div",{style:{marginLeft:4,backgroundColor:o,width:"1em",height:"1em",borderRadius:"0.2em"}})]})}),g=t.jsxs(y,{display:"flex",flexGrow:1,alignItems:"center",height:"40px",onKeyDown:p,children:[t.jsx(y,{display:"flex",alignItems:"center",onClick:()=>r(!0),children:t.jsx("div",{ref:s,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"}})}),t.jsx(qo,{open:a,anchorEl:s.current,onClose:()=>r(!1),anchorOrigin:{vertical:"bottom",horizontal:"center"},transformOrigin:{vertical:"top",horizontal:"center"},children:t.jsx(fs,{color:o,onChange:l=>c(l.hex)})})]});return e?g:x}en.propTypes=Jt;function tn({editing:e,description:o,value:n,onChange:a,componentProps:r,...s}){const{placeholder:h}=r,c=f.useRef(n),{t:p}=f.useContext(ve),x=l=>{l.key==="Enter"&&a(c.current,"confirm")},g=l=>{c.current=l,a(l)};return e?t.jsx(K,{style:{flex:1},fullWidth:!0,value:n,onChange:l=>{l.persist(),g(l.target.value)},autoFocus:!0,size:"small",variant:"outlined",placeholder:o||h,onKeyDown:x,...s}):t.jsx(y,{px:1,className:"form-item-input slot",children:n||t.jsx("span",{className:"placeholder",children:p("common.requiredInputPlaceholder",{name:o||h})})})}tn.propTypes=Jt;tn.defaultProps={componentProps:{}};function nn({editing:e,value:o,onChange:n,componentProps:a,...r}){const{blocklet:s}=a,h=o==="auto"?Wo.getPassportColorFromDid(s.appDid):o;return t.jsxs(y,{display:"flex",alignItems:"center",children:[t.jsx("div",{style:{width:96,marginRight:12},dangerouslySetInnerHTML:{__html:Go({title:"Owner",issuer:B.getDisplayName(s),issuerDid:s.appDid,ownerName:"Your Name",ownerDid:s.appDid,preferredColor:o||"auto"})}}),t.jsx(en,{...r,editing:e,value:e?h:o,onChange:n,componentProps:a})]})}nn.propTypes={...Jt,componentProps:i.shape({blocklet:i.object.isRequired}).isRequired};nn.defaultProps={};const Ms=zo`
68
+ `,Jt={description:i.string,editing:i.bool,onChange:i.func,required:i.bool,value:i.any,componentProps:i.object,render:i.func,renderFormItem:i.func};function en({editing:e,value:o,onChange:n}){const[a,r]=f.useState(!1),s=f.useRef(),h=f.useRef(o);f.useEffect(()=>{let l=null;return e&&(l=setTimeout(()=>{r(!0)},50)),()=>{clearTimeout(l)}},[e]);const c=l=>{h.current=l,n(l)},p=()=>{r(!1),n(h.current)},x=t.jsx(y,{className:"form-item-input slot",px:1,children:t.jsxs(y,{display:"flex",alignItems:"center",children:[o,o!=="auto"&&t.jsx("div",{style:{marginLeft:4,backgroundColor:o,width:"1em",height:"1em",borderRadius:"0.2em"}})]})}),g=t.jsxs(y,{display:"flex",flexGrow:1,alignItems:"center",height:"40px",onKeyDown:p,children:[t.jsx(y,{display:"flex",alignItems:"center",onClick:()=>r(!0),children:t.jsx("div",{ref:s,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"}})}),t.jsx(qo,{open:a,anchorEl:s.current,onClose:()=>r(!1),anchorOrigin:{vertical:"bottom",horizontal:"center"},transformOrigin:{vertical:"top",horizontal:"center"},children:t.jsx(fs,{color:o,onChange:l=>c(l.hex)})})]});return e?g:x}en.propTypes=Jt;function tn({editing:e,description:o,value:n,onChange:a,componentProps:r,...s}){const{placeholder:h}=r,c=f.useRef(n),{t:p}=f.useContext(ve),x=l=>{l.key==="Enter"&&a(c.current,"confirm")},g=l=>{c.current=l,a(l)};return e?t.jsx(K,{style:{flex:1},fullWidth:!0,value:n,onChange:l=>{l.persist(),g(l.target.value)},autoFocus:!0,size:"small",variant:"outlined",placeholder:o||h,onKeyDown:x,...s}):t.jsx(y,{px:1,className:"form-item-input slot",children:n||t.jsx("span",{className:"placeholder",children:p("common.requiredInputPlaceholder",{name:o||h})})})}tn.propTypes=Jt;tn.defaultProps={componentProps:{}};function nn({editing:e,value:o,onChange:n,componentProps:a,...r}){const{blocklet:s}=a,h=o==="auto"?Wo.getPassportColorFromDid(s.appDid):o;return t.jsxs(y,{display:"flex",alignItems:"center",children:[t.jsx("div",{style:{width:96,marginRight:12},dangerouslySetInnerHTML:{__html:Go({title:"Owner",issuer:B.getDisplayName(s),issuerDid:s.appDid,ownerName:"Your Name",ownerDid:s.appDid,preferredColor:o||"auto"})}}),t.jsx(en,{...r,editing:e,value:e?h:o,onChange:n,componentProps:a})]})}nn.propTypes={...Jt,componentProps:i.shape({blocklet:i.object.isRequired}).isRequired};nn.defaultProps={};const Ms=Fo`
69
69
  0%, 100% {
70
70
  transform: scale(1) translateX(0);
71
71
  }
@@ -75,7 +75,7 @@ import{bW as Bo,j as t,f7 as Oo,hL as $o,l2 as Mo,aP as Wt,aQ as Gt,m as G,bq as
75
75
  25%, 75% {
76
76
  transform: scale(1.1) translateX(3px);
77
77
  }
78
- `,As={input:tn,color:en,passport:nn,uploader:e=>t.jsx($r,{...e.componentProps})};function qs(e,{editing:o=!1}){const{componentType:n="input",render:a,renderFormItem:r}=e;return o&&r?r:!o&&a?a:As[n==null?void 0:n.toLowerCase()]}vt.propTypes={item:i.object.isRequired,findEditingItem:i.func.isRequired,getItemValue:i.func.isRequired,onFormItemChange:i.func.isRequired,onFocusOut:i.func.isRequired,disabled:i.bool,loading:i.bool,onCancel:i.func,formValues:i.object.isRequired};vt.defaultProps={disabled:!1,loading:!1,onCancel:()=>{}};function vt({item:e,findEditingItem:o,getItemValue:n,onFormItemChange:a,onFocusOut:r,disabled:s,loading:h,onCancel:c,formValues:p}){var w;const{key:x,description:g,required:l,solo:b=!1,hidden:d=!1,componentProps:T={},skipButtonDisabled:S=!1}=e;if(d)return null;const R=o(x),{editing:k,shaking:C}=R??{},m=n(e,{editing:k}),u=qs(e,{editing:k}),v={inputProps:{"data-cy":"schema-form-item-component"},key:x,description:g,editing:k,value:m,onChange:(j,N="change")=>a(e,j,N),componentProps:T,skipButtonDisabled:S,onBlur:()=>r(e)};return e.componentType==="collapse"&&((w=e.children)==null?void 0:w.length)>0?t.jsxs(ds,{children:[t.jsx(us,{expandIcon:t.jsx(ps,{fontSize:"small"}),"aria-controls":"panel1-content",id:"panel1-header",children:e.description}),t.jsx(ms,{children:e.children.map(j=>t.jsx(vt,{item:j,findEditingItem:o,getItemValue:n,onFormItemChange:a,onFocusOut:r,formValues:p,disabled:s,loading:h,onCancel:c},j.key))})]}):t.jsxs(y,{className:"form-item",children:[!b&&t.jsxs(y,{className:"form-item-label",sx:{color:l&&!m?"error.main":"text.secondary"},children:[g,l&&t.jsx(dt,{})]}),t.jsxs(y,{className:"form-item-body",children:[t.jsx(y,{className:"form-item-input","data-cy":"schema-form-item-edit",sx:{textAlign:b?"center":"left"},style:{cursor:"text"},onClick:()=>{s||R!=null&&R.edited||S||a(e,p[x],"edit")},children:t.jsx(u,{...v})}),!b&&t.jsx(y,{className:"form-item-action",style:{marginLeft:0},children:k?t.jsxs(t.Fragment,{children:[R.edited?t.jsx(Z,{"data-cy":"schema-form-item-confirm",onClick:()=>{a(e,m,"confirm")},disabled:s||h,sx:{animation:C?`${Ms} 0.5s linear`:"none"},style:{paddingRight:4},size:"large",children:h?t.jsx(ue,{size:24}):t.jsx(cs,{})}):null,t.jsx(Z,{"data-cy":"schema-form-item-cancel",onClick:()=>c(e),style:{paddingLeft:R.edited?4:8},disabled:s||h,size:"large",children:t.jsx(Fo,{})})]}):null})]})]},x)}function on({schema:e,loading:o,value:n,defaultValue:a,onChange:r,style:s,disabled:h}){const c=Object.prototype.toString.call(n)==="[object Object]",[p,x]=f.useState([]),[g,l]=f.useState(c?n:a),b=f.useMemo(()=>e.length===1,[e]),d=f.useCallback(u=>p.find(v=>v.key===u),[p]);f.useEffect(()=>{var u;b&&((u=e[0])!=null&&u.required)&&x([{key:e[0].key,editing:!0,initialValue:a[e[0].key]}])},[e,b,a]);const T=f.useCallback(u=>{x(v=>v.find(j=>j.key===u.key)?v.map(j=>j.key===u.key?u:{...j}):[u].concat(v))},[]),S=f.useCallback((u,v,w)=>{const{key:j,secure:N}=u,M=d(j)??{...u};M.editing=!0;const I=g[j]!==v;M.edited=v&&M.initialValue!==v,M.initialValue=a[j];const ne={...g,[j]:v};I&&l(ne),r({[j]:v},{allValues:ne,action:w,currentItem:u}),w==="confirm"&&N&&l({...g,[j]:"__encrypted__"}),w==="confirm"&&(M.initialValue=g[j]),["confirm","cancel"].includes(w)&&(M.editing=!1,M.edited=!1),T(M)},[a,g,r,T,d]),R=f.useCallback((u,{editing:v=!1})=>{const{key:w}=u,j=c?n[w]:g[w];return j==="__encrypted__"?v?"":"******":j},[c,n,g]),k=f.useCallback(u=>{const v=d(u.key);v&&S(u,v.initialValue,"cancel")},[d,S]),C=f.useCallback(u=>{const v=d(u.key);!v||!v.edited||(v.shaking=!0,T(v),setTimeout(()=>{v.shaking=!1,T(v)},500))},[d,T]),m=f.useCallback(u=>{const v=d(u.key);!v||!v.edited?k(u):C(u)},[d,C,k]);return t.jsx(Ws,{className:"form",style:s,children:e==null?void 0:e.map(u=>{const{hidden:v=!1}=u;return v?null:t.jsx(vt,{item:u,findEditingItem:d,getItemValue:R,onFormItemChange:S,onFocusOut:m,formValues:g,disabled:h,loading:o,onCancel:k})})})}on.propTypes={schema:i.array.isRequired,loading:i.bool,onChange:i.func.isRequired,value:i.object,defaultValue:i.object,style:i.object,disabled:i.bool};on.defaultProps={loading:!1,value:void 0,defaultValue:{},style:{},disabled:!1};const Ws=$(Or)``;function rn({meta:e,onCancel:o,mode:n,handlePaySuccess:a}){const{t:r,locale:s}=G(),{info:h}=H(),c=Vo(h),[p,x]=f.useState(null),g=new URL(e==null?void 0:e.registryUrl).origin,l=B.getDisplayName({meta:e}),b=async(T,S)=>{const R=({downloadTokenList:m})=>{a({downloadTokenList:m})},k=m=>{L.error(m),o(m)};function C(m){return Ho(()=>Qn.get(m).then(async({data:u})=>{const v=u==null?void 0:u.downloadTokenList;if(u.status==="succeed"){if(v&&v.length)await R({downloadTokenList:v});else return await k(r("blocklet.component.missDownloadTokenTip")),!0;return!0}return u.status==="error"?(console.error("vc error: ",u),await k(u==null?void 0:u.error),!0):!1}),{interval:1e3})}if(n==="purchase"&&p){const{statusUrl:m}=Ko(p);await C(m)}else await R({downloadTokenList:T.downloadTokenList&&S(T.downloadTokenList)})};if(f.useEffect(()=>{if(n==="purchase"){const T=new URL(g);T.pathname="/api/did/verify-purchase-blocklet/token",T.searchParams.set("serverDid",h.did),T.searchParams.set("blockletDid",e==null?void 0:e.did);try{Qn.get(T.href).then(({data:S})=>{const R=`${S.url}`;x(R)})}catch(S){console.error("get next workflow url error: ",S)}}return()=>{x(null)}},[n]),n==="purchase"&&!p)return"";const d={verify:{action:"verify-purchase-blocklet",checkFn:Wn.create({baseURL:g}).get,extraParams:{serverDid:h.did,blockletDid:e==null?void 0:e.did},messages:{title:r("store.purchase.verify.auth.title",{name:l}),scan:r("store.purchase.verify.auth.scan"),confirm:r("store.purchase.verify.auth.confirm"),success:r("store.purchase.verify.auth.success")}},purchase:{action:"acquire-asset",checkFn:Wn.create({baseURL:gt(g,"/store")}).get,extraParams:{factory:e.nftFactory,nw:p},messages:{title:r("store.purchase.auth.title",{name:l}),scan:r("store.purchase.auth.scan"),confirm:r("store.purchase.auth.confirm"),success:t.jsxs(t.Fragment,{children:[t.jsx("p",{children:r("store.purchase.auth.success")}),t.jsx("p",{children:r("blocklet.component.purchaseComponentSecondCheckTip")})]})}}};return t.jsx(Yo,{open:!0,locale:s,popup:!1,saveConnect:!1,className:"connect",baseUrl:g,onSuccess:b,cancelWhenScanned:o,onClose:o,checkTimeout:60*5e3,webWalletUrl:c,disableClose:!0,showDownload:!1,...d[n]})}rn.propTypes={...qr,handlePaySuccess:i.func,mode:i.oneOf(["verify","purchase"]).isRequired};rn.defaultProps={handlePaySuccess:()=>{}};const sn=f.forwardRef(({mode:e,...o},n)=>{const[a,r]=f.useState(e!=="both"?e:"verify"),[s,h]=f.useState(e!=="both"?2:1),c=x=>{x!==a&&r(x)},p=()=>{a&&s!==2&&h(2)};return f.useImperativeHandle(n,()=>({onNext:p,getCurrentStep:()=>s})),s===1?t.jsx("div",{style:{maxWidth:520},children:t.jsx(Wr,{action:a,onNext:null,onSelect:c})}):t.jsx(rn,{...o,mode:a})});sn.propTypes={mode:i.oneOf(["both","verify","purchase"]).isRequired,ref:i.any};sn.defaultProps={ref:{}};const Gs=sn;function zs({...e}){return t.jsx(ae,{className:"bottom-button",variant:"contained",color:"primary",...e})}function an({blocklet:e,onStartNow:o,children:n,disabled:a}){const{t:r}=G(),s=vo();return!e||Qo(e.meta)?t.jsx(Fs,{children:n}):t.jsxs(Vs,{isMobile:s,children:[t.jsx(zs,{className:"start-now",variant:"contained",color:"primary",disabled:a,onClick:()=>o(),children:r("setup.startNow")}),t.jsx(y,{display:"flex",alignItems:"center",children:n})]})}an.propTypes={blocklet:i.object,onStartNow:i.func,children:i.any,disabled:i.bool};an.defaultProps={blocklet:null,onStartNow:()=>{},children:null,disabled:!1};const Fs=$(y)`
78
+ `,As={input:tn,color:en,passport:nn,uploader:e=>t.jsx($r,{...e.componentProps})};function qs(e,{editing:o=!1}){const{componentType:n="input",render:a,renderFormItem:r}=e;return o&&r?r:!o&&a?a:As[n==null?void 0:n.toLowerCase()]}vt.propTypes={item:i.object.isRequired,findEditingItem:i.func.isRequired,getItemValue:i.func.isRequired,onFormItemChange:i.func.isRequired,onFocusOut:i.func.isRequired,disabled:i.bool,loading:i.bool,onCancel:i.func,formValues:i.object.isRequired};vt.defaultProps={disabled:!1,loading:!1,onCancel:()=>{}};function vt({item:e,findEditingItem:o,getItemValue:n,onFormItemChange:a,onFocusOut:r,disabled:s,loading:h,onCancel:c,formValues:p}){var w;const{key:x,description:g,required:l,solo:b=!1,hidden:d=!1,componentProps:T={},skipButtonDisabled:S=!1}=e;if(d)return null;const R=o(x),{editing:k,shaking:C}=R??{},m=n(e,{editing:k}),u=qs(e,{editing:k}),v={inputProps:{"data-cy":"schema-form-item-component"},key:x,description:g,editing:k,value:m,onChange:(j,N="change")=>a(e,j,N),componentProps:T,skipButtonDisabled:S,onBlur:()=>r(e)};return e.componentType==="collapse"&&((w=e.children)==null?void 0:w.length)>0?t.jsxs(ds,{children:[t.jsx(us,{expandIcon:t.jsx(ps,{fontSize:"small"}),"aria-controls":"panel1-content",id:"panel1-header",children:e.description}),t.jsx(ms,{children:e.children.map(j=>t.jsx(vt,{item:j,findEditingItem:o,getItemValue:n,onFormItemChange:a,onFocusOut:r,formValues:p,disabled:s,loading:h,onCancel:c},j.key))})]}):t.jsxs(y,{className:"form-item",children:[!b&&t.jsxs(y,{className:"form-item-label",sx:{color:l&&!m?"error.main":"text.secondary"},children:[g,l&&t.jsx(dt,{})]}),t.jsxs(y,{className:"form-item-body",children:[t.jsx(y,{className:"form-item-input","data-cy":"schema-form-item-edit",sx:{textAlign:b?"center":"left"},style:{cursor:"text"},onClick:()=>{s||R!=null&&R.edited||S||a(e,p[x],"edit")},children:t.jsx(u,{...v})}),!b&&t.jsx(y,{className:"form-item-action",style:{marginLeft:0},children:k?t.jsxs(t.Fragment,{children:[R.edited?t.jsx(Z,{"data-cy":"schema-form-item-confirm",onClick:()=>{a(e,m,"confirm")},disabled:s||h,sx:{animation:C?`${Ms} 0.5s linear`:"none"},style:{paddingRight:4},size:"large",children:h?t.jsx(ue,{size:24}):t.jsx(cs,{})}):null,t.jsx(Z,{"data-cy":"schema-form-item-cancel",onClick:()=>c(e),style:{paddingLeft:R.edited?4:8},disabled:s||h,size:"large",children:t.jsx(zo,{})})]}):null})]})]},x)}function on({schema:e,loading:o,value:n,defaultValue:a,onChange:r,style:s,disabled:h}){const c=Object.prototype.toString.call(n)==="[object Object]",[p,x]=f.useState([]),[g,l]=f.useState(c?n:a),b=f.useMemo(()=>e.length===1,[e]),d=f.useCallback(u=>p.find(v=>v.key===u),[p]);f.useEffect(()=>{var u;b&&((u=e[0])!=null&&u.required)&&x([{key:e[0].key,editing:!0,initialValue:a[e[0].key]}])},[e,b,a]);const T=f.useCallback(u=>{x(v=>v.find(j=>j.key===u.key)?v.map(j=>j.key===u.key?u:{...j}):[u].concat(v))},[]),S=f.useCallback((u,v,w)=>{const{key:j,secure:N}=u,M=d(j)??{...u};M.editing=!0;const I=g[j]!==v;M.edited=v&&M.initialValue!==v,M.initialValue=a[j];const ne={...g,[j]:v};I&&l(ne),r({[j]:v},{allValues:ne,action:w,currentItem:u}),w==="confirm"&&N&&l({...g,[j]:"__encrypted__"}),w==="confirm"&&(M.initialValue=g[j]),["confirm","cancel"].includes(w)&&(M.editing=!1,M.edited=!1),T(M)},[a,g,r,T,d]),R=f.useCallback((u,{editing:v=!1})=>{const{key:w}=u,j=c?n[w]:g[w];return j==="__encrypted__"?v?"":"******":j},[c,n,g]),k=f.useCallback(u=>{const v=d(u.key);v&&S(u,v.initialValue,"cancel")},[d,S]),C=f.useCallback(u=>{const v=d(u.key);!v||!v.edited||(v.shaking=!0,T(v),setTimeout(()=>{v.shaking=!1,T(v)},500))},[d,T]),m=f.useCallback(u=>{const v=d(u.key);!v||!v.edited?k(u):C(u)},[d,C,k]);return t.jsx(Ws,{className:"form",style:s,children:e==null?void 0:e.map(u=>{const{hidden:v=!1}=u;return v?null:t.jsx(vt,{item:u,findEditingItem:d,getItemValue:R,onFormItemChange:S,onFocusOut:m,formValues:g,disabled:h,loading:o,onCancel:k})})})}on.propTypes={schema:i.array.isRequired,loading:i.bool,onChange:i.func.isRequired,value:i.object,defaultValue:i.object,style:i.object,disabled:i.bool};on.defaultProps={loading:!1,value:void 0,defaultValue:{},style:{},disabled:!1};const Ws=$(Or)``;function rn({meta:e,onCancel:o,mode:n,handlePaySuccess:a}){const{t:r,locale:s}=G(),{info:h}=H(),c=Vo(h),[p,x]=f.useState(null),g=new URL(e==null?void 0:e.registryUrl).origin,l=B.getDisplayName({meta:e}),b=async(T,S)=>{const R=({downloadTokenList:m})=>{a({downloadTokenList:m})},k=m=>{L.error(m),o(m)};function C(m){return Ho(()=>Qn.get(m).then(async({data:u})=>{const v=u==null?void 0:u.downloadTokenList;if(u.status==="succeed"){if(v&&v.length)await R({downloadTokenList:v});else return await k(r("blocklet.component.missDownloadTokenTip")),!0;return!0}return u.status==="error"?(console.error("vc error: ",u),await k(u==null?void 0:u.error),!0):!1}),{interval:1e3})}if(n==="purchase"&&p){const{statusUrl:m}=Ko(p);await C(m)}else await R({downloadTokenList:T.downloadTokenList&&S(T.downloadTokenList)})};if(f.useEffect(()=>{if(n==="purchase"){const T=new URL(g);T.pathname="/api/did/verify-purchase-blocklet/token",T.searchParams.set("serverDid",h.did),T.searchParams.set("blockletDid",e==null?void 0:e.did);try{Qn.get(T.href).then(({data:S})=>{const R=`${S.url}`;x(R)})}catch(S){console.error("get next workflow url error: ",S)}}return()=>{x(null)}},[n]),n==="purchase"&&!p)return"";const d={verify:{action:"verify-purchase-blocklet",checkFn:Wn.create({baseURL:g}).get,extraParams:{serverDid:h.did,blockletDid:e==null?void 0:e.did},messages:{title:r("store.purchase.verify.auth.title",{name:l}),scan:r("store.purchase.verify.auth.scan"),confirm:r("store.purchase.verify.auth.confirm"),success:r("store.purchase.verify.auth.success")}},purchase:{action:"acquire-asset",checkFn:Wn.create({baseURL:gt(g,"/store")}).get,extraParams:{factory:e.nftFactory,nw:p},messages:{title:r("store.purchase.auth.title",{name:l}),scan:r("store.purchase.auth.scan"),confirm:r("store.purchase.auth.confirm"),success:t.jsxs(t.Fragment,{children:[t.jsx("p",{children:r("store.purchase.auth.success")}),t.jsx("p",{children:r("blocklet.component.purchaseComponentSecondCheckTip")})]})}}};return t.jsx(Yo,{open:!0,locale:s,popup:!1,saveConnect:!1,className:"connect",baseUrl:g,onSuccess:b,cancelWhenScanned:o,onClose:o,checkTimeout:60*5e3,webWalletUrl:c,disableClose:!0,showDownload:!1,...d[n]})}rn.propTypes={...qr,handlePaySuccess:i.func,mode:i.oneOf(["verify","purchase"]).isRequired};rn.defaultProps={handlePaySuccess:()=>{}};const sn=f.forwardRef(({mode:e,...o},n)=>{const[a,r]=f.useState(e!=="both"?e:"verify"),[s,h]=f.useState(e!=="both"?2:1),c=x=>{x!==a&&r(x)},p=()=>{a&&s!==2&&h(2)};return f.useImperativeHandle(n,()=>({onNext:p,getCurrentStep:()=>s})),s===1?t.jsx("div",{style:{maxWidth:520},children:t.jsx(Wr,{action:a,onNext:null,onSelect:c})}):t.jsx(rn,{...o,mode:a})});sn.propTypes={mode:i.oneOf(["both","verify","purchase"]).isRequired,ref:i.any};sn.defaultProps={ref:{}};const Gs=sn;function Fs({...e}){return t.jsx(ae,{className:"bottom-button",variant:"contained",color:"primary",...e})}function an({blocklet:e,onStartNow:o,children:n,disabled:a}){const{t:r}=G(),s=vo();return!e||Qo(e.meta)?t.jsx(zs,{children:n}):t.jsxs(Vs,{isMobile:s,children:[t.jsx(Fs,{className:"start-now",variant:"contained",color:"primary",disabled:a,onClick:()=>o(),children:r("setup.startNow")}),t.jsx(y,{display:"flex",alignItems:"center",children:n})]})}an.propTypes={blocklet:i.object,onStartNow:i.func,children:i.any,disabled:i.bool};an.defaultProps={blocklet:null,onStartNow:()=>{},children:null,disabled:!1};const zs=$(y)`
79
79
  width: 100%;
80
80
  margin-top: auto;
81
81
  padding-top: 24px;
@@ -125,7 +125,7 @@ import{bW as Bo,j as t,f7 as Oo,hL as $o,l2 as Mo,aP as Wt,aQ as Gt,m as G,bq as
125
125
  overflow-y: auto;
126
126
  padding-bottom: 32px;
127
127
  overflow-x: hidden;
128
- `;function cn({onChange:e,loading:o,children:n,extra:a,stores:r,storageKey:s}){const{t:h}=G(),{info:c,inService:p}=H(),{blocklet:x}=pe(),[g,l]=f.useState(!1),b=f.useRef(null),[d,T]=f.useState(),[S,R]=bs(s||"tmp"),[k,C]=s?[S,R]:[d,T],{storeList:m,teamDid:u}=lo({fromBlocklet:p,blocklet:x,nodeInfo:c}),v=co([...r.map(j=>({...j,protected:!0})),...m],"url"),w=k&&v.find(j=>k===j.url)||v[0];return t.jsxs(t.Fragment,{children:[t.jsxs(Ks,{children:[t.jsx(ae,{ref:b,color:"primary","data-cy":"add-component-select-store",endIcon:t.jsx(vs,{color:"primary"}),onClick:()=>{l(!0)},style:{padding:"0 2px"},children:t.jsx(te,{color:"primary",children:w.name})}),t.jsx(te,{color:"primary",children:a})]}),t.jsxs(K,{id:"mui-registry-select",select:!0,autoComplete:"off",variant:"outlined",name:"did",helperText:h("blocklet.component.selectRegistryTip"),"data-cy":"component-registry-select",fullWidth:!0,value:w,autoFocus:!0,onChange:j=>{const N=j.target.value;C(N.url),e(N)},SelectProps:{open:g,MenuProps:{anchorEl:b.current},renderValue:j=>j==null?void 0:j.name,onClose:()=>{l(!1)}},style:{display:"none"},margin:"normal",children:[v==null?void 0:v.map(j=>t.jsx(ye,{sx:{width:"400px",maxWidth:"90vw"},value:j,"data-cy":j.url,children:t.jsx(Gr,{teamDid:u,store:j,onDelete:()=>{var N;k===j.url&&C((N=v[0])==null?void 0:N.url)}})},j.url)),!xo.isInServerlessMode(c)&&t.jsx(zr,{disabled:o,storeList:v,teamDid:u,onAdd:j=>{C(j)}})]}),n({currentRegistry:w})]})}cn.propTypes={onChange:i.func,loading:i.bool,children:i.any.isRequired,extra:i.node,storageKey:i.string,stores:i.arrayOf(i.shape({name:i.string.isRequired,url:i.string.isRequired}))};cn.defaultProps={onChange:()=>{},loading:!1,extra:"",stores:[],storageKey:""};const Ks=$.div`
128
+ `;function cn({onChange:e,loading:o,children:n,extra:a,stores:r,storageKey:s}){const{t:h}=G(),{info:c,inService:p}=H(),{blocklet:x}=pe(),[g,l]=f.useState(!1),b=f.useRef(null),[d,T]=f.useState(),[S,R]=bs(s||"tmp"),[k,C]=s?[S,R]:[d,T],{storeList:m,teamDid:u}=lo({fromBlocklet:p,blocklet:x,nodeInfo:c}),v=co([...r.map(j=>({...j,protected:!0})),...m],"url"),w=k&&v.find(j=>k===j.url)||v[0];return t.jsxs(t.Fragment,{children:[t.jsxs(Ks,{children:[t.jsx(ae,{ref:b,color:"primary","data-cy":"add-component-select-store",endIcon:t.jsx(vs,{color:"primary"}),onClick:()=>{l(!0)},style:{padding:"0 2px"},children:t.jsx(te,{color:"primary",children:w.name})}),t.jsx(te,{color:"primary",children:a})]}),t.jsxs(K,{id:"mui-registry-select",select:!0,autoComplete:"off",variant:"outlined",name:"did",helperText:h("blocklet.component.selectRegistryTip"),"data-cy":"component-registry-select",fullWidth:!0,value:w,autoFocus:!0,onChange:j=>{const N=j.target.value;C(N.url),e(N)},SelectProps:{open:g,MenuProps:{anchorEl:b.current},renderValue:j=>j==null?void 0:j.name,onClose:()=>{l(!1)}},style:{display:"none"},margin:"normal",children:[v==null?void 0:v.map(j=>t.jsx(ye,{sx:{width:"400px",maxWidth:"90vw"},value:j,"data-cy":j.url,children:t.jsx(Gr,{teamDid:u,store:j,onDelete:()=>{var N;k===j.url&&C((N=v[0])==null?void 0:N.url)}})},j.url)),!xo.isInServerlessMode(c)&&t.jsx(Fr,{disabled:o,storeList:v,teamDid:u,onAdd:j=>{C(j)}})]}),n({currentRegistry:w})]})}cn.propTypes={onChange:i.func,loading:i.bool,children:i.any.isRequired,extra:i.node,storageKey:i.string,stores:i.arrayOf(i.shape({name:i.string.isRequired,url:i.string.isRequired}))};cn.defaultProps={onChange:()=>{},loading:!1,extra:"",stores:[],storageKey:""};const Ks=$.div`
129
129
  display: flex;
130
130
  justify-content: space-between;
131
131
  align-items: center;
@@ -136,7 +136,7 @@ import{bW as Bo,j as t,f7 as Oo,hL as $o,l2 as Mo,aP as Wt,aQ as Gt,m as G,bq as
136
136
  color: ${e=>e.theme.palette.text.primary};
137
137
  // font-weight: bold;
138
138
  }
139
- `,Hs={width:24,height:24,body:'<path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 5a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v4a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1zm0 10a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v4a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1zm10 0a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v4a1 1 0 0 1-1 1h-4a1 1 0 0 1-1-1zm0-8h6m-3-3v6"/>'},Qs={width:24,height:24,body:'<g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><path d="m17 10l-2-6m-8 6l2-6m4 16H7.244a3 3 0 0 1-2.965-2.544l-1.255-7.152A2 2 0 0 1 5.001 8H19a2 2 0 0 1 1.977 2.304"/><path d="M10 14a2 2 0 1 0 4 0a2 2 0 0 0-4 0m11 1h-2.5a1.5 1.5 0 0 0 0 3h1a1.5 1.5 0 0 1 0 3H17m2 0v1m0-8v1"/></g>'},Zs={width:24,height:24,body:'<path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m7 11l5-5l5 5M7 17l5-5l5 5"/>'},Xs=(e,o)=>gt(o,`/blocklets/${e.did}`),no=({blocklet:e,attribute:o,value:n})=>e._formatted?e._formatted[o]:n,Js=e=>e.inStore&&B.isFreeBlocklet(e)===!1;function dn({blocklet:e,blocklets:o,handleButtonClick:n,endpoint:a,serverVersion:r}){var R,k;const{t:s}=G();let h=gt(a,or(e.did,e.logo||""));try{const C=new URL(h);C.searchParams.set("v",e.version||+new Date),h=C.href}catch{}const[c,p]=f.useState(!1),x=async()=>{try{p(!0),await n({meta:e,registryUrl:a,blocklets:o})}catch(C){L.error(C.message)}finally{p(!1)}},{blocklet:g}=pe(),l=()=>((g==null?void 0:g.children)||[]).find(u=>u.meta.bundleDid===e.did).meta.version,d=(()=>{const C=((g==null?void 0:g.children)||[]).find(m=>m.meta.bundleDid===e.did);if(C){try{const m=C.meta.version,u=e.version;if(rr.gt(u,m))return"upgrade"}catch{return"install"}return"disable"}return"install"})(),T=(R=e.requirements)==null?void 0:R.server,S=[];return d==="upgrade"?S.push({key:"upgrade",icon:t.jsx(Q,{icon:Zs,color:"success.light",width:20,height:20},"version"),title:`${l()} -> ${e.version}`,align:"right",color:"success.light",maxWidth:300,text:t.jsx(y,{sx:{fontWeight:"bold"},children:s("blocklet.component.upgradeAvailable")})}):d==="disable"?S.push({key:"disable",icon:t.jsx(Q,{icon:Hs,color:"text.disabled",width:20,height:20},"disable"),align:"right",maxWidth:300,color:"text.disabled",text:s("blocklet.component.installed")}):Js(e)&&S.push({key:"purchase",icon:t.jsx(Q,{icon:Qs,color:"primary.main",width:20,height:20},"purchase"),align:"right",maxWidth:300,color:"primary.main",text:s("blocklet.component.needBuy")}),t.jsx(ei,{title:no({blocklet:e,attribute:"title",value:e.title||e.name}),did:e.did,description:no({blocklet:e,attribute:"description",value:e.description}),cover:e.logo?h:"",version:e.version,onButtonClick:null,"data-cy":"install-blocklet",sx:d!=="disable"?{"&:hover, && *":{cursor:"pointer"}}:{"&:after, &:before":{content:'""',opacity:"0 !important"}},onMainClick:d==="disable"?void 0:x,icons:(k=e.docker)!=null&&k.image?[{key:"docker",icon:t.jsx(y,{display:"flex",color:"primary.main",children:t.jsx(Q,{icon:yo})}),title:s("blocklet.dockerImage")}]:[],official:e.isOfficial?{tooltip:s("blocklet.component.isOfficial")}:void 0,download:e.stats.downloads,status:S,button:t.jsx(Vr,{serverVersion:r,requirementVersion:T,size:"small",children:t.jsx("div",{style:{display:"flex",alignItems:"center"},children:t.jsx(Yr,{children:t.jsx(ae,{size:"small",disabled:c,variant:"outlined",color:"primary",onClick:C=>{C.preventDefault(),C.stopPropagation();const m=Xs(e,a);m&&window.open(m,"_blank","noopener,noreferrer")},children:s("common.detail")},e.did)})})})})}dn.propTypes={blocklet:i.object.isRequired,blocklets:i.array,handleButtonClick:i.func,endpoint:i.string,serverVersion:i.string};dn.defaultProps={handleButtonClick:null,endpoint:"",blocklets:[],serverVersion:""};function un({handleButtonClick:e,handleSearchSelect:o,storeUrl:n,handleBlockletRender:a,extraFilter:r,serverVersion:s,resourceType:h,resourceDid:c,showResourcesSwitch:p,showCategory:x,compact:g,...l}){const b=ft(),{locale:d}=G(),[T,S]=f.useState(!1),[R,k]=f.useState({}),C=v=>{k(v)},m=n,u=f.useMemo(()=>Jo(b,{palette:{background:{default:b.palette.background.paper}}}),[b]);return f.useEffect(()=>{k({showResources:!0,resourceType:h,resourceDid:c})},[m,h,c]),f.useEffect(()=>{S(!0),k({showResources:!0,resourceType:h,resourceDid:c})},[]),t.jsx(er,{theme:u,children:t.jsx(tr,{FallbackComponent:nr,resetKeys:[m],children:t.jsxs(y,{...l,sx:[{overflow:"auto",".title-bar + div":{height:"unset"}},Array.isArray(l.sx)?l.sx:[l.sx]],children:[T&&t.jsx(Fr,{showCategory:x,showResourcesSwitch:p,blockletRender:v=>{const w={...v,handleButtonClick:e,endpoint:m};return a({...v,defaultRender:t.jsx(dn,{...w})})},compact:g,minItemWidth:300,baseSearch:!0,endpoint:m,locale:d,onFilterChange:C,onSearchSelect:o,filters:R,extraFilter:r,serverVersion:s,fetchCategoryDelay:500}),t.jsx(y,{sx:{mt:2},children:" "})]})})})}un.propTypes={storeUrl:i.string.isRequired,handleButtonClick:i.func,handleSearchSelect:i.func,handleBlockletRender:i.func,extraFilter:i.func,serverVersion:i.string,resourceType:i.string,resourceDid:i.string,showResourcesSwitch:i.bool,showCategory:i.bool,compact:i.bool};un.defaultProps={handleButtonClick:null,handleSearchSelect:null,handleBlockletRender:null,extraFilter:void 0,serverVersion:"",resourceType:"",resourceDid:"",showResourcesSwitch:!0,showCategory:!0,compact:!1};const ei=$(Kr)`
139
+ `,Hs={width:24,height:24,body:'<path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 5a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v4a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1zm0 10a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v4a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1zm10 0a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v4a1 1 0 0 1-1 1h-4a1 1 0 0 1-1-1zm0-8h6m-3-3v6"/>'},Qs={width:24,height:24,body:'<g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><path d="m17 10l-2-6m-8 6l2-6m4 16H7.244a3 3 0 0 1-2.965-2.544l-1.255-7.152A2 2 0 0 1 5.001 8H19a2 2 0 0 1 1.977 2.304"/><path d="M10 14a2 2 0 1 0 4 0a2 2 0 0 0-4 0m11 1h-2.5a1.5 1.5 0 0 0 0 3h1a1.5 1.5 0 0 1 0 3H17m2 0v1m0-8v1"/></g>'},Zs={width:24,height:24,body:'<path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m7 11l5-5l5 5M7 17l5-5l5 5"/>'},Xs=(e,o)=>gt(o,`/blocklets/${e.did}`),no=({blocklet:e,attribute:o,value:n})=>e._formatted?e._formatted[o]:n,Js=e=>e.inStore&&B.isFreeBlocklet(e)===!1;function dn({blocklet:e,blocklets:o,handleButtonClick:n,endpoint:a,serverVersion:r}){var R,k;const{t:s}=G();let h=gt(a,or(e.did,e.logo||""));try{const C=new URL(h);C.searchParams.set("v",e.version||+new Date),h=C.href}catch{}const[c,p]=f.useState(!1),x=async()=>{try{p(!0),await n({meta:e,registryUrl:a,blocklets:o})}catch(C){L.error(C.message)}finally{p(!1)}},{blocklet:g}=pe(),l=()=>((g==null?void 0:g.children)||[]).find(u=>u.meta.bundleDid===e.did).meta.version,d=(()=>{const C=((g==null?void 0:g.children)||[]).find(m=>m.meta.bundleDid===e.did);if(C){try{const m=C.meta.version,u=e.version;if(rr.gt(u,m))return"upgrade"}catch{return"install"}return"disable"}return"install"})(),T=(R=e.requirements)==null?void 0:R.server,S=[];return d==="upgrade"?S.push({key:"upgrade",icon:t.jsx(Q,{icon:Zs,color:"success.light",width:20,height:20},"version"),title:`${l()} -> ${e.version}`,align:"right",color:"success.light",maxWidth:300,text:t.jsx(y,{sx:{fontWeight:"bold"},children:s("blocklet.component.upgradeAvailable")})}):d==="disable"?S.push({key:"disable",icon:t.jsx(Q,{icon:Hs,color:"text.disabled",width:20,height:20},"disable"),align:"right",maxWidth:300,color:"text.disabled",text:s("blocklet.component.installed")}):Js(e)&&S.push({key:"purchase",icon:t.jsx(Q,{icon:Qs,color:"primary.main",width:20,height:20},"purchase"),align:"right",maxWidth:300,color:"primary.main",text:s("blocklet.component.needBuy")}),t.jsx(ei,{title:no({blocklet:e,attribute:"title",value:e.title||e.name}),did:e.did,description:no({blocklet:e,attribute:"description",value:e.description}),cover:e.logo?h:"",version:e.version,onButtonClick:null,"data-cy":"install-blocklet",sx:d!=="disable"?{"&:hover, && *":{cursor:"pointer"}}:{"&:after, &:before":{content:'""',opacity:"0 !important"}},onMainClick:d==="disable"?void 0:x,icons:(k=e.docker)!=null&&k.image?[{key:"docker",icon:t.jsx(y,{display:"flex",color:"primary.main",children:t.jsx(Q,{icon:yo})}),title:s("blocklet.dockerImage")}]:[],official:e.isOfficial?{tooltip:s("blocklet.component.isOfficial")}:void 0,download:e.stats.downloads,status:S,button:t.jsx(Vr,{serverVersion:r,requirementVersion:T,size:"small",children:t.jsx("div",{style:{display:"flex",alignItems:"center"},children:t.jsx(Yr,{children:t.jsx(ae,{size:"small",disabled:c,variant:"outlined",color:"primary",onClick:C=>{C.preventDefault(),C.stopPropagation();const m=Xs(e,a);m&&window.open(m,"_blank","noopener,noreferrer")},children:s("common.detail")},e.did)})})})})}dn.propTypes={blocklet:i.object.isRequired,blocklets:i.array,handleButtonClick:i.func,endpoint:i.string,serverVersion:i.string};dn.defaultProps={handleButtonClick:null,endpoint:"",blocklets:[],serverVersion:""};function un({handleButtonClick:e,handleSearchSelect:o,storeUrl:n,handleBlockletRender:a,extraFilter:r,serverVersion:s,resourceType:h,resourceDid:c,showResourcesSwitch:p,showCategory:x,compact:g,...l}){const b=ft(),{locale:d}=G(),[T,S]=f.useState(!1),[R,k]=f.useState({}),C=v=>{k(v)},m=n,u=f.useMemo(()=>Jo(b,{palette:{background:{default:b.palette.background.paper}}}),[b]);return f.useEffect(()=>{k({showResources:!0,resourceType:h,resourceDid:c})},[m,h,c]),f.useEffect(()=>{S(!0),k({showResources:!0,resourceType:h,resourceDid:c})},[]),t.jsx(er,{theme:u,children:t.jsx(tr,{FallbackComponent:nr,resetKeys:[m],children:t.jsxs(y,{...l,sx:[{overflow:"auto",".title-bar + div":{height:"unset"}},Array.isArray(l.sx)?l.sx:[l.sx]],children:[T&&t.jsx(zr,{showCategory:x,showResourcesSwitch:p,blockletRender:v=>{const w={...v,handleButtonClick:e,endpoint:m};return a({...v,defaultRender:t.jsx(dn,{...w})})},compact:g,minItemWidth:300,baseSearch:!0,endpoint:m,locale:d,onFilterChange:C,onSearchSelect:o,filters:R,extraFilter:r,serverVersion:s,fetchCategoryDelay:500}),t.jsx(y,{sx:{mt:2},children:" "})]})})})}un.propTypes={storeUrl:i.string.isRequired,handleButtonClick:i.func,handleSearchSelect:i.func,handleBlockletRender:i.func,extraFilter:i.func,serverVersion:i.string,resourceType:i.string,resourceDid:i.string,showResourcesSwitch:i.bool,showCategory:i.bool,compact:i.bool};un.defaultProps={handleButtonClick:null,handleSearchSelect:null,handleBlockletRender:null,extraFilter:void 0,serverVersion:"",resourceType:"",resourceDid:"",showResourcesSwitch:!0,showCategory:!0,compact:!1};const ei=$(Kr)`
140
140
  .ms-highlight {
141
141
  color: ${e=>e.theme.palette.primary.main};
142
142
  }
@@ -281,7 +281,7 @@ import{bW as Bo,j as t,f7 as Oo,hL as $o,l2 as Mo,aP as Wt,aQ as Gt,m as G,bq as
281
281
  & .connect {
282
282
  background: white;
283
283
  }
284
- `,oi=pn,ri=e=>e.inStore&&B.isFreeBlocklet(e)===!1,si=e=>{var o;return[Y.BLOCKLET_APP_SPACE_REQUIREMENT.REQUIRED,Y.BLOCKLET_APP_SPACE_REQUIREMENT.REQUIRED_ON_SETUP].includes((o=e==null?void 0:e.capabilities)==null?void 0:o.didSpace)},Ot=e=>{var o,n;return((n=(o=e==null?void 0:e.configs)==null?void 0:o.find(a=>a.key===Y.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_SPACE_ENDPOINT))==null?void 0:n.value)||null},ii=e=>(e.environments||[]).some(o=>o.required),ro=(e,o)=>e==null?void 0:e.some(n=>n.required&&!o[n.key]),ai=({params:e,blocklet:o,t:n})=>{const a=e.title||e.name;return a?((o==null?void 0:o.children)||[]).find(s=>s.meta.bundleDid===e.bundleDid)?n("blocklet.component.upgradeNext",{name:a}):n("blocklet.component.addNext",{name:a}):n("common.next")},so=({componentDid:e,timeout:o=1e3,manual:n=!1}={})=>{setTimeout(()=>{window.parent.postMessage({event:"component.installed",componentDid:e,manual:n},"*")},o)};function mn({onClose:e,mode:o,stores:n,resourceType:a,resourceDid:r,storageKey:s,inDialog:h,selectedMeta:c,storeUrl:p,showResourcesSwitch:x,showFromUrl:g,enableRunBackground:l,showCategory:b}){var _n,In,Dn,Un,Je,Nn,et,Ln,Bn,On;const{t:d,locale:T}=G(),[S,R]=f.useState(!1),[k,C]=f.useState(null),[m,u]=f.useState(""),[v,w]=f.useState(""),{api:j,ws:{useSubscription:N},inService:M,info:X}=H(),{blocklet:I,actions:{refreshBlocklet:ne}}=pe(),[me,J]=f.useState(null),[Pe,we]=f.useState(!1),Ee={bundleDid:"",componentDid:"",componentName:"",pathPrefix:"",name:"",title:"",configsList:[],configsValue:{},hasMissRequiredConfigs:!1,hasEnvironmentsStep:!1,hasRequiredEnvironments:!1,requirePurchase:!1,didSpaceIsRequiredSetup:null,installResultProps:{},purchaseResultProps:{},showFromUrlDialog:!1},[_,fe]=f.useState(Ee),[W,he]=f.useState(0),A=f.useRef({}),ke=f.useRef({}),le=f.useRef({}),_e=uo(P=>P.breakpoints.down("md")),E=ir(),[V,ce]=f.useState(!0),{meta:z}=A.current,ee=as(z),be=f.useRef(!1),F=P=>fe(D=>({...D,...P}));f.useEffect(()=>{if(_.pathPrefix){const{errMsg:P}=kn({..._,pathPrefix:_.pathPrefix,locale:T});u(P)}},[_.pathPrefix]),f.useEffect(()=>{W===0&&fe(Ee)},[W]);const Ie=()=>{const P=Ot(I)??"";F({didSpaceEndpoint:P})},Re=()=>{var P;return(P=A==null?void 0:A.current)!=null&&P.meta?B.getDisplayName(A.current):""},Ge=()=>{R(!1),fe({}),be.current=!1,A.current={},e()},Le=P=>{const D=O=>{F({installResultProps:{variant:"error",title:Re(),subTitle:P,footer:t.jsx(ae,{className:"bottom-button",disabled:O,"data-cy":"retry-install-component",onClick:async()=>{D(!0),await Pn(A.current.installInput)},children:t.jsxs(y,{display:"flex",alignItems:"center",children:[O&&t.jsx(ue,{size:16,style:{marginRight:8}}),d("common.retry")]})})}})};D()},Xe=P=>D=>{var O,q;(((O=D==null?void 0:D.meta)==null?void 0:O.did)||(D==null?void 0:D.meta))===((q=I==null?void 0:I.meta)==null?void 0:q.did)&&P(D)},_o=()=>{so({timeout:0,componentDid:E.componentDid,manual:!0}),Ge(),setTimeout(()=>{const P=document.getElementsByClassName("dashboard-main")[0];P&&(P.scrollTop=P.scrollHeight)},200)};N(Y.BlockletEvents.componentInstalled,Xe(()=>{F({installResultProps:{variant:"success",title:Re(),subTitle:d("blocklet.component.installSuccessTip")}}),so({componentDid:E.componentDid})}),[(_n=I==null?void 0:I.meta)==null?void 0:_n.did]),N(Y.BlockletEvents.statusChange,Xe(()=>{const P=Ot(I);F(D=>({...D,didSpaceEndpoint:P}))}),[(In=I==null?void 0:I.meta)==null?void 0:In.did]),N(Y.BlockletEvents.downloadFailed,Xe(()=>{be.current=!1,Le(d("blocklet.component.installComponentError"))}),[(Dn=I==null?void 0:I.meta)==null?void 0:Dn.did]),N(Y.BlockletEvents.installFailed,Xe(()=>{be.current=!1,Le(d("blocklet.component.installComponentError"))}),[(Un=I==null?void 0:I.meta)==null?void 0:Un.did]);const de=[],Tn=P=>((I==null?void 0:I.children)||[]).find(D=>D.meta.did===P),Pn=async P=>{var Oe,$e;be.current=!0;const{pathPrefix:D,bundleDid:O,title:q,componentName:De="",componentDid:Be=""}=_,Ue=((Oe=A.current)==null?void 0:Oe.meta)||{},{configs:Se=[],registryUrl:Te,inStore:Fe,inputUrl:Ve,dist:Pt}=Ue,Ye=($e=A.current)==null?void 0:$e.downloadTokenList,re=Ve||(Fe?Gn(Te,O,Pt):"");R(!0);const tt={rootDid:I.meta.did,url:re,mountPoint:D?je(D):`/${je(Ue.title||Ue.name)}`,title:q,name:De,did:Be,dist:{tarball:"",integrity:""},onlyRequired:!V,..._.hasEnvironmentsStep&&Se.length>0?{configs:Se.map(xe=>({...xe,value:_.configsValue[xe.key]||""}))}:{},...Ye?{downloadTokenList:Ye}:{},...P};try{if(await j.installComponent({input:tt}),Te){const{teamDid:xe,storeList:Me}=lo({fromBlocklet:M,nodeInfo:X,blocklet:I}),{isNew:kt,decoded:nt}=cr(Te,Me);kt&&await j.addBlockletStore({input:{teamDid:xe,url:nt}})}F({installResultProps:{}}),ne({showError:!1,attachRuntimeInfo:!1})}catch(xe){const Me=ie(xe);L.error(Me),console.error("installComponent error: ",xe),Le(Me)}finally{R(!1),A.current.installInput=tt}},kn=P=>{const D=jo({params:{...P,did:P.bundleDid},blocklets:[I],blocklet:I,locale:T});if(D){const O=Tn(P.bundleDid),q=js({params:{...P,did:P.bundleDid},blocklet:I});if(O&&O.mountPoint===q)return{errMsg:""}}return{errMsg:D}},ge=async P=>{var O,q;const{errMsg:D}=kn({..._,locale:T});u(D),W===de.length-2&&!be.current&&await Pn(P),(q=(O=ke.current)==null?void 0:O.setActiveStepByIndex)==null||q.call(O,De=>De+1)},ze=()=>{var P,D;(D=(P=ke.current)==null?void 0:P.setActiveStepByIndex)==null||D.call(P,O=>O-1)},Io=()=>{const{pathPrefix:P,bundleDid:D,title:O,componentName:q="",componentDid:De=""}=_,{meta:Be={}}=A.current||{},{registryUrl:Ue,inStore:Se,inputUrl:Te,dist:Fe}=Be,Ve=Se?Gn(Ue,D,Fe):Te;J({meta:Be,installOpts:{type:"component",rootDid:I.meta.did,mountPoint:P,url:Ve,title:O,name:q,did:De}})},Do=P=>{we(!1),F({purchaseResultProps:{variant:"error",title:Re(),subTitle:P,style:{paddingTop:120},footer:t.jsx(ae,{className:"bottom-button","data-cy":"retry-purchase-component",onClick:()=>{F({purchaseResultProps:{}})},children:d("common.retry")})}})},Uo=({downloadTokenList:P})=>{A.current.downloadTokenList=P,we(!1),ge()},Tt=({chooseParams:P=A.current,componentDid:D,isInit:O=!1})=>{var nt,$n,Mn,An;const{meta:q,registryUrl:De,inStore:Be,inputUrl:Ue}=P,{did:Se,title:Te,name:Fe}=q,Ve=(((nt=I.settings)==null?void 0:nt.children)||[]).filter(se=>se.status==="deleted"&&se.meta.bundleDid===Se),Pt=D||"",Ye=($n=q.environments)==null?void 0:$n.map(se=>{const{name:_t,validation:ot,...rt}=se,It={validation:dr(ot)?"":ot};return{...rt,key:_t,...It}});A.current={...P,meta:{...q,configs:Ye,registryUrl:De,inStore:Be,inputUrl:Ue}};let re={};if(O){const se=[I],_t=Ye||[],ot=[],rt=co(lr([..._t,...ot]),"key").filter(Ae=>!!Ae.key).sort((Ae,st)=>Ae.required&&!st.required?-1:st.required&&!Ae.required?1:0),It=B.getSharedConfigObj(se[0],{configs:rt}),Dt={},qn=rt.map(Ae=>{const{default:st,key:it,...Lo}=Ae;return Dt[it]=It[it]||st,{...Lo,key:it,hidden:!!Y.BLOCKLET_CONFIGURABLE_KEY[it]}});re={...re,configsList:qn,configsValue:Dt,hasMissRequiredConfigs:ro(qn,Dt)}}const tt=I.children.some(se=>se.mountPoint==="/"),Oe=Ve.find(se=>se.meta.bundleDid===Se),$e=I.children.find(se=>se.meta.bundleDid===Se);re.title=Te||"",Oe?re={...re,pathPrefix:Oe.mountPoint||"",componentName:Oe.meta.name,hasEnvironmentsStep:!1}:$e?re={...re,pathPrefix:$e.mountPoint||"",componentName:$e.meta.name,hasEnvironmentsStep:!1}:re={...re,pathPrefix:tt?`/${je(Te)||je(Fe)}`.toLowerCase():"/",componentName:"",hasEnvironmentsStep:((An=(Mn=A.current.meta)==null?void 0:Mn.environments)==null?void 0:An.length)>0};const xe=ri(A.current.meta),Me=si(A.current.meta),kt=Ot(I);F({bundleDid:Se,componentDid:Pt,...re,hasRequiredEnvironments:ii(A.current.meta),requirePurchase:xe,didSpaceIsRequiredSetup:Me,didSpaceEndpoint:kt}),O&&xe&&Io()};f.useEffect(()=>{!c||W!==0||!I||(Tt({chooseParams:{blocklets:[c],meta:c,registryUrl:p||c.homepage,inStore:!0},isInit:!0}),F({showFromUrlDialog:!1}),ge())},[c,W,I]),de.push({key:"selectComponent",name:d("blocklet.component.selectComponent"),body:t.jsxs(Ne,{sx:{width:400,display:"flex",flexDirection:"column"},component:"div",children:[g&&_.showFromUrlDialog&&t.jsx(gs,{mode:"component",onCancel:()=>{F({showFromUrlDialog:!1})},onSuccess:({meta:P,inputUrl:D,inStore:O,registryUrl:q})=>{Tt({chooseParams:{meta:P,inputUrl:D,inStore:O,registryUrl:q},isInit:!0}),F({showFromUrlDialog:!1}),ge()},handleText:{title:d("blocklet.component.addComponentTip.fromUrl"),confirm:d("blocklet.component.choose")}}),t.jsx(cn,{stores:n,extra:xo.isInServerlessMode(X)?null:g?t.jsxs(ae,{variant:"text",color:"primary","data-cy":"add-component-from-url",onClick:()=>{F({showFromUrlDialog:!0})},style:{padding:"0 2px"},children:[t.jsx(Yt,{style:{fontSize:20,marginRight:4}}),d("blocklet.component.addComponentTip.fromUrl")]}):null,loading:S,onChange:()=>{fe({}),A.current={}},storageKey:s,children:({currentRegistry:P})=>t.jsx(un,{showResourcesSwitch:x,showCategory:b,serverVersion:X==null?void 0:X.version,compact:!0,style:{flex:1,overflow:"hidden",height:"100%"},storeUrl:P.url,resourceType:a,resourceDid:r,handleButtonClick:D=>{Tt({chooseParams:{...D,inStore:!0},isInit:!0})},handleBlockletRender:({blocklet:D,defaultRender:O})=>{const q=(_==null?void 0:_.bundleDid)&&(_==null?void 0:_.bundleDid)===(D==null?void 0:D.did);return t.jsxs(ci,{children:[t.jsx(y,{className:q?"choose-blocklet":"",sx:{"& > div":{position:"relative","&:before, &:after":{content:'""',position:"absolute",width:"0",height:"0",opacity:0,transition:"width 0.3s, height 0.3s, opacity 0.3s",borderRadius:"8px",pointerEvents:"none",...q?{width:"100%",height:"100%",opacity:1}:{}},"&:before":{top:0,left:0,borderTop:"1px solid",borderLeft:"1px solid",borderColor:"primary.main"},"&:after":{bottom:0,right:0,borderBottom:"1px solid",borderRight:"1px solid",borderColor:"primary.main"},"&:hover":{"&:before, &:after":{width:"100%",height:"100%",opacity:1}}}},style:{marginLeft:16},children:O}),q&&t.jsx(y,{className:"check-container",children:t.jsx(ar,{className:"check-icon"})})]})}})})]}),cancel:o==="embed"?void 0:d("common.cancel"),confirm:ai({params:_,blocklet:I,t:d}),onCancel:Ge,onConfirm:()=>{ge()}}),de.push({key:"agreement",name:d("launchBlocklet.introduction"),body:t.jsxs(Ne,{component:"div",className:"agreement-wrapper",children:[t.jsx(Co,{title:d("launchBlocklet.introduction"),subTitle:d("blocklet.component.addComponentTip.introduction")}),t.jsx(ls,{meta:z,onClickNext:ge,installRelated:V,onChangeInstallRelated:ce,handleDescEle:t.jsx("p",{children:d("blocklet.component.addComponentTip.belowInformation")})})]}),cancel:c?void 0:d("common.pre"),disabled:!ee,confirm:d(ee?"launchBlocklet.next":"launchBlocklet.canNotInstall"),onCancel:c?Ge:ze,onConfirm:()=>{we(!1),ge()}}),z&&_.requirePurchase&&de.push({key:"purchase",name:t.jsxs(t.Fragment,{children:[d("common.verifyNFT"),t.jsx(dt,{})]}),body:t.jsxs(Ne,{component:"div",className:"flex-align-center",style:{flexDirection:"column"},children:[!(((Nn=(Je=le.current)==null?void 0:Je.getCurrentStep)==null?void 0:Nn.call(Je))===2||Pe)&&t.jsx(ct,{title:d("common.verifyNFT"),subTitle:d("blocklet.component.addComponentTip.verifyNFT")}),at(_.purchaseResultProps)?me&&t.jsx(Gs,{ref:le,meta:me.meta,mode:_.componentDid?"verify":"both",onCancel:Do,installOpts:me.installOpts,handlePaySuccess:Uo}):t.jsx("div",{className:"flex-align-center flex-justify-center",children:t.jsx(Hn,{..._.purchaseResultProps})})]}),disabled:((Ln=(et=le.current)==null?void 0:et.getCurrentStep)==null?void 0:Ln.call(et))===2||Pe,cancel:d("common.pre"),confirm:d("common.next"),onConfirm:()=>{typeof le.current.onNext=="function"&&(le.current.onNext(),we(!0))},onCancel:()=>{ze()}}),B.hasStartEngine(z)&&po.hasMountPoint(z)?de.push({key:"config",name:d("common.config"),error:m,body:t.jsxs(Ne,{component:"div",children:[t.jsx(ct,{title:d("common.config"),subTitle:d("blocklet.component.addComponentTip.config")}),t.jsx(K,{label:d("blocklet.component.mountPoint"),autoComplete:"off",variant:"outlined",name:"pathPrefix",inputProps:{"data-cy":"mount-point-input"},fullWidth:!0,helperText:v||d("blocklet.component.mountPointTip"),style:{marginBottom:32},margin:"normal",value:_.pathPrefix,onChange:P=>{const D=P.target.value;F({pathPrefix:D}),w(d("common.slugifyHint",{value:zt(D)}))}}),!!m&&t.jsx($t,{severity:"error",style:{width:"100%",marginTop:8},children:m})]}),cancel:d("common.pre"),confirm:d("common.next"),onCancel:ze,onConfirm:()=>{ge()}}):z&&(_.pathPrefix=((On=(Bn=z.interfaces)==null?void 0:Bn[0])==null?void 0:On.path)||`/${z.did}`),z&&(_!=null&&_.hasEnvironmentsStep)&&de.push({key:"environment",name:t.jsxs(t.Fragment,{children:[d("common.environment")," ",_.hasRequiredEnvironments&&t.jsx(dt,{})]}),disabled:!!k||(_==null?void 0:_.hasMissRequiredConfigs),body:()=>t.jsxs(Ne,{component:"div",style:{overflowY:"auto"},children:[t.jsx(ct,{title:d("common.environment"),subTitle:d("blocklet.component.addComponentTip.environment")}),t.jsx(on,{style:{marginTop:-12,width:"100%"},schema:_.configsList,defaultValue:_.configsValue,onChange:(P,{action:D,currentItem:O,allValues:q})=>{D==="confirm"&&F({hasMissRequiredConfigs:ro(_.configsList,q),configsValue:q}),D==="edit"?C(O):["cancel","confirm"].includes(D)&&C(null)}})]}),cancel:d("common.pre"),confirm:d("common.next"),onCancel:ze,onConfirm:ge}),z&&(_!=null&&_.didSpaceIsRequiredSetup)&&de.push({key:"didSpace",name:t.jsxs(t.Fragment,{children:[d("blocklet.component.didSpaceConfig")," ",_.didSpaceIsRequiredSetup==="required"&&t.jsx(dt,{})]}),disabled:(_==null?void 0:_.didSpaceIsRequiredSetup)&&!_.didSpaceEndpoint,body:()=>t.jsx(ss,{children:t.jsxs(Ne,{component:"div",children:[t.jsx(ct,{title:d("blocklet.component.didSpaceConfig"),subTitle:d("blocklet.component.didSpaceConfigTip")}),t.jsx(y,{sx:{mt:"36px","& > div":{maxWidth:"unset !important","& .MuiAutocomplete-root":{maxWidth:"unset !important"}}},children:t.jsx(ln,{blockletMeta:A.current.meta,onNext:()=>{ge()},onEndpointUpdate:Ie})})]})}),cancel:d("common.pre"),confirm:d("common.next"),onCancel:ze,onConfirm:ge}),de.push({key:"install",name:Tn(z==null?void 0:z.did)?d("common.upgrade"):d("common.install"),disabled:l?!1:at(_.installResultProps),loading:l?!1:at(_.installResultProps),body:t.jsx(Ne,{component:"div",className:"flex-justify-center flex-align-center",style:{flexDirection:"column"},children:at(_.installResultProps)?t.jsx(Jr,{message:t.jsx(di,{children:d(l?"blocklet.component.installingCanCloseWindowTip":"blocklet.component.installingTip")}),increaseSpeed:.3,messageLoop:!1}):t.jsx("div",{style:{marginTop:120},children:t.jsx(Hn,{..._.installResultProps})})}),confirm:d("common.complete"),onConfirm:_o});const oe=de[W]||{},No=()=>S||oe.error||!_.bundleDid?!0:W>1?!_.pathPrefix:!1;return I?t.jsxs(li,{sx:h?{height:{xs:"calc(100vh - 72px - 32px)",md:"72vh"},"&& .ll-header":{p:3},"&& .MuiDialogContent-root":{p:0},"&& .layout-content":{p:0,pl:{xs:0,md:2},pb:0,"& .filter-bar":{pt:0,pl:2}}}:{width:"100%",height:"100vh"},children:[t.jsx(es,{steps:de,mode:"memory",children:t.jsx(oi,{ref:ke,meta:z,isMobile:_e,onStepChange:P=>{he(P)}})}),t.jsxs(y,{className:"action-bar",children:[oe.cancel&&t.jsx(ae,{onClick:P=>{P.stopPropagation(),oe.onCancel()},disabled:W===de.length-2&&S,color:"inherit",children:oe.cancel||d("common.cancel")}),oe.confirm&&t.jsx(ae,{onClick:P=>{P.stopPropagation(),oe.onConfirm()},color:"primary","data-cy":"submit-confirm-next",disabled:S||(typeof oe.disabled=="boolean"?oe.disabled:No()),variant:"contained",autoFocus:!0,title:oe.confirm,style:{marginLeft:8,overflow:"hidden",minWidth:"140px",maxWidth:"280px",textAlign:"center"},children:t.jsxs(y,{display:"flex",alignItems:"center",overflow:"hidden",children:[(typeof oe.loading=="boolean"?oe.loading:S)&&t.jsx(ue,{style:{marginRight:8},size:16}),t.jsx(y,{component:"span",flex:1,sx:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:oe.confirm})]})})]})]}):null}mn.propTypes={onClose:i.func,mode:i.oneOf(["normal","embed"]),inDialog:i.bool,stores:i.arrayOf(i.string),storeUrl:i.string,resourceType:i.string,resourceDid:i.string,storageKey:i.string,selectedMeta:i.object,showResourcesSwitch:i.bool,showFromUrl:i.bool,enableRunBackground:i.bool,showCategory:i.bool};mn.defaultProps={onClose:()=>{},mode:"normal",stores:[],storeUrl:"",resourceType:"",resourceDid:"",storageKey:"",inDialog:!0,selectedMeta:null,showResourcesSwitch:!0,showFromUrl:!0,enableRunBackground:!0,showCategory:!0};const li=$(y)`
284
+ `,oi=pn,ri=e=>e.inStore&&B.isFreeBlocklet(e)===!1,si=e=>{var o;return[Y.BLOCKLET_APP_SPACE_REQUIREMENT.REQUIRED,Y.BLOCKLET_APP_SPACE_REQUIREMENT.REQUIRED_ON_SETUP].includes((o=e==null?void 0:e.capabilities)==null?void 0:o.didSpace)},Ot=e=>{var o,n;return((n=(o=e==null?void 0:e.configs)==null?void 0:o.find(a=>a.key===Y.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_SPACE_ENDPOINT))==null?void 0:n.value)||null},ii=e=>(e.environments||[]).some(o=>o.required),ro=(e,o)=>e==null?void 0:e.some(n=>n.required&&!o[n.key]),ai=({params:e,blocklet:o,t:n})=>{const a=e.title||e.name;return a?((o==null?void 0:o.children)||[]).find(s=>s.meta.bundleDid===e.bundleDid)?n("blocklet.component.upgradeNext",{name:a}):n("blocklet.component.addNext",{name:a}):n("common.next")},so=({componentDid:e,timeout:o=1e3,manual:n=!1}={})=>{setTimeout(()=>{window.parent.postMessage({event:"component.installed",componentDid:e,manual:n},"*")},o)};function mn({onClose:e,mode:o,stores:n,resourceType:a,resourceDid:r,storageKey:s,inDialog:h,selectedMeta:c,storeUrl:p,showResourcesSwitch:x,showFromUrl:g,enableRunBackground:l,showCategory:b}){var _n,In,Dn,Un,Je,Nn,et,Ln,Bn,On;const{t:d,locale:T}=G(),[S,R]=f.useState(!1),[k,C]=f.useState(null),[m,u]=f.useState(""),[v,w]=f.useState(""),{api:j,ws:{useSubscription:N},inService:M,info:X}=H(),{blocklet:I,actions:{refreshBlocklet:ne}}=pe(),[me,J]=f.useState(null),[Pe,we]=f.useState(!1),Ee={bundleDid:"",componentDid:"",componentName:"",pathPrefix:"",name:"",title:"",configsList:[],configsValue:{},hasMissRequiredConfigs:!1,hasEnvironmentsStep:!1,hasRequiredEnvironments:!1,requirePurchase:!1,didSpaceIsRequiredSetup:null,installResultProps:{},purchaseResultProps:{},showFromUrlDialog:!1},[_,fe]=f.useState(Ee),[W,he]=f.useState(0),A=f.useRef({}),ke=f.useRef({}),le=f.useRef({}),_e=uo(P=>P.breakpoints.down("md")),E=ir(),[V,ce]=f.useState(!0),{meta:F}=A.current,ee=as(F),be=f.useRef(!1),z=P=>fe(D=>({...D,...P}));f.useEffect(()=>{if(_.pathPrefix){const{errMsg:P}=kn({..._,pathPrefix:_.pathPrefix,locale:T});u(P)}},[_.pathPrefix]),f.useEffect(()=>{W===0&&fe(Ee)},[W]);const Ie=()=>{const P=Ot(I)??"";z({didSpaceEndpoint:P})},Re=()=>{var P;return(P=A==null?void 0:A.current)!=null&&P.meta?B.getDisplayName(A.current):""},Ge=()=>{R(!1),fe({}),be.current=!1,A.current={},e()},Le=P=>{const D=O=>{z({installResultProps:{variant:"error",title:Re(),subTitle:P,footer:t.jsx(ae,{className:"bottom-button",disabled:O,"data-cy":"retry-install-component",onClick:async()=>{D(!0),await Pn(A.current.installInput)},children:t.jsxs(y,{display:"flex",alignItems:"center",children:[O&&t.jsx(ue,{size:16,style:{marginRight:8}}),d("common.retry")]})})}})};D()},Xe=P=>D=>{var O,q;(((O=D==null?void 0:D.meta)==null?void 0:O.did)||(D==null?void 0:D.meta))===((q=I==null?void 0:I.meta)==null?void 0:q.did)&&P(D)},_o=()=>{so({timeout:0,componentDid:E.componentDid,manual:!0}),Ge(),setTimeout(()=>{const P=document.getElementsByClassName("dashboard-main")[0];P&&(P.scrollTop=P.scrollHeight)},200)};N(Y.BlockletEvents.componentInstalled,Xe(()=>{z({installResultProps:{variant:"success",title:Re(),subTitle:d("blocklet.component.installSuccessTip")}}),so({componentDid:E.componentDid})}),[(_n=I==null?void 0:I.meta)==null?void 0:_n.did]),N(Y.BlockletEvents.statusChange,Xe(()=>{const P=Ot(I);z(D=>({...D,didSpaceEndpoint:P}))}),[(In=I==null?void 0:I.meta)==null?void 0:In.did]),N(Y.BlockletEvents.downloadFailed,Xe(()=>{be.current=!1,Le(d("blocklet.component.installComponentError"))}),[(Dn=I==null?void 0:I.meta)==null?void 0:Dn.did]),N(Y.BlockletEvents.installFailed,Xe(()=>{be.current=!1,Le(d("blocklet.component.installComponentError"))}),[(Un=I==null?void 0:I.meta)==null?void 0:Un.did]);const de=[],Tn=P=>((I==null?void 0:I.children)||[]).find(D=>D.meta.did===P),Pn=async P=>{var Oe,$e;be.current=!0;const{pathPrefix:D,bundleDid:O,title:q,componentName:De="",componentDid:Be=""}=_,Ue=((Oe=A.current)==null?void 0:Oe.meta)||{},{configs:Se=[],registryUrl:Te,inStore:ze,inputUrl:Ve,dist:Pt}=Ue,Ye=($e=A.current)==null?void 0:$e.downloadTokenList,re=Ve||(ze?Gn(Te,O,Pt):"");R(!0);const tt={rootDid:I.meta.did,url:re,mountPoint:D?je(D):`/${je(Ue.title||Ue.name)}`,title:q,name:De,did:Be,dist:{tarball:"",integrity:""},onlyRequired:!V,..._.hasEnvironmentsStep&&Se.length>0?{configs:Se.map(xe=>({...xe,value:_.configsValue[xe.key]||""}))}:{},...Ye?{downloadTokenList:Ye}:{},...P};try{if(await j.installComponent({input:tt}),Te){const{teamDid:xe,storeList:Me}=lo({fromBlocklet:M,nodeInfo:X,blocklet:I}),{isNew:kt,decoded:nt}=cr(Te,Me);kt&&await j.addBlockletStore({input:{teamDid:xe,url:nt}})}z({installResultProps:{}}),ne({showError:!1,attachRuntimeInfo:!1})}catch(xe){const Me=ie(xe);L.error(Me),console.error("installComponent error: ",xe),Le(Me)}finally{R(!1),A.current.installInput=tt}},kn=P=>{const D=jo({params:{...P,did:P.bundleDid},blocklets:[I],blocklet:I,locale:T});if(D){const O=Tn(P.bundleDid),q=js({params:{...P,did:P.bundleDid},blocklet:I});if(O&&O.mountPoint===q)return{errMsg:""}}return{errMsg:D}},ge=async P=>{var O,q;const{errMsg:D}=kn({..._,locale:T});u(D),W===de.length-2&&!be.current&&await Pn(P),(q=(O=ke.current)==null?void 0:O.setActiveStepByIndex)==null||q.call(O,De=>De+1)},Fe=()=>{var P,D;(D=(P=ke.current)==null?void 0:P.setActiveStepByIndex)==null||D.call(P,O=>O-1)},Io=()=>{const{pathPrefix:P,bundleDid:D,title:O,componentName:q="",componentDid:De=""}=_,{meta:Be={}}=A.current||{},{registryUrl:Ue,inStore:Se,inputUrl:Te,dist:ze}=Be,Ve=Se?Gn(Ue,D,ze):Te;J({meta:Be,installOpts:{type:"component",rootDid:I.meta.did,mountPoint:P,url:Ve,title:O,name:q,did:De}})},Do=P=>{we(!1),z({purchaseResultProps:{variant:"error",title:Re(),subTitle:P,style:{paddingTop:120},footer:t.jsx(ae,{className:"bottom-button","data-cy":"retry-purchase-component",onClick:()=>{z({purchaseResultProps:{}})},children:d("common.retry")})}})},Uo=({downloadTokenList:P})=>{A.current.downloadTokenList=P,we(!1),ge()},Tt=({chooseParams:P=A.current,componentDid:D,isInit:O=!1})=>{var nt,$n,Mn,An;const{meta:q,registryUrl:De,inStore:Be,inputUrl:Ue}=P,{did:Se,title:Te,name:ze}=q,Ve=(((nt=I.settings)==null?void 0:nt.children)||[]).filter(se=>se.status==="deleted"&&se.meta.bundleDid===Se),Pt=D||"",Ye=($n=q.environments)==null?void 0:$n.map(se=>{const{name:_t,validation:ot,...rt}=se,It={validation:dr(ot)?"":ot};return{...rt,key:_t,...It}});A.current={...P,meta:{...q,configs:Ye,registryUrl:De,inStore:Be,inputUrl:Ue}};let re={};if(O){const se=[I],_t=Ye||[],ot=[],rt=co(lr([..._t,...ot]),"key").filter(Ae=>!!Ae.key).sort((Ae,st)=>Ae.required&&!st.required?-1:st.required&&!Ae.required?1:0),It=B.getSharedConfigObj(se[0],{configs:rt}),Dt={},qn=rt.map(Ae=>{const{default:st,key:it,...Lo}=Ae;return Dt[it]=It[it]||st,{...Lo,key:it,hidden:!!Y.BLOCKLET_CONFIGURABLE_KEY[it]}});re={...re,configsList:qn,configsValue:Dt,hasMissRequiredConfigs:ro(qn,Dt)}}const tt=I.children.some(se=>se.mountPoint==="/"),Oe=Ve.find(se=>se.meta.bundleDid===Se),$e=I.children.find(se=>se.meta.bundleDid===Se);re.title=Te||"",Oe?re={...re,pathPrefix:Oe.mountPoint||"",componentName:Oe.meta.name,hasEnvironmentsStep:!1}:$e?re={...re,pathPrefix:$e.mountPoint||"",componentName:$e.meta.name,hasEnvironmentsStep:!1}:re={...re,pathPrefix:tt?`/${je(Te)||je(ze)}`.toLowerCase():"/",componentName:"",hasEnvironmentsStep:((An=(Mn=A.current.meta)==null?void 0:Mn.environments)==null?void 0:An.length)>0};const xe=ri(A.current.meta),Me=si(A.current.meta),kt=Ot(I);z({bundleDid:Se,componentDid:Pt,...re,hasRequiredEnvironments:ii(A.current.meta),requirePurchase:xe,didSpaceIsRequiredSetup:Me,didSpaceEndpoint:kt}),O&&xe&&Io()};f.useEffect(()=>{!c||W!==0||!I||(Tt({chooseParams:{blocklets:[c],meta:c,registryUrl:p||c.homepage,inStore:!0},isInit:!0}),z({showFromUrlDialog:!1}),ge())},[c,W,I]),de.push({key:"selectComponent",name:d("blocklet.component.selectComponent"),body:t.jsxs(Ne,{sx:{width:400,display:"flex",flexDirection:"column"},component:"div",children:[g&&_.showFromUrlDialog&&t.jsx(gs,{mode:"component",onCancel:()=>{z({showFromUrlDialog:!1})},onSuccess:({meta:P,inputUrl:D,inStore:O,registryUrl:q})=>{Tt({chooseParams:{meta:P,inputUrl:D,inStore:O,registryUrl:q},isInit:!0}),z({showFromUrlDialog:!1}),ge()},handleText:{title:d("blocklet.component.addComponentTip.fromUrl"),confirm:d("blocklet.component.choose")}}),t.jsx(cn,{stores:n,extra:xo.isInServerlessMode(X)?null:g?t.jsxs(ae,{variant:"text",color:"primary","data-cy":"add-component-from-url",onClick:()=>{z({showFromUrlDialog:!0})},style:{padding:"0 2px"},children:[t.jsx(Yt,{style:{fontSize:20,marginRight:4}}),d("blocklet.component.addComponentTip.fromUrl")]}):null,loading:S,onChange:()=>{fe({}),A.current={}},storageKey:s,children:({currentRegistry:P})=>t.jsx(un,{showResourcesSwitch:x,showCategory:b,serverVersion:X==null?void 0:X.version,compact:!0,style:{flex:1,overflow:"hidden",height:"100%"},storeUrl:P.url,resourceType:a,resourceDid:r,handleButtonClick:D=>{Tt({chooseParams:{...D,inStore:!0},isInit:!0})},handleBlockletRender:({blocklet:D,defaultRender:O})=>{const q=(_==null?void 0:_.bundleDid)&&(_==null?void 0:_.bundleDid)===(D==null?void 0:D.did);return t.jsxs(ci,{children:[t.jsx(y,{className:q?"choose-blocklet":"",sx:{"& > div":{position:"relative","&:before, &:after":{content:'""',position:"absolute",width:"0",height:"0",opacity:0,transition:"width 0.3s, height 0.3s, opacity 0.3s",borderRadius:"8px",pointerEvents:"none",...q?{width:"100%",height:"100%",opacity:1}:{}},"&:before":{top:0,left:0,borderTop:"1px solid",borderLeft:"1px solid",borderColor:"primary.main"},"&:after":{bottom:0,right:0,borderBottom:"1px solid",borderRight:"1px solid",borderColor:"primary.main"},"&:hover":{"&:before, &:after":{width:"100%",height:"100%",opacity:1}}}},style:{marginLeft:16},children:O}),q&&t.jsx(y,{className:"check-container",children:t.jsx(ar,{className:"check-icon"})})]})}})})]}),cancel:o==="embed"?void 0:d("common.cancel"),confirm:ai({params:_,blocklet:I,t:d}),onCancel:Ge,onConfirm:()=>{ge()}}),de.push({key:"agreement",name:d("launchBlocklet.introduction"),body:t.jsxs(Ne,{component:"div",className:"agreement-wrapper",children:[t.jsx(Co,{title:d("launchBlocklet.introduction"),subTitle:d("blocklet.component.addComponentTip.introduction")}),t.jsx(ls,{meta:F,onClickNext:ge,installRelated:V,onChangeInstallRelated:ce,handleDescEle:t.jsx("p",{children:d("blocklet.component.addComponentTip.belowInformation")})})]}),cancel:c?void 0:d("common.pre"),disabled:!ee,confirm:d(ee?"launchBlocklet.next":"launchBlocklet.canNotInstall"),onCancel:c?Ge:Fe,onConfirm:()=>{we(!1),ge()}}),F&&_.requirePurchase&&de.push({key:"purchase",name:t.jsxs(t.Fragment,{children:[d("common.verifyNFT"),t.jsx(dt,{})]}),body:t.jsxs(Ne,{component:"div",className:"flex-align-center",style:{flexDirection:"column"},children:[!(((Nn=(Je=le.current)==null?void 0:Je.getCurrentStep)==null?void 0:Nn.call(Je))===2||Pe)&&t.jsx(ct,{title:d("common.verifyNFT"),subTitle:d("blocklet.component.addComponentTip.verifyNFT")}),at(_.purchaseResultProps)?me&&t.jsx(Gs,{ref:le,meta:me.meta,mode:_.componentDid?"verify":"both",onCancel:Do,installOpts:me.installOpts,handlePaySuccess:Uo}):t.jsx("div",{className:"flex-align-center flex-justify-center",children:t.jsx(Hn,{..._.purchaseResultProps})})]}),disabled:((Ln=(et=le.current)==null?void 0:et.getCurrentStep)==null?void 0:Ln.call(et))===2||Pe,cancel:d("common.pre"),confirm:d("common.next"),onConfirm:()=>{typeof le.current.onNext=="function"&&(le.current.onNext(),we(!0))},onCancel:()=>{Fe()}}),B.hasStartEngine(F)&&po.hasMountPoint(F)?de.push({key:"config",name:d("common.config"),error:m,body:t.jsxs(Ne,{component:"div",children:[t.jsx(ct,{title:d("common.config"),subTitle:d("blocklet.component.addComponentTip.config")}),t.jsx(K,{label:d("blocklet.component.mountPoint"),autoComplete:"off",variant:"outlined",name:"pathPrefix",inputProps:{"data-cy":"mount-point-input"},fullWidth:!0,helperText:v||d("blocklet.component.mountPointTip"),style:{marginBottom:32},margin:"normal",value:_.pathPrefix,onChange:P=>{const D=P.target.value;z({pathPrefix:D}),w(d("common.slugifyHint",{value:Ft(D)}))}}),!!m&&t.jsx($t,{severity:"error",style:{width:"100%",marginTop:8},children:m})]}),cancel:d("common.pre"),confirm:d("common.next"),onCancel:Fe,onConfirm:()=>{ge()}}):F&&(_.pathPrefix=((On=(Bn=F.interfaces)==null?void 0:Bn[0])==null?void 0:On.path)||`/${F.did}`),F&&(_!=null&&_.hasEnvironmentsStep)&&de.push({key:"environment",name:t.jsxs(t.Fragment,{children:[d("common.environment")," ",_.hasRequiredEnvironments&&t.jsx(dt,{})]}),disabled:!!k||(_==null?void 0:_.hasMissRequiredConfigs),body:()=>t.jsxs(Ne,{component:"div",style:{overflowY:"auto"},children:[t.jsx(ct,{title:d("common.environment"),subTitle:d("blocklet.component.addComponentTip.environment")}),t.jsx(on,{style:{marginTop:-12,width:"100%"},schema:_.configsList,defaultValue:_.configsValue,onChange:(P,{action:D,currentItem:O,allValues:q})=>{D==="confirm"&&z({hasMissRequiredConfigs:ro(_.configsList,q),configsValue:q}),D==="edit"?C(O):["cancel","confirm"].includes(D)&&C(null)}})]}),cancel:d("common.pre"),confirm:d("common.next"),onCancel:Fe,onConfirm:ge}),F&&(_!=null&&_.didSpaceIsRequiredSetup)&&de.push({key:"didSpace",name:t.jsxs(t.Fragment,{children:[d("blocklet.component.didSpaceConfig")," ",_.didSpaceIsRequiredSetup==="required"&&t.jsx(dt,{})]}),disabled:(_==null?void 0:_.didSpaceIsRequiredSetup)&&!_.didSpaceEndpoint,body:()=>t.jsx(ss,{children:t.jsxs(Ne,{component:"div",children:[t.jsx(ct,{title:d("blocklet.component.didSpaceConfig"),subTitle:d("blocklet.component.didSpaceConfigTip")}),t.jsx(y,{sx:{mt:"36px","& > div":{maxWidth:"unset !important","& .MuiAutocomplete-root":{maxWidth:"unset !important"}}},children:t.jsx(ln,{blockletMeta:A.current.meta,onNext:()=>{ge()},onEndpointUpdate:Ie})})]})}),cancel:d("common.pre"),confirm:d("common.next"),onCancel:Fe,onConfirm:ge}),de.push({key:"install",name:Tn(F==null?void 0:F.did)?d("common.upgrade"):d("common.install"),disabled:l?!1:at(_.installResultProps),loading:l?!1:at(_.installResultProps),body:t.jsx(Ne,{component:"div",className:"flex-justify-center flex-align-center",style:{flexDirection:"column"},children:at(_.installResultProps)?t.jsx(Jr,{message:t.jsx(di,{children:d(l?"blocklet.component.installingCanCloseWindowTip":"blocklet.component.installingTip")}),increaseSpeed:.3,messageLoop:!1}):t.jsx("div",{style:{marginTop:120},children:t.jsx(Hn,{..._.installResultProps})})}),confirm:d("common.complete"),onConfirm:_o});const oe=de[W]||{},No=()=>S||oe.error||!_.bundleDid?!0:W>1?!_.pathPrefix:!1;return I?t.jsxs(li,{sx:h?{height:{xs:"calc(100vh - 72px - 32px)",md:"72vh"},"&& .ll-header":{p:3},"&& .MuiDialogContent-root":{p:0},"&& .layout-content":{p:0,pl:{xs:0,md:2},pb:0,"& .filter-bar":{pt:0,pl:2}}}:{width:"100%",height:"100vh"},children:[t.jsx(es,{steps:de,mode:"memory",children:t.jsx(oi,{ref:ke,meta:F,isMobile:_e,onStepChange:P=>{he(P)}})}),t.jsxs(y,{className:"action-bar",children:[oe.cancel&&t.jsx(ae,{onClick:P=>{P.stopPropagation(),oe.onCancel()},disabled:W===de.length-2&&S,color:"inherit",children:oe.cancel||d("common.cancel")}),oe.confirm&&t.jsx(ae,{onClick:P=>{P.stopPropagation(),oe.onConfirm()},color:"primary","data-cy":"submit-confirm-next",disabled:S||(typeof oe.disabled=="boolean"?oe.disabled:No()),variant:"contained",autoFocus:!0,title:oe.confirm,style:{marginLeft:8,overflow:"hidden",minWidth:"140px",maxWidth:"280px",textAlign:"center"},children:t.jsxs(y,{display:"flex",alignItems:"center",overflow:"hidden",children:[(typeof oe.loading=="boolean"?oe.loading:S)&&t.jsx(ue,{style:{marginRight:8},size:16}),t.jsx(y,{component:"span",flex:1,sx:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:oe.confirm})]})})]})]}):null}mn.propTypes={onClose:i.func,mode:i.oneOf(["normal","embed"]),inDialog:i.bool,stores:i.arrayOf(i.string),storeUrl:i.string,resourceType:i.string,resourceDid:i.string,storageKey:i.string,selectedMeta:i.object,showResourcesSwitch:i.bool,showFromUrl:i.bool,enableRunBackground:i.bool,showCategory:i.bool};mn.defaultProps={onClose:()=>{},mode:"normal",stores:[],storeUrl:"",resourceType:"",resourceDid:"",storageKey:"",inDialog:!0,selectedMeta:null,showResourcesSwitch:!0,showFromUrl:!0,enableRunBackground:!0,showCategory:!0};const li=$(y)`
285
285
  .action-bar {
286
286
  display: flex;
287
287
  justify-content: flex-end;
@@ -358,7 +358,7 @@ import{bW as Bo,j as t,f7 as Oo,hL as $o,l2 as Mo,aP as Wt,aQ as Gt,m as G,bq as
358
358
  .MuiDialogContent-root {
359
359
  background-color: ${({theme:e})=>e.palette.background.paper};
360
360
  }
361
- `;function fn({blocklet:e,children:o}){const{t:n}=G(),[a,r]=f.useState(!1),s=h=>{h.stopPropagation(),r(!0)};return t.jsxs(t.Fragment,{children:[typeof o=="function"?o({open:s}):t.jsxs(ye,{onClick:s,className:"component-action","data-cy":"action-add-component",children:[t.jsx(Yt,{style:{fontSize:18,marginRight:5}}),n("blocklet.component.add")]}),t.jsx(bt,{showDialog:a,setShowDialog:r,blocklet:e})]})}fn.propTypes={children:i.any,blocklet:i.object.isRequired};fn.defaultProps={children:null};const pi=e=>e.children.filter(o=>o.meta.interfaces.find(n=>n.type===Y.BLOCKLET_INTERFACE_TYPE_WEB));function Rt({params:e,setParams:o,setError:n,serviceTypes:a}){const{t:r}=G(),{blocklet:s}=pe(),h=s.meta.did,c=pi(s),[p,x]=f.useState([]),g={301:r("common.redirectPermanently"),302:r("common.redirectTemporary"),307:r("common.redirectTemporary"),308:r("common.redirectPermanently")};return f.useEffect(()=>{if(e.type===U.ROUTING_RULE_TYPES.COMPONENT&&e.componentId){const l=c.find(T=>T.meta.did===e.componentId),b=B.findWebInterface(l.meta),d=(Array.isArray(b==null?void 0:b.pageGroups)?b.pageGroups:[]).map(T=>({value:T,label:`${T} pages`}));d.length&&d.unshift({value:"",label:"All pages"}),x(d),e.pageGroup&&d.find(T=>T.value===e.pageGroup)===!1&&o({...e,pageGroups:""})}},[e.componentId,e.type]),t.jsxs(t.Fragment,{children:[t.jsx(K,{select:!0,label:r("router.domain.add.type"),autoComplete:"off",variant:"outlined",name:"type","data-cy":"domain-add-type",fullWidth:!0,value:e.type,onChange:l=>{n(""),o({...e,type:l.target.value,did:l.target.value===U.ROUTING_RULE_TYPES.BLOCKLET?h:"",__disableConfirm:!1})},style:{marginBottom:32},SelectProps:{},children:a.map(({name:l,value:b})=>t.jsx(ye,{value:b,children:l},b))}),e.type===U.ROUTING_RULE_TYPES.REDIRECT&&[t.jsx(K,{select:!0,label:r("router.domain.add.redirect"),autoComplete:"off",variant:"outlined",name:"type",fullWidth:!0,value:e.redirectCode,onChange:l=>o({...e,redirectCode:l.target.value}),style:{marginBottom:32},SelectProps:{},children:Object.keys(g).map(l=>t.jsx(ye,{value:l,children:`${g[l]} - ${l}`},l))},"redirectCode"),t.jsx(K,{label:r("common.redirectUrl"),autoComplete:"off",variant:"outlined",name:"url",inputProps:{"data-cy":"redirect-url-input"},fullWidth:!0,value:e.url,helperText:r("router.urlHelperText"),style:{marginBottom:32},onChange:l=>{o({...e,url:l.target.value,__disableConfirm:!l.target.value.trim()}),l.target.value.trim()?n(""):n(r("router.validation.redirectUrlRequired"))}},"redirectUrl")],e.type===U.ROUTING_RULE_TYPES.COMPONENT&&[t.jsx(K,{select:!0,label:r("router.domain.add.component"),autoComplete:"off",variant:"outlined","data-cy":"select-component-input",name:"componentId",fullWidth:!0,value:e.componentId,onChange:l=>{o({...e,componentId:l.target.value})},style:{marginBottom:32},SelectProps:{},children:c.map(l=>t.jsx(ye,{value:l.meta.did,selected:l.meta.did===e.componentId,children:B.getDisplayName(l,!0)},l.meta.did))},"componentId"),p.length?t.jsx(K,{select:!0,label:r("router.domain.add.pageGroup"),autoComplete:"off",variant:"outlined",name:"pageGroup","data-cy":"route-group-input",fullWidth:!0,value:e.pageGroup,helperText:r("router.domain.add.pageGroupTip"),style:{marginBottom:32},onChange:l=>{o({...e,pageGroup:l.target.value})},SelectProps:{},children:p.map(l=>t.jsx(ye,{value:l.value,selected:l.value===e.pageGroup,children:l.label},l.label))},"pageGroup"):null].filter(Boolean),e.type===U.ROUTING_RULE_TYPES.GENERAL_REWRITE&&t.jsx(K,{label:r("common.rewriteUrl"),autoComplete:"off",variant:"outlined",name:"url","data-cy":"rewrite-url-input",fullWidth:!0,value:e.url,helperText:r("router.urlHelperText"),style:{marginBottom:32},onChange:l=>{const b=l.target.value.trim();o({...e,url:l.target.value,__disableConfirm:!b}),n(b?"":r("router.validation.rewriteUrlRequired"))}},"url"),e.type===U.ROUTING_RULE_TYPES.DIRECT_RESPONSE&&[t.jsx(K,{select:!0,label:r("router.rule.add.responseType"),autoComplete:"off",variant:"outlined",name:"responseType",fullWidth:!0,value:e.responseType,onChange:l=>o({...e,responseType:l.target.value}),style:{marginBottom:32},SelectProps:{},children:U.ROUTING_RESPONSE_TYPES.map(l=>t.jsx(ye,{value:l.value,children:l.text},l.value))},"responseType"),t.jsx(K,{label:r("router.rule.add.responseBody"),autoComplete:"off",variant:"outlined",name:"responseBody","data-cy":"response-body-input",fullWidth:!0,multiline:!0,minRows:3,value:e.responseBody,helperText:r("router.rule.add.responseBodyTip"),style:{marginBottom:32},onChange:l=>{const b=l.target.value.trim();o({...e,responseBody:l.target.value,__disableConfirm:!b}),n(b?"":r("router.rule.add.responseBodyRequired"))}},"response-body")]]})}Rt.propTypes={params:i.object,serviceTypes:i.array,setParams:i.func,setError:i.func};Rt.defaultProps={params:{},serviceTypes:[{name:"Redirect",value:U.ROUTING_RULE_TYPES.REDIRECT},{name:"Default - User will see the 404 page",value:U.ROUTING_RULE_TYPES.NONE},{name:"Rewrite - Route traffic without redirect",value:U.ROUTING_RULE_TYPES.GENERAL_REWRITE},{name:"Response - Response with provided content",value:U.ROUTING_RULE_TYPES.DIRECT_RESPONSE},{name:"Component - Pass traffic to blocklet component",value:U.ROUTING_RULE_TYPES.COMPONENT}],setParams:()=>{},setError:()=>{}};function hn({children:e,hiddenChildren:o,open:n,onClose:a}){const{t:r}=G(),{api:s}=H(),{blocklet:h}=pe(),[c,p]=f.useState(!1),[x,g]=f.useState(!1),l=h.meta.did,b=h.site.id,d=()=>{a==null||a(),p(!1),g(!1)},T=async C=>{try{const m=await ut(C,r);if(m)throw m;p(!0);const u={from:{pathPrefix:je(C.pathPrefix)},to:{type:C.type}};C.type===U.ROUTING_RULE_TYPES.REDIRECT&&(u.to.url=C.url.trim(),u.to.redirectCode=C.redirectCode),C.type===U.ROUTING_RULE_TYPES.COMPONENT&&(u.to.did=l,u.to.componentId=C.componentId,u.to.pageGroup=C.pageGroup),C.type===U.ROUTING_RULE_TYPES.GENERAL_REWRITE&&(u.to.url=je(C.url)),C.type===U.ROUTING_RULE_TYPES.DIRECT_RESPONSE&&(u.to.response={status:200,contentType:C.responseType,body:C.responseBody}),await s.addRoutingRule({input:{id:b,rule:u,teamDid:l}}),a==null||a()}catch(m){L.error(m.message)}finally{p(!1),g(!1)}},S={title:r("router.rule.add.title"),description:(C,m,u)=>{const v=w=>{if(u(null),ut(w,r)){m({...w,__disableConfirm:!0});return}m({...w})};return t.jsxs(te,{component:"div",children:[t.jsx(K,{label:r("router.rule.add.pathPrefix"),autoComplete:"off",variant:"outlined",name:"pathPrefix",inputProps:{"data-cy":"path-prefix-input"},fullWidth:!0,autoFocus:!0,helperText:C.pathPrefixHint||r("router.rule.add.pathPrefixTip"),style:{marginBottom:32},margin:"dense",value:C.pathPrefix,onChange:w=>{let j=!1;const N=jo({params:{...C,pathPrefix:w.target.value},blocklets:[h]});u(N),C.type===U.ROUTING_RULE_TYPES.BLOCKLET&&N&&(j=!0),C.type===U.ROUTING_RULE_TYPES.REDIRECT&&!C.url&&(j=!0),C.type===U.ROUTING_RULE_TYPES.GENERAL_REWRITE&&!C.url&&(j=!0),C.type===U.ROUTING_RULE_TYPES.DIRECT_RESPONSE&&(!C.responseType||!C.responseBody)&&(j=!0),w.target.value.trim()||(j=!0,u(r("router.validation.pathPrefixRequired"))),j||u("");const M=r("common.slugifyHint",{value:zt(w.target.value)});m({...C,pathPrefix:w.target.value,pathPrefixHint:M,__disableConfirm:j})}}),t.jsx(Rt,{params:C,setParams:v,setError:u})]})},confirm:r("router.rule.add.confirm"),cancel:r("common.cancel"),params:{did:"",pathPrefix:"",type:U.ROUTING_RULE_TYPES.REDIRECT,componentId:"",pageGroup:"",redirectCode:302,responseType:"text/plain",responseBody:"",__disableConfirm:!0},onConfirm:T,onCancel:d},R=C=>{C.stopPropagation(),g(!0)};let k=null;return o||(k=typeof e=="function"?e({open:R}):t.jsxs(ye,{onClick:R,className:"rule-action","data-cy":"action-add-rule",children:[c?t.jsx(ue,{size:16}):t.jsx(Yt,{style:{fontSize:18,marginRight:5}}),r("router.rule.add.title")]})),t.jsxs(t.Fragment,{children:[k,(n||x)&&t.jsx(We,{title:S.title,description:S.description,confirm:S.confirm,cancel:S.cancel,params:S.params,onConfirm:S.onConfirm,onCancel:S.onCancel,color:"primary"})]})}hn.propTypes={children:i.any,onClose:i.func,hiddenChildren:i.bool,open:i.bool};hn.defaultProps={children:null,open:!1,onClose:null,hiddenChildren:!1};function Ze({depth:e,className:o}){return t.jsx(y,{ml:Math.max((e-1)*2,0),className:o,sx:{borderBottom:1,borderColor:"rgba(0,0,0,0.12)"}},"group-collapse-box")}Ze.propTypes={depth:i.number,className:i.string};Ze.defaultProps={depth:1,className:""};function gn({id:e,from:o,children:n}){const{t:a}=G(),{api:r}=H(),{blocklet:s}=pe(),[h,c]=f.useState(!1),[p,x]=f.useState(null),g=s.meta.did,l=s.site.id,b=o.pathPrefix,d=()=>{c(!1),x(null)},T=async()=>{c(!0);try{await r.deleteRoutingRule({input:{id:l,ruleId:e,teamDid:g}})}catch(k){L.error(k.message)}finally{x(null),c(!1)}},S={keyName:b,title:a("router.rule.delete.title"),description:a("router.rule.delete.description",{name:`<b>${b}</b>`}),confirmPlaceholder:a("router.rule.delete.confirm_desc",{name:b}),confirm:a("common.delConfirm"),cancel:a("router.rule.delete.cancel"),onConfirm:T,onCancel:d},R=k=>{k.stopPropagation(),x(S)};return t.jsxs(t.Fragment,{children:[typeof n=="function"?n({loading:h,open:R}):t.jsxs(ye,{onClick:R,className:"rule-action","data-cy":"action-delete-rule",children:[h?t.jsx(ue,{size:16}):t.jsx(Ct,{style:{fontSize:18,marginRight:5}}),a("router.rule.delete.title")]}),p&&t.jsx(Rs,{keyName:p.keyName,title:p.title,description:p.description,confirmPlaceholder:p.confirmPlaceholder,confirm:p.confirm,cancel:p.cancel,params:p.params,onConfirm:p.onConfirm,onCancel:p.onCancel})]})}gn.propTypes={id:i.string.isRequired,from:i.object.isRequired,children:i.any};gn.defaultProps={children:null};function xn({id:e,from:o,to:n,children:a}){var C,m;const{t:r}=G(),{api:s}=H(),{blocklet:h}=pe(),[c,p]=f.useState(!1),[x,g]=f.useState(null),l=h.meta.did,b=h.site.id,d=o.pathPrefix,T=()=>{p(!1),g(null)},S=async u=>{try{const v=await ut(u,r);if(v)throw v;p(!0);const w={id:e,from:{pathPrefix:je(u.pathPrefix)},to:{type:u.type}};u.type===U.ROUTING_RULE_TYPES.REDIRECT&&(w.to.url=u.url,w.to.redirectCode=u.redirectCode),u.type===U.ROUTING_RULE_TYPES.COMPONENT&&(w.to.did=l,w.to.componentId=u.componentId,w.to.pageGroup=u.pageGroup),u.type===U.ROUTING_RULE_TYPES.GENERAL_REWRITE&&(w.to.url=je(u.url)),u.type===U.ROUTING_RULE_TYPES.DIRECT_RESPONSE&&(w.to.response={status:200,contentType:u.responseType,body:u.responseBody}),await s.updateRoutingRule({input:{id:b,rule:w,teamDid:l}})}catch(v){L.error(v.message)}finally{p(!1),g(null)}},R={title:r("router.rule.update.title"),description:(u,v,w)=>{const j=N=>{if(ut(N,r)){v({...N,__disableConfirm:!0});return}v({...N})};return t.jsxs(te,{component:"div",children:[t.jsx(K,{label:r("router.rule.add.pathPrefix"),autoComplete:"off",variant:"outlined",name:"pathPrefix",inputProps:{"data-cy":"path-prefix-input"},fullWidth:!0,autoFocus:!0,helperText:u.helperText||r("router.rule.add.pathPrefixTip"),style:{marginBottom:32},margin:"dense",value:u.pathPrefix,onChange:N=>{let M=!1;u.type===U.ROUTING_RULE_TYPES.REDIRECT&&!u.url&&(M=!0),u.type===U.ROUTING_RULE_TYPES.GENERAL_REWRITE&&!u.url&&(M=!0),u.type===U.ROUTING_RULE_TYPES.DIRECT_RESPONSE&&(!u.responseType||!u.responseBody)&&(M=!0),N.target.value.trim()||(M=!0,w(r("router.validation.pathPrefixRequired"))),M||w("");const X=r("common.slugifyHint",{value:zt(N.target.value)});v({...u,pathPrefix:N.target.value,helperText:X,__disableConfirm:M})}}),t.jsx(Rt,{params:u,setParams:j,setError:w})]})},confirm:r("router.rule.update.confirm"),cancel:r("router.rule.update.cancel"),color:"primary",params:{did:n.did||"",pathPrefix:d==="/"?d:d.replace(/^\/+/,"").replace(/\/+$/,""),type:n.type||U.ROUTING_RULE_TYPES.BLOCKLET,redirectCode:n.redirectCode||302,componentId:n.componentId||"",pageGroup:n.pageGroup||"",url:n.url||"",responseType:((C=n.response)==null?void 0:C.contentType)||"",responseBody:(((m=n.response)==null?void 0:m.body)||"").replace(/\\"/g,'"'),__disableConfirm:!1},onConfirm:S,onCancel:T},k=u=>{u.stopPropagation(),g(R)};return t.jsxs(t.Fragment,{children:[typeof a=="function"?a({loading:c,open:k}):t.jsxs(ye,{onClick:k,className:"rule-action","data-cy":"action-update-rule",children:[c?t.jsx(ue,{size:16}):t.jsx(go,{style:{fontSize:18,marginRight:5}}),r("router.rule.update.title")]}),x&&t.jsx(We,{title:x.title,description:x.description,confirm:x.confirm,color:x.color,cancel:x.cancel,params:x.params,onConfirm:x.onConfirm,onCancel:x.onCancel})]})}xn.propTypes={id:i.string.isRequired,from:i.object.isRequired,to:i.object.isRequired,children:i.any};xn.defaultProps={children:null};function yn(e){const{locale:o}=G(),{blocklet:n,recommendedDomain:a}=pe(),r=mo(a,e.from.pathPrefix,Ft(n,o));return t.jsxs(y,{display:"flex",alignItems:"center",children:[t.jsx(y,{component:"a",sx:{display:{xs:"flex",md:"none"}},target:"_blank",href:r,rel:"noopener noreferrer",title:r,children:t.jsx(Z,{size:"small",children:t.jsx(bo,{})})}),t.jsx(xn,{...e,children:({open:s})=>t.jsx(Z,{size:"small",onClick:s,disabled:e.isProtected,"data-cy":"action-update-rule",children:t.jsx(Mr,{})})}),t.jsx(gn,{...e,children:({open:s})=>t.jsx(Z,{size:"small",onClick:s,disabled:e.isProtected,"data-cy":"action-delete-rule",children:t.jsx(Ct,{})})})]})}yn.propTypes={isProtected:i.bool};yn.defaultProps={isProtected:!1};function Eo({group:e,...o}){return e?t.jsx(Qe,{type:"reverse",...o,children:e}):null}Eo.propTypes={group:i.string.isRequired};function pt({domain:e,isHttps:o,toUrl:n}){const a=o?"https":"http";let r=n;return mr(r)||(r=`${a}://${e}${n}`),t.jsx(xt,{href:r,target:"_blank",style:{fontSize:14},underline:"hover",children:n},r)}pt.propTypes={domain:i.string.isRequired,toUrl:i.string.isRequired,isHttps:i.bool};pt.defaultProps={isHttps:!1};function St({hasPermission:e}){const{t:o,locale:n}=G(),a=ft(),{blocklet:r,recommendedDomain:s}=pe();return r.site.rules.filter(c=>c.to.type!==U.ROUTING_RULE_TYPES.BLOCKLET).map(c=>{var l;let p=null,x=null;c.to.type===U.ROUTING_RULE_TYPES.NONE?p="404":c.to.type===U.ROUTING_RULE_TYPES.REDIRECT?p=c.to.redirectCode:c.to.type===U.ROUTING_RULE_TYPES.GENERAL_REWRITE?p="R":c.to.type===U.ROUTING_RULE_TYPES.DIRECT_RESPONSE?p=t.jsx(Ps,{sx:{color:"text.secondary",fontSize:"45px"}}):c.to.type===U.ROUTING_RULE_TYPES.COMPONENT&&(x=r.children.find(b=>b.meta.did===c.to.componentId),p="C");const g=c.isProtected?t.jsx(Ce,{title:o("blocklet.router.urlLockTooltip"),placement:"top",children:t.jsx("span",{children:t.jsx(Z,{disabled:!0,size:"small",style:{pointerEvents:"auto",paddingTop:0,paddingBottom:0,margin:"12px 0"},children:t.jsx(hs,{style:{fill:a.palette.text.disabled}})})})}):t.jsx(yn,{...c});return[t.jsxs(y,{display:"flex",py:2,className:"component-item",justifyContent:"space-between",alignItems:"center",children:[t.jsxs(y,{width:{xs:300,md:400},display:"flex",alignItems:"center",children:[t.jsx(y,{className:"component-item__indent",width:28}),typeof p=="object"?p:t.jsx(ur,{children:p}),t.jsxs(y,{sx:{ml:2,flex:1,wordBreak:"break-word"},children:[t.jsxs(y,{style:{color:"text.primary",fontSize:16},children:[c.to.type===U.ROUTING_RULE_TYPES.NONE&&o("common.page404"),c.to.type===U.ROUTING_RULE_TYPES.REDIRECT&&o("common.redirect"),c.to.type===U.ROUTING_RULE_TYPES.GENERAL_REWRITE&&o("common.rewrite"),c.to.type===U.ROUTING_RULE_TYPES.DIRECT_RESPONSE&&((l=U.ROUTING_RESPONSE_TYPES.find(b=>b.value===c.to.response.contentType))==null?void 0:l.text),c.to.type===U.ROUTING_RULE_TYPES.COMPONENT&&B.getDisplayName(x,!0)]}),t.jsxs(y,{display:"flex",alignItems:"center",children:[c.to.type===U.ROUTING_RULE_TYPES.REDIRECT&&t.jsx(pt,{domain:s,toUrl:c.to.url}),c.to.type===U.ROUTING_RULE_TYPES.GENERAL_REWRITE&&t.jsx(pt,{domain:s,toUrl:c.to.url}),c.to.type===U.ROUTING_RULE_TYPES.COMPONENT&&t.jsx(Eo,{group:c.to.pageGroup})]})]})]}),t.jsx(y,{px:2,sx:{display:{xs:"none",md:"flex"}},alignItems:"center",flexGrow:"1",children:t.jsx(xt,{href:mo(s,c.from.pathPrefix,Ft(r,n)),target:"_blank",style:{fontSize:16,color:"inherit"},underline:"hover",children:pr(c.from.pathPrefix,"/")||"/"})},c.from.pathPrefix),t.jsx(y,{children:e&&t.jsx("div",{style:{textAlign:"right"},children:g})},"actions")]},"rule"),t.jsx(Ze,{},"divider")]})}St.propTypes={hasPermission:i.bool};St.defaultProps={hasPermission:!1};const mi=yt(St,"mutate_blocklets"),fi=yt(St,"",He);function hi(e){const{inService:o}=H();return o?t.jsx(fi,{...e}):t.jsx(mi,{...e})}function gi(e,o){const n=f.useRef(o);f.useEffect(()=>{const a=r=>n.current(r.detail);return window.addEventListener(e,a),()=>window.removeEventListener(e,a)},[e])}function xi(e){const o=fo(),{t:n}=G(),a=()=>{const r=new URLSearchParams(window.location.search);r.get("checkUpdate")&&(r.delete("checkUpdate"),o(r.toString()),e(),L.success(n("notification.checkingForUpdates")))};f.useEffect(a,[]),gi("checkUpdate",a)}function yi({blocklet:e,scrollToComponent:o}={blocklet:null,scrollToComponent:!1}){const n=fo(),{t:a}=G(),r=f.useRef(null),s=f.useMemo(()=>{if(!e||!e.optionalComponents)return null;const h=new URLSearchParams(window.location.search),c=h.get("install-component");if(c){r.current=c,h.delete("install-component"),n(h.toString());const p=e.optionalComponents.find(g=>g.meta.did===c);if(!p)return L.success(a("notification.installComponentError",{did:c})),null;const{meta:x}=p;if(o){const g=document.getElementById(`optional-component-${c}`),l=document.querySelector(".dashboard-main");if(g){const b=g.getBoundingClientRect(),d=l.getBoundingClientRect();l.scrollTo({top:b.top-d.top+l.scrollTop,behavior:"smooth"})}}return x}return null},[e,n,a,o]);return f.useEffect(()=>{var h;r.current&&window.opener&&window.opener.postMessage({blocklet:e,kind:"component-installer"},(h=window.blocklet)==null?void 0:h.appUrl)},[e]),s}function wt({open:e,onClose:o,blocklet:n,ancestors:a}){var x;const{t:r}=G(),s=[...(a||[]).map(g=>{var l;return((l=g==null?void 0:g.meta)==null?void 0:l.did)||""}),((x=n==null?void 0:n.meta)==null?void 0:x.did)||""].filter(Boolean).join("/"),h=r("preferencesFor",{name:B.getDisplayName(n,!0)}),c=f.useMemo(()=>({position:"relative",minHeight:"50vh",height:"100%",overflow:"hidden",border:0}),[]);if(qe(n.status)||n.status==="unknown"&&qe(n.status))return null;const p=()=>{o==null||o()};return t.jsx(Ci,{open:e,fullWidth:!0,maxWidth:"md",title:h,onClose:p,PaperProps:{style:{minHeight:"500px"}},children:t.jsxs(ao,{gap:1,children:[t.jsx(te,{sx:{fontSize:12,color:"text.secondary",mb:.5},children:r("description.preferences",{name:B.getDisplayName(n,!0)})}),t.jsx(Ar,{id:s,styles:c})]})})}wt.propTypes={blocklet:i.object.isRequired,ancestors:i.array,open:i.bool,onClose:i.func};wt.defaultProps={ancestors:[],open:!1,onClose:null};const Ci=$(ht)`
361
+ `;function fn({blocklet:e,children:o}){const{t:n}=G(),[a,r]=f.useState(!1),s=h=>{h.stopPropagation(),r(!0)};return t.jsxs(t.Fragment,{children:[typeof o=="function"?o({open:s}):t.jsxs(ye,{onClick:s,className:"component-action","data-cy":"action-add-component",children:[t.jsx(Yt,{style:{fontSize:18,marginRight:5}}),n("blocklet.component.add")]}),t.jsx(bt,{showDialog:a,setShowDialog:r,blocklet:e})]})}fn.propTypes={children:i.any,blocklet:i.object.isRequired};fn.defaultProps={children:null};const pi=e=>e.children.filter(o=>o.meta.interfaces.find(n=>n.type===Y.BLOCKLET_INTERFACE_TYPE_WEB));function Rt({params:e,setParams:o,setError:n,serviceTypes:a}){const{t:r}=G(),{blocklet:s}=pe(),h=s.meta.did,c=pi(s),[p,x]=f.useState([]),g={301:r("common.redirectPermanently"),302:r("common.redirectTemporary"),307:r("common.redirectTemporary"),308:r("common.redirectPermanently")};return f.useEffect(()=>{if(e.type===U.ROUTING_RULE_TYPES.COMPONENT&&e.componentId){const l=c.find(T=>T.meta.did===e.componentId),b=B.findWebInterface(l.meta),d=(Array.isArray(b==null?void 0:b.pageGroups)?b.pageGroups:[]).map(T=>({value:T,label:`${T} pages`}));d.length&&d.unshift({value:"",label:"All pages"}),x(d),e.pageGroup&&d.find(T=>T.value===e.pageGroup)===!1&&o({...e,pageGroups:""})}},[e.componentId,e.type]),t.jsxs(t.Fragment,{children:[t.jsx(K,{select:!0,label:r("router.domain.add.type"),autoComplete:"off",variant:"outlined",name:"type","data-cy":"domain-add-type",fullWidth:!0,value:e.type,onChange:l=>{n(""),o({...e,type:l.target.value,did:l.target.value===U.ROUTING_RULE_TYPES.BLOCKLET?h:"",__disableConfirm:!1})},style:{marginBottom:32},SelectProps:{},children:a.map(({name:l,value:b})=>t.jsx(ye,{value:b,children:l},b))}),e.type===U.ROUTING_RULE_TYPES.REDIRECT&&[t.jsx(K,{select:!0,label:r("router.domain.add.redirect"),autoComplete:"off",variant:"outlined",name:"type",fullWidth:!0,value:e.redirectCode,onChange:l=>o({...e,redirectCode:l.target.value}),style:{marginBottom:32},SelectProps:{},children:Object.keys(g).map(l=>t.jsx(ye,{value:l,children:`${g[l]} - ${l}`},l))},"redirectCode"),t.jsx(K,{label:r("common.redirectUrl"),autoComplete:"off",variant:"outlined",name:"url",inputProps:{"data-cy":"redirect-url-input"},fullWidth:!0,value:e.url,helperText:r("router.urlHelperText"),style:{marginBottom:32},onChange:l=>{o({...e,url:l.target.value,__disableConfirm:!l.target.value.trim()}),l.target.value.trim()?n(""):n(r("router.validation.redirectUrlRequired"))}},"redirectUrl")],e.type===U.ROUTING_RULE_TYPES.COMPONENT&&[t.jsx(K,{select:!0,label:r("router.domain.add.component"),autoComplete:"off",variant:"outlined","data-cy":"select-component-input",name:"componentId",fullWidth:!0,value:e.componentId,onChange:l=>{o({...e,componentId:l.target.value})},style:{marginBottom:32},SelectProps:{},children:c.map(l=>t.jsx(ye,{value:l.meta.did,selected:l.meta.did===e.componentId,children:B.getDisplayName(l,!0)},l.meta.did))},"componentId"),p.length?t.jsx(K,{select:!0,label:r("router.domain.add.pageGroup"),autoComplete:"off",variant:"outlined",name:"pageGroup","data-cy":"route-group-input",fullWidth:!0,value:e.pageGroup,helperText:r("router.domain.add.pageGroupTip"),style:{marginBottom:32},onChange:l=>{o({...e,pageGroup:l.target.value})},SelectProps:{},children:p.map(l=>t.jsx(ye,{value:l.value,selected:l.value===e.pageGroup,children:l.label},l.label))},"pageGroup"):null].filter(Boolean),e.type===U.ROUTING_RULE_TYPES.GENERAL_REWRITE&&t.jsx(K,{label:r("common.rewriteUrl"),autoComplete:"off",variant:"outlined",name:"url","data-cy":"rewrite-url-input",fullWidth:!0,value:e.url,helperText:r("router.urlHelperText"),style:{marginBottom:32},onChange:l=>{const b=l.target.value.trim();o({...e,url:l.target.value,__disableConfirm:!b}),n(b?"":r("router.validation.rewriteUrlRequired"))}},"url"),e.type===U.ROUTING_RULE_TYPES.DIRECT_RESPONSE&&[t.jsx(K,{select:!0,label:r("router.rule.add.responseType"),autoComplete:"off",variant:"outlined",name:"responseType",fullWidth:!0,value:e.responseType,onChange:l=>o({...e,responseType:l.target.value}),style:{marginBottom:32},SelectProps:{},children:U.ROUTING_RESPONSE_TYPES.map(l=>t.jsx(ye,{value:l.value,children:l.text},l.value))},"responseType"),t.jsx(K,{label:r("router.rule.add.responseBody"),autoComplete:"off",variant:"outlined",name:"responseBody","data-cy":"response-body-input",fullWidth:!0,multiline:!0,minRows:3,value:e.responseBody,helperText:r("router.rule.add.responseBodyTip"),style:{marginBottom:32},onChange:l=>{const b=l.target.value.trim();o({...e,responseBody:l.target.value,__disableConfirm:!b}),n(b?"":r("router.rule.add.responseBodyRequired"))}},"response-body")]]})}Rt.propTypes={params:i.object,serviceTypes:i.array,setParams:i.func,setError:i.func};Rt.defaultProps={params:{},serviceTypes:[{name:"Redirect",value:U.ROUTING_RULE_TYPES.REDIRECT},{name:"Default - User will see the 404 page",value:U.ROUTING_RULE_TYPES.NONE},{name:"Rewrite - Route traffic without redirect",value:U.ROUTING_RULE_TYPES.GENERAL_REWRITE},{name:"Response - Response with provided content",value:U.ROUTING_RULE_TYPES.DIRECT_RESPONSE},{name:"Component - Pass traffic to blocklet component",value:U.ROUTING_RULE_TYPES.COMPONENT}],setParams:()=>{},setError:()=>{}};function hn({children:e,hiddenChildren:o,open:n,onClose:a}){const{t:r}=G(),{api:s}=H(),{blocklet:h}=pe(),[c,p]=f.useState(!1),[x,g]=f.useState(!1),l=h.meta.did,b=h.site.id,d=()=>{a==null||a(),p(!1),g(!1)},T=async C=>{try{const m=await ut(C,r);if(m)throw m;p(!0);const u={from:{pathPrefix:je(C.pathPrefix)},to:{type:C.type}};C.type===U.ROUTING_RULE_TYPES.REDIRECT&&(u.to.url=C.url.trim(),u.to.redirectCode=C.redirectCode),C.type===U.ROUTING_RULE_TYPES.COMPONENT&&(u.to.did=l,u.to.componentId=C.componentId,u.to.pageGroup=C.pageGroup),C.type===U.ROUTING_RULE_TYPES.GENERAL_REWRITE&&(u.to.url=je(C.url)),C.type===U.ROUTING_RULE_TYPES.DIRECT_RESPONSE&&(u.to.response={status:200,contentType:C.responseType,body:C.responseBody}),await s.addRoutingRule({input:{id:b,rule:u,teamDid:l}}),a==null||a()}catch(m){L.error(m.message)}finally{p(!1),g(!1)}},S={title:r("router.rule.add.title"),description:(C,m,u)=>{const v=w=>{if(u(null),ut(w,r)){m({...w,__disableConfirm:!0});return}m({...w})};return t.jsxs(te,{component:"div",children:[t.jsx(K,{label:r("router.rule.add.pathPrefix"),autoComplete:"off",variant:"outlined",name:"pathPrefix",inputProps:{"data-cy":"path-prefix-input"},fullWidth:!0,autoFocus:!0,helperText:C.pathPrefixHint||r("router.rule.add.pathPrefixTip"),style:{marginBottom:32},margin:"dense",value:C.pathPrefix,onChange:w=>{let j=!1;const N=jo({params:{...C,pathPrefix:w.target.value},blocklets:[h]});u(N),C.type===U.ROUTING_RULE_TYPES.BLOCKLET&&N&&(j=!0),C.type===U.ROUTING_RULE_TYPES.REDIRECT&&!C.url&&(j=!0),C.type===U.ROUTING_RULE_TYPES.GENERAL_REWRITE&&!C.url&&(j=!0),C.type===U.ROUTING_RULE_TYPES.DIRECT_RESPONSE&&(!C.responseType||!C.responseBody)&&(j=!0),w.target.value.trim()||(j=!0,u(r("router.validation.pathPrefixRequired"))),j||u("");const M=r("common.slugifyHint",{value:Ft(w.target.value)});m({...C,pathPrefix:w.target.value,pathPrefixHint:M,__disableConfirm:j})}}),t.jsx(Rt,{params:C,setParams:v,setError:u})]})},confirm:r("router.rule.add.confirm"),cancel:r("common.cancel"),params:{did:"",pathPrefix:"",type:U.ROUTING_RULE_TYPES.REDIRECT,componentId:"",pageGroup:"",redirectCode:302,responseType:"text/plain",responseBody:"",__disableConfirm:!0},onConfirm:T,onCancel:d},R=C=>{C.stopPropagation(),g(!0)};let k=null;return o||(k=typeof e=="function"?e({open:R}):t.jsxs(ye,{onClick:R,className:"rule-action","data-cy":"action-add-rule",children:[c?t.jsx(ue,{size:16}):t.jsx(Yt,{style:{fontSize:18,marginRight:5}}),r("router.rule.add.title")]})),t.jsxs(t.Fragment,{children:[k,(n||x)&&t.jsx(We,{title:S.title,description:S.description,confirm:S.confirm,cancel:S.cancel,params:S.params,onConfirm:S.onConfirm,onCancel:S.onCancel,color:"primary"})]})}hn.propTypes={children:i.any,onClose:i.func,hiddenChildren:i.bool,open:i.bool};hn.defaultProps={children:null,open:!1,onClose:null,hiddenChildren:!1};function Ze({depth:e,className:o}){return t.jsx(y,{ml:Math.max((e-1)*2,0),className:o,sx:{borderBottom:1,borderColor:"rgba(0,0,0,0.12)"}},"group-collapse-box")}Ze.propTypes={depth:i.number,className:i.string};Ze.defaultProps={depth:1,className:""};function gn({id:e,from:o,children:n}){const{t:a}=G(),{api:r}=H(),{blocklet:s}=pe(),[h,c]=f.useState(!1),[p,x]=f.useState(null),g=s.meta.did,l=s.site.id,b=o.pathPrefix,d=()=>{c(!1),x(null)},T=async()=>{c(!0);try{await r.deleteRoutingRule({input:{id:l,ruleId:e,teamDid:g}})}catch(k){L.error(k.message)}finally{x(null),c(!1)}},S={keyName:b,title:a("router.rule.delete.title"),description:a("router.rule.delete.description",{name:`<b>${b}</b>`}),confirmPlaceholder:a("router.rule.delete.confirm_desc",{name:b}),confirm:a("common.delConfirm"),cancel:a("router.rule.delete.cancel"),onConfirm:T,onCancel:d},R=k=>{k.stopPropagation(),x(S)};return t.jsxs(t.Fragment,{children:[typeof n=="function"?n({loading:h,open:R}):t.jsxs(ye,{onClick:R,className:"rule-action","data-cy":"action-delete-rule",children:[h?t.jsx(ue,{size:16}):t.jsx(Ct,{style:{fontSize:18,marginRight:5}}),a("router.rule.delete.title")]}),p&&t.jsx(Rs,{keyName:p.keyName,title:p.title,description:p.description,confirmPlaceholder:p.confirmPlaceholder,confirm:p.confirm,cancel:p.cancel,params:p.params,onConfirm:p.onConfirm,onCancel:p.onCancel})]})}gn.propTypes={id:i.string.isRequired,from:i.object.isRequired,children:i.any};gn.defaultProps={children:null};function xn({id:e,from:o,to:n,children:a}){var C,m;const{t:r}=G(),{api:s}=H(),{blocklet:h}=pe(),[c,p]=f.useState(!1),[x,g]=f.useState(null),l=h.meta.did,b=h.site.id,d=o.pathPrefix,T=()=>{p(!1),g(null)},S=async u=>{try{const v=await ut(u,r);if(v)throw v;p(!0);const w={id:e,from:{pathPrefix:je(u.pathPrefix)},to:{type:u.type}};u.type===U.ROUTING_RULE_TYPES.REDIRECT&&(w.to.url=u.url,w.to.redirectCode=u.redirectCode),u.type===U.ROUTING_RULE_TYPES.COMPONENT&&(w.to.did=l,w.to.componentId=u.componentId,w.to.pageGroup=u.pageGroup),u.type===U.ROUTING_RULE_TYPES.GENERAL_REWRITE&&(w.to.url=je(u.url)),u.type===U.ROUTING_RULE_TYPES.DIRECT_RESPONSE&&(w.to.response={status:200,contentType:u.responseType,body:u.responseBody}),await s.updateRoutingRule({input:{id:b,rule:w,teamDid:l}})}catch(v){L.error(v.message)}finally{p(!1),g(null)}},R={title:r("router.rule.update.title"),description:(u,v,w)=>{const j=N=>{if(ut(N,r)){v({...N,__disableConfirm:!0});return}v({...N})};return t.jsxs(te,{component:"div",children:[t.jsx(K,{label:r("router.rule.add.pathPrefix"),autoComplete:"off",variant:"outlined",name:"pathPrefix",inputProps:{"data-cy":"path-prefix-input"},fullWidth:!0,autoFocus:!0,helperText:u.helperText||r("router.rule.add.pathPrefixTip"),style:{marginBottom:32},margin:"dense",value:u.pathPrefix,onChange:N=>{let M=!1;u.type===U.ROUTING_RULE_TYPES.REDIRECT&&!u.url&&(M=!0),u.type===U.ROUTING_RULE_TYPES.GENERAL_REWRITE&&!u.url&&(M=!0),u.type===U.ROUTING_RULE_TYPES.DIRECT_RESPONSE&&(!u.responseType||!u.responseBody)&&(M=!0),N.target.value.trim()||(M=!0,w(r("router.validation.pathPrefixRequired"))),M||w("");const X=r("common.slugifyHint",{value:Ft(N.target.value)});v({...u,pathPrefix:N.target.value,helperText:X,__disableConfirm:M})}}),t.jsx(Rt,{params:u,setParams:j,setError:w})]})},confirm:r("router.rule.update.confirm"),cancel:r("router.rule.update.cancel"),color:"primary",params:{did:n.did||"",pathPrefix:d==="/"?d:d.replace(/^\/+/,"").replace(/\/+$/,""),type:n.type||U.ROUTING_RULE_TYPES.BLOCKLET,redirectCode:n.redirectCode||302,componentId:n.componentId||"",pageGroup:n.pageGroup||"",url:n.url||"",responseType:((C=n.response)==null?void 0:C.contentType)||"",responseBody:(((m=n.response)==null?void 0:m.body)||"").replace(/\\"/g,'"'),__disableConfirm:!1},onConfirm:S,onCancel:T},k=u=>{u.stopPropagation(),g(R)};return t.jsxs(t.Fragment,{children:[typeof a=="function"?a({loading:c,open:k}):t.jsxs(ye,{onClick:k,className:"rule-action","data-cy":"action-update-rule",children:[c?t.jsx(ue,{size:16}):t.jsx(go,{style:{fontSize:18,marginRight:5}}),r("router.rule.update.title")]}),x&&t.jsx(We,{title:x.title,description:x.description,confirm:x.confirm,color:x.color,cancel:x.cancel,params:x.params,onConfirm:x.onConfirm,onCancel:x.onCancel})]})}xn.propTypes={id:i.string.isRequired,from:i.object.isRequired,to:i.object.isRequired,children:i.any};xn.defaultProps={children:null};function yn(e){const{locale:o}=G(),{blocklet:n,recommendedDomain:a}=pe(),r=mo(a,e.from.pathPrefix,zt(n,o));return t.jsxs(y,{display:"flex",alignItems:"center",children:[t.jsx(y,{component:"a",sx:{display:{xs:"flex",md:"none"}},target:"_blank",href:r,rel:"noopener noreferrer",title:r,children:t.jsx(Z,{size:"small",children:t.jsx(bo,{})})}),t.jsx(xn,{...e,children:({open:s})=>t.jsx(Z,{size:"small",onClick:s,disabled:e.isProtected,"data-cy":"action-update-rule",children:t.jsx(Mr,{})})}),t.jsx(gn,{...e,children:({open:s})=>t.jsx(Z,{size:"small",onClick:s,disabled:e.isProtected,"data-cy":"action-delete-rule",children:t.jsx(Ct,{})})})]})}yn.propTypes={isProtected:i.bool};yn.defaultProps={isProtected:!1};function Eo({group:e,...o}){return e?t.jsx(Qe,{type:"reverse",...o,children:e}):null}Eo.propTypes={group:i.string.isRequired};function pt({domain:e,isHttps:o,toUrl:n}){const a=o?"https":"http";let r=n;return mr(r)||(r=`${a}://${e}${n}`),t.jsx(xt,{href:r,target:"_blank",style:{fontSize:14},underline:"hover",children:n},r)}pt.propTypes={domain:i.string.isRequired,toUrl:i.string.isRequired,isHttps:i.bool};pt.defaultProps={isHttps:!1};function St({hasPermission:e}){const{t:o,locale:n}=G(),a=ft(),{blocklet:r,recommendedDomain:s}=pe();return r.site.rules.filter(c=>c.to.type!==U.ROUTING_RULE_TYPES.BLOCKLET).map(c=>{var l;let p=null,x=null;c.to.type===U.ROUTING_RULE_TYPES.NONE?p="404":c.to.type===U.ROUTING_RULE_TYPES.REDIRECT?p=c.to.redirectCode:c.to.type===U.ROUTING_RULE_TYPES.GENERAL_REWRITE?p="R":c.to.type===U.ROUTING_RULE_TYPES.DIRECT_RESPONSE?p=t.jsx(Ps,{sx:{color:"text.secondary",fontSize:"45px"}}):c.to.type===U.ROUTING_RULE_TYPES.COMPONENT&&(x=r.children.find(b=>b.meta.did===c.to.componentId),p="C");const g=c.isProtected?t.jsx(Ce,{title:o("blocklet.router.urlLockTooltip"),placement:"top",children:t.jsx("span",{children:t.jsx(Z,{disabled:!0,size:"small",style:{pointerEvents:"auto",paddingTop:0,paddingBottom:0,margin:"12px 0"},children:t.jsx(hs,{style:{fill:a.palette.text.disabled}})})})}):t.jsx(yn,{...c});return[t.jsxs(y,{display:"flex",py:2,className:"component-item",justifyContent:"space-between",alignItems:"center",children:[t.jsxs(y,{width:{xs:300,md:400},display:"flex",alignItems:"center",children:[t.jsx(y,{className:"component-item__indent",width:28}),typeof p=="object"?p:t.jsx(ur,{children:p}),t.jsxs(y,{sx:{ml:2,flex:1,wordBreak:"break-word"},children:[t.jsxs(y,{style:{color:"text.primary",fontSize:16},children:[c.to.type===U.ROUTING_RULE_TYPES.NONE&&o("common.page404"),c.to.type===U.ROUTING_RULE_TYPES.REDIRECT&&o("common.redirect"),c.to.type===U.ROUTING_RULE_TYPES.GENERAL_REWRITE&&o("common.rewrite"),c.to.type===U.ROUTING_RULE_TYPES.DIRECT_RESPONSE&&((l=U.ROUTING_RESPONSE_TYPES.find(b=>b.value===c.to.response.contentType))==null?void 0:l.text),c.to.type===U.ROUTING_RULE_TYPES.COMPONENT&&B.getDisplayName(x,!0)]}),t.jsxs(y,{display:"flex",alignItems:"center",children:[c.to.type===U.ROUTING_RULE_TYPES.REDIRECT&&t.jsx(pt,{domain:s,toUrl:c.to.url}),c.to.type===U.ROUTING_RULE_TYPES.GENERAL_REWRITE&&t.jsx(pt,{domain:s,toUrl:c.to.url}),c.to.type===U.ROUTING_RULE_TYPES.COMPONENT&&t.jsx(Eo,{group:c.to.pageGroup})]})]})]}),t.jsx(y,{px:2,sx:{display:{xs:"none",md:"flex"}},alignItems:"center",flexGrow:"1",children:t.jsx(xt,{href:mo(s,c.from.pathPrefix,zt(r,n)),target:"_blank",style:{fontSize:16,color:"inherit"},underline:"hover",children:pr(c.from.pathPrefix,"/")||"/"})},c.from.pathPrefix),t.jsx(y,{children:e&&t.jsx("div",{style:{textAlign:"right"},children:g})},"actions")]},"rule"),t.jsx(Ze,{},"divider")]})}St.propTypes={hasPermission:i.bool};St.defaultProps={hasPermission:!1};const mi=yt(St,"mutate_blocklets"),fi=yt(St,"",He);function hi(e){const{inService:o}=H();return o?t.jsx(fi,{...e}):t.jsx(mi,{...e})}function gi(e,o){const n=f.useRef(o);f.useEffect(()=>{const a=r=>n.current(r.detail);return window.addEventListener(e,a),()=>window.removeEventListener(e,a)},[e])}function xi(e){const o=fo(),{t:n}=G(),a=()=>{const r=new URLSearchParams(window.location.search);r.get("checkUpdate")&&(r.delete("checkUpdate"),o(r.toString()),e(),L.success(n("notification.checkingForUpdates")))};f.useEffect(a,[]),gi("checkUpdate",a)}function yi({blocklet:e,scrollToComponent:o}={blocklet:null,scrollToComponent:!1}){const n=fo(),{t:a}=G(),r=f.useRef(null),s=f.useMemo(()=>{if(!e||!e.optionalComponents)return null;const h=new URLSearchParams(window.location.search),c=h.get("install-component");if(c){r.current=c,h.delete("install-component"),n(h.toString());const p=e.optionalComponents.find(g=>g.meta.did===c);if(!p)return L.success(a("notification.installComponentError",{did:c})),null;const{meta:x}=p;if(o){const g=document.getElementById(`optional-component-${c}`),l=document.querySelector(".dashboard-main");if(g){const b=g.getBoundingClientRect(),d=l.getBoundingClientRect();l.scrollTo({top:b.top-d.top+l.scrollTop,behavior:"smooth"})}}return x}return null},[e,n,a,o]);return f.useEffect(()=>{var h;r.current&&window.opener&&window.opener.postMessage({blocklet:e,kind:"component-installer"},(h=window.blocklet)==null?void 0:h.appUrl)},[e]),s}function wt({open:e,onClose:o,blocklet:n,ancestors:a}){var x;const{t:r}=G(),s=[...(a||[]).map(g=>{var l;return((l=g==null?void 0:g.meta)==null?void 0:l.did)||""}),((x=n==null?void 0:n.meta)==null?void 0:x.did)||""].filter(Boolean).join("/"),h=r("preferencesFor",{name:B.getDisplayName(n,!0)}),c=f.useMemo(()=>({position:"relative",minHeight:"50vh",height:"100%",overflow:"hidden",border:0}),[]);if(qe(n.status)||n.status==="unknown"&&qe(n.status))return null;const p=()=>{o==null||o()};return t.jsx(Ci,{open:e,fullWidth:!0,maxWidth:"md",title:h,onClose:p,PaperProps:{style:{minHeight:"500px"}},children:t.jsxs(ao,{gap:1,children:[t.jsx(te,{sx:{fontSize:12,color:"text.secondary",mb:.5},children:r("description.preferences",{name:B.getDisplayName(n,!0)})}),t.jsx(Ar,{id:s,styles:c})]})})}wt.propTypes={blocklet:i.object.isRequired,ancestors:i.array,open:i.bool,onClose:i.func};wt.defaultProps={ancestors:[],open:!1,onClose:null};const Ci=$(ht)`
362
362
  .MuiDialogContent-root {
363
363
  padding-top: 0;
364
364
  padding-bottom: 24px;
@@ -480,7 +480,7 @@ import{bW as Bo,j as t,f7 as Oo,hL as $o,l2 as Mo,aP as Wt,aQ as Gt,m as G,bq as
480
480
  margin-left: 4px;
481
481
  transform: translateY(-1px);
482
482
  }
483
- `;function En({blocklet:e,onUpdate:o,getComponentUrl:n,...a}){var _e;const{t:r}=f.useContext(ve),{api:s,inService:h,info:c}=H(),{addDeletingDid:p,removeDeletingDid:x,matchDeletingDid:g}=Vt(),[l,b]=f.useState(!1),[d,T]=f.useState(null),[S,R]=f.useState(null),[k,C]=f.useState(!1),[m,u]=f.useState(!1),[v,w]=f.useState(!1),[j,N]=f.useState(!1),[M,X]=f.useState(null),I=e&&e.structVersion!==U.APP_STRUCT_VERSION,[ne,me]=f.useState(!1),J=[...e.children];e.meta.group!=="gateway"&&J.unshift(e),g(J.map(E=>E.meta.did));const Pe=async()=>{if(!l){b(!0);try{const{updateId:E,updateList:V}=(await s.checkComponentsForUpdates({input:{did:e.meta.did}})).preUpdateInfo||{};if(b(!1),!E){L.info(r("blocklet.component.noUpdate"));return}const ce=[];B.forEachChildSync(e,(ee,{id:be,ancestors:F})=>{const Ie=V.find(Re=>Re.id===be);if(Ie){const Re=F.slice(1).concat(ee).map(Le=>Le.meta.title||Le.meta.name).join(" / "),Ge=(F[1]||ee).meta.did;ce.push({groupId:Ge,name:Re,version:ee.meta.version,newVersion:Ie.meta.version})}});const z={};ce.forEach(ee=>{z[ee.groupId]?ee.disabled=!0:z[ee.groupId]=!0}),T({params:{updateId:E},list:ce,checks:z,hasChecks:!0})}catch(E){b(!1),L.error(ie(E))}}},we=async()=>{if(!l)try{b(!0);const E=Object.keys(d.checks).filter(ce=>d.checks[ce]),V={updateId:d.params.updateId,rootDid:e.meta.did,selectedComponents:E};await s.upgradeComponents({input:V}),b(!1),T(null),me(null)}catch(E){b(!1),L.error(ie(E))}},Ee=async(E,V)=>{p(E.meta.did);try{await s.deleteComponent({input:{did:E.meta.did,keepData:V==="keepData",rootDid:e.meta.did}}),await Ke(800)}catch(ce){L.error(ie(ce)),x(E.meta.did)}},_=async E=>{try{await s.startBlocklet({input:{did:e.meta.did,componentDids:[E.meta.did]}}),await Ke(800)}catch(V){L.error(ie(V))}},fe=async E=>{try{await s.stopBlocklet({input:{did:e.meta.did,componentDids:[E.meta.did]}}),await Ke(800)}catch(V){L.error(ie(V))}},W=async E=>{try{await s.restartBlocklet({input:{did:e.meta.did,componentDids:[E.meta.did]}}),await Ke(800)}catch(V){L.error(ie(V))}},he=(E,V)=>{const{checked:ce}=E.target;T(z=>{const ee=Object.entries(z.checks).reduce((F,[Ie,Re])=>(F[Ie]=V===Ie||V==="all"?ce:Re,F),{}),be=Object.values(ee).includes(!0);return{...z,checks:ee,hasChecks:be}})},A=f.useMemo(()=>d==null?void 0:d.list.filter(E=>!E.disabled).every(E=>d.checks[E.groupId]),[d]);xi(Pe);const ke=yi({blocklet:e,scrollToComponent:!0}),le=M||ke;return t.jsxs(Ni,{component:"div",...a,children:[t.jsxs(Li,{display:"flex",children:[t.jsxs(Bi,{flexDirection:"row",className:"title",display:"flex",alignItems:"center",children:[J!=null&&J.length?`${r("common.components")} (${J.length})`:`${r("common.components")}`,!I&&t.jsx(At,{permission:h?"":"mutate_blocklets",role:h?He:[],children:t.jsx(Zt,{children:t.jsx(qt,{top:1.2,right:.4,color:"error",badgeContent:"",variant:"dot",invisible:!ne,children:t.jsxs(ae,{disabled:l||B.isInProgress(e.status),onClick:()=>{Pe()},"data-cy":"check-for-updates",children:[t.jsx(y,{ml:.5,mr:.5,display:"flex",children:l?t.jsx(ue,{size:16}):t.jsx(wo,{style:{fontSize:"1em"}})}),r("blocklet.component.checkUpdateTitle")]})})})})]}),t.jsx(At,{permission:h?"":"mutate_blocklets",role:h?He:[],children:t.jsxs(y,{display:"flex",alignItems:"center",children:[!I&&t.jsx(fn,{blocklet:e,serverVersion:c.version,children:({open:E})=>t.jsxs(ae,{disabled:l||B.isInProgress(e.status),variant:"text",color:"primary","data-cy":"add-component",className:"sm-hide-icon",onClick:E,children:[t.jsx(Er,{style:{fontSize:"1.3em",marginRight:4}}),r("blocklet.component.add")]})}),t.jsx(So,{"data-cy":"component-actions",actions:[{icon:t.jsx(Q,{icon:"fluent:link-20-filled"}),onClick:()=>u(!0),text:r("router.rule.add.title"),disabled:l||B.isInProgress(e.status)},...I?[]:[{icon:t.jsx(Q,{icon:"mdi:variable"}),onClick:()=>{w(!0)},text:r("common.environments")},{icon:t.jsx(Qt,{}),onClick:()=>{N(!0)},text:r("common.preferences")}]].filter(Boolean)})]})})]}),J!=null&&J.length?t.jsxs(t.Fragment,{children:[t.jsxs(y,{mt:2,children:[e.meta.group!=="gateway"&&t.jsx(mt,{blocklet:e,app:e,onRemove:Ee,onStart:_,onStop:fe,onRestart:W,getComponentUrl:n},`0-${e.meta.did}`),e.children.map(E=>t.jsx(mt,{depth:1,blocklet:E,ancestors:[e],app:e,onRemove:Ee,onStart:_,onStop:fe,onRestart:W,getComponentUrl:n},`1-${E.meta.did}`))]},`top-blocklet-${e.meta.did}`),(_e=e.optionalComponents)==null?void 0:_e.map(E=>t.jsx(Sn,{children:t.jsx(wn,{setInstallComponentMeta:X,...E})},E.meta.did))]}):t.jsx(y,{mt:8,children:t.jsx(Tr,{children:r("blocklet.component.noComponent")})}),!!e.site.rules.length&&t.jsx(y,{sx:{mt:0,".component-item__indent":{pl:2,width:0}},children:t.jsx(hi,{})}),!!d&&t.jsx(zn,{open:!0,fullWidth:!0,children:t.jsxs(y,{paddingY:1.5,children:[t.jsx(Fn,{children:r("blocklet.component.updateTitle")}),t.jsxs(y,{component:Vn,py:4,children:[d.list.filter(E=>!E.disabled).length>1&&t.jsxs(y,{display:"flex",alignItems:"center",children:[t.jsx(Yn,{checked:A,onChange:E=>he(E,"all")}),t.jsx(y,{children:r(A?"common.unselectAll":"common.selectAll")})]}),d.list.map(E=>t.jsxs(y,{display:"flex",alignItems:"center",mb:1,children:[t.jsx(Yn,{checked:d.checks[E.groupId],onChange:V=>he(V,E.groupId),style:{marginLeft:E.disabled?16:0,alignSelf:"flex-start"},defaultChecked:!0,disabled:E.disabled}),t.jsxs(y,{flexGrow:1,children:[t.jsx(y,{pt:1,xs:8,children:E.name}),E.version&&t.jsxs(lt,{fontSize:"h6.fontSize",container:!0,spacing:2,alignItems:"center",children:[t.jsx(lt,{item:!0,xs:3,children:E.version}),t.jsx(lt,{item:!0,xs:1,children:t.jsx(br,{style:{fontSize:"0.9em"}})}),t.jsx(lt,{item:!0,xs:3,children:t.jsx(y,{color:"secondary.main",children:E.newVersion})})]})]},`${E.name}-${E.newVersion}`)]},E.name))]}),t.jsxs(Rr,{style:{padding:"8px 24px 24px"},children:[t.jsx(ae,{onClick:()=>{T(null)},children:r("common.cancel")}),t.jsxs(ae,{onClick:E=>{E.stopPropagation(),we()},color:"primary",disabled:l||!d.hasChecks,variant:"contained",autoFocus:!0,children:[l&&t.jsx(ue,{size:16}),r("common.update")]})]})]})}),!!S&&t.jsx(zn,{open:!0,fullWidth:!0,onClose:()=>R(!1),children:t.jsxs(y,{paddingY:1.5,children:[t.jsx(Fn,{children:r("common.configuration")}),t.jsx(Vn,{children:t.jsx(y,{py:2,children:t.jsx(Mt,{control:t.jsx(Es,{checked:k,onChange:E=>C(!!E.target.checked)}),label:r("blocklet.component.showContainer")})})})]})}),t.jsx(bt,{selectedMeta:le,blocklet:e,showDialog:!!le,setShowDialog:()=>X(null)}),m&&t.jsx(hn,{hiddenChildren:!0,open:!0,onClose:()=>u(!1)}),v&&t.jsx(jt,{open:!0,onClose:()=>w(!1),hiddenChildren:!0,blocklet:e,ancestors:[]}),j&&t.jsx(wt,{open:!0,onClose:()=>N(!1),blocklet:e,ancestors:[]})]})}En.propTypes={blocklet:i.object.isRequired,onUpdate:i.func,getComponentUrl:i.func};En.defaultProps={onUpdate:()=>{},getComponentUrl:()=>window.location.origin};const Ni=$.div`
483
+ `;function En({blocklet:e,onUpdate:o,getComponentUrl:n,...a}){var _e;const{t:r}=f.useContext(ve),{api:s,inService:h,info:c}=H(),{addDeletingDid:p,removeDeletingDid:x,matchDeletingDid:g}=Vt(),[l,b]=f.useState(!1),[d,T]=f.useState(null),[S,R]=f.useState(null),[k,C]=f.useState(!1),[m,u]=f.useState(!1),[v,w]=f.useState(!1),[j,N]=f.useState(!1),[M,X]=f.useState(null),I=e&&e.structVersion!==U.APP_STRUCT_VERSION,[ne,me]=f.useState(!1),J=[...e.children];e.meta.group!=="gateway"&&J.unshift(e),g(J.map(E=>E.meta.did));const Pe=async()=>{if(!l){b(!0);try{const{updateId:E,updateList:V}=(await s.checkComponentsForUpdates({input:{did:e.meta.did}})).preUpdateInfo||{};if(b(!1),!E){L.info(r("blocklet.component.noUpdate"));return}const ce=[];B.forEachChildSync(e,(ee,{id:be,ancestors:z})=>{const Ie=V.find(Re=>Re.id===be);if(Ie){const Re=z.slice(1).concat(ee).map(Le=>Le.meta.title||Le.meta.name).join(" / "),Ge=(z[1]||ee).meta.did;ce.push({groupId:Ge,name:Re,version:ee.meta.version,newVersion:Ie.meta.version})}});const F={};ce.forEach(ee=>{F[ee.groupId]?ee.disabled=!0:F[ee.groupId]=!0}),T({params:{updateId:E},list:ce,checks:F,hasChecks:!0})}catch(E){b(!1),L.error(ie(E))}}},we=async()=>{if(!l)try{b(!0);const E=Object.keys(d.checks).filter(ce=>d.checks[ce]),V={updateId:d.params.updateId,rootDid:e.meta.did,selectedComponents:E};await s.upgradeComponents({input:V}),b(!1),T(null),me(null)}catch(E){b(!1),L.error(ie(E))}},Ee=async(E,V)=>{p(E.meta.did);try{await s.deleteComponent({input:{did:E.meta.did,keepData:V==="keepData",rootDid:e.meta.did}}),await Ke(800)}catch(ce){L.error(ie(ce)),x(E.meta.did)}},_=async E=>{try{await s.startBlocklet({input:{did:e.meta.did,componentDids:[E.meta.did]}}),await Ke(800)}catch(V){L.error(ie(V))}},fe=async E=>{try{await s.stopBlocklet({input:{did:e.meta.did,componentDids:[E.meta.did]}}),await Ke(800)}catch(V){L.error(ie(V))}},W=async E=>{try{await s.restartBlocklet({input:{did:e.meta.did,componentDids:[E.meta.did]}}),await Ke(800)}catch(V){L.error(ie(V))}},he=(E,V)=>{const{checked:ce}=E.target;T(F=>{const ee=Object.entries(F.checks).reduce((z,[Ie,Re])=>(z[Ie]=V===Ie||V==="all"?ce:Re,z),{}),be=Object.values(ee).includes(!0);return{...F,checks:ee,hasChecks:be}})},A=f.useMemo(()=>d==null?void 0:d.list.filter(E=>!E.disabled).every(E=>d.checks[E.groupId]),[d]);xi(Pe);const ke=yi({blocklet:e,scrollToComponent:!0}),le=M||ke;return t.jsxs(Ni,{component:"div",...a,children:[t.jsxs(Li,{display:"flex",children:[t.jsxs(Bi,{flexDirection:"row",className:"title",display:"flex",alignItems:"center",children:[J!=null&&J.length?`${r("common.components")} (${J.length})`:`${r("common.components")}`,!I&&t.jsx(At,{permission:h?"":"mutate_blocklets",role:h?He:[],children:t.jsx(Zt,{children:t.jsx(qt,{top:1.2,right:.4,color:"error",badgeContent:"",variant:"dot",invisible:!ne,children:t.jsxs(ae,{disabled:l||B.isInProgress(e.status),onClick:()=>{Pe()},"data-cy":"check-for-updates",children:[t.jsx(y,{ml:.5,mr:.5,display:"flex",children:l?t.jsx(ue,{size:16}):t.jsx(wo,{style:{fontSize:"1em"}})}),r("blocklet.component.checkUpdateTitle")]})})})})]}),t.jsx(At,{permission:h?"":"mutate_blocklets",role:h?He:[],children:t.jsxs(y,{display:"flex",alignItems:"center",children:[!I&&t.jsx(fn,{blocklet:e,serverVersion:c.version,children:({open:E})=>t.jsxs(ae,{disabled:l||B.isInProgress(e.status),variant:"text",color:"primary","data-cy":"add-component",className:"sm-hide-icon",onClick:E,children:[t.jsx(Er,{style:{fontSize:"1.3em",marginRight:4}}),r("blocklet.component.add")]})}),t.jsx(So,{"data-cy":"component-actions",actions:[{icon:t.jsx(Q,{icon:"fluent:link-20-filled"}),onClick:()=>u(!0),text:r("router.rule.add.title"),disabled:l||B.isInProgress(e.status)},...I?[]:[{icon:t.jsx(Q,{icon:"mdi:variable"}),onClick:()=>{w(!0)},text:r("common.environments")},{icon:t.jsx(Qt,{}),onClick:()=>{N(!0)},text:r("common.preferences")}]].filter(Boolean)})]})})]}),J!=null&&J.length?t.jsxs(t.Fragment,{children:[t.jsxs(y,{mt:2,children:[e.meta.group!=="gateway"&&t.jsx(mt,{blocklet:e,app:e,onRemove:Ee,onStart:_,onStop:fe,onRestart:W,getComponentUrl:n},`0-${e.meta.did}`),e.children.map(E=>t.jsx(mt,{depth:1,blocklet:E,ancestors:[e],app:e,onRemove:Ee,onStart:_,onStop:fe,onRestart:W,getComponentUrl:n},`1-${E.meta.did}`))]},`top-blocklet-${e.meta.did}`),(_e=e.optionalComponents)==null?void 0:_e.map(E=>t.jsx(Sn,{children:t.jsx(wn,{setInstallComponentMeta:X,...E})},E.meta.did))]}):t.jsx(y,{mt:8,children:t.jsx(Tr,{children:r("blocklet.component.noComponent")})}),!!e.site.rules.length&&t.jsx(y,{sx:{mt:0,".component-item__indent":{pl:2,width:0}},children:t.jsx(hi,{})}),!!d&&t.jsx(Fn,{open:!0,fullWidth:!0,children:t.jsxs(y,{paddingY:1.5,children:[t.jsx(zn,{children:r("blocklet.component.updateTitle")}),t.jsxs(y,{component:Vn,py:4,children:[d.list.filter(E=>!E.disabled).length>1&&t.jsxs(y,{display:"flex",alignItems:"center",children:[t.jsx(Yn,{checked:A,onChange:E=>he(E,"all")}),t.jsx(y,{children:r(A?"common.unselectAll":"common.selectAll")})]}),d.list.map(E=>t.jsxs(y,{display:"flex",alignItems:"center",mb:1,children:[t.jsx(Yn,{checked:d.checks[E.groupId],onChange:V=>he(V,E.groupId),style:{marginLeft:E.disabled?16:0,alignSelf:"flex-start"},defaultChecked:!0,disabled:E.disabled}),t.jsxs(y,{flexGrow:1,children:[t.jsx(y,{pt:1,xs:8,children:E.name}),E.version&&t.jsxs(lt,{fontSize:"h6.fontSize",container:!0,spacing:2,alignItems:"center",children:[t.jsx(lt,{item:!0,xs:3,children:E.version}),t.jsx(lt,{item:!0,xs:1,children:t.jsx(br,{style:{fontSize:"0.9em"}})}),t.jsx(lt,{item:!0,xs:3,children:t.jsx(y,{color:"secondary.main",children:E.newVersion})})]})]},`${E.name}-${E.newVersion}`)]},E.name))]}),t.jsxs(Rr,{style:{padding:"8px 24px 24px"},children:[t.jsx(ae,{onClick:()=>{T(null)},children:r("common.cancel")}),t.jsxs(ae,{onClick:E=>{E.stopPropagation(),we()},color:"primary",disabled:l||!d.hasChecks,variant:"contained",autoFocus:!0,children:[l&&t.jsx(ue,{size:16}),r("common.update")]})]})]})}),!!S&&t.jsx(Fn,{open:!0,fullWidth:!0,onClose:()=>R(!1),children:t.jsxs(y,{paddingY:1.5,children:[t.jsx(zn,{children:r("common.configuration")}),t.jsx(Vn,{children:t.jsx(y,{py:2,children:t.jsx(Mt,{control:t.jsx(Es,{checked:k,onChange:E=>C(!!E.target.checked)}),label:r("blocklet.component.showContainer")})})})]})}),t.jsx(bt,{selectedMeta:le,blocklet:e,showDialog:!!le,setShowDialog:()=>X(null)}),m&&t.jsx(hn,{hiddenChildren:!0,open:!0,onClose:()=>u(!1)}),v&&t.jsx(jt,{open:!0,onClose:()=>w(!1),hiddenChildren:!0,blocklet:e,ancestors:[]}),j&&t.jsx(wt,{open:!0,onClose:()=>N(!1),blocklet:e,ancestors:[]})]})}En.propTypes={blocklet:i.object.isRequired,onUpdate:i.func,getComponentUrl:i.func};En.defaultProps={onUpdate:()=>{},getComponentUrl:()=>window.location.origin};const Ni=$.div`
484
484
  .title {
485
485
  font-size: 1.2rem;
486
486
  font-weight: bold;
@@ -518,4 +518,4 @@ import{bW as Bo,j as t,f7 as Oo,hL as $o,l2 as Mo,aP as Wt,aQ as Gt,m as G,bq as
518
518
  width: 100%;
519
519
  justify-content: space-between;
520
520
  }
521
- `;function ko(e){const{locale:o}=f.useContext(ve),{blocklet:n,recommendedDomain:a}=Ts(),r=s=>Sr({blocklet:n,domain:{value:a||`${wr.encode(n.appPid)}.${U.DEFAULT_DID_DOMAIN}`},mountPoint:s,params:Ft(n,o)});return t.jsx(En,{blocklet:n,getComponentUrl:r,...e})}ko.propTypes={};ko.defaultProps={};export{ko as default};
521
+ `;function ko(e){const{locale:o}=f.useContext(ve),{blocklet:n,recommendedDomain:a}=Ts(),r=s=>Sr({blocklet:n,domain:{value:a||`${wr.encode(n.appPid)}.${U.DEFAULT_DID_DOMAIN}`},mountPoint:s,params:zt(n,o)});return t.jsx(En,{blocklet:n,getComponentUrl:r,...e})}ko.propTypes={};ko.defaultProps={};export{ko as default};
@@ -1,4 +1,4 @@
1
- import{j as e,k as i,dv as x,dw as c,dq as p}from"./index-DTb1YjkO.js";function w({name:t,nameFormatter:a=o=>typeof o=="string"?o.split(" ").map(m=>x(c(m))).join(" "):o,layout:n="horizontal",children:r,valueComponent:l="div",nameWidth:s=90,...f}){return e.jsxs(d,{layout:n,width:s,...f,children:[e.jsx(i,{color:"textSecondary",className:"info-row__name",children:a(t)}),r&&e.jsx(i,{color:"textPrimary",component:l,className:"info-row__value",children:r})]})}const d=p("div")`
1
+ import{j as e,k as i,dv as x,dw as c,dq as p}from"./index-BXOD69ua.js";function w({name:t,nameFormatter:a=o=>typeof o=="string"?o.split(" ").map(m=>x(c(m))).join(" "):o,layout:n="horizontal",children:r,valueComponent:l="div",nameWidth:s=90,...f}){return e.jsxs(d,{layout:n,width:s,...f,children:[e.jsx(i,{color:"textSecondary",className:"info-row__name",children:a(t)}),r&&e.jsx(i,{color:"textPrimary",component:l,className:"info-row__value",children:r})]})}const d=p("div")`
2
2
  display: flex;
3
3
  flex-direction: ${t=>t.layout==="vertical"?"column":"row"};
4
4
  justify-content: flex-start;
@@ -1,4 +1,4 @@
1
- import{r as o,Q as d,j as e,ep as c,ba as b,eb as I,bx as M,fk as E,fj as P,dq as p,fl as S}from"./index-DTb1YjkO.js";import{B as z}from"./ButtonGroup-ClVwTb7r.js";function A(r){const{size:u="medium",color:s="primary",menu:a=[],children:i=null,variant:m="contained",onClick:f=P,menuButtonProps:x={},...h}=r,[j,l]=o.useState(!1),n=o.useRef(null),g=Array.isArray(a)?a.map((t,C)=>o.isValidElement(t)?t:o.createElement(d,{...t,key:C})):a,y=()=>{l(t=>!t)},k=t=>{n.current&&n.current.contains(t.target)||l(!1)},B=t=>{t.target.closest(".MuiMenuItem-root")&&l(!1)};return e.jsxs(e.Fragment,{children:[e.jsxs(L,{variant:m,size:u,color:s,ref:n,...h,children:[typeof i=="function"?i():e.jsx(c,{onClick:f,color:s,children:i}),e.jsx(c,{onClick:y,color:s,...x,"aria-label":"more functions",children:e.jsx(b,{})})]}),e.jsx(w,{open:j,anchorEl:n.current,placement:"bottom-end",disablePortal:!1,children:e.jsx(I,{children:e.jsx(M,{onClickAway:k,children:e.jsx(E,{onClick:B,children:g})})})})]})}A.Item=d;const L=p(z)`
1
+ import{r as o,Q as d,j as e,ep as c,ba as b,eb as I,bx as M,fk as E,fj as P,dq as p,fl as S}from"./index-BXOD69ua.js";import{B as z}from"./ButtonGroup-pRTDFJWg.js";function A(r){const{size:u="medium",color:s="primary",menu:a=[],children:i=null,variant:m="contained",onClick:f=P,menuButtonProps:x={},...h}=r,[j,l]=o.useState(!1),n=o.useRef(null),g=Array.isArray(a)?a.map((t,C)=>o.isValidElement(t)?t:o.createElement(d,{...t,key:C})):a,y=()=>{l(t=>!t)},k=t=>{n.current&&n.current.contains(t.target)||l(!1)},B=t=>{t.target.closest(".MuiMenuItem-root")&&l(!1)};return e.jsxs(e.Fragment,{children:[e.jsxs(L,{variant:m,size:u,color:s,ref:n,...h,children:[typeof i=="function"?i():e.jsx(c,{onClick:f,color:s,children:i}),e.jsx(c,{onClick:y,color:s,...x,"aria-label":"more functions",children:e.jsx(b,{})})]}),e.jsx(w,{open:j,anchorEl:n.current,placement:"bottom-end",disablePortal:!1,children:e.jsx(I,{children:e.jsx(M,{onClickAway:k,children:e.jsx(E,{onClick:B,children:g})})})})]})}A.Item=d;const L=p(z)`
2
2
  > .MuiButtonBase-root:last-of-type {
3
3
  min-width: 2em;
4
4
  padding-left: 0;
@@ -1 +1 @@
1
- import{j as e,cE as j,K as v,x as P,r as l,e as S,aA as w,u as k,w as E,al as b,aT as K,dr as U,cu as u,bc as W,v as _,Y as R,C as L,ds as T,dt as D}from"./index-DTb1YjkO.js";import{R as d}from"./index-CIeEDIRZ.js";function a({children:r,...s}){var o,c;return e.jsx(j,{...s,did:((o=window==null?void 0:window.blocklet)==null?void 0:o.appPid)||((c=window==null?void 0:window.env)==null?void 0:c.appPid),children:e.jsx(v,{sx:{maxWidth:"100%",height:"100%"},children:r})})}function A(){const r=P(),{t:s,locale:o}=l.useContext(S),{api:c}=w(),{info:p}=k(),f=E(p),x=b(),n=K({ready:!1,success:!1,error:null,invalidSession:!1}),i=U(),h=()=>{try{const t=new URL(window.location.href);if(t.hash.includes("invalid")){n.invalidSession=!0;return}const g=t.searchParams.get("__connect_url__"),y=T(g);if(!D(y))throw new Error;n.ready=!0}catch{n.invalidSession=!0,r("#invalid",{replace:!0})}};l.useLayoutEffect(()=>h(),[]);const m=u(t=>{n.error=t.message,r("#invalid",{replace:!0})}),C=u(()=>{n.success=!0});if(n.invalidSession)return e.jsx(a,{children:e.jsx(d,{style:{backgroundColor:"transparent"},status:"error",title:s("didConnect.common.invalidSession"),description:s("didConnect.common.invalidSessionDesc")})});if(n.error){const t=n.error;return e.jsx(a,{children:e.jsx(d,{style:{backgroundColor:"transparent"},status:"error",title:s("didConnect.common.connectionError"),description:t})})}return n.success?e.jsx(a,{children:e.jsx(d,{style:{backgroundColor:"transparent"},status:"info",icon:e.jsx(W,{style:{color:x.palette.success.main,fontSize:72}}),title:s("didConnect.genKeyPair.success"),description:s("didConnect.genKeyPair.successDesc")})}):n.ready?e.jsx(a,{children:e.jsx(_,{className:"connect",action:"gen-key-pair",checkFn:c.get,checkTimeout:10*60*1e3,extraParams:{sourceAppPid:i==null?void 0:i.appPid,forceSwitch:!0},saveConnect:!1,forceConnected:!1,webWalletUrl:f,onSuccess:C,onError:m,locale:o,messages:{title:s("didConnect.genKeyPair.title"),scan:s("didConnect.genKeyPair.scan"),confirm:s("auth.confirm"),success:s("didConnect.genKeyPair.success")},popup:!0,open:!0,hideCloseButton:!0})},"ready"):e.jsx(R,{children:e.jsx(L,{})})}export{A as default};
1
+ import{j as e,cE as j,K as v,x as P,r as l,e as S,aA as w,u as k,w as E,al as b,aT as K,dr as U,cu as u,bc as W,v as _,Y as R,C as L,ds as T,dt as D}from"./index-BXOD69ua.js";import{R as d}from"./index-BBjq0j2v.js";function a({children:r,...s}){var o,c;return e.jsx(j,{...s,did:((o=window==null?void 0:window.blocklet)==null?void 0:o.appPid)||((c=window==null?void 0:window.env)==null?void 0:c.appPid),children:e.jsx(v,{sx:{maxWidth:"100%",height:"100%"},children:r})})}function A(){const r=P(),{t:s,locale:o}=l.useContext(S),{api:c}=w(),{info:p}=k(),f=E(p),x=b(),n=K({ready:!1,success:!1,error:null,invalidSession:!1}),i=U(),h=()=>{try{const t=new URL(window.location.href);if(t.hash.includes("invalid")){n.invalidSession=!0;return}const g=t.searchParams.get("__connect_url__"),y=T(g);if(!D(y))throw new Error;n.ready=!0}catch{n.invalidSession=!0,r("#invalid",{replace:!0})}};l.useLayoutEffect(()=>h(),[]);const m=u(t=>{n.error=t.message,r("#invalid",{replace:!0})}),C=u(()=>{n.success=!0});if(n.invalidSession)return e.jsx(a,{children:e.jsx(d,{style:{backgroundColor:"transparent"},status:"error",title:s("didConnect.common.invalidSession"),description:s("didConnect.common.invalidSessionDesc")})});if(n.error){const t=n.error;return e.jsx(a,{children:e.jsx(d,{style:{backgroundColor:"transparent"},status:"error",title:s("didConnect.common.connectionError"),description:t})})}return n.success?e.jsx(a,{children:e.jsx(d,{style:{backgroundColor:"transparent"},status:"info",icon:e.jsx(W,{style:{color:x.palette.success.main,fontSize:72}}),title:s("didConnect.genKeyPair.success"),description:s("didConnect.genKeyPair.successDesc")})}):n.ready?e.jsx(a,{children:e.jsx(_,{className:"connect",action:"gen-key-pair",checkFn:c.get,checkTimeout:10*60*1e3,extraParams:{sourceAppPid:i==null?void 0:i.appPid,forceSwitch:!0},saveConnect:!1,forceConnected:!1,webWalletUrl:f,onSuccess:C,onError:m,locale:o,messages:{title:s("didConnect.genKeyPair.title"),scan:s("didConnect.genKeyPair.scan"),confirm:s("auth.confirm"),success:s("didConnect.genKeyPair.success")},popup:!0,open:!0,hideCloseButton:!0})},"ready"):e.jsx(R,{children:e.jsx(L,{})})}export{A as default};
@@ -1 +1 @@
1
- import{r as o,e,j as t,n}from"./index-DTb1YjkO.js";import{R as r}from"./index-CIeEDIRZ.js";function i(){const{t:s}=o.useContext(e);return t.jsx(a,{style:{paddingTop:"25vh"},children:t.jsx(r,{status:"404",description:s("noMatch.desc"),style:{backgroundColor:"transparent"}})})}const a=n.main``;export{i as default};
1
+ import{r as o,e,j as t,n}from"./index-BXOD69ua.js";import{R as r}from"./index-BBjq0j2v.js";function i(){const{t:s}=o.useContext(e);return t.jsx(a,{style:{paddingTop:"25vh"},children:t.jsx(r,{status:"404",description:s("noMatch.desc"),style:{backgroundColor:"transparent"}})})}const a=n.main``;export{i as default};