@abtnode/blocklet-services 1.16.39-beta-20250208-101442-7280c143 → 1.16.39-beta-20250209-091732-ccef0248

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 (115) hide show
  1. package/api/libs/connect/session.js +2 -0
  2. package/dist/assets/{Add-_iRymiOl.js → Add-DSPtuudj.js} +1 -1
  3. package/dist/assets/{ArrowDropDown-DyEwa2F9.js → ArrowDropDown-DM9y1OaN.js} +1 -1
  4. package/dist/assets/{CheckCircle-Tp5VOipm.js → CheckCircle-BxzRfCun.js} +1 -1
  5. package/dist/assets/{ChevronLeft-D2Ho6WQh.js → ChevronLeft-CmbkC1dP.js} +1 -1
  6. package/dist/assets/{ChevronRight-gE0lOnIo.js → ChevronRight-DlIj8Fj2.js} +1 -1
  7. package/dist/assets/{DeleteOutline-C6VkRbFK.js → DeleteOutline-BzV7E1BM.js} +1 -1
  8. package/dist/assets/{Done-DVvDyJtD.js → Done-DJfjmlFC.js} +1 -1
  9. package/dist/assets/{Download-B1t0EslI.js → Download-B4M4wwJm.js} +1 -1
  10. package/dist/assets/{Error-DEnZKIyw.js → Error-CN75ZRlV.js} +1 -1
  11. package/dist/assets/{Google-C5Apqxhw.js → Google-DTKsjoGP.js} +1 -1
  12. package/dist/assets/{InfoOutlined-C5fMx7-l.js → InfoOutlined-C_J3Y0fX.js} +1 -1
  13. package/dist/assets/{Launch-vt_CNjmC.js → Launch-BX35m3eH.js} +1 -1
  14. package/dist/assets/{LaunchOutlined-DxGn2DKz.js → LaunchOutlined-DaJw5LME.js} +1 -1
  15. package/dist/assets/{Loop-OLIg6dh7.js → Loop-B05tzyuy.js} +1 -1
  16. package/dist/assets/{MoreHoriz-BkVO_QXB.js → MoreHoriz-JX8PbVXG.js} +1 -1
  17. package/dist/assets/{PlayArrow-CyaFn-Ol.js → PlayArrow-DZfknrYj.js} +1 -1
  18. package/dist/assets/{ViewList-PZwK-0pV.js → ViewList-CgG45KQv.js} +1 -1
  19. package/dist/assets/{access-control-C_I9vnpS.js → access-control-DdXj5niw.js} +1 -1
  20. package/dist/assets/{actions-CS0A6ZvH.js → actions-CPjP-DJ-.js} +1 -1
  21. package/dist/assets/{add-component-core-CDWBeeS1.js → add-component-core-BtRcqhKo.js} +1 -1
  22. package/dist/assets/{add-resource-E7327Bws.js → add-resource-nU5RWMls.js} +1 -1
  23. package/dist/assets/{addon-bMI-7aOZ.js → addon-B4K2H5lA.js} +1 -1
  24. package/dist/assets/{analytics-D32wGcj3.js → analytics-X9VRwkzm.js} +1 -1
  25. package/dist/assets/audit-logs-BJdGmYfI.js +18 -0
  26. package/dist/assets/{base32-Bb5-8D4h.js → base32-BAfsRZF6.js} +1 -1
  27. package/dist/assets/{branding-DR_L569O.js → branding-DzXJA2pJ.js} +2 -2
  28. package/dist/assets/{bundle-avatar-BcIG01qq.js → bundle-avatar-CYdInmjR.js} +1 -1
  29. package/dist/assets/button-BZmMffY2.js +1 -0
  30. package/dist/assets/{click-to-copy-BixfYLPy.js → click-to-copy-Bu9H6mvL.js} +1 -1
  31. package/dist/assets/{complete-ZFv3syW1.js → complete-DtNcnxdf.js} +4 -4
  32. package/dist/assets/{component-Cq51erjd.js → component-DOOz4rgK.js} +1 -1
  33. package/dist/assets/{config-BQiB23JZ.js → config-CSlXpbL2.js} +1 -1
  34. package/dist/assets/{config-D-gLxJK_.js → config-DjozEU7w.js} +1 -1
  35. package/dist/assets/{config-navigation-JwYI5c3u.js → config-navigation-B5FcBZZN.js} +3 -3
  36. package/dist/assets/{config-space-Q6HENzum.js → config-space-Y_f6nwhj.js} +1 -1
  37. package/dist/assets/{confirm-CPtiZE0r.js → confirm-CpCj_oj-.js} +1 -1
  38. package/dist/assets/{connect-HQAAv30Q.js → connect-BprUwdvy.js} +1 -1
  39. package/dist/assets/connect-ByH0XoiE.js +1 -0
  40. package/dist/assets/{connect-to-Bt8_yfyU.js → connect-to-BYvNqC5N.js} +1 -1
  41. package/dist/assets/{dashboard-BxMHOYyh.js → dashboard-Cgj1BkGn.js} +10 -10
  42. package/dist/assets/{did-address-Bpb9HTRt.js → did-address-D0Fo5eTl.js} +1 -1
  43. package/dist/assets/{domain-BaqHASeF.js → domain-BD1Bntmg.js} +2 -2
  44. package/dist/assets/{domain-list-DxhvsNeW.js → domain-list-h_f8stui.js} +2 -2
  45. package/dist/assets/{email-CI0YNxDH.js → email-BaNlnEr5.js} +2 -2
  46. package/dist/assets/{exchange-passport--ITba_8X.js → exchange-passport-CjaHJzsV.js} +1 -1
  47. package/dist/assets/{form-text-input-C3pP_SCY.js → form-text-input-DS_PVT1r.js} +2 -2
  48. package/dist/assets/{fuel-BzjjfKxQ.js → fuel-BM8_TX9D.js} +1 -1
  49. package/dist/assets/{fullpage-Bxt7Lsx9.js → fullpage-DT2JXUAZ.js} +1 -1
  50. package/dist/assets/{get-safe-url-ClvIGbO9.js → get-safe-url-DDeO6YpV.js} +1 -1
  51. package/dist/assets/{get-safe-url-DBA3YcFh.js → get-safe-url-Du4BhDgB.js} +1 -1
  52. package/dist/assets/{home-h-b1y9y8.js → home-DqIS-M10.js} +1 -1
  53. package/dist/assets/{iframe-DuaKUdqD.js → iframe-CU0LfRyS.js} +1 -1
  54. package/dist/assets/{index-gRh_ocU8.js → index-0u5pzPhR.js} +1 -1
  55. package/dist/assets/{index-BFDq4CA-.js → index-BA_7CRkd.js} +1 -1
  56. package/dist/assets/{index-CT2kaEsJ.js → index-BFxdORkH.js} +1 -1
  57. package/dist/assets/{index-BzmHWq6G.js → index-BMWG7Eya.js} +1 -1
  58. package/dist/assets/{index-B8ZVPR0B.js → index-C7dWd4bS.js} +4 -4
  59. package/dist/assets/{index-DswiSRuh.js → index-Cqc33Ts_.js} +3 -3
  60. package/dist/assets/{index-C3EMCJb1.js → index-D6IQwB0H.js} +1 -1
  61. package/dist/assets/{index-BvvY74m1.js → index-DF1jJ-bb.js} +3 -3
  62. package/dist/assets/{index-Fyc9Yh32.js → index-DGzAI_hi.js} +1 -1
  63. package/dist/assets/{index-C8EWVV7E.js → index-DRwuz-J9.js} +1 -1
  64. package/dist/assets/{index-DfOPIsLs.js → index-DzU25sJ1.js} +1 -1
  65. package/dist/assets/{index-Cp0o05oj.js → index-Dzj545ro.js} +1 -1
  66. package/dist/assets/{index-1soveoNH.js → index-LIf2LIyz.js} +3 -3
  67. package/dist/assets/{index-D6xvEfk8.js → index-PcImULKW.js} +1 -1
  68. package/dist/assets/{index-DH7yV8cM.js → index-ee8g6Cmz.js} +1 -1
  69. package/dist/assets/{invitation-B1_YvDcH.js → invitation-DSIQ2w-K.js} +3 -3
  70. package/dist/assets/{invite-DJGa7dsX.js → invite-C4uHXoFz.js} +1 -1
  71. package/dist/assets/{issue-passport-Cy103t5H.js → issue-passport-Dq9lOjJK.js} +1 -1
  72. package/dist/assets/{item-DC2b5v0Z.js → item-Ba7fzXuK.js} +1 -1
  73. package/dist/assets/{layout-D9K6IZdV.js → layout-BwWrVSXk.js} +1 -1
  74. package/dist/assets/{list-D3k0O0Xi.js → list-DI-9r9EP.js} +1 -1
  75. package/dist/assets/{list-header-CegSwHre.js → list-header-BdJ1JRqY.js} +1 -1
  76. package/dist/assets/{localization-wwWSGBBO.js → localization-Dqw_hZdb.js} +1 -1
  77. package/dist/assets/{log-B5shqSVV.js → log-D4hWjoeK.js} +1 -1
  78. package/dist/assets/login-DnwZJEBm.js +1 -0
  79. package/dist/assets/{login-oauth-callback-s99_h6fH.js → login-oauth-callback-Dua5YLNm.js} +1 -1
  80. package/dist/assets/{logo-uploader-BeSpYnSl.js → logo-uploader-DbSGPbXh.js} +3 -3
  81. package/dist/assets/{lost-passport-DlMMmOpM.js → lost-passport-Cqpxv9tR.js} +3 -3
  82. package/dist/assets/{open-window-Zq1x7xKe.js → open-window-BCSIX9-I.js} +1 -1
  83. package/dist/assets/{overview-BOIsSliU.js → overview-DMjokddi.js} +1 -1
  84. package/dist/assets/{page-header-DqhVsAOw.js → page-header-xWImGBdx.js} +1 -1
  85. package/dist/assets/{permission-C4wOllow.js → permission-C0p6f4_S.js} +1 -1
  86. package/dist/assets/{preferences-M821Nbub.js → preferences-C1-L0Kuo.js} +1 -1
  87. package/dist/assets/publish-resource-BeEqCNhj.js +1 -0
  88. package/dist/assets/{react-beautiful-dnd.esm-CWDllqTB.js → react-beautiful-dnd.esm-DwxjmShi.js} +1 -1
  89. package/dist/assets/{relative-time-cOKPNX1U.js → relative-time-DpRjdL5Z.js} +1 -1
  90. package/dist/assets/sdk-TBkp9MgA.js +1 -0
  91. package/dist/assets/session-CM1ewS-k.js +1 -0
  92. package/dist/assets/{setup-Cm--NvZ1.js → setup-hqq9REGL.js} +3 -3
  93. package/dist/assets/{start-C_nc1AIm.js → start-C1K4M5DN.js} +1 -1
  94. package/dist/assets/{step-actions-DLkXmgm2.js → step-actions-BJ9p7QSx.js} +1 -1
  95. package/dist/assets/{studio-BBxcN5pm.js → studio-DtUwD8m6.js} +1 -1
  96. package/dist/assets/{switch-control-CyqD0Juh.js → switch-control-D2qynQm8.js} +1 -1
  97. package/dist/assets/{traffic-CS576wme.js → traffic-DelPjTGb.js} +3 -3
  98. package/dist/assets/{transfer-DC-nnm4b.js → transfer-Dqy9gGzf.js} +1 -1
  99. package/dist/assets/{unsubscribe-DDgZq9Y7.js → unsubscribe-Bq-uODgj.js} +1 -1
  100. package/dist/assets/{useLocalStorage-CVBgwJgU.js → useLocalStorage-DV4AIe5L.js} +1 -1
  101. package/dist/assets/{user-center-BxglHi8W.js → user-center-D0eTpKkD.js} +1 -1
  102. package/dist/assets/{util-DMMg7Sbk.js → util-BpKZM3xV.js} +1 -1
  103. package/dist/assets/{util-5SXnNpj9.js → util-NSOsPZWM.js} +1 -1
  104. package/dist/assets/{vendor-arcblock-oqH5gsLR.js → vendor-arcblock-DZrZ_x_3.js} +154 -154
  105. package/dist/assets/{wrap-locale-D4yZwBtm.js → wrap-locale-oTlFUOZf.js} +1 -1
  106. package/dist/index.html +2 -2
  107. package/dist/service-worker.js +1 -1
  108. package/package.json +29 -29
  109. package/dist/assets/audit-logs-Ct6NbUiV.js +0 -18
  110. package/dist/assets/button-C4NPz_vA.js +0 -1
  111. package/dist/assets/connect-BkKF9mgk.js +0 -1
  112. package/dist/assets/login-3tpx-b2O.js +0 -1
  113. package/dist/assets/publish-resource-B-y64yfT.js +0 -1
  114. package/dist/assets/sdk-Dwpx68pe.js +0 -1
  115. package/dist/assets/session-B07p7iif.js +0 -1
@@ -1,4 +1,4 @@
1
- import{_ as ae,aF as $e,z as mt,f as Me,L as pt,e as E,a5 as ft,j as O,aY as ht,aZ as Be,a_ as xt,C as Pe,Y as gt,a1 as V,a8 as Ue,aU as Dt,at as yt}from"./vendor-arcblock-oqH5gsLR.js";import{a1 as le,j as e,bX as ze,a3 as p,a2 as U,T as F,ad as ce,e as Z,t as de,aj as Ne,E as s,a4 as B,M as jt,al as Oe,bm as vt,bn as bt,am as wt,ao as Ct,aa as St,I as Rt}from"./vendor-mui-core-xF5F4eT7.js";import{x as Y,w as At,y as It,H as ue,C as Pt,n as Ee,b as Et}from"./vendor-utils-5TjOM6td.js";import{r as A,g as Tt}from"./vendor-react-D-afvo_7.js";import{d as kt}from"./Add-_iRymiOl.js";import{b as Lt}from"./base32-Bb5-8D4h.js";import{ah as _t,ai as We,y as q,B as He,h as Te,aj as Ve,T as Ft,ak as qt,ag as Ye,b as $t,H as ke,al as Mt,M as Bt,J as Ut,am as zt,an as Nt,f as Le}from"./index-1soveoNH.js";import{d as Ot}from"./LockIcon-D-W4Rph6.js";import{s as Wt,n as Ht,u as H,o as Vt,w as Yt}from"./vendor-hooks-BKxTDk_P.js";import{d as Zt}from"./CheckCircle-Tp5VOipm.js";import{d as Gt,p as _e}from"./util-DMMg7Sbk.js";import{_ as G}from"./useSetState-Crt4S51m.js";import{w as Ze}from"./permission-C4wOllow.js";import{_ as Kt,D as Fe}from"./useAsyncRetry-Bmo6a1Zp.js";import{C as K}from"./confirm-CPtiZE0r.js";import{d as Qt}from"./InfoOutlined-C5fMx7-l.js";import{_ as Xt}from"./useAsync-Ua5iss51.js";import"./api-K65cLqol.js";import{I as Jt}from"./index-Fyc9Yh32.js";import{A as en}from"./actions-CS0A6ZvH.js";var me={},tn=le;Object.defineProperty(me,"__esModule",{value:!0});var Ge=me.default=void 0,nn=tn(ae()),sn=e;Ge=me.default=(0,nn.default)((0,sn.jsx)("path",{d:"m12 8-6 6 1.41 1.41L12 10.83l4.59 4.58L18 14z"}),"ExpandLess");const on=$e({});on.interceptors.request.use(n=>{const t=window.blocklet?window.blocklet.prefix:"/";return n.baseURL=t||"",n.url=Y("/api",String(n.url)),n.timeout=2e5,n.params=n.params||{},new URLSearchParams(n.url.split("?")[1]).has("locale")||(n.params.locale=mt()),n},n=>Promise.reject(n));const Ke=(...n)=>$e(...n),rn=(n,t)=>t?n?[n,...Array.isArray(t)?t:[t]]:t:n,an=(n,{width:t=600,height:i=700,name:o="did-domain:popup"}={})=>{const a=window.screenX+(window.innerWidth-t)/2,r=window.screenY+(window.innerHeight-i)/2,l=[`left=${a}`,`top=${r}`,`width=${t}`,`height=${i}`,"resizable=no","scrollbars=yes","status=yes","popup=yes"],c=window.open("",o,l.join(","));if(c===null)throw new Error("Failed to open popup");return c.location.href=At(n,{opener:window.location.origin}),c},ln="z2qaGosS3rZ7m5ttP3Nd4V4qczR9TryTcRV4p",Qe=async n=>{var d;if(!n||!(n!=null&&n.trim()))return null;const t=Ke(),i=new URL(n);i.pathname="__blocklet__.js",i.searchParams.set("type","json");const{data:o}=await t.get(i.toString()),a=(d=o==null?void 0:o.componentMountPoints)==null?void 0:d.find(h=>h.did===ln),r=new URL(n);r.pathname=a==null?void 0:a.mountPoint;const l=r.toString(),c=Y(l,"/api");return{base:l,api:c}},cn=Me({buy:{button:{title:"Buy DID Domain"},status:{inProgress:"Please wait while we are processing your request, the domain will be automatically resolved to the current app after the purchase...",success:"Purchase completed!"},error:{failedToCreateSession:"Failed to create session"}}}),dn=Me({buy:{button:{title:"购买 DID 域名"},status:{inProgress:"请稍等,我们正在处理您的请求,购买域名后会自动解析到当前的应用...",success:"购买完成!"},error:{failedToCreateSession:"创建会话失败"}}}),un={zh:dn,en:cn},mn=async({didDomainURL:n,delegatee:t,delegateePk:i})=>{const o=await Qe(n);if(!o)return null;const a=Ke({baseURL:o.api}),{data:r}=await a.post("/payment/session",{delegatee:t,delegateePk:i});return{sessionId:r.sessionId,baseURL:o.base}};function Xe({delegatee:n,delegateePk:t,didDomainURL:i,locale:o,title:a,onSuccess:r,...l}){const{t:c}=E(),[d,h]=Wt({currentState:1}),f=A.useRef(null),g=Ht(async()=>{const x=await mn({didDomainURL:i,delegatee:n,delegateePk:t});return x},{debounceWait:500,debounceLeading:!0,debounceTrailing:!1,debounceMaxWait:3e3,refreshDeps:[],onError(x){console.error(x)}}),C=H(x=>{var m,S,I,v;x.data.type==="didDomain.success"&&(r==null||r({nftDid:(m=x.data)==null?void 0:m.nftDid,domain:(S=x.data)==null?void 0:S.domain,chainHost:(I=x.data)==null?void 0:I.chainHost}),(v=f.current)==null||v.close(),f.current=null,h({currentState:4}),setTimeout(()=>{h({currentState:8})},2e3))});Vt(()=>{var x;try{window.removeEventListener("message",C),(x=f.current)==null||x.close(),f.current=null}catch(m){console.warn("Failed to close popup",m)}});const D=H(()=>{h({currentState:1})}),j=H(()=>{if(h({currentState:2}),!g.data){console.error("Failed to create session");return}T({sessionId:g.data.sessionId,baseURL:g.data.baseURL})}),T=H(({sessionId:x,baseURL:m})=>{window.addEventListener("message",C);const S=new URL(m);S.searchParams.set("sessionId",x),S.searchParams.set("locale",o),f.current=an(S.toString());const I=setInterval(()=>{var v;(v=f.current)!=null&&v.closed&&(clearInterval(I),D())},1e3);return()=>clearInterval(I)});return e.jsxs(e.Fragment,{children:[e.jsx(ze,{loading:g.loading,onClick:j,variant:"contained",startIcon:e.jsx(Gt,{}),...l,children:a||c("buy.button.title")}),e.jsxs(ft,{fullWidth:!0,maxWidth:"xs",open:d.currentState>1&&d.currentState<8,onClose:D,children:[!g.error&&e.jsxs(p,{sx:{display:"flex",alignItems:"center",flexDirection:"column",gap:2},children:[d.currentState===2&&e.jsx(U,{size:50}),d.currentState===4&&e.jsx(Zt,{sx:{color:"primary.main",fontSize:"5rem"}}),d.currentState===2&&e.jsx(F,{children:c("buy.status.inProgress")}),d.currentState===4&&e.jsx(F,{children:c("buy.status.success")})]}),g.error&&e.jsx(ce,{severity:"error",children:c("buy.error.failedToCreateSession")})]})]})}const Je={onSuccess:()=>{},title:""};Xe.defaultProps=Je;function et(n){return e.jsx(pt,{locale:n.locale,translations:un,children:e.jsx(Xe,{...n})})}et.defaultProps=Je;function tt({nftDid:n,didDomainURL:t,locale:i,sx:o}){const{t:a}=E(),[r,l]=G({safeIframeRef:null,popoverAnchorEl:null}),c=A.useRef(null),d=Z(),h=de(d.breakpoints.down("md")),f=j=>{l({popoverAnchorEl:j.currentTarget})},g=()=>{l({popoverAnchorEl:null})},C=Yt(async()=>{const j=await Qe(t);return j?j.base:null});if(!C.value)return null;if(C.loading)return e.jsx(U,{});const D=Y(C.value,`/embed/domain?nft-did=${n}&locale=${i}`);return e.jsxs(e.Fragment,{children:[e.jsx(p,{component:"img",src:Y(t,"/.well-known/service/blocklet/logo"),alt:"logo",width:16,height:16,onClick:f,sx:rn({cursor:"pointer"},o)}),e.jsx(Ne,{id:"popover-info",open:!!r.popoverAnchorEl,anchorEl:r.popoverAnchorEl,onClose:g,anchorOrigin:{vertical:"bottom",horizontal:"right"},children:e.jsx("iframe",{ref:c,title:a("common.subscription"),width:h?"320px":"400px",height:h?"600px":"680px",style:{border:0},src:D})})]})}tt.defaultProps={sx:{}};const pn=n=>["waiting","creating","renewaling"].includes(n);function pe(n){var w,R;const{t}=E(),[i,o]=A.useState(!1),{inService:a}=q(),[r,l]=A.useState(null),{siteId:c,domain:d,onAdd:h,children:f,did:g}=n,[C,D]=A.useState(!1),{api:j,ws:{useSubscription:T}}=q(),{mode:x,actions:{refreshDomainStatus:m}}=He(),S=Kt(async()=>{const{cert:b}=await j.findCertificateByDomain({input:{domain:d,did:g}});return b}),I=(b,z)=>{b.domain===d&&(D(!1),o(!1),a&&x!=="setup"&&(z==="success"?O.success(t("setup.domain.genCertSuccess",{domain:b.domain})):z==="error"&&O.error(t("setup.domain.genCertFailed",{domain:b.domain,message:b.message}))))};if(A.useEffect(()=>{var b;S.loading||D(pn((b=S.value)==null?void 0:b.status))},[S.loading,(w=S.value)==null?void 0:w.status]),T(Te.BlockletEvents.certError,b=>I(b,"error")),T(Te.BlockletEvents.certIssued,b=>{S.retry(),m(b.domain),I(b,"success")}),S.loading||((R=S.value)==null?void 0:R.status)==="normal")return"";const v=()=>{o(!1),l(null)},k=async()=>{o(!0);try{await j.issueLetsEncryptCert({input:{siteId:c,domain:d,did:g,inBlockletSetup:x==="setup"}}),h(),D(!0)}catch(b){console.error(b),D(!1)}finally{o(!1),l(null)}},u={title:t("router.cert.genLetsEncryptCert.title"),description:e.jsxs("div",{children:[e.jsx(ce,{severity:"success",children:t("router.cert.genLetsEncryptCert.dnsTip")}),t("router.cert.genLetsEncryptCert.description")]}),confirm:t("common.confirm"),onConfirm:k,onCancel:v},L=b=>{b.stopPropagation(),l(u)};return e.jsxs(e.Fragment,{children:[C?e.jsx(B,{title:t("router.cert.issuing"),children:e.jsx(U,{size:12})}):f({loading:i,open:L}),r&&e.jsx(K,{color:"primary",title:r.title,description:r.description,confirm:r.confirm,params:r.params,onConfirm:r.onConfirm,onCancel:r.onCancel})]})}pe.propTypes={domain:s.string.isRequired,did:s.string.isRequired,siteId:s.string.isRequired,onAdd:s.func,children:s.any};pe.defaultProps={onAdd:()=>{},children:null};function fe(n){const{domain:t,domainStatus:i,...o}=n;return _t(t)||!We(t)||It(i)||i!=null&&i.isHttps?"":e.jsx(pe,{domain:t,...o})}fe.propTypes={domain:s.string.isRequired,domainStatus:s.shape({isHttps:s.bool}).isRequired,did:s.string.isRequired,onAdd:s.func,children:s.any};fe.defaultProps={onAdd:()=>{},children:null};var he={},fn=le;Object.defineProperty(he,"__esModule",{value:!0});var nt=he.default=void 0,hn=fn(ae()),xn=e;nt=he.default=(0,hn.default)((0,xn.jsx)("path",{d:"M17 20.41 18.41 19 15 15.59 13.59 17zM7.5 8H11v5.59L5.59 19 7 20.41l6-6V8h3.5L12 3.5z"}),"CallMerge");const st=A.createContext({}),{Provider:gn,Consumer:ts}=st;function Dn({children:n}){const[t,i]=G({domain:"",error:null}),{locale:o}=E(),a={error:t.error,domain:t.domain,setError:r=>{i({error:r})},setDomain:r=>{const l=ue(r),c=Ve(l,o);i({domain:l,error:c})}};return e.jsx(gn,{value:{value:a},children:n})}function yn(){const{value:n}=A.useContext(st);return n}const{joinURL:qe}=Ft,jn=qt,ot="z2qaGosS3rZ7m5ttP3Nd4V4qczR9TryTcRV4p",vn=async n=>{var c;if(!n||!(n!=null&&n.trim()))return null;const t=new URL(n);t.pathname="__blocklet__.js",t.searchParams.set("type","json");const{data:i}=await jn.get(t.toString()),o=(c=i==null?void 0:i.componentMountPoints)==null?void 0:c.find(d=>d.did===ot),a=new URL(n);a.pathname=o==null?void 0:o.mountPoint;const r=a.toString(),l=qe(r,"/api");return{base:r,api:l,domain:qe(l,"/domains")}};var bn={DID_DOMAIN_SERVICE_DID:ot,getDidDomainServiceURL:vn},Q={exports:{}};const wn=ht,Cn=["Failed to fetch","NetworkError when attempting to fetch resource.","The Internet connection appears to be offline.","Network request failed"];class it extends Error{constructor(t){super(),t instanceof Error?(this.originalError=t,{message:t}=t):(this.originalError=new Error(t),this.originalError.stack=this.stack),this.name="AbortError",this.message=t}}const Sn=(n,t,i)=>{const o=i.retries-(t-1);return n.attemptNumber=t,n.retriesLeft=o,n},Rn=n=>Cn.includes(n),rt=(n,t)=>new Promise((i,o)=>{t={onFailedAttempt:()=>{},retries:10,...t};const a=wn.operation(t);a.attempt(async r=>{try{i(await n(r))}catch(l){if(!(l instanceof Error)){o(new TypeError(`Non-error was thrown: "${l}". You should only throw errors.`));return}if(l instanceof it)a.stop(),o(l.originalError);else if(l instanceof TypeError&&!Rn(l.message))a.stop(),o(l);else{Sn(l,r,t);try{await t.onFailedAttempt(l)}catch(c){o(c);return}a.retry(l)||o(a.mainError())}}})});Q.exports=rt;Q.exports.default=rt;Q.exports.AbortError=it;var An=Q.exports;const In=Tt(An);function xe({domain:n,resolvedTarget:t,...i}){const{t:o,locale:a}=E();return e.jsxs(p,{sx:{backgroundColor:"rgb(236, 251, 253)",borderColor:"rgb(236, 251, 253)",borderRadius:"8px",padding:"12px"},...i,children:[e.jsxs(p,{display:"flex",children:[o("router.domain.setup.tipStart"),n&&e.jsx(p,{mx:.5,color:"primary.main",fontWeight:"fontWeightBold",children:n}),o("router.domain.setup.tipEnd"),":"]}),e.jsxs(p,{sx:{"&>div":{mb:0},marginTop:"8px"},children:[e.jsx(se,{label:o("router.domain.setup.recordType"),value:"CNAME",locale:a}),e.jsx(se,{label:o("router.domain.setup.recordValue"),value:t,locale:a})]})]})}xe.propTypes={domain:s.string,resolvedTarget:s.string.isRequired};xe.defaultProps={domain:""};function se({locale:n,label:t,value:i}){const o=de(r=>r.breakpoints.down("md")),a=Z();return e.jsx(Jt,{name:t,nameWidth:120,children:e.jsxs(p,{sx:{display:"flex",alignItems:"center",lineHeight:1},children:[e.jsx(F,{component:"span",color:"primary.main",overflow:"auto",sx:o?{maxWidth:"95%",wordWrap:"break-word"}:{wordWrap:"break-word"},children:i}),e.jsx(Be,{content:i,locale:n,style:{marginLeft:"4px",color:a.palette.text.secondary}})]})})}se.propTypes={locale:s.string.isRequired,label:s.string.isRequired,value:s.string.isRequired};function ge({siteId:n,teamDid:t,cnameDomain:i,defaultCustomDomain:o,onInputDomain:a,appId:r,appPk:l,onSuccess:c,onError:d,disabled:h,autoFocus:f,inBlockletSetup:g,shouldCheckDomain:C,onStateChange:D,currentIp:j,resolveDomain:T,...x}){const{t:m,locale:S}=E(),{api:I,info:v}=q(),k=yn(),u=Z(),L=xt({key:"sm"}),[w,R]=G({submittingDomain:!1,domain:o,error:null,type:v!=null&&v.nftDomainUrl?"nftDomain":"inputDomain",showNFTDomainAuth:!1,showDnsTip:!1}),b=Xt(()=>bn.getDidDomainServiceURL(v==null?void 0:v.nftDomainUrl));if(v!=null&&v.nftDomainUrl&&b.loading)return e.jsx(p,{...x,children:e.jsx(Pe,{relative:"parent",children:e.jsx(U,{})})});if(b.error)return e.jsx(p,{...x,children:e.jsx(Pe,{relative:"parent",children:b.error.message})});const z=b.value,lt=()=>{R({invalidDNSDomain:null})},ee=async y=>{D(m("setup.domain.addingDomain")),await I.addDomainAlias({input:{id:n,domainAlias:y,teamDid:t,inBlockletSetup:!0}}),R({submittingDomain:!1}),c({domain:y,type:"inputDomain"})},Se=async({domain:y,type:P,nftDid:N,chainHost:_})=>{try{if(!C){if(P==="inputDomain"){await ee(y);return}c({domain:y,type:P,nftDid:N,chainHost:_});return}D({text:m("setup.domain.checkingResolvable")});let $=30;const te=3e3,ut=$*1e3/te,Ae=setInterval(()=>{if($<=0){clearInterval(Ae);return}D({text:`${m("setup.domain.checkingResolvable")} (${$--}s)`})},1e3),Ie=await In(async()=>{const{data:M}=await T(y);if(!M.address)throw new Error("Cannot resolve domain");return M.address},{retries:ut,minTimeout:te,maxTimeout:te,onFailedAttempt:console.error}).catch(console.error);if(clearInterval(Ae),!Ie){const M=m("setup.domain.cannotResolve",{domain:y});if(P==="nftDomain"){O.error(M),c({domain:y,type:"nftDomain"});return}D({text:""}),R({invalidDNSDomain:{domain:y,error:M},domain:y,type:P,submittingDomain:!1});return}if(Ie!==j){const M=m("setup.domain.resolvedAddressError",{domain:y,curDomain:window.location.hostname});if(P==="nftDomain"){O.error(M),c({domain:y,type:"nftDomain"});return}D({text:""}),R({invalidDNSDomain:{domain:y,error:M},domain:y,type:P,submittingDomain:!1});return}if(P==="nftDomain"){c({domain:y,type:"nftDomain"});return}await ee(y)}catch($){O.error($.message),D({text:""}),R({submittingDomain:!1})}},ct=async({domain:y,nftDid:P,chainHost:N})=>{try{const _=_e(y);R({submittingDomain:!0}),await I.addDomainAlias({input:{id:n,type:"nft-domain",domainAlias:_,nftDid:P,chainHost:N,teamDid:t,inBlockletSetup:g}});const $="nftDomain";R({showNFTDomainAuth:!1,type:$}),await Se({domain:_,type:$,nftDid:P,chainHost:N})}catch(_){O.error(_.message)}finally{R({showNFTDomainAuth:!1,submittingDomain:!1})}},dt=async()=>{try{R({submittingDomain:!0});const y=_e(w.domain);if(v.nftDomainUrl&&z&&(await I.isDidDomain({input:{domain:y}})).value===!0){R({showNFTDomainAuth:!0});return}await Se({domain:y,type:w.type})}catch(y){R({submittingDomain:!1}),k.setError(y.message)}},Re=k.error||w.error;return e.jsx(p,{...x,children:e.jsxs(p,{sx:{display:"flex",flexDirection:"column",justifyContent:"flex-start",gap:"1em"},children:[e.jsxs(p,{sx:{display:"flex",flexDirection:"column",gap:"8px"},children:[e.jsx(F,{sx:{color:u.palette.text.primary},children:m("router.domainAlias.add.tips")}),e.jsx(jt,{sx:{display:"block",marginTop:"8px"},label:m("router.domainAlias.add.domainDescription"),helperText:w.type==="inputDomain"&&Re||m("router.domainAlias.add.helperText"),inputProps:{"data-cy":"domain-name-input"},fullWidth:!0,disabled:h,value:w.domain,size:"small",variant:"outlined",error:!!Re&&w.type==="inputDomain",onChange:y=>{var _;const P=ue((_=y.target)==null?void 0:_.value);k.setDomain(P);const N=Ve(P,S);R({domain:P,error:N,type:"inputDomain"}),a({domain:P,error:N,type:"inputDomain"})},autoFocus:f,onBlur:()=>{k.domain||(R({error:null}),k.setError(null))}}),e.jsx(p,{sx:{width:"100%",display:"flex",justifyContent:"flex-end"},children:e.jsx(ze,{"data-cy":"confirm-add-domain",fullWidth:L,variant:"contained",loading:w.submittingDomain,onClick:dt,children:m("common.add")})}),e.jsxs(p,{sx:{cursor:"pointer",fontSize:"14px",display:"flex",alignItems:"center",gap:"4px",lineHeight:1,color:u.palette.primary.main},onClick:()=>R({showDnsTip:!w.showDnsTip}),children:[e.jsx(Qt,{fontSize:"1em"}),m("router.domainAlias.showTipHint")]}),w.showDnsTip&&e.jsx(xe,{domain:w.domain,resolvedTarget:i,style:{marginTop:"4px"}})]}),w.invalidDNSDomain&&e.jsx(K,{title:m("common.reminder"),description:m("setup.domain.invalidDNSReminder",{error:w.invalidDNSDomain.error}),color:"primary",confirm:m("setup.domain.continueAdd"),onConfirm:()=>ee(w.invalidDNSDomain.domain,w.type),onCancel:lt}),z&&e.jsx(gt,{open:w.showNFTDomainAuth,popup:!0,useSocket:!1,forceConnected:!1,action:"authorize",baseUrl:z.api,checkFn:Pt.create({baseURL:z.api}).get,extraParams:{delegatee:r,delegateePk:l,domain:w.domain},onSuccess:ct,onClose:()=>R({showNFTDomainAuth:!1,submittingDomain:!1}),checkTimeout:60*5e3,showDownload:!1,messages:{title:m("router.domainAlias.addDomainNFT.connect.title"),scan:m("router.domainAlias.addDomainNFT.connect.scan"),confirm:m("router.domainAlias.addDomainNFT.connect.confirm"),success:m("router.domainAlias.addDomainNFT.connect.success")}})]})})}ge.propTypes={siteId:s.string.isRequired,currentIp:s.string,teamDid:s.string.isRequired,cnameDomain:s.string.isRequired,defaultCustomDomain:s.string,onInputDomain:s.func,onSuccess:s.func,appId:s.string,appPk:s.string,disabled:s.bool,autoFocus:s.bool,inBlockletSetup:s.bool,shouldCheckDomain:s.bool,onStateChange:s.func,resolveDomain:s.func,onError:s.func};ge.defaultProps={defaultCustomDomain:"",currentIp:"",onInputDomain:Ee,onSuccess:Ee,appId:"",appPk:"",disabled:!1,autoFocus:!0,inBlockletSetup:!1,shouldCheckDomain:!1,onStateChange:()=>{},resolveDomain:()=>{},onError:()=>{}};function De({id:n,children:t,title:i,teamDid:o,systemDomains:a,appId:r,appPk:l}){const{t:c}=E(),[d,h]=G({loading:!1,confirmSetting:null}),f=a.find(j=>Ye.isDidDomain(j)),g=()=>{h({loading:!1,confirmSetting:null})},C={title:i||c("router.domainAlias.add.title"),description:function(T,x,m){return e.jsx(ge,{siteId:n,teamDid:o,cnameDomain:f,onSuccess:()=>h({confirmSetting:null}),onInputDomain:({domain:S,type:I,error:v})=>{x({...T,domain:S,type:I,__disableConfirm:!!v}),m(v)},appId:r,appPk:l})},confirm:c("common.confirm"),cancel:c("common.cancel"),params:{domain:"",__disableConfirm:!0},onCancel:g},D=j=>{j.stopPropagation(),h({confirmSetting:C})};return e.jsxs(e.Fragment,{children:[typeof t=="function"?t({loading:d.loading,open:D}):e.jsxs(Oe,{onClick:D,className:"rule-action","data-cy":"action-add-domain-alias",children:[d.loading?e.jsx(U,{size:16}):e.jsx(nt,{style:{fontSize:18,marginRight:5}}),c("router.domainAlias.add.title")]}),d.confirmSetting&&e.jsx(K,{title:d.confirmSetting.title,description:d.confirmSetting.description,confirm:d.confirmSetting.confirm,cancel:d.confirmSetting.cancel,params:d.confirmSetting.params,onCancel:d.confirmSetting.onCancel,showConfirm:!1,showCancel:!0,displayError:!1,color:"primary",loading:d.loading,maxWidth:"sm"})]})}De.propTypes={id:s.string.isRequired,children:s.any,title:s.string,teamDid:s.string,systemDomains:s.arrayOf(s.string).isRequired,appId:s.string,appPk:s.string.isRequired};De.defaultProps={children:null,title:"",teamDid:"",appId:null};function Pn(n){return e.jsx(Dn,{children:e.jsx(De,{...n})})}function ye({appId:n,appPk:t,siteId:i,inBlockletSetup:o,teamDid:a,sx:r,...l}){const{api:c,info:d}=q(),{locale:h,t:f}=E(),g=async({domain:C,nftDid:D,chainHost:j})=>{await c.addDomainAlias({input:{id:i,type:"nft-domain",domainAlias:C,nftDid:D,chainHost:j,teamDid:a,inBlockletSetup:o}})};return e.jsx(et,{delegatee:n,delegateePk:t,didDomainURL:d.nftDomainUrl,onSuccess:g,locale:h,variant:"outlined",sx:r,title:f("router.domainAlias.addDomainNFT.buy"),...l})}ye.propTypes={appId:s.string.isRequired,appPk:s.string.isRequired,siteId:s.string.isRequired,inBlockletSetup:s.bool.isRequired,teamDid:s.string.isRequired,sx:s.object};ye.defaultProps={sx:{}};function je(n){const{t}=E(),[i,o]=A.useState(!1),[a,r]=A.useState(null),{id:l,domain:c,children:d,teamDid:h}=n,{api:f}=q(),g=()=>{o(!1),r(null)},C=async()=>{o(!0);try{await f.deleteDomainAlias({input:{id:l,domainAlias:c,teamDid:h}}),await $t(2e3)}catch(T){O.error(T.message)}finally{r(null),o(!1)}},D={title:t("router.domainAlias.delete.title"),description:t("router.domainAlias.delete.description"),confirm:t("common.confirm"),onConfirm:C,onCancel:g},j=T=>{T.stopPropagation(),r(D)};return e.jsxs(e.Fragment,{children:[typeof d=="function"?d({loading:i,open:j}):e.jsxs(V,{edge:"end",onClick:j,size:"small",className:"rule-action",color:"error","data-cy":"action-delete-domain-alias",children:[i?e.jsx(U,{size:16}):e.jsx(Ue,{style:{fontSize:16}}),t("router.domainAlias.delete.title")]}),a&&e.jsx(K,{title:a.title,description:a.description,confirm:a.confirm,params:a.params,onConfirm:a.onConfirm,onCancel:a.onCancel})]})}je.propTypes={id:s.string.isRequired,domain:s.string.isRequired,children:s.any,teamDid:s.string};je.defaultProps={children:null,teamDid:""};function ve({site:n,domain:t,blocklet:i}){const{t:o}=E(),a=t.value===window.location.hostname;return e.jsx(en,{"data-cy":"domain-actions",size:"large",actions:[({close:r})=>{var l;return e.jsx(je,{id:n.id,domain:t.value,teamDid:(l=i==null?void 0:i.meta)==null?void 0:l.did,children:({open:c})=>e.jsx(B,{title:a?o("blocklet.router.currentDomainTip"):"",children:e.jsx("span",{children:e.jsxs(Oe,{disabled:t.isProtected||a,dense:!0,onClick:d=>{r(),c(d)},"data-cy":"action-toggle-block",children:[e.jsx(vt,{style:{minWidth:24,marginRight:8},children:e.jsx(Ue,{})}),e.jsx(bt,{primary:o("common.delete")})]},"remove")})})})}]})}ve.propTypes={site:s.object.isRequired,domain:s.object.isRequired,blocklet:s.object.isRequired};ve.defaultProps={};var be={},En=le;Object.defineProperty(be,"__esModule",{value:!0});var we=be.default=void 0,Tn=En(ae()),kn=e;we=be.default=(0,Tn.default)((0,kn.jsx)("path",{d:"M18 8h-1V6c0-2.76-2.24-5-5-5S7 3.24 7 6v2H6c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V10c0-1.1-.9-2-2-2m-6 9c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2m3.1-9H8.9V6c0-1.71 1.39-3.1 3.1-3.1 1.71 0 3.1 1.39 3.1 3.1z"}),"Https");const X=s.shape({href:s.string,accessibility:s.shape({loading:s.bool,accessible:s.bool}),domainStatus:s.shape({isHttps:s.bool,matchedCert:s.object}),dns:s.shape({resolved:s.bool,ip:s.string})});function Ce({certificate:n}){const[t,i]=A.useState(null),o=q(),{t:a,locale:r}=E(),l=h=>{i(h.currentTarget)},c=()=>{i(null)},d=!!t;return e.jsxs(e.Fragment,{children:[e.jsx(we,{"aria-owns":d?"mouse-over-popover":void 0,onMouseEnter:l,onMouseLeave:c,style:{color:"#44cdc6",fontSize:20,cursor:"pointer"}}),e.jsx(Ne,{id:"mouse-over-popover",style:{pointerEvents:"none"},open:d,anchorEl:t,anchorOrigin:{vertical:"bottom",horizontal:"left"},transformOrigin:{vertical:"top",horizontal:"left"},onClose:c,disableRestoreFocus:!0,children:e.jsx(wt,{children:e.jsxs(Ct,{style:{display:"flex"},children:[e.jsx("div",{children:e.jsx("img",{src:`${o.imgPrefix}/https-certificate-icon.png`,alt:"certificate icon",style:{maxHeight:"100%",maxWidth:"100%"}})}),e.jsxs(F,{component:"div",style:{marginLeft:"16px"},children:[e.jsx(F,{component:"div",style:{fontWeight:"bold"},children:n.domain}),e.jsx(F,{component:"div",children:`${a("common.issuer")}: ${Et(n,"issuer.commonName","")}`}),e.jsx(F,{component:"div",children:`${a("router.cert.issuedOn")}: ${ke(n.validFrom,r)}`}),e.jsx(F,{component:"div",children:`${a("router.cert.expiryOn")}: ${ke(n.validTo,r)}`})]})]})})})]})}Ce.propTypes={certificate:s.object};Ce.defaultProps={certificate:{}};function W({domain:n,filters:t}){const{t:i}=E(),{value:o,domainStatus:a}=n;if(!We(o))return null;let r=null,l=null;const{isHttps:c,matchedCert:d}=a;if(!Mt(o)){const{dns:{resolved:f,ip:g}={}}=a;f||g==="127.0.0.1"?r=e.jsx(B,{title:i("router.domain.verify.ok"),children:e.jsx(Fe,{color:"success"})}):r=e.jsx(B,{title:i("router.domain.verify.notResolved"),children:e.jsx(Fe,{color:"error"})})}c?l=e.jsx(Ce,{certificate:d}):l=e.jsx(B,{title:i("router.domain.https.bad"),children:e.jsx(we,{style:{color:"#D0021B",fontSize:20,cursor:"pointer"}})});const h=t.map(f=>f==="domain"?r:f==="http"?l:null);return A.createElement(A.Fragment,null,...h)}W.propTypes={domain:X.isRequired,filters:s.array};W.defaultProps={filters:["domain","http"]};const Ln=Ze(J,"mutate_blocklets"),_n=Ze(J,"",Bt);function at(n){const{inService:t}=q(),{blocklet:i,loadingRuntimeInfo:o}=He();let a=Ln;return t&&(a=_n),e.jsx(a,{...n,blocklet:i,inService:t,loadingRuntimeInfo:o})}at.propTypes={listOnly:s.bool};at.defaultProps={listOnly:!1};function J({hasPermission:n,blocklet:t,loadingRuntimeInfo:i,inService:o,listOnly:a}){var S,I,v,k;const{t:r}=E(),{info:l}=q(),[c,d]=A.useState(!1),h=de(u=>u.breakpoints.down("md")),f=A.useMemo(()=>{let u=n;return Ut(t)&&(u=u&&o),u},[n,o,t]),{site:g}=t,C=A.useMemo(()=>{var u;return zt((u=t.site)==null?void 0:u.domainAliases)},[(S=t.site)==null?void 0:S.domainAliases]),D=[],j=[],T=Lt.encode(t.appPid),x=(v=(I=t.environments)==null?void 0:I.find(u=>u.key==="BLOCKLET_APP_PK"))==null?void 0:v.value,m=Nt(C);return C.forEach(u=>{const L=u.value||"";Ye.isDidDomain(L)&&!L.startsWith(T)?j.push(u):D.push(u)}),e.jsxs(e.Fragment,{children:[!a&&e.jsxs(e.Fragment,{children:[e.jsxs(p,{className:"title first",display:"flex",justifyContent:"space-between",alignItems:"center",children:[e.jsx(p,{children:r("common.domain")}),f&&e.jsxs(p,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(Pn,{id:g.id,title:r("router.domain.add.title"),teamDid:(k=t.meta)==null?void 0:k.did,appId:t.appPid,appPk:x,systemDomains:m==null?void 0:m.map(u=>u.value),children:({open:u})=>e.jsxs(V,{style:{marginLeft:16},variant:"contained",color:"primary","data-cy":"add-domain-alias",onClick:u,disabled:Le.isInProgress(t.status),children:[e.jsx(kt,{style:{fontSize:"1.3em",marginRight:4}}),r("common.add")]})}),l.nftDomainUrl&&e.jsx(ye,{variant:"outlined",appId:t.appPid,appPk:x,siteId:g.id,inBlockletSetup:!1,teamDid:t.meta.did})]})]}),Le.isAccessible(t.status)===!1&&e.jsx(p,{mt:1.5,mb:1.5,children:e.jsx(ce,{severity:"warning",children:r("blocklet.router.noRunning")})})]}),e.jsx(p,{sx:{display:"flex",flexDirection:"column",gap:1},children:(c?C:D).map(u=>{var w,R;const L=u.value;return e.jsxs(A.Fragment,{children:[h&&e.jsxs(p,{display:"flex",flexDirection:"column",children:[e.jsx(p,{display:"flex",alignItems:"center",justifyContent:"flex-start",children:e.jsx(oe,{domain:u,target:"_blank",children:u.value})}),e.jsxs(p,{display:"flex",alignItems:"center",justifyContent:"space-between",children:[e.jsxs(p,{sx:{display:"flex",alignItems:"center",justifyContent:"flex-start",gap:1},children:[e.jsx(W,{domain:u,filters:["domain"]},`${u.value}-domain`),e.jsx(re,{siteId:(w=t.site)==null?void 0:w.id,domain:u,blocklet:t,hasMutatePermission:f})]}),e.jsx(p,{sx:{button:{padding:0}},children:e.jsx(ie,{hasMutatePermission:f,site:g,domain:u,blocklet:t})})]})]},L),!h&&e.jsxs(p,{display:"flex",alignItems:"center",justifyContent:"space-between",children:[e.jsxs(p,{display:"flex",alignItems:"center",justifyContent:"flex-start",children:[e.jsx(W,{domain:u,filters:["domain"]},`${u.value}-domain`),e.jsx(p,{sx:{ml:2,mr:.5},children:e.jsx(oe,{domain:u,target:"_blank",children:u.value})}),e.jsx(re,{siteId:(R=t.site)==null?void 0:R.id,domain:u,blocklet:t,hasMutatePermission:f})]}),e.jsx(p,{sx:{button:{padding:0}},children:e.jsx(ie,{hasMutatePermission:f,site:g,domain:u,blocklet:t})})]},L)]},L)})}),j.length>0&&e.jsx("div",{style:{marginLeft:"20px",marginTop:"12px"},children:e.jsx(V,{endIcon:c?e.jsx(Ge,{}):e.jsx(Dt,{}),onClick:()=>d(!c),children:r(c?"common.collapseAll":"blocklet.router.showAllDomains")})}),!C.length&&(i?e.jsx(U,{size:16}):e.jsx(yt,{children:r("common.empty")}))]})}J.propTypes={hasPermission:s.bool,blocklet:s.object.isRequired,loadingRuntimeInfo:s.bool,inService:s.bool.isRequired,listOnly:s.bool};J.defaultProps={hasPermission:!1,loadingRuntimeInfo:!1,listOnly:!1};function oe({domain:n,children:t,...i}){const{t:o,locale:a}=E(),{href:r,accessibility:l,value:c}=n,d=A.useCallback(()=>e.jsx(Be,{content:ue(c),locale:a,style:{marginLeft:"4px",color:"#999",fontSize:"0.8em",verticalAlign:"bottom"}}),[c,a]);return!l||l.loading?e.jsxs(ne,{...i,children:[t,d(),e.jsx(B,{title:o("blocklet.router.checkUrlAccessible"),placement:"top-end",children:e.jsx("span",{className:"status",children:e.jsx(U,{size:12})})})]}):l.accessible?e.jsxs(ne,{...i,children:[e.jsx(p,{component:"a",href:r,target:"_blank",rel:"noopener noreferrer",children:t}),d()]}):e.jsxs(ne,{...i,children:[e.jsx(B,{title:o("blocklet.router.urlInaccessible"),placement:"top-end",children:e.jsx("span",{children:t})}),d()]})}oe.propTypes={domain:X.isRequired,children:s.any.isRequired};const ne=St.span`
1
+ import{$ as ae,aG as $e,z as mt,f as Me,L as pt,e as E,a6 as ft,j as O,aZ as ht,a_ as Be,a$ as xt,C as Pe,Z as gt,a2 as V,a9 as ze,aV as Dt,au as yt}from"./vendor-arcblock-DZrZ_x_3.js";import{a1 as le,j as e,bX as Ue,a3 as p,a2 as z,T as q,ad as ce,e as G,t as de,aj as Ne,E as s,a4 as B,M as jt,al as Oe,bm as vt,bn as bt,am as wt,ao as Ct,aa as St,I as Rt}from"./vendor-mui-core-xF5F4eT7.js";import{x as Z,w as At,y as It,H as ue,C as Pt,n as Ee,b as Et}from"./vendor-utils-5TjOM6td.js";import{r as A,g as Tt}from"./vendor-react-D-afvo_7.js";import{d as kt}from"./Add-DSPtuudj.js";import{b as Lt}from"./base32-BAfsRZF6.js";import{ah as _t,ai as We,y as F,B as He,h as Te,aj as Ve,T as qt,ak as Ft,ag as Ze,b as $t,H as ke,al as Mt,M as Bt,J as zt,am as Ut,an as Nt,f as Le}from"./index-LIf2LIyz.js";import{d as Ot}from"./LockIcon-D-W4Rph6.js";import{s as Wt,n as Ht,u as H,o as Vt,w as Zt}from"./vendor-hooks-BKxTDk_P.js";import{d as Gt}from"./CheckCircle-BxzRfCun.js";import{d as Kt,p as _e}from"./util-BpKZM3xV.js";import{_ as K}from"./useSetState-Crt4S51m.js";import{w as Ge}from"./permission-C0p6f4_S.js";import{_ as Qt,D as qe}from"./useAsyncRetry-Bmo6a1Zp.js";import{C as Q}from"./confirm-CpCj_oj-.js";import{d as Xt}from"./InfoOutlined-C_J3Y0fX.js";import{_ as Yt}from"./useAsync-Ua5iss51.js";import"./api-K65cLqol.js";import{I as Jt}from"./index-DGzAI_hi.js";import{A as en}from"./actions-CPjP-DJ-.js";var me={},tn=le;Object.defineProperty(me,"__esModule",{value:!0});var Ke=me.default=void 0,nn=tn(ae()),sn=e;Ke=me.default=(0,nn.default)((0,sn.jsx)("path",{d:"m12 8-6 6 1.41 1.41L12 10.83l4.59 4.58L18 14z"}),"ExpandLess");const on=$e({});on.interceptors.request.use(n=>{const t=window.blocklet?window.blocklet.prefix:"/";return n.baseURL=t||"",n.url=Z("/api",String(n.url)),n.timeout=2e5,n.params=n.params||{},new URLSearchParams(n.url.split("?")[1]).has("locale")||(n.params.locale=mt()),n},n=>Promise.reject(n));const Qe=(...n)=>$e(...n),rn=(n,t)=>t?n?[n,...Array.isArray(t)?t:[t]]:t:n,an=(n,{width:t=600,height:i=700,name:o="did-domain:popup"}={})=>{const a=window.screenX+(window.innerWidth-t)/2,r=window.screenY+(window.innerHeight-i)/2,l=[`left=${a}`,`top=${r}`,`width=${t}`,`height=${i}`,"resizable=no","scrollbars=yes","status=yes","popup=yes"],c=window.open("",o,l.join(","));if(c===null)throw new Error("Failed to open popup");return c.location.href=At(n,{opener:window.location.origin}),c},ln="z2qaGosS3rZ7m5ttP3Nd4V4qczR9TryTcRV4p",Xe=async n=>{var d;if(!n||!(n!=null&&n.trim()))return null;const t=Qe(),i=new URL(n);i.pathname="__blocklet__.js",i.searchParams.set("type","json");const{data:o}=await t.get(i.toString()),a=(d=o==null?void 0:o.componentMountPoints)==null?void 0:d.find(h=>h.did===ln),r=new URL(n);r.pathname=a==null?void 0:a.mountPoint;const l=r.toString(),c=Z(l,"/api");return{base:l,api:c}},cn=Me({buy:{button:{title:"Buy DID Domain"},status:{inProgress:"Please wait while we are processing your request, the domain will be automatically resolved to the current app after the purchase...",success:"Purchase completed!"},error:{failedToCreateSession:"Failed to create session"}}}),dn=Me({buy:{button:{title:"购买 DID 域名"},status:{inProgress:"请稍等,我们正在处理您的请求,购买域名后会自动解析到当前的应用...",success:"购买完成!"},error:{failedToCreateSession:"创建会话失败"}}}),un={zh:dn,en:cn},mn=async({didDomainURL:n,delegatee:t,delegateePk:i})=>{const o=await Xe(n);if(!o)return null;const a=Qe({baseURL:o.api}),{data:r}=await a.post("/payment/session",{delegatee:t,delegateePk:i});return{sessionId:r.sessionId,baseURL:o.base}};function Ye({delegatee:n,delegateePk:t,didDomainURL:i,locale:o,title:a,onSuccess:r,...l}){const{t:c}=E(),[d,h]=Wt({currentState:1}),f=A.useRef(null),g=Ht(async()=>{const x=await mn({didDomainURL:i,delegatee:n,delegateePk:t});return x},{debounceWait:500,debounceLeading:!0,debounceTrailing:!1,debounceMaxWait:3e3,refreshDeps:[],onError(x){console.error(x)}}),C=H(x=>{var m,S,I,v;x.data.type==="didDomain.success"&&(r==null||r({nftDid:(m=x.data)==null?void 0:m.nftDid,domain:(S=x.data)==null?void 0:S.domain,chainHost:(I=x.data)==null?void 0:I.chainHost}),(v=f.current)==null||v.close(),f.current=null,h({currentState:4}),setTimeout(()=>{h({currentState:8})},2e3))});Vt(()=>{var x;try{window.removeEventListener("message",C),(x=f.current)==null||x.close(),f.current=null}catch(m){console.warn("Failed to close popup",m)}});const D=H(()=>{h({currentState:1})}),j=H(()=>{if(h({currentState:2}),!g.data){console.error("Failed to create session");return}T({sessionId:g.data.sessionId,baseURL:g.data.baseURL})}),T=H(({sessionId:x,baseURL:m})=>{window.addEventListener("message",C);const S=new URL(m);S.searchParams.set("sessionId",x),S.searchParams.set("locale",o),f.current=an(S.toString());const I=setInterval(()=>{var v;(v=f.current)!=null&&v.closed&&(clearInterval(I),D())},1e3);return()=>clearInterval(I)});return e.jsxs(e.Fragment,{children:[e.jsx(Ue,{loading:g.loading,onClick:j,variant:"contained",startIcon:e.jsx(Kt,{}),...l,children:a||c("buy.button.title")}),e.jsxs(ft,{fullWidth:!0,maxWidth:"xs",open:d.currentState>1&&d.currentState<8,onClose:D,children:[!g.error&&e.jsxs(p,{sx:{display:"flex",alignItems:"center",flexDirection:"column",gap:2},children:[d.currentState===2&&e.jsx(z,{size:50}),d.currentState===4&&e.jsx(Gt,{sx:{color:"primary.main",fontSize:"5rem"}}),d.currentState===2&&e.jsx(q,{children:c("buy.status.inProgress")}),d.currentState===4&&e.jsx(q,{children:c("buy.status.success")})]}),g.error&&e.jsx(ce,{severity:"error",children:c("buy.error.failedToCreateSession")})]})]})}const Je={onSuccess:()=>{},title:""};Ye.defaultProps=Je;function et(n){return e.jsx(pt,{locale:n.locale,translations:un,children:e.jsx(Ye,{...n})})}et.defaultProps=Je;function tt({nftDid:n,didDomainURL:t,locale:i,sx:o}){const{t:a}=E(),[r,l]=K({safeIframeRef:null,popoverAnchorEl:null}),c=A.useRef(null),d=G(),h=de(d.breakpoints.down("md")),f=j=>{l({popoverAnchorEl:j.currentTarget})},g=()=>{l({popoverAnchorEl:null})},C=Zt(async()=>{const j=await Xe(t);return j?j.base:null});if(!C.value)return null;if(C.loading)return e.jsx(z,{});const D=Z(C.value,`/embed/domain?nft-did=${n}&locale=${i}`);return e.jsxs(e.Fragment,{children:[e.jsx(p,{component:"img",src:Z(t,"/.well-known/service/blocklet/logo"),alt:"logo",width:16,height:16,onClick:f,sx:rn({cursor:"pointer"},o)}),e.jsx(Ne,{id:"popover-info",open:!!r.popoverAnchorEl,anchorEl:r.popoverAnchorEl,onClose:g,anchorOrigin:{vertical:"bottom",horizontal:"right"},children:e.jsx("iframe",{ref:c,title:a("common.subscription"),width:h?"320px":"400px",height:h?"600px":"680px",style:{border:0},src:D})})]})}tt.defaultProps={sx:{}};const pn=n=>["waiting","creating","renewaling"].includes(n);function pe(n){var w,R;const{t}=E(),[i,o]=A.useState(!1),{inService:a}=F(),[r,l]=A.useState(null),{siteId:c,domain:d,onAdd:h,children:f,did:g}=n,[C,D]=A.useState(!1),{api:j,ws:{useSubscription:T}}=F(),{mode:x,actions:{refreshDomainStatus:m}}=He(),S=Qt(async()=>{const{cert:b}=await j.findCertificateByDomain({input:{domain:d,did:g}});return b}),I=(b,U)=>{b.domain===d&&(D(!1),o(!1),a&&x!=="setup"&&(U==="success"?O.success(t("setup.domain.genCertSuccess",{domain:b.domain})):U==="error"&&O.error(t("setup.domain.genCertFailed",{domain:b.domain,message:b.message}))))};if(A.useEffect(()=>{var b;S.loading||D(pn((b=S.value)==null?void 0:b.status))},[S.loading,(w=S.value)==null?void 0:w.status]),T(Te.BlockletEvents.certError,b=>I(b,"error")),T(Te.BlockletEvents.certIssued,b=>{S.retry(),m(b.domain),I(b,"success")}),S.loading||((R=S.value)==null?void 0:R.status)==="normal")return"";const v=()=>{o(!1),l(null)},k=async()=>{o(!0);try{await j.issueLetsEncryptCert({input:{siteId:c,domain:d,did:g,inBlockletSetup:x==="setup"}}),h(),D(!0)}catch(b){console.error(b),D(!1)}finally{o(!1),l(null)}},u={title:t("router.cert.genLetsEncryptCert.title"),description:e.jsxs("div",{children:[e.jsx(ce,{severity:"success",children:t("router.cert.genLetsEncryptCert.dnsTip")}),t("router.cert.genLetsEncryptCert.description")]}),confirm:t("common.confirm"),onConfirm:k,onCancel:v},L=b=>{b.stopPropagation(),l(u)};return e.jsxs(e.Fragment,{children:[C?e.jsx(B,{title:t("router.cert.issuing"),children:e.jsx(z,{size:12})}):f({loading:i,open:L}),r&&e.jsx(Q,{color:"primary",title:r.title,description:r.description,confirm:r.confirm,params:r.params,onConfirm:r.onConfirm,onCancel:r.onCancel})]})}pe.propTypes={domain:s.string.isRequired,did:s.string.isRequired,siteId:s.string.isRequired,onAdd:s.func,children:s.any};pe.defaultProps={onAdd:()=>{},children:null};function fe(n){const{domain:t,domainStatus:i,...o}=n;return _t(t)||!We(t)||It(i)||i!=null&&i.isHttps?"":e.jsx(pe,{domain:t,...o})}fe.propTypes={domain:s.string.isRequired,domainStatus:s.shape({isHttps:s.bool}).isRequired,did:s.string.isRequired,onAdd:s.func,children:s.any};fe.defaultProps={onAdd:()=>{},children:null};var he={},fn=le;Object.defineProperty(he,"__esModule",{value:!0});var nt=he.default=void 0,hn=fn(ae()),xn=e;nt=he.default=(0,hn.default)((0,xn.jsx)("path",{d:"M17 20.41 18.41 19 15 15.59 13.59 17zM7.5 8H11v5.59L5.59 19 7 20.41l6-6V8h3.5L12 3.5z"}),"CallMerge");const st=A.createContext({}),{Provider:gn,Consumer:ts}=st;function Dn({children:n}){const[t,i]=K({domain:"",error:null}),{locale:o}=E(),a={error:t.error,domain:t.domain,setError:r=>{i({error:r})},setDomain:r=>{const l=ue(r),c=Ve(l,o);i({domain:l,error:c})}};return e.jsx(gn,{value:{value:a},children:n})}function yn(){const{value:n}=A.useContext(st);return n}const{joinURL:Fe}=qt,jn=Ft,ot="z2qaGosS3rZ7m5ttP3Nd4V4qczR9TryTcRV4p",vn=async n=>{var c;if(!n||!(n!=null&&n.trim()))return null;const t=new URL(n);t.pathname="__blocklet__.js",t.searchParams.set("type","json");const{data:i}=await jn.get(t.toString()),o=(c=i==null?void 0:i.componentMountPoints)==null?void 0:c.find(d=>d.did===ot),a=new URL(n);a.pathname=o==null?void 0:o.mountPoint;const r=a.toString(),l=Fe(r,"/api");return{base:r,api:l,domain:Fe(l,"/domains")}};var bn={DID_DOMAIN_SERVICE_DID:ot,getDidDomainServiceURL:vn},X={exports:{}};const wn=ht,Cn=["Failed to fetch","NetworkError when attempting to fetch resource.","The Internet connection appears to be offline.","Network request failed"];class it extends Error{constructor(t){super(),t instanceof Error?(this.originalError=t,{message:t}=t):(this.originalError=new Error(t),this.originalError.stack=this.stack),this.name="AbortError",this.message=t}}const Sn=(n,t,i)=>{const o=i.retries-(t-1);return n.attemptNumber=t,n.retriesLeft=o,n},Rn=n=>Cn.includes(n),rt=(n,t)=>new Promise((i,o)=>{t={onFailedAttempt:()=>{},retries:10,...t};const a=wn.operation(t);a.attempt(async r=>{try{i(await n(r))}catch(l){if(!(l instanceof Error)){o(new TypeError(`Non-error was thrown: "${l}". You should only throw errors.`));return}if(l instanceof it)a.stop(),o(l.originalError);else if(l instanceof TypeError&&!Rn(l.message))a.stop(),o(l);else{Sn(l,r,t);try{await t.onFailedAttempt(l)}catch(c){o(c);return}a.retry(l)||o(a.mainError())}}})});X.exports=rt;X.exports.default=rt;X.exports.AbortError=it;var An=X.exports;const In=Tt(An);function xe({domain:n,resolvedTarget:t,...i}){const{t:o,locale:a}=E();return e.jsxs(p,{sx:{backgroundColor:"rgb(236, 251, 253)",borderColor:"rgb(236, 251, 253)",borderRadius:"8px",padding:"12px"},...i,children:[e.jsxs(p,{display:"flex",children:[o("router.domain.setup.tipStart"),n&&e.jsx(p,{mx:.5,color:"primary.main",fontWeight:"fontWeightBold",children:n}),o("router.domain.setup.tipEnd"),":"]}),e.jsxs(p,{sx:{"&>div":{mb:0},marginTop:"8px"},children:[e.jsx(se,{label:o("router.domain.setup.recordType"),value:"CNAME",locale:a}),e.jsx(se,{label:o("router.domain.setup.recordValue"),value:t,locale:a})]})]})}xe.propTypes={domain:s.string,resolvedTarget:s.string.isRequired};xe.defaultProps={domain:""};function se({locale:n,label:t,value:i}){const o=de(r=>r.breakpoints.down("md")),a=G();return e.jsx(Jt,{name:t,nameWidth:120,children:e.jsxs(p,{sx:{display:"flex",alignItems:"center",lineHeight:1},children:[e.jsx(q,{component:"span",color:"primary.main",overflow:"auto",sx:o?{maxWidth:"95%",wordWrap:"break-word"}:{wordWrap:"break-word"},children:i}),e.jsx(Be,{content:i,locale:n,style:{marginLeft:"4px",color:a.palette.text.secondary}})]})})}se.propTypes={locale:s.string.isRequired,label:s.string.isRequired,value:s.string.isRequired};function ge({siteId:n,teamDid:t,cnameDomain:i,defaultCustomDomain:o,onInputDomain:a,appId:r,appPk:l,onSuccess:c,onError:d,disabled:h,autoFocus:f,inBlockletSetup:g,shouldCheckDomain:C,onStateChange:D,currentIp:j,resolveDomain:T,...x}){const{t:m,locale:S}=E(),{api:I,info:v}=F(),k=yn(),u=G(),L=xt({key:"sm"}),[w,R]=K({submittingDomain:!1,domain:o,error:null,type:v!=null&&v.nftDomainUrl?"nftDomain":"inputDomain",showNFTDomainAuth:!1,showDnsTip:!1}),b=Yt(()=>bn.getDidDomainServiceURL(v==null?void 0:v.nftDomainUrl));if(v!=null&&v.nftDomainUrl&&b.loading)return e.jsx(p,{...x,children:e.jsx(Pe,{relative:"parent",children:e.jsx(z,{})})});if(b.error)return e.jsx(p,{...x,children:e.jsx(Pe,{relative:"parent",children:b.error.message})});const U=b.value,lt=()=>{R({invalidDNSDomain:null})},ee=async y=>{D(m("setup.domain.addingDomain")),await I.addDomainAlias({input:{id:n,domainAlias:y,teamDid:t,inBlockletSetup:!0}}),R({submittingDomain:!1}),c({domain:y,type:"inputDomain"})},Se=async({domain:y,type:P,nftDid:N,chainHost:_})=>{try{if(!C){if(P==="inputDomain"){await ee(y);return}c({domain:y,type:P,nftDid:N,chainHost:_});return}D({text:m("setup.domain.checkingResolvable")});let $=30;const te=3e3,ut=$*1e3/te,Ae=setInterval(()=>{if($<=0){clearInterval(Ae);return}D({text:`${m("setup.domain.checkingResolvable")} (${$--}s)`})},1e3),Ie=await In(async()=>{const{data:M}=await T(y);if(!M.address)throw new Error("Cannot resolve domain");return M.address},{retries:ut,minTimeout:te,maxTimeout:te,onFailedAttempt:console.error}).catch(console.error);if(clearInterval(Ae),!Ie){const M=m("setup.domain.cannotResolve",{domain:y});if(P==="nftDomain"){O.error(M),c({domain:y,type:"nftDomain"});return}D({text:""}),R({invalidDNSDomain:{domain:y,error:M},domain:y,type:P,submittingDomain:!1});return}if(Ie!==j){const M=m("setup.domain.resolvedAddressError",{domain:y,curDomain:window.location.hostname});if(P==="nftDomain"){O.error(M),c({domain:y,type:"nftDomain"});return}D({text:""}),R({invalidDNSDomain:{domain:y,error:M},domain:y,type:P,submittingDomain:!1});return}if(P==="nftDomain"){c({domain:y,type:"nftDomain"});return}await ee(y)}catch($){O.error($.message),D({text:""}),R({submittingDomain:!1})}},ct=async({domain:y,nftDid:P,chainHost:N})=>{try{const _=_e(y);R({submittingDomain:!0}),await I.addDomainAlias({input:{id:n,type:"nft-domain",domainAlias:_,nftDid:P,chainHost:N,teamDid:t,inBlockletSetup:g}});const $="nftDomain";R({showNFTDomainAuth:!1,type:$}),await Se({domain:_,type:$,nftDid:P,chainHost:N})}catch(_){O.error(_.message)}finally{R({showNFTDomainAuth:!1,submittingDomain:!1})}},dt=async()=>{try{R({submittingDomain:!0});const y=_e(w.domain);if(v.nftDomainUrl&&U&&(await I.isDidDomain({input:{domain:y}})).value===!0){R({showNFTDomainAuth:!0});return}await Se({domain:y,type:w.type})}catch(y){R({submittingDomain:!1}),k.setError(y.message)}},Re=k.error||w.error;return e.jsx(p,{...x,children:e.jsxs(p,{sx:{display:"flex",flexDirection:"column",justifyContent:"flex-start",gap:"1em"},children:[e.jsxs(p,{sx:{display:"flex",flexDirection:"column",gap:"8px"},children:[e.jsx(q,{sx:{color:u.palette.text.primary},children:m("router.domainAlias.add.tips")}),e.jsx(jt,{sx:{display:"block",marginTop:"8px"},label:m("router.domainAlias.add.domainDescription"),helperText:w.type==="inputDomain"&&Re||m("router.domainAlias.add.helperText"),inputProps:{"data-cy":"domain-name-input"},fullWidth:!0,disabled:h,value:w.domain,size:"small",variant:"outlined",error:!!Re&&w.type==="inputDomain",onChange:y=>{var _;const P=ue((_=y.target)==null?void 0:_.value);k.setDomain(P);const N=Ve(P,S);R({domain:P,error:N,type:"inputDomain"}),a({domain:P,error:N,type:"inputDomain"})},autoFocus:f,onBlur:()=>{k.domain||(R({error:null}),k.setError(null))}}),e.jsx(p,{sx:{width:"100%",display:"flex",justifyContent:"flex-end"},children:e.jsx(Ue,{"data-cy":"confirm-add-domain",fullWidth:L,variant:"contained",loading:w.submittingDomain,onClick:dt,children:m("common.add")})}),e.jsxs(p,{sx:{cursor:"pointer",fontSize:"14px",display:"flex",alignItems:"center",gap:"4px",lineHeight:1,color:u.palette.primary.main},onClick:()=>R({showDnsTip:!w.showDnsTip}),children:[e.jsx(Xt,{fontSize:"1em"}),m("router.domainAlias.showTipHint")]}),w.showDnsTip&&e.jsx(xe,{domain:w.domain,resolvedTarget:i,style:{marginTop:"4px"}})]}),w.invalidDNSDomain&&e.jsx(Q,{title:m("common.reminder"),description:m("setup.domain.invalidDNSReminder",{error:w.invalidDNSDomain.error}),color:"primary",confirm:m("setup.domain.continueAdd"),onConfirm:()=>ee(w.invalidDNSDomain.domain,w.type),onCancel:lt}),U&&e.jsx(gt,{open:w.showNFTDomainAuth,popup:!0,useSocket:!1,forceConnected:!1,action:"authorize",baseUrl:U.api,checkFn:Pt.create({baseURL:U.api}).get,extraParams:{delegatee:r,delegateePk:l,domain:w.domain},onSuccess:ct,onClose:()=>R({showNFTDomainAuth:!1,submittingDomain:!1}),checkTimeout:60*5e3,showDownload:!1,messages:{title:m("router.domainAlias.addDomainNFT.connect.title"),scan:m("router.domainAlias.addDomainNFT.connect.scan"),confirm:m("router.domainAlias.addDomainNFT.connect.confirm"),success:m("router.domainAlias.addDomainNFT.connect.success")}})]})})}ge.propTypes={siteId:s.string.isRequired,currentIp:s.string,teamDid:s.string.isRequired,cnameDomain:s.string.isRequired,defaultCustomDomain:s.string,onInputDomain:s.func,onSuccess:s.func,appId:s.string,appPk:s.string,disabled:s.bool,autoFocus:s.bool,inBlockletSetup:s.bool,shouldCheckDomain:s.bool,onStateChange:s.func,resolveDomain:s.func,onError:s.func};ge.defaultProps={defaultCustomDomain:"",currentIp:"",onInputDomain:Ee,onSuccess:Ee,appId:"",appPk:"",disabled:!1,autoFocus:!0,inBlockletSetup:!1,shouldCheckDomain:!1,onStateChange:()=>{},resolveDomain:()=>{},onError:()=>{}};function De({id:n,children:t,title:i,teamDid:o,systemDomains:a,appId:r,appPk:l}){const{t:c}=E(),[d,h]=K({loading:!1,confirmSetting:null}),f=a.find(j=>Ze.isDidDomain(j)),g=()=>{h({loading:!1,confirmSetting:null})},C={title:i||c("router.domainAlias.add.title"),description:function(T,x,m){return e.jsx(ge,{siteId:n,teamDid:o,cnameDomain:f,onSuccess:()=>h({confirmSetting:null}),onInputDomain:({domain:S,type:I,error:v})=>{x({...T,domain:S,type:I,__disableConfirm:!!v}),m(v)},appId:r,appPk:l})},confirm:c("common.confirm"),cancel:c("common.cancel"),params:{domain:"",__disableConfirm:!0},onCancel:g},D=j=>{j.stopPropagation(),h({confirmSetting:C})};return e.jsxs(e.Fragment,{children:[typeof t=="function"?t({loading:d.loading,open:D}):e.jsxs(Oe,{onClick:D,className:"rule-action","data-cy":"action-add-domain-alias",children:[d.loading?e.jsx(z,{size:16}):e.jsx(nt,{style:{fontSize:18,marginRight:5}}),c("router.domainAlias.add.title")]}),d.confirmSetting&&e.jsx(Q,{title:d.confirmSetting.title,description:d.confirmSetting.description,confirm:d.confirmSetting.confirm,cancel:d.confirmSetting.cancel,params:d.confirmSetting.params,onCancel:d.confirmSetting.onCancel,showConfirm:!1,showCancel:!0,displayError:!1,color:"primary",loading:d.loading,maxWidth:"sm"})]})}De.propTypes={id:s.string.isRequired,children:s.any,title:s.string,teamDid:s.string,systemDomains:s.arrayOf(s.string).isRequired,appId:s.string,appPk:s.string.isRequired};De.defaultProps={children:null,title:"",teamDid:"",appId:null};function Pn(n){return e.jsx(Dn,{children:e.jsx(De,{...n})})}function ye({appId:n,appPk:t,siteId:i,inBlockletSetup:o,teamDid:a,sx:r,...l}){const{api:c,info:d}=F(),{locale:h,t:f}=E(),g=async({domain:C,nftDid:D,chainHost:j})=>{await c.addDomainAlias({input:{id:i,type:"nft-domain",domainAlias:C,nftDid:D,chainHost:j,teamDid:a,inBlockletSetup:o}})};return e.jsx(et,{delegatee:n,delegateePk:t,didDomainURL:d.nftDomainUrl,onSuccess:g,locale:h,variant:"outlined",sx:r,title:f("router.domainAlias.addDomainNFT.buy"),...l})}ye.propTypes={appId:s.string.isRequired,appPk:s.string.isRequired,siteId:s.string.isRequired,inBlockletSetup:s.bool.isRequired,teamDid:s.string.isRequired,sx:s.object};ye.defaultProps={sx:{}};function je(n){const{t}=E(),[i,o]=A.useState(!1),[a,r]=A.useState(null),{id:l,domain:c,children:d,teamDid:h}=n,{api:f}=F(),g=()=>{o(!1),r(null)},C=async()=>{o(!0);try{await f.deleteDomainAlias({input:{id:l,domainAlias:c,teamDid:h}}),await $t(2e3)}catch(T){O.error(T.message)}finally{r(null),o(!1)}},D={title:t("router.domainAlias.delete.title"),description:t("router.domainAlias.delete.description"),confirm:t("common.confirm"),onConfirm:C,onCancel:g},j=T=>{T.stopPropagation(),r(D)};return e.jsxs(e.Fragment,{children:[typeof d=="function"?d({loading:i,open:j}):e.jsxs(V,{edge:"end",onClick:j,size:"small",className:"rule-action",color:"error","data-cy":"action-delete-domain-alias",children:[i?e.jsx(z,{size:16}):e.jsx(ze,{style:{fontSize:16}}),t("router.domainAlias.delete.title")]}),a&&e.jsx(Q,{title:a.title,description:a.description,confirm:a.confirm,params:a.params,onConfirm:a.onConfirm,onCancel:a.onCancel})]})}je.propTypes={id:s.string.isRequired,domain:s.string.isRequired,children:s.any,teamDid:s.string};je.defaultProps={children:null,teamDid:""};function ve({site:n,domain:t,blocklet:i}){const{t:o}=E(),a=t.value===window.location.hostname;return e.jsx(en,{"data-cy":"domain-actions",size:"large",actions:[({close:r})=>{var l;return e.jsx(je,{id:n.id,domain:t.value,teamDid:(l=i==null?void 0:i.meta)==null?void 0:l.did,children:({open:c})=>e.jsx(B,{title:a?o("blocklet.router.currentDomainTip"):"",children:e.jsx("span",{children:e.jsxs(Oe,{disabled:t.isProtected||a,dense:!0,onClick:d=>{r(),c(d)},"data-cy":"action-toggle-block",children:[e.jsx(vt,{style:{minWidth:24,marginRight:8},children:e.jsx(ze,{})}),e.jsx(bt,{primary:o("common.delete")})]},"remove")})})})}]})}ve.propTypes={site:s.object.isRequired,domain:s.object.isRequired,blocklet:s.object.isRequired};ve.defaultProps={};var be={},En=le;Object.defineProperty(be,"__esModule",{value:!0});var we=be.default=void 0,Tn=En(ae()),kn=e;we=be.default=(0,Tn.default)((0,kn.jsx)("path",{d:"M18 8h-1V6c0-2.76-2.24-5-5-5S7 3.24 7 6v2H6c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V10c0-1.1-.9-2-2-2m-6 9c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2m3.1-9H8.9V6c0-1.71 1.39-3.1 3.1-3.1 1.71 0 3.1 1.39 3.1 3.1z"}),"Https");const Y=s.shape({href:s.string,accessibility:s.shape({loading:s.bool,accessible:s.bool}),domainStatus:s.shape({isHttps:s.bool,matchedCert:s.object}),dns:s.shape({resolved:s.bool,ip:s.string})});function Ce({certificate:n}){const[t,i]=A.useState(null),o=F(),{t:a,locale:r}=E(),l=h=>{i(h.currentTarget)},c=()=>{i(null)},d=!!t;return e.jsxs(e.Fragment,{children:[e.jsx(we,{"aria-owns":d?"mouse-over-popover":void 0,onMouseEnter:l,onMouseLeave:c,style:{color:"#44cdc6",fontSize:20,cursor:"pointer"}}),e.jsx(Ne,{id:"mouse-over-popover",style:{pointerEvents:"none"},open:d,anchorEl:t,anchorOrigin:{vertical:"bottom",horizontal:"left"},transformOrigin:{vertical:"top",horizontal:"left"},onClose:c,disableRestoreFocus:!0,children:e.jsx(wt,{children:e.jsxs(Ct,{style:{display:"flex"},children:[e.jsx("div",{children:e.jsx("img",{src:`${o.imgPrefix}/https-certificate-icon.png`,alt:"certificate icon",style:{maxHeight:"100%",maxWidth:"100%"}})}),e.jsxs(q,{component:"div",style:{marginLeft:"16px"},children:[e.jsx(q,{component:"div",style:{fontWeight:"bold"},children:n.domain}),e.jsx(q,{component:"div",children:`${a("common.issuer")}: ${Et(n,"issuer.commonName","")}`}),e.jsx(q,{component:"div",children:`${a("router.cert.issuedOn")}: ${ke(n.validFrom,r)}`}),e.jsx(q,{component:"div",children:`${a("router.cert.expiryOn")}: ${ke(n.validTo,r)}`})]})]})})})]})}Ce.propTypes={certificate:s.object};Ce.defaultProps={certificate:{}};function W({domain:n,filters:t}){const{t:i}=E(),{value:o,domainStatus:a}=n;if(!We(o))return null;let r=null,l=null;const{isHttps:c,matchedCert:d}=a;if(!Mt(o)){const{dns:{resolved:f,ip:g}={}}=a;f||g==="127.0.0.1"?r=e.jsx(B,{title:i("router.domain.verify.ok"),children:e.jsx(qe,{color:"success"})}):r=e.jsx(B,{title:i("router.domain.verify.notResolved"),children:e.jsx(qe,{color:"error"})})}c?l=e.jsx(Ce,{certificate:d}):l=e.jsx(B,{title:i("router.domain.https.bad"),children:e.jsx(we,{style:{color:"#D0021B",fontSize:20,cursor:"pointer"}})});const h=t.map(f=>f==="domain"?r:f==="http"?l:null);return A.createElement(A.Fragment,null,...h)}W.propTypes={domain:Y.isRequired,filters:s.array};W.defaultProps={filters:["domain","http"]};const Ln=Ge(J,"mutate_blocklets"),_n=Ge(J,"",Bt);function at(n){const{inService:t}=F(),{blocklet:i,loadingRuntimeInfo:o}=He();let a=Ln;return t&&(a=_n),e.jsx(a,{...n,blocklet:i,inService:t,loadingRuntimeInfo:o})}at.propTypes={listOnly:s.bool};at.defaultProps={listOnly:!1};function J({hasPermission:n,blocklet:t,loadingRuntimeInfo:i,inService:o,listOnly:a}){var S,I,v,k;const{t:r}=E(),{info:l}=F(),[c,d]=A.useState(!1),h=de(u=>u.breakpoints.down("md")),f=A.useMemo(()=>{let u=n;return zt(t)&&(u=u&&o),u},[n,o,t]),{site:g}=t,C=A.useMemo(()=>{var u;return Ut((u=t.site)==null?void 0:u.domainAliases)},[(S=t.site)==null?void 0:S.domainAliases]),D=[],j=[],T=Lt.encode(t.appPid),x=(v=(I=t.environments)==null?void 0:I.find(u=>u.key==="BLOCKLET_APP_PK"))==null?void 0:v.value,m=Nt(C);return C.forEach(u=>{const L=u.value||"";Ze.isDidDomain(L)&&!L.startsWith(T)?j.push(u):D.push(u)}),e.jsxs(e.Fragment,{children:[!a&&e.jsxs(e.Fragment,{children:[e.jsxs(p,{className:"title first",display:"flex",justifyContent:"space-between",alignItems:"center",children:[e.jsx(p,{children:r("common.domain")}),f&&e.jsxs(p,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(Pn,{id:g.id,title:r("router.domain.add.title"),teamDid:(k=t.meta)==null?void 0:k.did,appId:t.appPid,appPk:x,systemDomains:m==null?void 0:m.map(u=>u.value),children:({open:u})=>e.jsxs(V,{style:{marginLeft:16},variant:"contained",color:"primary","data-cy":"add-domain-alias",onClick:u,disabled:Le.isInProgress(t.status),children:[e.jsx(kt,{style:{fontSize:"1.3em",marginRight:4}}),r("common.add")]})}),l.nftDomainUrl&&e.jsx(ye,{variant:"outlined",appId:t.appPid,appPk:x,siteId:g.id,inBlockletSetup:!1,teamDid:t.meta.did})]})]}),Le.isAccessible(t.status)===!1&&e.jsx(p,{mt:1.5,mb:1.5,children:e.jsx(ce,{severity:"warning",children:r("blocklet.router.noRunning")})})]}),e.jsx(p,{sx:{display:"flex",flexDirection:"column",gap:1},children:(c?C:D).map(u=>{var w,R;const L=u.value;return e.jsxs(A.Fragment,{children:[h&&e.jsxs(p,{display:"flex",flexDirection:"column",children:[e.jsx(p,{display:"flex",alignItems:"center",justifyContent:"flex-start",children:e.jsx(oe,{domain:u,target:"_blank",children:u.value})}),e.jsxs(p,{display:"flex",alignItems:"center",justifyContent:"space-between",children:[e.jsxs(p,{sx:{display:"flex",alignItems:"center",justifyContent:"flex-start",gap:1},children:[e.jsx(W,{domain:u,filters:["domain"]},`${u.value}-domain`),e.jsx(re,{siteId:(w=t.site)==null?void 0:w.id,domain:u,blocklet:t,hasMutatePermission:f})]}),e.jsx(p,{sx:{button:{padding:0}},children:e.jsx(ie,{hasMutatePermission:f,site:g,domain:u,blocklet:t})})]})]},L),!h&&e.jsxs(p,{display:"flex",alignItems:"center",justifyContent:"space-between",children:[e.jsxs(p,{display:"flex",alignItems:"center",justifyContent:"flex-start",children:[e.jsx(W,{domain:u,filters:["domain"]},`${u.value}-domain`),e.jsx(p,{sx:{ml:2,mr:.5},children:e.jsx(oe,{domain:u,target:"_blank",children:u.value})}),e.jsx(re,{siteId:(R=t.site)==null?void 0:R.id,domain:u,blocklet:t,hasMutatePermission:f})]}),e.jsx(p,{sx:{button:{padding:0}},children:e.jsx(ie,{hasMutatePermission:f,site:g,domain:u,blocklet:t})})]},L)]},L)})}),j.length>0&&e.jsx("div",{style:{marginLeft:"20px",marginTop:"12px"},children:e.jsx(V,{endIcon:c?e.jsx(Ke,{}):e.jsx(Dt,{}),onClick:()=>d(!c),children:r(c?"common.collapseAll":"blocklet.router.showAllDomains")})}),!C.length&&(i?e.jsx(z,{size:16}):e.jsx(yt,{children:r("common.empty")}))]})}J.propTypes={hasPermission:s.bool,blocklet:s.object.isRequired,loadingRuntimeInfo:s.bool,inService:s.bool.isRequired,listOnly:s.bool};J.defaultProps={hasPermission:!1,loadingRuntimeInfo:!1,listOnly:!1};function oe({domain:n,children:t,...i}){const{t:o,locale:a}=E(),{href:r,accessibility:l,value:c}=n,d=A.useCallback(()=>e.jsx(Be,{content:ue(c),locale:a,style:{marginLeft:"4px",color:"#999",fontSize:"0.8em",verticalAlign:"bottom"}}),[c,a]);return!l||l.loading?e.jsxs(ne,{...i,children:[t,d(),e.jsx(B,{title:o("blocklet.router.checkUrlAccessible"),placement:"top-end",children:e.jsx("span",{className:"status",children:e.jsx(z,{size:12})})})]}):l.accessible?e.jsxs(ne,{...i,children:[e.jsx(p,{component:"a",href:r,target:"_blank",rel:"noopener noreferrer",children:t}),d()]}):e.jsxs(ne,{...i,children:[e.jsx(B,{title:o("blocklet.router.urlInaccessible"),placement:"top-end",children:e.jsx("span",{children:t})}),d()]})}oe.propTypes={domain:Y.isRequired,children:s.any.isRequired};const ne=St.span`
2
2
  &,
3
3
  & > * {
4
4
  color: #222;
@@ -12,4 +12,4 @@ import{_ as ae,aF as $e,z as mt,f as Me,L as pt,e as E,a5 as ft,j as O,aY as ht,
12
12
  .status {
13
13
  margin-left: 8px;
14
14
  }
15
- `;function ie({hasMutatePermission:n,site:t,domain:i,blocklet:o}){const a=Z(),{t:r}=E();return n&&!i.isProtected?e.jsx(ve,{site:t,domain:i,blocklet:o}):e.jsx(B,{title:r("blocklet.router.domainLockTooltip"),placement:"top",children:e.jsx(Rt,{disabled:!0,size:"large",style:{pointerEvents:"auto",paddingTop:0,paddingBottom:0},children:e.jsx(Ot,{style:{fill:a.palette.text.disabled}})})})}ie.propTypes={hasMutatePermission:s.bool.isRequired,site:s.object.isRequired,domain:X.isRequired,blocklet:s.object.isRequired};function re({siteId:n,domain:t,blocklet:i,hasMutatePermission:o}){const{info:a}=q(),{t:r,locale:l}=E();return e.jsxs(p,{sx:{display:"flex",justifyContent:"flex-start",alignItems:"center",gap:1},children:[t.type==="nft-domain"&&e.jsx(tt,{locale:l,nftDid:t.nftDid,didDomainURL:a.nftDomainUrl}),e.jsx(W,{domain:t,filters:["http"]},`${t.value}-http`),o&&e.jsx(fe,{siteId:n,domain:t.value,domainStatus:t.domainStatus,did:i.meta.did,children:({open:c})=>e.jsx(V,{sx:{padding:0},size:"small",onClick:d=>c(d),children:r("router.cert.genLetsEncryptCert.title")})})]})}re.propTypes={siteId:s.string.isRequired,domain:X.isRequired,blocklet:s.object.isRequired,hasMutatePermission:s.bool.isRequired};export{ge as A,ye as B,Dn as D,at as a};
15
+ `;function ie({hasMutatePermission:n,site:t,domain:i,blocklet:o}){const a=G(),{t:r}=E();return n&&!i.isProtected?e.jsx(ve,{site:t,domain:i,blocklet:o}):e.jsx(B,{title:r("blocklet.router.domainLockTooltip"),placement:"top",children:e.jsx(Rt,{disabled:!0,size:"large",style:{pointerEvents:"auto",paddingTop:0,paddingBottom:0},children:e.jsx(Ot,{style:{fill:a.palette.text.disabled}})})})}ie.propTypes={hasMutatePermission:s.bool.isRequired,site:s.object.isRequired,domain:Y.isRequired,blocklet:s.object.isRequired};function re({siteId:n,domain:t,blocklet:i,hasMutatePermission:o}){const{info:a}=F(),{t:r,locale:l}=E();return e.jsxs(p,{sx:{display:"flex",justifyContent:"flex-start",alignItems:"center",gap:1},children:[t.type==="nft-domain"&&e.jsx(tt,{locale:l,nftDid:t.nftDid,didDomainURL:a.nftDomainUrl}),e.jsx(W,{domain:t,filters:["http"]},`${t.value}-http`),o&&e.jsx(fe,{siteId:n,domain:t.value,domainStatus:t.domainStatus,did:i.meta.did,children:({open:c})=>e.jsx(V,{sx:{padding:0},size:"small",onClick:d=>c(d),children:r("router.cert.genLetsEncryptCert.title")})})]})}re.propTypes={siteId:s.string.isRequired,domain:Y.isRequired,blocklet:s.object.isRequired,hasMutatePermission:s.bool.isRequired};export{ge as A,ye as B,Dn as D,at as a};
@@ -1,5 +1,5 @@
1
1
  const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-DVYdq7IA.js","assets/vendor-react-D-afvo_7.js"])))=>i.map(i=>d[i]);
2
- import{u as ee,_ as b,d as $}from"./index-1soveoNH.js";import{a1 as te,j as e,ac as g,T as w,x as R,bp as se,a3 as z,M as H,a2 as ne,aa as ie}from"./vendor-mui-core-xF5F4eT7.js";import{r,u as re}from"./vendor-react-D-afvo_7.js";import{H as h}from"./vendor-utils-5TjOM6td.js";import{i as oe}from"./isEmail-BWNRBSAy.js";import{b as p,_ as ae,e as ce,F as le,j as C,H as ue,D as de,S as fe,m as me}from"./vendor-arcblock-oqH5gsLR.js";import{F as pe}from"./fullpage-Bxt7Lsx9.js";import{f as S}from"./format-error-C0Ke3VXF.js";import{d as ge}from"./CheckCircle-Tp5VOipm.js";import{g as T}from"./get-safe-url-DBA3YcFh.js";import"./vendor-hooks-BKxTDk_P.js";var M;(M=window.env)!=null&&M.groupPathPrefix;p.ROLES.ADMIN,p.ROLES.OWNER;const y=()=>{const{searchParams:a}=new URL(window.location.href);return a.get("fromWallet")==="1"};var P={},he=te;Object.defineProperty(P,"__esModule",{value:!0});var N=P.default=void 0,ye=he(ae()),xe=e;N=P.default=(0,ye.default)((0,xe.jsx)("path",{d:"M12 19c0-3.87 3.13-7 7-7 1.08 0 2.09.25 3 .68V6c0-1.1-.9-2-2-2H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h8.08c-.05-.33-.08-.66-.08-1M4 6l8 5 8-5v2l-8 5-8-5zm13.34 16-3.54-3.54 1.41-1.41 2.12 2.12 4.24-4.24L23 16.34z"}),"MarkEmailRead");const Ee=ie.form`
2
+ import{u as ee,_ as b,d as W}from"./index-LIf2LIyz.js";import{a1 as te,j as e,ac as g,T as w,x as R,bp as se,a3 as z,M as H,a2 as ne,aa as ie}from"./vendor-mui-core-xF5F4eT7.js";import{r,u as re}from"./vendor-react-D-afvo_7.js";import{H as h}from"./vendor-utils-5TjOM6td.js";import{i as oe}from"./isEmail-BWNRBSAy.js";import{b as p,$ as ae,e as ce,F as le,j as C,H as ue,D as de,S as fe,m as me}from"./vendor-arcblock-DZrZ_x_3.js";import{F as pe}from"./fullpage-DT2JXUAZ.js";import{f as S}from"./format-error-C0Ke3VXF.js";import{d as ge}from"./CheckCircle-BxzRfCun.js";import{g as T}from"./get-safe-url-DDeO6YpV.js";import"./vendor-hooks-BKxTDk_P.js";var M;(M=window.env)!=null&&M.groupPathPrefix;p.ROLES.ADMIN,p.ROLES.OWNER;const y=()=>{const{searchParams:a}=new URL(window.location.href);return a.get("fromWallet")==="1"};var P={},he=te;Object.defineProperty(P,"__esModule",{value:!0});var N=P.default=void 0,ye=he(ae()),xe=e;N=P.default=(0,ye.default)((0,xe.jsx)("path",{d:"M12 19c0-3.87 3.13-7 7-7 1.08 0 2.09.25 3 .68V6c0-1.1-.9-2-2-2H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h8.08c-.05-.33-.08-.66-.08-1M4 6l8 5 8-5v2l-8 5-8-5zm13.34 16-3.54-3.54 1.41-1.41 2.12 2.12 4.24-4.24L23 16.34z"}),"MarkEmailRead");const Ee=ie.form`
3
3
  display: flex;
4
4
  flex-direction: column;
5
5
  align-items: center;
@@ -15,4 +15,4 @@ import{u as ee,_ as b,d as $}from"./index-1soveoNH.js";import{a1 as te,j as e,ac
15
15
  div.Mui-focused input {
16
16
  caret-color: ${a=>a.theme.palette.primary.main};
17
17
  }
18
- `,ve=a=>{try{if(!a)return null;const o=me.fromBase64(a).toString();return oe(o)?o:null}catch{return null}};function Te(){var B,F;const a=r.useRef(null),{session:o,connectApi:I}=ee(),{t:s,locale:d}=ce(),[x,L]=r.useState(((B=o.user)==null?void 0:B.email)||""),[c,A]=r.useState(""),[E,_]=r.useState(!1),[U,q]=r.useState(!1),[u,G]=r.useState(!1),[Y,K]=r.useState(!1),[v,Q]=r.useState(!1),{wallet:f}=le(),[l]=re(),O=l.get("inviter")||localStorage.getItem("inviter"),m=l.get("updateKyc")==="1";r.useEffect(()=>{const n=l.get("subject"),t=ve(n);t&&L(t)},[]),r.useEffect(()=>{var n;(n=o.user)!=null&&n.emailVerified&&m&&(K(!0),setTimeout(()=>{if(f&&y()){b(()=>import("./index-DVYdq7IA.js").then(t=>t.i),__vite__mapDeps([0,1])).then(t=>{t.call("arcClosePage")});return}window.location.href=T(l.get("redirect")||"/")},1e3))},[o.user,m,f,l]);const J=r.useCallback(async n=>{var t;n.preventDefault(),_(!0);try{await $.post(`/kyc/email/send?locale=${d}`,{email:x}),G(!0),C.success(s("login.issueKyc.codeSentSuccess"))}catch(i){C.error(S(i)),(t=document.getElementById("email-input"))==null||t.focus()}finally{_(!1)}},[x,d,s]),k=r.useCallback(async n=>{var t;n&&n.preventDefault(),_(!0);try{await $.post(`/kyc/email/verify?locale=${d}`,{code:c}),K(!0),I.open({locale:d,action:"issue-kyc",extraParams:{code:c,updateKyc:l.get("updateKyc")||"0",inviter:O||""},containerEl:a.current,className:"connect",popup:!1,saveConnect:!1,forceConnected:!0,messages:{title:s("login.issueKyc.claim"),scan:s("login.issueKyc.scan"),confirm:s("login.issueKyc.confirm"),success:s("login.issueKyc.success")},useSocket:!0,onSuccess:()=>{Q(!0),I.close(),m?(o.refresh({showProgress:!1,forceRefreshToken:!0}),setTimeout(()=>{if(f&&y()){b(()=>import("./index-DVYdq7IA.js").then(i=>i.i),__vite__mapDeps([0,1])).then(i=>{i.call("arcClosePage")});return}window.location.href=T(l.get("redirect")||"/")},1e3)):f&&y()&&b(()=>import("./index-DVYdq7IA.js").then(i=>i.i),__vite__mapDeps([0,1])).then(i=>{i.call("arcClosePage")})},onError:i=>{C.error(S(i))}})}catch(i){K(!1),C.error(S(i)),(t=document.getElementById(`code-input-${h(c).length-1}`))==null||t.focus()}finally{_(!1)}},[c,d,l,m,f,O]);r.useEffect(()=>{u&&h(c).length===p.VERIFY_CODE_LENGTH&&k()},[c,k,u]);const X=r.useCallback(()=>{q(!0),I.open({locale:d,action:"update-kyc",containerEl:a.current,className:"connect",popup:!1,saveConnect:!1,forceConnected:!0,messages:{title:s("login.updateKyc.title"),scan:s("login.updateKyc.scan"),confirm:s("login.updateKyc.confirm"),success:s("login.updateKyc.success")},useSocket:!0,onSuccess:()=>{o.refresh({showProgress:!1,forceRefreshToken:!0}),setTimeout(()=>{if(f&&y()){b(()=>import("./index-DVYdq7IA.js").then(n=>n.i),__vite__mapDeps([0,1])).then(n=>{n.call("arcClosePage")});return}window.location.href=T(l.get("redirect")||"/")},2e3)},onError:n=>{C.error(S(n))}})},[d,l,f]),D=r.useCallback(n=>{if(!u)return;n.preventDefault();const t=h(n.clipboardData.getData("text/plain").slice(0,p.VERIFY_CODE_LENGTH));if(!/^\d+$/.test(t))return;A(t.padEnd(p.VERIFY_CODE_LENGTH," "));const i=document.getElementById(`code-input-${t.length}`);i&&i.focus()},[u]);r.useEffect(()=>(document.addEventListener("paste",D),()=>{document.removeEventListener("paste",D)}),[D]);const V=y()?s("login.issueKyc.issueTitle"):s("login.issueKyc.verifyTitle"),Z=y()?s("login.issueKyc.issueAction"):s("login.issueKyc.verifyAction");return e.jsxs(pe,{did:(F=window.blocklet)==null?void 0:F.appPid,children:[e.jsx(ue,{children:e.jsx("title",{children:V})}),e.jsxs(g,{direction:"column",justifyContent:"center",alignItems:"center",sx:{width:"560px",px:2,boxSizing:"border-box",maxWidth:"100%",height:"100%"},children:[e.jsxs(g,{spacing:1,justifyContent:"center",alignItems:"center",sx:{mb:3},children:[v?e.jsx(ge,{sx:{fontSize:72},color:"success"}):e.jsx(N,{sx:{fontSize:72},color:"primary"}),e.jsx(w,{variant:"h5",sx:{textAlign:"center"},children:V}),!v&&e.jsx(w,{variant:"body2",color:"text.secondary",sx:{textAlign:"center"},children:s("login.issueKyc.pageDescription")}),v&&e.jsx(w,{variant:"body1",sx:{textAlign:"center"},children:s("login.issueKyc.success")}),v&&e.jsx(R,{variant:"contained",color:"primary",component:se,href:"/",size:"large",children:s("login.issueKyc.backToHome")}),!v&&o.user&&e.jsxs(g,{direction:"column",justifyContent:"center",alignItems:"center",children:[e.jsx(w,{variant:"body2",color:"info.main",sx:{textAlign:"center",mt:1},children:s("login.issueKyc.issueTarget",{action:Z})}),e.jsxs(g,{direction:"row",justifyContent:"center",alignItems:"center",spacing:1,sx:{width:"100%",maxWidth:360},children:[e.jsx(de,{did:o.user.did,responsive:!0,copyable:!0,showQrcode:!1}),e.jsx(fe,{locale:d,session:o,showRole:!0,showManageBlocklet:!1})]})]})]}),e.jsx(z,{ref:a,sx:{width:"100%"},children:!Y&&!U&&e.jsxs(Ee,{onSubmit:u?k:J,children:[!u&&e.jsx(H,{type:"email",id:"email-input",placeholder:s("login.issueKyc.emailPlaceholder"),sx:{width:"100%",maxWidth:360},value:x,onChange:n=>L(n.target.value),disabled:E,required:!0}),u&&e.jsxs(g,{direction:"column",justifyContent:"center",alignItems:"center",spacing:2,children:[e.jsx(w,{variant:"body2",textAlign:"center",children:s("login.issueKyc.codeSentMessage",{email:x})}),e.jsx(z,{sx:{width:"100%",maxWidth:360,display:"flex",justifyContent:"space-between"},children:[...Array(p.VERIFY_CODE_LENGTH)].map((n,t)=>e.jsx(H,{value:h(c[t])||"",type:"number",inputProps:{maxLength:1,style:{textAlign:"center",fontSize:"1.5rem"},autoComplete:"off"},sx:{width:"14%"},onChange:i=>{var W;const j=c.split("");j[t]=i.target.value,A(j.join("")),i.target.value&&t<5&&((W=document.getElementById(`code-input-${t+1}`))==null||W.focus())},onKeyDown:i=>{var j;i.key==="Backspace"&&!h(c[t])&&t>0&&((j=document.getElementById(`code-input-${t-1}`))==null||j.focus())},disabled:E,required:!0,id:`code-input-${t}`,autoComplete:"off"},`code-input-${t}`))})]}),e.jsxs(g,{direction:"row",justifyContent:m?"space-between":"center",alignItems:"center",spacing:2,sx:{width:"100%",maxWidth:360},children:[m&&e.jsx(R,{variant:"text",disabled:E,onClick:X,size:"large",children:s("login.updateKyc.button")}),e.jsx(R,{type:"submit",size:"large",variant:"contained",disabled:E||!x||u&&h(c).length!==p.VERIFY_CODE_LENGTH,sx:{width:m?"auto":"100%"},children:E?e.jsx(ne,{size:24}):s(u?"login.issueKyc.verifyButton":"login.issueKyc.sendCodeButton")})]})]})})]})]})}export{Te as default};
18
+ `,ve=a=>{try{if(!a)return null;const o=me.fromBase64(a).toString();return oe(o)?o:null}catch{return null}};function Te(){var B,$;const a=r.useRef(null),{session:o,connectApi:I}=ee(),{t:s,locale:d}=ce(),[x,L]=r.useState(((B=o.user)==null?void 0:B.email)||""),[c,A]=r.useState(""),[E,_]=r.useState(!1),[U,q]=r.useState(!1),[u,G]=r.useState(!1),[Y,K]=r.useState(!1),[v,Q]=r.useState(!1),{wallet:f}=le(),[l]=re(),O=l.get("inviter")||localStorage.getItem("inviter"),m=l.get("updateKyc")==="1";r.useEffect(()=>{const n=l.get("subject"),t=ve(n);t&&L(t)},[]),r.useEffect(()=>{var n;(n=o.user)!=null&&n.emailVerified&&m&&(K(!0),setTimeout(()=>{if(f&&y()){b(()=>import("./index-DVYdq7IA.js").then(t=>t.i),__vite__mapDeps([0,1])).then(t=>{t.call("arcClosePage")});return}window.location.href=T(l.get("redirect")||"/")},1e3))},[o.user,m,f,l]);const J=r.useCallback(async n=>{var t;n.preventDefault(),_(!0);try{await W.post(`/kyc/email/send?locale=${d}`,{email:x}),G(!0),C.success(s("login.issueKyc.codeSentSuccess"))}catch(i){C.error(S(i)),(t=document.getElementById("email-input"))==null||t.focus()}finally{_(!1)}},[x,d,s]),k=r.useCallback(async n=>{var t;n&&n.preventDefault(),_(!0);try{await W.post(`/kyc/email/verify?locale=${d}`,{code:c}),K(!0),I.open({locale:d,action:"issue-kyc",extraParams:{code:c,updateKyc:l.get("updateKyc")||"0",inviter:O||""},containerEl:a.current,className:"connect",popup:!1,saveConnect:!1,forceConnected:!0,messages:{title:s("login.issueKyc.claim"),scan:s("login.issueKyc.scan"),confirm:s("login.issueKyc.confirm"),success:s("login.issueKyc.success")},useSocket:!0,onSuccess:()=>{Q(!0),I.close(),m?(o.refresh({showProgress:!1,forceRefreshToken:!0}),setTimeout(()=>{if(f&&y()){b(()=>import("./index-DVYdq7IA.js").then(i=>i.i),__vite__mapDeps([0,1])).then(i=>{i.call("arcClosePage")});return}window.location.href=T(l.get("redirect")||"/")},1e3)):f&&y()&&b(()=>import("./index-DVYdq7IA.js").then(i=>i.i),__vite__mapDeps([0,1])).then(i=>{i.call("arcClosePage")})},onError:i=>{C.error(S(i))}})}catch(i){K(!1),C.error(S(i)),(t=document.getElementById(`code-input-${h(c).length-1}`))==null||t.focus()}finally{_(!1)}},[c,d,l,m,f,O]);r.useEffect(()=>{u&&h(c).length===p.VERIFY_CODE_LENGTH&&k()},[c,k,u]);const X=r.useCallback(()=>{q(!0),I.open({locale:d,action:"update-kyc",containerEl:a.current,className:"connect",popup:!1,saveConnect:!1,forceConnected:!0,messages:{title:s("login.updateKyc.title"),scan:s("login.updateKyc.scan"),confirm:s("login.updateKyc.confirm"),success:s("login.updateKyc.success")},useSocket:!0,onSuccess:()=>{o.refresh({showProgress:!1,forceRefreshToken:!0}),setTimeout(()=>{if(f&&y()){b(()=>import("./index-DVYdq7IA.js").then(n=>n.i),__vite__mapDeps([0,1])).then(n=>{n.call("arcClosePage")});return}window.location.href=T(l.get("redirect")||"/")},2e3)},onError:n=>{C.error(S(n))}})},[d,l,f]),D=r.useCallback(n=>{if(!u)return;n.preventDefault();const t=h(n.clipboardData.getData("text/plain").slice(0,p.VERIFY_CODE_LENGTH));if(!/^\d+$/.test(t))return;A(t.padEnd(p.VERIFY_CODE_LENGTH," "));const i=document.getElementById(`code-input-${t.length}`);i&&i.focus()},[u]);r.useEffect(()=>(document.addEventListener("paste",D),()=>{document.removeEventListener("paste",D)}),[D]);const V=y()?s("login.issueKyc.issueTitle"):s("login.issueKyc.verifyTitle"),Z=y()?s("login.issueKyc.issueAction"):s("login.issueKyc.verifyAction");return e.jsxs(pe,{did:($=window.blocklet)==null?void 0:$.appPid,children:[e.jsx(ue,{children:e.jsx("title",{children:V})}),e.jsxs(g,{direction:"column",justifyContent:"center",alignItems:"center",sx:{width:"560px",px:2,boxSizing:"border-box",maxWidth:"100%",height:"100%"},children:[e.jsxs(g,{spacing:1,justifyContent:"center",alignItems:"center",sx:{mb:3},children:[v?e.jsx(ge,{sx:{fontSize:72},color:"success"}):e.jsx(N,{sx:{fontSize:72},color:"primary"}),e.jsx(w,{variant:"h5",sx:{textAlign:"center"},children:V}),!v&&e.jsx(w,{variant:"body2",color:"text.secondary",sx:{textAlign:"center"},children:s("login.issueKyc.pageDescription")}),v&&e.jsx(w,{variant:"body1",sx:{textAlign:"center"},children:s("login.issueKyc.success")}),v&&e.jsx(R,{variant:"contained",color:"primary",component:se,href:"/",size:"large",children:s("login.issueKyc.backToHome")}),!v&&o.user&&e.jsxs(g,{direction:"column",justifyContent:"center",alignItems:"center",children:[e.jsx(w,{variant:"body2",color:"info.main",sx:{textAlign:"center",mt:1},children:s("login.issueKyc.issueTarget",{action:Z})}),e.jsxs(g,{direction:"row",justifyContent:"center",alignItems:"center",spacing:1,sx:{width:"100%",maxWidth:360},children:[e.jsx(de,{did:o.user.did,responsive:!0,copyable:!0,showQrcode:!1}),e.jsx(fe,{locale:d,session:o,showRole:!0,showManageBlocklet:!1})]})]})]}),e.jsx(z,{ref:a,sx:{width:"100%"},children:!Y&&!U&&e.jsxs(Ee,{onSubmit:u?k:J,children:[!u&&e.jsx(H,{type:"email",id:"email-input",placeholder:s("login.issueKyc.emailPlaceholder"),sx:{width:"100%",maxWidth:360},value:x,onChange:n=>L(n.target.value),disabled:E,required:!0}),u&&e.jsxs(g,{direction:"column",justifyContent:"center",alignItems:"center",spacing:2,children:[e.jsx(w,{variant:"body2",textAlign:"center",children:s("login.issueKyc.codeSentMessage",{email:x})}),e.jsx(z,{sx:{width:"100%",maxWidth:360,display:"flex",justifyContent:"space-between"},children:[...Array(p.VERIFY_CODE_LENGTH)].map((n,t)=>e.jsx(H,{value:h(c[t])||"",type:"number",inputProps:{maxLength:1,style:{textAlign:"center",fontSize:"1.5rem"},autoComplete:"off"},sx:{width:"14%"},onChange:i=>{var F;const j=c.split("");j[t]=i.target.value,A(j.join("")),i.target.value&&t<5&&((F=document.getElementById(`code-input-${t+1}`))==null||F.focus())},onKeyDown:i=>{var j;i.key==="Backspace"&&!h(c[t])&&t>0&&((j=document.getElementById(`code-input-${t-1}`))==null||j.focus())},disabled:E,required:!0,id:`code-input-${t}`,autoComplete:"off"},`code-input-${t}`))})]}),e.jsxs(g,{direction:"row",justifyContent:m?"space-between":"center",alignItems:"center",spacing:2,sx:{width:"100%",maxWidth:360},children:[m&&e.jsx(R,{variant:"text",disabled:E,onClick:X,size:"large",children:s("login.updateKyc.button")}),e.jsx(R,{type:"submit",size:"large",variant:"contained",disabled:E||!x||u&&h(c).length!==p.VERIFY_CODE_LENGTH,sx:{width:m?"auto":"100%"},children:E?e.jsx(ne,{size:24}):s(u?"login.issueKyc.verifyButton":"login.issueKyc.sendCodeButton")})]})]})})]})]})}export{Te as default};
@@ -1 +1 @@
1
- import{j as e,a2 as C,a3 as T}from"./vendor-mui-core-xF5F4eT7.js";import{r as j,k}from"./vendor-react-D-afvo_7.js";import{e as W,C as S,Y as I,j as h,b as R,Z as U}from"./vendor-arcblock-oqH5gsLR.js";import{F as b}from"./fullpage-Bxt7Lsx9.js";import{w as v}from"./wrap-locale-D4yZwBtm.js";import{g as L}from"./get-safe-url-ClvIGbO9.js";import{S as F,s as N,a as _}from"./index-1soveoNH.js";import"./vendor-utils-5TjOM6td.js";import"./vendor-hooks-BKxTDk_P.js";function D({SessionContext:a,webWalletUrl:n,onSuccess:s}){var d,g;const{api:t,session:i}=j.useContext(a),{t:o,locale:f}=W(),u=k(),{searchParams:l}=new URL(window.location.href),p=l.get("redirect"),w=async(r,E)=>{s(r,E),await i.refresh(),h.success(o("exchangePassport.success")),setTimeout(()=>{if(p){const c=decodeURIComponent(p);c.startsWith(R.WELLKNOWN_SERVICE_PATH_PREFIX)?u(c,{replace:!0}):window.location.href=L(c)}else window.location.href=window.env.pathPrefix||window.env.apiPrefix||"/"},3e3)},P=r=>{h.error(r.message)},m={},x=l.get("componentId");return x&&(m.componentId=x),i.loading?e.jsx(S,{children:e.jsx(C,{})}):e.jsx(b,{did:((d=window==null?void 0:window.blocklet)==null?void 0:d.appPid)||((g=window==null?void 0:window.env)==null?void 0:g.appPid),children:e.jsx(T,{sx:{width:"560px",maxWidth:"100%",height:"100%"},children:e.jsx(I,{className:"connect",action:"exchange-passport",checkFn:t.get,checkTimeout:10*60*1e3,webWalletUrl:n,onSuccess:w,onError:P,locale:f,messages:{title:o("exchangePassport.dialog.title"),scan:o("exchangePassport.dialog.scan"),confirm:o("exchangePassport.dialog.confirm"),success:o("exchangePassport.dialog.success")},extraParams:m,extraContent:null})})})}const A=v(D);function q(){const a=U(),n=(s,t)=>{s.sessionToken&&(N(t(s.sessionToken)),_(t(s.refreshToken)))};return e.jsx(A,{SessionContext:F,webWalletUrl:a,onSuccess:n})}export{q as default};
1
+ import{j as e,a2 as C,a3 as T}from"./vendor-mui-core-xF5F4eT7.js";import{r as j,k}from"./vendor-react-D-afvo_7.js";import{e as W,C as S,Z as I,j as h,b as R,_ as U}from"./vendor-arcblock-DZrZ_x_3.js";import{F as b}from"./fullpage-DT2JXUAZ.js";import{w as v}from"./wrap-locale-oTlFUOZf.js";import{g as L}from"./get-safe-url-Du4BhDgB.js";import{S as F,s as N,a as _}from"./index-LIf2LIyz.js";import"./vendor-utils-5TjOM6td.js";import"./vendor-hooks-BKxTDk_P.js";function D({SessionContext:a,webWalletUrl:n,onSuccess:s}){var d,g;const{api:t,session:i}=j.useContext(a),{t:o,locale:f}=W(),u=k(),{searchParams:l}=new URL(window.location.href),p=l.get("redirect"),w=async(r,E)=>{s(r,E),await i.refresh(),h.success(o("exchangePassport.success")),setTimeout(()=>{if(p){const c=decodeURIComponent(p);c.startsWith(R.WELLKNOWN_SERVICE_PATH_PREFIX)?u(c,{replace:!0}):window.location.href=L(c)}else window.location.href=window.env.pathPrefix||window.env.apiPrefix||"/"},3e3)},P=r=>{h.error(r.message)},m={},x=l.get("componentId");return x&&(m.componentId=x),i.loading?e.jsx(S,{children:e.jsx(C,{})}):e.jsx(b,{did:((d=window==null?void 0:window.blocklet)==null?void 0:d.appPid)||((g=window==null?void 0:window.env)==null?void 0:g.appPid),children:e.jsx(T,{sx:{width:"560px",maxWidth:"100%",height:"100%"},children:e.jsx(I,{className:"connect",action:"exchange-passport",checkFn:t.get,checkTimeout:10*60*1e3,webWalletUrl:n,onSuccess:w,onError:P,locale:f,messages:{title:o("exchangePassport.dialog.title"),scan:o("exchangePassport.dialog.scan"),confirm:o("exchangePassport.dialog.confirm"),success:o("exchangePassport.dialog.success")},extraParams:m,extraContent:null})})})}const A=v(D);function y(){const a=U(),n=(s,t)=>{s.sessionToken&&(N(t(s.sessionToken)),_(t(s.refreshToken)))};return e.jsx(A,{SessionContext:F,webWalletUrl:a,onSuccess:n})}export{y as default};
@@ -1,4 +1,4 @@
1
- import{a1 as X,j as e,E as t,I as k,bq as A,x as U,P as V,v as W,$ as G,ar as H,al as J,bS as Q,M as Y,a3 as u,a2 as Z}from"./vendor-mui-core-xF5F4eT7.js";import{_ as ee,a0 as te,ad as se}from"./vendor-arcblock-oqH5gsLR.js";import{b as P,r as i}from"./vendor-react-D-afvo_7.js";import{d as ae}from"./Done-DVvDyJtD.js";import{F as le,R as ne}from"./logo-uploader-BeSpYnSl.js";import{d as re}from"./EditIcon-BOr0kf6I.js";import{d as ie}from"./ArrowDropDown-DyEwa2F9.js";var R={},oe=X;Object.defineProperty(R,"__esModule",{value:!0});var ce=R.default=void 0,ue=oe(ee()),de=e;ce=R.default=(0,ue.default)((0,de.jsx)("path",{d:"M19.43 12.98c.04-.32.07-.64.07-.98 0-.34-.03-.66-.07-.98l2.11-1.65c.19-.15.24-.42.12-.64l-2-3.46c-.09-.16-.26-.25-.44-.25-.06 0-.12.01-.17.03l-2.49 1c-.52-.4-1.08-.73-1.69-.98l-.38-2.65C14.46 2.18 14.25 2 14 2h-4c-.25 0-.46.18-.49.42l-.38 2.65c-.61.25-1.17.59-1.69.98l-2.49-1c-.06-.02-.12-.03-.18-.03-.17 0-.34.09-.43.25l-2 3.46c-.13.22-.07.49.12.64l2.11 1.65c-.04.32-.07.65-.07.98 0 .33.03.66.07.98l-2.11 1.65c-.19.15-.24.42-.12.64l2 3.46c.09.16.26.25.44.25.06 0 .12-.01.17-.03l2.49-1c.52.4 1.08.73 1.69.98l.38 2.65c.03.24.24.42.49.42h4c.25 0 .46-.18.49-.42l.38-2.65c.61-.25 1.17-.59 1.69-.98l2.49 1c.06.02.12.03.18.03.17 0 .34-.09.43-.25l2-3.46c.12-.22.07-.49-.12-.64zm-1.98-1.71c.04.31.05.52.05.73 0 .21-.02.43-.05.73l-.14 1.13.89.7 1.08.84-.7 1.21-1.27-.51-1.04-.42-.9.68c-.43.32-.84.56-1.25.73l-1.06.43-.16 1.13-.2 1.35h-1.4l-.19-1.35-.16-1.13-1.06-.43c-.43-.18-.83-.41-1.23-.71l-.91-.7-1.06.43-1.27.51-.7-1.21 1.08-.84.89-.7-.14-1.13c-.03-.31-.05-.54-.05-.74s.02-.43.05-.73l.14-1.13-.89-.7-1.08-.84.7-1.21 1.27.51 1.04.42.9-.68c.43-.32.84-.56 1.25-.73l1.06-.43.16-1.13.2-1.35h1.39l.19 1.35.16 1.13 1.06.43c.43.18.83.41 1.23.71l.91.7 1.06-.43 1.27-.51.7 1.21-1.07.85-.89.7zM12 8c-2.21 0-4 1.79-4 4s1.79 4 4 4 4-1.79 4-4-1.79-4-4-4m0 6c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2"}),"SettingsOutlined");function _({triggers:l,onEnterEdit:a,disabled:m}){const n=P.useRef(null),[p,o]=P.useState(!1),b=s=>{o(!1),s()},C=()=>{o(s=>!s)},d=s=>{n.current&&n.current.contains(s.target)||o(!1)};return l.length===0?e.jsx(k,{"data-cy":"schema-form-item-edit",onClick:a,disabled:m,size:"large",children:e.jsx(re,{})}):e.jsxs(e.Fragment,{children:[e.jsx(A,{variant:"outlined",ref:n,"aria-label":"split button",children:e.jsx(U,{size:"large","aria-controls":p?"split-button-menu":void 0,"aria-expanded":p?"true":void 0,sx:{paddingLeft:"12px",paddingRight:"12px"},onClick:C,children:e.jsx(ie,{})})}),e.jsx(V,{sx:{zIndex:9999},open:p,anchorEl:n.current,role:void 0,placement:"bottom-end",children:e.jsx(W,{children:e.jsx(G,{onClickAway:d,children:e.jsx(H,{id:"split-button-menu",autoFocusItem:!0,children:l.map(s=>e.jsx(J,{onClick:()=>b(s.handler),children:s.title},s.key))})})})})]})}_.propTypes={triggers:t.arrayOf(t.shape({key:t.string.isRequired,title:t.string.isRequired,handler:t.func.isRequired})),onEnterEdit:t.func.isRequired,disabled:t.bool.isRequired};_.defaultProps={triggers:[]};const T=(l,a,m)=>l===null&&a&&m?"******":l?a?"******":l:"",fe=Q`
1
+ import{a1 as X,j as e,E as t,I as k,bq as A,x as U,P as V,v as W,$ as G,ar as H,al as J,bS as Q,M as Y,a3 as u,a2 as Z}from"./vendor-mui-core-xF5F4eT7.js";import{$ as ee,a1 as te,ae as se}from"./vendor-arcblock-DZrZ_x_3.js";import{b as P,r as i}from"./vendor-react-D-afvo_7.js";import{d as ae}from"./Done-DJfjmlFC.js";import{F as le,R as ne}from"./logo-uploader-DbSGPbXh.js";import{d as re}from"./EditIcon-BOr0kf6I.js";import{d as ie}from"./ArrowDropDown-DM9y1OaN.js";var R={},oe=X;Object.defineProperty(R,"__esModule",{value:!0});var ce=R.default=void 0,ue=oe(ee()),de=e;ce=R.default=(0,ue.default)((0,de.jsx)("path",{d:"M19.43 12.98c.04-.32.07-.64.07-.98 0-.34-.03-.66-.07-.98l2.11-1.65c.19-.15.24-.42.12-.64l-2-3.46c-.09-.16-.26-.25-.44-.25-.06 0-.12.01-.17.03l-2.49 1c-.52-.4-1.08-.73-1.69-.98l-.38-2.65C14.46 2.18 14.25 2 14 2h-4c-.25 0-.46.18-.49.42l-.38 2.65c-.61.25-1.17.59-1.69.98l-2.49-1c-.06-.02-.12-.03-.18-.03-.17 0-.34.09-.43.25l-2 3.46c-.13.22-.07.49.12.64l2.11 1.65c-.04.32-.07.65-.07.98 0 .33.03.66.07.98l-2.11 1.65c-.19.15-.24.42-.12.64l2 3.46c.09.16.26.25.44.25.06 0 .12-.01.17-.03l2.49-1c.52.4 1.08.73 1.69.98l.38 2.65c.03.24.24.42.49.42h4c.25 0 .46-.18.49-.42l.38-2.65c.61-.25 1.17-.59 1.69-.98l2.49 1c.06.02.12.03.18.03.17 0 .34-.09.43-.25l2-3.46c.12-.22.07-.49-.12-.64zm-1.98-1.71c.04.31.05.52.05.73 0 .21-.02.43-.05.73l-.14 1.13.89.7 1.08.84-.7 1.21-1.27-.51-1.04-.42-.9.68c-.43.32-.84.56-1.25.73l-1.06.43-.16 1.13-.2 1.35h-1.4l-.19-1.35-.16-1.13-1.06-.43c-.43-.18-.83-.41-1.23-.71l-.91-.7-1.06.43-1.27.51-.7-1.21 1.08-.84.89-.7-.14-1.13c-.03-.31-.05-.54-.05-.74s.02-.43.05-.73l.14-1.13-.89-.7-1.08-.84.7-1.21 1.27.51 1.04.42.9-.68c.43-.32.84-.56 1.25-.73l1.06-.43.16-1.13.2-1.35h1.39l.19 1.35.16 1.13 1.06.43c.43.18.83.41 1.23.71l.91.7 1.06-.43 1.27-.51.7 1.21-1.07.85-.89.7zM12 8c-2.21 0-4 1.79-4 4s1.79 4 4 4 4-1.79 4-4-1.79-4-4-4m0 6c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2"}),"SettingsOutlined");function I({triggers:l,onEnterEdit:a,disabled:m}){const n=P.useRef(null),[p,o]=P.useState(!1),b=s=>{o(!1),s()},C=()=>{o(s=>!s)},d=s=>{n.current&&n.current.contains(s.target)||o(!1)};return l.length===0?e.jsx(k,{"data-cy":"schema-form-item-edit",onClick:a,disabled:m,size:"large",children:e.jsx(re,{})}):e.jsxs(e.Fragment,{children:[e.jsx(A,{variant:"outlined",ref:n,"aria-label":"split button",children:e.jsx(U,{size:"large","aria-controls":p?"split-button-menu":void 0,"aria-expanded":p?"true":void 0,sx:{paddingLeft:"12px",paddingRight:"12px"},onClick:C,children:e.jsx(ie,{})})}),e.jsx(V,{sx:{zIndex:9999},open:p,anchorEl:n.current,role:void 0,placement:"bottom-end",children:e.jsx(W,{children:e.jsx(G,{onClickAway:d,children:e.jsx(H,{id:"split-button-menu",autoFocusItem:!0,children:l.map(s=>e.jsx(J,{onClick:()=>b(s.handler),children:s.title},s.key))})})})})]})}I.propTypes={triggers:t.arrayOf(t.shape({key:t.string.isRequired,title:t.string.isRequired,handler:t.func.isRequired})),onEnterEdit:t.func.isRequired,disabled:t.bool.isRequired};I.defaultProps={triggers:[]};const T=(l,a,m)=>l===null&&a&&m?"******":l?a?"******":l:"",fe=Q`
2
2
  0%, 100% {
3
3
  transform: scale(1) translateX(0);
4
4
  }
@@ -8,4 +8,4 @@ import{a1 as X,j as e,E as t,I as k,bq as A,x as U,P as V,v as W,$ as G,ar as H,
8
8
  25%, 75% {
9
9
  transform: scale(1.1) translateX(3px);
10
10
  }
11
- `;function w({label:l,disabled:a,required:m,initialValue:n,onChange:p,placeholder:o,style:b,onSubmit:C,secure:d,triggers:s,formatterBeforeSubmit:I,...N}){const[q,g]=i.useState(!1),[h,v]=i.useState(!1),{t:L}=i.useContext(te),[y,B]=i.useState(d&&n==="__encrypted__"?null:n),[c,x]=i.useState(y),[f,j]=i.useState(!1),[M,E]=i.useState(!1),F=async()=>{v(!0);try{if(await C(c)===!1)x(y);else{let S=c;typeof I=="function"&&(S=I(c)),x(S),B(S),j(!1)}}catch{x(y)}finally{v(!1),g(!1)}},O=r=>{j(r!==c),x(r),p(r)},$=r=>{r.key==="Enter"&&F()},z=i.useCallback(()=>{E(!0),setTimeout(()=>{E(!1)},500)},[]),D=i.useCallback(()=>{f&&z(),!f&&!a&&!h&&(g(!1),j(!1))},[f,a,h,z]),K=q?e.jsx(Y,{style:{flex:1},fullWidth:!0,value:c,onChange:r=>{O(r.target.value)},autoFocus:!0,size:"small",variant:"outlined",placeholder:o,onKeyDown:$,onBlur:D,disabled:a,type:d?"password":"text",...N}):e.jsx(u,{px:1,"data-cy":"schema-form-item-edit",className:"form-item-input slot",style:{whiteSpace:"pre-wrap",cursor:"text"},onClick:()=>{a||g(!0)},children:T(c,d,n)?T(c,d,n):e.jsx("span",{className:"placeholder",children:L("common.requiredInputPlaceholder",{name:o||l})})});return e.jsx(le,{className:"form",style:b,children:e.jsxs(u,{className:"form-item",children:[e.jsxs(u,{className:"form-item-label",children:[l,m&&e.jsx(ne,{})]}),e.jsxs(u,{className:"form-item-body",style:{alignItems:"flex-start"},children:[e.jsx(u,{className:"form-item-input",children:K}),e.jsx(u,{className:"form-item-action",style:{marginLeft:s.length?12:0},children:q?e.jsxs(e.Fragment,{children:[f?e.jsx(k,{"data-cy":"schema-form-item-confirm",onClick:F,disabled:a||h||!f,sx:{animation:M?`${fe} 0.5s linear`:"none"},style:{paddingRight:4},size:"large",children:h?e.jsx(Z,{size:24}):e.jsx(ae,{})}):null,e.jsx(k,{"data-cy":"schema-form-item-cancel",onClick:()=>{x(y),g(!1),j(!1)},style:{paddingLeft:f?4:8},disabled:a||h,size:"large",children:e.jsx(se,{})})]}):e.jsx(u,{children:s.length?e.jsx(_,{triggers:s,disabled:a}):null})})]})]})})}w.propTypes={style:t.object,onSubmit:t.func,onChange:t.func,label:t.string,initialValue:t.string,placeholder:t.string,required:t.bool,disabled:t.bool,secure:t.bool,triggers:t.array,formatterBeforeSubmit:t.func};w.defaultProps={style:{},onSubmit:()=>{},onChange:()=>{},label:"",initialValue:"",placeholder:"",required:!1,disabled:!1,secure:!1,triggers:[],formatterBeforeSubmit:null};export{w as F,ce as d};
11
+ `;function w({label:l,disabled:a,required:m,initialValue:n,onChange:p,placeholder:o,style:b,onSubmit:C,secure:d,triggers:s,formatterBeforeSubmit:_,...N}){const[q,g]=i.useState(!1),[h,v]=i.useState(!1),{t:L}=i.useContext(te),[y,$]=i.useState(d&&n==="__encrypted__"?null:n),[c,x]=i.useState(y),[f,j]=i.useState(!1),[B,E]=i.useState(!1),F=async()=>{v(!0);try{if(await C(c)===!1)x(y);else{let S=c;typeof _=="function"&&(S=_(c)),x(S),$(S),j(!1)}}catch{x(y)}finally{v(!1),g(!1)}},M=r=>{j(r!==c),x(r),p(r)},O=r=>{r.key==="Enter"&&F()},z=i.useCallback(()=>{E(!0),setTimeout(()=>{E(!1)},500)},[]),D=i.useCallback(()=>{f&&z(),!f&&!a&&!h&&(g(!1),j(!1))},[f,a,h,z]),K=q?e.jsx(Y,{style:{flex:1},fullWidth:!0,value:c,onChange:r=>{M(r.target.value)},autoFocus:!0,size:"small",variant:"outlined",placeholder:o,onKeyDown:O,onBlur:D,disabled:a,type:d?"password":"text",...N}):e.jsx(u,{px:1,"data-cy":"schema-form-item-edit",className:"form-item-input slot",style:{whiteSpace:"pre-wrap",cursor:"text"},onClick:()=>{a||g(!0)},children:T(c,d,n)?T(c,d,n):e.jsx("span",{className:"placeholder",children:L("common.requiredInputPlaceholder",{name:o||l})})});return e.jsx(le,{className:"form",style:b,children:e.jsxs(u,{className:"form-item",children:[e.jsxs(u,{className:"form-item-label",children:[l,m&&e.jsx(ne,{})]}),e.jsxs(u,{className:"form-item-body",style:{alignItems:"flex-start"},children:[e.jsx(u,{className:"form-item-input",children:K}),e.jsx(u,{className:"form-item-action",style:{marginLeft:s.length?12:0},children:q?e.jsxs(e.Fragment,{children:[f?e.jsx(k,{"data-cy":"schema-form-item-confirm",onClick:F,disabled:a||h||!f,sx:{animation:B?`${fe} 0.5s linear`:"none"},style:{paddingRight:4},size:"large",children:h?e.jsx(Z,{size:24}):e.jsx(ae,{})}):null,e.jsx(k,{"data-cy":"schema-form-item-cancel",onClick:()=>{x(y),g(!1),j(!1)},style:{paddingLeft:f?4:8},disabled:a||h,size:"large",children:e.jsx(se,{})})]}):e.jsx(u,{children:s.length?e.jsx(I,{triggers:s,disabled:a}):null})})]})]})})}w.propTypes={style:t.object,onSubmit:t.func,onChange:t.func,label:t.string,initialValue:t.string,placeholder:t.string,required:t.bool,disabled:t.bool,secure:t.bool,triggers:t.array,formatterBeforeSubmit:t.func};w.defaultProps={style:{},onSubmit:()=>{},onChange:()=>{},label:"",initialValue:"",placeholder:"",required:!1,disabled:!1,secure:!1,triggers:[],formatterBeforeSubmit:null};export{w as F,ce as d};
@@ -1,4 +1,4 @@
1
- import{j as e,a3 as t,a2 as P,bp as W,E as d,aa as B}from"./vendor-mui-core-xF5F4eT7.js";import{r as l}from"./vendor-react-D-afvo_7.js";import{x as v}from"./vendor-utils-5TjOM6td.js";import{d as E}from"./Launch-vt_CNjmC.js";import{a0 as I,Y as L}from"./vendor-arcblock-oqH5gsLR.js";import{W as $}from"./did-address-Bpb9HTRt.js";import{P as D}from"./page-header-DqhVsAOw.js";import{o as T,u as z}from"./index-1soveoNH.js";import{S as A}from"./layout-D9K6IZdV.js";import{S as F}from"./step-actions-DLkXmgm2.js";import{S as m}from"./button-C4NPz_vA.js";import"./vendor-hooks-BKxTDk_P.js";import"./content-layout-cWwRTmIc.js";function u({onNext:n,onPrevious:f}){const{locale:x,t:s}=l.useContext(I),{blocklet:a,gas:c,tokenInfo:h,actions:j}=T(),{api:y}=z(),[g,o]=l.useState(!1),{need:p="",current:b="",owe:r=99999,deficiency:k,symbol:C="",endpoint:i}=c||{},{origin:S="/"}=i?new URL(i):{};l.useEffect(()=>{const N=setInterval(()=>{j.refreshFuel()},2e3);return()=>{clearInterval(N)}},[]);const w=()=>{o(!1)};return c?e.jsxs(R,{children:[e.jsx("div",{className:"header",children:e.jsx(D,{title:s("setup.fuel.title"),onClickBack:f})}),e.jsxs(t,{className:"qr-body",children:[e.jsxs(t,{mb:6,className:"tip",children:[s("setup.fuel.tipStart").replace("slot",""),e.jsx("span",{className:"amount",children:`${p} ${C}`}),s("setup.fuel.tipEnd")]}),e.jsx(t,{fontSize:16,fontWeight:"fontWeightBold",mb:.5,children:s("setup.fuel.addressTitle")}),e.jsxs(t,{display:"flex",alignItems:"center",children:[e.jsx($,{className:"address",did:a.appDid}),e.jsx(W,{style:{lineHeight:1},target:"_blank",href:v(S,"/explorer/accounts/",a.appDid),underline:"hover",children:e.jsx(E,{className:"icon-launch"})})]}),e.jsx(t,{my:2,children:e.jsx(m,{color:"primary",onClick:()=>o(!0),disabled:!r,children:s("setup.fuel.fuelApp")})}),e.jsx(L,{popup:!0,open:g,action:"fuel",checkFn:y.get,checkTimeout:10*60*1e3,onSuccess:w,onClose:()=>o(!1),locale:x,messages:{title:s("setup.connect.title"),scan:s("setup.connect.scan"),confirm:s("setup.connect.confirm"),success:s("setup.connect.success")},extraParams:{amount:k,...h,endpoint:i}}),e.jsxs(t,{display:"flex",color:"text.secondary",children:[e.jsxs(t,{display:"flex",children:[e.jsxs(t,{children:[s("setup.fuel.need"),":"]}),e.jsx(t,{ml:.5,color:"primary.main",fontWeight:"fontWeightBold",children:p})]}),e.jsxs(t,{display:"flex",ml:3,children:[e.jsxs(t,{children:[s("setup.fuel.current"),":"]}),e.jsx(t,{ml:.5,color:r>0?"error.main":"primary.main",fontWeight:"fontWeightBold",children:b})]})]})]}),e.jsx(F,{mt:8,children:e.jsx(m,{disabled:r>0,onClick:()=>n(),children:s("setup.next")})})]}):e.jsx(t,{display:"flex",justifyContent:"center",alignItems:"center",width:"100%",children:e.jsx(P,{})})}u.propTypes={onNext:d.func,onPrevious:d.func};u.defaultProps={onNext:()=>{},onPrevious:()=>{}};const R=B(A)`
1
+ import{j as e,a3 as t,a2 as P,bp as W,E as d,aa as B}from"./vendor-mui-core-xF5F4eT7.js";import{r as l}from"./vendor-react-D-afvo_7.js";import{x as v}from"./vendor-utils-5TjOM6td.js";import{d as E}from"./Launch-BX35m3eH.js";import{a1 as I,Z as L}from"./vendor-arcblock-DZrZ_x_3.js";import{W as $}from"./did-address-D0Fo5eTl.js";import{P as D}from"./page-header-xWImGBdx.js";import{o as T,u as z}from"./index-LIf2LIyz.js";import{S as A}from"./layout-BwWrVSXk.js";import{S as F}from"./step-actions-BJ9p7QSx.js";import{S as m}from"./button-BZmMffY2.js";import"./vendor-hooks-BKxTDk_P.js";import"./content-layout-cWwRTmIc.js";function u({onNext:n,onPrevious:f}){const{locale:x,t:s}=l.useContext(I),{blocklet:a,gas:c,tokenInfo:h,actions:j}=T(),{api:y}=z(),[g,o]=l.useState(!1),{need:p="",current:b="",owe:r=99999,deficiency:k,symbol:C="",endpoint:i}=c||{},{origin:S="/"}=i?new URL(i):{};l.useEffect(()=>{const N=setInterval(()=>{j.refreshFuel()},2e3);return()=>{clearInterval(N)}},[]);const w=()=>{o(!1)};return c?e.jsxs(R,{children:[e.jsx("div",{className:"header",children:e.jsx(D,{title:s("setup.fuel.title"),onClickBack:f})}),e.jsxs(t,{className:"qr-body",children:[e.jsxs(t,{mb:6,className:"tip",children:[s("setup.fuel.tipStart").replace("slot",""),e.jsx("span",{className:"amount",children:`${p} ${C}`}),s("setup.fuel.tipEnd")]}),e.jsx(t,{fontSize:16,fontWeight:"fontWeightBold",mb:.5,children:s("setup.fuel.addressTitle")}),e.jsxs(t,{display:"flex",alignItems:"center",children:[e.jsx($,{className:"address",did:a.appDid}),e.jsx(W,{style:{lineHeight:1},target:"_blank",href:v(S,"/explorer/accounts/",a.appDid),underline:"hover",children:e.jsx(E,{className:"icon-launch"})})]}),e.jsx(t,{my:2,children:e.jsx(m,{color:"primary",onClick:()=>o(!0),disabled:!r,children:s("setup.fuel.fuelApp")})}),e.jsx(L,{popup:!0,open:g,action:"fuel",checkFn:y.get,checkTimeout:10*60*1e3,onSuccess:w,onClose:()=>o(!1),locale:x,messages:{title:s("setup.connect.title"),scan:s("setup.connect.scan"),confirm:s("setup.connect.confirm"),success:s("setup.connect.success")},extraParams:{amount:k,...h,endpoint:i}}),e.jsxs(t,{display:"flex",color:"text.secondary",children:[e.jsxs(t,{display:"flex",children:[e.jsxs(t,{children:[s("setup.fuel.need"),":"]}),e.jsx(t,{ml:.5,color:"primary.main",fontWeight:"fontWeightBold",children:p})]}),e.jsxs(t,{display:"flex",ml:3,children:[e.jsxs(t,{children:[s("setup.fuel.current"),":"]}),e.jsx(t,{ml:.5,color:r>0?"error.main":"primary.main",fontWeight:"fontWeightBold",children:b})]})]})]}),e.jsx(F,{mt:8,children:e.jsx(m,{disabled:r>0,onClick:()=>n(),children:s("setup.next")})})]}):e.jsx(t,{display:"flex",justifyContent:"center",alignItems:"center",width:"100%",children:e.jsx(P,{})})}u.propTypes={onNext:d.func,onPrevious:d.func};u.defaultProps={onNext:()=>{},onPrevious:()=>{}};const R=B(A)`
2
2
  .qr-body {
3
3
  width: 580px;
4
4
  ${n=>n.theme.breakpoints.down("md")} {
@@ -1 +1 @@
1
- import{j as e,T as x,bp as h,a3 as o,E as r}from"./vendor-mui-core-xF5F4eT7.js";import{ar as j,B as v,ae as a}from"./vendor-arcblock-oqH5gsLR.js";function w({linkProps:t,...d}){return e.jsxs(x,{...d,children:["Powered by"," ",e.jsx(h,{href:"https://www.arcblock.io",target:"_blank",underline:"hover",...t,children:"ArcBlock"}),"'s"," ",e.jsx(h,{href:"https://www.blocklet.io",target:"_blank",underline:"hover",...t,children:"Blocklet Technology"}),", the decentralized web engine."]})}const y="/.well-known/service/static/assets/login-bg-Cbfh9Uc2.png";function k({did:t,children:d,title:l,description:c,logo:n,logoSize:g,appUrl:i}){var b,f,p,m;if(!t)return d;let s;try{s=j(t)}catch{console.warn("Invalid did:",t)}const u=(globalThis==null?void 0:globalThis.blocklet)||(globalThis==null?void 0:globalThis.env)||{};return l===void 0&&(l=u.appName),c===void 0&&(c=u.appDescription),n===void 0&&(n=((b=globalThis==null?void 0:globalThis.blocklet)==null?void 0:b.appLogoRect)||((f=globalThis==null?void 0:globalThis.blocklet)==null?void 0:f.appLogo)||""),typeof n=="string"&&(n?n=e.jsx(o,{sx:{height:g,maxHeight:g,maxWidth:"50%",objectFit:"contain"},component:"img",src:n,alt:`${l}'s logo`}):n=e.jsx(v,{size:g,did:t,src:n,variant:"rounded"})),typeof i=="string"&&(i=((p=globalThis==null?void 0:globalThis.blocklet)==null?void 0:p.appUrl)||"",!i&&(globalThis!=null&&globalThis.env)&&(i=(m=globalThis==null?void 0:globalThis.env)==null?void 0:m.baseUrl)),e.jsxs(o,{sx:{width:"100vw",height:"100vh",overflowX:"auto",display:"flex",backgroundColor:a.backgroundsBgSubtile},children:[e.jsxs(o,{sx:{position:"relative",fontSize:0,flex:30,display:{xs:"none",lg:"flex"},minWidth:"400px",backgroundColor:a.surfaceBgSubtitle},children:[e.jsx(o,{sx:{position:"absolute",top:0,bottom:0,left:0,right:0,background:s?`linear-gradient(0deg, ${s} 0%, ${s} 100%), url(${y}), lightgray 50% / cover no-repeat`:`url(${y}), lightgray 50% / cover no-repeat`,backgroundPosition:"center",backgroundSize:"cover",backgroundBlendMode:s?"soft-light, normal":"unset",mask:"linear-gradient(172deg, rgba(0, 0, 0, 0.0) 24.62%, rgba(0, 0, 0, 0.80) 44.47%, #000 100%)"}}),e.jsxs(o,{sx:{display:"flex",flexDirection:"column",position:"absolute",top:0,left:0,width:"100%",p:3},children:[i?e.jsx(o,{children:e.jsx(h,{href:i,underline:"none",color:"inherit",children:n})}):n,l&&e.jsx(x,{variant:"h5",sx:{mt:3,mb:1,p:0,mx:0,fontWeight:"bold"},children:i?e.jsx(h,{href:i,underline:"none",color:"inherit",children:l}):l}),c&&e.jsx(x,{variant:"body2",sx:{m:0,p:0,color:a.foregroundsFgSubtile,fontSize:"12px",lineHeight:"20px"},children:c})]}),e.jsx(w,{linkProps:{underline:"always",color:a.textSubtitle},sx:{zIndex:10,position:"absolute",bottom:40,left:20,right:20,textAlign:"center",fontSize:"12px",color:a.textSubtitle}})]}),e.jsx(o,{sx:{display:"flex",justifyContent:"center",alignItems:"center",flex:70,maxWidth:{xs:"100%",md:"90%"},margin:"auto",height:"auto"},children:d})]})}k.propTypes={did:r.string.isRequired,children:r.any.isRequired,title:r.any,description:r.any,logo:r.any,logoSize:r.number,appUrl:r.string};k.defaultProps={title:void 0,description:void 0,logo:void 0,logoSize:40,appUrl:""};export{k as F};
1
+ import{j as e,T as x,bp as h,a3 as o,E as r}from"./vendor-mui-core-xF5F4eT7.js";import{as as j,B as v,af as a}from"./vendor-arcblock-DZrZ_x_3.js";function w({linkProps:t,...d}){return e.jsxs(x,{...d,children:["Powered by"," ",e.jsx(h,{href:"https://www.arcblock.io",target:"_blank",underline:"hover",...t,children:"ArcBlock"}),"'s"," ",e.jsx(h,{href:"https://www.blocklet.io",target:"_blank",underline:"hover",...t,children:"Blocklet Technology"}),", the decentralized web engine."]})}const y="/.well-known/service/static/assets/login-bg-Cbfh9Uc2.png";function k({did:t,children:d,title:l,description:c,logo:n,logoSize:g,appUrl:i}){var b,f,p,m;if(!t)return d;let s;try{s=j(t)}catch{console.warn("Invalid did:",t)}const u=(globalThis==null?void 0:globalThis.blocklet)||(globalThis==null?void 0:globalThis.env)||{};return l===void 0&&(l=u.appName),c===void 0&&(c=u.appDescription),n===void 0&&(n=((b=globalThis==null?void 0:globalThis.blocklet)==null?void 0:b.appLogoRect)||((f=globalThis==null?void 0:globalThis.blocklet)==null?void 0:f.appLogo)||""),typeof n=="string"&&(n?n=e.jsx(o,{sx:{height:g,maxHeight:g,maxWidth:"50%",objectFit:"contain"},component:"img",src:n,alt:`${l}'s logo`}):n=e.jsx(v,{size:g,did:t,src:n,variant:"rounded"})),typeof i=="string"&&(i=((p=globalThis==null?void 0:globalThis.blocklet)==null?void 0:p.appUrl)||"",!i&&(globalThis!=null&&globalThis.env)&&(i=(m=globalThis==null?void 0:globalThis.env)==null?void 0:m.baseUrl)),e.jsxs(o,{sx:{width:"100vw",height:"100vh",overflowX:"auto",display:"flex",backgroundColor:a.backgroundsBgSubtile},children:[e.jsxs(o,{sx:{position:"relative",fontSize:0,flex:30,display:{xs:"none",lg:"flex"},minWidth:"400px",backgroundColor:a.surfaceBgSubtitle},children:[e.jsx(o,{sx:{position:"absolute",top:0,bottom:0,left:0,right:0,background:s?`linear-gradient(0deg, ${s} 0%, ${s} 100%), url(${y}), lightgray 50% / cover no-repeat`:`url(${y}), lightgray 50% / cover no-repeat`,backgroundPosition:"center",backgroundSize:"cover",backgroundBlendMode:s?"soft-light, normal":"unset",mask:"linear-gradient(172deg, rgba(0, 0, 0, 0.0) 24.62%, rgba(0, 0, 0, 0.80) 44.47%, #000 100%)"}}),e.jsxs(o,{sx:{display:"flex",flexDirection:"column",position:"absolute",top:0,left:0,width:"100%",p:3},children:[i?e.jsx(o,{children:e.jsx(h,{href:i,underline:"none",color:"inherit",children:n})}):n,l&&e.jsx(x,{variant:"h5",sx:{mt:3,mb:1,p:0,mx:0,fontWeight:"bold"},children:i?e.jsx(h,{href:i,underline:"none",color:"inherit",children:l}):l}),c&&e.jsx(x,{variant:"body2",sx:{m:0,p:0,color:a.foregroundsFgSubtile,fontSize:"12px",lineHeight:"20px"},children:c})]}),e.jsx(w,{linkProps:{underline:"always",color:a.textSubtitle},sx:{zIndex:10,position:"absolute",bottom:40,left:20,right:20,textAlign:"center",fontSize:"12px",color:a.textSubtitle}})]}),e.jsx(o,{sx:{display:"flex",justifyContent:"center",alignItems:"center",flex:70,maxWidth:{xs:"100%",md:"90%"},margin:"auto",height:"auto"},children:d})]})}k.propTypes={did:r.string.isRequired,children:r.any.isRequired,title:r.any,description:r.any,logo:r.any,logoSize:r.number,appUrl:r.string};k.defaultProps={title:void 0,description:void 0,logo:void 0,logoSize:40,appUrl:""};export{k as F};
@@ -1 +1 @@
1
- import{aq as t,j as o}from"./vendor-arcblock-oqH5gsLR.js";function i(...e){try{return t(...e)}catch(r){throw o.error("Invalid redirect url"),console.error("Invalid redirect url",r),r}}export{i as g};
1
+ import{ar as t,j as o}from"./vendor-arcblock-DZrZ_x_3.js";function i(...e){try{return t(...e)}catch(r){throw o.error("Invalid redirect url"),console.error("Invalid redirect url",r),r}}export{i as g};
@@ -1 +1 @@
1
- import{aq as t,j as o}from"./vendor-arcblock-oqH5gsLR.js";function i(...e){try{return t(...e)}catch(r){throw o.error("Invalid redirect url"),console.error("Invalid redirect url",r),r}}export{i as g};
1
+ import{ar as t,j as o}from"./vendor-arcblock-DZrZ_x_3.js";function i(...e){try{return t(...e)}catch(r){throw o.error("Invalid redirect url"),console.error("Invalid redirect url",r),r}}export{i as g};
@@ -1 +1 @@
1
- import{j as o,ac as n}from"./vendor-mui-core-xF5F4eT7.js";import{L as r}from"./vendor-react-D-afvo_7.js";import{a1 as i,b as t}from"./vendor-arcblock-oqH5gsLR.js";import{S as e}from"./studio-BBxcN5pm.js";import"./vendor-utils-5TjOM6td.js";import"./vendor-hooks-BKxTDk_P.js";function p(){return o.jsx(e,{children:o.jsxs(n,{direction:"row",m:4,spacing:2,children:[o.jsx(i,{component:r,to:`${t.WELLKNOWN_SERVICE_PATH_PREFIX}/studio/preferences`,size:"large",color:"primary",variant:"outlined",children:"Preference Builder"}),o.jsx(i,{component:r,to:`${t.WELLKNOWN_SERVICE_PATH_PREFIX}/studio/branding`,size:"large",color:"primary",variant:"outlined",children:"Branding Images"}),o.jsx(i,{component:r,to:`${t.WELLKNOWN_SERVICE_PATH_PREFIX}/studio/localization`,size:"large",color:"primary",variant:"outlined",children:"Localization"})]})})}export{p as default};
1
+ import{j as o,ac as n}from"./vendor-mui-core-xF5F4eT7.js";import{L as r}from"./vendor-react-D-afvo_7.js";import{a2 as i,b as t}from"./vendor-arcblock-DZrZ_x_3.js";import{S as e}from"./studio-DtUwD8m6.js";import"./vendor-utils-5TjOM6td.js";import"./vendor-hooks-BKxTDk_P.js";function p(){return o.jsx(e,{children:o.jsxs(n,{direction:"row",m:4,spacing:2,children:[o.jsx(i,{component:r,to:`${t.WELLKNOWN_SERVICE_PATH_PREFIX}/studio/preferences`,size:"large",color:"primary",variant:"outlined",children:"Preference Builder"}),o.jsx(i,{component:r,to:`${t.WELLKNOWN_SERVICE_PATH_PREFIX}/studio/branding`,size:"large",color:"primary",variant:"outlined",children:"Branding Images"}),o.jsx(i,{component:r,to:`${t.WELLKNOWN_SERVICE_PATH_PREFIX}/studio/localization`,size:"large",color:"primary",variant:"outlined",children:"Localization"})]})})}export{p as default};
@@ -1 +1 @@
1
- import{b as x}from"./vendor-react-D-afvo_7.js";import{au as E}from"./vendor-arcblock-oqH5gsLR.js";const L=({url:r,allowFullScreen:o,position:a,display:u,height:i,width:c,overflow:f,styles:y,onLoad:p,onMouseOver:m,onMouseOut:b,scrolling:w,id:d,frameBorder:n,ariaHidden:O,sandbox:s,allow:j,className:g,title:h,ariaLabel:k,ariaLabelledby:I,name:P,target:v,loading:A,importance:F,referrerpolicy:M,allowpaymentrequest:S,src:$,key:q})=>{const t=E({src:$||r,target:v||null,style:{position:a||null,display:u||"initial",overflow:f||null},scrolling:w||null,allowpaymentrequest:S||null,importance:F||null,sandbox:s&&[...s].join(" ")||null,loading:A||null,styles:y||null,name:P||null,className:g||null,allowFullScreen:"allowFullScreen",referrerpolicy:M||null,title:h||null,allow:j||null,id:d||null,"aria-labelledby":I||null,"aria-hidden":O||null,"aria-label":k||null,width:c||null,height:i||null,onLoad:p||null,onMouseOver:m||null,onMouseOut:b||null,key:q||"iframe"});let l=Object.create(null);for(let e of Object.keys(t))t[e]!=null&&(l[e]=t[e]);for(let e of Object.keys(l.style))l.style[e]==null&&delete l.style[e];if(l.styles)for(let e of Object.keys(l.styles))l.styles.hasOwnProperty(e)&&(l.style[e]=l.styles[e]),Object.keys(l.styles).pop()==e&&delete l.styles;if(o)if("allow"in l){const e=l.allow.replace("fullscreen","");l.allow=`fullscreen ${e.trim()}`.trim()}else l.allow="fullscreen";return n>=0&&(l.style.hasOwnProperty("border")||(l.style.border=n)),x.createElement("iframe",Object.assign({},l))},z=L;export{z as I};
1
+ import{b as x}from"./vendor-react-D-afvo_7.js";import{av as E}from"./vendor-arcblock-DZrZ_x_3.js";const L=({url:r,allowFullScreen:o,position:a,display:i,height:u,width:c,overflow:f,styles:y,onLoad:p,onMouseOver:m,onMouseOut:b,scrolling:w,id:d,frameBorder:n,ariaHidden:O,sandbox:s,allow:j,className:g,title:h,ariaLabel:k,ariaLabelledby:v,name:I,target:P,loading:A,importance:F,referrerpolicy:M,allowpaymentrequest:S,src:$,key:q})=>{const t=E({src:$||r,target:P||null,style:{position:a||null,display:i||"initial",overflow:f||null},scrolling:w||null,allowpaymentrequest:S||null,importance:F||null,sandbox:s&&[...s].join(" ")||null,loading:A||null,styles:y||null,name:I||null,className:g||null,allowFullScreen:"allowFullScreen",referrerpolicy:M||null,title:h||null,allow:j||null,id:d||null,"aria-labelledby":v||null,"aria-hidden":O||null,"aria-label":k||null,width:c||null,height:u||null,onLoad:p||null,onMouseOver:m||null,onMouseOut:b||null,key:q||"iframe"});let l=Object.create(null);for(let e of Object.keys(t))t[e]!=null&&(l[e]=t[e]);for(let e of Object.keys(l.style))l.style[e]==null&&delete l.style[e];if(l.styles)for(let e of Object.keys(l.styles))l.styles.hasOwnProperty(e)&&(l.style[e]=l.styles[e]),Object.keys(l.styles).pop()==e&&delete l.styles;if(o)if("allow"in l){const e=l.allow.replace("fullscreen","");l.allow=`fullscreen ${e.trim()}`.trim()}else l.allow="fullscreen";return n>=0&&(l.style.hasOwnProperty("border")||(l.style.border=n)),x.createElement("iframe",Object.assign({},l))},z=L;export{z as I};
@@ -1 +1 @@
1
- import{E as T,j as K,aM as J}from"./vendor-mui-core-xF5F4eT7.js";import{x as O}from"./vendor-utils-5TjOM6td.js";import{y as ee,h as _,R as te,O as ne,T as se,D as re,U as oe}from"./index-1soveoNH.js";import{g as W,r as ae}from"./vendor-react-D-afvo_7.js";import{n as ie}from"./vendor-arcblock-oqH5gsLR.js";const S=(e,t)=>{var n;let s="?v=";return t?s+=te(t):s+=`${(n=e==null?void 0:e.meta)==null?void 0:n.version}${ne(e==null?void 0:e.status)?"~":""}`,s};function ce({blocklet:e}){var L,x,N,C,B,F,j;const{inService:t}=ee(),s=(L=((e==null?void 0:e.environments)||[]).find(m=>m.key===_.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_LOGO_SQUARE))==null?void 0:L.value,n=(x=((e==null?void 0:e.environments)||[]).find(m=>m.key===_.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_LOGO_RECT))==null?void 0:x.value,r=(N=((e==null?void 0:e.environments)||[]).find(m=>m.key===_.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_LOGO_FAVICON))==null?void 0:N.value,o=(C=((e==null?void 0:e.environments)||[]).find(m=>m.key===_.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_SPLASH_PORTRAIT))==null?void 0:C.value,i=(B=((e==null?void 0:e.environments)||[]).find(m=>m.key===_.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_SPLASH_LANDSCAPE))==null?void 0:B.value,a=(F=((e==null?void 0:e.environments)||[]).find(m=>m.key===_.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_OG_IMAGE))==null?void 0:F.value,c=((j=window.env)==null?void 0:j.apiPrefix)||"/",d=`${O(c,`/blocklet/logo/${t?"":e.meta.did}`)}${S(e,s)}`,l=`${O(c,`/blocklet/logo-rect/${t?"":e.meta.did}`)}${S(e,n??s)}`,f=`${O(c,`/blocklet/logo-favicon/${t?"":e.meta.did}`)}${S(e,r??s)}`,p=`${O(c,`/blocklet/splash/portrait/${t?"":e.meta.did}`)}${S(e,o)}`,h=`${O(c,`/blocklet/splash/landscape/${t?"":e.meta.did}`)}${S(e,i)}`,u=`${O(c,`/blocklet/og-image/${t?"":e.meta.did}`)}${S(e,a)}`;return{logoUrl:d,rectLogoUrl:l,faviconUrl:f,splashPortraitUrl:p,splashLandscapeUrl:h,ogImageUrl:u}}function V({blocklet:e,style:t,size:s,...n}){const{logoUrl:r}=ce({blocklet:e}),{variant:o}=n;return K.jsx(J,{variant:o||"square",style:Object.assign({backgroundColor:"transparent",width:s,height:s,borderRadius:10},t),...n,children:K.jsx("img",{src:r,alt:"",style:{width:s}})})}V.propTypes={blocklet:T.object.isRequired,style:T.object,size:T.oneOfType([T.number,T.string])};V.defaultProps={style:{},size:40};var le=ae;function de(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var w=de(le);function M(){return M=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var s=arguments[t];for(var n in s)Object.prototype.hasOwnProperty.call(s,n)&&(e[n]=s[n])}return e},M.apply(this,arguments)}function ue(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,A(e,t)}function A(e,t){return A=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},A(e,t)}function fe(e,t){if(e==null)return{};var s={},n=Object.keys(e),r,o;for(o=0;o<n.length;o++)r=n[o],!(t.indexOf(r)>=0)&&(s[r]=e[r]);return s}var G={position:"absolute",bottom:0,left:0,height:0,overflow:"hidden","padding-top":0,"padding-bottom":0,border:"none"},pe=["box-sizing","width","font-size","font-weight","font-family","font-style","letter-spacing","text-indent","white-space","word-break","overflow-wrap","padding-left","padding-right"];function me(e,t){if(!e||typeof e!="object")return e;var s={};return Object.keys(e).forEach(function(n){t.indexOf(n)>-1||(s[n]=e[n])}),s}var he=["component","className","unsafeHTML"];function Y(e,t){if(t!=="letters"&&t!=="words")throw new Error("Unsupported options basedOn: "+t);if(e.nodeType===Node.TEXT_NODE){var s=document.createDocumentFragment(),n;switch(t){case"words":n=e.textContent.split(/\b|(?=\W)/);break;case"letters":n=Array.from(e.textContent);break}n.forEach(function(a){s.appendChild(ge(a))}),e.parentNode.replaceChild(s,e)}else if(e.nodeType===Node.ELEMENT_NODE)for(var r=[].slice.call(e.childNodes),o=r.length,i=0;i<o;i++)Y(r[i],t)}function ge(e){var t=document.createElement("span");return t.className="LinesEllipsis-unit",t.textContent=e,t}function z(e){e.parentNode.replaceChild(document.createTextNode(e.textContent),e)}function q(e,t){if(!(!t.contains(e)||e===t)){for(;e.nextElementSibling;)e.parentNode.removeChild(e.nextElementSibling);q(e.parentNode,t)}}function Le(e){for(var t=e;t=t.parentNode;)if(/p|div|main|section|h\d|ul|ol|li/.test(t.tagName.toLowerCase()))return t}function b(e){return!!(e.offsetHeight&&(e.offsetWidth||/\S/.test(e.textContent)))}var k={component:"div",unsafeHTML:"",maxLine:1,ellipsis:"…",ellipsisHTML:void 0,className:"",basedOn:void 0,onReflow:function(){},winWidth:void 0},Ee=Object.keys(k),Q=function(e){ue(t,e);function t(n){var r;return r=e.call(this,n)||this,r.state={html:n.unsafeHTML,clamped:!1},r.canvas=null,r.maxLine=0,r.nlUnits=[],r}var s=t.prototype;return s.componentDidMount=function(){this.initCanvas(),this.reflow(this.props)},s.componentDidUpdate=function(r){r.winWidth!==this.props.winWidth&&this.copyStyleToCanvas(),this.props!==r&&this.reflow(this.props)},s.componentWillUnmount=function(){this.canvas.parentNode.removeChild(this.canvas),this.canvas=null},s.setState=function(r,o){return typeof r.clamped<"u"&&(this.clamped=r.clamped),e.prototype.setState.call(this,r,o)},s.initCanvas=function(){if(!this.canvas){var r=this.canvas=document.createElement("div");r.className="LinesEllipsis-canvas "+this.props.className,r.setAttribute("aria-hidden","true"),this.copyStyleToCanvas(),Object.keys(G).forEach(function(o){r.style[o]=G[o]}),document.body.appendChild(r)}},s.copyStyleToCanvas=function(){var r=this,o=window.getComputedStyle(this.target);pe.forEach(function(i){r.canvas.style[i]=o[i]})},s.reflow=function(r){this.maxLine=+r.maxLine||1,this.canvas.innerHTML=r.unsafeHTML;var o=r.basedOn||(/^[\x00-\x7F]+$/.test(r.unsafeHTML)?"words":"letters");Y(this.canvas,o);var i=this.putEllipsis(this.calcIndexes()),a={clamped:i,html:this.canvas.innerHTML};this.setState(a,r.onReflow.bind(this,a))},s.calcIndexes=function(){var r=[0],o=this.nlUnits=Array.from(this.canvas.querySelectorAll(".LinesEllipsis-unit")),i=o.length;if(!o.length)return r;var a=o.find(b);if(!a)return r;for(var c=1,d=a.offsetTop,l=1;l<i&&!(b(o[l])&&o[l].offsetTop-d>1&&(c++,r.push(l),d=o[l].offsetTop,c>this.maxLine));l++);return r},s.putEllipsis=function(r){if(r.length<=this.maxLine)return!1;this.nlUnits=this.nlUnits.slice(0,r[this.maxLine]);var o=this.nlUnits.pop(),i=this.makeEllipsisSpan();do q(o,this.canvas),Le(o).appendChild(i),o=this.nlUnits.pop();while(o&&(!b(o)||i.offsetHeight>o.offsetHeight||i.offsetTop>o.offsetTop));return o&&z(o),this.nlUnits.forEach(z),!0},s.makeEllipsisSpan=function(){var r=this.props,o=r.ellipsisHTML,i=r.ellipsis,a=document.createElement("span");a.appendChild(document.createElement("wbr"));var c=document.createElement("span");return c.className="LinesEllipsis-ellipsis",o?c.innerHTML=o:c.textContent=i,a.appendChild(c),a},s.isClamped=function(){return this.clamped},s.render=function(){var r=this,o=this.state,i=o.html,a=o.clamped,c=this.props,d=c.component,l=c.className,f=c.unsafeHTML,p=fe(c,he);return w.default.createElement(d,M({className:"LinesEllipsis "+(a?"LinesEllipsis--clamped":"")+" "+l,ref:function(u){return r.target=u}},me(p,Ee)),w.default.createElement("div",{dangerouslySetInnerHTML:{__html:a?i:f}}))},t}(w.default.Component);Q.defaultProps=k;var ve=Q;const qe=W(ve),{joinURL:g,withQuery:E}=se,{toTypeInfo:ye}=ie,{isEVMChain:xe,getExplorerUrl:Oe}=re,{arcChainConfig:_e}=oe,Se={ROLE_ACCOUNT:"number",ROLE_NODE:"number",ROLE_DEVICE:"number",ROLE_APPLICATION:"number",ROLE_SMART_CONTRACT:"number",ROLE_BOT:"number",ROLE_ASSET:"number",ROLE_STAKE:"number",ROLE_VALIDATOR:"number",ROLE_GROUP:"number",ROLE_TX:"number",ROLE_TETHER:"number",ROLE_SWAP:"number",ROLE_DELEGATION:"number",ROLE_VC:"number",ROLE_BLOCKLET:"number",ROLE_STORE:"number",ROLE_TOKEN:"number",ROLE_FACTORY:"number",ROLE_ROLLUP:"number",ROLE_STORAGE:"number",ROLE_PROFILE:"number",ROLE_ANY:"number"},v="https://explorer.abtnetwork.io/explorer/";var Ce=function({hash:t,asset:s,rollup:n,address:r,token:o,stake:i,chainId:a=""}){if(xe(a)){const f=Oe(a);return t?g(f,`tx/${t}`):s?g(f,`token/${s}`):g(f,`address/${r}`)}const c=_e[a],d=c==null?void 0:c.defaultRPC,l=d?`${d}`:void 0;return n&&ye(n).role===Se.ROLE_ROLLUP?t?E(g(v,`rollups/${n}/moves/${t}`),{host:l}):E(g(v,`rollups/${n}`),{host:l}):s?E(g(v,`assets/${s}`),{host:l}):t?E(g(v,`txs/${t}`),{host:l}):o?E(g(v,`tokens/${o}/tx`),{host:l}):i?E(g(v,`stakes/${i}`),{host:l}):E(g(v,`accounts/${r}`),{host:l})},Te={isSameAddr:(e,t)=>String(e).toLowerCase()===String(t).toLowerCase()};const $=Ce,{isSameAddr:y}=Te;class U{constructor({type:t,did:s,chainId:n,text:r}){this.text=r,this.did=s,this.type=t,this.chainId=n}}const D=e=>{const t=[];try{let s=0;const n=/<(.+?)\(?[tx|nft|token|stake|did|dapp|link]+[:](.+?)\)?>/gi,r=e.matchAll(n);for(const o of r){const i=/\([tx|nft|token|stake|did|dapp|link]+[:](.+?)\)/gi,a=o[0],c=o.index||s,d=c+a.length;if([...a.matchAll(i)].length>1)return[e];let f="";const p=i.exec(a);let h="";if(p){const C=p[0];f=a.replace(C,"").replace(/^</,"").replace(/(>)$/,""),h=C.replace(/\)$/,"").replace(/^\(/,"")}else h=a;const u=h.split(":"),L=(u[0]||"").replace(/^</,"").replace(/^\(/,"").toUpperCase(),x=(u[1]||"").replace(/>$/,"").replace(/\)$/,""),N=(u[u.length-1]||"").replace(/>$/,"").replace(/\)$/,"");t.push(e.substring(s,c)),t.push(new U({type:L,chainId:x,did:N,text:f||L})),s=d}return s<e.length&&t.push(e.substring(s)),t}catch(s){return console.error(s==null?void 0:s.message),[e]}},H=e=>{let t;const{type:s,chainId:n,did:r}=e;return y(s,"link")?t=`${n}:${r}`:y(s,"tx")?t=$({hash:r,chainId:n}):y(s,"stake")?t=$({stake:r,chainId:n}):y(s,"nft")?t=$({asset:r,chainId:n}):y(s,"token")?t=$({token:r,chainId:n}):y(s,"did")&&(t=$({address:r,chainId:n})),t},$e=(e,t=!0)=>D(e).map(n=>{if(n instanceof U){if(t){const r=H(n),{type:o,chainId:i,did:a}=n;return y(o,"dapp")?`<em style="font-weight:bold;" data-type="${o}" data-chain-id="${i}" data-did="${a}">${n.text}</em>`:r?`<a target="_blank" rel="noopener noreferrer" style="color:#4598fa;font-weight:bold;" href="${r}">${n.text}</a>`:`<em style="font-weight:bold;" data-type="${o}" data-chain-id="${i}" data-did="${a}">${n.text}</em>`}return n.text}return n}).join(""),Re=e=>D(e).map(s=>s instanceof U?`<${H(s)}|${s.text}>`:s.replace(/:\n/g,": ")).join("");var ke={toClickableSpan:$e,toTextList:D,toSlackLink:Re,Link:U,getLink:H};const Ne=e=>{const t="explorer.arcblockio.cn";return e&&{beta:"beta.abtnetwork.io",main:"main.abtnetwork.io"}[e]||t},Ue=e=>{try{return new URL(e).host}catch{return e}};var Qe={getChainHost:Ne,getUrlHost:Ue},Xe={linkStyle:{color:"#2754C5",fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif",fontSize:"14px",textDecoration:"underline"},actionsStyle:{margin:"20px -8px 0px"},actionStyle:{color:"#4598fa",fontSize:14,border:"1px solid #4598fa",display:"inline-block",borderRadius:"4px",margin:"8px",marginTop:"8px",marginBottom:"8px",marginLeft:"8px",marginRight:"8px"},assetStyle:{backgroundColor:"#f6f6f6",borderRadius:"8px",padding:"8px"},remarkStyle:{color:"#9397a1",fontSize:"12px",margin:0,whiteSpace:"pre-line!important"},summaryStyle:{color:"#49c3ad",fontWeight:700},titleStyle:{marginBottom:"6px"},severityColorMap:{normal:"#C4C5CA",success:"#25C99B",error:"#F16E6E",warning:"#DE9E37"},attachmentsStyle:{borderLeft:"2px solid transparent",paddingLeft:"20px"},h1Style:{color:"#333",fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif",fontSize:"24px",fontWeight:"bold",margin:"40px 0",padding:"0"},footerStyle:{color:"#898989",fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif",fontSize:"12px",lineHeight:"22px",margin:0}},we={year:{long:"year",short:"y"},day:{long:"day",short:"d"},hour:{long:"hour",short:"h"},minute:{long:"minute",short:"m"},second:{long:"second",short:"s"},millisecond:{long:"millisecond",short:"ms"},microsecond:{long:"microsecond",short:"µs"},nanosecond:{long:"nanosecond",short:"ns"}},be={year:{long:"年",short:"年"},day:{long:"天",short:"天"},hour:{long:"小时",short:"小时"},minute:{long:"分钟",short:"分"},second:{long:"秒钟",short:"秒"},millisecond:{long:"毫秒",short:"毫秒"},microsecond:{long:"微秒",short:"微秒"},nanosecond:{long:"纳秒",short:"纳秒"}};const P=new Map,Me=(e,t)=>{P.set(e,t)},Ae=(e="en_US")=>P.get(e)||P.get("en_US");var X={registerLang:Me,getLang:Ae},Pe=e=>{if(typeof e!="number")throw new TypeError("Expected a number");const t=e>0?Math.floor:Math.ceil;return{days:t(e/864e5),hours:t(e/36e5)%24,minutes:t(e/6e4)%60,seconds:t(e/1e3)%60,milliseconds:t(e)%1e3,microseconds:t(e*1e3)%1e3,nanoseconds:t(e*1e6)%1e3}};const De=Pe,{getLang:R}=X,He=(e,t)=>t===1?e:`${e}s`,Ie=1e-7;var Be=(e,t={})=>{if(!Number.isFinite(e))throw new TypeError("Expected a finite number");t.colonNotation&&(t.compact=!1,t.formatSubMilliseconds=!1,t.separateMilliseconds=!1,t.verbose=!1),t.compact&&(t.secondsDecimalDigits=0,t.millisecondsDecimalDigits=0);const s=R(t.locale),n=[],r=(a,c)=>{const d=Math.floor(a*10**c+Ie);return(Math.round(d)/10**c).toFixed(c)},o=(a,c,d)=>{if((n.length===0||!t.colonNotation)&&a===0&&!(t.colonNotation&&c==="minute"))return;const{long:l}=s[c]||R("en_US")[c],{short:f}=s[c]||R("en_US")[c];let p=(d||a||"0").toString(),h,u;if(t.colonNotation){h=n.length>0?":":"",u="";const L=p.includes(".")?p.split(".")[0].length:p.length,x=n.length>0?2:1;p="0".repeat(Math.max(0,x-L))+p}else h="",t.locale==="zh_CN"?Object.values(i).filter(L=>L>0).length>1?!i.days&&!i.hours&&i.minutes&&t.compact?u=l:u=f:i.minutes?u=l:u=f:u=t.verbose?` ${He(l,a)}`:f;n.push(h+p+u)},i=De(e);if(o(Math.trunc(i.days/365),"year"),o(i.days%365,"day"),o(i.hours,"hour"),o(i.minutes,"minute"),t.separateMilliseconds||t.formatSubMilliseconds||!t.colonNotation&&e<1e3)if(o(i.seconds,"second"),t.formatSubMilliseconds)o(i.milliseconds,"millisecond"),o(i.microseconds,"microsecond"),o(i.nanoseconds,"nanosecond");else{const a=i.milliseconds+i.microseconds/1e3+i.nanoseconds/1e6,c=typeof t.millisecondsDecimalDigits=="number"?t.millisecondsDecimalDigits:0,d=a>=1?Math.round(a):Math.ceil(a),l=c?a.toFixed(c):d;o(Number.parseFloat(l,10),"millisecond",l)}else{const a=e/1e3%60,c=typeof t.secondsDecimalDigits=="number"?t.secondsDecimalDigits:1,d=r(a,c),l=t.keepDecimalsOnWholeSeconds?d:d.replace(/\.0+$/,"");o(Number.parseFloat(l,10),"second",l)}if(n.length===0){const a=(s.millisecond||R("en_US").millisecond).long,c=(s.millisecond||R("en_US").millisecond).short;return t.locale==="zh_CN"?`0${t.verbose?`${a}`:c}`:`0${t.verbose?` ${a}s`:c}`}if(t.compact)return n[0];if(typeof t.unitCount=="number"){const a=t.colonNotation?"":" ";return n.slice(0,Math.max(t.unitCount,1)).join(a)}return t.colonNotation?n.join(""):n.join(" ")};const Fe=we,je=be,{registerLang:I}=X,Z=Be;I("en_US",Fe);I("zh_CN",je);Z.registerLang=I;var Ke=Z;const Ze=W(Ke);export{V as B,qe as H,Qe as c,Te as f,ke as h,Ze as p,Xe as s,ce as u};
1
+ import{E as T,j as K,aM as J}from"./vendor-mui-core-xF5F4eT7.js";import{x as O}from"./vendor-utils-5TjOM6td.js";import{y as ee,h as _,R as te,O as ne,T as se,D as re,U as oe}from"./index-LIf2LIyz.js";import{g as W,r as ae}from"./vendor-react-D-afvo_7.js";import{n as ie}from"./vendor-arcblock-DZrZ_x_3.js";const S=(e,t)=>{var n;let s="?v=";return t?s+=te(t):s+=`${(n=e==null?void 0:e.meta)==null?void 0:n.version}${ne(e==null?void 0:e.status)?"~":""}`,s};function ce({blocklet:e}){var L,x,N,C,B,F,j;const{inService:t}=ee(),s=(L=((e==null?void 0:e.environments)||[]).find(m=>m.key===_.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_LOGO_SQUARE))==null?void 0:L.value,n=(x=((e==null?void 0:e.environments)||[]).find(m=>m.key===_.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_LOGO_RECT))==null?void 0:x.value,r=(N=((e==null?void 0:e.environments)||[]).find(m=>m.key===_.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_LOGO_FAVICON))==null?void 0:N.value,o=(C=((e==null?void 0:e.environments)||[]).find(m=>m.key===_.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_SPLASH_PORTRAIT))==null?void 0:C.value,i=(B=((e==null?void 0:e.environments)||[]).find(m=>m.key===_.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_SPLASH_LANDSCAPE))==null?void 0:B.value,a=(F=((e==null?void 0:e.environments)||[]).find(m=>m.key===_.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_OG_IMAGE))==null?void 0:F.value,c=((j=window.env)==null?void 0:j.apiPrefix)||"/",d=`${O(c,`/blocklet/logo/${t?"":e.meta.did}`)}${S(e,s)}`,l=`${O(c,`/blocklet/logo-rect/${t?"":e.meta.did}`)}${S(e,n??s)}`,f=`${O(c,`/blocklet/logo-favicon/${t?"":e.meta.did}`)}${S(e,r??s)}`,p=`${O(c,`/blocklet/splash/portrait/${t?"":e.meta.did}`)}${S(e,o)}`,h=`${O(c,`/blocklet/splash/landscape/${t?"":e.meta.did}`)}${S(e,i)}`,u=`${O(c,`/blocklet/og-image/${t?"":e.meta.did}`)}${S(e,a)}`;return{logoUrl:d,rectLogoUrl:l,faviconUrl:f,splashPortraitUrl:p,splashLandscapeUrl:h,ogImageUrl:u}}function V({blocklet:e,style:t,size:s,...n}){const{logoUrl:r}=ce({blocklet:e}),{variant:o}=n;return K.jsx(J,{variant:o||"square",style:Object.assign({backgroundColor:"transparent",width:s,height:s,borderRadius:10},t),...n,children:K.jsx("img",{src:r,alt:"",style:{width:s}})})}V.propTypes={blocklet:T.object.isRequired,style:T.object,size:T.oneOfType([T.number,T.string])};V.defaultProps={style:{},size:40};var le=ae;function de(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var w=de(le);function M(){return M=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var s=arguments[t];for(var n in s)Object.prototype.hasOwnProperty.call(s,n)&&(e[n]=s[n])}return e},M.apply(this,arguments)}function ue(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,A(e,t)}function A(e,t){return A=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},A(e,t)}function fe(e,t){if(e==null)return{};var s={},n=Object.keys(e),r,o;for(o=0;o<n.length;o++)r=n[o],!(t.indexOf(r)>=0)&&(s[r]=e[r]);return s}var G={position:"absolute",bottom:0,left:0,height:0,overflow:"hidden","padding-top":0,"padding-bottom":0,border:"none"},pe=["box-sizing","width","font-size","font-weight","font-family","font-style","letter-spacing","text-indent","white-space","word-break","overflow-wrap","padding-left","padding-right"];function me(e,t){if(!e||typeof e!="object")return e;var s={};return Object.keys(e).forEach(function(n){t.indexOf(n)>-1||(s[n]=e[n])}),s}var he=["component","className","unsafeHTML"];function Y(e,t){if(t!=="letters"&&t!=="words")throw new Error("Unsupported options basedOn: "+t);if(e.nodeType===Node.TEXT_NODE){var s=document.createDocumentFragment(),n;switch(t){case"words":n=e.textContent.split(/\b|(?=\W)/);break;case"letters":n=Array.from(e.textContent);break}n.forEach(function(a){s.appendChild(ge(a))}),e.parentNode.replaceChild(s,e)}else if(e.nodeType===Node.ELEMENT_NODE)for(var r=[].slice.call(e.childNodes),o=r.length,i=0;i<o;i++)Y(r[i],t)}function ge(e){var t=document.createElement("span");return t.className="LinesEllipsis-unit",t.textContent=e,t}function z(e){e.parentNode.replaceChild(document.createTextNode(e.textContent),e)}function q(e,t){if(!(!t.contains(e)||e===t)){for(;e.nextElementSibling;)e.parentNode.removeChild(e.nextElementSibling);q(e.parentNode,t)}}function Le(e){for(var t=e;t=t.parentNode;)if(/p|div|main|section|h\d|ul|ol|li/.test(t.tagName.toLowerCase()))return t}function b(e){return!!(e.offsetHeight&&(e.offsetWidth||/\S/.test(e.textContent)))}var k={component:"div",unsafeHTML:"",maxLine:1,ellipsis:"…",ellipsisHTML:void 0,className:"",basedOn:void 0,onReflow:function(){},winWidth:void 0},Ee=Object.keys(k),Q=function(e){ue(t,e);function t(n){var r;return r=e.call(this,n)||this,r.state={html:n.unsafeHTML,clamped:!1},r.canvas=null,r.maxLine=0,r.nlUnits=[],r}var s=t.prototype;return s.componentDidMount=function(){this.initCanvas(),this.reflow(this.props)},s.componentDidUpdate=function(r){r.winWidth!==this.props.winWidth&&this.copyStyleToCanvas(),this.props!==r&&this.reflow(this.props)},s.componentWillUnmount=function(){this.canvas.parentNode.removeChild(this.canvas),this.canvas=null},s.setState=function(r,o){return typeof r.clamped<"u"&&(this.clamped=r.clamped),e.prototype.setState.call(this,r,o)},s.initCanvas=function(){if(!this.canvas){var r=this.canvas=document.createElement("div");r.className="LinesEllipsis-canvas "+this.props.className,r.setAttribute("aria-hidden","true"),this.copyStyleToCanvas(),Object.keys(G).forEach(function(o){r.style[o]=G[o]}),document.body.appendChild(r)}},s.copyStyleToCanvas=function(){var r=this,o=window.getComputedStyle(this.target);pe.forEach(function(i){r.canvas.style[i]=o[i]})},s.reflow=function(r){this.maxLine=+r.maxLine||1,this.canvas.innerHTML=r.unsafeHTML;var o=r.basedOn||(/^[\x00-\x7F]+$/.test(r.unsafeHTML)?"words":"letters");Y(this.canvas,o);var i=this.putEllipsis(this.calcIndexes()),a={clamped:i,html:this.canvas.innerHTML};this.setState(a,r.onReflow.bind(this,a))},s.calcIndexes=function(){var r=[0],o=this.nlUnits=Array.from(this.canvas.querySelectorAll(".LinesEllipsis-unit")),i=o.length;if(!o.length)return r;var a=o.find(b);if(!a)return r;for(var c=1,d=a.offsetTop,l=1;l<i&&!(b(o[l])&&o[l].offsetTop-d>1&&(c++,r.push(l),d=o[l].offsetTop,c>this.maxLine));l++);return r},s.putEllipsis=function(r){if(r.length<=this.maxLine)return!1;this.nlUnits=this.nlUnits.slice(0,r[this.maxLine]);var o=this.nlUnits.pop(),i=this.makeEllipsisSpan();do q(o,this.canvas),Le(o).appendChild(i),o=this.nlUnits.pop();while(o&&(!b(o)||i.offsetHeight>o.offsetHeight||i.offsetTop>o.offsetTop));return o&&z(o),this.nlUnits.forEach(z),!0},s.makeEllipsisSpan=function(){var r=this.props,o=r.ellipsisHTML,i=r.ellipsis,a=document.createElement("span");a.appendChild(document.createElement("wbr"));var c=document.createElement("span");return c.className="LinesEllipsis-ellipsis",o?c.innerHTML=o:c.textContent=i,a.appendChild(c),a},s.isClamped=function(){return this.clamped},s.render=function(){var r=this,o=this.state,i=o.html,a=o.clamped,c=this.props,d=c.component,l=c.className,f=c.unsafeHTML,p=fe(c,he);return w.default.createElement(d,M({className:"LinesEllipsis "+(a?"LinesEllipsis--clamped":"")+" "+l,ref:function(u){return r.target=u}},me(p,Ee)),w.default.createElement("div",{dangerouslySetInnerHTML:{__html:a?i:f}}))},t}(w.default.Component);Q.defaultProps=k;var ve=Q;const qe=W(ve),{joinURL:g,withQuery:E}=se,{toTypeInfo:ye}=ie,{isEVMChain:xe,getExplorerUrl:Oe}=re,{arcChainConfig:_e}=oe,Se={ROLE_ACCOUNT:"number",ROLE_NODE:"number",ROLE_DEVICE:"number",ROLE_APPLICATION:"number",ROLE_SMART_CONTRACT:"number",ROLE_BOT:"number",ROLE_ASSET:"number",ROLE_STAKE:"number",ROLE_VALIDATOR:"number",ROLE_GROUP:"number",ROLE_TX:"number",ROLE_TETHER:"number",ROLE_SWAP:"number",ROLE_DELEGATION:"number",ROLE_VC:"number",ROLE_BLOCKLET:"number",ROLE_STORE:"number",ROLE_TOKEN:"number",ROLE_FACTORY:"number",ROLE_ROLLUP:"number",ROLE_STORAGE:"number",ROLE_PROFILE:"number",ROLE_ANY:"number"},v="https://explorer.abtnetwork.io/explorer/";var Ce=function({hash:t,asset:s,rollup:n,address:r,token:o,stake:i,chainId:a=""}){if(xe(a)){const f=Oe(a);return t?g(f,`tx/${t}`):s?g(f,`token/${s}`):g(f,`address/${r}`)}const c=_e[a],d=c==null?void 0:c.defaultRPC,l=d?`${d}`:void 0;return n&&ye(n).role===Se.ROLE_ROLLUP?t?E(g(v,`rollups/${n}/moves/${t}`),{host:l}):E(g(v,`rollups/${n}`),{host:l}):s?E(g(v,`assets/${s}`),{host:l}):t?E(g(v,`txs/${t}`),{host:l}):o?E(g(v,`tokens/${o}/tx`),{host:l}):i?E(g(v,`stakes/${i}`),{host:l}):E(g(v,`accounts/${r}`),{host:l})},Te={isSameAddr:(e,t)=>String(e).toLowerCase()===String(t).toLowerCase()};const $=Ce,{isSameAddr:y}=Te;class U{constructor({type:t,did:s,chainId:n,text:r}){this.text=r,this.did=s,this.type=t,this.chainId=n}}const D=e=>{const t=[];try{let s=0;const n=/<(.+?)\(?[tx|nft|token|stake|did|dapp|link]+[:](.+?)\)?>/gi,r=e.matchAll(n);for(const o of r){const i=/\([tx|nft|token|stake|did|dapp|link]+[:](.+?)\)/gi,a=o[0],c=o.index||s,d=c+a.length;if([...a.matchAll(i)].length>1)return[e];let f="";const p=i.exec(a);let h="";if(p){const C=p[0];f=a.replace(C,"").replace(/^</,"").replace(/(>)$/,""),h=C.replace(/\)$/,"").replace(/^\(/,"")}else h=a;const u=h.split(":"),L=(u[0]||"").replace(/^</,"").replace(/^\(/,"").toUpperCase(),x=(u[1]||"").replace(/>$/,"").replace(/\)$/,""),N=(u[u.length-1]||"").replace(/>$/,"").replace(/\)$/,"");t.push(e.substring(s,c)),t.push(new U({type:L,chainId:x,did:N,text:f||L})),s=d}return s<e.length&&t.push(e.substring(s)),t}catch(s){return console.error(s==null?void 0:s.message),[e]}},H=e=>{let t;const{type:s,chainId:n,did:r}=e;return y(s,"link")?t=`${n}:${r}`:y(s,"tx")?t=$({hash:r,chainId:n}):y(s,"stake")?t=$({stake:r,chainId:n}):y(s,"nft")?t=$({asset:r,chainId:n}):y(s,"token")?t=$({token:r,chainId:n}):y(s,"did")&&(t=$({address:r,chainId:n})),t},$e=(e,t=!0)=>D(e).map(n=>{if(n instanceof U){if(t){const r=H(n),{type:o,chainId:i,did:a}=n;return y(o,"dapp")?`<em style="font-weight:bold;" data-type="${o}" data-chain-id="${i}" data-did="${a}">${n.text}</em>`:r?`<a target="_blank" rel="noopener noreferrer" style="color:#4598fa;font-weight:bold;" href="${r}">${n.text}</a>`:`<em style="font-weight:bold;" data-type="${o}" data-chain-id="${i}" data-did="${a}">${n.text}</em>`}return n.text}return n}).join(""),Re=e=>D(e).map(s=>s instanceof U?`<${H(s)}|${s.text}>`:s.replace(/:\n/g,": ")).join("");var ke={toClickableSpan:$e,toTextList:D,toSlackLink:Re,Link:U,getLink:H};const Ne=e=>{const t="explorer.arcblockio.cn";return e&&{beta:"beta.abtnetwork.io",main:"main.abtnetwork.io"}[e]||t},Ue=e=>{try{return new URL(e).host}catch{return e}};var Qe={getChainHost:Ne,getUrlHost:Ue},Xe={linkStyle:{color:"#2754C5",fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif",fontSize:"14px",textDecoration:"underline"},actionsStyle:{margin:"20px -8px 0px"},actionStyle:{color:"#4598fa",fontSize:14,border:"1px solid #4598fa",display:"inline-block",borderRadius:"4px",margin:"8px",marginTop:"8px",marginBottom:"8px",marginLeft:"8px",marginRight:"8px"},assetStyle:{backgroundColor:"#f6f6f6",borderRadius:"8px",padding:"8px"},remarkStyle:{color:"#9397a1",fontSize:"12px",margin:0,whiteSpace:"pre-line!important"},summaryStyle:{color:"#49c3ad",fontWeight:700},titleStyle:{marginBottom:"6px"},severityColorMap:{normal:"#C4C5CA",success:"#25C99B",error:"#F16E6E",warning:"#DE9E37"},attachmentsStyle:{borderLeft:"2px solid transparent",paddingLeft:"20px"},h1Style:{color:"#333",fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif",fontSize:"24px",fontWeight:"bold",margin:"40px 0",padding:"0"},footerStyle:{color:"#898989",fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif",fontSize:"12px",lineHeight:"22px",margin:0}},we={year:{long:"year",short:"y"},day:{long:"day",short:"d"},hour:{long:"hour",short:"h"},minute:{long:"minute",short:"m"},second:{long:"second",short:"s"},millisecond:{long:"millisecond",short:"ms"},microsecond:{long:"microsecond",short:"µs"},nanosecond:{long:"nanosecond",short:"ns"}},be={year:{long:"年",short:"年"},day:{long:"天",short:"天"},hour:{long:"小时",short:"小时"},minute:{long:"分钟",short:"分"},second:{long:"秒钟",short:"秒"},millisecond:{long:"毫秒",short:"毫秒"},microsecond:{long:"微秒",short:"微秒"},nanosecond:{long:"纳秒",short:"纳秒"}};const P=new Map,Me=(e,t)=>{P.set(e,t)},Ae=(e="en_US")=>P.get(e)||P.get("en_US");var X={registerLang:Me,getLang:Ae},Pe=e=>{if(typeof e!="number")throw new TypeError("Expected a number");const t=e>0?Math.floor:Math.ceil;return{days:t(e/864e5),hours:t(e/36e5)%24,minutes:t(e/6e4)%60,seconds:t(e/1e3)%60,milliseconds:t(e)%1e3,microseconds:t(e*1e3)%1e3,nanoseconds:t(e*1e6)%1e3}};const De=Pe,{getLang:R}=X,He=(e,t)=>t===1?e:`${e}s`,Ie=1e-7;var Be=(e,t={})=>{if(!Number.isFinite(e))throw new TypeError("Expected a finite number");t.colonNotation&&(t.compact=!1,t.formatSubMilliseconds=!1,t.separateMilliseconds=!1,t.verbose=!1),t.compact&&(t.secondsDecimalDigits=0,t.millisecondsDecimalDigits=0);const s=R(t.locale),n=[],r=(a,c)=>{const d=Math.floor(a*10**c+Ie);return(Math.round(d)/10**c).toFixed(c)},o=(a,c,d)=>{if((n.length===0||!t.colonNotation)&&a===0&&!(t.colonNotation&&c==="minute"))return;const{long:l}=s[c]||R("en_US")[c],{short:f}=s[c]||R("en_US")[c];let p=(d||a||"0").toString(),h,u;if(t.colonNotation){h=n.length>0?":":"",u="";const L=p.includes(".")?p.split(".")[0].length:p.length,x=n.length>0?2:1;p="0".repeat(Math.max(0,x-L))+p}else h="",t.locale==="zh_CN"?Object.values(i).filter(L=>L>0).length>1?!i.days&&!i.hours&&i.minutes&&t.compact?u=l:u=f:i.minutes?u=l:u=f:u=t.verbose?` ${He(l,a)}`:f;n.push(h+p+u)},i=De(e);if(o(Math.trunc(i.days/365),"year"),o(i.days%365,"day"),o(i.hours,"hour"),o(i.minutes,"minute"),t.separateMilliseconds||t.formatSubMilliseconds||!t.colonNotation&&e<1e3)if(o(i.seconds,"second"),t.formatSubMilliseconds)o(i.milliseconds,"millisecond"),o(i.microseconds,"microsecond"),o(i.nanoseconds,"nanosecond");else{const a=i.milliseconds+i.microseconds/1e3+i.nanoseconds/1e6,c=typeof t.millisecondsDecimalDigits=="number"?t.millisecondsDecimalDigits:0,d=a>=1?Math.round(a):Math.ceil(a),l=c?a.toFixed(c):d;o(Number.parseFloat(l,10),"millisecond",l)}else{const a=e/1e3%60,c=typeof t.secondsDecimalDigits=="number"?t.secondsDecimalDigits:1,d=r(a,c),l=t.keepDecimalsOnWholeSeconds?d:d.replace(/\.0+$/,"");o(Number.parseFloat(l,10),"second",l)}if(n.length===0){const a=(s.millisecond||R("en_US").millisecond).long,c=(s.millisecond||R("en_US").millisecond).short;return t.locale==="zh_CN"?`0${t.verbose?`${a}`:c}`:`0${t.verbose?` ${a}s`:c}`}if(t.compact)return n[0];if(typeof t.unitCount=="number"){const a=t.colonNotation?"":" ";return n.slice(0,Math.max(t.unitCount,1)).join(a)}return t.colonNotation?n.join(""):n.join(" ")};const Fe=we,je=be,{registerLang:I}=X,Z=Be;I("en_US",Fe);I("zh_CN",je);Z.registerLang=I;var Ke=Z;const Ze=W(Ke);export{V as B,qe as H,Qe as c,Te as f,ke as h,Ze as p,Xe as s,ce as u};
@@ -1,4 +1,4 @@
1
- import{g as w}from"./vendor-react-D-afvo_7.js";import{ae as b}from"./index-1soveoNH.js";var x=(n,t=1,e)=>{if(e={indent:" ",includeEmptyLines:!1,...e},typeof n!="string")throw new TypeError(`Expected \`input\` to be a \`string\`, got \`${typeof n}\``);if(typeof t!="number")throw new TypeError(`Expected \`count\` to be a \`number\`, got \`${typeof t}\``);if(typeof e.indent!="string")throw new TypeError(`Expected \`options.indent\` to be a \`string\`, got \`${typeof e.indent}\``);if(t===0)return n;const r=e.includeEmptyLines?/^/gm:/^(?!\s*$)/gm;return n.replace(r,e.indent.repeat(t))};const m=b,E=/\s+at.*(?:\(|\s)(.*)\)?/,$=/^(?:(?:(?:node|(?:internal\/[\w/]*|.*node_modules\/(?:babel-polyfill|pirates)\/.*)?\w+)\.js:\d+:\d+)|native)/,j=typeof m.homedir>"u"?"":m.homedir();var v=(n,t)=>(t=Object.assign({pretty:!1},t),n.replace(/\\/g,"/").split(`
1
+ import{g as w}from"./vendor-react-D-afvo_7.js";import{ae as b}from"./index-LIf2LIyz.js";var x=(n,t=1,e)=>{if(e={indent:" ",includeEmptyLines:!1,...e},typeof n!="string")throw new TypeError(`Expected \`input\` to be a \`string\`, got \`${typeof n}\``);if(typeof t!="number")throw new TypeError(`Expected \`count\` to be a \`number\`, got \`${typeof t}\``);if(typeof e.indent!="string")throw new TypeError(`Expected \`options.indent\` to be a \`string\`, got \`${typeof e.indent}\``);if(t===0)return n;const r=e.includeEmptyLines?/^/gm:/^(?!\s*$)/gm;return n.replace(r,e.indent.repeat(t))};const m=b,E=/\s+at.*(?:\(|\s)(.*)\)?/,$=/^(?:(?:(?:node|(?:internal\/[\w/]*|.*node_modules\/(?:babel-polyfill|pirates)\/.*)?\w+)\.js:\d+:\d+)|native)/,j=typeof m.homedir>"u"?"":m.homedir();var v=(n,t)=>(t=Object.assign({pretty:!1},t),n.replace(/\\/g,"/").split(`
2
2
  `).filter(e=>{const r=e.match(E);if(r===null||!r[1])return!0;const a=r[1];return a.includes(".app/Contents/Resources/electron.asar")||a.includes(".app/Contents/Resources/default_app.asar")?!1:!$.test(a)}).filter(e=>e.trim()!=="").map(e=>t.pretty?e.replace(E,(r,a)=>r.replace(a,a.replace(j,"~"))):e).join(`
3
3
  `));const A=x,S=v,I=n=>n.replace(/\s+at .*aggregate-error\/index.js:\d+:\d+\)?/g,"");let k=class extends Error{constructor(t){if(!Array.isArray(t))throw new TypeError(`Expected input to be an Array, got ${typeof t}`);t=[...t].map(r=>r instanceof Error?r:r!==null&&typeof r=="object"?Object.assign(new Error(r.message),r):new Error(r));let e=t.map(r=>typeof r.stack=="string"?I(S(r.stack)):String(r)).join(`
4
4
  `);e=`
@@ -1 +1 @@
1
- import{j as t,aa as r}from"./vendor-mui-core-xF5F4eT7.js";import{r as s}from"./vendor-react-D-afvo_7.js";import{a0 as a,R as e}from"./vendor-arcblock-oqH5gsLR.js";import"./vendor-utils-5TjOM6td.js";import"./vendor-hooks-BKxTDk_P.js";function u(){const{t:o}=s.useContext(a);return t.jsx(n,{style:{paddingTop:"25vh"},children:t.jsx(e,{status:"404",description:o("noMatch.desc"),style:{backgroundColor:"transparent"}})})}const n=r.main``;export{u as default};
1
+ import{j as t,aa as r}from"./vendor-mui-core-xF5F4eT7.js";import{r as s}from"./vendor-react-D-afvo_7.js";import{a1 as a,R as e}from"./vendor-arcblock-DZrZ_x_3.js";import"./vendor-utils-5TjOM6td.js";import"./vendor-hooks-BKxTDk_P.js";function u(){const{t:o}=s.useContext(a);return t.jsx(n,{style:{paddingTop:"25vh"},children:t.jsx(e,{status:"404",description:o("noMatch.desc"),style:{backgroundColor:"transparent"}})})}const n=r.main``;export{u as default};
@@ -1,4 +1,4 @@
1
- import{r as d}from"./vendor-react-D-afvo_7.js";import{E as l,j as n,a3 as g,aj as A,M as G,I as L,a2 as H,bS as U,aa as Y}from"./vendor-mui-core-xF5F4eT7.js";import{a0 as J,w as Q,ad as Z}from"./vendor-arcblock-oqH5gsLR.js";import{d as v}from"./Done-DVvDyJtD.js";import{C as ee}from"./Google-C5Apqxhw.js";import{aa as te,f as ne}from"./index-1soveoNH.js";import{R as re,F as oe,L as se}from"./logo-uploader-BeSpYnSl.js";const S={description:l.string,editing:l.bool,onChange:l.func,required:l.bool,value:l.any,componentProps:l.object,render:l.func,renderFormItem:l.func};function N({editing:r,value:o,onChange:a}){const[c,u]=d.useState(!1),m=d.useRef(),p=d.useRef(o);d.useEffect(()=>{let s=null;return r&&(s=setTimeout(()=>{u(!0)},50)),()=>{clearTimeout(s)}},[r]);const k=s=>{p.current=s,a(s)},b=()=>{u(!1),a(p.current)},I=n.jsx(g,{className:"form-item-input slot",px:1,children:n.jsxs(g,{display:"flex",alignItems:"center",children:[o,o!=="auto"&&n.jsx("div",{style:{marginLeft:4,backgroundColor:o,width:"1em",height:"1em",borderRadius:"0.2em"}})]})}),f=n.jsxs(g,{display:"flex",flexGrow:1,alignItems:"center",height:"40px",onKeyDown:b,children:[n.jsx(g,{display:"flex",alignItems:"center",onClick:()=>u(!0),children:n.jsx("div",{ref:m,style:{flexShrink:0,marginLeft:"8px",backgroundColor:o,width:"32px",height:"32px",boxSizing:"border-box",borderRadius:"8px",border:"1px solid #eee",cursor:o==="auto"?"default":"pointer"}})}),n.jsx(A,{open:c,anchorEl:m.current,onClose:()=>u(!1),anchorOrigin:{vertical:"bottom",horizontal:"center"},transformOrigin:{vertical:"top",horizontal:"center"},children:n.jsx(ee,{color:o,onChange:s=>k(s.hex)})})]});return r?f:I}N.propTypes=S;function _({editing:r,description:o,value:a,onChange:c,componentProps:u,...m}){const{placeholder:p}=u,k=d.useRef(a),{t:b}=d.useContext(J),I=s=>{s.key==="Enter"&&c(k.current,"confirm")},f=s=>{k.current=s,c(s)};return r?n.jsx(G,{style:{flex:1},fullWidth:!0,value:a,onChange:s=>{s.persist(),f(s.target.value)},autoFocus:!0,size:"small",variant:"outlined",placeholder:o||p,onKeyDown:I,...m}):n.jsx(g,{px:1,className:"form-item-input slot",children:a||n.jsx("span",{className:"placeholder",children:b("common.requiredInputPlaceholder",{name:o||p})})})}_.propTypes=S;_.defaultProps={componentProps:{}};function T({editing:r,value:o,onChange:a,componentProps:c,...u}){const{blocklet:m}=c,p=o==="auto"?Q.getPassportColorFromDid(m.appDid):o;return n.jsxs(g,{display:"flex",alignItems:"center",children:[n.jsx("div",{style:{width:96,marginRight:12},dangerouslySetInnerHTML:{__html:te({title:"Owner",issuer:ne.getDisplayName(m),issuerDid:m.appDid,ownerName:"Your Name",ownerDid:m.appDid,preferredColor:o||"auto"})}}),n.jsx(N,{...u,editing:r,value:r?p:o,onChange:a,componentProps:c})]})}T.propTypes={...S,componentProps:l.shape({blocklet:l.object.isRequired}).isRequired};T.defaultProps={};const ie=U`
1
+ import{r as d}from"./vendor-react-D-afvo_7.js";import{E as l,j as n,a3 as g,aj as A,M as G,I as L,a2 as H,bS as U,aa as Y}from"./vendor-mui-core-xF5F4eT7.js";import{a1 as J,w as Q,ae as Z}from"./vendor-arcblock-DZrZ_x_3.js";import{d as v}from"./Done-DJfjmlFC.js";import{C as ee}from"./Google-DTKsjoGP.js";import{aa as te,f as ne}from"./index-LIf2LIyz.js";import{R as re,F as oe,L as se}from"./logo-uploader-DbSGPbXh.js";const S={description:l.string,editing:l.bool,onChange:l.func,required:l.bool,value:l.any,componentProps:l.object,render:l.func,renderFormItem:l.func};function N({editing:r,value:o,onChange:a}){const[c,u]=d.useState(!1),m=d.useRef(),p=d.useRef(o);d.useEffect(()=>{let s=null;return r&&(s=setTimeout(()=>{u(!0)},50)),()=>{clearTimeout(s)}},[r]);const k=s=>{p.current=s,a(s)},b=()=>{u(!1),a(p.current)},I=n.jsx(g,{className:"form-item-input slot",px:1,children:n.jsxs(g,{display:"flex",alignItems:"center",children:[o,o!=="auto"&&n.jsx("div",{style:{marginLeft:4,backgroundColor:o,width:"1em",height:"1em",borderRadius:"0.2em"}})]})}),f=n.jsxs(g,{display:"flex",flexGrow:1,alignItems:"center",height:"40px",onKeyDown:b,children:[n.jsx(g,{display:"flex",alignItems:"center",onClick:()=>u(!0),children:n.jsx("div",{ref:m,style:{flexShrink:0,marginLeft:"8px",backgroundColor:o,width:"32px",height:"32px",boxSizing:"border-box",borderRadius:"8px",border:"1px solid #eee",cursor:o==="auto"?"default":"pointer"}})}),n.jsx(A,{open:c,anchorEl:m.current,onClose:()=>u(!1),anchorOrigin:{vertical:"bottom",horizontal:"center"},transformOrigin:{vertical:"top",horizontal:"center"},children:n.jsx(ee,{color:o,onChange:s=>k(s.hex)})})]});return r?f:I}N.propTypes=S;function _({editing:r,description:o,value:a,onChange:c,componentProps:u,...m}){const{placeholder:p}=u,k=d.useRef(a),{t:b}=d.useContext(J),I=s=>{s.key==="Enter"&&c(k.current,"confirm")},f=s=>{k.current=s,c(s)};return r?n.jsx(G,{style:{flex:1},fullWidth:!0,value:a,onChange:s=>{s.persist(),f(s.target.value)},autoFocus:!0,size:"small",variant:"outlined",placeholder:o||p,onKeyDown:I,...m}):n.jsx(g,{px:1,className:"form-item-input slot",children:a||n.jsx("span",{className:"placeholder",children:b("common.requiredInputPlaceholder",{name:o||p})})})}_.propTypes=S;_.defaultProps={componentProps:{}};function T({editing:r,value:o,onChange:a,componentProps:c,...u}){const{blocklet:m}=c,p=o==="auto"?Q.getPassportColorFromDid(m.appDid):o;return n.jsxs(g,{display:"flex",alignItems:"center",children:[n.jsx("div",{style:{width:96,marginRight:12},dangerouslySetInnerHTML:{__html:te({title:"Owner",issuer:ne.getDisplayName(m),issuerDid:m.appDid,ownerName:"Your Name",ownerDid:m.appDid,preferredColor:o||"auto"})}}),n.jsx(N,{...u,editing:r,value:r?p:o,onChange:a,componentProps:c})]})}T.propTypes={...S,componentProps:l.shape({blocklet:l.object.isRequired}).isRequired};T.defaultProps={};const ie=U`
2
2
  0%, 100% {
3
3
  transform: scale(1) translateX(0);
4
4
  }