@abtnode/blocklet-services 1.17.8 → 1.17.9

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 (128) hide show
  1. package/dist/assets/{Google-CG1lv5ol.js → Google-BpkBLSiL.js} +1 -1
  2. package/dist/assets/{access-control-CWoVUHgh.js → access-control-BIhY5wfd.js} +1 -1
  3. package/dist/assets/{actions-rfPaFLCj.js → actions-Cqfaor6G.js} +1 -1
  4. package/dist/assets/{add-component-core-D0UktG5E.js → add-component-core-B8HzULLJ.js} +1 -1
  5. package/dist/assets/{add-resource-B7lRLkA_.js → add-resource-CEddRkJz.js} +1 -1
  6. package/dist/assets/{advanced-ymKehsrI.js → advanced-DkQUAOtW.js} +1 -1
  7. package/dist/assets/{aigne-yDpeUg7z.js → aigne-BXMpb7iF.js} +1 -1
  8. package/dist/assets/{appearance-CG-6r2py.js → appearance-xmocGS9K.js} +1 -1
  9. package/dist/assets/{audit-logs-C-OsN7ub.js → audit-logs-BJPoC3sp.js} +1 -1
  10. package/dist/assets/{authorize-DjikDURs.js → authorize-CeTEulz5.js} +1 -1
  11. package/dist/assets/{base32-BFSrw7-h.js → base32-Cx5Qjcq5.js} +1 -1
  12. package/dist/assets/{bind-account-BVdU9BOU.js → bind-account-Dpc4iwR3.js} +1 -1
  13. package/dist/assets/{branding-D6MicIet.js → branding-Bz1ajNEX.js} +1 -1
  14. package/dist/assets/{branding-C42_zeHW.js → branding-OeU_TRNz.js} +1 -1
  15. package/dist/assets/{branding-CqLoLW7D.js → branding-vz6onXUa.js} +1 -1
  16. package/dist/assets/{bundle-avatar-7Wt_FbiF.js → bundle-avatar-CQ5BcuIS.js} +1 -1
  17. package/dist/assets/{complete-ziHMeIgC.js → complete-RloCU6Dp.js} +1 -1
  18. package/dist/assets/{component-Djqgi00F.js → component-Cjmzo-fv.js} +2 -2
  19. package/dist/assets/{config-Bko_B6fT.js → config-Bb4cFHRC.js} +1 -1
  20. package/dist/assets/{config-BQiW0tZA.js → config-CJmL1lNg.js} +1 -1
  21. package/dist/assets/{config-navigation-BwAXHqA4.js → config-navigation-CV6BVvIo.js} +2 -2
  22. package/dist/assets/{config-DtX2hGRq.js → config-rELfdDu6.js} +1 -1
  23. package/dist/assets/{config-space-DMk4apM9.js → config-space-CjtdFXkd.js} +1 -1
  24. package/dist/assets/{confirm-BMWka5pp.js → confirm-DhDNorbd.js} +1 -1
  25. package/dist/assets/{connect-D7P92kCs.js → connect-DrvWw6WK.js} +1 -1
  26. package/dist/assets/{connect-BP5XU00d.js → connect-J76vh4nC.js} +1 -1
  27. package/dist/assets/{connect-CzwZd1QL.js → connect-pvi_9C1U.js} +1 -1
  28. package/dist/assets/{connect-to-D5tNZXTo.js → connect-to-BRIhV6_s.js} +1 -1
  29. package/dist/assets/{dashboard-BZs_YRr4.js → dashboard-OrVG8J2E.js} +2 -2
  30. package/dist/assets/{delete-confirm-CwOFci6r.js → delete-confirm-C0N4quT9.js} +1 -1
  31. package/dist/assets/{domain-CvkFdrHE.js → domain-DRBQmuep.js} +1 -1
  32. package/dist/assets/{domain-action-card-D9LF4Rpy.js → domain-action-card-BXg1GQv4.js} +1 -1
  33. package/dist/assets/{domains-BeQB_OAv.js → domains-ClxiW6KS.js} +1 -1
  34. package/dist/assets/{email-DmH_Ukt2.js → email-QHwvdq0F.js} +1 -1
  35. package/dist/assets/engine-BmJsBu5Z.js +1 -0
  36. package/dist/assets/{exchange-passport-CidDSOuv.js → exchange-passport-_nLFQuN2.js} +1 -1
  37. package/dist/assets/{federated-detail-dialog-CkIKuPwA.js → federated-detail-dialog-B3FXukx8.js} +1 -1
  38. package/dist/assets/{form-DwiizKm1.js → form-BEZi0to4.js} +1 -1
  39. package/dist/assets/{fuel-D1KEpJ7m.js → fuel-D3ouL-7h.js} +1 -1
  40. package/dist/assets/{gen-access-key-rsAO4mAP.js → gen-access-key-DDpUJQ6-.js} +1 -1
  41. package/dist/assets/{gen-simple-access-key-DGcsvu3t.js → gen-simple-access-key-BTB-PYVK.js} +1 -1
  42. package/dist/assets/{get-safe-url-C1Ml6qBb.js → get-safe-url-uxJSMQTF.js} +1 -1
  43. package/dist/assets/{home-DKIZCHrI.js → home-BuvlMo1H.js} +1 -1
  44. package/dist/assets/{iframe-eNnbtEC_.js → iframe-CVEnFycA.js} +1 -1
  45. package/dist/assets/{index-DliNbpRr.js → index--yN2lwQm.js} +1 -1
  46. package/dist/assets/{index-BDz_o8O7.js → index-8APBdkv_.js} +1 -1
  47. package/dist/assets/{index-BVgxwS3B.js → index-BLYrVxV3.js} +1 -1
  48. package/dist/assets/{index-3rd8tEjJ.js → index-BLi7-52u.js} +1 -1
  49. package/dist/assets/{index-CPwDD0Vr.js → index-BaK_cJO7.js} +1 -1
  50. package/dist/assets/{index-B4YwAnux.js → index-Bz8EYhmA.js} +1 -1
  51. package/dist/assets/{index-DtobDjZ_.js → index-C0ZPC8OS.js} +1 -1
  52. package/dist/assets/{index-BjD8juw_.js → index-C2_MQP4T.js} +1 -1
  53. package/dist/assets/{index-BKqykGJ0.js → index-C2jYGrXX.js} +1 -1
  54. package/dist/assets/{index-ChjBQq8c.js → index-C9rUhDwd.js} +1 -1
  55. package/dist/assets/{index-fulV4VYn.js → index-CBR-Vn-z.js} +1 -1
  56. package/dist/assets/{index-BqN4XYa3.js → index-CEH7q22l.js} +1 -1
  57. package/dist/assets/{index-QkGGubJA.js → index-CNX69Q5e.js} +1 -1
  58. package/dist/assets/{index-qy92cIq_.js → index-CUa0qHck.js} +1 -1
  59. package/dist/assets/{index-DPBkkhMC.js → index-CZWagtq4.js} +1 -1
  60. package/dist/assets/{index-C_8V6Zdm.js → index-C_LVs1QE.js} +1 -1
  61. package/dist/assets/{index-CRVOCdMR.js → index-CbgqxO1V.js} +1 -1
  62. package/dist/assets/{index-BgdIPmn8.js → index-CeSwZI3Q.js} +1 -1
  63. package/dist/assets/{index-DOtXGGiB.js → index-CeaSaqPE.js} +1 -1
  64. package/dist/assets/{index-DcM4ljaV.js → index-CgSpL7jz.js} +4 -4
  65. package/dist/assets/{index-dA_JPQDw.js → index-CiGaRVW9.js} +1 -1
  66. package/dist/assets/{index-6ovPLp0y.js → index-D0mTUcjJ.js} +2 -2
  67. package/dist/assets/{index-BtpVtm9d.js → index-DI80KOep.js} +1 -1
  68. package/dist/assets/{index-EZZK7Nyo.js → index-DwaBdfGv.js} +3 -3
  69. package/dist/assets/{index-CEsBpdP3.js → index-DzOChX1R.js} +1 -1
  70. package/dist/assets/{index-rwBbhEdR.js → index-WAnZs-pf.js} +1 -1
  71. package/dist/assets/{index-DjpY9R14.js → index-_llkmI7F.js} +1 -1
  72. package/dist/assets/{index-t0K-45aJ.js → index-k0OLPTEM.js} +1 -1
  73. package/dist/assets/{info-outline-rounded-CxbBCZbx.js → info-outline-rounded-CmLwPXzn.js} +1 -1
  74. package/dist/assets/{invitation-tRY9vnXE.js → invitation-CcqRXA0x.js} +1 -1
  75. package/dist/assets/{invitations-Db5hitbJ.js → invitations-Rtn4ZgkA.js} +1 -1
  76. package/dist/assets/{invite-FhylBBBB.js → invite-BVCWrw1u.js} +1 -1
  77. package/dist/assets/{issue-passport-BMFNH3nj.js → issue-passport-D9KC0G_A.js} +1 -1
  78. package/dist/assets/{item-CHfrpFLz.js → item-Cno3GsuG.js} +1 -1
  79. package/dist/assets/{layout-ej-JNJCP.js → layout-DkUZePxy.js} +1 -1
  80. package/dist/assets/{list-CIMWgr08.js → list-BaZEqvv_.js} +1 -1
  81. package/dist/assets/{list-DX9meaEq.js → list-qpUoyhan.js} +1 -1
  82. package/dist/assets/{localization-DJF_aQrB.js → localization-VWhLouBc.js} +1 -1
  83. package/dist/assets/{log-C-XJlJmX.js → log-CGsJ5N6b.js} +1 -1
  84. package/dist/assets/{login-WWa0obto.js → login-BUZAiJi7.js} +1 -1
  85. package/dist/assets/{login-oauth-callback-558tm7Kk.js → login-oauth-callback-D7IVWJCK.js} +1 -1
  86. package/dist/assets/{logo-uploader-C_AnxhNP.js → logo-uploader-CEZXDf8O.js} +1 -1
  87. package/dist/assets/{lost-passport-DauVMfLO.js → lost-passport-BShdkOY2.js} +1 -1
  88. package/dist/assets/{metadata-CbEG9b2n.js → metadata-iEUnwzkK.js} +1 -1
  89. package/dist/assets/{open-window-hkynwoL5.js → open-window-CKutfNqx.js} +1 -1
  90. package/dist/assets/{over-due-invoice-payment-CPLJV5KG.js → over-due-invoice-payment-D6491JHf.js} +1 -1
  91. package/dist/assets/{overview-JVbZ7hCB.js → overview-ns7CHx6H.js} +1 -1
  92. package/dist/assets/{passport-bxIQRuHM.js → passport-2AVRJTQK.js} +1 -1
  93. package/dist/assets/{passport-item-C7svpOMT.js → passport-item-CeYGFFGn.js} +1 -1
  94. package/dist/assets/{permission-CiRkLVwn.js → permission-C2bdzuoM.js} +1 -1
  95. package/dist/assets/{preferences-DgvuFkNS.js → preferences-Bm3lpvWM.js} +1 -1
  96. package/dist/assets/{profile-embed-DyHkusY5.js → profile-embed-CBiaNgfm.js} +1 -1
  97. package/dist/assets/{publish-resource-DqQSmKCy.js → publish-resource-Cb8cFftb.js} +1 -1
  98. package/dist/assets/{runtime-OuwOSzER.js → runtime-W3sVCToB.js} +1 -1
  99. package/dist/assets/sdk-CuoW9qgj.js +1 -0
  100. package/dist/assets/{security-DwWYfqfY.js → security-FuAWjgqg.js} +1 -1
  101. package/dist/assets/{session-D6Z4R7oi.js → session-BEf_KK-i.js} +1 -1
  102. package/dist/assets/{setup-N7vDP87_.js → setup-BUrG-d2H.js} +1 -1
  103. package/dist/assets/{spaces-B8t2gKsu.js → spaces-DiyZ082O.js} +1 -1
  104. package/dist/assets/{start-D0WlW7li.js → start-Rwj2OQ5m.js} +1 -1
  105. package/dist/assets/{starting-progress--6NzzPU1.js → starting-progress-s-XqSluO.js} +1 -1
  106. package/dist/assets/{status-DI89bjlc.js → status-CTDbw135.js} +1 -1
  107. package/dist/assets/{step-actions-D0ooBDiZ.js → step-actions-Ezqn_AMv.js} +1 -1
  108. package/dist/assets/{studio-fGrv4L1C.js → studio-CYIn9aNz.js} +1 -1
  109. package/dist/assets/{team-sypU8pIA.js → team-Bso_Sjaa.js} +1 -1
  110. package/dist/assets/{traffic-CB937Mlw.js → traffic-BqxYiIWh.js} +1 -1
  111. package/dist/assets/{transfer-C29v213E.js → transfer-OPn3RlKK.js} +1 -1
  112. package/dist/assets/{unsubscribe-D4mqt-ru.js → unsubscribe-CdltWhMv.js} +1 -1
  113. package/dist/assets/{use-app-logo-Dt5Rf_oh.js → use-app-logo-DcBQK--f.js} +1 -1
  114. package/dist/assets/{user-center-BNVLcFuw.js → user-center-Bc5-qHT9.js} +2 -2
  115. package/dist/assets/{user-follower-BF8dghPj.js → user-follower-D8zGIprF.js} +1 -1
  116. package/dist/assets/{util-BKm61knf.js → util-CIgNPQhV.js} +1 -1
  117. package/dist/assets/{util-C7ejGMZd.js → util-Cz5-V-1E.js} +1 -1
  118. package/dist/assets/{utils-yU0z64Pf.js → utils-CWRBZd9l.js} +1 -1
  119. package/dist/assets/{wait-connect-B1z3SEpN.js → wait-connect-2CirehkG.js} +1 -1
  120. package/dist/assets/{wallet-hidden-topbar-SQtOXLKg.js → wallet-hidden-topbar-CZaZNW94.js} +1 -1
  121. package/dist/assets/{wizard-components-Dxf0c0dt.js → wizard-components-BwA5watz.js} +1 -1
  122. package/dist/assets/{wizard-DwUESHQa.js → wizard-xTNgKfB7.js} +1 -1
  123. package/dist/assets/{wrap-locale-Ck3xud_e.js → wrap-locale-AxlzuLIu.js} +1 -1
  124. package/dist/assets/{zh-oZCQbfAf.js → zh-BYHnQ2ca.js} +1 -1
  125. package/dist/index.html +1 -1
  126. package/package.json +23 -23
  127. package/dist/assets/engine-CvxZhwAf.js +0 -1
  128. package/dist/assets/sdk-BDbUPswI.js +0 -1
@@ -1,4 +1,4 @@
1
- import{aa as M,a3 as q,ab as N,bU as Y,b2 as ve,b3 as Ce,bS as Se}from"./vendor-ux-PO0jFgJf.js";import{x as Te,r as ae,q as Ie}from"./vendor-hooks-Ca2cSNuD.js";import{r as v,a as ce}from"./vendor-react-DX7tU9aY.js";import{G as Re,L as de,j as e,Z as We,b1 as ze,a0 as De,al as d,A as ne,T as C,a7 as U,b4 as te,S as Ae,R as F,bK as ie,an as P,b6 as _,a6 as X,W as G,U as Z,aY as Oe,V as L,I as B,bQ as $e,bR as Pe,a8 as qe,F as Le,X as t,b3 as W,a4 as pe,a_ as ee,dR as Me,aM as Be,aN as Fe,dS as Ne,dT as He,dU as Ue,s as oe,aV as _e,ak as Ve,cv as Ke,cs as Ye,cu as Xe}from"./vendor-mui-core-CDEc-eG6.js";import{X as V,W as Je,M as Qe,V as Ge,ah as Ze,cJ as J,aV as ue,aW as xe,aX as he}from"./index-DcM4ljaV.js";import{S as et}from"./switch-BiObK5C0.js";import{b as K}from"./team-sypU8pIA.js";import{u as tt}from"./use-mobile-CnCzXOEv.js";import{u as ot,C as Q}from"./index.esm-C4tuRtuv.js";import{y as me,a as ge,F as st}from"./vendor-utils-_C9URqjS.js";import{C as nt}from"./confirm-BMWka5pp.js";import{A as it}from"./actions-C6EeERSU.js";import{T as re}from"./table-tips-CRXYL7Hz.js";import"./vendor-arcblock-BVQTtbN-.js";import"./session-D6Z4R7oi.js";import"./purify.es-HRjpPm7y.js";import"./wallet-hidden-topbar-SQtOXLKg.js";import"./theme-mode-toggle-WRMGhjzA.js";import"./use-mobile-DKWj9MJD.js";import"./index-BVgxwS3B.js";import"./isURL-CpQHQuaa.js";import"./isIP-BBY240SU.js";import"./use-blocklet-logo-nVOJALp0.js";import"./use-app-logo-Dt5Rf_oh.js";import"./index-DBs9Ljax.js";const rt=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(me(j,Je,"/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 be({eventsBySource:n,selectedEvents:p,setSelectedEvents:c,error:f=null}){const{t:r}=M(),[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(X,{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,A=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(X,{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(Oe,{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(B,{size:"small",edge:"end",children:A?e.jsx($e,{}):e.jsx(Pe,{})})]})]})}),m.length>0&&e.jsx(qe,{in:A,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(X,{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(Le,{error:!0,sx:{mt:1},children:f})]})}be.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 fe({id:n=null,url:p="",description:c="",enabledEvents:f=[],onSubmit:r,onClose:w=()=>{}}){const{t:u}=M(),[j,a]=v.useState({}),{teamDid:b}=K(),{api:g}=V(),{loading:y,error:z,eventsBySource:I}=rt(),s=Re(),{control:l,handleSubmit:m,formState:{errors:k},reset:S,setValue:D,trigger:R}=ot({defaultValues:{url:"",description:""}}),A=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[O,se]=T.split("-");return!O||!se?null:{type:O,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(We,{open:!0,onClose:i,maxWidth:"lg",fullWidth:!0,fullScreen:A,children:e.jsxs("form",{onSubmit:m(h),children:[e.jsx(ze,{children:u(n?"webhookEndpoint.editWebhookTitle":"webhookEndpoint.createWebhookTitle")}),e.jsx(De,{children:e.jsxs(d,{sx:{display:"flex",flexDirection:"column",gap:2,mt:2},children:[e.jsx(Q,{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(Q,{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(Q,{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(be,{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")})]})]})})}fe.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 lt(n){return n==="enabled"?"success":"default"}const at=(n="en")=>n==="tw"?"zh":n;function H(n,p="YYYY-MM-DD HH:mm:ss",c="en"){return n?Qe(n).locale(at(c)).format(p):"-"}function ct(n){return typeof n=="number"?!1:ge(n)}function dt(n){return n>=200&&n<300}function $({value:n,label:p,tip:c="",divider:f=!1}){const r=ct(n);return e.jsxs(e.Fragment,{children:[e.jsxs(W,{direction:"column",alignItems:"flex-start",children:[e.jsxs(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 je({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]})}je.propTypes={title:t.oneOfType([t.string,t.node]).isRequired,children:t.node,mb:t.number,mt:t.number};const pt={width:24,height:24,body:'<path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M20 11A8.1 8.1 0 0 0 4.5 9M4 5v4h4m-4 4a8.1 8.1 0 0 0 15.5 2m.5 4v-4h-4"/>'},ut=n=>{const p={};return n.forEach(c=>{const f=new Date(c.createdAt).toLocaleDateString();p[f]||(p[f]=[]),p[f]?.push(c)}),p};function ye({eventId:n="",webhookEndpointId:p="",event:c=null}){const{api:f,ws:{useSubscription:r}}=V(),{t:w}=M(),{teamDid:u}=K(),{blocklet:j}=Ge(),{data:a,loadMore:b,loadingMore:g,loading:y,mutate:z}=Te(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=ut(I);if(v.useEffect(()=>{!s&&a?.list.length&&l(a.list[0])},[a?.list.length,s]),r(Ze.WEBHOOK_ATTEMPT,o=>{z(x=>{if(x.list.find(T=>T.id===o.id)){const T=x.list.map(O=>O.id===o.id?{...O,...o}:O);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)}))},A=o=>{if(o.responseBody&&o.responseBody?.sessionId&&o.responseBody?.projectId&&o.responseBody?.agentId){const x=j?.site?.domainAliases[0]?.value,E=(j.children||[]).find(O=>O?.meta?.name==="ai-studio"),T=st(me(`https://${x}`,E?.mountPoint||"","projects",o.responseBody.projectId,"logs/main"),{sessionId:o.responseBody.sessionId,agentId:o.responseBody.agentId});return e.jsx(B,{sx:{fontSize:20},onClick:()=>window.open(T,"_blank"),children:e.jsx(d,{component:N,icon:J})})}return null},i=o=>o.status==="pending"?e.jsx(Ne,{color:"warning"}):dt(o.responseStatus)?e.jsx(He,{color:"success"}):e.jsx(Ue,{color:"error"}),h=s?.triggeredFrom&&(a?.list||[]).find(o=>o.id===s.triggeredFrom);return e.jsxs(xt,{container:!0,spacing:{xs:0,md:1},sx:{height:1},children:[e.jsx(ee,{size:{xs:12,md:4},sx:{height:1},children:ge(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:H(E.createdAt,"HH:mm:ss")}),children:[e.jsx(Be,{sx:{minWidth:0,mr:1.5},children:i(E)}),e.jsx(Fe,{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:A(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(ue,{showDid:!0,did:s.triggeredBy,cardType:he.Detailed,infoType:xe.Minimal,sx:{border:0,padding:0,minWidth:0,".MuiTypography-root":{color:"common.white",fontWeight:400}}}),e.jsx(pe,{}),e.jsxs(d,{sx:{display:"flex",flexDirection:"column"},children:[e.jsx(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(B,{onClick:()=>l(h),children:e.jsx(d,{component:N,icon:J,sx:{fontSize:16,color:"common.white"}})})]})]})]}),slotProps:{tooltip:{sx:{maxWidth:400}}},children:e.jsx(B,{onClick:()=>l(h),children:e.jsx(d,{component:N,icon:J,sx:{fontSize:16}})})}),e.jsxs(F,{variant:"outlined",color:"primary",size:"small",onClick:R,disabled:m,children:[e.jsx(d,{component:N,icon:pt,sx:{fontSize:16,animation:m?"spin 1s linear infinite":"none",mr:.5}}),w("notification.resend")]})]})]}),e.jsxs(d,{children:[e.jsxs(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)})]})]})]})}ye.propTypes={eventId:t.string,webhookEndpointId:t.string,event:t.shape({type:t.string,data:t.object,request:t.object,requestInfo:t.object})};const xt=oe(ee)`
1
+ import{aa as M,a3 as q,ab as N,bU as Y,b2 as ve,b3 as Ce,bS as Se}from"./vendor-ux-PO0jFgJf.js";import{x as Te,r as ae,q as Ie}from"./vendor-hooks-Ca2cSNuD.js";import{r as v,a as ce}from"./vendor-react-DX7tU9aY.js";import{G as Re,L as de,j as e,Z as We,b1 as ze,a0 as De,al as d,A as ne,T as C,a7 as U,b4 as te,S as Ae,R as F,bK as ie,an as P,b6 as _,a6 as X,W as G,U as Z,aY as Oe,V as L,I as B,bQ as $e,bR as Pe,a8 as qe,F as Le,X as t,b3 as W,a4 as pe,a_ as ee,dR as Me,aM as Be,aN as Fe,dS as Ne,dT as He,dU as Ue,s as oe,aV as _e,ak as Ve,cv as Ke,cs as Ye,cu as Xe}from"./vendor-mui-core-CDEc-eG6.js";import{X as V,W as Je,M as Qe,V as Ge,ah as Ze,cJ as J,aV as ue,aW as xe,aX as he}from"./index-CgSpL7jz.js";import{S as et}from"./switch-BiObK5C0.js";import{b as K}from"./team-Bso_Sjaa.js";import{u as tt}from"./use-mobile-CnCzXOEv.js";import{u as ot,C as Q}from"./index.esm-C4tuRtuv.js";import{y as me,a as ge,F as st}from"./vendor-utils-_C9URqjS.js";import{C as nt}from"./confirm-DhDNorbd.js";import{A as it}from"./actions-C6EeERSU.js";import{T as re}from"./table-tips-CRXYL7Hz.js";import"./vendor-arcblock-BVQTtbN-.js";import"./session-BEf_KK-i.js";import"./purify.es-HRjpPm7y.js";import"./wallet-hidden-topbar-CZaZNW94.js";import"./theme-mode-toggle-WRMGhjzA.js";import"./use-mobile-DKWj9MJD.js";import"./index-BLYrVxV3.js";import"./isURL-CpQHQuaa.js";import"./isIP-BBY240SU.js";import"./use-blocklet-logo-nVOJALp0.js";import"./use-app-logo-DcBQK--f.js";import"./index-DBs9Ljax.js";const rt=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(me(j,Je,"/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 be({eventsBySource:n,selectedEvents:p,setSelectedEvents:c,error:f=null}){const{t:r}=M(),[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(X,{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,A=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(X,{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(Oe,{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(B,{size:"small",edge:"end",children:A?e.jsx($e,{}):e.jsx(Pe,{})})]})]})}),m.length>0&&e.jsx(qe,{in:A,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(X,{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(Le,{error:!0,sx:{mt:1},children:f})]})}be.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 fe({id:n=null,url:p="",description:c="",enabledEvents:f=[],onSubmit:r,onClose:w=()=>{}}){const{t:u}=M(),[j,a]=v.useState({}),{teamDid:b}=K(),{api:g}=V(),{loading:y,error:z,eventsBySource:I}=rt(),s=Re(),{control:l,handleSubmit:m,formState:{errors:k},reset:S,setValue:D,trigger:R}=ot({defaultValues:{url:"",description:""}}),A=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[O,se]=T.split("-");return!O||!se?null:{type:O,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(We,{open:!0,onClose:i,maxWidth:"lg",fullWidth:!0,fullScreen:A,children:e.jsxs("form",{onSubmit:m(h),children:[e.jsx(ze,{children:u(n?"webhookEndpoint.editWebhookTitle":"webhookEndpoint.createWebhookTitle")}),e.jsx(De,{children:e.jsxs(d,{sx:{display:"flex",flexDirection:"column",gap:2,mt:2},children:[e.jsx(Q,{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(Q,{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(Q,{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(be,{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")})]})]})})}fe.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 lt(n){return n==="enabled"?"success":"default"}const at=(n="en")=>n==="tw"?"zh":n;function H(n,p="YYYY-MM-DD HH:mm:ss",c="en"){return n?Qe(n).locale(at(c)).format(p):"-"}function ct(n){return typeof n=="number"?!1:ge(n)}function dt(n){return n>=200&&n<300}function $({value:n,label:p,tip:c="",divider:f=!1}){const r=ct(n);return e.jsxs(e.Fragment,{children:[e.jsxs(W,{direction:"column",alignItems:"flex-start",children:[e.jsxs(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 je({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]})}je.propTypes={title:t.oneOfType([t.string,t.node]).isRequired,children:t.node,mb:t.number,mt:t.number};const pt={width:24,height:24,body:'<path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M20 11A8.1 8.1 0 0 0 4.5 9M4 5v4h4m-4 4a8.1 8.1 0 0 0 15.5 2m.5 4v-4h-4"/>'},ut=n=>{const p={};return n.forEach(c=>{const f=new Date(c.createdAt).toLocaleDateString();p[f]||(p[f]=[]),p[f]?.push(c)}),p};function ye({eventId:n="",webhookEndpointId:p="",event:c=null}){const{api:f,ws:{useSubscription:r}}=V(),{t:w}=M(),{teamDid:u}=K(),{blocklet:j}=Ge(),{data:a,loadMore:b,loadingMore:g,loading:y,mutate:z}=Te(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=ut(I);if(v.useEffect(()=>{!s&&a?.list.length&&l(a.list[0])},[a?.list.length,s]),r(Ze.WEBHOOK_ATTEMPT,o=>{z(x=>{if(x.list.find(T=>T.id===o.id)){const T=x.list.map(O=>O.id===o.id?{...O,...o}:O);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)}))},A=o=>{if(o.responseBody&&o.responseBody?.sessionId&&o.responseBody?.projectId&&o.responseBody?.agentId){const x=j?.site?.domainAliases[0]?.value,E=(j.children||[]).find(O=>O?.meta?.name==="ai-studio"),T=st(me(`https://${x}`,E?.mountPoint||"","projects",o.responseBody.projectId,"logs/main"),{sessionId:o.responseBody.sessionId,agentId:o.responseBody.agentId});return e.jsx(B,{sx:{fontSize:20},onClick:()=>window.open(T,"_blank"),children:e.jsx(d,{component:N,icon:J})})}return null},i=o=>o.status==="pending"?e.jsx(Ne,{color:"warning"}):dt(o.responseStatus)?e.jsx(He,{color:"success"}):e.jsx(Ue,{color:"error"}),h=s?.triggeredFrom&&(a?.list||[]).find(o=>o.id===s.triggeredFrom);return e.jsxs(xt,{container:!0,spacing:{xs:0,md:1},sx:{height:1},children:[e.jsx(ee,{size:{xs:12,md:4},sx:{height:1},children:ge(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:H(E.createdAt,"HH:mm:ss")}),children:[e.jsx(Be,{sx:{minWidth:0,mr:1.5},children:i(E)}),e.jsx(Fe,{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:A(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(ue,{showDid:!0,did:s.triggeredBy,cardType:he.Detailed,infoType:xe.Minimal,sx:{border:0,padding:0,minWidth:0,".MuiTypography-root":{color:"common.white",fontWeight:400}}}),e.jsx(pe,{}),e.jsxs(d,{sx:{display:"flex",flexDirection:"column"},children:[e.jsx(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(B,{onClick:()=>l(h),children:e.jsx(d,{component:N,icon:J,sx:{fontSize:16,color:"common.white"}})})]})]})]}),slotProps:{tooltip:{sx:{maxWidth:400}}},children:e.jsx(B,{onClick:()=>l(h),children:e.jsx(d,{component:N,icon:J,sx:{fontSize:16}})})}),e.jsxs(F,{variant:"outlined",color:"primary",size:"small",onClick:R,disabled:m,children:[e.jsx(d,{component:N,icon:pt,sx:{fontSize:16,animation:m?"spin 1s linear infinite":"none",mr:.5}}),w("notification.resend")]})]})]}),e.jsxs(d,{children:[e.jsxs(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)})]})]})]})}ye.propTypes={eventId:t.string,webhookEndpointId:t.string,event:t.shape({type:t.string,data:t.object,request:t.object,requestInfo:t.object})};const xt=oe(ee)`
2
2
  @keyframes spin {
3
3
  to {
4
4
  transform: rotate(360deg);
@@ -1,4 +1,4 @@
1
- import{B as xr}from"./vendor-utils-_C9URqjS.js";import{p as ae}from"./vendor-react-DX7tU9aY.js";import{cc as Se,dn as Nr,F as _r,dp as Kr,E as Xe,b6 as Tr,dq as Ur,dr as Br,ds as Je,dt as Dr,aV as Mr,ca as Lr,du as Cr}from"./vendor-ux-PO0jFgJf.js";import{cK as Pr,aL as Vr,aO as Fr}from"./index-DcM4ljaV.js";import{r as $r}from"./index-fulV4VYn.js";var Pe={exports:{}},Re={},er;function Rr(){if(er)return Re;er=1;function p(u){"@babel/helpers - typeof";return p=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(h){return typeof h}:function(h){return h&&typeof Symbol=="function"&&h.constructor===Symbol&&h!==Symbol.prototype?"symbol":typeof h},p(u)}function b(u,h,S){return Object.defineProperty(u,"prototype",{writable:!1}),u}function f(u,h){if(!(u instanceof h))throw new TypeError("Cannot call a class as a function")}function g(u,h){if(typeof h!="function"&&h!==null)throw new TypeError("Super expression must either be null or a function");u.prototype=Object.create(h&&h.prototype,{constructor:{value:u,writable:!0,configurable:!0}}),Object.defineProperty(u,"prototype",{writable:!1}),h&&N(u,h)}function N(u,h){return N=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(B,_){return B.__proto__=_,B},N(u,h)}function L(u){var h=n();return function(){var B=e(u),_;if(h){var K=e(this).constructor;_=Reflect.construct(B,arguments,K)}else _=B.apply(this,arguments);return v(this,_)}}function v(u,h){if(h&&(p(h)==="object"||typeof h=="function"))return h;if(h!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return s(u)}function s(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,h,S){S||(S=Error);function B(K,W,C){return typeof h=="string"?h:h(K,W,C)}var _=(function(K){g(C,K);var W=L(C);function C(H,ee,Z){var J;return f(this,C),J=W.call(this,B(H,ee,Z)),J.code=u,J}return b(C)})(S);r[u]=_}function q(u,h){if(Array.isArray(u)){var S=u.length;return u=u.map(function(B){return String(B)}),S>2?"one of ".concat(h," ").concat(u.slice(0,S-1).join(", "),", or ")+u[S-1]:S===2?"one of ".concat(h," ").concat(u[0]," or ").concat(u[1]):"of ".concat(h," ").concat(u[0])}else return"of ".concat(h," ").concat(String(u))}function O(u,h,S){return u.substr(0,h.length)===h}function A(u,h,S){return(S===void 0||S>u.length)&&(S=u.length),u.substring(S-h.length,S)===h}function j(u,h,S){return typeof S!="number"&&(S=0),S+h.length>u.length?!1:u.indexOf(h,S)!==-1}return l("ERR_AMBIGUOUS_ARGUMENT",'The "%s" argument is ambiguous. %s',TypeError),l("ERR_INVALID_ARG_TYPE",function(u,h,S){d===void 0&&(d=ke()),d(typeof u=="string","'name' must be a string");var B;typeof h=="string"&&O(h,"not ")?(B="must not be",h=h.replace(/^not /,"")):B="must be";var _;if(A(u," argument"))_="The ".concat(u," ").concat(B," ").concat(q(h,"type"));else{var K=j(u,".")?"property":"argument";_='The "'.concat(u,'" ').concat(K," ").concat(B," ").concat(q(h,"type"))}return _+=". Received type ".concat(p(S)),_},TypeError),l("ERR_INVALID_ARG_VALUE",function(u,h){var S=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"is invalid";y===void 0&&(y=Se());var B=y.inspect(h);return B.length>128&&(B="".concat(B.slice(0,128),"...")),"The argument '".concat(u,"' ").concat(S,". Received ").concat(B)},TypeError),l("ERR_INVALID_RETURN_VALUE",function(u,h,S){var B;return S&&S.constructor&&S.constructor.name?B="instance of ".concat(S.constructor.name):B="type ".concat(p(S)),"Expected ".concat(u,' to be returned from the "').concat(h,'"')+" function but got ".concat(B,".")},TypeError),l("ERR_MISSING_ARGS",function(){for(var u=arguments.length,h=new Array(u),S=0;S<u;S++)h[S]=arguments[S];d===void 0&&(d=ke()),d(h.length>0,"At least one arg needs to be specified");var B="The ",_=h.length;switch(h=h.map(function(K){return'"'.concat(K,'"')}),_){case 1:B+="".concat(h[0]," argument");break;case 2:B+="".concat(h[0]," and ").concat(h[1]," arguments");break;default:B+=h.slice(0,_-1).join(", "),B+=", and ".concat(h[_-1]," arguments");break}return"".concat(B," must be specified")},TypeError),Re.codes=r,Re}var Ie,rr;function Gr(){if(rr)return Ie;rr=1;function p(E,m){var U=Object.keys(E);if(Object.getOwnPropertySymbols){var x=Object.getOwnPropertySymbols(E);m&&(x=x.filter(function(V){return Object.getOwnPropertyDescriptor(E,V).enumerable})),U.push.apply(U,x)}return U}function b(E){for(var m=1;m<arguments.length;m++){var U=arguments[m]!=null?arguments[m]:{};m%2?p(Object(U),!0).forEach(function(x){f(E,x,U[x])}):Object.getOwnPropertyDescriptors?Object.defineProperties(E,Object.getOwnPropertyDescriptors(U)):p(Object(U)).forEach(function(x){Object.defineProperty(E,x,Object.getOwnPropertyDescriptor(U,x))})}return E}function f(E,m,U){return m=v(m),m in E?Object.defineProperty(E,m,{value:U,enumerable:!0,configurable:!0,writable:!0}):E[m]=U,E}function g(E,m){if(!(E instanceof m))throw new TypeError("Cannot call a class as a function")}function N(E,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(E,v(x.key),x)}}function L(E,m,U){return m&&N(E.prototype,m),Object.defineProperty(E,"prototype",{writable:!1}),E}function v(E){var m=s(E,"string");return u(m)==="symbol"?m:String(m)}function s(E,m){if(u(E)!=="object"||E===null)return E;var U=E[Symbol.toPrimitive];if(U!==void 0){var x=U.call(E,m);if(u(x)!=="object")return x;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(E)}function n(E,m){if(typeof m!="function"&&m!==null)throw new TypeError("Super expression must either be null or a function");E.prototype=Object.create(m&&m.prototype,{constructor:{value:E,writable:!0,configurable:!0}}),Object.defineProperty(E,"prototype",{writable:!1}),m&&A(E,m)}function e(E){var m=q();return function(){var x=j(E),V;if(m){var a=j(this).constructor;V=Reflect.construct(x,arguments,a)}else V=x.apply(this,arguments);return r(this,V)}}function r(E,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(E)}function d(E){if(E===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return E}function y(E){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,V)}function V(){return l(x,arguments,j(this).constructor)}return V.prototype=Object.create(x.prototype,{constructor:{value:V,enumerable:!1,writable:!0,configurable:!0}}),A(V,x)},y(E)}function l(E,m,U){return q()?l=Reflect.construct.bind():l=function(V,a,i){var c=[null];c.push.apply(c,a);var R=Function.bind.apply(V,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(E){return Function.toString.call(E).indexOf("[native code]")!==-1}function A(E,m){return A=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(x,V){return x.__proto__=V,x},A(E,m)}function j(E){return j=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(U){return U.__proto__||Object.getPrototypeOf(U)},j(E)}function u(E){"@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(E)}var h=Se(),S=h.inspect,B=Rr(),_=B.codes.ERR_INVALID_ARG_TYPE;function K(E,m,U){return(U===void 0||U>E.length)&&(U=E.length),E.substring(U-m.length,U)===m}function W(E,m){if(m=Math.floor(m),E.length==0||m==0)return"";var U=E.length*m;for(m=Math.floor(Math.log(m)/Math.log(2));m;)E+=E,m--;return E+=E.substring(0,U-E.length),E}var C="",H="",ee="",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(E){var m=Object.keys(E),U=Object.create(Object.getPrototypeOf(E));return m.forEach(function(x){U[x]=E[x]}),Object.defineProperty(U,"message",{value:E.message}),U}function oe(E){return S(E,{compact:!1,customInspect:!1,depth:1e3,maxArrayLength:1/0,showHidden:!1,breakLength:1/0,showProxy:!1,sorted:!0,getters:!0})}function ye(E,m,U){var x="",V="",a=0,i="",c=!1,R=oe(E),w=R.split(`
1
+ import{B as xr}from"./vendor-utils-_C9URqjS.js";import{p as ae}from"./vendor-react-DX7tU9aY.js";import{cc as Se,dn as Nr,F as _r,dp as Kr,E as Xe,b6 as Tr,dq as Ur,dr as Br,ds as Je,dt as Dr,aV as Mr,ca as Lr,du as Cr}from"./vendor-ux-PO0jFgJf.js";import{cK as Pr,aL as Vr,aO as Fr}from"./index-CgSpL7jz.js";import{r as $r}from"./index-CBR-Vn-z.js";var Pe={exports:{}},Re={},er;function Rr(){if(er)return Re;er=1;function p(u){"@babel/helpers - typeof";return p=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(h){return typeof h}:function(h){return h&&typeof Symbol=="function"&&h.constructor===Symbol&&h!==Symbol.prototype?"symbol":typeof h},p(u)}function b(u,h,S){return Object.defineProperty(u,"prototype",{writable:!1}),u}function f(u,h){if(!(u instanceof h))throw new TypeError("Cannot call a class as a function")}function g(u,h){if(typeof h!="function"&&h!==null)throw new TypeError("Super expression must either be null or a function");u.prototype=Object.create(h&&h.prototype,{constructor:{value:u,writable:!0,configurable:!0}}),Object.defineProperty(u,"prototype",{writable:!1}),h&&N(u,h)}function N(u,h){return N=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(B,_){return B.__proto__=_,B},N(u,h)}function L(u){var h=n();return function(){var B=e(u),_;if(h){var K=e(this).constructor;_=Reflect.construct(B,arguments,K)}else _=B.apply(this,arguments);return v(this,_)}}function v(u,h){if(h&&(p(h)==="object"||typeof h=="function"))return h;if(h!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return s(u)}function s(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,h,S){S||(S=Error);function B(K,W,C){return typeof h=="string"?h:h(K,W,C)}var _=(function(K){g(C,K);var W=L(C);function C(H,ee,Z){var J;return f(this,C),J=W.call(this,B(H,ee,Z)),J.code=u,J}return b(C)})(S);r[u]=_}function q(u,h){if(Array.isArray(u)){var S=u.length;return u=u.map(function(B){return String(B)}),S>2?"one of ".concat(h," ").concat(u.slice(0,S-1).join(", "),", or ")+u[S-1]:S===2?"one of ".concat(h," ").concat(u[0]," or ").concat(u[1]):"of ".concat(h," ").concat(u[0])}else return"of ".concat(h," ").concat(String(u))}function O(u,h,S){return u.substr(0,h.length)===h}function A(u,h,S){return(S===void 0||S>u.length)&&(S=u.length),u.substring(S-h.length,S)===h}function j(u,h,S){return typeof S!="number"&&(S=0),S+h.length>u.length?!1:u.indexOf(h,S)!==-1}return l("ERR_AMBIGUOUS_ARGUMENT",'The "%s" argument is ambiguous. %s',TypeError),l("ERR_INVALID_ARG_TYPE",function(u,h,S){d===void 0&&(d=ke()),d(typeof u=="string","'name' must be a string");var B;typeof h=="string"&&O(h,"not ")?(B="must not be",h=h.replace(/^not /,"")):B="must be";var _;if(A(u," argument"))_="The ".concat(u," ").concat(B," ").concat(q(h,"type"));else{var K=j(u,".")?"property":"argument";_='The "'.concat(u,'" ').concat(K," ").concat(B," ").concat(q(h,"type"))}return _+=". Received type ".concat(p(S)),_},TypeError),l("ERR_INVALID_ARG_VALUE",function(u,h){var S=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"is invalid";y===void 0&&(y=Se());var B=y.inspect(h);return B.length>128&&(B="".concat(B.slice(0,128),"...")),"The argument '".concat(u,"' ").concat(S,". Received ").concat(B)},TypeError),l("ERR_INVALID_RETURN_VALUE",function(u,h,S){var B;return S&&S.constructor&&S.constructor.name?B="instance of ".concat(S.constructor.name):B="type ".concat(p(S)),"Expected ".concat(u,' to be returned from the "').concat(h,'"')+" function but got ".concat(B,".")},TypeError),l("ERR_MISSING_ARGS",function(){for(var u=arguments.length,h=new Array(u),S=0;S<u;S++)h[S]=arguments[S];d===void 0&&(d=ke()),d(h.length>0,"At least one arg needs to be specified");var B="The ",_=h.length;switch(h=h.map(function(K){return'"'.concat(K,'"')}),_){case 1:B+="".concat(h[0]," argument");break;case 2:B+="".concat(h[0]," and ").concat(h[1]," arguments");break;default:B+=h.slice(0,_-1).join(", "),B+=", and ".concat(h[_-1]," arguments");break}return"".concat(B," must be specified")},TypeError),Re.codes=r,Re}var Ie,rr;function Gr(){if(rr)return Ie;rr=1;function p(E,m){var U=Object.keys(E);if(Object.getOwnPropertySymbols){var x=Object.getOwnPropertySymbols(E);m&&(x=x.filter(function(V){return Object.getOwnPropertyDescriptor(E,V).enumerable})),U.push.apply(U,x)}return U}function b(E){for(var m=1;m<arguments.length;m++){var U=arguments[m]!=null?arguments[m]:{};m%2?p(Object(U),!0).forEach(function(x){f(E,x,U[x])}):Object.getOwnPropertyDescriptors?Object.defineProperties(E,Object.getOwnPropertyDescriptors(U)):p(Object(U)).forEach(function(x){Object.defineProperty(E,x,Object.getOwnPropertyDescriptor(U,x))})}return E}function f(E,m,U){return m=v(m),m in E?Object.defineProperty(E,m,{value:U,enumerable:!0,configurable:!0,writable:!0}):E[m]=U,E}function g(E,m){if(!(E instanceof m))throw new TypeError("Cannot call a class as a function")}function N(E,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(E,v(x.key),x)}}function L(E,m,U){return m&&N(E.prototype,m),Object.defineProperty(E,"prototype",{writable:!1}),E}function v(E){var m=s(E,"string");return u(m)==="symbol"?m:String(m)}function s(E,m){if(u(E)!=="object"||E===null)return E;var U=E[Symbol.toPrimitive];if(U!==void 0){var x=U.call(E,m);if(u(x)!=="object")return x;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(E)}function n(E,m){if(typeof m!="function"&&m!==null)throw new TypeError("Super expression must either be null or a function");E.prototype=Object.create(m&&m.prototype,{constructor:{value:E,writable:!0,configurable:!0}}),Object.defineProperty(E,"prototype",{writable:!1}),m&&A(E,m)}function e(E){var m=q();return function(){var x=j(E),V;if(m){var a=j(this).constructor;V=Reflect.construct(x,arguments,a)}else V=x.apply(this,arguments);return r(this,V)}}function r(E,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(E)}function d(E){if(E===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return E}function y(E){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,V)}function V(){return l(x,arguments,j(this).constructor)}return V.prototype=Object.create(x.prototype,{constructor:{value:V,enumerable:!1,writable:!0,configurable:!0}}),A(V,x)},y(E)}function l(E,m,U){return q()?l=Reflect.construct.bind():l=function(V,a,i){var c=[null];c.push.apply(c,a);var R=Function.bind.apply(V,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(E){return Function.toString.call(E).indexOf("[native code]")!==-1}function A(E,m){return A=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(x,V){return x.__proto__=V,x},A(E,m)}function j(E){return j=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(U){return U.__proto__||Object.getPrototypeOf(U)},j(E)}function u(E){"@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(E)}var h=Se(),S=h.inspect,B=Rr(),_=B.codes.ERR_INVALID_ARG_TYPE;function K(E,m,U){return(U===void 0||U>E.length)&&(U=E.length),E.substring(U-m.length,U)===m}function W(E,m){if(m=Math.floor(m),E.length==0||m==0)return"";var U=E.length*m;for(m=Math.floor(Math.log(m)/Math.log(2));m;)E+=E,m--;return E+=E.substring(0,U-E.length),E}var C="",H="",ee="",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(E){var m=Object.keys(E),U=Object.create(Object.getPrototypeOf(E));return m.forEach(function(x){U[x]=E[x]}),Object.defineProperty(U,"message",{value:E.message}),U}function oe(E){return S(E,{compact:!1,customInspect:!1,depth:1e3,maxArrayLength:1/0,showHidden:!1,breakLength:1/0,showProxy:!1,sorted:!0,getters:!0})}function ye(E,m,U){var x="",V="",a=0,i="",c=!1,R=oe(E),w=R.split(`
2
2
  `),I=oe(m).split(`
3
3
  `),D=0,z="";if(U==="strictEqual"&&u(E)==="object"&&u(m)==="object"&&E!==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(E)!=="object"||E===null)&&(u(m)!=="object"||m===null)&&(E!==0||m!==0))return"".concat(J[U],`
4
4
 
@@ -1 +1 @@
1
- import{X as u,j as B,al as H}from"./vendor-mui-core-CDEc-eG6.js";import{r as s}from"./vendor-react-DX7tU9aY.js";import{ah as K,ai as T,aE as X,a2 as _,as as V,c0 as Y,aB as ee,ay as te,p as se,au as oe}from"./vendor-ux-PO0jFgJf.js";import{a as o,G as ie,b as v,h as re,i as ae,g as ne}from"./vendor-hooks-Ca2cSNuD.js";import{c as A,n as ce}from"./vendor-utils-_C9URqjS.js";import{a4 as I,bk as pe}from"./index-DcM4ljaV.js";function le({blocklet:d,action:c,sourceAppPid:i,connectState:p,enableSwitchApp:t}){const r=s.use(I),l=o(()=>t===!0?!0:!(t===!1||r?.session?.user&&!["login","invite","connect-to-did-space","connect-to-did-domain"].includes(c)),[c,r?.session?.user]),h=o(()=>{if(A(i)){const a=K(d),f=T(d);if(a&&f?.appPid)return f.appPid}return i},[i,d]);return{appInfoList:o(()=>X(d).filter(a=>l?!0:A(i)?A(p.sourceAppPid)?r?.session?.user?a.sourceAppPid===r.session.user.sourceAppPid:a.sourceAppPid===h:a.sourceAppPid===p.sourceAppPid:a.sourceAppPid===i),[l,i,p.sourceAppPid,h,r?.session?.user]),autoGenerateSourceAppPid:h,canSwitchApp:l}}const j=s.createContext({isWalletWebview:!1,isMobile:!1,matchSmallScreen:!1,blocklet:null}),{Provider:ue,Consumer:Se}=j;function de({children:d,blocklet:c,masterBlocklet:i=void 0,action:p,extraParams:t={},locale:r="en",testOnlyBorderColor:l=void 0,...h}){const a=ie(),[f,W]=s.useState([]),[R,E]=s.useState(!1),[b,L]=s.useState(""),N=o(()=>new Map(f.map(e=>[e.name,e])),[f]),Z=v(e=>N.get(e)),$=re(b),G=v((e,P={})=>_(pe,e,r,"en",P)),q=s.use(I),n=ae({sourceAppPid:void 0,status:"created",autoActiveWebview:!0,deeplink:void 0,chooseMethod:"",walletMethod:"",retryConnect:ce}),J=s.useRef({cancelCount:0}),m=V(),{appInfoList:x,autoGenerateSourceAppPid:w,canSwitchApp:k}=le({blocklet:c,connectState:n,action:p,sourceAppPid:t?.sourceAppPid,enableSwitchApp:t?.forceSwitch||t?.enableSwitchApp}),U=o(()=>{try{return localStorage.getItem(Y)}catch{return""}},[]),y=s.useRef(null),C=ne(y),M=o(()=>(C?.width||0)<500,[C?.width]),g=o(()=>{if(k)return{...t,sourceAppPid:A(n.sourceAppPid)?w:n.sourceAppPid};const e=T(c)?.appPid,P=T(globalThis.blocklet)?.appPid;return q?.session?.user&&(e===P||!e)?A(t?.sourceAppPid)?{...t,sourceAppPid:q.session.user?.sourceAppPid}:t:{...t,sourceAppPid:w}},[k,t,n.sourceAppPid,p,w,q?.session?.user]),z=o(()=>{const e=window?.navigator?.userAgent;return e.indexOf("Edge")>-1||e.indexOf("Edg")>-1?"edge":e.indexOf("Chrome")>-1?"chrome":"unknown"},[]);s.useEffect(()=>{n.sourceAppPid=g.sourceAppPid},[g.sourceAppPid]);const F=v(e=>{n.status=e||"created"}),S=globalThis.blocklet?ee(c):globalThis.env,O=o(()=>{if(l)return l;const e=S.appPid,P=te(e),D=P?void 0:se(e);return P?oe(e):D.color},[S.appId,l]),Q=o(()=>({isWalletWebview:m.wallet||m.arcSphere,isMobile:m.mobile.any,matchSmallScreen:M,connectState:n,staticState:J,reactiveState:n,appInfoList:x,extraParams:g,blocklet:c,masterBlocklet:i,browserBrand:z,currentAppInfo:S,currentAppColor:O,t:G,locale:r,action:p,changeStatus:F,getPlugin:Z,latestActivePlugin:$,plugins:f,setPlugins:W,selectedPlugin:b,setSelectedPlugin:L,forceUpdate:a,showWalletOptions:R,setShowWalletOptions:E,lastLoginMethod:U}),[m.wallet,m.arcSphere,m.mobile.any,M,JSON.stringify(n),JSON.stringify(x),JSON.stringify(g),c,i,r,b,a,S,O]);return B.jsx(ue,{value:Q,children:B.jsx(H,{...h,ref:y,children:d})})}de.propTypes={children:u.any.isRequired,blocklet:u.object.isRequired,masterBlocklet:u.object,action:u.string.isRequired,extraParams:u.object,locale:u.string,testOnlyBorderColor:u.string};function be(){return s.use(j)}const qe={width:24,height:24,body:'<path fill="currentColor" d="M12 17q.425 0 .713-.288T13 16v-4q0-.425-.288-.713T12 11q-.425 0-.713.288T11 12v4q0 .425.288.713T12 17Zm0-8q.425 0 .713-.288T13 8q0-.425-.288-.713T12 7q-.425 0-.713.288T11 8q0 .425.288.713T12 9Zm0 13q-2.075 0-3.9-.788t-3.175-2.137q-1.35-1.35-2.137-3.175T2 12q0-2.075.788-3.9t2.137-3.175q1.35-1.35 3.175-2.137T12 2q2.075 0 3.9.788t3.175 2.137q1.35 1.35 2.138 3.175T22 12q0 2.075-.788 3.9t-2.137 3.175q-1.35 1.35-3.175 2.138T12 22Zm0-2q3.35 0 5.675-2.325T20 12q0-3.35-2.325-5.675T12 4Q8.65 4 6.325 6.325T4 12q0 3.35 2.325 5.675T12 20Zm0-8Z"/>'};export{qe as d,de as m,be as x};
1
+ import{X as u,j as B,al as H}from"./vendor-mui-core-CDEc-eG6.js";import{r as s}from"./vendor-react-DX7tU9aY.js";import{ah as K,ai as T,aE as X,a2 as _,as as V,c0 as Y,aB as ee,ay as te,p as se,au as oe}from"./vendor-ux-PO0jFgJf.js";import{a as o,G as ie,b as v,h as re,i as ae,g as ne}from"./vendor-hooks-Ca2cSNuD.js";import{c as A,n as ce}from"./vendor-utils-_C9URqjS.js";import{a4 as I,bk as pe}from"./index-CgSpL7jz.js";function le({blocklet:d,action:c,sourceAppPid:i,connectState:p,enableSwitchApp:t}){const r=s.use(I),l=o(()=>t===!0?!0:!(t===!1||r?.session?.user&&!["login","invite","connect-to-did-space","connect-to-did-domain"].includes(c)),[c,r?.session?.user]),h=o(()=>{if(A(i)){const a=K(d),f=T(d);if(a&&f?.appPid)return f.appPid}return i},[i,d]);return{appInfoList:o(()=>X(d).filter(a=>l?!0:A(i)?A(p.sourceAppPid)?r?.session?.user?a.sourceAppPid===r.session.user.sourceAppPid:a.sourceAppPid===h:a.sourceAppPid===p.sourceAppPid:a.sourceAppPid===i),[l,i,p.sourceAppPid,h,r?.session?.user]),autoGenerateSourceAppPid:h,canSwitchApp:l}}const j=s.createContext({isWalletWebview:!1,isMobile:!1,matchSmallScreen:!1,blocklet:null}),{Provider:ue,Consumer:Se}=j;function de({children:d,blocklet:c,masterBlocklet:i=void 0,action:p,extraParams:t={},locale:r="en",testOnlyBorderColor:l=void 0,...h}){const a=ie(),[f,W]=s.useState([]),[R,E]=s.useState(!1),[b,L]=s.useState(""),N=o(()=>new Map(f.map(e=>[e.name,e])),[f]),Z=v(e=>N.get(e)),$=re(b),G=v((e,P={})=>_(pe,e,r,"en",P)),q=s.use(I),n=ae({sourceAppPid:void 0,status:"created",autoActiveWebview:!0,deeplink:void 0,chooseMethod:"",walletMethod:"",retryConnect:ce}),J=s.useRef({cancelCount:0}),m=V(),{appInfoList:x,autoGenerateSourceAppPid:w,canSwitchApp:k}=le({blocklet:c,connectState:n,action:p,sourceAppPid:t?.sourceAppPid,enableSwitchApp:t?.forceSwitch||t?.enableSwitchApp}),U=o(()=>{try{return localStorage.getItem(Y)}catch{return""}},[]),y=s.useRef(null),C=ne(y),M=o(()=>(C?.width||0)<500,[C?.width]),g=o(()=>{if(k)return{...t,sourceAppPid:A(n.sourceAppPid)?w:n.sourceAppPid};const e=T(c)?.appPid,P=T(globalThis.blocklet)?.appPid;return q?.session?.user&&(e===P||!e)?A(t?.sourceAppPid)?{...t,sourceAppPid:q.session.user?.sourceAppPid}:t:{...t,sourceAppPid:w}},[k,t,n.sourceAppPid,p,w,q?.session?.user]),z=o(()=>{const e=window?.navigator?.userAgent;return e.indexOf("Edge")>-1||e.indexOf("Edg")>-1?"edge":e.indexOf("Chrome")>-1?"chrome":"unknown"},[]);s.useEffect(()=>{n.sourceAppPid=g.sourceAppPid},[g.sourceAppPid]);const F=v(e=>{n.status=e||"created"}),S=globalThis.blocklet?ee(c):globalThis.env,O=o(()=>{if(l)return l;const e=S.appPid,P=te(e),D=P?void 0:se(e);return P?oe(e):D.color},[S.appId,l]),Q=o(()=>({isWalletWebview:m.wallet||m.arcSphere,isMobile:m.mobile.any,matchSmallScreen:M,connectState:n,staticState:J,reactiveState:n,appInfoList:x,extraParams:g,blocklet:c,masterBlocklet:i,browserBrand:z,currentAppInfo:S,currentAppColor:O,t:G,locale:r,action:p,changeStatus:F,getPlugin:Z,latestActivePlugin:$,plugins:f,setPlugins:W,selectedPlugin:b,setSelectedPlugin:L,forceUpdate:a,showWalletOptions:R,setShowWalletOptions:E,lastLoginMethod:U}),[m.wallet,m.arcSphere,m.mobile.any,M,JSON.stringify(n),JSON.stringify(x),JSON.stringify(g),c,i,r,b,a,S,O]);return B.jsx(ue,{value:Q,children:B.jsx(H,{...h,ref:y,children:d})})}de.propTypes={children:u.any.isRequired,blocklet:u.object.isRequired,masterBlocklet:u.object,action:u.string.isRequired,extraParams:u.object,locale:u.string,testOnlyBorderColor:u.string};function be(){return s.use(j)}const qe={width:24,height:24,body:'<path fill="currentColor" d="M12 17q.425 0 .713-.288T13 16v-4q0-.425-.288-.713T12 11q-.425 0-.713.288T11 12v4q0 .425.288.713T12 17Zm0-8q.425 0 .713-.288T13 8q0-.425-.288-.713T12 7q-.425 0-.713.288T11 8q0 .425.288.713T12 9Zm0 13q-2.075 0-3.9-.788t-3.175-2.137q-1.35-1.35-2.137-3.175T2 12q0-2.075.788-3.9t2.137-3.175q1.35-1.35 3.175-2.137T12 2q2.075 0 3.9.788t3.175 2.137q1.35 1.35 2.138 3.175T22 12q0 2.075-.788 3.9t-2.137 3.175q-1.35 1.35-3.175 2.138T12 22Zm0-2q3.35 0 5.675-2.325T20 12q0-3.35-2.325-5.675T12 4Q8.65 4 6.325 6.325T4 12q0 3.35 2.325 5.675T12 20Zm0-8Z"/>'};export{qe as d,de as m,be as x};
@@ -1,4 +1,4 @@
1
- import{r as n}from"./vendor-react-DX7tU9aY.js";import{j as i,bp as L,aT as h,X as s,al as y,bg as V,a7 as $,s as E}from"./vendor-mui-core-CDEc-eG6.js";import{i as H,j as T,b as j,r as A}from"./vendor-hooks-Ca2cSNuD.js";import{M as D,s as U,W as q,O as F,Q as k,T as z,U as O}from"./index-DcM4ljaV.js";import{bj as W,b1 as B,bk as Y,aa as w,a7 as X}from"./vendor-ux-PO0jFgJf.js";import{N as J}from"./index-BvUXcJcd.js";import{y as K}from"./vendor-utils-_C9URqjS.js";import{u as Q}from"./use-passport-id-B-b-_oYF.js";import{u as G}from"./session-D6Z4R7oi.js";import{b as Z}from"./sdk-BDbUPswI.js";import{w as ee}from"./wrap-locale-Ck3xud_e.js";function P({invitation:e,createPassportSvg:a,passportColor:p="auto"}){const[d,r]=n.useState(!1),{t:l}=n.useContext(W),t=n.useMemo(()=>(e.role.title||e.role.name).toUpperCase(),[e.role.title,e.role.name]),m=n.useMemo(()=>a({title:t,issuer:e.info.name,issuerDid:e.info.appDid,ownerName:"Your Name",ownerDid:e.info.appDid,preferredColor:e.info.passportColor||p,extra:e.passportExpireTime?{key:"Exp",value:D(e.passportExpireTime).format("YYYY-MM-DD HH:mm:ss")}:void 0}),[e,t]),u=n.useCallback(()=>{r(!0)},[]),o=n.useCallback(()=>{r(!1)},[]);return i.jsxs(i.Fragment,{children:[i.jsx(ie,{children:i.jsxs("div",{className:"invite-passport__card",onClick:u,children:[!!e.display&&i.jsx(J,{data:e.display,style:{width:"100%",height:"100%"}}),!e.display&&i.jsx("div",{className:"invite-passport__cover",dangerouslySetInnerHTML:{__html:m}})]})}),i.jsx(B,{open:d,title:l("invite.viewPermission"),PaperProps:{style:{minHeight:"auto",paddingBottom:"20px"}},onClose:o,children:e.role.permissions&&e.role.permissions.length>0?i.jsx("ul",{style:{listStyle:"circle",padding:"0 20px"},children:e.role.permissions.map(x=>i.jsx("li",{style:{listStyle:"circle"},children:x.description},x.name))}):i.jsxs("div",{style:{color:"#999",textAlign:"center"},children:[i.jsx(L,{style:{width:"30px",height:"30px"}}),i.jsx("div",{children:l("invite.emptyPermission")})]})})]})}P.propTypes={invitation:s.object.isRequired,createPassportSvg:s.func.isRequired,passportColor:s.string};const ie=h.div`
1
+ import{r as n}from"./vendor-react-DX7tU9aY.js";import{j as i,bp as L,aT as h,X as s,al as y,bg as V,a7 as $,s as E}from"./vendor-mui-core-CDEc-eG6.js";import{i as H,j as T,b as j,r as A}from"./vendor-hooks-Ca2cSNuD.js";import{M as D,s as U,W as q,O as F,Q as k,T as z,U as O}from"./index-CgSpL7jz.js";import{bj as W,b1 as B,bk as Y,aa as w,a7 as X}from"./vendor-ux-PO0jFgJf.js";import{N as J}from"./index-BvUXcJcd.js";import{y as K}from"./vendor-utils-_C9URqjS.js";import{u as Q}from"./use-passport-id-B-b-_oYF.js";import{u as G}from"./session-BEf_KK-i.js";import{b as Z}from"./sdk-CuoW9qgj.js";import{w as ee}from"./wrap-locale-AxlzuLIu.js";function P({invitation:e,createPassportSvg:a,passportColor:p="auto"}){const[d,r]=n.useState(!1),{t:l}=n.useContext(W),t=n.useMemo(()=>(e.role.title||e.role.name).toUpperCase(),[e.role.title,e.role.name]),m=n.useMemo(()=>a({title:t,issuer:e.info.name,issuerDid:e.info.appDid,ownerName:"Your Name",ownerDid:e.info.appDid,preferredColor:e.info.passportColor||p,extra:e.passportExpireTime?{key:"Exp",value:D(e.passportExpireTime).format("YYYY-MM-DD HH:mm:ss")}:void 0}),[e,t]),u=n.useCallback(()=>{r(!0)},[]),o=n.useCallback(()=>{r(!1)},[]);return i.jsxs(i.Fragment,{children:[i.jsx(ie,{children:i.jsxs("div",{className:"invite-passport__card",onClick:u,children:[!!e.display&&i.jsx(J,{data:e.display,style:{width:"100%",height:"100%"}}),!e.display&&i.jsx("div",{className:"invite-passport__cover",dangerouslySetInnerHTML:{__html:m}})]})}),i.jsx(B,{open:d,title:l("invite.viewPermission"),PaperProps:{style:{minHeight:"auto",paddingBottom:"20px"}},onClose:o,children:e.role.permissions&&e.role.permissions.length>0?i.jsx("ul",{style:{listStyle:"circle",padding:"0 20px"},children:e.role.permissions.map(x=>i.jsx("li",{style:{listStyle:"circle"},children:x.description},x.name))}):i.jsxs("div",{style:{color:"#999",textAlign:"center"},children:[i.jsx(L,{style:{width:"30px",height:"30px"}}),i.jsx("div",{children:l("invite.emptyPermission")})]})})]})}P.propTypes={invitation:s.object.isRequired,createPassportSvg:s.func.isRequired,passportColor:s.string};const ie=h.div`
2
2
  display: flex;
3
3
  max-width: 350px;
4
4
  margin: 30px auto;
@@ -1,3 +1,3 @@
1
- import{r}from"./vendor-react-DX7tU9aY.js";import{j as o,a7 as B,an as D,al as w,cs as L,aT as T,X as x}from"./vendor-mui-core-CDEc-eG6.js";import{bj as H,bk as M,b3 as S,b2 as Y}from"./vendor-ux-PO0jFgJf.js";import{X as z,M as E,E as N,e as P,b1 as X}from"./index-DcM4ljaV.js";import{n as A}from"./vendor-utils-_C9URqjS.js";import{b as K}from"./team-sypU8pIA.js";import{C as W}from"./confirm-BMWka5pp.js";import{P as _}from"./permission-CiRkLVwn.js";import{C as q}from"./click-to-copy-BmatCVrP.js";function F({invitations:a=[],onRefresh:v=A}){const{api:C,inService:d}=z(),{t:n,locale:y}=r.useContext(H),{teamDid:h,invitations:f,refresh:g,endpoint:l,roles:j}=K(),[i,m]=r.useState(null),[b,c]=r.useState(!1),s=r.useMemo(()=>a.length>0?a:f,[a,f]),I=async({inviteId:e})=>{if(!b){c(!0);try{await C.deleteInvitation({input:{teamDid:h,inviteId:e}}),g(),v?.(),await P(800)}catch(t){console.error(t)}finally{c(!1),m(null)}}},k=()=>{c(!1),m(null)},p=e=>l?X({inviteId:e.inviteId,endpoint:l}):"",R=[{label:n("team.inviting.link"),name:"inviteId",options:{sort:!1,customBodyRenderLite:e=>{const t=s[e];return l?o.jsx(q,{children:p(t)}):o.jsx(B,{size:16})}}},{label:n("common.role"),name:"role",widtn:70,options:{sort:!1,customBodyRender:e=>{const t=j.find(u=>u.name===e);return t?.title?o.jsx(D,{title:e,children:t.title}):e||"--"}}},{label:n("common.remark"),name:"remark",options:{sort:!1,customBodyRender:e=>e||"--"}},{label:n("team.inviting.inviter"),name:"inviter.fullName",options:{sort:!1,customBodyRender:(e,{rowIndex:t})=>s[t]?.inviter?.fullName}},{label:n("common.expires"),name:"expireDate",options:{sort:!1,customBodyRender:e=>o.jsx(w,{children:E(e).format("YYYY-MM-DD HH:mm")})}},{label:n("common.actions"),name:"",width:100,align:"center",options:{sort:!1,customBodyRenderLite:e=>{const t=s[e];return o.jsx(_,{permission:d?"":"mutate_team",role:d?N:[],children:o.jsxs(M,{onClick:()=>m({title:n("team.inviting.delete.title"),description:n("team.inviting.delete.description",{link:p(t)}),confirm:n("common.delConfirm"),cancel:n("common.cancel"),onConfirm:()=>I(t),onCancel:k}),size:"small",color:"error",variant:"text",children:[o.jsx(L,{style:{fontSize:"1.2em"}}),n("common.delete")]})})}}}];return o.jsxs(G,{children:[s.length?o.jsx(S,{locale:y,data:[...s],columns:R,verticalKeyWidth:100,options:{download:!1,filter:!1,print:!1,search:!1,viewColumns:!1}}):o.jsx(Y,{sx:{minHeight:200},children:n("common.empty")}),i&&o.jsx(W,{title:i.title,description:i.description,confirm:i.confirm,cancel:i.cancel,params:i.params,onConfirm:i.onConfirm,onCancel:i.onCancel})]})}F.propTypes={invitations:x.array,onRefresh:x.func};const G=T.div`
1
+ import{r}from"./vendor-react-DX7tU9aY.js";import{j as o,a7 as B,an as D,al as w,cs as L,aT as T,X as x}from"./vendor-mui-core-CDEc-eG6.js";import{bj as H,bk as M,b3 as S,b2 as Y}from"./vendor-ux-PO0jFgJf.js";import{X as z,M as E,E as N,e as P,b1 as X}from"./index-CgSpL7jz.js";import{n as A}from"./vendor-utils-_C9URqjS.js";import{b as K}from"./team-Bso_Sjaa.js";import{C as W}from"./confirm-DhDNorbd.js";import{P as _}from"./permission-C2bdzuoM.js";import{C as q}from"./click-to-copy-BmatCVrP.js";function F({invitations:a=[],onRefresh:v=A}){const{api:C,inService:d}=z(),{t:n,locale:y}=r.useContext(H),{teamDid:h,invitations:f,refresh:g,endpoint:l,roles:j}=K(),[i,m]=r.useState(null),[b,c]=r.useState(!1),s=r.useMemo(()=>a.length>0?a:f,[a,f]),I=async({inviteId:e})=>{if(!b){c(!0);try{await C.deleteInvitation({input:{teamDid:h,inviteId:e}}),g(),v?.(),await P(800)}catch(t){console.error(t)}finally{c(!1),m(null)}}},k=()=>{c(!1),m(null)},p=e=>l?X({inviteId:e.inviteId,endpoint:l}):"",R=[{label:n("team.inviting.link"),name:"inviteId",options:{sort:!1,customBodyRenderLite:e=>{const t=s[e];return l?o.jsx(q,{children:p(t)}):o.jsx(B,{size:16})}}},{label:n("common.role"),name:"role",widtn:70,options:{sort:!1,customBodyRender:e=>{const t=j.find(u=>u.name===e);return t?.title?o.jsx(D,{title:e,children:t.title}):e||"--"}}},{label:n("common.remark"),name:"remark",options:{sort:!1,customBodyRender:e=>e||"--"}},{label:n("team.inviting.inviter"),name:"inviter.fullName",options:{sort:!1,customBodyRender:(e,{rowIndex:t})=>s[t]?.inviter?.fullName}},{label:n("common.expires"),name:"expireDate",options:{sort:!1,customBodyRender:e=>o.jsx(w,{children:E(e).format("YYYY-MM-DD HH:mm")})}},{label:n("common.actions"),name:"",width:100,align:"center",options:{sort:!1,customBodyRenderLite:e=>{const t=s[e];return o.jsx(_,{permission:d?"":"mutate_team",role:d?N:[],children:o.jsxs(M,{onClick:()=>m({title:n("team.inviting.delete.title"),description:n("team.inviting.delete.description",{link:p(t)}),confirm:n("common.delConfirm"),cancel:n("common.cancel"),onConfirm:()=>I(t),onCancel:k}),size:"small",color:"error",variant:"text",children:[o.jsx(L,{style:{fontSize:"1.2em"}}),n("common.delete")]})})}}}];return o.jsxs(G,{children:[s.length?o.jsx(S,{locale:y,data:[...s],columns:R,verticalKeyWidth:100,options:{download:!1,filter:!1,print:!1,search:!1,viewColumns:!1}}):o.jsx(Y,{sx:{minHeight:200},children:n("common.empty")}),i&&o.jsx(W,{title:i.title,description:i.description,confirm:i.confirm,cancel:i.cancel,params:i.params,onConfirm:i.onConfirm,onCancel:i.onCancel})]})}F.propTypes={invitations:x.array,onRefresh:x.func};const G=T.div`
2
2
  margin-top: -20px;
3
3
  `;export{F as I};
@@ -1 +1 @@
1
- import{j as i,al as w}from"./vendor-mui-core-CDEc-eG6.js";import{u as g,r as v}from"./vendor-react-DX7tU9aY.js";import{b as x}from"./vendor-hooks-Ca2cSNuD.js";import{I as u}from"./invitation-tRY9vnXE.js";import{K as I}from"./landing-page-BvgQ3gcP.js";import{aa as k,ao as T}from"./vendor-ux-PO0jFgJf.js";import{u as S,m as j,W as c,b as E,d as P,H as R}from"./index-DcM4ljaV.js";import{g as W}from"./get-safe-url-C1Ml6qBb.js";import{c as b}from"./passport-bxIQRuHM.js";import"./vendor-utils-_C9URqjS.js";import"./index-BvUXcJcd.js";import"./purify.es-HRjpPm7y.js";import"./use-passport-id-B-b-_oYF.js";import"./session-D6Z4R7oi.js";import"./sdk-BDbUPswI.js";import"./wrap-locale-Ck3xud_e.js";import"./index-BjD8juw_.js";import"./use-blocklet-logo-nVOJALp0.js";import"./vendor-arcblock-BVQTtbN-.js";import"./create-passport-svg-DNOT-xbE.js";function J(m){const p=g(),{searchParams:n}=new URL(window.location.href),{api:d,session:s}=S(),{t:f}=k(),r=n.get("inviteId"),a=n.get("redirect"),h=v.useCallback(async()=>{const{data:o}=await j.get("invitation",{params:{inviteId:r}});if(!!o?.orgId&&!s.user){const t=encodeURIComponent(`${window.location.pathname}${window.location.search}`);window.location.href=`${c}/login?redirect=${t}`}return o},[r,s.user]),l=x(async(o,e=t=>t)=>{o&&o.sessionToken&&o.refreshToken&&(E(e(o.sessionToken)),P(e(o.refreshToken)),o.visitorId&&T(e(o.visitorId))),await s.refresh(),setTimeout(()=>{if(a){const t=decodeURIComponent(a);t.startsWith(c)?p(t,{replace:!0}):window.location.href=W(t)}else window.location.href=window.env.pathPrefix||"/"},50)});return i.jsxs(I,{did:window.blocklet?.appPid,children:[i.jsx(R,{children:i.jsxs("title",{children:[f("pageTitle.invite")," | ",window.blocklet?.appName]})}),i.jsx(w,{sx:{width:"560px",maxWidth:"100%",height:"100%"},className:"page-invite",children:i.jsx(u,{...m,getDataFn:h,checkFn:d.get,createPassportSvg:o=>b({...o}),onLoginSuccess:l,inService:!0})})]})}export{J as default};
1
+ import{j as i,al as w}from"./vendor-mui-core-CDEc-eG6.js";import{u as g,r as v}from"./vendor-react-DX7tU9aY.js";import{b as x}from"./vendor-hooks-Ca2cSNuD.js";import{I as u}from"./invitation-CcqRXA0x.js";import{K as I}from"./landing-page-BvgQ3gcP.js";import{aa as k,ao as T}from"./vendor-ux-PO0jFgJf.js";import{u as S,m as j,W as c,b as E,d as P,H as R}from"./index-CgSpL7jz.js";import{g as W}from"./get-safe-url-uxJSMQTF.js";import{c as b}from"./passport-2AVRJTQK.js";import"./vendor-utils-_C9URqjS.js";import"./index-BvUXcJcd.js";import"./purify.es-HRjpPm7y.js";import"./use-passport-id-B-b-_oYF.js";import"./session-BEf_KK-i.js";import"./sdk-CuoW9qgj.js";import"./wrap-locale-AxlzuLIu.js";import"./index-C2_MQP4T.js";import"./use-blocklet-logo-nVOJALp0.js";import"./vendor-arcblock-BVQTtbN-.js";import"./create-passport-svg-DNOT-xbE.js";function J(m){const p=g(),{searchParams:n}=new URL(window.location.href),{api:d,session:s}=S(),{t:f}=k(),r=n.get("inviteId"),a=n.get("redirect"),h=v.useCallback(async()=>{const{data:o}=await j.get("invitation",{params:{inviteId:r}});if(!!o?.orgId&&!s.user){const t=encodeURIComponent(`${window.location.pathname}${window.location.search}`);window.location.href=`${c}/login?redirect=${t}`}return o},[r,s.user]),l=x(async(o,e=t=>t)=>{o&&o.sessionToken&&o.refreshToken&&(E(e(o.sessionToken)),P(e(o.refreshToken)),o.visitorId&&T(e(o.visitorId))),await s.refresh(),setTimeout(()=>{if(a){const t=decodeURIComponent(a);t.startsWith(c)?p(t,{replace:!0}):window.location.href=W(t)}else window.location.href=window.env.pathPrefix||"/"},50)});return i.jsxs(I,{did:window.blocklet?.appPid,children:[i.jsx(R,{children:i.jsxs("title",{children:[f("pageTitle.invite")," | ",window.blocklet?.appName]})}),i.jsx(w,{sx:{width:"560px",maxWidth:"100%",height:"100%"},className:"page-invite",children:i.jsx(u,{...m,getDataFn:h,checkFn:d.get,createPassportSvg:o=>b({...o}),onLoginSuccess:l,inService:!0})})]})}export{J as default};
@@ -1 +1 @@
1
- import{j as e,a7 as g,al as x}from"./vendor-mui-core-CDEc-eG6.js";import{i as v,r as T,b as m}from"./vendor-hooks-Ca2cSNuD.js";import{I as k}from"./invitation-tRY9vnXE.js";import{K as I}from"./landing-page-BvgQ3gcP.js";import{aa as P,ao as j}from"./vendor-ux-PO0jFgJf.js";import{u as R,b as S,d as E,W,H as N}from"./index-DcM4ljaV.js";import{g as b}from"./get-safe-url-C1Ml6qBb.js";import{c as C}from"./passport-bxIQRuHM.js";import{u as F}from"./vendor-react-DX7tU9aY.js";import"./vendor-utils-_C9URqjS.js";import"./index-BvUXcJcd.js";import"./purify.es-HRjpPm7y.js";import"./use-passport-id-B-b-_oYF.js";import"./session-D6Z4R7oi.js";import"./sdk-BDbUPswI.js";import"./wrap-locale-Ck3xud_e.js";import"./index-BjD8juw_.js";import"./use-blocklet-logo-nVOJALp0.js";import"./vendor-arcblock-BVQTtbN-.js";import"./create-passport-svg-DNOT-xbE.js";function $(c){const{searchParams:r}=new URL(window.location.href),{api:a,session:f}=R(),d=F(),{t:u}=P(),n=r.get("id"),p=r.get("redirect"),h=v({state:""}),o=T(async()=>{if(!n)return null;const{data:t}=await a.get("/api/invitation",{params:{inviteId:n,mode:"issue-passport"}});return t}),l=m(()=>{if(o.error)throw o.error;return o?.data}),w=m(async(t,i=s=>s)=>{t&&(t.sessionToken&&S(i(t.sessionToken)),t.refreshToken&&E(i(t.refreshToken)),t.visitorId&&j(i(t.visitorId)),await f.refresh()),setTimeout(()=>{if(p){const s=decodeURIComponent(p);s.startsWith(W)?d(s,{replace:!0}):window.location.href=b(s)}else window.location.href=window.env.pathPrefix||"/"},50)});return o.loading?e.jsx(g,{}):e.jsxs(I,{did:window.blocklet?.appPid,children:[e.jsx(N,{children:e.jsxs("title",{children:[u("pageTitle.issuePassport")," | ",window.blocklet?.appName]})}),e.jsx(x,{className:"page-invite",sx:{width:"560px",maxWidth:"100%",height:"100%"},children:e.jsx(k,{...c,action:"issue-passport",getDataFn:l,checkFn:a.get,createPassportSvg:C,onLoginSuccess:w,inService:!0,status:h.state})})]})}export{$ as default};
1
+ import{j as e,a7 as g,al as x}from"./vendor-mui-core-CDEc-eG6.js";import{i as v,r as T,b as m}from"./vendor-hooks-Ca2cSNuD.js";import{I as k}from"./invitation-CcqRXA0x.js";import{K as I}from"./landing-page-BvgQ3gcP.js";import{aa as P,ao as j}from"./vendor-ux-PO0jFgJf.js";import{u as R,b as S,d as E,W,H as N}from"./index-CgSpL7jz.js";import{g as b}from"./get-safe-url-uxJSMQTF.js";import{c as C}from"./passport-2AVRJTQK.js";import{u as F}from"./vendor-react-DX7tU9aY.js";import"./vendor-utils-_C9URqjS.js";import"./index-BvUXcJcd.js";import"./purify.es-HRjpPm7y.js";import"./use-passport-id-B-b-_oYF.js";import"./session-BEf_KK-i.js";import"./sdk-CuoW9qgj.js";import"./wrap-locale-AxlzuLIu.js";import"./index-C2_MQP4T.js";import"./use-blocklet-logo-nVOJALp0.js";import"./vendor-arcblock-BVQTtbN-.js";import"./create-passport-svg-DNOT-xbE.js";function $(c){const{searchParams:r}=new URL(window.location.href),{api:a,session:f}=R(),d=F(),{t:u}=P(),n=r.get("id"),p=r.get("redirect"),h=v({state:""}),o=T(async()=>{if(!n)return null;const{data:t}=await a.get("/api/invitation",{params:{inviteId:n,mode:"issue-passport"}});return t}),l=m(()=>{if(o.error)throw o.error;return o?.data}),w=m(async(t,i=s=>s)=>{t&&(t.sessionToken&&S(i(t.sessionToken)),t.refreshToken&&E(i(t.refreshToken)),t.visitorId&&j(i(t.visitorId)),await f.refresh()),setTimeout(()=>{if(p){const s=decodeURIComponent(p);s.startsWith(W)?d(s,{replace:!0}):window.location.href=b(s)}else window.location.href=window.env.pathPrefix||"/"},50)});return o.loading?e.jsx(g,{}):e.jsxs(I,{did:window.blocklet?.appPid,children:[e.jsx(N,{children:e.jsxs("title",{children:[u("pageTitle.issuePassport")," | ",window.blocklet?.appName]})}),e.jsx(x,{className:"page-invite",sx:{width:"560px",maxWidth:"100%",height:"100%"},children:e.jsx(k,{...c,action:"issue-passport",getDataFn:l,checkFn:a.get,createPassportSvg:C,onLoginSuccess:w,inService:!0,status:h.state})})]})}export{$ as default};