@abtnode/blocklet-services 1.16.44-beta-20250529-004636-15e80e20 → 1.16.44-beta-20250529-223630-10e16ac8
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.
- package/dist/assets/{access-control-eEjmzQYf.js → access-control-BhxOcGdx.js} +1 -1
- package/dist/assets/{add-component-core-pJP41zEE.js → add-component-core-XUReAzat.js} +1 -1
- package/dist/assets/{add-resource-CZeL421l.js → add-resource-C3kDcfBw.js} +1 -1
- package/dist/assets/{advanced-P0pT0XgG.js → advanced-hz-KSWn2.js} +1 -1
- package/dist/assets/{appearance-DeIbdwlo.js → appearance-ChvtVBNv.js} +1 -1
- package/dist/assets/{audit-logs-DdN0-QQr.js → audit-logs-DXoc97BV.js} +1 -1
- package/dist/assets/{authorize-C_rSdM9R.js → authorize-_fbQ19S4.js} +1 -1
- package/dist/assets/{branding-C6umqmKR.js → branding-DpkSF6dd.js} +2 -2
- package/dist/assets/{branding-HedBd6t0.js → branding-DuPWVNlC.js} +1 -1
- package/dist/assets/{bundle-avatar-B9he3Bf1.js → bundle-avatar-D4fwror8.js} +1 -1
- package/dist/assets/{complete-D7dveRTo.js → complete-C5D4D-fJ.js} +1 -1
- package/dist/assets/{component-cssFwqtY.js → component-CURpjZJ2.js} +1 -1
- package/dist/assets/{config-eQ2Et0RC.js → config-e36Xplpo.js} +1 -1
- package/dist/assets/config-navigation-BvjYZI_j.js +26 -0
- package/dist/assets/{config-space-CQ7Atb1l.js → config-space-EoSm62Er.js} +1 -1
- package/dist/assets/{confirm-Tue92P8p.js → confirm-Vzr2I9eM.js} +1 -1
- package/dist/assets/{connect-Cm-sTMiW.js → connect-B5Xr7MId.js} +1 -1
- package/dist/assets/{connect-PdQoyrqe.js → connect-DXOsnqkO.js} +1 -1
- package/dist/assets/{connect-to-FvVJBIsZ.js → connect-to-Bz9wYM04.js} +1 -1
- package/dist/assets/{dashboard-BhR1WNzF.js → dashboard-xUr1SbPS.js} +3 -3
- package/dist/assets/{delete-confirm-CHnQ2leb.js → delete-confirm-DNn4Os6R.js} +1 -1
- package/dist/assets/{domain-FY9-unAU.js → domain-XXgOrJDa.js} +1 -1
- package/dist/assets/{domain-action-card-Jvzi8kyL.js → domain-action-card-Cf1AoKOi.js} +1 -1
- package/dist/assets/{domains-CiBZW8yk.js → domains-DeFj6Ipl.js} +1 -1
- package/dist/assets/{email-z4l1k3Mi.js → email-BIVfXnpk.js} +1 -1
- package/dist/assets/{exchange-passport-DSoEjAA_.js → exchange-passport-C9Pvr9Da.js} +1 -1
- package/dist/assets/{fuel-CzrPInoR.js → fuel-Cs--pEYt.js} +1 -1
- package/dist/assets/{gen-access-key-BU2nGVgA.js → gen-access-key-CIzULsBE.js} +1 -1
- package/dist/assets/{index-D0F0qx_R.js → index-B7IOoVDF.js} +1 -1
- package/dist/assets/{index-C1XrZATd.js → index-BCJADuMw.js} +5 -5
- package/dist/assets/{index-NQMMaHuW.js → index-BU2FTGFr.js} +1 -1
- package/dist/assets/{index-C3le1atN.js → index-BoTgqYtV.js} +1 -1
- package/dist/assets/{index-5EytSaVA.js → index-C64IgZKt.js} +1 -1
- package/dist/assets/{index-D2a97Hdb.js → index-CsXmgylH.js} +3 -3
- package/dist/assets/{index-DutfRO7F.js → index-D-Lxloq5.js} +1 -1
- package/dist/assets/{index-P2m0RlAs.js → index-DBqLPDUh.js} +1 -1
- package/dist/assets/index-DDXNOodN.js +99 -0
- package/dist/assets/{index-B_NDUfon.js → index-DDoVX3je.js} +2 -2
- package/dist/assets/{index-hkk3GUEf.js → index-Drd9jydY.js} +1 -1
- package/dist/assets/{index-klBzz5vO.js → index-Dsd9SXVN.js} +1 -1
- package/dist/assets/index-DvBh35bh.js +1 -0
- package/dist/assets/{index-DrHUHp5S.js → index-U3mAyHwS.js} +1 -1
- package/dist/assets/{index-m831cH-_.js → index-W_fQ-nuf.js} +1 -1
- package/dist/assets/{index-ChHy6AQ7.js → index-wLX5GW2c.js} +1 -1
- package/dist/assets/{invitation-CGjIZ62g.js → invitation-Dsnc8lab.js} +1 -1
- package/dist/assets/{invite-CS_4jRwt.js → invite-CvAru4rZ.js} +1 -1
- package/dist/assets/{issue-passport-B6-OzJX7.js → issue-passport-CDE6vHUE.js} +1 -1
- package/dist/assets/{item-CuLwkmbx.js → item-rXnALS3b.js} +1 -1
- package/dist/assets/{layout-CNC_rrzE.js → layout-DYG0Wl7R.js} +1 -1
- package/dist/assets/{list-BTBbj1K4.js → list-DLMy1vVs.js} +1 -1
- package/dist/assets/list-b96sX5Y6.js +2 -0
- package/dist/assets/{log-29oTWiWO.js → log-Bwqh69bM.js} +1 -1
- package/dist/assets/{login-C52vMwpY.js → login-Ygmj8_J7.js} +1 -1
- package/dist/assets/{logo-uploader-Cir_HrSm.js → logo-uploader-CLwbDhA_.js} +2 -2
- package/dist/assets/{lost-passport-C2-kDXqq.js → lost-passport-CqzPSoLw.js} +1 -1
- package/dist/assets/{overview-BKOb0zVP.js → overview-DqabCKYi.js} +1 -1
- package/dist/assets/{passport-item-OEfv-Vh7.js → passport-item-C5-ZuTPM.js} +1 -1
- package/dist/assets/{publish-resource-DayX-x8-.js → publish-resource-ebKgw7OW.js} +1 -1
- package/dist/assets/{runtime-BbgMhX7n.js → runtime-B454s6Gb.js} +1 -1
- package/dist/assets/{security-DFHcsUZl.js → security-DCArL_za.js} +1 -1
- package/dist/assets/{setup-Do62jucF.js → setup-CX2pUl2y.js} +3 -3
- package/dist/assets/{start-B8F850CZ.js → start-Dhbx5j_D.js} +1 -1
- package/dist/assets/{status-D5JgbTyM.js → status-D4K-kiXO.js} +1 -1
- package/dist/assets/{step-actions-1pM57149.js → step-actions-CISMVGx2.js} +1 -1
- package/dist/assets/{traffic-Dvs1P0Re.js → traffic-BqHyn9L9.js} +1 -1
- package/dist/assets/{transfer-bax-fMxe.js → transfer-Bqv1gMqL.js} +1 -1
- package/dist/assets/{unsubscribe-DwUfpwja.js → unsubscribe-B3OLQIVA.js} +1 -1
- package/dist/assets/{use-blocklet-logo-BZU9LLmz.js → use-blocklet-logo-Bhkp-Zm7.js} +1 -1
- package/dist/assets/{user-center-DQ_Kc4sL.js → user-center-vIx28YXm.js} +1 -1
- package/dist/assets/{util-BiCOL9ao.js → util-Dnkhck-D.js} +1 -1
- package/dist/assets/{wrap-locale-0GIFYj8p.js → wrap-locale-C_UOH97U.js} +1 -1
- package/dist/index.html +1 -1
- package/dist/service-worker.js +1 -1
- package/package.json +21 -21
- package/dist/assets/config-navigation-0pU9J0da.js +0 -26
- package/dist/assets/index-DC3jOsuk.js +0 -99
- package/dist/assets/index-DQD2rqsI.js +0 -1
- package/dist/assets/list-BNMEncjS.js +0 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as S,g as Ee,b as ct}from"./vendor-react-DEoibe3W.js";import{a as dt,l as ne}from"./vendor-hooks-BgUTpb6X.js";import{j as e,aa as y,H as w,ah as H,E as pt,T as E,X as ut,al as te,ad as K,ab as M,ak as Me,a9 as mt,I as q,O as W,q as oe,N as ft,br as $e,cn as Oe,co as ee,bU as We,bq as qe,bx as ht,bs as xt,bR as gt,v as yt,y as jt,bn as vt,s as bt}from"./vendor-mui-core-BV2FUxWJ.js";import{a as L,ao as U,au as Ct,Y as fe,a0 as A,a9 as xe,j as G,aP as St,B as _,r as Tt,a2 as ge,bB as He,h as wt,b9 as Pt,bV as Ae,bo as It,bA as Rt}from"./vendor-ux-did-connect-2jRoUb28.js";import{D as F,y as Ue,n as Dt,V as X,G as kt,ad as At,f as Ft,b as re,aD as Nt,T as Ge}from"./index-
|
|
1
|
+
import{r as S,g as Ee,b as ct}from"./vendor-react-DEoibe3W.js";import{a as dt,l as ne}from"./vendor-hooks-BgUTpb6X.js";import{j as e,aa as y,H as w,ah as H,E as pt,T as E,X as ut,al as te,ad as K,ab as M,ak as Me,a9 as mt,I as q,O as W,q as oe,N as ft,br as $e,cn as Oe,co as ee,bU as We,bq as qe,bx as ht,bs as xt,bR as gt,v as yt,y as jt,bn as vt,s as bt}from"./vendor-mui-core-BV2FUxWJ.js";import{a as L,ao as U,au as Ct,Y as fe,a0 as A,a9 as xe,j as G,aP as St,B as _,r as Tt,a2 as ge,bB as He,h as wt,b9 as Pt,bV as Ae,bo as It,bA as Rt}from"./vendor-ux-did-connect-2jRoUb28.js";import{D as F,y as Ue,n as Dt,V as X,G as kt,ad as At,f as Ft,b as re,aD as Nt,T as Ge}from"./index-DDoVX3je.js";import{n as Lt,c as Bt,B as ye,X as Q}from"./vendor-arcblock-BlrkGjK9.js";import{W as je}from"./did-address-Dq-4__HB.js";import{u as $}from"./dashboard-xUr1SbPS.js";import{r as ve,a as be,b as Ce,c as ie,d as zt,e as Ve,u as _t,f as Et}from"./passport-item-C5-ZuTPM.js";import{p as Ye}from"./util-DMfPwzVN.js";import{u as Mt}from"./use-mobile-BAa0wi8o.js";import{w as V,P as Ke}from"./permission-DSHe73ba.js";import{C as $t}from"./Google-Bn3zPWiu.js";import{M as Z,aA as Ot,K as Wt}from"./vendor-utils-rHXShPKm.js";import{E as le}from"./EditIcon-8BXW1OHp.js";import{C as Se}from"./confirm-Vzr2I9eM.js";import{L as Ze}from"./list-header-xt282ZMS.js";import{f as se}from"./index-8eXqqyHQ.js";import{_ as qt}from"./useSetState-CWq0AVWn.js";import{L as Ht}from"./LockIcon-DFb6sSpT.js";import"./lottie-web-jYmAQWuC.js";import"./useLocalStorage-D6gvgmEW.js";import"./PlayArrow-CDOOUxMp.js";import"./get-safe-url-c4iAcpvA.js";import"./session-C_8V_o-O.js";import"./use-blocklet-logo-Bhkp-Zm7.js";import"./InfoOutlined-D3XnF0Vg.js";import"./dot-itVN8XTt.js";import"./useAsync-510ntT1B.js";import"./use-mobile-C21X4TYN.js";import"./index-D1kTR2xk.js";import"./Phone-BkOMNOMO.js";import"./Location-DxPzfR_p.js";import"./Email-BirbvqZ3.js";import"./Timezone-D91Of94T.js";import"./base32-WurN0cIW.js";import"./cloneDeep-UpFQ2VNg.js";const Fe="info";function Te({createPassportSvg:c,passport:o,onCancel:d,onSwitchPassport:f}){const{t:u}=L(),l=dt({tab:Fe}),h={info:{label:u("common.basicInfo"),value:Fe,component:()=>e.jsx(Xe,{passport:o,createPassportSvg:c})},logs:{label:u("common.logs"),value:"logs",component:()=>e.jsx(et,{passport:o})},related:{label:u("team.passport.related"),value:"related",component:()=>e.jsx(tt,{passport:o,onSwitchPassport:f})}},s=Object.values(h).map(({label:n,value:t})=>({label:n,value:t})).filter(n=>n.value==="related"?o.parentDid:!0),m=h[l.tab]||h.info,r=n=>{l.tab=n};return e.jsx(U,{title:u("common.passport"),onClose:d,open:!0,PaperProps:{style:{maxWidth:800,minHeight:"80vh"}},fullWidth:!0,children:e.jsxs(Ut,{children:[e.jsx(y,{className:"tabs",children:e.jsx(Ct,{tabs:s,current:l.tab,onChange:r,scrollButtons:"auto"})}),e.jsx(y,{className:"body",children:e.jsx(m.component,{})})]})})}Te.propTypes={createPassportSvg:w.func.isRequired,passport:w.object.isRequired,onCancel:w.func.isRequired,onSwitchPassport:w.func};Te.defaultProps={onSwitchPassport:()=>{}};const Ut=H(y)`
|
|
2
2
|
margin-top: -16px;
|
|
3
3
|
|
|
4
4
|
.tabs {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as t,aa as s,H as i,T as a}from"./vendor-mui-core-BV2FUxWJ.js";import{a as f}from"./vendor-ux-did-connect-2jRoUb28.js";import{L as g,r as k}from"./vendor-react-DEoibe3W.js";import"./index-
|
|
1
|
+
import{j as t,aa as s,H as i,T as a}from"./vendor-mui-core-BV2FUxWJ.js";import{a as f}from"./vendor-ux-did-connect-2jRoUb28.js";import{L as g,r as k}from"./vendor-react-DEoibe3W.js";import"./index-DDoVX3je.js";import"./vendor-utils-rHXShPKm.js";import"./vendor-hooks-BgUTpb6X.js";import"./lottie-web-jYmAQWuC.js";import"./vendor-arcblock-BlrkGjK9.js";const p=(e,o)=>[e,...Array.isArray(o)?o:[o]],l=(e=2)=>({overflow:"hidden",textOverflow:"ellipsis",wordBreak:"break-word",display:"-webkit-box",WebkitLineClamp:e,WebkitBoxOrient:"vertical"});function d({sx:e,...o}){const r=p({display:"flex",flexWrap:"wrap",mx:-1},e);return t.jsx(s,{sx:r,...o})}d.propTypes={sx:i.object};d.defaultProps={sx:{}};function w({icon:e}){const[o,r]=k.useState(!1);return!e||o?null:typeof e=="string"?t.jsx(s,{component:"img",src:e,alt:"",sx:{width:1,height:1},onError:()=>r(!0)}):e}w.propTypes={icon:i.oneOfType([i.string,i.node]).isRequired};function u({title:e,desc:o,extra:r,cover:c,icon:n,to:x,sx:h}){const m=p({position:"relative",flexBasis:{xs:"100%",sm:"50%",md:"33.33%",lg:"25%"},maxWidth:{xs:"100%",sm:"50%",md:"33.33%",lg:"25%"},mb:{xs:2,md:6},px:1},h);return t.jsx(s,{sx:m,children:t.jsx(s,{component:g,to:x,target:"_blank",sx:{display:"flex",flexDirection:"column",gap:1,height:1,pt:0,color:"inherit",textDecoration:"none",borderRadius:1,cursor:"pointer"},children:t.jsxs(s,{children:[t.jsxs(s,{sx:{position:"relative"},children:[c,n&&t.jsx(s,{sx:{position:"absolute",top:44,left:16,zIndex:1,width:56,height:56},children:t.jsx(w,{icon:n})})]}),t.jsx(a,{sx:{mt:1,fontSize:"1.25rem",fontWeight:600,...l()},children:e}),o&&t.jsx(a,{variant:"body2",sx:{my:1,...l(),color:"text.secondary"},children:o}),r]})})})}u.propTypes={title:i.string.isRequired,desc:i.string.isRequired,extra:i.node.isRequired,cover:i.string.isRequired,icon:i.string.isRequired,to:i.string.isRequired,sx:i.object.isRequired};const j="/.well-known/service/static/assets/doc-board-bg-DWZHV9Ng.png";function b({board:e,sx:o,...r}){return t.jsx(u,{date:e.createdAt,sx:o,to:e.link,title:e.title,desc:e.desc,cover:t.jsx(s,{sx:{position:"relative",paddingTop:`${9/16*100}%`,border:1,borderColor:"divider",borderRadius:1,overflow:"hidden"},children:t.jsx(s,{component:"img",src:j,alt:"",sx:{position:"absolute",top:0,left:0,width:1,filter:c=>c.palette.mode==="dark"?"brightness(0.28) contrast(1.1)":"none"}})}),icon:e.icon,...r})}b.propTypes={board:i.object.isRequired,sx:i.object.isRequired};function I(){const{locale:e}=f(),o=[{id:"1",title:"Blocklet Platform",desc:"Guide to understand and build on our blocklet platform",icon:"https://www.arcblock.io/favicon.ico",link:`https://www.arcblock.io/docs/blocklet-developer/${e}/getting-started`},{id:"2",title:"Create Blocklet",desc:"Build blocklet with just one command line.",icon:"https://www.arcblock.io/favicon.ico",link:`https://www.arcblock.io/docs/createblocklet/${e}/quick-start`},{id:"3",title:"Blocklet Launcher",desc:"Streamlining Blocklet Launching.",icon:"https://www.arcblock.io/docs/uploads/5a4f4716bc8061532a535fe816a9169c.png",link:`https://www.arcblock.io/docs/launcher/${e}/launcher-welcome`},{id:"4",title:"DID Spaces",desc:"Digital Spaces for Decentralized Identity (DID)",icon:"https://www.arcblock.io/docs/uploads/3a8b142d7c940c57eced71eddba2ff19.png",link:`https://www.arcblock.io/docs/did-spaces/${e}/did-spaces-getting-started`},{id:"5",title:"DID Wallet",desc:"DID Wallet Support docs",icon:"https://www.arcblock.io/docs/uploads/59ddb28f405ee670428e5fe1ff12d104.png",link:`https://www.arcblock.io/docs/did-wallet/${e}/get-started`},{id:"6",title:"DID Names",desc:"Naming Service based on NFT and verifiable credentials",icon:"https://www.didnames.io/favicon.ico?imageFilter=resize&w=32",link:`https://www.arcblock.io/docs/did-domain/${e}/did-domain-faq`},{id:"7",title:"Blockchain",desc:"The ledger for ArcBlock ecosystem",icon:"https://www.arcblock.io/docs/uploads/4a20c152faae0f104ed0815ff3b8b48b.png",link:`https://www.arcblock.io/docs/blockchain/${e}/blockchain-how-to-guides`},{id:"8",title:"DID Connect",desc:"The open protocol and development kit for connecting users and dapps",icon:"https://www.arcblock.io/docs/uploads/d189118f89b56e9d5b03ad5a0212a4ab.png",link:`https://www.arcblock.io/docs/did-connect/${e}/developer-guides`}];return t.jsx(d,{children:o.map(r=>t.jsx(b,{board:r},r.id))})}export{I as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as B,a0 as q,bT as _,I as ge,bU as fe,a2 as je,a9 as ye,bA as we}from"./vendor-ux-did-connect-2jRoUb28.js";import{t as ke,l as de,j as Ee}from"./vendor-hooks-BgUTpb6X.js";import{r as S,b as Q}from"./vendor-react-DEoibe3W.js";import{d as X}from"./InfoOutlined-D3XnF0Vg.js";import{j as ve,B as Ce}from"./vendor-arcblock-BlrkGjK9.js";import{U as Te,C as Se,I as Ie}from"./index-D1kTR2xk.js";import{D as F,aB as Re,aC as K,G as pe,y as De}from"./index-DDoVX3je.js";import{u as U}from"./dashboard-xUr1SbPS.js";import{u as ze}from"./use-mobile-BAa0wi8o.js";import{H as t,j as e,D as Pe,aj as Ae,t as We,aa as m,O as re,T as I,ab as M,ak as Z,z as Oe,y as H,bs as le,bR as Y,ad as $,L as J,A as G,bc as qe,E as L,I as ee,C as $e,bq as Le,al as z,cg as Be,X as Me,bb as V,bp as He,b4 as Ne,ch as Fe,ci as Ue,b5 as _e,an as Ke,c0 as Ye,s as ue,v as Ve,cj as Je,ck as Ge,cl as Qe,cm as Xe}from"./vendor-mui-core-BV2FUxWJ.js";import{d as Ze}from"./ExpandLess-t1cH-Bc4.js";import{b as he,z as et,A as tt}from"./vendor-utils-rHXShPKm.js";import{C as ot}from"./confirm-Vzr2I9eM.js";import{A as st}from"./actions-DP7pj6xB.js";import{T as ae}from"./table-tips-BfSSGl9N.js";import"./lottie-web-jYmAQWuC.js";import"./Phone-BkOMNOMO.js";import"./Location-DxPzfR_p.js";import"./Email-BirbvqZ3.js";import"./Timezone-D91Of94T.js";import"./useLocalStorage-D6gvgmEW.js";import"./index-8eXqqyHQ.js";import"./PlayArrow-CDOOUxMp.js";import"./get-safe-url-c4iAcpvA.js";import"./session-C_8V_o-O.js";import"./use-blocklet-logo-Bhkp-Zm7.js";import"./dot-itVN8XTt.js";import"./useAsync-510ntT1B.js";import"./useSetState-CWq0AVWn.js";import"./use-mobile-C21X4TYN.js";import"./MoreHoriz-DpKn_fkc.js";const nt=o=>{var f,w;const[p,u]=S.useState(null),[E,s]=S.useState(!o),[R,c]=S.useState(null),{blocklet:a}=pe(),d=(w=(f=a==null?void 0:a.site)==null?void 0:f.domainAliases[0])==null?void 0:w.value,j=S.useMemo(()=>{const b={};return p&&(p.sources.forEach(l=>{b[l.did]={source:l,events:[],count:0}}),p.events.forEach(l=>{b[l.source]&&(b[l.source].events.push(l),b[l.source].count+=1)})),b},[p]),y=async()=>{try{if(s(!0),!d)return;const l=await(await fetch(`https://${d}/.well-known/service/openevent.json`)).json();u(l),c(null)}catch(b){c(b instanceof Error?b:new Error(String(b)))}finally{s(!1)}};return S.useEffect(()=>{y()},[d]),{openEvent:p,setOpenEvent:u,eventsBySource:j,loading:E,error:R,loadData:y}};function te({eventsBySource:o,selectedEvents:p,setSelectedEvents:u,error:E}){const{t:s}=B(),[R,c]=S.useState({}),a=S.useMemo(()=>{const l={};return Object.entries(o).forEach(([g,{events:h}])=>{const T=h.filter(x=>p[`${x.type}-${x.source}`]).length;l[g]=T}),l},[o,p]),d=S.useMemo(()=>Object.values(a).reduce((l,g)=>l+g,0),[a]),j=S.useMemo(()=>Object.values(o).reduce((l,{events:g})=>l+g.length,0),[o]),y=(l,g)=>{g.stopPropagation(),c({...R,[l]:!R[l]})},f=l=>{const g=`${l.type}-${l.source}`;u(h=>({...h,[g]:!h[g]}))},w=(l,g)=>{const h={};l.forEach(T=>{const x=`${T.type}-${T.source}`;h[x]=!g}),u(T=>({...T,...h}))},b=l=>{const g={};Object.values(o).forEach(({events:h})=>{h.forEach(T=>{const x=`${T.type}-${T.source}`;g[x]=l.target.checked})}),u(g)};return e.jsxs(m,{sx:{width:"100%"},children:[e.jsxs(m,{sx:{display:"flex",alignItems:"center",mb:1,mt:1},children:[e.jsx(le,{control:e.jsx(Y,{onChange:b,checked:d>0&&d===j}),label:e.jsxs(m,{sx:{display:"flex",alignItems:"center",cursor:"pointer"},children:[s("webhookEndpoint.selectAllEvents"),e.jsx(m,{sx:{display:"flex",alignItems:"center"},children:e.jsx($,{title:s("webhookEndpoint.selectAllEventsTooltip"),placement:"right",children:e.jsx(X,{fontSize:"small",sx:{ml:.5,cursor:"help"}})})})]}),sx:{m:0}}),d>0&&e.jsx(I,{variant:"body2",color:"primary",sx:{ml:"auto"},children:s("webhookEndpoint.selectedEventsCount",{count:d})})]}),e.jsx(m,{sx:{maxHeight:"50vh",overflow:"auto"},children:e.jsx(J,{disablePadding:!0,sx:{border:"1px solid",borderColor:"divider",borderRadius:"4px"},children:Object.entries(o).map(([l,{source:g,events:h,count:T}],x)=>{const D=a[l]>0,k=a[l]===h.length&&h.length>0,A=R[l];return e.jsxs(Q.Fragment,{children:[e.jsx(G,{sx:{borderBottom:({palette:n})=>x<Object.keys(o).length-1?`1px solid ${n.divider}`:"none",px:2,py:1.5,"&:hover":{bgcolor:"rgba(0, 0, 0, 0.02)"}},children:e.jsxs(m,{sx:{display:"flex",width:"100%",justifyContent:"space-between",alignItems:"center"},onClick:n=>{n.target.closest(".MuiFormControlLabel-root")||y(l,n)},children:[e.jsx(m,{sx:{display:"flex",alignItems:"center"},children:h.length>0&&e.jsx(le,{control:e.jsx(Y,{checked:k,indeterminate:D&&!k,onChange:n=>{n.stopPropagation(),w(h,k)}}),label:e.jsxs(m,{sx:{display:"flex",alignItems:"center",gap:1},children:[g.logo&&e.jsx(qe,{src:g.logo,sx:{width:24,height:24}}),e.jsx(m,{children:g.title||l}),D&&e.jsx(L,{label:s("webhookEndpoint.selectedCount",{count:a[l]}),size:"small",sx:{mt:"2px",height:"20px",fontSize:"12px",bgcolor:n=>`${n.palette.primary.main}20`,color:"primary.main",fontWeight:500}})]}),sx:{m:0,"& .MuiFormControlLabel-label":{flex:1}}})}),e.jsxs(m,{sx:{display:"flex",alignItems:"center"},children:[e.jsx(I,{variant:"body2",color:"text.secondary",sx:{mr:1},children:s("webhookEndpoint.eventsCount",{count:T})}),h.length>0&&e.jsx(ee,{size:"small",edge:"end",children:A?e.jsx(Ze,{}):e.jsx(ve,{})})]})]})}),h.length>0&&e.jsx($e,{in:A,timeout:"auto",unmountOnExit:!0,children:e.jsx(J,{disablePadding:!0,sx:{pl:2,pr:2,py:1,bgcolor:"rgba(0, 0, 0, 0.01)"},children:h.map(n=>{const r=`${n.type}-${n.source}`,i=!!p[r];return e.jsx(G,{dense:!0,sx:{py:.75},onClick:()=>f(n),children:e.jsxs(m,{sx:{display:"flex",alignItems:"flex-start",width:"100%"},children:[e.jsx(Y,{checked:i,sx:{mr:1}}),e.jsxs(m,{children:[e.jsx(I,{variant:"body1",sx:{cursor:"pointer"},children:n.type}),e.jsx(I,{variant:"caption",color:"text.disabled",sx:{display:"block",cursor:"pointer"},children:n.description})]})]})},r)})})})]},l)})})}),E&&e.jsx(Le,{error:!0,sx:{mt:1},children:E})]})}te.propTypes={eventsBySource:t.objectOf(t.shape({source:t.shape({did:t.string.isRequired,title:t.string,description:t.string,version:t.string,logo:t.string}).isRequired,events:t.arrayOf(t.shape({type:t.string.isRequired,description:t.string.isRequired,source:t.string.isRequired})).isRequired,count:t.number.isRequired})).isRequired,selectedEvents:t.objectOf(t.bool).isRequired,setSelectedEvents:t.func.isRequired,error:t.string};te.defaultProps={error:null};function oe({id:o,url:p,description:u,enabledEvents:E,onSubmit:s,onClose:R}){var n;const{t:c}=B(),[a,d]=S.useState({}),{teamDid:j}=U(),{api:y}=F(),{loading:f,error:w,eventsBySource:b}=nt(),{control:l,handleSubmit:g,formState:{errors:h},reset:T,setValue:x,trigger:D}=Re({defaultValues:{url:"",description:""}});S.useEffect(()=>{const r=Object.values(a).some(i=>i);x("selectedEvents",r?"valid":""),D("selectedEvents")},[a,x,D]);const k=()=>{d({}),T(),R()},A=async r=>{const i=Object.keys(a).filter(v=>a[v]),C={url:r.url,description:r.description,enabledEvents:i.map(v=>{const[P,O]=v.split("-");return!P||!O?null:{type:P,source:O}}).filter(Boolean)};try{if(o){const v=await y.updateWebhookEndpoint({input:{teamDid:j,id:o,data:C}});q.success(`${c("webhookEndpoint.updateWebhook")} ${c("webhookEndpoint.success")}`),s(v)}else{const v=await y.createWebhookEndpoint({input:{teamDid:j,input:C}});q.success(`${c("webhookEndpoint.createWebhook")} ${c("webhookEndpoint.success")}`),s(v)}}catch(v){q.error(v==null?void 0:v.message)}k()};return S.useEffect(()=>{T({url:p,description:u}),d(E.reduce((r,i)=>(r[`${i.type}-${i.source}`]=!0,r),{}))},[T,d,p,u,E]),e.jsx(Pe,{open:!0,onClose:k,maxWidth:"lg",fullWidth:!0,sx:{"& .MuiDialog-paper":{minHeight:600}},children:e.jsxs("form",{onSubmit:g(A),children:[e.jsx(Ae,{children:c(o?"webhookEndpoint.editWebhookTitle":"webhookEndpoint.createWebhookTitle")}),e.jsx(We,{children:e.jsxs(m,{sx:{display:"flex",flexDirection:"column",gap:2,mt:2},children:[e.jsx(K,{name:"url",control:l,rules:{required:c("webhookEndpoint.validation.urlRequired"),pattern:{value:/^(http|https):\/\/[^ "]+$/,message:c("webhookEndpoint.validation.urlInvalid")}},render:({field:r})=>{var i;return e.jsx(re,{...r,label:c("webhookEndpoint.url.label"),fullWidth:!0,error:!!h.url,helperText:(i=h.url)==null?void 0:i.message})}}),e.jsx(K,{name:"description",control:l,rules:{required:c("webhookEndpoint.validation.descriptionRequired")},render:({field:r})=>{var i;return e.jsx(re,{...r,label:c("webhookEndpoint.description.label"),fullWidth:!0,multiline:!0,minRows:2,maxRows:4,error:!!h.description,helperText:(i=h.description)==null?void 0:i.message})}}),e.jsx(K,{name:"selectedEvents",control:l,rules:{required:c("webhookEndpoint.validation.eventRequired")},render:({field:r})=>e.jsx("input",{type:"hidden",...r})}),!f&&b&&Object.keys(b).length>0&&e.jsx(te,{eventsBySource:b,selectedEvents:a,setSelectedEvents:d,error:(n=h.selectedEvents)==null?void 0:n.message}),!f&&(!b||Object.keys(b).length===0)&&e.jsx(I,{color:"text.secondary",children:c("webhookEndpoint.noAvailableEvents")}),f&&e.jsx(m,{sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"500px",width:"100%"},children:e.jsx(M,{size:20})}),w&&e.jsx(Z,{severity:"error",children:c("webhookEndpoint.loadingError",{message:w==null?void 0:w.message})})]})}),e.jsxs(Oe,{sx:{p:"8px 24px 24px"},children:[e.jsx(H,{onClick:k,children:c("common.cancel")}),e.jsx(H,{type:"submit",variant:"contained",color:"primary",children:c(o?"webhookEndpoint.updateWebhook":"webhookEndpoint.saveWebhook")})]})]})})}oe.propTypes={onSubmit:t.func.isRequired,id:t.string,url:t.string,description:t.string,enabledEvents:t.arrayOf(t.shape({type:t.string.isRequired,source:t.string.isRequired})),onClose:t.func};oe.defaultProps={id:null,url:"",description:"",enabledEvents:[],onClose:()=>{}};function xe(o){switch(o){case"enabled":return"success";case"disabled":default:return"default"}}const it=(o="en")=>o==="tw"?"zh":o;function N(o,p="YYYY-MM-DD HH:mm:ss",u="en"){return o?De(o).locale(it(u)).format(p):"-"}function rt(o){return typeof o=="number"?!1:he(o)}function lt(o){return o>=200&&o<300}function W(o){const p=rt(o.value);return e.jsxs(e.Fragment,{children:[e.jsxs(z,{direction:"column",alignItems:"flex-start",children:[e.jsxs(I,{component:"div",variant:"body1",mb:1,color:"text.primary",sx:{fontWeight:500},children:[o.label,!!o.tip&&e.jsx($,{title:o.tip,children:e.jsx(Be,{fontSize:"small"})})]}),e.jsx(I,{component:"div",variant:"body1",color:p?"text.disabled":"text.secondary",sx:{width:"100%",minHeight:"24px"},children:p?"-":o.value})]}),o.divider&&e.jsx(Me,{orientation:"vertical",flexItem:!0})]})}W.propTypes={label:t.oneOfType([t.string,t.node]).isRequired,value:t.oneOfType([t.string,t.node]).isRequired,tip:t.oneOfType([t.string,t.node]),divider:t.bool};W.defaultProps={tip:"",divider:!1};function se(o){return e.jsxs(z,{className:"section-header",direction:"row",justifyContent:"space-between",alignItems:"center",flexWrap:"wrap",gap:1,sx:{mb:o.mb,mt:o.mt,pb:1},children:[e.jsx(I,{variant:"h3",sx:{fontSize:{xs:"18px",md:"1.09375rem"}},component:"div",children:o.title}),o.children]})}se.propTypes={title:t.oneOfType([t.string,t.node]).isRequired,children:t.node,mb:t.number,mt:t.number};se.defaultProps={children:null,mb:1.5,mt:1.5};const at=o=>{const p={};return o.forEach(u=>{var s;const E=new Date(u.createdAt).toLocaleDateString();p[E]||(p[E]=[]),(s=p[E])==null||s.push(u)}),p};function ne({eventId:o,webhookEndpointId:p,event:u}){const{api:E}=F(),{t:s}=B(),{teamDid:R}=U(),{blocklet:c}=pe(),{data:a,loadMore:d,loadingMore:j,loading:y}=ke(x=>{const k=x?Math.ceil(x.list.length/15)+1:1;return E.getWebhookAttempts({input:{teamDid:R,input:{eventId:o,webhookId:p},paging:{page:k,pageSize:15}}})},{reloadDeps:[o,p]}),f=(a==null?void 0:a.list)||[],[w,b]=S.useState(null),l=at(f);S.useEffect(()=>{!w&&(a!=null&&a.list.length)&&b(a.list[0])},[a==null?void 0:a.list.length,w]);const g=x=>{b(x)};if(y)return e.jsx(M,{});const h=a&&a.list.length<a.paging.total,T=x=>{var D,k,A,n,r;if(x.responseBody&&((D=x.responseBody)!=null&&D.sessionId)&&((k=x.responseBody)!=null&&k.projectId)&&((A=x.responseBody)!=null&&A.agentId)){const i=(r=(n=c==null?void 0:c.site)==null?void 0:n.domainAliases[0])==null?void 0:r.value,C=(c.children||[]).find(P=>{var O;return((O=P==null?void 0:P.meta)==null?void 0:O.name)==="ai-studio"}),v=et(tt(`https://${i}`,(C==null?void 0:C.mountPoint)||"","projects",x.responseBody.projectId,"logs/main"),{sessionId:x.responseBody.sessionId,agentId:x.responseBody.agentId});return e.jsx(ee,{sx:{fontSize:20},onClick:()=>window.open(v,"_blank"),children:e.jsx(m,{component:ge,icon:fe})})}return null};return e.jsxs(V,{container:!0,spacing:{xs:0,md:1},sx:{height:1},children:[e.jsx(V,{item:!0,xs:12,md:4,height:1,children:he(Object.keys(l))?e.jsx(I,{color:"text.secondary",children:s("webhookEndpoint.waitingForEvents")}):e.jsxs(e.Fragment,{children:[e.jsx(J,{sx:{maxHeight:"calc(100% - 40px)",py:0,overflowY:"auto"},children:Object.entries(l).map(([x,D])=>e.jsxs(Q.Fragment,{children:[e.jsx(He,{children:x}),D.map(k=>e.jsxs(G,{sx:{cursor:"pointer"},onClick:()=>g(k),selected:w===k,secondaryAction:e.jsx(I,{color:"text.secondary",children:N(k.createdAt,"HH:mm:ss")}),children:[e.jsx(Ne,{sx:{minWidth:0,mr:1.5},children:lt(k.responseStatus)===!1?e.jsx(Fe,{color:"error"}):e.jsx(Ue,{color:"success"})}),e.jsx(_e,{primary:e.jsx(I,{color:"text.primary",children:k.event.type})})]},k.id))]},x))}),h&&e.jsx(m,{display:"flex",justifyContent:"center",alignItems:"center",width:1,children:e.jsx(H,{variant:"text",type:"button",color:"inherit",onClick:d,disabled:j,sx:{color:x=>x.palette.text.disabled},children:s(j?"webhookEndpoint.loadingMore":"webhookEndpoint.loadMore")})})]})}),e.jsxs(V,{item:!0,xs:12,md:8,height:1,children:[w&&e.jsxs(z,{height:1,overflow:"auto",direction:"column",spacing:2,sx:{pl:{xs:0,md:1},mt:{xs:2,md:0},borderLeft:{xs:"none"}},children:[e.jsxs(m,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(I,{variant:"h6",children:o?w.endpoint.url:w.event.type}),e.jsx(m,{children:T(w)})]}),e.jsxs(m,{children:[e.jsxs(I,{variant:"h6",children:[s("webhookEndpoint.response")," (",w.responseStatus,")"]}),e.jsx(_,{language:"json",children:JSON.stringify(w.responseBody,null,2)})]}),e.jsxs(m,{children:[e.jsx(z,{direction:"row",alignItems:"center",spacing:1,children:e.jsx(I,{variant:"h6",children:s("webhookEndpoint.request")})}),e.jsx(_,{language:"json",sx:{margin:0},children:JSON.stringify(w.event,null,2)})]})]}),(a==null?void 0:a.list.length)===0&&u&&e.jsxs(m,{children:[e.jsx(z,{direction:"row",alignItems:"center",spacing:1,children:e.jsx(I,{variant:"h6",children:s("webhookEndpoint.eventData")})}),e.jsx(_,{language:"json",sx:{margin:0},children:JSON.stringify(u.data,null,2)})]})]})]})}ne.propTypes={eventId:t.string,webhookEndpointId:t.string,event:t.shape({type:t.string,data:t.object,request:t.object,requestInfo:t.object})};ne.defaultProps={eventId:"",webhookEndpointId:"",event:null};function me({id:o,onClose:p}){var j,y,f,w;const{t:u}=B(),{api:E}=F(),{teamDid:s}=U(),{loading:R,error:c,data:a}=de(()=>E.getWebhookEndpoint({input:{teamDid:s,id:o}})),d=a==null?void 0:a.data;return c?e.jsx(Z,{severity:"error",children:c.message}):R||!d?e.jsx(m,{display:"flex",justifyContent:"center",alignItems:"center",height:1,width:1,children:e.jsx(M,{})}):e.jsxs(ct,{direction:"column",sx:{height:{xs:"auto",md:1}},children:[e.jsxs(m,{children:[e.jsxs(z,{direction:"row",justifyContent:"space-between",alignItems:"center",children:[e.jsx(z,{flex:1,width:0,children:e.jsxs(m,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(I,{variant:"h5",fontWeight:600,sx:{overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis"},children:d.description}),e.jsx($,{title:d.url,children:e.jsx(X,{sx:{fontSize:"16px",marginTop:"2px"}})})]})}),e.jsx(z,{direction:"row",alignItems:"center",children:e.jsx(ee,{edge:"end",color:"inherit",onClick:p,children:e.jsx(Ye,{})})})]}),e.jsx(m,{mt:2,children:e.jsxs(z,{className:"section-body",direction:{xs:"column",md:"row"},spacing:{xs:1,md:3},justifyContent:"flex-start",flexWrap:"wrap",sx:{pt:2,mt:2,borderTop:"1px solid #eee"},children:[e.jsx(W,{label:u("common.status"),value:e.jsx(L,{size:"small",variant:"filled",label:d.status,color:xe(d.status),sx:{borderRadius:"4px",lineHeight:"20px",textTransform:"capitalize"}}),divider:!0}),e.jsx(W,{label:u("webhookEndpoint.listen"),value:e.jsx($,{arrow:!0,title:e.jsx("ul",{style:{padding:0,margin:0},children:d.enabledEvents.map(b=>e.jsx("li",{style:{fontSize:"0.7875rem"},children:b==null?void 0:b.type},b))}),children:e.jsx(L,{size:"small",variant:"filled",label:u("webhookEndpoint.eventsCount",{count:d.enabledEvents.length}),sx:{borderRadius:"4px",lineHeight:"20px",textTransform:"capitalize"}})}),divider:!0}),e.jsx(W,{label:u("webhookEndpoint.version"),value:d.apiVersion,divider:!0}),e.jsx(W,{label:u("common.createdAt"),value:N(d.createdAt),divider:!0}),e.jsx(W,{label:u("common.updatedAt"),value:N(d.updatedAt),divider:!0}),e.jsx(W,{label:u("common.createdBy"),value:e.jsx($,{arrow:!0,title:(j=d.createUser)==null?void 0:j.did,children:e.jsx(L,{size:"small",variant:"filled",label:(y=d.createUser)==null?void 0:y.fullName,sx:{borderRadius:"4px",lineHeight:"20px",textTransform:"capitalize"}})}),divider:!0}),e.jsx(W,{label:u("common.updatedBy"),value:e.jsx($,{arrow:!0,title:(f=d.updateUser)==null?void 0:f.did,children:e.jsx(L,{size:"small",variant:"filled",label:(w=d.updateUser)==null?void 0:w.fullName,sx:{borderRadius:"4px",lineHeight:"20px",textTransform:"capitalize"}})})})]})})]}),e.jsxs(z,{className:"section",flex:1,height:0,overflow:"hidden",children:[e.jsx(se,{title:u("webhookEndpoint.attempts"),mb:0,mt:4}),e.jsx(z,{height:0,flex:1,overflow:"hidden",children:e.jsx(ne,{webhookEndpointId:d.id})})]})]})}me.propTypes={id:t.string.isRequired,onClose:t.func.isRequired};const ct=ue(z)``;function be({open:o,onClose:p,id:u}){return e.jsx(Ke,{anchor:"right",open:o,onClose:p,PaperProps:{sx:{width:"90vw",maxWidth:"1200px"}},children:e.jsx(m,{sx:{height:"100vh",p:3},children:e.jsx(me,{id:u,onClose:p})})})}be.propTypes={open:t.bool.isRequired,onClose:t.func.isRequired,id:t.string.isRequired};function ce(){return null}const ie=Q.memo(({options:o,columns:p,toolbar:u=!0,footer:E=!0,hasRowLink:s=!1,emptyNodeText:R="",...c})=>{const{locale:a}=B(),d=Ve(f=>f.breakpoints.down("md")),j={print:!1,download:!1,filter:!1,selectableRows:"none",rowsPerPage:d?5:10,rowsPerPageOptions:[5,10,20,50,100],searchDebounceTime:300,tableBodyHeight:"100%",loading:!0},y={};return u||(y.TableToolbar=ce),E||(y.TableFooter=ce),e.jsx(dt,{locale:a,options:{...j,...o},columns:(p||[]).map(f=>(f.options=f.options||{},f.options.filter=f.options.filter||!1,f.options.sort=f.options.sort||!1,f)),emptyNode:e.jsx(je,{children:R}),...c,components:y,hasRowLink:s,isMobile:d})});ie.propTypes={options:t.object,columns:t.array,toolbar:t.bool,footer:t.bool,hasRowLink:t.bool,emptyNodeText:t.node,durable:t.string,durableKeys:t.array,data:t.array,loading:t.bool,onChange:t.func,title:t.node,components:t.object};ie.defaultProps={options:{},columns:[],toolbar:!0,footer:!0,hasRowLink:!1,emptyNodeText:null,durable:"",durableKeys:[],data:[],loading:!1,onChange:()=>{},title:null,components:{}};const dt=ue(ye)``,pt=ie;function Ft(){const{teamDid:o}=U(),p=ze(),u=`webhook-endpoints-${o}`,E=we(u),{t:s,locale:R}=B(),{api:c}=F(),[a,d]=S.useState(""),[j,y]=S.useState({webhookDetail:{open:!1,id:null},createEdit:{open:!1,id:null,url:"",description:"",enabledEvents:[]},deleteConfirm:null}),[f,w]=Ee(u,{defaultValue:{pageSize:E.rowsPerPage||20,page:E.page?E.page+1:1}}),{loading:b,error:l,data:g,refresh:h}=de(()=>c.getWebhookEndpoints({input:{teamDid:o,paging:{page:f.page,pageSize:f.pageSize}}}));S.useEffect(()=>{h()},[f,h]);const T=S.useCallback(async(n,r)=>{try{await c.updateWebhookEndpoint({input:{teamDid:o,id:n.id,data:{status:r?"disabled":"enabled"}}}),h(),q.success(`${s(r?"webhookEndpoint.disable":"webhookEndpoint.enable")}${s("webhookEndpoint.success")}`)}catch(i){q.error(i==null?void 0:i.message)}},[c,o,h,s]),x=S.useCallback(async n=>{try{await c.deleteWebhookEndpoint({input:{teamDid:o,id:n}}),h(),y(r=>({...r,deleteConfirm:null})),q.success(`${s("common.delete")}${s("webhookEndpoint.success")}`)}catch(r){q.error(r==null?void 0:r.message)}},[c,o,h,s]),D=(n,r)=>{let i=n.page+1;const C=n.searchText||"";if(C!==a){d(C);return}if(r==="changePage"||r==="changeRowsPerPage"){r!=="changePage"&&(i=1);const v={page:i,pageSize:n.rowsPerPage};d(""),w(v)}};if(l)return e.jsx(Z,{severity:"error",children:l.message});if(b||!g)return e.jsx(m,{display:"flex",justifyContent:"center",alignItems:"center",width:1,height:500,children:e.jsx(M,{})});const k=((g==null?void 0:g.list)||[]).filter(n=>{if(!a)return!0;const r=a.toLowerCase();return n.description.toLowerCase().includes(r)||n.url.toLowerCase().includes(r)}),A=[{label:"URL",name:"url",options:{customBodyRenderLite:(n,r)=>{const i=k[r];return e.jsxs(m,{sx:{display:"flex",alignItems:"center",cursor:"pointer",gap:.5},children:[e.jsx(I,{variant:"body2",children:i.description}),e.jsx(m,{sx:{display:"flex"},onClick:C=>{C.stopPropagation()},children:e.jsx($,{title:i.url,children:e.jsx(X,{sx:{fontSize:"15px",marginTop:"1px"}})})})]})}}},{label:"Events",name:"events",options:{customBodyRenderLite:(n,r)=>{const i=k[r];return e.jsx(m,{sx:{display:"flex",alignItems:"center",gap:1,flexWrap:"wrap"},children:i.enabledEvents.map(C=>e.jsx(L,{size:"small",variant:"filled",label:C.type,sx:{borderRadius:"4px",textTransform:"capitalize"}},`${i.source}-${C.type}`))})}}},{label:s("common.status"),name:"status",options:{customBodyRenderLite:(n,r)=>{const i=k[r];return e.jsx(L,{size:"small",variant:"filled",label:s(`webhookEndpoint.${i==null?void 0:i.status}`),color:xe(i==null?void 0:i.status),sx:{borderRadius:"4px",textTransform:"capitalize"}},`status-${i.status}`)}}},{label:s("common.createdAt"),name:"createdAt",minWidth:200,options:{customBodyRender:n=>N(n)}},{label:s("common.createdBy"),name:"createUser",width:100,options:{customBodyRender:n=>n?e.jsx(Te,{showDid:!0,did:n==null?void 0:n.did,cardType:Se.Detailed,infoType:Ie.Minimal,sx:{border:0,padding:0}}):"-"}},{label:s("common.actions"),name:"actions",width:100,align:"center",verticalKeyAlign:"center",options:{customBodyRenderLite:(n,r)=>{const i=k[r],C=(i==null?void 0:i.status)==="enabled";return e.jsx(st,{actions:[{icon:C?e.jsx(Je,{}):e.jsx(Ge,{}),text:s(C?"webhookEndpoint.disable":"webhookEndpoint.enable"),onClick:v=>{v.stopPropagation(),T(i,C)}},{icon:e.jsx(Qe,{}),text:s("common.edit"),onClick:v=>{v.stopPropagation(),y(P=>({...P,createEdit:{open:!0,id:i.id,url:i.url,description:i.description,enabledEvents:i.enabledEvents}}))}},{icon:e.jsx(Xe,{}),text:s("common.delete"),onClick:v=>{v.stopPropagation(),y(P=>({...P,deleteConfirm:{title:s("webhookEndpoint.deleteWebhook.title"),description:s("webhookEndpoint.deleteWebhook.description"),confirm:s("common.confirm"),cancel:s("common.cancel"),onConfirm:()=>x(i.id),onCancel:()=>y(O=>({...O,deleteConfirm:null}))}}))}}]})}}}];return e.jsxs(m,{sx:{".custom-toobar-btns":{gap:"8px"},".custom-toobar-title .custom-toobar-title-inner>span":{display:"flex",alignItems:"center","white-space":"inherit",height:"100%"}},children:[p?e.jsx(ae,{title:s("webhookEndpoint.listTitle"),tooltipTitle:s("webhookEndpoint.tooltipTitle"),link:`https://www.arcblock.io/docs/blocklet-developer/${R}/webhook`}):null,e.jsx(pt,{durable:u,durableKeys:["page","rowsPerPage"],data:k,columns:A,options:{count:g.count,page:f.page-1,rowsPerPage:f.pageSize,viewColumns:!1,onRowClick:(n,{dataIndex:r})=>{const i=g.list[r];y(C=>({...C,webhookDetail:{open:!0,id:i.id}}))}},loading:b,onChange:D,emptyNodeText:e.jsx(z,{gap:1,children:s("webhookEndpoint.noWebhooksAdded")}),title:p?null:e.jsx(ae,{title:s("webhookEndpoint.listTitle"),tooltipTitle:s("webhookEndpoint.tooltipTitle"),link:`https://www.arcblock.io/docs/blocklet-developer/${R}/webhook`}),customButtons:[e.jsxs(H,{sx:{color:"common.white"},edge:"end",variant:"contained",color:"primary",onClick:()=>y(n=>({...n,createEdit:{...n.createEdit,open:!0}})),className:"rule-action",children:[b?e.jsx(M,{size:16}):e.jsx(Ce,{style:{fontSize:16}}),s("common.create")]},"add")]}),j.webhookDetail.open&&e.jsx(be,{open:!0,onClose:()=>y(n=>({...n,webhookDetail:{open:!1,id:null}})),id:j.webhookDetail.id}),j.createEdit.open&&e.jsx(oe,{onSubmit:h,...j.createEdit,onClose:()=>y(n=>({...n,createEdit:{id:null,url:"",description:"",enabledEvents:[],open:!1}}))}),j.deleteConfirm&&e.jsx(ot,{title:j.deleteConfirm.title,description:j.deleteConfirm.description,confirm:j.deleteConfirm.confirm,cancel:j.deleteConfirm.cancel,params:j.deleteConfirm.params,onConfirm:j.deleteConfirm.onConfirm,onCancel:j.deleteConfirm.onCancel})]})}export{Ft as default};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/lottie-react.esm-D2t-u0YU.js","assets/vendor-react-DEoibe3W.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{j as e,aa as n,bb as g,T as z,O as U,bu as q,bs as W,bv as H,cI as L,y as O,ah as I,ai as N,cm as J,dA as X,dB as K,I as Y,dC as Q,e as Z,c0 as ee}from"./vendor-mui-core-BV2FUxWJ.js";import{r as b}from"./vendor-react-DEoibe3W.js";import{H as te,a as B,e as re,i as ie,b as oe}from"./vendor-hooks-BgUTpb6X.js";import{T as ae,bz as se,_}from"./vendor-ux-did-connect-2jRoUb28.js";import{aP as ne}from"./vendor-utils-rHXShPKm.js";import{getAIKitComponent as le}from"./index-
|
|
2
|
+
import{j as e,aa as n,bb as g,T as z,O as U,bu as q,bs as W,bv as H,cI as L,y as O,ah as I,ai as N,cm as J,dA as X,dB as K,I as Y,dC as Q,e as Z,c0 as ee}from"./vendor-mui-core-BV2FUxWJ.js";import{r as b}from"./vendor-react-DEoibe3W.js";import{H as te,a as B,e as re,i as ie,b as oe}from"./vendor-hooks-BgUTpb6X.js";import{T as ae,bz as se,_}from"./vendor-ux-did-connect-2jRoUb28.js";import{aP as ne}from"./vendor-utils-rHXShPKm.js";import{getAIKitComponent as le}from"./index-CsXmgylH.js";import"./lottie-web-jYmAQWuC.js";import"./vendor-arcblock-BlrkGjK9.js";import"./index-Bs1kxR8_.js";import"./index-DDoVX3je.js";import"./index-DVQCgvFb.js";const F=b.createContext({}),D=()=>b.useContext(F);function de({children:t,restrictions:c,i18n:s,theme:o}){const[l,f]=te({loading:!1}),x=a=>f(j=>({...j,loading:a})),p=b.useMemo(()=>({...l,onLoading:x,restrictions:c,i18n:s}),[l]);return e.jsx(ae,{theme:o,children:e.jsx(F.Provider,{value:p,children:t})})}const ce=["1024x1024","1024x1792","1792x1024"],xe=["256x256","512x512","1024x1024"],ue=[{label:"DALL·E 3",value:"dall-e-3"},{label:"DALL·E 2",value:"dall-e-2"}];function me({onSubmit:t}){const{loading:c,i18n:s}=D(),o=B({model:"dall-e-3",prompt:"",size:"1024x1024",number:1}),l=()=>{const a=JSON.parse(JSON.stringify(o));Object.values(o).every(y=>!!y)&&t(a)},{run:f}=re(l,{wait:500}),x={width:"100%",pl:1,pr:1},p=o.model==="dall-e-2"?xe:ce;return e.jsxs(pe,{onSubmit:a=>a.preventDefault(),children:[e.jsx(n,{sx:{flex:1,overflowY:"auto",overflowX:"hidden",m:2,mb:0},children:e.jsxs(g,{container:!0,gap:2.5,children:[e.jsxs(g,{item:!0,xs:12,children:[e.jsx(z,{gutterBottom:!0,className:"title label",color:"text.primary",children:s("aiImagePrompt")}),e.jsx(U,{sx:{width:1,mt:1},size:"small",type:"text",required:!0,placeholder:s("aiImagePromptTip"),multiline:!0,minRows:5,maxRows:6,value:o.prompt??"",onChange:a=>{a.stopPropagation(),o.prompt=a.target.value},inputProps:{maxLength:1e3}})]}),e.jsxs(g,{item:!0,xs:12,children:[e.jsx(z,{gutterBottom:!0,className:"title label",color:"text.primary",children:`${s("aiImageModel")}`}),e.jsx(q,{row:!0,sx:{".MuiFormControlLabel-label":{fontSize:"12px",color:"text.primary"}},value:o.model,onChange:a=>{o.number=1,o.size="1024x1024",o.model=a.target.value},children:ue.map(a=>e.jsx(W,{value:a.value,control:e.jsx(H,{size:"small"}),label:a.label},a.label))})]}),e.jsxs(g,{item:!0,xs:12,children:[e.jsx(z,{gutterBottom:!0,className:"title label",color:"text.primary",children:`${s("aiImageSize")}: ${o.size}`}),e.jsx(g,{container:!0,sx:{gap:2.5,pt:1},children:e.jsx(n,{flex:1,children:e.jsx(n,{...x,children:e.jsx(L,{size:"small",min:0,max:p.length-1,step:1,value:p.findIndex(a=>a==o.size),onChange:(a,j)=>{o.size=p[j]}})})})})]}),o.model==="dall-e-2"&&e.jsxs(g,{item:!0,xs:12,children:[e.jsx(z,{gutterBottom:!0,className:"title label",color:"text.primary",children:`${s("aiImageNumber")}: ${o.number}`}),e.jsx(n,{...x,children:e.jsx(L,{size:"small",defaultValue:1,valueLabelDisplay:"auto",step:1,min:1,max:10,value:o.number,onChange:(a,j)=>{a.stopPropagation(),o.number=Number(j)}})})]})]})}),e.jsx(O,{sx:{m:2,transition:"all 0.3s"},className:"submit-ai",variant:"contained",onClick:f,disabled:c,children:s(c?"aiImageGenerating":"aiImageGenerate")},c?"loading-submit":"submit")]})}const pe=I(n)`
|
|
3
3
|
display: flex;
|
|
4
4
|
flex-direction: column;
|
|
5
5
|
height: 100%;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as e,H as h,ah as Je,T as C,ab as A,e as Ze,cF as Z,ae as G,cG as Ge,aa as j,al as W,s as ge,ad as Se,be as et,cH as ze,a9 as ye,q,b4 as Y,b5 as H,y as tt,ap as st,bb as Ae}from"./vendor-mui-core-BV2FUxWJ.js";import{l as nt,i as Pe,f as fe}from"./vendor-hooks-BgUTpb6X.js";import{r as y,h as ot}from"./vendor-react-DEoibe3W.js";import{c as _,J as rt,a0 as at,V as it,a1 as ct,n as lt,G as dt,a2 as ue,I as ut}from"./vendor-arcblock-BlrkGjK9.js";import{a0 as D,a as T,b4 as pt,j as R,b9 as V,a9 as mt,r as je,bx as ft,B as pe,aq as ht,C as _e,au as xt}from"./vendor-ux-did-connect-2jRoUb28.js";import{G as O,D as M,y as w,a3 as gt,af as St,aE as yt}from"./index-
|
|
1
|
+
import{j as e,H as h,ah as Je,T as C,ab as A,e as Ze,cF as Z,ae as G,cG as Ge,aa as j,al as W,s as ge,ad as Se,be as et,cH as ze,a9 as ye,q,b4 as Y,b5 as H,y as tt,ap as st,bb as Ae}from"./vendor-mui-core-BV2FUxWJ.js";import{l as nt,i as Pe,f as fe}from"./vendor-hooks-BgUTpb6X.js";import{r as y,h as ot}from"./vendor-react-DEoibe3W.js";import{c as _,J as rt,a0 as at,V as it,a1 as ct,n as lt,G as dt,a2 as ue,I as ut}from"./vendor-arcblock-BlrkGjK9.js";import{a0 as D,a as T,b4 as pt,j as R,b9 as V,a9 as mt,r as je,bx as ft,B as pe,aq as ht,C as _e,au as xt}from"./vendor-ux-did-connect-2jRoUb28.js";import{G as O,D as M,y as w,a3 as gt,af as St,aE as yt}from"./index-DDoVX3je.js";import{u as jt}from"./use-mobile-BAa0wi8o.js";import{b as Q,d as Me,a7 as bt,I as Ct,E as Ue,A as he}from"./vendor-utils-rHXShPKm.js";import"./api-BjteVZFg.js";import{u as Ne,C as kt,D as Bt,a as Dt}from"./connect-to-Bz9wYM04.js";import{b as Et,c as wt,d as Tt,i as It,e as xe,f as Rt,h as vt,j as At}from"./spaces-DApg1wzn.js";import{f as X}from"./index-8eXqqyHQ.js";import{I as Ot}from"./index-BUHyq-oP.js";import{R as Lt}from"./index-J3Tqz9ZT.js";import{d as zt}from"./MoreHoriz-DpKn_fkc.js";import{c as Pt}from"./dashboard-xUr1SbPS.js";import{d as _t}from"./DeleteOutline-DpNyWtNL.js";import{g as Oe}from"./get-safe-url-c4iAcpvA.js";import{S as Mt}from"./switch-control-CpCSorUo.js";import{C as Ut,u as Nt}from"./config-space-EoSm62Er.js";import{L as Le}from"./list-header-xt282ZMS.js";import"./lottie-web-jYmAQWuC.js";import"./useLocalStorage-D6gvgmEW.js";import"./confirm-Vzr2I9eM.js";import"./PlayArrow-CDOOUxMp.js";import"./session-C_8V_o-O.js";import"./use-blocklet-logo-Bhkp-Zm7.js";import"./InfoOutlined-D3XnF0Vg.js";import"./dot-itVN8XTt.js";import"./useAsync-510ntT1B.js";import"./useSetState-CWq0AVWn.js";import"./use-mobile-C21X4TYN.js";async function Wt({blockletDid:t,nodeApi:r,spaceGateways:o}){let s=!1;const i=await Promise.all(o.map(async n=>{let{name:a}=n;const d=await Et(n.endpoint);return!Q(d)&&d!==a&&(a=d,s=!0),{...n,name:a}}));return s&&await Promise.all(i.filter(n=>n.did).map(n=>r.updateBlockletSpaceGateway({input:{did:t,where:{did:n.did},spaceGateway:{...n}}}))),i}function Ft({refresh:t}={}){var i;const{blocklet:r}=O(),o=(i=r==null?void 0:r.meta)==null?void 0:i.did,{api:s}=M();return nt(async()=>{if(!o)return[];const{spaceGateways:n}=await s.getBlockletSpaceGateways({input:{did:o}});return await Wt({blockletDid:o,nodeApi:s,spaceGateways:n})??[]},{refreshDeps:[o,t],onError(n){var a;(a=n==null?void 0:n.message)!=null&&a.includes("not logged")?console.warn(n):(console.error(n),D.error(X(n)))}})}function We({deps:t,setLoading:r,backupDate:o}={deps:[],setLoading:()=>{},backupDate:new Date}){var x;const{blocklet:s}=O(),[i,n]=y.useState([]),{api:a}=M(),[d,u]=y.useMemo(()=>o?[w(o).startOf("day").toISOString(),w(o).endOf("day").toISOString()]:[w().startOf("year").toISOString(),w().endOf("day").toISOString()],[o]),c=Me(async()=>{try{if(r(!0),!s){n([]);return}const{backups:p}=await a.getBlockletBackups({input:{did:s.meta.did,startTime:d,endTime:u}});n(p??[])}catch(p){console.error(p),D.error(X(p))}finally{r(!1)}},1e3);return Pe(async()=>{c()},[(x=s==null?void 0:s.meta)==null?void 0:x.did].concat(t)),{backups:i}}function Kt({appDid:t}){const{backups:r}=We(),[o,s]=y.useState({message:"",progress:0,completed:!1}),i=M(),{ws:{useSubscription:n}}=i;return n(_.BlockletEvents.backupProgress,a=>{t===(a==null?void 0:a.appDid)&&s(()=>({...a}))},[t]),y.useEffect(()=>{var a;if(r!=null&&r.length&&bt((a=r[0])==null?void 0:a.status)){const[d]=r;s(()=>({message:d.message,progress:d.progress,completed:d.progress>=100}))}},[r]),o}function $t({deps:t=[],setLoading:r=()=>{}}={}){var d;const{blocklet:o}=O(),[s,i]=y.useState([]),{api:n}=M(),a=y.useCallback(Me(async()=>{var u;if(!n||!((u=o==null?void 0:o.meta)!=null&&u.did)){i([]);return}try{r(!0);const c=w(),x=c.subtract(1,"year"),{summary:p}=await n.getBlockletBackupSummary({input:{did:o.meta.did,startTime:x.toISOString(),endTime:c.toISOString()}});i(Array.isArray(p)?p:[])}catch(c){console.error("Failed to fetch backup summary:",c),D.error(X(c)),i([])}finally{r(!1)}},1e3),[]);return Pe(async()=>(await a(),()=>{a.cancel()}),[(d=o==null?void 0:o.meta)==null?void 0:d.did].concat(t)),{backupSummary:s}}const Fe=y.createContext({}),{Provider:qt,Consumer:Ws}=Fe;function be({children:t}){var K;const{t:r}=T(),{api:o}=M(),{blocklet:s}=O(),[i,n]=y.useState(null),[a,d]=y.useState(!1),{data:u,loading:c,mutate:x}=Ft({refresh:a}),p=Ct(u),g=Kt({appDid:s==null?void 0:s.appDid}),f=y.useMemo(()=>wt(s==null?void 0:s.environments),[s==null?void 0:s.environments]),[b,B]=y.useState(!1),[S,l]=y.useState(!1),{backups:te}=We({deps:[S,i],setLoading:B,backupDate:i}),[se,ne]=y.useState(!1),{backupSummary:oe}=$t({deps:[se]}),[U,z]=y.useState(u==null?void 0:u.find(m=>m.endpoint===f)),I=(K=s==null?void 0:s.settings)==null?void 0:K.autoBackup,v=()=>{d(m=>!m)},re=()=>{ne(m=>!m)},ae=()=>{l(m=>!m)},F=async m=>{await o.updateAutoBackup({input:{did:s.meta.did,autoBackup:m}})},J=async()=>{await o.abortBlockletBackup({input:{appPid:s.meta.did}})},ie=async(m,N)=>{try{x(E=>{const P=[...E];return P.push({...m,loading:!0}),P}),await o.addBlockletSpaceGateway({input:{did:s.meta.did,spaceGateway:m}}),f!==N&&await o.configBlocklet({input:{did:[s.meta.did],configs:[{key:_.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:N}]}}),z(m),v(),D.success(r("storage.spaces.connectedWithName",{name:(m==null?void 0:m.name)??"DID Spaces"}))}catch(E){throw console.error(E),x(P=>[...P].filter(de=>de.did!==m.did)),E}},ce=async m=>{m&&(m.endpoint===f&&(await o.configBlocklet({input:{did:[s.meta.did],configs:[{key:_.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:""}]}}),I!=null&&I.enabled&&await F({enabled:!1})),await o.deleteBlockletSpaceGateway({input:{did:s.meta.did,spaceGatewayDid:m==null?void 0:m.did}}),x(N=>{const E=[...N];return E.splice(E.indexOf(m),1),E}),z(m),v())},le=async m=>{await Promise.all([o.updateBlockletSpaceGateway({input:{did:s.meta.did,where:{did:m.did},spaceGateway:m}}),f!==m.endpoint&&o.configBlocklet({input:{did:[s.meta.did],configs:[{key:_.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:m.endpoint}]}})]),D.success(r("storage.spaces.connectedWithName",{name:(m==null?void 0:m.name)??"DID Spaces"})),v()},k=m=>(m==null?void 0:m.endpoint)===f;return e.jsx(qt,{value:{spaceGateways:u||[],selectedSpaceGateway:U,addSpaceGateway:ie,deleteSpaceGateway:ce,updateSpaceGateway:le,refreshSpaceGateways:v,spaceGatewaysLoading:c,spaceGatewaysFirstLoading:p,spaceGatewayIsSelected:k,updateAutoBackup:F,abortBlockletBackup:J,backupEndpoint:f,backupProgress:g,backups:te,backupSummary:oe,refreshBackupSummary:re,refreshBackups:ae,setBackupDate:n,backupsLoading:b,autoBackup:I},children:t})}be.propTypes={children:h.any.isRequired};be.defaultProps={};function L(){return y.useContext(Fe)}function ee({...t}){const{blocklet:r}=O(),{info:o}=M(),{t:s}=T(),i=Ne({blocklet:r}),n=gt(o),{spaceGateways:a,addSpaceGateway:d}=L(),u={checkFn:Ue.create({baseURL:he(window.location.origin,St())}).get,webWalletUrl:n,extraParams:{appPid:r.appPid,appDid:i.appDid,appName:i.appName,appDescription:i.appDescription,appUrl:i.appUrl,referrer:i.referrer,scopes:i.scopes,nodeDid:o.did}},c=async({endpoint:p,name:g,did:f})=>{const b=await Tt(p);if(!await It(b)){D.error(s("storage.spaces.gateway.add.invalidUrl"));return}if(a.some(l=>l.endpoint===p)){D.error(s("storage.spaces.gateway.add.duplicate",{name:g}));return}await d({name:g,did:f,url:b,endpoint:p},p)},x=async({spaceGateway:p})=>{try{await c(p)}catch(g){console.error(g),D.error(X(g))}};return e.jsx(rt,{...t,options:u,onSuccess:x})}ee.propTypes={};ee.defaultProps={};function Ke({...t}){const{t:r}=y.useContext(pt),{blocklet:o,loadingDiskInfo:s,actions:i}=O();if(y.useEffect(()=>{i==null||i.refreshBlocklet({showError:!1,attachDiskInfo:!0})},[]),o.diskInfo){const n=(u,c,x)=>e.jsxs(C,{children:[u," ",e.jsx("strong",{children:c?yt(c):"empty"})]}),a=o.environments.reduce((u,c)=>(u[c.key]=c.value,u),{}),d=[{key:"appDir",name:r("blocklet.diskInfo.appDir"),value:n(a.BLOCKLET_APP_DIR,o.diskInfo.app)},{key:"dataDir",name:r("blocklet.diskInfo.dataDir"),value:n(a.BLOCKLET_DATA_DIR,o.diskInfo.data)},{key:"logDir",name:r("blocklet.diskInfo.logDir"),value:n(a.BLOCKLET_LOG_DIR,o.diskInfo.log)},{key:"cacheDir",name:r("blocklet.diskInfo.cacheDir"),value:n(a.BLOCKLET_CACHE_DIR,o.diskInfo.cache)}];return e.jsx(Yt,{component:"div",...t,children:d.map(u=>e.jsx(Ot,{valueComponent:"div",nameWidth:120,name:u.name,children:u.value},u.key))})}return s?e.jsx(A,{}):e.jsx(C,{children:r("blocklet.diskInfo.empty")})}const Yt=Je(C)``;function Ce(){const{t}=T(),{setBackupDate:r,backupSummary:o}=L(),s=at({key:"lg"}),i=y.useRef(null),n=Ze(),a=y.useCallback(c=>{r(c)},[r]),d=y.useMemo(()=>{const c=w().add(1,"day"),x=w().subtract(11,"month").startOf("month"),p=new Map(o.map(f=>[f.date,{date:f.date,successCount:f.successCount,errorCount:f.errorCount}])),g=[];for(let f=x.clone();w(f).isBefore(c);f=f.add(1,"day")){const b=f.format("YYYY-MM-DD");g.push(p.get(b)||{date:b,successCount:0,errorCount:0})}return g},[o]),u=y.useMemo(()=>({grid:{containLabel:!0,right:10,top:30,bottom:12},tooltip:{formatter:b=>{const{date:B,successCount:S,errorCount:l}=d[b.dataIndex]||{date:b.data[0],successCount:0,errorCount:0};return[`<div>${t("common.time")}: ${B}</div>`,`<div>${t("common.succeeded")}: ${S}</div>`,`<div>${t("common.failed")}: ${l}</div>`].join(`
|
|
2
2
|
`)},backgroundColor:n.palette.background.paper,borderColor:n.palette.divider,textStyle:{color:n.palette.text.primary,fontSize:14},extraCssText:`box-shadow: ${n.shadows[2]}; border-radius: 4px;`,padding:[8,10]},visualMap:{show:!1,min:-12,max:12,pieces:[{min:Number.MIN_SAFE_INTEGER,max:-9,color:Z[600]},{min:-9,max:-6,color:Z[500]},{min:-6,max:-3,color:Z[400]},{min:-3,max:-1,color:Z[300]},{min:0,max:0,color:n.palette.grey[200]},{min:1,max:3,color:G[300]},{min:3,max:6,color:G[400]},{min:6,max:9,color:G[500]},{min:9,max:Number.MAX_SAFE_INTEGER,color:G[600]}],orient:"horizontal",left:"center",bottom:12,itemWidth:12,itemHeight:12,textStyle:{color:n.palette.text.secondary,fontSize:12}},calendar:{top:30,left:50,right:10,bottom:4,cellSize:[8,8],splitLine:{show:!1},itemStyle:{borderWidth:2,borderColor:n.palette.background.default,color:n.palette.background.default},dayLabel:{show:!0,firstDay:0,nameMap:["","Mon","","Wed","","Fri",""],position:"start",margin:4,fontSize:10,color:n.palette.text.primary,fontWeight:"400",width:20},monthLabel:{show:!0,nameMap:"cn",align:"left",color:n.palette.text.primary,fontWeight:"400",fontSize:12,position:"start",margin:4,width:30,padding:[0,2]},yearLabel:{show:!1},range:[w().subtract(11,"month").startOf("month").format("YYYY-MM-DD"),w().endOf("month").format("YYYY-MM-DD")],orient:"horizontal"},series:{type:"heatmap",coordinateSystem:"calendar",data:d.map(b=>[b.date,b.errorCount?-b.errorCount:b.successCount]),label:{show:!1},itemStyle:{borderWidth:2,borderColor:n.palette.background.default,borderRadius:4},emphasis:{itemStyle:{borderWidth:2,borderColor:Ge[200],color:"inherit"}}}}),[d,t,n]);return e.jsxs(e.Fragment,{children:[e.jsx(j,{ref:i,sx:{maxWidth:"1280px",border:"1px solid",borderColor:"divider",padding:"8px",overflowX:"auto"},children:e.jsx(j,{sx:{width:"1200px",height:"180px",position:"relative"},children:e.jsx(Lt,{option:u,style:{height:"100%",width:"100%"},notMerge:!0,lazyUpdate:!1,opts:{renderer:"canvas"},onEvents:{click:c=>{c.componentType==="series"&&c.data&&a(c.data[0])}}})})}),e.jsx(j,{display:"flex",justifyContent:"flex-end",mt:1,mr:s?2:5,mb:2,children:e.jsxs(W,{direction:s?"column":"row",spacing:s?2:1,width:"100%",justifyContent:"flex-start",alignItems:s?"flex-start":"center",children:[e.jsxs(W,{direction:"row",alignItems:"center",spacing:1,children:[e.jsx(j,{width:32,height:12,borderRadius:.5,sx:{background:"linear-gradient(90deg, #8B5000 0%, #A36200 33%, #C17700 66%, #E29000 100%)"}}),e.jsx(C,{variant:"body2",color:"text.secondary",children:t("storage.spaces.backup.failed")})]}),e.jsxs(W,{direction:"row",alignItems:"center",spacing:1,children:[e.jsx(j,{width:32,height:12,borderRadius:.5,bgcolor:"grey.200",border:"1px solid",borderColor:"grey.200"}),e.jsx(C,{variant:"body2",color:"text.secondary",children:t("storage.spaces.backup.without")})]}),e.jsxs(W,{direction:"row",alignItems:"center",spacing:1,children:[e.jsx(j,{width:32,height:12,borderRadius:.5,sx:{background:"linear-gradient(90deg, #9be9a8 0%, #40c463 33%, #30a14e 66%, #216e39 100%)"}}),e.jsx(C,{variant:"body2",color:"text.secondary",children:t("storage.spaces.backup.succeeded")})]})]})})]})}Ce.propTypes={};const Ht=ge(({className:t,...r})=>e.jsx(Se,{...r,classes:{popper:t}}))(()=>({".MuiTooltip-tooltip":{backgroundColor:"transparent",padding:0,margin:0,boxShadow:"none",maxWidth:"none"},".MuiTooltip-arrow":{color:"rgba(230, 235, 245, 1)"}}));function ke({status:t,message:r,createdAt:o}){const{t:s}=T(),i=t===R.BACKUPS.STATUS.PROGRESS&&w().diff(o,"hours")>=R.BACKUPS.TIMEOUT_HOURS,n=i&&s("common.timeoutError"),a=t===R.BACKUPS.STATUS.PROGRESS&&!i,d=t===R.BACKUPS.STATUS.SUCCEEDED&&!i;return a?e.jsxs(C,{display:"inline-flex",alignItems:"center",fontSize:"14px",children:[e.jsx(A,{sx:{marginRight:"4px"},size:"12px"}),s("common.progress")]}):d?e.jsx(V,{type:"success",children:s("common.succeeded")}):e.jsxs(j,{display:"inline-flex",alignItems:"center",children:[e.jsx(V,{type:"error",children:s("common.failed")})," ",e.jsx(Se,{style:{display:"flex",alignItems:"center",flexShrink:0},title:r||n,children:e.jsx(ze,{children:e.jsx(it,{style:{width:"24px",height:"24px"},color:"error"})})})]})}ke.propTypes={status:h.string.isRequired,message:h.string,createdAt:h.string.isRequired};ke.defaultProps={message:""};function Be({metadata:t}){const{t:r}=T();if(Q(t))return e.jsx(V,{type:"success",children:r("common.succeeded")});const o=t.count||0,s=t.size||0,i=ct(s,{iec:!0}),n=e.jsxs(j,{p:1,sx:{color:"black",backgroundColor:"white"},borderRadius:1,boxShadow:2,children:[e.jsxs(C,{variant:"body2",children:[r("common.fileCount"),": ",o]}),e.jsxs(C,{variant:"body2",children:[r("common.fileSize"),": ",i]})]});return e.jsxs(j,{display:"inline-flex",alignItems:"center",children:[e.jsx(V,{type:"success",children:r("common.succeeded")})," ",e.jsx(Ht,{title:n,style:{display:"flex",alignItems:"center",flexShrink:0},placement:"left",children:e.jsx(ze,{children:e.jsx(lt,{style:{width:"24px",height:"24px"},color:"primary"})})})]})}Be.propTypes={metadata:h.object};Be.defaultProps={metadata:{}};function De(){const{t,locale:r}=T(),{spaceGateways:o,backups:s,backupsLoading:i}=L(),n=y.useMemo(()=>[{label:"DID Space",name:"target",options:{customBodyRenderLite:d=>{var B;const{targetUrl:u,targetName:c,status:x,createdAt:p}=s[d],g=x===R.BACKUPS.STATUS.PROGRESS&&w().diff(p,"hours")>=R.BACKUPS.TIMEOUT_HOURS,f=x===R.BACKUPS.STATUS.SUCCEEDED&&!g,b=c||((B=o.find(S=>u==null?void 0:u.includes(xe(S==null?void 0:S.endpoint))))==null?void 0:B.name)||"Unknown DID Space";return f?e.jsx(et,{fontSize:"16px",href:u,target:"_blank",children:b}):e.jsx(C,{variant:"body1",fontSize:"16px",children:b})}}},{label:t("common.strategy"),name:"strategy",options:{customBodyRender:d=>{const u=t(d===0?"common.auto":"common.manual");return e.jsx(V,{children:u})}}},{label:t("common.startTime"),name:"createdAt",options:{customBodyRender:d=>w(d).format("YYYY-MM-DD HH:mm:ss")}},{label:t("common.endTime"),name:"updatedAt",options:{customBodyRender:d=>Q(d)?"":w(d).format("YYYY-MM-DD HH:mm:ss")}},{label:t("common.status"),name:"status",options:{customBodyRenderLite:d=>{const u=(s==null?void 0:s[d])??{},{status:c,message:x,createdAt:p,metadata:g}=u,f=c===R.BACKUPS.STATUS.PROGRESS&&w().diff(p,"hours")>=R.BACKUPS.TIMEOUT_HOURS,b=c===R.BACKUPS.STATUS.PROGRESS&&!f,B=c===R.BACKUPS.STATUS.SUCCEEDED&&!f;return b?e.jsxs(C,{display:"inline-flex",alignItems:"center",fontSize:"14px",children:[e.jsx(A,{sx:{marginRight:"4px"},size:"12px"}),t("common.progress")]}):B?e.jsx(Be,{metadata:g}):e.jsx(ke,{status:c,message:x,createdAt:p})}}}],[s,o,t]),a=y.useMemo(()=>!(s!=null&&s.length),[s]);return e.jsx(e.Fragment,{children:a?e.jsx(j,{display:"flex",justifyContent:"center",alignItems:"center",height:"100px",color:"#9397A1",marginTop:"16px",marginBottom:"24px",children:t("storage.spaces.record.emptyData")}):e.jsx(mt,{title:"",loading:i,data:s,columns:n,emptyNode:t("storage.spaces.record.emptyData",r),options:{download:!1,filter:!1,print:!1,search:!1,viewColumns:!1}})})}De.propTypes={};function $e(){const{t}=T();return e.jsxs(j,{children:[e.jsxs(j,{display:"flex",gap:3,flexDirection:{xs:"column",md:"row"},children:[e.jsxs(j,{display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",alignContent:"center",minWidth:240,children:[e.jsx(dt,{style:{cursor:"pointer",width:"150px",height:"100%",maxHeight:160}}),e.jsx(C,{my:2,sx:{textAlign:"center",color:"text.secondary"},children:t("storage.spaces.connect.provider")}),e.jsx(ee,{})]}),e.jsxs(j,{sx:{flexGrow:1,minWidth:0},children:[e.jsx(j,{display:"flex",justifyContent:"space-between",alignItems:"center",mb:3,children:e.jsx(C,{fontSize:"1.2rem",fontWeight:"bold",children:t("storage.spaces.backup.records")})}),e.jsx(Ce,{})]})]}),e.jsx(De,{sx:{marginTop:"24px"}}),e.jsx(C,{fontSize:"1.2rem",fontWeight:"bold",mb:2,mt:2,children:t("common.dataStorage")}),e.jsx(Ke,{})]})}$e.propTypes={};var Ee={},Vt=ye;Object.defineProperty(Ee,"__esModule",{value:!0});var qe=Ee.default=void 0,Qt=Vt(je()),Xt=e;qe=Ee.default=(0,Qt.default)((0,Xt.jsx)("path",{d:"M6 6v2h8.59L5 17.59 6.41 19 16 9.41V18h2V6z"}),"ArrowOutward");var we={},Jt=ye;Object.defineProperty(we,"__esModule",{value:!0});var Ye=we.default=void 0,Zt=Jt(je()),Gt=e;Ye=we.default=(0,Zt.default)((0,Gt.jsx)("path",{d:"M14.69 2.21 4.33 11.49c-.64.58-.28 1.65.58 1.73L13 14l-4.85 6.76c-.22.31-.19.74.08 1.01.3.3.77.31 1.08.02l10.36-9.28c.64-.58.28-1.65-.58-1.73L11 10l4.85-6.76c.22-.31.19-.74-.08-1.01-.3-.3-.77-.31-1.08-.02"}),"ElectricBoltOutlined");var Te={},es=ye;Object.defineProperty(Te,"__esModule",{value:!0});var He=Te.default=void 0,ts=es(je()),ss=e;He=Te.default=(0,ts.default)((0,ss.jsx)("path",{d:"m9.17 6 2 2H20v10H4V6zM10 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2h-8z"}),"FolderOutlined");function Ie({spaceGateway:t,onConfirm:r,onCancel:o}){const{t:s}=T(),[i,n]=y.useState(!1),[a,d]=y.useState(!1),u=(p,g)=>{p==null||p.preventDefault(),p==null||p.stopPropagation(),n(g)},c=async p=>{try{p==null||p.stopPropagation(),d(!0),await(r==null?void 0:r(t)),n(!1)}catch(g){console.error(g),D.error(`${s("storage.space.gateway.delete.failed")}: ${X(g)}`)}finally{n(!1),d(!1)}},x=p=>{u(p,!1),o==null||o(p)};return e.jsxs(e.Fragment,{children:[e.jsxs(q,{color:"red",onClick:p=>u(p,!0),children:[e.jsx(Y,{style:{minWidth:24,color:"red"},children:e.jsx(_t,{fontSize:"small"})}),e.jsx(H,{style:{color:"red"},children:s("common.delete")})]}),e.jsx(ft,{title:s("storage.spaces.gateway.delete.title"),open:i,confirmButton:{text:s("common.confirm"),props:{size:"small",variant:"contained",color:"error",loading:a}},cancelButton:{text:s("common.cancel"),props:{size:"small",variant:"outlined",disabled:a}},onConfirm:c,onCancel:x,children:e.jsx(C,{sx:{wordWrap:"break-word"},children:s("storage.spaces.gateway.delete.descForBackup",{name:`${t==null?void 0:t.name}`})})})]})}Ie.propTypes={spaceGateway:h.shape({name:h.string.isRequired,url:h.string.isRequired,protected:h.bool}).isRequired,onConfirm:h.func,onCancel:h.func};Ie.defaultProps={onConfirm:()=>{},onCancel:()=>{}};function Re({spaceGateway:t,selected:r,onDelete:o,onConnect:s,enableSwitchToSpace:i,backupInProgress:n,...a}){const{abortBlockletBackup:d}=L(),[u,c]=y.useState(null),{t:x}=T(),[p,g]=y.useState(!1),f=(S,l)=>{S.stopPropagation(),S.preventDefault(),c(l&&S.currentTarget)},b=async S=>{try{g(!0),f(S,!1),await s(t)}catch(l){console.error(l),D.error(l.message)}finally{g(!1)}},B=async S=>{try{g(!0),f(S,!1),await d()}catch(l){console.error(l),D.error(l.message)}finally{g(!1)}};return e.jsxs(e.Fragment,{children:[p||t!=null&&t.loading?e.jsx(A,{sx:{ml:1},size:"24px"}):e.jsx(tt,{"aria-label":"more","aria-controls":"actions-menu","aria-haspopup":"true","data-cy":"trigger-blocklet-actions",variant:"outlined",size:"small",onClick:S=>f(S,!0),...a,children:e.jsx(zt,{})}),e.jsxs(st,{id:"simple-menu",anchorEl:u,keepMounted:!0,open:!!u,onClose:S=>f(S,!1),children:[e.jsxs(q,{onClick:S=>{f(S,!1),window.open(Oe(t.endpoint?Rt(t.endpoint):t.url,{allowDomains:null}))},children:[e.jsx(Y,{style:{minWidth:24},children:e.jsx(qe,{fontSize:"small"})}),e.jsx(H,{children:x("common.open")})]}),e.jsxs(q,{onClick:S=>{f(S,!1),window.open(Oe(vt(t.endpoint),{allowDomains:null}))},children:[e.jsx(Y,{style:{minWidth:24},children:e.jsx(He,{fontSize:"small"})}),e.jsx(H,{children:x("storage.spaces.strategy.viewBackupFiles")})]}),!r&&i&&e.jsxs(q,{onClick:b,children:[e.jsx(Y,{style:{minWidth:24},children:e.jsx(Ye,{fontSize:"small"})}),e.jsx(H,{children:x("storage.spaces.connect.switchToSpace")})]}),n&&e.jsxs(q,{onClick:B,children:[e.jsx(Y,{style:{minWidth:24},children:e.jsx(Pt,{fontSize:"small"})}),e.jsx(H,{children:x("storage.spaces.connect.abortBlockletBackup")})]}),!n&&e.jsx(Ie,{spaceGateway:t,onConfirm:async()=>{c(null),await(o==null?void 0:o(t))},onCancel:()=>c(null)})]})]})}Re.propTypes={spaceGateway:h.shape({name:h.string.isRequired,url:h.string.isRequired,protected:h.bool,endpoint:h.string.isRequired,loading:h.bool}).isRequired,selected:h.bool.isRequired,enableSwitchToSpace:h.bool,onDelete:h.func,onConnect:h.func,backupInProgress:h.bool};Re.defaultProps={onDelete:()=>{},onConnect:()=>{},enableSwitchToSpace:!0,backupInProgress:!1};const ns=ge(({className:t,...r})=>e.jsx(Se,{...r,classes:{popper:t}}))(()=>({".MuiTooltip-tooltip":{backgroundColor:"transparent",padding:0,margin:0,boxShadow:"none",maxWidth:"none"},".MuiTooltip-arrow":{color:"rgba(230, 235, 245, 1)"}}));function ve({spaceGateway:t,spaceStatus:r,selected:o,onConnected:s,onDeleted:i,onBackedUp:n}){const{t:a,locale:d}=T(),{blocklet:u}=O(),{api:c,info:{did:x}}=M(),{appDid:p,appName:g,appDescription:f,scopes:b,appUrl:B,referrer:S}=Ne({blocklet:u}),{backupProgress:l,updateSpaceGateway:te,deleteSpaceGateway:se,refreshBackupSummary:ne,refreshBackups:oe}=L(),[U,z]=y.useState(!1),[I,v]=y.useState({open:!1,action:"one-click-authorization",checkTimeout:1e3*300,messages:{title:a("storage.spaces.authorize.title",{appName:g},d),scan:a("storage.spaces.authorize.scan",{appName:g},d),confirm:"",success:e.jsx(C,{gutterBottom:!0,children:a("storage.spaces.authorize.success")})},onClose:()=>{v(k=>({...k,open:!1}))}}),re=o&&!U&&r===ue.DISCONNECTED,ae=o&&!U&&!t.loading&&r===ue.CONNECTED,F=o&&U&&r===ue.CONNECTED&&(l==null?void 0:l.progress)>=0,J=async()=>{try{if(await At(t==null?void 0:t.endpoint)){await c.configBlocklet({input:{did:[u.meta.did],configs:[{key:_.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:t.endpoint}]}}),D.success(a("storage.spaces.connect.switchToSpaceSucceeded",{name:t.name?`(${t.name})`:""})),s==null||s(null,t);return}}catch(k){console.error(k),s==null||s(k,t);return}v(k=>({...k,open:!0,prefix:he(t.url,"space/api/did"),baseUrl:new URL(t.url).origin,checkFn:Ue.create({baseURL:he(t.url,"space")}).get,extraParams:{appDid:p,appName:g,appDescription:f,scopes:b,appUrl:B,referrer:S,nodeDid:x,spaceDid:t.did}}))},ie=async(k,K)=>{const m=K(k.endpoint),N=xe(m),E=k.space?K(k.space):{};if(t.did&&N!==t.did){v(de=>({...de,open:!1}));const $=a("storage.spaces.gateway.switch.failedForMismatchSpace",{name:E!=null&&E.name?E.name:""});D.error($),s==null||s(new Error($),t);return}const P={...t,name:E.name??"DID Space",did:E.did??xe(m),endpoint:m};await te(P),v($=>({...$,open:!1})),s==null||s(null,P)},ce=async()=>{try{if(U)return;z(!0),await c.backupBlocklet({input:{appDid:u.appDid,to:"spaces"}})}catch(k){console.error(k),D.error(k.message),n==null||n(k,t)}finally{z(!0)}},le=async()=>{try{await se(t),D.success(a("storage.spaces.gateway.delete.succeeded",{name:t.name?`(${t.name})`:""})),i==null||i(null,t)}catch(k){console.error(k),i==null||i(k,t)}};return y.useEffect(()=>{l!=null&&l.completed?(o&&((l==null?void 0:l.progress)===100?(D.success(a("storage.spaces.backupSuccessfully")),n==null||n(null,t)):l.message&&(n==null||n(new Error(l==null?void 0:l.message),t)),l.progress=0,l.message=""),z(!1),setTimeout(()=>{ne(),oe()},1e3)):l.progress&&z(!0)},[l]),e.jsxs(e.Fragment,{children:[e.jsxs(j,{sx:{".action-btn":{borderRadius:1,marginLeft:1}},display:"flex",alignItems:"center",children:[ae&&e.jsx(pe,{className:"action-btn",variant:"outlined",size:"small",onClick:ce,children:a("storage.spaces.strategy.backupNow")}),re&&e.jsx(pe,{className:"action-btn",variant:"outlined",size:"small",onClick:J,children:a("storage.spaces.disconnected.reconnectNow")}),F&&e.jsx(ns,{title:(l==null?void 0:l.message)&&e.jsx(j,{p:1,sx:{color:"black",backgroundColor:"white"},borderRadius:1,boxShadow:2,children:e.jsx(C,{variant:"body2",children:l.message})}),children:e.jsxs(pe,{className:"action-btn",variant:"outlined",size:"small",sx:{minWidth:70},children:[e.jsx(A,{variant:"determinate",value:l==null?void 0:l.progress,size:14,sx:{mr:1}}),l==null?void 0:l.progress,"%"]})}),e.jsx(ht,{forceConnected:!1,saveConnect:!1,prefix:I.prefix,open:I.open,popup:!0,action:I.action,baseUrl:I.baseUrl,checkFn:I.checkFn,onSuccess:ie,onClose:I.onClose,checkTimeout:I.checkTimeout,extraParams:I.extraParams,messages:I.messages,locale:d},"get-endpoint")]}),e.jsx(Re,{sx:{minWidth:32,padding:"2px 4px",ml:1},spaceGateway:t,selected:o,onDelete:le,onConnect:J,enableSwitchToSpace:(l==null?void 0:l.completed)||Q(l==null?void 0:l.message),backupInProgress:F})]})}ve.propTypes={spaceGateway:h.shape({did:h.string.isRequired,name:h.string.isRequired,url:h.string.isRequired,endpoint:h.string.isRequired,protected:h.bool,loading:h.bool}).isRequired,spaceStatus:h.string.isRequired,selected:h.bool.isRequired,onConnected:h.func,onDeleted:h.func,onBackedUp:h.func};ve.defaultProps={onConnected:()=>{},onDeleted:()=>{},onBackedUp:()=>{}};function Ve({...t}){const{t:r}=T();return e.jsxs(j,{...t,children:[e.jsx(j,{display:"flex",justifyContent:"space-between",alignItems:"center",mb:3,children:e.jsx(C,{fontSize:"1.2rem",fontWeight:"bold",children:r("storage.spaces.backup.records")})}),e.jsx(Ce,{}),e.jsx(De,{})]})}Ve.propTypes={};function Qe({...t}){const{t:r}=T(),{autoBackup:o,updateAutoBackup:s}=L(),i=async()=>{try{const n=!(o!=null&&o.enabled);await s({enabled:n}),D.success(r(n?"storage.spaces.autoBackup.enabled":"storage.spaces.autoBackup.disabled"))}catch(n){D.error(n.message)}};return e.jsx(Mt,{checked:!!(o!=null&&o.enabled),onChange:i,name:"enableWelcomePage",labelProps:{label:e.jsx(C,{marginRight:"8px",children:e.jsx("span",{children:r("storage.spaces.autoBackup.title")})})},style:{...t.style}})}Qe.propTypes={};function os(){const{t}=T(),{spaceGateways:r,spaceGatewaysLoading:o,spaceGatewayIsSelected:s}=L(),i=o&&!(r!=null&&r.length),n=({spaceGateway:a,spaceStatus:d,selected:u,refresh:c})=>e.jsx(ve,{spaceGateway:a,spaceStatus:d,selected:u,onConnected:()=>c(),onBackedUp:x=>x&&c()});return e.jsxs(j,{display:"flex",flexDirection:"column",children:[e.jsxs(j,{sx:{display:"flex",flexDirection:{xs:"column",md:"row"},gap:{xs:1,md:2},justifyContent:{xs:"center",md:"flex-start"},alignItems:{xs:"flex-start",md:"center"}},children:[e.jsx(C,{fontSize:"1.2rem",fontWeight:"bold",flexGrow:1,children:t("storage.spaces.connected.title")}),e.jsx(Qe,{}),e.jsx(ee,{})]}),e.jsx(j,{mt:2,children:i?e.jsx(j,{display:"flex",justifyContent:"center",children:e.jsx(A,{})}):e.jsx(Ae,{container:!0,spacing:2,children:e.jsx(e.Fragment,{children:r.map(a=>e.jsx(Ae,{item:!0,xs:12,md:6,children:e.jsx(ut,{endpoint:a.endpoint,selected:s(a),action:n},a.endpoint)}))})})}),e.jsx(Ve,{sx:{marginTop:"24px"}}),e.jsx(C,{fontSize:"1.2rem",fontWeight:"bold",mb:2,children:t("common.dataStorage")}),e.jsx(Ke,{})]})}function rs(){const{spaceGatewaysFirstLoading:t,spaceGateways:r}=L();return t?e.jsx(_e,{relative:"parent",children:e.jsx(A,{})}):Q(r)?e.jsx($e,{}):e.jsx(os,{})}function as(){return e.jsx(be,{children:e.jsx(rs,{})})}function is(){const{spaceGateway:t,settingStorageEndpoint:r,updateSpaceGateway:o,hasStorageEndpoint:s,loading:i,storageEndpoint:n}=Nt(),a=fe(()=>({display:"flex",alignItems:"center",justifyContent:"center",paddingTop:"16px"}));return i?e.jsx(_e,{relative:"parent",children:e.jsx(A,{})}):e.jsxs(j,{sx:{maxWidth:"md",position:"relative"},children:[s?e.jsx(kt,{spaceGateway:t,settingStorageEndpoint:r}):e.jsx(Bt,{}),e.jsx(j,{sx:a,children:e.jsx(Dt,{onConnect:o,storageEndpoint:n})})]})}function cs(){const{t}=T();return e.jsxs(Ut,{children:[e.jsxs(W,{spacing:1,marginBottom:2,children:[e.jsx(C,{fontSize:"1.2rem",fontWeight:"bold",children:t("storage.appLevel.title")}),e.jsx(C,{color:"text.secondary",children:t("storage.appLevel.description")})]}),e.jsx(is,{})]})}function Xe({navOrientation:t,...r}){const{t:o,locale:s}=T(),{blocklet:i}=O(),n=jt({key:"md"}),[a,d]=ot(),u=a.get("tab")||"backup",c=n?"horizontal":t,x=fe(()=>{var l;const B=[{label:o("common.backup"),value:"backup"}],S=(l=i==null?void 0:i.capabilities)==null?void 0:l.didSpace;return(S===_.BLOCKLET_APP_SPACE_REQUIREMENT.REQUIRED||S===_.BLOCKLET_APP_SPACE_REQUIREMENT.REQUIRED_ON_SETUP)&&B.push({label:o("common.storage"),value:"storage"}),B},[s,c]),g=fe(()=>({backup:e.jsx(as,{}),storage:e.jsx(cs,{})}))[u],f=B=>{d(S=>(B==="backup"?S.delete("tab"):S.set("tab",B),S))};if(x.length<=1)return e.jsx(me,{children:g});const b=e.jsx(xt,{tabs:x,current:u,orientation:c,onChange:f,sx:[{borderRight:1,height:"100%",borderColor:"divider"},c==="horizontal"&&{borderRight:0}]});if(c==="vertical")return e.jsx(j,{...r,children:e.jsxs(W,{direction:{md:"column",lg:"row"},gap:2,children:[e.jsx(j,{sx:{flexShrink:0},children:e.jsx(Le,{left:b})}),e.jsx(j,{sx:{flexGrow:1,minWidth:0},children:e.jsx(me,{sx:{mt:1},children:g})})]})});if(c==="horizontal")return e.jsxs(j,{...r,children:[e.jsx(Le,{left:b}),e.jsx(me,{sx:{mt:2},children:g})]})}Xe.propTypes={navOrientation:h.oneOf(["vertical","horizontal"])};Xe.defaultProps={navOrientation:"vertical"};const me=ge(j)`
|
|
3
3
|
position: relative;
|
|
4
4
|
min-height: 66vh;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as u}from"./vendor-react-DEoibe3W.js";import{H as o,j as e,aa as b,b3 as A,O as K,c1 as B,I as O,ab as M,ah as W}from"./vendor-mui-core-BV2FUxWJ.js";import{b4 as X,aP as $,d as H}from"./vendor-ux-did-connect-2jRoUb28.js";import{d as G}from"./Done-BTd13H2U.js";import{A as U,a as Y,d as J,b as Q}from"./collapse-l9wHY9gJ.js";import{C as Z}from"./Google-Bn3zPWiu.js";import{ad as v,f as ee}from"./index-
|
|
1
|
+
import{r as u}from"./vendor-react-DEoibe3W.js";import{H as o,j as e,aa as b,b3 as A,O as K,c1 as B,I as O,ab as M,ah as W}from"./vendor-mui-core-BV2FUxWJ.js";import{b4 as X,aP as $,d as H}from"./vendor-ux-did-connect-2jRoUb28.js";import{d as G}from"./Done-BTd13H2U.js";import{A as U,a as Y,d as J,b as Q}from"./collapse-l9wHY9gJ.js";import{C as Z}from"./Google-Bn3zPWiu.js";import{ad as v,f as ee}from"./index-DDoVX3je.js";import{R as ne,F as te,L as re}from"./logo-uploader-CLwbDhA_.js";const S={description:o.string,editing:o.bool,onChange:o.func,required:o.bool,value:o.any,componentProps:o.object,render:o.func,renderFormItem:o.func};function T({editing:n,value:s,onChange:i}){const[a,d]=u.useState(!1),f=u.useRef(),m=u.useRef(s);u.useEffect(()=>{let l=null;return n&&(l=setTimeout(()=>{d(!0)},50)),()=>{clearTimeout(l)}},[n]);const x=l=>{m.current=l,i(l)},j=()=>{d(!1),i(m.current)},y=e.jsx(b,{className:"form-item-input slot",px:1,children:e.jsxs(b,{display:"flex",alignItems:"center",children:[s,s!=="auto"&&e.jsx("div",{style:{marginLeft:4,backgroundColor:s,width:"1em",height:"1em",borderRadius:"0.2em"}})]})}),p=e.jsxs(b,{display:"flex",flexGrow:1,alignItems:"center",height:"40px",onKeyDown:j,children:[e.jsx(b,{display:"flex",alignItems:"center",onClick:()=>d(!0),children:e.jsx("div",{ref:f,style:{flexShrink:0,marginLeft:"8px",backgroundColor:s,width:"32px",height:"32px",boxSizing:"border-box",borderRadius:"8px",border:"1px solid #eee",cursor:s==="auto"?"default":"pointer"}})}),e.jsx(A,{open:a,anchorEl:f.current,onClose:()=>d(!1),anchorOrigin:{vertical:"bottom",horizontal:"center"},transformOrigin:{vertical:"top",horizontal:"center"},children:e.jsx(Z,{color:s,onChange:l=>x(l.hex)})})]});return n?p:y}T.propTypes=S;function _({editing:n,description:s,value:i,onChange:a,componentProps:d,...f}){const{placeholder:m}=d,x=u.useRef(i),{t:j}=u.useContext(X),y=l=>{l.key==="Enter"&&a(x.current,"confirm")},p=l=>{x.current=l,a(l)};return n?e.jsx(K,{style:{flex:1},fullWidth:!0,value:i,onChange:l=>{l.persist(),p(l.target.value)},autoFocus:!0,size:"small",variant:"outlined",placeholder:s||m,onKeyDown:y,...f}):e.jsx(b,{px:1,className:"form-item-input slot",children:i||e.jsx("span",{className:"placeholder",children:j("common.requiredInputPlaceholder",{name:s||m})})})}_.propTypes=S;_.defaultProps={componentProps:{}};function D({editing:n,value:s,onChange:i,componentProps:a,...d}){const{blocklet:f}=a,m=s==="auto"?$.getPassportColorFromDid(f.appDid):s;return e.jsxs(b,{display:"flex",alignItems:"center",children:[e.jsx("div",{style:{width:96,marginRight:12},dangerouslySetInnerHTML:{__html:v({title:"Owner",issuer:ee.getDisplayName(f),issuerDid:f.appDid,ownerName:"Your Name",ownerDid:f.appDid,preferredColor:s||"auto"})}}),e.jsx(T,{...d,editing:n,value:n?m:s,onChange:i,componentProps:a})]})}D.propTypes={...S,componentProps:o.shape({blocklet:o.object.isRequired}).isRequired};D.defaultProps={};const oe=B`
|
|
2
2
|
0%, 100% {
|
|
3
3
|
transform: scale(1) translateX(0);
|
|
4
4
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{H as i,ah as v,j as s,bH as A,aa as N,ab as D,s as $}from"./vendor-mui-core-BV2FUxWJ.js";import{a as E,m as H,u as b,l as M}from"./vendor-hooks-BgUTpb6X.js";import{a as q,R as F}from"./vendor-arcblock-BlrkGjK9.js";import{r as m}from"./vendor-react-DEoibe3W.js";import{b4 as U,ao as B,a as j,aT as O,j as Y,b5 as S,$ as W}from"./vendor-ux-did-connect-2jRoUb28.js";import{y as V,z as X,A as L,B as z}from"./index-
|
|
1
|
+
import{H as i,ah as v,j as s,bH as A,aa as N,ab as D,s as $}from"./vendor-mui-core-BV2FUxWJ.js";import{a as E,m as H,u as b,l as M}from"./vendor-hooks-BgUTpb6X.js";import{a as q,R as F}from"./vendor-arcblock-BlrkGjK9.js";import{r as m}from"./vendor-react-DEoibe3W.js";import{b4 as U,ao as B,a as j,aT as O,j as Y,b5 as S,$ as W}from"./vendor-ux-did-connect-2jRoUb28.js";import{y as V,z as X,A as L,B as z}from"./index-DDoVX3je.js";import{A as J}from"./vendor-utils-rHXShPKm.js";import{u as K}from"./use-passport-id-B-b-_oYF.js";import{u as G}from"./session-C_8V_o-O.js";import{b as Q}from"./sdk-DeS3iq37.js";import{d as Z}from"./CheckCircle-Caqp5gKY.js";import{w as ee}from"./wrap-locale-C_UOH97U.js";function P({invitation:e,createPassportSvg:a,passportColor:c}){const[p,n]=m.useState(!1),{t}=m.useContext(U),l=m.useMemo(()=>(e.role.title||e.role.name).toUpperCase(),[e.role.title,e.role.name]),u=m.useMemo(()=>a({title:l,issuer:e.info.name,issuerDid:e.info.appDid,ownerName:"Your Name",ownerDid:e.info.appDid,preferredColor:e.info.passportColor||c,extra:e.passportExpireTime?{key:"Exp",value:V(e.passportExpireTime).format("YYYY-MM-DD HH:mm:ss")}:void 0}),[e,l]),f=m.useCallback(()=>{n(!0)},[]),r=m.useCallback(()=>{n(!1)},[]);return s.jsxs(s.Fragment,{children:[s.jsx(se,{children:s.jsxs("div",{className:"invite-passport__card",onClick:f,children:[!!e.display&&s.jsx(q,{data:e.display,style:{width:"100%",height:"100%"}}),!e.display&&s.jsx("div",{className:"invite-passport__cover",dangerouslySetInnerHTML:{__html:u}})]})}),s.jsx(B,{open:p,title:t("invite.viewPermission"),PaperProps:{style:{minHeight:"auto",paddingBottom:"20px"}},onClose:r,children:e.role.permissions&&e.role.permissions.length>0?s.jsx("ul",{style:{listStyle:"circle",padding:"0 20px"},children:e.role.permissions.map(o=>s.jsx("li",{style:{listStyle:"circle"},children:o.description},o.name))}):s.jsxs("div",{style:{color:"#999",textAlign:"center"},children:[s.jsx(A,{style:{width:"30px",height:"30px"}}),s.jsx("div",{children:t("invite.emptyPermission")})]})})]})}P.propTypes={invitation:i.object.isRequired,createPassportSvg:i.func.isRequired,passportColor:i.string};P.defaultProps={passportColor:"auto"};const se=v.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
max-width: 350px;
|
|
4
4
|
margin: 30px auto;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as i,aa as g}from"./vendor-mui-core-BV2FUxWJ.js";import{f as x,r as v}from"./vendor-react-DEoibe3W.js";import{u}from"./vendor-hooks-BgUTpb6X.js";import{I as w}from"./invitation-
|
|
1
|
+
import{j as i,aa as g}from"./vendor-mui-core-BV2FUxWJ.js";import{f as x,r as v}from"./vendor-react-DEoibe3W.js";import{u}from"./vendor-hooks-BgUTpb6X.js";import{I as w}from"./invitation-Dsnc8lab.js";import{L as I}from"./landing-page-DrVLCVAm.js";import{a as S,aV as j,j as P}from"./vendor-ux-did-connect-2jRoUb28.js";import{H as T}from"./vendor-arcblock-BlrkGjK9.js";import{g as k}from"./get-safe-url-Q70tRxL7.js";import{u as E,d as L,c as R,s as W,a as C}from"./index-DDoVX3je.js";import"./vendor-utils-rHXShPKm.js";import"./use-passport-id-B-b-_oYF.js";import"./session-C_8V_o-O.js";import"./sdk-DeS3iq37.js";import"./CheckCircle-Caqp5gKY.js";import"./wrap-locale-C_UOH97U.js";import"./lottie-web-jYmAQWuC.js";function y(c){var r;const m=x(),{searchParams:s}=new URL(window.location.href),{api:p,session:d}=E(),{t:f}=S(),a=s.get("inviteId"),n=s.get("redirect"),h=v.useCallback(async()=>{const{data:t}=await L.get("invitation",{params:{inviteId:a}});return t},[a]),l=u(async(t,o=e=>e)=>{t&&(W(o(t.sessionToken)),C(o(t.refreshToken)),t.visitorId&&j(o(t.visitorId))),await d.refresh(),setTimeout(()=>{if(n){const e=decodeURIComponent(n);e.startsWith(P.WELLKNOWN_SERVICE_PATH_PREFIX)?m(e,{replace:!0}):window.location.href=k(e)}else window.location.href=window.env.pathPrefix||"/"},50)});return i.jsxs(I,{did:(r=window.blocklet)==null?void 0:r.appPid,children:[i.jsx(T,{children:i.jsx("title",{children:f("pageTitle.invite")})}),i.jsx(g,{sx:{width:"560px",maxWidth:"100%",height:"100%"},className:"page-invite",children:i.jsx(w,{...c,getDataFn:h,checkFn:p.get,createPassportSvg:t=>R({...t}),onLoginSuccess:l,inService:!0})})]})}export{y as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e,ab as w,aa as v}from"./vendor-mui-core-BV2FUxWJ.js";import{a as I,l as P,u as p}from"./vendor-hooks-BgUTpb6X.js";import{I as T}from"./invitation-
|
|
1
|
+
import{j as e,ab as w,aa as v}from"./vendor-mui-core-BV2FUxWJ.js";import{a as I,l as P,u as p}from"./vendor-hooks-BgUTpb6X.js";import{I as T}from"./invitation-Dsnc8lab.js";import{L as j}from"./landing-page-DrVLCVAm.js";import{a as k,aV as R,j as S}from"./vendor-ux-did-connect-2jRoUb28.js";import{H as L}from"./vendor-arcblock-BlrkGjK9.js";import{g as E}from"./get-safe-url-Q70tRxL7.js";import{u as C,c as W,s as F,a as N}from"./index-DDoVX3je.js";import{f as H}from"./vendor-react-DEoibe3W.js";import"./vendor-utils-rHXShPKm.js";import"./use-passport-id-B-b-_oYF.js";import"./session-C_8V_o-O.js";import"./sdk-DeS3iq37.js";import"./CheckCircle-Caqp5gKY.js";import"./wrap-locale-C_UOH97U.js";import"./lottie-web-jYmAQWuC.js";function Q(f){var m;const{searchParams:a}=new URL(window.location.href),{api:r,session:d}=C(),u=H(),{t:h}=k(),n=a.get("id"),c=a.get("redirect"),l=I({state:""}),s=P(async()=>{if(!n)return null;const{data:t}=await r.get("/api/invitation",{params:{inviteId:n,mode:"issue-passport"}});return t}),g=p(()=>{if(s.error)throw s.error;return s==null?void 0:s.data}),x=p(async(t,i=o=>o)=>{t&&(t.sessionToken&&F(i(t.sessionToken)),t.refreshToken&&N(i(t.refreshToken)),t.visitorId&&R(i(t.visitorId)),await d.refresh()),setTimeout(()=>{if(c){const o=decodeURIComponent(c);o.startsWith(S.WELLKNOWN_SERVICE_PATH_PREFIX)?u(o,{replace:!0}):window.location.href=E(o)}else window.location.href=window.env.pathPrefix||"/"},50)});return s.loading?e.jsx(w,{}):e.jsxs(j,{did:(m=window.blocklet)==null?void 0:m.appPid,children:[e.jsx(L,{children:e.jsx("title",{children:h("pageTitle.issuePassport")})}),e.jsx(v,{className:"page-invite",sx:{width:"560px",maxWidth:"100%",height:"100%"},children:e.jsx(T,{...f,action:"issue-passport",getDataFn:g,checkFn:r.get,createPassportSvg:W,onLoginSuccess:x,inService:!0,status:l.state})})]})}export{Q as default};
|