@abtnode/blocklet-services 1.17.0-beta-20251105-000053-53e6e3e9 → 1.17.0-beta-20251105-030013-0c24dbf6

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 (168) hide show
  1. package/dist/assets/{AdapterDayjs-Dxut8SOC.js → AdapterDayjs-B-b5_b14.js} +1 -1
  2. package/dist/assets/{Google-BcAmgU5I.js → Google-CxaAXeb1.js} +1 -1
  3. package/dist/assets/{access-control-DeRZmmHW.js → access-control-C3aWCG0W.js} +1 -1
  4. package/dist/assets/{add-component-core-CB3Z_tio.js → add-component-core-CRqEjYc1.js} +1 -1
  5. package/dist/assets/{add-resource-CCTsswQz.js → add-resource-Kud8H4eS.js} +1 -1
  6. package/dist/assets/{addon-CQMBWXij.js → addon-VZzbFc4Q.js} +1 -1
  7. package/dist/assets/{advanced-DwXInVBG.js → advanced-DwN5K1Ff.js} +1 -1
  8. package/dist/assets/{aigne-DHc1tJm6.js → aigne-vtnawws9.js} +1 -1
  9. package/dist/assets/api-BNrHV6cZ.js +1 -0
  10. package/dist/assets/{appearance-CvCbU39V.js → appearance-DYn7payW.js} +1 -1
  11. package/dist/assets/{arrow-down.svg-DYdzNpAQ.js → arrow-down.svg-BezS4XZA.js} +1 -1
  12. package/dist/assets/{audit-logs-5mTYZKV1.js → audit-logs-ranSELEi.js} +1 -1
  13. package/dist/assets/{authorize-BfkXf6G0.js → authorize-BNjP0AT6.js} +1 -1
  14. package/dist/assets/{base-chart-C-Raz4Q-.js → base-chart-CPiuDOeg.js} +1 -1
  15. package/dist/assets/{base32-BozpD0f9.js → base32-Cb13w5RY.js} +1 -1
  16. package/dist/assets/{bind-account-BC8VQXvm.js → bind-account-CjXV1Nno.js} +1 -1
  17. package/dist/assets/branding-BEu6Nivw.js +1 -0
  18. package/dist/assets/{branding-7XUcxGmI.js → branding-QC85gvgZ.js} +1 -1
  19. package/dist/assets/{branding-DV5KIxNj.js → branding-yaaSBVab.js} +1 -1
  20. package/dist/assets/{bundle-avatar-Edt0e34F.js → bundle-avatar-4eBexs7E.js} +1 -1
  21. package/dist/assets/{button-CubXLpb7.js → button-DEB1ikxx.js} +1 -1
  22. package/dist/assets/{click-to-copy-BoG45bWR.js → click-to-copy-D0Tma2zF.js} +1 -1
  23. package/dist/assets/{cloneDeep-C6qewg0C.js → cloneDeep-D_w1MBt4.js} +1 -1
  24. package/dist/assets/{complete--uTpwi8F.js → complete-DStPKf0Q.js} +1 -1
  25. package/dist/assets/{component-BVl40muz.js → component-CWCG4qb4.js} +2 -2
  26. package/dist/assets/{config-B6xx5Ruh.js → config-C7oNdxEU.js} +1 -1
  27. package/dist/assets/{config-dsw6u7QS.js → config-DdMgBHpi.js} +1 -1
  28. package/dist/assets/{config-navigation-DFyttFiT.js → config-navigation-w_sixXn5.js} +2 -2
  29. package/dist/assets/{config-space-0Usu_97A.js → config-space-CT4_9rp4.js} +1 -1
  30. package/dist/assets/{config-D9zrtkNt.js → config-yPiuiId6.js} +4 -4
  31. package/dist/assets/{confirm-DK89V84H.js → confirm-BCfyUWCf.js} +1 -1
  32. package/dist/assets/{connect-CxECECho.js → connect-BBC5ABRw.js} +1 -1
  33. package/dist/assets/{connect-CfMU05qb.js → connect-BLGYXo3k.js} +1 -1
  34. package/dist/assets/{connect-to-DRAd7i9J.js → connect-to-C7YGs17H.js} +1 -1
  35. package/dist/assets/{create-passport-svg-CUotftEJ.js → create-passport-svg-CER2V7n5.js} +1 -1
  36. package/dist/assets/{createClass-D2cbgKRl.js → createClass-BTAbWc4O.js} +1 -1
  37. package/dist/assets/{dashboard-C9Qtd5rI.js → dashboard-D7oMAKNq.js} +2 -2
  38. package/dist/assets/{delete-confirm-Bwhg916Y.js → delete-confirm-D-BcbVbX.js} +1 -1
  39. package/dist/assets/{did-address-6rS8aBAV.js → did-address-CIq-nlk0.js} +1 -1
  40. package/dist/assets/{domain-D55gMP_T.js → domain-CDlbT513.js} +1 -1
  41. package/dist/assets/{domain-action-card-BZKoL_Hh.js → domain-action-card-CE5CNtpq.js} +1 -1
  42. package/dist/assets/domains-CPMJY1aF.js +1 -0
  43. package/dist/assets/{email-lJEVkuhh.js → email-PGVxLLOt.js} +1 -1
  44. package/dist/assets/engine-D5u6S-6w.js +1 -0
  45. package/dist/assets/{exchange-passport-O8PN-vEa.js → exchange-passport-B3E8SgcT.js} +1 -1
  46. package/dist/assets/{form-HILzmtS4.js → form-5Ep-D-hL.js} +1 -1
  47. package/dist/assets/{form-text-input-DVzTem6p.js → form-text-input-DQaRIPYf.js} +1 -1
  48. package/dist/assets/{fuel-9ToDglZ4.js → fuel-BAcphlwQ.js} +1 -1
  49. package/dist/assets/{gen-access-key-RAY3R1wL.js → gen-access-key-tmiL6HEK.js} +1 -1
  50. package/dist/assets/{gen-simple-access-key-CPyew41i.js → gen-simple-access-key-BtZeyFUU.js} +1 -1
  51. package/dist/assets/get-safe-url-BJvKfOW0.js +1 -0
  52. package/dist/assets/{home-C6yH6iXB.js → home-kCW65EFx.js} +1 -1
  53. package/dist/assets/{iframe-CHUN17ve.js → iframe-DXyZAOxC.js} +1 -1
  54. package/dist/assets/{index-DcnBbXEh.js → index-3fEKnvhn.js} +1 -1
  55. package/dist/assets/{index-CktHtJue.js → index-B-kQtv91.js} +1 -1
  56. package/dist/assets/{index-e_3-iMyP.js → index-BBLMdRjh.js} +1 -1
  57. package/dist/assets/{index-FbQLWg2H.js → index-BBPJehPD.js} +1 -1
  58. package/dist/assets/{index-BymvP8Hj.js → index-BGOAuSiO.js} +1 -1
  59. package/dist/assets/{index-Dh2Rf2Hx.js → index-BGm4_k5i.js} +3 -3
  60. package/dist/assets/{index-NomqB6Iy.js → index-BM4g9p9K.js} +1 -1
  61. package/dist/assets/{index-Bp_5Qnng.js → index-BONnU4i4.js} +1 -1
  62. package/dist/assets/{index-BcSuA3_M.js → index-BUUnz9gZ.js} +1 -1
  63. package/dist/assets/{index-Be2S1b8R.js → index-BaE8Lb4N.js} +1 -1
  64. package/dist/assets/{index-B2BVBFP1.js → index-BoYypJBw.js} +1 -1
  65. package/dist/assets/{index-BAxVZet9.js → index-C-_gU_Fe.js} +1 -1
  66. package/dist/assets/{index-BSauF6RI.js → index-C6NMt-mL.js} +1 -1
  67. package/dist/assets/index-C6cUmsAO.js +63 -0
  68. package/dist/assets/{index-B_LOh3-7.js → index-CDeFKxFp.js} +1 -1
  69. package/dist/assets/{index-R_6vOn5c.js → index-CEbaUWs9.js} +1 -1
  70. package/dist/assets/{index-B8wgXU-M.js → index-CNQc5Pv0.js} +3 -3
  71. package/dist/assets/{index-BDVkvtSV.js → index-CPenNsCA.js} +1 -1
  72. package/dist/assets/{index-BDgx7EkS.js → index-CRrvw28E.js} +2 -2
  73. package/dist/assets/{index-CyALrDx6.js → index-CWM6CeCJ.js} +1 -1
  74. package/dist/assets/{index-C5W1sNxF.js → index-CaN6T62E.js} +3 -3
  75. package/dist/assets/{index-BYHO9_8F.js → index-CafgPOrl.js} +1 -1
  76. package/dist/assets/{index-CRtYD69s.js → index-Cor3Ch2R.js} +1 -1
  77. package/dist/assets/{index-qu80tqs0.js → index-Cu5G_kkl.js} +1 -1
  78. package/dist/assets/{index-CsYbXfj1.js → index-CuHHEyaf.js} +1 -1
  79. package/dist/assets/{index-B-XlfvkZ.js → index-CvqAqbTY.js} +131 -129
  80. package/dist/assets/{index-Crh53cke.js → index-DWh4QrB6.js} +1 -1
  81. package/dist/assets/{index-ChdnEUnd.js → index-DlBn_nkP.js} +1 -1
  82. package/dist/assets/{index-CHVQCEyp.js → index-DuUAY6sJ.js} +1 -1
  83. package/dist/assets/{index-Bdfvhhor.js → index-DwJ0PXgi.js} +1 -1
  84. package/dist/assets/{index-yi6WvhoN.js → index-OfvA4Ihw.js} +1 -1
  85. package/dist/assets/{index-DIx7BUTi.js → index-Qoz8CAva.js} +1 -1
  86. package/dist/assets/{invitation-BZCAm4go.js → invitation-Bo7he7gn.js} +1 -1
  87. package/dist/assets/{invitations-DOKvWh-D.js → invitations-JBUEZ62G.js} +1 -1
  88. package/dist/assets/{invite-_7I-iD9F.js → invite-CDIjLBXY.js} +1 -1
  89. package/dist/assets/{isURL-shHw2FLx.js → isURL-CwakGHMn.js} +1 -1
  90. package/dist/assets/{issue-passport-4Pjg5_J2.js → issue-passport-Bx1Kkdgv.js} +1 -1
  91. package/dist/assets/{item-DWQamqmG.js → item-BIsnfFrn.js} +1 -1
  92. package/dist/assets/{landing-page-DHzhfnIo.js → landing-page-Befk8WNO.js} +1 -1
  93. package/dist/assets/{layout-1j-FirqT.js → layout-jQm-DzbI.js} +1 -1
  94. package/dist/assets/{list-GFQ23C96.js → list-CGYVFvl-.js} +1 -1
  95. package/dist/assets/{list-82I80nT4.js → list-DTozzh-_.js} +1 -1
  96. package/dist/assets/localization-C3RRCpKi.js +1 -0
  97. package/dist/assets/{log-DSlLPNrL.js → log-B-igF5Lx.js} +1 -1
  98. package/dist/assets/logger-Hz7uEgBd.js +1 -0
  99. package/dist/assets/{login-BCmON-gb.js → login-DnEH1TJW.js} +1 -1
  100. package/dist/assets/{login-oauth-callback-BJoNAJDQ.js → login-oauth-callback-D4t1m8CH.js} +1 -1
  101. package/dist/assets/{logo-uploader-Blzn_BDN.js → logo-uploader-BhceTgHW.js} +1 -1
  102. package/dist/assets/{lost-passport-BMVsDg1D.js → lost-passport-i4tl7Emt.js} +1 -1
  103. package/dist/assets/{omit-hhiOJGRf.js → omit-CigYLGmT.js} +1 -1
  104. package/dist/assets/{open-window-3fNVG3jy.js → open-window-57MP9-Xk.js} +1 -1
  105. package/dist/assets/{over-due-invoice-payment-MS2Z5Q7I.js → over-due-invoice-payment-ZK0Cmr5s.js} +1 -1
  106. package/dist/assets/{overview-CUrNqNDE.js → overview-DbZdlDOd.js} +1 -1
  107. package/dist/assets/passport-_qL8zXAT.js +1 -0
  108. package/dist/assets/{passport-item-C75Jm1_H.js → passport-item-ORKJlSS3.js} +1 -1
  109. package/dist/assets/{permission-mw1ZNsp2.js → permission-CDjTfL1z.js} +1 -1
  110. package/dist/assets/{preferences-nc4oRkZr.js → preferences-COmB9XC_.js} +1 -1
  111. package/dist/assets/profile-embed-CYk0Xxk0.js +1 -0
  112. package/dist/assets/{publish-resource-CUhJuUtt.js → publish-resource-Dlh13UBC.js} +1 -1
  113. package/dist/assets/{react-beautiful-dnd.esm-CArJPjh2.js → react-beautiful-dnd.esm-xmMAwjuG.js} +1 -1
  114. package/dist/assets/{runtime-wYAsV832.js → runtime-DHe0QjJ3.js} +1 -1
  115. package/dist/assets/{sanitize-BEqBHa8a.js → sanitize-Bib7lw-G.js} +1 -1
  116. package/dist/assets/sdk-DP4NQY41.js +1 -0
  117. package/dist/assets/{security--siQ5O1l.js → security-CfDm5JBm.js} +1 -1
  118. package/dist/assets/{session-zaFSgetw.js → session-DUnZO0dx.js} +1 -1
  119. package/dist/assets/{setup-2wB1RpQx.js → setup-BF09OVjg.js} +1 -1
  120. package/dist/assets/{simple-select-DhYZPYiw.js → simple-select-DYKnLkk9.js} +1 -1
  121. package/dist/assets/{spaces-D5ZbqByE.js → spaces-BD_IfTnB.js} +1 -1
  122. package/dist/assets/{start-Bj3IUKjU.js → start-C2pCothU.js} +1 -1
  123. package/dist/assets/{starting-progress-QpbqpMn4.js → starting-progress-j5Gbwbka.js} +1 -1
  124. package/dist/assets/{status-DdYVVFLE.js → status-CYWf3uBt.js} +1 -1
  125. package/dist/assets/{step-actions-DsK7No59.js → step-actions-Dbs-BfbR.js} +1 -1
  126. package/dist/assets/{studio-B_8_8ekc.js → studio-B_wUyHyC.js} +1 -1
  127. package/dist/assets/{switch-control-DFAD8EW8.js → switch-control-BUtetd7I.js} +1 -1
  128. package/dist/assets/{table-tips-l51OFH7y.js → table-tips-CS1WAXWA.js} +1 -1
  129. package/dist/assets/{team-BLHzIk1L.js → team-C7pbRoxF.js} +1 -1
  130. package/dist/assets/{traffic-BVXNh0NF.js → traffic-C6Zltx_D.js} +1 -1
  131. package/dist/assets/{transfer-B8aeHYnn.js → transfer-EfMEfJCO.js} +1 -1
  132. package/dist/assets/{unsubscribe-Cfv9XkeO.js → unsubscribe-t2-by_s5.js} +1 -1
  133. package/dist/assets/{use-app-logo-B8kguOVt.js → use-app-logo-Cn8xa27P.js} +1 -1
  134. package/dist/assets/{use-window-close-B5H67t66.js → use-window-close-JowHVZZx.js} +1 -1
  135. package/dist/assets/{useAsync-cZ_FPf9k.js → useAsync-BvASW8Y8.js} +1 -1
  136. package/dist/assets/{useAsync-BcVLpt2E.js → useAsync-DouUkRB3.js} +1 -1
  137. package/dist/assets/{useAsyncRetry-DwwEjrjs.js → useAsyncRetry-C8ETjgdm.js} +1 -1
  138. package/dist/assets/{useLocalStorage-B6EKILzf.js → useLocalStorage-DMy4Hcmk.js} +1 -1
  139. package/dist/assets/user-center-tHuPRrTG.js +126 -0
  140. package/dist/assets/{user-follower-ClQHH3Bs.js → user-follower-BPuRj5Cd.js} +1 -1
  141. package/dist/assets/{util-C0VnVv6a.js → util-BRJRNQfv.js} +1 -1
  142. package/dist/assets/{util-Dgt9KiDQ.js → util-CZq54ng4.js} +1 -1
  143. package/dist/assets/{vendor-arcblock-BwXbOk2K.js → vendor-arcblock-BgUgVGvU.js} +1 -1
  144. package/dist/assets/{vendor-hooks-CjESGRlR.js → vendor-hooks-OpgB8gyY.js} +1 -1
  145. package/dist/assets/vendor-utils-ByKYcWuf.js +213 -0
  146. package/dist/assets/{vendor-ux-BzbOqBel.js → vendor-ux-CWISwSx6.js} +7 -7
  147. package/dist/assets/{wait-connect-DrsxOKar.js → wait-connect-URVrdT7J.js} +1 -1
  148. package/dist/assets/{wizard-CjSRXNxn.js → wizard-BnWT5z4g.js} +1 -1
  149. package/dist/assets/{wizard-components-DDoE7ozK.js → wizard-components-DymXOorF.js} +1 -1
  150. package/dist/assets/wrap-locale-BkF6rwNU.js +1 -0
  151. package/dist/assets/{zh-Coo9u8yK.js → zh-CfkvICo2.js} +1 -1
  152. package/dist/index.html +1 -1
  153. package/dist/service-worker.js +1 -1
  154. package/package.json +50 -50
  155. package/dist/assets/api-Btn0Tp3W.js +0 -1
  156. package/dist/assets/branding-2dWKGu90.js +0 -1
  157. package/dist/assets/domains-B68IENPq.js +0 -1
  158. package/dist/assets/engine-HllL7ndi.js +0 -1
  159. package/dist/assets/get-safe-url-BJkYMXT3.js +0 -1
  160. package/dist/assets/index-B6AIfiH6.js +0 -62
  161. package/dist/assets/localization-D_sXjdOF.js +0 -1
  162. package/dist/assets/logger-CRs1-njY.js +0 -1
  163. package/dist/assets/passport-BmUaoAYN.js +0 -1
  164. package/dist/assets/profile-embed-COBooKOy.js +0 -1
  165. package/dist/assets/sdk-oOD0ugLK.js +0 -1
  166. package/dist/assets/user-center-BK3PLY7H.js +0 -126
  167. package/dist/assets/vendor-utils-cJEl_UEd.js +0 -213
  168. package/dist/assets/wrap-locale-CcKDlll4.js +0 -1
@@ -1 +1 @@
1
- import{j as t,ak as s,T as n,W as i}from"./vendor-mui-core-CnXrAOs3.js";import{V as f}from"./vendor-ux-BzbOqBel.js";import{L as g,r as k}from"./vendor-react-Dvs43sk9.js";import"./index-B-XlfvkZ.js";import"./vendor-utils-cJEl_UEd.js";import"./vendor-hooks-CjESGRlR.js";import"./lottie-web-4koyQiv_.js";import"./vendor-arcblock-BwXbOk2K.js";const l=(e,o)=>[e,...Array.isArray(o)?o:[o]],a=(e=2)=>({overflow:"hidden",textOverflow:"ellipsis",wordBreak:"break-word",display:"-webkit-box",WebkitLineClamp:e,WebkitBoxOrient:"vertical"});function p({sx:e={},...o}){const r=l({display:"flex",flexWrap:"wrap",mx:-1},e);return t.jsx(s,{sx:r,...o})}p.propTypes={sx:i.object};function w({icon:e}){const[o,r]=k.useState(!1);return!e||o?null:typeof e=="string"?t.jsx(s,{component:"img",src:e,alt:"",sx:{width:1,height:1},onError:()=>r(!0)}):e}w.propTypes={icon:i.oneOfType([i.string,i.node]).isRequired};function b({title:e,desc:o,extra:r,cover:c,icon:d,to:x,sx:h}){const m=l({position:"relative",flexBasis:{xs:"100%",sm:"50%",md:"33.33%",lg:"25%"},maxWidth:{xs:"100%",sm:"50%",md:"33.33%",lg:"25%"},mb:{xs:2,md:6},px:1},h);return t.jsx(s,{sx:m,children:t.jsx(s,{component:g,to:x,target:"_blank",sx:{display:"flex",flexDirection:"column",gap:1,height:1,pt:0,color:"inherit",textDecoration:"none",borderRadius:1,cursor:"pointer"},children:t.jsxs(s,{children:[t.jsxs(s,{sx:{position:"relative"},children:[c,d&&t.jsx(s,{sx:{position:"absolute",top:44,left:16,zIndex:1,width:56,height:56},children:t.jsx(w,{icon:d})})]}),t.jsx(n,{sx:{mt:1,fontSize:"1.25rem",fontWeight:600,...a()},children:e}),o&&t.jsx(n,{variant:"body2",sx:{my:1,...a(),color:"text.secondary"},children:o}),r]})})})}b.propTypes={title:i.string.isRequired,desc:i.string.isRequired,extra:i.node.isRequired,cover:i.string.isRequired,icon:i.string.isRequired,to:i.string.isRequired,sx:i.object.isRequired};const j=""+window.__toCdnUrl("assets/doc-board-bg-DWZHV9Ng.png");function u({board:e,sx:o,...r}){return t.jsx(b,{date:e.createdAt,sx:o,to:e.link,title:e.title,desc:e.desc,cover:t.jsx(s,{sx:{position:"relative",paddingTop:`${9/16*100}%`,border:1,borderColor:"divider",borderRadius:1,overflow:"hidden"},children:t.jsx(s,{component:"img",src:j,alt:"",sx:{position:"absolute",top:0,left:0,width:1,filter:c=>c.palette.mode==="dark"?"brightness(0.28) contrast(1.1)":"none"}})}),icon:e.icon,...r})}u.propTypes={board:i.object.isRequired,sx:i.object.isRequired};function I(){const{locale:e}=f(),o=[{id:"1",title:"Blocklet Platform",desc:"Guide to understand and build on our blocklet platform",icon:"https://www.arcblock.io/favicon.ico",link:`https://www.arcblock.io/docs/blocklet-developer/${e}/getting-started`},{id:"2",title:"Create Blocklet",desc:"Build blocklet with just one command line.",icon:"https://www.arcblock.io/favicon.ico",link:`https://www.arcblock.io/docs/createblocklet/${e}/quick-start`},{id:"3",title:"Blocklet Launcher",desc:"Streamlining Blocklet Launching.",icon:"https://www.arcblock.io/docs/uploads/5a4f4716bc8061532a535fe816a9169c.png",link:`https://www.arcblock.io/docs/launcher/${e}/launcher-welcome`},{id:"4",title:"DID Spaces",desc:"Digital Spaces for Decentralized Identity (DID)",icon:"https://www.arcblock.io/docs/uploads/3a8b142d7c940c57eced71eddba2ff19.png",link:`https://www.arcblock.io/docs/did-spaces/${e}/did-spaces-getting-started`},{id:"5",title:"DID Wallet",desc:"DID Wallet Support docs",icon:"https://www.arcblock.io/docs/uploads/59ddb28f405ee670428e5fe1ff12d104.png",link:`https://www.arcblock.io/docs/did-wallet/${e}/get-started`},{id:"6",title:"DID Names",desc:"Naming Service based on NFT and verifiable credentials",icon:"https://www.didnames.io/favicon.ico?imageFilter=resize&w=32",link:`https://www.arcblock.io/docs/did-domain/${e}/did-domain-faq`},{id:"7",title:"Blockchain",desc:"The ledger for ArcBlock ecosystem",icon:"https://www.arcblock.io/docs/uploads/4a20c152faae0f104ed0815ff3b8b48b.png",link:`https://www.arcblock.io/docs/blockchain/${e}/blockchain-how-to-guides`},{id:"8",title:"DID Connect",desc:"The open protocol and development kit for connecting users and dapps",icon:"https://www.arcblock.io/docs/uploads/d189118f89b56e9d5b03ad5a0212a4ab.png",link:`https://www.arcblock.io/docs/did-connect/${e}/developer-guides`}];return t.jsx(p,{children:o.map(r=>t.jsx(u,{board:r},r.id))})}export{I as default};
1
+ import{j as t,ak as s,T as n,W as i}from"./vendor-mui-core-CnXrAOs3.js";import{V as f}from"./vendor-ux-CWISwSx6.js";import{L as g,r as k}from"./vendor-react-Dvs43sk9.js";import"./index-CvqAqbTY.js";import"./vendor-utils-ByKYcWuf.js";import"./vendor-hooks-OpgB8gyY.js";import"./lottie-web-4koyQiv_.js";import"./vendor-arcblock-BgUgVGvU.js";const l=(e,o)=>[e,...Array.isArray(o)?o:[o]],a=(e=2)=>({overflow:"hidden",textOverflow:"ellipsis",wordBreak:"break-word",display:"-webkit-box",WebkitLineClamp:e,WebkitBoxOrient:"vertical"});function p({sx:e={},...o}){const r=l({display:"flex",flexWrap:"wrap",mx:-1},e);return t.jsx(s,{sx:r,...o})}p.propTypes={sx:i.object};function w({icon:e}){const[o,r]=k.useState(!1);return!e||o?null:typeof e=="string"?t.jsx(s,{component:"img",src:e,alt:"",sx:{width:1,height:1},onError:()=>r(!0)}):e}w.propTypes={icon:i.oneOfType([i.string,i.node]).isRequired};function b({title:e,desc:o,extra:r,cover:c,icon:d,to:x,sx:h}){const m=l({position:"relative",flexBasis:{xs:"100%",sm:"50%",md:"33.33%",lg:"25%"},maxWidth:{xs:"100%",sm:"50%",md:"33.33%",lg:"25%"},mb:{xs:2,md:6},px:1},h);return t.jsx(s,{sx:m,children:t.jsx(s,{component:g,to:x,target:"_blank",sx:{display:"flex",flexDirection:"column",gap:1,height:1,pt:0,color:"inherit",textDecoration:"none",borderRadius:1,cursor:"pointer"},children:t.jsxs(s,{children:[t.jsxs(s,{sx:{position:"relative"},children:[c,d&&t.jsx(s,{sx:{position:"absolute",top:44,left:16,zIndex:1,width:56,height:56},children:t.jsx(w,{icon:d})})]}),t.jsx(n,{sx:{mt:1,fontSize:"1.25rem",fontWeight:600,...a()},children:e}),o&&t.jsx(n,{variant:"body2",sx:{my:1,...a(),color:"text.secondary"},children:o}),r]})})})}b.propTypes={title:i.string.isRequired,desc:i.string.isRequired,extra:i.node.isRequired,cover:i.string.isRequired,icon:i.string.isRequired,to:i.string.isRequired,sx:i.object.isRequired};const j=""+window.__toCdnUrl("assets/doc-board-bg-DWZHV9Ng.png");function u({board:e,sx:o,...r}){return t.jsx(b,{date:e.createdAt,sx:o,to:e.link,title:e.title,desc:e.desc,cover:t.jsx(s,{sx:{position:"relative",paddingTop:`${9/16*100}%`,border:1,borderColor:"divider",borderRadius:1,overflow:"hidden"},children:t.jsx(s,{component:"img",src:j,alt:"",sx:{position:"absolute",top:0,left:0,width:1,filter:c=>c.palette.mode==="dark"?"brightness(0.28) contrast(1.1)":"none"}})}),icon:e.icon,...r})}u.propTypes={board:i.object.isRequired,sx:i.object.isRequired};function I(){const{locale:e}=f(),o=[{id:"1",title:"Blocklet Platform",desc:"Guide to understand and build on our blocklet platform",icon:"https://www.arcblock.io/favicon.ico",link:`https://www.arcblock.io/docs/blocklet-developer/${e}/getting-started`},{id:"2",title:"Create Blocklet",desc:"Build blocklet with just one command line.",icon:"https://www.arcblock.io/favicon.ico",link:`https://www.arcblock.io/docs/createblocklet/${e}/quick-start`},{id:"3",title:"Blocklet Launcher",desc:"Streamlining Blocklet Launching.",icon:"https://www.arcblock.io/docs/uploads/5a4f4716bc8061532a535fe816a9169c.png",link:`https://www.arcblock.io/docs/launcher/${e}/launcher-welcome`},{id:"4",title:"DID Spaces",desc:"Digital Spaces for Decentralized Identity (DID)",icon:"https://www.arcblock.io/docs/uploads/3a8b142d7c940c57eced71eddba2ff19.png",link:`https://www.arcblock.io/docs/did-spaces/${e}/did-spaces-getting-started`},{id:"5",title:"DID Wallet",desc:"DID Wallet Support docs",icon:"https://www.arcblock.io/docs/uploads/59ddb28f405ee670428e5fe1ff12d104.png",link:`https://www.arcblock.io/docs/did-wallet/${e}/get-started`},{id:"6",title:"DID Names",desc:"Naming Service based on NFT and verifiable credentials",icon:"https://www.didnames.io/favicon.ico?imageFilter=resize&w=32",link:`https://www.arcblock.io/docs/did-domain/${e}/did-domain-faq`},{id:"7",title:"Blockchain",desc:"The ledger for ArcBlock ecosystem",icon:"https://www.arcblock.io/docs/uploads/4a20c152faae0f104ed0815ff3b8b48b.png",link:`https://www.arcblock.io/docs/blockchain/${e}/blockchain-how-to-guides`},{id:"8",title:"DID Connect",desc:"The open protocol and development kit for connecting users and dapps",icon:"https://www.arcblock.io/docs/uploads/d189118f89b56e9d5b03ad5a0212a4ab.png",link:`https://www.arcblock.io/docs/did-connect/${e}/developer-guides`}];return t.jsx(p,{children:o.map(r=>t.jsx(u,{board:r},r.id))})}export{I as default};
@@ -1,4 +1,4 @@
1
- import{j as e,W as u,a6 as z,T as j,at as _e,D as We,cH as V,ao as J,cI as Ke,ak as h,b1 as K,a$ as Ge,s as fe,cJ as ke,co as Fe,am as ge,cq as Ye,M as F,aO as Y,bX as $e,aP as $,Q as qe,be as He,aR as Qe,cK as Xe,cL as Ve,cM as Je,cN as Ze,c2 as he}from"./vendor-mui-core-CnXrAOs3.js";import{k as be,j as je,a as ue}from"./vendor-hooks-CjESGRlR.js";import{r as k,u as et}from"./vendor-react-Dvs43sk9.js";import{ac as O,_ as L,a1 as E,Y as N,aM as tt,aN as st,aE as nt,c as T,v as ot}from"./index-B-XlfvkZ.js";import{H as B,V as D,p as at,Q as q,h as rt,W as it,n as le,k as ct}from"./vendor-ux-BzbOqBel.js";import{u as lt}from"./use-mobile-maRlSUwU.js";import{a as H,d as Ce,a0 as dt,c as pt,D as we,C as me}from"./vendor-utils-cJEl_UEd.js";import{o as Be}from"./vendor-arcblock-BwXbOk2K.js";import{b as ut,u as mt,D as xt,c as de,a as ft}from"./index-C5W1sNxF.js";import"./index-BDVkvtSV.js";import"./index-BojVbZw0.js";import"./api-Btn0Tp3W.js";import{u as De,C as gt,D as ht,a as St}from"./connect-to-DRAd7i9J.js";import{b as yt,c as kt,d as bt,i as jt,e as xe,f as Ct,h as wt,j as Bt}from"./spaces-D5ZbqByE.js";import{f as Q}from"./index-DBs9Ljax.js";import{v as Dt}from"./index-DcnBbXEh.js";import{E as Et}from"./index-NomqB6Iy.js";import{x as It}from"./index-DRYJ0xIl.js";import{g as Se}from"./get-safe-url-BJkYMXT3.js";import{S as Tt}from"./switch-control-DFAD8EW8.js";import{C as Rt,u as Pt}from"./config-space-0Usu_97A.js";import{L as ye}from"./list-header-BE2kzda_.js";import"./lottie-web-4koyQiv_.js";import"./index-CRtYD69s.js";async function vt({blockletDid:t,nodeApi:n,spaceGateways:o}){let s=!1;const r=await Promise.all(o.map(async a=>{let{name:c}=a;const i=await yt(a.endpoint);return!H(i)&&i!==c&&(c=i,s=!0),{...a,name:c}}));return s&&await Promise.all(r.filter(a=>a.did).map(a=>n.updateBlockletSpaceGateway({input:{did:t,where:{did:a.did},spaceGateway:{...a}}}))),r}function At({refresh:t}={}){const{blocklet:n}=O(),o=n?.meta?.did,{api:s}=L();return be(async()=>{if(!o)return[];const{spaceGateways:r}=await s.getBlockletSpaceGateways({input:{did:o}});return await vt({blockletDid:o,nodeApi:s,spaceGateways:r})??[]},{refreshDeps:[o,t],onError(r){r?.message?.includes("not logged")?console.warn(r):(console.error(r),B.error(Q(r)))}})}function Ee({deps:t,setLoading:n,backupDate:o}={deps:[],setLoading:()=>{},backupDate:new Date}){const{blocklet:s}=O(),[r,a]=k.useState([]),{api:c}=L(),[i,d]=k.useMemo(()=>o?[E(o).startOf("day").toISOString(),E(o).endOf("day").toISOString()]:[E().startOf("year").toISOString(),E().endOf("day").toISOString()],[o]),l=Ce(async()=>{try{if(n(!0),!s){a([]);return}const{backups:x}=await c.getBlockletBackups({input:{did:s.meta.did,startTime:i,endTime:d}});a(x??[])}catch(x){console.error(x),B.error(Q(x))}finally{n(!1)}},1e3);return je(async()=>{l()},[s?.meta?.did].concat(t)),{backups:r}}function zt({appDid:t}){const{backups:n}=Ee(),[o,s]=k.useState({message:"",progress:0,completed:!1}),r=L(),{ws:{useSubscription:a}}=r;return a(N.BlockletEvents.backupProgress,c=>{t===c?.appDid&&s(()=>({...c}))},[t]),k.useEffect(()=>{if(n?.length&&dt(n[0]?.status)){const[c]=n;s(()=>({message:c.message,progress:c.progress,completed:c.progress>=100}))}},[n]),o}function Ot({deps:t=[],setLoading:n=()=>{}}={}){const{blocklet:o}=O(),[s,r]=k.useState([]),{api:a}=L(),c=k.useCallback(Ce(async()=>{if(!a||!o?.meta?.did){r([]);return}try{n(!0);const i=E(),d=i.subtract(1,"year"),{summary:l}=await a.getBlockletBackupSummary({input:{did:o.meta.did,startTime:d.toISOString(),endTime:i.toISOString()}});r(Array.isArray(l)?l:[])}catch(i){console.error("Failed to fetch backup summary:",i),B.error(Q(i)),r([])}finally{n(!1)}},1e3),[]);return je(async()=>(await c(),()=>{c.cancel()}),[o?.meta?.did].concat(t)),{backupSummary:s}}const Ie=k.createContext({}),{Provider:Lt,Consumer:ks}=Ie;function Te({children:t}){const{t:n}=D(),{api:o}=L(),{blocklet:s}=O(),[r,a]=k.useState(null),[c,i]=k.useState(!1),{data:d,loading:l,mutate:x}=At({refresh:c}),g=pt(d),m=zt({appDid:s?.appDid}),p=k.useMemo(()=>kt(s?.environments),[s?.environments]),[b,w]=k.useState(!1),[S,y]=k.useState(0),{backups:Z}=Ee({deps:[S,r],setLoading:w,backupDate:r}),[ee,te]=k.useState(0),{backupSummary:se}=Ot({deps:[ee]}),[_,M]=k.useState(d?.find(f=>f.endpoint===p)),I=s?.settings?.autoBackup,P=()=>{i(f=>!f)},ne=()=>{te(f=>f+1)},oe=()=>{y(f=>f+1)},G=async f=>{await o.updateAutoBackup({input:{did:s.meta.did,autoBackup:f}})},X=async()=>{await o.abortBlockletBackup({input:{appPid:s.meta.did}})},ae=async(f,A)=>{try{x(R=>{const v=[...R];return v.push({...f,loading:!0}),v}),await o.addBlockletSpaceGateway({input:{did:s.meta.did,spaceGateway:f}}),p!==A&&await o.configBlocklet({input:{did:[s.meta.did],configs:[{key:N.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:A}]}}),M(f),P(),B.success(n("storage.spaces.connectedWithName",{name:f?.name??"DID Spaces"}))}catch(R){throw console.error(R),x(v=>[...v].filter(W=>W.did!==f.did)),R}},re=async f=>{f&&(f.endpoint===p&&(await o.configBlocklet({input:{did:[s.meta.did],configs:[{key:N.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:""}]}}),I?.enabled&&await G({enabled:!1})),await o.deleteBlockletSpaceGateway({input:{did:s.meta.did,spaceGatewayDid:f?.did}}),x(A=>{const R=[...A];return R.splice(R.indexOf(f),1),R}),M(f),P())},ie=async f=>{await Promise.all([o.updateBlockletSpaceGateway({input:{did:s.meta.did,where:{did:f.did},spaceGateway:f}}),p!==f.endpoint&&o.configBlocklet({input:{did:[s.meta.did],configs:[{key:N.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:f.endpoint}]}})]),B.success(n("storage.spaces.connectedWithName",{name:f?.name??"DID Spaces"})),P()},C=f=>f?.endpoint===p;return e.jsx(Lt,{value:{spaceGateways:d||[],selectedSpaceGateway:_,addSpaceGateway:ae,deleteSpaceGateway:re,updateSpaceGateway:ie,refreshSpaceGateways:P,spaceGatewaysLoading:l,spaceGatewaysFirstLoading:g,spaceGatewayIsSelected:C,updateAutoBackup:G,abortBlockletBackup:X,backupEndpoint:p,backupProgress:m,backups:Z,backupSummary:se,refreshBackupSummary:ne,refreshBackups:oe,setBackupDate:a,backupsLoading:b,autoBackup:I},children:t})}Te.propTypes={children:u.any.isRequired};function U(){return k.useContext(Ie)}function Re({...t}){const{blocklet:n}=O(),{info:o}=L(),{t:s}=D(),r=De({blocklet:n}),a=tt(o),{spaceGateways:c,addSpaceGateway:i}=U(),d={checkFn:we.create({baseURL:me(window.location.origin,st())}).get,webWalletUrl:a,extraParams:{appPid:n.appPid,appDid:r.appDid,appName:r.appName,appDescription:r.appDescription,appUrl:r.appUrl,referrer:r.referrer,scopes:r.scopes,nodeDid:o.did}},l=async({endpoint:g,name:m,did:p})=>{const b=await bt(g);if(!await jt(b)){B.error(s("storage.spaces.gateway.add.invalidUrl"));return}if(c.some(y=>y.endpoint===g)){B.error(s("storage.spaces.gateway.add.duplicate",{name:m}));return}await i({name:m,did:p,url:b,endpoint:g},g)},x=async({spaceGateway:g})=>{try{await l(g)}catch(m){console.error(m),B.error(Q(m))}};return e.jsx(ut,{...t,connectScope:"app",options:d,onSuccess:x})}function Ut(){const{api:t}=L(),{blocklet:n}=O(),{data:o,loading:s}=be(()=>t.getBlocklet({input:{did:n?.meta?.did,attachDiskInfo:!0,attachRuntimeInfo:!0}}),{ready:!!n?.meta?.did,refreshDeps:[n?.meta?.did]});return{blocklet:o?.blocklet??null,loading:s}}function Pe({...t}){const{t:n}=k.useContext(at),{blocklet:o,loading:s}=Ut();if(o?.diskInfo){const r=(i,d,l)=>e.jsxs(j,{children:[i," ",e.jsx("strong",{children:d?nt(d):"empty"})]}),a=o.environments.reduce((i,d)=>(i[d.key]=d.value,i),{}),c=[{key:"appDir",name:n("blocklet.diskInfo.appDir"),value:r(a.BLOCKLET_APP_DIR,o.diskInfo.app)},{key:"dataDir",name:n("blocklet.diskInfo.dataDir"),value:r(a.BLOCKLET_DATA_DIR,o.diskInfo.data)},{key:"logDir",name:n("blocklet.diskInfo.logDir"),value:r(a.BLOCKLET_LOG_DIR,o.diskInfo.log)},{key:"cacheDir",name:n("blocklet.diskInfo.cacheDir"),value:r(a.BLOCKLET_CACHE_DIR,o.diskInfo.cache)}];return e.jsx(Mt,{component:"div",...t,children:c.map(i=>e.jsx(Dt,{valueComponent:"div",nameWidth:120,name:i.name,children:i.value},i.key))})}return s?e.jsx(z,{}):e.jsx(j,{children:n("blocklet.diskInfo.empty")})}const Mt=_e(j)``;function ve(){const{t}=D(),{setBackupDate:n,backupSummary:o}=U(),s=mt({key:"lg"}),r=k.useRef(null),a=We(),c=k.useCallback(l=>{n(l)},[n]),i=k.useMemo(()=>{const l=E().add(1,"day"),x=l.subtract(1,"year"),g=new Map(o.map(p=>[p.date,{date:p.date,successCount:p.successCount,errorCount:p.errorCount}])),m=[];for(let p=x.clone();E(p).isBefore(l);p=p.add(1,"day")){const b=p.format("YYYY-MM-DD");m.push(g.get(b)||{date:b,successCount:0,errorCount:0})}return m},[o]),d=k.useMemo(()=>({grid:{containLabel:!0,right:10,top:30,bottom:12},tooltip:{formatter:b=>{const{date:w,successCount:S,errorCount:y}=i[b.dataIndex]||{date:b.data[0],successCount:0,errorCount:0};return[`<div>${t("common.time")}: ${w}</div>`,`<div>${t("common.succeeded")}: ${S}</div>`,`<div>${t("common.failed")}: ${y}</div>`].join(`
1
+ import{j as e,W as u,a6 as z,T as j,at as _e,D as We,cH as V,ao as J,cI as Ke,ak as h,b1 as K,a$ as Ge,s as fe,cJ as ke,co as Fe,am as ge,cq as Ye,M as F,aO as Y,bX as $e,aP as $,Q as qe,be as He,aR as Qe,cK as Xe,cL as Ve,cM as Je,cN as Ze,c2 as he}from"./vendor-mui-core-CnXrAOs3.js";import{k as be,j as je,a as ue}from"./vendor-hooks-OpgB8gyY.js";import{r as k,u as et}from"./vendor-react-Dvs43sk9.js";import{ac as O,_ as L,a1 as E,Y as N,aM as tt,aN as st,aE as nt,c as T,v as ot}from"./index-CvqAqbTY.js";import{H as B,V as D,p as at,Q as q,h as rt,W as it,n as le,k as ct}from"./vendor-ux-CWISwSx6.js";import{u as lt}from"./use-mobile-maRlSUwU.js";import{a as H,d as Ce,a0 as dt,c as pt,D as we,C as me}from"./vendor-utils-ByKYcWuf.js";import{o as Be}from"./vendor-arcblock-BgUgVGvU.js";import{b as ut,u as mt,D as xt,c as de,a as ft}from"./index-CaN6T62E.js";import"./index-CPenNsCA.js";import"./index-BojVbZw0.js";import"./api-BNrHV6cZ.js";import{u as De,C as gt,D as ht,a as St}from"./connect-to-C7YGs17H.js";import{b as yt,c as kt,d as bt,i as jt,e as xe,f as Ct,h as wt,j as Bt}from"./spaces-BD_IfTnB.js";import{f as Q}from"./index-DBs9Ljax.js";import{v as Dt}from"./index-3fEKnvhn.js";import{E as Et}from"./index-BM4g9p9K.js";import{x as It}from"./index-DRYJ0xIl.js";import{g as Se}from"./get-safe-url-BJvKfOW0.js";import{S as Tt}from"./switch-control-BUtetd7I.js";import{C as Rt,u as Pt}from"./config-space-CT4_9rp4.js";import{L as ye}from"./list-header-BE2kzda_.js";import"./lottie-web-4koyQiv_.js";import"./index-Cor3Ch2R.js";async function vt({blockletDid:t,nodeApi:n,spaceGateways:o}){let s=!1;const r=await Promise.all(o.map(async a=>{let{name:c}=a;const i=await yt(a.endpoint);return!H(i)&&i!==c&&(c=i,s=!0),{...a,name:c}}));return s&&await Promise.all(r.filter(a=>a.did).map(a=>n.updateBlockletSpaceGateway({input:{did:t,where:{did:a.did},spaceGateway:{...a}}}))),r}function At({refresh:t}={}){const{blocklet:n}=O(),o=n?.meta?.did,{api:s}=L();return be(async()=>{if(!o)return[];const{spaceGateways:r}=await s.getBlockletSpaceGateways({input:{did:o}});return await vt({blockletDid:o,nodeApi:s,spaceGateways:r})??[]},{refreshDeps:[o,t],onError(r){r?.message?.includes("not logged")?console.warn(r):(console.error(r),B.error(Q(r)))}})}function Ee({deps:t,setLoading:n,backupDate:o}={deps:[],setLoading:()=>{},backupDate:new Date}){const{blocklet:s}=O(),[r,a]=k.useState([]),{api:c}=L(),[i,d]=k.useMemo(()=>o?[E(o).startOf("day").toISOString(),E(o).endOf("day").toISOString()]:[E().startOf("year").toISOString(),E().endOf("day").toISOString()],[o]),l=Ce(async()=>{try{if(n(!0),!s){a([]);return}const{backups:x}=await c.getBlockletBackups({input:{did:s.meta.did,startTime:i,endTime:d}});a(x??[])}catch(x){console.error(x),B.error(Q(x))}finally{n(!1)}},1e3);return je(async()=>{l()},[s?.meta?.did].concat(t)),{backups:r}}function zt({appDid:t}){const{backups:n}=Ee(),[o,s]=k.useState({message:"",progress:0,completed:!1}),r=L(),{ws:{useSubscription:a}}=r;return a(N.BlockletEvents.backupProgress,c=>{t===c?.appDid&&s(()=>({...c}))},[t]),k.useEffect(()=>{if(n?.length&&dt(n[0]?.status)){const[c]=n;s(()=>({message:c.message,progress:c.progress,completed:c.progress>=100}))}},[n]),o}function Ot({deps:t=[],setLoading:n=()=>{}}={}){const{blocklet:o}=O(),[s,r]=k.useState([]),{api:a}=L(),c=k.useCallback(Ce(async()=>{if(!a||!o?.meta?.did){r([]);return}try{n(!0);const i=E(),d=i.subtract(1,"year"),{summary:l}=await a.getBlockletBackupSummary({input:{did:o.meta.did,startTime:d.toISOString(),endTime:i.toISOString()}});r(Array.isArray(l)?l:[])}catch(i){console.error("Failed to fetch backup summary:",i),B.error(Q(i)),r([])}finally{n(!1)}},1e3),[]);return je(async()=>(await c(),()=>{c.cancel()}),[o?.meta?.did].concat(t)),{backupSummary:s}}const Ie=k.createContext({}),{Provider:Lt,Consumer:ks}=Ie;function Te({children:t}){const{t:n}=D(),{api:o}=L(),{blocklet:s}=O(),[r,a]=k.useState(null),[c,i]=k.useState(!1),{data:d,loading:l,mutate:x}=At({refresh:c}),g=pt(d),m=zt({appDid:s?.appDid}),p=k.useMemo(()=>kt(s?.environments),[s?.environments]),[b,w]=k.useState(!1),[S,y]=k.useState(0),{backups:Z}=Ee({deps:[S,r],setLoading:w,backupDate:r}),[ee,te]=k.useState(0),{backupSummary:se}=Ot({deps:[ee]}),[_,M]=k.useState(d?.find(f=>f.endpoint===p)),I=s?.settings?.autoBackup,P=()=>{i(f=>!f)},ne=()=>{te(f=>f+1)},oe=()=>{y(f=>f+1)},G=async f=>{await o.updateAutoBackup({input:{did:s.meta.did,autoBackup:f}})},X=async()=>{await o.abortBlockletBackup({input:{appPid:s.meta.did}})},ae=async(f,A)=>{try{x(R=>{const v=[...R];return v.push({...f,loading:!0}),v}),await o.addBlockletSpaceGateway({input:{did:s.meta.did,spaceGateway:f}}),p!==A&&await o.configBlocklet({input:{did:[s.meta.did],configs:[{key:N.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:A}]}}),M(f),P(),B.success(n("storage.spaces.connectedWithName",{name:f?.name??"DID Spaces"}))}catch(R){throw console.error(R),x(v=>[...v].filter(W=>W.did!==f.did)),R}},re=async f=>{f&&(f.endpoint===p&&(await o.configBlocklet({input:{did:[s.meta.did],configs:[{key:N.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:""}]}}),I?.enabled&&await G({enabled:!1})),await o.deleteBlockletSpaceGateway({input:{did:s.meta.did,spaceGatewayDid:f?.did}}),x(A=>{const R=[...A];return R.splice(R.indexOf(f),1),R}),M(f),P())},ie=async f=>{await Promise.all([o.updateBlockletSpaceGateway({input:{did:s.meta.did,where:{did:f.did},spaceGateway:f}}),p!==f.endpoint&&o.configBlocklet({input:{did:[s.meta.did],configs:[{key:N.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:f.endpoint}]}})]),B.success(n("storage.spaces.connectedWithName",{name:f?.name??"DID Spaces"})),P()},C=f=>f?.endpoint===p;return e.jsx(Lt,{value:{spaceGateways:d||[],selectedSpaceGateway:_,addSpaceGateway:ae,deleteSpaceGateway:re,updateSpaceGateway:ie,refreshSpaceGateways:P,spaceGatewaysLoading:l,spaceGatewaysFirstLoading:g,spaceGatewayIsSelected:C,updateAutoBackup:G,abortBlockletBackup:X,backupEndpoint:p,backupProgress:m,backups:Z,backupSummary:se,refreshBackupSummary:ne,refreshBackups:oe,setBackupDate:a,backupsLoading:b,autoBackup:I},children:t})}Te.propTypes={children:u.any.isRequired};function U(){return k.useContext(Ie)}function Re({...t}){const{blocklet:n}=O(),{info:o}=L(),{t:s}=D(),r=De({blocklet:n}),a=tt(o),{spaceGateways:c,addSpaceGateway:i}=U(),d={checkFn:we.create({baseURL:me(window.location.origin,st())}).get,webWalletUrl:a,extraParams:{appPid:n.appPid,appDid:r.appDid,appName:r.appName,appDescription:r.appDescription,appUrl:r.appUrl,referrer:r.referrer,scopes:r.scopes,nodeDid:o.did}},l=async({endpoint:g,name:m,did:p})=>{const b=await bt(g);if(!await jt(b)){B.error(s("storage.spaces.gateway.add.invalidUrl"));return}if(c.some(y=>y.endpoint===g)){B.error(s("storage.spaces.gateway.add.duplicate",{name:m}));return}await i({name:m,did:p,url:b,endpoint:g},g)},x=async({spaceGateway:g})=>{try{await l(g)}catch(m){console.error(m),B.error(Q(m))}};return e.jsx(ut,{...t,connectScope:"app",options:d,onSuccess:x})}function Ut(){const{api:t}=L(),{blocklet:n}=O(),{data:o,loading:s}=be(()=>t.getBlocklet({input:{did:n?.meta?.did,attachDiskInfo:!0,attachRuntimeInfo:!0}}),{ready:!!n?.meta?.did,refreshDeps:[n?.meta?.did]});return{blocklet:o?.blocklet??null,loading:s}}function Pe({...t}){const{t:n}=k.useContext(at),{blocklet:o,loading:s}=Ut();if(o?.diskInfo){const r=(i,d,l)=>e.jsxs(j,{children:[i," ",e.jsx("strong",{children:d?nt(d):"empty"})]}),a=o.environments.reduce((i,d)=>(i[d.key]=d.value,i),{}),c=[{key:"appDir",name:n("blocklet.diskInfo.appDir"),value:r(a.BLOCKLET_APP_DIR,o.diskInfo.app)},{key:"dataDir",name:n("blocklet.diskInfo.dataDir"),value:r(a.BLOCKLET_DATA_DIR,o.diskInfo.data)},{key:"logDir",name:n("blocklet.diskInfo.logDir"),value:r(a.BLOCKLET_LOG_DIR,o.diskInfo.log)},{key:"cacheDir",name:n("blocklet.diskInfo.cacheDir"),value:r(a.BLOCKLET_CACHE_DIR,o.diskInfo.cache)}];return e.jsx(Mt,{component:"div",...t,children:c.map(i=>e.jsx(Dt,{valueComponent:"div",nameWidth:120,name:i.name,children:i.value},i.key))})}return s?e.jsx(z,{}):e.jsx(j,{children:n("blocklet.diskInfo.empty")})}const Mt=_e(j)``;function ve(){const{t}=D(),{setBackupDate:n,backupSummary:o}=U(),s=mt({key:"lg"}),r=k.useRef(null),a=We(),c=k.useCallback(l=>{n(l)},[n]),i=k.useMemo(()=>{const l=E().add(1,"day"),x=l.subtract(1,"year"),g=new Map(o.map(p=>[p.date,{date:p.date,successCount:p.successCount,errorCount:p.errorCount}])),m=[];for(let p=x.clone();E(p).isBefore(l);p=p.add(1,"day")){const b=p.format("YYYY-MM-DD");m.push(g.get(b)||{date:b,successCount:0,errorCount:0})}return m},[o]),d=k.useMemo(()=>({grid:{containLabel:!0,right:10,top:30,bottom:12},tooltip:{formatter:b=>{const{date:w,successCount:S,errorCount:y}=i[b.dataIndex]||{date:b.data[0],successCount:0,errorCount:0};return[`<div>${t("common.time")}: ${w}</div>`,`<div>${t("common.succeeded")}: ${S}</div>`,`<div>${t("common.failed")}: ${y}</div>`].join(`
2
2
  `)},backgroundColor:a.palette.background.paper,borderColor:a.palette.divider,textStyle:{color:a.palette.text.primary,fontSize:14},extraCssText:`box-shadow: ${a.shadows[2]}; border-radius: 4px;`,padding:[8,10]},visualMap:{show:!1,min:-12,max:12,pieces:[{min:Number.MIN_SAFE_INTEGER,max:-9,color:V[600]},{min:-9,max:-6,color:V[500]},{min:-6,max:-3,color:V[400]},{min:-3,max:-1,color:V[300]},{min:0,max:0,color:a.palette.grey[200]},{min:1,max:3,color:J[300]},{min:3,max:6,color:J[400]},{min:6,max:9,color:J[500]},{min:9,max:Number.MAX_SAFE_INTEGER,color:J[600]}],orient:"horizontal",left:"center",bottom:12,itemWidth:12,itemHeight:12,textStyle:{color:a.palette.text.secondary,fontSize:12}},calendar:{top:30,left:50,right:10,bottom:4,cellSize:[8,8],splitLine:{show:!1},itemStyle:{borderWidth:2,borderColor:a.palette.background.default,color:a.palette.background.default},dayLabel:{show:!0,firstDay:0,nameMap:["","Mon","","Wed","","Fri",""],position:"start",margin:4,fontSize:10,color:a.palette.text.primary,fontWeight:"400",width:20},monthLabel:{show:!0,nameMap:"cn",align:"left",color:a.palette.text.primary,fontWeight:"400",fontSize:12,position:"start",margin:4,width:30,padding:[0,2]},yearLabel:{show:!1},range:[E().subtract(11,"month").startOf("month").format("YYYY-MM-DD"),E().endOf("month").format("YYYY-MM-DD")],orient:"horizontal"},series:{type:"heatmap",coordinateSystem:"calendar",data:i.map(b=>[b.date,b.errorCount?-b.errorCount:b.successCount]),label:{show:!1},itemStyle:{borderWidth:2,borderColor:a.palette.background.default,borderRadius:4},emphasis:{itemStyle:{borderWidth:2,borderColor:Ke[200],color:"inherit"}}}}),[i,t,a]);return e.jsxs(e.Fragment,{children:[e.jsx(h,{ref:r,sx:{maxWidth:"1280px",border:"1px solid",borderColor:"divider",padding:"8px",overflowX:"auto"},children:e.jsx(h,{sx:{width:"1200px",height:"180px",position:"relative"},children:e.jsx(Et,{option:d,style:{height:"100%",width:"100%"},notMerge:!0,lazyUpdate:!1,opts:{renderer:"canvas"},onEvents:{click:l=>{l.componentType==="series"&&l.data&&c(l.data[0])}}})})}),e.jsx(h,{sx:{display:"flex",justifyContent:"flex-end",mt:1,mr:s?2:5,mb:2},children:e.jsxs(K,{direction:s?"column":"row",spacing:s?2:1,sx:{width:"100%",justifyContent:"flex-start",alignItems:s?"flex-start":"center"},children:[e.jsxs(K,{direction:"row",spacing:1,sx:{alignItems:"center"},children:[e.jsx(h,{sx:{width:32,height:12,borderRadius:.5,background:"linear-gradient(90deg, #8B5000 0%, #A36200 33%, #C17700 66%, #E29000 100%)"}}),e.jsx(j,{variant:"body2",sx:{color:"text.secondary"},children:t("storage.spaces.backup.failed")})]}),e.jsxs(K,{direction:"row",spacing:1,sx:{alignItems:"center"},children:[e.jsx(h,{sx:{width:32,height:12,borderRadius:.5,bgcolor:"grey.200",border:"1px solid",borderColor:"grey.200"}}),e.jsx(j,{variant:"body2",sx:{color:"text.secondary"},children:t("storage.spaces.backup.without")})]}),e.jsxs(K,{direction:"row",spacing:1,sx:{alignItems:"center"},children:[e.jsx(h,{sx:{width:32,height:12,borderRadius:.5,background:"linear-gradient(90deg, #9be9a8 0%, #40c463 33%, #30a14e 66%, #216e39 100%)"}}),e.jsx(j,{variant:"body2",sx:{color:"text.secondary"},children:t("storage.spaces.backup.succeeded")})]})]})})]})}const Nt=fe(({className:t,...n})=>e.jsx(ge,{...n,classes:{popper:t}}))(()=>({".MuiTooltip-tooltip":{backgroundColor:"transparent",padding:0,margin:0,boxShadow:"none",maxWidth:"none"},".MuiTooltip-arrow":{color:"rgba(230, 235, 245, 1)"}}));function Ae({status:t,message:n="",createdAt:o}){const{t:s}=D(),r=t===T.BACKUPS.STATUS.PROGRESS&&E().diff(o,"hours")>=T.BACKUPS.TIMEOUT_HOURS,a=r&&s("common.timeoutError"),c=t===T.BACKUPS.STATUS.PROGRESS&&!r,i=t===T.BACKUPS.STATUS.SUCCEEDED&&!r;return c?e.jsxs(j,{sx:{display:"inline-flex",alignItems:"center",fontSize:"14px"},children:[e.jsx(z,{sx:{marginRight:"4px"},size:"12px"}),s("common.progress")]}):i?e.jsx(q,{type:"success",children:s("common.succeeded")}):e.jsxs(h,{sx:{display:"inline-flex",alignItems:"center"},children:[e.jsx(q,{type:"error",children:s("common.failed")}),e.jsx(ge,{style:{display:"flex",alignItems:"center",flexShrink:0},title:n||a,children:e.jsx(ke,{children:e.jsx(Ye,{style:{width:"24px",height:"24px"},color:"error"})})})]})}Ae.propTypes={status:u.string.isRequired,message:u.string,createdAt:u.string.isRequired};function ze({metadata:t={}}){const{t:n}=D();if(H(t))return e.jsx(q,{type:"success",children:n("common.succeeded")});const o=t.count||0,s=t.size||0,r=It(s,{iec:!0}),a=e.jsxs(h,{sx:{p:1,borderRadius:1,boxShadow:2,color:"black",backgroundColor:"white"},children:[e.jsxs(j,{variant:"body2",children:[n("common.fileCount"),": ",o]}),e.jsxs(j,{variant:"body2",children:[n("common.fileSize"),": ",r]})]});return e.jsxs(h,{sx:{display:"inline-flex",alignItems:"center"},children:[e.jsx(q,{type:"success",children:n("common.succeeded")}),e.jsx(Nt,{title:a,style:{display:"flex",alignItems:"center",flexShrink:0},placement:"left",children:e.jsx(ke,{children:e.jsx(Fe,{style:{width:"24px",height:"24px"},color:"primary"})})})]})}ze.propTypes={metadata:u.object};function Oe(){const{t,locale:n}=D(),{spaceGateways:o,backups:s,backupsLoading:r}=U(),a=k.useMemo(()=>[{label:"DID Space",name:"target",options:{customBodyRenderLite:i=>{const{targetUrl:d,targetName:l,status:x,createdAt:g}=s[i],m=x===T.BACKUPS.STATUS.PROGRESS&&E().diff(g,"hours")>=T.BACKUPS.TIMEOUT_HOURS,p=x===T.BACKUPS.STATUS.SUCCEEDED&&!m,b=l||o.find(w=>d?.includes(xe(w?.endpoint)))?.name||"Unknown DID Space";return p?e.jsx(Ge,{href:d,target:"_blank",sx:{fontSize:"16px"},children:b}):e.jsx(j,{variant:"body1",sx:{fontSize:"16px"},children:b})}}},{label:t("common.strategy"),name:"strategy",options:{customBodyRender:i=>{const d=t(i===0?"common.auto":"common.manual");return e.jsx(q,{children:d})}}},{label:t("common.startTime"),name:"createdAt",options:{customBodyRender:i=>E(i).format("YYYY-MM-DD HH:mm:ss")}},{label:t("common.endTime"),name:"updatedAt",options:{customBodyRender:i=>H(i)?"":E(i).format("YYYY-MM-DD HH:mm:ss")}},{label:t("common.status"),name:"status",options:{customBodyRenderLite:i=>{const d=s?.[i]??{},{status:l,message:x,createdAt:g,metadata:m}=d,p=l===T.BACKUPS.STATUS.PROGRESS&&E().diff(g,"hours")>=T.BACKUPS.TIMEOUT_HOURS,b=l===T.BACKUPS.STATUS.PROGRESS&&!p,w=l===T.BACKUPS.STATUS.SUCCEEDED&&!p;return b?e.jsxs(j,{sx:{display:"inline-flex",alignItems:"center",fontSize:"14px"},children:[e.jsx(z,{sx:{marginRight:"4px"},size:"12px"}),t("common.progress")]}):w?e.jsx(ze,{metadata:m}):e.jsx(Ae,{status:l,message:x,createdAt:g})}}}],[s,o,t]),c=k.useMemo(()=>!s?.length,[s]);return e.jsx(e.Fragment,{children:c?e.jsx(h,{sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"100px",color:"#9397A1",marginTop:"16px",marginBottom:"24px"},children:t("storage.spaces.record.emptyData")}):e.jsx(rt,{title:"",loading:r,data:s,columns:a,emptyNode:t("storage.spaces.record.emptyData",n),options:{download:!1,filter:!1,print:!1,search:!1,viewColumns:!1}})})}function _t(){const{t}=D();return e.jsxs(h,{children:[e.jsxs(h,{sx:{display:"flex",gap:3,flexDirection:{xs:"column",md:"row"}},children:[e.jsxs(h,{sx:{display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",alignContent:"center",minWidth:240},children:[e.jsx(xt,{style:{cursor:"pointer",width:"150px",height:"100%",maxHeight:160}}),e.jsx(j,{sx:{my:2,textAlign:"center",color:"text.secondary"},children:t("storage.spaces.connect.provider")}),e.jsx(Re,{})]}),e.jsxs(h,{sx:{flexGrow:1,minWidth:0},children:[e.jsx(h,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:3},children:e.jsx(j,{sx:{fontSize:"1.2rem",fontWeight:"bold"},children:t("storage.spaces.backup.records")})}),e.jsx(ve,{})]})]}),e.jsx(Oe,{sx:{marginTop:"24px"}}),e.jsx(j,{sx:{fontSize:"1.2rem",fontWeight:"bold",mb:2,mt:2},children:t("common.dataStorage")}),e.jsx(Pe,{})]})}function Le({spaceGateway:t,onConfirm:n=()=>{},onCancel:o=()=>{}}){const{t:s}=D(),[r,a]=k.useState(!1),[c,i]=k.useState(!1),d=(g,m)=>{g?.preventDefault(),g?.stopPropagation(),a(m)},l=async g=>{try{g?.stopPropagation(),i(!0),await n?.(t),a(!1)}catch(m){console.error(m),B.error(`${s("storage.space.gateway.delete.failed")}: ${Q(m)}`)}finally{a(!1),i(!1)}},x=g=>{d(g,!1),o?.(g)};return e.jsxs(e.Fragment,{children:[e.jsxs(F,{color:"red",onClick:g=>d(g,!0),children:[e.jsx(Y,{style:{minWidth:24,color:"red"},children:e.jsx($e,{fontSize:"small"})}),e.jsx($,{style:{color:"red"},children:s("common.disconnect")})]}),e.jsx(it,{title:s("storage.spaces.gateway.delete.title"),open:r,confirmButton:{text:s("common.confirm"),props:{size:"small",variant:"contained",color:"error",loading:c}},cancelButton:{text:s("common.cancel"),props:{size:"small",variant:"outlined",disabled:c}},onConfirm:l,onCancel:x,children:e.jsx(j,{sx:{wordWrap:"break-word"},children:s("storage.spaces.gateway.delete.descForBackup",{name:`${t?.name}`})})})]})}Le.propTypes={spaceGateway:u.shape({name:u.string.isRequired,url:u.string.isRequired,protected:u.bool}).isRequired,onConfirm:u.func,onCancel:u.func};function Ue({spaceGateway:t,selected:n,onDelete:o=()=>{},onConnect:s=()=>{},enableSwitchToSpace:r=!0,backupInProgress:a=!1,...c}){const{abortBlockletBackup:i}=U(),[d,l]=k.useState(null),{t:x}=D(),[g,m]=k.useState(!1),p=(S,y)=>{S.stopPropagation(),S.preventDefault(),l(y&&S.currentTarget)},b=async S=>{try{m(!0),p(S,!1),await s(t)}catch(y){console.error(y),B.error(y.message)}finally{m(!1)}},w=async S=>{try{m(!0),p(S,!1),await i()}catch(y){console.error(y),B.error(y.message)}finally{m(!1)}};return e.jsxs(e.Fragment,{children:[g||t?.loading?e.jsx(z,{sx:{ml:1},size:"24px"}):e.jsx(qe,{"aria-label":"more","aria-controls":"actions-menu","aria-haspopup":"true","data-cy":"trigger-blocklet-actions",variant:"outlined",size:"small",onClick:S=>p(S,!0),...c,children:e.jsx(He,{})}),e.jsxs(Qe,{id:"simple-menu",anchorEl:d,keepMounted:!0,open:!!d,onClose:S=>p(S,!1),children:[e.jsxs(F,{onClick:S=>{p(S,!1),window.open(Se(t.endpoint?Ct(t.endpoint):t.url,{allowDomains:null}))},children:[e.jsx(Y,{style:{minWidth:24},children:e.jsx(Xe,{fontSize:"small"})}),e.jsx($,{children:x("common.open")})]}),e.jsxs(F,{onClick:S=>{p(S,!1),window.open(Se(wt(t.endpoint),{allowDomains:null}))},children:[e.jsx(Y,{style:{minWidth:24},children:e.jsx(Ve,{fontSize:"small"})}),e.jsx($,{children:x("storage.spaces.strategy.viewBackupFiles")})]}),!n&&r&&e.jsxs(F,{onClick:b,children:[e.jsx(Y,{style:{minWidth:24},children:e.jsx(Je,{fontSize:"small"})}),e.jsx($,{children:x("storage.spaces.connect.switchToSpace")})]}),a&&e.jsxs(F,{onClick:w,children:[e.jsx(Y,{style:{minWidth:24},children:e.jsx(Ze,{fontSize:"small"})}),e.jsx($,{children:x("storage.spaces.connect.abortBlockletBackup")})]}),!a&&e.jsx(Le,{spaceGateway:t,onConfirm:async()=>{l(null),await o?.(t)},onCancel:()=>l(null)})]})]})}Ue.propTypes={spaceGateway:u.shape({name:u.string.isRequired,url:u.string.isRequired,protected:u.bool,endpoint:u.string.isRequired,loading:u.bool}).isRequired,selected:u.bool.isRequired,enableSwitchToSpace:u.bool,onDelete:u.func,onConnect:u.func,backupInProgress:u.bool};const Wt=fe(({className:t,...n})=>e.jsx(ge,{...n,classes:{popper:t}}))(()=>({".MuiTooltip-tooltip":{backgroundColor:"transparent",padding:0,margin:0,boxShadow:"none",maxWidth:"none"},".MuiTooltip-arrow":{color:"rgba(230, 235, 245, 1)"}}));function Me({spaceGateway:t,spaceStatus:n,selected:o,onConnected:s=()=>{},onDeleted:r=()=>{},onBackedUp:a=()=>{}}){const{t:c,locale:i}=D(),{blocklet:d}=O(),{api:l,info:{did:x}}=L(),{appDid:g,appName:m,appDescription:p,scopes:b,appUrl:w,referrer:S}=De({blocklet:d}),{backupProgress:y,updateSpaceGateway:Z,deleteSpaceGateway:ee,refreshBackupSummary:te,refreshBackups:se}=U(),[_,M]=k.useState(!1),[I,P]=k.useState({open:!1,action:"one-click-authorization",checkTimeout:1e3*300,messages:{title:c("storage.spaces.authorize.title",{appName:m},i),scan:c("storage.spaces.authorize.scan",{appName:m},i),confirm:"",success:e.jsx(j,{gutterBottom:!0,children:c("storage.spaces.authorize.success")})},onClose:()=>{P(C=>({...C,open:!1}))}}),ne=o&&!_&&n===de.DISCONNECTED,oe=o&&!_&&!t.loading&&n===de.CONNECTED,G=o&&_&&n===de.CONNECTED&&y?.progress>=0,X=async()=>{try{if(await Bt(t?.endpoint)){await l.configBlocklet({input:{did:[d.meta.did],configs:[{key:N.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:t.endpoint}]}}),B.success(c("storage.spaces.connect.switchToSpaceSucceeded",{name:t.name?`(${t.name})`:""})),s?.(null,t);return}}catch(C){console.error(C),s?.(C,t);return}P(C=>({...C,open:!0,prefix:me(t.url,"space/api/did"),baseUrl:new URL(t.url).origin,checkFn:we.create({baseURL:me(t.url,"space")}).get,extraParams:{appDid:g,appName:m,appDescription:p,scopes:b,appUrl:w,referrer:S,nodeDid:x,spaceDid:t.did}}))},ae=async(C,f)=>{const A=f(C.endpoint),R=xe(A),v=C.space?f(C.space):{};if(t.did&&R!==t.did){P(Ne=>({...Ne,open:!1}));const W=c("storage.spaces.gateway.switch.failedForMismatchSpace",{name:v?.name?v.name:""});B.error(W),s?.(new Error(W),t);return}const ce={...t,name:v.name??"DID Space",did:v.did??xe(A),endpoint:A};await Z(ce),P(W=>({...W,open:!1})),s?.(null,ce)},re=async()=>{try{if(_)return;M(!0),await l.backupBlocklet({input:{appDid:d.appDid,to:"spaces"}})}catch(C){console.error(C),B.error(C.message),a?.(C,t)}finally{M(!0)}},ie=async()=>{try{await ee(t),B.success(c("storage.spaces.gateway.delete.succeeded",{name:t.name?`(${t.name})`:""})),r?.(null,t)}catch(C){console.error(C),r?.(C,t)}};return k.useEffect(()=>{y?.completed?(o&&(y?.progress===100?(B.success(c("storage.spaces.backupSuccessfully")),a?.(null,t)):y.message&&a?.(new Error(y?.message),t),y.progress=0,y.message=""),M(!1),te(),se()):y.progress&&M(!0)},[y]),e.jsxs(e.Fragment,{children:[e.jsxs(h,{sx:{display:"flex",alignItems:"center",".action-btn":{borderRadius:1,marginLeft:1}},children:[oe&&e.jsx(le,{className:"action-btn",variant:"outlined",size:"small",onClick:re,children:c("storage.spaces.strategy.backupNow")}),ne&&e.jsx(le,{className:"action-btn",variant:"outlined",size:"small",onClick:X,children:c("storage.spaces.disconnected.reconnectNow")}),G&&e.jsx(Wt,{title:y?.message&&e.jsx(h,{sx:{p:1,borderRadius:1,boxShadow:2,color:"black",backgroundColor:"white"},children:e.jsx(j,{variant:"body2",children:y.message})}),children:e.jsxs(le,{className:"action-btn",variant:"outlined",size:"small",sx:{minWidth:70},children:[e.jsx(z,{variant:"determinate",value:y?.progress,size:14,sx:{mr:1}}),y?.progress,"%"]})}),e.jsx(ot,{forceConnected:!1,saveConnect:!1,prefix:I.prefix,open:I.open,popup:!0,action:I.action,baseUrl:I.baseUrl,checkFn:I.checkFn,onSuccess:ae,onClose:I.onClose,checkTimeout:I.checkTimeout,extraParams:I.extraParams,messages:I.messages,locale:i},"get-endpoint")]}),e.jsx(Ue,{sx:{minWidth:32,padding:"2px 4px",ml:1},spaceGateway:t,selected:o,onDelete:ie,onConnect:X,enableSwitchToSpace:y?.completed||H(y?.message),backupInProgress:G})]})}Me.propTypes={spaceGateway:u.shape({did:u.string.isRequired,name:u.string.isRequired,url:u.string.isRequired,endpoint:u.string.isRequired,protected:u.bool,loading:u.bool}).isRequired,spaceStatus:u.string.isRequired,selected:u.bool.isRequired,onConnected:u.func,onDeleted:u.func,onBackedUp:u.func};function Kt({...t}){const{t:n}=D();return e.jsxs(h,{...t,children:[e.jsx(h,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:3},children:e.jsx(j,{sx:{fontSize:"1.2rem",fontWeight:"bold"},children:n("storage.spaces.backup.records")})}),e.jsx(ve,{}),e.jsx(Oe,{})]})}function Gt({...t}){const{t:n}=D(),{autoBackup:o,updateAutoBackup:s}=U(),r=async()=>{try{const a=!o?.enabled;await s({enabled:a}),B.success(n(a?"storage.spaces.autoBackup.enabled":"storage.spaces.autoBackup.disabled"))}catch(a){B.error(a.message)}};return e.jsx(Tt,{checked:!!o?.enabled,onChange:r,name:"enableWelcomePage",labelProps:{label:e.jsx(j,{sx:{marginRight:"8px"},children:e.jsx("span",{children:n("storage.spaces.autoBackup.title")})})},style:{...t.style}})}function Ft(){const{t}=D(),{spaceGateways:n,spaceGatewaysLoading:o,spaceGatewayIsSelected:s}=U(),r=o&&!n?.length,a=({spaceGateway:c,spaceStatus:i,selected:d,refresh:l})=>e.jsx(Me,{spaceGateway:c,spaceStatus:i,selected:d,onConnected:()=>l(),onBackedUp:x=>x&&l()});return e.jsxs(h,{sx:{display:"flex",flexDirection:"column"},children:[e.jsxs(h,{sx:{display:"flex",flexDirection:{xs:"column",md:"row"},gap:{xs:1,md:2},justifyContent:{xs:"center",md:"flex-start"},alignItems:{xs:"flex-start",md:"center"}},children:[e.jsx(j,{sx:{fontSize:"1.2rem",fontWeight:"bold",flexGrow:1},children:t("storage.spaces.connected.title")}),e.jsx(Gt,{}),e.jsx(Re,{})]}),e.jsx(h,{sx:{mt:2},children:r?e.jsx(h,{sx:{display:"flex",justifyContent:"center"},children:e.jsx(z,{})}):e.jsx(he,{container:!0,spacing:2,children:e.jsx(e.Fragment,{children:n.map(c=>e.jsx(he,{size:{xs:12,md:6},children:e.jsx(ft,{endpoint:c.endpoint,selected:s(c),action:a},c.endpoint)},c.endpoint))})})}),e.jsx(Kt,{sx:{marginTop:"24px"}}),e.jsx(j,{sx:{fontSize:"1.2rem",fontWeight:"bold",mb:2},children:t("common.dataStorage")}),e.jsx(Pe,{})]})}function Yt(){const{spaceGatewaysFirstLoading:t,spaceGateways:n}=U();return t?e.jsx(Be,{relative:"parent",children:e.jsx(z,{})}):H(n)?e.jsx(_t,{}):e.jsx(Ft,{})}function $t(){return e.jsx(Te,{children:e.jsx(Yt,{})})}function qt(){const{spaceGateway:t,settingStorageEndpoint:n,updateSpaceGateway:o,hasStorageEndpoint:s,loading:r,storageEndpoint:a}=Pt(),c=ue(()=>({display:"flex",alignItems:"center",justifyContent:"center",paddingTop:"16px"}));return r?e.jsx(Be,{relative:"parent",children:e.jsx(z,{})}):e.jsxs(h,{sx:{maxWidth:"md",position:"relative"},children:[s?e.jsx(gt,{spaceGateway:t,settingStorageEndpoint:n}):e.jsx(ht,{}),e.jsx(h,{sx:c,children:e.jsx(St,{onConnect:o,storageEndpoint:a})})]})}function Ht(){const{t}=D();return e.jsxs(Rt,{children:[e.jsxs(K,{spacing:1,sx:{marginBottom:2},children:[e.jsx(j,{sx:{fontSize:"1.2rem",fontWeight:"bold"},children:t("storage.appLevel.title")}),e.jsx(j,{sx:{color:"text.secondary"},children:t("storage.appLevel.description")})]}),e.jsx(qt,{})]})}function Qt({navOrientation:t="vertical",...n}){const{t:o,locale:s}=D(),{blocklet:r}=O(),a=lt({key:"md"}),[c,i]=et(),d=c.get("tab")||"backup",l=a?"horizontal":t,x=ue(()=>{const w=[{label:o("common.backup"),value:"backup"}],S=r?.capabilities?.didSpace;return(S===N.BLOCKLET_APP_SPACE_REQUIREMENT.REQUIRED||S===N.BLOCKLET_APP_SPACE_REQUIREMENT.REQUIRED_ON_SETUP)&&w.push({label:o("common.storage"),value:"storage"}),w},[s,l]),m=ue(()=>({backup:e.jsx($t,{}),storage:e.jsx(Ht,{})}))[d],p=w=>{i(S=>(w==="backup"?S.delete("tab"):S.set("tab",w),S))};if(x.length<=1)return e.jsx(pe,{children:m});const b=e.jsx(ct,{tabs:x,current:d,orientation:l,onChange:p,sx:[{borderRight:1,height:"100%",borderColor:"divider"},l==="horizontal"&&{borderRight:0}]});if(l==="vertical")return e.jsx(h,{...n,children:e.jsxs(K,{direction:{md:"column",lg:"row"},sx:{gap:2},children:[e.jsx(h,{sx:{flexShrink:0},children:e.jsx(ye,{left:b})}),e.jsx(h,{sx:{flexGrow:1,minWidth:0},children:e.jsx(pe,{sx:{mt:1},children:m})})]})});if(l==="horizontal")return e.jsxs(h,{...n,children:[e.jsx(ye,{left:b}),e.jsx(pe,{sx:{mt:2},children:m})]})}Qt.propTypes={navOrientation:u.oneOf(["vertical","horizontal"])};const pe=fe(h)`
3
3
  position: relative;
4
4
  min-height: 66vh;
@@ -0,0 +1,63 @@
1
+ import{B as Pe}from"./vendor-utils-ByKYcWuf.js";import{p as oe}from"./vendor-react-Dvs43sk9.js";import{ax as Te,ay as tt,az as nt,aA as it,aB as at,aC as ot,aD as zr,aE as ct,aF as sr,aG as ut,aH as Yr,aI as st,aJ as ft,r as fe,aK as Zr,aL as lt,aM as ht,aN as pt,aO as fr,aP as yt,aQ as dt,aR as gt}from"./vendor-ux-CWISwSx6.js";import{bO as Wr,aC as vt}from"./index-CvqAqbTY.js";var Le={exports:{}},Me={},pr;function Jr(){if(pr)return Me;pr=1;function n(g){"@babel/helpers - typeof";return n=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(E){return typeof E}:function(E){return E&&typeof Symbol=="function"&&E.constructor===Symbol&&E!==Symbol.prototype?"symbol":typeof E},n(g)}function y(g,E,P){return Object.defineProperty(g,"prototype",{writable:!1}),g}function a(g,E){if(!(g instanceof E))throw new TypeError("Cannot call a class as a function")}function d(g,E){if(typeof E!="function"&&E!==null)throw new TypeError("Super expression must either be null or a function");g.prototype=Object.create(E&&E.prototype,{constructor:{value:g,writable:!0,configurable:!0}}),Object.defineProperty(g,"prototype",{writable:!1}),E&&R(g,E)}function R(g,E){return R=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(x,D){return x.__proto__=D,x},R(g,E)}function _(g){var E=t();return function(){var x=r(g),D;if(E){var T=r(this).constructor;D=Reflect.construct(x,arguments,T)}else D=x.apply(this,arguments);return v(this,D)}}function v(g,E){if(E&&(n(E)==="object"||typeof E=="function"))return E;if(E!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return o(g)}function o(g){if(g===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return g}function t(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function r(g){return r=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(P){return P.__proto__||Object.getPrototypeOf(P)},r(g)}var e={},c,p;function h(g,E,P){P||(P=Error);function x(T,z,C){return typeof E=="string"?E:E(T,z,C)}var D=function(T){d(C,T);var z=_(C);function C(Z,te,Y){var X;return a(this,C),X=z.call(this,x(Z,te,Y)),X.code=g,X}return y(C)}(P);e[g]=D}function w(g,E){if(Array.isArray(g)){var P=g.length;return g=g.map(function(x){return String(x)}),P>2?"one of ".concat(E," ").concat(g.slice(0,P-1).join(", "),", or ")+g[P-1]:P===2?"one of ".concat(E," ").concat(g[0]," or ").concat(g[1]):"of ".concat(E," ").concat(g[0])}else return"of ".concat(E," ").concat(String(g))}function b(g,E,P){return g.substr(0,E.length)===E}function A(g,E,P){return(P===void 0||P>g.length)&&(P=g.length),g.substring(P-E.length,P)===E}function j(g,E,P){return typeof P!="number"&&(P=0),P+E.length>g.length?!1:g.indexOf(E,P)!==-1}return h("ERR_AMBIGUOUS_ARGUMENT",'The "%s" argument is ambiguous. %s',TypeError),h("ERR_INVALID_ARG_TYPE",function(g,E,P){c===void 0&&(c=ur()),c(typeof g=="string","'name' must be a string");var x;typeof E=="string"&&b(E,"not ")?(x="must not be",E=E.replace(/^not /,"")):x="must be";var D;if(A(g," argument"))D="The ".concat(g," ").concat(x," ").concat(w(E,"type"));else{var T=j(g,".")?"property":"argument";D='The "'.concat(g,'" ').concat(T," ").concat(x," ").concat(w(E,"type"))}return D+=". Received type ".concat(n(P)),D},TypeError),h("ERR_INVALID_ARG_VALUE",function(g,E){var P=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"is invalid";p===void 0&&(p=Te());var x=p.inspect(E);return x.length>128&&(x="".concat(x.slice(0,128),"...")),"The argument '".concat(g,"' ").concat(P,". Received ").concat(x)},TypeError),h("ERR_INVALID_RETURN_VALUE",function(g,E,P){var x;return P&&P.constructor&&P.constructor.name?x="instance of ".concat(P.constructor.name):x="type ".concat(n(P)),"Expected ".concat(g,' to be returned from the "').concat(E,'"')+" function but got ".concat(x,".")},TypeError),h("ERR_MISSING_ARGS",function(){for(var g=arguments.length,E=new Array(g),P=0;P<g;P++)E[P]=arguments[P];c===void 0&&(c=ur()),c(E.length>0,"At least one arg needs to be specified");var x="The ",D=E.length;switch(E=E.map(function(T){return'"'.concat(T,'"')}),D){case 1:x+="".concat(E[0]," argument");break;case 2:x+="".concat(E[0]," and ").concat(E[1]," arguments");break;default:x+=E.slice(0,D-1).join(", "),x+=", and ".concat(E[D-1]," arguments");break}return"".concat(x," must be specified")},TypeError),Me.codes=e,Me}var He,yr;function Et(){if(yr)return He;yr=1;function n(m,S){var U=Object.keys(m);if(Object.getOwnPropertySymbols){var N=Object.getOwnPropertySymbols(m);S&&(N=N.filter(function(H){return Object.getOwnPropertyDescriptor(m,H).enumerable})),U.push.apply(U,N)}return U}function y(m){for(var S=1;S<arguments.length;S++){var U=arguments[S]!=null?arguments[S]:{};S%2?n(Object(U),!0).forEach(function(N){a(m,N,U[N])}):Object.getOwnPropertyDescriptors?Object.defineProperties(m,Object.getOwnPropertyDescriptors(U)):n(Object(U)).forEach(function(N){Object.defineProperty(m,N,Object.getOwnPropertyDescriptor(U,N))})}return m}function a(m,S,U){return S=v(S),S in m?Object.defineProperty(m,S,{value:U,enumerable:!0,configurable:!0,writable:!0}):m[S]=U,m}function d(m,S){if(!(m instanceof S))throw new TypeError("Cannot call a class as a function")}function R(m,S){for(var U=0;U<S.length;U++){var N=S[U];N.enumerable=N.enumerable||!1,N.configurable=!0,"value"in N&&(N.writable=!0),Object.defineProperty(m,v(N.key),N)}}function _(m,S,U){return S&&R(m.prototype,S),Object.defineProperty(m,"prototype",{writable:!1}),m}function v(m){var S=o(m,"string");return g(S)==="symbol"?S:String(S)}function o(m,S){if(g(m)!=="object"||m===null)return m;var U=m[Symbol.toPrimitive];if(U!==void 0){var N=U.call(m,S);if(g(N)!=="object")return N;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(m)}function t(m,S){if(typeof S!="function"&&S!==null)throw new TypeError("Super expression must either be null or a function");m.prototype=Object.create(S&&S.prototype,{constructor:{value:m,writable:!0,configurable:!0}}),Object.defineProperty(m,"prototype",{writable:!1}),S&&A(m,S)}function r(m){var S=w();return function(){var N=j(m),H;if(S){var f=j(this).constructor;H=Reflect.construct(N,arguments,f)}else H=N.apply(this,arguments);return e(this,H)}}function e(m,S){if(S&&(g(S)==="object"||typeof S=="function"))return S;if(S!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return c(m)}function c(m){if(m===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return m}function p(m){var S=typeof Map=="function"?new Map:void 0;return p=function(N){if(N===null||!b(N))return N;if(typeof N!="function")throw new TypeError("Super expression must either be null or a function");if(typeof S<"u"){if(S.has(N))return S.get(N);S.set(N,H)}function H(){return h(N,arguments,j(this).constructor)}return H.prototype=Object.create(N.prototype,{constructor:{value:H,enumerable:!1,writable:!0,configurable:!0}}),A(H,N)},p(m)}function h(m,S,U){return w()?h=Reflect.construct.bind():h=function(H,f,u){var l=[null];l.push.apply(l,f);var I=Function.bind.apply(H,l),O=new I;return u&&A(O,u.prototype),O},h.apply(null,arguments)}function w(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function b(m){return Function.toString.call(m).indexOf("[native code]")!==-1}function A(m,S){return A=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(N,H){return N.__proto__=H,N},A(m,S)}function j(m){return j=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(U){return U.__proto__||Object.getPrototypeOf(U)},j(m)}function g(m){"@babel/helpers - typeof";return g=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(S){return typeof S}:function(S){return S&&typeof Symbol=="function"&&S.constructor===Symbol&&S!==Symbol.prototype?"symbol":typeof S},g(m)}var E=Te(),P=E.inspect,x=Jr(),D=x.codes.ERR_INVALID_ARG_TYPE;function T(m,S,U){return(U===void 0||U>m.length)&&(U=m.length),m.substring(U-S.length,U)===S}function z(m,S){if(S=Math.floor(S),m.length==0||S==0)return"";var U=m.length*S;for(S=Math.floor(Math.log(S)/Math.log(2));S;)m+=m,S--;return m+=m.substring(0,U-m.length),m}var C="",Z="",te="",Y="",X={deepStrictEqual:"Expected values to be strictly deep-equal:",strictEqual:"Expected values to be strictly equal:",strictEqualObject:'Expected "actual" to be reference-equal to "expected":',deepEqual:"Expected values to be loosely deep-equal:",equal:"Expected values to be loosely equal:",notDeepStrictEqual:'Expected "actual" not to be strictly deep-equal to:',notStrictEqual:'Expected "actual" to be strictly unequal to:',notStrictEqualObject:'Expected "actual" not to be reference-equal to "expected":',notDeepEqual:'Expected "actual" not to be loosely deep-equal to:',notEqual:'Expected "actual" to be loosely unequal to:',notIdentical:"Values identical but not reference-equal:"},me=10;function we(m){var S=Object.keys(m),U=Object.create(Object.getPrototypeOf(m));return S.forEach(function(N){U[N]=m[N]}),Object.defineProperty(U,"message",{value:m.message}),U}function ae(m){return P(m,{compact:!1,customInspect:!1,depth:1e3,maxArrayLength:1/0,showHidden:!1,breakLength:1/0,showProxy:!1,sorted:!0,getters:!0})}function Se(m,S,U){var N="",H="",f=0,u="",l=!1,I=ae(m),O=I.split(`
2
+ `),K=ae(S).split(`
3
+ `),L=0,V="";if(U==="strictEqual"&&g(m)==="object"&&g(S)==="object"&&m!==null&&S!==null&&(U="strictEqualObject"),O.length===1&&K.length===1&&O[0]!==K[0]){var W=O[0].length+K[0].length;if(W<=me){if((g(m)!=="object"||m===null)&&(g(S)!=="object"||S===null)&&(m!==0||S!==0))return"".concat(X[U],`
4
+
5
+ `)+"".concat(O[0]," !== ").concat(K[0],`
6
+ `)}else if(U!=="strictEqualObject"){var J=oe.stderr&&oe.stderr.isTTY?oe.stderr.columns:80;if(W<J){for(;O[0][L]===K[0][L];)L++;L>2&&(V=`
7
+ `.concat(z(" ",L),"^"),L=0)}}}for(var ee=O[O.length-1],ve=K[K.length-1];ee===ve&&(L++<2?u=`
8
+ `.concat(ee).concat(u):N=ee,O.pop(),K.pop(),!(O.length===0||K.length===0));)ee=O[O.length-1],ve=K[K.length-1];var qe=Math.max(O.length,K.length);if(qe===0){var Ee=I.split(`
9
+ `);if(Ee.length>30)for(Ee[26]="".concat(C,"...").concat(Y);Ee.length>27;)Ee.pop();return"".concat(X.notIdentical,`
10
+
11
+ `).concat(Ee.join(`
12
+ `),`
13
+ `)}L>3&&(u=`
14
+ `.concat(C,"...").concat(Y).concat(u),l=!0),N!==""&&(u=`
15
+ `.concat(N).concat(u),N="");var ne=0,Ie=X[U]+`
16
+ `.concat(Z,"+ actual").concat(Y," ").concat(te,"- expected").concat(Y),Be=" ".concat(C,"...").concat(Y," Lines skipped");for(L=0;L<qe;L++){var ie=L-f;if(O.length<L+1)ie>1&&L>2&&(ie>4?(H+=`
17
+ `.concat(C,"...").concat(Y),l=!0):ie>3&&(H+=`
18
+ `.concat(K[L-2]),ne++),H+=`
19
+ `.concat(K[L-1]),ne++),f=L,N+=`
20
+ `.concat(te,"-").concat(Y," ").concat(K[L]),ne++;else if(K.length<L+1)ie>1&&L>2&&(ie>4?(H+=`
21
+ `.concat(C,"...").concat(Y),l=!0):ie>3&&(H+=`
22
+ `.concat(O[L-2]),ne++),H+=`
23
+ `.concat(O[L-1]),ne++),f=L,H+=`
24
+ `.concat(Z,"+").concat(Y," ").concat(O[L]),ne++;else{var be=K[L],ue=O[L],i=ue!==be&&(!T(ue,",")||ue.slice(0,-1)!==be);i&&T(be,",")&&be.slice(0,-1)===ue&&(i=!1,ue+=","),i?(ie>1&&L>2&&(ie>4?(H+=`
25
+ `.concat(C,"...").concat(Y),l=!0):ie>3&&(H+=`
26
+ `.concat(O[L-2]),ne++),H+=`
27
+ `.concat(O[L-1]),ne++),f=L,H+=`
28
+ `.concat(Z,"+").concat(Y," ").concat(ue),N+=`
29
+ `.concat(te,"-").concat(Y," ").concat(be),ne+=2):(H+=N,N="",(ie===1||L===0)&&(H+=`
30
+ `.concat(ue),ne++))}if(ne>20&&L<qe-2)return"".concat(Ie).concat(Be,`
31
+ `).concat(H,`
32
+ `).concat(C,"...").concat(Y).concat(N,`
33
+ `)+"".concat(C,"...").concat(Y)}return"".concat(Ie).concat(l?Be:"",`
34
+ `).concat(H).concat(N).concat(u).concat(V)}var ce=function(m,S){t(N,m);var U=r(N);function N(H){var f;if(d(this,N),g(H)!=="object"||H===null)throw new D("options","Object",H);var u=H.message,l=H.operator,I=H.stackStartFn,O=H.actual,K=H.expected,L=Error.stackTraceLimit;if(Error.stackTraceLimit=0,u!=null)f=U.call(this,String(u));else if(oe.stderr&&oe.stderr.isTTY&&(oe.stderr&&oe.stderr.getColorDepth&&oe.stderr.getColorDepth()!==1?(C="\x1B[34m",Z="\x1B[32m",Y="\x1B[39m",te="\x1B[31m"):(C="",Z="",Y="",te="")),g(O)==="object"&&O!==null&&g(K)==="object"&&K!==null&&"stack"in O&&O instanceof Error&&"stack"in K&&K instanceof Error&&(O=we(O),K=we(K)),l==="deepStrictEqual"||l==="strictEqual")f=U.call(this,Se(O,K,l));else if(l==="notDeepStrictEqual"||l==="notStrictEqual"){var V=X[l],W=ae(O).split(`
35
+ `);if(l==="notStrictEqual"&&g(O)==="object"&&O!==null&&(V=X.notStrictEqualObject),W.length>30)for(W[26]="".concat(C,"...").concat(Y);W.length>27;)W.pop();W.length===1?f=U.call(this,"".concat(V," ").concat(W[0])):f=U.call(this,"".concat(V,`
36
+
37
+ `).concat(W.join(`
38
+ `),`
39
+ `))}else{var J=ae(O),ee="",ve=X[l];l==="notDeepEqual"||l==="notEqual"?(J="".concat(X[l],`
40
+
41
+ `).concat(J),J.length>1024&&(J="".concat(J.slice(0,1021),"..."))):(ee="".concat(ae(K)),J.length>512&&(J="".concat(J.slice(0,509),"...")),ee.length>512&&(ee="".concat(ee.slice(0,509),"...")),l==="deepEqual"||l==="equal"?J="".concat(ve,`
42
+
43
+ `).concat(J,`
44
+
45
+ should equal
46
+
47
+ `):ee=" ".concat(l," ").concat(ee)),f=U.call(this,"".concat(J).concat(ee))}return Error.stackTraceLimit=L,f.generatedMessage=!u,Object.defineProperty(c(f),"name",{value:"AssertionError [ERR_ASSERTION]",enumerable:!1,writable:!0,configurable:!0}),f.code="ERR_ASSERTION",f.actual=O,f.expected=K,f.operator=l,Error.captureStackTrace&&Error.captureStackTrace(c(f),I),f.stack,f.name="AssertionError",e(f)}return _(N,[{key:"toString",value:function(){return"".concat(this.name," [").concat(this.code,"]: ").concat(this.message)}},{key:S,value:function(f,u){return P(this,y(y({},u),{},{customInspect:!1,depth:0}))}}]),N}(p(Error),P.custom);return He=ce,He}var Ce,dr;function bt(){if(dr)return Ce;dr=1;var n=Wr(),y=tt()(),a=nt(),d=it(),R=a("Array.prototype.push"),_=a("Object.prototype.propertyIsEnumerable"),v=y?d.getOwnPropertySymbols:null;return Ce=function(t,r){if(t==null)throw new TypeError("target must be an object");var e=d(t);if(arguments.length===1)return e;for(var c=1;c<arguments.length;++c){var p=d(arguments[c]),h=n(p),w=y&&(d.getOwnPropertySymbols||v);if(w)for(var b=w(p),A=0;A<b.length;++A){var j=b[A];_(p,j)&&R(h,j)}for(var g=0;g<h.length;++g){var E=h[g];if(_(p,E)){var P=p[E];e[E]=P}}}return e},Ce}var ke,gr;function mt(){if(gr)return ke;gr=1;var n=bt(),y=function(){if(!Object.assign)return!1;for(var d="abcdefghijklmnopqrst",R=d.split(""),_={},v=0;v<R.length;++v)_[R[v]]=R[v];var o=Object.assign({},_),t="";for(var r in o)t+=r;return d!==t},a=function(){if(!Object.assign||!Object.preventExtensions)return!1;var d=Object.preventExtensions({1:2});try{Object.assign(d,"xy")}catch{return d[1]==="y"}return!1};return ke=function(){return!Object.assign||y()||a()?n:Object.assign},ke}var Fe,vr;function Xr(){if(vr)return Fe;vr=1;var n=function(y){return y!==y};return Fe=function(a,d){return a===0&&d===0?1/a===1/d:!!(a===d||n(a)&&n(d))},Fe}var $e,Er;function lr(){if(Er)return $e;Er=1;var n=Xr();return $e=function(){return typeof Object.is=="function"?Object.is:n},$e}var Ve,br;function De(){if(br)return Ve;br=1;var n=Wr(),y=typeof Symbol=="function"&&typeof Symbol("foo")=="symbol",a=Object.prototype.toString,d=Array.prototype.concat,R=at(),_=function(r){return typeof r=="function"&&a.call(r)==="[object Function]"},v=ot()(),o=function(r,e,c,p){if(e in r){if(p===!0){if(r[e]===c)return}else if(!_(p)||!p())return}v?R(r,e,c,!0):R(r,e,c)},t=function(r,e){var c=arguments.length>2?arguments[2]:{},p=n(e);y&&(p=d.call(p,Object.getOwnPropertySymbols(e)));for(var h=0;h<p.length;h+=1)o(r,p[h],e[p[h]],c[p[h]])};return t.supportsDescriptors=!!v,Ve=t,Ve}var Ge,mr;function wt(){if(mr)return Ge;mr=1;var n=lr(),y=De();return Ge=function(){var d=n();return y(Object,{is:d},{is:function(){return Object.is!==d}}),d},Ge}var ze,wr;function St(){if(wr)return ze;wr=1;var n=De(),y=zr(),a=Xr(),d=lr(),R=wt(),_=y(d(),Object);return n(_,{getPolyfill:d,implementation:a,shim:R}),ze=_,ze}var Ye,Sr;function Qr(){return Sr||(Sr=1,Ye=function(y){return y!==y}),Ye}var Ze,_r;function et(){if(_r)return Ze;_r=1;var n=Qr();return Ze=function(){return Number.isNaN&&Number.isNaN(NaN)&&!Number.isNaN("a")?Number.isNaN:n},Ze}var We,Or;function _t(){if(Or)return We;Or=1;var n=De(),y=et();return We=function(){var d=y();return n(Number,{isNaN:d},{isNaN:function(){return Number.isNaN!==d}}),d},We}var Je,Ar;function Ot(){if(Ar)return Je;Ar=1;var n=zr(),y=De(),a=Qr(),d=et(),R=_t(),_=n(d(),Number);return y(_,{getPolyfill:d,implementation:a,shim:R}),Je=_,Je}var Xe,Pr;function At(){if(Pr)return Xe;Pr=1;function n(i,s){return _(i)||R(i,s)||a(i,s)||y()}function y(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
48
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function a(i,s){if(i){if(typeof i=="string")return d(i,s);var q=Object.prototype.toString.call(i).slice(8,-1);if(q==="Object"&&i.constructor&&(q=i.constructor.name),q==="Map"||q==="Set")return Array.from(i);if(q==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(q))return d(i,s)}}function d(i,s){(s==null||s>i.length)&&(s=i.length);for(var q=0,B=new Array(s);q<s;q++)B[q]=i[q];return B}function R(i,s){var q=i==null?null:typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(q!=null){var B,M,F,k,$=[],G=!0,Q=!1;try{if(F=(q=q.call(i)).next,s!==0)for(;!(G=(B=F.call(q)).done)&&($.push(B.value),$.length!==s);G=!0);}catch(re){Q=!0,M=re}finally{try{if(!G&&q.return!=null&&(k=q.return(),Object(k)!==k))return}finally{if(Q)throw M}}return $}}function _(i){if(Array.isArray(i))return i}function v(i){"@babel/helpers - typeof";return v=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(s){return typeof s}:function(s){return s&&typeof Symbol=="function"&&s.constructor===Symbol&&s!==Symbol.prototype?"symbol":typeof s},v(i)}var o=/a/g.flags!==void 0,t=function(s){var q=[];return s.forEach(function(B){return q.push(B)}),q},r=function(s){var q=[];return s.forEach(function(B,M){return q.push([M,B])}),q},e=Object.is?Object.is:St(),c=Object.getOwnPropertySymbols?Object.getOwnPropertySymbols:function(){return[]},p=Number.isNaN?Number.isNaN:Ot();function h(i){return i.call.bind(i)}var w=h(Object.prototype.hasOwnProperty),b=h(Object.prototype.propertyIsEnumerable),A=h(Object.prototype.toString),j=Te().types,g=j.isAnyArrayBuffer,E=j.isArrayBufferView,P=j.isDate,x=j.isMap,D=j.isRegExp,T=j.isSet,z=j.isNativeError,C=j.isBoxedPrimitive,Z=j.isNumberObject,te=j.isStringObject,Y=j.isBooleanObject,X=j.isBigIntObject,me=j.isSymbolObject,we=j.isFloat32Array,ae=j.isFloat64Array;function Se(i){if(i.length===0||i.length>10)return!0;for(var s=0;s<i.length;s++){var q=i.charCodeAt(s);if(q<48||q>57)return!0}return i.length===10&&i>=Math.pow(2,32)}function ce(i){return Object.keys(i).filter(Se).concat(c(i).filter(Object.prototype.propertyIsEnumerable.bind(i)))}/*!
49
+ * The buffer module from node.js, for the browser.
50
+ *
51
+ * @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
52
+ * @license MIT
53
+ */function m(i,s){if(i===s)return 0;for(var q=i.length,B=s.length,M=0,F=Math.min(q,B);M<F;++M)if(i[M]!==s[M]){q=i[M],B=s[M];break}return q<B?-1:B<q?1:0}var S=!0,U=!1,N=0,H=1,f=2,u=3;function l(i,s){return o?i.source===s.source&&i.flags===s.flags:RegExp.prototype.toString.call(i)===RegExp.prototype.toString.call(s)}function I(i,s){if(i.byteLength!==s.byteLength)return!1;for(var q=0;q<i.byteLength;q++)if(i[q]!==s[q])return!1;return!0}function O(i,s){return i.byteLength!==s.byteLength?!1:m(new Uint8Array(i.buffer,i.byteOffset,i.byteLength),new Uint8Array(s.buffer,s.byteOffset,s.byteLength))===0}function K(i,s){return i.byteLength===s.byteLength&&m(new Uint8Array(i),new Uint8Array(s))===0}function L(i,s){return Z(i)?Z(s)&&e(Number.prototype.valueOf.call(i),Number.prototype.valueOf.call(s)):te(i)?te(s)&&String.prototype.valueOf.call(i)===String.prototype.valueOf.call(s):Y(i)?Y(s)&&Boolean.prototype.valueOf.call(i)===Boolean.prototype.valueOf.call(s):X(i)?X(s)&&BigInt.prototype.valueOf.call(i)===BigInt.prototype.valueOf.call(s):me(s)&&Symbol.prototype.valueOf.call(i)===Symbol.prototype.valueOf.call(s)}function V(i,s,q,B){if(i===s)return i!==0?!0:q?e(i,s):!0;if(q){if(v(i)!=="object")return typeof i=="number"&&p(i)&&p(s);if(v(s)!=="object"||i===null||s===null||Object.getPrototypeOf(i)!==Object.getPrototypeOf(s))return!1}else{if(i===null||v(i)!=="object")return s===null||v(s)!=="object"?i==s:!1;if(s===null||v(s)!=="object")return!1}var M=A(i),F=A(s);if(M!==F)return!1;if(Array.isArray(i)){if(i.length!==s.length)return!1;var k=ce(i),$=ce(s);return k.length!==$.length?!1:J(i,s,q,B,H,k)}if(M==="[object Object]"&&(!x(i)&&x(s)||!T(i)&&T(s)))return!1;if(P(i)){if(!P(s)||Date.prototype.getTime.call(i)!==Date.prototype.getTime.call(s))return!1}else if(D(i)){if(!D(s)||!l(i,s))return!1}else if(z(i)||i instanceof Error){if(i.message!==s.message||i.name!==s.name)return!1}else if(E(i)){if(!q&&(we(i)||ae(i))){if(!I(i,s))return!1}else if(!O(i,s))return!1;var G=ce(i),Q=ce(s);return G.length!==Q.length?!1:J(i,s,q,B,N,G)}else{if(T(i))return!T(s)||i.size!==s.size?!1:J(i,s,q,B,f);if(x(i))return!x(s)||i.size!==s.size?!1:J(i,s,q,B,u);if(g(i)){if(!K(i,s))return!1}else if(C(i)&&!L(i,s))return!1}return J(i,s,q,B,N)}function W(i,s){return s.filter(function(q){return b(i,q)})}function J(i,s,q,B,M,F){if(arguments.length===5){F=Object.keys(i);var k=Object.keys(s);if(F.length!==k.length)return!1}for(var $=0;$<F.length;$++)if(!w(s,F[$]))return!1;if(q&&arguments.length===5){var G=c(i);if(G.length!==0){var Q=0;for($=0;$<G.length;$++){var re=G[$];if(b(i,re)){if(!b(s,re))return!1;F.push(re),Q++}else if(b(s,re))return!1}var Ke=c(s);if(G.length!==Ke.length&&W(s,Ke).length!==Q)return!1}else{var _e=c(s);if(_e.length!==0&&W(s,_e).length!==0)return!1}}if(F.length===0&&(M===N||M===H&&i.length===0||i.size===0))return!0;if(B===void 0)B={val1:new Map,val2:new Map,position:0};else{var je=B.val1.get(i);if(je!==void 0){var se=B.val2.get(s);if(se!==void 0)return je===se}B.position++}B.val1.set(i,B.position),B.val2.set(s,B.position);var Ne=ie(i,s,q,F,B,M);return B.val1.delete(i),B.val2.delete(s),Ne}function ee(i,s,q,B){for(var M=t(i),F=0;F<M.length;F++){var k=M[F];if(V(s,k,q,B))return i.delete(k),!0}return!1}function ve(i){switch(v(i)){case"undefined":return null;case"object":return;case"symbol":return!1;case"string":i=+i;case"number":if(p(i))return!1}return!0}function qe(i,s,q){var B=ve(q);return B??(s.has(B)&&!i.has(B))}function Ee(i,s,q,B,M){var F=ve(q);if(F!=null)return F;var k=s.get(F);return k===void 0&&!s.has(F)||!V(B,k,!1,M)?!1:!i.has(F)&&V(B,k,!1,M)}function ne(i,s,q,B){for(var M=null,F=t(i),k=0;k<F.length;k++){var $=F[k];if(v($)==="object"&&$!==null)M===null&&(M=new Set),M.add($);else if(!s.has($)){if(q||!qe(i,s,$))return!1;M===null&&(M=new Set),M.add($)}}if(M!==null){for(var G=t(s),Q=0;Q<G.length;Q++){var re=G[Q];if(v(re)==="object"&&re!==null){if(!ee(M,re,q,B))return!1}else if(!q&&!i.has(re)&&!ee(M,re,q,B))return!1}return M.size===0}return!0}function Ie(i,s,q,B,M,F){for(var k=t(i),$=0;$<k.length;$++){var G=k[$];if(V(q,G,M,F)&&V(B,s.get(G),M,F))return i.delete(G),!0}return!1}function Be(i,s,q,B){for(var M=null,F=r(i),k=0;k<F.length;k++){var $=n(F[k],2),G=$[0],Q=$[1];if(v(G)==="object"&&G!==null)M===null&&(M=new Set),M.add(G);else{var re=s.get(G);if(re===void 0&&!s.has(G)||!V(Q,re,q,B)){if(q||!Ee(i,s,G,Q,B))return!1;M===null&&(M=new Set),M.add(G)}}}if(M!==null){for(var Ke=r(s),_e=0;_e<Ke.length;_e++){var je=n(Ke[_e],2),se=je[0],Ne=je[1];if(v(se)==="object"&&se!==null){if(!Ie(M,i,se,Ne,q,B))return!1}else if(!q&&(!i.has(se)||!V(i.get(se),Ne,!1,B))&&!Ie(M,i,se,Ne,!1,B))return!1}return M.size===0}return!0}function ie(i,s,q,B,M,F){var k=0;if(F===f){if(!ne(i,s,q,M))return!1}else if(F===u){if(!Be(i,s,q,M))return!1}else if(F===H)for(;k<i.length;k++)if(w(i,k)){if(!w(s,k)||!V(i[k],s[k],q,M))return!1}else{if(w(s,k))return!1;for(var $=Object.keys(i);k<$.length;k++){var G=$[k];if(!w(s,G)||!V(i[G],s[G],q,M))return!1}return $.length===Object.keys(s).length}for(k=0;k<B.length;k++){var Q=B[k];if(!V(i[Q],s[Q],q,M))return!1}return!0}function be(i,s){return V(i,s,U)}function ue(i,s){return V(i,s,S)}return Xe={isDeepEqual:be,isDeepStrictEqual:ue},Xe}var Rr;function ur(){if(Rr)return Le.exports;Rr=1;function n(f){"@babel/helpers - typeof";return n=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(u){return typeof u}:function(u){return u&&typeof Symbol=="function"&&u.constructor===Symbol&&u!==Symbol.prototype?"symbol":typeof u},n(f)}function y(f,u,l){return Object.defineProperty(f,"prototype",{writable:!1}),f}function a(f,u){if(!(f instanceof u))throw new TypeError("Cannot call a class as a function")}var d=Jr(),R=d.codes,_=R.ERR_AMBIGUOUS_ARGUMENT,v=R.ERR_INVALID_ARG_TYPE,o=R.ERR_INVALID_ARG_VALUE,t=R.ERR_INVALID_RETURN_VALUE,r=R.ERR_MISSING_ARGS,e=Et(),c=Te(),p=c.inspect,h=Te().types,w=h.isPromise,b=h.isRegExp,A=mt()(),j=lr()(),g=ct()("RegExp.prototype.test"),E,P;function x(){var f=At();E=f.isDeepEqual,P=f.isDeepStrictEqual}var D=!1,T=Le.exports=Y,z={};function C(f){throw f.message instanceof Error?f.message:new e(f)}function Z(f,u,l,I,O){var K=arguments.length,L;if(K===0)L="Failed";else if(K===1)l=f,f=void 0;else{if(D===!1){D=!0;var V=oe.emitWarning?oe.emitWarning:console.warn.bind(console);V("assert.fail() with more than one argument is deprecated. Please use assert.strictEqual() instead or only pass a message.","DeprecationWarning","DEP0094")}K===2&&(I="!=")}if(l instanceof Error)throw l;var W={actual:f,expected:u,operator:I===void 0?"fail":I,stackStartFn:O||Z};l!==void 0&&(W.message=l);var J=new e(W);throw L&&(J.message=L,J.generatedMessage=!0),J}T.fail=Z,T.AssertionError=e;function te(f,u,l,I){if(!l){var O=!1;if(u===0)O=!0,I="No value argument passed to `assert.ok()`";else if(I instanceof Error)throw I;var K=new e({actual:l,expected:!0,message:I,operator:"==",stackStartFn:f});throw K.generatedMessage=O,K}}function Y(){for(var f=arguments.length,u=new Array(f),l=0;l<f;l++)u[l]=arguments[l];te.apply(void 0,[Y,u.length].concat(u))}T.ok=Y,T.equal=function f(u,l,I){if(arguments.length<2)throw new r("actual","expected");u!=l&&C({actual:u,expected:l,message:I,operator:"==",stackStartFn:f})},T.notEqual=function f(u,l,I){if(arguments.length<2)throw new r("actual","expected");u==l&&C({actual:u,expected:l,message:I,operator:"!=",stackStartFn:f})},T.deepEqual=function f(u,l,I){if(arguments.length<2)throw new r("actual","expected");E===void 0&&x(),E(u,l)||C({actual:u,expected:l,message:I,operator:"deepEqual",stackStartFn:f})},T.notDeepEqual=function f(u,l,I){if(arguments.length<2)throw new r("actual","expected");E===void 0&&x(),E(u,l)&&C({actual:u,expected:l,message:I,operator:"notDeepEqual",stackStartFn:f})},T.deepStrictEqual=function f(u,l,I){if(arguments.length<2)throw new r("actual","expected");E===void 0&&x(),P(u,l)||C({actual:u,expected:l,message:I,operator:"deepStrictEqual",stackStartFn:f})},T.notDeepStrictEqual=X;function X(f,u,l){if(arguments.length<2)throw new r("actual","expected");E===void 0&&x(),P(f,u)&&C({actual:f,expected:u,message:l,operator:"notDeepStrictEqual",stackStartFn:X})}T.strictEqual=function f(u,l,I){if(arguments.length<2)throw new r("actual","expected");j(u,l)||C({actual:u,expected:l,message:I,operator:"strictEqual",stackStartFn:f})},T.notStrictEqual=function f(u,l,I){if(arguments.length<2)throw new r("actual","expected");j(u,l)&&C({actual:u,expected:l,message:I,operator:"notStrictEqual",stackStartFn:f})};var me=y(function f(u,l,I){var O=this;a(this,f),l.forEach(function(K){K in u&&(I!==void 0&&typeof I[K]=="string"&&b(u[K])&&g(u[K],I[K])?O[K]=I[K]:O[K]=u[K])})});function we(f,u,l,I,O,K){if(!(l in f)||!P(f[l],u[l])){if(!I){var L=new me(f,O),V=new me(u,O,f),W=new e({actual:L,expected:V,operator:"deepStrictEqual",stackStartFn:K});throw W.actual=f,W.expected=u,W.operator=K.name,W}C({actual:f,expected:u,message:I,operator:K.name,stackStartFn:K})}}function ae(f,u,l,I){if(typeof u!="function"){if(b(u))return g(u,f);if(arguments.length===2)throw new v("expected",["Function","RegExp"],u);if(n(f)!=="object"||f===null){var O=new e({actual:f,expected:u,message:l,operator:"deepStrictEqual",stackStartFn:I});throw O.operator=I.name,O}var K=Object.keys(u);if(u instanceof Error)K.push("name","message");else if(K.length===0)throw new o("error",u,"may not be an empty object");return E===void 0&&x(),K.forEach(function(L){typeof f[L]=="string"&&b(u[L])&&g(u[L],f[L])||we(f,u,L,l,K,I)}),!0}return u.prototype!==void 0&&f instanceof u?!0:Error.isPrototypeOf(u)?!1:u.call({},f)===!0}function Se(f){if(typeof f!="function")throw new v("fn","Function",f);try{f()}catch(u){return u}return z}function ce(f){return w(f)||f!==null&&n(f)==="object"&&typeof f.then=="function"&&typeof f.catch=="function"}function m(f){return Promise.resolve().then(function(){var u;if(typeof f=="function"){if(u=f(),!ce(u))throw new t("instance of Promise","promiseFn",u)}else if(ce(f))u=f;else throw new v("promiseFn",["Function","Promise"],f);return Promise.resolve().then(function(){return u}).then(function(){return z}).catch(function(l){return l})})}function S(f,u,l,I){if(typeof l=="string"){if(arguments.length===4)throw new v("error",["Object","Error","Function","RegExp"],l);if(n(u)==="object"&&u!==null){if(u.message===l)throw new _("error/message",'The error message "'.concat(u.message,'" is identical to the message.'))}else if(u===l)throw new _("error/message",'The error "'.concat(u,'" is identical to the message.'));I=l,l=void 0}else if(l!=null&&n(l)!=="object"&&typeof l!="function")throw new v("error",["Object","Error","Function","RegExp"],l);if(u===z){var O="";l&&l.name&&(O+=" (".concat(l.name,")")),O+=I?": ".concat(I):".";var K=f.name==="rejects"?"rejection":"exception";C({actual:void 0,expected:l,operator:f.name,message:"Missing expected ".concat(K).concat(O),stackStartFn:f})}if(l&&!ae(u,l,I,f))throw u}function U(f,u,l,I){if(u!==z){if(typeof l=="string"&&(I=l,l=void 0),!l||ae(u,l)){var O=I?": ".concat(I):".",K=f.name==="doesNotReject"?"rejection":"exception";C({actual:u,expected:l,operator:f.name,message:"Got unwanted ".concat(K).concat(O,`
54
+ `)+'Actual message: "'.concat(u&&u.message,'"'),stackStartFn:f})}throw u}}T.throws=function f(u){for(var l=arguments.length,I=new Array(l>1?l-1:0),O=1;O<l;O++)I[O-1]=arguments[O];S.apply(void 0,[f,Se(u)].concat(I))},T.rejects=function f(u){for(var l=arguments.length,I=new Array(l>1?l-1:0),O=1;O<l;O++)I[O-1]=arguments[O];return m(u).then(function(K){return S.apply(void 0,[f,K].concat(I))})},T.doesNotThrow=function f(u){for(var l=arguments.length,I=new Array(l>1?l-1:0),O=1;O<l;O++)I[O-1]=arguments[O];U.apply(void 0,[f,Se(u)].concat(I))},T.doesNotReject=function f(u){for(var l=arguments.length,I=new Array(l>1?l-1:0),O=1;O<l;O++)I[O-1]=arguments[O];return m(u).then(function(K){return U.apply(void 0,[f,K].concat(I))})},T.ifError=function f(u){if(u!=null){var l="ifError got unwanted exception: ";n(u)==="object"&&typeof u.message=="string"?u.message.length===0&&u.constructor?l+=u.constructor.name:l+=u.message:l+=p(u);var I=new e({actual:u,expected:null,operator:"ifError",message:l,stackStartFn:f}),O=u.stack;if(typeof O=="string"){var K=O.split(`
55
+ `);K.shift();for(var L=I.stack.split(`
56
+ `),V=0;V<K.length;V++){var W=L.indexOf(K[V]);if(W!==-1){L=L.slice(0,W);break}}I.stack="".concat(L.join(`
57
+ `),`
58
+ `).concat(K.join(`
59
+ `))}throw I}};function N(f,u,l,I,O){if(!b(u))throw new v("regexp","RegExp",u);var K=O==="match";if(typeof f!="string"||g(u,f)!==K){if(l instanceof Error)throw l;var L=!l;l=l||(typeof f!="string"?'The "string" argument must be of type string. Received type '+"".concat(n(f)," (").concat(p(f),")"):(K?"The input did not match the regular expression ":"The input was expected to not match the regular expression ")+"".concat(p(u),`. Input:
60
+
61
+ `).concat(p(f),`
62
+ `));var V=new e({actual:f,expected:u,message:l,operator:O,stackStartFn:I});throw V.generatedMessage=L,V}}T.match=function f(u,l,I){N(u,l,I,f,"match")},T.doesNotMatch=function f(u,l,I){N(u,l,I,f,"doesNotMatch")};function H(){for(var f=arguments.length,u=new Array(f),l=0;l<f;l++)u[l]=arguments[l];te.apply(void 0,[H,u.length].concat(u))}return T.strict=A(H,T,{equal:T.strictEqual,deepEqual:T.deepStrictEqual,notEqual:T.notStrictEqual,notDeepEqual:T.notDeepStrictEqual}),T.strict.strict=T.strict,Le.exports}var Qe,qr;function Pt(){if(qr)return Qe;qr=1;var n=sr().Buffer;function y(a){if(a.length>=255)throw new TypeError("Alphabet too long");for(var d=new Uint8Array(256),R=0;R<d.length;R++)d[R]=255;for(var _=0;_<a.length;_++){var v=a.charAt(_),o=v.charCodeAt(0);if(d[o]!==255)throw new TypeError(v+" is ambiguous");d[o]=_}var t=a.length,r=a.charAt(0),e=Math.log(t)/Math.log(256),c=Math.log(256)/Math.log(t);function p(b){if((Array.isArray(b)||b instanceof Uint8Array)&&(b=n.from(b)),!n.isBuffer(b))throw new TypeError("Expected Buffer");if(b.length===0)return"";for(var A=0,j=0,g=0,E=b.length;g!==E&&b[g]===0;)g++,A++;for(var P=(E-g)*c+1>>>0,x=new Uint8Array(P);g!==E;){for(var D=b[g],T=0,z=P-1;(D!==0||T<j)&&z!==-1;z--,T++)D+=256*x[z]>>>0,x[z]=D%t>>>0,D=D/t>>>0;if(D!==0)throw new Error("Non-zero carry");j=T,g++}for(var C=P-j;C!==P&&x[C]===0;)C++;for(var Z=r.repeat(A);C<P;++C)Z+=a.charAt(x[C]);return Z}function h(b){if(typeof b!="string")throw new TypeError("Expected String");if(b.length===0)return n.alloc(0);for(var A=0,j=0,g=0;b[A]===r;)j++,A++;for(var E=(b.length-A)*e+1>>>0,P=new Uint8Array(E);A<b.length;){var x=d[b.charCodeAt(A)];if(x===255)return;for(var D=0,T=E-1;(x!==0||D<g)&&T!==-1;T--,D++)x+=t*P[T]>>>0,P[T]=x%256>>>0,x=x/256>>>0;if(x!==0)throw new Error("Non-zero carry");g=D,A++}for(var z=E-g;z!==E&&P[z]===0;)z++;var C=n.allocUnsafe(j+(E-z));C.fill(0,0,j);for(var Z=j;z!==E;)C[Z++]=P[z++];return C}function w(b){var A=h(b);if(A)return A;throw new Error("Non-base"+t+" character")}return{encode:p,decodeUnsafe:h,decode:w}}return Qe=y,Qe}var er,Ir;function Rt(){if(Ir)return er;Ir=1;var n=Pt(),y="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";return er=n(y),er}var rr,Kr;function qt(){if(Kr)return rr;Kr=1;var n=Rt(),y=sr().Buffer;return rr=function(a){function d(o){var t=a(o);return n.encode(y.concat([o,t],o.length+4))}function R(o){var t=o.slice(0,-4),r=o.slice(-4),e=a(t);if(!(r[0]^e[0]|r[1]^e[1]|r[2]^e[2]|r[3]^e[3]))return t}function _(o){var t=n.decodeUnsafe(o);if(t)return R(t)}function v(o){var t=n.decode(o),r=R(t);if(!r)throw new Error("Invalid checksum");return r}return{encode:d,decode:v,decodeUnsafe:_}},rr}var tr,jr;function It(){if(jr)return tr;jr=1;var n=ut(),y=qt();function a(d){var R=n("sha256").update(d).digest();return n("sha256").update(R).digest()}return tr=y(a),tr}var nr,Nr;function Kt(){if(Nr)return nr;Nr=1;const n={IMPOSSIBLE_CASE:"Impossible case. Please create issue.",TWEAK_ADD:"The tweak was out of range or the resulted private key is invalid",TWEAK_MUL:"The tweak was out of range or equal to zero",CONTEXT_RANDOMIZE_UNKNOW:"Unknow error on context randomization",SECKEY_INVALID:"Private Key is invalid",PUBKEY_PARSE:"Public Key could not be parsed",PUBKEY_SERIALIZE:"Public Key serialization error",PUBKEY_COMBINE:"The sum of the public keys is not valid",SIG_PARSE:"Signature could not be parsed",SIGN:"The nonce generation function failed, or the private key was invalid",RECOVER:"Public key could not be recover",ECDH:"Scalar was invalid (zero or overflow)"};function y(v,o){if(!v)throw new Error(o)}function a(v,o,t){if(y(o instanceof Uint8Array,`Expected ${v} to be an Uint8Array`),t!==void 0)if(Array.isArray(t)){const r=t.join(", "),e=`Expected ${v} to be an Uint8Array with length [${r}]`;y(t.includes(o.length),e)}else{const r=`Expected ${v} to be an Uint8Array with length ${t}`;y(o.length===t,r)}}function d(v){y(_(v)==="Boolean","Expected compressed to be a Boolean")}function R(v=t=>new Uint8Array(t),o){return typeof v=="function"&&(v=v(o)),a("output",v,o),v}function _(v){return Object.prototype.toString.call(v).slice(8,-1)}return nr=v=>({contextRandomize(o){switch(y(o===null||o instanceof Uint8Array,"Expected seed to be an Uint8Array or null"),o!==null&&a("seed",o,32),v.contextRandomize(o)){case 1:throw new Error(n.CONTEXT_RANDOMIZE_UNKNOW)}},privateKeyVerify(o){return a("private key",o,32),v.privateKeyVerify(o)===0},privateKeyNegate(o){switch(a("private key",o,32),v.privateKeyNegate(o)){case 0:return o;case 1:throw new Error(n.IMPOSSIBLE_CASE)}},privateKeyTweakAdd(o,t){switch(a("private key",o,32),a("tweak",t,32),v.privateKeyTweakAdd(o,t)){case 0:return o;case 1:throw new Error(n.TWEAK_ADD)}},privateKeyTweakMul(o,t){switch(a("private key",o,32),a("tweak",t,32),v.privateKeyTweakMul(o,t)){case 0:return o;case 1:throw new Error(n.TWEAK_MUL)}},publicKeyVerify(o){return a("public key",o,[33,65]),v.publicKeyVerify(o)===0},publicKeyCreate(o,t=!0,r){switch(a("private key",o,32),d(t),r=R(r,t?33:65),v.publicKeyCreate(r,o)){case 0:return r;case 1:throw new Error(n.SECKEY_INVALID);case 2:throw new Error(n.PUBKEY_SERIALIZE)}},publicKeyConvert(o,t=!0,r){switch(a("public key",o,[33,65]),d(t),r=R(r,t?33:65),v.publicKeyConvert(r,o)){case 0:return r;case 1:throw new Error(n.PUBKEY_PARSE);case 2:throw new Error(n.PUBKEY_SERIALIZE)}},publicKeyNegate(o,t=!0,r){switch(a("public key",o,[33,65]),d(t),r=R(r,t?33:65),v.publicKeyNegate(r,o)){case 0:return r;case 1:throw new Error(n.PUBKEY_PARSE);case 2:throw new Error(n.IMPOSSIBLE_CASE);case 3:throw new Error(n.PUBKEY_SERIALIZE)}},publicKeyCombine(o,t=!0,r){y(Array.isArray(o),"Expected public keys to be an Array"),y(o.length>0,"Expected public keys array will have more than zero items");for(const e of o)a("public key",e,[33,65]);switch(d(t),r=R(r,t?33:65),v.publicKeyCombine(r,o)){case 0:return r;case 1:throw new Error(n.PUBKEY_PARSE);case 2:throw new Error(n.PUBKEY_COMBINE);case 3:throw new Error(n.PUBKEY_SERIALIZE)}},publicKeyTweakAdd(o,t,r=!0,e){switch(a("public key",o,[33,65]),a("tweak",t,32),d(r),e=R(e,r?33:65),v.publicKeyTweakAdd(e,o,t)){case 0:return e;case 1:throw new Error(n.PUBKEY_PARSE);case 2:throw new Error(n.TWEAK_ADD)}},publicKeyTweakMul(o,t,r=!0,e){switch(a("public key",o,[33,65]),a("tweak",t,32),d(r),e=R(e,r?33:65),v.publicKeyTweakMul(e,o,t)){case 0:return e;case 1:throw new Error(n.PUBKEY_PARSE);case 2:throw new Error(n.TWEAK_MUL)}},signatureNormalize(o){switch(a("signature",o,64),v.signatureNormalize(o)){case 0:return o;case 1:throw new Error(n.SIG_PARSE)}},signatureExport(o,t){a("signature",o,64),t=R(t,72);const r={output:t,outputlen:72};switch(v.signatureExport(r,o)){case 0:return t.slice(0,r.outputlen);case 1:throw new Error(n.SIG_PARSE);case 2:throw new Error(n.IMPOSSIBLE_CASE)}},signatureImport(o,t){switch(a("signature",o),t=R(t,64),v.signatureImport(t,o)){case 0:return t;case 1:throw new Error(n.SIG_PARSE);case 2:throw new Error(n.IMPOSSIBLE_CASE)}},ecdsaSign(o,t,r={},e){a("message",o,32),a("private key",t,32),y(_(r)==="Object","Expected options to be an Object"),r.data!==void 0&&a("options.data",r.data),r.noncefn!==void 0&&y(_(r.noncefn)==="Function","Expected options.noncefn to be a Function"),e=R(e,64);const c={signature:e,recid:null};switch(v.ecdsaSign(c,o,t,r.data,r.noncefn)){case 0:return c;case 1:throw new Error(n.SIGN);case 2:throw new Error(n.IMPOSSIBLE_CASE)}},ecdsaVerify(o,t,r){switch(a("signature",o,64),a("message",t,32),a("public key",r,[33,65]),v.ecdsaVerify(o,t,r)){case 0:return!0;case 3:return!1;case 1:throw new Error(n.SIG_PARSE);case 2:throw new Error(n.PUBKEY_PARSE)}},ecdsaRecover(o,t,r,e=!0,c){switch(a("signature",o,64),y(_(t)==="Number"&&t>=0&&t<=3,"Expected recovery id to be a Number within interval [0, 3]"),a("message",r,32),d(e),c=R(c,e?33:65),v.ecdsaRecover(c,o,t,r)){case 0:return c;case 1:throw new Error(n.SIG_PARSE);case 2:throw new Error(n.RECOVER);case 3:throw new Error(n.IMPOSSIBLE_CASE)}},ecdh(o,t,r={},e){switch(a("public key",o,[33,65]),a("private key",t,32),y(_(r)==="Object","Expected options to be an Object"),r.data!==void 0&&a("options.data",r.data),r.hashfn!==void 0?(y(_(r.hashfn)==="Function","Expected options.hashfn to be a Function"),r.xbuf!==void 0&&a("options.xbuf",r.xbuf,32),r.ybuf!==void 0&&a("options.ybuf",r.ybuf,32),a("output",e)):e=R(e,32),v.ecdh(e,o,t,r.data,r.hashfn,r.xbuf,r.ybuf)){case 0:return e;case 1:throw new Error(n.PUBKEY_PARSE);case 2:throw new Error(n.ECDH)}}}),nr}var ir,xr;function jt(){if(xr)return ir;xr=1;const n=Yr().ec,y=new n("secp256k1"),a=y.curve,d=a.n.constructor;function R(t,r){let e=new d(r);if(e.cmp(a.p)>=0)return null;e=e.toRed(a.red);let c=e.redSqr().redIMul(e).redIAdd(a.b).redSqrt();return t===3!==c.isOdd()&&(c=c.redNeg()),y.keyPair({pub:{x:e,y:c}})}function _(t,r,e){let c=new d(r),p=new d(e);if(c.cmp(a.p)>=0||p.cmp(a.p)>=0||(c=c.toRed(a.red),p=p.toRed(a.red),(t===6||t===7)&&p.isOdd()!==(t===7)))return null;const h=c.redSqr().redIMul(c);return p.redSqr().redISub(h.redIAdd(a.b)).isZero()?y.keyPair({pub:{x:c,y:p}}):null}function v(t){const r=t[0];switch(r){case 2:case 3:return t.length!==33?null:R(r,t.subarray(1,33));case 4:case 6:case 7:return t.length!==65?null:_(r,t.subarray(1,33),t.subarray(33,65));default:return null}}function o(t,r){const e=r.encode(null,t.length===33);for(let c=0;c<t.length;++c)t[c]=e[c]}return ir={contextRandomize(){return 0},privateKeyVerify(t){const r=new d(t);return r.cmp(a.n)<0&&!r.isZero()?0:1},privateKeyNegate(t){const r=new d(t),e=a.n.sub(r).umod(a.n).toArrayLike(Uint8Array,"be",32);return t.set(e),0},privateKeyTweakAdd(t,r){const e=new d(r);if(e.cmp(a.n)>=0||(e.iadd(new d(t)),e.cmp(a.n)>=0&&e.isub(a.n),e.isZero()))return 1;const c=e.toArrayLike(Uint8Array,"be",32);return t.set(c),0},privateKeyTweakMul(t,r){let e=new d(r);if(e.cmp(a.n)>=0||e.isZero())return 1;e.imul(new d(t)),e.cmp(a.n)>=0&&(e=e.umod(a.n));const c=e.toArrayLike(Uint8Array,"be",32);return t.set(c),0},publicKeyVerify(t){return v(t)===null?1:0},publicKeyCreate(t,r){const e=new d(r);if(e.cmp(a.n)>=0||e.isZero())return 1;const c=y.keyFromPrivate(r).getPublic();return o(t,c),0},publicKeyConvert(t,r){const e=v(r);if(e===null)return 1;const c=e.getPublic();return o(t,c),0},publicKeyNegate(t,r){const e=v(r);if(e===null)return 1;const c=e.getPublic();return c.y=c.y.redNeg(),o(t,c),0},publicKeyCombine(t,r){const e=new Array(r.length);for(let p=0;p<r.length;++p)if(e[p]=v(r[p]),e[p]===null)return 1;let c=e[0].getPublic();for(let p=1;p<e.length;++p)c=c.add(e[p].pub);return c.isInfinity()?2:(o(t,c),0)},publicKeyTweakAdd(t,r,e){const c=v(r);if(c===null)return 1;if(e=new d(e),e.cmp(a.n)>=0)return 2;const p=c.getPublic().add(a.g.mul(e));return p.isInfinity()?2:(o(t,p),0)},publicKeyTweakMul(t,r,e){const c=v(r);if(c===null)return 1;if(e=new d(e),e.cmp(a.n)>=0||e.isZero())return 2;const p=c.getPublic().mul(e);return o(t,p),0},signatureNormalize(t){const r=new d(t.subarray(0,32)),e=new d(t.subarray(32,64));return r.cmp(a.n)>=0||e.cmp(a.n)>=0?1:(e.cmp(y.nh)===1&&t.set(a.n.sub(e).toArrayLike(Uint8Array,"be",32),32),0)},signatureExport(t,r){const e=r.subarray(0,32),c=r.subarray(32,64);if(new d(e).cmp(a.n)>=0||new d(c).cmp(a.n)>=0)return 1;const{output:p}=t;let h=p.subarray(4,37);h[0]=0,h.set(e,1);let w=33,b=0;for(;w>1&&h[b]===0&&!(h[b+1]&128);--w,++b);if(h=h.subarray(b),h[0]&128||w>1&&h[0]===0&&!(h[1]&128))return 1;let A=p.subarray(39,72);A[0]=0,A.set(c,1);let j=33,g=0;for(;j>1&&A[g]===0&&!(A[g+1]&128);--j,++g);return A=A.subarray(g),A[0]&128||j>1&&A[0]===0&&!(A[1]&128)?1:(t.outputlen=6+w+j,p[0]=48,p[1]=t.outputlen-2,p[2]=2,p[3]=h.length,p.set(h,4),p[4+w]=2,p[5+w]=A.length,p.set(A,6+w),0)},signatureImport(t,r){if(r.length<8||r.length>72||r[0]!==48||r[1]!==r.length-2||r[2]!==2)return 1;const e=r[3];if(e===0||5+e>=r.length||r[4+e]!==2)return 1;const c=r[5+e];if(c===0||6+e+c!==r.length||r[4]&128||e>1&&r[4]===0&&!(r[5]&128)||r[e+6]&128||c>1&&r[e+6]===0&&!(r[e+7]&128))return 1;let p=r.subarray(4,4+e);if(p.length===33&&p[0]===0&&(p=p.subarray(1)),p.length>32)return 1;let h=r.subarray(6+e);if(h.length===33&&h[0]===0&&(h=h.slice(1)),h.length>32)throw new Error("S length is too long");let w=new d(p);w.cmp(a.n)>=0&&(w=new d(0));let b=new d(r.subarray(6+e));return b.cmp(a.n)>=0&&(b=new d(0)),t.set(w.toArrayLike(Uint8Array,"be",32),0),t.set(b.toArrayLike(Uint8Array,"be",32),32),0},ecdsaSign(t,r,e,c,p){if(p){const b=p;p=A=>{const j=b(r,e,null,c,A);if(!(j instanceof Uint8Array&&j.length===32))throw new Error("This is the way");return new d(j)}}const h=new d(e);if(h.cmp(a.n)>=0||h.isZero())return 1;let w;try{w=y.sign(r,e,{canonical:!0,k:p,pers:c})}catch{return 1}return t.signature.set(w.r.toArrayLike(Uint8Array,"be",32),0),t.signature.set(w.s.toArrayLike(Uint8Array,"be",32),32),t.recid=w.recoveryParam,0},ecdsaVerify(t,r,e){const c={r:t.subarray(0,32),s:t.subarray(32,64)},p=new d(c.r),h=new d(c.s);if(p.cmp(a.n)>=0||h.cmp(a.n)>=0)return 1;if(h.cmp(y.nh)===1||p.isZero()||h.isZero())return 3;const w=v(e);if(w===null)return 2;const b=w.getPublic();return y.verify(r,c,b)?0:3},ecdsaRecover(t,r,e,c){const p={r:r.slice(0,32),s:r.slice(32,64)},h=new d(p.r),w=new d(p.s);if(h.cmp(a.n)>=0||w.cmp(a.n)>=0)return 1;if(h.isZero()||w.isZero())return 2;let b;try{b=y.recoverPubKey(c,p,e)}catch{return 2}return o(t,b),0},ecdh(t,r,e,c,p,h,w){const b=v(r);if(b===null)return 1;const A=new d(e);if(A.cmp(a.n)>=0||A.isZero())return 2;const j=b.getPublic().mul(A);if(p===void 0){const g=j.encode(null,!0),E=y.hash().update(g).digest();for(let P=0;P<32;++P)t[P]=E[P]}else{h||(h=new Uint8Array(32));const g=j.getX().toArray("be",32);for(let D=0;D<32;++D)h[D]=g[D];w||(w=new Uint8Array(32));const E=j.getY().toArray("be",32);for(let D=0;D<32;++D)w[D]=E[D];const P=p(h,w,c);if(!(P instanceof Uint8Array&&P.length===t.length))return 2;t.set(P)}return 0}},ir}var ar,Tr;function Nt(){return Tr||(Tr=1,ar=Kt()(jt())),ar}var or,Br;function xt(){if(Br)return or;Br=1;var n=ur(),y=sr().Buffer,a=st(),d=ft(),R=It(),_=Nt(),v=y.from("Bitcoin seed","utf8"),o=2147483648,t=78,r={private:76066276,public:76067358};function e(h){this.versions=h||r,this.depth=0,this.index=0,this._privateKey=null,this._publicKey=null,this.chainCode=null,this._fingerprint=0,this.parentFingerprint=0}Object.defineProperty(e.prototype,"fingerprint",{get:function(){return this._fingerprint}}),Object.defineProperty(e.prototype,"identifier",{get:function(){return this._identifier}}),Object.defineProperty(e.prototype,"pubKeyHash",{get:function(){return this.identifier}}),Object.defineProperty(e.prototype,"privateKey",{get:function(){return this._privateKey},set:function(h){h=Uint8Array.from(h),n.equal(h.length,32,"Private key must be 32 bytes."),n(_.privateKeyVerify(h)===!0,"Invalid private key"),this._privateKey=y.from(h),this._publicKey=y.from(_.publicKeyCreate(h,!0)),this._identifier=p(this.publicKey),this._fingerprint=this._identifier.slice(0,4).readUInt32BE(0)}}),Object.defineProperty(e.prototype,"publicKey",{get:function(){return this._publicKey},set:function(h){n(h.length===33||h.length===65,"Public key must be 33 or 65 bytes."),n(_.publicKeyVerify(h)===!0,"Invalid public key"),this._publicKey=y.from(_.publicKeyConvert(h,!0)),this._identifier=p(this.publicKey),this._fingerprint=this._identifier.slice(0,4).readUInt32BE(0),this._privateKey=null}}),Object.defineProperty(e.prototype,"privateExtendedKey",{get:function(){return this._privateKey?R.encode(c(this,this.versions.private,y.concat([y.alloc(1,0),this.privateKey]))):null}}),Object.defineProperty(e.prototype,"publicExtendedKey",{get:function(){return R.encode(c(this,this.versions.public,this.publicKey))}}),e.prototype.derive=function(h){if(h==="m"||h==="M"||h==="m'"||h==="M'")return this;var w=h.split("/"),b=this;return w.forEach(function(A,j){if(j===0){n(/^[mM]{1}/.test(A),'Path must start with "m" or "M"');return}var g=A.length>1&&A[A.length-1]==="'",E=parseInt(A,10);n(E<o,"Invalid index"),g&&(E+=o),b=b.deriveChild(E)}),b},e.prototype.deriveChild=function(h){var w=h>=o,b=y.allocUnsafe(4);b.writeUInt32BE(h,0);var A;if(w){n(this.privateKey,"Could not derive hardened child key");var j=y.from(this.privateKey),g=y.alloc(1,0);j=y.concat([g,j]),A=y.concat([j,b])}else A=y.concat([this.publicKey,b]);var E=a.createHmac("sha512",this.chainCode).update(A).digest(),P=E.slice(0,32),x=E.slice(32),D=new e(this.versions);if(this.privateKey)try{D.privateKey=y.from(_.privateKeyTweakAdd(y.from(this.privateKey),P))}catch{return this.deriveChild(h+1)}else try{D.publicKey=y.from(_.publicKeyTweakAdd(y.from(this.publicKey),P,!0))}catch{return this.deriveChild(h+1)}return D.chainCode=x,D.depth=this.depth+1,D.parentFingerprint=this.fingerprint,D.index=h,D},e.prototype.sign=function(h){return y.from(_.ecdsaSign(h,this.privateKey).signature)},e.prototype.verify=function(h,w){return _.ecdsaVerify(Uint8Array.from(w),Uint8Array.from(h),Uint8Array.from(this.publicKey))},e.prototype.wipePrivateData=function(){return this._privateKey&&a.randomBytes(this._privateKey.length).copy(this._privateKey),this._privateKey=null,this},e.prototype.toJSON=function(){return{xpriv:this.privateExtendedKey,xpub:this.publicExtendedKey}},e.fromMasterSeed=function(h,w){var b=a.createHmac("sha512",v).update(h).digest(),A=b.slice(0,32),j=b.slice(32),g=new e(w);return g.chainCode=j,g.privateKey=A,g},e.fromExtendedKey=function(h,w){w=w||r;var b=new e(w),A=R.decode(h),j=A.readUInt32BE(0);n(j===w.private||j===w.public,"Version mismatch: does not match private or public"),b.depth=A.readUInt8(4),b.parentFingerprint=A.readUInt32BE(5),b.index=A.readUInt32BE(9),b.chainCode=A.slice(13,45);var g=A.slice(45);return g.readUInt8(0)===0?(n(j===w.private,"Version mismatch: version does not match private"),b.privateKey=y.from(g.slice(1))):(n(j===w.public,"Version mismatch: version does not match public"),b.publicKey=y.from(g)),b},e.fromJSON=function(h){return e.fromExtendedKey(h.xpriv)};function c(h,w,b){var A=y.allocUnsafe(t);A.writeUInt32BE(w,0),A.writeUInt8(h.depth,4);var j=h.depth?h.parentFingerprint:0;return A.writeUInt32BE(j,5),A.writeUInt32BE(h.index,9),h.chainCode.copy(A,13),b.copy(A,45),A}function p(h){var w=a.createHash("sha256").update(h).digest();return new d().update(w).digest()}return e.HARDENED_OFFSET=o,or=e,or}var xe={},Ue={},Ur;function Re(){if(Ur)return Ue;Ur=1,Object.defineProperty(Ue,"__esModule",{value:!0}),Ue.encode=y;const n=fe();function y(a,d="hex"){return["hex","base16"].includes(d)?(0,n.toHex)(a):d==="base58"?(0,n.toBase58)(a):d==="base64"?(0,n.toBase64)(a):d==="Uint8Array"?(0,n.toUint8Array)(a):d==="buffer"?(0,n.toBuffer)(a):a}return Ue}var le={},Dr;function Tt(){if(Dr)return le;Dr=1;var n=le&&le.__importDefault||function(_){return _&&_.__esModule?_:{default:_}};Object.defineProperty(le,"__esModule",{value:!0}),le.KeccakHasher=void 0;const y=n(Zr()),a=fe(),d=Re();class R{constructor(){[224,256,384,512].forEach(v=>{const o=`hash${v}`,t=e=>y.default[`keccak${v}`](e),r=(e,c)=>c===1?t(e):r(t(e),c-1);this[o]=(e,c=1,p="hex")=>{let h=e;try{h=(0,a.toUint8Array)(e)}catch{}const w=r(h,c);return(0,d.encode)(`0x${w}`,p)}})}}return le.KeccakHasher=R,le.default=new R,le}var Oe={},Lr;function Bt(){if(Lr)return Oe;Lr=1,Object.defineProperty(Oe,"__esModule",{value:!0}),Oe.Sha2Hasher=void 0;const n=fe(),y=lt(),a=Re(),d={sha224:y.sha224,sha256:y.sha256,sha384:y.sha384,sha512:y.sha512};class R{constructor(){[224,256,384,512].forEach(v=>{const o=`hash${v}`,t=d[`sha${v}`],r=(e,c)=>{let p=e;try{p=(0,n.toUint8Array)(e)}catch{}return c===1?`0x${t().update(p).digest("hex")}`:r(r(p,1),c-1)};this[o]=(e,c=2,p="hex")=>{const h=r(e,c);return(0,a.encode)(h,p)}})}}return Oe.Sha2Hasher=R,Oe.default=new R,Oe}var he={},Mr;function Ut(){if(Mr)return he;Mr=1;var n=he&&he.__importDefault||function(_){return _&&_.__esModule?_:{default:_}};Object.defineProperty(he,"__esModule",{value:!0}),he.Sha3Hasher=void 0;const y=n(Zr()),a=fe(),d=Re();class R{constructor(){[224,256,384,512].forEach(v=>{const o=`hash${v}`,t=y.default[`sha3_${v}`],r=(e,c)=>c===1?t(e):r(t(e),c-1);this[o]=(e,c=1,p="hex")=>{let h=e;try{h=(0,a.toUint8Array)(e)}catch{}const w=r(h,c);return(0,d.encode)(`0x${w}`,p)}})}}return he.Sha3Hasher=R,he.default=new R,he}var pe={},Ae={},Hr;function hr(){if(Hr)return Ae;Hr=1;var n=Ae&&Ae.__importDefault||function(a){return a&&a.__esModule?a:{default:a}};Object.defineProperty(Ae,"__esModule",{value:!0});const y=n(ht());return Ae.default=y.default.create("genKeyPair","getPublicKey","sign","verify"),Ae}var Cr;function Dt(){if(Cr)return pe;Cr=1;var n=pe&&pe.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(pe,"__esModule",{value:!0}),pe.Ed25519Signer=void 0;const y=n(pt()),a=n(fr()),d=fe(),R=n(hr()),_=Re(),v=y.default.sign;class o extends R.default{constructor(){super()}genKeyPair(r="hex",e){const c=e?(0,d.toUint8Array)(e):new Uint8Array((0,a.default)(32));if(c.byteLength!==32)throw new Error("Invalid seed to generate key pair");const p=v.keyPair.fromSeed(c);return p.publicKey=(0,_.encode)(p.publicKey,r),p.secretKey=(0,_.encode)(p.secretKey,r),p}getPublicKey(r,e="hex"){const c=(0,d.toUint8Array)(r),p=v.keyPair.fromSecretKey(c).publicKey;return(0,_.encode)(p,e)}sign(r,e,c="hex"){const p=(0,d.toUint8Array)(e),h=(0,d.toUint8Array)(r),w=v.detached(h,p);return(0,_.encode)(w,c)}verify(r,e,c){const p=(0,d.toUint8Array)(c),h=(0,d.toUint8Array)(r),w=(0,d.toUint8Array)(e);return v.detached.verify(h,w,p)}}return pe.Ed25519Signer=o,pe.default=new o,pe}var ye={},de={},kr;function rt(){if(kr)return de;kr=1;var n=de&&de.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(de,"__esModule",{value:!0}),de.Secp256k1Signer=void 0;const y=n(Yr()),a=fe(),d=n(fr()),R=n(hr()),_=Re(),v=y.default.ec,o=new v("secp256k1");class t extends R.default{constructor(){super(),this.pkHasFormatPrefix=!0,this.pkCompressed=!1}isValidSK(e){if(e.byteLength!==32)return!1;const c=new a.BN(e);return c.cmp(o.curve.n)<0&&!c.isZero()}genKeyPair(e="hex"){let c=null;do c=new Uint8Array((0,d.default)(32));while(!this.isValidSK(c));const p=this.getPublicKey((0,a.toHex)(c));return{secretKey:(0,_.encode)(c,e),publicKey:(0,_.encode)(p,e)}}getPublicKey(e,c="hex"){if(!this.isValidSK((0,a.toUint8Array)(e)))throw new Error("Invalid secret key");let p=o.keyFromPrivate((0,a.toBuffer)(e)).getPublic(this.pkCompressed,"hex");return this.pkHasFormatPrefix===!1&&(p=p.slice(2)),(0,_.encode)(`0x${p}`,c)}sign(e,c,p="hex"){let h=e;try{h=(0,a.toUint8Array)(e)}catch{}const w=o.keyFromPrivate((0,a.toBuffer)(c)).sign((0,a.stripHexPrefix)(h),{canonical:!0}).toDER("hex");return(0,_.encode)(`0x${w}`,p)}verify(e,c,p){let h=e;try{h=(0,a.toUint8Array)(e)}catch{}let w=(0,a.toBuffer)(p);return this.pkHasFormatPrefix===!1&&w[0]!==4&&w.byteLength===64&&(w=Pe.concat([Pe.from([4]),w])),o.keyFromPublic(w).verify((0,a.stripHexPrefix)(h),(0,a.stripHexPrefix)((0,a.toHex)(c)))}}return de.Secp256k1Signer=t,de.default=new t,de}var Fr;function Lt(){if(Fr)return ye;Fr=1;var n=ye&&ye.__importDefault||function(v){return v&&v.__esModule?v:{default:v}};Object.defineProperty(ye,"__esModule",{value:!0}),ye.EthereumSigner=void 0;const y=n(yt()),a=n(dt()),d=fe(),R=rt();class _ extends R.Secp256k1Signer{constructor(){super(),this.pkHasFormatPrefix=!1}ethHash(o){const t=(0,d.isHexStrict)(o)?o:(0,d.utf8ToHex)(o),r=(0,d.hexToBytes)(t),e=Pe.from(r),c=`Ethereum Signed Message:
63
+ ${r.length}`,p=Pe.from(c),h=Pe.concat([p,e]);return a.default.keccak256s(h)}ethSign(o,t){return y.default.sign(o,t)}ethRecover(o,t){return y.default.recover(o,t)}}return ye.EthereumSigner=_,ye.default=new _,ye}var ge={},$r;function Mt(){if($r)return ge;$r=1;var n=ge&&ge.__importDefault||function(_){return _&&_.__esModule?_:{default:_}};Object.defineProperty(ge,"__esModule",{value:!0}),ge.PasskeySigner=void 0;const y=fe(),a=gt(),d=n(hr());class R extends d.default{constructor(){super()}genKeyPair(v="hex",o){throw new Error("Not supported")}getPublicKey(v,o="hex"){throw new Error("Not supported")}sign(v,o,t="hex"){throw new Error("Not supported")}async verify(v,o,t,r){const e=JSON.parse(r);if(!e.authenticatorData||!e.clientDataJSON)throw new Error("extra.authenticatorData or extra.clientDataJSON is required for passkey signature verification");const c=(0,y.toBuffer)((0,y.fromBase64)(e.authenticatorData)),p=await(0,a.toHash)(a.isoBase64URL.toBuffer(e.clientDataJSON));if((0,a.decodeClientDataJSON)(e.clientDataJSON).challenge!==(0,y.toBase64)(v))throw new Error("challenge mismatch for passkey signature");return(0,a.verifySignature)({signature:a.isoBase64URL.toBuffer(typeof o=="string"?o:(0,y.toBase64)(o)),data:a.isoUint8Array.concat([c,p]),credentialPublicKey:t})}}return ge.PasskeySigner=R,ge.default=new R,ge}var Vr;function Ht(){return Vr||(Vr=1,function(n){var y=xe&&xe.__importDefault||function(b){return b&&b.__esModule?b:{default:b}};Object.defineProperty(n,"__esModule",{value:!0}),n.toTxHash=n.Hashers=n.Signers=n.types=n.Hasher=n.Signer=void 0,n.getSigner=c,n.getHasher=p,n.getRandomBytes=h;const a=y(fr()),d=Re(),R=y(Tt()),_=y(Bt()),v=y(Ut()),o=y(Dt()),t=y(Lt()),r=y(rt()),e=y(Mt());n.Signer={Ed25519:o.default,Secp256k1:r.default,Ethereum:t.default,Passkey:e.default},n.Hasher={SHA2:_.default,SHA3:v.default,Keccak:R.default},n.types={KeyType:{ED25519:0,SECP256K1:1,ETHEREUM:2,PASSKEY:3},HashType:{KECCAK:0,SHA3:1,KECCAK_384:2,SHA3_384:3,KECCAK_512:4,SHA3_512:5,SHA2:6},RoleType:{ROLE_ACCOUNT:0,ROLE_NODE:1,ROLE_DEVICE:2,ROLE_APPLICATION:3,ROLE_SMART_CONTRACT:4,ROLE_BOT:5,ROLE_ASSET:6,ROLE_STAKE:7,ROLE_VALIDATOR:8,ROLE_GROUP:9,ROLE_TX:10,ROLE_TETHER:11,ROLE_SWAP:12,ROLE_DELEGATION:13,ROLE_VC:14,ROLE_BLOCKLET:15,ROLE_STORE:16,ROLE_TOKEN:17,ROLE_FACTORY:18,ROLE_ROLLUP:19,ROLE_STORAGE:20,ROLE_PROFILE:21,ROLE_PASSKEY:22,ROLE_TOKEN_FACTORY:23,ROLE_ANY:63},EncodingType:{BASE16:0,BASE58:1}};function c(b){if(typeof n.Signers[b]>"u")throw new Error(`Unsupported signer type: ${b}`);return n.Signers[b]}function p(b){if(typeof n.Hashers[b]>"u")throw new Error(`Unsupported hash type: ${b}`);return n.Hashers[b]}function h(b=32,A="hex"){return(0,d.encode)((0,a.default)(b),A)}n.Signers=Object.freeze({[n.types.KeyType.ED25519]:n.Signer.Ed25519,[n.types.KeyType.SECP256K1]:n.Signer.Secp256k1,[n.types.KeyType.ETHEREUM]:n.Signer.Ethereum,[n.types.KeyType.PASSKEY]:n.Signer.Passkey}),n.Hashers=Object.freeze({[n.types.HashType.KECCAK]:n.Hasher.Keccak.hash256,[n.types.HashType.KECCAK_384]:n.Hasher.Keccak.hash384,[n.types.HashType.KECCAK_512]:n.Hasher.Keccak.hash512,[n.types.HashType.SHA3]:n.Hasher.SHA3.hash256,[n.types.HashType.SHA3_384]:n.Hasher.SHA3.hash384,[n.types.HashType.SHA3_512]:n.Hasher.SHA3.hash512,[n.types.HashType.SHA2]:n.Hasher.SHA2.hash256});const w=b=>n.Hasher.SHA2.hash256(b,1,"hex").replace(/^0x/,"").toUpperCase();n.toTxHash=w}(xe)),xe}var cr,Gr;function Vt(){if(Gr)return cr;Gr=1;const n=xt(),y=Ht(),{fromSecretKey:a,WalletType:d}=vt(),{isHexStrict:R,toHex:_,toBuffer:v,stripHexPrefix:o}=fe(),{types:t}=y;return cr={fromAppDid:(e,c,p={role:t.RoleType.ROLE_ACCOUNT},h=0)=>{if(!c)throw new Error("Cannot get user wallet with empty root sk");const w=y.Hasher.SHA3.hash256(v(e)),b=o(w).slice(0,16),A=b.slice(0,8),j=b.slice(8,16),g=parseInt(+`0x${A}`,10)&2147483647,E=parseInt(+`0x${j}`,10)&2147483647,P=o(R(c)?c:_(c)),x=n.fromMasterSeed(Pe.from(P,"hex")),D=`m/44'/260'/${g}'/${E}'/${h}`,T=x.derive(D),z=d(p),{pk:C=t.KeyType.ED25519}=z;let Z;return C===t.KeyType.ED25519?Z=y.Signer.Ed25519.genKeyPair("hex",T.privateKey).secretKey:Z=_(T.privateKey),C===t.KeyType.ETHEREUM&&(Z=Z.slice(0,66)),a(Z,z)}},cr}export{Vt as r};
@@ -1,4 +1,4 @@
1
- import{V as L,H as q,U as N,q as Y,j as Se,h as Te,a2 as Ie}from"./vendor-ux-BzbOqBel.js";import{q as Re,k as ae,t as We}from"./vendor-hooks-CjESGRlR.js";import{r as v,a as ce}from"./vendor-react-Dvs43sk9.js";import{D as ze,J as de,j as e,Y as De,bC as Oe,$ as $e,ak as d,z as ne,T as S,a6 as F,aX as te,R as Ae,Q as H,b6 as ie,am as P,bf as _,a5 as J,V as G,S as Z,b4 as Pe,U as B,I as M,ci as qe,bh as Be,a7 as Le,F as Me,W as o,b1 as W,a3 as pe,c2 as ee,cj as Fe,aO as He,aP as Ne,ck as Ue,cl as _e,cm as Ve,s as oe,aU as Ke,aj as Ye,cn as Je,aZ as Qe,cc as Xe,bb as Ge,cb as Ze}from"./vendor-mui-core-CnXrAOs3.js";import{B as ue,o as xe,l as he}from"./index-CyALrDx6.js";import{_ as V,c as me,a1 as et,ac as tt,b5 as Q}from"./index-B-XlfvkZ.js";import{u as K}from"./team-BLHzIk1L.js";import{u as ot}from"./use-mobile-maRlSUwU.js";import{u as st,C as X}from"./index.esm-JPZAjt0x.js";import{C as ge,a as be,J as nt}from"./vendor-utils-cJEl_UEd.js";import{C as it}from"./confirm-DK89V84H.js";import{A as rt}from"./actions-DqoNrBDK.js";import{T as re}from"./table-tips-l51OFH7y.js";import"./lottie-web-4koyQiv_.js";import"./vendor-arcblock-BwXbOk2K.js";import"./session-zaFSgetw.js";import"./isURL-shHw2FLx.js";import"./use-app-logo-B8kguOVt.js";import"./index-DBs9Ljax.js";const lt=n=>{const[p,c]=v.useState(null),[f,r]=v.useState(!0),[w,u]=v.useState(null),j=window.blocklet?.appUrl,a=v.useMemo(()=>{const g={};return p&&(p.sources.forEach(y=>{g[y.did]={source:y,events:[],count:0}}),p.events.forEach(y=>{g[y.source]&&(g[y.source].events.push(y),g[y.source].count+=1)})),g},[p]),b=async()=>{try{if(r(!0),!j)return;const y=await(await fetch(ge(j,me.WELLKNOWN_SERVICE_PATH_PREFIX,"/openevent.json"))).json();c(y),u(null)}catch(g){u(g instanceof Error?g:new Error(String(g)))}finally{r(!1)}};return v.useEffect(()=>{b()},[j]),{openEvent:p,setOpenEvent:c,eventsBySource:a,loading:f,error:w,loadData:b}};function fe({eventsBySource:n,selectedEvents:p,setSelectedEvents:c,error:f=null}){const{t:r}=L(),[w,u]=v.useState({}),j=v.useMemo(()=>{const s={};return Object.entries(n).forEach(([l,{events:m}])=>{const k=m.filter(T=>p[`${T.type}-${T.source}`]).length;s[l]=k}),s},[n,p]),a=v.useMemo(()=>Object.values(j).reduce((s,l)=>s+l,0),[j]),b=v.useMemo(()=>Object.values(n).reduce((s,{events:l})=>s+l.length,0),[n]),g=(s,l)=>{l.stopPropagation(),u({...w,[s]:!w[s]})},y=s=>{const l=`${s.type}-${s.source}`;c(m=>({...m,[l]:!m[l]}))},z=(s,l)=>{const m={};s.forEach(k=>{const T=`${k.type}-${k.source}`;m[T]=!l}),c(k=>({...k,...m}))},I=s=>{const l={};Object.values(n).forEach(({events:m})=>{m.forEach(k=>{const T=`${k.type}-${k.source}`;l[T]=s.target.checked})}),c(l)};return e.jsxs(d,{sx:{width:"100%"},children:[e.jsxs(d,{sx:{display:"flex",alignItems:"center",mb:1,mt:1},children:[e.jsx(ie,{control:e.jsx(J,{onChange:I,checked:a>0&&a===b}),label:e.jsxs(d,{sx:{display:"flex",alignItems:"center",cursor:"pointer"},children:[r("webhookEndpoint.selectAllEvents"),e.jsx(d,{sx:{display:"flex",alignItems:"center"},children:e.jsx(P,{title:r("webhookEndpoint.selectAllEventsTooltip"),placement:"right",children:e.jsx(_,{fontSize:"small",sx:{ml:.5,cursor:"help"}})})})]}),sx:{m:0}}),a>0&&e.jsx(S,{variant:"body2",color:"primary",sx:{ml:"auto"},children:r("webhookEndpoint.selectedEventsCount",{count:a})})]}),e.jsx(d,{className:"webhook-event-selector",sx:{maxHeight:"50vh",overflowY:"auto",overflowX:"hidden"},children:e.jsx(G,{disablePadding:!0,sx:{border:"1px solid",borderColor:"divider",borderRadius:.5},children:Object.entries(n).map(([s,{source:l,events:m,count:k}],T)=>{const O=j[s]>0,R=j[s]===m.length&&m.length>0,$=w[s];return e.jsxs(ce.Fragment,{children:[e.jsx(Z,{sx:{borderBottom:({palette:i})=>T<Object.keys(n).length-1?`1px solid ${i.divider}`:"none",px:0,py:1,"&:hover":{bgcolor:"rgba(0, 0, 0, 0.02)"}},children:e.jsxs(d,{sx:{display:"flex",width:"100%",justifyContent:"space-between",alignItems:"center"},onClick:i=>{i.target.closest(".MuiFormControlLabel-root")||g(s,i)},children:[e.jsx(d,{sx:{display:"flex",alignItems:"center"},children:m.length>0&&e.jsx(ie,{control:e.jsx(J,{checked:R,indeterminate:O&&!R,onChange:i=>{i.stopPropagation(),z(m,R)}}),label:e.jsxs(d,{sx:{display:"flex",alignItems:"center",gap:1},children:[l.logo&&e.jsx(Pe,{src:l.logo,sx:{width:24,height:24}}),e.jsx(d,{children:l.title||s}),O&&e.jsx(B,{label:r("webhookEndpoint.selectedCount",{count:j[s]}),size:"small",sx:{mt:"2px",height:"20px",fontSize:"12px",bgcolor:i=>`${i.palette.primary.main}20`,color:"primary.main",fontWeight:500}})]}),sx:{m:0,"& .MuiFormControlLabel-label":{flex:1}}})}),e.jsxs(d,{sx:{display:"flex",alignItems:"center"},children:[e.jsx(S,{variant:"body2",sx:{color:"text.secondary",mr:1},children:r("webhookEndpoint.eventsCount",{count:k})}),m.length>0&&e.jsx(M,{size:"small",edge:"end",children:$?e.jsx(qe,{}):e.jsx(Be,{})})]})]})}),m.length>0&&e.jsx(Le,{in:$,timeout:"auto",unmountOnExit:!0,children:e.jsx(G,{disablePadding:!0,sx:{p:0,bgcolor:"rgba(0, 0, 0, 0.01)"},children:m.map(i=>{const x=`${i.type}-${i.source}`,t=!!p[x];return e.jsx(Z,{dense:!0,sx:{py:.75,px:1},onClick:()=>y(i),children:e.jsxs(d,{sx:{display:"flex",alignItems:"flex-start",width:"100%"},children:[e.jsx(J,{checked:t,sx:{flexShrink:0}}),e.jsxs(d,{sx:{flex:1,minWidth:0},children:[e.jsx(S,{variant:"body1",className:"webhook-event-type",sx:{cursor:"pointer",color:"text.primary",wordBreak:"break-word",overflowWrap:"break-word"},children:i.type}),e.jsx(S,{variant:"caption",sx:{color:"text.secondary",display:"block",cursor:"pointer",wordBreak:"break-word",overflowWrap:"break-word"},children:i.description})]})]})},x)})})})]},s)})})}),f&&e.jsx(Me,{error:!0,sx:{mt:1},children:f})]})}fe.propTypes={eventsBySource:o.objectOf(o.shape({source:o.shape({did:o.string.isRequired,title:o.string,description:o.string,version:o.string,logo:o.string}).isRequired,events:o.arrayOf(o.shape({type:o.string.isRequired,description:o.string.isRequired,source:o.string.isRequired})).isRequired,count:o.number.isRequired})).isRequired,selectedEvents:o.objectOf(o.bool).isRequired,setSelectedEvents:o.func.isRequired,error:o.string};function je({id:n=null,url:p="",description:c="",enabledEvents:f=[],onSubmit:r,onClose:w=()=>{}}){const{t:u}=L(),[j,a]=v.useState({}),{teamDid:b}=K(),{api:g}=V(),{loading:y,error:z,eventsBySource:I}=lt(),s=ze(),{control:l,handleSubmit:m,formState:{errors:k},reset:T,setValue:O,trigger:R}=st({defaultValues:{url:"",description:""}}),$=de(s.breakpoints.down("md"));v.useEffect(()=>{const t=Object.values(j).some(h=>h);O("selectedEvents",t?"valid":""),R("selectedEvents")},[j,O,R]);const i=()=>{a({}),T(),w()},x=async t=>{const h=Object.keys(j).filter(C=>j[C]),E={url:t.url,description:t.description,enabledEvents:h.map(C=>{const[D,se]=C.split("-");return!D||!se?null:{type:D,source:se}}).filter(Boolean)};try{if(n){const C=await g.updateWebhookEndpoint({input:{teamDid:b,id:n,data:E}});q.success(`${u("webhookEndpoint.updateWebhook")} ${u("webhookEndpoint.success")}`),r(C)}else{const C=await g.createWebhookEndpoint({input:{teamDid:b,input:E}});q.success(`${u("webhookEndpoint.createWebhook")} ${u("webhookEndpoint.success")}`),r(C)}}catch(C){q.error(C?.message)}i()};return v.useEffect(()=>{T({url:p,description:c}),a(f.reduce((t,h)=>(t[`${h.type}-${h.source}`]=!0,t),{}))},[T,a,p,c,f]),e.jsx(De,{open:!0,onClose:i,maxWidth:"lg",fullWidth:!0,fullScreen:$,sx:{"& .MuiDialog-paper":{minHeight:600}},children:e.jsxs("form",{onSubmit:m(x),children:[e.jsx(Oe,{children:u(n?"webhookEndpoint.editWebhookTitle":"webhookEndpoint.createWebhookTitle")}),e.jsx($e,{children:e.jsxs(d,{sx:{display:"flex",flexDirection:"column",gap:2,mt:2},children:[e.jsx(X,{name:"url",control:l,rules:{required:u("webhookEndpoint.validation.urlRequired"),pattern:{value:/^(http|https):\/\/[^ "]+$/,message:u("webhookEndpoint.validation.urlInvalid")}},render:({field:t})=>e.jsx(ne,{...t,label:u("webhookEndpoint.url.label"),fullWidth:!0,error:!!k.url,helperText:k.url?.message})}),e.jsx(X,{name:"description",control:l,rules:{required:u("webhookEndpoint.validation.descriptionRequired")},render:({field:t})=>e.jsx(ne,{...t,label:u("webhookEndpoint.description.label"),fullWidth:!0,multiline:!0,minRows:2,maxRows:4,error:!!k.description,helperText:k.description?.message})}),e.jsx(X,{name:"selectedEvents",control:l,rules:{required:u("webhookEndpoint.validation.eventRequired")},render:({field:t})=>e.jsx("input",{type:"hidden",...t})}),!y&&I&&Object.keys(I).length>0&&e.jsx(fe,{eventsBySource:I,selectedEvents:j,setSelectedEvents:a,error:k.selectedEvents?.message}),!y&&(!I||Object.keys(I).length===0)&&e.jsx(S,{sx:{color:"text.secondary"},children:u("webhookEndpoint.noAvailableEvents")}),y&&e.jsx(d,{sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"500px",width:"100%"},children:e.jsx(F,{size:20})}),z&&e.jsx(te,{severity:"error",children:u("webhookEndpoint.loadingError",{message:z?.message})})]})}),e.jsxs(Ae,{sx:{p:"8px 24px 24px"},children:[e.jsx(H,{onClick:i,children:u("common.cancel")}),e.jsx(H,{type:"submit",variant:"contained",color:"primary",children:u(n?"webhookEndpoint.updateWebhook":"webhookEndpoint.saveWebhook")})]})]})})}je.propTypes={onSubmit:o.func.isRequired,id:o.string,url:o.string,description:o.string,enabledEvents:o.arrayOf(o.shape({type:o.string.isRequired,source:o.string.isRequired})),onClose:o.func};function ye(n){switch(n){case"enabled":return"success";case"disabled":default:return"default"}}const at=(n="en")=>n==="tw"?"zh":n;function U(n,p="YYYY-MM-DD HH:mm:ss",c="en"){return n?et(n).locale(at(c)).format(p):"-"}function ct(n){return typeof n=="number"?!1:be(n)}function dt(n){return n>=200&&n<300}function A({value:n,label:p,tip:c="",divider:f=!1}){const r=ct(n);return e.jsxs(e.Fragment,{children:[e.jsxs(W,{direction:"column",alignItems:"flex-start",children:[e.jsxs(S,{component:"div",variant:"body1",mb:1,color:"text.primary",sx:{fontWeight:500},children:[p,!!c&&e.jsx(P,{title:c,children:e.jsx(_,{fontSize:"small"})})]}),e.jsx(S,{component:"div",variant:"body1",color:r?"text.disabled":"text.secondary",sx:{width:"100%",minHeight:"24px"},children:r?"-":n})]}),f&&e.jsx(pe,{orientation:"vertical",flexItem:!0})]})}A.propTypes={label:o.oneOfType([o.string,o.node]).isRequired,value:o.oneOfType([o.string,o.node]).isRequired,tip:o.oneOfType([o.string,o.node]),divider:o.bool};function we({title:n,children:p=null,mb:c=1.5,mt:f=1.5}){return e.jsxs(W,{className:"section-header",direction:"row",sx:{justifyContent:"space-between",alignItems:"center",flexWrap:"wrap",gap:1,mb:c,mt:f,pb:1},children:[e.jsx(S,{variant:"h3",sx:{fontSize:{xs:"18px",md:"1.09375rem"}},component:"div",children:n}),p]})}we.propTypes={title:o.oneOfType([o.string,o.node]).isRequired,children:o.node,mb:o.number,mt:o.number};const pt={width:24,height:24,body:'<path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M20 11A8.1 8.1 0 0 0 4.5 9M4 5v4h4m-4 4a8.1 8.1 0 0 0 15.5 2m.5 4v-4h-4"/>'},ut=n=>{const p={};return n.forEach(c=>{const f=new Date(c.createdAt).toLocaleDateString();p[f]||(p[f]=[]),p[f]?.push(c)}),p};function ke({eventId:n="",webhookEndpointId:p="",event:c=null}){const{api:f,ws:{useSubscription:r}}=V(),{t:w}=L(),{teamDid:u}=K(),{blocklet:j}=tt(),{data:a,loadMore:b,loadingMore:g,loading:y,mutate:z}=Re(t=>{const E=t?Math.ceil(t.list.length/15)+1:1;return f.getWebhookAttempts({input:{teamDid:u,input:{eventId:n,webhookId:p},paging:{page:E,pageSize:15}}})},{reloadDeps:[n,p]}),I=a?.list||[],[s,l]=v.useState(null),[m,k]=v.useState(!1),T=ut(I);if(v.useEffect(()=>{!s&&a?.list.length&&l(a.list[0])},[a?.list.length,s]),r(me.EVENTS.WEBHOOK_ATTEMPT,t=>{z(h=>{if(h.list.find(C=>C.id===t.id)){const C=h.list.map(D=>D.id===t.id?{...D,...t}:D);return{...h,list:C}}return t.endpoint=h.list[0]?.endpoint,t.event=h.list[0]?.event,{...h,list:[t,...h.list]}})},[]),y)return e.jsx(F,{});const O=a&&a.list.length<a.paging.total,R=async()=>{s&&(k(!0),await f.retryWebhookAttempt({input:{teamDid:u,eventId:s.event.id,webhookId:p,attemptId:s.id}}).finally(()=>{setTimeout(()=>{k(!1)},1e3)}))},$=t=>{if(t.responseBody&&t.responseBody?.sessionId&&t.responseBody?.projectId&&t.responseBody?.agentId){const h=j?.site?.domainAliases[0]?.value,E=(j.children||[]).find(D=>D?.meta?.name==="ai-studio"),C=nt(ge(`https://${h}`,E?.mountPoint||"","projects",t.responseBody.projectId,"logs/main"),{sessionId:t.responseBody.sessionId,agentId:t.responseBody.agentId});return e.jsx(M,{sx:{fontSize:20},onClick:()=>window.open(C,"_blank"),children:e.jsx(d,{component:N,icon:Q})})}return null},i=t=>t.status==="pending"?e.jsx(Ue,{color:"warning"}):dt(t.responseStatus)?e.jsx(_e,{color:"success"}):e.jsx(Ve,{color:"error"}),x=s?.triggeredFrom&&(a?.list||[]).find(t=>t.id===s.triggeredFrom);return e.jsxs(xt,{container:!0,spacing:{xs:0,md:1},sx:{height:1},children:[e.jsx(ee,{size:{xs:12,md:4},sx:{height:1},children:be(Object.keys(T))?e.jsx(S,{sx:{color:"text.secondary"},children:w("webhookEndpoint.waitingForEvents")}):e.jsxs(e.Fragment,{children:[e.jsx(G,{sx:{maxHeight:"calc(100% - 40px)",py:0,overflowY:"auto"},children:Object.entries(T).map(([t,h])=>e.jsxs(ce.Fragment,{children:[e.jsx(Fe,{sx:{p:0},children:t}),h.map(E=>e.jsxs(Z,{sx:{cursor:"pointer",px:1},onClick:()=>l(E),selected:s&&s?.id===E?.id,secondaryAction:e.jsx(S,{sx:{color:"text.secondary"},children:U(E.createdAt,"HH:mm:ss")}),children:[e.jsx(He,{sx:{minWidth:0,mr:1.5},children:i(E)}),e.jsx(Ne,{primary:e.jsx(S,{sx:{color:"text.primary"},children:E.event.type})})]},E.id))]},t))}),O&&e.jsx(d,{sx:{display:"flex",justifyContent:"center",alignItems:"center",width:1},children:e.jsx(H,{variant:"text",type:"button",color:"inherit",onClick:b,disabled:g,sx:{color:t=>t.palette.text.disabled},children:w(g?"webhookEndpoint.loadingMore":"webhookEndpoint.loadMore")})})]})}),e.jsxs(ee,{size:{xs:12,md:8},sx:{height:1},children:[s&&e.jsxs(W,{direction:"column",spacing:2,sx:{height:1,overflow:"auto",pl:{xs:0,md:1},mt:{xs:2,md:0},borderLeft:{xs:"none"}},children:[e.jsxs(d,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[e.jsxs(d,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(S,{variant:"h4",children:w(`common.${s.status}`)}),e.jsx(d,{children:$(s)})]}),e.jsxs(d,{sx:{display:"flex",alignItems:"center",gap:1},children:[x&&e.jsx(P,{placement:"left",title:e.jsxs(W,{onClick:()=>l(x),sx:{gap:1,cursor:"pointer",".did-address-text":{color:"common.white"}},children:[e.jsx(ue,{showDid:!0,did:s.triggeredBy,cardType:he.Detailed,infoType:xe.Minimal,sx:{border:0,padding:0,minWidth:0,".MuiTypography-root":{color:"common.white",fontWeight:400}}}),e.jsx(pe,{}),e.jsxs(d,{sx:{display:"flex",flexDirection:"column"},children:[e.jsx(S,{variant:"body2",sx:{color:"primary.main"},children:w("webhookEndpoint.triggeredFrom")}),e.jsxs(d,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(S,{variant:"body2",children:s.id}),e.jsx(M,{onClick:()=>l(x),children:e.jsx(d,{component:N,icon:Q,sx:{fontSize:16,color:"common.white"}})})]})]})]}),slotProps:{tooltip:{sx:{maxWidth:400}}},children:e.jsx(M,{onClick:()=>l(x),children:e.jsx(d,{component:N,icon:Q,sx:{fontSize:16}})})}),e.jsxs(H,{variant:"outlined",color:"primary",size:"small",onClick:R,disabled:m,children:[e.jsx(d,{component:N,icon:pt,sx:{fontSize:16,animation:m?"spin 1s linear infinite":"none",mr:.5}}),w("notification.resend")]})]})]}),e.jsxs(d,{children:[e.jsxs(S,{variant:"h6",children:[w("webhookEndpoint.response")," (",s.responseStatus,")"]}),e.jsx(Y,{language:"json",children:JSON.stringify(s.responseBody,null,2)})]}),e.jsxs(d,{children:[e.jsx(W,{direction:"row",spacing:1,sx:{alignItems:"center"},children:e.jsx(S,{variant:"h6",children:w("webhookEndpoint.request")})}),e.jsx(Y,{language:"json",sx:{margin:0},children:JSON.stringify(s.event,null,2)})]})]}),a?.list.length===0&&c&&e.jsxs(d,{children:[e.jsx(W,{direction:"row",spacing:1,sx:{alignItems:"center"},children:e.jsx(S,{variant:"h6",children:w("webhookEndpoint.eventData")})}),e.jsx(Y,{language:"json",sx:{margin:0},children:JSON.stringify(c.data,null,2)})]})]})]})}ke.propTypes={eventId:o.string,webhookEndpointId:o.string,event:o.shape({type:o.string,data:o.object,request:o.object,requestInfo:o.object})};const xt=oe(ee)`
1
+ import{V as L,H as q,U as N,q as Y,j as Se,h as Te,a2 as Ie}from"./vendor-ux-CWISwSx6.js";import{q as Re,k as ae,t as We}from"./vendor-hooks-OpgB8gyY.js";import{r as v,a as ce}from"./vendor-react-Dvs43sk9.js";import{D as ze,J as de,j as e,Y as De,bC as Oe,$ as $e,ak as d,z as ne,T as S,a6 as F,aX as te,R as Ae,Q as H,b6 as ie,am as P,bf as _,a5 as J,V as G,S as Z,b4 as Pe,U as B,I as M,ci as qe,bh as Be,a7 as Le,F as Me,W as o,b1 as W,a3 as pe,c2 as ee,cj as Fe,aO as He,aP as Ne,ck as Ue,cl as _e,cm as Ve,s as oe,aU as Ke,aj as Ye,cn as Je,aZ as Qe,cc as Xe,bb as Ge,cb as Ze}from"./vendor-mui-core-CnXrAOs3.js";import{B as ue,o as xe,l as he}from"./index-CWM6CeCJ.js";import{_ as V,c as me,a1 as et,ac as tt,b5 as Q}from"./index-CvqAqbTY.js";import{u as K}from"./team-C7pbRoxF.js";import{u as ot}from"./use-mobile-maRlSUwU.js";import{u as st,C as X}from"./index.esm-JPZAjt0x.js";import{C as ge,a as be,J as nt}from"./vendor-utils-ByKYcWuf.js";import{C as it}from"./confirm-BCfyUWCf.js";import{A as rt}from"./actions-DqoNrBDK.js";import{T as re}from"./table-tips-CS1WAXWA.js";import"./lottie-web-4koyQiv_.js";import"./vendor-arcblock-BgUgVGvU.js";import"./session-DUnZO0dx.js";import"./isURL-CwakGHMn.js";import"./use-app-logo-Cn8xa27P.js";import"./index-DBs9Ljax.js";const lt=n=>{const[p,c]=v.useState(null),[f,r]=v.useState(!0),[w,u]=v.useState(null),j=window.blocklet?.appUrl,a=v.useMemo(()=>{const g={};return p&&(p.sources.forEach(y=>{g[y.did]={source:y,events:[],count:0}}),p.events.forEach(y=>{g[y.source]&&(g[y.source].events.push(y),g[y.source].count+=1)})),g},[p]),b=async()=>{try{if(r(!0),!j)return;const y=await(await fetch(ge(j,me.WELLKNOWN_SERVICE_PATH_PREFIX,"/openevent.json"))).json();c(y),u(null)}catch(g){u(g instanceof Error?g:new Error(String(g)))}finally{r(!1)}};return v.useEffect(()=>{b()},[j]),{openEvent:p,setOpenEvent:c,eventsBySource:a,loading:f,error:w,loadData:b}};function fe({eventsBySource:n,selectedEvents:p,setSelectedEvents:c,error:f=null}){const{t:r}=L(),[w,u]=v.useState({}),j=v.useMemo(()=>{const s={};return Object.entries(n).forEach(([l,{events:m}])=>{const k=m.filter(T=>p[`${T.type}-${T.source}`]).length;s[l]=k}),s},[n,p]),a=v.useMemo(()=>Object.values(j).reduce((s,l)=>s+l,0),[j]),b=v.useMemo(()=>Object.values(n).reduce((s,{events:l})=>s+l.length,0),[n]),g=(s,l)=>{l.stopPropagation(),u({...w,[s]:!w[s]})},y=s=>{const l=`${s.type}-${s.source}`;c(m=>({...m,[l]:!m[l]}))},z=(s,l)=>{const m={};s.forEach(k=>{const T=`${k.type}-${k.source}`;m[T]=!l}),c(k=>({...k,...m}))},I=s=>{const l={};Object.values(n).forEach(({events:m})=>{m.forEach(k=>{const T=`${k.type}-${k.source}`;l[T]=s.target.checked})}),c(l)};return e.jsxs(d,{sx:{width:"100%"},children:[e.jsxs(d,{sx:{display:"flex",alignItems:"center",mb:1,mt:1},children:[e.jsx(ie,{control:e.jsx(J,{onChange:I,checked:a>0&&a===b}),label:e.jsxs(d,{sx:{display:"flex",alignItems:"center",cursor:"pointer"},children:[r("webhookEndpoint.selectAllEvents"),e.jsx(d,{sx:{display:"flex",alignItems:"center"},children:e.jsx(P,{title:r("webhookEndpoint.selectAllEventsTooltip"),placement:"right",children:e.jsx(_,{fontSize:"small",sx:{ml:.5,cursor:"help"}})})})]}),sx:{m:0}}),a>0&&e.jsx(S,{variant:"body2",color:"primary",sx:{ml:"auto"},children:r("webhookEndpoint.selectedEventsCount",{count:a})})]}),e.jsx(d,{className:"webhook-event-selector",sx:{maxHeight:"50vh",overflowY:"auto",overflowX:"hidden"},children:e.jsx(G,{disablePadding:!0,sx:{border:"1px solid",borderColor:"divider",borderRadius:.5},children:Object.entries(n).map(([s,{source:l,events:m,count:k}],T)=>{const O=j[s]>0,R=j[s]===m.length&&m.length>0,$=w[s];return e.jsxs(ce.Fragment,{children:[e.jsx(Z,{sx:{borderBottom:({palette:i})=>T<Object.keys(n).length-1?`1px solid ${i.divider}`:"none",px:0,py:1,"&:hover":{bgcolor:"rgba(0, 0, 0, 0.02)"}},children:e.jsxs(d,{sx:{display:"flex",width:"100%",justifyContent:"space-between",alignItems:"center"},onClick:i=>{i.target.closest(".MuiFormControlLabel-root")||g(s,i)},children:[e.jsx(d,{sx:{display:"flex",alignItems:"center"},children:m.length>0&&e.jsx(ie,{control:e.jsx(J,{checked:R,indeterminate:O&&!R,onChange:i=>{i.stopPropagation(),z(m,R)}}),label:e.jsxs(d,{sx:{display:"flex",alignItems:"center",gap:1},children:[l.logo&&e.jsx(Pe,{src:l.logo,sx:{width:24,height:24}}),e.jsx(d,{children:l.title||s}),O&&e.jsx(B,{label:r("webhookEndpoint.selectedCount",{count:j[s]}),size:"small",sx:{mt:"2px",height:"20px",fontSize:"12px",bgcolor:i=>`${i.palette.primary.main}20`,color:"primary.main",fontWeight:500}})]}),sx:{m:0,"& .MuiFormControlLabel-label":{flex:1}}})}),e.jsxs(d,{sx:{display:"flex",alignItems:"center"},children:[e.jsx(S,{variant:"body2",sx:{color:"text.secondary",mr:1},children:r("webhookEndpoint.eventsCount",{count:k})}),m.length>0&&e.jsx(M,{size:"small",edge:"end",children:$?e.jsx(qe,{}):e.jsx(Be,{})})]})]})}),m.length>0&&e.jsx(Le,{in:$,timeout:"auto",unmountOnExit:!0,children:e.jsx(G,{disablePadding:!0,sx:{p:0,bgcolor:"rgba(0, 0, 0, 0.01)"},children:m.map(i=>{const x=`${i.type}-${i.source}`,t=!!p[x];return e.jsx(Z,{dense:!0,sx:{py:.75,px:1},onClick:()=>y(i),children:e.jsxs(d,{sx:{display:"flex",alignItems:"flex-start",width:"100%"},children:[e.jsx(J,{checked:t,sx:{flexShrink:0}}),e.jsxs(d,{sx:{flex:1,minWidth:0},children:[e.jsx(S,{variant:"body1",className:"webhook-event-type",sx:{cursor:"pointer",color:"text.primary",wordBreak:"break-word",overflowWrap:"break-word"},children:i.type}),e.jsx(S,{variant:"caption",sx:{color:"text.secondary",display:"block",cursor:"pointer",wordBreak:"break-word",overflowWrap:"break-word"},children:i.description})]})]})},x)})})})]},s)})})}),f&&e.jsx(Me,{error:!0,sx:{mt:1},children:f})]})}fe.propTypes={eventsBySource:o.objectOf(o.shape({source:o.shape({did:o.string.isRequired,title:o.string,description:o.string,version:o.string,logo:o.string}).isRequired,events:o.arrayOf(o.shape({type:o.string.isRequired,description:o.string.isRequired,source:o.string.isRequired})).isRequired,count:o.number.isRequired})).isRequired,selectedEvents:o.objectOf(o.bool).isRequired,setSelectedEvents:o.func.isRequired,error:o.string};function je({id:n=null,url:p="",description:c="",enabledEvents:f=[],onSubmit:r,onClose:w=()=>{}}){const{t:u}=L(),[j,a]=v.useState({}),{teamDid:b}=K(),{api:g}=V(),{loading:y,error:z,eventsBySource:I}=lt(),s=ze(),{control:l,handleSubmit:m,formState:{errors:k},reset:T,setValue:O,trigger:R}=st({defaultValues:{url:"",description:""}}),$=de(s.breakpoints.down("md"));v.useEffect(()=>{const t=Object.values(j).some(h=>h);O("selectedEvents",t?"valid":""),R("selectedEvents")},[j,O,R]);const i=()=>{a({}),T(),w()},x=async t=>{const h=Object.keys(j).filter(C=>j[C]),E={url:t.url,description:t.description,enabledEvents:h.map(C=>{const[D,se]=C.split("-");return!D||!se?null:{type:D,source:se}}).filter(Boolean)};try{if(n){const C=await g.updateWebhookEndpoint({input:{teamDid:b,id:n,data:E}});q.success(`${u("webhookEndpoint.updateWebhook")} ${u("webhookEndpoint.success")}`),r(C)}else{const C=await g.createWebhookEndpoint({input:{teamDid:b,input:E}});q.success(`${u("webhookEndpoint.createWebhook")} ${u("webhookEndpoint.success")}`),r(C)}}catch(C){q.error(C?.message)}i()};return v.useEffect(()=>{T({url:p,description:c}),a(f.reduce((t,h)=>(t[`${h.type}-${h.source}`]=!0,t),{}))},[T,a,p,c,f]),e.jsx(De,{open:!0,onClose:i,maxWidth:"lg",fullWidth:!0,fullScreen:$,sx:{"& .MuiDialog-paper":{minHeight:600}},children:e.jsxs("form",{onSubmit:m(x),children:[e.jsx(Oe,{children:u(n?"webhookEndpoint.editWebhookTitle":"webhookEndpoint.createWebhookTitle")}),e.jsx($e,{children:e.jsxs(d,{sx:{display:"flex",flexDirection:"column",gap:2,mt:2},children:[e.jsx(X,{name:"url",control:l,rules:{required:u("webhookEndpoint.validation.urlRequired"),pattern:{value:/^(http|https):\/\/[^ "]+$/,message:u("webhookEndpoint.validation.urlInvalid")}},render:({field:t})=>e.jsx(ne,{...t,label:u("webhookEndpoint.url.label"),fullWidth:!0,error:!!k.url,helperText:k.url?.message})}),e.jsx(X,{name:"description",control:l,rules:{required:u("webhookEndpoint.validation.descriptionRequired")},render:({field:t})=>e.jsx(ne,{...t,label:u("webhookEndpoint.description.label"),fullWidth:!0,multiline:!0,minRows:2,maxRows:4,error:!!k.description,helperText:k.description?.message})}),e.jsx(X,{name:"selectedEvents",control:l,rules:{required:u("webhookEndpoint.validation.eventRequired")},render:({field:t})=>e.jsx("input",{type:"hidden",...t})}),!y&&I&&Object.keys(I).length>0&&e.jsx(fe,{eventsBySource:I,selectedEvents:j,setSelectedEvents:a,error:k.selectedEvents?.message}),!y&&(!I||Object.keys(I).length===0)&&e.jsx(S,{sx:{color:"text.secondary"},children:u("webhookEndpoint.noAvailableEvents")}),y&&e.jsx(d,{sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"500px",width:"100%"},children:e.jsx(F,{size:20})}),z&&e.jsx(te,{severity:"error",children:u("webhookEndpoint.loadingError",{message:z?.message})})]})}),e.jsxs(Ae,{sx:{p:"8px 24px 24px"},children:[e.jsx(H,{onClick:i,children:u("common.cancel")}),e.jsx(H,{type:"submit",variant:"contained",color:"primary",children:u(n?"webhookEndpoint.updateWebhook":"webhookEndpoint.saveWebhook")})]})]})})}je.propTypes={onSubmit:o.func.isRequired,id:o.string,url:o.string,description:o.string,enabledEvents:o.arrayOf(o.shape({type:o.string.isRequired,source:o.string.isRequired})),onClose:o.func};function ye(n){switch(n){case"enabled":return"success";case"disabled":default:return"default"}}const at=(n="en")=>n==="tw"?"zh":n;function U(n,p="YYYY-MM-DD HH:mm:ss",c="en"){return n?et(n).locale(at(c)).format(p):"-"}function ct(n){return typeof n=="number"?!1:be(n)}function dt(n){return n>=200&&n<300}function A({value:n,label:p,tip:c="",divider:f=!1}){const r=ct(n);return e.jsxs(e.Fragment,{children:[e.jsxs(W,{direction:"column",alignItems:"flex-start",children:[e.jsxs(S,{component:"div",variant:"body1",mb:1,color:"text.primary",sx:{fontWeight:500},children:[p,!!c&&e.jsx(P,{title:c,children:e.jsx(_,{fontSize:"small"})})]}),e.jsx(S,{component:"div",variant:"body1",color:r?"text.disabled":"text.secondary",sx:{width:"100%",minHeight:"24px"},children:r?"-":n})]}),f&&e.jsx(pe,{orientation:"vertical",flexItem:!0})]})}A.propTypes={label:o.oneOfType([o.string,o.node]).isRequired,value:o.oneOfType([o.string,o.node]).isRequired,tip:o.oneOfType([o.string,o.node]),divider:o.bool};function we({title:n,children:p=null,mb:c=1.5,mt:f=1.5}){return e.jsxs(W,{className:"section-header",direction:"row",sx:{justifyContent:"space-between",alignItems:"center",flexWrap:"wrap",gap:1,mb:c,mt:f,pb:1},children:[e.jsx(S,{variant:"h3",sx:{fontSize:{xs:"18px",md:"1.09375rem"}},component:"div",children:n}),p]})}we.propTypes={title:o.oneOfType([o.string,o.node]).isRequired,children:o.node,mb:o.number,mt:o.number};const pt={width:24,height:24,body:'<path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M20 11A8.1 8.1 0 0 0 4.5 9M4 5v4h4m-4 4a8.1 8.1 0 0 0 15.5 2m.5 4v-4h-4"/>'},ut=n=>{const p={};return n.forEach(c=>{const f=new Date(c.createdAt).toLocaleDateString();p[f]||(p[f]=[]),p[f]?.push(c)}),p};function ke({eventId:n="",webhookEndpointId:p="",event:c=null}){const{api:f,ws:{useSubscription:r}}=V(),{t:w}=L(),{teamDid:u}=K(),{blocklet:j}=tt(),{data:a,loadMore:b,loadingMore:g,loading:y,mutate:z}=Re(t=>{const E=t?Math.ceil(t.list.length/15)+1:1;return f.getWebhookAttempts({input:{teamDid:u,input:{eventId:n,webhookId:p},paging:{page:E,pageSize:15}}})},{reloadDeps:[n,p]}),I=a?.list||[],[s,l]=v.useState(null),[m,k]=v.useState(!1),T=ut(I);if(v.useEffect(()=>{!s&&a?.list.length&&l(a.list[0])},[a?.list.length,s]),r(me.EVENTS.WEBHOOK_ATTEMPT,t=>{z(h=>{if(h.list.find(C=>C.id===t.id)){const C=h.list.map(D=>D.id===t.id?{...D,...t}:D);return{...h,list:C}}return t.endpoint=h.list[0]?.endpoint,t.event=h.list[0]?.event,{...h,list:[t,...h.list]}})},[]),y)return e.jsx(F,{});const O=a&&a.list.length<a.paging.total,R=async()=>{s&&(k(!0),await f.retryWebhookAttempt({input:{teamDid:u,eventId:s.event.id,webhookId:p,attemptId:s.id}}).finally(()=>{setTimeout(()=>{k(!1)},1e3)}))},$=t=>{if(t.responseBody&&t.responseBody?.sessionId&&t.responseBody?.projectId&&t.responseBody?.agentId){const h=j?.site?.domainAliases[0]?.value,E=(j.children||[]).find(D=>D?.meta?.name==="ai-studio"),C=nt(ge(`https://${h}`,E?.mountPoint||"","projects",t.responseBody.projectId,"logs/main"),{sessionId:t.responseBody.sessionId,agentId:t.responseBody.agentId});return e.jsx(M,{sx:{fontSize:20},onClick:()=>window.open(C,"_blank"),children:e.jsx(d,{component:N,icon:Q})})}return null},i=t=>t.status==="pending"?e.jsx(Ue,{color:"warning"}):dt(t.responseStatus)?e.jsx(_e,{color:"success"}):e.jsx(Ve,{color:"error"}),x=s?.triggeredFrom&&(a?.list||[]).find(t=>t.id===s.triggeredFrom);return e.jsxs(xt,{container:!0,spacing:{xs:0,md:1},sx:{height:1},children:[e.jsx(ee,{size:{xs:12,md:4},sx:{height:1},children:be(Object.keys(T))?e.jsx(S,{sx:{color:"text.secondary"},children:w("webhookEndpoint.waitingForEvents")}):e.jsxs(e.Fragment,{children:[e.jsx(G,{sx:{maxHeight:"calc(100% - 40px)",py:0,overflowY:"auto"},children:Object.entries(T).map(([t,h])=>e.jsxs(ce.Fragment,{children:[e.jsx(Fe,{sx:{p:0},children:t}),h.map(E=>e.jsxs(Z,{sx:{cursor:"pointer",px:1},onClick:()=>l(E),selected:s&&s?.id===E?.id,secondaryAction:e.jsx(S,{sx:{color:"text.secondary"},children:U(E.createdAt,"HH:mm:ss")}),children:[e.jsx(He,{sx:{minWidth:0,mr:1.5},children:i(E)}),e.jsx(Ne,{primary:e.jsx(S,{sx:{color:"text.primary"},children:E.event.type})})]},E.id))]},t))}),O&&e.jsx(d,{sx:{display:"flex",justifyContent:"center",alignItems:"center",width:1},children:e.jsx(H,{variant:"text",type:"button",color:"inherit",onClick:b,disabled:g,sx:{color:t=>t.palette.text.disabled},children:w(g?"webhookEndpoint.loadingMore":"webhookEndpoint.loadMore")})})]})}),e.jsxs(ee,{size:{xs:12,md:8},sx:{height:1},children:[s&&e.jsxs(W,{direction:"column",spacing:2,sx:{height:1,overflow:"auto",pl:{xs:0,md:1},mt:{xs:2,md:0},borderLeft:{xs:"none"}},children:[e.jsxs(d,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[e.jsxs(d,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(S,{variant:"h4",children:w(`common.${s.status}`)}),e.jsx(d,{children:$(s)})]}),e.jsxs(d,{sx:{display:"flex",alignItems:"center",gap:1},children:[x&&e.jsx(P,{placement:"left",title:e.jsxs(W,{onClick:()=>l(x),sx:{gap:1,cursor:"pointer",".did-address-text":{color:"common.white"}},children:[e.jsx(ue,{showDid:!0,did:s.triggeredBy,cardType:he.Detailed,infoType:xe.Minimal,sx:{border:0,padding:0,minWidth:0,".MuiTypography-root":{color:"common.white",fontWeight:400}}}),e.jsx(pe,{}),e.jsxs(d,{sx:{display:"flex",flexDirection:"column"},children:[e.jsx(S,{variant:"body2",sx:{color:"primary.main"},children:w("webhookEndpoint.triggeredFrom")}),e.jsxs(d,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(S,{variant:"body2",children:s.id}),e.jsx(M,{onClick:()=>l(x),children:e.jsx(d,{component:N,icon:Q,sx:{fontSize:16,color:"common.white"}})})]})]})]}),slotProps:{tooltip:{sx:{maxWidth:400}}},children:e.jsx(M,{onClick:()=>l(x),children:e.jsx(d,{component:N,icon:Q,sx:{fontSize:16}})})}),e.jsxs(H,{variant:"outlined",color:"primary",size:"small",onClick:R,disabled:m,children:[e.jsx(d,{component:N,icon:pt,sx:{fontSize:16,animation:m?"spin 1s linear infinite":"none",mr:.5}}),w("notification.resend")]})]})]}),e.jsxs(d,{children:[e.jsxs(S,{variant:"h6",children:[w("webhookEndpoint.response")," (",s.responseStatus,")"]}),e.jsx(Y,{language:"json",children:JSON.stringify(s.responseBody,null,2)})]}),e.jsxs(d,{children:[e.jsx(W,{direction:"row",spacing:1,sx:{alignItems:"center"},children:e.jsx(S,{variant:"h6",children:w("webhookEndpoint.request")})}),e.jsx(Y,{language:"json",sx:{margin:0},children:JSON.stringify(s.event,null,2)})]})]}),a?.list.length===0&&c&&e.jsxs(d,{children:[e.jsx(W,{direction:"row",spacing:1,sx:{alignItems:"center"},children:e.jsx(S,{variant:"h6",children:w("webhookEndpoint.eventData")})}),e.jsx(Y,{language:"json",sx:{margin:0},children:JSON.stringify(c.data,null,2)})]})]})]})}ke.propTypes={eventId:o.string,webhookEndpointId:o.string,event:o.shape({type:o.string,data:o.object,request:o.object,requestInfo:o.object})};const xt=oe(ee)`
2
2
  @keyframes spin {
3
3
  to {
4
4
  transform: rotate(360deg);