@abtnode/blocklet-services 1.16.45-beta-20250618-073451-6e48fb62 → 1.16.45-beta-20250620-082630-c0c76051
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-C9hWo6TU.js +1 -1
- package/dist/assets/add-component-core-CpBArNQj.js +1 -1
- package/dist/assets/add-resource-YRx2pKzx.js +1 -1
- package/dist/assets/advanced-C9eBqn30.js +1 -1
- package/dist/assets/appearance-DzftIlmu.js +1 -1
- package/dist/assets/audit-logs-Cljb9yLV.js +1 -1
- package/dist/assets/complete-D2In_TeH.js +1 -1
- package/dist/assets/component-DN1QsNYm.js +1 -1
- package/dist/assets/config-DS_kGhWk.js +1 -1
- package/dist/assets/config-navigation-BB2LlxWl.js +1 -1
- package/dist/assets/dashboard-CpxtvWAW.js +2 -2
- package/dist/assets/domain-C7iO-bfS.js +1 -1
- package/dist/assets/fuel-BRI4NZNF.js +1 -1
- package/dist/assets/index-0KJGv8YB.js +1 -1
- package/dist/assets/index-BAtw7eB6.js +1 -1
- package/dist/assets/index-BEyvIdTp.js +1 -1
- package/dist/assets/index-BMCGWiyM.js +1 -1
- package/dist/assets/index-ClFIRXfV.js +1 -1
- package/dist/assets/index-D7U3pqVe.js +1 -1
- package/dist/assets/index-DhXQuL-K.js +1 -1
- package/dist/assets/index-Dj3HMPh8.js +1 -1
- package/dist/assets/index-Dl0q_c7r.js +1 -1
- package/dist/assets/index-ZdwmM3LS.js +1 -1
- package/dist/assets/list-DBhbLnjZ.js +1 -1
- package/dist/assets/overview-BgK_P3ko.js +1 -1
- package/dist/assets/runtime-XL6C0WHV.js +1 -1
- package/dist/assets/security-C5-rO801.js +1 -1
- package/dist/assets/setup-Dpq6lpy4.js +1 -1
- package/dist/assets/start-BTmB0MgK.js +1 -1
- package/dist/assets/step-actions-njetG0Iy.js +1 -1
- package/dist/assets/table-tips-Cjv8HIcF.js +1 -1
- package/dist/assets/use-server-logo-UTr-CyJD.js +1 -1
- package/package.json +22 -22
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-BW2DapLf.js","assets/vendor-ux-did-connect-BbCim3WZ.js","assets/vendor-react-DEoibe3W.js","assets/vendor-utils-BfZ4tlod.js","assets/vendor-mui-core-Bq8gXTan.js","assets/vendor-hooks-DqdmWCmo.js","assets/lottie-web-jYmAQWuC.js","assets/vendor-ux-did-connect-DpSGLE7B.css","assets/vendor-arcblock-f1tICt1E.js","assets/index-BxJZWVOT.js","assets/index-BMCGWiyM.js","assets/index-DOq-_YXu.css","assets/index-DVQCgvFb.js","assets/index-AgKpYdvC.css"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{r as b,b as Ue}from"./vendor-react-DEoibe3W.js";import{a as F,d as K,k as W,a3 as H,_ as ye,a2 as ne,$ as V,br as ve,bs as Ce,bt as Te,bd as we,ac as Se,a5 as Ie}from"./vendor-ux-did-connect-BbCim3WZ.js";import{H as o,j as e,D as X,aj as G,I as Q,t as J,al as L,T as R,aa as p,O as w,bq as v,bK as Re,bQ as oe,bs as se,bR as ae,X as Y,ak as ce,z as de,y as z,ab as Z,ad as Ee}from"./vendor-mui-core-Bq8gXTan.js";import{v as ue}from"./vendor-arcblock-f1tICt1E.js";import{d as Ae}from"./Edit-D-oqMZ6h.js";import{_ as ke}from"./dot-4jhL56kz.js";import{l as pe}from"./index-DECQi8Vb.js";import{D as $,aC as he,aD as S,G as Pe}from"./index-BMCGWiyM.js";import{u as B}from"./dashboard-CpxtvWAW.js";import{o as Ne,c as We,A as re}from"./vendor-utils-BfZ4tlod.js";import{T as qe}from"./index-WjR0qttM.js";import{E as Oe}from"./empty-spinner-BHwHZpq-.js";import{C as y}from"./click-to-copy-D0HginOX.js";import{D as Le}from"./delete-confirm-BdthpUzC.js";import{b as _e}from"./passport-item-fJ88Wv4t.js";import{A as De}from"./actions-BgkGoToI.js";import{T as le}from"./table-tips-Cjv8HIcF.js";import{u as ze}from"./use-mobile-CtTQsfXN.js";import"./vendor-hooks-DqdmWCmo.js";import"./lottie-web-jYmAQWuC.js";import"./useAsync-C62uE2pS.js";import"./useLocalStorage-iQ2AmaOA.js";import"./index-8eXqqyHQ.js";import"./confirm-Bbp7EOHO.js";import"./PlayArrow-DZsdEeq_.js";import"./get-safe-url-CuT70yLx.js";import"./session-BDyIB4uh.js";import"./use-blocklet-logo-DwwmdicD.js";import"./InfoOutlined-B5f3YRb4.js";import"./useSetState-CWq0AVWn.js";import"./use-mobile-DwzRjjku.js";import"./vendor-mui-x-1nqAyytV.js";import"./AdapterDayjs-T0keO70D.js";import"./did-address-DFiM35OM.js";import"./util-paKPrRHx.js";import"./base32-Cbt7-U8e.js";import"./MoreHoriz-H_VQNQ9b.js";const Fe={clientName:"",clientUri:"",redirectUris:"",scope:["profile:read"],contacts:"",tosUri:"",policyUri:""};function me({onCreated:r,onClose:u}){const[i,m]=b.useState(!1),{t:n,locale:s}=F(),{api:g}=$(),{teamDid:h}=B(),{control:f,handleSubmit:k,formState:{errors:a},watch:I,setValue:x}=he({defaultValues:Fe,mode:"onChange"}),T=I("scope"),E=c=>{c!=="profile:read"&&x("scope",T.includes(c)?T.filter(d=>d!==c):[...T,c])},q=async c=>{m(!0);try{const d={...c,redirectUris:c.redirectUris,contacts:c.contacts?c.contacts.split(",").map(P=>P.trim()):[],scope:c.scope.join(" ")};await g.createOAuthClient({input:{teamDid:h,input:Ne(d,We)}}),r(d)}catch(d){H.error(d.message||"Failed to create OAuth App")}finally{m(!1)}};return e.jsxs(X,{open:!0,onClose:u,maxWidth:"md",fullWidth:!0,children:[e.jsxs(G,{children:[n("oauth.client.register")," ",e.jsx(Q,{onClick:u,sx:{position:"absolute",right:8,top:8},children:e.jsx(K,{})})]}),e.jsx(J,{children:e.jsxs(L,{spacing:4,sx:{mt:2},children:[e.jsx(R,{variant:"h6",gutterBottom:!0,children:n("oauth.client.requiredInformation")}),e.jsx(p,{children:e.jsx(S,{name:"clientName",control:f,rules:{required:n("oauth.client.validate.clientName"),minLength:{value:3,message:n("oauth.client.validate.clientNameMinLength")}},render:({field:c})=>{var d;return e.jsxs(e.Fragment,{children:[e.jsx(w,{size:"small",...c,label:n("oauth.client.name"),required:!0,fullWidth:!0,placeholder:n("oauth.client.input.clientNamePlaceholder"),error:!!a.clientName,helperText:(d=a.clientName)==null?void 0:d.message}),e.jsx(v,{children:n("oauth.client.helperText.clientName")})]})}})}),e.jsx(p,{children:e.jsx(S,{name:"clientUri",control:f,rules:{required:n("oauth.client.validate.clientUri"),pattern:{value:/^https?:\/\/.+/,message:n("oauth.client.validate.clientUriInvalid")}},render:({field:c})=>{var d;return e.jsxs(e.Fragment,{children:[e.jsx(w,{size:"small",...c,label:n("oauth.client.input.clientUri"),required:!0,fullWidth:!0,placeholder:n("oauth.client.input.clientUriPlaceholder"),error:!!a.clientUri,helperText:(d=a.clientUri)==null?void 0:d.message}),e.jsx(v,{children:n("oauth.client.helperText.clientUri")})]})}})}),e.jsx(p,{children:e.jsx(S,{name:"redirectUris",control:f,rules:{required:n("oauth.client.validate.redirectUris"),pattern:{value:/^https?:\/\/.+/,message:n("oauth.client.validate.redirectUrisInvalid")}},render:({field:c})=>{var d;return e.jsxs(e.Fragment,{children:[e.jsx(w,{size:"small",...c,label:n("oauth.client.input.redirectUris"),required:!0,fullWidth:!0,placeholder:n("oauth.client.input.redirectUrisPlaceholder"),error:!!a.redirectUris,helperText:(d=a.redirectUris)==null?void 0:d.message}),e.jsxs(p,{sx:{display:"flex",gap:"2px"},children:[e.jsx(v,{children:n("oauth.client.helperText.redirectUris")}),e.jsx(v,{children:n("oauth.client.helperText.read")}),e.jsx(v,{sx:{color:"info.main"},component:"a",href:`https://www.arcblock.io/docs/blocklet-developer/${s}/oauth-service`,target:"_blank",rel:"noopener noreferrer",children:n("oauth.client.helperText.document")}),e.jsx(v,{children:n("oauth.client.helperText.more")})]})]})}})}),e.jsxs(Re,{variant:"outlined",sx:{p:2,display:"none"},children:[e.jsx(R,{variant:"subtitle2",gutterBottom:!0,children:n("oauth.client.input.permissions")}),e.jsx(p,{sx:{border:"1px solid",borderColor:"divider",borderRadius:1,p:2},children:e.jsx(oe,{children:Object.entries(W.OAUTH_SCOPES).map(([c,d])=>e.jsx(se,{control:e.jsx(ae,{checked:T.includes(c),onChange:()=>E(c),disabled:c==="profile:read",color:"primary"}),label:e.jsx(p,{children:e.jsx(R,{variant:"body2",sx:{fontWeight:500},children:d})})},c))})})]}),e.jsx(Y,{}),e.jsx(R,{variant:"h6",gutterBottom:!0,children:n("oauth.client.optionalInformation")}),e.jsx(L,{children:e.jsx(S,{name:"contacts",control:f,rules:{pattern:{value:/^$|^[^@\s]+@[^@\s]+\.[^@\s]+(\s*,\s*[^@\s]+@[^@\s]+\.[^@\s]+)*$/,message:n("oauth.client.validate.contacts")}},render:({field:c})=>{var d;return e.jsxs(e.Fragment,{children:[e.jsx(w,{size:"small",...c,label:n("oauth.client.input.contacts"),fullWidth:!0,placeholder:n("oauth.client.input.contactsPlaceholder"),error:!!a.contacts,helperText:(d=a.contacts)==null?void 0:d.message}),e.jsx(v,{children:n("oauth.client.helperText.contacts")})]})}})}),e.jsxs(L,{direction:{xs:"column",sm:"row"},spacing:2,children:[e.jsx(S,{name:"tosUri",control:f,rules:{pattern:{value:/^$|^https?:\/\/.+/,message:n("oauth.client.validate.tosUriInvalid")}},render:({field:c})=>{var d;return e.jsxs(p,{sx:{width:"50%"},children:[e.jsx(w,{size:"small",...c,label:n("oauth.client.input.tosUri"),fullWidth:!0,placeholder:n("oauth.client.input.tosUriPlaceholder"),error:!!a.tosUri,helperText:(d=a.tosUri)==null?void 0:d.message}),e.jsx(v,{children:n("oauth.client.helperText.tosUri")})]})}}),e.jsx(S,{name:"policyUri",control:f,rules:{pattern:{value:/^$|^https?:\/\/.+/,message:n("oauth.client.validate.policyUriInvalid")}},render:({field:c})=>{var d;return e.jsxs(p,{sx:{width:"50%"},children:[e.jsx(w,{size:"small",...c,label:n("oauth.client.input.policyUri"),fullWidth:!0,placeholder:n("oauth.client.input.policyUriPlaceholder"),error:!!a.policyUri,helperText:(d=a.policyUri)==null?void 0:d.message}),e.jsx(v,{children:n("oauth.client.helperText.policyUri")})]})}})]}),a.error&&e.jsx(ce,{severity:"error",children:a.error.message})]})}),e.jsxs(de,{children:[e.jsx(z,{onClick:u,children:n("common.cancel")}),e.jsxs(z,{onClick:k(q),disabled:i,variant:"contained",color:"primary",children:[i?e.jsx(Z,{size:20,sx:{mr:1}}):null,n("oauth.client.registerButton")]})]})]})}me.propTypes={onCreated:o.func.isRequired,onClose:o.func.isRequired};function M({scope:r,...u}){if(!r)return null;const i=r.split(" ").filter(Boolean);return e.jsx(L,{direction:"row",flexWrap:"wrap",gap:1,...u,children:i.map(m=>e.jsx(Ue.Fragment,{children:e.jsx(Ee,{title:W.OAUTH_SCOPES[m],children:e.jsx(y,{children:m})})},m))})}M.propTypes={scope:o.string};M.defaultProps={scope:""};const ee=r=>{const{prefix:u}=$(),{blocklet:i}=Pe(),m=re(u,"/api/media/upload",i.appPid),n=b.useCallback(g=>g?g.startsWith("http")?g:`${re(u,"/api/media/upload",i.appPid)}/${g}`:"",[u,i.appPid]);return{clientLogoUrl:b.useMemo(()=>n(r),[r,n]),apiPath:m,getClientLogoUrl:n}},$e=b.lazy(()=>ye(()=>import("./index-BW2DapLf.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13])).then(r=>({default:r.Uploader})));function xe({client:r,onUpdate:u,onClose:i}){const[m,n]=b.useState(!1),{t:s,locale:g}=F(),h=b.useRef(null),{api:f}=$(),{teamDid:k}=B(),{control:a,handleSubmit:I,formState:{errors:x},watch:T,setValue:E,getValues:q}=he({defaultValues:{clientName:r.clientName||"",clientUri:r.clientUri||"",redirectUris:Array.isArray(r.redirectUris)?r.redirectUris.join(","):"",scope:r.scope?r.scope.split(" "):["profile:read"],contacts:Array.isArray(r.contacts)?r.contacts.join(","):"",tosUri:r.tosUri||"",policyUri:r.policyUri||"",logoUri:r.logoUri||"",clientSecretExpiresAt:r.clientSecretExpiresAt||null},mode:"onChange"}),c=T("scope"),d=T("logoUri"),{clientLogoUrl:P,apiPath:O}=ee(d),A=l=>{l!=="profile:read"&&E("scope",c.includes(l)?c.filter(t=>t!==l):[...c,l])},_=async l=>{const t={clientId:r.clientId,clientName:l.clientName.trim(),clientUri:l.clientUri,redirectUris:l.redirectUris.split(",").map(C=>C.trim()).filter(Boolean),contacts:l.contacts?l.contacts.split(",").map(C=>C.trim()):[],scope:l.scope.join(" "),tosUri:l.tosUri,policyUri:l.policyUri,logoUri:l.logoUri,clientSecretExpiresAt:l.clientSecretExpiresAt?parseInt(l.clientSecretExpiresAt/1e3,10):null};await f.updateOAuthClient({input:{teamDid:k,input:t}})},D=async l=>{n(!0);try{await _(l),u(),i()}catch(t){H.error(t.message||s("oauth.client.updateFailed"))}finally{n(!1)}};return e.jsxs(X,{open:!0,onClose:i,maxWidth:"md",fullWidth:!0,children:[e.jsxs(G,{children:[s("oauth.client.update")," ",e.jsx(Q,{onClick:i,sx:{position:"absolute",right:8,top:8},children:e.jsx(K,{})})]}),e.jsx(J,{children:e.jsxs(L,{spacing:3,sx:{mt:2},children:[e.jsxs(p,{sx:{mb:3},children:[e.jsx(R,{variant:"subtitle1",sx:{fontWeight:500,mb:1},children:s("oauth.client.logo")}),e.jsxs(p,{children:[e.jsx(p,{sx:{width:120,height:120,position:"relative",borderRadius:"4px",overflow:"hidden"},children:P?e.jsx(p,{children:e.jsx("img",{src:P,alt:"client-logo",style:{width:"100%",height:"100%"}})}):e.jsx(p,{onClick:()=>{var l;(l=h.current)==null||l.open()},sx:{width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center",bgcolor:"grey.200"},children:e.jsx(ue,{sx:{fontSize:40,color:"common.white"}})})}),e.jsx(z,{sx:{mt:2},variant:"outlined",size:"small",onClick:()=>{var l;(l=h.current)==null||l.open()},children:s(P?"common.change":"common.upload")})]}),e.jsx(p,{sx:{display:"flex",alignItems:"center"},children:e.jsx(b.Suspense,{fallback:e.jsx(Oe,{}),children:e.jsx($e,{ref:h,locale:g,popup:!0,onUploadFinish:l=>{E("logoUri",l.data.filename),_(q()).then(()=>{u()}).catch(t=>{H.error(t.message||s("oauth.client.updateFailed"))}).finally(()=>{var t;(t=h.current)==null||t.close()})},plugins:["ImageEditor"],installerProps:{disabled:!0},apiPathProps:{uploader:O,disableMediaKitPrefix:!0,disableAutoPrefix:!0,disableMediaKitStatus:!0},coreProps:{restrictions:{allowedFileTypes:["image/png","image/jpeg","image/webp","image/svg+xml"],maxFileSize:1024*1024*.5,maxNumberOfFiles:1}},dashboardProps:{autoOpen:"imageEditor"},imageEditorProps:{actions:{revert:!0,rotate:!0,granularRotate:!0,flip:!0,zoomIn:!0,zoomOut:!0,cropSquare:!1,cropWidescreen:!1,cropWidescreenVertical:!1},cropperOptions:{autoCrop:!0,aspectRatio:1,initialAspectRatio:1,autoCropArea:1,croppedCanvasOptions:{minWidth:256,minHeight:256}}}},"uploader-logo")})})]}),e.jsx(R,{variant:"subtitle1",sx:{fontWeight:500},children:s("oauth.client.requiredInformation")}),e.jsx(w,{label:"Client Id",fullWidth:!0,value:r.clientId,disabled:!0}),e.jsx(p,{children:e.jsx(S,{name:"clientName",control:a,rules:{required:s("oauth.client.validate.clientName"),minLength:{value:3,message:s("oauth.client.validate.clientNameMinLength")}},render:({field:l})=>{var t;return e.jsxs(e.Fragment,{children:[e.jsx(w,{...l,label:s("oauth.client.name"),required:!0,fullWidth:!0,error:!!x.clientName,helperText:(t=x.clientName)==null?void 0:t.message}),e.jsx(v,{children:s("oauth.client.helperText.clientName")})]})}})}),e.jsx(p,{children:e.jsx(S,{name:"clientUri",control:a,rules:{required:s("oauth.client.validate.clientUri"),pattern:{value:/^https?:\/\/.+/,message:s("oauth.client.validate.clientUriInvalid")}},render:({field:l})=>{var t;return e.jsxs(e.Fragment,{children:[e.jsx(w,{...l,label:s("oauth.client.input.clientUri"),required:!0,fullWidth:!0,error:!!x.clientUri,helperText:(t=x.clientUri)==null?void 0:t.message}),e.jsx(v,{children:s("oauth.client.helperText.clientUri")})]})}})}),e.jsx(p,{children:e.jsx(S,{name:"redirectUris",control:a,rules:{required:s("oauth.client.validate.redirectUris"),pattern:{value:/^https?:\/\/.+/,message:s("oauth.client.validate.redirectUrisInvalid")}},render:({field:l})=>{var t;return e.jsxs(e.Fragment,{children:[e.jsx(w,{...l,label:s("oauth.client.input.redirectUris"),required:!0,fullWidth:!0,multiline:!0,rows:2,error:!!x.redirectUris,helperText:(t=x.redirectUris)==null?void 0:t.message}),e.jsx(v,{children:s("oauth.client.helperText.redirectUris")})]})}})}),e.jsx(S,{name:"clientSecretExpiresAt",control:a,render:({field:l})=>e.jsx(qe,{placeholder:s("oauth.client.input.expireTime"),value:l.value*1e3,onChange:t=>{l.onChange(t)}})}),e.jsxs(p,{sx:{display:"none"},children:[e.jsx(R,{variant:"subtitle2",sx:{mb:1},children:s("oauth.client.input.permissions")}),e.jsx(p,{sx:{border:"1px solid",borderColor:"divider",borderRadius:1,p:2},children:e.jsx(oe,{children:Object.entries(W.OAUTH_SCOPES).map(([l,t])=>e.jsx(se,{control:e.jsx(ae,{checked:c.includes(l),onChange:()=>A(l),disabled:l==="profile:read",color:"primary"}),label:e.jsx(p,{children:e.jsx(R,{variant:"body2",sx:{fontWeight:500},children:t})})},l))})})]}),e.jsx(Y,{}),e.jsx(R,{variant:"subtitle1",sx:{fontWeight:500},children:s("oauth.client.optionalInformation")}),e.jsx(p,{children:e.jsx(S,{name:"contacts",control:a,rules:{pattern:{value:/^$|^[^@\s]+@[^@\s]+\.[^@\s]+(\s*,\s*[^@\s]+@[^@\s]+\.[^@\s]+)*$/,message:s("oauth.client.validate.contacts")}},render:({field:l})=>{var t;return e.jsxs(e.Fragment,{children:[e.jsx(w,{...l,label:s("oauth.client.input.contacts"),fullWidth:!0,error:!!x.contacts,helperText:(t=x.contacts)==null?void 0:t.message}),e.jsx(v,{children:s("oauth.client.helperText.contacts")})]})}})}),e.jsxs(L,{direction:{xs:"column",sm:"row"},spacing:2,children:[e.jsx(S,{name:"tosUri",control:a,rules:{pattern:{value:/^$|^https?:\/\/.+/,message:s("oauth.client.validate.tosUriInvalid")}},render:({field:l})=>{var t;return e.jsxs(p,{sx:{width:"50%"},children:[e.jsx(w,{...l,label:s("oauth.client.input.tosUri"),fullWidth:!0,error:!!x.tosUri,helperText:(t=x.tosUri)==null?void 0:t.message}),e.jsx(v,{children:s("oauth.client.helperText.tosUri")})]})}}),e.jsx(S,{name:"policyUri",control:a,rules:{pattern:{value:/^$|^https?:\/\/.+/,message:s("oauth.client.validate.policyUriInvalid")}},render:({field:l})=>{var t;return e.jsxs(p,{sx:{width:"50%"},children:[e.jsx(w,{...l,label:s("oauth.client.input.policyUri"),fullWidth:!0,error:!!x.policyUri,helperText:(t=x.policyUri)==null?void 0:t.message}),e.jsx(v,{children:s("oauth.client.helperText.policyUri")})]})}})]}),x.error&&e.jsx(ce,{severity:"error",children:x.error.message})]})}),e.jsxs(de,{children:[e.jsx(z,{onClick:i,children:s("common.cancel")}),e.jsx(z,{onClick:I(D),disabled:m,variant:"contained",color:"primary",children:m?e.jsx(Z,{size:16}):s("common.update")})]})]})}xe.propTypes={client:o.shape({clientId:o.string.isRequired,clientName:o.string.isRequired,clientUri:o.string,redirectUris:o.arrayOf(o.string),scope:o.string,contacts:o.arrayOf(o.string),tosUri:o.string,policyUri:o.string,logoUri:o.string,clientSecretExpiresAt:o.number}).isRequired,onUpdate:o.func.isRequired,onClose:o.func.isRequired};function je({client:r,onUpdate:u,onClose:i}){return e.jsx(xe,{client:r,onUpdate:m=>u(m),onClose:i})}je.propTypes={client:o.shape({clientId:o.string.isRequired,clientName:o.string.isRequired,clientUri:o.string,redirectUris:o.arrayOf(o.string),scope:o.string,contacts:o.arrayOf(o.string),tosUri:o.string,policyUri:o.string,logoUri:o.string,clientSecretExpiresAt:o.number}).isRequired,onUpdate:o.func.isRequired,onClose:o.func.isRequired};function te(r){const{t:u}=F(),{api:i}=$(),{teamDid:m}=B(),{clientId:n,clientName:s,onDelete:g=()=>{},onClose:h=()=>{}}=r,f=()=>{h()},k=async()=>{try{await i.deleteOAuthClient({input:{teamDid:m,clientId:n}}),g()}catch(I){H.error(I==null?void 0:I.message)}finally{f()}},a={keyName:s,title:u("oauth.client.delete.title"),description:u("oauth.client.delete.description",{name:`<b>${s}</b>`}),confirmPlaceholder:u("oauth.client.delete.description",{name:s}),confirm:u("common.delConfirm"),cancel:u("common.cancel"),onConfirm:k,onCancel:f};return e.jsx(Le,{keyName:a.keyName,title:a.title,description:a.description,confirmPlaceholder:a.confirmPlaceholder,confirm:a.confirm,cancel:a.cancel,params:a.params,onConfirm:a.onConfirm,onCancel:a.onCancel})}te.propTypes={clientId:o.string.isRequired,clientName:o.string.isRequired,onDelete:o.func,onClose:o.func};te.defaultProps={onDelete:()=>{},onClose:()=>{}};function ge({title:r,items:u}){return e.jsxs(p,{mb:3,children:[e.jsx(R,{variant:"h6",sx:{mb:1.5},children:r}),e.jsx(L,{spacing:1.5,children:u.map(({label:i,value:m})=>e.jsxs(p,{display:"flex",alignItems:"center",gap:2,children:[e.jsx(R,{variant:"subtitle2",color:"textSecondary",sx:{minWidth:200},children:i}),e.jsx(R,{sx:{wordBreak:"break-all"},children:m||"-"})]},i))})]})}ge.propTypes={title:o.string.isRequired,items:o.arrayOf(o.shape({label:o.string.isRequired,value:o.any})).isRequired};function fe({client:r,onClose:u}){const{t:i,locale:m}=F(),{teamDid:n}=B(),{clientName:s,clientId:g,clientSecret:h,redirectUris:f,scope:k,clientUri:a,logoUri:I,contacts:x,tosUri:T,policyUri:E,jwksUri:q,jwks:c,softwareId:d,softwareVersion:P,clientIdIssuedAt:O,clientSecretExpiresAt:A,updatedAt:_,createUser:D}=r,{clientLogoUrl:l}=ee(I),t=j=>{try{const N=new URL(window.blocklet.appUrl);return N.pathname=j,N.toString()}catch{return"-"}},C=pe.fromAppDid(g,n),U=[{title:i("common.baseInfo"),items:[{label:i("oauth.client.name"),value:s},{label:i("oauth.client.logoUri"),value:e.jsx(ne,{variant:"rounded",shape:"square",src:l,did:C.address,size:64})},{label:i("oauth.client.clientUri"),value:a?e.jsx(y,{children:a}):"-"},{label:i("oauth.client.clientId"),value:e.jsx(y,{children:g})},{label:i("oauth.client.clientSecret"),value:e.jsx(y,{children:h})},{label:i("oauth.client.redirectUris"),value:e.jsx(y,{children:(f||[]).join(", ")})},{label:i("oauth.client.scope"),value:e.jsx(M,{scope:k})},{label:i("oauth.client.createUser"),value:D?_e(D,!0):i("oauth.client.openRegistration")}]},{title:i("oauth.client.oauthEndpoints"),items:[{label:i("oauth.client.openidConfiguration"),value:e.jsx(y,{children:t("/.well-known/openid-configuration")})},{label:i("oauth.client.authorizationEndpoint"),value:e.jsx(y,{children:t(`${W.WELLKNOWN_SERVICE_PATH_PREFIX}/oauth/authorize`)})},{label:i("oauth.client.tokenEndpoint"),value:e.jsx(y,{children:t(`${W.WELLKNOWN_SERVICE_PATH_PREFIX}/oauth/token`)})},{label:i("oauth.client.userinfoEndpoint"),value:e.jsx(y,{children:t(`${W.WELLKNOWN_SERVICE_PATH_PREFIX}/oauth/userinfo`)})},{label:i("oauth.client.jwksUri"),value:e.jsx(y,{children:t(`${W.WELLKNOWN_SERVICE_PATH_PREFIX}/oauth/jwks`)})},{label:i("oauth.client.registrationEndpoint"),value:e.jsx(y,{children:t(`${W.WELLKNOWN_SERVICE_PATH_PREFIX}/oauth/register`)})},{label:i("oauth.client.endSessionEndpoint"),value:e.jsx(y,{children:t(`${W.WELLKNOWN_SERVICE_PATH_PREFIX}/oauth/logout`)})}]},{title:i("oauth.client.metaContact"),items:[{label:i("oauth.client.contacts"),value:x.length?e.jsx(y,{children:(x||[]).join(", ")}):"-"},{label:i("oauth.client.tosUri"),value:T?e.jsx(y,{children:T}):"-"},{label:i("oauth.client.policyUri"),value:E?e.jsx(y,{children:E}):"-"},{label:i("oauth.client.jwksUri"),value:q},{label:i("oauth.client.jwks"),value:c},{label:i("oauth.client.softwareId"),value:d},{label:i("oauth.client.softwareVersion"),value:P}]},{title:i("common.timeInfo"),items:[{label:i("oauth.client.clientIdIssuedAt"),value:O?e.jsx(V,{value:O*1e3,type:"all",locale:m}):"-"},{label:i("oauth.client.clientSecretExpiresAt"),value:A?e.jsx(V,{value:A*1e3,type:"all",locale:m}):"-"},{label:i("common.updatedAt"),value:_?e.jsx(V,{value:_,type:"all",locale:m}):"-"}]}].filter(Boolean);return e.jsxs(X,{open:!0,onClose:u,maxWidth:"lg",fullWidth:!0,children:[e.jsxs(G,{children:[i("oauth.client.oauthAppDetails"),e.jsx(Q,{onClick:u,sx:{position:"absolute",right:8,top:8},children:e.jsx(K,{})})]}),e.jsx(J,{children:e.jsx(p,{mt:1,children:U.map((j,N)=>e.jsxs(p,{children:[e.jsx(ge,{title:j.title,items:j.items}),N!==U.length-1&&e.jsx(Y,{sx:{my:2}})]},j.title))})})]})}fe.propTypes={client:o.object.isRequired,onClose:o.func.isRequired};function Be(r){return e.jsx(V,{value:r*1e3})}function ie({selected:r,onClose:u}){return r?e.jsx(fe,{client:r,onClose:u}):null}ie.propTypes={selected:o.object,onClose:o.func.isRequired};ie.defaultProps={selected:null};function be({open:r,onCreated:u,onClose:i}){return r?e.jsx(me,{onCreated:u,onClose:i}):null}be.propTypes={open:o.bool.isRequired,onCreated:o.func.isRequired,onClose:o.func.isRequired};function It(){var l;const[r,u]=b.useState({searchText:"",pageSize:10,page:1}),[i,m]=b.useState(null),[n,s]=b.useState(!1),g=b.useRef(null),{t:h,locale:f}=F(),{api:k}=$(),{teamDid:a}=B(),[I,x]=b.useState(null),[T,E]=b.useState(null),q=ze(),{getClientLogoUrl:c}=ee(),d=ke(async()=>await k.getOAuthClients({input:{teamDid:a,paging:{page:r.page,pageSize:r.pageSize}}}),[r.page,r.pageSize]),{loading:P}=d,O=b.useMemo(()=>{var t;return((t=d.value)==null?void 0:t.list)||[]},[(l=d.value)==null?void 0:l.list]),A=b.useMemo(()=>r.searchText?O.filter(t=>t.clientName.toLowerCase().includes(r.searchText.toLowerCase())||t.clientId.toLowerCase().includes(r.searchText.toLowerCase())||t.scope.toLowerCase().includes(r.searchText.toLowerCase())):O,[r.searchText,O]),_=b.useMemo(()=>[{label:h("oauth.client.name"),name:"clientName",options:{customBodyRender:(t,{rowIndex:C})=>{const U=A[C],j=c(U.logoUri),N=pe.fromAppDid(U.clientId,a);return e.jsx(p,{sx:{display:"flex",alignItems:"center",gap:2},children:e.jsxs(p,{display:"flex",alignItems:"center",gap:2,sx:{cursor:"pointer"},children:[e.jsx(ne,{variant:"rounded",shape:"square",did:N.address,src:j,size:48}),e.jsxs(L,{gap:.5,children:[e.jsx(p,{sx:{color:"text.primary"},children:U.clientName}),e.jsx(p,{sx:{color:"text.secondary"},children:U.clientUri})]})]})})}}},{label:h("oauth.client.clientId"),name:"clientId"},{label:h("oauth.client.scope"),name:"scope",options:{customBodyRender:t=>e.jsx(M,{scope:t})}},{label:h("common.createdAt"),name:"clientIdIssuedAt",options:{customBodyRender:Be}},{label:h("common.createdBy"),name:"createdBy",width:100,options:{customBodyRender:t=>t?e.jsx(ve,{showDid:!0,did:t,cardType:Ce.Detailed,infoType:Te.Minimal,sx:{border:0,padding:0}}):h("oauth.client.openRegistration")}},{label:h("common.actions"),name:"actions",width:100,align:"center",verticalKeyAlign:"center",options:{customBodyRender:(t,{rowIndex:C})=>{const U=A[C];return e.jsx(De,{actions:[{icon:e.jsx(Ae,{}),text:h("common.edit"),onClick:j=>{j.stopPropagation(),x(U)}},{icon:e.jsx(we,{}),text:h("common.delete"),onClick:j=>{j.stopPropagation(),E(U)}}]})}}}],[A,h,c,a,x,E]),D=({page:t,rowsPerPage:C,searchText:U})=>{r.pageSize!==C?u(j=>({...j,searchText:"",pageSize:C,page:1})):r.page!==t+1?u(j=>({...j,searchText:"",page:t+1})):r.searchText!==U&&u(j=>({...j,searchText:U,page:1}))};return e.jsxs(p,{ref:g,sx:{".custom-toobar-btns":{gap:"8px"},".custom-toobar-title .custom-toobar-title-inner>span":{display:"flex",alignItems:"center","white-space":"inherit",height:"100%"}},children:[q?e.jsx(le,{title:h("oauth.client.listTitle"),tooltipTitle:h("oauth.client.tooltipTitle"),link:`https://www.arcblock.io/docs/blocklet-developer/${f}/oauth-service`}):null,e.jsx(Se,{data:A,columns:_,options:{sort:!1,download:!1,filter:!1,print:!1,viewColumns:!1,page:r.page-1,rowsPerPage:r.pageSize,count:A.length,searchDebounceTime:400,onRowClick(t,{dataIndex:C},U){var j;if((j=g.current)!=null&&j.contains(U.target)){const N=A[C];m(N)}}},onChange:D,title:q?null:e.jsx(le,{title:h("oauth.client.listTitle"),tooltipTitle:h("oauth.client.tooltipTitle"),link:`https://www.arcblock.io/docs/blocklet-developer/${f}/oauth-service`}),customButtons:[e.jsxs(z,{variant:"contained",size:"small",onClick:()=>s(!0),children:[P?e.jsx(Z,{size:16}):e.jsx(ue,{style:{fontSize:16}}),h("common.create")]},"add")],loading:!1,emptyNode:e.jsx(Ie,{children:h("oauth.client.empty")})}),e.jsx(ie,{selected:i,onClose:()=>m(null)}),e.jsx(be,{open:n,onCreated:()=>{s(!1),d.retry()},onClose:()=>s(!1)}),I&&e.jsx(je,{client:I,onUpdate:d.retry,onClose:()=>x(null)}),T&&e.jsx(te,{...T,onDelete:d.retry,onClose:()=>E(null)})]})}export{It as default};
|
|
2
|
+
import{r as b,b as Ue}from"./vendor-react-DEoibe3W.js";import{a as F,d as K,k as W,a3 as H,_ as ye,a2 as ne,$ as V,br as ve,bs as Ce,bt as Te,bd as we,ac as Se,a5 as Ie}from"./vendor-ux-did-connect-BbCim3WZ.js";import{H as o,j as e,D as X,aj as G,I as Q,t as J,al as L,T as R,aa as p,O as w,bq as v,bK as Re,bQ as oe,bs as se,bR as ae,X as Y,ak as ce,z as de,y as z,ab as Z,ad as Ee}from"./vendor-mui-core-Bq8gXTan.js";import{v as ue}from"./vendor-arcblock-f1tICt1E.js";import{d as Ae}from"./Edit-D-oqMZ6h.js";import{_ as ke}from"./dot-4jhL56kz.js";import{l as pe}from"./index-DECQi8Vb.js";import{D as $,aC as he,aD as S,G as Pe}from"./index-BMCGWiyM.js";import{u as B}from"./dashboard-CpxtvWAW.js";import{o as Ne,c as We,A as re}from"./vendor-utils-BfZ4tlod.js";import{T as qe}from"./index-WjR0qttM.js";import{E as Oe}from"./empty-spinner-BHwHZpq-.js";import{C as y}from"./click-to-copy-D0HginOX.js";import{D as Le}from"./delete-confirm-BdthpUzC.js";import{b as _e}from"./passport-item-fJ88Wv4t.js";import{A as De}from"./actions-BgkGoToI.js";import{T as le}from"./table-tips-Cjv8HIcF.js";import{u as ze}from"./use-mobile-DwzRjjku.js";import"./vendor-hooks-DqdmWCmo.js";import"./lottie-web-jYmAQWuC.js";import"./useAsync-C62uE2pS.js";import"./useLocalStorage-iQ2AmaOA.js";import"./index-8eXqqyHQ.js";import"./confirm-Bbp7EOHO.js";import"./PlayArrow-DZsdEeq_.js";import"./get-safe-url-CuT70yLx.js";import"./session-BDyIB4uh.js";import"./use-blocklet-logo-DwwmdicD.js";import"./InfoOutlined-B5f3YRb4.js";import"./useSetState-CWq0AVWn.js";import"./use-mobile-CtTQsfXN.js";import"./vendor-mui-x-1nqAyytV.js";import"./AdapterDayjs-T0keO70D.js";import"./did-address-DFiM35OM.js";import"./util-paKPrRHx.js";import"./base32-Cbt7-U8e.js";import"./MoreHoriz-H_VQNQ9b.js";const Fe={clientName:"",clientUri:"",redirectUris:"",scope:["profile:read"],contacts:"",tosUri:"",policyUri:""};function me({onCreated:r,onClose:u}){const[i,m]=b.useState(!1),{t:n,locale:s}=F(),{api:g}=$(),{teamDid:h}=B(),{control:f,handleSubmit:k,formState:{errors:a},watch:I,setValue:x}=he({defaultValues:Fe,mode:"onChange"}),T=I("scope"),E=c=>{c!=="profile:read"&&x("scope",T.includes(c)?T.filter(d=>d!==c):[...T,c])},q=async c=>{m(!0);try{const d={...c,redirectUris:c.redirectUris,contacts:c.contacts?c.contacts.split(",").map(P=>P.trim()):[],scope:c.scope.join(" ")};await g.createOAuthClient({input:{teamDid:h,input:Ne(d,We)}}),r(d)}catch(d){H.error(d.message||"Failed to create OAuth App")}finally{m(!1)}};return e.jsxs(X,{open:!0,onClose:u,maxWidth:"md",fullWidth:!0,children:[e.jsxs(G,{children:[n("oauth.client.register")," ",e.jsx(Q,{onClick:u,sx:{position:"absolute",right:8,top:8},children:e.jsx(K,{})})]}),e.jsx(J,{children:e.jsxs(L,{spacing:4,sx:{mt:2},children:[e.jsx(R,{variant:"h6",gutterBottom:!0,children:n("oauth.client.requiredInformation")}),e.jsx(p,{children:e.jsx(S,{name:"clientName",control:f,rules:{required:n("oauth.client.validate.clientName"),minLength:{value:3,message:n("oauth.client.validate.clientNameMinLength")}},render:({field:c})=>{var d;return e.jsxs(e.Fragment,{children:[e.jsx(w,{size:"small",...c,label:n("oauth.client.name"),required:!0,fullWidth:!0,placeholder:n("oauth.client.input.clientNamePlaceholder"),error:!!a.clientName,helperText:(d=a.clientName)==null?void 0:d.message}),e.jsx(v,{children:n("oauth.client.helperText.clientName")})]})}})}),e.jsx(p,{children:e.jsx(S,{name:"clientUri",control:f,rules:{required:n("oauth.client.validate.clientUri"),pattern:{value:/^https?:\/\/.+/,message:n("oauth.client.validate.clientUriInvalid")}},render:({field:c})=>{var d;return e.jsxs(e.Fragment,{children:[e.jsx(w,{size:"small",...c,label:n("oauth.client.input.clientUri"),required:!0,fullWidth:!0,placeholder:n("oauth.client.input.clientUriPlaceholder"),error:!!a.clientUri,helperText:(d=a.clientUri)==null?void 0:d.message}),e.jsx(v,{children:n("oauth.client.helperText.clientUri")})]})}})}),e.jsx(p,{children:e.jsx(S,{name:"redirectUris",control:f,rules:{required:n("oauth.client.validate.redirectUris"),pattern:{value:/^https?:\/\/.+/,message:n("oauth.client.validate.redirectUrisInvalid")}},render:({field:c})=>{var d;return e.jsxs(e.Fragment,{children:[e.jsx(w,{size:"small",...c,label:n("oauth.client.input.redirectUris"),required:!0,fullWidth:!0,placeholder:n("oauth.client.input.redirectUrisPlaceholder"),error:!!a.redirectUris,helperText:(d=a.redirectUris)==null?void 0:d.message}),e.jsxs(p,{sx:{display:"flex",gap:"2px"},children:[e.jsx(v,{children:n("oauth.client.helperText.redirectUris")}),e.jsx(v,{children:n("oauth.client.helperText.read")}),e.jsx(v,{sx:{color:"info.main"},component:"a",href:`https://www.arcblock.io/docs/blocklet-developer/${s}/oauth-service`,target:"_blank",rel:"noopener noreferrer",children:n("oauth.client.helperText.document")}),e.jsx(v,{children:n("oauth.client.helperText.more")})]})]})}})}),e.jsxs(Re,{variant:"outlined",sx:{p:2,display:"none"},children:[e.jsx(R,{variant:"subtitle2",gutterBottom:!0,children:n("oauth.client.input.permissions")}),e.jsx(p,{sx:{border:"1px solid",borderColor:"divider",borderRadius:1,p:2},children:e.jsx(oe,{children:Object.entries(W.OAUTH_SCOPES).map(([c,d])=>e.jsx(se,{control:e.jsx(ae,{checked:T.includes(c),onChange:()=>E(c),disabled:c==="profile:read",color:"primary"}),label:e.jsx(p,{children:e.jsx(R,{variant:"body2",sx:{fontWeight:500},children:d})})},c))})})]}),e.jsx(Y,{}),e.jsx(R,{variant:"h6",gutterBottom:!0,children:n("oauth.client.optionalInformation")}),e.jsx(L,{children:e.jsx(S,{name:"contacts",control:f,rules:{pattern:{value:/^$|^[^@\s]+@[^@\s]+\.[^@\s]+(\s*,\s*[^@\s]+@[^@\s]+\.[^@\s]+)*$/,message:n("oauth.client.validate.contacts")}},render:({field:c})=>{var d;return e.jsxs(e.Fragment,{children:[e.jsx(w,{size:"small",...c,label:n("oauth.client.input.contacts"),fullWidth:!0,placeholder:n("oauth.client.input.contactsPlaceholder"),error:!!a.contacts,helperText:(d=a.contacts)==null?void 0:d.message}),e.jsx(v,{children:n("oauth.client.helperText.contacts")})]})}})}),e.jsxs(L,{direction:{xs:"column",sm:"row"},spacing:2,children:[e.jsx(S,{name:"tosUri",control:f,rules:{pattern:{value:/^$|^https?:\/\/.+/,message:n("oauth.client.validate.tosUriInvalid")}},render:({field:c})=>{var d;return e.jsxs(p,{sx:{width:"50%"},children:[e.jsx(w,{size:"small",...c,label:n("oauth.client.input.tosUri"),fullWidth:!0,placeholder:n("oauth.client.input.tosUriPlaceholder"),error:!!a.tosUri,helperText:(d=a.tosUri)==null?void 0:d.message}),e.jsx(v,{children:n("oauth.client.helperText.tosUri")})]})}}),e.jsx(S,{name:"policyUri",control:f,rules:{pattern:{value:/^$|^https?:\/\/.+/,message:n("oauth.client.validate.policyUriInvalid")}},render:({field:c})=>{var d;return e.jsxs(p,{sx:{width:"50%"},children:[e.jsx(w,{size:"small",...c,label:n("oauth.client.input.policyUri"),fullWidth:!0,placeholder:n("oauth.client.input.policyUriPlaceholder"),error:!!a.policyUri,helperText:(d=a.policyUri)==null?void 0:d.message}),e.jsx(v,{children:n("oauth.client.helperText.policyUri")})]})}})]}),a.error&&e.jsx(ce,{severity:"error",children:a.error.message})]})}),e.jsxs(de,{children:[e.jsx(z,{onClick:u,children:n("common.cancel")}),e.jsxs(z,{onClick:k(q),disabled:i,variant:"contained",color:"primary",children:[i?e.jsx(Z,{size:20,sx:{mr:1}}):null,n("oauth.client.registerButton")]})]})]})}me.propTypes={onCreated:o.func.isRequired,onClose:o.func.isRequired};function M({scope:r,...u}){if(!r)return null;const i=r.split(" ").filter(Boolean);return e.jsx(L,{direction:"row",flexWrap:"wrap",gap:1,...u,children:i.map(m=>e.jsx(Ue.Fragment,{children:e.jsx(Ee,{title:W.OAUTH_SCOPES[m],children:e.jsx(y,{children:m})})},m))})}M.propTypes={scope:o.string};M.defaultProps={scope:""};const ee=r=>{const{prefix:u}=$(),{blocklet:i}=Pe(),m=re(u,"/api/media/upload",i.appPid),n=b.useCallback(g=>g?g.startsWith("http")?g:`${re(u,"/api/media/upload",i.appPid)}/${g}`:"",[u,i.appPid]);return{clientLogoUrl:b.useMemo(()=>n(r),[r,n]),apiPath:m,getClientLogoUrl:n}},$e=b.lazy(()=>ye(()=>import("./index-BW2DapLf.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13])).then(r=>({default:r.Uploader})));function xe({client:r,onUpdate:u,onClose:i}){const[m,n]=b.useState(!1),{t:s,locale:g}=F(),h=b.useRef(null),{api:f}=$(),{teamDid:k}=B(),{control:a,handleSubmit:I,formState:{errors:x},watch:T,setValue:E,getValues:q}=he({defaultValues:{clientName:r.clientName||"",clientUri:r.clientUri||"",redirectUris:Array.isArray(r.redirectUris)?r.redirectUris.join(","):"",scope:r.scope?r.scope.split(" "):["profile:read"],contacts:Array.isArray(r.contacts)?r.contacts.join(","):"",tosUri:r.tosUri||"",policyUri:r.policyUri||"",logoUri:r.logoUri||"",clientSecretExpiresAt:r.clientSecretExpiresAt||null},mode:"onChange"}),c=T("scope"),d=T("logoUri"),{clientLogoUrl:P,apiPath:O}=ee(d),A=l=>{l!=="profile:read"&&E("scope",c.includes(l)?c.filter(t=>t!==l):[...c,l])},_=async l=>{const t={clientId:r.clientId,clientName:l.clientName.trim(),clientUri:l.clientUri,redirectUris:l.redirectUris.split(",").map(C=>C.trim()).filter(Boolean),contacts:l.contacts?l.contacts.split(",").map(C=>C.trim()):[],scope:l.scope.join(" "),tosUri:l.tosUri,policyUri:l.policyUri,logoUri:l.logoUri,clientSecretExpiresAt:l.clientSecretExpiresAt?parseInt(l.clientSecretExpiresAt/1e3,10):null};await f.updateOAuthClient({input:{teamDid:k,input:t}})},D=async l=>{n(!0);try{await _(l),u(),i()}catch(t){H.error(t.message||s("oauth.client.updateFailed"))}finally{n(!1)}};return e.jsxs(X,{open:!0,onClose:i,maxWidth:"md",fullWidth:!0,children:[e.jsxs(G,{children:[s("oauth.client.update")," ",e.jsx(Q,{onClick:i,sx:{position:"absolute",right:8,top:8},children:e.jsx(K,{})})]}),e.jsx(J,{children:e.jsxs(L,{spacing:3,sx:{mt:2},children:[e.jsxs(p,{sx:{mb:3},children:[e.jsx(R,{variant:"subtitle1",sx:{fontWeight:500,mb:1},children:s("oauth.client.logo")}),e.jsxs(p,{children:[e.jsx(p,{sx:{width:120,height:120,position:"relative",borderRadius:"4px",overflow:"hidden"},children:P?e.jsx(p,{children:e.jsx("img",{src:P,alt:"client-logo",style:{width:"100%",height:"100%"}})}):e.jsx(p,{onClick:()=>{var l;(l=h.current)==null||l.open()},sx:{width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center",bgcolor:"grey.200"},children:e.jsx(ue,{sx:{fontSize:40,color:"common.white"}})})}),e.jsx(z,{sx:{mt:2},variant:"outlined",size:"small",onClick:()=>{var l;(l=h.current)==null||l.open()},children:s(P?"common.change":"common.upload")})]}),e.jsx(p,{sx:{display:"flex",alignItems:"center"},children:e.jsx(b.Suspense,{fallback:e.jsx(Oe,{}),children:e.jsx($e,{ref:h,locale:g,popup:!0,onUploadFinish:l=>{E("logoUri",l.data.filename),_(q()).then(()=>{u()}).catch(t=>{H.error(t.message||s("oauth.client.updateFailed"))}).finally(()=>{var t;(t=h.current)==null||t.close()})},plugins:["ImageEditor"],installerProps:{disabled:!0},apiPathProps:{uploader:O,disableMediaKitPrefix:!0,disableAutoPrefix:!0,disableMediaKitStatus:!0},coreProps:{restrictions:{allowedFileTypes:["image/png","image/jpeg","image/webp","image/svg+xml"],maxFileSize:1024*1024*.5,maxNumberOfFiles:1}},dashboardProps:{autoOpen:"imageEditor"},imageEditorProps:{actions:{revert:!0,rotate:!0,granularRotate:!0,flip:!0,zoomIn:!0,zoomOut:!0,cropSquare:!1,cropWidescreen:!1,cropWidescreenVertical:!1},cropperOptions:{autoCrop:!0,aspectRatio:1,initialAspectRatio:1,autoCropArea:1,croppedCanvasOptions:{minWidth:256,minHeight:256}}}},"uploader-logo")})})]}),e.jsx(R,{variant:"subtitle1",sx:{fontWeight:500},children:s("oauth.client.requiredInformation")}),e.jsx(w,{label:"Client Id",fullWidth:!0,value:r.clientId,disabled:!0}),e.jsx(p,{children:e.jsx(S,{name:"clientName",control:a,rules:{required:s("oauth.client.validate.clientName"),minLength:{value:3,message:s("oauth.client.validate.clientNameMinLength")}},render:({field:l})=>{var t;return e.jsxs(e.Fragment,{children:[e.jsx(w,{...l,label:s("oauth.client.name"),required:!0,fullWidth:!0,error:!!x.clientName,helperText:(t=x.clientName)==null?void 0:t.message}),e.jsx(v,{children:s("oauth.client.helperText.clientName")})]})}})}),e.jsx(p,{children:e.jsx(S,{name:"clientUri",control:a,rules:{required:s("oauth.client.validate.clientUri"),pattern:{value:/^https?:\/\/.+/,message:s("oauth.client.validate.clientUriInvalid")}},render:({field:l})=>{var t;return e.jsxs(e.Fragment,{children:[e.jsx(w,{...l,label:s("oauth.client.input.clientUri"),required:!0,fullWidth:!0,error:!!x.clientUri,helperText:(t=x.clientUri)==null?void 0:t.message}),e.jsx(v,{children:s("oauth.client.helperText.clientUri")})]})}})}),e.jsx(p,{children:e.jsx(S,{name:"redirectUris",control:a,rules:{required:s("oauth.client.validate.redirectUris"),pattern:{value:/^https?:\/\/.+/,message:s("oauth.client.validate.redirectUrisInvalid")}},render:({field:l})=>{var t;return e.jsxs(e.Fragment,{children:[e.jsx(w,{...l,label:s("oauth.client.input.redirectUris"),required:!0,fullWidth:!0,multiline:!0,rows:2,error:!!x.redirectUris,helperText:(t=x.redirectUris)==null?void 0:t.message}),e.jsx(v,{children:s("oauth.client.helperText.redirectUris")})]})}})}),e.jsx(S,{name:"clientSecretExpiresAt",control:a,render:({field:l})=>e.jsx(qe,{placeholder:s("oauth.client.input.expireTime"),value:l.value*1e3,onChange:t=>{l.onChange(t)}})}),e.jsxs(p,{sx:{display:"none"},children:[e.jsx(R,{variant:"subtitle2",sx:{mb:1},children:s("oauth.client.input.permissions")}),e.jsx(p,{sx:{border:"1px solid",borderColor:"divider",borderRadius:1,p:2},children:e.jsx(oe,{children:Object.entries(W.OAUTH_SCOPES).map(([l,t])=>e.jsx(se,{control:e.jsx(ae,{checked:c.includes(l),onChange:()=>A(l),disabled:l==="profile:read",color:"primary"}),label:e.jsx(p,{children:e.jsx(R,{variant:"body2",sx:{fontWeight:500},children:t})})},l))})})]}),e.jsx(Y,{}),e.jsx(R,{variant:"subtitle1",sx:{fontWeight:500},children:s("oauth.client.optionalInformation")}),e.jsx(p,{children:e.jsx(S,{name:"contacts",control:a,rules:{pattern:{value:/^$|^[^@\s]+@[^@\s]+\.[^@\s]+(\s*,\s*[^@\s]+@[^@\s]+\.[^@\s]+)*$/,message:s("oauth.client.validate.contacts")}},render:({field:l})=>{var t;return e.jsxs(e.Fragment,{children:[e.jsx(w,{...l,label:s("oauth.client.input.contacts"),fullWidth:!0,error:!!x.contacts,helperText:(t=x.contacts)==null?void 0:t.message}),e.jsx(v,{children:s("oauth.client.helperText.contacts")})]})}})}),e.jsxs(L,{direction:{xs:"column",sm:"row"},spacing:2,children:[e.jsx(S,{name:"tosUri",control:a,rules:{pattern:{value:/^$|^https?:\/\/.+/,message:s("oauth.client.validate.tosUriInvalid")}},render:({field:l})=>{var t;return e.jsxs(p,{sx:{width:"50%"},children:[e.jsx(w,{...l,label:s("oauth.client.input.tosUri"),fullWidth:!0,error:!!x.tosUri,helperText:(t=x.tosUri)==null?void 0:t.message}),e.jsx(v,{children:s("oauth.client.helperText.tosUri")})]})}}),e.jsx(S,{name:"policyUri",control:a,rules:{pattern:{value:/^$|^https?:\/\/.+/,message:s("oauth.client.validate.policyUriInvalid")}},render:({field:l})=>{var t;return e.jsxs(p,{sx:{width:"50%"},children:[e.jsx(w,{...l,label:s("oauth.client.input.policyUri"),fullWidth:!0,error:!!x.policyUri,helperText:(t=x.policyUri)==null?void 0:t.message}),e.jsx(v,{children:s("oauth.client.helperText.policyUri")})]})}})]}),x.error&&e.jsx(ce,{severity:"error",children:x.error.message})]})}),e.jsxs(de,{children:[e.jsx(z,{onClick:i,children:s("common.cancel")}),e.jsx(z,{onClick:I(D),disabled:m,variant:"contained",color:"primary",children:m?e.jsx(Z,{size:16}):s("common.update")})]})]})}xe.propTypes={client:o.shape({clientId:o.string.isRequired,clientName:o.string.isRequired,clientUri:o.string,redirectUris:o.arrayOf(o.string),scope:o.string,contacts:o.arrayOf(o.string),tosUri:o.string,policyUri:o.string,logoUri:o.string,clientSecretExpiresAt:o.number}).isRequired,onUpdate:o.func.isRequired,onClose:o.func.isRequired};function je({client:r,onUpdate:u,onClose:i}){return e.jsx(xe,{client:r,onUpdate:m=>u(m),onClose:i})}je.propTypes={client:o.shape({clientId:o.string.isRequired,clientName:o.string.isRequired,clientUri:o.string,redirectUris:o.arrayOf(o.string),scope:o.string,contacts:o.arrayOf(o.string),tosUri:o.string,policyUri:o.string,logoUri:o.string,clientSecretExpiresAt:o.number}).isRequired,onUpdate:o.func.isRequired,onClose:o.func.isRequired};function te(r){const{t:u}=F(),{api:i}=$(),{teamDid:m}=B(),{clientId:n,clientName:s,onDelete:g=()=>{},onClose:h=()=>{}}=r,f=()=>{h()},k=async()=>{try{await i.deleteOAuthClient({input:{teamDid:m,clientId:n}}),g()}catch(I){H.error(I==null?void 0:I.message)}finally{f()}},a={keyName:s,title:u("oauth.client.delete.title"),description:u("oauth.client.delete.description",{name:`<b>${s}</b>`}),confirmPlaceholder:u("oauth.client.delete.description",{name:s}),confirm:u("common.delConfirm"),cancel:u("common.cancel"),onConfirm:k,onCancel:f};return e.jsx(Le,{keyName:a.keyName,title:a.title,description:a.description,confirmPlaceholder:a.confirmPlaceholder,confirm:a.confirm,cancel:a.cancel,params:a.params,onConfirm:a.onConfirm,onCancel:a.onCancel})}te.propTypes={clientId:o.string.isRequired,clientName:o.string.isRequired,onDelete:o.func,onClose:o.func};te.defaultProps={onDelete:()=>{},onClose:()=>{}};function ge({title:r,items:u}){return e.jsxs(p,{mb:3,children:[e.jsx(R,{variant:"h6",sx:{mb:1.5},children:r}),e.jsx(L,{spacing:1.5,children:u.map(({label:i,value:m})=>e.jsxs(p,{display:"flex",alignItems:"center",gap:2,children:[e.jsx(R,{variant:"subtitle2",color:"textSecondary",sx:{minWidth:200},children:i}),e.jsx(R,{sx:{wordBreak:"break-all"},children:m||"-"})]},i))})]})}ge.propTypes={title:o.string.isRequired,items:o.arrayOf(o.shape({label:o.string.isRequired,value:o.any})).isRequired};function fe({client:r,onClose:u}){const{t:i,locale:m}=F(),{teamDid:n}=B(),{clientName:s,clientId:g,clientSecret:h,redirectUris:f,scope:k,clientUri:a,logoUri:I,contacts:x,tosUri:T,policyUri:E,jwksUri:q,jwks:c,softwareId:d,softwareVersion:P,clientIdIssuedAt:O,clientSecretExpiresAt:A,updatedAt:_,createUser:D}=r,{clientLogoUrl:l}=ee(I),t=j=>{try{const N=new URL(window.blocklet.appUrl);return N.pathname=j,N.toString()}catch{return"-"}},C=pe.fromAppDid(g,n),U=[{title:i("common.baseInfo"),items:[{label:i("oauth.client.name"),value:s},{label:i("oauth.client.logoUri"),value:e.jsx(ne,{variant:"rounded",shape:"square",src:l,did:C.address,size:64})},{label:i("oauth.client.clientUri"),value:a?e.jsx(y,{children:a}):"-"},{label:i("oauth.client.clientId"),value:e.jsx(y,{children:g})},{label:i("oauth.client.clientSecret"),value:e.jsx(y,{children:h})},{label:i("oauth.client.redirectUris"),value:e.jsx(y,{children:(f||[]).join(", ")})},{label:i("oauth.client.scope"),value:e.jsx(M,{scope:k})},{label:i("oauth.client.createUser"),value:D?_e(D,!0):i("oauth.client.openRegistration")}]},{title:i("oauth.client.oauthEndpoints"),items:[{label:i("oauth.client.openidConfiguration"),value:e.jsx(y,{children:t("/.well-known/openid-configuration")})},{label:i("oauth.client.authorizationEndpoint"),value:e.jsx(y,{children:t(`${W.WELLKNOWN_SERVICE_PATH_PREFIX}/oauth/authorize`)})},{label:i("oauth.client.tokenEndpoint"),value:e.jsx(y,{children:t(`${W.WELLKNOWN_SERVICE_PATH_PREFIX}/oauth/token`)})},{label:i("oauth.client.userinfoEndpoint"),value:e.jsx(y,{children:t(`${W.WELLKNOWN_SERVICE_PATH_PREFIX}/oauth/userinfo`)})},{label:i("oauth.client.jwksUri"),value:e.jsx(y,{children:t(`${W.WELLKNOWN_SERVICE_PATH_PREFIX}/oauth/jwks`)})},{label:i("oauth.client.registrationEndpoint"),value:e.jsx(y,{children:t(`${W.WELLKNOWN_SERVICE_PATH_PREFIX}/oauth/register`)})},{label:i("oauth.client.endSessionEndpoint"),value:e.jsx(y,{children:t(`${W.WELLKNOWN_SERVICE_PATH_PREFIX}/oauth/logout`)})}]},{title:i("oauth.client.metaContact"),items:[{label:i("oauth.client.contacts"),value:x.length?e.jsx(y,{children:(x||[]).join(", ")}):"-"},{label:i("oauth.client.tosUri"),value:T?e.jsx(y,{children:T}):"-"},{label:i("oauth.client.policyUri"),value:E?e.jsx(y,{children:E}):"-"},{label:i("oauth.client.jwksUri"),value:q},{label:i("oauth.client.jwks"),value:c},{label:i("oauth.client.softwareId"),value:d},{label:i("oauth.client.softwareVersion"),value:P}]},{title:i("common.timeInfo"),items:[{label:i("oauth.client.clientIdIssuedAt"),value:O?e.jsx(V,{value:O*1e3,type:"all",locale:m}):"-"},{label:i("oauth.client.clientSecretExpiresAt"),value:A?e.jsx(V,{value:A*1e3,type:"all",locale:m}):"-"},{label:i("common.updatedAt"),value:_?e.jsx(V,{value:_,type:"all",locale:m}):"-"}]}].filter(Boolean);return e.jsxs(X,{open:!0,onClose:u,maxWidth:"lg",fullWidth:!0,children:[e.jsxs(G,{children:[i("oauth.client.oauthAppDetails"),e.jsx(Q,{onClick:u,sx:{position:"absolute",right:8,top:8},children:e.jsx(K,{})})]}),e.jsx(J,{children:e.jsx(p,{mt:1,children:U.map((j,N)=>e.jsxs(p,{children:[e.jsx(ge,{title:j.title,items:j.items}),N!==U.length-1&&e.jsx(Y,{sx:{my:2}})]},j.title))})})]})}fe.propTypes={client:o.object.isRequired,onClose:o.func.isRequired};function Be(r){return e.jsx(V,{value:r*1e3})}function ie({selected:r,onClose:u}){return r?e.jsx(fe,{client:r,onClose:u}):null}ie.propTypes={selected:o.object,onClose:o.func.isRequired};ie.defaultProps={selected:null};function be({open:r,onCreated:u,onClose:i}){return r?e.jsx(me,{onCreated:u,onClose:i}):null}be.propTypes={open:o.bool.isRequired,onCreated:o.func.isRequired,onClose:o.func.isRequired};function It(){var l;const[r,u]=b.useState({searchText:"",pageSize:10,page:1}),[i,m]=b.useState(null),[n,s]=b.useState(!1),g=b.useRef(null),{t:h,locale:f}=F(),{api:k}=$(),{teamDid:a}=B(),[I,x]=b.useState(null),[T,E]=b.useState(null),q=ze(),{getClientLogoUrl:c}=ee(),d=ke(async()=>await k.getOAuthClients({input:{teamDid:a,paging:{page:r.page,pageSize:r.pageSize}}}),[r.page,r.pageSize]),{loading:P}=d,O=b.useMemo(()=>{var t;return((t=d.value)==null?void 0:t.list)||[]},[(l=d.value)==null?void 0:l.list]),A=b.useMemo(()=>r.searchText?O.filter(t=>t.clientName.toLowerCase().includes(r.searchText.toLowerCase())||t.clientId.toLowerCase().includes(r.searchText.toLowerCase())||t.scope.toLowerCase().includes(r.searchText.toLowerCase())):O,[r.searchText,O]),_=b.useMemo(()=>[{label:h("oauth.client.name"),name:"clientName",options:{customBodyRender:(t,{rowIndex:C})=>{const U=A[C],j=c(U.logoUri),N=pe.fromAppDid(U.clientId,a);return e.jsx(p,{sx:{display:"flex",alignItems:"center",gap:2},children:e.jsxs(p,{display:"flex",alignItems:"center",gap:2,sx:{cursor:"pointer"},children:[e.jsx(ne,{variant:"rounded",shape:"square",did:N.address,src:j,size:48}),e.jsxs(L,{gap:.5,children:[e.jsx(p,{sx:{color:"text.primary"},children:U.clientName}),e.jsx(p,{sx:{color:"text.secondary"},children:U.clientUri})]})]})})}}},{label:h("oauth.client.clientId"),name:"clientId"},{label:h("oauth.client.scope"),name:"scope",options:{customBodyRender:t=>e.jsx(M,{scope:t})}},{label:h("common.createdAt"),name:"clientIdIssuedAt",options:{customBodyRender:Be}},{label:h("common.createdBy"),name:"createdBy",width:100,options:{customBodyRender:t=>t?e.jsx(ve,{showDid:!0,did:t,cardType:Ce.Detailed,infoType:Te.Minimal,sx:{border:0,padding:0}}):h("oauth.client.openRegistration")}},{label:h("common.actions"),name:"actions",width:100,align:"center",verticalKeyAlign:"center",options:{customBodyRender:(t,{rowIndex:C})=>{const U=A[C];return e.jsx(De,{actions:[{icon:e.jsx(Ae,{}),text:h("common.edit"),onClick:j=>{j.stopPropagation(),x(U)}},{icon:e.jsx(we,{}),text:h("common.delete"),onClick:j=>{j.stopPropagation(),E(U)}}]})}}}],[A,h,c,a,x,E]),D=({page:t,rowsPerPage:C,searchText:U})=>{r.pageSize!==C?u(j=>({...j,searchText:"",pageSize:C,page:1})):r.page!==t+1?u(j=>({...j,searchText:"",page:t+1})):r.searchText!==U&&u(j=>({...j,searchText:U,page:1}))};return e.jsxs(p,{ref:g,sx:{".custom-toobar-btns":{gap:"8px"},".custom-toobar-title .custom-toobar-title-inner>span":{display:"flex",alignItems:"center","white-space":"inherit",height:"100%"}},children:[q?e.jsx(le,{title:h("oauth.client.listTitle"),tooltipTitle:h("oauth.client.tooltipTitle"),link:`https://www.arcblock.io/docs/blocklet-developer/${f}/oauth-service`}):null,e.jsx(Se,{data:A,columns:_,options:{sort:!1,download:!1,filter:!1,print:!1,viewColumns:!1,page:r.page-1,rowsPerPage:r.pageSize,count:A.length,searchDebounceTime:400,onRowClick(t,{dataIndex:C},U){var j;if((j=g.current)!=null&&j.contains(U.target)){const N=A[C];m(N)}}},onChange:D,title:q?null:e.jsx(le,{title:h("oauth.client.listTitle"),tooltipTitle:h("oauth.client.tooltipTitle"),link:`https://www.arcblock.io/docs/blocklet-developer/${f}/oauth-service`}),customButtons:[e.jsxs(z,{variant:"contained",size:"small",onClick:()=>s(!0),children:[P?e.jsx(Z,{size:16}):e.jsx(ue,{style:{fontSize:16}}),h("common.create")]},"add")],loading:!1,emptyNode:e.jsx(Ie,{children:h("oauth.client.empty")})}),e.jsx(ie,{selected:i,onClose:()=>m(null)}),e.jsx(be,{open:n,onCreated:()=>{s(!1),d.retry()},onClose:()=>s(!1)}),I&&e.jsx(je,{client:I,onUpdate:d.retry,onClose:()=>x(null)}),T&&e.jsx(te,{...T,onDelete:d.retry,onClose:()=>E(null)})]})}export{It as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as e,aa as s,ai as z,ap as me,H as p,ah as de,ad as S,T as I,as as re}from"./vendor-mui-core-Bq8gXTan.js";import{r as u,b as ye}from"./vendor-react-DEoibe3W.js";import{I as h,a as M,B as be,$ as ke,bg as we,k as A}from"./vendor-ux-did-connect-BbCim3WZ.js";import{J as Se,K as N}from"./vendor-arcblock-f1tICt1E.js";import{d as C}from"./InfoOutlined-B5f3YRb4.js";import{K as Te}from"./keyboard-arrow-down-rounded-DadBVmpO.js";import{u as _e,p as Ae}from"./dashboard-CpxtvWAW.js";import{D as Ie,G as Me,M as Re,A as $e,am as Ce,y as q}from"./index-BMCGWiyM.js";import{I as Be}from"./index-DDI23z2P.js";import{_ as De}from"./dot-4jhL56kz.js";import{A as ze}from"./vendor-utils-BfZ4tlod.js";import{W as j}from"./did-address-DFiM35OM.js";import{V as Ne}from"./status-D8GKQyA3.js";import{c as qe}from"./spaces-BR4I2U0t.js";import"./vendor-hooks-DqdmWCmo.js";import"./lottie-web-jYmAQWuC.js";import"./useLocalStorage-iQ2AmaOA.js";import"./index-8eXqqyHQ.js";import"./confirm-Bbp7EOHO.js";import"./PlayArrow-DZsdEeq_.js";import"./get-safe-url-CuT70yLx.js";import"./session-BDyIB4uh.js";import"./use-blocklet-logo-DwwmdicD.js";import"./useSetState-CWq0AVWn.js";import"./use-mobile-
|
|
1
|
+
import{j as e,aa as s,ai as z,ap as me,H as p,ah as de,ad as S,T as I,as as re}from"./vendor-mui-core-Bq8gXTan.js";import{r as u,b as ye}from"./vendor-react-DEoibe3W.js";import{I as h,a as M,B as be,$ as ke,bg as we,k as A}from"./vendor-ux-did-connect-BbCim3WZ.js";import{J as Se,K as N}from"./vendor-arcblock-f1tICt1E.js";import{d as C}from"./InfoOutlined-B5f3YRb4.js";import{K as Te}from"./keyboard-arrow-down-rounded-DadBVmpO.js";import{u as _e,p as Ae}from"./dashboard-CpxtvWAW.js";import{D as Ie,G as Me,M as Re,A as $e,am as Ce,y as q}from"./index-BMCGWiyM.js";import{I as Be}from"./index-DDI23z2P.js";import{_ as De}from"./dot-4jhL56kz.js";import{A as ze}from"./vendor-utils-BfZ4tlod.js";import{W as j}from"./did-address-DFiM35OM.js";import{V as Ne}from"./status-D8GKQyA3.js";import{c as qe}from"./spaces-BR4I2U0t.js";import"./vendor-hooks-DqdmWCmo.js";import"./lottie-web-jYmAQWuC.js";import"./useLocalStorage-iQ2AmaOA.js";import"./index-8eXqqyHQ.js";import"./confirm-Bbp7EOHO.js";import"./PlayArrow-DZsdEeq_.js";import"./get-safe-url-CuT70yLx.js";import"./session-BDyIB4uh.js";import"./use-blocklet-logo-DwwmdicD.js";import"./useSetState-CWq0AVWn.js";import"./use-mobile-CtTQsfXN.js";import"./useAsync-C62uE2pS.js";import"./omit-Cao4GLS7.js";import"./api-C1S8LUld.js";const Ee={width:24,height:24,body:'<path fill="currentColor" d="m12 10.8l-3.9 3.9q-.275.275-.7.275t-.7-.275q-.275-.275-.275-.7t.275-.7l4.6-4.6q.3-.3.7-.3t.7.3l4.6 4.6q.275.275.275.7t-.275.7q-.275.275-.7.275t-.7-.275L12 10.8Z"/>'},Pe=Ee,Ue={width:24,height:24,body:'<path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 17a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v2a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2zm12 0a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v2a2 2 0 0 1-2 2h-2a2 2 0 0 1-2-2zM9 5a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v2a2 2 0 0 1-2 2h-2a2 2 0 0 1-2-2zM6 15v-1a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v1m-6-6v3"/>'},He=Ue,Le={width:24,height:24,body:'<path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 7a4 4 0 1 0 8 0a4 4 0 1 0-8 0M3 21v-2a4 4 0 0 1 4-4h4a4 4 0 0 1 4 4v2m1-17.87a4 4 0 0 1 0 7.75M21 21v-2a4 4 0 0 0-3-3.85"/>'},Ke=Le,Ve={width:24,height:24,body:'<g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><path d="M7 12h3v4H7z"/><path d="M10 6H4a1 1 0 0 0-1 1v12a1 1 0 0 0 1 1h16a1 1 0 0 0 1-1V7a1 1 0 0 0-1-1h-6"/><path d="M10 4a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v3a1 1 0 0 1-1 1h-2a1 1 0 0 1-1-1zm4 12h2m-2-4h4"/></g>'},Oe=Ve,Qe={width:24,height:24,body:'<g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><path d="M19.5 7A9 9 0 0 0 12 3a8.991 8.991 0 0 0-7.484 4"/><path d="M11.5 3a16.989 16.989 0 0 0-1.826 4M12.5 3a16.989 16.989 0 0 1 1.828 4M19.5 17a9 9 0 0 1-7.5 4a8.991 8.991 0 0 1-7.484-4"/><path d="M11.5 21a16.989 16.989 0 0 1-1.826-4m2.826 4a16.989 16.989 0 0 0 1.828-4M2 10l1 4l1.5-4L6 14l1-4m10 0l1 4l1.5-4l1.5 4l1-4M9.5 10l1 4l1.5-4l1.5 4l1-4"/></g>'},We=Qe,Fe={width:24,height:24,body:'<g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><path d="M3 12a9 9 0 1 0 18 0a9 9 0 0 0-18 0"/><path d="M12 7v5l3 3"/></g>'},le=Fe,Ge={width:24,height:24,body:'<path fill="currentColor" d="M12 14q-.825 0-1.413-.588T10 12q0-.825.588-1.413T12 10q.825 0 1.413.588T14 12q0 .825-.588 1.413T12 14Zm0 7q-3.475 0-6.025-2.288T3.05 13H5.1q.35 2.6 2.313 4.3T12 19q2.925 0 4.963-2.038T19 12q0-2.925-2.038-4.963T12 5q-1.725 0-3.225.8T6.25 8H9v2H3V4h2v2.35q1.275-1.6 3.113-2.475T12 3q1.875 0 3.513.713t2.85 1.924q1.212 1.213 1.925 2.85T21 12q0 1.875-.713 3.513t-1.924 2.85q-1.213 1.212-2.85 1.925T12 21Z"/>'},Ze=Ge;function E({icon:n,value:r,name:a,url:l="",animated:c=!1,LinkComponent:d=me,loading:x=!1}){const g=()=>ye.isValidElement(n)?n:e.jsx(s,{component:h,icon:n,alt:typeof a=="string"?a:"",sx:{fontSize:30}});if(x)return e.jsxs(ce,{children:[n&&e.jsx(s,{className:"metric__image",children:e.jsx(z,{variant:"circular",width:32,height:32})}),e.jsxs(s,{children:[e.jsx(z,{className:`metric__number ${c?"metric__number--animated":""}`,variant:"rounded",width:160,height:"36px",sx:{mb:1}}),e.jsx(z,{className:"metric__name",variant:"rounded",width:80,height:20})]})]});const f=e.jsxs(e.Fragment,{children:[n&&e.jsx(s,{className:"metric__image",children:g()}),e.jsxs(s,{children:[u.isValidElement(r)?e.jsx(s,{className:`metric__number ${c?"metric__number--animated":""}`,children:r}):e.jsx(s,{className:`metric__number ${c?"metric__number--animated":""}`,dangerouslySetInnerHTML:{__html:r}}),e.jsx(s,{className:"metric__name",children:a})]})]});return e.jsx(ce,{children:l?e.jsx(d,{href:l,sx:{textDecoration:"none"},children:f}):f})}E.propTypes={icon:p.string.isRequired,value:p.string.isRequired,name:p.string.isRequired,url:p.string,animated:p.bool,LinkComponent:p.elementType,loading:p.bool};E.defaultProps={url:"",animated:!1,LinkComponent:me,loading:!1};const ce=de(s)`
|
|
2
2
|
border-left: 1px solid ${n=>n.theme.palette.divider};
|
|
3
3
|
padding: 10px 0 10px 16px;
|
|
4
4
|
@media (max-width: ${n=>n.theme.breakpoints.values.sm}px) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as I}from"./vendor-react-DEoibe3W.js";import{e as C,m as B,j as n,H as s,aa as x,T as g,as as k,ah as P,ad as M,cl as O,cm as q}from"./vendor-mui-core-Bq8gXTan.js";import{B as X,p as _}from"./dashboard-CpxtvWAW.js";import{a as R,a5 as J,I as K,ac as Q}from"./vendor-ux-did-connect-BbCim3WZ.js";import{ax as S,aF as F,D as V,G as N,f as $,aN as Y}from"./index-BMCGWiyM.js";import{aM as Z}from"./vendor-utils-BfZ4tlod.js";import{X as U}from"./vendor-arcblock-f1tICt1E.js";import{B as E}from"./base-chart-CoApVzod.js";import{B as ee}from"./bundle-avatar-CH2OoDP-.js";import"./useLocalStorage-iQ2AmaOA.js";import"./index-8eXqqyHQ.js";import"./confirm-Bbp7EOHO.js";import"./PlayArrow-DZsdEeq_.js";import"./get-safe-url-CuT70yLx.js";import"./session-BDyIB4uh.js";import"./vendor-hooks-DqdmWCmo.js";import"./use-blocklet-logo-DwwmdicD.js";import"./InfoOutlined-B5f3YRb4.js";import"./dot-4jhL56kz.js";import"./useAsync-C62uE2pS.js";import"./useSetState-CWq0AVWn.js";import"./use-mobile-
|
|
1
|
+
import{r as I}from"./vendor-react-DEoibe3W.js";import{e as C,m as B,j as n,H as s,aa as x,T as g,as as k,ah as P,ad as M,cl as O,cm as q}from"./vendor-mui-core-Bq8gXTan.js";import{B as X,p as _}from"./dashboard-CpxtvWAW.js";import{a as R,a5 as J,I as K,ac as Q}from"./vendor-ux-did-connect-BbCim3WZ.js";import{ax as S,aF as F,D as V,G as N,f as $,aN as Y}from"./index-BMCGWiyM.js";import{aM as Z}from"./vendor-utils-BfZ4tlod.js";import{X as U}from"./vendor-arcblock-f1tICt1E.js";import{B as E}from"./base-chart-CoApVzod.js";import{B as ee}from"./bundle-avatar-CH2OoDP-.js";import"./useLocalStorage-iQ2AmaOA.js";import"./index-8eXqqyHQ.js";import"./confirm-Bbp7EOHO.js";import"./PlayArrow-DZsdEeq_.js";import"./get-safe-url-CuT70yLx.js";import"./session-BDyIB4uh.js";import"./vendor-hooks-DqdmWCmo.js";import"./use-blocklet-logo-DwwmdicD.js";import"./InfoOutlined-B5f3YRb4.js";import"./dot-4jhL56kz.js";import"./useAsync-C62uE2pS.js";import"./useSetState-CWq0AVWn.js";import"./use-mobile-CtTQsfXN.js";import"./lottie-web-jYmAQWuC.js";import"./index-w4f-mlFt.js";function D({title:o,cpus:c,currentLoad:a,history:u,empty:i,onHover:h,hoverIndex:l}){const{t:y,locale:p}=R(),t=C(),e=`${o||y("common.cpu")} (${Math.floor(a||0)}%)`,r=100,m=80,d=T=>`${T}%`,b=[{max:m,color:B(t.palette.primary.main,t.palette.mode==="dark"?.15:.08)},{min:m,max:100,color:B(t.palette.warning.main,t.palette.mode==="dark"?.18:.12)},{min:100,color:B(t.palette.error.main,t.palette.mode==="dark"?.25:.18)}],j={silent:!0,symbol:["none","none"],data:[{yAxis:100,lineStyle:{color:t.palette.error.main,type:"dashed",width:1.5},label:{formatter:`${d(100)}`,position:"insideEndTop",color:t.palette.text.secondary,padding:[2,4],borderRadius:2}},{yAxis:m,lineStyle:{color:t.palette.warning.light,type:"dashed",width:1.5},label:{formatter:`${d(m)}`,position:"insideEndTop",color:t.palette.text.secondary,padding:[2,4],borderRadius:2}}]},v=n.jsx("span",{children:`${y("system.cores")}: ${(c==null?void 0:c.length)||0}`}),L=T=>S(T,"HH:mm",p);return n.jsx(E,{title:e,total:r,history:u,valueFn:d,xAxisFormat:L,visualMapPieces:b,markLineData:j,extraInfo:v,empty:i,onHover:h,hoverIndex:l})}D.propTypes={title:s.string,cpus:s.array,currentLoad:s.number,history:s.array,empty:s.node,onHover:s.func,hoverIndex:s.number};D.defaultProps={title:"",cpus:[],currentLoad:0,history:[],empty:null,onHover:()=>{},hoverIndex:null};function H({instanceCount:o,title:c,total:a,used:u,history:i,empty:h,onHover:l,hoverIndex:y}){const{t:p,locale:t}=R(),e=C(),r=!!a,m=a-u,d=r?`(${F(u)}, ${Math.floor(u/a*100)}%)`:"",b=`${c||p("common.memory")} ${d}`,j=Math.ceil(a*.8),v=f=>U(f,{short:!0,iec:!0}),L=[];o&&L.push({title:p("system.instances"),metric:o}),r&&L.push({title:p("system.free"),metric:v(m)});const T=[{max:j,color:B(e.palette.primary.main,e.palette.mode==="dark"?.15:.08)},{min:j,max:a,color:B(e.palette.warning.main,e.palette.mode==="dark"?.18:.12)},{min:a,color:B(e.palette.error.main,e.palette.mode==="dark"?.25:.18)}],A={silent:!0,symbol:["none","none"],data:[{yAxis:a,lineStyle:{color:e.palette.error.main,type:"dashed",width:1.5},label:{formatter:`${v(a)}`,position:"insideEndTop",color:e.palette.text.secondary,padding:[2,4],borderRadius:2}},{yAxis:j,lineStyle:{color:e.palette.warning.light,type:"dashed",width:1.5},label:{formatter:`${v(j)}`,position:"insideEndTop",color:e.palette.text.secondary,padding:[2,4],borderRadius:2}}]},z=n.jsx(n.Fragment,{children:L.map((f,W)=>n.jsxs(x,{sx:{marginLeft:W===0?0:1,display:"inline-flex"},children:[f.title,": ",f.metric]},f.title))}),G=f=>S(f,"HH:mm",t);return n.jsx(E,{title:b,total:a,history:i,valueFn:v,xAxisFormat:G,visualMapPieces:T,markLineData:A,extraInfo:z,empty:h,onHover:l,hoverIndex:y})}H.propTypes={title:s.string,instanceCount:s.number,total:s.number,used:s.number,history:s.array,empty:s.node,onHover:s.func,hoverIndex:s.number};H.defaultProps={title:"",instanceCount:null,total:null,used:null,history:[],empty:null,onHover:()=>{},hoverIndex:null};function w({blocklet:o,...c}){const{t:a}=R(),{info:u}=V(),{runtimeHistory:i}=N(),[h,l]=I.useState(null),y=I.useCallback(t=>o.status!=="running"?n.jsx(g,{children:a("blocklet.runtimeInfo.noRunning")}):t.length?null:n.jsx(J,{children:a("common.empty")}),[o.status,a]),p=I.useCallback(t=>{l(t)},[]);return i.length===0?n.jsx(g,{children:a("blocklet.runtimeInfo.noRunning")}):n.jsxs(te,{component:"div",...c,children:[n.jsxs(k,{className:"page-metrics",container:!0,spacing:5,children:[n.jsx(k,{item:!0,xs:12,sx:{pt:"16px !important"},children:n.jsx(g,{fontSize:"16px",fontWeight:"bold",children:"CPU"})}),i==null?void 0:i.map(t=>{var e,r;return n.jsx(k,{item:!0,lg:4,md:6,sm:6,xs:12,sx:{pt:"16px !important"},children:n.jsx(D,{title:`${t.name} CPU`,empty:y(t.cpu),currentLoad:((e=t.appRuntimeInfo)==null?void 0:e.cpuUsage)||0,cpus:((r=t.appRuntimeInfo)==null?void 0:r.cpus)||[],history:t.cpu,onHover:p,hoverIndex:h,style:{height:150}})},`${t.key}-cpu`)})]}),n.jsxs(k,{className:"page-metrics",container:!0,spacing:5,sx:{mt:1},children:[n.jsx(k,{item:!0,xs:12,sx:{pt:"16px !important"},children:n.jsx(g,{fontSize:"16px",fontWeight:"bold",children:"Memory"})}),i==null?void 0:i.map(t=>{var e,r,m;return n.jsx(k,{item:!0,lg:4,md:6,sm:6,xs:12,sx:{pt:"16px !important"},children:n.jsx(H,{title:`${t.name} Memory`,empty:y(t.memory),total:(e=u.runtimeConfig)!=null&&e.blockletMaxMemoryLimit?U.parseSize(`${u.runtimeConfig.blockletMaxMemoryLimit*(t.key===((r=o==null?void 0:o.meta)==null?void 0:r.did)?i.length-1:1)}MiB`):0,used:((m=t.appRuntimeInfo)==null?void 0:m.memoryUsage)||0,history:t.memory,onHover:p,hoverIndex:h,style:{height:150}})},`${t.key}-memory`)})]})]})}w.propTypes={blocklet:s.object.isRequired,cpuHistory:s.arrayOf(s.shape({date:s.number,value:s.number})),memoryHistory:s.arrayOf(s.shape({date:s.number,value:s.number}))};w.defaultProps={cpuHistory:[],memoryHistory:[]};const te=P(g)``;function re(){const{t:o,locale:c}=R(),[a,u]=I.useState(6),{blocklet:i,actions:{refreshBlocklet:h}}=N(),l=I.useMemo(()=>{const t=[];return $.forEachBlockletSync(i,(e,{ancestors:r,id:m,level:d})=>{var b;(b=e==null?void 0:e.meta)!=null&&b.did&&e.meta.did!==i.meta.did&&t.push({type:"blocklet",groupId:i.meta.did,groupName:$.getDisplayName(i),id:m,name:$.getDisplayName(e,!0),blocklet:i,component:e,level:d-1>=0?d-1:0,runtimeInfo:e.runtimeInfo,ancestors:r})}),t},[i]);I.useEffect(()=>{h({hours:a});const t=setInterval(()=>{h({hours:a})},1e3*10);return()=>{clearInterval(t)}},[a]);const y=t=>_(Number(t||0),{locale:Y(c)}),p=[{label:o("common.name"),name:"name",options:{customBodyRenderLite(t){const{name:e,component:r,level:m,ancestors:d}=l[t];return n.jsxs(x,{display:"flex",alignItems:"center",pl:m*2,children:[n.jsx(ee,{size:20,blocklet:r,ancestors:d}),n.jsx(x,{ml:1,children:e}),n.jsx(X,{variant:"pin",style:{marginLeft:8},status:r.status,source:r.source,progress:r.progress})]})}}},{label:o("common.uptime"),name:"runtimeInfo.uptime",options:{customBodyRenderLite(t){const{runtimeInfo:e,component:r}=l[t];return!(r!=null&&r.status)||r.status!=="running"?n.jsx(M,{title:o("common.noData"),children:"--"}):y(e==null?void 0:e.uptime)}}},{label:o("blocklet.runtimeInfo.memoryUsage"),name:"runtimeInfo.memoryUsage",options:{customBodyRenderLite(t){const{runtimeInfo:e,component:r}=l[t];return!(r!=null&&r.status)||r.status!=="running"?n.jsx(M,{title:o("common.noData"),children:"--"}):F((e==null?void 0:e.memoryUsage)||0)}}},{label:o("blocklet.runtimeInfo.cpuUsage"),name:"runtimeInfo.cpuUsage",options:{customBodyRenderLite(t){const{runtimeInfo:e,component:r}=l[t];return!(r!=null&&r.status)||r.status!=="running"?n.jsx(M,{title:o("common.noData"),children:"--"}):`${((e==null?void 0:e.cpuUsage)||0).toFixed(1)}%`}}},{label:o("analytics.runtime"),name:"runtimeInfo.runtime",options:{customBodyRenderLite(t){const{runtimeInfo:e}=l[t];return e!=null&&e.uptime?n.jsxs(x,{display:"flex",alignItems:"center",children:[n.jsx(K,{icon:e!=null&&e.runningDocker?"catppuccin:docker-ignore":"logos:nodejs-icon"}),n.jsx(x,{ml:1,children:e!=null&&e.runningDocker?"Docker":"Nodejs"})]}):null}}},{label:o("blocklet.runtimeInfo.processId"),name:"runtimeInfo.pid",options:{customBodyRenderLite(t){const{runtimeInfo:e,component:r}=l[t];return!(r!=null&&r.status)||r.status!=="running"?n.jsx(M,{title:o("common.noData"),children:"--"}):e==null?void 0:e.pid}}},{label:o("blocklet.runtimeInfo.port"),name:"runtimeInfo.port",options:{customBodyRenderLite(t){const{runtimeInfo:e,component:r}=l[t];return!(r!=null&&r.status)||r.status!=="running"?n.jsx(M,{title:o("common.noData"),children:"--"}):e==null?void 0:e.port}}}];return n.jsxs(ne,{component:"div",children:[n.jsxs(x,{display:"flex",justifyContent:"space-between",flexDirection:"row",mb:2,children:[n.jsx(g,{component:"h3",variant:"h5",color:"textPrimary",style:{fontSize:18,fontWeight:"bold"},mb:2,children:o("analytics.trend")}),n.jsx(O,{size:"small",exclusive:!0,value:a,onChange:(t,e)=>{Z(e)&&u(e)},children:[1,3,6,12,24].map(t=>n.jsxs(q,{value:t,children:[t,"H"]},t))})]}),n.jsx(x,{children:n.jsx(w,{blocklet:i})}),n.jsx(x,{mt:3,children:n.jsx(Q,{title:o("analytics.detail"),className:"monitor-table",locale:c,data:l,columns:p,options:{search:!1,download:!1,filter:!1,print:!1,viewColumns:!1,pagination:!1,rowsPerPage:100}})})]})}re.propTypes={};const ne=P(g)``;export{re as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as Ie,I as Y,bb as It,k as N,a3 as Q,ar as Zt,B as Yt,ab as Jt,ac as Qt,r as io,ci as sn,ax as so}from"./vendor-ux-did-connect-BbCim3WZ.js";import{a as Dt,l as jt,u as E,b as er,m as ln}from"./vendor-hooks-DqdmWCmo.js";import{r as H,a as ee,g as lo}from"./vendor-react-DEoibe3W.js";import{H as D,j as a,aa as $,ad as Z,I as he,bt as Rt,e as kt,O as te,N as co,y as Ke,T as uo,a9 as A,cH as fo,cI as po,cJ as mo,cK as re,c4 as ue,cL as cn,cM as tr,cN as rr,cO as ho,cP as un,cQ as vo,cR as yo,b5 as xe,cS as go,cT as bo,cU as xo,cV as _o,cW as Po,cX as Co,cY as jo,cZ as Ro,c_ as Oo,c$ as wo,d0 as To,bo as ge,bQ as Mt,bs as be,bR as Pt,bq as qo,E as Mo,bK as So,C as Io,bV as Do,bu as dn,bv as fn,al as ko,ah as $o}from"./vendor-mui-core-Bq8gXTan.js";import{n as Se,S as St,aK as Wo,D as Ct,A as Bo,aB as dr,P as pn,I as Ce,o as mn}from"./vendor-utils-BfZ4tlod.js";import{G as $t,D as Wt,aC as nr,aD as ce}from"./index-BMCGWiyM.js";import{S as Lt}from"./simple-select-0cjVFuay.js";import{e as Ao,u as hn}from"./dashboard-CpxtvWAW.js";import{A as vn}from"./config-DEbtcbH9.js";import{u as Ho}from"./use-mobile-CtTQsfXN.js";import"./lottie-web-jYmAQWuC.js";import"./vendor-arcblock-f1tICt1E.js";import"./useLocalStorage-iQ2AmaOA.js";import"./index-8eXqqyHQ.js";import"./confirm-Bbp7EOHO.js";import"./PlayArrow-DZsdEeq_.js";import"./get-safe-url-CuT70yLx.js";import"./session-BDyIB4uh.js";import"./use-blocklet-logo-DwwmdicD.js";import"./InfoOutlined-B5f3YRb4.js";import"./dot-4jhL56kz.js";import"./useAsync-C62uE2pS.js";import"./useSetState-CWq0AVWn.js";import"./use-mobile-DwzRjjku.js";const Lo={width:24,height:24,body:'<path fill="currentColor" d="M11 14.2V6q0-.425.288-.713T12 5q.425 0 .713.288T13 6v8.2l2.9-2.9q.275-.275.7-.275t.7.275q.275.275.275.7t-.275.7l-4.6 4.6q-.3.3-.7.3t-.7-.3l-4.6-4.6q-.275-.275-.275-.7t.275-.7q.275-.275.7-.275t.7.275l2.9 2.9Z"/>'},Eo={width:24,height:24,body:'<path fill="currentColor" d="m11 8.8l-2.9 2.9q-.275.275-.7.275t-.7-.275q-.275-.275-.275-.7t.275-.7l4.6-4.6q.3-.3.7-.3t.7.3l4.6 4.6q.275.275.275.7t-.275.7q-.275.275-.7.275t-.7-.275L13 8.8V17q0 .425-.288.713T12 18q-.425 0-.713-.288T11 17V8.8Z"/>'},or={width:24,height:24,body:'<path fill="currentColor" d="M7 21q-.825 0-1.413-.588T5 19V6q-.425 0-.713-.288T4 5q0-.425.288-.713T5 4h4q0-.425.288-.713T10 3h4q.425 0 .713.288T15 4h4q.425 0 .713.288T20 5q0 .425-.288.713T19 6v13q0 .825-.588 1.413T17 21H7Zm2-4h2V8H9v9Zm4 0h2V8h-2v9Z"/>'},ar={width:24,height:24,body:'<path fill="currentColor" d="M4 21q-.425 0-.713-.288T3 20v-2.425q0-.4.15-.763t.425-.637L16.2 3.575q.3-.275.663-.425t.762-.15q.4 0 .775.15t.65.45L20.425 5q.3.275.437.65T21 6.4q0 .4-.138.763t-.437.662l-12.6 12.6q-.275.275-.638.425t-.762.15H4ZM17.6 7.8L19 6.4L17.6 5l-1.4 1.4l1.4 1.4Z"/>'};function yn({enabled:e,showUp:d=!0,showDown:o=!0,showSwitch:n=!0,showDelete:i=!0,showEdit:c=!0,disableEdit:m=!1,disableSwitch:t=!1,onClickUp:r=()=>{},onClickDown:s=()=>{},onClickSwitch:u=()=>{},onClickDelete:P=()=>{},onClickEdit:v=()=>{}}){const{t:x}=Ie();return a.jsxs($,{sx:{display:"flex",alignItems:"center",gap:0},onClick:w=>w.stopPropagation(),children:[c?a.jsx(Z,{title:x("common.edit"),children:a.jsx(he,{size:"small",onClick:v,color:"success",disabled:m,children:a.jsx(Y,{icon:ar,fontSize:18})})}):null,i?a.jsx(Z,{title:x("common.delete"),children:a.jsx(he,{size:"small",onClick:P,color:"error",children:a.jsx(Y,{icon:or,fontSize:18})})}):null,n?a.jsx(Z,{title:x(e?"common.enabled":"common.disabled"),children:a.jsx(Rt,{size:"small",checked:e,onClick:u,disabled:t})}):null,d?a.jsx(Z,{title:x("common.moveUp"),children:a.jsx(he,{size:"small",onClick:r,disabled:m,children:a.jsx(Y,{icon:Eo,fontSize:20})})}):null,o?a.jsx(Z,{title:x("common.moveDown"),children:a.jsx(he,{size:"small",onClick:s,disabled:m,children:a.jsx(Y,{icon:Lo,fontSize:20})})}):null]})}yn.propTypes={enabled:D.bool.isRequired,showUp:D.bool,showDown:D.bool,showSwitch:D.bool,showDelete:D.bool,showEdit:D.bool,disableEdit:D.bool,disableSwitch:D.bool,onClickUp:D.func,onClickDown:D.func,onClickSwitch:D.func,onClickDelete:D.func,onClickEdit:D.func};const zo=H.forwardRef((e,d)=>{var O,q,B;const{t:o}=H.useContext(It),{blocklet:n}=$t(),{api:i}=Wt(),c=(O=n==null?void 0:n.meta)==null?void 0:O.did,m=kt(),t=((B=(q=m==null?void 0:m.transitions)==null?void 0:q.duration)==null?void 0:B.leavingScreen)||300,r=Dt({mode:"add",show:!1,isDefaultRule:!1,callback:Se,get dialogTitle(){return this.mode==="edit"?o("securityRule.edit"):this.mode==="view"?o("securityRule.view"):o("securityRule.add")}}),s=jt(async()=>{const{accessPolicies:M}=await i.getBlockletAccessPolicies({input:{did:c}});return St(M,T=>T.isProtected?1:0)},{manual:!0}),u=jt(async()=>{const{responseHeaderPolicies:M}=await i.getBlockletResponseHeaderPolicies({input:{did:c}});return St(M,T=>T.isProtected?1:0)},{manual:!0}),{handleSubmit:P,control:v,watch:x,setValue:w,getValues:S,reset:I,formState:{errors:R}}=nr({mode:"onChange",defaultValues:{componentDid:"",pathPattern:"",responseHeaderPolicyId:"",accessPolicyId:"",remark:""}}),p=E(()=>{I(),r.mode="add"}),C=E(()=>{r.show=!1,setTimeout(()=>{p()},t)}),y=E((M,T=null)=>{r.show=!0,T&&(r.isDefaultRule=T.id===N.SECURITY_RULE_DEFAULT_ID,r.mode="edit",w("componentDid",T.componentDid),w("pathPattern",T.pathPattern),w("responseHeaderPolicyId",T.responseHeaderPolicyId),w("accessPolicyId",T.accessPolicyId),w("remark",T.remark||"")),M?r.callback=M:r.mode="view",s.run(),u.run()});H.useImperativeHandle(d,()=>({open:y,close:C}),[y,C]);const f=E(()=>{const[M,T]=S(["accessPolicyId","responseHeaderPolicyId"]);return!M&&!T?o("securityRule.form.accessPolicyOrResponseHeaderPolicyRequired"):!0}),b=E(M=>{const T=f();T===!0?r.callback(M,C):Q.error(T)}),_=x("componentDid"),h=E(M=>{const T=M==null?void 0:M.trim();if(!T)return o("common.requiredErrorText",{name:o("securityRule.form.pathPattern")});if(_){if(T.startsWith("/"))return o("securityRule.form.pathPatternErrorText")}else if(!T.startsWith("/")&&T!=="*")return o("securityRule.form.pathPatternErrorText");return!0}),l=E(M=>(M==null?void 0:M.trim())?!0:o("common.requiredErrorText",{name:o("securityRule.form.accessPolicy")})),g=E(M=>(M==null?void 0:M.trim())?!0:o("common.requiredErrorText",{name:o("securityRule.form.responseHeaderPolicy")})),j=er(()=>{const T=((n==null?void 0:n.children)||[]).find(k=>k.meta.did===_);return T!=null&&T.mountPoint?Wo(T.mountPoint):null},[n,_]);return a.jsx(Zt,{open:r.show,title:r.dialogTitle,onClose:C,PaperProps:{style:{minHeight:"unset"}},actions:a.jsx(Yt,{color:"primary",autoFocus:!0,variant:"contained",onClick:P(b),children:o("common.confirm")}),children:a.jsxs("form",{noValidate:!0,autoComplete:"off",children:[r.isDefaultRule?null:a.jsx(ce,{name:"componentDid",control:v,render:({field:M})=>{var T,k;return a.jsx(Lt,{fullWidth:!0,margin:"dense",size:"small",label:o("securityRule.form.component"),placeholer:o("securityRule.form.componentPlaceholder"),options:n.children.map(L=>({title:L.meta.title,value:L.meta.did,description:L.mountPoint})),error:!!((T=R==null?void 0:R.componentDid)!=null&&T.message),helperText:((k=R==null?void 0:R.componentDid)==null?void 0:k.message)||"Choose belong to component",...Ct(M,"ref"),readOnly:r.mode==="view"})}}),a.jsx(ce,{name:"pathPattern",control:v,rules:{validate:h},render:({field:M})=>{var T,k;return a.jsx(te,{fullWidth:!0,required:!0,margin:"dense",size:"small",placeholder:o("securityRule.form.pathPatternPlaceholder"),label:o("securityRule.form.pathPattern"),error:!!((T=R==null?void 0:R.pathPattern)!=null&&T.message),helperText:((k=R==null?void 0:R.pathPattern)==null?void 0:k.message)||"/abc/bcd or /abc or /abc/*",InputProps:{startAdornment:j?a.jsx(co,{position:"start",children:j}):null},...M,disabled:r.isDefaultRule||r.mode==="view"})}}),a.jsx(ce,{name:"accessPolicyId",control:v,rules:{validate:r.isDefaultRule?l:Se},render:({field:M})=>{var T,k;return a.jsx(Lt,{fullWidth:!0,required:r.isDefaultRule,margin:"dense",size:"small",label:o("securityRule.form.accessPolicy"),placeholer:o("securityRule.form.accessPolicyPlaceholder"),options:(s.data||[]).map(L=>({value:L.id,title:L.name,description:L.description})),error:!!((T=R==null?void 0:R.accessPolicyId)!=null&&T.message),helperText:((k=R==null?void 0:R.accessPolicyId)==null?void 0:k.message)||o("securityRule.form.accessPolicyHelperText"),...Ct(M,"ref"),disabled:r.mode==="view"})}}),a.jsx(ce,{name:"responseHeaderPolicyId",control:v,rules:{validate:r.isDefaultRule?g:Se},render:({field:M})=>{var T,k;return a.jsx(Lt,{fullWidth:!0,required:r.isDefaultRule,margin:"dense",size:"small",label:o("securityRule.form.responseHeaderPolicy"),placeholer:o("securityRule.form.responseHeaderPolicyPlaceholder"),options:(u.data||[]).map(L=>({title:L.name,value:L.id,description:L.description})),error:!!((T=R==null?void 0:R.responseHeaderPolicyId)!=null&&T.message),helperText:((k=R==null?void 0:R.responseHeaderPolicyId)==null?void 0:k.message)||o("securityRule.form.responseHeaderPolicyHelperText"),...Ct(M,"ref"),disabled:r.mode==="view"})}}),a.jsx(ce,{name:"remark",control:v,render:({field:M})=>a.jsx(te,{fullWidth:!0,multiline:!0,minRows:3,maxRows:7,size:"small",margin:"dense",placeholder:o("securityRule.form.remarkPlaceholder"),label:o("securityRule.form.remark"),helperText:R==null?void 0:R.message,...M,disabled:r.mode==="view"})})]})})}),se=async(e,d="Failed to saved")=>{try{await e()}catch(o){Q.error((o==null?void 0:o.message)||d)}};function gn(){var h;const{t:e,locale:d}=Ie(),{blocklet:o}=$t(),{api:n}=Wt(),i=(h=o==null?void 0:o.meta)==null?void 0:h.did,c=kt(),m=H.useRef(null),t=H.useRef(null),{confirmApi:r,confirmHolder:s}=Jt(),u=jt(async()=>{const{securityRules:l}=await n.getBlockletSecurityRules({input:{did:i,includeDisabled:!0}});return l}),P=l=>l.id===N.SECURITY_RULE_DEFAULT_ID,v=E(l=>{var j;return(j=((o==null?void 0:o.children)||[]).find(O=>O.meta.did===l))==null?void 0:j.mountPoint}),x=(u.data||[]).map(l=>{if(l.componentDid){const g=v(l.componentDid);l._disabled=g===void 0}return l}),w=x.filter(l=>!P(l)),S=(l,g)=>{se(async()=>{const j=l.target.checked;await n.updateBlockletSecurityRule({input:{did:i,data:{id:g.id,enabled:j}}}),Q.success(e("common.succeeded")),u.run()})},I=(l,g,j)=>{se(async()=>{const O=j-1,q=x[O];await Promise.all([n.updateBlockletSecurityRule({input:{did:i,data:{id:g.id,priority:q.priority}}}),n.updateBlockletSecurityRule({input:{did:i,data:{id:q.id,priority:g.priority}}})]),Q.success(e("common.succeeded")),u.run()})},R=(l,g,j)=>{se(async()=>{const O=j+1,q=x[O];await Promise.all([n.updateBlockletSecurityRule({input:{did:i,data:{id:g.id,priority:q.priority}}}),n.updateBlockletSecurityRule({input:{did:i,data:{id:q.id,priority:g.priority}}})]),Q.success(e("common.succeeded")),u.run()})},p=()=>{m.current.open((l,g)=>{se(async()=>{await n.addBlockletSecurityRule({input:{did:i,data:l}}),Q.success(e("common.succeeded")),u.run(),g()})})},C=(l,g)=>{m.current.open((j,O)=>{se(async()=>{await n.updateBlockletSecurityRule({input:{did:i,data:{...j,id:g.id}}}),Q.success(e("common.succeeded")),u.run(),O()})},g)},y=(l,g)=>{r.open({title:e("securityRule.delete.title"),content:e("securityRule.delete.description"),confirmButtonText:e("common.confirm"),confirmButtonProps:{color:"error"},cancelButtonText:e("common.cancel"),onConfirm(j){se(async()=>{await n.deleteBlockletSecurityRule({input:{did:i,id:g.id}}),Q.success(e("common.succeeded")),u.run(),j()})}})},f={sort:!1,download:!1,filter:!1,print:!1,search:!1,viewColumns:!1,expandableRowsOnClick:!0,searchDebounceTime:600,onRowClick(l,{dataIndex:g},j){var O;if((O=t.current)!=null&&O.contains(j.target)){const q=x[g];m.current.open(void 0,q)}},setRowProps:(l,g)=>x[g]._disabled?{title:e("securityRule.useless"),style:{backgroundColor:c.palette.action.disabledBackground,cursor:"default"}}:{}},b=[a.jsx(Ke,{size:"small",variant:"outlined",onClick:()=>{u.run()},sx:{mr:1},children:e("common.refresh")},"refresh"),a.jsx(Ke,{size:"small",variant:"contained",onClick:p,children:e("common.add")})],_=[{label:e("securityRule.form.pathPattern"),name:"pathPattern",options:{customBodyRenderLite(l){const g=x[l];return a.jsx($,{sx:{whiteSpace:"nowrap"},children:g.id===N.SECURITY_RULE_DEFAULT_ID?"Default":Bo(v(g.componentDid),g.pathPattern)})}}},{label:e("responseHeaderPolicy.title"),name:"responseHeaderPolicy",options:{customBodyRenderLite(l){var j;return(j=x[l].responseHeaderPolicy)==null?void 0:j.name}}},{label:e("accessPolicy.title"),name:"accessPolicyId",options:{customBodyRenderLite(l){var j;return(j=x[l].accessPolicy)==null?void 0:j.name}}},{label:e("securityRule.form.remark"),name:"remark"},{label:e("common.actions"),name:"",width:100,align:"center",verticalKeyAlign:"center",options:{customBodyRenderLite(l){const g=x[l],j=P(g);return a.jsx(yn,{disableEdit:g._disabled,disableSwitch:g._disabled,enabled:g.enabled,showSwitch:!j,showDelete:!j,showUp:l>0&&!j,showDown:l<w.length-1&&!j,onClickSwitch:O=>{S(O,g)},onClickUp:O=>{I(O,g,l)},onClickDown:O=>{R(O,g,l)},onClickEdit:O=>{C(O,g)},onClickDelete:O=>{y(O,g)}})}}}].filter(Boolean);return a.jsxs($,{sx:{display:"flex",flexDirection:"column",gap:2},ref:t,children:[a.jsx(Qt,{verticalKeyWidth:100,locale:d,title:a.jsxs($,{sx:{display:"flex",alignItems:"center",gap:1},children:[e("securityRule.title")," ",a.jsx(uo,{variant:"body2",children:e("securityRule.sortByDescription")})]}),data:x,columns:_,customButtons:b,options:f,loading:u.loading}),a.jsx(zo,{ref:m}),s]})}gn.propTypes={};const bn={width:24,height:24,body:'<path fill="currentColor" d="M5 21q-.825 0-1.413-.588T3 19V5q0-.825.588-1.413T5 3h14q.825 0 1.413.588T21 5v14q0 .825-.588 1.413T19 21H5Zm0-2h14V7H5v12Zm7-2q-2.05 0-3.663-1.113T6 13q.725-1.775 2.337-2.888T12 9q2.05 0 3.663 1.113T18 13q-.725 1.775-2.337 2.888T12 17Zm0-2.5q-.625 0-1.063-.438T10.5 13q0-.625.438-1.063T12 11.5q.625 0 1.063.438T13.5 13q0 .625-.438 1.063T12 14.5Zm0 1q1.05 0 1.775-.725T14.5 13q0-1.05-.725-1.775T12 10.5q-1.05 0-1.775.725T9.5 13q0 1.05.725 1.775T12 15.5Z"/>'};var ir={},Fo=A;Object.defineProperty(ir,"__esModule",{value:!0});var xn=ir.default=void 0,No=Fo(io()),Vo=a;xn=ir.default=(0,No.default)((0,Vo.jsx)("path",{d:"M24 9v2h-6V9zM8 4C5.79 4 4 5.79 4 8s1.79 4 4 4 4-1.79 4-4-1.79-4-4-4m0 9c-2.67 0-8 1.34-8 4v3h16v-3c0-2.66-5.33-4-8-4m4.51-8.95C13.43 5.11 14 6.49 14 8s-.57 2.89-1.49 3.95C14.47 11.7 16 10.04 16 8s-1.53-3.7-3.49-3.95m4.02 9.78C17.42 14.66 18 15.7 18 17v3h2v-3c0-1.45-1.59-2.51-3.47-3.17"}),"GroupRemove");var _n={},Te={};const je=ee(fo),Xe=ee(po);var Et={},Je={},Ae={};const Re=ee(mo);var Tt={},fr;function Uo(){if(fr)return Tt;fr=1;var e=A;Object.defineProperty(Tt,"__esModule",{value:!0}),Tt.default=o;var d=e(re);function o(n,i){return(0,d.default)({toolbar:{minHeight:56,[n.up("xs")]:{"@media (orientation: landscape)":{minHeight:48}},[n.up("sm")]:{minHeight:64}}},i)}return Tt}var _e={},Qe={},pr;function Ko(){if(pr)return Qe;pr=1,Object.defineProperty(Qe,"__esModule",{value:!0}),Qe.default=void 0;const e={black:"#000",white:"#fff"};return Qe.default=e,Qe}var et={},mr;function Xo(){if(mr)return et;mr=1,Object.defineProperty(et,"__esModule",{value:!0}),et.default=void 0;const e={50:"#fafafa",100:"#f5f5f5",200:"#eeeeee",300:"#e0e0e0",400:"#bdbdbd",500:"#9e9e9e",600:"#757575",700:"#616161",800:"#424242",900:"#212121",A100:"#f5f5f5",A200:"#eeeeee",A400:"#bdbdbd",A700:"#616161"};return et.default=e,et}var tt={},hr;function Go(){if(hr)return tt;hr=1,Object.defineProperty(tt,"__esModule",{value:!0}),tt.default=void 0;const e={50:"#f3e5f5",100:"#e1bee7",200:"#ce93d8",300:"#ba68c8",400:"#ab47bc",500:"#9c27b0",600:"#8e24aa",700:"#7b1fa2",800:"#6a1b9a",900:"#4a148c",A100:"#ea80fc",A200:"#e040fb",A400:"#d500f9",A700:"#aa00ff"};return tt.default=e,tt}var rt={},vr;function Zo(){if(vr)return rt;vr=1,Object.defineProperty(rt,"__esModule",{value:!0}),rt.default=void 0;const e={50:"#ffebee",100:"#ffcdd2",200:"#ef9a9a",300:"#e57373",400:"#ef5350",500:"#f44336",600:"#e53935",700:"#d32f2f",800:"#c62828",900:"#b71c1c",A100:"#ff8a80",A200:"#ff5252",A400:"#ff1744",A700:"#d50000"};return rt.default=e,rt}var nt={},yr;function Yo(){if(yr)return nt;yr=1,Object.defineProperty(nt,"__esModule",{value:!0}),nt.default=void 0;const e={50:"#fff3e0",100:"#ffe0b2",200:"#ffcc80",300:"#ffb74d",400:"#ffa726",500:"#ff9800",600:"#fb8c00",700:"#f57c00",800:"#ef6c00",900:"#e65100",A100:"#ffd180",A200:"#ffab40",A400:"#ff9100",A700:"#ff6d00"};return nt.default=e,nt}var ot={},gr;function Jo(){if(gr)return ot;gr=1,Object.defineProperty(ot,"__esModule",{value:!0}),ot.default=void 0;const e={50:"#e3f2fd",100:"#bbdefb",200:"#90caf9",300:"#64b5f6",400:"#42a5f5",500:"#2196f3",600:"#1e88e5",700:"#1976d2",800:"#1565c0",900:"#0d47a1",A100:"#82b1ff",A200:"#448aff",A400:"#2979ff",A700:"#2962ff"};return ot.default=e,ot}var at={},br;function Qo(){if(br)return at;br=1,Object.defineProperty(at,"__esModule",{value:!0}),at.default=void 0;const e={50:"#e1f5fe",100:"#b3e5fc",200:"#81d4fa",300:"#4fc3f7",400:"#29b6f6",500:"#03a9f4",600:"#039be5",700:"#0288d1",800:"#0277bd",900:"#01579b",A100:"#80d8ff",A200:"#40c4ff",A400:"#00b0ff",A700:"#0091ea"};return at.default=e,at}var it={},xr;function ea(){if(xr)return it;xr=1,Object.defineProperty(it,"__esModule",{value:!0}),it.default=void 0;const e={50:"#e8f5e9",100:"#c8e6c9",200:"#a5d6a7",300:"#81c784",400:"#66bb6a",500:"#4caf50",600:"#43a047",700:"#388e3c",800:"#2e7d32",900:"#1b5e20",A100:"#b9f6ca",A200:"#69f0ae",A400:"#00e676",A700:"#00c853"};return it.default=e,it}var _r;function ta(){if(_r)return _e;_r=1;var e=A;Object.defineProperty(_e,"__esModule",{value:!0}),_e.dark=void 0,_e.default=h,_e.light=void 0;var d=e(re),o=e(ue()),n=e(cn),i=e(tr),c=rr,m=e(Ko()),t=e(Xo()),r=e(Go()),s=e(Zo()),u=e(Yo()),P=e(Jo()),v=e(Qo()),x=e(ea());const w=["mode","contrastThreshold","tonalOffset"],S=_e.light={text:{primary:"rgba(0, 0, 0, 0.87)",secondary:"rgba(0, 0, 0, 0.6)",disabled:"rgba(0, 0, 0, 0.38)"},divider:"rgba(0, 0, 0, 0.12)",background:{paper:m.default.white,default:m.default.white},action:{active:"rgba(0, 0, 0, 0.54)",hover:"rgba(0, 0, 0, 0.04)",hoverOpacity:.04,selected:"rgba(0, 0, 0, 0.08)",selectedOpacity:.08,disabled:"rgba(0, 0, 0, 0.26)",disabledBackground:"rgba(0, 0, 0, 0.12)",disabledOpacity:.38,focus:"rgba(0, 0, 0, 0.12)",focusOpacity:.12,activatedOpacity:.12}},I=_e.dark={text:{primary:m.default.white,secondary:"rgba(255, 255, 255, 0.7)",disabled:"rgba(255, 255, 255, 0.5)",icon:"rgba(255, 255, 255, 0.5)"},divider:"rgba(255, 255, 255, 0.12)",background:{paper:"#121212",default:"#121212"},action:{active:m.default.white,hover:"rgba(255, 255, 255, 0.08)",hoverOpacity:.08,selected:"rgba(255, 255, 255, 0.16)",selectedOpacity:.16,disabled:"rgba(255, 255, 255, 0.3)",disabledBackground:"rgba(255, 255, 255, 0.12)",disabledOpacity:.38,focus:"rgba(255, 255, 255, 0.12)",focusOpacity:.12,activatedOpacity:.24}};function R(l,g,j,O){const q=O.light||O,B=O.dark||O*1.5;l[g]||(l.hasOwnProperty(j)?l[g]=l[j]:g==="light"?l.light=(0,c.lighten)(l.main,q):g==="dark"&&(l.dark=(0,c.darken)(l.main,B)))}function p(l="light"){return l==="dark"?{main:P.default[200],light:P.default[50],dark:P.default[400]}:{main:P.default[700],light:P.default[400],dark:P.default[800]}}function C(l="light"){return l==="dark"?{main:r.default[200],light:r.default[50],dark:r.default[400]}:{main:r.default[500],light:r.default[300],dark:r.default[700]}}function y(l="light"){return l==="dark"?{main:s.default[500],light:s.default[300],dark:s.default[700]}:{main:s.default[700],light:s.default[400],dark:s.default[800]}}function f(l="light"){return l==="dark"?{main:v.default[400],light:v.default[300],dark:v.default[700]}:{main:v.default[700],light:v.default[500],dark:v.default[900]}}function b(l="light"){return l==="dark"?{main:x.default[400],light:x.default[300],dark:x.default[700]}:{main:x.default[800],light:x.default[500],dark:x.default[900]}}function _(l="light"){return l==="dark"?{main:u.default[400],light:u.default[300],dark:u.default[700]}:{main:"#ed6c02",light:u.default[500],dark:u.default[900]}}function h(l){const{mode:g="light",contrastThreshold:j=3,tonalOffset:O=.2}=l,q=(0,o.default)(l,w),B=l.primary||p(g),M=l.secondary||C(g),T=l.error||y(g),k=l.info||f(g),L=l.success||b(g),V=l.warning||_(g);function J(z){return(0,c.getContrastRatio)(z,I.text.primary)>=j?I.text.primary:S.text.primary}const U=({color:z,name:X,mainShade:de=500,lightShade:ne=300,darkShade:F=700})=>{if(z=(0,d.default)({},z),!z.main&&z[de]&&(z.main=z[de]),!z.hasOwnProperty("main"))throw new Error((0,n.default)(11,X?` (${X})`:"",de));if(typeof z.main!="string")throw new Error((0,n.default)(12,X?` (${X})`:"",JSON.stringify(z.main)));return R(z,"light",ne,O),R(z,"dark",F,O),z.contrastText||(z.contrastText=J(z.main)),z},K={dark:I,light:S};return(0,i.default)((0,d.default)({common:(0,d.default)({},m.default),mode:g,primary:U({color:B,name:"primary"}),secondary:U({color:M,name:"secondary",mainShade:"A400",lightShade:"A200",darkShade:"A700"}),error:U({color:T,name:"error"}),warning:U({color:V,name:"warning"}),info:U({color:k,name:"info"}),success:U({color:L,name:"success"}),grey:t.default,contrastThreshold:j,getContrastText:J,augmentColor:U,tonalOffset:O},K[g]),q)}return _e}var qt={},Pr;function ra(){if(Pr)return qt;Pr=1;var e=A;Object.defineProperty(qt,"__esModule",{value:!0}),qt.default=r;var d=e(re),o=e(ue()),n=e(tr);const i=["fontFamily","fontSize","fontWeightLight","fontWeightRegular","fontWeightMedium","fontWeightBold","htmlFontSize","allVariants","pxToRem"];function c(s){return Math.round(s*1e5)/1e5}const m={textTransform:"uppercase"},t='"Roboto", "Helvetica", "Arial", sans-serif';function r(s,u){const P=typeof u=="function"?u(s):u,{fontFamily:v=t,fontSize:x=14,fontWeightLight:w=300,fontWeightRegular:S=400,fontWeightMedium:I=500,fontWeightBold:R=700,htmlFontSize:p=16,allVariants:C,pxToRem:y}=P,f=(0,o.default)(P,i),b=x/14,_=y||(g=>`${g/p*b}rem`),h=(g,j,O,q,B)=>(0,d.default)({fontFamily:v,fontWeight:g,fontSize:_(j),lineHeight:O},v===t?{letterSpacing:`${c(q/j)}em`}:{},B,C),l={h1:h(w,96,1.167,-1.5),h2:h(w,60,1.2,-.5),h3:h(S,48,1.167,0),h4:h(S,34,1.235,.25),h5:h(S,24,1.334,0),h6:h(I,20,1.6,.15),subtitle1:h(S,16,1.75,.15),subtitle2:h(I,14,1.57,.1),body1:h(S,16,1.5,.15),body2:h(S,14,1.43,.15),button:h(I,14,1.75,.4,m),caption:h(S,12,1.66,.4),overline:h(S,12,2.66,1,m),inherit:{fontFamily:"inherit",fontWeight:"inherit",fontSize:"inherit",lineHeight:"inherit",letterSpacing:"inherit"}};return(0,n.default)((0,d.default)({htmlFontSize:p,pxToRem:_,fontFamily:v,fontSize:x,fontWeightLight:w,fontWeightRegular:S,fontWeightMedium:I,fontWeightBold:R},l),f,{clone:!1})}return qt}var st={},Cr;function na(){if(Cr)return st;Cr=1,Object.defineProperty(st,"__esModule",{value:!0}),st.default=void 0;const e=.2,d=.14,o=.12;function n(...c){return[`${c[0]}px ${c[1]}px ${c[2]}px ${c[3]}px rgba(0,0,0,${e})`,`${c[4]}px ${c[5]}px ${c[6]}px ${c[7]}px rgba(0,0,0,${d})`,`${c[8]}px ${c[9]}px ${c[10]}px ${c[11]}px rgba(0,0,0,${o})`].join(",")}const i=["none",n(0,2,1,-1,0,1,1,0,0,1,3,0),n(0,3,1,-2,0,2,2,0,0,1,5,0),n(0,3,3,-2,0,3,4,0,0,1,8,0),n(0,2,4,-1,0,4,5,0,0,1,10,0),n(0,3,5,-1,0,5,8,0,0,1,14,0),n(0,3,5,-1,0,6,10,0,0,1,18,0),n(0,4,5,-2,0,7,10,1,0,2,16,1),n(0,5,5,-3,0,8,10,1,0,3,14,2),n(0,5,6,-3,0,9,12,1,0,3,16,2),n(0,6,6,-3,0,10,14,1,0,4,18,3),n(0,6,7,-4,0,11,15,1,0,4,20,3),n(0,7,8,-4,0,12,17,2,0,5,22,4),n(0,7,8,-4,0,13,19,2,0,5,24,4),n(0,7,9,-4,0,14,21,2,0,5,26,4),n(0,8,9,-5,0,15,22,2,0,6,28,5),n(0,8,10,-5,0,16,24,2,0,6,30,5),n(0,8,11,-5,0,17,26,2,0,6,32,5),n(0,9,11,-5,0,18,28,2,0,7,34,6),n(0,9,12,-6,0,19,29,2,0,7,36,6),n(0,10,13,-6,0,20,31,3,0,8,38,7),n(0,10,13,-6,0,21,33,3,0,8,40,7),n(0,10,14,-6,0,22,35,3,0,8,42,7),n(0,11,14,-7,0,23,36,3,0,9,44,8),n(0,11,15,-7,0,24,38,3,0,9,46,8)];return st.default=i,st}var Pe={},jr;function oa(){if(jr)return Pe;jr=1;var e=A;Object.defineProperty(Pe,"__esModule",{value:!0}),Pe.default=r,Pe.easing=Pe.duration=void 0;var d=e(ue()),o=e(re);const n=["duration","easing","delay"],i=Pe.easing={easeInOut:"cubic-bezier(0.4, 0, 0.2, 1)",easeOut:"cubic-bezier(0.0, 0, 0.2, 1)",easeIn:"cubic-bezier(0.4, 0, 1, 1)",sharp:"cubic-bezier(0.4, 0, 0.6, 1)"},c=Pe.duration={shortest:150,shorter:200,short:250,standard:300,complex:375,enteringScreen:225,leavingScreen:195};function m(s){return`${Math.round(s)}ms`}function t(s){if(!s)return 0;const u=s/36;return Math.round((4+15*u**.25+u/5)*10)}function r(s){const u=(0,o.default)({},i,s.easing),P=(0,o.default)({},c,s.duration),v=(x=["all"],w={})=>{const{duration:S=P.standard,easing:I=u.easeInOut,delay:R=0}=w;return(0,d.default)(w,n),(Array.isArray(x)?x:[x]).map(p=>`${p} ${typeof S=="string"?S:m(S)} ${I} ${typeof R=="string"?R:m(R)}`).join(",")};return(0,o.default)({getAutoHeightDuration:t,create:v},s,{easing:u,duration:P})}return Pe}var lt={},Rr;function aa(){if(Rr)return lt;Rr=1,Object.defineProperty(lt,"__esModule",{value:!0}),lt.default=void 0;const e={mobileStepper:1e3,fab:1050,speedDial:1050,appBar:1100,drawer:1200,modal:1300,snackbar:1400,tooltip:1500};return lt.default=e,lt}var Or;function ia(){if(Or)return Ae;Or=1;var e=A;Object.defineProperty(Ae,"__esModule",{value:!0}),Ae.createMuiTheme=R,Ae.default=void 0;var d=e(re),o=e(ue()),n=e(cn),i=e(tr),c=S(un),m=e(ho);e(Re);var t=e(Uo()),r=e(ta()),s=e(ra()),u=e(na()),P=e(oa()),v=e(aa());const x=["breakpoints","mixins","spacing","palette","transitions","typography","shape"];function w(p){if(typeof WeakMap!="function")return null;var C=new WeakMap,y=new WeakMap;return(w=function(f){return f?y:C})(p)}function S(p,C){if(p&&p.__esModule)return p;if(p===null||typeof p!="object"&&typeof p!="function")return{default:p};var y=w(C);if(y&&y.has(p))return y.get(p);var f={__proto__:null},b=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var _ in p)if(_!=="default"&&Object.prototype.hasOwnProperty.call(p,_)){var h=b?Object.getOwnPropertyDescriptor(p,_):null;h&&(h.get||h.set)?Object.defineProperty(f,_,h):f[_]=p[_]}return f.default=p,y&&y.set(p,f),f}function I(p={},...C){const{mixins:y={},palette:f={},transitions:b={},typography:_={}}=p,h=(0,o.default)(p,x);if(p.vars&&p.generateCssVars===void 0)throw new Error((0,n.default)(18));const l=(0,r.default)(f),g=(0,m.default)(p);let j=(0,i.default)(g,{mixins:(0,t.default)(g.breakpoints,y),palette:l,shadows:u.default.slice(),typography:(0,s.default)(l,_),transitions:(0,P.default)(b),zIndex:(0,d.default)({},v.default)});return j=(0,i.default)(j,h),j=C.reduce((O,q)=>(0,i.default)(O,q),j),j.unstable_sxConfig=(0,d.default)({},c.unstable_defaultSxConfig,h==null?void 0:h.unstable_sxConfig),j.unstable_sx=function(q){return(0,c.default)({sx:q,theme:this})},j}function R(...p){return I(...p)}return Ae.default=I,Ae}var wr;function sa(){if(wr)return Je;wr=1;var e=A;Object.defineProperty(Je,"__esModule",{value:!0}),Je.default=void 0;var d=e(ia());const o=(0,d.default)();return Je.default=o,Je}var ct={},Tr;function la(){return Tr||(Tr=1,Object.defineProperty(ct,"__esModule",{value:!0}),ct.default=void 0,ct.default="$$material"),ct}var ut={},dt={},qr;function Pn(){if(qr)return dt;qr=1,Object.defineProperty(dt,"__esModule",{value:!0}),dt.default=void 0;function e(d){return d!=="ownerState"&&d!=="theme"&&d!=="sx"&&d!=="as"}return dt.default=e,dt}var Mr;function ca(){if(Mr)return ut;Mr=1;var e=A;Object.defineProperty(ut,"__esModule",{value:!0}),ut.default=void 0;var d=e(Pn());const o=n=>(0,d.default)(n)&&n!=="classes";return ut.default=o,ut}var Sr;function De(){return Sr||(Sr=1,function(e){"use client";var d=A;Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0,Object.defineProperty(e,"rootShouldForwardProp",{enumerable:!0,get:function(){return c.default}}),Object.defineProperty(e,"slotShouldForwardProp",{enumerable:!0,get:function(){return m.default}});var o=d(vo),n=d(sa()),i=d(la()),c=d(ca()),m=d(Pn());const t=(0,o.default)({themeId:i.default,defaultTheme:n.default,rootShouldForwardProp:c.default});e.default=t}(Et)),Et}var zt={},He={};const ua=ee(yo);var Ir;function da(){if(Ir)return He;Ir=1;var e=A;Object.defineProperty(He,"__esModule",{value:!0}),He.default=void 0,He.useDefaultProps=t;var d=e(re);c(H),e(xe);var o=c(ua),n=a;function i(r){if(typeof WeakMap!="function")return null;var s=new WeakMap,u=new WeakMap;return(i=function(P){return P?u:s})(r)}function c(r,s){if(r&&r.__esModule)return r;if(r===null||typeof r!="object"&&typeof r!="function")return{default:r};var u=i(s);if(u&&u.has(r))return u.get(r);var P={__proto__:null},v=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var x in r)if(x!=="default"&&Object.prototype.hasOwnProperty.call(r,x)){var w=v?Object.getOwnPropertyDescriptor(r,x):null;w&&(w.get||w.set)?Object.defineProperty(P,x,w):P[x]=r[x]}return P.default=r,u&&u.set(r,P),P}function m(r){return(0,n.jsx)(o.default,(0,d.default)({},r))}He.default=m;function t(r){return(0,o.useDefaultProps)(r)}return He}var Dr;function ke(){return Dr||(Dr=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return d.default}}),Object.defineProperty(e,"useDefaultProps",{enumerable:!0,get:function(){return d.useDefaultProps}});var d=n(da());function o(i){if(typeof WeakMap!="function")return null;var c=new WeakMap,m=new WeakMap;return(o=function(t){return t?m:c})(i)}function n(i,c){if(i&&i.__esModule)return i;if(i===null||typeof i!="object"&&typeof i!="function")return{default:i};var m=o(c);if(m&&m.has(i))return m.get(i);var t={__proto__:null},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in i)if(s!=="default"&&Object.prototype.hasOwnProperty.call(i,s)){var u=r?Object.getOwnPropertyDescriptor(i,s):null;u&&(u.get||u.set)?Object.defineProperty(t,s,u):t[s]=i[s]}return t.default=i,m&&m.set(i,t),t}}(zt)),zt}var ft={},kr;function sr(){if(kr)return ft;kr=1,Object.defineProperty(ft,"__esModule",{value:!0}),ft.default=void 0;var e=o(H);function d(i){if(typeof WeakMap!="function")return null;var c=new WeakMap,m=new WeakMap;return(d=function(t){return t?m:c})(i)}function o(i,c){if(i&&i.__esModule)return i;if(i===null||typeof i!="object"&&typeof i!="function")return{default:i};var m=d(c);if(m&&m.has(i))return m.get(i);var t={__proto__:null},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in i)if(s!=="default"&&Object.prototype.hasOwnProperty.call(i,s)){var u=r?Object.getOwnPropertyDescriptor(i,s):null;u&&(u.get||u.set)?Object.defineProperty(t,s,u):t[s]=i[s]}return t.default=i,m&&m.set(i,t),t}const n=e.createContext({});return ft.default=n,ft}var Ft={},qe={};const fa=ee(go),pa=ee(bo);var pt={};const ma=ee(xo);var $r;function Cn(){if($r)return pt;$r=1;var e=A;Object.defineProperty(pt,"__esModule",{value:!0}),pt.default=void 0;var d=e(ma);return pt.default=d.default,pt}var mt={};const ha=ee(_o);var Wr;function va(){if(Wr)return mt;Wr=1;var e=A;Object.defineProperty(mt,"__esModule",{value:!0}),mt.default=void 0;var d=e(ha);return mt.default=d.default,mt}var ht={};const ya=ee(Po);var Br;function ga(){if(Br)return ht;Br=1;var e=A;Object.defineProperty(ht,"__esModule",{value:!0}),ht.default=void 0;var d=e(ya);return ht.default=d.default,ht}var le={};const ba=ee(Co),xa=ee(jo),_a=ee(Ro);var vt={},Ar;function Pa(){if(Ar)return vt;Ar=1;var e=A;Object.defineProperty(vt,"__esModule",{value:!0}),vt.default=void 0;var d=c(H);e(xe);var o=e(je),n=a;function i(t){if(typeof WeakMap!="function")return null;var r=new WeakMap,s=new WeakMap;return(i=function(u){return u?s:r})(t)}function c(t,r){if(t&&t.__esModule)return t;if(t===null||typeof t!="object"&&typeof t!="function")return{default:t};var s=i(r);if(s&&s.has(t))return s.get(t);var u={__proto__:null},P=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var v in t)if(v!=="default"&&Object.prototype.hasOwnProperty.call(t,v)){var x=P?Object.getOwnPropertyDescriptor(t,v):null;x&&(x.get||x.set)?Object.defineProperty(u,v,x):u[v]=t[v]}return u.default=t,s&&s.set(t,u),u}function m(t){const{className:r,classes:s,pulsate:u=!1,rippleX:P,rippleY:v,rippleSize:x,in:w,onExited:S,timeout:I}=t,[R,p]=d.useState(!1),C=(0,o.default)(r,s.ripple,s.rippleVisible,u&&s.ripplePulsate),y={width:x,height:x,top:-(x/2)+v,left:-(x/2)+P},f=(0,o.default)(s.child,R&&s.childLeaving,u&&s.childPulsate);return!w&&!R&&p(!0),d.useEffect(()=>{if(!w&&S!=null){const b=setTimeout(S,I);return()=>{clearTimeout(b)}}},[S,w,I]),(0,n.jsx)("span",{className:C,style:y,children:(0,n.jsx)("span",{className:f})})}return vt.default=m,vt}var Le={};const $e=ee(Oo);var Hr;function jn(){if(Hr)return Le;Hr=1;var e=A;Object.defineProperty(Le,"__esModule",{value:!0}),Le.default=void 0,Le.getTouchRippleUtilityClass=n;var d=e($e),o=e(Re);function n(c){return(0,o.default)("MuiTouchRipple",c)}const i=(0,d.default)("MuiTouchRipple",["root","ripple","rippleVisible","ripplePulsate","child","childLeaving","childPulsate"]);return Le.default=i,Le}var Lr;function Ca(){if(Lr)return le;Lr=1;var e=A;Object.defineProperty(le,"__esModule",{value:!0}),le.default=le.TouchRippleRoot=le.TouchRippleRipple=le.DELAY_RIPPLE=void 0;var d=e(re),o=e(ue()),n=S(H);e(xe);var i=ba,c=e(je),m=xa,t=e(_a),r=e(De()),s=ke(),u=e(Pa()),P=e(jn()),v=a;const x=["center","classes","className"];function w(h){if(typeof WeakMap!="function")return null;var l=new WeakMap,g=new WeakMap;return(w=function(j){return j?g:l})(h)}function S(h,l){if(h&&h.__esModule)return h;if(h===null||typeof h!="object"&&typeof h!="function")return{default:h};var g=w(l);if(g&&g.has(h))return g.get(h);var j={__proto__:null},O=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var q in h)if(q!=="default"&&Object.prototype.hasOwnProperty.call(h,q)){var B=O?Object.getOwnPropertyDescriptor(h,q):null;B&&(B.get||B.set)?Object.defineProperty(j,q,B):j[q]=h[q]}return j.default=h,g&&g.set(h,j),j}const I=550,R=le.DELAY_RIPPLE=80,p=(0,m.keyframes)`
|
|
1
|
+
import{a as Ie,I as Y,bb as It,k as N,a3 as Q,ar as Zt,B as Yt,ab as Jt,ac as Qt,r as io,ci as sn,ax as so}from"./vendor-ux-did-connect-BbCim3WZ.js";import{a as Dt,l as jt,u as E,b as er,m as ln}from"./vendor-hooks-DqdmWCmo.js";import{r as H,a as ee,g as lo}from"./vendor-react-DEoibe3W.js";import{H as D,j as a,aa as $,ad as Z,I as he,bt as Rt,e as kt,O as te,N as co,y as Ke,T as uo,a9 as A,cH as fo,cI as po,cJ as mo,cK as re,c4 as ue,cL as cn,cM as tr,cN as rr,cO as ho,cP as un,cQ as vo,cR as yo,b5 as xe,cS as go,cT as bo,cU as xo,cV as _o,cW as Po,cX as Co,cY as jo,cZ as Ro,c_ as Oo,c$ as wo,d0 as To,bo as ge,bQ as Mt,bs as be,bR as Pt,bq as qo,E as Mo,bK as So,C as Io,bV as Do,bu as dn,bv as fn,al as ko,ah as $o}from"./vendor-mui-core-Bq8gXTan.js";import{n as Se,S as St,aK as Wo,D as Ct,A as Bo,aB as dr,P as pn,I as Ce,o as mn}from"./vendor-utils-BfZ4tlod.js";import{G as $t,D as Wt,aC as nr,aD as ce}from"./index-BMCGWiyM.js";import{S as Lt}from"./simple-select-0cjVFuay.js";import{e as Ao,u as hn}from"./dashboard-CpxtvWAW.js";import{A as vn}from"./config-DEbtcbH9.js";import{u as Ho}from"./use-mobile-DwzRjjku.js";import"./lottie-web-jYmAQWuC.js";import"./vendor-arcblock-f1tICt1E.js";import"./useLocalStorage-iQ2AmaOA.js";import"./index-8eXqqyHQ.js";import"./confirm-Bbp7EOHO.js";import"./PlayArrow-DZsdEeq_.js";import"./get-safe-url-CuT70yLx.js";import"./session-BDyIB4uh.js";import"./use-blocklet-logo-DwwmdicD.js";import"./InfoOutlined-B5f3YRb4.js";import"./dot-4jhL56kz.js";import"./useAsync-C62uE2pS.js";import"./useSetState-CWq0AVWn.js";import"./use-mobile-CtTQsfXN.js";const Lo={width:24,height:24,body:'<path fill="currentColor" d="M11 14.2V6q0-.425.288-.713T12 5q.425 0 .713.288T13 6v8.2l2.9-2.9q.275-.275.7-.275t.7.275q.275.275.275.7t-.275.7l-4.6 4.6q-.3.3-.7.3t-.7-.3l-4.6-4.6q-.275-.275-.275-.7t.275-.7q.275-.275.7-.275t.7.275l2.9 2.9Z"/>'},Eo={width:24,height:24,body:'<path fill="currentColor" d="m11 8.8l-2.9 2.9q-.275.275-.7.275t-.7-.275q-.275-.275-.275-.7t.275-.7l4.6-4.6q.3-.3.7-.3t.7.3l4.6 4.6q.275.275.275.7t-.275.7q-.275.275-.7.275t-.7-.275L13 8.8V17q0 .425-.288.713T12 18q-.425 0-.713-.288T11 17V8.8Z"/>'},or={width:24,height:24,body:'<path fill="currentColor" d="M7 21q-.825 0-1.413-.588T5 19V6q-.425 0-.713-.288T4 5q0-.425.288-.713T5 4h4q0-.425.288-.713T10 3h4q.425 0 .713.288T15 4h4q.425 0 .713.288T20 5q0 .425-.288.713T19 6v13q0 .825-.588 1.413T17 21H7Zm2-4h2V8H9v9Zm4 0h2V8h-2v9Z"/>'},ar={width:24,height:24,body:'<path fill="currentColor" d="M4 21q-.425 0-.713-.288T3 20v-2.425q0-.4.15-.763t.425-.637L16.2 3.575q.3-.275.663-.425t.762-.15q.4 0 .775.15t.65.45L20.425 5q.3.275.437.65T21 6.4q0 .4-.138.763t-.437.662l-12.6 12.6q-.275.275-.638.425t-.762.15H4ZM17.6 7.8L19 6.4L17.6 5l-1.4 1.4l1.4 1.4Z"/>'};function yn({enabled:e,showUp:d=!0,showDown:o=!0,showSwitch:n=!0,showDelete:i=!0,showEdit:c=!0,disableEdit:m=!1,disableSwitch:t=!1,onClickUp:r=()=>{},onClickDown:s=()=>{},onClickSwitch:u=()=>{},onClickDelete:P=()=>{},onClickEdit:v=()=>{}}){const{t:x}=Ie();return a.jsxs($,{sx:{display:"flex",alignItems:"center",gap:0},onClick:w=>w.stopPropagation(),children:[c?a.jsx(Z,{title:x("common.edit"),children:a.jsx(he,{size:"small",onClick:v,color:"success",disabled:m,children:a.jsx(Y,{icon:ar,fontSize:18})})}):null,i?a.jsx(Z,{title:x("common.delete"),children:a.jsx(he,{size:"small",onClick:P,color:"error",children:a.jsx(Y,{icon:or,fontSize:18})})}):null,n?a.jsx(Z,{title:x(e?"common.enabled":"common.disabled"),children:a.jsx(Rt,{size:"small",checked:e,onClick:u,disabled:t})}):null,d?a.jsx(Z,{title:x("common.moveUp"),children:a.jsx(he,{size:"small",onClick:r,disabled:m,children:a.jsx(Y,{icon:Eo,fontSize:20})})}):null,o?a.jsx(Z,{title:x("common.moveDown"),children:a.jsx(he,{size:"small",onClick:s,disabled:m,children:a.jsx(Y,{icon:Lo,fontSize:20})})}):null]})}yn.propTypes={enabled:D.bool.isRequired,showUp:D.bool,showDown:D.bool,showSwitch:D.bool,showDelete:D.bool,showEdit:D.bool,disableEdit:D.bool,disableSwitch:D.bool,onClickUp:D.func,onClickDown:D.func,onClickSwitch:D.func,onClickDelete:D.func,onClickEdit:D.func};const zo=H.forwardRef((e,d)=>{var O,q,B;const{t:o}=H.useContext(It),{blocklet:n}=$t(),{api:i}=Wt(),c=(O=n==null?void 0:n.meta)==null?void 0:O.did,m=kt(),t=((B=(q=m==null?void 0:m.transitions)==null?void 0:q.duration)==null?void 0:B.leavingScreen)||300,r=Dt({mode:"add",show:!1,isDefaultRule:!1,callback:Se,get dialogTitle(){return this.mode==="edit"?o("securityRule.edit"):this.mode==="view"?o("securityRule.view"):o("securityRule.add")}}),s=jt(async()=>{const{accessPolicies:M}=await i.getBlockletAccessPolicies({input:{did:c}});return St(M,T=>T.isProtected?1:0)},{manual:!0}),u=jt(async()=>{const{responseHeaderPolicies:M}=await i.getBlockletResponseHeaderPolicies({input:{did:c}});return St(M,T=>T.isProtected?1:0)},{manual:!0}),{handleSubmit:P,control:v,watch:x,setValue:w,getValues:S,reset:I,formState:{errors:R}}=nr({mode:"onChange",defaultValues:{componentDid:"",pathPattern:"",responseHeaderPolicyId:"",accessPolicyId:"",remark:""}}),p=E(()=>{I(),r.mode="add"}),C=E(()=>{r.show=!1,setTimeout(()=>{p()},t)}),y=E((M,T=null)=>{r.show=!0,T&&(r.isDefaultRule=T.id===N.SECURITY_RULE_DEFAULT_ID,r.mode="edit",w("componentDid",T.componentDid),w("pathPattern",T.pathPattern),w("responseHeaderPolicyId",T.responseHeaderPolicyId),w("accessPolicyId",T.accessPolicyId),w("remark",T.remark||"")),M?r.callback=M:r.mode="view",s.run(),u.run()});H.useImperativeHandle(d,()=>({open:y,close:C}),[y,C]);const f=E(()=>{const[M,T]=S(["accessPolicyId","responseHeaderPolicyId"]);return!M&&!T?o("securityRule.form.accessPolicyOrResponseHeaderPolicyRequired"):!0}),b=E(M=>{const T=f();T===!0?r.callback(M,C):Q.error(T)}),_=x("componentDid"),h=E(M=>{const T=M==null?void 0:M.trim();if(!T)return o("common.requiredErrorText",{name:o("securityRule.form.pathPattern")});if(_){if(T.startsWith("/"))return o("securityRule.form.pathPatternErrorText")}else if(!T.startsWith("/")&&T!=="*")return o("securityRule.form.pathPatternErrorText");return!0}),l=E(M=>(M==null?void 0:M.trim())?!0:o("common.requiredErrorText",{name:o("securityRule.form.accessPolicy")})),g=E(M=>(M==null?void 0:M.trim())?!0:o("common.requiredErrorText",{name:o("securityRule.form.responseHeaderPolicy")})),j=er(()=>{const T=((n==null?void 0:n.children)||[]).find(k=>k.meta.did===_);return T!=null&&T.mountPoint?Wo(T.mountPoint):null},[n,_]);return a.jsx(Zt,{open:r.show,title:r.dialogTitle,onClose:C,PaperProps:{style:{minHeight:"unset"}},actions:a.jsx(Yt,{color:"primary",autoFocus:!0,variant:"contained",onClick:P(b),children:o("common.confirm")}),children:a.jsxs("form",{noValidate:!0,autoComplete:"off",children:[r.isDefaultRule?null:a.jsx(ce,{name:"componentDid",control:v,render:({field:M})=>{var T,k;return a.jsx(Lt,{fullWidth:!0,margin:"dense",size:"small",label:o("securityRule.form.component"),placeholer:o("securityRule.form.componentPlaceholder"),options:n.children.map(L=>({title:L.meta.title,value:L.meta.did,description:L.mountPoint})),error:!!((T=R==null?void 0:R.componentDid)!=null&&T.message),helperText:((k=R==null?void 0:R.componentDid)==null?void 0:k.message)||"Choose belong to component",...Ct(M,"ref"),readOnly:r.mode==="view"})}}),a.jsx(ce,{name:"pathPattern",control:v,rules:{validate:h},render:({field:M})=>{var T,k;return a.jsx(te,{fullWidth:!0,required:!0,margin:"dense",size:"small",placeholder:o("securityRule.form.pathPatternPlaceholder"),label:o("securityRule.form.pathPattern"),error:!!((T=R==null?void 0:R.pathPattern)!=null&&T.message),helperText:((k=R==null?void 0:R.pathPattern)==null?void 0:k.message)||"/abc/bcd or /abc or /abc/*",InputProps:{startAdornment:j?a.jsx(co,{position:"start",children:j}):null},...M,disabled:r.isDefaultRule||r.mode==="view"})}}),a.jsx(ce,{name:"accessPolicyId",control:v,rules:{validate:r.isDefaultRule?l:Se},render:({field:M})=>{var T,k;return a.jsx(Lt,{fullWidth:!0,required:r.isDefaultRule,margin:"dense",size:"small",label:o("securityRule.form.accessPolicy"),placeholer:o("securityRule.form.accessPolicyPlaceholder"),options:(s.data||[]).map(L=>({value:L.id,title:L.name,description:L.description})),error:!!((T=R==null?void 0:R.accessPolicyId)!=null&&T.message),helperText:((k=R==null?void 0:R.accessPolicyId)==null?void 0:k.message)||o("securityRule.form.accessPolicyHelperText"),...Ct(M,"ref"),disabled:r.mode==="view"})}}),a.jsx(ce,{name:"responseHeaderPolicyId",control:v,rules:{validate:r.isDefaultRule?g:Se},render:({field:M})=>{var T,k;return a.jsx(Lt,{fullWidth:!0,required:r.isDefaultRule,margin:"dense",size:"small",label:o("securityRule.form.responseHeaderPolicy"),placeholer:o("securityRule.form.responseHeaderPolicyPlaceholder"),options:(u.data||[]).map(L=>({title:L.name,value:L.id,description:L.description})),error:!!((T=R==null?void 0:R.responseHeaderPolicyId)!=null&&T.message),helperText:((k=R==null?void 0:R.responseHeaderPolicyId)==null?void 0:k.message)||o("securityRule.form.responseHeaderPolicyHelperText"),...Ct(M,"ref"),disabled:r.mode==="view"})}}),a.jsx(ce,{name:"remark",control:v,render:({field:M})=>a.jsx(te,{fullWidth:!0,multiline:!0,minRows:3,maxRows:7,size:"small",margin:"dense",placeholder:o("securityRule.form.remarkPlaceholder"),label:o("securityRule.form.remark"),helperText:R==null?void 0:R.message,...M,disabled:r.mode==="view"})})]})})}),se=async(e,d="Failed to saved")=>{try{await e()}catch(o){Q.error((o==null?void 0:o.message)||d)}};function gn(){var h;const{t:e,locale:d}=Ie(),{blocklet:o}=$t(),{api:n}=Wt(),i=(h=o==null?void 0:o.meta)==null?void 0:h.did,c=kt(),m=H.useRef(null),t=H.useRef(null),{confirmApi:r,confirmHolder:s}=Jt(),u=jt(async()=>{const{securityRules:l}=await n.getBlockletSecurityRules({input:{did:i,includeDisabled:!0}});return l}),P=l=>l.id===N.SECURITY_RULE_DEFAULT_ID,v=E(l=>{var j;return(j=((o==null?void 0:o.children)||[]).find(O=>O.meta.did===l))==null?void 0:j.mountPoint}),x=(u.data||[]).map(l=>{if(l.componentDid){const g=v(l.componentDid);l._disabled=g===void 0}return l}),w=x.filter(l=>!P(l)),S=(l,g)=>{se(async()=>{const j=l.target.checked;await n.updateBlockletSecurityRule({input:{did:i,data:{id:g.id,enabled:j}}}),Q.success(e("common.succeeded")),u.run()})},I=(l,g,j)=>{se(async()=>{const O=j-1,q=x[O];await Promise.all([n.updateBlockletSecurityRule({input:{did:i,data:{id:g.id,priority:q.priority}}}),n.updateBlockletSecurityRule({input:{did:i,data:{id:q.id,priority:g.priority}}})]),Q.success(e("common.succeeded")),u.run()})},R=(l,g,j)=>{se(async()=>{const O=j+1,q=x[O];await Promise.all([n.updateBlockletSecurityRule({input:{did:i,data:{id:g.id,priority:q.priority}}}),n.updateBlockletSecurityRule({input:{did:i,data:{id:q.id,priority:g.priority}}})]),Q.success(e("common.succeeded")),u.run()})},p=()=>{m.current.open((l,g)=>{se(async()=>{await n.addBlockletSecurityRule({input:{did:i,data:l}}),Q.success(e("common.succeeded")),u.run(),g()})})},C=(l,g)=>{m.current.open((j,O)=>{se(async()=>{await n.updateBlockletSecurityRule({input:{did:i,data:{...j,id:g.id}}}),Q.success(e("common.succeeded")),u.run(),O()})},g)},y=(l,g)=>{r.open({title:e("securityRule.delete.title"),content:e("securityRule.delete.description"),confirmButtonText:e("common.confirm"),confirmButtonProps:{color:"error"},cancelButtonText:e("common.cancel"),onConfirm(j){se(async()=>{await n.deleteBlockletSecurityRule({input:{did:i,id:g.id}}),Q.success(e("common.succeeded")),u.run(),j()})}})},f={sort:!1,download:!1,filter:!1,print:!1,search:!1,viewColumns:!1,expandableRowsOnClick:!0,searchDebounceTime:600,onRowClick(l,{dataIndex:g},j){var O;if((O=t.current)!=null&&O.contains(j.target)){const q=x[g];m.current.open(void 0,q)}},setRowProps:(l,g)=>x[g]._disabled?{title:e("securityRule.useless"),style:{backgroundColor:c.palette.action.disabledBackground,cursor:"default"}}:{}},b=[a.jsx(Ke,{size:"small",variant:"outlined",onClick:()=>{u.run()},sx:{mr:1},children:e("common.refresh")},"refresh"),a.jsx(Ke,{size:"small",variant:"contained",onClick:p,children:e("common.add")})],_=[{label:e("securityRule.form.pathPattern"),name:"pathPattern",options:{customBodyRenderLite(l){const g=x[l];return a.jsx($,{sx:{whiteSpace:"nowrap"},children:g.id===N.SECURITY_RULE_DEFAULT_ID?"Default":Bo(v(g.componentDid),g.pathPattern)})}}},{label:e("responseHeaderPolicy.title"),name:"responseHeaderPolicy",options:{customBodyRenderLite(l){var j;return(j=x[l].responseHeaderPolicy)==null?void 0:j.name}}},{label:e("accessPolicy.title"),name:"accessPolicyId",options:{customBodyRenderLite(l){var j;return(j=x[l].accessPolicy)==null?void 0:j.name}}},{label:e("securityRule.form.remark"),name:"remark"},{label:e("common.actions"),name:"",width:100,align:"center",verticalKeyAlign:"center",options:{customBodyRenderLite(l){const g=x[l],j=P(g);return a.jsx(yn,{disableEdit:g._disabled,disableSwitch:g._disabled,enabled:g.enabled,showSwitch:!j,showDelete:!j,showUp:l>0&&!j,showDown:l<w.length-1&&!j,onClickSwitch:O=>{S(O,g)},onClickUp:O=>{I(O,g,l)},onClickDown:O=>{R(O,g,l)},onClickEdit:O=>{C(O,g)},onClickDelete:O=>{y(O,g)}})}}}].filter(Boolean);return a.jsxs($,{sx:{display:"flex",flexDirection:"column",gap:2},ref:t,children:[a.jsx(Qt,{verticalKeyWidth:100,locale:d,title:a.jsxs($,{sx:{display:"flex",alignItems:"center",gap:1},children:[e("securityRule.title")," ",a.jsx(uo,{variant:"body2",children:e("securityRule.sortByDescription")})]}),data:x,columns:_,customButtons:b,options:f,loading:u.loading}),a.jsx(zo,{ref:m}),s]})}gn.propTypes={};const bn={width:24,height:24,body:'<path fill="currentColor" d="M5 21q-.825 0-1.413-.588T3 19V5q0-.825.588-1.413T5 3h14q.825 0 1.413.588T21 5v14q0 .825-.588 1.413T19 21H5Zm0-2h14V7H5v12Zm7-2q-2.05 0-3.663-1.113T6 13q.725-1.775 2.337-2.888T12 9q2.05 0 3.663 1.113T18 13q-.725 1.775-2.337 2.888T12 17Zm0-2.5q-.625 0-1.063-.438T10.5 13q0-.625.438-1.063T12 11.5q.625 0 1.063.438T13.5 13q0 .625-.438 1.063T12 14.5Zm0 1q1.05 0 1.775-.725T14.5 13q0-1.05-.725-1.775T12 10.5q-1.05 0-1.775.725T9.5 13q0 1.05.725 1.775T12 15.5Z"/>'};var ir={},Fo=A;Object.defineProperty(ir,"__esModule",{value:!0});var xn=ir.default=void 0,No=Fo(io()),Vo=a;xn=ir.default=(0,No.default)((0,Vo.jsx)("path",{d:"M24 9v2h-6V9zM8 4C5.79 4 4 5.79 4 8s1.79 4 4 4 4-1.79 4-4-1.79-4-4-4m0 9c-2.67 0-8 1.34-8 4v3h16v-3c0-2.66-5.33-4-8-4m4.51-8.95C13.43 5.11 14 6.49 14 8s-.57 2.89-1.49 3.95C14.47 11.7 16 10.04 16 8s-1.53-3.7-3.49-3.95m4.02 9.78C17.42 14.66 18 15.7 18 17v3h2v-3c0-1.45-1.59-2.51-3.47-3.17"}),"GroupRemove");var _n={},Te={};const je=ee(fo),Xe=ee(po);var Et={},Je={},Ae={};const Re=ee(mo);var Tt={},fr;function Uo(){if(fr)return Tt;fr=1;var e=A;Object.defineProperty(Tt,"__esModule",{value:!0}),Tt.default=o;var d=e(re);function o(n,i){return(0,d.default)({toolbar:{minHeight:56,[n.up("xs")]:{"@media (orientation: landscape)":{minHeight:48}},[n.up("sm")]:{minHeight:64}}},i)}return Tt}var _e={},Qe={},pr;function Ko(){if(pr)return Qe;pr=1,Object.defineProperty(Qe,"__esModule",{value:!0}),Qe.default=void 0;const e={black:"#000",white:"#fff"};return Qe.default=e,Qe}var et={},mr;function Xo(){if(mr)return et;mr=1,Object.defineProperty(et,"__esModule",{value:!0}),et.default=void 0;const e={50:"#fafafa",100:"#f5f5f5",200:"#eeeeee",300:"#e0e0e0",400:"#bdbdbd",500:"#9e9e9e",600:"#757575",700:"#616161",800:"#424242",900:"#212121",A100:"#f5f5f5",A200:"#eeeeee",A400:"#bdbdbd",A700:"#616161"};return et.default=e,et}var tt={},hr;function Go(){if(hr)return tt;hr=1,Object.defineProperty(tt,"__esModule",{value:!0}),tt.default=void 0;const e={50:"#f3e5f5",100:"#e1bee7",200:"#ce93d8",300:"#ba68c8",400:"#ab47bc",500:"#9c27b0",600:"#8e24aa",700:"#7b1fa2",800:"#6a1b9a",900:"#4a148c",A100:"#ea80fc",A200:"#e040fb",A400:"#d500f9",A700:"#aa00ff"};return tt.default=e,tt}var rt={},vr;function Zo(){if(vr)return rt;vr=1,Object.defineProperty(rt,"__esModule",{value:!0}),rt.default=void 0;const e={50:"#ffebee",100:"#ffcdd2",200:"#ef9a9a",300:"#e57373",400:"#ef5350",500:"#f44336",600:"#e53935",700:"#d32f2f",800:"#c62828",900:"#b71c1c",A100:"#ff8a80",A200:"#ff5252",A400:"#ff1744",A700:"#d50000"};return rt.default=e,rt}var nt={},yr;function Yo(){if(yr)return nt;yr=1,Object.defineProperty(nt,"__esModule",{value:!0}),nt.default=void 0;const e={50:"#fff3e0",100:"#ffe0b2",200:"#ffcc80",300:"#ffb74d",400:"#ffa726",500:"#ff9800",600:"#fb8c00",700:"#f57c00",800:"#ef6c00",900:"#e65100",A100:"#ffd180",A200:"#ffab40",A400:"#ff9100",A700:"#ff6d00"};return nt.default=e,nt}var ot={},gr;function Jo(){if(gr)return ot;gr=1,Object.defineProperty(ot,"__esModule",{value:!0}),ot.default=void 0;const e={50:"#e3f2fd",100:"#bbdefb",200:"#90caf9",300:"#64b5f6",400:"#42a5f5",500:"#2196f3",600:"#1e88e5",700:"#1976d2",800:"#1565c0",900:"#0d47a1",A100:"#82b1ff",A200:"#448aff",A400:"#2979ff",A700:"#2962ff"};return ot.default=e,ot}var at={},br;function Qo(){if(br)return at;br=1,Object.defineProperty(at,"__esModule",{value:!0}),at.default=void 0;const e={50:"#e1f5fe",100:"#b3e5fc",200:"#81d4fa",300:"#4fc3f7",400:"#29b6f6",500:"#03a9f4",600:"#039be5",700:"#0288d1",800:"#0277bd",900:"#01579b",A100:"#80d8ff",A200:"#40c4ff",A400:"#00b0ff",A700:"#0091ea"};return at.default=e,at}var it={},xr;function ea(){if(xr)return it;xr=1,Object.defineProperty(it,"__esModule",{value:!0}),it.default=void 0;const e={50:"#e8f5e9",100:"#c8e6c9",200:"#a5d6a7",300:"#81c784",400:"#66bb6a",500:"#4caf50",600:"#43a047",700:"#388e3c",800:"#2e7d32",900:"#1b5e20",A100:"#b9f6ca",A200:"#69f0ae",A400:"#00e676",A700:"#00c853"};return it.default=e,it}var _r;function ta(){if(_r)return _e;_r=1;var e=A;Object.defineProperty(_e,"__esModule",{value:!0}),_e.dark=void 0,_e.default=h,_e.light=void 0;var d=e(re),o=e(ue()),n=e(cn),i=e(tr),c=rr,m=e(Ko()),t=e(Xo()),r=e(Go()),s=e(Zo()),u=e(Yo()),P=e(Jo()),v=e(Qo()),x=e(ea());const w=["mode","contrastThreshold","tonalOffset"],S=_e.light={text:{primary:"rgba(0, 0, 0, 0.87)",secondary:"rgba(0, 0, 0, 0.6)",disabled:"rgba(0, 0, 0, 0.38)"},divider:"rgba(0, 0, 0, 0.12)",background:{paper:m.default.white,default:m.default.white},action:{active:"rgba(0, 0, 0, 0.54)",hover:"rgba(0, 0, 0, 0.04)",hoverOpacity:.04,selected:"rgba(0, 0, 0, 0.08)",selectedOpacity:.08,disabled:"rgba(0, 0, 0, 0.26)",disabledBackground:"rgba(0, 0, 0, 0.12)",disabledOpacity:.38,focus:"rgba(0, 0, 0, 0.12)",focusOpacity:.12,activatedOpacity:.12}},I=_e.dark={text:{primary:m.default.white,secondary:"rgba(255, 255, 255, 0.7)",disabled:"rgba(255, 255, 255, 0.5)",icon:"rgba(255, 255, 255, 0.5)"},divider:"rgba(255, 255, 255, 0.12)",background:{paper:"#121212",default:"#121212"},action:{active:m.default.white,hover:"rgba(255, 255, 255, 0.08)",hoverOpacity:.08,selected:"rgba(255, 255, 255, 0.16)",selectedOpacity:.16,disabled:"rgba(255, 255, 255, 0.3)",disabledBackground:"rgba(255, 255, 255, 0.12)",disabledOpacity:.38,focus:"rgba(255, 255, 255, 0.12)",focusOpacity:.12,activatedOpacity:.24}};function R(l,g,j,O){const q=O.light||O,B=O.dark||O*1.5;l[g]||(l.hasOwnProperty(j)?l[g]=l[j]:g==="light"?l.light=(0,c.lighten)(l.main,q):g==="dark"&&(l.dark=(0,c.darken)(l.main,B)))}function p(l="light"){return l==="dark"?{main:P.default[200],light:P.default[50],dark:P.default[400]}:{main:P.default[700],light:P.default[400],dark:P.default[800]}}function C(l="light"){return l==="dark"?{main:r.default[200],light:r.default[50],dark:r.default[400]}:{main:r.default[500],light:r.default[300],dark:r.default[700]}}function y(l="light"){return l==="dark"?{main:s.default[500],light:s.default[300],dark:s.default[700]}:{main:s.default[700],light:s.default[400],dark:s.default[800]}}function f(l="light"){return l==="dark"?{main:v.default[400],light:v.default[300],dark:v.default[700]}:{main:v.default[700],light:v.default[500],dark:v.default[900]}}function b(l="light"){return l==="dark"?{main:x.default[400],light:x.default[300],dark:x.default[700]}:{main:x.default[800],light:x.default[500],dark:x.default[900]}}function _(l="light"){return l==="dark"?{main:u.default[400],light:u.default[300],dark:u.default[700]}:{main:"#ed6c02",light:u.default[500],dark:u.default[900]}}function h(l){const{mode:g="light",contrastThreshold:j=3,tonalOffset:O=.2}=l,q=(0,o.default)(l,w),B=l.primary||p(g),M=l.secondary||C(g),T=l.error||y(g),k=l.info||f(g),L=l.success||b(g),V=l.warning||_(g);function J(z){return(0,c.getContrastRatio)(z,I.text.primary)>=j?I.text.primary:S.text.primary}const U=({color:z,name:X,mainShade:de=500,lightShade:ne=300,darkShade:F=700})=>{if(z=(0,d.default)({},z),!z.main&&z[de]&&(z.main=z[de]),!z.hasOwnProperty("main"))throw new Error((0,n.default)(11,X?` (${X})`:"",de));if(typeof z.main!="string")throw new Error((0,n.default)(12,X?` (${X})`:"",JSON.stringify(z.main)));return R(z,"light",ne,O),R(z,"dark",F,O),z.contrastText||(z.contrastText=J(z.main)),z},K={dark:I,light:S};return(0,i.default)((0,d.default)({common:(0,d.default)({},m.default),mode:g,primary:U({color:B,name:"primary"}),secondary:U({color:M,name:"secondary",mainShade:"A400",lightShade:"A200",darkShade:"A700"}),error:U({color:T,name:"error"}),warning:U({color:V,name:"warning"}),info:U({color:k,name:"info"}),success:U({color:L,name:"success"}),grey:t.default,contrastThreshold:j,getContrastText:J,augmentColor:U,tonalOffset:O},K[g]),q)}return _e}var qt={},Pr;function ra(){if(Pr)return qt;Pr=1;var e=A;Object.defineProperty(qt,"__esModule",{value:!0}),qt.default=r;var d=e(re),o=e(ue()),n=e(tr);const i=["fontFamily","fontSize","fontWeightLight","fontWeightRegular","fontWeightMedium","fontWeightBold","htmlFontSize","allVariants","pxToRem"];function c(s){return Math.round(s*1e5)/1e5}const m={textTransform:"uppercase"},t='"Roboto", "Helvetica", "Arial", sans-serif';function r(s,u){const P=typeof u=="function"?u(s):u,{fontFamily:v=t,fontSize:x=14,fontWeightLight:w=300,fontWeightRegular:S=400,fontWeightMedium:I=500,fontWeightBold:R=700,htmlFontSize:p=16,allVariants:C,pxToRem:y}=P,f=(0,o.default)(P,i),b=x/14,_=y||(g=>`${g/p*b}rem`),h=(g,j,O,q,B)=>(0,d.default)({fontFamily:v,fontWeight:g,fontSize:_(j),lineHeight:O},v===t?{letterSpacing:`${c(q/j)}em`}:{},B,C),l={h1:h(w,96,1.167,-1.5),h2:h(w,60,1.2,-.5),h3:h(S,48,1.167,0),h4:h(S,34,1.235,.25),h5:h(S,24,1.334,0),h6:h(I,20,1.6,.15),subtitle1:h(S,16,1.75,.15),subtitle2:h(I,14,1.57,.1),body1:h(S,16,1.5,.15),body2:h(S,14,1.43,.15),button:h(I,14,1.75,.4,m),caption:h(S,12,1.66,.4),overline:h(S,12,2.66,1,m),inherit:{fontFamily:"inherit",fontWeight:"inherit",fontSize:"inherit",lineHeight:"inherit",letterSpacing:"inherit"}};return(0,n.default)((0,d.default)({htmlFontSize:p,pxToRem:_,fontFamily:v,fontSize:x,fontWeightLight:w,fontWeightRegular:S,fontWeightMedium:I,fontWeightBold:R},l),f,{clone:!1})}return qt}var st={},Cr;function na(){if(Cr)return st;Cr=1,Object.defineProperty(st,"__esModule",{value:!0}),st.default=void 0;const e=.2,d=.14,o=.12;function n(...c){return[`${c[0]}px ${c[1]}px ${c[2]}px ${c[3]}px rgba(0,0,0,${e})`,`${c[4]}px ${c[5]}px ${c[6]}px ${c[7]}px rgba(0,0,0,${d})`,`${c[8]}px ${c[9]}px ${c[10]}px ${c[11]}px rgba(0,0,0,${o})`].join(",")}const i=["none",n(0,2,1,-1,0,1,1,0,0,1,3,0),n(0,3,1,-2,0,2,2,0,0,1,5,0),n(0,3,3,-2,0,3,4,0,0,1,8,0),n(0,2,4,-1,0,4,5,0,0,1,10,0),n(0,3,5,-1,0,5,8,0,0,1,14,0),n(0,3,5,-1,0,6,10,0,0,1,18,0),n(0,4,5,-2,0,7,10,1,0,2,16,1),n(0,5,5,-3,0,8,10,1,0,3,14,2),n(0,5,6,-3,0,9,12,1,0,3,16,2),n(0,6,6,-3,0,10,14,1,0,4,18,3),n(0,6,7,-4,0,11,15,1,0,4,20,3),n(0,7,8,-4,0,12,17,2,0,5,22,4),n(0,7,8,-4,0,13,19,2,0,5,24,4),n(0,7,9,-4,0,14,21,2,0,5,26,4),n(0,8,9,-5,0,15,22,2,0,6,28,5),n(0,8,10,-5,0,16,24,2,0,6,30,5),n(0,8,11,-5,0,17,26,2,0,6,32,5),n(0,9,11,-5,0,18,28,2,0,7,34,6),n(0,9,12,-6,0,19,29,2,0,7,36,6),n(0,10,13,-6,0,20,31,3,0,8,38,7),n(0,10,13,-6,0,21,33,3,0,8,40,7),n(0,10,14,-6,0,22,35,3,0,8,42,7),n(0,11,14,-7,0,23,36,3,0,9,44,8),n(0,11,15,-7,0,24,38,3,0,9,46,8)];return st.default=i,st}var Pe={},jr;function oa(){if(jr)return Pe;jr=1;var e=A;Object.defineProperty(Pe,"__esModule",{value:!0}),Pe.default=r,Pe.easing=Pe.duration=void 0;var d=e(ue()),o=e(re);const n=["duration","easing","delay"],i=Pe.easing={easeInOut:"cubic-bezier(0.4, 0, 0.2, 1)",easeOut:"cubic-bezier(0.0, 0, 0.2, 1)",easeIn:"cubic-bezier(0.4, 0, 1, 1)",sharp:"cubic-bezier(0.4, 0, 0.6, 1)"},c=Pe.duration={shortest:150,shorter:200,short:250,standard:300,complex:375,enteringScreen:225,leavingScreen:195};function m(s){return`${Math.round(s)}ms`}function t(s){if(!s)return 0;const u=s/36;return Math.round((4+15*u**.25+u/5)*10)}function r(s){const u=(0,o.default)({},i,s.easing),P=(0,o.default)({},c,s.duration),v=(x=["all"],w={})=>{const{duration:S=P.standard,easing:I=u.easeInOut,delay:R=0}=w;return(0,d.default)(w,n),(Array.isArray(x)?x:[x]).map(p=>`${p} ${typeof S=="string"?S:m(S)} ${I} ${typeof R=="string"?R:m(R)}`).join(",")};return(0,o.default)({getAutoHeightDuration:t,create:v},s,{easing:u,duration:P})}return Pe}var lt={},Rr;function aa(){if(Rr)return lt;Rr=1,Object.defineProperty(lt,"__esModule",{value:!0}),lt.default=void 0;const e={mobileStepper:1e3,fab:1050,speedDial:1050,appBar:1100,drawer:1200,modal:1300,snackbar:1400,tooltip:1500};return lt.default=e,lt}var Or;function ia(){if(Or)return Ae;Or=1;var e=A;Object.defineProperty(Ae,"__esModule",{value:!0}),Ae.createMuiTheme=R,Ae.default=void 0;var d=e(re),o=e(ue()),n=e(cn),i=e(tr),c=S(un),m=e(ho);e(Re);var t=e(Uo()),r=e(ta()),s=e(ra()),u=e(na()),P=e(oa()),v=e(aa());const x=["breakpoints","mixins","spacing","palette","transitions","typography","shape"];function w(p){if(typeof WeakMap!="function")return null;var C=new WeakMap,y=new WeakMap;return(w=function(f){return f?y:C})(p)}function S(p,C){if(p&&p.__esModule)return p;if(p===null||typeof p!="object"&&typeof p!="function")return{default:p};var y=w(C);if(y&&y.has(p))return y.get(p);var f={__proto__:null},b=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var _ in p)if(_!=="default"&&Object.prototype.hasOwnProperty.call(p,_)){var h=b?Object.getOwnPropertyDescriptor(p,_):null;h&&(h.get||h.set)?Object.defineProperty(f,_,h):f[_]=p[_]}return f.default=p,y&&y.set(p,f),f}function I(p={},...C){const{mixins:y={},palette:f={},transitions:b={},typography:_={}}=p,h=(0,o.default)(p,x);if(p.vars&&p.generateCssVars===void 0)throw new Error((0,n.default)(18));const l=(0,r.default)(f),g=(0,m.default)(p);let j=(0,i.default)(g,{mixins:(0,t.default)(g.breakpoints,y),palette:l,shadows:u.default.slice(),typography:(0,s.default)(l,_),transitions:(0,P.default)(b),zIndex:(0,d.default)({},v.default)});return j=(0,i.default)(j,h),j=C.reduce((O,q)=>(0,i.default)(O,q),j),j.unstable_sxConfig=(0,d.default)({},c.unstable_defaultSxConfig,h==null?void 0:h.unstable_sxConfig),j.unstable_sx=function(q){return(0,c.default)({sx:q,theme:this})},j}function R(...p){return I(...p)}return Ae.default=I,Ae}var wr;function sa(){if(wr)return Je;wr=1;var e=A;Object.defineProperty(Je,"__esModule",{value:!0}),Je.default=void 0;var d=e(ia());const o=(0,d.default)();return Je.default=o,Je}var ct={},Tr;function la(){return Tr||(Tr=1,Object.defineProperty(ct,"__esModule",{value:!0}),ct.default=void 0,ct.default="$$material"),ct}var ut={},dt={},qr;function Pn(){if(qr)return dt;qr=1,Object.defineProperty(dt,"__esModule",{value:!0}),dt.default=void 0;function e(d){return d!=="ownerState"&&d!=="theme"&&d!=="sx"&&d!=="as"}return dt.default=e,dt}var Mr;function ca(){if(Mr)return ut;Mr=1;var e=A;Object.defineProperty(ut,"__esModule",{value:!0}),ut.default=void 0;var d=e(Pn());const o=n=>(0,d.default)(n)&&n!=="classes";return ut.default=o,ut}var Sr;function De(){return Sr||(Sr=1,function(e){"use client";var d=A;Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0,Object.defineProperty(e,"rootShouldForwardProp",{enumerable:!0,get:function(){return c.default}}),Object.defineProperty(e,"slotShouldForwardProp",{enumerable:!0,get:function(){return m.default}});var o=d(vo),n=d(sa()),i=d(la()),c=d(ca()),m=d(Pn());const t=(0,o.default)({themeId:i.default,defaultTheme:n.default,rootShouldForwardProp:c.default});e.default=t}(Et)),Et}var zt={},He={};const ua=ee(yo);var Ir;function da(){if(Ir)return He;Ir=1;var e=A;Object.defineProperty(He,"__esModule",{value:!0}),He.default=void 0,He.useDefaultProps=t;var d=e(re);c(H),e(xe);var o=c(ua),n=a;function i(r){if(typeof WeakMap!="function")return null;var s=new WeakMap,u=new WeakMap;return(i=function(P){return P?u:s})(r)}function c(r,s){if(r&&r.__esModule)return r;if(r===null||typeof r!="object"&&typeof r!="function")return{default:r};var u=i(s);if(u&&u.has(r))return u.get(r);var P={__proto__:null},v=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var x in r)if(x!=="default"&&Object.prototype.hasOwnProperty.call(r,x)){var w=v?Object.getOwnPropertyDescriptor(r,x):null;w&&(w.get||w.set)?Object.defineProperty(P,x,w):P[x]=r[x]}return P.default=r,u&&u.set(r,P),P}function m(r){return(0,n.jsx)(o.default,(0,d.default)({},r))}He.default=m;function t(r){return(0,o.useDefaultProps)(r)}return He}var Dr;function ke(){return Dr||(Dr=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return d.default}}),Object.defineProperty(e,"useDefaultProps",{enumerable:!0,get:function(){return d.useDefaultProps}});var d=n(da());function o(i){if(typeof WeakMap!="function")return null;var c=new WeakMap,m=new WeakMap;return(o=function(t){return t?m:c})(i)}function n(i,c){if(i&&i.__esModule)return i;if(i===null||typeof i!="object"&&typeof i!="function")return{default:i};var m=o(c);if(m&&m.has(i))return m.get(i);var t={__proto__:null},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in i)if(s!=="default"&&Object.prototype.hasOwnProperty.call(i,s)){var u=r?Object.getOwnPropertyDescriptor(i,s):null;u&&(u.get||u.set)?Object.defineProperty(t,s,u):t[s]=i[s]}return t.default=i,m&&m.set(i,t),t}}(zt)),zt}var ft={},kr;function sr(){if(kr)return ft;kr=1,Object.defineProperty(ft,"__esModule",{value:!0}),ft.default=void 0;var e=o(H);function d(i){if(typeof WeakMap!="function")return null;var c=new WeakMap,m=new WeakMap;return(d=function(t){return t?m:c})(i)}function o(i,c){if(i&&i.__esModule)return i;if(i===null||typeof i!="object"&&typeof i!="function")return{default:i};var m=d(c);if(m&&m.has(i))return m.get(i);var t={__proto__:null},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in i)if(s!=="default"&&Object.prototype.hasOwnProperty.call(i,s)){var u=r?Object.getOwnPropertyDescriptor(i,s):null;u&&(u.get||u.set)?Object.defineProperty(t,s,u):t[s]=i[s]}return t.default=i,m&&m.set(i,t),t}const n=e.createContext({});return ft.default=n,ft}var Ft={},qe={};const fa=ee(go),pa=ee(bo);var pt={};const ma=ee(xo);var $r;function Cn(){if($r)return pt;$r=1;var e=A;Object.defineProperty(pt,"__esModule",{value:!0}),pt.default=void 0;var d=e(ma);return pt.default=d.default,pt}var mt={};const ha=ee(_o);var Wr;function va(){if(Wr)return mt;Wr=1;var e=A;Object.defineProperty(mt,"__esModule",{value:!0}),mt.default=void 0;var d=e(ha);return mt.default=d.default,mt}var ht={};const ya=ee(Po);var Br;function ga(){if(Br)return ht;Br=1;var e=A;Object.defineProperty(ht,"__esModule",{value:!0}),ht.default=void 0;var d=e(ya);return ht.default=d.default,ht}var le={};const ba=ee(Co),xa=ee(jo),_a=ee(Ro);var vt={},Ar;function Pa(){if(Ar)return vt;Ar=1;var e=A;Object.defineProperty(vt,"__esModule",{value:!0}),vt.default=void 0;var d=c(H);e(xe);var o=e(je),n=a;function i(t){if(typeof WeakMap!="function")return null;var r=new WeakMap,s=new WeakMap;return(i=function(u){return u?s:r})(t)}function c(t,r){if(t&&t.__esModule)return t;if(t===null||typeof t!="object"&&typeof t!="function")return{default:t};var s=i(r);if(s&&s.has(t))return s.get(t);var u={__proto__:null},P=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var v in t)if(v!=="default"&&Object.prototype.hasOwnProperty.call(t,v)){var x=P?Object.getOwnPropertyDescriptor(t,v):null;x&&(x.get||x.set)?Object.defineProperty(u,v,x):u[v]=t[v]}return u.default=t,s&&s.set(t,u),u}function m(t){const{className:r,classes:s,pulsate:u=!1,rippleX:P,rippleY:v,rippleSize:x,in:w,onExited:S,timeout:I}=t,[R,p]=d.useState(!1),C=(0,o.default)(r,s.ripple,s.rippleVisible,u&&s.ripplePulsate),y={width:x,height:x,top:-(x/2)+v,left:-(x/2)+P},f=(0,o.default)(s.child,R&&s.childLeaving,u&&s.childPulsate);return!w&&!R&&p(!0),d.useEffect(()=>{if(!w&&S!=null){const b=setTimeout(S,I);return()=>{clearTimeout(b)}}},[S,w,I]),(0,n.jsx)("span",{className:C,style:y,children:(0,n.jsx)("span",{className:f})})}return vt.default=m,vt}var Le={};const $e=ee(Oo);var Hr;function jn(){if(Hr)return Le;Hr=1;var e=A;Object.defineProperty(Le,"__esModule",{value:!0}),Le.default=void 0,Le.getTouchRippleUtilityClass=n;var d=e($e),o=e(Re);function n(c){return(0,o.default)("MuiTouchRipple",c)}const i=(0,d.default)("MuiTouchRipple",["root","ripple","rippleVisible","ripplePulsate","child","childLeaving","childPulsate"]);return Le.default=i,Le}var Lr;function Ca(){if(Lr)return le;Lr=1;var e=A;Object.defineProperty(le,"__esModule",{value:!0}),le.default=le.TouchRippleRoot=le.TouchRippleRipple=le.DELAY_RIPPLE=void 0;var d=e(re),o=e(ue()),n=S(H);e(xe);var i=ba,c=e(je),m=xa,t=e(_a),r=e(De()),s=ke(),u=e(Pa()),P=e(jn()),v=a;const x=["center","classes","className"];function w(h){if(typeof WeakMap!="function")return null;var l=new WeakMap,g=new WeakMap;return(w=function(j){return j?g:l})(h)}function S(h,l){if(h&&h.__esModule)return h;if(h===null||typeof h!="object"&&typeof h!="function")return{default:h};var g=w(l);if(g&&g.has(h))return g.get(h);var j={__proto__:null},O=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var q in h)if(q!=="default"&&Object.prototype.hasOwnProperty.call(h,q)){var B=O?Object.getOwnPropertyDescriptor(h,q):null;B&&(B.get||B.set)?Object.defineProperty(j,q,B):j[q]=h[q]}return j.default=h,g&&g.set(h,j),j}const I=550,R=le.DELAY_RIPPLE=80,p=(0,m.keyframes)`
|
|
2
2
|
0% {
|
|
3
3
|
transform: scale(0);
|
|
4
4
|
opacity: 0.1;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/connect-hUOpYByL.js","assets/vendor-mui-core-Bq8gXTan.js","assets/vendor-react-DEoibe3W.js","assets/vendor-utils-BfZ4tlod.js","assets/useAsync-C62uE2pS.js","assets/vendor-hooks-DqdmWCmo.js","assets/vendor-arcblock-f1tICt1E.js","assets/vendor-ux-did-connect-BbCim3WZ.js","assets/lottie-web-jYmAQWuC.js","assets/vendor-ux-did-connect-DpSGLE7B.css","assets/index-BMCGWiyM.js","assets/index-DOq-_YXu.css","assets/config-DS_kGhWk.js","assets/index-DyCrJT9-.js","assets/Done-C4iTqhTW.js","assets/collapse-D4xd-ptF.js","assets/Google-DboCD85r.js","assets/cloneDeep-CDl5kZTY.js","assets/logo-uploader-C1N-bsM2.js","assets/index-DVQCgvFb.js","assets/page-header-CiTTXRdM.js","assets/layout-Balq-c2F.js","assets/content-layout-BC2QkTYi.js","assets/step-actions-njetG0Iy.js","assets/use-mobile-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/connect-hUOpYByL.js","assets/vendor-mui-core-Bq8gXTan.js","assets/vendor-react-DEoibe3W.js","assets/vendor-utils-BfZ4tlod.js","assets/useAsync-C62uE2pS.js","assets/vendor-hooks-DqdmWCmo.js","assets/vendor-arcblock-f1tICt1E.js","assets/vendor-ux-did-connect-BbCim3WZ.js","assets/lottie-web-jYmAQWuC.js","assets/vendor-ux-did-connect-DpSGLE7B.css","assets/index-BMCGWiyM.js","assets/index-DOq-_YXu.css","assets/config-DS_kGhWk.js","assets/index-DyCrJT9-.js","assets/Done-C4iTqhTW.js","assets/collapse-D4xd-ptF.js","assets/Google-DboCD85r.js","assets/cloneDeep-CDl5kZTY.js","assets/logo-uploader-C1N-bsM2.js","assets/index-DVQCgvFb.js","assets/page-header-CiTTXRdM.js","assets/layout-Balq-c2F.js","assets/content-layout-BC2QkTYi.js","assets/step-actions-njetG0Iy.js","assets/use-mobile-CtTQsfXN.js","assets/button-ogiWKbo_.js","assets/index-Dj3HMPh8.js","assets/config-space-DlQnLPiY.js","assets/spaces-BR4I2U0t.js","assets/api-C1S8LUld.js","assets/connect-to-EzXJLWP1.js","assets/index-8eXqqyHQ.js","assets/DeleteOutline-CYuYysba.js","assets/domain-C7iO-bfS.js","assets/domain-action-card-CqcqlPAn.js","assets/ExpandLess-CRv5O8qM.js","assets/permission-CQWJVo4a.js","assets/session-BDyIB4uh.js","assets/dot-4jhL56kz.js","assets/confirm-Bbp7EOHO.js","assets/actions-BgkGoToI.js","assets/MoreHoriz-H_VQNQ9b.js","assets/delete-confirm-BdthpUzC.js","assets/click-to-copy-D0HginOX.js","assets/util-BK7oThoq.js","assets/useSetState-CWq0AVWn.js","assets/InfoOutlined-B5f3YRb4.js","assets/index-DDI23z2P.js","assets/CheckCircle-DYKWpCjc.js","assets/access-control-C9hWo6TU.js","assets/config-DEbtcbH9.js","assets/fuel-BRI4NZNF.js","assets/Launch-Cy-UlooC.js","assets/did-address-DFiM35OM.js","assets/complete-D2In_TeH.js","assets/launch-result-message-AharZGq2.js","assets/get-safe-url-BS4IIyYC.js","assets/starting-progress-BsYL_5xB.js","assets/addon-DZBLWIf7.js","assets/QuestionMarkCircle-jbhclAfX.js","assets/use-server-logo-UTr-CyJD.js","assets/use-mobile-DwzRjjku.js"])))=>i.map(i=>d[i]);
|
|
2
2
|
import{a as V,a$ as G,k as P,_ as h}from"./vendor-ux-did-connect-BbCim3WZ.js";import{j as e,a7 as J,ah as b,e as Y,bD as ee,aa as te,ab as se,b9 as ae}from"./vendor-mui-core-Bq8gXTan.js";import{r as i,h as ne,f as oe,i as re,j as m,k as ie}from"./vendor-react-DEoibe3W.js";import{B as ce,z as le,A as a,$ as pe,ab as ue}from"./vendor-utils-BfZ4tlod.js";import{C as de}from"./config-space-DlQnLPiY.js";import{H as me}from"./addon-DZBLWIf7.js";import{S as he,L as fe,c as S}from"./vendor-arcblock-f1tICt1E.js";import{r as _e,k as Le,u as xe,t as E,v as Ce,w as ge,x as O,N as Ee,f as ye,S as ve}from"./index-BMCGWiyM.js";import{g as U}from"./get-safe-url-BS4IIyYC.js";import{y as we}from"./vendor-hooks-DqdmWCmo.js";import{u as Pe}from"./use-server-logo-UTr-CyJD.js";const Se=s=>i.createElement("svg",{width:32,height:32,viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg",...s},i.createElement("path",{d:"M4.00572 31C3.25866 31 2.53839 30.7217 1.98537 30.2194C1.43235 29.7171 1.08623 29.0269 1.01451 28.2833L1.00049 27.9948V5.95637C1.00052 5.2093 1.27881 4.48903 1.78109 3.93601C2.28336 3.38299 2.9736 3.03688 3.71722 2.96516L4.00572 2.95113H13.0214C13.7682 2.95112 14.4882 3.22913 15.0412 3.73099C15.5941 4.23285 15.9405 4.92261 16.0126 5.66586L16.0267 5.95637V6.46526L20.4123 1.91934C20.9292 1.38325 21.6267 1.05817 22.3696 1.00708C23.1125 0.956001 23.8479 1.18256 24.4333 1.64285L24.6657 1.84521L30.1893 7.30472C30.7197 7.82899 31.0362 8.53173 31.0773 9.27635C31.1184 10.021 30.8812 10.7543 30.4117 11.3337L30.2054 11.5661L25.5753 15.9738H26.0441C26.7909 15.9738 27.5109 16.2518 28.0639 16.7537C28.6168 17.2555 28.9631 17.9453 29.0353 18.6886L29.0494 18.9791V27.9948C29.0494 28.7415 28.7714 29.4615 28.2695 30.0145C27.7676 30.5675 27.0779 30.9138 26.3346 30.986L26.0441 31H4.00572ZM14.0232 17.9773H3.00398V27.9948C3.00388 28.1993 3.06641 28.399 3.18317 28.567C3.29993 28.735 3.46533 28.8632 3.65712 28.9344L3.82541 28.9805L4.00572 28.9965H14.0232V17.9773ZM26.0441 17.9773H16.0267V28.9965H26.0441C26.2786 28.9966 26.5056 28.9144 26.6858 28.7643C26.8659 28.6142 26.9876 28.4057 27.0298 28.1751L27.0459 27.9948V18.9791C27.0459 18.7446 26.9638 18.5175 26.8137 18.3374C26.6636 18.1573 26.4551 18.0355 26.2244 17.9933L26.0441 17.9773ZM16.0267 12.3876V15.9738H19.6129L16.0267 12.3876ZM13.0214 4.95462H4.00572C3.77126 4.95455 3.5442 5.03671 3.36409 5.18681C3.18397 5.3369 3.06221 5.54542 3.02001 5.77605L3.00398 5.95637V15.9738H14.0232V5.95637C14.0233 5.75179 13.9607 5.55209 13.844 5.38411C13.7272 5.21613 13.5618 5.08792 13.37 5.01673L13.2017 4.97065L13.0214 4.95462ZM23.2833 3.29774C23.1148 3.13081 22.8929 3.02865 22.6565 3.00922C22.4202 2.9898 22.1845 3.05436 21.9911 3.19155L21.8548 3.31176L16.6137 8.74723C16.4555 8.91127 16.358 9.12433 16.3373 9.35125C16.3165 9.57817 16.3737 9.80539 16.4995 9.99541L16.6257 10.1517L21.8668 15.3908C22.0273 15.5515 22.2377 15.653 22.4634 15.6785C22.6891 15.7039 22.9167 15.652 23.109 15.531L23.2653 15.4088L28.7909 10.1457C28.9556 9.97892 29.0567 9.7597 29.0764 9.52614C29.0962 9.29259 29.0334 9.0595 28.8991 8.86744L28.7809 8.7292L23.2833 3.29774Z"})),H="https://launcher.arcblock.io",je=s=>{if(!s)return H;const{protocol:t,host:f}=pe(ue(s));return`${t}//${f}`},Re=s=>s?{"__did-connect__":ce.from(JSON.stringify({switchBehavior:"auto",forceConnected:s,showClose:!1}),"utf8").toString("base64")}:{};function Ae(s,t=H,f=""){const{t:_}=V(),y=Re(f),{loading:d,value:p,error:n,retry:c}=we(async()=>{if(s!=="serverless")return null;const v=je(t),L=await _e(v),w=le(a(L,"/u/apps"),y);return{text:_("launchBlocklet.nav.myApps"),appText:_("launchBlocklet.nav.viewMyApps"),link:w,buttonProps:{sx:{fontSize:"1rem"}},icon:e.jsx(J,{component:Se,fontSize:"small",viewBox:"0 0 32 32"})}},[s,t,f,_]);return s!=="serverless"||p===null?{}:d?{loading:!0}:n?{error:n,retry:c}:p||{}}const ke=b.span`
|
|
3
3
|
color: ${s=>s.theme.palette.error.main};
|
|
4
4
|
&::before {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as t,ab as G,bD as Q,aa as p,v as X,H as v,ap as J,b9 as Y,ah as S,w as Z}from"./vendor-mui-core-Bq8gXTan.js";import{r as g,L as H}from"./vendor-react-DEoibe3W.js";import{x as ee,b as E}from"./vendor-hooks-DqdmWCmo.js";import{A as L}from"./vendor-utils-BfZ4tlod.js";import{d as te}from"./PlayArrow-DZsdEeq_.js";import{d as re}from"./Error-Dt1QvSlR.js";import{a as F,a3 as D,F as oe,k as A,Q as ne,B as R,a2 as se,D as ie}from"./vendor-ux-did-connect-BbCim3WZ.js";import{W as ae}from"./did-address-DFiM35OM.js";import{d as z,e as W,g as le,f as U,h as de,j as T,S as ce,u as pe,k as me,l as he,m as ue,P as ge,O as fe,n as I,o as xe,q as B}from"./index-BMCGWiyM.js";import{H as be}from"./addon-DZBLWIf7.js";import{u as ke}from"./use-server-logo-UTr-CyJD.js";import{g as M}from"./get-safe-url-BS4IIyYC.js";import{b as je}from"./vendor-arcblock-f1tICt1E.js";import{p as ye,S as we,P as ve}from"./starting-progress-BsYL_5xB.js";import"./lottie-web-jYmAQWuC.js";import"./QuestionMarkCircle-jbhclAfX.js";import"./use-mobile-
|
|
1
|
+
import{j as t,ab as G,bD as Q,aa as p,v as X,H as v,ap as J,b9 as Y,ah as S,w as Z}from"./vendor-mui-core-Bq8gXTan.js";import{r as g,L as H}from"./vendor-react-DEoibe3W.js";import{x as ee,b as E}from"./vendor-hooks-DqdmWCmo.js";import{A as L}from"./vendor-utils-BfZ4tlod.js";import{d as te}from"./PlayArrow-DZsdEeq_.js";import{d as re}from"./Error-Dt1QvSlR.js";import{a as F,a3 as D,F as oe,k as A,Q as ne,B as R,a2 as se,D as ie}from"./vendor-ux-did-connect-BbCim3WZ.js";import{W as ae}from"./did-address-DFiM35OM.js";import{d as z,e as W,g as le,f as U,h as de,j as T,S as ce,u as pe,k as me,l as he,m as ue,P as ge,O as fe,n as I,o as xe,q as B}from"./index-BMCGWiyM.js";import{H as be}from"./addon-DZBLWIf7.js";import{u as ke}from"./use-server-logo-UTr-CyJD.js";import{g as M}from"./get-safe-url-BS4IIyYC.js";import{b as je}from"./vendor-arcblock-f1tICt1E.js";import{p as ye,S as we,P as ve}from"./starting-progress-BsYL_5xB.js";import"./lottie-web-jYmAQWuC.js";import"./QuestionMarkCircle-jbhclAfX.js";import"./use-mobile-DwzRjjku.js";function K({appInfo:e,...o}){const[r,i]=g.useState(!1),d=X(f=>f.breakpoints.down("md"))?32:48;return r?t.jsx(se,{did:e.publisher,size:d}):t.jsx(ie,{src:e.icon,alt:e.title,width:d,height:d,...o,onError:()=>i(!0)})}K.propTypes={appInfo:v.object.isRequired};const q=(e,o)=>U.findComponentByIdV2(e,o)||e;function Ke(){var w,$,k;const{t:e,locale:o}=F(),[r,i]=ee({blocklet:null,component:null,launcherSession:null,loading:!1,starting:!1,manageSubscriptionURL:"",restart:!1}),l=localStorage.getItem("blocklet-server-url"),d=ke({onClick:()=>{l&&window.open(M(l,{allowDomains:null}))}}),f=new URL(window.location.href),P=f.searchParams.get("componentId"),_=()=>{const s=f.searchParams.get("redirect")||"/";window.location.href=M(decodeURIComponent(s))},x=()=>{const s=setInterval(()=>{z.get("/blocklet/detail?nocache=1").then(({data:n})=>{i(u=>({...u,blocklet:n}));const a=q(n,P);if(a.status==="running"){_();return}a.status!=="starting"&&!r.restart&&(i({blocklet:n,starting:!1}),n!==a&&i({component:a}),clearInterval(s))}).catch(n=>{i({loading:!1,restart:!1}),D.error(n.message)})},3e3)},j=()=>{i({restart:!0,starting:!0,loading:!0}),setTimeout(()=>{x()},10)};g.useEffect(()=>{i({loading:!0}),z.get("/blocklet/detail?nocache=1").then(({data:s})=>{const n=q(s,P);if(i({blocklet:s,loading:!1}),n.status==="running"){_();return}i({blocklet:s}),s!==n&&i({component:n}),n.status==="starting"&&(i({starting:!0}),x())}).catch(s=>{i({loading:!1}),D.error(s.message)})},[]);const C=g.useCallback(()=>{i({loading:!0,starting:!0});const s=r.blocklet;if(!s)return;const n={did:s==null?void 0:s.meta.did};s.children.length>0&&(n.componentDids=s.children.map(a=>a.meta.did)),W.startBlocklet({input:n}).then(({blocklet:a})=>{i(u=>({...u,blocklet:a})),x()}).catch(a=>{D.error(a.message),i({loading:!1,starting:!1})})},[r.component,r.blocklet]);g.useEffect(()=>{var s;(s=r.blocklet)!=null&&s.controller&&(le({launcherUrl:r.blocklet.controller.launcherUrl,launcherSessionId:r.blocklet.controller.launcherSessionId,locale:o}).then(n=>{i({manageSubscriptionURL:n})}).catch(n=>{console.error("get manage subscription url error",n)}),W.getLauncherSession({input:{launcherSessionId:r.blocklet.controller.launcherSessionId,launcherUrl:r.blocklet.controller.launcherUrl}}).then(n=>{i({launcherSession:n.launcherSession})}).catch(n=>{console.error("get launcher session error",n)}))},[(w=r.blocklet)==null?void 0:w.controller]);const b=E(()=>{var s,n;return(n=(s=r.blocklet)==null?void 0:s.children)==null?void 0:n.length},[r.blocklet]),c=E(()=>{var s,n,a;return((a=(n=(s=r.blocklet)==null?void 0:s.children)==null?void 0:n.filter(u=>u.status==="running"))==null?void 0:a.length)||0},[r.blocklet]),m=E(()=>b?c?Math.round(Math.max(c/b,.15)*100):5:0,[c,b]);if(!r.blocklet)return t.jsx(oe,{children:t.jsx(G,{})});const h={icon:`${A.WELLKNOWN_SERVICE_PATH_PREFIX}/blocklet/logo`,title:U.getDisplayName(r.blocklet),publisher:r.blocklet.appDid},N=ne(ye,r.starting?{width:`${m}%`,"&::after":{width:`${m}%`},"&::before":{width:`${m}%`,animation:"shimmer 1s infinite cubic-bezier(0.4, 0.0, 0.2, 1)","@keyframes shimmer":{"0%":{width:0},"100%":{width:`${m}%`}}}}:{}),y=de(r.blocklet)||T(r.launcherSession);return t.jsxs(_e,{children:[t.jsx(Q,{styles:Pe}),t.jsxs("header",{className:"root-header",children:[t.jsx("div",{className:"left",children:d}),t.jsx(je,{children:t.jsx(be,{SessionContext:ce})})]}),t.jsxs(Ce,{elevation:0,children:[t.jsxs(Ne,{children:[t.jsx(K,{appInfo:h}),t.jsxs("div",{className:"app-info_content",children:[t.jsx(p,{className:"app-info_name",children:h.title}),t.jsx(ae,{size:14,className:"app-info_did",did:h.publisher})]})]}),(r.restart||!y)&&t.jsxs(t.Fragment,{children:[t.jsxs(p,{className:"title-box",children:[t.jsx(p,{className:"icon",children:t.jsx(te,{})}),t.jsx(p,{className:"title",children:e("blocklet.startApplication")})]}),t.jsx(p,{className:"sub-title",children:r.starting?t.jsx(we,{blocklets:(($=r.blocklet)==null?void 0:$.children)??[]}):e("blocklet.startDescription",{name:r.component?U.getDisplayName(r.component,!0):U.getDisplayName(r.blocklet)})}),t.jsx(p,{mt:8,display:"flex",flexDirection:"column",alignItems:"center",gap:1,children:t.jsx(ve,{blocklets:((k=r.blocklet)==null?void 0:k.children)??[],status:r.starting?"starting":"",children:t.jsx(R,{sx:N,disabled:r.loading||r.starting,variant:"contained",color:"primary",size:"large",loading:r.starting,onClick:()=>C(),children:t.jsx("span",{style:{position:"relative",zIndex:2},children:r.starting?`(${c}/${b}) ${e("blocklet.starting")}`:e("blocklet.start")})})})})]}),y&&!r.restart&&t.jsx(O,{blocklet:r.blocklet,launcherSession:r.launcherSession,manageSubscriptionURL:r.manageSubscriptionURL,handleRestart:j}),t.jsx(p,{mt:5,children:t.jsx(H,{className:"footer-link",to:`${A.WELLKNOWN_SERVICE_PATH_PREFIX}/admin/overview`,children:e("blocklet.dashboard")})})]})]})}function O({blocklet:e,launcherSession:o,manageSubscriptionURL:r,handleRestart:i}){var N,y;const{t:l,locale:d}=F(),{connectApi:f,session:P}=pe(),{refreshSubscription:_}=me(),[x,j]=g.useState(!1),[C,b]=g.useState("");if(g.useEffect(()=>{var w;if((w=e==null?void 0:e.controller)!=null&&w.launcherUrl&&T(o)){const $=L(e.controller.launcherUrl,"__blocklet__.js?type=json");fetch($).then(k=>k.json()).then(k=>{var a,u;const s=(u=(a=k.componentMountPoints)==null?void 0:a.find(V=>V.did==="z2qaCNvKMv5GjouKdcDWexv6WqtHbpNPQDnAk"))==null?void 0:u.mountPoint,n=L(e.controller.launcherUrl,s);b(n)})}},[(N=e==null?void 0:e.controller)==null?void 0:N.launcherUrl,o]),!e||!o)return"";const c=T(o),m=!c&&he(e,o),h=!c&&ue(e,o);return!m&&!h&&!c?"":t.jsxs(t.Fragment,{children:[x&&C&&o&&t.jsx(ge,{session:P,connect:f,baseUrl:C,authToken:o.subscription.authToken,children:t.jsx(fe,{dialogProps:{open:x,onClose:()=>j(!1)},subscriptionId:o.subscription.id,successToast:!0,onPaid:()=>{z.post("/blocklet/start?fromSetup=1"),_(),i(),j(!1)}})}),t.jsxs(p,{className:"title-box",children:[t.jsx(re,{className:"icon-error"}),t.jsxs(p,{className:"title error",children:[m&&l("blocklet.suspended"),h&&l("blocklet.terminated"),c&&l("blocklet.suspended")]})]}),t.jsxs(p,{className:"sub-title",children:[m&&l("blocklet.suspendedCausedByExpired",{deadline:I(o==null?void 0:o.reservedUntil,d),canceledAt:I((((y=o==null?void 0:o.subscription)==null?void 0:y.canceled_at)||0)*1e3,d)}),h&&l("blocklet.suspendedCausedByTerminated",{canceledAt:I(o==null?void 0:o.terminatedAt,d),deadline:xe(o==null?void 0:o.terminatedAt,d)}),c&&l("blocklet.suspendedCausedByPastDue",{deadline:I(o==null?void 0:o.reservedUntil,d)})]}),t.jsxs(p,{mt:8,children:[c&&!B(o)&&t.jsx(R,{style:{minWidth:200},variant:"contained",color:"primary",size:"large",onClick:()=>j(!0),children:l("blocklet.payNow")}),(m||B(o))&&t.jsx(R,{component:J,style:{minWidth:200},variant:"contained",color:"primary",size:"large",target:"_blank",href:r||"#",children:l("blocklet.manageSubscription")}),h&&t.jsx(R,{component:H,to:L(A.WELLKNOWN_SERVICE_PATH_PREFIX,"/admin/did-spaces"),style:{minWidth:200},variant:"contained",color:"primary",size:"large",children:l("common.backup")})]})]})}O.propTypes={blocklet:v.object.isRequired,launcherSession:v.object.isRequired,manageSubscriptionURL:v.string.isRequired,handleRestart:v.func.isRequired};const Pe=Y`
|
|
2
2
|
html,
|
|
3
3
|
body,
|
|
4
4
|
#app,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as e,aa as a,H as o,ah as p}from"./vendor-mui-core-Bq8gXTan.js";import{u as l}from"./use-mobile-
|
|
1
|
+
import{j as e,aa as a,H as o,ah as p}from"./vendor-mui-core-Bq8gXTan.js";import{u as l}from"./use-mobile-CtTQsfXN.js";import{al as m}from"./index-BMCGWiyM.js";function r({blocklet:t,children:n}){const i=l();return!t||m(t.meta)?e.jsx(s,{isMobile:i,children:n}):e.jsx(s,{isMobile:i,children:e.jsx(a,{display:"flex",variant:"contained",color:"primary",alignItems:"center",marginLeft:"32px",children:n})})}r.propTypes={blocklet:o.object,children:o.any};r.defaultProps={blocklet:null,children:null};const s=p(a)`
|
|
2
2
|
padding-top: 24px;
|
|
3
3
|
margin-top: auto;
|
|
4
4
|
width: 100%;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{d as c}from"./InfoOutlined-B5f3YRb4.js";import{r as u}from"./vendor-react-DEoibe3W.js";import{a as j}from"./vendor-ux-did-connect-BbCim3WZ.js";import{j as e,aa as s,a8 as b,ad as x,I as d,H as o}from"./vendor-mui-core-Bq8gXTan.js";import{u as g}from"./use-mobile-
|
|
1
|
+
import{d as c}from"./InfoOutlined-B5f3YRb4.js";import{r as u}from"./vendor-react-DEoibe3W.js";import{a as j}from"./vendor-ux-did-connect-BbCim3WZ.js";import{j as e,aa as s,a8 as b,ad as x,I as d,H as o}from"./vendor-mui-core-Bq8gXTan.js";import{u as g}from"./use-mobile-DwzRjjku.js";function T({title:n,tooltipTitle:r,link:i}){const{t}=j(),p=g(),[h,l]=u.useState(!1),m=()=>l(f=>!f),a=()=>l(!1);return p?e.jsxs(s,{sx:{color:"text.secondary",fontSize:"14px",lineHeight:1.5},children:[n,e.jsx(b,{onClickAway:a,children:e.jsx("span",{children:e.jsx(x,{open:h,onClose:a,disableFocusListener:!0,disableHoverListener:!0,disableTouchListener:!0,title:e.jsxs(s,{sx:{fontSize:"14px",lineHeight:1.5},children:[r,e.jsx(s,{sx:{color:"info.main",ml:.5},component:"a",href:i,target:"_blank",rel:"noopener noreferrer",children:t("dashboard.document")})]}),children:e.jsx(d,{size:"small",onClick:m,sx:{ml:.5},children:e.jsx(c,{fontSize:"14"})})})})})]}):e.jsxs(s,{sx:{color:"text.secondary",fontSize:"14px",lineHeight:1.5},children:[n,e.jsx(x,{enterTouchDelay:0,leaveTouchDelay:3e3,title:e.jsxs(s,{sx:{fontSize:"14px",lineHeight:1.5},children:[r,e.jsx(s,{sx:{color:"info.main",ml:.5},component:"a",href:i,target:"_blank",rel:"noopener noreferrer",children:t("dashboard.document")})]}),children:e.jsx(d,{size:"small",sx:{ml:.5},children:e.jsx(c,{fontSize:"14"})})})]})}T.propTypes={title:o.string.isRequired,tooltipTitle:o.string.isRequired,link:o.string.isRequired};export{T};
|