@abtnode/webapp 1.16.25 → 1.16.26-beta-bdd2d7c0
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/blocklet.js +1 -1
- package/blocklet.yml +1 -1
- package/build/asset-manifest.json +47 -47
- package/build/index.html +1 -1
- package/build/service-worker.js +1 -1
- package/build/static/js/1059.cd52ca65.chunk.js +1 -0
- package/build/static/js/{1371.384ff23d.chunk.js → 1371.c21feb0c.chunk.js} +1 -1
- package/build/static/js/1575.eebd3dd7.chunk.js +1 -0
- package/build/static/js/{1667.dc49a80d.chunk.js → 1667.34ff0c47.chunk.js} +1 -1
- package/build/static/js/1846.6e3f3612.chunk.js +1 -0
- package/build/static/js/2019.2d3a40ae.chunk.js +1 -0
- package/build/static/js/{2098.6c45c749.chunk.js → 2098.a38c7200.chunk.js} +1 -1
- package/build/static/js/{2183.ddd3936e.chunk.js → 2183.0f4144d9.chunk.js} +1 -1
- package/build/static/js/2264.f2eb6130.chunk.js +1 -0
- package/build/static/js/233.a4c19158.chunk.js +1 -0
- package/build/static/js/2611.b0ece77c.chunk.js +1 -0
- package/build/static/js/{2960.b8de1df9.chunk.js → 2960.ba10b91c.chunk.js} +1 -1
- package/build/static/js/{3389.83a58684.chunk.js → 3389.7f3e3f8a.chunk.js} +1 -1
- package/build/static/js/3803.df3cb936.chunk.js +1 -0
- package/build/static/js/3930.31250151.chunk.js +1 -0
- package/build/static/js/4423.0b4a3962.chunk.js +1 -0
- package/build/static/js/4465.d622f2c2.chunk.js +1 -0
- package/build/static/js/{4549.40b371f5.chunk.js → 4549.40465785.chunk.js} +1 -1
- package/build/static/js/{4550.6398038b.chunk.js → 4550.b2afea4a.chunk.js} +1 -1
- package/build/static/js/{4775.bc1f9bc3.chunk.js → 4775.6cffbd67.chunk.js} +1 -1
- package/build/static/js/4906.9b6bdc77.chunk.js +1 -0
- package/build/static/js/{5059.963d527c.chunk.js → 5059.af256250.chunk.js} +1 -1
- package/build/static/js/{5526.09906842.chunk.js → 5526.1aec6323.chunk.js} +2 -2
- package/build/static/js/{5672.c3cf88bf.chunk.js → 5672.12d96543.chunk.js} +1 -1
- package/build/static/js/5748.12e93155.chunk.js +1 -0
- package/build/static/js/5979.a7c1a387.chunk.js +1 -0
- package/build/static/js/{6230.a542a601.chunk.js → 6230.4c0db690.chunk.js} +1 -1
- package/build/static/js/6471.cc995637.chunk.js +1 -0
- package/build/static/js/6511.94eda291.chunk.js +1 -0
- package/build/static/js/670.cc95cf88.chunk.js +1 -0
- package/build/static/js/{6743.fc32eb89.chunk.js → 6743.f19f7583.chunk.js} +2 -2
- package/build/static/js/6906.244f97fe.chunk.js +1 -0
- package/build/static/js/{6931.fa818149.chunk.js → 6931.3b4c19d0.chunk.js} +1 -1
- package/build/static/js/6944.d847d48d.chunk.js +1 -0
- package/build/static/js/{7022.76c60285.chunk.js → 7022.7b668dae.chunk.js} +1 -1
- package/build/static/js/7534.58ee2840.chunk.js +1 -0
- package/build/static/js/8170.38d0b64e.chunk.js +1 -0
- package/build/static/js/{8219.bc63e11b.chunk.js → 8219.0110ce93.chunk.js} +1 -1
- package/build/static/js/8427.b510fa70.chunk.js +2 -0
- package/build/static/js/8590.f59207df.chunk.js +1 -0
- package/build/static/js/9041.62504f43.chunk.js +1 -0
- package/build/static/js/{2677.491ccc30.chunk.js → 9237.82494039.chunk.js} +2 -2
- package/build/static/js/9552.d10aac40.chunk.js +1 -0
- package/build/static/js/9586.efb66311.chunk.js +1 -0
- package/build/static/js/main.914d9380.js +2 -0
- package/build/static/js/{main.20a607fe.js.LICENSE.txt → main.914d9380.js.LICENSE.txt} +8 -5
- package/package.json +1 -1
- package/build/static/js/1059.446f653a.chunk.js +0 -1
- package/build/static/js/1575.9889e444.chunk.js +0 -1
- package/build/static/js/1846.8091d9b8.chunk.js +0 -1
- package/build/static/js/2019.c4e134a4.chunk.js +0 -1
- package/build/static/js/233.5cf94cae.chunk.js +0 -1
- package/build/static/js/2365.a3571172.chunk.js +0 -1
- package/build/static/js/2611.4eb6822b.chunk.js +0 -1
- package/build/static/js/3217.ca7a654b.chunk.js +0 -1
- package/build/static/js/3803.a22da8fb.chunk.js +0 -1
- package/build/static/js/3930.5079b881.chunk.js +0 -1
- package/build/static/js/4423.fc17ebc1.chunk.js +0 -1
- package/build/static/js/4465.88a081e5.chunk.js +0 -1
- package/build/static/js/4906.0bf02a4f.chunk.js +0 -1
- package/build/static/js/5748.d017d106.chunk.js +0 -1
- package/build/static/js/5979.73ce82e4.chunk.js +0 -1
- package/build/static/js/6511.6b799f59.chunk.js +0 -1
- package/build/static/js/670.6c2a6ee0.chunk.js +0 -1
- package/build/static/js/6906.6c830eaf.chunk.js +0 -1
- package/build/static/js/6944.ac06ea4a.chunk.js +0 -1
- package/build/static/js/7534.ea3b613f.chunk.js +0 -1
- package/build/static/js/8170.4ad15204.chunk.js +0 -1
- package/build/static/js/8427.9d00acc3.chunk.js +0 -2
- package/build/static/js/8590.f6c87639.chunk.js +0 -1
- package/build/static/js/9041.a5b13c5d.chunk.js +0 -1
- package/build/static/js/9552.be5312c3.chunk.js +0 -1
- package/build/static/js/9586.e21d0d28.chunk.js +0 -1
- package/build/static/js/main.20a607fe.js +0 -2
- /package/build/static/css/{2677.bceba133.chunk.css → 9237.bceba133.chunk.css} +0 -0
- /package/build/static/js/{5526.09906842.chunk.js.LICENSE.txt → 5526.1aec6323.chunk.js.LICENSE.txt} +0 -0
- /package/build/static/js/{6743.fc32eb89.chunk.js.LICENSE.txt → 6743.f19f7583.chunk.js.LICENSE.txt} +0 -0
- /package/build/static/js/{8427.9d00acc3.chunk.js.LICENSE.txt → 8427.b510fa70.chunk.js.LICENSE.txt} +0 -0
- /package/build/static/js/{2677.491ccc30.chunk.js.LICENSE.txt → 9237.82494039.chunk.js.LICENSE.txt} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(self.webpackChunk_abtnode_webapp=self.webpackChunk_abtnode_webapp||[]).push([[5979],{75979:(e,t,s)=>{s.r(t),s.d(t,{default:()=>Je});var n,a,r=s(71171),i=s(5057),o=s(55898),l=s.n(o),c=s(33518),d=s(44919),m=s(39948),p=s(86229),u=s(68420),h=s(28726),f=s(17682),x=s(44846),j=s(24558),g=s(18067),y=s(18945),Z=s(15715),v=s(58238),C=s(17425),b=s(46090),S=s(63406),P=s(82638),w=s(18901),k=s(25842),D=s.n(k),N=s(13128),T=s(67680),I=s(26174),z=s(88092),A=s(78150),F=s(70461),R=s(99607),_=s.n(R),W=s(55372),E=s(11750),L=s(47020),B=s(88574),q=s(96266);function O(e){let{teamDid:t,onCancel:s,onSuccess:n,onError:a,mode:r,item:o}=e;const{api:l}=(0,v.h6)(),[c,d]=(0,i.useState)(!1),[m,p]=(0,i.useState)(""),{t:f}=(0,u.PE)(),[j,g]=(0,i.useState)(o.title||""),[y,Z]=(0,i.useState)(o.description||""),C=(0,q.jsxs)("div",{children:["update"===r&&(0,q.jsx)(E.Z,{component:"div",style:{paddingTop:24},children:(0,q.jsx)(L.Z,{label:"ID",autoComplete:"off",variant:"outlined",name:"url","data-cy":"mutate-role-input-name",fullWidth:!0,autoFocus:!0,value:o.name,disabled:!0})}),(0,q.jsx)(E.Z,{component:"div",style:{marginTop:24},children:(0,q.jsx)(L.Z,{label:f("common.title"),autoComplete:"off",variant:"outlined",name:"title","data-cy":"mutate-role-input-title",fullWidth:!0,autoFocus:!0,value:j,onChange:e=>{p(null),g(e.target.value)},disabled:"update"===r||c,helperText:f("team.passport.create.titleTip")})}),(0,q.jsx)(E.Z,{component:"div",style:{marginTop:24,marginBottom:24},children:(0,q.jsx)(L.Z,{label:f("common.description"),autoComplete:"off",variant:"outlined",name:"description","data-cy":"mutate-role-input-description",fullWidth:!0,autoFocus:!0,value:y,onChange:e=>{p(null),Z(e.target.value)},disabled:c,multiline:!0,rows:3})})]});return(0,q.jsxs)(N.ZP,{title:"create"===r?f("team.passport.create.title"):"",fullWidth:!0,open:!0,onClose:s,showCloseButton:!1,actions:(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(h.Z,{onClick:s,color:"inherit",children:f("common.cancel")}),(0,q.jsxs)(h.Z,{"data-cy":"mutate-role-confirm",onClick:async()=>{const e=j.trim();if(!e)return void p(f("team.passport.error.titleEmpty"));if(e.length>64)return void p(f("team.passport.error.titleTooLong",{length:64}));const s=y.replace(/\n/g," ");if(!s)return void p(f("team.passport.error.descriptionEmpty"));const i="create"===r?_()(e):o.name;p(null),d(!0);try{"create"===r?await l.createRole({input:{teamDid:t,name:i,title:e,description:s}}):await l.updateRole({input:{teamDid:t,role:{name:i,title:e,description:s}}}),n()}catch(c){const e=(0,b.Z)(c);p(e),a(c)}finally{d(!1)}},color:"primary",disabled:c,variant:"contained",autoFocus:!0,children:[c&&(0,q.jsx)(x.Z,{size:16}),f("create"===r?"common.create":"common.update")]})]}),children:[(0,q.jsx)(W.Z,{component:"div",children:C}),!!m&&(0,q.jsx)(B.Z,{type:"error",variant:"icon",style:{width:"100%",margin:0},children:m})]})}function M(e){let{onCancel:t,onSuccess:s,onDelete:n,roleName:a,hasPermission:r}=e;const{api:o}=(0,v.h6)(),{roles:l,permissions:c,teamDid:d,refresh:m,isNodeTeam:f}=(0,C.DJ)(),{t:g}=(0,u.PE)(),[y,Z]=(0,i.useState)([]),[S,P]=(0,i.useState)(!1),[w,k]=(0,i.useState)(null),[R,_]=(0,i.useState)(!1),W=D()(l.find((e=>e.name===a))),E=(0,b.vd)(a);(0,i.useEffect)((()=>{d&&a&&(async(e,t)=>{const s=(await o.getPermissionsByRole({input:{teamDid:e,role:{name:t}}})).permissions||[],n=c.map((e=>({...e,bind:s.some((t=>t.name===e.name))})));Z(n)})(d,a)}),[d,a]);const L=f||!r;let B=null;return f&&(B=(0,q.jsxs)("div",{className:"bind",children:[(0,q.jsx)("div",{className:"title",children:g("common.permission")}),(0,q.jsx)("div",{className:"list",children:y.filter((e=>!L||e.bind)).map((e=>(0,q.jsx)("div",{className:"item",children:(0,q.jsx)(I.Z,{control:(0,q.jsx)(z.Z,{disabled:L,checked:e.bind,onChange:()=>{Z((t=>t.map((t=>(t.name===e.name&&(t.bind=!t.bind),t)))))},name:e.name}),label:e.description})})))})]})),(0,q.jsxs)(N.ZP,{title:g("common.passport"),onClose:t,open:!0,fullWidth:!0,toolbar:r&&!E&&(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(T.Z,{onClick:()=>P(W),"data-cy":"edit-passport-".concat(W.name),size:"large",children:(0,q.jsx)(j.Z,{fill:"#bfbfbf"})}),(0,q.jsx)(T.Z,{onClick:()=>k({title:g("team.passport.delete.title"),description:g("team.passport.delete.description",{name:W.title}),confirm:g("common.delConfirm"),cancel:g("common.cancel"),onConfirm:()=>{(async e=>{if(!R)try{_(!0),await o.deleteRole({input:{teamDid:d,name:e}}),n()}catch(t){p.Z.error(t.message)}finally{_(!1),k(null)}})(W.name)},onCancel:()=>{_(!1),k(null)}}),"data-cy":"delete-passport-".concat(W.name),size:"large",children:(0,q.jsx)(A.Z,{"data-cy":"close-passport-dialog",fill:"#bfbfbf"})})]}),actions:f&&!L&&(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(h.Z,{onClick:t,color:"inherit",children:g("common.cancel")}),(0,q.jsxs)(h.Z,{onClick:async()=>{_(!0);const e=y.filter((e=>e.bind)).map((e=>e.name));try{await o.updatePermissionsForRole({input:{teamDid:d,roleName:W.name,grantNames:e}}),p.Z.success(g("common.saveSuccess")),s()}catch(t){p.Z.error((0,b.Z)(t))}finally{_(!1)}},color:"primary",disabled:R||!W,variant:"contained",autoFocus:!0,"data-cy":"bind-permission-btn-confirm",children:[R&&(0,q.jsx)(x.Z,{size:16}),g("common.save")]})]}),children:[(0,q.jsxs)(J,{children:[!W&&(0,q.jsx)(K,{children:(0,q.jsx)(x.Z,{})}),W&&(0,q.jsxs)("div",{className:"dialog-content",children:[(0,q.jsxs)("div",{className:"header",children:[(0,q.jsx)("div",{className:"title",children:W.title}),(0,q.jsx)("div",{className:"description",style:{marginTop:f?16:48},children:W.description})]}),B]})]}),S&&(0,q.jsx)(O,{teamDid:d,onCancel:()=>P(null),onSuccess:()=>{P(null),m()},mode:"update",roleName:S.name,item:S}),w&&(0,q.jsx)(F.Z,{title:w.title,description:w.description,confirm:w.confirm,cancel:w.cancel,params:w.params,onConfirm:w.onConfirm,onCancel:w.onCancel})]})}O.propTypes={teamDid:l().string.isRequired,onCancel:l().func.isRequired,onSuccess:l().func.isRequired,onError:l().func,mode:l().oneOf(["create","update"]),item:l().object},O.defaultProps={onError:()=>{},mode:"create",item:{}};const V=(0,S.V)(M,"mutate_team"),H=(0,S.V)(M,"",b.Wf);function G(e){const{inService:t}=(0,v.h6)();return t?(0,q.jsx)(H,{...e}):(0,q.jsx)(V,{...e})}M.propTypes={roleName:l().string.isRequired,onCancel:l().func.isRequired,onSuccess:l().func.isRequired,onDelete:l().func.isRequired,hasPermission:l().bool},M.defaultProps={hasPermission:!1};const J=c.Z.div(n||(n=(0,r.Z)(["\n .header {\n .title {\n font-weight: 400;\n font-size: 24px;\n line-height: 28px;\n color: #222222;\n }\n\n .description {\n margin-top: 16px;\n font-weight: 400;\n font-size: 16px;\n line-height: 19px;\n color: #999999;\n }\n }\n\n .bind {\n margin-top: 24px;\n .title {\n font-weight: 400;\n font-size: 16px;\n line-height: 19px;\n color: #666666;\n margin-bottom: 24px;\n }\n .item {\n margin-top: 24px;\n }\n\n .MuiFormControlLabel-label {\n font-weight: 400;\n font-size: 16px;\n line-height: 19px;\n color: #666;\n }\n\n .PrivateSwitchBase-root-45 {\n padding: 0;\n padding-right: 12px;\n }\n }\n"]))),K=c.Z.div(a||(a=(0,r.Z)(["\n flex: 1;\n display: flex;\n justify-content: center;\n align-items: center;\n height: 200px;\n"])));var Y=s(67486),U=s(49777),Q=s.n(U),X=s(38242),$=s(76818),ee=s(77277),te=s(29054);function se(e){let{onCancel:t,onSuccess:s}=e;const{api:n}=(0,v.h6)(),{blocklet:a}=(0,te.y0)(),{t:r}=(0,u.PE)(),[o,l]=(0,i.useState)(!1),c=(a.environments.find((e=>"BLOCKLET_PASSPORT_COLOR"===e.key))||{}).value||"auto",d="auto"===c?(0,$.getPassportColorFromDid)(a.appDid):c,[f,j]=(0,i.useState)(d);return(0,q.jsx)(N.ZP,{title:r("team.passport.color"),onClose:t,open:!0,fullWidth:!0,actions:(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(h.Z,{onClick:t,color:"inherit",children:r("common.cancel")}),(0,q.jsxs)(h.Z,{onClick:async()=>{const e=[{key:ee.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_PASSPORT_COLOR,value:f}];try{l(!0),await n.configBlocklet({input:{did:a.meta.did,configs:e}}),s()}catch(t){p.Z.error(t.message)}finally{l(!1)}},color:"primary",disabled:o,variant:"contained",autoFocus:!0,"data-cy":"color-btn-confirm",children:[o&&(0,q.jsx)(x.Z,{size:16}),r("common.save")]})]}),children:(0,q.jsxs)(m.Z,{display:"flex",justifyContent:"center",alignItems:"center",className:"dialog-content",children:[(0,q.jsx)(Y.AI,{color:f,onChange:e=>j(e.hex)}),(0,q.jsx)("div",{style:{width:220,marginLeft:24},dangerouslySetInnerHTML:{__html:Q()({title:"Owner",issuer:(0,X.getDisplayName)(a),issuerDid:a.appDid,ownerName:"Your Name",ownerDid:a.appDid,preferredColor:f})}})]})})}const ne=(0,S.V)(se,"mutate_team"),ae=(0,S.V)(se,"",b.Wf);function re(e){const{inService:t}=(0,v.h6)();return t?(0,q.jsx)(ae,{...e}):(0,q.jsx)(ne,{...e})}se.propTypes={onCancel:l().func.isRequired,onSuccess:l().func.isRequired},se.defaultProps={};var ie,oe=s(25710),le=s(17450),ce=s(76007),de=s(74490),me=s(35432),pe=function(e){return(0,q.jsx)("svg",{...e,children:(0,q.jsx)("path",{d:"M64.707 8.707a1 1 0 0 0 0-1.414L58.343.929a1 1 0 1 0-1.414 1.414L62.586 8l-5.657 5.657a1 1 0 0 0 1.414 1.414l6.364-6.364ZM0 9h64V7H0v2Z",fill:"#666"})})};pe.defaultProps={width:"65",height:"16",fill:"none",xmlns:"http://www.w3.org/2000/svg"};const ue=(e,t)=>!!e&&!t.some((e=>!e.from.passport||!e.to.role));function he(e){let{onCancel:t,onSuccess:s,data:n,trustedPassports:a}=e;const{api:r}=(0,v.h6)(),{roles:o,teamDid:l}=(0,C.DJ)(),{t:c}=(0,u.PE)(),[d,f]=(0,i.useState)(!1),[j,g]=(0,i.useState)(n.issuerDid||""),[y,Z]=(0,i.useState)(n.remark||""),[S,P]=(0,i.useState)(D()(n.mappings)||[]),w=a.findIndex((e=>e.issuerDid===n.issuerDid));return(0,q.jsx)(N.ZP,{title:c("team.passport.trustedIssuers"),open:!0,showCloseButton:!1,PaperProps:{style:{minHeight:"80vh"}},fullWidth:!0,prepend:(0,q.jsx)(T.Z,{onClick:t,"data-cy":"trusted-issuer-close",size:"large",children:(0,q.jsx)(ce.Z,{})}),actions:(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(h.Z,{onClick:t,color:"inherit",children:c("common.cancel")}),(0,q.jsxs)(h.Z,{onClick:()=>(async()=>{if(d)return;const e={issuerDid:j,remark:y,mappings:S},t=[...a];-1===w?t.unshift(e):t[w]=e;try{f(!0),await r.configTrustedPassports({input:{teamDid:l,trustedPassports:t}}),await(0,b._v)(800),f(!1),p.Z.success(c("common.saveSuccess")),s()}catch(n){f(!1),p.Z.error((0,b.Z)(n))}})(),color:"primary",disabled:!ue(j,S)||!y||d,variant:"contained",autoFocus:!0,"data-cy":"save-mapping",children:[d&&(0,q.jsx)(x.Z,{size:16}),c("common.save")]})]}),children:(0,q.jsx)(fe,{children:(0,q.jsxs)("div",{className:"dialog-content",children:[(0,q.jsx)(L.Z,{fullWidth:!0,"data-cy":"input-issuer-did",placeholder:c("team.passport.issuerDid"),value:j,onChange:e=>{g(e.target.value)}}),(0,q.jsx)(L.Z,{style:{marginTop:16},fullWidth:!0,"data-cy":"input-issuer-remark",placeholder:c("common.remark"),value:y,onChange:e=>{Z(e.target.value)}}),(0,q.jsxs)(m.Z,{mt:"30px",display:"flex",justifyContent:"space-between",alignItems:"center",children:[(0,q.jsx)(m.Z,{className:"dialog-h1",children:c("team.passport.mappingRule")}),(0,q.jsx)(m.Z,{children:(0,q.jsx)(h.Z,{variant:"outlined",color:"primary","data-cy":"add-mapping",onClick:()=>{P((e=>{const t=[...e];return t.unshift({from:{passport:""},to:{role:me.ROLES.GUEST}}),t}))},children:c("team.add")})})]}),(0,q.jsxs)(m.Z,{className:"list",mt:-.5,children:[S.map(((e,t)=>(0,q.jsxs)(m.Z,{display:"flex",alignItems:"center",justifyContent:"space-between",my:3,children:[(0,q.jsxs)(m.Z,{display:"flex",alignItems:"center",flexGrow:1,children:[(0,q.jsx)(m.Z,{flexGrow:1,flexBasis:1,children:(0,q.jsx)(L.Z,{fullWidth:!0,size:"small","data-cy":"input-".concat(t,"-from"),placeholder:"Issuer\u2019s Passport Name/ID",value:e.from.passport,onChange:e=>{const{value:s}=e.target;P((e=>{const n=[...e];return n[t].from.passport=s,n}))}})}),(0,q.jsx)(m.Z,{flexShrink:0,mx:4,children:(0,q.jsx)(pe,{})}),(0,q.jsx)(m.Z,{flexGrow:1,flexBasis:1,children:(0,q.jsx)(L.Z,{fullWidth:!0,size:"small",select:!0,value:e.to.role,onChange:e=>{P((s=>{const n=[...s];return n[t].to.role=e.target.value,n}))},variant:"outlined",children:o.filter((e=>"owner"!==e.name)).map((e=>(0,q.jsx)(de.Z,{value:e.name,"data-cy":"passport-mapping-select-option-".concat(e.name),children:(0,q.jsx)("span",{children:e.title||e.name})},e.name)))})})]}),(0,q.jsx)(m.Z,{flexShrink:0,ml:4,children:(0,q.jsx)(T.Z,{onClick:()=>{P((e=>{const s=[...e];return s.splice(t,1),s}))},size:"large",children:(0,q.jsx)(A.Z,{})})})]},"mapping-".concat(t)))),!S.length&&(0,q.jsx)(m.Z,{my:2,color:"text.secondary",fontSize:"16px",children:(0,q.jsx)(oe.Z,{children:c("common.empty")})})]})]})})})}he.propTypes={onCancel:l().func.isRequired,onSuccess:l().func.isRequired,trustedPassports:l().array,data:l().object},he.defaultProps={data:{},trustedPassports:[]};const fe=c.Z.div(ie||(ie=(0,r.Z)(["\n .dialog-h1 {\n font-size: 18px;\n }\n\n .list {\n .MuiIconButton-root {\n svg {\n fill: #bfbfbf;\n }\n }\n }\n"])));var xe;function je(e){let{onCancel:t,hasPermission:s}=e;const{api:n}=(0,v.h6)(),{teamDid:a,trustedPassports:r}=(0,C.DJ)(),{t:o}=(0,u.PE)(),[l,c]=(0,i.useState)(null),[f,x]=(0,i.useState)(!1),[g,y]=(0,i.useState)(!1),[Z,S]=(0,i.useState)(""),k=r.filter((e=>!Z||e.issuerDid.toLowerCase().includes(Z.toLowerCase())));return(0,q.jsxs)(N.ZP,{title:o("team.passport.trustedIssuers"),open:!0,onClose:t,fullWidth:!0,PaperProps:{style:{minHeight:"80vh"}},children:[(0,q.jsx)(ve,{children:(0,q.jsxs)("div",{className:"dialog-content",children:[(0,q.jsx)("div",{className:"dialog-h1",children:o("team.passport.trustedPassportIssuers")}),(0,q.jsxs)(m.Z,{component:w.Z,mt:3,children:[(0,q.jsx)("div",{className:"left",children:(0,q.jsx)(P.Z,{placeholder:o("team.passport.searchIssuerDid"),value:Z,onChange:e=>S(e.target.value)})}),(0,q.jsx)("div",{className:"right",children:s&&(0,q.jsxs)(h.Z,{variant:"contained",color:"primary","data-cy":"add-trusted-issuer",onClick:()=>y({mode:"add"}),children:[(0,q.jsx)(d.Z,{style:{fontSize:16,marginRight:4}}),o("team.add")]})})]}),(0,q.jsxs)("div",{className:"list",children:[k.map((e=>(0,q.jsxs)(m.Z,{display:"flex",alignItems:"center",justifyContent:"space-between",mt:"20px",children:[(0,q.jsxs)(m.Z,{flexShrink:0,children:[(0,q.jsx)(le.Z,{copyable:!1,size:16,did:e.issuerDid,showDidLogo:!1}),!!e.remark&&(0,q.jsx)(m.Z,{pl:3.5,fontSize:12,maxWidth:"300px",children:e.remark})]}),(0,q.jsx)(m.Z,{color:"gray",ml:"28px",flexGrow:1,children:e.mappings&&e.mappings.length?"".concat(e.mappings.length," ").concat(o("team.passport.mappingRule")):o("team.passport.defaultRule")}),(0,q.jsxs)(m.Z,{flexShrink:0,display:"flex",alignItems:"center",children:[(0,q.jsx)(T.Z,{onClick:()=>y({mode:"update",data:D()(e)}),"data-cy":"edit-mapping-rule",size:"large",children:(0,q.jsx)(j.Z,{})}),(0,q.jsx)(T.Z,{"data-cy":"delete-mapping-rule",onClick:()=>c({title:o("common.delete"),description:o("common.delConfirmDescription",{data:e.issuerDid}),confirm:o("common.delConfirm"),cancel:o("common.cancel"),onConfirm:()=>(async e=>{if(f)return;const t=r.findIndex((t=>t.issuerDid===e));-1===t&&p.Z.error("Cannot find passports");const s=[...r];s.splice(t,1);try{x(!0),await n.configTrustedPassports({input:{teamDid:a,trustedPassports:s}}),await(0,b._v)(800),x(!1),p.Z.success(o("common.saveSuccess")),c(!1)}catch(i){x(!1),p.Z.error(i.message)}})(e.issuerDid),onCancel:()=>{x(!1),c(null)}}),size:"large",children:(0,q.jsx)(A.Z,{})})]})]},e.issuerDid))),!r.length&&(0,q.jsx)(oe.Z,{children:o("common.empty")})]})]})}),g&&(0,q.jsx)(he,{mode:g.mode,data:g.data,trustedPassports:D()(r),onCancel:()=>y(null),onSuccess:()=>{y(null)}}),l&&(0,q.jsx)(F.Z,{title:l.title,description:l.description,confirm:l.confirm,cancel:l.cancel,params:l.params,onConfirm:l.onConfirm,onCancel:l.onCancel})]})}je.propTypes={onCancel:l().func.isRequired,hasPermission:l().bool},je.defaultProps={hasPermission:!1};const ge=(0,S.V)(je,"mutate_team"),ye=(0,S.V)(je,"",b.Wf);function Ze(e){const{inService:t}=(0,v.h6)();return t?(0,q.jsx)(ye,{...e}):(0,q.jsx)(ge,{...e})}const ve=c.Z.div(xe||(xe=(0,r.Z)(["\n .list {\n .MuiIconButton-root {\n svg {\n fill: #bfbfbf;\n }\n }\n }\n"])));var Ce=s(19778),be=s(67313),Se=s.n(be),Pe=s(61111),we=s(75239),ke=s(6041),De=s(12594),Ne=s(90067),Te=s(53070),Ie=s(55222),ze=s(28768),Ae=s(31853),Fe=s(24411),Re=s.n(Fe);const _e={};var We;function Ee(e){var t,s,n;let{onCancel:a,onSuccess:r,data:o,trustedFactories:l}=e;const{api:c}=(0,v.h6)(),{roles:d,teamDid:m}=(0,C.DJ)(),{t:f}=(0,u.PE)(),[j,g]=(0,Ae.Z)({loading:!1,fetching:!1,fetched:[],errored:[],factoryAddress:o.factoryAddress||"",remark:o.remark||"",role:(null===(t=o.passport)||void 0===t?void 0:t.role)||"member",ttlPolicy:(null===(s=o.passport)||void 0===s?void 0:s.ttlPolicy)||"never",ttl:Se()(+(null===(n=o.passport)||void 0===n?void 0:n.ttl)||31536e6),error:""}),y=l.findIndex((e=>e.factoryAddress===o.factoryAddress));(0,i.useEffect)((()=>{const e=j.fetched.find((e=>e.address===j.factoryAddress)),t=j.errored.find((e=>e.address===j.factoryAddress));if((0,Pe.isValid)(j.factoryAddress)&&!j.fetching&&!e&&!t){g({fetching:!0});(function(e){if(!e)return null;if(_e[e])return _e[e];const t=new(Re())(e);return _e[e]=t,t})(me.MAIN_CHAIN_ENDPOINT).getFactoryState({address:j.factoryAddress}).then((e=>{e.state?g({fetching:!1,fetched:[...j.fetched.filter((e=>e.address!==j.factoryAddress)),e.state],remark:e.state.name}):g({fetching:!1,errored:[...j.errored.filter((e=>e.address!==j.factoryAddress)),{address:j.factoryAddress}],error:f("team.passport.factory404",j)})})).catch((e=>{console.error(e),g({fetching:!1,error:(0,b.Z)(e)})}))}}),[j.factoryAddress,j.fetching]);let Z=j.error;const S=j.factoryAddress?j.errored.find((e=>e.address===j.factoryAddress)):null;!Z&&S&&(Z=f("team.passport.factory404",j));const P=j.factoryAddress?j.fetched.find((e=>e.address===j.factoryAddress)):null;return!Z&&P&&(Z=P.description),Z||(Z=f("team.passport.factoryAddressTip")),(0,q.jsx)(N.ZP,{title:f("team.passport.trustedFactories"),open:!0,showCloseButton:!1,PaperProps:{style:{minHeight:"80vh"}},fullWidth:!0,prepend:(0,q.jsx)(T.Z,{onClick:a,"data-cy":"close-trusted-factory",size:"large",children:(0,q.jsx)(ce.Z,{})}),actions:(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(h.Z,{onClick:a,color:"inherit",children:f("common.cancel")}),(0,q.jsxs)(h.Z,{onClick:()=>(async()=>{if(j.loading)return;const{factoryAddress:e,remark:t,role:s,ttlPolicy:n,ttl:a}=j,i={factoryAddress:e,remark:t,passport:{role:s,ttlPolicy:n,ttl:"never"===n?0:Se()(a)}},o=[...l];-1===y?o.unshift(i):o[y]=i;try{g({loading:!0}),await c.configTrustedFactories({input:{teamDid:m,trustedFactories:o}}),await(0,b._v)(800),p.Z.success(f("common.saveSuccess")),r()}catch(d){console.error(d),p.Z.error((0,b.Z)(d))}finally{g({loading:!1})}})(),color:"primary",disabled:!j.factoryAddress||!j.remark||!j.role||j.loading||j.error||S,variant:"contained",autoFocus:!0,"data-cy":"save-trusted-factory",children:[j.loading&&(0,q.jsx)(x.Z,{size:16}),f("common.save")]})]}),children:(0,q.jsx)(Le,{children:(0,q.jsxs)("div",{className:"dialog-content",children:[(0,q.jsx)(L.Z,{fullWidth:!0,error:!!j.error||!!S,"data-cy":"input-factory-address",label:f("team.passport.factoryAddress"),helperText:Z,value:j.factoryAddress,InputProps:{endAdornment:j.fetching?(0,q.jsx)(Te.Z,{position:"end",children:(0,q.jsx)(x.Z,{size:16})}):null},onChange:e=>{g({factoryAddress:e.target.value,error:""})}}),(0,q.jsx)(L.Z,{style:{marginTop:32},fullWidth:!0,"data-cy":"input-factory-remark",label:f("common.remark"),value:j.remark,onChange:e=>{g({remark:e.target.value})}}),(0,q.jsx)(L.Z,{style:{marginTop:32},fullWidth:!0,"data-cy":"input-passport-role",label:f("team.passport.role"),select:!0,value:j.role,onChange:e=>{g({role:e.target.value})},variant:"outlined",children:d.filter((e=>"owner"!==e.name)).map((e=>(0,q.jsx)(de.Z,{value:e.name,"data-cy":"passport-role-select-option-".concat(e.name),children:(0,q.jsx)("span",{children:e.title||e.name})},e.name)))}),(0,q.jsxs)("div",{style:{marginTop:32},children:[(0,q.jsx)(ke.Z,{children:f("team.passport.ttl")}),(0,q.jsxs)(ze.Z,{color:"primary",size:"small",value:j.ttlPolicy,exclusive:!0,style:{marginTop:16},onChange:(e,t)=>g({ttlPolicy:t}),"data-cy":"input-passport-ttl-since","aria-label":"Expire Policy",children:[(0,q.jsx)(Ie.Z,{value:"never","data-cy":"input-passport-ttl-never",children:(0,q.jsx)(we.Z,{title:f("team.passport.ttlNeverTip"),children:(0,q.jsx)(E.Z,{children:f("team.passport.ttlNever")})})}),(0,q.jsx)(Ie.Z,{value:"mint","data-cy":"input-passport-ttl-mint",children:(0,q.jsx)(we.Z,{title:f("team.passport.ttlMintTip"),children:(0,q.jsx)(E.Z,{children:f("team.passport.ttlMint")})})}),(0,q.jsx)(Ie.Z,{value:"exchange","data-cy":"input-passport-ttl-exchange",children:(0,q.jsx)(we.Z,{title:f("team.passport.ttlExchangeTip"),children:(0,q.jsx)(E.Z,{children:f("team.passport.ttlExchange")})})})]}),"never"!==j.ttlPolicy&&(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(De.Z,{fullWidth:!0,type:"text",style:{marginTop:16},"data-cy":"input-passport-ttl",value:j.ttl,onChange:e=>{g({ttl:e.target.value})}}),(0,q.jsx)(Ne.Z,{children:f("team.passport.ttlTip")})]})]})]})})})}Ee.propTypes={onCancel:l().func.isRequired,onSuccess:l().func.isRequired,trustedFactories:l().array,data:l().object},Ee.defaultProps={data:{},trustedFactories:[]};const Le=c.Z.div(We||(We=(0,r.Z)(["\n .dialog-h1 {\n font-size: 18px;\n }\n\n .list {\n .MuiIconButton-root {\n svg {\n fill: #bfbfbf;\n }\n }\n }\n"])));var Be;function qe(e){let{onCancel:t,hasPermission:s}=e;const{api:n}=(0,v.h6)(),{teamDid:a,trustedFactories:r}=(0,C.DJ)(),{t:o}=(0,u.PE)(),[l,c]=(0,i.useState)(null),[f,x]=(0,i.useState)(!1),[g,y]=(0,i.useState)(null),[Z,S]=(0,i.useState)(""),k=r.filter((e=>!Z||e.factoryAddress.toLowerCase().includes(Z.toLowerCase())));return(0,q.jsxs)(N.ZP,{title:o("team.passport.trustedFactories"),open:!0,onClose:t,fullWidth:!0,PaperProps:{style:{minHeight:"80vh"}},children:[(0,q.jsx)(He,{children:(0,q.jsxs)("div",{className:"dialog-content",children:[(0,q.jsx)("div",{className:"dialog-h1",children:o("team.passport.trustedFactoriesTip")}),(0,q.jsxs)(m.Z,{component:w.Z,mt:3,children:[(0,q.jsx)("div",{className:"left",children:(0,q.jsx)(P.Z,{placeholder:o("team.passport.searchFactoryAddress"),value:Z,onChange:e=>S(e.target.value)})}),(0,q.jsx)("div",{className:"right",children:s&&(0,q.jsxs)(h.Z,{variant:"contained",color:"primary",size:"small","data-cy":"add-trusted-factory",onClick:()=>y({mode:"add"}),children:[(0,q.jsx)(d.Z,{style:{fontSize:16,marginRight:4}}),o("team.add")]})})]}),(0,q.jsxs)("div",{className:"list",children:[k.map((e=>(0,q.jsxs)(m.Z,{display:"flex",alignItems:"center",justifyContent:"space-between",mt:"20px",children:[(0,q.jsxs)(m.Z,{flexGrow:1,children:[(0,q.jsx)(le.Z,{copyable:!1,did:e.factoryAddress,size:16,showDidLogo:!1}),!!e.remark&&(0,q.jsx)(m.Z,{fontSize:12,maxWidth:"300px",children:e.remark})]}),(0,q.jsx)(m.Z,{color:"gray",mr:"24px",children:(0,q.jsx)(Ce.Z,{type:"success",children:e.passport.role})}),(0,q.jsxs)(m.Z,{flexShrink:0,display:"flex",alignItems:"center",children:[(0,q.jsx)(T.Z,{onClick:()=>y({mode:"update",data:D()(e)}),"data-cy":"edit-trusted-factory",size:"large",children:(0,q.jsx)(j.Z,{})}),(0,q.jsx)(T.Z,{"data-cy":"delete-trusted-factory",onClick:()=>c({title:o("common.delete"),description:o("common.delConfirmDescription",{data:e.factoryAddress}),confirm:o("common.delConfirm"),cancel:o("common.cancel"),onConfirm:()=>(async e=>{if(!f)try{x(!0),await n.configTrustedFactories({input:{teamDid:a,trustedFactories:r.filter((t=>t.factoryAddress!==e))}}),await(0,b._v)(800),x(!1),p.Z.success(o("common.saveSuccess")),c(null)}catch(t){x(!1),p.Z.error(t.message)}})(e.factoryAddress),onCancel:()=>{x(!1),c(null)}}),size:"large",children:(0,q.jsx)(A.Z,{})})]})]},e.factoryAddress))),!r.length&&(0,q.jsx)(oe.Z,{children:o("common.empty")})]})]})}),g&&(0,q.jsx)(Ee,{data:g.data,trustedFactories:D()(r),onCancel:()=>y(null),onSuccess:()=>{y(null)}}),l&&(0,q.jsx)(F.Z,{title:l.title,description:l.description,confirm:l.confirm,cancel:l.cancel,params:l.params,onConfirm:l.onConfirm,onCancel:l.onCancel})]})}qe.propTypes={onCancel:l().func.isRequired,hasPermission:l().bool},qe.defaultProps={hasPermission:!1};const Oe=(0,S.V)(qe,"mutate_team"),Me=(0,S.V)(qe,"",b.Wf);function Ve(e){const{inService:t}=(0,v.h6)();return t?(0,q.jsx)(Me,{...e}):(0,q.jsx)(Oe,{...e})}const He=c.Z.div(Be||(Be=(0,r.Z)(["\n .list {\n .MuiIconButton-root {\n svg {\n fill: #bfbfbf;\n }\n }\n }\n"])));var Ge;function Je(e){let{createPassportSvg:t}=e;const{t:s}=(0,i.useContext)(u.RD),{api:n,inService:a}=(0,v.h6)(),{roles:r,teamDid:o,teamIssuerDid:l,teamName:c,refresh:k,enablePassportIssuance:D,passportColor:N,isNodeTeam:T}=(0,C.DJ)(),[I,z]=(0,i.useState)(!1),[A,F]=(0,i.useState)(!1),[R,_]=(0,i.useState)(!1),[W,E]=(0,i.useState)(!1),[L,B]=(0,i.useState)(!1),[M,V]=(0,i.useState)(""),[H,J]=(0,i.useState)(!1),K=(0,Z.Z)((e=>e.breakpoints.down("md"))),Y=r.filter((e=>!M||e.title.includes(M)||e.name.includes(M)));return(0,q.jsxs)(Ke,{sx:{mt:a?6:0},children:[(0,q.jsxs)(w.Z,{children:[(0,q.jsx)("div",{className:"left",children:(0,q.jsx)(P.Z,{placeholder:s("team.passport.search"),value:M,onChange:e=>V(e.target.value)})}),(0,q.jsx)("div",{className:"right",children:(0,q.jsxs)(S.Z,{permission:a?"":"mutate_team",role:a?b.Wf:[],children:[(0,q.jsx)(f.Z,{variant:"outlined",menuButtonProps:{"data-cy":"trusted-issuers-more"},menu:(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(f.Z.Item,{onClick:()=>B(!0),"data-cy":"config-show-trusted-factories",children:(0,q.jsxs)(m.Z,{children:[s("team.passport.configFactories"),(0,q.jsx)(m.Z,{fontSize:12,color:"#888",children:s("team.passport.configFactoriesTip")})]})}),(0,q.jsx)(f.Z.Item,{"data-cy":"config-show-issue-passport",onClick:async e=>{if(e.stopPropagation(),!H){J(!0);try{await n.configPassportIssuance({input:{teamDid:o,enable:!D}}),k(),await(0,b._v)(800),p.Z.success(s("common.configSuccess")),J(!1)}catch(t){p.Z.error(t.message),J(!1)}}},children:(0,q.jsxs)(m.Z,{display:"flex",alignItems:"center",children:[H&&(0,q.jsx)(x.Z,{size:16,style:{marginRight:8}}),(0,q.jsxs)(m.Z,{children:[s(D?"team.passport.disableIssuance":"team.passport.enableIssuance"),(0,q.jsx)(m.Z,{fontSize:12,color:"#888",children:s(D?"team.passport.disableIssuanceTip":"team.passport.enableIssuanceTip")})]})]})}),!T&&(0,q.jsx)(f.Z.Item,{onClick:()=>_(!0),"data-cy":"config-passport-color",children:(0,q.jsxs)(m.Z,{children:[s("team.passport.configColor"),(0,q.jsx)(m.Z,{fontSize:12,color:"#888",children:s("team.passport.configColorTip")})]})})]}),children:()=>(0,q.jsxs)(h.Z,{variant:"outlined","data-cy":"config-trusted-issuers",onClick:()=>{E(!0)},children:[(0,q.jsx)(y.Z,{style:{fontSize:16,marginRight:4}}),s("team.passport.trustedPassportIssuers")]})}),!T&&(0,q.jsxs)(h.Z,{style:{marginLeft:16},variant:"contained",edge:"end",color:"primary","data-cy":"create-role",onClick:()=>z(!0),children:[(0,q.jsx)(d.Z,{style:{fontSize:16,marginRight:4}}),s("team.add")]})]})})]}),(0,q.jsx)(m.Z,{mt:3}),(0,q.jsx)(m.Z,{className:"list",children:Y.map((e=>(0,q.jsxs)(m.Z,{"data-cy":"passport-".concat(e.name),sx:{display:"flex",justifyContent:"space-between"},className:"item",display:"flex",alignItems:"center",onClick:()=>F(e),children:[(0,q.jsxs)(m.Z,{display:"flex",alignItems:"center",children:[(0,q.jsx)("div",{style:{width:150},dangerouslySetInnerHTML:{__html:t({title:e.title,issuer:c,issuerDid:l,ownerName:"Your Name",ownerDid:l,preferredColor:N,width:"150px"})}}),(0,q.jsx)(m.Z,{ml:3,className:"title",children:e.title})]}),!K&&(0,q.jsx)(m.Z,{className:"description",children:e.description}),(0,q.jsx)(S.Z,{permission:a?"":"mutate_team",role:a?b.Wf:[],children:(0,q.jsx)("div",{className:"action",children:(0,b.vd)(e.name)?(0,q.jsx)(g.Z,{}):(0,q.jsx)(j.Z,{})})})]},e.name)))}),I&&(0,q.jsx)(O,{teamDid:o,onCancel:()=>z(!1),onSuccess:()=>{z(!1),k()}}),A&&(0,q.jsx)(G,{onCancel:()=>F(!1),onSuccess:()=>{F(!1),k()},onDelete:()=>{F(!1),k()},mode:"update",roleName:A.name,item:A}),W&&(0,q.jsx)(Ze,{onCancel:()=>E(!1)}),L&&(0,q.jsx)(Ve,{onCancel:()=>B(!1)}),R&&(0,q.jsx)(re,{onCancel:()=>_(!1),onSuccess:()=>_(!1)})]})}const Ke=(0,c.Z)(m.Z)(Ge||(Ge=(0,r.Z)(["\n .list {\n .item {\n padding: 12px;\n margin: 12px -12px;\n cursor: pointer;\n transition: box-shadow 0.4s;\n &:hover {\n box-shadow: 0 0 10px 4px rgba(0, 0, 0, 0.1);\n }\n }\n\n .title {\n font-weight: 400;\n font-size: 18px;\n width: 80px;\n line-height: 21px;\n color: #222222;\n }\n\n .description {\n flex: 1;\n margin-left: 64px;\n color: #999999;\n }\n\n .action {\n color: #bfbfbf;\n fill: #bfbfbf;\n }\n }\n"])));Je.propTypes={createPassportSvg:l().func.isRequired},Je.defaultProps={}}}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";(self.webpackChunk_abtnode_webapp=self.webpackChunk_abtnode_webapp||[]).push([[6230],{80378:(e,n,t)=>{t.d(n,{Z:()=>u});var i=t(55898),o=t.n(i),a=t(62681),l=t(72333),r=t(6352),s=t.n(r),c=t(35432),d=t(58238),m=t(14491);var p=t(96266);function u(e){let{blocklet:n,style:t,size:i,ancestors:o,...r}=e;const u=(0,d.h6)(),{logoUrl:f,inService:h}=function(e){var n;let{blocklet:t,ancestors:i=[]}=e;const o=(0,d.h6)(),{inService:a}=o,l="?v=".concat(null===t||void 0===t||null===(n=t.meta)||void 0===n?void 0:n.version).concat((0,m.XN)(null===t||void 0===t?void 0:t.status)?"~":"");let r=a?s()(m.zn,c.WELLKNOWN_SERVICE_PATH_PREFIX,"/blocklet/logo-bundle",l):s()(o.imgPrefix,"blocklet.png");if("registry"===t.source&&t.deployedFrom&&t.meta.logo)r=s()(t.deployedFrom,(0,m.lk)(t.meta.bundleDid,t.meta.logo),l);else{const e=window.env.apiPrefix||"/",n=i.concat(t),o=a?n.slice(1):n;r=s()(e,"/blocklet/logo-bundle".concat(o.map((e=>"/".concat(e.meta.did))).join("")),l)}return{logoUrl:r,inService:a}}({blocklet:n,ancestors:o}),{variant:g}=r,x=h?()=>{}:e=>{e.target.src="".concat(u.imgPrefix,"/blocklet.png")};let b=(0,p.jsx)("img",{src:f,onError:x,alt:n.meta.name,style:{width:i}});return n.meta.logo||(b=(0,p.jsx)(l.Z,{did:n.meta.did||"",responsive:!0})),(0,p.jsx)(a.Z,{variant:g||"square",style:Object.assign({backgroundColor:"transparent",width:i,height:i,borderRadius:10},t),...r,children:b})}u.propTypes={blocklet:o().object.isRequired,style:o().object,size:o().oneOfType([o().number,o().string]),ancestors:o().array},u.defaultProps={style:{},size:40,ancestors:[]}},74286:(e,n,t)=>{t.d(n,{Z:()=>r});var i=t(55898),o=t.n(i),a=t(39948),l=t(96266);function r(e){let{depth:n,className:t}=e;return(0,l.jsx)(a.Z,{ml:Math.max(2*(n-1),0),className:t,sx:{borderBottom:1,borderColor:"rgba(0,0,0,0.12)"}},"group-collapse-box")}r.propTypes={depth:o().number,className:o().string},r.defaultProps={depth:1,className:""}},44784:(e,n,t)=>{t.d(n,{Z:()=>d});var i,o=t(71171),a=t(33518),l=t(82790),r=t(96266);function s(e){let{labelProps:n,className:t,style:i,...o}=e;const a={...n,labelPlacement:(null===n||void 0===n?void 0:n.labelPlacement)||"start"};return(0,r.jsx)(c,{className:t,style:i,children:(0,r.jsx)(l.Z,{labelProps:a,...o})})}s.propTypes=l.Z.propTypes,s.defaultProps=l.Z.defaultProps;const c=a.Z.div(i||(i=(0,o.Z)(["\n max-width: 300px;\n > label {\n display: flex;\n justify-content: space-between;\n width: 100%;\n margin-left: 0;\n margin-right: 0;\n }\n "," {\n max-width: 100%;\n }\n"])),(e=>{let{theme:n}=e;return n.breakpoints.down("sm")})),d=s},59375:(e,n,t)=>{t.d(n,{Z:()=>Z});var i,o=t(71171),a=t(5057),l=t(55898),r=t.n(l),s=t(6352),c=t.n(s),d=t(33518),m=t(92706),p=t.n(m),u=t(39948),f=t(52277),h=t.n(f),g=t(68420),x=t(96266);const b=(0,a.lazy)((()=>Promise.all([t.e(6547),t.e(5760),t.e(6743),t.e(9818),t.e(1294),t.e(6472)]).then(t.bind(t,84804)).then((e=>({default:e.Uploader}))))),v="/blocklet/logo/upload";function Z(e){let{url:n,height:t,width:i,enabled:o,type:l,did:r,prefix:s,headers:d,onUploaded:m}=e;const{t:p}=(0,g.PE)(),f=(0,a.useRef)(null),Z={cursor:o?"pointer":"default","&::after":{content:'"'.concat(p("common.switch"),'"')}};return(0,x.jsxs)(j,{id:"uploader-".concat(r,"-").concat(l),children:[(0,x.jsx)(b,{ref:f,popup:!0,onUploadFinish:()=>{var e;m(),null===(e=f.current)||void 0===e||e.close()},plugins:["ImageEditor"],installerProps:{disabled:!0},apiPathProps:{uploader:c()(s,v,l,r),disableMediaKitPrefix:!0},coreProps:{restrictions:{allowedFileTypes:["image/*",".jpg",".jpeg",".png",".gif",".svg"],maxFileSize:10485760,maxNumberOfFiles:1}},tusProps:{headers:d}}),(0,x.jsx)(u.Z,{className:h()("uploader-wrapper",o&&"enabled"),sx:Z,onClick:()=>{var e;null===(e=f.current)||void 0===e||e.open()},children:(0,x.jsx)("img",{alt:"Logo",src:n,style:{height:t,width:i}})})]},"uploader-".concat(r,"-").concat(l))}Z.propTypes={url:r().string.isRequired,type:r().oneOf(["square","rect","favicon"]).isRequired,did:r().string.isRequired,prefix:r().string.isRequired,headers:r().func,onUploaded:r().func,height:r().number,width:r().any,enabled:r().bool},Z.defaultProps={height:80,width:"auto",enabled:!0,headers:()=>({}),onUploaded:p()};const j=d.Z.div(i||(i=(0,o.Z)(["\n .uploader-wrapper {\n display: inline-flex;\n position: relative;\n font-size: 0px;\n &.enabled {\n cursor: pointer;\n }\n &::after {\n display: none;\n }\n &.enabled::after {\n display: block;\n opacity: 0;\n position: absolute;\n bottom: 0;\n background: rgba(0, 0, 0, 0.2);\n left: 0;\n right: 0;\n height: 2.2em;\n color: white;\n text-align: center;\n font-size: 12px;\n line-height: 2em;\n transition: opacity 0.3s ease;\n }\n &:hover::after {\n opacity: 1;\n }\n }\n"])))},64558:(e,n,t)=>{t.r(n),t.d(n,{default:()=>mt});var i,o=t(71171),a=t(5057),l=t(33518),r=t(55898),s=t.n(r),c=t(96181),d=t(6352),m=t.n(d),p=t(35432),u=t(39948),f=t(55402),h=t(82275),g=t(96399),x=t(65688),b=t(37633),v=t(48037),Z=t(92273),j=t(76720),y=t(15849),C=t(68420),k=t(94464),w=t(38242),S=t(80378),E=t(1722),L=t(43681),P=t.n(L),R=t(50482),T=t.n(R),A=t(16147),_=t(29034),N=t(28726),O=t(80578),I=t(77277),F=t(86229),B=t(28641),z=t(44846),U=t(13727),D=t(56184),K=t(67680),W=t(19654),q=t(90067),G=t(39646),V=t(43897),H=t(47020),M=t(49020),Y=t(35406),J=t(11875),Q=t(95890),X=t(96266);function $(e){let{label:n,disabled:t,required:i,initialValue:o,onChange:l,style:r,onSubmit:s,triggers:c,options:d,formatterBeforeSubmit:m,helperText:p,placeholder:f,renderImage:h,renderLabel:g,filterKeys:x,noEmpty:b,...v}=e;const[Z,j]=(0,a.useState)(!1),[y,C]=(0,a.useState)(!1),[k,w]=a.useState(""),[S,E]=(0,a.useState)(o),[L,P]=(0,a.useState)(S),R=(0,a.useMemo)((()=>{if(!d)return{};const e={};return d.forEach((n=>{e[n.code]=n})),e}),[d]),T=Z?(0,X.jsx)(G.Z,{options:d,value:L,onChange:(e,n)=>{if(!Array.isArray(n))return P([]),void l([]);const t=n.filter((e=>R[e]));if(!t.length)return P([]),void l([]);P(t),l(t)},inputValue:k,onInputChange:(e,n)=>{w(n)},PopperComponent:ne,fullWidth:!0,multiple:!0,variant:"outlined",margin:"dense",filterOptions:()=>{if(!d)return[];if(!k)return d.map((e=>e.code));const e=new RegExp(k.toLowerCase());return d.filter((n=>{for(let i=0;i<x.length;i++){var t;const o=x[i];if(e.test(null===(t=n[o])||void 0===t?void 0:t.toLowerCase()))return!0}return!1})).map((e=>e.code))},getOptionLabel:e=>{var n;return null===(n=R[e])||void 0===n?void 0:n.name},renderInput:e=>(0,X.jsx)(H.Z,{...e,label:"",placeholder:f}),renderOption:(e,n)=>{var t;const i=-1!==L.indexOf(n);return(0,a.createElement)(ee,{component:"li",...e,key:n},h(R[n]||{}),(0,X.jsx)(u.Z,{sx:{"& > img":{mr:2,flexShrink:0}},style:{flex:1,fontWeight:i?"700":"normal"},children:g(n,R[n])||(null===(t=R[n])||void 0===t?void 0:t.name)}),(0,X.jsx)(u.Z,{component:U.default,sx:{opacity:.5,width:18,height:18},style:{visibility:i?"visible":"hidden"}}))},...v}):(0,X.jsx)(u.Z,{px:1,className:"form-item-input slot",style:{whiteSpace:"pre-wrap"},children:L.filter((e=>d.some((n=>n.code===e)))).map((e=>(0,X.jsx)(W.Z,{label:d.find((n=>n.code===e)).name,style:{marginRight:8},size:"small"},e)))});return(0,X.jsx)(J.Z,{className:"form",style:r,children:(0,X.jsxs)(u.Z,{className:"form-item",children:[(0,X.jsxs)(u.Z,{className:"form-item-label",children:[n,i&&(0,X.jsx)(Y.Z,{})]}),(0,X.jsxs)(u.Z,{className:"form-item-body",children:[(0,X.jsx)(u.Z,{className:"form-item-input",children:T}),(0,X.jsx)(u.Z,{className:"form-item-action",children:Z?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(K.Z,{"data-cy":"schema-form-item-confirm",onClick:async()=>{C(!0);try{!1===await s("function"===typeof m?m(L):L)?P(S):b&&!L.length?(P(o),E(o)):(P(L),E(L))}catch(e){P(S)}finally{C(!1),j(!1)}},disabled:t||y,size:"large",children:y?(0,X.jsx)(z.Z,{size:24}):(0,X.jsx)(D.Z,{})}),(0,X.jsx)(K.Z,{"data-cy":"schema-form-item-cancel",onClick:()=>{P(S),j(!1)},disabled:t||y,size:"large",children:(0,X.jsx)(U.default,{})})]}):(0,X.jsx)(Q.Z,{triggers:c,onEnterEdit:()=>j(!0),disabled:t})})]}),Z&&p&&(0,X.jsx)(q.Z,{children:p})]})})}$.propTypes={style:s().object,onSubmit:s().func,onChange:s().func,label:s().string,initialValue:s().string,required:s().bool,disabled:s().bool,triggers:s().array,options:s().array,helperText:s().string,formatterBeforeSubmit:s().func,placeholder:s().string,renderImage:s().func,filterKeys:s().arrayOf(s().string),noEmpty:s().bool,renderLabel:s().func},$.defaultProps={style:{},onSubmit:()=>{},onChange:()=>{},label:"",initialValue:"",required:!1,disabled:!1,triggers:[],options:[],helperText:"",formatterBeforeSubmit:e=>e.join(","),placeholder:"",filterKeys:["name"],renderImage:()=>null,renderLabel:(e,n)=>"",noEmpty:!1};const ee=l.Z.div(i||(i=(0,o.Z)(["\n display: flex;\n justify-content: space-between;\n align-items: center;\n height: 48px;\n border-bottom: 1px solid rgba(0, 0, 0, 0.08);\n font-size: 1.1em;\n"]))),ne=(0,l.Z)(M.Z)((()=>({["& .".concat(V.Z.paper)]:{boxShadow:"0px 8px 12px rgba(92, 92, 92, 0.04), 0px -10px 12px rgba(92, 92, 92, 0.04)",borderRadius:"6px",width:"100%",border:"1px solid rgba(0, 0, 0, 0.12)",color:"inherit",fontSize:13,position:"absolute",left:0,top:0},["& .".concat(V.Z.listbox)]:{padding:0}})));var te,ie=t(58238),oe=t(14491),ae=t(54063),le=t(63406),re=t(78410),se=t(31853),ce=t(22425),de=t(70461),me=t(73545),pe=t(29054);function ue(e){let{initialValue:n,onChange:t,disabled:i,loading:o}=e;const{t:a}=(0,C.PE)(),{api:l}=(0,me.T)(),{blocklet:r}=(0,pe.y0)(),[s,c]=(0,se.Z)({newAppSk:"",isConnectOpen:!1}),d=()=>c({isConnectOpen:!1}),m=r.structVersion===p.APP_STRUCT_VERSION?[{key:"rotate-with-did-wallet",title:"Migrate with DID Wallet",handler:()=>{(0,oe.An)(r.status)?F.Z.error(a("blocklet.error.isRunning")):(0,w.isInProgress)(r.status)?F.Z.error(a("blocklet.error.isInProgress")):c({isConnectOpen:!0})}}]:[];return[(0,X.jsx)(B.Z,{disabled:i,loading:o,initialValue:n,onSubmit:e=>(c({newAppSk:e}),!1),triggers:m,secure:!0}),s.newAppSk&&(0,X.jsx)(de.Z,{title:a("blocklet.config.appSkTitle"),description:(0,X.jsxs)(u.Z,{children:[(0,X.jsx)(u.Z,{children:a("blocklet.config.appSkChangeTip")}),(0,X.jsx)(u.Z,{fontWeight:"bold",mt:2,children:a("blocklet.config.appDidChangeTip")}),(0,X.jsxs)(fe,{children:[(0,X.jsx)("li",{children:a("blocklet.config.appDidChangeTipL1")}),(0,X.jsx)("li",{children:a("blocklet.config.appDidChangeTipL2")})]})]}),confirm:a("confirm"),cancel:a("cancel"),onConfirm:()=>(async e=>{try{await t(e)}finally{c({newAppSk:""})}})(s.newAppSk),onCancel:()=>c({newAppSk:""})}),(0,X.jsx)(ce.Z,{popup:!0,open:s.isConnectOpen,forceConnected:!1,saveConnect:!1,action:"rotate-key-pair",checkFn:l.get,checkTimeout:3e5,onSuccess:d,extraParams:{appDid:r.appDid},messages:{title:a("setup.keyPair.title"),scan:a("setup.keyPair.scan"),confirm:a("setup.keyPair.confirm"),success:a("setup.keyPair.success")},onClose:d})]}ue.propTypes={initialValue:s().string,onChange:s().func,disabled:s().bool,loading:s().bool},ue.defaultProps={initialValue:"default",onChange:()=>{},disabled:!1,loading:!1};const fe=(0,l.Z)("ul")(te||(te=(0,o.Z)(["\n padding-left: 16px;\n li {\n margin-top: 8px;\n list-style: disk;\n font-weight: bold;\n }\n"])));var he,ge=t(13128),xe=t(55372),be=t(11750),ve=t(88574),Ze=t(26174),je=t(88092),ye=t(50185),Ce=t(17425);function ke(e){let{onCancel:n,onSuccess:t,onError:i}=e;const{api:o}=(0,a.useContext)(me.B),[l,r]=(0,a.useState)(!1),{t:s,locale:c}=(0,C.PE)(),[d,m]=(0,a.useState)(""),[p,f]=(0,a.useState)(!1),[h,g]=(0,a.useState)(0),[x,b]=(0,a.useState)(""),{endpoint:v}=(0,Ce.DJ)(),[Z,j]=(0,a.useState)(!1),y=e=>{m(null),r(!0);try{b(e.result),g(w.length-1)}catch(n){const e=(0,oe.Z)(n);m(e),i(n)}finally{r(!1)}},k=()=>{f(!1),g(0)},w=[{body:(0,X.jsxs)(u.Z,{children:[(0,X.jsx)(be.Z,{children:s("team.transferApp.transferDialog.tips.progress")}),(0,X.jsx)(be.Z,{mt:3,mb:2,children:s("team.transferApp.transferDialog.tips.newOwnerPermissions")})]}),cancel:s("common.cancel"),confirm:s("team.transferApp.transferDialog.createTransferLink"),onCancel:n,onConfirm:()=>{f(!0),g(1)}},{body:()=>(0,X.jsx)(ce.Z,{action:"transfer-app-owner",open:p,locale:c,checkFn:o.get,onClose:k,onSuccess:y,checkTimeout:3e5,extraParams:{},messages:{title:s("team.transferApp.connectDialog.title"),scan:s("team.transferApp.connectDialog.scan"),confirm:s("team.transferApp.connectDialog.confirm"),success:s("team.transferApp.connectDialog.success")},popup:!0})},{body:()=>{const e=(0,oe.VP)({transferId:x.transferId,endpoint:v});return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(u.Z,{component:we,dangerouslySetInnerHTML:{__html:s("team.transferApp.transferDialog.createSuccessTip1")}}),(0,X.jsx)(u.Z,{component:we,mt:2,children:(0,X.jsx)(we,{children:s("team.transferApp.transferDialog.createSuccessTip3")})}),(0,X.jsxs)(u.Z,{children:[(0,X.jsx)(u.Z,{component:we,mt:2,children:(0,X.jsx)(we,{children:s("team.transferApp.transferDialog.createSuccessTip2",{expireDate:(0,oe.B2)(x.expireDate,c)})})}),(0,X.jsx)(u.Z,{my:1,children:(0,X.jsx)(ye.Z,{children:e})})]}),(0,X.jsx)("div",{children:(0,X.jsx)(Ze.Z,{value:"end",control:(0,X.jsx)(je.Z,{checked:Z,onChange:e=>j(e.target.checked)}),label:s("team.transferApp.transferDialog.iKnow"),labelPlacement:"end"})})]})},confirm:s("common.confirm"),onConfirm:t}],S=w[h];return(0,X.jsxs)(ge.ZP,{title:(0,X.jsx)(we,{className:"title",children:s("team.transferApp.transferDialog.title")}),fullWidth:!0,open:!0,showCloseButton:!1,actions:(0,X.jsxs)(X.Fragment,{children:[S.cancel&&(0,X.jsx)(N.Z,{onClick:S.onCancel,color:"inherit",children:S.cancel}),(0,X.jsxs)(N.Z,{onClick:S.onConfirm,color:"error",disabled:l||h===w.length-1&&!Z,variant:"contained",autoFocus:!0,children:[l&&(0,X.jsx)(z.Z,{size:16}),S.confirm]})]}),children:[(0,X.jsx)(xe.Z,{component:"div",children:"function"===typeof S.body?S.body():S.body}),!!d&&(0,X.jsx)(ve.Z,{type:"error",variant:"icon",children:d})]})}ke.propTypes={onCancel:s().func.isRequired,onSuccess:s().func.isRequired,onError:s().func},ke.defaultProps={onError:()=>{}};const we=l.Z.div(he||(he=(0,o.Z)(["\n font-size: 16px;\n font-weight: bold;\n &.title {\n font-size: 20px;\n }\n"])));var Se,Ee=t(49522),Le=t(59375);const Pe=Object.keys(I.SUPPORTED_LANGUAGES).map((e=>({code:e,name:I.SUPPORTED_LANGUAGES[e].nativeName,enName:I.SUPPORTED_LANGUAGES[e].name}))),Re=["name","enName","code"];function Te(e){var n;let{blocklet:t,onUpdate:i,hasPermission:o,...l}=e;const{api:r,inService:s,prefix:c,getSessionInHeader:d,ws:{useSubscription:m}}=(0,ie.h6)(),{t:f}=(0,a.useContext)(C.RD),[h,g]=(0,a.useState)(""),[x,b]=(0,a.useState)(""),[v,Z]=(0,a.useState)(!1),j=(0,w.getWhoCanAccess)(t),y=null===t||void 0===t||null===(n=t.settings)||void 0===n?void 0:n.publicToStore,k=x||!o,{logoUrl:S,rectLogoUrl:E,faviconUrl:L}=(0,Ee.Z)({blocklet:t}),{did:R}=t.meta,{site:z}=t,U=P()(t.meta,"capabilities.clusterMode",!1);if(m(p.EVENTS.NODE_RUNTIME_INFO,(e=>{U&&g(P()(e,"cpu.physicalCores",""))})),(0,oe.wS)(t.status))return null;const D=t.environments.find((e=>e.key===I.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_DELETABLE)),K=!D||"yes"===D.value,W=t.environments.find((e=>e.key===I.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_LANGUAGES)),q=t.environments.find((e=>e.key===I.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_URL)),G=t.environments.find((e=>e.key===I.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_COPYRIGHT_OWNER)),V=t.environments.find((e=>e.key===I.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_COPYRIGHT_YEAR)),H=[{key:I.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_NAME,description:f("blocklet.config.name"),value:t.environments.find((e=>"BLOCKLET_APP_NAME"===e.key)).value},{key:I.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_DESCRIPTION,description:f("blocklet.config.description"),value:t.environments.find((e=>"BLOCKLET_APP_DESCRIPTION"===e.key)).value},{key:I.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_URL,description:f("blocklet.config.appUrl"),value:q?q.value:""},{key:I.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_COPYRIGHT_OWNER,description:f("blocklet.config.copyrightOwner"),value:G?G.value:""},{key:I.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_COPYRIGHT_YEAR,description:f("blocklet.config.copyrightYear"),value:V?V.value:""}];if(U){const e=t.configs.find((e=>e.key===I.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_CLUSTER_SIZE)),n=e?e.value:h;H.push({key:I.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_CLUSTER_SIZE,description:f("blocklet.config.clusterSize"),value:n,cpuCores:h})}const M=async(e,n)=>{if(e===I.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_CLUSTER_SIZE){const e=(0,oe.I)({value:n,cpuCores:h});if(e)return void F.Z.error(e)}const o=[{key:e,value:n}];try{b(!0);const{blocklet:e}=await r.configBlocklet({input:{did:t.meta.did,configs:o}});i(e)}catch(a){F.Z.error(a.message)}finally{b(!1)}};return(0,X.jsxs)(Oe,{...l,children:[H.map((e=>(0,X.jsxs)(u.Z,{className:"config-form",mt:2,children:[(0,X.jsx)(u.Z,{className:"config-label",fontSize:14,mb:0,children:e.description}),(0,X.jsx)(B.Z,{style:{marginTop:0},disabled:x||k,loading:x,initialValue:e.value,onSubmit:n=>M(e.key,n)})]}))),(0,X.jsx)(u.Z,{className:"config-form",component:_.Z,my:3}),(0,X.jsx)(u.Z,{className:"config-label",fontSize:14,mb:1,sx:{flexGrow:0,width:"auto"},children:f("blocklet.config.logoSquare")}),(0,X.jsx)(Le.Z,{did:t.meta.did,height:80,width:80,type:"square",prefix:c,url:S,enabled:o,headers:d}),(0,X.jsx)(u.Z,{className:"config-label",fontSize:14,mt:4,children:f("blocklet.config.logoRect")}),(0,X.jsx)(u.Z,{mb:1.5,className:"config-desc",children:f("blocklet.config.logoRectDesc")}),(0,X.jsx)(Le.Z,{did:t.meta.did,height:80,type:"rect",prefix:c,url:E,enabled:o,headers:d}),(0,X.jsx)(u.Z,{className:"config-label",fontSize:14,mt:4,children:f("blocklet.config.logoFavicon")}),(0,X.jsx)(u.Z,{mb:1.5,className:"config-desc",children:f("blocklet.config.logoFaviconDesc")}),(0,X.jsx)(Le.Z,{did:t.meta.did,height:25,width:25,type:"favicon",prefix:c,url:L,enabled:o,headers:d}),(0,X.jsx)(u.Z,{className:"config-form",children:"all"===j&&"registry"===t.source&&(0,X.jsxs)(u.Z,{className:"config-item",children:[(0,X.jsxs)(u.Z,{className:"config-label",children:[f("blocklet.config.access.publicToStore"),(0,X.jsx)(u.Z,{className:"config-desc",children:f("blocklet.config.access.publicInstanceTip")})]}),(0,X.jsx)(A.Z,{disabled:k,checked:y,defaultChecked:!0,onChange:async e=>{if(!x){b(!0);try{const{checked:n}=e.target,{blocklet:o}=await r.configPublicToStore({input:{did:t.meta.did,publicToStore:n}});i(o)}catch(n){F.Z.error(n.message)}finally{b(!1)}}}})]})}),(0,X.jsx)(u.Z,{className:"config-form",component:_.Z,my:3}),(0,X.jsxs)(u.Z,{className:"config-form",mt:2,children:[(0,X.jsx)(u.Z,{className:"config-label",fontSize:14,mb:0,children:f("blocklet.config.languages")}),(0,X.jsx)($,{style:{marginTop:0},disabled:x||k,loading:x,options:Pe,noEmpty:!0,initialValue:W?W.value.split(","):["en","zh"],onSubmit:e=>M("BLOCKLET_APP_LANGUAGES",e),helperText:f("blocklet.config.selectLanguagesTip"),placeholder:f("blocklet.config.languagesSearch"),filterKeys:Re,renderLabel:(e,n)=>n.name===n.enName?"".concat(n.name," (").concat(e.toUpperCase(),")"):"".concat(n.name,", ").concat(n.enName," (").concat(e.toUpperCase(),")")})]}),(0,X.jsx)(u.Z,{className:"config-form",component:_.Z,my:3}),(0,X.jsx)(u.Z,{className:"config-form",mt:2,children:(0,X.jsx)(u.Z,{className:"config-label",mb:0,children:f("common.security")})}),(0,X.jsxs)(u.Z,{className:"config-form",mt:2,children:[(0,X.jsx)(u.Z,{className:"config-label",fontSize:14,mb:0,children:f("router.domainSecurity.cors.title")}),(0,X.jsx)(u.Z,{mb:1.5,className:"config-desc",children:f("router.domainSecurity.cors.description",{name:"the blocklet"})}),(0,X.jsx)(B.Z,{style:{marginTop:0},disabled:x||k,loading:x,initialValue:(z.corsAllowedOrigins||[]).join(", "),onSubmit:async e=>{const n=z.corsAllowedOrigins||[],i=e.split(",").map((e=>e.trim())).filter(Boolean);if(T()(n,i))return!1;try{b(!0);const e=i.length?i:["__none__"];await r.updateRoutingSite({input:{id:z.id,corsAllowedOrigins:e,teamDid:t.meta.did}}),b(!1)}catch(o){return F.Z.error(o.message),b(!1),!1}return!0}})]}),(0,X.jsx)(u.Z,{className:"config-form",component:_.Z,my:3}),(0,X.jsx)(u.Z,{mb:2,className:"config-label",fontSize:20,children:f("blocklet.config.dangerZone")}),(0,X.jsxs)(u.Z,{px:2,py:1,sx:{border:"1px solid red",borderRadius:2},children:[(0,X.jsx)(u.Z,{className:"config-form",mt:2,children:!s&&(0,X.jsxs)(u.Z,{className:"config-item",children:[(0,X.jsxs)(u.Z,{className:"config-label",children:[f("blocklet.config.deletable.name"),(0,X.jsx)(u.Z,{className:"config-desc",children:f(K?"blocklet.config.deletable.disable":"blocklet.config.deletable.enable")})]}),(0,X.jsx)(A.Z,{disabled:k,checked:!K,defaultChecked:!0,onChange:async e=>{if(!x){b(!0);try{const{checked:n}=e.target,{blocklet:o}=await r.configBlocklet({input:{did:t.meta.did,configs:[{key:I.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_DELETABLE,value:n?"no":"yes"}]}});i(o)}catch(n){F.Z.error(n.message)}finally{b(!1)}}}})]})}),(0,X.jsxs)(u.Z,{className:"config-form",mt:2,children:[(0,X.jsx)(u.Z,{className:"config-label",fontSize:14,mb:0,children:f("blocklet.config.sk")}),(0,X.jsx)(ue,{disabled:x||k,loading:x,initialValue:t.environments.find((e=>"BLOCKLET_APP_SK"===e.key)).value,onChange:async e=>{if(!x){b(!0);try{const{blocklet:n}=await r.configBlocklet({input:{did:t.meta.did,configs:[{key:I.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_SK,value:e}]}});i(n)}catch(n){F.Z.error(n.message)}finally{b(!1)}}}})]}),s&&(0,X.jsx)(le.Z,{role:"owner",children:e=>(e||ae.C)&&(0,X.jsxs)(u.Z,{className:"config-form",mt:2,children:[(0,X.jsxs)(u.Z,{className:"config-item",children:[(0,X.jsx)(u.Z,{className:"config-label",mb:0,children:f("team.transferApp.name")}),(0,X.jsxs)(N.Z,{style:{flexShrink:0},variant:"contained",edge:"end",color:"error",size:"small","data-cy":"transfer-app",onClick:()=>Z(!0),children:[(0,X.jsx)(O.Z,{style:{fontSize:"1.3em",marginRight:4}}),f("team.transferApp.name")]})]}),v&&(0,X.jsx)(ke,{onCancel:()=>Z(!1),onSuccess:()=>Z(!1)})]})}),(0,X.jsx)(u.Z,{className:"config-form",mt:2,children:(0,X.jsxs)(u.Z,{className:"config-item",children:[(0,X.jsxs)(u.Z,{className:"config-label",children:[f("blocklet.config.clearCache.name"),(0,X.jsx)(u.Z,{className:"config-desc",children:f("blocklet.config.clearCache.purpose")})]}),(0,X.jsx)(re.Z,{teamDid:R})]})})]})]})}const Ae=(0,le.V)(Te,"mutate_blocklets"),_e=(0,le.V)(Te,"",oe.Wf);function Ne(e){const{inService:n}=(0,ie.h6)();return n?(0,X.jsx)(_e,{...e}):(0,X.jsx)(Ae,{...e})}Te.propTypes={blocklet:s().object.isRequired,onUpdate:s().func,hasPermission:s().bool},Te.defaultProps={onUpdate:()=>{},hasPermission:!1};const Oe=l.Z.div(Se||(Se=(0,o.Z)(["\n padding-top: 24px;\n .config-form {\n flex-grow: 1;\n overflow-y: auto;\n "," {\n width: 100%;\n flex-shrink: 0;\n padding: 0 24px;\n transform: translate(0, 0);\n }\n }\n\n .config-item {\n display: flex;\n align-items: center;\n justify-content: space-between;\n margin: 16px 0;\n }\n\n .config-label {\n font-weight: bold;\n }\n\n .config-desc {\n font-weight: normal;\n font-size: 12px;\n color: #666;\n }\n\n .form-item {\n margin-top: 0;\n }\n"])),(e=>e.theme.breakpoints.down("md")));var Ie=t(25710),Fe=t(93066),Be=t(80576),ze=t(8708),Ue=t.n(ze),De=t(12673),Ke=t(99360),We=t(80506),qe=t(766),Ge=t.n(qe),Ve=t(24529),He=t.n(Ve),Me=t(16727),Ye=t.n(Me),Je=t(92706),Qe=t.n(Je);const Xe=(0,a.forwardRef)(((e,n)=>{const{t:t}=(0,a.useContext)(C.RD),i=(0,De.Z)({show:!1,title:"",content:"",onConfirm:Qe(),onCancel:Qe(),loading:!1}),o=(0,Ke.Z)((function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};i.show=!0,i.title=e.title,i.content=e.content,i.onConfirm=e.onConfirm||Qe(),i.onCancel=e.onCancel||Qe(),i.loading=!1})),l=(0,Ke.Z)((()=>{i.title="",i.content="",i.onConfirm=Qe(),i.onCancel=Qe()})),r=(0,Ke.Z)((()=>{i.show=!1,setTimeout((()=>{l()}),300)})),s=(0,Ke.Z)((()=>{r(),null===i||void 0===i||i.onCancel()}),[]),c=(0,Ke.Z)((async()=>{i.loading=!0;try{await(null===i||void 0===i?void 0:i.onConfirm(r))}finally{i.loading=!1}}),[]);return(0,a.useImperativeHandle)(n,(()=>({open:o,close:r})),[o,r]),(0,X.jsx)(ge.I4,{open:i.show,title:i.title,onConfirm:c,onCancel:s,confirmButton:{text:t("common.confirm"),props:{variant:"contained",color:"primary",loading:i.loading}},cancelButton:{text:t("common.cancel"),props:{variant:"outlined",color:"primary"}},children:i.content instanceof Function?i.content():i.content})}));function $e(){const e=(0,a.useRef)(null),n=(0,Ke.Z)((function(){for(var n,t=arguments.length,i=new Array(t),o=0;o<t;o++)i[o]=arguments[o];null===(n=e.current)||void 0===n||n.open(...i)})),t=(0,Ke.Z)((function(){for(var n,t=arguments.length,i=new Array(t),o=0;o<t;o++)i[o]=arguments[o];null===(n=e.current)||void 0===n||n.close(...i)})),i={open:n,close:t};return{confirmHolder:(0,X.jsx)(Xe,{ref:e}),confirmApi:i}}const en={enabled:!1,secure:!1,from:"",host:"",port:"",user:"",password:""};const nn=function(){var e,n;const{api:t}=(0,ie.h6)(),{blocklet:i}=(0,pe.y0)(),{t:o}=(0,C.PE)(),{confirmApi:a,confirmHolder:l}=$e(),r=null===i||void 0===i||null===(e=i.meta)||void 0===e?void 0:e.did,s=Object.assign({...en},(null===i||void 0===i||null===(n=i.settings)||void 0===n||null===(n=n.notification)||void 0===n?void 0:n.email)||{}),{handleSubmit:c,control:d,formState:m,watch:p,reset:f}=(0,We.cI)({defaultValues:Ue()(s,Object.keys(en))}),h=(0,De.Z)({testReceiver:"",testReceiverError:""}),g=p("enabled"),x=(0,Ke.Z)((async function(e,n){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];try{var a;const{blocklet:n}=await t.configNotification({input:{did:r,notification:JSON.stringify({email:e})}}),l=Object.assign({...en},(null===n||void 0===n||null===(a=n.settings)||void 0===a||null===(a=a.notification)||void 0===a?void 0:a.email)||{});f(l),i&&F.Z.success(o("oauth.saveSuccess"))}catch(l){if(!i)throw l;F.Z.error(l.message||o("oauth.saveFailed"))}})),b=(0,Ke.Z)((async(e,n,i)=>{try{m.isDirty&&await x(e,n,!1),await t.sendEmail({input:{did:r,receiver:i,email:JSON.stringify({body:"Your SMTP configuration is correct!",title:"Test email",type:"notification"})}}),F.Z.success(o("notification.email.testSuccess"))}catch(a){F.Z.error(a.message||o("notification.email.testfailed"))}})),v=(0,Ke.Z)(((e,n)=>{h.testReceiver="",h.testReceiverError="",a.open({title:o("notification.email.testSendEmail"),content:()=>(0,X.jsx)(u.Z,{sx:{width:"300px"},children:(0,X.jsx)(H.Z,{fullWidth:!0,name:"testReceiver",label:o("notification.email.inputTestReceiver"),value:h.testReceiver,onChange:e=>{h.testReceiver=e.target.value},error:!!h.testReceiverError,helperText:h.testReceiverError||"\u3000"})}),async onConfirm(t){var i;const a=null===(i=h.testReceiver)||void 0===i?void 0:i.trim();a?Ge()(a)?(h.testReceiverError="",await b(e,n,a),t()):h.testReceiverError=o("notification.email.receiverInvalid"):h.testReceiverError=o("notification.email.receiverRequired")}})})),Z=(0,Ke.Z)((e=>{const n=null===e||void 0===e?void 0:e.trim();return n?!!Ge()(n)||o("notification.email.fromInvalid"):o("notification.email.fromRequired")})),j=(0,Ke.Z)((e=>{const n=null===e||void 0===e?void 0:e.trim();return n?!!He()(n,{require_host:!1,protocols:[]})||o("notification.email.hostInvalid"):o("notification.email.hostRequired")})),y=(0,Ke.Z)((e=>e?!!Ye()(e)||o("notification.email.portInvalid"):o("notification.email.portRequired"))),k=(0,Ke.Z)((e=>!(null===e||void 0===e||!e.trim())||o("notification.email.userRequired"))),w=(0,Ke.Z)((e=>!(null===e||void 0===e||!e.trim())||o("notification.email.passwordRequired"))),S=(0,Ke.Z)((()=>!0));return(0,X.jsxs)(u.Z,{children:[(0,X.jsxs)("form",{onSubmit:c(x),disabled:!0,children:[(0,X.jsx)(We.Qr,{name:"enabled",control:d,render:e=>{let{field:n}=e;return(0,X.jsx)(Ze.Z,{control:(0,X.jsx)(A.Z,{checked:n.value,...n}),label:o("notification.email.enable"),sx:{marginBottom:"8px"}})}}),(0,X.jsx)(We.Qr,{name:"from",control:d,rules:{validate:g?Z:S},render:e=>{var n;let{field:t}=e;return(0,X.jsx)(Be.Z,{fullWidth:!0,children:(0,X.jsx)(H.Z,{...t,label:o("notification.email.from"),error:!!m.errors[t.name],helperText:(null===(n=m.errors[t.name])||void 0===n?void 0:n.message)||"\u3000",disabled:!g})})}}),(0,X.jsx)(We.Qr,{name:"host",control:d,rules:{validate:g?j:S},render:e=>{var n;let{field:t}=e;return(0,X.jsx)(Be.Z,{fullWidth:!0,children:(0,X.jsx)(H.Z,{...t,error:!!m.errors[t.name],label:o("notification.email.host"),helperText:(null===(n=m.errors[t.name])||void 0===n?void 0:n.message)||"\u3000",disabled:!g})})}}),(0,X.jsx)(We.Qr,{name:"port",control:d,rules:{validate:g?y:S},render:e=>{var n;let{field:t}=e;return(0,X.jsx)(Be.Z,{fullWidth:!0,children:(0,X.jsx)(H.Z,{...t,type:"number",error:!!m.errors[t.name],label:o("notification.email.port"),helperText:(null===(n=m.errors[t.name])||void 0===n?void 0:n.message)||"\u3000",disabled:!g})})}}),(0,X.jsx)(We.Qr,{name:"user",control:d,rules:{validate:g?k:S},render:e=>{var n;let{field:t}=e;return(0,X.jsx)(Be.Z,{fullWidth:!0,children:(0,X.jsx)(H.Z,{...t,error:!!m.errors[t.name],label:o("notification.email.user"),helperText:(null===(n=m.errors[t.name])||void 0===n?void 0:n.message)||"\u3000",disabled:!g})})}}),(0,X.jsx)(We.Qr,{name:"password",control:d,rules:{validate:g?w:S},render:e=>{var n;let{field:t}=e;return(0,X.jsx)(Be.Z,{fullWidth:!0,children:(0,X.jsx)(H.Z,{...t,type:"password",error:!!m.errors[t.name],label:o("notification.email.password"),helperText:(null===(n=m.errors[t.name])||void 0===n?void 0:n.message)||"\u3000",disabled:!g})})}}),(0,X.jsx)(We.Qr,{name:"secure",control:d,rules:{validate:S},render:e=>{let{field:n}=e;return(0,X.jsx)(Be.Z,{fullWidth:!0,children:(0,X.jsx)(Ze.Z,{control:(0,X.jsx)(A.Z,{checked:n.value,...n,disabled:!g}),label:o("notification.email.secure"),style:{marginBottom:16}})})}}),(0,X.jsx)(N.Z,{variant:"outlined",color:"warning",onClick:c(v),sx:{mr:2},disabled:!g,children:o("oauth.runTest")}),(0,X.jsx)(N.Z,{type:"submit",variant:"contained",disabled:!m.isDirty,children:o("oauth.save")})]}),l]})},tn=[{label:(0,X.jsx)(u.Z,{textAlign:"center",width:"100%",children:"Email"}),value:"email"},{label:(0,X.jsx)(u.Z,{textAlign:"center",width:"100%",children:"More"}),value:"more"}];const on=function(){const[e,n]=(0,a.useState)(tn[0].value),{t:t}=(0,a.useContext)(C.RD),i=(0,Fe.Z)((()=>({email:(0,X.jsx)(nn,{}),more:(0,X.jsx)(u.Z,{children:(0,X.jsx)(Ie.Z,{children:t("notification.comingSoon")})})})),[t]);return(0,X.jsxs)(u.Z,{children:[(0,X.jsx)(k.Z,{tabs:tn,current:e,onChange:n}),(0,X.jsx)(u.Z,{marginTop:"10px",children:i[e]})]})};var an=t(96366),ln=t(75239),rn=t(48342),sn=t(94552),cn=t(24558),dn=t(74286),mn=t(74490),pn=t(76667),un=t(70648),fn=t(44067),hn=t(7664),gn=t(44123),xn=t(53906);const bn=[{value:p.WHO_CAN_ACCESS.ALL,icon:xn.Z,title:{zh:"\u6240\u6709\u4eba\u53ef\u8bbf\u95ee",en:"Accessible to all"},description:{zh:"\u5411\u6240\u6709\u4eba\u5f00\u653e\uff0c\u65e0\u9700\u901a\u884c\u8bc1\u5373\u53ef\u8bbf\u95ee\u5e94\u7528",en:"Open to the world anyone can access without passport"}},{value:p.WHO_CAN_ACCESS.INVITED,icon:gn.Z,title:{zh:"\u53ea\u6709\u88ab\u9080\u8bf7\u7684\u4eba\u53ef\u4ee5\u8bbf\u95ee",en:"Only invited people can access"},description:{zh:"\u7a0d\u540e\u60a8\u53ef\u4ee5\u5728\u7ba1\u7406\u9875\u9762\u4e2d\u9080\u8bf7\u6210\u5458",en:"You can invite members later in the admin page"}},{value:p.WHO_CAN_ACCESS.OWNER,icon:hn.Z,title:{zh:"\u53ea\u6709\u5e94\u7528\u6240\u6709\u8005\u53ef\u4ee5\u8bbf\u95ee",en:"Only Owner of the blocklet can access"},description:{zh:"\u5fc5\u987b\u63d0\u4f9b\u6240\u6709\u8005\u901a\u884c\u8bc1\u624d\u80fd\u8bbf\u95ee\u5e94\u7528",en:"You must provide owner passport to access this application"}}];var vn,Zn;const jn="roles",yn=[...bn,{value:jn,icon:un.Z,title:{zh:"\u6307\u5b9a\u901a\u884c\u8bc1\u53ef\u8bbf\u95ee",en:"Accessible to selected passports"},description:{zh:"\u53ea\u6709\u6307\u5b9a\u7684\u901a\u884c\u8bc1\u53ef\u4ee5\u8bbf\u95ee",en:"Only specified passports can access"}}],Cn=(e,n)=>{if(e&&e.startsWith(p.WHO_CAN_ACCESS_PREFIX_ROLES)){const t=(0,w.getRolesFromAuthConfig)({whoCanAccess:e}),i=n.filter((e=>t.includes(e.name)));return{access:jn,roles:i}}return{access:e,roles:[]}},kn=function(e,n){let{roles:t=[]}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const i=(e.configs||[]).find((e=>e.key===I.BLOCKLET_CONFIGURABLE_KEY.COMPONENT_ACCESS_WHO));if(i)return Cn(i.value,t);if(n&&P()(n,"settings.whoCanAccess")&&P()(n,"settings.whoCanAccess")!==p.WHO_CAN_ACCESS.ALL)return Cn(P()(n,"settings.whoCanAccess"),t);const o=(0,w.findServiceFromMeta)(e.meta,p.NODE_SERVICES.AUTH);return P()(o,"config.whoCanAccess")?Cn(o.config.whoCanAccess,t):{access:p.WHO_CAN_ACCESS.ALL,roles:[]}};function wn(e){let{blocklet:n,ancestors:t,children:i}=e;const o=(0,an.Z)(),[l,r]=(0,a.useState)(""),{t:s,locale:c}=(0,C.PE)(),{api:d}=(0,ie.h6)(),{roles:m}=(0,Ce.DJ)(),[f,h]=(0,a.useState)(""),g=t[0]||n,{access:x,roles:b}=kn(n,g,{roles:m}),[v,Z]=(0,a.useState)(x),[j,y]=(0,a.useState)(b),k=[...t.map((e=>e.meta.did)),n.meta.did],S={marginRight:4,fontSize:18,verticalAlign:"text-bottom",color:o.palette.text.secondary},E=t.concat(n).map((e=>(0,w.getDisplayName)(e,!0))).join(" / ");if((0,oe.wS)(n.status))return null;if("unknown"===n.status&&(0,oe.wS)(n.status))return null;const L=()=>{r(!1)},P=e=>{e.stopPropagation(),r(!0)},R=f||v===jn&&!j.length;return["function"===typeof i?i({open:P}):(0,X.jsx)(K.Z,{onClick:P,"data-cy":"action-config-component",children:(0,X.jsx)(pn.default,{})}),l&&(0,X.jsxs)(Sn,{open:!0,fullWidth:!0,title:E,onClose:L,PaperProps:{style:{minHeight:"auto"}},actions:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(N.Z,{onClick:L,color:"inherit","data-cy":"config-access-cancel",children:s("common.cancel")}),(0,X.jsxs)(N.Z,{onClick:async()=>{if(!f){h(!0);try{let e=v;e===jn&&(e="".concat(p.WHO_CAN_ACCESS_PREFIX_ROLES).concat(j.map((e=>e.name)).join(","))),await d.updateWhoCanAccess({input:{did:k,whoCanAccess:e}}),F.Z.success(s("blocklet.config.access.updatedTip")),L(),h(!1)}catch(e){h(!1),F.Z.error((0,oe.Z)(e))}}},color:"primary",disabled:R,variant:"contained",autoFocus:!0,"data-cy":"config-access-confirm",children:[f&&(0,X.jsx)(z.Z,{size:16}),s("common.confirm")]})]}),children:[(0,X.jsx)(u.Z,{mt:4,mb:3,children:(0,X.jsx)(H.Z,{label:s("blocklet.config.access.description"),select:!0,fullWidth:!0,value:v,onChange:e=>{const{value:n}=e.target;Z(n)},"data-cy":"config-access-select",SelectProps:{renderValue:e=>{const n=yn.find((n=>n.value===e));return n?(0,X.jsxs)(u.Z,{children:[(0,X.jsx)(n.icon,{style:S}),n.title[c]]}):null}},children:yn.map((e=>(0,X.jsxs)(En,{value:e.value,sx:{display:"block"},"data-cy":"config-access-opt-".concat(e.value),children:[(0,X.jsxs)(u.Z,{display:"flex",alignItems:"center",children:[(0,X.jsx)(e.icon,{style:S}),(0,X.jsx)(u.Z,{children:e.title[c]})]}),(0,X.jsx)(u.Z,{children:(0,X.jsx)(u.Z,{className:"tip",children:e.description[c]})})]})))})}),v===jn&&(0,X.jsx)(u.Z,{mt:4,mb:3,children:(0,X.jsx)(H.Z,{label:s("blocklet.config.access.description"),select:!0,fullWidth:!0,value:j.map((e=>e.name)),onChange:e=>{y(m.filter((n=>(e.target.value||[]).includes(n.name))))},SelectProps:{multiple:!0,renderValue:e=>(0,X.jsx)(u.Z,{sx:{display:"flex",flexWrap:"wrap",gap:.5},children:e.map((e=>{const n=m.find((n=>n.name===e));return(0,X.jsx)(W.Z,{label:n.title},n.text)}))})},children:m.map((e=>{let{name:n,title:t}=e;return(0,X.jsxs)(mn.Z,{value:n,children:[(0,X.jsx)(je.Z,{checked:j.some((e=>e.name===n))}),(0,X.jsx)(fn.Z,{primary:t})]},n)}))})})]})]}wn.propTypes={blocklet:s().object.isRequired,ancestors:s().array,children:s().any},wn.defaultProps={ancestors:[],children:null};const Sn=(0,l.Z)(ge.ZP)(vn||(vn=(0,o.Z)(["\n .MuiDialogContent-root {\n padding-top: 0;\n margin-top: -32px;\n }\n .MuiToolbar-root {\n padding-right: 12px;\n }\n .ux-dialog_right {\n padding-right: 20px;\n }\n"]))),En=(0,l.Z)(mn.Z)(Zn||(Zn=(0,o.Z)(["\n .tip {\n font-size: 12px;\n color: ",";\n }\n"])),(e=>e.theme.palette.text.secondary));var Ln;function Pn(e){var n;let{blocklet:t,ancestors:i,depth:o}=e;const l=(0,an.Z)(),{t:r,locale:s}=(0,C.PE)(),{roles:c}=(0,Ce.DJ)(),[d,m]=(0,a.useState)(!0),{recommendedDomain:p}=(0,pe.y0)(),f=i[0]||t,h="/".concat(i.map((e=>e.mountPoint||"/")).join("/"),"/").concat(t.mountPoint||"/").replace(/\/+/g,"/"),g=(0,oe.vH)({blocklet:f,domain:{value:p},mountPoint:h,params:(0,oe.f0)(f,s)}),x={fill:l.palette.text.secondary},b=o>0&&t.children.length>0,v=(0,X.jsx)(K.Z,{size:"small",children:d?(0,X.jsx)(j.Z,{fontSize:"inherit"}):(0,X.jsx)(Z.default,{fontSize:"inherit"})}),{access:y,roles:k}=kn(t,f,{roles:c});let E;if("roles"!==y)E=bn.find((e=>e.value===y))||bn[2];else{const e=k.map((e=>e.title)).join("/");E={title:{zh:"\u53ea\u6709 ".concat(e," \u53ef\u4ee5\u8bbf\u95ee"),en:"Only ".concat(e," can access")}}}return[(o>0||"gateway"!==t.meta.group)&&(0,X.jsxs)(u.Z,{display:"flex",py:2,className:"component-item",justifyContent:"space-between",alignItems:"center",children:[(0,X.jsxs)(u.Z,{pl:Math.max(2*(o-1),0),width:{xs:300,md:400},display:"flex",alignItems:"center",style:{cursor:b?"pointer":"cursor"},onClick:()=>b&&m(!d),children:[b?v:(0,X.jsx)(u.Z,{width:28}),(0,X.jsx)(S.Z,{blocklet:t,ancestors:i}),(0,X.jsxs)(u.Z,{ml:"16px",children:[(0,X.jsx)(u.Z,{style:{color:"#222",fontSize:18},children:(0,w.getDisplayName)(t,!0)}),(0,X.jsx)(u.Z,{display:"flex",alignItems:"center",children:(0,X.jsx)(u.Z,{color:"text.secondary",children:E.title[s]})})]})]},t),(0,X.jsxs)(u.Z,{children:[(0,X.jsx)(ln.Z,{title:r("common.visit"),children:(0,X.jsx)("a",{target:"_blank",href:g,rel:"noopener noreferrer",title:g,children:(0,X.jsx)(K.Z,{children:(0,X.jsx)(sn.Z,{})})})}),(0,X.jsx)(wn,{blocklet:t,ancestors:i,children:e=>{let{open:n}=e;return(0,X.jsx)(ln.Z,{title:r("common.edit"),children:(0,X.jsx)(K.Z,{onClick:n,"data-cy":"btn-edit-".concat(t.meta.did),children:(0,X.jsx)(cn.Z,{style:x})})})}})]},"actions")]},"group-not-gateway-box"),(0,X.jsx)(dn.Z,{depth:o},"line"),null!==(n=t.children)&&void 0!==n&&n.length?(0,X.jsx)(rn.Z,{in:d,children:t.children.map((e=>(0,X.jsx)(Pn,{blocklet:e,ancestors:[...i,t],depth:o+1},"".concat(o+1,"-").concat(e.meta.did))))},"blocklet-collapse"):null]}function Rn(){const{t:e}=(0,C.PE)(),{blocklet:n}=(0,pe.y0)(),t=[...n.children]||[];return"gateway"!==n.meta.group&&t.unshift(n),(0,X.jsx)(Tn,{component:"div",children:t&&t.length?[(0,X.jsx)(u.Z,{mt:2,ml:{xs:"-12px",md:"-24px"},style:{maxWidth:1080},children:(0,X.jsx)(Pn,{blocklet:n},"0-".concat(n.meta.did))},"top-blocklet-".concat(n.meta.did))]:(0,X.jsx)(u.Z,{mt:8,children:(0,X.jsx)(Ie.Z,{children:e("blocklet.component.noComponent")})})})}Pn.propTypes={blocklet:s().object.isRequired,ancestors:s().array,depth:s().number},Pn.defaultProps={ancestors:[],depth:0},Rn.propTypes={};const Tn=(0,l.Z)(u.Z)(Ln||(Ln=(0,o.Z)(["\n .title {\n font-size: 1.2rem;\n font-weight: bold;\n margin-top: ",";\n margin-bottom: ",";\n &.first {\n margin-top: 0;\n }\n }\n"])),(e=>e.theme.spacing(5)),(e=>e.theme.spacing(3)));var An=t(56556),_n=t(44784);const Nn=function(){var e,n;const{api:t}=(0,ie.h6)(),{blocklet:i}=(0,pe.y0)(),{t:o}=(0,C.PE)(),a=null===i||void 0===i||null===(e=i.meta)||void 0===e?void 0:e.did,l=Object.assign({enabled:!1,domain:"",clientId:""},(null===i||void 0===i||null===(n=i.settings)||void 0===n||null===(n=n.oauth)||void 0===n?void 0:n.auth0)||{}),{handleSubmit:r,control:s,formState:c,watch:d,reset:m}=(0,We.cI)({defaultValues:Ue()(l,["domain","clientId","enabled"])}),p=d("enabled"),f=(0,Ke.Z)((async e=>{try{var n;const{blocklet:i}=await t.configOAuth({input:{did:a,oauth:JSON.stringify({auth0:e})}}),l=Object.assign({enabled:!1,domain:"",clientId:""},(null===i||void 0===i||null===(n=i.settings)||void 0===n||null===(n=n.oauth)||void 0===n?void 0:n.auth0)||{});m(l),F.Z.success(o("oauth.saveSuccess"))}catch(i){F.Z.error(i.message||o("oauth.saveFailed"))}})),h=(0,Ke.Z)((e=>!(null===e||void 0===e||!e.trim())||o("oauth.auth0.domainDescribe"))),g=(0,Ke.Z)((e=>!(null===e||void 0===e||!e.trim())||o("oauth.auth0.clientIdDescribe"))),x=(0,Ke.Z)((()=>!0));return(0,X.jsx)(u.Z,{children:(0,X.jsxs)("form",{onSubmit:r(f),disabled:!0,children:[(0,X.jsx)(We.Qr,{name:"enabled",control:s,render:e=>{let{field:n}=e;return(0,X.jsx)(Ze.Z,{control:(0,X.jsx)(_n.Z,{checked:n.value,style:{marginRight:"6px"},...n}),label:o("oauth.auth0.enable"),sx:{marginBottom:2,ml:1}})}}),(0,X.jsx)(We.Qr,{name:"domain",control:s,rules:{validate:p?h:x},render:e=>{var n;let{field:t}=e;return(0,X.jsx)(Be.Z,{fullWidth:!0,children:(0,X.jsx)(H.Z,{...t,label:o("oauth.auth0.domain"),error:!!c.errors[t.name],helperText:(null===(n=c.errors[t.name])||void 0===n?void 0:n.message)||"\u3000",disabled:!p})})}}),(0,X.jsx)(We.Qr,{name:"clientId",control:s,rules:{validate:p?g:x},render:e=>{var n;let{field:t}=e;return(0,X.jsx)(Be.Z,{fullWidth:!0,children:(0,X.jsx)(H.Z,{...t,error:!!c.errors[t.name],label:o("oauth.auth0.clientId"),helperText:(null===(n=c.errors[t.name])||void 0===n?void 0:n.message)||"\u3000",disabled:!p})})}}),(0,X.jsx)(An.Z,{type:"submit",variant:"contained",onSubmit:r(f),disabled:!c.isDirty,children:o("oauth.save")})]})})};var On=t(62362),In=t(24103);const Fn={ttl:p.SESSION_TTL};function Bn(e){const n=arguments.length>1&&void 0!==arguments[1]&&arguments[1]?86400*e.ttl:e.ttl/86400;return{...e,ttl:n}}function zn(){var e,n;const{api:t}=(0,ie.h6)(),{blocklet:i}=(0,pe.y0)(),o=null===i||void 0===i||null===(e=i.meta)||void 0===e?void 0:e.did,a=Object.assign({},Fn,(null===i||void 0===i||null===(n=i.settings)||void 0===n?void 0:n.session)||{}),{handleSubmit:l,control:r,formState:s,reset:c}=(0,We.cI)({defaultValues:Ue()(Bn(a),["ttl"])}),{t:d}=(0,C.PE)(),m=(0,Ke.Z)((async e=>{try{var n;const{blocklet:i}=await t.updateAppSessionConfig({input:{did:o,config:Bn(e,!0)}}),a=Object.assign({},Fn,Ue()((null===i||void 0===i||null===(n=i.settings)||void 0===n?void 0:n.session)||{},["ttl"]));c(Bn(a)),F.Z.success(d("common.configSuccess"))}catch(i){F.Z.error(i.message)}}));return(0,X.jsx)(u.Z,{children:(0,X.jsxs)("form",{onSubmit:l(m),disabled:!0,children:[(0,X.jsx)(We.Qr,{name:"ttl",control:r,render:e=>{let{field:n}=e;return(0,X.jsx)(Be.Z,{fullWidth:!0,sx:{mb:2},children:(0,X.jsxs)(In.Z,{px:3,children:[(0,X.jsx)(u.Z,{mx:-3,my:.5,children:d("blocklet.config.session.ttl",{day:n.value})}),(0,X.jsx)(On.ZP,{...n,defaultValue:7,step:1,marks:[{value:1,label:d("blocklet.config.session.day",{day:1})},{value:7,label:d("blocklet.config.session.days",{day:7})},{value:14,label:d("blocklet.config.session.days",{day:14})},{value:21,label:d("blocklet.config.session.days",{day:21})},{value:30,label:d("blocklet.config.session.days",{day:30})}],min:1,max:30,valueLabelDisplay:"auto",style:{maxWidth:"360px"}})]})})}}),(0,X.jsx)(An.Z,{type:"submit",variant:"contained",onSubmit:l(m),disabled:!s.isDirty,children:d("oauth.save")})]})})}var Un=t(82555),Dn=t(30333),Kn=t(75760),Wn=t(97038),qn=t(64886),Gn=t(42080),Vn=t.n(Gn),Hn=t(75506),Mn=t.n(Hn),Yn=t(47685),Jn=t(13260),Qn=t(82434),Xn=t.n(Qn);const $n=(0,a.forwardRef)(((e,n)=>{var t;const{t:i}=(0,a.useContext)(C.RD),{blocklet:o}=(0,pe.y0)(),{api:l}=(0,ie.h6)(),r=(0,De.Z)({mode:"view",show:!1,data:{},callback:Qe()}),s=(0,Yn.Fg)(),c=(null===s||void 0===s||null===(t=s.transitions)||void 0===t||null===(t=t.duration)||void 0===t?void 0:t.leavingScreen)||300,d=(0,Ke.Z)((()=>{r.mode="view",r.data={},r.callback=Qe()}),[]),p=(0,Ke.Z)((()=>{r.show=!1,setTimeout((()=>{d()}),c)}),[]),f=(0,Ke.Z)((e=>{r.mode="view",r.show=!0,r.data=e}),[]),h=(0,Ke.Z)((function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Qe();r.mode="approve",r.show=!0,r.data=e,r.callback=n}),[]);(0,a.useImperativeHandle)(n,(()=>({open:f,close:p,approve:h})),[f,p,h]);const g=(0,Fe.Z)((()=>{if(!r.show)return[];r.data.migratedFrom=[r.data.appId,r.data.appPid];const e=["appName","appLogo","appId","appPid","migratedFrom","appDescription","appUrl","version","appliedAt","status","serverId","serverVersion"];return!1!==r.data.isMaster&&Vn()(e,"appliedAt","status"),e.map((e=>{const n=i("federated.info.".concat(e));let t=r.data[e];if("appName"===e&&r.data.isMaster&&(t=(0,X.jsxs)(u.Z,{children:[(0,X.jsx)(Un.Z,{component:Dn.Z}),t]})),["appId","appPid","serverId"].includes(e)&&(t=(0,X.jsx)(Jn.kL,{children:t})),["appUrl"].includes(e)&&(t=(0,X.jsx)(u.Z,{component:"a",href:t,target:"_blank",children:t})),["appLogo"].includes(e)){const e=Xn()(t)?t:m()(r.data.appUrl||"",t||"");try{const n=new URL(e);n.searchParams.set("imageFilter","resize"),n.searchParams.set("w","80"),n.searchParams.set("h","80"),t=(0,X.jsx)("img",{src:n.href,width:"60",height:"60",alt:r.data.appName})}catch{t=(0,X.jsx)("img",{src:e,width:"60",height:"60",alt:r.data.appName})}}if("status"===e&&(t=t&&i("federated.status.".concat(t))),"migratedFrom"===e){t=(r.data.migratedFrom||[]).filter((e=>![r.data.appId,r.data.appPid].includes(e))).map((e=>(0,X.jsx)(Jn.kL,{children:e})))}return Mn()(t)&&(t="-"),{name:n,value:t}}))}),[r.data]),x="approve"===r.mode,b=(0,Ke.Z)((async()=>{await l.auditFederatedLogin({input:{memberPid:r.data.appPid,did:o.appPid,status:"rejected"}}),p(),null===r||void 0===r||r.callback(!1)})),v=(0,Ke.Z)((async()=>{await l.auditFederatedLogin({input:{memberPid:r.data.appPid,did:o.appPid,status:"approved"}}),p(),null===r||void 0===r||r.callback(!0)}));return(0,X.jsx)(ge.ZP,{open:r.show,title:i(x?"federated.approveToJoinLogin":"federated.siteDetail"),onClose:p,actions:x?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(An.Z,{color:"error",variant:"contained",onClick:b,children:i("common.reject")}),(0,X.jsx)(An.Z,{variant:"contained",onClick:v,children:i("common.approve")})]}):(0,X.jsx)(An.Z,{variant:"outlined",onClick:p,children:i("common.close")}),children:g.map((e=>(0,X.jsx)(qn.Z,{style:{alignItems:"flex-start"},valueComponent:"div",nameWidth:180,name:e.name,children:e.value},e.name)))})}));var et=t(79842),nt=t(85408),tt=t.n(nt);const it=(0,a.forwardRef)(((e,n)=>{var t;const i=(0,Yn.Fg)(),o=(null===i||void 0===i||null===(t=i.transitions)||void 0===t||null===(t=t.duration)||void 0===t?void 0:t.leavingScreen)||300,{t:l}=(0,a.useContext)(C.RD),r=(0,De.Z)({show:!1,data:{link:""}}),s=(0,Ke.Z)((()=>{r.data.link=""}),[]),c=(0,Ke.Z)((()=>{r.show=!1,setTimeout((()=>{s()}),o)}),[]),d=(0,Ke.Z)((e=>{let{link:n}=e;r.show=!0,r.data.link=n}),[]);(0,a.useImperativeHandle)(n,(()=>({open:d,close:c})),[d,c]);const m=(0,Ke.Z)((()=>{tt()(r.data.link),c()}),[c]);return(0,X.jsxs)(ge.ZP,{open:r.show,title:l("federated.joinFederatedLogin"),onClose:c,PaperProps:{style:{minHeight:"unset"}},actions:(0,X.jsx)(N.Z,{color:"primary",autoFocus:!0,variant:"contained",onClick:m,children:l("common.copyAndClose")}),children:[(0,X.jsx)(u.Z,{mb:1,children:l("federated.inviteJoinFederatedLoginDescription")}),(0,X.jsx)(u.Z,{sx:{"& .copy-button":{display:"none !important"}},children:(0,X.jsx)(et.Z,{language:"shell",style:{marginBottom:0},children:r.data.link})})]})}));function ot(e){var n,t,i;let{mode:o}=e;const l=(0,a.useRef)(null),r=(0,a.useRef)(null),{t:s,locale:c}=(0,a.useContext)(C.RD),{blocklet:d,actions:{refreshBlocklet:m}}=(0,pe.y0)(),{confirmApi:p,confirmHolder:f}=$e(),{api:h}=(0,ie.h6)(),g=(null===(n=d.settings.federated)||void 0===n?void 0:n.sites)||[],x=(null===(t=d.settings.federated)||void 0===t?void 0:t.config)||{},b=!1!==x.isMaster,v=(0,Ke.Z)((e=>{var n;null===(n=r.current)||void 0===n||n.open(e)})),Z=(0,Ke.Z)((e=>{var n;null===(n=r.current)||void 0===n||n.approve(e,m)})),j=(0,Ke.Z)((e=>{p.open({title:s("federated.disableFederatedLogin"),content:s("federated.disableFederatedLoginDescription"),async onConfirm(n){await h.auditFederatedLogin({input:{memberPid:e.appPid,did:d.appPid,status:"revoked"}}),n()}})})),y=(0,Ke.Z)((e=>{p.open({title:s("federated.enableFederatedLogin"),content:s("federated.enableFederatedLoginDescription"),async onConfirm(n){await h.auditFederatedLogin({input:{memberPid:e.appPid,did:d.appPid,status:"approved"}}),n()}})})),k=(0,Fe.Z)((()=>{const e=[{label:s("common.name"),name:"appName",options:{customBodyRenderLite:e=>{const n=g[e],t=!1!==n.isMaster;return(0,X.jsx)(u.Z,{display:"inline-block",children:(0,X.jsxs)(u.Z,{component:"a",display:"flex",alignItems:"center",href:n.appUrl,target:"_blank",onClick:e=>{e.stopPropagation()},children:[t&&(0,X.jsx)(Un.Z,{component:Dn.Z,style:{marginRight:"4px"}}),n.appName]})})}}},{label:s("common.did"),name:"appId",options:{customBodyRenderLite:e=>{const n=g[e];return(0,X.jsx)(Wn.Z,{children:n.appId})}}},{label:s("common.status"),name:"status",options:{customBodyRenderLite:e=>{const n=g[e],t=!1!==n.isMaster;return(0,X.jsx)(u.Z,{children:t?"-":s("federated.status.".concat(n.status))})}}}];return b&&e.push({label:s("common.actions"),name:"actions",options:{customBodyRenderLite:e=>{const n=g[e],t=!1!==n.isMaster;return(0,X.jsx)(u.Z,{display:"flex",gap:1,children:t?(0,X.jsxs)(X.Fragment,{children:["rejected"===n.status&&(0,X.jsx)(N.Z,{variant:"contained",color:"error",size:"small",onClick:e=>{e.stopPropagation()},children:s("federated.status.rejected")}),"revoked"===n.status&&(0,X.jsx)(N.Z,{variant:"contained",color:"secondary",size:"small",onClick:e=>{e.stopPropagation()},children:s("federated.status.revoked")})]}):(0,X.jsxs)(X.Fragment,{children:["pending"===n.status&&(0,X.jsx)(N.Z,{variant:"contained",color:"primary",size:"small",onClick:e=>{e.stopPropagation(),Z(n)},children:s("federated.status.pending")}),"approved"===n.status&&(0,X.jsx)(N.Z,{variant:"contained",color:"error",size:"small",onClick:e=>{e.stopPropagation(),j(n)},style:{whiteSpace:"nowrap"},children:s("federated.revoke")}),"revoked"===n.status&&(0,X.jsx)(N.Z,{variant:"contained",color:"warning",size:"small",onClick:e=>{e.stopPropagation(),y(n)},style:{whiteSpace:"nowrap"},children:s("federated.approve")})]})})}}}),e}),[x.appId,g,b,s]),w=(0,Fe.Z)((()=>({sort:!0,download:!1,filter:!1,print:!1,expandableRowsOnClick:!0,onRowClick(e,n){let{dataIndex:t}=n;const i=g[t];v(i)}})),[]),S=(0,Ke.Z)((()=>{const e=d.environments.find((e=>e.key===I.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_URL));var n;null!==e&&void 0!==e&&e.value?null===(n=l.current)||void 0===n||n.open({link:e.value}):F.Z.error(s("federated.failedToGetFederatedLoginLink"))}),[null===(i=d.site)||void 0===i||null===(i=i.domainAliases)||void 0===i||null===(i=i[0])||void 0===i?void 0:i.href]),E=(0,Ke.Z)((()=>{p.open({title:s("federated.quitFederatedLogin"),content:s("federated.quitFederatedLoginDescription"),async onConfirm(e){await h.quitFederatedLogin({input:{did:d.appPid}}),e()}})})),L=(0,Ke.Z)((()=>{p.open({title:s("federated.disbandFederatedLogin"),content:s("federated.disbandFederatedLoginDescription"),async onConfirm(e){await h.disbandFederatedLogin({input:{did:d.appPid}}),e()}})})),P=[];return"master"!==o?P.push((0,X.jsx)(N.Z,{size:"small",variant:"contained",color:"error",onClick:E,sx:{ml:1},children:s("federated.quitFederatedLogin")},"quitFederatedLogin")):(P.push((0,X.jsx)(N.Z,{size:"small",variant:"contained",onClick:S,sx:{ml:1},children:s("federated.inviteJoinFederatedLogin")},"inviteJoinFederatedLogin")),P.push((0,X.jsx)(N.Z,{color:"error",size:"small",variant:"contained",onClick:L,sx:{ml:1},children:s("federated.disbandFederatedLogin")},"disbandFederatedLogin"))),(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Kn.Z,{className:"main-table",locale:c,data:g,columns:k,customButtons:P,title:(0,X.jsx)(u.Z,{className:"table-toolbar-left",children:s("oauth.federated")}),options:w}),f,(0,X.jsx)(it,{ref:l}),(0,X.jsx)($n,{ref:r})]})}ot.propTypes={mode:s().oneOf(["member","master"])},ot.defaultProps={mode:"member"};const at=ot,lt=(0,a.forwardRef)(((e,n)=>{var t;const{t:i}=(0,a.useContext)(C.RD),{api:o}=(0,ie.h6)(),{blocklet:l}=(0,pe.y0)(),r=null===l||void 0===l?void 0:l.appPid,s=(0,Yn.Fg)(),c=(null===s||void 0===s||null===(t=s.transitions)||void 0===t||null===(t=t.duration)||void 0===t?void 0:t.leavingScreen)||300,d=(0,De.Z)({show:!1,appUrl:"",appUrlError:"",callback:Qe()}),m=(0,Ke.Z)((()=>{d.appUrl="",d.appUrlError="",d.callback=Qe()}),[]),p=(0,Ke.Z)((()=>{d.show=!1,setTimeout((()=>{m()}),c)}),[]),f=(0,Ke.Z)((function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Qe();d.show=!0,d.callback=e}),[]);(0,a.useImperativeHandle)(n,(()=>({open:f,close:p})),[f,p]);const h=(0,Ke.Z)((e=>{if(!e)throw new Error(i("federated.federatedJoinAppUrlRequired"));if(!Xn()(e))throw new Error(i("federated.federatedJoinAppUrlInvalid"))})),g=(0,Ke.Z)((async()=>{try{h(d.appUrl);const e=await o.joinFederatedLogin({input:{did:r,appUrl:d.appUrl}});d.show=!1,p(),null===d||void 0===d||d.callback(e)}catch(e){d.appUrlError=e.message}}),[p,r]);return(0,X.jsxs)(ge.ZP,{open:d.show,title:i("federated.joinFederatedLogin"),onClose:p,PaperProps:{style:{minHeight:"unset"}},actions:(0,X.jsx)(N.Z,{color:"primary",autoFocus:!0,variant:"contained",onClick:g,children:i("common.confirm")}),children:[(0,X.jsx)(u.Z,{mb:1,children:i("federated.joinFederatedLoginDescription")}),(0,X.jsx)(H.Z,{fullWidth:!0,variant:"outlined",margin:"dense",placeholder:i("federated.federatedJoinAppUrl"),label:i("federated.federatedJoinAppUrl"),value:d.appUrl,error:!!d.appUrlError,helperText:d.appUrlError||"eg: https://www.arcblock.io",onChange:e=>{d.appUrl=e.target.value}})]})}));function rt(){var e,n;const t=(0,a.useRef)(null),i=(0,a.useRef)(null),{t:o}=(0,a.useContext)(C.RD),{blocklet:l,actions:{refreshBlocklet:r}}=(0,pe.y0)(),s=(0,Ke.Z)((()=>{var e;const n=null===(e=l.site)||void 0===e||null===(e=e.domainAliases)||void 0===e||null===(e=e[0])||void 0===e?void 0:e.href;if(n)try{var i;const e=new URL(n);null===(i=t.current)||void 0===i||i.open({link:e.origin})}catch{F.Z.error(o("federated.failedToGetFederatedLoginLink"))}}),[null===(e=l.site)||void 0===e||null===(e=e.domainAliases)||void 0===e||null===(e=e[0])||void 0===e?void 0:e.href]),c=(0,Ke.Z)((()=>{var e;null===(e=i.current)||void 0===e||e.open((()=>{r()}))}),[r]);if((null===(n=l.settings.federated)||void 0===n?void 0:n.sites.length)>0){var d;const e=!1!==(null===(d=l.settings.federated)||void 0===d?void 0:d.config.isMaster);return(0,X.jsx)(at,{mode:e?"master":"member"})}return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(u.Z,{display:"flex",flexDirection:"column",gap:2,justifyContent:"center",alignItems:"center",minHeight:"200px",children:[(0,X.jsx)(N.Z,{variant:"contained",onClick:s,children:o("federated.inviteJoinFederatedLogin")}),(0,X.jsx)(_.Z,{sx:{width:"150px",color:"rgba(0, 0, 0, 0.3)"},children:"OR"}),(0,X.jsx)(N.Z,{variant:"outlined",onClick:c,children:o("federated.joinFederatedLogin")})]}),(0,X.jsx)(it,{ref:t}),(0,X.jsx)(lt,{ref:i})]})}const st=function(){const{t:e}=(0,a.useContext)(C.RD),n=[{label:(0,X.jsx)(u.Z,{textAlign:"center",width:"100%",children:e("oauth.commonSettings")}),value:"settings"},{label:(0,X.jsx)(u.Z,{textAlign:"center",width:"100%",children:e("oauth.federated")}),value:"federated"},{label:(0,X.jsx)(u.Z,{textAlign:"center",width:"100%",children:"Auth0"}),value:"auth0"},{label:(0,X.jsx)(u.Z,{textAlign:"center",width:"100%",children:e("oauth.moreLogin")}),value:"more"}],[t,i]=(0,a.useState)(n[0].value),o=(0,Fe.Z)((()=>({auth0:(0,X.jsx)(Nn,{}),federated:(0,X.jsx)(rt,{}),more:(0,X.jsx)(u.Z,{children:(0,X.jsx)(Ie.Z,{children:e("oauth.comingSoon")})}),settings:(0,X.jsx)(u.Z,{children:(0,X.jsx)(zn,{})})})),[e]);return(0,X.jsxs)(u.Z,{children:[(0,X.jsx)(k.Z,{tabs:n,current:t,onChange:i}),(0,X.jsx)(u.Z,{marginTop:"10px",children:o[t]})]})};var ct;const dt=e=>{let{tabs:n,blocklet:t,ancestors:i=[],depth:o=1,t:a}=e;const l=[...i.map((e=>e.meta.did)),t.meta.did].join("/"),r=!(null!==i&&void 0!==i&&i.length);n.push({label:(0,X.jsxs)(u.Z,{pl:2*Math.max(1,o-1),display:"flex",alignItems:"center",justifyContent:"flex-start",children:[r?(0,X.jsx)(E.Z,{size:24,blocklet:t}):(0,X.jsx)(S.Z,{size:24,blocklet:t,ancestors:i}),(0,X.jsx)(u.Z,{ml:"16px",children:(0,X.jsx)(u.Z,{style:{color:"#222"},children:r?a("blocklet.component.container"):(0,w.getDisplayName)(t,!0)})})]},l),value:l}),t.children.length>0&&t.children.forEach((e=>{dt({tabs:n,blocklet:e,ancestors:[...i,t],depth:o+1,t:a})}))};function mt(e){let{blocklet:n,onUpdate:t,...i}=e;const{t:o}=(0,a.useContext)(C.RD),{info:l,inService:r}=(0,ie.h6)(),[s,d]=(0,a.useState)(!0),[w,S]=(0,y.useSearchParams)(),E=w.get("tab")||"general",L=[{label:(0,X.jsxs)(u.Z,{display:"flex",alignItems:"center","data-cy":"configuration-tab-general",children:[(0,X.jsx)(h.Z,{sx:{fontSize:24}}),(0,X.jsx)(u.Z,{ml:"16px",children:(0,X.jsx)(u.Z,{style:{color:"#222"},children:o("common.general")})})]},"general"),value:"general"},{label:(0,X.jsxs)(u.Z,{display:"flex",alignItems:"center","data-cy":"configuration-tab-access",children:[(0,X.jsx)(g.Z,{sx:{fontSize:24}}),(0,X.jsx)(u.Z,{ml:"16px",children:(0,X.jsx)(u.Z,{style:{color:"#222"},children:o("common.access")})})]},"access"),value:"access"},{label:(0,X.jsxs)(u.Z,{display:"flex",alignItems:"center","data-cy":"configuration-tab-oauth",children:[(0,X.jsx)(x.Z,{sx:{fontSize:24}}),(0,X.jsx)(u.Z,{ml:"16px",children:(0,X.jsx)(u.Z,{style:{color:"#222"},children:o("common.login")})})]},"oauth"),value:"oauth"},{label:(0,X.jsxs)(u.Z,{display:"flex",alignItems:"center","data-cy":"configuration-tab-notification",children:[(0,X.jsx)(b.Z,{sx:{fontSize:24}}),(0,X.jsx)(u.Z,{ml:"16px",children:(0,X.jsx)(u.Z,{style:{color:"#222"},children:o("common.notification")})})]},"notification"),value:"notification"},{label:(0,X.jsxs)(u.Z,{display:"flex",alignItems:"center","data-cy":"configuration-tab-preference",children:[(0,X.jsx)(u.Z,{ml:-2,style:{transform:"translateY(2px)"},children:s?(0,X.jsx)(j.Z,{fontSize:"inherit"}):(0,X.jsx)(Z.default,{fontSize:"inherit"})}),(0,X.jsx)(v.Z,{sx:{fontSize:24}}),(0,X.jsx)(u.Z,{ml:"16px",children:(0,X.jsx)(u.Z,{style:{color:"#222"},children:o("common.preferences")})})]},"preference"),value:"preference"}];s&&dt({tabs:L,blocklet:n,t:o});let P=null;if("general"===E)P=(0,X.jsx)(Ne,{blocklet:n,onUpdate:t});else if("access"===E)P=(0,X.jsx)(Rn,{});else if("oauth"===E)P=(0,X.jsx)(st,{});else if("notification"===E)P=(0,X.jsx)(on,{});else{const e=r?p.WELLKNOWN_SERVICE_PATH_PREFIX:l.routing.adminPath,n=new URLSearchParams;r||n.set("authKey","__sst"),n.set("schemaKey",m()(window.location.origin,e,"/api/preferences?id=".concat(encodeURIComponent(E)))),P=(0,X.jsx)(c.Z,{url:"".concat(m()(window.location.origin,e,"/hosted/form-collector/"),"?").concat(n.toString()),width:"100%",height:"100%",frameBorder:0,styles:{border:0}})}return(0,X.jsx)(pt,{...i,children:(0,X.jsxs)(f.ZP,{container:!0,spacing:4,columns:24,children:[(0,X.jsx)(f.ZP,{item:!0,sm:7,md:5,children:(0,X.jsx)(k.Z,{tabs:L,current:E,orientation:"vertical",onChange:e=>{"preference"===e?d(!s):S((n=>("general"===e?n.delete("tab"):n.set("tab",e),n)))},sx:{borderRight:1,height:"100%",borderColor:"divider"}})}),(0,X.jsx)(f.ZP,{item:!0,sm:17,md:19,children:(0,X.jsx)(u.Z,{style:{minHeight:"66vh",height:"100%",position:"relative",overflow:"hidden"},children:P})})]})})}mt.propTypes={blocklet:s().object.isRequired,onUpdate:s().func},mt.defaultProps={onUpdate:()=>{}};const pt=l.Z.div(ct||(ct=(0,o.Z)(["\n .MuiTab-root {\n text-align: left;\n align-items: flex-start;\n font-weight: normal;\n }\n .Mui-selected {\n font-weight: bold;\n }\n"])))},78410:(e,n,t)=>{t.d(n,{Z:()=>p});var i=t(5057),o=t(86229),a=t(28726),l=t(44846),r=t(68420),s=t(14491),c=t(58238),d=t(70461),m=t(96266);function p(e){let{teamDid:n,size:t="small",...p}=e;const{t:u}=(0,r.PE)(),{api:f}=(0,c.h6)(),[h,g]=(0,i.useState)(!1),[x,b]=(0,i.useState)(null),v={title:u("blocklet.config.clearCache.title"),description:u("blocklet.config.clearCache.description"),confirm:u("common.confirm"),cancel:u("common.cancel"),onConfirm:async()=>{try{var e;g(!0);const t=await f.clearCache({input:{teamDid:n}});o.Z.success(u("blocklet.config.clearCache.success",{count:(null===(e=t.removed)||void 0===e?void 0:e.length)||0}))}catch(t){o.Z.error((0,s.Z)(t))}finally{g(!1),b(null)}},onCancel:()=>{g(!1),b(null)}};return(0,m.jsxs)("div",{...p,children:[(0,m.jsxs)(a.Z,{onClick:()=>b(v),color:"error",variant:"outlined",size:t,children:[h?(0,m.jsx)(l.Z,{size:16,style:{marginRight:5}}):null,u("blocklet.config.clearCache.action")]}),x&&(0,m.jsx)(d.Z,{title:x.title,description:x.description,confirm:x.confirm,cancel:x.cancel,onConfirm:x.onConfirm,onCancel:x.onCancel})]})}},50185:(e,n,t)=>{t.d(n,{Z:()=>c});var i=t(5057),o=t(55898),a=t.n(o),l=t(12937),r=t(68420),s=t(96266);function c(e){let{children:n,...t}=e;const{t:o}=(0,i.useContext)(r.RD);return(0,s.jsx)(l.Z,{tip:o("common.copyTip"),copiedTip:o("common.copiedTip"),...t,children:n})}c.propTypes={children:a().any.isRequired}},28641:(e,n,t)=>{t.d(n,{Z:()=>x});var i=t(5057),o=t(55898),a=t.n(o),l=t(39948),r=t(47020),s=t(44846),c=t(13727),d=t(56184),m=t(67680),p=t(35406),u=t(11875),f=t(95890),h=t(96266);const g=(e,n,t)=>null===e&&n&&t?"******":e?n?"******":e:"";function x(e){let{label:n,disabled:t,required:o,initialValue:a,onChange:x,placeholder:b,style:v,onSubmit:Z,secure:j,triggers:y,formatterBeforeSubmit:C,...k}=e;const[w,S]=(0,i.useState)(!1),[E,L]=(0,i.useState)(!1),[P,R]=(0,i.useState)(j&&"__encrypted__"===a?null:a),[T,A]=(0,i.useState)(P),_=async()=>{L(!0);try{if(!1===await Z(T))A(P);else{let e=T;"function"===typeof C&&(e=C(T)),A(e),R(e)}}catch(e){A(P)}finally{L(!1),S(!1)}},N=w?(0,h.jsx)(r.Z,{style:{flex:1},fullWidth:!0,value:T,onChange:e=>{var n;n=e.target.value,A(n),x(n)},autoFocus:!0,size:"small",variant:"outlined",placeholder:b,onKeyDown:e=>{"Enter"===e.key&&_()},disabled:t,type:j?"password":"text",...k}):(0,h.jsx)(l.Z,{px:1,className:"form-item-input slot",style:{whiteSpace:"pre-wrap"},children:g(T,j,a)});return(0,h.jsx)(u.Z,{className:"form",style:v,children:(0,h.jsxs)(l.Z,{className:"form-item",children:[(0,h.jsxs)(l.Z,{className:"form-item-label",children:[n,o&&(0,h.jsx)(p.Z,{})]}),(0,h.jsxs)(l.Z,{className:"form-item-body",children:[(0,h.jsx)(l.Z,{className:"form-item-input",children:N}),(0,h.jsx)(l.Z,{className:"form-item-action",children:w?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(m.Z,{"data-cy":"schema-form-item-confirm",onClick:_,disabled:t||E,size:"large",children:E?(0,h.jsx)(s.Z,{size:24}):(0,h.jsx)(d.Z,{})}),(0,h.jsx)(m.Z,{"data-cy":"schema-form-item-cancel",onClick:()=>{A(P),S(!1)},disabled:t||E,size:"large",children:(0,h.jsx)(c.default,{})})]}):(0,h.jsx)(f.Z,{triggers:y,onEnterEdit:()=>S(!0),disabled:t})})]})]})})}x.propTypes={style:a().object,onSubmit:a().func,onChange:a().func,label:a().string,initialValue:a().string,placeholder:a().string,required:a().bool,disabled:a().bool,secure:a().bool,triggers:a().array,formatterBeforeSubmit:a().func},x.defaultProps={style:{},onSubmit:()=>{},onChange:()=>{},label:"",initialValue:"",placeholder:"",required:!1,disabled:!1,secure:!1,triggers:[],formatterBeforeSubmit:null}},11875:(e,n,t)=>{t.d(n,{Z:()=>r});var i,o=t(71171),a=t(33518),l=t(39948);const r=(0,a.Z)(l.Z)(i||(i=(0,o.Z)(["\n width: 100%;\n flex-grow: 1;\n overflow-y: auto;\n "," {\n width: 100%;\n flex-shrink: 0;\n padding: 0 24px;\n transform: translate(0, 0);\n /* max-height: 60vh; */\n }\n\n .form-item {\n width: 100%;\n margin-bottom: 24px;\n position: relative;\n "," {\n flex-wrap: wrap;\n justify-content: space-between;\n width: 100%;\n flex-shrink: 0;\n }\n }\n\n .form-item-body {\n display: flex;\n align-items: center;\n width: 100%;\n margin-top: 4px;\n }\n\n .form-item-label {\n line-height: 1.2;\n font-size: 14px;\n color: #888;\n font-weight: bold;\n\n "," {\n text-align: left;\n width: auto;\n flex-grow: 1;\n }\n }\n\n .form-item-input {\n flex-grow: 1;\n overflow: hidden;\n white-space: nowrap;\n text-overflow: ellipsis;\n\n &.slot {\n height: 40px;\n line-height: 40px;\n background: #f8f8f8;\n font-size: 16px;\n\n .MuiChip-root {\n margin-top: -4px;\n }\n }\n\n .MuiSelect-select {\n padding: 8px;\n }\n }\n\n .form-item-action {\n // width: 100px;\n text-align: left;\n margin-left: 12px;\n flex-shrink: 0;\n "," {\n width: auto;\n margin-left: 0px;\n }\n .MuiIconButton-root {\n padding: 8px;\n svg {\n fill: #888;\n }\n &.Mui-disabled {\n opacity: 0.4;\n }\n }\n }\n"])),(e=>e.theme.breakpoints.down("md")),(e=>e.theme.breakpoints.down("md")),(e=>e.theme.breakpoints.down("md")),(e=>e.theme.breakpoints.down("md")))},95890:(e,n,t)=>{t.d(n,{Z:()=>x});var i=t(5057),o=t(55898),a=t.n(o),l=t(24558),r=t(67680),s=t(56556),c=t(80633),d=t(49390),m=t(72113),p=t(25228),u=t(49020),f=t(74490),h=t(1733),g=t(96266);function x(e){let{triggers:n,onEnterEdit:t,disabled:o}=e;const a=i.useRef(null),[x,b]=i.useState(!1);return 0===n.length?(0,g.jsx)(r.Z,{"data-cy":"schema-form-item-edit",onClick:t,disabled:o,size:"large",children:(0,g.jsx)(l.Z,{})}):(0,g.jsxs)(g.Fragment,{children:[(0,g.jsxs)(c.Z,{variant:"outlined",ref:a,"aria-label":"split button",children:[(0,g.jsx)(s.Z,{"data-cy":"schema-form-item-edit",onClick:t,disabled:o,size:"large",children:(0,g.jsx)(l.Z,{})}),(0,g.jsx)(s.Z,{size:"small","aria-controls":x?"split-button-menu":void 0,"aria-expanded":x?"true":void 0,onClick:()=>{b((e=>!e))},children:(0,g.jsx)(d.Z,{})})]}),(0,g.jsx)(u.Z,{sx:{zIndex:9999},open:x,anchorEl:a.current,role:void 0,placement:"bottom-end",children:(0,g.jsx)(p.Z,{children:(0,g.jsx)(m.d,{onClickAway:e=>{a.current&&a.current.contains(e.target)||b(!1)},children:(0,g.jsx)(h.Z,{id:"split-button-menu",autoFocusItem:!0,children:n.map((e=>(0,g.jsx)(f.Z,{onClick:()=>{return n=e.handler,b(!1),void n();var n},children:e.title},e.key)))})})})})]})}x.propTypes={triggers:a().arrayOf(a().shape({key:a().string.isRequired,title:a().string.isRequired,handler:a().func.isRequired})),onEnterEdit:a().func.isRequired,disabled:a().bool.isRequired},x.defaultProps={triggers:[]}},35406:(e,n,t)=>{t.d(n,{Z:()=>a});var i,o=t(71171);const a=t(33518).Z.span(i||(i=(0,o.Z)(["\n color: ",";\n &::before {\n content: '*';\n }\n"])),(e=>e.theme.palette.error.main))},54063:(e,n,t)=>{t.d(n,{C:()=>i});const i="true"===localStorage.getItem("enableDebug")}}]);
|
|
1
|
+
"use strict";(self.webpackChunk_abtnode_webapp=self.webpackChunk_abtnode_webapp||[]).push([[6230],{80378:(e,n,t)=>{t.d(n,{Z:()=>u});var i=t(55898),o=t.n(i),a=t(62681),l=t(72333),r=t(6352),s=t.n(r),c=t(35432),d=t(58238),m=t(46090);var p=t(96266);function u(e){let{blocklet:n,style:t,size:i,ancestors:o,...r}=e;const u=(0,d.h6)(),{logoUrl:f,inService:h}=function(e){var n;let{blocklet:t,ancestors:i=[]}=e;const o=(0,d.h6)(),{inService:a}=o,l="?v=".concat(null===t||void 0===t||null===(n=t.meta)||void 0===n?void 0:n.version).concat((0,m.XN)(null===t||void 0===t?void 0:t.status)?"~":"");let r=a?s()(m.zn,c.WELLKNOWN_SERVICE_PATH_PREFIX,"/blocklet/logo-bundle",l):s()(o.imgPrefix,"blocklet.png");if("registry"===t.source&&t.deployedFrom&&t.meta.logo)r=s()(t.deployedFrom,(0,m.lk)(t.meta.bundleDid,t.meta.logo),l);else{const e=window.env.apiPrefix||"/",n=i.concat(t),o=a?n.slice(1):n;r=s()(e,"/blocklet/logo-bundle".concat(o.map((e=>"/".concat(e.meta.did))).join("")),l)}return{logoUrl:r,inService:a}}({blocklet:n,ancestors:o}),{variant:g}=r,x=h?()=>{}:e=>{e.target.src="".concat(u.imgPrefix,"/blocklet.png")};let b=(0,p.jsx)("img",{src:f,onError:x,alt:n.meta.name,style:{width:i}});return n.meta.logo||(b=(0,p.jsx)(l.Z,{did:n.meta.did||"",responsive:!0})),(0,p.jsx)(a.Z,{variant:g||"square",style:Object.assign({backgroundColor:"transparent",width:i,height:i,borderRadius:10},t),...r,children:b})}u.propTypes={blocklet:o().object.isRequired,style:o().object,size:o().oneOfType([o().number,o().string]),ancestors:o().array},u.defaultProps={style:{},size:40,ancestors:[]}},74286:(e,n,t)=>{t.d(n,{Z:()=>r});var i=t(55898),o=t.n(i),a=t(39948),l=t(96266);function r(e){let{depth:n,className:t}=e;return(0,l.jsx)(a.Z,{ml:Math.max(2*(n-1),0),className:t,sx:{borderBottom:1,borderColor:"rgba(0,0,0,0.12)"}},"group-collapse-box")}r.propTypes={depth:o().number,className:o().string},r.defaultProps={depth:1,className:""}},44784:(e,n,t)=>{t.d(n,{Z:()=>d});var i,o=t(71171),a=t(33518),l=t(82790),r=t(96266);function s(e){let{labelProps:n,className:t,style:i,...o}=e;const a={...n,labelPlacement:(null===n||void 0===n?void 0:n.labelPlacement)||"start"};return(0,r.jsx)(c,{className:t,style:i,children:(0,r.jsx)(l.Z,{labelProps:a,...o})})}s.propTypes=l.Z.propTypes,s.defaultProps=l.Z.defaultProps;const c=a.Z.div(i||(i=(0,o.Z)(["\n max-width: 300px;\n > label {\n display: flex;\n justify-content: space-between;\n width: 100%;\n margin-left: 0;\n margin-right: 0;\n }\n "," {\n max-width: 100%;\n }\n"])),(e=>{let{theme:n}=e;return n.breakpoints.down("sm")})),d=s},59375:(e,n,t)=>{t.d(n,{Z:()=>Z});var i,o=t(71171),a=t(5057),l=t(55898),r=t.n(l),s=t(6352),c=t.n(s),d=t(33518),m=t(92706),p=t.n(m),u=t(39948),f=t(52277),h=t.n(f),g=t(68420),x=t(96266);const b=(0,a.lazy)((()=>Promise.all([t.e(6547),t.e(5760),t.e(6743),t.e(9818),t.e(1294),t.e(6472)]).then(t.bind(t,84804)).then((e=>({default:e.Uploader}))))),v="/blocklet/logo/upload";function Z(e){let{url:n,height:t,width:i,enabled:o,type:l,did:r,prefix:s,headers:d,onUploaded:m}=e;const{t:p}=(0,g.PE)(),f=(0,a.useRef)(null),Z={cursor:o?"pointer":"default","&::after":{content:'"'.concat(p("common.switch"),'"')}};return(0,x.jsxs)(j,{id:"uploader-".concat(r,"-").concat(l),children:[(0,x.jsx)(b,{ref:f,popup:!0,onUploadFinish:()=>{var e;m(),null===(e=f.current)||void 0===e||e.close()},plugins:["ImageEditor"],installerProps:{disabled:!0},apiPathProps:{uploader:c()(s,v,l,r),disableMediaKitPrefix:!0},coreProps:{restrictions:{allowedFileTypes:["image/*",".jpg",".jpeg",".png",".gif",".svg"],maxFileSize:10485760,maxNumberOfFiles:1}},tusProps:{headers:d}}),(0,x.jsx)(u.Z,{className:h()("uploader-wrapper",o&&"enabled"),sx:Z,onClick:()=>{var e;null===(e=f.current)||void 0===e||e.open()},children:(0,x.jsx)("img",{alt:"Logo",src:n,style:{height:t,width:i}})})]},"uploader-".concat(r,"-").concat(l))}Z.propTypes={url:r().string.isRequired,type:r().oneOf(["square","rect","favicon"]).isRequired,did:r().string.isRequired,prefix:r().string.isRequired,headers:r().func,onUploaded:r().func,height:r().number,width:r().any,enabled:r().bool},Z.defaultProps={height:80,width:"auto",enabled:!0,headers:()=>({}),onUploaded:p()};const j=d.Z.div(i||(i=(0,o.Z)(["\n .uploader-wrapper {\n display: inline-flex;\n position: relative;\n font-size: 0px;\n &.enabled {\n cursor: pointer;\n }\n &::after {\n display: none;\n }\n &.enabled::after {\n display: block;\n opacity: 0;\n position: absolute;\n bottom: 0;\n background: rgba(0, 0, 0, 0.2);\n left: 0;\n right: 0;\n height: 2.2em;\n color: white;\n text-align: center;\n font-size: 12px;\n line-height: 2em;\n transition: opacity 0.3s ease;\n }\n &:hover::after {\n opacity: 1;\n }\n }\n"])))},64558:(e,n,t)=>{t.r(n),t.d(n,{default:()=>mt});var i,o=t(71171),a=t(5057),l=t(33518),r=t(55898),s=t.n(r),c=t(96181),d=t(6352),m=t.n(d),p=t(35432),u=t(39948),f=t(55402),h=t(82275),g=t(96399),x=t(65688),b=t(37633),v=t(48037),Z=t(92273),j=t(76720),y=t(15849),C=t(68420),k=t(94464),w=t(38242),S=t(80378),E=t(1722),L=t(43681),P=t.n(L),R=t(50482),T=t.n(R),A=t(16147),_=t(29034),N=t(28726),O=t(80578),I=t(77277),F=t(86229),B=t(28641),z=t(44846),U=t(13727),D=t(56184),K=t(67680),W=t(19654),q=t(90067),G=t(39646),V=t(43897),H=t(47020),M=t(49020),Y=t(35406),J=t(11875),Q=t(95890),X=t(96266);function $(e){let{label:n,disabled:t,required:i,initialValue:o,onChange:l,style:r,onSubmit:s,triggers:c,options:d,formatterBeforeSubmit:m,helperText:p,placeholder:f,renderImage:h,renderLabel:g,filterKeys:x,noEmpty:b,...v}=e;const[Z,j]=(0,a.useState)(!1),[y,C]=(0,a.useState)(!1),[k,w]=a.useState(""),[S,E]=(0,a.useState)(o),[L,P]=(0,a.useState)(S),R=(0,a.useMemo)((()=>{if(!d)return{};const e={};return d.forEach((n=>{e[n.code]=n})),e}),[d]),T=Z?(0,X.jsx)(G.Z,{options:d,value:L,onChange:(e,n)=>{if(!Array.isArray(n))return P([]),void l([]);const t=n.filter((e=>R[e]));if(!t.length)return P([]),void l([]);P(t),l(t)},inputValue:k,onInputChange:(e,n)=>{w(n)},PopperComponent:ne,fullWidth:!0,multiple:!0,variant:"outlined",margin:"dense",filterOptions:()=>{if(!d)return[];if(!k)return d.map((e=>e.code));const e=new RegExp(k.toLowerCase());return d.filter((n=>{for(let i=0;i<x.length;i++){var t;const o=x[i];if(e.test(null===(t=n[o])||void 0===t?void 0:t.toLowerCase()))return!0}return!1})).map((e=>e.code))},getOptionLabel:e=>{var n;return null===(n=R[e])||void 0===n?void 0:n.name},renderInput:e=>(0,X.jsx)(H.Z,{...e,label:"",placeholder:f}),renderOption:(e,n)=>{var t;const i=-1!==L.indexOf(n);return(0,a.createElement)(ee,{component:"li",...e,key:n},h(R[n]||{}),(0,X.jsx)(u.Z,{sx:{"& > img":{mr:2,flexShrink:0}},style:{flex:1,fontWeight:i?"700":"normal"},children:g(n,R[n])||(null===(t=R[n])||void 0===t?void 0:t.name)}),(0,X.jsx)(u.Z,{component:U.default,sx:{opacity:.5,width:18,height:18},style:{visibility:i?"visible":"hidden"}}))},...v}):(0,X.jsx)(u.Z,{px:1,className:"form-item-input slot",style:{whiteSpace:"pre-wrap"},children:L.filter((e=>d.some((n=>n.code===e)))).map((e=>(0,X.jsx)(W.Z,{label:d.find((n=>n.code===e)).name,style:{marginRight:8},size:"small"},e)))});return(0,X.jsx)(J.Z,{className:"form",style:r,children:(0,X.jsxs)(u.Z,{className:"form-item",children:[(0,X.jsxs)(u.Z,{className:"form-item-label",children:[n,i&&(0,X.jsx)(Y.Z,{})]}),(0,X.jsxs)(u.Z,{className:"form-item-body",children:[(0,X.jsx)(u.Z,{className:"form-item-input",children:T}),(0,X.jsx)(u.Z,{className:"form-item-action",children:Z?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(K.Z,{"data-cy":"schema-form-item-confirm",onClick:async()=>{C(!0);try{!1===await s("function"===typeof m?m(L):L)?P(S):b&&!L.length?(P(o),E(o)):(P(L),E(L))}catch(e){P(S)}finally{C(!1),j(!1)}},disabled:t||y,size:"large",children:y?(0,X.jsx)(z.Z,{size:24}):(0,X.jsx)(D.Z,{})}),(0,X.jsx)(K.Z,{"data-cy":"schema-form-item-cancel",onClick:()=>{P(S),j(!1)},disabled:t||y,size:"large",children:(0,X.jsx)(U.default,{})})]}):(0,X.jsx)(Q.Z,{triggers:c,onEnterEdit:()=>j(!0),disabled:t})})]}),Z&&p&&(0,X.jsx)(q.Z,{children:p})]})})}$.propTypes={style:s().object,onSubmit:s().func,onChange:s().func,label:s().string,initialValue:s().string,required:s().bool,disabled:s().bool,triggers:s().array,options:s().array,helperText:s().string,formatterBeforeSubmit:s().func,placeholder:s().string,renderImage:s().func,filterKeys:s().arrayOf(s().string),noEmpty:s().bool,renderLabel:s().func},$.defaultProps={style:{},onSubmit:()=>{},onChange:()=>{},label:"",initialValue:"",required:!1,disabled:!1,triggers:[],options:[],helperText:"",formatterBeforeSubmit:e=>e.join(","),placeholder:"",filterKeys:["name"],renderImage:()=>null,renderLabel:(e,n)=>"",noEmpty:!1};const ee=l.Z.div(i||(i=(0,o.Z)(["\n display: flex;\n justify-content: space-between;\n align-items: center;\n height: 48px;\n border-bottom: 1px solid rgba(0, 0, 0, 0.08);\n font-size: 1.1em;\n"]))),ne=(0,l.Z)(M.Z)((()=>({["& .".concat(V.Z.paper)]:{boxShadow:"0px 8px 12px rgba(92, 92, 92, 0.04), 0px -10px 12px rgba(92, 92, 92, 0.04)",borderRadius:"6px",width:"100%",border:"1px solid rgba(0, 0, 0, 0.12)",color:"inherit",fontSize:13,position:"absolute",left:0,top:0},["& .".concat(V.Z.listbox)]:{padding:0}})));var te,ie=t(58238),oe=t(46090),ae=t(54063),le=t(63406),re=t(78410),se=t(31853),ce=t(22425),de=t(70461),me=t(73545),pe=t(29054);function ue(e){let{initialValue:n,onChange:t,disabled:i,loading:o}=e;const{t:a}=(0,C.PE)(),{api:l}=(0,me.T)(),{blocklet:r}=(0,pe.y0)(),[s,c]=(0,se.Z)({newAppSk:"",isConnectOpen:!1}),d=()=>c({isConnectOpen:!1}),m=r.structVersion===p.APP_STRUCT_VERSION?[{key:"rotate-with-did-wallet",title:"Migrate with DID Wallet",handler:()=>{(0,oe.An)(r.status)?F.Z.error(a("blocklet.error.isRunning")):(0,w.isInProgress)(r.status)?F.Z.error(a("blocklet.error.isInProgress")):c({isConnectOpen:!0})}}]:[];return[(0,X.jsx)(B.Z,{disabled:i,loading:o,initialValue:n,onSubmit:e=>(c({newAppSk:e}),!1),triggers:m,secure:!0}),s.newAppSk&&(0,X.jsx)(de.Z,{title:a("blocklet.config.appSkTitle"),description:(0,X.jsxs)(u.Z,{children:[(0,X.jsx)(u.Z,{children:a("blocklet.config.appSkChangeTip")}),(0,X.jsx)(u.Z,{fontWeight:"bold",mt:2,children:a("blocklet.config.appDidChangeTip")}),(0,X.jsxs)(fe,{children:[(0,X.jsx)("li",{children:a("blocklet.config.appDidChangeTipL1")}),(0,X.jsx)("li",{children:a("blocklet.config.appDidChangeTipL2")})]})]}),confirm:a("confirm"),cancel:a("cancel"),onConfirm:()=>(async e=>{try{await t(e)}finally{c({newAppSk:""})}})(s.newAppSk),onCancel:()=>c({newAppSk:""})}),(0,X.jsx)(ce.Z,{popup:!0,open:s.isConnectOpen,forceConnected:!1,saveConnect:!1,action:"rotate-key-pair",checkFn:l.get,checkTimeout:3e5,onSuccess:d,extraParams:{appDid:r.appDid},messages:{title:a("setup.keyPair.title"),scan:a("setup.keyPair.scan"),confirm:a("setup.keyPair.confirm"),success:a("setup.keyPair.success")},onClose:d})]}ue.propTypes={initialValue:s().string,onChange:s().func,disabled:s().bool,loading:s().bool},ue.defaultProps={initialValue:"default",onChange:()=>{},disabled:!1,loading:!1};const fe=(0,l.Z)("ul")(te||(te=(0,o.Z)(["\n padding-left: 16px;\n li {\n margin-top: 8px;\n list-style: disk;\n font-weight: bold;\n }\n"])));var he,ge=t(13128),xe=t(55372),be=t(11750),ve=t(88574),Ze=t(26174),je=t(88092),ye=t(50185),Ce=t(17425);function ke(e){let{onCancel:n,onSuccess:t,onError:i}=e;const{api:o}=(0,a.useContext)(me.B),[l,r]=(0,a.useState)(!1),{t:s,locale:c}=(0,C.PE)(),[d,m]=(0,a.useState)(""),[p,f]=(0,a.useState)(!1),[h,g]=(0,a.useState)(0),[x,b]=(0,a.useState)(""),{endpoint:v}=(0,Ce.DJ)(),[Z,j]=(0,a.useState)(!1),y=e=>{m(null),r(!0);try{b(e.result),g(w.length-1)}catch(n){const e=(0,oe.Z)(n);m(e),i(n)}finally{r(!1)}},k=()=>{f(!1),g(0)},w=[{body:(0,X.jsxs)(u.Z,{children:[(0,X.jsx)(be.Z,{children:s("team.transferApp.transferDialog.tips.progress")}),(0,X.jsx)(be.Z,{mt:3,mb:2,children:s("team.transferApp.transferDialog.tips.newOwnerPermissions")})]}),cancel:s("common.cancel"),confirm:s("team.transferApp.transferDialog.createTransferLink"),onCancel:n,onConfirm:()=>{f(!0),g(1)}},{body:()=>(0,X.jsx)(ce.Z,{action:"transfer-app-owner",open:p,locale:c,checkFn:o.get,onClose:k,onSuccess:y,checkTimeout:3e5,extraParams:{},messages:{title:s("team.transferApp.connectDialog.title"),scan:s("team.transferApp.connectDialog.scan"),confirm:s("team.transferApp.connectDialog.confirm"),success:s("team.transferApp.connectDialog.success")},popup:!0})},{body:()=>{const e=(0,oe.VP)({transferId:x.transferId,endpoint:v});return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(u.Z,{component:we,dangerouslySetInnerHTML:{__html:s("team.transferApp.transferDialog.createSuccessTip1")}}),(0,X.jsx)(u.Z,{component:we,mt:2,children:(0,X.jsx)(we,{children:s("team.transferApp.transferDialog.createSuccessTip3")})}),(0,X.jsxs)(u.Z,{children:[(0,X.jsx)(u.Z,{component:we,mt:2,children:(0,X.jsx)(we,{children:s("team.transferApp.transferDialog.createSuccessTip2",{expireDate:(0,oe.B2)(x.expireDate,c)})})}),(0,X.jsx)(u.Z,{my:1,children:(0,X.jsx)(ye.Z,{children:e})})]}),(0,X.jsx)("div",{children:(0,X.jsx)(Ze.Z,{value:"end",control:(0,X.jsx)(je.Z,{checked:Z,onChange:e=>j(e.target.checked)}),label:s("team.transferApp.transferDialog.iKnow"),labelPlacement:"end"})})]})},confirm:s("common.confirm"),onConfirm:t}],S=w[h];return(0,X.jsxs)(ge.ZP,{title:(0,X.jsx)(we,{className:"title",children:s("team.transferApp.transferDialog.title")}),fullWidth:!0,open:!0,showCloseButton:!1,actions:(0,X.jsxs)(X.Fragment,{children:[S.cancel&&(0,X.jsx)(N.Z,{onClick:S.onCancel,color:"inherit",children:S.cancel}),(0,X.jsxs)(N.Z,{onClick:S.onConfirm,color:"error",disabled:l||h===w.length-1&&!Z,variant:"contained",autoFocus:!0,children:[l&&(0,X.jsx)(z.Z,{size:16}),S.confirm]})]}),children:[(0,X.jsx)(xe.Z,{component:"div",children:"function"===typeof S.body?S.body():S.body}),!!d&&(0,X.jsx)(ve.Z,{type:"error",variant:"icon",children:d})]})}ke.propTypes={onCancel:s().func.isRequired,onSuccess:s().func.isRequired,onError:s().func},ke.defaultProps={onError:()=>{}};const we=l.Z.div(he||(he=(0,o.Z)(["\n font-size: 16px;\n font-weight: bold;\n &.title {\n font-size: 20px;\n }\n"])));var Se,Ee=t(49522),Le=t(59375);const Pe=Object.keys(I.SUPPORTED_LANGUAGES).map((e=>({code:e,name:I.SUPPORTED_LANGUAGES[e].nativeName,enName:I.SUPPORTED_LANGUAGES[e].name}))),Re=["name","enName","code"];function Te(e){var n;let{blocklet:t,onUpdate:i,hasPermission:o,...l}=e;const{api:r,inService:s,prefix:c,getSessionInHeader:d,ws:{useSubscription:m}}=(0,ie.h6)(),{t:f}=(0,a.useContext)(C.RD),[h,g]=(0,a.useState)(""),[x,b]=(0,a.useState)(""),[v,Z]=(0,a.useState)(!1),j=(0,w.getWhoCanAccess)(t),y=null===t||void 0===t||null===(n=t.settings)||void 0===n?void 0:n.publicToStore,k=x||!o,{logoUrl:S,rectLogoUrl:E,faviconUrl:L}=(0,Ee.Z)({blocklet:t}),{did:R}=t.meta,{site:z}=t,U=P()(t.meta,"capabilities.clusterMode",!1);if(m(p.EVENTS.NODE_RUNTIME_INFO,(e=>{U&&g(P()(e,"cpu.physicalCores",""))})),(0,oe.wS)(t.status))return null;const D=t.environments.find((e=>e.key===I.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_DELETABLE)),K=!D||"yes"===D.value,W=t.environments.find((e=>e.key===I.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_LANGUAGES)),q=t.environments.find((e=>e.key===I.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_URL)),G=t.environments.find((e=>e.key===I.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_COPYRIGHT_OWNER)),V=t.environments.find((e=>e.key===I.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_COPYRIGHT_YEAR)),H=[{key:I.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_NAME,description:f("blocklet.config.name"),value:t.environments.find((e=>"BLOCKLET_APP_NAME"===e.key)).value},{key:I.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_DESCRIPTION,description:f("blocklet.config.description"),value:t.environments.find((e=>"BLOCKLET_APP_DESCRIPTION"===e.key)).value},{key:I.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_URL,description:f("blocklet.config.appUrl"),value:q?q.value:""},{key:I.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_COPYRIGHT_OWNER,description:f("blocklet.config.copyrightOwner"),value:G?G.value:""},{key:I.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_COPYRIGHT_YEAR,description:f("blocklet.config.copyrightYear"),value:V?V.value:""}];if(U){const e=t.configs.find((e=>e.key===I.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_CLUSTER_SIZE)),n=e?e.value:h;H.push({key:I.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_CLUSTER_SIZE,description:f("blocklet.config.clusterSize"),value:n,cpuCores:h})}const M=async(e,n)=>{if(e===I.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_CLUSTER_SIZE){const e=(0,oe.I)({value:n,cpuCores:h});if(e)return void F.Z.error(e)}const o=[{key:e,value:n}];try{b(!0);const{blocklet:e}=await r.configBlocklet({input:{did:t.meta.did,configs:o}});i(e)}catch(a){F.Z.error(a.message)}finally{b(!1)}};return(0,X.jsxs)(Oe,{...l,children:[H.map((e=>(0,X.jsxs)(u.Z,{className:"config-form",mt:2,children:[(0,X.jsx)(u.Z,{className:"config-label",fontSize:14,mb:0,children:e.description}),(0,X.jsx)(B.Z,{style:{marginTop:0},disabled:x||k,loading:x,initialValue:e.value,onSubmit:n=>M(e.key,n)})]}))),(0,X.jsx)(u.Z,{className:"config-form",component:_.Z,my:3}),(0,X.jsx)(u.Z,{className:"config-label",fontSize:14,mb:1,sx:{flexGrow:0,width:"auto"},children:f("blocklet.config.logoSquare")}),(0,X.jsx)(Le.Z,{did:t.meta.did,height:80,width:80,type:"square",prefix:c,url:S,enabled:o,headers:d}),(0,X.jsx)(u.Z,{className:"config-label",fontSize:14,mt:4,children:f("blocklet.config.logoRect")}),(0,X.jsx)(u.Z,{mb:1.5,className:"config-desc",children:f("blocklet.config.logoRectDesc")}),(0,X.jsx)(Le.Z,{did:t.meta.did,height:80,type:"rect",prefix:c,url:E,enabled:o,headers:d}),(0,X.jsx)(u.Z,{className:"config-label",fontSize:14,mt:4,children:f("blocklet.config.logoFavicon")}),(0,X.jsx)(u.Z,{mb:1.5,className:"config-desc",children:f("blocklet.config.logoFaviconDesc")}),(0,X.jsx)(Le.Z,{did:t.meta.did,height:25,width:25,type:"favicon",prefix:c,url:L,enabled:o,headers:d}),(0,X.jsx)(u.Z,{className:"config-form",children:"all"===j&&"registry"===t.source&&(0,X.jsxs)(u.Z,{className:"config-item",children:[(0,X.jsxs)(u.Z,{className:"config-label",children:[f("blocklet.config.access.publicToStore"),(0,X.jsx)(u.Z,{className:"config-desc",children:f("blocklet.config.access.publicInstanceTip")})]}),(0,X.jsx)(A.Z,{disabled:k,checked:y,defaultChecked:!0,onChange:async e=>{if(!x){b(!0);try{const{checked:n}=e.target,{blocklet:o}=await r.configPublicToStore({input:{did:t.meta.did,publicToStore:n}});i(o)}catch(n){F.Z.error(n.message)}finally{b(!1)}}}})]})}),(0,X.jsx)(u.Z,{className:"config-form",component:_.Z,my:3}),(0,X.jsxs)(u.Z,{className:"config-form",mt:2,children:[(0,X.jsx)(u.Z,{className:"config-label",fontSize:14,mb:0,children:f("blocklet.config.languages")}),(0,X.jsx)($,{style:{marginTop:0},disabled:x||k,loading:x,options:Pe,noEmpty:!0,initialValue:W?W.value.split(","):["en","zh"],onSubmit:e=>M("BLOCKLET_APP_LANGUAGES",e),helperText:f("blocklet.config.selectLanguagesTip"),placeholder:f("blocklet.config.languagesSearch"),filterKeys:Re,renderLabel:(e,n)=>n.name===n.enName?"".concat(n.name," (").concat(e.toUpperCase(),")"):"".concat(n.name,", ").concat(n.enName," (").concat(e.toUpperCase(),")")})]}),(0,X.jsx)(u.Z,{className:"config-form",component:_.Z,my:3}),(0,X.jsx)(u.Z,{className:"config-form",mt:2,children:(0,X.jsx)(u.Z,{className:"config-label",mb:0,children:f("common.security")})}),(0,X.jsxs)(u.Z,{className:"config-form",mt:2,children:[(0,X.jsx)(u.Z,{className:"config-label",fontSize:14,mb:0,children:f("router.domainSecurity.cors.title")}),(0,X.jsx)(u.Z,{mb:1.5,className:"config-desc",children:f("router.domainSecurity.cors.description",{name:"the blocklet"})}),(0,X.jsx)(B.Z,{style:{marginTop:0},disabled:x||k,loading:x,initialValue:(z.corsAllowedOrigins||[]).join(", "),onSubmit:async e=>{const n=z.corsAllowedOrigins||[],i=e.split(",").map((e=>e.trim())).filter(Boolean);if(T()(n,i))return!1;try{b(!0);const e=i.length?i:["__none__"];await r.updateRoutingSite({input:{id:z.id,corsAllowedOrigins:e,teamDid:t.meta.did}}),b(!1)}catch(o){return F.Z.error(o.message),b(!1),!1}return!0}})]}),(0,X.jsx)(u.Z,{className:"config-form",component:_.Z,my:3}),(0,X.jsx)(u.Z,{mb:2,className:"config-label",fontSize:20,children:f("blocklet.config.dangerZone")}),(0,X.jsxs)(u.Z,{px:2,py:1,sx:{border:"1px solid red",borderRadius:2},children:[(0,X.jsx)(u.Z,{className:"config-form",mt:2,children:!s&&(0,X.jsxs)(u.Z,{className:"config-item",children:[(0,X.jsxs)(u.Z,{className:"config-label",children:[f("blocklet.config.deletable.name"),(0,X.jsx)(u.Z,{className:"config-desc",children:f(K?"blocklet.config.deletable.disable":"blocklet.config.deletable.enable")})]}),(0,X.jsx)(A.Z,{disabled:k,checked:!K,defaultChecked:!0,onChange:async e=>{if(!x){b(!0);try{const{checked:n}=e.target,{blocklet:o}=await r.configBlocklet({input:{did:t.meta.did,configs:[{key:I.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_DELETABLE,value:n?"no":"yes"}]}});i(o)}catch(n){F.Z.error(n.message)}finally{b(!1)}}}})]})}),(0,X.jsxs)(u.Z,{className:"config-form",mt:2,children:[(0,X.jsx)(u.Z,{className:"config-label",fontSize:14,mb:0,children:f("blocklet.config.sk")}),(0,X.jsx)(ue,{disabled:x||k,loading:x,initialValue:t.environments.find((e=>"BLOCKLET_APP_SK"===e.key)).value,onChange:async e=>{if(!x){b(!0);try{const{blocklet:n}=await r.configBlocklet({input:{did:t.meta.did,configs:[{key:I.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_SK,value:e}]}});i(n)}catch(n){F.Z.error(n.message)}finally{b(!1)}}}})]}),s&&(0,X.jsx)(le.Z,{role:"owner",children:e=>(e||ae.C)&&(0,X.jsxs)(u.Z,{className:"config-form",mt:2,children:[(0,X.jsxs)(u.Z,{className:"config-item",children:[(0,X.jsx)(u.Z,{className:"config-label",mb:0,children:f("team.transferApp.name")}),(0,X.jsxs)(N.Z,{style:{flexShrink:0},variant:"contained",edge:"end",color:"error",size:"small","data-cy":"transfer-app",onClick:()=>Z(!0),children:[(0,X.jsx)(O.Z,{style:{fontSize:"1.3em",marginRight:4}}),f("team.transferApp.name")]})]}),v&&(0,X.jsx)(ke,{onCancel:()=>Z(!1),onSuccess:()=>Z(!1)})]})}),(0,X.jsx)(u.Z,{className:"config-form",mt:2,children:(0,X.jsxs)(u.Z,{className:"config-item",children:[(0,X.jsxs)(u.Z,{className:"config-label",children:[f("blocklet.config.clearCache.name"),(0,X.jsx)(u.Z,{className:"config-desc",children:f("blocklet.config.clearCache.purpose")})]}),(0,X.jsx)(re.Z,{teamDid:R})]})})]})]})}const Ae=(0,le.V)(Te,"mutate_blocklets"),_e=(0,le.V)(Te,"",oe.Wf);function Ne(e){const{inService:n}=(0,ie.h6)();return n?(0,X.jsx)(_e,{...e}):(0,X.jsx)(Ae,{...e})}Te.propTypes={blocklet:s().object.isRequired,onUpdate:s().func,hasPermission:s().bool},Te.defaultProps={onUpdate:()=>{},hasPermission:!1};const Oe=l.Z.div(Se||(Se=(0,o.Z)(["\n padding-top: 24px;\n .config-form {\n flex-grow: 1;\n overflow-y: auto;\n "," {\n width: 100%;\n flex-shrink: 0;\n padding: 0 24px;\n transform: translate(0, 0);\n }\n }\n\n .config-item {\n display: flex;\n align-items: center;\n justify-content: space-between;\n margin: 16px 0;\n }\n\n .config-label {\n font-weight: bold;\n }\n\n .config-desc {\n font-weight: normal;\n font-size: 12px;\n color: #666;\n }\n\n .form-item {\n margin-top: 0;\n }\n"])),(e=>e.theme.breakpoints.down("md")));var Ie=t(25710),Fe=t(93066),Be=t(80576),ze=t(8708),Ue=t.n(ze),De=t(12673),Ke=t(99360),We=t(80506),qe=t(766),Ge=t.n(qe),Ve=t(24529),He=t.n(Ve),Me=t(16727),Ye=t.n(Me),Je=t(92706),Qe=t.n(Je);const Xe=(0,a.forwardRef)(((e,n)=>{const{t:t}=(0,a.useContext)(C.RD),i=(0,De.Z)({show:!1,title:"",content:"",onConfirm:Qe(),onCancel:Qe(),loading:!1}),o=(0,Ke.Z)((function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};i.show=!0,i.title=e.title,i.content=e.content,i.onConfirm=e.onConfirm||Qe(),i.onCancel=e.onCancel||Qe(),i.loading=!1})),l=(0,Ke.Z)((()=>{i.title="",i.content="",i.onConfirm=Qe(),i.onCancel=Qe()})),r=(0,Ke.Z)((()=>{i.show=!1,setTimeout((()=>{l()}),300)})),s=(0,Ke.Z)((()=>{r(),null===i||void 0===i||i.onCancel()}),[]),c=(0,Ke.Z)((async()=>{i.loading=!0;try{await(null===i||void 0===i?void 0:i.onConfirm(r))}finally{i.loading=!1}}),[]);return(0,a.useImperativeHandle)(n,(()=>({open:o,close:r})),[o,r]),(0,X.jsx)(ge.I4,{open:i.show,title:i.title,onConfirm:c,onCancel:s,confirmButton:{text:t("common.confirm"),props:{variant:"contained",color:"primary",loading:i.loading}},cancelButton:{text:t("common.cancel"),props:{variant:"outlined",color:"primary"}},children:i.content instanceof Function?i.content():i.content})}));function $e(){const e=(0,a.useRef)(null),n=(0,Ke.Z)((function(){for(var n,t=arguments.length,i=new Array(t),o=0;o<t;o++)i[o]=arguments[o];null===(n=e.current)||void 0===n||n.open(...i)})),t=(0,Ke.Z)((function(){for(var n,t=arguments.length,i=new Array(t),o=0;o<t;o++)i[o]=arguments[o];null===(n=e.current)||void 0===n||n.close(...i)})),i={open:n,close:t};return{confirmHolder:(0,X.jsx)(Xe,{ref:e}),confirmApi:i}}const en={enabled:!1,secure:!1,from:"",host:"",port:"",user:"",password:""};const nn=function(){var e,n;const{api:t}=(0,ie.h6)(),{blocklet:i}=(0,pe.y0)(),{t:o}=(0,C.PE)(),{confirmApi:a,confirmHolder:l}=$e(),r=null===i||void 0===i||null===(e=i.meta)||void 0===e?void 0:e.did,s=Object.assign({...en},(null===i||void 0===i||null===(n=i.settings)||void 0===n||null===(n=n.notification)||void 0===n?void 0:n.email)||{}),{handleSubmit:c,control:d,formState:m,watch:p,reset:f}=(0,We.cI)({defaultValues:Ue()(s,Object.keys(en))}),h=(0,De.Z)({testReceiver:"",testReceiverError:""}),g=p("enabled"),x=(0,Ke.Z)((async function(e,n){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];try{var a;const{blocklet:n}=await t.configNotification({input:{did:r,notification:JSON.stringify({email:e})}}),l=Object.assign({...en},(null===n||void 0===n||null===(a=n.settings)||void 0===a||null===(a=a.notification)||void 0===a?void 0:a.email)||{});f(l),i&&F.Z.success(o("oauth.saveSuccess"))}catch(l){if(!i)throw l;F.Z.error(l.message||o("oauth.saveFailed"))}})),b=(0,Ke.Z)((async(e,n,i)=>{try{m.isDirty&&await x(e,n,!1),await t.sendEmail({input:{did:r,receiver:i,email:JSON.stringify({body:"Your SMTP configuration is correct!",title:"Test email",type:"notification"})}}),F.Z.success(o("notification.email.testSuccess"))}catch(a){F.Z.error(a.message||o("notification.email.testfailed"))}})),v=(0,Ke.Z)(((e,n)=>{h.testReceiver="",h.testReceiverError="",a.open({title:o("notification.email.testSendEmail"),content:()=>(0,X.jsx)(u.Z,{sx:{width:"300px"},children:(0,X.jsx)(H.Z,{fullWidth:!0,name:"testReceiver",label:o("notification.email.inputTestReceiver"),value:h.testReceiver,onChange:e=>{h.testReceiver=e.target.value},error:!!h.testReceiverError,helperText:h.testReceiverError||"\u3000"})}),async onConfirm(t){var i;const a=null===(i=h.testReceiver)||void 0===i?void 0:i.trim();a?Ge()(a)?(h.testReceiverError="",await b(e,n,a),t()):h.testReceiverError=o("notification.email.receiverInvalid"):h.testReceiverError=o("notification.email.receiverRequired")}})})),Z=(0,Ke.Z)((e=>{const n=null===e||void 0===e?void 0:e.trim();return n?!!Ge()(n)||o("notification.email.fromInvalid"):o("notification.email.fromRequired")})),j=(0,Ke.Z)((e=>{const n=null===e||void 0===e?void 0:e.trim();return n?!!He()(n,{require_host:!1,protocols:[]})||o("notification.email.hostInvalid"):o("notification.email.hostRequired")})),y=(0,Ke.Z)((e=>e?!!Ye()(e)||o("notification.email.portInvalid"):o("notification.email.portRequired"))),k=(0,Ke.Z)((e=>!(null===e||void 0===e||!e.trim())||o("notification.email.userRequired"))),w=(0,Ke.Z)((e=>!(null===e||void 0===e||!e.trim())||o("notification.email.passwordRequired"))),S=(0,Ke.Z)((()=>!0));return(0,X.jsxs)(u.Z,{children:[(0,X.jsxs)("form",{onSubmit:c(x),disabled:!0,children:[(0,X.jsx)(We.Qr,{name:"enabled",control:d,render:e=>{let{field:n}=e;return(0,X.jsx)(Ze.Z,{control:(0,X.jsx)(A.Z,{checked:n.value,...n}),label:o("notification.email.enable"),sx:{marginBottom:"8px"}})}}),(0,X.jsx)(We.Qr,{name:"from",control:d,rules:{validate:g?Z:S},render:e=>{var n;let{field:t}=e;return(0,X.jsx)(Be.Z,{fullWidth:!0,children:(0,X.jsx)(H.Z,{...t,label:o("notification.email.from"),error:!!m.errors[t.name],helperText:(null===(n=m.errors[t.name])||void 0===n?void 0:n.message)||"\u3000",disabled:!g})})}}),(0,X.jsx)(We.Qr,{name:"host",control:d,rules:{validate:g?j:S},render:e=>{var n;let{field:t}=e;return(0,X.jsx)(Be.Z,{fullWidth:!0,children:(0,X.jsx)(H.Z,{...t,error:!!m.errors[t.name],label:o("notification.email.host"),helperText:(null===(n=m.errors[t.name])||void 0===n?void 0:n.message)||"\u3000",disabled:!g})})}}),(0,X.jsx)(We.Qr,{name:"port",control:d,rules:{validate:g?y:S},render:e=>{var n;let{field:t}=e;return(0,X.jsx)(Be.Z,{fullWidth:!0,children:(0,X.jsx)(H.Z,{...t,type:"number",error:!!m.errors[t.name],label:o("notification.email.port"),helperText:(null===(n=m.errors[t.name])||void 0===n?void 0:n.message)||"\u3000",disabled:!g})})}}),(0,X.jsx)(We.Qr,{name:"user",control:d,rules:{validate:g?k:S},render:e=>{var n;let{field:t}=e;return(0,X.jsx)(Be.Z,{fullWidth:!0,children:(0,X.jsx)(H.Z,{...t,error:!!m.errors[t.name],label:o("notification.email.user"),helperText:(null===(n=m.errors[t.name])||void 0===n?void 0:n.message)||"\u3000",disabled:!g})})}}),(0,X.jsx)(We.Qr,{name:"password",control:d,rules:{validate:g?w:S},render:e=>{var n;let{field:t}=e;return(0,X.jsx)(Be.Z,{fullWidth:!0,children:(0,X.jsx)(H.Z,{...t,type:"password",error:!!m.errors[t.name],label:o("notification.email.password"),helperText:(null===(n=m.errors[t.name])||void 0===n?void 0:n.message)||"\u3000",disabled:!g})})}}),(0,X.jsx)(We.Qr,{name:"secure",control:d,rules:{validate:S},render:e=>{let{field:n}=e;return(0,X.jsx)(Be.Z,{fullWidth:!0,children:(0,X.jsx)(Ze.Z,{control:(0,X.jsx)(A.Z,{checked:n.value,...n,disabled:!g}),label:o("notification.email.secure"),style:{marginBottom:16}})})}}),(0,X.jsx)(N.Z,{variant:"outlined",color:"warning",onClick:c(v),sx:{mr:2},disabled:!g,children:o("oauth.runTest")}),(0,X.jsx)(N.Z,{type:"submit",variant:"contained",disabled:!m.isDirty,children:o("oauth.save")})]}),l]})},tn=[{label:(0,X.jsx)(u.Z,{textAlign:"center",width:"100%",children:"Email"}),value:"email"},{label:(0,X.jsx)(u.Z,{textAlign:"center",width:"100%",children:"More"}),value:"more"}];const on=function(){const[e,n]=(0,a.useState)(tn[0].value),{t:t}=(0,a.useContext)(C.RD),i=(0,Fe.Z)((()=>({email:(0,X.jsx)(nn,{}),more:(0,X.jsx)(u.Z,{children:(0,X.jsx)(Ie.Z,{children:t("notification.comingSoon")})})})),[t]);return(0,X.jsxs)(u.Z,{children:[(0,X.jsx)(k.Z,{tabs:tn,current:e,onChange:n}),(0,X.jsx)(u.Z,{marginTop:"10px",children:i[e]})]})};var an=t(96366),ln=t(75239),rn=t(48342),sn=t(94552),cn=t(24558),dn=t(74286),mn=t(74490),pn=t(76667),un=t(70648),fn=t(44067),hn=t(7664),gn=t(44123),xn=t(53906);const bn=[{value:p.WHO_CAN_ACCESS.ALL,icon:xn.Z,title:{zh:"\u6240\u6709\u4eba\u53ef\u8bbf\u95ee",en:"Accessible to all"},description:{zh:"\u5411\u6240\u6709\u4eba\u5f00\u653e\uff0c\u65e0\u9700\u901a\u884c\u8bc1\u5373\u53ef\u8bbf\u95ee\u5e94\u7528",en:"Open to the world anyone can access without passport"}},{value:p.WHO_CAN_ACCESS.INVITED,icon:gn.Z,title:{zh:"\u53ea\u6709\u88ab\u9080\u8bf7\u7684\u4eba\u53ef\u4ee5\u8bbf\u95ee",en:"Only invited people can access"},description:{zh:"\u7a0d\u540e\u60a8\u53ef\u4ee5\u5728\u7ba1\u7406\u9875\u9762\u4e2d\u9080\u8bf7\u6210\u5458",en:"You can invite members later in the admin page"}},{value:p.WHO_CAN_ACCESS.OWNER,icon:hn.Z,title:{zh:"\u53ea\u6709\u5e94\u7528\u6240\u6709\u8005\u53ef\u4ee5\u8bbf\u95ee",en:"Only Owner of the blocklet can access"},description:{zh:"\u5fc5\u987b\u63d0\u4f9b\u6240\u6709\u8005\u901a\u884c\u8bc1\u624d\u80fd\u8bbf\u95ee\u5e94\u7528",en:"You must provide owner passport to access this application"}}];var vn,Zn;const jn="roles",yn=[...bn,{value:jn,icon:un.Z,title:{zh:"\u6307\u5b9a\u901a\u884c\u8bc1\u53ef\u8bbf\u95ee",en:"Accessible to selected passports"},description:{zh:"\u53ea\u6709\u6307\u5b9a\u7684\u901a\u884c\u8bc1\u53ef\u4ee5\u8bbf\u95ee",en:"Only specified passports can access"}}],Cn=(e,n)=>{if(e&&e.startsWith(p.WHO_CAN_ACCESS_PREFIX_ROLES)){const t=(0,w.getRolesFromAuthConfig)({whoCanAccess:e}),i=n.filter((e=>t.includes(e.name)));return{access:jn,roles:i}}return{access:e,roles:[]}},kn=function(e,n){let{roles:t=[]}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const i=(e.configs||[]).find((e=>e.key===I.BLOCKLET_CONFIGURABLE_KEY.COMPONENT_ACCESS_WHO));if(i)return Cn(i.value,t);if(n&&P()(n,"settings.whoCanAccess")&&P()(n,"settings.whoCanAccess")!==p.WHO_CAN_ACCESS.ALL)return Cn(P()(n,"settings.whoCanAccess"),t);const o=(0,w.findServiceFromMeta)(e.meta,p.NODE_SERVICES.AUTH);return P()(o,"config.whoCanAccess")?Cn(o.config.whoCanAccess,t):{access:p.WHO_CAN_ACCESS.ALL,roles:[]}};function wn(e){let{blocklet:n,ancestors:t,children:i}=e;const o=(0,an.Z)(),[l,r]=(0,a.useState)(""),{t:s,locale:c}=(0,C.PE)(),{api:d}=(0,ie.h6)(),{roles:m}=(0,Ce.DJ)(),[f,h]=(0,a.useState)(""),g=t[0]||n,{access:x,roles:b}=kn(n,g,{roles:m}),[v,Z]=(0,a.useState)(x),[j,y]=(0,a.useState)(b),k=[...t.map((e=>e.meta.did)),n.meta.did],S={marginRight:4,fontSize:18,verticalAlign:"text-bottom",color:o.palette.text.secondary},E=t.concat(n).map((e=>(0,w.getDisplayName)(e,!0))).join(" / ");if((0,oe.wS)(n.status))return null;if("unknown"===n.status&&(0,oe.wS)(n.status))return null;const L=()=>{r(!1)},P=e=>{e.stopPropagation(),r(!0)},R=f||v===jn&&!j.length;return["function"===typeof i?i({open:P}):(0,X.jsx)(K.Z,{onClick:P,"data-cy":"action-config-component",children:(0,X.jsx)(pn.default,{})}),l&&(0,X.jsxs)(Sn,{open:!0,fullWidth:!0,title:E,onClose:L,PaperProps:{style:{minHeight:"auto"}},actions:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(N.Z,{onClick:L,color:"inherit","data-cy":"config-access-cancel",children:s("common.cancel")}),(0,X.jsxs)(N.Z,{onClick:async()=>{if(!f){h(!0);try{let e=v;e===jn&&(e="".concat(p.WHO_CAN_ACCESS_PREFIX_ROLES).concat(j.map((e=>e.name)).join(","))),await d.updateWhoCanAccess({input:{did:k,whoCanAccess:e}}),F.Z.success(s("blocklet.config.access.updatedTip")),L(),h(!1)}catch(e){h(!1),F.Z.error((0,oe.Z)(e))}}},color:"primary",disabled:R,variant:"contained",autoFocus:!0,"data-cy":"config-access-confirm",children:[f&&(0,X.jsx)(z.Z,{size:16}),s("common.confirm")]})]}),children:[(0,X.jsx)(u.Z,{mt:4,mb:3,children:(0,X.jsx)(H.Z,{label:s("blocklet.config.access.description"),select:!0,fullWidth:!0,value:v,onChange:e=>{const{value:n}=e.target;Z(n)},"data-cy":"config-access-select",SelectProps:{renderValue:e=>{const n=yn.find((n=>n.value===e));return n?(0,X.jsxs)(u.Z,{children:[(0,X.jsx)(n.icon,{style:S}),n.title[c]]}):null}},children:yn.map((e=>(0,X.jsxs)(En,{value:e.value,sx:{display:"block"},"data-cy":"config-access-opt-".concat(e.value),children:[(0,X.jsxs)(u.Z,{display:"flex",alignItems:"center",children:[(0,X.jsx)(e.icon,{style:S}),(0,X.jsx)(u.Z,{children:e.title[c]})]}),(0,X.jsx)(u.Z,{children:(0,X.jsx)(u.Z,{className:"tip",children:e.description[c]})})]})))})}),v===jn&&(0,X.jsx)(u.Z,{mt:4,mb:3,children:(0,X.jsx)(H.Z,{label:s("blocklet.config.access.description"),select:!0,fullWidth:!0,value:j.map((e=>e.name)),onChange:e=>{y(m.filter((n=>(e.target.value||[]).includes(n.name))))},SelectProps:{multiple:!0,renderValue:e=>(0,X.jsx)(u.Z,{sx:{display:"flex",flexWrap:"wrap",gap:.5},children:e.map((e=>{const n=m.find((n=>n.name===e));return(0,X.jsx)(W.Z,{label:n.title},n.text)}))})},children:m.map((e=>{let{name:n,title:t}=e;return(0,X.jsxs)(mn.Z,{value:n,children:[(0,X.jsx)(je.Z,{checked:j.some((e=>e.name===n))}),(0,X.jsx)(fn.Z,{primary:t})]},n)}))})})]})]}wn.propTypes={blocklet:s().object.isRequired,ancestors:s().array,children:s().any},wn.defaultProps={ancestors:[],children:null};const Sn=(0,l.Z)(ge.ZP)(vn||(vn=(0,o.Z)(["\n .MuiDialogContent-root {\n padding-top: 0;\n margin-top: -32px;\n }\n .MuiToolbar-root {\n padding-right: 12px;\n }\n .ux-dialog_right {\n padding-right: 20px;\n }\n"]))),En=(0,l.Z)(mn.Z)(Zn||(Zn=(0,o.Z)(["\n .tip {\n font-size: 12px;\n color: ",";\n }\n"])),(e=>e.theme.palette.text.secondary));var Ln;function Pn(e){var n;let{blocklet:t,ancestors:i,depth:o}=e;const l=(0,an.Z)(),{t:r,locale:s}=(0,C.PE)(),{roles:c}=(0,Ce.DJ)(),[d,m]=(0,a.useState)(!0),{recommendedDomain:p}=(0,pe.y0)(),f=i[0]||t,h="/".concat(i.map((e=>e.mountPoint||"/")).join("/"),"/").concat(t.mountPoint||"/").replace(/\/+/g,"/"),g=(0,oe.vH)({blocklet:f,domain:{value:p},mountPoint:h,params:(0,oe.f0)(f,s)}),x={fill:l.palette.text.secondary},b=o>0&&t.children.length>0,v=(0,X.jsx)(K.Z,{size:"small",children:d?(0,X.jsx)(j.Z,{fontSize:"inherit"}):(0,X.jsx)(Z.default,{fontSize:"inherit"})}),{access:y,roles:k}=kn(t,f,{roles:c});let E;if("roles"!==y)E=bn.find((e=>e.value===y))||bn[2];else{const e=k.map((e=>e.title)).join("/");E={title:{zh:"\u53ea\u6709 ".concat(e," \u53ef\u4ee5\u8bbf\u95ee"),en:"Only ".concat(e," can access")}}}return[(o>0||"gateway"!==t.meta.group)&&(0,X.jsxs)(u.Z,{display:"flex",py:2,className:"component-item",justifyContent:"space-between",alignItems:"center",children:[(0,X.jsxs)(u.Z,{pl:Math.max(2*(o-1),0),width:{xs:300,md:400},display:"flex",alignItems:"center",style:{cursor:b?"pointer":"cursor"},onClick:()=>b&&m(!d),children:[b?v:(0,X.jsx)(u.Z,{width:28}),(0,X.jsx)(S.Z,{blocklet:t,ancestors:i}),(0,X.jsxs)(u.Z,{ml:"16px",children:[(0,X.jsx)(u.Z,{style:{color:"#222",fontSize:18},children:(0,w.getDisplayName)(t,!0)}),(0,X.jsx)(u.Z,{display:"flex",alignItems:"center",children:(0,X.jsx)(u.Z,{color:"text.secondary",children:E.title[s]})})]})]},t),(0,X.jsxs)(u.Z,{children:[(0,X.jsx)(ln.Z,{title:r("common.visit"),children:(0,X.jsx)("a",{target:"_blank",href:g,rel:"noopener noreferrer",title:g,children:(0,X.jsx)(K.Z,{children:(0,X.jsx)(sn.Z,{})})})}),(0,X.jsx)(wn,{blocklet:t,ancestors:i,children:e=>{let{open:n}=e;return(0,X.jsx)(ln.Z,{title:r("common.edit"),children:(0,X.jsx)(K.Z,{onClick:n,"data-cy":"btn-edit-".concat(t.meta.did),children:(0,X.jsx)(cn.Z,{style:x})})})}})]},"actions")]},"group-not-gateway-box"),(0,X.jsx)(dn.Z,{depth:o},"line"),null!==(n=t.children)&&void 0!==n&&n.length?(0,X.jsx)(rn.Z,{in:d,children:t.children.map((e=>(0,X.jsx)(Pn,{blocklet:e,ancestors:[...i,t],depth:o+1},"".concat(o+1,"-").concat(e.meta.did))))},"blocklet-collapse"):null]}function Rn(){const{t:e}=(0,C.PE)(),{blocklet:n}=(0,pe.y0)(),t=[...n.children]||[];return"gateway"!==n.meta.group&&t.unshift(n),(0,X.jsx)(Tn,{component:"div",children:t&&t.length?[(0,X.jsx)(u.Z,{mt:2,ml:{xs:"-12px",md:"-24px"},style:{maxWidth:1080},children:(0,X.jsx)(Pn,{blocklet:n},"0-".concat(n.meta.did))},"top-blocklet-".concat(n.meta.did))]:(0,X.jsx)(u.Z,{mt:8,children:(0,X.jsx)(Ie.Z,{children:e("blocklet.component.noComponent")})})})}Pn.propTypes={blocklet:s().object.isRequired,ancestors:s().array,depth:s().number},Pn.defaultProps={ancestors:[],depth:0},Rn.propTypes={};const Tn=(0,l.Z)(u.Z)(Ln||(Ln=(0,o.Z)(["\n .title {\n font-size: 1.2rem;\n font-weight: bold;\n margin-top: ",";\n margin-bottom: ",";\n &.first {\n margin-top: 0;\n }\n }\n"])),(e=>e.theme.spacing(5)),(e=>e.theme.spacing(3)));var An=t(56556),_n=t(44784);const Nn=function(){var e,n;const{api:t}=(0,ie.h6)(),{blocklet:i}=(0,pe.y0)(),{t:o}=(0,C.PE)(),a=null===i||void 0===i||null===(e=i.meta)||void 0===e?void 0:e.did,l=Object.assign({enabled:!1,domain:"",clientId:""},(null===i||void 0===i||null===(n=i.settings)||void 0===n||null===(n=n.oauth)||void 0===n?void 0:n.auth0)||{}),{handleSubmit:r,control:s,formState:c,watch:d,reset:m}=(0,We.cI)({defaultValues:Ue()(l,["domain","clientId","enabled"])}),p=d("enabled"),f=(0,Ke.Z)((async e=>{try{var n;const{blocklet:i}=await t.configOAuth({input:{did:a,oauth:JSON.stringify({auth0:e})}}),l=Object.assign({enabled:!1,domain:"",clientId:""},(null===i||void 0===i||null===(n=i.settings)||void 0===n||null===(n=n.oauth)||void 0===n?void 0:n.auth0)||{});m(l),F.Z.success(o("oauth.saveSuccess"))}catch(i){F.Z.error(i.message||o("oauth.saveFailed"))}})),h=(0,Ke.Z)((e=>!(null===e||void 0===e||!e.trim())||o("oauth.auth0.domainDescribe"))),g=(0,Ke.Z)((e=>!(null===e||void 0===e||!e.trim())||o("oauth.auth0.clientIdDescribe"))),x=(0,Ke.Z)((()=>!0));return(0,X.jsx)(u.Z,{children:(0,X.jsxs)("form",{onSubmit:r(f),disabled:!0,children:[(0,X.jsx)(We.Qr,{name:"enabled",control:s,render:e=>{let{field:n}=e;return(0,X.jsx)(Ze.Z,{control:(0,X.jsx)(_n.Z,{checked:n.value,style:{marginRight:"6px"},...n}),label:o("oauth.auth0.enable"),sx:{marginBottom:2,ml:1}})}}),(0,X.jsx)(We.Qr,{name:"domain",control:s,rules:{validate:p?h:x},render:e=>{var n;let{field:t}=e;return(0,X.jsx)(Be.Z,{fullWidth:!0,children:(0,X.jsx)(H.Z,{...t,label:o("oauth.auth0.domain"),error:!!c.errors[t.name],helperText:(null===(n=c.errors[t.name])||void 0===n?void 0:n.message)||"\u3000",disabled:!p})})}}),(0,X.jsx)(We.Qr,{name:"clientId",control:s,rules:{validate:p?g:x},render:e=>{var n;let{field:t}=e;return(0,X.jsx)(Be.Z,{fullWidth:!0,children:(0,X.jsx)(H.Z,{...t,error:!!c.errors[t.name],label:o("oauth.auth0.clientId"),helperText:(null===(n=c.errors[t.name])||void 0===n?void 0:n.message)||"\u3000",disabled:!p})})}}),(0,X.jsx)(An.Z,{type:"submit",variant:"contained",onSubmit:r(f),disabled:!c.isDirty,children:o("oauth.save")})]})})};var On=t(62362),In=t(24103);const Fn={ttl:p.SESSION_TTL};function Bn(e){const n=arguments.length>1&&void 0!==arguments[1]&&arguments[1]?86400*e.ttl:e.ttl/86400;return{...e,ttl:n}}function zn(){var e,n;const{api:t}=(0,ie.h6)(),{blocklet:i}=(0,pe.y0)(),o=null===i||void 0===i||null===(e=i.meta)||void 0===e?void 0:e.did,a=Object.assign({},Fn,(null===i||void 0===i||null===(n=i.settings)||void 0===n?void 0:n.session)||{}),{handleSubmit:l,control:r,formState:s,reset:c}=(0,We.cI)({defaultValues:Ue()(Bn(a),["ttl"])}),{t:d}=(0,C.PE)(),m=(0,Ke.Z)((async e=>{try{var n;const{blocklet:i}=await t.updateAppSessionConfig({input:{did:o,config:Bn(e,!0)}}),a=Object.assign({},Fn,Ue()((null===i||void 0===i||null===(n=i.settings)||void 0===n?void 0:n.session)||{},["ttl"]));c(Bn(a)),F.Z.success(d("common.configSuccess"))}catch(i){F.Z.error(i.message)}}));return(0,X.jsx)(u.Z,{children:(0,X.jsxs)("form",{onSubmit:l(m),disabled:!0,children:[(0,X.jsx)(We.Qr,{name:"ttl",control:r,render:e=>{let{field:n}=e;return(0,X.jsx)(Be.Z,{fullWidth:!0,sx:{mb:2},children:(0,X.jsxs)(In.Z,{px:3,children:[(0,X.jsx)(u.Z,{mx:-3,my:.5,children:d("blocklet.config.session.ttl",{day:n.value})}),(0,X.jsx)(On.ZP,{...n,defaultValue:7,step:1,marks:[{value:1,label:d("blocklet.config.session.day",{day:1})},{value:7,label:d("blocklet.config.session.days",{day:7})},{value:14,label:d("blocklet.config.session.days",{day:14})},{value:21,label:d("blocklet.config.session.days",{day:21})},{value:30,label:d("blocklet.config.session.days",{day:30})}],min:1,max:30,valueLabelDisplay:"auto",style:{maxWidth:"360px"}})]})})}}),(0,X.jsx)(An.Z,{type:"submit",variant:"contained",onSubmit:l(m),disabled:!s.isDirty,children:d("oauth.save")})]})})}var Un=t(82555),Dn=t(30333),Kn=t(75760),Wn=t(97038),qn=t(64886),Gn=t(42080),Vn=t.n(Gn),Hn=t(75506),Mn=t.n(Hn),Yn=t(47685),Jn=t(13260),Qn=t(82434),Xn=t.n(Qn);const $n=(0,a.forwardRef)(((e,n)=>{var t;const{t:i}=(0,a.useContext)(C.RD),{blocklet:o}=(0,pe.y0)(),{api:l}=(0,ie.h6)(),r=(0,De.Z)({mode:"view",show:!1,data:{},callback:Qe()}),s=(0,Yn.Fg)(),c=(null===s||void 0===s||null===(t=s.transitions)||void 0===t||null===(t=t.duration)||void 0===t?void 0:t.leavingScreen)||300,d=(0,Ke.Z)((()=>{r.mode="view",r.data={},r.callback=Qe()}),[]),p=(0,Ke.Z)((()=>{r.show=!1,setTimeout((()=>{d()}),c)}),[]),f=(0,Ke.Z)((e=>{r.mode="view",r.show=!0,r.data=e}),[]),h=(0,Ke.Z)((function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Qe();r.mode="approve",r.show=!0,r.data=e,r.callback=n}),[]);(0,a.useImperativeHandle)(n,(()=>({open:f,close:p,approve:h})),[f,p,h]);const g=(0,Fe.Z)((()=>{if(!r.show)return[];r.data.migratedFrom=[r.data.appId,r.data.appPid];const e=["appName","appLogo","appId","appPid","migratedFrom","appDescription","appUrl","version","appliedAt","status","serverId","serverVersion"];return!1!==r.data.isMaster&&Vn()(e,"appliedAt","status"),e.map((e=>{const n=i("federated.info.".concat(e));let t=r.data[e];if("appName"===e&&r.data.isMaster&&(t=(0,X.jsxs)(u.Z,{children:[(0,X.jsx)(Un.Z,{component:Dn.Z}),t]})),["appId","appPid","serverId"].includes(e)&&(t=(0,X.jsx)(Jn.kL,{children:t})),["appUrl"].includes(e)&&(t=(0,X.jsx)(u.Z,{component:"a",href:t,target:"_blank",children:t})),["appLogo"].includes(e)){const e=Xn()(t)?t:m()(r.data.appUrl||"",t||"");try{const n=new URL(e);n.searchParams.set("imageFilter","resize"),n.searchParams.set("w","80"),n.searchParams.set("h","80"),t=(0,X.jsx)("img",{src:n.href,width:"60",height:"60",alt:r.data.appName})}catch{t=(0,X.jsx)("img",{src:e,width:"60",height:"60",alt:r.data.appName})}}if("status"===e&&(t=t&&i("federated.status.".concat(t))),"migratedFrom"===e){t=(r.data.migratedFrom||[]).filter((e=>![r.data.appId,r.data.appPid].includes(e))).map((e=>(0,X.jsx)(Jn.kL,{children:e})))}return Mn()(t)&&(t="-"),{name:n,value:t}}))}),[r.data]),x="approve"===r.mode,b=(0,Ke.Z)((async()=>{await l.auditFederatedLogin({input:{memberPid:r.data.appPid,did:o.appPid,status:"rejected"}}),p(),null===r||void 0===r||r.callback(!1)})),v=(0,Ke.Z)((async()=>{await l.auditFederatedLogin({input:{memberPid:r.data.appPid,did:o.appPid,status:"approved"}}),p(),null===r||void 0===r||r.callback(!0)}));return(0,X.jsx)(ge.ZP,{open:r.show,title:i(x?"federated.approveToJoinLogin":"federated.siteDetail"),onClose:p,actions:x?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(An.Z,{color:"error",variant:"contained",onClick:b,children:i("common.reject")}),(0,X.jsx)(An.Z,{variant:"contained",onClick:v,children:i("common.approve")})]}):(0,X.jsx)(An.Z,{variant:"outlined",onClick:p,children:i("common.close")}),children:g.map((e=>(0,X.jsx)(qn.Z,{style:{alignItems:"flex-start"},valueComponent:"div",nameWidth:180,name:e.name,children:e.value},e.name)))})}));var et=t(79842),nt=t(85408),tt=t.n(nt);const it=(0,a.forwardRef)(((e,n)=>{var t;const i=(0,Yn.Fg)(),o=(null===i||void 0===i||null===(t=i.transitions)||void 0===t||null===(t=t.duration)||void 0===t?void 0:t.leavingScreen)||300,{t:l}=(0,a.useContext)(C.RD),r=(0,De.Z)({show:!1,data:{link:""}}),s=(0,Ke.Z)((()=>{r.data.link=""}),[]),c=(0,Ke.Z)((()=>{r.show=!1,setTimeout((()=>{s()}),o)}),[]),d=(0,Ke.Z)((e=>{let{link:n}=e;r.show=!0,r.data.link=n}),[]);(0,a.useImperativeHandle)(n,(()=>({open:d,close:c})),[d,c]);const m=(0,Ke.Z)((()=>{tt()(r.data.link),c()}),[c]);return(0,X.jsxs)(ge.ZP,{open:r.show,title:l("federated.joinFederatedLogin"),onClose:c,PaperProps:{style:{minHeight:"unset"}},actions:(0,X.jsx)(N.Z,{color:"primary",autoFocus:!0,variant:"contained",onClick:m,children:l("common.copyAndClose")}),children:[(0,X.jsx)(u.Z,{mb:1,children:l("federated.inviteJoinFederatedLoginDescription")}),(0,X.jsx)(u.Z,{sx:{"& .copy-button":{display:"none !important"}},children:(0,X.jsx)(et.Z,{language:"shell",style:{marginBottom:0},children:r.data.link})})]})}));function ot(e){var n,t,i;let{mode:o}=e;const l=(0,a.useRef)(null),r=(0,a.useRef)(null),{t:s,locale:c}=(0,a.useContext)(C.RD),{blocklet:d,actions:{refreshBlocklet:m}}=(0,pe.y0)(),{confirmApi:p,confirmHolder:f}=$e(),{api:h}=(0,ie.h6)(),g=(null===(n=d.settings.federated)||void 0===n?void 0:n.sites)||[],x=(null===(t=d.settings.federated)||void 0===t?void 0:t.config)||{},b=!1!==x.isMaster,v=(0,Ke.Z)((e=>{var n;null===(n=r.current)||void 0===n||n.open(e)})),Z=(0,Ke.Z)((e=>{var n;null===(n=r.current)||void 0===n||n.approve(e,m)})),j=(0,Ke.Z)((e=>{p.open({title:s("federated.disableFederatedLogin"),content:s("federated.disableFederatedLoginDescription"),async onConfirm(n){await h.auditFederatedLogin({input:{memberPid:e.appPid,did:d.appPid,status:"revoked"}}),n()}})})),y=(0,Ke.Z)((e=>{p.open({title:s("federated.enableFederatedLogin"),content:s("federated.enableFederatedLoginDescription"),async onConfirm(n){await h.auditFederatedLogin({input:{memberPid:e.appPid,did:d.appPid,status:"approved"}}),n()}})})),k=(0,Fe.Z)((()=>{const e=[{label:s("common.name"),name:"appName",options:{customBodyRenderLite:e=>{const n=g[e],t=!1!==n.isMaster;return(0,X.jsx)(u.Z,{display:"inline-block",children:(0,X.jsxs)(u.Z,{component:"a",display:"flex",alignItems:"center",href:n.appUrl,target:"_blank",onClick:e=>{e.stopPropagation()},children:[t&&(0,X.jsx)(Un.Z,{component:Dn.Z,style:{marginRight:"4px"}}),n.appName]})})}}},{label:s("common.did"),name:"appId",options:{customBodyRenderLite:e=>{const n=g[e];return(0,X.jsx)(Wn.Z,{children:n.appId})}}},{label:s("common.status"),name:"status",options:{customBodyRenderLite:e=>{const n=g[e],t=!1!==n.isMaster;return(0,X.jsx)(u.Z,{children:t?"-":s("federated.status.".concat(n.status))})}}}];return b&&e.push({label:s("common.actions"),name:"actions",options:{customBodyRenderLite:e=>{const n=g[e],t=!1!==n.isMaster;return(0,X.jsx)(u.Z,{display:"flex",gap:1,children:t?(0,X.jsxs)(X.Fragment,{children:["rejected"===n.status&&(0,X.jsx)(N.Z,{variant:"contained",color:"error",size:"small",onClick:e=>{e.stopPropagation()},children:s("federated.status.rejected")}),"revoked"===n.status&&(0,X.jsx)(N.Z,{variant:"contained",color:"secondary",size:"small",onClick:e=>{e.stopPropagation()},children:s("federated.status.revoked")})]}):(0,X.jsxs)(X.Fragment,{children:["pending"===n.status&&(0,X.jsx)(N.Z,{variant:"contained",color:"primary",size:"small",onClick:e=>{e.stopPropagation(),Z(n)},children:s("federated.status.pending")}),"approved"===n.status&&(0,X.jsx)(N.Z,{variant:"contained",color:"error",size:"small",onClick:e=>{e.stopPropagation(),j(n)},style:{whiteSpace:"nowrap"},children:s("federated.revoke")}),"revoked"===n.status&&(0,X.jsx)(N.Z,{variant:"contained",color:"warning",size:"small",onClick:e=>{e.stopPropagation(),y(n)},style:{whiteSpace:"nowrap"},children:s("federated.approve")})]})})}}}),e}),[x.appId,g,b,s]),w=(0,Fe.Z)((()=>({sort:!0,download:!1,filter:!1,print:!1,expandableRowsOnClick:!0,onRowClick(e,n){let{dataIndex:t}=n;const i=g[t];v(i)}})),[]),S=(0,Ke.Z)((()=>{const e=d.environments.find((e=>e.key===I.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_URL));var n;null!==e&&void 0!==e&&e.value?null===(n=l.current)||void 0===n||n.open({link:e.value}):F.Z.error(s("federated.failedToGetFederatedLoginLink"))}),[null===(i=d.site)||void 0===i||null===(i=i.domainAliases)||void 0===i||null===(i=i[0])||void 0===i?void 0:i.href]),E=(0,Ke.Z)((()=>{p.open({title:s("federated.quitFederatedLogin"),content:s("federated.quitFederatedLoginDescription"),async onConfirm(e){await h.quitFederatedLogin({input:{did:d.appPid}}),e()}})})),L=(0,Ke.Z)((()=>{p.open({title:s("federated.disbandFederatedLogin"),content:s("federated.disbandFederatedLoginDescription"),async onConfirm(e){await h.disbandFederatedLogin({input:{did:d.appPid}}),e()}})})),P=[];return"master"!==o?P.push((0,X.jsx)(N.Z,{size:"small",variant:"contained",color:"error",onClick:E,sx:{ml:1},children:s("federated.quitFederatedLogin")},"quitFederatedLogin")):(P.push((0,X.jsx)(N.Z,{size:"small",variant:"contained",onClick:S,sx:{ml:1},children:s("federated.inviteJoinFederatedLogin")},"inviteJoinFederatedLogin")),P.push((0,X.jsx)(N.Z,{color:"error",size:"small",variant:"contained",onClick:L,sx:{ml:1},children:s("federated.disbandFederatedLogin")},"disbandFederatedLogin"))),(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Kn.Z,{className:"main-table",locale:c,data:g,columns:k,customButtons:P,title:(0,X.jsx)(u.Z,{className:"table-toolbar-left",children:s("oauth.federated")}),options:w}),f,(0,X.jsx)(it,{ref:l}),(0,X.jsx)($n,{ref:r})]})}ot.propTypes={mode:s().oneOf(["member","master"])},ot.defaultProps={mode:"member"};const at=ot,lt=(0,a.forwardRef)(((e,n)=>{var t;const{t:i}=(0,a.useContext)(C.RD),{api:o}=(0,ie.h6)(),{blocklet:l}=(0,pe.y0)(),r=null===l||void 0===l?void 0:l.appPid,s=(0,Yn.Fg)(),c=(null===s||void 0===s||null===(t=s.transitions)||void 0===t||null===(t=t.duration)||void 0===t?void 0:t.leavingScreen)||300,d=(0,De.Z)({show:!1,appUrl:"",appUrlError:"",callback:Qe()}),m=(0,Ke.Z)((()=>{d.appUrl="",d.appUrlError="",d.callback=Qe()}),[]),p=(0,Ke.Z)((()=>{d.show=!1,setTimeout((()=>{m()}),c)}),[]),f=(0,Ke.Z)((function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Qe();d.show=!0,d.callback=e}),[]);(0,a.useImperativeHandle)(n,(()=>({open:f,close:p})),[f,p]);const h=(0,Ke.Z)((e=>{if(!e)throw new Error(i("federated.federatedJoinAppUrlRequired"));if(!Xn()(e))throw new Error(i("federated.federatedJoinAppUrlInvalid"))})),g=(0,Ke.Z)((async()=>{try{h(d.appUrl);const e=await o.joinFederatedLogin({input:{did:r,appUrl:d.appUrl}});d.show=!1,p(),null===d||void 0===d||d.callback(e)}catch(e){d.appUrlError=e.message}}),[p,r]);return(0,X.jsxs)(ge.ZP,{open:d.show,title:i("federated.joinFederatedLogin"),onClose:p,PaperProps:{style:{minHeight:"unset"}},actions:(0,X.jsx)(N.Z,{color:"primary",autoFocus:!0,variant:"contained",onClick:g,children:i("common.confirm")}),children:[(0,X.jsx)(u.Z,{mb:1,children:i("federated.joinFederatedLoginDescription")}),(0,X.jsx)(H.Z,{fullWidth:!0,variant:"outlined",margin:"dense",placeholder:i("federated.federatedJoinAppUrl"),label:i("federated.federatedJoinAppUrl"),value:d.appUrl,error:!!d.appUrlError,helperText:d.appUrlError||"eg: https://www.arcblock.io",onChange:e=>{d.appUrl=e.target.value}})]})}));function rt(){var e,n;const t=(0,a.useRef)(null),i=(0,a.useRef)(null),{t:o}=(0,a.useContext)(C.RD),{blocklet:l,actions:{refreshBlocklet:r}}=(0,pe.y0)(),s=(0,Ke.Z)((()=>{var e;const n=null===(e=l.site)||void 0===e||null===(e=e.domainAliases)||void 0===e||null===(e=e[0])||void 0===e?void 0:e.href;if(n)try{var i;const e=new URL(n);null===(i=t.current)||void 0===i||i.open({link:e.origin})}catch{F.Z.error(o("federated.failedToGetFederatedLoginLink"))}}),[null===(e=l.site)||void 0===e||null===(e=e.domainAliases)||void 0===e||null===(e=e[0])||void 0===e?void 0:e.href]),c=(0,Ke.Z)((()=>{var e;null===(e=i.current)||void 0===e||e.open((()=>{r()}))}),[r]);if((null===(n=l.settings.federated)||void 0===n?void 0:n.sites.length)>0){var d;const e=!1!==(null===(d=l.settings.federated)||void 0===d?void 0:d.config.isMaster);return(0,X.jsx)(at,{mode:e?"master":"member"})}return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(u.Z,{display:"flex",flexDirection:"column",gap:2,justifyContent:"center",alignItems:"center",minHeight:"200px",children:[(0,X.jsx)(N.Z,{variant:"contained",onClick:s,children:o("federated.inviteJoinFederatedLogin")}),(0,X.jsx)(_.Z,{sx:{width:"150px",color:"rgba(0, 0, 0, 0.3)"},children:"OR"}),(0,X.jsx)(N.Z,{variant:"outlined",onClick:c,children:o("federated.joinFederatedLogin")})]}),(0,X.jsx)(it,{ref:t}),(0,X.jsx)(lt,{ref:i})]})}const st=function(){const{t:e}=(0,a.useContext)(C.RD),n=[{label:(0,X.jsx)(u.Z,{textAlign:"center",width:"100%",children:e("oauth.commonSettings")}),value:"settings"},{label:(0,X.jsx)(u.Z,{textAlign:"center",width:"100%",children:e("oauth.federated")}),value:"federated"},{label:(0,X.jsx)(u.Z,{textAlign:"center",width:"100%",children:"Auth0"}),value:"auth0"},{label:(0,X.jsx)(u.Z,{textAlign:"center",width:"100%",children:e("oauth.moreLogin")}),value:"more"}],[t,i]=(0,a.useState)(n[0].value),o=(0,Fe.Z)((()=>({auth0:(0,X.jsx)(Nn,{}),federated:(0,X.jsx)(rt,{}),more:(0,X.jsx)(u.Z,{children:(0,X.jsx)(Ie.Z,{children:e("oauth.comingSoon")})}),settings:(0,X.jsx)(u.Z,{children:(0,X.jsx)(zn,{})})})),[e]);return(0,X.jsxs)(u.Z,{children:[(0,X.jsx)(k.Z,{tabs:n,current:t,onChange:i}),(0,X.jsx)(u.Z,{marginTop:"10px",children:o[t]})]})};var ct;const dt=e=>{let{tabs:n,blocklet:t,ancestors:i=[],depth:o=1,t:a}=e;const l=[...i.map((e=>e.meta.did)),t.meta.did].join("/"),r=!(null!==i&&void 0!==i&&i.length);n.push({label:(0,X.jsxs)(u.Z,{pl:2*Math.max(1,o-1),display:"flex",alignItems:"center",justifyContent:"flex-start",children:[r?(0,X.jsx)(E.Z,{size:24,blocklet:t}):(0,X.jsx)(S.Z,{size:24,blocklet:t,ancestors:i}),(0,X.jsx)(u.Z,{ml:"16px",children:(0,X.jsx)(u.Z,{style:{color:"#222"},children:r?a("blocklet.component.container"):(0,w.getDisplayName)(t,!0)})})]},l),value:l}),t.children.length>0&&t.children.forEach((e=>{dt({tabs:n,blocklet:e,ancestors:[...i,t],depth:o+1,t:a})}))};function mt(e){let{blocklet:n,onUpdate:t,...i}=e;const{t:o}=(0,a.useContext)(C.RD),{info:l,inService:r}=(0,ie.h6)(),[s,d]=(0,a.useState)(!0),[w,S]=(0,y.useSearchParams)(),E=w.get("tab")||"general",L=[{label:(0,X.jsxs)(u.Z,{display:"flex",alignItems:"center","data-cy":"configuration-tab-general",children:[(0,X.jsx)(h.Z,{sx:{fontSize:24}}),(0,X.jsx)(u.Z,{ml:"16px",children:(0,X.jsx)(u.Z,{style:{color:"#222"},children:o("common.general")})})]},"general"),value:"general"},{label:(0,X.jsxs)(u.Z,{display:"flex",alignItems:"center","data-cy":"configuration-tab-access",children:[(0,X.jsx)(g.Z,{sx:{fontSize:24}}),(0,X.jsx)(u.Z,{ml:"16px",children:(0,X.jsx)(u.Z,{style:{color:"#222"},children:o("common.access")})})]},"access"),value:"access"},{label:(0,X.jsxs)(u.Z,{display:"flex",alignItems:"center","data-cy":"configuration-tab-oauth",children:[(0,X.jsx)(x.Z,{sx:{fontSize:24}}),(0,X.jsx)(u.Z,{ml:"16px",children:(0,X.jsx)(u.Z,{style:{color:"#222"},children:o("common.login")})})]},"oauth"),value:"oauth"},{label:(0,X.jsxs)(u.Z,{display:"flex",alignItems:"center","data-cy":"configuration-tab-notification",children:[(0,X.jsx)(b.Z,{sx:{fontSize:24}}),(0,X.jsx)(u.Z,{ml:"16px",children:(0,X.jsx)(u.Z,{style:{color:"#222"},children:o("common.notification")})})]},"notification"),value:"notification"},{label:(0,X.jsxs)(u.Z,{display:"flex",alignItems:"center","data-cy":"configuration-tab-preference",children:[(0,X.jsx)(u.Z,{ml:-2,style:{transform:"translateY(2px)"},children:s?(0,X.jsx)(j.Z,{fontSize:"inherit"}):(0,X.jsx)(Z.default,{fontSize:"inherit"})}),(0,X.jsx)(v.Z,{sx:{fontSize:24}}),(0,X.jsx)(u.Z,{ml:"16px",children:(0,X.jsx)(u.Z,{style:{color:"#222"},children:o("common.preferences")})})]},"preference"),value:"preference"}];s&&dt({tabs:L,blocklet:n,t:o});let P=null;if("general"===E)P=(0,X.jsx)(Ne,{blocklet:n,onUpdate:t});else if("access"===E)P=(0,X.jsx)(Rn,{});else if("oauth"===E)P=(0,X.jsx)(st,{});else if("notification"===E)P=(0,X.jsx)(on,{});else{const e=r?p.WELLKNOWN_SERVICE_PATH_PREFIX:l.routing.adminPath,n=new URLSearchParams;r||n.set("authKey","__sst"),n.set("schemaKey",m()(window.location.origin,e,"/api/preferences?id=".concat(encodeURIComponent(E)))),P=(0,X.jsx)(c.Z,{url:"".concat(m()(window.location.origin,e,"/hosted/form-collector/"),"?").concat(n.toString()),width:"100%",height:"100%",frameBorder:0,styles:{border:0}})}return(0,X.jsx)(pt,{...i,children:(0,X.jsxs)(f.ZP,{container:!0,spacing:4,columns:24,children:[(0,X.jsx)(f.ZP,{item:!0,sm:7,md:5,children:(0,X.jsx)(k.Z,{tabs:L,current:E,orientation:"vertical",onChange:e=>{"preference"===e?d(!s):S((n=>("general"===e?n.delete("tab"):n.set("tab",e),n)))},sx:{borderRight:1,height:"100%",borderColor:"divider"}})}),(0,X.jsx)(f.ZP,{item:!0,sm:17,md:19,children:(0,X.jsx)(u.Z,{style:{minHeight:"66vh",height:"100%",position:"relative",overflow:"hidden"},children:P})})]})})}mt.propTypes={blocklet:s().object.isRequired,onUpdate:s().func},mt.defaultProps={onUpdate:()=>{}};const pt=l.Z.div(ct||(ct=(0,o.Z)(["\n .MuiTab-root {\n text-align: left;\n align-items: flex-start;\n font-weight: normal;\n }\n .Mui-selected {\n font-weight: bold;\n }\n"])))},78410:(e,n,t)=>{t.d(n,{Z:()=>p});var i=t(5057),o=t(86229),a=t(28726),l=t(44846),r=t(68420),s=t(46090),c=t(58238),d=t(70461),m=t(96266);function p(e){let{teamDid:n,size:t="small",...p}=e;const{t:u}=(0,r.PE)(),{api:f}=(0,c.h6)(),[h,g]=(0,i.useState)(!1),[x,b]=(0,i.useState)(null),v={title:u("blocklet.config.clearCache.title"),description:u("blocklet.config.clearCache.description"),confirm:u("common.confirm"),cancel:u("common.cancel"),onConfirm:async()=>{try{var e;g(!0);const t=await f.clearCache({input:{teamDid:n}});o.Z.success(u("blocklet.config.clearCache.success",{count:(null===(e=t.removed)||void 0===e?void 0:e.length)||0}))}catch(t){o.Z.error((0,s.Z)(t))}finally{g(!1),b(null)}},onCancel:()=>{g(!1),b(null)}};return(0,m.jsxs)("div",{...p,children:[(0,m.jsxs)(a.Z,{onClick:()=>b(v),color:"error",variant:"outlined",size:t,children:[h?(0,m.jsx)(l.Z,{size:16,style:{marginRight:5}}):null,u("blocklet.config.clearCache.action")]}),x&&(0,m.jsx)(d.Z,{title:x.title,description:x.description,confirm:x.confirm,cancel:x.cancel,onConfirm:x.onConfirm,onCancel:x.onCancel})]})}},50185:(e,n,t)=>{t.d(n,{Z:()=>c});var i=t(5057),o=t(55898),a=t.n(o),l=t(12937),r=t(68420),s=t(96266);function c(e){let{children:n,...t}=e;const{t:o}=(0,i.useContext)(r.RD);return(0,s.jsx)(l.Z,{tip:o("common.copyTip"),copiedTip:o("common.copiedTip"),...t,children:n})}c.propTypes={children:a().any.isRequired}},28641:(e,n,t)=>{t.d(n,{Z:()=>x});var i=t(5057),o=t(55898),a=t.n(o),l=t(39948),r=t(47020),s=t(44846),c=t(13727),d=t(56184),m=t(67680),p=t(35406),u=t(11875),f=t(95890),h=t(96266);const g=(e,n,t)=>null===e&&n&&t?"******":e?n?"******":e:"";function x(e){let{label:n,disabled:t,required:o,initialValue:a,onChange:x,placeholder:b,style:v,onSubmit:Z,secure:j,triggers:y,formatterBeforeSubmit:C,...k}=e;const[w,S]=(0,i.useState)(!1),[E,L]=(0,i.useState)(!1),[P,R]=(0,i.useState)(j&&"__encrypted__"===a?null:a),[T,A]=(0,i.useState)(P),_=async()=>{L(!0);try{if(!1===await Z(T))A(P);else{let e=T;"function"===typeof C&&(e=C(T)),A(e),R(e)}}catch(e){A(P)}finally{L(!1),S(!1)}},N=w?(0,h.jsx)(r.Z,{style:{flex:1},fullWidth:!0,value:T,onChange:e=>{var n;n=e.target.value,A(n),x(n)},autoFocus:!0,size:"small",variant:"outlined",placeholder:b,onKeyDown:e=>{"Enter"===e.key&&_()},disabled:t,type:j?"password":"text",...k}):(0,h.jsx)(l.Z,{px:1,className:"form-item-input slot",style:{whiteSpace:"pre-wrap"},children:g(T,j,a)});return(0,h.jsx)(u.Z,{className:"form",style:v,children:(0,h.jsxs)(l.Z,{className:"form-item",children:[(0,h.jsxs)(l.Z,{className:"form-item-label",children:[n,o&&(0,h.jsx)(p.Z,{})]}),(0,h.jsxs)(l.Z,{className:"form-item-body",children:[(0,h.jsx)(l.Z,{className:"form-item-input",children:N}),(0,h.jsx)(l.Z,{className:"form-item-action",children:w?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(m.Z,{"data-cy":"schema-form-item-confirm",onClick:_,disabled:t||E,size:"large",children:E?(0,h.jsx)(s.Z,{size:24}):(0,h.jsx)(d.Z,{})}),(0,h.jsx)(m.Z,{"data-cy":"schema-form-item-cancel",onClick:()=>{A(P),S(!1)},disabled:t||E,size:"large",children:(0,h.jsx)(c.default,{})})]}):(0,h.jsx)(f.Z,{triggers:y,onEnterEdit:()=>S(!0),disabled:t})})]})]})})}x.propTypes={style:a().object,onSubmit:a().func,onChange:a().func,label:a().string,initialValue:a().string,placeholder:a().string,required:a().bool,disabled:a().bool,secure:a().bool,triggers:a().array,formatterBeforeSubmit:a().func},x.defaultProps={style:{},onSubmit:()=>{},onChange:()=>{},label:"",initialValue:"",placeholder:"",required:!1,disabled:!1,secure:!1,triggers:[],formatterBeforeSubmit:null}},11875:(e,n,t)=>{t.d(n,{Z:()=>r});var i,o=t(71171),a=t(33518),l=t(39948);const r=(0,a.Z)(l.Z)(i||(i=(0,o.Z)(["\n width: 100%;\n flex-grow: 1;\n overflow-y: auto;\n "," {\n width: 100%;\n flex-shrink: 0;\n padding: 0 24px;\n transform: translate(0, 0);\n /* max-height: 60vh; */\n }\n\n .form-item {\n width: 100%;\n margin-bottom: 24px;\n position: relative;\n "," {\n flex-wrap: wrap;\n justify-content: space-between;\n width: 100%;\n flex-shrink: 0;\n }\n }\n\n .form-item-body {\n display: flex;\n align-items: center;\n width: 100%;\n margin-top: 4px;\n }\n\n .form-item-label {\n line-height: 1.2;\n font-size: 14px;\n color: #888;\n font-weight: bold;\n\n "," {\n text-align: left;\n width: auto;\n flex-grow: 1;\n }\n }\n\n .form-item-input {\n flex-grow: 1;\n overflow: hidden;\n white-space: nowrap;\n text-overflow: ellipsis;\n\n &.slot {\n height: 40px;\n line-height: 40px;\n background: #f8f8f8;\n font-size: 16px;\n\n .MuiChip-root {\n margin-top: -4px;\n }\n }\n\n .MuiSelect-select {\n padding: 8px;\n }\n }\n\n .form-item-action {\n // width: 100px;\n text-align: left;\n margin-left: 12px;\n flex-shrink: 0;\n "," {\n width: auto;\n margin-left: 0px;\n }\n .MuiIconButton-root {\n padding: 8px;\n svg {\n fill: #888;\n }\n &.Mui-disabled {\n opacity: 0.4;\n }\n }\n }\n"])),(e=>e.theme.breakpoints.down("md")),(e=>e.theme.breakpoints.down("md")),(e=>e.theme.breakpoints.down("md")),(e=>e.theme.breakpoints.down("md")))},95890:(e,n,t)=>{t.d(n,{Z:()=>x});var i=t(5057),o=t(55898),a=t.n(o),l=t(24558),r=t(67680),s=t(56556),c=t(80633),d=t(49390),m=t(72113),p=t(25228),u=t(49020),f=t(74490),h=t(1733),g=t(96266);function x(e){let{triggers:n,onEnterEdit:t,disabled:o}=e;const a=i.useRef(null),[x,b]=i.useState(!1);return 0===n.length?(0,g.jsx)(r.Z,{"data-cy":"schema-form-item-edit",onClick:t,disabled:o,size:"large",children:(0,g.jsx)(l.Z,{})}):(0,g.jsxs)(g.Fragment,{children:[(0,g.jsxs)(c.Z,{variant:"outlined",ref:a,"aria-label":"split button",children:[(0,g.jsx)(s.Z,{"data-cy":"schema-form-item-edit",onClick:t,disabled:o,size:"large",children:(0,g.jsx)(l.Z,{})}),(0,g.jsx)(s.Z,{size:"small","aria-controls":x?"split-button-menu":void 0,"aria-expanded":x?"true":void 0,onClick:()=>{b((e=>!e))},children:(0,g.jsx)(d.Z,{})})]}),(0,g.jsx)(u.Z,{sx:{zIndex:9999},open:x,anchorEl:a.current,role:void 0,placement:"bottom-end",children:(0,g.jsx)(p.Z,{children:(0,g.jsx)(m.d,{onClickAway:e=>{a.current&&a.current.contains(e.target)||b(!1)},children:(0,g.jsx)(h.Z,{id:"split-button-menu",autoFocusItem:!0,children:n.map((e=>(0,g.jsx)(f.Z,{onClick:()=>{return n=e.handler,b(!1),void n();var n},children:e.title},e.key)))})})})})]})}x.propTypes={triggers:a().arrayOf(a().shape({key:a().string.isRequired,title:a().string.isRequired,handler:a().func.isRequired})),onEnterEdit:a().func.isRequired,disabled:a().bool.isRequired},x.defaultProps={triggers:[]}},35406:(e,n,t)=>{t.d(n,{Z:()=>a});var i,o=t(71171);const a=t(33518).Z.span(i||(i=(0,o.Z)(["\n color: ",";\n &::before {\n content: '*';\n }\n"])),(e=>e.theme.palette.error.main))},54063:(e,n,t)=>{t.d(n,{C:()=>i});const i="true"===localStorage.getItem("enableDebug")}}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(self.webpackChunk_abtnode_webapp=self.webpackChunk_abtnode_webapp||[]).push([[6471],{49390:(e,t,o)=>{var r=o(71600);t.Z=void 0;var a=r(o(56930)),n=o(96266);t.Z=(0,a.default)((0,n.jsx)("path",{d:"m7 10 5 5 5-5z"}),"ArrowDropDown")},47595:(e,t,o)=>{var r=o(71600);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var a=r(o(56930)),n=o(96266);t.default=(0,a.default)((0,n.jsx)("path",{d:"M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6zM8 9h8v10H8zm7.5-5-1-1h-5l-1 1H5v2h14V4z"}),"DeleteOutline")},57201:(e,t,o)=>{var r=o(71600);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var a=r(o(56930)),n=o(96266);t.default=(0,a.default)((0,n.jsx)("path",{d:"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14"}),"Search")},39434:(e,t,o)=>{o.d(t,{Z:()=>j});var r=o(7896),a=o(29218),n=o(5057),i=(o(97408),o(9978)),l=o(15109),s=o(82261),d=o(62773),c=o(42908),u=o(11750),p=o(96295),v=o(57471),m=o(96266);const h=(0,v.Z)((0,m.jsx)("path",{d:"M6 10c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm12 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm-6 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"}),"MoreHoriz");var g=o(66230);const b=["slots","slotProps"],f=(0,d.ZP)(g.Z)((e=>{let{theme:t}=e;return(0,r.Z)({display:"flex",marginLeft:"calc(".concat(t.spacing(1)," * 0.5)"),marginRight:"calc(".concat(t.spacing(1)," * 0.5)")},"light"===t.palette.mode?{backgroundColor:t.palette.grey[100],color:t.palette.grey[700]}:{backgroundColor:t.palette.grey[700],color:t.palette.grey[100]},{borderRadius:2,"&:hover, &:focus":(0,r.Z)({},"light"===t.palette.mode?{backgroundColor:t.palette.grey[200]}:{backgroundColor:t.palette.grey[600]}),"&:active":(0,r.Z)({boxShadow:t.shadows[0]},"light"===t.palette.mode?{backgroundColor:(0,p._4)(t.palette.grey[200],.12)}:{backgroundColor:(0,p._4)(t.palette.grey[600],.12)})})})),Z=(0,d.ZP)(h)({width:24,height:16});const x=function(e){const{slots:t={},slotProps:o={}}=e,n=(0,a.Z)(e,b),i=e;return(0,m.jsx)("li",{children:(0,m.jsx)(f,(0,r.Z)({focusRipple:!0},n,{ownerState:i,children:(0,m.jsx)(Z,(0,r.Z)({as:t.CollapsedIcon,ownerState:i},o.collapsedIcon))}))})};var y=o(46849),B=o(96036);function R(e){return(0,B.ZP)("MuiBreadcrumbs",e)}const S=(0,y.Z)("MuiBreadcrumbs",["root","ol","li","separator"]),w=["children","className","component","slots","slotProps","expandText","itemsAfterCollapse","itemsBeforeCollapse","maxItems","separator"],C=(0,d.ZP)(u.Z,{name:"MuiBreadcrumbs",slot:"Root",overridesResolver:(e,t)=>[{["& .".concat(S.li)]:t.li},t.root]})({}),z=(0,d.ZP)("ol",{name:"MuiBreadcrumbs",slot:"Ol",overridesResolver:(e,t)=>t.ol})({display:"flex",flexWrap:"wrap",alignItems:"center",padding:0,margin:0,listStyle:"none"}),P=(0,d.ZP)("li",{name:"MuiBreadcrumbs",slot:"Separator",overridesResolver:(e,t)=>t.separator})({display:"flex",userSelect:"none",marginLeft:8,marginRight:8});function E(e,t,o,r){return e.reduce(((a,n,i)=>(i<e.length-1?a=a.concat(n,(0,m.jsx)(P,{"aria-hidden":!0,className:t,ownerState:r,children:o},"separator-".concat(i))):a.push(n),a)),[])}const j=n.forwardRef((function(e,t){const o=(0,c.Z)({props:e,name:"MuiBreadcrumbs"}),{children:d,className:u,component:p="nav",slots:v={},slotProps:h={},expandText:g="Show path",itemsAfterCollapse:b=1,itemsBeforeCollapse:f=1,maxItems:Z=8,separator:y="/"}=o,B=(0,a.Z)(o,w),[S,P]=n.useState(!1),j=(0,r.Z)({},o,{component:p,expanded:S,expandText:g,itemsAfterCollapse:b,itemsBeforeCollapse:f,maxItems:Z,separator:y}),M=(e=>{const{classes:t}=e;return(0,s.Z)({root:["root"],li:["li"],ol:["ol"],separator:["separator"]},R,t)})(j),I=(0,l.y)({elementType:v.CollapsedIcon,externalSlotProps:h.collapsedIcon,ownerState:j}),N=n.useRef(null),k=n.Children.toArray(d).filter((e=>n.isValidElement(e))).map(((e,t)=>(0,m.jsx)("li",{className:M.li,children:e},"child-".concat(t))));return(0,m.jsx)(C,(0,r.Z)({ref:t,component:p,color:"text.secondary",className:(0,i.Z)(M.root,u),ownerState:j},B,{children:(0,m.jsx)(z,{className:M.ol,ref:N,ownerState:j,children:E(S||Z&&k.length<=Z?k:(e=>f+b>=e.length?e:[...e.slice(0,f),(0,m.jsx)(x,{"aria-label":g,slots:{CollapsedIcon:v.CollapsedIcon},slotProps:{collapsedIcon:I},onClick:()=>{P(!0);const e=N.current.querySelector("a[href],button,[tabindex]");e&&e.focus()}},"ellipsis"),...e.slice(e.length-b,e.length)])(k),M.separator,y,j)})}))}))},80633:(e,t,o)=>{o.d(t,{Z:()=>B});var r=o(29218),a=o(7896),n=o(5057),i=o(9978),l=o(82261),s=o(96295),d=o(88781),c=o(6285),u=o(62773),p=o(42908),v=o(46849),m=o(96036);function h(e){return(0,m.ZP)("MuiButtonGroup",e)}const g=(0,v.Z)("MuiButtonGroup",["root","contained","outlined","text","disableElevation","disabled","firstButton","fullWidth","vertical","grouped","groupedHorizontal","groupedVertical","groupedText","groupedTextHorizontal","groupedTextVertical","groupedTextPrimary","groupedTextSecondary","groupedOutlined","groupedOutlinedHorizontal","groupedOutlinedVertical","groupedOutlinedPrimary","groupedOutlinedSecondary","groupedContained","groupedContainedHorizontal","groupedContainedVertical","groupedContainedPrimary","groupedContainedSecondary","lastButton","middleButton"]);var b=o(17681),f=o(27258),Z=o(96266);const x=["children","className","color","component","disabled","disableElevation","disableFocusRipple","disableRipple","fullWidth","orientation","size","variant"],y=(0,u.ZP)("div",{name:"MuiButtonGroup",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:o}=e;return[{["& .".concat(g.grouped)]:t.grouped},{["& .".concat(g.grouped)]:t["grouped".concat((0,c.Z)(o.orientation))]},{["& .".concat(g.grouped)]:t["grouped".concat((0,c.Z)(o.variant))]},{["& .".concat(g.grouped)]:t["grouped".concat((0,c.Z)(o.variant)).concat((0,c.Z)(o.orientation))]},{["& .".concat(g.grouped)]:t["grouped".concat((0,c.Z)(o.variant)).concat((0,c.Z)(o.color))]},{["& .".concat(g.firstButton)]:t.firstButton},{["& .".concat(g.lastButton)]:t.lastButton},{["& .".concat(g.middleButton)]:t.middleButton},t.root,t[o.variant],!0===o.disableElevation&&t.disableElevation,o.fullWidth&&t.fullWidth,"vertical"===o.orientation&&t.vertical]}})((e=>{let{theme:t,ownerState:o}=e;return(0,a.Z)({display:"inline-flex",borderRadius:(t.vars||t).shape.borderRadius},"contained"===o.variant&&{boxShadow:(t.vars||t).shadows[2]},o.disableElevation&&{boxShadow:"none"},o.fullWidth&&{width:"100%"},"vertical"===o.orientation&&{flexDirection:"column"},{["& .".concat(g.grouped)]:(0,a.Z)({minWidth:40,"&:hover":(0,a.Z)({},"contained"===o.variant&&{boxShadow:"none"})},"contained"===o.variant&&{boxShadow:"none"}),["& .".concat(g.firstButton,",& .").concat(g.middleButton)]:(0,a.Z)({},"horizontal"===o.orientation&&{borderTopRightRadius:0,borderBottomRightRadius:0},"vertical"===o.orientation&&{borderBottomRightRadius:0,borderBottomLeftRadius:0},"text"===o.variant&&"horizontal"===o.orientation&&{borderRight:t.vars?"1px solid rgba(".concat(t.vars.palette.common.onBackgroundChannel," / 0.23)"):"1px solid ".concat("light"===t.palette.mode?"rgba(0, 0, 0, 0.23)":"rgba(255, 255, 255, 0.23)"),["&.".concat(g.disabled)]:{borderRight:"1px solid ".concat((t.vars||t).palette.action.disabled)}},"text"===o.variant&&"vertical"===o.orientation&&{borderBottom:t.vars?"1px solid rgba(".concat(t.vars.palette.common.onBackgroundChannel," / 0.23)"):"1px solid ".concat("light"===t.palette.mode?"rgba(0, 0, 0, 0.23)":"rgba(255, 255, 255, 0.23)"),["&.".concat(g.disabled)]:{borderBottom:"1px solid ".concat((t.vars||t).palette.action.disabled)}},"text"===o.variant&&"inherit"!==o.color&&{borderColor:t.vars?"rgba(".concat(t.vars.palette[o.color].mainChannel," / 0.5)"):(0,s.Fq)(t.palette[o.color].main,.5)},"outlined"===o.variant&&"horizontal"===o.orientation&&{borderRightColor:"transparent"},"outlined"===o.variant&&"vertical"===o.orientation&&{borderBottomColor:"transparent"},"contained"===o.variant&&"horizontal"===o.orientation&&{borderRight:"1px solid ".concat((t.vars||t).palette.grey[400]),["&.".concat(g.disabled)]:{borderRight:"1px solid ".concat((t.vars||t).palette.action.disabled)}},"contained"===o.variant&&"vertical"===o.orientation&&{borderBottom:"1px solid ".concat((t.vars||t).palette.grey[400]),["&.".concat(g.disabled)]:{borderBottom:"1px solid ".concat((t.vars||t).palette.action.disabled)}},"contained"===o.variant&&"inherit"!==o.color&&{borderColor:(t.vars||t).palette[o.color].dark},{"&:hover":(0,a.Z)({},"outlined"===o.variant&&"horizontal"===o.orientation&&{borderRightColor:"currentColor"},"outlined"===o.variant&&"vertical"===o.orientation&&{borderBottomColor:"currentColor"})}),["& .".concat(g.lastButton,",& .").concat(g.middleButton)]:(0,a.Z)({},"horizontal"===o.orientation&&{borderTopLeftRadius:0,borderBottomLeftRadius:0},"vertical"===o.orientation&&{borderTopRightRadius:0,borderTopLeftRadius:0},"outlined"===o.variant&&"horizontal"===o.orientation&&{marginLeft:-1},"outlined"===o.variant&&"vertical"===o.orientation&&{marginTop:-1})})})),B=n.forwardRef((function(e,t){const o=(0,p.Z)({props:e,name:"MuiButtonGroup"}),{children:s,className:u,color:v="primary",component:m="div",disabled:g=!1,disableElevation:B=!1,disableFocusRipple:R=!1,disableRipple:S=!1,fullWidth:w=!1,orientation:C="horizontal",size:z="medium",variant:P="outlined"}=o,E=(0,r.Z)(o,x),j=(0,a.Z)({},o,{color:v,component:m,disabled:g,disableElevation:B,disableFocusRipple:R,disableRipple:S,fullWidth:w,orientation:C,size:z,variant:P}),M=(e=>{const{classes:t,color:o,disabled:r,disableElevation:a,fullWidth:n,orientation:i,variant:s}=e,d={root:["root",s,"vertical"===i&&"vertical",n&&"fullWidth",a&&"disableElevation"],grouped:["grouped","grouped".concat((0,c.Z)(i)),"grouped".concat((0,c.Z)(s)),"grouped".concat((0,c.Z)(s)).concat((0,c.Z)(i)),"grouped".concat((0,c.Z)(s)).concat((0,c.Z)(o)),r&&"disabled"],firstButton:["firstButton"],lastButton:["lastButton"],middleButton:["middleButton"]};return(0,l.Z)(d,h,t)})(j),I=n.useMemo((()=>({className:M.grouped,color:v,disabled:g,disableElevation:B,disableFocusRipple:R,disableRipple:S,fullWidth:w,size:z,variant:P})),[v,g,B,R,S,w,z,P,M.grouped]),N=(0,d.Z)(s),k=N.length,L=e=>{const t=0===e,o=e===k-1;return t&&o?"":t?M.firstButton:o?M.lastButton:M.middleButton};return(0,Z.jsx)(y,(0,a.Z)({as:m,role:"group",className:(0,i.Z)(M.root,u),ref:t,ownerState:j},E,{children:(0,Z.jsx)(b.Z.Provider,{value:I,children:N.map(((e,t)=>(0,Z.jsx)(f.Z.Provider,{value:L(t),children:e},t)))})}))}))},53070:(e,t,o)=>{o.d(t,{Z:()=>Z});var r,a=o(29218),n=o(7896),i=o(5057),l=o(9978),s=o(82261),d=o(6285),c=o(11750),u=o(54352),p=o(38038),v=o(62773),m=o(17815),h=o(42908),g=o(96266);const b=["children","className","component","disablePointerEvents","disableTypography","position","variant"],f=(0,v.ZP)("div",{name:"MuiInputAdornment",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:o}=e;return[t.root,t["position".concat((0,d.Z)(o.position))],!0===o.disablePointerEvents&&t.disablePointerEvents,t[o.variant]]}})((e=>{let{theme:t,ownerState:o}=e;return(0,n.Z)({display:"flex",height:"0.01em",maxHeight:"2em",alignItems:"center",whiteSpace:"nowrap",color:(t.vars||t).palette.action.active},"filled"===o.variant&&{["&.".concat(m.Z.positionStart,"&:not(.").concat(m.Z.hiddenLabel,")")]:{marginTop:16}},"start"===o.position&&{marginRight:8},"end"===o.position&&{marginLeft:8},!0===o.disablePointerEvents&&{pointerEvents:"none"})})),Z=i.forwardRef((function(e,t){const o=(0,h.Z)({props:e,name:"MuiInputAdornment"}),{children:v,className:Z,component:x="div",disablePointerEvents:y=!1,disableTypography:B=!1,position:R,variant:S}=o,w=(0,a.Z)(o,b),C=(0,p.Z)()||{};let z=S;S&&C.variant,C&&!z&&(z=C.variant);const P=(0,n.Z)({},o,{hiddenLabel:C.hiddenLabel,size:C.size,disablePointerEvents:y,position:R,variant:z}),E=(e=>{const{classes:t,disablePointerEvents:o,hiddenLabel:r,position:a,size:n,variant:i}=e,l={root:["root",o&&"disablePointerEvents",a&&"position".concat((0,d.Z)(a)),i,r&&"hiddenLabel",n&&"size".concat((0,d.Z)(n))]};return(0,s.Z)(l,m.w,t)})(P);return(0,g.jsx)(u.Z.Provider,{value:null,children:(0,g.jsx)(f,(0,n.Z)({as:x,ownerState:P,className:(0,l.Z)(E.root,Z),ref:t},w,{children:"string"!==typeof v||B?(0,g.jsxs)(i.Fragment,{children:["start"===R?r||(r=(0,g.jsx)("span",{className:"notranslate",children:"\u200b"})):null,v]}):(0,g.jsx)(c.Z,{color:"text.secondary",children:v})}))})}))},17815:(e,t,o)=>{o.d(t,{Z:()=>i,w:()=>n});var r=o(46849),a=o(96036);function n(e){return(0,a.ZP)("MuiInputAdornment",e)}const i=(0,r.Z)("MuiInputAdornment",["root","filled","standard","outlined","positionStart","positionEnd","disablePointerEvents","hiddenLabel","sizeSmall"])},88781:(e,t,o)=>{o.d(t,{Z:()=>a});var r=o(5057);function a(e){return r.Children.toArray(e).filter((e=>r.isValidElement(e)))}},67654:(e,t,o)=>{var r=o(5057),a=o(77931);t.Z=function(e,t,o){if(!a.isBrowser)return[t,a.noop,a.noop];if(!e)throw new Error("useLocalStorage key may not be falsy");var n=o?o.raw?function(e){return e}:o.deserializer:JSON.parse,i=r.useRef((function(e){try{var r=o?o.raw?String:o.serializer:JSON.stringify,a=localStorage.getItem(e);return null!==a?n(a):(t&&localStorage.setItem(e,r(t)),t)}catch(l){return t}})),l=r.useState((function(){return i.current(e)})),s=l[0],d=l[1];r.useLayoutEffect((function(){return d(i.current(e))}),[e]);var c=r.useCallback((function(t){try{var r="function"===typeof t?t(s):t;if("undefined"===typeof r)return;var a=void 0;a=o?o.raw?"string"===typeof r?r:JSON.stringify(r):o.serializer?o.serializer(r):JSON.stringify(r):JSON.stringify(r),localStorage.setItem(e,a),d(n(a))}catch(l){}}),[e,d]),u=r.useCallback((function(){try{localStorage.removeItem(e),d(void 0)}catch(l){}}),[e,d]);return[s,c,u]}}}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(self.webpackChunk_abtnode_webapp=self.webpackChunk_abtnode_webapp||[]).push([[6511],{86511:(e,t,n)=>{n.r(t),n.d(t,{default:()=>ne});var a=n(71171),i=n(5057),o=n(33518),l=n(85493),s=n(15849),c=n(68420),r=n(11750),d=n(39434),u=n(39948),p=n(83407),m=n(94464),v=n(88574),h=n(28726),g=n(38242),b=n(81010),f=n(87363),y=(n(5892),n(86229)),k=n(1722),x=n(35432),w=n(22425),P=n(58238),j=n(29054),S=n(73545),B=n(46090),Z=n(4651),C=n(96266);const E=e=>{const t={};let n=null;return(0,g.forEachBlockletSync)(e,(e=>{t[e.meta.bundleDid]?n=(0,g.getDisplayName)(e,!0):e.meta.bundleDid&&(t[e.meta.bundleDid]=!0)})),n},L=(e,t,n)=>{const{hostname:a,href:i}=e;if(!t)return i;if(n){var o;const e=/\d+[-.]\d+[-.]\d+[-.]\d+/.exec(a);if(!e)return i;const n=e[0],l=(((null===(o=t.site)||void 0===o?void 0:o.domainAliases)||[]).map((e=>e.value)).filter(Boolean).find((e=>e.endsWith(x.DEFAULT_DID_DOMAIN)))||"").replace(".".concat(x.DEFAULT_DID_DOMAIN),"");return l?i.replace(a,"".concat(l,"-").concat(n,".").concat(x.DEFAULT_IP_DOMAIN_SUFFIX)):i}return i.replace(t.meta.bundleDid,t.appPid)};function _(){const{t:e}=(0,c.PE)(),{api:t}=(0,S.T)(),{blocklet:n}=(0,j.y0)(),{inService:a}=(0,P.h6)(),[o,l]=(0,i.useState)(!1),[s,r]=(0,i.useState)(5),d=n&&n.structVersion!==x.APP_STRUCT_VERSION;return[d&&(0,C.jsxs)(v.Z,{type:"warning",style:{margin:"12px 0"},children:[(0,C.jsxs)(u.Z,{display:"flex",alignItems:"center",children:[(0,C.jsx)(h.Z,{variant:"contained",size:"small",color:"primary",onClick:()=>(()=>{try{if("running"===n.status)return void y.Z.error(e("blocklet.migrate.tip.running"));const t=E(n);if(t)return void y.Z.error(e("blocklet.migrate.tip.duplicate",{name:t}));l(!0)}catch(t){y.Z.error((0,B.Z)(t))}})(),style:{marginRight:8},children:e("blocklet.migrate.intro.l1")}),(0,C.jsx)("span",{children:e("blocklet.migrate.intro.l2")})]}),["l3","l4","l5","l6"].map((t=>(0,C.jsx)(u.Z,{display:"flex",alignItems:"center",children:e("blocklet.migrate.intro.".concat(t))},t)))]},"alert"),n&&(0,C.jsx)(w.Z,{popup:!0,open:o,saveConnect:!1,forceConnected:!1,action:"migrate-app-to-struct-v2",checkFn:t.get,checkTimeout:3e5,onSuccess:()=>{const e=L(window.location,n,a);setTimeout((()=>{window.location.href=e}),5e3),r(5),setInterval((()=>{r((e=>e-1))}),1e3)},extraParams:{appDid:n.appDid,did:n.meta.did,wt:(0,Z.iK)(n,!0),title:(0,g.getDisplayName)(n)},messages:{title:e("blocklet.migrate.title"),scan:e("blocklet.migrate.scan"),confirm:e("blocklet.migrate.confirm"),success:s>=0?e("blocklet.migrate.success",{sec:s}):"Redirecting..."},onClose:()=>l(!1)},"connect")]}_.propTypes={};var D,A=n(35966),N=n(85531),G=n(44846),U=n(78123),T=n(75793),I=n(17022),O=n(21289),K=n(74094),z=n(7199);const R=(0,i.lazy)((()=>Promise.all([n.e(7718),n.e(7020),n.e(4549)]).then(n.bind(n,64549)))),F=(0,i.lazy)((()=>Promise.all([n.e(7718),n.e(7020),n.e(8537),n.e(4631),n.e(2294),n.e(6547),n.e(9085),n.e(5760),n.e(506),n.e(2362),n.e(4852),n.e(4509),n.e(6230)]).then(n.bind(n,64558)))),M=(0,i.lazy)((()=>Promise.all([n.e(7718),n.e(7020),n.e(4631),n.e(6547),n.e(6743),n.e(506),n.e(4852),n.e(1294),n.e(3555),n.e(4775)]).then(n.bind(n,14775)))),V=(0,i.lazy)((()=>Promise.all([n.e(7718),n.e(442),n.e(9662),n.e(7676),n.e(8986)]).then(n.bind(n,13239)))),Y=(0,i.lazy)((()=>Promise.all([n.e(7718),n.e(7020),n.e(5745),n.e(9725),n.e(5374),n.e(592),n.e(5979),n.e(2537)]).then(n.bind(n,75979)))),$=(0,i.lazy)((()=>Promise.all([n.e(7718),n.e(7020),n.e(8537),n.e(4631),n.e(2294),n.e(6547),n.e(9085),n.e(5760),n.e(6743),n.e(9818),n.e(9590),n.e(5672),n.e(3216)]).then(n.bind(n,75672)))),W=(0,i.lazy)((()=>Promise.all([n.e(7718),n.e(7020),n.e(8537),n.e(4631),n.e(2294),n.e(9085),n.e(4901),n.e(1685),n.e(5015)]).then(n.bind(n,85555)))),X=(0,i.lazy)((()=>Promise.all([n.e(7718),n.e(7020),n.e(8537),n.e(4631),n.e(2294),n.e(9085),n.e(2911),n.e(4901),n.e(5745),n.e(442),n.e(5526),n.e(9725),n.e(7638),n.e(1685),n.e(9237),n.e(3135),n.e(406),n.e(1846),n.e(2264),n.e(8427)]).then(n.bind(n,48427)))),J=(0,i.lazy)((()=>Promise.all([n.e(7718),n.e(9327),n.e(8219)]).then(n.bind(n,92379)))),Q=(0,i.lazy)((()=>Promise.all([n.e(7718),n.e(7020),n.e(8537),n.e(4631),n.e(2294),n.e(6547),n.e(9085),n.e(5760),n.e(7534)]).then(n.bind(n,87534)))),q=(0,i.lazy)((()=>Promise.all([n.e(7718),n.e(7020),n.e(4901),n.e(4232),n.e(2611)]).then(n.bind(n,42611)))),H=(0,i.lazy)((()=>Promise.all([n.e(7718),n.e(7020),n.e(8537),n.e(4631),n.e(2294),n.e(6547),n.e(9085),n.e(5760),n.e(406),n.e(1846),n.e(9552)]).then(n.bind(n,39552)))),ee=e=>{let{children:t}=e;return t};function te(){var e;const t=(0,l.useNavigate)(),{tab:n="overview"}=(0,l.useParams)(),{did:a,blocklet:o,error:w,client:P,actions:{setBlocklet:j,refreshBlocklet:S}}=(0,O.y0)(),{refresh:B}=(0,T.h6)(),{t:Z}=(0,c.PE)(),E=(0,i.useCallback)((()=>(0,C.jsx)(V,{scope:a})),[a]),L=(null===o||void 0===o||null===(e=o.environments.find((e=>"BLOCKLET_APP_URL"===e.key)))||void 0===e?void 0:e.value)||window.location.origin,D=e=>(0,K.bV)(e,L),N=e=>{t("/blocklets/".concat(a,"/").concat(e))},te=e=>{e&&j(e),S()},ne=!o||(0,K.wS)(o.status)?[]:(0,g.getAppMissingConfigs)(o);let ie=null;const oe=[{label:Z("common.overview"),value:"overview"},{breadcrumbsLabel:Z("common.components"),label:(0,C.jsx)(p.Z,{color:"error",variant:"dot",invisible:!ne.length,children:Z("common.components")}),value:"components"}];if(w)ie=(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(v.Z,{type:"error",variant:"icon",children:(0,K.Z)(w)}),(0,C.jsx)(h.Z,{onClick:()=>S(),children:(0,C.jsx)("span",{style:{textDecoration:"underline"},children:Z("common.retry")})})]});else if(o){var le;const e={overview:(0,C.jsx)(R,{}),configuration:F,navigation:M,services:W,members:(0,C.jsx)($,{type:"blocklet",createPassportSvg:D}),passports:Y,components:X,"audit-logs":E,logs:J,runtime:(0,C.jsx)(Q,{}),traffic:(0,C.jsx)(q,{client:P,did:a}),storage:(0,C.jsx)(H,{})};"configuration"===n&&(0,K.wS)(o.status)&&N("overview"),(0,K.wS)(o.status)||(oe.push({label:Z("common.members"),value:"members"}),oe.push({label:Z("common.passport"),value:"passports"}),oe.push({label:Z("common.configuration"),value:"configuration"})),oe.push({label:Z("common.auditLogs"),value:"audit-logs"}),o&&null!==(le=o.children)&&void 0!==le&&le.length&&o.structVersion===x.APP_STRUCT_VERSION&&oe.push({label:Z("common.logs"),value:"logs"}),oe.push({label:Z("common.configNavigation"),value:"navigation"}),oe.push({label:Z("common.runtime"),value:"runtime"}),oe.push({label:Z("common.traffic"),value:"traffic"}),oe.push({label:Z("common.storage"),value:"storage"});(0,g.getBlockletServices)(o).length&&oe.splice(2,0,{label:Z("blocklet.services"),value:"services"});const t=e[n]||e.overview;ie=(0,C.jsxs)(f.g,{type:"components",children:[!(0,g.isExternalBlocklet)(o)&&(0,C.jsx)(m.Z,{tabs:oe,current:n,onChange:N,scrollButtons:"auto"}),(0,C.jsx)("div",{className:"page-content",children:(0,C.jsx)(i.Suspense,{fallback:(0,C.jsx)(A.Z,{relative:"parent",children:(0,C.jsx)(G.Z,{})}),children:(0,i.isValidElement)(t)?t:(0,C.jsx)(t,{blocklet:o,onUpdate:te,createPassportSvg:D})})})]})}else ie=(0,C.jsx)(A.Z,{relative:"parent",children:(0,C.jsx)(G.Z,{})});const se=oe.find((e=>e.value===n)),ce=o?I.G6:ee;return(0,C.jsx)(ce,{teamDid:a,children:(0,C.jsxs)(ae,{children:[(0,C.jsxs)(d.Z,{separator:"\u203a","aria-label":"breadcrumb",className:"page-breadcrumb",children:[(0,C.jsx)(s.Link,{color:"textSecondary",to:"/blocklets",children:Z("common.blocklets")}),(0,C.jsx)(s.NavLink,{to:"/blocklets/".concat(a,"/overview"),style:e=>e?{color:"inherit"}:{},children:Z("common.detail")}),(0,C.jsx)(r.Z,{color:"textSecondary",children:se?se.breadcrumbsLabel||se.label:""})]}),(0,C.jsxs)(r.Z,{component:"div",className:"page-header",children:[(0,C.jsxs)(r.Z,{component:"h2",variant:"h4",className:"page-title",color:"textPrimary",children:[o?(0,C.jsx)(k.Z,{blocklet:o,style:{marginRight:16}}):null,o?(0,C.jsxs)(u.Z,{display:"flex",alignItems:"center",flexWrap:"wrap",gap:1,children:[(0,C.jsx)(u.Z,{children:(0,g.getDisplayName)(o)}),"unknown"!==(null===o||void 0===o?void 0:o.status)&&(0,C.jsx)(b.Z,{size:"12px",status:o.status,source:o.source,progress:o.progress})]}):"".concat(Z("common.blocklet")," ").concat(Z("common.detail"))]}),(0,C.jsx)(z.Z,{permission:"mutate_blocklets",children:!!o&&!(0,g.isExternalBlocklet)(o)&&(0,C.jsx)(U.Z,{className:"page-actions",blocklet:o,onStart:()=>{},onComplete:e=>{let{action:n,error:a}=e;a?y.Z.error(a.message):"remove"===n?(B(),t("/blocklets")):S()},variant:"group"})})]}),(0,C.jsx)(_,{}),ie]})})}function ne(){const{did:e}=(0,l.useParams)();return e?(0,C.jsx)(O.$8,{did:e,children:(0,C.jsx)(N.wV,{children:(0,C.jsx)(te,{})})}):null}const ae=o.Z.main(D||(D=(0,a.Z)(["\n .page-header {\n display: flex;\n justify-content: space-between;\n align-items: center;\n flex-wrap: wrap;\n gap: 16px;\n }\n\n .page-title {\n display: flex;\n align-items: center;\n\n .page-link {\n font-size: 15px;\n margin-top: 8px;\n margin-left: 8px;\n }\n }\n\n .page-content {\n margin-top: 16px;\n }\n\n @media (max-width: ","px) {\n .page-header {\n flex-direction: column;\n align-items: flex-start;\n .page-actions,\n .MuiButtonGroup-root {\n width: 100%;\n }\n .MuiButtonGroup-root {\n .MuiButtonBase-root {\n flex: 1;\n }\n .blocklet-action-text {\n display: none;\n }\n }\n }\n\n .page-title {\n margin-bottom: 15px;\n }\n }\n"])),(e=>e.theme.breakpoints.values.md))},85531:(e,t,n)=>{n.d(t,{wV:()=>w,XN:()=>P});var a=n(5057),i=n(55898),o=n.n(i),l=n(86229),s=n(68420),c=n(77277),r=n(29054),d=n(84584),u=n(41899),p=n(58238),m=n(65873);var v=n(46090);function h(){var e;let{setLoading:t,refresh:n}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{blocklet:i,actions:{refreshBlocklet:o}}=(0,r.y0)(),s=null===i||void 0===i||null===(e=i.meta)||void 0===e?void 0:e.did,[c,h]=(0,a.useState)([]),{api:g}=(0,p.h6)();return(0,u.Z)((async()=>{try{if(!s)return void h([]);null===t||void 0===t||t(!0);const{spaceGateways:e}=await g.getBlockletSpaceGateways({input:{did:s}}),n=await async function(e){let{blockletDid:t,nodeApi:n,spaceGateways:a}=e,i=!1;const o=await Promise.all(a.map((async e=>{let{name:t}=e;const n=await(0,d.nU)(e.endpoint);return(0,m.isEmpty)(n)||n===t||(t=n,i=!0),{...e,name:t}})));return i&&await Promise.all(o.filter((e=>e.did)).map((e=>n.updateBlockletSpaceGateway({input:{did:t,where:{did:e.did},spaceGateway:{...e}}})))),o}({blockletDid:s,nodeApi:g,spaceGateways:e});h(null!==n&&void 0!==n?n:[])}catch(e){console.error(e),l.Z.error((0,v.Z)(e))}finally{null===t||void 0===t||t(!1)}}),[s,o,n]),{spaceGateways:c}}function g(){var e;let{deps:t,setLoading:n}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{deps:[],setLoading:()=>{}};const{blocklet:i}=(0,r.y0)(),[o,s]=(0,a.useState)([]),{api:c}=(0,p.h6)(),d=(0,m.debounce)((async()=>{try{if(n(!0),!i)return void s([]);const{backups:e}=await c.getBlockletBackups({input:{did:i.meta.did}});s(null!==e&&void 0!==e?e:[])}catch(e){console.error(e),l.Z.error((0,v.Z)(e))}finally{n(!1)}}),2e3);return(0,u.Z)((async()=>{d()}),[null===i||void 0===i||null===(e=i.meta)||void 0===e?void 0:e.did].concat(t)),{backups:o}}const b=function(e){let{appDid:t}=e;const{backups:n}=g(),[i,o]=(0,a.useState)({message:"",progress:0,completed:!1}),l=(0,p.h6)(),{ws:{useSubscription:s}}=l;return s(c.BlockletEvents.backupProgress,(e=>{t===(null===e||void 0===e?void 0:e.appDid)&&o((()=>({...e})))}),[t]),(0,a.useEffect)((()=>{var e;if(null!==n&&void 0!==n&&n.length&&(0,m.isNull)(null===(e=n[0])||void 0===e?void 0:e.status)){const[e]=n;o((()=>({message:e.message,progress:e.progress,completed:Boolean(e.progress>=100)})))}}),[n]),i};var f=n(96266);const y=(0,a.createContext)({}),{Provider:k,Consumer:x}=y;function w(e){let{children:t}=e;const{t:n}=(0,s.PE)(),{api:i}=(0,p.h6)(),{blocklet:o}=(0,r.y0)(),[m,v]=(0,a.useState)(!1),[y,x]=(0,a.useState)(!1),{spaceGateways:w}=h({refresh:y,setLoading:v}),P=b({appDid:null===o||void 0===o?void 0:o.appDid}),[j,S]=(0,a.useState)(!1),B=(0,a.useMemo)((()=>(0,d.mo)(null===o||void 0===o?void 0:o.environments)),[o,y,j]),[Z,C]=(0,a.useState)(!1),{backups:E}=g({deps:[P],setLoading:C}),[L,_]=(0,a.useState)(null===w||void 0===w?void 0:w.find((e=>e.endpoint===B))),[D,A]=(0,a.useState)(!1),N=function(){var e;let{deps:t}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{deps:[]};const{blocklet:n}=(0,r.y0)(),{api:i}=(0,p.h6)(),[o,l]=(0,a.useState)(null);return(0,u.Z)((async()=>{var e;if(null!==n&&void 0!==n&&null!==(e=n.meta)&&void 0!==e&&e.did){const{autoBackup:e}=await i.getAutoBackup({input:{did:n.meta.did}});l(e)}}),[null===n||void 0===n||null===(e=n.meta)||void 0===e?void 0:e.did].concat(t)),o}({deps:[D]}),[G,U]=(0,a.useState)(!1),T=function(){var e;let{deps:t}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{deps:[]};const{blocklet:n}=(0,r.y0)(),{api:i}=(0,p.h6)(),[o,l]=(0,a.useState)(null);return(0,u.Z)((async()=>{var e;if(null!==n&&void 0!==n&&null!==(e=n.meta)&&void 0!==e&&e.did){const{autoCheckUpdate:e}=await i.getAutoCheckUpdate({input:{did:n.meta.did}});l(e)}}),[null===n||void 0===n||null===(e=n.meta)||void 0===e?void 0:e.did].concat(t)),o}({deps:[G]}),I=()=>{x((e=>!e))};return(0,f.jsx)(k,{value:{spaceGateways:w,selectedSpaceGateway:L,addSpaceGateway:async(e,t)=>{w.push({...e,loading:!0}),await i.addBlockletSpaceGateway({input:{did:o.meta.did,spaceGateway:e}}),B!==t&&await i.configBlocklet({input:{did:[o.meta.did],configs:[{key:c.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:t}]}}),I(),_(e)},deleteSpaceGateway:async e=>{e&&(e.endpoint!==B?(await i.deleteBlockletSpaceGateway({input:{did:o.meta.did,spaceGatewayDid:null===e||void 0===e?void 0:e.did}}),I(),_(e)):l.Z.warning(n("storage.spaces.gateway.delete.failedForConnected")))},updateSpaceGateway:async e=>{var t;await i.updateBlockletSpaceGateway({input:{did:o.meta.did,where:{did:e.did},spaceGateway:e}}),B!==e.endpoint&&await i.configBlocklet({input:{did:[o.meta.did],configs:[{key:c.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:e.endpoint}]}}),l.Z.success(n("storage.spaces.connectedWithName",{name:null!==(t=null===e||void 0===e?void 0:e.name)&&void 0!==t?t:"DID Spaces"})),I()},refreshSpaceGateways:I,spaceGatewaysLoading:m,spaceGatewayIsSelected:e=>(null===e||void 0===e?void 0:e.endpoint)===B,updateAutoBackup:async e=>{await i.updateAutoBackup({input:{did:o.meta.did,autoBackup:e}}),A((e=>!e))},updateAutoCheckUpdate:async e=>{await i.updateAutoCheckUpdate({input:{did:o.meta.did,autoCheckUpdate:e}}),U((e=>!e))},autoCheckUpdate:T,backupEndpoint:B,backupProgress:P,backups:E,backupsLoading:Z,refreshBackupEndpoint:()=>{S((e=>!e))},autoBackup:N},children:t})}function P(){return(0,a.useContext)(y)}w.propTypes={children:o().any.isRequired},w.defaultProps={}},60344:(e,t,n)=>{n.d(t,{hi:()=>o,od:()=>i.a});var a=n(10458),i=n.n(a);i().defaults.timeout=1e4;const o=i().create()},84584:(e,t,n)=>{n.d(t,{EJ:()=>f,Jf:()=>b,LQ:()=>u,Nb:()=>p,UV:()=>y,Xv:()=>r,Z3:()=>k,ag:()=>v,mo:()=>m,nD:()=>d,nU:()=>g,w2:()=>h});var a=n(82434),i=n.n(a),o=n(77277),l=n(65873),s=n(2842),c=n(60344);function r(e){const t=e.replace(/\/api\/space\/.+/,""),n=e.replace(/\/$/,"").split("/"),a=n.at(-4),i=n.at(-2);return(0,s.xn)(t,"space",a,"apps",i,"explorer?key=/apps/".concat(i,"/.did-objects/").concat(i,"/"))}function d(e){const t=e.replace(/\/api\/space\/.+/,""),n=e.replace(/\/$/,"").split("/").at(-4);return(0,s.xn)(t,"space",n)}function u(e){return e.replace(/\/$/,"").split("/").at(-4)}async function p(e){try{if(!i()(e))return!1;const{headers:t}=await c.hi.head(e,{timeout:5e3});return"true"===t["x-listable"]&&"true"===t["x-readable"]&&"true"===t["x-writeable"]}catch(t){return console.error(t),!1}}function m(e){var t;return(null===e||void 0===e||null===(t=e.find((e=>e.key===o.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT)))||void 0===t?void 0:t.value)||""}function v(e){const t=new URL(e);return(0,s.xn)(t.origin,t.pathname)}async function h(e){try{if(!i()(e))return!1;const t=v(e),n=(0,s.xn)(t,"space/api/did/one-click-authorization/token"),{status:a,data:o}=await c.hi.get(n,{timeout:5e3});return 200===a&&(0,l.isObject)(o)}catch(t){return console.error(t),!1}}async function g(e){let{timeout:t}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{timeout:3e3};try{if(!i()(e))return"";const{headers:n}=await c.hi.head(e,{timeout:t}),a=n["x-space-name"];return a?decodeURIComponent(a):""}catch(n){return console.error(n),""}}function b(e){const t=e.replace(/\/api\/space\/.+/,""),n=e.replace(/\/$/,"").split("/").at(-4);return(0,s.xn)(t,"/api/space/nft/display?spaceDid=".concat(n))}const f=e=>{var t;return(null===e||void 0===e||null===(t=e.configs)||void 0===t||null===(t=t.find((e=>e.key===o.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_SPACE_ENDPOINT)))||void 0===t?void 0:t.value)||null};async function y(e){const t={};return t.did=u(e),t.name=await g(e),t.url=function(e){return null===e||void 0===e?void 0:e.replace(/\/api\/space\/.+/,"")}(e),t.endpoint=e,t}async function k(e){var t;let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{timeout:3e4,withSearchParams:!0};if(!(0,l.isString)(e))throw new Error("url(".concat(e,") must be a string"));const a=e.startsWith("http")?e:"https://".concat(e),i=new URL(a),{data:o}=await c.hi.get((0,s.xn)(i.origin,"/__blocklet__.js?type=json"),{timeout:n.timeout}),r=null===(t=o.componentMountPoints.findLast((e=>"z8iZnaYxnkMD5AKRjTKiCb8pQr1ut8UantAcf"===e.did)))||void 0===t?void 0:t.mountPoint;if(!r)throw new Error("MountPoint(".concat(r,") not found"));const d=(0,s.xn)(i.origin,r);return n.withSearchParams&&i.searchParams.get("spaceDid")?(0,s.xn)(d,"?spaceDid=".concat(i.searchParams.get("spaceDid"))):d}}}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(self.webpackChunk_abtnode_webapp=self.webpackChunk_abtnode_webapp||[]).push([[670,2611],{16580:(e,t,n)=>{n.r(t),n.d(t,{default:()=>X});var r=n(71171),o=n(5057),a=n(33518),i=n(85493),s=n(11750),l=n(94464),c=n(68420),d=n(42611),m=n(75793),u=n(96266);function p(){const{api:e,info:t}=(0,m.h6)();return(0,u.jsx)(d.default,{client:e,did:t.did})}var f=n(45603),h=n.n(f),v=n(39948),y=n(55402),g=n(55222),x=n(28768),b=n(75760),Z=n(44846),j=n(35966),k=n(66506),w=n(35432),P=n(77277),E=n(86229),D=n(1722),I=n(80378),O=n(46090),C=n(38242),L=n(56169),N=n(1979),R=n(55898),S=n.n(R),T=n(50844),_=n(99154),z=n(844);const B=(0,T.Z)((e=>({root:{height:10},colorPrimary:{backgroundColor:e.palette.grey["light"===e.palette.mode?200:700]},bar:{backgroundColor:e.palette.secondary.main}})))(_.Z);function F(e){const{value:t}=e;return(0,u.jsxs)(v.Z,{display:"flex",alignItems:"center",mt:2,children:[(0,u.jsx)(v.Z,{width:"100%",style:{overflow:"hidden"},mr:1,children:(0,u.jsx)(B,{variant:"determinate",...e})}),(0,u.jsx)(v.Z,{minWidth:35,children:(0,u.jsx)(s.Z,{variant:"body2",color:"textSecondary",children:"".concat(Math.round(t),"%")})})]})}function U(e){let{disk:t}=e;const{t:n}=(0,o.useContext)(c.RD),r=[{id:1,className:"used",title:n("system.used"),metric:(0,O.Gw)(t.used)},{id:2,className:"free",title:n("system.free"),metric:(0,O.Gw)(t.free)},{id:3,className:"total",title:n("system.total"),metric:(0,O.Gw)(t.total)}];return(0,u.jsx)(z.Z,{title:"".concat(n("common.disk")," (").concat(t.device,")"),value:(0,O.Gw)(t.used),graph:(0,u.jsx)(v.Z,{mt:3,children:(0,u.jsx)(F,{value:t.used/t.total*100})}),description:r.map(((e,t)=>(0,u.jsxs)(v.Z,{sx:{marginLeft:0===t?0:2},children:[e.title,": ",e.metric]},e.title)))})}F.propTypes={value:S().number.isRequired},U.propTypes={disk:S().shape({used:S().number,free:S().number,total:S().number,device:S().string})},U.defaultProps={disk:{used:0,free:0,total:1,device:""}};var M=n(67654),G=n(52926),Y=n(52581),q=n(34937),A=n(74094);const K={uptime:0,pid:-1,cpuUsage:0,memoryUsage:0},V="Blocklet Server";function H(e){let{initialBlocklets:t}=e;const{t:n,locale:r}=(0,c.PE)(),{api:a}=(0,m.h6)(),[i,l]=(0,M.Z)("runtime-view-interval",6),d=(0,o.useMemo)((()=>{const e=[];return e.push({type:"server",groupId:"server",groupName:V,id:"server:daemon",name:"Server (Daemon)",runtimeInfo:K}),e.push({type:"server",groupId:"server",groupName:V,id:"server:service",name:"Server (Service)",runtimeInfo:K}),t.forEach((t=>{(0,C.forEachBlockletSync)(t,((n,r)=>{let{id:o,ancestors:a}=r;n.runtimeInfo&&e.push({type:"blocklet",groupId:t.meta.did,groupName:(0,C.getDisplayName)(t),id:o,name:(0,C.getDisplayName)(n,!0),blocklet:t,component:n,runtimeInfo:n.runtimeInfo,ancestors:a})}))})),e}),[]),[p,f]=(0,o.useState)(d),[Z,j]=(0,o.useState)({os:{platform:""},mem:{used:0,free:0,total:1},cpu:{cpus:[],currentLoad:1},disks:[],daemon:{},service:{}}),[R,S]=(0,o.useState)({cpu:[],mem:[],daemonMem:[],serviceMem:[]});(0,q.mU)(w.EVENTS.NODE_RUNTIME_INFO,(e=>{e.mem.total=e.mem.total||0,e.mem.used=e.mem.total-(e.mem.available||0),j(e),f((t=>t.map((t=>"server:daemon"===t.id?{...t,runtimeInfo:{...t.runtimeInfo,...e.daemon}}:"server:service"===t.id?{...t,runtimeInfo:{...t.runtimeInfo,...e.service}}:t))))})),(0,q.mU)(w.EVENTS.BLOCKLETS_RUNTIME_INFO,(e=>{e&&e.length?f((t=>t.map((t=>{const n=e.find((e=>e.componentId===t.id));return n?{...t,runtimeInfo:{...t.runtimeInfo,...n.runtimeInfo}}:t})))):console.error("incorrect blocklets runtime info format",e)}));const T=e=>{f((t=>t.filter((t=>t.groupId!==e.meta.did))))},_=async e=>{try{const{blocklet:t}=await a.getBlocklet({input:{did:e.meta.did,attachRuntimeInfo:!0}});"running"!==t.status&&T(t),f((e=>{const n=e.filter((e=>e.groupId!==t.meta.did));return(0,C.forEachBlockletSync)(t,((e,r)=>{let{id:o,ancestors:a}=r;e.runtimeInfo&&n.push({type:"blocklet",groupId:t.meta.did,groupName:(0,C.getDisplayName)(t),id:o,name:(0,C.getDisplayName)(e,!0),blocklet:t,component:e,runtimeInfo:e.runtimeInfo,ancestors:a})})),n}))}catch(t){E.Z.error(t.message)}};(0,q.mU)(P.BlockletEvents.removed,T),(0,q.mU)(P.BlockletEvents.startFailed,T),(0,q.mU)(P.BlockletEvents.statusChange,(e=>{"running"===e.status?_(e):T(e)})),(0,q.mU)(P.BlockletEvents.updated,_),(0,q.mU)(P.BlockletEvents.started,_);(0,o.useEffect)((()=>{a.getNodeRuntimeHistory({input:{hours:i}}).then((e=>{const t=e.history||[];S({cpu:t.map((e=>({date:e.date,value:e.cpu}))),mem:t.map((e=>({date:e.date,value:e.mem}))),daemonMem:t.map((e=>({date:e.date,value:e.daemonMem}))),serviceMem:t.map((e=>({date:e.date,value:e.serviceMem})))})})).catch((e=>{E.Z.error(e.message)}))}),[i]);const z=[{label:n("common.group"),name:"groupName",options:{customBodyRenderLite(e){const{type:t,blocklet:n,groupName:r}=p[e];return"server"===t?(0,u.jsxs)(v.Z,{display:"flex",alignItems:"center",children:[(0,u.jsx)(Y.r,{width:"14",height:"14"}),(0,u.jsx)(v.Z,{ml:1,children:r})]}):(0,u.jsxs)(v.Z,{display:"flex",alignItems:"center",children:[(0,u.jsx)(D.Z,{size:14,blocklet:n}),(0,u.jsx)(v.Z,{ml:1,children:r})]})}}},{label:n("common.name"),name:"name",options:{customBodyRenderLite(e){const{type:t,name:n,component:r,ancestors:o}=p[e];return"server"===t?(0,u.jsxs)(v.Z,{display:"flex",alignItems:"center",children:[(0,u.jsx)(k.Z,{width:"14",height:"14"}),(0,u.jsx)(v.Z,{ml:1,children:n})]}):(0,u.jsxs)(v.Z,{display:"flex",alignItems:"center",children:[(0,u.jsx)(I.Z,{size:14,blocklet:r,ancestors:o}),(0,u.jsx)(v.Z,{ml:1,children:n})]})}}},{label:n("common.uptime"),name:"runtimeInfo.uptime",options:{customBodyRenderLite(e){const{runtimeInfo:t}=p[e];return n=t.uptime,h()(Number(n||0),{locale:(0,O.FF)(r)});var n}}},{label:n("blocklet.runtimeInfo.memoryUsage"),name:"runtimeInfo.memoryUsage",options:{customBodyRenderLite(e){const{runtimeInfo:t}=p[e];return(0,A.Gw)((null===t||void 0===t?void 0:t.memoryUsage)||0)},sortDirection:"asc"}},{label:n("blocklet.runtimeInfo.cpuUsage"),name:"runtimeInfo.cpuUsage",options:{customBodyRenderLite(e){const{runtimeInfo:t}=p[e];return"".concat((t.cpuUsage||0).toFixed(1),"%")}}},{label:n("blocklet.runtimeInfo.processId"),name:"runtimeInfo.pid"},{label:n("blocklet.runtimeInfo.port"),name:"runtimeInfo.port"}];return(0,u.jsxs)("div",{children:[(0,u.jsxs)(v.Z,{display:"flex",justifyContent:"space-between",flexDirection:"row",mb:2,children:[(0,u.jsx)(s.Z,{component:"h3",variant:"h5",color:"textPrimary",style:{fontSize:18,fontWeight:"bold"},children:n("analytics.trend")}),(0,u.jsx)(x.Z,{size:"small",exclusive:!0,value:i,onChange:(e,t)=>l(t),children:[1,3,6,12,24].map((e=>(0,u.jsxs)(g.Z,{value:e,children:[e,"H"]},e)))})]}),(0,u.jsxs)(y.ZP,{mb:4,container:!0,spacing:4,children:[(0,u.jsx)(y.ZP,{item:!0,lg:3,md:6,sm:6,xs:12,children:(0,u.jsx)(L.Z,{...Z.cpu,history:R.cpu})},"cpu"),(0,u.jsx)(y.ZP,{item:!0,lg:3,md:6,sm:6,xs:12,children:(0,u.jsx)(N.Z,{...Z.mem,history:R.mem})},"memory"),(0,u.jsx)(y.ZP,{item:!0,lg:3,md:6,sm:6,xs:12,children:(0,u.jsx)(N.Z,{title:"".concat(n("common.memory")," (Daemon)"),used:Z.daemon.memoryUsage||0,history:R.daemonMem})},"memory-daemon"),(0,u.jsx)(y.ZP,{item:!0,lg:3,md:6,sm:6,xs:12,children:(0,u.jsx)(N.Z,{title:"".concat(n("common.memory")," (Service)"),instanceCount:Z.service.instanceCount||0,used:Z.service.memoryUsage||0,history:R.serviceMem})},"memory-service"),Z.disks.map((e=>(0,u.jsx)(y.ZP,{item:!0,lg:3,md:6,sm:6,xs:12,children:(0,u.jsx)(U,{disk:e})},"disk")))]}),(0,u.jsx)(b.Z,{className:"runtime-insight-list",title:n("analytics.detail"),locale:r,data:p,columns:z,options:{download:!1,filter:!1,print:!1,pagination:!1,rowsPerPage:100}})]})}function W(){const{data:e,externalData:t,initialized:n}=(0,G.RJ)();if(!n)return(0,u.jsx)(j.Z,{relative:"parent",children:(0,u.jsx)(Z.Z,{})});const r=[...e,...t]||[];return(0,u.jsx)(H,{initialBlocklets:r})}var Q;function X(){const e=(0,i.useNavigate)(),{t:t}=(0,o.useContext)(c.RD),{tab:n="traffic"}=(0,i.useParams)(),r=[{label:t("common.traffic"),value:"traffic"},{label:t("common.runtime"),value:"runtime"}],a={traffic:p,runtime:W},d=a[n]||a.traffic;return(0,u.jsxs)(J,{children:[(0,u.jsx)(s.Z,{component:"h2",variant:"h4",className:"page-header",color:"textPrimary",children:t("common.analytics")}),(0,u.jsx)(l.Z,{tabs:r,current:n,onChange:t=>{e("/analytics/".concat(t))}}),(0,u.jsx)("div",{className:"page-content",children:(0,o.isValidElement)(d)?d:(0,u.jsx)(d,{})})]})}const J=a.Z.main(Q||(Q=(0,r.Z)(["\n .page-header {\n display: flex;\n justify-content: space-between;\n align-items: center;\n }\n\n .page-content {\n margin-top: 16px;\n }\n"])))},844:(e,t,n)=>{n.d(t,{Z:()=>p});var r,o=n(71171),a=n(55898),i=n.n(a),s=n(33518),l=n(38763),c=n(75392),d=n(11750),m=n(39948),u=n(96266);function p(e){let{style:t,title:n,value:r,graph:o,description:a}=e;return(0,u.jsx)(f,{children:(0,u.jsxs)(c.Z,{style:{...t},children:[(0,u.jsx)(d.Z,{sx:{fontSize:14},color:"text.secondary",children:n}),(0,u.jsx)(d.Z,{variant:"h5",component:"div",mt:1,children:r}),o,!!a&&(0,u.jsx)(m.Z,{display:"flex",sx:{fontSize:12,marginTop:3},color:"text.secondary",children:a})]})})}p.propTypes={style:i().object,title:i().node,value:i().node,graph:i().node,description:i().any},p.defaultProps={style:{},title:null,value:null,graph:null,description:null};const f=(0,s.Z)(l.Z)(r||(r=(0,o.Z)(["\n .card-content {\n height: 150px;\n }\n\n .card-sparkline {\n flex: 2;\n display: flex;\n position: relative;\n *[hidden] {\n display: none;\n }\n }\n .sparkline {\n stroke: ",";\n fill: ","1A;\n }\n .tooltip {\n position: absolute;\n background: rgba(0, 0, 0, 0.7);\n color: #fff;\n padding: 2px 5px;\n font-size: 12px;\n white-space: nowrap;\n z-index: 9999;\n }\n .sparkline--cursor {\n stroke: orange;\n }\n\n .sparkline--spot {\n fill: red;\n stroke: red;\n }\n"])),(e=>e.theme.palette.primary.main),(e=>e.theme.palette.primary.main))},52959:(e,t,n)=>{n.d(t,{Z:()=>m});var r=n(5057),o=n(55898),a=n.n(o),i=n(12673),s=n(28563),l=n(26089),c=n(844),d=n(96266);function m(e){let{id:t,title:n,current:o,description:a,data:m,dateFn:u,valueFn:p}=e;const f=(0,r.useRef)(null),h=(0,r.useRef)(null),v=(0,i.Z)({style:{top:0,left:0},hidden:!0,textContent:""}),[y,g]=(0,r.useState)(null),x=(0,s.Z)(y),b={onmousemove(e,t){const{date:n,value:r}=t;v.textContent="".concat(u(n),": ").concat(p(r)),v.style.top=-30,v.style.left=80,v.hidden=!1},onmouseout(){v.hidden=!0}};return(0,r.useEffect)((()=>{setTimeout((()=>{g(document.querySelector(".".concat(t))),setTimeout((()=>{f.current&&(0,l.Z)(f.current,m||[],b)}),400)}))}),[m]),(0,d.jsx)(c.Z,{title:n,value:o,graph:(0,d.jsxs)("div",{className:"card-sparkline ".concat(t),style:{marginTop:16},children:[(0,d.jsx)("svg",{ref:f,className:"sparkline",width:(null===x||void 0===x?void 0:x.width)||100,height:30,strokeWidth:"2"}),(0,d.jsx)("span",{className:"tooltip",ref:h,hidden:v.hidden,style:{...v.style},children:v.textContent})]}),description:a})}m.propTypes={id:a().string.isRequired,title:a().string.isRequired,current:a().any.isRequired,description:a().any,data:a().array,dateFn:a().func,valueFn:a().func},m.defaultProps={description:null,data:[],dateFn:e=>e,valueFn:e=>e}},56169:(e,t,n)=>{n.d(t,{Z:()=>m});var r=n(5057),o=n(55898),a=n.n(o),i=n(68420),s=n(52959),l=n(46090),c=n(96266);const d=e=>"".concat(e,"%");function m(e){let{cpus:t,currentLoad:n,history:o}=e;const{t:a,locale:m}=(0,r.useContext)(i.RD);return(0,c.jsx)(s.Z,{id:"cpu-sparkline",title:a("common.cpu"),current:"".concat(Math.floor(n||0),"%"),data:o,description:"".concat(a("system.cores"),": ").concat((null===t||void 0===t?void 0:t.length)||0),dateFn:e=>(0,l.mr)(e,"HH:mm:ss",m),valueFn:d})}m.propTypes={cpus:a().array,currentLoad:a().number,history:a().array},m.defaultProps={cpus:[],currentLoad:0,history:[]}},1979:(e,t,n)=>{n.d(t,{Z:()=>d});var r=n(55898),o=n.n(r),a=n(39948),i=n(68420),s=n(52959),l=n(46090),c=n(96266);function d(e){let{instanceCount:t,title:n,total:r,used:o,history:d}=e;const{t:m,locale:u}=(0,i.PE)(),p=!!r,f=r-o,h=p?"(".concat(Math.floor(o/r*100),"%)"):"",v=[];return t&&v.push({title:m("system.instances"),metric:t}),v.push({title:m("system.used"),metric:(0,l.Gw)(o)}),p&&v.push({title:m("system.free"),metric:(0,l.Gw)(f)},{title:m("system.total"),metric:(0,l.Gw)(r)}),(0,c.jsx)(s.Z,{id:"mem-sparkline",title:n||m("common.memory"),current:"".concat((0,l.Gw)(Math.floor(o||0))," ").concat(h),data:d,description:v.map(((e,t)=>(0,c.jsxs)(a.Z,{sx:{marginLeft:0===t?0:2},children:[e.title,": ",e.metric]},e.title))),dateFn:e=>(0,l.mr)(e,"HH:mm:ss",u),valueFn:l.Gw})}d.propTypes={title:o().string,instanceCount:o().number,total:o().number,used:o().number,history:o().array},d.defaultProps={title:"",instanceCount:null,total:null,used:null,history:[]}},42611:(e,t,n)=>{n.r(t),n.d(t,{default:()=>M,getDefaultRanges:()=>U});var r=n(5057),o=n(1577),a=n.n(o),i=n(6465),s=n.n(i),l=n(6352),c=n.n(l),d=n(74511),m=n(96181),u=n(93938),p=n(44846),f=n(55402),h=n(11750),v=n(56556),y=n(67680),g=n(11819),x=n(13811),b=n(49204),Z=n(79940),j=n(20425),k=n(34862),w=n(68420),P=n(35432),E=n(87364),D=n(39458),I=n(4903),O=n(44926),C=n(90298),L=n(43713),N=n(59497),R=n(9732),S=n(13379),T=n(46090),_=n(58238),z=n(52959),B=n(96266);const F=s()(0),U=(e,t)=>[{label:"This Week",startDate:(0,E.Z)(e,{locale:t}),endDate:(0,D.Z)(e,{locale:t})},{label:"Last Week",startDate:(0,E.Z)((0,I.Z)(e,-1),{locale:t}),endDate:(0,D.Z)((0,I.Z)(e,-1),{locale:t})},{label:"Last 7 Days",startDate:(0,I.Z)(e,-1),endDate:e},{label:"This Month",startDate:(0,O.Z)(e),endDate:(0,C.Z)(e)},{label:"Last Month",startDate:(0,O.Z)((0,L.Z)(e,-1)),endDate:(0,C.Z)((0,L.Z)(e,-1))},{label:"This Year",startDate:(0,N.Z)(e),endDate:(0,R.Z)(e)},{label:"Last Year",startDate:(0,N.Z)((0,S.Z)(e,-1)),endDate:(0,R.Z)((0,S.Z)(e,-1))}];function M(e){let{client:t,did:n}=e;const o=a()().subtract(1,"day").toDate(),{info:i,inService:s}=(0,_.h6)(),{t:l,locale:E}=(0,w.PE)(),[D,I]=(0,r.useState)(null),[O,C]=(0,r.useState)(!1),[L,N]=(0,r.useState)(o),[R,S]=(0,r.useState)({startDate:a()().subtract(30,"day").toDate(),endDate:o}),M=(0,d.Z)((async()=>(await t.getTrafficInsights({input:{did:n,startDate:a()(R.startDate).format("YYYY-MM-DD"),endDate:a()(R.endDate).format("YYYY-MM-DD")}})).list));(0,r.useEffect)((()=>{M.loading||R.startDate&&R.endDate&&M.retry()}),[R]);const G=e=>{I(D?null:e.currentTarget)},Y=M.value||[],{loading:q,error:A}=M;if(!Y.length&&q)return(0,B.jsx)(p.Z,{});if(A)return(0,B.jsx)(u.Z,{severity:"error",children:(0,T.Z)(A)});const K={totalRequests:F,validRequests:F,failedRequests:F,uniqueVisitors:F,uniqueFiles:F,uniqueReferrers:F,uniqueNotFound:F,uniqueStaticFiles:F,logSize:T.Gw,bandwidth:T.Gw},V=Object.keys(K).map((e=>({id:"".concat(e,"_chart"),title:l("analytics.traffic.".concat(e)),current:Y.length?K[e](Y[0][e]):0,data:Y.map((t=>({date:t.date,value:t[e]}))).reverse(),dateFn:F,valueFn:K[e]}))),H=Boolean(D),W=H?"date-range-picker-popover":void 0,Q=s?P.WELLKNOWN_SERVICE_PATH_PREFIX:i.routing.adminPath,X=c()(window.location.origin,Q,"/api/analytics/traffic?date=".concat(a()(L).format("YYYY-MM-DD"),"&did=").concat(n));return(0,B.jsxs)("div",{children:[(0,B.jsxs)(h.Z,{component:"div",variant:"h5",className:"page-header",color:"textPrimary",style:{fontSize:18,fontWeight:"bold"},mb:2,children:[l("analytics.trend"),(0,B.jsxs)(v.Z,{onClick:G,variant:"outlined",size:"small",color:"secondary",children:[(0,T.pz)(R.startDate,E)," - ",(0,T.pz)(R.endDate,E)]})]}),(0,B.jsx)(g.ZP,{id:W,open:H,anchorEl:D,onClose:()=>I(null),anchorOrigin:{vertical:"bottom",horizontal:"left"},children:(0,B.jsx)(b.D,{open:!0,toggle:G,maxDate:o,definedRanges:U(L),onChange:e=>{S(e),I(null)}})}),(0,B.jsx)(f.ZP,{container:!0,spacing:4,children:V.map((e=>(0,B.jsx)(f.ZP,{item:!0,lg:3,md:6,sm:6,xs:12,children:(0,B.jsx)(z.Z,{...e})},e.id)))}),(0,B.jsxs)(h.Z,{component:"div",variant:"h5",className:"page-header",color:"textPrimary",style:{fontSize:18,fontWeight:"bold"},mt:4,mb:1,children:[l("analytics.detail"),(0,B.jsxs)("span",{children:[O&&(0,B.jsx)(y.Z,{onClick:()=>{window.open(X)},style:{marginRight:32},children:(0,B.jsx)(x.Z,{})}),(0,B.jsx)(k._,{dateAdapter:j.y,children:(0,B.jsx)(Z.M,{disableFuture:!0,format:"ll",value:a()(L),onChange:e=>{N(e.toDate()),C(!1)},slotProps:{textField:{size:"small"}}})})]})]}),(0,B.jsx)(m.Z,{url:X,width:"100%",height:"100%",frameBorder:0,onLoad:()=>C(!0),styles:{border:0,minHeight:"400vh"}})]})}},1722:(e,t,n)=>{n.d(t,{Z:()=>d});var r=n(55898),o=n.n(r),a=n(62681),i=n(72333),s=n(77277),l=n(49522),c=n(96266);function d(e){let{blocklet:t,style:n,size:r,...o}=e;const{logoUrl:d}=(0,l.Z)({blocklet:t}),{variant:m}=o;let u=(0,c.jsx)("img",{src:d,alt:"",style:{width:r}});if(!t.meta.logo){var p;(null===(p=(t.configs||[]).find((e=>e.key===s.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_LOGO_SQUARE)))||void 0===p?void 0:p.value)||(u=(0,c.jsx)(i.Z,{did:t.meta.did||"",responsive:!0}))}return(0,c.jsx)(a.Z,{variant:m||"square",style:Object.assign({backgroundColor:"transparent",width:r,height:r,borderRadius:10},n),...o,children:u})}d.propTypes={blocklet:o().object.isRequired,style:o().object,size:o().oneOfType([o().number,o().string])},d.defaultProps={style:{},size:40}},80378:(e,t,n)=>{n.d(t,{Z:()=>p});var r=n(55898),o=n.n(r),a=n(62681),i=n(72333),s=n(6352),l=n.n(s),c=n(35432),d=n(58238),m=n(46090);var u=n(96266);function p(e){let{blocklet:t,style:n,size:r,ancestors:o,...s}=e;const p=(0,d.h6)(),{logoUrl:f,inService:h}=function(e){var t;let{blocklet:n,ancestors:r=[]}=e;const o=(0,d.h6)(),{inService:a}=o,i="?v=".concat(null===n||void 0===n||null===(t=n.meta)||void 0===t?void 0:t.version).concat((0,m.XN)(null===n||void 0===n?void 0:n.status)?"~":"");let s=a?l()(m.zn,c.WELLKNOWN_SERVICE_PATH_PREFIX,"/blocklet/logo-bundle",i):l()(o.imgPrefix,"blocklet.png");if("registry"===n.source&&n.deployedFrom&&n.meta.logo)s=l()(n.deployedFrom,(0,m.lk)(n.meta.bundleDid,n.meta.logo),i);else{const e=window.env.apiPrefix||"/",t=r.concat(n),o=a?t.slice(1):t;s=l()(e,"/blocklet/logo-bundle".concat(o.map((e=>"/".concat(e.meta.did))).join("")),i)}return{logoUrl:s,inService:a}}({blocklet:t,ancestors:o}),{variant:v}=s,y=h?()=>{}:e=>{e.target.src="".concat(p.imgPrefix,"/blocklet.png")};let g=(0,u.jsx)("img",{src:f,onError:y,alt:t.meta.name,style:{width:r}});return t.meta.logo||(g=(0,u.jsx)(i.Z,{did:t.meta.did||"",responsive:!0})),(0,u.jsx)(a.Z,{variant:v||"square",style:Object.assign({backgroundColor:"transparent",width:r,height:r,borderRadius:10},n),...s,children:g})}p.propTypes={blocklet:o().object.isRequired,style:o().object,size:o().oneOfType([o().number,o().string]),ancestors:o().array},p.defaultProps={style:{},size:40,ancestors:[]}},49522:(e,t,n)=>{n.d(t,{Z:()=>c});var r=n(6352),o=n.n(r),a=n(77277),i=n(58238),s=n(46090);const l=(e,t)=>{let n="?v=";var r;t?n+=(0,s.Qi)(t):n+="".concat(null===e||void 0===e||null===(r=e.meta)||void 0===r?void 0:r.version).concat((0,s.wS)(null===e||void 0===e?void 0:e.status)?"~":"");return n};function c(e){var t,n,r,s;let{blocklet:c}=e;const{inService:d}=(0,i.h6)(),m=null===(t=((null===c||void 0===c?void 0:c.environments)||[]).find((e=>e.key===a.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_LOGO_SQUARE)))||void 0===t?void 0:t.value,u=null===(n=((null===c||void 0===c?void 0:c.environments)||[]).find((e=>e.key===a.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_LOGO_RECT)))||void 0===n?void 0:n.value,p=null===(r=((null===c||void 0===c?void 0:c.environments)||[]).find((e=>e.key===a.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_LOGO_FAVICON)))||void 0===r?void 0:r.value,f=(null===(s=window.env)||void 0===s?void 0:s.apiPrefix)||"/";return{logoUrl:o()(f,"/blocklet/logo/".concat(d?"":c.meta.did),l(c,m)),rectLogoUrl:o()(f,"/blocklet/logo-rect/".concat(d?"":c.meta.did),l(c,u)),faviconUrl:o()(f,"/blocklet/logo-favicon/".concat(d?"":c.meta.did),l(c,p))}}},66506:(e,t,n)=>{t.Z=void 0;(r=n(5057))&&r.__esModule;var r,o=n(96266);function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?a(Object(n),!0).forEach((function(t){s(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):a(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function s(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var l=function(e){return(0,o.jsxs)("svg",i(i({},e),{},{children:[(0,o.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2.083 3.2c0-.619.501-1.12 1.12-1.12h25.6c.619 0 1.12.501 1.12 1.12v10.24a1.12 1.12 0 0 1-1.12 1.12h-25.6a1.12 1.12 0 0 1-1.12-1.12V3.2zm2.24 1.12v8h23.36v-8H4.323zm-2.24 14.24c0-.619.501-1.12 1.12-1.12h25.6c.619 0 1.12.501 1.12 1.12V28.8a1.12 1.12 0 0 1-1.12 1.12h-25.6a1.12 1.12 0 0 1-1.12-1.12V18.56zm2.24 1.12v8h23.36v-8H4.323z",fill:"currentColor"}),(0,o.jsx)("path",{d:"M8.963 7.04h-1.28a.64.64 0 0 0-.64.64v1.28a.64.64 0 0 0 .64.64h1.28a.64.64 0 0 0 .64-.64V7.68a.64.64 0 0 0-.64-.64zm0 15.36h-1.28a.64.64 0 0 0-.64.64v1.28a.64.64 0 0 0 .64.64h1.28a.64.64 0 0 0 .64-.64v-1.28a.64.64 0 0 0-.64-.64zm5.12-15.36h-1.28a.64.64 0 0 0-.64.64v1.28a.64.64 0 0 0 .64.64h1.28a.64.64 0 0 0 .64-.64V7.68a.64.64 0 0 0-.64-.64zm0 15.36h-1.28a.64.64 0 0 0-.64.64v1.28a.64.64 0 0 0 .64.64h1.28a.64.64 0 0 0 .64-.64v-1.28a.64.64 0 0 0-.64-.64z",fill:"currentColor"})]}))};l.defaultProps={width:"32",height:"32",viewBox:"0 0 32 32",xmlns:"http://www.w3.org/2000/svg"},l.displayName="server";t.Z=l},50844:(e,t,n)=>{n.d(t,{Z:()=>p});var r=n(7896),o=n(29218),a=n(5057),i=n(56129),s=n.n(i),l=n(92877);var c=n(95335),d=n(96266);const m=["defaultTheme","withTheme","name"],u=["classes"],p=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return n=>{const{defaultTheme:i,withTheme:p=!1,name:f}=t,h=(0,o.Z)(t,m);let v=f;const y=(0,l.Z)(e,(0,r.Z)({defaultTheme:i,Component:n,name:f||n.displayName,classNamePrefix:v},h)),g=a.forwardRef((function(e,t){const a=(0,o.Z)(e,u),s=y((0,r.Z)({},n.defaultProps,e));let l,m=a;return("string"===typeof f||p)&&(l=(0,c.Z)()||i,f&&(m=function(e){const{theme:t,name:n,props:o}=e;if(!t||!t.components||!t.components[n]||!t.components[n].defaultProps)return o;const a=(0,r.Z)({},o),i=t.components[n].defaultProps;let s;for(s in i)void 0===a[s]&&(a[s]=i[s]);return a}({theme:l,name:f,props:a})),p&&!m.theme&&(m.theme=l)),(0,d.jsx)(n,(0,r.Z)({ref:t,classes:s},m))}));return s()(g,n),g}}},88781:(e,t,n)=>{n.d(t,{Z:()=>o});var r=n(5057);function o(e){return r.Children.toArray(e).filter((e=>r.isValidElement(e)))}}}]);
|