@abtnode/webapp 1.16.27-beta-426c1690 → 1.16.27-beta-d27e19fa
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/blocklet.js +1 -1
- package/blocklet.yml +1 -1
- package/build/asset-manifest.json +35 -36
- package/build/index.html +1 -1
- package/build/service-worker.js +1 -1
- package/build/static/js/1667.0305ed57.chunk.js +1 -0
- package/build/static/js/1685.7e872f73.chunk.js +2 -0
- package/build/static/js/1794.ff8418be.chunk.js +1 -0
- package/build/static/js/1869.958bc1ed.chunk.js +1 -0
- package/build/static/js/2226.183fdd58.chunk.js +1 -0
- package/build/static/js/2355.ed718f0c.chunk.js +1 -0
- package/build/static/js/2536.2c1f5173.chunk.js +1 -0
- package/build/static/js/2646.0f064d37.chunk.js +1 -0
- package/build/static/js/{5526.d2a1b8f0.chunk.js → 3047.2530c08d.chunk.js} +2 -2
- package/build/static/js/3108.ce45067a.chunk.js +1 -0
- package/build/static/js/3217.0647b52d.chunk.js +1 -0
- package/build/static/js/3595.f18b855e.chunk.js +1 -0
- package/build/static/js/3646.656a10a6.chunk.js +1 -0
- package/build/static/js/3815.bb373a04.chunk.js +1 -0
- package/build/static/js/3998.be52d2b0.chunk.js +1 -0
- package/build/static/js/4542.bf4b1ee9.chunk.js +1 -0
- package/build/static/js/{4804.9dc4ff41.chunk.js → 4804.4efecf89.chunk.js} +2 -2
- package/build/static/js/4906.ce938f60.chunk.js +1 -0
- package/build/static/js/{5083.ecb059e3.chunk.js → 5083.b86f0c1f.chunk.js} +2 -2
- package/build/static/js/5433.2b6a887c.chunk.js +1 -0
- package/build/static/js/5515.b6a25364.chunk.js +1 -0
- package/build/static/js/5760.4f263e0c.chunk.js +1 -0
- package/build/static/js/{592.c99306f8.chunk.js → 592.4624a4d2.chunk.js} +2 -2
- package/build/static/js/6129.bafd3307.chunk.js +1 -0
- package/build/static/js/{6234.42a5a205.chunk.js → 6234.93acfe87.chunk.js} +1 -1
- package/build/static/js/6399.d5c8f353.chunk.js +1 -0
- package/build/static/js/7702.059ea71f.chunk.js +1 -0
- package/build/static/js/8110.9889f226.chunk.js +1 -0
- package/build/static/js/8299.854a15c8.chunk.js +1 -0
- package/build/static/js/833.aaaf3519.chunk.js +1 -0
- package/build/static/js/8399.77b6358a.chunk.js +1 -0
- package/build/static/js/{9713.0f0a2355.chunk.js → 9713.6f7c47cb.chunk.js} +1 -1
- package/build/static/js/9779.7c1f5592.chunk.js +1 -0
- package/build/static/js/main.774f6320.js +2 -0
- package/package.json +1 -1
- package/build/static/js/1667.a0c1bd62.chunk.js +0 -1
- package/build/static/js/1685.8aa7ded2.chunk.js +0 -2
- package/build/static/js/1794.7f151439.chunk.js +0 -1
- package/build/static/js/1869.ca76ad10.chunk.js +0 -1
- package/build/static/js/2294.9e37053f.chunk.js +0 -1
- package/build/static/js/2355.fe9e5eaf.chunk.js +0 -1
- package/build/static/js/2646.7e958bf1.chunk.js +0 -1
- package/build/static/js/3108.430b8b4e.chunk.js +0 -1
- package/build/static/js/3217.1d7bfa2b.chunk.js +0 -1
- package/build/static/js/3351.be676eac.chunk.js +0 -1
- package/build/static/js/3595.763ef502.chunk.js +0 -1
- package/build/static/js/3646.97713153.chunk.js +0 -1
- package/build/static/js/3815.fa2cf47f.chunk.js +0 -1
- package/build/static/js/3998.505c54b8.chunk.js +0 -1
- package/build/static/js/4542.61cf3cd5.chunk.js +0 -1
- package/build/static/js/4906.fc570676.chunk.js +0 -1
- package/build/static/js/5433.56888945.chunk.js +0 -1
- package/build/static/js/5760.b43b20af.chunk.js +0 -1
- package/build/static/js/6129.b538b033.chunk.js +0 -1
- package/build/static/js/7702.65c33107.chunk.js +0 -1
- package/build/static/js/8110.446170f9.chunk.js +0 -1
- package/build/static/js/8139.b91619d0.chunk.js +0 -1
- package/build/static/js/8299.99b06bd6.chunk.js +0 -1
- package/build/static/js/833.ae2cf030.chunk.js +0 -1
- package/build/static/js/8399.d74f7fac.chunk.js +0 -1
- package/build/static/js/9085.2eba86ab.chunk.js +0 -1
- package/build/static/js/9733.35499d50.chunk.js +0 -1
- package/build/static/js/9779.c840728c.chunk.js +0 -1
- package/build/static/js/main.f04637c6.js +0 -2
- /package/build/static/js/{1685.8aa7ded2.chunk.js.LICENSE.txt → 1685.7e872f73.chunk.js.LICENSE.txt} +0 -0
- /package/build/static/js/{5526.d2a1b8f0.chunk.js.LICENSE.txt → 3047.2530c08d.chunk.js.LICENSE.txt} +0 -0
- /package/build/static/js/{4804.9dc4ff41.chunk.js.LICENSE.txt → 4804.4efecf89.chunk.js.LICENSE.txt} +0 -0
- /package/build/static/js/{5083.ecb059e3.chunk.js.LICENSE.txt → 5083.b86f0c1f.chunk.js.LICENSE.txt} +0 -0
- /package/build/static/js/{592.c99306f8.chunk.js.LICENSE.txt → 592.4624a4d2.chunk.js.LICENSE.txt} +0 -0
- /package/build/static/js/{main.f04637c6.js.LICENSE.txt → main.774f6320.js.LICENSE.txt} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_abtnode_webapp=self.webpackChunk_abtnode_webapp||[]).push([[8299],{13455:(e,t,n)=>{"use strict";n.d(t,{Z:()=>d});var o=n(55898),s=n.n(o),a=n(36687),r=n(72333);const i="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAUAAAAFACAYAAADNkKWqAAAACXBIWXMAACxLAAAsSwGlPZapAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAA1aSURBVHgB7d3ZjhxVEoDhxDKN902AUF/w/s/lCwthtXc3VsvyzETNJNOUe6kllzgnvk9KwVyMMNj5d2ZGRtUP//qPAaCgOwNAUQIIlCWAQFl3B5jJt2/fhvPz8+HDhw/DxcXF5n/fuXNnODk5GR4/fjzcv39/uHvXH0HW84MhCFOL0L1//35zxN9fJ+J379694cWLF0LIKgSQyewavqs8evRICFmcAHK0Y8K3LUL45MmTzZUhzE0AOdiU4dsWAYznhHHAXASQvX39+nUTvY8fP04evm1xS/z8+XMhZBYCyM5ikjuGb2ljCE2OmZIAcqsvX74Mb9682fx1bSbHTEkAuVam8F3F5JhjCSDfyR6+bSbHHEoA+Vtr4dtmcsy+BJDh06dPm3W1VsO3zeSYXQlgUeOeblzxxWstPTI55jYCWMycLy9nZXLMdQSwiIrhu4rJMZcJYOeE72omxwQB7FTG8MVnAWaLsMlxbQLYmSX3dHc1DiMePny4WaeLX9sa63Q3MTmuSQA7seae7nVuurqKUL99+zZtCE2OaxDAxmV8eXmcuO7yfG0M4V9//ZXqdRyT4xoEsFGth29bxG/8d8r2XqLJcb8EsDG9he8qsZmSNYQmx30RwEZUCN+2rCt6Jsf9EMDkMkYgroSePXu2+XrLJcS/u8kxcxDAhDLu6cY7fHGiP336dLVnYSbHTE0AE8n68nJEL474+wxMjpmKACYgfIcxOeZYArgi4ZuOyTGHEMAVCN98TI7ZhwAuKPuebsvh22ZyzC4EcAEZp5dVrkhMjrmJAM6o4svLWZkccxUBnIHw5WVyzGUCOCHha4vJMQI4AeFrm8lxXQJ4BHu6fTE5rkcAD5Dt1inDnm5PTI7rEMAdeXm5HpPj/gngLYQPk+N+CeA1hI+rmBz3RQC3CB+7MDnugwD+jz1dDmFy3LbyAbSnyxRMjttUNoBeXmYOJsdtKRdA4WMJJsdtKBNA4WMtJsd5dR9A4SMLk+N8ug2gPV2yMjnOo7sA2tOlFSbH6+sigF5epmUmx+tpOoDCR09MjpfXZACFj96ZHC+jqQAKH9WYHM+riQDa06U6k+N5pA6gPV34J5PjaaUMoJeX4WYmx9NIFUDhg/2YHB8nRQCFD45ncry/VQMofDA9k+PdrRJAe7owP5Pj2y0aQHu6sDyT4+vNHkAvL0MOJsffmzWAEb34Dy58kEfmyXFcEcaxlNkCGOGLIwPhg6tlnBzHc/jT09NFztVZApglfsIHu8k2mIxb4ojg3CYPYPwkefny5bAme7pwmEyT419++WX2SfHkATw7O9s8+1uDPV2YRobJ8RJXgZOPXGLCtDQvL8O04i4qrsDiTmqtyXFcjcYAdc67uMkDeHFxMSxF+GBeYwjXmhxHT+Y8v5t9QBY/FcQPlhEhfPDgQXePl5pdf4hL41evXpX8Kj9YUsZlhqk0v/8Vl+OvX7/ePKcQQphOxk9in1o3C7BCCNPI+ClNc+nuEwCEEA5TKXyjbj8CZTuEFb7lHg6R9fMDl9B9EcYQRvzGl6SFkOp6Hmzso0wJxjfb4+j1W+7hNsL3TyULEJf8cQghVVSY6B6i9JkvhPSu4mBjH874QQjpj/Dtxpl+yeUQZv0aP7hJ5YnuIQTwCmMIfdgCLTDYOFy6AP7+++9pvsEqforaNyarrOG7/Ensf/zxR+qr0XQB3P4csgwhtF1CJlknui1+BUXaW2AhhH/KOtiIczWiF+dDa19Bkf4ZoBBSXdbw9fCMvJkhyOUQjl/asvZX+dk3Zk5ZJ7o9DQebO1svDyQ+f/68eRaSJYT2jTlW5oluj6+HNXuWjs8d4sjy5c72jTlUCxPdHr9itouzM2ITR6Zvubddwi5MdNfV1VkphLTCRDeHLs9GISQrE91cuj4LxxBm+kNn37gmE92cSlyGxG/u6enp5g/fu3fvhvPz82Ft9o37Z6KbX6n7sPjN/u233/6e1to3Zg4muu0o+SDKdglzMNFtT+kn8ULIFEx022UUOQghhzHRbZ8AXmLfmF2Y6PbDmXQF+8ZsM9HtkzPoBvaNMdHtmzNnR7ZLajHRrcEZsych7JuJbi3OlAMJYV9MdGtyhhzJvnHbTHRrE8CJ2Dduh4kuIwGcmH3jvEx02SaAM7FdkoeJLtcRwJkJ4XpMdLmNAC5ECJdjosuuBHBh9o3nY6LLvgRwJfaNp2GiyzEEcGX2jQ9jossUBDAR2yW3M9FlSgKYkBB+z0SXOQhgYkJoosu8BLABFfeNTXRZggA2pPd9YxNdliaADept39hEl7UIYMNa3y4x0WVtAtiB1kJooksWAtiR7CGMuMTWi8EGWQhgh7LuG5+dnQ2ZCB8C2LGM+8YZmOgyEsACMu4bL81gg6sIYDEZt0vmJHzcRACL6j2EJrrsQgCL6y2EBhvsQwDZyLhvvA/h4xACyD9k3De+iYkuxxBArpRx33hksMFUBJAbZdouET6mJoDsZM0QmugyFwFkL0uG0GCDuQkgB5lz31j4WIoAcpTL+8bjh5oe6uTkZPj555+Fj8V4oMIkIoQ//fTTcIwIoPixJAEEyhJAoCwBBMoSQKAsAQTKEkCgLAEEyhJAoCwBBMoSQKAsAQTKEkCgLAEEyhJAoCwBBMoSQKAsAQTKEkCgLAEEyhJAoCwBBMoSQKAsAQTKEkCgLAEEyhJAoCwBBMoSQKAsAQTKEkCgLAEEyhJAoCwBBMoSQKAsAQTKEkCgLAEEyhJAoCwBBMoSQKAsAQTKEkCgLAEEyhJAoCwBBMoSQKAsAQTKEkCgLAEEyhJAoCwBBMoSQKAsAQTKEkCgLAEEyhJAoCwBBMoSQKAsAQTKEkCgLAEEyhJAoCwBBMoSQKAsAQTKEkCgLAEEyhJAoCwBBMoSQKAsAQTKEkCgLAEEyhJAoCwBBMoSQKAsAQTKEkCgLAEEyhJAoCwBBMoSQKAsAQTKEkCgLAEEyhJAoCwBBMoSQKAsAQTKEkCgLAEEyhJAoCwBBMoSQKAsAQTKEkCgLAEEyhJAoCwBBMoSQKCsdAH8+vXrALTv27dvmyOzu0MyL1++HB49ejS8ePFiuHs33S8PuEVE7/3795tDAA/w6dOnzSGE0I6Li4tN9D5//pw+fKPUZRFCyO/Lly/DmzdvNn9tTRNFEULIp+XwjZoqyRjCBw8eDM+ePRvu3bs3AMuJW9vz8/Ph3bt3m1ve1k0ewDt37sx+/x+/AXFEAOOKUAhhXi0NNvYxeQDj9nSpnwxx6f3q1avNP/P58+fD48ePB2A6a4fv5ORkmNPkAXz48OHil8bx7uDr16+Ht2/fCiFMIMNEN+IXd5RzmjyAT58+Xe2nhRDCcTINNqIlc5vlGWDE5+zsbFiLEMJ+sk10Y9C5xHk7yxQ4yh1XgBGgNV0OYfya4vbcKzTwX1knunHr++uvvw5LmK0GceX1448/bn6qrL3fG//8uCKNW/P4qRKHEFJV1olu3D3GhUoccz/7G81agXhxOY54dy9LCONqMA4vVVON8H1vkbM/WwiD7RKqyLqju2b4Roue9UIIy8m6qhbP+MZn8muFb7TK2S6EMJ+s4cu4ubXqWT6GMNNvmH1jWpR5RzfzymqKy5z4D3N6eroJ4MePHzfH2uwb04LMg43xImLudbZjpLrPi8jEEa/QxKQ2QwjtG5ORie40fvjXfwxJja+tZAjhSAivF48O/vzzz+FQ8ThkqRdgW2WiO63UARwJYRsEcD4muvNoIoAjIcxNAKdnojuvpgI4ihCOw5IsX6MZIay+byyA0zDRXU6TZ+rlq67xJ6R9Y1pnoru8ps/QCIx9Y1pnoruebs5M2yW0xkR3fd2dkUJIdia6eXR7Jgoh2Zjo5tP9GWjfmDWZ6OZW5hLEvjFLMtFtQ7l7MPvGzMlEty1Nvgg9Jdsl06n8IrSJbpvKB3AkhMerGEAT3bYJ4BYhPFylAJro9kEAr2HfeH+9B9BEtz9eRLuGfWNGJrr9cvbcwr5xXSa6/XPW7MF2SQ0munU4Ww4ghH0y0a3HWXIEIeyDiW5dzo4J2Dduj4kuQQAnZN84PxNdLhPAGdg3zsdEl6t4EXoBVbZLMr4IbaLLTQRwQb2HMFMATXTZhQCuoNcQZgigiS77EMAV9bZvvFYATXQ5lCHIiuwbH8dEl2MJYAL2jfdjostUBDAZ2yXXM9FlagKYlBD+n4kucxHA5CqH0ESXuQlgI1rYN56CiS5L8hpMoyKAEYmIRRZxJXjMFWr8/yOAJrosRQAbl/Gl6h4YbNQggJ0QwmkIXy0C2BkhPIyJbk0C2Ckh3I3BRm0C2LmM+8YZCB9BAIuI+MUGRWxSVA2hiS7bBLCgTC9VL8Fgg+sIYGG9h1D4uI0A0l0ITXTZlQDyt9ZDaLDBvgSQ72T9EILrCB+HEkCulXHf+LL4cIgnT54IHwcTQG6V6aVqgw2mJIDsbM0QCh9zEED2tmQIx2+piy9nEj6mJoAcbM4QGmywBAHkaFPuGwsfSxJAJnPMvrGJLmsQQGaxy0vVBhusTQCZVYTww4cPmy84iu/6iNDFqtr9+/eFj9UJIFCWH79AWQIIlCWAQFn/BizMxGSX68uEAAAAAElFTkSuQmCC";var l=n(74094),c=n(96266);function d(e){let{blocklet:t,blockletMetaUrl:n}=e;const{did:o,version:s,logo:d}=t.meta;let p;return p=d?(0,c.jsx)(a.Z,{src:(0,l.aZ)({did:o,version:s,logoPath:d,baseUrl:new URL(n).origin}),fallback:i,width:64,size:"contain",placeholder:"application logo"}):(0,c.jsx)(r.Z,{did:o,size:64}),p}d.propTypes={blocklet:s().object.isRequired,blockletMetaUrl:s().string.isRequired}},13932:(e,t,n)=>{"use strict";n.d(t,{Z:()=>x});var o,s=n(71171),a=n(68420),r=n(77277),i=n(33518),l=n(39948),c=n(5057),d=n(11397),p=n.n(d),u=n(6202),h=n(96266);const m=p()("@abtnode/webapp:launch-blocklet:download-progress");const f=(e,t)=>{m("getDownloadBundleStep",e);return(e||[]).map((e=>{var n;const o=t("launchBlocklet.waiting.".concat("extracting"===e.status?"extractingComponent":"downloadingComponent"),{name:(null===(n=e.component)||void 0===n?void 0:n.title)||""}),s=e.total&&e.current?": ".concat(Math.floor(e.current/e.total*100)," %"):"";let a=e.name?": ".concat(e.name):"";return s||(a+="..."),"".concat(o).concat(s).concat(a)})).join("\n")};function x(e){let{appDid:t,visible:n}=e;const{t:o}=(0,a.PE)(),s=function(e){let{appDid:t}=e;const[n,o]=(0,c.useState)([]),s=(0,u.ZP)();return(0,c.useEffect)((()=>(s.on(r.BlockletEvents.downloadBundleProgress,(e=>{t&&t===(null===e||void 0===e?void 0:e.appDid)&&o((t=>{const n=[...t],o=n.findIndex((t=>{var n,o;return(null===(n=t.component)||void 0===n?void 0:n.did)===(null===(o=e.component)||void 0===o?void 0:o.did)}));return"completed"===e.status?-1!==o&&n.splice(o,1):-1!==o?n[o]=e:n.push(e),[...n]}))})),()=>{s.off(r.BlockletEvents.downloadBundleProgress)})),[t,s]),n}({appDid:t});return(0,h.jsx)(g,{style:{display:n?"block":"none"},children:f(s,o)})}x.defaultProps={appDid:"",visible:!0};const g=(0,i.Z)(l.Z)(o||(o=(0,s.Z)(["\n flex: 0 0 auto;\n white-space: pre;\n overflow-y: auto;\n overflow-x: auto;\n max-height: 10em;\n max-width: 500px;\n min-width: auto;\n @media (max-width: ","px) {\n max-width: 90%;\n max-height: 30vh;\n }\n"])),(e=>e.theme.breakpoints.values.md))},66436:(e,t,n)=>{"use strict";n.d(t,{Z:()=>i});var o,s=n(71171),a=n(33518),r=n(96266);function i(e){let{children:t}=e;return(0,r.jsx)(l,{children:t})}const l=a.Z.div(o||(o=(0,s.Z)(["\n color: #1dc1c7;\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n width: 100%;\n"])))},11476:(e,t,n)=>{"use strict";n.d(t,{Z:()=>g});var o=n(5057),s=n(77277),a=n(31853),r=n(11397),i=n.n(r),l=n(6202),c=n(10155);const d=i()("@abtnode/webapp:launch-blocklet:runtime-state"),p=Object.keys(s.BlockletStatus),u=Object.values(s.BlockletStatus),h=Object.values(s.BlockletEvents).filter((e=>![s.BlockletEvents.purchaseChange,s.BlockletEvents.domainStatus].includes(e))),m=(e,t)=>{var n;return(null===e||void 0===e?void 0:e.appDid)===t||(null===e||void 0===e||null===(n=e.meta)||void 0===n?void 0:n.did)===t},f=8e3,x=2e3;function g(e){const t=(0,c.Z)(),n=(0,l.ZP)(),s=(0,o.useRef)(null),r=()=>{e&&!s.current&&(s.current=setInterval((()=>{e&&(d("polling blocklet state"),v())}),x))},[i,g]=(0,a.Z)({status:null,eventName:"",runtimeBlocklet:null,error:"",isGetBlocklet:!1,startPolling:r,stopPolling:()=>{s.current&&clearInterval(s.current)}}),v=()=>{t.getBlocklet({input:{did:e,attachRuntimeInfo:!0}}).then((e=>{g({status:e.blocklet?e.blocklet.status:"",eventName:"",runtimeBlocklet:e.blocklet,isGetBlocklet:!0})})).catch((e=>{console.error("get blocklet failed",e)}))};(0,o.useEffect)((()=>{let t=null;return e&&(d("schedule polling blocklet state"),t=setTimeout((()=>{r()}),f)),()=>{t&&clearInterval(t)}}),[e]),(0,o.useEffect)((()=>{e?null===i.status&&(d("polling blocklet state on start"),v()):g({status:"",eventName:"",runtimeBlocklet:null})}),[e,i.status]);const y=t=>n=>{if(m(n,e)){const e={status:null,eventName:t,runtimeBlocklet:n,isGetBlocklet:!1};if(n.error)d("blocklet error",{blockletEventName:t,error:n.error}),e.status="error",e.error=n.error;else{const o=p[u.indexOf(n.status)];d("blocklet event",{blockletEventName:t,status:o}),o&&(e.status=o)}g(e)}};for(const a of h)(0,o.useEffect)((()=>{const t=y(a);return e&&n.on(a,t),()=>{e&&n.off(a,t)}}),[e]);return i}},28299:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>Qt});var o,s=n(71171),a=n(5057),r=n(53616),i=n.n(r),l=n(85493),c=n(6352),d=n.n(c),p=n(21371),u=n(15715),h=n(33518),m=n(68420),f=n(63061),x=n(77829),g=n(66889),v=n(10866),y=n(4456),w=n(12332),k=n(47791),b=n(64387),j=n(25339),A=n(75793),Z=n(84024),E=n(39948),S=n(19577),P=n(2478),C=n(44067),B=n(28726),D=n(42876),T=n(55898),R=n(96266);function M(e){let{children:t,selected:n}=e;return(0,R.jsxs)(L,{children:[t,(0,R.jsx)(E.Z,{className:"selected-container ".concat(n?"selected":""),children:(0,R.jsx)(D.default,{className:"selected-icon"})})]})}const L=(0,h.Z)(E.Z)(o||(o=(0,s.Z)(["\n position: relative;\n\n .selected-container {\n display: flex !important;\n position: absolute;\n right: 0px;\n bottom: 0px;\n -webkit-box-pack: end;\n justify-content: flex-end;\n align-items: flex-end;\n width: 32px;\n height: 32px;\n border-radius: 0px 0px 8px;\n color: rgb(255, 255, 255);\n overflow: hidden;\n transition: all 0.4s ease 0s;\n\n &::after {\n position: absolute;\n z-index: 0;\n left: 60px;\n top: 60px;\n display: block;\n width: 0px;\n height: 0px;\n border-width: 16px;\n border-style: solid;\n border-color: transparent #1dc1c7 #1dc1c7 transparent;\n transition: all 0.1s ease 0s;\n content: '';\n }\n\n .selected-icon {\n visibility: hidden;\n width: 60%;\n height: 60%;\n position: relative;\n z-index: 2;\n margin: 0px 1px 1px 0px;\n font-size: 16px;\n transition: all 0.2s ease 0s;\n }\n }\n\n .selected-container.selected {\n &::after {\n left: 0px;\n top: 0px;\n }\n\n .selected-icon {\n visibility: visible;\n }\n }\n"])));M.propTypes={children:T.node.isRequired,selected:T.bool},M.defaultProps={selected:!1};var N=n(67654),O=n(65873),F=n(94639);const Q=(0,a.createContext)({}),{Provider:U,Consumer:z}=Q;function G(e){let{children:t}=e;const{t:n}=(0,m.PE)(),[o,s]=(0,N.Z)("spaceGatewaysForRestore",[{name:"Prod DID Spaces",url:"https://www.didspaces.com/app",protected:!0},{name:"Staging DID Spaces",url:"https://spaces.staging.arcblock.io/app",protected:!0}]),[r,i]=(0,N.Z)("selectedSpaceGatewayForRestore",o.find((e=>"https://www.didspaces.com/app"===e.url)));return(0,a.useEffect)((()=>{!async function(){const e=await Promise.all(o.map((async e=>{var t;const{data:n}=await F.Z.get(d()(e.url,"/__blocklet__.js?type=json"),{timeout:5e3}).catch((e=>(console.error(e),{data:{}}))),o=null!==(t=n.appName)&&void 0!==t?t:e.name;return(0,O.merge)(e,{name:o})})));s(e)}()}),[]),(0,R.jsx)(U,{value:{spaceGateways:o,selectedSpaceGateway:r,addSpaceGateway:e=>{const t=o.find((t=>e.url===t.url));if(t)throw new Error(n("storage.spaces.gateway.add.duplicate",{name:t.name}));s((()=>[...o,(0,O.cloneDeep)(e)])),i(e)},deleteSpaceGateway:e=>{if(e.url===r.url)throw new Error(n("storage.spaces.gateway.delete.failedForSelected"));s((()=>o.filter((t=>t.url!==e.url))))},handleSelectSpaceGateway:e=>{i(e)}},children:t})}G.defaultProps={};var I=n(92877),J=n(11750),H=n(83580),X=n(94552),K=n(67680),Y=n(19778),W=n(47595),_=n(60939),V=n(86229),q=n(72443),$=n.n(q);function ee(e){let{spaceGateway:t,onDeleteSpaceGateway:n}=e;const{t:o}=(0,m.PE)(),[s,r]=(0,a.useState)(!1),[i,l]=(0,a.useState)(!1),c=(e,t)=>{null===e||void 0===e||e.stopPropagation(),r(t)};return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(K.Z,{size:"small",onClick:e=>c(e,!0),children:(0,R.jsx)(W.default,{})}),(0,R.jsx)(_.Z,{title:o("common.delConfirmDescription",{data:"".concat(null===t||void 0===t?void 0:t.name)}),open:s,confirmButton:{text:o("common.confirm"),props:{variant:"contained",color:"error",loading:i}},cancelButton:{text:o("common.cancel"),props:{variant:"contained",color:"primary"}},onConfirm:async e=>{try{null===e||void 0===e||e.stopPropagation(),l(!0),await n(t),r(!1)}catch(s){console.error(s),V.Z.error("".concat(o("storage.spaces.gateway.delete.failed"),": ").concat($()(s)))}finally{l(!1)}},onCancel:e=>c(e,!1)})]})}ee.defaultProps={onDeleteSpaceGateway:()=>{}};const te=ee;var ne=n(95335);const oe=function(){const e=(0,ne.Z)(),t=(0,u.Z)(e.breakpoints.down("md"));return{minWidth:t?300:e.breakpoints.values.sm,isMobile:t}};var se,ae=n(74094);const re=(0,I.Z)((()=>({menuName:{display:"flex",flex:1,flexDirection:"column",paddingRight:"24px","& span":{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}}})));function ie(e){let{spaceGateway:t,selected:n,onDeleteSpaceGateway:o,onSelectGateway:s,...a}=e;const r=re(),{t:i}=(0,m.PE)(),{isMobile:l}=oe();return(0,R.jsxs)(le,{...a,children:[(0,R.jsx)(E.Z,{display:"inline-flex",marginRight:"8px",alignItems:"center",children:(0,R.jsx)("img",{alt:t.name,src:d()(t.url,"favicon.ico"),width:"48px",height:"48px"})}),(0,R.jsxs)(E.Z,{className:r.menuName,onClick:s,children:[(0,R.jsxs)(J.Z,{component:"span",variant:"subtitle1",style:{fontWeight:"400"},children:[null===t||void 0===t?void 0:t.name," ",n&&(0,R.jsx)(Y.Z,{color:"primary",style:{marginLeft:"8px"},children:i("common.selected")})]}),(0,R.jsx)(J.Z,{className:"url",component:"span",variant:"inherit",children:"".concat(l?(0,ae.aS)(null===t||void 0===t?void 0:t.url,38):null===t||void 0===t?void 0:t.url)})]}),(0,R.jsxs)(H.Z,{children:[(0,R.jsx)(K.Z,{onClick:e=>{e.stopPropagation(),window.open(t.url)},size:"small",children:(0,R.jsx)(X.Z,{})}),!0!==(null===t||void 0===t?void 0:t.protected)&&(0,R.jsx)(te,{spaceGateway:t,onDeleteSpaceGateway:async()=>{await o(t)}})]})]})}const le=(0,h.Z)(E.Z)(se||(se=(0,s.Z)(["\n display: flex;\n"])));ie.defaultProps={onDeleteSpaceGateway:()=>{},selected:!1,onSelectGateway:()=>{}};var ce=n(13128),de=n(44846),pe=n(47020),ue=n(55372),he=n(88574),me=n(96567);function fe(e){let{onAddGateway:t,...n}=e;const{t:o,locale:s}=(0,m.PE)(),[r,i]=(0,a.useState)(""),[l,c]=(0,a.useState)(!1),[p,u]=(0,a.useState)(!1),[h,f]=(0,a.useState)(""),x=async()=>{try{c(!0);const e=await(0,me.Z3)(r,{withSearchParams:!1});if(!await(0,me.w2)(e))throw new Error(o("storage.spaces.gateway.add.invalidUrl"));const{data:n}=await F.Z.get(d()(new URL(e).origin,"/__blocklet__.js?type=json")),s={name:n.appName,url:e,protected:!1};await t(s),V.Z.success(o("storage.spaces.addedWithName",{name:s.name})),u(!1)}catch(e){f("".concat(o("storage.spaces.gateway.add.failed",s),": ").concat($()(e)))}finally{c(!1)}};return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(B.Z,{size:"middle",color:"primary",variant:"outlined",onClick:()=>u(!0),...n,children:o("storage.spaces.gateway.add.title")}),(0,R.jsxs)(ce.ZP,{title:o("storage.spaces.gateway.add.title"),fullWidth:!0,maxWidth:"md",open:p,onClose:()=>u(!1),PaperProps:{style:{minHeight:"auto"}},actions:(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(B.Z,{onClick:e=>{e.stopPropagation(),u(!1)},color:"inherit",children:o("common.cancel")}),(0,R.jsxs)(B.Z,{onClick:e=>{e.stopPropagation(),x()},color:"primary","data-cy":"install-blocklet-next-step",disabled:l||!r,variant:"contained",autoFocus:!0,children:[l&&(0,R.jsx)(de.Z,{size:16}),o("common.confirm")]})]}),children:[(0,R.jsx)("div",{style:{paddingTop:12,overflowY:"hidden"},children:(0,R.jsx)(ue.Z,{component:"div",children:(0,R.jsx)(J.Z,{component:"div",children:(0,R.jsx)(pe.Z,{label:o("storage.spaces.gateway.add.label"),autoComplete:"off",variant:"outlined",name:"url",fullWidth:!0,value:r,onChange:e=>{f(null),i(e.target.value)},disabled:l,onKeyPress:async e=>{"Enter"===e.key&&(e.preventDefault(),await x())},autoFocus:!0})})})}),!!h&&(0,R.jsx)(he.Z,{type:"error",style:{width:"100%"},children:h})]})]})}fe.defaultProps={onAddGateway:()=>{}};const xe=fe;function ge(e){let{onConnect:t,...n}=e;const{spaceGateways:o,selectedSpaceGateway:s,handleSelectSpaceGateway:r,addSpaceGateway:i,deleteSpaceGateway:l}=(0,a.useContext)(Q),{t:c}=(0,m.PE)(),d=async e=>{await l(e)};return(0,R.jsxs)(E.Z,{...n,children:[(0,R.jsx)(S.Z,{children:o.map((e=>{const t=(null===e||void 0===e?void 0:e.url)===s.url;return(0,R.jsx)(M,{selected:t,children:(0,R.jsx)(P.ZP,{button:!0,selected:t,"data-cy":"get-space-endpoint-for-restore",children:(0,R.jsx)(C.Z,{children:(0,R.jsx)(ie,{spaceGateway:e,onDeleteSpaceGateway:d,selected:t,onSelectGateway:()=>(e=>{r(e)})(e)})})},e.url)})}))}),(0,R.jsxs)(E.Z,{display:"flex",marginTop:"16px",justifyContent:"center",alignItems:"center",children:[(0,R.jsx)(xe,{onAddGateway:async e=>{await i(e)}}),(0,R.jsx)(B.Z,{sx:{marginLeft:"16px"},size:"middle",variant:"contained",onClick:()=>{t(s)},children:c("storage.spaces.connect.now")})]})]})}ge.defaultProps={onConnect:()=>{}};const ve=ge;var ye;const we=(0,h.Z)("div")(ye||(ye=(0,s.Z)(["\n width: 100%;\n height: 100%;\n overflow-y: auto;\n"])));const ke=function(){const{info:e}=(0,A.h6)(),{t:t,locale:n}=(0,a.useContext)(m.RD),o=(0,a.useMemo)((()=>e?(0,k.RU)(e):""),[e]);return(0,R.jsx)(G,{children:(0,R.jsxs)(we,{children:[(0,R.jsx)(Z.Z,{title:t("blocklet.restoreFromSpaces.connect.title"),subTitle:t("blocklet.restoreFromSpaces.connect.subTitle"),onClickBack:()=>window.history.back()}),(0,R.jsx)(E.Z,{display:"flex",justifyContent:"center",children:(0,R.jsx)(ve,{sx:{marginTop:"64px",marginBottom:"32px",width:"720px"},onConnect:e=>{const t=new URL(d()(e.url,"restore")),s=d()(o,"blocklets/restore/verify-ownership");t.searchParams.set("redirectUrl",s),t.searchParams.set("locale",n),window.location.href=t.toString()}})})]})})};var be,je=n(15849),Ae=n(48208),Ze=n(88577),Ee=n(69972),Se=n(38898),Pe=n(39463),Ce=n(10032),Be=n(31853),De=n(13455),Te=n(13932),Re=n(31910),Me=n(93040);const Le=(0,h.Z)("div")(be||(be=(0,s.Z)(["\n width: 100%;\n height: 100%;\n overflow-y: auto;\n"]))),Ne="verify-app-ownership-spaces";const Oe=function(){const{session:e}=(0,Ae.T)(),[t]=(0,je.useSearchParams)(),{t:n}=(0,m.PE)(),{api:o,info:s}=(0,A.h6)(),{api:r}=(0,Ae.T)(),{meta:i}=(0,Re.J_)(),c=(0,l.useNavigate)(),p=(0,a.useMemo)((()=>s?(0,k.RU)(s):""),[s]),[u,h]=(0,Be.Z)({isRestoring:!1,isComplete:!1,isOverwrite:!1,shouldReconnect:!1,exists:!1,accessUrl:"",isConnectOpen:!1,isConfirmOpen:!1,connectData:{action:"",checkFn:()=>{},extraParams:{}},connectMessages:{}}),f=t.get("launchType"),x=t.get("nftId"),g=t.get("chainHost"),v=t.get("from"),y=t.get("blocklet_meta_url"),w=t.get("launcherSessionId")||"",b=t.get("launcherUrl")||"",j=(e=>{const t=e.split("/").filter(Boolean);return t[t.length-2]})(i.spaceEndpoint),S=(0,Pe.getServerAuthMethod)(s,f,w,e.user),P=async(t,n)=>{const o=Array.isArray(t)?t.find((e=>!!e.sessionToken)):t;null!==o&&void 0!==o&&o.sessionToken&&((0,ae.ZB)(n(o.sessionToken)),await e.refresh()),h({isConnectOpen:!1}),setTimeout((()=>{const e=new URLSearchParams({appDid:j});[{name:"launchType",value:f},{name:"nftId",value:x},{name:"from",value:v},{name:"blocklet_meta_url",value:y},{name:"chainHost",value:g}].forEach((t=>{let{name:n,value:o}=t;o&&e.set(n,o)})),c("/blocklets/restore/restore-blocklet?".concat(e.toString()))}),0)},C=async function(){var t,s,a;let l=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(!l){if(u.shouldReconnect)return void(window.location.href=d()(p,"blocklets/restore/connect-space"));if(e.user){const e=await o.getBlocklet({input:{did:j,attachRuntimeInfo:!0}});if(e.blocklet){const t=await(0,Me.DB)(e.blocklet);if(t){const n=new URL(t);"running"!==e.blocklet.status&&n.searchParams.set("__start__","1"),h({shouldReconnect:!0,exists:!0,accessUrl:n.href})}return}}}if("nft"===S){var c,m,v;const e=new URL(window.location.href);e.pathname=d()(null!==(c=null===(m=window)||void 0===m||null===(v=m.env)||void 0===v?void 0:v.apiPrefix)&&void 0!==c?c:"/","/api/did/".concat(Ne,"/token")),e.searchParams.set("appDid",j),e.searchParams.set("endpoint",i.spaceEndpoint),e.searchParams.set("referrer",window.location.href),e.searchParams.set("nftId",x),e.searchParams.set("appPid",i.did);const t={autoConnect:!1,launchType:f,nftId:x};g&&(e.searchParams.set("chainHost",g),t.chainHost=g),l&&e.searchParams.set("overwrite","1");const{data:o}=await r.get(e.href);return o.error?void V.Z.error(o.error):(t.nw=o.url,void h({isConnectOpen:!0,connectData:{action:"verify-restore-by-nft",extraParams:t},connectMessages:{title:n("blocklet.restoreFromSpaces.nftAuthDialog.title"),scan:n("blocklet.restoreFromSpaces.nftAuthDialog.scan"),confirm:n("blocklet.restoreFromSpaces.nftAuthDialog.confirm"),success:n("blocklet.restoreFromSpaces.nftAuthDialog.success")}}))}if("launcher"===S){const{launcherSession:e,error:t}=await o.getLauncherSession({input:{launcherUrl:b,launcherSessionId:w}});return void(e?h({isConnectOpen:!0,connectData:{action:Ne,extraParams:{appDid:j,appPid:i.did,endpoint:i.spaceEndpoint,referrer:window.location.href,restoreFrom:"spaces",overwrite:l?"1":void 0,launcherUrl:b,launcherSessionId:w,chainHost:g}},connectMessages:{title:n("blocklet.restoreBlocklet.verify.title"),scan:n("blocklet.restoreBlocklet.verify.scan"),confirm:n("blocklet.restoreBlocklet.verify.confirm"),success:n("blocklet.restoreBlocklet.verify.success")}}):V.Z.error("Launch session invalid: ".concat(t)))}if("session"===S)return void h({isConnectOpen:!0,connectData:{action:Ne,extraParams:{appDid:j,appPid:i.did,endpoint:i.spaceEndpoint,referrer:window.location.href,overwrite:l?"1":void 0,restoreFrom:"spaces"}},connectMessages:{title:n("blocklet.restoreBlocklet.verify.title"),scan:n("blocklet.restoreBlocklet.verify.scan"),confirm:n("blocklet.restoreBlocklet.verify.confirm"),success:n("blocklet.restoreBlocklet.verify.success")}});const y=new URL(window.location.href);y.pathname=d()(null!==(t=null===(s=window)||void 0===s||null===(a=s.env)||void 0===a?void 0:a.apiPrefix)&&void 0!==t?t:"/","/api/did/".concat(Ne,"/token")),y.searchParams.set("appDid",j),y.searchParams.set("appPid",i.did),y.searchParams.set("endpoint",i.spaceEndpoint),y.searchParams.set("referrer",window.location.href),y.searchParams.set("restoreFrom","spaces");const{data:k}=await r.get(y.href);e.login(P,{nw:k.url,openMode:"popup"})};return(0,a.useEffect)((()=>{C()}),[]),(0,R.jsxs)(Le,{children:[(0,R.jsx)(Z.Z,{title:n("blocklet.restoreBlocklet.verify.title"),subTitle:n("blocklet.restoreBlocklet.verify.subTitle"),onClickBack:()=>window.history.back()}),(0,R.jsxs)(E.Z,{textAlign:"center",mt:6,children:[(0,R.jsx)(De.Z,{blocklet:{meta:i},blockletMetaUrl:y}),(0,R.jsxs)(E.Z,{mt:2,mb:2,children:[(0,R.jsx)(J.Z,{variant:"body2",children:i.title}),(0,R.jsx)(Ee.Z,{did:j})]}),u.exists&&u.accessUrl&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(J.Z,{component:"p",variant:"body1",gutterBottom:!0,sx:{color:"orange"},children:n("blocklet.restoreBlocklet.verify.exists")}),(0,R.jsxs)(J.Z,{component:"div",sx:{marginTop:"32px"},children:[u.accessUrl&&(0,R.jsx)(B.Z,{variant:"contained",component:Se.Z,href:u.accessUrl,sx:{width:"160px",height:"100%"},children:n("blocklet.restoreBlocklet.verify.open")}),(0,R.jsx)(B.Z,{variant:"contained",color:"error",onClick:()=>{h({isConfirmOpen:!0})},sx:{width:"160px",height:"100%",marginLeft:"32px"},children:n("blocklet.restoreBlocklet.verify.overwrite")})]})]}),!u.exists&&(0,R.jsx)(B.Z,{variant:"contained",disabled:u.isConnectOpen,onClick:C,sx:{width:"180px",height:"100%"},children:n("blocklet.restoreBlocklet.verify.".concat(u.shouldReconnect?"reconnect":"verify"))})]}),u.connectData.isConnectOpen&&(0,R.jsx)(Te.Z,{appDid:j,visible:!1}),(0,R.jsx)(Ze.Z,{popup:!0,open:u.isConnectOpen,forceConnected:!1,saveConnect:!1,action:u.connectData.action,checkFn:r.get,checkTimeout:3e5,webWalletUrl:(0,ae.yP)(s),onSuccess:P,extraParams:u.connectData.extraParams,messages:u.connectMessages,onClose:()=>{h({isConnectOpen:!1})}}),u.isConfirmOpen&&(0,R.jsx)(Ce.Z,{color:"error",title:n("blocklet.restoreBlocklet.overwrite.title"),description:n("blocklet.restoreBlocklet.overwrite.description"),confirm:n("common.confirm"),onCancel:()=>{h({isConfirmOpen:!1})},onConfirm:()=>{h({isConfirmOpen:!1,isOverwrite:!0}),C(!0)}})]})};var Fe,Qe=n(70917);const Ue=(0,h.Z)(Qe.Z)(Fe||(Fe=(0,s.Z)(["\n && .result-footer {\n height: 120px;\n > div {\n flex-wrap: wrap;\n }\n }\n"])));var ze,Ge,Ie,Je=n(35266),He=n(77277),Xe=n(77429),Ke=n(75506),Ye=n.n(Ke),We=n(50482),_e=n.n(We),Ve=n(11397),qe=n.n(Ve),$e=n(11476),et=n(6202),tt=n(66436);const nt=qe()("@abtnode/webapp:restore-blocklet:step-install"),ot=(0,h.Z)("div")(ze||(ze=(0,s.Z)(["\n display: flex;\n align-items: center;\n justify-content: flex-start;\n flex-direction: column;\n width: 100%;\n height: 100%;\n overflow-y: auto;\n"]))),st=h.Z.div(Ge||(Ge=(0,s.Z)(["\n line-height: 1.4em;\n .error-desc {\n margin-top: 8px;\n word-wrap: break-word;\n color: ",";\n }\n"])),(e=>e.theme.palette.grey[500])),at={[He.RESTORE_PROGRESS_STATUS.waiting]:0,[He.RESTORE_PROGRESS_STATUS.start]:1,[He.RESTORE_PROGRESS_STATUS.importData]:2,[He.RESTORE_PROGRESS_STATUS.downloading]:3,[He.RESTORE_PROGRESS_STATUS.importDataSuccess]:4,[He.RESTORE_PROGRESS_STATUS.installing]:5,[He.RESTORE_PROGRESS_STATUS.completed]:10};const rt=(0,h.Z)(E.Z)(Ie||(Ie=(0,s.Z)(["\n padding-top: 24px;\n"]))),it=function(){var e,t,n,o;const s=new URL(window.location.href),r=s.searchParams.get("appDid"),i=s.searchParams.get("launchType"),l=s.searchParams.get("nftId"),c=s.searchParams.get("fromLauncher"),d=s.searchParams.get("from"),p=s.searchParams.get("chainHost"),u=function(e){let{appDid:t}=e;const[n,o]=(0,a.useState)(He.RESTORE_PROGRESS_STATUS.waiting),s=(0,et.ZP)();return s.connect(),(0,a.useEffect)((()=>(s.on(He.BlockletEvents.restoreProgress,(e=>{t===(null===e||void 0===e?void 0:e.appDid)&&o(e)})),()=>{s.off(He.BlockletEvents.restoreProgress)})),[t,s]),n}({appDid:r}),[h,f]=(0,a.useState)(0),x=(0,a.useRef)(null),{meta:g}=(0,Re.J_)(),{t:v}=(0,m.PE)(),{api:y,info:w}=(0,A.h6)(),[b,j]=(0,Be.Z)({nextAccessUrl:"",installError:null}),E=(0,$e.Z)(r),{status:S,eventName:P}=E,C=()=>{f(12),x.current&&(clearTimeout(x.current),x.current=null),x.current=setTimeout((()=>{y.getBlocklet({input:{did:r,attachRuntimeInfo:!0}}).then((e=>{e.blocklet&&M(e.blocklet)}))}),500)},D=()=>{var e,t;null!==E&&void 0!==E&&null!==(e=E.runtimeBlocklet)&&void 0!==e&&null!==(t=e.settings)&&void 0!==t&&t.initialized?f(11):C()},T=[v("blocklet.restoreFromSpaces.progress.waiting"),v("blocklet.restoreFromSpaces.progress.restoring"),v("blocklet.restoreFromSpaces.progress.importData"),v("blocklet.restoreFromSpaces.progress.downloading",{progress:"".concat(null!==(e=null===u||void 0===u||null===(t=u.data)||void 0===t?void 0:t.completed)&&void 0!==e?e:100,"/").concat(null!==(n=null===u||void 0===u||null===(o=u.data)||void 0===o?void 0:o.total)&&void 0!==n?n:100)}),v("blocklet.restoreFromSpaces.progress.importSuccess"),v("launchBlocklet.waiting.downloading"),v("launchBlocklet.waiting.verifying"),v("launchBlocklet.waiting.downloading"),v("launchBlocklet.waiting.extracting"),v("upgrading"===S?"common.upgrading":"launchBlocklet.waiting.installing"),v("launchBlocklet.waiting.installed"),v("launchBlocklet.waiting.starting"),v("launchBlocklet.waiting.done")];(0,a.useEffect)((()=>{if(u.status===He.RESTORE_PROGRESS_STATUS.error){const e={message:u.message,name:"restoreFailed",action:"retryRestore"};return _e()(e,b.installError)||V.Z.error($()(e)),void j({installError:e})}f(at[u.status]||0)}),[u.status]),(0,a.useEffect)((()=>{if("serverless"!==i||P!==He.BlockletEvents.nftConsumed)switch(S){case"waiting":f(6);break;case"downloading":f(7);break;case"installing":case"upgrading":f(8);break;case"installed":if("serverless"===i&&!(0,Me.MZ)(E))break;D();break;case"starting":f(11);break;case"running":f(12),C();break;case"stopped":C();break;case"corrupted":case"error":{var e;null===E||void 0===E||E.stopPolling();const t={message:null===E||void 0===E||null===(e=E.error)||void 0===e?void 0:e.message,name:null===E||void 0===E?void 0:E.eventName,action:"retryRestore"},n=function(){var e;let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};!_e()(t,b.installError)&&null!==E&&void 0!==E&&null!==(e=E.error)&&void 0!==e&&e.message&&V.Z.error($()(E.error)),j({installError:t,...n})};y.getBlocklet({input:{did:r,attachRuntimeInfo:!0}}).then((e=>{var o;let{blocklet:s}=e;null!==s&&void 0!==s&&null!==(o=s.settings)&&void 0!==o&&o.initialized&&(t.action="retryStart"),n()})).catch((()=>{n()}))}}else D()}),[S,P,E]);const M=async e=>{const t=await(0,Me.DB)(e);if(Ye()(t))return;const n=new URL(t);n.searchParams.set("serverUrl",(0,k.RU)(w)),"running"!==e.status&&n.searchParams.set("__start__","1"),c&&n.searchParams.set("fromLauncher",c),d&&n.searchParams.set("from",d),i&&n.searchParams.set("launchType",i),l&&n.searchParams.set("nftId",l),p&&n.searchParams.set("chainHost",p),null===E||void 0===E||E.stopPolling(),j({nextAccessUrl:n.href,status:e.status,resultMessage:"running"===e.status?{variant:"success",title:v("blocklet.restoreFromSpaces.restore.completeTitle"),subTitle:"",footer:v("common.open")}:{variant:"info",title:v("blocklet.restoreFromSpaces.restore.installedTitle"),subTitle:v("blocklet.restoreFromSpaces.restore.installedSubTitle"),footer:v("common.configuration")}})};if(b.installError){const e={retryRestore:(0,R.jsx)(B.Z,{variant:"contained",className:"bottom-button","data-cy":"retry-install",component:je.Link,to:"/blocklets/restore/verify-ownership".concat(window.location.search),children:v("common.retry")}),retryStart:(0,R.jsx)(B.Z,{variant:"contained",className:"bottom-button","data-cy":"retry-start",onClick:()=>(async()=>{j({installError:null,nextAccessUrl:""}),await y.startBlocklet({input:{did:r}}),null===E||void 0===E||E.startPolling()})(),children:v("common.retry")})},t=b.installError.name?b.installError.name.replace("blocklet.",""):"installFailed";return(0,R.jsx)(Ue,{variant:"error",title:null===g||void 0===g?void 0:g.title,subTitle:(0,R.jsxs)(st,{children:[(0,R.jsx)("div",{children:v("launchBlocklet.error.".concat(t))}),b.installError.message&&(0,R.jsx)("div",{className:"error-desc",children:v("common.errorMessage")+b.installError.message})]}),footer:(0,R.jsxs)(rt,{children:[e[b.installError.action],"serverless"===i&&(0,R.jsx)("div",{style:{marginTop:"24px"},dangerouslySetInnerHTML:{__html:v("blocklet.restoreFromSpaces.restore.support",{communityLink:"https://community.arcblock.io/",supportEmail:"launcher@arcblock.io"})}})]})})}const L=!!b.nextAccessUrl;return nt("render",{status:S,eventName:P,launchType:i,runtimeBlockletState:E,state:b}),(0,R.jsxs)(ot,{children:[!L&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(Z.Z,{title:v("blocklet.restoreBlocklet.restore.title"),subTitle:v("blocklet.restoreFromSpaces.restore.subTitle")}),(0,R.jsxs)(tt.Z,{children:[(0,R.jsx)(Je.Z,{increaseSpeed:.3,messageLoop:!1,message:(0,R.jsx)(Xe.Z,{steps:T,stepIndex:h,autoGrowth:10===h?1e3:4e3})}),[5,7,8].includes(h)&&(0,R.jsx)(Te.Z,{appDid:r})]})]}),L&&(0,R.jsx)(Ue,{variant:b.resultMessage.variant,title:b.resultMessage.title,subTitle:b.resultMessage.subTitle,footer:(0,R.jsx)(rt,{children:(0,R.jsx)(B.Z,{variant:"contained",style:{width:"200px"},component:Se.Z,href:b.nextAccessUrl,children:b.resultMessage.footer})})})]})};const lt=function(){return(0,R.jsx)(it,{})};var ct,dt,pt,ut=n(23484);function ht(){const e=(0,u.Z)((e=>e.breakpoints.down("md"))),{t:t,locale:n}=(0,m.PE)(),{info:o}=(0,A.h6)(),s=(0,ut.Z)(),{meta:r}=(0,Re.J_)(),c=(0,a.useMemo)((()=>o?(0,k.RU)(o):""),[o]),h=(0,b.yP)(o),Z=d()((0,b.Y5)(),"/blocklets/restore"),E=[{key:"verify-ownership",name:t("blocklet.restoreBlocklet.verify.title"),path:d()(Z,"verify-ownership")},{key:"restore-blocklet",name:t("blocklet.restoreFromSpaces.restore.title"),path:d()(Z,"restore-blocklet")}];let S=[];S="launcher"===i()(s.get("from"))?[{key:"purchase-space",name:t("launchBlocklet.steps.purchaseSpace")},{key:"prepare-space",name:t("launchBlocklet.steps.prepareSpace")},...E]:[{key:"connect-space",name:t("blocklet.restoreFromSpaces.connect.title"),path:d()(Z,"connect-space")},{key:"select-blocklet",name:t("blocklet.restoreFromSpaces.selectBlocklet.title")},...E];const P=(0,R.jsx)(xt,{className:"".concat(c?"logo-can-click":""),children:(0,R.jsx)(w.Z,{onClick:()=>{c&&window.open(c)},logo:e?(0,R.jsx)(v.Z,{width:"32",height:"32"}):(0,R.jsx)(y.Z,{width:"128",height:"48"})})});return(0,R.jsx)(x.W,{steps:S,children:(0,R.jsx)(f.Z,{blockletMeta:r,locale:n,useOfSkeleton:!1,navLogo:P,navSubTitle:t("blocklet.restoreFromSpaces.navSubTitle"),loading:!1,headerEndAddons:(0,R.jsx)(g.Z,{webWalletUrl:h,SessionContext:j.B3}),pcWidth:"80%",style:{height:"100%"},logoUrl:null===r||void 0===r?void 0:r.logo,children:(0,R.jsxs)(ft,{children:[(0,R.jsx)(p.Global,{styles:mt}),(0,R.jsxs)(l.Routes,{children:[(0,R.jsx)(l.Route,{path:"connect-space",element:(0,R.jsx)(ke,{})}),(0,R.jsx)(l.Route,{path:"verify-ownership",element:(0,R.jsx)(Oe,{})}),(0,R.jsx)(l.Route,{path:"restore-blocklet",element:(0,R.jsx)(lt,{})}),(0,R.jsx)(l.Route,{path:"*",element:(0,R.jsx)(l.Navigate,{to:"connect-space",replace:!0})})]})]})})})}const mt=(0,p.css)(ct||(ct=(0,s.Z)(["\n html,\n body,\n #root,\n #root > .wrapper {\n height: 100%;\n }\n"]))),ft=h.Z.div(dt||(dt=(0,s.Z)(["\n "," {\n padding-top: 34px;\n }\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"])),(e=>e.theme.breakpoints.up("md"))),xt=h.Z.div(pt||(pt=(0,s.Z)(["\n margin-top: -1px;\n &.logo-can-click {\n cursor: pointer;\n }\n"])));var gt,vt,yt,wt=n(83294),kt=n(72333),bt=n(25710);function jt(e){let{onSelect:t}=e;const{api:n}=(0,A.h6)(),{t:o,locale:s}=(0,m.PE)(),[r,i]=(0,a.useState)(!1),[c,d]=(0,a.useState)([]),[p,u]=(0,a.useState)(""),[h,f]=(0,a.useState)(null),x=(0,l.useNavigate)();(0,a.useEffect)((()=>{(async()=>{try{i(!0),f(!1);const{getBlocklets:{blocklets:e},getBlockletsFromBackup:{backups:t}}=await n.doBatchQuery({getBlocklets:{input:{}},getBlockletsFromBackup:{input:{}}});d((t||[]).filter((t=>!(e||[]).some((e=>{var n;return t.appPid===(null===(n=e.meta)||void 0===n?void 0:n.did)})))).sort(((e,t)=>t.createdAt-e.createdAt)).slice(0,200)),i(!1)}catch(e){i(!1),f(e.message)}})()}),[]);let g=null;return g=h?(0,R.jsx)(he.Z,{type:"error",style:{width:"100%",marginTop:8},children:h}):r?(0,R.jsx)(de.Z,{size:16}):c.length?(0,R.jsx)(Zt,{children:c.map((e=>(0,R.jsxs)(Et,{className:"middle-font-size space ".concat(p===e.appDid?"selected":""),onClick:()=>(e=>{u(e.appDid)})(e),children:[(0,R.jsxs)("div",{className:"left",children:[(0,R.jsx)("div",{className:"header",children:(0,R.jsx)(E.Z,{sx:{width:40,height:40},children:(0,R.jsx)(kt.Z,{did:e.appDid,size:40})})}),(0,R.jsxs)("div",{className:"body",children:[(0,R.jsx)(J.Z,{className:"text",children:e.name}),(0,R.jsx)(J.Z,{className:"text middle-font-size",children:(0,R.jsx)(Ee.Z,{responsive:!1,compact:!0,inline:!0,copyable:!1,size:12,did:e.appDid})})]}),(0,R.jsxs)(E.Z,{color:"text.secondary",className:"footer small-font-size",children:[o("blocklet.restoreFromServer.backupIn")," ",(0,b.B2)(e.createdAt,s)]})]}),(0,R.jsx)("div",{className:"right",children:(0,R.jsx)("div",{className:"more",children:(0,R.jsx)(K.Z,{onClick:()=>{},className:"more-btn",size:"large","aria-label":"more functions",children:(0,R.jsx)(wt.Z,{color:"disabled"})})})}),(0,R.jsx)("div",{className:"selected-container",children:(0,R.jsx)(D.default,{className:"selected-icon"})})]},e.appDid)))}):(0,R.jsx)(bt.Z,{children:o("common.empty")}),(0,R.jsxs)(At,{style:{width:"100%"},children:[(0,R.jsx)(Z.Z,{title:o("blocklet.restoreFromServer.selectTitle"),subTitle:o("blocklet.restoreFromServer.description")}),(0,R.jsx)(E.Z,{mt:4,mx:3,className:"main-body",children:g}),(0,R.jsx)(E.Z,{className:"main-footer",display:"flex",justifyContent:"center",children:(0,R.jsx)(B.Z,{sx:{width:"180px",height:"100%"},onClick:e=>{e.stopPropagation(),(()=>{const e=c.find((e=>e.appDid===p));t({did:e.appDid,name:e.appDid,title:e.name});const n=new URL(window.location.href);n.searchParams.set("appDid",e.appDid),n.searchParams.set("appName",e.name),x("/blocklets/restore/verify-ownership".concat(n.search))})()},color:"primary","data-cy":"install-blocklet-next-step",variant:"contained",disabled:r||h||!p,children:o("common.restore")})})]})}jt.defaultProps={onSelect:()=>{}};const At=(0,h.Z)(E.Z)(gt||(gt=(0,s.Z)(["\n .main-body {\n height: 50vh;\n "," {\n height: 80vh;\n }\n\n overflow: auto;\n }\n .main-footer {\n padding-top: 24px;\n padding-bottom: 24px;\n "," {\n position: fixed;\n bottom: 16px;\n width: 100%;\n padding-bottom: 0;\n }\n }\n"])),(e=>e.theme.breakpoints.down("md")),(e=>e.theme.breakpoints.down("md"))),Zt=(0,h.Z)(E.Z)(vt||(vt=(0,s.Z)(["\n display: block;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n max-width: 1000px;\n margin: 0 auto;\n\n .space {\n display: flex;\n margin: 8px auto;\n\n .selected-container {\n position: absolute;\n right: 0px;\n bottom: 0px;\n display: flex;\n -webkit-box-pack: end;\n justify-content: flex-end;\n align-items: flex-end;\n width: 30px;\n height: 30px;\n border-radius: 0px 0px 7px;\n color: rgb(255, 255, 255);\n overflow: hidden;\n transition: all 0.3s ease 0s;\n\n &::after {\n position: absolute;\n z-index: 0;\n left: 30px;\n top: 30px;\n display: block;\n width: 0px;\n height: 0px;\n border-width: 15px;\n border-style: solid;\n /* border-color: transparent rgb(29, 193, 199) rgb(29, 193, 199) transparent; */\n border-color: transparent ","\n "," transparent;\n transition: all 0.1s ease 0s;\n content: '';\n }\n\n .selected-icon {\n visibility: hidden;\n width: 60%;\n height: 60%;\n position: relative;\n z-index: 2;\n margin: 0px 1px 1px 0px;\n font-size: 16px;\n transition: all 0.2s ease 0s;\n }\n }\n }\n\n .space.selected {\n background-color: rgb(236, 251, 253);\n border-color: rgb(236, 251, 253);\n\n .selected-container {\n &::after {\n left: 0px;\n top: 0px;\n }\n\n .selected-icon {\n visibility: visible;\n }\n }\n }\n"])),(e=>e.theme.palette.primary.main),(e=>e.theme.palette.primary.main)),Et=(0,h.Z)("div")(yt||(yt=(0,s.Z)(["\n display: flex;\n position: relative;\n width: 100%;\n padding: 10px;\n border: 1 solid #ccc;\n cursor: pointer;\n\n .left {\n display: flex;\n align-items: flex-start;\n width: 100%;\n margin: 0px 20px 0px 0px;\n\n .header {\n padding: 5px 16px 0 0;\n }\n\n .body {\n display: flex;\n flex-direction: column;\n width: 100%;\n }\n\n .footer {\n display: flex;\n align-items: center;\n flex-shrink: 0;\n height: 100%;\n }\n }\n\n .right {\n display: flex;\n }\n\n "," {\n .left {\n display: flex;\n flex-direction: column;\n margin-right: 20px;\n\n .header {\n display: none;\n }\n\n .footer {\n margin-top: 6px;\n margin-left: 0px;\n padding: 2px 0px;\n height: auto;\n }\n }\n\n .right {\n width: auto;\n }\n\n .text {\n display: -webkit-box;\n overflow: hidden;\n -webkit-box-orient: vertical;\n }\n }\n\n // \u516c\u5171\u5c5e\u6027\n .middle-font-size {\n font-size: 14px;\n }\n\n .small-font-size {\n font-size: 12px;\n }\n"])),(e=>e.theme.breakpoints.down("md")));var St,Pt=n(95712);const Ct=(0,h.Z)("div")(St||(St=(0,s.Z)(["\n width: 100%;\n height: 100%;\n overflow-y: auto;\n"]))),Bt="verify-app-ownership-disk";const Dt=function(){const e=new URL(window.location.href),t=e.searchParams.get("appDid"),n=e.searchParams.get("appName"),{t:o}=(0,m.PE)(),{api:s,info:r}=(0,A.h6)(),{session:i,api:l}=(0,Ae.T)(),c=(0,a.useMemo)((()=>r?(0,k.RU)(r):""),[r]),[p,u]=(0,Be.Z)({isRestoring:!1,isComplete:!1,connectData:{isConnectOpen:!1,action:"",checkFn:()=>{},extraParams:{}}}),h=()=>{u({connectData:{isConnectOpen:!1}}),setTimeout((()=>{const e=new URL(d()(c,"blocklets/restore/restore-blocklet".concat(window.location.search)));window.location.href=e.href}),0)},f=async()=>{if(i.user)await(async()=>{if((await s.getBlocklet({input:{did:t}})).blocklet)return V.Z.error("Blocklet ".concat(n,"(").concat(t,") already exists")),void u({shouldReconnect:!0});u({connectData:{isConnectOpen:!0,action:Bt,extraParams:{appDid:t,restoreFrom:"disk"}}})})();else{var e,o,a;const n=new URL(window.location.href);n.pathname=d()(null!==(e=null===(o=window)||void 0===o||null===(a=o.env)||void 0===a?void 0:a.apiPrefix)&&void 0!==e?e:"/","/api/did/".concat(Bt,"/token")),n.searchParams.set("appDid",t),n.searchParams.set("restoreFrom","disk");const{data:s}=await l.get(n.href);i.login(h,{nw:s.url,openMode:"popup"})}};return(0,a.useEffect)((()=>{f()}),[]),(0,R.jsxs)(Ct,{children:[(0,R.jsx)(Z.Z,{title:o("blocklet.restoreBlocklet.verify.title"),subTitle:o("blocklet.restoreBlocklet.verify.subTitle")}),(0,R.jsxs)(E.Z,{textAlign:"center",mt:6,children:[(0,R.jsx)(Pt.Z,{did:t,size:128}),(0,R.jsxs)(E.Z,{mt:2,mb:2,children:[(0,R.jsx)(J.Z,{variant:"body2",children:n}),(0,R.jsx)(Ee.Z,{did:t})]}),(0,R.jsx)(B.Z,{variant:"contained",disabled:p.connectData.isConnectOpen,onClick:f,sx:{width:"180px",height:"100%"},children:o("blocklet.restoreBlocklet.verify.".concat(p.shouldReconnect?"reconnect":"verify"))})]}),p.connectData.isConnectOpen&&(0,R.jsx)(Te.Z,{appDid:t,visible:!1}),(0,R.jsx)(Ze.Z,{popup:!0,open:p.connectData.isConnectOpen,forceConnected:!1,saveConnect:!1,action:p.connectData.action,checkFn:l.get,checkTimeout:3e5,webWalletUrl:(0,ae.yP)(r),onSuccess:h,extraParams:p.connectData.extraParams,messages:{title:o("blocklet.restoreBlocklet.verify.title"),scan:o("blocklet.restoreBlocklet.verify.scan"),confirm:o("blocklet.restoreBlocklet.verify.confirm"),success:o("blocklet.restoreBlocklet.verify.success")},onClose:()=>{u({connectData:{isConnectOpen:!1}})}})]})};var Tt,Rt,Mt;function Lt(){const e=(0,u.Z)((e=>e.breakpoints.down("md"))),{t:t,locale:n}=(0,m.PE)(),{info:o}=(0,A.h6)(),{meta:s,setMeta:r}=(0,a.useState)({}),i=(0,a.useMemo)((()=>o?(0,k.RU)(o):""),[o]),c=(0,b.yP)(o),h=d()((0,b.Y5)(),"/blocklets/restore"),Z=[{key:"select",name:t("blocklet.restoreFromServer.selectTitle"),path:d()(h,"select")},{key:"verify-ownership",name:t("blocklet.restoreBlocklet.verify.title"),path:d()(h,"verify-ownership")},{key:"restore-blocklet",name:t("blocklet.restoreBlocklet.restore.title"),path:d()(h,"restore-blocklet")}],E=(0,R.jsx)(Ft,{className:"".concat(i?"logo-can-click":""),children:(0,R.jsx)(w.Z,{onClick:()=>{i&&window.open(i)},logo:e?(0,R.jsx)(v.Z,{width:"32",height:"32"}):(0,R.jsx)(y.Z,{width:"128",height:"48"})})});return(0,R.jsx)(x.W,{steps:Z,children:(0,R.jsx)(f.Z,{blockletMeta:{...s,registryUrl:""},locale:n,useOfSkeleton:!1,navLogo:E,headerEndAddons:(0,R.jsx)(g.Z,{webWalletUrl:c,SessionContext:j.B3}),pcWidth:"80%",style:{height:"100%"},logoUrl:null===s||void 0===s?void 0:s.logo,children:(0,R.jsxs)(Ot,{children:[(0,R.jsx)(p.Global,{styles:Nt}),(0,R.jsxs)(l.Routes,{children:[(0,R.jsx)(l.Route,{path:"select",element:(0,R.jsx)(jt,{onSelect:r})}),(0,R.jsx)(l.Route,{path:"verify-ownership",element:(0,R.jsx)(Dt,{})}),(0,R.jsx)(l.Route,{path:"restore-blocklet",element:(0,R.jsx)(lt,{})}),(0,R.jsx)(l.Route,{path:"*",element:(0,R.jsx)(l.Navigate,{to:"select".concat(window.location.search),replace:!0})})]})]})})})}const Nt=(0,p.css)(Tt||(Tt=(0,s.Z)(["\n html,\n body,\n #root,\n #root > .wrapper {\n height: 100%;\n }\n"]))),Ot=h.Z.div(Rt||(Rt=(0,s.Z)(["\n "," {\n padding-top: 34px;\n }\n width: 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"])),(e=>e.theme.breakpoints.up("md"))),Ft=h.Z.div(Mt||(Mt=(0,s.Z)(["\n margin-top: -1px;\n &.logo-can-click {\n cursor: pointer;\n }\n"])));function Qt(){const{search:e}=window.location;return e.includes("restoreFrom=server")?(0,R.jsx)(Lt,{}):(0,R.jsx)(ht,{})}},12332:(e,t,n)=>{"use strict";n.d(t,{Z:()=>d});var o,s,a=n(71171),r=n(55898),i=n.n(r),l=n(33518),c=n(96266);function d(e){let{logo:t,name:n,subname:o,previousData:s,...a}=e,r=(0,c.jsx)(p,{logo:t}),i=n,l=o;return s.logo&&(r=(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(p,{logo:t,className:"left-fade-in-ele"}),(0,c.jsx)(p,{logo:s.logo,className:"postion-abs left-fade-out-ele"})]})),s.name&&s.name!==n&&(i=(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)("span",{className:"right-fade-in-ele",style:{display:"inline-block"},children:n}),(0,c.jsx)("span",{className:"postion-abs right-fade-out-ele",children:s.name})]})),s.subname&&s.subname!==o&&(l=(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)("span",{className:"right-fade-in-ele",style:{display:"inline-block"},children:o}),(0,c.jsx)("span",{className:"postion-abs right-fade-out-ele",children:s.subname})]})),(0,c.jsx)(h,{...a,children:(0,c.jsxs)("div",{className:"logo-inner",children:[(0,c.jsx)("div",{className:"logo-img-content",children:r}),(0,c.jsxs)("div",{className:"logo-info ".concat(n||o?"":"zero-left"),children:[(0,c.jsx)("div",{className:"logo-name",children:i}),(0,c.jsx)("div",{className:"logo-subname",children:l})]})]})})}function p(e){let{logo:t,...n}=e;return(0,c.jsx)(u,{...n,children:t})}d.propTypes={logo:i().element.isRequired,name:i().string,subname:i().string,previousData:i().object},d.defaultProps={name:"",subname:"",previousData:{logo:"",name:"",subname:""}};const u=l.Z.div(o||(o=(0,a.Z)(["\n display: block;\n > * {\n display: block;\n }\n"]))),h=l.Z.div(s||(s=(0,a.Z)(["\n position: relative;\n display: block;\n\n .logo-inner {\n display: flex;\n align-items: center;\n height: 100%;\n .logo-img-content {\n position: relative;\n display: block;\n }\n .logo-info {\n display: flex;\n flex-direction: column;\n justify-content: center;\n margin-left: 10px;\n letter-spacing: 0.1px;\n &.zero-left {\n margin-left: 0%;\n }\n .logo-name {\n position: relative;\n line-height: 16px;\n font-size: 16px;\n color: #121319;\n }\n .logo-subname {\n position: relative;\n line-height: 13px;\n font-size: 13px;\n color: #7d8085;\n }\n }\n }\n\n .postion-abs {\n position: absolute;\n left: 0;\n top: 0;\n height: 100%;\n }\n\n .right-fade-out-ele {\n animation: right-fade-out ease 0.5s;\n animation-delay: 2s;\n animation-fill-mode: forwards;\n }\n\n .right-fade-in-ele {\n animation: right-fade-in ease 0.5s;\n animation-delay: 2s;\n animation-fill-mode: both;\n }\n\n @keyframes right-fade-out {\n 0% {\n opacity: 1;\n transform: translate(0, 0);\n }\n 100% {\n opacity: 0;\n transform: translate(8px, 0);\n }\n }\n\n @keyframes right-fade-in {\n 0% {\n opacity: 0;\n transform: translate(8px, 0);\n }\n 100% {\n opacity: 1;\n transform: translate(0, 0);\n }\n }\n\n .left-fade-out-ele {\n animation: left-fade-out ease 0.5s;\n animation-delay: 2s;\n animation-fill-mode: forwards;\n }\n\n .left-fade-in-ele {\n animation: left-fade-in ease 0.5s;\n animation-delay: 2s;\n animation-fill-mode: both;\n }\n\n @keyframes left-fade-out {\n 0% {\n opacity: 1;\n transform: translate(0, 0);\n }\n 100% {\n opacity: 0;\n transform: translate(-8px, 0);\n }\n }\n\n @keyframes left-fade-in {\n 0% {\n opacity: 0;\n transform: translate(-8px, 0);\n }\n 100% {\n opacity: 1;\n transform: translate(0, 0);\n }\n }\n"])))},80676:(e,t,n)=>{"use strict";n.d(t,{hi:()=>a,od:()=>s.a});var o=n(10458),s=n.n(o);s().defaults.timeout=1e4;const a=s().create()},96567:(e,t,n)=>{"use strict";n.d(t,{EJ:()=>v,Jf:()=>g,LQ:()=>p,Nb:()=>u,UV:()=>y,Xv:()=>c,Z3:()=>w,ag:()=>m,mo:()=>h,nD:()=>d,nU:()=>x,w2:()=>f});var o=n(82434),s=n.n(o),a=n(77277),r=n(65873),i=n(2842),l=n(80676);function c(e){const t=e.replace(/\/api\/space\/.+/,""),n=e.replace(/\/$/,"").split("/"),o=n.at(-4),s=n.at(-2);return(0,i.xn)(t,"space",o,"apps",s,"explorer?key=/apps/".concat(s,"/.did-objects/").concat(s,"/"))}function d(e){const t=e.replace(/\/api\/space\/.+/,""),n=e.replace(/\/$/,"").split("/").at(-4);return(0,i.xn)(t,"space",n)}function p(e){return e.replace(/\/$/,"").split("/").at(-4)}async function u(e){try{if(!s()(e))return!1;const{headers:t}=await l.hi.head(e,{timeout:5e3});return"true"===t["x-listable"]&&"true"===t["x-readable"]&&"true"===t["x-writeable"]}catch(t){return console.error(t),!1}}function h(e){var t;return(null===e||void 0===e||null===(t=e.find((e=>e.key===a.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT)))||void 0===t?void 0:t.value)||""}function m(e){const t=new URL(e);return(0,i.xn)(t.origin,t.pathname)}async function f(e){try{if(!s()(e))return!1;const t=m(e),n=(0,i.xn)(t,"space/api/did/one-click-authorization/token"),{status:o,data:a}=await l.hi.get(n,{timeout:5e3});return 200===o&&(0,r.isObject)(a)}catch(t){return console.error(t),!1}}async function x(e){let{timeout:t}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{timeout:3e3};try{if(!s()(e))return"";const{headers:n}=await l.hi.head(e,{timeout:t}),o=n["x-space-name"];return o?decodeURIComponent(o):""}catch(n){return console.error(n),""}}function g(e){const t=e.replace(/\/api\/space\/.+/,""),n=e.replace(/\/$/,"").split("/").at(-4);return(0,i.xn)(t,"/api/space/nft/display?spaceDid=".concat(n))}const v=e=>{var t;return(null===e||void 0===e||null===(t=e.configs)||void 0===t||null===(t=t.find((e=>e.key===a.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_SPACE_ENDPOINT)))||void 0===t?void 0:t.value)||null};async function y(e){const t={};return t.did=p(e),t.name=await x(e),t.url=function(e){return null===e||void 0===e?void 0:e.replace(/\/api\/space\/.+/,"")}(e),t.endpoint=e,t}async function w(e){var t;let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{timeout:3e4,withSearchParams:!0};if(!(0,r.isString)(e))throw new Error("url(".concat(e,") must be a string"));const o=e.startsWith("http")?e:"https://".concat(e),s=new URL(o),{data:a}=await l.hi.get((0,i.xn)(s.origin,"/__blocklet__.js?type=json"),{timeout:n.timeout}),c=null===(t=a.componentMountPoints.findLast((e=>"z8iZnaYxnkMD5AKRjTKiCb8pQr1ut8UantAcf"===e.did)))||void 0===t?void 0:t.mountPoint;if(!c)throw new Error("MountPoint(".concat(c,") not found"));const d=(0,i.xn)(s.origin,c);return n.withSearchParams&&s.searchParams.get("spaceDid")?(0,i.xn)(d,"?spaceDid=".concat(s.searchParams.get("spaceDid"))):d}},35701:(e,t,n)=>{"use strict";t.Z=void 0;(o=n(5057))&&o.__esModule;var o,s=n(96266);function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function r(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?a(Object(n),!0).forEach((function(t){i(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):a(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function i(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,t||"default");if("object"!=typeof o)return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var l=function(e){return(0,s.jsx)("svg",r(r({},e),{},{children:(0,s.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7.361 2.4a.8.8 0 0 0-.728.469L.873 15.54a.8.8 0 0 0-.072.33V27.393a.8.8 0 0 0 .8.8h28.8a.8.8 0 0 0 .8-.8v-11.52a.8.8 0 0 0-.072-.331L25.37 2.869a.8.8 0 0 0-.728-.47H7.361zm-4.96 14.4v9.792h27.2v-9.799a.814.814 0 0 1-.104.007h-7.098l-2.066 3.1a.8.8 0 0 1-.666.356h-8.064a.8.8 0 0 1-.665-.356L8.87 16.8h-6.47zm26.816-1.6H21.97a.8.8 0 0 0-.665.356l-2.067 3.1h-7.208l-2.066-3.1a.8.8 0 0 0-.666-.356H2.785L7.876 4h16.25l5.09 11.2z",fill:"currentColor"})}))};l.defaultProps={width:"32",height:"32",viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg"},l.displayName="empty";t.Z=l},25710:(e,t,n)=>{"use strict";n.d(t,{Z:()=>h});var o,s=n(71171),a=n(55898),r=n.n(a),i=n(39948),l=n(35701),c=n(47685),d=n(96266);const p=(0,c.zo)(i.Z)(o||(o=(0,s.Z)(["\n display: flex;\n justify-content: center;\n align-items: center;\n flex-direction: column;\n height: 100%;\n min-height: 100px;\n color: #999;\n .empty-icon {\n margin: 10px 0;\n }\n"])));function u(e){let{color:t,size:n,children:o,...s}=e;return(0,d.jsxs)(p,{...s,children:[(0,d.jsx)(l.Z,{style:{width:n,height:n,color:t},className:"empty-icon"}),(0,d.jsx)(i.Z,{className:"empty-content",children:o})]})}u.propTypes={color:r().string,size:r().number,children:r().any},u.defaultProps={color:"inherit",size:36,children:null};const h=u},47595:(e,t,n)=>{"use strict";var o=n(71600);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var s=o(n(56930)),a=n(96266);t.default=(0,s.default)((0,a.jsx)("path",{d:"M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6zM8 9h8v10H8zm7.5-5-1-1h-5l-1 1H5v2h14V4z"}),"DeleteOutline")},94552:(e,t,n)=>{"use strict";var o=n(71600);t.Z=void 0;var s=o(n(56930)),a=n(96266);t.Z=(0,s.default)((0,a.jsx)("path",{d:"M19 19H5V5h7V3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2v-7h-2zM14 3v2h3.59l-9.83 9.83 1.41 1.41L19 6.41V10h2V3z"}),"Launch")},83294:(e,t,n)=>{"use strict";var o=n(71600);t.Z=void 0;var s=o(n(56930)),a=n(96266);t.Z=(0,s.default)((0,a.jsx)("path",{d:"M12 8c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2m0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2"}),"MoreVert")},53616:(e,t,n)=>{var o=n(26849);e.exports=function(e){return o(e).toLowerCase()}}}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_abtnode_webapp=self.webpackChunk_abtnode_webapp||[]).push([[833],{56742:(e,n,i)=>{const{toBuffer:t,toAddress:o,toBase58:r,toHex:a}=i(49394),{base32:s}=i(46422);e.exports={encode:e=>{if(!e)return e;const n=t(o(e));return s.encode(n)},decode:e=>{if(!e)return e;const n=s.decode(e),i=r(n);return i.length>30?i:a(n)}}},27472:(e,n,i)=>{const t=i(6352),o=i(94874),r="z2qaGosS3rZ7m5ttP3Nd4V4qczR9TryTcRV4p";e.exports={DID_DOMAIN_SERVICE_DID:r,getDidDomainServiceURL:async e=>{var n;if(!e||null===e||void 0===e||!e.trim())return null;const i=new URL(e);i.pathname="__blocklet__.js",i.searchParams.set("type","json");const{data:a}=await o.get(i.toString()),s=null===a||void 0===a||null===(n=a.componentMountPoints)||void 0===n?void 0:n.find((e=>e.did===r)),l=new URL(e);l.pathname=null===s||void 0===s?void 0:s.mountPoint;const d=l.toString(),c=t(d,"/api");return{base:d,api:c,domain:t(c,"/domains")}}}},44543:(e,n,i)=>{const t=i(57156);e.exports=(e,n)=>t(e)===t(n)},60501:(e,n,i)=>{"use strict";i.d(n,{Z:()=>x});var t,o=i(71171),r=i(5057),a=i(55898),s=i.n(a),l=i(33518),d=i(67680),c=i(61533),m=i(74490),u=i(45267),p=i(46954),h=i(44067),f=i(96266);function x(e){let{actions:n,size:i,...t}=e;const[o,a]=(0,r.useState)(null),s=Boolean(o),l=e=>{try{e.stopPropagation(),e.preventDefault()}catch{}a(null)};return(0,f.jsxs)(g,{...t,children:[(0,f.jsx)(d.Z,{"aria-label":"more","aria-controls":"actions-menu","aria-haspopup":"true","data-cy":"actions-menu-icon",onClick:e=>{try{e.stopPropagation(),e.preventDefault()}catch{}a(e.currentTarget)},size:i,children:(0,f.jsx)(u.Z,{})}),(0,f.jsx)(c.Z,{id:"actions-menu","data-cy":"actions-menu",anchorEl:o,keepMounted:!0,open:s,onClose:l,slotProps:{paper:{}},children:n.map(((e,n)=>{if("function"===typeof e)return e({close:l});const{icon:i,text:t,onClick:o,disabled:a=!1,...s}=e;return(0,r.createElement)(m.Z,{...s,disabled:a,dense:!0,onClick:async e=>{await o(e),l()},key:n,"data-cy":"actions-menu-".concat(n)},(0,f.jsx)(p.Z,{style:{minWidth:24,marginRight:8},children:i}),(0,f.jsx)(h.Z,{primary:t}))}))})]})}x.propTypes={actions:s().array,size:s().oneOf(["small","medium","large"])},x.defaultProps={actions:[],size:"small"};const g=l.Z.div(t||(t=(0,o.Z)([""])))},40833:(e,n,i)=>{"use strict";i.r(n),i.d(n,{default:()=>Ge});var t=i(71171),o=i(28726),r=i(33518),a=i(5057),s=i(17655),l=i(76720),d=i(64886),c=i(68420),m=i(19778),u=i(38242),p=i(11750),h=i(33650),f=i(22324),x=i(69972),g=i(64387),v=i(30746),y=i(47791),j=i(55898),b=i.n(j),D=i(44919),Z=i(76416),k=i(93938),C=i(39948),P=i(38763),S=i(75392),w=i(67680),T=i(11819),R=i(75239),E=i(96366),I=i(15715),A=i(56742),_=i(49714),N=i(18067),q=i(25710),F=i(44846),z=i(73881),L=i(74511),B=i(88574),O=i(86229),W=i(77277),M=i(10032),H=i(96266);const U=e=>["waiting","creating","renewaling"].includes(e);function K(e){var n,i;const{t:t}=(0,c.PE)(),[o,r]=(0,a.useState)(!1),{inService:s}=(0,f.h6)(),[l,d]=(0,a.useState)(null),{siteId:m,domain:u,onAdd:p,children:x,did:g}=e,[v,y]=(0,a.useState)(!1),{api:j,ws:{useSubscription:b}}=(0,f.h6)(),{mode:D,actions:{refreshDomainStatus:Z}}=(0,h.y0)(),k=(0,L.Z)((async()=>{const{cert:e}=await j.findCertificateByDomain({input:{domain:u,did:g}});return e})),C=(e,n)=>{e.domain===u&&(y(!1),r(!1),s&&"setup"!==D&&("success"===n?O.Z.success(t("setup.domain.genCertSuccess",{domain:e.domain})):"error"===n&&O.Z.error(t("setup.domain.genCertFailed",{domain:e.domain,message:e.message}))))};if((0,a.useEffect)((()=>{var e;k.loading||y(U(null===(e=k.value)||void 0===e?void 0:e.status))}),[k.loading,null===(n=k.value)||void 0===n?void 0:n.status]),b(W.BlockletEvents.certError,(e=>C(e,"error"))),b(W.BlockletEvents.certIssued,(e=>{k.retry(),Z(e.domain),C(e,"success")})),k.loading)return"";if("normal"===(null===(i=k.value)||void 0===i?void 0:i.status))return"";const P={title:t("router.cert.genLetsEncryptCert.title"),description:(0,H.jsxs)("div",{children:[(0,H.jsx)(B.Z,{type:"success",children:t("router.cert.genLetsEncryptCert.dnsTip")}),t("router.cert.genLetsEncryptCert.description")]}),confirm:t("common.confirm"),onConfirm:async()=>{r(!0);try{await j.issueLetsEncryptCert({input:{siteId:m,domain:u,did:g,inBlockletSetup:"setup"===D}}),p(),y(!0)}catch(e){console.error(e),y(!1)}finally{r(!1),d(null)}},onCancel:()=>{r(!1),d(null)}};return(0,H.jsxs)(H.Fragment,{children:[v?(0,H.jsx)(R.Z,{title:t("router.cert.issuing"),children:(0,H.jsx)(F.Z,{size:12})}):x({loading:o,open:e=>{e.stopPropagation(),d(P)}}),l&&(0,H.jsx)(M.Z,{color:"primary",title:l.title,description:l.description,confirm:l.confirm,params:l.params,onConfirm:l.onConfirm,onCancel:l.onCancel})]})}function V(e){const{domain:n,domainStatus:i,...t}=e;return!(0,g.rM)(n)||null!==i&&void 0!==i&&i.isHttps?"":(0,H.jsx)(K,{domain:n,...t})}K.propTypes={domain:b().string.isRequired,did:b().string.isRequired,siteId:b().string.isRequired,onAdd:b().func,children:b().any},K.defaultProps={onAdd:()=>{},children:null},V.propTypes={domain:b().string.isRequired,domainStatus:b().shape({isHttps:b().bool}).isRequired,did:b().string.isRequired,onAdd:b().func,children:b().any},V.defaultProps={onAdd:()=>{},children:null};var Q=i(11593),Y=i(74490),G=i(31853),X=i(11854),J=i.n(X);const $=(0,a.createContext)({}),{Provider:ee,Consumer:ne}=$;function ie(e){let{children:n}=e;const[i,t]=(0,G.Z)({domain:"",error:null}),{locale:o}=(0,c.PE)(),r={error:i.error,domain:i.domain,setError:e=>{t({error:e})},setDomain:e=>{const n=J()(e),i=(0,g.ub)(n,o);t({domain:n,error:i})}};return(0,H.jsx)(ee,{value:{value:r},children:n})}var te=i(27472),oe=i(88577),re=i(35966),ae=i(41297),se=i(34966),le=i(96538),de=i(39067),ce=i(38898),me=i(47020),ue=i(92706),pe=i.n(ue),he=i(44152),fe=i.n(he),xe=i(26796),ge=i(80676),ve=i(12937);function ye(e){let{domain:n,resolvedTarget:i,...t}=e;const{t:o,locale:r}=(0,c.PE)();return(0,H.jsxs)(C.Z,{sx:{backgroundColor:"rgb(236, 251, 253)",borderColor:"rgb(236, 251, 253)",borderRadius:"8px",padding:"12px"},...t,children:[(0,H.jsxs)(C.Z,{display:"flex",children:[o("router.domain.setup.tipStart"),n&&(0,H.jsx)(C.Z,{mx:.5,color:"primary.main",fontWeight:"fontWeightBold",children:n}),o("router.domain.setup.tipEnd"),":"]}),(0,H.jsxs)(C.Z,{sx:{"&>div":{mb:0},marginTop:"8px"},children:[(0,H.jsx)(je,{label:o("router.domain.setup.recordType"),value:"CNAME",locale:r}),(0,H.jsx)(je,{label:o("router.domain.setup.recordValue"),value:i,locale:r})]})]})}function je(e){let{locale:n,label:i,value:t}=e;const o=(0,I.Z)((e=>e.breakpoints.down("md"))),r=(0,E.Z)();return(0,H.jsx)(d.Z,{name:i,nameWidth:120,children:(0,H.jsxs)(C.Z,{sx:{display:"flex",alignItems:"center",lineHeight:1},children:[(0,H.jsx)(p.Z,{component:"span",color:"primary.main",overflow:"auto",sx:o?{maxWidth:"95%",wordWrap:"break-word"}:{wordWrap:"break-word"},children:t}),(0,H.jsx)(ve.q,{content:t,locale:n,style:{marginLeft:"4px",color:r.palette.text.secondary}})]})})}ye.propTypes={domain:b().string,resolvedTarget:b().string.isRequired},ye.defaultProps={domain:""},je.propTypes={locale:b().string.isRequired,label:b().string.isRequired,value:b().string.isRequired};var be=i(35110),De=i(24921);function Ze(e){let{siteId:n,teamDid:i,cnameDomain:t,defaultCustomDomain:o,onInputDomain:r,appId:s,appPk:l,onSuccess:d,onError:m,disabled:u,autoFocus:h,inBlockletSetup:x,shouldCheckDomain:v,onStateChange:y,currentIp:j,resolveDomain:b,...D}=e;const{t:Z,locale:k}=(0,c.PE)(),{api:P,info:S}=(0,f.h6)(),w=function(){const{value:e}=(0,a.useContext)($);return e}(),T=(0,E.Z)(),R=(0,ae.Z)({key:"sm"}),[I,A]=(0,G.Z)({submittingDomain:!1,domain:o,error:null,type:null!==S&&void 0!==S&&S.nftDomainUrl?"nftDomain":"inputDomain",showNFTDomainAuth:!1,showDnsTip:!1}),_=(0,xe.default)((()=>(0,te.getDidDomainServiceURL)(null===S||void 0===S?void 0:S.nftDomainUrl)));if(null!==S&&void 0!==S&&S.nftDomainUrl&&_.loading)return(0,H.jsx)(C.Z,{...D,children:(0,H.jsx)(re.Z,{relative:"parent",children:(0,H.jsx)(F.Z,{})})});if(_.error)return(0,H.jsx)(C.Z,{...D,children:(0,H.jsx)(re.Z,{relative:"parent",children:_.error.message})});const N=_.value,q=async e=>{y(Z("setup.domain.addingDomain")),await P.addDomainAlias({input:{id:n,domainAlias:e,teamDid:i,inBlockletSetup:!0}}),A({submittingDomain:!1}),d({domain:e,type:"inputDomain"})},z=async e=>{let{domain:n,type:i,nftDid:t,chainHost:o}=e;try{if(!v)return"inputDomain"===i?void await q(n):void d({domain:n,type:i,nftDid:t,chainHost:o});y({text:Z("setup.domain.checkingResolvable")});let e=30;const r=3e3,a=(void 0,"production"===(null===De||void 0===De||null===(De={NODE_ENV:"production",PUBLIC_URL:".",WDS_SOCKET_HOST:void 0,WDS_SOCKET_PATH:void 0,WDS_SOCKET_PORT:void 0,FAST_REFRESH:!0})||void 0===De?void 0:De.NODE_ENV)?1e3*e/r:0),s=setInterval((()=>{e<=0?clearInterval(s):y({text:"".concat(Z("setup.domain.checkingResolvable")," (").concat(e--,"s)")})}),1e3),l=await fe()((async()=>{const{data:e}=await b(n);if(!e.address)throw new Error("Cannot resolve domain");return e.address}),{retries:a,minTimeout:r,maxTimeout:r,onFailedAttempt:console.error}).catch(console.error);if(clearInterval(s),!l){const e=Z("setup.domain.cannotResolve",{domain:n});return"nftDomain"===i?(O.Z.error(e),void d({domain:n,type:"nftDomain"})):(y({text:""}),void A({invalidDNSDomain:{domain:n,error:e},domain:n,type:i,submittingDomain:!1}))}if(l!==j){const e=Z("setup.domain.resolvedAddressError",{domain:n,curDomain:window.location.hostname});return"nftDomain"===i?(O.Z.error(e),void d({domain:n,type:"nftDomain"})):(y({text:""}),void A({invalidDNSDomain:{domain:n,error:e},domain:n,type:i,submittingDomain:!1}))}if("nftDomain"===i)return void d({domain:n,type:"nftDomain"});await q(n)}catch(r){O.Z.error(r.message),y({text:""}),A({submittingDomain:!1})}},L=w.error||I.error;return(0,H.jsx)(C.Z,{...D,children:(0,H.jsxs)(C.Z,{sx:{display:"flex",flexDirection:"column",justifyContent:"flex-start",gap:"1em"},children:[(0,H.jsxs)(C.Z,{sx:{display:"flex",flexDirection:"column",gap:"8px"},children:[S.nftDomainUrl&&N&&(0,H.jsxs)(C.Z,{sx:{color:T.palette.text.primary},children:[(0,H.jsx)(p.Z,{children:Z("router.domainAlias.addDomainNFT.tips")}),(0,H.jsxs)(p.Z,{component:"div",children:[Z("router.domainAlias.addDomainNFT.buyTip"),(0,H.jsxs)(ce.Z,{href:N.base,sx:{display:"inline-flex",alignItems:"center"},target:"_blank",children:[(0,H.jsx)("i",{children:Z("router.domainAlias.addDomainNFT.buy")}),(0,H.jsx)(le.Z,{fontSize:"small"})]})]})]}),(0,H.jsx)(me.Z,{sx:{display:"block",marginTop:"8px"},label:Z("router.domainAlias.add.domainDescription"),helperText:"inputDomain"===I.type&&L||Z("router.domainAlias.add.helperText"),inputProps:{"data-cy":"domain-name-input"},fullWidth:!0,disabled:u,value:I.domain,size:"small",variant:"outlined",error:!!L&&"inputDomain"===I.type,onChange:e=>{var n;const i=J()(null===(n=e.target)||void 0===n?void 0:n.value);w.setDomain(i);const t=(0,g.ub)(i,k);A({domain:i,error:t,type:"inputDomain"}),r({domain:i,error:t,type:"inputDomain"})},autoFocus:h,onBlur:()=>{w.domain||(A({error:null}),w.setError(null))}}),(0,H.jsx)(C.Z,{sx:{width:"100%",display:"flex",justifyContent:"flex-end"},children:(0,H.jsx)(de.Z,{"data-cy":"confirm-add-domain",fullWidth:R,variant:"contained",loading:I.submittingDomain,onClick:async()=>{try{A({submittingDomain:!0});const e=(0,be.sf)(I.domain);if(S.nftDomainUrl&&N){if(!0===(await P.isDidDomain({input:{domain:e}})).value)return void A({showNFTDomainAuth:!0})}await z({domain:e,type:I.type})}catch(L){A({submittingDomain:!1}),w.setError(L.message)}},children:Z("common.add")})}),(0,H.jsxs)(C.Z,{sx:{cursor:"pointer",fontSize:"14px",display:"flex",alignItems:"center",gap:"4px",lineHeight:1,color:T.palette.primary.main},onClick:()=>A({showDnsTip:!I.showDnsTip}),children:[(0,H.jsx)(se.Z,{fontSize:"1em"}),Z("router.domainAlias.showTipHint")]}),I.showDnsTip&&(0,H.jsx)(ye,{domain:I.domain,resolvedTarget:t,style:{marginTop:"4px"}})]}),I.invalidDNSDomain&&(0,H.jsx)(M.Z,{title:Z("common.reminder"),description:Z("setup.domain.invalidDNSReminder",{error:I.invalidDNSDomain.error}),color:"primary",confirm:Z("setup.domain.continueAdd"),onConfirm:()=>q(I.invalidDNSDomain.domain,I.type),onCancel:()=>{A({invalidDNSDomain:null})}}),N&&(0,H.jsx)(oe.Z,{open:I.showNFTDomainAuth,popup:!0,useSocket:!1,action:"authorize",baseUrl:N.api,checkFn:ge.od.create({baseURL:N.api}).get,extraParams:{delegatee:s,delegateePk:l,domain:I.domain},onSuccess:async e=>{let{domain:t,nftDid:o,chainHost:r}=e;try{const e=(0,be.sf)(t);A({submittingDomain:!0}),await P.addDomainAlias({input:{id:n,type:"nft-domain",domainAlias:e,nftDid:o,chainHost:r,teamDid:i,inBlockletSetup:x}});const a="nftDomain";A({showNFTDomainAuth:!1,type:a}),await z({domain:e,type:a,nftDid:o,chainHost:r})}catch(L){O.Z.error(L.message)}finally{A({showNFTDomainAuth:!1,submittingDomain:!1})}},onClose:()=>A({showNFTDomainAuth:!1,submittingDomain:!1}),checkTimeout:3e5,showDownload:!1,messages:{title:Z("router.domainAlias.addDomainNFT.connect.title"),scan:Z("router.domainAlias.addDomainNFT.connect.scan"),confirm:Z("router.domainAlias.addDomainNFT.connect.confirm"),success:Z("router.domainAlias.addDomainNFT.connect.success")}})]})})}function ke(e){let{id:n,children:i,title:t,teamDid:o,systemDomains:r,appId:a,appPk:s}=e;const{t:l}=(0,c.PE)(),[d,m]=(0,G.Z)({loading:!1,confirmSetting:null}),u=r.find((e=>(0,_.isDidDomain)(e))),p={title:t||l("router.domainAlias.add.title"),description:function(e,i,t){return(0,H.jsx)(Ze,{siteId:n,teamDid:o,cnameDomain:u,onSuccess:()=>m({confirmSetting:null}),onInputDomain:n=>{let{domain:o,type:r,error:a}=n;i({...e,domain:o,type:r,__disableConfirm:!!a}),t(a)},appId:a,appPk:s})},confirm:l("common.confirm"),cancel:l("common.cancel"),params:{domain:"",__disableConfirm:!0},onCancel:()=>{m({loading:!1,confirmSetting:null})}},h=e=>{e.stopPropagation(),m({confirmSetting:p})};return(0,H.jsxs)(H.Fragment,{children:["function"===typeof i?i({loading:d.loading,open:h}):(0,H.jsxs)(Y.Z,{onClick:h,className:"rule-action","data-cy":"action-add-domain-alias",children:[d.loading?(0,H.jsx)(F.Z,{size:16}):(0,H.jsx)(Q.Z,{style:{fontSize:18,marginRight:5}}),l("router.domainAlias.add.title")]}),d.confirmSetting&&(0,H.jsx)(M.Z,{title:d.confirmSetting.title,description:d.confirmSetting.description,confirm:d.confirmSetting.confirm,cancel:d.confirmSetting.cancel,params:d.confirmSetting.params,onCancel:d.confirmSetting.onCancel,showConfirm:!1,showCancel:!0,displayError:!1,color:"primary",loading:d.loading,maxWidth:"sm"})]})}function Ce(e){return(0,H.jsx)(ie,{children:(0,H.jsx)(ke,{...e})})}Ze.propTypes={siteId:b().string.isRequired,currentIp:b().string,teamDid:b().string.isRequired,cnameDomain:b().string.isRequired,defaultCustomDomain:b().string,onInputDomain:b().func,onSuccess:b().func,appId:b().string,appPk:b().string,disabled:b().bool,autoFocus:b().bool,inBlockletSetup:b().bool,shouldCheckDomain:b().bool,onStateChange:b().func,resolveDomain:b().func,onError:b().func},Ze.defaultProps={defaultCustomDomain:"",currentIp:"",onInputDomain:pe(),onSuccess:pe(),appId:"",appPk:"",disabled:!1,autoFocus:!0,inBlockletSetup:!1,shouldCheckDomain:!1,onStateChange:()=>{},resolveDomain:()=>{},onError:()=>{}},ke.propTypes={id:b().string.isRequired,children:b().any,title:b().string,teamDid:b().string,systemDomains:b().arrayOf(b().string).isRequired,appId:b().string,appPk:b().string.isRequired},ke.defaultProps={children:null,title:"",teamDid:"",appId:null};var Pe=i(46954),Se=i(44067),we=i(27773),Te=i(60501);function Re(e){const{t:n}=(0,c.PE)(),[i,t]=(0,a.useState)(!1),[r,s]=(0,a.useState)(null),{id:l,domain:d,children:m,teamDid:u}=e,{api:p}=(0,f.h6)(),h={title:n("router.domainAlias.delete.title"),description:n("router.domainAlias.delete.description"),confirm:n("common.confirm"),onConfirm:async()=>{t(!0);try{await p.deleteDomainAlias({input:{id:l,domainAlias:d,teamDid:u}}),await(0,g._v)(2e3)}catch(e){O.Z.error(e.message)}finally{s(null),t(!1)}},onCancel:()=>{t(!1),s(null)}},x=e=>{e.stopPropagation(),s(h)};return(0,H.jsxs)(H.Fragment,{children:["function"===typeof m?m({loading:i,open:x}):(0,H.jsxs)(o.Z,{edge:"end",onClick:x,size:"small",className:"rule-action",color:"error","data-cy":"action-delete-domain-alias",children:[i?(0,H.jsx)(F.Z,{size:16}):(0,H.jsx)(we.default,{style:{fontSize:16}}),n("router.domainAlias.delete.title")]}),r&&(0,H.jsx)(M.Z,{title:r.title,description:r.description,confirm:r.confirm,params:r.params,onConfirm:r.onConfirm,onCancel:r.onCancel})]})}function Ee(e){let{site:n,domain:i,blocklet:t}=e;const{t:o}=(0,c.PE)(),r=i.value===window.location.hostname;return(0,H.jsx)(Te.Z,{"data-cy":"domain-actions",size:"large",actions:[e=>{var a;let{close:s}=e;return(0,H.jsx)(Re,{id:n.id,domain:i.value,teamDid:null===t||void 0===t||null===(a=t.meta)||void 0===a?void 0:a.did,children:e=>{let{open:n}=e;return(0,H.jsx)(R.Z,{title:r?o("blocklet.router.currentDomainTip"):"",children:(0,H.jsx)("span",{children:(0,H.jsxs)(Y.Z,{disabled:i.isProtected||r,dense:!0,onClick:e=>{s(),n(e)},"data-cy":"action-toggle-block",children:[(0,H.jsx)(Pe.Z,{style:{minWidth:24,marginRight:8},children:(0,H.jsx)(we.default,{})}),(0,H.jsx)(Se.Z,{primary:o("common.delete")})]},"remove")})})}})}]})}Re.propTypes={id:b().string.isRequired,domain:b().string.isRequired,children:b().any,teamDid:b().string},Re.defaultProps={children:null,teamDid:""},Ee.propTypes={site:b().object.isRequired,domain:b().object.isRequired,blocklet:b().object.isRequired},Ee.defaultProps={};var Ie=i(31942),Ae=i(238);const _e=b().shape({href:b().string,accessibility:b().shape({loading:b().bool,accessible:b().bool}),domainStatus:b().shape({isHttps:b().bool,matchedCert:b().object}),dns:b().shape({resolved:b().bool,ip:b().string})});var Ne,qe=i(43681),Fe=i.n(qe);function ze(e){let{certificate:n}=e;const[i,t]=(0,a.useState)(null),o=(0,f.h6)(),{t:r,locale:s}=(0,c.PE)(),l=()=>{t(null)},d=Boolean(i);return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(Ie.Z,{"aria-owns":d?"mouse-over-popover":void 0,onMouseEnter:e=>{t(e.currentTarget)},onMouseLeave:l,style:{color:"#44cdc6",fontSize:20,cursor:"pointer"}}),(0,H.jsx)(T.ZP,{id:"mouse-over-popover",style:{pointerEvents:"none"},open:d,anchorEl:i,anchorOrigin:{vertical:"bottom",horizontal:"left"},transformOrigin:{vertical:"top",horizontal:"left"},onClose:l,disableRestoreFocus:!0,children:(0,H.jsx)(P.Z,{children:(0,H.jsxs)(S.Z,{style:{display:"flex"},children:[(0,H.jsx)("div",{children:(0,H.jsx)("img",{src:"".concat(o.imgPrefix,"/https-certificate-icon.png"),alt:"certificate icon",style:{maxHeight:"100%",maxWidth:"100%"}})}),(0,H.jsxs)(p.Z,{component:"div",style:{marginLeft:"16px"},children:[(0,H.jsx)(p.Z,{component:"div",style:{fontWeight:"bold"},children:n.domain}),(0,H.jsx)(p.Z,{component:"div",children:"".concat(r("common.issuer"),": ").concat(Fe()(n,"issuer.commonName",""))}),(0,H.jsx)(p.Z,{component:"div",children:"".concat(r("router.cert.issuedOn"),": ").concat((0,g.pz)(n.validFrom,s))}),(0,H.jsx)(p.Z,{component:"div",children:"".concat(r("router.cert.expiryOn"),": ").concat((0,g.pz)(n.validTo,s))})]})]})})})]})}function Le(e){let{domain:n,filters:i}=e;const{t:t}=(0,c.PE)(),{value:o,domainStatus:r}=n;if(!(0,g.rM)(o))return null;let s=null,l=null;const{isHttps:d,matchedCert:m}=r;if(!(0,g.ao)(o)){const{dns:{resolved:e,ip:n}={}}=r;s=e||"127.0.0.1"===n?(0,H.jsx)(R.Z,{title:t("router.domain.verify.ok"),children:(0,H.jsx)(Ae.Z,{color:"success"})}):(0,H.jsx)(R.Z,{title:t("router.domain.verify.notResolved"),children:(0,H.jsx)(Ae.Z,{color:"error"})})}l=d?(0,H.jsx)(ze,{certificate:m}):(0,H.jsx)(R.Z,{title:t("router.domain.https.bad"),children:(0,H.jsx)(Ie.Z,{style:{color:"#D0021B",fontSize:20,cursor:"pointer"}})});const u=i.map((e=>"domain"===e?s:"http"===e?l:null));return(0,a.createElement)(a.Fragment,null,...u)}ze.propTypes={certificate:b().object},ze.defaultProps={certificate:{}},Le.propTypes={domain:_e.isRequired,filters:b().array},Le.defaultProps={filters:["domain","http"]};const Be=(0,z.V)(Me,"mutate_blocklets"),Oe=(0,z.V)(Me,"",g.Wf);function We(e){const{inService:n}=(0,f.h6)(),{blocklet:i,loadingRuntimeInfo:t}=(0,h.y0)();let o=Be;return n&&(o=Oe),(0,H.jsx)(o,{...e,blocklet:i,inService:n,loadingRuntimeInfo:t})}function Me(e){var n,i,t;let{hasPermission:r,blocklet:d,loadingRuntimeInfo:m,inService:p,listOnly:h}=e;const{t:f}=(0,c.PE)(),[x,v]=(0,a.useState)(!1),j=(0,I.Z)((e=>e.breakpoints.down("md"))),b=(0,a.useMemo)((()=>{let e=r;return(0,y.ep)(d)&&(e=e&&p),e}),[r,p,d]),{site:Z}=d,P=(0,a.useMemo)((()=>{var e;return(0,g.oE)(null===(e=d.site)||void 0===e?void 0:e.domainAliases)}),[null===(n=d.site)||void 0===n?void 0:n.domainAliases]),S=[],w=[],T=(0,A.encode)(d.appPid),R=null===(i=d.environments)||void 0===i||null===(i=i.find((e=>"BLOCKLET_APP_PK"===e.key)))||void 0===i?void 0:i.value,E=(0,g.M6)(P);return P.forEach((e=>{const n=e.value||"";(0,_.isDidDomain)(n)&&!n.startsWith(T)?w.push(e):S.push(e)})),(0,H.jsxs)(H.Fragment,{children:[!h&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(C.Z,{className:"title first",display:"flex",justifyContent:"space-between",alignItems:"center",children:[(0,H.jsx)(C.Z,{children:f("common.domain")}),b&&(0,H.jsx)(Ce,{id:Z.id,title:f("router.domain.add.title"),teamDid:null===(t=d.meta)||void 0===t?void 0:t.did,appId:d.appPid,appPk:R,systemDomains:null===E||void 0===E?void 0:E.map((e=>e.value)),children:e=>{let{open:n}=e;return(0,H.jsxs)(o.Z,{style:{marginLeft:16},variant:"contained",color:"primary","data-cy":"add-domain-alias",onClick:n,disabled:(0,u.isInProgress)(d.status),children:[(0,H.jsx)(D.Z,{style:{fontSize:"1.3em",marginRight:4}}),f("common.add")]})}})]}),!1===(0,u.isAccessible)(d.status)&&(0,H.jsx)(C.Z,{mt:1.5,mb:1.5,children:(0,H.jsx)(k.Z,{severity:"warning",children:f("blocklet.router.noRunning")})})]}),(0,H.jsx)(C.Z,{sx:{display:"flex",flexDirection:"column",gap:1},children:(x?P:S).map((e=>{var n,i;const t=e.value;return(0,H.jsxs)(a.Fragment,{children:[j&&(0,H.jsxs)(C.Z,{display:"flex",flexDirection:"column",children:[(0,H.jsx)(C.Z,{display:"flex",alignItems:"center",justifyContent:"flex-start",children:(0,H.jsx)(He,{domain:e,target:"_blank",children:e.value})}),(0,H.jsxs)(C.Z,{display:"flex",alignItems:"center",justifyContent:"space-between",children:[(0,H.jsxs)(C.Z,{sx:{display:"flex",alignItems:"center",justifyContent:"flex-start",gap:1},children:[(0,H.jsx)(Le,{domain:e,filters:["domain"]},"".concat(e.value,"-domain")),(0,H.jsx)(Ve,{siteId:null===(n=d.site)||void 0===n?void 0:n.id,domain:e,blocklet:d,hasMutatePermission:b})]}),(0,H.jsx)(C.Z,{sx:{button:{padding:0}},children:(0,H.jsx)(Ke,{hasMutatePermission:b,site:Z,domain:e,blocklet:d})})]})]},t),!j&&(0,H.jsxs)(C.Z,{display:"flex",alignItems:"center",justifyContent:"space-between",children:[(0,H.jsxs)(C.Z,{display:"flex",alignItems:"center",justifyContent:"flex-start",children:[(0,H.jsx)(Le,{domain:e,filters:["domain"]},"".concat(e.value,"-domain")),(0,H.jsx)(C.Z,{sx:{ml:2,mr:.5},children:(0,H.jsx)(He,{domain:e,target:"_blank",children:e.value})}),(0,H.jsx)(Ve,{siteId:null===(i=d.site)||void 0===i?void 0:i.id,domain:e,blocklet:d,hasMutatePermission:b})]}),(0,H.jsx)(C.Z,{sx:{button:{padding:0}},children:(0,H.jsx)(Ke,{hasMutatePermission:b,site:Z,domain:e,blocklet:d})})]},t)]},t)}))}),w.length>0&&(0,H.jsx)("div",{style:{marginLeft:"20px",marginTop:"12px"},children:(0,H.jsx)(o.Z,{endIcon:x?(0,H.jsx)(s.Z,{}):(0,H.jsx)(l.Z,{}),onClick:()=>v(!x),children:f(x?"common.collapseAll":"blocklet.router.showAllDomains")})}),!P.length&&(m?(0,H.jsx)(F.Z,{size:16}):(0,H.jsx)(q.Z,{children:f("common.empty")}))]})}function He(e){let{domain:n,children:i,...t}=e;const{t:o}=(0,c.PE)(),{href:r,accessibility:a}=n;return!a||a.loading?(0,H.jsxs)(Ue,{...t,children:[i,(0,H.jsx)(R.Z,{title:o("blocklet.router.checkUrlAccessible"),placement:"top-end",children:(0,H.jsx)("span",{className:"status",children:(0,H.jsx)(F.Z,{size:12})})})]}):a.accessible?(0,H.jsx)(Ue,{...t,children:(0,H.jsx)("a",{href:r,target:"_blank",rel:"noopener noreferrer",children:i})}):(0,H.jsx)(Ue,{...t,children:(0,H.jsx)(R.Z,{title:o("blocklet.router.urlInaccessible"),placement:"top-end",children:(0,H.jsx)("span",{children:i})})})}We.propTypes={listOnly:b().bool},We.defaultProps={listOnly:!1},Me.propTypes={hasPermission:b().bool,blocklet:b().object.isRequired,loadingRuntimeInfo:b().bool,inService:b().bool.isRequired,listOnly:b().bool},Me.defaultProps={hasPermission:!1,loadingRuntimeInfo:!1,listOnly:!1},He.propTypes={domain:_e.isRequired,children:b().any.isRequired};const Ue=r.Z.span(Ne||(Ne=(0,t.Z)(["\n &,\n & > * {\n color: #222;\n font-size: 18px;\n word-break: break-all;\n }\n\n .status {\n margin-left: 8px;\n }\n"])));function Ke(e){let{hasMutatePermission:n,site:i,domain:t,blocklet:o}=e;const r=(0,E.Z)(),{t:a}=(0,c.PE)();return n&&!t.isProtected?(0,H.jsx)(Ee,{site:i,domain:t,blocklet:o}):(0,H.jsx)(R.Z,{title:a("blocklet.router.domainLockTooltip"),placement:"top",children:(0,H.jsx)(w.Z,{disabled:!0,size:"large",style:{pointerEvents:"auto",paddingTop:0,paddingBottom:0},children:(0,H.jsx)(N.Z,{style:{fill:r.palette.text.disabled}})})})}function Ve(e){let{siteId:n,domain:i,blocklet:t,hasMutatePermission:r}=e;const s=(0,E.Z)(),{t:l}=(0,c.PE)(),[d,m]=(0,a.useState)(null),u=()=>{m(null)};return(0,H.jsxs)(C.Z,{sx:{display:"flex",justifyContent:"flex-start",alignItems:"center",gap:1},children:["nft-domain"===i.type&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(Z.Z,{onMouseEnter:e=>{m(e.currentTarget)},onMouseLeave:u,style:{cursor:"pointer",fill:s.palette.primary.main}}),(0,H.jsx)(T.ZP,{id:"mouse-over-popover",style:{pointerEvents:"none"},open:Boolean(d),anchorEl:d,anchorOrigin:{vertical:"bottom",horizontal:"left"},transformOrigin:{vertical:"top",horizontal:"left"},onClose:u,disableRestoreFocus:!0,children:(0,H.jsx)(P.Z,{children:(0,H.jsxs)(S.Z,{style:{display:"flex",flexDirection:"column"},children:[(0,H.jsxs)(p.Z,{component:"div",style:{display:"flex",alignItems:"center"},children:[(0,H.jsx)(Z.Z,{style:{fill:s.palette.primary.main}}),(0,H.jsx)(p.Z,{component:"span",style:{marginLeft:"8px",fontSize:"18px",fontWeight:"bolder"},children:l("router.domainAlias.nftDomain")})]}),(0,H.jsxs)(p.Z,{component:"div",style:{display:"flex",marginTop:"12px"},children:[(0,H.jsx)(p.Z,{component:"span",style:{width:"80px",marginRight:"8px"},children:l("common.domain")}),(0,H.jsx)(p.Z,{component:"span",children:i.value})]}),(0,H.jsxs)(p.Z,{component:"div",style:{display:"flex"},children:[(0,H.jsx)(p.Z,{component:"span",style:{width:"80px",marginRight:"8px"},children:"NFT"}),(0,H.jsx)(x.Z,{did:i.nftDid})]})]})})})]}),(0,H.jsx)(Le,{domain:i,filters:["http"]},"".concat(i.value,"-http")),r&&(0,H.jsx)(V,{siteId:n,domain:i.value,domainStatus:i.domainStatus,did:t.meta.did,children:e=>{let{open:n}=e;return(0,H.jsx)(o.Z,{sx:{padding:0},size:"small",onClick:e=>n(e),children:l("router.cert.genLetsEncryptCert.title")})}})]})}var Qe;Ke.propTypes={hasMutatePermission:b().bool.isRequired,site:b().object.isRequired,domain:_e.isRequired,blocklet:b().object.isRequired},Ve.propTypes={siteId:b().string.isRequired,domain:_e.isRequired,blocklet:b().object.isRequired,hasMutatePermission:b().bool.isRequired};const Ye={arcblock:"ArcBlock",ethereum:"Ethereum"};function Ge(){var e,n,i,t,r;const{t:p,locale:j}=(0,c.PE)(),{info:b,inService:D}=(0,f.h6)(),[Z,k]=(0,a.useState)(!1),{blocklet:C}=(0,h.y0)(),{appDid:P,appPid:S,migratedFrom:w=[]}=C,T=null===(e=C.environments.find((e=>"BLOCKLET_APP_CHAIN_TYPE"===e.key)))||void 0===e?void 0:e.value,R=[P?{name:p("blocklet.appId"),value:(0,H.jsx)(x.Z,{did:P,showQrcode:!0})}:null,S?{name:p("blocklet.appPid"),value:(0,H.jsx)(x.Z,{did:S,showQrcode:!0})}:null,(null===w||void 0===w?void 0:w.length)>1?{name:p("blocklet.alsoKnownAs"),value:(0,H.jsxs)("div",{children:[(Z?w.slice(1):w.slice(1,2)).map((e=>(0,H.jsx)(x.Z,{did:e.appDid,showQrcode:!0}))),w.length>2&&(0,H.jsx)(o.Z,{style:{marginLeft:"18px"},endIcon:Z?(0,H.jsx)(s.Z,{}):(0,H.jsx)(l.Z,{}),onClick:()=>k(!Z),children:p(Z?"common.collapseAll":"blocklet.router.showAllDIDs")})]})}:null,{name:p("common.name"),value:(0,u.getDisplayName)(C,!0)},{name:p("common.status"),value:(0,H.jsx)(v.Z,{status:C.status,source:C.source,progress:C.progress})},(0,y.ep)(C)?{name:"NFT",value:(0,H.jsx)(x.Z,{external:!0,href:(0,g.E8)(null===C||void 0===C||null===(n=C.controller)||void 0===n?void 0:n.chainHost,null===C||void 0===C||null===(i=C.controller)||void 0===i?void 0:i.nftId,"asset"),did:null===C||void 0===C||null===(t=C.controller)||void 0===t?void 0:t.nftId,showQrcode:!0})}:null,{name:p("blocklet.installedAt"),value:(0,g.B2)(C.installedAt,j)},{name:p("blocklet.overview.accessControl"),value:p("team.whoCanAccess.".concat((0,u.getWhoCanAccess)(C),".title"))},{name:p("common.owner"),value:null!==(r=C.settings)&&void 0!==r&&r.owner?(0,H.jsx)(x.Z,{did:C.settings.owner.did,showQrcode:!0}):"-"},{name:p("blocklet.config.walletType.name"),value:Ye[T||"arcblock"]||T},C.externalSkSource?{name:p("blocklet.skSource"),value:C.externalSkSource}:null].filter(Boolean);D&&R.push({name:p("common.serverDid"),value:(0,H.jsx)(x.Z,{did:b.did,showQrcode:!0})},{name:p("common.serverVersion"),value:(0,H.jsx)(m.Z,{children:b.version})});return(0,H.jsxs)(Xe,{component:"div",children:[(0,H.jsx)(We,{}),(0,H.jsx)("div",{className:"title",children:(0,H.jsx)("span",{children:p("common.basicInfo")})}),(0,H.jsx)("div",{className:"basicInfo",children:(E=R,E.map((e=>(0,H.jsx)(d.Z,{style:{display:"flex",alignItems:"flex-start"},valueComponent:"div",nameWidth:120,name:e.name,nameFormatter:()=>e.name,children:e.value},e.name))))})]});var E}Ge.propTypes={};const Xe=(0,r.Z)(p.Z)(Qe||(Qe=(0,t.Z)(["\n .title {\n font-size: 1.2rem;\n font-weight: bold;\n margin-top: ",";\n margin-bottom: ",";\n\n &.first {\n margin-top: 0;\n }\n }\n"])),(e=>e.theme.spacing(5)),(e=>e.theme.spacing(3)))},35110:(e,n,i)=>{"use strict";i.d(n,{Rw:()=>c,fX:()=>d,sf:()=>m});var t=i(35432),o=i(44543),r=i.n(o),a=i(77277),s=i(32828);const l=(e,n)=>{if(e.type===t.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===t.ROUTING_RULE_TYPES.BLOCKLET&&!e.did)return new Error(n("router.validation.didRequired"));return null},d=(e,n)=>{const i=l(e,n);return i||(e.pathPrefix.length?e.pathPrefix.length>150?new Error(n("router.validation.pathPrefixTooLong",{length:150})):null:new Error(n("router.validation.pathPrefixCannotBeEmpty")))},c=e=>{let{params:n,blocklets:i,blocklet:t,locale:o="en"}=e;if(t){let e=(t.children||[]).find((e=>(0,s.default)(e.meta)&&r()(e.mountPoint,n.pathPrefix)));if("gateway"!==t.meta.group&&"/"===n.pathPrefix&&(e="/"),e)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")}[o]}const l=i.find((e=>e.meta.did===n.did));if(!l)return"";const d=l.meta.interfaces.find((e=>"web"===e.type));return d&&d.prefix!==a.BLOCKLET_DYNAMIC_PATH_PREFIX&&n.pathPrefix!==d.prefix?{zh:"\u8be5 blocklet \u53ea\u80fd\u6302\u8f7d\u5728 ".concat(d.prefix),en:"This blocklet can only be mounted on ".concat(d.prefix)}[o]:""},m=e=>{if(!e||"string"!==typeof e)return e;let n=e.trim();try{return n=n.toLowerCase(),n.startsWith("http://")||n.startsWith("https://")?new URL(n).hostname:n}catch(i){return console.error("format domain failed",i),n}}}}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(self.webpackChunk_abtnode_webapp=self.webpackChunk_abtnode_webapp||[]).push([[8399],{26362:(e,n,t)=>{t.d(n,{Z:()=>p});var i=t(55898),o=t.n(i),l=t(62681),a=t(72333),r=t(6352),s=t.n(r),c=t(35432),d=t(22324),u=t(64387);var m=t(96266);function p(e){let{blocklet:n,style:t,size:i,ancestors:o,...r}=e;const p=(0,d.h6)(),{logoUrl:h,inService:f}=function(e){var n;let{blocklet:t,ancestors:i=[]}=e;const o=(0,d.h6)(),{inService:l}=o,a=(0,u.XN)(null===t||void 0===t?void 0:t.status)||(0,u.tv)(null===t||void 0===t?void 0:t.status),r="?v=".concat(null===t||void 0===t||null===(n=t.meta)||void 0===n?void 0:n.version).concat(a?"~":"");let m=l?s()(u.zn,c.WELLKNOWN_SERVICE_PATH_PREFIX,"/blocklet/logo-bundle",r):s()(o.imgPrefix,"blocklet.png");if("registry"===t.source&&t.deployedFrom&&t.meta.logo)m=s()(t.deployedFrom,(0,u.lk)(t.meta.bundleDid,t.meta.logo),r);else{const e=window.env.apiPrefix||"/",n=i.concat(t),o=l?n.slice(1):n;m=s()(e,"/blocklet/logo-bundle".concat(o.map((e=>"/".concat(e.meta.did))).join("")),r)}return{logoUrl:m,inService:l}}({blocklet:n,ancestors:o}),{variant:g}=r,x=f?()=>{}:e=>{e.target.src="".concat(p.imgPrefix,"/blocklet.png")};let v=(0,m.jsx)("img",{src:h,onError:x,alt:n.meta.name,style:{width:i}});return n.meta.logo||(v=(0,m.jsx)(a.Z,{did:n.meta.did||"",responsive:!0})),(0,m.jsx)(l.Z,{variant:g||"square",style:Object.assign({backgroundColor:"transparent",width:i,height:i,borderRadius:10},t),...r,children:v})}p.propTypes={blocklet:o().object.isRequired,style:o().object,size:o().oneOfType([o().number,o().string]),ancestors:o().array},p.defaultProps={style:{},size:40,ancestors:[]}},53777:(e,n,t)=>{t.d(n,{Z:()=>r});var i=t(55898),o=t.n(i),l=t(39948),a=t(96266);function r(e){let{depth:n,className:t}=e;return(0,a.jsx)(l.Z,{ml:Math.max(2*(n-1),0),className:t,sx:{borderBottom:1,borderColor:"rgba(0,0,0,0.12)"}},"group-collapse-box")}r.propTypes={depth:o().number,className:o().string},r.defaultProps={depth:1,className:""}},67357:(e,n,t)=>{t.d(n,{Z:()=>d});var i,o=t(71171),l=t(33518),a=t(82790),r=t(96266);function s(e){let{labelProps:n,className:t,style:i,...o}=e;const l={...n,labelPlacement:(null===n||void 0===n?void 0:n.labelPlacement)||"start"};return(0,r.jsx)(c,{className:t,style:i,children:(0,r.jsx)(a.Z,{labelProps:l,...o})})}s.propTypes=a.Z.propTypes,s.defaultProps=a.Z.defaultProps;const c=l.Z.div(i||(i=(0,o.Z)(["\n max-width: 300px;\n > label {\n display: flex;\n justify-content: space-between;\n width: 100%;\n margin-left: 0;\n margin-right: 0;\n }\n "," {\n max-width: 100%;\n }\n"])),(e=>{let{theme:n}=e;return n.breakpoints.down("sm")})),d=s},19197:(e,n,t)=>{t.d(n,{Z:()=>Z});var i,o=t(71171),l=t(5057),a=t(55898),r=t.n(a),s=t(6352),c=t.n(s),d=t(33518),u=t(92706),m=t.n(u),p=t(39948),h=t(52277),f=t.n(h),g=t(68420),x=t(96266);const v=(0,l.lazy)((()=>Promise.all([t.e(6547),t.e(5760),t.e(6743),t.e(1697),t.e(1294),t.e(4804)]).then(t.bind(t,84804)).then((e=>({default:e.Uploader}))))),b="/blocklet/logo/upload";function Z(e){let{url:n,height:t,width:i,enabled:o,type:a,did:r,prefix:s,headers:d,onUploaded:u}=e;const{t:m}=(0,g.PE)(),h=(0,l.useRef)(null),Z={cursor:o?"pointer":"default","&::after":{content:'"'.concat(m("common.switch"),'"')}};return(0,x.jsxs)(j,{id:"uploader-".concat(r,"-").concat(a),children:[(0,x.jsx)(v,{ref:h,popup:!0,onUploadFinish:()=>{var e;u(),null===(e=h.current)||void 0===e||e.close()},plugins:["ImageEditor"],installerProps:{disabled:!0},apiPathProps:{uploader:c()(s,b,a,r),disableMediaKitPrefix:!0},coreProps:{restrictions:{allowedFileTypes:["image/*",".jpg",".jpeg",".png",".gif",".svg"],maxFileSize:10485760,maxNumberOfFiles:1}},tusProps:{headers:d}}),(0,x.jsx)(p.Z,{className:f()("uploader-wrapper",o&&"enabled"),sx:Z,onClick:()=>{var e;null===(e=h.current)||void 0===e||e.open()},children:(0,x.jsx)("img",{alt:"Logo",src:n,style:{height:t,width:i}})})]},"uploader-".concat(r,"-").concat(a))}Z.propTypes={url:r().string.isRequired,type:r().oneOf(["square","rect","favicon"]).isRequired,did:r().string.isRequired,prefix:r().string.isRequired,headers:r().func,onUploaded:r().func,height:r().number,width:r().any,enabled:r().bool},Z.defaultProps={height:80,width:"auto",enabled:!0,headers:()=>({}),onUploaded:m()};const j=d.Z.div(i||(i=(0,o.Z)(["\n .uploader-wrapper {\n display: inline-flex;\n position: relative;\n font-size: 0px;\n &.enabled {\n cursor: pointer;\n }\n &::after {\n display: none;\n }\n &.enabled::after {\n display: block;\n opacity: 0;\n position: absolute;\n bottom: 0;\n background: rgba(0, 0, 0, 0.2);\n left: 0;\n right: 0;\n height: 2.2em;\n color: white;\n text-align: center;\n font-size: 12px;\n line-height: 2em;\n transition: opacity 0.3s ease;\n }\n &:hover::after {\n opacity: 1;\n }\n }\n"])))},1515:(e,n,t)=>{t.r(n),t.d(n,{default:()=>_t});var i,o=t(71171),l=t(5057),a=t(33518),r=t(55898),s=t.n(r),c=t(96181),d=t(6352),u=t.n(d),m=t(35432),p=t(39948),h=t(55402),f=t(82275),g=t(96399),x=t(65688),v=t(37633),b=t(48037),Z=t(92273),j=t(76720),y=t(15849),k=t(68420),C=t(94464),S=t(38242),w=t(26362),E=t(54474),L=t(43681),P=t.n(L),T=t(50482),O=t.n(T),N=t(16147),R=t(29034),_=t(28726),A=t(80578),I=t(77277),B=t(86229),D=t(30629),F=t(44846),z=t(13727),U=t(56184),K=t(67680),W=t(19654),q=t(90067),M=t(39646),G=t(43897),V=t(47020),H=t(49020),Y=t(43449),J=t(37382),Q=t(90651),X=t(96266);function $(e){let{label:n,disabled:t,required:i,initialValue:o,onChange:a,style:r,onSubmit:s,triggers:c,options:d,formatterBeforeSubmit:u,helperText:m,placeholder:h,renderImage:f,renderLabel:g,filterKeys:x,noEmpty:v,...b}=e;const[Z,j]=(0,l.useState)(!1),[y,k]=(0,l.useState)(!1),[C,S]=l.useState(""),[w,E]=(0,l.useState)(o),[L,P]=(0,l.useState)(w),T=(0,l.useMemo)((()=>{if(!d)return{};const e={};return d.forEach((n=>{e[n.code]=n})),e}),[d]),O=Z?(0,X.jsx)(M.Z,{options:d,value:L,onChange:(e,n)=>{if(!Array.isArray(n))return P([]),void a([]);const t=n.filter((e=>T[e]));if(!t.length)return P([]),void a([]);P(t),a(t)},inputValue:C,onInputChange:(e,n)=>{S(n)},PopperComponent:ne,fullWidth:!0,multiple:!0,variant:"outlined",margin:"dense",filterOptions:()=>{if(!d)return[];if(!C)return d.map((e=>e.code));const e=new RegExp(C.toLowerCase());return d.filter((n=>{for(let i=0;i<x.length;i++){var t;const o=x[i];if(e.test(null===(t=n[o])||void 0===t?void 0:t.toLowerCase()))return!0}return!1})).map((e=>e.code))},getOptionLabel:e=>{var n;return null===(n=T[e])||void 0===n?void 0:n.name},renderInput:e=>(0,X.jsx)(V.Z,{...e,label:"",placeholder:h}),renderOption:(e,n)=>{var t;const i=-1!==L.indexOf(n);return(0,l.createElement)(ee,{component:"li",...e,key:n},f(T[n]||{}),(0,X.jsx)(p.Z,{sx:{"& > img":{mr:2,flexShrink:0}},style:{flex:1,fontWeight:i?"700":"normal"},children:g(n,T[n])||(null===(t=T[n])||void 0===t?void 0:t.name)}),(0,X.jsx)(p.Z,{component:z.default,sx:{opacity:.5,width:18,height:18},style:{visibility:i?"visible":"hidden"}}))},...b}):(0,X.jsx)(p.Z,{px:1,className:"form-item-input slot",style:{whiteSpace:"pre-wrap"},children:L.filter((e=>d.some((n=>n.code===e)))).map((e=>(0,X.jsx)(W.Z,{label:d.find((n=>n.code===e)).name,style:{marginRight:8},size:"small"},e)))});return(0,X.jsx)(J.Z,{className:"form",style:r,children:(0,X.jsxs)(p.Z,{className:"form-item",children:[(0,X.jsxs)(p.Z,{className:"form-item-label",children:[n,i&&(0,X.jsx)(Y.Z,{})]}),(0,X.jsxs)(p.Z,{className:"form-item-body",children:[(0,X.jsx)(p.Z,{className:"form-item-input",children:O}),(0,X.jsx)(p.Z,{className:"form-item-action",children:Z?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(K.Z,{"data-cy":"schema-form-item-confirm",onClick:async()=>{k(!0);try{!1===await s("function"===typeof u?u(L):L)?P(w):v&&!L.length?(P(o),E(o)):(P(L),E(L))}catch(e){P(w)}finally{k(!1),j(!1)}},disabled:t||y,size:"large",children:y?(0,X.jsx)(F.Z,{size:24}):(0,X.jsx)(U.Z,{})}),(0,X.jsx)(K.Z,{"data-cy":"schema-form-item-cancel",onClick:()=>{P(w),j(!1)},disabled:t||y,size:"large",children:(0,X.jsx)(z.default,{})})]}):(0,X.jsx)(Q.Z,{triggers:c,onEnterEdit:()=>j(!0),disabled:t})})]}),Z&&m&&(0,X.jsx)(q.Z,{children:m})]})})}$.propTypes={style:s().object,onSubmit:s().func,onChange:s().func,label:s().string,initialValue:s().string,required:s().bool,disabled:s().bool,triggers:s().array,options:s().array,helperText:s().string,formatterBeforeSubmit:s().func,placeholder:s().string,renderImage:s().func,filterKeys:s().arrayOf(s().string),noEmpty:s().bool,renderLabel:s().func},$.defaultProps={style:{},onSubmit:()=>{},onChange:()=>{},label:"",initialValue:"",required:!1,disabled:!1,triggers:[],options:[],helperText:"",formatterBeforeSubmit:e=>e.join(","),placeholder:"",filterKeys:["name"],renderImage:()=>null,renderLabel:(e,n)=>"",noEmpty:!1};const ee=a.Z.div(i||(i=(0,o.Z)(["\n display: flex;\n justify-content: space-between;\n align-items: center;\n height: 48px;\n border-bottom: 1px solid rgba(0, 0, 0, 0.08);\n font-size: 1.1em;\n"]))),ne=(0,a.Z)(H.Z)((()=>({["& .".concat(G.Z.paper)]:{boxShadow:"0px 8px 12px rgba(92, 92, 92, 0.04), 0px -10px 12px rgba(92, 92, 92, 0.04)",borderRadius:"6px",width:"100%",border:"1px solid rgba(0, 0, 0, 0.12)",color:"inherit",fontSize:13,position:"absolute",left:0,top:0},["& .".concat(G.Z.listbox)]:{padding:0}})));var te,ie=t(22324),oe=t(64387),le=t(78903),ae=t(73881),re=t(69058),se=t(31853),ce=t(88577),de=t(10032),ue=t(48208),me=t(33650);function pe(e){let{initialValue:n,onChange:t,disabled:i,loading:o}=e;const{t:l}=(0,k.PE)(),{api:a}=(0,ue.T)(),{blocklet:r}=(0,me.y0)(),[s,c]=(0,se.Z)({newAppSk:"",isConnectOpen:!1}),d=()=>c({isConnectOpen:!1}),u=r.structVersion===m.APP_STRUCT_VERSION?[{key:"rotate-with-did-wallet",title:"Migrate with DID Wallet",handler:()=>{(0,oe.An)(r.status)?B.Z.error(l("blocklet.error.isRunning")):(0,S.isInProgress)(r.status)?B.Z.error(l("blocklet.error.isInProgress")):c({isConnectOpen:!0})}}]:[];return[(0,X.jsx)(D.Z,{disabled:i,loading:o,initialValue:n,onSubmit:e=>(c({newAppSk:e}),!1),triggers:u,secure:!0}),s.newAppSk&&(0,X.jsx)(de.Z,{title:l("blocklet.config.appSkTitle"),description:(0,X.jsxs)(p.Z,{children:[(0,X.jsx)(p.Z,{children:l("blocklet.config.appSkChangeTip")}),(0,X.jsx)(p.Z,{fontWeight:"bold",mt:2,children:l("blocklet.config.appDidChangeTip")}),(0,X.jsxs)(he,{children:[(0,X.jsx)("li",{children:l("blocklet.config.appDidChangeTipL1")}),(0,X.jsx)("li",{children:l("blocklet.config.appDidChangeTipL2")})]})]}),confirm:l("confirm"),cancel:l("cancel"),onConfirm:()=>(async e=>{try{await t(e)}finally{c({newAppSk:""})}})(s.newAppSk),onCancel:()=>c({newAppSk:""})}),(0,X.jsx)(ce.Z,{popup:!0,open:s.isConnectOpen,forceConnected:!1,saveConnect:!1,action:"rotate-key-pair",checkFn:a.get,checkTimeout:3e5,onSuccess:d,extraParams:{appDid:r.appDid},messages:{title:l("setup.keyPair.title"),scan:l("setup.keyPair.scan"),confirm:l("setup.keyPair.confirm"),success:l("setup.keyPair.success")},onClose:d})]}pe.propTypes={initialValue:s().string,onChange:s().func,disabled:s().bool,loading:s().bool},pe.defaultProps={initialValue:"default",onChange:()=>{},disabled:!1,loading:!1};const he=(0,a.Z)("ul")(te||(te=(0,o.Z)(["\n padding-left: 16px;\n li {\n margin-top: 8px;\n list-style: disk;\n font-weight: bold;\n }\n"])));var fe,ge=t(13128),xe=t(55372),ve=t(11750),be=t(88574),Ze=t(26174),je=t(88092),ye=t(69561),ke=t(84177);function Ce(e){let{onCancel:n,onSuccess:t,onError:i}=e;const{api:o}=(0,l.useContext)(ue.B),[a,r]=(0,l.useState)(!1),{t:s,locale:c}=(0,k.PE)(),[d,u]=(0,l.useState)(""),[m,h]=(0,l.useState)(!1),[f,g]=(0,l.useState)(0),[x,v]=(0,l.useState)(""),{endpoint:b}=(0,ke.DJ)(),[Z,j]=(0,l.useState)(!1),y=e=>{u(null),r(!0);try{v(e.result),g(S.length-1)}catch(n){const e=(0,oe.Z)(n);u(e),i(n)}finally{r(!1)}},C=()=>{h(!1),g(0)},S=[{body:(0,X.jsxs)(p.Z,{children:[(0,X.jsx)(ve.Z,{children:s("team.transferApp.transferDialog.tips.progress")}),(0,X.jsx)(ve.Z,{mt:3,mb:2,children:s("team.transferApp.transferDialog.tips.newOwnerPermissions")})]}),cancel:s("common.cancel"),confirm:s("team.transferApp.transferDialog.createTransferLink"),onCancel:n,onConfirm:()=>{h(!0),g(1)}},{body:()=>(0,X.jsx)(ce.Z,{action:"transfer-app-owner",open:m,locale:c,checkFn:o.get,onClose:C,onSuccess:y,checkTimeout:3e5,extraParams:{},messages:{title:s("team.transferApp.connectDialog.title"),scan:s("team.transferApp.connectDialog.scan"),confirm:s("team.transferApp.connectDialog.confirm"),success:s("team.transferApp.connectDialog.success")},popup:!0})},{body:()=>{const e=(0,oe.VP)({transferId:x.transferId,endpoint:b});return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(p.Z,{component:Se,dangerouslySetInnerHTML:{__html:s("team.transferApp.transferDialog.createSuccessTip1")}}),(0,X.jsx)(p.Z,{component:Se,mt:2,children:(0,X.jsx)(Se,{children:s("team.transferApp.transferDialog.createSuccessTip3")})}),(0,X.jsxs)(p.Z,{children:[(0,X.jsx)(p.Z,{component:Se,mt:2,children:(0,X.jsx)(Se,{children:s("team.transferApp.transferDialog.createSuccessTip2",{expireDate:(0,oe.B2)(x.expireDate,c)})})}),(0,X.jsx)(p.Z,{my:1,children:(0,X.jsx)(ye.Z,{children:e})})]}),(0,X.jsx)("div",{children:(0,X.jsx)(Ze.Z,{value:"end",control:(0,X.jsx)(je.Z,{checked:Z,onChange:e=>j(e.target.checked)}),label:s("team.transferApp.transferDialog.iKnow"),labelPlacement:"end"})})]})},confirm:s("common.confirm"),onConfirm:t}],w=S[f];return(0,X.jsxs)(ge.ZP,{title:(0,X.jsx)(Se,{className:"title",children:s("team.transferApp.transferDialog.title")}),fullWidth:!0,open:!0,showCloseButton:!1,actions:(0,X.jsxs)(X.Fragment,{children:[w.cancel&&(0,X.jsx)(_.Z,{onClick:w.onCancel,color:"inherit",children:w.cancel}),(0,X.jsxs)(_.Z,{onClick:w.onConfirm,color:"error",disabled:a||f===S.length-1&&!Z,variant:"contained",autoFocus:!0,children:[a&&(0,X.jsx)(F.Z,{size:16}),w.confirm]})]}),children:[(0,X.jsx)(xe.Z,{component:"div",children:"function"===typeof w.body?w.body():w.body}),!!d&&(0,X.jsx)(be.Z,{type:"error",variant:"icon",children:d})]})}Ce.propTypes={onCancel:s().func.isRequired,onSuccess:s().func.isRequired,onError:s().func},Ce.defaultProps={onError:()=>{}};const Se=a.Z.div(fe||(fe=(0,o.Z)(["\n font-size: 16px;\n font-weight: bold;\n &.title {\n font-size: 20px;\n }\n"])));var we,Ee=t(74655),Le=t(19197);const Pe=Object.keys(I.SUPPORTED_LANGUAGES).map((e=>({code:e,name:I.SUPPORTED_LANGUAGES[e].nativeName,enName:I.SUPPORTED_LANGUAGES[e].name}))),Te=["name","enName","code"];function Oe(e){var n;let{blocklet:t,onUpdate:i,hasPermission:o,...a}=e;const{api:r,inService:s,prefix:c,getSessionInHeader:d,ws:{useSubscription:u}}=(0,ie.h6)(),{t:h}=(0,l.useContext)(k.RD),[f,g]=(0,l.useState)(""),[x,v]=(0,l.useState)(""),[b,Z]=(0,l.useState)(!1),j=(0,S.getWhoCanAccess)(t),y=null===t||void 0===t||null===(n=t.settings)||void 0===n?void 0:n.publicToStore,C=x||!o,{logoUrl:w,rectLogoUrl:E,faviconUrl:L}=(0,Ee.Z)({blocklet:t}),{did:T}=t.meta,{site:F}=t,z=P()(t.meta,"capabilities.clusterMode",!1);if(u(m.EVENTS.NODE_RUNTIME_INFO,(e=>{z&&g(P()(e,"cpu.physicalCores",""))})),(0,oe.wS)(t.status))return null;const U=t.environments.find((e=>e.key===I.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_DELETABLE)),K=!U||"yes"===U.value,W=t.environments.find((e=>e.key===I.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_LANGUAGES)),q=t.environments.find((e=>e.key===I.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_URL)),M=t.environments.find((e=>e.key===I.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_TENANT_MODE)),G=(null===M||void 0===M?void 0:M.value)||I.BLOCKLET_TENANT_MODES.SINGLE,V=t.environments.find((e=>e.key===I.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_COPYRIGHT_OWNER)),H=t.environments.find((e=>e.key===I.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_COPYRIGHT_YEAR)),Y=[{key:I.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_NAME,description:h("blocklet.config.name"),value:t.environments.find((e=>"BLOCKLET_APP_NAME"===e.key)).value},{key:I.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_DESCRIPTION,description:h("blocklet.config.description"),value:t.environments.find((e=>"BLOCKLET_APP_DESCRIPTION"===e.key)).value},{key:I.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_URL,description:h("blocklet.config.appUrl"),value:q?q.value:""},{key:I.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_COPYRIGHT_OWNER,description:h("blocklet.config.copyrightOwner"),value:V?V.value:""},{key:I.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_COPYRIGHT_YEAR,description:h("blocklet.config.copyrightYear"),value:H?H.value:""}];if(z){const e=t.configs.find((e=>e.key===I.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_CLUSTER_SIZE)),n=e?e.value:f;Y.push({key:I.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_CLUSTER_SIZE,description:h("blocklet.config.clusterSize"),value:n,cpuCores:f})}const J=async(e,n)=>{if(e===I.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_CLUSTER_SIZE){const e=(0,oe.I)({value:n,cpuCores:f});if(e)return void B.Z.error(e)}const o=[{key:e,value:n}];try{v(!0);const{blocklet:e}=await r.configBlocklet({input:{did:t.meta.did,configs:o}});i(e)}catch(l){B.Z.error(l.message)}finally{v(!1)}},Q=(e,n)=>async o=>{if(!x){v(!0);try{const{checked:l}=o.target,{blocklet:a}=await r.configBlocklet({input:{did:t.meta.did,configs:[{key:I.BLOCKLET_CONFIGURABLE_KEY[e],value:n(l)}]}});i(a)}catch(l){B.Z.error(l.message)}finally{v(!1)}}},ee=Q("BLOCKLET_DELETABLE",(e=>e?"no":"yes")),ne=Q("BLOCKLET_APP_TENANT_MODE",(e=>e?I.BLOCKLET_TENANT_MODES.MULTIPLE:I.BLOCKLET_TENANT_MODES.SINGLE));return(0,X.jsxs)(Ae,{...a,children:[Y.map((e=>(0,X.jsxs)(p.Z,{className:"config-form",mt:2,children:[(0,X.jsx)(p.Z,{className:"config-label",fontSize:14,mb:0,children:e.description}),(0,X.jsx)(D.Z,{style:{marginTop:0},disabled:C,loading:x,initialValue:e.value,onSubmit:n=>J(e.key,n)})]}))),(0,X.jsx)(p.Z,{className:"config-form",component:R.Z,my:3}),(0,X.jsx)(p.Z,{className:"config-label",fontSize:14,mb:1,sx:{flexGrow:0,width:"auto"},children:h("blocklet.config.logoSquare")}),(0,X.jsx)(Le.Z,{did:t.meta.did,height:80,width:80,type:"square",prefix:c,url:w,enabled:o,headers:d}),(0,X.jsx)(p.Z,{className:"config-label",fontSize:14,mt:4,children:h("blocklet.config.logoRect")}),(0,X.jsx)(p.Z,{mb:1.5,className:"config-desc",children:h("blocklet.config.logoRectDesc")}),(0,X.jsx)(Le.Z,{did:t.meta.did,height:80,type:"rect",prefix:c,url:E,enabled:o,headers:d}),(0,X.jsx)(p.Z,{className:"config-label",fontSize:14,mt:4,children:h("blocklet.config.logoFavicon")}),(0,X.jsx)(p.Z,{mb:1.5,className:"config-desc",children:h("blocklet.config.logoFaviconDesc")}),(0,X.jsx)(Le.Z,{did:t.meta.did,height:25,width:25,type:"favicon",prefix:c,url:L,enabled:o,headers:d}),(0,X.jsx)(p.Z,{className:"config-form",children:"all"===j&&"registry"===t.source&&(0,X.jsxs)(p.Z,{className:"config-item",children:[(0,X.jsxs)(p.Z,{className:"config-label",children:[h("blocklet.config.access.publicToStore"),(0,X.jsx)(p.Z,{className:"config-desc",children:h("blocklet.config.access.publicInstanceTip")})]}),(0,X.jsx)(N.Z,{disabled:C,checked:y,defaultChecked:!0,onChange:async e=>{if(!x){v(!0);try{const{checked:n}=e.target,{blocklet:o}=await r.configPublicToStore({input:{did:t.meta.did,publicToStore:n}});i(o)}catch(n){B.Z.error(n.message)}finally{v(!1)}}}})]})}),(0,X.jsx)(p.Z,{className:"config-form",component:R.Z,my:3}),(0,X.jsxs)(p.Z,{className:"config-form",mt:2,children:[(0,X.jsx)(p.Z,{className:"config-label",fontSize:14,mb:0,children:h("blocklet.config.languages")}),(0,X.jsx)($,{style:{marginTop:0},disabled:C,loading:x,options:Pe,noEmpty:!0,initialValue:W?W.value.split(","):["en","zh"],onSubmit:e=>J("BLOCKLET_APP_LANGUAGES",e),helperText:h("blocklet.config.selectLanguagesTip"),placeholder:h("blocklet.config.languagesSearch"),filterKeys:Te,renderLabel:(e,n)=>n.name===n.enName?"".concat(n.name," (").concat(e.toUpperCase(),")"):"".concat(n.name,", ").concat(n.enName," (").concat(e.toUpperCase(),")")})]}),(0,X.jsx)(p.Z,{className:"config-form",component:R.Z,my:3}),(0,X.jsx)(p.Z,{className:"config-form",mt:2,children:(0,X.jsx)(p.Z,{className:"config-label",mb:0,children:h("common.security")})}),(0,X.jsxs)(p.Z,{className:"config-form",mt:2,children:[(0,X.jsx)(p.Z,{className:"config-label",fontSize:14,mb:0,children:h("router.domainSecurity.cors.title")}),(0,X.jsx)(p.Z,{mb:1.5,className:"config-desc",children:h("router.domainSecurity.cors.description",{name:"the blocklet"})}),(0,X.jsx)(D.Z,{style:{marginTop:0},disabled:C,loading:x,initialValue:(F.corsAllowedOrigins||[]).join(", "),onSubmit:async e=>{const n=F.corsAllowedOrigins||[],i=e.split(",").map((e=>e.trim())).filter(Boolean);if(O()(n,i))return!1;try{v(!0);const e=i.length?i:["__none__"];await r.updateRoutingSite({input:{id:F.id,corsAllowedOrigins:e,teamDid:t.meta.did}}),v(!1)}catch(o){return B.Z.error(o.message),v(!1),!1}return!0}})]}),(0,X.jsx)(p.Z,{className:"config-form",component:R.Z,my:3}),(0,X.jsx)(p.Z,{mb:2,className:"config-label",fontSize:20,children:h("blocklet.config.dangerZone")}),(0,X.jsxs)(p.Z,{px:2,py:1,sx:{border:"1px solid red",borderRadius:2},children:[(0,X.jsx)(p.Z,{className:"config-form",children:!s&&(0,X.jsxs)(p.Z,{className:"config-item",children:[(0,X.jsxs)(p.Z,{className:"config-label",children:[h("blocklet.config.deletable.name"),(0,X.jsx)(p.Z,{className:"config-desc",children:h(K?"blocklet.config.deletable.disable":"blocklet.config.deletable.enable")})]}),(0,X.jsx)(N.Z,{disabled:C,checked:!K,defaultChecked:!0,onChange:ee})]})}),(0,X.jsxs)(p.Z,{className:"config-form",mt:2,children:[(0,X.jsx)(p.Z,{className:"config-label",fontSize:14,mb:0,children:h("blocklet.config.sk")}),(0,X.jsx)(pe,{disabled:C,loading:x,initialValue:t.environments.find((e=>"BLOCKLET_APP_SK"===e.key)).value,onChange:async e=>{if(!x){v(!0);try{const{blocklet:n}=await r.configBlocklet({input:{did:t.meta.did,configs:[{key:I.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_SK,value:e}]}});i(n)}catch(n){B.Z.error(n.message)}finally{v(!1)}}}})]}),s&&(0,X.jsx)(ae.Z,{role:"owner",children:e=>(e||le.C)&&(0,X.jsxs)(p.Z,{className:"config-form",mt:2,children:[(0,X.jsxs)(p.Z,{className:"config-item",children:[(0,X.jsx)(p.Z,{className:"config-label",mb:0,children:h("team.transferApp.name")}),(0,X.jsxs)(_.Z,{style:{flexShrink:0},variant:"contained",edge:"end",color:"error",size:"small","data-cy":"transfer-app",onClick:()=>Z(!0),children:[(0,X.jsx)(A.Z,{style:{fontSize:"1.3em",marginRight:4}}),h("team.transferApp.name")]})]}),b&&(0,X.jsx)(Ce,{onCancel:()=>Z(!1),onSuccess:()=>Z(!1)})]})}),(0,X.jsx)(p.Z,{className:"config-form",mt:2,children:(0,X.jsxs)(p.Z,{className:"config-item",children:[(0,X.jsxs)(p.Z,{className:"config-label",children:[h("blocklet.config.clearCache.name"),(0,X.jsx)(p.Z,{className:"config-desc",children:h("blocklet.config.clearCache.purpose")})]}),(0,X.jsx)(re.Z,{teamDid:T})]})}),(0,X.jsx)(p.Z,{className:"config-form",children:(0,X.jsxs)(p.Z,{className:"config-item",children:[(0,X.jsxs)(p.Z,{className:"config-label",children:[h("blocklet.config.tenantMode.name"),(0,X.jsx)(p.Z,{className:"config-desc",children:h("blocklet.config.tenantMode.".concat(G))})]}),(0,X.jsx)(N.Z,{disabled:C,checked:G===I.BLOCKLET_TENANT_MODES.MULTIPLE,onChange:ne})]})})]})]})}const Ne=(0,ae.V)(Oe,"mutate_blocklets"),Re=(0,ae.V)(Oe,"",oe.Wf);function _e(e){const{inService:n}=(0,ie.h6)();return n?(0,X.jsx)(Re,{...e}):(0,X.jsx)(Ne,{...e})}Oe.propTypes={blocklet:s().object.isRequired,onUpdate:s().func,hasPermission:s().bool},Oe.defaultProps={onUpdate:()=>{},hasPermission:!1};const Ae=a.Z.div(we||(we=(0,o.Z)(["\n padding-top: 24px;\n .config-form {\n flex-grow: 1;\n overflow-y: auto;\n "," {\n width: 100%;\n flex-shrink: 0;\n padding: 0 24px;\n transform: translate(0, 0);\n }\n }\n\n .config-item {\n display: flex;\n align-items: center;\n justify-content: space-between;\n margin: 16px 0;\n }\n\n .config-label {\n font-weight: bold;\n }\n\n .config-desc {\n font-weight: normal;\n font-size: 12px;\n color: #666;\n }\n\n .form-item {\n margin-top: 0;\n }\n"])),(e=>e.theme.breakpoints.down("md")));var Ie=t(25710),Be=t(93066),De=t(80576),Fe=t(8708),ze=t.n(Fe),Ue=t(12673),Ke=t(99360),We=t(80506),qe=t(766),Me=t.n(qe),Ge=t(24529),Ve=t.n(Ge),He=t(16727),Ye=t.n(He),Je=t(92706),Qe=t.n(Je);const Xe=(0,l.forwardRef)(((e,n)=>{const{t:t}=(0,l.useContext)(k.RD),i=(0,Ue.Z)({show:!1,title:"",content:"",onConfirm:Qe(),onCancel:Qe(),loading:!1}),o=(0,Ke.Z)((function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};i.show=!0,i.title=e.title,i.content=e.content,i.onConfirm=e.onConfirm||Qe(),i.onCancel=e.onCancel||Qe(),i.loading=!1})),a=(0,Ke.Z)((()=>{i.title="",i.content="",i.onConfirm=Qe(),i.onCancel=Qe()})),r=(0,Ke.Z)((()=>{i.show=!1,setTimeout((()=>{a()}),300)})),s=(0,Ke.Z)((()=>{r(),null===i||void 0===i||i.onCancel()}),[]),c=(0,Ke.Z)((async()=>{i.loading=!0;try{await(null===i||void 0===i?void 0:i.onConfirm(r))}finally{i.loading=!1}}),[]);return(0,l.useImperativeHandle)(n,(()=>({open:o,close:r})),[o,r]),(0,X.jsx)(ge.I4,{open:i.show,title:i.title,onConfirm:c,onCancel:s,confirmButton:{text:t("common.confirm"),props:{variant:"contained",color:"primary",loading:i.loading}},cancelButton:{text:t("common.cancel"),props:{variant:"outlined",color:"primary"}},children:i.content instanceof Function?i.content():i.content})}));function $e(){const e=(0,l.useRef)(null),n=(0,Ke.Z)((function(){for(var n,t=arguments.length,i=new Array(t),o=0;o<t;o++)i[o]=arguments[o];null===(n=e.current)||void 0===n||n.open(...i)})),t=(0,Ke.Z)((function(){for(var n,t=arguments.length,i=new Array(t),o=0;o<t;o++)i[o]=arguments[o];null===(n=e.current)||void 0===n||n.close(...i)})),i={open:n,close:t};return{confirmHolder:(0,X.jsx)(Xe,{ref:e}),confirmApi:i}}const en={enabled:!1,secure:!1,from:"",host:"",port:"",user:"",password:""};const nn=function(){var e,n;const{api:t}=(0,ie.h6)(),{blocklet:i}=(0,me.y0)(),{t:o}=(0,k.PE)(),{confirmApi:l,confirmHolder:a}=$e(),r=null===i||void 0===i||null===(e=i.meta)||void 0===e?void 0:e.did,s=Object.assign({...en},(null===i||void 0===i||null===(n=i.settings)||void 0===n||null===(n=n.notification)||void 0===n?void 0:n.email)||{}),{handleSubmit:c,control:d,formState:u,watch:m,reset:h}=(0,We.cI)({defaultValues:ze()(s,Object.keys(en))}),f=(0,Ue.Z)({testReceiver:"",testReceiverError:""}),g=m("enabled"),x=(0,Ke.Z)((async function(e,n){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];try{var l;const{blocklet:n}=await t.configNotification({input:{did:r,notification:JSON.stringify({email:e})}}),a=Object.assign({...en},(null===n||void 0===n||null===(l=n.settings)||void 0===l||null===(l=l.notification)||void 0===l?void 0:l.email)||{});h(a),i&&B.Z.success(o("oauth.saveSuccess"))}catch(a){if(!i)throw a;B.Z.error(a.message||o("oauth.saveFailed"))}})),v=(0,Ke.Z)((async(e,n,i)=>{try{u.isDirty&&await x(e,n,!1),await t.sendEmail({input:{did:r,receiver:i,email:JSON.stringify({body:"Your SMTP configuration is correct!",title:"Test email",type:"notification"})}}),B.Z.success(o("notification.email.testSuccess"))}catch(l){B.Z.error(l.message||o("notification.email.testfailed"))}})),b=(0,Ke.Z)(((e,n)=>{f.testReceiver="",f.testReceiverError="",l.open({title:o("notification.email.testSendEmail"),content:()=>(0,X.jsx)(p.Z,{sx:{width:"300px"},children:(0,X.jsx)(V.Z,{fullWidth:!0,name:"testReceiver",label:o("notification.email.inputTestReceiver"),value:f.testReceiver,onChange:e=>{f.testReceiver=e.target.value},error:!!f.testReceiverError,helperText:f.testReceiverError||"\u3000"})}),async onConfirm(t){var i;const l=null===(i=f.testReceiver)||void 0===i?void 0:i.trim();l?Me()(l)?(f.testReceiverError="",await v(e,n,l),t()):f.testReceiverError=o("notification.email.receiverInvalid"):f.testReceiverError=o("notification.email.receiverRequired")}})})),Z=(0,Ke.Z)((e=>{const n=null===e||void 0===e?void 0:e.trim();return n?!!Me()(n)||o("notification.email.fromInvalid"):o("notification.email.fromRequired")})),j=(0,Ke.Z)((e=>{const n=null===e||void 0===e?void 0:e.trim();return n?!!Ve()(n,{require_host:!1,protocols:[]})||o("notification.email.hostInvalid"):o("notification.email.hostRequired")})),y=(0,Ke.Z)((e=>e?!!Ye()(e)||o("notification.email.portInvalid"):o("notification.email.portRequired"))),C=(0,Ke.Z)((e=>!(null===e||void 0===e||!e.trim())||o("notification.email.userRequired"))),S=(0,Ke.Z)((e=>!(null===e||void 0===e||!e.trim())||o("notification.email.passwordRequired"))),w=(0,Ke.Z)((()=>!0));return(0,X.jsxs)(p.Z,{children:[(0,X.jsxs)("form",{onSubmit:c(x),disabled:!0,children:[(0,X.jsx)(We.Qr,{name:"enabled",control:d,render:e=>{let{field:n}=e;return(0,X.jsx)(Ze.Z,{control:(0,X.jsx)(N.Z,{checked:n.value,...n}),label:o("notification.email.enable"),sx:{marginBottom:"8px"}})}}),(0,X.jsx)(We.Qr,{name:"from",control:d,rules:{validate:g?Z:w},render:e=>{var n;let{field:t}=e;return(0,X.jsx)(De.Z,{fullWidth:!0,children:(0,X.jsx)(V.Z,{...t,label:o("notification.email.from"),error:!!u.errors[t.name],helperText:(null===(n=u.errors[t.name])||void 0===n?void 0:n.message)||"\u3000",disabled:!g})})}}),(0,X.jsx)(We.Qr,{name:"host",control:d,rules:{validate:g?j:w},render:e=>{var n;let{field:t}=e;return(0,X.jsx)(De.Z,{fullWidth:!0,children:(0,X.jsx)(V.Z,{...t,error:!!u.errors[t.name],label:o("notification.email.host"),helperText:(null===(n=u.errors[t.name])||void 0===n?void 0:n.message)||"\u3000",disabled:!g})})}}),(0,X.jsx)(We.Qr,{name:"port",control:d,rules:{validate:g?y:w},render:e=>{var n;let{field:t}=e;return(0,X.jsx)(De.Z,{fullWidth:!0,children:(0,X.jsx)(V.Z,{...t,type:"number",error:!!u.errors[t.name],label:o("notification.email.port"),helperText:(null===(n=u.errors[t.name])||void 0===n?void 0:n.message)||"\u3000",disabled:!g})})}}),(0,X.jsx)(We.Qr,{name:"user",control:d,rules:{validate:g?C:w},render:e=>{var n;let{field:t}=e;return(0,X.jsx)(De.Z,{fullWidth:!0,children:(0,X.jsx)(V.Z,{...t,error:!!u.errors[t.name],label:o("notification.email.user"),helperText:(null===(n=u.errors[t.name])||void 0===n?void 0:n.message)||"\u3000",disabled:!g})})}}),(0,X.jsx)(We.Qr,{name:"password",control:d,rules:{validate:g?S:w},render:e=>{var n;let{field:t}=e;return(0,X.jsx)(De.Z,{fullWidth:!0,children:(0,X.jsx)(V.Z,{...t,type:"password",error:!!u.errors[t.name],label:o("notification.email.password"),helperText:(null===(n=u.errors[t.name])||void 0===n?void 0:n.message)||"\u3000",disabled:!g})})}}),(0,X.jsx)(We.Qr,{name:"secure",control:d,rules:{validate:w},render:e=>{let{field:n}=e;return(0,X.jsx)(De.Z,{fullWidth:!0,children:(0,X.jsx)(Ze.Z,{control:(0,X.jsx)(N.Z,{checked:n.value,...n,disabled:!g}),label:o("notification.email.secure"),style:{marginBottom:16}})})}}),(0,X.jsx)(_.Z,{variant:"outlined",color:"warning",onClick:c(b),sx:{mr:2},disabled:!g,children:o("oauth.runTest")}),(0,X.jsx)(_.Z,{type:"submit",variant:"contained",disabled:!u.isDirty,children:o("oauth.save")})]}),a]})},tn=[{label:(0,X.jsx)(p.Z,{textAlign:"center",width:"100%",children:"Email"}),value:"email"},{label:(0,X.jsx)(p.Z,{textAlign:"center",width:"100%",children:"More"}),value:"more"}];const on=function(){const[e,n]=(0,l.useState)(tn[0].value),{t:t}=(0,l.useContext)(k.RD),i=(0,Be.Z)((()=>({email:(0,X.jsx)(nn,{}),more:(0,X.jsx)(p.Z,{children:(0,X.jsx)(Ie.Z,{children:t("notification.comingSoon")})})})),[t]);return(0,X.jsxs)(p.Z,{children:[(0,X.jsx)(C.Z,{tabs:tn,current:e,onChange:n}),(0,X.jsx)(p.Z,{marginTop:"10px",children:i[e]})]})};var ln=t(96366),an=t(75239),rn=t(48342),sn=t(94552),cn=t(24558),dn=t(53777),un=t(74490),mn=t(76667),pn=t(70648),hn=t(44067),fn=t(7664),gn=t(44123),xn=t(53906);const vn=[{value:m.WHO_CAN_ACCESS.ALL,icon:xn.Z,title:{zh:"\u6240\u6709\u4eba\u53ef\u8bbf\u95ee",en:"Accessible to all"},description:{zh:"\u5411\u6240\u6709\u4eba\u5f00\u653e\uff0c\u65e0\u9700\u901a\u884c\u8bc1\u5373\u53ef\u8bbf\u95ee\u5e94\u7528",en:"Open to the world anyone can access without passport"}},{value:m.WHO_CAN_ACCESS.INVITED,icon:gn.Z,title:{zh:"\u53ea\u6709\u88ab\u9080\u8bf7\u7684\u4eba\u53ef\u4ee5\u8bbf\u95ee",en:"Only invited people can access"},description:{zh:"\u7a0d\u540e\u60a8\u53ef\u4ee5\u5728\u7ba1\u7406\u9875\u9762\u4e2d\u9080\u8bf7\u6210\u5458",en:"You can invite members later in the admin page"}},{value:m.WHO_CAN_ACCESS.OWNER,icon:fn.Z,title:{zh:"\u53ea\u6709\u5e94\u7528\u6240\u6709\u8005\u53ef\u4ee5\u8bbf\u95ee",en:"Only Owner of the blocklet can access"},description:{zh:"\u5fc5\u987b\u63d0\u4f9b\u6240\u6709\u8005\u901a\u884c\u8bc1\u624d\u80fd\u8bbf\u95ee\u5e94\u7528",en:"You must provide owner passport to access this application"}}];var bn,Zn;const jn="roles",yn=[...vn,{value:jn,icon:pn.Z,title:{zh:"\u6307\u5b9a\u901a\u884c\u8bc1\u53ef\u8bbf\u95ee",en:"Accessible to selected passports"},description:{zh:"\u53ea\u6709\u6307\u5b9a\u7684\u901a\u884c\u8bc1\u53ef\u4ee5\u8bbf\u95ee",en:"Only specified passports can access"}}],kn=(e,n)=>{if(e&&e.startsWith(m.WHO_CAN_ACCESS_PREFIX_ROLES)){const t=(0,S.getRolesFromAuthConfig)({whoCanAccess:e}),i=n.filter((e=>t.includes(e.name)));return{access:jn,roles:i}}return{access:e,roles:[]}},Cn=function(e,n){let{roles:t=[]}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const i=(e.configs||[]).find((e=>e.key===I.BLOCKLET_CONFIGURABLE_KEY.COMPONENT_ACCESS_WHO));if(i)return kn(i.value,t);if(n&&P()(n,"settings.whoCanAccess")&&P()(n,"settings.whoCanAccess")!==m.WHO_CAN_ACCESS.ALL)return kn(P()(n,"settings.whoCanAccess"),t);const o=(0,S.findServiceFromMeta)(e.meta,m.NODE_SERVICES.AUTH);return P()(o,"config.whoCanAccess")?kn(o.config.whoCanAccess,t):{access:m.WHO_CAN_ACCESS.ALL,roles:[]}};function Sn(e){let{blocklet:n,ancestors:t,children:i}=e;const o=(0,ln.Z)(),[a,r]=(0,l.useState)(""),{t:s,locale:c}=(0,k.PE)(),{api:d}=(0,ie.h6)(),{roles:u}=(0,ke.DJ)(),[h,f]=(0,l.useState)(""),g=t[0]||n,{access:x,roles:v}=Cn(n,g,{roles:u}),[b,Z]=(0,l.useState)(x),[j,y]=(0,l.useState)(v),C=[...t.map((e=>e.meta.did)),n.meta.did],w={marginRight:4,fontSize:18,verticalAlign:"text-bottom",color:o.palette.text.secondary},E=t.concat(n).map((e=>(0,S.getDisplayName)(e,!0))).join(" / ");if((0,oe.wS)(n.status))return null;if("unknown"===n.status&&(0,oe.wS)(n.status))return null;const L=()=>{r(!1)},P=e=>{e.stopPropagation(),r(!0)},T=h||b===jn&&!j.length;return["function"===typeof i?i({open:P}):(0,X.jsx)(K.Z,{onClick:P,"data-cy":"action-config-component",children:(0,X.jsx)(mn.default,{})}),a&&(0,X.jsxs)(wn,{open:!0,fullWidth:!0,title:E,onClose:L,PaperProps:{style:{minHeight:"auto"}},actions:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(_.Z,{onClick:L,color:"inherit","data-cy":"config-access-cancel",children:s("common.cancel")}),(0,X.jsxs)(_.Z,{onClick:async()=>{if(!h){f(!0);try{let e=b;e===jn&&(e="".concat(m.WHO_CAN_ACCESS_PREFIX_ROLES).concat(j.map((e=>e.name)).join(","))),await d.updateWhoCanAccess({input:{did:C,whoCanAccess:e}}),B.Z.success(s("blocklet.config.access.updatedTip")),L(),f(!1)}catch(e){f(!1),B.Z.error((0,oe.Z)(e))}}},color:"primary",disabled:T,variant:"contained",autoFocus:!0,"data-cy":"config-access-confirm",children:[h&&(0,X.jsx)(F.Z,{size:16}),s("common.confirm")]})]}),children:[(0,X.jsx)(p.Z,{mt:4,mb:3,children:(0,X.jsx)(V.Z,{label:s("blocklet.config.access.description"),select:!0,fullWidth:!0,value:b,onChange:e=>{const{value:n}=e.target;Z(n)},"data-cy":"config-access-select",SelectProps:{renderValue:e=>{const n=yn.find((n=>n.value===e));return n?(0,X.jsxs)(p.Z,{children:[(0,X.jsx)(n.icon,{style:w}),n.title[c]]}):null}},children:yn.map((e=>(0,X.jsxs)(En,{value:e.value,sx:{display:"block"},"data-cy":"config-access-opt-".concat(e.value),children:[(0,X.jsxs)(p.Z,{display:"flex",alignItems:"center",children:[(0,X.jsx)(e.icon,{style:w}),(0,X.jsx)(p.Z,{children:e.title[c]})]}),(0,X.jsx)(p.Z,{children:(0,X.jsx)(p.Z,{className:"tip",children:e.description[c]})})]})))})}),b===jn&&(0,X.jsx)(p.Z,{mt:4,mb:3,children:(0,X.jsx)(V.Z,{label:s("blocklet.config.access.description"),select:!0,fullWidth:!0,value:j.map((e=>e.name)),onChange:e=>{y(u.filter((n=>(e.target.value||[]).includes(n.name))))},SelectProps:{multiple:!0,renderValue:e=>(0,X.jsx)(p.Z,{sx:{display:"flex",flexWrap:"wrap",gap:.5},children:e.map((e=>{const n=u.find((n=>n.name===e));return(0,X.jsx)(W.Z,{label:n.title},n.text)}))})},children:u.map((e=>{let{name:n,title:t}=e;return(0,X.jsxs)(un.Z,{value:n,children:[(0,X.jsx)(je.Z,{checked:j.some((e=>e.name===n))}),(0,X.jsx)(hn.Z,{primary:t})]},n)}))})})]})]}Sn.propTypes={blocklet:s().object.isRequired,ancestors:s().array,children:s().any},Sn.defaultProps={ancestors:[],children:null};const wn=(0,a.Z)(ge.ZP)(bn||(bn=(0,o.Z)(["\n .MuiDialogContent-root {\n padding-top: 0;\n margin-top: -32px;\n }\n .MuiToolbar-root {\n padding-right: 12px;\n }\n .ux-dialog_right {\n padding-right: 20px;\n }\n"]))),En=(0,a.Z)(un.Z)(Zn||(Zn=(0,o.Z)(["\n .tip {\n font-size: 12px;\n color: ",";\n }\n"])),(e=>e.theme.palette.text.secondary));var Ln;function Pn(e){var n;let{blocklet:t,ancestors:i,depth:o}=e;const a=(0,ln.Z)(),{t:r,locale:s}=(0,k.PE)(),{roles:c}=(0,ke.DJ)(),[d,u]=(0,l.useState)(!0),{recommendedDomain:m}=(0,me.y0)(),h=i[0]||t,f="/".concat(i.map((e=>e.mountPoint||"/")).join("/"),"/").concat(t.mountPoint||"/").replace(/\/+/g,"/"),g=(0,oe.vH)({blocklet:h,domain:{value:m},mountPoint:f,params:(0,oe.f0)(h,s)}),x={fill:a.palette.text.secondary},v=o>0&&t.children.length>0,b=(0,X.jsx)(K.Z,{size:"small",children:d?(0,X.jsx)(j.Z,{fontSize:"inherit"}):(0,X.jsx)(Z.default,{fontSize:"inherit"})}),{access:y,roles:C}=Cn(t,h,{roles:c});let E;if("roles"!==y)E=vn.find((e=>e.value===y))||vn[2];else{const e=C.map((e=>e.title)).join("/");E={title:{zh:"\u53ea\u6709 ".concat(e," \u53ef\u4ee5\u8bbf\u95ee"),en:"Only ".concat(e," can access")}}}return[(o>0||"gateway"!==t.meta.group)&&(0,X.jsxs)(p.Z,{display:"flex",py:2,className:"component-item",justifyContent:"space-between",alignItems:"center",children:[(0,X.jsxs)(p.Z,{pl:Math.max(2*(o-1),0),width:{xs:300,md:400},display:"flex",alignItems:"center",style:{cursor:v?"pointer":"cursor"},onClick:()=>v&&u(!d),children:[v?b:(0,X.jsx)(p.Z,{width:28}),(0,X.jsx)(w.Z,{blocklet:t,ancestors:i}),(0,X.jsxs)(p.Z,{ml:"16px",children:[(0,X.jsx)(p.Z,{style:{color:"#222",fontSize:18},children:(0,S.getDisplayName)(t,!0)}),(0,X.jsx)(p.Z,{display:"flex",alignItems:"center",children:(0,X.jsx)(p.Z,{color:"text.secondary",children:E.title[s]})})]})]},t),(0,X.jsxs)(p.Z,{children:[(0,X.jsx)(an.Z,{title:r("common.visit"),children:(0,X.jsx)("a",{target:"_blank",href:g,rel:"noopener noreferrer",title:g,children:(0,X.jsx)(K.Z,{children:(0,X.jsx)(sn.Z,{})})})}),(0,X.jsx)(Sn,{blocklet:t,ancestors:i,children:e=>{let{open:n}=e;return(0,X.jsx)(an.Z,{title:r("common.edit"),children:(0,X.jsx)(K.Z,{onClick:n,"data-cy":"btn-edit-".concat(t.meta.did),children:(0,X.jsx)(cn.Z,{style:x})})})}})]},"actions")]},"group-not-gateway-box"),(0,X.jsx)(dn.Z,{depth:o},"line"),null!==(n=t.children)&&void 0!==n&&n.length?(0,X.jsx)(rn.Z,{in:d,children:t.children.map((e=>(0,X.jsx)(Pn,{blocklet:e,ancestors:[...i,t],depth:o+1},"".concat(o+1,"-").concat(e.meta.did))))},"blocklet-collapse"):null]}function Tn(){const{t:e}=(0,k.PE)(),{blocklet:n}=(0,me.y0)(),t=[...n.children]||[];return"gateway"!==n.meta.group&&t.unshift(n),(0,X.jsx)(On,{component:"div",children:t&&t.length?[(0,X.jsx)(p.Z,{mt:2,ml:{xs:"-12px",md:"-24px"},style:{maxWidth:1080},children:(0,X.jsx)(Pn,{blocklet:n},"0-".concat(n.meta.did))},"top-blocklet-".concat(n.meta.did))]:(0,X.jsx)(p.Z,{mt:8,children:(0,X.jsx)(Ie.Z,{children:e("blocklet.component.noComponent")})})})}Pn.propTypes={blocklet:s().object.isRequired,ancestors:s().array,depth:s().number},Pn.defaultProps={ancestors:[],depth:0},Tn.propTypes={};const On=(0,a.Z)(p.Z)(Ln||(Ln=(0,o.Z)(["\n .title {\n font-size: 1.2rem;\n font-weight: bold;\n margin-top: ",";\n margin-bottom: ",";\n &.first {\n margin-top: 0;\n }\n }\n"])),(e=>e.theme.spacing(5)),(e=>e.theme.spacing(3)));var Nn=t(36095),Rn=t(20877),_n=t(55498),An=t(21764),In=t(25125),Bn=t(13573),Dn=t(69210),Fn=t(56556),zn=t(67357);const Un={enabled:!1,domain:"",clientId:"",clientSecret:""};const Kn=function(){var e,n;const{api:t}=(0,ie.h6)(),{blocklet:i}=(0,me.y0)(),{t:o}=(0,k.PE)(),l=null===i||void 0===i||null===(e=i.meta)||void 0===e?void 0:e.did,a=Object.assign({...Un},(null===i||void 0===i||null===(n=i.settings)||void 0===n||null===(n=n.oauth)||void 0===n?void 0:n.auth0)||{}),{handleSubmit:r,control:s,formState:c,watch:d,reset:u}=(0,We.cI)({defaultValues:ze()(a,Object.keys(Un))}),m=d("enabled"),h=(0,Ke.Z)((async e=>{try{var n;const{blocklet:i}=await t.configOAuth({input:{did:l,oauth:JSON.stringify({auth0:e})}}),a=Object.assign({...Un},(null===i||void 0===i||null===(n=i.settings)||void 0===n||null===(n=n.oauth)||void 0===n?void 0:n.auth0)||{});u(a),B.Z.success(o("oauth.saveSuccess"))}catch(i){B.Z.error(i.message||o("oauth.saveFailed"))}})),f=(0,Ke.Z)((e=>!(null===e||void 0===e||!e.trim())||o("oauth.auth0.domainDescription"))),g=(0,Ke.Z)((e=>!(null===e||void 0===e||!e.trim())||o("oauth.auth0.clientIdDescription"))),x=(0,Ke.Z)((e=>!(null===e||void 0===e||!e.trim())||o("oauth.auth0.clientSecretDescription"))),v=(0,Ke.Z)((()=>!0));return(0,X.jsx)(p.Z,{children:(0,X.jsxs)("form",{onSubmit:r(h),disabled:!0,children:[(0,X.jsx)(We.Qr,{name:"enabled",control:s,render:e=>{let{field:n}=e;return(0,X.jsx)(Ze.Z,{control:(0,X.jsx)(zn.Z,{checked:n.value,style:{marginRight:"6px"},...n}),label:o("oauth.auth0.enable"),sx:{marginBottom:2,ml:1}})}}),(0,X.jsx)(We.Qr,{name:"domain",control:s,rules:{validate:m?f:v},render:e=>{var n;let{field:t}=e;return(0,X.jsx)(De.Z,{fullWidth:!0,children:(0,X.jsx)(V.Z,{...t,label:o("oauth.auth0.domain"),error:!!c.errors[t.name],helperText:(null===(n=c.errors[t.name])||void 0===n?void 0:n.message)||"\u3000",disabled:!m})})}}),(0,X.jsx)(We.Qr,{name:"clientId",control:s,rules:{validate:m?g:v},render:e=>{var n;let{field:t}=e;return(0,X.jsx)(De.Z,{fullWidth:!0,children:(0,X.jsx)(V.Z,{...t,error:!!c.errors[t.name],label:o("oauth.auth0.clientId"),helperText:(null===(n=c.errors[t.name])||void 0===n?void 0:n.message)||"\u3000",disabled:!m})})}}),(0,X.jsx)(We.Qr,{name:"clientSecret",control:s,rules:{validate:m?x:v},render:e=>{var n;let{field:t}=e;return(0,X.jsx)(De.Z,{fullWidth:!0,children:(0,X.jsx)(V.Z,{...t,type:"password",error:!!c.errors[t.name],label:o("oauth.auth0.clientSecret"),helperText:(null===(n=c.errors[t.name])||void 0===n?void 0:n.message)||"\u3000",disabled:!m})})}}),(0,X.jsx)(Fn.Z,{type:"submit",variant:"contained",onSubmit:r(h),disabled:!c.isDirty,children:o("oauth.save")})]})})},Wn={enabled:!1,clientId:"",clientSecret:""};const qn=function(){var e,n;const{api:t}=(0,ie.h6)(),{blocklet:i}=(0,me.y0)(),{t:o}=(0,k.PE)(),l=null===i||void 0===i||null===(e=i.meta)||void 0===e?void 0:e.did,a=Object.assign({...Wn},(null===i||void 0===i||null===(n=i.settings)||void 0===n||null===(n=n.oauth)||void 0===n?void 0:n.github)||{}),{handleSubmit:r,control:s,formState:c,watch:d,reset:u}=(0,We.cI)({defaultValues:ze()(a,Object.keys(Wn))}),m=d("enabled"),h=(0,Ke.Z)((async e=>{try{var n;const{blocklet:i}=await t.configOAuth({input:{did:l,oauth:JSON.stringify({github:e})}}),a=Object.assign({...Wn},(null===i||void 0===i||null===(n=i.settings)||void 0===n||null===(n=n.oauth)||void 0===n?void 0:n.github)||{});u(a),B.Z.success(o("oauth.saveSuccess"))}catch(i){B.Z.error(i.message||o("oauth.saveFailed"))}})),f=(0,Ke.Z)((e=>!(null===e||void 0===e||!e.trim())||o("oauth.github.clientIdDescription"))),g=(0,Ke.Z)((e=>!(null===e||void 0===e||!e.trim())||o("oauth.github.clientSecretDescription"))),x=(0,Ke.Z)((()=>!0));return(0,X.jsx)(p.Z,{children:(0,X.jsxs)("form",{onSubmit:r(h),disabled:!0,children:[(0,X.jsx)(We.Qr,{name:"enabled",control:s,render:e=>{let{field:n}=e;return(0,X.jsx)(Ze.Z,{control:(0,X.jsx)(zn.Z,{checked:n.value,style:{marginRight:"6px"},...n}),label:o("oauth.github.enable"),sx:{marginBottom:2,ml:1}})}}),(0,X.jsx)(We.Qr,{name:"clientId",control:s,rules:{validate:m?f:x},render:e=>{var n;let{field:t}=e;return(0,X.jsx)(De.Z,{fullWidth:!0,children:(0,X.jsx)(V.Z,{...t,error:!!c.errors[t.name],label:o("oauth.github.clientId"),helperText:(null===(n=c.errors[t.name])||void 0===n?void 0:n.message)||"\u3000",disabled:!m})})}}),(0,X.jsx)(We.Qr,{name:"clientSecret",control:s,rules:{validate:m?g:x},render:e=>{var n;let{field:t}=e;return(0,X.jsx)(De.Z,{fullWidth:!0,children:(0,X.jsx)(V.Z,{...t,type:"password",label:o("oauth.github.clientSecret"),error:!!c.errors[t.name],helperText:(null===(n=c.errors[t.name])||void 0===n?void 0:n.message)||"\u3000",disabled:!m})})}}),(0,X.jsx)(Fn.Z,{type:"submit",variant:"contained",onSubmit:r(h),disabled:!c.isDirty,children:o("oauth.save")})]})})},Mn={enabled:!1,clientId:"",clientSecret:""};const Gn=function(){var e,n;const{api:t}=(0,ie.h6)(),{blocklet:i}=(0,me.y0)(),{t:o}=(0,k.PE)(),l=null===i||void 0===i||null===(e=i.meta)||void 0===e?void 0:e.did,a=Object.assign({...Mn},(null===i||void 0===i||null===(n=i.settings)||void 0===n||null===(n=n.oauth)||void 0===n?void 0:n.google)||{}),{handleSubmit:r,control:s,formState:c,watch:d,reset:u}=(0,We.cI)({defaultValues:ze()(a,Object.keys(Mn))}),m=d("enabled"),h=(0,Ke.Z)((async e=>{try{var n;const{blocklet:i}=await t.configOAuth({input:{did:l,oauth:JSON.stringify({google:e})}}),a=Object.assign({...Mn},(null===i||void 0===i||null===(n=i.settings)||void 0===n||null===(n=n.oauth)||void 0===n?void 0:n.google)||{});u(a),B.Z.success(o("oauth.saveSuccess"))}catch(i){B.Z.error(i.message||o("oauth.saveFailed"))}})),f=(0,Ke.Z)((e=>!(null===e||void 0===e||!e.trim())||o("oauth.google.clientIdDescription"))),g=(0,Ke.Z)((e=>!(null===e||void 0===e||!e.trim())||o("oauth.google.clientSecretDescription"))),x=(0,Ke.Z)((()=>!0));return(0,X.jsx)(p.Z,{children:(0,X.jsxs)("form",{onSubmit:r(h),disabled:!0,children:[(0,X.jsx)(We.Qr,{name:"enabled",control:s,render:e=>{let{field:n}=e;return(0,X.jsx)(Ze.Z,{control:(0,X.jsx)(zn.Z,{checked:n.value,style:{marginRight:"6px"},...n}),label:o("oauth.google.enable"),sx:{marginBottom:2,ml:1}})}}),(0,X.jsx)(We.Qr,{name:"clientId",control:s,rules:{validate:m?f:x},render:e=>{var n;let{field:t}=e;return(0,X.jsx)(De.Z,{fullWidth:!0,children:(0,X.jsx)(V.Z,{...t,error:!!c.errors[t.name],label:o("oauth.google.clientId"),helperText:(null===(n=c.errors[t.name])||void 0===n?void 0:n.message)||"\u3000",disabled:!m})})}}),(0,X.jsx)(We.Qr,{name:"clientSecret",control:s,rules:{validate:m?g:x},render:e=>{var n;let{field:t}=e;return(0,X.jsx)(De.Z,{fullWidth:!0,children:(0,X.jsx)(V.Z,{...t,type:"password",label:o("oauth.google.clientSecret"),error:!!c.errors[t.name],helperText:(null===(n=c.errors[t.name])||void 0===n?void 0:n.message)||"\u3000",disabled:!m})})}}),(0,X.jsx)(Fn.Z,{type:"submit",variant:"contained",onSubmit:r(h),disabled:!c.isDirty,children:o("oauth.save")})]})})},Vn={enabled:!1,teamId:"",serviceId:"",keyId:"",authKey:"",bundleId:""};const Hn=function(){var e,n;const{api:t}=(0,ie.h6)(),{blocklet:i}=(0,me.y0)(),{t:o}=(0,k.PE)(),l=null===i||void 0===i||null===(e=i.meta)||void 0===e?void 0:e.did,a=Object.assign({...Vn},(null===i||void 0===i||null===(n=i.settings)||void 0===n||null===(n=n.oauth)||void 0===n?void 0:n.apple)||{}),{handleSubmit:r,control:s,formState:c,watch:d,reset:u}=(0,We.cI)({defaultValues:ze()(a,Object.keys(Vn))}),m=d("enabled"),h=(0,Ke.Z)((async e=>{try{var n;const{blocklet:i}=await t.configOAuth({input:{did:l,oauth:JSON.stringify({apple:e})}}),a=Object.assign({...Vn},(null===i||void 0===i||null===(n=i.settings)||void 0===n||null===(n=n.oauth)||void 0===n?void 0:n.apple)||{});u(a),B.Z.success(o("oauth.saveSuccess"))}catch(i){B.Z.error(i.message||o("oauth.saveFailed"))}})),f=(0,Ke.Z)((e=>!(null===e||void 0===e||!e.trim())||o("oauth.apple.teamIdDescription"))),g=(0,Ke.Z)((e=>!(null===e||void 0===e||!e.trim())||o("oauth.apple.serviceIdDescription"))),x=(0,Ke.Z)((e=>!(null===e||void 0===e||!e.trim())||o("oauth.apple.keyIdDescription"))),v=(0,Ke.Z)((e=>!(null===e||void 0===e||!e.trim())||o("oauth.apple.authKeyDescription"))),b=(0,Ke.Z)((e=>!(null===e||void 0===e||!e.trim())||o("oauth.apple.bundleIdDescription"))),Z=(0,Ke.Z)((()=>!0));return(0,X.jsx)(p.Z,{children:(0,X.jsxs)("form",{onSubmit:r(h),disabled:!0,children:[(0,X.jsx)(We.Qr,{name:"enabled",control:s,render:e=>{let{field:n}=e;return(0,X.jsx)(Ze.Z,{control:(0,X.jsx)(zn.Z,{checked:n.value,style:{marginRight:"6px"},...n}),label:o("oauth.apple.enable"),sx:{marginBottom:2,ml:1}})}}),(0,X.jsx)(We.Qr,{name:"teamId",control:s,rules:{validate:m?f:Z},render:e=>{var n;let{field:t}=e;return(0,X.jsx)(De.Z,{fullWidth:!0,children:(0,X.jsx)(V.Z,{...t,error:!!c.errors[t.name],label:o("oauth.apple.teamId"),helperText:(null===(n=c.errors[t.name])||void 0===n?void 0:n.message)||"\u3000",disabled:!m})})}}),(0,X.jsx)(We.Qr,{name:"bundleId",control:s,rules:{validate:m?b:Z},render:e=>{var n;let{field:t}=e;return(0,X.jsx)(De.Z,{fullWidth:!0,children:(0,X.jsx)(V.Z,{...t,error:!!c.errors[t.name],label:o("oauth.apple.bundleId"),helperText:(null===(n=c.errors[t.name])||void 0===n?void 0:n.message)||"\u3000",disabled:!m})})}}),(0,X.jsx)(We.Qr,{name:"serviceId",control:s,rules:{validate:m?g:Z},render:e=>{var n;let{field:t}=e;return(0,X.jsx)(De.Z,{fullWidth:!0,children:(0,X.jsx)(V.Z,{...t,error:!!c.errors[t.name],label:o("oauth.apple.serviceId"),helperText:(null===(n=c.errors[t.name])||void 0===n?void 0:n.message)||"\u3000",disabled:!m})})}}),(0,X.jsx)(We.Qr,{name:"keyId",control:s,rules:{validate:m?x:Z},render:e=>{var n;let{field:t}=e;return(0,X.jsx)(De.Z,{fullWidth:!0,children:(0,X.jsx)(V.Z,{...t,error:!!c.errors[t.name],label:o("oauth.apple.keyId"),helperText:(null===(n=c.errors[t.name])||void 0===n?void 0:n.message)||"\u3000",disabled:!m})})}}),(0,X.jsx)(We.Qr,{name:"authKey",control:s,rules:{validate:m?v:Z},render:e=>{var n;let{field:t}=e;return(0,X.jsx)(De.Z,{fullWidth:!0,children:(0,X.jsx)(V.Z,{...t,type:"password",multiline:!0,rows:4,label:o("oauth.apple.authKey"),error:!!c.errors[t.name],helperText:(null===(n=c.errors[t.name])||void 0===n?void 0:n.message)||"\u3000",disabled:!m})})}}),(0,X.jsx)(Fn.Z,{type:"submit",variant:"contained",onSubmit:r(h),disabled:!c.isDirty,children:o("oauth.save")})]})})};var Yn=t(46711),Jn=t(2266),Qn=t(76223),Xn=t(34435),$n=t(6837);function et(e){let{title:n,id:t,children:i,index:o,onMove:a,defaultExpand:r,onEnd:s}=e;const[c,d]=(0,l.useState)(r),u=(0,l.useRef)(null),m=(0,l.useRef)(null),[{handlerId:h},f]=(0,Yn.L)({accept:"dragItem",collect:e=>({handlerId:e.getHandlerId()}),hover(e,n){var t,i;if(!u.current)return;const l=e.index,r=o;if(l===r)return;const s=null===(t=u.current)||void 0===t?void 0:t.getBoundingClientRect(),c=null===(i=m.current)||void 0===i?void 0:i.getBoundingClientRect(),d=(c.bottom-c.top)/2,p=n.getClientOffset().y-s.top;l<r&&p<d||l>r&&p>d||(a(l,r),e.index=r)}}),[{isDragging:g},x]=(0,Jn.c)({item:{index:o,type:"dragItem"},collect:e=>({isDragging:e.isDragging()}),end:s});x(m),f(u);const v=g?.5:1,b=(0,Ke.Z)((e=>{e.preventDefault(),e.stopPropagation(),d(!c)}));return(0,X.jsxs)(p.Z,{ref:u,sx:{borderBottom:"1px solid ".concat(Qn.E.lineBorderStrong)},children:[(0,X.jsx)(p.Z,{sx:{cursor:"pointer","&:hover":{backgroundColor:Qn.E.backgroundsBgSubtileHover},borderRadius:2},ref:m,"data-handler-id":h,children:(0,X.jsxs)(p.Z,{sx:{py:1.5,px:1,opacity:v,display:"flex",alignItems:"center",gap:.5},draggable:!1,onClick:b,children:[(0,X.jsx)(p.Z,{sx:{pointerEvents:"auto",cursor:"grab","&:active":{cursor:"grabbing"},fontSize:0,color:Qn.E.textMuted,"&:hover":{color:Qn.E.textSubtitle}},children:(0,X.jsx)(_n.JO,{fontSize:20,icon:Xn.Z})}),(0,X.jsx)(ve.Z,{sx:{flex:1},children:n}),(0,X.jsx)(K.Z,{size:"small",sx:{pointerEvents:"auto",transform:c?"":"rotate(180deg)",transition:"transform 0.3s ease"},children:(0,X.jsx)(_n.JO,{icon:$n.Z,style:{transform:"scale(1.5)"}})})]})}),(0,X.jsx)(p.Z,{sx:{pl:4,py:1,display:c?"block":"none"},children:i})]})}et.propTypes={title:s().string.isRequired,id:s().string.isRequired,children:s().node.isRequired,index:s().number.isRequired,onMove:s().func.isRequired,onEnd:s().func.isRequired,defaultExpand:s().bool},et.defaultProps={defaultExpand:!0};const nt=[{name:"github",title:"GitHub",icon:(0,X.jsx)(_n.JO,{icon:In.Z}),component:(0,X.jsx)(qn,{})},{name:"google",title:"Google",icon:(0,X.jsx)(_n.JO,{icon:Bn.Z}),component:(0,X.jsx)(Gn,{})},{name:"apple",title:"Apple",icon:(0,X.jsx)(_n.JO,{icon:An.Z}),component:(0,X.jsx)(Hn,{})},{name:"auth0",title:"Auth0",icon:(0,X.jsx)(_n.JO,{icon:Dn.Z}),component:(0,X.jsx)(Kn,{})}],tt=["github","google","apple","auth0"];function it(){var e,n;const{api:t}=(0,ie.h6)(),{blocklet:i}=(0,me.y0)(),o=null===i||void 0===i||null===(e=i.meta)||void 0===e?void 0:e.did,l=(null===i||void 0===i||null===(n=i.settings)||void 0===n?void 0:n.oauth)||{},a=Object.keys(l).sort(((e,n)=>{var t,i,o;return void 0!==(null===(t=l[e])||void 0===t?void 0:t.order)&&void 0!==(null===(i=l[n])||void 0===i?void 0:i.order)?l[e].order-l[n].order:void 0!==(null===(o=l[e])||void 0===o?void 0:o.order)?-1:1}));for(const p of tt)a.includes(p)||a.push(p);const r=(0,Ue.Z)(a.reduce(((e,n,t)=>Object.assign(e,{[n]:t})),{})),s=(0,Be.Z)((()=>{const e=[...nt];return e.sort(((e,n)=>r[e.name]-r[n.name])),e}),[r.auth0,r.github,r.google]),c={};"undefined"!==typeof window&&(c.context=window);const d=(0,Ke.Z)((async e=>{const n={};Object.keys(e).forEach((t=>{n[t]={order:e[t]}})),await t.configOAuth({input:{did:o,oauth:JSON.stringify(n)}})})),u=(0,Ke.Z)(((e,n)=>{const t=s[e],i=s[n];r[t.name]=n,r[i.name]=e})),m=(0,Ke.Z)((async()=>{await d(r)}));return(0,X.jsx)(p.Z,{children:(0,X.jsx)(Nn.W,{backend:Rn.HTML5Backend,...c,children:s.map(((e,n)=>(0,X.jsx)(et,{index:n,id:e.name,title:e.title,icon:e.icon,onMove:u,onEnd:m,defaultExpand:e.enabled,children:e.component},e.name)))})})}var ot=t(62362),lt=t(24103);const at={ttl:m.SESSION_TTL};function rt(e){const n=arguments.length>1&&void 0!==arguments[1]&&arguments[1]?86400*e.ttl:e.ttl/86400;return{...e,ttl:n}}function st(){var e,n;const{api:t}=(0,ie.h6)(),{blocklet:i}=(0,me.y0)(),o=null===i||void 0===i||null===(e=i.meta)||void 0===e?void 0:e.did,l=Object.assign({},at,(null===i||void 0===i||null===(n=i.settings)||void 0===n?void 0:n.session)||{}),{handleSubmit:a,control:r,formState:s,reset:c}=(0,We.cI)({defaultValues:ze()(rt(l),["ttl"])}),{t:d}=(0,k.PE)(),u=(0,Ke.Z)((async e=>{try{var n;const{blocklet:i}=await t.updateAppSessionConfig({input:{did:o,config:rt(e,!0)}}),l=Object.assign({},at,ze()((null===i||void 0===i||null===(n=i.settings)||void 0===n?void 0:n.session)||{},["ttl"]));c(rt(l)),B.Z.success(d("common.configSuccess"))}catch(i){B.Z.error(i.message)}}));return(0,X.jsx)(p.Z,{children:(0,X.jsxs)("form",{onSubmit:a(u),disabled:!0,children:[(0,X.jsx)(We.Qr,{name:"ttl",control:r,render:e=>{let{field:n}=e;return(0,X.jsx)(De.Z,{fullWidth:!0,sx:{mb:2},children:(0,X.jsxs)(lt.Z,{px:3,children:[(0,X.jsx)(p.Z,{mx:-3,my:.5,children:d("blocklet.config.session.ttl",{day:n.value})}),(0,X.jsx)(ot.ZP,{...n,defaultValue:7,step:1,marks:[{value:1,label:d("blocklet.config.session.day",{day:1})},{value:7,label:d("blocklet.config.session.days",{day:7})},{value:14,label:d("blocklet.config.session.days",{day:14})},{value:21,label:d("blocklet.config.session.days",{day:21})},{value:30,label:d("blocklet.config.session.days",{day:30})}],min:1,max:30,valueLabelDisplay:"auto",style:{maxWidth:"360px"}})]})})}}),(0,X.jsx)(Fn.Z,{type:"submit",variant:"contained",onSubmit:a(u),disabled:!s.isDirty,children:d("oauth.save")})]})})}var ct=t(82555),dt=t(30333),ut=t(75760),mt=t(97038),pt=t(64886),ht=t(42080),ft=t.n(ht),gt=t(75506),xt=t.n(gt),vt=t(47685),bt=t(13260),Zt=t(82434),jt=t.n(Zt);const yt=(0,l.forwardRef)(((e,n)=>{var t;const{t:i}=(0,l.useContext)(k.RD),{blocklet:o}=(0,me.y0)(),{api:a}=(0,ie.h6)(),r=(0,Ue.Z)({mode:"view",show:!1,data:{},callback:Qe()}),s=(0,vt.Fg)(),c=(null===s||void 0===s||null===(t=s.transitions)||void 0===t||null===(t=t.duration)||void 0===t?void 0:t.leavingScreen)||300,d=(0,Ke.Z)((()=>{r.mode="view",r.data={},r.callback=Qe()}),[]),m=(0,Ke.Z)((()=>{r.show=!1,setTimeout((()=>{d()}),c)}),[]),h=(0,Ke.Z)((e=>{r.mode="view",r.show=!0,r.data=e}),[]),f=(0,Ke.Z)((function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Qe();r.mode="approve",r.show=!0,r.data=e,r.callback=n}),[]);(0,l.useImperativeHandle)(n,(()=>({open:h,close:m,approve:f})),[h,m,f]);const g=(0,Be.Z)((()=>{if(!r.show)return[];r.data.migratedFrom=[r.data.appId,r.data.appPid];const e=["appName","appLogo","appId","appPid","migratedFrom","appDescription","appUrl","version","appliedAt","status","serverId","serverVersion"];return!1!==r.data.isMaster&&ft()(e,"appliedAt","status"),e.map((e=>{const n=i("federated.info.".concat(e));let t=r.data[e];if("appName"===e&&r.data.isMaster&&(t=(0,X.jsxs)(p.Z,{children:[(0,X.jsx)(ct.Z,{component:dt.Z}),t]})),["appId","appPid","serverId"].includes(e)&&(t=(0,X.jsx)(bt.kL,{children:t})),["appUrl"].includes(e)&&(t=(0,X.jsx)(p.Z,{component:"a",href:t,target:"_blank",children:t})),["appLogo"].includes(e)){const e=jt()(t)?t:u()(r.data.appUrl||"",t||"");try{const n=new URL(e);n.searchParams.set("imageFilter","resize"),n.searchParams.set("w","80"),n.searchParams.set("h","80"),t=(0,X.jsx)("img",{src:n.href,width:"60",height:"60",alt:r.data.appName})}catch{t=(0,X.jsx)("img",{src:e,width:"60",height:"60",alt:r.data.appName})}}if("status"===e&&(t=t&&i("federated.status.".concat(t))),"migratedFrom"===e){t=(r.data.migratedFrom||[]).filter((e=>![r.data.appId,r.data.appPid].includes(e))).map((e=>(0,X.jsx)(bt.kL,{children:e})))}return xt()(t)&&(t="-"),{name:n,value:t}}))}),[r.data]),x="approve"===r.mode,v=(0,Ke.Z)((async()=>{await a.auditFederatedLogin({input:{memberPid:r.data.appPid,did:o.appPid,status:"rejected"}}),m(),null===r||void 0===r||r.callback(!1)})),b=(0,Ke.Z)((async()=>{await a.auditFederatedLogin({input:{memberPid:r.data.appPid,did:o.appPid,status:"approved"}}),m(),null===r||void 0===r||r.callback(!0)}));return(0,X.jsx)(ge.ZP,{open:r.show,title:i(x?"federated.approveToJoinLogin":"federated.siteDetail"),onClose:m,actions:x?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Fn.Z,{color:"error",variant:"contained",onClick:v,children:i("common.reject")}),(0,X.jsx)(Fn.Z,{variant:"contained",onClick:b,children:i("common.approve")})]}):(0,X.jsx)(Fn.Z,{variant:"outlined",onClick:m,children:i("common.close")}),children:g.map((e=>(0,X.jsx)(pt.Z,{style:{alignItems:"flex-start"},valueComponent:"div",nameWidth:180,name:e.name,children:e.value},e.name)))})}));var kt=t(79842),Ct=t(85408),St=t.n(Ct);const wt=(0,l.forwardRef)(((e,n)=>{var t;const i=(0,vt.Fg)(),o=(null===i||void 0===i||null===(t=i.transitions)||void 0===t||null===(t=t.duration)||void 0===t?void 0:t.leavingScreen)||300,{t:a}=(0,l.useContext)(k.RD),r=(0,Ue.Z)({show:!1,data:{link:""}}),s=(0,Ke.Z)((()=>{r.data.link=""}),[]),c=(0,Ke.Z)((()=>{r.show=!1,setTimeout((()=>{s()}),o)}),[]),d=(0,Ke.Z)((e=>{let{link:n}=e;r.show=!0,r.data.link=n}),[]);(0,l.useImperativeHandle)(n,(()=>({open:d,close:c})),[d,c]);const u=(0,Ke.Z)((()=>{St()(r.data.link),c()}),[c]);return(0,X.jsxs)(ge.ZP,{open:r.show,title:a("federated.joinFederatedLogin"),onClose:c,PaperProps:{style:{minHeight:"unset"}},actions:(0,X.jsx)(_.Z,{color:"primary",autoFocus:!0,variant:"contained",onClick:u,children:a("common.copyAndClose")}),children:[(0,X.jsx)(p.Z,{mb:1,children:a("federated.inviteJoinFederatedLoginDescription")}),(0,X.jsx)(p.Z,{sx:{"& .copy-button":{display:"none !important"}},children:(0,X.jsx)(kt.Z,{language:"shell",style:{marginBottom:0},children:r.data.link})})]})}));function Et(e){var n,t,i;let{mode:o}=e;const a=(0,l.useRef)(null),r=(0,l.useRef)(null),{t:s,locale:c}=(0,l.useContext)(k.RD),{blocklet:d,actions:{refreshBlocklet:u}}=(0,me.y0)(),{confirmApi:m,confirmHolder:h}=$e(),{api:f}=(0,ie.h6)(),g=(null===(n=d.settings.federated)||void 0===n?void 0:n.sites)||[],x=(null===(t=d.settings.federated)||void 0===t?void 0:t.config)||{},v=!1!==x.isMaster,b=(0,Ke.Z)((e=>{var n;null===(n=r.current)||void 0===n||n.open(e)})),Z=(0,Ke.Z)((e=>{var n;null===(n=r.current)||void 0===n||n.approve(e,u)})),j=(0,Ke.Z)((e=>{m.open({title:s("federated.disableFederatedLogin"),content:s("federated.disableFederatedLoginDescription"),async onConfirm(n){await f.auditFederatedLogin({input:{memberPid:e.appPid,did:d.appPid,status:"revoked"}}),n()}})})),y=(0,Ke.Z)((e=>{m.open({title:s("federated.enableFederatedLogin"),content:s("federated.enableFederatedLoginDescription"),async onConfirm(n){await f.auditFederatedLogin({input:{memberPid:e.appPid,did:d.appPid,status:"approved"}}),n()}})})),C=(0,Be.Z)((()=>{const e=[{label:s("common.name"),name:"appName",options:{customBodyRenderLite:e=>{const n=g[e],t=!1!==n.isMaster;return(0,X.jsx)(p.Z,{display:"inline-block",children:(0,X.jsxs)(p.Z,{component:"a",display:"flex",alignItems:"center",href:n.appUrl,target:"_blank",onClick:e=>{e.stopPropagation()},children:[t&&(0,X.jsx)(ct.Z,{component:dt.Z,style:{marginRight:"4px"}}),n.appName]})})}}},{label:s("common.did"),name:"appId",options:{customBodyRenderLite:e=>{const n=g[e];return(0,X.jsx)(mt.Z,{children:n.appId})}}},{label:s("common.status"),name:"status",options:{customBodyRenderLite:e=>{const n=g[e],t=!1!==n.isMaster;return(0,X.jsx)(p.Z,{children:t?"-":s("federated.status.".concat(n.status))})}}}];return v&&e.push({label:s("common.actions"),name:"actions",options:{customBodyRenderLite:e=>{const n=g[e],t=!1!==n.isMaster;return(0,X.jsx)(p.Z,{display:"flex",gap:1,children:t?(0,X.jsxs)(X.Fragment,{children:["rejected"===n.status&&(0,X.jsx)(_.Z,{variant:"contained",color:"error",size:"small",onClick:e=>{e.stopPropagation()},children:s("federated.status.rejected")}),"revoked"===n.status&&(0,X.jsx)(_.Z,{variant:"contained",color:"secondary",size:"small",onClick:e=>{e.stopPropagation()},children:s("federated.status.revoked")})]}):(0,X.jsxs)(X.Fragment,{children:["pending"===n.status&&(0,X.jsx)(_.Z,{variant:"contained",color:"primary",size:"small",onClick:e=>{e.stopPropagation(),Z(n)},children:s("federated.status.pending")}),"approved"===n.status&&(0,X.jsx)(_.Z,{variant:"contained",color:"error",size:"small",onClick:e=>{e.stopPropagation(),j(n)},style:{whiteSpace:"nowrap"},children:s("federated.revoke")}),"revoked"===n.status&&(0,X.jsx)(_.Z,{variant:"contained",color:"warning",size:"small",onClick:e=>{e.stopPropagation(),y(n)},style:{whiteSpace:"nowrap"},children:s("federated.approve")})]})})}}}),e}),[x.appId,g,v,s]),S=(0,Be.Z)((()=>({sort:!0,download:!1,filter:!1,print:!1,expandableRowsOnClick:!0,onRowClick(e,n){let{dataIndex:t}=n;const i=g[t];b(i)}})),[]),w=(0,Ke.Z)((()=>{const e=d.environments.find((e=>e.key===I.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_URL));var n;null!==e&&void 0!==e&&e.value?null===(n=a.current)||void 0===n||n.open({link:e.value}):B.Z.error(s("federated.failedToGetFederatedLoginLink"))}),[null===(i=d.site)||void 0===i||null===(i=i.domainAliases)||void 0===i||null===(i=i[0])||void 0===i?void 0:i.href]),E=(0,Ke.Z)((()=>{m.open({title:s("federated.quitFederatedLogin"),content:s("federated.quitFederatedLoginDescription"),async onConfirm(e){await f.quitFederatedLogin({input:{did:d.appPid}}),e()}})})),L=(0,Ke.Z)((()=>{m.open({title:s("federated.disbandFederatedLogin"),content:s("federated.disbandFederatedLoginDescription"),async onConfirm(e){await f.disbandFederatedLogin({input:{did:d.appPid}}),e()}})})),P=[];return"master"!==o?P.push((0,X.jsx)(_.Z,{size:"small",variant:"contained",color:"error",onClick:E,sx:{ml:1},children:s("federated.quitFederatedLogin")},"quitFederatedLogin")):(P.push((0,X.jsx)(_.Z,{size:"small",variant:"contained",onClick:w,sx:{ml:1},children:s("federated.inviteJoinFederatedLogin")},"inviteJoinFederatedLogin")),P.push((0,X.jsx)(_.Z,{color:"error",size:"small",variant:"contained",onClick:L,sx:{ml:1},children:s("federated.disbandFederatedLogin")},"disbandFederatedLogin"))),(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(ut.Z,{className:"main-table",locale:c,data:g,columns:C,customButtons:P,title:(0,X.jsx)(p.Z,{className:"table-toolbar-left",children:s("oauth.federated")}),options:S}),h,(0,X.jsx)(wt,{ref:a}),(0,X.jsx)(yt,{ref:r})]})}Et.propTypes={mode:s().oneOf(["member","master"])},Et.defaultProps={mode:"member"};const Lt=Et,Pt=(0,l.forwardRef)(((e,n)=>{var t;const{t:i}=(0,l.useContext)(k.RD),{api:o}=(0,ie.h6)(),{blocklet:a}=(0,me.y0)(),r=null===a||void 0===a?void 0:a.appPid,s=(0,vt.Fg)(),c=(null===s||void 0===s||null===(t=s.transitions)||void 0===t||null===(t=t.duration)||void 0===t?void 0:t.leavingScreen)||300,d=(0,Ue.Z)({show:!1,appUrl:"",appUrlError:"",callback:Qe()}),u=(0,Ke.Z)((()=>{d.appUrl="",d.appUrlError="",d.callback=Qe()}),[]),m=(0,Ke.Z)((()=>{d.show=!1,setTimeout((()=>{u()}),c)}),[]),h=(0,Ke.Z)((function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Qe();d.show=!0,d.callback=e}),[]);(0,l.useImperativeHandle)(n,(()=>({open:h,close:m})),[h,m]);const f=(0,Ke.Z)((e=>{if(!e)throw new Error(i("federated.federatedJoinAppUrlRequired"));if(!jt()(e))throw new Error(i("federated.federatedJoinAppUrlInvalid"))})),g=(0,Ke.Z)((async()=>{try{f(d.appUrl);const e=await o.joinFederatedLogin({input:{did:r,appUrl:d.appUrl}});d.show=!1,m(),null===d||void 0===d||d.callback(e)}catch(e){d.appUrlError=e.message}}),[m,r]);return(0,X.jsxs)(ge.ZP,{open:d.show,title:i("federated.joinFederatedLogin"),onClose:m,PaperProps:{style:{minHeight:"unset"}},actions:(0,X.jsx)(_.Z,{color:"primary",autoFocus:!0,variant:"contained",onClick:g,children:i("common.confirm")}),children:[(0,X.jsx)(p.Z,{mb:1,children:i("federated.joinFederatedLoginDescription")}),(0,X.jsx)(V.Z,{fullWidth:!0,variant:"outlined",margin:"dense",placeholder:i("federated.federatedJoinAppUrl"),label:i("federated.federatedJoinAppUrl"),value:d.appUrl,error:!!d.appUrlError,helperText:d.appUrlError||"eg: https://www.arcblock.io",onChange:e=>{d.appUrl=e.target.value}})]})}));function Tt(){var e,n;const t=(0,l.useRef)(null),i=(0,l.useRef)(null),{t:o}=(0,l.useContext)(k.RD),{blocklet:a,actions:{refreshBlocklet:r}}=(0,me.y0)(),s=(0,Ke.Z)((()=>{var e;const n=null===(e=a.site)||void 0===e||null===(e=e.domainAliases)||void 0===e||null===(e=e[0])||void 0===e?void 0:e.href;if(n)try{var i;const e=new URL(n);null===(i=t.current)||void 0===i||i.open({link:e.origin})}catch{B.Z.error(o("federated.failedToGetFederatedLoginLink"))}}),[null===(e=a.site)||void 0===e||null===(e=e.domainAliases)||void 0===e||null===(e=e[0])||void 0===e?void 0:e.href]),c=(0,Ke.Z)((()=>{var e;null===(e=i.current)||void 0===e||e.open((()=>{r()}))}),[r]);if((null===(n=a.settings.federated)||void 0===n?void 0:n.sites.length)>0){var d;const e=!1!==(null===(d=a.settings.federated)||void 0===d?void 0:d.config.isMaster);return(0,X.jsx)(Lt,{mode:e?"master":"member"})}return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(p.Z,{display:"flex",flexDirection:"column",gap:2,justifyContent:"center",alignItems:"center",minHeight:"200px",children:[(0,X.jsx)(_.Z,{variant:"contained",onClick:s,children:o("federated.inviteJoinFederatedLogin")}),(0,X.jsx)(R.Z,{sx:{width:"150px",color:"rgba(0, 0, 0, 0.3)"},children:"OR"}),(0,X.jsx)(_.Z,{variant:"outlined",onClick:c,children:o("federated.joinFederatedLogin")})]}),(0,X.jsx)(wt,{ref:t}),(0,X.jsx)(Pt,{ref:i})]})}const Ot=function(){const{t:e}=(0,l.useContext)(k.RD),n=[{label:(0,X.jsx)(p.Z,{textAlign:"center",width:"100%",children:e("oauth.commonSettings")}),value:"settings"},{label:(0,X.jsx)(p.Z,{textAlign:"center",width:"100%",children:e("oauth.federated")}),value:"federated"},{label:(0,X.jsx)(p.Z,{textAlign:"center",width:"100%",children:e("oauth.oauth")}),value:"oauth"},{label:(0,X.jsx)(p.Z,{textAlign:"center",width:"100%",children:e("oauth.moreLogin")}),value:"more"}],[t,i]=(0,l.useState)(n[0].value),o=(0,Be.Z)((()=>({oauth:(0,X.jsx)(it,{}),federated:(0,X.jsx)(Tt,{}),more:(0,X.jsx)(p.Z,{children:(0,X.jsx)(Ie.Z,{children:e("oauth.comingSoon")})}),settings:(0,X.jsx)(p.Z,{children:(0,X.jsx)(st,{})})})),[e]);return(0,X.jsxs)(p.Z,{children:[(0,X.jsx)(C.Z,{tabs:n,current:t,onChange:i}),(0,X.jsx)(p.Z,{marginTop:"10px",children:o[t]})]})};var Nt;const Rt=e=>{let{tabs:n,blocklet:t,ancestors:i=[],depth:o=1,t:l}=e;const a=[...i.map((e=>e.meta.did)),t.meta.did].join("/"),r=!(null!==i&&void 0!==i&&i.length);n.push({label:(0,X.jsxs)(p.Z,{pl:2*Math.max(1,o-1),display:"flex",alignItems:"center",justifyContent:"flex-start",children:[r?(0,X.jsx)(E.Z,{size:24,blocklet:t}):(0,X.jsx)(w.Z,{size:24,blocklet:t,ancestors:i}),(0,X.jsx)(p.Z,{ml:"16px",children:(0,X.jsx)(p.Z,{style:{color:"#222"},children:r?l("blocklet.component.container"):(0,S.getDisplayName)(t,!0)})})]},a),value:a}),t.children.length>0&&t.children.forEach((e=>{Rt({tabs:n,blocklet:e,ancestors:[...i,t],depth:o+1,t:l})}))};function _t(e){let{blocklet:n,onUpdate:t,...i}=e;const{t:o}=(0,l.useContext)(k.RD),{info:a,inService:r}=(0,ie.h6)(),[s,d]=(0,l.useState)(!0),[S,w]=(0,y.useSearchParams)(),E=S.get("tab")||"general",L=[{label:(0,X.jsxs)(p.Z,{display:"flex",alignItems:"center","data-cy":"configuration-tab-general",children:[(0,X.jsx)(f.Z,{sx:{fontSize:24}}),(0,X.jsx)(p.Z,{ml:"16px",children:(0,X.jsx)(p.Z,{style:{color:"#222"},children:o("common.general")})})]},"general"),value:"general"},{label:(0,X.jsxs)(p.Z,{display:"flex",alignItems:"center","data-cy":"configuration-tab-access",children:[(0,X.jsx)(g.Z,{sx:{fontSize:24}}),(0,X.jsx)(p.Z,{ml:"16px",children:(0,X.jsx)(p.Z,{style:{color:"#222"},children:o("common.access")})})]},"access"),value:"access"},{label:(0,X.jsxs)(p.Z,{display:"flex",alignItems:"center","data-cy":"configuration-tab-authentication",children:[(0,X.jsx)(x.Z,{sx:{fontSize:24}}),(0,X.jsx)(p.Z,{ml:"16px",children:(0,X.jsx)(p.Z,{style:{color:"#222"},children:o("common.login")})})]},"authentication"),value:"authentication"},{label:(0,X.jsxs)(p.Z,{display:"flex",alignItems:"center","data-cy":"configuration-tab-notification",children:[(0,X.jsx)(v.Z,{sx:{fontSize:24}}),(0,X.jsx)(p.Z,{ml:"16px",children:(0,X.jsx)(p.Z,{style:{color:"#222"},children:o("common.notification")})})]},"notification"),value:"notification"},{label:(0,X.jsxs)(p.Z,{display:"flex",alignItems:"center","data-cy":"configuration-tab-preference",children:[(0,X.jsx)(p.Z,{ml:-2,style:{transform:"translateY(2px)"},children:s?(0,X.jsx)(j.Z,{fontSize:"inherit"}):(0,X.jsx)(Z.default,{fontSize:"inherit"})}),(0,X.jsx)(b.Z,{sx:{fontSize:24}}),(0,X.jsx)(p.Z,{ml:"16px",children:(0,X.jsx)(p.Z,{style:{color:"#222"},children:o("common.preferences")})})]},"preference"),value:"preference"}];s&&Rt({tabs:L,blocklet:n,t:o});let P=null;if("general"===E)P=(0,X.jsx)(_e,{blocklet:n,onUpdate:t});else if("access"===E)P=(0,X.jsx)(Tn,{});else if("authentication"===E)P=(0,X.jsx)(Ot,{});else if("notification"===E)P=(0,X.jsx)(on,{});else{const e=r?m.WELLKNOWN_SERVICE_PATH_PREFIX:a.routing.adminPath,n=new URLSearchParams;r||n.set("authKey","__sst"),n.set("schemaKey",u()(window.location.origin,e,"/api/preferences?id=".concat(encodeURIComponent(E)))),P=(0,X.jsx)(c.Z,{url:"".concat(u()(window.location.origin,e,"/hosted/form-collector/"),"?").concat(n.toString()),width:"100%",height:"100%",frameBorder:0,styles:{border:0}})}return(0,X.jsx)(At,{...i,children:(0,X.jsxs)(h.ZP,{container:!0,spacing:4,columns:24,children:[(0,X.jsx)(h.ZP,{item:!0,sm:7,md:5,children:(0,X.jsx)(C.Z,{tabs:L,current:E,orientation:"vertical",onChange:e=>{"preference"===e?d(!s):w((n=>("general"===e?n.delete("tab"):n.set("tab",e),n)))},sx:{borderRight:1,height:"100%",borderColor:"divider"}})}),(0,X.jsx)(h.ZP,{item:!0,sm:17,md:19,children:(0,X.jsx)(p.Z,{style:{minHeight:"66vh",height:"100%",position:"relative",overflow:"hidden"},children:P})})]})})}_t.propTypes={blocklet:s().object.isRequired,onUpdate:s().func},_t.defaultProps={onUpdate:()=>{}};const At=a.Z.div(Nt||(Nt=(0,o.Z)(["\n .MuiTab-root {\n text-align: left;\n align-items: flex-start;\n font-weight: normal;\n }\n .Mui-selected {\n font-weight: bold;\n }\n"])))},69058:(e,n,t)=>{t.d(n,{Z:()=>m});var i=t(5057),o=t(86229),l=t(28726),a=t(44846),r=t(68420),s=t(64387),c=t(22324),d=t(10032),u=t(96266);function m(e){let{teamDid:n,size:t="small",...m}=e;const{t:p}=(0,r.PE)(),{api:h}=(0,c.h6)(),[f,g]=(0,i.useState)(!1),[x,v]=(0,i.useState)(null),b={title:p("blocklet.config.clearCache.title"),description:p("blocklet.config.clearCache.description"),confirm:p("common.confirm"),cancel:p("common.cancel"),onConfirm:async()=>{try{var e;g(!0);const t=await h.clearCache({input:{teamDid:n}});o.Z.success(p("blocklet.config.clearCache.success",{count:(null===(e=t.removed)||void 0===e?void 0:e.length)||0}))}catch(t){o.Z.error((0,s.Z)(t))}finally{g(!1),v(null)}},onCancel:()=>{g(!1),v(null)}};return(0,u.jsxs)("div",{...m,children:[(0,u.jsxs)(l.Z,{onClick:()=>v(b),color:"error",variant:"outlined",size:t,children:[f?(0,u.jsx)(a.Z,{size:16,style:{marginRight:5}}):null,p("blocklet.config.clearCache.action")]}),x&&(0,u.jsx)(d.Z,{title:x.title,description:x.description,confirm:x.confirm,cancel:x.cancel,onConfirm:x.onConfirm,onCancel:x.onCancel})]})}},69561:(e,n,t)=>{t.d(n,{Z:()=>c});var i=t(5057),o=t(55898),l=t.n(o),a=t(12937),r=t(68420),s=t(96266);function c(e){let{children:n,...t}=e;const{t:o}=(0,i.useContext)(r.RD);return(0,s.jsx)(a.Z,{tip:o("common.copyTip"),copiedTip:o("common.copiedTip"),...t,children:n})}c.propTypes={children:l().any.isRequired}},30629:(e,n,t)=>{t.d(n,{Z:()=>x});var i=t(5057),o=t(55898),l=t.n(o),a=t(39948),r=t(47020),s=t(44846),c=t(13727),d=t(56184),u=t(67680),m=t(43449),p=t(37382),h=t(90651),f=t(96266);const g=(e,n,t)=>null===e&&n&&t?"******":e?n?"******":e:"";function x(e){let{label:n,disabled:t,required:o,initialValue:l,onChange:x,placeholder:v,style:b,onSubmit:Z,secure:j,triggers:y,formatterBeforeSubmit:k,...C}=e;const[S,w]=(0,i.useState)(!1),[E,L]=(0,i.useState)(!1),[P,T]=(0,i.useState)(j&&"__encrypted__"===l?null:l),[O,N]=(0,i.useState)(P),R=async()=>{L(!0);try{if(!1===await Z(O))N(P);else{let e=O;"function"===typeof k&&(e=k(O)),N(e),T(e)}}catch(e){N(P)}finally{L(!1),w(!1)}},_=S?(0,f.jsx)(r.Z,{style:{flex:1},fullWidth:!0,value:O,onChange:e=>{var n;n=e.target.value,N(n),x(n)},autoFocus:!0,size:"small",variant:"outlined",placeholder:v,onKeyDown:e=>{"Enter"===e.key&&R()},disabled:t,type:j?"password":"text",...C}):(0,f.jsx)(a.Z,{px:1,className:"form-item-input slot",style:{whiteSpace:"pre-wrap"},children:g(O,j,l)});return(0,f.jsx)(p.Z,{className:"form",style:b,children:(0,f.jsxs)(a.Z,{className:"form-item",children:[(0,f.jsxs)(a.Z,{className:"form-item-label",children:[n,o&&(0,f.jsx)(m.Z,{})]}),(0,f.jsxs)(a.Z,{className:"form-item-body",children:[(0,f.jsx)(a.Z,{className:"form-item-input",children:_}),(0,f.jsx)(a.Z,{className:"form-item-action",children:S?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(u.Z,{"data-cy":"schema-form-item-confirm",onClick:R,disabled:t||E,size:"large",children:E?(0,f.jsx)(s.Z,{size:24}):(0,f.jsx)(d.Z,{})}),(0,f.jsx)(u.Z,{"data-cy":"schema-form-item-cancel",onClick:()=>{N(P),w(!1)},disabled:t||E,size:"large",children:(0,f.jsx)(c.default,{})})]}):(0,f.jsx)(h.Z,{triggers:y,onEnterEdit:()=>w(!0),disabled:t})})]})]})})}x.propTypes={style:l().object,onSubmit:l().func,onChange:l().func,label:l().string,initialValue:l().string,placeholder:l().string,required:l().bool,disabled:l().bool,secure:l().bool,triggers:l().array,formatterBeforeSubmit:l().func},x.defaultProps={style:{},onSubmit:()=>{},onChange:()=>{},label:"",initialValue:"",placeholder:"",required:!1,disabled:!1,secure:!1,triggers:[],formatterBeforeSubmit:null}},37382:(e,n,t)=>{t.d(n,{Z:()=>r});var i,o=t(71171),l=t(33518),a=t(39948);const r=(0,l.Z)(a.Z)(i||(i=(0,o.Z)(["\n width: 100%;\n flex-grow: 1;\n overflow-y: auto;\n "," {\n width: 100%;\n flex-shrink: 0;\n padding: 0 24px;\n transform: translate(0, 0);\n /* max-height: 60vh; */\n }\n\n .form-item {\n width: 100%;\n margin-bottom: 24px;\n position: relative;\n "," {\n flex-wrap: wrap;\n justify-content: space-between;\n width: 100%;\n flex-shrink: 0;\n }\n }\n\n .form-item-body {\n display: flex;\n align-items: center;\n width: 100%;\n margin-top: 4px;\n }\n\n .form-item-label {\n line-height: 1.2;\n font-size: 14px;\n color: #888;\n font-weight: bold;\n\n "," {\n text-align: left;\n width: auto;\n flex-grow: 1;\n }\n }\n\n .form-item-input {\n flex-grow: 1;\n overflow: hidden;\n white-space: nowrap;\n text-overflow: ellipsis;\n\n &.slot {\n height: 40px;\n line-height: 40px;\n background: #f8f8f8;\n font-size: 16px;\n\n .MuiChip-root {\n margin-top: -4px;\n }\n }\n\n .MuiSelect-select {\n padding: 8px;\n }\n }\n\n .form-item-action {\n // width: 100px;\n text-align: left;\n margin-left: 12px;\n flex-shrink: 0;\n "," {\n width: auto;\n margin-left: 0px;\n }\n .MuiIconButton-root {\n padding: 8px;\n svg {\n fill: #888;\n }\n &.Mui-disabled {\n opacity: 0.4;\n }\n }\n }\n"])),(e=>e.theme.breakpoints.down("md")),(e=>e.theme.breakpoints.down("md")),(e=>e.theme.breakpoints.down("md")),(e=>e.theme.breakpoints.down("md")))},90651:(e,n,t)=>{t.d(n,{Z:()=>x});var i=t(5057),o=t(55898),l=t.n(o),a=t(24558),r=t(67680),s=t(56556),c=t(80633),d=t(49390),u=t(72113),m=t(25228),p=t(49020),h=t(74490),f=t(1733),g=t(96266);function x(e){let{triggers:n,onEnterEdit:t,disabled:o}=e;const l=i.useRef(null),[x,v]=i.useState(!1);return 0===n.length?(0,g.jsx)(r.Z,{"data-cy":"schema-form-item-edit",onClick:t,disabled:o,size:"large",children:(0,g.jsx)(a.Z,{})}):(0,g.jsxs)(g.Fragment,{children:[(0,g.jsxs)(c.Z,{variant:"outlined",ref:l,"aria-label":"split button",children:[(0,g.jsx)(s.Z,{"data-cy":"schema-form-item-edit",onClick:t,disabled:o,size:"large",children:(0,g.jsx)(a.Z,{})}),(0,g.jsx)(s.Z,{size:"small","aria-controls":x?"split-button-menu":void 0,"aria-expanded":x?"true":void 0,onClick:()=>{v((e=>!e))},children:(0,g.jsx)(d.Z,{})})]}),(0,g.jsx)(p.Z,{sx:{zIndex:9999},open:x,anchorEl:l.current,role:void 0,placement:"bottom-end",children:(0,g.jsx)(m.Z,{children:(0,g.jsx)(u.d,{onClickAway:e=>{l.current&&l.current.contains(e.target)||v(!1)},children:(0,g.jsx)(f.Z,{id:"split-button-menu",autoFocusItem:!0,children:n.map((e=>(0,g.jsx)(h.Z,{onClick:()=>{return n=e.handler,v(!1),void n();var n},children:e.title},e.key)))})})})})]})}x.propTypes={triggers:l().arrayOf(l().shape({key:l().string.isRequired,title:l().string.isRequired,handler:l().func.isRequired})),onEnterEdit:l().func.isRequired,disabled:l().bool.isRequired},x.defaultProps={triggers:[]}},43449:(e,n,t)=>{t.d(n,{Z:()=>l});var i,o=t(71171);const l=t(33518).Z.span(i||(i=(0,o.Z)(["\n color: ",";\n &::before {\n content: '*';\n }\n"])),(e=>e.theme.palette.error.main))},78903:(e,n,t)=>{t.d(n,{C:()=>i});const i="true"===localStorage.getItem("enableDebug")}}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";(self.webpackChunk_abtnode_webapp=self.webpackChunk_abtnode_webapp||[]).push([[9713,5889],{40249:(e,t,n)=>{n.r(t),n.d(t,{default:()=>Q});var r=n(71171),o=n(5057),i=n(33518),a=n(85493),s=n(11750),l=n(94464),c=n(68420),d=n(65889),u=n(75793),m=n(96266);function p(){const{api:e,info:t}=(0,u.h6)();return(0,m.jsx)(d.default,{client:e,did:t.did})}var f=n(45603),h=n.n(f),v=n(39948),y=n(55402),g=n(55222),b=n(28768),x=n(75760),j=n(44846),Z=n(35966),w=n(66506),k=n(35432),P=n(77277),O=n(86229),D=n(54474),E=n(26362),I=n(64387),N=n(38242),S=n(5863),C=n(38003),L=n(55898),R=n.n(L),T=n(50844),z=n(99154),_=n(36955);const F=(0,T.Z)((e=>({root:{height:10},colorPrimary:{backgroundColor:e.palette.grey["light"===e.palette.mode?200:700]},bar:{backgroundColor:e.palette.secondary.main}})))(z.Z);function B(e){const{value:t}=e;return(0,m.jsxs)(v.Z,{display:"flex",alignItems:"center",mt:2,children:[(0,m.jsx)(v.Z,{width:"100%",style:{overflow:"hidden"},mr:1,children:(0,m.jsx)(F,{variant:"determinate",...e})}),(0,m.jsx)(v.Z,{minWidth:35,children:(0,m.jsx)(s.Z,{variant:"body2",color:"textSecondary",children:"".concat(Math.round(t),"%")})})]})}function M(e){let{disk:t}=e;const{t:n}=(0,o.useContext)(c.RD),r=[{id:1,className:"used",title:n("system.used"),metric:(0,I.Gw)(t.used)},{id:2,className:"free",title:n("system.free"),metric:(0,I.Gw)(t.free)},{id:3,className:"total",title:n("system.total"),metric:(0,I.Gw)(t.total)}];return(0,m.jsx)(_.Z,{title:"".concat(n("common.disk")," (").concat(t.device,")"),value:(0,I.Gw)(t.used),graph:(0,m.jsx)(v.Z,{mt:3,children:(0,m.jsx)(B,{value:t.used/t.total*100})}),description:r.map(((e,t)=>(0,m.jsxs)(v.Z,{sx:{marginLeft:0===t?0:2},children:[e.title,": ",e.metric]},e.title)))})}B.propTypes={value:R().number.isRequired},M.propTypes={disk:R().shape({used:R().number,free:R().number,total:R().number,device:R().string})},M.defaultProps={disk:{used:0,free:0,total:1,device:""}};var U=n(67654),G=n(52926),q=n(52581),Y=n(6202),H=n(74094);const V={uptime:0,pid:-1,cpuUsage:0,memoryUsage:0},A="Blocklet Server";function K(e){let{initialBlocklets:t}=e;const{t:n,locale:r}=(0,c.PE)(),{api:i}=(0,u.h6)(),[a,l]=(0,U.Z)("runtime-view-interval",6),d=(0,o.useMemo)((()=>{const e=[];return e.push({type:"server",groupId:"server",groupName:A,id:"server:daemon",name:"Server (Daemon)",runtimeInfo:V}),e.push({type:"server",groupId:"server",groupName:A,id:"server:service",name:"Server (Service)",runtimeInfo:V}),t.forEach((t=>{(0,N.forEachBlockletSync)(t,((n,r)=>{let{id:o,ancestors:i}=r;n.runtimeInfo&&e.push({type:"blocklet",groupId:t.meta.did,groupName:(0,N.getDisplayName)(t),id:o,name:(0,N.getDisplayName)(n,!0),blocklet:t,component:n,runtimeInfo:n.runtimeInfo,ancestors:i})}))})),e}),[]),[p,f]=(0,o.useState)(d),[j,Z]=(0,o.useState)({os:{platform:""},mem:{used:0,free:0,total:1},cpu:{cpus:[],currentLoad:1},disks:[],daemon:{},service:{}}),[L,R]=(0,o.useState)({cpu:[],mem:[],daemonMem:[],serviceMem:[]});(0,Y.mU)(k.EVENTS.NODE_RUNTIME_INFO,(e=>{e.mem.total=e.mem.total||0,e.mem.used=e.mem.total-(e.mem.available||0),Z(e),f((t=>t.map((t=>"server:daemon"===t.id?{...t,runtimeInfo:{...t.runtimeInfo,...e.daemon}}:"server:service"===t.id?{...t,runtimeInfo:{...t.runtimeInfo,...e.service}}:t))))})),(0,Y.mU)(k.EVENTS.BLOCKLETS_RUNTIME_INFO,(e=>{e&&e.length?f((t=>t.map((t=>{const n=e.find((e=>e.componentId===t.id));return n?{...t,runtimeInfo:{...t.runtimeInfo,...n.runtimeInfo}}:t})))):console.error("incorrect blocklets runtime info format",e)}));const T=e=>{f((t=>t.filter((t=>t.groupId!==e.meta.did))))},z=async e=>{try{const{blocklet:t}=await i.getBlocklet({input:{did:e.meta.did,attachRuntimeInfo:!0}});"running"!==t.status&&T(t),f((e=>{const n=e.filter((e=>e.groupId!==t.meta.did));return(0,N.forEachBlockletSync)(t,((e,r)=>{let{id:o,ancestors:i}=r;e.runtimeInfo&&n.push({type:"blocklet",groupId:t.meta.did,groupName:(0,N.getDisplayName)(t),id:o,name:(0,N.getDisplayName)(e,!0),blocklet:t,component:e,runtimeInfo:e.runtimeInfo,ancestors:i})})),n}))}catch(t){O.Z.error(t.message)}};(0,Y.mU)(P.BlockletEvents.removed,T),(0,Y.mU)(P.BlockletEvents.startFailed,T),(0,Y.mU)(P.BlockletEvents.statusChange,(e=>{"running"===e.status?z(e):T(e)})),(0,Y.mU)(P.BlockletEvents.updated,z),(0,Y.mU)(P.BlockletEvents.started,z);(0,o.useEffect)((()=>{i.getNodeRuntimeHistory({input:{hours:a}}).then((e=>{const t=e.history||[];R({cpu:t.map((e=>({date:e.date,value:e.cpu}))),mem:t.map((e=>({date:e.date,value:e.mem}))),daemonMem:t.map((e=>({date:e.date,value:e.daemonMem}))),serviceMem:t.map((e=>({date:e.date,value:e.serviceMem})))})})).catch((e=>{O.Z.error(e.message)}))}),[a]);const _=[{label:n("common.group"),name:"groupName",options:{customBodyRenderLite(e){const{type:t,blocklet:n,groupName:r}=p[e];return"server"===t?(0,m.jsxs)(v.Z,{display:"flex",alignItems:"center",children:[(0,m.jsx)(q.r,{width:"14",height:"14"}),(0,m.jsx)(v.Z,{ml:1,children:r})]}):(0,m.jsxs)(v.Z,{display:"flex",alignItems:"center",children:[(0,m.jsx)(D.Z,{size:14,blocklet:n}),(0,m.jsx)(v.Z,{ml:1,children:r})]})}}},{label:n("common.name"),name:"name",options:{customBodyRenderLite(e){const{type:t,name:n,component:r,ancestors:o}=p[e];return"server"===t?(0,m.jsxs)(v.Z,{display:"flex",alignItems:"center",children:[(0,m.jsx)(w.Z,{width:"14",height:"14"}),(0,m.jsx)(v.Z,{ml:1,children:n})]}):(0,m.jsxs)(v.Z,{display:"flex",alignItems:"center",children:[(0,m.jsx)(E.Z,{size:14,blocklet:r,ancestors:o}),(0,m.jsx)(v.Z,{ml:1,children:n})]})}}},{label:n("common.uptime"),name:"runtimeInfo.uptime",options:{customBodyRenderLite(e){const{runtimeInfo:t}=p[e];return n=t.uptime,h()(Number(n||0),{locale:(0,I.FF)(r)});var n}}},{label:n("blocklet.runtimeInfo.memoryUsage"),name:"runtimeInfo.memoryUsage",options:{customBodyRenderLite(e){const{runtimeInfo:t}=p[e];return(0,H.Gw)((null===t||void 0===t?void 0:t.memoryUsage)||0)},sortDirection:"asc"}},{label:n("blocklet.runtimeInfo.cpuUsage"),name:"runtimeInfo.cpuUsage",options:{customBodyRenderLite(e){const{runtimeInfo:t}=p[e];return"".concat((t.cpuUsage||0).toFixed(1),"%")}}},{label:n("blocklet.runtimeInfo.processId"),name:"runtimeInfo.pid"},{label:n("blocklet.runtimeInfo.port"),name:"runtimeInfo.port"}];return(0,m.jsxs)("div",{children:[(0,m.jsxs)(v.Z,{display:"flex",justifyContent:"space-between",flexDirection:"row",mb:2,children:[(0,m.jsx)(s.Z,{component:"h3",variant:"h5",color:"textPrimary",style:{fontSize:18,fontWeight:"bold"},children:n("analytics.trend")}),(0,m.jsx)(b.Z,{size:"small",exclusive:!0,value:a,onChange:(e,t)=>l(t),children:[1,3,6,12,24].map((e=>(0,m.jsxs)(g.Z,{value:e,children:[e,"H"]},e)))})]}),(0,m.jsxs)(y.ZP,{mb:4,container:!0,spacing:4,children:[(0,m.jsx)(y.ZP,{item:!0,lg:3,md:6,sm:6,xs:12,children:(0,m.jsx)(S.Z,{...j.cpu,history:L.cpu})},"cpu"),(0,m.jsx)(y.ZP,{item:!0,lg:3,md:6,sm:6,xs:12,children:(0,m.jsx)(C.Z,{...j.mem,history:L.mem})},"memory"),(0,m.jsx)(y.ZP,{item:!0,lg:3,md:6,sm:6,xs:12,children:(0,m.jsx)(C.Z,{title:"".concat(n("common.memory")," (Daemon)"),used:j.daemon.memoryUsage||0,history:L.daemonMem})},"memory-daemon"),(0,m.jsx)(y.ZP,{item:!0,lg:3,md:6,sm:6,xs:12,children:(0,m.jsx)(C.Z,{title:"".concat(n("common.memory")," (Service)"),instanceCount:j.service.instanceCount||0,used:j.service.memoryUsage||0,history:L.serviceMem})},"memory-service"),j.disks.map((e=>(0,m.jsx)(y.ZP,{item:!0,lg:3,md:6,sm:6,xs:12,children:(0,m.jsx)(M,{disk:e})},"disk")))]}),(0,m.jsx)(x.Z,{className:"runtime-insight-list",title:n("analytics.detail"),locale:r,data:p,columns:_,options:{download:!1,filter:!1,print:!1,pagination:!1,rowsPerPage:100}})]})}function W(){const{data:e,externalData:t,initialized:n}=(0,G.RJ)();if(!n)return(0,m.jsx)(Z.Z,{relative:"parent",children:(0,m.jsx)(j.Z,{})});const r=[...e,...t]||[];return(0,m.jsx)(K,{initialBlocklets:r})}var X;function Q(){const e=(0,a.useNavigate)(),{t:t}=(0,o.useContext)(c.RD),{tab:n="traffic"}=(0,a.useParams)(),r=[{label:t("common.traffic"),value:"traffic"},{label:t("common.runtime"),value:"runtime"}],i={traffic:p,runtime:W},d=i[n]||i.traffic;return(0,m.jsxs)(J,{children:[(0,m.jsx)(s.Z,{component:"h2",variant:"h4",className:"page-header",color:"textPrimary",children:t("common.analytics")}),(0,m.jsx)(l.Z,{tabs:r,current:n,onChange:t=>{e("/analytics/".concat(t))}}),(0,m.jsx)("div",{className:"page-content",children:(0,o.isValidElement)(d)?d:(0,m.jsx)(d,{})})]})}const J=i.Z.main(X||(X=(0,r.Z)(["\n .page-header {\n display: flex;\n justify-content: space-between;\n align-items: center;\n }\n\n .page-content {\n margin-top: 16px;\n }\n"])))},36955:(e,t,n)=>{n.d(t,{Z:()=>p});var r,o=n(71171),i=n(55898),a=n.n(i),s=n(33518),l=n(38763),c=n(75392),d=n(11750),u=n(39948),m=n(96266);function p(e){let{style:t,title:n,value:r,graph:o,description:i}=e;return(0,m.jsx)(f,{children:(0,m.jsxs)(c.Z,{style:{...t},children:[(0,m.jsx)(d.Z,{sx:{fontSize:14},color:"text.secondary",children:n}),(0,m.jsx)(d.Z,{variant:"h5",component:"div",mt:1,children:r}),o,!!i&&(0,m.jsx)(u.Z,{display:"flex",sx:{fontSize:12,marginTop:3},color:"text.secondary",children:i})]})})}p.propTypes={style:a().object,title:a().node,value:a().node,graph:a().node,description:a().any},p.defaultProps={style:{},title:null,value:null,graph:null,description:null};const f=(0,s.Z)(l.Z)(r||(r=(0,o.Z)(["\n .card-content {\n height: 150px;\n }\n\n .card-sparkline {\n flex: 2;\n display: flex;\n position: relative;\n *[hidden] {\n display: none;\n }\n }\n .sparkline {\n stroke: ",";\n fill: ","1A;\n }\n .tooltip {\n position: absolute;\n background: rgba(0, 0, 0, 0.7);\n color: #fff;\n padding: 2px 5px;\n font-size: 12px;\n white-space: nowrap;\n z-index: 9999;\n }\n .sparkline--cursor {\n stroke: orange;\n }\n\n .sparkline--spot {\n fill: red;\n stroke: red;\n }\n"])),(e=>e.theme.palette.primary.main),(e=>e.theme.palette.primary.main))},70823:(e,t,n)=>{n.d(t,{Z:()=>u});var r=n(5057),o=n(55898),i=n.n(o),a=n(12673),s=n(28563),l=n(26089),c=n(36955),d=n(96266);function u(e){let{id:t,title:n,current:o,description:i,data:u,dateFn:m,valueFn:p}=e;const f=(0,r.useRef)(null),h=(0,r.useRef)(null),v=(0,a.Z)({style:{top:0,left:0},hidden:!0,textContent:""}),[y,g]=(0,r.useState)(null),b=(0,s.Z)(y),x={onmousemove(e,t){const{date:n,value:r}=t;v.textContent="".concat(m(n),": ").concat(p(r)),v.style.top=-30,v.style.left=80,v.hidden=!1},onmouseout(){v.hidden=!0}};return(0,r.useEffect)((()=>{setTimeout((()=>{g(document.querySelector(".".concat(t))),setTimeout((()=>{f.current&&(0,l.Z)(f.current,u||[],x)}),400)}))}),[u]),(0,d.jsx)(c.Z,{title:n,value:o,graph:(0,d.jsxs)("div",{className:"card-sparkline ".concat(t),style:{marginTop:16},children:[(0,d.jsx)("svg",{ref:f,className:"sparkline",width:(null===b||void 0===b?void 0:b.width)||100,height:30,strokeWidth:"2"}),(0,d.jsx)("span",{className:"tooltip",ref:h,hidden:v.hidden,style:{...v.style},children:v.textContent})]}),description:i})}u.propTypes={id:i().string.isRequired,title:i().string.isRequired,current:i().any.isRequired,description:i().any,data:i().array,dateFn:i().func,valueFn:i().func},u.defaultProps={description:null,data:[],dateFn:e=>e,valueFn:e=>e}},5863:(e,t,n)=>{n.d(t,{Z:()=>u});var r=n(5057),o=n(55898),i=n.n(o),a=n(68420),s=n(70823),l=n(64387),c=n(96266);const d=e=>"".concat(e,"%");function u(e){let{cpus:t,currentLoad:n,history:o}=e;const{t:i,locale:u}=(0,r.useContext)(a.RD);return(0,c.jsx)(s.Z,{id:"cpu-sparkline",title:i("common.cpu"),current:"".concat(Math.floor(n||0),"%"),data:o,description:"".concat(i("system.cores"),": ").concat((null===t||void 0===t?void 0:t.length)||0),dateFn:e=>(0,l.mr)(e,"HH:mm:ss",u),valueFn:d})}u.propTypes={cpus:i().array,currentLoad:i().number,history:i().array},u.defaultProps={cpus:[],currentLoad:0,history:[]}},38003:(e,t,n)=>{n.d(t,{Z:()=>d});var r=n(55898),o=n.n(r),i=n(39948),a=n(68420),s=n(70823),l=n(64387),c=n(96266);function d(e){let{instanceCount:t,title:n,total:r,used:o,history:d}=e;const{t:u,locale:m}=(0,a.PE)(),p=!!r,f=r-o,h=p?"(".concat(Math.floor(o/r*100),"%)"):"",v=[];return t&&v.push({title:u("system.instances"),metric:t}),v.push({title:u("system.used"),metric:(0,l.Gw)(o)}),p&&v.push({title:u("system.free"),metric:(0,l.Gw)(f)},{title:u("system.total"),metric:(0,l.Gw)(r)}),(0,c.jsx)(s.Z,{id:"mem-sparkline",title:n||u("common.memory"),current:"".concat((0,l.Gw)(Math.floor(o||0))," ").concat(h),data:d,description:v.map(((e,t)=>(0,c.jsxs)(i.Z,{sx:{marginLeft:0===t?0:2},children:[e.title,": ",e.metric]},e.title))),dateFn:e=>(0,l.mr)(e,"HH:mm:ss",m),valueFn:l.Gw})}d.propTypes={title:o().string,instanceCount:o().number,total:o().number,used:o().number,history:o().array},d.defaultProps={title:"",instanceCount:null,total:null,used:null,history:[]}},65889:(e,t,n)=>{n.r(t),n.d(t,{default:()=>U,getDefaultRanges:()=>M});var r=n(5057),o=n(1577),i=n.n(o),a=n(6465),s=n.n(a),l=n(6352),c=n.n(l),d=n(74511),u=n(96181),m=n(93938),p=n(44846),f=n(55402),h=n(11750),v=n(56556),y=n(67680),g=n(11819),b=n(13811),x=n(49204),j=n(79940),Z=n(20425),w=n(34862),k=n(68420),P=n(35432),O=n(87364),D=n(39458),E=n(4903),I=n(44926),N=n(90298),S=n(43713),C=n(59497),L=n(9732),R=n(13379),T=n(64387),z=n(22324),_=n(70823),F=n(96266);const B=s()(0),M=(e,t)=>[{label:"This Week",startDate:(0,O.Z)(e,{locale:t}),endDate:(0,D.Z)(e,{locale:t})},{label:"Last Week",startDate:(0,O.Z)((0,E.Z)(e,-1),{locale:t}),endDate:(0,D.Z)((0,E.Z)(e,-1),{locale:t})},{label:"Last 7 Days",startDate:(0,E.Z)(e,-1),endDate:e},{label:"This Month",startDate:(0,I.Z)(e),endDate:(0,N.Z)(e)},{label:"Last Month",startDate:(0,I.Z)((0,S.Z)(e,-1)),endDate:(0,N.Z)((0,S.Z)(e,-1))},{label:"This Year",startDate:(0,C.Z)(e),endDate:(0,L.Z)(e)},{label:"Last Year",startDate:(0,C.Z)((0,R.Z)(e,-1)),endDate:(0,L.Z)((0,R.Z)(e,-1))}];function U(e){let{client:t,did:n}=e;const o=i()().subtract(1,"day").toDate(),{info:a,inService:s}=(0,z.h6)(),{t:l,locale:O}=(0,k.PE)(),[D,E]=(0,r.useState)(null),[I,N]=(0,r.useState)(!1),[S,C]=(0,r.useState)(o),[L,R]=(0,r.useState)({startDate:i()().subtract(30,"day").toDate(),endDate:o}),U=(0,d.Z)((async()=>(await t.getTrafficInsights({input:{did:n,startDate:i()(L.startDate).format("YYYY-MM-DD"),endDate:i()(L.endDate).format("YYYY-MM-DD")}})).list));(0,r.useEffect)((()=>{U.loading||L.startDate&&L.endDate&&U.retry()}),[L]);const G=e=>{E(D?null:e.currentTarget)},q=U.value||[],{loading:Y,error:H}=U;if(!q.length&&Y)return(0,F.jsx)(p.Z,{});if(H)return(0,F.jsx)(m.Z,{severity:"error",children:(0,T.Z)(H)});const V={totalRequests:B,validRequests:B,failedRequests:B,uniqueVisitors:B,uniqueFiles:B,uniqueReferrers:B,uniqueNotFound:B,uniqueStaticFiles:B,logSize:T.Gw,bandwidth:T.Gw},A=Object.keys(V).map((e=>({id:"".concat(e,"_chart"),title:l("analytics.traffic.".concat(e)),current:q.length?V[e](q[0][e]):0,data:q.map((t=>({date:t.date,value:t[e]}))).reverse(),dateFn:B,valueFn:V[e]}))),K=Boolean(D),W=K?"date-range-picker-popover":void 0,X=s?P.WELLKNOWN_SERVICE_PATH_PREFIX:a.routing.adminPath,Q=c()(window.location.origin,X,"/api/analytics/traffic?date=".concat(i()(S).format("YYYY-MM-DD"),"&did=").concat(n));return(0,F.jsxs)("div",{children:[(0,F.jsxs)(h.Z,{component:"div",variant:"h5",className:"page-header",color:"textPrimary",style:{fontSize:18,fontWeight:"bold"},mb:2,children:[l("analytics.trend"),(0,F.jsxs)(v.Z,{onClick:G,variant:"outlined",size:"small",color:"secondary",children:[(0,T.pz)(L.startDate,O)," - ",(0,T.pz)(L.endDate,O)]})]}),(0,F.jsx)(g.ZP,{id:W,open:K,anchorEl:D,onClose:()=>E(null),anchorOrigin:{vertical:"bottom",horizontal:"left"},children:(0,F.jsx)(x.D,{open:!0,toggle:G,maxDate:o,definedRanges:M(S),onChange:e=>{R(e),E(null)}})}),(0,F.jsx)(f.ZP,{container:!0,spacing:4,children:A.map((e=>(0,F.jsx)(f.ZP,{item:!0,lg:3,md:6,sm:6,xs:12,children:(0,F.jsx)(_.Z,{...e})},e.id)))}),(0,F.jsxs)(h.Z,{component:"div",variant:"h5",className:"page-header",color:"textPrimary",style:{fontSize:18,fontWeight:"bold"},mt:4,mb:1,children:[l("analytics.detail"),(0,F.jsxs)("span",{children:[I&&(0,F.jsx)(y.Z,{onClick:()=>{window.open(Q)},style:{marginRight:32},children:(0,F.jsx)(b.Z,{})}),(0,F.jsx)(w._,{dateAdapter:Z.y,children:(0,F.jsx)(j.M,{disableFuture:!0,format:"ll",value:i()(S),onChange:e=>{C(e.toDate()),N(!1)},slotProps:{textField:{size:"small"}}})})]})]}),(0,F.jsx)(u.Z,{url:Q,width:"100%",height:"100%",frameBorder:0,onLoad:()=>N(!0),styles:{border:0,minHeight:"400vh"}})]})}},54474:(e,t,n)=>{n.d(t,{Z:()=>l});var r=n(55898),o=n.n(r),i=n(62681),a=n(74655),s=n(96266);function l(e){let{blocklet:t,style:n,size:r,...o}=e;const{logoUrl:l}=(0,a.Z)({blocklet:t}),{variant:c}=o;return(0,s.jsx)(i.Z,{variant:c||"square",style:Object.assign({backgroundColor:"transparent",width:r,height:r,borderRadius:10},n),...o,children:(0,s.jsx)("img",{src:l,alt:"",style:{width:r}})})}l.propTypes={blocklet:o().object.isRequired,style:o().object,size:o().oneOfType([o().number,o().string])},l.defaultProps={style:{},size:40}},26362:(e,t,n)=>{n.d(t,{Z:()=>p});var r=n(55898),o=n.n(r),i=n(62681),a=n(72333),s=n(6352),l=n.n(s),c=n(35432),d=n(22324),u=n(64387);var m=n(96266);function p(e){let{blocklet:t,style:n,size:r,ancestors:o,...s}=e;const p=(0,d.h6)(),{logoUrl:f,inService:h}=function(e){var t;let{blocklet:n,ancestors:r=[]}=e;const o=(0,d.h6)(),{inService:i}=o,a="?v=".concat(null===n||void 0===n||null===(t=n.meta)||void 0===t?void 0:t.version).concat((0,u.XN)(null===n||void 0===n?void 0:n.status)?"~":"");let s=i?l()(u.zn,c.WELLKNOWN_SERVICE_PATH_PREFIX,"/blocklet/logo-bundle",a):l()(o.imgPrefix,"blocklet.png");if("registry"===n.source&&n.deployedFrom&&n.meta.logo)s=l()(n.deployedFrom,(0,u.lk)(n.meta.bundleDid,n.meta.logo),a);else{const e=window.env.apiPrefix||"/",t=r.concat(n),o=i?t.slice(1):t;s=l()(e,"/blocklet/logo-bundle".concat(o.map((e=>"/".concat(e.meta.did))).join("")),a)}return{logoUrl:s,inService:i}}({blocklet:t,ancestors:o}),{variant:v}=s,y=h?()=>{}:e=>{e.target.src="".concat(p.imgPrefix,"/blocklet.png")};let g=(0,m.jsx)("img",{src:f,onError:y,alt:t.meta.name,style:{width:r}});return t.meta.logo||(g=(0,m.jsx)(a.Z,{did:t.meta.did||"",responsive:!0})),(0,m.jsx)(i.Z,{variant:v||"square",style:Object.assign({backgroundColor:"transparent",width:r,height:r,borderRadius:10},n),...s,children:g})}p.propTypes={blocklet:o().object.isRequired,style:o().object,size:o().oneOfType([o().number,o().string]),ancestors:o().array},p.defaultProps={style:{},size:40,ancestors:[]}},74655:(e,t,n)=>{n.d(t,{Z:()=>c});var r=n(6352),o=n.n(r),i=n(77277),a=n(22324),s=n(64387);const l=(e,t)=>{let n="?v=";var r;t?n+=(0,s.Qi)(t):n+="".concat(null===e||void 0===e||null===(r=e.meta)||void 0===r?void 0:r.version).concat((0,s.wS)(null===e||void 0===e?void 0:e.status)?"~":"");return n};function c(e){var t,n,r,s;let{blocklet:c}=e;const{inService:d}=(0,a.h6)(),u=null===(t=((null===c||void 0===c?void 0:c.environments)||[]).find((e=>e.key===i.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_LOGO_SQUARE)))||void 0===t?void 0:t.value,m=null===(n=((null===c||void 0===c?void 0:c.environments)||[]).find((e=>e.key===i.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_LOGO_RECT)))||void 0===n?void 0:n.value,p=null===(r=((null===c||void 0===c?void 0:c.environments)||[]).find((e=>e.key===i.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_LOGO_FAVICON)))||void 0===r?void 0:r.value,f=(null===(s=window.env)||void 0===s?void 0:s.apiPrefix)||"/";return{logoUrl:o()(f,"/blocklet/logo/".concat(d?"":c.meta.did),l(c,u)),rectLogoUrl:o()(f,"/blocklet/logo-rect/".concat(d?"":c.meta.did),l(c,m)),faviconUrl:o()(f,"/blocklet/logo-favicon/".concat(d?"":c.meta.did),l(c,p))}}},35701:(e,t,n)=>{t.Z=void 0;(r=n(5057))&&r.__esModule;var r,o=n(96266);function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function a(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?i(Object(n),!0).forEach((function(t){s(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function s(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var l=function(e){return(0,o.jsx)("svg",a(a({},e),{},{children:(0,o.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7.361 2.4a.8.8 0 0 0-.728.469L.873 15.54a.8.8 0 0 0-.072.33V27.393a.8.8 0 0 0 .8.8h28.8a.8.8 0 0 0 .8-.8v-11.52a.8.8 0 0 0-.072-.331L25.37 2.869a.8.8 0 0 0-.728-.47H7.361zm-4.96 14.4v9.792h27.2v-9.799a.814.814 0 0 1-.104.007h-7.098l-2.066 3.1a.8.8 0 0 1-.666.356h-8.064a.8.8 0 0 1-.665-.356L8.87 16.8h-6.47zm26.816-1.6H21.97a.8.8 0 0 0-.665.356l-2.067 3.1h-7.208l-2.066-3.1a.8.8 0 0 0-.666-.356H2.785L7.876 4h16.25l5.09 11.2z",fill:"currentColor"})}))};l.defaultProps={width:"32",height:"32",viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg"},l.displayName="empty";t.Z=l},66506:(e,t,n)=>{t.Z=void 0;(r=n(5057))&&r.__esModule;var r,o=n(96266);function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function a(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?i(Object(n),!0).forEach((function(t){s(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function s(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var l=function(e){return(0,o.jsxs)("svg",a(a({},e),{},{children:[(0,o.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2.083 3.2c0-.619.501-1.12 1.12-1.12h25.6c.619 0 1.12.501 1.12 1.12v10.24a1.12 1.12 0 0 1-1.12 1.12h-25.6a1.12 1.12 0 0 1-1.12-1.12V3.2zm2.24 1.12v8h23.36v-8H4.323zm-2.24 14.24c0-.619.501-1.12 1.12-1.12h25.6c.619 0 1.12.501 1.12 1.12V28.8a1.12 1.12 0 0 1-1.12 1.12h-25.6a1.12 1.12 0 0 1-1.12-1.12V18.56zm2.24 1.12v8h23.36v-8H4.323z",fill:"currentColor"}),(0,o.jsx)("path",{d:"M8.963 7.04h-1.28a.64.64 0 0 0-.64.64v1.28a.64.64 0 0 0 .64.64h1.28a.64.64 0 0 0 .64-.64V7.68a.64.64 0 0 0-.64-.64zm0 15.36h-1.28a.64.64 0 0 0-.64.64v1.28a.64.64 0 0 0 .64.64h1.28a.64.64 0 0 0 .64-.64v-1.28a.64.64 0 0 0-.64-.64zm5.12-15.36h-1.28a.64.64 0 0 0-.64.64v1.28a.64.64 0 0 0 .64.64h1.28a.64.64 0 0 0 .64-.64V7.68a.64.64 0 0 0-.64-.64zm0 15.36h-1.28a.64.64 0 0 0-.64.64v1.28a.64.64 0 0 0 .64.64h1.28a.64.64 0 0 0 .64-.64v-1.28a.64.64 0 0 0-.64-.64z",fill:"currentColor"})]}))};l.defaultProps={width:"32",height:"32",viewBox:"0 0 32 32",xmlns:"http://www.w3.org/2000/svg"},l.displayName="server";t.Z=l},25710:(e,t,n)=>{n.d(t,{Z:()=>p});var r,o=n(71171),i=n(55898),a=n.n(i),s=n(39948),l=n(35701),c=n(47685),d=n(96266);const u=(0,c.zo)(s.Z)(r||(r=(0,o.Z)(["\n display: flex;\n justify-content: center;\n align-items: center;\n flex-direction: column;\n height: 100%;\n min-height: 100px;\n color: #999;\n .empty-icon {\n margin: 10px 0;\n }\n"])));function m(e){let{color:t,size:n,children:r,...o}=e;return(0,d.jsxs)(u,{...o,children:[(0,d.jsx)(l.Z,{style:{width:n,height:n,color:t},className:"empty-icon"}),(0,d.jsx)(s.Z,{className:"empty-content",children:r})]})}m.propTypes={color:a().string,size:a().number,children:a().any},m.defaultProps={color:"inherit",size:36,children:null};const p=m},50844:(e,t,n)=>{n.d(t,{Z:()=>p});var r=n(7896),o=n(31461),i=n(5057),a=n(56129),s=n.n(a),l=n(92877);var c=n(95335),d=n(96266);const u=["defaultTheme","withTheme","name"],m=["classes"],p=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return n=>{const{defaultTheme:a,withTheme:p=!1,name:f}=t,h=(0,o.Z)(t,u);let v=f;const y=(0,l.Z)(e,(0,r.Z)({defaultTheme:a,Component:n,name:f||n.displayName,classNamePrefix:v},h)),g=i.forwardRef((function(e,t){const i=(0,o.Z)(e,m),s=y((0,r.Z)({},n.defaultProps,e));let l,u=i;return("string"===typeof f||p)&&(l=(0,c.Z)()||a,f&&(u=function(e){const{theme:t,name:n,props:o}=e;if(!t||!t.components||!t.components[n]||!t.components[n].defaultProps)return o;const i=(0,r.Z)({},o),a=t.components[n].defaultProps;let s;for(s in a)void 0===i[s]&&(i[s]=a[s]);return i}({theme:l,name:f,props:i})),p&&!u.theme&&(u.theme=l)),(0,d.jsx)(n,(0,r.Z)({ref:t,classes:s},u))}));return s()(g,n),g}}},88781:(e,t,n)=>{n.d(t,{Z:()=>o});var r=n(5057);function o(e){return r.Children.toArray(e).filter((e=>r.isValidElement(e)))}}}]);
|
|
1
|
+
"use strict";(self.webpackChunk_abtnode_webapp=self.webpackChunk_abtnode_webapp||[]).push([[9713,5889],{40249:(e,t,n)=>{n.r(t),n.d(t,{default:()=>Q});var r=n(71171),o=n(5057),i=n(33518),a=n(85493),s=n(11750),l=n(94464),c=n(68420),d=n(65889),u=n(75793),m=n(96266);function p(){const{api:e,info:t}=(0,u.h6)();return(0,m.jsx)(d.default,{client:e,did:t.did})}var f=n(45603),h=n.n(f),v=n(39948),y=n(55402),g=n(55222),b=n(28768),x=n(75760),j=n(44846),Z=n(35966),w=n(66506),k=n(35432),P=n(77277),O=n(86229),D=n(54474),E=n(26362),I=n(64387),N=n(38242),S=n(5863),C=n(38003),L=n(55898),R=n.n(L),T=n(50844),z=n(99154),_=n(36955);const F=(0,T.Z)((e=>({root:{height:10},colorPrimary:{backgroundColor:e.palette.grey["light"===e.palette.mode?200:700]},bar:{backgroundColor:e.palette.secondary.main}})))(z.Z);function B(e){const{value:t}=e;return(0,m.jsxs)(v.Z,{display:"flex",alignItems:"center",mt:2,children:[(0,m.jsx)(v.Z,{width:"100%",style:{overflow:"hidden"},mr:1,children:(0,m.jsx)(F,{variant:"determinate",...e})}),(0,m.jsx)(v.Z,{minWidth:35,children:(0,m.jsx)(s.Z,{variant:"body2",color:"textSecondary",children:"".concat(Math.round(t),"%")})})]})}function M(e){let{disk:t}=e;const{t:n}=(0,o.useContext)(c.RD),r=[{id:1,className:"used",title:n("system.used"),metric:(0,I.Gw)(t.used)},{id:2,className:"free",title:n("system.free"),metric:(0,I.Gw)(t.free)},{id:3,className:"total",title:n("system.total"),metric:(0,I.Gw)(t.total)}];return(0,m.jsx)(_.Z,{title:"".concat(n("common.disk")," (").concat(t.device,")"),value:(0,I.Gw)(t.used),graph:(0,m.jsx)(v.Z,{mt:3,children:(0,m.jsx)(B,{value:t.used/t.total*100})}),description:r.map(((e,t)=>(0,m.jsxs)(v.Z,{sx:{marginLeft:0===t?0:2},children:[e.title,": ",e.metric]},e.title)))})}B.propTypes={value:R().number.isRequired},M.propTypes={disk:R().shape({used:R().number,free:R().number,total:R().number,device:R().string})},M.defaultProps={disk:{used:0,free:0,total:1,device:""}};var U=n(67654),G=n(52926),q=n(52581),Y=n(6202),H=n(74094);const V={uptime:0,pid:-1,cpuUsage:0,memoryUsage:0},A="Blocklet Server";function K(e){let{initialBlocklets:t}=e;const{t:n,locale:r}=(0,c.PE)(),{api:i}=(0,u.h6)(),[a,l]=(0,U.Z)("runtime-view-interval",6),d=(0,o.useMemo)((()=>{const e=[];return e.push({type:"server",groupId:"server",groupName:A,id:"server:daemon",name:"Server (Daemon)",runtimeInfo:V}),e.push({type:"server",groupId:"server",groupName:A,id:"server:service",name:"Server (Service)",runtimeInfo:V}),t.forEach((t=>{(0,N.forEachBlockletSync)(t,((n,r)=>{let{id:o,ancestors:i}=r;n.runtimeInfo&&e.push({type:"blocklet",groupId:t.meta.did,groupName:(0,N.getDisplayName)(t),id:o,name:(0,N.getDisplayName)(n,!0),blocklet:t,component:n,runtimeInfo:n.runtimeInfo,ancestors:i})}))})),e}),[]),[p,f]=(0,o.useState)(d),[j,Z]=(0,o.useState)({os:{platform:""},mem:{used:0,free:0,total:1},cpu:{cpus:[],currentLoad:1},disks:[],daemon:{},service:{}}),[L,R]=(0,o.useState)({cpu:[],mem:[],daemonMem:[],serviceMem:[]});(0,Y.mU)(k.EVENTS.NODE_RUNTIME_INFO,(e=>{e.mem.total=e.mem.total||0,e.mem.used=e.mem.total-(e.mem.available||0),Z(e),f((t=>t.map((t=>"server:daemon"===t.id?{...t,runtimeInfo:{...t.runtimeInfo,...e.daemon}}:"server:service"===t.id?{...t,runtimeInfo:{...t.runtimeInfo,...e.service}}:t))))})),(0,Y.mU)(k.EVENTS.BLOCKLETS_RUNTIME_INFO,(e=>{e&&e.length?f((t=>t.map((t=>{const n=e.find((e=>e.componentId===t.id));return n?{...t,runtimeInfo:{...t.runtimeInfo,...n.runtimeInfo}}:t})))):console.error("incorrect blocklets runtime info format",e)}));const T=e=>{f((t=>t.filter((t=>t.groupId!==e.meta.did))))},z=async e=>{try{const{blocklet:t}=await i.getBlocklet({input:{did:e.meta.did,attachRuntimeInfo:!0}});"running"!==t.status&&T(t),f((e=>{const n=e.filter((e=>e.groupId!==t.meta.did));return(0,N.forEachBlockletSync)(t,((e,r)=>{let{id:o,ancestors:i}=r;e.runtimeInfo&&n.push({type:"blocklet",groupId:t.meta.did,groupName:(0,N.getDisplayName)(t),id:o,name:(0,N.getDisplayName)(e,!0),blocklet:t,component:e,runtimeInfo:e.runtimeInfo,ancestors:i})})),n}))}catch(t){O.Z.error(t.message)}};(0,Y.mU)(P.BlockletEvents.removed,T),(0,Y.mU)(P.BlockletEvents.startFailed,T),(0,Y.mU)(P.BlockletEvents.statusChange,(e=>{"running"===e.status?z(e):T(e)})),(0,Y.mU)(P.BlockletEvents.updated,z),(0,Y.mU)(P.BlockletEvents.started,z);(0,o.useEffect)((()=>{i.getNodeRuntimeHistory({input:{hours:a}}).then((e=>{const t=e.history||[];R({cpu:t.map((e=>({date:e.date,value:e.cpu}))),mem:t.map((e=>({date:e.date,value:e.mem}))),daemonMem:t.map((e=>({date:e.date,value:e.daemonMem}))),serviceMem:t.map((e=>({date:e.date,value:e.serviceMem})))})})).catch((e=>{O.Z.error(e.message)}))}),[a]);const _=[{label:n("common.group"),name:"groupName",options:{customBodyRenderLite(e){const{type:t,blocklet:n,groupName:r}=p[e];return"server"===t?(0,m.jsxs)(v.Z,{display:"flex",alignItems:"center",children:[(0,m.jsx)(q.r,{width:"14",height:"14"}),(0,m.jsx)(v.Z,{ml:1,children:r})]}):(0,m.jsxs)(v.Z,{display:"flex",alignItems:"center",children:[(0,m.jsx)(D.Z,{size:14,blocklet:n}),(0,m.jsx)(v.Z,{ml:1,children:r})]})}}},{label:n("common.name"),name:"name",options:{customBodyRenderLite(e){const{type:t,name:n,component:r,ancestors:o}=p[e];return"server"===t?(0,m.jsxs)(v.Z,{display:"flex",alignItems:"center",children:[(0,m.jsx)(w.Z,{width:"14",height:"14"}),(0,m.jsx)(v.Z,{ml:1,children:n})]}):(0,m.jsxs)(v.Z,{display:"flex",alignItems:"center",children:[(0,m.jsx)(E.Z,{size:14,blocklet:r,ancestors:o}),(0,m.jsx)(v.Z,{ml:1,children:n})]})}}},{label:n("common.uptime"),name:"runtimeInfo.uptime",options:{customBodyRenderLite(e){const{runtimeInfo:t}=p[e];return n=t.uptime,h()(Number(n||0),{locale:(0,I.FF)(r)});var n}}},{label:n("blocklet.runtimeInfo.memoryUsage"),name:"runtimeInfo.memoryUsage",options:{customBodyRenderLite(e){const{runtimeInfo:t}=p[e];return(0,H.Gw)((null===t||void 0===t?void 0:t.memoryUsage)||0)},sortDirection:"asc"}},{label:n("blocklet.runtimeInfo.cpuUsage"),name:"runtimeInfo.cpuUsage",options:{customBodyRenderLite(e){const{runtimeInfo:t}=p[e];return"".concat((t.cpuUsage||0).toFixed(1),"%")}}},{label:n("blocklet.runtimeInfo.processId"),name:"runtimeInfo.pid"},{label:n("blocklet.runtimeInfo.port"),name:"runtimeInfo.port"}];return(0,m.jsxs)("div",{children:[(0,m.jsxs)(v.Z,{display:"flex",justifyContent:"space-between",flexDirection:"row",mb:2,children:[(0,m.jsx)(s.Z,{component:"h3",variant:"h5",color:"textPrimary",style:{fontSize:18,fontWeight:"bold"},children:n("analytics.trend")}),(0,m.jsx)(b.Z,{size:"small",exclusive:!0,value:a,onChange:(e,t)=>l(t),children:[1,3,6,12,24].map((e=>(0,m.jsxs)(g.Z,{value:e,children:[e,"H"]},e)))})]}),(0,m.jsxs)(y.ZP,{mb:4,container:!0,spacing:4,children:[(0,m.jsx)(y.ZP,{item:!0,lg:3,md:6,sm:6,xs:12,children:(0,m.jsx)(S.Z,{...j.cpu,history:L.cpu})},"cpu"),(0,m.jsx)(y.ZP,{item:!0,lg:3,md:6,sm:6,xs:12,children:(0,m.jsx)(C.Z,{...j.mem,history:L.mem})},"memory"),(0,m.jsx)(y.ZP,{item:!0,lg:3,md:6,sm:6,xs:12,children:(0,m.jsx)(C.Z,{title:"".concat(n("common.memory")," (Daemon)"),used:j.daemon.memoryUsage||0,history:L.daemonMem})},"memory-daemon"),(0,m.jsx)(y.ZP,{item:!0,lg:3,md:6,sm:6,xs:12,children:(0,m.jsx)(C.Z,{title:"".concat(n("common.memory")," (Service)"),instanceCount:j.service.instanceCount||0,used:j.service.memoryUsage||0,history:L.serviceMem})},"memory-service"),j.disks.map((e=>(0,m.jsx)(y.ZP,{item:!0,lg:3,md:6,sm:6,xs:12,children:(0,m.jsx)(M,{disk:e})},"disk")))]}),(0,m.jsx)(x.Z,{className:"runtime-insight-list",title:n("analytics.detail"),locale:r,data:p,columns:_,options:{download:!1,filter:!1,print:!1,pagination:!1,rowsPerPage:100}})]})}function W(){const{data:e,externalData:t,initialized:n}=(0,G.RJ)();if(!n)return(0,m.jsx)(Z.Z,{relative:"parent",children:(0,m.jsx)(j.Z,{})});const r=[...e,...t]||[];return(0,m.jsx)(K,{initialBlocklets:r})}var X;function Q(){const e=(0,a.useNavigate)(),{t:t}=(0,o.useContext)(c.RD),{tab:n="traffic"}=(0,a.useParams)(),r=[{label:t("common.traffic"),value:"traffic"},{label:t("common.runtime"),value:"runtime"}],i={traffic:p,runtime:W},d=i[n]||i.traffic;return(0,m.jsxs)(J,{children:[(0,m.jsx)(s.Z,{component:"h2",variant:"h4",className:"page-header",color:"textPrimary",children:t("common.analytics")}),(0,m.jsx)(l.Z,{tabs:r,current:n,onChange:t=>{e("/analytics/".concat(t))}}),(0,m.jsx)("div",{className:"page-content",children:(0,o.isValidElement)(d)?d:(0,m.jsx)(d,{})})]})}const J=i.Z.main(X||(X=(0,r.Z)(["\n .page-header {\n display: flex;\n justify-content: space-between;\n align-items: center;\n }\n\n .page-content {\n margin-top: 16px;\n }\n"])))},36955:(e,t,n)=>{n.d(t,{Z:()=>p});var r,o=n(71171),i=n(55898),a=n.n(i),s=n(33518),l=n(38763),c=n(75392),d=n(11750),u=n(39948),m=n(96266);function p(e){let{style:t,title:n,value:r,graph:o,description:i}=e;return(0,m.jsx)(f,{children:(0,m.jsxs)(c.Z,{style:{...t},children:[(0,m.jsx)(d.Z,{sx:{fontSize:14},color:"text.secondary",children:n}),(0,m.jsx)(d.Z,{variant:"h5",component:"div",mt:1,children:r}),o,!!i&&(0,m.jsx)(u.Z,{display:"flex",sx:{fontSize:12,marginTop:3},color:"text.secondary",children:i})]})})}p.propTypes={style:a().object,title:a().node,value:a().node,graph:a().node,description:a().any},p.defaultProps={style:{},title:null,value:null,graph:null,description:null};const f=(0,s.Z)(l.Z)(r||(r=(0,o.Z)(["\n .card-content {\n height: 150px;\n }\n\n .card-sparkline {\n flex: 2;\n display: flex;\n position: relative;\n *[hidden] {\n display: none;\n }\n }\n .sparkline {\n stroke: ",";\n fill: ","1A;\n }\n .tooltip {\n position: absolute;\n background: rgba(0, 0, 0, 0.7);\n color: #fff;\n padding: 2px 5px;\n font-size: 12px;\n white-space: nowrap;\n z-index: 9999;\n }\n .sparkline--cursor {\n stroke: orange;\n }\n\n .sparkline--spot {\n fill: red;\n stroke: red;\n }\n"])),(e=>e.theme.palette.primary.main),(e=>e.theme.palette.primary.main))},70823:(e,t,n)=>{n.d(t,{Z:()=>u});var r=n(5057),o=n(55898),i=n.n(o),a=n(12673),s=n(28563),l=n(26089),c=n(36955),d=n(96266);function u(e){let{id:t,title:n,current:o,description:i,data:u,dateFn:m,valueFn:p}=e;const f=(0,r.useRef)(null),h=(0,r.useRef)(null),v=(0,a.Z)({style:{top:0,left:0},hidden:!0,textContent:""}),[y,g]=(0,r.useState)(null),b=(0,s.Z)(y),x={onmousemove(e,t){const{date:n,value:r}=t;v.textContent="".concat(m(n),": ").concat(p(r)),v.style.top=-30,v.style.left=80,v.hidden=!1},onmouseout(){v.hidden=!0}};return(0,r.useEffect)((()=>{setTimeout((()=>{g(document.querySelector(".".concat(t))),setTimeout((()=>{f.current&&(0,l.Z)(f.current,u||[],x)}),400)}))}),[u]),(0,d.jsx)(c.Z,{title:n,value:o,graph:(0,d.jsxs)("div",{className:"card-sparkline ".concat(t),style:{marginTop:16},children:[(0,d.jsx)("svg",{ref:f,className:"sparkline",width:(null===b||void 0===b?void 0:b.width)||100,height:30,strokeWidth:"2"}),(0,d.jsx)("span",{className:"tooltip",ref:h,hidden:v.hidden,style:{...v.style},children:v.textContent})]}),description:i})}u.propTypes={id:i().string.isRequired,title:i().string.isRequired,current:i().any.isRequired,description:i().any,data:i().array,dateFn:i().func,valueFn:i().func},u.defaultProps={description:null,data:[],dateFn:e=>e,valueFn:e=>e}},5863:(e,t,n)=>{n.d(t,{Z:()=>u});var r=n(5057),o=n(55898),i=n.n(o),a=n(68420),s=n(70823),l=n(64387),c=n(96266);const d=e=>"".concat(e,"%");function u(e){let{cpus:t,currentLoad:n,history:o}=e;const{t:i,locale:u}=(0,r.useContext)(a.RD);return(0,c.jsx)(s.Z,{id:"cpu-sparkline",title:i("common.cpu"),current:"".concat(Math.floor(n||0),"%"),data:o,description:"".concat(i("system.cores"),": ").concat((null===t||void 0===t?void 0:t.length)||0),dateFn:e=>(0,l.mr)(e,"HH:mm:ss",u),valueFn:d})}u.propTypes={cpus:i().array,currentLoad:i().number,history:i().array},u.defaultProps={cpus:[],currentLoad:0,history:[]}},38003:(e,t,n)=>{n.d(t,{Z:()=>d});var r=n(55898),o=n.n(r),i=n(39948),a=n(68420),s=n(70823),l=n(64387),c=n(96266);function d(e){let{instanceCount:t,title:n,total:r,used:o,history:d}=e;const{t:u,locale:m}=(0,a.PE)(),p=!!r,f=r-o,h=p?"(".concat(Math.floor(o/r*100),"%)"):"",v=[];return t&&v.push({title:u("system.instances"),metric:t}),v.push({title:u("system.used"),metric:(0,l.Gw)(o)}),p&&v.push({title:u("system.free"),metric:(0,l.Gw)(f)},{title:u("system.total"),metric:(0,l.Gw)(r)}),(0,c.jsx)(s.Z,{id:"mem-sparkline",title:n||u("common.memory"),current:"".concat((0,l.Gw)(Math.floor(o||0))," ").concat(h),data:d,description:v.map(((e,t)=>(0,c.jsxs)(i.Z,{sx:{marginLeft:0===t?0:2},children:[e.title,": ",e.metric]},e.title))),dateFn:e=>(0,l.mr)(e,"HH:mm:ss",m),valueFn:l.Gw})}d.propTypes={title:o().string,instanceCount:o().number,total:o().number,used:o().number,history:o().array},d.defaultProps={title:"",instanceCount:null,total:null,used:null,history:[]}},65889:(e,t,n)=>{n.r(t),n.d(t,{default:()=>U,getDefaultRanges:()=>M});var r=n(5057),o=n(1577),i=n.n(o),a=n(6465),s=n.n(a),l=n(6352),c=n.n(l),d=n(74511),u=n(96181),m=n(93938),p=n(44846),f=n(55402),h=n(11750),v=n(56556),y=n(67680),g=n(11819),b=n(13811),x=n(49204),j=n(79940),Z=n(20425),w=n(34862),k=n(68420),P=n(35432),O=n(87364),D=n(39458),E=n(4903),I=n(44926),N=n(90298),S=n(43713),C=n(59497),L=n(9732),R=n(13379),T=n(64387),z=n(22324),_=n(70823),F=n(96266);const B=s()(0),M=(e,t)=>[{label:"This Week",startDate:(0,O.Z)(e,{locale:t}),endDate:(0,D.Z)(e,{locale:t})},{label:"Last Week",startDate:(0,O.Z)((0,E.Z)(e,-1),{locale:t}),endDate:(0,D.Z)((0,E.Z)(e,-1),{locale:t})},{label:"Last 7 Days",startDate:(0,E.Z)(e,-1),endDate:e},{label:"This Month",startDate:(0,I.Z)(e),endDate:(0,N.Z)(e)},{label:"Last Month",startDate:(0,I.Z)((0,S.Z)(e,-1)),endDate:(0,N.Z)((0,S.Z)(e,-1))},{label:"This Year",startDate:(0,C.Z)(e),endDate:(0,L.Z)(e)},{label:"Last Year",startDate:(0,C.Z)((0,R.Z)(e,-1)),endDate:(0,L.Z)((0,R.Z)(e,-1))}];function U(e){let{client:t,did:n}=e;const o=i()().subtract(1,"day").toDate(),{info:a,inService:s}=(0,z.h6)(),{t:l,locale:O}=(0,k.PE)(),[D,E]=(0,r.useState)(null),[I,N]=(0,r.useState)(!1),[S,C]=(0,r.useState)(o),[L,R]=(0,r.useState)({startDate:i()().subtract(30,"day").toDate(),endDate:o}),U=(0,d.Z)((async()=>(await t.getTrafficInsights({input:{did:n,startDate:i()(L.startDate).format("YYYY-MM-DD"),endDate:i()(L.endDate).format("YYYY-MM-DD")}})).list));(0,r.useEffect)((()=>{U.loading||L.startDate&&L.endDate&&U.retry()}),[L]);const G=e=>{E(D?null:e.currentTarget)},q=U.value||[],{loading:Y,error:H}=U;if(!q.length&&Y)return(0,F.jsx)(p.Z,{});if(H)return(0,F.jsx)(m.Z,{severity:"error",children:(0,T.Z)(H)});const V={totalRequests:B,validRequests:B,failedRequests:B,uniqueVisitors:B,uniqueFiles:B,uniqueReferrers:B,uniqueNotFound:B,uniqueStaticFiles:B,logSize:T.Gw,bandwidth:T.Gw},A=Object.keys(V).map((e=>({id:"".concat(e,"_chart"),title:l("analytics.traffic.".concat(e)),current:q.length?V[e](q[0][e]):0,data:q.map((t=>({date:t.date,value:t[e]}))).reverse(),dateFn:B,valueFn:V[e]}))),K=Boolean(D),W=K?"date-range-picker-popover":void 0,X=s?P.WELLKNOWN_SERVICE_PATH_PREFIX:a.routing.adminPath,Q=c()(window.location.origin,X,"/api/analytics/traffic?date=".concat(i()(S).format("YYYY-MM-DD"),"&did=").concat(n));return(0,F.jsxs)("div",{children:[(0,F.jsxs)(h.Z,{component:"div",variant:"h5",className:"page-header",color:"textPrimary",style:{fontSize:18,fontWeight:"bold"},mb:2,children:[l("analytics.trend"),(0,F.jsxs)(v.Z,{onClick:G,variant:"outlined",size:"small",color:"secondary",children:[(0,T.pz)(L.startDate,O)," - ",(0,T.pz)(L.endDate,O)]})]}),(0,F.jsx)(g.ZP,{id:W,open:K,anchorEl:D,onClose:()=>E(null),anchorOrigin:{vertical:"bottom",horizontal:"left"},children:(0,F.jsx)(x.D,{open:!0,toggle:G,maxDate:o,definedRanges:M(S),onChange:e=>{R(e),E(null)}})}),(0,F.jsx)(f.ZP,{container:!0,spacing:4,children:A.map((e=>(0,F.jsx)(f.ZP,{item:!0,lg:3,md:6,sm:6,xs:12,children:(0,F.jsx)(_.Z,{...e})},e.id)))}),(0,F.jsxs)(h.Z,{component:"div",variant:"h5",className:"page-header",color:"textPrimary",style:{fontSize:18,fontWeight:"bold"},mt:4,mb:1,children:[l("analytics.detail"),(0,F.jsxs)("span",{children:[I&&(0,F.jsx)(y.Z,{onClick:()=>{window.open(Q)},style:{marginRight:32},children:(0,F.jsx)(b.Z,{})}),(0,F.jsx)(w._,{dateAdapter:Z.y,children:(0,F.jsx)(j.M,{disableFuture:!0,format:"ll",value:i()(S),onChange:e=>{C(e.toDate()),N(!1)},slotProps:{textField:{size:"small"}}})})]})]}),(0,F.jsx)(u.Z,{url:Q,width:"100%",height:"100%",frameBorder:0,onLoad:()=>N(!0),styles:{border:0,minHeight:"400vh"}})]})}},54474:(e,t,n)=>{n.d(t,{Z:()=>l});var r=n(55898),o=n.n(r),i=n(62681),a=n(74655),s=n(96266);function l(e){let{blocklet:t,style:n,size:r,...o}=e;const{logoUrl:l}=(0,a.Z)({blocklet:t}),{variant:c}=o;return(0,s.jsx)(i.Z,{variant:c||"square",style:Object.assign({backgroundColor:"transparent",width:r,height:r,borderRadius:10},n),...o,children:(0,s.jsx)("img",{src:l,alt:"",style:{width:r}})})}l.propTypes={blocklet:o().object.isRequired,style:o().object,size:o().oneOfType([o().number,o().string])},l.defaultProps={style:{},size:40}},26362:(e,t,n)=>{n.d(t,{Z:()=>p});var r=n(55898),o=n.n(r),i=n(62681),a=n(72333),s=n(6352),l=n.n(s),c=n(35432),d=n(22324),u=n(64387);var m=n(96266);function p(e){let{blocklet:t,style:n,size:r,ancestors:o,...s}=e;const p=(0,d.h6)(),{logoUrl:f,inService:h}=function(e){var t;let{blocklet:n,ancestors:r=[]}=e;const o=(0,d.h6)(),{inService:i}=o,a=(0,u.XN)(null===n||void 0===n?void 0:n.status)||(0,u.tv)(null===n||void 0===n?void 0:n.status),s="?v=".concat(null===n||void 0===n||null===(t=n.meta)||void 0===t?void 0:t.version).concat(a?"~":"");let m=i?l()(u.zn,c.WELLKNOWN_SERVICE_PATH_PREFIX,"/blocklet/logo-bundle",s):l()(o.imgPrefix,"blocklet.png");if("registry"===n.source&&n.deployedFrom&&n.meta.logo)m=l()(n.deployedFrom,(0,u.lk)(n.meta.bundleDid,n.meta.logo),s);else{const e=window.env.apiPrefix||"/",t=r.concat(n),o=i?t.slice(1):t;m=l()(e,"/blocklet/logo-bundle".concat(o.map((e=>"/".concat(e.meta.did))).join("")),s)}return{logoUrl:m,inService:i}}({blocklet:t,ancestors:o}),{variant:v}=s,y=h?()=>{}:e=>{e.target.src="".concat(p.imgPrefix,"/blocklet.png")};let g=(0,m.jsx)("img",{src:f,onError:y,alt:t.meta.name,style:{width:r}});return t.meta.logo||(g=(0,m.jsx)(a.Z,{did:t.meta.did||"",responsive:!0})),(0,m.jsx)(i.Z,{variant:v||"square",style:Object.assign({backgroundColor:"transparent",width:r,height:r,borderRadius:10},n),...s,children:g})}p.propTypes={blocklet:o().object.isRequired,style:o().object,size:o().oneOfType([o().number,o().string]),ancestors:o().array},p.defaultProps={style:{},size:40,ancestors:[]}},74655:(e,t,n)=>{n.d(t,{Z:()=>c});var r=n(6352),o=n.n(r),i=n(77277),a=n(22324),s=n(64387);const l=(e,t)=>{let n="?v=";var r;t?n+=(0,s.Qi)(t):n+="".concat(null===e||void 0===e||null===(r=e.meta)||void 0===r?void 0:r.version).concat((0,s.wS)(null===e||void 0===e?void 0:e.status)?"~":"");return n};function c(e){var t,n,r,s;let{blocklet:c}=e;const{inService:d}=(0,a.h6)(),u=null===(t=((null===c||void 0===c?void 0:c.environments)||[]).find((e=>e.key===i.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_LOGO_SQUARE)))||void 0===t?void 0:t.value,m=null===(n=((null===c||void 0===c?void 0:c.environments)||[]).find((e=>e.key===i.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_LOGO_RECT)))||void 0===n?void 0:n.value,p=null===(r=((null===c||void 0===c?void 0:c.environments)||[]).find((e=>e.key===i.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_LOGO_FAVICON)))||void 0===r?void 0:r.value,f=(null===(s=window.env)||void 0===s?void 0:s.apiPrefix)||"/";return{logoUrl:o()(f,"/blocklet/logo/".concat(d?"":c.meta.did),l(c,u)),rectLogoUrl:o()(f,"/blocklet/logo-rect/".concat(d?"":c.meta.did),l(c,m)),faviconUrl:o()(f,"/blocklet/logo-favicon/".concat(d?"":c.meta.did),l(c,p))}}},35701:(e,t,n)=>{t.Z=void 0;(r=n(5057))&&r.__esModule;var r,o=n(96266);function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function a(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?i(Object(n),!0).forEach((function(t){s(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function s(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var l=function(e){return(0,o.jsx)("svg",a(a({},e),{},{children:(0,o.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7.361 2.4a.8.8 0 0 0-.728.469L.873 15.54a.8.8 0 0 0-.072.33V27.393a.8.8 0 0 0 .8.8h28.8a.8.8 0 0 0 .8-.8v-11.52a.8.8 0 0 0-.072-.331L25.37 2.869a.8.8 0 0 0-.728-.47H7.361zm-4.96 14.4v9.792h27.2v-9.799a.814.814 0 0 1-.104.007h-7.098l-2.066 3.1a.8.8 0 0 1-.666.356h-8.064a.8.8 0 0 1-.665-.356L8.87 16.8h-6.47zm26.816-1.6H21.97a.8.8 0 0 0-.665.356l-2.067 3.1h-7.208l-2.066-3.1a.8.8 0 0 0-.666-.356H2.785L7.876 4h16.25l5.09 11.2z",fill:"currentColor"})}))};l.defaultProps={width:"32",height:"32",viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg"},l.displayName="empty";t.Z=l},66506:(e,t,n)=>{t.Z=void 0;(r=n(5057))&&r.__esModule;var r,o=n(96266);function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function a(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?i(Object(n),!0).forEach((function(t){s(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function s(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var l=function(e){return(0,o.jsxs)("svg",a(a({},e),{},{children:[(0,o.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2.083 3.2c0-.619.501-1.12 1.12-1.12h25.6c.619 0 1.12.501 1.12 1.12v10.24a1.12 1.12 0 0 1-1.12 1.12h-25.6a1.12 1.12 0 0 1-1.12-1.12V3.2zm2.24 1.12v8h23.36v-8H4.323zm-2.24 14.24c0-.619.501-1.12 1.12-1.12h25.6c.619 0 1.12.501 1.12 1.12V28.8a1.12 1.12 0 0 1-1.12 1.12h-25.6a1.12 1.12 0 0 1-1.12-1.12V18.56zm2.24 1.12v8h23.36v-8H4.323z",fill:"currentColor"}),(0,o.jsx)("path",{d:"M8.963 7.04h-1.28a.64.64 0 0 0-.64.64v1.28a.64.64 0 0 0 .64.64h1.28a.64.64 0 0 0 .64-.64V7.68a.64.64 0 0 0-.64-.64zm0 15.36h-1.28a.64.64 0 0 0-.64.64v1.28a.64.64 0 0 0 .64.64h1.28a.64.64 0 0 0 .64-.64v-1.28a.64.64 0 0 0-.64-.64zm5.12-15.36h-1.28a.64.64 0 0 0-.64.64v1.28a.64.64 0 0 0 .64.64h1.28a.64.64 0 0 0 .64-.64V7.68a.64.64 0 0 0-.64-.64zm0 15.36h-1.28a.64.64 0 0 0-.64.64v1.28a.64.64 0 0 0 .64.64h1.28a.64.64 0 0 0 .64-.64v-1.28a.64.64 0 0 0-.64-.64z",fill:"currentColor"})]}))};l.defaultProps={width:"32",height:"32",viewBox:"0 0 32 32",xmlns:"http://www.w3.org/2000/svg"},l.displayName="server";t.Z=l},25710:(e,t,n)=>{n.d(t,{Z:()=>p});var r,o=n(71171),i=n(55898),a=n.n(i),s=n(39948),l=n(35701),c=n(47685),d=n(96266);const u=(0,c.zo)(s.Z)(r||(r=(0,o.Z)(["\n display: flex;\n justify-content: center;\n align-items: center;\n flex-direction: column;\n height: 100%;\n min-height: 100px;\n color: #999;\n .empty-icon {\n margin: 10px 0;\n }\n"])));function m(e){let{color:t,size:n,children:r,...o}=e;return(0,d.jsxs)(u,{...o,children:[(0,d.jsx)(l.Z,{style:{width:n,height:n,color:t},className:"empty-icon"}),(0,d.jsx)(s.Z,{className:"empty-content",children:r})]})}m.propTypes={color:a().string,size:a().number,children:a().any},m.defaultProps={color:"inherit",size:36,children:null};const p=m},50844:(e,t,n)=>{n.d(t,{Z:()=>p});var r=n(7896),o=n(31461),i=n(5057),a=n(56129),s=n.n(a),l=n(92877);var c=n(95335),d=n(96266);const u=["defaultTheme","withTheme","name"],m=["classes"],p=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return n=>{const{defaultTheme:a,withTheme:p=!1,name:f}=t,h=(0,o.Z)(t,u);let v=f;const y=(0,l.Z)(e,(0,r.Z)({defaultTheme:a,Component:n,name:f||n.displayName,classNamePrefix:v},h)),g=i.forwardRef((function(e,t){const i=(0,o.Z)(e,m),s=y((0,r.Z)({},n.defaultProps,e));let l,u=i;return("string"===typeof f||p)&&(l=(0,c.Z)()||a,f&&(u=function(e){const{theme:t,name:n,props:o}=e;if(!t||!t.components||!t.components[n]||!t.components[n].defaultProps)return o;const i=(0,r.Z)({},o),a=t.components[n].defaultProps;let s;for(s in a)void 0===i[s]&&(i[s]=a[s]);return i}({theme:l,name:f,props:i})),p&&!u.theme&&(u.theme=l)),(0,d.jsx)(n,(0,r.Z)({ref:t,classes:s},u))}));return s()(g,n),g}}},88781:(e,t,n)=>{n.d(t,{Z:()=>o});var r=n(5057);function o(e){return r.Children.toArray(e).filter((e=>r.isValidElement(e)))}}}]);
|