@abtnode/blocklet-services 1.16.16-beta-ca17cc31 → 1.16.16

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 (87) hide show
  1. package/api/emails/components/copyright.js +3 -1
  2. package/api/socket/channel/component.js +18 -19
  3. package/build/asset-manifest.json +97 -97
  4. package/build/index.html +1 -1
  5. package/build/service-worker.js +1 -1
  6. package/build/service-worker.js.map +1 -1
  7. package/build/static/js/{1013.48b6d77d.chunk.js → 1013.7b9f0d1c.chunk.js} +3 -3
  8. package/build/static/js/{1480.88c590c2.chunk.js → 1480.4d4dda1b.chunk.js} +2 -2
  9. package/build/static/js/1565.ba7ad6c9.chunk.js +2 -0
  10. package/build/static/js/2291.1627e4db.chunk.js +2 -0
  11. package/build/static/js/{2393.c5bbedfd.chunk.js → 2393.29558f48.chunk.js} +2 -2
  12. package/build/static/js/{2631.54f86f84.chunk.js → 2631.58f5f3bd.chunk.js} +2 -2
  13. package/build/static/js/2653.e7392aa1.chunk.js +2 -0
  14. package/build/static/js/{2686.7ae70bfd.chunk.js → 2686.890b32ed.chunk.js} +2 -2
  15. package/build/static/js/{2838.6fa46760.chunk.js → 2838.777de983.chunk.js} +3 -3
  16. package/build/static/js/{3038.8cbed218.chunk.js → 3038.40d611d1.chunk.js} +2 -2
  17. package/build/static/js/3593.4d68c718.chunk.js +2 -0
  18. package/build/static/js/3595.e2b52a55.chunk.js +3 -0
  19. package/build/static/js/3688.a821d97e.chunk.js +2 -0
  20. package/build/static/js/4023.c145cf94.chunk.js +2 -0
  21. package/build/static/js/{4355.42023420.chunk.js → 4355.7ff96d41.chunk.js} +2 -2
  22. package/build/static/js/4420.8b69d6e7.chunk.js +2 -0
  23. package/build/static/js/4706.d0c07efb.chunk.js +3 -0
  24. package/build/static/js/4716.bd8bed1b.chunk.js +2 -0
  25. package/build/static/js/{476.1f6135d6.chunk.js → 476.f196e88a.chunk.js} +2 -2
  26. package/build/static/js/4802.c534aa74.chunk.js +2 -0
  27. package/build/static/js/{5465.e0965b1d.chunk.js → 5465.19cd4b1f.chunk.js} +2 -2
  28. package/build/static/js/5628.8e4d578c.chunk.js +2 -0
  29. package/build/static/js/{5673.ab67c509.chunk.js → 5673.24aec022.chunk.js} +2 -2
  30. package/build/static/js/{5683.7e5d47f1.chunk.js → 5683.19dfa1f2.chunk.js} +2 -2
  31. package/build/static/js/{5960.adcd2848.chunk.js → 5960.e6da30ae.chunk.js} +2 -2
  32. package/build/static/js/{5982.89bdb419.chunk.js → 5982.27671e0b.chunk.js} +2 -2
  33. package/build/static/js/6186.99068c82.chunk.js +2 -0
  34. package/build/static/js/6452.8510e39f.chunk.js +2 -0
  35. package/build/static/js/{6498.bd96fa39.chunk.js → 6498.698608f8.chunk.js} +2 -2
  36. package/build/static/js/6576.2afa44eb.chunk.js +2 -0
  37. package/build/static/js/6737.16a327aa.chunk.js +2 -0
  38. package/build/static/js/{6771.acc94e01.chunk.js → 6771.fae30b2e.chunk.js} +3 -3
  39. package/build/static/js/6856.2eb98754.chunk.js +2 -0
  40. package/build/static/js/{6868.f2fd5c29.chunk.js → 6868.b4a7c4d1.chunk.js} +2 -2
  41. package/build/static/js/{6640.f40cecbd.chunk.js → 6919.aa19f009.chunk.js} +2 -2
  42. package/build/static/js/{7465.babf76bb.chunk.js → 6974.9fe85473.chunk.js} +3 -3
  43. package/build/static/js/{7006.b72aff66.chunk.js → 7006.8f0645e5.chunk.js} +2 -2
  44. package/build/static/js/{7367.60cb10e0.chunk.js → 7367.c5adfbb1.chunk.js} +2 -2
  45. package/build/static/js/7516.eb541f26.chunk.js +2 -0
  46. package/build/static/js/{8143.e1c8ca20.chunk.js → 8143.34374ce2.chunk.js} +2 -2
  47. package/build/static/js/{8497.0cf2247d.chunk.js → 8497.e83aa0c8.chunk.js} +2 -2
  48. package/build/static/js/{8604.ad77a749.chunk.js → 8604.ad426a4a.chunk.js} +3 -3
  49. package/build/static/js/9088.4313ac38.chunk.js +3 -0
  50. package/build/static/js/9102.ff87def5.chunk.js +2 -0
  51. package/build/static/js/9409.c853d69d.chunk.js +2 -0
  52. package/build/static/js/941.94668382.chunk.js +2 -0
  53. package/build/static/js/{9899.af2e4f43.chunk.js → 9899.277d673f.chunk.js} +2 -2
  54. package/build/static/js/main.adbd79ef.js +3 -0
  55. package/package.json +25 -25
  56. package/build/static/js/1565.6df974b9.chunk.js +0 -2
  57. package/build/static/js/2291.4b1a6a86.chunk.js +0 -2
  58. package/build/static/js/2653.5dc29ed5.chunk.js +0 -2
  59. package/build/static/js/3593.c1eddcd6.chunk.js +0 -2
  60. package/build/static/js/3595.cbf763c8.chunk.js +0 -3
  61. package/build/static/js/3688.9bb1c7a8.chunk.js +0 -2
  62. package/build/static/js/4023.6d1a7ac8.chunk.js +0 -2
  63. package/build/static/js/4420.55971847.chunk.js +0 -2
  64. package/build/static/js/4706.212c92c8.chunk.js +0 -3
  65. package/build/static/js/4716.88f32cf2.chunk.js +0 -2
  66. package/build/static/js/4802.cf122fc7.chunk.js +0 -2
  67. package/build/static/js/50.cbaa5a4e.chunk.js +0 -3
  68. package/build/static/js/5628.e46ecc79.chunk.js +0 -2
  69. package/build/static/js/6186.6c16ec07.chunk.js +0 -2
  70. package/build/static/js/6452.143af37a.chunk.js +0 -2
  71. package/build/static/js/6576.f78daf32.chunk.js +0 -2
  72. package/build/static/js/6700.5dfd9c70.chunk.js +0 -2
  73. package/build/static/js/6737.7d135225.chunk.js +0 -2
  74. package/build/static/js/6856.e185e317.chunk.js +0 -2
  75. package/build/static/js/9102.828066ce.chunk.js +0 -2
  76. package/build/static/js/9409.62a2aee0.chunk.js +0 -2
  77. package/build/static/js/941.6a4ed4dd.chunk.js +0 -2
  78. package/build/static/js/main.8ae2fba0.js +0 -3
  79. /package/build/static/js/{1013.48b6d77d.chunk.js.LICENSE.txt → 1013.7b9f0d1c.chunk.js.LICENSE.txt} +0 -0
  80. /package/build/static/js/{2838.6fa46760.chunk.js.LICENSE.txt → 2838.777de983.chunk.js.LICENSE.txt} +0 -0
  81. /package/build/static/js/{3595.cbf763c8.chunk.js.LICENSE.txt → 3595.e2b52a55.chunk.js.LICENSE.txt} +0 -0
  82. /package/build/static/js/{4706.212c92c8.chunk.js.LICENSE.txt → 4706.d0c07efb.chunk.js.LICENSE.txt} +0 -0
  83. /package/build/static/js/{6771.acc94e01.chunk.js.LICENSE.txt → 6771.fae30b2e.chunk.js.LICENSE.txt} +0 -0
  84. /package/build/static/js/{7465.babf76bb.chunk.js.LICENSE.txt → 6974.9fe85473.chunk.js.LICENSE.txt} +0 -0
  85. /package/build/static/js/{8604.ad77a749.chunk.js.LICENSE.txt → 8604.ad426a4a.chunk.js.LICENSE.txt} +0 -0
  86. /package/build/static/js/{50.cbaa5a4e.chunk.js.LICENSE.txt → 9088.4313ac38.chunk.js.LICENSE.txt} +0 -0
  87. /package/build/static/js/{main.8ae2fba0.js.LICENSE.txt → main.adbd79ef.js.LICENSE.txt} +0 -0
@@ -0,0 +1,2 @@
1
+ (self.webpackChunk_abtnode_blocklet_services=self.webpackChunk_abtnode_blocklet_services||[]).push([[1565],{31565:function(e,n,t){"use strict";t.r(n),t.d(n,{default:function(){return po}});var r=t(33028),o=t(59740),i=t(19611),a=t.n(i),l=t(68079),c=t(71171),s=t(32723),u=t(34795),d=t(96234),p=t(30969),m=t(16380),f=t(24974),h=t.n(f),x=t(84636),v=t(38361),g=t(87130),Z=t(38357),y=t(91862),b=t(46973),k=t(94551),j=t(3715),C=t(78744),P=t(85385),R=t(55829),E=t(11909),T=t(3994),S=t(6779),w=t(88412),_=t(88876),U=t(13875),N=t(57256),I=t(10814),L=t(49884),D=t(34159),O=t(96628),B=t(20244),F=t(94308),q=t(70177),A=t(26022),G=t(29996),z=t(78789),W=t(7017),M=t(6399),K=t.n(M),V=t(1986),Y=t(43820),H=t(36558),X=t(61472),Q=t(2878),J=t.n(Q),$=t(9715),ee=t(19638),ne=t(37574);function te(e){var n,t=e.sourceInfo,r=e.blocklet,o=(0,p.useContext)(A.RD).t;return(0,ne.jsxs)(v.Z,{display:"flex",alignItems:"center",children:[(0,ne.jsx)($.Z,{type:"success",children:J()(t.source)},"source"),"registry"===t.source&&(0,ne.jsx)(ee.Z,{href:a()(t.deployedFrom,"blocklets",(null===r||void 0===r||null===(n=r.meta)||void 0===n?void 0:n.bundleDid)||""),target:"_blank",className:"page-link",underline:"hover",style:{display:"flex",alignItems:"center",marginLeft:8},children:o("blocklet.overview.viewInStore")})]})}te.propTypes={sourceInfo:h().shape({source:h().string,deployedFrom:h().string}),blocklet:h().object},te.defaultProps={sourceInfo:{},blocklet:{}};var re=t(94282),oe=t(88397),ie=t(59505),ae=t(8479),le=t(41395),ce=t(24891),se=t(22572),ue=["blocklet","checkUpgrade","hasPermission"];function de(e){var n=e.blocklet,t=e.checkUpgrade,i=e.hasPermission,a=(0,o.Z)(e,ue),l=(0,le.h6)().api,c=(0,p.useContext)(A.RD).t,m=(0,p.useState)(!1),f=(0,d.Z)(m,2),h=f[0],x=f[1],v=(0,p.useState)(""),g=(0,d.Z)(v,2),Z=g[0],y=g[1],b=(0,p.useState)(null),j=(0,d.Z)(b,2),C=j[0],P=j[1],R=(0,p.useState)(null),E=(0,d.Z)(R,2),T=E[0],w=E[1];(0,p.useEffect)((function(){P(null),t&&(n.mode,ie.BLOCKLET_MODES.DEVELOPMENT)}),[n,t]);var _=function(){var e=(0,u.Z)((0,s.Z)().mark((function e(){var t;return(0,s.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return x(!0),e.prev=1,t={did:n.meta.did,version:C.version,storeUrl:C.registryUrl||""},e.next=5,(0,ce._v)(2e3);case 5:return e.next=7,l.upgradeBlocklet({input:t});case 7:e.next=12;break;case 9:e.prev=9,e.t0=e.catch(1),V.Z.error("Blocklet upgrade failed: ".concat((0,ce.Z)(e.t0)));case 12:return e.prev=12,x(!1),w(null),e.finish(12);case 16:case"end":return e.stop()}}),e,null,[[1,9,12,16]])})));return function(){return e.apply(this,arguments)}}(),U={title:"".concat(c("common.upgrade")," ").concat(c("common.blocklet")," ").concat((0,W.getDisplayName)(n)),description:c("blocklet.action.upgradeDescription"),confirm:c("blocklet.action.confirmUpgrade"),cancel:c("common.cancel"),onConfirm:_,onCancel:function(){x(!1),w(null)}};return i&&C&&!(0,W.isInProgress)(n.status)?(0,ne.jsxs)(ne.Fragment,{children:[(0,ne.jsx)(X.Z,(0,r.Z)((0,r.Z)({},a),{},{children:n.meta.version})),(0,ne.jsx)(S.Z,{title:c("common.updateAvailable",{version:C.version}),children:(0,ne.jsx)(k.Z,{size:"small",style:{marginLeft:8},disabled:h,onClick:function(){return w(U)},children:h?(0,ne.jsx)(F.Z,{size:16}):(0,ne.jsx)(oe.Z,{style:{fontSize:16,color:"red"}})})}),!!Z&&(0,ne.jsx)(V.Z,{variant:"error",message:Z,onClose:function(){return y("")}}),T&&(0,ne.jsx)(ae.Z,{title:T.title,description:T.description,confirm:T.confirm,cancel:T.cancel,params:T.params,onConfirm:T.onConfirm,onCancel:T.onCancel})]}):(0,ne.jsx)(X.Z,(0,r.Z)((0,r.Z)({},a),{},{children:n.meta.version}))}de.propTypes={blocklet:h().object.isRequired,checkUpgrade:h().bool,hasPermission:h().bool},de.defaultProps={checkUpgrade:!1,hasPermission:!1};var pe=(0,se.V)(de,"mutate_blocklets"),me=(0,se.V)(de,"",ce.Wf);function fe(e){return(0,le.h6)().inService?(0,ne.jsx)(me,(0,r.Z)({},e)):(0,ne.jsx)(pe,(0,r.Z)({},e))}var he=t(70998),xe=["mode"];function ve(e){var n=e.mode,t=(0,o.Z)(e,xe);return"development"===n?(0,ne.jsx)(X.Z,(0,r.Z)((0,r.Z)({type:"primary"},t),{},{children:"DEV"})):null}ve.propTypes={mode:h().string.isRequired};var ge,Ze,ye,be=t(88356),ke=t(50496),je=t(19865),Ce=t(32666),Pe=t(87006),Re=t(18877),Ee=t(73820),Te=t(38996),Se=t(44181),we=t(60306),_e=t(56567),Ue=t(81172),Ne=t(75296),Ie=t(52838),Le=t(81779),De=t(90713),Oe=t(97475),Be=t(65481),Fe=t(83153),qe={Add:j.Z,Check:Te.default,Delete:I.default,Edit:be.default,Clear:Se.default,DetailPanel:Ie.default,Filter:_e.Z,FirstPage:Ue.default,LastPage:Ne.default,NextPage:Ie.default,PreviousPage:Le.default,Search:De.default,ResetSearch:Se.default,SortArrow:Oe.Z,Export:we.default,ThirdStateCheck:Be.default,ViewColumn:Fe.default},Ae=m.Z.div(ge||(ge=(0,c.Z)(["\n .MuiPaper-root {\n box-shadow: none !important;\n border: none !important;\n border-radius: 0 !important;\n background: transparent;\n }\n .MuiToolbar-root {\n background: transparent;\n padding-left: 0;\n display: none;\n }\n\n &.show-pagination {\n .MuiTablePagination-toolbar {\n display: flex;\n }\n }\n\n .MuiTableHead-root th {\n min-width: 100px;\n background: transparent;\n }\n\n .MuiTable-root {\n overflow-y: hidden;\n }\n .MuiTableRow-root {\n border: none !important;\n }\n\n .MuiTableCell-root {\n padding-right: 16px;\n &:last-of-type {\n padding-right: 0;\n }\n }\n\n /* @material-table/core@next \u517c\u5bb9 mui v5, \u4f46 pagination \u6837\u5f0f\u4f3c\u4e4e\u6709\u4e9b\u95ee\u9898, \u6682\u5730\u5b9a\u5236\u4e0b\u9762\u7684\u6837\u5f0f\u4fee\u590d, \u540e\u9762\u8003\u8651\u5f03\u7528 material-table */\n .MuiTablePagination-selectLabel,\n .MuiTablePagination-displayedRows {\n display: none;\n }\n .MuiTypography-caption {\n display: inline-block;\n }\n .MuiTablePagination-selectLabel + .MuiInputBase-root {\n margin-right: 8px;\n }\n"]))),Ge=t(55008),ze=function(e,n){var t=e.description;return(Object.values(ie.CHAIN_PROP_MAP).includes(e.key)||(0,W.isEnvShareable)(e))&&(t=t?"".concat(t," (").concat(n("blocklet.config.sharedToAllComponents"),")"):n("blocklet.config.sharedToAllComponents")),t&&(0,ne.jsx)("div",{style:{marginLeft:12},children:t})},We=function(e,n){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];return!(null!==t&&void 0!==t&&t.length||e.custom||["CHAIN_ID","CHAIN_HOST"].includes(e.key)||n.meta.environments.find((function(n){return n.name===e.key}))||!n.children.every((function(n){return!n.meta.environments.find((function(n){return n.name===e.key}))})))||e.custom};function Me(e){var n=e.blocklet,t=e.ancestors,o=(0,le.h6)(),i=o.inService,a=(0,p.useContext)(A.RD).t,c=[].concat((0,l.Z)(t.map((function(e){return e.meta.did}))),[n.meta.did]),d=function(){return V.Z.success(a("blocklet.config.changedTip"))},m=function(e){return We(e,n,t)};if((0,ce.wS)(n.status))return null;if("unknown"===n.status&&(0,ce.wS)(n.status))return null;var f=function(){var e=(0,u.Z)((0,s.Z)().mark((function e(n){var t;return(0,s.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n.key.trim()&&n.value.trim()){e.next=3;break}return V.Z.error(a("blocklet.config.environment.keyValueRequired")),e.abrupt("return");case 3:if(!n.key.startsWith("BLOCKLET_")&&!n.key.startsWith("COMPONENT_")){e.next=6;break}return V.Z.error(a("blocklet.config.environment.invalidKey")),e.abrupt("return");case 6:return n.custom=!0,e.next=9,o.api.configBlocklet({input:{did:c,configs:[n]}});case 9:"ok"===(t=e.sent).code&&d(t.blocklet);case 11:case"end":return e.stop()}}),e)})));return function(n){return e.apply(this,arguments)}}(),h=function(){var e=(0,u.Z)((0,s.Z)().mark((function e(r,i){var l,u,p;return(0,s.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!r.required||r.key.trim()&&r.value.trim()){e.next=3;break}return V.Z.error(a("blocklet.config.environment.keyValueRequired")),e.abrupt("return");case 3:if(!r.key.startsWith("BLOCKLET_")||ie.BLOCKLET_CONFIGURABLE_KEY[r.key]){e.next=6;break}return V.Z.error(a("blocklet.config.environment.invalidKey")),e.abrupt("return");case 6:if(r.key!==ie.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_CLUSTER_SIZE){e.next=11;break}if(!(l=(0,ce.I)(r))){e.next=11;break}return V.Z.error(l),e.abrupt("return");case 11:if(u=[r],r.key===i.key){e.next=17;break}if(We(r,n,t)){e.next=16;break}return V.Z.error("Only key of custom env can be changed"),e.abrupt("return");case 16:u.push({key:i.key,custom:!0});case 17:return e.prev=17,e.next=20,o.api.configBlocklet({input:{did:c,configs:u}});case 20:"ok"===(p=e.sent).code&&d(p.blocklet),e.next=27;break;case 24:e.prev=24,e.t0=e.catch(17),V.Z.error((0,ce.Z)(e.t0));case 27:case"end":return e.stop()}}),e,null,[[17,24]])})));return function(n,t){return e.apply(this,arguments)}}(),x=function(){var e=(0,u.Z)((0,s.Z)().mark((function e(r){var i;return(0,s.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!r.required){e.next=3;break}return V.Z.error(a("blocklet.config.environment.deleteForbidden")),e.abrupt("return");case 3:if(We(r,n,t)){e.next=6;break}return V.Z.error("Only key of custom env can be changed"),e.abrupt("return");case 6:return e.next=8,o.api.configBlocklet({input:{did:c,configs:[{key:r.key,custom:!0}]}});case 8:"ok"===(i=e.sent).code&&d(i.blocklet);case 10:case"end":return e.stop()}}),e)})));return function(n){return e.apply(this,arguments)}}(),v=(n.configs||[]).filter((function(e){return!ie.BLOCKLET_CONFIGURABLE_KEY[e.key]})),g=(0,W.getSharedConfigObj)(t[0],n),Z=(0,W.getComponentMissingConfigs)(n,t[0]),y=v.map((function(e){return(0,r.Z)((0,r.Z)({},e),{},{value:Object.values(ie.CHAIN_PROP_MAP).includes(e.key)&&Object.keys(g).includes(e.key)?g[e.key]:g[e.key]||e.value})})),b=y.some((function(e){return e.key&&e.key.startsWith("BWA_")})),k={onRowAdd:f,onRowUpdate:h,onRowDelete:x,isDeletable:m};return(0,ne.jsxs)(Ve,{children:[!!Z.length&&(0,ne.jsx)(Re.Z,{severity:"error",style:{marginTop:24},children:a("blocklet.config.missingRequired")}),b&&(0,ne.jsx)(Re.Z,{severity:"info",children:a("blocklet.config.environment.tip")}),(0,ne.jsx)(se.Z,{permission:i?"":"mutate_blocklets",role:i?ce.Wf:[],children:function(e){return(0,ne.jsx)(Ae,{className:"config-table",children:(0,ne.jsx)(Ce.ZP,{title:(0,ne.jsx)("h4",{children:a("common.environment")}),columns:[{title:a("common.key"),field:"key",initialEditValue:"Key",width:"30%",render:function(e){return(0,ne.jsx)(Ee.Z,{value:e.value,style:{color:e.required&&!e.value?"#ff4436":"#222222",fontWeight:e.required?"bold":"normal"},children:e.key})},editComponent:function(e){var n=e.value,t=e.rowData,r=e.onChange;return(0,ne.jsx)(Ye,{children:(0,ne.jsx)(Pe.Z,{fullWidth:!0,size:"small",disabled:!1===m(t),value:n,onChange:function(e){return r(e.target.value)},variant:"outlined",label:"Key",placeholder:a("blocklet.config.environment.key"),margin:"dense",autoFocus:!0})})}},{title:a("common.value"),field:"value",initialEditValue:"Value",width:"calc((100% - (96px + 30%)) / 1)",render:function(e){return e.value?e.secure?"******":(0,ne.jsx)(Ee.Z,{unstyled:!0,value:e.value,style:{wordBreak:"break-all"},children:e.value}):null},editComponent:function(e){var n=e.value,t=e.rowData,r=e.onChange;return(0,ne.jsxs)(Ye,{children:[(0,ne.jsx)(Pe.Z,{fullWidth:!0,size:"small",value:"__encrypted__"===n?"":n,onChange:function(e){return r(e.target.value)},variant:"outlined",label:a("common.value"),placeholder:a("blocklet.config.environment.value"),margin:"dense",autoFocus:!0}),ze(t,a)]})}}],icons:(0,r.Z)((0,r.Z)({},Ge.Z),qe),options:{emptyRowsWhenPaging:!1,actionsColumnIndex:-1,tableLayout:"auto",maxBodyHeight:"100%",paging:!1,search:!1},localization:{header:{actions:a("common.actions")},body:{emptyDataSourceMessage:a("common.noData")}},data:y,editable:e?k:{}})})}})]})}Me.propTypes={blocklet:h().object.isRequired,ancestors:h().array},Me.defaultProps={ancestors:[]};var Ke,Ve=m.Z.div(Ze||(Ze=(0,c.Z)(["\n .config-table {\n margin-bottom: 24px;\n position: relative;\n .hide-control {\n position: absolute;\n top: 10px;\n left: 200px;\n @media (max-width: ","px) {\n left: 160px;\n }\n }\n\n .MuiToolbar-root {\n display: flex;\n }\n\n .MuiTableRow-head {\n display: none;\n }\n\n &.hide-header {\n .MuiToolbar-root {\n display: none;\n }\n }\n }\n\n .accordion {\n margin-bottom: 16px;\n &:last-of-type {\n margin-bottom: 0;\n }\n padding: 8px 0 8px 0px;\n &.MuiAccordion-root {\n background: transparent;\n box-shadow: none;\n border: 1px solid #ddd;\n border-radius: 4px;\n &::before,\n &::after {\n height: 0;\n }\n .MuiAccordionSummary-root {\n padding-left: 0;\n }\n .accordion-title {\n font-weight: bold;\n padding-left: 16px;\n }\n }\n }\n"])),(function(e){return e.theme.breakpoints.values.sm})),Ye=m.Z.div(ye||(ye=(0,c.Z)(["\n height: 60px;\n"]))),He=t(88617),Xe=t(67019),Qe=["blocklet","ancestors","hasPermission"];function Je(e){var n=e.blocklet,t=e.ancestors,i=e.hasPermission,a=(0,o.Z)(e,Qe),l=(0,A.PE)().t,c=(0,le.h6)().api,m=!t.length,f=m?n.meta.did:t.map((function(e){return e.meta.did}))[0],h=(0,p.useState)(""),x=(0,d.Z)(h,2),g=x[0],Z=x[1],y=(0,p.useState)(""),b=(0,d.Z)(y,2),k=b[0],j=b[1],C=g||!i;if(!f)return null;if("unknown"===n.status&&(0,ce.wS)(n.status))return null;var P=function(){var e=(0,u.Z)((0,s.Z)().mark((function e(t){var r;return(0,s.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Z(!0),e.prev=1,r={rootDid:f,mountPoint:(0,He.default)(t)},m||(r.did=n.meta.did),e.next=6,c.updateComponentMountPoint({input:r});case 6:return Z(!1),e.abrupt("return",!0);case 10:throw e.prev=10,e.t0=e.catch(1),Z(!1),e.t0.message=(0,ce.Z)(e.t0),V.Z.error(e.t0.message),e.t0;case 16:case"end":return e.stop()}}),e,null,[[1,10]])})));return function(n){return e.apply(this,arguments)}}();return(0,ne.jsx)(rn,(0,r.Z)((0,r.Z)({component:"div"},a),{},{children:(0,ne.jsx)(v.Z,{mt:3,children:(0,ne.jsx)(Xe.Z,{label:l("blocklet.component.mountPoint"),style:{marginTop:-24},disabled:g||C,loading:g,required:!0,initialValue:n.mountPoint,onSubmit:P,onChange:function(e){j(l("common.slugifyHint",{value:(0,ce.LN)(e)}))},helperText:k,formatterBeforeSubmit:function(e){return(0,He.default)(e)}})})}))}var $e=(0,se.V)(Je,"mutate_blocklets"),en=(0,se.V)(Je,"",ce.Wf);function nn(e){return(0,le.h6)().inService?(0,ne.jsx)(en,(0,r.Z)({},e)):(0,ne.jsx)($e,(0,r.Z)({},e))}Je.propTypes={blocklet:h().object.isRequired,ancestors:h().array,hasPermission:h().bool},Je.defaultProps={ancestors:[],hasPermission:!1};var tn,rn=m.Z.div(Ke||(Ke=(0,c.Z)([""])));function on(e){var n=e.blocklet,t=e.ancestors,r=e.children,o=(0,p.useState)(""),i=(0,d.Z)(o,2),a=i[0],l=i[1],c=(0,A.PE)().t,s=!!t.length,u=(0,p.useState)("settings"),m=(0,d.Z)(u,2),f=m[0],h=m[1],x=s?(0,W.getDisplayName)(n,!0):c("blocklet.component.container");if((0,ce.wS)(n.status))return null;if("unknown"===n.status&&(0,ce.wS)(n.status))return null;var g=function(e){e.stopPropagation(),l(!0)},Z={settings:{label:c("blocklet.component.setting"),value:"settings",component:(0,ne.jsx)(nn,{blocklet:n,ancestors:t})},environments:{label:c("common.environment"),value:"environments",component:(0,ne.jsx)(Me,{blocklet:n,ancestors:t})}},y=Object.values(Z).map((function(e){return{label:e.label,value:e.value}})),b=Z[f]||Z.settings;return["function"===typeof r?r({open:g}):(0,ne.jsx)(k.Z,{onClick:g,"data-cy":"action-config-component",children:(0,ne.jsx)(be.default,{})}),a&&(0,ne.jsx)(ln,{open:!0,fullWidth:!0,maxWidth:"md",title:x,onClose:function(){l(!1)},PaperProps:{style:{minHeight:"auto"}},children:s?(0,ne.jsxs)(v.Z,{mt:1,children:[(0,ne.jsx)(je.Z,{tabs:y,current:f,onChange:function(e){h(e)},scrollButtons:"auto"}),b.component]}):(0,ne.jsx)(Me,{blocklet:n,ancestors:t})})]}on.propTypes={blocklet:h().object.isRequired,ancestors:h().array,children:h().any},on.defaultProps={ancestors:[],children:null};var an,ln=(0,m.Z)(ke.ZP)(tn||(tn=(0,c.Z)(["\n .MuiDialogContent-root {\n padding-top: 0;\n margin-top: -32px;\n }\n .MuiToolbar-root {\n padding-right: 12px;\n }\n .ux-dialog_right {\n padding-right: 20px;\n }\n"]))),cn=t(33359),sn=t(76492),un=t(97517);function dn(e){var n=e.component,t=e.remove,o=e.disabled,i=e.tip,a=e.showConfirm,l=e.hideBtn,c=e.onCancel,m=(0,p.useContext)(A.RD).t,f=(0,p.useState)(!1),h=(0,d.Z)(f,2),x=h[0],v=h[1],g=(0,p.useState)(null),Z=(0,d.Z)(g,2),y=Z[0],b=Z[1],k=function(){var e=(0,u.Z)((0,s.Z)().mark((function e(n){return(0,s.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return v(!0),e.next=3,t(n.component,n.removeType);case 3:v(!1),b(null);case 5:case"end":return e.stop()}}),e)})));return function(n){return e.apply(this,arguments)}}(),j=o||x,C=function(){b({title:"".concat(m("common.delete")," ").concat(n.meta.title||n.meta.name),description:function(e,n){return(0,ne.jsxs)(cn.Z,{component:"div",children:[(0,ne.jsx)(cn.Z,{gutterBottom:!0,children:m("blocklet.action.removeComponentDescription")}),(0,ne.jsxs)(un.Z,{name:"removeType",value:e.removeType,onChange:function(t){return n((0,r.Z)((0,r.Z)({},e),{},{removeType:t.target.value}))},children:[(0,ne.jsx)(L.Z,{value:"keepData",control:(0,ne.jsx)(sn.Z,{}),label:m("blocklet.action.removeComponentKeepData")}),(0,ne.jsx)(L.Z,{value:"complete",control:(0,ne.jsx)(sn.Z,{}),label:m("blocklet.action.removeComponentComplete")})]})]})},confirm:m("common.confirm"),cancel:m("common.cancel"),params:{component:n,removeType:"keepData"},onConfirm:k,onCancel:function(){b(null),c()}})};(0,p.useEffect)((function(){a?C():(v(!1),b(null))}),[a]);var P=(0,ne.jsx)(mn,{size:"small",disabled:j,onClick:function(){return C},"data-cy":"delete-component-btn",children:(0,ne.jsx)(I.default,{disabled:j})}),R=(0,ne.jsx)(S.Z,{title:i||m("common.delete"),children:(0,ne.jsx)("span",{children:P})});return(0,ne.jsxs)(ne.Fragment,{children:[!l&&R,y&&(0,ne.jsx)(ae.Z,{title:y.title,description:y.description,confirm:y.confirm,cancel:y.cancel,params:y.params,onConfirm:y.onConfirm,onCancel:y.onCancel})]})}dn.propTypes={component:h().object.isRequired,remove:h().func,onCancel:h().func,disabled:h().bool,showConfirm:h().bool,hideBtn:h().bool,tip:h().string},dn.defaultProps={remove:function(){var e=(0,u.Z)((0,s.Z)().mark((function e(){return(0,s.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),disabled:!1,showConfirm:!1,hideBtn:!1,onCancel:function(){},tip:""};var pn,mn=(0,m.Z)(k.Z)(an||(an=(0,c.Z)(["\n &.Mui-disabled {\n opacity: 0.5;\n }\n"]))),fn=t(8825),hn=t(60003);function xn(e){var n=e.component,t=e.onStart,r=e.onStop,o=e.disabled,i=e.tip,a=(0,p.useContext)(A.RD).t,l=(0,p.useState)(!1),c=(0,d.Z)(l,2),m=c[0],f=c[1],h=(0,p.useState)(),x=(0,d.Z)(h,2),v=x[0],g=x[1],Z=function(){var e=(0,u.Z)((0,s.Z)().mark((function e(){return(0,s.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return f(!0),e.prev=1,e.next=4,t(n);case 4:e.next=9;break;case 6:e.prev=6,e.t0=e.catch(1),V.Z.error(e.t0.message);case 9:f(!1);case 10:case"end":return e.stop()}}),e,null,[[1,6]])})));return function(){return e.apply(this,arguments)}}(),y=function(){var e=(0,u.Z)((0,s.Z)().mark((function e(){return(0,s.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return f(!0),e.prev=1,e.next=4,r(n);case 4:e.next=9;break;case 6:e.prev=6,e.t0=e.catch(1),V.Z.error(e.t0.message);case 9:f(!1);case 10:case"end":return e.stop()}}),e,null,[[1,6]])})));return function(){return e.apply(this,arguments)}}(),b=o||m,k=["starting","running","stopping"].includes(n.status),j=k?hn.Z:fn.Z,C=(0,ne.jsx)(vn,{disabled:b,onClick:function(){var e;k?g({title:"".concat(a("common.stop")," ").concat(null===n||void 0===n||null===(e=n.meta)||void 0===e?void 0:e.title),description:a("blocklet.action.stopComponentDescription"),confirm:a("blocklet.action.confirmStop"),cancel:a("common.cancel"),onConfirm:function(){return g(null),y()},onCancel:function(){return g(null)}}):Z()},"data-cy":"".concat(k?"stop":"start","-component-btn"),children:(0,ne.jsx)(j,{disabled:b})});return[(0,ne.jsx)(S.Z,{title:i||a("common.".concat(k?"stop":"start")),children:(0,ne.jsx)("span",{children:C})},"btn"),v&&(0,ne.jsx)(ae.Z,{title:v.title,description:v.description,confirm:v.confirm,cancel:v.cancel,params:v.params,onConfirm:v.onConfirm,onCancel:v.onCancel},"connect")]}xn.propTypes={component:h().object.isRequired,onStart:h().func,onStop:h().func,disabled:h().bool,tip:h().string},xn.defaultProps={onStart:function(){var e=(0,u.Z)((0,s.Z)().mark((function e(){return(0,s.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),onStop:function(){var e=(0,u.Z)((0,s.Z)().mark((function e(){return(0,s.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),disabled:!1,tip:""};var vn=(0,m.Z)(k.Z)(pn||(pn=(0,c.Z)(["\n &.Mui-disabled {\n opacity: 0.5;\n }\n"]))),gn=t(2569),Zn=t(12700),yn=t.n(Zn),bn=t(43260),kn=t.n(bn),jn=t(76032),Cn=t.n(jn),Pn=t(60523),Rn=t.n(Pn),En=t(99398),Tn=t(43207),Sn=t(2689),wn=t(1437),_n=t(75255),Un=t(66629),Nn=t(43001),In=t(23299),Ln=t(78598),Dn=t(65248),On=t(45008),Bn=t(8016),Fn=t(14458),qn=t(72836),An=t(59485),Gn=t.n(An),zn=t(54559),Wn=t(74743),Mn=t(67888),Kn=t(9943),Vn=t(86008),Yn=t(93310),Hn=t(64698),Xn=t(36508),Qn=t(6200),Jn={meta:h().object.isRequired,onCancel:h().func.isRequired},$n=(0,Wn.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 et(e){var n=e.action,t=e.onSelect,r=e.onNext,o=$n(),i=(0,A.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,ne.jsxs)(ne.Fragment,{children:[(0,ne.jsx)(Mn.Z,{className:o.tabPanel,children:a.map((function(e){return(0,ne.jsxs)(Kn.ZP,{button:!0,selected:n===e.action,onClick:function(){return t(e.action)},children:[(0,ne.jsx)(Yn.Z,{className:o.iconRoot,children:"purchase"===e.action?(0,ne.jsx)(Hn.Z,{style:{color:"purchase"===n?Qn.Z.primary.main:"#AAA",fontSize:32}}):(0,ne.jsx)(Xn.Z,{style:{color:"verify"===n?Qn.Z.primary.main:"#AAA",fontSize:32}})}),(0,ne.jsx)(Vn.Z,{primary:e.title,secondary:e.description})]},e.action)}))}),r&&(0,ne.jsx)(G.Z,{fullWidth:!0,disabled:!n,variant:"contained",color:"primary",style:{marginTop:16},onClick:r,children:i("common.next")})]})}et.propTypes={action:h().oneOf(["both","purchase","verify"]).isRequired,onSelect:h().func.isRequired,onNext:h().func.isRequired};var nt=["mode"];function tt(e){var n=e.meta,t=e.onCancel,o=e.mode,i=e.handlePaySuccess,l=(0,A.PE)(),c=l.t,m=l.locale,f=(0,le.h6)().info,h=(0,ce.yP)(f),x=(0,p.useState)(null),v=(0,d.Z)(x,2),g=v[0],Z=v[1],y=new URL(null===n||void 0===n?void 0:n.registryUrl).origin,b=(0,W.getDisplayName)({meta:n}),k=function(){var e=(0,u.Z)((0,s.Z)().mark((function e(n,r){var a,l,d,p,m;return(0,s.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(d=function(e){return Gn()((function(){return zn.hi.get(e).then(function(){var e=(0,u.Z)((0,s.Z)().mark((function e(n){var t,r;return(0,s.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=n.data,r=null===t||void 0===t?void 0:t.downloadTokenList,"succeed"!==t.status){e.next=12;break}if(!r||!r.length){e.next=8;break}return e.next=6,a({downloadTokenList:r});case 6:e.next=11;break;case 8:return e.next=10,l(c("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,l(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})},a=function(e){var n=e.downloadTokenList;i({downloadTokenList:n})},l=function(e){V.Z.error(e),t(e)},"purchase"!==o||!g){e.next=9;break}return p=(0,ce.Pi)(g),m=p.statusUrl,e.next=7,d(m);case 7:e.next=11;break;case 9:return e.next=11,a({downloadTokenList:n.downloadTokenList&&r(n.downloadTokenList)});case 11:case"end":return e.stop()}}),e)})));return function(n,t){return e.apply(this,arguments)}}();if((0,p.useEffect)((function(){if("purchase"===o){var e=new URL(y);e.pathname="/api/did/verify-purchase-blocklet/token",e.searchParams.set("serverDid",f.did),e.searchParams.set("blockletDid",null===n||void 0===n?void 0:n.did);try{zn.hi.get(e.href).then((function(e){var n=e.data,t="".concat(n.url);Z(t)}))}catch(t){console.error("get next workflow url error: ",t)}}return function(){Z(null)}}),[o]),"purchase"===o&&!g)return"";var j={verify:{action:"verify-purchase-blocklet",checkFn:zn.od.create({baseURL:y}).get,extraParams:{serverDid:f.did,blockletDid:null===n||void 0===n?void 0:n.did},messages:{title:c("store.purchase.verify.auth.title",{name:b}),scan:c("store.purchase.verify.auth.scan"),confirm:c("store.purchase.verify.auth.confirm"),success:c("store.purchase.verify.auth.success")}},purchase:{action:"acquire-asset",checkFn:zn.od.create({baseURL:a()(y,"/store")}).get,extraParams:{factory:n.nftFactory,nw:g},messages:{title:c("store.purchase.auth.title",{name:b}),scan:c("store.purchase.auth.scan"),confirm:c("store.purchase.auth.confirm"),success:(0,ne.jsxs)(ne.Fragment,{children:[(0,ne.jsx)("p",{children:c("store.purchase.auth.success")}),(0,ne.jsx)("p",{children:c("blocklet.component.purchaseComponentSecondCheckTip")})]})}}};return(0,ne.jsx)(qn.default,(0,r.Z)({open:!0,locale:m,popup:!1,saveConnect:!1,className:"connect",baseUrl:y,onSuccess:k,cancelWhenScanned:t,onClose:t,checkTimeout:3e5,webWalletUrl:h,disableClose:!0,showDownload:!1},j[o]))}tt.propTypes=(0,r.Z)((0,r.Z)({},Jn),{},{handlePaySuccess:h().func,mode:h().oneOf(["verify","purchase"]).isRequired}),tt.defaultProps={handlePaySuccess:function(){}};var rt=(0,p.forwardRef)((function(e,n){var t=e.mode,i=(0,o.Z)(e,nt),a=(0,p.useState)("both"!==t?t:"verify"),l=(0,d.Z)(a,2),c=l[0],s=l[1],u=(0,p.useState)("both"!==t?2:1),m=(0,d.Z)(u,2),f=m[0],h=m[1],x=function(){c&&2!==f&&h(2)};return(0,p.useImperativeHandle)(n,(function(){return{onNext:x,getCurrentStep:function(){return f}}})),1===f?(0,ne.jsx)("div",{style:{maxWidth:520},children:(0,ne.jsx)(et,{action:c,onNext:null,onSelect:function(e){e!==c&&s(e)}})}):(0,ne.jsx)(tt,(0,r.Z)((0,r.Z)({},i),{},{mode:c}))}));rt.propTypes={mode:h().oneOf(["both","verify","purchase"]).isRequired,ref:h().any},rt.defaultProps={ref:{}};var ot,it=rt,at=t(52654),lt=t(30734),ct=t(94486),st=t(30250),ut=t(33665);function dt(e){var n=Object.assign({},((0,ut.Z)(e),e));return(0,ne.jsxs)("div",(0,r.Z)((0,r.Z)({},n),{},{style:{width:"100%"},children:[(0,ne.jsx)("h3",{children:"End User License Agreement for Application"}),(0,ne.jsxs)("p",{children:["Blocklet Server License Agreement ",B.COPYRIGHT_OWNER," version 2020-08-28"]}),(0,ne.jsx)("p",{children:"BLOCKLET SERVER LICENSE AGREEMENT"}),(0,ne.jsx)("p",{children:"\u6682\u65e0"})]}))}function pt(e){var n=e.meta,t=e.onClickNext,r=e.handleDescEle,o=(0,lt.useNavigate)(),i=(0,A.PE)(),a=i.t,l=i.locale,c=t||function(){o("/launch-blocklet/install".concat(window.location.search))};return(0,ne.jsxs)(mt,{children:[(0,ne.jsx)("div",{className:"app-content",children:(0,ne.jsx)("div",{className:"agreement",children:(0,ne.jsx)("div",{className:"agreement-content",children:(0,ne.jsx)(st.Z,{blockletMeta:{data:n},locale:l,handleDescEle:r})})})}),(0,ne.jsx)("div",{className:"button-container","data-cy":"agree-all",children:(0,ne.jsx)(ct.Z,{onContinue:c,description:(0,ne.jsx)(dt,{}),texts:{listenName:a("launchBlocklet.license"),buttonNext:a("launchBlocklet.next")}})})]})}pt.propTypes={meta:h().object.isRequired,onClickNext:h().func,handleDescEle:h().node},pt.defaultProps={onClickNext:null,handleDescEle:""};var mt=m.Z.div(ot||(ot=(0,c.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")})),ft=t(38219),ht=t(70576),xt=t(50624),vt=t(77370),gt=t(90617);function Zt(e){var n=e.defaultUrl,t=e.onCancel,o=e.onSuccess,i=e.onError,a=e.mode,l=e.handleText,c=(0,le.h6)().api,m=(0,vt.T)().api,f=(0,p.useState)(!1),h=(0,d.Z)(f,2),x=h[0],v=h[1],g=(0,p.useState)(""),Z=(0,d.Z)(g,2),y=Z[0],b=Z[1],k=(0,A.PE)().t,j={dist:{}},C=(0,p.useState)(n),P=(0,d.Z)(C,2),R=P[0],E=P[1],T=(0,p.useState)(n?1:0),S=(0,d.Z)(T,2),w=S[0],_=S[1],U=(0,p.useState)(j),N=(0,d.Z)(U,2),I=N[0],L=N[1],D=(0,p.useState)(!1),O=(0,d.Z)(D,2),B=O[0],z=O[1],M=(0,p.useState)({}),K=(0,d.Z)(M,2),V=K[0],Y=K[1],X="component"===a,Q=!!X||!n,J=function(){var e=(0,u.Z)((0,s.Z)().mark((function e(){var n,t,r,o,a,l;return(0,s.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:L(j),b(null),v(!0),e.prev=3,n=decodeURIComponent(R.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,c.getBlockletMetaFromUrl({input:{url:n}});case 14:t=e.sent,r=t.meta,o=t.inStore,a=t.registryUrl,L(r),Y({inStore:o,registryUrl:a,inputUrl:R.trim()}),e.next=28;break;case 22:e.prev=22,e.t1=e.catch(3),console.error(e.t1),l="Blocklet Install failed: ".concat((0,ce.Z)(e.t1)),b(l),i(e.t1);case 28:return e.prev=28,v(!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,p.useEffect)((function(){n&&J()}),[n]);var $=[{name:k("common.name"),value:(0,W.getDisplayName)({meta:I},!0)},{name:k("common.version"),value:I.version},{name:k("common.did"),value:(0,ne.jsx)(H.Z,{did:I.did})},{name:k("common.author"),value:(0,ce.rq)(I.author)},{name:k("blocklet.dist.downloadLink"),value:I.dist.tarball}],ee=[{label:k("blocklet.fromUrl.step0"),body:(0,ne.jsx)(cn.Z,{component:"div",children:(0,ne.jsx)(Pe.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:R,onChange:function(e){b(null),E(e.target.value)},disabled:x,onKeyPress:function(e){"Enter"===e.key&&(e.preventDefault(),J(),_(1))}})}),cancel:k("common.cancel"),confirm:k("common.next"),onCancel:t,onConfirm:function(){J(),_(1)}},{label:k("blocklet.fromUrl.step1"),body:x?(0,ne.jsx)("div",{style:{height:200,width:"100%",display:"flex",alignItems:"center",justifyContent:"center",flexDirection:"column"},children:(0,ne.jsx)(F.Z,{})}):I.did?(0,ne.jsx)("div",{style:{paddingLeft:"10%"},children:$.map((function(e){return e.name===k("common.did")?(0,ne.jsx)(q.Z,{valueComponent:"div",nameWidth:120,name:e.name,nameFormatter:function(){return k("common.did")},children:e.value},e.name):(0,ne.jsx)(q.Z,{valueComponent:"div",nameWidth:120,name:e.name,children:e.value},e.name)}))}):null,cancel:k(Q?"common.pre":"common.cancel"),confirm:(null===l||void 0===l?void 0:l.confirm)||k("blocklet.fromUrl.confirm"),onCancel:function(){Q?_((function(e){return e-1})):t()},onConfirm:function(){!function(){if(X)return o((0,r.Z)({meta:I},V)),void t();v(!0),z(!0)}()}}],te=ee[w];return(0,ne.jsxs)(ne.Fragment,{children:[(0,ne.jsxs)(ke.ZP,{title:(null===l||void 0===l?void 0:l.title)||k("blocklet.fromUrl.title"),fullWidth:!0,maxWidth:"md",onClose:function(){return te.onCancel()},showCloseButton:0===w,disableEscapeKeyDown:!0,open:!0,actions:(0,ne.jsxs)(ne.Fragment,{children:[te.cancel&&(0,ne.jsx)(G.Z,{onClick:function(e){e.stopPropagation(),b(null),te.onCancel()},color:"inherit",children:te.cancel||k("common.cancel")}),(0,ne.jsxs)(G.Z,{onClick:function(e){e.stopPropagation(),te.onConfirm()},color:"primary","data-cy":"install-blocklet-next-step",disabled:x||!R||y,variant:"contained",autoFocus:!0,style:{marginLeft:8},children:[x&&0===w&&(0,ne.jsx)(F.Z,{size:16}),te.confirm]})]}),children:[Q&&(0,ne.jsx)(ft.Z,{alternativeLabel:!0,activeStep:w,children:ee.map((function(e){var n=e.label;return(0,ne.jsx)(ht.Z,{children:(0,ne.jsx)(xt.Z,{children:n})},n)}))}),(0,ne.jsx)(Tn.Z,{component:"div",style:{marginTop:24},children:te.body}),!!y&&(0,ne.jsx)(In.Z,{type:"error",style:{width:"100%",marginTop:8},children:y})]}),I&&B&&(0,ne.jsx)(qn.default,{popup:!0,open:!0,forceConnected:!1,className:"launch-from-url-auth",action:"launch-free-blocklet-by-session",checkFn:m.get,checkTimeout:3e5,onSuccess:function(){v(!1),z(!1),o((0,r.Z)({meta:I},V)),t()},extraParams:{title:I.title,wt:(0,gt.iK)(I),blockletMetaUrl:decodeURIComponent(R.trim())},messages:{title:k("setup.keyPair.title"),scan:k("setup.keyPair.scan"),confirm:k("setup.keyPair.confirm"),success:k("setup.keyPair.success")},onClose:function(){v(!1),z(!1)}})]})}Zt.propTypes={defaultUrl:h().string,onCancel:h().func.isRequired,onSuccess:h().func.isRequired,onError:h().func,mode:h().oneOf(["install","component"]),handleText:h().object},Zt.defaultProps={onError:function(){},defaultUrl:"",mode:"install",handleText:{}};var yt=t(17708),bt="blocklet-add-component-registry",kt="server-add-registry",jt=(0,Wn.Z)((function(e){return{addMenuItemRoot:{justifyContent:"center",color:e.palette.primary.main,lineHeight:"3.2"}}}));function Ct(e){var n=e.disabled,t=e.storeList,r=e.teamDid,o=e.onAdd,i=(0,le.h6)().api,a=(0,p.useState)(!1),l=(0,d.Z)(a,2),c=l[0],m=l[1],f=(0,p.useState)(!0),h=(0,d.Z)(f,2),x=h[0],v=h[1],g=(0,p.useState)(!1),Z=(0,d.Z)(g,2),y=Z[0],b=Z[1],k=(0,p.useState)(""),C=(0,d.Z)(k,2),P=C[0],R=C[1],E=(0,p.useState)(""),T=(0,d.Z)(E,2),S=T[0],w=T[1],_=(0,A.PE)().t,U=jt(),N=function(){var e=(0,u.Z)((0,s.Z)().mark((function e(){var n,a,l,c;return(0,s.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(m(!0),e.prev=1,n=(0,ce.bQ)(P,t),a=n.isNew,l=n.decoded,a){e.next=5;break}throw new Error(_("store.blockletRegistry.haveSameRegistry"));case 5:return e.next=7,i.addBlockletStore({input:{teamDid:r,url:l}});case 7:o(l),b(!1),e.next=15;break;case 11:e.prev=11,e.t0=e.catch(1),c="".concat(_("store.blockletRegistry.addFailed")," ").concat((0,ce.Z)(e.t0)),w(c);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,ne.jsxs)(ne.Fragment,{children:[(0,ne.jsxs)(Kn.ZP,{button:!0,disabled:n,className:U.addMenuItemRoot,onClick:function(){b(!0)},children:[(0,ne.jsx)(j.Z,{font:!0}),(0,ne.jsx)(cn.Z,{variant:"inherit",children:_("store.blockletRegistry.addRegistry")})]}),(0,ne.jsxs)(ke.ZP,{title:_("store.blockletRegistry.addRegistry"),fullWidth:!0,maxWidth:"md",open:y,onClose:function(){return b(!1)},PaperProps:{style:{minHeight:"auto"}},actions:(0,ne.jsxs)(ne.Fragment,{children:[(0,ne.jsx)(G.Z,{onClick:function(e){e.stopPropagation(),b(!1)},color:"inherit",children:_("common.cancel")}),(0,ne.jsxs)(G.Z,{onClick:function(e){e.stopPropagation(),N()},color:"primary","data-cy":"install-blocklet-next-step",disabled:c||!P||x,variant:"contained",autoFocus:!0,children:[c&&(0,ne.jsx)(F.Z,{size:16}),_("common.confirm")]})]}),children:[(0,ne.jsx)("div",{style:{paddingTop:12,overflowY:"hidden"},children:(0,ne.jsx)(Tn.Z,{component:"div",children:(0,ne.jsx)(cn.Z,{component:"div",children:(0,ne.jsx)(Pe.Z,{label:_("store.blockletRegistry.registryUrl"),autoComplete:"off",variant:"outlined",name:"url",fullWidth:!0,value:P,onChange:function(e){w(null);var n=!1;e.target.value.trim()||(n=!0),e.target.value.trim()||w(_("store.blockletRegistry.registryUrlEmpty")),R(e.target.value),v(n)},disabled:c,onKeyPress:function(e){"Enter"===e.key&&(e.preventDefault(),e.target.value.trim()?N():w(_("store.blockletRegistry.registryUrlEmpty")))}})})})}),!!S&&(0,ne.jsx)(In.Z,{type:"error",style:{width:"100%"},children:S})]})]})}Ct.propTypes={teamDid:h().string.isRequired,disabled:h().bool,storeList:h().array,onAdd:h().func},Ct.defaultProps={disabled:!1,storeList:[],onAdd:function(){}};var Pt=t(50714),Rt=t(94702),Et=t(30291);function Tt(e){var n=e.title,t=e.description,o=e.confirmPlaceholder,i=e.cancel,a=e.confirm,l=e.params,c=e.onCancel,s=e.onConfirm,u=e.keyName,d=(0,A.PE)().t,p={title:function(){return(0,ne.jsxs)("div",{children:[n," (".concat(u,")")]})},description:function(e,n){return(0,ne.jsxs)("div",{children:[(0,ne.jsx)(Re.Z,{severity:"warning",style:{width:"100%"},children:d("common.notice")}),(0,ne.jsx)("div",{style:{marginTop:24,marginBottom:24},dangerouslySetInnerHTML:{__html:t}}),(0,ne.jsxs)("div",{style:{marginBottom:24},children:[d("common.click"),"\uff1a",(0,ne.jsx)(Ee.Z,{"data-cy":"click-copy",children:u})]}),(0,ne.jsx)(cn.Z,{component:"div",children:(0,ne.jsx)(Pe.Z,{label:o,autoComplete:"off","data-cy":"delete-confirm-input",variant:"outlined",fullWidth:!0,autoFocus:!0,value:e.inputVal,onChange:function(t){var o;o=(0,r.Z)((0,r.Z)({},e),{},{inputVal:t.target.value,__disableConfirm:u!==t.target.value}),n((0,r.Z)((0,r.Z)({},o),{},{__disableConfirm:o.__disableConfirm}))}})})]})},confirm:a,cancel:i,onConfirm:s,onCancel:c,params:(0,r.Z)({inputVal:"",__disableConfirm:!0},l)};return(0,ne.jsx)(ae.Z,{title:p.title,description:p.description,confirm:p.confirm,cancel:p.cancel,params:p.params,onConfirm:p.onConfirm,onCancel:p.onCancel})}function St(e){var n=e.store,t=e.teamDid,r=e.onDelete,o=(0,le.h6)().api,i=(0,A.PE)().t,a=(0,p.useState)(!1),l=(0,d.Z)(a,2),c=l[0],m=l[1],f=(0,p.useState)(null),h=(0,d.Z)(f,2),x=h[0],v=h[1],g=(0,Rt.Z)(),Z=function(){var e=(0,u.Z)((0,s.Z)().mark((function e(){return(0,s.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,m(!0),e.next=4,o.deleteBlockletStore({input:{teamDid:t,url:n.url}});case 4:r&&"function"===typeof r&&r(),e.next=10;break;case 7:e.prev=7,e.t0=e.catch(0),V.Z.error("Remove Blocklet Store Error: ".concat((0,ce.Z)(e.t0)));case 10:return e.prev=10,m(!1),v(null),e.finish(10);case 14:case"end":return e.stop()}}),e,null,[[0,7,10,14]])})));return function(){return e.apply(this,arguments)}}(),y={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:Z,onCancel:function(){m(!1),v(null)}};return(0,ne.jsxs)(ne.Fragment,{children:[(0,ne.jsx)(k.Z,{disabled:c,onClick:function(e){e.stopPropagation(),v(y)},size:"large",children:(0,ne.jsx)(Et.default,{})}),x&&(0,ne.jsx)(Tt,{keyName:x.keyName,title:x.title,description:x.description,confirmPlaceholder:x.confirmPlaceholder,confirm:x.confirm,cancel:x.cancel,params:x.params,onConfirm:x.onConfirm,onCancel:x.onCancel})]})}Tt.propTypes={title:h().any.isRequired,keyName:h().any.isRequired,description:h().any.isRequired,confirmPlaceholder:h().any.isRequired,cancel:h().string,confirm:h().string,params:h().object,onCancel:h().func,onConfirm:h().func.isRequired},Tt.defaultProps={onCancel:function(){},cancel:"",confirm:"Confirm",params:{}},St.propTypes={teamDid:h().string.isRequired,store:h().object.isRequired,onDelete:h().func},St.defaultProps={onDelete:function(){}};var wt,_t=(0,Wn.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 Ut(e){var n=e.teamDid,t=e.store,r=e.onDelete,o=_t();return(0,ne.jsxs)("div",{className:o.menuName,children:[(0,ne.jsx)(cn.Z,{component:"span",variant:"subtitle1",style:{fontWeight:"400"},children:t.name}),(0,ne.jsx)(cn.Z,{className:"url",component:"span",variant:"inherit",children:"".concat(t.url)}),(0,ne.jsxs)(Pt.Z,{children:[(0,ne.jsx)(k.Z,{onClick:function(e){e.stopPropagation(),window.open(t.url)},size:"large",children:(0,ne.jsx)(E.Z,{})}),!t.protected&&(0,ne.jsx)(St,{store:t,onDelete:r,teamDid:n})]})]})}function Nt(e){var n=e.onChange,t=e.loading,r=e.children,o=e.extra,i=(0,A.PE)().t,a=(0,le.h6)(),l=a.info,c=a.inService,s=(0,On.y0)().blocklet,u=(0,p.useState)(!1),m=(0,d.Z)(u,2),f=m[0],h=m[1],x=(0,p.useRef)(null),v=c?bt:kt,g=(0,yt.Z)(v),Z=(0,d.Z)(g,2),y=Z[0],b=Z[1],k=(0,ce.dX)({fromBlocklet:c,blocklet:s,nodeInfo:l}),j=k.storeList,C=k.teamDid,P=y&&j.find((function(e){return y===e.url}))||j[0],R=l.mode===B.NODE_MODES.SERVERLESS;return(0,ne.jsxs)(ne.Fragment,{children:[(0,ne.jsxs)(Lt,{children:[(0,ne.jsx)(G.Z,{ref:x,color:"secondary","data-cy":"add-component-select-store",endIcon:(0,ne.jsx)(Oe.Z,{color:"secondary"}),onClick:function(){h(!0)},style:{padding:"0 2px"},children:(0,ne.jsx)(cn.Z,{color:"secondary",children:P.name})}),(0,ne.jsx)(cn.Z,{color:"secondary",children:o})]}),(0,ne.jsxs)(Pe.Z,{id:"mui-registry-select",select:!0,autoComplete:"off",variant:"outlined",name:"did",helperText:i("blocklet.component.selectRegistryTip"),"data-cy":"component-registry-select",fullWidth:!0,value:P,autoFocus:!0,onChange:function(e){var t=e.target.value;b(t.url),n(t)},SelectProps:{open:f,MenuProps:{anchorEl:x.current},renderValue:function(e){return null===e||void 0===e?void 0:e.name},onClose:function(){h(!1)}},style:{display:"none"},margin:"normal",children:[null===j||void 0===j?void 0:j.map((function(e){return(0,ne.jsx)(Sn.Z,{value:e,"data-cy":e.url,children:(0,ne.jsx)(Ut,{teamDid:C,store:e,onDelete:function(){var n;y===e.url&&b(null===(n=j[0])||void 0===n?void 0:n.url)}})},e.url)})),!R&&(0,ne.jsx)(Ct,{disabled:t,storeList:j,teamDid:C,onAdd:function(e){b(e)}})]}),r({currentRegistry:P})]})}Ut.propTypes={teamDid:h().string.isRequired,store:h().shape({name:h().string.isRequired,url:h().string.isRequired,protected:h().bool}).isRequired,onDelete:h().func},Ut.defaultProps={onDelete:function(){}},Nt.propTypes={onChange:h().func,loading:h().bool,children:h().any.isRequired,extra:h().node},Nt.defaultProps={onChange:function(){},loading:!1,extra:""};var It,Lt=m.Z.div(wt||(wt=(0,c.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})),Dt=t(37433),Ot=t(51921),Bt=t(9709),Ft=t(49956),qt=["handleButtonClick","handleSearchSelect","storeUrl","handleBlockletRender","extraFilter","serverVersion"],At=function(e,n){return a()(n,"/blocklets/".concat(e.did))},Gt=function(e){var n=e.blocklet,t=e.attribute,r=e.value;return n._formatted?n._formatted[t]:r},zt=function(e){return e.inStore&&!1===(0,W.isFreeBlocklet)(e)};function Wt(e){var n=e.blocklet,t=e.blocklets,r=e.handleButtonClick,o=e.endpoint,i=(0,A.PE)().t,l=a()(o,(0,ce.lk)(n.did,n.logo||"")),c=(0,p.useState)(!1),m=(0,d.Z)(c,2),f=m[0],h=m[1],x=zt(n)?i("common.purchase"):i("blocklet.component.choose"),v=function(){var e=(0,u.Z)((0,s.Z)().mark((function e(i){return(0,s.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i.preventDefault(),i.stopPropagation(),e.prev=2,h(!0),e.next=6,r({meta:n,registryUrl:o,blocklets:t});case 6:e.next=11;break;case 8:e.prev=8,e.t0=e.catch(2),V.Z.error(e.t0.message);case 11:return e.prev=11,h(!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,ne.jsx)(ee.Z,{href:At(n,o),style:{color:"initial",textDecoration:"none"},onClick:function(e){return!!e.currentTarget.contains(e.target)||(e.preventDefault(),!1)},target:"_blank",children:(0,ne.jsx)(Vt,{title:Gt({blocklet:n,attribute:"title",value:n.title||n.name}),did:n.did,description:Gt({blocklet:n,attribute:"description",value:n.description}),cover:n.logo?l:"",version:n.version,button:(0,ne.jsx)("div",{style:{display:"flex",alignItems:"center"},children:(0,ne.jsx)(Ft.Kk,{children:(0,ne.jsx)(G.Z,{onClick:v,size:"small",disabled:f,variant:"outlined",color:"primary","data-cy":"install-blocklet",children:f?(0,ne.jsxs)(ne.Fragment,{children:[(0,ne.jsx)(F.Z,{size:16,style:{marginRight:3}}),x]}):x},n.did)})})})})}function Mt(e){var n=e.handleButtonClick,t=e.handleSearchSelect,i=e.storeUrl,a=e.handleBlockletRender,l=e.extraFilter,c=e.serverVersion,s=(0,o.Z)(e,qt),u=(0,A.PE)().locale,m=(0,p.useState)({}),f=(0,d.Z)(m,2),h=f[0],x=f[1],v=i;return(0,p.useEffect)((function(){x({})}),[v]),(0,ne.jsx)(Ot.ErrorBoundary,{FallbackComponent:Dt.H,resetKeys:[v],children:(0,ne.jsx)("div",(0,r.Z)((0,r.Z)({},s),{},{children:(0,ne.jsx)(Bt.Z,{blockletRender:function(e){var t=(0,r.Z)((0,r.Z)({},e),{},{handleButtonClick:n,endpoint:v});return a((0,r.Z)((0,r.Z)({},e),{},{defaultRender:(0,ne.jsx)(Wt,(0,r.Z)({},t))}))},baseSearch:!0,endpoint:v,locale:u,onFilterChange:function(e){x(e)},onSearchSelect:t,filters:h,extraFilter:l,serverVersion:c})}))})}Wt.propTypes={blocklet:h().object.isRequired,blocklets:h().array,handleButtonClick:h().func,endpoint:h().string},Wt.defaultProps={handleButtonClick:null,endpoint:"",blocklets:[]},Mt.propTypes={storeUrl:h().string.isRequired,handleButtonClick:h().func,handleSearchSelect:h().func,handleBlockletRender:h().func,extraFilter:h().func,serverVersion:h().string},Mt.defaultProps={handleButtonClick:null,handleSearchSelect:null,handleBlockletRender:null,extraFilter:void 0,serverVersion:""};var Kt,Vt=(0,m.Z)(Ft.ZP)(It||(It=(0,c.Z)(["\n .ms-highlight {\n color: ",";\n }\n"])),(function(e){return e.theme.palette.primary.main})),Yt=t(95803),Ht=t.n(Yt),Xt=t(50576),Qt=t(92522),Jt=t.n(Qt),$t=t(25599),er=t(59467),nr=t(17665),tr=t(74202),rr=["onSelect","endpoint","gatewayUrl","loading","size","helperText"],or=[{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"}],ir=(0,nr.D)();function ar(e){var n=e.onSelect,t=e.endpoint,i=e.gatewayUrl,c=e.loading,s=e.size,u=e.helperText,m=(0,o.Z)(e,rr),f=(0,yt.Z)("did-space-gateway-list",or),h=(0,d.Z)(f,2),x=h[0],v=h[1],g=(0,p.useState)(i||or[0].value),Z=(0,d.Z)(g,2),y=Z[0],b=Z[1],k=(0,A.PE)().t,j=(0,vt.T)().api;return(0,p.useEffect)((function(){y&&!x.find((function(e){return e.value===y}))&&j.get(a()(y,"/__blocklet__.js?type=json")).then((function(e){v([].concat((0,l.Z)(x),[{value:y,label:e.data.appName}]))})).catch((function(e){console.error(e),V.Z.error("Can not add this gateway, please check the url and try again")}))}),[y]),(0,ne.jsx)(lr,(0,r.Z)((0,r.Z)({},m),{},{freeSolo:!0,selectOnFocus:!0,clearOnBlur:!0,handleHomeEndKeys:!0,value:y,options:x,onChange:function(e,n){if(n)if("string"===typeof n){var t=x.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,ne.jsxs)(Kn.ZP,(0,r.Z)((0,r.Z)({},e),{},{children:[(0,ne.jsx)($t.Z,{children:(0,ne.jsx)(er.Z,{children:n.avatar})}),(0,ne.jsx)(Vn.Z,{primary:n.label,secondary:n.value})]}),n.value)},filterOptions:function(e,n){var t=ir(e,n);n.inputValue&&Jt()(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,ne.jsx)(Pe.Z,(0,r.Z)((0,r.Z)({},e),{},{helperText:u,label:k("storage.spaces.label"),size:s,InputProps:(0,r.Z)((0,r.Z)({},e.InputProps),{},{type:"search",endAdornment:(0,ne.jsx)(G.Z,{variant:"contained",onClick:function(){return n(y)},size:"small",loading:c,disable:c,sx:{position:"absolute",right:0,display:"flex",justifyContent:"center",alignItems:"center",width:"100px",height:"100%"},children:k(t?"storage.spaces.reconnect":"storage.spaces.connect.now")})})}))}}))}var lr=(0,m.Z)(tr.Z)(Kt||(Kt=(0,c.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")}));ar.propTypes={onSelect:h().func.isRequired,endpoint:h().string,loading:h().bool,size:h().string,helperText:h().string,gatewayUrl:h().string},ar.defaultProps={endpoint:void 0,loading:!1,size:"small",helperText:"",gatewayUrl:""};var cr=ar,sr=["onConnect"];var ur=(0,p.forwardRef)((function(e,n){var t=e.onConnect,i=(0,o.Z)(e,sr),l=(0,le.h6)(),c=l.api,m=l.info.did,f=(0,p.useContext)(A.RD),h=f.t,x=f.locale,v=(0,On.y0)(),g=v.blocklet,Z=v.actions.refreshBlocklet,y=(0,p.useState)(""),b=(0,d.Z)(y,2),k=b[0],j=b[1],C=(0,p.useMemo)((function(){var e,n,t,r;return{endpoint:(null===g||void 0===g||null===(e=g.environments)||void 0===e||null===(n=e.find((function(e){return e.key===ie.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_SPACE_ENDPOINT})))||void 0===n?void 0:n.value)||"",gatewayUrl:(null===g||void 0===g||null===(t=g.environments)||void 0===t||null===(r=t.find((function(e){return e.key===ie.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_SPACES_URL})))||void 0===r?void 0:r.value)||""}}),[g]),P=(0,W.getAppName)(g),R=(0,W.getAppDescription)(g),E=function(e){var n,t,r,o=null===e||void 0===e||null===(n=e.site)||void 0===n||null===(t=n.domainAliases)||void 0===t||null===(r=t.sort((function(e,n){return e.accessibility.accessible&&n.accessibility.accessible?+e.isProtected-+n.isProtected:+n.accessibility.accessible-+e.accessibility.accessible})))||void 0===r?void 0:r.map((function(e){var n,t=null!==e&&void 0!==e&&null!==(n=e.domainStatus)&&void 0!==n&&n.isHttps?"https://":"http://",r=null===e||void 0===e?void 0:e.value;return"".concat(t).concat(r)})).filter(Boolean),i=null===o||void 0===o?void 0:o[0];return{appUrl:i,isReady:Boolean(i)}}(g),T=E.appUrl,S=E.isReady;function w(e,n){return _.apply(this,arguments)}function _(){return(_=(0,u.Z)((0,s.Z)().mark((function e(n,t){return(0,s.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,c.configBlocklet({input:{did:[n],configs:[{key:ie.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_SPACES_URL,value:k},{key:ie.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_SPACE_ENDPOINT,value:t}]}}).then((function(){V.Z.success(h("storage.spaces.connect.succeeded",x))})).catch((function(e){console.error(e),V.Z.error(e.message)}));case 2:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var U=function(){var e=(0,u.Z)((0,s.Z)().mark((function e(n,o){return(0,s.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,w(g.meta.did,o(n.endpoint));case 2:setTimeout((function(){D((function(e){return(0,r.Z)((0,r.Z)({},e),{},{open:!1})})),null===t||void 0===t||t(),Z()}),3e3);case 3:case"end":return e.stop()}}),e)})));return function(n,t){return e.apply(this,arguments)}}(),N=(0,p.useState)({open:!1}),I=(0,d.Z)(N,2),L=I[0],D=I[1];return(0,p.useEffect)((function(){D((function(e){return(0,r.Z)((0,r.Z)({},e),{},{messages:{title:h("storage.spaces.authorize.title",{appName:P}),scan:h("storage.spaces.authorize.scan",{appName:P}),confirm:"",success:(0,ne.jsx)(cn.Z,{gutterBottom:!0,children:h("storage.spaces.authorize.success")})}})}))}),[P,x,h]),(0,p.useImperativeHandle)(n,(function(){return{getEndpoint:function(){return C.endpoint},getGatewayUrl:function(){return C.gatewayUrl}}})),(0,ne.jsxs)(ne.Fragment,{children:[(0,ne.jsx)(cr,(0,r.Z)((0,r.Z)((0,r.Z)({},i),C),{},{onSelect:function(e){(0,Xt.isEmpty)(e)?V.Z.error(h("storage.spaces.addressCannotEmpty",x)):(j(e),D((function(n){return(0,r.Z)((0,r.Z)({},n),{},{action:"one-click-authorization",checkTimeout:3e5,prefix:a()(e,"space/api/did"),baseUrl:new URL(e).origin,checkFn:Ht().create({baseURL:a()(e,"space")}).get,extraParams:{appDid:g.appDid,appName:P,appDescription:R,scopes:"list:object read:object write:object",appUrl:T,referrer:window.location.href,nodeDid:m},onClose:function(){D((function(e){return(0,r.Z)((0,r.Z)({},e),{},{open:!1})}))},open:!0})})))},loading:!S})),(0,ne.jsx)(qn.default,{forceConnected:!1,saveConnect:!1,prefix:L.prefix,open:L.open,popup:!0,action:L.action,baseUrl:L.baseUrl,checkFn:L.checkFn,onSuccess:U,onClose:L.onClose,checkTimeout:L.checkTimeout,extraParams:L.extraParams,messages:L.messages,locale:x})]})}));ur.propTypes={onConnect:h().func},ur.defaultProps={onConnect:function(){}};var dr,pr,mr,fr,hr,xr,vr,gr=ur,Zr=["name","validation"],yr=["default","key"],br=function(e){return e.inStore&&!1===(0,W.isFreeBlocklet)(e)},kr=function(e){var n;return null===e||void 0===e||null===(n=e.capabilities)||void 0===n?void 0:n.didSpace},jr=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===ie.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_SPACE_ENDPOINT})))||void 0===t?void 0:t.value)||null},Cr=function(e){return(e.environments||[]).some((function(e){return e.required}))},Pr=function(e,n){return null===e||void 0===e?void 0:e.some((function(e){return e.required&&!n[e.key]}))},Rr=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return e.title||e.name},Er=(0,p.forwardRef)((function(e,n){var t=e.meta,o=e.isMobile,i=e.onStepChange,a=(0,Nn.s)(),l=a.steps,c=a.activeStep,s=a.setActiveStepByKey,u=a.setActiveStepByIndex,d=(0,A.PE)(),m=d.t,f=d.locale,h=l[c];return(0,p.useEffect)((function(){i(c)}),[i,c]),(0,p.useImperativeHandle)(n,(function(){return{setActiveStepByKey:s,setActiveStepByIndex:u}})),(0,ne.jsx)(Nr,{component:"div",className:o?"mobileStyle":"",children:(0,ne.jsx)(Un.Z,{locale:f,blockletMeta:(0,r.Z)({title:" "},t),pcWidth:"100%",pcHeight:"100%",logoUrl:t&&t.logo&&t.registryUrl?(0,ce.aZ)({did:t.did,baseUrl:t.registryUrl,logoPath:t.logo}):null,stepTip:m("blocklet.component.add"),children:(0,ne.jsx)(_r,{children:null!==h&&void 0!==h&&h.body&&"function"===typeof h.body?h.body():h.body})})})}));function Tr(e){var n,t,i,a,c,m,f,h=e.blocklet,x=e.children,g=(0,A.PE)(),Z=g.t,y=g.locale,b=(0,p.useState)(!1),k=(0,d.Z)(b,2),j=k[0],C=k[1],P=(0,p.useState)(null),R=(0,d.Z)(P,2),E=R[0],T=R[1],S=(0,p.useState)(""),w=(0,d.Z)(S,2),_=w[0],U=w[1],N=(0,p.useState)(""),I=(0,d.Z)(N,2),L=I[0],D=I[1],O=(0,p.useState)(""),q=(0,d.Z)(O,2),z=q[0],M=q[1],K=(0,le.h6)(),Y=K.api,H=K.ws.useSubscription,X=K.inService,Q=K.info,J=(0,On.y0)().actions.refreshBlocklet,$=(0,p.useState)(null),ee=(0,d.Z)($,2),te=ee[0],re=ee[1],oe=(0,p.useState)(!1),ae=(0,d.Z)(oe,2),se=ae[0],ue=ae[1],de={bundleDid:"",componentDid:"",componentName:"",pathPrefix:"",name:"",title:"",configsList:[],configsValue:{},hasMissRequiredConfigs:!1,hasEnvironmentsStep:!1,hasRequiredEnvironments:!1,requirePurchase:!1,didSpaceCapability:null,installResultProps:{},purchaseResultProps:{},showFromUrlDialog:!1},pe=(0,p.useState)(de),me=(0,d.Z)(pe,2),fe=me[0],he=me[1],xe=(0,p.useState)(0),ve=(0,d.Z)(xe,2),ge=ve[0],Ze=ve[1],ye=(0,p.useRef)({}),be=(0,p.useRef)({}),ke=(0,p.useRef)({}),je=(0,_n.Z)((function(e){return e.breakpoints.down("md")})),Ce=ye.current.meta,Re=(be.current||{}).setActiveStepByIndex,Ee=Q.mode===B.NODE_MODES.SERVERLESS,Se=function(e){return he((function(n){return(0,r.Z)((0,r.Z)({},n),e)}))};(0,p.useEffect)((function(){if(fe.pathPrefix){var e=Le((0,r.Z)((0,r.Z)({},fe),{},{pathPrefix:fe.pathPrefix,locale:y})).errMsg;U(e)}}),[fe.pathPrefix]),(0,p.useEffect)((function(){0===ge&&he(de)}),[ge]);var we=function(){var e;return null!==ye&&void 0!==ye&&null!==(e=ye.current)&&void 0!==e&&e.meta?(0,W.getDisplayName)(ye.current):""},_e=function(e){!function n(t){Se({installResultProps:{variant:"error",title:we(),subTitle:e,footer:(0,ne.jsx)(G.Z,{className:"bottom-button",disabled:t,"data-cy":"retry-install-component",onClick:function(){var e=(0,u.Z)((0,s.Z)().mark((function e(){return(0,s.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n(!0),e.next=3,Ie(ye.current.installInput);case 3:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),children:(0,ne.jsxs)(v.Z,{display:"flex",alignItems:"center",children:[t&&(0,ne.jsx)(F.Z,{size:16,style:{marginRight:8}}),Z("common.retry")]})})}})}()},Ue=function(e){return function(n){var t,r;((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===h||void 0===h||null===(r=h.meta)||void 0===r?void 0:r.did)&&e(n)}};H(ie.BlockletEvents.statusChange,Ue((function(e){if(e.status===ie.BlockletStatus.upgrading)Se({installResultProps:{variant:"success",title:we(),subTitle:Z("blocklet.component.installSuccessTip")}})})),[null===h||void 0===h||null===(n=h.meta)||void 0===n?void 0:n.did]),H(ie.BlockletEvents.downloadFailed,Ue((function(){_e(Z("blocklet.component.installComponentError"))})),[null===h||void 0===h||null===(t=h.meta)||void 0===t?void 0:t.did]),H(ie.BlockletEvents.installFailed,Ue((function(){_e(Z("blocklet.component.installComponentError"))})),[null===h||void 0===h||null===(i=h.meta)||void 0===i?void 0:i.did]);var Ne=function(){C(!1),D(!1),he({}),ye.current={}},Ie=function(){var e=(0,u.Z)((0,s.Z)().mark((function e(n){var t,o,i,a,l,c,u,d,p,m,f,x,v,g,Z,y,b,k,j,P,R,E,T,S,w;return(0,s.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=fe.pathPrefix,a=fe.bundleDid,l=fe.title,c=fe.componentName,u=void 0===c?"":c,d=fe.componentDid,p=void 0===d?"":d,m=(null===(t=ye.current)||void 0===t?void 0:t.meta)||{},f=m.configs,x=void 0===f?[]:f,v=m.registryUrl,g=m.inStore,Z=m.inputUrl,y=null===(o=ye.current)||void 0===o?void 0:o.downloadTokenList,b=g?(0,ce.Rn)(v,a):Z,C(!0),k=(0,r.Z)((0,r.Z)((0,r.Z)({rootDid:h.meta.did,url:b,mountPoint:(0,He.default)(i),title:l,name:u,did:p},fe.hasEnvironmentsStep&&x.length>0?{configs:x.map((function(e){return(0,r.Z)((0,r.Z)({},e),{},{value:fe.configsValue[e.key]||""})}))}:{}),y?{downloadTokenList:y}:{}),n),e.prev=6,e.next=9,Y.installComponent({input:k});case 9:if(!v){e.next=15;break}if(j=(0,ce.dX)({fromBlocklet:X,nodeInfo:Q,blocklet:h}),P=j.teamDid,R=j.storeList,E=(0,ce.bQ)(v,R),T=E.isNew,S=E.decoded,!T){e.next=15;break}return e.next=15,Y.addBlockletStore({input:{teamDid:P,url:S}});case 15:Se({installResultProps:{}}),J({showError:!1,attachRuntimeInfo:!1}),e.next=25;break;case 19:e.prev=19,e.t0=e.catch(6),w=(0,ce.Z)(e.t0),V.Z.error(w),console.error("installComponent error: ",e.t0),_e(w);case 25:return e.prev=25,C(!1),ye.current.installInput=k,e.finish(25);case 29:case"end":return e.stop()}}),e,null,[[6,19,25,29]])})));return function(n){return e.apply(this,arguments)}}(),Le=function(e){return{errMsg:(0,at.Rw)({params:(0,r.Z)((0,r.Z)({},e),{},{did:e.bundleDid}),blocklets:[h],blocklet:h,locale:y})}},De=function(){var e=(0,u.Z)((0,s.Z)().mark((function e(n){var t,o;return(0,s.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=Le((0,r.Z)((0,r.Z)({},fe),{},{locale:y})),o=t.errMsg,U(o),ge!==Fe.length-2){e.next=5;break}return e.next=5,Ie(n);case 5:Re((function(e){return e+1}));case 6:case"end":return e.stop()}}),e)})));return function(n){return e.apply(this,arguments)}}(),Oe=function(){Re((function(e){return e-1}))},Be=function(e){var n,t,i=e.chooseParams,a=void 0===i?ye.current:i,c=e.componentDid,s=e.isInit,u=void 0!==s&&s,d=a.meta,p=a.registryUrl,m=a.inStore,f=a.inputUrl,x=d.did,v=d.title,g=d.name,Z=((null===(n=h.settings)||void 0===n?void 0:n.children)||[]).filter((function(e){return"deleted"===e.status&&e.meta.bundleDid===x})),y=c||"",b=null===(t=d.environments)||void 0===t?void 0:t.map((function(e){var n=e.name,t=e.validation,i=(0,o.Z)(e,Zr),a={validation:Rn()(t)?"":t};return(0,r.Z)((0,r.Z)({},i),{},{key:n},a)}));ye.current=(0,r.Z)((0,r.Z)({},a),{},{meta:(0,r.Z)((0,r.Z)({},d),{},{configs:b,registryUrl:p,inStore:m,inputUrl:f})});var k={};if(u){var j=[h],C=b||[],P=yn()(kn()([].concat((0,l.Z)(C),[])),"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,W.getSharedConfigObj)(j[0],{configs:P}),E={},T=P.map((function(e){var n=e.default,t=e.key,i=(0,o.Z)(e,yr);return E[t]=R[t]||n,(0,r.Z)((0,r.Z)({},i),{},{key:t,hidden:!!ie.BLOCKLET_CONFIGURABLE_KEY[t]})}));k=(0,r.Z)((0,r.Z)({},k),{},{configsList:T,configsValue:E,hasMissRequiredConfigs:Pr(T,E)})}var S,w,_=h.children.some((function(e){return"/"===e.mountPoint})),U=Z.find((function(e){return e.meta.bundleDid===x}));U?k=(0,r.Z)((0,r.Z)({},k),{},{pathPrefix:U.mountPoint,title:v||"",componentName:U.meta.name,hasEnvironmentsStep:!1}):k=(0,r.Z)((0,r.Z)({},k),{},{pathPrefix:_?"/".concat((0,He.default)(g)):"/",title:v||"",componentName:"",hasEnvironmentsStep:(null===(S=ye.current.meta)||void 0===S||null===(w=S.environments)||void 0===w?void 0:w.length)>0});var N=br(ye.current.meta),I=kr(ye.current.meta),L=jr(h);Se((0,r.Z)((0,r.Z)({bundleDid:x,componentDid:y},k),{},{hasRequiredEnvironments:Cr(ye.current.meta),requirePurchase:N,didSpaceCapability:I,didSpaceEndpoint:L})),u&&N&&function(){var e=fe.pathPrefix,n=fe.bundleDid,t=fe.title,r=fe.componentName,o=void 0===r?"":r,i=fe.componentDid,a=void 0===i?"":i,l=(ye.current||{}).meta,c=void 0===l?{}:l,s=c.registryUrl,u=c.inStore,d=c.inputUrl,p=u?(0,ce.Rn)(s,n):d;re({meta:c,installOpts:{type:"component",rootDid:h.meta.did,mountPoint:e,url:p,title:t,name:o,did:a}})}()},Fe=[{key:"selectComponent",name:Z("blocklet.component.selectComponent"),body:(0,ne.jsxs)(wr,{component:"div",children:[fe.showFromUrlDialog&&(0,ne.jsx)(Zt,{mode:"component",onCancel:function(){Se({showFromUrlDialog:!1})},onSuccess:function(e){var n=e.meta,t=e.inputUrl,r=e.inStore,o=e.registryUrl;Be({chooseParams:{meta:n,inputUrl:t,inStore:r,registryUrl:o},isInit:!0}),Se({showFromUrlDialog:!1}),De()},handleText:{title:Z("blocklet.component.addComponentTip.fromUrl"),confirm:Z("blocklet.component.choose")}}),(0,ne.jsx)(Nt,{extra:Ee?null:(0,ne.jsxs)(G.Z,{variant:"text",color:"primary","data-cy":"add-component-from-url",onClick:function(){Se({showFromUrlDialog:!0})},style:{padding:"0 2px"},children:[(0,ne.jsx)(wn.Z,{style:{fontSize:20,marginRight:4}})," ",Z("blocklet.component.addComponentTip.fromUrl")," "]}),loading:j,onChange:function(){he({}),ye.current={}},children:function(e){var n=e.currentRegistry;return(0,ne.jsx)(Mt,{serverVersion:null===Q||void 0===Q?void 0:Q.version,style:je?{height:"calc(100vh - 56px - 80px - 32px - 40px )"}:{height:"calc(100% - 40px)"},storeUrl:n.url,handleButtonClick:function(e){Be({chooseParams:(0,r.Z)((0,r.Z)({},e),{},{inStore:!0}),isInit:!0})},handleBlockletRender:function(e){var n=e.blocklet,t=e.defaultRender,r=(null===fe||void 0===fe?void 0:fe.bundleDid)&&(null===fe||void 0===fe?void 0:fe.bundleDid)===(null===n||void 0===n?void 0:n.did);return(0,ne.jsxs)(Lr,{children:[r&&(0,ne.jsx)("div",{className:"check-container",children:(0,ne.jsx)(Te.default,{className:"check-icon"})}),(0,ne.jsx)("div",{className:r?"choose-blocklet":"",style:{marginLeft:16},children:t})]})},extraFilter:function(e){return null===e||void 0===e?void 0:e.filter((function(e){return!!(0,W.isComponentBlocklet)(e)&&!(h.children||[]).some((function(n){return n.meta.did===e.did}))}))}})}})]}),cancel:Z("common.cancel"),confirm:Rr(fe)?Z("blocklet.component.addNext",{name:Rr(fe)}):Z("common.next"),onCancel:Ne,onConfirm:function(){De()}},{key:"agreement",name:Z("launchBlocklet.introduction"),body:(0,ne.jsxs)(wr,{component:"div",className:"agreement-wrapper",children:[(0,ne.jsx)(En.Z,{title:Z("launchBlocklet.introduction"),subTitle:Z("blocklet.component.addComponentTip.introduction")}),(0,ne.jsx)(pt,{meta:Ce,onClickNext:De,handleDescEle:(0,ne.jsxs)(ne.Fragment,{children:[(0,ne.jsx)("p",{children:(0,ne.jsx)("div",{dangerouslySetInnerHTML:{__html:Z("blocklet.component.addComponentTip.".concat(fe.requirePurchase?"isPurchase":"isFree"),{name:we()})}})}),(0,ne.jsx)("p",{children:Z("blocklet.component.addComponentTip.belowInformation")})]})})]}),cancel:Z("common.pre"),confirm:Z("launchBlocklet.next"),onCancel:Oe,onConfirm:function(){ue(!1),De()}},Ce&&fe.requirePurchase&&{key:"purchase",name:(0,ne.jsxs)(ne.Fragment,{children:[Z("common.verifyNFT"),(0,ne.jsx)(Fn.Z,{})]}),body:(0,ne.jsxs)(wr,{component:"div",className:"flex-align-center",style:{flexDirection:"column"},children:[!(2===(null===(a=ke.current)||void 0===a||null===(c=a.getCurrentStep)||void 0===c?void 0:c.call(a))||se)&&(0,ne.jsx)(Ir,{title:Z("common.verifyNFT"),subTitle:Z("blocklet.component.addComponentTip.verifyNFT")}),Cn()(fe.purchaseResultProps)?te&&(0,ne.jsx)(it,{ref:ke,meta:te.meta,mode:fe.componentDid?"verify":"both",onCancel:function(e){ue(!1),Se({purchaseResultProps:{variant:"error",title:we(),subTitle:e,style:{paddingTop:120},footer:(0,ne.jsx)(G.Z,{className:"bottom-button","data-cy":"retry-purchase-component",onClick:function(){Se({purchaseResultProps:{}})},children:Z("common.retry")})}})},installOpts:te.installOpts,handlePaySuccess:function(e){var n=e.downloadTokenList;ye.current.downloadTokenList=n,ue(!1),De()}}):(0,ne.jsx)("div",{className:"flex-align-center flex-justify-center",children:(0,ne.jsx)(Dn.Z,(0,r.Z)({},fe.purchaseResultProps))})]}),disabled:2===(null===(m=ke.current)||void 0===m||null===(f=m.getCurrentStep)||void 0===f?void 0:f.call(m))||se,cancel:Z("common.pre"),confirm:Z("common.next"),onConfirm:function(){"function"===typeof ke.current.onNext&&(ke.current.onNext(),ue(!0))},onCancel:function(){Oe()}},(0,W.hasStartEngine)(Ce)&&{key:"config",name:Z("common.config"),error:_,body:(0,ne.jsxs)(wr,{component:"div",children:[(0,ne.jsx)(Ir,{title:Z("common.config"),subTitle:Z("blocklet.component.addComponentTip.config")}),(0,ne.jsx)(Pe.Z,{label:Z("blocklet.component.mountPoint"),autoComplete:"off",variant:"outlined",name:"pathPrefix",inputProps:{"data-cy":"mount-point-input"},fullWidth:!0,helperText:z||Z("blocklet.component.mountPointTip"),style:{marginBottom:32},margin:"normal",value:fe.pathPrefix,onChange:function(e){var n=e.target.value;Se({pathPrefix:n}),M(Z("common.slugifyHint",{value:(0,ce.LN)(n)}))}}),!!_&&(0,ne.jsx)(In.Z,{type:"error",style:{width:"100%",marginTop:8},children:_})]}),cancel:Z("common.pre"),confirm:Z("common.next"),onCancel:Oe,onConfirm:function(){De()}},Ce&&(null===fe||void 0===fe?void 0:fe.hasEnvironmentsStep)&&{key:"environment",name:(0,ne.jsxs)(ne.Fragment,{children:[Z("common.environment")," ",fe.hasRequiredEnvironments&&(0,ne.jsx)(Fn.Z,{})]}),disabled:!!E||(null===fe||void 0===fe?void 0:fe.hasMissRequiredConfigs),body:function(){return(0,ne.jsxs)(wr,{component:"div",children:[(0,ne.jsx)(Ir,{title:Z("common.environment"),subTitle:Z("blocklet.component.addComponentTip.environment")}),(0,ne.jsx)(Bn.Z,{style:{marginTop:-12,width:"100%"},schema:fe.configsList,defaultValue:fe.configsValue,onChange:function(e,n){var t=n.action,r=n.currentItem,o=n.allValues;"confirm"===t&&Se({hasMissRequiredConfigs:Pr(fe.configsList,o),configsValue:o}),"edit"===t?T(r):["cancel","confirm"].includes(t)&&T(null)}})]})},cancel:Z("common.pre"),confirm:Z("common.next"),onCancel:Oe,onConfirm:De},Ce&&(null===fe||void 0===fe?void 0:fe.didSpaceCapability)&&{key:"didSpace",name:(0,ne.jsxs)(ne.Fragment,{children:[Z("blocklet.component.didSpaceConfig")," ","required"===fe.didSpaceCapability&&(0,ne.jsx)(Fn.Z,{})]}),disabled:"required"===fe.didSpaceCapability&&!fe.didSpaceEndpoint,body:function(){return(0,ne.jsxs)(wr,{component:"div",children:[(0,ne.jsx)(Ir,{title:Z("blocklet.component.didSpaceConfig"),subTitle:Z("blocklet.component.didSpaceConfigTip")}),(0,ne.jsx)(v.Z,{sx:{mt:"36px","& > div":{maxWidth:"unset !important","& .MuiAutocomplete-root":{maxWidth:"unset !important"}}},children:(0,ne.jsx)(gr,{sx:{"& .MuiFormHelperText-root":{wordBreak:"break-all"}},helperText:fe.didSpaceEndpoint&&Z("blocklet.component.didSpaceConnected",{endpoint:fe.didSpaceEndpoint}),onConnect:function(){De()}})})]})},cancel:Z("common.pre"),confirm:Z("common.next"),onCancel:Oe,onConfirm:De},{key:"install",name:Z("common.install"),disabled:!1,loading:!1,body:(0,ne.jsx)(wr,{component:"div",className:"flex-justify-center flex-align-center",style:{flexDirection:"column"},children:Cn()(fe.installResultProps)?(0,ne.jsx)(Ln.Z,{message:(0,ne.jsx)(Dr,{children:Z("blocklet.component.installingCanCloseWindowTip")}),increaseSpeed:.3,messageLoop:!1}):(0,ne.jsx)("div",{style:{marginTop:120},children:(0,ne.jsx)(Dn.Z,(0,r.Z)({},fe.installResultProps))})}),confirm:Z("common.complete"),onConfirm:function(){Ne(),setTimeout((function(){var e=document.getElementsByClassName("dashboard-main")[0];e&&(e.scrollTop=e.scrollHeight)}),200)}}].filter((function(e){return e})),qe=Fe[ge]||{},Ae=function(e){e.stopPropagation(),D(!0)},Ge=ge<Fe.length-1;return(0,ne.jsxs)(ne.Fragment,{children:["function"===typeof x?x({loading:j,open:Ae}):(0,ne.jsxs)(Sn.Z,{onClick:Ae,className:"component-action","data-cy":"action-add-component",children:[j?(0,ne.jsx)(F.Z,{size:16}):(0,ne.jsx)(wn.Z,{style:{fontSize:18,marginRight:5}}),Z("blocklet.component.add")]}),L&&(0,ne.jsx)(Sr,{title:Z("blocklet.component.addWithName",{name:(0,W.getDisplayName)(h)}),maxWidth:!1,fullWidth:!1,PaperProps:{style:je?{width:"100%",height:window.innerHeight}:{maxWidth:1350,minWidth:930,width:"80%"}},onClose:function(e,n){var t,r;"backdropClick"!==n&&(null===(t=Fe[0])||void 0===t||null===(r=t.onCancel)||void 0===r||r.call(t))},showCloseButton:Ge,disableEscapeKeyDown:!0,open:!0,actions:(0,ne.jsxs)(ne.Fragment,{children:[qe.cancel&&(0,ne.jsx)(G.Z,{onClick:function(e){e.stopPropagation(),qe.onCancel()},disabled:ge===Fe.length-2&&j,color:"inherit",children:qe.cancel||Z("common.cancel")}),qe.confirm&&(0,ne.jsx)(G.Z,{onClick:function(e){e.stopPropagation(),qe.onConfirm()},color:"primary","data-cy":"submit-confirm-next",disabled:j||("boolean"===typeof qe.disabled?qe.disabled:!(!j&&!qe.error&&fe.bundleDid)||ge>0&&!fe.pathPrefix),variant:"contained",autoFocus:!0,title:qe.confirm,style:{marginLeft:8,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxWidth:"280px",display:"inline-block"},children:(0,ne.jsxs)(v.Z,{display:"flex",alignItems:"center",children:[("boolean"===typeof qe.loading?qe.loading:j)&&(0,ne.jsx)(F.Z,{size:16}),qe.confirm]})})]}),children:(0,ne.jsx)(Nn.W,{steps:Fe,mode:"memory",children:(0,ne.jsx)(Er,{ref:be,meta:Ce,isMobile:je,onStepChange:function(e){Ze(e)}})})})]})}Er.propTypes={meta:h().any,onStepChange:h().func.isRequired,isMobile:h().bool.isRequired},Er.defaultProps={meta:null},Tr.propTypes={children:h().any,blocklet:h().object.isRequired},Tr.defaultProps={children:null};var Sr=(0,m.Z)(ke.ZP)(dr||(dr=(0,c.Z)(["\n .MuiDialogContent-root {\n padding-left: 0;\n padding-right: 0;\n padding-bottom: 0;\n }\n\n .MuiDialogActions-root {\n padding: 16px 24px;\n }\n"]))),wr=(0,m.Z)(cn.Z)(pr||(pr=(0,c.Z)(["\n width: 100%;\n height: 100%;\n"]))),_r=m.Z.div(mr||(mr=(0,c.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"]))),Ur=function(e){return e.isMobile?"\n height: calc(100vh - 56px - 64px - 48px);\n ":""},Nr=(0,m.Z)(Tn.Z)(fr||(fr=(0,c.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 height: 100%;\n\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 height: 72vh;\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-top: 0;\n // padding-left: 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: 24px;\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 Ur(e)}),(function(e){return Ur(e)})),Ir=(0,m.Z)(En.Z)(hr||(hr=(0,c.Z)(["\n margin-bottom: 24px;\n"]))),Lr=m.Z.div(xr||(xr=(0,c.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})),Dr=m.Z.div(vr||(vr=(0,c.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})),Or=function(e){return e.children.filter((function(e){return e.meta.interfaces.find((function(e){return e.type===ie.BLOCKLET_INTERFACE_TYPE_WEB}))}))};function Br(e){var n=e.params,t=e.setParams,o=e.setError,i=e.serviceTypes,a=(0,A.PE)().t,l=(0,On.y0)().blocklet,c=l.meta.did,s=Or(l),u=(0,p.useState)([]),m=(0,d.Z)(u,2),f=m[0],h=m[1],x={301:a("common.redirectPermanently"),302:a("common.redirectTemporary"),307:a("common.redirectTemporary"),308:a("common.redirectPermanently")};return(0,p.useEffect)((function(){if(n.type===B.ROUTING_RULE_TYPES.COMPONENT&&n.componentId){var e=s.find((function(e){return e.meta.did===n.componentId})),o=(0,W.findWebInterface)(e.meta),i=(Array.isArray(null===o||void 0===o?void 0:o.pageGroups)?o.pageGroups:[]).map((function(e){return{value:e,label:"".concat(e," pages")}}));i.length&&i.unshift({value:"",label:"All pages"}),h(i),n.pageGroup&&!1===i.find((function(e){return e.value===n.pageGroup}))&&t((0,r.Z)((0,r.Z)({},n),{},{pageGroups:""}))}}),[n.componentId,n.type]),(0,ne.jsxs)(ne.Fragment,{children:[(0,ne.jsx)(Pe.Z,{select:!0,label:a("router.domain.add.type"),autoComplete:"off",variant:"outlined",name:"type","data-cy":"domain-add-type",fullWidth:!0,value:n.type,onChange:function(e){o(""),t((0,r.Z)((0,r.Z)({},n),{},{type:e.target.value,did:e.target.value===B.ROUTING_RULE_TYPES.BLOCKLET?c:"",__disableConfirm:!1}))},style:{marginBottom:32},SelectProps:{},children:i.map((function(e){var n=e.name,t=e.value;return(0,ne.jsx)(Sn.Z,{value:t,children:n},t)}))}),n.type===B.ROUTING_RULE_TYPES.REDIRECT&&[(0,ne.jsx)(Pe.Z,{select:!0,label:a("router.domain.add.redirect"),autoComplete:"off",variant:"outlined",name:"type",fullWidth:!0,value:n.redirectCode,onChange:function(e){return t((0,r.Z)((0,r.Z)({},n),{},{redirectCode:e.target.value}))},style:{marginBottom:32},SelectProps:{},children:Object.keys(x).map((function(e){return(0,ne.jsx)(Sn.Z,{value:e,children:"".concat(x[e]," - ").concat(e)},e)}))},"redirectCode"),(0,ne.jsx)(Pe.Z,{label:a("common.redirectUrl"),autoComplete:"off",variant:"outlined",name:"url","data-cy":"redirect-url-input",fullWidth:!0,value:n.url,helperText:a("router.urlHelperText"),style:{marginBottom:32},onChange:function(e){t((0,r.Z)((0,r.Z)({},n),{},{url:e.target.value,__disableConfirm:!e.target.value.trim()})),e.target.value.trim()?o(""):o(a("router.validation.redirectUrlRequired"))}},"redirectUrl")],n.type===B.ROUTING_RULE_TYPES.COMPONENT&&[(0,ne.jsx)(Pe.Z,{select:!0,label:a("router.domain.add.component"),autoComplete:"off",variant:"outlined","data-cy":"select-component-input",name:"componentId",fullWidth:!0,value:n.componentId,onChange:function(e){t((0,r.Z)((0,r.Z)({},n),{},{componentId:e.target.value}))},style:{marginBottom:32},SelectProps:{},children:s.map((function(e){return(0,ne.jsx)(Sn.Z,{value:e.meta.did,selected:e.meta.did===n.componentId,children:(0,W.getDisplayName)(e,!0)},e.meta.did)}))},"componentId"),f.length?(0,ne.jsx)(Pe.Z,{select:!0,label:a("router.domain.add.pageGroup"),autoComplete:"off",variant:"outlined",name:"pageGroup","data-cy":"route-group-input",fullWidth:!0,value:n.pageGroup,helperText:a("router.domain.add.pageGroupTip"),style:{marginBottom:32},onChange:function(e){t((0,r.Z)((0,r.Z)({},n),{},{pageGroup:e.target.value}))},SelectProps:{},children:f.map((function(e){return(0,ne.jsx)(Sn.Z,{value:e.value,selected:e.value===n.pageGroup,children:e.label},e.label)}))},"pageGroup"):null].filter(Boolean),n.type===B.ROUTING_RULE_TYPES.GENERAL_REWRITE&&(0,ne.jsx)(Pe.Z,{label:a("common.rewriteUrl"),autoComplete:"off",variant:"outlined",name:"url","data-cy":"rewrite-url-input",fullWidth:!0,value:n.url,helperText:a("router.urlHelperText"),style:{marginBottom:32},onChange:function(e){t((0,r.Z)((0,r.Z)({},n),{},{url:e.target.value,__disableConfirm:!e.target.value.trim()})),e.target.value.trim()?o(""):o(a("router.validation.rewriteUrlRequired"))}},"url")]})}function Fr(e){var n=e.children,t=(0,A.PE)().t,o=(0,le.h6)().api,i=(0,On.y0)().blocklet,a=(0,p.useState)(!1),l=(0,d.Z)(a,2),c=l[0],m=l[1],f=(0,p.useState)(null),h=(0,d.Z)(f,2),x=h[0],v=h[1],g=i.meta.did,Z=i.site.id,y=function(){var e=(0,u.Z)((0,s.Z)().mark((function e(n){var r,i;return(0,s.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,(0,at.fX)(n,t);case 3:if(!(r=e.sent)){e.next=6;break}throw r;case 6:return m(!0),i={from:{pathPrefix:(0,He.default)(n.pathPrefix)},to:{type:n.type}},n.type===B.ROUTING_RULE_TYPES.REDIRECT&&(i.to.url=n.url.trim(),i.to.redirectCode=n.redirectCode),n.type===B.ROUTING_RULE_TYPES.COMPONENT&&(i.to.did=g,i.to.componentId=n.componentId,i.to.pageGroup=n.pageGroup),n.type===B.ROUTING_RULE_TYPES.GENERAL_REWRITE&&(i.to.url=(0,He.default)(n.url)),e.next=13,o.addRoutingRule({input:{id:Z,rule:i,teamDid:g}});case 13:e.next=18;break;case 15:e.prev=15,e.t0=e.catch(0),V.Z.error(e.t0.message);case 18:return e.prev=18,m(!1),v(null),e.finish(18);case 22:case"end":return e.stop()}}),e,null,[[0,15,18,22]])})));return function(n){return e.apply(this,arguments)}}(),b={title:t("router.rule.add.title"),description:function(e,n,o){return(0,ne.jsxs)(cn.Z,{component:"div",children:[(0,ne.jsx)(Pe.Z,{label:t("router.rule.add.pathPrefix"),autoComplete:"off",variant:"outlined",name:"pathPrefix","data-cy":"path-prefix-input",fullWidth:!0,autoFocus:!0,helperText:e.pathPrefixHint||t("router.rule.add.pathPrefixTip"),style:{marginBottom:32},margin:"dense",value:e.pathPrefix,onChange:function(a){var l=!1,c=(0,at.Rw)({params:(0,r.Z)((0,r.Z)({},e),{},{pathPrefix:a.target.value}),blocklets:[i]});o(c),e.type===B.ROUTING_RULE_TYPES.BLOCKLET&&c&&(l=!0),e.type!==B.ROUTING_RULE_TYPES.REDIRECT||e.url||(l=!0),e.type!==B.ROUTING_RULE_TYPES.GENERAL_REWRITE||e.url||(l=!0),a.target.value.trim()||(l=!0,o(t("router.validation.pathPrefixRequired"))),l||o("");var s=t("common.slugifyHint",{value:(0,ce.LN)(a.target.value)});n((0,r.Z)((0,r.Z)({},e),{},{pathPrefix:a.target.value,pathPrefixHint:s,__disableConfirm:l}))}}),(0,ne.jsx)(Br,{params:e,setParams:function(e){o(null),(0,at.fX)(e,t)?n((0,r.Z)((0,r.Z)({},e),{},{__disableConfirm:!0})):n((0,r.Z)({},e))},setError:o})]})},confirm:t("router.rule.add.confirm"),cancel:t("common.cancel"),params:{did:"",pathPrefix:"",type:B.ROUTING_RULE_TYPES.REDIRECT,componentId:"",pageGroup:"",redirectCode:302,__disableConfirm:!0},onConfirm:y,onCancel:function(){m(!1),v(null)}},k=function(e){e.stopPropagation(),v(b)};return(0,ne.jsxs)(ne.Fragment,{children:["function"===typeof n?n({loading:c,open:k}):(0,ne.jsxs)(Sn.Z,{onClick:k,className:"rule-action","data-cy":"action-add-rule",children:[c?(0,ne.jsx)(F.Z,{size:16}):(0,ne.jsx)(wn.Z,{style:{fontSize:18,marginRight:5}}),t("router.rule.add.title")]}),x&&(0,ne.jsx)(ae.Z,{title:x.title,description:x.description,confirm:x.confirm,cancel:x.cancel,params:x.params,onConfirm:x.onConfirm,onCancel:x.onCancel,color:"primary"})]})}Br.propTypes={params:h().object,serviceTypes:h().array,setParams:h().func,setError:h().func},Br.defaultProps={params:{},serviceTypes:[{name:"Redirect",value:B.ROUTING_RULE_TYPES.REDIRECT},{name:"Default - User will see the 404 page",value:B.ROUTING_RULE_TYPES.NONE},{name:"Rewrite - Route traffic without redirect",value:B.ROUTING_RULE_TYPES.GENERAL_REWRITE},{name:"Component - Pass traffic to blocklet component",value:B.ROUTING_RULE_TYPES.COMPONENT}],setParams:function(){},setError:function(){}},Fr.propTypes={children:h().any},Fr.defaultProps={children:null};var qr=t(87862);function Ar(e){var n=e.id,t=e.from,r=e.children,o=(0,A.PE)().t,i=(0,le.h6)().api,a=(0,On.y0)().blocklet,l=(0,p.useState)(!1),c=(0,d.Z)(l,2),m=c[0],f=c[1],h=(0,p.useState)(null),x=(0,d.Z)(h,2),v=x[0],g=x[1],Z=a.meta.did,y=a.site.id,b=t.pathPrefix,k=function(){var e=(0,u.Z)((0,s.Z)().mark((function e(){return(0,s.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return f(!0),e.prev=1,e.next=4,i.deleteRoutingRule({input:{id:y,ruleId:n,teamDid:Z}});case 4:e.next=9;break;case 6:e.prev=6,e.t0=e.catch(1),V.Z.error(e.t0.message);case 9:return e.prev=9,g(null),f(!1),e.finish(9);case 13:case"end":return e.stop()}}),e,null,[[1,6,9,13]])})));return function(){return e.apply(this,arguments)}}(),j={keyName:b,title:o("router.rule.delete.title"),description:o("router.rule.delete.description",{name:"<b>".concat(b,"</b>")}),confirmPlaceholder:o("router.rule.delete.confirm_desc",{name:b}),confirm:o("common.delConfirm"),cancel:o("router.rule.delete.cancel"),onConfirm:k,onCancel:function(){f(!1),g(null)}},C=function(e){e.stopPropagation(),g(j)};return(0,ne.jsxs)(ne.Fragment,{children:["function"===typeof r?r({loading:m,open:C}):(0,ne.jsxs)(Sn.Z,{onClick:C,className:"rule-action","data-cy":"action-delete-rule",children:[m?(0,ne.jsx)(F.Z,{size:16}):(0,ne.jsx)(I.default,{style:{fontSize:18,marginRight:5}}),o("router.rule.delete.title")]}),v&&(0,ne.jsx)(Tt,{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})]})}function Gr(e){var n=e.id,t=e.from,o=e.to,i=e.children,a=(0,A.PE)().t,l=(0,le.h6)().api,c=(0,On.y0)().blocklet,m=(0,p.useState)(!1),f=(0,d.Z)(m,2),h=f[0],x=f[1],v=(0,p.useState)(null),g=(0,d.Z)(v,2),Z=g[0],y=g[1],b=c.meta.did,k=c.site.id,j=t.pathPrefix,C=function(){var e=(0,u.Z)((0,s.Z)().mark((function e(t){var r,o;return(0,s.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,(0,at.fX)(t,a);case 3:if(!(r=e.sent)){e.next=6;break}throw r;case 6:return x(!0),o={id:n,from:{pathPrefix:(0,He.default)(t.pathPrefix)},to:{type:t.type}},t.type===B.ROUTING_RULE_TYPES.REDIRECT&&(o.to.url=t.url,o.to.redirectCode=t.redirectCode),t.type===B.ROUTING_RULE_TYPES.COMPONENT&&(o.to.did=b,o.to.componentId=t.componentId,o.to.pageGroup=t.pageGroup),t.type===B.ROUTING_RULE_TYPES.GENERAL_REWRITE&&(o.to.url=(0,He.default)(t.url)),e.next=13,l.updateRoutingRule({input:{id:k,rule:o,teamDid:b}});case 13:e.next=18;break;case 15:e.prev=15,e.t0=e.catch(0),V.Z.error(e.t0.message);case 18:return e.prev=18,x(!1),y(null),e.finish(18);case 22:case"end":return e.stop()}}),e,null,[[0,15,18,22]])})));return function(n){return e.apply(this,arguments)}}(),P={title:a("router.rule.update.title"),description:function(e,n,t){return(0,ne.jsxs)(cn.Z,{component:"div",children:[(0,ne.jsx)(Pe.Z,{label:a("router.rule.add.pathPrefix"),autoComplete:"off",variant:"outlined",name:"pathPrefix","data-cy":"path-prefix-input",fullWidth:!0,autoFocus:!0,helperText:e.helperText||a("router.rule.add.pathPrefixTip"),style:{marginBottom:32},margin:"dense",value:e.pathPrefix,onChange:function(o){var i=!1;e.type!==B.ROUTING_RULE_TYPES.REDIRECT||e.url||(i=!0),e.type!==B.ROUTING_RULE_TYPES.GENERAL_REWRITE||e.url||(i=!0),o.target.value.trim()||(i=!0,t(a("router.validation.pathPrefixRequired"))),i||t("");var l=a("common.slugifyHint",{value:(0,ce.LN)(o.target.value)});n((0,r.Z)((0,r.Z)({},e),{},{pathPrefix:o.target.value,helperText:l,__disableConfirm:i}))}}),(0,ne.jsx)(Br,{params:e,setParams:function(e){(0,at.fX)(e,a)?n((0,r.Z)((0,r.Z)({},e),{},{__disableConfirm:!0})):n((0,r.Z)({},e))},setError:t})]})},confirm:a("router.rule.update.confirm"),cancel:a("router.rule.update.cancel"),color:"primary",params:{did:o.did||"",pathPrefix:"/"===j?j:j.replace(/^\/+/,"").replace(/\/+$/,""),type:o.type||B.ROUTING_RULE_TYPES.BLOCKLET,redirectCode:o.redirectCode||302,componentId:o.componentId||"",pageGroup:o.pageGroup||"",url:o.url||"",__disableConfirm:!1},onConfirm:C,onCancel:function(){x(!1),y(null)}},R=function(e){e.stopPropagation(),y(P)};return(0,ne.jsxs)(ne.Fragment,{children:["function"===typeof i?i({loading:h,open:R}):(0,ne.jsxs)(Sn.Z,{onClick:R,className:"rule-action","data-cy":"action-update-rule",children:[h?(0,ne.jsx)(F.Z,{size:16}):(0,ne.jsx)(be.default,{style:{fontSize:18,marginRight:5}}),a("router.rule.update.title")]}),Z&&(0,ne.jsx)(ae.Z,{title:Z.title,description:Z.description,confirm:Z.confirm,color:Z.color,cancel:Z.cancel,params:Z.params,onConfirm:Z.onConfirm,onCancel:Z.onCancel})]})}function zr(e){var n=(0,A.PE)().locale,t=(0,On.y0)(),o=t.blocklet,i=t.recommendedDomain,a=(0,ce.Sk)(i,e.from.pathPrefix,(0,ce.f0)(o,n));return(0,ne.jsxs)(v.Z,{display:"flex",alignItems:"center",children:[(0,ne.jsx)("a",{target:"_blank",href:a,rel:"noopener noreferrer",title:a,children:(0,ne.jsx)(k.Z,{size:"small",children:(0,ne.jsx)(E.Z,{})})}),(0,ne.jsx)(Gr,(0,r.Z)((0,r.Z)({},e),{},{children:function(n){var t=n.open;return(0,ne.jsx)(k.Z,{size:"small",onClick:t,disabled:e.isProtected,"data-cy":"action-update-rule",children:(0,ne.jsx)(P.Z,{})})}})),(0,ne.jsx)(Ar,(0,r.Z)((0,r.Z)({},e),{},{children:function(n){var t=n.open;return(0,ne.jsx)(k.Z,{size:"small",onClick:t,disabled:e.isProtected,"data-cy":"action-delete-rule",children:(0,ne.jsx)(I.default,{})})}}))]})}Ar.propTypes={id:h().string.isRequired,from:h().object.isRequired,children:h().any},Ar.defaultProps={children:null},Gr.propTypes={id:h().string.isRequired,from:h().object.isRequired,to:h().object.isRequired,children:h().any},Gr.defaultProps={children:null},zr.propTypes={isProtected:h().bool},zr.defaultProps={isProtected:!1};var Wr=["group"];function Mr(e){var n=e.group,t=(0,o.Z)(e,Wr);return n?(0,ne.jsx)(X.Z,(0,r.Z)((0,r.Z)({type:"reverse"},t),{},{children:n})):null}function Kr(e){var n=e.domain,t=e.isHttps,r=e.toUrl,o=t?"https":"http",i=r;return Jt()(i)||(i="".concat(o,"://").concat(n).concat(r)),(0,ne.jsx)(ee.Z,{href:i,target:"_blank",style:{fontSize:14},underline:"hover",children:r},i)}function Vr(e){var n=e.hasPermission,t=(0,A.PE)(),o=t.t,i=t.locale,a=(0,Rt.Z)(),l=(0,On.y0)(),c=l.blocklet,s=l.recommendedDomain;return c.site.rules.filter((function(e){return e.to.type!==B.ROUTING_RULE_TYPES.BLOCKLET})).map((function(e){var t=null,l=null;e.to.type===B.ROUTING_RULE_TYPES.NONE?t="404":e.to.type===B.ROUTING_RULE_TYPES.REDIRECT?t=e.to.redirectCode:e.to.type===B.ROUTING_RULE_TYPES.GENERAL_REWRITE?t="R":e.to.type===B.ROUTING_RULE_TYPES.COMPONENT&&(l=c.children.find((function(n){return n.meta.did===e.to.componentId})),t="C");var u=e.isProtected?(0,ne.jsx)(S.Z,{title:o("blocklet.router.urlLockTooltip"),placement:"top",children:(0,ne.jsx)("span",{children:(0,ne.jsx)(k.Z,{disabled:!0,size:"small",style:{pointerEvents:"auto",paddingTop:0,paddingBottom:0,margin:"12px 0"},children:(0,ne.jsx)(qr.Z,{style:{fill:a.palette.text.disabled}})})})}):(0,ne.jsx)(zr,(0,r.Z)({},e));return[(0,ne.jsxs)(v.Z,{display:"flex",py:2,className:"component-item",justifyContent:"space-between",alignItems:"center",children:[(0,ne.jsxs)(v.Z,{width:{xs:300,md:400},display:"flex",alignItems:"center",children:[(0,ne.jsx)(v.Z,{width:28}),"object"===typeof t?t:(0,ne.jsx)(er.Z,{children:t}),(0,ne.jsxs)(v.Z,{ml:2,children:[(0,ne.jsxs)(v.Z,{style:{color:"#222",fontSize:16},children:[e.to.type===B.ROUTING_RULE_TYPES.NONE&&o("common.page404"),e.to.type===B.ROUTING_RULE_TYPES.REDIRECT&&o("common.redirect"),e.to.type===B.ROUTING_RULE_TYPES.GENERAL_REWRITE&&o("common.rewrite"),e.to.type===B.ROUTING_RULE_TYPES.COMPONENT&&(0,W.getDisplayName)(l,!0)]}),(0,ne.jsxs)(v.Z,{display:"flex",alignItems:"center",children:[e.to.type===B.ROUTING_RULE_TYPES.REDIRECT&&(0,ne.jsx)(Kr,{domain:s,toUrl:e.to.url}),e.to.type===B.ROUTING_RULE_TYPES.GENERAL_REWRITE&&(0,ne.jsx)(Kr,{domain:s,toUrl:e.to.url}),e.to.type===B.ROUTING_RULE_TYPES.COMPONENT&&(0,ne.jsx)(Mr,{group:e.to.pageGroup})]})]})]}),(0,ne.jsx)(v.Z,{px:2,sx:{display:{xs:"none",md:"flex"}},alignItems:"center",flexGrow:"1",children:(0,ne.jsx)(ee.Z,{href:(0,ce.Sk)(s,e.from.pathPrefix,(0,ce.f0)(c,i)),target:"_blank",style:{fontSize:16},underline:"hover",children:e.from.pathPrefix})},e.from.pathPrefix),(0,ne.jsx)(v.Z,{children:n&&(0,ne.jsx)("div",{style:{textAlign:"right"},children:u})},"actions")]},"rule"),(0,ne.jsx)(gn.Z,{},"divider")]}))}Mr.propTypes={group:h().string.isRequired},Kr.propTypes={domain:h().string.isRequired,toUrl:h().string.isRequired,isHttps:h().bool},Kr.defaultProps={isHttps:!1},Vr.propTypes={hasPermission:h().bool},Vr.defaultProps={hasPermission:!1};var Yr=(0,se.V)(Vr,"mutate_blocklets"),Hr=(0,se.V)(Vr,"",ce.Wf);function Xr(e){return(0,le.h6)().inService?(0,ne.jsx)(Hr,(0,r.Z)({},e)):(0,ne.jsx)(Yr,(0,r.Z)({},e))}var Qr,Jr,$r,eo=t(80714),no=["blocklet","onUpdate","getComponentUrl"],to=function(e,n){return e?[{name:n("common.name"),value:e.displayName},{name:n("common.description"),value:e.description},{name:n("common.version"),value:(0,ne.jsx)(X.Z,{children:e.version})}]:[]},ro=function(e){var n=e.source,t=e.deployedFrom,r=e.bundleSource;return n?{source:n,deployedFrom:t}:r?r.url?{source:"url",deployedFrom:t||Array.isArray(r.url)?r.url[0]:r.url}:r.store?{source:"registry",deployedFrom:t||Array.isArray(r.store)?r.store[0]:r.store}:{}:{source:"upload",deployedFrom:t}},oo=function(e,n){for(var t=e.split("/").slice(1),r=n,o=0,i=[];r&&o<t.length;){var a=r.children.find((function(e){return e.meta.did===t[o]}));r=a,o++,a&&i.push(a.meta.title)}return i.join(" / ")};function io(e){var n,t,r,o,i=e.blocklet,a=e.ancestors,l=e.depth,c=e.onRemove,m=e.onStart,f=e.onStop,h=e.onRestart,y=e.onReload,b=e.getComponentUrl,j=e.app,C=(0,p.useContext)(A.RD),T=C.t,w=C.locale,_=(0,p.useState)(),L=(0,d.Z)(_,2),D=L[0],B=L[1],F=(0,p.useState)(!1),G=(0,d.Z)(F,2),z=G[0],M=G[1],V=(0,p.useState)(!1),Q=(0,d.Z)(V,2),J=Q[0],$=Q[1],ee=(0,p.useState)(null),oe=(0,d.Z)(ee,2),ie=oe[0],le=oe[1],se=(0,Y.K)().deletingBlocklets,ue=i.status;1===l&&se.includes(i.meta.did)&&(ue="deleting");var de,pe="/".concat(i.mountPoint||"/").replace(/\/+/g,"/"),me=b(pe),xe=D?ro(D):{},ge=D?[{name:T("common.name"),value:(0,W.getDisplayName)(D,!0)},{name:T("common.version"),value:(0,ne.jsx)(fe,{blocklet:D,checkUpgrade:!1})},{name:T("common.status"),value:(0,ne.jsx)(re.Z,{status:ue,source:D.source})},"running"===i.status?{name:T("blocklet.startedAt"),value:(0,ce.B2)(i.startedAt,w)}:null,"running"!==i.status?{name:T("blocklet.stoppedAt"),value:(0,ce.B2)(i.stoppedAt,w)}:null,i.installedAt?{name:T("blocklet.installedAt"),value:(0,ce.B2)(i.installedAt,w)}:null,(0,W.hasStartEngine)(i.meta)?{name:T("common.mountPoint"),value:pe}:null,D.meta.group?{name:T("common.group"),value:(0,ne.jsx)(X.Z,{type:"success",children:D.meta.group})}:null,{name:T("blocklet.overview.source"),value:(0,ne.jsx)(te,{sourceInfo:xe,blocklet:i})},{name:T("blocklet.overview.deployedFrom"),value:xe.deployedFrom||"-"},{name:T("common.did"),value:(0,ne.jsx)(H.Z,{did:D.meta.did})},{name:T("common.author"),value:(0,ce.rq)(D.meta.author)},{name:T("common.engine"),value:to(D.engine,T).map((function(e){var n=e.name,t=e.value;return(0,ne.jsx)(q.Z,{style:{marginBottom:4},nameWidth:120,name:n,children:t},n)}))},null!==(n=i.dependents)&&void 0!==n&&n.length?{name:T("common.dependents"),value:(0,ne.jsx)(v.Z,{children:i.dependents.map((function(e){return(0,ne.jsx)(v.Z,{children:"".concat(oo(e.id,j)," ").concat(e.required?"(".concat(T("common.required"),")"):"")})}))})}:null,null!==(t=i.meta.resources)&&void 0!==t&&t.length?{name:T("common.resource"),value:i.meta.resources.join(", ")}:null].filter(Boolean):[],Ze=(0,W.isInProgress)(j.status),ye=(0,W.isInProgress)(i.status),be="";if(Ze||ye||1===l&&se.includes(i.meta.did))be=T("blocklet.component.tip.stopBlocklet");else if(null!==(r=i.dependents)&&void 0!==r&&r.length){var ke=i.dependents.filter((function(e){return e.required}));if(ke.length){var je=ke.map((function(e){return oo(e.id,j)}));be=T("blocklet.component.tip.requiredBy",{name:je.join(", ")})}}return[(0,ne.jsxs)(lo,{display:"flex",py:2,className:"component-item",justifyContent:"space-between",alignItems:"center",children:[(0,ne.jsxs)(v.Z,{pl:2,width:{xs:300,md:400},display:"flex",alignItems:"center",children:[(0,ne.jsx)(he.Z,{blocklet:i,ancestors:a}),(0,ne.jsxs)(v.Z,{ml:"16px",children:[(0,ne.jsx)(v.Z,{className:"component-name",onClick:function(){return B(i)},children:(0,W.getDisplayName)(i,!0)}),(0,ne.jsxs)(v.Z,{display:"flex",alignItems:"center",children:[(0,ne.jsx)(fe,{blocklet:i,checkUpgrade:!1}),(0,ne.jsx)(ve,{style:{marginLeft:4},mode:i.mode||""}),"unknown"!==ue&&(0,ne.jsx)(re.Z,{style:{marginLeft:4},status:ue,source:i.source}),!(null===(o=i.dependents)||void 0===o||!o.length)&&(0,ne.jsx)(S.Z,{title:["".concat(T("common.dependents"),": "),i.dependents.map((function(e){return(0,ne.jsx)(v.Z,{pl:1,children:"".concat(oo(e.id,j)," ").concat(e.required?"(".concat(T("common.required"),")"):"")})}))],children:(0,ne.jsx)(v.Z,{display:"flex",color:"primary.main",ml:1,children:(0,ne.jsx)(O.JO,{icon:"octicon:package-dependents-16"})})})]})]})]},i),(0,W.hasStartEngine)(i.meta)&&(0,ne.jsx)(v.Z,{sx:{display:{xs:"none",md:"flex"}},alignItems:"center",flexGrow:"1",children:(0,ne.jsx)("a",{target:"_blank",href:me,rel:"noopener noreferrer",title:me,children:(0,ne.jsx)(v.Z,{maxWidth:400,sx:{color:"secondary.main",fontSize:18,px:2},overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis",children:K()(pe)})})},pe),(0,ne.jsxs)(v.Z,{display:"flex",alignItems:"center",children:[(0,W.hasStartEngine)(i.meta)&&(0,ne.jsx)(S.Z,{title:T("common.visit"),children:(0,ne.jsx)("a",{target:"_blank",href:me,rel:"noopener noreferrer",children:(0,ne.jsx)(k.Z,{size:"small",children:(0,ne.jsx)(E.Z,{})})})}),(0,W.hasStartEngine)(i.meta)&&(0,ne.jsx)(on,{blocklet:i,ancestors:a,children:function(e){var n=e.open;return(0,ne.jsx)(S.Z,{title:T("common.config"),children:(0,ne.jsx)(ao,{color:"error",badgeContent:"",variant:"dot",invisible:!(0,W.getComponentMissingConfigs)(i,a[0]).length,children:(0,ne.jsx)(k.Z,{onClick:n,size:"small",children:(0,ne.jsx)(P.Z,{})})})},"config")}}),(0,ne.jsx)(xn,{blocklet:j,component:i,onStart:m,onStop:f,disabled:!["starting","stopping"].includes(j.status)&&(0,W.isInProgress)(j.status)}),(0,ne.jsx)(eo.Z,{"data-cy":"component-actions",actions:[(0,W.hasStartEngine)(i.meta)?{icon:(0,ne.jsx)(R.Z,{}),text:T("common.detail"),onClick:function(){B(i)}}:null,{icon:(0,ne.jsx)(U.default,{}),text:T("common.restart"),onClick:function(){le({title:"".concat(T("common.restart")," ").concat(i.meta.title),description:T("blocklet.action.restartDescription"),confirm:T("blocklet.action.confirmRestart"),cancel:T("common.cancel"),onConfirm:function(){var e=(0,u.Z)((0,s.Z)().mark((function e(){return(0,s.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return $(!0),e.next=3,h(i);case 3:$(!1);case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),onCancel:function(){return le(null)}})},disabled:Ze||ye||"running"!==i.status},{icon:(0,ne.jsx)(N.Z,{}),text:T("common.reload"),onClick:function(){var e=(0,u.Z)((0,s.Z)().mark((function e(){return(0,s.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return $(!0),e.next=3,y(i);case 3:$(!1);case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),disabled:J||Ze||ye||"running"!==i.status},{icon:(0,ne.jsx)(I.default,{}),text:T("common.delete"),onClick:function(){M(!0)},disabled:Ze||ye||!!be,tip:be}].filter(Boolean)})]},"actions")]},"group-not-gateway-box"),(0,ne.jsx)(gn.Z,{depth:2}),!!D&&(0,ne.jsx)(x.Z,{open:!0,fullWidth:!0,maxWidth:"md",onClose:function(){B(null)},children:(0,ne.jsxs)(v.Z,{paddingY:1.5,children:[(0,ne.jsx)(Z.Z,{children:T("common.componentBasicInfo")}),(0,ne.jsx)(g.Z,{children:(de=ge,de.map((function(e){return e.name===T("common.did")||e.name===T("blocklet.appId")?(0,ne.jsx)(q.Z,{valueComponent:"div",nameWidth:120,name:e.name,nameFormatter:function(){return e.name},children:e.value},e.name):(0,ne.jsx)(q.Z,{valueComponent:"div",nameWidth:120,name:e.name,children:e.value},e.name)})))})]},"dialog-wrapper")},"base-info-dialog"),(0,ne.jsx)(dn,{blocklet:j,component:i,remove:function(){var e=(0,u.Z)((0,s.Z)().mark((function e(){var n=arguments;return(0,s.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return $(!0),e.prev=1,e.next=4,c.apply(void 0,n);case 4:e.next=8;break;case 6:e.prev=6,e.t0=e.catch(1);case 8:$(!1),M(!1);case 10:case"end":return e.stop()}}),e,null,[[1,6]])})));return function(){return e.apply(this,arguments)}}(),onCancel:function(){return M(!1)},hideBtn:!0,showConfirm:z}),ie&&(0,ne.jsx)(ae.Z,{title:ie.title,description:ie.description,confirm:ie.confirm,cancel:ie.cancel,params:ie.params,onConfirm:ie.onConfirm,onCancel:ie.onCancel})]}io.propTypes={blocklet:h().object.isRequired,ancestors:h().array,depth:h().number,onRemove:h().func,onStart:h().func,onStop:h().func,onRestart:h().func,onReload:h().func,getComponentUrl:h().func,app:h().object},io.defaultProps={ancestors:[],depth:0,onRemove:function(){},onStart:function(){},onStop:function(){},onRestart:function(){},onReload:function(){},getComponentUrl:function(){return window.location.origin},app:null};var ao=(0,m.Z)(C.Z)(Qr||(Qr=(0,c.Z)(["\n .BaseBadge-badge {\n top: ","px;\n right: ","px;\n }\n"])),(function(e){return 8*e.top||6}),(function(e){return 8*e.right||6})),lo=(0,m.Z)(v.Z)(Jr||(Jr=(0,c.Z)(["\n .component-name {\n color: #222;\n font-size: 16px;\n cursor: pointer;\n }\n"])));function co(e){var n=e.blocklet,t=(e.onUpdate,e.getComponentUrl),i=(0,o.Z)(e,no),a=(0,p.useContext)(A.RD).t,c=(0,le.h6)(),m=c.api,f=c.inService,h=c.info,C=(0,Y.K)(),R=C.addDeletingDid,E=C.removeDeletingDid,U=C.matchDeletingDid,N=(0,p.useState)(!1),I=(0,d.Z)(N,2),O=I[0],q=I[1],M=(0,p.useState)(null),K=(0,d.Z)(M,2),H=K[0],X=K[1],Q=(0,p.useState)(null),J=(0,d.Z)(Q,2),$=J[0],ee=J[1],te=(0,p.useState)(!1),re=(0,d.Z)(te,2),oe=re[0],ie=re[1],ae=n&&n.structVersion!==B.APP_STRUCT_VERSION,ue=(0,p.useState)(!1),de=(0,d.Z)(ue,2),pe=de[0],me=de[1],fe=(0,l.Z)(n.children)||[];"gateway"!==n.meta.group&&fe.unshift(n),U(fe.map((function(e){return e.meta.did})));var he=function(){var e=(0,u.Z)((0,s.Z)().mark((function e(){var t,r,o,i,l;return(0,s.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!O){e.next=2;break}return e.abrupt("return");case 2:return q(!0),e.prev=3,e.next=6,m.checkComponentsForUpdates({input:{did:n.meta.did}});case 6:if(e.t0=e.sent.preUpdateInfo,e.t0){e.next=9;break}e.t0={};case 9:if(t=e.t0,r=t.updateId,o=t.updateList,q(!1),r){e.next=16;break}return V.Z.info(a("blocklet.component.noUpdate")),e.abrupt("return");case 16:i=[],(0,W.forEachChildSync)(n,(function(e,n){var t=n.id,r=n.ancestors,a=o.find((function(e){return e.id===t}));if(a){var l=r.slice(1).concat(e).map((function(e){return e.meta.title||e.meta.name})).join(" / "),c=(r[1]||e).meta.did;i.push({groupId:c,name:l,version:e.meta.version,newVersion:a.meta.version})}})),l={},i.forEach((function(e){l[e.groupId]?e.disabled=!0:l[e.groupId]=!0})),X({params:{updateId:r},list:i,checks:l,hasChecks:!0}),e.next=27;break;case 23:e.prev=23,e.t1=e.catch(3),q(!1),V.Z.error((0,ce.Z)(e.t1));case 27:case"end":return e.stop()}}),e,null,[[3,23]])})));return function(){return e.apply(this,arguments)}}(),xe=function(){var e=(0,u.Z)((0,s.Z)().mark((function e(){var t,r;return(0,s.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!O){e.next=2;break}return e.abrupt("return");case 2:return e.prev=2,q(!0),t=Object.keys(H.checks).filter((function(e){return H.checks[e]})),r={updateId:H.params.updateId,rootDid:n.meta.did,selectedComponents:t},e.next=8,m.upgradeComponents({input:r});case 8:q(!1),X(null),me(null),e.next=17;break;case 13:e.prev=13,e.t0=e.catch(2),q(!1),V.Z.error((0,ce.Z)(e.t0));case 17:case"end":return e.stop()}}),e,null,[[2,13]])})));return function(){return e.apply(this,arguments)}}(),ve=function(){var e=(0,u.Z)((0,s.Z)().mark((function e(t,r){return(0,s.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return R(t.meta.did),e.prev=1,e.next=4,m.deleteComponent({input:{did:t.meta.did,keepData:"keepData"===r,rootDid:n.meta.did}});case 4:return e.next=6,(0,ce._v)(800);case 6:e.next=12;break;case 8:e.prev=8,e.t0=e.catch(1),V.Z.error((0,ce.Z)(e.t0)),E(t.meta.did);case 12:case"end":return e.stop()}}),e,null,[[1,8]])})));return function(n,t){return e.apply(this,arguments)}}(),ge=function(){var e=(0,u.Z)((0,s.Z)().mark((function e(t){return(0,s.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,m.startBlocklet({input:{did:n.meta.did,componentDids:[t.meta.did]}});case 3:return e.next=5,(0,ce._v)(800);case 5:e.next=10;break;case 7:e.prev=7,e.t0=e.catch(0),V.Z.error((0,ce.Z)(e.t0));case 10:case"end":return e.stop()}}),e,null,[[0,7]])})));return function(n){return e.apply(this,arguments)}}(),Ze=function(){var e=(0,u.Z)((0,s.Z)().mark((function e(t){return(0,s.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,m.stopBlocklet({input:{did:n.meta.did,componentDids:[t.meta.did]}});case 3:return e.next=5,(0,ce._v)(800);case 5:e.next=10;break;case 7:e.prev=7,e.t0=e.catch(0),V.Z.error((0,ce.Z)(e.t0));case 10:case"end":return e.stop()}}),e,null,[[0,7]])})));return function(n){return e.apply(this,arguments)}}(),ye=function(){var e=(0,u.Z)((0,s.Z)().mark((function e(t){return(0,s.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,m.restartBlocklet({input:{did:n.meta.did,componentDids:[t.meta.did]}});case 3:return e.next=5,(0,ce._v)(800);case 5:e.next=10;break;case 7:e.prev=7,e.t0=e.catch(0),V.Z.error((0,ce.Z)(e.t0));case 10:case"end":return e.stop()}}),e,null,[[0,7]])})));return function(n){return e.apply(this,arguments)}}(),be=function(){var e=(0,u.Z)((0,s.Z)().mark((function e(t){return(0,s.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,m.reloadBlocklet({input:{did:n.meta.did,componentDids:[t.meta.did]}});case 3:return e.next=5,(0,ce._v)(800);case 5:V.Z.success(a("blocklet.reloadSuccess")),e.next=11;break;case 8:e.prev=8,e.t0=e.catch(0),V.Z.error((0,ce.Z)(e.t0));case 11:case"end":return e.stop()}}),e,null,[[0,8]])})));return function(n){return e.apply(this,arguments)}}();return(0,ne.jsxs)(so,(0,r.Z)((0,r.Z)({component:"div"},i),{},{children:[(0,ne.jsxs)(v.Z,{display:"flex",justifyContent:"space-between",alignItems:"center",children:[(0,ne.jsxs)("div",{className:"title",children:[a("common.components"),!ae&&(0,ne.jsx)(se.Z,{permission:f?"":"mutate_blocklets",role:f?ce.Wf:[],children:(0,ne.jsx)(ao,{top:1.2,right:.4,color:"error",badgeContent:"",variant:"dot",invisible:!pe,children:(0,ne.jsxs)(G.Z,{disabled:O||(0,W.isInProgress)(n.status),color:"secondary",onClick:function(){he()},"data-cy":"check-for-updates",children:[(0,ne.jsx)(v.Z,{mr:.5,display:"flex",children:O?(0,ne.jsx)(F.Z,{size:16}):(0,ne.jsx)(b.Z,{style:{fontSize:"1em"}})}),a("blocklet.component.checkUpdateTitle")]})})})]}),(0,ne.jsx)(se.Z,{permission:f?"":"mutate_blocklets",role:f?ce.Wf:[],children:(0,ne.jsxs)(v.Z,{display:"flex",alignItems:"center",children:[(0,ne.jsx)(Fr,{children:function(e){var t=e.open;return(0,ne.jsxs)(G.Z,{disabled:O||(0,W.isInProgress)(n.status),variant:"text",color:"primary","data-cy":"add-rule",onClick:t,children:[(0,ne.jsx)(j.Z,{style:{fontSize:"1.3em",marginRight:4}}),a("router.rule.add.title")]})}}),!ae&&(0,ne.jsx)(Tr,{blocklet:n,serverVersion:h.version,children:function(e){var t=e.open;return(0,ne.jsxs)(G.Z,{disabled:O||(0,W.isInProgress)(n.status),variant:"text",color:"primary","data-cy":"add-component",onClick:t,children:[(0,ne.jsx)(j.Z,{style:{fontSize:"1.3em",marginRight:4}}),a("blocklet.component.add")]})}}),!ae&&(0,ne.jsx)(on,{blocklet:n,ancestors:[],children:function(e){var n=e.open;return(0,ne.jsx)(S.Z,{title:"".concat(a("blocklet.component.container")).concat(a("common.config")),children:(0,ne.jsx)(k.Z,{onClick:n,size:"small",color:"primary",children:(0,ne.jsx)(P.Z,{style:{fontSize:18}})})},"config")}})]})})]}),fe&&fe.length?(0,ne.jsxs)(v.Z,{mt:2,ml:{xs:"-12px",md:"-24px"},children:["gateway"!==n.meta.group&&(0,ne.jsx)(io,{blocklet:n,app:n,onRemove:ve,onStart:ge,onStop:Ze,onReload:be,onRestart:ye,getComponentUrl:t},"0-".concat(n.meta.did)),n.children.map((function(e){return(0,ne.jsx)(io,{depth:1,blocklet:e,ancestors:[n],app:n,onRemove:ve,onStart:ge,onStop:Ze,onReload:be,onRestart:ye,getComponentUrl:t},"1-".concat(e.meta.did))}))]},"top-blocklet-".concat(n.meta.did)):(0,ne.jsx)(v.Z,{mt:8,children:(0,ne.jsx)(z.Z,{children:a("blocklet.component.noComponent")})}),!!n.site.rules.length&&(0,ne.jsx)(v.Z,{mt:0,ml:{xs:"-16px",md:"-28px"},children:(0,ne.jsx)(Xr,{})}),!!H&&(0,ne.jsx)(x.Z,{open:!0,fullWidth:!0,children:(0,ne.jsxs)(v.Z,{paddingY:1.5,children:[(0,ne.jsx)(Z.Z,{children:a("blocklet.component.updateTitle")}),(0,ne.jsx)(v.Z,{component:g.Z,py:4,children:H.list.map((function(e){return(0,ne.jsxs)(v.Z,{display:"flex",alignItems:"center",children:[(0,ne.jsx)(_.Z,{checked:H.checks[e.groupId],onChange:function(n){return function(e,n){var t=e.target.checked;X((function(e){var o=Object.entries(e.checks).reduce((function(e,r){var o=(0,d.Z)(r,2),i=o[0],a=o[1];return e[i]=n===i?t:a,e}),{}),i=Object.values(o).includes(!0);return(0,r.Z)((0,r.Z)({},e),{},{checks:o,hasChecks:i})}))}(n,e.groupId)},style:{marginLeft:e.disabled?16:0},defaultChecked:!0,disabled:e.disabled}),(0,ne.jsxs)(v.Z,{flexGrow:1,mt:3,children:[(0,ne.jsx)(v.Z,{item:!0,xs:8,children:e.name}),e.version&&(0,ne.jsxs)(T.ZP,{fontSize:"h6.fontSize",container:!0,spacing:2,alignItems:"center",children:[(0,ne.jsx)(T.ZP,{item:!0,xs:3,children:e.version}),(0,ne.jsx)(T.ZP,{item:!0,xs:1,children:(0,ne.jsx)(w.Z,{style:{fontSize:"0.9em"}})}),(0,ne.jsx)(T.ZP,{item:!0,xs:3,children:(0,ne.jsx)(v.Z,{color:"secondary.main",children:e.newVersion})})]})]},"".concat(e.name,"-").concat(e.newVersion))]})}))}),(0,ne.jsxs)(y.Z,{style:{padding:"8px 24px 24px"},children:[(0,ne.jsx)(G.Z,{onClick:function(){X(null)},children:a("common.cancel")}),(0,ne.jsxs)(G.Z,{onClick:function(e){e.stopPropagation(),xe()},color:"primary",disabled:O||!H.hasChecks,variant:"contained",autoFocus:!0,children:[O&&(0,ne.jsx)(F.Z,{size:16}),a("common.update")]})]})]})}),!!$&&(0,ne.jsx)(x.Z,{open:!0,fullWidth:!0,onClose:function(){return ee(!1)},children:(0,ne.jsxs)(v.Z,{paddingY:1.5,children:[(0,ne.jsx)(Z.Z,{children:a("common.configuration")}),(0,ne.jsx)(g.Z,{children:(0,ne.jsx)(v.Z,{py:2,children:(0,ne.jsx)(L.Z,{control:(0,ne.jsx)(D.Z,{checked:oe,onChange:function(e){return ie(!!e.target.checked)}}),label:a("blocklet.component.showContainer")})})})]})})]}))}co.propTypes={blocklet:h().object.isRequired,onUpdate:h().func,getComponentUrl:h().func},co.defaultProps={onUpdate:function(){},getComponentUrl:function(){return window.location.origin}};var so=m.Z.div($r||($r=(0,c.Z)(["\n .title {\n font-size: 1.2rem;\n font-weight: bold;\n margin-bottom: ",";\n }\n\n @keyframes showDelay {\n 0% {\n opacity: 0;\n }\n\n 100% {\n opacity: 1;\n }\n }\n\n .component-item {\n animation: showDelay 0.75s ease 1;\n }\n"])),(function(e){return e.theme.spacing(1)})),uo=["blocklet"];function po(e){var n=e.blocklet,t=(0,o.Z)(e,uo);return(0,ne.jsx)(co,(0,r.Z)({blocklet:n,getComponentUrl:function(e){return"".concat(a()(window.location.origin,e))}},t))}po.defaultProps={}},60966:function(e,n,t){var r=t(6399);e.exports=function(e,n){return r(e)===r(n)}},80714:function(e,n,t){"use strict";t.d(n,{Z:function(){return j}});var r,o=t(71171),i=t(32723),a=t(34795),l=t(33028),c=t(96234),s=t(59740),u=t(30969),d=t(24974),p=t.n(d),m=t(16380),f=t(94551),h=t(48082),x=t(2689),v=t(28722),g=t(93310),Z=t(86008),y=t(37574),b=["actions","size"],k=["icon","text","onClick","disabled"];function j(e){var n=e.actions,t=e.size,r=(0,s.Z)(e,b),o=(0,u.useState)(null),d=(0,c.Z)(o,2),p=d[0],m=d[1],j=Boolean(p),P=function(e){try{e.stopPropagation(),e.preventDefault()}catch(n){}m(null)};return(0,y.jsxs)(C,(0,l.Z)((0,l.Z)({},r),{},{children:[(0,y.jsx)(f.Z,{"aria-label":"more","aria-controls":"actions-menu","aria-haspopup":"true","data-cy":"actions-menu-icon",onClick:function(e){try{e.stopPropagation(),e.preventDefault()}catch(n){}m(e.currentTarget)},size:t,children:(0,y.jsx)(v.Z,{})}),(0,y.jsx)(h.Z,{id:"actions-menu","data-cy":"actions-menu",anchorEl:p,keepMounted:!0,open:j,onClose:P,PaperProps:{},children:n.map((function(e,n){if("function"===typeof e)return e({close:P});var t=e.icon,r=e.text,o=e.onClick,c=e.disabled,d=void 0!==c&&c,p=(0,s.Z)(e,k);return(0,u.createElement)(x.Z,(0,l.Z)((0,l.Z)({},p),{},{disabled:d,dense:!0,onClick:function(){var e=(0,a.Z)((0,i.Z)().mark((function e(n){return(0,i.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,o(n);case 2:P();case 3:case"end":return e.stop()}}),e)})));return function(n){return e.apply(this,arguments)}}(),key:n,"data-cy":"actions-menu-".concat(n)}),(0,y.jsx)(g.Z,{style:{minWidth:24,marginRight:8},children:t}),(0,y.jsx)(Z.Z,{primary:r}))}))})]}))}j.propTypes={actions:p().array,size:p().oneOf(["small","medium","large"])},j.defaultProps={actions:[],size:"small"};var C=m.Z.div(r||(r=(0,o.Z)([""])))},52654:function(e,n,t){"use strict";t.d(n,{Rw:function(){return u},fX:function(){return s},sf:function(){return d},ub:function(){return c}});var r=t(20244),o=t(60966),i=t.n(o),a=t(59505),l=function(e,n){if(e.type===r.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===r.ROUTING_RULE_TYPES.BLOCKLET&&!e.did)return new Error(n("router.validation.didRequired"));return null},c=function(e,n){return e?e.endsWith(r.DEFAULT_IP_DOMAIN_SUFFIX)?n("router.domain.validate.suffixTip",{suffix:r.DEFAULT_IP_DOMAIN_SUFFIX}):null:n("router.domain.validate.emptyTip")},s=function(e,n){var t=l(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,r=e.blocklet,o=e.locale,l=void 0===o?"en":o;if(r){var c=(r.children||[]).find((function(e){return i()(e.mountPoint,n.pathPrefix)}));if("gateway"!==r.meta.group&&"/"===n.pathPrefix&&(c="/"),c)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")}[l]}var s=t.find((function(e){return e.meta.did===n.did}));if(!s)return"";var u=s.meta.interfaces.find((function(e){return"web"===e.type}));return u&&u.prefix!==a.BLOCKLET_DYNAMIC_PATH_PREFIX&&n.pathPrefix!==u.prefix?{zh:"\u8be5 blocklet \u53ea\u80fd\u6302\u8f7d\u5728 ".concat(u.prefix),en:"This blocklet can only be mounted on ".concat(u.prefix)}[l]:""},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}}},36558:function(e,n,t){"use strict";var r=t(33028),o=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,o.Z)(e,d)),p=(0,u.jsx)(s.Z,(0,r.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},8016:function(e,n,t){"use strict";t.d(n,{Z:function(){return L}});var r=t(71171),o=t(56666),i=t(33028),a=t(96234),l=t(30969),c=t(24974),s=t.n(c),u=t(16380),d=t(38361),p=t(1484),m=t(88581),f=t(27724),h=t(94551),x=t(94308),v=t(83176),g=t(98545),Z={description:s().string,editing:s().bool,onChange:s().func,required:s().bool,value:s().any,componentProps:s().object,render:s().func,renderFormItem:s().func},y=t(37574);function b(e){var n=e.editing,t=e.value,r=e.onChange,o=(0,l.useState)(!1),i=(0,a.Z)(o,2),c=i[0],s=i[1],u=(0,l.useRef)(),p=(0,l.useRef)(t);(0,l.useEffect)((function(){var e=null;return n&&(e=setTimeout((function(){s(!0)}),50)),function(){clearTimeout(e)}}),[n]);var m=function(e){p.current=e,r(e)},f=(0,y.jsx)(d.Z,{className:"form-item-input slot",px:1,children:(0,y.jsxs)(d.Z,{display:"flex",alignItems:"center",children:[t,"auto"!==t&&(0,y.jsx)("div",{style:{marginLeft:4,backgroundColor:t,width:"1em",height:"1em",borderRadius:"0.2em"}})]})}),h=(0,y.jsxs)(d.Z,{display:"flex",flexGrow:1,alignItems:"center",height:"40px",onKeyDown:function(){s(!1),r(p.current)},children:[(0,y.jsx)(d.Z,{display:"flex",alignItems:"center",onClick:function(){return s(!0)},children:(0,y.jsx)("div",{ref:u,style:{flexShrink:0,marginLeft:"8px",backgroundColor:t,width:"32px",height:"32px",boxSizing:"border-box",borderRadius:"8px",border:"1px solid #eee",cursor:"auto"===t?"default":"pointer"}})}),(0,y.jsx)(v.ZP,{open:c,anchorEl:u.current,onClose:function(){return s(!1)},anchorOrigin:{vertical:"bottom",horizontal:"center"},transformOrigin:{vertical:"top",horizontal:"center"},children:(0,y.jsx)(g.AI,{color:t,onChange:function(e){return m(e.hex)}})})]});return n?h:f}b.propTypes=Z;var k=t(59740),j=t(87006),C=["editing","description","value","onChange","componentProps"];function P(e){var n=e.editing,t=e.description,r=e.value,o=e.onChange,a=e.componentProps,c=(0,k.Z)(e,C),s=a.placeholder,u=(0,l.useRef)(r),p=function(e){u.current=e,o(e)};return n?(0,y.jsx)(j.Z,(0,i.Z)({style:{flex:1},fullWidth:!0,value:r,onChange:function(e){e.persist(),p(e.target.value)},autoFocus:!0,size:"small",variant:"outlined",placeholder:t||s,onKeyDown:function(e){"Enter"===e.key&&o(u.current,"confirm")}},c)):(0,y.jsx)(d.Z,{px:1,className:"form-item-input slot",children:r})}P.propTypes=Z,P.defaultProps={componentProps:{}};var R=t(52469),E=t.n(R),T=t(84938),S=t(7017),w=["editing","value","onChange","componentProps"];function _(e){var n=e.editing,t=e.value,r=e.onChange,o=e.componentProps,a=(0,k.Z)(e,w),l=o.blocklet,c="auto"===t?(0,T.getPassportColorFromDid)(l.appDid):t;return(0,y.jsxs)(d.Z,{display:"flex",alignItems:"center",children:[(0,y.jsx)("div",{style:{width:96,marginRight:12},dangerouslySetInnerHTML:{__html:E()({title:"Owner",issuer:(0,S.getDisplayName)(l),issuerDid:l.appDid,ownerName:"Your Name",ownerDid:l.appDid,preferredColor:t||"auto"})}}),(0,y.jsx)(b,(0,i.Z)((0,i.Z)({},a),{},{editing:n,value:n?c:t,onChange:r,componentProps:o}))]})}_.propTypes=(0,i.Z)((0,i.Z)({},Z),{},{componentProps:s().shape({blocklet:s().object.isRequired}).isRequired}),_.defaultProps={};var U,N=t(14458),I=t(28412);function L(e){var n=e.schema,t=e.loading,r=e.value,c=e.defaultValue,s=e.onChange,u=e.style,v=e.disabled,g="[object Object]"===Object.prototype.toString.call(r),Z=(0,l.useState)(null),k=(0,a.Z)(Z,2),j=k[0],C=k[1],R=(0,l.useState)(g?r:c),E=(0,a.Z)(R,2),T=E[0],S=E[1],w=(0,l.useRef)();function U(e,n,t){var r=e.key,a=e.secure,l=T[r]!==n,c=(0,i.Z)((0,i.Z)({},T),{},(0,o.Z)({},r,n));l&&S(c),s((0,o.Z)({},r,n),{allValues:c,action:t,currentItem:e}),"confirm"===t&&a&&S((0,i.Z)((0,i.Z)({},T),{},(0,o.Z)({},r,"__encrypted__"))),["confirm","cancel"].includes(t)?I(null):I(e)}function I(e){if(e)return w.current=T[e.key],void C(e);w.current=null,C(null)}return(0,y.jsx)(D,{className:"form",style:u,children:null===n||void 0===n?void 0:n.map((function(e){var n=e.key,o=e.description,a=e.required,l=e.hidden,c=void 0!==l&&l,s=e.componentProps,u=void 0===s?{}:s;if(c)return null;var Z=!(!j||n!==j.key),k=function(e,n){var t=n.editing,o=void 0!==t&&t,i=e.key,a=g?r[i]:T[i];return"__encrypted__"===a?o?"":"******":a}(e,{editing:Z}),C=function(e,n){var t=n.editing,r=void 0!==t&&t,o=e.componentType,i=void 0===o?"input":o,a=e.render,l=e.renderFormItem;return r&&l?l:!r&&a?a:{input:P,color:b,passport:_}[null===i||void 0===i?void 0:i.toLowerCase()]}(e,{editing:Z}),R={inputProps:{"data-cy":"schema-form-item-component"},key:n,description:o,editing:Z,value:k,onChange:function(n){return U(e,n,arguments.length>1&&void 0!==arguments[1]?arguments[1]:"change")},componentProps:u};return(0,y.jsxs)(d.Z,{className:"form-item",children:[(0,y.jsxs)(d.Z,{className:"form-item-label",style:{color:a&&!k?"#ff0000":"#333"},children:[o,a&&(0,y.jsx)(N.Z,{})]}),(0,y.jsxs)(d.Z,{className:"form-item-body",children:[(0,y.jsx)(d.Z,{className:"form-item-input",children:(0,y.jsx)(C,(0,i.Z)({},R))}),(0,y.jsx)(d.Z,{className:"form-item-action",children:Z?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(h.Z,{"data-cy":"schema-form-item-confirm",onClick:function(){U(e,k,"confirm")},disabled:v||t,size:"large",children:t?(0,y.jsx)(x.Z,{size:24}):(0,y.jsx)(f.Z,{})}),(0,y.jsx)(h.Z,{"data-cy":"schema-form-item-cancel",onClick:function(){U(e,w.current,"cancel")},disabled:v||t,size:"large",children:(0,y.jsx)(m.default,{})})]}):(0,y.jsx)(h.Z,{"data-cy":"schema-form-item-edit",onClick:function(){U(e,T[n],"edit")},disabled:v||j,size:"large",children:(0,y.jsx)(p.Z,{})})})]})]},n)}))})}L.propTypes={schema:s().array.isRequired,loading:s().bool,onChange:s().func.isRequired,value:s().object,defaultValue:s().object,style:s().object,disabled:s().bool},L.defaultProps={loading:!1,value:void 0,defaultValue:{},style:{},disabled:!1};var D=(0,u.Z)(I.Z)(U||(U=(0,r.Z)([""])))}}]);
2
+ //# sourceMappingURL=1565.ba7ad6c9.chunk.js.map