@abtnode/blocklet-services 1.17.5-beta-20251208-123021-e8c53f96 → 1.17.5-beta-20251209-090953-3a59e7ac

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 (125) hide show
  1. package/api/index.js +4 -3
  2. package/dist/assets/{access-control-uMgSmVtl.js → access-control-BQ-IG3_x.js} +1 -1
  3. package/dist/assets/{add-component-core-Dc36lTWq.js → add-component-core-Cb9Jf9pu.js} +1 -1
  4. package/dist/assets/{add-resource-CNyb02oE.js → add-resource-BmEJTiqi.js} +1 -1
  5. package/dist/assets/{addon-BrD52yP8.js → addon-CzieGOEG.js} +1 -1
  6. package/dist/assets/{advanced-BTz3ZBM_.js → advanced-B94516o4.js} +1 -1
  7. package/dist/assets/{aigne-CKJhF6YF.js → aigne-CYChXVP3.js} +1 -1
  8. package/dist/assets/{appearance-BJ1pZ5mv.js → appearance-C1uh29fy.js} +1 -1
  9. package/dist/assets/{arrow-down.svg-C_9IZZzE.js → arrow-down.svg-DCPm0wfX.js} +1 -1
  10. package/dist/assets/{audit-logs-Cv97rr17.js → audit-logs-Dcdyar51.js} +1 -1
  11. package/dist/assets/{authorize-B7P46IV2.js → authorize-QHj4ueFL.js} +1 -1
  12. package/dist/assets/{bind-account-jReeH6gL.js → bind-account-BX-KG0Qr.js} +1 -1
  13. package/dist/assets/{branding-DTiVyAwp.js → branding-Ce0jZMDd.js} +1 -1
  14. package/dist/assets/{branding-Dw7bAXb5.js → branding-CqhvExJP.js} +4 -4
  15. package/dist/assets/{branding-DDbf7iKd.js → branding-Dnj3tYIM.js} +1 -1
  16. package/dist/assets/{bundle-avatar-CKp8Upr1.js → bundle-avatar--xYBq9Gb.js} +1 -1
  17. package/dist/assets/{complete-I86fdk2J.js → complete-CF2ewVuD.js} +1 -1
  18. package/dist/assets/{component-BxDPcxLA.js → component-u6OazrP-.js} +3 -3
  19. package/dist/assets/{config-3y5DLQbx.js → config-BdGGivQg.js} +1 -1
  20. package/dist/assets/{config-CmTXD9uy.js → config-Cj_KRqwi.js} +1 -1
  21. package/dist/assets/{config-uqOLSuI1.js → config-DwBbQRLw.js} +1 -1
  22. package/dist/assets/{config-navigation-IlBVGJJp.js → config-navigation-2cI6Tcgp.js} +2 -2
  23. package/dist/assets/{config-space-CMOK4l4q.js → config-space-DI_Aw2fC.js} +1 -1
  24. package/dist/assets/{confirm-DQ4M1D6U.js → confirm-F2_i30bc.js} +1 -1
  25. package/dist/assets/{connect-N6Jlg0kg.js → connect-4HW3qKz4.js} +1 -1
  26. package/dist/assets/{connect-Bt_sH-vn.js → connect-BeA4k1eX.js} +1 -1
  27. package/dist/assets/{connect-to-CTgmFTT0.js → connect-to-BBcrmPHg.js} +1 -1
  28. package/dist/assets/dashboard-BDag6cuN.js +106 -0
  29. package/dist/assets/{delete-confirm-CkOWa6dE.js → delete-confirm-DBhiUq1r.js} +1 -1
  30. package/dist/assets/{domain-CNgcPSuz.js → domain-CM8EYUUH.js} +1 -1
  31. package/dist/assets/{domain-action-card-DglaZM09.js → domain-action-card-BdWmmq7M.js} +1 -1
  32. package/dist/assets/{domains-xkwgfn_I.js → domains-C_hsR6kY.js} +1 -1
  33. package/dist/assets/{email-B0VF90tU.js → email-CbHnzIjr.js} +1 -1
  34. package/dist/assets/engine-C3zb9k-C.js +1 -0
  35. package/dist/assets/{exchange-passport-CrW7dVAg.js → exchange-passport-3WK7243a.js} +1 -1
  36. package/dist/assets/{form-BqVjSzP6.js → form-CCmYt5yy.js} +1 -1
  37. package/dist/assets/{fuel-Cgu54jtO.js → fuel-BG9pjC0w.js} +1 -1
  38. package/dist/assets/{gen-access-key-D4Zopy1D.js → gen-access-key-BPsrFRZB.js} +1 -1
  39. package/dist/assets/{gen-simple-access-key-BOkAbBHA.js → gen-simple-access-key-CZGyIc9a.js} +1 -1
  40. package/dist/assets/{get-safe-url-DKPL0sDC.js → get-safe-url-BrPSNpgv.js} +1 -1
  41. package/dist/assets/{home-CAGJ1uyT.js → home-CQklhtpC.js} +1 -1
  42. package/dist/assets/{iframe-DvPZuyhb.js → iframe-CKjr768a.js} +1 -1
  43. package/dist/assets/{index-DKeCxW4D.js → index-0tKuoOtp.js} +1 -1
  44. package/dist/assets/{index-Bka-tTFw.js → index-21gjg2tv.js} +1 -1
  45. package/dist/assets/{index-DhsOorTb.js → index-2T0bIXYn.js} +1 -1
  46. package/dist/assets/{index-CLtIjagu.js → index-B-xwjRHD.js} +1 -1
  47. package/dist/assets/{index-BTBqUQm1.js → index-BjYRoSYo.js} +1 -1
  48. package/dist/assets/{index-C3fi8Y-l.js → index-BmnHj012.js} +1 -1
  49. package/dist/assets/{index-C9dtkWmq.js → index-BnLnviXD.js} +1 -1
  50. package/dist/assets/{index-Dj0nGRrj.js → index-C6JbpwU_.js} +1 -1
  51. package/dist/assets/{index-BSf_vZgi.js → index-CQbGIqeS.js} +1 -1
  52. package/dist/assets/{index-Dq0Srq3h.js → index-CVED_BmV.js} +1 -1
  53. package/dist/assets/{index-B6tDB9NM.js → index-CVVhDiqm.js} +1 -1
  54. package/dist/assets/{index-nDxxcSRU.js → index-CX38UUlR.js} +1 -1
  55. package/dist/assets/{index-eMvzC3RF.js → index-C_xi8Qiz.js} +1 -1
  56. package/dist/assets/{index-DTXEQVwg.js → index-CdOL_gmG.js} +1 -1
  57. package/dist/assets/{index-8pWloMM4.js → index-CnWOeW7L.js} +2 -2
  58. package/dist/assets/{index-BU1h5ax2.js → index-CpF08yLs.js} +1 -1
  59. package/dist/assets/{index-DXScybaX.js → index-DQt_6j3C.js} +53 -53
  60. package/dist/assets/{index-PD6zy1bY.js → index-D_0Kti8n.js} +1 -1
  61. package/dist/assets/{index-B-FsPHvJ.js → index-Dke96m3s.js} +1 -1
  62. package/dist/assets/{index-vB1fWp5c.js → index-DlXYHnCm.js} +1 -1
  63. package/dist/assets/{index-CbziauTS.js → index-DqGlhvi9.js} +1 -1
  64. package/dist/assets/{index-x4RKBi5w.js → index-Dw7qYst2.js} +1 -1
  65. package/dist/assets/{index-BvTGUpv5.js → index-NecLGEW0.js} +1 -1
  66. package/dist/assets/{index-C6xsUkOM.js → index-SZPelu8V.js} +3 -3
  67. package/dist/assets/{index-B6WvmZFK.js → index-cDc_AEjv.js} +1 -1
  68. package/dist/assets/{index-BmQjG3jd.js → index-rDCB37wy.js} +1 -1
  69. package/dist/assets/{invitation-D95v3XVN.js → invitation-DquuV8dW.js} +1 -1
  70. package/dist/assets/{invitations-DMcpv_mD.js → invitations-CTnzBAUW.js} +1 -1
  71. package/dist/assets/{invite-DnfMFz38.js → invite-Cqtkz9TE.js} +1 -1
  72. package/dist/assets/{isURL-CFycC-gz.js → isURL-BHeH7II4.js} +1 -1
  73. package/dist/assets/{issue-passport-BaMEOyaL.js → issue-passport-O1f1uJyL.js} +1 -1
  74. package/dist/assets/{item-BmeJ8uZM.js → item-Gzu2HZ93.js} +1 -1
  75. package/dist/assets/{landing-page-BQv8Dm_n.js → landing-page-BJPl6ZR-.js} +1 -1
  76. package/dist/assets/{layout-TOJ7kEb4.js → layout-CbkYBUG0.js} +1 -1
  77. package/dist/assets/{list-Dxgf_FJ5.js → list-BC0XcUGx.js} +1 -1
  78. package/dist/assets/{list-Citro58J.js → list-CA3FRf5d.js} +1 -1
  79. package/dist/assets/{localization-CfvvNuIZ.js → localization-CHT9qqQu.js} +1 -1
  80. package/dist/assets/{log-BL7saUR-.js → log-ljlYVvKz.js} +1 -1
  81. package/dist/assets/{login-CfPEbOMU.js → login-e_NJksFx.js} +1 -1
  82. package/dist/assets/{login-oauth-callback-CbHNtlhV.js → login-oauth-callback-6FC8idn6.js} +1 -1
  83. package/dist/assets/{logo-uploader-CXV5koKw.js → logo-uploader-BghZxaXm.js} +1 -1
  84. package/dist/assets/{lost-passport-DJ2zK8hy.js → lost-passport-sW8DA7d5.js} +1 -1
  85. package/dist/assets/{open-window-qEAgomZG.js → open-window-CXEIuhm-.js} +1 -1
  86. package/dist/assets/{over-due-invoice-payment-D5hqgkBT.js → over-due-invoice-payment-CcPBU5m-.js} +1 -1
  87. package/dist/assets/{overview-C_lm4_df.js → overview-D4mRghWV.js} +1 -1
  88. package/dist/assets/{passport-DM5SPbHM.js → passport-InAw8ts3.js} +1 -1
  89. package/dist/assets/{passport-item-3DI7pGBf.js → passport-item-7G49I01A.js} +1 -1
  90. package/dist/assets/{permission-s1vfZfOB.js → permission-DVlrf60Y.js} +1 -1
  91. package/dist/assets/{preferences-_yaCJj1p.js → preferences-DDCeejgD.js} +1 -1
  92. package/dist/assets/{profile-embed-C9mA_S9A.js → profile-embed-BLiDn2ls.js} +1 -1
  93. package/dist/assets/{publish-resource-Q3Sg4NhQ.js → publish-resource-ztAbEOYJ.js} +1 -1
  94. package/dist/assets/{runtime-DJ07buOB.js → runtime-DI-5yi3_.js} +1 -1
  95. package/dist/assets/sdk-BbyMeQrc.js +1 -0
  96. package/dist/assets/{security-BB8LkO1d.js → security-BFYfTqZs.js} +1 -1
  97. package/dist/assets/{session-BYUJUwt5.js → session-SqadLMEY.js} +1 -1
  98. package/dist/assets/{setup-D_uNhYL1.js → setup-DSHYh-k3.js} +1 -1
  99. package/dist/assets/{simple-select-Bh-KqIzp.js → simple-select-Bif1RlSz.js} +1 -1
  100. package/dist/assets/{spaces-CAh777pB.js → spaces-CLjWPJSv.js} +1 -1
  101. package/dist/assets/{start-BXVj6K34.js → start-RseKdDAg.js} +1 -1
  102. package/dist/assets/{starting-progress-Cr7Dhtc0.js → starting-progress-BdHDbZA8.js} +1 -1
  103. package/dist/assets/{status-C1igPCAc.js → status-B02rE3OJ.js} +1 -1
  104. package/dist/assets/{step-actions-CzQHsGG8.js → step-actions-gJEftNli.js} +1 -1
  105. package/dist/assets/{studio-NLZNkTb4.js → studio-VRwDw2v1.js} +1 -1
  106. package/dist/assets/{team-_EogfHX7.js → team-D29LjHNf.js} +1 -1
  107. package/dist/assets/{traffic-BbiwlHWj.js → traffic-DGDO-5_X.js} +1 -1
  108. package/dist/assets/{transfer-gc1GZBIx.js → transfer-CzsMxoja.js} +1 -1
  109. package/dist/assets/{unsubscribe-DuwSXkBI.js → unsubscribe-BPqvl0Qq.js} +1 -1
  110. package/dist/assets/{use-app-logo-iwMRCv-t.js → use-app-logo-D768RYSo.js} +1 -1
  111. package/dist/assets/{user-center-DfwrnXim.js → user-center-B6mso4VA.js} +2 -2
  112. package/dist/assets/{user-follower-BLRS0VYS.js → user-follower-Bx_h5g8K.js} +1 -1
  113. package/dist/assets/{util-DPYbSMU0.js → util-BQmjsgsT.js} +1 -1
  114. package/dist/assets/{util-IJIaP2Ju.js → util-CW4LiHT7.js} +1 -1
  115. package/dist/assets/{wait-connect-iNFEi-e2.js → wait-connect-DOCM-L84.js} +1 -1
  116. package/dist/assets/{wizard-DGVZKhvx.js → wizard-BsZNkmTe.js} +1 -1
  117. package/dist/assets/{wizard-components-DAyQuqLW.js → wizard-components-Bhn-EsyA.js} +1 -1
  118. package/dist/assets/{wrap-locale-BHrzeI1j.js → wrap-locale-BovKZCTj.js} +1 -1
  119. package/dist/assets/{zh-CVVdRn45.js → zh-DhM7svnr.js} +1 -1
  120. package/dist/index.html +1 -1
  121. package/dist/service-worker.js +2 -2
  122. package/package.json +30 -29
  123. package/dist/assets/dashboard-DRyb1sbI.js +0 -106
  124. package/dist/assets/engine-DHTRYPdG.js +0 -1
  125. package/dist/assets/sdk-Bomrk-jh.js +0 -1
@@ -1 +1 @@
1
- import{j as t,at as r}from"./vendor-mui-core-BPQ6AEW_.js";import{r as s}from"./vendor-react-CUXIiAnY.js";import{p as n}from"./vendor-ux-r9bApERu.js";import{t as p}from"./index-DXScybaX.js";import"./vendor-utils-BgSaqjGx.js";import"./vendor-hooks-PN9SWiQm.js";import"./lottie-web-4koyQiv_.js";import"./vendor-arcblock-D8WYBDYe.js";function l(){const{t:o}=s.useContext(n);return t.jsx(a,{style:{paddingTop:"25vh"},children:t.jsx(p,{status:"404",description:o("noMatch.desc"),style:{backgroundColor:"transparent"}})})}const a=r.main``;export{l as default};
1
+ import{j as t,at as r}from"./vendor-mui-core-BPQ6AEW_.js";import{r as s}from"./vendor-react-CUXIiAnY.js";import{p as n}from"./vendor-ux-r9bApERu.js";import{t as p}from"./index-DQt_6j3C.js";import"./vendor-utils-BgSaqjGx.js";import"./vendor-hooks-PN9SWiQm.js";import"./lottie-web-4koyQiv_.js";import"./vendor-arcblock-D8WYBDYe.js";function l(){const{t:o}=s.useContext(n);return t.jsx(a,{style:{paddingTop:"25vh"},children:t.jsx(p,{status:"404",description:o("noMatch.desc"),style:{backgroundColor:"transparent"}})})}const a=r.main``;export{l as default};
@@ -1,4 +1,4 @@
1
- import{j as a,D as M,T as _,ce as T,Q as W,cf as q,aV as X,ak as h,cg as Y,aU as Z,av as B,f as C,b$ as J,ch as K}from"./vendor-mui-core-BPQ6AEW_.js";import{r as d,k as L,L as z,n as ee,o as ae}from"./vendor-react-CUXIiAnY.js";import{H as E,aW as te}from"./index-DXScybaX.js";import{e as ie}from"./vendor-hooks-PN9SWiQm.js";import{M as re,l as m,a0 as A,a1 as S}from"./vendor-ux-r9bApERu.js";import{z as oe}from"./vendor-arcblock-D8WYBDYe.js";const H=d.createContext(null),se=e=>{const i=d.use(H);return d.useLayoutEffect(()=>{},[]),i};function le({children:e=void 0,...i}){const[t,r]=d.useState({inFullPage:!1,showToggleButton:!1,headerVisibleInFullPage:!0,footerVisibleInFullPage:!1,sidebarVisibleInFullPage:!1}),s=()=>{r(o=>({...o,inFullPage:!o.inFullPage}))},l=d.useMemo(()=>({...t,headerVisible:!t.inFullPage||t.headerVisibleInFullPage,footerVisible:!t.inFullPage||t.footerVisibleInFullPage,sidebarVisible:!t.inFullPage||t.sidebarVisibleInFullPage,toggleFullPage:s,configure:o=>r(n=>({...n,...o}))}),[t]);return a.jsx(H,{value:l,...i,children:e})}function ne({name:e,size:i=36,alt:t="",color:r="#000000",prefix:s="/images",showBadge:l=!1,style:o={},...n}){const c=`${s}/${e}-${r.replace(/^#/,"")}.png`;return a.jsxs(de,{style:{width:i,height:i},children:[a.jsx(re,{width:i,height:i,alt:t||e,src:c,style:Object.assign({width:i},o),...n}),l&&a.jsx("i",{className:"badge-point"})]})}const de=m("div")`
1
+ import{j as a,D as M,T as _,ce as T,Q as W,cf as q,aV as X,ak as h,cg as Y,aU as Z,av as B,f as C,b$ as J,ch as K}from"./vendor-mui-core-BPQ6AEW_.js";import{r as d,k as L,L as z,n as ee,o as ae}from"./vendor-react-CUXIiAnY.js";import{H as E,aW as te}from"./index-DQt_6j3C.js";import{e as ie}from"./vendor-hooks-PN9SWiQm.js";import{M as re,l as m,a0 as A,a1 as S}from"./vendor-ux-r9bApERu.js";import{z as oe}from"./vendor-arcblock-D8WYBDYe.js";const H=d.createContext(null),se=e=>{const i=d.use(H);return d.useLayoutEffect(()=>{},[]),i};function le({children:e=void 0,...i}){const[t,r]=d.useState({inFullPage:!1,showToggleButton:!1,headerVisibleInFullPage:!0,footerVisibleInFullPage:!1,sidebarVisibleInFullPage:!1}),s=()=>{r(o=>({...o,inFullPage:!o.inFullPage}))},l=d.useMemo(()=>({...t,headerVisible:!t.inFullPage||t.headerVisibleInFullPage,footerVisible:!t.inFullPage||t.footerVisibleInFullPage,sidebarVisible:!t.inFullPage||t.sidebarVisibleInFullPage,toggleFullPage:s,configure:o=>r(n=>({...n,...o}))}),[t]);return a.jsx(H,{value:l,...i,children:e})}function ne({name:e,size:i=36,alt:t="",color:r="#000000",prefix:s="/images",showBadge:l=!1,style:o={},...n}){const c=`${s}/${e}-${r.replace(/^#/,"")}.png`;return a.jsxs(de,{style:{width:i,height:i},children:[a.jsx(re,{width:i,height:i,alt:t||e,src:c,style:Object.assign({width:i},o),...n}),l&&a.jsx("i",{className:"badge-point"})]})}const de=m("div")`
2
2
  position: relative;
3
3
  .badge-point {
4
4
  position: absolute;
@@ -1,4 +1,4 @@
1
- import{g as Bt,r as v}from"./vendor-react-CUXIiAnY.js";import{j as e,ak as S,z as X,b6 as me,bg as Ke,y as V,am as ut,d7 as Wt,bn as Kt,at as ie,b1 as mt,W as p,T as ee,U as Je,d8 as pt,b5 as qe,a5 as Me,Q as Pe,d9 as Ge,aN as Ue,a6 as ft,D as ht,ci as qt,ad as xt,da as Mt,db as Ut,c2 as st,n as Ht,J as $t,x as Vt,bc as Jt,M as it,cw as Gt,I as Yt,dc as Qt}from"./vendor-mui-core-BPQ6AEW_.js";import{A as gt,J as Xt,C as Zt,e as oe,F as en,a3 as je}from"./vendor-utils-BgSaqjGx.js";import{V as te,H as q,n as le,p as tn,j as bt,Q as nn,aD as sn,m as jt,$ as vt,h as yt,aE as ke,b as St,z as an,a2 as rn}from"./vendor-ux-r9bApERu.js";import{aK as on,_ as Ye,ac as Ct,aA as wt,K as _e,c as B,a1 as Z,o as ln,aS as at}from"./index-DXScybaX.js";import{g as ye,b as $,a as se}from"./vendor-hooks-PN9SWiQm.js";import{u as Rt,C as Y}from"./index.esm-DTmS4tth.js";import{i as He}from"./isURL-CFycC-gz.js";import{S as Q}from"./section-Cyr0YvGa.js";import{A as cn,a as dn,b as un}from"./collapse-CzqKk-Uw.js";import{S as Se}from"./shorten-label-D6jbe4l0.js";import{v as Tt}from"./index-ySP_m_Ux.js";import{R as Nt,A as mn,S as pn,a as fn,B as hn}from"./list-Citro58J.js";import{j as xn,c as gn,N as bn}from"./team-_EogfHX7.js";import{W as jn}from"./did-address-j4poFq12.js";import{p as It}from"./util-IJIaP2Ju.js";import{D as vn,g as yn}from"./traffic-BbiwlHWj.js";import{B as Et}from"./bundle-avatar-CKp8Upr1.js";import{u as Sn}from"./use-mobile-ajdJIsoX.js";import"./lottie-web-4koyQiv_.js";import"./vendor-arcblock-D8WYBDYe.js";import"./required-Btg6mEmX.js";import"./server-logo-notext.svg-DHxZ1bRk.js";import"./session-BYUJUwt5.js";import"./use-app-logo-iwMRCv-t.js";import"./base32-eAS52qli.js";import"./useAsyncRetry-LJm0Fhbe.js";import"./useAsync-BCC9JxQR.js";import"./iframe-DvPZuyhb.js";import"./index-y-XalrLG.js";import"./index-DBs9Ljax.js";import"./base-chart-CcNdwghd.js";import"./index-BnOhhAn2.js";import"./vendor-mui-x-CWNb8fsW.js";import"./AdapterDayjs-DEl3BogQ.js";var Re={exports:{}},Te={exports:{}},Ne={exports:{}},rt;function Cn(){return rt||(rt=1,function(t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.default=n;function n(r){return r==null}t.exports=s.default,t.exports.default=s.default}(Ne,Ne.exports)),Ne.exports}var ot;function wn(){return ot||(ot=1,function(t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.default=f;var n=o(on()),r=o(Cn());function o(u){return u&&u.__esModule?u:{default:u}}var l=/^(?:[-+]?(?:0|[1-9][0-9]*))$/,j=/^[-+]?[0-9]+$/;function f(u,a){(0,n.default)(u),a=a||{};var y=a.allow_leading_zeroes===!1?l:j,R=!a.hasOwnProperty("min")||(0,r.default)(a.min)||u>=a.min,w=!a.hasOwnProperty("max")||(0,r.default)(a.max)||u<=a.max,b=!a.hasOwnProperty("lt")||(0,r.default)(a.lt)||u<a.lt,E=!a.hasOwnProperty("gt")||(0,r.default)(a.gt)||u>a.gt;return y.test(u)&&R&&w&&b&&E}t.exports=s.default,t.exports.default=s.default}(Te,Te.exports)),Te.exports}var lt;function Rn(){return lt||(lt=1,function(t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.default=o;var n=r(wn());function r(l){return l&&l.__esModule?l:{default:l}}function o(l){return(0,n.default)(l,{allow_leading_zeroes:!1,min:0,max:65535})}t.exports=s.default,t.exports.default=s.default}(Re,Re.exports)),Re.exports}var Tn=Rn();const Nn=Bt(Tn),ze={enabled:!1,secure:!1,from:"",host:"",port:"",user:"",password:"",companyName:"",companyLink:"",companyAddress:"",supportEmail:""};function In(){const{api:t}=Ye(),{blocklet:s}=Ct(),{t:n}=te(),{confirmApi:r,confirmHolder:o}=wt(),l=s?.meta?.did,j=Object.assign({...ze},s?.settings?.notification?.email||{}),{handleSubmit:f,control:u,formState:a,watch:y,reset:R}=Rt({defaultValues:gt(j,Object.keys(ze))}),w=ye({testReceiver:"",testReceiverError:""}),b=y("enabled"),E=$(async(i,C,D=!0)=>{try{const{blocklet:O}=await t.configNotification({input:{did:l,notification:JSON.stringify({email:i})}}),ae=Object.assign({...ze},O?.settings?.notification?.email||{});R(ae),D&&q.success(n("oauth.saveSuccess"))}catch(O){if(D)q.error(O.message||n("oauth.saveFailed"));else throw O}}),J=$(async(i,C,D)=>{try{a.isDirty&&await E(i,C,!1),await t.sendEmail({input:{did:l,receiver:D,email:JSON.stringify({body:"Your SMTP configuration is correct!",title:"Test email",type:"notification",attachments:[{type:"link",data:{url:"https://community.arcblock.io",title:"Community",image:"https://community.arcblock.io/.well-known/service/blocklet/logo-rect-dark",utm:{campaign:"test-campaign"}}}],utm:{content:"test-email-button"}})}}),q.success(n("notification.email.testSuccess"))}catch(O){q.error(O.message||n("notification.email.testfailed"))}}),M=$((i,C)=>{w.testReceiver=localStorage.getItem("test-receiver")||"",w.testReceiverError="",r.open({title:n("notification.email.testSendEmail"),content:()=>e.jsx(S,{sx:{width:"300px"},children:e.jsx(X,{sx:{mt:1},fullWidth:!0,name:"testReceiver",label:n("notification.email.inputTestReceiver"),value:w.testReceiver,onChange:D=>{w.testReceiver=D.target.value},error:!!w.testReceiverError,helperText:w.testReceiverError||" "})}),confirmButtonText:n("common.confirm"),cancelButtonText:n("common.cancel"),async onConfirm(D){const O=w.testReceiver?.trim();if(!O){w.testReceiverError=n("notification.email.receiverRequired");return}if(!_e(O)){w.testReceiverError=n("notification.email.receiverInvalid");return}w.testReceiverError="",await J(i,C,O),D()}})}),P=$(i=>{const C=i?.trim();return C?_e(C)?!0:n("notification.email.fromInvalid"):n("notification.email.fromRequired")}),F=$(i=>{const C=i?.trim();return C?He(C,{require_host:!1,protocols:[]})?!0:n("notification.email.hostInvalid"):n("notification.email.hostRequired")}),N=$(i=>i?Nn(i)?!0:n("notification.email.portInvalid"):n("notification.email.portRequired")),W=$(i=>i?.trim()?!0:n("notification.email.userRequired")),K=$(i=>i?.trim()?!0:n("notification.email.passwordRequired")),h=$(i=>i?.trim()&&!He(i,{protocols:["http","https"],require_protocol:!0})?n("notification.email.linkInvalid"):!0),T=$(i=>i?.trim()&&!_e(i)?n("notification.email.emailInvalid"):!0),k=$(()=>!0);return e.jsxs(S,{children:[e.jsxs(En,{component:"form",onSubmit:f(E),disabled:!0,sx:{".section-left":{width:"160px"}},children:[e.jsx(Q,{title:n("notification.email.enable"),my:2.5,children:e.jsx(Y,{name:"enabled",control:u,render:({field:i})=>e.jsx(me,{control:e.jsx(Ke,{checked:i.value,...i})})})}),e.jsx(Q,{title:n("notification.email.from"),children:e.jsx(Y,{name:"from",control:u,rules:{validate:b?P:k},render:({field:i})=>e.jsx(V,{fullWidth:!0,children:e.jsx(X,{...i,size:"small",required:!0,label:n("notification.email.from"),error:!!a.errors[i.name],helperText:a.errors[i.name]?.message||" ",disabled:!b})})})}),e.jsx(Q,{title:n("notification.email.host"),children:e.jsx(Y,{name:"host",control:u,rules:{validate:b?F:k},render:({field:i})=>e.jsx(V,{fullWidth:!0,children:e.jsx(X,{...i,size:"small",required:!0,error:!!a.errors[i.name],label:n("notification.email.host"),helperText:a.errors[i.name]?.message||" ",disabled:!b})})})}),e.jsx(Q,{title:n("notification.email.port"),children:e.jsx(Y,{name:"port",control:u,rules:{validate:b?N:k},render:({field:i})=>e.jsx(V,{fullWidth:!0,children:e.jsx(X,{...i,size:"small",required:!0,type:"number",error:!!a.errors[i.name],label:n("notification.email.port"),helperText:a.errors[i.name]?.message||" ",disabled:!b})})})}),e.jsx(Q,{title:n("notification.email.user"),children:e.jsx(Y,{name:"user",control:u,rules:{validate:b?W:k},render:({field:i})=>e.jsx(V,{fullWidth:!0,children:e.jsx(X,{...i,size:"small",required:!0,error:!!a.errors[i.name],label:n("notification.email.user"),helperText:a.errors[i.name]?.message||" ",disabled:!b})})})}),e.jsx(Q,{title:n("notification.email.password"),children:e.jsx(Y,{name:"password",control:u,rules:{validate:b?K:k},render:({field:i})=>e.jsx(V,{fullWidth:!0,children:e.jsx(X,{...i,size:"small",required:!0,type:"password",error:!!a.errors[i.name],label:n("notification.email.password"),helperText:a.errors[i.name]?.message||" ",disabled:!b})})})}),e.jsx(Q,{title:n("notification.email.secure"),children:e.jsx(Y,{name:"secure",control:u,rules:{validate:k},render:({field:i})=>e.jsx(V,{fullWidth:!0,children:e.jsx(me,{control:e.jsx(Ke,{checked:i.value,...i,disabled:!b})})})})}),e.jsxs(cn,{children:[e.jsxs(dn,{expandIcon:e.jsx(Kt,{fontSize:"small"}),"aria-controls":"panel1-content",id:"panel1-header",children:[n("notification.email.signature"),e.jsx(ut,{title:n("notification.email.signatureTooltip"),children:e.jsx(Wt,{fontSize:"small",sx:{ml:1,cursor:"help"}})})]}),e.jsxs(un,{children:[e.jsx(Q,{title:n("notification.email.companyName"),children:e.jsx(Y,{name:"companyName",control:u,rules:{validate:k},render:({field:i})=>e.jsx(V,{fullWidth:!0,children:e.jsx(X,{...i,size:"small",error:!!a.errors[i.name],label:n("notification.email.companyName"),helperText:a.errors[i.name]?.message||" ",disabled:!b})})})}),e.jsx(Q,{title:n("notification.email.companyLink"),children:e.jsx(Y,{name:"companyLink",control:u,rules:{validate:b?h:k},render:({field:i})=>e.jsx(V,{fullWidth:!0,children:e.jsx(X,{...i,size:"small",error:!!a.errors[i.name],label:n("notification.email.companyLink"),helperText:a.errors[i.name]?.message||" ",disabled:!b})})})}),e.jsx(Q,{title:n("notification.email.companyAddress"),children:e.jsx(Y,{name:"companyAddress",control:u,rules:{validate:k},render:({field:i})=>e.jsx(V,{fullWidth:!0,children:e.jsx(X,{...i,size:"small",error:!!a.errors[i.name],label:n("notification.email.companyAddress"),helperText:a.errors[i.name]?.message||" ",disabled:!b})})})}),e.jsx(Q,{title:n("notification.email.supportEmail"),children:e.jsx(Y,{name:"supportEmail",control:u,rules:{validate:b?T:k},render:({field:i})=>e.jsx(V,{fullWidth:!0,children:e.jsx(X,{...i,size:"small",type:"email",error:!!a.errors[i.name],label:n("notification.email.supportEmail"),helperText:a.errors[i.name]?.message||" ",disabled:!b})})})})]})]}),e.jsxs(S,{sx:{display:"flex",justifyContent:"flex-end",gap:2,mt:3},children:[e.jsx(le,{variant:"outlined",color:"warning",onClick:f(M),disabled:!b,children:n("oauth.runTest")}),e.jsx(le,{type:"submit",variant:"contained",disabled:!a.isDirty,children:n("oauth.save")})]})]}),o]})}const En=ie(mt)``,Be={enabled:!1,endpoint:"",did:void 0,pushPath:void 0};function kn(){const{api:t}=Ye(),{blocklet:s}=Ct(),{t:n}=te(),{confirmApi:r,confirmHolder:o}=wt(),l=s?.meta?.did,j=Object.assign({...Be},s?.settings?.notification?.pushKit||{}),{handleSubmit:f,control:u,formState:a,watch:y,reset:R}=Rt({defaultValues:gt(j,Object.keys(Be))}),w=ye({testReceiver:"",testReceiverError:""}),b=y("enabled"),E=$(async(N,W,K=!0)=>{try{const{blocklet:h}=await t.configNotification({input:{did:l,notification:JSON.stringify({pushKit:N})}}),T=Object.assign({...Be},h?.settings?.notification?.pushKit||{});R(T),K&&q.success(n("oauth.saveSuccess"))}catch(h){if(K)q.error(h.message||n("oauth.saveFailed"));else throw h}}),J=$(async(N,W)=>{try{a.isDirty&&await E(N,W,!1);const K=(s?.configs||[]).find(k=>k.key==="BLOCKLET_APP_URL")?.value,h=Xt(Zt(K,B.WELLKNOWN_SERVICE_PATH_PREFIX,"/blocklet/logo"),{v:s?.meta?.version,t:new Date(s?.updatedAt||0).getTime()}),T={type:"passthrough",passthroughType:"messageStatus",data:{message:{title:"Test push-kit notification",body:"This is message from push-kit config test",sender:{did:s?.appDid,fullName:s?.meta?.title,avatar:h}}}};await t.sendPush({input:{did:l,receiver:w.testReceiver,notification:JSON.stringify(T)}}),q.success(n("notification.pushKit.testSuccess"))}catch(K){q.error(K.message||n("notification.pushKit.testfailed"))}}),M=$((N,W)=>{w.testReceiverError="",r.open({title:n("notification.pushKit.testSend"),content:()=>e.jsx(S,{sx:{width:"450px",maxWidth:"100%"},children:e.jsx(X,{sx:{mt:1},fullWidth:!0,name:"testReceiver",label:n("notification.pushKit.inputTestReceiver"),value:w.testReceiver,onChange:K=>{w.testReceiver=K.target.value},error:!!w.testReceiverError,helperText:w.testReceiverError||" "})}),confirmButtonText:n("common.confirm"),cancelButtonText:n("common.cancel"),async onConfirm(K){if(!w.testReceiver?.trim()){w.testReceiverError=n("notification.pushKit.receiverRequired");return}w.testReceiverError="",await J(N,W),K()}})}),P=$(N=>{const W=N?.trim();return W?He(W)?!0:n("notification.pushKit.endpointInvalid"):n("notification.pushKit.endpointRequired")}),F=$(()=>!0);return e.jsxs(S,{children:[e.jsxs(An,{component:"form",onSubmit:f(E),disabled:!0,sx:{".section-left":{width:"160px"}},children:[e.jsx(Q,{title:n("notification.pushKit.enable"),my:2.5,children:e.jsx(Y,{name:"enabled",control:u,render:({field:N})=>e.jsx(me,{control:e.jsx(Ke,{checked:N.value,...N})})})}),e.jsx(Q,{title:n("notification.pushKit.endpoint"),children:e.jsx(Y,{name:"endpoint",control:u,rules:{validate:b?P:F},render:({field:N})=>e.jsx(V,{fullWidth:!0,children:e.jsx(X,{...N,size:"small",required:!0,label:n("notification.pushKit.endpoint"),error:!!a.errors[N.name],helperText:a.errors[N.name]?.message||" ",disabled:!b})})})}),e.jsxs(Q,{title:n("notification.pushKit.customOptions"),children:[e.jsx(Y,{name:"did",control:u,render:({field:N})=>e.jsx(V,{fullWidth:!0,children:e.jsx(X,{...N,size:"small",label:n("notification.pushKit.did"),error:!!a.errors[N.name],helperText:a.errors[N.name]?.message||" ",disabled:!b})})}),e.jsx(Y,{name:"pushPath",control:u,render:({field:N})=>e.jsx(V,{fullWidth:!0,children:e.jsx(X,{...N,size:"small",label:n("notification.pushKit.pushPath"),error:!!a.errors[N.name],helperText:a.errors[N.name]?.message||" ",disabled:!b})})})]}),e.jsxs(S,{sx:{display:"flex",justifyContent:"flex-end",gap:2,mt:3},children:[e.jsx(le,{variant:"outlined",color:"warning",onClick:f(M),disabled:!b,children:n("oauth.runTest")}),e.jsx(le,{type:"submit",variant:"contained",disabled:!a.isDirty,children:n("oauth.save")})]})]}),o]})}const An=ie(mt)``,ct=[{label:e.jsx(S,{sx:{textAlign:"center",width:"100%"},children:"Email"}),value:"email"},{label:e.jsx(S,{sx:{textAlign:"center",width:"100%"},children:"Push Kit"}),value:"pushKit"}];function On(){const[t,s]=v.useState(ct[0].value),{locale:n}=v.useContext(tn),r=se(()=>({email:e.jsx(In,{}),pushKit:e.jsx(kn,{})}),[n]),o=v.useMemo(()=>({padding:"10px 0"}),[]);return e.jsxs(S,{children:[e.jsx(bt,{tabs:ct,current:t,onChange:s}),e.jsx(S,{style:o,children:r[t]})]})}const kt=v.createContext({}),{Provider:Dn,Consumer:Bs}=kt;function Ln({children:t,blocklet:s=""}){const{api:n,inService:r,ws:{useSubscription:o}}=Ye(),[l,j]=v.useState([]),[f,u]=v.useState({total:0,pageSize:20,pageCount:0,page:1}),a=se(()=>s.meta?.did,[s]),[y,R]=v.useState([]),[w,b]=v.useState({}),E=se(()=>l.length?new Set(l.map(h=>h.id)):new Set,[l]),J=async({page:h=1,pageSize:T=20,...k}={})=>{if(!a)return[];try{const i={paging:{page:h,pageSize:T},...k,teamDid:a,dateRange:k.dateRange?[Z(k.dateRange[0]).toISOString(),Z(k.dateRange[1]).toISOString()]:void 0},{dids:C,...D}=i;let O="";C&&C.includes("system")&&(O="system");const ae=C?C.filter(pe=>pe!=="system"):[],de={...D,source:O,componentDids:ae},re=await n.getNotificationSendLog({input:de});return b(de),j(re.list),u(re.paging),re.list}catch(i){return q.error(i.message),[]}},M=async()=>{const h=await n.getNotificationComponents({input:{teamDid:a}});R(h.componentDids)},P=v.useCallback(h=>{const T=s.children.find(k=>k.meta?.did===h);if(T)return T.ancestors=[s],T},[s]),F=async({notificationId:h,receivers:T,channels:k,...i})=>{await n.resendNotification({input:{teamDid:a,notificationId:h,receivers:T,channels:k.map(C=>C==="wallet"?B.NOTIFICATION_SEND_CHANNEL.WALLET:C==="pushKit"?B.NOTIFICATION_SEND_CHANNEL.PUSH:C),...i}})},N=v.useCallback(async h=>(await n.getUser({input:{teamDid:a,user:{did:h},options:{enableConnectedAccount:!0}}})).user,[n,a]),W=v.useCallback(async({page:h=1,pageSize:T=20,...k}={})=>{try{const i={paging:{page:h,pageSize:T},...k,userName:k.searchText||"",teamDid:a,dateRange:k.dateRange?[Z(k.dateRange[0]).toISOString(),Z(k.dateRange[1]).toISOString()]:void 0};return await n.getReceivers({input:i})}catch(i){throw q.error(i.message),i}},[n,a]);v.useEffect(()=>{a&&M()},[a]),o(B.EVENTS.NOTIFICATION_BLOCKLET_UPDATE,h=>{E.has(h.notificationId)&&J(w)},[E,w]),o(B.EVENTS.NOTIFICATION_BLOCKLET_CREATE,h=>{E.has(h.id)||J(w)},[E,w]);const K={fetch:J,data:l,paging:f,blocklet:s,getComponent:P,resendNotification:F,getUser:N,componentDids:y,getReceivers:W,inService:r,teamDid:a};return e.jsx(Dn,{value:{notificationRecords:K},children:t})}function Qe(){const{notificationRecords:t}=v.useContext(kt);return t}Ce.propTypes={severity:p.oneOf(Object.values(["info","success","error","warning"])).isRequired};const Pn={info:"primary",success:"success",error:"error",warning:"warning"};function Ce({severity:t="info"}){return e.jsx(nn,{type:Pn[t],children:t})}const Fn=(t,s,n="")=>{if(!n||!s)return"";switch(n){case B.NOTIFICATION_SEND_FAILED_REASON.USER_DISABLED:return t("notification.sendStatus.reason.disabled",{channel:s});case B.NOTIFICATION_SEND_FAILED_REASON.CHANNEL_UNAVAILABLE:return t("notification.sendStatus.reason.unavailable",{channel:s});case B.NOTIFICATION_SEND_FAILED_REASON.CHANNEL_DISABLED:return t("notification.sendStatus.reason.notSent",{channel:s});case B.NOTIFICATION_SEND_FAILED_REASON.NOT_ONLINE:return t("notification.sendStatus.reason.offline");default:return n}};function At(t,s,n={}){const{status:r,updatedAt:o,reason:l="",channel:j="wallet"}=n,f=o?t("notification.sendStatus.sentTime",{date:ln(o,s)}):"",u=Fn(t,j,l);return r===B.NOTIFICATION_SEND_STATUS.FAILED?{status:"failed",title:t("notification.sendStatus.failed"),sentTime:f,reason:u}:r===B.NOTIFICATION_SEND_STATUS.SENT?{status:"success",title:t("notification.sendStatus.success"),sentTime:f}:{status:"pending",title:t("notification.sendStatus.pending"),reason:u,sentTime:f}}const $e={pending:"#aaaaaa",success:"#34BE74",failed:"#D0021B"},Ve=["wallet","pushKit","email"],dt=["info","success","error","warning"],Ot=t=>{const{settings:s}=t;return s?.notification?.email?.enabled},Dt=t=>{const{settings:s}=t;return s?.notification?.pushKit?.enabled},_n=(t,s)=>{const n=oe(s,"extra.notifications.email",!0);return{available:Ot(t),enabled:n}},zn=(t,s)=>{const n=oe(s,"extra.notifications.push",!0);return{available:Dt(t),enabled:n}},Bn=t=>({enabled:oe(t,"extra.notifications.wallet",!0)}),Wn=t=>({enabled:oe(t,"extra.webhooks",[]).length>0}),Ie=(t=3)=>new Promise(s=>{setTimeout(()=>{s()},t*1e3)}),Kn=(t,s)=>s==="wallet"||s==="webhook"?[{channel:s,type:"enabled",pass:t("notification.sendStatus.reason.enabled",{channel:s}),fail:t("notification.sendStatus.reason.disabled",{channel:s})}]:s==="pushKit"||s==="email"?[{channel:s,type:"available",pass:t("notification.sendStatus.reason.available",{channel:s}),fail:t("notification.sendStatus.reason.unavailable",{channel:s})},{channel:s,type:"enabled",pass:t("notification.sendStatus.reason.enabled",{channel:s}),fail:t("notification.sendStatus.reason.disabled",{channel:s})}]:[],Ee=(t=[])=>{const s=Z().startOf("day");return t.filter(n=>Z(n.sendAt).isSame(s,"day")).length},qn=(t,s="")=>{if(s&&Ve.includes(s)){const l=`${s}SendRecord`,j=oe(t,l,[]);return Ee(j)}const n=oe(t,"webhook",{}),r=Object.keys(n??{})??[];if(s&&r.includes(s)){const l=n[s]??[];return Ee(l)}const o={};return Ve.forEach(l=>{const j=`${l}SendRecord`,f=oe(t,j,[]),u=Ee(f);o[l]=u}),r.length>0&&r.forEach(l=>{const j=n[l]??[],f=Ee(j);o[l]=f}),o},Ae=(t,s,n)=>{if(!Array.isArray(t))throw new Error("Invalid filterList or index");return t[n].splice(s,1),t},Oe=(t,s)=>{if(!Array.isArray(s))throw new Error("filters must be an array");return s.length?!s.includes(t):!1},Mn=t=>{switch(t){case B.NOTIFICATION_SEND_CHANNEL.WALLET:return"Wallet";case B.NOTIFICATION_SEND_CHANNEL.PUSH:return"Push Kit";case B.NOTIFICATION_SEND_CHANNEL.EMAIL:return"Email";case B.NOTIFICATION_SEND_CHANNEL.WEBHOOK:return"Webhook";default:return""}},Lt=()=>({components:{MUIDataTableFilter:{styleOverrides:{header:{marginBottom:0,p:{margin:0}},root:{"& .MuiGrid-container":{marginTop:0,"& .MuiGrid-item":{paddingTop:0}}}}},MuiPopover:{styleOverrides:{root:{"&.MuiPopover-root":{"& .MuiPaper-root:has(.filter-container)":{width:"420px"}}}}}}});function ce({config:t,enableTooltip:s=!0,showTitle:n=!1,children:r=null}){const{status:o,title:l="",sentTime:j="",reason:f=""}=t,u=[l,f].filter(Boolean).join(", ");return e.jsx(ut,{title:s?e.jsxs(e.Fragment,{children:[e.jsx(ee,{color:"inherit",sx:{fontSize:12},children:u}),e.jsx("span",{children:j})]}):null,arrow:!0,placement:"top",children:e.jsxs(S,{sx:{display:"flex",flexDirection:"row",alignItems:"center",gap:"4px"},children:[e.jsxs(S,{sx:{position:"relative",minHeight:14,minWidth:14,display:"flex",alignItems:"center",justifyContent:"center"},children:[e.jsx(S,{style:{opacity:.15},sx:{position:"absolute",width:"100%",height:"100%",borderRadius:"50%",bgcolor:$e[o]}}),e.jsx(S,{sx:{position:"absolute",width:"55%",height:"55%",borderRadius:"50%",bgcolor:$e[o]}})]}),e.jsx(ee,{color:"inherit",sx:{fontSize:12},children:n?l:r})]})})}ce.propTypes={config:p.object.isRequired,enableTooltip:p.bool,showTitle:p.bool,children:p.node};De.propTypes={list:p.array.isRequired,label:p.string.isRequired,onDelete:p.func};function De({list:t,label:s,onDelete:n=()=>{}}){const{t:r,locale:o}=te();return e.jsxs(S,{sx:{display:"flex",gap:1,alignItems:"center"},children:[e.jsxs(ee,{children:[s,": "]}),t.map(l=>{const j=At(r,o,{status:l});return e.jsx(Je,{size:"small",label:e.jsx(S,{sx:{display:"flex",alignItems:"center",gap:"4px"},children:e.jsx(ce,{config:j,enableTooltip:!1,children:j.title})}),onDelete:f=>n(f,l)},l)})]})}Xe.propTypes={filterList:p.array.isRequired,onChange:p.func.isRequired,index:p.number.isRequired,column:p.object.isRequired,filterValues:p.array.isRequired,label:p.string.isRequired,renderLabel:p.func.isRequired};function Xe({filterList:t,onChange:s,index:n,column:r,filterValues:o,label:l,renderLabel:j}){return e.jsxs(V,{className:"filter-container",children:[e.jsx(pt,{component:"legend",children:l}),e.jsx(qe,{row:!0,children:o.map(f=>e.jsx(me,{control:e.jsx(Me,{checked:t[n].indexOf(f.value??f)>-1,onChange:u=>{const a=[...t];u.target.checked?a[n]=[...a[n],f.value??f]:a[n]=a[n].filter(y=>y!==(f.value??f)),s(a[n],n,r)},name:f.value??f}),label:e.jsx("span",{style:{display:"flex",alignItems:"center"},children:j(f)})},f.value??f))})]})}function We(t){return e.jsx(Xe,{...t,renderLabel:s=>e.jsx(ce,{enableTooltip:!1,config:{status:s.status},children:s.label})})}xe.propTypes={status:p.number.isRequired,updatedAt:p.string.isRequired,reason:p.string,channel:p.string,onResend:p.func};function xe({status:t,updatedAt:s,reason:n="",channel:r="wallet",onResend:o}){const{t:l,locale:j}=te(),f=At(l,j,{status:t,updatedAt:s,reason:n,channel:r});return e.jsxs(S,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(ce,{config:f,showTitle:!0}),f.status!=="success"&&e.jsx(Pe,{className:"resend-btn",size:"small",startIcon:e.jsx(Ge,{}),sx:{fontSize:12,color:"rgba(0, 0, 0, 0.87)",fontWeight:400,".MuiButton-startIcon":{mr:"2px"}},onClick:o,children:l("notification.resend")})]})}Ze.propTypes={value:p.array.isRequired,onChange:p.func};function Ze({value:t,onChange:s}){const{locale:n}=te(),r=Z().toDate(),[o,l]=v.useState(null),j=v.useCallback(a=>{l(o?null:a.currentTarget)},[o]),f=!!o,u=v.useCallback(a=>{if(!a.startDate||!a.endDate){q.error("Please select a date range");return}if(Z(a.startDate).isAfter(a.endDate)||!Z(a.startDate).isValid()||!Z(a.endDate).isValid()){q.error("Invalid date range");return}s([a.startDate,a.endDate]),l(null)},[s]);return e.jsxs("div",{children:[e.jsx(ee,{component:"div",variant:"h5",color:"textPrimary",style:{fontSize:18,fontWeight:"bold"},sx:{mb:0},children:e.jsxs(Pe,{onClick:j,variant:"outlined",size:"small",color:"inherit",children:[at(t[0],n)," - ",at(t[1],n)]})}),e.jsx(Ue,{open:f,anchorEl:o,onClose:()=>{l(null)},anchorOrigin:{vertical:"bottom",horizontal:"left"},children:e.jsx(vn,{open:!0,maxDate:r,initialDateRange:{startDate:t[0],endDate:t[1]},toggle:j,definedRanges:yn(r),onChange:u})})]})}et.propTypes={itemComponent:p.elementType.isRequired};function et({itemComponent:t,...s}){const{t:n}=te();return!s?.filterList?.filter(o=>o.length).length?null:e.jsxs(S,{sx:{display:"flex",gap:1,alignItems:"center"},children:[e.jsx("div",{className:"toolbar-filter-title",children:n("notification.filter")}),e.jsx("div",{className:"toolbar-filter-content",children:e.jsx(sn.TableFilterList,{...s,ItemComponent:t})})]})}function tt({label:t,onDelete:s,canDelete:n=()=>!0,...r}){const o=s&&typeof s=="function"?s:void 0;let l=!0;return n&&typeof n=="function"&&(l=n({label:t,...r})),e.jsx(Je,{label:t,variant:"outlined",...o&&l?{onDelete:o}:{}})}tt.propTypes={label:p.string.isRequired,onDelete:p.func,canDelete:p.func};const Un=[{label:"Wallet",value:"app",checked:!0},{label:"Email",value:"email",checked:!0},{label:"Push Kit",value:"push",checked:!0},{label:"Webhook",value:"webhook",checked:!0}];Pt.propTypes={loading:p.bool,onCancel:p.func,onConfirm:p.func};function Pt({loading:t=!1,onCancel:s=()=>{},onConfirm:n=()=>{}}){const{t:r}=te(),[o,l]=v.useState(Un),[j,f]=v.useState(!0),u=(y,R)=>{R.checked=y.target.checked;const w=o.map(b=>({...b,checked:b.value===R.value?R.checked:b.checked}));l(w)},a=y=>{y.stopPropagation(),n({channels:o.filter(R=>R.checked).map(R=>R.value),isResendFailedOnly:j})};return e.jsxs(S,{className:"resend-config",sx:{padding:"16px 24px"},children:[e.jsx(ee,{variant:"body1",component:"div",className:"check-title",sx:{fontWeight:700,mb:1},children:r("notification.config")}),e.jsx(S,{className:"choose-channel",children:e.jsxs(V,{component:"fieldset",variant:"standard",children:[e.jsx(pt,{component:"legend",children:r("notification.selectChannels")}),e.jsx(qe,{sx:{display:"flex",flexDirection:"row",flexWrap:"wrap",gap:1},children:o.map(y=>e.jsx(me,{control:e.jsx(Me,{checked:y.checked,onChange:R=>u(R,y),name:y.value}),label:y.label},y.value))})]})}),e.jsx(S,{className:"resend-config-footer",children:e.jsx(qe,{children:e.jsx(me,{control:e.jsx(Me,{checked:j,onChange:y=>f(y.target.checked)}),label:r("notification.resendFailedOnly")})})}),e.jsxs(S,{className:"resend-config-footer-tip",sx:{display:"flex",justifyContent:"flex-end",gap:1},children:[e.jsx(Pe,{onClick:y=>{y.stopPropagation(),s()},color:"inherit",children:r("common.cancel")}),e.jsxs(Pe,{onClick:a,color:"primary",disabled:t,variant:"contained",autoFocus:!0,style:{marginLeft:8},children:[t&&e.jsx(ft,{size:16}),r("common.confirm")]})]})]})}Ft.propTypes={notificationId:p.string.isRequired,handleResend:p.func,resending:p.bool};function Ft({notificationId:t,handleResend:s,resending:n=!1}){const{t:r,locale:o}=te(),l=ht(),j=v.useMemo(()=>jt(l,Lt()),[l]),{getReceivers:f,inService:u,teamDid:a,getUser:y,blocklet:R}=Qe(),[w,b]=v.useState(!1),[E,J]=v.useState([]),M=ye({anchorEl:null,position:null}),P=ye({anchorEl:null,position:null}),[F,N]=v.useState(null),[W,K]=v.useState({total:0,pageSize:10,pageCount:0,page:1}),[h,T]=v.useState({searchText:"",page:1,pageSize:10,walletSendStatus:[],pushKitSendStatus:[],emailSendStatus:[],dateRange:[Z().subtract(1,"month").startOf("day").toDate(),Z().endOf("day").toDate()]}),[k,i]=v.useState([]),C=[{label:r("notification.sendStatus.pending"),value:0,status:"pending"},{label:r("notification.sendStatus.success"),value:1,status:"success"},{label:r("notification.sendStatus.failed"),value:2,status:"failed"}],D=async()=>{if(!w&&t)try{b(!0);const c=await f({notificationId:t,...h}),d=c.list.map(m=>({...m,receiverUser:{...m.receiverUser,avatar:It(m.receiverUser.avatar,a,u)}}));J(d),K(c.paging),b(!1)}catch(c){q.error(c.message),b(!1)}};v.useEffect(()=>{D()},[h]);const O=c=>{c.stopPropagation();const d=c.currentTarget;P.anchorEl=d;const m=d.getBoundingClientRect();P.position={top:m.top+window.scrollY,left:m.left+window.scrollX}},ae=c=>c.data.length?e.jsx("div",{style:{display:"flex",alignItems:"center",padding:"10px"},children:e.jsx(le,{className:"resend-btn",size:"small",color:"primary",variant:"contained",startIcon:e.jsx(Ge,{}),sx:{".MuiButton-startIcon":{mr:"2px"}},onClick:O,children:r("notification.resend")})}):null,de={sort:!1,download:!1,print:!1,selectableRows:"multiple",searchPlaceholder:r("common.search"),searchAlwaysOpen:!1,filterType:"checkbox",searchDebounceTime:300,page:W.page-1,rowsPerPage:W.pageSize,count:W.total,searchText:h.searchText,tableBodyMaxHeight:"calc(80vh - 260px)",rowsSelected:k,onRowSelectionChange:(c,d)=>{i(d.map(m=>m.dataIndex))},customToolbarSelect:ae},re=({page:c,rowsPerPage:d,searchText:m,filterList:A})=>{const[,U=[],ne=[],G=[]]=A;h.pageSize!==d?T(H=>({...H,pageSize:d,page:1})):h.page!==c+1?T(H=>({...H,page:c+1})):h.searchText!==m?T(H=>({...H,searchText:m,page:1})):je(U,h.walletSendStatus)?je(ne,h.pushKitSendStatus)?je(G,h.emailSendStatus)||T(H=>({...H,emailSendStatus:G,page:1})):T(H=>({...H,pushKitSendStatus:ne,page:1})):T(H=>({...H,walletSendStatus:U,page:1}))},pe=v.useCallback(async(c,d)=>{if(!d)return!1;const m=await y(d);return m?c==="wallet"?Bn(m):c==="email"?_n(R,m):c==="pushKit"?zn(R,m):c==="webhook"?Wn(m):!0:!1},[y,R]),Fe=v.useCallback(c=>Kn(r,c),[r]),ue=()=>{M.anchorEl=null,M.position=null,N(null)},fe=()=>{P.anchorEl=null,P.position=null},we=async(c,d,m=!0,A="")=>{if(!(!d.length||!c.length))try{s(c,d,m,A),P.anchorEl||(await Ie(.5),ue())}catch(U){console.error("handleResend error",{error:U})}},g=async({channels:c,isResendFailedOnly:d})=>{const m=k.map(A=>E[A].receiver);await we(c,m,d),await Ie(.5),fe(),i([])},x=async(c,d=[],m=!0)=>{try{await we(["webhook"],[c.receiver],m,d)}catch(A){q.error(A.response?A.response.statusText:A.message)}},I=async(c,d,m,A=[],U=!0)=>{if(c.stopPropagation(),qn(d,m)>=4){q.warning(r("notification.resendLimit"));return}if(!Ve.includes(m)){await x(d,A,U);return}if(c){const G=c.currentTarget,H=G.getBoundingClientRect();M.anchorEl=G,M.position={top:H.top+window.scrollY,left:H.left+window.scrollX}}N({channel:m});try{const G=await pe(m,d.receiver);await Ie(1),N({channel:m,result:G}),(typeof G=="boolean"&&G||en(G)&&Object.values(G).every(H=>!!H))&&(await s([m],[d.receiver],U),P.anchorEl||(await Ie(.5),ue()))}catch(G){q.error(G.message)}},_=c=>{T(d=>({...d,dateRange:c,page:1}))},z=(c,d,m,A)=>{c.stopPropagation();const U=m.filter(ne=>ne!==d);T(ne=>({...ne,[A]:U,page:1}))},L=se(()=>[{label:r("notification.receiver"),name:"receiver",width:200,options:{filter:!1,customBodyRenderLite:c=>{const{receiverUser:d,receiver:m}=E[c];return d?e.jsxs(S,{"data-cy":`member-name-${d.fullName}`,sx:{display:"flex",alignItems:"center",gap:1,justifyContent:"flex-start"},children:[e.jsx(vt,{src:`${d.avatar}?imageFilter=resize&w=48&h=48`,size:32,did:m,shape:"circle",style:{borderRadius:"100%",overflow:"hidden"}}),e.jsx(Se,{children:d.fullName})]},m):e.jsx(jn,{size:14,responsive:!1,compact:!0,copyable:!1,did:m})}}},{label:"Wallet",name:"walletSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),filter:!0,filterType:"custom",filterList:h.walletSendStatus??[],customFilterListOptions:{render:c=>e.jsx(De,{list:c,label:"Wallet",onDelete:(d,m)=>{d.stopPropagation(),z(d,m,L[1].options.filterList,"walletSendStatus")}}),update:Ae},filterOptions:{names:C,fullWidth:!0,logic:Oe,display:(c,d,m,A)=>e.jsx(We,{label:"Wallet",filterList:c,onChange:d,index:m,column:A,filterValues:C})},customBodyRenderLite:c=>{const{walletSendStatus:d,walletSendAt:m,walletSendFailedReason:A}=E[c];return e.jsx(xe,{status:d,updatedAt:m,reason:A,channel:"wallet",onResend:U=>I(U,E[c],"wallet",[],!1)})}}},{label:"Push Kit",name:"pushKitSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:c=>{const{pushKitSendStatus:d,pushKitSendAt:m,pushKitSendFailedReason:A}=E[c];return e.jsx(xe,{status:d,updatedAt:m,reason:A,channel:"pushkit",onResend:U=>I(U,E[c],"pushKit",[],!1)})},filter:!0,filterType:"custom",filterList:h.pushKitSendStatus??[],customFilterListOptions:{render:c=>e.jsx(De,{list:c,label:"Push Kit",onDelete:(d,m)=>{d.stopPropagation(),z(d,m,L[2].options.filterList,"pushKitSendStatus")}}),update:Ae},filterOptions:{names:C,fullWidth:!0,logic:Oe,display:(c,d,m,A)=>e.jsx(We,{label:"Push Kit",filterList:c,onChange:d,index:m,column:A,filterValues:C})}}},{label:"Email",name:"emailSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:c=>{const{emailSendStatus:d,emailSendAt:m,emailSendFailedReason:A}=E[c];return e.jsx(xe,{status:d,updatedAt:m,reason:A,channel:"email",onResend:U=>I(U,E[c],"email",[],!1)})},filter:!0,filterType:"custom",filterList:h.emailSendStatus??[],customFilterListOptions:{render:c=>e.jsx(De,{list:c,label:"Email",onDelete:(d,m)=>{d.stopPropagation(),z(d,m,L[3].options.filterList,"emailSendStatus")}}),update:Ae},filterOptions:{names:C,fullWidth:!0,logic:Oe,display:(c,d,m,A)=>e.jsx(We,{label:"Email",filterList:c,onChange:d,index:m,column:A,filterValues:C})}}},{label:"Webhook",name:"webhook",width:200,options:{filter:!1,setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:c=>{const{webhook:d}=E[c];if(!d)return null;const m=Object.entries(d)[0];if(!m)return null;const[A,U]=m,ne=U[0];return e.jsx(S,{sx:{display:"flex",flexDirection:"column",gap:1},children:e.jsxs(S,{className:"webhook-item",sx:{fontSize:12},children:[e.jsx(Se,{maxLength:30,children:A},A),e.jsx(xe,{status:ne.status,updatedAt:ne.sendAt,reason:ne.failedReason,channel:"webhook",onResend:G=>I(G,E[c],"webhook",[A],!1)})]},A)})}}},{label:r("common.createdAt"),name:"createdAt",width:100,options:{filter:!1,customBodyRenderLite:c=>{const{createdAt:d}=E[c];return e.jsx(Nt,{value:d,locale:o,shouldUpdate:!0})}}}],[E,o,h,r]),he=[e.jsx(Ze,{value:h.dateRange,onChange:_},"date-picker"),e.jsx(le,{variant:"contained",size:"small",color:"primary",loading:w,startIcon:e.jsx(qt,{}),onClick:()=>D(),sx:{".MuiButton-startIcon":{mr:"2px"}},style:{marginLeft:8},children:r("common.refresh")},"refresh")];return e.jsx(S,{sx:{overflow:"auto",".MuiTableCell-head":{whiteSpace:"nowrap",fontWeight:"bold"},".MuiTableCell-root":{paddingRight:"8px",whiteSpace:"nowrap"}},children:e.jsx($n,{children:e.jsxs(xt,{theme:j,children:[e.jsx(yt,{className:"receivers-table",locale:o,loading:w,columns:L,data:E,onChange:re,options:de,customButtons:he,components:{TableFilterList:c=>e.jsx(et,{...c,itemComponent:d=>e.jsx(tt,{...d,canDelete:()=>!1})})}}),M.anchorEl&&e.jsx(Ue,{open:!!M.anchorEl,anchorReference:"anchorPosition",anchorPosition:M.position,onClose:ue,anchorOrigin:{vertical:"center",horizontal:"right"},transformOrigin:{vertical:"center",horizontal:"left"},children:e.jsxs(Vn,{children:[e.jsxs(ee,{variant:"body1",component:"div",className:"check-title",children:[F?.channel," Checking"]}),e.jsx(S,{sx:{display:"flex",flexDirection:"column",gap:"4px"},children:Fe(F?.channel).map(c=>{const{type:d,pass:m,fail:A}=c;return!F?.result||F?.result?.[d]?e.jsxs(ee,{variant:"body1",component:"div",className:"check-item",sx:{display:"flex",alignItems:"center",gap:"4px",color:F?.result?.[d]?ke.success.main:"inherit"},children:[F?.result?e.jsx(Mt,{}):e.jsx(ft,{size:12,sx:{color:ke.primary.main}}),e.jsx("span",{children:m})]},d):e.jsxs(ee,{variant:"body1",component:"div",className:"check-item",sx:{display:"flex",alignItems:"center",gap:"4px",color:ke.error.main},children:[e.jsx(Ut,{}),e.jsx("span",{children:A})]},d)})})]})}),P.anchorEl&&e.jsx(Ue,{open:!!P.anchorEl,anchorReference:"anchorPosition",anchorPosition:P.position,onClose:fe,anchorOrigin:{vertical:"center",horizontal:"right"},transformOrigin:{vertical:"center",horizontal:"left"},children:e.jsx(Pt,{loading:n,onCancel:fe,onConfirm:g})})]})})})}const Hn=v.memo(Ft),$n=ie.div`
1
+ import{g as Bt,r as v}from"./vendor-react-CUXIiAnY.js";import{j as e,ak as S,z as X,b6 as me,bg as Ke,y as V,am as ut,d7 as Wt,bn as Kt,at as ie,b1 as mt,W as p,T as ee,U as Je,d8 as pt,b5 as qe,a5 as Me,Q as Pe,d9 as Ge,aN as Ue,a6 as ft,D as ht,ci as qt,ad as xt,da as Mt,db as Ut,c2 as st,n as Ht,J as $t,x as Vt,bc as Jt,M as it,cw as Gt,I as Yt,dc as Qt}from"./vendor-mui-core-BPQ6AEW_.js";import{A as gt,J as Xt,C as Zt,e as oe,F as en,a3 as je}from"./vendor-utils-BgSaqjGx.js";import{V as te,H as q,n as le,p as tn,j as bt,Q as nn,aD as sn,m as jt,$ as vt,h as yt,aE as ke,b as St,z as an,a2 as rn}from"./vendor-ux-r9bApERu.js";import{aK as on,_ as Ye,ac as Ct,aA as wt,K as _e,c as B,a1 as Z,o as ln,aS as at}from"./index-DQt_6j3C.js";import{g as ye,b as $,a as se}from"./vendor-hooks-PN9SWiQm.js";import{u as Rt,C as Y}from"./index.esm-DTmS4tth.js";import{i as He}from"./isURL-BHeH7II4.js";import{S as Q}from"./section-Cyr0YvGa.js";import{A as cn,a as dn,b as un}from"./collapse-CzqKk-Uw.js";import{S as Se}from"./shorten-label-D6jbe4l0.js";import{v as Tt}from"./index-ySP_m_Ux.js";import{R as Nt,A as mn,S as pn,a as fn,B as hn}from"./list-CA3FRf5d.js";import{j as xn,c as gn,N as bn}from"./team-D29LjHNf.js";import{W as jn}from"./did-address-j4poFq12.js";import{p as It}from"./util-CW4LiHT7.js";import{D as vn,g as yn}from"./traffic-DGDO-5_X.js";import{B as Et}from"./bundle-avatar--xYBq9Gb.js";import{u as Sn}from"./use-mobile-ajdJIsoX.js";import"./lottie-web-4koyQiv_.js";import"./vendor-arcblock-D8WYBDYe.js";import"./required-Btg6mEmX.js";import"./server-logo-notext.svg-DHxZ1bRk.js";import"./session-SqadLMEY.js";import"./use-app-logo-D768RYSo.js";import"./base32-eAS52qli.js";import"./useAsyncRetry-LJm0Fhbe.js";import"./useAsync-BCC9JxQR.js";import"./iframe-CKjr768a.js";import"./index-y-XalrLG.js";import"./index-DBs9Ljax.js";import"./base-chart-CcNdwghd.js";import"./index-BnOhhAn2.js";import"./vendor-mui-x-CWNb8fsW.js";import"./AdapterDayjs-DEl3BogQ.js";var Re={exports:{}},Te={exports:{}},Ne={exports:{}},rt;function Cn(){return rt||(rt=1,function(t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.default=n;function n(r){return r==null}t.exports=s.default,t.exports.default=s.default}(Ne,Ne.exports)),Ne.exports}var ot;function wn(){return ot||(ot=1,function(t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.default=f;var n=o(on()),r=o(Cn());function o(u){return u&&u.__esModule?u:{default:u}}var l=/^(?:[-+]?(?:0|[1-9][0-9]*))$/,j=/^[-+]?[0-9]+$/;function f(u,a){(0,n.default)(u),a=a||{};var y=a.allow_leading_zeroes===!1?l:j,R=!a.hasOwnProperty("min")||(0,r.default)(a.min)||u>=a.min,w=!a.hasOwnProperty("max")||(0,r.default)(a.max)||u<=a.max,b=!a.hasOwnProperty("lt")||(0,r.default)(a.lt)||u<a.lt,E=!a.hasOwnProperty("gt")||(0,r.default)(a.gt)||u>a.gt;return y.test(u)&&R&&w&&b&&E}t.exports=s.default,t.exports.default=s.default}(Te,Te.exports)),Te.exports}var lt;function Rn(){return lt||(lt=1,function(t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.default=o;var n=r(wn());function r(l){return l&&l.__esModule?l:{default:l}}function o(l){return(0,n.default)(l,{allow_leading_zeroes:!1,min:0,max:65535})}t.exports=s.default,t.exports.default=s.default}(Re,Re.exports)),Re.exports}var Tn=Rn();const Nn=Bt(Tn),ze={enabled:!1,secure:!1,from:"",host:"",port:"",user:"",password:"",companyName:"",companyLink:"",companyAddress:"",supportEmail:""};function In(){const{api:t}=Ye(),{blocklet:s}=Ct(),{t:n}=te(),{confirmApi:r,confirmHolder:o}=wt(),l=s?.meta?.did,j=Object.assign({...ze},s?.settings?.notification?.email||{}),{handleSubmit:f,control:u,formState:a,watch:y,reset:R}=Rt({defaultValues:gt(j,Object.keys(ze))}),w=ye({testReceiver:"",testReceiverError:""}),b=y("enabled"),E=$(async(i,C,D=!0)=>{try{const{blocklet:O}=await t.configNotification({input:{did:l,notification:JSON.stringify({email:i})}}),ae=Object.assign({...ze},O?.settings?.notification?.email||{});R(ae),D&&q.success(n("oauth.saveSuccess"))}catch(O){if(D)q.error(O.message||n("oauth.saveFailed"));else throw O}}),J=$(async(i,C,D)=>{try{a.isDirty&&await E(i,C,!1),await t.sendEmail({input:{did:l,receiver:D,email:JSON.stringify({body:"Your SMTP configuration is correct!",title:"Test email",type:"notification",attachments:[{type:"link",data:{url:"https://community.arcblock.io",title:"Community",image:"https://community.arcblock.io/.well-known/service/blocklet/logo-rect-dark",utm:{campaign:"test-campaign"}}}],utm:{content:"test-email-button"}})}}),q.success(n("notification.email.testSuccess"))}catch(O){q.error(O.message||n("notification.email.testfailed"))}}),M=$((i,C)=>{w.testReceiver=localStorage.getItem("test-receiver")||"",w.testReceiverError="",r.open({title:n("notification.email.testSendEmail"),content:()=>e.jsx(S,{sx:{width:"300px"},children:e.jsx(X,{sx:{mt:1},fullWidth:!0,name:"testReceiver",label:n("notification.email.inputTestReceiver"),value:w.testReceiver,onChange:D=>{w.testReceiver=D.target.value},error:!!w.testReceiverError,helperText:w.testReceiverError||" "})}),confirmButtonText:n("common.confirm"),cancelButtonText:n("common.cancel"),async onConfirm(D){const O=w.testReceiver?.trim();if(!O){w.testReceiverError=n("notification.email.receiverRequired");return}if(!_e(O)){w.testReceiverError=n("notification.email.receiverInvalid");return}w.testReceiverError="",await J(i,C,O),D()}})}),P=$(i=>{const C=i?.trim();return C?_e(C)?!0:n("notification.email.fromInvalid"):n("notification.email.fromRequired")}),F=$(i=>{const C=i?.trim();return C?He(C,{require_host:!1,protocols:[]})?!0:n("notification.email.hostInvalid"):n("notification.email.hostRequired")}),N=$(i=>i?Nn(i)?!0:n("notification.email.portInvalid"):n("notification.email.portRequired")),W=$(i=>i?.trim()?!0:n("notification.email.userRequired")),K=$(i=>i?.trim()?!0:n("notification.email.passwordRequired")),h=$(i=>i?.trim()&&!He(i,{protocols:["http","https"],require_protocol:!0})?n("notification.email.linkInvalid"):!0),T=$(i=>i?.trim()&&!_e(i)?n("notification.email.emailInvalid"):!0),k=$(()=>!0);return e.jsxs(S,{children:[e.jsxs(En,{component:"form",onSubmit:f(E),disabled:!0,sx:{".section-left":{width:"160px"}},children:[e.jsx(Q,{title:n("notification.email.enable"),my:2.5,children:e.jsx(Y,{name:"enabled",control:u,render:({field:i})=>e.jsx(me,{control:e.jsx(Ke,{checked:i.value,...i})})})}),e.jsx(Q,{title:n("notification.email.from"),children:e.jsx(Y,{name:"from",control:u,rules:{validate:b?P:k},render:({field:i})=>e.jsx(V,{fullWidth:!0,children:e.jsx(X,{...i,size:"small",required:!0,label:n("notification.email.from"),error:!!a.errors[i.name],helperText:a.errors[i.name]?.message||" ",disabled:!b})})})}),e.jsx(Q,{title:n("notification.email.host"),children:e.jsx(Y,{name:"host",control:u,rules:{validate:b?F:k},render:({field:i})=>e.jsx(V,{fullWidth:!0,children:e.jsx(X,{...i,size:"small",required:!0,error:!!a.errors[i.name],label:n("notification.email.host"),helperText:a.errors[i.name]?.message||" ",disabled:!b})})})}),e.jsx(Q,{title:n("notification.email.port"),children:e.jsx(Y,{name:"port",control:u,rules:{validate:b?N:k},render:({field:i})=>e.jsx(V,{fullWidth:!0,children:e.jsx(X,{...i,size:"small",required:!0,type:"number",error:!!a.errors[i.name],label:n("notification.email.port"),helperText:a.errors[i.name]?.message||" ",disabled:!b})})})}),e.jsx(Q,{title:n("notification.email.user"),children:e.jsx(Y,{name:"user",control:u,rules:{validate:b?W:k},render:({field:i})=>e.jsx(V,{fullWidth:!0,children:e.jsx(X,{...i,size:"small",required:!0,error:!!a.errors[i.name],label:n("notification.email.user"),helperText:a.errors[i.name]?.message||" ",disabled:!b})})})}),e.jsx(Q,{title:n("notification.email.password"),children:e.jsx(Y,{name:"password",control:u,rules:{validate:b?K:k},render:({field:i})=>e.jsx(V,{fullWidth:!0,children:e.jsx(X,{...i,size:"small",required:!0,type:"password",error:!!a.errors[i.name],label:n("notification.email.password"),helperText:a.errors[i.name]?.message||" ",disabled:!b})})})}),e.jsx(Q,{title:n("notification.email.secure"),children:e.jsx(Y,{name:"secure",control:u,rules:{validate:k},render:({field:i})=>e.jsx(V,{fullWidth:!0,children:e.jsx(me,{control:e.jsx(Ke,{checked:i.value,...i,disabled:!b})})})})}),e.jsxs(cn,{children:[e.jsxs(dn,{expandIcon:e.jsx(Kt,{fontSize:"small"}),"aria-controls":"panel1-content",id:"panel1-header",children:[n("notification.email.signature"),e.jsx(ut,{title:n("notification.email.signatureTooltip"),children:e.jsx(Wt,{fontSize:"small",sx:{ml:1,cursor:"help"}})})]}),e.jsxs(un,{children:[e.jsx(Q,{title:n("notification.email.companyName"),children:e.jsx(Y,{name:"companyName",control:u,rules:{validate:k},render:({field:i})=>e.jsx(V,{fullWidth:!0,children:e.jsx(X,{...i,size:"small",error:!!a.errors[i.name],label:n("notification.email.companyName"),helperText:a.errors[i.name]?.message||" ",disabled:!b})})})}),e.jsx(Q,{title:n("notification.email.companyLink"),children:e.jsx(Y,{name:"companyLink",control:u,rules:{validate:b?h:k},render:({field:i})=>e.jsx(V,{fullWidth:!0,children:e.jsx(X,{...i,size:"small",error:!!a.errors[i.name],label:n("notification.email.companyLink"),helperText:a.errors[i.name]?.message||" ",disabled:!b})})})}),e.jsx(Q,{title:n("notification.email.companyAddress"),children:e.jsx(Y,{name:"companyAddress",control:u,rules:{validate:k},render:({field:i})=>e.jsx(V,{fullWidth:!0,children:e.jsx(X,{...i,size:"small",error:!!a.errors[i.name],label:n("notification.email.companyAddress"),helperText:a.errors[i.name]?.message||" ",disabled:!b})})})}),e.jsx(Q,{title:n("notification.email.supportEmail"),children:e.jsx(Y,{name:"supportEmail",control:u,rules:{validate:b?T:k},render:({field:i})=>e.jsx(V,{fullWidth:!0,children:e.jsx(X,{...i,size:"small",type:"email",error:!!a.errors[i.name],label:n("notification.email.supportEmail"),helperText:a.errors[i.name]?.message||" ",disabled:!b})})})})]})]}),e.jsxs(S,{sx:{display:"flex",justifyContent:"flex-end",gap:2,mt:3},children:[e.jsx(le,{variant:"outlined",color:"warning",onClick:f(M),disabled:!b,children:n("oauth.runTest")}),e.jsx(le,{type:"submit",variant:"contained",disabled:!a.isDirty,children:n("oauth.save")})]})]}),o]})}const En=ie(mt)``,Be={enabled:!1,endpoint:"",did:void 0,pushPath:void 0};function kn(){const{api:t}=Ye(),{blocklet:s}=Ct(),{t:n}=te(),{confirmApi:r,confirmHolder:o}=wt(),l=s?.meta?.did,j=Object.assign({...Be},s?.settings?.notification?.pushKit||{}),{handleSubmit:f,control:u,formState:a,watch:y,reset:R}=Rt({defaultValues:gt(j,Object.keys(Be))}),w=ye({testReceiver:"",testReceiverError:""}),b=y("enabled"),E=$(async(N,W,K=!0)=>{try{const{blocklet:h}=await t.configNotification({input:{did:l,notification:JSON.stringify({pushKit:N})}}),T=Object.assign({...Be},h?.settings?.notification?.pushKit||{});R(T),K&&q.success(n("oauth.saveSuccess"))}catch(h){if(K)q.error(h.message||n("oauth.saveFailed"));else throw h}}),J=$(async(N,W)=>{try{a.isDirty&&await E(N,W,!1);const K=(s?.configs||[]).find(k=>k.key==="BLOCKLET_APP_URL")?.value,h=Xt(Zt(K,B.WELLKNOWN_SERVICE_PATH_PREFIX,"/blocklet/logo"),{v:s?.meta?.version,t:new Date(s?.updatedAt||0).getTime()}),T={type:"passthrough",passthroughType:"messageStatus",data:{message:{title:"Test push-kit notification",body:"This is message from push-kit config test",sender:{did:s?.appDid,fullName:s?.meta?.title,avatar:h}}}};await t.sendPush({input:{did:l,receiver:w.testReceiver,notification:JSON.stringify(T)}}),q.success(n("notification.pushKit.testSuccess"))}catch(K){q.error(K.message||n("notification.pushKit.testfailed"))}}),M=$((N,W)=>{w.testReceiverError="",r.open({title:n("notification.pushKit.testSend"),content:()=>e.jsx(S,{sx:{width:"450px",maxWidth:"100%"},children:e.jsx(X,{sx:{mt:1},fullWidth:!0,name:"testReceiver",label:n("notification.pushKit.inputTestReceiver"),value:w.testReceiver,onChange:K=>{w.testReceiver=K.target.value},error:!!w.testReceiverError,helperText:w.testReceiverError||" "})}),confirmButtonText:n("common.confirm"),cancelButtonText:n("common.cancel"),async onConfirm(K){if(!w.testReceiver?.trim()){w.testReceiverError=n("notification.pushKit.receiverRequired");return}w.testReceiverError="",await J(N,W),K()}})}),P=$(N=>{const W=N?.trim();return W?He(W)?!0:n("notification.pushKit.endpointInvalid"):n("notification.pushKit.endpointRequired")}),F=$(()=>!0);return e.jsxs(S,{children:[e.jsxs(An,{component:"form",onSubmit:f(E),disabled:!0,sx:{".section-left":{width:"160px"}},children:[e.jsx(Q,{title:n("notification.pushKit.enable"),my:2.5,children:e.jsx(Y,{name:"enabled",control:u,render:({field:N})=>e.jsx(me,{control:e.jsx(Ke,{checked:N.value,...N})})})}),e.jsx(Q,{title:n("notification.pushKit.endpoint"),children:e.jsx(Y,{name:"endpoint",control:u,rules:{validate:b?P:F},render:({field:N})=>e.jsx(V,{fullWidth:!0,children:e.jsx(X,{...N,size:"small",required:!0,label:n("notification.pushKit.endpoint"),error:!!a.errors[N.name],helperText:a.errors[N.name]?.message||" ",disabled:!b})})})}),e.jsxs(Q,{title:n("notification.pushKit.customOptions"),children:[e.jsx(Y,{name:"did",control:u,render:({field:N})=>e.jsx(V,{fullWidth:!0,children:e.jsx(X,{...N,size:"small",label:n("notification.pushKit.did"),error:!!a.errors[N.name],helperText:a.errors[N.name]?.message||" ",disabled:!b})})}),e.jsx(Y,{name:"pushPath",control:u,render:({field:N})=>e.jsx(V,{fullWidth:!0,children:e.jsx(X,{...N,size:"small",label:n("notification.pushKit.pushPath"),error:!!a.errors[N.name],helperText:a.errors[N.name]?.message||" ",disabled:!b})})})]}),e.jsxs(S,{sx:{display:"flex",justifyContent:"flex-end",gap:2,mt:3},children:[e.jsx(le,{variant:"outlined",color:"warning",onClick:f(M),disabled:!b,children:n("oauth.runTest")}),e.jsx(le,{type:"submit",variant:"contained",disabled:!a.isDirty,children:n("oauth.save")})]})]}),o]})}const An=ie(mt)``,ct=[{label:e.jsx(S,{sx:{textAlign:"center",width:"100%"},children:"Email"}),value:"email"},{label:e.jsx(S,{sx:{textAlign:"center",width:"100%"},children:"Push Kit"}),value:"pushKit"}];function On(){const[t,s]=v.useState(ct[0].value),{locale:n}=v.useContext(tn),r=se(()=>({email:e.jsx(In,{}),pushKit:e.jsx(kn,{})}),[n]),o=v.useMemo(()=>({padding:"10px 0"}),[]);return e.jsxs(S,{children:[e.jsx(bt,{tabs:ct,current:t,onChange:s}),e.jsx(S,{style:o,children:r[t]})]})}const kt=v.createContext({}),{Provider:Dn,Consumer:Bs}=kt;function Ln({children:t,blocklet:s=""}){const{api:n,inService:r,ws:{useSubscription:o}}=Ye(),[l,j]=v.useState([]),[f,u]=v.useState({total:0,pageSize:20,pageCount:0,page:1}),a=se(()=>s.meta?.did,[s]),[y,R]=v.useState([]),[w,b]=v.useState({}),E=se(()=>l.length?new Set(l.map(h=>h.id)):new Set,[l]),J=async({page:h=1,pageSize:T=20,...k}={})=>{if(!a)return[];try{const i={paging:{page:h,pageSize:T},...k,teamDid:a,dateRange:k.dateRange?[Z(k.dateRange[0]).toISOString(),Z(k.dateRange[1]).toISOString()]:void 0},{dids:C,...D}=i;let O="";C&&C.includes("system")&&(O="system");const ae=C?C.filter(pe=>pe!=="system"):[],de={...D,source:O,componentDids:ae},re=await n.getNotificationSendLog({input:de});return b(de),j(re.list),u(re.paging),re.list}catch(i){return q.error(i.message),[]}},M=async()=>{const h=await n.getNotificationComponents({input:{teamDid:a}});R(h.componentDids)},P=v.useCallback(h=>{const T=s.children.find(k=>k.meta?.did===h);if(T)return T.ancestors=[s],T},[s]),F=async({notificationId:h,receivers:T,channels:k,...i})=>{await n.resendNotification({input:{teamDid:a,notificationId:h,receivers:T,channels:k.map(C=>C==="wallet"?B.NOTIFICATION_SEND_CHANNEL.WALLET:C==="pushKit"?B.NOTIFICATION_SEND_CHANNEL.PUSH:C),...i}})},N=v.useCallback(async h=>(await n.getUser({input:{teamDid:a,user:{did:h},options:{enableConnectedAccount:!0}}})).user,[n,a]),W=v.useCallback(async({page:h=1,pageSize:T=20,...k}={})=>{try{const i={paging:{page:h,pageSize:T},...k,userName:k.searchText||"",teamDid:a,dateRange:k.dateRange?[Z(k.dateRange[0]).toISOString(),Z(k.dateRange[1]).toISOString()]:void 0};return await n.getReceivers({input:i})}catch(i){throw q.error(i.message),i}},[n,a]);v.useEffect(()=>{a&&M()},[a]),o(B.EVENTS.NOTIFICATION_BLOCKLET_UPDATE,h=>{E.has(h.notificationId)&&J(w)},[E,w]),o(B.EVENTS.NOTIFICATION_BLOCKLET_CREATE,h=>{E.has(h.id)||J(w)},[E,w]);const K={fetch:J,data:l,paging:f,blocklet:s,getComponent:P,resendNotification:F,getUser:N,componentDids:y,getReceivers:W,inService:r,teamDid:a};return e.jsx(Dn,{value:{notificationRecords:K},children:t})}function Qe(){const{notificationRecords:t}=v.useContext(kt);return t}Ce.propTypes={severity:p.oneOf(Object.values(["info","success","error","warning"])).isRequired};const Pn={info:"primary",success:"success",error:"error",warning:"warning"};function Ce({severity:t="info"}){return e.jsx(nn,{type:Pn[t],children:t})}const Fn=(t,s,n="")=>{if(!n||!s)return"";switch(n){case B.NOTIFICATION_SEND_FAILED_REASON.USER_DISABLED:return t("notification.sendStatus.reason.disabled",{channel:s});case B.NOTIFICATION_SEND_FAILED_REASON.CHANNEL_UNAVAILABLE:return t("notification.sendStatus.reason.unavailable",{channel:s});case B.NOTIFICATION_SEND_FAILED_REASON.CHANNEL_DISABLED:return t("notification.sendStatus.reason.notSent",{channel:s});case B.NOTIFICATION_SEND_FAILED_REASON.NOT_ONLINE:return t("notification.sendStatus.reason.offline");default:return n}};function At(t,s,n={}){const{status:r,updatedAt:o,reason:l="",channel:j="wallet"}=n,f=o?t("notification.sendStatus.sentTime",{date:ln(o,s)}):"",u=Fn(t,j,l);return r===B.NOTIFICATION_SEND_STATUS.FAILED?{status:"failed",title:t("notification.sendStatus.failed"),sentTime:f,reason:u}:r===B.NOTIFICATION_SEND_STATUS.SENT?{status:"success",title:t("notification.sendStatus.success"),sentTime:f}:{status:"pending",title:t("notification.sendStatus.pending"),reason:u,sentTime:f}}const $e={pending:"#aaaaaa",success:"#34BE74",failed:"#D0021B"},Ve=["wallet","pushKit","email"],dt=["info","success","error","warning"],Ot=t=>{const{settings:s}=t;return s?.notification?.email?.enabled},Dt=t=>{const{settings:s}=t;return s?.notification?.pushKit?.enabled},_n=(t,s)=>{const n=oe(s,"extra.notifications.email",!0);return{available:Ot(t),enabled:n}},zn=(t,s)=>{const n=oe(s,"extra.notifications.push",!0);return{available:Dt(t),enabled:n}},Bn=t=>({enabled:oe(t,"extra.notifications.wallet",!0)}),Wn=t=>({enabled:oe(t,"extra.webhooks",[]).length>0}),Ie=(t=3)=>new Promise(s=>{setTimeout(()=>{s()},t*1e3)}),Kn=(t,s)=>s==="wallet"||s==="webhook"?[{channel:s,type:"enabled",pass:t("notification.sendStatus.reason.enabled",{channel:s}),fail:t("notification.sendStatus.reason.disabled",{channel:s})}]:s==="pushKit"||s==="email"?[{channel:s,type:"available",pass:t("notification.sendStatus.reason.available",{channel:s}),fail:t("notification.sendStatus.reason.unavailable",{channel:s})},{channel:s,type:"enabled",pass:t("notification.sendStatus.reason.enabled",{channel:s}),fail:t("notification.sendStatus.reason.disabled",{channel:s})}]:[],Ee=(t=[])=>{const s=Z().startOf("day");return t.filter(n=>Z(n.sendAt).isSame(s,"day")).length},qn=(t,s="")=>{if(s&&Ve.includes(s)){const l=`${s}SendRecord`,j=oe(t,l,[]);return Ee(j)}const n=oe(t,"webhook",{}),r=Object.keys(n??{})??[];if(s&&r.includes(s)){const l=n[s]??[];return Ee(l)}const o={};return Ve.forEach(l=>{const j=`${l}SendRecord`,f=oe(t,j,[]),u=Ee(f);o[l]=u}),r.length>0&&r.forEach(l=>{const j=n[l]??[],f=Ee(j);o[l]=f}),o},Ae=(t,s,n)=>{if(!Array.isArray(t))throw new Error("Invalid filterList or index");return t[n].splice(s,1),t},Oe=(t,s)=>{if(!Array.isArray(s))throw new Error("filters must be an array");return s.length?!s.includes(t):!1},Mn=t=>{switch(t){case B.NOTIFICATION_SEND_CHANNEL.WALLET:return"Wallet";case B.NOTIFICATION_SEND_CHANNEL.PUSH:return"Push Kit";case B.NOTIFICATION_SEND_CHANNEL.EMAIL:return"Email";case B.NOTIFICATION_SEND_CHANNEL.WEBHOOK:return"Webhook";default:return""}},Lt=()=>({components:{MUIDataTableFilter:{styleOverrides:{header:{marginBottom:0,p:{margin:0}},root:{"& .MuiGrid-container":{marginTop:0,"& .MuiGrid-item":{paddingTop:0}}}}},MuiPopover:{styleOverrides:{root:{"&.MuiPopover-root":{"& .MuiPaper-root:has(.filter-container)":{width:"420px"}}}}}}});function ce({config:t,enableTooltip:s=!0,showTitle:n=!1,children:r=null}){const{status:o,title:l="",sentTime:j="",reason:f=""}=t,u=[l,f].filter(Boolean).join(", ");return e.jsx(ut,{title:s?e.jsxs(e.Fragment,{children:[e.jsx(ee,{color:"inherit",sx:{fontSize:12},children:u}),e.jsx("span",{children:j})]}):null,arrow:!0,placement:"top",children:e.jsxs(S,{sx:{display:"flex",flexDirection:"row",alignItems:"center",gap:"4px"},children:[e.jsxs(S,{sx:{position:"relative",minHeight:14,minWidth:14,display:"flex",alignItems:"center",justifyContent:"center"},children:[e.jsx(S,{style:{opacity:.15},sx:{position:"absolute",width:"100%",height:"100%",borderRadius:"50%",bgcolor:$e[o]}}),e.jsx(S,{sx:{position:"absolute",width:"55%",height:"55%",borderRadius:"50%",bgcolor:$e[o]}})]}),e.jsx(ee,{color:"inherit",sx:{fontSize:12},children:n?l:r})]})})}ce.propTypes={config:p.object.isRequired,enableTooltip:p.bool,showTitle:p.bool,children:p.node};De.propTypes={list:p.array.isRequired,label:p.string.isRequired,onDelete:p.func};function De({list:t,label:s,onDelete:n=()=>{}}){const{t:r,locale:o}=te();return e.jsxs(S,{sx:{display:"flex",gap:1,alignItems:"center"},children:[e.jsxs(ee,{children:[s,": "]}),t.map(l=>{const j=At(r,o,{status:l});return e.jsx(Je,{size:"small",label:e.jsx(S,{sx:{display:"flex",alignItems:"center",gap:"4px"},children:e.jsx(ce,{config:j,enableTooltip:!1,children:j.title})}),onDelete:f=>n(f,l)},l)})]})}Xe.propTypes={filterList:p.array.isRequired,onChange:p.func.isRequired,index:p.number.isRequired,column:p.object.isRequired,filterValues:p.array.isRequired,label:p.string.isRequired,renderLabel:p.func.isRequired};function Xe({filterList:t,onChange:s,index:n,column:r,filterValues:o,label:l,renderLabel:j}){return e.jsxs(V,{className:"filter-container",children:[e.jsx(pt,{component:"legend",children:l}),e.jsx(qe,{row:!0,children:o.map(f=>e.jsx(me,{control:e.jsx(Me,{checked:t[n].indexOf(f.value??f)>-1,onChange:u=>{const a=[...t];u.target.checked?a[n]=[...a[n],f.value??f]:a[n]=a[n].filter(y=>y!==(f.value??f)),s(a[n],n,r)},name:f.value??f}),label:e.jsx("span",{style:{display:"flex",alignItems:"center"},children:j(f)})},f.value??f))})]})}function We(t){return e.jsx(Xe,{...t,renderLabel:s=>e.jsx(ce,{enableTooltip:!1,config:{status:s.status},children:s.label})})}xe.propTypes={status:p.number.isRequired,updatedAt:p.string.isRequired,reason:p.string,channel:p.string,onResend:p.func};function xe({status:t,updatedAt:s,reason:n="",channel:r="wallet",onResend:o}){const{t:l,locale:j}=te(),f=At(l,j,{status:t,updatedAt:s,reason:n,channel:r});return e.jsxs(S,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(ce,{config:f,showTitle:!0}),f.status!=="success"&&e.jsx(Pe,{className:"resend-btn",size:"small",startIcon:e.jsx(Ge,{}),sx:{fontSize:12,color:"rgba(0, 0, 0, 0.87)",fontWeight:400,".MuiButton-startIcon":{mr:"2px"}},onClick:o,children:l("notification.resend")})]})}Ze.propTypes={value:p.array.isRequired,onChange:p.func};function Ze({value:t,onChange:s}){const{locale:n}=te(),r=Z().toDate(),[o,l]=v.useState(null),j=v.useCallback(a=>{l(o?null:a.currentTarget)},[o]),f=!!o,u=v.useCallback(a=>{if(!a.startDate||!a.endDate){q.error("Please select a date range");return}if(Z(a.startDate).isAfter(a.endDate)||!Z(a.startDate).isValid()||!Z(a.endDate).isValid()){q.error("Invalid date range");return}s([a.startDate,a.endDate]),l(null)},[s]);return e.jsxs("div",{children:[e.jsx(ee,{component:"div",variant:"h5",color:"textPrimary",style:{fontSize:18,fontWeight:"bold"},sx:{mb:0},children:e.jsxs(Pe,{onClick:j,variant:"outlined",size:"small",color:"inherit",children:[at(t[0],n)," - ",at(t[1],n)]})}),e.jsx(Ue,{open:f,anchorEl:o,onClose:()=>{l(null)},anchorOrigin:{vertical:"bottom",horizontal:"left"},children:e.jsx(vn,{open:!0,maxDate:r,initialDateRange:{startDate:t[0],endDate:t[1]},toggle:j,definedRanges:yn(r),onChange:u})})]})}et.propTypes={itemComponent:p.elementType.isRequired};function et({itemComponent:t,...s}){const{t:n}=te();return!s?.filterList?.filter(o=>o.length).length?null:e.jsxs(S,{sx:{display:"flex",gap:1,alignItems:"center"},children:[e.jsx("div",{className:"toolbar-filter-title",children:n("notification.filter")}),e.jsx("div",{className:"toolbar-filter-content",children:e.jsx(sn.TableFilterList,{...s,ItemComponent:t})})]})}function tt({label:t,onDelete:s,canDelete:n=()=>!0,...r}){const o=s&&typeof s=="function"?s:void 0;let l=!0;return n&&typeof n=="function"&&(l=n({label:t,...r})),e.jsx(Je,{label:t,variant:"outlined",...o&&l?{onDelete:o}:{}})}tt.propTypes={label:p.string.isRequired,onDelete:p.func,canDelete:p.func};const Un=[{label:"Wallet",value:"app",checked:!0},{label:"Email",value:"email",checked:!0},{label:"Push Kit",value:"push",checked:!0},{label:"Webhook",value:"webhook",checked:!0}];Pt.propTypes={loading:p.bool,onCancel:p.func,onConfirm:p.func};function Pt({loading:t=!1,onCancel:s=()=>{},onConfirm:n=()=>{}}){const{t:r}=te(),[o,l]=v.useState(Un),[j,f]=v.useState(!0),u=(y,R)=>{R.checked=y.target.checked;const w=o.map(b=>({...b,checked:b.value===R.value?R.checked:b.checked}));l(w)},a=y=>{y.stopPropagation(),n({channels:o.filter(R=>R.checked).map(R=>R.value),isResendFailedOnly:j})};return e.jsxs(S,{className:"resend-config",sx:{padding:"16px 24px"},children:[e.jsx(ee,{variant:"body1",component:"div",className:"check-title",sx:{fontWeight:700,mb:1},children:r("notification.config")}),e.jsx(S,{className:"choose-channel",children:e.jsxs(V,{component:"fieldset",variant:"standard",children:[e.jsx(pt,{component:"legend",children:r("notification.selectChannels")}),e.jsx(qe,{sx:{display:"flex",flexDirection:"row",flexWrap:"wrap",gap:1},children:o.map(y=>e.jsx(me,{control:e.jsx(Me,{checked:y.checked,onChange:R=>u(R,y),name:y.value}),label:y.label},y.value))})]})}),e.jsx(S,{className:"resend-config-footer",children:e.jsx(qe,{children:e.jsx(me,{control:e.jsx(Me,{checked:j,onChange:y=>f(y.target.checked)}),label:r("notification.resendFailedOnly")})})}),e.jsxs(S,{className:"resend-config-footer-tip",sx:{display:"flex",justifyContent:"flex-end",gap:1},children:[e.jsx(Pe,{onClick:y=>{y.stopPropagation(),s()},color:"inherit",children:r("common.cancel")}),e.jsxs(Pe,{onClick:a,color:"primary",disabled:t,variant:"contained",autoFocus:!0,style:{marginLeft:8},children:[t&&e.jsx(ft,{size:16}),r("common.confirm")]})]})]})}Ft.propTypes={notificationId:p.string.isRequired,handleResend:p.func,resending:p.bool};function Ft({notificationId:t,handleResend:s,resending:n=!1}){const{t:r,locale:o}=te(),l=ht(),j=v.useMemo(()=>jt(l,Lt()),[l]),{getReceivers:f,inService:u,teamDid:a,getUser:y,blocklet:R}=Qe(),[w,b]=v.useState(!1),[E,J]=v.useState([]),M=ye({anchorEl:null,position:null}),P=ye({anchorEl:null,position:null}),[F,N]=v.useState(null),[W,K]=v.useState({total:0,pageSize:10,pageCount:0,page:1}),[h,T]=v.useState({searchText:"",page:1,pageSize:10,walletSendStatus:[],pushKitSendStatus:[],emailSendStatus:[],dateRange:[Z().subtract(1,"month").startOf("day").toDate(),Z().endOf("day").toDate()]}),[k,i]=v.useState([]),C=[{label:r("notification.sendStatus.pending"),value:0,status:"pending"},{label:r("notification.sendStatus.success"),value:1,status:"success"},{label:r("notification.sendStatus.failed"),value:2,status:"failed"}],D=async()=>{if(!w&&t)try{b(!0);const c=await f({notificationId:t,...h}),d=c.list.map(m=>({...m,receiverUser:{...m.receiverUser,avatar:It(m.receiverUser.avatar,a,u)}}));J(d),K(c.paging),b(!1)}catch(c){q.error(c.message),b(!1)}};v.useEffect(()=>{D()},[h]);const O=c=>{c.stopPropagation();const d=c.currentTarget;P.anchorEl=d;const m=d.getBoundingClientRect();P.position={top:m.top+window.scrollY,left:m.left+window.scrollX}},ae=c=>c.data.length?e.jsx("div",{style:{display:"flex",alignItems:"center",padding:"10px"},children:e.jsx(le,{className:"resend-btn",size:"small",color:"primary",variant:"contained",startIcon:e.jsx(Ge,{}),sx:{".MuiButton-startIcon":{mr:"2px"}},onClick:O,children:r("notification.resend")})}):null,de={sort:!1,download:!1,print:!1,selectableRows:"multiple",searchPlaceholder:r("common.search"),searchAlwaysOpen:!1,filterType:"checkbox",searchDebounceTime:300,page:W.page-1,rowsPerPage:W.pageSize,count:W.total,searchText:h.searchText,tableBodyMaxHeight:"calc(80vh - 260px)",rowsSelected:k,onRowSelectionChange:(c,d)=>{i(d.map(m=>m.dataIndex))},customToolbarSelect:ae},re=({page:c,rowsPerPage:d,searchText:m,filterList:A})=>{const[,U=[],ne=[],G=[]]=A;h.pageSize!==d?T(H=>({...H,pageSize:d,page:1})):h.page!==c+1?T(H=>({...H,page:c+1})):h.searchText!==m?T(H=>({...H,searchText:m,page:1})):je(U,h.walletSendStatus)?je(ne,h.pushKitSendStatus)?je(G,h.emailSendStatus)||T(H=>({...H,emailSendStatus:G,page:1})):T(H=>({...H,pushKitSendStatus:ne,page:1})):T(H=>({...H,walletSendStatus:U,page:1}))},pe=v.useCallback(async(c,d)=>{if(!d)return!1;const m=await y(d);return m?c==="wallet"?Bn(m):c==="email"?_n(R,m):c==="pushKit"?zn(R,m):c==="webhook"?Wn(m):!0:!1},[y,R]),Fe=v.useCallback(c=>Kn(r,c),[r]),ue=()=>{M.anchorEl=null,M.position=null,N(null)},fe=()=>{P.anchorEl=null,P.position=null},we=async(c,d,m=!0,A="")=>{if(!(!d.length||!c.length))try{s(c,d,m,A),P.anchorEl||(await Ie(.5),ue())}catch(U){console.error("handleResend error",{error:U})}},g=async({channels:c,isResendFailedOnly:d})=>{const m=k.map(A=>E[A].receiver);await we(c,m,d),await Ie(.5),fe(),i([])},x=async(c,d=[],m=!0)=>{try{await we(["webhook"],[c.receiver],m,d)}catch(A){q.error(A.response?A.response.statusText:A.message)}},I=async(c,d,m,A=[],U=!0)=>{if(c.stopPropagation(),qn(d,m)>=4){q.warning(r("notification.resendLimit"));return}if(!Ve.includes(m)){await x(d,A,U);return}if(c){const G=c.currentTarget,H=G.getBoundingClientRect();M.anchorEl=G,M.position={top:H.top+window.scrollY,left:H.left+window.scrollX}}N({channel:m});try{const G=await pe(m,d.receiver);await Ie(1),N({channel:m,result:G}),(typeof G=="boolean"&&G||en(G)&&Object.values(G).every(H=>!!H))&&(await s([m],[d.receiver],U),P.anchorEl||(await Ie(.5),ue()))}catch(G){q.error(G.message)}},_=c=>{T(d=>({...d,dateRange:c,page:1}))},z=(c,d,m,A)=>{c.stopPropagation();const U=m.filter(ne=>ne!==d);T(ne=>({...ne,[A]:U,page:1}))},L=se(()=>[{label:r("notification.receiver"),name:"receiver",width:200,options:{filter:!1,customBodyRenderLite:c=>{const{receiverUser:d,receiver:m}=E[c];return d?e.jsxs(S,{"data-cy":`member-name-${d.fullName}`,sx:{display:"flex",alignItems:"center",gap:1,justifyContent:"flex-start"},children:[e.jsx(vt,{src:`${d.avatar}?imageFilter=resize&w=48&h=48`,size:32,did:m,shape:"circle",style:{borderRadius:"100%",overflow:"hidden"}}),e.jsx(Se,{children:d.fullName})]},m):e.jsx(jn,{size:14,responsive:!1,compact:!0,copyable:!1,did:m})}}},{label:"Wallet",name:"walletSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),filter:!0,filterType:"custom",filterList:h.walletSendStatus??[],customFilterListOptions:{render:c=>e.jsx(De,{list:c,label:"Wallet",onDelete:(d,m)=>{d.stopPropagation(),z(d,m,L[1].options.filterList,"walletSendStatus")}}),update:Ae},filterOptions:{names:C,fullWidth:!0,logic:Oe,display:(c,d,m,A)=>e.jsx(We,{label:"Wallet",filterList:c,onChange:d,index:m,column:A,filterValues:C})},customBodyRenderLite:c=>{const{walletSendStatus:d,walletSendAt:m,walletSendFailedReason:A}=E[c];return e.jsx(xe,{status:d,updatedAt:m,reason:A,channel:"wallet",onResend:U=>I(U,E[c],"wallet",[],!1)})}}},{label:"Push Kit",name:"pushKitSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:c=>{const{pushKitSendStatus:d,pushKitSendAt:m,pushKitSendFailedReason:A}=E[c];return e.jsx(xe,{status:d,updatedAt:m,reason:A,channel:"pushkit",onResend:U=>I(U,E[c],"pushKit",[],!1)})},filter:!0,filterType:"custom",filterList:h.pushKitSendStatus??[],customFilterListOptions:{render:c=>e.jsx(De,{list:c,label:"Push Kit",onDelete:(d,m)=>{d.stopPropagation(),z(d,m,L[2].options.filterList,"pushKitSendStatus")}}),update:Ae},filterOptions:{names:C,fullWidth:!0,logic:Oe,display:(c,d,m,A)=>e.jsx(We,{label:"Push Kit",filterList:c,onChange:d,index:m,column:A,filterValues:C})}}},{label:"Email",name:"emailSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:c=>{const{emailSendStatus:d,emailSendAt:m,emailSendFailedReason:A}=E[c];return e.jsx(xe,{status:d,updatedAt:m,reason:A,channel:"email",onResend:U=>I(U,E[c],"email",[],!1)})},filter:!0,filterType:"custom",filterList:h.emailSendStatus??[],customFilterListOptions:{render:c=>e.jsx(De,{list:c,label:"Email",onDelete:(d,m)=>{d.stopPropagation(),z(d,m,L[3].options.filterList,"emailSendStatus")}}),update:Ae},filterOptions:{names:C,fullWidth:!0,logic:Oe,display:(c,d,m,A)=>e.jsx(We,{label:"Email",filterList:c,onChange:d,index:m,column:A,filterValues:C})}}},{label:"Webhook",name:"webhook",width:200,options:{filter:!1,setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:c=>{const{webhook:d}=E[c];if(!d)return null;const m=Object.entries(d)[0];if(!m)return null;const[A,U]=m,ne=U[0];return e.jsx(S,{sx:{display:"flex",flexDirection:"column",gap:1},children:e.jsxs(S,{className:"webhook-item",sx:{fontSize:12},children:[e.jsx(Se,{maxLength:30,children:A},A),e.jsx(xe,{status:ne.status,updatedAt:ne.sendAt,reason:ne.failedReason,channel:"webhook",onResend:G=>I(G,E[c],"webhook",[A],!1)})]},A)})}}},{label:r("common.createdAt"),name:"createdAt",width:100,options:{filter:!1,customBodyRenderLite:c=>{const{createdAt:d}=E[c];return e.jsx(Nt,{value:d,locale:o,shouldUpdate:!0})}}}],[E,o,h,r]),he=[e.jsx(Ze,{value:h.dateRange,onChange:_},"date-picker"),e.jsx(le,{variant:"contained",size:"small",color:"primary",loading:w,startIcon:e.jsx(qt,{}),onClick:()=>D(),sx:{".MuiButton-startIcon":{mr:"2px"}},style:{marginLeft:8},children:r("common.refresh")},"refresh")];return e.jsx(S,{sx:{overflow:"auto",".MuiTableCell-head":{whiteSpace:"nowrap",fontWeight:"bold"},".MuiTableCell-root":{paddingRight:"8px",whiteSpace:"nowrap"}},children:e.jsx($n,{children:e.jsxs(xt,{theme:j,children:[e.jsx(yt,{className:"receivers-table",locale:o,loading:w,columns:L,data:E,onChange:re,options:de,customButtons:he,components:{TableFilterList:c=>e.jsx(et,{...c,itemComponent:d=>e.jsx(tt,{...d,canDelete:()=>!1})})}}),M.anchorEl&&e.jsx(Ue,{open:!!M.anchorEl,anchorReference:"anchorPosition",anchorPosition:M.position,onClose:ue,anchorOrigin:{vertical:"center",horizontal:"right"},transformOrigin:{vertical:"center",horizontal:"left"},children:e.jsxs(Vn,{children:[e.jsxs(ee,{variant:"body1",component:"div",className:"check-title",children:[F?.channel," Checking"]}),e.jsx(S,{sx:{display:"flex",flexDirection:"column",gap:"4px"},children:Fe(F?.channel).map(c=>{const{type:d,pass:m,fail:A}=c;return!F?.result||F?.result?.[d]?e.jsxs(ee,{variant:"body1",component:"div",className:"check-item",sx:{display:"flex",alignItems:"center",gap:"4px",color:F?.result?.[d]?ke.success.main:"inherit"},children:[F?.result?e.jsx(Mt,{}):e.jsx(ft,{size:12,sx:{color:ke.primary.main}}),e.jsx("span",{children:m})]},d):e.jsxs(ee,{variant:"body1",component:"div",className:"check-item",sx:{display:"flex",alignItems:"center",gap:"4px",color:ke.error.main},children:[e.jsx(Ut,{}),e.jsx("span",{children:A})]},d)})})]})}),P.anchorEl&&e.jsx(Ue,{open:!!P.anchorEl,anchorReference:"anchorPosition",anchorPosition:P.position,onClose:fe,anchorOrigin:{vertical:"center",horizontal:"right"},transformOrigin:{vertical:"center",horizontal:"left"},children:e.jsx(Pt,{loading:n,onCancel:fe,onConfirm:g})})]})})})}const Hn=v.memo(Ft),$n=ie.div`
2
2
  td.MuiTableCell-footer {
3
3
  border: none !important;
4
4
  }
@@ -1,4 +1,4 @@
1
- import{B as qr}from"./vendor-utils-BgSaqjGx.js";import{p as ae}from"./vendor-react-CUXIiAnY.js";import{ag as Se,ah as jr,ai as xr,aj as Nr,ak as _r,al as Kr,am as Sr,an as Tr,ao as ke,ap as Ur,aq as Br,ar as Dr,as as Mr,a6 as Lr,r as Cr}from"./vendor-ux-r9bApERu.js";import{be as Or,aG as Vr}from"./index-DXScybaX.js";var Pe={exports:{}},Re={},Je;function Ar(){if(Je)return Re;Je=1;function h(u){"@babel/helpers - typeof";return h=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(p){return typeof p}:function(p){return p&&typeof Symbol=="function"&&p.constructor===Symbol&&p!==Symbol.prototype?"symbol":typeof p},h(u)}function g(u,p,S){return Object.defineProperty(u,"prototype",{writable:!1}),u}function s(u,p){if(!(u instanceof p))throw new TypeError("Cannot call a class as a function")}function b(u,p){if(typeof p!="function"&&p!==null)throw new TypeError("Super expression must either be null or a function");u.prototype=Object.create(p&&p.prototype,{constructor:{value:u,writable:!0,configurable:!0}}),Object.defineProperty(u,"prototype",{writable:!1}),p&&_(u,p)}function _(u,p){return _=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(N,B){return N.__proto__=B,N},_(u,p)}function L(u){var p=n();return function(){var N=e(u),B;if(p){var K=e(this).constructor;B=Reflect.construct(N,arguments,K)}else B=N.apply(this,arguments);return E(this,B)}}function E(u,p){if(p&&(h(p)==="object"||typeof p=="function"))return p;if(p!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return f(u)}function f(u){if(u===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return u}function n(){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 e(u){return e=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(S){return S.__proto__||Object.getPrototypeOf(S)},e(u)}var r={},d,y;function l(u,p,S){S||(S=Error);function N(K,H,V){return typeof p=="string"?p:p(K,H,V)}var B=function(K){b(V,K);var H=L(V);function V(W,te,Z){var J;return s(this,V),J=H.call(this,N(W,te,Z)),J.code=u,J}return g(V)}(S);r[u]=B}function q(u,p){if(Array.isArray(u)){var S=u.length;return u=u.map(function(N){return String(N)}),S>2?"one of ".concat(p," ").concat(u.slice(0,S-1).join(", "),", or ")+u[S-1]:S===2?"one of ".concat(p," ").concat(u[0]," or ").concat(u[1]):"of ".concat(p," ").concat(u[0])}else return"of ".concat(p," ").concat(String(u))}function O(u,p,S){return u.substr(0,p.length)===p}function A(u,p,S){return(S===void 0||S>u.length)&&(S=u.length),u.substring(S-p.length,S)===p}function j(u,p,S){return typeof S!="number"&&(S=0),S+p.length>u.length?!1:u.indexOf(p,S)!==-1}return l("ERR_AMBIGUOUS_ARGUMENT",'The "%s" argument is ambiguous. %s',TypeError),l("ERR_INVALID_ARG_TYPE",function(u,p,S){d===void 0&&(d=We()),d(typeof u=="string","'name' must be a string");var N;typeof p=="string"&&O(p,"not ")?(N="must not be",p=p.replace(/^not /,"")):N="must be";var B;if(A(u," argument"))B="The ".concat(u," ").concat(N," ").concat(q(p,"type"));else{var K=j(u,".")?"property":"argument";B='The "'.concat(u,'" ').concat(K," ").concat(N," ").concat(q(p,"type"))}return B+=". Received type ".concat(h(S)),B},TypeError),l("ERR_INVALID_ARG_VALUE",function(u,p){var S=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"is invalid";y===void 0&&(y=Se());var N=y.inspect(p);return N.length>128&&(N="".concat(N.slice(0,128),"...")),"The argument '".concat(u,"' ").concat(S,". Received ").concat(N)},TypeError),l("ERR_INVALID_RETURN_VALUE",function(u,p,S){var N;return S&&S.constructor&&S.constructor.name?N="instance of ".concat(S.constructor.name):N="type ".concat(h(S)),"Expected ".concat(u,' to be returned from the "').concat(p,'"')+" function but got ".concat(N,".")},TypeError),l("ERR_MISSING_ARGS",function(){for(var u=arguments.length,p=new Array(u),S=0;S<u;S++)p[S]=arguments[S];d===void 0&&(d=We()),d(p.length>0,"At least one arg needs to be specified");var N="The ",B=p.length;switch(p=p.map(function(K){return'"'.concat(K,'"')}),B){case 1:N+="".concat(p[0]," argument");break;case 2:N+="".concat(p[0]," and ").concat(p[1]," arguments");break;default:N+=p.slice(0,B-1).join(", "),N+=", and ".concat(p[B-1]," arguments");break}return"".concat(N," must be specified")},TypeError),Re.codes=r,Re}var Ie,Qe;function Fr(){if(Qe)return Ie;Qe=1;function h(v,m){var U=Object.keys(v);if(Object.getOwnPropertySymbols){var x=Object.getOwnPropertySymbols(v);m&&(x=x.filter(function(C){return Object.getOwnPropertyDescriptor(v,C).enumerable})),U.push.apply(U,x)}return U}function g(v){for(var m=1;m<arguments.length;m++){var U=arguments[m]!=null?arguments[m]:{};m%2?h(Object(U),!0).forEach(function(x){s(v,x,U[x])}):Object.getOwnPropertyDescriptors?Object.defineProperties(v,Object.getOwnPropertyDescriptors(U)):h(Object(U)).forEach(function(x){Object.defineProperty(v,x,Object.getOwnPropertyDescriptor(U,x))})}return v}function s(v,m,U){return m=E(m),m in v?Object.defineProperty(v,m,{value:U,enumerable:!0,configurable:!0,writable:!0}):v[m]=U,v}function b(v,m){if(!(v instanceof m))throw new TypeError("Cannot call a class as a function")}function _(v,m){for(var U=0;U<m.length;U++){var x=m[U];x.enumerable=x.enumerable||!1,x.configurable=!0,"value"in x&&(x.writable=!0),Object.defineProperty(v,E(x.key),x)}}function L(v,m,U){return m&&_(v.prototype,m),Object.defineProperty(v,"prototype",{writable:!1}),v}function E(v){var m=f(v,"string");return u(m)==="symbol"?m:String(m)}function f(v,m){if(u(v)!=="object"||v===null)return v;var U=v[Symbol.toPrimitive];if(U!==void 0){var x=U.call(v,m);if(u(x)!=="object")return x;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(v)}function n(v,m){if(typeof m!="function"&&m!==null)throw new TypeError("Super expression must either be null or a function");v.prototype=Object.create(m&&m.prototype,{constructor:{value:v,writable:!0,configurable:!0}}),Object.defineProperty(v,"prototype",{writable:!1}),m&&A(v,m)}function e(v){var m=q();return function(){var x=j(v),C;if(m){var a=j(this).constructor;C=Reflect.construct(x,arguments,a)}else C=x.apply(this,arguments);return r(this,C)}}function r(v,m){if(m&&(u(m)==="object"||typeof m=="function"))return m;if(m!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return d(v)}function d(v){if(v===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return v}function y(v){var m=typeof Map=="function"?new Map:void 0;return y=function(x){if(x===null||!O(x))return x;if(typeof x!="function")throw new TypeError("Super expression must either be null or a function");if(typeof m<"u"){if(m.has(x))return m.get(x);m.set(x,C)}function C(){return l(x,arguments,j(this).constructor)}return C.prototype=Object.create(x.prototype,{constructor:{value:C,enumerable:!1,writable:!0,configurable:!0}}),A(C,x)},y(v)}function l(v,m,U){return q()?l=Reflect.construct.bind():l=function(C,a,i){var c=[null];c.push.apply(c,a);var R=Function.bind.apply(C,c),w=new R;return i&&A(w,i.prototype),w},l.apply(null,arguments)}function q(){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 O(v){return Function.toString.call(v).indexOf("[native code]")!==-1}function A(v,m){return A=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(x,C){return x.__proto__=C,x},A(v,m)}function j(v){return j=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(U){return U.__proto__||Object.getPrototypeOf(U)},j(v)}function u(v){"@babel/helpers - typeof";return u=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(m){return typeof m}:function(m){return m&&typeof Symbol=="function"&&m.constructor===Symbol&&m!==Symbol.prototype?"symbol":typeof m},u(v)}var p=Se(),S=p.inspect,N=Ar(),B=N.codes.ERR_INVALID_ARG_TYPE;function K(v,m,U){return(U===void 0||U>v.length)&&(U=v.length),v.substring(U-m.length,U)===m}function H(v,m){if(m=Math.floor(m),v.length==0||m==0)return"";var U=v.length*m;for(m=Math.floor(Math.log(m)/Math.log(2));m;)v+=v,m--;return v+=v.substring(0,U-v.length),v}var V="",W="",te="",Z="",J={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:"},he=10;function de(v){var m=Object.keys(v),U=Object.create(Object.getPrototypeOf(v));return m.forEach(function(x){U[x]=v[x]}),Object.defineProperty(U,"message",{value:v.message}),U}function oe(v){return S(v,{compact:!1,customInspect:!1,depth:1e3,maxArrayLength:1/0,showHidden:!1,breakLength:1/0,showProxy:!1,sorted:!0,getters:!0})}function ye(v,m,U){var x="",C="",a=0,i="",c=!1,R=oe(v),w=R.split(`
1
+ import{B as qr}from"./vendor-utils-BgSaqjGx.js";import{p as ae}from"./vendor-react-CUXIiAnY.js";import{ag as Se,ah as jr,ai as xr,aj as Nr,ak as _r,al as Kr,am as Sr,an as Tr,ao as ke,ap as Ur,aq as Br,ar as Dr,as as Mr,a6 as Lr,r as Cr}from"./vendor-ux-r9bApERu.js";import{be as Or,aG as Vr}from"./index-DQt_6j3C.js";var Pe={exports:{}},Re={},Je;function Ar(){if(Je)return Re;Je=1;function h(u){"@babel/helpers - typeof";return h=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(p){return typeof p}:function(p){return p&&typeof Symbol=="function"&&p.constructor===Symbol&&p!==Symbol.prototype?"symbol":typeof p},h(u)}function g(u,p,S){return Object.defineProperty(u,"prototype",{writable:!1}),u}function s(u,p){if(!(u instanceof p))throw new TypeError("Cannot call a class as a function")}function b(u,p){if(typeof p!="function"&&p!==null)throw new TypeError("Super expression must either be null or a function");u.prototype=Object.create(p&&p.prototype,{constructor:{value:u,writable:!0,configurable:!0}}),Object.defineProperty(u,"prototype",{writable:!1}),p&&_(u,p)}function _(u,p){return _=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(N,B){return N.__proto__=B,N},_(u,p)}function L(u){var p=n();return function(){var N=e(u),B;if(p){var K=e(this).constructor;B=Reflect.construct(N,arguments,K)}else B=N.apply(this,arguments);return E(this,B)}}function E(u,p){if(p&&(h(p)==="object"||typeof p=="function"))return p;if(p!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return f(u)}function f(u){if(u===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return u}function n(){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 e(u){return e=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(S){return S.__proto__||Object.getPrototypeOf(S)},e(u)}var r={},d,y;function l(u,p,S){S||(S=Error);function N(K,H,V){return typeof p=="string"?p:p(K,H,V)}var B=function(K){b(V,K);var H=L(V);function V(W,te,Z){var J;return s(this,V),J=H.call(this,N(W,te,Z)),J.code=u,J}return g(V)}(S);r[u]=B}function q(u,p){if(Array.isArray(u)){var S=u.length;return u=u.map(function(N){return String(N)}),S>2?"one of ".concat(p," ").concat(u.slice(0,S-1).join(", "),", or ")+u[S-1]:S===2?"one of ".concat(p," ").concat(u[0]," or ").concat(u[1]):"of ".concat(p," ").concat(u[0])}else return"of ".concat(p," ").concat(String(u))}function O(u,p,S){return u.substr(0,p.length)===p}function A(u,p,S){return(S===void 0||S>u.length)&&(S=u.length),u.substring(S-p.length,S)===p}function j(u,p,S){return typeof S!="number"&&(S=0),S+p.length>u.length?!1:u.indexOf(p,S)!==-1}return l("ERR_AMBIGUOUS_ARGUMENT",'The "%s" argument is ambiguous. %s',TypeError),l("ERR_INVALID_ARG_TYPE",function(u,p,S){d===void 0&&(d=We()),d(typeof u=="string","'name' must be a string");var N;typeof p=="string"&&O(p,"not ")?(N="must not be",p=p.replace(/^not /,"")):N="must be";var B;if(A(u," argument"))B="The ".concat(u," ").concat(N," ").concat(q(p,"type"));else{var K=j(u,".")?"property":"argument";B='The "'.concat(u,'" ').concat(K," ").concat(N," ").concat(q(p,"type"))}return B+=". Received type ".concat(h(S)),B},TypeError),l("ERR_INVALID_ARG_VALUE",function(u,p){var S=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"is invalid";y===void 0&&(y=Se());var N=y.inspect(p);return N.length>128&&(N="".concat(N.slice(0,128),"...")),"The argument '".concat(u,"' ").concat(S,". Received ").concat(N)},TypeError),l("ERR_INVALID_RETURN_VALUE",function(u,p,S){var N;return S&&S.constructor&&S.constructor.name?N="instance of ".concat(S.constructor.name):N="type ".concat(h(S)),"Expected ".concat(u,' to be returned from the "').concat(p,'"')+" function but got ".concat(N,".")},TypeError),l("ERR_MISSING_ARGS",function(){for(var u=arguments.length,p=new Array(u),S=0;S<u;S++)p[S]=arguments[S];d===void 0&&(d=We()),d(p.length>0,"At least one arg needs to be specified");var N="The ",B=p.length;switch(p=p.map(function(K){return'"'.concat(K,'"')}),B){case 1:N+="".concat(p[0]," argument");break;case 2:N+="".concat(p[0]," and ").concat(p[1]," arguments");break;default:N+=p.slice(0,B-1).join(", "),N+=", and ".concat(p[B-1]," arguments");break}return"".concat(N," must be specified")},TypeError),Re.codes=r,Re}var Ie,Qe;function Fr(){if(Qe)return Ie;Qe=1;function h(v,m){var U=Object.keys(v);if(Object.getOwnPropertySymbols){var x=Object.getOwnPropertySymbols(v);m&&(x=x.filter(function(C){return Object.getOwnPropertyDescriptor(v,C).enumerable})),U.push.apply(U,x)}return U}function g(v){for(var m=1;m<arguments.length;m++){var U=arguments[m]!=null?arguments[m]:{};m%2?h(Object(U),!0).forEach(function(x){s(v,x,U[x])}):Object.getOwnPropertyDescriptors?Object.defineProperties(v,Object.getOwnPropertyDescriptors(U)):h(Object(U)).forEach(function(x){Object.defineProperty(v,x,Object.getOwnPropertyDescriptor(U,x))})}return v}function s(v,m,U){return m=E(m),m in v?Object.defineProperty(v,m,{value:U,enumerable:!0,configurable:!0,writable:!0}):v[m]=U,v}function b(v,m){if(!(v instanceof m))throw new TypeError("Cannot call a class as a function")}function _(v,m){for(var U=0;U<m.length;U++){var x=m[U];x.enumerable=x.enumerable||!1,x.configurable=!0,"value"in x&&(x.writable=!0),Object.defineProperty(v,E(x.key),x)}}function L(v,m,U){return m&&_(v.prototype,m),Object.defineProperty(v,"prototype",{writable:!1}),v}function E(v){var m=f(v,"string");return u(m)==="symbol"?m:String(m)}function f(v,m){if(u(v)!=="object"||v===null)return v;var U=v[Symbol.toPrimitive];if(U!==void 0){var x=U.call(v,m);if(u(x)!=="object")return x;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(v)}function n(v,m){if(typeof m!="function"&&m!==null)throw new TypeError("Super expression must either be null or a function");v.prototype=Object.create(m&&m.prototype,{constructor:{value:v,writable:!0,configurable:!0}}),Object.defineProperty(v,"prototype",{writable:!1}),m&&A(v,m)}function e(v){var m=q();return function(){var x=j(v),C;if(m){var a=j(this).constructor;C=Reflect.construct(x,arguments,a)}else C=x.apply(this,arguments);return r(this,C)}}function r(v,m){if(m&&(u(m)==="object"||typeof m=="function"))return m;if(m!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return d(v)}function d(v){if(v===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return v}function y(v){var m=typeof Map=="function"?new Map:void 0;return y=function(x){if(x===null||!O(x))return x;if(typeof x!="function")throw new TypeError("Super expression must either be null or a function");if(typeof m<"u"){if(m.has(x))return m.get(x);m.set(x,C)}function C(){return l(x,arguments,j(this).constructor)}return C.prototype=Object.create(x.prototype,{constructor:{value:C,enumerable:!1,writable:!0,configurable:!0}}),A(C,x)},y(v)}function l(v,m,U){return q()?l=Reflect.construct.bind():l=function(C,a,i){var c=[null];c.push.apply(c,a);var R=Function.bind.apply(C,c),w=new R;return i&&A(w,i.prototype),w},l.apply(null,arguments)}function q(){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 O(v){return Function.toString.call(v).indexOf("[native code]")!==-1}function A(v,m){return A=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(x,C){return x.__proto__=C,x},A(v,m)}function j(v){return j=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(U){return U.__proto__||Object.getPrototypeOf(U)},j(v)}function u(v){"@babel/helpers - typeof";return u=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(m){return typeof m}:function(m){return m&&typeof Symbol=="function"&&m.constructor===Symbol&&m!==Symbol.prototype?"symbol":typeof m},u(v)}var p=Se(),S=p.inspect,N=Ar(),B=N.codes.ERR_INVALID_ARG_TYPE;function K(v,m,U){return(U===void 0||U>v.length)&&(U=v.length),v.substring(U-m.length,U)===m}function H(v,m){if(m=Math.floor(m),v.length==0||m==0)return"";var U=v.length*m;for(m=Math.floor(Math.log(m)/Math.log(2));m;)v+=v,m--;return v+=v.substring(0,U-v.length),v}var V="",W="",te="",Z="",J={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:"},he=10;function de(v){var m=Object.keys(v),U=Object.create(Object.getPrototypeOf(v));return m.forEach(function(x){U[x]=v[x]}),Object.defineProperty(U,"message",{value:v.message}),U}function oe(v){return S(v,{compact:!1,customInspect:!1,depth:1e3,maxArrayLength:1/0,showHidden:!1,breakLength:1/0,showProxy:!1,sorted:!0,getters:!0})}function ye(v,m,U){var x="",C="",a=0,i="",c=!1,R=oe(v),w=R.split(`
2
2
  `),I=oe(m).split(`
3
3
  `),D=0,z="";if(U==="strictEqual"&&u(v)==="object"&&u(m)==="object"&&v!==null&&m!==null&&(U="strictEqualObject"),w.length===1&&I.length===1&&w[0]!==I[0]){var k=w[0].length+I[0].length;if(k<=he){if((u(v)!=="object"||v===null)&&(u(m)!=="object"||m===null)&&(v!==0||m!==0))return"".concat(J[U],`
4
4
 
@@ -1,4 +1,4 @@
1
- import{W as o,j as n,ak as h,f as y,bh as q,av as w,D as I}from"./vendor-mui-core-BPQ6AEW_.js";import{r as $}from"./vendor-react-CUXIiAnY.js";import{l as k,a3 as W,V as A,m as B,K as H}from"./vendor-ux-r9bApERu.js";import{aX as Y,aY as V,aZ as Z,a_ as C,k as K,a$ as P,b0 as X,b1 as G,am as J,b2 as N,b3 as Q}from"./index-DXScybaX.js";import{Y as U,I as ee,Z as ne}from"./vendor-utils-BgSaqjGx.js";import{a as oe}from"./vendor-hooks-PN9SWiQm.js";function z({name:e="",logo:t="",description:i="",...c}){if(!e&&!t&&!i)return null;const d=$.isValidElement(t)?t:n.jsx("img",{src:t,alt:e});return n.jsxs(te,{...c,children:[n.jsxs("div",{children:[t&&n.jsx(h,{component:"a",href:"/",className:"footer-brand-logo",children:d}),e&&n.jsx("div",{className:"footer-brand-name",children:e})]}),i&&n.jsx("div",{className:"footer-brand-desc",children:i})]})}z.propTypes={name:o.node,logo:o.node,description:o.string};const te=k("div")`
1
+ import{W as o,j as n,ak as h,f as y,bh as q,av as w,D as I}from"./vendor-mui-core-BPQ6AEW_.js";import{r as $}from"./vendor-react-CUXIiAnY.js";import{l as k,a3 as W,V as A,m as B,K as H}from"./vendor-ux-r9bApERu.js";import{aX as Y,aY as V,aZ as Z,a_ as C,k as K,a$ as P,b0 as X,b1 as G,am as J,b2 as N,b3 as Q}from"./index-DQt_6j3C.js";import{Y as U,I as ee,Z as ne}from"./vendor-utils-BgSaqjGx.js";import{a as oe}from"./vendor-hooks-PN9SWiQm.js";function z({name:e="",logo:t="",description:i="",...c}){if(!e&&!t&&!i)return null;const d=$.isValidElement(t)?t:n.jsx("img",{src:t,alt:e});return n.jsxs(te,{...c,children:[n.jsxs("div",{children:[t&&n.jsx(h,{component:"a",href:"/",className:"footer-brand-logo",children:d}),e&&n.jsx("div",{className:"footer-brand-name",children:e})]}),i&&n.jsx("div",{className:"footer-brand-desc",children:i})]})}z.propTypes={name:o.node,logo:o.node,description:o.string};const te=k("div")`
2
2
  display: flex;
3
3
  flex-direction: column;
4
4
  font-size: 14px;
@@ -1,4 +1,4 @@
1
- import{D as w1,J as K1,j as r,Y as Y1,$ as W1,I as q1,df as _1,ar as I1,ak as U,a$ as R,cW as y1,b1 as $1,am as B1,T,bD as e6,z as t6,cq as n6,a6,Q as r6}from"./vendor-mui-core-BPQ6AEW_.js";import{C as x,a as i6,a9 as S1,J as M,c as s6,I as o6,F as c6}from"./vendor-utils-BgSaqjGx.js";import{V as l6,I as F1,e as u6,A as H,l as C6,x as p6,b as d6,n as t1,aF as n1}from"./vendor-ux-r9bApERu.js";import{r as t}from"./vendor-react-CUXIiAnY.js";import{k as L1,b as v1,a as Z}from"./vendor-hooks-PN9SWiQm.js";import{bj as Y,Z as W,bz as U1,bA as h6,v as m6,bs as E6,bf as g6}from"./index-DXScybaX.js";import{x as f6}from"./index-DRYJ0xIl.js";import{f as A6}from"./index-BojVbZw0.js";import{v as a1}from"./index-CJ1z6qNA.js";const j=Y({});function D6({key:e}={key:"md"}){const n=w1();return K1(n.breakpoints.down(e))}var A=(e=>(e[e.NETWORK_ERROR=1001]="NETWORK_ERROR",e[e.UNAUTHORIZED=1002]="UNAUTHORIZED",e[e.EXPIRED=1003]="EXPIRED",e[e.PAST_DUE=1004]="PAST_DUE",e[e.INVALID=1005]="INVALID",e[e.UNIT_LIMIT=1006]="UNIT_LIMIT",e[e.CORS_BLOCKED=1007]="CORS_BLOCKED",e[e.INCOMPATIBLE=1008]="INCOMPATIBLE",e))(A||{}),O1=(e=>(e.DEFAULT="default",e.SUCCEEDED="succeeded",e.FAILED="failed",e.PENDING="pending",e))(O1||{}),F=(e=>(e.APP_DISCONNECTED="app-disconnected",e.APP_RESTORE="app-restore",e.APP_BACKUP="app-backup",e.APP_CONNECTED="app-connected",e.APP_OBJECTS_SYNC="app-objects-sync",e))(F||{});function x6({endpoint:e,deps:n=[]}){return L1(async()=>{if(!W(e))return;const{headers:a}=await j.head(e,{timeout:1e3*30,params:{withExtras:!0}}),[i,s,c,u,l,C,d,p,m,g]=[a["x-space-name"],a["x-subscription-id"],a["x-listable"]==="true",a["x-readable"]==="true",a["x-writeable"]==="true",a["x-space-version"],a["x-space-owner-did"],a["x-space-is-available"],a["x-error-code"],a["x-is-site-admin"]],h=i?decodeURIComponent(i):"";if(p===void 0||m===void 0){const f=c&&u&&l;return{version:C,name:h,subscriptionId:s,ownerDid:d||"",isAvailable:f,errorCode:f?0:A.UNAUTHORIZED,isSiteAdmin:g==="true"}}return{version:C,name:h,subscriptionId:s,ownerDid:d,isAvailable:p==="true",errorCode:parseInt(m,10),isSiteAdmin:g==="true"}},{refreshDeps:[e].concat(n),onError(a){console.error(a)}})}const w6=U1.flatten({common:{cancel:"Cancel",confirm:"Confirm",delete:"Delete",error:"Error",open:"Open",unknown:"Unknown",invalidUrl:"Invalid url: {url}",upgrade:"Upgrade",viewMore:"View More"},storage:{spaces:{authorize:{title:"Connect {appName} to DID Spaces",scan:"Use your DID Wallet to scan the QR code below to allow the app {appName} to connect to DID Spaces",success:"Connected successfully"},connect:{reconnect:"Reconnect Now",useSpaceGateway:"Connect using the DID Spaces gateway",useWallet:"Connect to DID Spaces",howToGetGatewayUrl:"How to get the url of did spaces",providerForStorage:"Please connect your DID Spaces"},connected:{title:"Connected DID Spaces",tag:"Connected"},disconnected:{tag:"Disconnected"},error:{tag:"Need Attention",blockedByCors:"Access blocked by CORS",unreachable:"DID Space is unreachable",expired:"DID Spaces has expired, click this link to re-subscribe",pastDue:"DID Spaces has unpaid bills, click this link to complete payment",invalid:"DID Spaces subscription anomaly, click this link to check",unitLimit:"DID Spaces free quota has been used up, click this link to pay for the upgrade",cors:`The connection request may fail due to CORS restrictions:
1
+ import{D as w1,J as K1,j as r,Y as Y1,$ as W1,I as q1,df as _1,ar as I1,ak as U,a$ as R,cW as y1,b1 as $1,am as B1,T,bD as e6,z as t6,cq as n6,a6,Q as r6}from"./vendor-mui-core-BPQ6AEW_.js";import{C as x,a as i6,a9 as S1,J as M,c as s6,I as o6,F as c6}from"./vendor-utils-BgSaqjGx.js";import{V as l6,I as F1,e as u6,A as H,l as C6,x as p6,b as d6,n as t1,aF as n1}from"./vendor-ux-r9bApERu.js";import{r as t}from"./vendor-react-CUXIiAnY.js";import{k as L1,b as v1,a as Z}from"./vendor-hooks-PN9SWiQm.js";import{bj as Y,Z as W,bz as U1,bA as h6,v as m6,bs as E6,bf as g6}from"./index-DQt_6j3C.js";import{x as f6}from"./index-DRYJ0xIl.js";import{f as A6}from"./index-BojVbZw0.js";import{v as a1}from"./index-CJ1z6qNA.js";const j=Y({});function D6({key:e}={key:"md"}){const n=w1();return K1(n.breakpoints.down(e))}var A=(e=>(e[e.NETWORK_ERROR=1001]="NETWORK_ERROR",e[e.UNAUTHORIZED=1002]="UNAUTHORIZED",e[e.EXPIRED=1003]="EXPIRED",e[e.PAST_DUE=1004]="PAST_DUE",e[e.INVALID=1005]="INVALID",e[e.UNIT_LIMIT=1006]="UNIT_LIMIT",e[e.CORS_BLOCKED=1007]="CORS_BLOCKED",e[e.INCOMPATIBLE=1008]="INCOMPATIBLE",e))(A||{}),O1=(e=>(e.DEFAULT="default",e.SUCCEEDED="succeeded",e.FAILED="failed",e.PENDING="pending",e))(O1||{}),F=(e=>(e.APP_DISCONNECTED="app-disconnected",e.APP_RESTORE="app-restore",e.APP_BACKUP="app-backup",e.APP_CONNECTED="app-connected",e.APP_OBJECTS_SYNC="app-objects-sync",e))(F||{});function x6({endpoint:e,deps:n=[]}){return L1(async()=>{if(!W(e))return;const{headers:a}=await j.head(e,{timeout:1e3*30,params:{withExtras:!0}}),[i,s,c,u,l,C,d,p,m,g]=[a["x-space-name"],a["x-subscription-id"],a["x-listable"]==="true",a["x-readable"]==="true",a["x-writeable"]==="true",a["x-space-version"],a["x-space-owner-did"],a["x-space-is-available"],a["x-error-code"],a["x-is-site-admin"]],h=i?decodeURIComponent(i):"";if(p===void 0||m===void 0){const f=c&&u&&l;return{version:C,name:h,subscriptionId:s,ownerDid:d||"",isAvailable:f,errorCode:f?0:A.UNAUTHORIZED,isSiteAdmin:g==="true"}}return{version:C,name:h,subscriptionId:s,ownerDid:d,isAvailable:p==="true",errorCode:parseInt(m,10),isSiteAdmin:g==="true"}},{refreshDeps:[e].concat(n),onError(a){console.error(a)}})}const w6=U1.flatten({common:{cancel:"Cancel",confirm:"Confirm",delete:"Delete",error:"Error",open:"Open",unknown:"Unknown",invalidUrl:"Invalid url: {url}",upgrade:"Upgrade",viewMore:"View More"},storage:{spaces:{authorize:{title:"Connect {appName} to DID Spaces",scan:"Use your DID Wallet to scan the QR code below to allow the app {appName} to connect to DID Spaces",success:"Connected successfully"},connect:{reconnect:"Reconnect Now",useSpaceGateway:"Connect using the DID Spaces gateway",useWallet:"Connect to DID Spaces",howToGetGatewayUrl:"How to get the url of did spaces",providerForStorage:"Please connect your DID Spaces"},connected:{title:"Connected DID Spaces",tag:"Connected"},disconnected:{tag:"Disconnected"},error:{tag:"Need Attention",blockedByCors:"Access blocked by CORS",unreachable:"DID Space is unreachable",expired:"DID Spaces has expired, click this link to re-subscribe",pastDue:"DID Spaces has unpaid bills, click this link to complete payment",invalid:"DID Spaces subscription anomaly, click this link to check",unitLimit:"DID Spaces free quota has been used up, click this link to pay for the upgrade",cors:`The connection request may fail due to CORS restrictions:
2
2
  1. Please contact the DID Space administrator to verify the relevant configuration.
3
3
  2. If you are the administrator, click the link below to view the detailed setup guide and resolve the issue.`,networkError:"DID Space is currently unreachable due to potential server issues, network problems, or maintenance. Please click the link to visit the homepage and check its status.",incompatible:`The current connection of DID Spaces version ({spaceVersion}) is not compatible with the component version ({expectVersion}). Please contact the administrator for adjustments.
4
4
  If you are the administrator, you can click the link below to take action.`},gateway:{add:{invalidUrl:"Invalid DID Spaces gateway url",label:"Enter the url of the DID Spaces",title:"Add DID Spaces"}},provideNFT:{title:"Please show the DID Spaces NFT for {appName}",scan:"Use your DID Wallet to scan the QR code below to allow the app {appName} show DID Spaces NFT",success:"Connected successfully"},helperText:{fixCorsError:"Fixing CORS Errors When Connecting to DID Spaces"}}},auditLog:{backup:{description:"A backup operation was completed {relativeTime}"},restore:{description:"A restore operation was completed {relativeTime}"},connected:{description:"A connection was established {relativeTime}"},disconnected:{description:"The connection was disconnected {relativeTime}"},objectsSync:{description:"{totalCount} objects ({size}) were synchronized {relativeTime}"}}}),I6=U1.flatten({common:{cancel:"取消",confirm:"确认",delete:"删除",error:"错误",open:"打开",unknown:"未知",invalidUrl:"无效的 url: {url}",upgrade:"升级",viewMore:"查看更多"},storage:{spaces:{authorize:{title:"连接 {appName} 至 DID Spaces",scan:"使用你的 DID Wallet 扫描下面的二维码以允许应用 {appName} 连接至 DID Spaces",success:"连接成功"},connect:{reconnect:"立即重连",useSpaceGateway:"使用 DID Spaces 网关连接",useWallet:"连接至 DID Spaces",howToGetGatewayUrl:"如何获取 DID Spaces 的网关地址",providerForStorage:"请连接您的 DID Spaces"},connected:{title:"已连接的 DID Spaces",tag:"已连接"},disconnected:{tag:"连接已断开"},error:{tag:"需要关注",blockedByCors:"因 CORS 限制,访问被阻止",unreachable:"DID Space 无法访问",expired:"DID Spaces 已过期,点击此链接重新订阅",pastDue:"DID Spaces 有未支付账单,点击此链接完成支付",invalid:"DID Spaces 订阅异常,点击此链接检查",unitLimit:"DID Spaces 免费额度已用完,点击此链接付费升级",cors:`连接请求可能因 CORS 限制而失败:
@@ -1,4 +1,4 @@
1
- import{V as B,H as q,U as H,k as Y,i as Ce,h as Se,a2 as Te}from"./vendor-ux-r9bApERu.js";import{q as Ie,k as ae,t as Re}from"./vendor-hooks-PN9SWiQm.js";import{r as v,a as ce}from"./vendor-react-CUXIiAnY.js";import{D as We,J as de,j as e,Y as ze,bC as De,$ as Oe,ak as d,z as ne,T as C,a6 as U,aX as te,R as Ae,Q as F,b6 as ie,am as P,bf as _,a5 as J,V as G,S as Z,b4 as $e,U as L,I as M,cj as Pe,bh as qe,a7 as Le,F as Be,W as t,b1 as W,a3 as pe,c2 as ee,ck as Me,aO as Fe,aP as He,cl as Ne,cm as Ue,cn as _e,s as oe,aU as Ve,aj as Ke,cc as Ye,bb as Je,cb as Qe}from"./vendor-mui-core-BPQ6AEW_.js";import{_ as V,c as ue,a1 as Xe,ac as Ge,b4 as Q,ar as xe,as as he,at as me}from"./index-DXScybaX.js";import{S as Ze}from"./switch-D2wksu-s.js";import{u as K}from"./team-_EogfHX7.js";import{u as et}from"./use-mobile-ajdJIsoX.js";import{u as tt,C as X}from"./index.esm-DTmS4tth.js";import{C as ge,a as be,J as ot}from"./vendor-utils-BgSaqjGx.js";import{C as st}from"./confirm-DQ4M1D6U.js";import{A as nt}from"./actions-DhSvOHy-.js";import{T as re}from"./table-tips-sMVI7VOu.js";import"./lottie-web-4koyQiv_.js";import"./vendor-arcblock-D8WYBDYe.js";import"./session-BYUJUwt5.js";import"./isURL-CFycC-gz.js";import"./use-app-logo-iwMRCv-t.js";import"./index-DBs9Ljax.js";const it=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,ue.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}=B(),[w,u]=v.useState({}),j=v.useMemo(()=>{const s={};return Object.entries(n).forEach(([l,{events:m}])=>{const k=m.filter(S=>p[`${S.type}-${S.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 S=`${k.type}-${k.source}`;m[S]=!l}),c(k=>({...k,...m}))},I=s=>{const l={};Object.values(n).forEach(({events:m})=>{m.forEach(k=>{const S=`${k.type}-${k.source}`;l[S]=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(C,{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}],S)=>{const D=j[s]>0,R=j[s]===m.length&&m.length>0,O=w[s];return e.jsxs(ce.Fragment,{children:[e.jsx(Z,{sx:{borderBottom:({palette:i})=>S<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:D&&!R,onChange:i=>{i.stopPropagation(),z(m,R)}}),label:e.jsxs(d,{sx:{display:"flex",alignItems:"center",gap:1},children:[l.logo&&e.jsx($e,{src:l.logo,sx:{width:24,height:24}}),e.jsx(d,{children:l.title||s}),D&&e.jsx(L,{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(C,{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:O?e.jsx(Pe,{}):e.jsx(qe,{})})]})]})}),m.length>0&&e.jsx(Le,{in:O,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 h=`${i.type}-${i.source}`,o=!!p[h];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:o,sx:{flexShrink:0}}),e.jsxs(d,{sx:{flex:1,minWidth:0},children:[e.jsx(C,{variant:"body1",className:"webhook-event-type",sx:{cursor:"pointer",color:"text.primary",wordBreak:"break-word",overflowWrap:"break-word"},children:i.type}),e.jsx(C,{variant:"caption",sx:{color:"text.secondary",display:"block",cursor:"pointer",wordBreak:"break-word",overflowWrap:"break-word"},children:i.description})]})]})},h)})})})]},s)})})}),f&&e.jsx(Be,{error:!0,sx:{mt:1},children:f})]})}fe.propTypes={eventsBySource:t.objectOf(t.shape({source:t.shape({did:t.string.isRequired,title:t.string,description:t.string,version:t.string,logo:t.string}).isRequired,events:t.arrayOf(t.shape({type:t.string.isRequired,description:t.string.isRequired,source:t.string.isRequired})).isRequired,count:t.number.isRequired})).isRequired,selectedEvents:t.objectOf(t.bool).isRequired,setSelectedEvents:t.func.isRequired,error:t.string};function je({id:n=null,url:p="",description:c="",enabledEvents:f=[],onSubmit:r,onClose:w=()=>{}}){const{t:u}=B(),[j,a]=v.useState({}),{teamDid:b}=K(),{api:g}=V(),{loading:y,error:z,eventsBySource:I}=it(),s=We(),{control:l,handleSubmit:m,formState:{errors:k},reset:S,setValue:D,trigger:R}=tt({defaultValues:{url:"",description:""}}),O=de(s.breakpoints.down("md"));v.useEffect(()=>{const o=Object.values(j).some(x=>x);D("selectedEvents",o?"valid":""),R("selectedEvents")},[j,D,R]);const i=()=>{a({}),S(),w()},h=async o=>{const x=Object.keys(j).filter(T=>j[T]),E={url:o.url,description:o.description,enabledEvents:x.map(T=>{const[A,se]=T.split("-");return!A||!se?null:{type:A,source:se}}).filter(Boolean)};try{if(n){const T=await g.updateWebhookEndpoint({input:{teamDid:b,id:n,data:E}});q.success(`${u("webhookEndpoint.updateWebhook")} ${u("webhookEndpoint.success")}`),r(T)}else{const T=await g.createWebhookEndpoint({input:{teamDid:b,input:E}});q.success(`${u("webhookEndpoint.createWebhook")} ${u("webhookEndpoint.success")}`),r(T)}}catch(T){q.error(T?.message)}i()};return v.useEffect(()=>{S({url:p,description:c}),a(f.reduce((o,x)=>(o[`${x.type}-${x.source}`]=!0,o),{}))},[S,a,p,c,f]),e.jsx(ze,{open:!0,onClose:i,maxWidth:"lg",fullWidth:!0,fullScreen:O,sx:{"& .MuiDialog-paper":{minHeight:600}},children:e.jsxs("form",{onSubmit:m(h),children:[e.jsx(De,{children:u(n?"webhookEndpoint.editWebhookTitle":"webhookEndpoint.createWebhookTitle")}),e.jsx(Oe,{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:o})=>e.jsx(ne,{...o,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:o})=>e.jsx(ne,{...o,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:o})=>e.jsx("input",{type:"hidden",...o})}),!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(C,{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(U,{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(F,{onClick:i,children:u("common.cancel")}),e.jsx(F,{type:"submit",variant:"contained",color:"primary",children:u(n?"webhookEndpoint.updateWebhook":"webhookEndpoint.saveWebhook")})]})]})})}je.propTypes={onSubmit:t.func.isRequired,id:t.string,url:t.string,description:t.string,enabledEvents:t.arrayOf(t.shape({type:t.string.isRequired,source:t.string.isRequired})),onClose:t.func};function rt(n){switch(n){case"enabled":return"success";case"disabled":default:return"default"}}const lt=(n="en")=>n==="tw"?"zh":n;function N(n,p="YYYY-MM-DD HH:mm:ss",c="en"){return n?Xe(n).locale(lt(c)).format(p):"-"}function at(n){return typeof n=="number"?!1:be(n)}function ct(n){return n>=200&&n<300}function $({value:n,label:p,tip:c="",divider:f=!1}){const r=at(n);return e.jsxs(e.Fragment,{children:[e.jsxs(W,{direction:"column",alignItems:"flex-start",children:[e.jsxs(C,{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(C,{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})]})}$.propTypes={label:t.oneOfType([t.string,t.node]).isRequired,value:t.oneOfType([t.string,t.node]).isRequired,tip:t.oneOfType([t.string,t.node]),divider:t.bool};function ye({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(C,{variant:"h3",sx:{fontSize:{xs:"18px",md:"1.09375rem"}},component:"div",children:n}),p]})}ye.propTypes={title:t.oneOfType([t.string,t.node]).isRequired,children:t.node,mb:t.number,mt:t.number};const dt={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"/>'},pt=n=>{const p={};return n.forEach(c=>{const f=new Date(c.createdAt).toLocaleDateString();p[f]||(p[f]=[]),p[f]?.push(c)}),p};function we({eventId:n="",webhookEndpointId:p="",event:c=null}){const{api:f,ws:{useSubscription:r}}=V(),{t:w}=B(),{teamDid:u}=K(),{blocklet:j}=Ge(),{data:a,loadMore:b,loadingMore:g,loading:y,mutate:z}=Ie(o=>{const E=o?Math.ceil(o.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),S=pt(I);if(v.useEffect(()=>{!s&&a?.list.length&&l(a.list[0])},[a?.list.length,s]),r(ue.EVENTS.WEBHOOK_ATTEMPT,o=>{z(x=>{if(x.list.find(T=>T.id===o.id)){const T=x.list.map(A=>A.id===o.id?{...A,...o}:A);return{...x,list:T}}return o.endpoint=x.list[0]?.endpoint,o.event=x.list[0]?.event,{...x,list:[o,...x.list]}})},[]),y)return e.jsx(U,{});const D=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)}))},O=o=>{if(o.responseBody&&o.responseBody?.sessionId&&o.responseBody?.projectId&&o.responseBody?.agentId){const x=j?.site?.domainAliases[0]?.value,E=(j.children||[]).find(A=>A?.meta?.name==="ai-studio"),T=ot(ge(`https://${x}`,E?.mountPoint||"","projects",o.responseBody.projectId,"logs/main"),{sessionId:o.responseBody.sessionId,agentId:o.responseBody.agentId});return e.jsx(M,{sx:{fontSize:20},onClick:()=>window.open(T,"_blank"),children:e.jsx(d,{component:H,icon:Q})})}return null},i=o=>o.status==="pending"?e.jsx(Ne,{color:"warning"}):ct(o.responseStatus)?e.jsx(Ue,{color:"success"}):e.jsx(_e,{color:"error"}),h=s?.triggeredFrom&&(a?.list||[]).find(o=>o.id===s.triggeredFrom);return e.jsxs(ut,{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(S))?e.jsx(C,{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(S).map(([o,x])=>e.jsxs(ce.Fragment,{children:[e.jsx(Me,{sx:{p:0},children:o}),x.map(E=>e.jsxs(Z,{sx:{cursor:"pointer",px:1},onClick:()=>l(E),selected:s&&s?.id===E?.id,secondaryAction:e.jsx(C,{sx:{color:"text.secondary"},children:N(E.createdAt,"HH:mm:ss")}),children:[e.jsx(Fe,{sx:{minWidth:0,mr:1.5},children:i(E)}),e.jsx(He,{primary:e.jsx(C,{sx:{color:"text.primary"},children:E.event.type})})]},E.id))]},o))}),D&&e.jsx(d,{sx:{display:"flex",justifyContent:"center",alignItems:"center",width:1},children:e.jsx(F,{variant:"text",type:"button",color:"inherit",onClick:b,disabled:g,sx:{color:o=>o.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(C,{variant:"h4",children:w(`common.${s.status}`)}),e.jsx(d,{children:O(s)})]}),e.jsxs(d,{sx:{display:"flex",alignItems:"center",gap:1},children:[h&&e.jsx(P,{placement:"left",title:e.jsxs(W,{onClick:()=>l(h),sx:{gap:1,cursor:"pointer",".did-address-text":{color:"common.white"}},children:[e.jsx(xe,{showDid:!0,did:s.triggeredBy,cardType:me.Detailed,infoType:he.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(C,{variant:"body2",sx:{color:"primary.main"},children:w("webhookEndpoint.triggeredFrom")}),e.jsxs(d,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(C,{variant:"body2",children:s.id}),e.jsx(M,{onClick:()=>l(h),children:e.jsx(d,{component:H,icon:Q,sx:{fontSize:16,color:"common.white"}})})]})]})]}),slotProps:{tooltip:{sx:{maxWidth:400}}},children:e.jsx(M,{onClick:()=>l(h),children:e.jsx(d,{component:H,icon:Q,sx:{fontSize:16}})})}),e.jsxs(F,{variant:"outlined",color:"primary",size:"small",onClick:R,disabled:m,children:[e.jsx(d,{component:H,icon:dt,sx:{fontSize:16,animation:m?"spin 1s linear infinite":"none",mr:.5}}),w("notification.resend")]})]})]}),e.jsxs(d,{children:[e.jsxs(C,{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(C,{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(C,{variant:"h6",children:w("webhookEndpoint.eventData")})}),e.jsx(Y,{language:"json",sx:{margin:0},children:JSON.stringify(c.data,null,2)})]})]})]})}we.propTypes={eventId:t.string,webhookEndpointId:t.string,event:t.shape({type:t.string,data:t.object,request:t.object,requestInfo:t.object})};const ut=oe(ee)`
1
+ import{V as B,H as q,U as H,k as Y,i as Ce,h as Se,a2 as Te}from"./vendor-ux-r9bApERu.js";import{q as Ie,k as ae,t as Re}from"./vendor-hooks-PN9SWiQm.js";import{r as v,a as ce}from"./vendor-react-CUXIiAnY.js";import{D as We,J as de,j as e,Y as ze,bC as De,$ as Oe,ak as d,z as ne,T as C,a6 as U,aX as te,R as Ae,Q as F,b6 as ie,am as P,bf as _,a5 as J,V as G,S as Z,b4 as $e,U as L,I as M,cj as Pe,bh as qe,a7 as Le,F as Be,W as t,b1 as W,a3 as pe,c2 as ee,ck as Me,aO as Fe,aP as He,cl as Ne,cm as Ue,cn as _e,s as oe,aU as Ve,aj as Ke,cc as Ye,bb as Je,cb as Qe}from"./vendor-mui-core-BPQ6AEW_.js";import{_ as V,c as ue,a1 as Xe,ac as Ge,b4 as Q,ar as xe,as as he,at as me}from"./index-DQt_6j3C.js";import{S as Ze}from"./switch-D2wksu-s.js";import{u as K}from"./team-D29LjHNf.js";import{u as et}from"./use-mobile-ajdJIsoX.js";import{u as tt,C as X}from"./index.esm-DTmS4tth.js";import{C as ge,a as be,J as ot}from"./vendor-utils-BgSaqjGx.js";import{C as st}from"./confirm-F2_i30bc.js";import{A as nt}from"./actions-DhSvOHy-.js";import{T as re}from"./table-tips-sMVI7VOu.js";import"./lottie-web-4koyQiv_.js";import"./vendor-arcblock-D8WYBDYe.js";import"./session-SqadLMEY.js";import"./isURL-BHeH7II4.js";import"./use-app-logo-D768RYSo.js";import"./index-DBs9Ljax.js";const it=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,ue.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}=B(),[w,u]=v.useState({}),j=v.useMemo(()=>{const s={};return Object.entries(n).forEach(([l,{events:m}])=>{const k=m.filter(S=>p[`${S.type}-${S.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 S=`${k.type}-${k.source}`;m[S]=!l}),c(k=>({...k,...m}))},I=s=>{const l={};Object.values(n).forEach(({events:m})=>{m.forEach(k=>{const S=`${k.type}-${k.source}`;l[S]=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(C,{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}],S)=>{const D=j[s]>0,R=j[s]===m.length&&m.length>0,O=w[s];return e.jsxs(ce.Fragment,{children:[e.jsx(Z,{sx:{borderBottom:({palette:i})=>S<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:D&&!R,onChange:i=>{i.stopPropagation(),z(m,R)}}),label:e.jsxs(d,{sx:{display:"flex",alignItems:"center",gap:1},children:[l.logo&&e.jsx($e,{src:l.logo,sx:{width:24,height:24}}),e.jsx(d,{children:l.title||s}),D&&e.jsx(L,{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(C,{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:O?e.jsx(Pe,{}):e.jsx(qe,{})})]})]})}),m.length>0&&e.jsx(Le,{in:O,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 h=`${i.type}-${i.source}`,o=!!p[h];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:o,sx:{flexShrink:0}}),e.jsxs(d,{sx:{flex:1,minWidth:0},children:[e.jsx(C,{variant:"body1",className:"webhook-event-type",sx:{cursor:"pointer",color:"text.primary",wordBreak:"break-word",overflowWrap:"break-word"},children:i.type}),e.jsx(C,{variant:"caption",sx:{color:"text.secondary",display:"block",cursor:"pointer",wordBreak:"break-word",overflowWrap:"break-word"},children:i.description})]})]})},h)})})})]},s)})})}),f&&e.jsx(Be,{error:!0,sx:{mt:1},children:f})]})}fe.propTypes={eventsBySource:t.objectOf(t.shape({source:t.shape({did:t.string.isRequired,title:t.string,description:t.string,version:t.string,logo:t.string}).isRequired,events:t.arrayOf(t.shape({type:t.string.isRequired,description:t.string.isRequired,source:t.string.isRequired})).isRequired,count:t.number.isRequired})).isRequired,selectedEvents:t.objectOf(t.bool).isRequired,setSelectedEvents:t.func.isRequired,error:t.string};function je({id:n=null,url:p="",description:c="",enabledEvents:f=[],onSubmit:r,onClose:w=()=>{}}){const{t:u}=B(),[j,a]=v.useState({}),{teamDid:b}=K(),{api:g}=V(),{loading:y,error:z,eventsBySource:I}=it(),s=We(),{control:l,handleSubmit:m,formState:{errors:k},reset:S,setValue:D,trigger:R}=tt({defaultValues:{url:"",description:""}}),O=de(s.breakpoints.down("md"));v.useEffect(()=>{const o=Object.values(j).some(x=>x);D("selectedEvents",o?"valid":""),R("selectedEvents")},[j,D,R]);const i=()=>{a({}),S(),w()},h=async o=>{const x=Object.keys(j).filter(T=>j[T]),E={url:o.url,description:o.description,enabledEvents:x.map(T=>{const[A,se]=T.split("-");return!A||!se?null:{type:A,source:se}}).filter(Boolean)};try{if(n){const T=await g.updateWebhookEndpoint({input:{teamDid:b,id:n,data:E}});q.success(`${u("webhookEndpoint.updateWebhook")} ${u("webhookEndpoint.success")}`),r(T)}else{const T=await g.createWebhookEndpoint({input:{teamDid:b,input:E}});q.success(`${u("webhookEndpoint.createWebhook")} ${u("webhookEndpoint.success")}`),r(T)}}catch(T){q.error(T?.message)}i()};return v.useEffect(()=>{S({url:p,description:c}),a(f.reduce((o,x)=>(o[`${x.type}-${x.source}`]=!0,o),{}))},[S,a,p,c,f]),e.jsx(ze,{open:!0,onClose:i,maxWidth:"lg",fullWidth:!0,fullScreen:O,sx:{"& .MuiDialog-paper":{minHeight:600}},children:e.jsxs("form",{onSubmit:m(h),children:[e.jsx(De,{children:u(n?"webhookEndpoint.editWebhookTitle":"webhookEndpoint.createWebhookTitle")}),e.jsx(Oe,{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:o})=>e.jsx(ne,{...o,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:o})=>e.jsx(ne,{...o,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:o})=>e.jsx("input",{type:"hidden",...o})}),!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(C,{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(U,{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(F,{onClick:i,children:u("common.cancel")}),e.jsx(F,{type:"submit",variant:"contained",color:"primary",children:u(n?"webhookEndpoint.updateWebhook":"webhookEndpoint.saveWebhook")})]})]})})}je.propTypes={onSubmit:t.func.isRequired,id:t.string,url:t.string,description:t.string,enabledEvents:t.arrayOf(t.shape({type:t.string.isRequired,source:t.string.isRequired})),onClose:t.func};function rt(n){switch(n){case"enabled":return"success";case"disabled":default:return"default"}}const lt=(n="en")=>n==="tw"?"zh":n;function N(n,p="YYYY-MM-DD HH:mm:ss",c="en"){return n?Xe(n).locale(lt(c)).format(p):"-"}function at(n){return typeof n=="number"?!1:be(n)}function ct(n){return n>=200&&n<300}function $({value:n,label:p,tip:c="",divider:f=!1}){const r=at(n);return e.jsxs(e.Fragment,{children:[e.jsxs(W,{direction:"column",alignItems:"flex-start",children:[e.jsxs(C,{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(C,{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})]})}$.propTypes={label:t.oneOfType([t.string,t.node]).isRequired,value:t.oneOfType([t.string,t.node]).isRequired,tip:t.oneOfType([t.string,t.node]),divider:t.bool};function ye({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(C,{variant:"h3",sx:{fontSize:{xs:"18px",md:"1.09375rem"}},component:"div",children:n}),p]})}ye.propTypes={title:t.oneOfType([t.string,t.node]).isRequired,children:t.node,mb:t.number,mt:t.number};const dt={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"/>'},pt=n=>{const p={};return n.forEach(c=>{const f=new Date(c.createdAt).toLocaleDateString();p[f]||(p[f]=[]),p[f]?.push(c)}),p};function we({eventId:n="",webhookEndpointId:p="",event:c=null}){const{api:f,ws:{useSubscription:r}}=V(),{t:w}=B(),{teamDid:u}=K(),{blocklet:j}=Ge(),{data:a,loadMore:b,loadingMore:g,loading:y,mutate:z}=Ie(o=>{const E=o?Math.ceil(o.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),S=pt(I);if(v.useEffect(()=>{!s&&a?.list.length&&l(a.list[0])},[a?.list.length,s]),r(ue.EVENTS.WEBHOOK_ATTEMPT,o=>{z(x=>{if(x.list.find(T=>T.id===o.id)){const T=x.list.map(A=>A.id===o.id?{...A,...o}:A);return{...x,list:T}}return o.endpoint=x.list[0]?.endpoint,o.event=x.list[0]?.event,{...x,list:[o,...x.list]}})},[]),y)return e.jsx(U,{});const D=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)}))},O=o=>{if(o.responseBody&&o.responseBody?.sessionId&&o.responseBody?.projectId&&o.responseBody?.agentId){const x=j?.site?.domainAliases[0]?.value,E=(j.children||[]).find(A=>A?.meta?.name==="ai-studio"),T=ot(ge(`https://${x}`,E?.mountPoint||"","projects",o.responseBody.projectId,"logs/main"),{sessionId:o.responseBody.sessionId,agentId:o.responseBody.agentId});return e.jsx(M,{sx:{fontSize:20},onClick:()=>window.open(T,"_blank"),children:e.jsx(d,{component:H,icon:Q})})}return null},i=o=>o.status==="pending"?e.jsx(Ne,{color:"warning"}):ct(o.responseStatus)?e.jsx(Ue,{color:"success"}):e.jsx(_e,{color:"error"}),h=s?.triggeredFrom&&(a?.list||[]).find(o=>o.id===s.triggeredFrom);return e.jsxs(ut,{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(S))?e.jsx(C,{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(S).map(([o,x])=>e.jsxs(ce.Fragment,{children:[e.jsx(Me,{sx:{p:0},children:o}),x.map(E=>e.jsxs(Z,{sx:{cursor:"pointer",px:1},onClick:()=>l(E),selected:s&&s?.id===E?.id,secondaryAction:e.jsx(C,{sx:{color:"text.secondary"},children:N(E.createdAt,"HH:mm:ss")}),children:[e.jsx(Fe,{sx:{minWidth:0,mr:1.5},children:i(E)}),e.jsx(He,{primary:e.jsx(C,{sx:{color:"text.primary"},children:E.event.type})})]},E.id))]},o))}),D&&e.jsx(d,{sx:{display:"flex",justifyContent:"center",alignItems:"center",width:1},children:e.jsx(F,{variant:"text",type:"button",color:"inherit",onClick:b,disabled:g,sx:{color:o=>o.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(C,{variant:"h4",children:w(`common.${s.status}`)}),e.jsx(d,{children:O(s)})]}),e.jsxs(d,{sx:{display:"flex",alignItems:"center",gap:1},children:[h&&e.jsx(P,{placement:"left",title:e.jsxs(W,{onClick:()=>l(h),sx:{gap:1,cursor:"pointer",".did-address-text":{color:"common.white"}},children:[e.jsx(xe,{showDid:!0,did:s.triggeredBy,cardType:me.Detailed,infoType:he.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(C,{variant:"body2",sx:{color:"primary.main"},children:w("webhookEndpoint.triggeredFrom")}),e.jsxs(d,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(C,{variant:"body2",children:s.id}),e.jsx(M,{onClick:()=>l(h),children:e.jsx(d,{component:H,icon:Q,sx:{fontSize:16,color:"common.white"}})})]})]})]}),slotProps:{tooltip:{sx:{maxWidth:400}}},children:e.jsx(M,{onClick:()=>l(h),children:e.jsx(d,{component:H,icon:Q,sx:{fontSize:16}})})}),e.jsxs(F,{variant:"outlined",color:"primary",size:"small",onClick:R,disabled:m,children:[e.jsx(d,{component:H,icon:dt,sx:{fontSize:16,animation:m?"spin 1s linear infinite":"none",mr:.5}}),w("notification.resend")]})]})]}),e.jsxs(d,{children:[e.jsxs(C,{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(C,{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(C,{variant:"h6",children:w("webhookEndpoint.eventData")})}),e.jsx(Y,{language:"json",sx:{margin:0},children:JSON.stringify(c.data,null,2)})]})]})]})}we.propTypes={eventId:t.string,webhookEndpointId:t.string,event:t.shape({type:t.string,data:t.object,request:t.object,requestInfo:t.object})};const ut=oe(ee)`
2
2
  @keyframes spin {
3
3
  to {
4
4
  transform: rotate(360deg);
@@ -1 +1 @@
1
- import{_ as r}from"./vendor-ux-r9bApERu.js";import{V as _,W as e}from"./index-DXScybaX.js";const m={en:_(e),ar:()=>r(()=>import("./ar-Cwm1-0yA.js"),[],import.meta.url).then(t=>_(t.default)),de:()=>r(()=>import("./de-XQM4sDLo.js"),[],import.meta.url).then(t=>_(t.default)),es:()=>r(()=>import("./es-D4zFwVhj.js"),[],import.meta.url).then(t=>_(t.default)),fr:()=>r(()=>import("./fr-BQXlmrTL.js"),[],import.meta.url).then(t=>_(t.default)),hi:()=>r(()=>import("./hi-Cdz2GskJ.js"),[],import.meta.url).then(t=>_(t.default)),id:()=>r(()=>import("./id-Q9i8FdSt.js"),[],import.meta.url).then(t=>_(t.default)),ja:()=>r(()=>import("./ja-CH8WZngC.js"),[],import.meta.url).then(t=>_(t.default)),ko:()=>r(()=>import("./ko-Nli9PwTV.js"),[],import.meta.url).then(t=>_(t.default)),pt:()=>r(()=>import("./pt-eVksFEJb.js"),[],import.meta.url).then(t=>_(t.default)),ru:()=>r(()=>import("./ru-ycnIgUGb.js"),[],import.meta.url).then(t=>_(t.default)),th:()=>r(()=>import("./th-BvLhxkpi.js"),[],import.meta.url).then(t=>_(t.default)),vi:()=>r(()=>import("./vi-BmM-09Iq.js"),[],import.meta.url).then(t=>_(t.default)),"zh-TW":()=>r(()=>import("./zh-tw-CW4J6ddt.js"),[],import.meta.url).then(t=>_(t.default)),zh:()=>r(()=>import("./zh-BkVzTN9N.js"),[],import.meta.url).then(t=>_(t.default))};export{m as t};
1
+ import{_ as r}from"./vendor-ux-r9bApERu.js";import{V as _,W as e}from"./index-DQt_6j3C.js";const m={en:_(e),ar:()=>r(()=>import("./ar-Cwm1-0yA.js"),[],import.meta.url).then(t=>_(t.default)),de:()=>r(()=>import("./de-XQM4sDLo.js"),[],import.meta.url).then(t=>_(t.default)),es:()=>r(()=>import("./es-D4zFwVhj.js"),[],import.meta.url).then(t=>_(t.default)),fr:()=>r(()=>import("./fr-BQXlmrTL.js"),[],import.meta.url).then(t=>_(t.default)),hi:()=>r(()=>import("./hi-Cdz2GskJ.js"),[],import.meta.url).then(t=>_(t.default)),id:()=>r(()=>import("./id-Q9i8FdSt.js"),[],import.meta.url).then(t=>_(t.default)),ja:()=>r(()=>import("./ja-CH8WZngC.js"),[],import.meta.url).then(t=>_(t.default)),ko:()=>r(()=>import("./ko-Nli9PwTV.js"),[],import.meta.url).then(t=>_(t.default)),pt:()=>r(()=>import("./pt-eVksFEJb.js"),[],import.meta.url).then(t=>_(t.default)),ru:()=>r(()=>import("./ru-ycnIgUGb.js"),[],import.meta.url).then(t=>_(t.default)),th:()=>r(()=>import("./th-BvLhxkpi.js"),[],import.meta.url).then(t=>_(t.default)),vi:()=>r(()=>import("./vi-BmM-09Iq.js"),[],import.meta.url).then(t=>_(t.default)),"zh-TW":()=>r(()=>import("./zh-tw-CW4J6ddt.js"),[],import.meta.url).then(t=>_(t.default)),zh:()=>r(()=>import("./zh-BkVzTN9N.js"),[],import.meta.url).then(t=>_(t.default))};export{m as t};
@@ -1 +1 @@
1
- import{r as p}from"./vendor-react-CUXIiAnY.js";import{j as a,y as b,W as t,z as y,M as E,ak as I}from"./vendor-mui-core-BPQ6AEW_.js";import{a as j}from"./vendor-hooks-PN9SWiQm.js";import{a1 as r}from"./index-DXScybaX.js";import{V as A}from"./vendor-ux-r9bApERu.js";import{l as C}from"./arrow-down.svg-C_9IZZzE.js";import{L as O,D as H}from"./vendor-mui-x-CWNb8fsW.js";import{A as R}from"./AdapterDayjs-DEl3BogQ.js";function v({value:s=null,onChange:i,error:l=!1,helperText:c="",label:h="",timezone:e="",minDateTime:f=null}){const d=j(()=>{let n=r();return s&&(n=e?r(s).tz(e):r(s)),n},[s,e]),m=n=>{const T=e?r(n).tz(e):r(n);i(new Date(T.format("YYYY-MM-DD HH:mm:00")))};return a.jsx(O,{dateAdapter:R,children:a.jsx(b,{fullWidth:!0,error:l,children:a.jsx(H,{label:h,minDateTime:f,value:d,onChange:m,slotProps:{textField:{error:l,helperText:l?c:""}},format:"YYYY-MM-DD HH:mm"})})})}v.propTypes={value:t.oneOfType([t.string,t.instanceOf(Date)]),onChange:t.func.isRequired,error:t.bool,helperText:t.string,label:t.string,timezone:t.string,minDateTime:t.instanceOf(Date)};function U(s){return a.jsx(C,{...s,width:20,height:20})}const u={MINUTES_30:30*60*1e3,HOUR_1:60*60*1e3,HOURS_3:3*60*60*1e3,DAY_1:24*60*60*1e3,DAYS_7:7*24*60*60*1e3,DAYS_30:30*24*60*60*1e3};function $({placeholder:s="",value:i="",onChange:l,timezone:c="",showError:h=!0}){const{t:e}=A(),[f,d]=p.useState(i||""),[m,n]=p.useState(null),[T,Y]=p.useState(null),x=p.useMemo(()=>[{value:u.MINUTES_30,label:`30 ${e("common.minutes")}`},{value:u.HOUR_1,label:`1 ${e("common.hour")}`},{value:u.HOURS_3,label:`3 ${e("common.hours")}`},{value:u.DAY_1,label:`1 ${e("common.day")}`},{value:u.DAYS_7,label:`7 ${e("common.days")}`},{value:u.DAYS_30,label:`30 ${e("common.days")}`},{value:"custom",label:e("common.custom")}],[e]),M=o=>{if(d(o),o==="custom"){const D=c?r().tz(c):r(),S=D.add(1,"day").toDate();Y(D),n(S),l(S)}else l(new Date(Date.now()+o))},_=o=>{n(o),l(o)};p.useEffect(()=>{i&&(x.find(D=>r(D.value).isSame(i))||(d("custom"),n(i)))},[]);const g=j(()=>h?!!(!m||r(m).isBefore(r())):!1,[m,e]);return a.jsxs(a.Fragment,{children:[a.jsx(b,{fullWidth:!0,children:a.jsx(y,{select:!0,value:f,label:s||e("team.passport.passportExpireTime"),onChange:o=>M(o.target.value),variant:"outlined",slotProps:{select:{IconComponent:U}},sx:{"& .MuiInputLabel-root":{width:"calc(100% - 46px)"}},children:x.map(o=>a.jsx(E,{value:o.value,children:o.label},o.value))})}),f==="custom"&&a.jsx(I,{children:a.jsx(v,{value:m,onChange:_,label:e("team.passport.customExpireTime"),timezone:c,error:!!g,helperText:g?e("team.passport.customExpireTimeIsInvalid"):void 0,minDateTime:T})})]})}$.propTypes={value:t.oneOfType([t.string,t.instanceOf(Date)]),onChange:t.func.isRequired,timezone:t.string,placeholder:t.string,showError:t.bool};export{$ as T};
1
+ import{r as p}from"./vendor-react-CUXIiAnY.js";import{j as a,y as b,W as t,z as y,M as E,ak as I}from"./vendor-mui-core-BPQ6AEW_.js";import{a as j}from"./vendor-hooks-PN9SWiQm.js";import{a1 as r}from"./index-DQt_6j3C.js";import{V as A}from"./vendor-ux-r9bApERu.js";import{l as C}from"./arrow-down.svg-DCPm0wfX.js";import{L as O,D as H}from"./vendor-mui-x-CWNb8fsW.js";import{A as R}from"./AdapterDayjs-DEl3BogQ.js";function v({value:s=null,onChange:i,error:l=!1,helperText:c="",label:h="",timezone:e="",minDateTime:f=null}){const d=j(()=>{let n=r();return s&&(n=e?r(s).tz(e):r(s)),n},[s,e]),m=n=>{const T=e?r(n).tz(e):r(n);i(new Date(T.format("YYYY-MM-DD HH:mm:00")))};return a.jsx(O,{dateAdapter:R,children:a.jsx(b,{fullWidth:!0,error:l,children:a.jsx(H,{label:h,minDateTime:f,value:d,onChange:m,slotProps:{textField:{error:l,helperText:l?c:""}},format:"YYYY-MM-DD HH:mm"})})})}v.propTypes={value:t.oneOfType([t.string,t.instanceOf(Date)]),onChange:t.func.isRequired,error:t.bool,helperText:t.string,label:t.string,timezone:t.string,minDateTime:t.instanceOf(Date)};function U(s){return a.jsx(C,{...s,width:20,height:20})}const u={MINUTES_30:30*60*1e3,HOUR_1:60*60*1e3,HOURS_3:3*60*60*1e3,DAY_1:24*60*60*1e3,DAYS_7:7*24*60*60*1e3,DAYS_30:30*24*60*60*1e3};function $({placeholder:s="",value:i="",onChange:l,timezone:c="",showError:h=!0}){const{t:e}=A(),[f,d]=p.useState(i||""),[m,n]=p.useState(null),[T,Y]=p.useState(null),x=p.useMemo(()=>[{value:u.MINUTES_30,label:`30 ${e("common.minutes")}`},{value:u.HOUR_1,label:`1 ${e("common.hour")}`},{value:u.HOURS_3,label:`3 ${e("common.hours")}`},{value:u.DAY_1,label:`1 ${e("common.day")}`},{value:u.DAYS_7,label:`7 ${e("common.days")}`},{value:u.DAYS_30,label:`30 ${e("common.days")}`},{value:"custom",label:e("common.custom")}],[e]),M=o=>{if(d(o),o==="custom"){const D=c?r().tz(c):r(),S=D.add(1,"day").toDate();Y(D),n(S),l(S)}else l(new Date(Date.now()+o))},_=o=>{n(o),l(o)};p.useEffect(()=>{i&&(x.find(D=>r(D.value).isSame(i))||(d("custom"),n(i)))},[]);const g=j(()=>h?!!(!m||r(m).isBefore(r())):!1,[m,e]);return a.jsxs(a.Fragment,{children:[a.jsx(b,{fullWidth:!0,children:a.jsx(y,{select:!0,value:f,label:s||e("team.passport.passportExpireTime"),onChange:o=>M(o.target.value),variant:"outlined",slotProps:{select:{IconComponent:U}},sx:{"& .MuiInputLabel-root":{width:"calc(100% - 46px)"}},children:x.map(o=>a.jsx(E,{value:o.value,children:o.label},o.value))})}),f==="custom"&&a.jsx(I,{children:a.jsx(v,{value:m,onChange:_,label:e("team.passport.customExpireTime"),timezone:c,error:!!g,helperText:g?e("team.passport.customExpireTimeIsInvalid"):void 0,minDateTime:T})})]})}$.propTypes={value:t.oneOfType([t.string,t.instanceOf(Date)]),onChange:t.func.isRequired,timezone:t.string,placeholder:t.string,showError:t.bool};export{$ as T};
@@ -1,4 +1,4 @@
1
- import{r as v,g as $e,a as qe}from"./vendor-react-CUXIiAnY.js";import{g as Ue,k as Z}from"./vendor-hooks-PN9SWiQm.js";import{j as e,ak as t,at as $,b1 as Y,a6 as B,aX as He,am as G,co as Ge,U as Ye,T as F,a3 as Ke,W as S,z as O,M as Q,I as _,cp as ge,cb as je,A as Ve,x as Ze,c3 as Qe,c4 as ee,bw as Xe,F as Je,bc as es,s as ss}from"./vendor-mui-core-BPQ6AEW_.js";import{V as A,b as W,j as ts,h as ae,z as se,H as P,n as z,i as re,P as ye,x as ve,Q as as,a2 as rs}from"./vendor-ux-r9bApERu.js";import{_ as D,o as os,a1 as be,c as M,B as J,ac as ns,e as is,Y as ls,a2 as V,b5 as cs}from"./index-DXScybaX.js";import{W as oe}from"./did-address-j4poFq12.js";import{u as N}from"./team-_EogfHX7.js";import{a as ne,r as ie,b as le,c as Se,d as X,e as ds,u as ps,f as us}from"./passport-item-3DI7pGBf.js";import{p as Ce}from"./util-IJIaP2Ju.js";import{u as ms}from"./use-mobile-ajdJIsoX.js";import{v as H}from"./index-CJ1z6qNA.js";import{w as q,P as fs}from"./permission-s1vfZfOB.js";import{C as xs}from"./Google-FE-PKKgg.js";import{c as hs}from"./create-passport-svg-CIUyZVGt.js";import{A as gs}from"./vendor-arcblock-D8WYBDYe.js";import{G as K,_ as js}from"./vendor-utils-BgSaqjGx.js";import{e as we}from"./edit.svg-Dz9cVo7r.js";import{H as ce,P as ys}from"./index-BmQjG3jd.js";import{C as Te}from"./confirm-DQ4M1D6U.js";import{L as Ie}from"./list-header-Cv_gaaAc.js";import{f as te}from"./index-DBs9Ljax.js";import{u as vs}from"./useSetState-cWrp7qoX.js";import"./lottie-web-4koyQiv_.js";import"./session-BYUJUwt5.js";import"./isURL-CFycC-gz.js";import"./use-app-logo-iwMRCv-t.js";import"./ua-parser-DP5omx3I.js";import"./base32-eAS52qli.js";import"./cloneDeep-DHlHhGOY.js";import"./lock.svg-BPCZ0CT3.js";const me="info";function Pe({createPassportSvg:c,passport:s,onCancel:p,onSwitchPassport:u=()=>{}}){const{t:f}=A(),i=Ue({tab:me}),d={info:{label:f("common.basicInfo"),value:me,component:()=>e.jsx(De,{passport:s,createPassportSvg:c})},logs:{label:f("common.logs"),value:"logs",component:()=>e.jsx(Ae,{passport:s})},related:{label:f("team.passport.related"),value:"related",component:()=>e.jsx(Le,{passport:s,onSwitchPassport:u})}},l=Object.values(d).map(({label:h,value:m})=>({label:h,value:m})).filter(h=>h.value==="related"?s.parentDid:!0),r=d[i.tab]||d.info,n=h=>{i.tab=h};return e.jsx(W,{title:f("common.passport"),onClose:p,open:!0,PaperProps:{style:{maxWidth:800,minHeight:"80vh"}},fullWidth:!0,children:e.jsxs(bs,{children:[e.jsx(t,{className:"tabs",children:e.jsx(ts,{tabs:l,current:i.tab,onChange:n,scrollButtons:"auto"})}),e.jsx(t,{className:"body",children:e.jsx(r.component,{})})]})})}Pe.propTypes={createPassportSvg:S.func.isRequired,passport:S.object.isRequired,onCancel:S.func.isRequired,onSwitchPassport:S.func};const bs=$(t)`
1
+ import{r as v,g as $e,a as qe}from"./vendor-react-CUXIiAnY.js";import{g as Ue,k as Z}from"./vendor-hooks-PN9SWiQm.js";import{j as e,ak as t,at as $,b1 as Y,a6 as B,aX as He,am as G,co as Ge,U as Ye,T as F,a3 as Ke,W as S,z as O,M as Q,I as _,cp as ge,cb as je,A as Ve,x as Ze,c3 as Qe,c4 as ee,bw as Xe,F as Je,bc as es,s as ss}from"./vendor-mui-core-BPQ6AEW_.js";import{V as A,b as W,j as ts,h as ae,z as se,H as P,n as z,i as re,P as ye,x as ve,Q as as,a2 as rs}from"./vendor-ux-r9bApERu.js";import{_ as D,o as os,a1 as be,c as M,B as J,ac as ns,e as is,Y as ls,a2 as V,b5 as cs}from"./index-DQt_6j3C.js";import{W as oe}from"./did-address-j4poFq12.js";import{u as N}from"./team-D29LjHNf.js";import{a as ne,r as ie,b as le,c as Se,d as X,e as ds,u as ps,f as us}from"./passport-item-7G49I01A.js";import{p as Ce}from"./util-CW4LiHT7.js";import{u as ms}from"./use-mobile-ajdJIsoX.js";import{v as H}from"./index-CJ1z6qNA.js";import{w as q,P as fs}from"./permission-DVlrf60Y.js";import{C as xs}from"./Google-FE-PKKgg.js";import{c as hs}from"./create-passport-svg-CIUyZVGt.js";import{A as gs}from"./vendor-arcblock-D8WYBDYe.js";import{G as K,_ as js}from"./vendor-utils-BgSaqjGx.js";import{e as we}from"./edit.svg-Dz9cVo7r.js";import{H as ce,P as ys}from"./index-rDCB37wy.js";import{C as Te}from"./confirm-F2_i30bc.js";import{L as Ie}from"./list-header-Cv_gaaAc.js";import{f as te}from"./index-DBs9Ljax.js";import{u as vs}from"./useSetState-cWrp7qoX.js";import"./lottie-web-4koyQiv_.js";import"./session-SqadLMEY.js";import"./isURL-BHeH7II4.js";import"./use-app-logo-D768RYSo.js";import"./ua-parser-DP5omx3I.js";import"./base32-eAS52qli.js";import"./cloneDeep-DHlHhGOY.js";import"./lock.svg-BPCZ0CT3.js";const me="info";function Pe({createPassportSvg:c,passport:s,onCancel:p,onSwitchPassport:u=()=>{}}){const{t:f}=A(),i=Ue({tab:me}),d={info:{label:f("common.basicInfo"),value:me,component:()=>e.jsx(De,{passport:s,createPassportSvg:c})},logs:{label:f("common.logs"),value:"logs",component:()=>e.jsx(Ae,{passport:s})},related:{label:f("team.passport.related"),value:"related",component:()=>e.jsx(Le,{passport:s,onSwitchPassport:u})}},l=Object.values(d).map(({label:h,value:m})=>({label:h,value:m})).filter(h=>h.value==="related"?s.parentDid:!0),r=d[i.tab]||d.info,n=h=>{i.tab=h};return e.jsx(W,{title:f("common.passport"),onClose:p,open:!0,PaperProps:{style:{maxWidth:800,minHeight:"80vh"}},fullWidth:!0,children:e.jsxs(bs,{children:[e.jsx(t,{className:"tabs",children:e.jsx(ts,{tabs:l,current:i.tab,onChange:n,scrollButtons:"auto"})}),e.jsx(t,{className:"body",children:e.jsx(r.component,{})})]})})}Pe.propTypes={createPassportSvg:S.func.isRequired,passport:S.object.isRequired,onCancel:S.func.isRequired,onSwitchPassport:S.func};const bs=$(t)`
2
2
  margin-top: -16px;
3
3
 
4
4
  .tabs {