@abtnode/webapp 1.16.15-beta-9318a201 → 1.16.15-beta-ed0db59e
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 +51 -51
- package/build/index.html +1 -1
- package/build/service-worker.js +1 -1
- package/build/static/js/{1005.54d54e22.chunk.js → 1005.75ed0870.chunk.js} +1 -1
- package/build/static/js/1520.135d0493.chunk.js +1 -0
- package/build/static/js/{1685.2a736ee3.chunk.js → 1685.1679bdbd.chunk.js} +2 -2
- package/build/static/js/17.713812e2.chunk.js +1 -0
- package/build/static/js/2113.a0a3a688.chunk.js +1 -0
- package/build/static/js/2305.1a17468a.chunk.js +2 -0
- package/build/static/js/{2334.926a3436.chunk.js → 2334.74e08d81.chunk.js} +1 -1
- package/build/static/js/2701.45ca55d3.chunk.js +2 -0
- package/build/static/js/3245.878486bd.chunk.js +1 -0
- package/build/static/js/3704.139947e9.chunk.js +2 -0
- package/build/static/js/4038.057c3526.chunk.js +2 -0
- package/build/static/js/{4168.b428ccb4.chunk.js → 4168.a4beefbf.chunk.js} +1 -1
- package/build/static/js/436.08547c14.chunk.js +1 -0
- package/build/static/js/{4407.5f35466c.chunk.js → 4407.0fbdcce5.chunk.js} +2 -2
- package/build/static/js/4620.ff302a51.chunk.js +1 -0
- package/build/static/js/{4775.a61ecf17.chunk.js → 4775.a65e6576.chunk.js} +1 -1
- package/build/static/js/4901.00cc1363.chunk.js +1 -0
- package/build/static/js/{5032.8a0b671e.chunk.js → 5032.da91d5e6.chunk.js} +1 -1
- package/build/static/js/5285.93a44f4f.chunk.js +1 -0
- package/build/static/js/542.58bca24d.chunk.js +1 -0
- package/build/static/js/5904.afb2521a.chunk.js +1 -0
- package/build/static/js/5928.5547c6bf.chunk.js +1 -0
- package/build/static/js/6287.026bbca2.chunk.js +1 -0
- package/build/static/js/{6412.77cadf28.chunk.js → 6412.f8cd3f1d.chunk.js} +1 -1
- package/build/static/js/{6419.f9f93f10.chunk.js → 6419.4fbfd6e6.chunk.js} +1 -1
- package/build/static/js/{6511.0fe81071.chunk.js → 6511.efec9d61.chunk.js} +1 -1
- package/build/static/js/{6950.bab47d5c.chunk.js → 6950.ecc9d35b.chunk.js} +1 -1
- package/build/static/js/{6960.0604a491.chunk.js → 6960.25320e87.chunk.js} +1 -1
- package/build/static/js/7020.5c140160.chunk.js +1 -0
- package/build/static/js/7126.b4ad3d91.chunk.js +1 -0
- package/build/static/js/{7327.d1ca9d48.chunk.js → 7327.ae862a0d.chunk.js} +1 -1
- package/build/static/js/{7534.77f71429.chunk.js → 7534.4e543a5c.chunk.js} +1 -1
- package/build/static/js/{7604.e325079e.chunk.js → 7604.d16d75c3.chunk.js} +2 -2
- package/build/static/js/7638.4c7ee6d6.chunk.js +1 -0
- package/build/static/js/7718.11941d75.chunk.js +1 -0
- package/build/static/js/{7913.f8875090.chunk.js → 7913.777445d3.chunk.js} +1 -1
- package/build/static/js/{8219.b43d875a.chunk.js → 8219.22ddc152.chunk.js} +1 -1
- package/build/static/js/{8359.8b6900c4.chunk.js → 8359.71547b04.chunk.js} +1 -1
- package/build/static/js/8719.27070c24.chunk.js +1 -0
- package/build/static/js/{9041.d699548c.chunk.js → 9041.712e053e.chunk.js} +1 -1
- package/build/static/js/{9244.0e63ef9b.chunk.js → 9244.01ad2b1f.chunk.js} +1 -1
- package/build/static/js/{9249.ee6559ec.chunk.js → 9249.4f20dc04.chunk.js} +1 -1
- package/build/static/js/{9327.77d4d1d8.chunk.js → 9327.b7f3ca87.chunk.js} +1 -1
- package/build/static/js/{9351.01fbdf43.chunk.js → 9351.06847c24.chunk.js} +1 -1
- package/build/static/js/9354.6dc219d4.chunk.js +1 -0
- package/build/static/js/9662.ce2f3bff.chunk.js +1 -0
- package/build/static/js/9744.832f9a25.chunk.js +1 -0
- package/build/static/js/{9801.38e0a56a.chunk.js → 9801.dd5edb8d.chunk.js} +1 -1
- package/build/static/js/9963.d6ed27e8.chunk.js +1 -0
- package/build/static/js/main.cdfecab7.js +2 -0
- package/package.json +1 -1
- package/build/static/js/1520.62e8079a.chunk.js +0 -1
- package/build/static/js/17.8cf3a2be.chunk.js +0 -1
- package/build/static/js/2113.9d869f90.chunk.js +0 -1
- package/build/static/js/2305.56b207a7.chunk.js +0 -2
- package/build/static/js/3245.e3e5fc36.chunk.js +0 -1
- package/build/static/js/3704.976069d0.chunk.js +0 -2
- package/build/static/js/4016.8eebff14.chunk.js +0 -2
- package/build/static/js/4038.e37978fb.chunk.js +0 -2
- package/build/static/js/436.92515855.chunk.js +0 -1
- package/build/static/js/4620.693d9d87.chunk.js +0 -1
- package/build/static/js/4901.3e63171b.chunk.js +0 -1
- package/build/static/js/5285.626871cb.chunk.js +0 -1
- package/build/static/js/542.3398e930.chunk.js +0 -1
- package/build/static/js/5904.d5c51cdf.chunk.js +0 -1
- package/build/static/js/5928.0f1d6dac.chunk.js +0 -1
- package/build/static/js/6287.46d99e7f.chunk.js +0 -1
- package/build/static/js/7020.3bb7de06.chunk.js +0 -1
- package/build/static/js/7126.d7ac7234.chunk.js +0 -1
- package/build/static/js/7638.dace3fe5.chunk.js +0 -1
- package/build/static/js/7718.6203b3b2.chunk.js +0 -1
- package/build/static/js/8592.9a930219.chunk.js +0 -1
- package/build/static/js/8719.d032d97d.chunk.js +0 -1
- package/build/static/js/9662.7329e545.chunk.js +0 -1
- package/build/static/js/9744.aea4abe9.chunk.js +0 -1
- package/build/static/js/9963.c11eaf1c.chunk.js +0 -1
- package/build/static/js/main.05aa4b84.js +0 -2
- /package/build/static/js/{1685.2a736ee3.chunk.js.LICENSE.txt → 1685.1679bdbd.chunk.js.LICENSE.txt} +0 -0
- /package/build/static/js/{2305.56b207a7.chunk.js.LICENSE.txt → 2305.1a17468a.chunk.js.LICENSE.txt} +0 -0
- /package/build/static/js/{4016.8eebff14.chunk.js.LICENSE.txt → 2701.45ca55d3.chunk.js.LICENSE.txt} +0 -0
- /package/build/static/js/{3704.976069d0.chunk.js.LICENSE.txt → 3704.139947e9.chunk.js.LICENSE.txt} +0 -0
- /package/build/static/js/{4038.e37978fb.chunk.js.LICENSE.txt → 4038.057c3526.chunk.js.LICENSE.txt} +0 -0
- /package/build/static/js/{4407.5f35466c.chunk.js.LICENSE.txt → 4407.0fbdcce5.chunk.js.LICENSE.txt} +0 -0
- /package/build/static/js/{7604.e325079e.chunk.js.LICENSE.txt → 7604.d16d75c3.chunk.js.LICENSE.txt} +0 -0
- /package/build/static/js/{main.05aa4b84.js.LICENSE.txt → main.cdfecab7.js.LICENSE.txt} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";(self.webpackChunk_abtnode_webapp=self.webpackChunk_abtnode_webapp||[]).push([[9801],{44784:function(e,n,t){var r,i=t(71171),o=t(33028),a=t(59740),s=t(33518),l=t(82790),c=t(96266),d=["labelProps","className","style"];function u(e){var n=e.labelProps,t=e.className,r=e.style,i=(0,a.Z)(e,d),s=(0,o.Z)((0,o.Z)({},n),{},{labelPlacement:(null===n||void 0===n?void 0:n.labelPlacement)||"start"});return(0,c.jsx)(p,{className:t,style:r,children:(0,c.jsx)(l.Z,(0,o.Z)({labelProps:s},i))})}u.propTypes=l.Z.propTypes,u.defaultProps=l.Z.defaultProps;var p=s.default.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},71320:function(e,n,t){t.r(n),t.d(n,{default:function(){return Pt}});var r=t(71171),i=t(33028),o=t(96234),a=t(59740),s=t(68079),l=t(5057),c=t(33518),d=t(55898),u=t.n(d),p=t(96181),f=t(6352),m=t.n(f),h=t(35432),x=t(39948),v=t(55402),Z=t(82275),g=t(96399),j=t(65688),b=t(37633),y=t(48037),k=t(92273),C=t(76720),w=t(15849),S=t(39075),L=t(94464),E=t(38242),P=t(80378),A=t(1722),_=t(32723),T=t(34795),O=t(43681),R=t.n(O),N=t(50482),I=t.n(N),B=t(96366),D=t(36554),F=t(29034),z=t(44919),U=t(67680),K=t(75239),W=t(28726),q=t(25710),G=t(18067),V=t(80578),M=t(76811),H=t(86229),Y=t(28641),J=t(44846),Q=t(13727),X=t(56184),$=t(74490),ee=t(51177),ne=t(19654),te=t(35406),re=t(11875),ie=t(95890),oe=t(96266),ae=["label","disabled","required","initialValue","onChange","style","onSubmit","triggers","options","formatterBeforeSubmit"],se={PaperProps:{style:{maxHeight:224,width:250}}},le=function(e,n,t){return{fontWeight:-1===n.indexOf(e)?t.typography.fontWeightRegular:t.typography.fontWeightMedium}};function ce(e){var n=e.label,t=e.disabled,r=e.required,s=e.initialValue,c=e.onChange,d=e.style,u=e.onSubmit,p=e.triggers,f=e.options,m=e.formatterBeforeSubmit,h=(0,a.Z)(e,ae),v=(0,B.Z)(),Z=(0,l.useState)(!1),g=(0,o.Z)(Z,2),j=g[0],b=g[1],y=(0,l.useState)(!1),k=(0,o.Z)(y,2),C=k[0],w=k[1],S=(0,l.useState)(s),L=(0,o.Z)(S,2),E=L[0],P=L[1],A=(0,l.useState)(E),O=(0,o.Z)(A,2),R=O[0],N=O[1],I=function(){var e=(0,T.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(R):R);case 4:!1===e.sent?N(E):(N(R),P(R)),e.next=11;break;case 8:e.prev=8,e.t0=e.catch(1),N(E);case 11:return e.prev=11,w(!1),b(!1),e.finish(11);case 15:case"end":return e.stop()}}),e,null,[[1,8,11,15]])})));return function(){return e.apply(this,arguments)}}(),D=j?(0,oe.jsx)(ee.Z,(0,i.Z)((0,i.Z)({value:R,onChange:function(e){var n=e.target.value;n="string"===typeof n?n.split(","):n,N(n),c(n)},fullWidth:!0,multiple:!0,variant:"outlined",margin:"dense",renderValue:function(e){return(0,oe.jsx)(x.Z,{sx:{display:"flex",flexWrap:"wrap"},children:e.filter((function(e){return f.some((function(n){return n.code===e}))})).map((function(e){return(0,oe.jsx)(ne.Z,{label:f.find((function(n){return n.code===e})).name,style:{marginRight:8},size:"small"},e)}))})},MenuProps:se},h),{},{children:f.map((function(e){return(0,oe.jsx)($.Z,{value:e.code,style:le(e.code,R,v),children:e.name},e.code)}))})):(0,oe.jsx)(x.Z,{px:1,className:"form-item-input slot",style:{whiteSpace:"pre-wrap"},children:R.filter((function(e){return f.some((function(n){return n.code===e}))})).map((function(e){return(0,oe.jsx)(ne.Z,{label:f.find((function(n){return n.code===e})).name,style:{marginRight:8},size:"small"},e)}))});return(0,oe.jsx)(re.Z,{className:"form",style:d,children:(0,oe.jsxs)(x.Z,{className:"form-item",children:[(0,oe.jsxs)(x.Z,{className:"form-item-label",children:[n,r&&(0,oe.jsx)(te.Z,{})]}),(0,oe.jsxs)(x.Z,{className:"form-item-body",children:[(0,oe.jsx)(x.Z,{className:"form-item-input",children:D}),(0,oe.jsx)(x.Z,{className:"form-item-action",children:j?(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsx)(U.Z,{"data-cy":"schema-form-item-confirm",onClick:I,disabled:t||C,size:"large",children:C?(0,oe.jsx)(J.Z,{size:24}):(0,oe.jsx)(X.Z,{})}),(0,oe.jsx)(U.Z,{"data-cy":"schema-form-item-cancel",onClick:function(){N(E),b(!1)},disabled:t||C,size:"large",children:(0,oe.jsx)(Q.default,{})})]}):(0,oe.jsx)(ie.Z,{triggers:p,onEnterEdit:function(){return b(!0)},disabled:t})})]})]})})}ce.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},ce.defaultProps={style:{},onSubmit:function(){},onChange:function(){},label:"",initialValue:"",required:!1,disabled:!1,triggers:[],options:[],formatterBeforeSubmit:function(e){return e.join(",")}};var de=t(58238),ue=t(14491),pe=t(54063),fe=t(63406),me=t(11593),he=t(11750),xe=t(47020),ve=t(70461),Ze=t(51233);function ge(e){var n=e.id,t=e.children,r=e.title,a=e.teamDid,s=(0,S.PE)().t,c=(0,de.h6)().api,d=(0,l.useState)(!1),u=(0,o.Z)(d,2),p=u[0],f=u[1],m=(0,l.useState)(null),h=(0,o.Z)(m,2),x=h[0],v=h[1],Z=function(){var e=(0,T.Z)((0,_.Z)().mark((function e(t){return(0,_.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!p){e.next=2;break}return e.abrupt("return");case 2:return f(!0),e.prev=3,e.next=6,c.addDomainAlias({input:{id:n,domainAlias:(0,Ze.sf)(t.domain),teamDid:a}});case 6:return e.next=8,(0,ue._v)(2e3);case 8:v(null);case 9:return e.prev=9,f(!1),e.finish(9);case 12:case"end":return e.stop()}}),e,null,[[3,,9,12]])})));return function(n){return e.apply(this,arguments)}}(),g=function(){var e=(0,T.Z)((0,_.Z)().mark((function e(n,t,r){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:e.next=8;break;case 5:e.prev=5,e.t0=e.catch(0),r((0,ue.Z)(e.t0));case 8:return e.prev=8,f(!1),e.finish(8);case 11:case"end":return e.stop()}}),e,null,[[0,5,8,11]])})));return function(n,t,r){return e.apply(this,arguments)}}(),j={title:r||s("router.domainAlias.add.title"),description:function(e,n,t){return(0,oe.jsx)(he.Z,{component:"div",children:(0,oe.jsx)(xe.Z,{label:s("router.domainAlias.add.domainDescription"),helperText:s("router.domainAlias.add.helperText"),autoComplete:"off",variant:"outlined",name:"domain","data-cy":"add-domain",fullWidth:!0,autoFocus:!0,inputProps:{"data-cy":"domain-name-input"},value:e.domain,style:{marginBottom:8},margin:"dense",onChange:function(r){var o=r.target.value.trim(),a=(0,Ze.ub)(o,s);n((0,i.Z)((0,i.Z)({},e),{},{domain:o,__disableConfirm:!!a})),t(a||"")},onKeyPress:function(n){if("Enter"===n.key){n.preventDefault();var r=n.target.value.trim(),i=(0,Ze.ub)(r,s);i?t(i):g(e,Z,t)}}})})},confirm:s("common.confirm"),cancel:s("common.cancel"),params:{domain:"",__disableConfirm:!0},onConfirm:Z,onCancel:function(){f(!1),v(null)}},b=function(e){e.stopPropagation(),v(j)};return(0,oe.jsxs)(oe.Fragment,{children:["function"===typeof t?t({loading:p,open:b}):(0,oe.jsxs)($.Z,{onClick:b,className:"rule-action","data-cy":"action-add-domain-alias",children:[p?(0,oe.jsx)(J.Z,{size:16}):(0,oe.jsx)(me.Z,{style:{fontSize:18,marginRight:5}}),s("router.domainAlias.add.title")]}),x&&(0,oe.jsx)(ve.Z,{title:x.title,description:x.description,confirm:x.confirm,cancel:x.cancel,params:x.params,onConfirm:x.onConfirm,onCancel:x.onCancel,color:"primary",loading:p})]})}ge.propTypes={id:u().string.isRequired,children:u().any,title:u().string,teamDid:u().string},ge.defaultProps={children:null,title:"",teamDid:""};var je=t(63405),be=t(46954),ye=t(44067),ke=t(27773),Ce=t(92726);function we(e){var n=(0,S.PE)().t,t=(0,l.useState)(!1),r=(0,o.Z)(t,2),i=r[0],a=r[1],s=(0,l.useState)(null),c=(0,o.Z)(s,2),d=c[0],u=c[1],p=e.id,f=e.domain,m=e.children,h=e.teamDid,x=(0,de.h6)().api,v=function(){var e=(0,T.Z)((0,_.Z)().mark((function e(){return(0,_.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a(!0),e.prev=1,e.next=4,x.deleteDomainAlias({input:{id:p,domainAlias:f,teamDid:h}});case 4:return e.next=6,(0,ue._v)(2e3);case 6:e.next=11;break;case 8:e.prev=8,e.t0=e.catch(1),H.Z.error(e.t0.message);case 11:return e.prev=11,u(null),a(!1),e.finish(11);case 15:case"end":return e.stop()}}),e,null,[[1,8,11,15]])})));return function(){return e.apply(this,arguments)}}(),Z={title:n("router.domainAlias.delete.title"),description:n("router.domainAlias.delete.description"),confirm:n("common.confirm"),onConfirm:v,onCancel:function(){a(!1),u(null)}},g=function(e){e.stopPropagation(),u(Z)};return(0,oe.jsxs)(oe.Fragment,{children:["function"===typeof m?m({loading:i,open:g}):(0,oe.jsxs)(W.Z,{edge:"end",onClick:g,size:"small",className:"rule-action",color:"error","data-cy":"action-delete-domain-alias",children:[i?(0,oe.jsx)(J.Z,{size:16}):(0,oe.jsx)(ke.default,{style:{fontSize:16}}),n("router.domainAlias.delete.title")]}),d&&(0,oe.jsx)(ve.Z,{title:d.title,description:d.description,confirm:d.confirm,params:d.params,onConfirm:d.onConfirm,onCancel:d.onCancel})]})}function Se(e){var n=e.site,t=e.domain,r=e.blocklet,i=(0,S.PE)().t,o=t.value===window.location.hostname;return(0,oe.jsx)(Ce.Z,{"data-cy":"domain-actions",actions:[function(e){var a,s=e.close;return(0,oe.jsx)(we,{id:n.id,domain:t.value,teamDid:null===r||void 0===r||null===(a=r.meta)||void 0===a?void 0:a.did,children:function(e){var n=e.open;return(0,oe.jsx)(K.Z,{title:o?i("blocklet.router.currentDomainTip"):"",children:(0,oe.jsx)("span",{children:(0,oe.jsxs)($.Z,{disabled:t.isProtected||o,dense:!0,onClick:function(e){s(),n(e)},"data-cy":"action-toggle-block",children:[(0,oe.jsx)(be.Z,{style:{minWidth:24,marginRight:8},children:(0,oe.jsx)(ke.default,{})}),(0,oe.jsx)(ye.Z,{primary:i("common.delete")})]},"remove")})})}})}]})}we.propTypes={id:u().string.isRequired,domain:u().string.isRequired,children:u().any,teamDid:u().string},we.defaultProps={children:null,teamDid:""},Se.propTypes={site:u().object.isRequired,domain:u().object.isRequired,blocklet:u().object.isRequired},Se.defaultProps={};var Le,Ee=t(31853),Pe=t(19574),Ae=t(73545),_e=t(29054);function Te(e){var n=e.initialValue,t=e.onChange,r=e.disabled,i=e.loading,a=(0,S.PE)().t,s=(0,Ae.T)().api,l=(0,_e.y0)().blocklet,c=(0,Ee.Z)({newAppSk:"",isConnectOpen:!1}),d=(0,o.Z)(c,2),u=d[0],p=d[1],f=function(){var e=(0,T.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,p({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 p({isConnectOpen:!1})},v=l.structVersion===h.APP_STRUCT_VERSION?[{key:"rotate-with-did-wallet",title:"Migrate with DID Wallet",handler:function(){(0,ue.An)(l.status)?H.Z.error(a("blocklet.error.isRunning")):(0,E.isInProgress)(l.status)?H.Z.error(a("blocklet.error.isInProgress")):p({isConnectOpen:!0})}}]:[];return[(0,oe.jsx)(Y.Z,{disabled:r,loading:i,initialValue:n,onSubmit:function(e){return p({newAppSk:e}),!1},triggers:v,secure:!0}),u.newAppSk&&(0,oe.jsx)(ve.Z,{title:a("blocklet.config.appSkTitle"),description:(0,oe.jsxs)(x.Z,{children:[(0,oe.jsx)(x.Z,{children:a("blocklet.config.appSkChangeTip")}),(0,oe.jsx)(x.Z,{fontWeight:"bold",mt:2,children:a("blocklet.config.appDidChangeTip")}),(0,oe.jsxs)(Oe,{children:[(0,oe.jsx)("li",{children:a("blocklet.config.appDidChangeTipL1")}),(0,oe.jsx)("li",{children:a("blocklet.config.appDidChangeTipL2")})]})]}),confirm:a("confirm"),cancel:a("cancel"),onConfirm:function(){return f(u.newAppSk)},onCancel:function(){return p({newAppSk:""})}}),(0,oe.jsx)(Pe.default,{popup:!0,open:u.isConnectOpen,forceConnected:!1,saveConnect:!1,action:"rotate-key-pair",checkFn:s.get,checkTimeout:3e5,onSuccess:m,extraParams:{appDid:l.appDid},messages:{title:a("setup.keyPair.title"),scan:a("setup.keyPair.scan"),confirm:a("setup.keyPair.confirm"),success:a("setup.keyPair.success")},onClose:m})]}Te.propTypes={initialValue:u().string,onChange:u().func,disabled:u().bool,loading:u().bool},Te.defaultProps={initialValue:"default",onChange:function(){},disabled:!1,loading:!1};var Oe=(0,c.default)("ul")(Le||(Le=(0,r.Z)(["\n padding-left: 16px;\n li {\n margin-top: 8px;\n list-style: disk;\n font-weight: bold;\n }\n"]))),Re=t(74511),Ne=t(88574),Ie=["domain","domainStatus"],Be=function(e){return["waiting","creating","renewaling"].includes(e)};function De(e){var n,t=(0,S.PE)().t,r=(0,l.useState)(!1),i=(0,o.Z)(r,2),a=i[0],s=i[1],c=(0,l.useState)(null),d=(0,o.Z)(c,2),u=d[0],p=d[1],f=e.domain,m=e.onAdd,h=e.children,x=e.did,v=(0,de.h6)(),Z=v.api,g=v.ws.useSubscription,j=(0,l.useState)(!1),b=(0,o.Z)(j,2),y=b[0],k=b[1],C=(0,_e.y0)().actions.refreshDomainStatus,w=(0,Re.Z)((0,T.Z)((0,_.Z)().mark((function e(){var n,t;return(0,_.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Z.findCertificateByDomain({input:{domain:f,did:x}});case 2:return n=e.sent,t=n.cert,e.abrupt("return",t);case 5:case"end":return e.stop()}}),e)})))),L=function(e,n){e.domain===f&&(k(!1),"success"===n?H.Z.success("The ".concat(e.domain," certificate is issued successfully")):"error"===n&&H.Z.error("Failed to issue certificate for ".concat(e.domain)))};if((0,l.useEffect)((function(){var e;!w.loading&&Be(null===(e=w.value)||void 0===e?void 0:e.status)&&k(!0)}),[w]),g(M.BlockletEvents.certError,(function(e){return L(e,"error")})),g(M.BlockletEvents.certIssued,(function(e){w.retry(),C(e.domain),L(e,"success")})),w.loading)return"";if("normal"===(null===(n=w.value)||void 0===n?void 0:n.status))return"";var E=function(){var e=(0,T.Z)((0,_.Z)().mark((function e(){return(0,_.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return s(!0),e.prev=1,e.next=4,Z.issueLetsEncryptCert({input:{domain:f,did:x}});case 4:m(),k(!0),e.next=12;break;case 8:e.prev=8,e.t0=e.catch(1),console.error(e.t0),k(!1);case 12:return e.prev=12,s(!1),p(null),e.finish(12);case 16:case"end":return e.stop()}}),e,null,[[1,8,12,16]])})));return function(){return e.apply(this,arguments)}}(),P={title:t("router.cert.genLetsEncryptCert.title"),description:(0,oe.jsxs)("div",{children:[(0,oe.jsx)(Ne.Z,{type:"success",children:t("router.cert.genLetsEncryptCert.dnsTip")}),t("router.cert.genLetsEncryptCert.description")]}),confirm:t("common.confirm"),onConfirm:E,onCancel:function(){s(!1),p(null)}};return(0,oe.jsxs)(oe.Fragment,{children:[y?(0,oe.jsx)(K.Z,{title:t("router.cert.issuing"),children:(0,oe.jsx)(J.Z,{size:12})}):h({loading:a,open:function(e){e.stopPropagation(),p(P)}}),u&&(0,oe.jsx)(ve.Z,{color:"primary",title:u.title,description:u.description,confirm:u.confirm,params:u.params,onConfirm:u.onConfirm,onCancel:u.onCancel})]})}function Fe(e){var n=e.domain,t=e.domainStatus,r=(0,a.Z)(e,Ie);return!(0,ue.rM)(n)||null!==t&&void 0!==t&&t.isHttps?"":(0,oe.jsx)(De,(0,i.Z)({domain:n},r))}De.propTypes={domain:u().string.isRequired,did:u().string.isRequired,onAdd:u().func,children:u().any},De.defaultProps={onAdd:function(){},children:null},Fe.propTypes={domain:u().string.isRequired,domainStatus:u().shape({isHttps:u().bool}).isRequired,did:u().string.isRequired,onAdd:u().func,children:u().any},Fe.defaultProps={onAdd:function(){},children:null};var ze,Ue=t(13128),Ke=t(55372),We=t(26174),qe=t(88092),Ge=t(50185),Ve=t(17425);function Me(e){var n=e.onCancel,t=e.onSuccess,r=e.onError,i=(0,l.useContext)(Ae.B).api,a=(0,l.useState)(!1),s=(0,o.Z)(a,2),c=s[0],d=s[1],u=(0,S.PE)(),p=u.t,f=u.locale,m=(0,l.useState)(""),h=(0,o.Z)(m,2),v=h[0],Z=h[1],g=(0,l.useState)(!1),j=(0,o.Z)(g,2),b=j[0],y=j[1],k=(0,l.useState)(0),C=(0,o.Z)(k,2),w=C[0],L=C[1],E=(0,l.useState)(""),P=(0,o.Z)(E,2),A=P[0],_=P[1],T=(0,Ve.DJ)().endpoint,O=(0,l.useState)(!1),R=(0,o.Z)(O,2),N=R[0],I=R[1],B=function(e){Z(null),d(!0);try{_(e.result),L(F.length-1)}catch(t){var n=(0,ue.Z)(t);Z(n),r(t)}finally{d(!1)}},D=function(){y(!1),L(0)},F=[{body:(0,oe.jsxs)(x.Z,{children:[(0,oe.jsx)(he.Z,{children:p("team.transferApp.transferDialog.tips.progress")}),(0,oe.jsx)(he.Z,{mt:3,mb:2,children:p("team.transferApp.transferDialog.tips.newOwnerPermissions")})]}),cancel:p("common.cancel"),confirm:p("team.transferApp.transferDialog.createTransferLink"),onCancel:n,onConfirm:function(){y(!0),L(1)}},{body:function(){return(0,oe.jsx)(Pe.default,{action:"transfer-app-owner",open:b,locale:f,checkFn:i.get,onClose:D,onSuccess:B,checkTimeout:3e5,extraParams:{},messages:{title:p("team.transferApp.connectDialog.title"),scan:p("team.transferApp.connectDialog.scan"),confirm:p("team.transferApp.connectDialog.confirm"),success:p("team.transferApp.connectDialog.success")},popup:!0})}},{body:function(){var e=(0,ue.VP)({transferId:A.transferId,endpoint:T});return(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsx)(x.Z,{component:Ye,dangerouslySetInnerHTML:{__html:p("team.transferApp.transferDialog.createSuccessTip1")}}),(0,oe.jsx)(x.Z,{component:Ye,mt:2,children:(0,oe.jsx)(Ye,{children:p("team.transferApp.transferDialog.createSuccessTip3")})}),(0,oe.jsxs)(x.Z,{children:[(0,oe.jsx)(x.Z,{component:Ye,mt:2,children:(0,oe.jsx)(Ye,{children:p("team.transferApp.transferDialog.createSuccessTip2",{expireDate:(0,ue.B2)(A.expireDate,f)})})}),(0,oe.jsx)(x.Z,{my:1,children:(0,oe.jsx)(Ge.Z,{children:e})})]}),(0,oe.jsx)("div",{children:(0,oe.jsx)(We.Z,{value:"end",control:(0,oe.jsx)(qe.Z,{checked:N,onChange:function(e){return I(e.target.checked)}}),label:p("team.transferApp.transferDialog.iKnow"),labelPlacement:"end"})})]})},confirm:p("common.confirm"),onConfirm:t}],z=F[w];return(0,oe.jsxs)(Ue.Z,{title:(0,oe.jsx)(Ye,{className:"title",children:p("team.transferApp.transferDialog.title")}),fullWidth:!0,open:!0,showCloseButton:!1,actions:(0,oe.jsxs)(oe.Fragment,{children:[z.cancel&&(0,oe.jsx)(W.Z,{onClick:z.onCancel,color:"inherit",children:z.cancel}),(0,oe.jsxs)(W.Z,{onClick:z.onConfirm,color:"error",disabled:c||w===F.length-1&&!N,variant:"contained",autoFocus:!0,children:[c&&(0,oe.jsx)(J.Z,{size:16}),z.confirm]})]}),children:[(0,oe.jsx)(Ke.Z,{component:"div",children:"function"===typeof z.body?z.body():z.body}),!!v&&(0,oe.jsx)(Ne.Z,{type:"error",variant:"icon",children:v})]})}Me.propTypes={onCancel:u().func.isRequired,onSuccess:u().func.isRequired,onError:u().func},Me.defaultProps={onError:function(){}};var He,Ye=c.default.div(ze||(ze=(0,r.Z)(["\n font-size: 16px;\n font-weight: bold;\n &.title {\n font-size: 20px;\n }\n"]))),Je=["blocklet","onUpdate","hasPermission"],Qe=Object.keys(M.SUPPORTED_LANGUAGES).map((function(e){return{code:e,name:M.SUPPORTED_LANGUAGES[e].nativeName}}));function Xe(e){var n,t=e.blocklet,r=e.onUpdate,s=e.hasPermission,c=(0,a.Z)(e,Je),d=(0,de.h6)(),u=(0,l.useContext)(S.RD).t,p=(0,l.useState)(""),f=(0,o.Z)(p,2),m=f[0],v=f[1],Z=(0,l.useState)(""),g=(0,o.Z)(Z,2),j=g[0],b=g[1],y=(0,l.useState)(!1),k=(0,o.Z)(y,2),C=k[0],w=k[1],L=(0,E.getWhoCanAccess)(t),P=null===t||void 0===t||null===(n=t.settings)||void 0===n?void 0:n.publicToStore,A=(0,B.Z)(),O=j||!s,N=d.inService,J=d.ws.useSubscription,Q=t.meta.did,X=t.site,$=(0,ue.oE)(null===X||void 0===X?void 0:X.domainAliases),ee=R()(t.meta,"capabilities.clusterMode",!1);if(J(h.EVENTS.NODE_RUNTIME_INFO,(function(e){ee&&v(R()(e,"cpu.physicalCores",""))})),(0,ue.wS)(t.status))return null;var ne=t.environments.find((function(e){return"BLOCKLET_DELETABLE"===e.key})),te=!ne||"yes"===ne.value,re=t.environments.find((function(e){return"BLOCKLET_APP_LANGUAGES"===e.key})),ie=t.environments.find((function(e){return"BLOCKLET_APP_URL"===e.key})),ae=t.environments.find((function(e){return"BLOCKLET_APP_LOGO_SQUARE"===e.key})),se=t.environments.find((function(e){return"BLOCKLET_APP_LOGO_RECT"===e.key})),le=t.environments.find((function(e){return"BLOCKLET_APP_LOGO_FAVICON"===e.key})),me=t.environments.find((function(e){return"BLOCKLET_APP_LOGO"===e.key})),he=[{key:M.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_NAME,description:u("blocklet.config.name"),value:t.environments.find((function(e){return"BLOCKLET_APP_NAME"===e.key})).value},{key:M.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_DESCRIPTION,description:u("blocklet.config.description"),value:t.environments.find((function(e){return"BLOCKLET_APP_DESCRIPTION"===e.key})).value},{key:M.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_URL,description:u("blocklet.config.appUrl"),value:ie?ie.value:""},{key:M.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_LOGO_SQUARE,description:u("blocklet.config.logoSquare"),value:ae?ae.value:""},{key:M.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_LOGO_RECT,description:u("blocklet.config.logoRect"),value:se?se.value:""},{key:M.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_LOGO_FAVICON,description:u("blocklet.config.logoFavicon"),value:le?le.value:""},{key:M.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_LOGO,description:u("blocklet.config.logo"),value:me?me.value:""}];if(ee){var xe=t.configs.find((function(e){return e.key===M.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_CLUSTER_SIZE})),ve=xe?xe.value:m;he.push({key:M.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_CLUSTER_SIZE,description:u("blocklet.config.clusterSize"),value:ve,cpuCores:m})}var Ze=function(){var e=(0,T.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(!j){e.next=2;break}return e.abrupt("return");case 2:return b(!0),e.prev=3,i=n.target.checked,e.next=7,d.api.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,b(!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)}}(),be=function(){var e=(0,T.Z)((0,_.Z)().mark((function e(n,i){var o,a,s,l;return(0,_.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n!==M.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_CLUSTER_SIZE){e.next=5;break}if(!(o=(0,ue.I)({value:i,cpuCores:m}))){e.next=5;break}return H.Z.error(o),e.abrupt("return");case 5:return a=[{key:n,value:i}],e.prev=6,b(!0),e.next=10,d.api.configBlocklet({input:{did:t.meta.did,configs:a}});case 10:s=e.sent,l=s.blocklet,r(l),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,b(!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)}}(),ye=function(){var e=(0,T.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(!j){e.next=2;break}return e.abrupt("return");case 2:return b(!0),e.prev=3,i=n.target.checked,e.next=7,d.api.configBlocklet({input:{did:t.meta.did,configs:[{key:M.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,b(!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)}}(),ke=function(){var e=(0,T.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=X.corsAllowedOrigins||[],i=n.split(",").map((function(e){return e.trim()})).filter(Boolean),!I()(r,i)){e.next=4;break}return e.abrupt("return",!1);case 4:return e.prev=4,b(!0),o=i.length?i:["__none__"],e.next=9,d.api.updateRoutingSite({input:{id:X.id,corsAllowedOrigins:o,teamDid:t.meta.did}});case 9:b(!1),e.next=17;break;case 12:return e.prev=12,e.t0=e.catch(4),H.Z.error(e.t0.message),b(!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)}}(),Ce=function(){var e=(0,T.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(!j){e.next=2;break}return e.abrupt("return");case 2:return b(!0),e.prev=3,e.next=6,d.api.configBlocklet({input:{did:t.meta.did,configs:[{key:M.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,b(!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)}}();return(0,oe.jsxs)(tn,(0,i.Z)((0,i.Z)({},c),{},{children:[he.map((function(e){return(0,oe.jsxs)(x.Z,{className:"config-form",mt:2,children:[(0,oe.jsx)(x.Z,{className:"config-label",fontSize:14,mb:0,children:e.description}),(0,oe.jsx)(Y.Z,{style:{marginTop:0},disabled:j||O,loading:j,initialValue:e.value,onSubmit:function(n){return be(e.key,n)}})]})})),(0,oe.jsx)(x.Z,{className:"config-form",children:"all"===L&&"registry"===t.source&&(0,oe.jsxs)(x.Z,{className:"config-item",children:[(0,oe.jsxs)(x.Z,{className:"config-label",children:[u("blocklet.config.access.publicToStore"),(0,oe.jsx)(x.Z,{className:"config-desc",children:u("blocklet.config.access.publicInstanceTip")})]}),(0,oe.jsx)(D.Z,{disabled:O,checked:P,defaultChecked:!0,onChange:Ze})]})}),(0,oe.jsx)(x.Z,{className:"config-form",component:F.Z,my:3}),(0,oe.jsxs)(x.Z,{className:"config-form",mt:2,children:[(0,oe.jsx)(x.Z,{className:"config-label",fontSize:14,mb:0,children:u("blocklet.config.languages")}),(0,oe.jsx)(ce,{style:{marginTop:0},disabled:j||O,loading:j,options:Qe,initialValue:re?re.value.split(","):["en","zh"],onSubmit:function(e){return be("BLOCKLET_APP_LANGUAGES",e)}})]}),(0,oe.jsx)(x.Z,{className:"config-form",component:F.Z,my:3}),(0,oe.jsxs)(x.Z,{className:"config-form",children:[(0,oe.jsxs)(x.Z,{display:"flex",justifyContent:"space-between",alignItems:"center",children:[(0,oe.jsx)("div",{className:"config-label",children:u("common.domain")}),(0,oe.jsx)(x.Z,{display:"flex",alignItems:"center",children:(0,oe.jsx)(ge,{id:X.id,title:u("router.domain.add.title"),teamDid:Q,children:function(e){var n=e.open;return(0,oe.jsxs)(W.Z,{style:{marginLeft:16},variant:"contained",color:"primary","data-cy":"add-domain-alias",onClick:n,disabled:(0,E.isInProgress)(t.status),children:[(0,oe.jsx)(z.Z,{style:{fontSize:"1.3em",marginRight:4}}),u("common.add")]})}})})]}),$.map((function(e,n){return(0,oe.jsxs)(x.Z,{display:"flex",alignItems:"center",justifyContent:"space-between",mt:n?0:1,children:[(0,oe.jsxs)(x.Z,{display:"flex",alignItems:"center",justifyContent:"space-between",children:[(0,oe.jsx)(je.Z,{domain:e,filters:["domain"]},"".concat(e.value,"-domain")),(0,oe.jsx)(x.Z,{ml:2,mr:.5,children:e.value}),(0,oe.jsx)(je.Z,{domain:e,filters:["http"]},"".concat(e.value,"-http")),(0,oe.jsx)("span",{style:{marginLeft:12}}),(0,oe.jsx)(Fe,{domain:e.value,domainStatus:e.domainStatus,did:t.meta.did,children:function(e){var n=e.open;return(0,oe.jsx)(W.Z,{size:"small",onClick:function(e){return n(e)},children:u("router.cert.genLetsEncryptCert.title")})}})]}),s&&!e.isProtected?(0,oe.jsx)(Se,{site:X,domain:e,blocklet:t}):(0,oe.jsx)(K.Z,{title:u("blocklet.router.domainLockTooltip"),placement:"top",children:(0,oe.jsx)(U.Z,{disabled:!0,size:"large",style:{pointerEvents:"auto",paddingTop:0,paddingBottom:0,margin:"12px 0"},children:(0,oe.jsx)(G.Z,{style:{fill:A.palette.text.disabled}})})})]},e.value)})),!$.length&&(0,oe.jsx)(x.Z,{mt:4,children:(0,oe.jsx)(q.Z,{children:u("common.empty")})})]}),(0,oe.jsx)(x.Z,{className:"config-form",component:F.Z,my:3}),(0,oe.jsx)(x.Z,{className:"config-form",mt:2,children:(0,oe.jsx)(x.Z,{className:"config-label",mb:0,children:u("common.security")})}),(0,oe.jsxs)(x.Z,{className:"config-form",mt:2,children:[(0,oe.jsx)(x.Z,{className:"config-label",fontSize:14,mb:0,children:u("router.domainSecurity.cors.title")}),(0,oe.jsx)(x.Z,{mb:1.5,className:"config-desc",children:u("router.domainSecurity.cors.description",{name:"the blocklet"})}),(0,oe.jsx)(Y.Z,{style:{marginTop:0},disabled:j||O,loading:j,initialValue:(X.corsAllowedOrigins||[]).join(", "),onSubmit:ke})]}),(0,oe.jsx)(x.Z,{className:"config-form",component:F.Z,my:3}),(0,oe.jsx)(x.Z,{mb:2,className:"config-label",fontSize:20,children:u("blocklet.config.dangerZone")}),(0,oe.jsxs)(x.Z,{px:2,py:1,sx:{border:"1px solid red",borderRadius:2},children:[(0,oe.jsx)(x.Z,{className:"config-form",mt:2,children:!N&&(0,oe.jsxs)(x.Z,{className:"config-item",children:[(0,oe.jsxs)(x.Z,{className:"config-label",children:[u("blocklet.config.deletable.name"),(0,oe.jsx)(x.Z,{className:"config-desc",children:u(te?"blocklet.config.deletable.disable":"blocklet.config.deletable.enable")})]}),(0,oe.jsx)(D.Z,{disabled:O,checked:!te,defaultChecked:!0,onChange:ye})]})}),(0,oe.jsxs)(x.Z,{className:"config-form",mt:2,children:[(0,oe.jsx)(x.Z,{className:"config-label",fontSize:14,mb:0,children:u("blocklet.config.sk")}),(0,oe.jsx)(Te,{disabled:j||O,loading:j,initialValue:t.environments.find((function(e){return"BLOCKLET_APP_SK"===e.key})).value,onChange:Ce})]}),N&&(0,oe.jsx)(fe.Z,{role:"owner",children:function(e){return(e||pe.C)&&(0,oe.jsxs)(x.Z,{className:"config-form",mt:2,children:[(0,oe.jsxs)(x.Z,{className:"config-item",children:[(0,oe.jsx)(x.Z,{className:"config-label",mb:0,children:u("team.transferApp.name")}),(0,oe.jsxs)(W.Z,{style:{flexShrink:0},variant:"contained",edge:"end",color:"error",size:"small","data-cy":"transfer-app",onClick:function(){return w(!0)},children:[(0,oe.jsx)(V.Z,{style:{fontSize:"1.3em",marginRight:4}}),u("team.transferApp.name")]})]}),C&&(0,oe.jsx)(Me,{onCancel:function(){return w(!1)},onSuccess:function(){return w(!1)}})]})}})]})]}))}var $e=(0,fe.V)(Xe,"mutate_blocklets"),en=(0,fe.V)(Xe,"",ue.Wf);function nn(e){return(0,de.h6)().inService?(0,oe.jsx)(en,(0,i.Z)({},e)):(0,oe.jsx)($e,(0,i.Z)({},e))}Xe.propTypes={blocklet:u().object.isRequired,onUpdate:u().func,hasPermission:u().bool},Xe.defaultProps={onUpdate:function(){},hasPermission:!1};var tn=c.default.div(He||(He=(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 max-height: 60vh;\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"])),(function(e){return e.theme.breakpoints.down("md")})),rn=t(93066),on=t(80576),an=t(56556),sn=t(8708),ln=t.n(sn),cn=t(99360),dn=t(95550),un=t(766),pn=t.n(un),fn=t(24529),mn=t.n(fn),hn=t(16727),xn=t.n(hn),vn={enabled:!1,secure:!1,from:"",host:"",port:"",user:"",password:""};var Zn=function(){var e,n,t,r=(0,de.h6)().api,o=(0,_e.y0)().blocklet,a=(0,S.PE)().t,s=null===o||void 0===o||null===(e=o.meta)||void 0===e?void 0:e.did,l=Object.assign((0,i.Z)({},vn),(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,dn.cI)({defaultValues:ln()(l,Object.keys(vn))}),d=c.handleSubmit,u=c.control,p=c.formState,f=c.watch,m=c.reset,h=f("enabled"),v=(0,cn.Z)(function(){var e=(0,T.Z)((0,_.Z)().mark((function e(n){var t,o,l,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:s,notification:JSON.stringify({email:n})}});case 3:l=e.sent,c=l.blocklet,d=Object.assign((0,i.Z)({},vn),(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)}}()),Z=(0,cn.Z)((function(e){var n=null===e||void 0===e?void 0:e.trim();return n?!!pn()(n)||a("notification.email.fromInvalid"):a("notification.email.fromRequired")})),g=(0,cn.Z)((function(e){var n=null===e||void 0===e?void 0:e.trim();return n?!!mn()(n,{require_host:!1,protocols:[]})||a("notification.email.hostInvalid"):a("notification.email.hostRequired")})),j=(0,cn.Z)((function(e){return e?!!xn()(e)||a("notification.email.portInvalid"):a("notification.email.portRequired")})),b=(0,cn.Z)((function(e){return!(null===e||void 0===e||!e.trim())||a("notification.email.userRequired")})),y=(0,cn.Z)((function(e){return!(null===e||void 0===e||!e.trim())||a("notification.email.passwordRequired")})),k=(0,cn.Z)((function(){return!0}));return(0,oe.jsx)(x.Z,{children:(0,oe.jsxs)("form",{onSubmit:d(v),disabled:!0,children:[(0,oe.jsx)(dn.Qr,{name:"enabled",control:u,render:function(e){var n=e.field;return(0,oe.jsx)(We.Z,{control:(0,oe.jsx)(D.Z,(0,i.Z)({checked:n.value},n)),label:a("notification.email.enable"),sx:{marginBottom:"8px"}})}}),(0,oe.jsx)(dn.Qr,{name:"from",control:u,rules:{validate:h?Z:k},render:function(e){var n,t=e.field;return(0,oe.jsx)(on.Z,{fullWidth:!0,children:(0,oe.jsx)(xe.Z,(0,i.Z)((0,i.Z)({},t),{},{label:a("notification.email.from"),error:!!p.errors[t.name],helperText:(null===(n=p.errors[t.name])||void 0===n?void 0:n.message)||"\u3000",disabled:!h}))})}}),(0,oe.jsx)(dn.Qr,{name:"host",control:u,rules:{validate:h?g:k},render:function(e){var n,t=e.field;return(0,oe.jsx)(on.Z,{fullWidth:!0,children:(0,oe.jsx)(xe.Z,(0,i.Z)((0,i.Z)({},t),{},{error:!!p.errors[t.name],label:a("notification.email.host"),helperText:(null===(n=p.errors[t.name])||void 0===n?void 0:n.message)||"\u3000",disabled:!h}))})}}),(0,oe.jsx)(dn.Qr,{name:"port",control:u,rules:{validate:h?j:k},render:function(e){var n,t=e.field;return(0,oe.jsx)(on.Z,{fullWidth:!0,children:(0,oe.jsx)(xe.Z,(0,i.Z)((0,i.Z)({},t),{},{type:"number",error:!!p.errors[t.name],label:a("notification.email.port"),helperText:(null===(n=p.errors[t.name])||void 0===n?void 0:n.message)||"\u3000",disabled:!h}))})}}),(0,oe.jsx)(dn.Qr,{name:"user",control:u,rules:{validate:h?b:k},render:function(e){var n,t=e.field;return(0,oe.jsx)(on.Z,{fullWidth:!0,children:(0,oe.jsx)(xe.Z,(0,i.Z)((0,i.Z)({},t),{},{error:!!p.errors[t.name],label:a("notification.email.user"),helperText:(null===(n=p.errors[t.name])||void 0===n?void 0:n.message)||"\u3000",disabled:!h}))})}}),(0,oe.jsx)(dn.Qr,{name:"password",control:u,rules:{validate:h?y:k},render:function(e){var n,t=e.field;return(0,oe.jsx)(on.Z,{fullWidth:!0,children:(0,oe.jsx)(xe.Z,(0,i.Z)((0,i.Z)({},t),{},{type:"password",error:!!p.errors[t.name],label:a("notification.email.password"),helperText:(null===(n=p.errors[t.name])||void 0===n?void 0:n.message)||"\u3000",disabled:!h}))})}}),(0,oe.jsx)(dn.Qr,{name:"secure",control:u,rules:{validate:k},render:function(e){var n=e.field;return(0,oe.jsx)(on.Z,{fullWidth:!0,children:(0,oe.jsx)(We.Z,{control:(0,oe.jsx)(D.Z,(0,i.Z)((0,i.Z)({checked:n.value},n),{},{disabled:!h})),label:a("notification.email.secure"),style:{marginBottom:16}})})}}),(0,oe.jsx)(an.Z,{type:"submit",variant:"contained",onSubmit:d(v),disabled:!p.isDirty,children:a("oauth.save")})]})})},gn=[{label:(0,oe.jsx)(x.Z,{textAlign:"center",width:"100%",children:"Email"}),value:"email"},{label:(0,oe.jsx)(x.Z,{textAlign:"center",width:"100%",children:"More"}),value:"more"}];var jn,bn,yn=function(){var e=(0,l.useState)(gn[0].value),n=(0,o.Z)(e,2),t=n[0],r=n[1],i=(0,l.useContext)(S.RD).t,a=(0,rn.Z)((function(){return{email:(0,oe.jsx)(Zn,{}),more:(0,oe.jsx)(x.Z,{children:(0,oe.jsx)(q.Z,{children:i("notification.comingSoon")})})}}),[i]);return(0,oe.jsxs)(x.Z,{children:[(0,oe.jsx)(L.Z,{tabs:gn,current:t,onChange:r}),(0,oe.jsx)(x.Z,{marginTop:"10px",children:a[t]})]})},kn=t(48342),Cn=t(94552),wn=t(24558),Sn=t(74286),Ln=t(76667),En=t(70648),Pn=t(7664),An=t(44123),_n=t(53906),Tn=[{value:h.WHO_CAN_ACCESS.ALL,icon:_n.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:h.WHO_CAN_ACCESS.INVITED,icon:An.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:h.WHO_CAN_ACCESS.OWNER,icon:Pn.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"}}],On="roles",Rn=[].concat((0,s.Z)(Tn),[{value:On,icon:En.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"}}]),Nn=function(e,n){if(e&&e.startsWith(h.WHO_CAN_ACCESS_PREFIX_ROLES)){var t=(0,E.getRolesFromAuthConfig)({whoCanAccess:e}),r=n.filter((function(e){return t.includes(e.name)}));return{access:On,roles:r}}return{access:e,roles:[]}},In=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===M.BLOCKLET_CONFIGURABLE_KEY.COMPONENT_ACCESS_WHO}));if(i)return Nn(i.value,r);if(n&&R()(n,"settings.whoCanAccess")&&R()(n,"settings.whoCanAccess")!==h.WHO_CAN_ACCESS.ALL)return Nn(R()(n,"settings.whoCanAccess"),r);var o=(0,E.findServiceFromMeta)(e.meta,h.NODE_SERVICES.AUTH);return R()(o,"config.whoCanAccess")?Nn(o.config.whoCanAccess,r):{access:h.WHO_CAN_ACCESS.ALL,roles:[]}};function Bn(e){var n=e.blocklet,t=e.ancestors,r=e.children,i=(0,B.Z)(),a=(0,l.useState)(""),c=(0,o.Z)(a,2),d=c[0],u=c[1],p=(0,S.PE)(),f=p.t,m=p.locale,v=(0,de.h6)().api,Z=(0,Ve.DJ)().roles,g=(0,l.useState)(""),j=(0,o.Z)(g,2),b=j[0],y=j[1],k=t[0]||n,C=In(n,k,{roles:Z}),w=C.access,L=C.roles,P=(0,l.useState)(w),A=(0,o.Z)(P,2),O=A[0],R=A[1],N=(0,l.useState)(L),I=(0,o.Z)(N,2),D=I[0],F=I[1],z=[].concat((0,s.Z)(t.map((function(e){return e.meta.did}))),[n.meta.did]),K={marginRight:4,fontSize:18,verticalAlign:"text-bottom",color:i.palette.text.secondary},q=t.concat(n).map((function(e){return(0,E.getDisplayName)(e,!0)})).join(" / ");if((0,ue.wS)(n.status))return null;if("unknown"===n.status&&(0,ue.wS)(n.status))return null;var G=function(){u(!1)},V=function(e){e.stopPropagation(),u(!0)},M=function(){var e=(0,T.Z)((0,_.Z)().mark((function e(){var n;return(0,_.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!b){e.next=2;break}return e.abrupt("return");case 2:return y(!0),e.prev=3,(n=O)===On&&(n="".concat(h.WHO_CAN_ACCESS_PREFIX_ROLES).concat(D.map((function(e){return e.name})).join(","))),e.next=8,v.updateWhoCanAccess({input:{did:z,whoCanAccess:n}});case 8:H.Z.success(f("blocklet.config.access.updatedTip")),G(),y(!1),e.next=17;break;case 13:e.prev=13,e.t0=e.catch(3),y(!1),H.Z.error((0,ue.Z)(e.t0));case 17:case"end":return e.stop()}}),e,null,[[3,13]])})));return function(){return e.apply(this,arguments)}}(),Y=b||O===On&&!D.length;return["function"===typeof r?r({open:V}):(0,oe.jsx)(U.Z,{onClick:V,"data-cy":"action-config-component",children:(0,oe.jsx)(Ln.default,{})}),d&&(0,oe.jsxs)(Fn,{open:!0,fullWidth:!0,title:q,onClose:G,PaperProps:{style:{minHeight:"auto"}},actions:(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsx)(W.Z,{onClick:G,color:"inherit","data-cy":"config-access-cancel",children:f("common.cancel")}),(0,oe.jsxs)(W.Z,{onClick:M,color:"primary",disabled:Y,variant:"contained",autoFocus:!0,"data-cy":"config-access-confirm",children:[b&&(0,oe.jsx)(J.Z,{size:16}),f("common.confirm")]})]}),children:[(0,oe.jsx)(x.Z,{mt:4,mb:3,children:(0,oe.jsx)(xe.Z,{label:f("blocklet.config.access.description"),select:!0,fullWidth:!0,value:O,onChange:function(e){var n=e.target.value;R(n)},"data-cy":"config-access-select",SelectProps:{renderValue:function(e){var n=Rn.find((function(n){return n.value===e}));return n?(0,oe.jsxs)(x.Z,{children:[(0,oe.jsx)(n.icon,{style:K}),n.title[m]]}):null}},children:Rn.map((function(e){return(0,oe.jsxs)(zn,{value:e.value,sx:{display:"block"},"data-cy":"config-access-opt-".concat(e.value),children:[(0,oe.jsxs)(x.Z,{display:"flex",alignItems:"center",children:[(0,oe.jsx)(e.icon,{style:K}),(0,oe.jsx)(x.Z,{children:e.title[m]})]}),(0,oe.jsx)(x.Z,{children:(0,oe.jsx)(x.Z,{className:"tip",children:e.description[m]})})]})}))})}),O===On&&(0,oe.jsx)(x.Z,{mt:4,mb:3,children:(0,oe.jsx)(xe.Z,{label:f("blocklet.config.access.description"),select:!0,fullWidth:!0,value:D.map((function(e){return e.name})),onChange:function(e){F(Z.filter((function(n){return(e.target.value||[]).includes(n.name)})))},SelectProps:{multiple:!0,renderValue:function(e){return(0,oe.jsx)(x.Z,{sx:{display:"flex",flexWrap:"wrap",gap:.5},children:e.map((function(e){var n=Z.find((function(n){return n.name===e}));return(0,oe.jsx)(ne.Z,{label:n.title},n.text)}))})}},children:Z.map((function(e){var n=e.name,t=e.title;return(0,oe.jsxs)($.Z,{value:n,children:[(0,oe.jsx)(qe.Z,{checked:D.some((function(e){return e.name===n}))}),(0,oe.jsx)(ye.Z,{primary:t})]},n)}))})})]})]}Bn.propTypes={blocklet:u().object.isRequired,ancestors:u().array,children:u().any},Bn.defaultProps={ancestors:[],children:null};var Dn,Fn=(0,c.default)(Ue.Z)(jn||(jn=(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"]))),zn=(0,c.default)($.Z)(bn||(bn=(0,r.Z)(["\n .tip {\n font-size: 12px;\n color: ",";\n }\n"])),(function(e){return e.theme.palette.text.secondary}));function Un(e){var n,t,r=e.blocklet,i=e.ancestors,a=e.depth,c=(0,B.Z)(),d=(0,S.PE)(),u=d.t,p=d.locale,f=(0,Ve.DJ)().roles,m=(0,l.useState)(!0),h=(0,o.Z)(m,2),v=h[0],Z=h[1],g=(0,_e.y0)().recommendedDomain,j=i[0]||r,b="/".concat(i.map((function(e){return e.mountPoint||"/"})).join("/"),"/").concat(r.mountPoint||"/").replace(/\/+/g,"/"),y=(0,ue.vH)({blocklet:j,domain:{value:g},mountPoint:b,params:(0,ue.f0)(j,p)}),w={fill:c.palette.text.secondary},L=a>0&&r.children.length>0,A=(0,oe.jsx)(U.Z,{size:"small",children:v?(0,oe.jsx)(C.Z,{fontSize:"inherit"}):(0,oe.jsx)(k.default,{fontSize:"inherit"})}),_=In(r,j,{roles:f}),T=_.access,O=_.roles;if("roles"!==T)t=Tn.find((function(e){return e.value===T}))||Tn[2];else{var R=O.map((function(e){return e.title})).join("/");t={title:{zh:"\u53ea\u6709 ".concat(R," \u53ef\u4ee5\u8bbf\u95ee"),en:"Only ".concat(R," can access")}}}return[(a>0||"gateway"!==r.meta.group)&&(0,oe.jsxs)(x.Z,{display:"flex",py:2,className:"component-item",justifyContent:"space-between",alignItems:"center",children:[(0,oe.jsxs)(x.Z,{pl:Math.max(2*(a-1),0),width:{xs:300,md:400},display:"flex",alignItems:"center",style:{cursor:L?"pointer":"cursor"},onClick:function(){return L&&Z(!v)},children:[L?A:(0,oe.jsx)(x.Z,{width:28}),(0,oe.jsx)(P.Z,{blocklet:r,ancestors:i}),(0,oe.jsxs)(x.Z,{ml:"16px",children:[(0,oe.jsx)(x.Z,{style:{color:"#222",fontSize:18},children:(0,E.getDisplayName)(r,!0)}),(0,oe.jsx)(x.Z,{display:"flex",alignItems:"center",children:(0,oe.jsx)(x.Z,{color:"text.secondary",children:t.title[p]})})]})]},r),(0,oe.jsxs)(x.Z,{children:[(0,oe.jsx)(K.Z,{title:u("common.visit"),children:(0,oe.jsx)("a",{target:"_blank",href:y,rel:"noopener noreferrer",title:y,children:(0,oe.jsx)(U.Z,{children:(0,oe.jsx)(Cn.Z,{})})})}),(0,oe.jsx)(Bn,{blocklet:r,ancestors:i,children:function(e){var n=e.open;return(0,oe.jsx)(K.Z,{title:u("common.edit"),children:(0,oe.jsx)(U.Z,{onClick:n,"data-cy":"btn-edit-".concat(r.meta.did),children:(0,oe.jsx)(wn.Z,{style:w})})})}})]},"actions")]},"group-not-gateway-box"),(0,oe.jsx)(Sn.Z,{depth:a}),null!==(n=r.children)&&void 0!==n&&n.length?(0,oe.jsx)(kn.Z,{in:v,children:r.children.map((function(e){return(0,oe.jsx)(Un,{blocklet:e,ancestors:[].concat((0,s.Z)(i),[r]),depth:a+1},"".concat(a+1,"-").concat(e.meta.did))}))},"blocklet-collapse"):null]}function Kn(){var e=(0,S.PE)().t,n=(0,_e.y0)().blocklet,t=(0,s.Z)(n.children)||[];return"gateway"!==n.meta.group&&t.unshift(n),(0,oe.jsx)(Wn,{component:"div",children:t&&t.length?[(0,oe.jsx)(x.Z,{mt:2,ml:{xs:"-12px",md:"-24px"},style:{maxWidth:1080},children:(0,oe.jsx)(Un,{blocklet:n},"0-".concat(n.meta.did))},"top-blocklet-".concat(n.meta.did))]:(0,oe.jsx)(x.Z,{mt:8,children:(0,oe.jsx)(q.Z,{children:e("blocklet.component.noComponent")})})})}Un.propTypes={blocklet:u().object.isRequired,ancestors:u().array,depth:u().number},Un.defaultProps={ancestors:[],depth:0},Kn.propTypes={};var Wn=(0,c.default)(x.Z)(Dn||(Dn=(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)})),qn=t(44784);var Gn=function(){var e,n,t,r=(0,de.h6)().api,o=(0,_e.y0)().blocklet,a=(0,S.PE)().t,s=null===o||void 0===o||null===(e=o.meta)||void 0===e?void 0:e.did,l=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,dn.cI)({defaultValues:ln()(l,["domain","clientId","enabled"])}),d=c.handleSubmit,u=c.control,p=c.formState,f=c.watch,m=c.reset,h=f("enabled"),v=(0,cn.Z)(function(){var e=(0,T.Z)((0,_.Z)().mark((function e(n){var t,i,o,l,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:s,oauth:JSON.stringify({auth0:n})}});case 3:o=e.sent,l=o.blocklet,c=Object.assign({enabled:!1,domain:"",clientId:""},(null===l||void 0===l||null===(t=l.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)}}()),Z=(0,cn.Z)((function(e){return!(null===e||void 0===e||!e.trim())||a("oauth.auth0.domainDescribe")})),g=(0,cn.Z)((function(e){return!(null===e||void 0===e||!e.trim())||a("oauth.auth0.clientIdDescribe")})),j=(0,cn.Z)((function(){return!0}));return(0,oe.jsx)(x.Z,{children:(0,oe.jsxs)("form",{onSubmit:d(v),disabled:!0,children:[(0,oe.jsx)(dn.Qr,{name:"enabled",control:u,render:function(e){var n=e.field;return(0,oe.jsx)(We.Z,{control:(0,oe.jsx)(qn.Z,(0,i.Z)({checked:n.value,style:{marginRight:"6px"}},n)),label:a("oauth.auth0.enable"),sx:{marginBottom:2,ml:1}})}}),(0,oe.jsx)(dn.Qr,{name:"domain",control:u,rules:{validate:h?Z:j},render:function(e){var n,t=e.field;return(0,oe.jsx)(on.Z,{fullWidth:!0,children:(0,oe.jsx)(xe.Z,(0,i.Z)((0,i.Z)({},t),{},{label:a("oauth.auth0.domain"),error:!!p.errors[t.name],helperText:(null===(n=p.errors[t.name])||void 0===n?void 0:n.message)||"\u3000",disabled:!h}))})}}),(0,oe.jsx)(dn.Qr,{name:"clientId",control:u,rules:{validate:h?g:j},render:function(e){var n,t=e.field;return(0,oe.jsx)(on.Z,{fullWidth:!0,children:(0,oe.jsx)(xe.Z,(0,i.Z)((0,i.Z)({},t),{},{error:!!p.errors[t.name],label:a("oauth.auth0.clientId"),helperText:(null===(n=p.errors[t.name])||void 0===n?void 0:n.message)||"\u3000",disabled:!h}))})}}),(0,oe.jsx)(an.Z,{type:"submit",variant:"contained",onSubmit:d(v),disabled:!p.isDirty,children:a("oauth.save")})]})})},Vn=t(77150),Mn=t(24103),Hn={ttl:604800};function Yn(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 Jn(){var e,n,t=(0,de.h6)().api,r=(0,_e.y0)().blocklet,o=null===r||void 0===r||null===(e=r.meta)||void 0===e?void 0:e.did,a=Object.assign({},Hn,(null===r||void 0===r||null===(n=r.settings)||void 0===n?void 0:n.session)||{}),s=(0,dn.cI)({defaultValues:ln()(Yn(a),["ttl"])}),l=s.handleSubmit,c=s.control,d=s.formState,u=s.reset,p=(0,S.PE)().t,f=(0,cn.Z)(function(){var e=(0,T.Z)((0,_.Z)().mark((function e(n){var r,i,a,s;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:Yn(n,!0)}});case 3:i=e.sent,a=i.blocklet,s=Object.assign({},Hn,ln()((null===a||void 0===a||null===(r=a.settings)||void 0===r?void 0:r.session)||{},["ttl"])),u(Yn(s)),H.Z.success(p("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,oe.jsx)(x.Z,{children:(0,oe.jsxs)("form",{onSubmit:l(f),disabled:!0,children:[(0,oe.jsx)(dn.Qr,{name:"ttl",control:c,render:function(e){var n=e.field;return(0,oe.jsx)(on.Z,{fullWidth:!0,sx:{mb:2},children:(0,oe.jsxs)(Mn.Z,{px:3,children:[(0,oe.jsx)(x.Z,{mx:-3,my:.5,children:p("blocklet.config.session.ttl",{day:n.value})}),(0,oe.jsx)(Vn.ZP,(0,i.Z)((0,i.Z)({},n),{},{defaultValue:7,step:1,marks:[{value:1,label:p("blocklet.config.session.day",{day:1})},{value:7,label:p("blocklet.config.session.days",{day:7})},{value:14,label:p("blocklet.config.session.days",{day:14})},{value:21,label:p("blocklet.config.session.days",{day:21})},{value:30,label:p("blocklet.config.session.days",{day:30})}],min:1,max:30,valueLabelDisplay:"auto",style:{maxWidth:"360px"}}))]})})}}),(0,oe.jsx)(an.Z,{type:"submit",variant:"contained",onSubmit:l(f),disabled:!d.isDirty,children:p("oauth.save")})]})})}var Qn=t(3267),Xn=t(30333),$n=t(75760),et=t(97038),nt=t(12673),tt=t(92706),rt=t.n(tt),it=(0,l.forwardRef)((function(e,n){var t=(0,l.useContext)(S.RD).t,r=(0,nt.Z)({show:!1,title:"",content:"",onConfirm:rt(),onCancel:rt()}),i=(0,cn.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||rt(),r.onCancel=e.onCancel||rt()})),o=(0,cn.Z)((function(){r.title="",r.content="",r.onConfirm=rt(),r.onCancel=rt()})),a=(0,cn.Z)((function(){r.show=!1,setTimeout((function(){o()}),300)})),s=(0,cn.Z)((function(){a(),null===r||void 0===r||r.onCancel()}),[]),c=(0,cn.Z)((function(){null===r||void 0===r||r.onConfirm(a)}),[]);return(0,l.useImperativeHandle)(n,(function(){return{open:i,close:a}}),[i,a]),(0,oe.jsx)(Ue.I,{open:r.show,title:r.title,onConfirm:c,onCancel:s,confirmButton:{text:t("common.confirm"),props:{variant:"contained",color:"primary"}},cancelButton:{text:t("common.cancel"),props:{variant:"outlined",color:"primary"}},children:r.content})}));var ot=t(64886),at=t(42080),st=t.n(at),lt=t(75506),ct=t.n(lt),dt=t(47685),ut=t(13260),pt=(0,l.forwardRef)((function(e,n){var t,r,i=(0,l.useContext)(S.RD).t,o=(0,_e.y0)().blocklet,a=(0,de.h6)().api,s=(0,nt.Z)({mode:"view",show:!1,data:{},callback:rt()}),c=(0,dt.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,cn.Z)((function(){s.mode="view",s.data={},s.callback=rt()}),[]),p=(0,cn.Z)((function(){s.show=!1,setTimeout((function(){u()}),d)}),[]),f=(0,cn.Z)((function(e){s.mode="view",s.show=!0,s.data=e}),[]),m=(0,cn.Z)((function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:rt();s.mode="approve",s.show=!0,s.data=e,s.callback=n}),[]);(0,l.useImperativeHandle)(n,(function(){return{open:f,close:p,approve:m}}),[f,p,m]);var h=(0,rn.Z)((function(){s.data.migratedFrom=[s.data.appId,s.data.appPid];var e=["appName","appLogo","appId","appPid","migratedFrom","appDescription","appUrl","version","appliedAt","status","serverId","serverVersion"];return!1!==s.data.isMaster&&st()(e,"appliedAt","status"),e.map((function(e){var n=i("federated.info.".concat(e)),t=s.data[e];("appName"===e&&s.data.isMaster&&(t=(0,oe.jsxs)(x.Z,{children:[(0,oe.jsx)(Qn.Z,{component:Xn.Z}),t]})),["appId","appPid","serverId"].includes(e)&&(t=(0,oe.jsx)(ut.kL,{children:t})),["appUrl"].includes(e)&&(t=(0,oe.jsx)(x.Z,{component:"a",href:t,target:"_blank",children:t})),["appLogo"].includes(e)&&(t=(0,oe.jsx)("img",{src:"".concat(s.data.appUrl,"/").concat(t),width:"60",height:"60",alt:s.data.appName})),"status"===e&&(t=t&&i("federated.status.".concat(t))),"migratedFrom"===e)&&(t=(s.data.migratedFrom||[]).filter((function(e){return![s.data.appId,s.data.appPid].includes(e)})).map((function(e){return(0,oe.jsx)(ut.kL,{children:e})})));return ct()(t)&&(t="-"),{name:n,value:t}}))}),[s.data]),v="approve"===s.mode,Z=(0,cn.Z)((0,T.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:s.data.appPid,did:o.appPid,status:"rejected"}});case 2:p(),null===s||void 0===s||s.callback(!1);case 4:case"end":return e.stop()}}),e)})))),g=(0,cn.Z)((0,T.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:s.data.appPid,did:o.appPid,status:"approved"}});case 2:p(),null===s||void 0===s||s.callback(!0);case 4:case"end":return e.stop()}}),e)}))));return(0,oe.jsx)(Ue.Z,{open:s.show,title:i(v?"federated.approveToJoinLogin":"federated.siteDetail"),onClose:p,actions:v?(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsx)(an.Z,{color:"error",variant:"contained",onClick:Z,children:i("common.reject")}),(0,oe.jsx)(an.Z,{variant:"contained",onClick:g,children:i("common.approve")})]}):(0,oe.jsx)(an.Z,{variant:"outlined",onClick:p,children:i("common.close")}),children:h.map((function(e){return(0,oe.jsx)(ot.Z,{style:{alignItems:"flex-start"},valueComponent:"div",nameWidth:180,name:e.name,children:e.value},e.name)}))})})),ft=pt,mt=t(79842),ht=t(85408),xt=t.n(ht),vt=(0,l.forwardRef)((function(e,n){var t,r,i=(0,dt.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,l.useContext)(S.RD).t,s=(0,nt.Z)({show:!1,data:{link:""}}),c=(0,cn.Z)((function(){s.data.link=""}),[]),d=(0,cn.Z)((function(){s.show=!1,setTimeout((function(){c()}),o)}),[]),u=(0,cn.Z)((function(e){var n=e.link;s.show=!0,s.data.link=n}),[]);(0,l.useImperativeHandle)(n,(function(){return{open:u,close:d}}),[u,d]);var p=(0,cn.Z)((function(){xt()(s.data.link),d()}),[d]);return(0,oe.jsxs)(Ue.Z,{open:s.show,title:a("federated.joinFederatedLogin"),onClose:d,PaperProps:{style:{minHeight:"unset"}},actions:(0,oe.jsx)(W.Z,{color:"primary",autoFocus:!0,variant:"contained",onClick:p,children:a("common.copyAndClose")}),children:[(0,oe.jsx)(x.Z,{mb:1,children:a("federated.inviteJoinFederatedLoginDescription")}),(0,oe.jsx)(x.Z,{sx:{"& .copy-button":{display:"none !important"}},children:(0,oe.jsx)(mt.Z,{language:"shell",style:{marginBottom:0},children:s.data.link})})]})}));function Zt(e){var n,t,r,i,a,s=e.mode,c=(0,l.useRef)(null),d=(0,l.useRef)(null),u=(0,l.useContext)(S.RD),p=u.t,f=u.locale,m=(0,_e.y0)(),h=m.blocklet,v=m.actions.refreshBlocklet,Z=function(){var e=(0,l.useRef)(null),n=(0,cn.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,cn.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,oe.jsx)(it,{ref:e}),confirmApi:r}}(),g=Z.confirmApi,j=Z.confirmHolder,b=(0,de.h6)().api,y=(null===(n=h.settings.federated)||void 0===n?void 0:n.sites)||[],k=(null===(t=h.settings.federated)||void 0===t?void 0:t.config)||{autoLogin:!1},C=!1!==k.isMaster,w=(0,cn.Z)((function(e){var n;null===(n=d.current)||void 0===n||n.open(e)})),L=(0,cn.Z)((function(e){var n;null===(n=d.current)||void 0===n||n.approve(e,v)})),E=(0,cn.Z)((function(e){g.open({title:p("federated.disableFederatedLogin"),content:p("federated.disableFederatedLoginDescription"),onConfirm:function(n){return(0,T.Z)((0,_.Z)().mark((function t(){return(0,_.Z)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,b.auditFederatedLogin({input:{memberPid:e.appPid,did:h.appPid,status:"revoked"}});case 2:n();case 3:case"end":return t.stop()}}),t)})))()}})})),P=(0,cn.Z)((function(e){g.open({title:p("federated.enableFederatedLogin"),content:p("federated.enableFederatedLoginDescription"),onConfirm:function(n){return(0,T.Z)((0,_.Z)().mark((function t(){return(0,_.Z)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,b.auditFederatedLogin({input:{memberPid:e.appPid,did:h.appPid,status:"approved"}});case 2:n();case 3:case"end":return t.stop()}}),t)})))()}})})),A=(0,rn.Z)((function(){var e=[{label:p("common.name"),name:"appName",options:{customBodyRenderLite:function(e){var n=y[e],t=!1!==n.isMaster;return(0,oe.jsx)(x.Z,{display:"inline-block",children:(0,oe.jsxs)(x.Z,{component:"a",display:"flex",alignItems:"center",href:n.appUrl,target:"_blank",onClick:function(e){e.stopPropagation()},children:[t&&(0,oe.jsx)(Qn.Z,{component:Xn.Z,style:{marginRight:"4px"}}),n.appName]})})}}},{label:p("common.did"),name:"appId",options:{customBodyRenderLite:function(e){var n=y[e];return(0,oe.jsx)(et.Z,{children:n.appId})}}},{label:p("common.status"),name:"status",options:{customBodyRenderLite:function(e){var n=y[e],t=!1!==n.isMaster;return(0,oe.jsx)(x.Z,{children:t?"-":p("federated.status.".concat(n.status))})}}}];return C&&e.push({label:p("common.actions"),name:"actions",options:{customBodyRenderLite:function(e){var n=y[e],t=!1!==n.isMaster;return(0,oe.jsx)(x.Z,{display:"flex",gap:1,children:t?(0,oe.jsxs)(oe.Fragment,{children:["rejected"===n.status&&(0,oe.jsx)(W.Z,{variant:"contained",color:"error",size:"small",onClick:function(e){e.stopPropagation()},children:p("federated.status.rejected")}),"revoked"===n.status&&(0,oe.jsx)(W.Z,{variant:"contained",color:"secondary",size:"small",onClick:function(e){e.stopPropagation()},children:p("federated.status.revoked")})]}):(0,oe.jsxs)(oe.Fragment,{children:["pending"===n.status&&(0,oe.jsx)(W.Z,{variant:"contained",color:"primary",size:"small",onClick:function(e){e.stopPropagation(),L(n)},children:p("federated.status.pending")}),"approved"===n.status&&(0,oe.jsx)(W.Z,{variant:"contained",color:"error",size:"small",onClick:function(e){e.stopPropagation(),E(n)},style:{whiteSpace:"nowrap"},children:p("federated.revoke")}),"revoked"===n.status&&(0,oe.jsx)(W.Z,{variant:"contained",color:"warning",size:"small",onClick:function(e){e.stopPropagation(),P(n)},style:{whiteSpace:"nowrap"},children:p("federated.approve")})]})})}}}),e}),[k.appId,y,C]),O=(0,rn.Z)((function(){return{sort:!0,download:!1,filter:!1,print:!1,expandableRowsOnClick:!0,onRowClick:function(e,n){var t=n.dataIndex,r=y[t];w(r)}}}),[]),R=(0,cn.Z)((function(){var e,n,t,r=null===(e=h.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 i,o=new URL(r);null===(i=c.current)||void 0===i||i.open({link:o.origin})}catch(a){H.Z.error(p("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]),N=(0,l.useState)(k.autoLogin||!1),I=(0,o.Z)(N,2),B=I[0],D=I[1],F=(0,cn.Z)((function(){g.open({title:p(B?"federated.disableFederatedAutoLogin":"federated.enableFederatedAutoLogin"),content:p(B?"federated.disableFederatedAutoLoginDescription":"federated.enableFederatedAutoLoginDescription"),onConfirm:function(e){return(0,T.Z)((0,_.Z)().mark((function n(){return(0,_.Z)().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,b.configFederated({input:{did:h.appPid,autoLogin:!B}});case 2:D((function(e){return!e})),e();case 4:case"end":return n.stop()}}),n)})))()}})}),[D,B]),z=(0,cn.Z)((function(){g.open({title:p("federated.quitFederatedLogin"),content:p("federated.quitFederatedLoginDescription"),onConfirm:function(e){return(0,T.Z)((0,_.Z)().mark((function n(){return(0,_.Z)().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,b.quitFederatedLogin({input:{did:h.appPid}});case 2:e();case 3:case"end":return n.stop()}}),n)})))()}})})),U=[];return"master"!==s?U.push((0,oe.jsx)(W.Z,{size:"small",variant:"contained",color:"error",onClick:z,sx:{ml:1},children:p("federated.quitFederatedLogin")})):U.push((0,oe.jsx)(W.Z,{size:"small",variant:"contained",onClick:R,sx:{ml:1},children:p("federated.inviteJoinFederatedLogin")})),(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsx)($n.Z,{className:"main-table",locale:f,data:y,columns:A,customButtons:U,title:(0,oe.jsx)(x.Z,{className:"table-toolbar-left",children:"master"===s?p("oauth.federated"):(0,oe.jsx)(We.Z,{sx:{ml:0,"& span.MuiSwitch-switchBase":{display:"flex"},"& span.MuiSwitch-track":{display:"block"}},control:(0,oe.jsx)(qn.Z,{checked:B,style:{marginRight:"6px"},onChange:F}),label:p("federated.enableFederatedAutoLogin")})}),options:O}),j,(0,oe.jsx)(vt,{ref:c}),(0,oe.jsx)(ft,{ref:d})]})}Zt.propTypes={mode:u().oneOf(["member","master"])},Zt.defaultProps={mode:"member"};var gt=Zt,jt=t(82434),bt=t.n(jt),yt=(0,l.forwardRef)((function(e,n){var t,r,i=(0,l.useContext)(S.RD).t,o=(0,de.h6)().api,a=(0,_e.y0)().blocklet,s=null===a||void 0===a?void 0:a.appPid,c=(0,dt.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,nt.Z)({show:!1,appUrl:"",appUrlError:"",callback:rt()}),p=(0,cn.Z)((function(){u.appUrl="",u.appUrlError="",u.callback=rt()}),[]),f=(0,cn.Z)((function(){u.show=!1,setTimeout((function(){p()}),d)}),[]),m=(0,cn.Z)((function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:rt();u.show=!0,u.callback=e}),[]);(0,l.useImperativeHandle)(n,(function(){return{open:m,close:f}}),[m,f]);var h=(0,cn.Z)((function(e){if(!e)throw new Error(i("federated.federatedJoinAppUrlRequired"));if(!bt()(e))throw new Error(i("federated.federatedJoinAppUrlInvalid"))})),v=(0,cn.Z)((0,T.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:s,appUrl:u.appUrl}});case 4:n=e.sent,u.show=!1,f(),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]])}))),[f,s]);return(0,oe.jsxs)(Ue.Z,{open:u.show,title:i("federated.joinFederatedLogin"),onClose:f,PaperProps:{style:{minHeight:"unset"}},actions:(0,oe.jsx)(W.Z,{color:"primary",autoFocus:!0,variant:"contained",onClick:v,children:i("common.confirm")}),children:[(0,oe.jsx)(x.Z,{mb:1,children:i("federated.joinFederatedLoginDescription")}),(0,oe.jsx)(xe.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}})]})})),kt=yt;function Ct(){var e,n,t,r,i=(0,l.useRef)(null),o=(0,l.useRef)(null),a=(0,l.useContext)(S.RD).t,s=(0,_e.y0)(),c=s.blocklet,d=s.actions.refreshBlocklet,u=(0,cn.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,s=new URL(r);null===(o=i.current)||void 0===o||o.open({link:s.origin})}catch(l){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]),p=(0,cn.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 f,m=!1!==(null===(f=c.settings.federated)||void 0===f?void 0:f.config.isMaster);return(0,oe.jsx)(gt,{mode:m?"master":"member"})}return(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsxs)(x.Z,{display:"flex",flexDirection:"column",gap:2,justifyContent:"center",alignItems:"center",minHeight:"200px",children:[(0,oe.jsx)(W.Z,{variant:"contained",onClick:u,children:a("federated.inviteJoinFederatedLogin")}),(0,oe.jsx)(F.Z,{sx:{width:"150px",color:"rgba(0, 0, 0, 0.3)"},children:"OR"}),(0,oe.jsx)(W.Z,{variant:"outlined",onClick:p,children:a("federated.joinFederatedLogin")})]}),(0,oe.jsx)(vt,{ref:i}),(0,oe.jsx)(kt,{ref:o})]})}var wt,St=function(){var e=(0,l.useContext)(S.RD).t,n=[{label:(0,oe.jsx)(x.Z,{textAlign:"center",width:"100%",children:e("oauth.commonSettings")}),value:"settings"},{label:(0,oe.jsx)(x.Z,{textAlign:"center",width:"100%",children:e("oauth.federated")}),value:"federated"},{label:(0,oe.jsx)(x.Z,{textAlign:"center",width:"100%",children:"Auth0"}),value:"auth0"},{label:(0,oe.jsx)(x.Z,{textAlign:"center",width:"100%",children:e("oauth.moreLogin")}),value:"more"}],t=(0,l.useState)(n[0].value),r=(0,o.Z)(t,2),i=r[0],a=r[1],s=(0,rn.Z)((function(){return{auth0:(0,oe.jsx)(Gn,{}),federated:(0,oe.jsx)(Ct,{}),more:(0,oe.jsx)(x.Z,{children:(0,oe.jsx)(q.Z,{children:e("oauth.comingSoon")})}),settings:(0,oe.jsx)(x.Z,{children:(0,oe.jsx)(Jn,{})})}}),[e]);return(0,oe.jsxs)(x.Z,{children:[(0,oe.jsx)(L.Z,{tabs:n,current:i,onChange:a}),(0,oe.jsx)(x.Z,{marginTop:"10px",children:s[i]})]})},Lt=["blocklet","onUpdate"],Et=function e(n){var t=n.tabs,r=n.blocklet,i=n.ancestors,o=void 0===i?[]:i,a=n.depth,l=void 0===a?1:a,c=n.t,d=[].concat((0,s.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,oe.jsxs)(x.Z,{pl:2*Math.max(1,l-1),display:"flex",alignItems:"center",justifyContent:"flex-start",children:[u?(0,oe.jsx)(A.Z,{size:24,blocklet:r}):(0,oe.jsx)(P.Z,{size:24,blocklet:r,ancestors:o}),(0,oe.jsx)(x.Z,{ml:"16px",children:(0,oe.jsx)(x.Z,{style:{color:"#222"},children:u?c("blocklet.component.container"):(0,E.getDisplayName)(r,!0)})})]},d),value:d}),r.children.length>0&&r.children.forEach((function(n){e({tabs:t,blocklet:n,ancestors:[].concat((0,s.Z)(o),[r]),depth:l+1,t:c})}))};function Pt(e){var n=e.blocklet,t=e.onUpdate,r=(0,a.Z)(e,Lt),s=(0,l.useContext)(S.RD).t,c=(0,de.h6)(),d=c.info,u=c.inService,f=(0,l.useState)(!0),E=(0,o.Z)(f,2),P=E[0],A=E[1],_=(0,w.useSearchParams)(),T=(0,o.Z)(_,2),O=T[0],R=T[1],N=O.get("tab")||"general",I=[{label:(0,oe.jsxs)(x.Z,{display:"flex",alignItems:"center","data-cy":"configuration-tab-general",children:[(0,oe.jsx)(Z.Z,{sx:{fontSize:24}}),(0,oe.jsx)(x.Z,{ml:"16px",children:(0,oe.jsx)(x.Z,{style:{color:"#222"},children:s("common.general")})})]},"general"),value:"general"},{label:(0,oe.jsxs)(x.Z,{display:"flex",alignItems:"center","data-cy":"configuration-tab-access",children:[(0,oe.jsx)(g.Z,{sx:{fontSize:24}}),(0,oe.jsx)(x.Z,{ml:"16px",children:(0,oe.jsx)(x.Z,{style:{color:"#222"},children:s("common.access")})})]},"access"),value:"access"},{label:(0,oe.jsxs)(x.Z,{display:"flex",alignItems:"center","data-cy":"configuration-tab-oauth",children:[(0,oe.jsx)(j.Z,{sx:{fontSize:24}}),(0,oe.jsx)(x.Z,{ml:"16px",children:(0,oe.jsx)(x.Z,{style:{color:"#222"},children:s("common.login")})})]},"oauth"),value:"oauth"},{label:(0,oe.jsxs)(x.Z,{display:"flex",alignItems:"center","data-cy":"configuration-tab-notification",children:[(0,oe.jsx)(b.Z,{sx:{fontSize:24}}),(0,oe.jsx)(x.Z,{ml:"16px",children:(0,oe.jsx)(x.Z,{style:{color:"#222"},children:s("common.notification")})})]},"notification"),value:"notification"},{label:(0,oe.jsxs)(x.Z,{display:"flex",alignItems:"center","data-cy":"configuration-tab-preference",children:[(0,oe.jsx)(x.Z,{ml:-2,style:{transform:"translateY(2px)"},children:P?(0,oe.jsx)(C.Z,{fontSize:"inherit"}):(0,oe.jsx)(k.default,{fontSize:"inherit"})}),(0,oe.jsx)(y.Z,{sx:{fontSize:24}}),(0,oe.jsx)(x.Z,{ml:"16px",children:(0,oe.jsx)(x.Z,{style:{color:"#222"},children:s("common.preferences")})})]},"preference"),value:"preference"}];P&&Et({tabs:I,blocklet:n,t:s});var B=null;if("general"===N)B=(0,oe.jsx)(nn,{blocklet:n,onUpdate:t});else if("access"===N)B=(0,oe.jsx)(Kn,{});else if("oauth"===N)B=(0,oe.jsx)(St,{});else if("notification"===N)B=(0,oe.jsx)(yn,{});else{var D=u?h.WELLKNOWN_SERVICE_PATH_PREFIX:d.routing.adminPath,F=new URLSearchParams;u||F.set("authKey","__sst"),F.set("schemaKey",m()(window.location.origin,D,"/api/preferences?id=".concat(encodeURIComponent(N)))),B=(0,oe.jsx)(p.Z,{url:"".concat(m()(window.location.origin,D,"/hosted/form-collector/"),"?").concat(F.toString()),width:"100%",height:"100%",frameBorder:0,styles:{border:0}})}return(0,oe.jsx)(At,(0,i.Z)((0,i.Z)({},r),{},{children:(0,oe.jsxs)(v.ZP,{container:!0,spacing:4,columns:24,children:[(0,oe.jsx)(v.ZP,{item:!0,sm:7,md:5,children:(0,oe.jsx)(L.Z,{tabs:I,current:N,orientation:"vertical",onChange:function(e){"preference"===e?A(!P):R((function(n){return"general"===e?n.delete("tab"):n.set("tab",e),n}))},sx:{borderRight:1,height:"100%",borderColor:"divider"}})}),(0,oe.jsx)(v.ZP,{item:!0,sm:17,md:19,children:(0,oe.jsx)(x.Z,{style:{minHeight:"66vh",height:"100%",position:"relative",overflow:"hidden"},children:B})})]})}))}Pt.propTypes={blocklet:u().object.isRequired,onUpdate:u().func},Pt.defaultProps={onUpdate:function(){}};var At=c.default.div(wt||(wt=(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"])))},63405:function(e,n,t){t.d(n,{Z:function(){return k}});var r=t(68079),i=t(5057),o=t(55898),a=t.n(o),s=t(31942),l=t(75239),c=t(39075),d=t(69569),u=t(37064),p=t(14491),f=t(96234),m=t(43681),h=t.n(m),x=t(11819),v=t(38763),Z=t(75392),g=t(11750),j=t(58238),b=t(96266);function y(e){var n=e.certificate,t=(0,i.useState)(null),r=(0,f.Z)(t,2),o=r[0],a=r[1],l=(0,j.h6)(),d=(0,c.PE)(),u=d.t,m=d.locale,y=function(){a(null)},k=Boolean(o);return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(s.Z,{"aria-owns":k?"mouse-over-popover":void 0,onMouseEnter:function(e){a(e.currentTarget)},onMouseLeave:y,style:{color:"#44cdc6",fontSize:20,marginLeft:8,cursor:"pointer"}}),(0,b.jsx)(x.ZP,{id:"mouse-over-popover",style:{pointerEvents:"none"},open:k,anchorEl:o,anchorOrigin:{vertical:"bottom",horizontal:"left"},transformOrigin:{vertical:"top",horizontal:"left"},onClose:y,disableRestoreFocus:!0,children:(0,b.jsx)(v.Z,{children:(0,b.jsxs)(Z.Z,{style:{display:"flex"},children:[(0,b.jsx)("div",{children:(0,b.jsx)("img",{src:"".concat(l.imgPrefix,"/https-certificate-icon.png"),alt:"certificate icon",style:{maxHeight:"100%",maxWidth:"100%"}})}),(0,b.jsxs)(g.Z,{component:"div",style:{marginLeft:"16px"},children:[(0,b.jsx)(g.Z,{component:"div",style:{fontWeight:"bold"},children:n.domain}),(0,b.jsx)(g.Z,{component:"div",children:"".concat(u("common.issuer"),": ").concat(h()(n,"issuer.commonName",""))}),(0,b.jsx)(g.Z,{component:"div",children:"".concat(u("router.cert.issuedOn"),": ").concat((0,p.pz)(n.validFrom,m))}),(0,b.jsx)(g.Z,{component:"div",children:"".concat(u("router.cert.expiryOn"),": ").concat((0,p.pz)(n.validTo,m))})]})]})})})]})}function k(e){var n=e.domain,t=e.filters,o=(0,c.PE)().t,a=n.value,u=n.domainStatus;if(!(0,p.rM)(a))return null;var f=null,m=null,h=u.isHttps,x=u.matchedCert;if(!(0,p.ao)(a)){var v=u.dns,Z=void 0===v?{}:v,g=Z.resolved,j=Z.ip;f=g||"127.0.0.1"===j?(0,b.jsx)(l.Z,{title:o("router.domain.verify.ok"),children:(0,b.jsx)(d.Z,{color:"success"})}):(0,b.jsx)(l.Z,{title:o("router.domain.verify.notResolved"),children:(0,b.jsx)(d.Z,{color:"error"})})}m=h?(0,b.jsx)(y,{certificate:x}):(0,b.jsx)(l.Z,{title:o("router.domain.https.bad"),children:(0,b.jsx)(s.Z,{style:{color:"#D0021B",fontSize:20,marginLeft:8,cursor:"pointer"}})});var k=t.map((function(e){return"domain"===e?f:"http"===e?m:null}));return i.createElement.apply(void 0,[i.Fragment,null].concat((0,r.Z)(k)))}y.propTypes={certificate:a().object},y.defaultProps={certificate:{}},k.propTypes={domain:u.Y.isRequired,filters:a().array},k.defaultProps={filters:["domain","http"]}},37064:function(e,n,t){t.d(n,{Y:function(){return o}});var r=t(55898),i=t.n(r),o=i().shape({href:i().string,accessibility:i().shape({loading:i().bool,accessible:i().bool}),domainStatus:i().shape({isHttps:i().bool,matchedCert:i().object}),dns:i().shape({resolved:i().bool,ip:i().string})})},54063:function(e,n,t){t.d(n,{C:function(){return r}});var r="true"===localStorage.getItem("enableDebug")}}]);
|
|
1
|
+
"use strict";(self.webpackChunk_abtnode_webapp=self.webpackChunk_abtnode_webapp||[]).push([[9801],{44784:function(e,n,t){var r,i=t(71171),o=t(33028),a=t(59740),s=t(33518),l=t(82790),c=t(96266),d=["labelProps","className","style"];function u(e){var n=e.labelProps,t=e.className,r=e.style,i=(0,a.Z)(e,d),s=(0,o.Z)((0,o.Z)({},n),{},{labelPlacement:(null===n||void 0===n?void 0:n.labelPlacement)||"start"});return(0,c.jsx)(p,{className:t,style:r,children:(0,c.jsx)(l.Z,(0,o.Z)({labelProps:s},i))})}u.propTypes=l.Z.propTypes,u.defaultProps=l.Z.defaultProps;var p=s.default.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},71320:function(e,n,t){t.r(n),t.d(n,{default:function(){return Pt}});var r=t(71171),i=t(33028),o=t(96234),a=t(59740),s=t(68079),l=t(5057),c=t(33518),d=t(55898),u=t.n(d),p=t(96181),f=t(6352),m=t.n(f),h=t(35432),x=t(39948),v=t(55402),Z=t(82275),g=t(96399),j=t(65688),b=t(37633),y=t(48037),k=t(92273),C=t(76720),w=t(15849),S=t(39075),L=t(94464),E=t(38242),P=t(80378),A=t(1722),_=t(32723),T=t(34795),O=t(43681),R=t.n(O),N=t(50482),I=t.n(N),B=t(96366),D=t(36554),F=t(29034),z=t(44919),U=t(67680),K=t(75239),W=t(28726),q=t(25710),G=t(18067),V=t(80578),M=t(76811),H=t(86229),Y=t(28641),J=t(44846),Q=t(13727),X=t(56184),$=t(74490),ee=t(51177),ne=t(19654),te=t(35406),re=t(11875),ie=t(95890),oe=t(96266),ae=["label","disabled","required","initialValue","onChange","style","onSubmit","triggers","options","formatterBeforeSubmit"],se={PaperProps:{style:{maxHeight:224,width:250}}},le=function(e,n,t){return{fontWeight:-1===n.indexOf(e)?t.typography.fontWeightRegular:t.typography.fontWeightMedium}};function ce(e){var n=e.label,t=e.disabled,r=e.required,s=e.initialValue,c=e.onChange,d=e.style,u=e.onSubmit,p=e.triggers,f=e.options,m=e.formatterBeforeSubmit,h=(0,a.Z)(e,ae),v=(0,B.Z)(),Z=(0,l.useState)(!1),g=(0,o.Z)(Z,2),j=g[0],b=g[1],y=(0,l.useState)(!1),k=(0,o.Z)(y,2),C=k[0],w=k[1],S=(0,l.useState)(s),L=(0,o.Z)(S,2),E=L[0],P=L[1],A=(0,l.useState)(E),O=(0,o.Z)(A,2),R=O[0],N=O[1],I=function(){var e=(0,T.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(R):R);case 4:!1===e.sent?N(E):(N(R),P(R)),e.next=11;break;case 8:e.prev=8,e.t0=e.catch(1),N(E);case 11:return e.prev=11,w(!1),b(!1),e.finish(11);case 15:case"end":return e.stop()}}),e,null,[[1,8,11,15]])})));return function(){return e.apply(this,arguments)}}(),D=j?(0,oe.jsx)(ee.Z,(0,i.Z)((0,i.Z)({value:R,onChange:function(e){var n=e.target.value;n="string"===typeof n?n.split(","):n,N(n),c(n)},fullWidth:!0,multiple:!0,variant:"outlined",margin:"dense",renderValue:function(e){return(0,oe.jsx)(x.Z,{sx:{display:"flex",flexWrap:"wrap"},children:e.filter((function(e){return f.some((function(n){return n.code===e}))})).map((function(e){return(0,oe.jsx)(ne.Z,{label:f.find((function(n){return n.code===e})).name,style:{marginRight:8},size:"small"},e)}))})},MenuProps:se},h),{},{children:f.map((function(e){return(0,oe.jsx)($.Z,{value:e.code,style:le(e.code,R,v),children:e.name},e.code)}))})):(0,oe.jsx)(x.Z,{px:1,className:"form-item-input slot",style:{whiteSpace:"pre-wrap"},children:R.filter((function(e){return f.some((function(n){return n.code===e}))})).map((function(e){return(0,oe.jsx)(ne.Z,{label:f.find((function(n){return n.code===e})).name,style:{marginRight:8},size:"small"},e)}))});return(0,oe.jsx)(re.Z,{className:"form",style:d,children:(0,oe.jsxs)(x.Z,{className:"form-item",children:[(0,oe.jsxs)(x.Z,{className:"form-item-label",children:[n,r&&(0,oe.jsx)(te.Z,{})]}),(0,oe.jsxs)(x.Z,{className:"form-item-body",children:[(0,oe.jsx)(x.Z,{className:"form-item-input",children:D}),(0,oe.jsx)(x.Z,{className:"form-item-action",children:j?(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsx)(U.Z,{"data-cy":"schema-form-item-confirm",onClick:I,disabled:t||C,size:"large",children:C?(0,oe.jsx)(J.Z,{size:24}):(0,oe.jsx)(X.Z,{})}),(0,oe.jsx)(U.Z,{"data-cy":"schema-form-item-cancel",onClick:function(){N(E),b(!1)},disabled:t||C,size:"large",children:(0,oe.jsx)(Q.default,{})})]}):(0,oe.jsx)(ie.Z,{triggers:p,onEnterEdit:function(){return b(!0)},disabled:t})})]})]})})}ce.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},ce.defaultProps={style:{},onSubmit:function(){},onChange:function(){},label:"",initialValue:"",required:!1,disabled:!1,triggers:[],options:[],formatterBeforeSubmit:function(e){return e.join(",")}};var de=t(58238),ue=t(14491),pe=t(54063),fe=t(63406),me=t(11593),he=t(11750),xe=t(47020),ve=t(70461),Ze=t(51233);function ge(e){var n=e.id,t=e.children,r=e.title,a=e.teamDid,s=(0,S.PE)().t,c=(0,de.h6)().api,d=(0,l.useState)(!1),u=(0,o.Z)(d,2),p=u[0],f=u[1],m=(0,l.useState)(null),h=(0,o.Z)(m,2),x=h[0],v=h[1],Z=function(){var e=(0,T.Z)((0,_.Z)().mark((function e(t){return(0,_.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!p){e.next=2;break}return e.abrupt("return");case 2:return f(!0),e.prev=3,e.next=6,c.addDomainAlias({input:{id:n,domainAlias:(0,Ze.sf)(t.domain),teamDid:a}});case 6:return e.next=8,(0,ue._v)(2e3);case 8:v(null);case 9:return e.prev=9,f(!1),e.finish(9);case 12:case"end":return e.stop()}}),e,null,[[3,,9,12]])})));return function(n){return e.apply(this,arguments)}}(),g=function(){var e=(0,T.Z)((0,_.Z)().mark((function e(n,t,r){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:e.next=8;break;case 5:e.prev=5,e.t0=e.catch(0),r((0,ue.Z)(e.t0));case 8:return e.prev=8,f(!1),e.finish(8);case 11:case"end":return e.stop()}}),e,null,[[0,5,8,11]])})));return function(n,t,r){return e.apply(this,arguments)}}(),j={title:r||s("router.domainAlias.add.title"),description:function(e,n,t){return(0,oe.jsx)(he.Z,{component:"div",children:(0,oe.jsx)(xe.Z,{label:s("router.domainAlias.add.domainDescription"),helperText:s("router.domainAlias.add.helperText"),autoComplete:"off",variant:"outlined",name:"domain","data-cy":"add-domain",fullWidth:!0,autoFocus:!0,inputProps:{"data-cy":"domain-name-input"},value:e.domain,style:{marginBottom:8},margin:"dense",onChange:function(r){var o=r.target.value.trim(),a=(0,Ze.ub)(o,s);n((0,i.Z)((0,i.Z)({},e),{},{domain:o,__disableConfirm:!!a})),t(a||"")},onKeyPress:function(n){if("Enter"===n.key){n.preventDefault();var r=n.target.value.trim(),i=(0,Ze.ub)(r,s);i?t(i):g(e,Z,t)}}})})},confirm:s("common.confirm"),cancel:s("common.cancel"),params:{domain:"",__disableConfirm:!0},onConfirm:Z,onCancel:function(){f(!1),v(null)}},b=function(e){e.stopPropagation(),v(j)};return(0,oe.jsxs)(oe.Fragment,{children:["function"===typeof t?t({loading:p,open:b}):(0,oe.jsxs)($.Z,{onClick:b,className:"rule-action","data-cy":"action-add-domain-alias",children:[p?(0,oe.jsx)(J.Z,{size:16}):(0,oe.jsx)(me.Z,{style:{fontSize:18,marginRight:5}}),s("router.domainAlias.add.title")]}),x&&(0,oe.jsx)(ve.Z,{title:x.title,description:x.description,confirm:x.confirm,cancel:x.cancel,params:x.params,onConfirm:x.onConfirm,onCancel:x.onCancel,color:"primary",loading:p})]})}ge.propTypes={id:u().string.isRequired,children:u().any,title:u().string,teamDid:u().string},ge.defaultProps={children:null,title:"",teamDid:""};var je=t(63405),be=t(46954),ye=t(44067),ke=t(27773),Ce=t(92726);function we(e){var n=(0,S.PE)().t,t=(0,l.useState)(!1),r=(0,o.Z)(t,2),i=r[0],a=r[1],s=(0,l.useState)(null),c=(0,o.Z)(s,2),d=c[0],u=c[1],p=e.id,f=e.domain,m=e.children,h=e.teamDid,x=(0,de.h6)().api,v=function(){var e=(0,T.Z)((0,_.Z)().mark((function e(){return(0,_.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a(!0),e.prev=1,e.next=4,x.deleteDomainAlias({input:{id:p,domainAlias:f,teamDid:h}});case 4:return e.next=6,(0,ue._v)(2e3);case 6:e.next=11;break;case 8:e.prev=8,e.t0=e.catch(1),H.Z.error(e.t0.message);case 11:return e.prev=11,u(null),a(!1),e.finish(11);case 15:case"end":return e.stop()}}),e,null,[[1,8,11,15]])})));return function(){return e.apply(this,arguments)}}(),Z={title:n("router.domainAlias.delete.title"),description:n("router.domainAlias.delete.description"),confirm:n("common.confirm"),onConfirm:v,onCancel:function(){a(!1),u(null)}},g=function(e){e.stopPropagation(),u(Z)};return(0,oe.jsxs)(oe.Fragment,{children:["function"===typeof m?m({loading:i,open:g}):(0,oe.jsxs)(W.Z,{edge:"end",onClick:g,size:"small",className:"rule-action",color:"error","data-cy":"action-delete-domain-alias",children:[i?(0,oe.jsx)(J.Z,{size:16}):(0,oe.jsx)(ke.default,{style:{fontSize:16}}),n("router.domainAlias.delete.title")]}),d&&(0,oe.jsx)(ve.Z,{title:d.title,description:d.description,confirm:d.confirm,params:d.params,onConfirm:d.onConfirm,onCancel:d.onCancel})]})}function Se(e){var n=e.site,t=e.domain,r=e.blocklet,i=(0,S.PE)().t,o=t.value===window.location.hostname;return(0,oe.jsx)(Ce.Z,{"data-cy":"domain-actions",actions:[function(e){var a,s=e.close;return(0,oe.jsx)(we,{id:n.id,domain:t.value,teamDid:null===r||void 0===r||null===(a=r.meta)||void 0===a?void 0:a.did,children:function(e){var n=e.open;return(0,oe.jsx)(K.Z,{title:o?i("blocklet.router.currentDomainTip"):"",children:(0,oe.jsx)("span",{children:(0,oe.jsxs)($.Z,{disabled:t.isProtected||o,dense:!0,onClick:function(e){s(),n(e)},"data-cy":"action-toggle-block",children:[(0,oe.jsx)(be.Z,{style:{minWidth:24,marginRight:8},children:(0,oe.jsx)(ke.default,{})}),(0,oe.jsx)(ye.Z,{primary:i("common.delete")})]},"remove")})})}})}]})}we.propTypes={id:u().string.isRequired,domain:u().string.isRequired,children:u().any,teamDid:u().string},we.defaultProps={children:null,teamDid:""},Se.propTypes={site:u().object.isRequired,domain:u().object.isRequired,blocklet:u().object.isRequired},Se.defaultProps={};var Le,Ee=t(31853),Pe=t(46999),Ae=t(73545),_e=t(29054);function Te(e){var n=e.initialValue,t=e.onChange,r=e.disabled,i=e.loading,a=(0,S.PE)().t,s=(0,Ae.T)().api,l=(0,_e.y0)().blocklet,c=(0,Ee.Z)({newAppSk:"",isConnectOpen:!1}),d=(0,o.Z)(c,2),u=d[0],p=d[1],f=function(){var e=(0,T.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,p({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 p({isConnectOpen:!1})},v=l.structVersion===h.APP_STRUCT_VERSION?[{key:"rotate-with-did-wallet",title:"Migrate with DID Wallet",handler:function(){(0,ue.An)(l.status)?H.Z.error(a("blocklet.error.isRunning")):(0,E.isInProgress)(l.status)?H.Z.error(a("blocklet.error.isInProgress")):p({isConnectOpen:!0})}}]:[];return[(0,oe.jsx)(Y.Z,{disabled:r,loading:i,initialValue:n,onSubmit:function(e){return p({newAppSk:e}),!1},triggers:v,secure:!0}),u.newAppSk&&(0,oe.jsx)(ve.Z,{title:a("blocklet.config.appSkTitle"),description:(0,oe.jsxs)(x.Z,{children:[(0,oe.jsx)(x.Z,{children:a("blocklet.config.appSkChangeTip")}),(0,oe.jsx)(x.Z,{fontWeight:"bold",mt:2,children:a("blocklet.config.appDidChangeTip")}),(0,oe.jsxs)(Oe,{children:[(0,oe.jsx)("li",{children:a("blocklet.config.appDidChangeTipL1")}),(0,oe.jsx)("li",{children:a("blocklet.config.appDidChangeTipL2")})]})]}),confirm:a("confirm"),cancel:a("cancel"),onConfirm:function(){return f(u.newAppSk)},onCancel:function(){return p({newAppSk:""})}}),(0,oe.jsx)(Pe.default,{popup:!0,open:u.isConnectOpen,forceConnected:!1,saveConnect:!1,action:"rotate-key-pair",checkFn:s.get,checkTimeout:3e5,onSuccess:m,extraParams:{appDid:l.appDid},messages:{title:a("setup.keyPair.title"),scan:a("setup.keyPair.scan"),confirm:a("setup.keyPair.confirm"),success:a("setup.keyPair.success")},onClose:m})]}Te.propTypes={initialValue:u().string,onChange:u().func,disabled:u().bool,loading:u().bool},Te.defaultProps={initialValue:"default",onChange:function(){},disabled:!1,loading:!1};var Oe=(0,c.default)("ul")(Le||(Le=(0,r.Z)(["\n padding-left: 16px;\n li {\n margin-top: 8px;\n list-style: disk;\n font-weight: bold;\n }\n"]))),Re=t(74511),Ne=t(88574),Ie=["domain","domainStatus"],Be=function(e){return["waiting","creating","renewaling"].includes(e)};function De(e){var n,t=(0,S.PE)().t,r=(0,l.useState)(!1),i=(0,o.Z)(r,2),a=i[0],s=i[1],c=(0,l.useState)(null),d=(0,o.Z)(c,2),u=d[0],p=d[1],f=e.domain,m=e.onAdd,h=e.children,x=e.did,v=(0,de.h6)(),Z=v.api,g=v.ws.useSubscription,j=(0,l.useState)(!1),b=(0,o.Z)(j,2),y=b[0],k=b[1],C=(0,_e.y0)().actions.refreshDomainStatus,w=(0,Re.Z)((0,T.Z)((0,_.Z)().mark((function e(){var n,t;return(0,_.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Z.findCertificateByDomain({input:{domain:f,did:x}});case 2:return n=e.sent,t=n.cert,e.abrupt("return",t);case 5:case"end":return e.stop()}}),e)})))),L=function(e,n){e.domain===f&&(k(!1),"success"===n?H.Z.success("The ".concat(e.domain," certificate is issued successfully")):"error"===n&&H.Z.error("Failed to issue certificate for ".concat(e.domain)))};if((0,l.useEffect)((function(){var e;!w.loading&&Be(null===(e=w.value)||void 0===e?void 0:e.status)&&k(!0)}),[w]),g(M.BlockletEvents.certError,(function(e){return L(e,"error")})),g(M.BlockletEvents.certIssued,(function(e){w.retry(),C(e.domain),L(e,"success")})),w.loading)return"";if("normal"===(null===(n=w.value)||void 0===n?void 0:n.status))return"";var E=function(){var e=(0,T.Z)((0,_.Z)().mark((function e(){return(0,_.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return s(!0),e.prev=1,e.next=4,Z.issueLetsEncryptCert({input:{domain:f,did:x}});case 4:m(),k(!0),e.next=12;break;case 8:e.prev=8,e.t0=e.catch(1),console.error(e.t0),k(!1);case 12:return e.prev=12,s(!1),p(null),e.finish(12);case 16:case"end":return e.stop()}}),e,null,[[1,8,12,16]])})));return function(){return e.apply(this,arguments)}}(),P={title:t("router.cert.genLetsEncryptCert.title"),description:(0,oe.jsxs)("div",{children:[(0,oe.jsx)(Ne.Z,{type:"success",children:t("router.cert.genLetsEncryptCert.dnsTip")}),t("router.cert.genLetsEncryptCert.description")]}),confirm:t("common.confirm"),onConfirm:E,onCancel:function(){s(!1),p(null)}};return(0,oe.jsxs)(oe.Fragment,{children:[y?(0,oe.jsx)(K.Z,{title:t("router.cert.issuing"),children:(0,oe.jsx)(J.Z,{size:12})}):h({loading:a,open:function(e){e.stopPropagation(),p(P)}}),u&&(0,oe.jsx)(ve.Z,{color:"primary",title:u.title,description:u.description,confirm:u.confirm,params:u.params,onConfirm:u.onConfirm,onCancel:u.onCancel})]})}function Fe(e){var n=e.domain,t=e.domainStatus,r=(0,a.Z)(e,Ie);return!(0,ue.rM)(n)||null!==t&&void 0!==t&&t.isHttps?"":(0,oe.jsx)(De,(0,i.Z)({domain:n},r))}De.propTypes={domain:u().string.isRequired,did:u().string.isRequired,onAdd:u().func,children:u().any},De.defaultProps={onAdd:function(){},children:null},Fe.propTypes={domain:u().string.isRequired,domainStatus:u().shape({isHttps:u().bool}).isRequired,did:u().string.isRequired,onAdd:u().func,children:u().any},Fe.defaultProps={onAdd:function(){},children:null};var ze,Ue=t(13128),Ke=t(55372),We=t(26174),qe=t(88092),Ge=t(50185),Ve=t(17425);function Me(e){var n=e.onCancel,t=e.onSuccess,r=e.onError,i=(0,l.useContext)(Ae.B).api,a=(0,l.useState)(!1),s=(0,o.Z)(a,2),c=s[0],d=s[1],u=(0,S.PE)(),p=u.t,f=u.locale,m=(0,l.useState)(""),h=(0,o.Z)(m,2),v=h[0],Z=h[1],g=(0,l.useState)(!1),j=(0,o.Z)(g,2),b=j[0],y=j[1],k=(0,l.useState)(0),C=(0,o.Z)(k,2),w=C[0],L=C[1],E=(0,l.useState)(""),P=(0,o.Z)(E,2),A=P[0],_=P[1],T=(0,Ve.DJ)().endpoint,O=(0,l.useState)(!1),R=(0,o.Z)(O,2),N=R[0],I=R[1],B=function(e){Z(null),d(!0);try{_(e.result),L(F.length-1)}catch(t){var n=(0,ue.Z)(t);Z(n),r(t)}finally{d(!1)}},D=function(){y(!1),L(0)},F=[{body:(0,oe.jsxs)(x.Z,{children:[(0,oe.jsx)(he.Z,{children:p("team.transferApp.transferDialog.tips.progress")}),(0,oe.jsx)(he.Z,{mt:3,mb:2,children:p("team.transferApp.transferDialog.tips.newOwnerPermissions")})]}),cancel:p("common.cancel"),confirm:p("team.transferApp.transferDialog.createTransferLink"),onCancel:n,onConfirm:function(){y(!0),L(1)}},{body:function(){return(0,oe.jsx)(Pe.default,{action:"transfer-app-owner",open:b,locale:f,checkFn:i.get,onClose:D,onSuccess:B,checkTimeout:3e5,extraParams:{},messages:{title:p("team.transferApp.connectDialog.title"),scan:p("team.transferApp.connectDialog.scan"),confirm:p("team.transferApp.connectDialog.confirm"),success:p("team.transferApp.connectDialog.success")},popup:!0})}},{body:function(){var e=(0,ue.VP)({transferId:A.transferId,endpoint:T});return(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsx)(x.Z,{component:Ye,dangerouslySetInnerHTML:{__html:p("team.transferApp.transferDialog.createSuccessTip1")}}),(0,oe.jsx)(x.Z,{component:Ye,mt:2,children:(0,oe.jsx)(Ye,{children:p("team.transferApp.transferDialog.createSuccessTip3")})}),(0,oe.jsxs)(x.Z,{children:[(0,oe.jsx)(x.Z,{component:Ye,mt:2,children:(0,oe.jsx)(Ye,{children:p("team.transferApp.transferDialog.createSuccessTip2",{expireDate:(0,ue.B2)(A.expireDate,f)})})}),(0,oe.jsx)(x.Z,{my:1,children:(0,oe.jsx)(Ge.Z,{children:e})})]}),(0,oe.jsx)("div",{children:(0,oe.jsx)(We.Z,{value:"end",control:(0,oe.jsx)(qe.Z,{checked:N,onChange:function(e){return I(e.target.checked)}}),label:p("team.transferApp.transferDialog.iKnow"),labelPlacement:"end"})})]})},confirm:p("common.confirm"),onConfirm:t}],z=F[w];return(0,oe.jsxs)(Ue.Z,{title:(0,oe.jsx)(Ye,{className:"title",children:p("team.transferApp.transferDialog.title")}),fullWidth:!0,open:!0,showCloseButton:!1,actions:(0,oe.jsxs)(oe.Fragment,{children:[z.cancel&&(0,oe.jsx)(W.Z,{onClick:z.onCancel,color:"inherit",children:z.cancel}),(0,oe.jsxs)(W.Z,{onClick:z.onConfirm,color:"error",disabled:c||w===F.length-1&&!N,variant:"contained",autoFocus:!0,children:[c&&(0,oe.jsx)(J.Z,{size:16}),z.confirm]})]}),children:[(0,oe.jsx)(Ke.Z,{component:"div",children:"function"===typeof z.body?z.body():z.body}),!!v&&(0,oe.jsx)(Ne.Z,{type:"error",variant:"icon",children:v})]})}Me.propTypes={onCancel:u().func.isRequired,onSuccess:u().func.isRequired,onError:u().func},Me.defaultProps={onError:function(){}};var He,Ye=c.default.div(ze||(ze=(0,r.Z)(["\n font-size: 16px;\n font-weight: bold;\n &.title {\n font-size: 20px;\n }\n"]))),Je=["blocklet","onUpdate","hasPermission"],Qe=Object.keys(M.SUPPORTED_LANGUAGES).map((function(e){return{code:e,name:M.SUPPORTED_LANGUAGES[e].nativeName}}));function Xe(e){var n,t=e.blocklet,r=e.onUpdate,s=e.hasPermission,c=(0,a.Z)(e,Je),d=(0,de.h6)(),u=(0,l.useContext)(S.RD).t,p=(0,l.useState)(""),f=(0,o.Z)(p,2),m=f[0],v=f[1],Z=(0,l.useState)(""),g=(0,o.Z)(Z,2),j=g[0],b=g[1],y=(0,l.useState)(!1),k=(0,o.Z)(y,2),C=k[0],w=k[1],L=(0,E.getWhoCanAccess)(t),P=null===t||void 0===t||null===(n=t.settings)||void 0===n?void 0:n.publicToStore,A=(0,B.Z)(),O=j||!s,N=d.inService,J=d.ws.useSubscription,Q=t.meta.did,X=t.site,$=(0,ue.oE)(null===X||void 0===X?void 0:X.domainAliases),ee=R()(t.meta,"capabilities.clusterMode",!1);if(J(h.EVENTS.NODE_RUNTIME_INFO,(function(e){ee&&v(R()(e,"cpu.physicalCores",""))})),(0,ue.wS)(t.status))return null;var ne=t.environments.find((function(e){return"BLOCKLET_DELETABLE"===e.key})),te=!ne||"yes"===ne.value,re=t.environments.find((function(e){return"BLOCKLET_APP_LANGUAGES"===e.key})),ie=t.environments.find((function(e){return"BLOCKLET_APP_URL"===e.key})),ae=t.environments.find((function(e){return"BLOCKLET_APP_LOGO_SQUARE"===e.key})),se=t.environments.find((function(e){return"BLOCKLET_APP_LOGO_RECT"===e.key})),le=t.environments.find((function(e){return"BLOCKLET_APP_LOGO_FAVICON"===e.key})),me=t.environments.find((function(e){return"BLOCKLET_APP_LOGO"===e.key})),he=[{key:M.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_NAME,description:u("blocklet.config.name"),value:t.environments.find((function(e){return"BLOCKLET_APP_NAME"===e.key})).value},{key:M.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_DESCRIPTION,description:u("blocklet.config.description"),value:t.environments.find((function(e){return"BLOCKLET_APP_DESCRIPTION"===e.key})).value},{key:M.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_URL,description:u("blocklet.config.appUrl"),value:ie?ie.value:""},{key:M.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_LOGO_SQUARE,description:u("blocklet.config.logoSquare"),value:ae?ae.value:""},{key:M.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_LOGO_RECT,description:u("blocklet.config.logoRect"),value:se?se.value:""},{key:M.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_LOGO_FAVICON,description:u("blocklet.config.logoFavicon"),value:le?le.value:""},{key:M.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_LOGO,description:u("blocklet.config.logo"),value:me?me.value:""}];if(ee){var xe=t.configs.find((function(e){return e.key===M.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_CLUSTER_SIZE})),ve=xe?xe.value:m;he.push({key:M.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_CLUSTER_SIZE,description:u("blocklet.config.clusterSize"),value:ve,cpuCores:m})}var Ze=function(){var e=(0,T.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(!j){e.next=2;break}return e.abrupt("return");case 2:return b(!0),e.prev=3,i=n.target.checked,e.next=7,d.api.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,b(!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)}}(),be=function(){var e=(0,T.Z)((0,_.Z)().mark((function e(n,i){var o,a,s,l;return(0,_.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n!==M.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_CLUSTER_SIZE){e.next=5;break}if(!(o=(0,ue.I)({value:i,cpuCores:m}))){e.next=5;break}return H.Z.error(o),e.abrupt("return");case 5:return a=[{key:n,value:i}],e.prev=6,b(!0),e.next=10,d.api.configBlocklet({input:{did:t.meta.did,configs:a}});case 10:s=e.sent,l=s.blocklet,r(l),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,b(!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)}}(),ye=function(){var e=(0,T.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(!j){e.next=2;break}return e.abrupt("return");case 2:return b(!0),e.prev=3,i=n.target.checked,e.next=7,d.api.configBlocklet({input:{did:t.meta.did,configs:[{key:M.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,b(!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)}}(),ke=function(){var e=(0,T.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=X.corsAllowedOrigins||[],i=n.split(",").map((function(e){return e.trim()})).filter(Boolean),!I()(r,i)){e.next=4;break}return e.abrupt("return",!1);case 4:return e.prev=4,b(!0),o=i.length?i:["__none__"],e.next=9,d.api.updateRoutingSite({input:{id:X.id,corsAllowedOrigins:o,teamDid:t.meta.did}});case 9:b(!1),e.next=17;break;case 12:return e.prev=12,e.t0=e.catch(4),H.Z.error(e.t0.message),b(!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)}}(),Ce=function(){var e=(0,T.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(!j){e.next=2;break}return e.abrupt("return");case 2:return b(!0),e.prev=3,e.next=6,d.api.configBlocklet({input:{did:t.meta.did,configs:[{key:M.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,b(!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)}}();return(0,oe.jsxs)(tn,(0,i.Z)((0,i.Z)({},c),{},{children:[he.map((function(e){return(0,oe.jsxs)(x.Z,{className:"config-form",mt:2,children:[(0,oe.jsx)(x.Z,{className:"config-label",fontSize:14,mb:0,children:e.description}),(0,oe.jsx)(Y.Z,{style:{marginTop:0},disabled:j||O,loading:j,initialValue:e.value,onSubmit:function(n){return be(e.key,n)}})]})})),(0,oe.jsx)(x.Z,{className:"config-form",children:"all"===L&&"registry"===t.source&&(0,oe.jsxs)(x.Z,{className:"config-item",children:[(0,oe.jsxs)(x.Z,{className:"config-label",children:[u("blocklet.config.access.publicToStore"),(0,oe.jsx)(x.Z,{className:"config-desc",children:u("blocklet.config.access.publicInstanceTip")})]}),(0,oe.jsx)(D.Z,{disabled:O,checked:P,defaultChecked:!0,onChange:Ze})]})}),(0,oe.jsx)(x.Z,{className:"config-form",component:F.Z,my:3}),(0,oe.jsxs)(x.Z,{className:"config-form",mt:2,children:[(0,oe.jsx)(x.Z,{className:"config-label",fontSize:14,mb:0,children:u("blocklet.config.languages")}),(0,oe.jsx)(ce,{style:{marginTop:0},disabled:j||O,loading:j,options:Qe,initialValue:re?re.value.split(","):["en","zh"],onSubmit:function(e){return be("BLOCKLET_APP_LANGUAGES",e)}})]}),(0,oe.jsx)(x.Z,{className:"config-form",component:F.Z,my:3}),(0,oe.jsxs)(x.Z,{className:"config-form",children:[(0,oe.jsxs)(x.Z,{display:"flex",justifyContent:"space-between",alignItems:"center",children:[(0,oe.jsx)("div",{className:"config-label",children:u("common.domain")}),(0,oe.jsx)(x.Z,{display:"flex",alignItems:"center",children:(0,oe.jsx)(ge,{id:X.id,title:u("router.domain.add.title"),teamDid:Q,children:function(e){var n=e.open;return(0,oe.jsxs)(W.Z,{style:{marginLeft:16},variant:"contained",color:"primary","data-cy":"add-domain-alias",onClick:n,disabled:(0,E.isInProgress)(t.status),children:[(0,oe.jsx)(z.Z,{style:{fontSize:"1.3em",marginRight:4}}),u("common.add")]})}})})]}),$.map((function(e,n){return(0,oe.jsxs)(x.Z,{display:"flex",alignItems:"center",justifyContent:"space-between",mt:n?0:1,children:[(0,oe.jsxs)(x.Z,{display:"flex",alignItems:"center",justifyContent:"space-between",children:[(0,oe.jsx)(je.Z,{domain:e,filters:["domain"]},"".concat(e.value,"-domain")),(0,oe.jsx)(x.Z,{ml:2,mr:.5,children:e.value}),(0,oe.jsx)(je.Z,{domain:e,filters:["http"]},"".concat(e.value,"-http")),(0,oe.jsx)("span",{style:{marginLeft:12}}),(0,oe.jsx)(Fe,{domain:e.value,domainStatus:e.domainStatus,did:t.meta.did,children:function(e){var n=e.open;return(0,oe.jsx)(W.Z,{size:"small",onClick:function(e){return n(e)},children:u("router.cert.genLetsEncryptCert.title")})}})]}),s&&!e.isProtected?(0,oe.jsx)(Se,{site:X,domain:e,blocklet:t}):(0,oe.jsx)(K.Z,{title:u("blocklet.router.domainLockTooltip"),placement:"top",children:(0,oe.jsx)(U.Z,{disabled:!0,size:"large",style:{pointerEvents:"auto",paddingTop:0,paddingBottom:0,margin:"12px 0"},children:(0,oe.jsx)(G.Z,{style:{fill:A.palette.text.disabled}})})})]},e.value)})),!$.length&&(0,oe.jsx)(x.Z,{mt:4,children:(0,oe.jsx)(q.Z,{children:u("common.empty")})})]}),(0,oe.jsx)(x.Z,{className:"config-form",component:F.Z,my:3}),(0,oe.jsx)(x.Z,{className:"config-form",mt:2,children:(0,oe.jsx)(x.Z,{className:"config-label",mb:0,children:u("common.security")})}),(0,oe.jsxs)(x.Z,{className:"config-form",mt:2,children:[(0,oe.jsx)(x.Z,{className:"config-label",fontSize:14,mb:0,children:u("router.domainSecurity.cors.title")}),(0,oe.jsx)(x.Z,{mb:1.5,className:"config-desc",children:u("router.domainSecurity.cors.description",{name:"the blocklet"})}),(0,oe.jsx)(Y.Z,{style:{marginTop:0},disabled:j||O,loading:j,initialValue:(X.corsAllowedOrigins||[]).join(", "),onSubmit:ke})]}),(0,oe.jsx)(x.Z,{className:"config-form",component:F.Z,my:3}),(0,oe.jsx)(x.Z,{mb:2,className:"config-label",fontSize:20,children:u("blocklet.config.dangerZone")}),(0,oe.jsxs)(x.Z,{px:2,py:1,sx:{border:"1px solid red",borderRadius:2},children:[(0,oe.jsx)(x.Z,{className:"config-form",mt:2,children:!N&&(0,oe.jsxs)(x.Z,{className:"config-item",children:[(0,oe.jsxs)(x.Z,{className:"config-label",children:[u("blocklet.config.deletable.name"),(0,oe.jsx)(x.Z,{className:"config-desc",children:u(te?"blocklet.config.deletable.disable":"blocklet.config.deletable.enable")})]}),(0,oe.jsx)(D.Z,{disabled:O,checked:!te,defaultChecked:!0,onChange:ye})]})}),(0,oe.jsxs)(x.Z,{className:"config-form",mt:2,children:[(0,oe.jsx)(x.Z,{className:"config-label",fontSize:14,mb:0,children:u("blocklet.config.sk")}),(0,oe.jsx)(Te,{disabled:j||O,loading:j,initialValue:t.environments.find((function(e){return"BLOCKLET_APP_SK"===e.key})).value,onChange:Ce})]}),N&&(0,oe.jsx)(fe.Z,{role:"owner",children:function(e){return(e||pe.C)&&(0,oe.jsxs)(x.Z,{className:"config-form",mt:2,children:[(0,oe.jsxs)(x.Z,{className:"config-item",children:[(0,oe.jsx)(x.Z,{className:"config-label",mb:0,children:u("team.transferApp.name")}),(0,oe.jsxs)(W.Z,{style:{flexShrink:0},variant:"contained",edge:"end",color:"error",size:"small","data-cy":"transfer-app",onClick:function(){return w(!0)},children:[(0,oe.jsx)(V.Z,{style:{fontSize:"1.3em",marginRight:4}}),u("team.transferApp.name")]})]}),C&&(0,oe.jsx)(Me,{onCancel:function(){return w(!1)},onSuccess:function(){return w(!1)}})]})}})]})]}))}var $e=(0,fe.V)(Xe,"mutate_blocklets"),en=(0,fe.V)(Xe,"",ue.Wf);function nn(e){return(0,de.h6)().inService?(0,oe.jsx)(en,(0,i.Z)({},e)):(0,oe.jsx)($e,(0,i.Z)({},e))}Xe.propTypes={blocklet:u().object.isRequired,onUpdate:u().func,hasPermission:u().bool},Xe.defaultProps={onUpdate:function(){},hasPermission:!1};var tn=c.default.div(He||(He=(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 max-height: 60vh;\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"])),(function(e){return e.theme.breakpoints.down("md")})),rn=t(93066),on=t(80576),an=t(56556),sn=t(8708),ln=t.n(sn),cn=t(99360),dn=t(95550),un=t(766),pn=t.n(un),fn=t(24529),mn=t.n(fn),hn=t(16727),xn=t.n(hn),vn={enabled:!1,secure:!1,from:"",host:"",port:"",user:"",password:""};var Zn=function(){var e,n,t,r=(0,de.h6)().api,o=(0,_e.y0)().blocklet,a=(0,S.PE)().t,s=null===o||void 0===o||null===(e=o.meta)||void 0===e?void 0:e.did,l=Object.assign((0,i.Z)({},vn),(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,dn.cI)({defaultValues:ln()(l,Object.keys(vn))}),d=c.handleSubmit,u=c.control,p=c.formState,f=c.watch,m=c.reset,h=f("enabled"),v=(0,cn.Z)(function(){var e=(0,T.Z)((0,_.Z)().mark((function e(n){var t,o,l,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:s,notification:JSON.stringify({email:n})}});case 3:l=e.sent,c=l.blocklet,d=Object.assign((0,i.Z)({},vn),(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)}}()),Z=(0,cn.Z)((function(e){var n=null===e||void 0===e?void 0:e.trim();return n?!!pn()(n)||a("notification.email.fromInvalid"):a("notification.email.fromRequired")})),g=(0,cn.Z)((function(e){var n=null===e||void 0===e?void 0:e.trim();return n?!!mn()(n,{require_host:!1,protocols:[]})||a("notification.email.hostInvalid"):a("notification.email.hostRequired")})),j=(0,cn.Z)((function(e){return e?!!xn()(e)||a("notification.email.portInvalid"):a("notification.email.portRequired")})),b=(0,cn.Z)((function(e){return!(null===e||void 0===e||!e.trim())||a("notification.email.userRequired")})),y=(0,cn.Z)((function(e){return!(null===e||void 0===e||!e.trim())||a("notification.email.passwordRequired")})),k=(0,cn.Z)((function(){return!0}));return(0,oe.jsx)(x.Z,{children:(0,oe.jsxs)("form",{onSubmit:d(v),disabled:!0,children:[(0,oe.jsx)(dn.Qr,{name:"enabled",control:u,render:function(e){var n=e.field;return(0,oe.jsx)(We.Z,{control:(0,oe.jsx)(D.Z,(0,i.Z)({checked:n.value},n)),label:a("notification.email.enable"),sx:{marginBottom:"8px"}})}}),(0,oe.jsx)(dn.Qr,{name:"from",control:u,rules:{validate:h?Z:k},render:function(e){var n,t=e.field;return(0,oe.jsx)(on.Z,{fullWidth:!0,children:(0,oe.jsx)(xe.Z,(0,i.Z)((0,i.Z)({},t),{},{label:a("notification.email.from"),error:!!p.errors[t.name],helperText:(null===(n=p.errors[t.name])||void 0===n?void 0:n.message)||"\u3000",disabled:!h}))})}}),(0,oe.jsx)(dn.Qr,{name:"host",control:u,rules:{validate:h?g:k},render:function(e){var n,t=e.field;return(0,oe.jsx)(on.Z,{fullWidth:!0,children:(0,oe.jsx)(xe.Z,(0,i.Z)((0,i.Z)({},t),{},{error:!!p.errors[t.name],label:a("notification.email.host"),helperText:(null===(n=p.errors[t.name])||void 0===n?void 0:n.message)||"\u3000",disabled:!h}))})}}),(0,oe.jsx)(dn.Qr,{name:"port",control:u,rules:{validate:h?j:k},render:function(e){var n,t=e.field;return(0,oe.jsx)(on.Z,{fullWidth:!0,children:(0,oe.jsx)(xe.Z,(0,i.Z)((0,i.Z)({},t),{},{type:"number",error:!!p.errors[t.name],label:a("notification.email.port"),helperText:(null===(n=p.errors[t.name])||void 0===n?void 0:n.message)||"\u3000",disabled:!h}))})}}),(0,oe.jsx)(dn.Qr,{name:"user",control:u,rules:{validate:h?b:k},render:function(e){var n,t=e.field;return(0,oe.jsx)(on.Z,{fullWidth:!0,children:(0,oe.jsx)(xe.Z,(0,i.Z)((0,i.Z)({},t),{},{error:!!p.errors[t.name],label:a("notification.email.user"),helperText:(null===(n=p.errors[t.name])||void 0===n?void 0:n.message)||"\u3000",disabled:!h}))})}}),(0,oe.jsx)(dn.Qr,{name:"password",control:u,rules:{validate:h?y:k},render:function(e){var n,t=e.field;return(0,oe.jsx)(on.Z,{fullWidth:!0,children:(0,oe.jsx)(xe.Z,(0,i.Z)((0,i.Z)({},t),{},{type:"password",error:!!p.errors[t.name],label:a("notification.email.password"),helperText:(null===(n=p.errors[t.name])||void 0===n?void 0:n.message)||"\u3000",disabled:!h}))})}}),(0,oe.jsx)(dn.Qr,{name:"secure",control:u,rules:{validate:k},render:function(e){var n=e.field;return(0,oe.jsx)(on.Z,{fullWidth:!0,children:(0,oe.jsx)(We.Z,{control:(0,oe.jsx)(D.Z,(0,i.Z)((0,i.Z)({checked:n.value},n),{},{disabled:!h})),label:a("notification.email.secure"),style:{marginBottom:16}})})}}),(0,oe.jsx)(an.Z,{type:"submit",variant:"contained",onSubmit:d(v),disabled:!p.isDirty,children:a("oauth.save")})]})})},gn=[{label:(0,oe.jsx)(x.Z,{textAlign:"center",width:"100%",children:"Email"}),value:"email"},{label:(0,oe.jsx)(x.Z,{textAlign:"center",width:"100%",children:"More"}),value:"more"}];var jn,bn,yn=function(){var e=(0,l.useState)(gn[0].value),n=(0,o.Z)(e,2),t=n[0],r=n[1],i=(0,l.useContext)(S.RD).t,a=(0,rn.Z)((function(){return{email:(0,oe.jsx)(Zn,{}),more:(0,oe.jsx)(x.Z,{children:(0,oe.jsx)(q.Z,{children:i("notification.comingSoon")})})}}),[i]);return(0,oe.jsxs)(x.Z,{children:[(0,oe.jsx)(L.Z,{tabs:gn,current:t,onChange:r}),(0,oe.jsx)(x.Z,{marginTop:"10px",children:a[t]})]})},kn=t(48342),Cn=t(94552),wn=t(24558),Sn=t(74286),Ln=t(76667),En=t(70648),Pn=t(7664),An=t(44123),_n=t(53906),Tn=[{value:h.WHO_CAN_ACCESS.ALL,icon:_n.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:h.WHO_CAN_ACCESS.INVITED,icon:An.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:h.WHO_CAN_ACCESS.OWNER,icon:Pn.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"}}],On="roles",Rn=[].concat((0,s.Z)(Tn),[{value:On,icon:En.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"}}]),Nn=function(e,n){if(e&&e.startsWith(h.WHO_CAN_ACCESS_PREFIX_ROLES)){var t=(0,E.getRolesFromAuthConfig)({whoCanAccess:e}),r=n.filter((function(e){return t.includes(e.name)}));return{access:On,roles:r}}return{access:e,roles:[]}},In=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===M.BLOCKLET_CONFIGURABLE_KEY.COMPONENT_ACCESS_WHO}));if(i)return Nn(i.value,r);if(n&&R()(n,"settings.whoCanAccess")&&R()(n,"settings.whoCanAccess")!==h.WHO_CAN_ACCESS.ALL)return Nn(R()(n,"settings.whoCanAccess"),r);var o=(0,E.findServiceFromMeta)(e.meta,h.NODE_SERVICES.AUTH);return R()(o,"config.whoCanAccess")?Nn(o.config.whoCanAccess,r):{access:h.WHO_CAN_ACCESS.ALL,roles:[]}};function Bn(e){var n=e.blocklet,t=e.ancestors,r=e.children,i=(0,B.Z)(),a=(0,l.useState)(""),c=(0,o.Z)(a,2),d=c[0],u=c[1],p=(0,S.PE)(),f=p.t,m=p.locale,v=(0,de.h6)().api,Z=(0,Ve.DJ)().roles,g=(0,l.useState)(""),j=(0,o.Z)(g,2),b=j[0],y=j[1],k=t[0]||n,C=In(n,k,{roles:Z}),w=C.access,L=C.roles,P=(0,l.useState)(w),A=(0,o.Z)(P,2),O=A[0],R=A[1],N=(0,l.useState)(L),I=(0,o.Z)(N,2),D=I[0],F=I[1],z=[].concat((0,s.Z)(t.map((function(e){return e.meta.did}))),[n.meta.did]),K={marginRight:4,fontSize:18,verticalAlign:"text-bottom",color:i.palette.text.secondary},q=t.concat(n).map((function(e){return(0,E.getDisplayName)(e,!0)})).join(" / ");if((0,ue.wS)(n.status))return null;if("unknown"===n.status&&(0,ue.wS)(n.status))return null;var G=function(){u(!1)},V=function(e){e.stopPropagation(),u(!0)},M=function(){var e=(0,T.Z)((0,_.Z)().mark((function e(){var n;return(0,_.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!b){e.next=2;break}return e.abrupt("return");case 2:return y(!0),e.prev=3,(n=O)===On&&(n="".concat(h.WHO_CAN_ACCESS_PREFIX_ROLES).concat(D.map((function(e){return e.name})).join(","))),e.next=8,v.updateWhoCanAccess({input:{did:z,whoCanAccess:n}});case 8:H.Z.success(f("blocklet.config.access.updatedTip")),G(),y(!1),e.next=17;break;case 13:e.prev=13,e.t0=e.catch(3),y(!1),H.Z.error((0,ue.Z)(e.t0));case 17:case"end":return e.stop()}}),e,null,[[3,13]])})));return function(){return e.apply(this,arguments)}}(),Y=b||O===On&&!D.length;return["function"===typeof r?r({open:V}):(0,oe.jsx)(U.Z,{onClick:V,"data-cy":"action-config-component",children:(0,oe.jsx)(Ln.default,{})}),d&&(0,oe.jsxs)(Fn,{open:!0,fullWidth:!0,title:q,onClose:G,PaperProps:{style:{minHeight:"auto"}},actions:(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsx)(W.Z,{onClick:G,color:"inherit","data-cy":"config-access-cancel",children:f("common.cancel")}),(0,oe.jsxs)(W.Z,{onClick:M,color:"primary",disabled:Y,variant:"contained",autoFocus:!0,"data-cy":"config-access-confirm",children:[b&&(0,oe.jsx)(J.Z,{size:16}),f("common.confirm")]})]}),children:[(0,oe.jsx)(x.Z,{mt:4,mb:3,children:(0,oe.jsx)(xe.Z,{label:f("blocklet.config.access.description"),select:!0,fullWidth:!0,value:O,onChange:function(e){var n=e.target.value;R(n)},"data-cy":"config-access-select",SelectProps:{renderValue:function(e){var n=Rn.find((function(n){return n.value===e}));return n?(0,oe.jsxs)(x.Z,{children:[(0,oe.jsx)(n.icon,{style:K}),n.title[m]]}):null}},children:Rn.map((function(e){return(0,oe.jsxs)(zn,{value:e.value,sx:{display:"block"},"data-cy":"config-access-opt-".concat(e.value),children:[(0,oe.jsxs)(x.Z,{display:"flex",alignItems:"center",children:[(0,oe.jsx)(e.icon,{style:K}),(0,oe.jsx)(x.Z,{children:e.title[m]})]}),(0,oe.jsx)(x.Z,{children:(0,oe.jsx)(x.Z,{className:"tip",children:e.description[m]})})]})}))})}),O===On&&(0,oe.jsx)(x.Z,{mt:4,mb:3,children:(0,oe.jsx)(xe.Z,{label:f("blocklet.config.access.description"),select:!0,fullWidth:!0,value:D.map((function(e){return e.name})),onChange:function(e){F(Z.filter((function(n){return(e.target.value||[]).includes(n.name)})))},SelectProps:{multiple:!0,renderValue:function(e){return(0,oe.jsx)(x.Z,{sx:{display:"flex",flexWrap:"wrap",gap:.5},children:e.map((function(e){var n=Z.find((function(n){return n.name===e}));return(0,oe.jsx)(ne.Z,{label:n.title},n.text)}))})}},children:Z.map((function(e){var n=e.name,t=e.title;return(0,oe.jsxs)($.Z,{value:n,children:[(0,oe.jsx)(qe.Z,{checked:D.some((function(e){return e.name===n}))}),(0,oe.jsx)(ye.Z,{primary:t})]},n)}))})})]})]}Bn.propTypes={blocklet:u().object.isRequired,ancestors:u().array,children:u().any},Bn.defaultProps={ancestors:[],children:null};var Dn,Fn=(0,c.default)(Ue.Z)(jn||(jn=(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"]))),zn=(0,c.default)($.Z)(bn||(bn=(0,r.Z)(["\n .tip {\n font-size: 12px;\n color: ",";\n }\n"])),(function(e){return e.theme.palette.text.secondary}));function Un(e){var n,t,r=e.blocklet,i=e.ancestors,a=e.depth,c=(0,B.Z)(),d=(0,S.PE)(),u=d.t,p=d.locale,f=(0,Ve.DJ)().roles,m=(0,l.useState)(!0),h=(0,o.Z)(m,2),v=h[0],Z=h[1],g=(0,_e.y0)().recommendedDomain,j=i[0]||r,b="/".concat(i.map((function(e){return e.mountPoint||"/"})).join("/"),"/").concat(r.mountPoint||"/").replace(/\/+/g,"/"),y=(0,ue.vH)({blocklet:j,domain:{value:g},mountPoint:b,params:(0,ue.f0)(j,p)}),w={fill:c.palette.text.secondary},L=a>0&&r.children.length>0,A=(0,oe.jsx)(U.Z,{size:"small",children:v?(0,oe.jsx)(C.Z,{fontSize:"inherit"}):(0,oe.jsx)(k.default,{fontSize:"inherit"})}),_=In(r,j,{roles:f}),T=_.access,O=_.roles;if("roles"!==T)t=Tn.find((function(e){return e.value===T}))||Tn[2];else{var R=O.map((function(e){return e.title})).join("/");t={title:{zh:"\u53ea\u6709 ".concat(R," \u53ef\u4ee5\u8bbf\u95ee"),en:"Only ".concat(R," can access")}}}return[(a>0||"gateway"!==r.meta.group)&&(0,oe.jsxs)(x.Z,{display:"flex",py:2,className:"component-item",justifyContent:"space-between",alignItems:"center",children:[(0,oe.jsxs)(x.Z,{pl:Math.max(2*(a-1),0),width:{xs:300,md:400},display:"flex",alignItems:"center",style:{cursor:L?"pointer":"cursor"},onClick:function(){return L&&Z(!v)},children:[L?A:(0,oe.jsx)(x.Z,{width:28}),(0,oe.jsx)(P.Z,{blocklet:r,ancestors:i}),(0,oe.jsxs)(x.Z,{ml:"16px",children:[(0,oe.jsx)(x.Z,{style:{color:"#222",fontSize:18},children:(0,E.getDisplayName)(r,!0)}),(0,oe.jsx)(x.Z,{display:"flex",alignItems:"center",children:(0,oe.jsx)(x.Z,{color:"text.secondary",children:t.title[p]})})]})]},r),(0,oe.jsxs)(x.Z,{children:[(0,oe.jsx)(K.Z,{title:u("common.visit"),children:(0,oe.jsx)("a",{target:"_blank",href:y,rel:"noopener noreferrer",title:y,children:(0,oe.jsx)(U.Z,{children:(0,oe.jsx)(Cn.Z,{})})})}),(0,oe.jsx)(Bn,{blocklet:r,ancestors:i,children:function(e){var n=e.open;return(0,oe.jsx)(K.Z,{title:u("common.edit"),children:(0,oe.jsx)(U.Z,{onClick:n,"data-cy":"btn-edit-".concat(r.meta.did),children:(0,oe.jsx)(wn.Z,{style:w})})})}})]},"actions")]},"group-not-gateway-box"),(0,oe.jsx)(Sn.Z,{depth:a}),null!==(n=r.children)&&void 0!==n&&n.length?(0,oe.jsx)(kn.Z,{in:v,children:r.children.map((function(e){return(0,oe.jsx)(Un,{blocklet:e,ancestors:[].concat((0,s.Z)(i),[r]),depth:a+1},"".concat(a+1,"-").concat(e.meta.did))}))},"blocklet-collapse"):null]}function Kn(){var e=(0,S.PE)().t,n=(0,_e.y0)().blocklet,t=(0,s.Z)(n.children)||[];return"gateway"!==n.meta.group&&t.unshift(n),(0,oe.jsx)(Wn,{component:"div",children:t&&t.length?[(0,oe.jsx)(x.Z,{mt:2,ml:{xs:"-12px",md:"-24px"},style:{maxWidth:1080},children:(0,oe.jsx)(Un,{blocklet:n},"0-".concat(n.meta.did))},"top-blocklet-".concat(n.meta.did))]:(0,oe.jsx)(x.Z,{mt:8,children:(0,oe.jsx)(q.Z,{children:e("blocklet.component.noComponent")})})})}Un.propTypes={blocklet:u().object.isRequired,ancestors:u().array,depth:u().number},Un.defaultProps={ancestors:[],depth:0},Kn.propTypes={};var Wn=(0,c.default)(x.Z)(Dn||(Dn=(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)})),qn=t(44784);var Gn=function(){var e,n,t,r=(0,de.h6)().api,o=(0,_e.y0)().blocklet,a=(0,S.PE)().t,s=null===o||void 0===o||null===(e=o.meta)||void 0===e?void 0:e.did,l=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,dn.cI)({defaultValues:ln()(l,["domain","clientId","enabled"])}),d=c.handleSubmit,u=c.control,p=c.formState,f=c.watch,m=c.reset,h=f("enabled"),v=(0,cn.Z)(function(){var e=(0,T.Z)((0,_.Z)().mark((function e(n){var t,i,o,l,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:s,oauth:JSON.stringify({auth0:n})}});case 3:o=e.sent,l=o.blocklet,c=Object.assign({enabled:!1,domain:"",clientId:""},(null===l||void 0===l||null===(t=l.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)}}()),Z=(0,cn.Z)((function(e){return!(null===e||void 0===e||!e.trim())||a("oauth.auth0.domainDescribe")})),g=(0,cn.Z)((function(e){return!(null===e||void 0===e||!e.trim())||a("oauth.auth0.clientIdDescribe")})),j=(0,cn.Z)((function(){return!0}));return(0,oe.jsx)(x.Z,{children:(0,oe.jsxs)("form",{onSubmit:d(v),disabled:!0,children:[(0,oe.jsx)(dn.Qr,{name:"enabled",control:u,render:function(e){var n=e.field;return(0,oe.jsx)(We.Z,{control:(0,oe.jsx)(qn.Z,(0,i.Z)({checked:n.value,style:{marginRight:"6px"}},n)),label:a("oauth.auth0.enable"),sx:{marginBottom:2,ml:1}})}}),(0,oe.jsx)(dn.Qr,{name:"domain",control:u,rules:{validate:h?Z:j},render:function(e){var n,t=e.field;return(0,oe.jsx)(on.Z,{fullWidth:!0,children:(0,oe.jsx)(xe.Z,(0,i.Z)((0,i.Z)({},t),{},{label:a("oauth.auth0.domain"),error:!!p.errors[t.name],helperText:(null===(n=p.errors[t.name])||void 0===n?void 0:n.message)||"\u3000",disabled:!h}))})}}),(0,oe.jsx)(dn.Qr,{name:"clientId",control:u,rules:{validate:h?g:j},render:function(e){var n,t=e.field;return(0,oe.jsx)(on.Z,{fullWidth:!0,children:(0,oe.jsx)(xe.Z,(0,i.Z)((0,i.Z)({},t),{},{error:!!p.errors[t.name],label:a("oauth.auth0.clientId"),helperText:(null===(n=p.errors[t.name])||void 0===n?void 0:n.message)||"\u3000",disabled:!h}))})}}),(0,oe.jsx)(an.Z,{type:"submit",variant:"contained",onSubmit:d(v),disabled:!p.isDirty,children:a("oauth.save")})]})})},Vn=t(77150),Mn=t(24103),Hn={ttl:604800};function Yn(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 Jn(){var e,n,t=(0,de.h6)().api,r=(0,_e.y0)().blocklet,o=null===r||void 0===r||null===(e=r.meta)||void 0===e?void 0:e.did,a=Object.assign({},Hn,(null===r||void 0===r||null===(n=r.settings)||void 0===n?void 0:n.session)||{}),s=(0,dn.cI)({defaultValues:ln()(Yn(a),["ttl"])}),l=s.handleSubmit,c=s.control,d=s.formState,u=s.reset,p=(0,S.PE)().t,f=(0,cn.Z)(function(){var e=(0,T.Z)((0,_.Z)().mark((function e(n){var r,i,a,s;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:Yn(n,!0)}});case 3:i=e.sent,a=i.blocklet,s=Object.assign({},Hn,ln()((null===a||void 0===a||null===(r=a.settings)||void 0===r?void 0:r.session)||{},["ttl"])),u(Yn(s)),H.Z.success(p("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,oe.jsx)(x.Z,{children:(0,oe.jsxs)("form",{onSubmit:l(f),disabled:!0,children:[(0,oe.jsx)(dn.Qr,{name:"ttl",control:c,render:function(e){var n=e.field;return(0,oe.jsx)(on.Z,{fullWidth:!0,sx:{mb:2},children:(0,oe.jsxs)(Mn.Z,{px:3,children:[(0,oe.jsx)(x.Z,{mx:-3,my:.5,children:p("blocklet.config.session.ttl",{day:n.value})}),(0,oe.jsx)(Vn.ZP,(0,i.Z)((0,i.Z)({},n),{},{defaultValue:7,step:1,marks:[{value:1,label:p("blocklet.config.session.day",{day:1})},{value:7,label:p("blocklet.config.session.days",{day:7})},{value:14,label:p("blocklet.config.session.days",{day:14})},{value:21,label:p("blocklet.config.session.days",{day:21})},{value:30,label:p("blocklet.config.session.days",{day:30})}],min:1,max:30,valueLabelDisplay:"auto",style:{maxWidth:"360px"}}))]})})}}),(0,oe.jsx)(an.Z,{type:"submit",variant:"contained",onSubmit:l(f),disabled:!d.isDirty,children:p("oauth.save")})]})})}var Qn=t(3267),Xn=t(30333),$n=t(75760),et=t(97038),nt=t(12673),tt=t(92706),rt=t.n(tt),it=(0,l.forwardRef)((function(e,n){var t=(0,l.useContext)(S.RD).t,r=(0,nt.Z)({show:!1,title:"",content:"",onConfirm:rt(),onCancel:rt()}),i=(0,cn.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||rt(),r.onCancel=e.onCancel||rt()})),o=(0,cn.Z)((function(){r.title="",r.content="",r.onConfirm=rt(),r.onCancel=rt()})),a=(0,cn.Z)((function(){r.show=!1,setTimeout((function(){o()}),300)})),s=(0,cn.Z)((function(){a(),null===r||void 0===r||r.onCancel()}),[]),c=(0,cn.Z)((function(){null===r||void 0===r||r.onConfirm(a)}),[]);return(0,l.useImperativeHandle)(n,(function(){return{open:i,close:a}}),[i,a]),(0,oe.jsx)(Ue.I,{open:r.show,title:r.title,onConfirm:c,onCancel:s,confirmButton:{text:t("common.confirm"),props:{variant:"contained",color:"primary"}},cancelButton:{text:t("common.cancel"),props:{variant:"outlined",color:"primary"}},children:r.content})}));var ot=t(64886),at=t(42080),st=t.n(at),lt=t(75506),ct=t.n(lt),dt=t(47685),ut=t(13260),pt=(0,l.forwardRef)((function(e,n){var t,r,i=(0,l.useContext)(S.RD).t,o=(0,_e.y0)().blocklet,a=(0,de.h6)().api,s=(0,nt.Z)({mode:"view",show:!1,data:{},callback:rt()}),c=(0,dt.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,cn.Z)((function(){s.mode="view",s.data={},s.callback=rt()}),[]),p=(0,cn.Z)((function(){s.show=!1,setTimeout((function(){u()}),d)}),[]),f=(0,cn.Z)((function(e){s.mode="view",s.show=!0,s.data=e}),[]),m=(0,cn.Z)((function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:rt();s.mode="approve",s.show=!0,s.data=e,s.callback=n}),[]);(0,l.useImperativeHandle)(n,(function(){return{open:f,close:p,approve:m}}),[f,p,m]);var h=(0,rn.Z)((function(){s.data.migratedFrom=[s.data.appId,s.data.appPid];var e=["appName","appLogo","appId","appPid","migratedFrom","appDescription","appUrl","version","appliedAt","status","serverId","serverVersion"];return!1!==s.data.isMaster&&st()(e,"appliedAt","status"),e.map((function(e){var n=i("federated.info.".concat(e)),t=s.data[e];("appName"===e&&s.data.isMaster&&(t=(0,oe.jsxs)(x.Z,{children:[(0,oe.jsx)(Qn.Z,{component:Xn.Z}),t]})),["appId","appPid","serverId"].includes(e)&&(t=(0,oe.jsx)(ut.kL,{children:t})),["appUrl"].includes(e)&&(t=(0,oe.jsx)(x.Z,{component:"a",href:t,target:"_blank",children:t})),["appLogo"].includes(e)&&(t=(0,oe.jsx)("img",{src:"".concat(s.data.appUrl,"/").concat(t),width:"60",height:"60",alt:s.data.appName})),"status"===e&&(t=t&&i("federated.status.".concat(t))),"migratedFrom"===e)&&(t=(s.data.migratedFrom||[]).filter((function(e){return![s.data.appId,s.data.appPid].includes(e)})).map((function(e){return(0,oe.jsx)(ut.kL,{children:e})})));return ct()(t)&&(t="-"),{name:n,value:t}}))}),[s.data]),v="approve"===s.mode,Z=(0,cn.Z)((0,T.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:s.data.appPid,did:o.appPid,status:"rejected"}});case 2:p(),null===s||void 0===s||s.callback(!1);case 4:case"end":return e.stop()}}),e)})))),g=(0,cn.Z)((0,T.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:s.data.appPid,did:o.appPid,status:"approved"}});case 2:p(),null===s||void 0===s||s.callback(!0);case 4:case"end":return e.stop()}}),e)}))));return(0,oe.jsx)(Ue.Z,{open:s.show,title:i(v?"federated.approveToJoinLogin":"federated.siteDetail"),onClose:p,actions:v?(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsx)(an.Z,{color:"error",variant:"contained",onClick:Z,children:i("common.reject")}),(0,oe.jsx)(an.Z,{variant:"contained",onClick:g,children:i("common.approve")})]}):(0,oe.jsx)(an.Z,{variant:"outlined",onClick:p,children:i("common.close")}),children:h.map((function(e){return(0,oe.jsx)(ot.Z,{style:{alignItems:"flex-start"},valueComponent:"div",nameWidth:180,name:e.name,children:e.value},e.name)}))})})),ft=pt,mt=t(79842),ht=t(85408),xt=t.n(ht),vt=(0,l.forwardRef)((function(e,n){var t,r,i=(0,dt.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,l.useContext)(S.RD).t,s=(0,nt.Z)({show:!1,data:{link:""}}),c=(0,cn.Z)((function(){s.data.link=""}),[]),d=(0,cn.Z)((function(){s.show=!1,setTimeout((function(){c()}),o)}),[]),u=(0,cn.Z)((function(e){var n=e.link;s.show=!0,s.data.link=n}),[]);(0,l.useImperativeHandle)(n,(function(){return{open:u,close:d}}),[u,d]);var p=(0,cn.Z)((function(){xt()(s.data.link),d()}),[d]);return(0,oe.jsxs)(Ue.Z,{open:s.show,title:a("federated.joinFederatedLogin"),onClose:d,PaperProps:{style:{minHeight:"unset"}},actions:(0,oe.jsx)(W.Z,{color:"primary",autoFocus:!0,variant:"contained",onClick:p,children:a("common.copyAndClose")}),children:[(0,oe.jsx)(x.Z,{mb:1,children:a("federated.inviteJoinFederatedLoginDescription")}),(0,oe.jsx)(x.Z,{sx:{"& .copy-button":{display:"none !important"}},children:(0,oe.jsx)(mt.Z,{language:"shell",style:{marginBottom:0},children:s.data.link})})]})}));function Zt(e){var n,t,r,i,a,s=e.mode,c=(0,l.useRef)(null),d=(0,l.useRef)(null),u=(0,l.useContext)(S.RD),p=u.t,f=u.locale,m=(0,_e.y0)(),h=m.blocklet,v=m.actions.refreshBlocklet,Z=function(){var e=(0,l.useRef)(null),n=(0,cn.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,cn.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,oe.jsx)(it,{ref:e}),confirmApi:r}}(),g=Z.confirmApi,j=Z.confirmHolder,b=(0,de.h6)().api,y=(null===(n=h.settings.federated)||void 0===n?void 0:n.sites)||[],k=(null===(t=h.settings.federated)||void 0===t?void 0:t.config)||{autoLogin:!1},C=!1!==k.isMaster,w=(0,cn.Z)((function(e){var n;null===(n=d.current)||void 0===n||n.open(e)})),L=(0,cn.Z)((function(e){var n;null===(n=d.current)||void 0===n||n.approve(e,v)})),E=(0,cn.Z)((function(e){g.open({title:p("federated.disableFederatedLogin"),content:p("federated.disableFederatedLoginDescription"),onConfirm:function(n){return(0,T.Z)((0,_.Z)().mark((function t(){return(0,_.Z)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,b.auditFederatedLogin({input:{memberPid:e.appPid,did:h.appPid,status:"revoked"}});case 2:n();case 3:case"end":return t.stop()}}),t)})))()}})})),P=(0,cn.Z)((function(e){g.open({title:p("federated.enableFederatedLogin"),content:p("federated.enableFederatedLoginDescription"),onConfirm:function(n){return(0,T.Z)((0,_.Z)().mark((function t(){return(0,_.Z)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,b.auditFederatedLogin({input:{memberPid:e.appPid,did:h.appPid,status:"approved"}});case 2:n();case 3:case"end":return t.stop()}}),t)})))()}})})),A=(0,rn.Z)((function(){var e=[{label:p("common.name"),name:"appName",options:{customBodyRenderLite:function(e){var n=y[e],t=!1!==n.isMaster;return(0,oe.jsx)(x.Z,{display:"inline-block",children:(0,oe.jsxs)(x.Z,{component:"a",display:"flex",alignItems:"center",href:n.appUrl,target:"_blank",onClick:function(e){e.stopPropagation()},children:[t&&(0,oe.jsx)(Qn.Z,{component:Xn.Z,style:{marginRight:"4px"}}),n.appName]})})}}},{label:p("common.did"),name:"appId",options:{customBodyRenderLite:function(e){var n=y[e];return(0,oe.jsx)(et.Z,{children:n.appId})}}},{label:p("common.status"),name:"status",options:{customBodyRenderLite:function(e){var n=y[e],t=!1!==n.isMaster;return(0,oe.jsx)(x.Z,{children:t?"-":p("federated.status.".concat(n.status))})}}}];return C&&e.push({label:p("common.actions"),name:"actions",options:{customBodyRenderLite:function(e){var n=y[e],t=!1!==n.isMaster;return(0,oe.jsx)(x.Z,{display:"flex",gap:1,children:t?(0,oe.jsxs)(oe.Fragment,{children:["rejected"===n.status&&(0,oe.jsx)(W.Z,{variant:"contained",color:"error",size:"small",onClick:function(e){e.stopPropagation()},children:p("federated.status.rejected")}),"revoked"===n.status&&(0,oe.jsx)(W.Z,{variant:"contained",color:"secondary",size:"small",onClick:function(e){e.stopPropagation()},children:p("federated.status.revoked")})]}):(0,oe.jsxs)(oe.Fragment,{children:["pending"===n.status&&(0,oe.jsx)(W.Z,{variant:"contained",color:"primary",size:"small",onClick:function(e){e.stopPropagation(),L(n)},children:p("federated.status.pending")}),"approved"===n.status&&(0,oe.jsx)(W.Z,{variant:"contained",color:"error",size:"small",onClick:function(e){e.stopPropagation(),E(n)},style:{whiteSpace:"nowrap"},children:p("federated.revoke")}),"revoked"===n.status&&(0,oe.jsx)(W.Z,{variant:"contained",color:"warning",size:"small",onClick:function(e){e.stopPropagation(),P(n)},style:{whiteSpace:"nowrap"},children:p("federated.approve")})]})})}}}),e}),[k.appId,y,C]),O=(0,rn.Z)((function(){return{sort:!0,download:!1,filter:!1,print:!1,expandableRowsOnClick:!0,onRowClick:function(e,n){var t=n.dataIndex,r=y[t];w(r)}}}),[]),R=(0,cn.Z)((function(){var e,n,t,r=null===(e=h.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 i,o=new URL(r);null===(i=c.current)||void 0===i||i.open({link:o.origin})}catch(a){H.Z.error(p("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]),N=(0,l.useState)(k.autoLogin||!1),I=(0,o.Z)(N,2),B=I[0],D=I[1],F=(0,cn.Z)((function(){g.open({title:p(B?"federated.disableFederatedAutoLogin":"federated.enableFederatedAutoLogin"),content:p(B?"federated.disableFederatedAutoLoginDescription":"federated.enableFederatedAutoLoginDescription"),onConfirm:function(e){return(0,T.Z)((0,_.Z)().mark((function n(){return(0,_.Z)().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,b.configFederated({input:{did:h.appPid,autoLogin:!B}});case 2:D((function(e){return!e})),e();case 4:case"end":return n.stop()}}),n)})))()}})}),[D,B]),z=(0,cn.Z)((function(){g.open({title:p("federated.quitFederatedLogin"),content:p("federated.quitFederatedLoginDescription"),onConfirm:function(e){return(0,T.Z)((0,_.Z)().mark((function n(){return(0,_.Z)().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,b.quitFederatedLogin({input:{did:h.appPid}});case 2:e();case 3:case"end":return n.stop()}}),n)})))()}})})),U=[];return"master"!==s?U.push((0,oe.jsx)(W.Z,{size:"small",variant:"contained",color:"error",onClick:z,sx:{ml:1},children:p("federated.quitFederatedLogin")})):U.push((0,oe.jsx)(W.Z,{size:"small",variant:"contained",onClick:R,sx:{ml:1},children:p("federated.inviteJoinFederatedLogin")})),(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsx)($n.Z,{className:"main-table",locale:f,data:y,columns:A,customButtons:U,title:(0,oe.jsx)(x.Z,{className:"table-toolbar-left",children:"master"===s?p("oauth.federated"):(0,oe.jsx)(We.Z,{sx:{ml:0,"& span.MuiSwitch-switchBase":{display:"flex"},"& span.MuiSwitch-track":{display:"block"}},control:(0,oe.jsx)(qn.Z,{checked:B,style:{marginRight:"6px"},onChange:F}),label:p("federated.enableFederatedAutoLogin")})}),options:O}),j,(0,oe.jsx)(vt,{ref:c}),(0,oe.jsx)(ft,{ref:d})]})}Zt.propTypes={mode:u().oneOf(["member","master"])},Zt.defaultProps={mode:"member"};var gt=Zt,jt=t(82434),bt=t.n(jt),yt=(0,l.forwardRef)((function(e,n){var t,r,i=(0,l.useContext)(S.RD).t,o=(0,de.h6)().api,a=(0,_e.y0)().blocklet,s=null===a||void 0===a?void 0:a.appPid,c=(0,dt.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,nt.Z)({show:!1,appUrl:"",appUrlError:"",callback:rt()}),p=(0,cn.Z)((function(){u.appUrl="",u.appUrlError="",u.callback=rt()}),[]),f=(0,cn.Z)((function(){u.show=!1,setTimeout((function(){p()}),d)}),[]),m=(0,cn.Z)((function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:rt();u.show=!0,u.callback=e}),[]);(0,l.useImperativeHandle)(n,(function(){return{open:m,close:f}}),[m,f]);var h=(0,cn.Z)((function(e){if(!e)throw new Error(i("federated.federatedJoinAppUrlRequired"));if(!bt()(e))throw new Error(i("federated.federatedJoinAppUrlInvalid"))})),v=(0,cn.Z)((0,T.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:s,appUrl:u.appUrl}});case 4:n=e.sent,u.show=!1,f(),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]])}))),[f,s]);return(0,oe.jsxs)(Ue.Z,{open:u.show,title:i("federated.joinFederatedLogin"),onClose:f,PaperProps:{style:{minHeight:"unset"}},actions:(0,oe.jsx)(W.Z,{color:"primary",autoFocus:!0,variant:"contained",onClick:v,children:i("common.confirm")}),children:[(0,oe.jsx)(x.Z,{mb:1,children:i("federated.joinFederatedLoginDescription")}),(0,oe.jsx)(xe.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}})]})})),kt=yt;function Ct(){var e,n,t,r,i=(0,l.useRef)(null),o=(0,l.useRef)(null),a=(0,l.useContext)(S.RD).t,s=(0,_e.y0)(),c=s.blocklet,d=s.actions.refreshBlocklet,u=(0,cn.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,s=new URL(r);null===(o=i.current)||void 0===o||o.open({link:s.origin})}catch(l){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]),p=(0,cn.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 f,m=!1!==(null===(f=c.settings.federated)||void 0===f?void 0:f.config.isMaster);return(0,oe.jsx)(gt,{mode:m?"master":"member"})}return(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsxs)(x.Z,{display:"flex",flexDirection:"column",gap:2,justifyContent:"center",alignItems:"center",minHeight:"200px",children:[(0,oe.jsx)(W.Z,{variant:"contained",onClick:u,children:a("federated.inviteJoinFederatedLogin")}),(0,oe.jsx)(F.Z,{sx:{width:"150px",color:"rgba(0, 0, 0, 0.3)"},children:"OR"}),(0,oe.jsx)(W.Z,{variant:"outlined",onClick:p,children:a("federated.joinFederatedLogin")})]}),(0,oe.jsx)(vt,{ref:i}),(0,oe.jsx)(kt,{ref:o})]})}var wt,St=function(){var e=(0,l.useContext)(S.RD).t,n=[{label:(0,oe.jsx)(x.Z,{textAlign:"center",width:"100%",children:e("oauth.commonSettings")}),value:"settings"},{label:(0,oe.jsx)(x.Z,{textAlign:"center",width:"100%",children:e("oauth.federated")}),value:"federated"},{label:(0,oe.jsx)(x.Z,{textAlign:"center",width:"100%",children:"Auth0"}),value:"auth0"},{label:(0,oe.jsx)(x.Z,{textAlign:"center",width:"100%",children:e("oauth.moreLogin")}),value:"more"}],t=(0,l.useState)(n[0].value),r=(0,o.Z)(t,2),i=r[0],a=r[1],s=(0,rn.Z)((function(){return{auth0:(0,oe.jsx)(Gn,{}),federated:(0,oe.jsx)(Ct,{}),more:(0,oe.jsx)(x.Z,{children:(0,oe.jsx)(q.Z,{children:e("oauth.comingSoon")})}),settings:(0,oe.jsx)(x.Z,{children:(0,oe.jsx)(Jn,{})})}}),[e]);return(0,oe.jsxs)(x.Z,{children:[(0,oe.jsx)(L.Z,{tabs:n,current:i,onChange:a}),(0,oe.jsx)(x.Z,{marginTop:"10px",children:s[i]})]})},Lt=["blocklet","onUpdate"],Et=function e(n){var t=n.tabs,r=n.blocklet,i=n.ancestors,o=void 0===i?[]:i,a=n.depth,l=void 0===a?1:a,c=n.t,d=[].concat((0,s.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,oe.jsxs)(x.Z,{pl:2*Math.max(1,l-1),display:"flex",alignItems:"center",justifyContent:"flex-start",children:[u?(0,oe.jsx)(A.Z,{size:24,blocklet:r}):(0,oe.jsx)(P.Z,{size:24,blocklet:r,ancestors:o}),(0,oe.jsx)(x.Z,{ml:"16px",children:(0,oe.jsx)(x.Z,{style:{color:"#222"},children:u?c("blocklet.component.container"):(0,E.getDisplayName)(r,!0)})})]},d),value:d}),r.children.length>0&&r.children.forEach((function(n){e({tabs:t,blocklet:n,ancestors:[].concat((0,s.Z)(o),[r]),depth:l+1,t:c})}))};function Pt(e){var n=e.blocklet,t=e.onUpdate,r=(0,a.Z)(e,Lt),s=(0,l.useContext)(S.RD).t,c=(0,de.h6)(),d=c.info,u=c.inService,f=(0,l.useState)(!0),E=(0,o.Z)(f,2),P=E[0],A=E[1],_=(0,w.useSearchParams)(),T=(0,o.Z)(_,2),O=T[0],R=T[1],N=O.get("tab")||"general",I=[{label:(0,oe.jsxs)(x.Z,{display:"flex",alignItems:"center","data-cy":"configuration-tab-general",children:[(0,oe.jsx)(Z.Z,{sx:{fontSize:24}}),(0,oe.jsx)(x.Z,{ml:"16px",children:(0,oe.jsx)(x.Z,{style:{color:"#222"},children:s("common.general")})})]},"general"),value:"general"},{label:(0,oe.jsxs)(x.Z,{display:"flex",alignItems:"center","data-cy":"configuration-tab-access",children:[(0,oe.jsx)(g.Z,{sx:{fontSize:24}}),(0,oe.jsx)(x.Z,{ml:"16px",children:(0,oe.jsx)(x.Z,{style:{color:"#222"},children:s("common.access")})})]},"access"),value:"access"},{label:(0,oe.jsxs)(x.Z,{display:"flex",alignItems:"center","data-cy":"configuration-tab-oauth",children:[(0,oe.jsx)(j.Z,{sx:{fontSize:24}}),(0,oe.jsx)(x.Z,{ml:"16px",children:(0,oe.jsx)(x.Z,{style:{color:"#222"},children:s("common.login")})})]},"oauth"),value:"oauth"},{label:(0,oe.jsxs)(x.Z,{display:"flex",alignItems:"center","data-cy":"configuration-tab-notification",children:[(0,oe.jsx)(b.Z,{sx:{fontSize:24}}),(0,oe.jsx)(x.Z,{ml:"16px",children:(0,oe.jsx)(x.Z,{style:{color:"#222"},children:s("common.notification")})})]},"notification"),value:"notification"},{label:(0,oe.jsxs)(x.Z,{display:"flex",alignItems:"center","data-cy":"configuration-tab-preference",children:[(0,oe.jsx)(x.Z,{ml:-2,style:{transform:"translateY(2px)"},children:P?(0,oe.jsx)(C.Z,{fontSize:"inherit"}):(0,oe.jsx)(k.default,{fontSize:"inherit"})}),(0,oe.jsx)(y.Z,{sx:{fontSize:24}}),(0,oe.jsx)(x.Z,{ml:"16px",children:(0,oe.jsx)(x.Z,{style:{color:"#222"},children:s("common.preferences")})})]},"preference"),value:"preference"}];P&&Et({tabs:I,blocklet:n,t:s});var B=null;if("general"===N)B=(0,oe.jsx)(nn,{blocklet:n,onUpdate:t});else if("access"===N)B=(0,oe.jsx)(Kn,{});else if("oauth"===N)B=(0,oe.jsx)(St,{});else if("notification"===N)B=(0,oe.jsx)(yn,{});else{var D=u?h.WELLKNOWN_SERVICE_PATH_PREFIX:d.routing.adminPath,F=new URLSearchParams;u||F.set("authKey","__sst"),F.set("schemaKey",m()(window.location.origin,D,"/api/preferences?id=".concat(encodeURIComponent(N)))),B=(0,oe.jsx)(p.Z,{url:"".concat(m()(window.location.origin,D,"/hosted/form-collector/"),"?").concat(F.toString()),width:"100%",height:"100%",frameBorder:0,styles:{border:0}})}return(0,oe.jsx)(At,(0,i.Z)((0,i.Z)({},r),{},{children:(0,oe.jsxs)(v.ZP,{container:!0,spacing:4,columns:24,children:[(0,oe.jsx)(v.ZP,{item:!0,sm:7,md:5,children:(0,oe.jsx)(L.Z,{tabs:I,current:N,orientation:"vertical",onChange:function(e){"preference"===e?A(!P):R((function(n){return"general"===e?n.delete("tab"):n.set("tab",e),n}))},sx:{borderRight:1,height:"100%",borderColor:"divider"}})}),(0,oe.jsx)(v.ZP,{item:!0,sm:17,md:19,children:(0,oe.jsx)(x.Z,{style:{minHeight:"66vh",height:"100%",position:"relative",overflow:"hidden"},children:B})})]})}))}Pt.propTypes={blocklet:u().object.isRequired,onUpdate:u().func},Pt.defaultProps={onUpdate:function(){}};var At=c.default.div(wt||(wt=(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"])))},63405:function(e,n,t){t.d(n,{Z:function(){return k}});var r=t(68079),i=t(5057),o=t(55898),a=t.n(o),s=t(31942),l=t(75239),c=t(39075),d=t(69569),u=t(37064),p=t(14491),f=t(96234),m=t(43681),h=t.n(m),x=t(11819),v=t(38763),Z=t(75392),g=t(11750),j=t(58238),b=t(96266);function y(e){var n=e.certificate,t=(0,i.useState)(null),r=(0,f.Z)(t,2),o=r[0],a=r[1],l=(0,j.h6)(),d=(0,c.PE)(),u=d.t,m=d.locale,y=function(){a(null)},k=Boolean(o);return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(s.Z,{"aria-owns":k?"mouse-over-popover":void 0,onMouseEnter:function(e){a(e.currentTarget)},onMouseLeave:y,style:{color:"#44cdc6",fontSize:20,marginLeft:8,cursor:"pointer"}}),(0,b.jsx)(x.ZP,{id:"mouse-over-popover",style:{pointerEvents:"none"},open:k,anchorEl:o,anchorOrigin:{vertical:"bottom",horizontal:"left"},transformOrigin:{vertical:"top",horizontal:"left"},onClose:y,disableRestoreFocus:!0,children:(0,b.jsx)(v.Z,{children:(0,b.jsxs)(Z.Z,{style:{display:"flex"},children:[(0,b.jsx)("div",{children:(0,b.jsx)("img",{src:"".concat(l.imgPrefix,"/https-certificate-icon.png"),alt:"certificate icon",style:{maxHeight:"100%",maxWidth:"100%"}})}),(0,b.jsxs)(g.Z,{component:"div",style:{marginLeft:"16px"},children:[(0,b.jsx)(g.Z,{component:"div",style:{fontWeight:"bold"},children:n.domain}),(0,b.jsx)(g.Z,{component:"div",children:"".concat(u("common.issuer"),": ").concat(h()(n,"issuer.commonName",""))}),(0,b.jsx)(g.Z,{component:"div",children:"".concat(u("router.cert.issuedOn"),": ").concat((0,p.pz)(n.validFrom,m))}),(0,b.jsx)(g.Z,{component:"div",children:"".concat(u("router.cert.expiryOn"),": ").concat((0,p.pz)(n.validTo,m))})]})]})})})]})}function k(e){var n=e.domain,t=e.filters,o=(0,c.PE)().t,a=n.value,u=n.domainStatus;if(!(0,p.rM)(a))return null;var f=null,m=null,h=u.isHttps,x=u.matchedCert;if(!(0,p.ao)(a)){var v=u.dns,Z=void 0===v?{}:v,g=Z.resolved,j=Z.ip;f=g||"127.0.0.1"===j?(0,b.jsx)(l.Z,{title:o("router.domain.verify.ok"),children:(0,b.jsx)(d.Z,{color:"success"})}):(0,b.jsx)(l.Z,{title:o("router.domain.verify.notResolved"),children:(0,b.jsx)(d.Z,{color:"error"})})}m=h?(0,b.jsx)(y,{certificate:x}):(0,b.jsx)(l.Z,{title:o("router.domain.https.bad"),children:(0,b.jsx)(s.Z,{style:{color:"#D0021B",fontSize:20,marginLeft:8,cursor:"pointer"}})});var k=t.map((function(e){return"domain"===e?f:"http"===e?m:null}));return i.createElement.apply(void 0,[i.Fragment,null].concat((0,r.Z)(k)))}y.propTypes={certificate:a().object},y.defaultProps={certificate:{}},k.propTypes={domain:u.Y.isRequired,filters:a().array},k.defaultProps={filters:["domain","http"]}},37064:function(e,n,t){t.d(n,{Y:function(){return o}});var r=t(55898),i=t.n(r),o=i().shape({href:i().string,accessibility:i().shape({loading:i().bool,accessible:i().bool}),domainStatus:i().shape({isHttps:i().bool,matchedCert:i().object}),dns:i().shape({resolved:i().bool,ip:i().string})})},54063:function(e,n,t){t.d(n,{C:function(){return r}});var r="true"===localStorage.getItem("enableDebug")}}]);
|