@abtnode/blocklet-services 1.17.1 → 1.17.2-beta-20251111-010532-4bb3b162

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 (180) hide show
  1. package/api/routes/oauth/client.js +19 -3
  2. package/dist/assets/{AdapterDayjs-DS6RugP1.js → AdapterDayjs-Cf3ilEXQ.js} +1 -1
  3. package/dist/assets/{Google-DL2G-Im-.js → Google-CAi86Mf6.js} +1 -1
  4. package/dist/assets/{access-control-BcP45PDK.js → access-control-CtmOVtqN.js} +1 -1
  5. package/dist/assets/{add-component-core-CDw-LKTz.js → add-component-core-BmqcC6wx.js} +1 -1
  6. package/dist/assets/add-resource-Wd8eygtg.js +1 -0
  7. package/dist/assets/{addon-BNvN2vhl.js → addon-b88MM48E.js} +1 -1
  8. package/dist/assets/{advanced-C0Q1MXTZ.js → advanced-B3-RuDYH.js} +1 -1
  9. package/dist/assets/aigne-dOgJ2u-w.js +10 -0
  10. package/dist/assets/api-Btn0Tp3W.js +1 -0
  11. package/dist/assets/{appearance-Du24FS2u.js → appearance-BqBKdeI5.js} +1 -1
  12. package/dist/assets/{arrow-down.svg-BNc6qym0.js → arrow-down.svg-DeLZPBrE.js} +1 -1
  13. package/dist/assets/{audit-logs-CC69qHzz.js → audit-logs-DtLr59sc.js} +1 -1
  14. package/dist/assets/{authorize-R4UDUnLr.js → authorize-DwHmsRbR.js} +1 -1
  15. package/dist/assets/{base-chart-CPiuDOeg.js → base-chart-C-Raz4Q-.js} +1 -1
  16. package/dist/assets/{base32-DvFJDTUa.js → base32-MTP_2iYY.js} +1 -1
  17. package/dist/assets/{bind-account-BHDDyJhv.js → bind-account-kNuk8_sP.js} +1 -1
  18. package/dist/assets/branding-B5SFGC6H.js +1 -0
  19. package/dist/assets/{branding-JJOTrGtN.js → branding-BDl2jvZZ.js} +1 -1
  20. package/dist/assets/{branding-DtWd56Gj.js → branding-ZWV6HBf3.js} +1 -1
  21. package/dist/assets/{bundle-avatar-DKBZZwLh.js → bundle-avatar-CTtvmGO1.js} +1 -1
  22. package/dist/assets/{button-Cg6OrnF6.js → button-vwR-NYG5.js} +1 -1
  23. package/dist/assets/{click-to-copy-8VrSVycN.js → click-to-copy-BOJgIYli.js} +1 -1
  24. package/dist/assets/{cloneDeep-D_w1MBt4.js → cloneDeep-C6qewg0C.js} +1 -1
  25. package/dist/assets/{complete-DPUMGf1q.js → complete-Bkaq2hgz.js} +2 -2
  26. package/dist/assets/{component-BHy3j7aa.js → component-C45V1KlM.js} +2 -2
  27. package/dist/assets/{config-BaVMK6fr.js → config-BLLq9bPE.js} +1 -1
  28. package/dist/assets/config-Ceq_JEL5.js +53 -0
  29. package/dist/assets/{config-9XjBKwBj.js → config-gkybDvOM.js} +1 -1
  30. package/dist/assets/{config-navigation-CFyO-icX.js → config-navigation-D1-Loy5H.js} +2 -2
  31. package/dist/assets/{config-space-u-t0AaTk.js → config-space-zpk7zMxf.js} +1 -1
  32. package/dist/assets/{confirm-BCjJ3Xga.js → confirm-CR8be0u2.js} +1 -1
  33. package/dist/assets/{connect-DlGrdygd.js → connect-BXpb2qd7.js} +1 -1
  34. package/dist/assets/{connect-B6Xh5geZ.js → connect-DOJrWNED.js} +1 -1
  35. package/dist/assets/{connect-to-DcXC96wu.js → connect-to-CmnRyCBb.js} +1 -1
  36. package/dist/assets/{create-passport-svg-BYZ8eY0w.js → create-passport-svg-C7Utfs-J.js} +1 -1
  37. package/dist/assets/{createClass-BQSl7_FJ.js → createClass-C0dSRoDm.js} +1 -1
  38. package/dist/assets/{dashboard-CQ72RYH1.js → dashboard-Dw224r_Y.js} +2 -2
  39. package/dist/assets/{delete-confirm-D2vWlDhQ.js → delete-confirm-DhJd_sYk.js} +1 -1
  40. package/dist/assets/{did-address-BxZuOgUQ.js → did-address-QgOhyegQ.js} +1 -1
  41. package/dist/assets/{domain-DrZ8Lgz4.js → domain-Cp9UTLSk.js} +1 -1
  42. package/dist/assets/{domain-action-card-CjprVCsh.js → domain-action-card-ClQw061p.js} +2 -2
  43. package/dist/assets/domains-Bqr-LIHe.js +1 -0
  44. package/dist/assets/{email-BLnwK6WC.js → email-CyuoT9tq.js} +1 -1
  45. package/dist/assets/engine-DPn0LHHl.js +1 -0
  46. package/dist/assets/{exchange-passport-CNwWQumn.js → exchange-passport-BpZ027R8.js} +1 -1
  47. package/dist/assets/{form-BmYfNrVX.js → form-5lUoL51-.js} +1 -1
  48. package/dist/assets/{form-text-input-BZq_zjB8.js → form-text-input-Ce6g965V.js} +1 -1
  49. package/dist/assets/{fuel-UmS8I6V5.js → fuel-SLYYbiDW.js} +1 -1
  50. package/dist/assets/{gen-access-key-BG0P5o2E.js → gen-access-key-CXXIb3w7.js} +1 -1
  51. package/dist/assets/gen-simple-access-key-BHzLGV5y.js +1 -0
  52. package/dist/assets/get-safe-url-DpalOXcM.js +1 -0
  53. package/dist/assets/{home-DDCrDH3h.js → home-DIAEkSVB.js} +1 -1
  54. package/dist/assets/{iframe-UTQ_4DZf.js → iframe-BUJLmqjE.js} +1 -1
  55. package/dist/assets/index-40i6YjCX.js +6 -0
  56. package/dist/assets/{index-bAaF7GbQ.js → index-5h5rz7VN.js} +1 -1
  57. package/dist/assets/index-7L77Yf9w.js +120 -0
  58. package/dist/assets/{index-CFpcdpS5.js → index-BQF4zMs8.js} +3 -3
  59. package/dist/assets/{index-BCuYGA8L.js → index-BiE-bsm3.js} +1 -1
  60. package/dist/assets/{index-BCF14HSR.js → index-BiRWeiPY.js} +1 -1
  61. package/dist/assets/{index-Db6d_BmF.js → index-Bjj89nDJ.js} +1 -1
  62. package/dist/assets/{index-CYIpEo41.js → index-Bpiwm7Vd.js} +1 -1
  63. package/dist/assets/{index-DoyPDWTY.js → index-C-ToEbCG.js} +1 -1
  64. package/dist/assets/{index-CRlbskWD.js → index-C45ih46D.js} +11 -11
  65. package/dist/assets/{index-BydChKjR.js → index-COTazo1u.js} +2 -2
  66. package/dist/assets/{index-H8Dc7uuB.js → index-CkOr9jjZ.js} +1 -1
  67. package/dist/assets/{index-Ct7hdtD6.js → index-CsfqJ8ys.js} +1 -1
  68. package/dist/assets/{index-COj40KfT.js → index-CxfTwIi4.js} +1 -1
  69. package/dist/assets/{index-C2c32kYu.js → index-DBJMdrD8.js} +1 -1
  70. package/dist/assets/index-DZRxerxf.js +7 -0
  71. package/dist/assets/{index-Kwxwmog8.js → index-DZsn1cNa.js} +3 -3
  72. package/dist/assets/{index-CrRuO2BQ.js → index-DicW-7Bz.js} +1 -1
  73. package/dist/assets/{index-D-Y0UA7w.js → index-DoMhm8T2.js} +1 -1
  74. package/dist/assets/{index-CfVxzco9.js → index-DzmaBRJ8.js} +1 -1
  75. package/dist/assets/{index-DrTSvHzP.js → index-F1NFyTyg.js} +7 -7
  76. package/dist/assets/index-FV6qYjQd.js +62 -0
  77. package/dist/assets/{index-D2k5qLgT.js → index-FpxO_1p7.js} +1 -1
  78. package/dist/assets/{index-I8DDinX-.js → index-GExzZtCU.js} +1 -1
  79. package/dist/assets/{index-C_bSN26w.js → index-I2xk2ilS.js} +2 -2
  80. package/dist/assets/{index-BM4g9p9K.js → index-NomqB6Iy.js} +1 -1
  81. package/dist/assets/{index-ChcIPY6P.js → index-UR2bgVDi.js} +2 -2
  82. package/dist/assets/{index-CKPpLyCQ.js → index-gt5P4O5b.js} +1 -1
  83. package/dist/assets/{index-Ch4CmFJG.js → index-l32Mt1U_.js} +1 -1
  84. package/dist/assets/{index-CkTEzTCn.js → index-sNHCLgAE.js} +140 -142
  85. package/dist/assets/{index-BjsH7wg6.js → index-x4Yvq15-.js} +1 -1
  86. package/dist/assets/{invitation-PFI3mpiQ.js → invitation-Bu3ivg7N.js} +1 -1
  87. package/dist/assets/{invitations-DBukPMcf.js → invitations-o-DfaNhe.js} +1 -1
  88. package/dist/assets/{invite-Z_7oCnoB.js → invite-C_VhlmyZ.js} +1 -1
  89. package/dist/assets/{isURL-CyShrkvP.js → isURL-D_2bLHU_.js} +2 -2
  90. package/dist/assets/{issue-passport-BexF9o0Q.js → issue-passport-BQmXTz6k.js} +1 -1
  91. package/dist/assets/{item-CBDRQx8K.js → item-BnTXSpRf.js} +1 -1
  92. package/dist/assets/{landing-page-BBuNoMf2.js → landing-page-sUHYSREd.js} +1 -1
  93. package/dist/assets/{layout-DsLcTLhU.js → layout-Ccrs-yyw.js} +1 -1
  94. package/dist/assets/list-Bzvh-74X.js +2 -0
  95. package/dist/assets/list-DORIbGy_.js +103 -0
  96. package/dist/assets/localization-DDhbgRgn.js +1 -0
  97. package/dist/assets/{log-CQbIkXws.js → log-C34JsgaL.js} +1 -1
  98. package/dist/assets/logger-CLmQ42wa.js +1 -0
  99. package/dist/assets/{login-CvnRp8HX.js → login-DHfG4EkA.js} +1 -1
  100. package/dist/assets/{login-oauth-callback-LnLYjVIe.js → login-oauth-callback-B7KlB_uu.js} +1 -1
  101. package/dist/assets/{logo-uploader-DRaSgU8c.js → logo-uploader-D-JPEx8I.js} +1 -1
  102. package/dist/assets/{lost-passport-B5NjzFZd.js → lost-passport-BLFCoJdG.js} +1 -1
  103. package/dist/assets/{omit-CigYLGmT.js → omit-hhiOJGRf.js} +1 -1
  104. package/dist/assets/{open-window-B_B0pir6.js → open-window-Bcj__Y7L.js} +1 -1
  105. package/dist/assets/{over-due-invoice-payment-mGIRggXd.js → over-due-invoice-payment-DUg5ApsD.js} +1 -1
  106. package/dist/assets/{overview-DmcFvtLD.js → overview-B-nkIeNy.js} +2 -2
  107. package/dist/assets/passport-Y64u4kIS.js +1 -0
  108. package/dist/assets/passport-item-DvglsId-.js +1 -0
  109. package/dist/assets/{permission-COoKrWxk.js → permission-DhYNRf8T.js} +1 -1
  110. package/dist/assets/{preferences-CDP-HNka.js → preferences-C4h4Dsj9.js} +1 -1
  111. package/dist/assets/profile-embed-lrJQLQky.js +1 -0
  112. package/dist/assets/{publish-resource-BMF29YI2.js → publish-resource-YXu5vhjp.js} +1 -1
  113. package/dist/assets/{react-beautiful-dnd.esm-4ukAiqxb.js → react-beautiful-dnd.esm-Ci2FESra.js} +1 -1
  114. package/dist/assets/runtime-DK0VmoOa.js +1 -0
  115. package/dist/assets/{sanitize-Bib7lw-G.js → sanitize-BEqBHa8a.js} +1 -1
  116. package/dist/assets/sdk-DFkL0HsT.js +1 -0
  117. package/dist/assets/{security-BcRPxWAt.js → security-DrqBVw07.js} +3 -3
  118. package/dist/assets/{session-GdZETrt0.js → session-BAD0lxQk.js} +1 -1
  119. package/dist/assets/{setup-MQVteZIu.js → setup-Br2wkFI2.js} +1 -1
  120. package/dist/assets/{simple-select-K2bKpwDf.js → simple-select-CzvjrR9I.js} +1 -1
  121. package/dist/assets/{spaces-iPLS3X1a.js → spaces-B0p4-23K.js} +1 -1
  122. package/dist/assets/{start-DE38ex9f.js → start-CXoSJa5Y.js} +1 -1
  123. package/dist/assets/{starting-progress-BQjEEvIV.js → starting-progress-NSYAzE2f.js} +1 -1
  124. package/dist/assets/{status-B0TeD-D-.js → status-guZHdt1q.js} +1 -1
  125. package/dist/assets/{step-actions-DPFoKvBN.js → step-actions-thgNsMmu.js} +1 -1
  126. package/dist/assets/{studio-CEsaMQhd.js → studio-Ceq7d-nC.js} +1 -1
  127. package/dist/assets/{switch-control-BHqY-fHZ.js → switch-control-CHsjrwFX.js} +1 -1
  128. package/dist/assets/{table-tips-6mCQ469z.js → table-tips-cwfDerzR.js} +1 -1
  129. package/dist/assets/{team-aiCyLcOV.js → team-DQuySqMB.js} +1 -1
  130. package/dist/assets/{traffic-CPElxbIH.js → traffic-QKQkjau1.js} +1 -1
  131. package/dist/assets/{transfer-DvfbExaq.js → transfer-B2DeADo4.js} +1 -1
  132. package/dist/assets/{unsubscribe-BfZzYk0c.js → unsubscribe-CBCoBRAZ.js} +1 -1
  133. package/dist/assets/{use-app-logo-Duu7Oh3J.js → use-app-logo-BQTE7YvS.js} +1 -1
  134. package/dist/assets/{use-window-close-CmeMvKPG.js → use-window-close-BgT_dImc.js} +1 -1
  135. package/dist/assets/{useAsync-DouUkRB3.js → useAsync-BcVLpt2E.js} +1 -1
  136. package/dist/assets/{useAsync-BvASW8Y8.js → useAsync-cZ_FPf9k.js} +1 -1
  137. package/dist/assets/{useAsyncRetry-C8ETjgdm.js → useAsyncRetry-DwwEjrjs.js} +1 -1
  138. package/dist/assets/{useLocalStorage-DZQPax49.js → useLocalStorage-C9RLNbTa.js} +1 -1
  139. package/dist/assets/{user-center-BVnh5pB3.js → user-center-Cj7ClpAN.js} +2 -2
  140. package/dist/assets/user-follower-D2fRTkiD.js +32 -0
  141. package/dist/assets/{util-Cx4i9QNN.js → util-BEWQY3Rq.js} +1 -1
  142. package/dist/assets/{util-D4K1svNc.js → util-BsAmOTBh.js} +1 -1
  143. package/dist/assets/{vendor-arcblock-A4RQuZfN.js → vendor-arcblock-CuFtPveO.js} +1 -1
  144. package/dist/assets/{vendor-hooks-OpgB8gyY.js → vendor-hooks-CjESGRlR.js} +1 -1
  145. package/dist/assets/vendor-utils-cJEl_UEd.js +213 -0
  146. package/dist/assets/{vendor-ux-RIH1nUSh.js → vendor-ux-IiQnod3w.js} +7 -7
  147. package/dist/assets/{wait-connect-KtqPocoC.js → wait-connect-DiO80nu-.js} +1 -1
  148. package/dist/assets/{wizard-C9022r7q.js → wizard-Br7PYJDY.js} +1 -1
  149. package/dist/assets/{wizard-components-DboyJGog.js → wizard-components-BJpLH2_r.js} +1 -1
  150. package/dist/assets/wrap-locale-fIPwg8LW.js +1 -0
  151. package/dist/assets/{zh-BQQVY0SI.js → zh-EIKQ0AV8.js} +1 -1
  152. package/dist/index.html +1 -1
  153. package/dist/service-worker.js +1 -1
  154. package/package.json +48 -48
  155. package/dist/assets/add-resource-CcTb_2qn.js +0 -1
  156. package/dist/assets/aigne-CIAkCLWQ.js +0 -10
  157. package/dist/assets/api-BNrHV6cZ.js +0 -1
  158. package/dist/assets/branding-z2zNNpPB.js +0 -1
  159. package/dist/assets/config-zjFvoy0D.js +0 -57
  160. package/dist/assets/domains-Pt7MqfcA.js +0 -1
  161. package/dist/assets/engine-BkRDnUT9.js +0 -1
  162. package/dist/assets/gen-simple-access-key-BD4DDZLa.js +0 -1
  163. package/dist/assets/get-safe-url-Cgcqi5oF.js +0 -1
  164. package/dist/assets/index-C0w3lI6i.js +0 -120
  165. package/dist/assets/index-CpPbuWHL.js +0 -7
  166. package/dist/assets/index-CuFT_Y96.js +0 -6
  167. package/dist/assets/index-DBjdZ7k_.js +0 -63
  168. package/dist/assets/index-OYI_VqY3.js +0 -1
  169. package/dist/assets/list-BDeeBLEM.js +0 -103
  170. package/dist/assets/list-BZRp_F7-.js +0 -2
  171. package/dist/assets/localization-Dp6_R66r.js +0 -1
  172. package/dist/assets/logger-BI25CDXT.js +0 -1
  173. package/dist/assets/passport-CScachCU.js +0 -1
  174. package/dist/assets/passport-item-BefzYs0z.js +0 -1
  175. package/dist/assets/profile-embed-CfTauOJU.js +0 -1
  176. package/dist/assets/runtime-CC2luaxU.js +0 -1
  177. package/dist/assets/sdk-CkMqUWSI.js +0 -1
  178. package/dist/assets/user-follower-z3gqroPM.js +0 -32
  179. package/dist/assets/vendor-utils-ByKYcWuf.js +0 -213
  180. package/dist/assets/wrap-locale-Dkx98Pk6.js +0 -1
@@ -1,5 +1,5 @@
1
1
  const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=[window.__toCdnUrl("assets/vendor-ux-DYcPPYq2.css"),window.__toCdnUrl("assets/index-DrVXX4fX.css"),window.__toCdnUrl("assets/index-gnjjKJuC.css"),window.__toCdnUrl("assets/add-component-core-G0iZE90Q.css")])))=>i.map(i=>d[i]);
2
- import{p as nn,n as ht,H as F,V as B,at as on,au as So,Q as jo,M as rn,U as sn,E as It,w as Co,j as ko,i as Io,_ as L}from"./vendor-ux-RIH1nUSh.js";import{j as i,W as S,aZ as Eo,cN as _o,d9 as Lo,bb as To,dh as Do,di as Ao,cP as Po,dj as Ro,dd as Mo,dk as Oo,I as Ne,aQ as No,aR as Uo,aX as gt,a3 as Bo,M as zo,aO as $o,a6 as V,aP as Fo,bi as Vo,at as Ue,T as ee,bq as Ho,b6 as Et,br as _t,ak as I,D as pe,J as re,ah as Be,ao as Wo,dl as qo,aj as Ko,dm as an,dn as cn,dp as ln,am as de,a$ as _e,dq as Lt,U as Q,aN as un,Y as dn,b_ as Go,dr as Qo,ds as Zo,Q as Xo,dt as Jo}from"./vendor-mui-core-CnXrAOs3.js";import{r as h,L as fn,i as pn,g as Yo,k as er,j as tr}from"./vendor-react-Dvs43sk9.js";import{_ as ze,e as P,Y as qe,an as Ke,c as R,Z as Tt,bB as nr,a2 as or,ac as rr,v as sr,bC as ir,bD as mn,a1 as te,bE as hn,aO as ar,bF as cr,X as lr,b2 as ur,b3 as dr,bG as fr,b4 as pr,bH as mr,bI as hr,am as gr,bJ as Ge,bK as br,bL as xr,b1 as yr,a as gn,B as bn,l as me,aa as vr,k as wr,ae as Sr,m as Dt,bM as At,h as jr,j as Cr,q as kr,o as ie,n as Ir,p as Er,P as _r,I as Lr,N as Tr,by as Dr,a0 as Ar,t as Pr}from"./index-CkTEzTCn.js";import{aa as Rr,C as W,J as xn,Q as Mr,e as Or}from"./vendor-utils-ByKYcWuf.js";import{o as Ae}from"./vendor-arcblock-A4RQuZfN.js";import{u as Pt}from"./useLocalStorage-DZQPax49.js";import{f as bt}from"./index-DBs9Ljax.js";import{C as Rt}from"./confirm-BCjJ3Xga.js";import{g as Mt}from"./get-safe-url-Cgcqi5oF.js";import{u as yn}from"./session-GdZETrt0.js";import{a as ne,l as Nr}from"./vendor-hooks-OpgB8gyY.js";import{j as Ur,b as Br,M as zr,a as $r,T as Fr,N as Vr}from"./team-aiCyLcOV.js";import{c as Ot}from"./passport-CScachCU.js";import{D as Hr,u as vn}from"./useAsyncRetry-C8ETjgdm.js";import{u as wn}from"./useSetState-DFuQZPPV.js";import{x as Wr,d as qr}from"./index-CRlbskWD.js";import{O as Kr}from"./over-due-invoice-payment-mGIRggXd.js";import{u as Gr}from"./use-mobile-DCNBsOlH.js";const Sn=h.createContext({});function jn({children:e,type:t="blocklets"}){const[n,r]=h.useState([]),o=h.useRef([]),s=l=>{if(!o.current.includes(l)){const u=[...o.current,l];r(u),o.current=u}},a=l=>{if(o.current.includes(l)){const u=o.current.filter(d=>d!==l);r(u),o.current=u}},c=l=>{const u=n.filter(p=>l.find(f=>f===p));Rr(u,n).forEach(p=>a(p))};return i.jsx(Sn.Provider,{value:{type:t,deletingBlocklets:n,addDeletingDid:s,removeDeletingDid:a,matchDeletingDid:c},children:e})}jn.propTypes={type:S.string,children:S.node.isRequired};function ec(){return h.useContext(Sn)}const Qr=e=>h.createElement("svg",{width:32,height:32,viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},h.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9.32989 8.20744C11.2787 6.82349 13.6098 6.08 16 6.08C18.3902 6.08 20.7213 6.82349 22.6701 8.20744C24.6189 9.59139 26.089 11.5473 26.8766 13.804C27.6642 16.0607 27.7304 18.5066 27.0659 20.8026C26.4419 22.9587 25.2026 24.8823 23.5044 26.3404H8.49555C6.79735 24.8823 5.55809 22.9587 4.9341 20.8026C4.26961 18.5066 4.33575 16.0607 5.12337 13.804C5.91098 11.5473 7.38107 9.59139 9.32989 8.20744ZM16 3.52C13.0786 3.52 10.2295 4.42871 7.84764 6.1202C5.46575 7.81169 3.66898 10.2022 2.70634 12.9604C1.7437 15.7187 1.66286 18.708 2.47501 21.5143C3.28717 24.3205 4.95211 26.8046 7.23909 28.6224C7.46554 28.8024 7.74628 28.9004 8.03554 28.9004H23.9644C24.2537 28.9004 24.5344 28.8024 24.7609 28.6224C27.0479 26.8046 28.7128 24.3205 29.5249 21.5143C30.3371 18.708 30.2563 15.7187 29.2936 12.9604C28.331 10.2022 26.5342 7.81169 24.1523 6.1202C21.7704 4.42871 18.9214 3.52 16 3.52ZM21.8829 13.5921C22.3827 13.0923 22.3827 12.2818 21.8829 11.7819C21.383 11.2821 20.5725 11.2821 20.0727 11.7819L17.868 13.9866C17.3072 13.7012 16.6724 13.5404 16 13.5404C13.7221 13.5404 11.8755 15.3869 11.8755 17.6648C11.8755 19.9427 13.7221 21.7892 16 21.7892C18.2779 21.7892 20.1244 19.9427 20.1244 17.6648C20.1244 16.9924 19.9635 16.3576 19.6782 15.7968L21.8829 13.5921ZM14.4355 17.6648C14.4355 16.8008 15.136 16.1004 16 16.1004C16.864 16.1004 17.5644 16.8008 17.5644 17.6648C17.5644 18.5288 16.864 19.2292 16 19.2292C15.136 19.2292 14.4355 18.5288 14.4355 17.6648Z",fill:"currentColor"})),Y={Start:Eo,Stop:_o,Restart:Lo,Reload:Oo,Remove:To,Config:Mo,Log:Ro,Group:Po,Cancel:Do,Dashboard:Qr,Overview:Ao},Zr=(e,t)=>{if(!e)return"";if(!t)return e;const n=new URL(e),r=new URLSearchParams(n.searchParams),o=new URL(W(n.origin,t));return o.search=r.toString(),o.toString()},Xr="internal",Jr="external";function Cn({blocklet:e,onStart:t,onComplete:n,variant:r="menu",hasPermission:o=!1,getComponentUrl:s=null,useBlockletUrlEvaluation:a=()=>({loading:!1,recommendedUrl:window?.location?.href}),...c}){const l=ze(),[u,d]=h.useState(null),[p,f]=h.useState(null),[x,y]=h.useState(!1),[b,j]=h.useState(null),{t:v}=h.useContext(nn),[C]=Pt("skip-blocklet-setup",!1),{loading:g,recommendedUrl:k}=a(e),[_]=Pt("blocklet-type-filter",Xr),m=P.isInProgress(e.status),[E,O]=h.useState(!1);h.useEffect(()=>{if(!e?.controller)return;O(e?.controller?.status?.value===qe.BLOCKLET_CONTROLLER_STATUS.suspended),(async()=>{try{const D=await l.api.getLauncherSession({input:{launcherSessionId:e?.controller?.launcherSessionId,launcherUrl:e?.controller?.launcherUrl}});if(D?.error){console.error("get launcher session failed",D.error);return}O([R.LAUNCH_SESSION_STATUS.overdue,R.LAUNCH_SESSION_STATUS.canceled,R.LAUNCH_SESSION_STATUS.terminated].includes(D?.launcherSession?.status))}catch(D){console.error("call getLauncherSession error",D)}})()},[]);const{inService:M}=l,N=(w,D,K=!1)=>async()=>{const G=async Se=>{t({action:w,blocklet:e}),y(!0),f(w);let je=!1;try{if(w==="remove")await D(Se);else if(w==="start"){if(!P.hasRunnableComponent(e)){F.error(v("blocklet.noComponent"));return}if(!M&&!C&&!e.settings?.initialized&&e.mode!==qe.BLOCKLET_MODES.DEVELOPMENT){if(!k||!Tt(k)){F.error(v("blocklet.gotoVisitError"));return}const U=nr(l.info),kt=new URL(k);kt.searchParams.set("serverUrl",U),window.open(Mt(kt.href,{allowDomains:null})),n({action:w,blocklet:e});return}const $=e.children.filter(U=>!P.isInProgress(U.status)&&U.status!=="running"&&!P.isInProgress(U.greenStatus)&&U.greenStatus!=="running").map(U=>U.meta.did),J={did:e.meta.did,componentDids:$};await D({input:J})}else if(["stop","restart","reload"].includes(w)){const $=e.children.filter(U=>P.isBlockletRunning(U)).map(U=>U.meta.did),J={did:e.meta.did,componentDids:$};await D({input:J})}else{const $={did:e.meta.did};await D({input:$})}w==="remove"?je=!0:await or(1e3),w==="reload"&&F.success(v("blocklet.reloadSuccess")),j(null),n({action:w,blocklet:e})}catch($){const J=`Blocklet ${w} failed: ${bt($)}`;throw n({action:w,blocklet:e,error:new Error(J)}),new Error(J)}finally{je||y(!1)}},ve=()=>{y(!1),j(null)},we=P.getDisplayName(e,!0),vo=e.mode===qe.BLOCKLET_MODES.DEVELOPMENT?{description:()=>i.jsx(ee,{component:"div",children:i.jsx(ee,{gutterBottom:!0,children:v("blocklet.action.removeApplicationDescription")})}),params:{removeType:"complete"}}:{description:(Se,je)=>i.jsxs(ee,{component:"div",children:[i.jsx(ee,{gutterBottom:!0,children:v("blocklet.action.removeApplicationDescription")}),i.jsxs(Ho,{name:"removeType",value:Se.removeType,onChange:$=>je({...Se,removeType:$.target.value}),children:[i.jsx(Et,{value:"backup",control:i.jsx(_t,{}),label:v("blocklet.action.removeApplicationAfterBackup")}),i.jsx(Et,{value:"complete",control:i.jsx(_t,{}),label:v("blocklet.action.removeApplicationComplete")})]})]}),params:{removeType:"backup"}},wo={stop:{title:`${v("common.stop")} ${we}`,description:v("blocklet.action.stopDescription"),confirm:v("blocklet.action.confirmStop"),cancel:v("common.cancel"),onConfirm:G,onCancel:ve},restart:{title:`${v("common.restart")} ${we}`,description:v("blocklet.action.restartDescription"),confirm:v("blocklet.action.confirmRestart"),cancel:v("common.cancel"),onConfirm:G,onCancel:ve},remove:{title:`${v("common.remove")} ${we}`,confirm:v("blocklet.action.confirmRemove"),cancel:v("common.cancel"),onConfirm:G,onCancel:ve,...vo},cancelDownload:{title:`${v("common.cancel")}`,description:v("blocklet.action.cancelDownloadDescription",{name:we}),confirm:v("common.confirm"),cancel:v("common.cancel"),onConfirm:G,onCancel:ve}};K?j(wo[w]):await G()},We=!!u,mo=w=>{try{w.stopPropagation(),w.preventDefault()}catch{}d(w.currentTarget)},ho=w=>{try{w.stopPropagation(),w.preventDefault()}catch{}d(null)},Ct=async(w,D)=>{try{D.stopPropagation(),D.preventDefault()}catch{}if(typeof w.handler=="function")try{y(!0),f(w.action),await w.handler()}catch(K){console.error(`Blocklet ${w.name} failed: `,K)}finally{y(!1),d(null)}else d(null)},go=!M&&P.isDeletableBlocklet(e)?{action:"remove",icon:Y.Remove,name:v("common.remove"),handler:N("remove",async({removeType:w})=>{w==="backup"&&await l.api.backupBlocklet({input:{appDid:e.appDid,to:"disk"}}),await l.api.deleteBlocklet({input:{did:e.meta.did,keepData:!1}})},!0),disabled:m}:null,bo={action:"remove",icon:({sx:w,...D})=>i.jsx(Y.Cancel,{sx:{...w,paddingRight:"2px",zoom:.95},...D}),name:v("common.cancel"),handler:N("cancelDownload",l.api.cancelDownloadBlocklet,!0)},xo=P.getAppMissingConfigs(e),yo=()=>{const w=`/${e.mountPoint||"/"}`.replace(/\/+/g,"/"),D=s?.({mountPoint:w,blocklet:e});if(!D||!Tt(D)){F.error(v("blocklet.gotoVisitError"));return}const K=e?.site?.domainAliases;window.open(Mt(Zr(D,`${R.WELLKNOWN_SERVICE_PATH_PREFIX}/admin`),{allowDomains:K?.map(G=>G.value)}))};let ye=[{action:"start",icon:Y.Start,inExternal:!0,name:v("common.start"),handler:N("start",l.api.startBlocklet),disabled:E||e.children.every(w=>P.isBlockletRunning(w))||Ke(e.status)||g||m},{action:"stop",icon:Y.Stop,inExternal:!0,name:v("common.stop"),handler:N("stop",l.api.stopBlocklet,!0),disabled:!["running","starting"].includes(e.status)},{action:"restart",inExternal:!0,icon:Y.Restart,name:v("common.restart"),handler:N("restart",l.api.restartBlocklet,!0),disabled:E||e.status!=="running"},Ke(e.status)?bo:go,{separator:!0},M?null:{action:"dashboard",icon:({style:w,...D})=>i.jsx(Y.Dashboard,{...D,style:{...w,width:"26px",height:"26px",paddingRight:"3px"}}),name:v("sidebar.dashboard"),handler:yo}].filter(Boolean);return _===Jr&&(ye=ye.filter(w=>w.inExternal)),r==="menu"?i.jsxs(Nt,{"data-cy":"blocklet-actions",children:[i.jsx(Ne,{"aria-label":"more","aria-controls":"actions-menu","aria-haspopup":"true","data-cy":"trigger-blocklet-actions","actions-blocklet-did":e.meta.did,onClick:mo,size:"small",disabled:!o||!Ke(e.status)&&x,children:i.jsx(No,{})}),i.jsxs(Uo,{id:"actions-menu",anchorEl:u,keepMounted:!0,open:We,onClose:ho,PaperProps:{},children:[xo.length>0&&i.jsxs(gt,{style:{maxWidth:"400px"},severity:"error",children:[v("blocklet.config.missingRequired"),i.jsx("br",{}),i.jsx(fn,{to:`/blocklets/${e.meta.did}/components`,children:v("blocklet.config.gotoFix")})]}),ye.map((w,D)=>w.separator?i.jsx(Bo,{},`separator-${D}`):i.jsxs(zo,{dense:!0,onClick:K=>Ct(w,K),disabled:x||w.disabled,"data-cy":`${w.action}-blocklet`,children:[i.jsx($o,{style:{minWidth:24},children:p===w.action&&x?i.jsx(V,{size:16,sx:{marginRight:1}}):i.jsx(w.icon,{fontSize:"small"})}),i.jsx(Fo,{primary:w.name})]},w.name))]}),b&&i.jsx(Rt,{title:b.title,description:b.description,confirm:b.confirm,cancel:b.cancel,params:b.params,onConfirm:b.onConfirm,onCancel:b.onCancel})]}):i.jsxs(Nt,{"data-cy":"blocklet-actions",...c,children:[i.jsx(Vo,{children:ye.filter(w=>!w.separator&&!w.onlyInMenu).map(w=>i.jsxs(ht,{title:w.name,"data-cy":`${w.action}-blocklet`,onClick:()=>Ct(w),disabled:!!w.disabled||x,children:[p===w.action&&x?i.jsx(V,{size:16,sx:{marginRight:1}}):i.jsx(w.icon,{}),i.jsx("span",{className:"blocklet-action-text",children:w.name})]},w.name))}),b&&i.jsx(Rt,{title:b.title,description:b.description,confirm:b.confirm,cancel:b.cancel,params:b.params,onConfirm:b.onConfirm,onCancel:b.onCancel})]})}Cn.propTypes={getComponentUrl:S.func,blocklet:S.object.isRequired,onStart:S.func.isRequired,onComplete:S.func.isRequired,variant:S.oneOf(["menu","group"]),hasPermission:S.bool,useBlockletUrlEvaluation:S.func};const Nt=Ue.div`
2
+ import{p as nn,n as ht,H as F,V as B,aG as on,aH as So,Q as jo,M as rn,U as sn,E as It,w as Co,j as ko,i as Io,_ as L}from"./vendor-ux-IiQnod3w.js";import{j as i,W as S,aZ as Eo,cN as _o,d9 as Lo,bb as To,dh as Do,di as Ao,cP as Po,dj as Ro,dd as Mo,dk as Oo,I as Ne,aQ as No,aR as Uo,aX as gt,a3 as Bo,M as zo,aO as $o,a6 as V,aP as Fo,bi as Vo,at as Ue,T as ee,bq as Ho,b6 as Et,br as _t,ak as I,D as pe,J as re,ah as Be,ao as Wo,dl as qo,aj as Ko,dm as an,dn as cn,dp as ln,am as de,a$ as _e,dq as Lt,U as Q,aN as un,Y as dn,b_ as Go,dr as Qo,ds as Zo,Q as Xo,dt as Jo}from"./vendor-mui-core-CnXrAOs3.js";import{r as h,L as fn,i as pn,g as Yo,k as er,j as tr}from"./vendor-react-Dvs43sk9.js";import{_ as ze,e as P,Y as qe,an as Ke,c as R,Z as Tt,bA as nr,a2 as or,ac as rr,v as sr,bB as ir,bC as mn,a1 as te,bD as hn,aR as ar,bE as cr,X as lr,b0 as ur,b1 as dr,bF as fr,b2 as pr,bG as mr,bH as hr,am as gr,bI as Ge,bJ as br,bK as xr,a$ as yr,a as gn,B as bn,l as me,aa as vr,k as wr,ae as Sr,m as Dt,bL as At,h as jr,j as Cr,q as kr,o as ie,n as Ir,p as Er,P as _r,I as Lr,N as Tr,bx as Dr,a0 as Ar,t as Pr}from"./index-sNHCLgAE.js";import{aa as Rr,C as W,J as xn,Q as Mr,e as Or}from"./vendor-utils-cJEl_UEd.js";import{o as Ae}from"./vendor-arcblock-CuFtPveO.js";import{u as Pt}from"./useLocalStorage-C9RLNbTa.js";import{f as bt}from"./index-DBs9Ljax.js";import{C as Rt}from"./confirm-CR8be0u2.js";import{g as Mt}from"./get-safe-url-DpalOXcM.js";import{u as yn}from"./session-BAD0lxQk.js";import{a as ne,l as Nr}from"./vendor-hooks-CjESGRlR.js";import{j as Ur,b as Br,M as zr,a as $r,T as Fr,N as Vr}from"./team-DQuySqMB.js";import{c as Ot}from"./passport-Y64u4kIS.js";import{D as Hr,u as vn}from"./useAsyncRetry-DwwEjrjs.js";import{u as wn}from"./useSetState-DFuQZPPV.js";import{x as Wr,d as qr}from"./index-C45ih46D.js";import{O as Kr}from"./over-due-invoice-payment-DUg5ApsD.js";import{u as Gr}from"./use-mobile-DCNBsOlH.js";const Sn=h.createContext({});function jn({children:e,type:t="blocklets"}){const[n,r]=h.useState([]),o=h.useRef([]),s=l=>{if(!o.current.includes(l)){const u=[...o.current,l];r(u),o.current=u}},a=l=>{if(o.current.includes(l)){const u=o.current.filter(d=>d!==l);r(u),o.current=u}},c=l=>{const u=n.filter(p=>l.find(f=>f===p));Rr(u,n).forEach(p=>a(p))};return i.jsx(Sn.Provider,{value:{type:t,deletingBlocklets:n,addDeletingDid:s,removeDeletingDid:a,matchDeletingDid:c},children:e})}jn.propTypes={type:S.string,children:S.node.isRequired};function ec(){return h.useContext(Sn)}const Qr=e=>h.createElement("svg",{width:32,height:32,viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},h.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9.32989 8.20744C11.2787 6.82349 13.6098 6.08 16 6.08C18.3902 6.08 20.7213 6.82349 22.6701 8.20744C24.6189 9.59139 26.089 11.5473 26.8766 13.804C27.6642 16.0607 27.7304 18.5066 27.0659 20.8026C26.4419 22.9587 25.2026 24.8823 23.5044 26.3404H8.49555C6.79735 24.8823 5.55809 22.9587 4.9341 20.8026C4.26961 18.5066 4.33575 16.0607 5.12337 13.804C5.91098 11.5473 7.38107 9.59139 9.32989 8.20744ZM16 3.52C13.0786 3.52 10.2295 4.42871 7.84764 6.1202C5.46575 7.81169 3.66898 10.2022 2.70634 12.9604C1.7437 15.7187 1.66286 18.708 2.47501 21.5143C3.28717 24.3205 4.95211 26.8046 7.23909 28.6224C7.46554 28.8024 7.74628 28.9004 8.03554 28.9004H23.9644C24.2537 28.9004 24.5344 28.8024 24.7609 28.6224C27.0479 26.8046 28.7128 24.3205 29.5249 21.5143C30.3371 18.708 30.2563 15.7187 29.2936 12.9604C28.331 10.2022 26.5342 7.81169 24.1523 6.1202C21.7704 4.42871 18.9214 3.52 16 3.52ZM21.8829 13.5921C22.3827 13.0923 22.3827 12.2818 21.8829 11.7819C21.383 11.2821 20.5725 11.2821 20.0727 11.7819L17.868 13.9866C17.3072 13.7012 16.6724 13.5404 16 13.5404C13.7221 13.5404 11.8755 15.3869 11.8755 17.6648C11.8755 19.9427 13.7221 21.7892 16 21.7892C18.2779 21.7892 20.1244 19.9427 20.1244 17.6648C20.1244 16.9924 19.9635 16.3576 19.6782 15.7968L21.8829 13.5921ZM14.4355 17.6648C14.4355 16.8008 15.136 16.1004 16 16.1004C16.864 16.1004 17.5644 16.8008 17.5644 17.6648C17.5644 18.5288 16.864 19.2292 16 19.2292C15.136 19.2292 14.4355 18.5288 14.4355 17.6648Z",fill:"currentColor"})),Y={Start:Eo,Stop:_o,Restart:Lo,Reload:Oo,Remove:To,Config:Mo,Log:Ro,Group:Po,Cancel:Do,Dashboard:Qr,Overview:Ao},Zr=(e,t)=>{if(!e)return"";if(!t)return e;const n=new URL(e),r=new URLSearchParams(n.searchParams),o=new URL(W(n.origin,t));return o.search=r.toString(),o.toString()},Xr="internal",Jr="external";function Cn({blocklet:e,onStart:t,onComplete:n,variant:r="menu",hasPermission:o=!1,getComponentUrl:s=null,useBlockletUrlEvaluation:a=()=>({loading:!1,recommendedUrl:window?.location?.href}),...c}){const l=ze(),[u,d]=h.useState(null),[p,f]=h.useState(null),[x,y]=h.useState(!1),[b,j]=h.useState(null),{t:v}=h.useContext(nn),[C]=Pt("skip-blocklet-setup",!1),{loading:g,recommendedUrl:k}=a(e),[_]=Pt("blocklet-type-filter",Xr),m=P.isInProgress(e.status),[E,O]=h.useState(!1);h.useEffect(()=>{if(!e?.controller)return;O(e?.controller?.status?.value===qe.BLOCKLET_CONTROLLER_STATUS.suspended),(async()=>{try{const D=await l.api.getLauncherSession({input:{launcherSessionId:e?.controller?.launcherSessionId,launcherUrl:e?.controller?.launcherUrl}});if(D?.error){console.error("get launcher session failed",D.error);return}O([R.LAUNCH_SESSION_STATUS.overdue,R.LAUNCH_SESSION_STATUS.canceled,R.LAUNCH_SESSION_STATUS.terminated].includes(D?.launcherSession?.status))}catch(D){console.error("call getLauncherSession error",D)}})()},[]);const{inService:M}=l,N=(w,D,K=!1)=>async()=>{const G=async Se=>{t({action:w,blocklet:e}),y(!0),f(w);let je=!1;try{if(w==="remove")await D(Se);else if(w==="start"){if(!P.hasRunnableComponent(e)){F.error(v("blocklet.noComponent"));return}if(!M&&!C&&!e.settings?.initialized&&e.mode!==qe.BLOCKLET_MODES.DEVELOPMENT){if(!k||!Tt(k)){F.error(v("blocklet.gotoVisitError"));return}const U=nr(l.info),kt=new URL(k);kt.searchParams.set("serverUrl",U),window.open(Mt(kt.href,{allowDomains:null})),n({action:w,blocklet:e});return}const $=e.children.filter(U=>!P.isInProgress(U.status)&&U.status!=="running"&&!P.isInProgress(U.greenStatus)&&U.greenStatus!=="running").map(U=>U.meta.did),J={did:e.meta.did,componentDids:$};await D({input:J})}else if(["stop","restart","reload"].includes(w)){const $=e.children.filter(U=>P.isBlockletRunning(U)).map(U=>U.meta.did),J={did:e.meta.did,componentDids:$};await D({input:J})}else{const $={did:e.meta.did};await D({input:$})}w==="remove"?je=!0:await or(1e3),w==="reload"&&F.success(v("blocklet.reloadSuccess")),j(null),n({action:w,blocklet:e})}catch($){const J=`Blocklet ${w} failed: ${bt($)}`;throw n({action:w,blocklet:e,error:new Error(J)}),new Error(J)}finally{je||y(!1)}},ve=()=>{y(!1),j(null)},we=P.getDisplayName(e,!0),vo=e.mode===qe.BLOCKLET_MODES.DEVELOPMENT?{description:()=>i.jsx(ee,{component:"div",children:i.jsx(ee,{gutterBottom:!0,children:v("blocklet.action.removeApplicationDescription")})}),params:{removeType:"complete"}}:{description:(Se,je)=>i.jsxs(ee,{component:"div",children:[i.jsx(ee,{gutterBottom:!0,children:v("blocklet.action.removeApplicationDescription")}),i.jsxs(Ho,{name:"removeType",value:Se.removeType,onChange:$=>je({...Se,removeType:$.target.value}),children:[i.jsx(Et,{value:"backup",control:i.jsx(_t,{}),label:v("blocklet.action.removeApplicationAfterBackup")}),i.jsx(Et,{value:"complete",control:i.jsx(_t,{}),label:v("blocklet.action.removeApplicationComplete")})]})]}),params:{removeType:"backup"}},wo={stop:{title:`${v("common.stop")} ${we}`,description:v("blocklet.action.stopDescription"),confirm:v("blocklet.action.confirmStop"),cancel:v("common.cancel"),onConfirm:G,onCancel:ve},restart:{title:`${v("common.restart")} ${we}`,description:v("blocklet.action.restartDescription"),confirm:v("blocklet.action.confirmRestart"),cancel:v("common.cancel"),onConfirm:G,onCancel:ve},remove:{title:`${v("common.remove")} ${we}`,confirm:v("blocklet.action.confirmRemove"),cancel:v("common.cancel"),onConfirm:G,onCancel:ve,...vo},cancelDownload:{title:`${v("common.cancel")}`,description:v("blocklet.action.cancelDownloadDescription",{name:we}),confirm:v("common.confirm"),cancel:v("common.cancel"),onConfirm:G,onCancel:ve}};K?j(wo[w]):await G()},We=!!u,mo=w=>{try{w.stopPropagation(),w.preventDefault()}catch{}d(w.currentTarget)},ho=w=>{try{w.stopPropagation(),w.preventDefault()}catch{}d(null)},Ct=async(w,D)=>{try{D.stopPropagation(),D.preventDefault()}catch{}if(typeof w.handler=="function")try{y(!0),f(w.action),await w.handler()}catch(K){console.error(`Blocklet ${w.name} failed: `,K)}finally{y(!1),d(null)}else d(null)},go=!M&&P.isDeletableBlocklet(e)?{action:"remove",icon:Y.Remove,name:v("common.remove"),handler:N("remove",async({removeType:w})=>{w==="backup"&&await l.api.backupBlocklet({input:{appDid:e.appDid,to:"disk"}}),await l.api.deleteBlocklet({input:{did:e.meta.did,keepData:!1}})},!0),disabled:m}:null,bo={action:"remove",icon:({sx:w,...D})=>i.jsx(Y.Cancel,{sx:{...w,paddingRight:"2px",zoom:.95},...D}),name:v("common.cancel"),handler:N("cancelDownload",l.api.cancelDownloadBlocklet,!0)},xo=P.getAppMissingConfigs(e),yo=()=>{const w=`/${e.mountPoint||"/"}`.replace(/\/+/g,"/"),D=s?.({mountPoint:w,blocklet:e});if(!D||!Tt(D)){F.error(v("blocklet.gotoVisitError"));return}const K=e?.site?.domainAliases;window.open(Mt(Zr(D,`${R.WELLKNOWN_SERVICE_PATH_PREFIX}/admin`),{allowDomains:K?.map(G=>G.value)}))};let ye=[{action:"start",icon:Y.Start,inExternal:!0,name:v("common.start"),handler:N("start",l.api.startBlocklet),disabled:E||e.children.every(w=>P.isBlockletRunning(w))||Ke(e.status)||g||m},{action:"stop",icon:Y.Stop,inExternal:!0,name:v("common.stop"),handler:N("stop",l.api.stopBlocklet,!0),disabled:!["running","starting"].includes(e.status)},{action:"restart",inExternal:!0,icon:Y.Restart,name:v("common.restart"),handler:N("restart",l.api.restartBlocklet,!0),disabled:E||e.status!=="running"},Ke(e.status)?bo:go,{separator:!0},M?null:{action:"dashboard",icon:({style:w,...D})=>i.jsx(Y.Dashboard,{...D,style:{...w,width:"26px",height:"26px",paddingRight:"3px"}}),name:v("sidebar.dashboard"),handler:yo}].filter(Boolean);return _===Jr&&(ye=ye.filter(w=>w.inExternal)),r==="menu"?i.jsxs(Nt,{"data-cy":"blocklet-actions",children:[i.jsx(Ne,{"aria-label":"more","aria-controls":"actions-menu","aria-haspopup":"true","data-cy":"trigger-blocklet-actions","actions-blocklet-did":e.meta.did,onClick:mo,size:"small",disabled:!o||!Ke(e.status)&&x,children:i.jsx(No,{})}),i.jsxs(Uo,{id:"actions-menu",anchorEl:u,keepMounted:!0,open:We,onClose:ho,PaperProps:{},children:[xo.length>0&&i.jsxs(gt,{style:{maxWidth:"400px"},severity:"error",children:[v("blocklet.config.missingRequired"),i.jsx("br",{}),i.jsx(fn,{to:`/blocklets/${e.meta.did}/components`,children:v("blocklet.config.gotoFix")})]}),ye.map((w,D)=>w.separator?i.jsx(Bo,{},`separator-${D}`):i.jsxs(zo,{dense:!0,onClick:K=>Ct(w,K),disabled:x||w.disabled,"data-cy":`${w.action}-blocklet`,children:[i.jsx($o,{style:{minWidth:24},children:p===w.action&&x?i.jsx(V,{size:16,sx:{marginRight:1}}):i.jsx(w.icon,{fontSize:"small"})}),i.jsx(Fo,{primary:w.name})]},w.name))]}),b&&i.jsx(Rt,{title:b.title,description:b.description,confirm:b.confirm,cancel:b.cancel,params:b.params,onConfirm:b.onConfirm,onCancel:b.onCancel})]}):i.jsxs(Nt,{"data-cy":"blocklet-actions",...c,children:[i.jsx(Vo,{children:ye.filter(w=>!w.separator&&!w.onlyInMenu).map(w=>i.jsxs(ht,{title:w.name,"data-cy":`${w.action}-blocklet`,onClick:()=>Ct(w),disabled:!!w.disabled||x,children:[p===w.action&&x?i.jsx(V,{size:16,sx:{marginRight:1}}):i.jsx(w.icon,{}),i.jsx("span",{className:"blocklet-action-text",children:w.name})]},w.name))}),b&&i.jsx(Rt,{title:b.title,description:b.description,confirm:b.confirm,cancel:b.cancel,params:b.params,onConfirm:b.onConfirm,onCancel:b.onCancel})]})}Cn.propTypes={getComponentUrl:S.func,blocklet:S.object.isRequired,onStart:S.func.isRequired,onComplete:S.func.isRequired,variant:S.oneOf(["menu","group"]),hasPermission:S.bool,useBlockletUrlEvaluation:S.func};const Nt=Ue.div`
3
3
  display: flex;
4
4
  align-items: center;
5
5
 
@@ -61,7 +61,7 @@ ${r}
61
61
  .header-brand-addon {
62
62
  display: block;
63
63
  }
64
- `;function ta(){const{t:e,locale:t}=B(),{blocklet:n,launcherSession:r,refreshSubscription:o}=me(),{connectApi:s,session:a,api:c}=gn(),[l,u]=h.useState(!1),[d,p]=h.useState(""),[f,x]=Nr({subscriptionURL:"#"});if(h.useEffect(()=>{(Dt(n,r)||At(r))&&jr({launcherSessionId:n?.controller?.launcherSessionId,launcherUrl:n?.controller?.launcherUrl,locale:t}).then(v=>{x({subscriptionURL:v})}).catch(v=>{console.error("get subscription url error:",v)})},[n,r]),h.useEffect(()=>{if(n.controller?.launcherUrl){const v=W(n.controller.launcherUrl,"__blocklet__.js?type=json");fetch(v).then(C=>C.json()).then(C=>{const g=C.componentMountPoints?.find(_=>_.did==="z2qaCNvKMv5GjouKdcDWexv6WqtHbpNPQDnAk")?.mountPoint,k=W(n.controller.launcherUrl,g);p(k)})}},[n.controller?.launcherUrl]),!n||!r)return"";let y=null,b="",j="error";return Cr(r)?(y=kr(r)?i.jsx(_e,{href:f.subscriptionURL,children:e("blocklet.manageSubscription")}):i.jsx(Xo,{variant:"text",color:"error",onClick:()=>u(!0),sx:{lineHeight:"inherit",fontSize:"inherit"},children:e("blocklet.payNow")}),b=e("blocklet.suspendedCausedByPastDue",{deadline:ie(r?.reservedUntil,t)})):At(r)?(y=i.jsx(_e,{href:f.subscriptionURL,children:e("blocklet.manageSubscription")}),b=e("blocklet.willBeSuspendedSoon",{deadline:ie((r?.subscription?.cancel_at||0)*1e3,t)}),j="warning"):Dt(n,r)?(y=i.jsx(_e,{href:f.subscriptionURL,children:e("blocklet.manageSubscription")}),b=e("blocklet.suspendedCausedByExpired",{deadline:ie(r?.reservedUntil,t),canceledAt:ie((r?.subscription?.canceled_at||0)*1e3,t)})):Ir(n,r)&&(y=i.jsx(fn,{to:W(R.WELLKNOWN_BLOCKLET_ADMIN_PATH,"/did-spaces"),children:e("common.backup")}),b=e("blocklet.suspendedCausedByTerminated",{canceledAt:ie(r?.terminatedAt,t),deadline:Er(r?.terminatedAt,t)})),b?i.jsxs(i.Fragment,{children:[i.jsxs(gt,{severity:j,sx:{mb:1},children:[b,i.jsx(ee,{sx:{display:"inline-block",fontSize:"inherit",lineHeight:"inherit",ml:1,a:{textDecoration:"auto"},"& .MuiButtonBase-root":{p:0,minWidth:"auto"}},children:y})]}),l&&d&&r&&i.jsx(_r,{session:a,connect:s,baseUrl:d,authToken:r.subscription.authToken,children:i.jsx(Kr,{dialogProps:{open:l,onClose:()=>u(!1)},subscriptionId:r.subscription.id,successToast:!0,onPaid:()=>{c.post("/blocklet/start?fromSetup=1"),o(),u(!1)}})})]}):null}const na=h.lazy(()=>L(()=>import("./log-CQbIkXws.js"),__vite__mapDeps([0,1]),import.meta.url)),oa=h.lazy(()=>L(()=>import("./index-DrTSvHzP.js"),__vite__mapDeps([0,1]),import.meta.url)),ra=h.lazy(()=>L(()=>import("./index-CpPbuWHL.js"),__vite__mapDeps([0,1]),import.meta.url)),sa=h.lazy(()=>L(()=>import("./index-CFpcdpS5.js"),__vite__mapDeps([0,1,2]),import.meta.url)),ia=h.lazy(()=>L(()=>import("./overview-DmcFvtLD.js"),__vite__mapDeps([0,1]),import.meta.url)),aa=h.lazy(()=>L(()=>import("./domains-Pt7MqfcA.js"),__vite__mapDeps([0,1]),import.meta.url)),ca=h.lazy(()=>L(()=>import("./index-DoyPDWTY.js"),__vite__mapDeps([0,1]),import.meta.url)),la=h.lazy(()=>L(()=>import("./appearance-Du24FS2u.js"),__vite__mapDeps([0,1]),import.meta.url)),ua=h.lazy(()=>L(()=>import("./audit-logs-CC69qHzz.js"),__vite__mapDeps([0,1,2]),import.meta.url)),da=h.lazy(()=>L(()=>import("./index-C0w3lI6i.js"),__vite__mapDeps([0,1]),import.meta.url)),fa=h.lazy(()=>L(()=>import("./config-navigation-CFyO-icX.js"),__vite__mapDeps([0,1]),import.meta.url)),pa=h.lazy(()=>L(()=>import("./index-Db6d_BmF.js"),__vite__mapDeps([0,1]),import.meta.url)),ma=h.lazy(()=>L(()=>import("./index-CKPpLyCQ.js"),__vite__mapDeps([0,1]),import.meta.url)),ha=h.lazy(()=>L(()=>import("./security-BcRPxWAt.js"),__vite__mapDeps([0,1]),import.meta.url)),ga=h.lazy(()=>L(()=>import("./branding-DtWd56Gj.js"),__vite__mapDeps([0,1]),import.meta.url)),ba=h.lazy(()=>L(()=>import("./advanced-C0Q1MXTZ.js"),__vite__mapDeps([0,1]),import.meta.url)),xa=h.lazy(()=>L(()=>import("./traffic-CPElxbIH.js").then(e=>e.t),__vite__mapDeps([0,1]),import.meta.url)),ya=h.lazy(()=>L(()=>import("./runtime-CC2luaxU.js"),__vite__mapDeps([0,1]),import.meta.url)),va=h.lazy(()=>L(()=>import("./index-D-Y0UA7w.js"),__vite__mapDeps([0,1]),import.meta.url)),wa=h.lazy(()=>L(()=>import("./list-BZRp_F7-.js"),__vite__mapDeps([0,1]),import.meta.url)),Sa=h.lazy(()=>L(()=>import("./index-BCF14HSR.js"),__vite__mapDeps([0,1]),import.meta.url)),ja=h.lazy(()=>L(()=>import("./config-zjFvoy0D.js").then(e=>e.c),__vite__mapDeps([0,1]),import.meta.url)),Ca=h.lazy(()=>L(()=>import("./observability-Zow0Sv-X.js"),[],import.meta.url)),ka=h.lazy(()=>L(()=>import("./playground-CAOOFQT1.js"),[],import.meta.url)),Ia=h.lazy(()=>L(()=>import("./index-CuFT_Y96.js").then(e=>e.i),__vite__mapDeps([0,1]),import.meta.url)),Ea=h.lazy(()=>L(()=>import("./component-BHy3j7aa.js"),__vite__mapDeps([0,1,2,3]),import.meta.url)),_a=h.lazy(()=>L(()=>import("./index-CYIpEo41.js"),__vite__mapDeps([0,1]),import.meta.url)),La=W(R.WELLKNOWN_SERVICE_PATH_PREFIX,"user","notifications"),Ta=e=>{const{enqueueSnackbar:t}=on(),n=h.useCallback(r=>xn(La,{id:r.id,severity:r.severity||"all",componentDid:r.source==="system"?"system":r.componentDid||"all"}),[]);Dr(`${e}/${R.EVENTS.NOTIFICATION_BLOCKLET_CREATE}`,r=>{const o=n(r),{severity:s,description:a}=r||{},c=["error","warning"].includes(s)||r.sticky;r.source==="system"&&t(a,{variant:s,autoHideDuration:c?null:5e3,content:l=>i.jsx(ls,{viewAllUrl:o,keyId:l,notification:r,content:i.jsx(Vr,{notification:r,minimal:!0,rows:0})})})},[],"user")};function po({blocklet:e,isAdmin:t}){return t?i.jsx(da,{blocklet:e}):i.jsx(Pr,{status:403})}po.propTypes={blocklet:S.object.isRequired,isAdmin:S.bool.isRequired};const Da=e=>{const{t}=B(),{blocklet:n,actions:{refreshBlocklet:r},client:o,did:s}=me(),a=ne(()=>Or(n,"settings.org.enabled",!1),[n]),c=n?.meta?.did,l=!n||Ar(n.status)?[]:P.getAppMissingConfigs(n),u={overview:[{label:t("common.overview"),value:"overview"},{label:i.jsx(Jo,{"data-cy":"blocklet-list",color:"error",variant:"dot",invisible:!l.length,children:t("common.components")}),labelText:t("common.components"),value:"components"}],"did-connect":[{label:t("common.members"),value:"members"},a?{label:t("common.orgs"),value:"orgs"}:null,{label:t("team.member.passports"),value:"passports"},{label:t("common.setting"),value:"settings"},{label:t("common.security"),value:"security"},{label:t("oauth.client.tab"),value:"oauth"}].filter(Boolean),aigne:[{label:t("setup.aigne.config"),value:"aigne-config"}],website:[{label:t("common.domains"),value:"domains"},{label:t("common.branding"),value:"branding"},{label:t("common.theming"),value:"theming"},{label:t("common.navigation"),value:"navigation"}],operations:[{label:t("common.notificationRecords"),value:"notifications",show:e},{label:t("common.analytics"),value:"analytics"},{label:t("common.auditLogs"),value:"audit-logs"},{label:t("common.advancedConfig"),value:"advanced"}],integrations:[{label:"Webhooks",value:"webhooks",show:e},{label:t("common.accessKeys"),value:"access-keys"},{label:t("common.mcpServers"),value:"mcp-servers"}],developers:[{label:t("common.logs"),value:"logs",show:n?.children?.length&&n.structVersion===R.APP_STRUCT_VERSION},{label:t("common.performance"),value:"performance"},{label:t("common.docs"),value:"docs"}]},d={overview:ia,components:Ea,members:i.jsx(oa,{type:"blocklet",createPassportSvg:Ot}),passports:i.jsx(ca,{createPassportSvg:Ot}),orgs:i.jsx(Ia,{editable:!1,mode:"dashboard",layout:"table"}),settings:i.jsx(ma,{orientation:"vertical"}),security:i.jsx(ha,{}),"did-spaces":i.jsx(pa,{navOrientation:"horizontal"}),domains:aa,branding:i.jsx(ga,{blocklet:n,onUpdate:r}),theming:i.jsx(la,{}),navigation:fa,sitemap:i.jsx(Io,{children:t("common.comingSoon")}),notifications:i.jsx(po,{blocklet:n,isAdmin:e}),"audit-logs":i.jsx(ua,{scope:c,categories:["blocklet","team","security","certificates","gateway"]}),analytics:i.jsx(xa,{client:o,did:s}),advanced:i.jsx(ba,{blocklet:n,onUpdate:r}),webhooks:i.jsx(ra,{}),"access-keys":i.jsx(va,{}),"mcp-servers":i.jsx(Sa,{}),logs:na,performance:i.jsx(ya,{client:o,did:s}),docs:_a,publish:i.jsx(sa,{}),oauth:i.jsx(wa,{}),"aigne-config":i.jsx(I,{sx:{maxWidth:1536},children:i.jsx(ja,{})}),"aigne-observability":i.jsx(Ca,{}),"aigne-playground":i.jsx(ka,{})};return{tabGroups:u,renders:d}};function Aa(){const e=pn(),{tab:t="overview",subtab:n}=tr(),{locale:r}=B(),{blocklet:o,refreshFlag:s}=me(),{session:a}=yn(),c=ne(()=>a?.user?.did,[a]),l=Gr(),u=ne(()=>a.user?.role&&bn.includes(a.user.role),[a]);Ta(c);const{tabGroups:d,renders:p}=Da(u),f=g=>{e(`${R.WELLKNOWN_SERVICE_PATH_PREFIX}/admin/${t}/${g}`)},x=(d[t]||[]).filter(g=>g.show===void 0||g.show),y=(x||[]).find(g=>g.value===n)?.value||x?.[0]?.value||t,b=p[y]||p.overview,j=["overview"].includes(t),v=o?i.jsxs(jn,{type:"components",children:[x.length>0&&i.jsxs(I,{sx:{mb:2,display:"flex",alignItems:"center",gap:2},children:[i.jsx(ko,{tabs:x,current:y,onChange:f,scrollButtons:"auto"}),j&&!l&&i.jsx(I,{sx:{flex:1,display:"flex",justifyContent:"flex-end"},children:i.jsx(I,{component:"div",className:"page-header",children:o?i.jsx(Ut,{className:"page-actions",hasPermission:!0,blocklet:o,onStart:()=>{},onComplete:({error:g}={})=>{g&&F.error(g.message)},variant:"group"}):null})})]}),i.jsx(I,{className:"page-content",children:i.jsx(h.Suspense,{fallback:i.jsx(Ae,{relative:"parent",children:i.jsx(V,{})}),children:h.isValidElement(b)?b:i.jsx(b,{blocklet:o})})})]}):i.jsx(Ae,{relative:"parent",children:i.jsx(V,{})}),C=ne(()=>{const g=window.blocklet?.navigation?.find(M=>M.id==="/team"&&M.section==="dashboard"),k=o?.meta?.title||"";let _="";if(g){const M=W(R.WELLKNOWN_BLOCKLET_ADMIN_PATH,t,t==="publish"?n:"");_=g.items.find(We=>We.link===M)?.title?.[r]||""}const m=x.find(M=>M.value===n),O=[m?.labelText||m?.label||x?.[0]?.labelText||x?.[0]?.label||"",_].filter(Boolean).join(" - ");return k?O?`${O} | ${k}`:k:O||""},[t,n,o,r]);return i.jsx(Tr,{children:i.jsx(Fr,{children:i.jsx(fo,{title:C,children:i.jsxs(Ra,{children:[l&&j&&i.jsx(I,{component:"div",className:"page-header",sx:{mb:2},children:o?i.jsx(Ut,{className:"page-actions",hasPermission:!0,blocklet:o,onStart:()=>{},onComplete:({error:g}={})=>{g&&F.error(g.message)},variant:"group"}):null}),i.jsx(ts,{}),i.jsx(ta,{}),v]})},`${s}`)})})}function Pa(){const{blocklet:e}=me(),t=e?.meta?.did;return h.useEffect(()=>{const n=Lr();return t&&n.connect(),()=>{t&&n.isConnected()&&n.disconnect()}},[t]),i.jsx(Aa,{})}const Ra=Ue.main`
64
+ `;function ta(){const{t:e,locale:t}=B(),{blocklet:n,launcherSession:r,refreshSubscription:o}=me(),{connectApi:s,session:a,api:c}=gn(),[l,u]=h.useState(!1),[d,p]=h.useState(""),[f,x]=Nr({subscriptionURL:"#"});if(h.useEffect(()=>{(Dt(n,r)||At(r))&&jr({launcherSessionId:n?.controller?.launcherSessionId,launcherUrl:n?.controller?.launcherUrl,locale:t}).then(v=>{x({subscriptionURL:v})}).catch(v=>{console.error("get subscription url error:",v)})},[n,r]),h.useEffect(()=>{if(n.controller?.launcherUrl){const v=W(n.controller.launcherUrl,"__blocklet__.js?type=json");fetch(v).then(C=>C.json()).then(C=>{const g=C.componentMountPoints?.find(_=>_.did==="z2qaCNvKMv5GjouKdcDWexv6WqtHbpNPQDnAk")?.mountPoint,k=W(n.controller.launcherUrl,g);p(k)})}},[n.controller?.launcherUrl]),!n||!r)return"";let y=null,b="",j="error";return Cr(r)?(y=kr(r)?i.jsx(_e,{href:f.subscriptionURL,children:e("blocklet.manageSubscription")}):i.jsx(Xo,{variant:"text",color:"error",onClick:()=>u(!0),sx:{lineHeight:"inherit",fontSize:"inherit"},children:e("blocklet.payNow")}),b=e("blocklet.suspendedCausedByPastDue",{deadline:ie(r?.reservedUntil,t)})):At(r)?(y=i.jsx(_e,{href:f.subscriptionURL,children:e("blocklet.manageSubscription")}),b=e("blocklet.willBeSuspendedSoon",{deadline:ie((r?.subscription?.cancel_at||0)*1e3,t)}),j="warning"):Dt(n,r)?(y=i.jsx(_e,{href:f.subscriptionURL,children:e("blocklet.manageSubscription")}),b=e("blocklet.suspendedCausedByExpired",{deadline:ie(r?.reservedUntil,t),canceledAt:ie((r?.subscription?.canceled_at||0)*1e3,t)})):Ir(n,r)&&(y=i.jsx(fn,{to:W(R.WELLKNOWN_BLOCKLET_ADMIN_PATH,"/did-spaces"),children:e("common.backup")}),b=e("blocklet.suspendedCausedByTerminated",{canceledAt:ie(r?.terminatedAt,t),deadline:Er(r?.terminatedAt,t)})),b?i.jsxs(i.Fragment,{children:[i.jsxs(gt,{severity:j,sx:{mb:1},children:[b,i.jsx(ee,{sx:{display:"inline-block",fontSize:"inherit",lineHeight:"inherit",ml:1,a:{textDecoration:"auto"},"& .MuiButtonBase-root":{p:0,minWidth:"auto"}},children:y})]}),l&&d&&r&&i.jsx(_r,{session:a,connect:s,baseUrl:d,authToken:r.subscription.authToken,children:i.jsx(Kr,{dialogProps:{open:l,onClose:()=>u(!1)},subscriptionId:r.subscription.id,successToast:!0,onPaid:()=>{c.post("/blocklet/start?fromSetup=1"),o(),u(!1)}})})]}):null}const na=h.lazy(()=>L(()=>import("./log-C34JsgaL.js"),__vite__mapDeps([0,1]),import.meta.url)),oa=h.lazy(()=>L(()=>import("./index-F1NFyTyg.js"),__vite__mapDeps([0,1]),import.meta.url)),ra=h.lazy(()=>L(()=>import("./index-DZRxerxf.js"),__vite__mapDeps([0,1]),import.meta.url)),sa=h.lazy(()=>L(()=>import("./index-BQF4zMs8.js"),__vite__mapDeps([0,1,2]),import.meta.url)),ia=h.lazy(()=>L(()=>import("./overview-B-nkIeNy.js"),__vite__mapDeps([0,1]),import.meta.url)),aa=h.lazy(()=>L(()=>import("./domains-Bqr-LIHe.js"),__vite__mapDeps([0,1]),import.meta.url)),ca=h.lazy(()=>L(()=>import("./index-C-ToEbCG.js"),__vite__mapDeps([0,1]),import.meta.url)),la=h.lazy(()=>L(()=>import("./appearance-BqBKdeI5.js"),__vite__mapDeps([0,1]),import.meta.url)),ua=h.lazy(()=>L(()=>import("./audit-logs-DtLr59sc.js"),__vite__mapDeps([0,1,2]),import.meta.url)),da=h.lazy(()=>L(()=>import("./index-7L77Yf9w.js"),__vite__mapDeps([0,1]),import.meta.url)),fa=h.lazy(()=>L(()=>import("./config-navigation-D1-Loy5H.js"),__vite__mapDeps([0,1]),import.meta.url)),pa=h.lazy(()=>L(()=>import("./index-Bjj89nDJ.js"),__vite__mapDeps([0,1]),import.meta.url)),ma=h.lazy(()=>L(()=>import("./index-gt5P4O5b.js"),__vite__mapDeps([0,1]),import.meta.url)),ha=h.lazy(()=>L(()=>import("./security-DrqBVw07.js"),__vite__mapDeps([0,1]),import.meta.url)),ga=h.lazy(()=>L(()=>import("./branding-ZWV6HBf3.js"),__vite__mapDeps([0,1]),import.meta.url)),ba=h.lazy(()=>L(()=>import("./advanced-B3-RuDYH.js"),__vite__mapDeps([0,1]),import.meta.url)),xa=h.lazy(()=>L(()=>import("./traffic-QKQkjau1.js").then(e=>e.t),__vite__mapDeps([0,1]),import.meta.url)),ya=h.lazy(()=>L(()=>import("./runtime-DK0VmoOa.js"),__vite__mapDeps([0,1]),import.meta.url)),va=h.lazy(()=>L(()=>import("./index-DoMhm8T2.js"),__vite__mapDeps([0,1]),import.meta.url)),wa=h.lazy(()=>L(()=>import("./list-Bzvh-74X.js"),__vite__mapDeps([0,1]),import.meta.url)),Sa=h.lazy(()=>L(()=>import("./index-BiRWeiPY.js"),__vite__mapDeps([0,1]),import.meta.url)),ja=h.lazy(()=>L(()=>import("./config-Ceq_JEL5.js").then(e=>e.c),__vite__mapDeps([0,1]),import.meta.url)),Ca=h.lazy(()=>L(()=>import("./observability-Zow0Sv-X.js"),[],import.meta.url)),ka=h.lazy(()=>L(()=>import("./playground-CAOOFQT1.js"),[],import.meta.url)),Ia=h.lazy(()=>L(()=>import("./index-40i6YjCX.js").then(e=>e.i),__vite__mapDeps([0,1]),import.meta.url)),Ea=h.lazy(()=>L(()=>import("./component-C45V1KlM.js"),__vite__mapDeps([0,1,2,3]),import.meta.url)),_a=h.lazy(()=>L(()=>import("./index-Bpiwm7Vd.js"),__vite__mapDeps([0,1]),import.meta.url)),La=W(R.WELLKNOWN_SERVICE_PATH_PREFIX,"user","notifications"),Ta=e=>{const{enqueueSnackbar:t}=on(),n=h.useCallback(r=>xn(La,{id:r.id,severity:r.severity||"all",componentDid:r.source==="system"?"system":r.componentDid||"all"}),[]);Dr(`${e}/${R.EVENTS.NOTIFICATION_BLOCKLET_CREATE}`,r=>{const o=n(r),{severity:s,description:a}=r||{},c=["error","warning"].includes(s)||r.sticky;r.source==="system"&&t(a,{variant:s,autoHideDuration:c?null:5e3,content:l=>i.jsx(ls,{viewAllUrl:o,keyId:l,notification:r,content:i.jsx(Vr,{notification:r,minimal:!0,rows:0})})})},[],"user")};function po({blocklet:e,isAdmin:t}){return t?i.jsx(da,{blocklet:e}):i.jsx(Pr,{status:403})}po.propTypes={blocklet:S.object.isRequired,isAdmin:S.bool.isRequired};const Da=e=>{const{t}=B(),{blocklet:n,actions:{refreshBlocklet:r},client:o,did:s}=me(),a=ne(()=>Or(n,"settings.org.enabled",!1),[n]),c=n?.meta?.did,l=!n||Ar(n.status)?[]:P.getAppMissingConfigs(n),u={overview:[{label:t("common.overview"),value:"overview"},{label:i.jsx(Jo,{"data-cy":"blocklet-list",color:"error",variant:"dot",invisible:!l.length,children:t("common.components")}),labelText:t("common.components"),value:"components"}],"did-connect":[{label:t("common.members"),value:"members"},a?{label:t("common.orgs"),value:"orgs"}:null,{label:t("team.member.passports"),value:"passports"},{label:t("common.setting"),value:"settings"},{label:t("common.security"),value:"security"},{label:t("oauth.client.tab"),value:"oauth"}].filter(Boolean),aigne:[{label:t("setup.aigne.config"),value:"aigne-config"}],website:[{label:t("common.domains"),value:"domains"},{label:t("common.branding"),value:"branding"},{label:t("common.theming"),value:"theming"},{label:t("common.navigation"),value:"navigation"}],operations:[{label:t("common.notificationRecords"),value:"notifications",show:e},{label:t("common.analytics"),value:"analytics"},{label:t("common.auditLogs"),value:"audit-logs"},{label:t("common.advancedConfig"),value:"advanced"}],integrations:[{label:"Webhooks",value:"webhooks",show:e},{label:t("common.accessKeys"),value:"access-keys"},{label:t("common.mcpServers"),value:"mcp-servers"}],developers:[{label:t("common.logs"),value:"logs",show:n?.children?.length&&n.structVersion===R.APP_STRUCT_VERSION},{label:t("common.performance"),value:"performance"},{label:t("common.docs"),value:"docs"}]},d={overview:ia,components:Ea,members:i.jsx(oa,{type:"blocklet",createPassportSvg:Ot}),passports:i.jsx(ca,{createPassportSvg:Ot}),orgs:i.jsx(Ia,{editable:!1,mode:"dashboard",layout:"table"}),settings:i.jsx(ma,{orientation:"vertical"}),security:i.jsx(ha,{}),"did-spaces":i.jsx(pa,{navOrientation:"horizontal"}),domains:aa,branding:i.jsx(ga,{blocklet:n,onUpdate:r}),theming:i.jsx(la,{}),navigation:fa,sitemap:i.jsx(Io,{children:t("common.comingSoon")}),notifications:i.jsx(po,{blocklet:n,isAdmin:e}),"audit-logs":i.jsx(ua,{scope:c,categories:["blocklet","team","security","certificates","gateway"]}),analytics:i.jsx(xa,{client:o,did:s}),advanced:i.jsx(ba,{blocklet:n,onUpdate:r}),webhooks:i.jsx(ra,{}),"access-keys":i.jsx(va,{}),"mcp-servers":i.jsx(Sa,{}),logs:na,performance:i.jsx(ya,{client:o,did:s}),docs:_a,publish:i.jsx(sa,{}),oauth:i.jsx(wa,{}),"aigne-config":i.jsx(I,{sx:{maxWidth:1536},children:i.jsx(ja,{})}),"aigne-observability":i.jsx(Ca,{}),"aigne-playground":i.jsx(ka,{})};return{tabGroups:u,renders:d}};function Aa(){const e=pn(),{tab:t="overview",subtab:n}=tr(),{locale:r}=B(),{blocklet:o,refreshFlag:s}=me(),{session:a}=yn(),c=ne(()=>a?.user?.did,[a]),l=Gr(),u=ne(()=>a.user?.role&&bn.includes(a.user.role),[a]);Ta(c);const{tabGroups:d,renders:p}=Da(u),f=g=>{e(`${R.WELLKNOWN_SERVICE_PATH_PREFIX}/admin/${t}/${g}`)},x=(d[t]||[]).filter(g=>g.show===void 0||g.show),y=(x||[]).find(g=>g.value===n)?.value||x?.[0]?.value||t,b=p[y]||p.overview,j=["overview"].includes(t),v=o?i.jsxs(jn,{type:"components",children:[x.length>0&&i.jsxs(I,{sx:{mb:2,display:"flex",alignItems:"center",gap:2},children:[i.jsx(ko,{tabs:x,current:y,onChange:f,scrollButtons:"auto"}),j&&!l&&i.jsx(I,{sx:{flex:1,display:"flex",justifyContent:"flex-end"},children:i.jsx(I,{component:"div",className:"page-header",children:o?i.jsx(Ut,{className:"page-actions",hasPermission:!0,blocklet:o,onStart:()=>{},onComplete:({error:g}={})=>{g&&F.error(g.message)},variant:"group"}):null})})]}),i.jsx(I,{className:"page-content",children:i.jsx(h.Suspense,{fallback:i.jsx(Ae,{relative:"parent",children:i.jsx(V,{})}),children:h.isValidElement(b)?b:i.jsx(b,{blocklet:o})})})]}):i.jsx(Ae,{relative:"parent",children:i.jsx(V,{})}),C=ne(()=>{const g=window.blocklet?.navigation?.find(M=>M.id==="/team"&&M.section==="dashboard"),k=o?.meta?.title||"";let _="";if(g){const M=W(R.WELLKNOWN_BLOCKLET_ADMIN_PATH,t,t==="publish"?n:"");_=g.items.find(We=>We.link===M)?.title?.[r]||""}const m=x.find(M=>M.value===n),O=[m?.labelText||m?.label||x?.[0]?.labelText||x?.[0]?.label||"",_].filter(Boolean).join(" - ");return k?O?`${O} | ${k}`:k:O||""},[t,n,o,r]);return i.jsx(Tr,{children:i.jsx(Fr,{children:i.jsx(fo,{title:C,children:i.jsxs(Ra,{children:[l&&j&&i.jsx(I,{component:"div",className:"page-header",sx:{mb:2},children:o?i.jsx(Ut,{className:"page-actions",hasPermission:!0,blocklet:o,onStart:()=>{},onComplete:({error:g}={})=>{g&&F.error(g.message)},variant:"group"}):null}),i.jsx(ts,{}),i.jsx(ta,{}),v]})},`${s}`)})})}function Pa(){const{blocklet:e}=me(),t=e?.meta?.did;return h.useEffect(()=>{const n=Lr();return t&&n.connect(),()=>{t&&n.isConnected()&&n.disconnect()}},[t]),i.jsx(Aa,{})}const Ra=Ue.main`
65
65
  .page-header {
66
66
  display: flex;
67
67
  justify-content: space-between;
@@ -1 +1 @@
1
- import{j as e,ak as o,aX as h,T as j,z as g,W as i}from"./vendor-mui-core-CnXrAOs3.js";import{V as _}from"./vendor-ux-RIH1nUSh.js";import{C as b}from"./click-to-copy-8VrSVycN.js";import{C as k}from"./confirm-BCjJ3Xga.js";function R({title:c,description:l,confirmPlaceholder:m,cancel:d="",confirm:u="Confirm",params:p={},onCancel:f=()=>{},onConfirm:C,keyName:t}){const{t:a}=_(),n={title:()=>e.jsx(o,{children:c}),description:(s,y)=>{const x=r=>{y({...r,__disableConfirm:r.__disableConfirm})};return e.jsxs(o,{children:[e.jsx(h,{severity:"warning",style:{width:"100%"},children:a("common.notice")}),e.jsx(o,{sx:{my:3,b:{wordBreak:"break-word"}},dangerouslySetInnerHTML:{__html:l}}),e.jsxs(o,{style:{marginBottom:24},children:[a("common.click"),":",e.jsx(b,{"data-cy":"click-copy",children:t})]}),e.jsx(j,{component:"div",children:e.jsx(g,{label:m,autoComplete:"off","data-cy":"delete-confirm-input",variant:"outlined",fullWidth:!0,autoFocus:!0,value:s.inputVal,onChange:r=>{x({...s,inputVal:r.target.value,__disableConfirm:t!==r.target.value})}})})]})},confirm:u,cancel:d,onConfirm:C,onCancel:f,params:{inputVal:"",__disableConfirm:!0,...p}};return e.jsx(k,{title:n.title,description:n.description,confirm:n.confirm,cancel:n.cancel,params:n.params,onConfirm:n.onConfirm,onCancel:n.onCancel})}R.propTypes={title:i.any.isRequired,keyName:i.any.isRequired,description:i.any.isRequired,confirmPlaceholder:i.any.isRequired,cancel:i.string,confirm:i.string,params:i.object,onCancel:i.func,onConfirm:i.func.isRequired};export{R as D};
1
+ import{j as e,ak as o,aX as h,T as j,z as g,W as i}from"./vendor-mui-core-CnXrAOs3.js";import{V as _}from"./vendor-ux-IiQnod3w.js";import{C as b}from"./click-to-copy-BOJgIYli.js";import{C as k}from"./confirm-CR8be0u2.js";function R({title:c,description:l,confirmPlaceholder:m,cancel:d="",confirm:u="Confirm",params:p={},onCancel:f=()=>{},onConfirm:C,keyName:t}){const{t:a}=_(),n={title:()=>e.jsx(o,{children:c}),description:(s,y)=>{const x=r=>{y({...r,__disableConfirm:r.__disableConfirm})};return e.jsxs(o,{children:[e.jsx(h,{severity:"warning",style:{width:"100%"},children:a("common.notice")}),e.jsx(o,{sx:{my:3,b:{wordBreak:"break-word"}},dangerouslySetInnerHTML:{__html:l}}),e.jsxs(o,{style:{marginBottom:24},children:[a("common.click"),":",e.jsx(b,{"data-cy":"click-copy",children:t})]}),e.jsx(j,{component:"div",children:e.jsx(g,{label:m,autoComplete:"off","data-cy":"delete-confirm-input",variant:"outlined",fullWidth:!0,autoFocus:!0,value:s.inputVal,onChange:r=>{x({...s,inputVal:r.target.value,__disableConfirm:t!==r.target.value})}})})]})},confirm:u,cancel:d,onConfirm:C,onCancel:f,params:{inputVal:"",__disableConfirm:!0,...p}};return e.jsx(k,{title:n.title,description:n.description,confirm:n.confirm,cancel:n.cancel,params:n.params,onConfirm:n.onConfirm,onCancel:n.onCancel})}R.propTypes={title:i.any.isRequired,keyName:i.any.isRequired,description:i.any.isRequired,confirmPlaceholder:i.any.isRequired,cancel:i.string,confirm:i.string,params:i.object,onCancel:i.func,onConfirm:i.func.isRequired};export{R as D};
@@ -1 +1 @@
1
- import{j as o,a$ as p,W as r}from"./vendor-mui-core-CnXrAOs3.js";import{L as f}from"./vendor-react-Dvs43sk9.js";import{e as l}from"./vendor-ux-RIH1nUSh.js";function m({did:s,href:t="",external:i=!1,avatarProps:n={},to:a="",...d}){const e=o.jsx(l,{did:s,...d,avatarProps:n,to:a});return t?i?o.jsx(p,{target:"_blank",href:t,underline:"hover",children:e}):o.jsx(f,{to:t,children:e}):e}m.propTypes={did:r.string.isRequired,to:r.string,href:r.string,avatarProps:r.object,external:r.bool};export{m as W};
1
+ import{j as o,a$ as p,W as r}from"./vendor-mui-core-CnXrAOs3.js";import{L as f}from"./vendor-react-Dvs43sk9.js";import{e as l}from"./vendor-ux-IiQnod3w.js";function m({did:s,href:t="",external:i=!1,avatarProps:n={},to:a="",...d}){const e=o.jsx(l,{did:s,...d,avatarProps:n,to:a});return t?i?o.jsx(p,{target:"_blank",href:t,underline:"hover",children:e}):o.jsx(f,{to:t,children:e}):e}m.propTypes={did:r.string.isRequired,to:r.string,href:r.string,avatarProps:r.object,external:r.bool};export{m as W};
@@ -1,4 +1,4 @@
1
- import{j as o,ak as i,at as g,W as u}from"./vendor-mui-core-CnXrAOs3.js";import{l as v,e as C,ad as b,d as B}from"./index-CkTEzTCn.js";import{D as E,a as I,b as w}from"./domain-action-card-CjprVCsh.js";import{p as T}from"./vendor-ux-RIH1nUSh.js";import{a as W}from"./page-header-DCvzRay5.js";import{r,u as A}from"./vendor-react-Dvs43sk9.js";import{u as L}from"./useSetState-DFuQZPPV.js";import{S as x}from"./button-Cg6OrnF6.js";import{S as $}from"./layout-DsLcTLhU.js";import{S as z}from"./step-actions-DPFoKvBN.js";import"./vendor-arcblock-A4RQuZfN.js";import"./vendor-utils-ByKYcWuf.js";import"./vendor-hooks-OpgB8gyY.js";import"./permission-COoKrWxk.js";import"./session-GdZETrt0.js";import"./useAsyncRetry-C8ETjgdm.js";import"./useAsync-BvASW8Y8.js";import"./confirm-BCjJ3Xga.js";import"./index-DBs9Ljax.js";import"./actions-DqoNrBDK.js";import"./delete-confirm-D2vWlDhQ.js";import"./click-to-copy-8VrSVycN.js";import"./useAsync-DouUkRB3.js";import"./index-Ch4CmFJG.js";import"./util-D4K1svNc.js";import"./engine-BkRDnUT9.js";import"./lottie-web-4koyQiv_.js";import"./content-layout-oyz1EqNZ.js";import"./use-mobile-DCNBsOlH.js";function h({onNext:a=()=>{},onPrevious:f=()=>{}}){const{t:n}=r.useContext(T),[D,d]=r.useState(!1),{blocklet:e}=v(),[p,S]=r.useState(""),j=((e?.site||{}).domainAliases||[]).map(t=>C.replaceSlotToIp(t.value,p)),[s,m]=L({domain:"",invalidDNSDomain:null,type:"",addDomainState:{text:""}}),c=e.environments?.find(t=>t.key==="BLOCKLET_APP_PK")?.value,y=j.find(t=>b.isDidDomain(t)),[l,P]=A();return r.useEffect(()=>{B.get(`/dns-resolve?hostname=${window.location.hostname}`).then(({data:t})=>{S(t.address||"")}).catch(t=>{console.error(t.message)})},[]),o.jsxs(H,{children:[o.jsx(i,{className:"header",children:o.jsx(W,{title:n("setup.domain.title"),subTitle:n("setup.domain.subTitle"),onClickBack:f})}),o.jsxs(i,{className:"form form-container",sx:{display:"flex",flexDirection:"column",gap:3,overflowY:"auto"},children:[o.jsxs(i,{children:[o.jsx(i,{sx:{color:"text.primary",fontWeight:"fontWeightBold",fontSize:"1.125rem"},children:o.jsx(i,{sx:{display:"inline"},children:`${n("setup.domain.buyOrConnect")} (${n("common.optional")})`})}),o.jsx(i,{sx:{mt:1},children:o.jsx(I,{blocklet:e,bugDidDomainProps:{appPk:c,appId:e.appPid,siteId:e.site.id,teamDid:e.meta.did,inBlockletSetup:!0},connectDomainProps:{autoFocus:!1,appPk:c,appId:e.appPid,siteId:e.site.id,teamDid:e.meta.did,cnameDomain:y,currentIp:p,inBlockletSetup:!0,shouldCheckDomain:!0,onInputDomain:t=>{m({domain:t.domain,type:t.type}),d(t.error)},onStateChange:t=>m({addDomainState:t}),onSuccess:t=>{const k={domain:t.domain,type:t.type,nftDid:t.nftDid,chainHost:t.chainHost};l.set("redirect",t.domain),P(l,{replace:!0}),m(k),a()},onError:d}})})]}),o.jsx(i,{children:o.jsx(w,{inSetup:!0,showAllDomains:!0,systemTips:o.jsx(i,{sx:{color:"text.primary",fontWeight:"fontWeightBold",fontSize:"1.125rem",mb:1},children:o.jsx(i,{sx:{display:"inline"},children:n("setup.domain.skipDescription")})})})})]}),o.jsx(z,{mt:8,disabled:!!s.addDomainState.text,blocklet:e,onStartNow:()=>a("complete"),children:s.domain?o.jsx(x,{variant:"contained",loading:!!s.addDomainState.text,disabled:D||!!s.addDomainState.text||!s.domain,onClick:()=>a(),children:s.addDomainState.text||n("setup.continue")}):o.jsx(x,{variant:"contained",disabled:!!s.addDomainState.text,onClick:()=>a(),children:n("setup.continue")})})]})}function ht(a){return o.jsx(E,{children:o.jsx(h,{...a})})}h.propTypes={onNext:u.func,onPrevious:u.func};const H=g($)`
1
+ import{j as o,ak as i,at as g,W as u}from"./vendor-mui-core-CnXrAOs3.js";import{l as v,e as C,ad as b,d as B}from"./index-sNHCLgAE.js";import{D as E,a as I,b as w}from"./domain-action-card-ClQw061p.js";import{p as T}from"./vendor-ux-IiQnod3w.js";import{a as W}from"./page-header-DCvzRay5.js";import{r,u as A}from"./vendor-react-Dvs43sk9.js";import{u as L}from"./useSetState-DFuQZPPV.js";import{S as x}from"./button-vwR-NYG5.js";import{S as $}from"./layout-Ccrs-yyw.js";import{S as z}from"./step-actions-thgNsMmu.js";import"./vendor-arcblock-CuFtPveO.js";import"./vendor-utils-cJEl_UEd.js";import"./vendor-hooks-CjESGRlR.js";import"./permission-DhYNRf8T.js";import"./session-BAD0lxQk.js";import"./useAsyncRetry-DwwEjrjs.js";import"./useAsync-cZ_FPf9k.js";import"./confirm-CR8be0u2.js";import"./index-DBs9Ljax.js";import"./actions-DqoNrBDK.js";import"./delete-confirm-DhJd_sYk.js";import"./click-to-copy-BOJgIYli.js";import"./useAsync-BcVLpt2E.js";import"./index-l32Mt1U_.js";import"./util-BsAmOTBh.js";import"./engine-DPn0LHHl.js";import"./lottie-web-4koyQiv_.js";import"./content-layout-oyz1EqNZ.js";import"./use-mobile-DCNBsOlH.js";function h({onNext:a=()=>{},onPrevious:f=()=>{}}){const{t:n}=r.useContext(T),[D,d]=r.useState(!1),{blocklet:e}=v(),[p,S]=r.useState(""),j=((e?.site||{}).domainAliases||[]).map(t=>C.replaceSlotToIp(t.value,p)),[s,m]=L({domain:"",invalidDNSDomain:null,type:"",addDomainState:{text:""}}),c=e.environments?.find(t=>t.key==="BLOCKLET_APP_PK")?.value,y=j.find(t=>b.isDidDomain(t)),[l,P]=A();return r.useEffect(()=>{B.get(`/dns-resolve?hostname=${window.location.hostname}`).then(({data:t})=>{S(t.address||"")}).catch(t=>{console.error(t.message)})},[]),o.jsxs(H,{children:[o.jsx(i,{className:"header",children:o.jsx(W,{title:n("setup.domain.title"),subTitle:n("setup.domain.subTitle"),onClickBack:f})}),o.jsxs(i,{className:"form form-container",sx:{display:"flex",flexDirection:"column",gap:3,overflowY:"auto"},children:[o.jsxs(i,{children:[o.jsx(i,{sx:{color:"text.primary",fontWeight:"fontWeightBold",fontSize:"1.125rem"},children:o.jsx(i,{sx:{display:"inline"},children:`${n("setup.domain.buyOrConnect")} (${n("common.optional")})`})}),o.jsx(i,{sx:{mt:1},children:o.jsx(I,{blocklet:e,bugDidDomainProps:{appPk:c,appId:e.appPid,siteId:e.site.id,teamDid:e.meta.did,inBlockletSetup:!0},connectDomainProps:{autoFocus:!1,appPk:c,appId:e.appPid,siteId:e.site.id,teamDid:e.meta.did,cnameDomain:y,currentIp:p,inBlockletSetup:!0,shouldCheckDomain:!0,onInputDomain:t=>{m({domain:t.domain,type:t.type}),d(t.error)},onStateChange:t=>m({addDomainState:t}),onSuccess:t=>{const k={domain:t.domain,type:t.type,nftDid:t.nftDid,chainHost:t.chainHost};l.set("redirect",t.domain),P(l,{replace:!0}),m(k),a()},onError:d}})})]}),o.jsx(i,{children:o.jsx(w,{inSetup:!0,showAllDomains:!0,systemTips:o.jsx(i,{sx:{color:"text.primary",fontWeight:"fontWeightBold",fontSize:"1.125rem",mb:1},children:o.jsx(i,{sx:{display:"inline"},children:n("setup.domain.skipDescription")})})})})]}),o.jsx(z,{mt:8,disabled:!!s.addDomainState.text,blocklet:e,onStartNow:()=>a("complete"),children:s.domain?o.jsx(x,{variant:"contained",loading:!!s.addDomainState.text,disabled:D||!!s.addDomainState.text||!s.domain,onClick:()=>a(),children:s.addDomainState.text||n("setup.continue")}):o.jsx(x,{variant:"contained",disabled:!!s.addDomainState.text,onClick:()=>a(),children:n("setup.continue")})})]})}function ht(a){return o.jsx(E,{children:o.jsx(h,{...a})})}h.propTypes={onNext:u.func,onPrevious:u.func};const H=g($)`
2
2
  height: 100%;
3
3
  overflow-y: hidden;
4
4
 
@@ -1,4 +1,4 @@
1
- import{ap as bn,T as vn,V as A,b as Cn,H as E,n as te,i as wn,S as ze}from"./vendor-ux-RIH1nUSh.js";import{j as e,cX as Ne,cY as Sn,ak as h,a6 as z,b0 as Rn,T as R,aX as ye,D as H,J as ie,am as L,aN as $e,W as t,bb as _e,M as Oe,aO as An,aP as kn,cZ as Tn,b7 as In,b9 as Pn,c_ as qn,c$ as En,b1 as W,P as We,ci as Ln,bh as Fn,at as Mn,a$ as Bn,cW as Un,d0 as zn,d1 as Nn,d2 as $n,d3 as Te,d4 as _,d5 as _n,z as On,n as Wn,bf as Hn,d6 as Vn,cb as Gn}from"./vendor-mui-core-CnXrAOs3.js";import{C as ee,J as Yn,a as Xn,e as Zn,H as je,a5 as Jn,a6 as Kn,n as X}from"./vendor-utils-ByKYcWuf.js";import{r as j,e as He,g as Qn}from"./vendor-react-Dvs43sk9.js";import{u as se}from"./useSetState-DFuQZPPV.js";import{l as et,k as nt,b as Z,m as tt,w as it}from"./vendor-hooks-OpgB8gyY.js";import{bj as Ve,V as Ge,bk as st,bl as Ye,_ as F,ac as oe,Y as Ie,a2 as ot,aO as Pe,bm as rt,B as at,ae as lt,bn as Xe,ad as fe,bo as Ze,bp as ct,bq as dt,br as mt,aY as ut,e as xe,bs as pt,bt as ft}from"./index-CkTEzTCn.js";import{w as Je}from"./permission-COoKrWxk.js";import{u as xt,D as qe}from"./useAsyncRetry-C8ETjgdm.js";import{C as re}from"./confirm-BCjJ3Xga.js";import{A as ht}from"./actions-DqoNrBDK.js";import{D as gt}from"./delete-confirm-D2vWlDhQ.js";import{o as Ee}from"./vendor-arcblock-A4RQuZfN.js";import{u as Dt}from"./useAsync-DouUkRB3.js";import{f as N}from"./index-DBs9Ljax.js";import{v as yt}from"./index-Ch4CmFJG.js";import{g as jt,p as Le}from"./util-D4K1svNc.js";import{C as bt}from"./click-to-copy-8VrSVycN.js";const vt=Ve({});vt.interceptors.request.use(n=>{const i=window.blocklet?window.blocklet.prefix:"/";return n.baseURL=i||"",n.url=ee("/api",String(n.url)),n.timeout=2e5,n.params=n.params||{},new URLSearchParams(n.url.split("?")[1]).has("locale")||(n.params.locale=bn()),n},n=>Promise.reject(n));const Ke=(...n)=>Ve(...n),Ct=(n,i)=>i?n?[n,...Array.isArray(i)?i:[i]]:i:n,wt=(n,{width:i=600,height:o=700,name:a="did-domain:popup"}={})=>{const s=window.screenX+(window.innerWidth-i)/2,r=window.screenY+(window.innerHeight-o)/2,u=[`left=${s}`,`top=${r}`,`width=${i}`,`height=${o}`,"resizable=no","scrollbars=yes","status=yes","popup=yes"],l=window.open("",a,u.join(","));if(l===null)throw new Error("Failed to open popup");return l.location.href=Yn(n,{opener:window.location.origin}),l},St="z2qaGosS3rZ7m5ttP3Nd4V4qczR9TryTcRV4p",Qe=async n=>{if(!n||!n?.trim())return null;const i=Ke(),o=new URL(n);o.pathname="__blocklet__.js",o.searchParams.set("type","json");const{data:a}=await i.get(o.toString()),s=a?.componentMountPoints?.find(m=>m.did===St),r=new URL(n);r.pathname=s?.mountPoint;const u=r.toString(),l=ee(u,"/api");return{base:u,api:l}},Rt=Ge({embed:{iconTip:"Click to view subscription details"},buy:{button:{title:"Buy DID Domain"},status:{inProgress:"Please wait while we are processing your request, the domain will be automatically resolved to the current app after the purchase...",success:"Purchase completed!"},error:{failedToCreateSession:"Failed to create session"}}}),At=Ge({embed:{iconTip:"点击查看订阅详情"},buy:{button:{title:"购买 DID 域名"},status:{inProgress:"请稍等,我们正在处理您的请求,购买域名后会自动解析到当前的应用...",success:"购买完成!"},error:{failedToCreateSession:"创建会话失败"}}}),kt={zh:At,en:Rt},Tt=async({didDomainURL:n,delegatee:i,delegateePk:o})=>{const a=await Qe(n);if(!a)return null;const s=Ke({baseURL:a.api}),{data:r}=await s.post("/payment/session",{delegatee:i,delegateePk:o});return{sessionId:r.sessionId,baseURL:a.base}};function It({delegatee:n,delegateePk:i,didDomainURL:o,locale:a,title:s="",onSuccess:r=()=>{},...u}){const{t:l}=A(),[m,p]=et({currentState:1}),f=j.useRef(null),c=nt(async()=>{const d=await Tt({didDomainURL:o,delegatee:n,delegateePk:i});return d},{debounceWait:500,debounceLeading:!0,debounceTrailing:!1,debounceMaxWait:3e3,refreshDeps:[],onError(d){console.error(d)}}),g=Z(d=>{d.data.type==="didDomain.success"&&(r?.({nftDid:d.data?.nftDid,domain:d.data?.domain,chainHost:d.data?.chainHost}),f.current?.close(),f.current=null,p({currentState:4}),setTimeout(()=>{p({currentState:8})},2e3))});tt(()=>{try{window.removeEventListener("message",g),f.current?.close(),f.current=null}catch(d){console.warn("Failed to close popup",d)}});const y=Z(()=>{p({currentState:1})}),x=Z(()=>{if(p({currentState:2}),!c.data){console.error("Failed to create session");return}b({sessionId:c.data.sessionId,baseURL:c.data.baseURL})}),b=Z(({sessionId:d,baseURL:w})=>{window.addEventListener("message",g);const C=new URL(w);C.searchParams.set("sessionId",d),C.searchParams.set("locale",a),C.searchParams.set("embed","1"),f.current=wt(C.toString());const q=setInterval(()=>{f.current?.closed&&(clearInterval(q),y())},1e3);return()=>clearInterval(q)});return e.jsxs(e.Fragment,{children:[e.jsx(Ne,{loading:c.loading,onClick:x,variant:"contained",startIcon:e.jsx(Sn,{}),...u,children:s||l("buy.button.title")}),e.jsxs(Cn,{fullWidth:!0,maxWidth:"xs",open:m.currentState>1&&m.currentState<8,onClose:y,children:[!c.error&&e.jsxs(h,{sx:{display:"flex",alignItems:"center",flexDirection:"column",gap:2},children:[m.currentState===2&&e.jsx(z,{size:50}),m.currentState===4&&e.jsx(Rn,{sx:{color:"primary.main",fontSize:"5rem"}}),m.currentState===2&&e.jsx(R,{children:l("buy.status.inProgress")}),m.currentState===4&&e.jsx(R,{children:l("buy.status.success")})]}),c.error&&e.jsx(ye,{severity:"error",children:l("buy.error.failedToCreateSession")})]})]})}function Pt(n){return e.jsx(vn,{locale:n.locale,translations:kt,children:e.jsx(It,{...n})})}function qt({nftDid:n,didDomainURL:i,locale:o,sx:a={}}){const{t:s}=A(),[r,u]=se({safeIframeRef:null,popoverAnchorEl:null}),l=j.useRef(null),m=H(),p=ie(m.breakpoints.down("md")),f=x=>{u({popoverAnchorEl:x.currentTarget})},c=()=>{u({popoverAnchorEl:null})},g=it(async()=>{const x=await Qe(i);return x?x.base:null});if(!g.value)return null;if(g.loading)return e.jsx(z,{});const y=ee(g.value,`/embed/domain?nft-did=${n}&locale=${o}`);return e.jsxs(e.Fragment,{children:[e.jsx(L,{title:s("embed.iconTip"),children:e.jsx(h,{component:"img",src:ee(i,"/.well-known/service/blocklet/logo"),alt:"logo",onClick:f,sx:[{width:16,height:16},Ct({cursor:"pointer"},a)]})}),e.jsx($e,{id:"popover-info",open:!!r.popoverAnchorEl,anchorEl:r.popoverAnchorEl,onClose:c,anchorOrigin:{vertical:"bottom",horizontal:"right"},children:e.jsx("iframe",{ref:l,title:s("common.subscription"),width:p?"320px":"400px",height:"350px",style:{border:0,display:"block"},src:y})})]})}const Et=n=>["waiting","creating","renewaling"].includes(n);function en({siteId:n,domain:i,onAdd:o=()=>{},children:a=null,did:s,issuing:r=!1,setIssuing:u=()=>{}}){const{t:l}=A(),[m,p]=j.useState(!1),{inService:f}=F(),[c,g]=j.useState(null),{api:y,ws:{useSubscription:x}}=F(),{mode:b,actions:{refreshDomainStatus:d}}=oe(),w=xt(async()=>{const{cert:T}=await y.findCertificateByDomain({input:{domain:i,did:s}});return T}),C=(T,S)=>{T.domain===i&&(u(!1),p(!1),f&&b!=="setup"&&(S==="success"?E.success(l("setup.domain.genCertSuccess",{domain:T.domain})):S==="error"&&E.error(l("setup.domain.genCertFailed",{domain:T.domain,message:T.message}))))};if(j.useEffect(()=>{w.loading||u(Et(w.value?.status))},[w.loading,w.value?.status,u]),x(Ie.BlockletEvents.certError,T=>C(T,"error")),x(Ie.BlockletEvents.certIssued,T=>{w.retry(),d(T.domain),C(T,"success")}),w.loading||w.value?.status==="normal")return"";const q=()=>{p(!1),g(null)},B=async()=>{p(!0);try{await y.issueLetsEncryptCert({input:{siteId:n,domain:i,did:s,inBlockletSetup:b==="setup"}}),o(),u(!0)}catch(T){console.error(T),u(!1)}finally{p(!1),g(null)}},M={title:l("router.cert.genLetsEncryptCert.title"),description:e.jsxs("div",{children:[e.jsx(ye,{severity:"success",children:l("router.cert.genLetsEncryptCert.dnsTip")}),l("router.cert.genLetsEncryptCert.description")]}),confirm:l("common.confirm"),onConfirm:B,onCancel:q},U=T=>{T.stopPropagation(),g(M)};return e.jsxs(e.Fragment,{children:[r?e.jsx(L,{title:l("router.cert.issuing"),children:e.jsx(z,{size:13,style:{fontSize:"13px"}})}):a({loading:m,open:U}),c&&e.jsx(re,{color:"primary",title:c.title,description:c.description,confirm:c.confirm,params:c.params,onConfirm:c.onConfirm,onCancel:c.onCancel})]})}en.propTypes={domain:t.string.isRequired,did:t.string.isRequired,siteId:t.string.isRequired,onAdd:t.func,children:t.any,issuing:t.bool,setIssuing:t.func};function nn({domain:n,domainStatus:i,did:o,onAdd:a=()=>{},children:s=null,issuing:r=!1,setIssuing:u=()=>{},...l}){return st(n)||!Ye(n)||Xn(i)||i?.isHttps?"":e.jsx(en,{...l,domain:n,did:o,onAdd:a,issuing:r,setIssuing:u,children:s})}nn.propTypes={domain:t.string.isRequired,domainStatus:t.shape({isHttps:t.bool}).isRequired,did:t.string.isRequired,onAdd:t.func,children:t.any,issuing:t.bool,setIssuing:t.func};function tn({id:n,domain:i,children:o=null,teamDid:a="",onDelete:s=null}){const{t:r}=A(),[u,l]=j.useState(!1),[m,p]=j.useState(null),{api:f}=F(),c=()=>{l(!1),p(null)},g=async()=>{l(!0);try{await f.deleteDomainAlias({input:{id:n,domainAlias:i,teamDid:a}}),s?.(),await ot(2e3)}catch(b){E.error(b.message)}finally{p(null),l(!1)}},y={keyName:i,title:r("router.domainAlias.delete.title"),description:r("router.domainAlias.delete.description",{domain:i}),confirmPlaceholder:r("router.domainAlias.delete.confirmPlaceholder",{domain:i}),confirm:r("common.delete"),onConfirm:g,onCancel:c},x=b=>{b.stopPropagation(),p(y)};return e.jsxs(e.Fragment,{children:[typeof o=="function"?o({loading:u,open:x}):e.jsxs(te,{edge:"end",onClick:x,size:"small",className:"rule-action",color:"error","data-cy":"action-delete-domain-alias",children:[u?e.jsx(z,{size:16}):e.jsx(_e,{style:{fontSize:16}}),r("common.delete")]}),m&&e.jsx(gt,{keyName:m.keyName,title:m.title,description:m.description,confirmPlaceholder:m.confirmPlaceholder,confirm:m.confirm,params:m.params,onConfirm:m.onConfirm,onCancel:m.onCancel})]})}tn.propTypes={id:t.string.isRequired,domain:t.string.isRequired,children:t.any,teamDid:t.string,onDelete:t.func};function sn({site:n,domain:i,blocklet:o,onDelete:a=()=>{}}){const{t:s}=A(),r=i.value===window.location.hostname;return e.jsx(ht,{"data-cy":"domain-actions",size:"large",actions:[({close:u})=>e.jsx(tn,{id:n.id,domain:i.value,teamDid:o?.meta?.did,onDelete:a,children:({open:l})=>e.jsx(L,{title:r?s("blocklet.router.currentDomainTip"):"",children:e.jsx("span",{children:e.jsxs(Oe,{disabled:i.isProtected||r,dense:!0,onClick:m=>{u(),l(m)},"data-cy":"action-toggle-block",children:[e.jsx(An,{style:{minWidth:24,marginRight:8},children:e.jsx(_e,{})}),e.jsx(kn,{primary:s("common.delete")})]},"remove")})})})]})}sn.propTypes={site:t.object.isRequired,domain:t.object.isRequired,blocklet:t.object.isRequired,onDelete:t.func};const ae=t.shape({href:t.string,accessibility:t.shape({loading:t.bool,accessible:t.bool}),domainStatus:t.shape({isHttps:t.bool,matchedCert:t.object}),dns:t.shape({resolved:t.bool,ip:t.string})});function on({certificate:n={}}){const[i,o]=j.useState(null),a=F(),{t:s,locale:r}=A(),u=p=>{o(p.currentTarget)},l=()=>{o(null)},m=!!i;return e.jsxs(e.Fragment,{children:[e.jsx(Tn,{"aria-owns":m?"mouse-over-popover":void 0,onMouseEnter:u,onMouseLeave:l,style:{color:"#44cdc6",fontSize:"1em",cursor:"pointer"}}),e.jsx($e,{id:"mouse-over-popover",style:{pointerEvents:"none"},open:m,anchorEl:i,anchorOrigin:{vertical:"bottom",horizontal:"left"},transformOrigin:{vertical:"top",horizontal:"left"},onClose:l,disableRestoreFocus:!0,children:e.jsx(In,{children:e.jsxs(Pn,{style:{display:"flex"},children:[e.jsx("div",{children:e.jsx("img",{src:`${a.imgPrefix}/https-certificate-icon.png`,alt:"certificate icon",style:{maxHeight:"100%",maxWidth:"100%"}})}),e.jsxs(R,{component:"div",style:{marginLeft:"16px"},children:[e.jsx(R,{component:"div",style:{fontWeight:"bold"},children:n.domain}),e.jsx(R,{component:"div",children:`${s("common.issuer")}: ${Zn(n,"issuer.commonName","")}`}),e.jsx(R,{component:"div",children:`${s("router.cert.issuedOn")}: ${Pe(n.validFrom,r)}`}),e.jsx(R,{component:"div",children:`${s("router.cert.expiryOn")}: ${Pe(n.validTo,r)}`})]})]})})})]})}on.propTypes={certificate:t.object};function ne({domain:n,filters:i=["domain","http"]}){const{t:o}=A(),{value:a,domainStatus:s}=n;if(!Ye(a))return null;let r=null,u=null;const{isHttps:l,matchedCert:m}=s,{dns:{ip:p,isDnsResolved:f,isCnameMatch:c}={}}=s,g=f&&c;rt(a)||(g||p==="127.0.0.1"?r=e.jsx(L,{title:o("router.domain.verify.ok"),children:e.jsx(qe,{color:"success"})}):r=e.jsx(L,{title:o("router.domain.verify.notResolved"),children:e.jsx(qe,{color:"error"})})),g?l?u=e.jsx(on,{certificate:m}):u=e.jsx(L,{title:o("router.domain.https.bad"),children:e.jsx(qn,{style:{color:"#D0021B",fontSize:"1em",cursor:"pointer"}})}):u=e.jsx(L,{title:o("router.domain.verify.notResolved"),children:e.jsx(En,{style:{color:"#D0021B",fontSize:"1em",cursor:"pointer"}})});const y=i.map(x=>x==="domain"?r:x==="http"?u:null);return j.createElement(j.Fragment,null,...y)}ne.propTypes={domain:ae.isRequired,filters:t.array};const Lt=Je(be,"mutate_blocklets"),Ft=Je(be,"",at);function pi(n){const{inService:i}=F(),{blocklet:o,loadingRuntimeInfo:a}=oe();let s=Lt;return i&&(s=Ft),e.jsx(s,{...n,blocklet:o,inService:i,loadingRuntimeInfo:a})}const Fe="nft-domain";function be({hasPermission:n=!1,blocklet:i,loadingRuntimeInfo:o=!1,inService:a=!1,showAllDomains:s=!1,updateBlockletDomainAliases:r=()=>{},systemTips:u=null}){const{t:l}=A(),m=ie(d=>d.breakpoints.down("md")),p=j.useMemo(()=>{let d=n;return lt(i)&&(d=d&&a),d},[n,a,i]),{site:f}=i,c=j.useMemo(()=>Xe(i.site?.domainAliases),[i.site?.domainAliases]),g=j.useMemo(()=>c.filter(d=>!fe.isCustomDomain(d.value)),[c]),y=j.useMemo(()=>c.filter(d=>fe.isCustomDomain(d.value)),[c]),x=j.useMemo(()=>y.filter(d=>d.type!==Fe),[y]),b=j.useMemo(()=>y.filter(d=>d.type===Fe),[y]);return e.jsxs(e.Fragment,{children:[e.jsxs(W,{sx:{gap:3},children:[!!b.length&&e.jsx(Q,{title:l("common.didDomains"),description:l("common.didDomainsDescription"),domains:b,hasMutatePermission:p,blocklet:i,site:f,mobile:m,showAllDomains:s,updateBlockletDomainAliases:r}),!!x.length&&e.jsx(Q,{title:l("common.manualDomains"),description:l("common.manualDomainsDescription"),domains:x,hasMutatePermission:p,blocklet:i,site:f,mobile:m,showAllDomains:s,updateBlockletDomainAliases:r}),!!g.length&&e.jsxs(h,{children:[u,e.jsx(Q,{title:l("common.systemDomains"),description:l("common.systemDomainsDescription"),domains:g,hasMutatePermission:p,blocklet:i,site:f,mobile:m,updateBlockletDomainAliases:r})]})]}),!c.length&&(o?e.jsx(z,{size:16}):e.jsx(wn,{children:l("common.empty")}))]})}be.propTypes={hasPermission:t.bool,blocklet:t.object.isRequired,loadingRuntimeInfo:t.bool,inService:t.bool.isRequired,showAllDomains:t.bool,updateBlockletDomainAliases:t.func,systemTips:t.node};function J({children:n=null}){return e.jsx(h,{component:"span",sx:{verticalAlign:"bottom"},children:n})}J.propTypes={children:t.node};function he({domain:n,children:i,suffix:o=null,...a}){const{t:s,locale:r}=A(),u=H(),{href:l,accessibility:m,value:p}=n,f=j.useCallback(()=>e.jsx(ze,{content:je(p),locale:r,style:{marginLeft:"4px",color:u.palette.text.secondary,fontSize:"0.8em"}}),[p,r,u]);return!m||m.loading?e.jsxs(me,{component:"span",...a,children:[e.jsx(L,{title:void 0,placement:"top-end",children:e.jsx(h,{component:"span",children:i})}),f(),e.jsx(J,{children:o}),e.jsx(L,{title:s("blocklet.router.checkUrlAccessible"),placement:"top-end",children:e.jsx(h,{component:"span",className:"status",children:e.jsx(z,{size:13,style:{fontSize:"13px"}})})})]}):m.accessible?e.jsxs(me,{component:"span",...a,children:[e.jsx(h,{component:"a",href:l,target:"_blank",rel:"noopener noreferrer",sx:{color:n.loading?"text.disabled":void 0},children:e.jsx(L,{title:void 0,placement:"top-end",children:e.jsx(h,{component:"span",children:i})})}),f(),e.jsx(J,{children:o})]}):e.jsxs(me,{component:"span",...a,children:[e.jsx(L,{title:s("blocklet.router.urlInaccessible"),placement:"top-end",children:e.jsx(h,{component:"span",children:i})}),!n.loading&&f(),e.jsx(J,{children:o})]})}he.propTypes={domain:ae.isRequired,children:t.any.isRequired,suffix:t.node};const me=Mn(h)`
1
+ import{aC as bn,T as vn,V as A,b as Cn,H as E,n as te,i as wn,S as ze}from"./vendor-ux-IiQnod3w.js";import{j as e,cX as Ne,cY as Rn,ak as h,a6 as z,b0 as Sn,T as S,aX as ye,D as H,J as ie,am as L,aN as $e,W as t,bb as _e,M as We,aO as An,aP as kn,cZ as Tn,b7 as In,b9 as Pn,c_ as qn,c$ as En,b1 as O,P as Oe,ci as Ln,bh as Fn,at as Mn,a$ as Bn,cW as Un,d0 as zn,d1 as Nn,d2 as $n,d3 as Te,d4 as _,d5 as _n,z as Wn,n as On,bf as Hn,d6 as Vn,cb as Gn}from"./vendor-mui-core-CnXrAOs3.js";import{C as ee,J as Xn,a as Yn,e as Zn,H as je,a5 as Jn,a6 as Kn,n as Y}from"./vendor-utils-cJEl_UEd.js";import{r as j,e as He,g as Qn}from"./vendor-react-Dvs43sk9.js";import{u as se}from"./useSetState-DFuQZPPV.js";import{l as et,k as nt,b as Z,m as tt,w as it}from"./vendor-hooks-CjESGRlR.js";import{bi as Ve,V as Ge,bj as st,bk as Xe,_ as F,ac as oe,Y as Ie,a2 as ot,aR as Pe,bl as rt,B as at,ae as lt,bm as Ye,ad as fe,bn as Ze,bo as ct,bp as dt,bq as mt,aW as ut,e as xe,br as pt,bs as ft}from"./index-sNHCLgAE.js";import{w as Je}from"./permission-DhYNRf8T.js";import{u as xt,D as qe}from"./useAsyncRetry-DwwEjrjs.js";import{C as re}from"./confirm-CR8be0u2.js";import{A as ht}from"./actions-DqoNrBDK.js";import{D as gt}from"./delete-confirm-DhJd_sYk.js";import{o as Ee}from"./vendor-arcblock-CuFtPveO.js";import{u as Dt}from"./useAsync-BcVLpt2E.js";import{f as N}from"./index-DBs9Ljax.js";import{v as yt}from"./index-l32Mt1U_.js";import{g as jt,p as Le}from"./util-BsAmOTBh.js";import{C as bt}from"./click-to-copy-BOJgIYli.js";const vt=Ve({});vt.interceptors.request.use(n=>{const i=window.blocklet?window.blocklet.prefix:"/";return n.baseURL=i||"",n.url=ee("/api",String(n.url)),n.timeout=2e5,n.params=n.params||{},new URLSearchParams(n.url.split("?")[1]).has("locale")||(n.params.locale=bn()),n},n=>Promise.reject(n));const Ke=(...n)=>Ve(...n),Ct=(n,i)=>i?n?[n,...Array.isArray(i)?i:[i]]:i:n,wt=(n,{width:i=600,height:o=700,name:a="did-domain:popup"}={})=>{const s=window.screenX+(window.innerWidth-i)/2,r=window.screenY+(window.innerHeight-o)/2,u=[`left=${s}`,`top=${r}`,`width=${i}`,`height=${o}`,"resizable=no","scrollbars=yes","status=yes","popup=yes"],l=window.open("",a,u.join(","));if(l===null)throw new Error("Failed to open popup");return l.location.href=Xn(n,{opener:window.location.origin}),l},Rt="z2qaGosS3rZ7m5ttP3Nd4V4qczR9TryTcRV4p",Qe=async n=>{if(!n||!n?.trim())return null;const i=Ke(),o=new URL(n);o.pathname="__blocklet__.js",o.searchParams.set("type","json");const{data:a}=await i.get(o.toString()),s=a?.componentMountPoints?.find(m=>m.did===Rt),r=new URL(n);r.pathname=s?.mountPoint;const u=r.toString(),l=ee(u,"/api");return{base:u,api:l}},St=Ge({embed:{iconTip:"Click to view subscription details"},buy:{button:{title:"Buy DID Domain"},status:{inProgress:"Please wait while we are processing your request, the domain will be automatically resolved to the current app after the purchase...",success:"Purchase completed!"},error:{failedToCreateSession:"Failed to create session"}}}),At=Ge({embed:{iconTip:"点击查看订阅详情"},buy:{button:{title:"购买 DID 域名"},status:{inProgress:"请稍等,我们正在处理您的请求,购买域名后会自动解析到当前的应用...",success:"购买完成!"},error:{failedToCreateSession:"创建会话失败"}}}),kt={zh:At,en:St},Tt=async({didDomainURL:n,delegatee:i,delegateePk:o})=>{const a=await Qe(n);if(!a)return null;const s=Ke({baseURL:a.api}),{data:r}=await s.post("/payment/session",{delegatee:i,delegateePk:o});return{sessionId:r.sessionId,baseURL:a.base}};function It({delegatee:n,delegateePk:i,didDomainURL:o,locale:a,title:s="",onSuccess:r=()=>{},...u}){const{t:l}=A(),[m,p]=et({currentState:1}),f=j.useRef(null),c=nt(async()=>{const d=await Tt({didDomainURL:o,delegatee:n,delegateePk:i});return d},{debounceWait:500,debounceLeading:!0,debounceTrailing:!1,debounceMaxWait:3e3,refreshDeps:[],onError(d){console.error(d)}}),g=Z(d=>{d.data.type==="didDomain.success"&&(r?.({nftDid:d.data?.nftDid,domain:d.data?.domain,chainHost:d.data?.chainHost}),f.current?.close(),f.current=null,p({currentState:4}),setTimeout(()=>{p({currentState:8})},2e3))});tt(()=>{try{window.removeEventListener("message",g),f.current?.close(),f.current=null}catch(d){console.warn("Failed to close popup",d)}});const y=Z(()=>{p({currentState:1})}),x=Z(()=>{if(p({currentState:2}),!c.data){console.error("Failed to create session");return}b({sessionId:c.data.sessionId,baseURL:c.data.baseURL})}),b=Z(({sessionId:d,baseURL:w})=>{window.addEventListener("message",g);const C=new URL(w);C.searchParams.set("sessionId",d),C.searchParams.set("locale",a),C.searchParams.set("embed","1"),f.current=wt(C.toString());const q=setInterval(()=>{f.current?.closed&&(clearInterval(q),y())},1e3);return()=>clearInterval(q)});return e.jsxs(e.Fragment,{children:[e.jsx(Ne,{loading:c.loading,onClick:x,variant:"contained",startIcon:e.jsx(Rn,{}),...u,children:s||l("buy.button.title")}),e.jsxs(Cn,{fullWidth:!0,maxWidth:"xs",open:m.currentState>1&&m.currentState<8,onClose:y,children:[!c.error&&e.jsxs(h,{sx:{display:"flex",alignItems:"center",flexDirection:"column",gap:2},children:[m.currentState===2&&e.jsx(z,{size:50}),m.currentState===4&&e.jsx(Sn,{sx:{color:"primary.main",fontSize:"5rem"}}),m.currentState===2&&e.jsx(S,{children:l("buy.status.inProgress")}),m.currentState===4&&e.jsx(S,{children:l("buy.status.success")})]}),c.error&&e.jsx(ye,{severity:"error",children:l("buy.error.failedToCreateSession")})]})]})}function Pt(n){return e.jsx(vn,{locale:n.locale,translations:kt,children:e.jsx(It,{...n})})}function qt({nftDid:n,didDomainURL:i,locale:o,sx:a={}}){const{t:s}=A(),[r,u]=se({safeIframeRef:null,popoverAnchorEl:null}),l=j.useRef(null),m=H(),p=ie(m.breakpoints.down("md")),f=x=>{u({popoverAnchorEl:x.currentTarget})},c=()=>{u({popoverAnchorEl:null})},g=it(async()=>{const x=await Qe(i);return x?x.base:null});if(!g.value)return null;if(g.loading)return e.jsx(z,{});const y=ee(g.value,`/embed/domain?nft-did=${n}&locale=${o}`);return e.jsxs(e.Fragment,{children:[e.jsx(L,{title:s("embed.iconTip"),children:e.jsx(h,{component:"img",src:ee(i,"/.well-known/service/blocklet/logo"),alt:"logo",onClick:f,sx:[{width:16,height:16},Ct({cursor:"pointer"},a)]})}),e.jsx($e,{id:"popover-info",open:!!r.popoverAnchorEl,anchorEl:r.popoverAnchorEl,onClose:c,anchorOrigin:{vertical:"bottom",horizontal:"right"},children:e.jsx("iframe",{ref:l,title:s("common.subscription"),width:p?"320px":"400px",height:"350px",style:{border:0,display:"block"},src:y})})]})}const Et=n=>["waiting","creating","renewaling"].includes(n);function en({siteId:n,domain:i,onAdd:o=()=>{},children:a=null,did:s,issuing:r=!1,setIssuing:u=()=>{}}){const{t:l}=A(),[m,p]=j.useState(!1),{inService:f}=F(),[c,g]=j.useState(null),{api:y,ws:{useSubscription:x}}=F(),{mode:b,actions:{refreshDomainStatus:d}}=oe(),w=xt(async()=>{const{cert:T}=await y.findCertificateByDomain({input:{domain:i,did:s}});return T}),C=(T,R)=>{T.domain===i&&(u(!1),p(!1),f&&b!=="setup"&&(R==="success"?E.success(l("setup.domain.genCertSuccess",{domain:T.domain})):R==="error"&&E.error(l("setup.domain.genCertFailed",{domain:T.domain,message:T.message}))))};if(j.useEffect(()=>{w.loading||u(Et(w.value?.status))},[w.loading,w.value?.status,u]),x(Ie.BlockletEvents.certError,T=>C(T,"error")),x(Ie.BlockletEvents.certIssued,T=>{w.retry(),d(T.domain),C(T,"success")}),w.loading||w.value?.status==="normal")return"";const q=()=>{p(!1),g(null)},B=async()=>{p(!0);try{await y.issueLetsEncryptCert({input:{siteId:n,domain:i,did:s,inBlockletSetup:b==="setup"}}),o(),u(!0)}catch(T){console.error(T),u(!1)}finally{p(!1),g(null)}},M={title:l("router.cert.genLetsEncryptCert.title"),description:e.jsxs("div",{children:[e.jsx(ye,{severity:"success",children:l("router.cert.genLetsEncryptCert.dnsTip")}),l("router.cert.genLetsEncryptCert.description")]}),confirm:l("common.confirm"),onConfirm:B,onCancel:q},U=T=>{T.stopPropagation(),g(M)};return e.jsxs(e.Fragment,{children:[r?e.jsx(L,{title:l("router.cert.issuing"),children:e.jsx(z,{size:13,style:{fontSize:"13px"}})}):a({loading:m,open:U}),c&&e.jsx(re,{color:"primary",title:c.title,description:c.description,confirm:c.confirm,params:c.params,onConfirm:c.onConfirm,onCancel:c.onCancel})]})}en.propTypes={domain:t.string.isRequired,did:t.string.isRequired,siteId:t.string.isRequired,onAdd:t.func,children:t.any,issuing:t.bool,setIssuing:t.func};function nn({domain:n,domainStatus:i,did:o,onAdd:a=()=>{},children:s=null,issuing:r=!1,setIssuing:u=()=>{},...l}){return st(n)||!Xe(n)||Yn(i)||i?.isHttps?"":e.jsx(en,{...l,domain:n,did:o,onAdd:a,issuing:r,setIssuing:u,children:s})}nn.propTypes={domain:t.string.isRequired,domainStatus:t.shape({isHttps:t.bool}).isRequired,did:t.string.isRequired,onAdd:t.func,children:t.any,issuing:t.bool,setIssuing:t.func};function tn({id:n,domain:i,children:o=null,teamDid:a="",onDelete:s=null}){const{t:r}=A(),[u,l]=j.useState(!1),[m,p]=j.useState(null),{api:f}=F(),c=()=>{l(!1),p(null)},g=async()=>{l(!0);try{await f.deleteDomainAlias({input:{id:n,domainAlias:i,teamDid:a}}),s?.(),await ot(2e3)}catch(b){E.error(b.message)}finally{p(null),l(!1)}},y={keyName:i,title:r("router.domainAlias.delete.title"),description:r("router.domainAlias.delete.description",{domain:i}),confirmPlaceholder:r("router.domainAlias.delete.confirmPlaceholder",{domain:i}),confirm:r("common.delete"),onConfirm:g,onCancel:c},x=b=>{b.stopPropagation(),p(y)};return e.jsxs(e.Fragment,{children:[typeof o=="function"?o({loading:u,open:x}):e.jsxs(te,{edge:"end",onClick:x,size:"small",className:"rule-action",color:"error","data-cy":"action-delete-domain-alias",children:[u?e.jsx(z,{size:16}):e.jsx(_e,{style:{fontSize:16}}),r("common.delete")]}),m&&e.jsx(gt,{keyName:m.keyName,title:m.title,description:m.description,confirmPlaceholder:m.confirmPlaceholder,confirm:m.confirm,params:m.params,onConfirm:m.onConfirm,onCancel:m.onCancel})]})}tn.propTypes={id:t.string.isRequired,domain:t.string.isRequired,children:t.any,teamDid:t.string,onDelete:t.func};function sn({site:n,domain:i,blocklet:o,onDelete:a=()=>{}}){const{t:s}=A(),r=i.value===window.location.hostname;return e.jsx(ht,{"data-cy":"domain-actions",size:"large",actions:[({close:u})=>e.jsx(tn,{id:n.id,domain:i.value,teamDid:o?.meta?.did,onDelete:a,children:({open:l})=>e.jsx(L,{title:r?s("blocklet.router.currentDomainTip"):"",children:e.jsx("span",{children:e.jsxs(We,{disabled:i.isProtected||r,dense:!0,onClick:m=>{u(),l(m)},"data-cy":"action-toggle-block",children:[e.jsx(An,{style:{minWidth:24,marginRight:8},children:e.jsx(_e,{})}),e.jsx(kn,{primary:s("common.delete")})]},"remove")})})})]})}sn.propTypes={site:t.object.isRequired,domain:t.object.isRequired,blocklet:t.object.isRequired,onDelete:t.func};const ae=t.shape({href:t.string,accessibility:t.shape({loading:t.bool,accessible:t.bool}),domainStatus:t.shape({isHttps:t.bool,matchedCert:t.object}),dns:t.shape({resolved:t.bool,ip:t.string})});function on({certificate:n={}}){const[i,o]=j.useState(null),a=F(),{t:s,locale:r}=A(),u=p=>{o(p.currentTarget)},l=()=>{o(null)},m=!!i;return e.jsxs(e.Fragment,{children:[e.jsx(Tn,{"aria-owns":m?"mouse-over-popover":void 0,onMouseEnter:u,onMouseLeave:l,style:{color:"#44cdc6",fontSize:"1em",cursor:"pointer"}}),e.jsx($e,{id:"mouse-over-popover",style:{pointerEvents:"none"},open:m,anchorEl:i,anchorOrigin:{vertical:"bottom",horizontal:"left"},transformOrigin:{vertical:"top",horizontal:"left"},onClose:l,disableRestoreFocus:!0,children:e.jsx(In,{children:e.jsxs(Pn,{style:{display:"flex"},children:[e.jsx("div",{children:e.jsx("img",{src:`${a.imgPrefix}/https-certificate-icon.png`,alt:"certificate icon",style:{maxHeight:"100%",maxWidth:"100%"}})}),e.jsxs(S,{component:"div",style:{marginLeft:"16px"},children:[e.jsx(S,{component:"div",style:{fontWeight:"bold"},children:n.domain}),e.jsx(S,{component:"div",children:`${s("common.issuer")}: ${Zn(n,"issuer.commonName","")}`}),e.jsx(S,{component:"div",children:`${s("router.cert.issuedOn")}: ${Pe(n.validFrom,r)}`}),e.jsx(S,{component:"div",children:`${s("router.cert.expiryOn")}: ${Pe(n.validTo,r)}`})]})]})})})]})}on.propTypes={certificate:t.object};function ne({domain:n,filters:i=["domain","http"]}){const{t:o}=A(),{value:a,domainStatus:s}=n;if(!Xe(a))return null;let r=null,u=null;const{isHttps:l,matchedCert:m}=s,{dns:{ip:p,isDnsResolved:f,isCnameMatch:c}={}}=s,g=f&&c;rt(a)||(g||p==="127.0.0.1"?r=e.jsx(L,{title:o("router.domain.verify.ok"),children:e.jsx(qe,{color:"success"})}):r=e.jsx(L,{title:o("router.domain.verify.notResolved"),children:e.jsx(qe,{color:"error"})})),g?l?u=e.jsx(on,{certificate:m}):u=e.jsx(L,{title:o("router.domain.https.bad"),children:e.jsx(qn,{style:{color:"#D0021B",fontSize:"1em",cursor:"pointer"}})}):u=e.jsx(L,{title:o("router.domain.verify.notResolved"),children:e.jsx(En,{style:{color:"#D0021B",fontSize:"1em",cursor:"pointer"}})});const y=i.map(x=>x==="domain"?r:x==="http"?u:null);return j.createElement(j.Fragment,null,...y)}ne.propTypes={domain:ae.isRequired,filters:t.array};const Lt=Je(be,"mutate_blocklets"),Ft=Je(be,"",at);function pi(n){const{inService:i}=F(),{blocklet:o,loadingRuntimeInfo:a}=oe();let s=Lt;return i&&(s=Ft),e.jsx(s,{...n,blocklet:o,inService:i,loadingRuntimeInfo:a})}const Fe="nft-domain";function be({hasPermission:n=!1,blocklet:i,loadingRuntimeInfo:o=!1,inService:a=!1,showAllDomains:s=!1,updateBlockletDomainAliases:r=()=>{},systemTips:u=null}){const{t:l}=A(),m=ie(d=>d.breakpoints.down("md")),p=j.useMemo(()=>{let d=n;return lt(i)&&(d=d&&a),d},[n,a,i]),{site:f}=i,c=j.useMemo(()=>Ye(i.site?.domainAliases),[i.site?.domainAliases]),g=j.useMemo(()=>c.filter(d=>!fe.isCustomDomain(d.value)),[c]),y=j.useMemo(()=>c.filter(d=>fe.isCustomDomain(d.value)),[c]),x=j.useMemo(()=>y.filter(d=>d.type!==Fe),[y]),b=j.useMemo(()=>y.filter(d=>d.type===Fe),[y]);return e.jsxs(e.Fragment,{children:[e.jsxs(O,{sx:{gap:3},children:[!!b.length&&e.jsx(Q,{title:l("common.didDomains"),description:l("common.didDomainsDescription"),domains:b,hasMutatePermission:p,blocklet:i,site:f,mobile:m,showAllDomains:s,updateBlockletDomainAliases:r}),!!x.length&&e.jsx(Q,{title:l("common.manualDomains"),description:l("common.manualDomainsDescription"),domains:x,hasMutatePermission:p,blocklet:i,site:f,mobile:m,showAllDomains:s,updateBlockletDomainAliases:r}),!!g.length&&e.jsxs(h,{children:[u,e.jsx(Q,{title:l("common.systemDomains"),description:l("common.systemDomainsDescription"),domains:g,hasMutatePermission:p,blocklet:i,site:f,mobile:m,updateBlockletDomainAliases:r})]})]}),!c.length&&(o?e.jsx(z,{size:16}):e.jsx(wn,{children:l("common.empty")}))]})}be.propTypes={hasPermission:t.bool,blocklet:t.object.isRequired,loadingRuntimeInfo:t.bool,inService:t.bool.isRequired,showAllDomains:t.bool,updateBlockletDomainAliases:t.func,systemTips:t.node};function J({children:n=null}){return e.jsx(h,{component:"span",sx:{verticalAlign:"bottom"},children:n})}J.propTypes={children:t.node};function he({domain:n,children:i,suffix:o=null,...a}){const{t:s,locale:r}=A(),u=H(),{href:l,accessibility:m,value:p}=n,f=j.useCallback(()=>e.jsx(ze,{content:je(p),locale:r,style:{marginLeft:"4px",color:u.palette.text.secondary,fontSize:"0.8em"}}),[p,r,u]);return!m||m.loading?e.jsxs(me,{component:"span",...a,children:[e.jsx(L,{title:void 0,placement:"top-end",children:e.jsx(h,{component:"span",children:i})}),f(),e.jsx(J,{children:o}),e.jsx(L,{title:s("blocklet.router.checkUrlAccessible"),placement:"top-end",children:e.jsx(h,{component:"span",className:"status",children:e.jsx(z,{size:13,style:{fontSize:"13px"}})})})]}):m.accessible?e.jsxs(me,{component:"span",...a,children:[e.jsx(h,{component:"a",href:l,target:"_blank",rel:"noopener noreferrer",sx:{color:n.loading?"text.disabled":void 0},children:e.jsx(L,{title:void 0,placement:"top-end",children:e.jsx(h,{component:"span",children:i})})}),f(),e.jsx(J,{children:o})]}):e.jsxs(me,{component:"span",...a,children:[e.jsx(L,{title:s("blocklet.router.urlInaccessible"),placement:"top-end",children:e.jsx(h,{component:"span",children:i})}),!n.loading&&f(),e.jsx(J,{children:o})]})}he.propTypes={domain:ae.isRequired,children:t.any.isRequired,suffix:t.node};const me=Mn(h)`
2
2
  display: inline-block;
3
3
  vertical-align: middle;
4
4
 
@@ -25,4 +25,4 @@ import{ap as bn,T as vn,V as A,b as Cn,H as E,n as te,i as wn,S as ze}from"./ven
25
25
  margin-left: 8px;
26
26
  font-size: 13px;
27
27
  }
28
- `;function ge({hasMutatePermission:n,site:i,domain:o,blocklet:a,onDelete:s}){return n&&!o.isProtected?e.jsx(sn,{site:i,domain:o,blocklet:a,onDelete:s}):null}ge.propTypes={hasMutatePermission:t.bool.isRequired,site:t.object.isRequired,domain:ae.isRequired,blocklet:t.object.isRequired,onDelete:t.func.isRequired};function K({siteId:n,domain:i,blocklet:o,hasMutatePermission:a}){const{info:s}=F(),{t:r,locale:u}=A(),[l,m]=j.useState(!1);return e.jsxs(h,{sx:{display:"flex",justifyContent:"flex-start",alignItems:"center",gap:.5,button:{lineHeight:1}},children:[i.type==="nft-domain"&&e.jsx(qt,{locale:u,nftDid:i.nftDid,didDomainURL:s.nftDomainUrl}),e.jsx(h,{sx:{display:"flex",mt:"-1px"},children:e.jsx(ne,{domain:i,filters:["http"]},`${i.value}-http`)}),a&&i.canGenerateCertificate&&e.jsx(nn,{siteId:n,domain:i.value,domainStatus:i.domainStatus,did:o.meta.did,issuing:l,setIssuing:m,children:({open:p})=>e.jsx(te,{sx:{padding:0},size:"small",onClick:f=>p(f),children:r("router.cert.genLetsEncryptCert.title")})})]})}K.propTypes={siteId:t.string.isRequired,domain:ae.isRequired,blocklet:t.object.isRequired,hasMutatePermission:t.bool.isRequired};function Q({title:n,description:i,domains:o=[],hasMutatePermission:a,blocklet:s,site:r,mobile:u,showAllDomains:l=!1,updateBlockletDomainAliases:m=()=>{}}){const[p,f]=j.useState(!1),c=j.useMemo(()=>l||p?o:o.slice(0,1),[o,p,l]),g=o.length>1,y=x=>a&&!x.isProtected;return e.jsx(We,{elevation:0,sx:{p:3,pb:l?3:1.5,display:"flex",alignItems:"flex-start",gap:3,borderRadius:2,border:"1px solid",borderColor:"divider",transition:"box-shadow 0.2s ease-in-out"},children:e.jsxs(W,{sx:{width:1},children:[e.jsxs(h,{sx:{mb:1.5},children:[e.jsx(R,{variant:"h6",children:n}),e.jsx(R,{sx:{fontSize:12,color:"text.secondary",mt:.5},children:i})]}),c.map((x,b)=>e.jsxs(W,{children:[b!==0&&e.jsx(h,{sx:{my:.75,width:1,height:"1px"}}),!u&&e.jsxs(h,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[e.jsxs(h,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(h,{sx:{height:28,display:"flex",alignItems:"center"},children:e.jsx(ne,{domain:x,filters:["domain"]},`${x.value}-domain`)}),e.jsxs(h,{sx:{display:"flex",alignItems:"center",justifyContent:"flex-start",gap:.5,svg:{width:"1em",height:"1em"},img:{width:"0.9em",height:"0.9em"}},children:[e.jsx(he,{domain:x,target:"_blank",children:x.value}),e.jsx(h,{sx:{mt:"2px"},children:e.jsx(K,{siteId:s.site?.id,domain:x,blocklet:s,hasMutatePermission:a})})]})]}),e.jsx(h,{sx:{button:{padding:0}},children:e.jsx(ge,{hasMutatePermission:a,site:r,domain:x,blocklet:s,onDelete:()=>m(x,"delete")})})]}),u&&e.jsxs(h,{sx:{display:"flex",flexDirection:"column"},children:[e.jsxs(h,{sx:{display:"flex",justifyContent:"flex-start",gap:1},children:[e.jsx(h,{sx:{height:28,display:"flex",alignItems:"center"},children:e.jsx(ne,{domain:x,filters:["domain"]},`${x.value}-domain`)}),e.jsx(he,{domain:x,target:"_blank",suffix:y(x)?null:e.jsx(h,{sx:{display:"inline-flex",alignItems:"center",justifyContent:"space-between",svg:{width:"1em",height:"1rem"},img:{width:"0.9rem",height:"0.9rem"}},children:e.jsx(K,{siteId:s.site?.id,domain:x,blocklet:s,hasMutatePermission:a})}),children:x.value})]}),y(x)&&e.jsxs(h,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",ml:"18px"},children:[e.jsx(h,{sx:{display:"flex",alignItems:"center"},children:e.jsx(K,{siteId:s.site?.id,domain:x,blocklet:s,hasMutatePermission:a})}),e.jsx(h,{sx:{button:{padding:0}},children:e.jsx(ge,{hasMutatePermission:a,site:r,domain:x,blocklet:s,onDelete:()=>m(x,"delete")})})]})]})]},x.value)),g&&!l&&e.jsx(te,{onClick:()=>f(!p),sx:{p:0,mt:.5,alignSelf:"center"},children:p?e.jsx(Ln,{}):e.jsx(Fn,{})})]})})}Q.propTypes={title:t.string.isRequired,description:t.string.isRequired,domains:t.array.isRequired,hasMutatePermission:t.bool.isRequired,blocklet:t.object.isRequired,site:t.object.isRequired,mobile:t.bool.isRequired,showAllDomains:t.bool,updateBlockletDomainAliases:t.func};const rn=j.createContext({}),{Provider:Mt,Consumer:fi}=rn;function Bt({children:n}){const[i,o]=se({domain:"",error:null}),{locale:a}=A(),s={error:i.error,domain:i.domain,setError:r=>{o({error:r})},setDomain:r=>{const u=je(r),l=Ze(u,a);o({domain:u,error:l})}};return e.jsx(Mt,{value:{value:s},children:n})}function Ut(){const{value:n}=j.useContext(rn);return n}var ue,Me;function zt(){if(Me)return ue;Me=1;const{joinURL:n}=ct(),i=dt(),o="z2qaGosS3rZ7m5ttP3Nd4V4qczR9TryTcRV4p";return ue={DID_DOMAIN_SERVICE_DID:o,getDidDomainServiceURL:async s=>{if(!s||!s?.trim())return null;const r=new URL(s);r.pathname="__blocklet__.js",r.searchParams.set("type","json");const{data:u}=await i.get(r.toString()),l=u?.componentMountPoints?.find(c=>c.did===o),m=new URL(s);m.pathname=l?.mountPoint;const p=m.toString(),f=n(p,"/api");return{base:p,api:f,domain:n(f,"/domains")}}},ue}var Nt=zt();const $t=He(Jn),_t=He(Kn);var pe,Be;function Ot(){if(Be)return pe;Be=1;const n=$t,i=_t;function o(s){return!s||typeof s!="string"?!1:s.split(".").length===2}return pe={isTopLevelDomain:o,formatTopLevelDidDomain:s=>{const r=n(i(s));return r&&(o(r)?`www.${r}`:r)}},pe}var Ue=Ot(),Wt=mt();const Ht=Qn(Wt);function an({domain:n="",resolvedTarget:i,...o}){const{t:a,locale:s}=A();return e.jsxs(h,{sx:{backgroundColor:"rgb(236, 251, 253)",borderColor:"rgb(236, 251, 253)",borderRadius:"8px",padding:"12px"},...o,children:[e.jsxs(h,{sx:{display:"flex",flexWrap:"wrap"},children:[a("router.domain.setup.tipStart"),n&&e.jsx(h,{sx:{mx:.5,color:"primary.main",fontWeight:"fontWeightBold"},children:n}),a("router.domain.setup.tipEnd"),":"]}),e.jsxs(W,{sx:{gap:.5,"&>div":{mb:0},marginTop:"12px"},children:[e.jsx(De,{label:a("router.domain.setup.recordType"),value:"CNAME",locale:s}),e.jsx(De,{label:a("router.domain.setup.recordValue"),value:i,locale:s})]})]})}an.propTypes={domain:t.string,resolvedTarget:t.string.isRequired};function De({locale:n,label:i,value:o}){const a=ie(r=>r.breakpoints.down("md")),s=H();return e.jsx(yt,{name:i,nameWidth:120,children:e.jsxs(h,{sx:{display:"flex",alignItems:"center",lineHeight:1},children:[e.jsx(R,{component:"span",sx:[{color:"primary.main",overflow:"auto"},a?{maxWidth:"95%",wordWrap:"break-word"}:{wordWrap:"break-word"}],children:o}),e.jsx(ze,{content:o,locale:n,style:{marginLeft:"4px",color:s.palette.text.secondary}})]})})}De.propTypes={locale:t.string.isRequired,label:t.string.isRequired,value:t.string.isRequired};function ln({children:n=null,href:i="",sx:o=null,showIcon:a=!1,...s}){const r=H();return e.jsxs(Bn,{href:i,target:"_blank",...s,sx:{display:"inline-flex",alignItems:"center",color:"text.primary",":hover":{color:r.palette.primary.main},...o},children:[n,a&&e.jsx(Un,{fontSize:"small",sx:{ml:"4px",fontSize:"1rem"}})]})}ln.propTypes={children:t.node,sx:t.object,href:t.string,showIcon:t.bool};function cn({records:n}){return e.jsx(zn,{component:h,sx:{".MuiTableCell-root":{color:"text.primary"}},children:e.jsxs(Nn,{children:[e.jsx($n,{children:e.jsxs(Te,{children:[e.jsx(_,{children:"Type"}),e.jsx(_,{children:"Name"}),e.jsx(_,{children:"Data"})]})}),e.jsx(_n,{children:n.map(i=>e.jsxs(Te,{children:[e.jsx(_,{children:i.type}),e.jsx(_,{children:i.name}),e.jsx(_,{sx:{wordBreak:"break-word"},children:e.jsx(bt,{children:i.data})})]},i.name))})]})})}cn.propTypes={records:t.array.isRequired};function dn({url:n,domain:i=""}){const{t:o}=A();return e.jsxs(h,{sx:{display:"flex",flexDirection:"column",gap:2},children:[e.jsxs(h,{sx:{display:"flex",flexDirection:"column",gap:1},children:[e.jsx(R,{component:"h3",variant:"h6",children:o("setting.dns.step1Title")}),e.jsxs(R,{component:"section",children:[o("setting.dns.step1Desc1"),e.jsx(ln,{href:"https://lookup.icann.org/",target:"_blank",children:"ICANN"})]})]}),e.jsxs(h,{sx:{display:"flex",flexDirection:"column",gap:1},children:[e.jsx(R,{component:"h3",variant:"h6",children:o("setting.dns.step2Title",{url:n})}),e.jsx(R,{component:"section",children:o("setting.dns.step2Desc")})]}),e.jsxs(h,{sx:{display:"flex",flexDirection:"column",gap:1},children:[e.jsx(R,{component:"h3",variant:"h6",children:o("setting.dns.step3Title")}),e.jsx(R,{component:"section",children:o("setting.dns.step3Desc")}),e.jsx(cn,{records:[{type:"CNAME",name:jt(n),data:i}]})]})]})}dn.propTypes={url:t.string.isRequired,domain:t.string};const mn=j.createContext();function Vt({children:n}){const{t:i}=A(),{api:o}=F(),{blocklet:a}=oe(),[s,r]=j.useState(null),u=j.useCallback(async(p,f)=>{try{const c=await o.getBlocklet({input:{domain:p,did:a?.meta?.did}});return c?.blocklet?new Promise(g=>{r({title:i("setting.domain.conflictTitle",{domain:p}),description:i("setting.domain.conflictDescription",{domain:p,title:c.blocklet.meta?.title,from:c.blocklet.meta?.title,to:a.meta?.title}),confirm:i("common.confirm"),cancel:i("common.cancel"),onConfirm:async()=>{r(null),await f?.(),g(!0)},onCancel:()=>{r(null),g(!1)}})}):!1}catch(c){return console.error(c),E.error(N(c)),!1}},[o,i,a]),l=j.useCallback(()=>s?e.jsx(re,{title:s.title,description:s.description,confirm:s.confirm,cancel:s.cancel,onConfirm:s.onConfirm,onCancel:s.onCancel}):null,[s]),m=j.useMemo(()=>({checkConflict:u}),[u]);return e.jsxs(mn.Provider,{value:m,children:[n,l()]})}function un(){return j.useContext(mn)}function pn({siteId:n,teamDid:i,cnameDomain:o,defaultCustomDomain:a="",onInputDomain:s=X,appId:r="",appPk:u="",onSuccess:l=X,onError:m=X,disabled:p=!1,autoFocus:f=!0,inBlockletSetup:c=!1,shouldCheckDomain:g=!1,onStateChange:y=X,currentIp:x="",...b}){const{t:d,locale:w}=A(),{api:C,info:q}=F(),{blocklet:B}=oe(),M=Ut(),U=H(),T=ut({key:"sm"}),[S,P]=se({submittingDomain:!1,domain:a,error:null,type:q?.nftDomainUrl?"nftDomain":"inputDomain",showDnsTip:!1}),le=xe.getDisplayName(B),{checkConflict:ve}=un(),{connectApi:gn}=pt(),V=Dt(()=>Nt.getDidDomainServiceURL(q?.nftDomainUrl));if(q?.nftDomainUrl&&V.loading)return e.jsx(h,{...b,onError:m,currentIp:x,children:e.jsx(Ee,{relative:"parent",children:e.jsx(z,{})})});if(V.error)return e.jsx(h,{...b,onError:m,currentIp:x,children:e.jsx(Ee,{relative:"parent",children:V.error.message})});const Ce=V.value,ce=()=>{P({invalidDNSDomain:null})},we=async(D,v,k=!1)=>{await C.addDomainAlias({input:{id:n,domainAlias:D,teamDid:i,inBlockletSetup:!0,force:k}}),P({submittingDomain:!1}),l({domain:D,type:"inputDomain",canGenerateCertificate:!v})},de=async(D,v)=>{y(d("setting.domain.addingDomain"));try{await we(D,v,!1)}catch(k){if(console.error(k),ce(),N(k).includes("already exists")){await ve(D,()=>we(D,v,!0));return}E.error(N(k))}},Se=async({domain:D,type:v,nftDid:k,chainHost:O})=>{try{if(!g){if(v==="inputDomain"){await de(D);return}l({domain:D,type:v,nftDid:k,chainHost:O});return}y({text:d("setting.domain.checkingResolvable")});let I=30;const $=3e3,jn=I*1e3/$,ke=setInterval(()=>{if(I<=0){clearInterval(ke);return}y({text:`${d("setting.domain.checkingResolvable")} (${I--}s)`})},1e3),G=await Ht(()=>C.getDomainDNS({input:{teamDid:i,domain:D}}),{retries:jn,minTimeout:$,maxTimeout:$,onFailedAttempt:console.error});if(clearInterval(ke),!G?.isDnsResolved||!G?.isCnameMatch){let Y="";if(G.isDnsResolved?G.isCnameMatch||(Y=d("setting.domain.resolvedAddressError",{domain:D,curDomain:o})):Y=d("setting.domain.cannotResolve",{domain:D}),v==="nftDomain"){E.error(Y),l({domain:D,type:"nftDomain"});return}y({text:""}),P({invalidDNSDomain:{domain:D,error:Y},domain:D,type:v,submittingDomain:!1});return}if(v==="nftDomain"){l({domain:D,type:"nftDomain"});return}await de(D)}catch(I){E.error(I.message),y({text:""}),P({submittingDomain:!1})}},Re=async({domain:D,nftDid:v,chainHost:k,force:O})=>{let I=Le(D);I=Ue.formatTopLevelDidDomain(I),P({submittingDomain:!0}),await C.addDomainAlias({input:{id:n,type:"nft-domain",domainAlias:I,nftDid:v,chainHost:k,teamDid:i,inBlockletSetup:c,force:O}});const $="nftDomain";P({type:$}),await Se({domain:I,type:$,nftDid:v,chainHost:k})},Dn=async({domain:D,nftDid:v,chainHost:k,isDomainOwner:O})=>{if(!O){const I=d("router.domainAlias.addDomainNFT.authorizeFailed");E.error(I),P({submittingDomain:!1,error:I});return}try{await Re({domain:D,nftDid:v,chainHost:k,force:!1})}catch(I){if(console.error(I),ce(),N(I).includes("already exists")){await ve(D,()=>Re({domain:D,nftDid:v,chainHost:k,force:!0}));return}E.error(N(I))}finally{P({submittingDomain:!1})}},yn=async()=>{try{P({submittingDomain:!0});const D=Le(S.domain);if(q.nftDomainUrl&&Ce&&(await C.isDidDomain({input:{domain:D}})).value===!0){gn.openPopup({prefix:"/connect-to-did-domain",custom:!0,locale:w,extraParams:{provider:"wallet",delegatee:r,delegateePk:u,domain:Ue.formatTopLevelDidDomain(S.domain),appName:le,appUrl:xe.getAppUrl(B)},message:{title:d("router.domainAlias.addDomainNFT.connect.title",{appName:le}),scan:d("router.domainAlias.addDomainNFT.connect.scan",{domain:S.domain,appName:le}),confirm:d("router.domainAlias.addDomainNFT.connect.confirm"),success:d("router.domainAlias.addDomainNFT.connect.success")},onSuccess:Dn,onError:k=>{E.error(k.message),P({submittingDomain:!1})},onClose:()=>P({submittingDomain:!1}),checkTimeout:60*5e3},{baseUrl:Ce.base,locale:w});return}await Se({domain:D,type:S.type})}catch(D){P({submittingDomain:!1}),M.setError(D.message)}},Ae=M.error||S.error;return e.jsx(h,{...b,onError:m,currentIp:x,children:e.jsxs(h,{sx:{display:"flex",flexDirection:"column",justifyContent:"flex-start",gap:"1em"},children:[e.jsxs(h,{component:"form",onSubmit:D=>{D.preventDefault(),yn()},sx:{display:"flex",flexDirection:"column",gap:"8px"},children:[e.jsx(R,{sx:{color:U.palette.text.primary},children:d("router.domainAlias.add.tips")}),e.jsx(On,{sx:{display:"block",marginTop:"8px"},label:d("router.domainAlias.add.domainDescription"),helperText:S.type==="inputDomain"&&Ae||d("router.domainAlias.add.helperText"),fullWidth:!0,disabled:p,value:S.domain,size:"small",variant:"outlined",error:!!Ae&&S.type==="inputDomain",onChange:D=>{const v=je(D.target?.value);M.setDomain(v);const k=Ze(v,w);P({domain:v,error:k,type:"inputDomain"}),s({domain:v,error:k,type:"inputDomain"})},autoFocus:f,onBlur:()=>{M.domain||(P({error:null}),M.setError(null))},slotProps:{htmlInput:{"data-cy":"domain-name-input"}}}),e.jsx(h,{sx:{width:"100%",display:"flex",justifyContent:"flex-end"},children:e.jsx(Ne,{"data-cy":"confirm-add-domain",fullWidth:T,variant:"contained",loading:S.submittingDomain,type:"submit",children:d("common.add")})}),e.jsx(h,{sx:{backgroundColor:()=>Wn(U.palette.primary.light,.1),borderRadius:"8px",padding:"12px"},children:d("router.domainAlias.addDomainNFT.topLevelDidDomainHint")}),e.jsxs(h,{sx:{cursor:"pointer",fontSize:"14px",display:"flex",alignItems:"center",gap:"4px",lineHeight:1,color:U.palette.primary.main},onClick:()=>P({showDnsTip:!S.showDnsTip}),children:[e.jsx(Hn,{fontSize:"1em"}),d("router.domainAlias.showTipHint")]}),S.showDnsTip&&e.jsx(an,{domain:S.domain,resolvedTarget:o,style:{marginTop:"4px"}})]}),S.invalidDNSDomain&&e.jsx(re,{maxWidth:"md",title:d("common.reminder"),description:e.jsxs(W,{sx:{gap:2},children:[e.jsx(ye,{severity:"warning",children:d("setting.domain.invalidDNSReminder",{error:S.invalidDNSDomain.error})}),e.jsx(dn,{url:S.domain,domain:o})]}),color:"primary",confirm:d("setting.domain.continueAdd"),onConfirm:()=>de(S.invalidDNSDomain.domain,S.type),onCancel:ce})]})})}pn.propTypes={siteId:t.string.isRequired,currentIp:t.string,teamDid:t.string.isRequired,cnameDomain:t.string.isRequired,defaultCustomDomain:t.string,onInputDomain:t.func,onSuccess:t.func,appId:t.string,appPk:t.string,disabled:t.bool,autoFocus:t.bool,inBlockletSetup:t.bool,shouldCheckDomain:t.bool,onStateChange:t.func,onError:t.func};function fn({id:n,children:i=null,title:o="",teamDid:a="",systemDomains:s,appId:r=null,appPk:u,onAddDomainAlias:l=()=>{},...m}){const{t:p}=A(),[f,c]=se({loading:!1,confirmSetting:null}),g=s.find(d=>fe.isDidDomain(d)),y=()=>{c({loading:!1,confirmSetting:null})},x={title:o||p("router.domainAlias.add.title"),description:function(w,C,q){return e.jsx(pn,{siteId:n,teamDid:a,cnameDomain:g,onSuccess:B=>{l(B),c({confirmSetting:null})},onInputDomain:({domain:B,type:M,error:U})=>{C({...w,domain:B,type:M,__disableConfirm:!!U}),q(U)},appId:r,appPk:u,...m})},confirm:p("common.confirm"),cancel:p("common.cancel"),params:{domain:"",__disableConfirm:!0},onCancel:y},b=d=>{d.stopPropagation(),c({confirmSetting:x})};return e.jsxs(e.Fragment,{children:[typeof i=="function"?i({loading:f.loading,open:b}):e.jsxs(Oe,{onClick:b,className:"rule-action","data-cy":"action-add-domain-alias",children:[f.loading?e.jsx(z,{size:16}):e.jsx(Vn,{style:{fontSize:18,marginRight:5}}),p("router.domainAlias.add.title")]}),f.confirmSetting&&e.jsx(re,{title:f.confirmSetting.title,description:f.confirmSetting.description,confirm:f.confirmSetting.confirm,cancel:f.confirmSetting.cancel,params:f.confirmSetting.params,onCancel:f.confirmSetting.onCancel,showConfirm:!1,showCancel:!0,displayError:!1,color:"primary",loading:f.loading,maxWidth:"sm"})]})}fn.propTypes={id:t.string.isRequired,children:t.any,title:t.string,teamDid:t.string,systemDomains:t.arrayOf(t.string).isRequired,appId:t.string,appPk:t.string.isRequired,onAddDomainAlias:t.func};function Gt(n){return e.jsx(Bt,{children:e.jsx(fn,{...n})})}function xn({appId:n,appPk:i,siteId:o,inBlockletSetup:a,teamDid:s,sx:r={},onAddDomainAlias:u=()=>{},...l}){const{api:m,info:p}=F(),{locale:f,t:c}=A(),{checkConflict:g}=un(),y=async({domain:b,nftDid:d,chainHost:w,force:C})=>{const q={id:o,type:"nft-domain",domainAlias:b,nftDid:d,chainHost:w,teamDid:s,inBlockletSetup:a,force:C};return await m.addDomainAlias({input:q}),q},x=async({domain:b,nftDid:d,chainHost:w})=>{try{const C=await y({domain:b,nftDid:d,chainHost:w,force:!1});u(C)}catch(C){if(N(C).includes("already exists")){await g(b,()=>y({domain:b,nftDid:d,chainHost:w,force:!0}));return}E.error(N(C))}};return e.jsx(Pt,{delegatee:n,delegateePk:i,didDomainURL:p.nftDomainUrl,onSuccess:x,locale:f,variant:"outlined",sx:r,title:c("router.domainAlias.addDomainNFT.buy"),...l})}xn.propTypes={appId:t.string.isRequired,appPk:t.string.isRequired,siteId:t.string.isRequired,inBlockletSetup:t.bool.isRequired,teamDid:t.string.isRequired,sx:t.object,onAddDomainAlias:t.func};function Yt({blocklet:n,bugDidDomainProps:i={},connectDomainProps:o={},updateBlockletDomainAliases:a=()=>{}}){const{t:s}=A(),{info:r}=F(),u=ie(c=>c.breakpoints.down("md")),{site:l}=n,m=j.useMemo(()=>Xe(n.site?.domainAliases),[n.site?.domainAliases]),p=n.environments?.find(c=>c.key==="BLOCKLET_APP_PK")?.value,f=ft(m);return e.jsx(Vt,{children:e.jsx(hn,{action:e.jsxs(h,{sx:{display:"flex",alignItems:u?"stretch":"center",flexDirection:u?"column":"row",gap:1},children:[r.nftDomainUrl&&e.jsx(xn,{variant:"contained",appId:n.appPid,appPk:p,siteId:l.id,inBlockletSetup:!1,teamDid:n.meta.did,onAddDomainAlias:c=>{const g={value:c.domainAlias,isProtected:!1,type:c.type,nftDid:c.nftDid,chainHost:c.chainHost,accessibility:{loading:!0}};a(g)},...i}),e.jsx(Gt,{id:l.id,title:s("common.connectExistingDomain"),teamDid:n.meta?.did,appId:n.appPid,appPk:p,systemDomains:f?.map(c=>c.value),onAddDomainAlias:c=>{const g={value:c.domain,isProtected:!1,type:c.type==="nftDomain"?"nft-domain":"",nftDid:c.nftDid,chainHost:c.chainHost,accessibility:{loading:!0},canGenerateCertificate:c.canGenerateCertificate===void 0?!0:c.canGenerateCertificate};a(g)},...o,children:({open:c})=>e.jsxs(te,{variant:"outlined",sx:{borderColor:"#ddd",color:"text.primary","&:hover":{bgcolor:g=>g.palette.primary.main,color:g=>g.palette.primary.contrastText}},"data-cy":"add-domain-alias",onClick:c,disabled:xe.isInProgress(n.status),children:[e.jsx(Gn,{style:{fontSize:"1.3em",marginRight:4}}),s("common.connectExistingDomain")]})})]})})})}Yt.propTypes={blocklet:t.object.isRequired,bugDidDomainProps:t.object,connectDomainProps:t.object,updateBlockletDomainAliases:t.func};function hn({action:n}){const{t:i}=A();return e.jsxs(We,{elevation:0,sx:{p:3,borderRadius:2,border:"1px solid",borderColor:"divider"},children:[e.jsx(h,{sx:{display:"flex",alignItems:"center",gap:2},children:e.jsxs(h,{sx:{flex:1,width:0,mb:1.5},children:[e.jsx(R,{variant:"h6",children:i("common.bugOrConnectDomain")}),e.jsx(R,{sx:{fontSize:12,color:"text.secondary",mt:.5},children:i("common.bugOrConnectDomainTip")})]})}),n]})}hn.propTypes={action:t.element.isRequired};export{Bt as D,Yt as a,pi as b};
28
+ `;function ge({hasMutatePermission:n,site:i,domain:o,blocklet:a,onDelete:s}){return n&&!o.isProtected?e.jsx(sn,{site:i,domain:o,blocklet:a,onDelete:s}):null}ge.propTypes={hasMutatePermission:t.bool.isRequired,site:t.object.isRequired,domain:ae.isRequired,blocklet:t.object.isRequired,onDelete:t.func.isRequired};function K({siteId:n,domain:i,blocklet:o,hasMutatePermission:a}){const{info:s}=F(),{t:r,locale:u}=A(),[l,m]=j.useState(!1);return e.jsxs(h,{sx:{display:"flex",justifyContent:"flex-start",alignItems:"center",gap:.5,button:{lineHeight:1}},children:[i.type==="nft-domain"&&e.jsx(qt,{locale:u,nftDid:i.nftDid,didDomainURL:s.nftDomainUrl}),e.jsx(h,{sx:{display:"flex",mt:"-1px"},children:e.jsx(ne,{domain:i,filters:["http"]},`${i.value}-http`)}),a&&i.canGenerateCertificate&&e.jsx(nn,{siteId:n,domain:i.value,domainStatus:i.domainStatus,did:o.meta.did,issuing:l,setIssuing:m,children:({open:p})=>e.jsx(te,{sx:{padding:0},size:"small",onClick:f=>p(f),children:r("router.cert.genLetsEncryptCert.title")})})]})}K.propTypes={siteId:t.string.isRequired,domain:ae.isRequired,blocklet:t.object.isRequired,hasMutatePermission:t.bool.isRequired};function Q({title:n,description:i,domains:o=[],hasMutatePermission:a,blocklet:s,site:r,mobile:u,showAllDomains:l=!1,updateBlockletDomainAliases:m=()=>{}}){const[p,f]=j.useState(!1),c=j.useMemo(()=>l||p?o:o.slice(0,1),[o,p,l]),g=o.length>1,y=x=>a&&!x.isProtected;return e.jsx(Oe,{elevation:0,sx:{p:3,pb:l?3:1.5,display:"flex",alignItems:"flex-start",gap:3,borderRadius:2,border:"1px solid",borderColor:"divider",transition:"box-shadow 0.2s ease-in-out"},children:e.jsxs(O,{sx:{width:1},children:[e.jsxs(h,{sx:{mb:1.5},children:[e.jsx(S,{variant:"h6",children:n}),e.jsx(S,{sx:{fontSize:12,color:"text.secondary",mt:.5},children:i})]}),c.map((x,b)=>e.jsxs(O,{children:[b!==0&&e.jsx(h,{sx:{my:.75,width:1,height:"1px"}}),!u&&e.jsxs(h,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[e.jsxs(h,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(h,{sx:{height:28,display:"flex",alignItems:"center"},children:e.jsx(ne,{domain:x,filters:["domain"]},`${x.value}-domain`)}),e.jsxs(h,{sx:{display:"flex",alignItems:"center",justifyContent:"flex-start",gap:.5,svg:{width:"1em",height:"1em"},img:{width:"0.9em",height:"0.9em"}},children:[e.jsx(he,{domain:x,target:"_blank",children:x.value}),e.jsx(h,{sx:{mt:"2px"},children:e.jsx(K,{siteId:s.site?.id,domain:x,blocklet:s,hasMutatePermission:a})})]})]}),e.jsx(h,{sx:{button:{padding:0}},children:e.jsx(ge,{hasMutatePermission:a,site:r,domain:x,blocklet:s,onDelete:()=>m(x,"delete")})})]}),u&&e.jsxs(h,{sx:{display:"flex",flexDirection:"column"},children:[e.jsxs(h,{sx:{display:"flex",justifyContent:"flex-start",gap:1},children:[e.jsx(h,{sx:{height:28,display:"flex",alignItems:"center"},children:e.jsx(ne,{domain:x,filters:["domain"]},`${x.value}-domain`)}),e.jsx(he,{domain:x,target:"_blank",suffix:y(x)?null:e.jsx(h,{sx:{display:"inline-flex",alignItems:"center",justifyContent:"space-between",svg:{width:"1em",height:"1rem"},img:{width:"0.9rem",height:"0.9rem"}},children:e.jsx(K,{siteId:s.site?.id,domain:x,blocklet:s,hasMutatePermission:a})}),children:x.value})]}),y(x)&&e.jsxs(h,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",ml:"18px"},children:[e.jsx(h,{sx:{display:"flex",alignItems:"center"},children:e.jsx(K,{siteId:s.site?.id,domain:x,blocklet:s,hasMutatePermission:a})}),e.jsx(h,{sx:{button:{padding:0}},children:e.jsx(ge,{hasMutatePermission:a,site:r,domain:x,blocklet:s,onDelete:()=>m(x,"delete")})})]})]})]},x.value)),g&&!l&&e.jsx(te,{onClick:()=>f(!p),sx:{p:0,mt:.5,alignSelf:"center"},children:p?e.jsx(Ln,{}):e.jsx(Fn,{})})]})})}Q.propTypes={title:t.string.isRequired,description:t.string.isRequired,domains:t.array.isRequired,hasMutatePermission:t.bool.isRequired,blocklet:t.object.isRequired,site:t.object.isRequired,mobile:t.bool.isRequired,showAllDomains:t.bool,updateBlockletDomainAliases:t.func};const rn=j.createContext({}),{Provider:Mt,Consumer:fi}=rn;function Bt({children:n}){const[i,o]=se({domain:"",error:null}),{locale:a}=A(),s={error:i.error,domain:i.domain,setError:r=>{o({error:r})},setDomain:r=>{const u=je(r),l=Ze(u,a);o({domain:u,error:l})}};return e.jsx(Mt,{value:{value:s},children:n})}function Ut(){const{value:n}=j.useContext(rn);return n}var ue,Me;function zt(){if(Me)return ue;Me=1;const{joinURL:n}=ct(),i=dt(),o="z2qaGosS3rZ7m5ttP3Nd4V4qczR9TryTcRV4p";return ue={DID_DOMAIN_SERVICE_DID:o,getDidDomainServiceURL:async s=>{if(!s||!s?.trim())return null;const r=new URL(s);r.pathname="__blocklet__.js",r.searchParams.set("type","json");const{data:u}=await i.get(r.toString()),l=u?.componentMountPoints?.find(c=>c.did===o),m=new URL(s);m.pathname=l?.mountPoint;const p=m.toString(),f=n(p,"/api");return{base:p,api:f,domain:n(f,"/domains")}}},ue}var Nt=zt();const $t=He(Jn),_t=He(Kn);var pe,Be;function Wt(){if(Be)return pe;Be=1;const n=$t,i=_t;function o(s){return!s||typeof s!="string"?!1:s.split(".").length===2}return pe={isTopLevelDomain:o,formatTopLevelDidDomain:s=>{const r=n(i(s));return r&&(o(r)?`www.${r}`:r)}},pe}var Ue=Wt(),Ot=mt();const Ht=Qn(Ot);function an({domain:n="",resolvedTarget:i,...o}){const{t:a,locale:s}=A();return e.jsxs(h,{sx:{backgroundColor:"rgb(236, 251, 253)",borderColor:"rgb(236, 251, 253)",borderRadius:"8px",padding:"12px"},...o,children:[e.jsxs(h,{sx:{display:"flex",flexWrap:"wrap"},children:[a("router.domain.setup.tipStart"),n&&e.jsx(h,{sx:{mx:.5,color:"primary.main",fontWeight:"fontWeightBold"},children:n}),a("router.domain.setup.tipEnd"),":"]}),e.jsxs(O,{sx:{gap:.5,"&>div":{mb:0},marginTop:"12px"},children:[e.jsx(De,{label:a("router.domain.setup.recordType"),value:"CNAME",locale:s}),e.jsx(De,{label:a("router.domain.setup.recordValue"),value:i,locale:s})]})]})}an.propTypes={domain:t.string,resolvedTarget:t.string.isRequired};function De({locale:n,label:i,value:o}){const a=ie(r=>r.breakpoints.down("md")),s=H();return e.jsx(yt,{name:i,nameWidth:120,children:e.jsxs(h,{sx:{display:"flex",alignItems:"center",lineHeight:1},children:[e.jsx(S,{component:"span",sx:[{color:"primary.main",overflow:"auto"},a?{maxWidth:"95%",wordWrap:"break-word"}:{wordWrap:"break-word"}],children:o}),e.jsx(ze,{content:o,locale:n,style:{marginLeft:"4px",color:s.palette.text.secondary}})]})})}De.propTypes={locale:t.string.isRequired,label:t.string.isRequired,value:t.string.isRequired};function ln({children:n=null,href:i="",sx:o=null,showIcon:a=!1,...s}){const r=H();return e.jsxs(Bn,{href:i,target:"_blank",...s,sx:{display:"inline-flex",alignItems:"center",color:"text.primary",":hover":{color:r.palette.primary.main},...o},children:[n,a&&e.jsx(Un,{fontSize:"small",sx:{ml:"4px",fontSize:"1rem"}})]})}ln.propTypes={children:t.node,sx:t.object,href:t.string,showIcon:t.bool};function cn({records:n}){return e.jsx(zn,{component:h,sx:{".MuiTableCell-root":{color:"text.primary"}},children:e.jsxs(Nn,{children:[e.jsx($n,{children:e.jsxs(Te,{children:[e.jsx(_,{children:"Type"}),e.jsx(_,{children:"Name"}),e.jsx(_,{children:"Data"})]})}),e.jsx(_n,{children:n.map(i=>e.jsxs(Te,{children:[e.jsx(_,{children:i.type}),e.jsx(_,{children:i.name}),e.jsx(_,{sx:{wordBreak:"break-word"},children:e.jsx(bt,{children:i.data})})]},i.name))})]})})}cn.propTypes={records:t.array.isRequired};function dn({url:n,domain:i=""}){const{t:o}=A();return e.jsxs(h,{sx:{display:"flex",flexDirection:"column",gap:2},children:[e.jsxs(h,{sx:{display:"flex",flexDirection:"column",gap:1},children:[e.jsx(S,{component:"h3",variant:"h6",children:o("setting.dns.step1Title")}),e.jsxs(S,{component:"section",children:[o("setting.dns.step1Desc1"),e.jsx(ln,{href:"https://lookup.icann.org/",target:"_blank",children:"ICANN"})]})]}),e.jsxs(h,{sx:{display:"flex",flexDirection:"column",gap:1},children:[e.jsx(S,{component:"h3",variant:"h6",children:o("setting.dns.step2Title",{url:n})}),e.jsx(S,{component:"section",children:o("setting.dns.step2Desc")})]}),e.jsxs(h,{sx:{display:"flex",flexDirection:"column",gap:1},children:[e.jsx(S,{component:"h3",variant:"h6",children:o("setting.dns.step3Title")}),e.jsx(S,{component:"section",children:o("setting.dns.step3Desc")}),e.jsx(cn,{records:[{type:"CNAME",name:jt(n),data:i}]})]})]})}dn.propTypes={url:t.string.isRequired,domain:t.string};const mn=j.createContext();function Vt({children:n}){const{t:i}=A(),{api:o}=F(),{blocklet:a}=oe(),[s,r]=j.useState(null),u=j.useCallback(async(p,f)=>{try{const c=await o.getBlocklet({input:{domain:p,did:a?.meta?.did}});return c?.blocklet?new Promise(g=>{r({title:i("setting.domain.conflictTitle",{domain:p}),description:i("setting.domain.conflictDescription",{domain:p,title:c.blocklet.meta?.title,from:c.blocklet.meta?.title,to:a.meta?.title}),confirm:i("common.confirm"),cancel:i("common.cancel"),onConfirm:async()=>{r(null),await f?.(),g(!0)},onCancel:()=>{r(null),g(!1)}})}):!1}catch(c){return console.error(c),E.error(N(c)),!1}},[o,i,a]),l=j.useCallback(()=>s?e.jsx(re,{title:s.title,description:s.description,confirm:s.confirm,cancel:s.cancel,onConfirm:s.onConfirm,onCancel:s.onCancel}):null,[s]),m=j.useMemo(()=>({checkConflict:u}),[u]);return e.jsxs(mn.Provider,{value:m,children:[n,l()]})}function un(){return j.useContext(mn)}function pn({siteId:n,teamDid:i,cnameDomain:o,defaultCustomDomain:a="",onInputDomain:s=Y,appId:r="",appPk:u="",onSuccess:l=Y,onError:m=Y,disabled:p=!1,autoFocus:f=!0,inBlockletSetup:c=!1,shouldCheckDomain:g=!1,onStateChange:y=Y,currentIp:x="",...b}){const{t:d,locale:w}=A(),{api:C,info:q}=F(),{blocklet:B}=oe(),M=Ut(),U=H(),T=ut({key:"sm"}),[R,P]=se({submittingDomain:!1,domain:a,error:null,type:q?.nftDomainUrl?"nftDomain":"inputDomain",showDnsTip:!1}),le=xe.getDisplayName(B),{checkConflict:ve}=un(),{connectApi:gn}=pt(),V=Dt(()=>Nt.getDidDomainServiceURL(q?.nftDomainUrl));if(q?.nftDomainUrl&&V.loading)return e.jsx(h,{...b,onError:m,currentIp:x,children:e.jsx(Ee,{relative:"parent",children:e.jsx(z,{})})});if(V.error)return e.jsx(h,{...b,onError:m,currentIp:x,children:e.jsx(Ee,{relative:"parent",children:V.error.message})});const Ce=V.value,ce=()=>{P({invalidDNSDomain:null})},we=async(D,v,k=!1)=>{await C.addDomainAlias({input:{id:n,domainAlias:D,teamDid:i,inBlockletSetup:!0,force:k}}),P({submittingDomain:!1}),l({domain:D,type:"inputDomain",canGenerateCertificate:!v})},de=async(D,v)=>{y(d("setting.domain.addingDomain"));try{await we(D,v,!1)}catch(k){if(console.error(k),ce(),N(k).includes("already exists")){await ve(D,()=>we(D,v,!0));return}E.error(N(k))}},Re=async({domain:D,type:v,nftDid:k,chainHost:W})=>{try{if(!g){if(v==="inputDomain"){await de(D);return}l({domain:D,type:v,nftDid:k,chainHost:W});return}y({text:d("setting.domain.checkingResolvable")});let I=30;const $=3e3,jn=I*1e3/$,ke=setInterval(()=>{if(I<=0){clearInterval(ke);return}y({text:`${d("setting.domain.checkingResolvable")} (${I--}s)`})},1e3),G=await Ht(()=>C.getDomainDNS({input:{teamDid:i,domain:D}}),{retries:jn,minTimeout:$,maxTimeout:$,onFailedAttempt:console.error});if(clearInterval(ke),!G?.isDnsResolved||!G?.isCnameMatch){let X="";if(G.isDnsResolved?G.isCnameMatch||(X=d("setting.domain.resolvedAddressError",{domain:D,curDomain:o})):X=d("setting.domain.cannotResolve",{domain:D}),v==="nftDomain"){E.error(X),l({domain:D,type:"nftDomain"});return}y({text:""}),P({invalidDNSDomain:{domain:D,error:X},domain:D,type:v,submittingDomain:!1});return}if(v==="nftDomain"){l({domain:D,type:"nftDomain"});return}await de(D)}catch(I){E.error(I.message),y({text:""}),P({submittingDomain:!1})}},Se=async({domain:D,nftDid:v,chainHost:k,force:W})=>{let I=Le(D);I=Ue.formatTopLevelDidDomain(I),P({submittingDomain:!0}),await C.addDomainAlias({input:{id:n,type:"nft-domain",domainAlias:I,nftDid:v,chainHost:k,teamDid:i,inBlockletSetup:c,force:W}});const $="nftDomain";P({type:$}),await Re({domain:I,type:$,nftDid:v,chainHost:k})},Dn=async({domain:D,nftDid:v,chainHost:k,isDomainOwner:W})=>{if(!W){const I=d("router.domainAlias.addDomainNFT.authorizeFailed");E.error(I),P({submittingDomain:!1,error:I});return}try{await Se({domain:D,nftDid:v,chainHost:k,force:!1})}catch(I){if(console.error(I),ce(),N(I).includes("already exists")){await ve(D,()=>Se({domain:D,nftDid:v,chainHost:k,force:!0}));return}E.error(N(I))}finally{P({submittingDomain:!1})}},yn=async()=>{try{P({submittingDomain:!0});const D=Le(R.domain);if(q.nftDomainUrl&&Ce&&(await C.isDidDomain({input:{domain:D}})).value===!0){gn.openPopup({prefix:"/connect-to-did-domain",custom:!0,locale:w,extraParams:{provider:"wallet",delegatee:r,delegateePk:u,domain:Ue.formatTopLevelDidDomain(R.domain),appName:le,appUrl:xe.getAppUrl(B)},message:{title:d("router.domainAlias.addDomainNFT.connect.title",{appName:le}),scan:d("router.domainAlias.addDomainNFT.connect.scan",{domain:R.domain,appName:le}),confirm:d("router.domainAlias.addDomainNFT.connect.confirm"),success:d("router.domainAlias.addDomainNFT.connect.success")},onSuccess:Dn,onError:k=>{E.error(k.message),P({submittingDomain:!1})},onClose:()=>P({submittingDomain:!1}),checkTimeout:60*5e3},{baseUrl:Ce.base,locale:w});return}await Re({domain:D,type:R.type})}catch(D){P({submittingDomain:!1}),M.setError(D.message)}},Ae=M.error||R.error;return e.jsx(h,{...b,onError:m,currentIp:x,children:e.jsxs(h,{sx:{display:"flex",flexDirection:"column",justifyContent:"flex-start",gap:"1em"},children:[e.jsxs(h,{component:"form",onSubmit:D=>{D.preventDefault(),yn()},sx:{display:"flex",flexDirection:"column",gap:"8px"},children:[e.jsx(S,{sx:{color:U.palette.text.primary},children:d("router.domainAlias.add.tips")}),e.jsx(Wn,{sx:{display:"block",marginTop:"8px"},label:d("router.domainAlias.add.domainDescription"),helperText:R.type==="inputDomain"&&Ae||d("router.domainAlias.add.helperText"),fullWidth:!0,disabled:p,value:R.domain,size:"small",variant:"outlined",error:!!Ae&&R.type==="inputDomain",onChange:D=>{const v=je(D.target?.value);M.setDomain(v);const k=Ze(v,w);P({domain:v,error:k,type:"inputDomain"}),s({domain:v,error:k,type:"inputDomain"})},autoFocus:f,onBlur:()=>{M.domain||(P({error:null}),M.setError(null))},slotProps:{htmlInput:{"data-cy":"domain-name-input"}}}),e.jsx(h,{sx:{width:"100%",display:"flex",justifyContent:"flex-end"},children:e.jsx(Ne,{"data-cy":"confirm-add-domain",fullWidth:T,variant:"contained",loading:R.submittingDomain,type:"submit",children:d("common.add")})}),e.jsx(h,{sx:{backgroundColor:()=>On(U.palette.primary.light,.1),borderRadius:"8px",padding:"12px"},children:d("router.domainAlias.addDomainNFT.topLevelDidDomainHint")}),e.jsxs(h,{sx:{cursor:"pointer",fontSize:"14px",display:"flex",alignItems:"center",gap:"4px",lineHeight:1,color:U.palette.primary.main},onClick:()=>P({showDnsTip:!R.showDnsTip}),children:[e.jsx(Hn,{fontSize:"1em"}),d("router.domainAlias.showTipHint")]}),R.showDnsTip&&e.jsx(an,{domain:R.domain,resolvedTarget:o,style:{marginTop:"4px"}})]}),R.invalidDNSDomain&&e.jsx(re,{maxWidth:"md",title:d("common.reminder"),description:e.jsxs(O,{sx:{gap:2},children:[e.jsx(ye,{severity:"warning",children:d("setting.domain.invalidDNSReminder",{error:R.invalidDNSDomain.error})}),e.jsx(dn,{url:R.domain,domain:o})]}),color:"primary",confirm:d("setting.domain.continueAdd"),onConfirm:()=>de(R.invalidDNSDomain.domain,R.type),onCancel:ce})]})})}pn.propTypes={siteId:t.string.isRequired,currentIp:t.string,teamDid:t.string.isRequired,cnameDomain:t.string.isRequired,defaultCustomDomain:t.string,onInputDomain:t.func,onSuccess:t.func,appId:t.string,appPk:t.string,disabled:t.bool,autoFocus:t.bool,inBlockletSetup:t.bool,shouldCheckDomain:t.bool,onStateChange:t.func,onError:t.func};function fn({id:n,children:i=null,title:o="",teamDid:a="",systemDomains:s,appId:r=null,appPk:u,onAddDomainAlias:l=()=>{},...m}){const{t:p}=A(),[f,c]=se({loading:!1,confirmSetting:null}),g=s.find(d=>fe.isDidDomain(d)),y=()=>{c({loading:!1,confirmSetting:null})},x={title:o||p("router.domainAlias.add.title"),description:function(w,C,q){return e.jsx(pn,{siteId:n,teamDid:a,cnameDomain:g,onSuccess:B=>{l(B),c({confirmSetting:null})},onInputDomain:({domain:B,type:M,error:U})=>{C({...w,domain:B,type:M,__disableConfirm:!!U}),q(U)},appId:r,appPk:u,...m})},confirm:p("common.confirm"),cancel:p("common.cancel"),params:{domain:"",__disableConfirm:!0},onCancel:y},b=d=>{d.stopPropagation(),c({confirmSetting:x})};return e.jsxs(e.Fragment,{children:[typeof i=="function"?i({loading:f.loading,open:b}):e.jsxs(We,{onClick:b,className:"rule-action","data-cy":"action-add-domain-alias",children:[f.loading?e.jsx(z,{size:16}):e.jsx(Vn,{style:{fontSize:18,marginRight:5}}),p("router.domainAlias.add.title")]}),f.confirmSetting&&e.jsx(re,{title:f.confirmSetting.title,description:f.confirmSetting.description,confirm:f.confirmSetting.confirm,cancel:f.confirmSetting.cancel,params:f.confirmSetting.params,onCancel:f.confirmSetting.onCancel,showConfirm:!1,showCancel:!0,displayError:!1,color:"primary",loading:f.loading,maxWidth:"sm"})]})}fn.propTypes={id:t.string.isRequired,children:t.any,title:t.string,teamDid:t.string,systemDomains:t.arrayOf(t.string).isRequired,appId:t.string,appPk:t.string.isRequired,onAddDomainAlias:t.func};function Gt(n){return e.jsx(Bt,{children:e.jsx(fn,{...n})})}function xn({appId:n,appPk:i,siteId:o,inBlockletSetup:a,teamDid:s,sx:r={},onAddDomainAlias:u=()=>{},...l}){const{api:m,info:p}=F(),{locale:f,t:c}=A(),{checkConflict:g}=un(),y=async({domain:b,nftDid:d,chainHost:w,force:C})=>{const q={id:o,type:"nft-domain",domainAlias:b,nftDid:d,chainHost:w,teamDid:s,inBlockletSetup:a,force:C};return await m.addDomainAlias({input:q}),q},x=async({domain:b,nftDid:d,chainHost:w})=>{try{const C=await y({domain:b,nftDid:d,chainHost:w,force:!1});u(C)}catch(C){if(N(C).includes("already exists")){await g(b,()=>y({domain:b,nftDid:d,chainHost:w,force:!0}));return}E.error(N(C))}};return e.jsx(Pt,{delegatee:n,delegateePk:i,didDomainURL:p.nftDomainUrl,onSuccess:x,locale:f,variant:"outlined",sx:r,title:c("router.domainAlias.addDomainNFT.buy"),...l})}xn.propTypes={appId:t.string.isRequired,appPk:t.string.isRequired,siteId:t.string.isRequired,inBlockletSetup:t.bool.isRequired,teamDid:t.string.isRequired,sx:t.object,onAddDomainAlias:t.func};function Xt({blocklet:n,bugDidDomainProps:i={},connectDomainProps:o={},updateBlockletDomainAliases:a=()=>{}}){const{t:s}=A(),{info:r}=F(),u=ie(c=>c.breakpoints.down("md")),{site:l}=n,m=j.useMemo(()=>Ye(n.site?.domainAliases),[n.site?.domainAliases]),p=n.environments?.find(c=>c.key==="BLOCKLET_APP_PK")?.value,f=ft(m);return e.jsx(Vt,{children:e.jsx(hn,{action:e.jsxs(h,{sx:{display:"flex",alignItems:u?"stretch":"center",flexDirection:u?"column":"row",gap:1},children:[r.nftDomainUrl&&e.jsx(xn,{variant:"contained",appId:n.appPid,appPk:p,siteId:l.id,inBlockletSetup:!1,teamDid:n.meta.did,onAddDomainAlias:c=>{const g={value:c.domainAlias,isProtected:!1,type:c.type,nftDid:c.nftDid,chainHost:c.chainHost,accessibility:{loading:!0}};a(g)},...i}),e.jsx(Gt,{id:l.id,title:s("common.connectExistingDomain"),teamDid:n.meta?.did,appId:n.appPid,appPk:p,systemDomains:f?.map(c=>c.value),onAddDomainAlias:c=>{const g={value:c.domain,isProtected:!1,type:c.type==="nftDomain"?"nft-domain":"",nftDid:c.nftDid,chainHost:c.chainHost,accessibility:{loading:!0},canGenerateCertificate:c.canGenerateCertificate===void 0?!0:c.canGenerateCertificate};a(g)},...o,children:({open:c})=>e.jsxs(te,{variant:"outlined",sx:{borderColor:"#ddd",color:"text.primary","&:hover":{bgcolor:g=>g.palette.primary.main,color:g=>g.palette.primary.contrastText}},"data-cy":"add-domain-alias",onClick:c,disabled:xe.isInProgress(n.status),children:[e.jsx(Gn,{style:{fontSize:"1.3em",marginRight:4}}),s("common.connectExistingDomain")]})})]})})})}Xt.propTypes={blocklet:t.object.isRequired,bugDidDomainProps:t.object,connectDomainProps:t.object,updateBlockletDomainAliases:t.func};function hn({action:n}){const{t:i}=A();return e.jsxs(Oe,{elevation:0,sx:{p:3,borderRadius:2,border:"1px solid",borderColor:"divider"},children:[e.jsx(h,{sx:{display:"flex",alignItems:"center",gap:2},children:e.jsxs(h,{sx:{flex:1,width:0,mb:1.5},children:[e.jsx(S,{variant:"h6",children:i("common.bugOrConnectDomain")}),e.jsx(S,{sx:{fontSize:12,color:"text.secondary",mt:.5},children:i("common.bugOrConnectDomainTip")})]})}),n]})}hn.propTypes={action:t.element.isRequired};export{Bt as D,Xt as a,pi as b};
@@ -0,0 +1 @@
1
+ import{r as m}from"./vendor-react-Dvs43sk9.js";import{V as n}from"./vendor-ux-IiQnod3w.js";import{ac as p,_ as l,ae as c,e as u}from"./index-sNHCLgAE.js";import{a as x,b as d}from"./domain-action-card-ClQw061p.js";import{j as t,ak as k,b1 as f,aX as h}from"./vendor-mui-core-CnXrAOs3.js";import"./vendor-utils-cJEl_UEd.js";import"./vendor-hooks-CjESGRlR.js";import"./lottie-web-4koyQiv_.js";import"./vendor-arcblock-CuFtPveO.js";import"./useSetState-DFuQZPPV.js";import"./permission-DhYNRf8T.js";import"./session-BAD0lxQk.js";import"./useAsyncRetry-DwwEjrjs.js";import"./useAsync-cZ_FPf9k.js";import"./confirm-CR8be0u2.js";import"./index-DBs9Ljax.js";import"./actions-DqoNrBDK.js";import"./delete-confirm-DhJd_sYk.js";import"./click-to-copy-BOJgIYli.js";import"./useAsync-BcVLpt2E.js";import"./index-l32Mt1U_.js";import"./util-BsAmOTBh.js";import"./engine-DPn0LHHl.js";function z(){const{blocklet:o,actions:{updateBlockletDomainAliases:i}}=p(),{inService:r}=l(),{t:e}=n(),a=m.useMemo(()=>{let s=!0;return c(o)&&(s=s&&r),s},[r,o]);return t.jsxs(k,{component:f,sx:{gap:3,maxWidth:820},children:[t.jsxs(t.Fragment,{children:[u.isAccessible(o.status)===!1&&t.jsx(h,{severity:"warning",children:e("blocklet.router.noRunning")}),a&&t.jsx(x,{blocklet:o,updateBlockletDomainAliases:i,connectDomainProps:{shouldCheckDomain:!0}})]}),t.jsx(d,{showAllDomains:!0,updateBlockletDomainAliases:i})]})}export{z as default};
@@ -1,4 +1,4 @@
1
- import{V as M,d as q,_ as w,H as C,e as Q,f as J}from"./vendor-ux-RIH1nUSh.js";import{j as t,b1 as f,b0 as X,b2 as Z,T as b,Q as T,a$ as ee,ak as B,z as $,a6 as te,at as se}from"./vendor-mui-core-CnXrAOs3.js";import{r as n,u as ie}from"./vendor-react-Dvs43sk9.js";import{H as g}from"./vendor-utils-ByKYcWuf.js";import{a as ne,J as h,d as O,c as j,H as oe,K as re}from"./index-CkTEzTCn.js";import{l as ae}from"./vendor-arcblock-A4RQuZfN.js";import{K as ce}from"./landing-page-BBuNoMf2.js";import{f as _}from"./index-DBs9Ljax.js";import{g as D}from"./get-safe-url-Cgcqi5oF.js";import"./vendor-hooks-OpgB8gyY.js";import"./lottie-web-4koyQiv_.js";const le=se.form`
1
+ import{V as M,d as q,_ as w,H as C,e as Q,f as J}from"./vendor-ux-IiQnod3w.js";import{j as t,b1 as f,b0 as X,b2 as Z,T as b,Q as T,a$ as ee,ak as B,z as $,a6 as te,at as se}from"./vendor-mui-core-CnXrAOs3.js";import{r as n,u as ie}from"./vendor-react-Dvs43sk9.js";import{H as g}from"./vendor-utils-cJEl_UEd.js";import{a as ne,J as h,d as O,c as j,H as oe,K as re}from"./index-sNHCLgAE.js";import{l as ae}from"./vendor-arcblock-CuFtPveO.js";import{K as ce}from"./landing-page-sUHYSREd.js";import{f as _}from"./index-DBs9Ljax.js";import{g as D}from"./get-safe-url-DpalOXcM.js";import"./vendor-hooks-CjESGRlR.js";import"./lottie-web-4koyQiv_.js";const le=se.form`
2
2
  display: flex;
3
3
  flex-direction: column;
4
4
  align-items: center;
@@ -0,0 +1 @@
1
+ import{a5 as e}from"./index-sNHCLgAE.js";var a=e();export{a as e};
@@ -1 +1 @@
1
- import{j as e,a6 as P,ak as E}from"./vendor-mui-core-CnXrAOs3.js";import{r as k,i as T}from"./vendor-react-Dvs43sk9.js";import{o as j}from"./vendor-arcblock-A4RQuZfN.js";import{V as C,H as d,s as S}from"./vendor-ux-RIH1nUSh.js";import{v as W,c as v,S as I,s as R,b as U}from"./index-CkTEzTCn.js";import{K as b}from"./landing-page-BBuNoMf2.js";import{w as L}from"./wrap-locale-Dkx98Pk6.js";import{g as N}from"./get-safe-url-Cgcqi5oF.js";import"./vendor-utils-ByKYcWuf.js";import"./vendor-hooks-OpgB8gyY.js";import"./lottie-web-4koyQiv_.js";import"./index-BjsH7wg6.js";function _({SessionContext:n,webWalletUrl:r,onSuccess:o}){const{api:t,session:i}=k.useContext(n),{t:s,locale:h}=C(),f=T(),{searchParams:p}=new URL(window.location.href),l=p.get("redirect"),g=async(a,w)=>{o(a,w),await i.refresh(),d.success(s("exchangePassport.success")),setTimeout(()=>{if(l){const c=decodeURIComponent(l);c.startsWith(v.WELLKNOWN_SERVICE_PATH_PREFIX)?f(c,{replace:!0}):window.location.href=N(c)}else window.location.href=window.env.pathPrefix||window.env.apiPrefix||"/"},3e3)},u=a=>{d.error(a.message)},m={},x=p.get("componentId");return x&&(m.componentId=x),i.loading?e.jsx(j,{children:e.jsx(P,{})}):e.jsx(b,{did:window?.blocklet?.appPid||window?.env?.appPid,children:e.jsx(E,{sx:{maxWidth:"100%",height:"100%"},children:e.jsx(W,{popup:!0,open:!0,className:"connect",action:"exchange-passport",checkFn:t.get,checkTimeout:10*60*1e3,webWalletUrl:r,onSuccess:g,onError:u,locale:h,messages:{title:s("exchangePassport.dialog.title"),scan:s("exchangePassport.dialog.scan"),confirm:s("exchangePassport.dialog.confirm"),success:s("exchangePassport.dialog.success")},extraParams:m,extraContent:null,hideCloseButton:!0})})})}const B=L(_);function G(){const n=S(),r=(o,t)=>{o.sessionToken&&(R(t(o.sessionToken)),U(t(o.refreshToken)))};return e.jsx(B,{SessionContext:I,webWalletUrl:n,onSuccess:r})}export{G as default};
1
+ import{j as e,a6 as P,ak as E}from"./vendor-mui-core-CnXrAOs3.js";import{r as k,i as T}from"./vendor-react-Dvs43sk9.js";import{o as j}from"./vendor-arcblock-CuFtPveO.js";import{V as C,H as d,s as S}from"./vendor-ux-IiQnod3w.js";import{v as W,c as v,S as I,s as R,b as U}from"./index-sNHCLgAE.js";import{K as b}from"./landing-page-sUHYSREd.js";import{w as L}from"./wrap-locale-fIPwg8LW.js";import{g as N}from"./get-safe-url-DpalOXcM.js";import"./vendor-utils-cJEl_UEd.js";import"./vendor-hooks-CjESGRlR.js";import"./lottie-web-4koyQiv_.js";import"./index-x4Yvq15-.js";function _({SessionContext:n,webWalletUrl:r,onSuccess:o}){const{api:t,session:i}=k.useContext(n),{t:s,locale:h}=C(),f=T(),{searchParams:p}=new URL(window.location.href),l=p.get("redirect"),g=async(a,w)=>{o(a,w),await i.refresh(),d.success(s("exchangePassport.success")),setTimeout(()=>{if(l){const c=decodeURIComponent(l);c.startsWith(v.WELLKNOWN_SERVICE_PATH_PREFIX)?f(c,{replace:!0}):window.location.href=N(c)}else window.location.href=window.env.pathPrefix||window.env.apiPrefix||"/"},3e3)},u=a=>{d.error(a.message)},m={},x=p.get("componentId");return x&&(m.componentId=x),i.loading?e.jsx(j,{children:e.jsx(P,{})}):e.jsx(b,{did:window?.blocklet?.appPid||window?.env?.appPid,children:e.jsx(E,{sx:{maxWidth:"100%",height:"100%"},children:e.jsx(W,{popup:!0,open:!0,className:"connect",action:"exchange-passport",checkFn:t.get,checkTimeout:10*60*1e3,webWalletUrl:r,onSuccess:g,onError:u,locale:h,messages:{title:s("exchangePassport.dialog.title"),scan:s("exchangePassport.dialog.scan"),confirm:s("exchangePassport.dialog.confirm"),success:s("exchangePassport.dialog.success")},extraParams:m,extraContent:null,hideCloseButton:!0})})})}const B=L(_);function G(){const n=S(),r=(o,t)=>{o.sessionToken&&(R(t(o.sessionToken)),U(t(o.refreshToken)))};return e.jsx(B,{SessionContext:I,webWalletUrl:n,onSuccess:r})}export{G as default};
@@ -1,4 +1,4 @@
1
- import{D as S,j as o,a6 as B,T,bp as k}from"./vendor-mui-core-CnXrAOs3.js";import{o as M}from"./vendor-arcblock-A4RQuZfN.js";import{V as P,b as F}from"./vendor-ux-RIH1nUSh.js";import{r as w}from"./vendor-react-Dvs43sk9.js";import{l as E}from"./vendor-hooks-OpgB8gyY.js";import{a7 as D,L as I}from"./index-CkTEzTCn.js";import"./vendor-utils-ByKYcWuf.js";import"./lottie-web-4koyQiv_.js";const{Elements:R,PaymentElement:z,useElements:N,useStripe:L,loadStripe:O,LinkAuthenticationElement:V}=globalThis.__STRIPE_COMPONENTS__,W=k("div")`
1
+ import{D as S,j as o,a6 as B,T,bp as k}from"./vendor-mui-core-CnXrAOs3.js";import{o as M}from"./vendor-arcblock-CuFtPveO.js";import{V as P,b as F}from"./vendor-ux-IiQnod3w.js";import{r as w}from"./vendor-react-Dvs43sk9.js";import{l as E}from"./vendor-hooks-CjESGRlR.js";import{a7 as D,L as I}from"./index-sNHCLgAE.js";import"./vendor-utils-cJEl_UEd.js";import"./lottie-web-4koyQiv_.js";const{Elements:R,PaymentElement:z,useElements:N,useStripe:L,loadStripe:O,LinkAuthenticationElement:V}=globalThis.__STRIPE_COMPONENTS__,W=k("div")`
2
2
  width: 100%;
3
3
  opacity: 0;
4
4
  transition: opacity 300ms ease;
@@ -1,4 +1,4 @@
1
- import{a as N,r as o}from"./vendor-react-Dvs43sk9.js";import{j as e,I as w,bi as G,Q as U,bE as H,O as Q,P as $,ai as J,o as Y,M as Z,W as s,z as V,ak as d,a6 as ee,bF as se,aj as te,F as ne,bG as ae}from"./vendor-mui-core-CnXrAOs3.js";import{p as re}from"./vendor-ux-RIH1nUSh.js";import{R as le}from"./required-BGaDOGrj.js";import{F as oe}from"./form-wrapper-C8oo_Fdy.js";import{e as ie}from"./edit.svg-DycWG9v3.js";function B({triggers:l=[],onEnterEdit:n,disabled:p}){const a=N.useRef(null),[h,c]=N.useState(!1),k=r=>{c(!1),r()},C=()=>{c(r=>!r)},i=r=>{a.current&&a.current.contains(r.target)||c(!1)};return l.length===0?e.jsx(w,{"data-cy":"schema-form-item-edit",onClick:n,disabled:p,size:"large",children:e.jsx(ie,{})}):e.jsxs(e.Fragment,{children:[e.jsx(G,{variant:"outlined",ref:a,"aria-label":"split button",children:e.jsx(U,{size:"large","aria-controls":h?"split-button-menu":void 0,"aria-expanded":h?"true":void 0,sx:{paddingLeft:"12px",paddingRight:"12px"},onClick:C,children:e.jsx(H,{})})}),e.jsx(Q,{sx:{zIndex:9999},open:h,anchorEl:a.current,role:void 0,placement:"bottom-end",children:e.jsx($,{children:e.jsx(J,{onClickAway:i,children:e.jsx(Y,{id:"split-button-menu",autoFocusItem:!0,children:l.map(r=>e.jsx(Z,{onClick:()=>k(r.handler),children:r.title},r.key))})})})})]})}B.propTypes={triggers:s.arrayOf(s.shape({key:s.string.isRequired,title:s.string.isRequired,handler:s.func.isRequired})),onEnterEdit:s.func.isRequired,disabled:s.bool.isRequired};const L=(l,n,p)=>l===null&&n&&p?"******":l?n?"******":l:"",ce=ae`
1
+ import{a as N,r as o}from"./vendor-react-Dvs43sk9.js";import{j as e,I as w,bi as G,Q as U,bE as H,O as Q,P as $,ai as J,o as Y,M as Z,W as s,z as V,ak as d,a6 as ee,bF as se,aj as te,F as ne,bG as ae}from"./vendor-mui-core-CnXrAOs3.js";import{p as re}from"./vendor-ux-IiQnod3w.js";import{R as le}from"./required-BGaDOGrj.js";import{F as oe}from"./form-wrapper-C8oo_Fdy.js";import{e as ie}from"./edit.svg-DycWG9v3.js";function B({triggers:l=[],onEnterEdit:n,disabled:p}){const a=N.useRef(null),[h,c]=N.useState(!1),k=r=>{c(!1),r()},C=()=>{c(r=>!r)},i=r=>{a.current&&a.current.contains(r.target)||c(!1)};return l.length===0?e.jsx(w,{"data-cy":"schema-form-item-edit",onClick:n,disabled:p,size:"large",children:e.jsx(ie,{})}):e.jsxs(e.Fragment,{children:[e.jsx(G,{variant:"outlined",ref:a,"aria-label":"split button",children:e.jsx(U,{size:"large","aria-controls":h?"split-button-menu":void 0,"aria-expanded":h?"true":void 0,sx:{paddingLeft:"12px",paddingRight:"12px"},onClick:C,children:e.jsx(H,{})})}),e.jsx(Q,{sx:{zIndex:9999},open:h,anchorEl:a.current,role:void 0,placement:"bottom-end",children:e.jsx($,{children:e.jsx(J,{onClickAway:i,children:e.jsx(Y,{id:"split-button-menu",autoFocusItem:!0,children:l.map(r=>e.jsx(Z,{onClick:()=>k(r.handler),children:r.title},r.key))})})})})]})}B.propTypes={triggers:s.arrayOf(s.shape({key:s.string.isRequired,title:s.string.isRequired,handler:s.func.isRequired})),onEnterEdit:s.func.isRequired,disabled:s.bool.isRequired};const L=(l,n,p)=>l===null&&n&&p?"******":l?n?"******":l:"",ce=ae`
2
2
  0%, 100% {
3
3
  transform: scale(1) translateX(0);
4
4
  }
@@ -1,4 +1,4 @@
1
- import{j as e,ak as s,a6 as w,a$ as B,bd as N,at as v,W as d}from"./vendor-mui-core-CnXrAOs3.js";import{r as l}from"./vendor-react-Dvs43sk9.js";import{C as I}from"./vendor-utils-ByKYcWuf.js";import{p as $}from"./vendor-ux-RIH1nUSh.js";import{l as L,a as E,v as z}from"./index-CkTEzTCn.js";import{W as A}from"./did-address-BxZuOgUQ.js";import{a as D}from"./page-header-DCvzRay5.js";import{S as F}from"./layout-DsLcTLhU.js";import{S as P}from"./step-actions-DPFoKvBN.js";import{S as m}from"./button-Cg6OrnF6.js";import"./vendor-hooks-OpgB8gyY.js";import"./lottie-web-4koyQiv_.js";import"./vendor-arcblock-A4RQuZfN.js";import"./content-layout-oyz1EqNZ.js";import"./use-mobile-DCNBsOlH.js";function R({onNext:n=()=>{},onPrevious:x=()=>{}}){const{locale:u,t}=l.useContext($),{blocklet:a,gas:c,tokenInfo:f,actions:h}=L(),{api:j}=E(),[y,o]=l.useState(!1),{need:p="",current:g="",owe:r=99999,deficiency:k,symbol:b="",endpoint:i}=c||{},{origin:C="/"}=i?new URL(i):{};l.useEffect(()=>{const W=setInterval(()=>{h.refreshFuel()},2e3);return()=>{clearInterval(W)}},[]);const S=()=>{o(!1)};return c?e.jsxs(T,{children:[e.jsx("div",{className:"header",children:e.jsx(D,{title:t("setup.fuel.title"),onClickBack:x})}),e.jsxs(s,{className:"qr-body",children:[e.jsxs(s,{className:"tip",sx:{mb:6},children:[t("setup.fuel.tipStart").replace("slot",""),e.jsx("span",{className:"amount",children:`${p} ${b}`}),t("setup.fuel.tipEnd")]}),e.jsx(s,{sx:{fontSize:16,fontWeight:"fontWeightBold",mb:.5},children:t("setup.fuel.addressTitle")}),e.jsxs(s,{sx:{display:"flex",alignItems:"center"},children:[e.jsx(A,{className:"address",did:a.appDid}),e.jsx(B,{style:{lineHeight:1},target:"_blank",href:I(C,"/explorer/accounts/",a.appDid),underline:"hover",children:e.jsx(N,{className:"icon-launch"})})]}),e.jsx(s,{sx:{my:2},children:e.jsx(m,{color:"primary",onClick:()=>o(!0),disabled:!r,children:t("setup.fuel.fuelApp")})}),e.jsx(z,{popup:!0,open:y,action:"fuel",checkFn:j.get,checkTimeout:10*60*1e3,onSuccess:S,onClose:()=>o(!1),locale:u,messages:{title:t("setup.connect.title"),scan:t("setup.connect.scan"),confirm:t("setup.connect.confirm"),success:t("setup.connect.success")},extraParams:{amount:k,...f,endpoint:i}}),e.jsxs(s,{sx:{display:"flex",color:"text.secondary"},children:[e.jsxs(s,{sx:{display:"flex"},children:[e.jsxs(s,{children:[t("setup.fuel.need"),":"]}),e.jsx(s,{sx:{ml:.5,color:"primary.main",fontWeight:"fontWeightBold"},children:p})]}),e.jsxs(s,{sx:{display:"flex",ml:3},children:[e.jsxs(s,{children:[t("setup.fuel.current"),":"]}),e.jsx(s,{sx:{ml:.5,color:r>0?"error.main":"primary.main",fontWeight:"fontWeightBold"},children:g})]})]})]}),e.jsx(P,{mt:8,children:e.jsx(m,{disabled:r>0,onClick:()=>n(),children:t("setup.next")})})]}):e.jsx(s,{sx:{display:"flex",justifyContent:"center",alignItems:"center",width:"100%"},children:e.jsx(w,{})})}R.propTypes={onNext:d.func,onPrevious:d.func};const T=v(F)`
1
+ import{j as e,ak as s,a6 as w,a$ as B,bd as N,at as v,W as d}from"./vendor-mui-core-CnXrAOs3.js";import{r as l}from"./vendor-react-Dvs43sk9.js";import{C as I}from"./vendor-utils-cJEl_UEd.js";import{p as $}from"./vendor-ux-IiQnod3w.js";import{l as L,a as E,v as z}from"./index-sNHCLgAE.js";import{W as A}from"./did-address-QgOhyegQ.js";import{a as D}from"./page-header-DCvzRay5.js";import{S as F}from"./layout-Ccrs-yyw.js";import{S as P}from"./step-actions-thgNsMmu.js";import{S as m}from"./button-vwR-NYG5.js";import"./vendor-hooks-CjESGRlR.js";import"./lottie-web-4koyQiv_.js";import"./vendor-arcblock-CuFtPveO.js";import"./content-layout-oyz1EqNZ.js";import"./use-mobile-DCNBsOlH.js";function R({onNext:n=()=>{},onPrevious:x=()=>{}}){const{locale:u,t}=l.useContext($),{blocklet:a,gas:c,tokenInfo:f,actions:h}=L(),{api:j}=E(),[y,o]=l.useState(!1),{need:p="",current:g="",owe:r=99999,deficiency:k,symbol:b="",endpoint:i}=c||{},{origin:C="/"}=i?new URL(i):{};l.useEffect(()=>{const W=setInterval(()=>{h.refreshFuel()},2e3);return()=>{clearInterval(W)}},[]);const S=()=>{o(!1)};return c?e.jsxs(T,{children:[e.jsx("div",{className:"header",children:e.jsx(D,{title:t("setup.fuel.title"),onClickBack:x})}),e.jsxs(s,{className:"qr-body",children:[e.jsxs(s,{className:"tip",sx:{mb:6},children:[t("setup.fuel.tipStart").replace("slot",""),e.jsx("span",{className:"amount",children:`${p} ${b}`}),t("setup.fuel.tipEnd")]}),e.jsx(s,{sx:{fontSize:16,fontWeight:"fontWeightBold",mb:.5},children:t("setup.fuel.addressTitle")}),e.jsxs(s,{sx:{display:"flex",alignItems:"center"},children:[e.jsx(A,{className:"address",did:a.appDid}),e.jsx(B,{style:{lineHeight:1},target:"_blank",href:I(C,"/explorer/accounts/",a.appDid),underline:"hover",children:e.jsx(N,{className:"icon-launch"})})]}),e.jsx(s,{sx:{my:2},children:e.jsx(m,{color:"primary",onClick:()=>o(!0),disabled:!r,children:t("setup.fuel.fuelApp")})}),e.jsx(z,{popup:!0,open:y,action:"fuel",checkFn:j.get,checkTimeout:10*60*1e3,onSuccess:S,onClose:()=>o(!1),locale:u,messages:{title:t("setup.connect.title"),scan:t("setup.connect.scan"),confirm:t("setup.connect.confirm"),success:t("setup.connect.success")},extraParams:{amount:k,...f,endpoint:i}}),e.jsxs(s,{sx:{display:"flex",color:"text.secondary"},children:[e.jsxs(s,{sx:{display:"flex"},children:[e.jsxs(s,{children:[t("setup.fuel.need"),":"]}),e.jsx(s,{sx:{ml:.5,color:"primary.main",fontWeight:"fontWeightBold"},children:p})]}),e.jsxs(s,{sx:{display:"flex",ml:3},children:[e.jsxs(s,{children:[t("setup.fuel.current"),":"]}),e.jsx(s,{sx:{ml:.5,color:r>0?"error.main":"primary.main",fontWeight:"fontWeightBold"},children:g})]})]})]}),e.jsx(P,{mt:8,children:e.jsx(m,{disabled:r>0,onClick:()=>n(),children:t("setup.next")})})]}):e.jsx(s,{sx:{display:"flex",justifyContent:"center",alignItems:"center",width:"100%"},children:e.jsx(w,{})})}R.propTypes={onNext:d.func,onPrevious:d.func};const T=v(F)`
2
2
  .qr-body {
3
3
  width: 580px;
4
4
  ${n=>n.theme.breakpoints.down("md")} {
@@ -1 +1 @@
1
- import{D as E,j as e,Q as S,b3 as P,b0 as R,ak as r,T as c,a6 as _}from"./vendor-mui-core-CnXrAOs3.js";import{a as I,R as L,c as N,t as p,T,U}from"./index-CkTEzTCn.js";import{o as W}from"./vendor-arcblock-A4RQuZfN.js";import{p as A}from"./vendor-ux-RIH1nUSh.js";import{g as D,b as w}from"./vendor-hooks-OpgB8gyY.js";import{i as z,r as i,u as F}from"./vendor-react-Dvs43sk9.js";import{K as a}from"./landing-page-BBuNoMf2.js";import{C as K}from"./vendor-utils-ByKYcWuf.js";import{u as M}from"./use-window-close-CmeMvKPG.js";import"./lottie-web-4koyQiv_.js";function Z(){const m=z(),l=i.useRef(null),{t:s,locale:d}=i.useContext(A),{api:x,connectApi:f}=I(),[h]=F(),j=E(),k=M(),n=D({ready:!1,success:!1,error:null,invalidSession:!1}),b=()=>{try{const t=new URL(window.location.href);if(t.hash.includes("invalid")){n.invalidSession=!0;return}const u=t.searchParams.get("__connect_url__"),v=T(u);if(!U(v))throw new Error("No token");n.ready=!0}catch{n.invalidSession=!0,m("#invalid",{replace:!0})}};i.useLayoutEffect(()=>b(),[]);const C=w(t=>{n.error=t.message,window.opener?.postMessage({type:"connect-endpoint-message",error:n.error},"*"),m("#invalid",{replace:!0})}),g=w(()=>{window.opener?.postMessage({type:"connect-endpoint-message",success:!0},"*"),n.success=!0}),o=h.get("source")||"Generate Access Key";i.useEffect(()=>{l.current&&n.ready&&f.open({locale:d,containerEl:l.current,action:"gen-access-key",extraParams:{remark:o},checkFn:x.get,saveConnect:!1,forceConnected:!1,className:"connect",popup:!1,baseUrl:window.location.origin,prefix:K(window.location.origin,N.WELLKNOWN_SERVICE_PATH_PREFIX,L),messages:{title:s("connectCli.title"),scan:s("connectCli.scan"),confirm:s("auth.confirm"),success:s("connectCli.success")},onSuccess:g,onError:C},{locale:d})},[f,n.ready,x,C,g,d,s,o]);const y=e.jsx(S,{variant:"outlined",color:"primary",size:"small",startIcon:e.jsx(P,{}),href:"/",style:{borderRadius:4},children:s("connectCli.home")});if(n.invalidSession)return e.jsx(a,{did:window.blocklet?.appPid,standalone:!0,children:e.jsx(p,{style:{backgroundColor:"transparent"},status:"error",title:s("connectCli.invalidSession"),description:s("connectCli.invalidSessionDesc"),extra:y})},"invalid");if(n.error){const t=n.error,u=y;return e.jsx(a,{did:window.blocklet?.appPid,standalone:!0,children:e.jsx(p,{style:{backgroundColor:"transparent"},status:"error",title:s("connectCli.connectionError"),description:t,extra:u})},"error")}return n.success?(h.has("closeOnSuccess")&&k(),e.jsx(a,{did:window.blocklet?.appPid,standalone:!0,children:e.jsx(p,{style:{backgroundColor:"transparent"},status:"info",icon:e.jsx(R,{style:{color:j.palette.success.main,fontSize:72}}),title:s("connectCli.success",{source:o}),description:`${s("connectCli.successDesc",{source:o})} ${s("connectCli.upload")}`})},"success")):n.ready?e.jsx(a,{did:window.blocklet?.appPid,standalone:!0,children:e.jsxs(r,{sx:{maxWidth:"100%",height:"100%"},children:[e.jsxs(r,{sx:{mb:5},children:[e.jsx(c,{variant:"h4",component:"h1",sx:{mb:1,fontWeight:"bold",textAlign:"center"},children:s("connectCli.tips.title")}),e.jsxs(r,{sx:{display:"flex",flexDirection:"column",gap:1,alignItems:"center"},children:[e.jsx(c,{sx:{color:"text.secondary"},children:s("connectCli.tips.item1")}),e.jsx(c,{sx:{color:"text.secondary"},children:s("connectCli.tips.item2")}),e.jsx(c,{sx:{color:"text.secondary"},children:s("connectCli.tips.item3")})]})]}),e.jsx(r,{sx:{display:"inline-block"},ref:l})]})},"ready"):e.jsx(W,{children:e.jsx(_,{})})}export{Z as default};
1
+ import{D as E,j as e,Q as S,b3 as P,b0 as R,ak as r,T as c,a6 as _}from"./vendor-mui-core-CnXrAOs3.js";import{a as I,R as L,c as N,t as p,T,U}from"./index-sNHCLgAE.js";import{o as W}from"./vendor-arcblock-CuFtPveO.js";import{p as A}from"./vendor-ux-IiQnod3w.js";import{g as D,b as w}from"./vendor-hooks-CjESGRlR.js";import{i as z,r as i,u as F}from"./vendor-react-Dvs43sk9.js";import{K as a}from"./landing-page-sUHYSREd.js";import{C as K}from"./vendor-utils-cJEl_UEd.js";import{u as M}from"./use-window-close-BgT_dImc.js";import"./lottie-web-4koyQiv_.js";function Z(){const m=z(),l=i.useRef(null),{t:s,locale:d}=i.useContext(A),{api:x,connectApi:f}=I(),[h]=F(),j=E(),k=M(),n=D({ready:!1,success:!1,error:null,invalidSession:!1}),b=()=>{try{const t=new URL(window.location.href);if(t.hash.includes("invalid")){n.invalidSession=!0;return}const u=t.searchParams.get("__connect_url__"),v=T(u);if(!U(v))throw new Error("No token");n.ready=!0}catch{n.invalidSession=!0,m("#invalid",{replace:!0})}};i.useLayoutEffect(()=>b(),[]);const C=w(t=>{n.error=t.message,window.opener?.postMessage({type:"connect-endpoint-message",error:n.error},"*"),m("#invalid",{replace:!0})}),g=w(()=>{window.opener?.postMessage({type:"connect-endpoint-message",success:!0},"*"),n.success=!0}),o=h.get("source")||"Generate Access Key";i.useEffect(()=>{l.current&&n.ready&&f.open({locale:d,containerEl:l.current,action:"gen-access-key",extraParams:{remark:o},checkFn:x.get,saveConnect:!1,forceConnected:!1,className:"connect",popup:!1,baseUrl:window.location.origin,prefix:K(window.location.origin,N.WELLKNOWN_SERVICE_PATH_PREFIX,L),messages:{title:s("connectCli.title"),scan:s("connectCli.scan"),confirm:s("auth.confirm"),success:s("connectCli.success")},onSuccess:g,onError:C},{locale:d})},[f,n.ready,x,C,g,d,s,o]);const y=e.jsx(S,{variant:"outlined",color:"primary",size:"small",startIcon:e.jsx(P,{}),href:"/",style:{borderRadius:4},children:s("connectCli.home")});if(n.invalidSession)return e.jsx(a,{did:window.blocklet?.appPid,standalone:!0,children:e.jsx(p,{style:{backgroundColor:"transparent"},status:"error",title:s("connectCli.invalidSession"),description:s("connectCli.invalidSessionDesc"),extra:y})},"invalid");if(n.error){const t=n.error,u=y;return e.jsx(a,{did:window.blocklet?.appPid,standalone:!0,children:e.jsx(p,{style:{backgroundColor:"transparent"},status:"error",title:s("connectCli.connectionError"),description:t,extra:u})},"error")}return n.success?(h.has("closeOnSuccess")&&k(),e.jsx(a,{did:window.blocklet?.appPid,standalone:!0,children:e.jsx(p,{style:{backgroundColor:"transparent"},status:"info",icon:e.jsx(R,{style:{color:j.palette.success.main,fontSize:72}}),title:s("connectCli.success",{source:o}),description:`${s("connectCli.successDesc",{source:o})} ${s("connectCli.upload")}`})},"success")):n.ready?e.jsx(a,{did:window.blocklet?.appPid,standalone:!0,children:e.jsxs(r,{sx:{maxWidth:"100%",height:"100%"},children:[e.jsxs(r,{sx:{mb:5},children:[e.jsx(c,{variant:"h4",component:"h1",sx:{mb:1,fontWeight:"bold",textAlign:"center"},children:s("connectCli.tips.title")}),e.jsxs(r,{sx:{display:"flex",flexDirection:"column",gap:1,alignItems:"center"},children:[e.jsx(c,{sx:{color:"text.secondary"},children:s("connectCli.tips.item1")}),e.jsx(c,{sx:{color:"text.secondary"},children:s("connectCli.tips.item2")}),e.jsx(c,{sx:{color:"text.secondary"},children:s("connectCli.tips.item3")})]})]}),e.jsx(r,{sx:{display:"inline-block"},ref:l})]})},"ready"):e.jsx(W,{children:e.jsx(_,{})})}export{Z as default};
@@ -0,0 +1 @@
1
+ import{j as e,ak as a,T as y,a6 as M,b1 as X,Q as O,a$ as Y,D as Z,aX as F,bU as K,b0 as ee}from"./vendor-mui-core-CnXrAOs3.js";import{r as d,i as se,u as ne}from"./vendor-react-Dvs43sk9.js";import{M as te,ar as oe,as as re,at as ie,ax as ae,a as ce,d as le,T as $,t as ue,ay as de,c as pe}from"./index-sNHCLgAE.js";import{n as v,U as he,C as W}from"./vendor-utils-cJEl_UEd.js";import{g as J,b as p,n as xe,o as fe}from"./vendor-hooks-CjESGRlR.js";import{M as H,V as Q,I as ge,o as G,D as me}from"./vendor-ux-IiQnod3w.js";import{o as je}from"./vendor-arcblock-CuFtPveO.js";import{K as ye}from"./landing-page-sUHYSREd.js";import{u as we}from"./use-window-close-BgT_dImc.js";import"./lottie-web-4koyQiv_.js";function Ce({requestAppInfo:l,currentAppInfo:w}){return e.jsxs(a,{sx:{textAlign:"center",display:"flex",flexDirection:"column",alignItems:"center",gap:2},children:[e.jsxs(a,{sx:{display:"flex",alignItems:"center",justifyContent:"center"},children:[e.jsx(H,{src:w.appLogo,alt:"Server",width:48,height:48,useProxyFallback:!0}),e.jsxs(a,{sx:{mx:2,display:"flex",alignItems:"center","& .dot":{width:8,height:8,borderRadius:"50%",bgcolor:"grey.500",mx:.5}},children:[e.jsx(a,{className:"dot"}),e.jsx(a,{className:"dot"}),e.jsx(a,{className:"dot"})]}),e.jsx(H,{src:l.appLogo,alt:l.appName,width:48,height:48,useProxyFallback:!0})]}),e.jsxs(y,{sx:{mb:1,fontSize:"1.2rem"},children:["Authorize"," ",e.jsx(a,{component:"span",sx:{color:"primary.main"},children:l.appName})]})]})}const Ae={en:{notThis:"Not you?",useAnother:"Use another account",authorize:"Authorize",connect:"Connect",cancel:"Cancel"},zh:{notThis:"不是这个?",useAnother:"使用其他账户",authorize:"授权",connect:"Connect",cancel:"取消"}};function Se({session:l,requestAppInfo:w,currentAppInfo:z,children:k=null,userInfo:s=void 0,hideSwitchConnect:N=!1,hideAuthorize:t=!1,hideCancel:L=!1,hideButton:T=!1,notThisText:I=void 0,authorizeText:o=void 0,connectText:c=void 0,cancelText:P=void 0,useAnotherText:C=void 0,slotProps:h=void 0,onConnect:R=v,onAuthorize:f=v,onSwitchConnect:_=v,onSwitchPassport:A=v,onCancel:U=v,ref:D,disableAuthorizeButton:b=!1}){const r=J({loading:!1}),{locale:S="en"}=Q()||{},g=p((B,j={})=>ge(Ae,B,S,"en",j)),x=p(()=>{r.loading=!1}),E=p(()=>{r.loading=!0,R?.(x)}),q=p(()=>{r.loading=!0,_?.(x)}),n=p(()=>{r.loading=!0,f?.(x)}),i=p(()=>{r.loading=!0,A?.(x)}),u=p(()=>{U?.()});if(d.useImperativeHandle(D,()=>({closeLoading:x})),l.loading||!l.initialized)return e.jsx(je,{children:e.jsx(M,{})});const m=s??l?.user;return e.jsx(ye,{did:window.blocklet?.appPid,standalone:!0,children:e.jsx(a,{...h?.root,sx:G({width:420,maxWidth:"100%"},h?.root?.sx),children:e.jsx(te,{hideCloseButton:!0,...h?.didConnectContainer,children:e.jsxs(a,{...h?.contentContainer,sx:G({display:"flex",flexDirection:"column",gap:1.5,p:{xs:2,lg:3,xl:4},pt:{xs:3,xl:4},bgcolor:"background.paper"},h?.contentContainer?.sx),children:[e.jsx(Ce,{requestAppInfo:w,currentAppInfo:z}),m?e.jsxs(e.Fragment,{children:[e.jsx(oe,{user:m,showDid:!0,cardType:ie.Detailed,infoType:re.Minimal,renderTopRightContent:()=>e.jsx(ae,{user:m,switchPassport:i})}),e.jsx(a,{})]}):null,k,T?null:e.jsxs(e.Fragment,{children:[e.jsx(a,{sx:{border:"1px solid",borderColor:"divider",borderRadius:2,overflow:"hidden",my:1}}),e.jsxs(X,{direction:"row",spacing:2,children:[L?null:e.jsx(O,{color:"inherit",variant:"outlined",size:"large",fullWidth:!0,onClick:u,sx:{color:"grey.500"},children:P||g("cancel")}),m&&!t?e.jsxs(O,{variant:"contained",size:"large",fullWidth:!0,onClick:n,disabled:r.loading||b,children:[r.loading?e.jsx(M,{size:20,sx:{mr:1}}):null,o||g("authorize")]}):e.jsxs(O,{variant:"contained",size:"large",fullWidth:!0,disabled:r.loading||b,onClick:E,children:[r.loading?e.jsx(M,{size:20,sx:{mr:1}}):null,c||g("connect")]})]})]}),N||!m?null:e.jsx(a,{sx:{textAlign:"center"},children:e.jsxs(y,{variant:"body2",sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:1},children:[I||g("notThis")," ",e.jsx(Y,{underline:"hover",onClick:q,sx:{cursor:"pointer"},children:C||g("useAnother")})]})})]})})})})}const ve=W(window.location.origin,pe.WELLKNOWN_BLOCKLET_USER_PATH,"settings#user-center-access-key-setting"),V=3e3;function Ue(){const l=d.useRef(null),[w,z]=d.useState(),[k]=xe({targetDate:w}),{session:s}=ce(),N=Z(),t=J({ready:!1,success:!1,error:null,invalidSession:!1,token:null}),[L,T]=fe("currentUserInfo",{defaultValue:null}),I=se(),{t:o}=Q(),[c]=ne(),P=we(),[,C]=d.useState(!0),[h,R]=d.useState({appName:c.get("cli")?c.get("appName")??o("aigne.cli"):"",appLogo:c.get("cli")?c.get("appLogo"):""}),f=c.get("required_roles")||"",_=d.useMemo(()=>{const n=f.split(",")||[];if(n.length===0)return n;const i=he([s.user?.role,(s.user?.passports||[]).map(u=>u.role)].flat().filter(Boolean));return i.length===0?i:n.filter(u=>i.includes(u.toLocaleLowerCase().trim()))},[s.user,f]),A=_.join(","),U=s.user&&f?_.length>0:!0,D=async()=>{C(!0);try{const n=c.get("__url__"),i=n?$(n):null;if(!i){C(!1);return}const u="__blocklet__.js?type=json",B=new URL(i).origin,{data:j}=await de.get(W(B,u));R({appName:j?.appName,appUrl:j?.appUrl,appLogo:W(j?.appUrl,j?.appLogo)})}catch(n){console.error(n)}finally{C(!1)}};d.useEffect(()=>{s.user&&T(s.user)},[s.user]);const b=()=>{D(),s.user&&T(s.user);try{const n=new URL(window.location.href);if(n.hash.includes("invalid")){t.invalidSession=!0;return}const i=n.searchParams.get("__token__"),u=i?$(i):null;if(!u)throw new Error("No token");t.token=u,t.ready=!0}catch(n){t.invalidSession=!0,t.error=n.message,window.opener?.postMessage({type:"connect-aigne-message",error:n.message},"*"),I("#invalid",{replace:!0})}};d.useLayoutEffect(()=>b(),[]);const r=window.blocklet,S=c.get("source")||"Generate Access Key",g=p(async n=>{try{await le.post("/access-key/authorize",{source:S,sid:t.token,requiredRoles:A}),t.success=!0,window.opener?.postMessage({type:"connect-aigne-message",success:!0},"*"),c.has("closeOnSuccess")&&(z(Date.now()+V),setTimeout(()=>P(),V))}catch(i){console.error(i)}finally{n()}}),x=p(()=>{s.login()}),E=p(()=>{window.close()});d.useEffect(()=>{s.initialized&&!s.user&&(me()||x())},[s?.user,s?.initialized,x]),d.useEffect(()=>{s.open||l.current?.closeLoading?.()},[s.open]);const q=()=>t.error?e.jsxs(F,{severity:"error",children:[e.jsx(K,{children:o("aigne.notAuthorized")}),t.error]}):t.success?e.jsx(ue,{style:{backgroundColor:"transparent"},status:"info",icon:e.jsx(ee,{style:{color:N.palette.success.main,fontSize:72}}),title:o("connectCli.success",{source:S}),description:`${o("connectCli.successDesc",{source:S})} ${c.has("closeOnSuccess")?o("connectCli.closeDelay",{seconds:Math.ceil(k/1e3)}):""}`}):e.jsxs(F,{severity:"info",children:[e.jsx(K,{children:o("aigne.connectTo",{appName:r.appName})}),f&&e.jsx(y,{component:"li",variant:"body2",children:A?o("aigne.accessTips.switchPassport",{required_roles:A}):o("aigne.accessTips.switchPassportRequired",{required_roles:f})}),e.jsx(y,{component:"li",variant:"body2",children:o("aigne.accessTips.tips1",{appName:h.appName,accessAppName:r.appName})}),e.jsx(y,{component:"li",variant:"body2",children:o("aigne.accessTips.tips2",{appName:h.appName})}),e.jsx(y,{component:"li",variant:"body2",sx:{"& a":{color:"inherit",textDecoration:"underline"}},dangerouslySetInnerHTML:{__html:o("aigne.accessTips.tips3",{url:ve,accessAppName:r.appName})}})]});return e.jsx(Se,{ref:l,session:s,requestAppInfo:h,currentAppInfo:r,userInfo:L,onAuthorize:g,onConnect:x,onSwitchConnect:s.switchDid,onCancel:E,hideAuthorize:!!t.error,hideSwitchConnect:t.success,hideButton:t.success,authorizeText:o("common.approve"),onSwitchPassport:s.switchDid,slotProps:{root:{sx:{width:500}}},disableAuthorizeButton:!U,children:q()})}export{Ue as default};
@@ -0,0 +1 @@
1
+ import{Q as t}from"./index-sNHCLgAE.js";import{H as e}from"./vendor-ux-IiQnod3w.js";function c(...o){try{return t(...o)}catch(r){throw e.error("Invalid redirect url"),console.error("Invalid redirect url",r),r}}export{c as g};
@@ -1 +1 @@
1
- import{j as o,b1 as n}from"./vendor-mui-core-CnXrAOs3.js";import{L as r}from"./vendor-react-Dvs43sk9.js";import{n as i}from"./vendor-ux-RIH1nUSh.js";import{c as t}from"./index-CkTEzTCn.js";import{S as e}from"./studio-CEsaMQhd.js";import"./vendor-utils-ByKYcWuf.js";import"./vendor-hooks-OpgB8gyY.js";import"./lottie-web-4koyQiv_.js";import"./vendor-arcblock-A4RQuZfN.js";import"./index-CRlbskWD.js";function L(){return o.jsx(e,{children:o.jsxs(n,{direction:"row",spacing:2,sx:{m:4},children:[o.jsx(i,{component:r,to:`${t.WELLKNOWN_SERVICE_PATH_PREFIX}/studio/preferences`,size:"large",color:"primary",variant:"outlined",children:"Preference Builder"}),o.jsx(i,{component:r,to:`${t.WELLKNOWN_SERVICE_PATH_PREFIX}/studio/branding`,size:"large",color:"primary",variant:"outlined",children:"Branding Images"}),o.jsx(i,{component:r,to:`${t.WELLKNOWN_SERVICE_PATH_PREFIX}/studio/localization`,size:"large",color:"primary",variant:"outlined",children:"Localization"})]})})}export{L as default};
1
+ import{j as o,b1 as n}from"./vendor-mui-core-CnXrAOs3.js";import{L as r}from"./vendor-react-Dvs43sk9.js";import{n as i}from"./vendor-ux-IiQnod3w.js";import{c as t}from"./index-sNHCLgAE.js";import{S as e}from"./studio-Ceq7d-nC.js";import"./vendor-utils-cJEl_UEd.js";import"./vendor-hooks-CjESGRlR.js";import"./lottie-web-4koyQiv_.js";import"./vendor-arcblock-CuFtPveO.js";import"./index-C45ih46D.js";function L(){return o.jsx(e,{children:o.jsxs(n,{direction:"row",spacing:2,sx:{m:4},children:[o.jsx(i,{component:r,to:`${t.WELLKNOWN_SERVICE_PATH_PREFIX}/studio/preferences`,size:"large",color:"primary",variant:"outlined",children:"Preference Builder"}),o.jsx(i,{component:r,to:`${t.WELLKNOWN_SERVICE_PATH_PREFIX}/studio/branding`,size:"large",color:"primary",variant:"outlined",children:"Branding Images"}),o.jsx(i,{component:r,to:`${t.WELLKNOWN_SERVICE_PATH_PREFIX}/studio/localization`,size:"large",color:"primary",variant:"outlined",children:"Localization"})]})})}export{L as default};
@@ -1 +1 @@
1
- import{a as E}from"./vendor-react-Dvs43sk9.js";import{a4 as L}from"./index-CkTEzTCn.js";const $=({url:r,allowFullScreen:o,position:a,display:i,height:u,width:y,overflow:c,styles:f,onLoad:p,onMouseOver:m,onMouseOut:w,scrolling:b,id:d,frameBorder:n,ariaHidden:O,sandbox:s,allow:j,className:g,title:h,ariaLabel:k,ariaLabelledby:P,name:v,target:A,loading:F,importance:I,referrerpolicy:M,allowpaymentrequest:S,src:q,key:x})=>{const t=L({src:q||r,target:A||null,style:{position:a||null,display:i||"initial",overflow:c||null},scrolling:b||null,allowpaymentrequest:S||null,importance:I||null,sandbox:s&&[...s].join(" ")||null,loading:F||null,styles:f||null,name:v||null,className:g||null,allowFullScreen:"allowFullScreen",referrerpolicy:M||null,title:h||null,allow:j||null,id:d||null,"aria-labelledby":P||null,"aria-hidden":O||null,"aria-label":k||null,width:y||null,height:u||null,onLoad:p||null,onMouseOver:m||null,onMouseOut:w||null,key:x||"iframe"});let l=Object.create(null);for(let e of Object.keys(t))t[e]!=null&&(l[e]=t[e]);for(let e of Object.keys(l.style))l.style[e]==null&&delete l.style[e];if(l.styles)for(let e of Object.keys(l.styles))l.styles.hasOwnProperty(e)&&(l.style[e]=l.styles[e]),Object.keys(l.styles).pop()==e&&delete l.styles;if(o)if("allow"in l){const e=l.allow.replace("fullscreen","");l.allow=`fullscreen ${e.trim()}`.trim()}else l.allow="fullscreen";return n>=0&&(l.style.hasOwnProperty("border")||(l.style.border=n)),E.createElement("iframe",Object.assign({},l))};export{$ as I};
1
+ import{a as E}from"./vendor-react-Dvs43sk9.js";import{a4 as L}from"./index-sNHCLgAE.js";const $=({url:r,allowFullScreen:o,position:a,display:i,height:u,width:y,overflow:c,styles:f,onLoad:p,onMouseOver:m,onMouseOut:w,scrolling:b,id:d,frameBorder:n,ariaHidden:O,sandbox:s,allow:j,className:g,title:h,ariaLabel:k,ariaLabelledby:P,name:v,target:A,loading:F,importance:I,referrerpolicy:M,allowpaymentrequest:S,src:q,key:x})=>{const t=L({src:q||r,target:A||null,style:{position:a||null,display:i||"initial",overflow:c||null},scrolling:b||null,allowpaymentrequest:S||null,importance:I||null,sandbox:s&&[...s].join(" ")||null,loading:F||null,styles:f||null,name:v||null,className:g||null,allowFullScreen:"allowFullScreen",referrerpolicy:M||null,title:h||null,allow:j||null,id:d||null,"aria-labelledby":P||null,"aria-hidden":O||null,"aria-label":k||null,width:y||null,height:u||null,onLoad:p||null,onMouseOver:m||null,onMouseOut:w||null,key:x||"iframe"});let l=Object.create(null);for(let e of Object.keys(t))t[e]!=null&&(l[e]=t[e]);for(let e of Object.keys(l.style))l.style[e]==null&&delete l.style[e];if(l.styles)for(let e of Object.keys(l.styles))l.styles.hasOwnProperty(e)&&(l.style[e]=l.styles[e]),Object.keys(l.styles).pop()==e&&delete l.styles;if(o)if("allow"in l){const e=l.allow.replace("fullscreen","");l.allow=`fullscreen ${e.trim()}`.trim()}else l.allow="fullscreen";return n>=0&&(l.style.hasOwnProperty("border")||(l.style.border=n)),E.createElement("iframe",Object.assign({},l))};export{$ as I};