@abtnode/blocklet-services 1.16.17-beta-ce49fe0e → 1.16.17-beta-2ac96448
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/api/index.js +1 -0
- package/api/routes/blocklet.js +10 -22
- package/api/util/index.js +1 -45
- package/build/asset-manifest.json +17 -17
- package/build/index.html +1 -1
- package/build/service-worker.js +1 -1
- package/build/service-worker.js.map +1 -1
- package/build/static/js/1760.ed4e8587.chunk.js +2 -0
- package/build/static/js/4461.d60aa7be.chunk.js +2 -0
- package/build/static/js/4802.b3a4b474.chunk.js +2 -0
- package/build/static/js/5547.980439e8.chunk.js +3 -0
- package/build/static/js/{6139.c781eea4.chunk.js → 6139.f7ca5bd6.chunk.js} +2 -2
- package/build/static/js/6186.4a89edaf.chunk.js +2 -0
- package/build/static/js/716.cf9ba82c.chunk.js +3 -0
- package/build/static/js/716.cf9ba82c.chunk.js.LICENSE.txt +5 -0
- package/build/static/js/main.7dce6ab7.js +3 -0
- package/package.json +18 -18
- package/build/static/js/1760.1e5aaa46.chunk.js +0 -2
- package/build/static/js/3255.2cf7c752.chunk.js +0 -2
- package/build/static/js/4461.02f584b7.chunk.js +0 -2
- package/build/static/js/4802.534357c1.chunk.js +0 -2
- package/build/static/js/5547.2e5aa64f.chunk.js +0 -3
- package/build/static/js/6186.1f08318c.chunk.js +0 -2
- package/build/static/js/main.ee013f15.js +0 -3
- /package/build/static/js/{5547.2e5aa64f.chunk.js.LICENSE.txt → 5547.980439e8.chunk.js.LICENSE.txt} +0 -0
- /package/build/static/js/{main.ee013f15.js.LICENSE.txt → main.7dce6ab7.js.LICENSE.txt} +0 -0
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";(self.webpackChunk_abtnode_blocklet_services=self.webpackChunk_abtnode_blocklet_services||[]).push([[4802],{92746:function(e,n,t){var r,i=t(71171),o=t(33028),a=t(59740),l=t(16380),s=t(50442),c=t(37574),d=["labelProps","className","style"];function u(e){var n=e.labelProps,t=e.className,r=e.style,i=(0,a.Z)(e,d),l=(0,o.Z)((0,o.Z)({},n),{},{labelPlacement:(null===n||void 0===n?void 0:n.labelPlacement)||"start"});return(0,c.jsx)(f,{className:t,style:r,children:(0,c.jsx)(s.Z,(0,o.Z)({labelProps:l},i))})}u.propTypes=s.Z.propTypes,u.defaultProps=s.Z.defaultProps;var f=l.Z.div(r||(r=(0,i.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"])),(function(e){return e.theme.breakpoints.down("sm")}));n.Z=u},121:function(e,n,t){t.r(n),t.d(n,{default:function(){return vt}});var r=t(71171),i=t(33028),o=t(96234),a=t(59740),l=t(68079),s=t(30969),c=t(16380),d=t(24974),u=t.n(d),f=t(95973),p=t(19611),m=t.n(p),h=t(20244),x=t(38361),Z=t(3994),g=t(79823),v=t(64689),b=t(99254),j=t(76527),k=t(85385),y=t(52838),C=t(23038),w=t(86822),L=t(26022),S=t(19865),P=t(7017),E=t(70998),A=t(84802),_=t(32723),N=t(34795),O=t(46292),T=t.n(O),R=t(15888),F=t.n(R),I=t(65667),B=t.n(I),D=t(34159),U=t(75295),z=t(29996),K=t(13134),W=t(59467),G=t(59505),H=t(1986),V=t(67019),M=t(94308),Y=t(88581),q=t(27724),J=t(94551),Q=t(2689),X=t(39130),$=t(7173),ee=t(94702),ne=t(14458),te=t(28412),re=t(76934),ie=t(37574),oe=["label","disabled","required","initialValue","onChange","style","onSubmit","triggers","options","formatterBeforeSubmit"],ae={PaperProps:{style:{maxHeight:224,width:250}}},le=function(e,n,t){return{fontWeight:-1===n.indexOf(e)?t.typography.fontWeightRegular:t.typography.fontWeightMedium}};function se(e){var n=e.label,t=e.disabled,r=e.required,l=e.initialValue,c=e.onChange,d=e.style,u=e.onSubmit,f=e.triggers,p=e.options,m=e.formatterBeforeSubmit,h=(0,a.Z)(e,oe),Z=(0,ee.Z)(),g=(0,s.useState)(!1),v=(0,o.Z)(g,2),b=v[0],j=v[1],k=(0,s.useState)(!1),y=(0,o.Z)(k,2),C=y[0],w=y[1],L=(0,s.useState)(l),S=(0,o.Z)(L,2),P=S[0],E=S[1],A=(0,s.useState)(P),O=(0,o.Z)(A,2),T=O[0],R=O[1],F=function(){var e=(0,N.Z)((0,_.Z)().mark((function e(){return(0,_.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return w(!0),e.prev=1,e.next=4,u("function"===typeof m?m(T):T);case 4:!1===e.sent?R(P):(R(T),E(T)),e.next=11;break;case 8:e.prev=8,e.t0=e.catch(1),R(P);case 11:return e.prev=11,w(!1),j(!1),e.finish(11);case 15:case"end":return e.stop()}}),e,null,[[1,8,11,15]])})));return function(){return e.apply(this,arguments)}}(),I=b?(0,ie.jsx)(X.Z,(0,i.Z)((0,i.Z)({value:T,onChange:function(e){var n=e.target.value;n="string"===typeof n?n.split(","):n,R(n),c(n)},fullWidth:!0,multiple:!0,variant:"outlined",margin:"dense",renderValue:function(e){return(0,ie.jsx)(x.Z,{sx:{display:"flex",flexWrap:"wrap"},children:e.filter((function(e){return p.some((function(n){return n.code===e}))})).map((function(e){return(0,ie.jsx)($.Z,{label:p.find((function(n){return n.code===e})).name,style:{marginRight:8},size:"small"},e)}))})},MenuProps:ae},h),{},{children:p.map((function(e){return(0,ie.jsx)(Q.Z,{value:e.code,style:le(e.code,T,Z),children:e.name},e.code)}))})):(0,ie.jsx)(x.Z,{px:1,className:"form-item-input slot",style:{whiteSpace:"pre-wrap"},children:T.filter((function(e){return p.some((function(n){return n.code===e}))})).map((function(e){return(0,ie.jsx)($.Z,{label:p.find((function(n){return n.code===e})).name,style:{marginRight:8},size:"small"},e)}))});return(0,ie.jsx)(te.Z,{className:"form",style:d,children:(0,ie.jsxs)(x.Z,{className:"form-item",children:[(0,ie.jsxs)(x.Z,{className:"form-item-label",children:[n,r&&(0,ie.jsx)(ne.Z,{})]}),(0,ie.jsxs)(x.Z,{className:"form-item-body",children:[(0,ie.jsx)(x.Z,{className:"form-item-input",children:I}),(0,ie.jsx)(x.Z,{className:"form-item-action",children:b?(0,ie.jsxs)(ie.Fragment,{children:[(0,ie.jsx)(J.Z,{"data-cy":"schema-form-item-confirm",onClick:F,disabled:t||C,size:"large",children:C?(0,ie.jsx)(M.Z,{size:24}):(0,ie.jsx)(q.Z,{})}),(0,ie.jsx)(J.Z,{"data-cy":"schema-form-item-cancel",onClick:function(){R(P),j(!1)},disabled:t||C,size:"large",children:(0,ie.jsx)(Y.default,{})})]}):(0,ie.jsx)(re.Z,{triggers:f,onEnterEdit:function(){return j(!0)},disabled:t})})]})]})})}se.propTypes={style:u().object,onSubmit:u().func,onChange:u().func,label:u().string,initialValue:u().string,required:u().bool,disabled:u().bool,triggers:u().array,options:u().array,formatterBeforeSubmit:u().func},se.defaultProps={style:{},onSubmit:function(){},onChange:function(){},label:"",initialValue:"",required:!1,disabled:!1,triggers:[],options:[],formatterBeforeSubmit:function(e){return e.join(",")}};var ce=t(41395),de=t(24891),ue=t(19066),fe=t(22572),pe=t(85710),me=t(8479),he=["teamDid","size"];function xe(e){var n=e.teamDid,t=e.size,r=void 0===t?"small":t,l=(0,a.Z)(e,he),c=(0,L.PE)().t,d=(0,ce.h6)().api,u=(0,s.useState)(!1),f=(0,o.Z)(u,2),p=f[0],m=f[1],h=(0,s.useState)(null),x=(0,o.Z)(h,2),Z=x[0],g=x[1],v=function(){var e=(0,N.Z)((0,_.Z)().mark((function e(){var t,r;return(0,_.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,m(!0),e.next=4,d.clearCache({input:{teamDid:n}});case 4:r=e.sent,H.Z.success(c("blocklet.config.clearCache.success",{count:(null===(t=r.removed)||void 0===t?void 0:t.length)||0})),e.next=11;break;case 8:e.prev=8,e.t0=e.catch(0),H.Z.error((0,pe.Z)(e.t0));case 11:return e.prev=11,m(!1),g(null),e.finish(11);case 15:case"end":return e.stop()}}),e,null,[[0,8,11,15]])})));return function(){return e.apply(this,arguments)}}(),b={title:c("blocklet.config.clearCache.title"),description:c("blocklet.config.clearCache.description"),confirm:c("common.confirm"),cancel:c("common.cancel"),onConfirm:v,onCancel:function(){m(!1),g(null)}};return(0,ie.jsxs)("div",(0,i.Z)((0,i.Z)({},l),{},{children:[(0,ie.jsxs)(z.Z,{onClick:function(){return g(b)},color:"error",variant:"outlined",size:r,children:[p?(0,ie.jsx)(M.Z,{size:16,style:{marginRight:5}}):null,c("blocklet.config.clearCache.action")]}),Z&&(0,ie.jsx)(me.Z,{title:Z.title,description:Z.description,confirm:Z.confirm,cancel:Z.cancel,onConfirm:Z.onConfirm,onCancel:Z.onCancel})]}))}var Ze,ge=t(43178),ve=t(72836),be=t(77370),je=t(45008);function ke(e){var n=e.initialValue,t=e.onChange,r=e.disabled,i=e.loading,a=(0,L.PE)().t,l=(0,be.T)().api,s=(0,je.y0)().blocklet,c=(0,ge.Z)({newAppSk:"",isConnectOpen:!1}),d=(0,o.Z)(c,2),u=d[0],f=d[1],p=function(){var e=(0,N.Z)((0,_.Z)().mark((function e(n){return(0,_.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,t(n);case 3:return e.prev=3,f({newAppSk:""}),e.finish(3);case 6:case"end":return e.stop()}}),e,null,[[0,,3,6]])})));return function(n){return e.apply(this,arguments)}}(),m=function(){return f({isConnectOpen:!1})},Z=s.structVersion===h.APP_STRUCT_VERSION?[{key:"rotate-with-did-wallet",title:"Migrate with DID Wallet",handler:function(){(0,de.An)(s.status)?H.Z.error(a("blocklet.error.isRunning")):(0,P.isInProgress)(s.status)?H.Z.error(a("blocklet.error.isInProgress")):f({isConnectOpen:!0})}}]:[];return[(0,ie.jsx)(V.Z,{disabled:r,loading:i,initialValue:n,onSubmit:function(e){return f({newAppSk:e}),!1},triggers:Z,secure:!0}),u.newAppSk&&(0,ie.jsx)(me.Z,{title:a("blocklet.config.appSkTitle"),description:(0,ie.jsxs)(x.Z,{children:[(0,ie.jsx)(x.Z,{children:a("blocklet.config.appSkChangeTip")}),(0,ie.jsx)(x.Z,{fontWeight:"bold",mt:2,children:a("blocklet.config.appDidChangeTip")}),(0,ie.jsxs)(Ce,{children:[(0,ie.jsx)("li",{children:a("blocklet.config.appDidChangeTipL1")}),(0,ie.jsx)("li",{children:a("blocklet.config.appDidChangeTipL2")})]})]}),confirm:a("confirm"),cancel:a("cancel"),onConfirm:function(){return p(u.newAppSk)},onCancel:function(){return f({newAppSk:""})}}),(0,ie.jsx)(ve.default,{popup:!0,open:u.isConnectOpen,forceConnected:!1,saveConnect:!1,action:"rotate-key-pair",checkFn:l.get,checkTimeout:3e5,onSuccess:m,extraParams:{appDid:s.appDid},messages:{title:a("setup.keyPair.title"),scan:a("setup.keyPair.scan"),confirm:a("setup.keyPair.confirm"),success:a("setup.keyPair.success")},onClose:m})]}ke.propTypes={initialValue:u().string,onChange:u().func,disabled:u().bool,loading:u().bool},ke.defaultProps={initialValue:"default",onChange:function(){},disabled:!1,loading:!1};var ye,Ce=(0,c.Z)("ul")(Ze||(Ze=(0,r.Z)(["\n padding-left: 16px;\n li {\n margin-top: 8px;\n list-style: disk;\n font-weight: bold;\n }\n"]))),we=t(50496),Le=t(43207),Se=t(33359),Pe=t(23299),Ee=t(49884),Ae=t(88876),_e=t(73820),Ne=t(80670);function Oe(e){var n=e.onCancel,t=e.onSuccess,r=e.onError,i=(0,s.useContext)(be.B).api,a=(0,s.useState)(!1),l=(0,o.Z)(a,2),c=l[0],d=l[1],u=(0,L.PE)(),f=u.t,p=u.locale,m=(0,s.useState)(""),h=(0,o.Z)(m,2),Z=h[0],g=h[1],v=(0,s.useState)(!1),b=(0,o.Z)(v,2),j=b[0],k=b[1],y=(0,s.useState)(0),C=(0,o.Z)(y,2),w=C[0],S=C[1],P=(0,s.useState)(""),E=(0,o.Z)(P,2),A=E[0],_=E[1],N=(0,Ne.DJ)().endpoint,O=(0,s.useState)(!1),T=(0,o.Z)(O,2),R=T[0],F=T[1],I=function(e){g(null),d(!0);try{_(e.result),S(D.length-1)}catch(t){var n=(0,de.Z)(t);g(n),r(t)}finally{d(!1)}},B=function(){k(!1),S(0)},D=[{body:(0,ie.jsxs)(x.Z,{children:[(0,ie.jsx)(Se.Z,{children:f("team.transferApp.transferDialog.tips.progress")}),(0,ie.jsx)(Se.Z,{mt:3,mb:2,children:f("team.transferApp.transferDialog.tips.newOwnerPermissions")})]}),cancel:f("common.cancel"),confirm:f("team.transferApp.transferDialog.createTransferLink"),onCancel:n,onConfirm:function(){k(!0),S(1)}},{body:function(){return(0,ie.jsx)(ve.default,{action:"transfer-app-owner",open:j,locale:p,checkFn:i.get,onClose:B,onSuccess:I,checkTimeout:3e5,extraParams:{},messages:{title:f("team.transferApp.connectDialog.title"),scan:f("team.transferApp.connectDialog.scan"),confirm:f("team.transferApp.connectDialog.confirm"),success:f("team.transferApp.connectDialog.success")},popup:!0})}},{body:function(){var e=(0,de.VP)({transferId:A.transferId,endpoint:N});return(0,ie.jsxs)(ie.Fragment,{children:[(0,ie.jsx)(x.Z,{component:Re,dangerouslySetInnerHTML:{__html:f("team.transferApp.transferDialog.createSuccessTip1")}}),(0,ie.jsx)(x.Z,{component:Re,mt:2,children:(0,ie.jsx)(Re,{children:f("team.transferApp.transferDialog.createSuccessTip3")})}),(0,ie.jsxs)(x.Z,{children:[(0,ie.jsx)(x.Z,{component:Re,mt:2,children:(0,ie.jsx)(Re,{children:f("team.transferApp.transferDialog.createSuccessTip2",{expireDate:(0,de.B2)(A.expireDate,p)})})}),(0,ie.jsx)(x.Z,{my:1,children:(0,ie.jsx)(_e.Z,{children:e})})]}),(0,ie.jsx)("div",{children:(0,ie.jsx)(Ee.Z,{value:"end",control:(0,ie.jsx)(Ae.Z,{checked:R,onChange:function(e){return F(e.target.checked)}}),label:f("team.transferApp.transferDialog.iKnow"),labelPlacement:"end"})})]})},confirm:f("common.confirm"),onConfirm:t}],U=D[w];return(0,ie.jsxs)(we.ZP,{title:(0,ie.jsx)(Re,{className:"title",children:f("team.transferApp.transferDialog.title")}),fullWidth:!0,open:!0,showCloseButton:!1,actions:(0,ie.jsxs)(ie.Fragment,{children:[U.cancel&&(0,ie.jsx)(z.Z,{onClick:U.onCancel,color:"inherit",children:U.cancel}),(0,ie.jsxs)(z.Z,{onClick:U.onConfirm,color:"error",disabled:c||w===D.length-1&&!R,variant:"contained",autoFocus:!0,children:[c&&(0,ie.jsx)(M.Z,{size:16}),U.confirm]})]}),children:[(0,ie.jsx)(Le.Z,{component:"div",children:"function"===typeof U.body?U.body():U.body}),!!Z&&(0,ie.jsx)(Pe.Z,{type:"error",variant:"icon",children:Z})]})}Oe.propTypes={onCancel:u().func.isRequired,onSuccess:u().func.isRequired,onError:u().func},Oe.defaultProps={onError:function(){}};var Te,Re=c.Z.div(ye||(ye=(0,r.Z)(["\n font-size: 16px;\n font-weight: bold;\n &.title {\n font-size: 20px;\n }\n"]))),Fe=t(15300),Ie=["blocklet","onUpdate","hasPermission"],Be=Object.keys(G.SUPPORTED_LANGUAGES).map((function(e){return{code:e,name:G.SUPPORTED_LANGUAGES[e].nativeName}})),De=(0,s.lazy)((function(){return Promise.all([t.e(4917),t.e(5547)]).then(t.bind(t,25547)).then((function(e){return{default:e.Uploader}}))})),Ue="/blocklet/logo/upload";function ze(e){var n,t=e.blocklet,r=e.onUpdate,l=e.hasPermission,c=(0,a.Z)(e,Ie),d=(0,ce.h6)(),u=d.api,f=d.inService,p=d.prefix,Z=d.getSessionInHeader,g=d.ws.useSubscription,v=(0,s.useContext)(L.RD).t,b=(0,s.useState)(""),j=(0,o.Z)(b,2),k=j[0],y=j[1],C=(0,s.useState)(""),w=(0,o.Z)(C,2),S=w[0],E=w[1],A=(0,s.useState)(!1),O=(0,o.Z)(A,2),R=O[0],I=O[1],M=(0,P.getWhoCanAccess)(t),Y=null===t||void 0===t||null===(n=t.settings)||void 0===n?void 0:n.publicToStore,q=S||!l,J=(0,s.useRef)(null),Q=(0,Fe.Z)({blocklet:t}),X=Q.logoUrl,$=Q.rectLogoUrl,ee=Q.faviconUrl,ne=(0,s.useState)(),te=(0,o.Z)(ne,2),re=te[0],oe=te[1],ae=m()(p,Ue,"square",t.meta.did),le=m()(p,Ue,"rect",t.meta.did),pe=m()(p,Ue,"favicon",t.meta.did),me=function(e){l&&(oe({uploader:e,disableMediaKitPrefix:!0}),J.current.open())},he=t.meta.did,Ze=t.site,ge=T()(t.meta,"capabilities.clusterMode",!1);if(g(h.EVENTS.NODE_RUNTIME_INFO,(function(e){ge&&y(T()(e,"cpu.physicalCores",""))})),(0,de.wS)(t.status))return null;var ve=t.environments.find((function(e){return e.key===G.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_DELETABLE})),be=!ve||"yes"===ve.value,je=t.environments.find((function(e){return e.key===G.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_LANGUAGES})),ye=t.environments.find((function(e){return e.key===G.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_URL})),Ce=t.environments.find((function(e){return e.key===G.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_COPYRIGHT_OWNER})),we=t.environments.find((function(e){return e.key===G.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_COPYRIGHT_YEAR})),Le=[{key:G.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_NAME,description:v("blocklet.config.name"),value:t.environments.find((function(e){return"BLOCKLET_APP_NAME"===e.key})).value},{key:G.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_DESCRIPTION,description:v("blocklet.config.description"),value:t.environments.find((function(e){return"BLOCKLET_APP_DESCRIPTION"===e.key})).value},{key:G.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_URL,description:v("blocklet.config.appUrl"),value:ye?ye.value:""},{key:G.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_COPYRIGHT_OWNER,description:v("blocklet.config.copyrightOwner"),value:Ce?Ce.value:""},{key:G.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_COPYRIGHT_YEAR,description:v("blocklet.config.copyrightYear"),value:we?we.value:""}];if(ge){var Se=t.configs.find((function(e){return e.key===G.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_CLUSTER_SIZE})),Pe=Se?Se.value:k;Le.push({key:G.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_CLUSTER_SIZE,description:v("blocklet.config.clusterSize"),value:Pe,cpuCores:k})}var Ee=function(){var e=(0,N.Z)((0,_.Z)().mark((function e(n){var i,o,a;return(0,_.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!S){e.next=2;break}return e.abrupt("return");case 2:return E(!0),e.prev=3,i=n.target.checked,e.next=7,u.configPublicToStore({input:{did:t.meta.did,publicToStore:i}});case 7:o=e.sent,a=o.blocklet,r(a),e.next=15;break;case 12:e.prev=12,e.t0=e.catch(3),H.Z.error(e.t0.message);case 15:return e.prev=15,E(!1),e.finish(15);case 18:case"end":return e.stop()}}),e,null,[[3,12,15,18]])})));return function(n){return e.apply(this,arguments)}}(),Ae=function(){var e=(0,N.Z)((0,_.Z)().mark((function e(n,i){var o,a,l,s;return(0,_.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n!==G.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_CLUSTER_SIZE){e.next=5;break}if(!(o=(0,de.I)({value:i,cpuCores:k}))){e.next=5;break}return H.Z.error(o),e.abrupt("return");case 5:return a=[{key:n,value:i}],e.prev=6,E(!0),e.next=10,u.configBlocklet({input:{did:t.meta.did,configs:a}});case 10:l=e.sent,s=l.blocklet,r(s),e.next=18;break;case 15:e.prev=15,e.t0=e.catch(6),H.Z.error(e.t0.message);case 18:return e.prev=18,E(!1),e.finish(18);case 21:case"end":return e.stop()}}),e,null,[[6,15,18,21]])})));return function(n,t){return e.apply(this,arguments)}}(),_e=function(){var e=(0,N.Z)((0,_.Z)().mark((function e(n){var i,o,a;return(0,_.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!S){e.next=2;break}return e.abrupt("return");case 2:return E(!0),e.prev=3,i=n.target.checked,e.next=7,u.configBlocklet({input:{did:t.meta.did,configs:[{key:G.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_DELETABLE,value:i?"no":"yes"}]}});case 7:o=e.sent,a=o.blocklet,r(a),e.next=15;break;case 12:e.prev=12,e.t0=e.catch(3),H.Z.error(e.t0.message);case 15:return e.prev=15,E(!1),e.finish(15);case 18:case"end":return e.stop()}}),e,null,[[3,12,15,18]])})));return function(n){return e.apply(this,arguments)}}(),Ne=function(){var e=(0,N.Z)((0,_.Z)().mark((function e(n){var r,i,o;return(0,_.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=Ze.corsAllowedOrigins||[],i=n.split(",").map((function(e){return e.trim()})).filter(Boolean),!F()(r,i)){e.next=4;break}return e.abrupt("return",!1);case 4:return e.prev=4,E(!0),o=i.length?i:["__none__"],e.next=9,u.updateRoutingSite({input:{id:Ze.id,corsAllowedOrigins:o,teamDid:t.meta.did}});case 9:E(!1),e.next=17;break;case 12:return e.prev=12,e.t0=e.catch(4),H.Z.error(e.t0.message),E(!1),e.abrupt("return",!1);case 17:return e.abrupt("return",!0);case 18:case"end":return e.stop()}}),e,null,[[4,12]])})));return function(n){return e.apply(this,arguments)}}(),Te=function(){var e=(0,N.Z)((0,_.Z)().mark((function e(n){var i,o;return(0,_.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!S){e.next=2;break}return e.abrupt("return");case 2:return E(!0),e.prev=3,e.next=6,u.configBlocklet({input:{did:t.meta.did,configs:[{key:G.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_SK,value:n}]}});case 6:i=e.sent,o=i.blocklet,r(o),e.next=14;break;case 11:e.prev=11,e.t0=e.catch(3),H.Z.error(e.t0.message);case 14:return e.prev=14,E(!1),e.finish(14);case 17:case"end":return e.stop()}}),e,null,[[3,11,14,17]])})));return function(n){return e.apply(this,arguments)}}(),Re={"&::after":{content:'"'.concat(v("common.switch"),'"')}};return(0,ie.jsxs)(He,(0,i.Z)((0,i.Z)({},c),{},{children:[Le.map((function(e){return(0,ie.jsxs)(x.Z,{className:"config-form",mt:2,children:[(0,ie.jsx)(x.Z,{className:"config-label",fontSize:14,mb:0,children:e.description}),(0,ie.jsx)(V.Z,{style:{marginTop:0},disabled:S||q,loading:S,initialValue:e.value,onSubmit:function(n){return Ae(e.key,n)}})]})})),(0,ie.jsx)(x.Z,{className:"config-form",component:U.Z,my:3}),(0,ie.jsx)(x.Z,{className:"config-label",fontSize:14,mb:1,sx:{flexGrow:0,width:"auto"},children:v("blocklet.config.logoSquare")}),(0,ie.jsx)(x.Z,{className:B()("uploader-wrapper",l&&"enabled"),sx:Re,onClick:function(){return me(ae)},children:(0,ie.jsx)(W.Z,{sx:{height:80,width:80},variant:"square",alt:"Blocklet Logo",src:X})}),(0,ie.jsx)(x.Z,{className:"config-label",fontSize:14,mt:4,children:v("blocklet.config.logoRect")}),(0,ie.jsx)(x.Z,{mb:1.5,className:"config-desc",children:v("blocklet.config.logoRectDesc")}),(0,ie.jsx)(x.Z,{className:B()("uploader-wrapper",l&&"enabled"),sx:Re,onClick:function(){return me(le)},children:(0,ie.jsx)("img",{alt:"Blocklet Rect Logo",src:$,style:{height:"80px"}})}),(0,ie.jsx)(x.Z,{className:"config-label",fontSize:14,mt:4,children:v("blocklet.config.logoFavicon")}),(0,ie.jsx)(x.Z,{mb:1.5,className:"config-desc",children:v("blocklet.config.logoFaviconDesc")}),(0,ie.jsx)(x.Z,{sx:{display:"inline-flex",cursor:l?"pointer":"default"},onClick:function(){return me(pe)},children:(0,ie.jsx)(W.Z,{variant:"square",sx:{width:20,height:20},alt:"Blocklet Favicon Logo",src:ee})}),(0,ie.jsx)(De,{id:"\u200buploader-logo",ref:J,popup:!0,onUploadFinish:function(){J.current.close()},plugins:[],apiPathProps:re,coreProps:{restrictions:{allowedFileTypes:["image/*",".jpg",".jpeg",".png",".gif",".svg"],maxFileSize:10485760,maxNumberOfFiles:1}},tusProps:{headers:Z}},"uploader-logo"),(0,ie.jsx)(x.Z,{className:"config-form",children:"all"===M&&"registry"===t.source&&(0,ie.jsxs)(x.Z,{className:"config-item",children:[(0,ie.jsxs)(x.Z,{className:"config-label",children:[v("blocklet.config.access.publicToStore"),(0,ie.jsx)(x.Z,{className:"config-desc",children:v("blocklet.config.access.publicInstanceTip")})]}),(0,ie.jsx)(D.Z,{disabled:q,checked:Y,defaultChecked:!0,onChange:Ee})]})}),(0,ie.jsx)(x.Z,{className:"config-form",component:U.Z,my:3}),(0,ie.jsxs)(x.Z,{className:"config-form",mt:2,children:[(0,ie.jsx)(x.Z,{className:"config-label",fontSize:14,mb:0,children:v("blocklet.config.languages")}),(0,ie.jsx)(se,{style:{marginTop:0},disabled:S||q,loading:S,options:Be,initialValue:je?je.value.split(","):["en","zh"],onSubmit:function(e){return Ae("BLOCKLET_APP_LANGUAGES",e)}})]}),(0,ie.jsx)(x.Z,{className:"config-form",component:U.Z,my:3}),(0,ie.jsx)(x.Z,{className:"config-form",mt:2,children:(0,ie.jsx)(x.Z,{className:"config-label",mb:0,children:v("common.security")})}),(0,ie.jsxs)(x.Z,{className:"config-form",mt:2,children:[(0,ie.jsx)(x.Z,{className:"config-label",fontSize:14,mb:0,children:v("router.domainSecurity.cors.title")}),(0,ie.jsx)(x.Z,{mb:1.5,className:"config-desc",children:v("router.domainSecurity.cors.description",{name:"the blocklet"})}),(0,ie.jsx)(V.Z,{style:{marginTop:0},disabled:S||q,loading:S,initialValue:(Ze.corsAllowedOrigins||[]).join(", "),onSubmit:Ne})]}),(0,ie.jsx)(x.Z,{className:"config-form",component:U.Z,my:3}),(0,ie.jsx)(x.Z,{mb:2,className:"config-label",fontSize:20,children:v("blocklet.config.dangerZone")}),(0,ie.jsxs)(x.Z,{px:2,py:1,sx:{border:"1px solid red",borderRadius:2},children:[(0,ie.jsx)(x.Z,{className:"config-form",mt:2,children:!f&&(0,ie.jsxs)(x.Z,{className:"config-item",children:[(0,ie.jsxs)(x.Z,{className:"config-label",children:[v("blocklet.config.deletable.name"),(0,ie.jsx)(x.Z,{className:"config-desc",children:v(be?"blocklet.config.deletable.disable":"blocklet.config.deletable.enable")})]}),(0,ie.jsx)(D.Z,{disabled:q,checked:!be,defaultChecked:!0,onChange:_e})]})}),(0,ie.jsxs)(x.Z,{className:"config-form",mt:2,children:[(0,ie.jsx)(x.Z,{className:"config-label",fontSize:14,mb:0,children:v("blocklet.config.sk")}),(0,ie.jsx)(ke,{disabled:S||q,loading:S,initialValue:t.environments.find((function(e){return"BLOCKLET_APP_SK"===e.key})).value,onChange:Te})]}),f&&(0,ie.jsx)(fe.Z,{role:"owner",children:function(e){return(e||ue.C)&&(0,ie.jsxs)(x.Z,{className:"config-form",mt:2,children:[(0,ie.jsxs)(x.Z,{className:"config-item",children:[(0,ie.jsx)(x.Z,{className:"config-label",mb:0,children:v("team.transferApp.name")}),(0,ie.jsxs)(z.Z,{style:{flexShrink:0},variant:"contained",edge:"end",color:"error",size:"small","data-cy":"transfer-app",onClick:function(){return I(!0)},children:[(0,ie.jsx)(K.Z,{style:{fontSize:"1.3em",marginRight:4}}),v("team.transferApp.name")]})]}),R&&(0,ie.jsx)(Oe,{onCancel:function(){return I(!1)},onSuccess:function(){return I(!1)}})]})}}),(0,ie.jsx)(x.Z,{className:"config-form",mt:2,children:(0,ie.jsxs)(x.Z,{className:"config-item",children:[(0,ie.jsxs)(x.Z,{className:"config-label",children:[v("blocklet.config.clearCache.name"),(0,ie.jsx)(x.Z,{className:"config-desc",children:v("blocklet.config.clearCache.purpose")})]}),(0,ie.jsx)(xe,{teamDid:he})]})})]})]}))}var Ke=(0,fe.V)(ze,"mutate_blocklets"),We=(0,fe.V)(ze,"",de.Wf);function Ge(e){return(0,ce.h6)().inService?(0,ie.jsx)(We,(0,i.Z)({},e)):(0,ie.jsx)(Ke,(0,i.Z)({},e))}ze.propTypes={blocklet:u().object.isRequired,onUpdate:u().func,hasPermission:u().bool},ze.defaultProps={onUpdate:function(){},hasPermission:!1};var He=c.Z.div(Te||(Te=(0,r.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\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"])),(function(e){return e.theme.breakpoints.down("md")})),Ve=t(78789),Me=t(46121),Ye=t(87535),qe=t(87006),Je=t(72097),Qe=t(49735),Xe=t.n(Qe),$e=t(35147),en=t(14764),nn=t(52553),tn=t.n(nn),rn=t(27021),on=t.n(rn),an=t(44632),ln=t.n(an),sn={enabled:!1,secure:!1,from:"",host:"",port:"",user:"",password:""};var cn=function(){var e,n,t,r=(0,ce.h6)().api,o=(0,je.y0)().blocklet,a=(0,L.PE)().t,l=null===o||void 0===o||null===(e=o.meta)||void 0===e?void 0:e.did,s=Object.assign((0,i.Z)({},sn),(null===o||void 0===o||null===(n=o.settings)||void 0===n||null===(t=n.notification)||void 0===t?void 0:t.email)||{}),c=(0,en.cI)({defaultValues:Xe()(s,Object.keys(sn))}),d=c.handleSubmit,u=c.control,f=c.formState,p=c.watch,m=c.reset,h=p("enabled"),Z=(0,$e.Z)(function(){var e=(0,N.Z)((0,_.Z)().mark((function e(n){var t,o,s,c,d;return(0,_.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,r.configNotification({input:{did:l,notification:JSON.stringify({email:n})}});case 3:s=e.sent,c=s.blocklet,d=Object.assign((0,i.Z)({},sn),(null===c||void 0===c||null===(t=c.settings)||void 0===t||null===(o=t.notification)||void 0===o?void 0:o.email)||{}),m(d),H.Z.success(a("oauth.saveSuccess")),e.next=13;break;case 10:e.prev=10,e.t0=e.catch(0),H.Z.error(e.t0.message||a("oauth.saveFailed"));case 13:case"end":return e.stop()}}),e,null,[[0,10]])})));return function(n){return e.apply(this,arguments)}}()),g=(0,$e.Z)((function(e){var n=null===e||void 0===e?void 0:e.trim();return n?!!tn()(n)||a("notification.email.fromInvalid"):a("notification.email.fromRequired")})),v=(0,$e.Z)((function(e){var n=null===e||void 0===e?void 0:e.trim();return n?!!on()(n,{require_host:!1,protocols:[]})||a("notification.email.hostInvalid"):a("notification.email.hostRequired")})),b=(0,$e.Z)((function(e){return e?!!ln()(e)||a("notification.email.portInvalid"):a("notification.email.portRequired")})),j=(0,$e.Z)((function(e){return!(null===e||void 0===e||!e.trim())||a("notification.email.userRequired")})),k=(0,$e.Z)((function(e){return!(null===e||void 0===e||!e.trim())||a("notification.email.passwordRequired")})),y=(0,$e.Z)((function(){return!0}));return(0,ie.jsx)(x.Z,{children:(0,ie.jsxs)("form",{onSubmit:d(Z),disabled:!0,children:[(0,ie.jsx)(en.Qr,{name:"enabled",control:u,render:function(e){var n=e.field;return(0,ie.jsx)(Ee.Z,{control:(0,ie.jsx)(D.Z,(0,i.Z)({checked:n.value},n)),label:a("notification.email.enable"),sx:{marginBottom:"8px"}})}}),(0,ie.jsx)(en.Qr,{name:"from",control:u,rules:{validate:h?g:y},render:function(e){var n,t=e.field;return(0,ie.jsx)(Ye.Z,{fullWidth:!0,children:(0,ie.jsx)(qe.Z,(0,i.Z)((0,i.Z)({},t),{},{label:a("notification.email.from"),error:!!f.errors[t.name],helperText:(null===(n=f.errors[t.name])||void 0===n?void 0:n.message)||"\u3000",disabled:!h}))})}}),(0,ie.jsx)(en.Qr,{name:"host",control:u,rules:{validate:h?v:y},render:function(e){var n,t=e.field;return(0,ie.jsx)(Ye.Z,{fullWidth:!0,children:(0,ie.jsx)(qe.Z,(0,i.Z)((0,i.Z)({},t),{},{error:!!f.errors[t.name],label:a("notification.email.host"),helperText:(null===(n=f.errors[t.name])||void 0===n?void 0:n.message)||"\u3000",disabled:!h}))})}}),(0,ie.jsx)(en.Qr,{name:"port",control:u,rules:{validate:h?b:y},render:function(e){var n,t=e.field;return(0,ie.jsx)(Ye.Z,{fullWidth:!0,children:(0,ie.jsx)(qe.Z,(0,i.Z)((0,i.Z)({},t),{},{type:"number",error:!!f.errors[t.name],label:a("notification.email.port"),helperText:(null===(n=f.errors[t.name])||void 0===n?void 0:n.message)||"\u3000",disabled:!h}))})}}),(0,ie.jsx)(en.Qr,{name:"user",control:u,rules:{validate:h?j:y},render:function(e){var n,t=e.field;return(0,ie.jsx)(Ye.Z,{fullWidth:!0,children:(0,ie.jsx)(qe.Z,(0,i.Z)((0,i.Z)({},t),{},{error:!!f.errors[t.name],label:a("notification.email.user"),helperText:(null===(n=f.errors[t.name])||void 0===n?void 0:n.message)||"\u3000",disabled:!h}))})}}),(0,ie.jsx)(en.Qr,{name:"password",control:u,rules:{validate:h?k:y},render:function(e){var n,t=e.field;return(0,ie.jsx)(Ye.Z,{fullWidth:!0,children:(0,ie.jsx)(qe.Z,(0,i.Z)((0,i.Z)({},t),{},{type:"password",error:!!f.errors[t.name],label:a("notification.email.password"),helperText:(null===(n=f.errors[t.name])||void 0===n?void 0:n.message)||"\u3000",disabled:!h}))})}}),(0,ie.jsx)(en.Qr,{name:"secure",control:u,rules:{validate:y},render:function(e){var n=e.field;return(0,ie.jsx)(Ye.Z,{fullWidth:!0,children:(0,ie.jsx)(Ee.Z,{control:(0,ie.jsx)(D.Z,(0,i.Z)((0,i.Z)({checked:n.value},n),{},{disabled:!h})),label:a("notification.email.secure"),style:{marginBottom:16}})})}}),(0,ie.jsx)(Je.Z,{type:"submit",variant:"contained",onSubmit:d(Z),disabled:!f.isDirty,children:a("oauth.save")})]})})},dn=[{label:(0,ie.jsx)(x.Z,{textAlign:"center",width:"100%",children:"Email"}),value:"email"},{label:(0,ie.jsx)(x.Z,{textAlign:"center",width:"100%",children:"More"}),value:"more"}];var un,fn,pn=function(){var e=(0,s.useState)(dn[0].value),n=(0,o.Z)(e,2),t=n[0],r=n[1],i=(0,s.useContext)(L.RD).t,a=(0,Me.Z)((function(){return{email:(0,ie.jsx)(cn,{}),more:(0,ie.jsx)(x.Z,{children:(0,ie.jsx)(Ve.Z,{children:i("notification.comingSoon")})})}}),[i]);return(0,ie.jsxs)(x.Z,{children:[(0,ie.jsx)(S.Z,{tabs:dn,current:t,onChange:r}),(0,ie.jsx)(x.Z,{marginTop:"10px",children:a[t]})]})},mn=t(6779),hn=t(6698),xn=t(11909),Zn=t(1484),gn=t(2569),vn=t(88356),bn=t(98127),jn=t(86008),kn=t(70115),yn="roles",Cn=[].concat((0,l.Z)(kn.Z),[{value:yn,icon:bn.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"}}]),wn=function(e,n){if(e&&e.startsWith(h.WHO_CAN_ACCESS_PREFIX_ROLES)){var t=(0,P.getRolesFromAuthConfig)({whoCanAccess:e}),r=n.filter((function(e){return t.includes(e.name)}));return{access:yn,roles:r}}return{access:e,roles:[]}},Ln=function(e,n){var t=(arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}).roles,r=void 0===t?[]:t,i=(e.configs||[]).find((function(e){return e.key===G.BLOCKLET_CONFIGURABLE_KEY.COMPONENT_ACCESS_WHO}));if(i)return wn(i.value,r);if(n&&T()(n,"settings.whoCanAccess")&&T()(n,"settings.whoCanAccess")!==h.WHO_CAN_ACCESS.ALL)return wn(T()(n,"settings.whoCanAccess"),r);var o=(0,P.findServiceFromMeta)(e.meta,h.NODE_SERVICES.AUTH);return T()(o,"config.whoCanAccess")?wn(o.config.whoCanAccess,r):{access:h.WHO_CAN_ACCESS.ALL,roles:[]}};function Sn(e){var n=e.blocklet,t=e.ancestors,r=e.children,i=(0,ee.Z)(),a=(0,s.useState)(""),c=(0,o.Z)(a,2),d=c[0],u=c[1],f=(0,L.PE)(),p=f.t,m=f.locale,Z=(0,ce.h6)().api,g=(0,Ne.DJ)().roles,v=(0,s.useState)(""),b=(0,o.Z)(v,2),j=b[0],k=b[1],y=t[0]||n,C=Ln(n,y,{roles:g}),w=C.access,S=C.roles,E=(0,s.useState)(w),A=(0,o.Z)(E,2),O=A[0],T=A[1],R=(0,s.useState)(S),F=(0,o.Z)(R,2),I=F[0],B=F[1],D=[].concat((0,l.Z)(t.map((function(e){return e.meta.did}))),[n.meta.did]),U={marginRight:4,fontSize:18,verticalAlign:"text-bottom",color:i.palette.text.secondary},K=t.concat(n).map((function(e){return(0,P.getDisplayName)(e,!0)})).join(" / ");if((0,de.wS)(n.status))return null;if("unknown"===n.status&&(0,de.wS)(n.status))return null;var W=function(){u(!1)},G=function(e){e.stopPropagation(),u(!0)},V=function(){var e=(0,N.Z)((0,_.Z)().mark((function e(){var n;return(0,_.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!j){e.next=2;break}return e.abrupt("return");case 2:return k(!0),e.prev=3,(n=O)===yn&&(n="".concat(h.WHO_CAN_ACCESS_PREFIX_ROLES).concat(I.map((function(e){return e.name})).join(","))),e.next=8,Z.updateWhoCanAccess({input:{did:D,whoCanAccess:n}});case 8:H.Z.success(p("blocklet.config.access.updatedTip")),W(),k(!1),e.next=17;break;case 13:e.prev=13,e.t0=e.catch(3),k(!1),H.Z.error((0,de.Z)(e.t0));case 17:case"end":return e.stop()}}),e,null,[[3,13]])})));return function(){return e.apply(this,arguments)}}(),Y=j||O===yn&&!I.length;return["function"===typeof r?r({open:G}):(0,ie.jsx)(J.Z,{onClick:G,"data-cy":"action-config-component",children:(0,ie.jsx)(vn.default,{})}),d&&(0,ie.jsxs)(En,{open:!0,fullWidth:!0,title:K,onClose:W,PaperProps:{style:{minHeight:"auto"}},actions:(0,ie.jsxs)(ie.Fragment,{children:[(0,ie.jsx)(z.Z,{onClick:W,color:"inherit","data-cy":"config-access-cancel",children:p("common.cancel")}),(0,ie.jsxs)(z.Z,{onClick:V,color:"primary",disabled:Y,variant:"contained",autoFocus:!0,"data-cy":"config-access-confirm",children:[j&&(0,ie.jsx)(M.Z,{size:16}),p("common.confirm")]})]}),children:[(0,ie.jsx)(x.Z,{mt:4,mb:3,children:(0,ie.jsx)(qe.Z,{label:p("blocklet.config.access.description"),select:!0,fullWidth:!0,value:O,onChange:function(e){var n=e.target.value;T(n)},"data-cy":"config-access-select",SelectProps:{renderValue:function(e){var n=Cn.find((function(n){return n.value===e}));return n?(0,ie.jsxs)(x.Z,{children:[(0,ie.jsx)(n.icon,{style:U}),n.title[m]]}):null}},children:Cn.map((function(e){return(0,ie.jsxs)(An,{value:e.value,sx:{display:"block"},"data-cy":"config-access-opt-".concat(e.value),children:[(0,ie.jsxs)(x.Z,{display:"flex",alignItems:"center",children:[(0,ie.jsx)(e.icon,{style:U}),(0,ie.jsx)(x.Z,{children:e.title[m]})]}),(0,ie.jsx)(x.Z,{children:(0,ie.jsx)(x.Z,{className:"tip",children:e.description[m]})})]})}))})}),O===yn&&(0,ie.jsx)(x.Z,{mt:4,mb:3,children:(0,ie.jsx)(qe.Z,{label:p("blocklet.config.access.description"),select:!0,fullWidth:!0,value:I.map((function(e){return e.name})),onChange:function(e){B(g.filter((function(n){return(e.target.value||[]).includes(n.name)})))},SelectProps:{multiple:!0,renderValue:function(e){return(0,ie.jsx)(x.Z,{sx:{display:"flex",flexWrap:"wrap",gap:.5},children:e.map((function(e){var n=g.find((function(n){return n.name===e}));return(0,ie.jsx)($.Z,{label:n.title},n.text)}))})}},children:g.map((function(e){var n=e.name,t=e.title;return(0,ie.jsxs)(Q.Z,{value:n,children:[(0,ie.jsx)(Ae.Z,{checked:I.some((function(e){return e.name===n}))}),(0,ie.jsx)(jn.Z,{primary:t})]},n)}))})})]})]}Sn.propTypes={blocklet:u().object.isRequired,ancestors:u().array,children:u().any},Sn.defaultProps={ancestors:[],children:null};var Pn,En=(0,c.Z)(we.ZP)(un||(un=(0,r.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"]))),An=(0,c.Z)(Q.Z)(fn||(fn=(0,r.Z)(["\n .tip {\n font-size: 12px;\n color: ",";\n }\n"])),(function(e){return e.theme.palette.text.secondary}));function _n(e){var n,t,r=e.blocklet,i=e.ancestors,a=e.depth,c=(0,ee.Z)(),d=(0,L.PE)(),u=d.t,f=d.locale,p=(0,Ne.DJ)().roles,m=(0,s.useState)(!0),h=(0,o.Z)(m,2),Z=h[0],g=h[1],v=(0,je.y0)().recommendedDomain,b=i[0]||r,j="/".concat(i.map((function(e){return e.mountPoint||"/"})).join("/"),"/").concat(r.mountPoint||"/").replace(/\/+/g,"/"),k=(0,de.vH)({blocklet:b,domain:{value:v},mountPoint:j,params:(0,de.f0)(b,f)}),w={fill:c.palette.text.secondary},S=a>0&&r.children.length>0,A=(0,ie.jsx)(J.Z,{size:"small",children:Z?(0,ie.jsx)(C.Z,{fontSize:"inherit"}):(0,ie.jsx)(y.default,{fontSize:"inherit"})}),_=Ln(r,b,{roles:p}),N=_.access,O=_.roles;if("roles"!==N)t=kn.Z.find((function(e){return e.value===N}))||kn.Z[2];else{var T=O.map((function(e){return e.title})).join("/");t={title:{zh:"\u53ea\u6709 ".concat(T," \u53ef\u4ee5\u8bbf\u95ee"),en:"Only ".concat(T," can access")}}}return[(a>0||"gateway"!==r.meta.group)&&(0,ie.jsxs)(x.Z,{display:"flex",py:2,className:"component-item",justifyContent:"space-between",alignItems:"center",children:[(0,ie.jsxs)(x.Z,{pl:Math.max(2*(a-1),0),width:{xs:300,md:400},display:"flex",alignItems:"center",style:{cursor:S?"pointer":"cursor"},onClick:function(){return S&&g(!Z)},children:[S?A:(0,ie.jsx)(x.Z,{width:28}),(0,ie.jsx)(E.Z,{blocklet:r,ancestors:i}),(0,ie.jsxs)(x.Z,{ml:"16px",children:[(0,ie.jsx)(x.Z,{style:{color:"#222",fontSize:18},children:(0,P.getDisplayName)(r,!0)}),(0,ie.jsx)(x.Z,{display:"flex",alignItems:"center",children:(0,ie.jsx)(x.Z,{color:"text.secondary",children:t.title[f]})})]})]},r),(0,ie.jsxs)(x.Z,{children:[(0,ie.jsx)(mn.Z,{title:u("common.visit"),children:(0,ie.jsx)("a",{target:"_blank",href:k,rel:"noopener noreferrer",title:k,children:(0,ie.jsx)(J.Z,{children:(0,ie.jsx)(xn.Z,{})})})}),(0,ie.jsx)(Sn,{blocklet:r,ancestors:i,children:function(e){var n=e.open;return(0,ie.jsx)(mn.Z,{title:u("common.edit"),children:(0,ie.jsx)(J.Z,{onClick:n,"data-cy":"btn-edit-".concat(r.meta.did),children:(0,ie.jsx)(Zn.Z,{style:w})})})}})]},"actions")]},"group-not-gateway-box"),(0,ie.jsx)(gn.Z,{depth:a}),null!==(n=r.children)&&void 0!==n&&n.length?(0,ie.jsx)(hn.Z,{in:Z,children:r.children.map((function(e){return(0,ie.jsx)(_n,{blocklet:e,ancestors:[].concat((0,l.Z)(i),[r]),depth:a+1},"".concat(a+1,"-").concat(e.meta.did))}))},"blocklet-collapse"):null]}function Nn(){var e=(0,L.PE)().t,n=(0,je.y0)().blocklet,t=(0,l.Z)(n.children)||[];return"gateway"!==n.meta.group&&t.unshift(n),(0,ie.jsx)(On,{component:"div",children:t&&t.length?[(0,ie.jsx)(x.Z,{mt:2,ml:{xs:"-12px",md:"-24px"},style:{maxWidth:1080},children:(0,ie.jsx)(_n,{blocklet:n},"0-".concat(n.meta.did))},"top-blocklet-".concat(n.meta.did))]:(0,ie.jsx)(x.Z,{mt:8,children:(0,ie.jsx)(Ve.Z,{children:e("blocklet.component.noComponent")})})})}_n.propTypes={blocklet:u().object.isRequired,ancestors:u().array,depth:u().number},_n.defaultProps={ancestors:[],depth:0},Nn.propTypes={};var On=(0,c.Z)(x.Z)(Pn||(Pn=(0,r.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"])),(function(e){return e.theme.spacing(5)}),(function(e){return e.theme.spacing(3)})),Tn=t(92746);var Rn=function(){var e,n,t,r=(0,ce.h6)().api,o=(0,je.y0)().blocklet,a=(0,L.PE)().t,l=null===o||void 0===o||null===(e=o.meta)||void 0===e?void 0:e.did,s=Object.assign({enabled:!1,domain:"",clientId:""},(null===o||void 0===o||null===(n=o.settings)||void 0===n||null===(t=n.oauth)||void 0===t?void 0:t.auth0)||{}),c=(0,en.cI)({defaultValues:Xe()(s,["domain","clientId","enabled"])}),d=c.handleSubmit,u=c.control,f=c.formState,p=c.watch,m=c.reset,h=p("enabled"),Z=(0,$e.Z)(function(){var e=(0,N.Z)((0,_.Z)().mark((function e(n){var t,i,o,s,c;return(0,_.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,r.configOAuth({input:{did:l,oauth:JSON.stringify({auth0:n})}});case 3:o=e.sent,s=o.blocklet,c=Object.assign({enabled:!1,domain:"",clientId:""},(null===s||void 0===s||null===(t=s.settings)||void 0===t||null===(i=t.oauth)||void 0===i?void 0:i.auth0)||{}),m(c),H.Z.success(a("oauth.saveSuccess")),e.next=13;break;case 10:e.prev=10,e.t0=e.catch(0),H.Z.error(e.t0.message||a("oauth.saveFailed"));case 13:case"end":return e.stop()}}),e,null,[[0,10]])})));return function(n){return e.apply(this,arguments)}}()),g=(0,$e.Z)((function(e){return!(null===e||void 0===e||!e.trim())||a("oauth.auth0.domainDescribe")})),v=(0,$e.Z)((function(e){return!(null===e||void 0===e||!e.trim())||a("oauth.auth0.clientIdDescribe")})),b=(0,$e.Z)((function(){return!0}));return(0,ie.jsx)(x.Z,{children:(0,ie.jsxs)("form",{onSubmit:d(Z),disabled:!0,children:[(0,ie.jsx)(en.Qr,{name:"enabled",control:u,render:function(e){var n=e.field;return(0,ie.jsx)(Ee.Z,{control:(0,ie.jsx)(Tn.Z,(0,i.Z)({checked:n.value,style:{marginRight:"6px"}},n)),label:a("oauth.auth0.enable"),sx:{marginBottom:2,ml:1}})}}),(0,ie.jsx)(en.Qr,{name:"domain",control:u,rules:{validate:h?g:b},render:function(e){var n,t=e.field;return(0,ie.jsx)(Ye.Z,{fullWidth:!0,children:(0,ie.jsx)(qe.Z,(0,i.Z)((0,i.Z)({},t),{},{label:a("oauth.auth0.domain"),error:!!f.errors[t.name],helperText:(null===(n=f.errors[t.name])||void 0===n?void 0:n.message)||"\u3000",disabled:!h}))})}}),(0,ie.jsx)(en.Qr,{name:"clientId",control:u,rules:{validate:h?v:b},render:function(e){var n,t=e.field;return(0,ie.jsx)(Ye.Z,{fullWidth:!0,children:(0,ie.jsx)(qe.Z,(0,i.Z)((0,i.Z)({},t),{},{error:!!f.errors[t.name],label:a("oauth.auth0.clientId"),helperText:(null===(n=f.errors[t.name])||void 0===n?void 0:n.message)||"\u3000",disabled:!h}))})}}),(0,ie.jsx)(Je.Z,{type:"submit",variant:"contained",onSubmit:d(Z),disabled:!f.isDirty,children:a("oauth.save")})]})})},Fn=t(29529),In=t(25139),Bn={ttl:604800};function Dn(e){var n=arguments.length>1&&void 0!==arguments[1]&&arguments[1]?86400*e.ttl:e.ttl/86400;return(0,i.Z)((0,i.Z)({},e),{},{ttl:n})}function Un(){var e,n,t=(0,ce.h6)().api,r=(0,je.y0)().blocklet,o=null===r||void 0===r||null===(e=r.meta)||void 0===e?void 0:e.did,a=Object.assign({},Bn,(null===r||void 0===r||null===(n=r.settings)||void 0===n?void 0:n.session)||{}),l=(0,en.cI)({defaultValues:Xe()(Dn(a),["ttl"])}),s=l.handleSubmit,c=l.control,d=l.formState,u=l.reset,f=(0,L.PE)().t,p=(0,$e.Z)(function(){var e=(0,N.Z)((0,_.Z)().mark((function e(n){var r,i,a,l;return(0,_.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,t.updateAppSessionConfig({input:{did:o,config:Dn(n,!0)}});case 3:i=e.sent,a=i.blocklet,l=Object.assign({},Bn,Xe()((null===a||void 0===a||null===(r=a.settings)||void 0===r?void 0:r.session)||{},["ttl"])),u(Dn(l)),H.Z.success(f("common.configSuccess")),e.next=13;break;case 10:e.prev=10,e.t0=e.catch(0),H.Z.error(e.t0.message);case 13:case"end":return e.stop()}}),e,null,[[0,10]])})));return function(n){return e.apply(this,arguments)}}());return(0,ie.jsx)(x.Z,{children:(0,ie.jsxs)("form",{onSubmit:s(p),disabled:!0,children:[(0,ie.jsx)(en.Qr,{name:"ttl",control:c,render:function(e){var n=e.field;return(0,ie.jsx)(Ye.Z,{fullWidth:!0,sx:{mb:2},children:(0,ie.jsxs)(In.Z,{px:3,children:[(0,ie.jsx)(x.Z,{mx:-3,my:.5,children:f("blocklet.config.session.ttl",{day:n.value})}),(0,ie.jsx)(Fn.ZP,(0,i.Z)((0,i.Z)({},n),{},{defaultValue:7,step:1,marks:[{value:1,label:f("blocklet.config.session.day",{day:1})},{value:7,label:f("blocklet.config.session.days",{day:7})},{value:14,label:f("blocklet.config.session.days",{day:14})},{value:21,label:f("blocklet.config.session.days",{day:21})},{value:30,label:f("blocklet.config.session.days",{day:30})}],min:1,max:30,valueLabelDisplay:"auto",style:{maxWidth:"360px"}}))]})})}}),(0,ie.jsx)(Je.Z,{type:"submit",variant:"contained",onSubmit:s(p),disabled:!d.isDirty,children:f("oauth.save")})]})})}var zn=t(48537),Kn=t(95002),Wn=t(2291),Gn=t(75260),Hn=t(28595),Vn=t(61398),Mn=t.n(Vn),Yn=(0,s.forwardRef)((function(e,n){var t=(0,s.useContext)(L.RD).t,r=(0,Hn.Z)({show:!1,title:"",content:"",onConfirm:Mn(),onCancel:Mn(),loading:!1}),i=(0,$e.Z)((function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};r.show=!0,r.title=e.title,r.content=e.content,r.onConfirm=e.onConfirm||Mn(),r.onCancel=e.onCancel||Mn(),r.loading=!1})),o=(0,$e.Z)((function(){r.title="",r.content="",r.onConfirm=Mn(),r.onCancel=Mn()})),a=(0,$e.Z)((function(){r.show=!1,setTimeout((function(){o()}),300)})),l=(0,$e.Z)((function(){a(),null===r||void 0===r||r.onCancel()}),[]),c=(0,$e.Z)((0,N.Z)((0,_.Z)().mark((function e(){return(0,_.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r.loading=!0,e.prev=1,e.next=4,null===r||void 0===r?void 0:r.onConfirm(a);case 4:return e.prev=4,r.loading=!1,e.finish(4);case 7:case"end":return e.stop()}}),e,null,[[1,,4,7]])}))),[]);return(0,s.useImperativeHandle)(n,(function(){return{open:i,close:a}}),[i,a]),(0,ie.jsx)(we.I4,{open:r.show,title:r.title,onConfirm:c,onCancel:l,confirmButton:{text:t("common.confirm"),props:{variant:"contained",color:"primary",loading:r.loading}},cancelButton:{text:t("common.cancel"),props:{variant:"outlined",color:"primary"}},children:r.content})}));var qn=t(70177),Jn=t(59182),Qn=t.n(Jn),Xn=t(76032),$n=t.n(Xn),et=t(55581),nt=t(63531),tt=t(92522),rt=t.n(tt),it=(0,s.forwardRef)((function(e,n){var t,r,i=(0,s.useContext)(L.RD).t,o=(0,je.y0)().blocklet,a=(0,ce.h6)().api,l=(0,Hn.Z)({mode:"view",show:!1,data:{},callback:Mn()}),c=(0,et.Fg)(),d=(null===c||void 0===c||null===(t=c.transitions)||void 0===t||null===(r=t.duration)||void 0===r?void 0:r.leavingScreen)||300,u=(0,$e.Z)((function(){l.mode="view",l.data={},l.callback=Mn()}),[]),f=(0,$e.Z)((function(){l.show=!1,setTimeout((function(){u()}),d)}),[]),p=(0,$e.Z)((function(e){l.mode="view",l.show=!0,l.data=e}),[]),h=(0,$e.Z)((function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Mn();l.mode="approve",l.show=!0,l.data=e,l.callback=n}),[]);(0,s.useImperativeHandle)(n,(function(){return{open:p,close:f,approve:h}}),[p,f,h]);var Z=(0,Me.Z)((function(){if(!l.show)return[];l.data.migratedFrom=[l.data.appId,l.data.appPid];var e=["appName","appLogo","appId","appPid","migratedFrom","appDescription","appUrl","version","appliedAt","status","serverId","serverVersion"];return!1!==l.data.isMaster&&Qn()(e,"appliedAt","status"),e.map((function(e){var n=i("federated.info.".concat(e)),t=l.data[e];if("appName"===e&&l.data.isMaster&&(t=(0,ie.jsxs)(x.Z,{children:[(0,ie.jsx)(zn.Z,{component:Kn.Z}),t]})),["appId","appPid","serverId"].includes(e)&&(t=(0,ie.jsx)(nt.kL,{children:t})),["appUrl"].includes(e)&&(t=(0,ie.jsx)(x.Z,{component:"a",href:t,target:"_blank",children:t})),["appLogo"].includes(e)){var r=rt()(t)?t:m()(l.data.appUrl||"",t||"");try{var o=new URL(r);o.searchParams.set("imageFilter","resize"),o.searchParams.set("w","80"),o.searchParams.set("h","80"),t=(0,ie.jsx)("img",{src:o.href,width:"60",height:"60",alt:l.data.appName})}catch(a){t=(0,ie.jsx)("img",{src:r,width:"60",height:"60",alt:l.data.appName})}}("status"===e&&(t=t&&i("federated.status.".concat(t))),"migratedFrom"===e)&&(t=(l.data.migratedFrom||[]).filter((function(e){return![l.data.appId,l.data.appPid].includes(e)})).map((function(e){return(0,ie.jsx)(nt.kL,{children:e})})));return $n()(t)&&(t="-"),{name:n,value:t}}))}),[l.data]),g="approve"===l.mode,v=(0,$e.Z)((0,N.Z)((0,_.Z)().mark((function e(){return(0,_.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,a.auditFederatedLogin({input:{memberPid:l.data.appPid,did:o.appPid,status:"rejected"}});case 2:f(),null===l||void 0===l||l.callback(!1);case 4:case"end":return e.stop()}}),e)})))),b=(0,$e.Z)((0,N.Z)((0,_.Z)().mark((function e(){return(0,_.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,a.auditFederatedLogin({input:{memberPid:l.data.appPid,did:o.appPid,status:"approved"}});case 2:f(),null===l||void 0===l||l.callback(!0);case 4:case"end":return e.stop()}}),e)}))));return(0,ie.jsx)(we.ZP,{open:l.show,title:i(g?"federated.approveToJoinLogin":"federated.siteDetail"),onClose:f,actions:g?(0,ie.jsxs)(ie.Fragment,{children:[(0,ie.jsx)(Je.Z,{color:"error",variant:"contained",onClick:v,children:i("common.reject")}),(0,ie.jsx)(Je.Z,{variant:"contained",onClick:b,children:i("common.approve")})]}):(0,ie.jsx)(Je.Z,{variant:"outlined",onClick:f,children:i("common.close")}),children:Z.map((function(e){return(0,ie.jsx)(qn.Z,{style:{alignItems:"flex-start"},valueComponent:"div",nameWidth:180,name:e.name,children:e.value},e.name)}))})})),ot=it,at=t(29951),lt=t(34760),st=t.n(lt),ct=(0,s.forwardRef)((function(e,n){var t,r,i=(0,et.Fg)(),o=(null===i||void 0===i||null===(t=i.transitions)||void 0===t||null===(r=t.duration)||void 0===r?void 0:r.leavingScreen)||300,a=(0,s.useContext)(L.RD).t,l=(0,Hn.Z)({show:!1,data:{link:""}}),c=(0,$e.Z)((function(){l.data.link=""}),[]),d=(0,$e.Z)((function(){l.show=!1,setTimeout((function(){c()}),o)}),[]),u=(0,$e.Z)((function(e){var n=e.link;l.show=!0,l.data.link=n}),[]);(0,s.useImperativeHandle)(n,(function(){return{open:u,close:d}}),[u,d]);var f=(0,$e.Z)((function(){st()(l.data.link),d()}),[d]);return(0,ie.jsxs)(we.ZP,{open:l.show,title:a("federated.joinFederatedLogin"),onClose:d,PaperProps:{style:{minHeight:"unset"}},actions:(0,ie.jsx)(z.Z,{color:"primary",autoFocus:!0,variant:"contained",onClick:f,children:a("common.copyAndClose")}),children:[(0,ie.jsx)(x.Z,{mb:1,children:a("federated.inviteJoinFederatedLoginDescription")}),(0,ie.jsx)(x.Z,{sx:{"& .copy-button":{display:"none !important"}},children:(0,ie.jsx)(at.Z,{language:"shell",style:{marginBottom:0},children:l.data.link})})]})}));function dt(e){var n,t,r,i,a,l=e.mode,c=(0,s.useRef)(null),d=(0,s.useRef)(null),u=(0,s.useContext)(L.RD),f=u.t,p=u.locale,m=(0,je.y0)(),h=m.blocklet,Z=m.actions.refreshBlocklet,g=function(){var e=(0,s.useRef)(null),n=(0,$e.Z)((function(){for(var n,t=arguments.length,r=new Array(t),i=0;i<t;i++)r[i]=arguments[i];null===(n=e.current)||void 0===n||n.open.apply(n,r)})),t=(0,$e.Z)((function(){for(var n,t=arguments.length,r=new Array(t),i=0;i<t;i++)r[i]=arguments[i];null===(n=e.current)||void 0===n||n.close.apply(n,r)})),r={open:n,close:t};return{confirmHolder:(0,ie.jsx)(Yn,{ref:e}),confirmApi:r}}(),v=g.confirmApi,b=g.confirmHolder,j=(0,ce.h6)().api,k=(null===(n=h.settings.federated)||void 0===n?void 0:n.sites)||[],y=(null===(t=h.settings.federated)||void 0===t?void 0:t.config)||{autoLogin:!1},C=!1!==y.isMaster,w=(0,$e.Z)((function(e){var n;null===(n=d.current)||void 0===n||n.open(e)})),S=(0,$e.Z)((function(e){var n;null===(n=d.current)||void 0===n||n.approve(e,Z)})),P=(0,$e.Z)((function(e){v.open({title:f("federated.disableFederatedLogin"),content:f("federated.disableFederatedLoginDescription"),onConfirm:function(n){return(0,N.Z)((0,_.Z)().mark((function t(){return(0,_.Z)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,j.auditFederatedLogin({input:{memberPid:e.appPid,did:h.appPid,status:"revoked"}});case 2:n();case 3:case"end":return t.stop()}}),t)})))()}})})),E=(0,$e.Z)((function(e){v.open({title:f("federated.enableFederatedLogin"),content:f("federated.enableFederatedLoginDescription"),onConfirm:function(n){return(0,N.Z)((0,_.Z)().mark((function t(){return(0,_.Z)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,j.auditFederatedLogin({input:{memberPid:e.appPid,did:h.appPid,status:"approved"}});case 2:n();case 3:case"end":return t.stop()}}),t)})))()}})})),A=(0,Me.Z)((function(){var e=[{label:f("common.name"),name:"appName",options:{customBodyRenderLite:function(e){var n=k[e],t=!1!==n.isMaster;return(0,ie.jsx)(x.Z,{display:"inline-block",children:(0,ie.jsxs)(x.Z,{component:"a",display:"flex",alignItems:"center",href:n.appUrl,target:"_blank",onClick:function(e){e.stopPropagation()},children:[t&&(0,ie.jsx)(zn.Z,{component:Kn.Z,style:{marginRight:"4px"}}),n.appName]})})}}},{label:f("common.did"),name:"appId",options:{customBodyRenderLite:function(e){var n=k[e];return(0,ie.jsx)(Gn.Z,{children:n.appId})}}},{label:f("common.status"),name:"status",options:{customBodyRenderLite:function(e){var n=k[e],t=!1!==n.isMaster;return(0,ie.jsx)(x.Z,{children:t?"-":f("federated.status.".concat(n.status))})}}}];return C&&e.push({label:f("common.actions"),name:"actions",options:{customBodyRenderLite:function(e){var n=k[e],t=!1!==n.isMaster;return(0,ie.jsx)(x.Z,{display:"flex",gap:1,children:t?(0,ie.jsxs)(ie.Fragment,{children:["rejected"===n.status&&(0,ie.jsx)(z.Z,{variant:"contained",color:"error",size:"small",onClick:function(e){e.stopPropagation()},children:f("federated.status.rejected")}),"revoked"===n.status&&(0,ie.jsx)(z.Z,{variant:"contained",color:"secondary",size:"small",onClick:function(e){e.stopPropagation()},children:f("federated.status.revoked")})]}):(0,ie.jsxs)(ie.Fragment,{children:["pending"===n.status&&(0,ie.jsx)(z.Z,{variant:"contained",color:"primary",size:"small",onClick:function(e){e.stopPropagation(),S(n)},children:f("federated.status.pending")}),"approved"===n.status&&(0,ie.jsx)(z.Z,{variant:"contained",color:"error",size:"small",onClick:function(e){e.stopPropagation(),P(n)},style:{whiteSpace:"nowrap"},children:f("federated.revoke")}),"revoked"===n.status&&(0,ie.jsx)(z.Z,{variant:"contained",color:"warning",size:"small",onClick:function(e){e.stopPropagation(),E(n)},style:{whiteSpace:"nowrap"},children:f("federated.approve")})]})})}}}),e}),[y.appId,k,C]),O=(0,Me.Z)((function(){return{sort:!0,download:!1,filter:!1,print:!1,expandableRowsOnClick:!0,onRowClick:function(e,n){var t=n.dataIndex,r=k[t];w(r)}}}),[]),T=(0,$e.Z)((function(){var e,n=h.environments.find((function(e){return e.key===G.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_URL}));null!==n&&void 0!==n&&n.value?null===(e=c.current)||void 0===e||e.open({link:n.value}):H.Z.error(f("federated.failedToGetFederatedLoginLink"))}),[null===(r=h.site)||void 0===r||null===(i=r.domainAliases)||void 0===i||null===(a=i[0])||void 0===a?void 0:a.href]),R=(0,s.useState)(y.autoLogin||!1),F=(0,o.Z)(R,2),I=F[0],B=F[1],D=(0,$e.Z)((function(){v.open({title:f(I?"federated.disableFederatedAutoLogin":"federated.enableFederatedAutoLogin"),content:f(I?"federated.disableFederatedAutoLoginDescription":"federated.enableFederatedAutoLoginDescription"),onConfirm:function(e){return(0,N.Z)((0,_.Z)().mark((function n(){return(0,_.Z)().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,j.configFederated({input:{did:h.appPid,autoLogin:!I}});case 2:B((function(e){return!e})),e();case 4:case"end":return n.stop()}}),n)})))()}})}),[B,I]),U=(0,$e.Z)((function(){v.open({title:f("federated.quitFederatedLogin"),content:f("federated.quitFederatedLoginDescription"),onConfirm:function(e){return(0,N.Z)((0,_.Z)().mark((function n(){return(0,_.Z)().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,j.quitFederatedLogin({input:{did:h.appPid}});case 2:e();case 3:case"end":return n.stop()}}),n)})))()}})})),K=(0,$e.Z)((function(){v.open({title:f("federated.disbandFederatedLogin"),content:f("federated.disbandFederatedLoginDescription"),onConfirm:function(e){return(0,N.Z)((0,_.Z)().mark((function n(){return(0,_.Z)().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,j.disbandFederatedLogin({input:{did:h.appPid}});case 2:e();case 3:case"end":return n.stop()}}),n)})))()}})})),W=[];return"master"!==l?W.push((0,ie.jsx)(z.Z,{size:"small",variant:"contained",color:"error",onClick:U,sx:{ml:1},children:f("federated.quitFederatedLogin")},"quitFederatedLogin")):(W.push((0,ie.jsx)(z.Z,{size:"small",variant:"contained",onClick:T,sx:{ml:1},children:f("federated.inviteJoinFederatedLogin")},"inviteJoinFederatedLogin")),W.push((0,ie.jsx)(z.Z,{color:"error",size:"small",variant:"contained",onClick:K,sx:{ml:1},children:f("federated.disbandFederatedLogin")},"disbandFederatedLogin"))),(0,ie.jsxs)(ie.Fragment,{children:[(0,ie.jsx)(Wn.Z,{className:"main-table",locale:p,data:k,columns:A,customButtons:W,title:(0,ie.jsx)(x.Z,{className:"table-toolbar-left",children:"master"===l?f("oauth.federated"):(0,ie.jsx)(Ee.Z,{sx:{ml:0,"& span.MuiSwitch-switchBase":{display:"flex"},"& span.MuiSwitch-track":{display:"block"}},control:(0,ie.jsx)(Tn.Z,{checked:I,style:{marginRight:"6px"},onChange:D}),label:f("federated.enableFederatedAutoLogin")})}),options:O}),b,(0,ie.jsx)(ct,{ref:c}),(0,ie.jsx)(ot,{ref:d})]})}dt.propTypes={mode:u().oneOf(["member","master"])},dt.defaultProps={mode:"member"};var ut=dt,ft=(0,s.forwardRef)((function(e,n){var t,r,i=(0,s.useContext)(L.RD).t,o=(0,ce.h6)().api,a=(0,je.y0)().blocklet,l=null===a||void 0===a?void 0:a.appPid,c=(0,et.Fg)(),d=(null===c||void 0===c||null===(t=c.transitions)||void 0===t||null===(r=t.duration)||void 0===r?void 0:r.leavingScreen)||300,u=(0,Hn.Z)({show:!1,appUrl:"",appUrlError:"",callback:Mn()}),f=(0,$e.Z)((function(){u.appUrl="",u.appUrlError="",u.callback=Mn()}),[]),p=(0,$e.Z)((function(){u.show=!1,setTimeout((function(){f()}),d)}),[]),m=(0,$e.Z)((function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Mn();u.show=!0,u.callback=e}),[]);(0,s.useImperativeHandle)(n,(function(){return{open:m,close:p}}),[m,p]);var h=(0,$e.Z)((function(e){if(!e)throw new Error(i("federated.federatedJoinAppUrlRequired"));if(!rt()(e))throw new Error(i("federated.federatedJoinAppUrlInvalid"))})),Z=(0,$e.Z)((0,N.Z)((0,_.Z)().mark((function e(){var n;return(0,_.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,h(u.appUrl),e.next=4,o.joinFederatedLogin({input:{did:l,appUrl:u.appUrl}});case 4:n=e.sent,u.show=!1,p(),null===u||void 0===u||u.callback(n),e.next=13;break;case 10:e.prev=10,e.t0=e.catch(0),u.appUrlError=e.t0.message;case 13:case"end":return e.stop()}}),e,null,[[0,10]])}))),[p,l]);return(0,ie.jsxs)(we.ZP,{open:u.show,title:i("federated.joinFederatedLogin"),onClose:p,PaperProps:{style:{minHeight:"unset"}},actions:(0,ie.jsx)(z.Z,{color:"primary",autoFocus:!0,variant:"contained",onClick:Z,children:i("common.confirm")}),children:[(0,ie.jsx)(x.Z,{mb:1,children:i("federated.joinFederatedLoginDescription")}),(0,ie.jsx)(qe.Z,{fullWidth:!0,variant:"outlined",margin:"dense",placeholder:i("federated.federatedJoinAppUrl"),label:i("federated.federatedJoinAppUrl"),value:u.appUrl,error:!!u.appUrlError,helperText:u.appUrlError||"eg: https://www.arcblock.io",onChange:function(e){u.appUrl=e.target.value}})]})})),pt=ft;function mt(){var e,n,t,r,i=(0,s.useRef)(null),o=(0,s.useRef)(null),a=(0,s.useContext)(L.RD).t,l=(0,je.y0)(),c=l.blocklet,d=l.actions.refreshBlocklet,u=(0,$e.Z)((function(){var e,n,t,r=null===(e=c.site)||void 0===e||null===(n=e.domainAliases)||void 0===n||null===(t=n[0])||void 0===t?void 0:t.href;if(r)try{var o,l=new URL(r);null===(o=i.current)||void 0===o||o.open({link:l.origin})}catch(s){H.Z.error(a("federated.failedToGetFederatedLoginLink"))}}),[null===(e=c.site)||void 0===e||null===(n=e.domainAliases)||void 0===n||null===(t=n[0])||void 0===t?void 0:t.href]),f=(0,$e.Z)((function(){var e;null===(e=o.current)||void 0===e||e.open((function(){d()}))}),[d]);if((null===(r=c.settings.federated)||void 0===r?void 0:r.sites.length)>0){var p,m=!1!==(null===(p=c.settings.federated)||void 0===p?void 0:p.config.isMaster);return(0,ie.jsx)(ut,{mode:m?"master":"member"})}return(0,ie.jsxs)(ie.Fragment,{children:[(0,ie.jsxs)(x.Z,{display:"flex",flexDirection:"column",gap:2,justifyContent:"center",alignItems:"center",minHeight:"200px",children:[(0,ie.jsx)(z.Z,{variant:"contained",onClick:u,children:a("federated.inviteJoinFederatedLogin")}),(0,ie.jsx)(U.Z,{sx:{width:"150px",color:"rgba(0, 0, 0, 0.3)"},children:"OR"}),(0,ie.jsx)(z.Z,{variant:"outlined",onClick:f,children:a("federated.joinFederatedLogin")})]}),(0,ie.jsx)(ct,{ref:i}),(0,ie.jsx)(pt,{ref:o})]})}var ht,xt=function(){var e=(0,s.useContext)(L.RD).t,n=[{label:(0,ie.jsx)(x.Z,{textAlign:"center",width:"100%",children:e("oauth.commonSettings")}),value:"settings"},{label:(0,ie.jsx)(x.Z,{textAlign:"center",width:"100%",children:e("oauth.federated")}),value:"federated"},{label:(0,ie.jsx)(x.Z,{textAlign:"center",width:"100%",children:"Auth0"}),value:"auth0"},{label:(0,ie.jsx)(x.Z,{textAlign:"center",width:"100%",children:e("oauth.moreLogin")}),value:"more"}],t=(0,s.useState)(n[0].value),r=(0,o.Z)(t,2),i=r[0],a=r[1],l=(0,Me.Z)((function(){return{auth0:(0,ie.jsx)(Rn,{}),federated:(0,ie.jsx)(mt,{}),more:(0,ie.jsx)(x.Z,{children:(0,ie.jsx)(Ve.Z,{children:e("oauth.comingSoon")})}),settings:(0,ie.jsx)(x.Z,{children:(0,ie.jsx)(Un,{})})}}),[e]);return(0,ie.jsxs)(x.Z,{children:[(0,ie.jsx)(S.Z,{tabs:n,current:i,onChange:a}),(0,ie.jsx)(x.Z,{marginTop:"10px",children:l[i]})]})},Zt=["blocklet","onUpdate"],gt=function e(n){var t=n.tabs,r=n.blocklet,i=n.ancestors,o=void 0===i?[]:i,a=n.depth,s=void 0===a?1:a,c=n.t,d=[].concat((0,l.Z)(o.map((function(e){return e.meta.did}))),[r.meta.did]).join("/"),u=!(null!==o&&void 0!==o&&o.length);t.push({label:(0,ie.jsxs)(x.Z,{pl:2*Math.max(1,s-1),display:"flex",alignItems:"center",justifyContent:"flex-start",children:[u?(0,ie.jsx)(A.Z,{size:24,blocklet:r}):(0,ie.jsx)(E.Z,{size:24,blocklet:r,ancestors:o}),(0,ie.jsx)(x.Z,{ml:"16px",children:(0,ie.jsx)(x.Z,{style:{color:"#222"},children:u?c("blocklet.component.container"):(0,P.getDisplayName)(r,!0)})})]},d),value:d}),r.children.length>0&&r.children.forEach((function(n){e({tabs:t,blocklet:n,ancestors:[].concat((0,l.Z)(o),[r]),depth:s+1,t:c})}))};function vt(e){var n=e.blocklet,t=e.onUpdate,r=(0,a.Z)(e,Zt),l=(0,s.useContext)(L.RD).t,c=(0,ce.h6)(),d=c.info,u=c.inService,p=(0,s.useState)(!0),P=(0,o.Z)(p,2),E=P[0],A=P[1],_=(0,w.lr)(),N=(0,o.Z)(_,2),O=N[0],T=N[1],R=O.get("tab")||"general",F=[{label:(0,ie.jsxs)(x.Z,{display:"flex",alignItems:"center","data-cy":"configuration-tab-general",children:[(0,ie.jsx)(g.Z,{sx:{fontSize:24}}),(0,ie.jsx)(x.Z,{ml:"16px",children:(0,ie.jsx)(x.Z,{style:{color:"#222"},children:l("common.general")})})]},"general"),value:"general"},{label:(0,ie.jsxs)(x.Z,{display:"flex",alignItems:"center","data-cy":"configuration-tab-access",children:[(0,ie.jsx)(v.Z,{sx:{fontSize:24}}),(0,ie.jsx)(x.Z,{ml:"16px",children:(0,ie.jsx)(x.Z,{style:{color:"#222"},children:l("common.access")})})]},"access"),value:"access"},{label:(0,ie.jsxs)(x.Z,{display:"flex",alignItems:"center","data-cy":"configuration-tab-oauth",children:[(0,ie.jsx)(b.Z,{sx:{fontSize:24}}),(0,ie.jsx)(x.Z,{ml:"16px",children:(0,ie.jsx)(x.Z,{style:{color:"#222"},children:l("common.login")})})]},"oauth"),value:"oauth"},{label:(0,ie.jsxs)(x.Z,{display:"flex",alignItems:"center","data-cy":"configuration-tab-notification",children:[(0,ie.jsx)(j.Z,{sx:{fontSize:24}}),(0,ie.jsx)(x.Z,{ml:"16px",children:(0,ie.jsx)(x.Z,{style:{color:"#222"},children:l("common.notification")})})]},"notification"),value:"notification"},{label:(0,ie.jsxs)(x.Z,{display:"flex",alignItems:"center","data-cy":"configuration-tab-preference",children:[(0,ie.jsx)(x.Z,{ml:-2,style:{transform:"translateY(2px)"},children:E?(0,ie.jsx)(C.Z,{fontSize:"inherit"}):(0,ie.jsx)(y.default,{fontSize:"inherit"})}),(0,ie.jsx)(k.Z,{sx:{fontSize:24}}),(0,ie.jsx)(x.Z,{ml:"16px",children:(0,ie.jsx)(x.Z,{style:{color:"#222"},children:l("common.preferences")})})]},"preference"),value:"preference"}];E&>({tabs:F,blocklet:n,t:l});var I=null;if("general"===R)I=(0,ie.jsx)(Ge,{blocklet:n,onUpdate:t});else if("access"===R)I=(0,ie.jsx)(Nn,{});else if("oauth"===R)I=(0,ie.jsx)(xt,{});else if("notification"===R)I=(0,ie.jsx)(pn,{});else{var B=u?h.WELLKNOWN_SERVICE_PATH_PREFIX:d.routing.adminPath,D=new URLSearchParams;u||D.set("authKey","__sst"),D.set("schemaKey",m()(window.location.origin,B,"/api/preferences?id=".concat(encodeURIComponent(R)))),I=(0,ie.jsx)(f.Z,{url:"".concat(m()(window.location.origin,B,"/hosted/form-collector/"),"?").concat(D.toString()),width:"100%",height:"100%",frameBorder:0,styles:{border:0}})}return(0,ie.jsx)(bt,(0,i.Z)((0,i.Z)({},r),{},{children:(0,ie.jsxs)(Z.ZP,{container:!0,spacing:4,columns:24,children:[(0,ie.jsx)(Z.ZP,{item:!0,sm:7,md:5,children:(0,ie.jsx)(S.Z,{tabs:F,current:R,orientation:"vertical",onChange:function(e){"preference"===e?A(!E):T((function(n){return"general"===e?n.delete("tab"):n.set("tab",e),n}))},sx:{borderRight:1,height:"100%",borderColor:"divider"}})}),(0,ie.jsx)(Z.ZP,{item:!0,sm:17,md:19,children:(0,ie.jsx)(x.Z,{style:{minHeight:"66vh",height:"100%",position:"relative",overflow:"hidden"},children:I})})]})}))}vt.propTypes={blocklet:u().object.isRequired,onUpdate:u().func},vt.defaultProps={onUpdate:function(){}};var bt=c.Z.div(ht||(ht=(0,r.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"])))},19066:function(e,n,t){t.d(n,{C:function(){return r}});var r="true"===localStorage.getItem("enableDebug")},70115:function(e,n,t){var r=t(39517),i=t(87642),o=t(64076),a=t(20244);n.Z=[{value:a.WHO_CAN_ACCESS.ALL,icon:o.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:a.WHO_CAN_ACCESS.INVITED,icon:i.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:a.WHO_CAN_ACCESS.OWNER,icon:r.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"}}]}}]);
|
|
2
|
+
//# sourceMappingURL=4802.b3a4b474.chunk.js.map
|