@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{j as r,aT as m}from"./vendor-mui-core-CDEc-eG6.js";import{C as p}from"./content-layout-D49-hpq6.js";import{aa as c,a3 as n}from"./vendor-ux-PO0jFgJf.js";import{a5 as d,F as i}from"./index-DcM4ljaV.js";const u=m(p)`
1
+ import{j as r,aT as m}from"./vendor-mui-core-CDEc-eG6.js";import{C as p}from"./content-layout-D49-hpq6.js";import{aa as c,a3 as n}from"./vendor-ux-PO0jFgJf.js";import{a5 as d,F as i}from"./index-CgSpL7jz.js";const u=m(p)`
2
2
  display: flex;
3
3
  flex-direction: column;
4
4
  width: 100%;
@@ -1,4 +1,4 @@
1
- import{r as o}from"./vendor-react-DX7tU9aY.js";import{j as t,aY as F,X as n,G as _,n as xe,bg as ye,bd as be,cz as ve,cA as je,cB as we,al as g,T as q,R as ke,bb as te,a4 as Ie,s as Me,L as Re,I as Ce,aT as Ae}from"./vendor-mui-core-CDEc-eG6.js";import{a as D,b as O,j as Te}from"./vendor-hooks-Ca2cSNuD.js";import{aa as X,bA as Ne,ab as ne,bj as re,bT as Se}from"./vendor-ux-PO0jFgJf.js";import{t as $e}from"./server-logo-notext.svg-CtPRYaCm.js";import{B as Le}from"./bundle-avatar-7Wt_FbiF.js";import{a as ze,g as se,d as ie,u as oe,e as V,M as ae,f as Ee,m as De,h as Be,j as Pe,c as qe,i as Ve,k as Fe,l as _e,n as Oe,N as We}from"./team-sypU8pIA.js";import{a4 as He,F as Ue,y as G,a as W}from"./vendor-utils-_C9URqjS.js";import{aV as Xe,aW as Ge,aX as Ke,W as Qe,X as Ye}from"./index-DcM4ljaV.js";import{p as Je}from"./util-BKm61knf.js";function le({blocklet:e,style:r={},size:s=40,...i}){const l=ze({blocklet:e,square:!0}),{variant:u}=i;return t.jsx(F,{variant:u||"square",style:Object.assign({backgroundColor:"transparent",width:s,height:s,borderRadius:10},r),...i,children:t.jsx("img",{src:l,alt:"",style:{width:s}})})}le.propTypes={blocklet:n.object.isRequired,style:n.object,size:n.oneOfType([n.number,n.string])};function Ze(e){return e.includes(" ")?new Date(e.replace(" ","T").replace(" ","")).getTime():new Date(e).getTime()}function K({value:e="",shouldUpdate:r=!1,...s}){const{locale:i}=X(),[l,u]=o.useState(0);if(o.useEffect(()=>{let d;if(r){const p=new Date(e).getTime(),y=Date.now(),v=Math.abs(Math.floor((p-y)/1e3)),b=()=>{u(k=>{const C=Math.random()*1e3;return parseFloat((k+C).toFixed(4))})};v<60?d=setInterval(b,1e3):v<3600?d=setInterval(b,6e4):d=setInterval(b,36e5)}return()=>{clearInterval(d)}},[e,l,r]),!e)return"-";const m=Ze(e);return t.jsx(Ne,{value:m,locale:i,...s})}K.propTypes={value:n.any,shouldUpdate:n.bool};const et={error:je,warning:ve,info:be,success:ye};ce.propTypes={severity:n.oneOf(["error","warning","info","success"]).isRequired,size:n.number};function ce({severity:e="info",size:r=32}){const s=_(),l=D(()=>({error:s.palette.error.main,warning:s.palette.warning.main,info:s.palette.info.main,success:s.palette.success.main}))[e],u=et[e],m=xe(l,.1);return t.jsx(F,{sx:{width:r,height:r,bgcolor:m,color:l},children:t.jsx(u,{fontSize:"small"})})}const tt={width:24,height:24,body:'<g fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><path d="M0 0h24v24H0z"/><path fill="currentColor" d="M5.821 4.91c3.898-2.765 9.469-2.539 13.073.536c3.667 3.127 4.168 8.238 1.152 11.897c-2.842 3.447-7.965 4.583-12.231 2.805l-.232-.101l-4.375.931l-.075.013l-.11.009l-.113-.004l-.044-.005l-.11-.02l-.105-.034l-.1-.044l-.076-.042l-.108-.077l-.081-.074l-.073-.083l-.053-.075l-.065-.115l-.042-.106l-.031-.113l-.013-.075l-.009-.11l.004-.113l.005-.044l.02-.11l.022-.072l1.15-3.451l-.022-.036C.969 12.45 1.97 7.805 5.59 5.079l.23-.168z"/></g>'},nt={width:24,height:24,body:'<g fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><path d="M0 0h24v24H0z"/><path fill="currentColor" d="M12 2a5 5 0 1 1-5 5l.005-.217A5 5 0 0 1 12 2zm2 12a5 5 0 0 1 5 5v1a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2v-1a5 5 0 0 1 5-5h4z"/></g>'},rt={width:24,height:24,body:'<g fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><path d="M0 0h24v24H0z"/><path fill="currentColor" d="M17 3.34A10 10 0 1 1 2 12l.005-.324A10 10 0 0 1 17 3.34zM12 6a1 1 0 0 0-1 1a3 3 0 1 0 0 6v2a1.024 1.024 0 0 1-.866-.398l-.068-.101a1 1 0 0 0-1.732.998a3 3 0 0 0 2.505 1.5H11a1 1 0 0 0 .883.994L12 18a1 1 0 0 0 1-1l.176-.005A3 3 0 0 0 13 11V9c.358-.012.671.14.866.398l.068.101a1 1 0 0 0 1.732-.998A3 3 0 0 0 13.161 7H13a1 1 0 0 0-1-1zm1 7a1 1 0 0 1 0 2v-2zm-2-4v2a1 1 0 0 1 0-2z"/></g>'},st={width:24,height:24,body:'<g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><path d="M8 12a4 4 0 1 0 8 0a4 4 0 1 0-8 0"/><path d="M16 12v1.5a2.5 2.5 0 0 0 5 0V12a9 9 0 1 0-5.5 8.28"/></g>'},it={width:24,height:24,body:'<path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m15 10l-4 4l6 6l4-16l-18 7l4 2l2 6l3-4"/>'},Z={comment:{icon:tt,bgColor:"rgba(239, 246, 255, 1)",color:"rgba(43, 127, 255, 1)"},like:{icon:"👍",bgColor:"rgba(244, 244, 245, 1)",color:"yellow",renderType:"emoji"},follow:{icon:nt,bgColor:"rgba(238, 242, 255, 1)",color:"rgba(97, 95, 255, 1)"},tips:{icon:rt,bgColor:"rgba(254, 252, 232, 1)",color:"rgba(240, 177, 0, 1)"},mention:{icon:st,bgColor:"rgba(244, 244, 245, 1)",color:"rgba(43, 127, 255, 1)"},assign:{icon:it,bgColor:"rgba(244, 244, 245, 1)",color:"rgba(43, 127, 255, 1)"}};de.propTypes={activity:n.oneOf(["comment","like","follow","tips","mention","assign"]).isRequired,size:n.number};function de({activity:e,size:r=32}){const s=Z[e]||Z.comment,i=s.icon;return t.jsx(F,{sx:{bgcolor:s.bgColor,color:s.color,width:r,height:r},children:s.renderType==="emoji"?t.jsx("span",{style:{fontSize:"14px"},children:i}):t.jsx(ne,{icon:i})})}const H={avatar:n.string,fullName:n.string,did:n.string};function U({actor:e,size:r,teamDid:s="",inService:i=!1,showName:l=!1}){const u=D(()=>({...e,avatar:e?.avatar?Je(e.avatar,s,i):null}),[e,s,i]),m=d=>{e&&(d.stopPropagation(),window.open(Ue(G(Qe,"user"),{did:e.did}),"_blank"),d.customPreventRedirect=!0)};return t.jsxs(g,{onClick:m,role:"button",style:{cursor:"pointer"},title:e?.fullName||"",sx:{display:"flex",alignItems:"center",gap:1},children:[u.avatar?t.jsx(Xe,{user:u,showDid:!0,cardType:Ke.AvatarOnly,infoType:Ge.Minimal,avatarSize:r,shape:"circle",sx:{width:r,height:r,borderRadius:"100%",overflow:"hidden",transition:"transform 0.2s ease-in-out","&:hover":{transform:"scale(1.1)"}}}):t.jsx(F,{sx:{width:r,height:r}}),l&&t.jsx("span",{children:e?.fullName})]})}U.propTypes={actor:n.shape(H).isRequired,size:n.number.isRequired,teamDid:n.string,inService:n.bool,showName:n.bool};Q.propTypes={actors:n.oneOfType([n.shape(H),n.arrayOf(n.shape(H))]).isRequired,size:n.number,maxDisplay:n.number,teamDid:n.string,inService:n.bool,showName:n.bool,avatarFallback:n.node};function Q({actors:e,size:r=32,maxDisplay:s=9,teamDid:i="",inService:l=!0,showName:u=!1,avatarFallback:m=null}){const d=D(()=>{const p=Array.isArray(e)?e:[e];return He(p,"did").filter(Boolean)},[e]);return d.length===1||!d.length?t.jsx(U,{actor:d[0],size:r,teamDid:i,inService:l,showName:u}):t.jsx(we,{total:d.length,renderSurplus:p=>p<100?t.jsxs("span",{children:["+",p]}):t.jsx("span",{children:"99+"}),max:s,sx:{justifyContent:"flex-end",height:`${r}px`,".MuiAvatar-root":{width:`${r}px`,height:`${r}px`,fontSize:`${r/2.5}px`,border:0,zIndex:2}},children:d.map((p,y)=>p?.avatar?t.jsx(U,{actor:p,size:r,teamDid:i,inService:l},p?.did||y):m)})}const ee=3;pe.propTypes={notification:n.object.isRequired,isMultiple:n.bool,blocklet:n.object,mountPoint:n.string,avatarFallback:n.node};ue.propTypes={notification:n.object.isRequired,mountPoint:n.string};he.propTypes={items:n.array.isRequired,activity:n.object.isRequired,blocklet:n.object,mountPoint:n.string,viewMoreLink:n.string,avatarFallback:n.node};function ue({notification:e,mountPoint:r=""}){const{activity:s}=e,{type:i,meta:l={}}=s||{},u=oe({activity:s,users:[e?.actorInfo],actors:[e?.activity?.actor],mountPoint:r});return W(s)||!s.type||!s.actor||W(s.target)?null:t.jsxs(g,{children:[t.jsx(q,{variant:"body1",sx:{color:"text.secondary",mb:.5,wordBreak:"break-all"},children:u}),l?t.jsx(ae,{meta:l,type:i}):null]})}function he({items:e,activity:r,blocklet:s,mountPoint:i="",viewMoreLink:l="",avatarFallback:u=null}){const m=_(),{t:d}=X(),p=D(()=>s?.did||s?.meta?.did||"",[s]),{locale:y}=o.useContext(re),v=D(()=>!W(r.meta)&&Object.values(r.meta).some(a=>a!=null),[r]),b=oe({activity:r,users:e.map(a=>a?.actorInfo),actors:e.map(a=>a?.activity?.actor),mountPoint:i}),k=O(a=>{if(!a.activity)return null;const x=se(a.activity);return x?.metaLink?ie(x?.metaLink)?x?.metaLink:G(i,x.metaLink):null}),C=O((a,x)=>{if(!x)return;const h=k(x);h&&(window.open(h,"_blank"),a.customPreventRedirect=!0)}),S=e.length>ee,w=e.slice(0,ee);return t.jsxs(g,{sx:{width:"100%"},children:[t.jsx(q,{variant:"body1",sx:{color:"text.secondary",mb:3},children:b}),v?t.jsxs(g,{className:"sub-content",sx:{display:"flex",flexDirection:"column",gap:3},children:[w.map(a=>t.jsxs(g,{onClick:x=>C(x,a),sx:{display:"flex",flexDirection:"column",gap:1},children:[t.jsxs(g,{sx:{display:"flex",alignItems:"center",gap:1},children:[V(a)?t.jsx(Q,{actors:a.actorInfo,size:32,teamDid:p}):u,t.jsx(q,{variant:"subtitle1",sx:{color:"text.primary"},children:V(a)?a?.actorInfo?.fullName:"System"})," ","·",t.jsx(K,{value:a.createdAt,locale:y,shouldUpdate:!0,style:{color:m.palette.text.secondary,fontSize:"0.875rem",minWidth:"50px",whiteSpace:"nowrap"}})]}),a.activity.meta?t.jsx(g,{sx:{pl:5},children:t.jsx(ae,{meta:a.activity.meta,type:a.activity.type})}):null]},a.id)),S&&l?t.jsx(g,{sx:{mt:1,display:"flex",justifyContent:"center"},children:t.jsxs(ke,{size:"large",variant:"text",component:te,href:l,target:"_blank",rel:"noopener noreferrer",onClick:a=>{a.customPreventRedirect=!0},children:[d("notification.viewMore")," ",t.jsx(ne,{icon:Ee,style:{marginLeft:4}})]})}):null]}):null]})}function pe({notification:e,isMultiple:r=!1,blocklet:s,mountPoint:i="",avatarFallback:l}){const u=D(()=>{if(!e.activity)return null;const m=se(e.activity);return m?.targetLink?ie(m?.targetLink)?m?.targetLink:G(i,m.targetLink):null},[e.activity,i]);return r?t.jsx(he,{items:e.items,activity:e.activity,blocklet:s,mountPoint:i,viewMoreLink:u,avatarFallback:l}):t.jsx(ue,{notification:e,mountPoint:i})}function me({notification:e}){const r=o.useMemo(()=>{const{actions:s,action:i}=e;let l=s??[];return!l.length&&i&&(l=[{name:"Visit",link:i}]),l},[e]);return r.length?t.jsx(g,{sx:{display:"flex",justifyContent:"start",flexWrap:"wrap",alignItems:"center",gap:1},children:r.map((s,i)=>t.jsxs(o.Fragment,{children:[t.jsx(te,{href:s.link,target:"_blank",className:"link",rel:"noopener noreferrer",sx:{fontSize:"15px"},onClick:l=>{l.customPreventRedirect=!0},children:s.name},s.link),i<r.length-1?t.jsx(Ie,{orientation:"vertical",sx:{height:12,borderWidth:"1px"}}):null]},s.link))}):null}me.propTypes={notification:n.object.isRequired};const ot=Me(g)`
1
+ import{r as o}from"./vendor-react-DX7tU9aY.js";import{j as t,aY as F,X as n,G as _,n as xe,bg as ye,bd as be,cz as ve,cA as je,cB as we,al as g,T as q,R as ke,bb as te,a4 as Ie,s as Me,L as Re,I as Ce,aT as Ae}from"./vendor-mui-core-CDEc-eG6.js";import{a as D,b as O,j as Te}from"./vendor-hooks-Ca2cSNuD.js";import{aa as X,bA as Ne,ab as ne,bj as re,bT as Se}from"./vendor-ux-PO0jFgJf.js";import{t as $e}from"./server-logo-notext.svg-CtPRYaCm.js";import{B as Le}from"./bundle-avatar-CQ5BcuIS.js";import{a as ze,g as se,d as ie,u as oe,e as V,M as ae,f as Ee,m as De,h as Be,j as Pe,c as qe,i as Ve,k as Fe,l as _e,n as Oe,N as We}from"./team-Bso_Sjaa.js";import{a4 as He,F as Ue,y as G,a as W}from"./vendor-utils-_C9URqjS.js";import{aV as Xe,aW as Ge,aX as Ke,W as Qe,X as Ye}from"./index-CgSpL7jz.js";import{p as Je}from"./util-CIgNPQhV.js";function le({blocklet:e,style:r={},size:s=40,...i}){const l=ze({blocklet:e,square:!0}),{variant:u}=i;return t.jsx(F,{variant:u||"square",style:Object.assign({backgroundColor:"transparent",width:s,height:s,borderRadius:10},r),...i,children:t.jsx("img",{src:l,alt:"",style:{width:s}})})}le.propTypes={blocklet:n.object.isRequired,style:n.object,size:n.oneOfType([n.number,n.string])};function Ze(e){return e.includes(" ")?new Date(e.replace(" ","T").replace(" ","")).getTime():new Date(e).getTime()}function K({value:e="",shouldUpdate:r=!1,...s}){const{locale:i}=X(),[l,u]=o.useState(0);if(o.useEffect(()=>{let d;if(r){const p=new Date(e).getTime(),y=Date.now(),v=Math.abs(Math.floor((p-y)/1e3)),b=()=>{u(k=>{const C=Math.random()*1e3;return parseFloat((k+C).toFixed(4))})};v<60?d=setInterval(b,1e3):v<3600?d=setInterval(b,6e4):d=setInterval(b,36e5)}return()=>{clearInterval(d)}},[e,l,r]),!e)return"-";const m=Ze(e);return t.jsx(Ne,{value:m,locale:i,...s})}K.propTypes={value:n.any,shouldUpdate:n.bool};const et={error:je,warning:ve,info:be,success:ye};ce.propTypes={severity:n.oneOf(["error","warning","info","success"]).isRequired,size:n.number};function ce({severity:e="info",size:r=32}){const s=_(),l=D(()=>({error:s.palette.error.main,warning:s.palette.warning.main,info:s.palette.info.main,success:s.palette.success.main}))[e],u=et[e],m=xe(l,.1);return t.jsx(F,{sx:{width:r,height:r,bgcolor:m,color:l},children:t.jsx(u,{fontSize:"small"})})}const tt={width:24,height:24,body:'<g fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><path d="M0 0h24v24H0z"/><path fill="currentColor" d="M5.821 4.91c3.898-2.765 9.469-2.539 13.073.536c3.667 3.127 4.168 8.238 1.152 11.897c-2.842 3.447-7.965 4.583-12.231 2.805l-.232-.101l-4.375.931l-.075.013l-.11.009l-.113-.004l-.044-.005l-.11-.02l-.105-.034l-.1-.044l-.076-.042l-.108-.077l-.081-.074l-.073-.083l-.053-.075l-.065-.115l-.042-.106l-.031-.113l-.013-.075l-.009-.11l.004-.113l.005-.044l.02-.11l.022-.072l1.15-3.451l-.022-.036C.969 12.45 1.97 7.805 5.59 5.079l.23-.168z"/></g>'},nt={width:24,height:24,body:'<g fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><path d="M0 0h24v24H0z"/><path fill="currentColor" d="M12 2a5 5 0 1 1-5 5l.005-.217A5 5 0 0 1 12 2zm2 12a5 5 0 0 1 5 5v1a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2v-1a5 5 0 0 1 5-5h4z"/></g>'},rt={width:24,height:24,body:'<g fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><path d="M0 0h24v24H0z"/><path fill="currentColor" d="M17 3.34A10 10 0 1 1 2 12l.005-.324A10 10 0 0 1 17 3.34zM12 6a1 1 0 0 0-1 1a3 3 0 1 0 0 6v2a1.024 1.024 0 0 1-.866-.398l-.068-.101a1 1 0 0 0-1.732.998a3 3 0 0 0 2.505 1.5H11a1 1 0 0 0 .883.994L12 18a1 1 0 0 0 1-1l.176-.005A3 3 0 0 0 13 11V9c.358-.012.671.14.866.398l.068.101a1 1 0 0 0 1.732-.998A3 3 0 0 0 13.161 7H13a1 1 0 0 0-1-1zm1 7a1 1 0 0 1 0 2v-2zm-2-4v2a1 1 0 0 1 0-2z"/></g>'},st={width:24,height:24,body:'<g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><path d="M8 12a4 4 0 1 0 8 0a4 4 0 1 0-8 0"/><path d="M16 12v1.5a2.5 2.5 0 0 0 5 0V12a9 9 0 1 0-5.5 8.28"/></g>'},it={width:24,height:24,body:'<path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m15 10l-4 4l6 6l4-16l-18 7l4 2l2 6l3-4"/>'},Z={comment:{icon:tt,bgColor:"rgba(239, 246, 255, 1)",color:"rgba(43, 127, 255, 1)"},like:{icon:"👍",bgColor:"rgba(244, 244, 245, 1)",color:"yellow",renderType:"emoji"},follow:{icon:nt,bgColor:"rgba(238, 242, 255, 1)",color:"rgba(97, 95, 255, 1)"},tips:{icon:rt,bgColor:"rgba(254, 252, 232, 1)",color:"rgba(240, 177, 0, 1)"},mention:{icon:st,bgColor:"rgba(244, 244, 245, 1)",color:"rgba(43, 127, 255, 1)"},assign:{icon:it,bgColor:"rgba(244, 244, 245, 1)",color:"rgba(43, 127, 255, 1)"}};de.propTypes={activity:n.oneOf(["comment","like","follow","tips","mention","assign"]).isRequired,size:n.number};function de({activity:e,size:r=32}){const s=Z[e]||Z.comment,i=s.icon;return t.jsx(F,{sx:{bgcolor:s.bgColor,color:s.color,width:r,height:r},children:s.renderType==="emoji"?t.jsx("span",{style:{fontSize:"14px"},children:i}):t.jsx(ne,{icon:i})})}const H={avatar:n.string,fullName:n.string,did:n.string};function U({actor:e,size:r,teamDid:s="",inService:i=!1,showName:l=!1}){const u=D(()=>({...e,avatar:e?.avatar?Je(e.avatar,s,i):null}),[e,s,i]),m=d=>{e&&(d.stopPropagation(),window.open(Ue(G(Qe,"user"),{did:e.did}),"_blank"),d.customPreventRedirect=!0)};return t.jsxs(g,{onClick:m,role:"button",style:{cursor:"pointer"},title:e?.fullName||"",sx:{display:"flex",alignItems:"center",gap:1},children:[u.avatar?t.jsx(Xe,{user:u,showDid:!0,cardType:Ke.AvatarOnly,infoType:Ge.Minimal,avatarSize:r,shape:"circle",sx:{width:r,height:r,borderRadius:"100%",overflow:"hidden",transition:"transform 0.2s ease-in-out","&:hover":{transform:"scale(1.1)"}}}):t.jsx(F,{sx:{width:r,height:r}}),l&&t.jsx("span",{children:e?.fullName})]})}U.propTypes={actor:n.shape(H).isRequired,size:n.number.isRequired,teamDid:n.string,inService:n.bool,showName:n.bool};Q.propTypes={actors:n.oneOfType([n.shape(H),n.arrayOf(n.shape(H))]).isRequired,size:n.number,maxDisplay:n.number,teamDid:n.string,inService:n.bool,showName:n.bool,avatarFallback:n.node};function Q({actors:e,size:r=32,maxDisplay:s=9,teamDid:i="",inService:l=!0,showName:u=!1,avatarFallback:m=null}){const d=D(()=>{const p=Array.isArray(e)?e:[e];return He(p,"did").filter(Boolean)},[e]);return d.length===1||!d.length?t.jsx(U,{actor:d[0],size:r,teamDid:i,inService:l,showName:u}):t.jsx(we,{total:d.length,renderSurplus:p=>p<100?t.jsxs("span",{children:["+",p]}):t.jsx("span",{children:"99+"}),max:s,sx:{justifyContent:"flex-end",height:`${r}px`,".MuiAvatar-root":{width:`${r}px`,height:`${r}px`,fontSize:`${r/2.5}px`,border:0,zIndex:2}},children:d.map((p,y)=>p?.avatar?t.jsx(U,{actor:p,size:r,teamDid:i,inService:l},p?.did||y):m)})}const ee=3;pe.propTypes={notification:n.object.isRequired,isMultiple:n.bool,blocklet:n.object,mountPoint:n.string,avatarFallback:n.node};ue.propTypes={notification:n.object.isRequired,mountPoint:n.string};he.propTypes={items:n.array.isRequired,activity:n.object.isRequired,blocklet:n.object,mountPoint:n.string,viewMoreLink:n.string,avatarFallback:n.node};function ue({notification:e,mountPoint:r=""}){const{activity:s}=e,{type:i,meta:l={}}=s||{},u=oe({activity:s,users:[e?.actorInfo],actors:[e?.activity?.actor],mountPoint:r});return W(s)||!s.type||!s.actor||W(s.target)?null:t.jsxs(g,{children:[t.jsx(q,{variant:"body1",sx:{color:"text.secondary",mb:.5,wordBreak:"break-all"},children:u}),l?t.jsx(ae,{meta:l,type:i}):null]})}function he({items:e,activity:r,blocklet:s,mountPoint:i="",viewMoreLink:l="",avatarFallback:u=null}){const m=_(),{t:d}=X(),p=D(()=>s?.did||s?.meta?.did||"",[s]),{locale:y}=o.useContext(re),v=D(()=>!W(r.meta)&&Object.values(r.meta).some(a=>a!=null),[r]),b=oe({activity:r,users:e.map(a=>a?.actorInfo),actors:e.map(a=>a?.activity?.actor),mountPoint:i}),k=O(a=>{if(!a.activity)return null;const x=se(a.activity);return x?.metaLink?ie(x?.metaLink)?x?.metaLink:G(i,x.metaLink):null}),C=O((a,x)=>{if(!x)return;const h=k(x);h&&(window.open(h,"_blank"),a.customPreventRedirect=!0)}),S=e.length>ee,w=e.slice(0,ee);return t.jsxs(g,{sx:{width:"100%"},children:[t.jsx(q,{variant:"body1",sx:{color:"text.secondary",mb:3},children:b}),v?t.jsxs(g,{className:"sub-content",sx:{display:"flex",flexDirection:"column",gap:3},children:[w.map(a=>t.jsxs(g,{onClick:x=>C(x,a),sx:{display:"flex",flexDirection:"column",gap:1},children:[t.jsxs(g,{sx:{display:"flex",alignItems:"center",gap:1},children:[V(a)?t.jsx(Q,{actors:a.actorInfo,size:32,teamDid:p}):u,t.jsx(q,{variant:"subtitle1",sx:{color:"text.primary"},children:V(a)?a?.actorInfo?.fullName:"System"})," ","·",t.jsx(K,{value:a.createdAt,locale:y,shouldUpdate:!0,style:{color:m.palette.text.secondary,fontSize:"0.875rem",minWidth:"50px",whiteSpace:"nowrap"}})]}),a.activity.meta?t.jsx(g,{sx:{pl:5},children:t.jsx(ae,{meta:a.activity.meta,type:a.activity.type})}):null]},a.id)),S&&l?t.jsx(g,{sx:{mt:1,display:"flex",justifyContent:"center"},children:t.jsxs(ke,{size:"large",variant:"text",component:te,href:l,target:"_blank",rel:"noopener noreferrer",onClick:a=>{a.customPreventRedirect=!0},children:[d("notification.viewMore")," ",t.jsx(ne,{icon:Ee,style:{marginLeft:4}})]})}):null]}):null]})}function pe({notification:e,isMultiple:r=!1,blocklet:s,mountPoint:i="",avatarFallback:l}){const u=D(()=>{if(!e.activity)return null;const m=se(e.activity);return m?.targetLink?ie(m?.targetLink)?m?.targetLink:G(i,m.targetLink):null},[e.activity,i]);return r?t.jsx(he,{items:e.items,activity:e.activity,blocklet:s,mountPoint:i,viewMoreLink:u,avatarFallback:l}):t.jsx(ue,{notification:e,mountPoint:i})}function me({notification:e}){const r=o.useMemo(()=>{const{actions:s,action:i}=e;let l=s??[];return!l.length&&i&&(l=[{name:"Visit",link:i}]),l},[e]);return r.length?t.jsx(g,{sx:{display:"flex",justifyContent:"start",flexWrap:"wrap",alignItems:"center",gap:1},children:r.map((s,i)=>t.jsxs(o.Fragment,{children:[t.jsx(te,{href:s.link,target:"_blank",className:"link",rel:"noopener noreferrer",sx:{fontSize:"15px"},onClick:l=>{l.customPreventRedirect=!0},children:s.name},s.link),i<r.length-1?t.jsx(Ie,{orientation:"vertical",sx:{height:12,borderWidth:"1px"}}):null]},s.link))}):null}me.propTypes={notification:n.object.isRequired};const ot=Me(g)`
2
2
  display: flex;
3
3
  justify-content: center;
4
4
  align-items: center;
@@ -1,2 +1,2 @@
1
1
  const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=[window.__toCdnUrl("assets/vendor-ux-DYcPPYq2.css"),window.__toCdnUrl("assets/index-DrCTi6nm.css"),window.__toCdnUrl("assets/index-_3Fxot8G.css")])))=>i.map(i=>d[i]);
2
- import{r as U,a as ye}from"./vendor-react-DX7tU9aY.js";import{aa as B,a3 as M,J as ve,a7 as le,bA as V,b3 as Ce,b2 as Te}from"./vendor-ux-PO0jFgJf.js";import{j as e,Z as H,b1 as K,I as X,ak as G,a0 as J,b3 as N,T as I,al as c,A as w,F as C,bX as we,bP as ne,bK as se,a6 as oe,a4 as Z,b4 as ae,S as ce,R as L,a7 as Q,X as n,an as Se,cu as ue,cv as Ie,cs as Re}from"./vendor-mui-core-CDEc-eG6.js";import{X as $,aR as Y,V as Ae,W as D,aV as ke,aW as qe,aX as Ee}from"./index-DcM4ljaV.js";import{u as We}from"./useAsyncRetry-DOQg_SXs.js";import{r as Ne}from"./index-t0K-45aJ.js";import{b as _}from"./team-sypU8pIA.js";import{u as de,C as S}from"./index.esm-C4tuRtuv.js";import{o as Oe,b as Pe,y as ie}from"./vendor-utils-_C9URqjS.js";import{T as ze}from"./index-QkGGubJA.js";import{E as De}from"./empty-spinner-2fS4Uw6Z.js";import{C as v}from"./click-to-copy-BmatCVrP.js";import{D as Le}from"./delete-confirm-CwOFci6r.js";import{a as Fe}from"./passport-item-C7svpOMT.js";import{A as Be}from"./actions-C6EeERSU.js";import{T as re}from"./table-tips-CRXYL7Hz.js";import{u as $e}from"./use-mobile-CnCzXOEv.js";import"./vendor-hooks-Ca2cSNuD.js";import"./vendor-arcblock-BVQTtbN-.js";import"./useAsync-10WR8h3k.js";import"./index-fulV4VYn.js";import"./index-BVgxwS3B.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"./isURL-CpQHQuaa.js";import"./isIP-BBY240SU.js";import"./use-blocklet-logo-nVOJALp0.js";import"./use-app-logo-Dt5Rf_oh.js";import"./arrow-down.svg-Dz9H9vM-.js";import"./vendor-mui-x-Bk3pxGrO.js";import"./AdapterDayjs-DtK6vYWP.js";import"./confirm-BMWka5pp.js";import"./index-DBs9Ljax.js";import"./ua-parser-D6QF1h5N.js";import"./did-address-BNKX5oDP.js";import"./util-BKm61knf.js";import"./base32-BFSrw7-h.js";var pe=Ne();const _e={clientName:"",clientUri:"",redirectUris:"",scope:["profile:read"],contacts:"",tosUri:"",policyUri:""};function he({onCreated:r,onClose:a}){const[i,h]=U.useState(!1),{t:l,locale:s}=B(),{api:f}=$(),{teamDid:d}=_(),{control:y,handleSubmit:g,formState:{errors:u},watch:q,setValue:m}=de({defaultValues:_e,mode:"onChange"}),T=q("scope"),R=o=>{o!=="profile:read"&&m("scope",T.includes(o)?T.filter(x=>x!==o):[...T,o])},E=async o=>{h(!0);try{const x={...o,redirectUris:o.redirectUris,contacts:o.contacts?o.contacts.split(",").map(k=>k.trim()):[],scope:o.scope.join(" ")};await f.createOAuthClient({input:{teamDid:d,input:Oe(x,Pe)}}),r(x)}catch(x){M.error(x.message||"Failed to create OAuth App")}finally{h(!1)}};return e.jsxs(H,{open:!0,onClose:a,maxWidth:"md",fullWidth:!0,children:[e.jsxs(K,{children:[l("oauth.client.register")," ",e.jsx(X,{onClick:a,sx:{position:"absolute",right:8,top:8},children:e.jsx(G,{})})]}),e.jsx(J,{children:e.jsxs(N,{spacing:4,sx:{mt:2},children:[e.jsx(I,{variant:"h6",gutterBottom:!0,children:l("oauth.client.requiredInformation")}),e.jsx(c,{children:e.jsx(S,{name:"clientName",control:y,rules:{required:l("oauth.client.validate.clientName"),minLength:{value:3,message:l("oauth.client.validate.clientNameMinLength")}},render:({field:o})=>e.jsxs(e.Fragment,{children:[e.jsx(w,{size:"small",...o,label:l("oauth.client.name"),required:!0,fullWidth:!0,placeholder:l("oauth.client.input.clientNamePlaceholder"),error:!!u.clientName,helperText:u.clientName?.message}),e.jsx(C,{children:l("oauth.client.helperText.clientName")})]})})}),e.jsx(c,{children:e.jsx(S,{name:"clientUri",control:y,rules:{required:l("oauth.client.validate.clientUri"),pattern:{value:/^https?:\/\/.+/,message:l("oauth.client.validate.clientUriInvalid")}},render:({field:o})=>e.jsxs(e.Fragment,{children:[e.jsx(w,{size:"small",...o,label:l("oauth.client.input.clientUri"),required:!0,fullWidth:!0,placeholder:l("oauth.client.input.clientUriPlaceholder"),error:!!u.clientUri,helperText:u.clientUri?.message}),e.jsx(C,{children:l("oauth.client.helperText.clientUri")})]})})}),e.jsx(c,{children:e.jsx(S,{name:"redirectUris",control:y,rules:{required:l("oauth.client.validate.redirectUris"),pattern:{value:/^https?:\/\/.+/,message:l("oauth.client.validate.redirectUrisInvalid")}},render:({field:o})=>e.jsxs(e.Fragment,{children:[e.jsx(w,{size:"small",...o,label:l("oauth.client.input.redirectUris"),required:!0,fullWidth:!0,placeholder:l("oauth.client.input.redirectUrisPlaceholder"),error:!!u.redirectUris,helperText:u.redirectUris?.message}),e.jsxs(c,{sx:{display:"flex",gap:"2px"},children:[e.jsx(C,{children:l("oauth.client.helperText.redirectUris")}),e.jsx(C,{children:l("oauth.client.helperText.read")}),e.jsx(C,{sx:{color:"info.main"},component:"a",href:`https://www.arcblock.io/docs/blocklet-developer/${s}/oauth-service`,target:"_blank",rel:"noopener noreferrer",children:l("oauth.client.helperText.document")}),e.jsx(C,{children:l("oauth.client.helperText.more")})]})]})})}),e.jsxs(we,{variant:"outlined",sx:{p:2,display:"none"},children:[e.jsx(I,{variant:"subtitle2",gutterBottom:!0,children:l("oauth.client.input.permissions")}),e.jsx(c,{sx:{border:"1px solid",borderColor:"divider",borderRadius:1,p:2},children:e.jsx(ne,{children:Object.entries(Y).map(([o,x])=>e.jsx(se,{control:e.jsx(oe,{checked:T.includes(o),onChange:()=>R(o),disabled:o==="profile:read",color:"primary"}),label:e.jsx(c,{children:e.jsx(I,{variant:"body2",sx:{fontWeight:500},children:x})})},o))})})]}),e.jsx(Z,{}),e.jsx(I,{variant:"h6",gutterBottom:!0,children:l("oauth.client.optionalInformation")}),e.jsx(N,{children:e.jsx(S,{name:"contacts",control:y,rules:{pattern:{value:/^$|^[^@\s]+@[^@\s]+\.[^@\s]+(\s*,\s*[^@\s]+@[^@\s]+\.[^@\s]+)*$/,message:l("oauth.client.validate.contacts")}},render:({field:o})=>e.jsxs(e.Fragment,{children:[e.jsx(w,{size:"small",...o,label:l("oauth.client.input.contacts"),fullWidth:!0,placeholder:l("oauth.client.input.contactsPlaceholder"),error:!!u.contacts,helperText:u.contacts?.message}),e.jsx(C,{children:l("oauth.client.helperText.contacts")})]})})}),e.jsxs(N,{direction:{xs:"column",sm:"row"},spacing:2,children:[e.jsx(S,{name:"tosUri",control:y,rules:{pattern:{value:/^$|^https?:\/\/.+/,message:l("oauth.client.validate.tosUriInvalid")}},render:({field:o})=>e.jsxs(c,{sx:{width:"50%"},children:[e.jsx(w,{size:"small",...o,label:l("oauth.client.input.tosUri"),fullWidth:!0,placeholder:l("oauth.client.input.tosUriPlaceholder"),error:!!u.tosUri,helperText:u.tosUri?.message}),e.jsx(C,{children:l("oauth.client.helperText.tosUri")})]})}),e.jsx(S,{name:"policyUri",control:y,rules:{pattern:{value:/^$|^https?:\/\/.+/,message:l("oauth.client.validate.policyUriInvalid")}},render:({field:o})=>e.jsxs(c,{sx:{width:"50%"},children:[e.jsx(w,{size:"small",...o,label:l("oauth.client.input.policyUri"),fullWidth:!0,placeholder:l("oauth.client.input.policyUriPlaceholder"),error:!!u.policyUri,helperText:u.policyUri?.message}),e.jsx(C,{children:l("oauth.client.helperText.policyUri")})]})})]}),u.error&&e.jsx(ae,{severity:"error",children:u.error.message})]})}),e.jsxs(ce,{children:[e.jsx(L,{onClick:a,children:l("common.cancel")}),e.jsxs(L,{onClick:g(E),disabled:i,variant:"contained",color:"primary",children:[i?e.jsx(Q,{size:20,sx:{mr:1}}):null,l("oauth.client.registerButton")]})]})]})}he.propTypes={onCreated:n.func.isRequired,onClose:n.func.isRequired};function ee({scope:r="",...a}){if(!r)return null;const i=r.split(" ").filter(Boolean);return e.jsx(N,{direction:"row",...a,sx:[{flexWrap:"wrap",gap:1},...Array.isArray(a.sx)?a.sx:[a.sx]],children:i.map(h=>e.jsx(ye.Fragment,{children:e.jsx(Se,{title:Y[h],children:e.jsx(v,{children:h})})},h))})}ee.propTypes={scope:n.string};const te=r=>{const{prefix:a}=$(),{blocklet:i}=Ae(),h=ie(a,"/api/media/upload",i.appPid),l=U.useCallback(f=>f?f.startsWith("http")?f:`${ie(a,"/api/media/upload",i.appPid)}/${f}`:"",[a,i.appPid]);return{clientLogoUrl:U.useMemo(()=>l(r),[r,l]),apiPath:h,getClientLogoUrl:l}},Ve=U.lazy(()=>ve(()=>import("./index-6ovPLp0y.js"),__vite__mapDeps([0,1,2]),import.meta.url).then(r=>({default:r.Uploader})));function me({client:r,onUpdate:a,onClose:i}){const[h,l]=U.useState(!1),{t:s,locale:f}=B(),d=U.useRef(null),{api:y}=$(),{teamDid:g}=_(),{control:u,handleSubmit:q,formState:{errors:m},watch:T,setValue:R,getValues:E}=de({defaultValues:{clientName:r.clientName||"",clientUri:r.clientUri||"",redirectUris:Array.isArray(r.redirectUris)?r.redirectUris.join(","):"",scope:r.scope?r.scope.split(" "):["profile:read"],contacts:Array.isArray(r.contacts)?r.contacts.join(","):"",tosUri:r.tosUri||"",policyUri:r.policyUri||"",logoUri:r.logoUri||"",clientSecretExpiresAt:r.clientSecretExpiresAt||null},mode:"onChange"}),o=T("scope"),x=T("logoUri"),{clientLogoUrl:k,apiPath:W}=te(x),A=t=>{t!=="profile:read"&&R("scope",o.includes(t)?o.filter(p=>p!==t):[...o,t])},O=async t=>{const p={clientId:r.clientId,clientName:t.clientName.trim(),clientUri:t.clientUri,redirectUris:t.redirectUris.split(",").map(j=>j.trim()).filter(Boolean),contacts:t.contacts?t.contacts.split(",").map(j=>j.trim()):[],scope:t.scope.join(" "),tosUri:t.tosUri,policyUri:t.policyUri,logoUri:t.logoUri,clientSecretExpiresAt:t.clientSecretExpiresAt?parseInt(t.clientSecretExpiresAt/1e3,10):null};await y.updateOAuthClient({input:{teamDid:g,input:p}})},z=async t=>{l(!0);try{await O(t),a(),i()}catch(p){M.error(p.message||s("oauth.client.updateFailed"))}finally{l(!1)}};return e.jsxs(H,{open:!0,onClose:i,maxWidth:"md",fullWidth:!0,children:[e.jsxs(K,{children:[s("oauth.client.update")," ",e.jsx(X,{onClick:i,sx:{position:"absolute",right:8,top:8},children:e.jsx(G,{})})]}),e.jsx(J,{children:e.jsxs(N,{spacing:3,sx:{mt:2},children:[e.jsxs(c,{sx:{mb:3},children:[e.jsx(I,{variant:"subtitle1",sx:{fontWeight:500,mb:1},children:s("oauth.client.logo")}),e.jsxs(c,{children:[e.jsx(c,{sx:{width:120,height:120,position:"relative",borderRadius:"4px",overflow:"hidden"},children:k?e.jsx(c,{children:e.jsx("img",{src:k,alt:"client-logo",style:{width:"100%",height:"100%"}})}):e.jsx(c,{onClick:()=>{d.current?.open()},sx:{width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center",bgcolor:"grey.200"},children:e.jsx(ue,{sx:{fontSize:40,color:"common.white"}})})}),e.jsx(L,{sx:{mt:2},variant:"outlined",size:"small",onClick:()=>{d.current?.open()},children:s(k?"common.change":"common.upload")})]}),e.jsx(c,{sx:{display:"flex",alignItems:"center"},children:e.jsx(U.Suspense,{fallback:e.jsx(De,{}),children:e.jsx(Ve,{ref:d,locale:f,popup:!0,onUploadFinish:t=>{R("logoUri",t.data.filename),O(E()).then(()=>{a()}).catch(p=>{M.error(p.message||s("oauth.client.updateFailed"))}).finally(()=>{d.current?.close()})},plugins:["ImageEditor"],installerProps:{disabled:!0},apiPathProps:{uploader:W,disableMediaKitPrefix:!0,disableAutoPrefix:!0,disableMediaKitStatus:!0},coreProps:{restrictions:{allowedFileTypes:["image/png","image/jpeg","image/webp","image/svg+xml"],maxFileSize:1024*1024*.5,maxNumberOfFiles:1}},dashboardProps:{autoOpen:"imageEditor"},imageEditorProps:{actions:{revert:!0,rotate:!0,granularRotate:!0,flip:!0,zoomIn:!0,zoomOut:!0,cropSquare:!1,cropWidescreen:!1,cropWidescreenVertical:!1},cropperOptions:{autoCrop:!0,aspectRatio:1,initialAspectRatio:1,autoCropArea:1,croppedCanvasOptions:{minWidth:256,minHeight:256}}}},"uploader-logo")})})]}),e.jsx(I,{variant:"subtitle1",sx:{fontWeight:500},children:s("oauth.client.requiredInformation")}),e.jsx(w,{label:"Client Id",fullWidth:!0,value:r.clientId,disabled:!0}),e.jsx(c,{children:e.jsx(S,{name:"clientName",control:u,rules:{required:s("oauth.client.validate.clientName"),minLength:{value:3,message:s("oauth.client.validate.clientNameMinLength")}},render:({field:t})=>e.jsxs(e.Fragment,{children:[e.jsx(w,{...t,label:s("oauth.client.name"),required:!0,fullWidth:!0,error:!!m.clientName,helperText:m.clientName?.message}),e.jsx(C,{children:s("oauth.client.helperText.clientName")})]})})}),e.jsx(c,{children:e.jsx(S,{name:"clientUri",control:u,rules:{required:s("oauth.client.validate.clientUri"),pattern:{value:/^https?:\/\/.+/,message:s("oauth.client.validate.clientUriInvalid")}},render:({field:t})=>e.jsxs(e.Fragment,{children:[e.jsx(w,{...t,label:s("oauth.client.input.clientUri"),required:!0,fullWidth:!0,error:!!m.clientUri,helperText:m.clientUri?.message}),e.jsx(C,{children:s("oauth.client.helperText.clientUri")})]})})}),e.jsx(c,{children:e.jsx(S,{name:"redirectUris",control:u,rules:{required:s("oauth.client.validate.redirectUris"),pattern:{value:/^https?:\/\/.+/,message:s("oauth.client.validate.redirectUrisInvalid")}},render:({field:t})=>e.jsxs(e.Fragment,{children:[e.jsx(w,{...t,label:s("oauth.client.input.redirectUris"),required:!0,fullWidth:!0,multiline:!0,rows:2,error:!!m.redirectUris,helperText:m.redirectUris?.message}),e.jsx(C,{children:s("oauth.client.helperText.redirectUris")})]})})}),e.jsx(S,{name:"clientSecretExpiresAt",control:u,render:({field:t})=>e.jsx(ze,{placeholder:s("oauth.client.input.expireTime"),value:t.value*1e3,onChange:p=>{t.onChange(p)}})}),e.jsxs(c,{sx:{display:"none"},children:[e.jsx(I,{variant:"subtitle2",sx:{mb:1},children:s("oauth.client.input.permissions")}),e.jsx(c,{sx:{border:"1px solid",borderColor:"divider",borderRadius:1,p:2},children:e.jsx(ne,{children:Object.entries(Y).map(([t,p])=>e.jsx(se,{control:e.jsx(oe,{checked:o.includes(t),onChange:()=>A(t),disabled:t==="profile:read",color:"primary"}),label:e.jsx(c,{children:e.jsx(I,{variant:"body2",sx:{fontWeight:500},children:p})})},t))})})]}),e.jsx(Z,{}),e.jsx(I,{variant:"subtitle1",sx:{fontWeight:500},children:s("oauth.client.optionalInformation")}),e.jsx(c,{children:e.jsx(S,{name:"contacts",control:u,rules:{pattern:{value:/^$|^[^@\s]+@[^@\s]+\.[^@\s]+(\s*,\s*[^@\s]+@[^@\s]+\.[^@\s]+)*$/,message:s("oauth.client.validate.contacts")}},render:({field:t})=>e.jsxs(e.Fragment,{children:[e.jsx(w,{...t,label:s("oauth.client.input.contacts"),fullWidth:!0,error:!!m.contacts,helperText:m.contacts?.message}),e.jsx(C,{children:s("oauth.client.helperText.contacts")})]})})}),e.jsxs(N,{direction:{xs:"column",sm:"row"},spacing:2,children:[e.jsx(S,{name:"tosUri",control:u,rules:{pattern:{value:/^$|^https?:\/\/.+/,message:s("oauth.client.validate.tosUriInvalid")}},render:({field:t})=>e.jsxs(c,{sx:{width:"50%"},children:[e.jsx(w,{...t,label:s("oauth.client.input.tosUri"),fullWidth:!0,error:!!m.tosUri,helperText:m.tosUri?.message}),e.jsx(C,{children:s("oauth.client.helperText.tosUri")})]})}),e.jsx(S,{name:"policyUri",control:u,rules:{pattern:{value:/^$|^https?:\/\/.+/,message:s("oauth.client.validate.policyUriInvalid")}},render:({field:t})=>e.jsxs(c,{sx:{width:"50%"},children:[e.jsx(w,{...t,label:s("oauth.client.input.policyUri"),fullWidth:!0,error:!!m.policyUri,helperText:m.policyUri?.message}),e.jsx(C,{children:s("oauth.client.helperText.policyUri")})]})})]}),m.error&&e.jsx(ae,{severity:"error",children:m.error.message})]})}),e.jsxs(ce,{children:[e.jsx(L,{onClick:i,children:s("common.cancel")}),e.jsx(L,{onClick:q(z),disabled:h,variant:"contained",color:"primary",children:h?e.jsx(Q,{size:16}):s("common.update")})]})]})}me.propTypes={client:n.shape({clientId:n.string.isRequired,clientName:n.string.isRequired,clientUri:n.string,redirectUris:n.arrayOf(n.string),scope:n.string,contacts:n.arrayOf(n.string),tosUri:n.string,policyUri:n.string,logoUri:n.string,clientSecretExpiresAt:n.number}).isRequired,onUpdate:n.func.isRequired,onClose:n.func.isRequired};function xe({client:r,onUpdate:a,onClose:i}){return e.jsx(me,{client:r,onUpdate:h=>a(h),onClose:i})}xe.propTypes={client:n.shape({clientId:n.string.isRequired,clientName:n.string.isRequired,clientUri:n.string,redirectUris:n.arrayOf(n.string),scope:n.string,contacts:n.arrayOf(n.string),tosUri:n.string,policyUri:n.string,logoUri:n.string,clientSecretExpiresAt:n.number}).isRequired,onUpdate:n.func.isRequired,onClose:n.func.isRequired};function je({clientId:r,clientName:a,onDelete:i=()=>{},onClose:h=()=>{}}){const{t:l}=B(),{api:s}=$(),{teamDid:f}=_(),d=()=>{h()},y=async()=>{try{await s.deleteOAuthClient({input:{teamDid:f,clientId:r}}),i()}catch(u){M.error(u?.message)}finally{d()}},g={keyName:a,title:l("oauth.client.delete.title"),description:l("oauth.client.delete.description",{name:`<b>${a}</b>`}),confirmPlaceholder:l("oauth.client.delete.description",{name:a}),confirm:l("common.delConfirm"),cancel:l("common.cancel"),onConfirm:y,onCancel:d};return e.jsx(Le,{keyName:g.keyName,title:g.title,description:g.description,confirmPlaceholder:g.confirmPlaceholder,confirm:g.confirm,cancel:g.cancel,params:g.params,onConfirm:g.onConfirm,onCancel:g.onCancel})}je.propTypes={clientId:n.string.isRequired,clientName:n.string.isRequired,onDelete:n.func,onClose:n.func};function ge({title:r,items:a}){return e.jsxs(c,{sx:{mb:3},children:[e.jsx(I,{variant:"h6",sx:{mb:1.5},children:r}),e.jsx(N,{spacing:1.5,children:a.map(({label:i,value:h})=>e.jsxs(c,{sx:{display:"flex",alignItems:"center",gap:2},children:[e.jsx(I,{variant:"subtitle2",color:"textSecondary",sx:{minWidth:200},children:i}),e.jsx(I,{sx:{wordBreak:"break-all"},children:h||"-"})]},i))})]})}ge.propTypes={title:n.string.isRequired,items:n.arrayOf(n.shape({label:n.string.isRequired,value:n.any})).isRequired};function fe({client:r,onClose:a}){const{t:i,locale:h}=B(),{teamDid:l}=_(),{clientName:s,clientId:f,clientSecret:d,redirectUris:y,scope:g,clientUri:u,logoUri:q,contacts:m,tosUri:T,policyUri:R,jwksUri:E,jwks:o,softwareId:x,softwareVersion:k,clientIdIssuedAt:W,clientSecretExpiresAt:A,updatedAt:O,createUser:z}=r,{clientLogoUrl:t}=te(q),p=P=>{try{const F=new URL(window.blocklet.appUrl);return F.pathname=P,F.toString()}catch{return"-"}},j=pe.fromAppDid(f,l),b=[{title:i("common.baseInfo"),items:[{label:i("oauth.client.name"),value:s},{label:i("oauth.client.logoUri"),value:e.jsx(le,{variant:"rounded",shape:"square",src:t,did:j.address,size:64})},{label:i("oauth.client.clientUri"),value:u?e.jsx(v,{children:u}):"-"},{label:i("oauth.client.clientId"),value:e.jsx(v,{children:f})},{label:i("oauth.client.clientSecret"),value:e.jsx(v,{children:d})},{label:i("oauth.client.redirectUris"),value:e.jsx(v,{children:(y||[]).join(", ")})},{label:i("oauth.client.scope"),value:e.jsx(ee,{scope:g})},{label:i("oauth.client.createUser"),value:z?Fe(z,!0):i("oauth.client.openRegistration")}]},{title:i("oauth.client.oauthEndpoints"),items:[{label:i("oauth.client.openidConfiguration"),value:e.jsx(v,{children:p("/.well-known/openid-configuration")})},{label:i("oauth.client.authorizationEndpoint"),value:e.jsx(v,{children:p(`${D}/oauth/authorize`)})},{label:i("oauth.client.tokenEndpoint"),value:e.jsx(v,{children:p(`${D}/oauth/token`)})},{label:i("oauth.client.userinfoEndpoint"),value:e.jsx(v,{children:p(`${D}/oauth/userinfo`)})},{label:i("oauth.client.jwksUri"),value:e.jsx(v,{children:p(`${D}/oauth/jwks`)})},{label:i("oauth.client.registrationEndpoint"),value:e.jsx(v,{children:p(`${D}/oauth/register`)})},{label:i("oauth.client.endSessionEndpoint"),value:e.jsx(v,{children:p(`${D}/oauth/logout`)})}]},{title:i("oauth.client.metaContact"),items:[{label:i("oauth.client.contacts"),value:m.length?e.jsx(v,{children:(m||[]).join(", ")}):"-"},{label:i("oauth.client.tosUri"),value:T?e.jsx(v,{children:T}):"-"},{label:i("oauth.client.policyUri"),value:R?e.jsx(v,{children:R}):"-"},{label:i("oauth.client.jwksUri"),value:E},{label:i("oauth.client.jwks"),value:o},{label:i("oauth.client.softwareId"),value:x},{label:i("oauth.client.softwareVersion"),value:k}]},{title:i("common.timeInfo"),items:[{label:i("oauth.client.clientIdIssuedAt"),value:W?e.jsx(V,{value:W*1e3,type:"all",locale:h}):"-"},{label:i("oauth.client.clientSecretExpiresAt"),value:A?e.jsx(V,{value:A*1e3,type:"all",locale:h}):"-"},{label:i("common.updatedAt"),value:O?e.jsx(V,{value:O,type:"all",locale:h}):"-"}]}].filter(Boolean);return e.jsxs(H,{open:!0,onClose:a,maxWidth:"lg",fullWidth:!0,children:[e.jsxs(K,{children:[i("oauth.client.oauthAppDetails"),e.jsx(X,{onClick:a,sx:{position:"absolute",right:8,top:8},children:e.jsx(G,{})})]}),e.jsx(J,{children:e.jsx(c,{sx:{mt:1},children:b.map((P,F)=>e.jsxs(c,{children:[e.jsx(ge,{title:P.title,items:P.items}),F!==b.length-1&&e.jsx(Z,{sx:{my:2}})]},P.title))})})]})}fe.propTypes={client:n.object.isRequired,onClose:n.func.isRequired};function Me(r){return e.jsx(V,{value:r*1e3})}function be({selected:r=null,onClose:a}){return r?e.jsx(fe,{client:r,onClose:a}):null}be.propTypes={selected:n.object,onClose:n.func.isRequired};function Ue({open:r,onCreated:a,onClose:i}){return r?e.jsx(he,{onCreated:a,onClose:i}):null}Ue.propTypes={open:n.bool.isRequired,onCreated:n.func.isRequired,onClose:n.func.isRequired};function Et(){const[r,a]=U.useState({searchText:"",pageSize:10,page:1}),[i,h]=U.useState(null),[l,s]=U.useState(!1),f=U.useRef(null),{t:d,locale:y}=B(),{api:g}=$(),{teamDid:u}=_(),[q,m]=U.useState(null),[T,R]=U.useState(null),E=$e(),{getClientLogoUrl:o}=te(),x=We(async()=>await g.getOAuthClients({input:{teamDid:u,paging:{page:r.page,pageSize:r.pageSize}}}),[r.page,r.pageSize]),{loading:k}=x,W=U.useMemo(()=>x.value?.list||[],[x.value?.list]),A=U.useMemo(()=>r.searchText?W.filter(t=>t.clientName.toLowerCase().includes(r.searchText.toLowerCase())||t.clientId.toLowerCase().includes(r.searchText.toLowerCase())||t.scope.toLowerCase().includes(r.searchText.toLowerCase())):W,[r.searchText,W]),O=U.useMemo(()=>[{label:d("oauth.client.name"),name:"clientName",options:{customBodyRender:(t,{rowIndex:p})=>{const j=A[p],b=o(j.logoUri),P=pe.fromAppDid(j.clientId,u);return e.jsx(c,{sx:{display:"flex",alignItems:"center",gap:2},children:e.jsxs(c,{sx:{display:"flex",alignItems:"center",gap:2,cursor:"pointer"},children:[e.jsx(le,{variant:"rounded",shape:"square",did:P.address,src:b,size:48}),e.jsxs(N,{sx:{gap:.5},children:[e.jsx(c,{sx:{color:"text.primary"},children:j.clientName}),e.jsx(c,{sx:{color:"text.secondary"},children:j.clientUri})]})]})})}}},{label:d("oauth.client.clientId"),name:"clientId"},{label:d("oauth.client.scope"),name:"scope",options:{customBodyRender:t=>e.jsx(ee,{scope:t})}},{label:d("common.createdAt"),name:"clientIdIssuedAt",options:{customBodyRender:Me}},{label:d("common.createdBy"),name:"createdBy",width:100,options:{customBodyRender:t=>t?e.jsx(ke,{showDid:!0,did:t,cardType:Ee.Detailed,infoType:qe.Minimal,sx:{border:0,padding:0}}):d("oauth.client.openRegistration")}},{label:d("common.actions"),name:"actions",width:100,align:"center",verticalKeyAlign:"center",options:{customBodyRender:(t,{rowIndex:p})=>{const j=A[p];return e.jsx(Be,{actions:[{icon:e.jsx(Ie,{}),text:d("common.edit"),onClick:b=>{b.stopPropagation(),m(j)}},{icon:e.jsx(Re,{}),text:d("common.delete"),onClick:b=>{b.stopPropagation(),R(j)}}]})}}}],[A,d,o,u,m,R]),z=({page:t,rowsPerPage:p,searchText:j})=>{r.pageSize!==p?a(b=>({...b,searchText:"",pageSize:p,page:1})):r.page!==t+1?a(b=>({...b,searchText:"",page:t+1})):r.searchText!==j&&a(b=>({...b,searchText:j,page:1}))};return e.jsxs(c,{ref:f,sx:{".custom-toobar-btns":{gap:"8px"},".custom-toobar-title .custom-toobar-title-inner>span":{display:"flex",alignItems:"center","white-space":"inherit",height:"100%"}},children:[E?e.jsx(re,{title:d("oauth.client.listTitle"),tooltipTitle:d("oauth.client.tooltipTitle"),link:`https://www.arcblock.io/docs/blocklet-developer/${y}/oauth-service`}):null,e.jsx(Ce,{data:A,columns:O,options:{sort:!1,download:!1,filter:!1,print:!1,viewColumns:!1,page:r.page-1,rowsPerPage:r.pageSize,count:A.length,searchDebounceTime:400,onRowClick(t,{dataIndex:p},j){if(f.current?.contains(j.target)){const b=A[p];h(b)}}},onChange:z,title:E?null:e.jsx(re,{title:d("oauth.client.listTitle"),tooltipTitle:d("oauth.client.tooltipTitle"),link:`https://www.arcblock.io/docs/blocklet-developer/${y}/oauth-service`}),customButtons:[e.jsxs(L,{variant:"contained",size:"small",onClick:()=>s(!0),children:[k?e.jsx(Q,{size:16}):e.jsx(ue,{style:{fontSize:16}}),d("common.create")]},"add")],loading:!1,emptyNode:e.jsx(Te,{children:d("oauth.client.empty")})}),e.jsx(be,{selected:i,onClose:()=>h(null)}),e.jsx(Ue,{open:l,onCreated:()=>{s(!1),x.retry()},onClose:()=>s(!1)}),q&&e.jsx(xe,{client:q,onUpdate:x.retry,onClose:()=>m(null)}),T&&e.jsx(je,{...T,onDelete:x.retry,onClose:()=>R(null)})]})}export{Et as default};
2
+ import{r as U,a as ye}from"./vendor-react-DX7tU9aY.js";import{aa as B,a3 as M,J as ve,a7 as le,bA as V,b3 as Ce,b2 as Te}from"./vendor-ux-PO0jFgJf.js";import{j as e,Z as H,b1 as K,I as X,ak as G,a0 as J,b3 as N,T as I,al as c,A as w,F as C,bX as we,bP as ne,bK as se,a6 as oe,a4 as Z,b4 as ae,S as ce,R as L,a7 as Q,X as n,an as Se,cu as ue,cv as Ie,cs as Re}from"./vendor-mui-core-CDEc-eG6.js";import{X as $,aR as Y,V as Ae,W as D,aV as ke,aW as qe,aX as Ee}from"./index-CgSpL7jz.js";import{u as We}from"./useAsyncRetry-DOQg_SXs.js";import{r as Ne}from"./index-k0OLPTEM.js";import{b as _}from"./team-Bso_Sjaa.js";import{u as de,C as S}from"./index.esm-C4tuRtuv.js";import{o as Oe,b as Pe,y as ie}from"./vendor-utils-_C9URqjS.js";import{T as ze}from"./index-CNX69Q5e.js";import{E as De}from"./empty-spinner-2fS4Uw6Z.js";import{C as v}from"./click-to-copy-BmatCVrP.js";import{D as Le}from"./delete-confirm-C0N4quT9.js";import{a as Fe}from"./passport-item-CeYGFFGn.js";import{A as Be}from"./actions-C6EeERSU.js";import{T as re}from"./table-tips-CRXYL7Hz.js";import{u as $e}from"./use-mobile-CnCzXOEv.js";import"./vendor-hooks-Ca2cSNuD.js";import"./vendor-arcblock-BVQTtbN-.js";import"./useAsync-10WR8h3k.js";import"./index-CBR-Vn-z.js";import"./index-BLYrVxV3.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"./isURL-CpQHQuaa.js";import"./isIP-BBY240SU.js";import"./use-blocklet-logo-nVOJALp0.js";import"./use-app-logo-DcBQK--f.js";import"./arrow-down.svg-Dz9H9vM-.js";import"./vendor-mui-x-Bk3pxGrO.js";import"./AdapterDayjs-DtK6vYWP.js";import"./confirm-DhDNorbd.js";import"./index-DBs9Ljax.js";import"./ua-parser-D6QF1h5N.js";import"./did-address-BNKX5oDP.js";import"./util-CIgNPQhV.js";import"./base32-Cx5Qjcq5.js";var pe=Ne();const _e={clientName:"",clientUri:"",redirectUris:"",scope:["profile:read"],contacts:"",tosUri:"",policyUri:""};function he({onCreated:r,onClose:a}){const[i,h]=U.useState(!1),{t:l,locale:s}=B(),{api:f}=$(),{teamDid:d}=_(),{control:y,handleSubmit:g,formState:{errors:u},watch:q,setValue:m}=de({defaultValues:_e,mode:"onChange"}),T=q("scope"),R=o=>{o!=="profile:read"&&m("scope",T.includes(o)?T.filter(x=>x!==o):[...T,o])},E=async o=>{h(!0);try{const x={...o,redirectUris:o.redirectUris,contacts:o.contacts?o.contacts.split(",").map(k=>k.trim()):[],scope:o.scope.join(" ")};await f.createOAuthClient({input:{teamDid:d,input:Oe(x,Pe)}}),r(x)}catch(x){M.error(x.message||"Failed to create OAuth App")}finally{h(!1)}};return e.jsxs(H,{open:!0,onClose:a,maxWidth:"md",fullWidth:!0,children:[e.jsxs(K,{children:[l("oauth.client.register")," ",e.jsx(X,{onClick:a,sx:{position:"absolute",right:8,top:8},children:e.jsx(G,{})})]}),e.jsx(J,{children:e.jsxs(N,{spacing:4,sx:{mt:2},children:[e.jsx(I,{variant:"h6",gutterBottom:!0,children:l("oauth.client.requiredInformation")}),e.jsx(c,{children:e.jsx(S,{name:"clientName",control:y,rules:{required:l("oauth.client.validate.clientName"),minLength:{value:3,message:l("oauth.client.validate.clientNameMinLength")}},render:({field:o})=>e.jsxs(e.Fragment,{children:[e.jsx(w,{size:"small",...o,label:l("oauth.client.name"),required:!0,fullWidth:!0,placeholder:l("oauth.client.input.clientNamePlaceholder"),error:!!u.clientName,helperText:u.clientName?.message}),e.jsx(C,{children:l("oauth.client.helperText.clientName")})]})})}),e.jsx(c,{children:e.jsx(S,{name:"clientUri",control:y,rules:{required:l("oauth.client.validate.clientUri"),pattern:{value:/^https?:\/\/.+/,message:l("oauth.client.validate.clientUriInvalid")}},render:({field:o})=>e.jsxs(e.Fragment,{children:[e.jsx(w,{size:"small",...o,label:l("oauth.client.input.clientUri"),required:!0,fullWidth:!0,placeholder:l("oauth.client.input.clientUriPlaceholder"),error:!!u.clientUri,helperText:u.clientUri?.message}),e.jsx(C,{children:l("oauth.client.helperText.clientUri")})]})})}),e.jsx(c,{children:e.jsx(S,{name:"redirectUris",control:y,rules:{required:l("oauth.client.validate.redirectUris"),pattern:{value:/^https?:\/\/.+/,message:l("oauth.client.validate.redirectUrisInvalid")}},render:({field:o})=>e.jsxs(e.Fragment,{children:[e.jsx(w,{size:"small",...o,label:l("oauth.client.input.redirectUris"),required:!0,fullWidth:!0,placeholder:l("oauth.client.input.redirectUrisPlaceholder"),error:!!u.redirectUris,helperText:u.redirectUris?.message}),e.jsxs(c,{sx:{display:"flex",gap:"2px"},children:[e.jsx(C,{children:l("oauth.client.helperText.redirectUris")}),e.jsx(C,{children:l("oauth.client.helperText.read")}),e.jsx(C,{sx:{color:"info.main"},component:"a",href:`https://www.arcblock.io/docs/blocklet-developer/${s}/oauth-service`,target:"_blank",rel:"noopener noreferrer",children:l("oauth.client.helperText.document")}),e.jsx(C,{children:l("oauth.client.helperText.more")})]})]})})}),e.jsxs(we,{variant:"outlined",sx:{p:2,display:"none"},children:[e.jsx(I,{variant:"subtitle2",gutterBottom:!0,children:l("oauth.client.input.permissions")}),e.jsx(c,{sx:{border:"1px solid",borderColor:"divider",borderRadius:1,p:2},children:e.jsx(ne,{children:Object.entries(Y).map(([o,x])=>e.jsx(se,{control:e.jsx(oe,{checked:T.includes(o),onChange:()=>R(o),disabled:o==="profile:read",color:"primary"}),label:e.jsx(c,{children:e.jsx(I,{variant:"body2",sx:{fontWeight:500},children:x})})},o))})})]}),e.jsx(Z,{}),e.jsx(I,{variant:"h6",gutterBottom:!0,children:l("oauth.client.optionalInformation")}),e.jsx(N,{children:e.jsx(S,{name:"contacts",control:y,rules:{pattern:{value:/^$|^[^@\s]+@[^@\s]+\.[^@\s]+(\s*,\s*[^@\s]+@[^@\s]+\.[^@\s]+)*$/,message:l("oauth.client.validate.contacts")}},render:({field:o})=>e.jsxs(e.Fragment,{children:[e.jsx(w,{size:"small",...o,label:l("oauth.client.input.contacts"),fullWidth:!0,placeholder:l("oauth.client.input.contactsPlaceholder"),error:!!u.contacts,helperText:u.contacts?.message}),e.jsx(C,{children:l("oauth.client.helperText.contacts")})]})})}),e.jsxs(N,{direction:{xs:"column",sm:"row"},spacing:2,children:[e.jsx(S,{name:"tosUri",control:y,rules:{pattern:{value:/^$|^https?:\/\/.+/,message:l("oauth.client.validate.tosUriInvalid")}},render:({field:o})=>e.jsxs(c,{sx:{width:"50%"},children:[e.jsx(w,{size:"small",...o,label:l("oauth.client.input.tosUri"),fullWidth:!0,placeholder:l("oauth.client.input.tosUriPlaceholder"),error:!!u.tosUri,helperText:u.tosUri?.message}),e.jsx(C,{children:l("oauth.client.helperText.tosUri")})]})}),e.jsx(S,{name:"policyUri",control:y,rules:{pattern:{value:/^$|^https?:\/\/.+/,message:l("oauth.client.validate.policyUriInvalid")}},render:({field:o})=>e.jsxs(c,{sx:{width:"50%"},children:[e.jsx(w,{size:"small",...o,label:l("oauth.client.input.policyUri"),fullWidth:!0,placeholder:l("oauth.client.input.policyUriPlaceholder"),error:!!u.policyUri,helperText:u.policyUri?.message}),e.jsx(C,{children:l("oauth.client.helperText.policyUri")})]})})]}),u.error&&e.jsx(ae,{severity:"error",children:u.error.message})]})}),e.jsxs(ce,{children:[e.jsx(L,{onClick:a,children:l("common.cancel")}),e.jsxs(L,{onClick:g(E),disabled:i,variant:"contained",color:"primary",children:[i?e.jsx(Q,{size:20,sx:{mr:1}}):null,l("oauth.client.registerButton")]})]})]})}he.propTypes={onCreated:n.func.isRequired,onClose:n.func.isRequired};function ee({scope:r="",...a}){if(!r)return null;const i=r.split(" ").filter(Boolean);return e.jsx(N,{direction:"row",...a,sx:[{flexWrap:"wrap",gap:1},...Array.isArray(a.sx)?a.sx:[a.sx]],children:i.map(h=>e.jsx(ye.Fragment,{children:e.jsx(Se,{title:Y[h],children:e.jsx(v,{children:h})})},h))})}ee.propTypes={scope:n.string};const te=r=>{const{prefix:a}=$(),{blocklet:i}=Ae(),h=ie(a,"/api/media/upload",i.appPid),l=U.useCallback(f=>f?f.startsWith("http")?f:`${ie(a,"/api/media/upload",i.appPid)}/${f}`:"",[a,i.appPid]);return{clientLogoUrl:U.useMemo(()=>l(r),[r,l]),apiPath:h,getClientLogoUrl:l}},Ve=U.lazy(()=>ve(()=>import("./index-D0mTUcjJ.js"),__vite__mapDeps([0,1,2]),import.meta.url).then(r=>({default:r.Uploader})));function me({client:r,onUpdate:a,onClose:i}){const[h,l]=U.useState(!1),{t:s,locale:f}=B(),d=U.useRef(null),{api:y}=$(),{teamDid:g}=_(),{control:u,handleSubmit:q,formState:{errors:m},watch:T,setValue:R,getValues:E}=de({defaultValues:{clientName:r.clientName||"",clientUri:r.clientUri||"",redirectUris:Array.isArray(r.redirectUris)?r.redirectUris.join(","):"",scope:r.scope?r.scope.split(" "):["profile:read"],contacts:Array.isArray(r.contacts)?r.contacts.join(","):"",tosUri:r.tosUri||"",policyUri:r.policyUri||"",logoUri:r.logoUri||"",clientSecretExpiresAt:r.clientSecretExpiresAt||null},mode:"onChange"}),o=T("scope"),x=T("logoUri"),{clientLogoUrl:k,apiPath:W}=te(x),A=t=>{t!=="profile:read"&&R("scope",o.includes(t)?o.filter(p=>p!==t):[...o,t])},O=async t=>{const p={clientId:r.clientId,clientName:t.clientName.trim(),clientUri:t.clientUri,redirectUris:t.redirectUris.split(",").map(j=>j.trim()).filter(Boolean),contacts:t.contacts?t.contacts.split(",").map(j=>j.trim()):[],scope:t.scope.join(" "),tosUri:t.tosUri,policyUri:t.policyUri,logoUri:t.logoUri,clientSecretExpiresAt:t.clientSecretExpiresAt?parseInt(t.clientSecretExpiresAt/1e3,10):null};await y.updateOAuthClient({input:{teamDid:g,input:p}})},z=async t=>{l(!0);try{await O(t),a(),i()}catch(p){M.error(p.message||s("oauth.client.updateFailed"))}finally{l(!1)}};return e.jsxs(H,{open:!0,onClose:i,maxWidth:"md",fullWidth:!0,children:[e.jsxs(K,{children:[s("oauth.client.update")," ",e.jsx(X,{onClick:i,sx:{position:"absolute",right:8,top:8},children:e.jsx(G,{})})]}),e.jsx(J,{children:e.jsxs(N,{spacing:3,sx:{mt:2},children:[e.jsxs(c,{sx:{mb:3},children:[e.jsx(I,{variant:"subtitle1",sx:{fontWeight:500,mb:1},children:s("oauth.client.logo")}),e.jsxs(c,{children:[e.jsx(c,{sx:{width:120,height:120,position:"relative",borderRadius:"4px",overflow:"hidden"},children:k?e.jsx(c,{children:e.jsx("img",{src:k,alt:"client-logo",style:{width:"100%",height:"100%"}})}):e.jsx(c,{onClick:()=>{d.current?.open()},sx:{width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center",bgcolor:"grey.200"},children:e.jsx(ue,{sx:{fontSize:40,color:"common.white"}})})}),e.jsx(L,{sx:{mt:2},variant:"outlined",size:"small",onClick:()=>{d.current?.open()},children:s(k?"common.change":"common.upload")})]}),e.jsx(c,{sx:{display:"flex",alignItems:"center"},children:e.jsx(U.Suspense,{fallback:e.jsx(De,{}),children:e.jsx(Ve,{ref:d,locale:f,popup:!0,onUploadFinish:t=>{R("logoUri",t.data.filename),O(E()).then(()=>{a()}).catch(p=>{M.error(p.message||s("oauth.client.updateFailed"))}).finally(()=>{d.current?.close()})},plugins:["ImageEditor"],installerProps:{disabled:!0},apiPathProps:{uploader:W,disableMediaKitPrefix:!0,disableAutoPrefix:!0,disableMediaKitStatus:!0},coreProps:{restrictions:{allowedFileTypes:["image/png","image/jpeg","image/webp","image/svg+xml"],maxFileSize:1024*1024*.5,maxNumberOfFiles:1}},dashboardProps:{autoOpen:"imageEditor"},imageEditorProps:{actions:{revert:!0,rotate:!0,granularRotate:!0,flip:!0,zoomIn:!0,zoomOut:!0,cropSquare:!1,cropWidescreen:!1,cropWidescreenVertical:!1},cropperOptions:{autoCrop:!0,aspectRatio:1,initialAspectRatio:1,autoCropArea:1,croppedCanvasOptions:{minWidth:256,minHeight:256}}}},"uploader-logo")})})]}),e.jsx(I,{variant:"subtitle1",sx:{fontWeight:500},children:s("oauth.client.requiredInformation")}),e.jsx(w,{label:"Client Id",fullWidth:!0,value:r.clientId,disabled:!0}),e.jsx(c,{children:e.jsx(S,{name:"clientName",control:u,rules:{required:s("oauth.client.validate.clientName"),minLength:{value:3,message:s("oauth.client.validate.clientNameMinLength")}},render:({field:t})=>e.jsxs(e.Fragment,{children:[e.jsx(w,{...t,label:s("oauth.client.name"),required:!0,fullWidth:!0,error:!!m.clientName,helperText:m.clientName?.message}),e.jsx(C,{children:s("oauth.client.helperText.clientName")})]})})}),e.jsx(c,{children:e.jsx(S,{name:"clientUri",control:u,rules:{required:s("oauth.client.validate.clientUri"),pattern:{value:/^https?:\/\/.+/,message:s("oauth.client.validate.clientUriInvalid")}},render:({field:t})=>e.jsxs(e.Fragment,{children:[e.jsx(w,{...t,label:s("oauth.client.input.clientUri"),required:!0,fullWidth:!0,error:!!m.clientUri,helperText:m.clientUri?.message}),e.jsx(C,{children:s("oauth.client.helperText.clientUri")})]})})}),e.jsx(c,{children:e.jsx(S,{name:"redirectUris",control:u,rules:{required:s("oauth.client.validate.redirectUris"),pattern:{value:/^https?:\/\/.+/,message:s("oauth.client.validate.redirectUrisInvalid")}},render:({field:t})=>e.jsxs(e.Fragment,{children:[e.jsx(w,{...t,label:s("oauth.client.input.redirectUris"),required:!0,fullWidth:!0,multiline:!0,rows:2,error:!!m.redirectUris,helperText:m.redirectUris?.message}),e.jsx(C,{children:s("oauth.client.helperText.redirectUris")})]})})}),e.jsx(S,{name:"clientSecretExpiresAt",control:u,render:({field:t})=>e.jsx(ze,{placeholder:s("oauth.client.input.expireTime"),value:t.value*1e3,onChange:p=>{t.onChange(p)}})}),e.jsxs(c,{sx:{display:"none"},children:[e.jsx(I,{variant:"subtitle2",sx:{mb:1},children:s("oauth.client.input.permissions")}),e.jsx(c,{sx:{border:"1px solid",borderColor:"divider",borderRadius:1,p:2},children:e.jsx(ne,{children:Object.entries(Y).map(([t,p])=>e.jsx(se,{control:e.jsx(oe,{checked:o.includes(t),onChange:()=>A(t),disabled:t==="profile:read",color:"primary"}),label:e.jsx(c,{children:e.jsx(I,{variant:"body2",sx:{fontWeight:500},children:p})})},t))})})]}),e.jsx(Z,{}),e.jsx(I,{variant:"subtitle1",sx:{fontWeight:500},children:s("oauth.client.optionalInformation")}),e.jsx(c,{children:e.jsx(S,{name:"contacts",control:u,rules:{pattern:{value:/^$|^[^@\s]+@[^@\s]+\.[^@\s]+(\s*,\s*[^@\s]+@[^@\s]+\.[^@\s]+)*$/,message:s("oauth.client.validate.contacts")}},render:({field:t})=>e.jsxs(e.Fragment,{children:[e.jsx(w,{...t,label:s("oauth.client.input.contacts"),fullWidth:!0,error:!!m.contacts,helperText:m.contacts?.message}),e.jsx(C,{children:s("oauth.client.helperText.contacts")})]})})}),e.jsxs(N,{direction:{xs:"column",sm:"row"},spacing:2,children:[e.jsx(S,{name:"tosUri",control:u,rules:{pattern:{value:/^$|^https?:\/\/.+/,message:s("oauth.client.validate.tosUriInvalid")}},render:({field:t})=>e.jsxs(c,{sx:{width:"50%"},children:[e.jsx(w,{...t,label:s("oauth.client.input.tosUri"),fullWidth:!0,error:!!m.tosUri,helperText:m.tosUri?.message}),e.jsx(C,{children:s("oauth.client.helperText.tosUri")})]})}),e.jsx(S,{name:"policyUri",control:u,rules:{pattern:{value:/^$|^https?:\/\/.+/,message:s("oauth.client.validate.policyUriInvalid")}},render:({field:t})=>e.jsxs(c,{sx:{width:"50%"},children:[e.jsx(w,{...t,label:s("oauth.client.input.policyUri"),fullWidth:!0,error:!!m.policyUri,helperText:m.policyUri?.message}),e.jsx(C,{children:s("oauth.client.helperText.policyUri")})]})})]}),m.error&&e.jsx(ae,{severity:"error",children:m.error.message})]})}),e.jsxs(ce,{children:[e.jsx(L,{onClick:i,children:s("common.cancel")}),e.jsx(L,{onClick:q(z),disabled:h,variant:"contained",color:"primary",children:h?e.jsx(Q,{size:16}):s("common.update")})]})]})}me.propTypes={client:n.shape({clientId:n.string.isRequired,clientName:n.string.isRequired,clientUri:n.string,redirectUris:n.arrayOf(n.string),scope:n.string,contacts:n.arrayOf(n.string),tosUri:n.string,policyUri:n.string,logoUri:n.string,clientSecretExpiresAt:n.number}).isRequired,onUpdate:n.func.isRequired,onClose:n.func.isRequired};function xe({client:r,onUpdate:a,onClose:i}){return e.jsx(me,{client:r,onUpdate:h=>a(h),onClose:i})}xe.propTypes={client:n.shape({clientId:n.string.isRequired,clientName:n.string.isRequired,clientUri:n.string,redirectUris:n.arrayOf(n.string),scope:n.string,contacts:n.arrayOf(n.string),tosUri:n.string,policyUri:n.string,logoUri:n.string,clientSecretExpiresAt:n.number}).isRequired,onUpdate:n.func.isRequired,onClose:n.func.isRequired};function je({clientId:r,clientName:a,onDelete:i=()=>{},onClose:h=()=>{}}){const{t:l}=B(),{api:s}=$(),{teamDid:f}=_(),d=()=>{h()},y=async()=>{try{await s.deleteOAuthClient({input:{teamDid:f,clientId:r}}),i()}catch(u){M.error(u?.message)}finally{d()}},g={keyName:a,title:l("oauth.client.delete.title"),description:l("oauth.client.delete.description",{name:`<b>${a}</b>`}),confirmPlaceholder:l("oauth.client.delete.description",{name:a}),confirm:l("common.delConfirm"),cancel:l("common.cancel"),onConfirm:y,onCancel:d};return e.jsx(Le,{keyName:g.keyName,title:g.title,description:g.description,confirmPlaceholder:g.confirmPlaceholder,confirm:g.confirm,cancel:g.cancel,params:g.params,onConfirm:g.onConfirm,onCancel:g.onCancel})}je.propTypes={clientId:n.string.isRequired,clientName:n.string.isRequired,onDelete:n.func,onClose:n.func};function ge({title:r,items:a}){return e.jsxs(c,{sx:{mb:3},children:[e.jsx(I,{variant:"h6",sx:{mb:1.5},children:r}),e.jsx(N,{spacing:1.5,children:a.map(({label:i,value:h})=>e.jsxs(c,{sx:{display:"flex",alignItems:"center",gap:2},children:[e.jsx(I,{variant:"subtitle2",color:"textSecondary",sx:{minWidth:200},children:i}),e.jsx(I,{sx:{wordBreak:"break-all"},children:h||"-"})]},i))})]})}ge.propTypes={title:n.string.isRequired,items:n.arrayOf(n.shape({label:n.string.isRequired,value:n.any})).isRequired};function fe({client:r,onClose:a}){const{t:i,locale:h}=B(),{teamDid:l}=_(),{clientName:s,clientId:f,clientSecret:d,redirectUris:y,scope:g,clientUri:u,logoUri:q,contacts:m,tosUri:T,policyUri:R,jwksUri:E,jwks:o,softwareId:x,softwareVersion:k,clientIdIssuedAt:W,clientSecretExpiresAt:A,updatedAt:O,createUser:z}=r,{clientLogoUrl:t}=te(q),p=P=>{try{const F=new URL(window.blocklet.appUrl);return F.pathname=P,F.toString()}catch{return"-"}},j=pe.fromAppDid(f,l),b=[{title:i("common.baseInfo"),items:[{label:i("oauth.client.name"),value:s},{label:i("oauth.client.logoUri"),value:e.jsx(le,{variant:"rounded",shape:"square",src:t,did:j.address,size:64})},{label:i("oauth.client.clientUri"),value:u?e.jsx(v,{children:u}):"-"},{label:i("oauth.client.clientId"),value:e.jsx(v,{children:f})},{label:i("oauth.client.clientSecret"),value:e.jsx(v,{children:d})},{label:i("oauth.client.redirectUris"),value:e.jsx(v,{children:(y||[]).join(", ")})},{label:i("oauth.client.scope"),value:e.jsx(ee,{scope:g})},{label:i("oauth.client.createUser"),value:z?Fe(z,!0):i("oauth.client.openRegistration")}]},{title:i("oauth.client.oauthEndpoints"),items:[{label:i("oauth.client.openidConfiguration"),value:e.jsx(v,{children:p("/.well-known/openid-configuration")})},{label:i("oauth.client.authorizationEndpoint"),value:e.jsx(v,{children:p(`${D}/oauth/authorize`)})},{label:i("oauth.client.tokenEndpoint"),value:e.jsx(v,{children:p(`${D}/oauth/token`)})},{label:i("oauth.client.userinfoEndpoint"),value:e.jsx(v,{children:p(`${D}/oauth/userinfo`)})},{label:i("oauth.client.jwksUri"),value:e.jsx(v,{children:p(`${D}/oauth/jwks`)})},{label:i("oauth.client.registrationEndpoint"),value:e.jsx(v,{children:p(`${D}/oauth/register`)})},{label:i("oauth.client.endSessionEndpoint"),value:e.jsx(v,{children:p(`${D}/oauth/logout`)})}]},{title:i("oauth.client.metaContact"),items:[{label:i("oauth.client.contacts"),value:m.length?e.jsx(v,{children:(m||[]).join(", ")}):"-"},{label:i("oauth.client.tosUri"),value:T?e.jsx(v,{children:T}):"-"},{label:i("oauth.client.policyUri"),value:R?e.jsx(v,{children:R}):"-"},{label:i("oauth.client.jwksUri"),value:E},{label:i("oauth.client.jwks"),value:o},{label:i("oauth.client.softwareId"),value:x},{label:i("oauth.client.softwareVersion"),value:k}]},{title:i("common.timeInfo"),items:[{label:i("oauth.client.clientIdIssuedAt"),value:W?e.jsx(V,{value:W*1e3,type:"all",locale:h}):"-"},{label:i("oauth.client.clientSecretExpiresAt"),value:A?e.jsx(V,{value:A*1e3,type:"all",locale:h}):"-"},{label:i("common.updatedAt"),value:O?e.jsx(V,{value:O,type:"all",locale:h}):"-"}]}].filter(Boolean);return e.jsxs(H,{open:!0,onClose:a,maxWidth:"lg",fullWidth:!0,children:[e.jsxs(K,{children:[i("oauth.client.oauthAppDetails"),e.jsx(X,{onClick:a,sx:{position:"absolute",right:8,top:8},children:e.jsx(G,{})})]}),e.jsx(J,{children:e.jsx(c,{sx:{mt:1},children:b.map((P,F)=>e.jsxs(c,{children:[e.jsx(ge,{title:P.title,items:P.items}),F!==b.length-1&&e.jsx(Z,{sx:{my:2}})]},P.title))})})]})}fe.propTypes={client:n.object.isRequired,onClose:n.func.isRequired};function Me(r){return e.jsx(V,{value:r*1e3})}function be({selected:r=null,onClose:a}){return r?e.jsx(fe,{client:r,onClose:a}):null}be.propTypes={selected:n.object,onClose:n.func.isRequired};function Ue({open:r,onCreated:a,onClose:i}){return r?e.jsx(he,{onCreated:a,onClose:i}):null}Ue.propTypes={open:n.bool.isRequired,onCreated:n.func.isRequired,onClose:n.func.isRequired};function Et(){const[r,a]=U.useState({searchText:"",pageSize:10,page:1}),[i,h]=U.useState(null),[l,s]=U.useState(!1),f=U.useRef(null),{t:d,locale:y}=B(),{api:g}=$(),{teamDid:u}=_(),[q,m]=U.useState(null),[T,R]=U.useState(null),E=$e(),{getClientLogoUrl:o}=te(),x=We(async()=>await g.getOAuthClients({input:{teamDid:u,paging:{page:r.page,pageSize:r.pageSize}}}),[r.page,r.pageSize]),{loading:k}=x,W=U.useMemo(()=>x.value?.list||[],[x.value?.list]),A=U.useMemo(()=>r.searchText?W.filter(t=>t.clientName.toLowerCase().includes(r.searchText.toLowerCase())||t.clientId.toLowerCase().includes(r.searchText.toLowerCase())||t.scope.toLowerCase().includes(r.searchText.toLowerCase())):W,[r.searchText,W]),O=U.useMemo(()=>[{label:d("oauth.client.name"),name:"clientName",options:{customBodyRender:(t,{rowIndex:p})=>{const j=A[p],b=o(j.logoUri),P=pe.fromAppDid(j.clientId,u);return e.jsx(c,{sx:{display:"flex",alignItems:"center",gap:2},children:e.jsxs(c,{sx:{display:"flex",alignItems:"center",gap:2,cursor:"pointer"},children:[e.jsx(le,{variant:"rounded",shape:"square",did:P.address,src:b,size:48}),e.jsxs(N,{sx:{gap:.5},children:[e.jsx(c,{sx:{color:"text.primary"},children:j.clientName}),e.jsx(c,{sx:{color:"text.secondary"},children:j.clientUri})]})]})})}}},{label:d("oauth.client.clientId"),name:"clientId"},{label:d("oauth.client.scope"),name:"scope",options:{customBodyRender:t=>e.jsx(ee,{scope:t})}},{label:d("common.createdAt"),name:"clientIdIssuedAt",options:{customBodyRender:Me}},{label:d("common.createdBy"),name:"createdBy",width:100,options:{customBodyRender:t=>t?e.jsx(ke,{showDid:!0,did:t,cardType:Ee.Detailed,infoType:qe.Minimal,sx:{border:0,padding:0}}):d("oauth.client.openRegistration")}},{label:d("common.actions"),name:"actions",width:100,align:"center",verticalKeyAlign:"center",options:{customBodyRender:(t,{rowIndex:p})=>{const j=A[p];return e.jsx(Be,{actions:[{icon:e.jsx(Ie,{}),text:d("common.edit"),onClick:b=>{b.stopPropagation(),m(j)}},{icon:e.jsx(Re,{}),text:d("common.delete"),onClick:b=>{b.stopPropagation(),R(j)}}]})}}}],[A,d,o,u,m,R]),z=({page:t,rowsPerPage:p,searchText:j})=>{r.pageSize!==p?a(b=>({...b,searchText:"",pageSize:p,page:1})):r.page!==t+1?a(b=>({...b,searchText:"",page:t+1})):r.searchText!==j&&a(b=>({...b,searchText:j,page:1}))};return e.jsxs(c,{ref:f,sx:{".custom-toobar-btns":{gap:"8px"},".custom-toobar-title .custom-toobar-title-inner>span":{display:"flex",alignItems:"center","white-space":"inherit",height:"100%"}},children:[E?e.jsx(re,{title:d("oauth.client.listTitle"),tooltipTitle:d("oauth.client.tooltipTitle"),link:`https://www.arcblock.io/docs/blocklet-developer/${y}/oauth-service`}):null,e.jsx(Ce,{data:A,columns:O,options:{sort:!1,download:!1,filter:!1,print:!1,viewColumns:!1,page:r.page-1,rowsPerPage:r.pageSize,count:A.length,searchDebounceTime:400,onRowClick(t,{dataIndex:p},j){if(f.current?.contains(j.target)){const b=A[p];h(b)}}},onChange:z,title:E?null:e.jsx(re,{title:d("oauth.client.listTitle"),tooltipTitle:d("oauth.client.tooltipTitle"),link:`https://www.arcblock.io/docs/blocklet-developer/${y}/oauth-service`}),customButtons:[e.jsxs(L,{variant:"contained",size:"small",onClick:()=>s(!0),children:[k?e.jsx(Q,{size:16}):e.jsx(ue,{style:{fontSize:16}}),d("common.create")]},"add")],loading:!1,emptyNode:e.jsx(Te,{children:d("oauth.client.empty")})}),e.jsx(be,{selected:i,onClose:()=>h(null)}),e.jsx(Ue,{open:l,onCreated:()=>{s(!1),x.retry()},onClose:()=>s(!1)}),q&&e.jsx(xe,{client:q,onUpdate:x.retry,onClose:()=>m(null)}),T&&e.jsx(je,{...T,onDelete:x.retry,onClose:()=>R(null)})]})}export{Et as default};
@@ -1 +1 @@
1
- import{j as o}from"./vendor-mui-core-CDEc-eG6.js";import"./vendor-react-DX7tU9aY.js";import{S as t}from"./studio-fGrv4L1C.js";import"./vendor-ux-PO0jFgJf.js";import"./vendor-utils-_C9URqjS.js";import"./vendor-hooks-Ca2cSNuD.js";import"./index-BtpVtm9d.js";import"./index-DcM4ljaV.js";import"./vendor-arcblock-BVQTtbN-.js";import"./nav-menu-CFJ8S6L5.js";import"./fallback-DAsXuNMP.js";function x(){return o.jsx(t,{children:"Coming soon..."})}export{x as default};
1
+ import{j as o}from"./vendor-mui-core-CDEc-eG6.js";import"./vendor-react-DX7tU9aY.js";import{S as t}from"./studio-CYIn9aNz.js";import"./vendor-ux-PO0jFgJf.js";import"./vendor-utils-_C9URqjS.js";import"./vendor-hooks-Ca2cSNuD.js";import"./index-DI80KOep.js";import"./index-CgSpL7jz.js";import"./vendor-arcblock-BVQTtbN-.js";import"./nav-menu-CFJ8S6L5.js";import"./fallback-DAsXuNMP.js";function x(){return o.jsx(t,{children:"Coming soon..."})}export{x as default};
@@ -1,4 +1,4 @@
1
- import{aT as fe,j as Y,X as te,L as Ye,bI as Xe,R as Je,al as _e,a7 as Le,d9 as Ze,z as Fe,bN as We,M as Ue,dR as Qe,A as et}from"./vendor-mui-core-CDEc-eG6.js";import{u as tt}from"./useLocalStorage-CSvyQkk-.js";import{p as De,a as it,d as rt,g as Ne,r as oe,j as st}from"./vendor-react-DX7tU9aY.js";import{d as nt,n as Re}from"./vendor-utils-_C9URqjS.js";import{cI as ot,X as $e,M as at}from"./index-DcM4ljaV.js";import{aa as ht,bk as Ae,b1 as lt,a3 as ct}from"./vendor-ux-PO0jFgJf.js";import{B as dt}from"./bundle-avatar-7Wt_FbiF.js";import"./vendor-arcblock-BVQTtbN-.js";import"./vendor-hooks-Ca2cSNuD.js";var ye={exports:{}},Be;function ut(){return Be||(Be=1,(function(G,V){(function(j,K){G.exports=K()})(globalThis,(()=>(()=>{var j={4567:function(R,s,o){var d=this&&this.__decorate||function(e,i,a,f){var p,g=arguments.length,l=g<3?i:f===null?f=Object.getOwnPropertyDescriptor(i,a):f;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")l=Reflect.decorate(e,i,a,f);else for(var m=e.length-1;m>=0;m--)(p=e[m])&&(l=(g<3?p(l):g>3?p(i,a,l):p(i,a))||l);return g>3&&l&&Object.defineProperty(i,a,l),l},_=this&&this.__param||function(e,i){return function(a,f){i(a,f,e)}};Object.defineProperty(s,"__esModule",{value:!0}),s.AccessibilityManager=void 0;const n=o(9042),c=o(9924),u=o(844),v=o(4725),h=o(2585),t=o(3656);let r=s.AccessibilityManager=class extends u.Disposable{constructor(e,i,a,f){super(),this._terminal=e,this._coreBrowserService=a,this._renderService=f,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="",this._accessibilityContainer=this._coreBrowserService.mainDocument.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=this._coreBrowserService.mainDocument.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let p=0;p<this._terminal.rows;p++)this._rowElements[p]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[p]);if(this._topBoundaryFocusListener=p=>this._handleBoundaryFocus(p,0),this._bottomBoundaryFocusListener=p=>this._handleBoundaryFocus(p,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions(),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=this._coreBrowserService.mainDocument.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this.register(new c.TimeBasedDebouncer(this._renderRows.bind(this))),!this._terminal.element)throw new Error("Cannot enable accessibility before Terminal.open");this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityContainer),this.register(this._terminal.onResize((p=>this._handleResize(p.rows)))),this.register(this._terminal.onRender((p=>this._refreshRows(p.start,p.end)))),this.register(this._terminal.onScroll((()=>this._refreshRows()))),this.register(this._terminal.onA11yChar((p=>this._handleChar(p)))),this.register(this._terminal.onLineFeed((()=>this._handleChar(`
1
+ import{aT as fe,j as Y,X as te,L as Ye,bI as Xe,R as Je,al as _e,a7 as Le,d9 as Ze,z as Fe,bN as We,M as Ue,dR as Qe,A as et}from"./vendor-mui-core-CDEc-eG6.js";import{u as tt}from"./useLocalStorage-CSvyQkk-.js";import{p as De,a as it,d as rt,g as Ne,r as oe,j as st}from"./vendor-react-DX7tU9aY.js";import{d as nt,n as Re}from"./vendor-utils-_C9URqjS.js";import{cI as ot,X as $e,M as at}from"./index-CgSpL7jz.js";import{aa as ht,bk as Ae,b1 as lt,a3 as ct}from"./vendor-ux-PO0jFgJf.js";import{B as dt}from"./bundle-avatar-CQ5BcuIS.js";import"./vendor-arcblock-BVQTtbN-.js";import"./vendor-hooks-Ca2cSNuD.js";var ye={exports:{}},Be;function ut(){return Be||(Be=1,(function(G,V){(function(j,K){G.exports=K()})(globalThis,(()=>(()=>{var j={4567:function(R,s,o){var d=this&&this.__decorate||function(e,i,a,f){var p,g=arguments.length,l=g<3?i:f===null?f=Object.getOwnPropertyDescriptor(i,a):f;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")l=Reflect.decorate(e,i,a,f);else for(var m=e.length-1;m>=0;m--)(p=e[m])&&(l=(g<3?p(l):g>3?p(i,a,l):p(i,a))||l);return g>3&&l&&Object.defineProperty(i,a,l),l},_=this&&this.__param||function(e,i){return function(a,f){i(a,f,e)}};Object.defineProperty(s,"__esModule",{value:!0}),s.AccessibilityManager=void 0;const n=o(9042),c=o(9924),u=o(844),v=o(4725),h=o(2585),t=o(3656);let r=s.AccessibilityManager=class extends u.Disposable{constructor(e,i,a,f){super(),this._terminal=e,this._coreBrowserService=a,this._renderService=f,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="",this._accessibilityContainer=this._coreBrowserService.mainDocument.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=this._coreBrowserService.mainDocument.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let p=0;p<this._terminal.rows;p++)this._rowElements[p]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[p]);if(this._topBoundaryFocusListener=p=>this._handleBoundaryFocus(p,0),this._bottomBoundaryFocusListener=p=>this._handleBoundaryFocus(p,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions(),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=this._coreBrowserService.mainDocument.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this.register(new c.TimeBasedDebouncer(this._renderRows.bind(this))),!this._terminal.element)throw new Error("Cannot enable accessibility before Terminal.open");this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityContainer),this.register(this._terminal.onResize((p=>this._handleResize(p.rows)))),this.register(this._terminal.onRender((p=>this._refreshRows(p.start,p.end)))),this.register(this._terminal.onScroll((()=>this._refreshRows()))),this.register(this._terminal.onA11yChar((p=>this._handleChar(p)))),this.register(this._terminal.onLineFeed((()=>this._handleChar(`
2
2
  `)))),this.register(this._terminal.onA11yTab((p=>this._handleTab(p)))),this.register(this._terminal.onKey((p=>this._handleKey(p.key)))),this.register(this._terminal.onBlur((()=>this._clearLiveRegion()))),this.register(this._renderService.onDimensionsChange((()=>this._refreshRowsDimensions()))),this.register((0,t.addDisposableDomListener)(document,"selectionchange",(()=>this._handleSelectionChange()))),this.register(this._coreBrowserService.onDprChange((()=>this._refreshRowsDimensions()))),this._refreshRows(),this.register((0,u.toDisposable)((()=>{this._accessibilityContainer.remove(),this._rowElements.length=0})))}_handleTab(e){for(let i=0;i<e;i++)this._handleChar(" ")}_handleChar(e){this._liveRegionLineCount<21&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
3
3
  `&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=n.tooMuchOutput)))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(e){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(e)||this._charsToConsume.push(e)}_refreshRows(e,i){this._liveRegionDebouncer.refresh(e,i,this._terminal.rows)}_renderRows(e,i){const a=this._terminal.buffer,f=a.lines.length.toString();for(let p=e;p<=i;p++){const g=a.lines.get(a.ydisp+p),l=[],m=g?.translateToString(!0,void 0,void 0,l)||"",E=(a.ydisp+p+1).toString(),x=this._rowElements[p];x&&(m.length===0?(x.innerText=" ",this._rowColumns.set(x,[0,1])):(x.textContent=m,this._rowColumns.set(x,l)),x.setAttribute("aria-posinset",E),x.setAttribute("aria-setsize",f))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(e,i){const a=e.target,f=this._rowElements[i===0?1:this._rowElements.length-2];if(a.getAttribute("aria-posinset")===(i===0?"1":`${this._terminal.buffer.lines.length}`)||e.relatedTarget!==f)return;let p,g;if(i===0?(p=a,g=this._rowElements.pop(),this._rowContainer.removeChild(g)):(p=this._rowElements.shift(),g=a,this._rowContainer.removeChild(p)),p.removeEventListener("focus",this._topBoundaryFocusListener),g.removeEventListener("focus",this._bottomBoundaryFocusListener),i===0){const l=this._createAccessibilityTreeNode();this._rowElements.unshift(l),this._rowContainer.insertAdjacentElement("afterbegin",l)}else{const l=this._createAccessibilityTreeNode();this._rowElements.push(l),this._rowContainer.appendChild(l)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(i===0?-1:1),this._rowElements[i===0?1:this._rowElements.length-2].focus(),e.preventDefault(),e.stopImmediatePropagation()}_handleSelectionChange(){if(this._rowElements.length===0)return;const e=document.getSelection();if(!e)return;if(e.isCollapsed)return void(this._rowContainer.contains(e.anchorNode)&&this._terminal.clearSelection());if(!e.anchorNode||!e.focusNode)return void console.error("anchorNode and/or focusNode are null");let i={node:e.anchorNode,offset:e.anchorOffset},a={node:e.focusNode,offset:e.focusOffset};if((i.node.compareDocumentPosition(a.node)&Node.DOCUMENT_POSITION_PRECEDING||i.node===a.node&&i.offset>a.offset)&&([i,a]=[a,i]),i.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(i={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(i.node))return;const f=this._rowElements.slice(-1)[0];if(a.node.compareDocumentPosition(f)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(a={node:f,offset:f.textContent?.length??0}),!this._rowContainer.contains(a.node))return;const p=({node:m,offset:E})=>{const x=m instanceof Text?m.parentNode:m;let L=parseInt(x?.getAttribute("aria-posinset"),10)-1;if(isNaN(L))return console.warn("row is invalid. Race condition?"),null;const b=this._rowColumns.get(x);if(!b)return console.warn("columns is null. Race condition?"),null;let A=E<b.length?b[E]:b.slice(-1)[0]+1;return A>=this._terminal.cols&&(++L,A=0),{row:L,column:A}},g=p(i),l=p(a);if(g&&l){if(g.row>l.row||g.row===l.row&&g.column>=l.column)throw new Error("invalid range");this._terminal.select(g.column,g.row,(l.row-g.row)*this._terminal.cols-g.column+l.column)}}_handleResize(e){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let i=this._rowContainer.children.length;i<this._terminal.rows;i++)this._rowElements[i]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[i]);for(;this._rowElements.length>e;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){const e=this._coreBrowserService.mainDocument.createElement("div");return e.setAttribute("role","listitem"),e.tabIndex=-1,this._refreshRowDimensions(e),e}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){this._accessibilityContainer.style.width=`${this._renderService.dimensions.css.canvas.width}px`,this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let e=0;e<this._terminal.rows;e++)this._refreshRowDimensions(this._rowElements[e])}}_refreshRowDimensions(e){e.style.height=`${this._renderService.dimensions.css.cell.height}px`}};s.AccessibilityManager=r=d([_(1,h.IInstantiationService),_(2,v.ICoreBrowserService),_(3,v.IRenderService)],r)},3614:(R,s)=>{function o(c){return c.replace(/\r?\n/g,"\r")}function d(c,u){return u?"\x1B[200~"+c+"\x1B[201~":c}function _(c,u,v,h){c=d(c=o(c),v.decPrivateModes.bracketedPasteMode&&h.rawOptions.ignoreBracketedPasteMode!==!0),v.triggerDataEvent(c,!0),u.value=""}function n(c,u,v){const h=v.getBoundingClientRect(),t=c.clientX-h.left-10,r=c.clientY-h.top-10;u.style.width="20px",u.style.height="20px",u.style.left=`${t}px`,u.style.top=`${r}px`,u.style.zIndex="1000",u.focus()}Object.defineProperty(s,"__esModule",{value:!0}),s.rightClickHandler=s.moveTextAreaUnderMouseCursor=s.paste=s.handlePasteEvent=s.copyHandler=s.bracketTextForPaste=s.prepareTextForTerminal=void 0,s.prepareTextForTerminal=o,s.bracketTextForPaste=d,s.copyHandler=function(c,u){c.clipboardData&&c.clipboardData.setData("text/plain",u.selectionText),c.preventDefault()},s.handlePasteEvent=function(c,u,v,h){c.stopPropagation(),c.clipboardData&&_(c.clipboardData.getData("text/plain"),u,v,h)},s.paste=_,s.moveTextAreaUnderMouseCursor=n,s.rightClickHandler=function(c,u,v,h,t){n(c,u,v),t&&h.rightClickSelect(c),u.value=h.selectionText,u.select()}},7239:(R,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.ColorContrastCache=void 0;const d=o(1505);s.ColorContrastCache=class{constructor(){this._color=new d.TwoKeyMap,this._css=new d.TwoKeyMap}setCss(_,n,c){this._css.set(_,n,c)}getCss(_,n){return this._css.get(_,n)}setColor(_,n,c){this._color.set(_,n,c)}getColor(_,n){return this._color.get(_,n)}clear(){this._color.clear(),this._css.clear()}}},3656:(R,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.addDisposableDomListener=void 0,s.addDisposableDomListener=function(o,d,_,n){o.addEventListener(d,_,n);let c=!1;return{dispose:()=>{c||(c=!0,o.removeEventListener(d,_,n))}}}},3551:function(R,s,o){var d=this&&this.__decorate||function(r,e,i,a){var f,p=arguments.length,g=p<3?e:a===null?a=Object.getOwnPropertyDescriptor(e,i):a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")g=Reflect.decorate(r,e,i,a);else for(var l=r.length-1;l>=0;l--)(f=r[l])&&(g=(p<3?f(g):p>3?f(e,i,g):f(e,i))||g);return p>3&&g&&Object.defineProperty(e,i,g),g},_=this&&this.__param||function(r,e){return function(i,a){e(i,a,r)}};Object.defineProperty(s,"__esModule",{value:!0}),s.Linkifier=void 0;const n=o(3656),c=o(8460),u=o(844),v=o(2585),h=o(4725);let t=s.Linkifier=class extends u.Disposable{get currentLink(){return this._currentLink}constructor(r,e,i,a,f){super(),this._element=r,this._mouseService=e,this._renderService=i,this._bufferService=a,this._linkProviderService=f,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this.register(new c.EventEmitter),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this.register(new c.EventEmitter),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this.register((0,u.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,u.toDisposable)((()=>{this._lastMouseEvent=void 0,this._activeProviderReplies?.clear()}))),this.register(this._bufferService.onResize((()=>{this._clearCurrentLink(),this._wasResized=!0}))),this.register((0,n.addDisposableDomListener)(this._element,"mouseleave",(()=>{this._isMouseOut=!0,this._clearCurrentLink()}))),this.register((0,n.addDisposableDomListener)(this._element,"mousemove",this._handleMouseMove.bind(this))),this.register((0,n.addDisposableDomListener)(this._element,"mousedown",this._handleMouseDown.bind(this))),this.register((0,n.addDisposableDomListener)(this._element,"mouseup",this._handleMouseUp.bind(this)))}_handleMouseMove(r){this._lastMouseEvent=r;const e=this._positionFromMouseEvent(r,this._element,this._mouseService);if(!e)return;this._isMouseOut=!1;const i=r.composedPath();for(let a=0;a<i.length;a++){const f=i[a];if(f.classList.contains("xterm"))break;if(f.classList.contains("xterm-hover"))return}this._lastBufferCell&&e.x===this._lastBufferCell.x&&e.y===this._lastBufferCell.y||(this._handleHover(e),this._lastBufferCell=e)}_handleHover(r){if(this._activeLine!==r.y||this._wasResized)return this._clearCurrentLink(),this._askForLink(r,!1),void(this._wasResized=!1);this._currentLink&&this._linkAtPosition(this._currentLink.link,r)||(this._clearCurrentLink(),this._askForLink(r,!0))}_askForLink(r,e){this._activeProviderReplies&&e||(this._activeProviderReplies?.forEach((a=>{a?.forEach((f=>{f.link.dispose&&f.link.dispose()}))})),this._activeProviderReplies=new Map,this._activeLine=r.y);let i=!1;for(const[a,f]of this._linkProviderService.linkProviders.entries())e?this._activeProviderReplies?.get(a)&&(i=this._checkLinkProviderResult(a,r,i)):f.provideLinks(r.y,(p=>{if(this._isMouseOut)return;const g=p?.map((l=>({link:l})));this._activeProviderReplies?.set(a,g),i=this._checkLinkProviderResult(a,r,i),this._activeProviderReplies?.size===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(r.y,this._activeProviderReplies)}))}_removeIntersectingLinks(r,e){const i=new Set;for(let a=0;a<e.size;a++){const f=e.get(a);if(f)for(let p=0;p<f.length;p++){const g=f[p],l=g.link.range.start.y<r?0:g.link.range.start.x,m=g.link.range.end.y>r?this._bufferService.cols:g.link.range.end.x;for(let E=l;E<=m;E++){if(i.has(E)){f.splice(p--,1);break}i.add(E)}}}}_checkLinkProviderResult(r,e,i){if(!this._activeProviderReplies)return i;const a=this._activeProviderReplies.get(r);let f=!1;for(let p=0;p<r;p++)this._activeProviderReplies.has(p)&&!this._activeProviderReplies.get(p)||(f=!0);if(!f&&a){const p=a.find((g=>this._linkAtPosition(g.link,e)));p&&(i=!0,this._handleNewLink(p))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!i)for(let p=0;p<this._activeProviderReplies.size;p++){const g=this._activeProviderReplies.get(p)?.find((l=>this._linkAtPosition(l.link,e)));if(g){i=!0,this._handleNewLink(g);break}}return i}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(r){if(!this._currentLink)return;const e=this._positionFromMouseEvent(r,this._element,this._mouseService);e&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,e)&&this._currentLink.link.activate(r,this._currentLink.link.text)}_clearCurrentLink(r,e){this._currentLink&&this._lastMouseEvent&&(!r||!e||this._currentLink.link.range.start.y>=r&&this._currentLink.link.range.end.y<=e)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,u.disposeArray)(this._linkCacheDisposables))}_handleNewLink(r){if(!this._lastMouseEvent)return;const e=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);e&&this._linkAtPosition(r.link,e)&&(this._currentLink=r,this._currentLink.state={decorations:{underline:r.link.decorations===void 0||r.link.decorations.underline,pointerCursor:r.link.decorations===void 0||r.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,r.link,this._lastMouseEvent),r.link.decorations={},Object.defineProperties(r.link.decorations,{pointerCursor:{get:()=>this._currentLink?.state?.decorations.pointerCursor,set:i=>{this._currentLink?.state&&this._currentLink.state.decorations.pointerCursor!==i&&(this._currentLink.state.decorations.pointerCursor=i,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",i))}},underline:{get:()=>this._currentLink?.state?.decorations.underline,set:i=>{this._currentLink?.state&&this._currentLink?.state?.decorations.underline!==i&&(this._currentLink.state.decorations.underline=i,this._currentLink.state.isHovered&&this._fireUnderlineEvent(r.link,i))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange((i=>{if(!this._currentLink)return;const a=i.start===0?0:i.start+1+this._bufferService.buffer.ydisp,f=this._bufferService.buffer.ydisp+1+i.end;if(this._currentLink.link.range.start.y>=a&&this._currentLink.link.range.end.y<=f&&(this._clearCurrentLink(a,f),this._lastMouseEvent)){const p=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);p&&this._askForLink(p,!1)}}))))}_linkHover(r,e,i){this._currentLink?.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(e,!0),this._currentLink.state.decorations.pointerCursor&&r.classList.add("xterm-cursor-pointer")),e.hover&&e.hover(i,e.text)}_fireUnderlineEvent(r,e){const i=r.range,a=this._bufferService.buffer.ydisp,f=this._createLinkUnderlineEvent(i.start.x-1,i.start.y-a-1,i.end.x,i.end.y-a-1,void 0);(e?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(f)}_linkLeave(r,e,i){this._currentLink?.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(e,!1),this._currentLink.state.decorations.pointerCursor&&r.classList.remove("xterm-cursor-pointer")),e.leave&&e.leave(i,e.text)}_linkAtPosition(r,e){const i=r.range.start.y*this._bufferService.cols+r.range.start.x,a=r.range.end.y*this._bufferService.cols+r.range.end.x,f=e.y*this._bufferService.cols+e.x;return i<=f&&f<=a}_positionFromMouseEvent(r,e,i){const a=i.getCoords(r,e,this._bufferService.cols,this._bufferService.rows);if(a)return{x:a[0],y:a[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(r,e,i,a,f){return{x1:r,y1:e,x2:i,y2:a,cols:this._bufferService.cols,fg:f}}};s.Linkifier=t=d([_(1,h.IMouseService),_(2,h.IRenderService),_(3,v.IBufferService),_(4,h.ILinkProviderService)],t)},9042:(R,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.tooMuchOutput=s.promptLabel=void 0,s.promptLabel="Terminal input",s.tooMuchOutput="Too much output to announce, navigate to rows manually to read"},3730:function(R,s,o){var d=this&&this.__decorate||function(h,t,r,e){var i,a=arguments.length,f=a<3?t:e===null?e=Object.getOwnPropertyDescriptor(t,r):e;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")f=Reflect.decorate(h,t,r,e);else for(var p=h.length-1;p>=0;p--)(i=h[p])&&(f=(a<3?i(f):a>3?i(t,r,f):i(t,r))||f);return a>3&&f&&Object.defineProperty(t,r,f),f},_=this&&this.__param||function(h,t){return function(r,e){t(r,e,h)}};Object.defineProperty(s,"__esModule",{value:!0}),s.OscLinkProvider=void 0;const n=o(511),c=o(2585);let u=s.OscLinkProvider=class{constructor(h,t,r){this._bufferService=h,this._optionsService=t,this._oscLinkService=r}provideLinks(h,t){const r=this._bufferService.buffer.lines.get(h-1);if(!r)return void t(void 0);const e=[],i=this._optionsService.rawOptions.linkHandler,a=new n.CellData,f=r.getTrimmedLength();let p=-1,g=-1,l=!1;for(let m=0;m<f;m++)if(g!==-1||r.hasContent(m)){if(r.loadCell(m,a),a.hasExtendedAttrs()&&a.extended.urlId){if(g===-1){g=m,p=a.extended.urlId;continue}l=a.extended.urlId!==p}else g!==-1&&(l=!0);if(l||g!==-1&&m===f-1){const E=this._oscLinkService.getLinkData(p)?.uri;if(E){const x={start:{x:g+1,y:h},end:{x:m+(l||m!==f-1?0:1),y:h}};let L=!1;if(!i?.allowNonHttpProtocols)try{const b=new URL(E);["http:","https:"].includes(b.protocol)||(L=!0)}catch{L=!0}L||e.push({text:E,range:x,activate:(b,A)=>i?i.activate(b,A,x):v(0,A),hover:(b,A)=>i?.hover?.(b,A,x),leave:(b,A)=>i?.leave?.(b,A,x)})}l=!1,a.hasExtendedAttrs()&&a.extended.urlId?(g=m,p=a.extended.urlId):(g=-1,p=-1)}}t(e)}};function v(h,t){if(confirm(`Do you want to navigate to ${t}?
4
4
 
@@ -1 +1 @@
1
- import{j as e,al as p,T as I,X as r,an as F,R as K,bf as pe,a7 as fe}from"./vendor-mui-core-CDEc-eG6.js";import{h as ue,a as ge,b as me,j as he}from"./vendor-hooks-Ca2cSNuD.js";import{r as X,u as we}from"./vendor-react-DX7tU9aY.js";import{u as xe,z as ye,s as ke,W as R,a as Pe,H as M,b as je,c as be,d as ve,e as z,R as Te,f as Ie}from"./index-DcM4ljaV.js";import{y as A,b as _,F as Ce,c as Le}from"./vendor-utils-_C9URqjS.js";import{o as Re}from"./vendor-arcblock-BVQTtbN-.js";import{a7 as _e,ac as We,aa as G,a0 as B,as as Ae,ai as Se,ah as Ue,a3 as O,ao as Ne,aA as V}from"./vendor-ux-PO0jFgJf.js";import{u as De}from"./use-passport-id-B-b-_oYF.js";import{g as J}from"./get-safe-url-C1Ml6qBb.js";import{d as W}from"./logger-BtwZslJC.js";function Y({blocklet:c=window.blocklet}){return e.jsxs(p,{sx:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(_e,{variant:"rounded",shape:"square",did:c.appPid,src:c.appLogo,size:80}),e.jsx(I,{component:"h2",variant:"h6",children:c.appName}),e.jsx(We,{did:c.appPid})]})}const qe=X.memo(Y);Y.propTypes={blocklet:r.shape({appName:r.string,appLogo:r.string,appPid:r.string})};const Ee=()=>window.blocklet?.componentMountPoints?.find(s=>s.did==="z2qaCNvKMv5GjouKdcDWexv6WqtHbpNPQDnAk")?.mountPoint;function Z({children:c=null,cta:s=null,...i}){return e.jsxs(p,{...i,children:[c?e.jsx(p,{sx:{maxHeight:"50vh",overflow:"hidden",position:"relative",":after":{content:'""',position:"absolute",left:0,right:0,bottom:0,height:"80%",background:"linear-gradient(transparent, #fff 85%)"}},children:c}):null,s?e.jsx(p,{sx:{display:"flex",flexDirection:"column",alignItems:"center",py:4,borderRadius:2},children:s}):null]})}Z.propTypes={children:r.node,cta:r.node};function ee({passports:c=[],onConnect:s=()=>{},redirect:i,...y}){const{t:f}=G(),k=Ee(),P=a=>{const m=a?.payable;return k&&m?A(k,`/api/redirect/checkout/${m}?redirect=${i}`):null};return e.jsxs(p,{sx:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:2,minHeight:"100vh",maxWidth:"400px",margin:"auto",paddingBottom:{sx:0,md:15}},children:[e.jsx(qe,{}),e.jsx(Z,{...y,cta:e.jsxs(e.Fragment,{children:[e.jsx(I,{variant:"h4",sx:{mx:2,textAlign:"center",fontWeight:"bold",color:"warning.main"},children:f("login.accessLimit.title")}),e.jsx(I,{variant:"body1",sx:{maxWidth:620,mt:2,mx:2,textAlign:"center",color:"gray"},children:f("login.accessLimit.description")}),e.jsx(p,{sx:{display:"flex",flexWrap:"wrap",justifyContent:"center",gap:1,mt:5},children:c?.map(a=>{const m=P(a);return m?e.jsx(F,{title:f("login.accessLimit.buyPassport"),arrow:!0,placement:"top",children:e.jsx(K,{color:"primary",variant:"contained",endIcon:e.jsx(pe,{}),href:m,target:"_blank",children:a.title||a.name})},a.name):e.jsx(F,{title:f("login.connectWithPassport"),arrow:!0,placement:"top",children:e.jsx(K,{color:"inherit",variant:"contained",onClick:s,children:a.title||a.name})},a.name)})}),e.jsxs(I,{variant:"body1",sx:{mt:2,color:"grey.400"},children:[e.jsx(p,{component:"span",sx:{display:"inline-block",mr:1},children:f("login.accessLimit.alreadyHavePassport")}),e.jsx(p,{component:"span",sx:{textDecoration:"underline",cursor:"pointer",color:"primary.main"},onClick:s,children:f("common.connect")})]})]})})]})}ee.propTypes={passports:r.arrayOf(r.shape({name:r.string.isRequired,title:r.string,payable:r.string})),onConnect:r.func,onClose:r.func,redirect:r.string.isRequired};function Je(){const c=X.useRef(null),{session:s}=xe(),{t:i,locale:y}=G(),{getPassportId:f}=De(),k=we(),P=B(),a=Ae(),{encryptKey:m,decrypt:ne}=ye(),j=ue(s),{searchParams:t}=new URL(window.location.href),h={passportId:f()},S=t.get("componentId"),U=t.get("authenticated"),oe=t.get("sessionToken"),te=t.get("csrfToken"),ie=t.get("refreshToken"),se=t.get("requiredRoles"),u=t.get("redirect"),d=t.get("forceConnected"),b=t.get("sourceAppPid"),C=t.get("origin"),N=t.get("autoConnectWebview"),D=t.get("popup"),q=t.get("showQuickConnect");let w=t.get("inviter");if(!w&&u)try{w=(u.startsWith("http")?new URL(u):new URL(u,window.location.origin)).searchParams.get("inviter")}catch{}w=w||localStorage.getItem("inviter"),S&&(h.componentId=S),P&&(h.visitorId=P),w&&(h.inviter=w),Le(b)||(b==="null"?h.sourceAppPid=null:b!==null&&(h.sourceAppPid=b));let E=[];try{E=JSON.parse(se)}catch{}const re=async n=>{const o=t.get("fromWallet");W("login page notifyWallet",{data:n,fromWallet:o,"browser.wallet":a.wallet}),n&&String(o)==="1"&&a.wallet&&await Promise.any([V.asyncCall("arcSetToken",n),z(3e3)])},v=n=>n&&(t.get("encrypted")?ne(n):n),H=async n=>{n&&await re(n),setTimeout(()=>{if(u){const o=decodeURIComponent(u);o.startsWith(R)?k(o,{replace:!0}):window.location.replace(J(o))}else window.location.replace(window.env.pathPrefix||"/")},50)},ce=n=>{const o={did:n.user.did,host:window.location.host,appPid:window.blocklet.appPid,visitorId:B(),sourceAppPid:n.user.sourceAppPid,fullName:n.user.fullName};W("bridge callArc: onLogin",o),V.callArc("onLogin",o)},Q=async(n,o)=>{const L=o(n.csrfToken),T=o(n.sessionToken),x=o(n.refreshToken),g=o(n.visitorId);W("login page onLogin",{result:n,decodeSessionToken:T,decodeRefreshToken:x,decodeVisitorId:g}),je(T),be(L),ve(x),n.visitorId&&Ne(g),await s.refresh(),await z(100),ce(j.current);const l={};t.get("saveConnect")?(l.connected_did=j.current.user.did,l.connected_pk=j.current.user.pk,l.connected_wallet_os=j.current.walletOS,l.connected_app=Te()):(l.connected_did=t.get("connected_did"),l.connected_pk=t.get("connected_pk"),l.connected_app=t.get("connected_app"),l.connected_wallet_os=t.get("connected_wallet_os")),Ie(l,!0),H({sessionToken:T,refreshToken:x,visitorId:g})},ae=ge(()=>C==="switch-did"?d&&typeof d=="string"?{title:i("login.switchSpecifiedDid.title"),scan:i("login.switchSpecifiedDid.scan",{did:d}),confirm:i("login.switchSpecifiedDid.confirm"),success:i("login.switchSpecifiedDid.success")}:{title:i("login.switchDid.title"),scan:i("login.switchDid.scan"),confirm:i("login.switchDid.confirm"),success:i("login.switchDid.success")}:{title:i("login.connect.title"),scan:i("login.connect.scan"),confirm:i("login.connect.confirm"),success:i("login.connect.success")},[d,C,i]),$=me(()=>{const n=window?.blocklet,o={className:"connect",popup:!1,action:"login",passkeyBehavior:"both",onSuccess:Q,onError:le,locale:y,messages:ae,extraParams:h,baseUrl:window.location.origin,prefix:A(window.location.origin,R,ke)};d&&(o.forceConnected=d,o.extraParams.enableSwitchApp=!1,o.extraParams.forceConnected=d),o.options||(o.options={}),C==="switch-did"?o.options.showQuickConnect=!0:_(q)||([!1,"false"].includes(q)?o.options.showQuickConnect=!1:o.options.showQuickConnect=!0);const L=Se();Ue()&&(o.extraParams.sourceAppPid=L.appPid);const x=A(window.location.origin,R,"connect"),g={params:Pe(encodeURIComponent(JSON.stringify(o))),appPid:n?.appPid,appName:n?.appName,locale:y,redirect:window.location.href,_ek_:m};_(N)||(g.autoConnectWebview=N),_(D)||(g.popup=D),g.disableClose=!0;const l=J(Ce(x,g),{allowDomains:null});window.location.href=l});he(()=>{if(t.get("sessionToken")){const n=t.get("visitorId");if(!n){O.error("Unexpected login response from server: visitorId is required");return}Q({sessionToken:v(oe),csrfToken:v(te),refreshToken:v(ie),visitorId:v(n)},o=>o)}else!s.user||d&&s.user.did!==d?$():!U&&!t.get("sessionToken")&&H()});const le=n=>{O.error(n.message)},de=t.has("popup");if(s.loading||s.user){if(!U||t.get("sessionToken"))return e.jsxs(e.Fragment,{children:[e.jsx(M,{children:e.jsx("title",{children:i("pageTitle.login")})}),e.jsx(Re,{children:de?null:e.jsx(fe,{})})]});const n=u?new URL(u,window.location.origin).href:window.location.href;return e.jsx(ee,{onConnect:$,passports:E,redirect:n})}return e.jsxs(e.Fragment,{children:[e.jsx(M,{children:e.jsx("title",{children:i("pageTitle.login")})}),e.jsx(p,{sx:{"box-sizing":"border-box",width:"100%",height:"100vh",position:"relative",display:"flex","flex-direction":"column",".connect":{background:"#fafafa"}},ref:c})]})}export{Je as default};
1
+ import{j as e,al as p,T as I,X as r,an as F,R as K,bf as pe,a7 as fe}from"./vendor-mui-core-CDEc-eG6.js";import{h as ue,a as ge,b as me,j as he}from"./vendor-hooks-Ca2cSNuD.js";import{r as X,u as we}from"./vendor-react-DX7tU9aY.js";import{u as xe,z as ye,s as ke,W as R,a as Pe,H as M,b as je,c as be,d as ve,e as z,R as Te,f as Ie}from"./index-CgSpL7jz.js";import{y as A,b as _,F as Ce,c as Le}from"./vendor-utils-_C9URqjS.js";import{o as Re}from"./vendor-arcblock-BVQTtbN-.js";import{a7 as _e,ac as We,aa as G,a0 as B,as as Ae,ai as Se,ah as Ue,a3 as O,ao as Ne,aA as V}from"./vendor-ux-PO0jFgJf.js";import{u as De}from"./use-passport-id-B-b-_oYF.js";import{g as J}from"./get-safe-url-uxJSMQTF.js";import{d as W}from"./logger-BtwZslJC.js";function Y({blocklet:c=window.blocklet}){return e.jsxs(p,{sx:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(_e,{variant:"rounded",shape:"square",did:c.appPid,src:c.appLogo,size:80}),e.jsx(I,{component:"h2",variant:"h6",children:c.appName}),e.jsx(We,{did:c.appPid})]})}const qe=X.memo(Y);Y.propTypes={blocklet:r.shape({appName:r.string,appLogo:r.string,appPid:r.string})};const Ee=()=>window.blocklet?.componentMountPoints?.find(s=>s.did==="z2qaCNvKMv5GjouKdcDWexv6WqtHbpNPQDnAk")?.mountPoint;function Z({children:c=null,cta:s=null,...i}){return e.jsxs(p,{...i,children:[c?e.jsx(p,{sx:{maxHeight:"50vh",overflow:"hidden",position:"relative",":after":{content:'""',position:"absolute",left:0,right:0,bottom:0,height:"80%",background:"linear-gradient(transparent, #fff 85%)"}},children:c}):null,s?e.jsx(p,{sx:{display:"flex",flexDirection:"column",alignItems:"center",py:4,borderRadius:2},children:s}):null]})}Z.propTypes={children:r.node,cta:r.node};function ee({passports:c=[],onConnect:s=()=>{},redirect:i,...y}){const{t:f}=G(),k=Ee(),P=a=>{const m=a?.payable;return k&&m?A(k,`/api/redirect/checkout/${m}?redirect=${i}`):null};return e.jsxs(p,{sx:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:2,minHeight:"100vh",maxWidth:"400px",margin:"auto",paddingBottom:{sx:0,md:15}},children:[e.jsx(qe,{}),e.jsx(Z,{...y,cta:e.jsxs(e.Fragment,{children:[e.jsx(I,{variant:"h4",sx:{mx:2,textAlign:"center",fontWeight:"bold",color:"warning.main"},children:f("login.accessLimit.title")}),e.jsx(I,{variant:"body1",sx:{maxWidth:620,mt:2,mx:2,textAlign:"center",color:"gray"},children:f("login.accessLimit.description")}),e.jsx(p,{sx:{display:"flex",flexWrap:"wrap",justifyContent:"center",gap:1,mt:5},children:c?.map(a=>{const m=P(a);return m?e.jsx(F,{title:f("login.accessLimit.buyPassport"),arrow:!0,placement:"top",children:e.jsx(K,{color:"primary",variant:"contained",endIcon:e.jsx(pe,{}),href:m,target:"_blank",children:a.title||a.name})},a.name):e.jsx(F,{title:f("login.connectWithPassport"),arrow:!0,placement:"top",children:e.jsx(K,{color:"inherit",variant:"contained",onClick:s,children:a.title||a.name})},a.name)})}),e.jsxs(I,{variant:"body1",sx:{mt:2,color:"grey.400"},children:[e.jsx(p,{component:"span",sx:{display:"inline-block",mr:1},children:f("login.accessLimit.alreadyHavePassport")}),e.jsx(p,{component:"span",sx:{textDecoration:"underline",cursor:"pointer",color:"primary.main"},onClick:s,children:f("common.connect")})]})]})})]})}ee.propTypes={passports:r.arrayOf(r.shape({name:r.string.isRequired,title:r.string,payable:r.string})),onConnect:r.func,onClose:r.func,redirect:r.string.isRequired};function Je(){const c=X.useRef(null),{session:s}=xe(),{t:i,locale:y}=G(),{getPassportId:f}=De(),k=we(),P=B(),a=Ae(),{encryptKey:m,decrypt:ne}=ye(),j=ue(s),{searchParams:t}=new URL(window.location.href),h={passportId:f()},S=t.get("componentId"),U=t.get("authenticated"),oe=t.get("sessionToken"),te=t.get("csrfToken"),ie=t.get("refreshToken"),se=t.get("requiredRoles"),u=t.get("redirect"),d=t.get("forceConnected"),b=t.get("sourceAppPid"),C=t.get("origin"),N=t.get("autoConnectWebview"),D=t.get("popup"),q=t.get("showQuickConnect");let w=t.get("inviter");if(!w&&u)try{w=(u.startsWith("http")?new URL(u):new URL(u,window.location.origin)).searchParams.get("inviter")}catch{}w=w||localStorage.getItem("inviter"),S&&(h.componentId=S),P&&(h.visitorId=P),w&&(h.inviter=w),Le(b)||(b==="null"?h.sourceAppPid=null:b!==null&&(h.sourceAppPid=b));let E=[];try{E=JSON.parse(se)}catch{}const re=async n=>{const o=t.get("fromWallet");W("login page notifyWallet",{data:n,fromWallet:o,"browser.wallet":a.wallet}),n&&String(o)==="1"&&a.wallet&&await Promise.any([V.asyncCall("arcSetToken",n),z(3e3)])},v=n=>n&&(t.get("encrypted")?ne(n):n),H=async n=>{n&&await re(n),setTimeout(()=>{if(u){const o=decodeURIComponent(u);o.startsWith(R)?k(o,{replace:!0}):window.location.replace(J(o))}else window.location.replace(window.env.pathPrefix||"/")},50)},ce=n=>{const o={did:n.user.did,host:window.location.host,appPid:window.blocklet.appPid,visitorId:B(),sourceAppPid:n.user.sourceAppPid,fullName:n.user.fullName};W("bridge callArc: onLogin",o),V.callArc("onLogin",o)},Q=async(n,o)=>{const L=o(n.csrfToken),T=o(n.sessionToken),x=o(n.refreshToken),g=o(n.visitorId);W("login page onLogin",{result:n,decodeSessionToken:T,decodeRefreshToken:x,decodeVisitorId:g}),je(T),be(L),ve(x),n.visitorId&&Ne(g),await s.refresh(),await z(100),ce(j.current);const l={};t.get("saveConnect")?(l.connected_did=j.current.user.did,l.connected_pk=j.current.user.pk,l.connected_wallet_os=j.current.walletOS,l.connected_app=Te()):(l.connected_did=t.get("connected_did"),l.connected_pk=t.get("connected_pk"),l.connected_app=t.get("connected_app"),l.connected_wallet_os=t.get("connected_wallet_os")),Ie(l,!0),H({sessionToken:T,refreshToken:x,visitorId:g})},ae=ge(()=>C==="switch-did"?d&&typeof d=="string"?{title:i("login.switchSpecifiedDid.title"),scan:i("login.switchSpecifiedDid.scan",{did:d}),confirm:i("login.switchSpecifiedDid.confirm"),success:i("login.switchSpecifiedDid.success")}:{title:i("login.switchDid.title"),scan:i("login.switchDid.scan"),confirm:i("login.switchDid.confirm"),success:i("login.switchDid.success")}:{title:i("login.connect.title"),scan:i("login.connect.scan"),confirm:i("login.connect.confirm"),success:i("login.connect.success")},[d,C,i]),$=me(()=>{const n=window?.blocklet,o={className:"connect",popup:!1,action:"login",passkeyBehavior:"both",onSuccess:Q,onError:le,locale:y,messages:ae,extraParams:h,baseUrl:window.location.origin,prefix:A(window.location.origin,R,ke)};d&&(o.forceConnected=d,o.extraParams.enableSwitchApp=!1,o.extraParams.forceConnected=d),o.options||(o.options={}),C==="switch-did"?o.options.showQuickConnect=!0:_(q)||([!1,"false"].includes(q)?o.options.showQuickConnect=!1:o.options.showQuickConnect=!0);const L=Se();Ue()&&(o.extraParams.sourceAppPid=L.appPid);const x=A(window.location.origin,R,"connect"),g={params:Pe(encodeURIComponent(JSON.stringify(o))),appPid:n?.appPid,appName:n?.appName,locale:y,redirect:window.location.href,_ek_:m};_(N)||(g.autoConnectWebview=N),_(D)||(g.popup=D),g.disableClose=!0;const l=J(Ce(x,g),{allowDomains:null});window.location.href=l});he(()=>{if(t.get("sessionToken")){const n=t.get("visitorId");if(!n){O.error("Unexpected login response from server: visitorId is required");return}Q({sessionToken:v(oe),csrfToken:v(te),refreshToken:v(ie),visitorId:v(n)},o=>o)}else!s.user||d&&s.user.did!==d?$():!U&&!t.get("sessionToken")&&H()});const le=n=>{O.error(n.message)},de=t.has("popup");if(s.loading||s.user){if(!U||t.get("sessionToken"))return e.jsxs(e.Fragment,{children:[e.jsx(M,{children:e.jsx("title",{children:i("pageTitle.login")})}),e.jsx(Re,{children:de?null:e.jsx(fe,{})})]});const n=u?new URL(u,window.location.origin).href:window.location.href;return e.jsx(ee,{onConnect:$,passports:E,redirect:n})}return e.jsxs(e.Fragment,{children:[e.jsx(M,{children:e.jsx("title",{children:i("pageTitle.login")})}),e.jsx(p,{sx:{"box-sizing":"border-box",width:"100%",height:"100vh",position:"relative",display:"flex","flex-direction":"column",".connect":{background:"#fafafa"}},ref:c})]})}export{Je as default};
@@ -1 +1 @@
1
- import{j as e,aS as d,al as r,T as m,b4 as p,R as u}from"./vendor-mui-core-CDEc-eG6.js";import{i as x,p as f,j as h}from"./vendor-hooks-Ca2cSNuD.js";import{j as c}from"./vendor-react-DX7tU9aY.js";import{W as j,g as y,h as w}from"./index-DcM4ljaV.js";import{k as C}from"./fallback-DAsXuNMP.js";import{aa as v}from"./vendor-ux-PO0jFgJf.js";import{y as M}from"./vendor-utils-_C9URqjS.js";import"./vendor-arcblock-BVQTtbN-.js";const k="authorization_response",A=w();function L(){const{t}=v(),[o]=c(),a=()=>{window.close()};return h(()=>{const i=o.get("state"),l=o.get("code"),s={type:k,response:{code:l}};if(window.opener)try{const n=new URL(i);window.opener.postMessage(s,n.origin),setTimeout(()=>{window.close()},2e3)}catch(n){console.error("Invalid login caller",n)}}),e.jsx(p,{severity:"success",children:e.jsxs(r,{sx:{display:"flex",flexDirection:"column",justifyContent:"center",alignContent:"center",gap:1},children:[t("login.needManualClose"),e.jsx(r,{sx:{textAlign:"center"},children:e.jsx(u,{variant:"outlined",size:"small",onClick:a,children:t("login.closeWindow")})})]})})}function _(){const{blocklet:t}=window,[o]=c(),a=o.get("error"),i=o.get("error_description"),l=o.get("state"),s=x({errorMessage:"",loading:!0});f(async()=>{if(a)s.errorMessage=i,s.loading=!1;else try{const g=new URL(l);(await A.federated.getTrustedDomains()).includes(g.hostname)||(s.errorMessage="Invalid login caller",s.loading=!1)}catch{s.errorMessage="Invalid login caller",s.loading=!1}},[a,i,l]);const n=M(j,`/blocklet/logo?&version=${t?.meta?.version||""}`);return e.jsx(d,{sx:{display:"flex",flexDirection:"column",minHeight:"100vh",justifyContent:"center",alignContent:"center"},children:e.jsxs(r,{sx:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:2,minHeight:"100vh",margin:"auto",paddingBottom:{sx:0,md:15}},children:[e.jsxs(r,{sx:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:.5},children:[e.jsx(r,{component:"img",src:n,alt:`${t?.appName||"site"} logo`,sx:{width:80}}),e.jsx(m,{variant:"h6",component:"p",children:t?.appName})]}),s.loading?s.errorMessage?e.jsx(C,{error:{message:s.errorMessage}}):e.jsx(L,{}):null,e.jsx(y,{sx:{mt:4}})]})})}export{_ as default};
1
+ import{j as e,aS as d,al as r,T as m,b4 as p,R as u}from"./vendor-mui-core-CDEc-eG6.js";import{i as x,p as f,j as h}from"./vendor-hooks-Ca2cSNuD.js";import{j as c}from"./vendor-react-DX7tU9aY.js";import{W as j,g as y,h as w}from"./index-CgSpL7jz.js";import{k as C}from"./fallback-DAsXuNMP.js";import{aa as v}from"./vendor-ux-PO0jFgJf.js";import{y as M}from"./vendor-utils-_C9URqjS.js";import"./vendor-arcblock-BVQTtbN-.js";const k="authorization_response",A=w();function L(){const{t}=v(),[o]=c(),a=()=>{window.close()};return h(()=>{const i=o.get("state"),l=o.get("code"),s={type:k,response:{code:l}};if(window.opener)try{const n=new URL(i);window.opener.postMessage(s,n.origin),setTimeout(()=>{window.close()},2e3)}catch(n){console.error("Invalid login caller",n)}}),e.jsx(p,{severity:"success",children:e.jsxs(r,{sx:{display:"flex",flexDirection:"column",justifyContent:"center",alignContent:"center",gap:1},children:[t("login.needManualClose"),e.jsx(r,{sx:{textAlign:"center"},children:e.jsx(u,{variant:"outlined",size:"small",onClick:a,children:t("login.closeWindow")})})]})})}function _(){const{blocklet:t}=window,[o]=c(),a=o.get("error"),i=o.get("error_description"),l=o.get("state"),s=x({errorMessage:"",loading:!0});f(async()=>{if(a)s.errorMessage=i,s.loading=!1;else try{const g=new URL(l);(await A.federated.getTrustedDomains()).includes(g.hostname)||(s.errorMessage="Invalid login caller",s.loading=!1)}catch{s.errorMessage="Invalid login caller",s.loading=!1}},[a,i,l]);const n=M(j,`/blocklet/logo?&version=${t?.meta?.version||""}`);return e.jsx(d,{sx:{display:"flex",flexDirection:"column",minHeight:"100vh",justifyContent:"center",alignContent:"center"},children:e.jsxs(r,{sx:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:2,minHeight:"100vh",margin:"auto",paddingBottom:{sx:0,md:15}},children:[e.jsxs(r,{sx:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:.5},children:[e.jsx(r,{component:"img",src:n,alt:`${t?.appName||"site"} logo`,sx:{width:80}}),e.jsx(m,{variant:"h6",component:"p",children:t?.appName})]}),s.loading?s.errorMessage?e.jsx(C,{error:{message:s.errorMessage}}):e.jsx(L,{}):null,e.jsx(y,{sx:{mt:4}})]})})}export{_ as default};
@@ -1,5 +1,5 @@
1
1
  const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=[window.__toCdnUrl("assets/vendor-ux-DYcPPYq2.css"),window.__toCdnUrl("assets/index-DrCTi6nm.css"),window.__toCdnUrl("assets/index-_3Fxot8G.css")])))=>i.map(i=>d[i]);
2
- import{aa as O,cd as _,J as q}from"./vendor-ux-PO0jFgJf.js";import{r as m}from"./vendor-react-DX7tU9aY.js";import{j as o,al as u,aT as z,X as e}from"./vendor-mui-core-CDEc-eG6.js";import{n as d,y as F}from"./vendor-utils-_C9URqjS.js";const U=m.lazy(()=>q(()=>import("./index-6ovPLp0y.js"),__vite__mapDeps([0,1,2]),import.meta.url).then(t=>({default:t.Uploader}))),k="/blocklet/logo/upload",c=[".png",".jpg",".jpeg",".webp",".bmp",".ico"];function C({url:t,height:f=80,width:g="auto",enabled:s=!0,allowSVG:h=!0,type:r,did:a,prefix:b,headers:x=d,aspectRatio:l=1,minWidth:P=256,minHeight:R=256,onUploaded:j=d,children:n=null}){const{t:v,locale:w}=O(),i=m.useRef(null),p=()=>{i.current?.open()},y=()=>{j(),i.current?.close()},E={cursor:s?"pointer":"default","&::after":{content:`"${v("common.switch")}"`}};return o.jsxs(S,{id:`uploader-${a}-${r}`,children:[o.jsx(U,{ref:i,locale:w,popup:!0,onUploadFinish:y,plugins:["ImageEditor"],installerProps:{disabled:!0},apiPathProps:{uploader:F(b,k,r,a),disableMediaKitPrefix:!0,disableMediaKitStatus:!0},coreProps:{restrictions:{allowedFileExts:h?[...c,".svg"]:c,maxFileSize:1024*1024*5,maxNumberOfFiles:1}},dashboardProps:{autoOpen:"imageEditor"},imageEditorProps:{actions:{revert:!0,rotate:!0,granularRotate:!0,flip:!0,zoomIn:!0,zoomOut:!0,cropSquare:!1,cropWidescreen:!1,cropWidescreenVertical:!1},cropperOptions:{autoCrop:!0,autoCropArea:1,aspectRatio:l,initialAspectRatio:l,croppedCanvasOptions:{minWidth:P,minHeight:R}}},tusProps:{headers:x}}),n?o.jsx(u,{onClick:p,children:n}):o.jsx(u,{className:_("uploader-wrapper",s&&"enabled"),sx:E,onClick:p,children:o.jsx("img",{alt:r,src:t,style:{width:g,height:f}})})]},`uploader-${a}-${r}`)}C.propTypes={url:e.string.isRequired,type:e.oneOf(["square","rect","favicon","splash-portrait","splash-landscape","og-image"]).isRequired,did:e.string.isRequired,prefix:e.string.isRequired,headers:e.func,onUploaded:e.func,height:e.number,width:e.any,enabled:e.bool,allowSVG:e.bool,aspectRatio:e.number,minWidth:e.number,minHeight:e.number,children:e.node};const S=z.div`
2
+ import{aa as O,cd as _,J as q}from"./vendor-ux-PO0jFgJf.js";import{r as m}from"./vendor-react-DX7tU9aY.js";import{j as o,al as u,aT as z,X as e}from"./vendor-mui-core-CDEc-eG6.js";import{n as d,y as F}from"./vendor-utils-_C9URqjS.js";const U=m.lazy(()=>q(()=>import("./index-D0mTUcjJ.js"),__vite__mapDeps([0,1,2]),import.meta.url).then(t=>({default:t.Uploader}))),k="/blocklet/logo/upload",c=[".png",".jpg",".jpeg",".webp",".bmp",".ico"];function C({url:t,height:f=80,width:g="auto",enabled:s=!0,allowSVG:h=!0,type:r,did:a,prefix:b,headers:x=d,aspectRatio:l=1,minWidth:P=256,minHeight:R=256,onUploaded:j=d,children:n=null}){const{t:v,locale:w}=O(),i=m.useRef(null),p=()=>{i.current?.open()},y=()=>{j(),i.current?.close()},E={cursor:s?"pointer":"default","&::after":{content:`"${v("common.switch")}"`}};return o.jsxs(S,{id:`uploader-${a}-${r}`,children:[o.jsx(U,{ref:i,locale:w,popup:!0,onUploadFinish:y,plugins:["ImageEditor"],installerProps:{disabled:!0},apiPathProps:{uploader:F(b,k,r,a),disableMediaKitPrefix:!0,disableMediaKitStatus:!0},coreProps:{restrictions:{allowedFileExts:h?[...c,".svg"]:c,maxFileSize:1024*1024*5,maxNumberOfFiles:1}},dashboardProps:{autoOpen:"imageEditor"},imageEditorProps:{actions:{revert:!0,rotate:!0,granularRotate:!0,flip:!0,zoomIn:!0,zoomOut:!0,cropSquare:!1,cropWidescreen:!1,cropWidescreenVertical:!1},cropperOptions:{autoCrop:!0,autoCropArea:1,aspectRatio:l,initialAspectRatio:l,croppedCanvasOptions:{minWidth:P,minHeight:R}}},tusProps:{headers:x}}),n?o.jsx(u,{onClick:p,children:n}):o.jsx(u,{className:_("uploader-wrapper",s&&"enabled"),sx:E,onClick:p,children:o.jsx("img",{alt:r,src:t,style:{width:g,height:f}})})]},`uploader-${a}-${r}`)}C.propTypes={url:e.string.isRequired,type:e.oneOf(["square","rect","favicon","splash-portrait","splash-landscape","og-image"]).isRequired,did:e.string.isRequired,prefix:e.string.isRequired,headers:e.func,onUploaded:e.func,height:e.number,width:e.any,enabled:e.bool,allowSVG:e.bool,aspectRatio:e.number,minWidth:e.number,minHeight:e.number,children:e.node};const S=z.div`
3
3
  .uploader-wrapper {
4
4
  display: inline-flex;
5
5
  position: relative;
@@ -1,4 +1,4 @@
1
- import{j as e,aT as $,X as v,L as _,al as r,aY as U,bg as X,T as N,bh as z,bi as F,bj as H,bb as B,aS as V,bk as G,bl as J,bm as O}from"./vendor-mui-core-CDEc-eG6.js";import{bj as Q,as as Y,bk as I,J as q,bi as K,aa as Z}from"./vendor-ux-PO0jFgJf.js";import{r as m}from"./vendor-react-DX7tU9aY.js";import{i as ee,A as te}from"./vendor-hooks-Ca2cSNuD.js";import{w as D,l as L,H as se,k as oe,b as ae,d as ne,c as re}from"./index-DcM4ljaV.js";import{M as ie}from"./vendor-utils-_C9URqjS.js";import{N as ce}from"./index-BvUXcJcd.js";import{W as le}from"./did-address-BNKX5oDP.js";import{w as pe}from"./wrap-locale-Ck3xud_e.js";import{u as de}from"./use-passport-id-B-b-_oYF.js";import{g as me}from"./get-safe-url-C1Ml6qBb.js";import{c as ue}from"./passport-bxIQRuHM.js";import"./vendor-arcblock-BVQTtbN-.js";import"./purify.es-HRjpPm7y.js";import"./index-BjD8juw_.js";import"./create-passport-svg-DNOT-xbE.js";function M({list:s=[],width:l=300,height:u=400,cardSpace:p=40,onSelect:i=()=>{},defaultIndex:f=0}){const[x,g]=m.useState(0),[o,d]=m.useState(0),w=m.useRef(null),b=n=>{if(n<0||n>s.length-1)return;g(n);const c=w.current.clientWidth;d(n*(l+p)-(c-l)/2+p*.5),i(n)};m.useEffect(()=>{b(f);const n=c=>c.preventDefault();w.current.addEventListener("touchmove",n,{passive:!1})},[]);let a;const k=n=>{a=n.touches[0].clientX},y=n=>{const c=n.changedTouches[0],j=a-c.clientX;Math.abs(j)>60&&(j>0?b(x+1):b(x-1))};return e.jsx(he,{ref:w,onTouchStart:k,onTouchEnd:y,children:e.jsx("div",{className:"card-container",style:{transform:`translate(${-o}px, 0)`},children:s.map((n,c)=>e.jsx("div",{className:`card-item ${c===x?"selected":""}`,style:{width:l,height:u,margin:p/2},onClick:()=>b(c),children:n.display?e.jsx("div",{className:"card-content",children:e.jsx(ce,{data:n.display,style:{width:"100%",height:"100%"}})}):e.jsx("div",{className:"card-content",dangerouslySetInnerHTML:{__html:n.src}})},n.id))})})}const he=$.div`
1
+ import{j as e,aT as $,X as v,L as _,al as r,aY as U,bg as X,T as N,bh as z,bi as F,bj as H,bb as B,aS as V,bk as G,bl as J,bm as O}from"./vendor-mui-core-CDEc-eG6.js";import{bj as Q,as as Y,bk as I,J as q,bi as K,aa as Z}from"./vendor-ux-PO0jFgJf.js";import{r as m}from"./vendor-react-DX7tU9aY.js";import{i as ee,A as te}from"./vendor-hooks-Ca2cSNuD.js";import{w as D,l as L,H as se,k as oe,b as ae,d as ne,c as re}from"./index-CgSpL7jz.js";import{M as ie}from"./vendor-utils-_C9URqjS.js";import{N as ce}from"./index-BvUXcJcd.js";import{W as le}from"./did-address-BNKX5oDP.js";import{w as pe}from"./wrap-locale-AxlzuLIu.js";import{u as de}from"./use-passport-id-B-b-_oYF.js";import{g as me}from"./get-safe-url-uxJSMQTF.js";import{c as ue}from"./passport-2AVRJTQK.js";import"./vendor-arcblock-BVQTtbN-.js";import"./purify.es-HRjpPm7y.js";import"./index-C2_MQP4T.js";import"./create-passport-svg-DNOT-xbE.js";function M({list:s=[],width:l=300,height:u=400,cardSpace:p=40,onSelect:i=()=>{},defaultIndex:f=0}){const[x,g]=m.useState(0),[o,d]=m.useState(0),w=m.useRef(null),b=n=>{if(n<0||n>s.length-1)return;g(n);const c=w.current.clientWidth;d(n*(l+p)-(c-l)/2+p*.5),i(n)};m.useEffect(()=>{b(f);const n=c=>c.preventDefault();w.current.addEventListener("touchmove",n,{passive:!1})},[]);let a;const k=n=>{a=n.touches[0].clientX},y=n=>{const c=n.changedTouches[0],j=a-c.clientX;Math.abs(j)>60&&(j>0?b(x+1):b(x-1))};return e.jsx(he,{ref:w,onTouchStart:k,onTouchEnd:y,children:e.jsx("div",{className:"card-container",style:{transform:`translate(${-o}px, 0)`},children:s.map((n,c)=>e.jsx("div",{className:`card-item ${c===x?"selected":""}`,style:{width:l,height:u,margin:p/2},onClick:()=>b(c),children:n.display?e.jsx("div",{className:"card-content",children:e.jsx(ce,{data:n.display,style:{width:"100%",height:"100%"}})}):e.jsx("div",{className:"card-content",dangerouslySetInnerHTML:{__html:n.src}})},n.id))})})}const he=$.div`
2
2
  overflow: hidden;
3
3
  mask-image: linear-gradient(to left, transparent, black 3%, black 97%, transparent);
4
4
  overflow: hidden;