@abtnode/webapp 1.17.5-beta-20251209-090953-3a59e7ac → 1.17.5-beta-20251211-104355-426d7eb6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (187) hide show
  1. package/blocklet.js +1 -1
  2. package/blocklet.yml +1 -1
  3. package/dist/assets/{AdapterDayjs-CBmYJq_c.js → AdapterDayjs-Dcg6AE_r.js} +1 -1
  4. package/dist/assets/{Add-BuqBIDFA.js → Add-CwJyd37s.js} +1 -1
  5. package/dist/assets/ArrowDropDown-BoUU1BUL.js +1 -0
  6. package/dist/assets/{Autocomplete-YxXH99vB.js → Autocomplete-C6KZatsu.js} +1 -1
  7. package/dist/assets/{Breadcrumbs-DngVGj6f.js → Breadcrumbs-Bj53u8dH.js} +1 -1
  8. package/dist/assets/{ButtonGroup-BtGO-VCX.js → ButtonGroup-uhq9NqjP.js} +1 -1
  9. package/dist/assets/{CSSTransition-Cj0uEEEn.js → CSSTransition-5vBScTx4.js} +1 -1
  10. package/dist/assets/{CallMerge-C4Y56e44.js → CallMerge-Div7wiLM.js} +1 -1
  11. package/dist/assets/{CardContent-DIS6zA0P.js → CardContent-BpUbXRgZ.js} +1 -1
  12. package/dist/assets/{ChevronLeft-ByepaSoC.js → ChevronLeft-CsonlqWZ.js} +1 -1
  13. package/dist/assets/{ChevronRight-Cf_5Xzjf.js → ChevronRight-slnHJMMM.js} +1 -1
  14. package/dist/assets/{Clear-Ch6COz32.js → Clear-By_ldZfu.js} +1 -1
  15. package/dist/assets/{DeleteOutline-ebJSYeqv.js → DeleteOutline-C9MsS08w.js} +1 -1
  16. package/dist/assets/{Done--5OjVF1L.js → Done-D3SMiC_1.js} +1 -1
  17. package/dist/assets/{Edit-Dynoa_c5.js → Edit-C2kFF9YJ.js} +1 -1
  18. package/dist/assets/{ErrorOutline-Bre_iFld.js → ErrorOutline-5-zcM4Ne.js} +1 -1
  19. package/dist/assets/{FilterList-DA2GUvmN.js → FilterList-CjwH8Y-X.js} +1 -1
  20. package/dist/assets/{Google-DgctB8-z.js → Google-DafSaE2h.js} +1 -1
  21. package/dist/assets/{HelpOutline-ByUUQACF.js → HelpOutline-BJpW-l3r.js} +1 -1
  22. package/dist/assets/{KeyboardArrowDown-BW2EjmL2.js → KeyboardArrowDown-TYg9Qprk.js} +1 -1
  23. package/dist/assets/{Launch-O8wdtoRZ.js → Launch-BkIcZSam.js} +1 -1
  24. package/dist/assets/{Link-C0DA-K7d.js → Link-FQWyZFOC.js} +1 -1
  25. package/dist/assets/{ListItemButton-Bi1hEGzW.js → ListItemButton-DvmajTMO.js} +1 -1
  26. package/dist/assets/{ListSubheader-EtXBMK8f.js → ListSubheader-CSUXgXE1.js} +1 -1
  27. package/dist/assets/{LoadingButton-CC22g72o.js → LoadingButton-DHcTITjP.js} +1 -1
  28. package/dist/assets/{MoreVert-DIAAjKU1.js → MoreVert-DuXHnJM1.js} +1 -1
  29. package/dist/assets/{OpenInNew-OpUheJsd.js → OpenInNew-D7AFQ7qH.js} +1 -1
  30. package/dist/assets/{Refresh-wGxvonur.js → Refresh-BLdRb4dq.js} +1 -1
  31. package/dist/assets/{Search-BcGKbDLr.js → Search-CIrZ9Ibh.js} +1 -1
  32. package/dist/assets/{Stepper-WKsCvhQB.js → Stepper-NFExDVoU.js} +1 -1
  33. package/dist/assets/{Switch-BhNob30A.js → Switch-CJHN4f7v.js} +1 -1
  34. package/dist/assets/{TableSearch-DsykJXmz.js → TableSearch-CXlvTHzu.js} +1 -1
  35. package/dist/assets/{ToggleButtonGroup-BeovK254.js → ToggleButtonGroup-TztJlMu5.js} +1 -1
  36. package/dist/assets/{UnfoldMore-CQwxJsaq.js → UnfoldMore-D4wb4PiB.js} +1 -1
  37. package/dist/assets/{Verified-BBY_HS8b.js → Verified-BIJapS2b.js} +1 -1
  38. package/dist/assets/{VerifiedUser-CsU_SR-Q.js → VerifiedUser-Bo-g1veK.js} +1 -1
  39. package/dist/assets/{ViewList-C5VNy_3l.js → ViewList-CKT7zkn0.js} +1 -1
  40. package/dist/assets/{_createAggregator-E-d6FWvu.js → _createAggregator-xnpdRDuH.js} +1 -1
  41. package/dist/assets/{actions-CfPtVW_5.js → actions-B_In1OEq.js} +1 -1
  42. package/dist/assets/{actions-C85Hfsv7.js → actions-DBjGgaan.js} +1 -1
  43. package/dist/assets/{agreement-BOqKQigq.js → agreement-D9n4TVAm.js} +1 -1
  44. package/dist/assets/api-B50CzjXC.js +1 -0
  45. package/dist/assets/{appearance-CnOE1Lt3.js → appearance-Cme4Q5BD.js} +1 -1
  46. package/dist/assets/{audit-logs-C0TwpEZz.js → audit-logs-C6BCcfl1.js} +1 -1
  47. package/dist/assets/{base-chart-CNeCrWCe.js → base-chart-CUFc4seL.js} +1 -1
  48. package/dist/assets/{blocklet-DrlbndLu.js → blocklet-Co-qXCPC.js} +1 -1
  49. package/dist/assets/{chain-C07zUxjw.js → chain-BWj1yQol.js} +1 -1
  50. package/dist/assets/{click-to-copy-mgbEjAVp.js → click-to-copy-DlpsaegJ.js} +1 -1
  51. package/dist/assets/cloneDeep-DPJyiVhO.js +1 -0
  52. package/dist/assets/{collapse-DPhRCMT_.js → collapse-DOmRxR9w.js} +1 -1
  53. package/dist/assets/{config-navigation-C1AJjTTc.js → config-navigation-3XgnTvq_.js} +3 -3
  54. package/dist/assets/{connect-to-Bng6Y8sS.js → connect-to-Dm8w-7IQ.js} +1 -1
  55. package/dist/assets/{cssMode-DQGyC1Du.js → cssMode-BpJODsaG.js} +1 -1
  56. package/dist/assets/{delete-confirm-DLgDxKNU.js → delete-confirm-DbYfIB8I.js} +1 -1
  57. package/dist/assets/{depsEqual-46Dc4Ni4.js → depsEqual-BHfyIN1m.js} +1 -1
  58. package/dist/assets/{detail-BYCOVu21.js → detail-CDpzlMf3.js} +3 -3
  59. package/dist/assets/{domains-BjHKwYRN.js → domains-CnqIlWBr.js} +1 -1
  60. package/dist/assets/{download-BuSoh4PJ.js → download-BIwYEIAP.js} +1 -1
  61. package/dist/assets/{edit.svg-CCrzTWgj.js → edit.svg-Cy4wFBH9.js} +1 -1
  62. package/dist/assets/emotion-cache.browser.esm-CF7qzYNW.js +1 -0
  63. package/dist/assets/engine-B8GFtkk-.js +1 -0
  64. package/dist/assets/{freemarker2-D8jMF7WR.js → freemarker2-BbsoXP_B.js} +1 -1
  65. package/dist/assets/{get-safe-url-D4wQQAus.js → get-safe-url-14Q6Gfeh.js} +1 -1
  66. package/dist/assets/getValidReactChildren-5khuIcs7.js +1 -0
  67. package/dist/assets/{graphqlMode-gngK04Mz.js → graphqlMode-CzqA5BWs.js} +2 -2
  68. package/dist/assets/{handlebars-CMFIkxCR.js → handlebars-BI7IZI6m.js} +1 -1
  69. package/dist/assets/{html-BJoJrX2a.js → html-C4s2FhZC.js} +1 -1
  70. package/dist/assets/{html-title-CDtGVxaB.js → html-title-CH-hjuPz.js} +1 -1
  71. package/dist/assets/{htmlMode-f2GdVJG0.js → htmlMode-D65ghVka.js} +1 -1
  72. package/dist/assets/{iframe-n69t61B3.js → iframe-CyW0Gy1t.js} +1 -1
  73. package/dist/assets/{index-rdWEFiu5.js → index-55nfVIC0.js} +1 -1
  74. package/dist/assets/{index-TupnUKnA.js → index-B0p2z33B.js} +1 -1
  75. package/dist/assets/{index-ClArlBqp.js → index-B2m_raRS.js} +11 -11
  76. package/dist/assets/{index-CD97LOq3.js → index-B2poRPnp.js} +1 -1
  77. package/dist/assets/{index-qmua1knN.js → index-B5NwSFOK.js} +1 -1
  78. package/dist/assets/{index-CypY1XVU.js → index-B5iZbzm_.js} +9 -9
  79. package/dist/assets/{index-D901ppFO.js → index-BHkNOM9n.js} +1 -1
  80. package/dist/assets/{index-B_0Cq7vU.js → index-BPIqxC-U.js} +2 -2
  81. package/dist/assets/{index-HpSfOeJE.js → index-BVJHTf7X.js} +1 -1
  82. package/dist/assets/{index-DY4IRZzA.js → index-BZORkGy0.js} +2 -2
  83. package/dist/assets/{index-CWIZ2lDN.js → index-BZeOf_Tu.js} +1 -1
  84. package/dist/assets/{index-B8iCpTth.js → index-Bbu_zE3x.js} +1 -1
  85. package/dist/assets/{index-DItDGwwa.js → index-BfVOZvkh.js} +1 -1
  86. package/dist/assets/{index-Cbs-jLgW.js → index-BiQXR3Bm.js} +1 -1
  87. package/dist/assets/{index-CAgAgIsZ.js → index-BmA5kukS.js} +1 -1
  88. package/dist/assets/{index-Dy6LJdxo.js → index-BoA3EH-W.js} +1 -1
  89. package/dist/assets/{index-B6Q2auFe.js → index-BqPjiG1G.js} +8 -8
  90. package/dist/assets/{index-ChDDmSQi.js → index-Bu5d1noc.js} +1 -1
  91. package/dist/assets/{index-XHh_P_2P.js → index-CF3eNUVb.js} +1 -1
  92. package/dist/assets/{index-COOkU215.js → index-CMtLSLIZ.js} +1 -1
  93. package/dist/assets/{index-ocWe7l-X.js → index-CND60QrG.js} +1 -1
  94. package/dist/assets/{index-C4kPl4ke.js → index-CW-42AHU.js} +1 -1
  95. package/dist/assets/{index-CE7lTr2p.js → index-CbWepdE1.js} +1 -1
  96. package/dist/assets/{index-Bf_Lmy-N.js → index-CeKndEzp.js} +1 -1
  97. package/dist/assets/{index-F-kjFBf8.js → index-ChAuk3cl.js} +1 -1
  98. package/dist/assets/{index-CreKO5jV.js → index-CoLKcvy8.js} +1 -1
  99. package/dist/assets/{index-CMIUu1l6.js → index-CoTlorpu.js} +1 -1
  100. package/dist/assets/{index-DI_priH-.js → index-CqjR4hs8.js} +1 -1
  101. package/dist/assets/{index-D-dFB32M.js → index-CwApT1Sd.js} +3 -3
  102. package/dist/assets/{index-BNCPRSyc.js → index-D3hM989k.js} +3 -3
  103. package/dist/assets/{index-B2Wn3GKA.js → index-DFXhXlJk.js} +1 -1
  104. package/dist/assets/{index-rn280PvV.js → index-DScXR38D.js} +1 -1
  105. package/dist/assets/{index-DVercaqG.js → index-DWcU23-2.js} +1 -1
  106. package/dist/assets/{index-DGPreTV-.js → index-DYJtcdqz.js} +1 -1
  107. package/dist/assets/{index-alA_n9r0.js → index-DbucqiHf.js} +1 -1
  108. package/dist/assets/{index-Dvzf_pfH.js → index-DcCauHzD.js} +1 -1
  109. package/dist/assets/index-DmFddMrj.js +1 -0
  110. package/dist/assets/{index-CYKSh2bk.js → index-DmlhRLwb.js} +3 -3
  111. package/dist/assets/{index-Cwqr74ON.js → index-Dmnos1kX.js} +1 -1
  112. package/dist/assets/{index-CYGcc8pV.js → index-DqDJse_r.js} +1 -1
  113. package/dist/assets/{index-C18EUjkb.js → index-DvOpuwAA.js} +1 -1
  114. package/dist/assets/{index-CNTrtWQE.js → index-M2fo3HYF.js} +1 -1
  115. package/dist/assets/{index-C3qhc5Io.js → index-Qj6_gIRY.js} +1 -1
  116. package/dist/assets/{index-B8GICsl0.js → index-WZgGKPGR.js} +1 -1
  117. package/dist/assets/{index-BD8Pal3n.js → index-cF2S-dYj.js} +1 -1
  118. package/dist/assets/{index-BXUBcEWf.js → index-sLr5Ytxz.js} +3 -3
  119. package/dist/assets/{index.esm-CAXrUMkM.js → index.esm-DQbImx_I.js} +1 -1
  120. package/dist/assets/{install-from-url-Wdi4EG68.js → install-from-url-J2LtUMoq.js} +1 -1
  121. package/dist/assets/{invitation-nrKDA1Kn.js → invitation-Y_KT9tdR.js} +1 -1
  122. package/dist/assets/{is-path-prefix-equal-CYEkz2os.js → is-path-prefix-equal-R8kSgKPg.js} +1 -1
  123. package/dist/assets/{item-CqSM8aGX.js → item-BLPIRYzp.js} +1 -1
  124. package/dist/assets/{javascript-B6yQKjiF.js → javascript-CVc_Qgjn.js} +1 -1
  125. package/dist/assets/{jsonMode-DkoM9aoY.js → jsonMode-DgyIRwXr.js} +1 -1
  126. package/dist/assets/{liquid-D7xIqXac.js → liquid-D65B7N7C.js} +1 -1
  127. package/dist/assets/{list-header-BWEUzaBX.js → list-header-DnI-B5kv.js} +1 -1
  128. package/dist/assets/{lock.svg-BSFciPfs.js → lock.svg-hi5yMnJ1.js} +1 -1
  129. package/dist/assets/{log-CdkXyW5t.js → log-B7iwZqYi.js} +1 -1
  130. package/dist/assets/{lottie-react.esm-RgV5Mvhb.js → lottie-react.esm-DNVXvBzr.js} +1 -1
  131. package/dist/assets/{mdx-Ddv0C9rb.js → mdx-BxX4PI2U.js} +1 -1
  132. package/dist/assets/{memory-dEa_r_d8.js → memory-vDDFn9lp.js} +1 -1
  133. package/dist/assets/{metric-Cat2Yufj.js → metric-DQy5zRdQ.js} +1 -1
  134. package/dist/assets/omit-CyaEv8Dl.js +1 -0
  135. package/dist/assets/{overview-DEC4e0Df.js → overview-p214oVcV.js} +1 -1
  136. package/dist/assets/{permission-C1lOJdTa.js → permission-DHM_Uhje.js} +1 -1
  137. package/dist/assets/{preference-BHwgiNrV.js → preference-CnzOTj3F.js} +3 -3
  138. package/dist/assets/{python-9TSgWHrh.js → python-CxsGjqcE.js} +1 -1
  139. package/dist/assets/{raf-schd.esm-CnfzVLep.js → raf-schd.esm-5K54oGhm.js} +1 -1
  140. package/dist/assets/{razor-QGFiiIP_.js → razor-DyGdbkd6.js} +1 -1
  141. package/dist/assets/{rotate-session-key-ICcx3tCe.js → rotate-session-key-D0cclybl.js} +1 -1
  142. package/dist/assets/{runtime-CvzCs6VN.js → runtime-CA_vnels.js} +1 -1
  143. package/dist/assets/schema-B-ts56Ax.js +1 -0
  144. package/dist/assets/sdk-Gp4bri9Y.js +1 -0
  145. package/dist/assets/{service-DSCUseEH.js → service-DA_A2jR4.js} +1 -1
  146. package/dist/assets/{shorten-label-BguF3cwJ.js → shorten-label-DhnoyJGB.js} +1 -1
  147. package/dist/assets/{simple-select-CBZtGNFi.js → simple-select-ooXqK-jE.js} +1 -1
  148. package/dist/assets/{spaces-DWWw-hnQ.js → spaces-pOZOSMK4.js} +1 -1
  149. package/dist/assets/{status-BiPp7u_X.js → status-BzJsqaQ5.js} +1 -1
  150. package/dist/assets/{status-DA56DtZT.js → status-CUv1Zltf.js} +1 -1
  151. package/dist/assets/{switch-control-33eNnRFB.js → switch-control-CGJvFC5A.js} +1 -1
  152. package/dist/assets/{table-icons-Cx2WnWde.js → table-icons-CwKGpe-L.js} +1 -1
  153. package/dist/assets/{team-Bv3LojgN.js → team-Dmx94iJo.js} +1 -1
  154. package/dist/assets/{toLower-uukMw69d.js → toLower-CFmpAjUt.js} +1 -1
  155. package/dist/assets/toUpper-BejUmrup.js +1 -0
  156. package/dist/assets/{traffic-QPS_JGtF.js → traffic-C0kPrhjJ.js} +1 -1
  157. package/dist/assets/{tsMode-CihLBg_5.js → tsMode-jZmbwl1N.js} +1 -1
  158. package/dist/assets/{typescript-CejJAf0y.js → typescript-dLvCYGkn.js} +1 -1
  159. package/dist/assets/{url-evaluation-mbcZFwZv.js → url-evaluation-CwmddBcY.js} +1 -1
  160. package/dist/assets/{url-join-CWTNXc5s.js → url-join-Dsyhdnws.js} +1 -1
  161. package/dist/assets/{use-mobile-v1FgCHxE.js → use-mobile-1I4QCh-N.js} +1 -1
  162. package/dist/assets/{use-mobile-DgLeM-D1.js → use-mobile-DqN9gudu.js} +1 -1
  163. package/dist/assets/{useAsync-qB657l8w.js → useAsync-CQunl03f.js} +1 -1
  164. package/dist/assets/{useAsyncRetry-BM67-AEe.js → useAsyncRetry-CjGr0FZe.js} +1 -1
  165. package/dist/assets/{useLocalStorage-X_cL3pYP.js → useLocalStorage-B6bhow_S.js} +1 -1
  166. package/dist/assets/{useThemeProps-BS8q21Ze.js → useThemeProps-DRCiWG5p.js} +1 -1
  167. package/dist/assets/{util-GsRauHGT.js → util-CJB4l2qD.js} +1 -1
  168. package/dist/assets/{wait-container-B_Dc4NpO.js → wait-container-Do1jfS7d.js} +1 -1
  169. package/dist/assets/{without-wallet-i0gb4gDU.js → without-wallet-BR6Y7zpF.js} +1 -1
  170. package/dist/assets/wrap-locale-CJqYMDgp.js +1 -0
  171. package/dist/assets/{xml-CXKq8G6H.js → xml-CgXlUmBT.js} +1 -1
  172. package/dist/assets/{yaml-DCnIpBTS.js → yaml-Bb8HrmNf.js} +1 -1
  173. package/dist/index.html +1 -1
  174. package/dist/service-worker.js +1 -1
  175. package/package.json +1 -1
  176. package/dist/assets/ArrowDropDown-Dt1OnkjV.js +0 -1
  177. package/dist/assets/api-1_6mJDDc.js +0 -1
  178. package/dist/assets/cloneDeep-iGPmlcW1.js +0 -1
  179. package/dist/assets/emotion-cache.browser.esm-Do6mSgYp.js +0 -1
  180. package/dist/assets/engine-BomELkty.js +0 -1
  181. package/dist/assets/getValidReactChildren-C1VhNdur.js +0 -1
  182. package/dist/assets/index-DYf0NUXR.js +0 -1
  183. package/dist/assets/omit-CfNSSESR.js +0 -1
  184. package/dist/assets/schema-hfM92ahP.js +0 -1
  185. package/dist/assets/sdk-TMvcAePy.js +0 -1
  186. package/dist/assets/toUpper-CEwZrf0n.js +0 -1
  187. package/dist/assets/wrap-locale-LMhScF83.js +0 -1
@@ -1,4 +1,4 @@
1
- import{c1 as Ke,c0 as Fe,r as h,c2 as Ge,j as e,b9 as ee,c4 as Ye,ch as J,c5 as $e,b_ as He,cj as qe,aF as he,M as q,bo as A,cw as Ce,H as B,Y as V,bg as E,fD as we,aQ as Be,b as N,iP as Ve,V as D,gD as Qe,o as f,x as Xe,ax as De,y as fe,al as Ze,p as Je,C as L,T as j,k as et,s as tt,f as ot,iQ as X,h_ as Z,iR as st,K as S,aW as K,aH as T,L as nt,g as H,dm as at,O as Se,R as G,aE as Y,a9 as $,a5 as rt,bB as it,fu as ct,b0 as lt,v as pe,w as dt,G as be,Z as Ee,bE as xe,B as pt}from"./index-DY4IRZzA.js";import{T as ut}from"./html-title-CDtGVxaB.js";import{u as U}from"./blocklet-DrlbndLu.js";import{u as mt}from"./use-mobile-v1FgCHxE.js";import{c as Ie,d as ft,e as xt,f as gt,g as ue,h as ht,b as St,u as yt,C as bt,D as kt,a as jt}from"./connect-to-Bng6Y8sS.js";import"./index-CYGcc8pV.js";import"./index-BojVbZw0.js";import"./api-1_6mJDDc.js";import{d as Ct,a as wt,g as Bt,i as Dt,e as ge,f as Et,h as It,j as Tt}from"./spaces-DWWw-hnQ.js";import{v as Rt}from"./index-C4kPl4ke.js";import{E as zt}from"./index-DVercaqG.js";import{H as vt}from"./HelpOutline-ByUUQACF.js";import{H as Pt}from"./index-D901ppFO.js";import{x as At}from"./index-DRYJ0xIl.js";import{c as Lt}from"./actions-C85Hfsv7.js";import{D as Ut}from"./DeleteOutline-ebJSYeqv.js";import{g as ke}from"./get-safe-url-D4wQQAus.js";import{S as Ot}from"./switch-control-33eNnRFB.js";import{L as je}from"./list-header-BWEUzaBX.js";import"./OpenInNew-OpUheJsd.js";import"./ButtonGroup-BtGO-VCX.js";import"./getValidReactChildren-C1VhNdur.js";import"./FilterList-DA2GUvmN.js";import"./CSSTransition-Cj0uEEEn.js";import"./emotion-cache.browser.esm-Do6mSgYp.js";import"./index-C18EUjkb.js";import"./redux-DfszZyTl.js";import"./typeof-QjJsDpFa.js";import"./depsEqual-46Dc4Ni4.js";import"./index-C3qhc5Io.js";import"./TableSearch-DsykJXmz.js";import"./Search-BcGKbDLr.js";import"./Clear-Ch6COz32.js";import"./MoreVert-DIAAjKU1.js";import"./useLocalStorage-X_cL3pYP.js";import"./url-evaluation-mbcZFwZv.js";import"./permission-C1lOJdTa.js";import"./Switch-BhNob30A.js";function Mt(t){return Ke("MuiIcon",t)}Fe("MuiIcon",["root","colorPrimary","colorSecondary","colorAction","colorError","colorDisabled","fontSizeInherit","fontSizeSmall","fontSizeMedium","fontSizeLarge"]);const Nt=t=>{const{color:o,fontSize:n,classes:s}=t,r={root:["root",o!=="inherit"&&`color${J(o)}`,`fontSize${J(n)}`]};return $e(r,Mt,s)},_t=ee("span",{name:"MuiIcon",slot:"Root",overridesResolver:(t,o)=>{const{ownerState:n}=t;return[o.root,n.color!=="inherit"&&o[`color${J(n.color)}`],o[`fontSize${J(n.fontSize)}`]]}})(He(({theme:t})=>({userSelect:"none",width:"1em",height:"1em",overflow:"hidden",display:"inline-block",textAlign:"center",flexShrink:0,variants:[{props:{fontSize:"inherit"},style:{fontSize:"inherit"}},{props:{fontSize:"small"},style:{fontSize:t.typography.pxToRem(20)}},{props:{fontSize:"medium"},style:{fontSize:t.typography.pxToRem(24)}},{props:{fontSize:"large"},style:{fontSize:t.typography.pxToRem(36)}},{props:{color:"action"},style:{color:(t.vars||t).palette.action.active}},{props:{color:"disabled"},style:{color:(t.vars||t).palette.action.disabled}},{props:{color:"inherit"},style:{color:void 0}},...Object.entries(t.palette).filter(qe()).map(([o])=>({props:{color:o},style:{color:(t.vars||t).palette[o].main}}))]}))),ye=h.forwardRef(function(o,n){const s=Ge({props:o,name:"MuiIcon"}),{baseClassName:r="material-icons",className:a,color:c="inherit",component:i="span",fontSize:d="medium",...l}=s,p={...s,baseClassName:r,color:c,component:i,fontSize:d},u=Nt(p);return e.jsx(_t,{as:i,className:Ye(r,"notranslate",u.root,a),ownerState:p,"aria-hidden":!0,ref:n,...l})});ye.muiName="Icon";const Wt=he(e.jsx("path",{d:"M6 6v2h8.59L5 17.59 6.41 19 16 9.41V18h2V6z"})),Kt=he(e.jsx("path",{d:"M14.69 2.21 4.33 11.49c-.64.58-.28 1.65.58 1.73L13 14l-4.85 6.76c-.22.31-.19.74.08 1.01.3.3.77.31 1.08.02l10.36-9.28c.64-.58.28-1.65-.58-1.73L11 10l4.85-6.76c.22-.31.19-.74-.08-1.01-.3-.3-.77-.31-1.08-.02"})),Ft=he(e.jsx("path",{d:"m9.17 6 2 2H20v10H4V6zM10 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2h-8z"}));async function Gt({blockletDid:t,nodeApi:o,spaceGateways:n}){let s=!1;const r=await Promise.all(n.map(async a=>{let{name:c}=a;const i=await Ct(a.endpoint);return!q(i)&&i!==c&&(c=i,s=!0),{...a,name:c}}));return s&&await Promise.all(r.filter(a=>a.did).map(a=>o.updateBlockletSpaceGateway({input:{did:t,where:{did:a.did},spaceGateway:{...a}}}))),r}function Yt({refresh:t}={}){const{blocklet:o}=U(),n=o?.meta?.did,{api:s}=A();return Ce(async()=>{if(!n)return[];const{spaceGateways:r}=await s.getBlockletSpaceGateways({input:{did:n}});return await Gt({blockletDid:n,nodeApi:s,spaceGateways:r})??[]},{refreshDeps:[n,t],onError(r){r?.message?.includes("not logged")?console.warn(r):(console.error(r),B.error(V(r)))}})}function Te({deps:t,setLoading:o,backupDate:n}={deps:[],setLoading:()=>{},backupDate:new Date}){const{blocklet:s}=U(),[r,a]=h.useState([]),{api:c}=A(),[i,d]=h.useMemo(()=>n?[E(n).startOf("day").toISOString(),E(n).endOf("day").toISOString()]:[E().startOf("year").toISOString(),E().endOf("day").toISOString()],[n]),l=we(async()=>{try{if(o(!0),!s){a([]);return}const{backups:p}=await c.getBlockletBackups({input:{did:s.meta.did,startTime:i,endTime:d}});a(p??[])}catch(p){console.error(p),B.error(V(p))}finally{o(!1)}},1e3);return Be(async()=>{l()},[s?.meta?.did].concat(t)),{backups:r}}function $t({appDid:t}){const{backups:o}=Te(),[n,s]=h.useState({message:"",progress:0,completed:!1}),r=A(),{ws:{useSubscription:a}}=r;return a(N.BlockletEvents.backupProgress,c=>{t===c?.appDid&&s(()=>({...c}))},[t]),h.useEffect(()=>{if(o?.length&&Ve(o[0]?.status)){const[c]=o;s(()=>({message:c.message,progress:c.progress,completed:c.progress>=100}))}},[o]),n}function Ht({deps:t=[],setLoading:o=()=>{}}={}){const{blocklet:n}=U(),[s,r]=h.useState([]),{api:a}=A(),c=h.useCallback(we(async()=>{if(!a||!n?.meta?.did){r([]);return}try{o(!0);const i=E(),d=i.subtract(1,"year"),{summary:l}=await a.getBlockletBackupSummary({input:{did:n.meta.did,startTime:d.toISOString(),endTime:i.toISOString()}}),p=Array.isArray(l)?l.map(u=>({...u,successCount:+u.successCount,errorCount:+u.errorCount})):[];r(p)}catch(i){console.error("Failed to fetch backup summary:",i),B.error(V(i)),r([])}finally{o(!1)}},1e3),[]);return Be(async()=>(await c(),()=>{c.cancel()}),[n?.meta?.did].concat(t)),{backupSummary:s}}const Re=h.createContext({}),{Provider:qt,Consumer:Ho}=Re;function ze({children:t}){const{t:o}=D(),{api:n}=A(),{blocklet:s}=U(),[r,a]=h.useState(null),[c,i]=h.useState(!1),{data:d,loading:l,mutate:p}=Yt({refresh:c}),u=Qe(d),x=$t({appDid:s?.appDid}),m=h.useMemo(()=>wt(s?.environments),[s?.environments]),[k,w]=h.useState(!1),[y,b]=h.useState(0),{backups:te}=Te({deps:[y,r],setLoading:w,backupDate:r}),[oe,se]=h.useState(0),{backupSummary:ne}=Ht({deps:[oe]}),[_,M]=h.useState(d?.find(g=>g.endpoint===m)),I=s?.settings?.autoBackup,z=()=>{i(g=>!g)},ae=()=>{se(g=>g+1)},re=()=>{b(g=>g+1)},F=async g=>{await n.updateAutoBackup({input:{did:s.meta.did,autoBackup:g}})},Q=async()=>{await n.abortBlockletBackup({input:{appPid:s.meta.did}})},ie=async(g,P)=>{try{p(R=>{const v=[...R];return v.push({...g,loading:!0}),v}),await n.addBlockletSpaceGateway({input:{did:s.meta.did,spaceGateway:g}}),m!==P&&await n.configBlocklet({input:{did:[s.meta.did],configs:[{key:N.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:P}]}}),M(g),z(),B.success(o("storage.spaces.connectedWithName",{name:g?.name??"DID Spaces"}))}catch(R){throw console.error(R),p(v=>[...v].filter(W=>W.did!==g.did)),R}},ce=async g=>{g&&(g.endpoint===m&&(await n.configBlocklet({input:{did:[s.meta.did],configs:[{key:N.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:""}]}}),I?.enabled&&await F({enabled:!1})),await n.deleteBlockletSpaceGateway({input:{did:s.meta.did,spaceGatewayDid:g?.did}}),p(P=>{const R=[...P];return R.splice(R.indexOf(g),1),R}),M(g),z())},le=async g=>{await Promise.all([n.updateBlockletSpaceGateway({input:{did:s.meta.did,where:{did:g.did},spaceGateway:g}}),m!==g.endpoint&&n.configBlocklet({input:{did:[s.meta.did],configs:[{key:N.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:g.endpoint}]}})]),B.success(o("storage.spaces.connectedWithName",{name:g?.name??"DID Spaces"})),z()},C=g=>g?.endpoint===m;return e.jsx(qt,{value:{spaceGateways:d||[],selectedSpaceGateway:_,addSpaceGateway:ie,deleteSpaceGateway:ce,updateSpaceGateway:le,refreshSpaceGateways:z,spaceGatewaysLoading:l,spaceGatewaysFirstLoading:u,spaceGatewayIsSelected:C,updateAutoBackup:F,abortBlockletBackup:Q,backupEndpoint:m,backupProgress:x,backups:te,backupSummary:ne,refreshBackupSummary:ae,refreshBackups:re,setBackupDate:a,backupsLoading:k,autoBackup:I},children:t})}ze.propTypes={children:f.any.isRequired};function O(){return h.useContext(Re)}function ve({...t}){const{blocklet:o}=U(),{info:n}=A(),{t:s}=D(),r=Ie({blocklet:o}),a=Xe(n),{spaceGateways:c,addSpaceGateway:i}=O(),d={checkFn:De.create({baseURL:fe(window.location.origin,Ze())}).get,webWalletUrl:a,extraParams:{appPid:o.appPid,appDid:r.appDid,appName:r.appName,appDescription:r.appDescription,appUrl:r.appUrl,referrer:r.referrer,scopes:r.scopes,nodeDid:n.did}},l=async({endpoint:u,name:x,did:m})=>{const k=await Bt(u);if(!await Dt(k)){B.error(s("storage.spaces.gateway.add.invalidUrl"));return}if(c.some(b=>b.endpoint===u)){B.error(s("storage.spaces.gateway.add.duplicate",{name:x}));return}await i({name:x,did:m,url:k,endpoint:u},u)},p=async({spaceGateway:u})=>{try{await l(u)}catch(x){console.error(x),B.error(V(x))}};return e.jsx(ft,{...t,connectScope:"app",options:d,onSuccess:p})}function Vt(){const{api:t}=A(),{blocklet:o}=U(),{data:n,loading:s}=Ce(()=>t.getBlocklet({input:{did:o?.meta?.did,attachDiskInfo:!0,attachRuntimeInfo:!0}}),{ready:!!o?.meta?.did,refreshDeps:[o?.meta?.did]});return{blocklet:n?.blocklet??null,loading:s}}function Pe({...t}){const{t:o}=h.useContext(Je),{blocklet:n,loading:s}=Vt();if(n?.diskInfo){const r=(i,d,l)=>e.jsxs(j,{children:[i," ",e.jsx("strong",{children:d?et(d):"empty"})]}),a=n.environments.reduce((i,d)=>(i[d.key]=d.value,i),{}),c=[{key:"appDir",name:o("blocklet.diskInfo.appDir"),value:r(a.BLOCKLET_APP_DIR,n.diskInfo.app)},{key:"dataDir",name:o("blocklet.diskInfo.dataDir"),value:r(a.BLOCKLET_DATA_DIR,n.diskInfo.data)},{key:"logDir",name:o("blocklet.diskInfo.logDir"),value:r(a.BLOCKLET_LOG_DIR,n.diskInfo.log)},{key:"cacheDir",name:o("blocklet.diskInfo.cacheDir"),value:r(a.BLOCKLET_CACHE_DIR,n.diskInfo.cache)}];return e.jsx(Qt,{component:"div",...t,children:c.map(i=>e.jsx(Rt,{valueComponent:"div",nameWidth:120,name:i.name,children:i.value},i.key))})}return s?e.jsx(L,{}):e.jsx(j,{children:o("blocklet.diskInfo.empty")})}const Qt=tt(j)``;function Ae(){const{t}=D(),{setBackupDate:o,backupSummary:n}=O(),s=xt({key:"lg"}),r=h.useRef(null),a=ot(),c=h.useCallback(l=>{o(l)},[o]),i=h.useMemo(()=>{const l=E().add(1,"day"),p=l.subtract(1,"year"),u=new Map(n.map(m=>[m.date,{date:m.date,successCount:m.successCount,errorCount:m.errorCount}])),x=[];for(let m=p.clone();E(m).isBefore(l);m=m.add(1,"day")){const k=m.format("YYYY-MM-DD");x.push(u.get(k)||{date:k,successCount:0,errorCount:0})}return x},[n]),d=h.useMemo(()=>({grid:{containLabel:!0,right:10,top:30,bottom:12},tooltip:{formatter:k=>{const{date:w,successCount:y,errorCount:b}=i[k.dataIndex]||{date:k.data[0],successCount:0,errorCount:0};return[`<div>${t("common.time")}: ${w}</div>`,`<div>${t("common.succeeded")}: ${y}</div>`,`<div>${t("common.failed")}: ${b}</div>`].join(`
1
+ import{c1 as Ke,c0 as Fe,r as h,c2 as Ge,j as e,b9 as ee,c4 as Ye,ch as J,c5 as $e,b_ as He,cj as qe,aF as he,M as q,bo as A,cw as Ce,H as B,Y as V,bg as E,fD as we,aQ as Be,b as N,iP as Ve,V as D,gD as Qe,o as f,x as Xe,ax as De,y as fe,al as Ze,p as Je,C as L,T as j,k as et,s as tt,f as ot,iQ as X,h_ as Z,iR as st,K as S,aW as K,aH as T,L as nt,g as H,dm as at,O as Se,R as G,aE as Y,a9 as $,a5 as rt,bB as it,fu as ct,b0 as lt,v as pe,w as dt,G as be,Z as Ee,bE as xe,B as pt}from"./index-BZORkGy0.js";import{T as ut}from"./html-title-CH-hjuPz.js";import{u as U}from"./blocklet-Co-qXCPC.js";import{u as mt}from"./use-mobile-1I4QCh-N.js";import{c as Ie,d as ft,e as xt,f as gt,g as ue,h as ht,b as St,u as yt,C as bt,D as kt,a as jt}from"./connect-to-Dm8w-7IQ.js";import"./index-DqDJse_r.js";import"./index-BojVbZw0.js";import"./api-B50CzjXC.js";import{d as Ct,a as wt,g as Bt,i as Dt,e as ge,f as Et,h as It,j as Tt}from"./spaces-pOZOSMK4.js";import{v as Rt}from"./index-CW-42AHU.js";import{E as zt}from"./index-DWcU23-2.js";import{H as vt}from"./HelpOutline-BJpW-l3r.js";import{H as Pt}from"./index-BHkNOM9n.js";import{x as At}from"./index-DRYJ0xIl.js";import{c as Lt}from"./actions-DBjGgaan.js";import{D as Ut}from"./DeleteOutline-C9MsS08w.js";import{g as ke}from"./get-safe-url-14Q6Gfeh.js";import{S as Ot}from"./switch-control-CGJvFC5A.js";import{L as je}from"./list-header-DnI-B5kv.js";import"./OpenInNew-D7AFQ7qH.js";import"./ButtonGroup-uhq9NqjP.js";import"./getValidReactChildren-5khuIcs7.js";import"./FilterList-CjwH8Y-X.js";import"./CSSTransition-5vBScTx4.js";import"./emotion-cache.browser.esm-CF7qzYNW.js";import"./index-DvOpuwAA.js";import"./redux-DfszZyTl.js";import"./typeof-QjJsDpFa.js";import"./depsEqual-BHfyIN1m.js";import"./index-Qj6_gIRY.js";import"./TableSearch-CXlvTHzu.js";import"./Search-CIrZ9Ibh.js";import"./Clear-By_ldZfu.js";import"./MoreVert-DuXHnJM1.js";import"./useLocalStorage-B6bhow_S.js";import"./url-evaluation-CwmddBcY.js";import"./permission-DHM_Uhje.js";import"./Switch-CJHN4f7v.js";function Mt(t){return Ke("MuiIcon",t)}Fe("MuiIcon",["root","colorPrimary","colorSecondary","colorAction","colorError","colorDisabled","fontSizeInherit","fontSizeSmall","fontSizeMedium","fontSizeLarge"]);const Nt=t=>{const{color:o,fontSize:n,classes:s}=t,r={root:["root",o!=="inherit"&&`color${J(o)}`,`fontSize${J(n)}`]};return $e(r,Mt,s)},_t=ee("span",{name:"MuiIcon",slot:"Root",overridesResolver:(t,o)=>{const{ownerState:n}=t;return[o.root,n.color!=="inherit"&&o[`color${J(n.color)}`],o[`fontSize${J(n.fontSize)}`]]}})(He(({theme:t})=>({userSelect:"none",width:"1em",height:"1em",overflow:"hidden",display:"inline-block",textAlign:"center",flexShrink:0,variants:[{props:{fontSize:"inherit"},style:{fontSize:"inherit"}},{props:{fontSize:"small"},style:{fontSize:t.typography.pxToRem(20)}},{props:{fontSize:"medium"},style:{fontSize:t.typography.pxToRem(24)}},{props:{fontSize:"large"},style:{fontSize:t.typography.pxToRem(36)}},{props:{color:"action"},style:{color:(t.vars||t).palette.action.active}},{props:{color:"disabled"},style:{color:(t.vars||t).palette.action.disabled}},{props:{color:"inherit"},style:{color:void 0}},...Object.entries(t.palette).filter(qe()).map(([o])=>({props:{color:o},style:{color:(t.vars||t).palette[o].main}}))]}))),ye=h.forwardRef(function(o,n){const s=Ge({props:o,name:"MuiIcon"}),{baseClassName:r="material-icons",className:a,color:c="inherit",component:i="span",fontSize:d="medium",...l}=s,p={...s,baseClassName:r,color:c,component:i,fontSize:d},u=Nt(p);return e.jsx(_t,{as:i,className:Ye(r,"notranslate",u.root,a),ownerState:p,"aria-hidden":!0,ref:n,...l})});ye.muiName="Icon";const Wt=he(e.jsx("path",{d:"M6 6v2h8.59L5 17.59 6.41 19 16 9.41V18h2V6z"})),Kt=he(e.jsx("path",{d:"M14.69 2.21 4.33 11.49c-.64.58-.28 1.65.58 1.73L13 14l-4.85 6.76c-.22.31-.19.74.08 1.01.3.3.77.31 1.08.02l10.36-9.28c.64-.58.28-1.65-.58-1.73L11 10l4.85-6.76c.22-.31.19-.74-.08-1.01-.3-.3-.77-.31-1.08-.02"})),Ft=he(e.jsx("path",{d:"m9.17 6 2 2H20v10H4V6zM10 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2h-8z"}));async function Gt({blockletDid:t,nodeApi:o,spaceGateways:n}){let s=!1;const r=await Promise.all(n.map(async a=>{let{name:c}=a;const i=await Ct(a.endpoint);return!q(i)&&i!==c&&(c=i,s=!0),{...a,name:c}}));return s&&await Promise.all(r.filter(a=>a.did).map(a=>o.updateBlockletSpaceGateway({input:{did:t,where:{did:a.did},spaceGateway:{...a}}}))),r}function Yt({refresh:t}={}){const{blocklet:o}=U(),n=o?.meta?.did,{api:s}=A();return Ce(async()=>{if(!n)return[];const{spaceGateways:r}=await s.getBlockletSpaceGateways({input:{did:n}});return await Gt({blockletDid:n,nodeApi:s,spaceGateways:r})??[]},{refreshDeps:[n,t],onError(r){r?.message?.includes("not logged")?console.warn(r):(console.error(r),B.error(V(r)))}})}function Te({deps:t,setLoading:o,backupDate:n}={deps:[],setLoading:()=>{},backupDate:new Date}){const{blocklet:s}=U(),[r,a]=h.useState([]),{api:c}=A(),[i,d]=h.useMemo(()=>n?[E(n).startOf("day").toISOString(),E(n).endOf("day").toISOString()]:[E().startOf("year").toISOString(),E().endOf("day").toISOString()],[n]),l=we(async()=>{try{if(o(!0),!s){a([]);return}const{backups:p}=await c.getBlockletBackups({input:{did:s.meta.did,startTime:i,endTime:d}});a(p??[])}catch(p){console.error(p),B.error(V(p))}finally{o(!1)}},1e3);return Be(async()=>{l()},[s?.meta?.did].concat(t)),{backups:r}}function $t({appDid:t}){const{backups:o}=Te(),[n,s]=h.useState({message:"",progress:0,completed:!1}),r=A(),{ws:{useSubscription:a}}=r;return a(N.BlockletEvents.backupProgress,c=>{t===c?.appDid&&s(()=>({...c}))},[t]),h.useEffect(()=>{if(o?.length&&Ve(o[0]?.status)){const[c]=o;s(()=>({message:c.message,progress:c.progress,completed:c.progress>=100}))}},[o]),n}function Ht({deps:t=[],setLoading:o=()=>{}}={}){const{blocklet:n}=U(),[s,r]=h.useState([]),{api:a}=A(),c=h.useCallback(we(async()=>{if(!a||!n?.meta?.did){r([]);return}try{o(!0);const i=E(),d=i.subtract(1,"year"),{summary:l}=await a.getBlockletBackupSummary({input:{did:n.meta.did,startTime:d.toISOString(),endTime:i.toISOString()}}),p=Array.isArray(l)?l.map(u=>({...u,successCount:+u.successCount,errorCount:+u.errorCount})):[];r(p)}catch(i){console.error("Failed to fetch backup summary:",i),B.error(V(i)),r([])}finally{o(!1)}},1e3),[]);return Be(async()=>(await c(),()=>{c.cancel()}),[n?.meta?.did].concat(t)),{backupSummary:s}}const Re=h.createContext({}),{Provider:qt,Consumer:Ho}=Re;function ze({children:t}){const{t:o}=D(),{api:n}=A(),{blocklet:s}=U(),[r,a]=h.useState(null),[c,i]=h.useState(!1),{data:d,loading:l,mutate:p}=Yt({refresh:c}),u=Qe(d),x=$t({appDid:s?.appDid}),m=h.useMemo(()=>wt(s?.environments),[s?.environments]),[k,w]=h.useState(!1),[y,b]=h.useState(0),{backups:te}=Te({deps:[y,r],setLoading:w,backupDate:r}),[oe,se]=h.useState(0),{backupSummary:ne}=Ht({deps:[oe]}),[_,M]=h.useState(d?.find(g=>g.endpoint===m)),I=s?.settings?.autoBackup,z=()=>{i(g=>!g)},ae=()=>{se(g=>g+1)},re=()=>{b(g=>g+1)},F=async g=>{await n.updateAutoBackup({input:{did:s.meta.did,autoBackup:g}})},Q=async()=>{await n.abortBlockletBackup({input:{appPid:s.meta.did}})},ie=async(g,P)=>{try{p(R=>{const v=[...R];return v.push({...g,loading:!0}),v}),await n.addBlockletSpaceGateway({input:{did:s.meta.did,spaceGateway:g}}),m!==P&&await n.configBlocklet({input:{did:[s.meta.did],configs:[{key:N.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:P}]}}),M(g),z(),B.success(o("storage.spaces.connectedWithName",{name:g?.name??"DID Spaces"}))}catch(R){throw console.error(R),p(v=>[...v].filter(W=>W.did!==g.did)),R}},ce=async g=>{g&&(g.endpoint===m&&(await n.configBlocklet({input:{did:[s.meta.did],configs:[{key:N.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:""}]}}),I?.enabled&&await F({enabled:!1})),await n.deleteBlockletSpaceGateway({input:{did:s.meta.did,spaceGatewayDid:g?.did}}),p(P=>{const R=[...P];return R.splice(R.indexOf(g),1),R}),M(g),z())},le=async g=>{await Promise.all([n.updateBlockletSpaceGateway({input:{did:s.meta.did,where:{did:g.did},spaceGateway:g}}),m!==g.endpoint&&n.configBlocklet({input:{did:[s.meta.did],configs:[{key:N.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:g.endpoint}]}})]),B.success(o("storage.spaces.connectedWithName",{name:g?.name??"DID Spaces"})),z()},C=g=>g?.endpoint===m;return e.jsx(qt,{value:{spaceGateways:d||[],selectedSpaceGateway:_,addSpaceGateway:ie,deleteSpaceGateway:ce,updateSpaceGateway:le,refreshSpaceGateways:z,spaceGatewaysLoading:l,spaceGatewaysFirstLoading:u,spaceGatewayIsSelected:C,updateAutoBackup:F,abortBlockletBackup:Q,backupEndpoint:m,backupProgress:x,backups:te,backupSummary:ne,refreshBackupSummary:ae,refreshBackups:re,setBackupDate:a,backupsLoading:k,autoBackup:I},children:t})}ze.propTypes={children:f.any.isRequired};function O(){return h.useContext(Re)}function ve({...t}){const{blocklet:o}=U(),{info:n}=A(),{t:s}=D(),r=Ie({blocklet:o}),a=Xe(n),{spaceGateways:c,addSpaceGateway:i}=O(),d={checkFn:De.create({baseURL:fe(window.location.origin,Ze())}).get,webWalletUrl:a,extraParams:{appPid:o.appPid,appDid:r.appDid,appName:r.appName,appDescription:r.appDescription,appUrl:r.appUrl,referrer:r.referrer,scopes:r.scopes,nodeDid:n.did}},l=async({endpoint:u,name:x,did:m})=>{const k=await Bt(u);if(!await Dt(k)){B.error(s("storage.spaces.gateway.add.invalidUrl"));return}if(c.some(b=>b.endpoint===u)){B.error(s("storage.spaces.gateway.add.duplicate",{name:x}));return}await i({name:x,did:m,url:k,endpoint:u},u)},p=async({spaceGateway:u})=>{try{await l(u)}catch(x){console.error(x),B.error(V(x))}};return e.jsx(ft,{...t,connectScope:"app",options:d,onSuccess:p})}function Vt(){const{api:t}=A(),{blocklet:o}=U(),{data:n,loading:s}=Ce(()=>t.getBlocklet({input:{did:o?.meta?.did,attachDiskInfo:!0,attachRuntimeInfo:!0}}),{ready:!!o?.meta?.did,refreshDeps:[o?.meta?.did]});return{blocklet:n?.blocklet??null,loading:s}}function Pe({...t}){const{t:o}=h.useContext(Je),{blocklet:n,loading:s}=Vt();if(n?.diskInfo){const r=(i,d,l)=>e.jsxs(j,{children:[i," ",e.jsx("strong",{children:d?et(d):"empty"})]}),a=n.environments.reduce((i,d)=>(i[d.key]=d.value,i),{}),c=[{key:"appDir",name:o("blocklet.diskInfo.appDir"),value:r(a.BLOCKLET_APP_DIR,n.diskInfo.app)},{key:"dataDir",name:o("blocklet.diskInfo.dataDir"),value:r(a.BLOCKLET_DATA_DIR,n.diskInfo.data)},{key:"logDir",name:o("blocklet.diskInfo.logDir"),value:r(a.BLOCKLET_LOG_DIR,n.diskInfo.log)},{key:"cacheDir",name:o("blocklet.diskInfo.cacheDir"),value:r(a.BLOCKLET_CACHE_DIR,n.diskInfo.cache)}];return e.jsx(Qt,{component:"div",...t,children:c.map(i=>e.jsx(Rt,{valueComponent:"div",nameWidth:120,name:i.name,children:i.value},i.key))})}return s?e.jsx(L,{}):e.jsx(j,{children:o("blocklet.diskInfo.empty")})}const Qt=tt(j)``;function Ae(){const{t}=D(),{setBackupDate:o,backupSummary:n}=O(),s=xt({key:"lg"}),r=h.useRef(null),a=ot(),c=h.useCallback(l=>{o(l)},[o]),i=h.useMemo(()=>{const l=E().add(1,"day"),p=l.subtract(1,"year"),u=new Map(n.map(m=>[m.date,{date:m.date,successCount:m.successCount,errorCount:m.errorCount}])),x=[];for(let m=p.clone();E(m).isBefore(l);m=m.add(1,"day")){const k=m.format("YYYY-MM-DD");x.push(u.get(k)||{date:k,successCount:0,errorCount:0})}return x},[n]),d=h.useMemo(()=>({grid:{containLabel:!0,right:10,top:30,bottom:12},tooltip:{formatter:k=>{const{date:w,successCount:y,errorCount:b}=i[k.dataIndex]||{date:k.data[0],successCount:0,errorCount:0};return[`<div>${t("common.time")}: ${w}</div>`,`<div>${t("common.succeeded")}: ${y}</div>`,`<div>${t("common.failed")}: ${b}</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:X[600]},{min:-9,max:-6,color:X[500]},{min:-6,max:-3,color:X[400]},{min:-3,max:-1,color:X[300]},{min:0,max:0,color:a.palette.grey[200]},{min:1,max:3,color:Z[300]},{min:3,max:6,color:Z[400]},{min:6,max:9,color:Z[500]},{min:9,max:Number.MAX_SAFE_INTEGER,color:Z[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(k=>[k.date,k.errorCount?-k.errorCount:k.successCount]),label:{show:!1},itemStyle:{borderWidth:2,borderColor:a.palette.background.default,borderRadius:4},emphasis:{itemStyle:{borderWidth:2,borderColor:st[200],color:"inherit"}}}}),[i,t,a]);return e.jsxs(e.Fragment,{children:[e.jsx(S,{ref:r,sx:{maxWidth:"1280px",border:"1px solid",borderColor:"divider",padding:"8px",overflowX:"auto"},children:e.jsx(S,{sx:{width:"1200px",height:"180px",position:"relative"},children:e.jsx(zt,{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(S,{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(S,{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(S,{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(S,{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 Xt=ee(({className:t,...o})=>e.jsx(Se,{...o,classes:{popper:t}}))(()=>({".MuiTooltip-tooltip":{backgroundColor:"transparent",padding:0,margin:0,boxShadow:"none",maxWidth:"none"},".MuiTooltip-arrow":{color:"rgba(230, 235, 245, 1)"}}));function Le({status:t,message:o="",createdAt:n}){const{t:s}=D(),r=t===T.BACKUPS.STATUS.PROGRESS&&E().diff(n,"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(L,{sx:{marginRight:"4px"},size:"12px"}),s("common.progress")]}):i?e.jsx(H,{type:"success",children:s("common.succeeded")}):e.jsxs(S,{sx:{display:"inline-flex",alignItems:"center"},children:[e.jsx(H,{type:"error",children:s("common.failed")}),e.jsx(Se,{style:{display:"flex",alignItems:"center",flexShrink:0},title:o||a,children:e.jsx(ye,{children:e.jsx(vt,{style:{width:"24px",height:"24px"},color:"error"})})})]})}Le.propTypes={status:f.string.isRequired,message:f.string,createdAt:f.string.isRequired};function Ue({metadata:t={}}){const{t:o}=D();if(q(t))return e.jsx(H,{type:"success",children:o("common.succeeded")});const n=t.count||0,s=t.size||0,r=At(s,{iec:!0}),a=e.jsxs(S,{sx:{p:1,borderRadius:1,boxShadow:2,color:"black",backgroundColor:"white"},children:[e.jsxs(j,{variant:"body2",children:[o("common.fileCount"),": ",n]}),e.jsxs(j,{variant:"body2",children:[o("common.fileSize"),": ",r]})]});return e.jsxs(S,{sx:{display:"inline-flex",alignItems:"center"},children:[e.jsx(H,{type:"success",children:o("common.succeeded")}),e.jsx(Xt,{title:a,style:{display:"flex",alignItems:"center",flexShrink:0},placement:"left",children:e.jsx(ye,{children:e.jsx(at,{style:{width:"24px",height:"24px"},color:"primary"})})})]})}Ue.propTypes={metadata:f.object};function Oe(){const{t,locale:o}=D(),{spaceGateways:n,backups:s,backupsLoading:r}=O(),a=h.useMemo(()=>[{label:"DID Space",name:"target",options:{customBodyRenderLite:i=>{const{targetUrl:d,targetName:l,status:p,createdAt:u}=s[i],x=p===T.BACKUPS.STATUS.PROGRESS&&E().diff(u,"hours")>=T.BACKUPS.TIMEOUT_HOURS,m=p===T.BACKUPS.STATUS.SUCCEEDED&&!x,k=l||n.find(w=>d?.includes(ge(w?.endpoint)))?.name||"Unknown DID Space";return m?e.jsx(nt,{href:d,target:"_blank",sx:{fontSize:"16px"},children:k}):e.jsx(j,{variant:"body1",sx:{fontSize:"16px"},children:k})}}},{label:t("common.strategy"),name:"strategy",options:{customBodyRender:i=>{const d=t(i===0?"common.auto":"common.manual");return e.jsx(H,{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=>q(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:p,createdAt:u,metadata:x}=d,m=l===T.BACKUPS.STATUS.PROGRESS&&E().diff(u,"hours")>=T.BACKUPS.TIMEOUT_HOURS,k=l===T.BACKUPS.STATUS.PROGRESS&&!m,w=l===T.BACKUPS.STATUS.SUCCEEDED&&!m;return k?e.jsxs(j,{sx:{display:"inline-flex",alignItems:"center",fontSize:"14px"},children:[e.jsx(L,{sx:{marginRight:"4px"},size:"12px"}),t("common.progress")]}):w?e.jsx(Ue,{metadata:x}):e.jsx(Le,{status:l,message:p,createdAt:u})}}}],[s,n,t]),c=h.useMemo(()=>!s?.length,[s]);return e.jsx(e.Fragment,{children:c?e.jsx(S,{sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"100px",color:"#9397A1",marginTop:"16px",marginBottom:"24px"},children:t("storage.spaces.record.emptyData")}):e.jsx(Pt,{title:"",loading:r,data:s,columns:a,emptyNode:t("storage.spaces.record.emptyData",o),options:{download:!1,filter:!1,print:!1,search:!1,viewColumns:!1}})})}function Zt(){const{t}=D();return e.jsxs(S,{children:[e.jsxs(S,{sx:{display:"flex",gap:3,flexDirection:{xs:"column",md:"row"}},children:[e.jsxs(S,{sx:{display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",alignContent:"center",minWidth:240},children:[e.jsx(gt,{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(ve,{})]}),e.jsxs(S,{sx:{flexGrow:1,minWidth:0},children:[e.jsx(S,{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(Ae,{})]})]}),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 Me({spaceGateway:t,onConfirm:o=()=>{},onCancel:n=()=>{}}){const{t:s}=D(),[r,a]=h.useState(!1),[c,i]=h.useState(!1),d=(u,x)=>{u?.preventDefault(),u?.stopPropagation(),a(x)},l=async u=>{try{u?.stopPropagation(),i(!0),await o?.(t),a(!1)}catch(x){console.error(x),B.error(`${s("storage.space.gateway.delete.failed")}: ${V(x)}`)}finally{a(!1),i(!1)}},p=u=>{d(u,!1),n?.(u)};return e.jsxs(e.Fragment,{children:[e.jsxs(G,{color:"red",onClick:u=>d(u,!0),children:[e.jsx(Y,{style:{minWidth:24,color:"red"},children:e.jsx(Ut,{fontSize:"small"})}),e.jsx($,{style:{color:"red"},children:s("common.disconnect")})]}),e.jsx(rt,{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:p,children:e.jsx(j,{sx:{wordWrap:"break-word"},children:s("storage.spaces.gateway.delete.descForBackup",{name:`${t?.name}`})})})]})}Me.propTypes={spaceGateway:f.shape({name:f.string.isRequired,url:f.string.isRequired,protected:f.bool}).isRequired,onConfirm:f.func,onCancel:f.func};function Ne({spaceGateway:t,selected:o,onDelete:n=()=>{},onConnect:s=()=>{},enableSwitchToSpace:r=!0,backupInProgress:a=!1,...c}){const{abortBlockletBackup:i}=O(),[d,l]=h.useState(null),{t:p}=D(),[u,x]=h.useState(!1),m=(y,b)=>{y.stopPropagation(),y.preventDefault(),l(b&&y.currentTarget)},k=async y=>{try{x(!0),m(y,!1),await s(t)}catch(b){console.error(b),B.error(b.message)}finally{x(!1)}},w=async y=>{try{x(!0),m(y,!1),await i()}catch(b){console.error(b),B.error(b.message)}finally{x(!1)}};return e.jsxs(e.Fragment,{children:[u||t?.loading?e.jsx(L,{sx:{ml:1},size:"24px"}):e.jsx(it,{"aria-label":"more","aria-controls":"actions-menu","aria-haspopup":"true","data-cy":"trigger-blocklet-actions",variant:"outlined",size:"small",onClick:y=>m(y,!0),...c,children:e.jsx(ct,{})}),e.jsxs(lt,{id:"simple-menu",anchorEl:d,keepMounted:!0,open:!!d,onClose:y=>m(y,!1),children:[e.jsxs(G,{onClick:y=>{m(y,!1),window.open(ke(t.endpoint?Et(t.endpoint):t.url,{allowDomains:null}))},children:[e.jsx(Y,{style:{minWidth:24},children:e.jsx(Wt,{fontSize:"small"})}),e.jsx($,{children:p("common.open")})]}),e.jsxs(G,{onClick:y=>{m(y,!1),window.open(ke(It(t.endpoint),{allowDomains:null}))},children:[e.jsx(Y,{style:{minWidth:24},children:e.jsx(Ft,{fontSize:"small"})}),e.jsx($,{children:p("storage.spaces.strategy.viewBackupFiles")})]}),!o&&r&&e.jsxs(G,{onClick:k,children:[e.jsx(Y,{style:{minWidth:24},children:e.jsx(Kt,{fontSize:"small"})}),e.jsx($,{children:p("storage.spaces.connect.switchToSpace")})]}),a&&e.jsxs(G,{onClick:w,children:[e.jsx(Y,{style:{minWidth:24},children:e.jsx(Lt,{fontSize:"small"})}),e.jsx($,{children:p("storage.spaces.connect.abortBlockletBackup")})]}),!a&&e.jsx(Me,{spaceGateway:t,onConfirm:async()=>{l(null),await n?.(t)},onCancel:()=>l(null)})]})]})}Ne.propTypes={spaceGateway:f.shape({name:f.string.isRequired,url:f.string.isRequired,protected:f.bool,endpoint:f.string.isRequired,loading:f.bool}).isRequired,selected:f.bool.isRequired,enableSwitchToSpace:f.bool,onDelete:f.func,onConnect:f.func,backupInProgress:f.bool};const Jt=ee(({className:t,...o})=>e.jsx(Se,{...o,classes:{popper:t}}))(()=>({".MuiTooltip-tooltip":{backgroundColor:"transparent",padding:0,margin:0,boxShadow:"none",maxWidth:"none"},".MuiTooltip-arrow":{color:"rgba(230, 235, 245, 1)"}}));function _e({spaceGateway:t,spaceStatus:o,selected:n,onConnected:s=()=>{},onDeleted:r=()=>{},onBackedUp:a=()=>{}}){const{t:c,locale:i}=D(),{blocklet:d}=U(),{api:l,info:{did:p}}=A(),{appDid:u,appName:x,appDescription:m,scopes:k,appUrl:w,referrer:y}=Ie({blocklet:d}),{backupProgress:b,updateSpaceGateway:te,deleteSpaceGateway:oe,refreshBackupSummary:se,refreshBackups:ne}=O(),[_,M]=h.useState(!1),[I,z]=h.useState({open:!1,action:"one-click-authorization",checkTimeout:1e3*300,messages:{title:c("storage.spaces.authorize.title",{appName:x},i),scan:c("storage.spaces.authorize.scan",{appName:x},i),confirm:"",success:e.jsx(j,{gutterBottom:!0,children:c("storage.spaces.authorize.success")})},onClose:()=>{z(C=>({...C,open:!1}))}}),ae=n&&!_&&o===ue.DISCONNECTED,re=n&&!_&&!t.loading&&o===ue.CONNECTED,F=n&&_&&o===ue.CONNECTED&&b?.progress>=0,Q=async()=>{try{if(await Tt(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}z(C=>({...C,open:!0,prefix:fe(t.url,"space/api/did"),baseUrl:new URL(t.url).origin,checkFn:De.create({baseURL:fe(t.url,"space")}).get,extraParams:{appDid:u,appName:x,appDescription:m,scopes:k,appUrl:w,referrer:y,nodeDid:p,spaceDid:t.did}}))},ie=async(C,g)=>{const P=g(C.endpoint),R=ge(P),v=C.space?g(C.space):{};if(t.did&&R!==t.did){z(We=>({...We,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 de={...t,name:v.name??"DID Space",did:v.did??ge(P),endpoint:P};await te(de),z(W=>({...W,open:!1})),s?.(null,de)},ce=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)}},le=async()=>{try{await oe(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 h.useEffect(()=>{b?.completed?(n&&(b?.progress===100?(B.success(c("storage.spaces.backupSuccessfully")),a?.(null,t)):b.message&&a?.(new Error(b?.message),t),b.progress=0,b.message=""),M(!1),se(),ne()):b.progress&&M(!0)},[b]),e.jsxs(e.Fragment,{children:[e.jsxs(S,{sx:{display:"flex",alignItems:"center",".action-btn":{borderRadius:1,marginLeft:1}},children:[re&&e.jsx(pe,{className:"action-btn",variant:"outlined",size:"small",onClick:ce,children:c("storage.spaces.strategy.backupNow")}),ae&&e.jsx(pe,{className:"action-btn",variant:"outlined",size:"small",onClick:Q,children:c("storage.spaces.disconnected.reconnectNow")}),F&&e.jsx(Jt,{title:b?.message&&e.jsx(S,{sx:{p:1,borderRadius:1,boxShadow:2,color:"black",backgroundColor:"white"},children:e.jsx(j,{variant:"body2",children:b.message})}),children:e.jsxs(pe,{className:"action-btn",variant:"outlined",size:"small",sx:{minWidth:70},children:[e.jsx(L,{variant:"determinate",value:b?.progress,size:14,sx:{mr:1}}),b?.progress,"%"]})}),e.jsx(dt,{forceConnected:!1,saveConnect:!1,prefix:I.prefix,open:I.open,popup:!0,action:I.action,baseUrl:I.baseUrl,checkFn:I.checkFn,onSuccess:ie,onClose:I.onClose,checkTimeout:I.checkTimeout,extraParams:I.extraParams,messages:I.messages,locale:i},"get-endpoint")]}),e.jsx(Ne,{sx:{minWidth:32,padding:"2px 4px",ml:1},spaceGateway:t,selected:n,onDelete:le,onConnect:Q,enableSwitchToSpace:b?.completed||q(b?.message),backupInProgress:F})]})}_e.propTypes={spaceGateway:f.shape({did:f.string.isRequired,name:f.string.isRequired,url:f.string.isRequired,endpoint:f.string.isRequired,protected:f.bool,loading:f.bool}).isRequired,spaceStatus:f.string.isRequired,selected:f.bool.isRequired,onConnected:f.func,onDeleted:f.func,onBackedUp:f.func};function eo({...t}){const{t:o}=D();return e.jsxs(S,{...t,children:[e.jsx(S,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:3},children:e.jsx(j,{sx:{fontSize:"1.2rem",fontWeight:"bold"},children:o("storage.spaces.backup.records")})}),e.jsx(Ae,{}),e.jsx(Oe,{})]})}function to({...t}){const{t:o}=D(),{autoBackup:n,updateAutoBackup:s}=O(),r=async()=>{try{const a=!n?.enabled;await s({enabled:a}),B.success(o(a?"storage.spaces.autoBackup.enabled":"storage.spaces.autoBackup.disabled"))}catch(a){B.error(a.message)}};return e.jsx(Ot,{checked:!!n?.enabled,onChange:r,name:"enableWelcomePage",labelProps:{label:e.jsx(j,{sx:{marginRight:"8px"},children:e.jsx("span",{children:o("storage.spaces.autoBackup.title")})})},style:{...t.style}})}function oo(){const{t}=D(),{spaceGateways:o,spaceGatewaysLoading:n,spaceGatewayIsSelected:s}=O(),r=n&&!o?.length,a=({spaceGateway:c,spaceStatus:i,selected:d,refresh:l})=>e.jsx(_e,{spaceGateway:c,spaceStatus:i,selected:d,onConnected:()=>l(),onBackedUp:p=>p&&l()});return e.jsxs(S,{sx:{display:"flex",flexDirection:"column"},children:[e.jsxs(S,{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(to,{}),e.jsx(ve,{})]}),e.jsx(S,{sx:{mt:2},children:r?e.jsx(S,{sx:{display:"flex",justifyContent:"center"},children:e.jsx(L,{})}):e.jsx(be,{container:!0,spacing:2,children:e.jsx(e.Fragment,{children:o.map(c=>e.jsx(be,{size:{xs:12,md:6},children:e.jsx(ht,{endpoint:c.endpoint,selected:s(c),action:a},c.endpoint)},c.endpoint))})})}),e.jsx(eo,{sx:{marginTop:"24px"}}),e.jsx(j,{sx:{fontSize:"1.2rem",fontWeight:"bold",mb:2},children:t("common.dataStorage")}),e.jsx(Pe,{})]})}function so(){const{spaceGatewaysFirstLoading:t,spaceGateways:o}=O();return t?e.jsx(Ee,{relative:"parent",children:e.jsx(L,{})}):q(o)?e.jsx(Zt,{}):e.jsx(oo,{})}function no(){return e.jsx(ze,{children:e.jsx(so,{})})}function ao(){const{spaceGateway:t,settingStorageEndpoint:o,updateSpaceGateway:n,hasStorageEndpoint:s,loading:r,storageEndpoint:a}=yt(),c=xe(()=>({display:"flex",alignItems:"center",justifyContent:"center",paddingTop:"16px"}));return r?e.jsx(Ee,{relative:"parent",children:e.jsx(L,{})}):e.jsxs(S,{sx:{maxWidth:"md",position:"relative"},children:[s?e.jsx(bt,{spaceGateway:t,settingStorageEndpoint:o}):e.jsx(kt,{}),e.jsx(S,{sx:c,children:e.jsx(jt,{onConnect:n,storageEndpoint:a})})]})}function ro(){const{t}=D();return e.jsxs(St,{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(ao,{})]})}function io({navOrientation:t="vertical",...o}){const{t:n,locale:s}=D(),{blocklet:r}=U(),a=mt({key:"md"}),[c,i]=pt(),d=c.get("tab")||"backup",l=a?"horizontal":t,p=xe(()=>{const w=[{label:n("common.backup"),value:"backup"}],y=r?.capabilities?.didSpace;return(y===N.BLOCKLET_APP_SPACE_REQUIREMENT.REQUIRED||y===N.BLOCKLET_APP_SPACE_REQUIREMENT.REQUIRED_ON_SETUP)&&w.push({label:n("common.storage"),value:"storage"}),w},[s,l]),x=xe(()=>({backup:e.jsx(no,{}),storage:e.jsx(ro,{})}))[d],m=w=>{i(y=>(w==="backup"?y.delete("tab"):y.set("tab",w),y))};if(p.length<=1)return e.jsx(me,{children:x});const k=e.jsx(ut,{tabs:p,current:d,orientation:l,onChange:m,sx:[{borderRight:1,height:"100%",borderColor:"divider"},l==="horizontal"&&{borderRight:0}]});if(l==="vertical")return e.jsx(S,{...o,children:e.jsxs(K,{direction:{md:"column",lg:"row"},sx:{gap:2},children:[e.jsx(S,{sx:{flexShrink:0},children:e.jsx(je,{left:k})}),e.jsx(S,{sx:{flexGrow:1,minWidth:0},children:e.jsx(me,{sx:{mt:1},children:x})})]})});if(l==="horizontal")return e.jsxs(S,{...o,children:[e.jsx(je,{left:k}),e.jsx(me,{sx:{mt:2},children:x})]})}io.propTypes={navOrientation:f.oneOf(["vertical","horizontal"])};const me=ee(S)`
3
3
  position: relative;
4
4
  min-height: 66vh;
@@ -1 +1 @@
1
- import{eH as D}from"./index-DY4IRZzA.js";function f(e){return e===null?"null":Array.isArray(e)?"array":typeof e}function $(e){return f(e)==="object"}function re(e){return Array.isArray(e)&&e.length>0&&e.every(m=>"message"in m)}function Y(e,m){return e.length<124?e:m}const ne="graphql-transport-ws";var g;(function(e){e[e.InternalServerError=4500]="InternalServerError",e[e.InternalClientError=4005]="InternalClientError",e[e.BadRequest=4400]="BadRequest",e[e.BadResponse=4004]="BadResponse",e[e.Unauthorized=4401]="Unauthorized",e[e.Forbidden=4403]="Forbidden",e[e.SubprotocolNotAcceptable=4406]="SubprotocolNotAcceptable",e[e.ConnectionInitialisationTimeout=4408]="ConnectionInitialisationTimeout",e[e.ConnectionAcknowledgementTimeout=4504]="ConnectionAcknowledgementTimeout",e[e.SubscriberAlreadyExists=4409]="SubscriberAlreadyExists",e[e.TooManyInitialisationRequests=4429]="TooManyInitialisationRequests"})(g||(g={}));var c;(function(e){e.ConnectionInit="connection_init",e.ConnectionAck="connection_ack",e.Ping="ping",e.Pong="pong",e.Subscribe="subscribe",e.Next="next",e.Error="error",e.Complete="complete"})(c||(c={}));function v(e){if(!$(e))throw new Error(`Message is expected to be an object, but got ${f(e)}`);if(!e.type)throw new Error("Message is missing the 'type' property");if(typeof e.type!="string")throw new Error(`Message is expects the 'type' property to be a string, but got ${f(e.type)}`);switch(e.type){case c.ConnectionInit:case c.ConnectionAck:case c.Ping:case c.Pong:{if(e.payload!=null&&!$(e.payload))throw new Error(`"${e.type}" message expects the 'payload' property to be an object or nullish or missing, but got "${e.payload}"`);break}case c.Subscribe:{if(typeof e.id!="string")throw new Error(`"${e.type}" message expects the 'id' property to be a string, but got ${f(e.id)}`);if(!e.id)throw new Error(`"${e.type}" message requires a non-empty 'id' property`);if(!$(e.payload))throw new Error(`"${e.type}" message expects the 'payload' property to be an object, but got ${f(e.payload)}`);if(typeof e.payload.query!="string")throw new Error(`"${e.type}" message payload expects the 'query' property to be a string, but got ${f(e.payload.query)}`);if(e.payload.variables!=null&&!$(e.payload.variables))throw new Error(`"${e.type}" message payload expects the 'variables' property to be a an object or nullish or missing, but got ${f(e.payload.variables)}`);if(e.payload.operationName!=null&&f(e.payload.operationName)!=="string")throw new Error(`"${e.type}" message payload expects the 'operationName' property to be a string or nullish or missing, but got ${f(e.payload.operationName)}`);if(e.payload.extensions!=null&&!$(e.payload.extensions))throw new Error(`"${e.type}" message payload expects the 'extensions' property to be a an object or nullish or missing, but got ${f(e.payload.extensions)}`);break}case c.Next:{if(typeof e.id!="string")throw new Error(`"${e.type}" message expects the 'id' property to be a string, but got ${f(e.id)}`);if(!e.id)throw new Error(`"${e.type}" message requires a non-empty 'id' property`);if(!$(e.payload))throw new Error(`"${e.type}" message expects the 'payload' property to be an object, but got ${f(e.payload)}`);break}case c.Error:{if(typeof e.id!="string")throw new Error(`"${e.type}" message expects the 'id' property to be a string, but got ${f(e.id)}`);if(!e.id)throw new Error(`"${e.type}" message requires a non-empty 'id' property`);if(!re(e.payload))throw new Error(`"${e.type}" message expects the 'payload' property to be an array of GraphQL errors, but got ${JSON.stringify(e.payload)}`);break}case c.Complete:{if(typeof e.id!="string")throw new Error(`"${e.type}" message expects the 'id' property to be a string, but got ${f(e.id)}`);if(!e.id)throw new Error(`"${e.type}" message requires a non-empty 'id' property`);break}default:throw new Error(`Invalid message 'type' property "${e.type}"`)}return e}function oe(e,m){return v(typeof e=="string"?JSON.parse(e,m):e)}function W(e,m){return v(e),JSON.stringify(e,m)}var A=function(e){return this instanceof A?(this.v=e,this):new A(e)},ie=function(e,m,R){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var M=R.apply(e,m||[]),b,w=[];return b={},E("next"),E("throw"),E("return"),b[Symbol.asyncIterator]=function(){return this},b;function E(u){M[u]&&(b[u]=function(r){return new Promise(function(S,L){w.push([u,r,S,L])>1||I(u,r)})})}function I(u,r){try{q(M[u](r))}catch(S){j(w[0][3],S)}}function q(u){u.value instanceof A?Promise.resolve(u.value.v).then(z,G):j(w[0][2],u)}function z(u){I("next",u)}function G(u){I("throw",u)}function j(u,r){u(r),w.shift(),w.length&&I(w[0][0],w[0][1])}};function pe(e){const{url:m,connectionParams:R,lazy:M=!0,onNonLazyError:b=console.error,lazyCloseTimeout:w=0,keepAlive:E=0,disablePong:I,connectionAckWaitTimeout:q=0,retryAttempts:z=5,retryWait:G=async function(a){let t=1e3;for(let o=0;o<a;o++)t*=2;await new Promise(o=>setTimeout(o,t+Math.floor(Math.random()*2700+300)))},shouldRetry:j=J,isFatalConnectionProblem:u,on:r,webSocketImpl:S,generateID:L=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,a=>{const t=Math.random()*16|0;return(a=="x"?t:t&3|8).toString(16)})},jsonMessageReplacer:U,jsonMessageReviver:ee}=e;let T;if(S){if(!ae(S))throw new Error("Invalid WebSocket implementation provided");T=S}else typeof WebSocket<"u"?T=WebSocket:typeof D<"u"?T=D.WebSocket||D.MozWebSocket:typeof window<"u"&&(T=window.WebSocket||window.MozWebSocket);if(!T)throw new Error("WebSocket implementation missing; on Node you can `import WebSocket from 'ws';` and pass `webSocketImpl: WebSocket` to `createClient`");const N=T,d=(()=>{const n=(()=>{const t={};return{on(o,s){return t[o]=s,()=>{delete t[o]}},emit(o){var s;"id"in o&&((s=t[o.id])===null||s===void 0||s.call(t,o))}}})(),a={connecting:r?.connecting?[r.connecting]:[],opened:r?.opened?[r.opened]:[],connected:r?.connected?[r.connected]:[],ping:r?.ping?[r.ping]:[],pong:r?.pong?[r.pong]:[],message:r?.message?[n.emit,r.message]:[n.emit],closed:r?.closed?[r.closed]:[],error:r?.error?[r.error]:[]};return{onMessage:n.on,on(t,o){const s=a[t];return s.push(o),()=>{s.splice(s.indexOf(o),1)}},emit(t,...o){for(const s of[...a[t]])s(...o)}}})();function Q(n){const a=[d.on("error",t=>{a.forEach(o=>o()),n(t)}),d.on("closed",t=>{a.forEach(o=>o()),n(t)})]}let h,k=0,H,O=!1,B=0,C=!1;async function K(){clearTimeout(H);const[n,a]=await(h??(h=new Promise((s,y)=>(async()=>{if(O){if(await G(B),!k)return h=void 0,y({code:1e3,reason:"All Subscriptions Gone"});B++}d.emit("connecting",O);const i=new N(typeof m=="function"?await m():m,ne);let x,_;function F(){isFinite(E)&&E>0&&(clearTimeout(_),_=setTimeout(()=>{i.readyState===N.OPEN&&(i.send(W({type:c.Ping})),d.emit("ping",!1,void 0))},E))}Q(l=>{h=void 0,clearTimeout(x),clearTimeout(_),y(l),l instanceof Z&&(i.close(4499,"Terminated"),i.onerror=null,i.onclose=null)}),i.onerror=l=>d.emit("error",l),i.onclose=l=>d.emit("closed",l),i.onopen=async()=>{try{d.emit("opened",i);const l=typeof R=="function"?await R():R;if(i.readyState!==N.OPEN)return;i.send(W(l?{type:c.ConnectionInit,payload:l}:{type:c.ConnectionInit},U)),isFinite(q)&&q>0&&(x=setTimeout(()=>{i.close(g.ConnectionAcknowledgementTimeout,"Connection acknowledgement timeout")},q)),F()}catch(l){d.emit("error",l),i.close(g.InternalClientError,Y(l instanceof Error?l.message:new Error(l).message,"Internal client error"))}};let P=!1;i.onmessage=({data:l})=>{try{const p=oe(l,ee);if(d.emit("message",p),p.type==="ping"||p.type==="pong"){d.emit(p.type,!0,p.payload),p.type==="pong"?F():I||(i.send(W(p.payload?{type:c.Pong,payload:p.payload}:{type:c.Pong})),d.emit("pong",!1,p.payload));return}if(P)return;if(p.type!==c.ConnectionAck)throw new Error(`First message cannot be of type ${p.type}`);clearTimeout(x),P=!0,d.emit("connected",i,p.payload,O),O=!1,B=0,s([i,new Promise((ce,te)=>Q(te))])}catch(p){i.onmessage=null,d.emit("error",p),i.close(g.BadResponse,Y(p instanceof Error?p.message:new Error(p).message,"Bad response"))}}})())));n.readyState===N.CLOSING&&await a;let t=()=>{};const o=new Promise(s=>t=s);return[n,t,Promise.race([o.then(()=>{if(!k){const s=()=>n.close(1e3,"Normal Closure");isFinite(w)&&w>0?H=setTimeout(()=>{n.readyState===N.OPEN&&s()},w):s()}}),a])]}function V(n){if(J(n)&&(se(n.code)||[g.InternalServerError,g.InternalClientError,g.BadRequest,g.BadResponse,g.Unauthorized,g.SubprotocolNotAcceptable,g.SubscriberAlreadyExists,g.TooManyInitialisationRequests].includes(n.code)))throw n;if(C)return!1;if(J(n)&&n.code===1e3)return k>0;if(!z||B>=z||!j(n)||u?.(n))throw n;return O=!0}M||(async()=>{for(k++;;)try{const[,,n]=await K();await n}catch(n){try{if(!V(n))return}catch(a){return b?.(a)}}})();function X(n,a){const t=L(n);let o=!1,s=!1,y=()=>{k--,o=!0};return(async()=>{for(k++;;)try{const[i,x,_]=await K();if(o)return x();const F=d.onMessage(t,P=>{switch(P.type){case c.Next:{a.next(P.payload);return}case c.Error:{s=!0,o=!0,a.error(P.payload),y();return}case c.Complete:{o=!0,y();return}}});i.send(W({id:t,type:c.Subscribe,payload:n},U)),y=()=>{!o&&i.readyState===N.OPEN&&i.send(W({id:t,type:c.Complete},U)),k--,o=!0,x()},await _.finally(F);return}catch(i){if(!V(i))return}})().then(()=>{s||a.complete()}).catch(i=>{a.error(i)}),()=>{o||y()}}return{on:d.on,subscribe:X,iterate(n){const a=[],t={done:!1,error:null,resolve:()=>{}},o=X(n,{next(y){a.push(y),t.resolve()},error(y){t.done=!0,t.error=y,t.resolve()},complete(){t.done=!0,t.resolve()}}),s=function(){return ie(this,arguments,function*(){for(;;){for(a.length||(yield A(new Promise(x=>t.resolve=x)));a.length;)yield yield A(a.shift());if(t.error)throw t.error;if(t.done)return yield A(void 0)}})}();return s.throw=async y=>(t.done||(t.done=!0,t.error=y,t.resolve()),{done:!0,value:void 0}),s.return=async()=>(o(),{done:!0,value:void 0}),s},async dispose(){if(C=!0,h){const[n]=await h;n.close(1e3,"Normal Closure")}},terminate(){h&&d.emit("closed",new Z)}}}class Z extends Error{constructor(){super(...arguments),this.name="TerminatedCloseEvent",this.message="4499: Terminated",this.code=4499,this.reason="Terminated",this.wasClean=!1}}function J(e){return $(e)&&"code"in e&&"reason"in e}function se(e){return[1e3,1001,1006,1005,1012,1013,1014].includes(e)?!1:e>=1e3&&e<=1999}function ae(e){return typeof e=="function"&&"constructor"in e&&"CLOSED"in e&&"CLOSING"in e&&"CONNECTING"in e&&"OPEN"in e}export{g as CloseCode,ne as GRAPHQL_TRANSPORT_WS_PROTOCOL,c as MessageType,Z as TerminatedCloseEvent,pe as createClient,oe as parseMessage,W as stringifyMessage,v as validateMessage};
1
+ import{eH as D}from"./index-BZORkGy0.js";function f(e){return e===null?"null":Array.isArray(e)?"array":typeof e}function $(e){return f(e)==="object"}function re(e){return Array.isArray(e)&&e.length>0&&e.every(m=>"message"in m)}function Y(e,m){return e.length<124?e:m}const ne="graphql-transport-ws";var g;(function(e){e[e.InternalServerError=4500]="InternalServerError",e[e.InternalClientError=4005]="InternalClientError",e[e.BadRequest=4400]="BadRequest",e[e.BadResponse=4004]="BadResponse",e[e.Unauthorized=4401]="Unauthorized",e[e.Forbidden=4403]="Forbidden",e[e.SubprotocolNotAcceptable=4406]="SubprotocolNotAcceptable",e[e.ConnectionInitialisationTimeout=4408]="ConnectionInitialisationTimeout",e[e.ConnectionAcknowledgementTimeout=4504]="ConnectionAcknowledgementTimeout",e[e.SubscriberAlreadyExists=4409]="SubscriberAlreadyExists",e[e.TooManyInitialisationRequests=4429]="TooManyInitialisationRequests"})(g||(g={}));var c;(function(e){e.ConnectionInit="connection_init",e.ConnectionAck="connection_ack",e.Ping="ping",e.Pong="pong",e.Subscribe="subscribe",e.Next="next",e.Error="error",e.Complete="complete"})(c||(c={}));function v(e){if(!$(e))throw new Error(`Message is expected to be an object, but got ${f(e)}`);if(!e.type)throw new Error("Message is missing the 'type' property");if(typeof e.type!="string")throw new Error(`Message is expects the 'type' property to be a string, but got ${f(e.type)}`);switch(e.type){case c.ConnectionInit:case c.ConnectionAck:case c.Ping:case c.Pong:{if(e.payload!=null&&!$(e.payload))throw new Error(`"${e.type}" message expects the 'payload' property to be an object or nullish or missing, but got "${e.payload}"`);break}case c.Subscribe:{if(typeof e.id!="string")throw new Error(`"${e.type}" message expects the 'id' property to be a string, but got ${f(e.id)}`);if(!e.id)throw new Error(`"${e.type}" message requires a non-empty 'id' property`);if(!$(e.payload))throw new Error(`"${e.type}" message expects the 'payload' property to be an object, but got ${f(e.payload)}`);if(typeof e.payload.query!="string")throw new Error(`"${e.type}" message payload expects the 'query' property to be a string, but got ${f(e.payload.query)}`);if(e.payload.variables!=null&&!$(e.payload.variables))throw new Error(`"${e.type}" message payload expects the 'variables' property to be a an object or nullish or missing, but got ${f(e.payload.variables)}`);if(e.payload.operationName!=null&&f(e.payload.operationName)!=="string")throw new Error(`"${e.type}" message payload expects the 'operationName' property to be a string or nullish or missing, but got ${f(e.payload.operationName)}`);if(e.payload.extensions!=null&&!$(e.payload.extensions))throw new Error(`"${e.type}" message payload expects the 'extensions' property to be a an object or nullish or missing, but got ${f(e.payload.extensions)}`);break}case c.Next:{if(typeof e.id!="string")throw new Error(`"${e.type}" message expects the 'id' property to be a string, but got ${f(e.id)}`);if(!e.id)throw new Error(`"${e.type}" message requires a non-empty 'id' property`);if(!$(e.payload))throw new Error(`"${e.type}" message expects the 'payload' property to be an object, but got ${f(e.payload)}`);break}case c.Error:{if(typeof e.id!="string")throw new Error(`"${e.type}" message expects the 'id' property to be a string, but got ${f(e.id)}`);if(!e.id)throw new Error(`"${e.type}" message requires a non-empty 'id' property`);if(!re(e.payload))throw new Error(`"${e.type}" message expects the 'payload' property to be an array of GraphQL errors, but got ${JSON.stringify(e.payload)}`);break}case c.Complete:{if(typeof e.id!="string")throw new Error(`"${e.type}" message expects the 'id' property to be a string, but got ${f(e.id)}`);if(!e.id)throw new Error(`"${e.type}" message requires a non-empty 'id' property`);break}default:throw new Error(`Invalid message 'type' property "${e.type}"`)}return e}function oe(e,m){return v(typeof e=="string"?JSON.parse(e,m):e)}function W(e,m){return v(e),JSON.stringify(e,m)}var A=function(e){return this instanceof A?(this.v=e,this):new A(e)},ie=function(e,m,R){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var M=R.apply(e,m||[]),b,w=[];return b={},E("next"),E("throw"),E("return"),b[Symbol.asyncIterator]=function(){return this},b;function E(u){M[u]&&(b[u]=function(r){return new Promise(function(S,L){w.push([u,r,S,L])>1||I(u,r)})})}function I(u,r){try{q(M[u](r))}catch(S){j(w[0][3],S)}}function q(u){u.value instanceof A?Promise.resolve(u.value.v).then(z,G):j(w[0][2],u)}function z(u){I("next",u)}function G(u){I("throw",u)}function j(u,r){u(r),w.shift(),w.length&&I(w[0][0],w[0][1])}};function pe(e){const{url:m,connectionParams:R,lazy:M=!0,onNonLazyError:b=console.error,lazyCloseTimeout:w=0,keepAlive:E=0,disablePong:I,connectionAckWaitTimeout:q=0,retryAttempts:z=5,retryWait:G=async function(a){let t=1e3;for(let o=0;o<a;o++)t*=2;await new Promise(o=>setTimeout(o,t+Math.floor(Math.random()*2700+300)))},shouldRetry:j=J,isFatalConnectionProblem:u,on:r,webSocketImpl:S,generateID:L=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,a=>{const t=Math.random()*16|0;return(a=="x"?t:t&3|8).toString(16)})},jsonMessageReplacer:U,jsonMessageReviver:ee}=e;let T;if(S){if(!ae(S))throw new Error("Invalid WebSocket implementation provided");T=S}else typeof WebSocket<"u"?T=WebSocket:typeof D<"u"?T=D.WebSocket||D.MozWebSocket:typeof window<"u"&&(T=window.WebSocket||window.MozWebSocket);if(!T)throw new Error("WebSocket implementation missing; on Node you can `import WebSocket from 'ws';` and pass `webSocketImpl: WebSocket` to `createClient`");const N=T,d=(()=>{const n=(()=>{const t={};return{on(o,s){return t[o]=s,()=>{delete t[o]}},emit(o){var s;"id"in o&&((s=t[o.id])===null||s===void 0||s.call(t,o))}}})(),a={connecting:r?.connecting?[r.connecting]:[],opened:r?.opened?[r.opened]:[],connected:r?.connected?[r.connected]:[],ping:r?.ping?[r.ping]:[],pong:r?.pong?[r.pong]:[],message:r?.message?[n.emit,r.message]:[n.emit],closed:r?.closed?[r.closed]:[],error:r?.error?[r.error]:[]};return{onMessage:n.on,on(t,o){const s=a[t];return s.push(o),()=>{s.splice(s.indexOf(o),1)}},emit(t,...o){for(const s of[...a[t]])s(...o)}}})();function Q(n){const a=[d.on("error",t=>{a.forEach(o=>o()),n(t)}),d.on("closed",t=>{a.forEach(o=>o()),n(t)})]}let h,k=0,H,O=!1,B=0,C=!1;async function K(){clearTimeout(H);const[n,a]=await(h??(h=new Promise((s,y)=>(async()=>{if(O){if(await G(B),!k)return h=void 0,y({code:1e3,reason:"All Subscriptions Gone"});B++}d.emit("connecting",O);const i=new N(typeof m=="function"?await m():m,ne);let x,_;function F(){isFinite(E)&&E>0&&(clearTimeout(_),_=setTimeout(()=>{i.readyState===N.OPEN&&(i.send(W({type:c.Ping})),d.emit("ping",!1,void 0))},E))}Q(l=>{h=void 0,clearTimeout(x),clearTimeout(_),y(l),l instanceof Z&&(i.close(4499,"Terminated"),i.onerror=null,i.onclose=null)}),i.onerror=l=>d.emit("error",l),i.onclose=l=>d.emit("closed",l),i.onopen=async()=>{try{d.emit("opened",i);const l=typeof R=="function"?await R():R;if(i.readyState!==N.OPEN)return;i.send(W(l?{type:c.ConnectionInit,payload:l}:{type:c.ConnectionInit},U)),isFinite(q)&&q>0&&(x=setTimeout(()=>{i.close(g.ConnectionAcknowledgementTimeout,"Connection acknowledgement timeout")},q)),F()}catch(l){d.emit("error",l),i.close(g.InternalClientError,Y(l instanceof Error?l.message:new Error(l).message,"Internal client error"))}};let P=!1;i.onmessage=({data:l})=>{try{const p=oe(l,ee);if(d.emit("message",p),p.type==="ping"||p.type==="pong"){d.emit(p.type,!0,p.payload),p.type==="pong"?F():I||(i.send(W(p.payload?{type:c.Pong,payload:p.payload}:{type:c.Pong})),d.emit("pong",!1,p.payload));return}if(P)return;if(p.type!==c.ConnectionAck)throw new Error(`First message cannot be of type ${p.type}`);clearTimeout(x),P=!0,d.emit("connected",i,p.payload,O),O=!1,B=0,s([i,new Promise((ce,te)=>Q(te))])}catch(p){i.onmessage=null,d.emit("error",p),i.close(g.BadResponse,Y(p instanceof Error?p.message:new Error(p).message,"Bad response"))}}})())));n.readyState===N.CLOSING&&await a;let t=()=>{};const o=new Promise(s=>t=s);return[n,t,Promise.race([o.then(()=>{if(!k){const s=()=>n.close(1e3,"Normal Closure");isFinite(w)&&w>0?H=setTimeout(()=>{n.readyState===N.OPEN&&s()},w):s()}}),a])]}function V(n){if(J(n)&&(se(n.code)||[g.InternalServerError,g.InternalClientError,g.BadRequest,g.BadResponse,g.Unauthorized,g.SubprotocolNotAcceptable,g.SubscriberAlreadyExists,g.TooManyInitialisationRequests].includes(n.code)))throw n;if(C)return!1;if(J(n)&&n.code===1e3)return k>0;if(!z||B>=z||!j(n)||u?.(n))throw n;return O=!0}M||(async()=>{for(k++;;)try{const[,,n]=await K();await n}catch(n){try{if(!V(n))return}catch(a){return b?.(a)}}})();function X(n,a){const t=L(n);let o=!1,s=!1,y=()=>{k--,o=!0};return(async()=>{for(k++;;)try{const[i,x,_]=await K();if(o)return x();const F=d.onMessage(t,P=>{switch(P.type){case c.Next:{a.next(P.payload);return}case c.Error:{s=!0,o=!0,a.error(P.payload),y();return}case c.Complete:{o=!0,y();return}}});i.send(W({id:t,type:c.Subscribe,payload:n},U)),y=()=>{!o&&i.readyState===N.OPEN&&i.send(W({id:t,type:c.Complete},U)),k--,o=!0,x()},await _.finally(F);return}catch(i){if(!V(i))return}})().then(()=>{s||a.complete()}).catch(i=>{a.error(i)}),()=>{o||y()}}return{on:d.on,subscribe:X,iterate(n){const a=[],t={done:!1,error:null,resolve:()=>{}},o=X(n,{next(y){a.push(y),t.resolve()},error(y){t.done=!0,t.error=y,t.resolve()},complete(){t.done=!0,t.resolve()}}),s=function(){return ie(this,arguments,function*(){for(;;){for(a.length||(yield A(new Promise(x=>t.resolve=x)));a.length;)yield yield A(a.shift());if(t.error)throw t.error;if(t.done)return yield A(void 0)}})}();return s.throw=async y=>(t.done||(t.done=!0,t.error=y,t.resolve()),{done:!0,value:void 0}),s.return=async()=>(o(),{done:!0,value:void 0}),s},async dispose(){if(C=!0,h){const[n]=await h;n.close(1e3,"Normal Closure")}},terminate(){h&&d.emit("closed",new Z)}}}class Z extends Error{constructor(){super(...arguments),this.name="TerminatedCloseEvent",this.message="4499: Terminated",this.code=4499,this.reason="Terminated",this.wasClean=!1}}function J(e){return $(e)&&"code"in e&&"reason"in e}function se(e){return[1e3,1001,1006,1005,1012,1013,1014].includes(e)?!1:e>=1e3&&e<=1999}function ae(e){return typeof e=="function"&&"constructor"in e&&"CLOSED"in e&&"CLOSING"in e&&"CONNECTING"in e&&"OPEN"in e}export{g as CloseCode,ne as GRAPHQL_TRANSPORT_WS_PROTOCOL,c as MessageType,Z as TerminatedCloseEvent,pe as createClient,oe as parseMessage,W as stringifyMessage,v as validateMessage};