@abtnode/blocklet-services 1.16.19-beta-7b2db880 → 1.16.19-beta-7d3ef675

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.
Files changed (73) hide show
  1. package/api/index.js +3 -2
  2. package/api/routes/user.js +42 -25
  3. package/api/validators/login.js +3 -1
  4. package/build/asset-manifest.json +73 -73
  5. package/build/index.html +1 -1
  6. package/build/service-worker.js +1 -1
  7. package/build/static/css/5547.75913953.chunk.css +12 -0
  8. package/build/static/js/{1148.5ccba08e.chunk.js → 1148.d3c53aea.chunk.js} +2 -2
  9. package/build/static/js/{1233.276cf2d0.chunk.js → 1233.43c6131b.chunk.js} +3 -3
  10. package/build/static/js/{6084.30821f2c.chunk.js → 1249.ce085f29.chunk.js} +3 -3
  11. package/build/static/js/1905.656cb960.chunk.js +2 -0
  12. package/build/static/js/{2291.37b0ad3a.chunk.js → 2291.7ffdc7df.chunk.js} +2 -2
  13. package/build/static/js/2506.dd9284b6.chunk.js +2 -0
  14. package/build/static/js/2838.bc235457.chunk.js +3 -0
  15. package/build/static/js/2940.5fc76234.chunk.js +2 -0
  16. package/build/static/js/{3025.7c99c058.chunk.js → 3025.76882d0f.chunk.js} +2 -2
  17. package/build/static/js/3033.f950a32b.chunk.js +2 -0
  18. package/build/static/js/3430.28c5bd04.chunk.js +2 -0
  19. package/build/static/js/3557.bfa0e436.chunk.js +2 -0
  20. package/build/static/js/3708.937e3176.chunk.js +3 -0
  21. package/build/static/js/371.5ff795df.chunk.js +2 -0
  22. package/build/static/js/{4023.5fe8180a.chunk.js → 4023.623d31df.chunk.js} +2 -2
  23. package/build/static/js/{4319.9f120992.chunk.js → 4319.8d9e189e.chunk.js} +2 -2
  24. package/build/static/js/4461.2e764a6b.chunk.js +2 -0
  25. package/build/static/js/{4587.9a042d46.chunk.js → 4587.0d0fd3ae.chunk.js} +2 -2
  26. package/build/static/js/5070.267c5f25.chunk.js +2 -0
  27. package/build/static/js/5547.1bea60f5.chunk.js +3 -0
  28. package/build/static/js/{5683.051a03c1.chunk.js → 5683.b87f7ca2.chunk.js} +2 -2
  29. package/build/static/js/6139.4c62883c.chunk.js +2 -0
  30. package/build/static/js/6271.0a698298.chunk.js +2 -0
  31. package/build/static/js/6311.d6addc15.chunk.js +2 -0
  32. package/build/static/js/716.8cd88d8c.chunk.js +3 -0
  33. package/build/static/js/779.21153e82.chunk.js +2 -0
  34. package/build/static/js/7858.7726a169.chunk.js +2 -0
  35. package/build/static/js/7892.46f78f2c.chunk.js +2 -0
  36. package/build/static/js/8393.c6c4c762.chunk.js +2 -0
  37. package/build/static/js/{8622.6aa0a4d4.chunk.js → 8622.03f917b3.chunk.js} +2 -2
  38. package/build/static/js/8944.7444f668.chunk.js +2 -0
  39. package/build/static/js/{8641.bec13444.chunk.js → 8983.6213f391.chunk.js} +2 -2
  40. package/build/static/js/9017.369db632.chunk.js +2 -0
  41. package/build/static/js/main.81fbc388.js +3 -0
  42. package/build/static/js/{main.09227d84.js.LICENSE.txt → main.81fbc388.js.LICENSE.txt} +1 -1
  43. package/package.json +23 -23
  44. package/build/static/css/5547.e016de4c.chunk.css +0 -12
  45. package/build/static/js/2801.33d2f238.chunk.js +0 -2
  46. package/build/static/js/2838.ec459fda.chunk.js +0 -3
  47. package/build/static/js/2940.ce32ab3f.chunk.js +0 -2
  48. package/build/static/js/3033.9fe46d7f.chunk.js +0 -2
  49. package/build/static/js/3076.28658ffc.chunk.js +0 -2
  50. package/build/static/js/3430.dc830483.chunk.js +0 -2
  51. package/build/static/js/3708.7e2ad66b.chunk.js +0 -3
  52. package/build/static/js/4461.f9a883d3.chunk.js +0 -2
  53. package/build/static/js/5070.31a74ba7.chunk.js +0 -2
  54. package/build/static/js/5434.523d071d.chunk.js +0 -2
  55. package/build/static/js/5547.42b98889.chunk.js +0 -3
  56. package/build/static/js/6032.1001afd3.chunk.js +0 -2
  57. package/build/static/js/6139.161b2e7f.chunk.js +0 -2
  58. package/build/static/js/716.e68425d7.chunk.js +0 -3
  59. package/build/static/js/779.73350f02.chunk.js +0 -2
  60. package/build/static/js/7858.52930f63.chunk.js +0 -2
  61. package/build/static/js/8181.bc510ea3.chunk.js +0 -2
  62. package/build/static/js/8393.ea7ef05d.chunk.js +0 -2
  63. package/build/static/js/840.5bc210dd.chunk.js +0 -2
  64. package/build/static/js/8944.5b8c231c.chunk.js +0 -2
  65. package/build/static/js/9017.56c20b17.chunk.js +0 -2
  66. package/build/static/js/9314.f0add972.chunk.js +0 -2
  67. package/build/static/js/main.09227d84.js +0 -3
  68. /package/build/static/js/{1233.276cf2d0.chunk.js.LICENSE.txt → 1233.43c6131b.chunk.js.LICENSE.txt} +0 -0
  69. /package/build/static/js/{6084.30821f2c.chunk.js.LICENSE.txt → 1249.ce085f29.chunk.js.LICENSE.txt} +0 -0
  70. /package/build/static/js/{2838.ec459fda.chunk.js.LICENSE.txt → 2838.bc235457.chunk.js.LICENSE.txt} +0 -0
  71. /package/build/static/js/{3708.7e2ad66b.chunk.js.LICENSE.txt → 3708.937e3176.chunk.js.LICENSE.txt} +0 -0
  72. /package/build/static/js/{5547.42b98889.chunk.js.LICENSE.txt → 5547.1bea60f5.chunk.js.LICENSE.txt} +0 -0
  73. /package/build/static/js/{716.e68425d7.chunk.js.LICENSE.txt → 716.8cd88d8c.chunk.js.LICENSE.txt} +0 -0
@@ -0,0 +1,2 @@
1
+ (self.webpackChunk_abtnode_blocklet_services=self.webpackChunk_abtnode_blocklet_services||[]).push([[371],{60966:function(e,n,t){var o=t(6399);e.exports=function(e,n){return o(e)===o(n)}},78181:function(e,n,t){"use strict";t.d(n,{Z:function(){return Yn}});var o=t(71171),r=t(68079),i=t(59740),a=t(32723),l=t(34795),c=t(96234),s=t(33028),u=t(30969),d=t(24974),p=t.n(d),m=t(30734),f=t(12700),h=t.n(f),v=t(43260),x=t.n(v),g=t(76032),y=t.n(g),b=t(60523),Z=t.n(b),k=t(99398),C=t(94308),j=t(33359),w=t(87006),P=t(1437),S=t(38996),R=t(75255),T=t(16380),E=t(26022),D=t(59505),U=t(66629),L=t(43001),N=t(38361),B=t(20244),_=t(29996),F=t(23299),q=t(78598),I=t(65248),O=t(7017),A=t(88617),K=t.n(A),z=t(1986),M=t(41395),W=t(45008),V=t(24891),H=t(8016),G=t(14458),Y=t(19611),X=t.n(Y),Q=t(26328),J=t(59485),$=t.n(J),ee=t(54559),ne=t(74743),te=t(67888),oe=t(9943),re=t(86008),ie=t(93310),ae=t(64698),le=t(36508),ce=t(6200),se=t(37574),ue={meta:p().object.isRequired,onCancel:p().func.isRequired},de=(0,ne.Z)((function(){return{dialogAuth:{padding:"0 0 24px !important","& .auth-title":{textAlign:"center !important",marginBottom:"4px !important"},"& .auth-tip--scan":{textAlign:"center !important"}},iconRoot:{minWidth:48}}}));function pe(e){var n=e.action,t=e.onSelect,o=e.onNext,r=de(),i=(0,E.PE)().t,a=[{action:"purchase",title:i("store.purchase.purchase.title"),description:i("store.purchase.purchase.description")},{action:"verify",title:i("store.purchase.verify.title"),description:i("store.purchase.verify.description")}];return(0,se.jsxs)(se.Fragment,{children:[(0,se.jsx)(te.Z,{className:r.tabPanel,children:a.map((function(e){return(0,se.jsxs)(oe.ZP,{button:!0,selected:n===e.action,onClick:function(){return t(e.action)},children:[(0,se.jsx)(ie.Z,{className:r.iconRoot,children:"purchase"===e.action?(0,se.jsx)(ae.Z,{style:{color:"purchase"===n?ce.Z.primary.main:"#AAA",fontSize:32}}):(0,se.jsx)(le.Z,{style:{color:"verify"===n?ce.Z.primary.main:"#AAA",fontSize:32}})}),(0,se.jsx)(re.Z,{primary:e.title,secondary:e.description})]},e.action)}))}),o&&(0,se.jsx)(_.Z,{fullWidth:!0,disabled:!n,variant:"contained",color:"primary",style:{marginTop:16},onClick:o,children:i("common.next")})]})}pe.propTypes={action:p().oneOf(["both","purchase","verify"]).isRequired,onSelect:p().func.isRequired,onNext:p().func.isRequired};var me=["mode"];function fe(e){var n=e.meta,t=e.onCancel,o=e.mode,r=e.handlePaySuccess,i=(0,E.PE)(),d=i.t,p=i.locale,m=(0,M.h6)().info,f=(0,V.yP)(m),h=(0,u.useState)(null),v=(0,c.Z)(h,2),x=v[0],g=v[1],y=new URL(null===n||void 0===n?void 0:n.registryUrl).origin,b=(0,O.getDisplayName)({meta:n}),Z=function(){var e=(0,l.Z)((0,a.Z)().mark((function e(n,i){var c,s,u,p,m;return(0,a.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(u=function(e){return $()((function(){return ee.hi.get(e).then(function(){var e=(0,l.Z)((0,a.Z)().mark((function e(n){var t,o;return(0,a.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=n.data,o=null===t||void 0===t?void 0:t.downloadTokenList,"succeed"!==t.status){e.next=12;break}if(!o||!o.length){e.next=8;break}return e.next=6,c({downloadTokenList:o});case 6:e.next=11;break;case 8:return e.next=10,s(d("blocklet.component.missDownloadTokenTip"));case 10:case 11:case 16:return e.abrupt("return",!0);case 12:if("error"!==t.status){e.next=17;break}return console.error("vc error: ",t),e.next=16,s(null===t||void 0===t?void 0:t.error);case 17:return e.abrupt("return",!1);case 18:case"end":return e.stop()}}),e)})));return function(n){return e.apply(this,arguments)}}())}),{interval:1e3})},c=function(e){var n=e.downloadTokenList;r({downloadTokenList:n})},s=function(e){z.Z.error(e),t(e)},"purchase"!==o||!x){e.next=9;break}return p=(0,V.Pi)(x),m=p.statusUrl,e.next=7,u(m);case 7:e.next=11;break;case 9:return e.next=11,c({downloadTokenList:n.downloadTokenList&&i(n.downloadTokenList)});case 11:case"end":return e.stop()}}),e)})));return function(n,t){return e.apply(this,arguments)}}();if((0,u.useEffect)((function(){if("purchase"===o){var e=new URL(y);e.pathname="/api/did/verify-purchase-blocklet/token",e.searchParams.set("serverDid",m.did),e.searchParams.set("blockletDid",null===n||void 0===n?void 0:n.did);try{ee.hi.get(e.href).then((function(e){var n=e.data,t="".concat(n.url);g(t)}))}catch(t){console.error("get next workflow url error: ",t)}}return function(){g(null)}}),[o]),"purchase"===o&&!x)return"";var k={verify:{action:"verify-purchase-blocklet",checkFn:ee.od.create({baseURL:y}).get,extraParams:{serverDid:m.did,blockletDid:null===n||void 0===n?void 0:n.did},messages:{title:d("store.purchase.verify.auth.title",{name:b}),scan:d("store.purchase.verify.auth.scan"),confirm:d("store.purchase.verify.auth.confirm"),success:d("store.purchase.verify.auth.success")}},purchase:{action:"acquire-asset",checkFn:ee.od.create({baseURL:X()(y,"/store")}).get,extraParams:{factory:n.nftFactory,nw:x},messages:{title:d("store.purchase.auth.title",{name:b}),scan:d("store.purchase.auth.scan"),confirm:d("store.purchase.auth.confirm"),success:(0,se.jsxs)(se.Fragment,{children:[(0,se.jsx)("p",{children:d("store.purchase.auth.success")}),(0,se.jsx)("p",{children:d("blocklet.component.purchaseComponentSecondCheckTip")})]})}}};return(0,se.jsx)(Q.Z,(0,s.Z)({open:!0,locale:p,popup:!1,saveConnect:!1,className:"connect",baseUrl:y,onSuccess:Z,cancelWhenScanned:t,onClose:t,checkTimeout:3e5,webWalletUrl:f,disableClose:!0,showDownload:!1},k[o]))}fe.propTypes=(0,s.Z)((0,s.Z)({},ue),{},{handlePaySuccess:p().func,mode:p().oneOf(["verify","purchase"]).isRequired}),fe.defaultProps={handlePaySuccess:function(){}};var he=(0,u.forwardRef)((function(e,n){var t=e.mode,o=(0,i.Z)(e,me),r=(0,u.useState)("both"!==t?t:"verify"),a=(0,c.Z)(r,2),l=a[0],d=a[1],p=(0,u.useState)("both"!==t?2:1),m=(0,c.Z)(p,2),f=m[0],h=m[1],v=function(){l&&2!==f&&h(2)};return(0,u.useImperativeHandle)(n,(function(){return{onNext:v,getCurrentStep:function(){return f}}})),1===f?(0,se.jsx)("div",{style:{maxWidth:520},children:(0,se.jsx)(pe,{action:l,onNext:null,onSelect:function(e){e!==l&&d(e)}})}):(0,se.jsx)(fe,(0,s.Z)((0,s.Z)({},o),{},{mode:l}))}));he.propTypes={mode:p().oneOf(["both","verify","purchase"]).isRequired,ref:p().any},he.defaultProps={ref:{}};var ve,xe=he,ge=t(52654),ye=t(94486),be=t(30250),Ze=t(33665);function ke(e){var n=Object.assign({},((0,Ze.Z)(e),e));return(0,se.jsxs)("div",(0,s.Z)((0,s.Z)({},n),{},{style:{width:"100%"},children:[(0,se.jsx)("h3",{children:"End User License Agreement for Application"}),(0,se.jsxs)("p",{children:["Blocklet Server License Agreement ",B.COPYRIGHT_OWNER," version 2020-08-28"]}),(0,se.jsx)("p",{children:"BLOCKLET SERVER LICENSE AGREEMENT"}),(0,se.jsx)("p",{children:"\u6682\u65e0"})]}))}function Ce(e){var n=e.meta,t=e.onClickNext,o=e.handleDescEle,r=(0,m.useNavigate)(),i=(0,E.PE)(),a=i.t,l=i.locale,c=t||function(){r("/launch-blocklet/install".concat(window.location.search))};return(0,se.jsxs)(je,{children:[(0,se.jsx)("div",{className:"app-content",children:(0,se.jsx)("div",{className:"agreement",children:(0,se.jsx)("div",{className:"agreement-content",children:(0,se.jsx)(be.Z,{blockletMeta:{data:n},locale:l,handleDescEle:o})})})}),(0,se.jsx)("div",{className:"button-container","data-cy":"agree-all",children:(0,se.jsx)(ye.Z,{onContinue:c,description:(0,se.jsx)(ke,{}),texts:{listenName:a("launchBlocklet.license"),buttonNext:a("launchBlocklet.next")}})})]})}Ce.propTypes={meta:p().object.isRequired,onClickNext:p().func,handleDescEle:p().node},Ce.defaultProps={onClickNext:null,handleDescEle:""};var je=T.Z.div(ve||(ve=(0,o.Z)(["\n display: flex;\n flex-direction: column;\n align-items: center;\n width: 100%;\n height: 100%;\n flex: 1;\n .app-content {\n padding: 2px 24px 24px;\n "," {\n padding-top: 10px;\n }\n width: 100%;\n flex: 1;\n letter-spacing: normal;\n }\n .agreement {\n position: relative;\n display: flex;\n flex-direction: column;\n width: 100%;\n height: 100%;\n border: 1px solid ",";\n border-radius: 12px;\n "," {\n margin-top: 24px;\n }\n "," {\n margin-top: 16px;\n }\n .agreement-content {\n position: absolute;\n left: 0;\n top: 0;\n width: 100%;\n height: 100%;\n font-size: 14px;\n overflow-y: auto;\n "," {\n padding: 0 24px;\n }\n "," {\n padding: 0 16px;\n }\n &:after {\n display: block;\n content: '';\n height: 24px;\n }\n }\n }\n .button-container {\n padding-top: 24px;\n padding-bottom: 34px;\n "," {\n padding-right: 24px;\n margin-left: auto;\n }\n "," {\n padding-top: 0;\n padding-bottom: 16px;\n }\n }\n"])),(function(e){return e.theme.breakpoints.down("md")}),(function(e){return e.theme.palette.grey[100]}),(function(e){return e.theme.breakpoints.up("md")}),(function(e){return e.theme.breakpoints.down("md")}),(function(e){return e.theme.breakpoints.up("md")}),(function(e){return e.theme.breakpoints.down("md")}),(function(e){return e.theme.breakpoints.up("md")}),(function(e){return e.theme.breakpoints.down("md")})),we=t(50496),Pe=t(43207),Se=t(38219),Re=t(70576),Te=t(50624),Ee=t(70177),De=t(77370),Ue=t(90617),Le=t(36558);function Ne(e){var n=e.defaultUrl,t=e.onCancel,o=e.onSuccess,r=e.onError,i=e.mode,d=e.handleText,p=(0,M.h6)().api,m=(0,De.T)().api,f=(0,u.useState)(!1),h=(0,c.Z)(f,2),v=h[0],x=h[1],g=(0,u.useState)(""),y=(0,c.Z)(g,2),b=y[0],Z=y[1],k=(0,E.PE)().t,P={dist:{}},S=(0,u.useState)(n),R=(0,c.Z)(S,2),T=R[0],D=R[1],U=(0,u.useState)(n?1:0),L=(0,c.Z)(U,2),N=L[0],B=L[1],q=(0,u.useState)(P),I=(0,c.Z)(q,2),A=I[0],K=I[1],z=(0,u.useState)(!1),W=(0,c.Z)(z,2),H=W[0],G=W[1],Y=(0,u.useState)({}),X=(0,c.Z)(Y,2),J=X[0],$=X[1],ee="component"===i,ne=!!ee||!n,te=function(){var e=(0,l.Z)((0,a.Z)().mark((function e(){var n,t,o,i,l,c;return(0,a.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:K(P),Z(null),x(!0),e.prev=3,n=decodeURIComponent(T.trim()),e.prev=5,new URL(n),e.next=12;break;case 9:throw e.prev=9,e.t0=e.catch(5),new Error("Invalid URL");case 12:return e.next=14,p.getBlockletMetaFromUrl({input:{url:n}});case 14:t=e.sent,o=t.meta,i=t.inStore,l=t.registryUrl,K(o),$({inStore:i,registryUrl:l,inputUrl:T.trim()}),e.next=28;break;case 22:e.prev=22,e.t1=e.catch(3),console.error(e.t1),c="Blocklet Install failed: ".concat((0,V.Z)(e.t1)),Z(c),r(e.t1);case 28:return e.prev=28,x(!1),e.finish(28);case 31:case"end":return e.stop()}}),e,null,[[3,22,28,31],[5,9]])})));return function(){return e.apply(this,arguments)}}();(0,u.useEffect)((function(){n&&te()}),[n]);var oe=[{name:k("common.name"),value:(0,O.getDisplayName)({meta:A},!0)},{name:k("common.version"),value:A.version},{name:k("common.did"),value:(0,se.jsx)(Le.Z,{did:A.did})},{name:k("common.author"),value:(0,V.rq)(A.author)},{name:k("blocklet.dist.downloadLink"),value:A.dist.tarball}],re=[{label:k("blocklet.fromUrl.step0"),body:(0,se.jsx)(j.Z,{component:"div",children:(0,se.jsx)(w.Z,{label:k("blocklet.fromUrl.label"),autoComplete:"off",variant:"outlined",name:"url","data-cy":"blocklet-url-input",fullWidth:!0,autoFocus:!0,style:{marginBottom:32},margin:"dense",helperText:k("blocklet.fromUrl.description"),value:T,onChange:function(e){Z(null),D(e.target.value)},disabled:v,onKeyPress:function(e){"Enter"===e.key&&(e.preventDefault(),te(),B(1))}})}),cancel:k("common.cancel"),confirm:k("common.next"),onCancel:t,onConfirm:function(){te(),B(1)}},{label:k("blocklet.fromUrl.step1"),body:v?(0,se.jsx)("div",{style:{height:200,width:"100%",display:"flex",alignItems:"center",justifyContent:"center",flexDirection:"column"},children:(0,se.jsx)(C.Z,{})}):A.did?(0,se.jsx)("div",{style:{paddingLeft:"10%"},children:oe.map((function(e){return e.name===k("common.did")?(0,se.jsx)(Ee.Z,{valueComponent:"div",nameWidth:120,name:e.name,nameFormatter:function(){return k("common.did")},children:e.value},e.name):(0,se.jsx)(Ee.Z,{valueComponent:"div",nameWidth:120,name:e.name,children:e.value},e.name)}))}):null,cancel:k(ne?"common.pre":"common.cancel"),confirm:(null===d||void 0===d?void 0:d.confirm)||k("blocklet.fromUrl.confirm"),onCancel:function(){ne?B((function(e){return e-1})):t()},onConfirm:function(){!function(){if(ee)return o((0,s.Z)({meta:A},J)),void t();x(!0),G(!0)}()}}],ie=re[N];return(0,se.jsxs)(se.Fragment,{children:[(0,se.jsxs)(we.ZP,{title:(null===d||void 0===d?void 0:d.title)||k("blocklet.fromUrl.title"),fullWidth:!0,maxWidth:"md",onClose:function(){return ie.onCancel()},showCloseButton:0===N,disableEscapeKeyDown:!0,open:!0,actions:(0,se.jsxs)(se.Fragment,{children:[ie.cancel&&(0,se.jsx)(_.Z,{onClick:function(e){e.stopPropagation(),Z(null),ie.onCancel()},color:"inherit",children:ie.cancel||k("common.cancel")}),(0,se.jsxs)(_.Z,{onClick:function(e){e.stopPropagation(),ie.onConfirm()},color:"primary","data-cy":"install-blocklet-next-step",disabled:v||!T||b,variant:"contained",autoFocus:!0,style:{marginLeft:8},children:[v&&0===N&&(0,se.jsx)(C.Z,{size:16}),ie.confirm]})]}),children:[ne&&(0,se.jsx)(Se.Z,{alternativeLabel:!0,activeStep:N,children:re.map((function(e){var n=e.label;return(0,se.jsx)(Re.Z,{children:(0,se.jsx)(Te.Z,{children:n})},n)}))}),(0,se.jsx)(Pe.Z,{component:"div",style:{marginTop:24},children:ie.body}),!!b&&(0,se.jsx)(F.Z,{type:"error",style:{width:"100%",marginTop:8},children:b})]}),A&&H&&(0,se.jsx)(Q.Z,{popup:!0,open:!0,forceConnected:!1,className:"launch-from-url-auth",action:"launch-free-blocklet-by-session",checkFn:m.get,checkTimeout:3e5,onSuccess:function(){x(!1),G(!1),o((0,s.Z)({meta:A},J)),t()},extraParams:{title:A.title,wt:(0,Ue.iK)(A),blockletMetaUrl:decodeURIComponent(T.trim())},messages:{title:k("setup.keyPair.title"),scan:k("setup.keyPair.scan"),confirm:k("setup.keyPair.confirm"),success:k("setup.keyPair.success")},onClose:function(){x(!1),G(!1)}})]})}Ne.propTypes={defaultUrl:p().string,onCancel:p().func.isRequired,onSuccess:p().func.isRequired,onError:p().func,mode:p().oneOf(["install","component"]),handleText:p().object},Ne.defaultProps={onError:function(){},defaultUrl:"",mode:"install",handleText:{}};var Be=t(2689),_e=t(97475),Fe=t(17708),qe=t(3715),Ie=(0,ne.Z)((function(e){return{addMenuItemRoot:{justifyContent:"center",color:e.palette.primary.main,lineHeight:"3.2"}}}));function Oe(e){var n=e.disabled,t=e.storeList,o=e.teamDid,r=e.onAdd,i=(0,M.h6)().api,s=(0,u.useState)(!1),d=(0,c.Z)(s,2),p=d[0],m=d[1],f=(0,u.useState)(!0),h=(0,c.Z)(f,2),v=h[0],x=h[1],g=(0,u.useState)(!1),y=(0,c.Z)(g,2),b=y[0],Z=y[1],k=(0,u.useState)(""),P=(0,c.Z)(k,2),S=P[0],R=P[1],T=(0,u.useState)(""),D=(0,c.Z)(T,2),U=D[0],L=D[1],N=(0,E.PE)().t,B=Ie(),q=function(){var e=(0,l.Z)((0,a.Z)().mark((function e(){var n,l,c,s;return(0,a.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(m(!0),e.prev=1,n=(0,V.bQ)(S,t),l=n.isNew,c=n.decoded,l){e.next=5;break}throw new Error(N("store.blockletRegistry.haveSameRegistry"));case 5:return e.next=7,i.addBlockletStore({input:{teamDid:o,url:c}});case 7:r(c),Z(!1),e.next=15;break;case 11:e.prev=11,e.t0=e.catch(1),s="".concat(N("store.blockletRegistry.addFailed")," ").concat((0,V.Z)(e.t0)),L(s);case 15:return e.prev=15,m(!1),e.finish(15);case 18:case"end":return e.stop()}}),e,null,[[1,11,15,18]])})));return function(){return e.apply(this,arguments)}}();return(0,se.jsxs)(se.Fragment,{children:[(0,se.jsxs)(oe.ZP,{button:!0,disabled:n,className:B.addMenuItemRoot,onClick:function(){Z(!0)},children:[(0,se.jsx)(qe.Z,{font:!0}),(0,se.jsx)(j.Z,{variant:"inherit",children:N("store.blockletRegistry.addRegistry")})]}),(0,se.jsxs)(we.ZP,{title:N("store.blockletRegistry.addRegistry"),fullWidth:!0,maxWidth:"md",open:b,onClose:function(){return Z(!1)},PaperProps:{style:{minHeight:"auto"}},actions:(0,se.jsxs)(se.Fragment,{children:[(0,se.jsx)(_.Z,{onClick:function(e){e.stopPropagation(),Z(!1)},color:"inherit",children:N("common.cancel")}),(0,se.jsxs)(_.Z,{onClick:function(e){e.stopPropagation(),q()},color:"primary","data-cy":"install-blocklet-next-step",disabled:p||!S||v,variant:"contained",autoFocus:!0,children:[p&&(0,se.jsx)(C.Z,{size:16}),N("common.confirm")]})]}),children:[(0,se.jsx)("div",{style:{paddingTop:12,overflowY:"hidden"},children:(0,se.jsx)(Pe.Z,{component:"div",children:(0,se.jsx)(j.Z,{component:"div",children:(0,se.jsx)(w.Z,{label:N("store.blockletRegistry.registryUrl"),autoComplete:"off",variant:"outlined",name:"url",fullWidth:!0,value:S,onChange:function(e){L(null);var n=!1;e.target.value.trim()||(n=!0),e.target.value.trim()||L(N("store.blockletRegistry.registryUrlEmpty")),R(e.target.value),x(n)},disabled:p,onKeyPress:function(e){"Enter"===e.key&&(e.preventDefault(),e.target.value.trim()?q():L(N("store.blockletRegistry.registryUrlEmpty")))}})})})}),!!U&&(0,se.jsx)(F.Z,{type:"error",style:{width:"100%"},children:U})]})]})}Oe.propTypes={teamDid:p().string.isRequired,disabled:p().bool,storeList:p().array,onAdd:p().func},Oe.defaultProps={disabled:!1,storeList:[],onAdd:function(){}};var Ae=t(50714),Ke=t(11909),ze=t(94551),Me=t(94702),We=t(30291),Ve=t(25371);function He(e){var n=e.store,t=e.teamDid,o=e.onDelete,r=(0,M.h6)().api,i=(0,E.PE)().t,s=(0,u.useState)(!1),d=(0,c.Z)(s,2),p=d[0],m=d[1],f=(0,u.useState)(null),h=(0,c.Z)(f,2),v=h[0],x=h[1],g=(0,Me.Z)(),y=function(){var e=(0,l.Z)((0,a.Z)().mark((function e(){return(0,a.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,m(!0),e.next=4,r.deleteBlockletStore({input:{teamDid:t,url:n.url}});case 4:o&&"function"===typeof o&&o(),e.next=10;break;case 7:e.prev=7,e.t0=e.catch(0),z.Z.error("Remove Blocklet Store Error: ".concat((0,V.Z)(e.t0)));case 10:return e.prev=10,m(!1),x(null),e.finish(10);case 14:case"end":return e.stop()}}),e,null,[[0,7,10,14]])})));return function(){return e.apply(this,arguments)}}(),b={keyName:n.url,title:i("store.blockletRegistry.deleteRegistry"),description:i("store.blockletRegistry.deleteDesc",{name:"<b>".concat(n.url,"</b>"),color:g.palette.error.main}),confirmPlaceholder:i("store.blockletRegistry.confirmDesc",{name:n.url}),confirm:i("common.delConfirm"),cancel:i("common.cancel"),onConfirm:y,onCancel:function(){m(!1),x(null)}};return(0,se.jsxs)(se.Fragment,{children:[(0,se.jsx)(ze.Z,{disabled:p,onClick:function(e){e.stopPropagation(),x(b)},size:"large",children:(0,se.jsx)(We.default,{})}),v&&(0,se.jsx)(Ve.Z,{keyName:v.keyName,title:v.title,description:v.description,confirmPlaceholder:v.confirmPlaceholder,confirm:v.confirm,cancel:v.cancel,params:v.params,onConfirm:v.onConfirm,onCancel:v.onCancel})]})}He.propTypes={teamDid:p().string.isRequired,store:p().object.isRequired,onDelete:p().func},He.defaultProps={onDelete:function(){}};var Ge,Ye=(0,ne.Z)((function(){return{buttonText:{textTransform:"none !important"},iconRoot:{minWidth:24},menuName:{display:"flex",flexDirection:"column",marginRight:"100px","& span":{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}}}}));function Xe(e){var n=e.teamDid,t=e.store,o=e.onDelete,r=Ye();return(0,se.jsxs)("div",{className:r.menuName,children:[(0,se.jsx)(j.Z,{component:"span",variant:"subtitle1",style:{fontWeight:"400"},children:t.name}),(0,se.jsx)(j.Z,{className:"url",component:"span",variant:"inherit",children:"".concat(t.url)}),(0,se.jsxs)(Ae.Z,{children:[(0,se.jsx)(ze.Z,{onClick:function(e){e.stopPropagation(),window.open(t.url)},size:"large",children:(0,se.jsx)(Ke.Z,{})}),!t.protected&&(0,se.jsx)(He,{store:t,onDelete:o,teamDid:n})]})]})}function Qe(e){var n=e.onChange,t=e.loading,o=e.children,i=e.extra,a=e.stores,l=e.storageKey,d=(0,E.PE)().t,p=(0,M.h6)(),m=p.info,f=p.inService,v=(0,W.y0)().blocklet,x=(0,u.useState)(!1),g=(0,c.Z)(x,2),y=g[0],b=g[1],Z=(0,u.useRef)(null),k=(0,u.useState)(),C=(0,c.Z)(k,2),P=C[0],S=C[1],R=(0,Fe.Z)(l||"tmp"),T=(0,c.Z)(R,2),D=T[0],U=T[1],L=l?[D,U]:[P,S],N=(0,c.Z)(L,2),F=N[0],q=N[1],I=(0,V.dX)({fromBlocklet:f,blocklet:v,nodeInfo:m}),O=I.storeList,A=I.teamDid,K=h()([].concat((0,r.Z)(a.map((function(e){return(0,s.Z)((0,s.Z)({},e),{},{protected:!0})}))),(0,r.Z)(O)),"url"),z=F&&K.find((function(e){return F===e.url}))||K[0],H=m.mode===B.NODE_MODES.SERVERLESS;return(0,se.jsxs)(se.Fragment,{children:[(0,se.jsxs)($e,{children:[(0,se.jsx)(_.Z,{ref:Z,color:"secondary","data-cy":"add-component-select-store",endIcon:(0,se.jsx)(_e.Z,{color:"secondary"}),onClick:function(){b(!0)},style:{padding:"0 2px"},children:(0,se.jsx)(j.Z,{color:"secondary",children:z.name})}),(0,se.jsx)(j.Z,{color:"secondary",children:i})]}),(0,se.jsxs)(w.Z,{id:"mui-registry-select",select:!0,autoComplete:"off",variant:"outlined",name:"did",helperText:d("blocklet.component.selectRegistryTip"),"data-cy":"component-registry-select",fullWidth:!0,value:z,autoFocus:!0,onChange:function(e){var t=e.target.value;q(t.url),n(t)},SelectProps:{open:y,MenuProps:{anchorEl:Z.current},renderValue:function(e){return null===e||void 0===e?void 0:e.name},onClose:function(){b(!1)}},style:{display:"none"},margin:"normal",children:[null===K||void 0===K?void 0:K.map((function(e){return(0,se.jsx)(Be.Z,{value:e,"data-cy":e.url,children:(0,se.jsx)(Xe,{teamDid:A,store:e,onDelete:function(){var n;F===e.url&&q(null===(n=K[0])||void 0===n?void 0:n.url)}})},e.url)})),!H&&(0,se.jsx)(Oe,{disabled:t,storeList:K,teamDid:A,onAdd:function(e){q(e)}})]}),o({currentRegistry:z})]})}Xe.propTypes={teamDid:p().string.isRequired,store:p().shape({name:p().string.isRequired,url:p().string.isRequired,protected:p().bool}).isRequired,onDelete:p().func},Xe.defaultProps={onDelete:function(){}},Qe.propTypes={onChange:p().func,loading:p().bool,children:p().any.isRequired,extra:p().node,storageKey:p().string,stores:p().arrayOf(p().shape({name:p().string.isRequired,url:p().string.isRequired}))},Qe.defaultProps={onChange:function(){},loading:!1,extra:"",stores:[],storageKey:""};var Je,$e=T.Z.div(Ge||(Ge=(0,o.Z)(["\n display: flex;\n justify-content: space-between;\n align-items: center;\n margin-bottom: 16px;\n\n span {\n font-size: 16px;\n color: ",";\n // font-weight: bold;\n }\n"])),(function(e){return e.theme.palette.common.black})),en=t(19638),nn=t(37433),tn=t(51921),on=t(95612),rn=t(49956),an=["handleButtonClick","handleSearchSelect","storeUrl","handleBlockletRender","extraFilter","serverVersion","resourceType"],ln=function(e,n){return X()(n,"/blocklets/".concat(e.did))},cn=function(e){var n=e.blocklet,t=e.attribute,o=e.value;return n._formatted?n._formatted[t]:o},sn=function(e){return e.inStore&&!1===(0,O.isFreeBlocklet)(e)};function un(e){var n=e.blocklet,t=e.blocklets,o=e.handleButtonClick,r=e.endpoint,i=(0,E.PE)().t,s=X()(r,(0,V.lk)(n.did,n.logo||"")),d=(0,u.useState)(!1),p=(0,c.Z)(d,2),m=p[0],f=p[1],h=sn(n)?i("common.purchase"):i("blocklet.component.choose"),v=function(){var e=(0,l.Z)((0,a.Z)().mark((function e(i){return(0,a.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i.preventDefault(),i.stopPropagation(),e.prev=2,f(!0),e.next=6,o({meta:n,registryUrl:r,blocklets:t});case 6:e.next=11;break;case 8:e.prev=8,e.t0=e.catch(2),z.Z.error(e.t0.message);case 11:return e.prev=11,f(!1),e.finish(11);case 14:case"end":return e.stop()}}),e,null,[[2,8,11,14]])})));return function(n){return e.apply(this,arguments)}}();return(0,se.jsx)(en.Z,{href:ln(n,r),style:{color:"initial",textDecoration:"none"},onClick:function(e){return!!e.currentTarget.contains(e.target)||(e.preventDefault(),!1)},target:"_blank",children:(0,se.jsx)(mn,{title:cn({blocklet:n,attribute:"title",value:n.title||n.name}),did:n.did,description:cn({blocklet:n,attribute:"description",value:n.description}),cover:n.logo?s:"",version:n.version,button:(0,se.jsx)("div",{style:{display:"flex",alignItems:"center"},children:(0,se.jsx)(rn.Kk,{children:(0,se.jsx)(_.Z,{onClick:v,size:"small",disabled:m,variant:"outlined",color:"primary","data-cy":"install-blocklet",children:m?(0,se.jsxs)(se.Fragment,{children:[(0,se.jsx)(C.Z,{size:16,style:{marginRight:3}}),h]}):h},n.did)})})})})}function dn(e){var n=e.handleButtonClick,t=e.handleSearchSelect,o=e.storeUrl,r=e.handleBlockletRender,a=e.extraFilter,l=e.serverVersion,d=e.resourceType,p=(0,i.Z)(e,an),m=(0,E.PE)().locale,f=(0,u.useState)(!1),h=(0,c.Z)(f,2),v=h[0],x=h[1],g=(0,u.useState)({}),y=(0,c.Z)(g,2),b=y[0],Z=y[1],k=o;return(0,u.useEffect)((function(){Z({resourceType:d})}),[k,d]),(0,u.useEffect)((function(){x(!0),Z({resourceType:d})}),[]),(0,se.jsx)(tn.ErrorBoundary,{FallbackComponent:nn.H,resetKeys:[k],children:(0,se.jsx)("div",(0,s.Z)((0,s.Z)({},p),{},{children:v&&(0,se.jsx)(on.Z,{blockletRender:function(e){var t=(0,s.Z)((0,s.Z)({},e),{},{handleButtonClick:n,endpoint:k});return r((0,s.Z)((0,s.Z)({},e),{},{defaultRender:(0,se.jsx)(un,(0,s.Z)({},t))}))},baseSearch:!0,endpoint:k,locale:m,onFilterChange:function(e){Z(e)},onSearchSelect:t,filters:b,extraFilter:a,serverVersion:l,fetchCategoryDelay:500})}))})}un.propTypes={blocklet:p().object.isRequired,blocklets:p().array,handleButtonClick:p().func,endpoint:p().string},un.defaultProps={handleButtonClick:null,endpoint:"",blocklets:[]},dn.propTypes={storeUrl:p().string.isRequired,handleButtonClick:p().func,handleSearchSelect:p().func,handleBlockletRender:p().func,extraFilter:p().func,serverVersion:p().string,resourceType:p().string},dn.defaultProps={handleButtonClick:null,handleSearchSelect:null,handleBlockletRender:null,extraFilter:void 0,serverVersion:"",resourceType:""};var pn,mn=(0,T.Z)(rn.ZP)(Je||(Je=(0,o.Z)(["\n .ms-highlight {\n color: ",";\n }\n"])),(function(e){return e.theme.palette.primary.main})),fn=t(95803),hn=t.n(fn),vn=t(50576),xn=t(92522),gn=t.n(xn),yn=t(25599),bn=t(59467),Zn=t(28126),kn=t(74202),Cn=["onSelect","endpoint","gatewayUrl","loading","size","helperText"],jn=[{value:"https://www.didspaces.com/app",label:"Prod DID Spaces",avatar:"P"},{value:"https://storage.staging.abtnet.io/app",label:"Staging DID Spaces",avatar:"S"}],wn=(0,Zn.D)();function Pn(e){var n=e.onSelect,t=e.endpoint,o=e.gatewayUrl,a=e.loading,l=e.size,d=e.helperText,p=(0,i.Z)(e,Cn),m=(0,Fe.Z)("did-space-gateway-list",jn),f=(0,c.Z)(m,2),h=f[0],v=f[1],x=(0,u.useState)(o||jn[0].value),g=(0,c.Z)(x,2),y=g[0],b=g[1],Z=(0,E.PE)().t,k=(0,De.T)().api;return(0,u.useEffect)((function(){y&&!h.find((function(e){return e.value===y}))&&k.get(X()(y,"/__blocklet__.js?type=json")).then((function(e){v([].concat((0,r.Z)(h),[{value:y,label:e.data.appName}]))})).catch((function(e){console.error(e),z.Z.error("Can not add this gateway, please check the url and try again")}))}),[y]),(0,se.jsx)(Sn,(0,s.Z)((0,s.Z)({},p),{},{freeSolo:!0,selectOnFocus:!0,clearOnBlur:!0,handleHomeEndKeys:!0,value:y,options:h,onChange:function(e,n){if(n)if("string"===typeof n){var t=h.find((function(e){return e.label===n}));t&&b(t.value)}else n.inputValue?b(n.inputValue):n.value&&b(n.value)},getOptionLabel:function(e){return"string"===typeof e?e:e.inputValue?e.inputValue:e.label},renderOption:function(e,n){return(0,se.jsxs)(oe.ZP,(0,s.Z)((0,s.Z)({},e),{},{children:[(0,se.jsx)(yn.Z,{children:(0,se.jsx)(bn.Z,{children:n.avatar})}),(0,se.jsx)(re.Z,{primary:n.label,secondary:n.value})]}),n.value)},filterOptions:function(e,n){var t=wn(e,n);n.inputValue&&gn()(n.inputValue)&&(e.some((function(e){return n.inputValue===e.value}))||t.push({value:n.inputValue,label:"Add new gateway"}));return t},renderInput:function(e){return(0,se.jsx)(w.Z,(0,s.Z)((0,s.Z)({},e),{},{helperText:d,label:Z("storage.spaces.label"),size:l,InputProps:(0,s.Z)((0,s.Z)({},e.InputProps),{},{type:"search",endAdornment:(0,se.jsx)(_.Z,{variant:"contained",onClick:function(){return n(y)},size:"small",loading:a,disable:a,sx:{position:"absolute",right:0,display:"flex",justifyContent:"center",alignItems:"center",width:"100px",height:"100%"},children:Z(t?"storage.spaces.reconnect":"storage.spaces.connect.now")})})}))}}))}var Sn=(0,T.Z)(kn.Z)(pn||(pn=(0,o.Z)(["\n height: 40px;\n width: 100%;\n max-width: 720px;\n "," {\n width: 75%;\n }\n input.MuiInputBase-input {\n max-width: calc(100% - 80px);\n }\n"])),(function(e){return e.theme.breakpoints.down("md")}));Pn.propTypes={onSelect:p().func.isRequired,endpoint:p().string,loading:p().bool,size:p().string,helperText:p().string,gatewayUrl:p().string},Pn.defaultProps={endpoint:void 0,loading:!1,size:"small",helperText:"",gatewayUrl:""};var Rn=Pn,Tn=["onConnect"];var En=(0,u.forwardRef)((function(e,n){var t=e.onConnect,o=(0,i.Z)(e,Tn),r=(0,M.h6)(),d=r.api,p=r.info.did,m=(0,u.useContext)(E.RD),f=m.t,h=m.locale,v=(0,W.y0)(),x=v.blocklet,g=v.actions.refreshBlocklet,y=(0,u.useState)(""),b=(0,c.Z)(y,2),Z=b[0],k=b[1],C=(0,u.useMemo)((function(){var e,n,t,o;return{endpoint:(null===x||void 0===x||null===(e=x.environments)||void 0===e||null===(n=e.find((function(e){return e.key===D.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_SPACE_ENDPOINT})))||void 0===n?void 0:n.value)||"",gatewayUrl:(null===x||void 0===x||null===(t=x.environments)||void 0===t||null===(o=t.find((function(e){return e.key===D.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_SPACES_URL})))||void 0===o?void 0:o.value)||""}}),[x]),w=(0,O.getAppName)(x),P=(0,O.getAppDescription)(x),S=function(e){var n,t,o,r=null===e||void 0===e||null===(n=e.site)||void 0===n||null===(t=n.domainAliases)||void 0===t||null===(o=t.sort((function(e,n){return e.accessibility.accessible&&n.accessibility.accessible?+e.isProtected-+n.isProtected:+n.accessibility.accessible-+e.accessibility.accessible})))||void 0===o?void 0:o.map((function(e){var n,t=null!==e&&void 0!==e&&null!==(n=e.domainStatus)&&void 0!==n&&n.isHttps?"https://":"http://",o=null===e||void 0===e?void 0:e.value;return"".concat(t).concat(o)})).filter(Boolean),i=null===r||void 0===r?void 0:r[0];return{appUrl:i,isReady:Boolean(i)}}(x),R=S.appUrl,T=S.isReady;function U(e,n){return L.apply(this,arguments)}function L(){return(L=(0,l.Z)((0,a.Z)().mark((function e(n,t){return(0,a.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,d.configBlocklet({input:{did:[n],configs:[{key:D.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_SPACES_URL,value:Z},{key:D.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_SPACE_ENDPOINT,value:t}]}}).then((function(){z.Z.success(f("storage.spaces.connect.succeeded",h))})).catch((function(e){console.error(e),z.Z.error(e.message)}));case 2:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var N=(0,u.useState)({open:!1}),B=(0,c.Z)(N,2),_=B[0],F=B[1],q=function(){var e=(0,l.Z)((0,a.Z)().mark((function e(n,o){return(0,a.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,U(x.meta.did,o(n.endpoint));case 2:setTimeout((function(){F((function(e){return(0,s.Z)((0,s.Z)({},e),{},{open:!1})})),null===t||void 0===t||t(),g()}),3e3);case 3:case"end":return e.stop()}}),e)})));return function(n,t){return e.apply(this,arguments)}}();return(0,u.useEffect)((function(){F((function(e){return(0,s.Z)((0,s.Z)({},e),{},{messages:{title:f("storage.spaces.authorize.title",{appName:w}),scan:f("storage.spaces.authorize.scan",{appName:w}),confirm:"",success:(0,se.jsx)(j.Z,{gutterBottom:!0,children:f("storage.spaces.authorize.success")})}})}))}),[w,h,f]),(0,u.useImperativeHandle)(n,(function(){return{getEndpoint:function(){return C.endpoint},getGatewayUrl:function(){return C.gatewayUrl}}})),(0,se.jsxs)(se.Fragment,{children:[(0,se.jsx)(Rn,(0,s.Z)((0,s.Z)((0,s.Z)({},o),C),{},{onSelect:function(e){(0,vn.isEmpty)(e)?z.Z.error(f("storage.spaces.addressCannotEmpty",h)):(k(e),F((function(n){return(0,s.Z)((0,s.Z)({},n),{},{action:"one-click-authorization",checkTimeout:3e5,prefix:X()(e,"space/api/did"),baseUrl:new URL(e).origin,checkFn:hn().create({baseURL:X()(e,"space")}).get,extraParams:{appDid:x.appDid,appName:w,appDescription:P,scopes:"list:object read:object write:object",appUrl:R,referrer:window.location.href,nodeDid:p},onClose:function(){F((function(e){return(0,s.Z)((0,s.Z)({},e),{},{open:!1})}))},open:!0})})))},loading:!T})),(0,se.jsx)(Q.Z,{forceConnected:!1,saveConnect:!1,prefix:_.prefix,open:_.open,popup:!0,action:_.action,baseUrl:_.baseUrl,checkFn:_.checkFn,onSuccess:q,onClose:_.onClose,checkTimeout:_.checkTimeout,extraParams:_.extraParams,messages:_.messages,locale:h})]})}));En.propTypes={onConnect:p().func},En.defaultProps={onConnect:function(){}};var Dn,Un,Ln,Nn,Bn,_n,Fn,qn=En,In=["name","validation"],On=["default","key"],An=function(e){return e.inStore&&!1===(0,O.isFreeBlocklet)(e)},Kn=function(e){var n;return null===e||void 0===e||null===(n=e.capabilities)||void 0===n?void 0:n.didSpace},zn=function(e){var n,t;return(null===e||void 0===e||null===(n=e.configs)||void 0===n||null===(t=n.find((function(e){return e.key===D.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_SPACE_ENDPOINT})))||void 0===t?void 0:t.value)||null},Mn=function(e){return(e.environments||[]).some((function(e){return e.required}))},Wn=function(e,n){return null===e||void 0===e?void 0:e.some((function(e){return e.required&&!n[e.key]}))},Vn=function(e){var n=e.params,t=e.blocklet,o=e.t,r=n.title||n.name;return r?o(((null===t||void 0===t?void 0:t.children)||[]).find((function(e){return e.meta.bundleDid===n.bundleDid}))?"blocklet.component.upgradeNext":"blocklet.component.addNext",{name:r}):o("common.next")},Hn=(0,u.forwardRef)((function(e,n){var t=e.meta,o=e.isMobile,r=e.onStepChange,i=(0,L.s)(),a=i.steps,l=i.activeStep,c=i.setActiveStepByKey,d=i.setActiveStepByIndex,p=(0,E.PE)(),m=p.t,f=p.locale,h=a[l];return(0,u.useEffect)((function(){r(l)}),[r,l]),(0,u.useImperativeHandle)(n,(function(){return{setActiveStepByKey:c,setActiveStepByIndex:d}})),(0,se.jsx)(et,{component:"div",className:o?"mobileStyle":"",sx:{height:"calc(100% - 56px)"},children:(0,se.jsx)(U.Z,{locale:f,blockletMeta:(0,s.Z)({title:" "},t),pcWidth:"100%",pcHeight:"100%",logoUrl:t&&t.logo&&t.registryUrl?(0,V.aZ)({did:t.did,baseUrl:t.registryUrl,logoPath:t.logo}):null,stepTip:m("blocklet.component.add"),children:(0,se.jsx)(Jn,{children:null!==h&&void 0!==h&&h.body&&"function"===typeof h.body?h.body():h.body})})})}));Hn.propTypes={meta:p().any,onStepChange:p().func.isRequired,isMobile:p().bool.isRequired},Hn.defaultProps={meta:null};var Gn=function(e){setTimeout((function(){window.parent.postMessage({event:"component.installed",componentDid:e},"*")}),arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e3)};function Yn(e){var n,t,o,d,p,f,v,g=e.onClose,b=e.mode,j=e.stores,T=e.resourceType,U=e.storageKey,A=e.inDialog,Y=(0,E.PE)(),X=Y.t,Q=Y.locale,J=(0,u.useState)(!1),$=(0,c.Z)(J,2),ee=$[0],ne=$[1],te=(0,u.useState)(null),oe=(0,c.Z)(te,2),re=oe[0],ie=oe[1],ae=(0,u.useState)(""),le=(0,c.Z)(ae,2),ce=le[0],ue=le[1],de=(0,u.useState)(""),pe=(0,c.Z)(de,2),me=pe[0],fe=pe[1],he=(0,M.h6)(),ve=he.api,ye=he.ws.useSubscription,be=he.inService,Ze=he.info,ke=(0,W.y0)(),je=ke.blocklet,we=ke.actions.refreshBlocklet,Pe=(0,u.useState)(null),Se=(0,c.Z)(Pe,2),Re=Se[0],Te=Se[1],Ee=(0,u.useState)(!1),De=(0,c.Z)(Ee,2),Ue=De[0],Le=De[1],Be={bundleDid:"",componentDid:"",componentName:"",pathPrefix:"",name:"",title:"",configsList:[],configsValue:{},hasMissRequiredConfigs:!1,hasEnvironmentsStep:!1,hasRequiredEnvironments:!1,requirePurchase:!1,didSpaceCapability:null,installResultProps:{},purchaseResultProps:{},showFromUrlDialog:!1},_e=(0,u.useState)(Be),Fe=(0,c.Z)(_e,2),qe=Fe[0],Ie=Fe[1],Oe=(0,u.useState)(0),Ae=(0,c.Z)(Oe,2),Ke=Ae[0],ze=Ae[1],Me=(0,u.useRef)({}),We=(0,u.useRef)({}),Ve=(0,u.useRef)({}),He=(0,R.Z)((function(e){return e.breakpoints.down("md")})),Ge=(0,m.useParams)(),Ye=Me.current.meta,Xe=(We.current||{}).setActiveStepByIndex,Je=Ze.mode===B.NODE_MODES.SERVERLESS,$e=function(e){return Ie((function(n){return(0,s.Z)((0,s.Z)({},n),e)}))};(0,u.useEffect)((function(){if(qe.pathPrefix){var e=an((0,s.Z)((0,s.Z)({},qe),{},{pathPrefix:qe.pathPrefix,locale:Q})).errMsg;ue(e)}}),[qe.pathPrefix]),(0,u.useEffect)((function(){0===Ke&&Ie(Be)}),[Ke]);var en=function(){var e;return null!==Me&&void 0!==Me&&null!==(e=Me.current)&&void 0!==e&&e.meta?(0,O.getDisplayName)(Me.current):""},nn=function(e){!function n(t){$e({installResultProps:{variant:"error",title:en(),subTitle:e,footer:(0,se.jsx)(_.Z,{className:"bottom-button",disabled:t,"data-cy":"retry-install-component",onClick:function(){var e=(0,l.Z)((0,a.Z)().mark((function e(){return(0,a.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n(!0),e.next=3,rn(Me.current.installInput);case 3:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),children:(0,se.jsxs)(N.Z,{display:"flex",alignItems:"center",children:[t&&(0,se.jsx)(C.Z,{size:16,style:{marginRight:8}}),X("common.retry")]})})}})}()},tn=function(e){return function(n){var t,o;((null===n||void 0===n||null===(t=n.meta)||void 0===t?void 0:t.did)||(null===n||void 0===n?void 0:n.meta))===(null===je||void 0===je||null===(o=je.meta)||void 0===o?void 0:o.did)&&e(n)}};ye(D.BlockletEvents.statusChange,tn((function(e){if(e.status===D.BlockletStatus.upgrading)$e({installResultProps:{variant:"success",title:en(),subTitle:X("blocklet.component.installSuccessTip")}}),Gn(Ge.componentDid)})),[null===je||void 0===je||null===(n=je.meta)||void 0===n?void 0:n.did]),ye(D.BlockletEvents.downloadFailed,tn((function(){nn(X("blocklet.component.installComponentError"))})),[null===je||void 0===je||null===(t=je.meta)||void 0===t?void 0:t.did]),ye(D.BlockletEvents.installFailed,tn((function(){nn(X("blocklet.component.installComponentError"))})),[null===je||void 0===je||null===(o=je.meta)||void 0===o?void 0:o.did]);var on=function(){ne(!1),Ie({}),Me.current={},g()},rn=function(){var e=(0,l.Z)((0,a.Z)().mark((function e(n){var t,o,r,i,l,c,u,d,p,m,f,h,v,x,g,y,b,Z,k,C,j,w,P,S,R;return(0,a.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=qe.pathPrefix,i=qe.bundleDid,l=qe.title,c=qe.componentName,u=void 0===c?"":c,d=qe.componentDid,p=void 0===d?"":d,m=(null===(t=Me.current)||void 0===t?void 0:t.meta)||{},f=m.configs,h=void 0===f?[]:f,v=m.registryUrl,x=m.inStore,g=m.inputUrl,y=null===(o=Me.current)||void 0===o?void 0:o.downloadTokenList,b=x?(0,V.Rn)(v,i):g,ne(!0),Z=(0,s.Z)((0,s.Z)((0,s.Z)({rootDid:je.meta.did,url:b,mountPoint:K()(r),title:l,name:u,did:p},qe.hasEnvironmentsStep&&h.length>0?{configs:h.map((function(e){return(0,s.Z)((0,s.Z)({},e),{},{value:qe.configsValue[e.key]||""})}))}:{}),y?{downloadTokenList:y}:{}),n),e.prev=6,e.next=9,ve.installComponent({input:Z});case 9:if(!v){e.next=15;break}if(k=(0,V.dX)({fromBlocklet:be,nodeInfo:Ze,blocklet:je}),C=k.teamDid,j=k.storeList,w=(0,V.bQ)(v,j),P=w.isNew,S=w.decoded,!P){e.next=15;break}return e.next=15,ve.addBlockletStore({input:{teamDid:C,url:S}});case 15:$e({installResultProps:{}}),we({showError:!1,attachRuntimeInfo:!1}),e.next=25;break;case 19:e.prev=19,e.t0=e.catch(6),R=(0,V.Z)(e.t0),z.Z.error(R),console.error("installComponent error: ",e.t0),nn(R);case 25:return e.prev=25,ne(!1),Me.current.installInput=Z,e.finish(25);case 29:case"end":return e.stop()}}),e,null,[[6,19,25,29]])})));return function(n){return e.apply(this,arguments)}}(),an=function(e){return{errMsg:(0,ge.Rw)({params:(0,s.Z)((0,s.Z)({},e),{},{did:e.bundleDid}),blocklets:[je],blocklet:je,locale:Q})}},ln=function(){var e=(0,l.Z)((0,a.Z)().mark((function e(n){var t,o;return(0,a.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=an((0,s.Z)((0,s.Z)({},qe),{},{locale:Q})),o=t.errMsg,ue(o),Ke!==un.length-2){e.next=5;break}return e.next=5,rn(n);case 5:Xe((function(e){return e+1}));case 6:case"end":return e.stop()}}),e)})));return function(n){return e.apply(this,arguments)}}(),cn=function(){Xe((function(e){return e-1}))},sn=function(e){var n,t,o=e.chooseParams,a=void 0===o?Me.current:o,l=e.componentDid,c=e.isInit,u=void 0!==c&&c,d=a.meta,p=a.registryUrl,m=a.inStore,f=a.inputUrl,v=d.did,g=d.title,y=d.name,b=((null===(n=je.settings)||void 0===n?void 0:n.children)||[]).filter((function(e){return"deleted"===e.status&&e.meta.bundleDid===v})),k=l||"",C=null===(t=d.environments)||void 0===t?void 0:t.map((function(e){var n=e.name,t=e.validation,o=(0,i.Z)(e,In),r={validation:Z()(t)?"":t};return(0,s.Z)((0,s.Z)({},o),{},{key:n},r)}));Me.current=(0,s.Z)((0,s.Z)({},a),{},{meta:(0,s.Z)((0,s.Z)({},d),{},{configs:C,registryUrl:p,inStore:m,inputUrl:f})});var j={};if(u){var w=[je],P=C||[],S=h()(x()([].concat((0,r.Z)(P),[])),"key").filter((function(e){return!!e.key})).sort((function(e,n){return e.required&&!n.required?-1:n.required&&!e.required?1:0})),R=(0,O.getSharedConfigObj)(w[0],{configs:S}),T={},E=S.map((function(e){var n=e.default,t=e.key,o=(0,i.Z)(e,On);return T[t]=R[t]||n,(0,s.Z)((0,s.Z)({},o),{},{key:t,hidden:!!D.BLOCKLET_CONFIGURABLE_KEY[t]})}));j=(0,s.Z)((0,s.Z)({},j),{},{configsList:E,configsValue:T,hasMissRequiredConfigs:Wn(E,T)})}var U,L,N=je.children.some((function(e){return"/"===e.mountPoint})),B=b.find((function(e){return e.meta.bundleDid===v}));B?j=(0,s.Z)((0,s.Z)({},j),{},{pathPrefix:B.mountPoint||"",title:g||"",componentName:B.meta.name,hasEnvironmentsStep:!1}):j=(0,s.Z)((0,s.Z)({},j),{},{pathPrefix:N?"/".concat(K()(g)||K()(y)):"/",title:g||"",componentName:"",hasEnvironmentsStep:(null===(U=Me.current.meta)||void 0===U||null===(L=U.environments)||void 0===L?void 0:L.length)>0});var _=An(Me.current.meta),F=Kn(Me.current.meta),q=zn(je);$e((0,s.Z)((0,s.Z)({bundleDid:v,componentDid:k},j),{},{hasRequiredEnvironments:Mn(Me.current.meta),requirePurchase:_,didSpaceCapability:F,didSpaceEndpoint:q})),u&&_&&function(){var e=qe.pathPrefix,n=qe.bundleDid,t=qe.title,o=qe.componentName,r=void 0===o?"":o,i=qe.componentDid,a=void 0===i?"":i,l=(Me.current||{}).meta,c=void 0===l?{}:l,s=c.registryUrl,u=c.inStore,d=c.inputUrl,p=u?(0,V.Rn)(s,n):d;Te({meta:c,installOpts:{type:"component",rootDid:je.meta.did,mountPoint:e,url:p,title:t,name:r,did:a}})}()},un=[{key:"selectComponent",name:X("blocklet.component.selectComponent"),body:(0,se.jsxs)(Qn,{component:"div",children:[qe.showFromUrlDialog&&(0,se.jsx)(Ne,{mode:"component",onCancel:function(){$e({showFromUrlDialog:!1})},onSuccess:function(e){var n=e.meta,t=e.inputUrl,o=e.inStore,r=e.registryUrl;sn({chooseParams:{meta:n,inputUrl:t,inStore:o,registryUrl:r},isInit:!0}),$e({showFromUrlDialog:!1}),ln()},handleText:{title:X("blocklet.component.addComponentTip.fromUrl"),confirm:X("blocklet.component.choose")}}),(0,se.jsx)(Qe,{stores:j,extra:Je?null:(0,se.jsxs)(_.Z,{variant:"text",color:"primary","data-cy":"add-component-from-url",onClick:function(){$e({showFromUrlDialog:!0})},style:{padding:"0 2px"},children:[(0,se.jsx)(P.Z,{style:{fontSize:20,marginRight:4}})," ",X("blocklet.component.addComponentTip.fromUrl")," "]}),loading:ee,onChange:function(){Ie({}),Me.current={}},storageKey:U,children:function(e){var n=e.currentRegistry;return(0,se.jsx)(dn,{serverVersion:null===Ze||void 0===Ze?void 0:Ze.version,style:He?{height:"calc(100vh - 56px - 80px - 32px - 40px )"}:{height:"calc(100% - 40px)"},storeUrl:n.url,resourceType:T,handleButtonClick:function(e){sn({chooseParams:(0,s.Z)((0,s.Z)({},e),{},{inStore:!0}),isInit:!0})},handleBlockletRender:function(e){var n=e.blocklet,t=e.defaultRender,o=(null===qe||void 0===qe?void 0:qe.bundleDid)&&(null===qe||void 0===qe?void 0:qe.bundleDid)===(null===n||void 0===n?void 0:n.did);return(0,se.jsxs)(tt,{children:[o&&(0,se.jsx)("div",{className:"check-container",children:(0,se.jsx)(S.default,{className:"check-icon"})}),(0,se.jsx)("div",{className:o?"choose-blocklet":"",style:{marginLeft:16},children:t})]})}})}})]}),cancel:"embed"===b?void 0:X("common.cancel"),confirm:Vn({params:qe,blocklet:je,t:X}),onCancel:on,onConfirm:function(){ln()}},{key:"agreement",name:X("launchBlocklet.introduction"),body:(0,se.jsxs)(Qn,{component:"div",className:"agreement-wrapper",children:[(0,se.jsx)(k.Z,{title:X("launchBlocklet.introduction"),subTitle:X("blocklet.component.addComponentTip.introduction")}),(0,se.jsx)(Ce,{meta:Ye,onClickNext:ln,handleDescEle:(0,se.jsxs)(se.Fragment,{children:[(0,se.jsx)("p",{children:(0,se.jsx)("div",{dangerouslySetInnerHTML:{__html:X("blocklet.component.addComponentTip.".concat(qe.requirePurchase?"isPurchase":"isFree"),{name:en()})}})}),(0,se.jsx)("p",{children:X("blocklet.component.addComponentTip.belowInformation")})]})})]}),cancel:X("common.pre"),confirm:X("launchBlocklet.next"),onCancel:cn,onConfirm:function(){Le(!1),ln()}},Ye&&qe.requirePurchase&&{key:"purchase",name:(0,se.jsxs)(se.Fragment,{children:[X("common.verifyNFT"),(0,se.jsx)(G.Z,{})]}),body:(0,se.jsxs)(Qn,{component:"div",className:"flex-align-center",style:{flexDirection:"column"},children:[!(2===(null===(d=Ve.current)||void 0===d||null===(p=d.getCurrentStep)||void 0===p?void 0:p.call(d))||Ue)&&(0,se.jsx)(nt,{title:X("common.verifyNFT"),subTitle:X("blocklet.component.addComponentTip.verifyNFT")}),y()(qe.purchaseResultProps)?Re&&(0,se.jsx)(xe,{ref:Ve,meta:Re.meta,mode:qe.componentDid?"verify":"both",onCancel:function(e){Le(!1),$e({purchaseResultProps:{variant:"error",title:en(),subTitle:e,style:{paddingTop:120},footer:(0,se.jsx)(_.Z,{className:"bottom-button","data-cy":"retry-purchase-component",onClick:function(){$e({purchaseResultProps:{}})},children:X("common.retry")})}})},installOpts:Re.installOpts,handlePaySuccess:function(e){var n=e.downloadTokenList;Me.current.downloadTokenList=n,Le(!1),ln()}}):(0,se.jsx)("div",{className:"flex-align-center flex-justify-center",children:(0,se.jsx)(I.Z,(0,s.Z)({},qe.purchaseResultProps))})]}),disabled:2===(null===(f=Ve.current)||void 0===f||null===(v=f.getCurrentStep)||void 0===v?void 0:v.call(f))||Ue,cancel:X("common.pre"),confirm:X("common.next"),onConfirm:function(){"function"===typeof Ve.current.onNext&&(Ve.current.onNext(),Le(!0))},onCancel:function(){cn()}},(0,O.hasStartEngine)(Ye)&&{key:"config",name:X("common.config"),error:ce,body:(0,se.jsxs)(Qn,{component:"div",children:[(0,se.jsx)(nt,{title:X("common.config"),subTitle:X("blocklet.component.addComponentTip.config")}),(0,se.jsx)(w.Z,{label:X("blocklet.component.mountPoint"),autoComplete:"off",variant:"outlined",name:"pathPrefix",inputProps:{"data-cy":"mount-point-input"},fullWidth:!0,helperText:me||X("blocklet.component.mountPointTip"),style:{marginBottom:32},margin:"normal",value:qe.pathPrefix,onChange:function(e){var n=e.target.value;$e({pathPrefix:n}),fe(X("common.slugifyHint",{value:(0,V.LN)(n)}))}}),!!ce&&(0,se.jsx)(F.Z,{type:"error",style:{width:"100%",marginTop:8},children:ce})]}),cancel:X("common.pre"),confirm:X("common.next"),onCancel:cn,onConfirm:function(){ln()}},Ye&&(null===qe||void 0===qe?void 0:qe.hasEnvironmentsStep)&&{key:"environment",name:(0,se.jsxs)(se.Fragment,{children:[X("common.environment")," ",qe.hasRequiredEnvironments&&(0,se.jsx)(G.Z,{})]}),disabled:!!re||(null===qe||void 0===qe?void 0:qe.hasMissRequiredConfigs),body:function(){return(0,se.jsxs)(Qn,{component:"div",children:[(0,se.jsx)(nt,{title:X("common.environment"),subTitle:X("blocklet.component.addComponentTip.environment")}),(0,se.jsx)(H.Z,{style:{marginTop:-12,width:"100%"},schema:qe.configsList,defaultValue:qe.configsValue,onChange:function(e,n){var t=n.action,o=n.currentItem,r=n.allValues;"confirm"===t&&$e({hasMissRequiredConfigs:Wn(qe.configsList,r),configsValue:r}),"edit"===t?ie(o):["cancel","confirm"].includes(t)&&ie(null)}})]})},cancel:X("common.pre"),confirm:X("common.next"),onCancel:cn,onConfirm:ln},Ye&&(null===qe||void 0===qe?void 0:qe.didSpaceCapability)&&{key:"didSpace",name:(0,se.jsxs)(se.Fragment,{children:[X("blocklet.component.didSpaceConfig")," ","required"===qe.didSpaceCapability&&(0,se.jsx)(G.Z,{})]}),disabled:"required"===qe.didSpaceCapability&&!qe.didSpaceEndpoint,body:function(){return(0,se.jsxs)(Qn,{component:"div",children:[(0,se.jsx)(nt,{title:X("blocklet.component.didSpaceConfig"),subTitle:X("blocklet.component.didSpaceConfigTip")}),(0,se.jsx)(N.Z,{sx:{mt:"36px","& > div":{maxWidth:"unset !important","& .MuiAutocomplete-root":{maxWidth:"unset !important"}}},children:(0,se.jsx)(qn,{sx:{"& .MuiFormHelperText-root":{wordBreak:"break-all"}},helperText:qe.didSpaceEndpoint&&X("blocklet.component.didSpaceConnected",{endpoint:qe.didSpaceEndpoint}),onConnect:function(){ln()}})})]})},cancel:X("common.pre"),confirm:X("common.next"),onCancel:cn,onConfirm:ln},{key:"install",name:X("common.install"),disabled:!1,loading:!1,body:(0,se.jsx)(Qn,{component:"div",className:"flex-justify-center flex-align-center",style:{flexDirection:"column"},children:y()(qe.installResultProps)?(0,se.jsx)(q.Z,{message:(0,se.jsx)(ot,{children:X("blocklet.component.installingCanCloseWindowTip")}),increaseSpeed:.3,messageLoop:!1}):(0,se.jsx)("div",{style:{marginTop:120},children:(0,se.jsx)(I.Z,(0,s.Z)({},qe.installResultProps))})}),confirm:X("common.complete"),onConfirm:function(){Gn(Ge.componentDid),on(),setTimeout((function(){var e=document.getElementsByClassName("dashboard-main")[0];e&&(e.scrollTop=e.scrollHeight)}),200)}}].filter((function(e){return e})),pn=un[Ke]||{};return je?(0,se.jsxs)(Xn,{sx:He?{width:"100%",height:window.innerHeight}:{width:"100%",height:A?"72vh":"100vh"},children:[(0,se.jsx)(L.W,{steps:un,mode:"memory",children:(0,se.jsx)(Hn,{ref:We,meta:Ye,isMobile:He,onStepChange:function(e){ze(e)}})}),(0,se.jsxs)(N.Z,{className:"action-bar",children:[pn.cancel&&(0,se.jsx)(_.Z,{onClick:function(e){e.stopPropagation(),pn.onCancel()},disabled:Ke===un.length-2&&ee,color:"inherit",children:pn.cancel||X("common.cancel")}),pn.confirm&&(0,se.jsx)(_.Z,{onClick:function(e){e.stopPropagation(),pn.onConfirm()},color:"primary","data-cy":"submit-confirm-next",disabled:ee||("boolean"===typeof pn.disabled?pn.disabled:!(!ee&&!pn.error&&qe.bundleDid)||Ke>1&&!qe.pathPrefix),variant:"contained",autoFocus:!0,title:pn.confirm,style:{marginLeft:8,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",minWidth:"140px",maxWidth:"280px",textAlign:"center"},children:(0,se.jsxs)(N.Z,{display:"flex",alignItems:"center",children:[("boolean"===typeof pn.loading?pn.loading:ee)&&(0,se.jsx)(C.Z,{style:{marginRight:8},size:16}),pn.confirm]})})]})]}):null}Yn.propTypes={onClose:p().func,mode:p().oneOf(["normal","embed"]),inDialog:p().bool,stores:p().arrayOf(p().string),resourceType:p().string,storageKey:p().string},Yn.defaultProps={onClose:function(){},mode:"normal",stores:[],resourceType:"",storageKey:"",inDialog:!0};var Xn=(0,T.Z)(N.Z)(Dn||(Dn=(0,o.Z)(["\n .action-bar {\n display: flex;\n justify-content: flex-end;\n position: sticky;\n bottom: 0;\n padding-top: 16px;\n z-index: 100;\n width: 100%;\n background: #fff;\n border-top: 1px solid #eee;\n }\n"]))),Qn=(0,T.Z)(j.Z)(Un||(Un=(0,o.Z)(["\n width: 100%;\n height: 100%;\n"]))),Jn=T.Z.div(Ln||(Ln=(0,o.Z)(["\n width: 100%;\n height: 100%;\n display: flex;\n flex-direction: column;\n justify-content: flex-start;\n align-items: flex-start;\n\n .bottom-button {\n min-width: 200px;\n }\n\n // blocklet-select-side\n aside {\n width: 140px;\n }\n"]))),$n=function(e){return e.isMobile?"\n height: calc(100vh - 56px - 64px - 48px);\n ":""},et=(0,T.Z)(N.Z)(Nn||(Nn=(0,o.Z)(["\n ","\n\n & .flex-justify-center {\n display: flex;\n justify-content: center;\n }\n\n & .flex-align-center {\n display: flex;\n height: 100%;\n align-items: center;\n ","\n }\n\n & .agreement-wrapper {\n ","\n max-height: 60vh;\n .eula-trigger {\n padding-right: 0;\n }\n .next-button {\n display: none;\n }\n }\n\n & .connect {\n background: white;\n }\n"])),(function(e){return"mobileStyle"===e.className?"\n & > div{\n height: 100%;\n }\n .root-header {\n .app-name-content {\n display: none;\n }\n }\n\n\n\n // content-panel\n .root-header + div{\n padding-top: 0;\n position: relative;\n & > div {\n padding-top: 0;\n }\n }\n\n header + div {\n padding-top: 0;\n }\n\n header {\n .header-title {\n margin-left: 0;\n }\n\n .header-title-name {\n max-width: 100% !important;\n }\n }\n ":"\n position: relative;\n .root-header {\n z-index: auto !important;\n position: fixed !important;\n }\n & > div {\n height: 100%;\n width: 100%;\n max-width: 100%;\n & > div {\n max-height: unset !important;\n max-width: 100%;\n & > div {\n // left-panel\n &:first-child {\n padding: 0;\n width: 25%;\n min-width: 240px;\n & > div:first-child {\n display: none;\n }\n // step\n & > div:last-child {\n // margin-top: 32px;\n margin-top: 0;\n }\n }\n // right-panel\n &:last-child {\n padding-top: 0;\n padding-right: 0px;\n overflow-y: auto;\n .app-content {\n padding: 0 0 24px 0;\n }\n .button-container {\n padding-right: 0;\n }\n }\n }\n }\n }\n\n "}),(function(e){return $n(e)}),(function(e){return $n(e)})),nt=(0,T.Z)(k.Z)(Bn||(Bn=(0,o.Z)(["\n margin-bottom: 24px;\n"]))),tt=T.Z.div(_n||(_n=(0,o.Z)(["\n position: relative;\n\n .choose-blocklet {\n background-color: rgb(236, 251, 253);\n border-color: rgb(236, 251, 253);\n border-radius: 8px;\n }\n\n .check-container {\n position: absolute;\n right: 0;\n bottom: 0;\n display: flex;\n justify-content: flex-end;\n align-items: flex-end;\n width: 30px;\n height: 30px;\n border-radius: 0 0 8px 0;\n color: ",";\n overflow: hidden;\n transition: all ease 0.3s;\n &:after {\n position: absolute;\n z-index: 0;\n display: block;\n width: 0;\n height: 0;\n border-top: transparent solid 15px;\n border-left: transparent solid 15px;\n border-bottom: "," solid 15px;\n border-right: "," solid 15px;\n transition: all ease 0.1s;\n content: '';\n }\n\n .check-icon {\n position: relative;\n z-index: 2;\n margin: 0 1px 1px 0;\n font-size: 16px;\n transition: all ease 0.2s;\n }\n }\n"])),(function(e){return e.theme.palette.common.white}),(function(e){return e.theme.palette.primary.main}),(function(e){return e.theme.palette.primary.main})),ot=T.Z.div(Fn||(Fn=(0,o.Z)(["\n color: ",";\n .msg-before {\n display: inline-block;\n color: #aaa;\n font-size: 14px;\n margin-right: 6px;\n }\n"])),(function(e){return e.theme.palette.primary.main}))},52654:function(e,n,t){"use strict";t.d(n,{Rw:function(){return u},fX:function(){return s},sf:function(){return d}});var o=t(20244),r=t(60966),i=t.n(r),a=t(59505),l=t(22351),c=function(e,n){if(e.type===o.ROUTING_RULE_TYPES.REDIRECT){if(!e.url)return new Error("".concat(n("router.validation.redirectUrlRequired")));if(!e.redirectCode)return new Error("redirect ".concat(n("router.validation.redirectCodeRequired")))}else if(e.type===o.ROUTING_RULE_TYPES.BLOCKLET&&!e.did)return new Error(n("router.validation.didRequired"));return null},s=function(e,n){var t=c(e,n);return t||(e.pathPrefix.length?e.pathPrefix.length>150?new Error(n("router.validation.pathPrefixTooLong",{length:150})):null:new Error(n("router.validation.pathPrefixCannotBeEmpty")))},u=function(e){var n=e.params,t=e.blocklets,o=e.blocklet,r=e.locale,c=void 0===r?"en":r;if(o){var s=(o.children||[]).find((function(e){return(0,l.default)(e.meta)&&i()(e.mountPoint,n.pathPrefix)}));if("gateway"!==o.meta.group&&"/"===n.pathPrefix&&(s="/"),s)return{zh:"\u6302\u8f7d\u70b9 ".concat(n.pathPrefix," \u5df2\u5b58\u5728\uff0c\u8bf7\u4f7f\u7528\u5176\u4ed6\u6302\u8f7d\u70b9"),en:"The mount point ".concat(n.pathPrefix," already exist, please use another mount point")}[c]}var u=t.find((function(e){return e.meta.did===n.did}));if(!u)return"";var d=u.meta.interfaces.find((function(e){return"web"===e.type}));return d&&d.prefix!==a.BLOCKLET_DYNAMIC_PATH_PREFIX&&n.pathPrefix!==d.prefix?{zh:"\u8be5 blocklet \u53ea\u80fd\u6302\u8f7d\u5728 ".concat(d.prefix),en:"This blocklet can only be mounted on ".concat(d.prefix)}[c]:""},d=function(e){if(!e||"string"!==typeof e)return e;var n=e.trim();try{return(n=n.toLowerCase()).startsWith("http://")||n.startsWith("https://")?new URL(n).hostname:n}catch(t){return console.error("format domain failed",t),n}}},73820:function(e,n,t){"use strict";t.d(n,{Z:function(){return p}});var o=t(33028),r=t(59740),i=t(30969),a=t(24974),l=t.n(a),c=t(99631),s=t(26022),u=t(37574),d=["children"];function p(e){var n=e.children,t=(0,r.Z)(e,d),a=(0,i.useContext)(s.RD).t;return(0,u.jsx)(c.Z,(0,o.Z)((0,o.Z)({tip:a("common.copyTip"),copiedTip:a("common.copiedTip")},t),{},{children:n}))}p.propTypes={children:l().any.isRequired}},25371:function(e,n,t){"use strict";t.d(n,{Z:function(){return m}});var o=t(33028),r=t(24974),i=t.n(r),a=t(33359),l=t(87006),c=t(18877),s=t(26022),u=t(73820),d=t(8479),p=t(37574);function m(e){var n=e.title,t=e.description,r=e.confirmPlaceholder,i=e.cancel,m=e.confirm,f=e.params,h=e.onCancel,v=e.onConfirm,x=e.keyName,g=(0,s.PE)().t,y={title:function(){return(0,p.jsxs)("div",{children:[n," (".concat(x,")")]})},description:function(e,n){return(0,p.jsxs)("div",{children:[(0,p.jsx)(c.Z,{severity:"warning",style:{width:"100%"},children:g("common.notice")}),(0,p.jsx)("div",{style:{marginTop:24,marginBottom:24},dangerouslySetInnerHTML:{__html:t}}),(0,p.jsxs)("div",{style:{marginBottom:24},children:[g("common.click"),"\uff1a",(0,p.jsx)(u.Z,{"data-cy":"click-copy",children:x})]}),(0,p.jsx)(a.Z,{component:"div",children:(0,p.jsx)(l.Z,{label:r,autoComplete:"off","data-cy":"delete-confirm-input",variant:"outlined",fullWidth:!0,autoFocus:!0,value:e.inputVal,onChange:function(t){var r;r=(0,o.Z)((0,o.Z)({},e),{},{inputVal:t.target.value,__disableConfirm:x!==t.target.value}),n((0,o.Z)((0,o.Z)({},r),{},{__disableConfirm:r.__disableConfirm}))}})})]})},confirm:m,cancel:i,onConfirm:v,onCancel:h,params:(0,o.Z)({inputVal:"",__disableConfirm:!0},f)};return(0,p.jsx)(d.Z,{title:y.title,description:y.description,confirm:y.confirm,cancel:y.cancel,params:y.params,onConfirm:y.onConfirm,onCancel:y.onCancel})}m.propTypes={title:i().any.isRequired,keyName:i().any.isRequired,description:i().any.isRequired,confirmPlaceholder:i().any.isRequired,cancel:i().string,confirm:i().string,params:i().object,onCancel:i().func,onConfirm:i().func.isRequired},m.defaultProps={onCancel:function(){},cancel:"",confirm:"Confirm",params:{}}},36558:function(e,n,t){"use strict";var o=t(33028),r=t(59740),i=t(24974),a=t.n(i),l=t(86822),c=t(19638),s=t(23586),u=t(37574),d=["did","href","external","avatarProps"];function p(e){var n=e.did,t=e.href,i=e.external,a=(e.avatarProps,(0,r.Z)(e,d)),p=(0,u.jsx)(s.Z,(0,o.Z)({did:n},a));return t?i?(0,u.jsx)(c.Z,{target:"_blank",href:t,underline:"hover",children:p}):(0,u.jsx)(l.rU,{to:t,children:p}):p}p.propTypes={did:a().string.isRequired,to:a().string,href:a().string,avatarProps:a().object,external:a().bool},p.defaultProps={to:"",href:"",avatarProps:{},external:!1},n.Z=p},7768:function(e,n,t){"use strict";t.d(n,{K_:function(){return o},WC:function(){return r},fx:function(){return i}});var o="blocklet-add-component-registry",r="server-add-registry",i=function(e){return"resource-".concat(e,"-add-registry")}}}]);
2
+ //# sourceMappingURL=371.5ff795df.chunk.js.map
@@ -1,2 +1,2 @@
1
- "use strict";(self.webpackChunk_abtnode_blocklet_services=self.webpackChunk_abtnode_blocklet_services||[]).push([[4023],{94785:function(n,e,t){var i=t(38636).default,o=t(73408).default,r=t(814).default,a=this&&this.__importDefault||function(n){return n&&n.__esModule?n:{default:n}};Object.defineProperty(e,"__esModule",{value:!0}),e.splitNavigationBySection=e.flattenNavigation=e.checkLink=e.joinLink=e.cleanOrphanNavigation=e.filterNavigation=e.nestNavigationList=e.isMatchSection=e.deepWalk=e.parseNavigation=void 0;var l=a(t(8566)),c=a(t(15888)),s=a(t(49735)),u=a(t(60523)),d=a(t(88674)),f=a(t(74082)),v=a(t(19611)),m=a(t(22523)),p=a(t(34155)),h=t(50576),g=a(t(22351)),x=t(88617);Object.defineProperty(e,"checkLink",{enumerable:!0,get:function(){return x.checkLink}});var k="header",b="/",j="/",Z="/";function y(n){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){},t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=t.key,o=void 0===i?"children":i,r=t.order,a=void 0===r?"first":r;!function n(t){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=i.index,l=void 0===r?0:r,c=i.parent,s=void 0===c?null:c,u=i.level,d=void 0===u?0:u;Array.isArray(t)?t.forEach((function(e,t){n(e,{index:t,parent:s,level:d+1})})):t&&("first"===a&&e(t,s,{index:l,level:d}),n(t[o],{parent:t,level:d}),"last"===a&&e(t,s,{index:l,level:d}))}(n)}function L(n,e){return!(e!==k||!(0,u.default)(n))||(Array.isArray(n)?n.includes(e):n===e)}function N(n){try{return JSON.parse(n)}catch(e){return n}}function S(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"/",e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";if((0,p.default)(e||""))return e;var t=m.default.join(n,e||j);return t.length>1&&t.endsWith("/")?t.slice(0,t.length-1):t}function w(n,e){var t=(arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}).strict,i=n,r=e;return void 0===t||t||(i=i||"/",r=r||"/"),(0,h.isObject)(i)&&(0,h.isString)(r)&&(0,x.checkLink)(r)?Object.keys(i).reduce((function(n,e){return n[e]=S(i[e],r),n}),{}):(0,h.isString)(i)&&(0,x.checkLink)(i)&&(0,h.isObject)(r)?Object.keys(r).reduce((function(n,e){return n[e]=S(i,r[e]),n}),{}):(0,h.isString)(i)&&(0,h.isString)(r)?(0,x.checkLink)(i)||(0,x.checkLink)(r)?S(i,r):r:(0,h.isObject)(i)&&(0,h.isObject)(r)?o(new Set([].concat(o(Object.keys(i)),o(Object.keys(r))))).reduce((function(n,e){return n[e]=S(i[e],r[e]),n}),{}):r}function C(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},t=e.depth,i=void 0===t?1:t,r=e.transform,a=void 0===r?function(n){return n}:r,l=(0,f.default)(n),c=[];return y(l,(function(n,e,t){var r=t.level;if(r>=i){var l=n.items,s=void 0===l?[]:l;if(s&&Array.isArray(s)&&s.length>0){delete n.items;var u=s.map((function(e){return a(e,n)}));if(e){var f;(f=e.items).push.apply(f,o(u))}else{var v=a((0,d.default)(n,["items"]),e);c.push.apply(c,[v].concat(o(u)))}}else if(1===r){var m=a((0,d.default)(n,["items"]),e);c.push(m)}}else 1===r&&c.push(n)}),{key:"items",order:"last"}),c}function P(n){var e,t=(0,f.default)(n),a=[],l=i(t);try{var c=function(){var n=e.value,t=(0,f.default)((0,d.default)(n,["items"])),l=[];function c(n,e){var i=function(n,e){return e&&Array.isArray(n.items)?n.items.filter((function(t){return(0,u.default)(t.section)?L(n.section,e):!!L(t.section,e)})).map((function(n){return r(r({},n),{},{section:e})})):[]}(n,e);l.push(r(r({},t),{},{section:e,items:i}))}if(Array.isArray(n.section)){var s,v=i(n.section);try{for(v.s();!(s=v.n()).done;){c(n,s.value)}}catch(x){v.e(x)}finally{v.f()}}else if(n.section){c(n,n.section)}else if(n.items&&n.items.length>0){var m,p=n.items.reduce((function(n,e){var t=(e||{}).section,i=void 0===t?[k]:t;return n.push.apply(n,o(i)),n}),[]),h=o(new Set(p)),g=i(h);try{for(g.s();!(m=g.n()).done;){c(n,m.value)}}catch(x){g.e(x)}finally{g.f()}}else l.push(r(r({},n),{},{section:k}));a.push.apply(a,l)};for(l.s();!(e=l.n()).done;)c()}catch(s){l.e(s)}finally{l.f()}return a}function O(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=(0,f.default)(n);return e.reduceRight((function(n,t,i){if(t.parent){var r=e.find((function(n){return t.section&&n.section?n.section===t.section&&n.id===t.parent:n.id===t.parent}));r&&(r.items||(r.items=[]),r.items=[t].concat(o(r.items))),e.splice(i,1)}return null}),null),e}e.deepWalk=y,e.isMatchSection=L,e.joinLink=function(n,e){var t=(0,f.default)(n);return y(t,(function(n,t){var i=n.component||n.child;if(i){var o=e.find((function(n){return n.name===i}));o&&(n.link=w(o.link,n.link,{strict:!1}))}else t&&(n.link=w(t.link,n.link))}),{key:"items"}),t},e.flattenNavigation=C,e.splitNavigationBySection=P,e.nestNavigationList=O,e.filterNavigation=function(n){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],t=O(n);return y(t,(function(n){if(null!==n&&void 0!==n&&n.component&&(e.some((function(e){return e.name===n.component}))||(n.visible=!1)),n.items&&n.items.length)for(var t=n.items.length-1;t>=0;t--)!1===n.items[t].visible&&n.items.splice(t,1)}),{key:"items"}),t.filter((function(n){var e;return!1!==n.visible&&!(n.items&&Array.isArray(n.items)&&n.items.length>0&&null!==(e=n.items)&&void 0!==e&&e.every((function(n){return!1===n.visible})))}))},e.cleanOrphanNavigation=function(n){return n.map((function(n){return n.items&&Array.isArray(n.items)&&1===n.items.length&&["header","footer","",void 0,null].includes(n.section)?n.items[0]:n}))},e.parseNavigation=function(){var n,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).beforeProcess,a=void 0===t?function(n){return n}:t,u=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=[],t=function t(a){var l,c,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},u=[],d=a.children,m=void 0===d?[]:d,p=a.meta,h=void 0===p?{}:p,x=(0,f.default)((null===h||void 0===h?void 0:h.navigation)||[]);(0,g.default)(h)&&!1!==(null===(l=a.meta)||void 0===l||null===(c=l.capabilities)||void 0===c?void 0:c.navigation)&&u.push.apply(u,o(x));var Z,y=s.name||"",L=s.mountPoint||b,N=a===n?"":h.name||"",S=a===n?"":a.mountPoint||b,w=i(m);try{var C=function(){var n,i,a,l,c=Z.value;if(!(0,g.default)(c.meta))return"continue";var s=c.meta.name,d=c.mountPoint,f=[y,N,s].filter(Boolean).join("."),m=c.meta.navigation||[],p=(0,v.default)(L,S,d);!1!==(null===(n=c.meta)||void 0===n||null===(i=n.capabilities)||void 0===i?void 0:i.navigation)&&e.push({did:c.meta.did,name:f,link:p,title:c.meta.title||"",navigation:m.map((function(n){return r({section:k},n)}))});var h=x.find((function(n){return!!n.component&&n.component===s}));if(h){if(!h.link)if(c.meta.navigation&&c.meta.navigation.length>0){var b,w,C=t(c,{mountPoint:S,name:N});C.length>0&&(h.items=null!==(b=h.items)&&void 0!==b?b:[],(w=h.items).push.apply(w,o(C)))}else h.link=j}else if(!1!==(null===(a=c.meta)||void 0===a||null===(l=a.capabilities)||void 0===l?void 0:l.navigation)){var P=t(c,{mountPoint:S,name:N}),O={title:c.meta.title,component:s,id:c.meta.did};P.length>0?(O.items=P,O.link=void 0):O.link=j,u.push(O)}};for(w.s();!(Z=w.n()).done;)C()}catch(P){w.e(P)}finally{w.f()}return u}(n);return{navigationList:t,components:e}}(e),d=u.navigationList,m=u.components,p=(null===e||void 0===e||null===(n=e.settings)||void 0===n?void 0:n.navigations)||[],h=function(n){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2,t=C((0,f.default)(n),{depth:e,transform:function(n,e){var t;return e&&(n._parent||(n._parent=e.id,e.component||(n.link=w(e.link,n.link))),n.section=n.section||e.section||[k],n.visible=null!==(t=n.visible)&&void 0!==t?t:e.visible),n.component=[e.component,n.component].filter(Boolean).join("."),n}});return y(t,(function(n){n.items&&n.items.length>0&&n.items.reduceRight((function(e,t){if(t._parent){var i=n.items.findIndex((function(n){return n.id===t._parent}));i>=0&&n.items.splice(i,1),delete t._parent}return null}),null)}),{key:"items"}),t}(a(d)),x=C(P(function(n){var e=(0,f.default)(n).filter((function(n){return n.id}));return y(e,(function(n,e){var t;if(n.items&&n.items.length){for(var i=n.items.length-1;i>=0;i--)n.items[i].id||n.items.splice(i,1);0===n.items.length&&n.component&&(n.link=n.link||j)}e&&(n.parent=e.id,n.id=[e.id,n.id].join(Z)),n.from=n.from||"yaml",n.visible=null===(t=n.visible)||void 0===t||t}),{key:"items"}),e}(h)).reduce((function(n,e){var t=["bottom","social","sessionManager"].includes(e.section),i=!1,a=m.find((function(n){return"/"===n.link}));if(a&&e.id===a.did&&(i=!0),t||i){if(e.items&&e.items.length>0)return n.push.apply(n,o(e.items.map((function(n){var t=e.section,i=w(e.link,n.link),o=[e.component,n.component].filter(Boolean).join(".");return r(r({},n),{},{section:t,link:i,component:o,parent:""})})))),n;if(i)return n}return n.push(e),n}),[]),{transform:function(n,e){var t=n.component;return null!==e&&void 0!==e&&e.component&&(t=[e.component,n.component].filter(Boolean).join(".")),r(r({},n),{},{component:t})}});return{navigationList:(0,l.default)(p.map((function(n){var e=r({},n);return e.role&&(e.role=N(e.role)),e.section&&(e.section=N(e.section)),e.title&&(e.title=N(e.title)),e.link&&(e.link=N(e.link)),e})),x,(function(n,e){var t=["id","section"];return(0,c.default)((0,s.default)(n,t),(0,s.default)(e,t))})),components:m,builtinList:x}}},4023:function(n,e,t){t.r(e),t.d(e,{default:function(){return xe}});var i=t(33028),o=t(32723),r=t(34795),a=t(30969),l=t(38361),c=t(72097),s=t(27265),u=t(87535),d=t(51385),f=t(2689),v=t(75255),m=t(46672),p=t(39130),h=t(56277),g=t(33359),x=t(39491),k=t(1986),b=t(96628),j=t(28595),Z=t(50496),y=t(26022),L=t(82972),N=t(61398),S=t.n(N),w=t(24974),C=t.n(w),P=t(67780),O=t(69241),E=t.n(O),A=t(74274),R=t.n(A),T=t(15888),_=t.n(T),I=t(96605),M=t(42821),D=t(37574);function W(n){var e=n.prevPath,t=n.nextPath,i=e.length,o=t.length;return!(i!==o||!_()(e.slice(0,i-1),t.slice(0,o-1)))}function z(n){var e=n.treeNode,t=(0,y.PE)().locale;return(0,D.jsxs)(D.Fragment,{children:[e.icon&&(0,D.jsx)(b.JO,{style:{marginRight:4},icon:e.icon}),function(){var n=e.title,i=e.subtitle,o=n,r=i;return R()(n)&&(o=n[t]),!(0,a.isValidElement)(i)&&R()(i)&&(r=i[t]),(0,D.jsxs)(l.Z,{display:"flex",alignItems:"center",children:[(0,D.jsx)(g.Z,{variant:"subtitle1",fontSize:16,children:o}),i&&(0,D.jsx)(g.Z,{variant:"body2",color:"gray",ml:1.5,lineHeight:1,children:r})]})}()]})}function J(n){var e=n.treeData,t=n.setTreeData,o=n.renderActions,r=e.map((function(n){return(0,i.Z)((0,i.Z)({},n),{},{expanded:!0})})),a={};return"undefined"!==typeof window&&(a.context=window),(0,D.jsx)(M.W,(0,i.Z)((0,i.Z)({backend:I.HTML5Backend},a),{},{children:(0,D.jsx)(P.oP,{generateNodeProps:function(n){return{buttons:o({data:n.node,className:"list-item-actions"}),icons:(0,D.jsx)(b.JO,{icon:"ic:round-drag-indicator"}),title:(0,D.jsx)(z,{treeNode:n.node})}},maxDepth:2,isVirtualized:!1,treeData:r,onChange:t,canDrop:W,theme:E()})}))}z.propTypes={treeNode:C().object.isRequired},J.propTypes={treeData:C().object.isRequired,setTreeData:C().func,renderActions:C().func},J.defaultProps={setTreeData:function(){},renderActions:function(){}};var F=J,B=t(96234),q=t(56666),G=t(29996),V=t(74202),K=t(94551),H=t(4953),U=t(87006),Q=t(57982),Y=t(14546),X=t(88674),$=t.n(X),nn=t(49735),en=t.n(nn),tn=t(9669),on=t.n(tn),rn=t(75359),an=t.n(rn),ln=t(76032),cn=t.n(ln),sn=t(86446),un=t.n(sn),dn=t(74082),fn=t.n(dn),vn=t(13953),mn=t(94785),pn=t(19611),hn=t.n(pn),gn=t(43430),xn=t(34155),kn=t.n(xn),bn=t(59505),jn=t(68079),Zn=t(15914),yn=t(50576),Ln=t(3672),Nn=t(8288),Sn=t(83176),wn=t(59740),Cn=t(7173),Pn=t(98123),On=t(86008),En=t(33656),An=["fullWidth","multiple","required","label","placeholer","options","helperText","error","margin"];function Rn(n){var e=n.fullWidth,t=n.multiple,o=n.required,r=n.label,a=n.placeholer,c=n.options,s=n.helperText,v=n.error,m=n.margin,h=(0,wn.Z)(n,An),x=c.find((function(n){return n.value===h.value})),k=null===x||void 0===x?void 0:x.title;return(0,D.jsxs)(u.Z,{margin:m,fullWidth:e,error:v,children:[(0,D.jsx)(d.Z,{children:"".concat(r).concat(o?"*":"")}),(0,D.jsxs)(p.Z,(0,i.Z)((0,i.Z)({multiple:t,input:(0,D.jsx)(En.Z,{defaultValue:k,sx:{flex:1},required:o,label:r,inputProps:{margin:m}}),renderValue:function(n){if(t)return(0,D.jsx)(l.Z,{sx:{display:"flex",flexWrap:"wrap",gap:.5},children:n.map((function(n){var e=c.find((function(e){return e.value===n}));return e&&e.title&&(0,D.jsx)(Cn.Z,{size:"small",label:e.title},n)}))});var e=c.find((function(e){return e.value===n}));return e&&e.title&&(0,D.jsxs)(l.Z,{children:[(0,D.jsx)(g.Z,{component:"span",children:e.title}),(0,D.jsx)(g.Z,{marginLeft:1,component:"span",variant:"body2",color:"text.secondary",children:e.description})]})}},h),{},{children:[(0,D.jsx)(f.Z,{disabled:!0,children:(0,D.jsx)("em",{children:a})}),!t&&(0,D.jsx)(f.Z,{value:"",children:"None"}),c.map((function(n){return n&&n.value&&(0,D.jsxs)(f.Z,{value:n.value,children:[(0,D.jsx)(On.Z,{children:n.title}),n.description&&(0,D.jsx)(g.Z,{variant:"body2",color:"text.secondary",children:n.description})]},n.value)}))]})),(0,D.jsx)(Pn.Z,{children:s})]})}Rn.propTypes={error:C().bool,required:C().bool,multiple:C().bool,fullWidth:C().bool,label:C().string,placeholer:C().string,options:C().array,helperText:C().string,margin:C().string},Rn.defaultProps={error:!1,required:!1,multiple:!1,fullWidth:!1,label:"",placeholer:"",options:[],helperText:"",margin:""};var Tn=Rn,_n="en";function In(n){var e=n.sx,t=n.onAdd,i=n.onChange,o=n.locales,r=n.localeMap,s=n.onRemoveLocale,u=(0,y.PE)().t,d=(0,a.useRef)(),f=(0,a.useState)(null),v=(0,B.Z)(f,2),m=v[0],p=v[1],h=(0,j.Z)({currentLocale:_n,localeList:[],inputLocale:"",localeError:""}),x=(0,a.useMemo)((function(){return!!m}),[m]),k=(0,a.useMemo)((function(){return o.includes(h.currentLocale)?h.currentLocale:_n}),[o,h.currentLocale]),Z=(0,a.useMemo)((function(){return Object.keys((0,yn.omit)(r,[].concat((0,jn.Z)(h.localeList),[_n]))).map((function(n){return{title:r[n],value:n}}))}),[h.localeList]);function L(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",e=function(n){return n?"en"!==n&&!h.localeList.includes(n)||u("navigation.form.localeExists",{value:n}):u("common.requiredErrorText",{name:"Locale"})}(null===n||void 0===n?void 0:n.trim());return h.localeError=!0!==e?e:"",e}function N(){var n,e=null===(n=h.inputLocale)||void 0===n?void 0:n.trim();!0===L(e)&&(S(),h.localeList.push(e),h.currentLocale=e,t(e))}function S(){p(null),h.inputLocale="",h.localeError=""}return(0,a.useEffect)((function(){h.localeList=(0,jn.Z)(o)}),[o,h]),(0,Zn.Z)("enter",(function(){setTimeout((function(){N()}))}),{target:d}),(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(Ln.Z,{sx:e,value:k,onChange:function(n,e){h.currentLocale=e,i(e)},children:[(0,D.jsx)(Nn.Z,{label:"Default (".concat(r[_n],")"),value:"en"}),h.localeList.map((function(n){return(0,D.jsx)(Nn.Z,{sx:{position:"relative"},label:(0,D.jsxs)(D.Fragment,{children:[r[n],(0,D.jsx)(K.Z,{size:"small",color:"inherit",sx:{position:"absolute",top:0,right:0},onClick:function(e){!function(n,e){n.preventDefault(),n.stopPropagation(),h.localeList=(0,yn.without)(h.localeList,e),s(e),e===h.currentLocale&&(h.currentLocale=_n)}(e,n)},children:(0,D.jsx)(b.JO,{icon:"mdi:close",height:14})})]}),value:n},n)})),(0,D.jsx)(K.Z,{color:"primary",disableFocusRipple:!0,sx:{width:"48px"},onClick:function(n){p(n.currentTarget)},children:(0,D.jsx)(b.JO,{icon:"mdi:plus"})})]}),(0,D.jsx)(Sn.ZP,{open:x,anchorEl:m,onClose:S,anchorOrigin:{vertical:"bottom",horizontal:"left"},children:(0,D.jsxs)(l.Z,{sx:{p:2,width:"270px"},children:[(0,D.jsx)(g.Z,{variant:"subtitle2",children:u("navigation.form.localePlaceholder")}),(0,D.jsx)(l.Z,{mt:1,children:(0,D.jsx)(Tn,{required:!0,fullWidth:!0,label:"Locale",value:h.inputLocale,options:Z,onChange:function(n){var e=n.target.value;L(e),h.inputLocale=e},error:!!h.localeError,helperText:h.localeError||" "})}),(0,D.jsx)(l.Z,{display:"flex",justifyContent:"flex-end",children:(0,D.jsx)(c.Z,{size:"small",variant:"contained",onClick:N,children:u("common.confirm")})})]})})]})}In.propTypes={sx:C().any,onAdd:C().func,onChange:C().func,onRemoveLocale:C().func,localeMap:C().object,locales:C().array},In.defaultProps={sx:null,onAdd:function(){},onChange:function(){},onRemoveLocale:function(){},localeMap:{},locales:[]};var Mn=In,Dn=t(80670),Wn=t(45008),zn="en",Jn={title:(0,q.Z)({},zn,""),link:(0,q.Z)({},zn,"")};function Fn(n){var e=n.icon,t=(0,a.useState)(!1),i=(0,B.Z)(t,2),l=i[0],c=i[1];return(0,Q.Z)((0,r.Z)((0,o.Z)().mark((function n(){return(0,o.Z)().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return c(!1),n.next=3,(0,b.GL)(e);case 3:c(!0);case 4:case"end":return n.stop()}}),n)}))),[e]),e?l?(0,D.jsx)(b.JO,{icon:e}):(0,D.jsx)(b.JO,{color:"#f06f6e",icon:"ic:baseline-error"}):(0,D.jsx)(b.JO,{icon:"codicon:blank"})}Fn.propTypes={icon:C().string.isRequired};var Bn=(0,a.forwardRef)((function(n,e){var t=n.section,c=n.components,s=n.rawNavigations,d=(0,Dn.DJ)().roles,f=(0,y.PE)(),v=f.t,m=f.locale,p=(0,Wn.y0)().blocklet.environments.find((function(n){return"BLOCKLET_APP_LANGUAGES"===n.key})),h=(p?p.value.split(","):["en","zh"]).filter((function(n){return bn.SUPPORTED_LANGUAGES[n]})).reduce((function(n,e){return n[e]=bn.SUPPORTED_LANGUAGES[e].nativeName,n}),{}),x=(0,a.useRef)((function(){})),L=(0,Y.Z)(!1),N=(0,B.Z)(L,2),S=N[0],w=N[1],C=w.setFalse,P=w.setTrue,O=(0,j.Z)({isRoot:!0,type:"add",linkDisabled:!1,locale:zn,formState:fn()(Jn),get localeList(){return an()(Object.keys(this.formState.title),zn)}}),E=(0,vn.cI)({mode:"onChange",defaultValues:{id:void 0,title:void 0,icon:void 0,link:void 0,component:void 0,parent:void 0,role:[]}}),A=E.handleSubmit,T=E.control,_=E.watch,I=E.setValue,M=E.clearErrors,W=E.formState.errors;(0,a.useEffect)((function(){I("title",O.formState.title[O.locale]),I("link",O.formState.link[O.locale])}),[I,O.locale,S]);var z=_("component"),J=_("title"),F=_("link"),Q=_("icon"),X=_("parent");(0,a.useEffect)((function(){O.formState.title[O.locale]=J}),[J]),(0,a.useEffect)((function(){O.formState.link[O.locale]=F}),[F]);var nn=(0,a.useMemo)((function(){return s.find((function(n){return z?c.find((function(n){return n.name===z})).did===n.id:n.id===X}))}),[c,s,z,X]),tn=(0,a.useMemo)((function(){if(null!==nn&&void 0!==nn&&nn.component){var n=(c.find((function(n){return n.name===nn.component}))||{}).link,e=R()(n)?n[O.locale]:n;if(z)return(0,gn.QT)(e);var t=R()(nn.link)?nn.link[O.locale]:nn.link;return(0,gn.QT)(hn()(e,t||"/"))}return null}),[c,O.locale,nn,z]),rn=(0,a.useMemo)((function(){var n=(nn||{}).component,e=(c.find((function(e){return e.name===n}))||{}).navigation,i=void 0===e?[]:e;return(0,mn.flattenNavigation)(i,{transform:function(n,e){return null!==e&&void 0!==e&&e.section&&(n.section=n.section||e.section),n}}).filter((function(n){return n.link})).filter((function(n){return(0,mn.isMatchSection)(n.section,t)})).map((function(n){return{label:n.link,title:n.title[m]||n.title}}))}),[nn,c,t,m]),ln=(0,a.useMemo)((function(){var n={add:v("common.create"),edit:v("common.edit")}[O.type];return n?"".concat(n," ").concat(v("navigation.navigation")):"--"}),[O.type,v]),sn=(0,a.useCallback)((function(){O.isRoot=!0,O.locale=zn,O.type="add",O.linkDisabled=!1,x.current=function(){},I("id",void 0),I("icon",void 0),I("title",void 0),I("link",void 0),I("component",void 0),I("parent",void 0),I("role",[]),O.formState=fn()(Jn),M()}),[M,I,O]),dn=(0,a.useCallback)((function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return O.localeList.length>0&&(new Set(on()(O.formState.title)).size>1&&(n.title=O.formState.title),new Set(on()(O.formState.link)).size>1&&(n.link=O.formState.link)),cn()(n.role)&&(n.role=void 0),n}),[O.formState.link,O.formState.title,O.localeList]),pn=(0,a.useCallback)((function(){C(),setTimeout((function(){sn()}))}),[sn,C]),xn=(0,a.useCallback)((function(){var n=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).parent,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){};O.type="add",O.isRoot=!n,I("parent",null===n||void 0===n?void 0:n.id),x.current=function(n){e(pn,n)},P()}),[pn,P,I,O]),jn=(0,a.useCallback)((function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){},t=n.id,i=n.title,o=n.icon,r=n.link,a=n.parent,l=n.component,c=n.role,s=void 0===c?[]:c;I("id",t),I("icon",o),"tmpl"===n.from&&(O.linkDisabled=!0),un()(i)?O.formState.title=O.localeList.reduce((function(n,e){return n[e]=i,n}),(0,q.Z)({},zn,i)):R()(i)?O.formState.title=fn()(i):O.formState.title={},un()(r)?O.formState.link=O.localeList.reduce((function(n,e){return n[e]=r,n}),(0,q.Z)({},zn,r)):R()(r)?O.formState.link=fn()(r):O.formState.link={},I("component",l),I("parent",a),I("role",s||[]),P(),O.type="edit",O.isRoot=!a,x.current=function(n){var t=en()(n,["id","title","icon","link","role"]);e(pn,t)}}),[pn,P,I,O]);function Zn(n){var e=null===n||void 0===n?void 0:n.trim();return e?!(e.length>24)||v("navigation.form.titleTooLong",{len:24}):v("common.requiredErrorText",{name:v("navigation.form.title")})}function yn(){return(yn=(0,r.Z)((0,o.Z)().mark((function n(e){var t;return(0,o.Z)().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(!(t=null===e||void 0===e?void 0:e.trim())){n.next=10;break}return n.prev=2,n.next=5,(0,b.GL)(t);case 5:n.next=10;break;case 7:return n.prev=7,n.t0=n.catch(2),n.abrupt("return",v("navigation.form.invalidIcon"));case 10:return n.abrupt("return",!0);case 11:case"end":return n.stop()}}),n,null,[[2,7]])})))).apply(this,arguments)}function Ln(n){var e=null===n||void 0===n?void 0:n.trim();return e?!!(0,mn.checkLink)(e)||v("navigation.form.invalidLink"):!!O.isRoot||v("common.requiredErrorText",{name:v("navigation.form.link")})}(0,a.useImperativeHandle)(e,(function(){return{add:xn,edit:jn,close:pn}}),[xn,pn,jn]);var Nn=(0,a.useCallback)((function(n){O.locale=n,O.formState.title[n]||(O.formState.title[n]=""),O.formState.link[n]||(O.formState.link[n]=""),setTimeout((function(){M()}))}),[M,O]),Sn=(0,a.useCallback)((function(){for(var n=O.formState,e=n.title,t=n.link,i=0,o=Object.keys(e);i<o.length;i++){var r=Zn(e[o[i]]);if(!0!==r)return r}for(var a=0,l=Object.keys(t);a<l.length;a++){var c=Ln(t[l[a]]);if(!0!==c)return c}return!0}),[O.formState]),wn=(0,a.useCallback)((function(n){var e=Sn();!0===e?x.current(dn(n)):k.Z.error(e)}),[Sn,dn]),Cn=(0,a.useCallback)((function(n){O.formState.title=$()(O.formState.title,n),O.formState.link=$()(O.formState.link,n)}),[O.formState]),Pn=(0,a.useCallback)((function(n){var e,t;O.locale=n,O.formState.title[n]=null===(e=O.formState.title)||void 0===e?void 0:e[zn],O.formState.link[n]=null===(t=O.formState.link)||void 0===t?void 0:t[zn],setTimeout((function(){M()}))}),[M,O]);return(0,D.jsxs)(Z.ZP,{open:S,title:ln,onClose:pn,actions:(0,D.jsx)(G.Z,{onClick:A(wn),color:"primary",autoFocus:!0,variant:"contained",children:v("common.confirm")}),children:[(0,D.jsx)(Mn,{sx:{mb:1},onAdd:Pn,onChange:Nn,onRemoveLocale:Cn,localeMap:h,locales:O.localeList}),(0,D.jsxs)("form",{noValidate:!0,autoComplete:"off",children:[(0,D.jsx)(vn.Qr,{name:"title",control:T,rules:{validate:Zn},render:function(n){var e,t,o=n.field;return(0,D.jsx)(U.Z,(0,i.Z)({fullWidth:!0,variant:"outlined",margin:"dense",required:!0,placeholder:v("navigation.form.titlePlaceholder"),label:v("navigation.form.title"),disabled:O.isEdit,error:!(null===W||void 0===W||null===(e=W.title)||void 0===e||!e.message),helperText:(null===W||void 0===W||null===(t=W.title)||void 0===t?void 0:t.message)||" "},o))}}),(0,D.jsx)(vn.Qr,{name:"icon",control:T,rules:{validate:function(n){return yn.apply(this,arguments)}},render:function(n){var e,t,o=n.field;return(0,D.jsx)(U.Z,(0,i.Z)((0,i.Z)({fullWidth:!0,variant:"outlined",margin:"dense",placeholder:v("navigation.form.iconPlaceholder"),label:v("navigation.form.icon"),error:!(null===W||void 0===W||null===(e=W.icon)||void 0===e||!e.message),disabled:O.locale!==zn,helperText:(null===W||void 0===W||null===(t=W.icon)||void 0===t?void 0:t.message)||(0,D.jsx)(l.Z,{display:"flex",children:(0,D.jsxs)(l.Z,{component:"a",href:"https://icones.js.org",target:"_blank",display:"flex",alignItems:"center",children:[v("navigation.form.findMoreIcon")," ",(0,D.jsx)(b.JO,{style:{marginLeft:4},icon:"radix-icons:external-link"})]})})},o),{},{InputProps:{endAdornment:(0,D.jsx)(H.Z,{position:"end",children:(0,D.jsx)(K.Z,{sx:{cursor:"default"},disableFocusRipple:!0,disableRipple:!0,children:Q&&(0,D.jsx)(Fn,{icon:Q})})})}}))}}),O.isRoot&&(0,D.jsx)(vn.Qr,{name:"component",control:T,render:function(n){var e,t,o=n.field;return(0,D.jsx)(Tn,(0,i.Z)({fullWidth:!0,margin:"dense",disabled:"edit"===O.type||O.locale!==zn,label:v("navigation.form.component"),placeholer:v("navigation.form.componentPlaceholder"),options:c.map((function(n){return{title:n.title,value:n.name,description:n.link}})),error:!(null===W||void 0===W||null===(e=W.component)||void 0===e||!e.message),helperText:(null===W||void 0===W||null===(t=W.component)||void 0===t?void 0:t.message)||" "},$()(o,"ref")))}}),(0,D.jsx)(vn.Qr,{name:"link",control:T,rules:{validate:Ln},render:function(n){var e=n.field;return(0,D.jsx)(u.Z,{fullWidth:!0,margin:"dense",children:(0,D.jsx)(V.Z,(0,i.Z)((0,i.Z)({disablePortal:!0,freeSolo:!0,blurOnSelect:!0,autoSelect:!0,fullWidth:!0,disabled:O.linkDisabled,isOptionEqualToValue:function(n){return n.label},options:rn,renderInput:function(n){var e,t;return(0,D.jsx)(U.Z,(0,i.Z)((0,i.Z)({},n),{},{placeholder:v("navigation.form.linkPlaceholder"),label:v("navigation.form.link"),error:!(null===W||void 0===W||null===(e=W.link)||void 0===e||!e.message),helperText:(null===W||void 0===W||null===(t=W.link)||void 0===t?void 0:t.message)||"/abc/bcd or /abc or https://arcblock.io",InputProps:{startAdornment:tn?(0,D.jsx)(H.Z,{position:"start",sx:{textDecoration:kn()(F||"")?"line-through":""},children:tn}):null}}))},renderOption:function(n,e){return(0,D.jsxs)(l.Z,(0,i.Z)((0,i.Z)({component:"li"},n),{},{children:[e.label,(0,D.jsx)(g.Z,{marginLeft:1,component:"span",variant:"body2",color:"text.secondary",children:e.title})]}))},margin:"dense"},e),{},{onChange:function(){},onInputChange:function(n,t){e.onChange(t)}}))})}}),["dashboard","sessionManager"].includes(t)&&(0,D.jsx)(vn.Qr,{name:"role",control:T,render:function(n){var e,t,o=n.field;return(0,D.jsx)(Tn,(0,i.Z)({fullWidth:!0,multiple:!0,margin:"dense",label:v("navigation.form.role"),placeholer:v("navigation.form.rolePlaceholder"),options:d.map((function(n){return{title:n.title,value:n.name}})),error:!(null===W||void 0===W||null===(e=W.role)||void 0===e||!e.message),helperText:(null===W||void 0===W||null===(t=W.role)||void 0===t?void 0:t.message)||" "},$()(o,"ref")))}})]})]})}));Bn.propTypes={section:C().string,components:C().array,rawNavigations:C().array},Bn.defaultProps={section:"",components:[],rawNavigations:[]};var qn=Bn;function Gn(n){var e=n.className,t=n.add,i=n.edit,o=n.toggle,r=n.del,l=n.data,c=n.section,s=(0,y.PE)().t,u=["yaml","tmpl"].includes(l.from),d=(0,a.isValidElement)(l.subtitle);function f(n){n.preventDefault(),n.stopPropagation()}var v=(0,a.useCallback)((function(n){f(n),t(l)}),[t,l]),m=(0,a.useCallback)((function(n){f(n),i(l)}),[i,l]),p=(0,a.useCallback)((function(n){f(n),o(l)}),[o,l]),h=(0,a.useCallback)((function(n){f(n),r(l)}),[r,l]);return(0,D.jsxs)("div",{className:e,children:[!l.parent&&["header","footer","dashboard"].includes(c)&&(0,D.jsx)("span",{title:s(d?"navigation.action.noAddSub":"navigation.action.addSub"),children:(0,D.jsx)(K.Z,{size:"small",color:"success",onClick:v,disabled:d,children:(0,D.jsx)(b.JO,{icon:"mdi:plus-box-outline"})})}),(0,D.jsx)("span",{title:s(d?"navigation.action.noEdit":"navigation.action.edit"),children:(0,D.jsx)(K.Z,{size:"small",color:"primary",onClick:m,disabled:d,children:(0,D.jsx)(b.JO,{icon:"mdi:pencil"})})}),(0,D.jsx)("span",{title:d?s("navigation.action.noEdit"):l.visible?s("navigation.action.hide"):s("navigation.action.show"),children:(0,D.jsx)(K.Z,{size:"small",color:"warning",onClick:p,disabled:d,children:!1===l.visible?(0,D.jsx)(b.JO,{icon:"mdi:eye-off-outline"}):(0,D.jsx)(b.JO,{icon:"mdi:eye-outline"})})}),(0,D.jsx)("span",{title:s(u&&!d?"navigation.action.noDel":"navigation.action.del"),children:(0,D.jsx)(K.Z,{disabled:u&&!d,size:"small",color:"error",onClick:h,children:(0,D.jsx)(b.JO,{icon:"mdi:delete"})})})]})}Gn.propTypes={data:C().object.isRequired,className:C().string,add:C().func,edit:C().func,toggle:C().func,del:C().func,section:C().string},Gn.defaultProps={className:"",add:function(){},edit:function(){},toggle:function(){},del:function(){},section:""};var Vn=Gn,Kn=t(60523),Hn=t.n(Kn),Un=t(70306),Qn=t.n(Un),Yn=t(20244),Xn=t(24891),$n="/",ne="header",ee={sessionManager:[{id:"/sessionManager",title:{en:"Manage",zh:"\u7ba1\u7406"},section:["sessionManager"],icon:"ion:settings-outline",link:"".concat(Yn.WELLKNOWN_SERVICE_PATH_PREFIX,"/admin"),role:["owner","admin"],from:"tmpl"}],dashboard:[{id:"/team",title:{en:"Access",zh:"\u8bbf\u95ee\u63a7\u5236"},role:["owner","admin","member"],section:["dashboard"],link:"",from:"tmpl",items:[{id:"member",title:{en:"Members",zh:"\u6210\u5458"},icon:"ant-design:user-outlined",link:"".concat(Yn.WELLKNOWN_SERVICE_PATH_PREFIX,"/admin/members"),from:"tmpl"},{id:"passport",title:{en:"Passport",zh:"\u901a\u884c\u8bc1"},icon:"icon-park-outline:passport",link:"".concat(Yn.WELLKNOWN_SERVICE_PATH_PREFIX,"/admin/passports"),from:"tmpl"}]},{id:"/dashboard",title:"Blocklet",role:["owner","admin"],section:["dashboard"],link:"",from:"tmpl",items:[{id:"dashboard",title:{en:"Dashboard",zh:"\u4eea\u8868\u76d8"},icon:"ant-design:dashboard-outlined",link:"".concat(Yn.WELLKNOWN_SERVICE_PATH_PREFIX,"/admin"),from:"tmpl"}]}]};function te(n,e){return n.section&&e.section?n.section===e.section&&n.id===e.id:n.id===e.id}function ie(){var n=(0,Wn.y0)(),e=n.blocklet,t=n.actions,l=(0,mn.parseNavigation)(e,{beforeProcess:function(n){var e=fn()(n);return ee.dashboard.forEach((function(n){e.some((function(e){return e.id===n.id}))||e.push(n)})),e.some((function(n){return n.id&&(n.section||[]).includes("sessionManager")}))||e.push.apply(e,(0,jn.Z)(ee.sessionManager)),e}}),c=l.navigationList,s=l.components,u=l.builtinList,d=(0,j.Z)({rawNavigation:fn()(c),activeSection:ne,components:s}),f=(0,a.useMemo)((function(){return(0,mn.nestNavigationList)(d.rawNavigation)}),[d.rawNavigation]),v=(0,a.useMemo)((function(){var n=(0,mn.filterNavigation)(d.rawNavigation,s),e=(0,mn.joinLink)(n,s);return(0,mn.cleanOrphanNavigation)(e)}),[s,d.rawNavigation]);function m(n){if(!n.id)return"";var e=(0,mn.flattenNavigation)((0,mn.joinLink)(f,s)),t=e.find((function(e){return e.id===n.id}));function i(n){var e=n.name;return(0,D.jsx)(Cn.Z,{label:"Uninstalled: ".concat(e),color:"error",size:"small",variant:"outlined",sx:{fontSize:10,height:20}})}if(null!==t&&void 0!==t&&t.component){if(!s.some((function(n){return n.name===t.component})))return(0,D.jsx)(i,{name:t.component})}else if(t.parent){var o=e.find((function(n){return n.id===t.parent}));if(null!==o&&void 0!==o&&o.component&&!s.some((function(n){return n.name===o.component})))return(0,D.jsx)(i,{name:o.component})}return null===t||void 0===t?void 0:t.link}function p(n){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:$n;return n.map((function(n){var t=s.find((function(e){return e.name===n.component})),i=(null===t||void 0===t?void 0:t.link)||e,o=n.items||[],r=n.link;return{title:n.title,subtitle:m(n),link:r,icon:n.icon,children:p(o,r||$n),section:n.section,visible:n.visible,parent:n.parent,component:n.component,id:n.id,role:n.role,from:n.from,__base:i}}))}function h(n){return g.apply(this,arguments)}function g(){return(g=(0,r.Z)((0,o.Z)().mark((function n(e){var r,a;return(0,o.Z)().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return r=e.map((function(n){return Qn()(n,Hn())})),a=r.map((function(n){var e=(0,i.Z)({},n);return e.role&&Array.isArray(e.role)&&(e.role=JSON.stringify(e.role)),e.section&&Array.isArray(e.section)&&(e.section=JSON.stringify(e.section)),e.title&&e.title instanceof Object&&(e.title=JSON.stringify(e.title)),e.link&&e.link instanceof Object&&(e.link=JSON.stringify(e.link)),e})),n.next=4,t.configNavigations(a);case 4:case"end":return n.stop()}}),n)})))).apply(this,arguments)}function x(){return(x=(0,r.Z)((0,o.Z)().mark((function n(){return(0,o.Z)().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,h([]);case 2:d.rawNavigation=fn()(u);case 3:case"end":return n.stop()}}),n)})))).apply(this,arguments)}return{state:d,navigation:v,components:s,getNavigationFullLink:m,updateActiveSection:function(n){d.activeSection=n},updateNavigationItem:function(n){!function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=d.rawNavigation.map((function(e){var t=n.find((function(n){return te((0,i.Z)((0,i.Z)({},n),{},{section:d.activeSection}),e)}));return t?(0,i.Z)((0,i.Z)({},e),t):e}));d.rawNavigation=e}([n])},delNavigationItem:function(n){var e=d.rawNavigation.filter((function(e){return e.id===n||e.parent===n})).map((function(n){return n.id}));d.rawNavigation=d.rawNavigation.filter((function(n){return!e.includes(n.id)}))},addNavigationItem:function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=(0,i.Z)((0,i.Z)({},n),{},{id:(0,Xn.x0)(),section:d.activeSection,visible:!0});d.rawNavigation=[].concat((0,jn.Z)(d.rawNavigation),[e])},updateNavigationTree:function(n){var e=[];(0,mn.deepWalk)(n,(function(n,t){var o=(0,i.Z)((0,i.Z)({},$()(n,["children","expand"])),{},{parent:null===t||void 0===t?void 0:t.id});e.push(o)}));var t=d.rawNavigation.filter((function(n){if(!d.activeSection)return!1;var t=e.find((function(e){return te(e,n)}));return!t||!(0,mn.isMatchSection)(t.section,d.activeSection)}));d.rawNavigation=[].concat((0,jn.Z)(t),e)},getNavigation:function(n){return p(fn()(f).filter((function(e){return(0,mn.isMatchSection)(e.section,n)})))},saveNavigationList:h,resetNavigation:function(){return x.apply(this,arguments)}}}var oe,re=t(71171),ae=t(65321),le=t(28834),ce=t(39563),se=t(77930),ue=t(3994),de=t(75402),fe=t(16380),ve=t(15300);function me(n){var e,t,i,o,r=n.className,a=n.navigation,c=(0,Wn.y0)().blocklet,s=(0,ve.Z)({blocklet:c}).logoUrl,u=null===c||void 0===c||null===(e=c.environments)||void 0===e||null===(t=e.find((function(n){return n.key===bn.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_COPYRIGHT_OWNER})))||void 0===t?void 0:t.value,d=null===c||void 0===c||null===(i=c.environments)||void 0===i||null===(o=i.find((function(n){return n.key===bn.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_COPYRIGHT_YEAR})))||void 0===o?void 0:o.value,f=u||d?{owner:u,year:d}:void 0,v={appId:c.appDid,appLogo:s,appName:c.meta.title,enableConnect:!0,enableLocale:!1,navigation:a,copyright:f};return(0,D.jsx)(se.Z,{children:(0,D.jsxs)(l.Z,{className:r,children:[(0,D.jsx)(ae.Z,{meta:v}),(0,D.jsx)(l.Z,{children:(0,D.jsx)(ce.Z,{meta:v,invalidPathFallback:function(){},headerProps:{style:{display:"none"}},children:(0,D.jsx)(ue.ZP,{container:!0,spacing:2,children:new Array(6).fill().map((function(n,e){return(0,D.jsxs)(ue.ZP,{item:!0,xs:4,children:[(0,D.jsx)(de.Z,{animation:!1,variant:"rectangular",width:"100%",height:120}),(0,D.jsxs)(l.Z,{sx:{pt:.5},children:[(0,D.jsx)(de.Z,{animation:!1}),(0,D.jsx)(de.Z,{width:"60%",animation:!1})]})]},e)}))})})}),(0,D.jsx)(le.Z,{meta:v})]})})}me.propTypes={className:C().string,navigation:C().array},me.defaultProps={className:"",navigation:[]};var pe=(0,fe.Z)(me)(oe||(oe=(0,re.Z)(["\n .dashboard {\n height: auto !important;\n }\n .dashboard-content + div {\n display: none;\n }\n"]))),he={login:S(),logout:S(),switch:S(),switchDid:S(),switchProfile:S(),switchPassport:S(),useDid:function(){return{walletDid:"abcdefghijklmnopqrstuvwxyz"}},useOAuth:function(){return{logoutOAuth:S(),bindOAuth:S(),configs:{},switchOAuthPassport:S()}}},ge={header:"Header",footer:"Footer",bottom:"Footer Link",social:"Footer Social",dashboard:"Dashboard",sessionManager:"SessionManager"};var xe=function(){var n=(0,y.PE)().t,e=(0,Wn.y0)().blocklet,t=(0,a.useRef)(null),N=(0,Dn.DJ)().roles,S=(0,v.Z)((function(n){return n.breakpoints.down("md")})),w=(0,j.Z)({saveLoading:!1,resetLoading:!1,showResetConfirm:!1,mockRole:"owner"}),C=ie(),P=C.state,O=C.navigation,E=C.getNavigation,A=C.saveNavigationList,R=C.resetNavigation,T=C.updateActiveSection,_=C.updateNavigationTree,I=C.updateNavigationItem,M=C.delNavigationItem,W=C.addNavigationItem,z=(0,a.useCallback)((function(n){t.current.add({parent:n},(function(n,e){W(e),n()}))}),[W]),J=(0,a.useCallback)((function(n){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};switch(n){case"edit":t.current.edit(e,(function(n,e){I(e),n()}));break;case"toggle":I({id:e.id,visible:!e.visible});break;case"del":M(e.id)}}),[M,I]),B=(0,a.useCallback)((0,r.Z)((0,o.Z)().mark((function e(){return(0,o.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,w.saveLoading=!0,e.next=4,A(P.rawNavigation);case 4:k.Z.success(n("common.succeeded")),e.next=10;break;case 7:e.prev=7,e.t0=e.catch(0),k.Z.error((0,D.jsxs)(l.Z,{children:[(0,D.jsx)(g.Z,{variant:"subtitle2",children:n("navigation.actionFailed")}),(0,D.jsx)(g.Z,{variant:"body1",children:(0,Xn.Z)(e.t0)||e.t0.error})]}));case 10:return e.prev=10,w.saveLoading=!1,e.finish(10);case 13:case"end":return e.stop()}}),e,null,[[0,7,10,13]])}))),[P.rawNavigation,w,A,n]),q=(0,a.useCallback)((0,r.Z)((0,o.Z)().mark((function e(){return(0,o.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,w.resetLoading=!0,e.next=4,R();case 4:k.Z.success(n("navigation.action.resetSuccessful"),{variant:"success"}),e.next=10;break;case 7:e.prev=7,e.t0=e.catch(0),k.Z.error((0,D.jsxs)(l.Z,{children:[(0,D.jsx)(g.Z,{variant:"subtitle2",children:n("navigation.actionFailed")}),(0,D.jsx)(g.Z,{variant:"body1",children:(0,Xn.Z)(e.t0)||e.t0.error})]}));case 10:return e.prev=10,w.resetLoading=!1,e.finish(10);case 13:case"end":return e.stop()}}),e,null,[[0,7,10,13]])}))),[w,R,n]),G=(0,a.useMemo)((function(){return{session:(0,i.Z)((0,i.Z)({},he),{},{user:{did:e.appDid,fullName:"Preview User",role:w.mockRole}})}}),[e.appDid,w.mockRole]);return(0,D.jsxs)(D.Fragment,{children:[S&&(0,D.jsx)(p.Z,{fullWidth:!0,size:"small",value:P.activeSection,onChange:function(n){return T(n.target.value)},children:Object.keys(ge).map((function(n){return(0,D.jsxs)(f.Z,{value:n,children:[ge[n]," (".concat(E(n).length,")")]})}))}),!S&&(0,D.jsx)(s.Z,{variant:"outlined",children:Object.keys(ge).map((function(n){return(0,D.jsxs)(c.Z,{variant:P.activeSection===n?"contained":void 0,onClick:function(){return T(n)},children:[ge[n]," (".concat(E(n).length,")")]},n)}))}),(0,D.jsxs)(h.Z,{variant:"dense",sx:{paddingLeft:"0px !important",paddingRight:"0px !important",mt:2},children:[(0,D.jsx)(g.Z,{variant:"h6",component:"div",sx:{flexGrow:1},children:n("common.config")}),(0,D.jsx)(s.Z,{variant:"outlined",children:(0,D.jsx)(x.Z,{size:"small",variant:"outlined",color:"error",startIcon:(0,D.jsx)(b.JO,{icon:"system-uicons:reset"}),sx:{mr:2},loading:w.resetLoading,loadingPosition:"start",onClick:function(){w.showResetConfirm=!0},children:n("navigation.action.reset")})}),(0,D.jsxs)(s.Z,{variant:"outlined",children:[(0,D.jsx)(c.Z,{size:"small",variant:"outlined",startIcon:(0,D.jsx)(b.JO,{icon:"mdi:plus"}),onClick:function(){return z()},children:n("navigation.action.new")}),(0,D.jsx)(x.Z,{size:"small",variant:"contained",startIcon:(0,D.jsx)(b.JO,{icon:"mdi:content-save"}),loading:w.saveLoading,loadingPosition:"start",onClick:B,children:n("common.save")})]})]}),(0,D.jsx)(m.Z,{variant:"outlined",sx:{display:"flex",height:280,overflow:"hidden"},children:(0,D.jsx)(m.Z,{elevation:0,sx:{flex:1,overflow:"auto"},children:(0,D.jsx)(F,{treeData:E(P.activeSection),setTreeData:_,renderActions:function(n){var e=n.data,t=n.className;return(0,D.jsx)(Vn,{data:e,className:t,section:P.activeSection,add:function(){return z.apply(void 0,arguments)},del:function(){for(var n=arguments.length,e=new Array(n),t=0;t<n;t++)e[t]=arguments[t];return J.apply(void 0,["del"].concat(e))},edit:function(){for(var n=arguments.length,e=new Array(n),t=0;t<n;t++)e[t]=arguments[t];return J.apply(void 0,["edit"].concat(e))},toggle:function(){for(var n=arguments.length,e=new Array(n),t=0;t<n;t++)e[t]=arguments[t];return J.apply(void 0,["toggle"].concat(e))}})}})})}),(0,D.jsxs)(h.Z,{variant:"dense",sx:{paddingLeft:"0px !important",paddingRight:"0px !important",mt:3},children:[(0,D.jsx)(g.Z,{variant:"h6",component:"div",sx:{flexGrow:1},children:n("common.preview")}),(0,D.jsxs)(u.Z,{sx:{m:1,minWidth:120},size:"small",children:[(0,D.jsx)(d.Z,{children:n("common.role")}),(0,D.jsx)(p.Z,{value:w.mockRole,label:"Role",onChange:function(n){w.mockRole=n.target.value},children:N.map((function(n){return(0,D.jsx)(f.Z,{value:n.name,children:n.title},n.name)}))})]})]}),(0,D.jsx)(m.Z,{variant:"outlined",children:(0,D.jsx)(L.B3.Provider,{value:G,children:(0,D.jsx)(pe,{navigation:O})})}),(0,D.jsx)(qn,{ref:t,section:P.activeSection,components:P.components,rawNavigations:P.rawNavigation}),(0,D.jsx)(Z.I4,{confirmButton:{text:n("common.confirm"),props:{variant:"contained",color:"error"}},cancelButton:{text:n("common.cancel"),props:{color:"primary"}},open:w.showResetConfirm,title:n("navigation.action.restConfirmTitle"),onConfirm:function(){var n=(0,r.Z)((0,o.Z)().mark((function n(){return(0,o.Z)().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,q();case 2:w.showResetConfirm=!1;case 3:case"end":return n.stop()}}),n)})));return function(){return n.apply(this,arguments)}}(),onCancel:function(){w.showResetConfirm=!1},children:(0,D.jsx)("p",{children:n("navigation.action.restConfirmDesc")})})]})}}}]);
2
- //# sourceMappingURL=4023.5fe8180a.chunk.js.map
1
+ "use strict";(self.webpackChunk_abtnode_blocklet_services=self.webpackChunk_abtnode_blocklet_services||[]).push([[4023],{94785:function(n,e,t){var i=t(38636).default,o=t(73408).default,r=t(814).default,a=this&&this.__importDefault||function(n){return n&&n.__esModule?n:{default:n}};Object.defineProperty(e,"__esModule",{value:!0}),e.splitNavigationBySection=e.flattenNavigation=e.checkLink=e.joinLink=e.cleanOrphanNavigation=e.filterNavigation=e.nestNavigationList=e.isMatchSection=e.deepWalk=e.parseNavigation=void 0;var l=a(t(8566)),c=a(t(15888)),s=a(t(49735)),u=a(t(60523)),d=a(t(88674)),f=a(t(74082)),v=a(t(19611)),m=a(t(22523)),p=a(t(34155)),h=t(50576),g=a(t(22351)),x=t(88617);Object.defineProperty(e,"checkLink",{enumerable:!0,get:function(){return x.checkLink}});var k="header",b="/",j="/",Z="/";function y(n){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){},t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=t.key,o=void 0===i?"children":i,r=t.order,a=void 0===r?"first":r;!function n(t){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=i.index,l=void 0===r?0:r,c=i.parent,s=void 0===c?null:c,u=i.level,d=void 0===u?0:u;Array.isArray(t)?t.forEach((function(e,t){n(e,{index:t,parent:s,level:d+1})})):t&&("first"===a&&e(t,s,{index:l,level:d}),n(t[o],{parent:t,level:d}),"last"===a&&e(t,s,{index:l,level:d}))}(n)}function L(n,e){return!(e!==k||!(0,u.default)(n))||(Array.isArray(n)?n.includes(e):n===e)}function N(n){try{return JSON.parse(n)}catch(e){return n}}function S(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"/",e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";if((0,p.default)(e||""))return e;var t=m.default.join(n,e||j);return t.length>1&&t.endsWith("/")?t.slice(0,t.length-1):t}function w(n,e){var t=(arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}).strict,i=n,r=e;return void 0===t||t||(i=i||"/",r=r||"/"),(0,h.isObject)(i)&&(0,h.isString)(r)&&(0,x.checkLink)(r)?Object.keys(i).reduce((function(n,e){return n[e]=S(i[e],r),n}),{}):(0,h.isString)(i)&&(0,x.checkLink)(i)&&(0,h.isObject)(r)?Object.keys(r).reduce((function(n,e){return n[e]=S(i,r[e]),n}),{}):(0,h.isString)(i)&&(0,h.isString)(r)?(0,x.checkLink)(i)||(0,x.checkLink)(r)?S(i,r):r:(0,h.isObject)(i)&&(0,h.isObject)(r)?o(new Set([].concat(o(Object.keys(i)),o(Object.keys(r))))).reduce((function(n,e){return n[e]=S(i[e],r[e]),n}),{}):r}function C(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},t=e.depth,i=void 0===t?1:t,r=e.transform,a=void 0===r?function(n){return n}:r,l=(0,f.default)(n),c=[];return y(l,(function(n,e,t){var r=t.level;if(r>=i){var l=n.items,s=void 0===l?[]:l;if(s&&Array.isArray(s)&&s.length>0){delete n.items;var u=s.map((function(e){return a(e,n)}));if(e){var f;(f=e.items).push.apply(f,o(u))}else{var v=a((0,d.default)(n,["items"]),e);c.push.apply(c,[v].concat(o(u)))}}else if(1===r){var m=a((0,d.default)(n,["items"]),e);c.push(m)}}else 1===r&&c.push(n)}),{key:"items",order:"last"}),c}function P(n){var e,t=(0,f.default)(n),a=[],l=i(t);try{var c=function(){var n=e.value,t=(0,f.default)((0,d.default)(n,["items"])),l=[];function c(n,e){var i=function(n,e){return e&&Array.isArray(n.items)?n.items.filter((function(t){return(0,u.default)(t.section)?L(n.section,e):!!L(t.section,e)})).map((function(n){return r(r({},n),{},{section:e})})):[]}(n,e);l.push(r(r({},t),{},{section:e,items:i}))}if(Array.isArray(n.section)){var s,v=i(n.section);try{for(v.s();!(s=v.n()).done;){c(n,s.value)}}catch(x){v.e(x)}finally{v.f()}}else if(n.section){c(n,n.section)}else if(n.items&&n.items.length>0){var m,p=n.items.reduce((function(n,e){var t=(e||{}).section,i=void 0===t?[k]:t;return n.push.apply(n,o(i)),n}),[]),h=o(new Set(p)),g=i(h);try{for(g.s();!(m=g.n()).done;){c(n,m.value)}}catch(x){g.e(x)}finally{g.f()}}else l.push(r(r({},n),{},{section:k}));a.push.apply(a,l)};for(l.s();!(e=l.n()).done;)c()}catch(s){l.e(s)}finally{l.f()}return a}function O(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=(0,f.default)(n);return e.reduceRight((function(n,t,i){if(t.parent){var r=e.find((function(n){return t.section&&n.section?n.section===t.section&&n.id===t.parent:n.id===t.parent}));r&&(r.items||(r.items=[]),r.items=[t].concat(o(r.items))),e.splice(i,1)}return null}),null),e}e.deepWalk=y,e.isMatchSection=L,e.joinLink=function(n,e){var t=(0,f.default)(n);return y(t,(function(n,t){var i=n.component||n.child;if(i){var o=e.find((function(n){return n.name===i}));o&&(n.link=w(o.link,n.link,{strict:!1}))}else t&&(n.link=w(t.link,n.link))}),{key:"items"}),t},e.flattenNavigation=C,e.splitNavigationBySection=P,e.nestNavigationList=O,e.filterNavigation=function(n){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],t=O(n);return y(t,(function(n){if(null!==n&&void 0!==n&&n.component&&(e.some((function(e){return e.name===n.component}))||(n.visible=!1)),n.items&&n.items.length)for(var t=n.items.length-1;t>=0;t--)!1===n.items[t].visible&&n.items.splice(t,1)}),{key:"items"}),t.filter((function(n){var e;return!1!==n.visible&&!(n.items&&Array.isArray(n.items)&&n.items.length>0&&null!==(e=n.items)&&void 0!==e&&e.every((function(n){return!1===n.visible})))}))},e.cleanOrphanNavigation=function(n){return n.map((function(n){return n.items&&Array.isArray(n.items)&&1===n.items.length&&["header","footer","",void 0,null].includes(n.section)?n.items[0]:n}))},e.parseNavigation=function(){var n,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).beforeProcess,a=void 0===t?function(n){return n}:t,u=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=[],t=function t(a){var l,c,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},u=[],d=a.children,m=void 0===d?[]:d,p=a.meta,h=void 0===p?{}:p,x=(0,f.default)((null===h||void 0===h?void 0:h.navigation)||[]);(0,g.default)(h)&&!1!==(null===(l=a.meta)||void 0===l||null===(c=l.capabilities)||void 0===c?void 0:c.navigation)&&u.push.apply(u,o(x));var Z,y=s.name||"",L=s.mountPoint||b,N=a===n?"":h.name||"",S=a===n?"":a.mountPoint||b,w=i(m);try{var C=function(){var n,i,a,l,c=Z.value;if(!(0,g.default)(c.meta))return"continue";var s=c.meta.name,d=c.mountPoint,f=[y,N,s].filter(Boolean).join("."),m=c.meta.navigation||[],p=(0,v.default)(L,S,d);!1!==(null===(n=c.meta)||void 0===n||null===(i=n.capabilities)||void 0===i?void 0:i.navigation)&&e.push({did:c.meta.did,name:f,link:p,title:c.meta.title||"",navigation:m.map((function(n){return r({section:k},n)}))});var h=x.find((function(n){return!!n.component&&n.component===s}));if(h){if(!h.link)if(c.meta.navigation&&c.meta.navigation.length>0){var b,w,C=t(c,{mountPoint:S,name:N});C.length>0&&(h.items=null!==(b=h.items)&&void 0!==b?b:[],(w=h.items).push.apply(w,o(C)))}else h.link=j}else if(!1!==(null===(a=c.meta)||void 0===a||null===(l=a.capabilities)||void 0===l?void 0:l.navigation)){var P=t(c,{mountPoint:S,name:N}),O={title:c.meta.title,component:s,id:c.meta.did};P.length>0?(O.items=P,O.link=void 0):O.link=j,u.push(O)}};for(w.s();!(Z=w.n()).done;)C()}catch(P){w.e(P)}finally{w.f()}return u}(n);return{navigationList:t,components:e}}(e),d=u.navigationList,m=u.components,p=(null===e||void 0===e||null===(n=e.settings)||void 0===n?void 0:n.navigations)||[],h=function(n){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2,t=C((0,f.default)(n),{depth:e,transform:function(n,e){var t;return e&&(n._parent||(n._parent=e.id,e.component||(n.link=w(e.link,n.link))),n.section=n.section||e.section||[k],n.visible=null!==(t=n.visible)&&void 0!==t?t:e.visible),n.component=[e.component,n.component].filter(Boolean).join("."),n}});return y(t,(function(n){n.items&&n.items.length>0&&n.items.reduceRight((function(e,t){if(t._parent){var i=n.items.findIndex((function(n){return n.id===t._parent}));i>=0&&n.items.splice(i,1),delete t._parent}return null}),null)}),{key:"items"}),t}(a(d)),x=C(P(function(n){var e=(0,f.default)(n).filter((function(n){return n.id}));return y(e,(function(n,e){var t;if(n.items&&n.items.length){for(var i=n.items.length-1;i>=0;i--)n.items[i].id||n.items.splice(i,1);0===n.items.length&&n.component&&(n.link=n.link||j)}e&&(n.parent=e.id,n.id=[e.id,n.id].join(Z)),n.from=n.from||"yaml",n.visible=null===(t=n.visible)||void 0===t||t}),{key:"items"}),e}(h)).reduce((function(n,e){var t=["bottom","social","sessionManager"].includes(e.section),i=!1,a=m.find((function(n){return"/"===n.link}));if(a&&e.id===a.did&&(i=!0),t||i){if(e.items&&e.items.length>0)return n.push.apply(n,o(e.items.map((function(n){var t=e.section,i=w(e.link,n.link),o=[e.component,n.component].filter(Boolean).join(".");return r(r({},n),{},{section:t,link:i,component:o,parent:""})})))),n;if(i)return n}return n.push(e),n}),[]),{transform:function(n,e){var t=n.component;return null!==e&&void 0!==e&&e.component&&(t=[e.component,n.component].filter(Boolean).join(".")),r(r({},n),{},{component:t})}});return{navigationList:(0,l.default)(p.map((function(n){var e=r({},n);return e.role&&(e.role=N(e.role)),e.section&&(e.section=N(e.section)),e.title&&(e.title=N(e.title)),e.link&&(e.link=N(e.link)),e})),x,(function(n,e){var t=["id","section"];return(0,c.default)((0,s.default)(n,t),(0,s.default)(e,t))})),components:m,builtinList:x}}},4023:function(n,e,t){t.r(e),t.d(e,{default:function(){return xe}});var i=t(33028),o=t(32723),r=t(34795),a=t(30969),l=t(38361),c=t(72097),s=t(27265),u=t(87535),d=t(51385),f=t(2689),v=t(75255),m=t(46672),p=t(39130),h=t(56277),g=t(33359),x=t(39491),k=t(1986),b=t(96628),j=t(28595),Z=t(50496),y=t(26022),L=t(41333),N=t(61398),S=t.n(N),w=t(24974),C=t.n(w),P=t(67780),O=t(69241),E=t.n(O),A=t(74274),R=t.n(A),T=t(15888),_=t.n(T),I=t(96605),M=t(42821),D=t(37574);function W(n){var e=n.prevPath,t=n.nextPath,i=e.length,o=t.length;return!(i!==o||!_()(e.slice(0,i-1),t.slice(0,o-1)))}function z(n){var e=n.treeNode,t=(0,y.PE)().locale;return(0,D.jsxs)(D.Fragment,{children:[e.icon&&(0,D.jsx)(b.JO,{style:{marginRight:4},icon:e.icon}),function(){var n=e.title,i=e.subtitle,o=n,r=i;return R()(n)&&(o=n[t]),!(0,a.isValidElement)(i)&&R()(i)&&(r=i[t]),(0,D.jsxs)(l.Z,{display:"flex",alignItems:"center",children:[(0,D.jsx)(g.Z,{variant:"subtitle1",fontSize:16,children:o}),i&&(0,D.jsx)(g.Z,{variant:"body2",color:"gray",ml:1.5,lineHeight:1,children:r})]})}()]})}function J(n){var e=n.treeData,t=n.setTreeData,o=n.renderActions,r=e.map((function(n){return(0,i.Z)((0,i.Z)({},n),{},{expanded:!0})})),a={};return"undefined"!==typeof window&&(a.context=window),(0,D.jsx)(M.W,(0,i.Z)((0,i.Z)({backend:I.HTML5Backend},a),{},{children:(0,D.jsx)(P.oP,{generateNodeProps:function(n){return{buttons:o({data:n.node,className:"list-item-actions"}),icons:(0,D.jsx)(b.JO,{icon:"ic:round-drag-indicator"}),title:(0,D.jsx)(z,{treeNode:n.node})}},maxDepth:2,isVirtualized:!1,treeData:r,onChange:t,canDrop:W,theme:E()})}))}z.propTypes={treeNode:C().object.isRequired},J.propTypes={treeData:C().object.isRequired,setTreeData:C().func,renderActions:C().func},J.defaultProps={setTreeData:function(){},renderActions:function(){}};var F=J,B=t(96234),q=t(56666),G=t(29996),V=t(74202),K=t(94551),H=t(4953),U=t(87006),Q=t(57982),Y=t(14546),X=t(88674),$=t.n(X),nn=t(49735),en=t.n(nn),tn=t(9669),on=t.n(tn),rn=t(75359),an=t.n(rn),ln=t(76032),cn=t.n(ln),sn=t(86446),un=t.n(sn),dn=t(74082),fn=t.n(dn),vn=t(13953),mn=t(94785),pn=t(19611),hn=t.n(pn),gn=t(43430),xn=t(34155),kn=t.n(xn),bn=t(59505),jn=t(68079),Zn=t(15914),yn=t(50576),Ln=t(3672),Nn=t(8288),Sn=t(83176),wn=t(59740),Cn=t(7173),Pn=t(98123),On=t(86008),En=t(33656),An=["fullWidth","multiple","required","label","placeholer","options","helperText","error","margin"];function Rn(n){var e=n.fullWidth,t=n.multiple,o=n.required,r=n.label,a=n.placeholer,c=n.options,s=n.helperText,v=n.error,m=n.margin,h=(0,wn.Z)(n,An),x=c.find((function(n){return n.value===h.value})),k=null===x||void 0===x?void 0:x.title;return(0,D.jsxs)(u.Z,{margin:m,fullWidth:e,error:v,children:[(0,D.jsx)(d.Z,{children:"".concat(r).concat(o?"*":"")}),(0,D.jsxs)(p.Z,(0,i.Z)((0,i.Z)({multiple:t,input:(0,D.jsx)(En.Z,{defaultValue:k,sx:{flex:1},required:o,label:r,inputProps:{margin:m}}),renderValue:function(n){if(t)return(0,D.jsx)(l.Z,{sx:{display:"flex",flexWrap:"wrap",gap:.5},children:n.map((function(n){var e=c.find((function(e){return e.value===n}));return e&&e.title&&(0,D.jsx)(Cn.Z,{size:"small",label:e.title},n)}))});var e=c.find((function(e){return e.value===n}));return e&&e.title&&(0,D.jsxs)(l.Z,{children:[(0,D.jsx)(g.Z,{component:"span",children:e.title}),(0,D.jsx)(g.Z,{marginLeft:1,component:"span",variant:"body2",color:"text.secondary",children:e.description})]})}},h),{},{children:[(0,D.jsx)(f.Z,{disabled:!0,children:(0,D.jsx)("em",{children:a})}),!t&&(0,D.jsx)(f.Z,{value:"",children:"None"}),c.map((function(n){return n&&n.value&&(0,D.jsxs)(f.Z,{value:n.value,children:[(0,D.jsx)(On.Z,{children:n.title}),n.description&&(0,D.jsx)(g.Z,{variant:"body2",color:"text.secondary",children:n.description})]},n.value)}))]})),(0,D.jsx)(Pn.Z,{children:s})]})}Rn.propTypes={error:C().bool,required:C().bool,multiple:C().bool,fullWidth:C().bool,label:C().string,placeholer:C().string,options:C().array,helperText:C().string,margin:C().string},Rn.defaultProps={error:!1,required:!1,multiple:!1,fullWidth:!1,label:"",placeholer:"",options:[],helperText:"",margin:""};var Tn=Rn,_n="en";function In(n){var e=n.sx,t=n.onAdd,i=n.onChange,o=n.locales,r=n.localeMap,s=n.onRemoveLocale,u=(0,y.PE)().t,d=(0,a.useRef)(),f=(0,a.useState)(null),v=(0,B.Z)(f,2),m=v[0],p=v[1],h=(0,j.Z)({currentLocale:_n,localeList:[],inputLocale:"",localeError:""}),x=(0,a.useMemo)((function(){return!!m}),[m]),k=(0,a.useMemo)((function(){return o.includes(h.currentLocale)?h.currentLocale:_n}),[o,h.currentLocale]),Z=(0,a.useMemo)((function(){return Object.keys((0,yn.omit)(r,[].concat((0,jn.Z)(h.localeList),[_n]))).map((function(n){return{title:r[n],value:n}}))}),[h.localeList]);function L(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",e=function(n){return n?"en"!==n&&!h.localeList.includes(n)||u("navigation.form.localeExists",{value:n}):u("common.requiredErrorText",{name:"Locale"})}(null===n||void 0===n?void 0:n.trim());return h.localeError=!0!==e?e:"",e}function N(){var n,e=null===(n=h.inputLocale)||void 0===n?void 0:n.trim();!0===L(e)&&(S(),h.localeList.push(e),h.currentLocale=e,t(e))}function S(){p(null),h.inputLocale="",h.localeError=""}return(0,a.useEffect)((function(){h.localeList=(0,jn.Z)(o)}),[o,h]),(0,Zn.Z)("enter",(function(){setTimeout((function(){N()}))}),{target:d}),(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(Ln.Z,{sx:e,value:k,onChange:function(n,e){h.currentLocale=e,i(e)},children:[(0,D.jsx)(Nn.Z,{label:"Default (".concat(r[_n],")"),value:"en"}),h.localeList.map((function(n){return(0,D.jsx)(Nn.Z,{sx:{position:"relative"},label:(0,D.jsxs)(D.Fragment,{children:[r[n],(0,D.jsx)(K.Z,{size:"small",color:"inherit",sx:{position:"absolute",top:0,right:0},onClick:function(e){!function(n,e){n.preventDefault(),n.stopPropagation(),h.localeList=(0,yn.without)(h.localeList,e),s(e),e===h.currentLocale&&(h.currentLocale=_n)}(e,n)},children:(0,D.jsx)(b.JO,{icon:"mdi:close",height:14})})]}),value:n},n)})),(0,D.jsx)(K.Z,{color:"primary",disableFocusRipple:!0,sx:{width:"48px"},onClick:function(n){p(n.currentTarget)},children:(0,D.jsx)(b.JO,{icon:"mdi:plus"})})]}),(0,D.jsx)(Sn.ZP,{open:x,anchorEl:m,onClose:S,anchorOrigin:{vertical:"bottom",horizontal:"left"},children:(0,D.jsxs)(l.Z,{sx:{p:2,width:"270px"},children:[(0,D.jsx)(g.Z,{variant:"subtitle2",children:u("navigation.form.localePlaceholder")}),(0,D.jsx)(l.Z,{mt:1,children:(0,D.jsx)(Tn,{required:!0,fullWidth:!0,label:"Locale",value:h.inputLocale,options:Z,onChange:function(n){var e=n.target.value;L(e),h.inputLocale=e},error:!!h.localeError,helperText:h.localeError||" "})}),(0,D.jsx)(l.Z,{display:"flex",justifyContent:"flex-end",children:(0,D.jsx)(c.Z,{size:"small",variant:"contained",onClick:N,children:u("common.confirm")})})]})})]})}In.propTypes={sx:C().any,onAdd:C().func,onChange:C().func,onRemoveLocale:C().func,localeMap:C().object,locales:C().array},In.defaultProps={sx:null,onAdd:function(){},onChange:function(){},onRemoveLocale:function(){},localeMap:{},locales:[]};var Mn=In,Dn=t(80670),Wn=t(45008),zn="en",Jn={title:(0,q.Z)({},zn,""),link:(0,q.Z)({},zn,"")};function Fn(n){var e=n.icon,t=(0,a.useState)(!1),i=(0,B.Z)(t,2),l=i[0],c=i[1];return(0,Q.Z)((0,r.Z)((0,o.Z)().mark((function n(){return(0,o.Z)().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return c(!1),n.next=3,(0,b.GL)(e);case 3:c(!0);case 4:case"end":return n.stop()}}),n)}))),[e]),e?l?(0,D.jsx)(b.JO,{icon:e}):(0,D.jsx)(b.JO,{color:"#f06f6e",icon:"ic:baseline-error"}):(0,D.jsx)(b.JO,{icon:"codicon:blank"})}Fn.propTypes={icon:C().string.isRequired};var Bn=(0,a.forwardRef)((function(n,e){var t=n.section,c=n.components,s=n.rawNavigations,d=(0,Dn.DJ)().roles,f=(0,y.PE)(),v=f.t,m=f.locale,p=(0,Wn.y0)().blocklet.environments.find((function(n){return"BLOCKLET_APP_LANGUAGES"===n.key})),h=(p?p.value.split(","):["en","zh"]).filter((function(n){return bn.SUPPORTED_LANGUAGES[n]})).reduce((function(n,e){return n[e]=bn.SUPPORTED_LANGUAGES[e].nativeName,n}),{}),x=(0,a.useRef)((function(){})),L=(0,Y.Z)(!1),N=(0,B.Z)(L,2),S=N[0],w=N[1],C=w.setFalse,P=w.setTrue,O=(0,j.Z)({isRoot:!0,type:"add",linkDisabled:!1,locale:zn,formState:fn()(Jn),get localeList(){return an()(Object.keys(this.formState.title),zn)}}),E=(0,vn.cI)({mode:"onChange",defaultValues:{id:void 0,title:void 0,icon:void 0,link:void 0,component:void 0,parent:void 0,role:[]}}),A=E.handleSubmit,T=E.control,_=E.watch,I=E.setValue,M=E.clearErrors,W=E.formState.errors;(0,a.useEffect)((function(){I("title",O.formState.title[O.locale]),I("link",O.formState.link[O.locale])}),[I,O.locale,S]);var z=_("component"),J=_("title"),F=_("link"),Q=_("icon"),X=_("parent");(0,a.useEffect)((function(){O.formState.title[O.locale]=J}),[J]),(0,a.useEffect)((function(){O.formState.link[O.locale]=F}),[F]);var nn=(0,a.useMemo)((function(){return s.find((function(n){return z?c.find((function(n){return n.name===z})).did===n.id:n.id===X}))}),[c,s,z,X]),tn=(0,a.useMemo)((function(){if(null!==nn&&void 0!==nn&&nn.component){var n=(c.find((function(n){return n.name===nn.component}))||{}).link,e=R()(n)?n[O.locale]:n;if(z)return(0,gn.QT)(e);var t=R()(nn.link)?nn.link[O.locale]:nn.link;return(0,gn.QT)(hn()(e,t||"/"))}return null}),[c,O.locale,nn,z]),rn=(0,a.useMemo)((function(){var n=(nn||{}).component,e=(c.find((function(e){return e.name===n}))||{}).navigation,i=void 0===e?[]:e;return(0,mn.flattenNavigation)(i,{transform:function(n,e){return null!==e&&void 0!==e&&e.section&&(n.section=n.section||e.section),n}}).filter((function(n){return n.link})).filter((function(n){return(0,mn.isMatchSection)(n.section,t)})).map((function(n){return{label:n.link,title:n.title[m]||n.title}}))}),[nn,c,t,m]),ln=(0,a.useMemo)((function(){var n={add:v("common.create"),edit:v("common.edit")}[O.type];return n?"".concat(n," ").concat(v("navigation.navigation")):"--"}),[O.type,v]),sn=(0,a.useCallback)((function(){O.isRoot=!0,O.locale=zn,O.type="add",O.linkDisabled=!1,x.current=function(){},I("id",void 0),I("icon",void 0),I("title",void 0),I("link",void 0),I("component",void 0),I("parent",void 0),I("role",[]),O.formState=fn()(Jn),M()}),[M,I,O]),dn=(0,a.useCallback)((function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return O.localeList.length>0&&(new Set(on()(O.formState.title)).size>1&&(n.title=O.formState.title),new Set(on()(O.formState.link)).size>1&&(n.link=O.formState.link)),cn()(n.role)&&(n.role=void 0),n}),[O.formState.link,O.formState.title,O.localeList]),pn=(0,a.useCallback)((function(){C(),setTimeout((function(){sn()}))}),[sn,C]),xn=(0,a.useCallback)((function(){var n=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).parent,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){};O.type="add",O.isRoot=!n,I("parent",null===n||void 0===n?void 0:n.id),x.current=function(n){e(pn,n)},P()}),[pn,P,I,O]),jn=(0,a.useCallback)((function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){},t=n.id,i=n.title,o=n.icon,r=n.link,a=n.parent,l=n.component,c=n.role,s=void 0===c?[]:c;I("id",t),I("icon",o),"tmpl"===n.from&&(O.linkDisabled=!0),un()(i)?O.formState.title=O.localeList.reduce((function(n,e){return n[e]=i,n}),(0,q.Z)({},zn,i)):R()(i)?O.formState.title=fn()(i):O.formState.title={},un()(r)?O.formState.link=O.localeList.reduce((function(n,e){return n[e]=r,n}),(0,q.Z)({},zn,r)):R()(r)?O.formState.link=fn()(r):O.formState.link={},I("component",l),I("parent",a),I("role",s||[]),P(),O.type="edit",O.isRoot=!a,x.current=function(n){var t=en()(n,["id","title","icon","link","role"]);e(pn,t)}}),[pn,P,I,O]);function Zn(n){var e=null===n||void 0===n?void 0:n.trim();return e?!(e.length>24)||v("navigation.form.titleTooLong",{len:24}):v("common.requiredErrorText",{name:v("navigation.form.title")})}function yn(){return(yn=(0,r.Z)((0,o.Z)().mark((function n(e){var t;return(0,o.Z)().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(!(t=null===e||void 0===e?void 0:e.trim())){n.next=10;break}return n.prev=2,n.next=5,(0,b.GL)(t);case 5:n.next=10;break;case 7:return n.prev=7,n.t0=n.catch(2),n.abrupt("return",v("navigation.form.invalidIcon"));case 10:return n.abrupt("return",!0);case 11:case"end":return n.stop()}}),n,null,[[2,7]])})))).apply(this,arguments)}function Ln(n){var e=null===n||void 0===n?void 0:n.trim();return e?!!(0,mn.checkLink)(e)||v("navigation.form.invalidLink"):!!O.isRoot||v("common.requiredErrorText",{name:v("navigation.form.link")})}(0,a.useImperativeHandle)(e,(function(){return{add:xn,edit:jn,close:pn}}),[xn,pn,jn]);var Nn=(0,a.useCallback)((function(n){O.locale=n,O.formState.title[n]||(O.formState.title[n]=""),O.formState.link[n]||(O.formState.link[n]=""),setTimeout((function(){M()}))}),[M,O]),Sn=(0,a.useCallback)((function(){for(var n=O.formState,e=n.title,t=n.link,i=0,o=Object.keys(e);i<o.length;i++){var r=Zn(e[o[i]]);if(!0!==r)return r}for(var a=0,l=Object.keys(t);a<l.length;a++){var c=Ln(t[l[a]]);if(!0!==c)return c}return!0}),[O.formState]),wn=(0,a.useCallback)((function(n){var e=Sn();!0===e?x.current(dn(n)):k.Z.error(e)}),[Sn,dn]),Cn=(0,a.useCallback)((function(n){O.formState.title=$()(O.formState.title,n),O.formState.link=$()(O.formState.link,n)}),[O.formState]),Pn=(0,a.useCallback)((function(n){var e,t;O.locale=n,O.formState.title[n]=null===(e=O.formState.title)||void 0===e?void 0:e[zn],O.formState.link[n]=null===(t=O.formState.link)||void 0===t?void 0:t[zn],setTimeout((function(){M()}))}),[M,O]);return(0,D.jsxs)(Z.ZP,{open:S,title:ln,onClose:pn,actions:(0,D.jsx)(G.Z,{onClick:A(wn),color:"primary",autoFocus:!0,variant:"contained",children:v("common.confirm")}),children:[(0,D.jsx)(Mn,{sx:{mb:1},onAdd:Pn,onChange:Nn,onRemoveLocale:Cn,localeMap:h,locales:O.localeList}),(0,D.jsxs)("form",{noValidate:!0,autoComplete:"off",children:[(0,D.jsx)(vn.Qr,{name:"title",control:T,rules:{validate:Zn},render:function(n){var e,t,o=n.field;return(0,D.jsx)(U.Z,(0,i.Z)({fullWidth:!0,variant:"outlined",margin:"dense",required:!0,placeholder:v("navigation.form.titlePlaceholder"),label:v("navigation.form.title"),disabled:O.isEdit,error:!(null===W||void 0===W||null===(e=W.title)||void 0===e||!e.message),helperText:(null===W||void 0===W||null===(t=W.title)||void 0===t?void 0:t.message)||" "},o))}}),(0,D.jsx)(vn.Qr,{name:"icon",control:T,rules:{validate:function(n){return yn.apply(this,arguments)}},render:function(n){var e,t,o=n.field;return(0,D.jsx)(U.Z,(0,i.Z)((0,i.Z)({fullWidth:!0,variant:"outlined",margin:"dense",placeholder:v("navigation.form.iconPlaceholder"),label:v("navigation.form.icon"),error:!(null===W||void 0===W||null===(e=W.icon)||void 0===e||!e.message),disabled:O.locale!==zn,helperText:(null===W||void 0===W||null===(t=W.icon)||void 0===t?void 0:t.message)||(0,D.jsx)(l.Z,{display:"flex",children:(0,D.jsxs)(l.Z,{component:"a",href:"https://icones.js.org",target:"_blank",display:"flex",alignItems:"center",children:[v("navigation.form.findMoreIcon")," ",(0,D.jsx)(b.JO,{style:{marginLeft:4},icon:"radix-icons:external-link"})]})})},o),{},{InputProps:{endAdornment:(0,D.jsx)(H.Z,{position:"end",children:(0,D.jsx)(K.Z,{sx:{cursor:"default"},disableFocusRipple:!0,disableRipple:!0,children:Q&&(0,D.jsx)(Fn,{icon:Q})})})}}))}}),O.isRoot&&(0,D.jsx)(vn.Qr,{name:"component",control:T,render:function(n){var e,t,o=n.field;return(0,D.jsx)(Tn,(0,i.Z)({fullWidth:!0,margin:"dense",disabled:"edit"===O.type||O.locale!==zn,label:v("navigation.form.component"),placeholer:v("navigation.form.componentPlaceholder"),options:c.map((function(n){return{title:n.title,value:n.name,description:n.link}})),error:!(null===W||void 0===W||null===(e=W.component)||void 0===e||!e.message),helperText:(null===W||void 0===W||null===(t=W.component)||void 0===t?void 0:t.message)||" "},$()(o,"ref")))}}),(0,D.jsx)(vn.Qr,{name:"link",control:T,rules:{validate:Ln},render:function(n){var e=n.field;return(0,D.jsx)(u.Z,{fullWidth:!0,margin:"dense",children:(0,D.jsx)(V.Z,(0,i.Z)((0,i.Z)({disablePortal:!0,freeSolo:!0,blurOnSelect:!0,autoSelect:!0,fullWidth:!0,disabled:O.linkDisabled,isOptionEqualToValue:function(n){return n.label},options:rn,renderInput:function(n){var e,t;return(0,D.jsx)(U.Z,(0,i.Z)((0,i.Z)({},n),{},{placeholder:v("navigation.form.linkPlaceholder"),label:v("navigation.form.link"),error:!(null===W||void 0===W||null===(e=W.link)||void 0===e||!e.message),helperText:(null===W||void 0===W||null===(t=W.link)||void 0===t?void 0:t.message)||"/abc/bcd or /abc or https://arcblock.io",InputProps:{startAdornment:tn?(0,D.jsx)(H.Z,{position:"start",sx:{textDecoration:kn()(F||"")?"line-through":""},children:tn}):null}}))},renderOption:function(n,e){return(0,D.jsxs)(l.Z,(0,i.Z)((0,i.Z)({component:"li"},n),{},{children:[e.label,(0,D.jsx)(g.Z,{marginLeft:1,component:"span",variant:"body2",color:"text.secondary",children:e.title})]}))},margin:"dense"},e),{},{onChange:function(){},onInputChange:function(n,t){e.onChange(t)}}))})}}),["dashboard","sessionManager"].includes(t)&&(0,D.jsx)(vn.Qr,{name:"role",control:T,render:function(n){var e,t,o=n.field;return(0,D.jsx)(Tn,(0,i.Z)({fullWidth:!0,multiple:!0,margin:"dense",label:v("navigation.form.role"),placeholer:v("navigation.form.rolePlaceholder"),options:d.map((function(n){return{title:n.title,value:n.name}})),error:!(null===W||void 0===W||null===(e=W.role)||void 0===e||!e.message),helperText:(null===W||void 0===W||null===(t=W.role)||void 0===t?void 0:t.message)||" "},$()(o,"ref")))}})]})]})}));Bn.propTypes={section:C().string,components:C().array,rawNavigations:C().array},Bn.defaultProps={section:"",components:[],rawNavigations:[]};var qn=Bn;function Gn(n){var e=n.className,t=n.add,i=n.edit,o=n.toggle,r=n.del,l=n.data,c=n.section,s=(0,y.PE)().t,u=["yaml","tmpl"].includes(l.from),d=(0,a.isValidElement)(l.subtitle);function f(n){n.preventDefault(),n.stopPropagation()}var v=(0,a.useCallback)((function(n){f(n),t(l)}),[t,l]),m=(0,a.useCallback)((function(n){f(n),i(l)}),[i,l]),p=(0,a.useCallback)((function(n){f(n),o(l)}),[o,l]),h=(0,a.useCallback)((function(n){f(n),r(l)}),[r,l]);return(0,D.jsxs)("div",{className:e,children:[!l.parent&&["header","footer","dashboard"].includes(c)&&(0,D.jsx)("span",{title:s(d?"navigation.action.noAddSub":"navigation.action.addSub"),children:(0,D.jsx)(K.Z,{size:"small",color:"success",onClick:v,disabled:d,children:(0,D.jsx)(b.JO,{icon:"mdi:plus-box-outline"})})}),(0,D.jsx)("span",{title:s(d?"navigation.action.noEdit":"navigation.action.edit"),children:(0,D.jsx)(K.Z,{size:"small",color:"primary",onClick:m,disabled:d,children:(0,D.jsx)(b.JO,{icon:"mdi:pencil"})})}),(0,D.jsx)("span",{title:d?s("navigation.action.noEdit"):l.visible?s("navigation.action.hide"):s("navigation.action.show"),children:(0,D.jsx)(K.Z,{size:"small",color:"warning",onClick:p,disabled:d,children:!1===l.visible?(0,D.jsx)(b.JO,{icon:"mdi:eye-off-outline"}):(0,D.jsx)(b.JO,{icon:"mdi:eye-outline"})})}),(0,D.jsx)("span",{title:s(u&&!d?"navigation.action.noDel":"navigation.action.del"),children:(0,D.jsx)(K.Z,{disabled:u&&!d,size:"small",color:"error",onClick:h,children:(0,D.jsx)(b.JO,{icon:"mdi:delete"})})})]})}Gn.propTypes={data:C().object.isRequired,className:C().string,add:C().func,edit:C().func,toggle:C().func,del:C().func,section:C().string},Gn.defaultProps={className:"",add:function(){},edit:function(){},toggle:function(){},del:function(){},section:""};var Vn=Gn,Kn=t(60523),Hn=t.n(Kn),Un=t(70306),Qn=t.n(Un),Yn=t(20244),Xn=t(24891),$n="/",ne="header",ee={sessionManager:[{id:"/sessionManager",title:{en:"Manage",zh:"\u7ba1\u7406"},section:["sessionManager"],icon:"ion:settings-outline",link:"".concat(Yn.WELLKNOWN_SERVICE_PATH_PREFIX,"/admin"),role:["owner","admin"],from:"tmpl"}],dashboard:[{id:"/team",title:{en:"Access",zh:"\u8bbf\u95ee\u63a7\u5236"},role:["owner","admin","member"],section:["dashboard"],link:"",from:"tmpl",items:[{id:"member",title:{en:"Members",zh:"\u6210\u5458"},icon:"ant-design:user-outlined",link:"".concat(Yn.WELLKNOWN_SERVICE_PATH_PREFIX,"/admin/members"),from:"tmpl"},{id:"passport",title:{en:"Passport",zh:"\u901a\u884c\u8bc1"},icon:"icon-park-outline:passport",link:"".concat(Yn.WELLKNOWN_SERVICE_PATH_PREFIX,"/admin/passports"),from:"tmpl"}]},{id:"/dashboard",title:"Blocklet",role:["owner","admin"],section:["dashboard"],link:"",from:"tmpl",items:[{id:"dashboard",title:{en:"Dashboard",zh:"\u4eea\u8868\u76d8"},icon:"ant-design:dashboard-outlined",link:"".concat(Yn.WELLKNOWN_SERVICE_PATH_PREFIX,"/admin"),from:"tmpl"}]}]};function te(n,e){return n.section&&e.section?n.section===e.section&&n.id===e.id:n.id===e.id}function ie(){var n=(0,Wn.y0)(),e=n.blocklet,t=n.actions,l=(0,mn.parseNavigation)(e,{beforeProcess:function(n){var e=fn()(n);return ee.dashboard.forEach((function(n){e.some((function(e){return e.id===n.id}))||e.push(n)})),e.some((function(n){return n.id&&(n.section||[]).includes("sessionManager")}))||e.push.apply(e,(0,jn.Z)(ee.sessionManager)),e}}),c=l.navigationList,s=l.components,u=l.builtinList,d=(0,j.Z)({rawNavigation:fn()(c),activeSection:ne,components:s}),f=(0,a.useMemo)((function(){return(0,mn.nestNavigationList)(d.rawNavigation)}),[d.rawNavigation]),v=(0,a.useMemo)((function(){var n=(0,mn.filterNavigation)(d.rawNavigation,s),e=(0,mn.joinLink)(n,s);return(0,mn.cleanOrphanNavigation)(e)}),[s,d.rawNavigation]);function m(n){if(!n.id)return"";var e=(0,mn.flattenNavigation)((0,mn.joinLink)(f,s)),t=e.find((function(e){return e.id===n.id}));function i(n){var e=n.name;return(0,D.jsx)(Cn.Z,{label:"Uninstalled: ".concat(e),color:"error",size:"small",variant:"outlined",sx:{fontSize:10,height:20}})}if(null!==t&&void 0!==t&&t.component){if(!s.some((function(n){return n.name===t.component})))return(0,D.jsx)(i,{name:t.component})}else if(t.parent){var o=e.find((function(n){return n.id===t.parent}));if(null!==o&&void 0!==o&&o.component&&!s.some((function(n){return n.name===o.component})))return(0,D.jsx)(i,{name:o.component})}return null===t||void 0===t?void 0:t.link}function p(n){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:$n;return n.map((function(n){var t=s.find((function(e){return e.name===n.component})),i=(null===t||void 0===t?void 0:t.link)||e,o=n.items||[],r=n.link;return{title:n.title,subtitle:m(n),link:r,icon:n.icon,children:p(o,r||$n),section:n.section,visible:n.visible,parent:n.parent,component:n.component,id:n.id,role:n.role,from:n.from,__base:i}}))}function h(n){return g.apply(this,arguments)}function g(){return(g=(0,r.Z)((0,o.Z)().mark((function n(e){var r,a;return(0,o.Z)().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return r=e.map((function(n){return Qn()(n,Hn())})),a=r.map((function(n){var e=(0,i.Z)({},n);return e.role&&Array.isArray(e.role)&&(e.role=JSON.stringify(e.role)),e.section&&Array.isArray(e.section)&&(e.section=JSON.stringify(e.section)),e.title&&e.title instanceof Object&&(e.title=JSON.stringify(e.title)),e.link&&e.link instanceof Object&&(e.link=JSON.stringify(e.link)),e})),n.next=4,t.configNavigations(a);case 4:case"end":return n.stop()}}),n)})))).apply(this,arguments)}function x(){return(x=(0,r.Z)((0,o.Z)().mark((function n(){return(0,o.Z)().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,h([]);case 2:d.rawNavigation=fn()(u);case 3:case"end":return n.stop()}}),n)})))).apply(this,arguments)}return{state:d,navigation:v,components:s,getNavigationFullLink:m,updateActiveSection:function(n){d.activeSection=n},updateNavigationItem:function(n){!function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=d.rawNavigation.map((function(e){var t=n.find((function(n){return te((0,i.Z)((0,i.Z)({},n),{},{section:d.activeSection}),e)}));return t?(0,i.Z)((0,i.Z)({},e),t):e}));d.rawNavigation=e}([n])},delNavigationItem:function(n){var e=d.rawNavigation.filter((function(e){return e.id===n||e.parent===n})).map((function(n){return n.id}));d.rawNavigation=d.rawNavigation.filter((function(n){return!e.includes(n.id)}))},addNavigationItem:function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=(0,i.Z)((0,i.Z)({},n),{},{id:(0,Xn.x0)(),section:d.activeSection,visible:!0});d.rawNavigation=[].concat((0,jn.Z)(d.rawNavigation),[e])},updateNavigationTree:function(n){var e=[];(0,mn.deepWalk)(n,(function(n,t){var o=(0,i.Z)((0,i.Z)({},$()(n,["children","expand"])),{},{parent:null===t||void 0===t?void 0:t.id});e.push(o)}));var t=d.rawNavigation.filter((function(n){if(!d.activeSection)return!1;var t=e.find((function(e){return te(e,n)}));return!t||!(0,mn.isMatchSection)(t.section,d.activeSection)}));d.rawNavigation=[].concat((0,jn.Z)(t),e)},getNavigation:function(n){return p(fn()(f).filter((function(e){return(0,mn.isMatchSection)(e.section,n)})))},saveNavigationList:h,resetNavigation:function(){return x.apply(this,arguments)}}}var oe,re=t(71171),ae=t(65321),le=t(28834),ce=t(39563),se=t(77930),ue=t(3994),de=t(75402),fe=t(16380),ve=t(15300);function me(n){var e,t,i,o,r=n.className,a=n.navigation,c=(0,Wn.y0)().blocklet,s=(0,ve.Z)({blocklet:c}).logoUrl,u=null===c||void 0===c||null===(e=c.environments)||void 0===e||null===(t=e.find((function(n){return n.key===bn.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_COPYRIGHT_OWNER})))||void 0===t?void 0:t.value,d=null===c||void 0===c||null===(i=c.environments)||void 0===i||null===(o=i.find((function(n){return n.key===bn.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_COPYRIGHT_YEAR})))||void 0===o?void 0:o.value,f=u||d?{owner:u,year:d}:void 0,v={appId:c.appDid,appLogo:s,appName:c.meta.title,enableConnect:!0,enableLocale:!1,navigation:a,copyright:f};return(0,D.jsx)(se.Z,{children:(0,D.jsxs)(l.Z,{className:r,children:[(0,D.jsx)(ae.Z,{meta:v}),(0,D.jsx)(l.Z,{children:(0,D.jsx)(ce.Z,{meta:v,invalidPathFallback:function(){},headerProps:{style:{display:"none"}},children:(0,D.jsx)(ue.ZP,{container:!0,spacing:2,children:new Array(6).fill().map((function(n,e){return(0,D.jsxs)(ue.ZP,{item:!0,xs:4,children:[(0,D.jsx)(de.Z,{animation:!1,variant:"rectangular",width:"100%",height:120}),(0,D.jsxs)(l.Z,{sx:{pt:.5},children:[(0,D.jsx)(de.Z,{animation:!1}),(0,D.jsx)(de.Z,{width:"60%",animation:!1})]})]},e)}))})})}),(0,D.jsx)(le.Z,{meta:v})]})})}me.propTypes={className:C().string,navigation:C().array},me.defaultProps={className:"",navigation:[]};var pe=(0,fe.Z)(me)(oe||(oe=(0,re.Z)(["\n .dashboard {\n height: auto !important;\n }\n .dashboard-content + div {\n display: none;\n }\n"]))),he={login:S(),logout:S(),switch:S(),switchDid:S(),switchProfile:S(),switchPassport:S(),useDid:function(){return{walletDid:"abcdefghijklmnopqrstuvwxyz"}},useOAuth:function(){return{logoutOAuth:S(),bindOAuth:S(),configs:{},switchOAuthPassport:S()}}},ge={header:"Header",footer:"Footer",bottom:"Footer Link",social:"Footer Social",dashboard:"Dashboard",sessionManager:"SessionManager"};var xe=function(){var n=(0,y.PE)().t,e=(0,Wn.y0)().blocklet,t=(0,a.useRef)(null),N=(0,Dn.DJ)().roles,S=(0,v.Z)((function(n){return n.breakpoints.down("md")})),w=(0,j.Z)({saveLoading:!1,resetLoading:!1,showResetConfirm:!1,mockRole:"owner"}),C=ie(),P=C.state,O=C.navigation,E=C.getNavigation,A=C.saveNavigationList,R=C.resetNavigation,T=C.updateActiveSection,_=C.updateNavigationTree,I=C.updateNavigationItem,M=C.delNavigationItem,W=C.addNavigationItem,z=(0,a.useCallback)((function(n){t.current.add({parent:n},(function(n,e){W(e),n()}))}),[W]),J=(0,a.useCallback)((function(n){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};switch(n){case"edit":t.current.edit(e,(function(n,e){I(e),n()}));break;case"toggle":I({id:e.id,visible:!e.visible});break;case"del":M(e.id)}}),[M,I]),B=(0,a.useCallback)((0,r.Z)((0,o.Z)().mark((function e(){return(0,o.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,w.saveLoading=!0,e.next=4,A(P.rawNavigation);case 4:k.Z.success(n("common.succeeded")),e.next=10;break;case 7:e.prev=7,e.t0=e.catch(0),k.Z.error((0,D.jsxs)(l.Z,{children:[(0,D.jsx)(g.Z,{variant:"subtitle2",children:n("navigation.actionFailed")}),(0,D.jsx)(g.Z,{variant:"body1",children:(0,Xn.Z)(e.t0)||e.t0.error})]}));case 10:return e.prev=10,w.saveLoading=!1,e.finish(10);case 13:case"end":return e.stop()}}),e,null,[[0,7,10,13]])}))),[P.rawNavigation,w,A,n]),q=(0,a.useCallback)((0,r.Z)((0,o.Z)().mark((function e(){return(0,o.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,w.resetLoading=!0,e.next=4,R();case 4:k.Z.success(n("navigation.action.resetSuccessful"),{variant:"success"}),e.next=10;break;case 7:e.prev=7,e.t0=e.catch(0),k.Z.error((0,D.jsxs)(l.Z,{children:[(0,D.jsx)(g.Z,{variant:"subtitle2",children:n("navigation.actionFailed")}),(0,D.jsx)(g.Z,{variant:"body1",children:(0,Xn.Z)(e.t0)||e.t0.error})]}));case 10:return e.prev=10,w.resetLoading=!1,e.finish(10);case 13:case"end":return e.stop()}}),e,null,[[0,7,10,13]])}))),[w,R,n]),G=(0,a.useMemo)((function(){return{session:(0,i.Z)((0,i.Z)({},he),{},{user:{did:e.appDid,fullName:"Preview User",role:w.mockRole}})}}),[e.appDid,w.mockRole]);return(0,D.jsxs)(D.Fragment,{children:[S&&(0,D.jsx)(p.Z,{fullWidth:!0,size:"small",value:P.activeSection,onChange:function(n){return T(n.target.value)},children:Object.keys(ge).map((function(n){return(0,D.jsxs)(f.Z,{value:n,children:[ge[n]," (".concat(E(n).length,")")]})}))}),!S&&(0,D.jsx)(s.Z,{variant:"outlined",children:Object.keys(ge).map((function(n){return(0,D.jsxs)(c.Z,{variant:P.activeSection===n?"contained":void 0,onClick:function(){return T(n)},children:[ge[n]," (".concat(E(n).length,")")]},n)}))}),(0,D.jsxs)(h.Z,{variant:"dense",sx:{paddingLeft:"0px !important",paddingRight:"0px !important",mt:2},children:[(0,D.jsx)(g.Z,{variant:"h6",component:"div",sx:{flexGrow:1},children:n("common.config")}),(0,D.jsx)(s.Z,{variant:"outlined",children:(0,D.jsx)(x.Z,{size:"small",variant:"outlined",color:"error",startIcon:(0,D.jsx)(b.JO,{icon:"system-uicons:reset"}),sx:{mr:2},loading:w.resetLoading,loadingPosition:"start",onClick:function(){w.showResetConfirm=!0},children:n("navigation.action.reset")})}),(0,D.jsxs)(s.Z,{variant:"outlined",children:[(0,D.jsx)(c.Z,{size:"small",variant:"outlined",startIcon:(0,D.jsx)(b.JO,{icon:"mdi:plus"}),onClick:function(){return z()},children:n("navigation.action.new")}),(0,D.jsx)(x.Z,{size:"small",variant:"contained",startIcon:(0,D.jsx)(b.JO,{icon:"mdi:content-save"}),loading:w.saveLoading,loadingPosition:"start",onClick:B,children:n("common.save")})]})]}),(0,D.jsx)(m.Z,{variant:"outlined",sx:{display:"flex",height:280,overflow:"hidden"},children:(0,D.jsx)(m.Z,{elevation:0,sx:{flex:1,overflow:"auto"},children:(0,D.jsx)(F,{treeData:E(P.activeSection),setTreeData:_,renderActions:function(n){var e=n.data,t=n.className;return(0,D.jsx)(Vn,{data:e,className:t,section:P.activeSection,add:function(){return z.apply(void 0,arguments)},del:function(){for(var n=arguments.length,e=new Array(n),t=0;t<n;t++)e[t]=arguments[t];return J.apply(void 0,["del"].concat(e))},edit:function(){for(var n=arguments.length,e=new Array(n),t=0;t<n;t++)e[t]=arguments[t];return J.apply(void 0,["edit"].concat(e))},toggle:function(){for(var n=arguments.length,e=new Array(n),t=0;t<n;t++)e[t]=arguments[t];return J.apply(void 0,["toggle"].concat(e))}})}})})}),(0,D.jsxs)(h.Z,{variant:"dense",sx:{paddingLeft:"0px !important",paddingRight:"0px !important",mt:3},children:[(0,D.jsx)(g.Z,{variant:"h6",component:"div",sx:{flexGrow:1},children:n("common.preview")}),(0,D.jsxs)(u.Z,{sx:{m:1,minWidth:120},size:"small",children:[(0,D.jsx)(d.Z,{children:n("common.role")}),(0,D.jsx)(p.Z,{value:w.mockRole,label:"Role",onChange:function(n){w.mockRole=n.target.value},children:N.map((function(n){return(0,D.jsx)(f.Z,{value:n.name,children:n.title},n.name)}))})]})]}),(0,D.jsx)(m.Z,{variant:"outlined",children:(0,D.jsx)(L.B3.Provider,{value:G,children:(0,D.jsx)(pe,{navigation:O})})}),(0,D.jsx)(qn,{ref:t,section:P.activeSection,components:P.components,rawNavigations:P.rawNavigation}),(0,D.jsx)(Z.I4,{confirmButton:{text:n("common.confirm"),props:{variant:"contained",color:"error"}},cancelButton:{text:n("common.cancel"),props:{color:"primary"}},open:w.showResetConfirm,title:n("navigation.action.restConfirmTitle"),onConfirm:function(){var n=(0,r.Z)((0,o.Z)().mark((function n(){return(0,o.Z)().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,q();case 2:w.showResetConfirm=!1;case 3:case"end":return n.stop()}}),n)})));return function(){return n.apply(this,arguments)}}(),onCancel:function(){w.showResetConfirm=!1},children:(0,D.jsx)("p",{children:n("navigation.action.restConfirmDesc")})})]})}}}]);
2
+ //# sourceMappingURL=4023.623d31df.chunk.js.map