@abtnode/webapp 1.16.29-beta-87e06e1c → 1.16.29-beta-2eaf40bc

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 (187) hide show
  1. package/blocklet.js +1 -1
  2. package/blocklet.yml +1 -1
  3. package/dist/assets/{Add-9p89cr51.js → Add-3VAJlzWu.js} +1 -1
  4. package/dist/assets/{ArrowDropDown-PUGycbah.js → ArrowDropDown-DehQx6JH.js} +1 -1
  5. package/dist/assets/{Autocomplete-CBrNN6Wi.js → Autocomplete-Dd8-Wnl0.js} +1 -1
  6. package/dist/assets/{Breadcrumbs-YbVhGF74.js → Breadcrumbs-B-3iNfJV.js} +1 -1
  7. package/dist/assets/{ButtonGroup-qjpoNO9j.js → ButtonGroup-4dUIbekw.js} +1 -1
  8. package/dist/assets/{CheckCircle-C458wd7t.js → CheckCircle-DQOA10VV.js} +1 -1
  9. package/dist/assets/{ChevronLeft-Bvm6nyLn.js → ChevronLeft-BovE6bSi.js} +1 -1
  10. package/dist/assets/{ChevronRight-pbRslwzZ.js → ChevronRight-COT0_GJ0.js} +1 -1
  11. package/dist/assets/{Close-CRs5nN-9.js → Close-DSOnajKv.js} +1 -1
  12. package/dist/assets/Delete-B0dIMgAO.js +1 -0
  13. package/dist/assets/{DeleteOutline-DkbzMi-O.js → DeleteOutline-BqV9pNFr.js} +1 -1
  14. package/dist/assets/DeleteOutline-C3yNjgmc.js +1 -0
  15. package/dist/assets/{Done-DycYtcxi.js → Done-C6j7V5dY.js} +1 -1
  16. package/dist/assets/{Edit-CWojktHH.js → Edit-UiTtw7ED.js} +1 -1
  17. package/dist/assets/{EditIcon-ugJwCH0S.js → EditIcon-D-Dhs8bv.js} +1 -1
  18. package/dist/assets/ExpandMore-CBwUEwtf.js +1 -0
  19. package/dist/assets/{FilterList-Cv0uknPg.js → FilterList-BfkrQFl0.js} +4 -4
  20. package/dist/assets/{Google-Bpr-eboG.js → Google-U8HcYuII.js} +1 -1
  21. package/dist/assets/{Https-DEV-Mw3j.js → Https-DJQ_Uk5c.js} +1 -1
  22. package/dist/assets/{InputAdornment-GAXpW_Pc.js → InputAdornment-xbC4GBmg.js} +1 -1
  23. package/dist/assets/{InputLabel-CdP2Vrv8.js → InputLabel-Dyg2n4KM.js} +1 -1
  24. package/dist/assets/{LastPage-BTLBin5_.js → LastPage-g6ViU_79.js} +1 -1
  25. package/dist/assets/{Launch-C4_ktc4w.js → Launch-CstW8TMa.js} +1 -1
  26. package/dist/assets/{Link-DbSs28Vg.js → Link-Bz3bTK5Z.js} +1 -1
  27. package/dist/assets/{LoadingButton-DXivgZhE.js → LoadingButton-yzy8vaq4.js} +1 -1
  28. package/dist/assets/{LockIcon-QS29DL1o.js → LockIcon-C86uaqg6.js} +1 -1
  29. package/dist/assets/{Loop-Dpp5fctN.js → Loop-D_KRqy9W.js} +1 -1
  30. package/dist/assets/{MoreVert-YMJ5zQGi.js → MoreVert-BB46cKFe.js} +1 -1
  31. package/dist/assets/{Pagination-Dw5SQ0Cx.js → Pagination-JhNJfD4t.js} +1 -1
  32. package/dist/assets/{Public-DuGVgRc8.js → Public-BjhCkcv9.js} +1 -1
  33. package/dist/assets/{SchemaReference.es-CuLNjPJp.js → SchemaReference.es-HI-2_6NF.js} +1 -1
  34. package/dist/assets/{Search-CnmiZ7r5.js → Search-rqHI-c1S.js} +1 -1
  35. package/dist/assets/{Select-D_jjFrx2.js → Select-BioDM9Sd.js} +2 -2
  36. package/dist/assets/{Skeleton-DMU-9YHS.js → Skeleton-DZ26ugSB.js} +5 -5
  37. package/dist/assets/{Slider-OEZKoU_q.js → Slider-CIc45JJ9.js} +1 -1
  38. package/dist/assets/{Stepper-BLioo72i.js → Stepper-BXZWzSgf.js} +1 -1
  39. package/dist/assets/TextField-BKw9m9nx.js +1 -0
  40. package/dist/assets/{ToggleButtonGroup-DOF-aia7.js → ToggleButtonGroup-DRfzhnnx.js} +1 -1
  41. package/dist/assets/{ViewList-e_g9Zmbu.js → ViewList-Cm-dAQhY.js} +1 -1
  42. package/dist/assets/actions-Bi_LOjPn.js +1 -0
  43. package/dist/assets/actions-DMSeOF_9.js +11 -0
  44. package/dist/assets/{agreement-CvcGSLJB.js → agreement-DPo8tjJ3.js} +6 -6
  45. package/dist/assets/api-DQe-yphm.js +1 -0
  46. package/dist/assets/app-avatar-CF6TIYj9.js +1 -0
  47. package/dist/assets/{audit-logs-DPElXT2k.js → audit-logs-DK4wA_bl.js} +1 -1
  48. package/dist/assets/blocklet-BJt-raxF.js +1 -0
  49. package/dist/assets/{brace-fold.es-CXHeYjf1.js → brace-fold.es-DwWLXH4V.js} +1 -1
  50. package/dist/assets/bundle-avatar-B6arcSZZ.js +1 -0
  51. package/dist/assets/{chart-B4W7fRqI.js → chart-DVdOH_wE.js} +1 -1
  52. package/dist/assets/{click-to-copy-6L_LfYIl.js → click-to-copy-BwGLfwQv.js} +1 -1
  53. package/dist/assets/{closebrackets.es-ZZ8LeVnj.js → closebrackets.es-piHSryNk.js} +1 -1
  54. package/dist/assets/{codemirror.es-CF4ao-W3.js → codemirror.es-BX7gc_SI.js} +1 -1
  55. package/dist/assets/{comment.es-DQ_cLmdb.js → comment.es-kfTcaTaN.js} +1 -1
  56. package/dist/assets/{config-navigation-CkEBHj2r.js → config-navigation-BjBcMzix.js} +5 -5
  57. package/dist/assets/{delete-confirm-BN8gy06y.js → delete-confirm-B6Tu_cjp.js} +1 -1
  58. package/dist/assets/{detail-CP83_tPj.js → detail-DXun71hQ.js} +3 -3
  59. package/dist/assets/{dialog.es-DExnqR6t.js → dialog.es-qczXxs5i.js} +1 -1
  60. package/dist/assets/{download-DKskcy43.js → download-hCU_NL5Y.js} +1 -1
  61. package/dist/assets/{foldgutter.es-BRAMSNxp.js → foldgutter.es-CNjZdGfG.js} +1 -1
  62. package/dist/assets/getValidReactChildren-Bfzg_2yP.js +1 -0
  63. package/dist/assets/{hint.es-6G79xByO.js → hint.es-BcTOFmVv.js} +1 -1
  64. package/dist/assets/{hint.es2-Baw04wRx.js → hint.es2-Po_QXCs2.js} +1 -1
  65. package/dist/assets/{iframe-CpnjA8zm.js → iframe-D60s0j4M.js} +1 -1
  66. package/dist/assets/{index-B2cmqIK_.js → index--pVRVvBB.js} +1 -1
  67. package/dist/assets/{index-BIJwoRQp.js → index--tmgIfny.js} +1 -1
  68. package/dist/assets/{index-DQvie1Xo.js → index-20iGb6mA.js} +1 -1
  69. package/dist/assets/index-5ep8c_KG.js +54 -0
  70. package/dist/assets/{index-COF37GzL.js → index-B6BXxNti.js} +8 -8
  71. package/dist/assets/{index-D0qCsQ_X.js → index-BOVEdIid.js} +1 -1
  72. package/dist/assets/{index-Bj-A_LO-.js → index-B_G8iSj9.js} +1 -1
  73. package/dist/assets/{index-DOvGlVxX.js → index-BlJ5mRs4.js} +11 -11
  74. package/dist/assets/index-BpaAmbjH.js +278 -0
  75. package/dist/assets/{index-brs4Ovtr.js → index-BqZEyDkY.js} +1 -1
  76. package/dist/assets/{index-D3_95_AQ.js → index-By48hREf.js} +1 -1
  77. package/dist/assets/{index-CJBXTfA_.js → index-C2D98lgI.js} +32 -32
  78. package/dist/assets/{index-DcAqvRRT.js → index-C2qpMC0j.js} +1 -1
  79. package/dist/assets/index-CHD6Sawv.js +1 -0
  80. package/dist/assets/{index-XomN73iI.js → index-CJQiOTRD.js} +1 -1
  81. package/dist/assets/{index-BWxquNjq.js → index-CLxOAjUq.js} +1 -1
  82. package/dist/assets/{index-OpPbc3XM.js → index-CS1WMiVI.js} +11 -11
  83. package/dist/assets/{index-DH_YItOr.js → index-CSHzjJLI.js} +1 -1
  84. package/dist/assets/{index-aeB_hGnn.js → index-CYa2z0tY.js} +1 -1
  85. package/dist/assets/{index-DM-kSqOV.js → index-CfMrG-6m.js} +1 -1
  86. package/dist/assets/index-CgFNSj9q.js +1 -0
  87. package/dist/assets/index-CjoxtNQO.js +1 -0
  88. package/dist/assets/{index-BBsadaJh.js → index-CjpSyZA2.js} +4 -4
  89. package/dist/assets/index-ClJrGzyV.js +1 -0
  90. package/dist/assets/index-CtJUE_Ce.js +16 -0
  91. package/dist/assets/{index-WT4dVA5f.js → index-CuSKWisM.js} +1 -1
  92. package/dist/assets/{index-DYG5Tovq.js → index-D5mvFHwK.js} +1 -1
  93. package/dist/assets/{index-Dz1ahtjo.js → index-D6BTN5bJ.js} +1 -1
  94. package/dist/assets/{index-I6_9XQww.js → index-D79trrES.js} +1 -1
  95. package/dist/assets/{index-CIsUZHl3.js → index-D7CruCrK.js} +3 -3
  96. package/dist/assets/{index-D0y4Peo7.js → index-DS0UcZlk.js} +4 -4
  97. package/dist/assets/{index-B6T71Xra.js → index-DWoEF0Xz.js} +1 -1
  98. package/dist/assets/{index-DDVZbDc5.js → index-DZMLm25q.js} +7 -7
  99. package/dist/assets/index-Dpr1-GCJ.js +2493 -0
  100. package/dist/assets/{index-CS1P34PK.js → index-Dv0PfLaH.js} +1 -1
  101. package/dist/assets/{index-DTCh76Oq.js → index-FuyWc2kY.js} +12 -9
  102. package/dist/assets/{index-CB51-nwP.js → index-G0ifYRE5.js} +1 -1
  103. package/dist/assets/{index-mFd06l0F.js → index-Q8ecyTb-.js} +1 -1
  104. package/dist/assets/{index-Dylb0qYR.js → index-T3bFNwLt.js} +1 -1
  105. package/dist/assets/{index-2gGHhy3B.js → index-pZ4wuW0n.js} +1 -1
  106. package/dist/assets/{index-C3f4JgKQ.js → index-p_USl--w.js} +12 -12
  107. package/dist/assets/{index-Cse3dDDG.js → index-rBCOxvDw.js} +1 -1
  108. package/dist/assets/{index-DVd2dq8l.js → index-rYvrv8TX.js} +1 -1
  109. package/dist/assets/{index-DgFCpT_-.js → index-wtjGA_La.js} +5 -5
  110. package/dist/assets/{index.es-D1k5M1E2.js → index.es-BQGldbXt.js} +1 -1
  111. package/dist/assets/{index.esm-NzqlBaFf.js → index.esm-DqRgonGB.js} +1 -1
  112. package/dist/assets/{info-addon.es-D28Gve7b.js → info-addon.es-CYKOi7kz.js} +1 -1
  113. package/dist/assets/{info.es-BHx5fgaf.js → info.es-CKNL-yym.js} +1 -1
  114. package/dist/assets/{install-from-url-D913MaCZ.js → install-from-url-DPfj2cnI.js} +1 -1
  115. package/dist/assets/{invitation-DSwZ-Xej.js → invitation-BY43eo5D.js} +4 -4
  116. package/dist/assets/{is-path-prefix-equal-ufTBNRSJ.js → is-path-prefix-equal-OAOH-qOd.js} +1 -1
  117. package/dist/assets/isEqual-C32HztcX.js +1 -0
  118. package/dist/assets/{item-B7ZSMqn6.js → item-CDyVRhvg.js} +26 -26
  119. package/dist/assets/{javascript.es-WSUko8sV.js → javascript.es-BYVV5293.js} +1 -1
  120. package/dist/assets/{jump-to-line.es-CcgyMzYU.js → jump-to-line.es-jsNifFMh.js} +1 -1
  121. package/dist/assets/{jump.es-dMMEnQpp.js → jump.es-BzHWkDXH.js} +1 -1
  122. package/dist/assets/{line-VZzxMXH1.js → line-BZys0zer.js} +4 -4
  123. package/dist/assets/{lint.es-BJtFL-R1.js → lint.es-BFWMqOv1.js} +1 -1
  124. package/dist/assets/{lint.es2-8JV00Yve.js → lint.es2-CUt2AauZ.js} +1 -1
  125. package/dist/assets/{lint.es3-1yXUm-RP.js → lint.es3-di_bUcOb.js} +1 -1
  126. package/dist/assets/{list-header-DwVsFEjc.js → list-header-d25I2byh.js} +1 -1
  127. package/dist/assets/{log-BpKaLgPW.js → log-DTxt_dGq.js} +1 -1
  128. package/dist/assets/{lottie-O2tV-OjZ.js → lottie-CVFkVbsZ.js} +1 -1
  129. package/dist/assets/{matchbrackets.es-rEntxSn4.js → matchbrackets.es-DVkRqCgH.js} +1 -1
  130. package/dist/assets/{memory-GChDLCy_.js → memory-Bv9qf5X_.js} +1 -1
  131. package/dist/assets/{mode.es-BR84FRL3.js → mode.es-CifbNh02.js} +1 -1
  132. package/dist/assets/{mode.es2-C9o9JxCy.js → mode.es2-cIWGTWZh.js} +1 -1
  133. package/dist/assets/{mode.es3-hEzwa8oI.js → mode.es3-aQZkTGg6.js} +1 -1
  134. package/dist/assets/{onlineParser.es-bjnhX9oL.js → onlineParser.es-DLUHNAdN.js} +1 -1
  135. package/dist/assets/overview-6t6Ij2OO.js +26 -0
  136. package/dist/assets/{react-D74HYKcx.js → react-Rgfin0TQ.js} +3 -3
  137. package/dist/assets/{redux-AeaWrwCk.js → redux-I4eB06Ek.js} +1 -1
  138. package/dist/assets/{resource-dialog-RnJtI7_o.js → resource-dialog-BqDlfetI.js} +2 -2
  139. package/dist/assets/{runtime-DfYA5FiE.js → runtime-KPnZVG0c.js} +1 -1
  140. package/dist/assets/{search.es-BxNdUYNg.js → search.es-BBE6mbEs.js} +1 -1
  141. package/dist/assets/{searchcursor.es-s8a8A3Ii.js → searchcursor.es-BijniVLl.js} +1 -1
  142. package/dist/assets/service-9ctjdI1h.js +1 -0
  143. package/dist/assets/{shorten-label-pU8ae-Oh.js → shorten-label-Io_PRP3C.js} +1 -1
  144. package/dist/assets/{show-hint.es-B1JGf57k.js → show-hint.es-DS-7hlNh.js} +1 -1
  145. package/dist/assets/{slicedToArray-C1UbO-hj.js → slicedToArray-BXSVsBoG.js} +1 -1
  146. package/dist/assets/{spaces-2O-5X4yt.js → spaces-DxJMOXk2.js} +1 -1
  147. package/dist/assets/{sublime.es-CiN5FIO2.js → sublime.es-7jzC1I8A.js} +1 -1
  148. package/dist/assets/{switch-control-Dh1twa_3.js → switch-control-BemP3Qoi.js} +1 -1
  149. package/dist/assets/{table-icons-BmuX7Xai.js → table-icons-D4d7sHXC.js} +9 -9
  150. package/dist/assets/{tag-BgAeiRXM.js → tag-DJbcwSVc.js} +1 -1
  151. package/dist/assets/{team-DGUd51ZP.js → team-FBszwXwa.js} +1 -1
  152. package/dist/assets/toUpper-DcVgFeb6.js +1 -0
  153. package/dist/assets/{traffic-BEhPBbjp.js → traffic-IVSZlM0h.js} +6 -6
  154. package/dist/assets/{url-evaluation-Cw18Tjx5.js → url-evaluation-D7EkdGbI.js} +2 -2
  155. package/dist/assets/{url-join-Di_BFQmE.js → url-join-Bw5bTuVj.js} +1 -1
  156. package/dist/assets/{use-blocklet-info-for-connect-did-spaces-CgjVAwmg.js → use-blocklet-info-for-connect-did-spaces-D16GfTTc.js} +1 -1
  157. package/dist/assets/{useLocalStorage-FbxxP1zi.js → useLocalStorage-HB6kerLO.js} +1 -1
  158. package/dist/assets/{util-DWgJMgY9.js → util-IfcYVLEi.js} +1 -1
  159. package/dist/assets/{wait-container-D5DZGw_l.js → wait-container-c5_W7fTC.js} +1 -1
  160. package/dist/assets/{withStyles-D9qnQfcC.js → withStyles-C51kZpfM.js} +1 -1
  161. package/dist/assets/{wrap-locale-CDqxNJXh.js → wrap-locale-CTfg_3mB.js} +1 -1
  162. package/dist/index.html +1 -1
  163. package/dist/service-worker.js +1 -1
  164. package/package.json +1 -1
  165. package/dist/assets/Delete-BTd8aIqu.js +0 -1
  166. package/dist/assets/DeleteOutline-CT39B0th.js +0 -1
  167. package/dist/assets/TextField-udFGOQyD.js +0 -1
  168. package/dist/assets/actions-BWX_qXJD.js +0 -11
  169. package/dist/assets/actions-e3525553.js +0 -1
  170. package/dist/assets/api-DeLIbQas.js +0 -1
  171. package/dist/assets/app-avatar-CFWpqff1.js +0 -1
  172. package/dist/assets/blocklet-BBUrtnew.js +0 -1
  173. package/dist/assets/bundle-avatar-DEQzPsHD.js +0 -1
  174. package/dist/assets/getValidReactChildren-DItgry09.js +0 -1
  175. package/dist/assets/index-BdNyli-L.js +0 -16
  176. package/dist/assets/index-CBhH59N7.js +0 -2
  177. package/dist/assets/index-CIh5WVdy.js +0 -54
  178. package/dist/assets/index-Ca8SBrNy.js +0 -1
  179. package/dist/assets/index-DT3eBYfa.js +0 -1
  180. package/dist/assets/index-DTt6OFJv.js +0 -1
  181. package/dist/assets/index-DW_sEbOX.js +0 -2491
  182. package/dist/assets/index-DwL4aLvY.js +0 -278
  183. package/dist/assets/index-KGG0_6hI.js +0 -1
  184. package/dist/assets/isEqual-vbSrcyPi.js +0 -1
  185. package/dist/assets/overview-y9hXmNWR.js +0 -23
  186. package/dist/assets/service-CFkt34Sc.js +0 -1
  187. package/dist/assets/toUpper-BSJ4Soan.js +0 -1
@@ -1 +1 @@
1
- import{r as E,q as j,z as I,j as e,V as W,C as k,ct as T,O as v,x as L,A as h,F as N,u as R,y as S,am as U,ae as b}from"./index-DW_sEbOX.js";import{w as F}from"./wrap-locale-CDqxNJXh.js";function _({SessionContext:t,webWalletUrl:a,onSuccess:c}){var g,u;const{api:o,session:n}=E.useContext(t),{t:s,locale:m}=j(),w=I(),{searchParams:l}=new URL(window.location.href),d=l.get("redirect"),P=async(r,C)=>{c(r,C),await n.refresh(),h.success(s("exchangePassport.success")),setTimeout(()=>{if(d){const i=decodeURIComponent(d);i.startsWith(N.WELLKNOWN_SERVICE_PATH_PREFIX)?w(i,{replace:!0}):window.location=i}else window.location=window.env.pathPrefix||window.env.apiPrefix||"/"},3e3)},f=r=>{h.error(r.message)},x={},p=l.get("componentId");return p&&(x.componentId=p),n.loading?e.jsx(W,{children:e.jsx(k,{})}):e.jsx(T,{did:((g=window==null?void 0:window.blocklet)==null?void 0:g.appPid)||((u=window==null?void 0:window.env)==null?void 0:u.appPid),children:e.jsx(v,{sx:{width:"560px",maxWidth:"100%",height:"100%"},children:e.jsx(L,{className:"connect",action:"exchange-passport",checkFn:o.get,checkTimeout:10*60*1e3,webWalletUrl:a,onSuccess:P,onError:f,locale:m,messages:{title:s("exchangePassport.dialog.title"),scan:s("exchangePassport.dialog.scan"),confirm:s("exchangePassport.dialog.confirm"),success:s("exchangePassport.dialog.success")},extraParams:x,extraContent:null})})})}const y=F(_);function O(){const{info:t}=R(),a=S(t),c=(o,n)=>{o.sessionToken&&b(n(o.sessionToken))};return e.jsx(y,{SessionContext:U,webWalletUrl:a,onSuccess:c})}export{O as default};
1
+ import{r as E,q as j,z as I,j as e,V as W,C as k,cs as T,O as v,x as L,A as h,F as N,u as R,y as S,am as U,ae as b}from"./index-Dpr1-GCJ.js";import{w as F}from"./wrap-locale-CTfg_3mB.js";function _({SessionContext:t,webWalletUrl:a,onSuccess:c}){var g,u;const{api:o,session:n}=E.useContext(t),{t:s,locale:m}=j(),w=I(),{searchParams:l}=new URL(window.location.href),d=l.get("redirect"),P=async(r,C)=>{c(r,C),await n.refresh(),h.success(s("exchangePassport.success")),setTimeout(()=>{if(d){const i=decodeURIComponent(d);i.startsWith(N.WELLKNOWN_SERVICE_PATH_PREFIX)?w(i,{replace:!0}):window.location=i}else window.location=window.env.pathPrefix||window.env.apiPrefix||"/"},3e3)},f=r=>{h.error(r.message)},x={},p=l.get("componentId");return p&&(x.componentId=p),n.loading?e.jsx(W,{children:e.jsx(k,{})}):e.jsx(T,{did:((g=window==null?void 0:window.blocklet)==null?void 0:g.appPid)||((u=window==null?void 0:window.env)==null?void 0:u.appPid),children:e.jsx(v,{sx:{width:"560px",maxWidth:"100%",height:"100%"},children:e.jsx(L,{className:"connect",action:"exchange-passport",checkFn:o.get,checkTimeout:10*60*1e3,webWalletUrl:a,onSuccess:P,onError:f,locale:m,messages:{title:s("exchangePassport.dialog.title"),scan:s("exchangePassport.dialog.scan"),confirm:s("exchangePassport.dialog.confirm"),success:s("exchangePassport.dialog.success")},extraParams:x,extraContent:null})})})}const y=F(_);function O(){const{info:t}=R(),a=S(t),c=(o,n)=>{o.sessionToken&&b(n(o.sessionToken))};return e.jsx(y,{SessionContext:U,webWalletUrl:a,onSuccess:c})}export{O as default};
@@ -1,4 +1,4 @@
1
- import{bM as zo,j as e,aK as qt,aL as _t,q as z,O as y,ax as ve,P as r,A,bn as J,r as f,f as Ce,bq as Je,b as X,M as O,J as dt,U as Mt,ce as Oe,n as F,K as Z,h3 as Vo,bI as Me,aY as ue,aX as gt,aC as Ft,a2 as $,D as xt,F as D,aP as qo,Y as Ke,$ as Wn,b1 as _o,g3 as Wo,g4 as Ho,C as re,fs as Yo,y as po,av as pt,a1 as we,x as Gt,hT as Jo,hU as Ko,B as ne,bd as uo,H as Wt,hV as Qo,m as ee,a3 as Zo,eT as Xo,W as mo,Z as fo,ak as $o,w as es,Q as He,V as ts,hW as ho,S as ge,az as ns,aA as os,aB as ss,i as yt,aN as rs,cE as is,bi as as,hu as ls,hX as cs,ay as Hn,cC as ds,ad as Fe,aJ as go,bK as Ht,cg as ps,hY as us,b8 as ms,z as fs,aZ as zt,T as hs,aQ as Ye,at as Nt,dN as gs,br as xo,aF as xs,ge as Pe,e4 as ys,hZ as Cs,gC as Yn,h_ as Jn,gE as Kn,a_ as js,G as at,gG as vs,bJ as Ss}from"./index-DW_sEbOX.js";import{d as bs}from"./Add-9p89cr51.js";import{a as Rs,R as ct,F as Es,L as Ts,d as Yt,b as Jt}from"./line-VZzxMXH1.js";import{C as ws,A as Ps,d as Is}from"./agreement-CvcGSLJB.js";import{E as ks}from"./index-DYG5Tovq.js";import{b as Us,a as Ds,c as Bs,u as Kt,e as Ns}from"./actions-BWX_qXJD.js";import{S as As}from"./switch-control-Dh1twa_3.js";import{u as Ls}from"./detail-CP83_tPj.js";import{d as yo}from"./Edit-CWojktHH.js";import{T as Os}from"./index-DcAqvRRT.js";import{T as Ms,M as Fs,t as Gs}from"./table-icons-BmuX7Xai.js";import{C as Qn}from"./click-to-copy-6L_LfYIl.js";import{T as K}from"./TextField-udFGOQyD.js";import{d as Qt}from"./Link-DbSs28Vg.js";import{c as zs,C as Vs,a as qs,b as _s,D as Ws,A as Hs,B as Ys,d as Js,S as Ks}from"./item-B7ZSMqn6.js";import{u as Qs,a as Zs,P as Co,L as Zn,A as Xs,S as $s}from"./index-Bj-A_LO-.js";import{u as jo,t as er}from"./toUpper-BSJ4Soan.js";import{u as ie}from"./blocklet-BBUrtnew.js";import{c as tr,d as nr,a as or,e as sr,f as rr,g as Xn,h as ir,i as $n}from"./spaces-2O-5X4yt.js";import{d as ar}from"./EditIcon-ugJwCH0S.js";import{d as lr}from"./Done-DycYtcxi.js";import{C as cr}from"./Google-Bpr-eboG.js";import{I as dr,B as pr}from"./install-from-url-D913MaCZ.js";import{a as eo}from"./api-DeLIbQas.js";import{v as vo,a as ut}from"./util-DWgJMgY9.js";import{P as ur,u as mr}from"./use-blocklet-info-for-connect-did-spaces-CgjVAwmg.js";import{D as fr}from"./DeleteOutline-CT39B0th.js";import{S as to}from"./index-BdNyli-L.js";import{d as hr}from"./ArrowDropDown-PUGycbah.js";import{_ as gr}from"./useLocalStorage-FbxxP1zi.js";import{d as xr}from"./LockIcon-QS29DL1o.js";import{d as Ct}from"./Delete-BTd8aIqu.js";import{d as So}from"./Launch-C4_ktc4w.js";import{C as yr}from"./delete-confirm-BN8gy06y.js";import{W as Qe}from"./tag-BgAeiRXM.js";import{d as Cr}from"./is-path-prefix-equal-ufTBNRSJ.js";import{R as jr,b as no,B as bo}from"./url-evaluation-Cw18Tjx5.js";import{B as vr}from"./bundle-avatar-DEQzPsHD.js";import{A as Ro}from"./actions-e3525553.js";import{I as At}from"./index-DH_YItOr.js";import{a as Sr}from"./index-BIJwoRQp.js";import{u as br}from"./team-DGUd51ZP.js";import"./ButtonGroup-qjpoNO9j.js";import"./getValidReactChildren-DItgry09.js";import"./index-BWxquNjq.js";import"./index-WT4dVA5f.js";import"./url-join-Di_BFQmE.js";import"./MoreVert-YMJ5zQGi.js";import"./app-avatar-CFWpqff1.js";import"./Breadcrumbs-YbVhGF74.js";import"./FilterList-Cv0uknPg.js";import"./Select-D_jjFrx2.js";import"./InputLabel-CdP2Vrv8.js";import"./LastPage-BTLBin5_.js";import"./slicedToArray-C1UbO-hj.js";import"./Search-CnmiZ7r5.js";import"./ChevronLeft-Bvm6nyLn.js";import"./ChevronRight-pbRslwzZ.js";import"./DeleteOutline-DkbzMi-O.js";import"./redux-AeaWrwCk.js";import"./Skeleton-DMU-9YHS.js";import"./InputAdornment-GAXpW_Pc.js";import"./memoize-one.esm-BdPwpGay.js";import"./index-BBsadaJh.js";import"./index-ZG7jWpak.js";import"./preact.module-B1z5cdvs.js";import"./Close-CRs5nN-9.js";import"./lottie-O2tV-OjZ.js";import"./Stepper-BLioo72i.js";import"./index-2gGHhy3B.js";import"./shorten-label-pU8ae-Oh.js";const Rr=zo(e.jsx("path",{d:"M14.17 5 19 9.83V19H5V5zm0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V9.83c0-.53-.21-1.04-.59-1.41l-4.83-4.83c-.37-.38-.88-.59-1.41-.59M7 15h10v2H7zm0-4h10v2H7zm0-4h7v2H7z"}),"TextSnippetOutlined");var Zt={},Er=_t;Object.defineProperty(Zt,"__esModule",{value:!0});var Eo=Zt.default=void 0,Tr=Er(qt()),wr=e;Eo=Zt.default=(0,Tr.default)((0,wr.jsx)("path",{d:"M21 10.12h-6.78l2.74-2.82c-2.73-2.7-7.15-2.8-9.88-.1-2.73 2.71-2.73 7.08 0 9.79s7.15 2.71 9.88 0C18.32 15.65 19 14.08 19 12.1h2c0 1.98-.88 4.55-2.64 6.29-3.51 3.48-9.21 3.48-12.72 0-3.5-3.47-3.53-9.11-.02-12.58s9.14-3.47 12.65 0L21 3zM12.5 8v4.25l3.5 2.08-.72 1.21L11 13V8z"}),"Update");function Xt({children:t,...o}){const{t:s}=z(),{updateAutoCheckUpdate:a,autoCheckUpdate:n}=Ls(),i=async()=>{try{const l=!(n!=null&&n.enabled);await a({enabled:l}),A.success(s(l?"storage.spaces.autoCheckUpdate.enabled":"storage.spaces.autoCheckUpdate.disabled"))}catch(l){A.error(l.message)}},m=!!(n!=null&&n.enabled);return e.jsxs(y,{display:"flex",flexDirection:"row",alignItems:"center",children:[t,e.jsx(ve,{title:s("storage.spaces.autoCheckUpdate.title"),arrow:!0,placement:"right",children:e.jsx("div",{children:e.jsx(As,{checked:m,onChange:i,name:"enableWelcomePage",style:{...o.style,zoom:.8}})})})]})}Xt.propTypes={children:r.any};Xt.defaultProps={children:null};const Pr=(t,o)=>{let{description:s}=t;return(Object.values(X.CHAIN_PROP_MAP).includes(t.key)||O.isEnvShareable(t))&&(s?s=`${s} (${o("blocklet.config.sharedToAllComponents")})`:s=o("blocklet.config.sharedToAllComponents")),s&&e.jsx("div",{style:{marginLeft:12},children:s})},Lt=(t,o,s=[])=>!(s!=null&&s.length)&&!t.custom&&!["CHAIN_ID","CHAIN_HOST"].includes(t.key)&&!o.meta.environments.find(a=>a.name===t.key)&&o.children.every(a=>!a.meta.environments.find(n=>n.name===t.key))?!0:t.custom;function mt({blocklet:t,ancestors:o}){const s=J(),{inService:a}=s,{t:n}=f.useContext(Ce),i=[...o.map(c=>c.meta.did),t.meta.did],m=()=>A.success(n("blocklet.config.changedTip")),l=c=>Lt(c,t,o);if(Je(t.status)||t.status==="unknown"&&Je(t.status))return null;const u=async c=>{if(!c.key.trim()||!c.value.trim()){A.error(n("blocklet.config.environment.keyValueRequired"));return}if(c.key.startsWith("BLOCKLET_")||c.key.startsWith("COMPONENT_")){A.error(n("blocklet.config.environment.invalidKey"));return}c.custom=!0;try{const v=await s.api.configBlocklet({input:{did:i,configs:[c]}});m(v.blocklet)}catch(v){A.error(Z(v))}},h=async(c,v)=>{if(c.required&&(!c.key.trim()||!c.value.trim())){A.error(n("blocklet.config.environment.keyValueRequired"));return}if(c.key.startsWith("BLOCKLET_")&&!X.BLOCKLET_CONFIGURABLE_KEY[c.key]){A.error(n("blocklet.config.environment.invalidKey"));return}if(c.key===X.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_CLUSTER_SIZE){const T=Vo(c);if(T){A.error(T);return}}const j=[{...c,value:c.secure&&c.value==="__encrypted__"?"":c.value}];if(c.key!==v.key){if(!Lt(c,t,o)){A.error("Only key of custom env can be changed");return}j.push({key:v.key,custom:!0})}try{const T=await s.api.configBlocklet({input:{did:i,configs:j}});m(T.blocklet)}catch(T){A.error(Z(T))}},g=async c=>{if(c.required){A.error(n("blocklet.config.environment.deleteForbidden"));return}if(!Lt(c,t,o)){A.error("Only key of custom env can be changed");return}try{const v=await s.api.configBlocklet({input:{did:i,configs:[{key:c.key,custom:!0}]}});m(v.blocklet)}catch(v){A.error(Z(v))}},p=(t.configs||[]).filter(c=>!X.BLOCKLET_CONFIGURABLE_KEY[c.key]),S=O.getSharedConfigObj(o[0],t),d=O.getComponentMissingConfigs(t,o[0]),b=p.map(c=>({...c,value:Object.values(X.CHAIN_PROP_MAP).includes(c.key)&&Object.keys(S).includes(c.key)?S[c.key]:S[c.key]||c.value})),C=b.some(c=>c.key&&c.key.startsWith("BWA_")),x={onRowAdd:u,onRowUpdate:h,onRowDelete:g,isDeletable:l},R=()=>[{title:n("common.key"),field:"key",initialEditValue:"Key",width:"30%",render:c=>e.jsx(Qn,{value:c.value,style:{color:c.required&&!c.value?"#ff4436":"#222222",fontWeight:c.required?"bold":"normal"},children:c.key}),editComponent:c=>{const{value:v,rowData:j,onChange:T}=c;return e.jsx(oo,{children:e.jsx(K,{fullWidth:!0,size:"small",disabled:l(j)===!1,value:v,onChange:I=>T(I.target.value),variant:"outlined",label:"Key",placeholder:n("blocklet.config.environment.key"),margin:"dense",autoFocus:!0})})}},{title:n("common.value"),field:"value",initialEditValue:"Value",width:"calc((100% - (96px + 30%)) / 1)",render:c=>c.value?c.secure?"******":e.jsx(Qn,{unstyled:!0,value:c.value,style:{wordBreak:"break-all"},children:c.value}):null,editComponent:c=>{const{value:v,rowData:j,onChange:T}=c;return e.jsxs(oo,{children:[e.jsx(K,{fullWidth:!0,size:"small",value:v==="__encrypted__"?"":v,onChange:I=>T(I.target.value),variant:"outlined",label:n("common.value"),placeholder:n("blocklet.config.environment.value"),margin:"dense",autoFocus:!0}),Pr(j,n)]})}}];return e.jsxs(Ir,{children:[!!d.length&&e.jsx(dt,{severity:"error",style:{marginTop:24},children:n("blocklet.config.missingRequired")}),C&&e.jsx(dt,{severity:"info",children:n("blocklet.config.environment.tip")}),e.jsx(Mt,{permission:a?"":"mutate_blocklets",role:a?Oe:[],children:c=>e.jsx(Ms,{className:"config-table",children:e.jsx(Fs,{title:e.jsx("h4",{children:n("common.environment")}),columns:R(),icons:{...Us,...Gs},options:{emptyRowsWhenPaging:!1,actionsColumnIndex:-1,tableLayout:"auto",maxBodyHeight:"100%",paging:!1,search:!1},localization:{header:{actions:n("common.actions")},body:{emptyDataSourceMessage:n("common.noData")}},data:b,editable:c?x:{}})})})]})}mt.propTypes={blocklet:r.object.isRequired,ancestors:r.array};mt.defaultProps={ancestors:[]};const Ir=F.div`
1
+ import{bL as zo,j as e,aK as Vt,aL as _t,q as z,O as y,ax as ve,P as r,A,bm as J,r as f,f as Ce,bp as Je,b as X,M as O,J as dt,U as Mt,cd as Oe,n as F,K as Z,gO as qo,bH as Me,aY as ue,aX as gt,aC as Ft,a2 as $,D as xt,F as D,aP as Vo,Y as Ke,$ as Wn,b1 as _o,fO as Wo,fP as Ho,C as re,fa as Yo,y as po,av as pt,a1 as we,x as Gt,hC as Jo,hD as Ko,B as ne,bc as uo,H as Wt,hE as Qo,m as ee,a3 as Zo,eB as Xo,W as mo,Z as fo,ak as $o,w as es,Q as He,V as ts,hF as ho,S as ge,az as ns,aA as os,aB as ss,i as yt,aN as rs,cF as is,bh as as,hd as ls,hG as cs,ay as Hn,cD as ds,ad as Fe,aJ as go,bJ as Ht,cf as ps,hH as us,b7 as ms,z as fs,aZ as zt,T as hs,aQ as Ye,at as Nt,dG as gs,bq as xo,aF as xs,fX as Pe,dO as ys,hI as Cs,gl as Yn,hJ as Jn,gn as Kn,a_ as js,G as at,gp as vs,bI as Ss}from"./index-Dpr1-GCJ.js";import{d as bs}from"./Add-3VAJlzWu.js";import{a as Rs,R as ct,F as Es,L as Ts,d as Yt,b as Jt}from"./line-BZys0zer.js";import{C as ws,A as Ps,d as Is}from"./agreement-DPo8tjJ3.js";import{E as ks}from"./index-D5mvFHwK.js";import{b as Us,a as Ds,c as Bs,u as Kt,R as Ns}from"./actions-DMSeOF_9.js";import{S as As}from"./switch-control-BemP3Qoi.js";import{u as Ls}from"./detail-DXun71hQ.js";import{d as yo}from"./Edit-UiTtw7ED.js";import{T as Os}from"./index-C2qpMC0j.js";import{T as Ms,M as Fs,t as Gs}from"./table-icons-D4d7sHXC.js";import{C as Qn}from"./click-to-copy-BwGLfwQv.js";import{T as K}from"./TextField-BKw9m9nx.js";import{d as Qt}from"./Link-Bz3bTK5Z.js";import{c as zs,C as qs,a as Vs,b as _s,D as Ws,A as Hs,B as Ys,d as Js,S as Ks}from"./item-CDyVRhvg.js";import{u as Qs,a as Zs,P as Co,L as Zn,A as Xs,S as $s}from"./index-B_G8iSj9.js";import{u as jo,t as er}from"./toUpper-DcVgFeb6.js";import{u as ie}from"./blocklet-BJt-raxF.js";import{c as tr,d as nr,a as or,e as sr,f as rr,g as Xn,h as ir,i as $n}from"./spaces-DxJMOXk2.js";import{d as ar}from"./EditIcon-D-Dhs8bv.js";import{d as lr}from"./Done-C6j7V5dY.js";import{C as cr}from"./Google-U8HcYuII.js";import{I as dr,B as pr}from"./install-from-url-DPfj2cnI.js";import{a as eo}from"./api-DQe-yphm.js";import{v as vo,a as ut}from"./util-IfcYVLEi.js";import{P as ur,u as mr}from"./use-blocklet-info-for-connect-did-spaces-D16GfTTc.js";import{D as fr}from"./DeleteOutline-C3yNjgmc.js";import{S as to}from"./index-CtJUE_Ce.js";import{d as hr}from"./ArrowDropDown-DehQx6JH.js";import{_ as gr}from"./useLocalStorage-HB6kerLO.js";import{d as xr}from"./LockIcon-C86uaqg6.js";import{d as Ct}from"./Delete-B0dIMgAO.js";import{d as So}from"./Launch-CstW8TMa.js";import{C as yr}from"./delete-confirm-B6Tu_cjp.js";import{W as Qe}from"./tag-DJbcwSVc.js";import{d as Cr}from"./is-path-prefix-equal-OAOH-qOd.js";import{R as jr,b as no,B as bo}from"./url-evaluation-D7EkdGbI.js";import{B as vr}from"./bundle-avatar-B6arcSZZ.js";import{A as Ro}from"./actions-Bi_LOjPn.js";import{I as At}from"./index-CSHzjJLI.js";import{a as Sr}from"./index--tmgIfny.js";import{u as br}from"./team-FBszwXwa.js";import"./ButtonGroup-4dUIbekw.js";import"./getValidReactChildren-Bfzg_2yP.js";import"./index-CLxOAjUq.js";import"./index-CuSKWisM.js";import"./url-join-Bw5bTuVj.js";import"./MoreVert-BB46cKFe.js";import"./app-avatar-CF6TIYj9.js";import"./Breadcrumbs-B-3iNfJV.js";import"./FilterList-BfkrQFl0.js";import"./Select-BioDM9Sd.js";import"./InputLabel-Dyg2n4KM.js";import"./LastPage-g6ViU_79.js";import"./slicedToArray-BXSVsBoG.js";import"./Search-rqHI-c1S.js";import"./ChevronLeft-BovE6bSi.js";import"./ChevronRight-COT0_GJ0.js";import"./DeleteOutline-BqV9pNFr.js";import"./redux-I4eB06Ek.js";import"./Skeleton-DZ26ugSB.js";import"./InputAdornment-xbC4GBmg.js";import"./memoize-one.esm-BdPwpGay.js";import"./index-CjpSyZA2.js";import"./index-ZG7jWpak.js";import"./preact.module-B1z5cdvs.js";import"./Close-DSOnajKv.js";import"./lottie-CVFkVbsZ.js";import"./Stepper-BXZWzSgf.js";import"./index-pZ4wuW0n.js";import"./ExpandMore-CBwUEwtf.js";import"./shorten-label-Io_PRP3C.js";const Rr=zo(e.jsx("path",{d:"M14.17 5 19 9.83V19H5V5zm0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V9.83c0-.53-.21-1.04-.59-1.41l-4.83-4.83c-.37-.38-.88-.59-1.41-.59M7 15h10v2H7zm0-4h10v2H7zm0-4h7v2H7z"}),"TextSnippetOutlined");var Zt={},Er=_t;Object.defineProperty(Zt,"__esModule",{value:!0});var Eo=Zt.default=void 0,Tr=Er(Vt()),wr=e;Eo=Zt.default=(0,Tr.default)((0,wr.jsx)("path",{d:"M21 10.12h-6.78l2.74-2.82c-2.73-2.7-7.15-2.8-9.88-.1-2.73 2.71-2.73 7.08 0 9.79s7.15 2.71 9.88 0C18.32 15.65 19 14.08 19 12.1h2c0 1.98-.88 4.55-2.64 6.29-3.51 3.48-9.21 3.48-12.72 0-3.5-3.47-3.53-9.11-.02-12.58s9.14-3.47 12.65 0L21 3zM12.5 8v4.25l3.5 2.08-.72 1.21L11 13V8z"}),"Update");function Xt({children:t,...o}){const{t:s}=z(),{updateAutoCheckUpdate:a,autoCheckUpdate:n}=Ls(),i=async()=>{try{const l=!(n!=null&&n.enabled);await a({enabled:l}),A.success(s(l?"storage.spaces.autoCheckUpdate.enabled":"storage.spaces.autoCheckUpdate.disabled"))}catch(l){A.error(l.message)}},m=!!(n!=null&&n.enabled);return e.jsxs(y,{display:"flex",flexDirection:"row",alignItems:"center",children:[t,e.jsx(ve,{title:s("storage.spaces.autoCheckUpdate.title"),arrow:!0,placement:"right",children:e.jsx("div",{children:e.jsx(As,{checked:m,onChange:i,name:"enableWelcomePage",style:{...o.style,zoom:.8}})})})]})}Xt.propTypes={children:r.any};Xt.defaultProps={children:null};const Pr=(t,o)=>{let{description:s}=t;return(Object.values(X.CHAIN_PROP_MAP).includes(t.key)||O.isEnvShareable(t))&&(s?s=`${s} (${o("blocklet.config.sharedToAllComponents")})`:s=o("blocklet.config.sharedToAllComponents")),s&&e.jsx("div",{style:{marginLeft:12},children:s})},Lt=(t,o,s=[])=>!(s!=null&&s.length)&&!t.custom&&!["CHAIN_ID","CHAIN_HOST"].includes(t.key)&&!o.meta.environments.find(a=>a.name===t.key)&&o.children.every(a=>!a.meta.environments.find(n=>n.name===t.key))?!0:t.custom;function mt({blocklet:t,ancestors:o}){const s=J(),{inService:a}=s,{t:n}=f.useContext(Ce),i=[...o.map(c=>c.meta.did),t.meta.did],m=()=>A.success(n("blocklet.config.changedTip")),l=c=>Lt(c,t,o);if(Je(t.status)||t.status==="unknown"&&Je(t.status))return null;const u=async c=>{if(!c.key.trim()||!c.value.trim()){A.error(n("blocklet.config.environment.keyValueRequired"));return}if(c.key.startsWith("BLOCKLET_")||c.key.startsWith("COMPONENT_")){A.error(n("blocklet.config.environment.invalidKey"));return}c.custom=!0;try{const v=await s.api.configBlocklet({input:{did:i,configs:[c]}});m(v.blocklet)}catch(v){A.error(Z(v))}},h=async(c,v)=>{if(c.required&&(!c.key.trim()||!c.value.trim())){A.error(n("blocklet.config.environment.keyValueRequired"));return}if(c.key.startsWith("BLOCKLET_")&&!X.BLOCKLET_CONFIGURABLE_KEY[c.key]){A.error(n("blocklet.config.environment.invalidKey"));return}if(c.key===X.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_CLUSTER_SIZE){const T=qo(c);if(T){A.error(T);return}}const j=[{...c,value:c.secure&&c.value==="__encrypted__"?"":c.value}];if(c.key!==v.key){if(!Lt(c,t,o)){A.error("Only key of custom env can be changed");return}j.push({key:v.key,custom:!0})}try{const T=await s.api.configBlocklet({input:{did:i,configs:j}});m(T.blocklet)}catch(T){A.error(Z(T))}},g=async c=>{if(c.required){A.error(n("blocklet.config.environment.deleteForbidden"));return}if(!Lt(c,t,o)){A.error("Only key of custom env can be changed");return}try{const v=await s.api.configBlocklet({input:{did:i,configs:[{key:c.key,custom:!0}]}});m(v.blocklet)}catch(v){A.error(Z(v))}},p=(t.configs||[]).filter(c=>!X.BLOCKLET_CONFIGURABLE_KEY[c.key]),S=O.getSharedConfigObj(o[0],t),d=O.getComponentMissingConfigs(t,o[0]),b=p.map(c=>({...c,value:Object.values(X.CHAIN_PROP_MAP).includes(c.key)&&Object.keys(S).includes(c.key)?S[c.key]:S[c.key]||c.value})),C=b.some(c=>c.key&&c.key.startsWith("BWA_")),x={onRowAdd:u,onRowUpdate:h,onRowDelete:g,isDeletable:l},R=()=>[{title:n("common.key"),field:"key",initialEditValue:"Key",width:"30%",render:c=>e.jsx(Qn,{value:c.value,style:{color:c.required&&!c.value?"#ff4436":"#222222",fontWeight:c.required?"bold":"normal"},children:c.key}),editComponent:c=>{const{value:v,rowData:j,onChange:T}=c;return e.jsx(oo,{children:e.jsx(K,{fullWidth:!0,size:"small",disabled:l(j)===!1,value:v,onChange:I=>T(I.target.value),variant:"outlined",label:"Key",placeholder:n("blocklet.config.environment.key"),margin:"dense",autoFocus:!0})})}},{title:n("common.value"),field:"value",initialEditValue:"Value",width:"calc((100% - (96px + 30%)) / 1)",render:c=>c.value?c.secure?"******":e.jsx(Qn,{unstyled:!0,value:c.value,style:{wordBreak:"break-all"},children:c.value}):null,editComponent:c=>{const{value:v,rowData:j,onChange:T}=c;return e.jsxs(oo,{children:[e.jsx(K,{fullWidth:!0,size:"small",value:v==="__encrypted__"?"":v,onChange:I=>T(I.target.value),variant:"outlined",label:n("common.value"),placeholder:n("blocklet.config.environment.value"),margin:"dense",autoFocus:!0}),Pr(j,n)]})}}];return e.jsxs(Ir,{children:[!!d.length&&e.jsx(dt,{severity:"error",style:{marginTop:24},children:n("blocklet.config.missingRequired")}),C&&e.jsx(dt,{severity:"info",children:n("blocklet.config.environment.tip")}),e.jsx(Mt,{permission:a?"":"mutate_blocklets",role:a?Oe:[],children:c=>e.jsx(Ms,{className:"config-table",children:e.jsx(Fs,{title:e.jsx("h4",{children:n("common.environment")}),columns:R(),icons:{...Us,...Gs},options:{emptyRowsWhenPaging:!1,actionsColumnIndex:-1,tableLayout:"auto",maxBodyHeight:"100%",paging:!1,search:!1},localization:{header:{actions:n("common.actions")},body:{emptyDataSourceMessage:n("common.noData")}},data:b,editable:c?x:{}})})})]})}mt.propTypes={blocklet:r.object.isRequired,ancestors:r.array};mt.defaultProps={ancestors:[]};const Ir=F.div`
2
2
  .config-table {
3
3
  margin-bottom: 24px;
4
4
  position: relative;
@@ -63,7 +63,7 @@ import{bM as zo,j as e,aK as qt,aL as _t,q as z,O as y,ax as ve,P as r,A,bn as J
63
63
  .ux-dialog_right {
64
64
  padding-right: 20px;
65
65
  }
66
- `,{NODE_MODES:so}=D,Ar=({mode:t,previousMode:o}={})=>t===so.SERVERLESS||o===so.SERVERLESS;var To={isInServerlessMode:Ar};function Lr(){const[t,o]=f.useState(null),{blocklet:s}=ie();return f.useEffect(()=>{o(tr(s))},[s]),{storageEndpoint:t}}const wo=f.createContext({}),{Provider:Or,Consumer:Za}=wo;function $t({children:t}){const[o,s]=f.useState(!1),[a,n]=f.useState(null),{blocklet:i,actions:{refreshBlocklet:m}}=ie(),{storageEndpoint:l}=Lr(),{api:u}=J();qo(async()=>{try{if(s(!0),Wn.isEmpty(l)){n(null);return}const d=await nr(l);n(d)}catch(d){console.error(d),A.error(d.message)}finally{s(!1)}},[l]);const h=()=>{n(null),m()},g=async d=>{n(d),await p(d.endpoint),m()},p=async d=>{await u.configBlocklet({input:{did:[i.meta.did],configs:[{key:X.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_SPACE_ENDPOINT,value:d}]}}),m()};f.useEffect(()=>{async function d(){if(!a)return;const b=await or(a.endpoint,a.name),C=Wn.merge(a,{name:b});n(C)}d()},[]);const S=!!(l&&a);return e.jsx(Or,{value:{loading:o,spaceGateway:a,deleteSpaceGateway:h,updateSpaceGateway:g,storageEndpoint:l,settingStorageEndpoint:p,hasStorageEndpoint:S},children:t})}$t.propTypes={children:Ke.node.isRequired};$t.defaultProps={};function en(){return f.useContext(wo)}const tn={description:r.string,editing:r.bool,onChange:r.func,required:r.bool,value:r.any,componentProps:r.object,render:r.func,renderFormItem:r.func};function nn({editing:t,value:o,onChange:s}){const[a,n]=f.useState(!1),i=f.useRef(),m=f.useRef(o);f.useEffect(()=>{let p=null;return t&&(p=setTimeout(()=>{n(!0)},50)),()=>{clearTimeout(p)}},[t]);const l=p=>{m.current=p,s(p)},u=()=>{n(!1),s(m.current)},h=e.jsx(y,{className:"form-item-input slot",px:1,children:e.jsxs(y,{display:"flex",alignItems:"center",children:[o,o!=="auto"&&e.jsx("div",{style:{marginLeft:4,backgroundColor:o,width:"1em",height:"1em",borderRadius:"0.2em"}})]})}),g=e.jsxs(y,{display:"flex",flexGrow:1,alignItems:"center",height:"40px",onKeyDown:u,children:[e.jsx(y,{display:"flex",alignItems:"center",onClick:()=>n(!0),children:e.jsx("div",{ref:i,style:{flexShrink:0,marginLeft:"8px",backgroundColor:o,width:"32px",height:"32px",boxSizing:"border-box",borderRadius:"8px",border:"1px solid #eee",cursor:o==="auto"?"default":"pointer"}})}),e.jsx(_o,{open:a,anchorEl:i.current,onClose:()=>n(!1),anchorOrigin:{vertical:"bottom",horizontal:"center"},transformOrigin:{vertical:"top",horizontal:"center"},children:e.jsx(cr,{color:o,onChange:p=>l(p.hex)})})]});return t?g:h}nn.propTypes=tn;function on({editing:t,description:o,value:s,onChange:a,componentProps:n,...i}){const{placeholder:m}=n,l=f.useRef(s),u=g=>{g.key==="Enter"&&a(l.current,"confirm")},h=g=>{l.current=g,a(g)};return t?e.jsx(K,{style:{flex:1},fullWidth:!0,value:s,onChange:g=>{g.persist(),h(g.target.value)},autoFocus:!0,size:"small",variant:"outlined",placeholder:o||m,onKeyDown:u,...i}):e.jsx(y,{px:1,className:"form-item-input slot",children:s})}on.propTypes=tn;on.defaultProps={componentProps:{}};function sn({editing:t,value:o,onChange:s,componentProps:a,...n}){const{blocklet:i}=a,m=o==="auto"?Wo.getPassportColorFromDid(i.appDid):o;return e.jsxs(y,{display:"flex",alignItems:"center",children:[e.jsx("div",{style:{width:96,marginRight:12},dangerouslySetInnerHTML:{__html:Ho({title:"Owner",issuer:O.getDisplayName(i),issuerDid:i.appDid,ownerName:"Your Name",ownerDid:i.appDid,preferredColor:o||"auto"})}}),e.jsx(nn,{...n,editing:t,value:t?m:o,onChange:s,componentProps:a})]})}sn.propTypes={...tn,componentProps:r.shape({blocklet:r.object.isRequired}).isRequired};sn.defaultProps={};const Mr={input:on,color:nn,passport:sn,uploader:t=>e.jsx(Ts,{...t.componentProps})};function Fr(t,{editing:o=!1}){const{componentType:s="input",render:a,renderFormItem:n}=t;return o&&n?n:!o&&a?a:Mr[s==null?void 0:s.toLowerCase()]}function rn({schema:t,loading:o,value:s,defaultValue:a,onChange:n,style:i,disabled:m}){const l=Object.prototype.toString.call(s)==="[object Object]",[u,h]=f.useState(null),[g,p]=f.useState(l?s:a),S=f.useRef();function d(x,R,c){const{key:v,secure:j}=x,I=g[v]!==R,U={...g,[v]:R};I&&p(U),n({[v]:R},{allValues:U,action:c,currentItem:x}),c==="confirm"&&j&&p({...g,[v]:"__encrypted__"}),["confirm","cancel"].includes(c)?b(null):b(x)}function b(x){if(x){S.current=g[x.key],h(x);return}S.current=null,h(null)}function C(x,{editing:R=!1}){const{key:c}=x,v=l?s[c]:g[c];return v==="__encrypted__"?R?"":"******":v}return e.jsx(Gr,{className:"form",style:i,children:t==null?void 0:t.map(x=>{const{key:R,description:c,required:v,solo:j=!1,hidden:T=!1,componentProps:I={}}=x;if(T)return null;const U=!!(u&&R===u.key),L=C(x,{editing:U}),k=Fr(x,{editing:U}),M={inputProps:{"data-cy":"schema-form-item-component"},key:R,description:c,editing:U,value:L,onChange:(B,V="change")=>d(x,B,V),componentProps:I};return e.jsxs(y,{className:"form-item",children:[!j&&e.jsxs(y,{className:"form-item-label",style:{color:v&&!L?"#ff0000":"#333"},children:[c,v&&e.jsx(ct,{})]}),e.jsxs(y,{className:"form-item-body",children:[e.jsx(y,{className:"form-item-input",sx:{textAlign:j?"center":"left"},children:e.jsx(k,{...M})}),!j&&e.jsx(y,{className:"form-item-action",children:U?e.jsxs(e.Fragment,{children:[e.jsx($,{"data-cy":"schema-form-item-confirm",onClick:()=>{d(x,L,"confirm")},disabled:m||o,size:"large",children:o?e.jsx(re,{size:24}):e.jsx(lr,{})}),e.jsx($,{"data-cy":"schema-form-item-cancel",onClick:()=>{d(x,S.current,"cancel")},disabled:m||o,size:"large",children:e.jsx(Yo,{})})]}):e.jsx($,{"data-cy":"schema-form-item-edit",onClick:()=>{d(x,g[R],"edit")},disabled:m||u,size:"large",children:e.jsx(ar,{})})})]})]},R)})})}rn.propTypes={schema:r.array.isRequired,loading:r.bool,onChange:r.func.isRequired,value:r.object,defaultValue:r.object,style:r.object,disabled:r.bool};rn.defaultProps={loading:!1,value:void 0,defaultValue:{},style:{},disabled:!1};const Gr=F(Es)``;function an({meta:t,onCancel:o,mode:s,handlePaySuccess:a}){const{t:n,locale:i}=z(),{info:m}=J(),l=po(m),[u,h]=f.useState(null),g=new URL(t==null?void 0:t.registryUrl).origin,p=O.getDisplayName({meta:t}),S=async(b,C)=>{const x=({downloadTokenList:v})=>{a({downloadTokenList:v})},R=v=>{A.error(v),o(v)};function c(v){return Ko(()=>eo.get(v).then(async({data:j})=>{const T=j==null?void 0:j.downloadTokenList;if(j.status==="succeed"){if(T&&T.length)await x({downloadTokenList:T});else return await R(n("blocklet.component.missDownloadTokenTip")),!0;return!0}return j.status==="error"?(console.error("vc error: ",j),await R(j==null?void 0:j.error),!0):!1}),{interval:1e3})}if(s==="purchase"&&u){const{statusUrl:v}=Jo(u);await c(v)}else await x({downloadTokenList:b.downloadTokenList&&C(b.downloadTokenList)})};if(f.useEffect(()=>{if(s==="purchase"){const b=new URL(g);b.pathname="/api/did/verify-purchase-blocklet/token",b.searchParams.set("serverDid",m.did),b.searchParams.set("blockletDid",t==null?void 0:t.did);try{eo.get(b.href).then(({data:C})=>{const x=`${C.url}`;h(x)})}catch(C){console.error("get next workflow url error: ",C)}}return()=>{h(null)}},[s]),s==="purchase"&&!u)return"";const d={verify:{action:"verify-purchase-blocklet",checkFn:pt.create({baseURL:g}).get,extraParams:{serverDid:m.did,blockletDid:t==null?void 0:t.did},messages:{title:n("store.purchase.verify.auth.title",{name:p}),scan:n("store.purchase.verify.auth.scan"),confirm:n("store.purchase.verify.auth.confirm"),success:n("store.purchase.verify.auth.success")}},purchase:{action:"acquire-asset",checkFn:pt.create({baseURL:we(g,"/store")}).get,extraParams:{factory:t.nftFactory,nw:u},messages:{title:n("store.purchase.auth.title",{name:p}),scan:n("store.purchase.auth.scan"),confirm:n("store.purchase.auth.confirm"),success:e.jsxs(e.Fragment,{children:[e.jsx("p",{children:n("store.purchase.auth.success")}),e.jsx("p",{children:n("blocklet.component.purchaseComponentSecondCheckTip")})]})}}};return e.jsx(Gt,{open:!0,locale:i,popup:!1,saveConnect:!1,className:"connect",baseUrl:g,onSuccess:S,cancelWhenScanned:o,onClose:o,checkTimeout:60*5e3,webWalletUrl:l,disableClose:!0,showDownload:!1,...d[s]})}an.propTypes={...zs,handlePaySuccess:r.func,mode:r.oneOf(["verify","purchase"]).isRequired};an.defaultProps={handlePaySuccess:()=>{}};const ln=f.forwardRef(({mode:t,...o},s)=>{const[a,n]=f.useState(t!=="both"?t:"verify"),[i,m]=f.useState(t!=="both"?2:1),l=h=>{h!==a&&n(h)},u=()=>{a&&i!==2&&m(2)};return f.useImperativeHandle(s,()=>({onNext:u,getCurrentStep:()=>i})),i===1?e.jsx("div",{style:{maxWidth:520},children:e.jsx(Vs,{action:a,onNext:null,onSelect:l})}):e.jsx(an,{...o,mode:a})});ln.propTypes={mode:r.oneOf(["both","verify","purchase"]).isRequired,ref:r.any};ln.defaultProps={ref:{}};const zr=ln;function Vr({...t}){return e.jsx(ne,{className:"bottom-button",variant:"contained",color:"primary",...t})}function cn({key:t}={key:"sm"}){const o=uo();return Wt(o.breakpoints.down(t))}function dn({blocklet:t,onStartNow:o,children:s,disabled:a}){const{t:n}=z(),i=cn();return!t||Qo(t.meta)?e.jsx(qr,{children:s}):e.jsxs(_r,{isMobile:i,children:[e.jsx(Vr,{className:"start-now",variant:"contained",color:"primary",disabled:a,onClick:()=>o(),children:n("setup.startNow")}),e.jsx(y,{display:"flex",alignItems:"center",children:s})]})}dn.propTypes={blocklet:r.object,onStartNow:r.func,children:r.any,disabled:r.bool};dn.defaultProps={blocklet:null,onStartNow:()=>{},children:null,disabled:!1};const qr=F(y)`
66
+ `,{NODE_MODES:so}=D,Ar=({mode:t,previousMode:o}={})=>t===so.SERVERLESS||o===so.SERVERLESS;var To={isInServerlessMode:Ar};function Lr(){const[t,o]=f.useState(null),{blocklet:s}=ie();return f.useEffect(()=>{o(tr(s))},[s]),{storageEndpoint:t}}const wo=f.createContext({}),{Provider:Or,Consumer:Xa}=wo;function $t({children:t}){const[o,s]=f.useState(!1),[a,n]=f.useState(null),{blocklet:i,actions:{refreshBlocklet:m}}=ie(),{storageEndpoint:l}=Lr(),{api:u}=J();Vo(async()=>{try{if(s(!0),Wn.isEmpty(l)){n(null);return}const d=await nr(l);n(d)}catch(d){console.error(d),A.error(d.message)}finally{s(!1)}},[l]);const h=()=>{n(null),m()},g=async d=>{n(d),await p(d.endpoint),m()},p=async d=>{await u.configBlocklet({input:{did:[i.meta.did],configs:[{key:X.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_SPACE_ENDPOINT,value:d}]}}),m()};f.useEffect(()=>{async function d(){if(!a)return;const b=await or(a.endpoint,a.name),C=Wn.merge(a,{name:b});n(C)}d()},[]);const S=!!(l&&a);return e.jsx(Or,{value:{loading:o,spaceGateway:a,deleteSpaceGateway:h,updateSpaceGateway:g,storageEndpoint:l,settingStorageEndpoint:p,hasStorageEndpoint:S},children:t})}$t.propTypes={children:Ke.node.isRequired};$t.defaultProps={};function en(){return f.useContext(wo)}const tn={description:r.string,editing:r.bool,onChange:r.func,required:r.bool,value:r.any,componentProps:r.object,render:r.func,renderFormItem:r.func};function nn({editing:t,value:o,onChange:s}){const[a,n]=f.useState(!1),i=f.useRef(),m=f.useRef(o);f.useEffect(()=>{let p=null;return t&&(p=setTimeout(()=>{n(!0)},50)),()=>{clearTimeout(p)}},[t]);const l=p=>{m.current=p,s(p)},u=()=>{n(!1),s(m.current)},h=e.jsx(y,{className:"form-item-input slot",px:1,children:e.jsxs(y,{display:"flex",alignItems:"center",children:[o,o!=="auto"&&e.jsx("div",{style:{marginLeft:4,backgroundColor:o,width:"1em",height:"1em",borderRadius:"0.2em"}})]})}),g=e.jsxs(y,{display:"flex",flexGrow:1,alignItems:"center",height:"40px",onKeyDown:u,children:[e.jsx(y,{display:"flex",alignItems:"center",onClick:()=>n(!0),children:e.jsx("div",{ref:i,style:{flexShrink:0,marginLeft:"8px",backgroundColor:o,width:"32px",height:"32px",boxSizing:"border-box",borderRadius:"8px",border:"1px solid #eee",cursor:o==="auto"?"default":"pointer"}})}),e.jsx(_o,{open:a,anchorEl:i.current,onClose:()=>n(!1),anchorOrigin:{vertical:"bottom",horizontal:"center"},transformOrigin:{vertical:"top",horizontal:"center"},children:e.jsx(cr,{color:o,onChange:p=>l(p.hex)})})]});return t?g:h}nn.propTypes=tn;function on({editing:t,description:o,value:s,onChange:a,componentProps:n,...i}){const{placeholder:m}=n,l=f.useRef(s),u=g=>{g.key==="Enter"&&a(l.current,"confirm")},h=g=>{l.current=g,a(g)};return t?e.jsx(K,{style:{flex:1},fullWidth:!0,value:s,onChange:g=>{g.persist(),h(g.target.value)},autoFocus:!0,size:"small",variant:"outlined",placeholder:o||m,onKeyDown:u,...i}):e.jsx(y,{px:1,className:"form-item-input slot",children:s})}on.propTypes=tn;on.defaultProps={componentProps:{}};function sn({editing:t,value:o,onChange:s,componentProps:a,...n}){const{blocklet:i}=a,m=o==="auto"?Wo.getPassportColorFromDid(i.appDid):o;return e.jsxs(y,{display:"flex",alignItems:"center",children:[e.jsx("div",{style:{width:96,marginRight:12},dangerouslySetInnerHTML:{__html:Ho({title:"Owner",issuer:O.getDisplayName(i),issuerDid:i.appDid,ownerName:"Your Name",ownerDid:i.appDid,preferredColor:o||"auto"})}}),e.jsx(nn,{...n,editing:t,value:t?m:o,onChange:s,componentProps:a})]})}sn.propTypes={...tn,componentProps:r.shape({blocklet:r.object.isRequired}).isRequired};sn.defaultProps={};const Mr={input:on,color:nn,passport:sn,uploader:t=>e.jsx(Ts,{...t.componentProps})};function Fr(t,{editing:o=!1}){const{componentType:s="input",render:a,renderFormItem:n}=t;return o&&n?n:!o&&a?a:Mr[s==null?void 0:s.toLowerCase()]}function rn({schema:t,loading:o,value:s,defaultValue:a,onChange:n,style:i,disabled:m}){const l=Object.prototype.toString.call(s)==="[object Object]",[u,h]=f.useState(null),[g,p]=f.useState(l?s:a),S=f.useRef();function d(x,R,c){const{key:v,secure:j}=x,I=g[v]!==R,U={...g,[v]:R};I&&p(U),n({[v]:R},{allValues:U,action:c,currentItem:x}),c==="confirm"&&j&&p({...g,[v]:"__encrypted__"}),["confirm","cancel"].includes(c)?b(null):b(x)}function b(x){if(x){S.current=g[x.key],h(x);return}S.current=null,h(null)}function C(x,{editing:R=!1}){const{key:c}=x,v=l?s[c]:g[c];return v==="__encrypted__"?R?"":"******":v}return e.jsx(Gr,{className:"form",style:i,children:t==null?void 0:t.map(x=>{const{key:R,description:c,required:v,solo:j=!1,hidden:T=!1,componentProps:I={}}=x;if(T)return null;const U=!!(u&&R===u.key),L=C(x,{editing:U}),k=Fr(x,{editing:U}),M={inputProps:{"data-cy":"schema-form-item-component"},key:R,description:c,editing:U,value:L,onChange:(B,q="change")=>d(x,B,q),componentProps:I};return e.jsxs(y,{className:"form-item",children:[!j&&e.jsxs(y,{className:"form-item-label",style:{color:v&&!L?"#ff0000":"#333"},children:[c,v&&e.jsx(ct,{})]}),e.jsxs(y,{className:"form-item-body",children:[e.jsx(y,{className:"form-item-input",sx:{textAlign:j?"center":"left"},children:e.jsx(k,{...M})}),!j&&e.jsx(y,{className:"form-item-action",children:U?e.jsxs(e.Fragment,{children:[e.jsx($,{"data-cy":"schema-form-item-confirm",onClick:()=>{d(x,L,"confirm")},disabled:m||o,size:"large",children:o?e.jsx(re,{size:24}):e.jsx(lr,{})}),e.jsx($,{"data-cy":"schema-form-item-cancel",onClick:()=>{d(x,S.current,"cancel")},disabled:m||o,size:"large",children:e.jsx(Yo,{})})]}):e.jsx($,{"data-cy":"schema-form-item-edit",onClick:()=>{d(x,g[R],"edit")},disabled:m||u,size:"large",children:e.jsx(ar,{})})})]})]},R)})})}rn.propTypes={schema:r.array.isRequired,loading:r.bool,onChange:r.func.isRequired,value:r.object,defaultValue:r.object,style:r.object,disabled:r.bool};rn.defaultProps={loading:!1,value:void 0,defaultValue:{},style:{},disabled:!1};const Gr=F(Es)``;function an({meta:t,onCancel:o,mode:s,handlePaySuccess:a}){const{t:n,locale:i}=z(),{info:m}=J(),l=po(m),[u,h]=f.useState(null),g=new URL(t==null?void 0:t.registryUrl).origin,p=O.getDisplayName({meta:t}),S=async(b,C)=>{const x=({downloadTokenList:v})=>{a({downloadTokenList:v})},R=v=>{A.error(v),o(v)};function c(v){return Ko(()=>eo.get(v).then(async({data:j})=>{const T=j==null?void 0:j.downloadTokenList;if(j.status==="succeed"){if(T&&T.length)await x({downloadTokenList:T});else return await R(n("blocklet.component.missDownloadTokenTip")),!0;return!0}return j.status==="error"?(console.error("vc error: ",j),await R(j==null?void 0:j.error),!0):!1}),{interval:1e3})}if(s==="purchase"&&u){const{statusUrl:v}=Jo(u);await c(v)}else await x({downloadTokenList:b.downloadTokenList&&C(b.downloadTokenList)})};if(f.useEffect(()=>{if(s==="purchase"){const b=new URL(g);b.pathname="/api/did/verify-purchase-blocklet/token",b.searchParams.set("serverDid",m.did),b.searchParams.set("blockletDid",t==null?void 0:t.did);try{eo.get(b.href).then(({data:C})=>{const x=`${C.url}`;h(x)})}catch(C){console.error("get next workflow url error: ",C)}}return()=>{h(null)}},[s]),s==="purchase"&&!u)return"";const d={verify:{action:"verify-purchase-blocklet",checkFn:pt.create({baseURL:g}).get,extraParams:{serverDid:m.did,blockletDid:t==null?void 0:t.did},messages:{title:n("store.purchase.verify.auth.title",{name:p}),scan:n("store.purchase.verify.auth.scan"),confirm:n("store.purchase.verify.auth.confirm"),success:n("store.purchase.verify.auth.success")}},purchase:{action:"acquire-asset",checkFn:pt.create({baseURL:we(g,"/store")}).get,extraParams:{factory:t.nftFactory,nw:u},messages:{title:n("store.purchase.auth.title",{name:p}),scan:n("store.purchase.auth.scan"),confirm:n("store.purchase.auth.confirm"),success:e.jsxs(e.Fragment,{children:[e.jsx("p",{children:n("store.purchase.auth.success")}),e.jsx("p",{children:n("blocklet.component.purchaseComponentSecondCheckTip")})]})}}};return e.jsx(Gt,{open:!0,locale:i,popup:!1,saveConnect:!1,className:"connect",baseUrl:g,onSuccess:S,cancelWhenScanned:o,onClose:o,checkTimeout:60*5e3,webWalletUrl:l,disableClose:!0,showDownload:!1,...d[s]})}an.propTypes={...zs,handlePaySuccess:r.func,mode:r.oneOf(["verify","purchase"]).isRequired};an.defaultProps={handlePaySuccess:()=>{}};const ln=f.forwardRef(({mode:t,...o},s)=>{const[a,n]=f.useState(t!=="both"?t:"verify"),[i,m]=f.useState(t!=="both"?2:1),l=h=>{h!==a&&n(h)},u=()=>{a&&i!==2&&m(2)};return f.useImperativeHandle(s,()=>({onNext:u,getCurrentStep:()=>i})),i===1?e.jsx("div",{style:{maxWidth:520},children:e.jsx(qs,{action:a,onNext:null,onSelect:l})}):e.jsx(an,{...o,mode:a})});ln.propTypes={mode:r.oneOf(["both","verify","purchase"]).isRequired,ref:r.any};ln.defaultProps={ref:{}};const zr=ln;function qr({...t}){return e.jsx(ne,{className:"bottom-button",variant:"contained",color:"primary",...t})}function cn({key:t}={key:"sm"}){const o=uo();return Wt(o.breakpoints.down(t))}function dn({blocklet:t,onStartNow:o,children:s,disabled:a}){const{t:n}=z(),i=cn();return!t||Qo(t.meta)?e.jsx(Vr,{children:s}):e.jsxs(_r,{isMobile:i,children:[e.jsx(qr,{className:"start-now",variant:"contained",color:"primary",disabled:a,onClick:()=>o(),children:n("setup.startNow")}),e.jsx(y,{display:"flex",alignItems:"center",children:s})]})}dn.propTypes={blocklet:r.object,onStartNow:r.func,children:r.any,disabled:r.bool};dn.defaultProps={blocklet:null,onStartNow:()=>{},children:null,disabled:!1};const Vr=F(y)`
67
67
  width: 100%;
68
68
  margin-top: auto;
69
69
  padding-top: 24px;
@@ -161,12 +161,12 @@ import{bM as zo,j as e,aK as qt,aL as _t,q as z,O as y,ax as ve,P as r,A,bn as J
161
161
  visibility: visible;
162
162
  }
163
163
  }
164
- `;function Hr(){const{t}=z(),{spaceGateway:o,settingStorageEndpoint:s}=en();return e.jsxs(y,{display:"flex",flexDirection:"column",children:[e.jsx(y,{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",marginBottom:"12px",children:e.jsx(ee,{fontSize:"1.2rem",fontWeight:"bold",children:t("storage.spaces.connected.title")})}),e.jsx(y,{children:e.jsx(un,{style:{marginTop:"12px"},spaceGateway:o,connected:!0,onDisconnect:()=>s(null)},o.endpoint)})]})}function mn({onConnect:t,...o}){const{blocklet:s}=ie(),{info:a}=J(),{t:n,locale:i}=z(),[m,l]=f.useState(""),[u,h]=f.useState(!1),[g,p]=f.useState(!1),[S,d]=f.useState(""),b=mr({blocklet:s}),C=po(a),{storageEndpoint:x}=en(),[R,c]=f.useState({open:!1,action:"connect-to-did-spaces",checkTimeout:1e3*300,prefix:"/api/did",checkFn:pt.create({baseURL:we(window.location.origin,$o())}).get,messages:{title:n("storage.spaces.provideNFT.title",{appName:b.appName},i),scan:n("storage.spaces.provideNFT.scan",{appName:b.appName},i),confirm:"",success:e.jsx(ee,{gutterBottom:!0,children:n("storage.spaces.provideNFT.success")})},onClose:()=>{c(k=>({...k,open:!1}))}}),[v,j]=f.useState({open:!1,action:"one-click-authorization",checkTimeout:1e3*300,messages:{title:n("storage.spaces.authorize.title",{appName:b.appName},i),scan:n("storage.spaces.authorize.scan",{appName:b.appName},i),confirm:"",success:e.jsx(ee,{gutterBottom:!0,children:n("storage.spaces.authorize.success")})},onClose:()=>{j(k=>({...k,open:!1}))}}),T=async({did:k,name:M,endpoint:B})=>{const V=await Xn(B);if(!await $n(V)){A.error(n("storage.spaces.gateway.add.invalidUrl"));return}const Q={name:M,did:k,url:V,endpoint:B};await t(Q),A.success(n("storage.spaces.connectedWithName",{name:Q.name}))},I=(k,M)=>{setTimeout(async()=>{if(j(Q=>({...Q,open:!1})),l(null),c(Q=>({...Q,open:!1})),!He(k.spaceGateway)){await T(M(k.spaceGateway));return}const B=M(k.endpoint),V=k.space?M(k.space):{};await T({endpoint:B,did:rr(B),name:"DID Space",...V})},0)},U=()=>{c(k=>({...k,open:!0,extraParams:{appPid:s.appPid,referrer:window.location.href}}))},L=async()=>{try{h(!0);const k=await Xn(m),M=ir(k),B=new URL(k).searchParams.get("spaceDid");if(!await $n(M))throw new Error(n("storage.spaces.gateway.add.invalidUrl"));j(V=>({...V,open:!0,prefix:we(M,"space/api/did"),baseUrl:new URL(M).origin,checkFn:pt.create({baseURL:we(M,"space")}).get,extraParams:{appDid:b.appDid,appName:b.appName,appDescription:b.appDescription,scopes:b.scopes,appUrl:b.appUrl,referrer:b.referrer,nodeDid:a.did,spaceDid:B}})),p(!1)}catch(k){const M=`${n("storage.spaces.gateway.add.failed",i)}: ${Z(k)}`;d(M)}finally{h(!1)}};return e.jsxs(y,{children:[e.jsx(to,{color:"primary",style:{textTransform:"none !important",fontSize:"1rem"},size:"small",onClick:U,variant:"outlined",menu:[e.jsx(to.Item,{sx:{textTransform:"none"},onClick:()=>p(!0),size:"small",...o,children:n(x?"storage.spaces.connect.useSpaceGatewayReconnect":"storage.spaces.connect.useSpaceGateway")},"1")],children:e.jsx(ee,{sx:{fontWeight:"bold",textTransform:"none"},children:n(x?"storage.spaces.connect.useWalletReconnect":"storage.spaces.connect.useWallet")})}),e.jsx(Gt,{forceConnected:!1,saveConnect:!1,prefix:R.prefix,open:R.open,popup:!0,action:R.action,webWalletUrl:C,baseUrl:R.baseUrl,checkFn:R.checkFn,onSuccess:I,onClose:R.onClose,checkTimeout:R.checkTimeout,extraParams:R.extraParams,messages:R.messages,locale:i}),e.jsx(Gt,{forceConnected:!1,saveConnect:!1,prefix:v.prefix,open:v.open,popup:!0,action:v.action,baseUrl:v.baseUrl,checkFn:v.checkFn,onSuccess:I,onClose:v.onClose,checkTimeout:v.checkTimeout,extraParams:v.extraParams,messages:v.messages,locale:i}),e.jsxs(xt,{title:n("storage.spaces.gateway.add.title"),fullWidth:!0,maxWidth:"md",open:g,onClose:()=>p(!1),PaperProps:{style:{minHeight:"auto"}},actions:e.jsxs(e.Fragment,{children:[e.jsx(ne,{onClick:k=>{k.stopPropagation(),p(!1)},color:"inherit",children:n("common.cancel")}),e.jsxs(ne,{onClick:L,color:"primary",disabled:u||!m,variant:"contained",autoFocus:!0,children:[u&&e.jsx(re,{size:16}),n("common.confirm")]})]}),children:[e.jsx("div",{style:{paddingTop:12,overflowY:"hidden"},children:e.jsx(es,{component:"div",children:e.jsx(ee,{component:"div",children:e.jsx(K,{label:n("storage.spaces.gateway.add.label"),autoComplete:"off",variant:"outlined",name:"url",fullWidth:!0,value:m,onChange:k=>{d(null),l(k.target.value)},disabled:u,onKeyPress:async k=>{k.key==="Enter"&&await L()},autoFocus:!0})})})}),!!S&&e.jsx(dt,{severity:"error",style:{width:"100%"},children:S})]})]})}mn.propTypes={onConnect:Ke.func};mn.defaultProps={onConnect:()=>{}};function fn({blockletMeta:t,onEndpointUpdate:o}){var l;const s=cn(),{blocklet:a}=ie(),{updateSpaceGateway:n,loading:i,hasStorageEndpoint:m}=en();return f.useEffect(()=>{o==null||o()},[a]),i?e.jsx(ts,{relative:"parent",children:e.jsx(re,{})}):e.jsxs(Yr,{children:[e.jsx(y,{width:s?"360px":"720px",children:m?e.jsx(Hr,{}):e.jsx(Io,{})}),((l=t==null?void 0:t.capabilities)==null?void 0:l.didSpace)==="required"&&e.jsx(dn,{mt:8,children:e.jsx(mn,{onConnect:n})})]})}fn.propTypes={blockletMeta:r.any.isRequired,onEndpointUpdate:Ke.func};fn.defaultProps={onEndpointUpdate:()=>{}};const Yr=F(ws)`
164
+ `;function Hr(){const{t}=z(),{spaceGateway:o,settingStorageEndpoint:s}=en();return e.jsxs(y,{display:"flex",flexDirection:"column",children:[e.jsx(y,{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",marginBottom:"12px",children:e.jsx(ee,{fontSize:"1.2rem",fontWeight:"bold",children:t("storage.spaces.connected.title")})}),e.jsx(y,{children:e.jsx(un,{style:{marginTop:"12px"},spaceGateway:o,connected:!0,onDisconnect:()=>s(null)},o.endpoint)})]})}function mn({onConnect:t,...o}){const{blocklet:s}=ie(),{info:a}=J(),{t:n,locale:i}=z(),[m,l]=f.useState(""),[u,h]=f.useState(!1),[g,p]=f.useState(!1),[S,d]=f.useState(""),b=mr({blocklet:s}),C=po(a),{storageEndpoint:x}=en(),[R,c]=f.useState({open:!1,action:"connect-to-did-spaces",checkTimeout:1e3*300,prefix:"/api/did",checkFn:pt.create({baseURL:we(window.location.origin,$o())}).get,messages:{title:n("storage.spaces.provideNFT.title",{appName:b.appName},i),scan:n("storage.spaces.provideNFT.scan",{appName:b.appName},i),confirm:"",success:e.jsx(ee,{gutterBottom:!0,children:n("storage.spaces.provideNFT.success")})},onClose:()=>{c(k=>({...k,open:!1}))}}),[v,j]=f.useState({open:!1,action:"one-click-authorization",checkTimeout:1e3*300,messages:{title:n("storage.spaces.authorize.title",{appName:b.appName},i),scan:n("storage.spaces.authorize.scan",{appName:b.appName},i),confirm:"",success:e.jsx(ee,{gutterBottom:!0,children:n("storage.spaces.authorize.success")})},onClose:()=>{j(k=>({...k,open:!1}))}}),T=async({did:k,name:M,endpoint:B})=>{const q=await Xn(B);if(!await $n(q)){A.error(n("storage.spaces.gateway.add.invalidUrl"));return}const Q={name:M,did:k,url:q,endpoint:B};await t(Q),A.success(n("storage.spaces.connectedWithName",{name:Q.name}))},I=(k,M)=>{setTimeout(async()=>{if(j(Q=>({...Q,open:!1})),l(null),c(Q=>({...Q,open:!1})),!He(k.spaceGateway)){await T(M(k.spaceGateway));return}const B=M(k.endpoint),q=k.space?M(k.space):{};await T({endpoint:B,did:rr(B),name:"DID Space",...q})},0)},U=()=>{c(k=>({...k,open:!0,extraParams:{appPid:s.appPid,referrer:window.location.href}}))},L=async()=>{try{h(!0);const k=await Xn(m),M=ir(k),B=new URL(k).searchParams.get("spaceDid");if(!await $n(M))throw new Error(n("storage.spaces.gateway.add.invalidUrl"));j(q=>({...q,open:!0,prefix:we(M,"space/api/did"),baseUrl:new URL(M).origin,checkFn:pt.create({baseURL:we(M,"space")}).get,extraParams:{appDid:b.appDid,appName:b.appName,appDescription:b.appDescription,scopes:b.scopes,appUrl:b.appUrl,referrer:b.referrer,nodeDid:a.did,spaceDid:B}})),p(!1)}catch(k){const M=`${n("storage.spaces.gateway.add.failed",i)}: ${Z(k)}`;d(M)}finally{h(!1)}};return e.jsxs(y,{children:[e.jsx(to,{color:"primary",style:{textTransform:"none !important",fontSize:"1rem"},size:"small",onClick:U,variant:"outlined",menu:[e.jsx(to.Item,{sx:{textTransform:"none"},onClick:()=>p(!0),size:"small",...o,children:n(x?"storage.spaces.connect.useSpaceGatewayReconnect":"storage.spaces.connect.useSpaceGateway")},"1")],children:e.jsx(ee,{sx:{fontWeight:"bold",textTransform:"none"},children:n(x?"storage.spaces.connect.useWalletReconnect":"storage.spaces.connect.useWallet")})}),e.jsx(Gt,{forceConnected:!1,saveConnect:!1,prefix:R.prefix,open:R.open,popup:!0,action:R.action,webWalletUrl:C,baseUrl:R.baseUrl,checkFn:R.checkFn,onSuccess:I,onClose:R.onClose,checkTimeout:R.checkTimeout,extraParams:R.extraParams,messages:R.messages,locale:i}),e.jsx(Gt,{forceConnected:!1,saveConnect:!1,prefix:v.prefix,open:v.open,popup:!0,action:v.action,baseUrl:v.baseUrl,checkFn:v.checkFn,onSuccess:I,onClose:v.onClose,checkTimeout:v.checkTimeout,extraParams:v.extraParams,messages:v.messages,locale:i}),e.jsxs(xt,{title:n("storage.spaces.gateway.add.title"),fullWidth:!0,maxWidth:"md",open:g,onClose:()=>p(!1),PaperProps:{style:{minHeight:"auto"}},actions:e.jsxs(e.Fragment,{children:[e.jsx(ne,{onClick:k=>{k.stopPropagation(),p(!1)},color:"inherit",children:n("common.cancel")}),e.jsxs(ne,{onClick:L,color:"primary",disabled:u||!m,variant:"contained",autoFocus:!0,children:[u&&e.jsx(re,{size:16}),n("common.confirm")]})]}),children:[e.jsx("div",{style:{paddingTop:12,overflowY:"hidden"},children:e.jsx(es,{component:"div",children:e.jsx(ee,{component:"div",children:e.jsx(K,{label:n("storage.spaces.gateway.add.label"),autoComplete:"off",variant:"outlined",name:"url",fullWidth:!0,value:m,onChange:k=>{d(null),l(k.target.value)},disabled:u,onKeyPress:async k=>{k.key==="Enter"&&await L()},autoFocus:!0})})})}),!!S&&e.jsx(dt,{severity:"error",style:{width:"100%"},children:S})]})]})}mn.propTypes={onConnect:Ke.func};mn.defaultProps={onConnect:()=>{}};function fn({blockletMeta:t,onEndpointUpdate:o}){var l;const s=cn(),{blocklet:a}=ie(),{updateSpaceGateway:n,loading:i,hasStorageEndpoint:m}=en();return f.useEffect(()=>{o==null||o()},[a]),i?e.jsx(ts,{relative:"parent",children:e.jsx(re,{})}):e.jsxs(Yr,{children:[e.jsx(y,{width:s?"360px":"720px",children:m?e.jsx(Hr,{}):e.jsx(Io,{})}),((l=t==null?void 0:t.capabilities)==null?void 0:l.didSpace)==="required"&&e.jsx(dn,{mt:8,children:e.jsx(mn,{onConnect:n})})]})}fn.propTypes={blockletMeta:r.any.isRequired,onEndpointUpdate:Ke.func};fn.defaultProps={onEndpointUpdate:()=>{}};const Yr=F(ws)`
165
165
  height: 100%;
166
166
  overflow-y: auto;
167
167
  padding-bottom: 32px;
168
168
  overflow-x: hidden;
169
- `;function hn({onChange:t,loading:o,children:s,extra:a,stores:n,storageKey:i}){const{t:m}=z(),{info:l,inService:u}=J(),{blocklet:h}=ie(),[g,p]=f.useState(!1),S=f.useRef(null),[d,b]=f.useState(),[C,x]=gr(i||"tmp"),[R,c]=i?[C,x]:[d,b],{storeList:v,teamDid:j}=ho({fromBlocklet:u,blocklet:h,nodeInfo:l}),T=jo([...n.map(U=>({...U,protected:!0})),...v],"url"),I=R&&T.find(U=>R===U.url)||T[0];return e.jsxs(e.Fragment,{children:[e.jsxs(Jr,{children:[e.jsx(ne,{ref:S,color:"primary","data-cy":"add-component-select-store",endIcon:e.jsx(hr,{color:"primary"}),onClick:()=>{p(!0)},style:{padding:"0 2px"},children:e.jsx(ee,{color:"primary",children:I.name})}),e.jsx(ee,{color:"primary",children:a})]}),e.jsxs(K,{id:"mui-registry-select",select:!0,autoComplete:"off",variant:"outlined",name:"did",helperText:m("blocklet.component.selectRegistryTip"),"data-cy":"component-registry-select",fullWidth:!0,value:I,autoFocus:!0,onChange:U=>{const L=U.target.value;c(L.url),t(L)},SelectProps:{open:g,MenuProps:{anchorEl:S.current},renderValue:U=>U==null?void 0:U.name,onClose:()=>{p(!1)}},style:{display:"none"},margin:"normal",children:[T==null?void 0:T.map(U=>e.jsx(ge,{sx:{width:"400px",maxWidth:"90vw"},value:U,"data-cy":U.url,children:e.jsx(qs,{teamDid:j,store:U,onDelete:()=>{var L;R===U.url&&c((L=T[0])==null?void 0:L.url)}})},U.url)),!To.isInServerlessMode(l)&&e.jsx(_s,{disabled:o,storeList:T,teamDid:j,onAdd:U=>{c(U)}})]}),s({currentRegistry:I})]})}hn.propTypes={onChange:r.func,loading:r.bool,children:r.any.isRequired,extra:r.node,storageKey:r.string,stores:r.arrayOf(r.shape({name:r.string.isRequired,url:r.string.isRequired}))};hn.defaultProps={onChange:()=>{},loading:!1,extra:"",stores:[],storageKey:""};const Jr=F.div`
169
+ `;function hn({onChange:t,loading:o,children:s,extra:a,stores:n,storageKey:i}){const{t:m}=z(),{info:l,inService:u}=J(),{blocklet:h}=ie(),[g,p]=f.useState(!1),S=f.useRef(null),[d,b]=f.useState(),[C,x]=gr(i||"tmp"),[R,c]=i?[C,x]:[d,b],{storeList:v,teamDid:j}=ho({fromBlocklet:u,blocklet:h,nodeInfo:l}),T=jo([...n.map(U=>({...U,protected:!0})),...v],"url"),I=R&&T.find(U=>R===U.url)||T[0];return e.jsxs(e.Fragment,{children:[e.jsxs(Jr,{children:[e.jsx(ne,{ref:S,color:"primary","data-cy":"add-component-select-store",endIcon:e.jsx(hr,{color:"primary"}),onClick:()=>{p(!0)},style:{padding:"0 2px"},children:e.jsx(ee,{color:"primary",children:I.name})}),e.jsx(ee,{color:"primary",children:a})]}),e.jsxs(K,{id:"mui-registry-select",select:!0,autoComplete:"off",variant:"outlined",name:"did",helperText:m("blocklet.component.selectRegistryTip"),"data-cy":"component-registry-select",fullWidth:!0,value:I,autoFocus:!0,onChange:U=>{const L=U.target.value;c(L.url),t(L)},SelectProps:{open:g,MenuProps:{anchorEl:S.current},renderValue:U=>U==null?void 0:U.name,onClose:()=>{p(!1)}},style:{display:"none"},margin:"normal",children:[T==null?void 0:T.map(U=>e.jsx(ge,{sx:{width:"400px",maxWidth:"90vw"},value:U,"data-cy":U.url,children:e.jsx(Vs,{teamDid:j,store:U,onDelete:()=>{var L;R===U.url&&c((L=T[0])==null?void 0:L.url)}})},U.url)),!To.isInServerlessMode(l)&&e.jsx(_s,{disabled:o,storeList:T,teamDid:j,onAdd:U=>{c(U)}})]}),s({currentRegistry:I})]})}hn.propTypes={onChange:r.func,loading:r.bool,children:r.any.isRequired,extra:r.node,storageKey:r.string,stores:r.arrayOf(r.shape({name:r.string.isRequired,url:r.string.isRequired}))};hn.defaultProps={onChange:()=>{},loading:!1,extra:"",stores:[],storageKey:""};const Jr=F.div`
170
170
  display: flex;
171
171
  justify-content: space-between;
172
172
  align-items: center;
@@ -177,7 +177,7 @@ import{bM as zo,j as e,aK as qt,aL as _t,q as z,O as y,ax as ve,P as r,A,bn as J
177
177
  color: ${t=>t.theme.palette.common.black};
178
178
  // font-weight: bold;
179
179
  }
180
- `;var gn={},Kr=_t;Object.defineProperty(gn,"__esModule",{value:!0});var Uo=gn.default=void 0,Qr=Kr(qt()),Zr=e;Uo=gn.default=(0,Qr.default)((0,Zr.jsx)("path",{d:"M16 18v2H8v-2zM11 7.99V16h2V7.99h3L12 4 8 7.99z"}),"Upgrade");const Xr=(t,o)=>we(o,`/blocklets/${t.did}`),ro=({blocklet:t,attribute:o,value:s})=>t._formatted?t._formatted[o]:s,$r=t=>t.inStore&&O.isFreeBlocklet(t)===!1;function xn({blocklet:t,blocklets:o,handleButtonClick:s,endpoint:a}){const{t:n}=z();let i=we(a,ss(t.did,t.logo||""));try{const C=new URL(i);C.searchParams.set("v",t.version||+new Date),i=C.href}catch{}const[m,l]=f.useState(!1),u=C=>C.currentTarget.contains(C.target)?!0:(C.preventDefault(),!1),h=async C=>{C.preventDefault(),C.stopPropagation();try{l(!0),await s({meta:t,registryUrl:a,blocklets:o})}catch(x){A.error(x.message)}finally{l(!1)}},{blocklet:g}=ie(),p=()=>((g==null?void 0:g.children)||[]).find(R=>R.meta.bundleDid===t.did).meta.version,d=(()=>{const C=((g==null?void 0:g.children)||[]).find(x=>x.meta.bundleDid===t.did);if(C){try{const x=C.meta.version,R=t.version;if(rs.gt(R,x))return"upgrade"}catch{return"install"}return"disable"}return"install"})();let b=n("blocklet.component.choose");return d==="upgrade"?b=n("blocklet.component.upgrade"):d==="disable"?b=n("blocklet.component.installed"):$r(t)&&(b=n("common.purchase")),e.jsx(yt,{href:Xr(t,a),style:{color:"initial",textDecoration:"none"},onClick:u,target:"_blank",children:e.jsx(ei,{title:ro({blocklet:t,attribute:"title",value:t.title||t.name}),did:t.did,description:ro({blocklet:t,attribute:"description",value:t.description}),cover:t.logo?i:"",version:t.version,button:e.jsx("div",{style:{display:"flex",alignItems:"center"},children:e.jsx(Hs,{children:e.jsxs(ne,{onClick:h,size:"small",disabled:m||d==="disable",variant:"outlined",color:"primary","data-cy":"install-blocklet",title:d==="upgrade"?`${p()} -> ${t.version}`:"",children:[m?e.jsxs(e.Fragment,{children:[e.jsx(re,{size:16,style:{marginRight:3}}),b]}):b,d==="upgrade"?e.jsx(Uo,{style:{fontSize:"1.2rem"}}):null]},t.did)})})})})}xn.propTypes={blocklet:r.object.isRequired,blocklets:r.array,handleButtonClick:r.func,endpoint:r.string};xn.defaultProps={handleButtonClick:null,endpoint:"",blocklets:[]};function yn({handleButtonClick:t,handleSearchSelect:o,storeUrl:s,handleBlockletRender:a,extraFilter:n,serverVersion:i,resourceType:m,resourceDid:l,showResourcesSwitch:u,showCategory:h,...g}){const{locale:p}=z(),[S,d]=f.useState(!1),[b,C]=f.useState({}),x=c=>{C(c)},R=s;return f.useEffect(()=>{C({showResources:!0,resourceType:m,resourceDid:l})},[R,m,l]),f.useEffect(()=>{d(!0),C({showResources:!0,resourceType:m,resourceDid:l})},[]),e.jsx(ns,{FallbackComponent:os,resetKeys:[R],children:e.jsx("div",{...g,children:S&&e.jsx(Ws,{showCategory:h,showResourcesSwitch:u,blockletRender:c=>{const v={...c,handleButtonClick:t,endpoint:R};return a({...c,defaultRender:e.jsx(xn,{...v})})},baseSearch:!0,endpoint:R,locale:p,onFilterChange:x,onSearchSelect:o,filters:b,extraFilter:n,serverVersion:i,fetchCategoryDelay:500})})})}yn.propTypes={storeUrl:r.string.isRequired,handleButtonClick:r.func,handleSearchSelect:r.func,handleBlockletRender:r.func,extraFilter:r.func,serverVersion:r.string,resourceType:r.string,resourceDid:r.string,showResourcesSwitch:r.bool,showCategory:r.bool};yn.defaultProps={handleButtonClick:null,handleSearchSelect:null,handleBlockletRender:null,extraFilter:void 0,serverVersion:"",resourceType:"",resourceDid:"",showResourcesSwitch:!0,showCategory:!0};const ei=F(Ys)`
180
+ `;var gn={},Kr=_t;Object.defineProperty(gn,"__esModule",{value:!0});var Uo=gn.default=void 0,Qr=Kr(Vt()),Zr=e;Uo=gn.default=(0,Qr.default)((0,Zr.jsx)("path",{d:"M16 18v2H8v-2zM11 7.99V16h2V7.99h3L12 4 8 7.99z"}),"Upgrade");const Xr=(t,o)=>we(o,`/blocklets/${t.did}`),ro=({blocklet:t,attribute:o,value:s})=>t._formatted?t._formatted[o]:s,$r=t=>t.inStore&&O.isFreeBlocklet(t)===!1;function xn({blocklet:t,blocklets:o,handleButtonClick:s,endpoint:a}){const{t:n}=z();let i=we(a,ss(t.did,t.logo||""));try{const C=new URL(i);C.searchParams.set("v",t.version||+new Date),i=C.href}catch{}const[m,l]=f.useState(!1),u=C=>C.currentTarget.contains(C.target)?!0:(C.preventDefault(),!1),h=async C=>{C.preventDefault(),C.stopPropagation();try{l(!0),await s({meta:t,registryUrl:a,blocklets:o})}catch(x){A.error(x.message)}finally{l(!1)}},{blocklet:g}=ie(),p=()=>((g==null?void 0:g.children)||[]).find(R=>R.meta.bundleDid===t.did).meta.version,d=(()=>{const C=((g==null?void 0:g.children)||[]).find(x=>x.meta.bundleDid===t.did);if(C){try{const x=C.meta.version,R=t.version;if(rs.gt(R,x))return"upgrade"}catch{return"install"}return"disable"}return"install"})();let b=n("blocklet.component.choose");return d==="upgrade"?b=n("blocklet.component.upgrade"):d==="disable"?b=n("blocklet.component.installed"):$r(t)&&(b=n("common.purchase")),e.jsx(yt,{href:Xr(t,a),style:{color:"initial",textDecoration:"none"},onClick:u,target:"_blank",children:e.jsx(ei,{title:ro({blocklet:t,attribute:"title",value:t.title||t.name}),did:t.did,description:ro({blocklet:t,attribute:"description",value:t.description}),cover:t.logo?i:"",version:t.version,button:e.jsx("div",{style:{display:"flex",alignItems:"center"},children:e.jsx(Hs,{children:e.jsxs(ne,{onClick:h,size:"small",disabled:m||d==="disable",variant:"outlined",color:"primary","data-cy":"install-blocklet",title:d==="upgrade"?`${p()} -> ${t.version}`:"",children:[m?e.jsxs(e.Fragment,{children:[e.jsx(re,{size:16,style:{marginRight:3}}),b]}):b,d==="upgrade"?e.jsx(Uo,{style:{fontSize:"1.2rem"}}):null]},t.did)})})})})}xn.propTypes={blocklet:r.object.isRequired,blocklets:r.array,handleButtonClick:r.func,endpoint:r.string};xn.defaultProps={handleButtonClick:null,endpoint:"",blocklets:[]};function yn({handleButtonClick:t,handleSearchSelect:o,storeUrl:s,handleBlockletRender:a,extraFilter:n,serverVersion:i,resourceType:m,resourceDid:l,showResourcesSwitch:u,showCategory:h,...g}){const{locale:p}=z(),[S,d]=f.useState(!1),[b,C]=f.useState({}),x=c=>{C(c)},R=s;return f.useEffect(()=>{C({showResources:!0,resourceType:m,resourceDid:l})},[R,m,l]),f.useEffect(()=>{d(!0),C({showResources:!0,resourceType:m,resourceDid:l})},[]),e.jsx(ns,{FallbackComponent:os,resetKeys:[R],children:e.jsx("div",{...g,children:S&&e.jsx(Ws,{showCategory:h,showResourcesSwitch:u,blockletRender:c=>{const v={...c,handleButtonClick:t,endpoint:R};return a({...c,defaultRender:e.jsx(xn,{...v})})},baseSearch:!0,endpoint:R,locale:p,onFilterChange:x,onSearchSelect:o,filters:b,extraFilter:n,serverVersion:i,fetchCategoryDelay:500})})})}yn.propTypes={storeUrl:r.string.isRequired,handleButtonClick:r.func,handleSearchSelect:r.func,handleBlockletRender:r.func,extraFilter:r.func,serverVersion:r.string,resourceType:r.string,resourceDid:r.string,showResourcesSwitch:r.bool,showCategory:r.bool};yn.defaultProps={handleButtonClick:null,handleSearchSelect:null,handleBlockletRender:null,extraFilter:void 0,serverVersion:"",resourceType:"",resourceDid:"",showResourcesSwitch:!0,showCategory:!0};const ei=F(Ys)`
181
181
  .ms-highlight {
182
182
  color: ${t=>t.theme.palette.primary.main};
183
183
  }
@@ -319,7 +319,7 @@ import{bM as zo,j as e,aK as qt,aL as _t,q as z,O as y,ax as ve,P as r,A,bn as J
319
319
  & .connect {
320
320
  background: white;
321
321
  }
322
- `,oi=Cn,si=t=>t.inStore&&O.isFreeBlocklet(t)===!1,ri=t=>{var o;return[X.BLOCKLET_APP_SPACE_REQUIREMENT.REQUIRED,X.BLOCKLET_APP_SPACE_REQUIREMENT.REQUIRED_ON_SETUP].includes((o=t==null?void 0:t.capabilities)==null?void 0:o.didSpace)},Ot=t=>{var o,s;return((s=(o=t==null?void 0:t.configs)==null?void 0:o.find(a=>a.key===X.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_SPACE_ENDPOINT))==null?void 0:s.value)||null},ii=t=>(t.environments||[]).some(o=>o.required),ao=(t,o)=>t==null?void 0:t.some(s=>s.required&&!o[s.key]),ai=({params:t,blocklet:o,t:s})=>{const a=t.title||t.name;return a?((o==null?void 0:o.children)||[]).find(i=>i.meta.bundleDid===t.bundleDid)?s("blocklet.component.upgradeNext",{name:a}):s("blocklet.component.addNext",{name:a}):s("common.next")},lo=({componentDid:t,timeout:o=1e3,manual:s=!1}={})=>{setTimeout(()=>{window.parent.postMessage({event:"component.installed",componentDid:t,manual:s},"*")},o)};function jn({onClose:t,mode:o,stores:s,resourceType:a,resourceDid:n,storageKey:i,inDialog:m,selectedMeta:l,storeUrl:u,showResourcesSwitch:h,showFromUrl:g,enableRunBackground:p,showCategory:S}){var Ln,On,Mn,$e,Fn,et,Gn;const{t:d,locale:b}=z(),[C,x]=f.useState(!1),[R,c]=f.useState(null),[v,j]=f.useState(""),[T,I]=f.useState(""),{api:U,ws:{useSubscription:L},inService:k,info:M}=J(),{blocklet:B,actions:{refreshBlocklet:V}}=ie(),[Q,Ie]=f.useState(null),[te,de]=f.useState(!1),Se={bundleDid:"",componentDid:"",componentName:"",pathPrefix:"",name:"",title:"",configsList:[],configsValue:{},hasMissRequiredConfigs:!1,hasEnvironmentsStep:!1,hasRequiredEnvironments:!1,requirePurchase:!1,didSpaceIsRequiredSetup:null,installResultProps:{},purchaseResultProps:{},showFromUrlDialog:!1},[P,ke]=f.useState(Se),[me,Ze]=f.useState(0),q=f.useRef({}),w=f.useRef({}),_=f.useRef({}),oe=Wt(E=>E.breakpoints.down("md")),xe=as(),[se,Ge]=f.useState(!0),{meta:Y}=q.current,H=E=>ke(N=>({...N,...E}));f.useEffect(()=>{if(P.pathPrefix){const{errMsg:E}=An({...P,pathPrefix:P.pathPrefix,locale:b});j(E)}},[P.pathPrefix]),f.useEffect(()=>{me===0&&ke(Se)},[me]);const be=()=>{const E=Ot(B)??"";H({didSpaceEndpoint:E})},ze=()=>{var E;return(E=q==null?void 0:q.current)!=null&&E.meta?O.getDisplayName(q.current):""},Ue=E=>{const N=G=>{H({installResultProps:{variant:"error",title:ze(),subTitle:E,footer:e.jsx(ne,{className:"bottom-button",disabled:G,"data-cy":"retry-install-component",onClick:async()=>{N(!0),await Nn(q.current.installInput)},children:e.jsxs(y,{display:"flex",alignItems:"center",children:[G&&e.jsx(re,{size:16,style:{marginRight:8}}),d("common.retry")]})})}})};N()},Tt=E=>N=>{var G,W;(((G=N==null?void 0:N.meta)==null?void 0:G.did)||(N==null?void 0:N.meta))===((W=B==null?void 0:B.meta)==null?void 0:W.did)&&E(N)};L(X.BlockletEvents.statusChange,Tt(E=>{switch(E.status){case X.BlockletStatus.upgrading:H({installResultProps:{variant:"success",title:ze(),subTitle:d("blocklet.component.installSuccessTip")}}),lo({componentDid:xe.componentDid});break}const N=Ot(B);H(G=>({...G,didSpaceEndpoint:N}))}),[(Ln=B==null?void 0:B.meta)==null?void 0:Ln.did]),L(X.BlockletEvents.downloadFailed,Tt(()=>{Ue(d("blocklet.component.installComponentError"))}),[(On=B==null?void 0:B.meta)==null?void 0:On.did]),L(X.BlockletEvents.installFailed,Tt(()=>{Ue(d("blocklet.component.installComponentError"))}),[(Mn=B==null?void 0:B.meta)==null?void 0:Mn.did]);const pe=[],wt=()=>{x(!1),ke({}),q.current={},t()},Xe=E=>((B==null?void 0:B.children)||[]).some(N=>N.meta.did===E),Nn=async E=>{var Be,Ne;const{pathPrefix:N,bundleDid:G,title:W,componentName:Re="",componentDid:De=""}=P,Ee=((Be=q.current)==null?void 0:Be.meta)||{},{configs:ye=[],registryUrl:je,inStore:qe,inputUrl:_e,dist:It}=Ee,We=(Ne=q.current)==null?void 0:Ne.downloadTokenList,le=qe?Hn(je,G,It):_e;x(!0);const tt={rootDid:B.meta.did,url:le,mountPoint:N?ue(N):`/${ue(Ee.title||Ee.name)}`,title:W,name:Re,did:De,onlyRequired:!se,...P.hasEnvironmentsStep&&ye.length>0?{configs:ye.map(he=>({...he,value:P.configsValue[he.key]||""}))}:{},...We?{downloadTokenList:We}:{},...E};try{if(await U.installComponent({input:tt}),je){const{teamDid:he,storeList:Ae}=ho({fromBlocklet:k,nodeInfo:M,blocklet:B}),{isNew:kt,decoded:nt}=ds(je,Ae);kt&&await U.addBlockletStore({input:{teamDid:he,url:nt}})}H({installResultProps:{}}),V({showError:!1,attachRuntimeInfo:!1})}catch(he){const Ae=Z(he);A.error(Ae),console.error("installComponent error: ",he),Ue(Ae)}finally{x(!1),q.current.installInput=tt}},An=E=>({errMsg:vo({params:{...E,did:E.bundleDid},blocklets:[B],blocklet:B,locale:b})}),fe=async E=>{var G,W;const{errMsg:N}=An({...P,locale:b});j(N),me===pe.length-2&&await Nn(E),(W=(G=w.current)==null?void 0:G.setActiveStepByIndex)==null||W.call(G,Re=>Re+1)},Ve=()=>{var E,N;(N=(E=w.current)==null?void 0:E.setActiveStepByIndex)==null||N.call(E,G=>G-1)},Lo=()=>{const{pathPrefix:E,bundleDid:N,title:G,componentName:W="",componentDid:Re=""}=P,{meta:De={}}=q.current||{},{registryUrl:Ee,inStore:ye,inputUrl:je,dist:qe}=De,_e=ye?Hn(Ee,N,qe):je;Ie({meta:De,installOpts:{type:"component",rootDid:B.meta.did,mountPoint:E,url:_e,title:G,name:W,did:Re}})},Oo=E=>{de(!1),H({purchaseResultProps:{variant:"error",title:ze(),subTitle:E,style:{paddingTop:120},footer:e.jsx(ne,{className:"bottom-button","data-cy":"retry-purchase-component",onClick:()=>{H({purchaseResultProps:{}})},children:d("common.retry")})}})},Mo=({downloadTokenList:E})=>{q.current.downloadTokenList=E,de(!1),fe()},Pt=({chooseParams:E=q.current,componentDid:N,isInit:G=!1})=>{var nt,zn,Vn,qn;const{meta:W,registryUrl:Re,inStore:De,inputUrl:Ee}=E,{did:ye,title:je,name:qe}=W,_e=(((nt=B.settings)==null?void 0:nt.children)||[]).filter(ce=>ce.status==="deleted"&&ce.meta.bundleDid===ye),It=N||"",We=(zn=W.environments)==null?void 0:zn.map(ce=>{const{name:Ut,validation:ot,...st}=ce,Dt={validation:ls(ot)?"":ot};return{...st,key:Ut,...Dt}});q.current={...E,meta:{...W,configs:We,registryUrl:Re,inStore:De,inputUrl:Ee}};let le={};if(G){const ce=[B],Ut=We||[],ot=[],st=jo(cs([...Ut,...ot]),"key").filter(Le=>!!Le.key).sort((Le,rt)=>Le.required&&!rt.required?-1:rt.required&&!Le.required?1:0),Dt=O.getSharedConfigObj(ce[0],{configs:st}),Bt={},_n=st.map(Le=>{const{default:rt,key:it,...Go}=Le;return Bt[it]=Dt[it]||rt,{...Go,key:it,hidden:!!X.BLOCKLET_CONFIGURABLE_KEY[it]}});le={...le,configsList:_n,configsValue:Bt,hasMissRequiredConfigs:ao(_n,Bt)}}const tt=B.children.some(ce=>ce.mountPoint==="/"),Be=_e.find(ce=>ce.meta.bundleDid===ye),Ne=B.children.find(ce=>ce.meta.bundleDid===ye);le.title=je||"",Be?le={...le,pathPrefix:Be.mountPoint||"",componentName:Be.meta.name,hasEnvironmentsStep:!1}:Ne?le={...le,pathPrefix:Ne.mountPoint||"",componentName:Ne.meta.name,hasEnvironmentsStep:!1}:le={...le,pathPrefix:tt?`/${ue(je)||ue(qe)}`.toLowerCase():"/",componentName:"",hasEnvironmentsStep:((qn=(Vn=q.current.meta)==null?void 0:Vn.environments)==null?void 0:qn.length)>0};const he=si(q.current.meta),Ae=ri(q.current.meta),kt=Ot(B);H({bundleDid:ye,componentDid:It,...le,hasRequiredEnvironments:ii(q.current.meta),requirePurchase:he,didSpaceIsRequiredSetup:Ae,didSpaceEndpoint:kt}),G&&he&&Lo()};f.useEffect(()=>{!l||me!==0||!B||(Pt({chooseParams:{blocklets:[l],meta:l,registryUrl:u||l.homepage,inStore:!0},isInit:!0}),H({showFromUrlDialog:!1}),fe())},[l,me,B]),pe.push({key:"selectComponent",name:d("blocklet.component.selectComponent"),body:e.jsxs(Te,{sx:{width:400},component:"div",children:[g&&P.showFromUrlDialog&&e.jsx(dr,{mode:"component",onCancel:()=>{H({showFromUrlDialog:!1})},onSuccess:({meta:E,inputUrl:N,inStore:G,registryUrl:W})=>{Pt({chooseParams:{meta:E,inputUrl:N,inStore:G,registryUrl:W},isInit:!0}),H({showFromUrlDialog:!1}),fe()},handleText:{title:d("blocklet.component.addComponentTip.fromUrl"),confirm:d("blocklet.component.choose")}}),e.jsx(hn,{stores:s,extra:To.isInServerlessMode(M)?null:g?e.jsxs(ne,{variant:"text",color:"primary","data-cy":"add-component-from-url",onClick:()=>{H({showFromUrlDialog:!0})},style:{padding:"0 2px"},children:[e.jsx(Qt,{style:{fontSize:20,marginRight:4}})," ",d("blocklet.component.addComponentTip.fromUrl")," "]}):null,loading:C,onChange:()=>{ke({}),q.current={}},storageKey:i,children:({currentRegistry:E})=>e.jsx(yn,{showResourcesSwitch:h,showCategory:S,serverVersion:M==null?void 0:M.version,style:oe?{height:"calc(100vh - 56px - 80px - 32px - 40px )"}:{height:"calc(100% - 40px)"},storeUrl:E.url,resourceType:a,resourceDid:n,handleButtonClick:N=>{Pt({chooseParams:{...N,inStore:!0},isInit:!0})},handleBlockletRender:({blocklet:N,defaultRender:G})=>{const W=(P==null?void 0:P.bundleDid)&&(P==null?void 0:P.bundleDid)===(N==null?void 0:N.did);return e.jsxs(ci,{children:[W&&e.jsx("div",{className:"check-container",children:e.jsx(fo,{className:"check-icon"})}),e.jsx("div",{className:W?"choose-blocklet":"",style:{marginLeft:16},children:G})]})}})})]}),cancel:o==="embed"?void 0:d("common.cancel"),confirm:ai({params:P,blocklet:B,t:d}),onCancel:wt,onConfirm:()=>{fe()}}),pe.push({key:"agreement",name:d("launchBlocklet.introduction"),body:e.jsxs(Te,{component:"div",className:"agreement-wrapper",children:[e.jsx(Co,{title:d("launchBlocklet.introduction"),subTitle:d("blocklet.component.addComponentTip.introduction")}),e.jsx(Ps,{meta:Y,onClickNext:fe,installRelated:se,onChangeInstallRelated:Ge,handleDescEle:e.jsx("p",{children:d("blocklet.component.addComponentTip.belowInformation")})})]}),cancel:l?void 0:d("common.pre"),confirm:d("launchBlocklet.next"),onCancel:l?wt:Ve,onConfirm:()=>{de(!1),fe()}}),Y&&P.requirePurchase&&pe.push({key:"purchase",name:e.jsxs(e.Fragment,{children:[d("common.verifyNFT"),e.jsx(ct,{})]}),body:e.jsxs(Te,{component:"div",className:"flex-align-center",style:{flexDirection:"column"},children:[!(((Fn=($e=_.current)==null?void 0:$e.getCurrentStep)==null?void 0:Fn.call($e))===2||te)&&e.jsx(lt,{title:d("common.verifyNFT"),subTitle:d("blocklet.component.addComponentTip.verifyNFT")}),He(P.purchaseResultProps)?Q&&e.jsx(zr,{ref:_,meta:Q.meta,mode:P.componentDid?"verify":"both",onCancel:Oo,installOpts:Q.installOpts,handlePaySuccess:Mo}):e.jsx("div",{className:"flex-align-center flex-justify-center",children:e.jsx(Zn,{...P.purchaseResultProps})})]}),disabled:((Gn=(et=_.current)==null?void 0:et.getCurrentStep)==null?void 0:Gn.call(et))===2||te,cancel:d("common.pre"),confirm:d("common.next"),onConfirm:()=>{typeof _.current.onNext=="function"&&(_.current.onNext(),de(!0))},onCancel:()=>{Ve()}}),O.hasStartEngine(Y)&&!Xe(Y.did)&&pe.push({key:"config",name:d("common.config"),error:v,body:e.jsxs(Te,{component:"div",children:[e.jsx(lt,{title:d("common.config"),subTitle:d("blocklet.component.addComponentTip.config")}),e.jsx(K,{label:d("blocklet.component.mountPoint"),autoComplete:"off",variant:"outlined",name:"pathPrefix",inputProps:{"data-cy":"mount-point-input"},fullWidth:!0,helperText:T||d("blocklet.component.mountPointTip"),style:{marginBottom:32},margin:"normal",value:P.pathPrefix,onChange:E=>{const N=E.target.value;H({pathPrefix:N}),I(d("common.slugifyHint",{value:gt(N)}))}}),!!v&&e.jsx(dt,{severity:"error",style:{width:"100%",marginTop:8},children:v})]}),cancel:d("common.pre"),confirm:d("common.next"),onCancel:Ve,onConfirm:()=>{fe()}}),Y&&!Xe(Y.did)&&(P!=null&&P.hasEnvironmentsStep)&&pe.push({key:"environment",name:e.jsxs(e.Fragment,{children:[d("common.environment")," ",P.hasRequiredEnvironments&&e.jsx(ct,{})]}),disabled:!!R||(P==null?void 0:P.hasMissRequiredConfigs),body:()=>e.jsxs(Te,{component:"div",children:[e.jsx(lt,{title:d("common.environment"),subTitle:d("blocklet.component.addComponentTip.environment")}),e.jsx(rn,{style:{marginTop:-12,width:"100%"},schema:P.configsList,defaultValue:P.configsValue,onChange:(E,{action:N,currentItem:G,allValues:W})=>{N==="confirm"&&H({hasMissRequiredConfigs:ao(P.configsList,W),configsValue:W}),N==="edit"?c(G):["cancel","confirm"].includes(N)&&c(null)}})]}),cancel:d("common.pre"),confirm:d("common.next"),onCancel:Ve,onConfirm:fe}),Y&&!Xe(Y.did)&&(P!=null&&P.didSpaceIsRequiredSetup)&&pe.push({key:"didSpace",name:e.jsxs(e.Fragment,{children:[d("blocklet.component.didSpaceConfig")," ",P.didSpaceIsRequiredSetup==="required"&&e.jsx(ct,{})]}),disabled:(P==null?void 0:P.didSpaceIsRequiredSetup)&&!P.didSpaceEndpoint,body:()=>e.jsx($t,{children:e.jsxs(Te,{component:"div",children:[e.jsx(lt,{title:d("blocklet.component.didSpaceConfig"),subTitle:d("blocklet.component.didSpaceConfigTip")}),e.jsx(y,{sx:{mt:"36px","& > div":{maxWidth:"unset !important","& .MuiAutocomplete-root":{maxWidth:"unset !important"}}},children:e.jsx(fn,{blockletMeta:q.current.meta,onNext:()=>{fe()},onEndpointUpdate:be})})]})}),cancel:d("common.pre"),confirm:d("common.next"),onCancel:Ve,onConfirm:fe}),pe.push({key:"install",name:Xe(Y==null?void 0:Y.did)?d("common.upgrade"):d("common.install"),disabled:p?!1:He(P.installResultProps),loading:p?!1:He(P.installResultProps),body:e.jsx(Te,{component:"div",className:"flex-justify-center flex-align-center",style:{flexDirection:"column"},children:He(P.installResultProps)?e.jsx(Xs,{message:e.jsx(di,{children:d(p?"blocklet.component.installingCanCloseWindowTip":"blocklet.component.installingTip")}),increaseSpeed:.3,messageLoop:!1}):e.jsx("div",{style:{marginTop:120},children:e.jsx(Zn,{...P.installResultProps})})}),confirm:d("common.complete"),onConfirm:()=>{lo({timeout:0,componentDid:xe.componentDid,manual:!0}),wt(),setTimeout(()=>{const E=document.getElementsByClassName("dashboard-main")[0];E&&(E.scrollTop=E.scrollHeight)},200)}});const ae=pe[me]||{},Fo=()=>C||ae.error||!P.bundleDid?!0:me>1?!P.pathPrefix:!1;return B?e.jsxs(li,{sx:{width:"100%",height:oe?window.innerHeight:m?"72vh":"100vh"},children:[e.jsx($s,{steps:pe,mode:"memory",children:e.jsx(oi,{ref:w,meta:Y,isMobile:oe,onStepChange:E=>{Ze(E)}})}),e.jsxs(y,{className:"action-bar",children:[ae.cancel&&e.jsx(ne,{onClick:E=>{E.stopPropagation(),ae.onCancel()},disabled:me===pe.length-2&&C,color:"inherit",children:ae.cancel||d("common.cancel")}),ae.confirm&&e.jsx(ne,{onClick:E=>{E.stopPropagation(),ae.onConfirm()},color:"primary","data-cy":"submit-confirm-next",disabled:C||(typeof ae.disabled=="boolean"?ae.disabled:Fo()),variant:"contained",autoFocus:!0,title:ae.confirm,style:{marginLeft:8,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",minWidth:"140px",maxWidth:"280px",textAlign:"center"},children:e.jsxs(y,{display:"flex",alignItems:"center",children:[(typeof ae.loading=="boolean"?ae.loading:C)&&e.jsx(re,{style:{marginRight:8},size:16}),ae.confirm]})})]})]}):null}jn.propTypes={onClose:r.func,mode:r.oneOf(["normal","embed"]),inDialog:r.bool,stores:r.arrayOf(r.string),storeUrl:r.string,resourceType:r.string,resourceDid:r.string,storageKey:r.string,selectedMeta:r.object,showResourcesSwitch:r.bool,showFromUrl:r.bool,enableRunBackground:r.bool,showCategory:r.bool};jn.defaultProps={onClose:()=>{},mode:"normal",stores:[],storeUrl:"",resourceType:"",resourceDid:"",storageKey:"",inDialog:!0,selectedMeta:null,showResourcesSwitch:!0,showFromUrl:!0,enableRunBackground:!0,showCategory:!0};const li=F(y)`
322
+ `,oi=Cn,si=t=>t.inStore&&O.isFreeBlocklet(t)===!1,ri=t=>{var o;return[X.BLOCKLET_APP_SPACE_REQUIREMENT.REQUIRED,X.BLOCKLET_APP_SPACE_REQUIREMENT.REQUIRED_ON_SETUP].includes((o=t==null?void 0:t.capabilities)==null?void 0:o.didSpace)},Ot=t=>{var o,s;return((s=(o=t==null?void 0:t.configs)==null?void 0:o.find(a=>a.key===X.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_SPACE_ENDPOINT))==null?void 0:s.value)||null},ii=t=>(t.environments||[]).some(o=>o.required),ao=(t,o)=>t==null?void 0:t.some(s=>s.required&&!o[s.key]),ai=({params:t,blocklet:o,t:s})=>{const a=t.title||t.name;return a?((o==null?void 0:o.children)||[]).find(i=>i.meta.bundleDid===t.bundleDid)?s("blocklet.component.upgradeNext",{name:a}):s("blocklet.component.addNext",{name:a}):s("common.next")},lo=({componentDid:t,timeout:o=1e3,manual:s=!1}={})=>{setTimeout(()=>{window.parent.postMessage({event:"component.installed",componentDid:t,manual:s},"*")},o)};function jn({onClose:t,mode:o,stores:s,resourceType:a,resourceDid:n,storageKey:i,inDialog:m,selectedMeta:l,storeUrl:u,showResourcesSwitch:h,showFromUrl:g,enableRunBackground:p,showCategory:S}){var Ln,On,Mn,$e,Fn,et,Gn;const{t:d,locale:b}=z(),[C,x]=f.useState(!1),[R,c]=f.useState(null),[v,j]=f.useState(""),[T,I]=f.useState(""),{api:U,ws:{useSubscription:L},inService:k,info:M}=J(),{blocklet:B,actions:{refreshBlocklet:q}}=ie(),[Q,Ie]=f.useState(null),[te,de]=f.useState(!1),Se={bundleDid:"",componentDid:"",componentName:"",pathPrefix:"",name:"",title:"",configsList:[],configsValue:{},hasMissRequiredConfigs:!1,hasEnvironmentsStep:!1,hasRequiredEnvironments:!1,requirePurchase:!1,didSpaceIsRequiredSetup:null,installResultProps:{},purchaseResultProps:{},showFromUrlDialog:!1},[P,ke]=f.useState(Se),[me,Ze]=f.useState(0),V=f.useRef({}),w=f.useRef({}),_=f.useRef({}),oe=Wt(E=>E.breakpoints.down("md")),xe=as(),[se,Ge]=f.useState(!0),{meta:Y}=V.current,H=E=>ke(N=>({...N,...E}));f.useEffect(()=>{if(P.pathPrefix){const{errMsg:E}=An({...P,pathPrefix:P.pathPrefix,locale:b});j(E)}},[P.pathPrefix]),f.useEffect(()=>{me===0&&ke(Se)},[me]);const be=()=>{const E=Ot(B)??"";H({didSpaceEndpoint:E})},ze=()=>{var E;return(E=V==null?void 0:V.current)!=null&&E.meta?O.getDisplayName(V.current):""},Ue=E=>{const N=G=>{H({installResultProps:{variant:"error",title:ze(),subTitle:E,footer:e.jsx(ne,{className:"bottom-button",disabled:G,"data-cy":"retry-install-component",onClick:async()=>{N(!0),await Nn(V.current.installInput)},children:e.jsxs(y,{display:"flex",alignItems:"center",children:[G&&e.jsx(re,{size:16,style:{marginRight:8}}),d("common.retry")]})})}})};N()},Tt=E=>N=>{var G,W;(((G=N==null?void 0:N.meta)==null?void 0:G.did)||(N==null?void 0:N.meta))===((W=B==null?void 0:B.meta)==null?void 0:W.did)&&E(N)};L(X.BlockletEvents.statusChange,Tt(E=>{switch(E.status){case X.BlockletStatus.upgrading:H({installResultProps:{variant:"success",title:ze(),subTitle:d("blocklet.component.installSuccessTip")}}),lo({componentDid:xe.componentDid});break}const N=Ot(B);H(G=>({...G,didSpaceEndpoint:N}))}),[(Ln=B==null?void 0:B.meta)==null?void 0:Ln.did]),L(X.BlockletEvents.downloadFailed,Tt(()=>{Ue(d("blocklet.component.installComponentError"))}),[(On=B==null?void 0:B.meta)==null?void 0:On.did]),L(X.BlockletEvents.installFailed,Tt(()=>{Ue(d("blocklet.component.installComponentError"))}),[(Mn=B==null?void 0:B.meta)==null?void 0:Mn.did]);const pe=[],wt=()=>{x(!1),ke({}),V.current={},t()},Xe=E=>((B==null?void 0:B.children)||[]).some(N=>N.meta.did===E),Nn=async E=>{var Be,Ne;const{pathPrefix:N,bundleDid:G,title:W,componentName:Re="",componentDid:De=""}=P,Ee=((Be=V.current)==null?void 0:Be.meta)||{},{configs:ye=[],registryUrl:je,inStore:Ve,inputUrl:_e,dist:It}=Ee,We=(Ne=V.current)==null?void 0:Ne.downloadTokenList,le=Ve?Hn(je,G,It):_e;x(!0);const tt={rootDid:B.meta.did,url:le,mountPoint:N?ue(N):`/${ue(Ee.title||Ee.name)}`,title:W,name:Re,did:De,onlyRequired:!se,...P.hasEnvironmentsStep&&ye.length>0?{configs:ye.map(he=>({...he,value:P.configsValue[he.key]||""}))}:{},...We?{downloadTokenList:We}:{},...E};try{if(await U.installComponent({input:tt}),je){const{teamDid:he,storeList:Ae}=ho({fromBlocklet:k,nodeInfo:M,blocklet:B}),{isNew:kt,decoded:nt}=ds(je,Ae);kt&&await U.addBlockletStore({input:{teamDid:he,url:nt}})}H({installResultProps:{}}),q({showError:!1,attachRuntimeInfo:!1})}catch(he){const Ae=Z(he);A.error(Ae),console.error("installComponent error: ",he),Ue(Ae)}finally{x(!1),V.current.installInput=tt}},An=E=>({errMsg:vo({params:{...E,did:E.bundleDid},blocklets:[B],blocklet:B,locale:b})}),fe=async E=>{var G,W;const{errMsg:N}=An({...P,locale:b});j(N),me===pe.length-2&&await Nn(E),(W=(G=w.current)==null?void 0:G.setActiveStepByIndex)==null||W.call(G,Re=>Re+1)},qe=()=>{var E,N;(N=(E=w.current)==null?void 0:E.setActiveStepByIndex)==null||N.call(E,G=>G-1)},Lo=()=>{const{pathPrefix:E,bundleDid:N,title:G,componentName:W="",componentDid:Re=""}=P,{meta:De={}}=V.current||{},{registryUrl:Ee,inStore:ye,inputUrl:je,dist:Ve}=De,_e=ye?Hn(Ee,N,Ve):je;Ie({meta:De,installOpts:{type:"component",rootDid:B.meta.did,mountPoint:E,url:_e,title:G,name:W,did:Re}})},Oo=E=>{de(!1),H({purchaseResultProps:{variant:"error",title:ze(),subTitle:E,style:{paddingTop:120},footer:e.jsx(ne,{className:"bottom-button","data-cy":"retry-purchase-component",onClick:()=>{H({purchaseResultProps:{}})},children:d("common.retry")})}})},Mo=({downloadTokenList:E})=>{V.current.downloadTokenList=E,de(!1),fe()},Pt=({chooseParams:E=V.current,componentDid:N,isInit:G=!1})=>{var nt,zn,qn,Vn;const{meta:W,registryUrl:Re,inStore:De,inputUrl:Ee}=E,{did:ye,title:je,name:Ve}=W,_e=(((nt=B.settings)==null?void 0:nt.children)||[]).filter(ce=>ce.status==="deleted"&&ce.meta.bundleDid===ye),It=N||"",We=(zn=W.environments)==null?void 0:zn.map(ce=>{const{name:Ut,validation:ot,...st}=ce,Dt={validation:ls(ot)?"":ot};return{...st,key:Ut,...Dt}});V.current={...E,meta:{...W,configs:We,registryUrl:Re,inStore:De,inputUrl:Ee}};let le={};if(G){const ce=[B],Ut=We||[],ot=[],st=jo(cs([...Ut,...ot]),"key").filter(Le=>!!Le.key).sort((Le,rt)=>Le.required&&!rt.required?-1:rt.required&&!Le.required?1:0),Dt=O.getSharedConfigObj(ce[0],{configs:st}),Bt={},_n=st.map(Le=>{const{default:rt,key:it,...Go}=Le;return Bt[it]=Dt[it]||rt,{...Go,key:it,hidden:!!X.BLOCKLET_CONFIGURABLE_KEY[it]}});le={...le,configsList:_n,configsValue:Bt,hasMissRequiredConfigs:ao(_n,Bt)}}const tt=B.children.some(ce=>ce.mountPoint==="/"),Be=_e.find(ce=>ce.meta.bundleDid===ye),Ne=B.children.find(ce=>ce.meta.bundleDid===ye);le.title=je||"",Be?le={...le,pathPrefix:Be.mountPoint||"",componentName:Be.meta.name,hasEnvironmentsStep:!1}:Ne?le={...le,pathPrefix:Ne.mountPoint||"",componentName:Ne.meta.name,hasEnvironmentsStep:!1}:le={...le,pathPrefix:tt?`/${ue(je)||ue(Ve)}`.toLowerCase():"/",componentName:"",hasEnvironmentsStep:((Vn=(qn=V.current.meta)==null?void 0:qn.environments)==null?void 0:Vn.length)>0};const he=si(V.current.meta),Ae=ri(V.current.meta),kt=Ot(B);H({bundleDid:ye,componentDid:It,...le,hasRequiredEnvironments:ii(V.current.meta),requirePurchase:he,didSpaceIsRequiredSetup:Ae,didSpaceEndpoint:kt}),G&&he&&Lo()};f.useEffect(()=>{!l||me!==0||!B||(Pt({chooseParams:{blocklets:[l],meta:l,registryUrl:u||l.homepage,inStore:!0},isInit:!0}),H({showFromUrlDialog:!1}),fe())},[l,me,B]),pe.push({key:"selectComponent",name:d("blocklet.component.selectComponent"),body:e.jsxs(Te,{sx:{width:400},component:"div",children:[g&&P.showFromUrlDialog&&e.jsx(dr,{mode:"component",onCancel:()=>{H({showFromUrlDialog:!1})},onSuccess:({meta:E,inputUrl:N,inStore:G,registryUrl:W})=>{Pt({chooseParams:{meta:E,inputUrl:N,inStore:G,registryUrl:W},isInit:!0}),H({showFromUrlDialog:!1}),fe()},handleText:{title:d("blocklet.component.addComponentTip.fromUrl"),confirm:d("blocklet.component.choose")}}),e.jsx(hn,{stores:s,extra:To.isInServerlessMode(M)?null:g?e.jsxs(ne,{variant:"text",color:"primary","data-cy":"add-component-from-url",onClick:()=>{H({showFromUrlDialog:!0})},style:{padding:"0 2px"},children:[e.jsx(Qt,{style:{fontSize:20,marginRight:4}})," ",d("blocklet.component.addComponentTip.fromUrl")," "]}):null,loading:C,onChange:()=>{ke({}),V.current={}},storageKey:i,children:({currentRegistry:E})=>e.jsx(yn,{showResourcesSwitch:h,showCategory:S,serverVersion:M==null?void 0:M.version,style:oe?{height:"calc(100vh - 56px - 80px - 32px - 40px )"}:{height:"calc(100% - 40px)"},storeUrl:E.url,resourceType:a,resourceDid:n,handleButtonClick:N=>{Pt({chooseParams:{...N,inStore:!0},isInit:!0})},handleBlockletRender:({blocklet:N,defaultRender:G})=>{const W=(P==null?void 0:P.bundleDid)&&(P==null?void 0:P.bundleDid)===(N==null?void 0:N.did);return e.jsxs(ci,{children:[W&&e.jsx("div",{className:"check-container",children:e.jsx(fo,{className:"check-icon"})}),e.jsx("div",{className:W?"choose-blocklet":"",style:{marginLeft:16},children:G})]})}})})]}),cancel:o==="embed"?void 0:d("common.cancel"),confirm:ai({params:P,blocklet:B,t:d}),onCancel:wt,onConfirm:()=>{fe()}}),pe.push({key:"agreement",name:d("launchBlocklet.introduction"),body:e.jsxs(Te,{component:"div",className:"agreement-wrapper",children:[e.jsx(Co,{title:d("launchBlocklet.introduction"),subTitle:d("blocklet.component.addComponentTip.introduction")}),e.jsx(Ps,{meta:Y,onClickNext:fe,installRelated:se,onChangeInstallRelated:Ge,handleDescEle:e.jsx("p",{children:d("blocklet.component.addComponentTip.belowInformation")})})]}),cancel:l?void 0:d("common.pre"),confirm:d("launchBlocklet.next"),onCancel:l?wt:qe,onConfirm:()=>{de(!1),fe()}}),Y&&P.requirePurchase&&pe.push({key:"purchase",name:e.jsxs(e.Fragment,{children:[d("common.verifyNFT"),e.jsx(ct,{})]}),body:e.jsxs(Te,{component:"div",className:"flex-align-center",style:{flexDirection:"column"},children:[!(((Fn=($e=_.current)==null?void 0:$e.getCurrentStep)==null?void 0:Fn.call($e))===2||te)&&e.jsx(lt,{title:d("common.verifyNFT"),subTitle:d("blocklet.component.addComponentTip.verifyNFT")}),He(P.purchaseResultProps)?Q&&e.jsx(zr,{ref:_,meta:Q.meta,mode:P.componentDid?"verify":"both",onCancel:Oo,installOpts:Q.installOpts,handlePaySuccess:Mo}):e.jsx("div",{className:"flex-align-center flex-justify-center",children:e.jsx(Zn,{...P.purchaseResultProps})})]}),disabled:((Gn=(et=_.current)==null?void 0:et.getCurrentStep)==null?void 0:Gn.call(et))===2||te,cancel:d("common.pre"),confirm:d("common.next"),onConfirm:()=>{typeof _.current.onNext=="function"&&(_.current.onNext(),de(!0))},onCancel:()=>{qe()}}),O.hasStartEngine(Y)&&!Xe(Y.did)&&pe.push({key:"config",name:d("common.config"),error:v,body:e.jsxs(Te,{component:"div",children:[e.jsx(lt,{title:d("common.config"),subTitle:d("blocklet.component.addComponentTip.config")}),e.jsx(K,{label:d("blocklet.component.mountPoint"),autoComplete:"off",variant:"outlined",name:"pathPrefix",inputProps:{"data-cy":"mount-point-input"},fullWidth:!0,helperText:T||d("blocklet.component.mountPointTip"),style:{marginBottom:32},margin:"normal",value:P.pathPrefix,onChange:E=>{const N=E.target.value;H({pathPrefix:N}),I(d("common.slugifyHint",{value:gt(N)}))}}),!!v&&e.jsx(dt,{severity:"error",style:{width:"100%",marginTop:8},children:v})]}),cancel:d("common.pre"),confirm:d("common.next"),onCancel:qe,onConfirm:()=>{fe()}}),Y&&!Xe(Y.did)&&(P!=null&&P.hasEnvironmentsStep)&&pe.push({key:"environment",name:e.jsxs(e.Fragment,{children:[d("common.environment")," ",P.hasRequiredEnvironments&&e.jsx(ct,{})]}),disabled:!!R||(P==null?void 0:P.hasMissRequiredConfigs),body:()=>e.jsxs(Te,{component:"div",children:[e.jsx(lt,{title:d("common.environment"),subTitle:d("blocklet.component.addComponentTip.environment")}),e.jsx(rn,{style:{marginTop:-12,width:"100%"},schema:P.configsList,defaultValue:P.configsValue,onChange:(E,{action:N,currentItem:G,allValues:W})=>{N==="confirm"&&H({hasMissRequiredConfigs:ao(P.configsList,W),configsValue:W}),N==="edit"?c(G):["cancel","confirm"].includes(N)&&c(null)}})]}),cancel:d("common.pre"),confirm:d("common.next"),onCancel:qe,onConfirm:fe}),Y&&!Xe(Y.did)&&(P!=null&&P.didSpaceIsRequiredSetup)&&pe.push({key:"didSpace",name:e.jsxs(e.Fragment,{children:[d("blocklet.component.didSpaceConfig")," ",P.didSpaceIsRequiredSetup==="required"&&e.jsx(ct,{})]}),disabled:(P==null?void 0:P.didSpaceIsRequiredSetup)&&!P.didSpaceEndpoint,body:()=>e.jsx($t,{children:e.jsxs(Te,{component:"div",children:[e.jsx(lt,{title:d("blocklet.component.didSpaceConfig"),subTitle:d("blocklet.component.didSpaceConfigTip")}),e.jsx(y,{sx:{mt:"36px","& > div":{maxWidth:"unset !important","& .MuiAutocomplete-root":{maxWidth:"unset !important"}}},children:e.jsx(fn,{blockletMeta:V.current.meta,onNext:()=>{fe()},onEndpointUpdate:be})})]})}),cancel:d("common.pre"),confirm:d("common.next"),onCancel:qe,onConfirm:fe}),pe.push({key:"install",name:Xe(Y==null?void 0:Y.did)?d("common.upgrade"):d("common.install"),disabled:p?!1:He(P.installResultProps),loading:p?!1:He(P.installResultProps),body:e.jsx(Te,{component:"div",className:"flex-justify-center flex-align-center",style:{flexDirection:"column"},children:He(P.installResultProps)?e.jsx(Xs,{message:e.jsx(di,{children:d(p?"blocklet.component.installingCanCloseWindowTip":"blocklet.component.installingTip")}),increaseSpeed:.3,messageLoop:!1}):e.jsx("div",{style:{marginTop:120},children:e.jsx(Zn,{...P.installResultProps})})}),confirm:d("common.complete"),onConfirm:()=>{lo({timeout:0,componentDid:xe.componentDid,manual:!0}),wt(),setTimeout(()=>{const E=document.getElementsByClassName("dashboard-main")[0];E&&(E.scrollTop=E.scrollHeight)},200)}});const ae=pe[me]||{},Fo=()=>C||ae.error||!P.bundleDid?!0:me>1?!P.pathPrefix:!1;return B?e.jsxs(li,{sx:{width:"100%",height:oe?window.innerHeight:m?"72vh":"100vh"},children:[e.jsx($s,{steps:pe,mode:"memory",children:e.jsx(oi,{ref:w,meta:Y,isMobile:oe,onStepChange:E=>{Ze(E)}})}),e.jsxs(y,{className:"action-bar",children:[ae.cancel&&e.jsx(ne,{onClick:E=>{E.stopPropagation(),ae.onCancel()},disabled:me===pe.length-2&&C,color:"inherit",children:ae.cancel||d("common.cancel")}),ae.confirm&&e.jsx(ne,{onClick:E=>{E.stopPropagation(),ae.onConfirm()},color:"primary","data-cy":"submit-confirm-next",disabled:C||(typeof ae.disabled=="boolean"?ae.disabled:Fo()),variant:"contained",autoFocus:!0,title:ae.confirm,style:{marginLeft:8,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",minWidth:"140px",maxWidth:"280px",textAlign:"center"},children:e.jsxs(y,{display:"flex",alignItems:"center",children:[(typeof ae.loading=="boolean"?ae.loading:C)&&e.jsx(re,{style:{marginRight:8},size:16}),ae.confirm]})})]})]}):null}jn.propTypes={onClose:r.func,mode:r.oneOf(["normal","embed"]),inDialog:r.bool,stores:r.arrayOf(r.string),storeUrl:r.string,resourceType:r.string,resourceDid:r.string,storageKey:r.string,selectedMeta:r.object,showResourcesSwitch:r.bool,showFromUrl:r.bool,enableRunBackground:r.bool,showCategory:r.bool};jn.defaultProps={onClose:()=>{},mode:"normal",stores:[],storeUrl:"",resourceType:"",resourceDid:"",storageKey:"",inDialog:!0,selectedMeta:null,showResourcesSwitch:!0,showFromUrl:!0,enableRunBackground:!0,showCategory:!0};const li=F(y)`
323
323
  .action-bar {
324
324
  display: flex;
325
325
  justify-content: flex-end;
@@ -399,7 +399,7 @@ import{bM as zo,j as e,aK as qt,aL as _t,q as z,O as y,ax as ve,P as r,A,bn as J
399
399
  &.Mui-disabled {
400
400
  opacity: 0.5;
401
401
  }
402
- `;function Pn({sourceInfo:t,blocklet:o}){var a;const{t:s}=f.useContext(Ce);return e.jsxs(y,{display:"flex",alignItems:"center",children:[e.jsx(hs,{type:"success",children:er(t.source)},"source"),t.source==="registry"&&e.jsx(yt,{href:we(t.deployedFrom,"blocklets",((a=o==null?void 0:o.meta)==null?void 0:a.bundleDid)||""),target:"_blank",className:"page-link",underline:"hover",style:{display:"flex",alignItems:"center",marginLeft:8},children:s("blocklet.overview.viewInStore")})]})}Pn.propTypes={sourceInfo:r.shape({source:r.string,deployedFrom:r.string}),blocklet:r.object};Pn.defaultProps={sourceInfo:{},blocklet:{}};var In={},Ci=_t;Object.defineProperty(In,"__esModule",{value:!0});var Bo=In.default=void 0,ji=Ci(qt()),vi=e;Bo=In.default=(0,ji.default)((0,vi.jsx)("path",{d:"m4 12 1.41 1.41L11 7.83V20h2V7.83l5.58 5.59L20 12l-8-8z"}),"ArrowUpward");function Et({blocklet:t,checkUpgrade:o,hasPermission:s,...a}){const{api:n}=J(),{t:i}=f.useContext(Ce),[m,l]=f.useState(!1),[u,h]=f.useState(""),[g,p]=f.useState(null),[S,d]=f.useState(null);f.useEffect(()=>{p(null),o&&(t.mode,X.BLOCKLET_MODES.DEVELOPMENT)},[t,o]);const b=()=>{l(!1),d(null)},C=async()=>{l(!0);try{const R={did:t.meta.did,version:g.version,storeUrl:g.registryUrl||""};await Ye(2e3),await n.upgradeBlocklet({input:R})}catch(R){A.error(`Blocklet upgrade failed: ${Z(R)}`)}finally{l(!1),d(null)}},x={title:`${i("common.upgrade")} ${i("common.blocklet")} ${O.getDisplayName(t)}`,description:i("blocklet.action.upgradeDescription"),confirm:i("blocklet.action.confirmUpgrade"),cancel:i("common.cancel"),onConfirm:C,onCancel:b};return s&&g&&!O.isInProgress(t.status)?e.jsxs(e.Fragment,{children:[e.jsx(Qe,{...a,children:t.meta.version}),e.jsx(ve,{title:i("common.updateAvailable",{version:g.version}),children:e.jsx($,{size:"small",style:{marginLeft:8},disabled:m,onClick:()=>d(x),children:m?e.jsx(re,{size:16}):e.jsx(Bo,{style:{fontSize:16,color:"red"}})})}),!!u&&e.jsx(A,{variant:"error",message:u,onClose:()=>h("")}),S&&e.jsx(Fe,{title:S.title,description:S.description,confirm:S.confirm,cancel:S.cancel,params:S.params,onConfirm:S.onConfirm,onCancel:S.onCancel})]}):e.jsx(Qe,{...a,children:t.meta.version})}Et.propTypes={blocklet:r.object.isRequired,checkUpgrade:r.bool,hasPermission:r.bool};Et.defaultProps={checkUpgrade:!1,hasPermission:!1};const Si=Me(Et,"mutate_blocklets"),bi=Me(Et,"",Oe);function Ri(t){const{inService:o}=J();return o?e.jsx(bi,{...t}):e.jsx(Si,{...t})}const Ei=t=>{var o;return!((o=t==null?void 0:t.meta)!=null&&o.group)},Ti=(t,o)=>t?[{name:o("common.name"),value:t.displayName},{name:o("common.description"),value:t.description},{name:o("common.version"),value:e.jsx(Qe,{children:t.version})}]:[],wi=t=>{const{source:o,deployedFrom:s,bundleSource:a}=t;return o?{source:o,deployedFrom:s}:a?a.url?{source:"url",deployedFrom:s||Array.isArray(a.url)?a.url[0]:a.url}:a.store?{source:"registry",deployedFrom:s||Array.isArray(a.store)?a.store[0]:a.store}:{}:{source:"upload",deployedFrom:s}},Pi=(t,o)=>{const s=t.split("/").slice(1);let a=o,n=0;const i=[];for(;a&&n<s.length;){const m=a.children.find(l=>l.meta.did===s[n]);a=m,n++,m&&i.push(m.meta.title)}return i.join(" / ")};function kn({blocklet:t,depth:o,componentInfo:s,app:a,onClose:n}){var d,b;const{t:i,locale:m}=f.useContext(Ce),{deletingBlocklets:l}=Kt();let{status:u}=t;o===1&&l.includes(t.meta.did)&&(u="deleting");const h=`/${t.mountPoint||"/"}`.replace(/\/+/g,"/"),g=C=>C.map(x=>x.name===i("common.did")||x.name===i("blocklet.appId")?e.jsx(At,{valueComponent:"div",nameWidth:120,name:x.name,nameFormatter:()=>x.name,children:x.value},x.name):e.jsx(At,{valueComponent:"div",nameWidth:120,name:x.name,children:x.value},x.name)),p=s?wi(s):{},S=s?[{name:i("common.name"),value:O.getDisplayName(s,!0)},{name:i("common.version"),value:e.jsx(Ri,{blocklet:s,checkUpgrade:!1})},{name:i("common.status"),value:e.jsx(bo,{isResource:Ei(t),status:u,source:s.source,progress:t.progress})},t.status==="running"?{name:i("blocklet.startedAt"),value:Nt(t.startedAt,m)}:null,t.status!=="running"?{name:i("blocklet.stoppedAt"),value:Nt(t.stoppedAt,m)}:null,t.installedAt?{name:i("blocklet.installedAt"),value:Nt(t.installedAt,m)}:null,O.hasStartEngine(t.meta)?{name:i("common.mountPoint"),value:h}:null,s.meta.group?{name:i("common.group"),value:e.jsx(Qe,{type:"success",children:s.meta.group})}:null,{name:i("blocklet.overview.source"),value:e.jsx(Pn,{sourceInfo:p,blocklet:t})},{name:i("blocklet.overview.deployedFrom"),value:p.deployedFrom||"-"},{name:i("common.did"),value:e.jsx(mo,{did:s.meta.did,showQrcode:!0})},{name:i("common.author"),value:gs(s.meta.author)},{name:i("common.engine"),value:Ti(s.engine,i).map(({name:C,value:x})=>e.jsx(At,{style:{marginBottom:4},nameWidth:120,name:C,children:x},C))},(d=t.dependents)!=null&&d.length?{name:i("common.dependents"),value:e.jsx(y,{children:t.dependents.map(C=>e.jsx(y,{children:`${Pi(C.id,a)} ${C.required?`(${i("common.required")})`:""}`},C.id))})}:null,(b=t.meta.resources)!=null&&b.length?{name:i("common.resource"),value:t.meta.resources.join(", ")}:null].filter(Boolean):[];return s?e.jsx(xt,{open:!0,title:i("common.componentBasicInfo"),showCloseButton:!0,fullWidth:!0,maxWidth:"md",onClose:()=>{n(null)},children:e.jsx(y,{paddingBottom:1.5,children:g(S)},"dialog-wrapper")},"base-info-dialog"):null}kn.propTypes={blocklet:r.object.isRequired,depth:r.number,app:r.object,componentInfo:r.object,onClose:r.func.isRequired};kn.defaultProps={depth:0,app:null,componentInfo:null};F(xo)`
402
+ `;function Pn({sourceInfo:t,blocklet:o}){var a;const{t:s}=f.useContext(Ce);return e.jsxs(y,{display:"flex",alignItems:"center",children:[e.jsx(hs,{type:"success",children:er(t.source)},"source"),t.source==="registry"&&e.jsx(yt,{href:we(t.deployedFrom,"blocklets",((a=o==null?void 0:o.meta)==null?void 0:a.bundleDid)||""),target:"_blank",className:"page-link",underline:"hover",style:{display:"flex",alignItems:"center",marginLeft:8},children:s("blocklet.overview.viewInStore")})]})}Pn.propTypes={sourceInfo:r.shape({source:r.string,deployedFrom:r.string}),blocklet:r.object};Pn.defaultProps={sourceInfo:{},blocklet:{}};var In={},Ci=_t;Object.defineProperty(In,"__esModule",{value:!0});var Bo=In.default=void 0,ji=Ci(Vt()),vi=e;Bo=In.default=(0,ji.default)((0,vi.jsx)("path",{d:"m4 12 1.41 1.41L11 7.83V20h2V7.83l5.58 5.59L20 12l-8-8z"}),"ArrowUpward");function Et({blocklet:t,checkUpgrade:o,hasPermission:s,...a}){const{api:n}=J(),{t:i}=f.useContext(Ce),[m,l]=f.useState(!1),[u,h]=f.useState(""),[g,p]=f.useState(null),[S,d]=f.useState(null);f.useEffect(()=>{p(null),o&&(t.mode,X.BLOCKLET_MODES.DEVELOPMENT)},[t,o]);const b=()=>{l(!1),d(null)},C=async()=>{l(!0);try{const R={did:t.meta.did,version:g.version,storeUrl:g.registryUrl||""};await Ye(2e3),await n.upgradeBlocklet({input:R})}catch(R){A.error(`Blocklet upgrade failed: ${Z(R)}`)}finally{l(!1),d(null)}},x={title:`${i("common.upgrade")} ${i("common.blocklet")} ${O.getDisplayName(t)}`,description:i("blocklet.action.upgradeDescription"),confirm:i("blocklet.action.confirmUpgrade"),cancel:i("common.cancel"),onConfirm:C,onCancel:b};return s&&g&&!O.isInProgress(t.status)?e.jsxs(e.Fragment,{children:[e.jsx(Qe,{...a,children:t.meta.version}),e.jsx(ve,{title:i("common.updateAvailable",{version:g.version}),children:e.jsx($,{size:"small",style:{marginLeft:8},disabled:m,onClick:()=>d(x),children:m?e.jsx(re,{size:16}):e.jsx(Bo,{style:{fontSize:16,color:"red"}})})}),!!u&&e.jsx(A,{variant:"error",message:u,onClose:()=>h("")}),S&&e.jsx(Fe,{title:S.title,description:S.description,confirm:S.confirm,cancel:S.cancel,params:S.params,onConfirm:S.onConfirm,onCancel:S.onCancel})]}):e.jsx(Qe,{...a,children:t.meta.version})}Et.propTypes={blocklet:r.object.isRequired,checkUpgrade:r.bool,hasPermission:r.bool};Et.defaultProps={checkUpgrade:!1,hasPermission:!1};const Si=Me(Et,"mutate_blocklets"),bi=Me(Et,"",Oe);function Ri(t){const{inService:o}=J();return o?e.jsx(bi,{...t}):e.jsx(Si,{...t})}const Ei=t=>{var o;return!((o=t==null?void 0:t.meta)!=null&&o.group)},Ti=(t,o)=>t?[{name:o("common.name"),value:t.displayName},{name:o("common.description"),value:t.description},{name:o("common.version"),value:e.jsx(Qe,{children:t.version})}]:[],wi=t=>{const{source:o,deployedFrom:s,bundleSource:a}=t;return o?{source:o,deployedFrom:s}:a?a.url?{source:"url",deployedFrom:s||Array.isArray(a.url)?a.url[0]:a.url}:a.store?{source:"registry",deployedFrom:s||Array.isArray(a.store)?a.store[0]:a.store}:{}:{source:"upload",deployedFrom:s}},Pi=(t,o)=>{const s=t.split("/").slice(1);let a=o,n=0;const i=[];for(;a&&n<s.length;){const m=a.children.find(l=>l.meta.did===s[n]);a=m,n++,m&&i.push(m.meta.title)}return i.join(" / ")};function kn({blocklet:t,depth:o,componentInfo:s,app:a,onClose:n}){var d,b;const{t:i,locale:m}=f.useContext(Ce),{deletingBlocklets:l}=Kt();let{status:u}=t;o===1&&l.includes(t.meta.did)&&(u="deleting");const h=`/${t.mountPoint||"/"}`.replace(/\/+/g,"/"),g=C=>C.map(x=>x.name===i("common.did")||x.name===i("blocklet.appId")?e.jsx(At,{valueComponent:"div",nameWidth:120,name:x.name,nameFormatter:()=>x.name,children:x.value},x.name):e.jsx(At,{valueComponent:"div",nameWidth:120,name:x.name,children:x.value},x.name)),p=s?wi(s):{},S=s?[{name:i("common.name"),value:O.getDisplayName(s,!0)},{name:i("common.version"),value:e.jsx(Ri,{blocklet:s,checkUpgrade:!1})},{name:i("common.status"),value:e.jsx(bo,{isResource:Ei(t),status:u,source:s.source,progress:t.progress})},t.status==="running"?{name:i("blocklet.startedAt"),value:Nt(t.startedAt,m)}:null,t.status!=="running"?{name:i("blocklet.stoppedAt"),value:Nt(t.stoppedAt,m)}:null,t.installedAt?{name:i("blocklet.installedAt"),value:Nt(t.installedAt,m)}:null,O.hasStartEngine(t.meta)?{name:i("common.mountPoint"),value:h}:null,s.meta.group?{name:i("common.group"),value:e.jsx(Qe,{type:"success",children:s.meta.group})}:null,{name:i("blocklet.overview.source"),value:e.jsx(Pn,{sourceInfo:p,blocklet:t})},{name:i("blocklet.overview.deployedFrom"),value:p.deployedFrom||"-"},{name:i("common.did"),value:e.jsx(mo,{did:s.meta.did,showQrcode:!0})},{name:i("common.author"),value:gs(s.meta.author)},{name:i("common.engine"),value:Ti(s.engine,i).map(({name:C,value:x})=>e.jsx(At,{style:{marginBottom:4},nameWidth:120,name:C,children:x},C))},(d=t.dependents)!=null&&d.length?{name:i("common.dependents"),value:e.jsx(y,{children:t.dependents.map(C=>e.jsx(y,{children:`${Pi(C.id,a)} ${C.required?`(${i("common.required")})`:""}`},C.id))})}:null,(b=t.meta.resources)!=null&&b.length?{name:i("common.resource"),value:t.meta.resources.join(", ")}:null].filter(Boolean):[];return s?e.jsx(xt,{open:!0,title:i("common.componentBasicInfo"),showCloseButton:!0,fullWidth:!0,maxWidth:"md",onClose:()=>{n(null)},children:e.jsx(y,{paddingBottom:1.5,children:g(S)},"dialog-wrapper")},"base-info-dialog"):null}kn.propTypes={blocklet:r.object.isRequired,depth:r.number,app:r.object,componentInfo:r.object,onClose:r.func.isRequired};kn.defaultProps={depth:0,app:null,componentInfo:null};F(xo)`
403
403
  .BaseBadge-badge {
404
404
  top: ${t=>t.top*8||6}px;
405
405
  right: ${t=>t.right*8||6}px;
@@ -421,12 +421,15 @@ import{bM as zo,j as e,aK as qt,aL as _t,q as z,O as y,ax as ve,P as r,A,bn as J
421
421
  margin-left: 4px;
422
422
  transform: translateY(-1px);
423
423
  }
424
- `;function No({blocklet:t,ancestors:o,mountPoint:s,href:a}){const[n,i]=f.useState(!1),[m,l]=f.useState(!1),[u,h]=f.useState(!1),[g,p]=f.useState(s),{api:S}=J(),d=!o.length,b=d?t.meta.did:o.map(c=>c.meta.did)[0];f.useEffect(()=>{l(!1),i(!1),h(!1)},[s]);const C=()=>{i(!1),l(!1),p(s)},x=async c=>{c.preventDefault(),h(!0),i(!1);try{const v={rootDid:b,mountPoint:ue(g)};d||(v.did=t.meta.did),await S.updateComponentMountPoint({input:v})}catch(v){throw h(!1),v.message=Z(v),A.error(v.message),v}},R=m?e.jsxs(y,{sx:{ml:1},children:[e.jsx($,{size:"medium",onMouseEnter:()=>i(!0),onMouseLeave:()=>i(!1),"data-cy":"edit-mount-point-submit",onClick:x,children:e.jsx(y,{component:Pe,icon:"material-symbols:done",sx:{color:"primary.main",transition:"0.3s opacity"}})}),e.jsx($,{size:"medium",onMouseEnter:()=>i(!0),onMouseLeave:()=>i(!1),onClick:C,children:e.jsx(y,{component:Pe,icon:"iconoir:cancel",sx:{color:"primary.main",transition:"0.3s opacity"}})})]}):e.jsx($,{size:"medium",onMouseEnter:()=>i(!0),onMouseLeave:()=>i(!1),onClick:()=>l(!0),children:e.jsx(y,{component:Pe,"data-cy":"edit-mount-point",icon:"lets-icons:edit-light",sx:{opacity:n?1:0,color:"primary.main",transition:"0.3s opacity"}})});return e.jsxs(y,{sx:{display:{xs:"none",md:"flex"}},alignItems:"center",flexGrow:"1",children:[m?e.jsx("form",{onSubmit:x,children:e.jsx(K,{style:{flex:1},fullWidth:!0,"data-cy":"edit-mount-point-input",value:g,onChange:c=>p(c.target.value),autoFocus:!0,size:"small",variant:"outlined",placeholder:s})}):e.jsx(y,{component:"a",target:"_blank",href:a,rel:"noopener noreferrer",title:a,onMouseEnter:()=>i(!0),onMouseLeave:()=>i(!1),children:e.jsx(y,{maxWidth:400,sx:{color:"secondary.main",fontSize:16,px:2},overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis",children:xs(s)})}),u?e.jsx(re,{size:20,sx:{ml:1}}):R]},s)}No.propTypes={mountPoint:r.string.isRequired,href:r.string.isRequired,blocklet:r.object.isRequired,ancestors:r.array.isRequired};const Ii=t=>{var o;return!((o=t==null?void 0:t.meta)!=null&&o.group)},co=(t,o)=>{const s=t.split("/").slice(1);let a=o,n=0;const i=[];for(;a&&n<s.length;){const m=a.children.find(l=>l.meta.did===s[n]);a=m,n++,m&&i.push(m.meta.title)}return i.join(" / ")};function ht({blocklet:t,ancestors:o,depth:s,onRemove:a,onStart:n,onStop:i,onRestart:m,getComponentUrl:l,app:u}){var V,Q,Ie;const{t:h}=f.useContext(Ce),[g,p]=f.useState(),[S,d]=f.useState(!1),[b,C]=f.useState(!1),[x,R]=f.useState(null),[c,v]=f.useState(!1),{deletingBlocklets:j}=Kt();let{status:T}=t;s===1&&j.includes(t.meta.did)&&(T="deleting");const I=`/${t.mountPoint||"/"}`.replace(/\/+/g,"/"),U=l(I),L=O.isInProgress(u.status),k=O.isInProgress(t.status);let M="";if(L||k||s===1&&j.includes(t.meta.did))M=h("blocklet.component.tip.stopBlocklet");else if((V=t.dependents)!=null&&V.length){const te=t.dependents.filter(de=>de.required);if(te.length){const de=te.map(Se=>co(Se.id,u));M=h("blocklet.component.tip.requiredBy",{name:de.join(", ")})}}const B=async(...te)=>{C(!0);try{await a(...te)}catch{}C(!1),d(!1)};return e.jsxs(e.Fragment,{children:[e.jsxs(Un,{display:"flex",py:2,className:"component-item",justifyContent:"flex-start",alignItems:"center",children:[e.jsxs(y,{pl:2,width:{xs:300,md:400},display:"flex",alignItems:"center",children:[e.jsx(vr,{blocklet:t,ancestors:o}),e.jsxs(y,{ml:"16px",children:[e.jsxs(y,{className:"component-header",onClick:()=>p(t),children:[e.jsx(y,{className:"component-name",children:O.getDisplayName(t,!0)}),e.jsx(y,{className:"component-version",children:(Q=t==null?void 0:t.meta)==null?void 0:Q.version})]}),e.jsxs(y,{display:"flex",alignItems:"center",sx:{mt:"2px",ml:-.5},children:[T!=="unknown"&&e.jsx(bo,{style:{marginLeft:4},status:T,source:t.source,progress:t.progress}),e.jsx(pr,{style:{marginLeft:4},mode:t.mode||""}),!!((Ie=t.dependents)!=null&&Ie.length)&&e.jsx(ve,{title:[`${h("common.dependents")}: `,t.dependents.map(te=>e.jsx(y,{pl:1,children:`${co(te.id,u)} ${te.required?`(${h("common.required")})`:""}`},te.id))],children:e.jsx(y,{display:"flex",color:"primary.main",ml:1,children:e.jsx(Pe,{icon:"octicon:package-dependents-16"})})})]})]})]},t),Ft.hasMountPoint(t.meta)&&e.jsx(No,{blocklet:t,ancestors:o,mountPoint:I,href:U},I),e.jsx("div",{style:{flex:1}}),e.jsxs(y,{display:"flex",alignItems:"center",children:[O.hasStartEngine(t.meta)&&e.jsx(ve,{title:h("common.visit"),children:e.jsx(y,{component:"a",sx:{display:{xs:"flex",md:"none"}},target:"_blank",href:U,rel:"noopener noreferrer",children:e.jsx($,{size:"small",children:e.jsx(So,{})})})}),e.jsx(wn,{blocklet:u,component:t,onStart:n,onStop:i,disabled:!["starting","stopping"].includes(u.status)&&O.isInProgress(u.status)}),e.jsx(Vt,{color:"error",badgeContent:"",variant:"dot",invisible:!O.getComponentMissingConfigs(t,o[0]).length,children:e.jsx(Ro,{"data-cy":"component-actions",actions:[O.hasStartEngine(t.meta)||Ii(t)?{icon:e.jsx(Cr,{}),text:h("common.detail"),onClick:()=>{p(t)}}:null,{icon:e.jsx(Ns,{}),text:h("common.restart"),onClick:()=>{R({title:`${h("common.restart")} ${t.meta.title}`,description:h("blocklet.action.restartDescription"),confirm:h("blocklet.action.confirmRestart"),cancel:h("common.cancel"),onConfirm:async()=>{C(!0),await m(t),C(!1)},onCancel:()=>R(null)})},disabled:b||L||k||t.status!=="running"},{icon:e.jsx(Ct,{}),text:h("common.delete"),onClick:()=>{d(!0)},disabled:L||k||!!M,tip:M},{separator:!0},{icon:e.jsx(Yt,{}),onClick:()=>{v(!0)},text:e.jsx(Vt,{color:"error",badgeContent:"",variant:"dot",invisible:!O.getComponentMissingConfigs(t,o[0]).length,children:e.jsx(y,{sx:{width:"100%"},children:h("common.config")})}),disabled:L||k}].filter(Boolean)})})]},"actions")]},"group-not-gateway-box"),e.jsx(Jt,{},"line"),e.jsx(kn,{componentInfo:g,onClose:p,blocklet:t,app:u,depth:s}),e.jsx(Tn,{blocklet:u,component:t,remove:B,onCancel:()=>d(!1),hideBtn:!0,showConfirm:S},"delete-component"),x&&e.jsx(Fe,{title:x.title,description:x.description,confirm:x.confirm,cancel:x.cancel,params:x.params,onConfirm:x.onConfirm,onCancel:x.onCancel},"confirm-setting"),c&&e.jsx(vt,{open:!0,hiddenChildren:!0,onClose:()=>v(!1),blocklet:t,ancestors:o})]})}ht.propTypes={blocklet:r.object.isRequired,ancestors:r.array,depth:r.number,onRemove:r.func,onStart:r.func,onStop:r.func,onRestart:r.func,getComponentUrl:r.func,app:r.object};ht.defaultProps={ancestors:[],depth:0,onRemove:()=>{},onStart:()=>{},onStop:()=>{},onRestart:()=>{},getComponentUrl:()=>window.location.origin,app:null};const Vt=F(xo)`
424
+ `;function No({blocklet:t,ancestors:o,mountPoint:s,href:a}){const[n,i]=f.useState(!1),[m,l]=f.useState(!1),[u,h]=f.useState(!1),[g,p]=f.useState(s),{api:S}=J(),d=!o.length,b=d?t.meta.did:o.map(c=>c.meta.did)[0];f.useEffect(()=>{l(!1),i(!1),h(!1)},[s]);const C=()=>{i(!1),l(!1),p(s)},x=async c=>{c.preventDefault(),h(!0),i(!1);try{const v={rootDid:b,mountPoint:ue(g)};d||(v.did=t.meta.did),await S.updateComponentMountPoint({input:v})}catch(v){throw h(!1),v.message=Z(v),A.error(v.message),v}},R=m?e.jsxs(y,{sx:{ml:1},children:[e.jsx($,{size:"medium",onMouseEnter:()=>i(!0),onMouseLeave:()=>i(!1),"data-cy":"edit-mount-point-submit",onClick:x,children:e.jsx(y,{component:Pe,icon:"material-symbols:done",sx:{color:"primary.main",transition:"0.3s opacity"}})}),e.jsx($,{size:"medium",onMouseEnter:()=>i(!0),onMouseLeave:()=>i(!1),onClick:C,children:e.jsx(y,{component:Pe,icon:"iconoir:cancel",sx:{color:"primary.main",transition:"0.3s opacity"}})})]}):e.jsx($,{size:"medium",onMouseEnter:()=>i(!0),onMouseLeave:()=>i(!1),onClick:()=>l(!0),children:e.jsx(y,{component:Pe,"data-cy":"edit-mount-point",icon:"lets-icons:edit-light",sx:{opacity:n?1:0,color:"primary.main",transition:"0.3s opacity"}})});return e.jsxs(y,{sx:{display:{xs:"none",md:"flex"}},alignItems:"center",flexGrow:"1",children:[m?e.jsx("form",{onSubmit:x,children:e.jsx(K,{style:{flex:1},fullWidth:!0,"data-cy":"edit-mount-point-input",value:g,onChange:c=>p(c.target.value),autoFocus:!0,size:"small",variant:"outlined",placeholder:s})}):e.jsx(y,{component:"a",target:"_blank",href:a,rel:"noopener noreferrer",title:a,onMouseEnter:()=>i(!0),onMouseLeave:()=>i(!1),children:e.jsx(y,{maxWidth:400,sx:{color:"secondary.main",fontSize:16,px:2},overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis",children:xs(s)})}),u?e.jsx(re,{size:20,sx:{ml:1}}):R]},s)}No.propTypes={mountPoint:r.string.isRequired,href:r.string.isRequired,blocklet:r.object.isRequired,ancestors:r.array.isRequired};const Ii=t=>{var o;return!((o=t==null?void 0:t.meta)!=null&&o.group)},co=(t,o)=>{const s=t.split("/").slice(1);let a=o,n=0;const i=[];for(;a&&n<s.length;){const m=a.children.find(l=>l.meta.did===s[n]);a=m,n++,m&&i.push(m.meta.title)}return i.join(" / ")};function ht({blocklet:t,ancestors:o,depth:s,onRemove:a,onStart:n,onStop:i,onRestart:m,getComponentUrl:l,app:u}){var q,Q,Ie;const{t:h}=f.useContext(Ce),[g,p]=f.useState(),[S,d]=f.useState(!1),[b,C]=f.useState(!1),[x,R]=f.useState(null),[c,v]=f.useState(!1),{deletingBlocklets:j}=Kt();let{status:T}=t;s===1&&j.includes(t.meta.did)&&(T="deleting");const I=`/${t.mountPoint||"/"}`.replace(/\/+/g,"/"),U=l(I),L=O.isInProgress(u.status),k=O.isInProgress(t.status);let M="";if(L||k||s===1&&j.includes(t.meta.did))M=h("blocklet.component.tip.stopBlocklet");else if((q=t.dependents)!=null&&q.length){const te=t.dependents.filter(de=>de.required);if(te.length){const de=te.map(Se=>co(Se.id,u));M=h("blocklet.component.tip.requiredBy",{name:de.join(", ")})}}const B=async(...te)=>{C(!0);try{await a(...te)}catch{}C(!1),d(!1)};return e.jsxs(e.Fragment,{children:[e.jsxs(Un,{display:"flex",py:2,className:"component-item",justifyContent:"flex-start",alignItems:"center",children:[e.jsxs(y,{pl:2,width:{xs:300,md:400},display:"flex",alignItems:"center",children:[e.jsx(vr,{blocklet:t,ancestors:o}),e.jsxs(y,{ml:"16px",children:[e.jsxs(y,{className:"component-header",onClick:()=>p(t),children:[e.jsx(y,{className:"component-name",children:O.getDisplayName(t,!0)}),e.jsx(y,{className:"component-version",children:(Q=t==null?void 0:t.meta)==null?void 0:Q.version})]}),e.jsxs(y,{display:"flex",alignItems:"center",sx:{mt:"2px",ml:-.5},children:[T!=="unknown"&&e.jsx(bo,{style:{marginLeft:4},status:T,source:t.source,progress:t.progress}),e.jsx(pr,{style:{marginLeft:4},mode:t.mode||""}),!!((Ie=t.dependents)!=null&&Ie.length)&&e.jsx(ve,{title:[`${h("common.dependents")}: `,t.dependents.map(te=>e.jsx(y,{pl:1,children:`${co(te.id,u)} ${te.required?`(${h("common.required")})`:""}`},te.id))],children:e.jsx(y,{display:"flex",color:"primary.main",ml:1,children:e.jsx(Pe,{icon:"octicon:package-dependents-16"})})})]})]})]},t),Ft.hasMountPoint(t.meta)&&e.jsx(No,{blocklet:t,ancestors:o,mountPoint:I,href:U},I),e.jsx("div",{style:{flex:1}}),e.jsxs(y,{display:"flex",alignItems:"center",children:[O.hasStartEngine(t.meta)&&e.jsx(ve,{title:h("common.visit"),children:e.jsx(y,{component:"a",sx:{display:{xs:"flex",md:"none"}},target:"_blank",href:U,rel:"noopener noreferrer",children:e.jsx($,{size:"small",children:e.jsx(So,{})})})}),e.jsx(wn,{blocklet:u,component:t,onStart:n,onStop:i,disabled:!["starting","stopping"].includes(u.status)&&O.isInProgress(u.status)}),e.jsx(qt,{color:"error",badgeContent:"",variant:"dot",invisible:!O.getComponentMissingConfigs(t,o[0]).length,children:e.jsx(Ro,{"data-cy":"component-actions",actions:[O.hasStartEngine(t.meta)||Ii(t)?{icon:e.jsx(Cr,{}),text:h("common.detail"),onClick:()=>{p(t)}}:null,{icon:e.jsx(Ns,{}),text:h("common.restart"),onClick:()=>{R({title:`${h("common.restart")} ${t.meta.title}`,description:h("blocklet.action.restartDescription"),confirm:h("blocklet.action.confirmRestart"),cancel:h("common.cancel"),onConfirm:async()=>{C(!0),await m(t),C(!1)},onCancel:()=>R(null)})},disabled:b||L||k||t.status!=="running"},{icon:e.jsx(Ct,{}),text:h("common.delete"),onClick:()=>{d(!0)},disabled:L||k||!!M,tip:M},{separator:!0},{icon:e.jsx(Yt,{}),onClick:()=>{v(!0)},text:e.jsx(qt,{color:"error",badgeContent:"",variant:"dot",invisible:!O.getComponentMissingConfigs(t,o[0]).length,children:e.jsx(y,{sx:{width:"100%"},children:h("common.config")})}),disabled:L||k}].filter(Boolean)})})]},"actions")]},"group-not-gateway-box"),e.jsx(Jt,{},"line"),e.jsx(kn,{componentInfo:g,onClose:p,blocklet:t,app:u,depth:s}),e.jsx(Tn,{blocklet:u,component:t,remove:B,onCancel:()=>d(!1),hideBtn:!0,showConfirm:S},"delete-component"),x&&e.jsx(Fe,{title:x.title,description:x.description,confirm:x.confirm,cancel:x.cancel,params:x.params,onConfirm:x.onConfirm,onCancel:x.onCancel},"confirm-setting"),c&&e.jsx(vt,{open:!0,hiddenChildren:!0,onClose:()=>v(!1),blocklet:t,ancestors:o})]})}ht.propTypes={blocklet:r.object.isRequired,ancestors:r.array,depth:r.number,onRemove:r.func,onStart:r.func,onStop:r.func,onRestart:r.func,getComponentUrl:r.func,app:r.object};ht.defaultProps={ancestors:[],depth:0,onRemove:()=>{},onStart:()=>{},onStop:()=>{},onRestart:()=>{},getComponentUrl:()=>window.location.origin,app:null};const qt=F(xo)`
425
425
  .BaseBadge-badge {
426
426
  top: ${t=>t.top*8||6}px;
427
427
  right: ${t=>t.right*8||6}px;
428
428
  }
429
429
  `,Un=F(y)`
430
+ &:hover {
431
+ background-color: rgba(0, 0, 0, 0.05);
432
+ }
430
433
  .component-header {
431
434
  display: flex;
432
435
  align-items: center;
@@ -489,7 +492,7 @@ import{bM as zo,j as e,aK as qt,aL as _t,q as z,O as y,ax as ve,P as r,A,bn as J
489
492
  margin-left: 4px;
490
493
  transform: translateY(-1px);
491
494
  }
492
- `;function Bn({blocklet:t,onUpdate:o,getComponentUrl:s,...a}){var q;const{t:n}=f.useContext(Ce),{api:i,inService:m,info:l}=J(),{addDeletingDid:u,removeDeletingDid:h,matchDeletingDid:g}=Kt(),[p,S]=f.useState(!1),[d,b]=f.useState(null),[C,x]=f.useState(null),[R,c]=f.useState(!1),[v,j]=f.useState(!1),[T,I]=f.useState(!1),[U,L]=f.useState(null),k=t&&t.structVersion!==D.APP_STRUCT_VERSION,[M,B]=f.useState(!1),V=[...t.children];t.meta.group!=="gateway"&&V.unshift(t),g(V.map(w=>w.meta.did));const Q=async()=>{if(!p){S(!0);try{const{updateId:w,updateList:_}=(await i.checkComponentsForUpdates({input:{did:t.meta.did}})).preUpdateInfo||{};if(S(!1),!w){A.info(n("blocklet.component.noUpdate"));return}const oe=[];O.forEachChildSync(t,(se,{id:Ge,ancestors:Y})=>{const H=_.find(be=>be.id===Ge);if(H){const be=Y.slice(1).concat(se).map(Ue=>Ue.meta.title||Ue.meta.name).join(" / "),ze=(Y[1]||se).meta.did;oe.push({groupId:ze,name:be,version:se.meta.version,newVersion:H.meta.version})}});const xe={};oe.forEach(se=>{xe[se.groupId]?se.disabled=!0:xe[se.groupId]=!0}),b({params:{updateId:w},list:oe,checks:xe,hasChecks:!0})}catch(w){S(!1),A.error(Z(w))}}},Ie=async()=>{if(!p)try{S(!0);const w=Object.keys(d.checks).filter(oe=>d.checks[oe]),_={updateId:d.params.updateId,rootDid:t.meta.did,selectedComponents:w};await i.upgradeComponents({input:_}),S(!1),b(null),B(null)}catch(w){S(!1),A.error(Z(w))}},te=async(w,_)=>{u(w.meta.did);try{await i.deleteComponent({input:{did:w.meta.did,keepData:_==="keepData",rootDid:t.meta.did}}),await Ye(800)}catch(oe){A.error(Z(oe)),h(w.meta.did)}},de=async w=>{try{await i.startBlocklet({input:{did:t.meta.did,componentDids:[w.meta.did]}}),await Ye(800)}catch(_){A.error(Z(_))}},Se=async w=>{try{await i.stopBlocklet({input:{did:t.meta.did,componentDids:[w.meta.did]}}),await Ye(800)}catch(_){A.error(Z(_))}},P=async w=>{try{await i.restartBlocklet({input:{did:t.meta.did,componentDids:[w.meta.did]}}),await Ye(800)}catch(_){A.error(Z(_))}},ke=(w,_)=>{const{checked:oe}=w.target;b(xe=>{const se=Object.entries(xe.checks).reduce((Y,[H,be])=>(Y[H]=_===H?oe:be,Y),{}),Ge=Object.values(se).includes(!0);return{...xe,checks:se,hasChecks:Ge}})};Cs(Q);const me=gi({blocklet:t,scrollToComponent:!0}),Ze=U||me;return e.jsxs(Ui,{component:"div",...a,children:[e.jsxs(Di,{display:"flex",children:[e.jsxs(Bi,{flexDirection:"row",className:"title",display:"flex",alignItems:"center",children:[V!=null&&V.length?`${n("common.components")} (${V.length})`:`${n("common.components")}`,!k&&e.jsx(Mt,{permission:m?"":"mutate_blocklets",role:m?Oe:[],children:e.jsx(Xt,{children:e.jsx(Vt,{top:1.2,right:.4,color:"error",badgeContent:"",variant:"dot",invisible:!M,children:e.jsxs(ne,{disabled:p||O.isInProgress(t.status),color:"secondary",onClick:()=>{Q()},"data-cy":"check-for-updates",children:[e.jsx(y,{ml:.5,mr:.5,display:"flex",children:p?e.jsx(re,{size:16}):e.jsx(Eo,{style:{fontSize:"1em"}})}),n("blocklet.component.checkUpdateTitle")]})})})})]}),e.jsx(Mt,{permission:m?"":"mutate_blocklets",role:m?Oe:[],children:e.jsxs(y,{display:"flex",alignItems:"center",children:[!k&&e.jsx(vn,{blocklet:t,serverVersion:l.version,children:({open:w})=>e.jsxs(ne,{disabled:p||O.isInProgress(t.status),variant:"text",color:"primary","data-cy":"add-component",className:"sm-hide-icon",onClick:w,children:[e.jsx(bs,{style:{fontSize:"1.3em",marginRight:4}}),n("blocklet.component.add")]})}),e.jsx(Ro,{"data-cy":"component-actions",actions:[{icon:e.jsx(Pe,{icon:"fluent:link-20-filled"}),onClick:()=>j(!0),text:n("router.rule.add.title"),disabled:p||O.isInProgress(t.status)},!k&&{icon:e.jsx(Yt,{}),text:`${n("blocklet.component.container")}`,onClick:()=>I(!0)}].filter(Boolean)})]})})]}),V!=null&&V.length?e.jsxs(e.Fragment,{children:[e.jsxs(y,{mt:2,children:[t.meta.group!=="gateway"&&e.jsx(ht,{blocklet:t,app:t,onRemove:te,onStart:de,onStop:Se,onRestart:P,getComponentUrl:s},`0-${t.meta.did}`),t.children.map(w=>e.jsx(ht,{depth:1,blocklet:w,ancestors:[t],app:t,onRemove:te,onStart:de,onStop:Se,onRestart:P,getComponentUrl:s},`1-${w.meta.did}`))]},`top-blocklet-${t.meta.did}`),(q=t.optionalComponents)==null?void 0:q.map(w=>e.jsx(Un,{children:e.jsx(Dn,{setInstallComponentMeta:L,...w})},w.meta.did))]}):e.jsx(y,{mt:8,children:e.jsx(ks,{children:n("blocklet.component.noComponent")})}),!!t.site.rules.length&&e.jsx(y,{sx:{mt:0,".component-item__indent":{pl:2,width:0}},children:e.jsx(hi,{})}),!!d&&e.jsx(Yn,{open:!0,fullWidth:!0,children:e.jsxs(y,{paddingY:1.5,children:[e.jsx(Jn,{children:n("blocklet.component.updateTitle")}),e.jsx(y,{component:Kn,py:4,children:d.list.map(w=>e.jsxs(y,{display:"flex",alignItems:"center",children:[e.jsx(js,{checked:d.checks[w.groupId],onChange:_=>ke(_,w.groupId),style:{marginLeft:w.disabled?16:0},defaultChecked:!0,disabled:w.disabled}),e.jsxs(y,{flexGrow:1,mt:3,children:[e.jsx(y,{item:!0,xs:8,children:w.name}),w.version&&e.jsxs(at,{fontSize:"h6.fontSize",container:!0,spacing:2,alignItems:"center",children:[e.jsx(at,{item:!0,xs:3,children:w.version}),e.jsx(at,{item:!0,xs:1,children:e.jsx(Is,{style:{fontSize:"0.9em"}})}),e.jsx(at,{item:!0,xs:3,children:e.jsx(y,{color:"secondary.main",children:w.newVersion})})]})]},`${w.name}-${w.newVersion}`)]},w.name))}),e.jsxs(vs,{style:{padding:"8px 24px 24px"},children:[e.jsx(ne,{onClick:()=>{b(null)},children:n("common.cancel")}),e.jsxs(ne,{onClick:w=>{w.stopPropagation(),Ie()},color:"primary",disabled:p||!d.hasChecks,variant:"contained",autoFocus:!0,children:[p&&e.jsx(re,{size:16}),n("common.update")]})]})]})}),!!C&&e.jsx(Yn,{open:!0,fullWidth:!0,onClose:()=>x(!1),children:e.jsxs(y,{paddingY:1.5,children:[e.jsx(Jn,{children:n("common.configuration")}),e.jsx(Kn,{children:e.jsx(y,{py:2,children:e.jsx(zt,{control:e.jsx(Sr,{checked:R,onChange:w=>c(!!w.target.checked)}),label:n("blocklet.component.showContainer")})})})]})}),e.jsx(St,{selectedMeta:Ze,blocklet:t,showDialog:!!Ze,setShowDialog:()=>L(null)}),v&&e.jsx(Sn,{hiddenChildren:!0,open:!0,onClose:()=>j(!1)}),T&&e.jsx(vt,{open:!0,onClose:()=>I(!1),hiddenChildren:!0,blocklet:t,ancestors:[]})]})}Bn.propTypes={blocklet:r.object.isRequired,onUpdate:r.func,getComponentUrl:r.func};Bn.defaultProps={onUpdate:()=>{},getComponentUrl:()=>window.location.origin};const Ui=F.div`
495
+ `;function Bn({blocklet:t,onUpdate:o,getComponentUrl:s,...a}){var V;const{t:n}=f.useContext(Ce),{api:i,inService:m,info:l}=J(),{addDeletingDid:u,removeDeletingDid:h,matchDeletingDid:g}=Kt(),[p,S]=f.useState(!1),[d,b]=f.useState(null),[C,x]=f.useState(null),[R,c]=f.useState(!1),[v,j]=f.useState(!1),[T,I]=f.useState(!1),[U,L]=f.useState(null),k=t&&t.structVersion!==D.APP_STRUCT_VERSION,[M,B]=f.useState(!1),q=[...t.children];t.meta.group!=="gateway"&&q.unshift(t),g(q.map(w=>w.meta.did));const Q=async()=>{if(!p){S(!0);try{const{updateId:w,updateList:_}=(await i.checkComponentsForUpdates({input:{did:t.meta.did}})).preUpdateInfo||{};if(S(!1),!w){A.info(n("blocklet.component.noUpdate"));return}const oe=[];O.forEachChildSync(t,(se,{id:Ge,ancestors:Y})=>{const H=_.find(be=>be.id===Ge);if(H){const be=Y.slice(1).concat(se).map(Ue=>Ue.meta.title||Ue.meta.name).join(" / "),ze=(Y[1]||se).meta.did;oe.push({groupId:ze,name:be,version:se.meta.version,newVersion:H.meta.version})}});const xe={};oe.forEach(se=>{xe[se.groupId]?se.disabled=!0:xe[se.groupId]=!0}),b({params:{updateId:w},list:oe,checks:xe,hasChecks:!0})}catch(w){S(!1),A.error(Z(w))}}},Ie=async()=>{if(!p)try{S(!0);const w=Object.keys(d.checks).filter(oe=>d.checks[oe]),_={updateId:d.params.updateId,rootDid:t.meta.did,selectedComponents:w};await i.upgradeComponents({input:_}),S(!1),b(null),B(null)}catch(w){S(!1),A.error(Z(w))}},te=async(w,_)=>{u(w.meta.did);try{await i.deleteComponent({input:{did:w.meta.did,keepData:_==="keepData",rootDid:t.meta.did}}),await Ye(800)}catch(oe){A.error(Z(oe)),h(w.meta.did)}},de=async w=>{try{await i.startBlocklet({input:{did:t.meta.did,componentDids:[w.meta.did]}}),await Ye(800)}catch(_){A.error(Z(_))}},Se=async w=>{try{await i.stopBlocklet({input:{did:t.meta.did,componentDids:[w.meta.did]}}),await Ye(800)}catch(_){A.error(Z(_))}},P=async w=>{try{await i.restartBlocklet({input:{did:t.meta.did,componentDids:[w.meta.did]}}),await Ye(800)}catch(_){A.error(Z(_))}},ke=(w,_)=>{const{checked:oe}=w.target;b(xe=>{const se=Object.entries(xe.checks).reduce((Y,[H,be])=>(Y[H]=_===H?oe:be,Y),{}),Ge=Object.values(se).includes(!0);return{...xe,checks:se,hasChecks:Ge}})};Cs(Q);const me=gi({blocklet:t,scrollToComponent:!0}),Ze=U||me;return e.jsxs(Ui,{component:"div",...a,children:[e.jsxs(Di,{display:"flex",children:[e.jsxs(Bi,{flexDirection:"row",className:"title",display:"flex",alignItems:"center",children:[q!=null&&q.length?`${n("common.components")} (${q.length})`:`${n("common.components")}`,!k&&e.jsx(Mt,{permission:m?"":"mutate_blocklets",role:m?Oe:[],children:e.jsx(Xt,{children:e.jsx(qt,{top:1.2,right:.4,color:"error",badgeContent:"",variant:"dot",invisible:!M,children:e.jsxs(ne,{disabled:p||O.isInProgress(t.status),color:"secondary",onClick:()=>{Q()},"data-cy":"check-for-updates",children:[e.jsx(y,{ml:.5,mr:.5,display:"flex",children:p?e.jsx(re,{size:16}):e.jsx(Eo,{style:{fontSize:"1em"}})}),n("blocklet.component.checkUpdateTitle")]})})})})]}),e.jsx(Mt,{permission:m?"":"mutate_blocklets",role:m?Oe:[],children:e.jsxs(y,{display:"flex",alignItems:"center",children:[!k&&e.jsx(vn,{blocklet:t,serverVersion:l.version,children:({open:w})=>e.jsxs(ne,{disabled:p||O.isInProgress(t.status),variant:"text",color:"primary","data-cy":"add-component",className:"sm-hide-icon",onClick:w,children:[e.jsx(bs,{style:{fontSize:"1.3em",marginRight:4}}),n("blocklet.component.add")]})}),e.jsx(Ro,{"data-cy":"component-actions",actions:[{icon:e.jsx(Pe,{icon:"fluent:link-20-filled"}),onClick:()=>j(!0),text:n("router.rule.add.title"),disabled:p||O.isInProgress(t.status)},!k&&{icon:e.jsx(Yt,{}),text:`${n("blocklet.component.container")}`,onClick:()=>I(!0)}].filter(Boolean)})]})})]}),q!=null&&q.length?e.jsxs(e.Fragment,{children:[e.jsxs(y,{mt:2,children:[t.meta.group!=="gateway"&&e.jsx(ht,{blocklet:t,app:t,onRemove:te,onStart:de,onStop:Se,onRestart:P,getComponentUrl:s},`0-${t.meta.did}`),t.children.map(w=>e.jsx(ht,{depth:1,blocklet:w,ancestors:[t],app:t,onRemove:te,onStart:de,onStop:Se,onRestart:P,getComponentUrl:s},`1-${w.meta.did}`))]},`top-blocklet-${t.meta.did}`),(V=t.optionalComponents)==null?void 0:V.map(w=>e.jsx(Un,{children:e.jsx(Dn,{setInstallComponentMeta:L,...w})},w.meta.did))]}):e.jsx(y,{mt:8,children:e.jsx(ks,{children:n("blocklet.component.noComponent")})}),!!t.site.rules.length&&e.jsx(y,{sx:{mt:0,".component-item__indent":{pl:2,width:0}},children:e.jsx(hi,{})}),!!d&&e.jsx(Yn,{open:!0,fullWidth:!0,children:e.jsxs(y,{paddingY:1.5,children:[e.jsx(Jn,{children:n("blocklet.component.updateTitle")}),e.jsx(y,{component:Kn,py:4,children:d.list.map(w=>e.jsxs(y,{display:"flex",alignItems:"center",children:[e.jsx(js,{checked:d.checks[w.groupId],onChange:_=>ke(_,w.groupId),style:{marginLeft:w.disabled?16:0},defaultChecked:!0,disabled:w.disabled}),e.jsxs(y,{flexGrow:1,mt:3,children:[e.jsx(y,{item:!0,xs:8,children:w.name}),w.version&&e.jsxs(at,{fontSize:"h6.fontSize",container:!0,spacing:2,alignItems:"center",children:[e.jsx(at,{item:!0,xs:3,children:w.version}),e.jsx(at,{item:!0,xs:1,children:e.jsx(Is,{style:{fontSize:"0.9em"}})}),e.jsx(at,{item:!0,xs:3,children:e.jsx(y,{color:"secondary.main",children:w.newVersion})})]})]},`${w.name}-${w.newVersion}`)]},w.name))}),e.jsxs(vs,{style:{padding:"8px 24px 24px"},children:[e.jsx(ne,{onClick:()=>{b(null)},children:n("common.cancel")}),e.jsxs(ne,{onClick:w=>{w.stopPropagation(),Ie()},color:"primary",disabled:p||!d.hasChecks,variant:"contained",autoFocus:!0,children:[p&&e.jsx(re,{size:16}),n("common.update")]})]})]})}),!!C&&e.jsx(Yn,{open:!0,fullWidth:!0,onClose:()=>x(!1),children:e.jsxs(y,{paddingY:1.5,children:[e.jsx(Jn,{children:n("common.configuration")}),e.jsx(Kn,{children:e.jsx(y,{py:2,children:e.jsx(zt,{control:e.jsx(Sr,{checked:R,onChange:w=>c(!!w.target.checked)}),label:n("blocklet.component.showContainer")})})})]})}),e.jsx(St,{selectedMeta:Ze,blocklet:t,showDialog:!!Ze,setShowDialog:()=>L(null)}),v&&e.jsx(Sn,{hiddenChildren:!0,open:!0,onClose:()=>j(!1)}),T&&e.jsx(vt,{open:!0,onClose:()=>I(!1),hiddenChildren:!0,blocklet:t,ancestors:[]})]})}Bn.propTypes={blocklet:r.object.isRequired,onUpdate:r.func,getComponentUrl:r.func};Bn.defaultProps={onUpdate:()=>{},getComponentUrl:()=>window.location.origin};const Ui=F.div`
493
496
  .title {
494
497
  font-size: 1.2rem;
495
498
  font-weight: bold;