@abtnode/webapp 1.16.19-beta-e6aac665 → 1.16.19-beta-710018ca

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/blocklet.js +1 -1
  2. package/blocklet.yml +1 -1
  3. package/build/asset-manifest.json +18 -19
  4. package/build/index.html +1 -1
  5. package/build/service-worker.js +1 -1
  6. package/build/static/css/3826.a5e3e6d6.chunk.css +11 -0
  7. package/build/static/js/{1037.654af9cb.chunk.js → 1037.fa6fc30e.chunk.js} +1 -1
  8. package/build/static/js/2311.fb7b3581.chunk.js +2 -0
  9. package/build/static/js/{2334.66fda96c.chunk.js → 2334.beff29a4.chunk.js} +1 -1
  10. package/build/static/js/2842.72d41513.chunk.js +1 -0
  11. package/build/static/js/3389.f5ebb45b.chunk.js +1 -0
  12. package/build/static/js/3826.9bdb438c.chunk.js +2 -0
  13. package/build/static/js/3883.0f7d3ca3.chunk.js +1 -0
  14. package/build/static/js/{4775.83ce25f4.chunk.js → 4775.ba145c26.chunk.js} +1 -1
  15. package/build/static/js/5953.1aad70e4.chunk.js +1 -0
  16. package/build/static/js/{6511.63e6ee73.chunk.js → 6511.02e01710.chunk.js} +1 -1
  17. package/build/static/js/{7022.53e6fae9.chunk.js → 7022.f99392a5.chunk.js} +1 -1
  18. package/build/static/js/{7657.1a626c13.chunk.js → 7657.30740d96.chunk.js} +2 -2
  19. package/build/static/js/{7718.96a45ba2.chunk.js → 7718.95d7a5e5.chunk.js} +1 -1
  20. package/build/static/js/8499.173cc930.chunk.js +2 -0
  21. package/build/static/js/95.ca0a2c3d.chunk.js +1 -0
  22. package/build/static/js/main.75630e0c.js +2 -0
  23. package/build/static/js/{main.bd846fb6.js.LICENSE.txt → main.75630e0c.js.LICENSE.txt} +1 -1
  24. package/package.json +1 -1
  25. package/build/static/css/3826.e34e7247.chunk.css +0 -11
  26. package/build/static/js/2311.5be934dc.chunk.js +0 -2
  27. package/build/static/js/2365.a3571172.chunk.js +0 -1
  28. package/build/static/js/2842.d560c730.chunk.js +0 -1
  29. package/build/static/js/3389.01128c14.chunk.js +0 -1
  30. package/build/static/js/3826.3d90fb73.chunk.js +0 -2
  31. package/build/static/js/3883.8ebeea7c.chunk.js +0 -1
  32. package/build/static/js/5953.3b6ebabc.chunk.js +0 -1
  33. package/build/static/js/8499.95468c53.chunk.js +0 -2
  34. package/build/static/js/95.0e2ad6c7.chunk.js +0 -1
  35. package/build/static/js/main.bd846fb6.js +0 -2
  36. /package/build/static/js/{2311.5be934dc.chunk.js.LICENSE.txt → 2311.fb7b3581.chunk.js.LICENSE.txt} +0 -0
  37. /package/build/static/js/{3826.3d90fb73.chunk.js.LICENSE.txt → 3826.9bdb438c.chunk.js.LICENSE.txt} +0 -0
  38. /package/build/static/js/{7657.1a626c13.chunk.js.LICENSE.txt → 7657.30740d96.chunk.js.LICENSE.txt} +0 -0
  39. /package/build/static/js/{8499.95468c53.chunk.js.LICENSE.txt → 8499.173cc930.chunk.js.LICENSE.txt} +0 -0
@@ -1 +1 @@
1
- "use strict";(self.webpackChunk_abtnode_webapp=self.webpackChunk_abtnode_webapp||[]).push([[4775],{19371:function(n,e,t){var i=t(38636).default,o=t(73408).default,r=t(814).default,a=this&&this.__importDefault||function(n){return n&&n.__esModule?n:{default:n}};Object.defineProperty(e,"__esModule",{value:!0}),e.splitNavigationBySection=e.flattenNavigation=e.checkLink=e.joinLink=e.cleanOrphanNavigation=e.filterNavigation=e.nestNavigationList=e.isMatchSection=e.deepWalk=e.parseNavigation=void 0;var l=a(t(10905)),c=a(t(50482)),s=a(t(8708)),u=a(t(3785)),d=a(t(24914)),f=a(t(25842)),v=a(t(6352)),m=a(t(56977)),p=a(t(6018)),h=t(65873),g=a(t(32828)),x=t(45239);Object.defineProperty(e,"checkLink",{enumerable:!0,get:function(){return x.checkLink}});var k="header",b="/",j="/",Z="/";function y(n){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){},t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=t.key,o=void 0===i?"children":i,r=t.order,a=void 0===r?"first":r;!function n(t){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=i.index,l=void 0===r?0:r,c=i.parent,s=void 0===c?null:c,u=i.level,d=void 0===u?0:u;Array.isArray(t)?t.forEach((function(e,t){n(e,{index:t,parent:s,level:d+1})})):t&&("first"===a&&e(t,s,{index:l,level:d}),n(t[o],{parent:t,level:d}),"last"===a&&e(t,s,{index:l,level:d}))}(n)}function L(n,e){return!(e!==k||!(0,u.default)(n))||(Array.isArray(n)?n.includes(e):n===e)}function N(n){try{return JSON.parse(n)}catch(e){return n}}function S(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"/",e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";if((0,p.default)(e||""))return e;var t=m.default.join(n,e||j);return t.length>1&&t.endsWith("/")?t.slice(0,t.length-1):t}function w(n,e){var t=(arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}).strict,i=n,r=e;return void 0===t||t||(i=i||"/",r=r||"/"),(0,h.isObject)(i)&&(0,h.isString)(r)&&(0,x.checkLink)(r)?Object.keys(i).reduce((function(n,e){return n[e]=S(i[e],r),n}),{}):(0,h.isString)(i)&&(0,x.checkLink)(i)&&(0,h.isObject)(r)?Object.keys(r).reduce((function(n,e){return n[e]=S(i,r[e]),n}),{}):(0,h.isString)(i)&&(0,h.isString)(r)?(0,x.checkLink)(i)||(0,x.checkLink)(r)?S(i,r):r:(0,h.isObject)(i)&&(0,h.isObject)(r)?o(new Set([].concat(o(Object.keys(i)),o(Object.keys(r))))).reduce((function(n,e){return n[e]=S(i[e],r[e]),n}),{}):r}function C(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},t=e.depth,i=void 0===t?1:t,r=e.transform,a=void 0===r?function(n){return n}:r,l=(0,f.default)(n),c=[];return y(l,(function(n,e,t){var r=t.level;if(r>=i){var l=n.items,s=void 0===l?[]:l;if(s&&Array.isArray(s)&&s.length>0){delete n.items;var u=s.map((function(e){return a(e,n)}));if(e){var f;(f=e.items).push.apply(f,o(u))}else{var v=a((0,d.default)(n,["items"]),e);c.push.apply(c,[v].concat(o(u)))}}else if(1===r){var m=a((0,d.default)(n,["items"]),e);c.push(m)}}else 1===r&&c.push(n)}),{key:"items",order:"last"}),c}function P(n){var e,t=(0,f.default)(n),a=[],l=i(t);try{var c=function(){var n=e.value,t=(0,f.default)((0,d.default)(n,["items"])),l=[];function c(n,e){var i=function(n,e){return e&&Array.isArray(n.items)?n.items.filter((function(t){return(0,u.default)(t.section)?L(n.section,e):!!L(t.section,e)})).map((function(n){return r(r({},n),{},{section:e})})):[]}(n,e);l.push(r(r({},t),{},{section:e,items:i}))}if(Array.isArray(n.section)){var s,v=i(n.section);try{for(v.s();!(s=v.n()).done;){c(n,s.value)}}catch(x){v.e(x)}finally{v.f()}}else if(n.section){c(n,n.section)}else if(n.items&&n.items.length>0){var m,p=n.items.reduce((function(n,e){var t=(e||{}).section,i=void 0===t?[k]:t;return n.push.apply(n,o(i)),n}),[]),h=o(new Set(p)),g=i(h);try{for(g.s();!(m=g.n()).done;){c(n,m.value)}}catch(x){g.e(x)}finally{g.f()}}else l.push(r(r({},n),{},{section:k}));a.push.apply(a,l)};for(l.s();!(e=l.n()).done;)c()}catch(s){l.e(s)}finally{l.f()}return a}function O(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=(0,f.default)(n);return e.reduceRight((function(n,t,i){if(t.parent){var r=e.find((function(n){return t.section&&n.section?n.section===t.section&&n.id===t.parent:n.id===t.parent}));r&&(r.items||(r.items=[]),r.items=[t].concat(o(r.items))),e.splice(i,1)}return null}),null),e}e.deepWalk=y,e.isMatchSection=L,e.joinLink=function(n,e){var t=(0,f.default)(n);return y(t,(function(n,t){var i=n.component||n.child;if(i){var o=e.find((function(n){return n.name===i}));o&&(n.link=w(o.link,n.link,{strict:!1}))}else t&&(n.link=w(t.link,n.link))}),{key:"items"}),t},e.flattenNavigation=C,e.splitNavigationBySection=P,e.nestNavigationList=O,e.filterNavigation=function(n){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],t=O(n);return y(t,(function(n){if(null!==n&&void 0!==n&&n.component&&(e.some((function(e){return e.name===n.component}))||(n.visible=!1)),n.items&&n.items.length)for(var t=n.items.length-1;t>=0;t--)!1===n.items[t].visible&&n.items.splice(t,1)}),{key:"items"}),t.filter((function(n){var e;return!1!==n.visible&&!(n.items&&Array.isArray(n.items)&&n.items.length>0&&null!==(e=n.items)&&void 0!==e&&e.every((function(n){return!1===n.visible})))}))},e.cleanOrphanNavigation=function(n){return n.map((function(n){return n.items&&Array.isArray(n.items)&&1===n.items.length&&["header","footer","",void 0,null].includes(n.section)?n.items[0]:n}))},e.parseNavigation=function(){var n,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).beforeProcess,a=void 0===t?function(n){return n}:t,u=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=[],t=function t(a){var l,c,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},u=[],d=a.children,m=void 0===d?[]:d,p=a.meta,h=void 0===p?{}:p,x=(0,f.default)((null===h||void 0===h?void 0:h.navigation)||[]);(0,g.default)(h)&&!1!==(null===(l=a.meta)||void 0===l||null===(c=l.capabilities)||void 0===c?void 0:c.navigation)&&u.push.apply(u,o(x));var Z,y=s.name||"",L=s.mountPoint||b,N=a===n?"":h.name||"",S=a===n?"":a.mountPoint||b,w=i(m);try{var C=function(){var n,i,a,l,c=Z.value;if(!(0,g.default)(c.meta))return"continue";var s=c.meta.name,d=c.mountPoint,f=[y,N,s].filter(Boolean).join("."),m=c.meta.navigation||[],p=(0,v.default)(L,S,d);!1!==(null===(n=c.meta)||void 0===n||null===(i=n.capabilities)||void 0===i?void 0:i.navigation)&&e.push({did:c.meta.did,name:f,link:p,title:c.meta.title||"",navigation:m.map((function(n){return r({section:k},n)}))});var h=x.find((function(n){return!!n.component&&n.component===s}));if(h){if(!h.link)if(c.meta.navigation&&c.meta.navigation.length>0){var b,w,C=t(c,{mountPoint:S,name:N});C.length>0&&(h.items=null!==(b=h.items)&&void 0!==b?b:[],(w=h.items).push.apply(w,o(C)))}else h.link=j}else if(!1!==(null===(a=c.meta)||void 0===a||null===(l=a.capabilities)||void 0===l?void 0:l.navigation)){var P=t(c,{mountPoint:S,name:N}),O={title:c.meta.title,component:s,id:c.meta.did};P.length>0?(O.items=P,O.link=void 0):O.link=j,u.push(O)}};for(w.s();!(Z=w.n()).done;)C()}catch(P){w.e(P)}finally{w.f()}return u}(n);return{navigationList:t,components:e}}(e),d=u.navigationList,m=u.components,p=(null===e||void 0===e||null===(n=e.settings)||void 0===n?void 0:n.navigations)||[],h=function(n){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2,t=C((0,f.default)(n),{depth:e,transform:function(n,e){var t;return e&&(n._parent||(n._parent=e.id,e.component||(n.link=w(e.link,n.link))),n.section=n.section||e.section||[k],n.visible=null!==(t=n.visible)&&void 0!==t?t:e.visible),n.component=[e.component,n.component].filter(Boolean).join("."),n}});return y(t,(function(n){n.items&&n.items.length>0&&n.items.reduceRight((function(e,t){if(t._parent){var i=n.items.findIndex((function(n){return n.id===t._parent}));i>=0&&n.items.splice(i,1),delete t._parent}return null}),null)}),{key:"items"}),t}(a(d)),x=C(P(function(n){var e=(0,f.default)(n).filter((function(n){return n.id}));return y(e,(function(n,e){var t;if(n.items&&n.items.length){for(var i=n.items.length-1;i>=0;i--)n.items[i].id||n.items.splice(i,1);0===n.items.length&&n.component&&(n.link=n.link||j)}e&&(n.parent=e.id,n.id=[e.id,n.id].join(Z)),n.from=n.from||"yaml",n.visible=null===(t=n.visible)||void 0===t||t}),{key:"items"}),e}(h)).reduce((function(n,e){var t=["bottom","social","sessionManager"].includes(e.section),i=!1,a=m.find((function(n){return"/"===n.link}));if(a&&e.id===a.did&&(i=!0),t||i){if(e.items&&e.items.length>0)return n.push.apply(n,o(e.items.map((function(n){var t=e.section,i=w(e.link,n.link),o=[e.component,n.component].filter(Boolean).join(".");return r(r({},n),{},{section:t,link:i,component:o,parent:""})})))),n;if(i)return n}return n.push(e),n}),[]),{transform:function(n,e){var t=n.component;return null!==e&&void 0!==e&&e.component&&(t=[e.component,n.component].filter(Boolean).join(".")),r(r({},n),{},{component:t})}});return{navigationList:(0,l.default)(p.map((function(n){var e=r({},n);return e.role&&(e.role=N(e.role)),e.section&&(e.section=N(e.section)),e.title&&(e.title=N(e.title)),e.link&&(e.link=N(e.link)),e})),x,(function(n,e){var t=["id","section"];return(0,c.default)((0,s.default)(n,t),(0,s.default)(e,t))})),components:m,builtinList:x}}},14775:function(n,e,t){t.r(e),t.d(e,{default:function(){return xe}});var i=t(33028),o=t(32723),r=t(34795),a=t(5057),l=t(39948),c=t(56556),s=t(49127),u=t(80576),d=t(6041),f=t(74490),v=t(72904),m=t(25228),p=t(51177),h=t(95301),g=t(11750),x=t(39067),k=t(86229),b=t(55498),j=t(12673),Z=t(13128),y=t(68420),L=t(54130),N=t(92706),S=t.n(N),w=t(55898),C=t.n(w),P=t(53210),O=t(86272),E=t.n(O),A=t(26271),R=t.n(A),T=t(50482),_=t.n(T),I=t(20877),M=t(36095),D=t(96266);function W(n){var e=n.prevPath,t=n.nextPath,i=e.length,o=t.length;return!(i!==o||!_()(e.slice(0,i-1),t.slice(0,o-1)))}function z(n){var e=n.treeNode,t=(0,y.PE)().locale;return(0,D.jsxs)(D.Fragment,{children:[e.icon&&(0,D.jsx)(b.JO,{style:{marginRight:4},icon:e.icon}),function(){var n=e.title,i=e.subtitle,o=n,r=i;return R()(n)&&(o=n[t]),!(0,a.isValidElement)(i)&&R()(i)&&(r=i[t]),(0,D.jsxs)(l.Z,{display:"flex",alignItems:"center",children:[(0,D.jsx)(g.Z,{variant:"subtitle1",fontSize:16,children:o}),i&&(0,D.jsx)(g.Z,{variant:"body2",color:"gray",ml:1.5,lineHeight:1,children:r})]})}()]})}function J(n){var e=n.treeData,t=n.setTreeData,o=n.renderActions,r=e.map((function(n){return(0,i.Z)((0,i.Z)({},n),{},{expanded:!0})})),a={};return"undefined"!==typeof window&&(a.context=window),(0,D.jsx)(M.W,(0,i.Z)((0,i.Z)({backend:I.HTML5Backend},a),{},{children:(0,D.jsx)(P.oP,{generateNodeProps:function(n){return{buttons:o({data:n.node,className:"list-item-actions"}),icons:(0,D.jsx)(b.JO,{icon:"ic:round-drag-indicator"}),title:(0,D.jsx)(z,{treeNode:n.node})}},maxDepth:2,isVirtualized:!1,treeData:r,onChange:t,canDrop:W,theme:E()})}))}z.propTypes={treeNode:C().object.isRequired},J.propTypes={treeData:C().object.isRequired,setTreeData:C().func,renderActions:C().func},J.defaultProps={setTreeData:function(){},renderActions:function(){}};var F=J,B=t(96234),q=t(56666),G=t(28726),V=t(75953),K=t(67680),H=t(53070),U=t(47020),Q=t(41899),Y=t(11251),X=t(24914),$=t.n(X),nn=t(8708),en=t.n(nn),tn=t(82488),on=t.n(tn),rn=t(78164),an=t.n(rn),ln=t(75506),cn=t.n(ln),sn=t(2765),un=t.n(sn),dn=t(25842),fn=t.n(dn),vn=t(80506),mn=t(19371),pn=t(6352),hn=t.n(pn),gn=t(2842),xn=t(6018),kn=t.n(xn),bn=t(76811),jn=t(68079),Zn=t(63838),yn=t(65873),Ln=t(27156),Nn=t(23985),Sn=t(11819),wn=t(59740),Cn=t(19654),Pn=t(90067),On=t(44067),En=t(12594),An=["fullWidth","multiple","required","label","placeholer","options","helperText","error","margin"];function Rn(n){var e=n.fullWidth,t=n.multiple,o=n.required,r=n.label,a=n.placeholer,c=n.options,s=n.helperText,v=n.error,m=n.margin,h=(0,wn.Z)(n,An),x=c.find((function(n){return n.value===h.value})),k=null===x||void 0===x?void 0:x.title;return(0,D.jsxs)(u.Z,{margin:m,fullWidth:e,error:v,children:[(0,D.jsx)(d.Z,{children:"".concat(r).concat(o?"*":"")}),(0,D.jsxs)(p.Z,(0,i.Z)((0,i.Z)({multiple:t,input:(0,D.jsx)(En.Z,{defaultValue:k,sx:{flex:1},required:o,label:r,inputProps:{margin:m}}),renderValue:function(n){if(t)return(0,D.jsx)(l.Z,{sx:{display:"flex",flexWrap:"wrap",gap:.5},children:n.map((function(n){var e=c.find((function(e){return e.value===n}));return e&&e.title&&(0,D.jsx)(Cn.Z,{size:"small",label:e.title},n)}))});var e=c.find((function(e){return e.value===n}));return e&&e.title&&(0,D.jsxs)(l.Z,{children:[(0,D.jsx)(g.Z,{component:"span",children:e.title}),(0,D.jsx)(g.Z,{marginLeft:1,component:"span",variant:"body2",color:"text.secondary",children:e.description})]})}},h),{},{children:[(0,D.jsx)(f.Z,{disabled:!0,children:(0,D.jsx)("em",{children:a})}),!t&&(0,D.jsx)(f.Z,{value:"",children:"None"}),c.map((function(n){return n&&n.value&&(0,D.jsxs)(f.Z,{value:n.value,children:[(0,D.jsx)(On.Z,{children:n.title}),n.description&&(0,D.jsx)(g.Z,{variant:"body2",color:"text.secondary",children:n.description})]},n.value)}))]})),(0,D.jsx)(Pn.Z,{children:s})]})}Rn.propTypes={error:C().bool,required:C().bool,multiple:C().bool,fullWidth:C().bool,label:C().string,placeholer:C().string,options:C().array,helperText:C().string,margin:C().string},Rn.defaultProps={error:!1,required:!1,multiple:!1,fullWidth:!1,label:"",placeholer:"",options:[],helperText:"",margin:""};var Tn=Rn,_n="en";function In(n){var e=n.sx,t=n.onAdd,i=n.onChange,o=n.locales,r=n.localeMap,s=n.onRemoveLocale,u=(0,y.PE)().t,d=(0,a.useRef)(),f=(0,a.useState)(null),v=(0,B.Z)(f,2),m=v[0],p=v[1],h=(0,j.Z)({currentLocale:_n,localeList:[],inputLocale:"",localeError:""}),x=(0,a.useMemo)((function(){return!!m}),[m]),k=(0,a.useMemo)((function(){return o.includes(h.currentLocale)?h.currentLocale:_n}),[o,h.currentLocale]),Z=(0,a.useMemo)((function(){return Object.keys((0,yn.omit)(r,[].concat((0,jn.Z)(h.localeList),[_n]))).map((function(n){return{title:r[n],value:n}}))}),[h.localeList]);function L(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",e=function(n){return n?"en"!==n&&!h.localeList.includes(n)||u("navigation.form.localeExists",{value:n}):u("common.requiredErrorText",{name:"Locale"})}(null===n||void 0===n?void 0:n.trim());return h.localeError=!0!==e?e:"",e}function N(){var n,e=null===(n=h.inputLocale)||void 0===n?void 0:n.trim();!0===L(e)&&(S(),h.localeList.push(e),h.currentLocale=e,t(e))}function S(){p(null),h.inputLocale="",h.localeError=""}return(0,a.useEffect)((function(){h.localeList=(0,jn.Z)(o)}),[o,h]),(0,Zn.Z)("enter",(function(){setTimeout((function(){N()}))}),{target:d}),(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(Ln.Z,{sx:e,value:k,onChange:function(n,e){h.currentLocale=e,i(e)},children:[(0,D.jsx)(Nn.Z,{label:"Default (".concat(r[_n],")"),value:"en"}),h.localeList.map((function(n){return(0,D.jsx)(Nn.Z,{sx:{position:"relative"},label:(0,D.jsxs)(D.Fragment,{children:[r[n],(0,D.jsx)(K.Z,{size:"small",color:"inherit",sx:{position:"absolute",top:0,right:0},onClick:function(e){!function(n,e){n.preventDefault(),n.stopPropagation(),h.localeList=(0,yn.without)(h.localeList,e),s(e),e===h.currentLocale&&(h.currentLocale=_n)}(e,n)},children:(0,D.jsx)(b.JO,{icon:"mdi:close",height:14})})]}),value:n},n)})),(0,D.jsx)(K.Z,{color:"primary",disableFocusRipple:!0,sx:{width:"48px"},onClick:function(n){p(n.currentTarget)},children:(0,D.jsx)(b.JO,{icon:"mdi:plus"})})]}),(0,D.jsx)(Sn.ZP,{open:x,anchorEl:m,onClose:S,anchorOrigin:{vertical:"bottom",horizontal:"left"},children:(0,D.jsxs)(l.Z,{sx:{p:2,width:"270px"},children:[(0,D.jsx)(g.Z,{variant:"subtitle2",children:u("navigation.form.localePlaceholder")}),(0,D.jsx)(l.Z,{mt:1,children:(0,D.jsx)(Tn,{required:!0,fullWidth:!0,label:"Locale",value:h.inputLocale,options:Z,onChange:function(n){var e=n.target.value;L(e),h.inputLocale=e},error:!!h.localeError,helperText:h.localeError||" "})}),(0,D.jsx)(l.Z,{display:"flex",justifyContent:"flex-end",children:(0,D.jsx)(c.Z,{size:"small",variant:"contained",onClick:N,children:u("common.confirm")})})]})})]})}In.propTypes={sx:C().any,onAdd:C().func,onChange:C().func,onRemoveLocale:C().func,localeMap:C().object,locales:C().array},In.defaultProps={sx:null,onAdd:function(){},onChange:function(){},onRemoveLocale:function(){},localeMap:{},locales:[]};var Mn=In,Dn=t(17425),Wn=t(29054),zn="en",Jn={title:(0,q.Z)({},zn,""),link:(0,q.Z)({},zn,"")};function Fn(n){var e=n.icon,t=(0,a.useState)(!1),i=(0,B.Z)(t,2),l=i[0],c=i[1];return(0,Q.Z)((0,r.Z)((0,o.Z)().mark((function n(){return(0,o.Z)().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return c(!1),n.next=3,(0,b.GL)(e);case 3:c(!0);case 4:case"end":return n.stop()}}),n)}))),[e]),e?l?(0,D.jsx)(b.JO,{icon:e}):(0,D.jsx)(b.JO,{color:"#f06f6e",icon:"ic:baseline-error"}):(0,D.jsx)(b.JO,{icon:"codicon:blank"})}Fn.propTypes={icon:C().string.isRequired};var Bn=(0,a.forwardRef)((function(n,e){var t=n.section,c=n.components,s=n.rawNavigations,d=(0,Dn.DJ)().roles,f=(0,y.PE)(),v=f.t,m=f.locale,p=(0,Wn.y0)().blocklet.environments.find((function(n){return"BLOCKLET_APP_LANGUAGES"===n.key})),h=(p?p.value.split(","):["en","zh"]).filter((function(n){return bn.SUPPORTED_LANGUAGES[n]})).reduce((function(n,e){return n[e]=bn.SUPPORTED_LANGUAGES[e].nativeName,n}),{}),x=(0,a.useRef)((function(){})),L=(0,Y.Z)(!1),N=(0,B.Z)(L,2),S=N[0],w=N[1],C=w.setFalse,P=w.setTrue,O=(0,j.Z)({isRoot:!0,type:"add",linkDisabled:!1,locale:zn,formState:fn()(Jn),get localeList(){return an()(Object.keys(this.formState.title),zn)}}),E=(0,vn.cI)({mode:"onChange",defaultValues:{id:void 0,title:void 0,icon:void 0,link:void 0,component:void 0,parent:void 0,role:[]}}),A=E.handleSubmit,T=E.control,_=E.watch,I=E.setValue,M=E.clearErrors,W=E.formState.errors;(0,a.useEffect)((function(){I("title",O.formState.title[O.locale]),I("link",O.formState.link[O.locale])}),[I,O.locale,S]);var z=_("component"),J=_("title"),F=_("link"),Q=_("icon"),X=_("parent");(0,a.useEffect)((function(){O.formState.title[O.locale]=J}),[J]),(0,a.useEffect)((function(){O.formState.link[O.locale]=F}),[F]);var nn=(0,a.useMemo)((function(){return s.find((function(n){return z?c.find((function(n){return n.name===z})).did===n.id:n.id===X}))}),[c,s,z,X]),tn=(0,a.useMemo)((function(){if(null!==nn&&void 0!==nn&&nn.component){var n=(c.find((function(n){return n.name===nn.component}))||{}).link,e=R()(n)?n[O.locale]:n;if(z)return(0,gn.QT)(e);var t=R()(nn.link)?nn.link[O.locale]:nn.link;return(0,gn.QT)(hn()(e,t||"/"))}return null}),[c,O.locale,nn,z]),rn=(0,a.useMemo)((function(){var n=(nn||{}).component,e=(c.find((function(e){return e.name===n}))||{}).navigation,i=void 0===e?[]:e;return(0,mn.flattenNavigation)(i,{transform:function(n,e){return null!==e&&void 0!==e&&e.section&&(n.section=n.section||e.section),n}}).filter((function(n){return n.link})).filter((function(n){return(0,mn.isMatchSection)(n.section,t)})).map((function(n){return{label:n.link,title:n.title[m]||n.title}}))}),[nn,c,t,m]),ln=(0,a.useMemo)((function(){var n={add:v("common.create"),edit:v("common.edit")}[O.type];return n?"".concat(n," ").concat(v("navigation.navigation")):"--"}),[O.type,v]),sn=(0,a.useCallback)((function(){O.isRoot=!0,O.locale=zn,O.type="add",O.linkDisabled=!1,x.current=function(){},I("id",void 0),I("icon",void 0),I("title",void 0),I("link",void 0),I("component",void 0),I("parent",void 0),I("role",[]),O.formState=fn()(Jn),M()}),[M,I,O]),dn=(0,a.useCallback)((function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return O.localeList.length>0&&(new Set(on()(O.formState.title)).size>1&&(n.title=O.formState.title),new Set(on()(O.formState.link)).size>1&&(n.link=O.formState.link)),cn()(n.role)&&(n.role=void 0),n}),[O.formState.link,O.formState.title,O.localeList]),pn=(0,a.useCallback)((function(){C(),setTimeout((function(){sn()}))}),[sn,C]),xn=(0,a.useCallback)((function(){var n=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).parent,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){};O.type="add",O.isRoot=!n,I("parent",null===n||void 0===n?void 0:n.id),x.current=function(n){e(pn,n)},P()}),[pn,P,I,O]),jn=(0,a.useCallback)((function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){},t=n.id,i=n.title,o=n.icon,r=n.link,a=n.parent,l=n.component,c=n.role,s=void 0===c?[]:c;I("id",t),I("icon",o),"tmpl"===n.from&&(O.linkDisabled=!0),un()(i)?O.formState.title=O.localeList.reduce((function(n,e){return n[e]=i,n}),(0,q.Z)({},zn,i)):R()(i)?O.formState.title=fn()(i):O.formState.title={},un()(r)?O.formState.link=O.localeList.reduce((function(n,e){return n[e]=r,n}),(0,q.Z)({},zn,r)):R()(r)?O.formState.link=fn()(r):O.formState.link={},I("component",l),I("parent",a),I("role",s||[]),P(),O.type="edit",O.isRoot=!a,x.current=function(n){var t=en()(n,["id","title","icon","link","role"]);e(pn,t)}}),[pn,P,I,O]);function Zn(n){var e=null===n||void 0===n?void 0:n.trim();return e?!(e.length>24)||v("navigation.form.titleTooLong",{len:24}):v("common.requiredErrorText",{name:v("navigation.form.title")})}function yn(){return(yn=(0,r.Z)((0,o.Z)().mark((function n(e){var t;return(0,o.Z)().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(!(t=null===e||void 0===e?void 0:e.trim())){n.next=10;break}return n.prev=2,n.next=5,(0,b.GL)(t);case 5:n.next=10;break;case 7:return n.prev=7,n.t0=n.catch(2),n.abrupt("return",v("navigation.form.invalidIcon"));case 10:return n.abrupt("return",!0);case 11:case"end":return n.stop()}}),n,null,[[2,7]])})))).apply(this,arguments)}function Ln(n){var e=null===n||void 0===n?void 0:n.trim();return e?!!(0,mn.checkLink)(e)||v("navigation.form.invalidLink"):!!O.isRoot||v("common.requiredErrorText",{name:v("navigation.form.link")})}(0,a.useImperativeHandle)(e,(function(){return{add:xn,edit:jn,close:pn}}),[xn,pn,jn]);var Nn=(0,a.useCallback)((function(n){O.locale=n,O.formState.title[n]||(O.formState.title[n]=""),O.formState.link[n]||(O.formState.link[n]=""),setTimeout((function(){M()}))}),[M,O]),Sn=(0,a.useCallback)((function(){for(var n=O.formState,e=n.title,t=n.link,i=0,o=Object.keys(e);i<o.length;i++){var r=Zn(e[o[i]]);if(!0!==r)return r}for(var a=0,l=Object.keys(t);a<l.length;a++){var c=Ln(t[l[a]]);if(!0!==c)return c}return!0}),[O.formState]),wn=(0,a.useCallback)((function(n){var e=Sn();!0===e?x.current(dn(n)):k.Z.error(e)}),[Sn,dn]),Cn=(0,a.useCallback)((function(n){O.formState.title=$()(O.formState.title,n),O.formState.link=$()(O.formState.link,n)}),[O.formState]),Pn=(0,a.useCallback)((function(n){var e,t;O.locale=n,O.formState.title[n]=null===(e=O.formState.title)||void 0===e?void 0:e[zn],O.formState.link[n]=null===(t=O.formState.link)||void 0===t?void 0:t[zn],setTimeout((function(){M()}))}),[M,O]);return(0,D.jsxs)(Z.ZP,{open:S,title:ln,onClose:pn,actions:(0,D.jsx)(G.Z,{onClick:A(wn),color:"primary",autoFocus:!0,variant:"contained",children:v("common.confirm")}),children:[(0,D.jsx)(Mn,{sx:{mb:1},onAdd:Pn,onChange:Nn,onRemoveLocale:Cn,localeMap:h,locales:O.localeList}),(0,D.jsxs)("form",{noValidate:!0,autoComplete:"off",children:[(0,D.jsx)(vn.Qr,{name:"title",control:T,rules:{validate:Zn},render:function(n){var e,t,o=n.field;return(0,D.jsx)(U.Z,(0,i.Z)({fullWidth:!0,variant:"outlined",margin:"dense",required:!0,placeholder:v("navigation.form.titlePlaceholder"),label:v("navigation.form.title"),disabled:O.isEdit,error:!(null===W||void 0===W||null===(e=W.title)||void 0===e||!e.message),helperText:(null===W||void 0===W||null===(t=W.title)||void 0===t?void 0:t.message)||" "},o))}}),(0,D.jsx)(vn.Qr,{name:"icon",control:T,rules:{validate:function(n){return yn.apply(this,arguments)}},render:function(n){var e,t,o=n.field;return(0,D.jsx)(U.Z,(0,i.Z)((0,i.Z)({fullWidth:!0,variant:"outlined",margin:"dense",placeholder:v("navigation.form.iconPlaceholder"),label:v("navigation.form.icon"),error:!(null===W||void 0===W||null===(e=W.icon)||void 0===e||!e.message),disabled:O.locale!==zn,helperText:(null===W||void 0===W||null===(t=W.icon)||void 0===t?void 0:t.message)||(0,D.jsx)(l.Z,{display:"flex",children:(0,D.jsxs)(l.Z,{component:"a",href:"https://icones.js.org",target:"_blank",display:"flex",alignItems:"center",children:[v("navigation.form.findMoreIcon")," ",(0,D.jsx)(b.JO,{style:{marginLeft:4},icon:"radix-icons:external-link"})]})})},o),{},{InputProps:{endAdornment:(0,D.jsx)(H.Z,{position:"end",children:(0,D.jsx)(K.Z,{sx:{cursor:"default"},disableFocusRipple:!0,disableRipple:!0,children:Q&&(0,D.jsx)(Fn,{icon:Q})})})}}))}}),O.isRoot&&(0,D.jsx)(vn.Qr,{name:"component",control:T,render:function(n){var e,t,o=n.field;return(0,D.jsx)(Tn,(0,i.Z)({fullWidth:!0,margin:"dense",disabled:"edit"===O.type||O.locale!==zn,label:v("navigation.form.component"),placeholer:v("navigation.form.componentPlaceholder"),options:c.map((function(n){return{title:n.title,value:n.name,description:n.link}})),error:!(null===W||void 0===W||null===(e=W.component)||void 0===e||!e.message),helperText:(null===W||void 0===W||null===(t=W.component)||void 0===t?void 0:t.message)||" "},$()(o,"ref")))}}),(0,D.jsx)(vn.Qr,{name:"link",control:T,rules:{validate:Ln},render:function(n){var e=n.field;return(0,D.jsx)(u.Z,{fullWidth:!0,margin:"dense",children:(0,D.jsx)(V.Z,(0,i.Z)((0,i.Z)({disablePortal:!0,freeSolo:!0,blurOnSelect:!0,autoSelect:!0,fullWidth:!0,disabled:O.linkDisabled,isOptionEqualToValue:function(n){return n.label},options:rn,renderInput:function(n){var e,t;return(0,D.jsx)(U.Z,(0,i.Z)((0,i.Z)({},n),{},{placeholder:v("navigation.form.linkPlaceholder"),label:v("navigation.form.link"),error:!(null===W||void 0===W||null===(e=W.link)||void 0===e||!e.message),helperText:(null===W||void 0===W||null===(t=W.link)||void 0===t?void 0:t.message)||"/abc/bcd or /abc or https://arcblock.io",InputProps:{startAdornment:tn?(0,D.jsx)(H.Z,{position:"start",sx:{textDecoration:kn()(F||"")?"line-through":""},children:tn}):null}}))},renderOption:function(n,e){return(0,D.jsxs)(l.Z,(0,i.Z)((0,i.Z)({component:"li"},n),{},{children:[e.label,(0,D.jsx)(g.Z,{marginLeft:1,component:"span",variant:"body2",color:"text.secondary",children:e.title})]}))},margin:"dense"},e),{},{onChange:function(){},onInputChange:function(n,t){e.onChange(t)}}))})}}),["dashboard","sessionManager"].includes(t)&&(0,D.jsx)(vn.Qr,{name:"role",control:T,render:function(n){var e,t,o=n.field;return(0,D.jsx)(Tn,(0,i.Z)({fullWidth:!0,multiple:!0,margin:"dense",label:v("navigation.form.role"),placeholer:v("navigation.form.rolePlaceholder"),options:d.map((function(n){return{title:n.title,value:n.name}})),error:!(null===W||void 0===W||null===(e=W.role)||void 0===e||!e.message),helperText:(null===W||void 0===W||null===(t=W.role)||void 0===t?void 0:t.message)||" "},$()(o,"ref")))}})]})]})}));Bn.propTypes={section:C().string,components:C().array,rawNavigations:C().array},Bn.defaultProps={section:"",components:[],rawNavigations:[]};var qn=Bn;function Gn(n){var e=n.className,t=n.add,i=n.edit,o=n.toggle,r=n.del,l=n.data,c=n.section,s=(0,y.PE)().t,u=["yaml","tmpl"].includes(l.from),d=(0,a.isValidElement)(l.subtitle);function f(n){n.preventDefault(),n.stopPropagation()}var v=(0,a.useCallback)((function(n){f(n),t(l)}),[t,l]),m=(0,a.useCallback)((function(n){f(n),i(l)}),[i,l]),p=(0,a.useCallback)((function(n){f(n),o(l)}),[o,l]),h=(0,a.useCallback)((function(n){f(n),r(l)}),[r,l]);return(0,D.jsxs)("div",{className:e,children:[!l.parent&&["header","footer","dashboard"].includes(c)&&(0,D.jsx)("span",{title:s(d?"navigation.action.noAddSub":"navigation.action.addSub"),children:(0,D.jsx)(K.Z,{size:"small",color:"success",onClick:v,disabled:d,children:(0,D.jsx)(b.JO,{icon:"mdi:plus-box-outline"})})}),(0,D.jsx)("span",{title:s(d?"navigation.action.noEdit":"navigation.action.edit"),children:(0,D.jsx)(K.Z,{size:"small",color:"primary",onClick:m,disabled:d,children:(0,D.jsx)(b.JO,{icon:"mdi:pencil"})})}),(0,D.jsx)("span",{title:d?s("navigation.action.noEdit"):l.visible?s("navigation.action.hide"):s("navigation.action.show"),children:(0,D.jsx)(K.Z,{size:"small",color:"warning",onClick:p,disabled:d,children:!1===l.visible?(0,D.jsx)(b.JO,{icon:"mdi:eye-off-outline"}):(0,D.jsx)(b.JO,{icon:"mdi:eye-outline"})})}),(0,D.jsx)("span",{title:s(u&&!d?"navigation.action.noDel":"navigation.action.del"),children:(0,D.jsx)(K.Z,{disabled:u&&!d,size:"small",color:"error",onClick:h,children:(0,D.jsx)(b.JO,{icon:"mdi:delete"})})})]})}Gn.propTypes={data:C().object.isRequired,className:C().string,add:C().func,edit:C().func,toggle:C().func,del:C().func,section:C().string},Gn.defaultProps={className:"",add:function(){},edit:function(){},toggle:function(){},del:function(){},section:""};var Vn=Gn,Kn=t(3785),Hn=t.n(Kn),Un=t(79683),Qn=t.n(Un),Yn=t(35432),Xn=t(14491),$n="/",ne="header",ee={sessionManager:[{id:"/sessionManager",title:{en:"Manage",zh:"\u7ba1\u7406"},section:["sessionManager"],icon:"ion:settings-outline",link:"".concat(Yn.WELLKNOWN_SERVICE_PATH_PREFIX,"/admin"),role:["owner","admin"],from:"tmpl"}],dashboard:[{id:"/team",title:{en:"Access",zh:"\u8bbf\u95ee\u63a7\u5236"},role:["owner","admin","member"],section:["dashboard"],link:"",from:"tmpl",items:[{id:"member",title:{en:"Members",zh:"\u6210\u5458"},icon:"ant-design:user-outlined",link:"".concat(Yn.WELLKNOWN_SERVICE_PATH_PREFIX,"/admin/members"),from:"tmpl"},{id:"passport",title:{en:"Passport",zh:"\u901a\u884c\u8bc1"},icon:"icon-park-outline:passport",link:"".concat(Yn.WELLKNOWN_SERVICE_PATH_PREFIX,"/admin/passports"),from:"tmpl"}]},{id:"/dashboard",title:"Blocklet",role:["owner","admin"],section:["dashboard"],link:"",from:"tmpl",items:[{id:"dashboard",title:{en:"Dashboard",zh:"\u4eea\u8868\u76d8"},icon:"ant-design:dashboard-outlined",link:"".concat(Yn.WELLKNOWN_SERVICE_PATH_PREFIX,"/admin"),from:"tmpl"}]}]};function te(n,e){return n.section&&e.section?n.section===e.section&&n.id===e.id:n.id===e.id}function ie(){var n=(0,Wn.y0)(),e=n.blocklet,t=n.actions,l=(0,mn.parseNavigation)(e,{beforeProcess:function(n){var e=fn()(n);return ee.dashboard.forEach((function(n){e.some((function(e){return e.id===n.id}))||e.push(n)})),e.some((function(n){return n.id&&(n.section||[]).includes("sessionManager")}))||e.push.apply(e,(0,jn.Z)(ee.sessionManager)),e}}),c=l.navigationList,s=l.components,u=l.builtinList,d=(0,j.Z)({rawNavigation:fn()(c),activeSection:ne,components:s}),f=(0,a.useMemo)((function(){return(0,mn.nestNavigationList)(d.rawNavigation)}),[d.rawNavigation]),v=(0,a.useMemo)((function(){var n=(0,mn.filterNavigation)(d.rawNavigation,s),e=(0,mn.joinLink)(n,s);return(0,mn.cleanOrphanNavigation)(e)}),[s,d.rawNavigation]);function m(n){if(!n.id)return"";var e=(0,mn.flattenNavigation)((0,mn.joinLink)(f,s)),t=e.find((function(e){return e.id===n.id}));function i(n){var e=n.name;return(0,D.jsx)(Cn.Z,{label:"Uninstalled: ".concat(e),color:"error",size:"small",variant:"outlined",sx:{fontSize:10,height:20}})}if(null!==t&&void 0!==t&&t.component){if(!s.some((function(n){return n.name===t.component})))return(0,D.jsx)(i,{name:t.component})}else if(t.parent){var o=e.find((function(n){return n.id===t.parent}));if(null!==o&&void 0!==o&&o.component&&!s.some((function(n){return n.name===o.component})))return(0,D.jsx)(i,{name:o.component})}return null===t||void 0===t?void 0:t.link}function p(n){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:$n;return n.map((function(n){var t=s.find((function(e){return e.name===n.component})),i=(null===t||void 0===t?void 0:t.link)||e,o=n.items||[],r=n.link;return{title:n.title,subtitle:m(n),link:r,icon:n.icon,children:p(o,r||$n),section:n.section,visible:n.visible,parent:n.parent,component:n.component,id:n.id,role:n.role,from:n.from,__base:i}}))}function h(n){return g.apply(this,arguments)}function g(){return(g=(0,r.Z)((0,o.Z)().mark((function n(e){var r,a;return(0,o.Z)().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return r=e.map((function(n){return Qn()(n,Hn())})),a=r.map((function(n){var e=(0,i.Z)({},n);return e.role&&Array.isArray(e.role)&&(e.role=JSON.stringify(e.role)),e.section&&Array.isArray(e.section)&&(e.section=JSON.stringify(e.section)),e.title&&e.title instanceof Object&&(e.title=JSON.stringify(e.title)),e.link&&e.link instanceof Object&&(e.link=JSON.stringify(e.link)),e})),n.next=4,t.configNavigations(a);case 4:case"end":return n.stop()}}),n)})))).apply(this,arguments)}function x(){return(x=(0,r.Z)((0,o.Z)().mark((function n(){return(0,o.Z)().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,h([]);case 2:d.rawNavigation=fn()(u);case 3:case"end":return n.stop()}}),n)})))).apply(this,arguments)}return{state:d,navigation:v,components:s,getNavigationFullLink:m,updateActiveSection:function(n){d.activeSection=n},updateNavigationItem:function(n){!function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=d.rawNavigation.map((function(e){var t=n.find((function(n){return te((0,i.Z)((0,i.Z)({},n),{},{section:d.activeSection}),e)}));return t?(0,i.Z)((0,i.Z)({},e),t):e}));d.rawNavigation=e}([n])},delNavigationItem:function(n){var e=d.rawNavigation.filter((function(e){return e.id===n||e.parent===n})).map((function(n){return n.id}));d.rawNavigation=d.rawNavigation.filter((function(n){return!e.includes(n.id)}))},addNavigationItem:function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=(0,i.Z)((0,i.Z)({},n),{},{id:(0,Xn.x0)(),section:d.activeSection,visible:!0});d.rawNavigation=[].concat((0,jn.Z)(d.rawNavigation),[e])},updateNavigationTree:function(n){var e=[];(0,mn.deepWalk)(n,(function(n,t){var o=(0,i.Z)((0,i.Z)({},$()(n,["children","expand"])),{},{parent:null===t||void 0===t?void 0:t.id});e.push(o)}));var t=d.rawNavigation.filter((function(n){if(!d.activeSection)return!1;var t=e.find((function(e){return te(e,n)}));return!t||!(0,mn.isMatchSection)(t.section,d.activeSection)}));d.rawNavigation=[].concat((0,jn.Z)(t),e)},getNavigation:function(n){return p(fn()(f).filter((function(e){return(0,mn.isMatchSection)(e.section,n)})))},saveNavigationList:h,resetNavigation:function(){return x.apply(this,arguments)}}}var oe,re=t(71171),ae=t(1192),le=t(2484),ce=t(5873),se=t(88764),ue=t(55402),de=t(5939),fe=t(33518),ve=t(49522);function me(n){var e,t,i,o,r=n.className,a=n.navigation,c=(0,Wn.y0)().blocklet,s=(0,ve.Z)({blocklet:c}).logoUrl,u=null===c||void 0===c||null===(e=c.environments)||void 0===e||null===(t=e.find((function(n){return n.key===bn.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_COPYRIGHT_OWNER})))||void 0===t?void 0:t.value,d=null===c||void 0===c||null===(i=c.environments)||void 0===i||null===(o=i.find((function(n){return n.key===bn.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_COPYRIGHT_YEAR})))||void 0===o?void 0:o.value,f=u||d?{owner:u,year:d}:void 0,v={appId:c.appDid,appLogo:s,appName:c.meta.title,enableConnect:!0,enableLocale:!1,navigation:a,copyright:f};return(0,D.jsx)(se.Z,{children:(0,D.jsxs)(l.Z,{className:r,children:[(0,D.jsx)(ae.Z,{meta:v}),(0,D.jsx)(l.Z,{children:(0,D.jsx)(ce.Z,{meta:v,invalidPathFallback:function(){},headerProps:{style:{display:"none"}},children:(0,D.jsx)(ue.ZP,{container:!0,spacing:2,children:new Array(6).fill().map((function(n,e){return(0,D.jsxs)(ue.ZP,{item:!0,xs:4,children:[(0,D.jsx)(de.Z,{animation:!1,variant:"rectangular",width:"100%",height:120}),(0,D.jsxs)(l.Z,{sx:{pt:.5},children:[(0,D.jsx)(de.Z,{animation:!1}),(0,D.jsx)(de.Z,{width:"60%",animation:!1})]})]},e)}))})})}),(0,D.jsx)(le.Z,{meta:v})]})})}me.propTypes={className:C().string,navigation:C().array},me.defaultProps={className:"",navigation:[]};var pe=(0,fe.Z)(me)(oe||(oe=(0,re.Z)(["\n .dashboard {\n height: auto !important;\n }\n .dashboard-content + div {\n display: none;\n }\n"]))),he={login:S(),logout:S(),switch:S(),switchDid:S(),switchProfile:S(),switchPassport:S(),useDid:function(){return{walletDid:"abcdefghijklmnopqrstuvwxyz"}},useOAuth:function(){return{logoutOAuth:S(),bindOAuth:S(),configs:{},switchOAuthPassport:S()}}},ge={header:"Header",footer:"Footer",bottom:"Footer Link",social:"Footer Social",dashboard:"Dashboard",sessionManager:"SessionManager"};var xe=function(){var n=(0,y.PE)().t,e=(0,Wn.y0)().blocklet,t=(0,a.useRef)(null),N=(0,Dn.DJ)().roles,S=(0,v.Z)((function(n){return n.breakpoints.down("md")})),w=(0,j.Z)({saveLoading:!1,resetLoading:!1,showResetConfirm:!1,mockRole:"owner"}),C=ie(),P=C.state,O=C.navigation,E=C.getNavigation,A=C.saveNavigationList,R=C.resetNavigation,T=C.updateActiveSection,_=C.updateNavigationTree,I=C.updateNavigationItem,M=C.delNavigationItem,W=C.addNavigationItem,z=(0,a.useCallback)((function(n){t.current.add({parent:n},(function(n,e){W(e),n()}))}),[W]),J=(0,a.useCallback)((function(n){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};switch(n){case"edit":t.current.edit(e,(function(n,e){I(e),n()}));break;case"toggle":I({id:e.id,visible:!e.visible});break;case"del":M(e.id)}}),[M,I]),B=(0,a.useCallback)((0,r.Z)((0,o.Z)().mark((function e(){return(0,o.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,w.saveLoading=!0,e.next=4,A(P.rawNavigation);case 4:k.Z.success(n("common.succeeded")),e.next=10;break;case 7:e.prev=7,e.t0=e.catch(0),k.Z.error((0,D.jsxs)(l.Z,{children:[(0,D.jsx)(g.Z,{variant:"subtitle2",children:n("navigation.actionFailed")}),(0,D.jsx)(g.Z,{variant:"body1",children:(0,Xn.Z)(e.t0)||e.t0.error})]}));case 10:return e.prev=10,w.saveLoading=!1,e.finish(10);case 13:case"end":return e.stop()}}),e,null,[[0,7,10,13]])}))),[P.rawNavigation,w,A,n]),q=(0,a.useCallback)((0,r.Z)((0,o.Z)().mark((function e(){return(0,o.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,w.resetLoading=!0,e.next=4,R();case 4:k.Z.success(n("navigation.action.resetSuccessful"),{variant:"success"}),e.next=10;break;case 7:e.prev=7,e.t0=e.catch(0),k.Z.error((0,D.jsxs)(l.Z,{children:[(0,D.jsx)(g.Z,{variant:"subtitle2",children:n("navigation.actionFailed")}),(0,D.jsx)(g.Z,{variant:"body1",children:(0,Xn.Z)(e.t0)||e.t0.error})]}));case 10:return e.prev=10,w.resetLoading=!1,e.finish(10);case 13:case"end":return e.stop()}}),e,null,[[0,7,10,13]])}))),[w,R,n]),G=(0,a.useMemo)((function(){return{session:(0,i.Z)((0,i.Z)({},he),{},{user:{did:e.appDid,fullName:"Preview User",role:w.mockRole}})}}),[e.appDid,w.mockRole]);return(0,D.jsxs)(D.Fragment,{children:[S&&(0,D.jsx)(p.Z,{fullWidth:!0,size:"small",value:P.activeSection,onChange:function(n){return T(n.target.value)},children:Object.keys(ge).map((function(n){return(0,D.jsxs)(f.Z,{value:n,children:[ge[n]," (".concat(E(n).length,")")]})}))}),!S&&(0,D.jsx)(s.Z,{variant:"outlined",children:Object.keys(ge).map((function(n){return(0,D.jsxs)(c.Z,{variant:P.activeSection===n?"contained":void 0,onClick:function(){return T(n)},children:[ge[n]," (".concat(E(n).length,")")]},n)}))}),(0,D.jsxs)(h.Z,{variant:"dense",sx:{paddingLeft:"0px !important",paddingRight:"0px !important",mt:2},children:[(0,D.jsx)(g.Z,{variant:"h6",component:"div",sx:{flexGrow:1},children:n("common.config")}),(0,D.jsx)(s.Z,{variant:"outlined",children:(0,D.jsx)(x.Z,{size:"small",variant:"outlined",color:"error",startIcon:(0,D.jsx)(b.JO,{icon:"system-uicons:reset"}),sx:{mr:2},loading:w.resetLoading,loadingPosition:"start",onClick:function(){w.showResetConfirm=!0},children:n("navigation.action.reset")})}),(0,D.jsxs)(s.Z,{variant:"outlined",children:[(0,D.jsx)(c.Z,{size:"small",variant:"outlined",startIcon:(0,D.jsx)(b.JO,{icon:"mdi:plus"}),onClick:function(){return z()},children:n("navigation.action.new")}),(0,D.jsx)(x.Z,{size:"small",variant:"contained",startIcon:(0,D.jsx)(b.JO,{icon:"mdi:content-save"}),loading:w.saveLoading,loadingPosition:"start",onClick:B,children:n("common.save")})]})]}),(0,D.jsx)(m.Z,{variant:"outlined",sx:{display:"flex",height:280,overflow:"hidden"},children:(0,D.jsx)(m.Z,{elevation:0,sx:{flex:1,overflow:"auto"},children:(0,D.jsx)(F,{treeData:E(P.activeSection),setTreeData:_,renderActions:function(n){var e=n.data,t=n.className;return(0,D.jsx)(Vn,{data:e,className:t,section:P.activeSection,add:function(){return z.apply(void 0,arguments)},del:function(){for(var n=arguments.length,e=new Array(n),t=0;t<n;t++)e[t]=arguments[t];return J.apply(void 0,["del"].concat(e))},edit:function(){for(var n=arguments.length,e=new Array(n),t=0;t<n;t++)e[t]=arguments[t];return J.apply(void 0,["edit"].concat(e))},toggle:function(){for(var n=arguments.length,e=new Array(n),t=0;t<n;t++)e[t]=arguments[t];return J.apply(void 0,["toggle"].concat(e))}})}})})}),(0,D.jsxs)(h.Z,{variant:"dense",sx:{paddingLeft:"0px !important",paddingRight:"0px !important",mt:3},children:[(0,D.jsx)(g.Z,{variant:"h6",component:"div",sx:{flexGrow:1},children:n("common.preview")}),(0,D.jsxs)(u.Z,{sx:{m:1,minWidth:120},size:"small",children:[(0,D.jsx)(d.Z,{children:n("common.role")}),(0,D.jsx)(p.Z,{value:w.mockRole,label:"Role",onChange:function(n){w.mockRole=n.target.value},children:N.map((function(n){return(0,D.jsx)(f.Z,{value:n.name,children:n.title},n.name)}))})]})]}),(0,D.jsx)(m.Z,{variant:"outlined",children:(0,D.jsx)(L.B3.Provider,{value:G,children:(0,D.jsx)(pe,{navigation:O})})}),(0,D.jsx)(qn,{ref:t,section:P.activeSection,components:P.components,rawNavigations:P.rawNavigation}),(0,D.jsx)(Z.I4,{confirmButton:{text:n("common.confirm"),props:{variant:"contained",color:"error"}},cancelButton:{text:n("common.cancel"),props:{color:"primary"}},open:w.showResetConfirm,title:n("navigation.action.restConfirmTitle"),onConfirm:function(){var n=(0,r.Z)((0,o.Z)().mark((function n(){return(0,o.Z)().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,q();case 2:w.showResetConfirm=!1;case 3:case"end":return n.stop()}}),n)})));return function(){return n.apply(this,arguments)}}(),onCancel:function(){w.showResetConfirm=!1},children:(0,D.jsx)("p",{children:n("navigation.action.restConfirmDesc")})})]})}}}]);
1
+ "use strict";(self.webpackChunk_abtnode_webapp=self.webpackChunk_abtnode_webapp||[]).push([[4775],{19371:function(n,e,t){var i=t(38636).default,o=t(73408).default,r=t(814).default,a=this&&this.__importDefault||function(n){return n&&n.__esModule?n:{default:n}};Object.defineProperty(e,"__esModule",{value:!0}),e.splitNavigationBySection=e.flattenNavigation=e.checkLink=e.joinLink=e.cleanOrphanNavigation=e.filterNavigation=e.nestNavigationList=e.isMatchSection=e.deepWalk=e.parseNavigation=void 0;var l=a(t(10905)),c=a(t(50482)),s=a(t(8708)),u=a(t(3785)),d=a(t(24914)),f=a(t(25842)),v=a(t(6352)),m=a(t(56977)),p=a(t(6018)),h=t(65873),g=a(t(32828)),x=t(45239);Object.defineProperty(e,"checkLink",{enumerable:!0,get:function(){return x.checkLink}});var k="header",b="/",j="/",Z="/";function y(n){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){},t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=t.key,o=void 0===i?"children":i,r=t.order,a=void 0===r?"first":r;!function n(t){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=i.index,l=void 0===r?0:r,c=i.parent,s=void 0===c?null:c,u=i.level,d=void 0===u?0:u;Array.isArray(t)?t.forEach((function(e,t){n(e,{index:t,parent:s,level:d+1})})):t&&("first"===a&&e(t,s,{index:l,level:d}),n(t[o],{parent:t,level:d}),"last"===a&&e(t,s,{index:l,level:d}))}(n)}function L(n,e){return!(e!==k||!(0,u.default)(n))||(Array.isArray(n)?n.includes(e):n===e)}function N(n){try{return JSON.parse(n)}catch(e){return n}}function S(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"/",e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";if((0,p.default)(e||""))return e;var t=m.default.join(n,e||j);return t.length>1&&t.endsWith("/")?t.slice(0,t.length-1):t}function w(n,e){var t=(arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}).strict,i=n,r=e;return void 0===t||t||(i=i||"/",r=r||"/"),(0,h.isObject)(i)&&(0,h.isString)(r)&&(0,x.checkLink)(r)?Object.keys(i).reduce((function(n,e){return n[e]=S(i[e],r),n}),{}):(0,h.isString)(i)&&(0,x.checkLink)(i)&&(0,h.isObject)(r)?Object.keys(r).reduce((function(n,e){return n[e]=S(i,r[e]),n}),{}):(0,h.isString)(i)&&(0,h.isString)(r)?(0,x.checkLink)(i)||(0,x.checkLink)(r)?S(i,r):r:(0,h.isObject)(i)&&(0,h.isObject)(r)?o(new Set([].concat(o(Object.keys(i)),o(Object.keys(r))))).reduce((function(n,e){return n[e]=S(i[e],r[e]),n}),{}):r}function C(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},t=e.depth,i=void 0===t?1:t,r=e.transform,a=void 0===r?function(n){return n}:r,l=(0,f.default)(n),c=[];return y(l,(function(n,e,t){var r=t.level;if(r>=i){var l=n.items,s=void 0===l?[]:l;if(s&&Array.isArray(s)&&s.length>0){delete n.items;var u=s.map((function(e){return a(e,n)}));if(e){var f;(f=e.items).push.apply(f,o(u))}else{var v=a((0,d.default)(n,["items"]),e);c.push.apply(c,[v].concat(o(u)))}}else if(1===r){var m=a((0,d.default)(n,["items"]),e);c.push(m)}}else 1===r&&c.push(n)}),{key:"items",order:"last"}),c}function P(n){var e,t=(0,f.default)(n),a=[],l=i(t);try{var c=function(){var n=e.value,t=(0,f.default)((0,d.default)(n,["items"])),l=[];function c(n,e){var i=function(n,e){return e&&Array.isArray(n.items)?n.items.filter((function(t){return(0,u.default)(t.section)?L(n.section,e):!!L(t.section,e)})).map((function(n){return r(r({},n),{},{section:e})})):[]}(n,e);l.push(r(r({},t),{},{section:e,items:i}))}if(Array.isArray(n.section)){var s,v=i(n.section);try{for(v.s();!(s=v.n()).done;){c(n,s.value)}}catch(x){v.e(x)}finally{v.f()}}else if(n.section){c(n,n.section)}else if(n.items&&n.items.length>0){var m,p=n.items.reduce((function(n,e){var t=(e||{}).section,i=void 0===t?[k]:t;return n.push.apply(n,o(i)),n}),[]),h=o(new Set(p)),g=i(h);try{for(g.s();!(m=g.n()).done;){c(n,m.value)}}catch(x){g.e(x)}finally{g.f()}}else l.push(r(r({},n),{},{section:k}));a.push.apply(a,l)};for(l.s();!(e=l.n()).done;)c()}catch(s){l.e(s)}finally{l.f()}return a}function O(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=(0,f.default)(n);return e.reduceRight((function(n,t,i){if(t.parent){var r=e.find((function(n){return t.section&&n.section?n.section===t.section&&n.id===t.parent:n.id===t.parent}));r&&(r.items||(r.items=[]),r.items=[t].concat(o(r.items))),e.splice(i,1)}return null}),null),e}e.deepWalk=y,e.isMatchSection=L,e.joinLink=function(n,e){var t=(0,f.default)(n);return y(t,(function(n,t){var i=n.component||n.child;if(i){var o=e.find((function(n){return n.name===i}));o&&(n.link=w(o.link,n.link,{strict:!1}))}else t&&(n.link=w(t.link,n.link))}),{key:"items"}),t},e.flattenNavigation=C,e.splitNavigationBySection=P,e.nestNavigationList=O,e.filterNavigation=function(n){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],t=O(n);return y(t,(function(n){if(null!==n&&void 0!==n&&n.component&&(e.some((function(e){return e.name===n.component}))||(n.visible=!1)),n.items&&n.items.length)for(var t=n.items.length-1;t>=0;t--)!1===n.items[t].visible&&n.items.splice(t,1)}),{key:"items"}),t.filter((function(n){var e;return!1!==n.visible&&!(n.items&&Array.isArray(n.items)&&n.items.length>0&&null!==(e=n.items)&&void 0!==e&&e.every((function(n){return!1===n.visible})))}))},e.cleanOrphanNavigation=function(n){return n.map((function(n){return n.items&&Array.isArray(n.items)&&1===n.items.length&&["header","footer","",void 0,null].includes(n.section)?n.items[0]:n}))},e.parseNavigation=function(){var n,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).beforeProcess,a=void 0===t?function(n){return n}:t,u=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=[],t=function t(a){var l,c,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},u=[],d=a.children,m=void 0===d?[]:d,p=a.meta,h=void 0===p?{}:p,x=(0,f.default)((null===h||void 0===h?void 0:h.navigation)||[]);(0,g.default)(h)&&!1!==(null===(l=a.meta)||void 0===l||null===(c=l.capabilities)||void 0===c?void 0:c.navigation)&&u.push.apply(u,o(x));var Z,y=s.name||"",L=s.mountPoint||b,N=a===n?"":h.name||"",S=a===n?"":a.mountPoint||b,w=i(m);try{var C=function(){var n,i,a,l,c=Z.value;if(!(0,g.default)(c.meta))return"continue";var s=c.meta.name,d=c.mountPoint,f=[y,N,s].filter(Boolean).join("."),m=c.meta.navigation||[],p=(0,v.default)(L,S,d);!1!==(null===(n=c.meta)||void 0===n||null===(i=n.capabilities)||void 0===i?void 0:i.navigation)&&e.push({did:c.meta.did,name:f,link:p,title:c.meta.title||"",navigation:m.map((function(n){return r({section:k},n)}))});var h=x.find((function(n){return!!n.component&&n.component===s}));if(h){if(!h.link)if(c.meta.navigation&&c.meta.navigation.length>0){var b,w,C=t(c,{mountPoint:S,name:N});C.length>0&&(h.items=null!==(b=h.items)&&void 0!==b?b:[],(w=h.items).push.apply(w,o(C)))}else h.link=j}else if(!1!==(null===(a=c.meta)||void 0===a||null===(l=a.capabilities)||void 0===l?void 0:l.navigation)){var P=t(c,{mountPoint:S,name:N}),O={title:c.meta.title,component:s,id:c.meta.did};P.length>0?(O.items=P,O.link=void 0):O.link=j,u.push(O)}};for(w.s();!(Z=w.n()).done;)C()}catch(P){w.e(P)}finally{w.f()}return u}(n);return{navigationList:t,components:e}}(e),d=u.navigationList,m=u.components,p=(null===e||void 0===e||null===(n=e.settings)||void 0===n?void 0:n.navigations)||[],h=function(n){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2,t=C((0,f.default)(n),{depth:e,transform:function(n,e){var t;return e&&(n._parent||(n._parent=e.id,e.component||(n.link=w(e.link,n.link))),n.section=n.section||e.section||[k],n.visible=null!==(t=n.visible)&&void 0!==t?t:e.visible),n.component=[e.component,n.component].filter(Boolean).join("."),n}});return y(t,(function(n){n.items&&n.items.length>0&&n.items.reduceRight((function(e,t){if(t._parent){var i=n.items.findIndex((function(n){return n.id===t._parent}));i>=0&&n.items.splice(i,1),delete t._parent}return null}),null)}),{key:"items"}),t}(a(d)),x=C(P(function(n){var e=(0,f.default)(n).filter((function(n){return n.id}));return y(e,(function(n,e){var t;if(n.items&&n.items.length){for(var i=n.items.length-1;i>=0;i--)n.items[i].id||n.items.splice(i,1);0===n.items.length&&n.component&&(n.link=n.link||j)}e&&(n.parent=e.id,n.id=[e.id,n.id].join(Z)),n.from=n.from||"yaml",n.visible=null===(t=n.visible)||void 0===t||t}),{key:"items"}),e}(h)).reduce((function(n,e){var t=["bottom","social","sessionManager"].includes(e.section),i=!1,a=m.find((function(n){return"/"===n.link}));if(a&&e.id===a.did&&(i=!0),t||i){if(e.items&&e.items.length>0)return n.push.apply(n,o(e.items.map((function(n){var t=e.section,i=w(e.link,n.link),o=[e.component,n.component].filter(Boolean).join(".");return r(r({},n),{},{section:t,link:i,component:o,parent:""})})))),n;if(i)return n}return n.push(e),n}),[]),{transform:function(n,e){var t=n.component;return null!==e&&void 0!==e&&e.component&&(t=[e.component,n.component].filter(Boolean).join(".")),r(r({},n),{},{component:t})}});return{navigationList:(0,l.default)(p.map((function(n){var e=r({},n);return e.role&&(e.role=N(e.role)),e.section&&(e.section=N(e.section)),e.title&&(e.title=N(e.title)),e.link&&(e.link=N(e.link)),e})),x,(function(n,e){var t=["id","section"];return(0,c.default)((0,s.default)(n,t),(0,s.default)(e,t))})),components:m,builtinList:x}}},14775:function(n,e,t){t.r(e),t.d(e,{default:function(){return xe}});var i=t(33028),o=t(32723),r=t(34795),a=t(5057),l=t(39948),c=t(56556),s=t(49127),u=t(80576),d=t(6041),f=t(74490),v=t(72904),m=t(25228),p=t(51177),h=t(95301),g=t(11750),x=t(39067),k=t(86229),b=t(55498),j=t(12673),Z=t(13128),y=t(68420),L=t(61059),N=t(92706),S=t.n(N),w=t(55898),C=t.n(w),P=t(53210),O=t(86272),E=t.n(O),A=t(26271),R=t.n(A),T=t(50482),_=t.n(T),I=t(20877),M=t(36095),D=t(96266);function W(n){var e=n.prevPath,t=n.nextPath,i=e.length,o=t.length;return!(i!==o||!_()(e.slice(0,i-1),t.slice(0,o-1)))}function z(n){var e=n.treeNode,t=(0,y.PE)().locale;return(0,D.jsxs)(D.Fragment,{children:[e.icon&&(0,D.jsx)(b.JO,{style:{marginRight:4},icon:e.icon}),function(){var n=e.title,i=e.subtitle,o=n,r=i;return R()(n)&&(o=n[t]),!(0,a.isValidElement)(i)&&R()(i)&&(r=i[t]),(0,D.jsxs)(l.Z,{display:"flex",alignItems:"center",children:[(0,D.jsx)(g.Z,{variant:"subtitle1",fontSize:16,children:o}),i&&(0,D.jsx)(g.Z,{variant:"body2",color:"gray",ml:1.5,lineHeight:1,children:r})]})}()]})}function J(n){var e=n.treeData,t=n.setTreeData,o=n.renderActions,r=e.map((function(n){return(0,i.Z)((0,i.Z)({},n),{},{expanded:!0})})),a={};return"undefined"!==typeof window&&(a.context=window),(0,D.jsx)(M.W,(0,i.Z)((0,i.Z)({backend:I.HTML5Backend},a),{},{children:(0,D.jsx)(P.oP,{generateNodeProps:function(n){return{buttons:o({data:n.node,className:"list-item-actions"}),icons:(0,D.jsx)(b.JO,{icon:"ic:round-drag-indicator"}),title:(0,D.jsx)(z,{treeNode:n.node})}},maxDepth:2,isVirtualized:!1,treeData:r,onChange:t,canDrop:W,theme:E()})}))}z.propTypes={treeNode:C().object.isRequired},J.propTypes={treeData:C().object.isRequired,setTreeData:C().func,renderActions:C().func},J.defaultProps={setTreeData:function(){},renderActions:function(){}};var F=J,B=t(96234),q=t(56666),G=t(28726),V=t(75953),K=t(67680),H=t(53070),U=t(47020),Q=t(41899),Y=t(11251),X=t(24914),$=t.n(X),nn=t(8708),en=t.n(nn),tn=t(82488),on=t.n(tn),rn=t(78164),an=t.n(rn),ln=t(75506),cn=t.n(ln),sn=t(2765),un=t.n(sn),dn=t(25842),fn=t.n(dn),vn=t(80506),mn=t(19371),pn=t(6352),hn=t.n(pn),gn=t(2842),xn=t(6018),kn=t.n(xn),bn=t(76811),jn=t(68079),Zn=t(63838),yn=t(65873),Ln=t(27156),Nn=t(23985),Sn=t(11819),wn=t(59740),Cn=t(19654),Pn=t(90067),On=t(44067),En=t(12594),An=["fullWidth","multiple","required","label","placeholer","options","helperText","error","margin"];function Rn(n){var e=n.fullWidth,t=n.multiple,o=n.required,r=n.label,a=n.placeholer,c=n.options,s=n.helperText,v=n.error,m=n.margin,h=(0,wn.Z)(n,An),x=c.find((function(n){return n.value===h.value})),k=null===x||void 0===x?void 0:x.title;return(0,D.jsxs)(u.Z,{margin:m,fullWidth:e,error:v,children:[(0,D.jsx)(d.Z,{children:"".concat(r).concat(o?"*":"")}),(0,D.jsxs)(p.Z,(0,i.Z)((0,i.Z)({multiple:t,input:(0,D.jsx)(En.Z,{defaultValue:k,sx:{flex:1},required:o,label:r,inputProps:{margin:m}}),renderValue:function(n){if(t)return(0,D.jsx)(l.Z,{sx:{display:"flex",flexWrap:"wrap",gap:.5},children:n.map((function(n){var e=c.find((function(e){return e.value===n}));return e&&e.title&&(0,D.jsx)(Cn.Z,{size:"small",label:e.title},n)}))});var e=c.find((function(e){return e.value===n}));return e&&e.title&&(0,D.jsxs)(l.Z,{children:[(0,D.jsx)(g.Z,{component:"span",children:e.title}),(0,D.jsx)(g.Z,{marginLeft:1,component:"span",variant:"body2",color:"text.secondary",children:e.description})]})}},h),{},{children:[(0,D.jsx)(f.Z,{disabled:!0,children:(0,D.jsx)("em",{children:a})}),!t&&(0,D.jsx)(f.Z,{value:"",children:"None"}),c.map((function(n){return n&&n.value&&(0,D.jsxs)(f.Z,{value:n.value,children:[(0,D.jsx)(On.Z,{children:n.title}),n.description&&(0,D.jsx)(g.Z,{variant:"body2",color:"text.secondary",children:n.description})]},n.value)}))]})),(0,D.jsx)(Pn.Z,{children:s})]})}Rn.propTypes={error:C().bool,required:C().bool,multiple:C().bool,fullWidth:C().bool,label:C().string,placeholer:C().string,options:C().array,helperText:C().string,margin:C().string},Rn.defaultProps={error:!1,required:!1,multiple:!1,fullWidth:!1,label:"",placeholer:"",options:[],helperText:"",margin:""};var Tn=Rn,_n="en";function In(n){var e=n.sx,t=n.onAdd,i=n.onChange,o=n.locales,r=n.localeMap,s=n.onRemoveLocale,u=(0,y.PE)().t,d=(0,a.useRef)(),f=(0,a.useState)(null),v=(0,B.Z)(f,2),m=v[0],p=v[1],h=(0,j.Z)({currentLocale:_n,localeList:[],inputLocale:"",localeError:""}),x=(0,a.useMemo)((function(){return!!m}),[m]),k=(0,a.useMemo)((function(){return o.includes(h.currentLocale)?h.currentLocale:_n}),[o,h.currentLocale]),Z=(0,a.useMemo)((function(){return Object.keys((0,yn.omit)(r,[].concat((0,jn.Z)(h.localeList),[_n]))).map((function(n){return{title:r[n],value:n}}))}),[h.localeList]);function L(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",e=function(n){return n?"en"!==n&&!h.localeList.includes(n)||u("navigation.form.localeExists",{value:n}):u("common.requiredErrorText",{name:"Locale"})}(null===n||void 0===n?void 0:n.trim());return h.localeError=!0!==e?e:"",e}function N(){var n,e=null===(n=h.inputLocale)||void 0===n?void 0:n.trim();!0===L(e)&&(S(),h.localeList.push(e),h.currentLocale=e,t(e))}function S(){p(null),h.inputLocale="",h.localeError=""}return(0,a.useEffect)((function(){h.localeList=(0,jn.Z)(o)}),[o,h]),(0,Zn.Z)("enter",(function(){setTimeout((function(){N()}))}),{target:d}),(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(Ln.Z,{sx:e,value:k,onChange:function(n,e){h.currentLocale=e,i(e)},children:[(0,D.jsx)(Nn.Z,{label:"Default (".concat(r[_n],")"),value:"en"}),h.localeList.map((function(n){return(0,D.jsx)(Nn.Z,{sx:{position:"relative"},label:(0,D.jsxs)(D.Fragment,{children:[r[n],(0,D.jsx)(K.Z,{size:"small",color:"inherit",sx:{position:"absolute",top:0,right:0},onClick:function(e){!function(n,e){n.preventDefault(),n.stopPropagation(),h.localeList=(0,yn.without)(h.localeList,e),s(e),e===h.currentLocale&&(h.currentLocale=_n)}(e,n)},children:(0,D.jsx)(b.JO,{icon:"mdi:close",height:14})})]}),value:n},n)})),(0,D.jsx)(K.Z,{color:"primary",disableFocusRipple:!0,sx:{width:"48px"},onClick:function(n){p(n.currentTarget)},children:(0,D.jsx)(b.JO,{icon:"mdi:plus"})})]}),(0,D.jsx)(Sn.ZP,{open:x,anchorEl:m,onClose:S,anchorOrigin:{vertical:"bottom",horizontal:"left"},children:(0,D.jsxs)(l.Z,{sx:{p:2,width:"270px"},children:[(0,D.jsx)(g.Z,{variant:"subtitle2",children:u("navigation.form.localePlaceholder")}),(0,D.jsx)(l.Z,{mt:1,children:(0,D.jsx)(Tn,{required:!0,fullWidth:!0,label:"Locale",value:h.inputLocale,options:Z,onChange:function(n){var e=n.target.value;L(e),h.inputLocale=e},error:!!h.localeError,helperText:h.localeError||" "})}),(0,D.jsx)(l.Z,{display:"flex",justifyContent:"flex-end",children:(0,D.jsx)(c.Z,{size:"small",variant:"contained",onClick:N,children:u("common.confirm")})})]})})]})}In.propTypes={sx:C().any,onAdd:C().func,onChange:C().func,onRemoveLocale:C().func,localeMap:C().object,locales:C().array},In.defaultProps={sx:null,onAdd:function(){},onChange:function(){},onRemoveLocale:function(){},localeMap:{},locales:[]};var Mn=In,Dn=t(17425),Wn=t(29054),zn="en",Jn={title:(0,q.Z)({},zn,""),link:(0,q.Z)({},zn,"")};function Fn(n){var e=n.icon,t=(0,a.useState)(!1),i=(0,B.Z)(t,2),l=i[0],c=i[1];return(0,Q.Z)((0,r.Z)((0,o.Z)().mark((function n(){return(0,o.Z)().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return c(!1),n.next=3,(0,b.GL)(e);case 3:c(!0);case 4:case"end":return n.stop()}}),n)}))),[e]),e?l?(0,D.jsx)(b.JO,{icon:e}):(0,D.jsx)(b.JO,{color:"#f06f6e",icon:"ic:baseline-error"}):(0,D.jsx)(b.JO,{icon:"codicon:blank"})}Fn.propTypes={icon:C().string.isRequired};var Bn=(0,a.forwardRef)((function(n,e){var t=n.section,c=n.components,s=n.rawNavigations,d=(0,Dn.DJ)().roles,f=(0,y.PE)(),v=f.t,m=f.locale,p=(0,Wn.y0)().blocklet.environments.find((function(n){return"BLOCKLET_APP_LANGUAGES"===n.key})),h=(p?p.value.split(","):["en","zh"]).filter((function(n){return bn.SUPPORTED_LANGUAGES[n]})).reduce((function(n,e){return n[e]=bn.SUPPORTED_LANGUAGES[e].nativeName,n}),{}),x=(0,a.useRef)((function(){})),L=(0,Y.Z)(!1),N=(0,B.Z)(L,2),S=N[0],w=N[1],C=w.setFalse,P=w.setTrue,O=(0,j.Z)({isRoot:!0,type:"add",linkDisabled:!1,locale:zn,formState:fn()(Jn),get localeList(){return an()(Object.keys(this.formState.title),zn)}}),E=(0,vn.cI)({mode:"onChange",defaultValues:{id:void 0,title:void 0,icon:void 0,link:void 0,component:void 0,parent:void 0,role:[]}}),A=E.handleSubmit,T=E.control,_=E.watch,I=E.setValue,M=E.clearErrors,W=E.formState.errors;(0,a.useEffect)((function(){I("title",O.formState.title[O.locale]),I("link",O.formState.link[O.locale])}),[I,O.locale,S]);var z=_("component"),J=_("title"),F=_("link"),Q=_("icon"),X=_("parent");(0,a.useEffect)((function(){O.formState.title[O.locale]=J}),[J]),(0,a.useEffect)((function(){O.formState.link[O.locale]=F}),[F]);var nn=(0,a.useMemo)((function(){return s.find((function(n){return z?c.find((function(n){return n.name===z})).did===n.id:n.id===X}))}),[c,s,z,X]),tn=(0,a.useMemo)((function(){if(null!==nn&&void 0!==nn&&nn.component){var n=(c.find((function(n){return n.name===nn.component}))||{}).link,e=R()(n)?n[O.locale]:n;if(z)return(0,gn.QT)(e);var t=R()(nn.link)?nn.link[O.locale]:nn.link;return(0,gn.QT)(hn()(e,t||"/"))}return null}),[c,O.locale,nn,z]),rn=(0,a.useMemo)((function(){var n=(nn||{}).component,e=(c.find((function(e){return e.name===n}))||{}).navigation,i=void 0===e?[]:e;return(0,mn.flattenNavigation)(i,{transform:function(n,e){return null!==e&&void 0!==e&&e.section&&(n.section=n.section||e.section),n}}).filter((function(n){return n.link})).filter((function(n){return(0,mn.isMatchSection)(n.section,t)})).map((function(n){return{label:n.link,title:n.title[m]||n.title}}))}),[nn,c,t,m]),ln=(0,a.useMemo)((function(){var n={add:v("common.create"),edit:v("common.edit")}[O.type];return n?"".concat(n," ").concat(v("navigation.navigation")):"--"}),[O.type,v]),sn=(0,a.useCallback)((function(){O.isRoot=!0,O.locale=zn,O.type="add",O.linkDisabled=!1,x.current=function(){},I("id",void 0),I("icon",void 0),I("title",void 0),I("link",void 0),I("component",void 0),I("parent",void 0),I("role",[]),O.formState=fn()(Jn),M()}),[M,I,O]),dn=(0,a.useCallback)((function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return O.localeList.length>0&&(new Set(on()(O.formState.title)).size>1&&(n.title=O.formState.title),new Set(on()(O.formState.link)).size>1&&(n.link=O.formState.link)),cn()(n.role)&&(n.role=void 0),n}),[O.formState.link,O.formState.title,O.localeList]),pn=(0,a.useCallback)((function(){C(),setTimeout((function(){sn()}))}),[sn,C]),xn=(0,a.useCallback)((function(){var n=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).parent,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){};O.type="add",O.isRoot=!n,I("parent",null===n||void 0===n?void 0:n.id),x.current=function(n){e(pn,n)},P()}),[pn,P,I,O]),jn=(0,a.useCallback)((function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){},t=n.id,i=n.title,o=n.icon,r=n.link,a=n.parent,l=n.component,c=n.role,s=void 0===c?[]:c;I("id",t),I("icon",o),"tmpl"===n.from&&(O.linkDisabled=!0),un()(i)?O.formState.title=O.localeList.reduce((function(n,e){return n[e]=i,n}),(0,q.Z)({},zn,i)):R()(i)?O.formState.title=fn()(i):O.formState.title={},un()(r)?O.formState.link=O.localeList.reduce((function(n,e){return n[e]=r,n}),(0,q.Z)({},zn,r)):R()(r)?O.formState.link=fn()(r):O.formState.link={},I("component",l),I("parent",a),I("role",s||[]),P(),O.type="edit",O.isRoot=!a,x.current=function(n){var t=en()(n,["id","title","icon","link","role"]);e(pn,t)}}),[pn,P,I,O]);function Zn(n){var e=null===n||void 0===n?void 0:n.trim();return e?!(e.length>24)||v("navigation.form.titleTooLong",{len:24}):v("common.requiredErrorText",{name:v("navigation.form.title")})}function yn(){return(yn=(0,r.Z)((0,o.Z)().mark((function n(e){var t;return(0,o.Z)().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(!(t=null===e||void 0===e?void 0:e.trim())){n.next=10;break}return n.prev=2,n.next=5,(0,b.GL)(t);case 5:n.next=10;break;case 7:return n.prev=7,n.t0=n.catch(2),n.abrupt("return",v("navigation.form.invalidIcon"));case 10:return n.abrupt("return",!0);case 11:case"end":return n.stop()}}),n,null,[[2,7]])})))).apply(this,arguments)}function Ln(n){var e=null===n||void 0===n?void 0:n.trim();return e?!!(0,mn.checkLink)(e)||v("navigation.form.invalidLink"):!!O.isRoot||v("common.requiredErrorText",{name:v("navigation.form.link")})}(0,a.useImperativeHandle)(e,(function(){return{add:xn,edit:jn,close:pn}}),[xn,pn,jn]);var Nn=(0,a.useCallback)((function(n){O.locale=n,O.formState.title[n]||(O.formState.title[n]=""),O.formState.link[n]||(O.formState.link[n]=""),setTimeout((function(){M()}))}),[M,O]),Sn=(0,a.useCallback)((function(){for(var n=O.formState,e=n.title,t=n.link,i=0,o=Object.keys(e);i<o.length;i++){var r=Zn(e[o[i]]);if(!0!==r)return r}for(var a=0,l=Object.keys(t);a<l.length;a++){var c=Ln(t[l[a]]);if(!0!==c)return c}return!0}),[O.formState]),wn=(0,a.useCallback)((function(n){var e=Sn();!0===e?x.current(dn(n)):k.Z.error(e)}),[Sn,dn]),Cn=(0,a.useCallback)((function(n){O.formState.title=$()(O.formState.title,n),O.formState.link=$()(O.formState.link,n)}),[O.formState]),Pn=(0,a.useCallback)((function(n){var e,t;O.locale=n,O.formState.title[n]=null===(e=O.formState.title)||void 0===e?void 0:e[zn],O.formState.link[n]=null===(t=O.formState.link)||void 0===t?void 0:t[zn],setTimeout((function(){M()}))}),[M,O]);return(0,D.jsxs)(Z.ZP,{open:S,title:ln,onClose:pn,actions:(0,D.jsx)(G.Z,{onClick:A(wn),color:"primary",autoFocus:!0,variant:"contained",children:v("common.confirm")}),children:[(0,D.jsx)(Mn,{sx:{mb:1},onAdd:Pn,onChange:Nn,onRemoveLocale:Cn,localeMap:h,locales:O.localeList}),(0,D.jsxs)("form",{noValidate:!0,autoComplete:"off",children:[(0,D.jsx)(vn.Qr,{name:"title",control:T,rules:{validate:Zn},render:function(n){var e,t,o=n.field;return(0,D.jsx)(U.Z,(0,i.Z)({fullWidth:!0,variant:"outlined",margin:"dense",required:!0,placeholder:v("navigation.form.titlePlaceholder"),label:v("navigation.form.title"),disabled:O.isEdit,error:!(null===W||void 0===W||null===(e=W.title)||void 0===e||!e.message),helperText:(null===W||void 0===W||null===(t=W.title)||void 0===t?void 0:t.message)||" "},o))}}),(0,D.jsx)(vn.Qr,{name:"icon",control:T,rules:{validate:function(n){return yn.apply(this,arguments)}},render:function(n){var e,t,o=n.field;return(0,D.jsx)(U.Z,(0,i.Z)((0,i.Z)({fullWidth:!0,variant:"outlined",margin:"dense",placeholder:v("navigation.form.iconPlaceholder"),label:v("navigation.form.icon"),error:!(null===W||void 0===W||null===(e=W.icon)||void 0===e||!e.message),disabled:O.locale!==zn,helperText:(null===W||void 0===W||null===(t=W.icon)||void 0===t?void 0:t.message)||(0,D.jsx)(l.Z,{display:"flex",children:(0,D.jsxs)(l.Z,{component:"a",href:"https://icones.js.org",target:"_blank",display:"flex",alignItems:"center",children:[v("navigation.form.findMoreIcon")," ",(0,D.jsx)(b.JO,{style:{marginLeft:4},icon:"radix-icons:external-link"})]})})},o),{},{InputProps:{endAdornment:(0,D.jsx)(H.Z,{position:"end",children:(0,D.jsx)(K.Z,{sx:{cursor:"default"},disableFocusRipple:!0,disableRipple:!0,children:Q&&(0,D.jsx)(Fn,{icon:Q})})})}}))}}),O.isRoot&&(0,D.jsx)(vn.Qr,{name:"component",control:T,render:function(n){var e,t,o=n.field;return(0,D.jsx)(Tn,(0,i.Z)({fullWidth:!0,margin:"dense",disabled:"edit"===O.type||O.locale!==zn,label:v("navigation.form.component"),placeholer:v("navigation.form.componentPlaceholder"),options:c.map((function(n){return{title:n.title,value:n.name,description:n.link}})),error:!(null===W||void 0===W||null===(e=W.component)||void 0===e||!e.message),helperText:(null===W||void 0===W||null===(t=W.component)||void 0===t?void 0:t.message)||" "},$()(o,"ref")))}}),(0,D.jsx)(vn.Qr,{name:"link",control:T,rules:{validate:Ln},render:function(n){var e=n.field;return(0,D.jsx)(u.Z,{fullWidth:!0,margin:"dense",children:(0,D.jsx)(V.Z,(0,i.Z)((0,i.Z)({disablePortal:!0,freeSolo:!0,blurOnSelect:!0,autoSelect:!0,fullWidth:!0,disabled:O.linkDisabled,isOptionEqualToValue:function(n){return n.label},options:rn,renderInput:function(n){var e,t;return(0,D.jsx)(U.Z,(0,i.Z)((0,i.Z)({},n),{},{placeholder:v("navigation.form.linkPlaceholder"),label:v("navigation.form.link"),error:!(null===W||void 0===W||null===(e=W.link)||void 0===e||!e.message),helperText:(null===W||void 0===W||null===(t=W.link)||void 0===t?void 0:t.message)||"/abc/bcd or /abc or https://arcblock.io",InputProps:{startAdornment:tn?(0,D.jsx)(H.Z,{position:"start",sx:{textDecoration:kn()(F||"")?"line-through":""},children:tn}):null}}))},renderOption:function(n,e){return(0,D.jsxs)(l.Z,(0,i.Z)((0,i.Z)({component:"li"},n),{},{children:[e.label,(0,D.jsx)(g.Z,{marginLeft:1,component:"span",variant:"body2",color:"text.secondary",children:e.title})]}))},margin:"dense"},e),{},{onChange:function(){},onInputChange:function(n,t){e.onChange(t)}}))})}}),["dashboard","sessionManager"].includes(t)&&(0,D.jsx)(vn.Qr,{name:"role",control:T,render:function(n){var e,t,o=n.field;return(0,D.jsx)(Tn,(0,i.Z)({fullWidth:!0,multiple:!0,margin:"dense",label:v("navigation.form.role"),placeholer:v("navigation.form.rolePlaceholder"),options:d.map((function(n){return{title:n.title,value:n.name}})),error:!(null===W||void 0===W||null===(e=W.role)||void 0===e||!e.message),helperText:(null===W||void 0===W||null===(t=W.role)||void 0===t?void 0:t.message)||" "},$()(o,"ref")))}})]})]})}));Bn.propTypes={section:C().string,components:C().array,rawNavigations:C().array},Bn.defaultProps={section:"",components:[],rawNavigations:[]};var qn=Bn;function Gn(n){var e=n.className,t=n.add,i=n.edit,o=n.toggle,r=n.del,l=n.data,c=n.section,s=(0,y.PE)().t,u=["yaml","tmpl"].includes(l.from),d=(0,a.isValidElement)(l.subtitle);function f(n){n.preventDefault(),n.stopPropagation()}var v=(0,a.useCallback)((function(n){f(n),t(l)}),[t,l]),m=(0,a.useCallback)((function(n){f(n),i(l)}),[i,l]),p=(0,a.useCallback)((function(n){f(n),o(l)}),[o,l]),h=(0,a.useCallback)((function(n){f(n),r(l)}),[r,l]);return(0,D.jsxs)("div",{className:e,children:[!l.parent&&["header","footer","dashboard"].includes(c)&&(0,D.jsx)("span",{title:s(d?"navigation.action.noAddSub":"navigation.action.addSub"),children:(0,D.jsx)(K.Z,{size:"small",color:"success",onClick:v,disabled:d,children:(0,D.jsx)(b.JO,{icon:"mdi:plus-box-outline"})})}),(0,D.jsx)("span",{title:s(d?"navigation.action.noEdit":"navigation.action.edit"),children:(0,D.jsx)(K.Z,{size:"small",color:"primary",onClick:m,disabled:d,children:(0,D.jsx)(b.JO,{icon:"mdi:pencil"})})}),(0,D.jsx)("span",{title:d?s("navigation.action.noEdit"):l.visible?s("navigation.action.hide"):s("navigation.action.show"),children:(0,D.jsx)(K.Z,{size:"small",color:"warning",onClick:p,disabled:d,children:!1===l.visible?(0,D.jsx)(b.JO,{icon:"mdi:eye-off-outline"}):(0,D.jsx)(b.JO,{icon:"mdi:eye-outline"})})}),(0,D.jsx)("span",{title:s(u&&!d?"navigation.action.noDel":"navigation.action.del"),children:(0,D.jsx)(K.Z,{disabled:u&&!d,size:"small",color:"error",onClick:h,children:(0,D.jsx)(b.JO,{icon:"mdi:delete"})})})]})}Gn.propTypes={data:C().object.isRequired,className:C().string,add:C().func,edit:C().func,toggle:C().func,del:C().func,section:C().string},Gn.defaultProps={className:"",add:function(){},edit:function(){},toggle:function(){},del:function(){},section:""};var Vn=Gn,Kn=t(3785),Hn=t.n(Kn),Un=t(79683),Qn=t.n(Un),Yn=t(35432),Xn=t(14491),$n="/",ne="header",ee={sessionManager:[{id:"/sessionManager",title:{en:"Manage",zh:"\u7ba1\u7406"},section:["sessionManager"],icon:"ion:settings-outline",link:"".concat(Yn.WELLKNOWN_SERVICE_PATH_PREFIX,"/admin"),role:["owner","admin"],from:"tmpl"}],dashboard:[{id:"/team",title:{en:"Access",zh:"\u8bbf\u95ee\u63a7\u5236"},role:["owner","admin","member"],section:["dashboard"],link:"",from:"tmpl",items:[{id:"member",title:{en:"Members",zh:"\u6210\u5458"},icon:"ant-design:user-outlined",link:"".concat(Yn.WELLKNOWN_SERVICE_PATH_PREFIX,"/admin/members"),from:"tmpl"},{id:"passport",title:{en:"Passport",zh:"\u901a\u884c\u8bc1"},icon:"icon-park-outline:passport",link:"".concat(Yn.WELLKNOWN_SERVICE_PATH_PREFIX,"/admin/passports"),from:"tmpl"}]},{id:"/dashboard",title:"Blocklet",role:["owner","admin"],section:["dashboard"],link:"",from:"tmpl",items:[{id:"dashboard",title:{en:"Dashboard",zh:"\u4eea\u8868\u76d8"},icon:"ant-design:dashboard-outlined",link:"".concat(Yn.WELLKNOWN_SERVICE_PATH_PREFIX,"/admin"),from:"tmpl"}]}]};function te(n,e){return n.section&&e.section?n.section===e.section&&n.id===e.id:n.id===e.id}function ie(){var n=(0,Wn.y0)(),e=n.blocklet,t=n.actions,l=(0,mn.parseNavigation)(e,{beforeProcess:function(n){var e=fn()(n);return ee.dashboard.forEach((function(n){e.some((function(e){return e.id===n.id}))||e.push(n)})),e.some((function(n){return n.id&&(n.section||[]).includes("sessionManager")}))||e.push.apply(e,(0,jn.Z)(ee.sessionManager)),e}}),c=l.navigationList,s=l.components,u=l.builtinList,d=(0,j.Z)({rawNavigation:fn()(c),activeSection:ne,components:s}),f=(0,a.useMemo)((function(){return(0,mn.nestNavigationList)(d.rawNavigation)}),[d.rawNavigation]),v=(0,a.useMemo)((function(){var n=(0,mn.filterNavigation)(d.rawNavigation,s),e=(0,mn.joinLink)(n,s);return(0,mn.cleanOrphanNavigation)(e)}),[s,d.rawNavigation]);function m(n){if(!n.id)return"";var e=(0,mn.flattenNavigation)((0,mn.joinLink)(f,s)),t=e.find((function(e){return e.id===n.id}));function i(n){var e=n.name;return(0,D.jsx)(Cn.Z,{label:"Uninstalled: ".concat(e),color:"error",size:"small",variant:"outlined",sx:{fontSize:10,height:20}})}if(null!==t&&void 0!==t&&t.component){if(!s.some((function(n){return n.name===t.component})))return(0,D.jsx)(i,{name:t.component})}else if(t.parent){var o=e.find((function(n){return n.id===t.parent}));if(null!==o&&void 0!==o&&o.component&&!s.some((function(n){return n.name===o.component})))return(0,D.jsx)(i,{name:o.component})}return null===t||void 0===t?void 0:t.link}function p(n){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:$n;return n.map((function(n){var t=s.find((function(e){return e.name===n.component})),i=(null===t||void 0===t?void 0:t.link)||e,o=n.items||[],r=n.link;return{title:n.title,subtitle:m(n),link:r,icon:n.icon,children:p(o,r||$n),section:n.section,visible:n.visible,parent:n.parent,component:n.component,id:n.id,role:n.role,from:n.from,__base:i}}))}function h(n){return g.apply(this,arguments)}function g(){return(g=(0,r.Z)((0,o.Z)().mark((function n(e){var r,a;return(0,o.Z)().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return r=e.map((function(n){return Qn()(n,Hn())})),a=r.map((function(n){var e=(0,i.Z)({},n);return e.role&&Array.isArray(e.role)&&(e.role=JSON.stringify(e.role)),e.section&&Array.isArray(e.section)&&(e.section=JSON.stringify(e.section)),e.title&&e.title instanceof Object&&(e.title=JSON.stringify(e.title)),e.link&&e.link instanceof Object&&(e.link=JSON.stringify(e.link)),e})),n.next=4,t.configNavigations(a);case 4:case"end":return n.stop()}}),n)})))).apply(this,arguments)}function x(){return(x=(0,r.Z)((0,o.Z)().mark((function n(){return(0,o.Z)().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,h([]);case 2:d.rawNavigation=fn()(u);case 3:case"end":return n.stop()}}),n)})))).apply(this,arguments)}return{state:d,navigation:v,components:s,getNavigationFullLink:m,updateActiveSection:function(n){d.activeSection=n},updateNavigationItem:function(n){!function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=d.rawNavigation.map((function(e){var t=n.find((function(n){return te((0,i.Z)((0,i.Z)({},n),{},{section:d.activeSection}),e)}));return t?(0,i.Z)((0,i.Z)({},e),t):e}));d.rawNavigation=e}([n])},delNavigationItem:function(n){var e=d.rawNavigation.filter((function(e){return e.id===n||e.parent===n})).map((function(n){return n.id}));d.rawNavigation=d.rawNavigation.filter((function(n){return!e.includes(n.id)}))},addNavigationItem:function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=(0,i.Z)((0,i.Z)({},n),{},{id:(0,Xn.x0)(),section:d.activeSection,visible:!0});d.rawNavigation=[].concat((0,jn.Z)(d.rawNavigation),[e])},updateNavigationTree:function(n){var e=[];(0,mn.deepWalk)(n,(function(n,t){var o=(0,i.Z)((0,i.Z)({},$()(n,["children","expand"])),{},{parent:null===t||void 0===t?void 0:t.id});e.push(o)}));var t=d.rawNavigation.filter((function(n){if(!d.activeSection)return!1;var t=e.find((function(e){return te(e,n)}));return!t||!(0,mn.isMatchSection)(t.section,d.activeSection)}));d.rawNavigation=[].concat((0,jn.Z)(t),e)},getNavigation:function(n){return p(fn()(f).filter((function(e){return(0,mn.isMatchSection)(e.section,n)})))},saveNavigationList:h,resetNavigation:function(){return x.apply(this,arguments)}}}var oe,re=t(71171),ae=t(1192),le=t(2484),ce=t(5873),se=t(88764),ue=t(55402),de=t(5939),fe=t(33518),ve=t(49522);function me(n){var e,t,i,o,r=n.className,a=n.navigation,c=(0,Wn.y0)().blocklet,s=(0,ve.Z)({blocklet:c}).logoUrl,u=null===c||void 0===c||null===(e=c.environments)||void 0===e||null===(t=e.find((function(n){return n.key===bn.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_COPYRIGHT_OWNER})))||void 0===t?void 0:t.value,d=null===c||void 0===c||null===(i=c.environments)||void 0===i||null===(o=i.find((function(n){return n.key===bn.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_COPYRIGHT_YEAR})))||void 0===o?void 0:o.value,f=u||d?{owner:u,year:d}:void 0,v={appId:c.appDid,appLogo:s,appName:c.meta.title,enableConnect:!0,enableLocale:!1,navigation:a,copyright:f};return(0,D.jsx)(se.Z,{children:(0,D.jsxs)(l.Z,{className:r,children:[(0,D.jsx)(ae.Z,{meta:v}),(0,D.jsx)(l.Z,{children:(0,D.jsx)(ce.Z,{meta:v,invalidPathFallback:function(){},headerProps:{style:{display:"none"}},children:(0,D.jsx)(ue.ZP,{container:!0,spacing:2,children:new Array(6).fill().map((function(n,e){return(0,D.jsxs)(ue.ZP,{item:!0,xs:4,children:[(0,D.jsx)(de.Z,{animation:!1,variant:"rectangular",width:"100%",height:120}),(0,D.jsxs)(l.Z,{sx:{pt:.5},children:[(0,D.jsx)(de.Z,{animation:!1}),(0,D.jsx)(de.Z,{width:"60%",animation:!1})]})]},e)}))})})}),(0,D.jsx)(le.Z,{meta:v})]})})}me.propTypes={className:C().string,navigation:C().array},me.defaultProps={className:"",navigation:[]};var pe=(0,fe.Z)(me)(oe||(oe=(0,re.Z)(["\n .dashboard {\n height: auto !important;\n }\n .dashboard-content + div {\n display: none;\n }\n"]))),he={login:S(),logout:S(),switch:S(),switchDid:S(),switchProfile:S(),switchPassport:S(),useDid:function(){return{walletDid:"abcdefghijklmnopqrstuvwxyz"}},useOAuth:function(){return{logoutOAuth:S(),bindOAuth:S(),configs:{},switchOAuthPassport:S()}}},ge={header:"Header",footer:"Footer",bottom:"Footer Link",social:"Footer Social",dashboard:"Dashboard",sessionManager:"SessionManager"};var xe=function(){var n=(0,y.PE)().t,e=(0,Wn.y0)().blocklet,t=(0,a.useRef)(null),N=(0,Dn.DJ)().roles,S=(0,v.Z)((function(n){return n.breakpoints.down("md")})),w=(0,j.Z)({saveLoading:!1,resetLoading:!1,showResetConfirm:!1,mockRole:"owner"}),C=ie(),P=C.state,O=C.navigation,E=C.getNavigation,A=C.saveNavigationList,R=C.resetNavigation,T=C.updateActiveSection,_=C.updateNavigationTree,I=C.updateNavigationItem,M=C.delNavigationItem,W=C.addNavigationItem,z=(0,a.useCallback)((function(n){t.current.add({parent:n},(function(n,e){W(e),n()}))}),[W]),J=(0,a.useCallback)((function(n){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};switch(n){case"edit":t.current.edit(e,(function(n,e){I(e),n()}));break;case"toggle":I({id:e.id,visible:!e.visible});break;case"del":M(e.id)}}),[M,I]),B=(0,a.useCallback)((0,r.Z)((0,o.Z)().mark((function e(){return(0,o.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,w.saveLoading=!0,e.next=4,A(P.rawNavigation);case 4:k.Z.success(n("common.succeeded")),e.next=10;break;case 7:e.prev=7,e.t0=e.catch(0),k.Z.error((0,D.jsxs)(l.Z,{children:[(0,D.jsx)(g.Z,{variant:"subtitle2",children:n("navigation.actionFailed")}),(0,D.jsx)(g.Z,{variant:"body1",children:(0,Xn.Z)(e.t0)||e.t0.error})]}));case 10:return e.prev=10,w.saveLoading=!1,e.finish(10);case 13:case"end":return e.stop()}}),e,null,[[0,7,10,13]])}))),[P.rawNavigation,w,A,n]),q=(0,a.useCallback)((0,r.Z)((0,o.Z)().mark((function e(){return(0,o.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,w.resetLoading=!0,e.next=4,R();case 4:k.Z.success(n("navigation.action.resetSuccessful"),{variant:"success"}),e.next=10;break;case 7:e.prev=7,e.t0=e.catch(0),k.Z.error((0,D.jsxs)(l.Z,{children:[(0,D.jsx)(g.Z,{variant:"subtitle2",children:n("navigation.actionFailed")}),(0,D.jsx)(g.Z,{variant:"body1",children:(0,Xn.Z)(e.t0)||e.t0.error})]}));case 10:return e.prev=10,w.resetLoading=!1,e.finish(10);case 13:case"end":return e.stop()}}),e,null,[[0,7,10,13]])}))),[w,R,n]),G=(0,a.useMemo)((function(){return{session:(0,i.Z)((0,i.Z)({},he),{},{user:{did:e.appDid,fullName:"Preview User",role:w.mockRole}})}}),[e.appDid,w.mockRole]);return(0,D.jsxs)(D.Fragment,{children:[S&&(0,D.jsx)(p.Z,{fullWidth:!0,size:"small",value:P.activeSection,onChange:function(n){return T(n.target.value)},children:Object.keys(ge).map((function(n){return(0,D.jsxs)(f.Z,{value:n,children:[ge[n]," (".concat(E(n).length,")")]})}))}),!S&&(0,D.jsx)(s.Z,{variant:"outlined",children:Object.keys(ge).map((function(n){return(0,D.jsxs)(c.Z,{variant:P.activeSection===n?"contained":void 0,onClick:function(){return T(n)},children:[ge[n]," (".concat(E(n).length,")")]},n)}))}),(0,D.jsxs)(h.Z,{variant:"dense",sx:{paddingLeft:"0px !important",paddingRight:"0px !important",mt:2},children:[(0,D.jsx)(g.Z,{variant:"h6",component:"div",sx:{flexGrow:1},children:n("common.config")}),(0,D.jsx)(s.Z,{variant:"outlined",children:(0,D.jsx)(x.Z,{size:"small",variant:"outlined",color:"error",startIcon:(0,D.jsx)(b.JO,{icon:"system-uicons:reset"}),sx:{mr:2},loading:w.resetLoading,loadingPosition:"start",onClick:function(){w.showResetConfirm=!0},children:n("navigation.action.reset")})}),(0,D.jsxs)(s.Z,{variant:"outlined",children:[(0,D.jsx)(c.Z,{size:"small",variant:"outlined",startIcon:(0,D.jsx)(b.JO,{icon:"mdi:plus"}),onClick:function(){return z()},children:n("navigation.action.new")}),(0,D.jsx)(x.Z,{size:"small",variant:"contained",startIcon:(0,D.jsx)(b.JO,{icon:"mdi:content-save"}),loading:w.saveLoading,loadingPosition:"start",onClick:B,children:n("common.save")})]})]}),(0,D.jsx)(m.Z,{variant:"outlined",sx:{display:"flex",height:280,overflow:"hidden"},children:(0,D.jsx)(m.Z,{elevation:0,sx:{flex:1,overflow:"auto"},children:(0,D.jsx)(F,{treeData:E(P.activeSection),setTreeData:_,renderActions:function(n){var e=n.data,t=n.className;return(0,D.jsx)(Vn,{data:e,className:t,section:P.activeSection,add:function(){return z.apply(void 0,arguments)},del:function(){for(var n=arguments.length,e=new Array(n),t=0;t<n;t++)e[t]=arguments[t];return J.apply(void 0,["del"].concat(e))},edit:function(){for(var n=arguments.length,e=new Array(n),t=0;t<n;t++)e[t]=arguments[t];return J.apply(void 0,["edit"].concat(e))},toggle:function(){for(var n=arguments.length,e=new Array(n),t=0;t<n;t++)e[t]=arguments[t];return J.apply(void 0,["toggle"].concat(e))}})}})})}),(0,D.jsxs)(h.Z,{variant:"dense",sx:{paddingLeft:"0px !important",paddingRight:"0px !important",mt:3},children:[(0,D.jsx)(g.Z,{variant:"h6",component:"div",sx:{flexGrow:1},children:n("common.preview")}),(0,D.jsxs)(u.Z,{sx:{m:1,minWidth:120},size:"small",children:[(0,D.jsx)(d.Z,{children:n("common.role")}),(0,D.jsx)(p.Z,{value:w.mockRole,label:"Role",onChange:function(n){w.mockRole=n.target.value},children:N.map((function(n){return(0,D.jsx)(f.Z,{value:n.name,children:n.title},n.name)}))})]})]}),(0,D.jsx)(m.Z,{variant:"outlined",children:(0,D.jsx)(L.B3.Provider,{value:G,children:(0,D.jsx)(pe,{navigation:O})})}),(0,D.jsx)(qn,{ref:t,section:P.activeSection,components:P.components,rawNavigations:P.rawNavigation}),(0,D.jsx)(Z.I4,{confirmButton:{text:n("common.confirm"),props:{variant:"contained",color:"error"}},cancelButton:{text:n("common.cancel"),props:{color:"primary"}},open:w.showResetConfirm,title:n("navigation.action.restConfirmTitle"),onConfirm:function(){var n=(0,r.Z)((0,o.Z)().mark((function n(){return(0,o.Z)().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,q();case 2:w.showResetConfirm=!1;case 3:case"end":return n.stop()}}),n)})));return function(){return n.apply(this,arguments)}}(),onCancel:function(){w.showResetConfirm=!1},children:(0,D.jsx)("p",{children:n("navigation.action.restConfirmDesc")})})]})}}}]);
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunk_abtnode_webapp=self.webpackChunk_abtnode_webapp||[]).push([[5953],{75953:function(e,t,n){n.d(t,{Z:function(){return X}});var o=n(56666),r=n(31461),a=n(7896),i=n(5057),l=n(9978),c=n(91213),u=n(3182),p=n(66685),s=n(24202),d=n(62773),f=n(42908),v=n(6285),g=n(31821),h=n(18561);function m(e){return(0,h.Z)("MuiListSubheader",e)}(0,g.Z)("MuiListSubheader",["root","colorPrimary","colorInherit","gutters","inset","sticky"]);var b=n(96266),Z=["className","color","component","disableGutters","disableSticky","inset"],x=(0,d.ZP)("li",{name:"MuiListSubheader",slot:"Root",overridesResolver:function(e,t){var n=e.ownerState;return[t.root,"default"!==n.color&&t["color".concat((0,v.Z)(n.color))],!n.disableGutters&&t.gutters,n.inset&&t.inset,!n.disableSticky&&t.sticky]}})((function(e){var t=e.theme,n=e.ownerState;return(0,a.Z)({boxSizing:"border-box",lineHeight:"48px",listStyle:"none",color:(t.vars||t).palette.text.secondary,fontFamily:t.typography.fontFamily,fontWeight:t.typography.fontWeightMedium,fontSize:t.typography.pxToRem(14)},"primary"===n.color&&{color:(t.vars||t).palette.primary.main},"inherit"===n.color&&{color:"inherit"},!n.disableGutters&&{paddingLeft:16,paddingRight:16},n.inset&&{paddingLeft:72},!n.disableSticky&&{position:"sticky",top:0,zIndex:1,backgroundColor:(t.vars||t).palette.background.paper})})),y=i.forwardRef((function(e,t){var n=(0,f.Z)({props:e,name:"MuiListSubheader"}),o=n.className,i=n.color,u=void 0===i?"default":i,p=n.component,s=void 0===p?"li":p,d=n.disableGutters,g=void 0!==d&&d,h=n.disableSticky,y=void 0!==h&&h,O=n.inset,I=void 0!==O&&O,S=(0,r.Z)(n,Z),P=(0,a.Z)({},n,{color:u,component:s,disableGutters:g,disableSticky:y,inset:I}),C=function(e){var t=e.classes,n=e.color,o=e.disableGutters,r=e.inset,a=e.disableSticky,i={root:["root","default"!==n&&"color".concat((0,v.Z)(n)),!o&&"gutters",r&&"inset",!a&&"sticky"]};return(0,c.Z)(i,m,t)}(P);return(0,b.jsx)(x,(0,a.Z)({as:s,className:(0,l.Z)(C.root,o),ref:t,ownerState:P},S))}));y.muiSkipListHighlight=!0;var O=y,I=n(25228),S=n(67680),P=n(19654),C=n(46234),k=n(9243),w=n(82226),L=n(75623),A=n(74235),T=n(60473);function R(e){return(0,h.Z)("MuiAutocomplete",e)}var N,M,D=(0,g.Z)("MuiAutocomplete",["root","expanded","fullWidth","focused","focusVisible","tag","tagSizeSmall","tagSizeMedium","hasPopupIcon","hasClearIcon","inputRoot","input","inputFocused","endAdornment","clearIndicator","popupIndicator","popupIndicatorOpen","popper","popperDisablePortal","paper","listbox","loading","noOptions","option","groupLabel","groupUl"]),z=n(2286),E=["autoComplete","autoHighlight","autoSelect","blurOnSelect","ChipProps","className","clearIcon","clearOnBlur","clearOnEscape","clearText","closeText","componentsProps","defaultValue","disableClearable","disableCloseOnSelect","disabled","disabledItemsFocusable","disableListWrap","disablePortal","filterOptions","filterSelectedOptions","forcePopupIcon","freeSolo","fullWidth","getLimitTagsText","getOptionDisabled","getOptionLabel","isOptionEqualToValue","groupBy","handleHomeEndKeys","id","includeInputInList","inputValue","limitTags","ListboxComponent","ListboxProps","loading","loadingText","multiple","noOptionsText","onChange","onClose","onHighlightChange","onInputChange","onOpen","open","openOnFocus","openText","options","PaperComponent","PopperComponent","popupIcon","readOnly","renderGroup","renderInput","renderOption","renderTags","selectOnFocus","size","slotProps","value"],F=["ref"],H=["key"],W=(0,d.ZP)("div",{name:"MuiAutocomplete",slot:"Root",overridesResolver:function(e,t){var n=e.ownerState,r=n.fullWidth,a=n.hasClearIcon,i=n.hasPopupIcon,l=n.inputFocused,c=n.size;return[(0,o.Z)({},"& .".concat(D.tag),t.tag),(0,o.Z)({},"& .".concat(D.tag),t["tagSize".concat((0,v.Z)(c))]),(0,o.Z)({},"& .".concat(D.inputRoot),t.inputRoot),(0,o.Z)({},"& .".concat(D.input),t.input),(0,o.Z)({},"& .".concat(D.input),l&&t.inputFocused),t.root,r&&t.fullWidth,i&&t.hasPopupIcon,a&&t.hasClearIcon]}})((function(e){var t,n,r,i,l,c=e.ownerState;return(0,a.Z)((t={},(0,o.Z)(t,"&.".concat(D.focused," .").concat(D.clearIndicator),{visibility:"visible"}),(0,o.Z)(t,"@media (pointer: fine)",(0,o.Z)({},"&:hover .".concat(D.clearIndicator),{visibility:"visible"})),t),c.fullWidth&&{width:"100%"},(l={},(0,o.Z)(l,"& .".concat(D.tag),(0,a.Z)({margin:3,maxWidth:"calc(100% - 6px)"},"small"===c.size&&{margin:2,maxWidth:"calc(100% - 4px)"})),(0,o.Z)(l,"& .".concat(D.inputRoot),(n={flexWrap:"wrap"},(0,o.Z)(n,".".concat(D.hasPopupIcon,"&, .").concat(D.hasClearIcon,"&"),{paddingRight:30}),(0,o.Z)(n,".".concat(D.hasPopupIcon,".").concat(D.hasClearIcon,"&"),{paddingRight:56}),(0,o.Z)(n,"& .".concat(D.input),{width:0,minWidth:30}),n)),(0,o.Z)(l,"& .".concat(C.Z.root),{paddingBottom:1,"& .MuiInput-input":{padding:"4px 4px 4px 0px"}}),(0,o.Z)(l,"& .".concat(C.Z.root,".").concat(k.Z.sizeSmall),(0,o.Z)({},"& .".concat(C.Z.input),{padding:"2px 4px 3px 0"})),(0,o.Z)(l,"& .".concat(w.Z.root),(r={padding:9},(0,o.Z)(r,".".concat(D.hasPopupIcon,"&, .").concat(D.hasClearIcon,"&"),{paddingRight:39}),(0,o.Z)(r,".".concat(D.hasPopupIcon,".").concat(D.hasClearIcon,"&"),{paddingRight:65}),(0,o.Z)(r,"& .".concat(D.input),{padding:"7.5px 4px 7.5px 5px"}),(0,o.Z)(r,"& .".concat(D.endAdornment),{right:9}),r)),(0,o.Z)(l,"& .".concat(w.Z.root,".").concat(k.Z.sizeSmall),(0,o.Z)({paddingTop:6,paddingBottom:6,paddingLeft:6},"& .".concat(D.input),{padding:"2.5px 4px 2.5px 8px"})),(0,o.Z)(l,"& .".concat(L.Z.root),(i={paddingTop:19,paddingLeft:8},(0,o.Z)(i,".".concat(D.hasPopupIcon,"&, .").concat(D.hasClearIcon,"&"),{paddingRight:39}),(0,o.Z)(i,".".concat(D.hasPopupIcon,".").concat(D.hasClearIcon,"&"),{paddingRight:65}),(0,o.Z)(i,"& .".concat(L.Z.input),{padding:"7px 4px"}),(0,o.Z)(i,"& .".concat(D.endAdornment),{right:9}),i)),(0,o.Z)(l,"& .".concat(L.Z.root,".").concat(k.Z.sizeSmall),(0,o.Z)({paddingBottom:1},"& .".concat(L.Z.input),{padding:"2.5px 4px"})),(0,o.Z)(l,"& .".concat(k.Z.hiddenLabel),{paddingTop:8}),(0,o.Z)(l,"& .".concat(L.Z.root,".").concat(k.Z.hiddenLabel),(0,o.Z)({paddingTop:0,paddingBottom:0},"& .".concat(D.input),{paddingTop:16,paddingBottom:17})),(0,o.Z)(l,"& .".concat(L.Z.root,".").concat(k.Z.hiddenLabel,".").concat(k.Z.sizeSmall),(0,o.Z)({},"& .".concat(D.input),{paddingTop:8,paddingBottom:9})),(0,o.Z)(l,"& .".concat(D.input),(0,a.Z)({flexGrow:1,textOverflow:"ellipsis",opacity:0},c.inputFocused&&{opacity:1})),l))})),j=(0,d.ZP)("div",{name:"MuiAutocomplete",slot:"EndAdornment",overridesResolver:function(e,t){return t.endAdornment}})({position:"absolute",right:0,top:"calc(50% - 14px)"}),V=(0,d.ZP)(S.Z,{name:"MuiAutocomplete",slot:"ClearIndicator",overridesResolver:function(e,t){return t.clearIndicator}})({marginRight:-2,padding:4,visibility:"hidden"}),B=(0,d.ZP)(S.Z,{name:"MuiAutocomplete",slot:"PopupIndicator",overridesResolver:function(e,t){var n=e.ownerState;return(0,a.Z)({},t.popupIndicator,n.popupOpen&&t.popupIndicatorOpen)}})((function(e){var t=e.ownerState;return(0,a.Z)({padding:2,marginRight:-2},t.popupOpen&&{transform:"rotate(180deg)"})})),q=(0,d.ZP)(s.Z,{name:"MuiAutocomplete",slot:"Popper",overridesResolver:function(e,t){var n=e.ownerState;return[(0,o.Z)({},"& .".concat(D.option),t.option),t.popper,n.disablePortal&&t.popperDisablePortal]}})((function(e){var t=e.theme,n=e.ownerState;return(0,a.Z)({zIndex:(t.vars||t).zIndex.modal},n.disablePortal&&{position:"absolute"})})),G=(0,d.ZP)(I.Z,{name:"MuiAutocomplete",slot:"Paper",overridesResolver:function(e,t){return t.paper}})((function(e){var t=e.theme;return(0,a.Z)({},t.typography.body1,{overflow:"auto"})})),K=(0,d.ZP)("div",{name:"MuiAutocomplete",slot:"Loading",overridesResolver:function(e,t){return t.loading}})((function(e){var t=e.theme;return{color:(t.vars||t).palette.text.secondary,padding:"14px 16px"}})),U=(0,d.ZP)("div",{name:"MuiAutocomplete",slot:"NoOptions",overridesResolver:function(e,t){return t.noOptions}})((function(e){var t=e.theme;return{color:(t.vars||t).palette.text.secondary,padding:"14px 16px"}})),_=(0,d.ZP)("div",{name:"MuiAutocomplete",slot:"Listbox",overridesResolver:function(e,t){return t.listbox}})((function(e){var t,n,r=e.theme;return(0,o.Z)({listStyle:"none",margin:0,padding:"8px 0",maxHeight:"40vh",overflow:"auto",position:"relative"},"& .".concat(D.option),(n={minHeight:48,display:"flex",overflow:"hidden",justifyContent:"flex-start",alignItems:"center",cursor:"pointer",paddingTop:6,boxSizing:"border-box",outline:"0",WebkitTapHighlightColor:"transparent",paddingBottom:6,paddingLeft:16,paddingRight:16},(0,o.Z)(n,r.breakpoints.up("sm"),{minHeight:"auto"}),(0,o.Z)(n,"&.".concat(D.focused),{backgroundColor:(r.vars||r).palette.action.hover,"@media (hover: none)":{backgroundColor:"transparent"}}),(0,o.Z)(n,'&[aria-disabled="true"]',{opacity:(r.vars||r).palette.action.disabledOpacity,pointerEvents:"none"}),(0,o.Z)(n,"&.".concat(D.focusVisible),{backgroundColor:(r.vars||r).palette.action.focus}),(0,o.Z)(n,'&[aria-selected="true"]',(t={backgroundColor:r.vars?"rgba(".concat(r.vars.palette.primary.mainChannel," / ").concat(r.vars.palette.action.selectedOpacity,")"):(0,p.Fq)(r.palette.primary.main,r.palette.action.selectedOpacity)},(0,o.Z)(t,"&.".concat(D.focused),{backgroundColor:r.vars?"rgba(".concat(r.vars.palette.primary.mainChannel," / calc(").concat(r.vars.palette.action.selectedOpacity," + ").concat(r.vars.palette.action.hoverOpacity,"))"):(0,p.Fq)(r.palette.primary.main,r.palette.action.selectedOpacity+r.palette.action.hoverOpacity),"@media (hover: none)":{backgroundColor:(r.vars||r).palette.action.selected}}),(0,o.Z)(t,"&.".concat(D.focusVisible),{backgroundColor:r.vars?"rgba(".concat(r.vars.palette.primary.mainChannel," / calc(").concat(r.vars.palette.action.selectedOpacity," + ").concat(r.vars.palette.action.focusOpacity,"))"):(0,p.Fq)(r.palette.primary.main,r.palette.action.selectedOpacity+r.palette.action.focusOpacity)}),t)),n))})),J=(0,d.ZP)(O,{name:"MuiAutocomplete",slot:"GroupLabel",overridesResolver:function(e,t){return t.groupLabel}})((function(e){var t=e.theme;return{backgroundColor:(t.vars||t).palette.background.paper,top:-8}})),Q=(0,d.ZP)("ul",{name:"MuiAutocomplete",slot:"GroupUl",overridesResolver:function(e,t){return t.groupUl}})((0,o.Z)({padding:0},"& .".concat(D.option),{paddingLeft:24})),X=i.forwardRef((function(e,t){var n,o,p,d,g,h=(0,f.Z)({props:e,name:"MuiAutocomplete"}),m=(h.autoComplete,h.autoHighlight,h.autoSelect,h.blurOnSelect,h.ChipProps),Z=h.className,x=h.clearIcon,y=void 0===x?N||(N=(0,b.jsx)(A.Z,{fontSize:"small"})):x,O=h.clearOnBlur,S=(void 0===O&&h.freeSolo,h.clearOnEscape,h.clearText),C=void 0===S?"Clear":S,k=h.closeText,w=void 0===k?"Close":k,L=h.componentsProps,D=void 0===L?{}:L,X=h.defaultValue,Y=(void 0===X&&h.multiple,h.disableClearable),$=void 0!==Y&&Y,ee=(h.disableCloseOnSelect,h.disabled),te=void 0!==ee&&ee,ne=(h.disabledItemsFocusable,h.disableListWrap,h.disablePortal),oe=void 0!==ne&&ne,re=(h.filterSelectedOptions,h.forcePopupIcon),ae=void 0===re?"auto":re,ie=h.freeSolo,le=void 0!==ie&&ie,ce=h.fullWidth,ue=void 0!==ce&&ce,pe=h.getLimitTagsText,se=void 0===pe?function(e){return"+".concat(e)}:pe,de=h.getOptionLabel,fe=h.groupBy,ve=h.handleHomeEndKeys,ge=(void 0===ve&&h.freeSolo,h.includeInputInList,h.limitTags),he=void 0===ge?-1:ge,me=h.ListboxComponent,be=void 0===me?"ul":me,Ze=h.ListboxProps,xe=h.loading,ye=void 0!==xe&&xe,Oe=h.loadingText,Ie=void 0===Oe?"Loading\u2026":Oe,Se=h.multiple,Pe=void 0!==Se&&Se,Ce=h.noOptionsText,ke=void 0===Ce?"No options":Ce,we=(h.openOnFocus,h.openText),Le=void 0===we?"Open":we,Ae=h.PaperComponent,Te=void 0===Ae?I.Z:Ae,Re=h.PopperComponent,Ne=void 0===Re?s.Z:Re,Me=h.popupIcon,De=void 0===Me?M||(M=(0,b.jsx)(T.Z,{})):Me,ze=h.readOnly,Ee=void 0!==ze&&ze,Fe=h.renderGroup,He=h.renderInput,We=h.renderOption,je=h.renderTags,Ve=h.selectOnFocus,Be=(void 0===Ve&&h.freeSolo,h.size),qe=void 0===Be?"medium":Be,Ge=h.slotProps,Ke=void 0===Ge?{}:Ge,Ue=(0,r.Z)(h,E),_e=(0,u.o)((0,a.Z)({},h,{componentName:"Autocomplete"})),Je=_e.getRootProps,Qe=_e.getInputProps,Xe=_e.getInputLabelProps,Ye=_e.getPopupIndicatorProps,$e=_e.getClearProps,et=_e.getTagProps,tt=_e.getListboxProps,nt=_e.getOptionProps,ot=_e.value,rt=_e.dirty,at=_e.expanded,it=_e.id,lt=_e.popupOpen,ct=_e.focused,ut=_e.focusedTag,pt=_e.anchorEl,st=_e.setAnchorEl,dt=_e.inputValue,ft=_e.groupedOptions,vt=!$&&!te&&rt&&!Ee,gt=(!le||!0===ae)&&!1!==ae,ht=Qe().onMouseDown,mt=(null!=Ze?Ze:{}).ref,bt=tt(),Zt=bt.ref,xt=(0,r.Z)(bt,F),yt=(0,z.Z)(Zt,mt),Ot=de||function(e){var t;return null!=(t=e.label)?t:e},It=(0,a.Z)({},h,{disablePortal:oe,expanded:at,focused:ct,fullWidth:ue,getOptionLabel:Ot,hasClearIcon:vt,hasPopupIcon:gt,inputFocused:-1===ut,popupOpen:lt,size:qe}),St=function(e){var t=e.classes,n=e.disablePortal,o=e.expanded,r=e.focused,a=e.fullWidth,i=e.hasClearIcon,l=e.hasPopupIcon,u=e.inputFocused,p=e.popupOpen,s=e.size,d={root:["root",o&&"expanded",r&&"focused",a&&"fullWidth",i&&"hasClearIcon",l&&"hasPopupIcon"],inputRoot:["inputRoot"],input:["input",u&&"inputFocused"],tag:["tag","tagSize".concat((0,v.Z)(s))],endAdornment:["endAdornment"],clearIndicator:["clearIndicator"],popupIndicator:["popupIndicator",p&&"popupIndicatorOpen"],popper:["popper",n&&"popperDisablePortal"],paper:["paper"],listbox:["listbox"],loading:["loading"],noOptions:["noOptions"],option:["option"],groupLabel:["groupLabel"],groupUl:["groupUl"]};return(0,c.Z)(d,R,t)}(It);if(Pe&&ot.length>0){var Pt=function(e){return(0,a.Z)({className:St.tag,disabled:te},et(e))};g=je?je(ot,Pt,It):ot.map((function(e,t){return(0,b.jsx)(P.Z,(0,a.Z)({label:Ot(e),size:qe},Pt({index:t}),m))}))}if(he>-1&&Array.isArray(g)){var Ct=g.length-he;!ct&&Ct>0&&(g=g.splice(0,he)).push((0,b.jsx)("span",{className:St.tag,children:se(Ct)},g.length))}var kt=Fe||function(e){return(0,b.jsxs)("li",{children:[(0,b.jsx)(J,{className:St.groupLabel,ownerState:It,component:"div",children:e.group}),(0,b.jsx)(Q,{className:St.groupUl,ownerState:It,children:e.children})]},e.key)},wt=We||function(e,t){var n=e.key,o=(0,r.Z)(e,H);return(0,b.jsx)("li",(0,a.Z)({},o,{children:Ot(t)}),n)},Lt=function(e,t){var n=nt({option:e,index:t});return wt((0,a.Z)({},n,{className:St.option}),e,{selected:n["aria-selected"],index:t,inputValue:dt},It)},At=null!=(n=Ke.clearIndicator)?n:D.clearIndicator,Tt=null!=(o=Ke.paper)?o:D.paper,Rt=null!=(p=Ke.popper)?p:D.popper,Nt=null!=(d=Ke.popupIndicator)?d:D.popupIndicator;return(0,b.jsxs)(i.Fragment,{children:[(0,b.jsx)(W,(0,a.Z)({ref:t,className:(0,l.Z)(St.root,Z),ownerState:It},Je(Ue),{children:He({id:it,disabled:te,fullWidth:!0,size:"small"===qe?"small":void 0,InputLabelProps:Xe(),InputProps:(0,a.Z)({ref:st,className:St.inputRoot,startAdornment:g,onClick:function(e){e.target===e.currentTarget&&ht(e)}},(vt||gt)&&{endAdornment:(0,b.jsxs)(j,{className:St.endAdornment,ownerState:It,children:[vt?(0,b.jsx)(V,(0,a.Z)({},$e(),{"aria-label":C,title:C,ownerState:It},At,{className:(0,l.Z)(St.clearIndicator,null==At?void 0:At.className),children:y})):null,gt?(0,b.jsx)(B,(0,a.Z)({},Ye(),{disabled:te,"aria-label":lt?w:Le,title:lt?w:Le,ownerState:It},Nt,{className:(0,l.Z)(St.popupIndicator,null==Nt?void 0:Nt.className),children:De})):null]})}),inputProps:(0,a.Z)({className:St.input,disabled:te,readOnly:Ee},Qe())})})),pt?(0,b.jsx)(q,(0,a.Z)({as:Ne,disablePortal:oe,style:{width:pt?pt.clientWidth:null},ownerState:It,role:"presentation",anchorEl:pt,open:lt},Rt,{className:(0,l.Z)(St.popper,null==Rt?void 0:Rt.className),children:(0,b.jsxs)(G,(0,a.Z)({ownerState:It,as:Te},Tt,{className:(0,l.Z)(St.paper,null==Tt?void 0:Tt.className),children:[ye&&0===ft.length?(0,b.jsx)(K,{className:St.loading,ownerState:It,children:Ie}):null,0!==ft.length||le||ye?null:(0,b.jsx)(U,{className:St.noOptions,ownerState:It,role:"presentation",onMouseDown:function(e){e.preventDefault()},children:ke}),ft.length>0?(0,b.jsx)(_,(0,a.Z)({as:be,className:St.listbox,ownerState:It},xt,Ze,{ref:yt,children:ft.map((function(e,t){return fe?kt({key:e.key,group:e.group,children:e.options.map((function(t,n){return Lt(t,e.index+n)}))}):Lt(e,t)}))})):null]}))})):null]})}))},3182:function(e,t,n){n.d(t,{D:function(){return d},o:function(){return m}});var o=n(96234),r=n(7896),a=n(5057),i=n(32852),l=n(62663),c=n(77590),u=n(2534),p=n(98038);function s(e){return"undefined"!==typeof e.normalize?e.normalize("NFD").replace(/[\u0300-\u036f]/g,""):e}function d(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.ignoreAccents,n=void 0===t||t,o=e.ignoreCase,r=void 0===o||o,a=e.limit,i=e.matchFrom,l=void 0===i?"any":i,c=e.stringify,u=e.trim,p=void 0!==u&&u;return function(e,t){var o=t.inputValue,i=t.getOptionLabel,u=p?o.trim():o;r&&(u=u.toLowerCase()),n&&(u=s(u));var d=u?e.filter((function(e){var t=(c||i)(e);return r&&(t=t.toLowerCase()),n&&(t=s(t)),"start"===l?0===t.indexOf(u):t.indexOf(u)>-1})):e;return"number"===typeof a?d.slice(0,a):d}}function f(e,t){for(var n=0;n<e.length;n+=1)if(t(e[n]))return n;return-1}var v=d(),g=5,h=function(e){var t;return null!==e.current&&(null==(t=e.current.parentElement)?void 0:t.contains(document.activeElement))};function m(e){var t,n=e.unstable_isActiveElementInListbox,s=void 0===n?h:n,d=e.unstable_classNamePrefix,m=void 0===d?"Mui":d,b=e.autoComplete,Z=void 0!==b&&b,x=e.autoHighlight,y=void 0!==x&&x,O=e.autoSelect,I=void 0!==O&&O,S=e.blurOnSelect,P=void 0!==S&&S,C=e.clearOnBlur,k=void 0===C?!e.freeSolo:C,w=e.clearOnEscape,L=void 0!==w&&w,A=e.componentName,T=void 0===A?"useAutocomplete":A,R=e.defaultValue,N=void 0===R?e.multiple?[]:null:R,M=e.disableClearable,D=void 0!==M&&M,z=e.disableCloseOnSelect,E=void 0!==z&&z,F=e.disabled,H=e.disabledItemsFocusable,W=void 0!==H&&H,j=e.disableListWrap,V=void 0!==j&&j,B=e.filterOptions,q=void 0===B?v:B,G=e.filterSelectedOptions,K=void 0!==G&&G,U=e.freeSolo,_=void 0!==U&&U,J=e.getOptionDisabled,Q=e.getOptionLabel,X=void 0===Q?function(e){var t;return null!=(t=e.label)?t:e}:Q,Y=e.groupBy,$=e.handleHomeEndKeys,ee=void 0===$?!e.freeSolo:$,te=e.id,ne=e.includeInputInList,oe=void 0!==ne&&ne,re=e.inputValue,ae=e.isOptionEqualToValue,ie=void 0===ae?function(e,t){return e===t}:ae,le=e.multiple,ce=void 0!==le&&le,ue=e.onChange,pe=e.onClose,se=e.onHighlightChange,de=e.onInputChange,fe=e.onOpen,ve=e.open,ge=e.openOnFocus,he=void 0!==ge&&ge,me=e.options,be=e.readOnly,Ze=void 0!==be&&be,xe=e.selectOnFocus,ye=void 0===xe?!e.freeSolo:xe,Oe=e.value,Ie=(0,i.Z)(te);t=function(e){var t=X(e);return"string"!==typeof t?String(t):t};var Se=a.useRef(!1),Pe=a.useRef(!0),Ce=a.useRef(null),ke=a.useRef(null),we=a.useState(null),Le=(0,o.Z)(we,2),Ae=Le[0],Te=Le[1],Re=a.useState(-1),Ne=(0,o.Z)(Re,2),Me=Ne[0],De=Ne[1],ze=y?0:-1,Ee=a.useRef(ze),Fe=(0,l.Z)({controlled:Oe,default:N,name:T}),He=(0,o.Z)(Fe,2),We=He[0],je=He[1],Ve=(0,l.Z)({controlled:re,default:"",name:T,state:"inputValue"}),Be=(0,o.Z)(Ve,2),qe=Be[0],Ge=Be[1],Ke=a.useState(!1),Ue=(0,o.Z)(Ke,2),_e=Ue[0],Je=Ue[1],Qe=a.useCallback((function(e,n){if((ce?We.length<n.length:null!==n)||k){var o;if(ce)o="";else if(null==n)o="";else{var r=t(n);o="string"===typeof r?r:""}qe!==o&&(Ge(o),de&&de(e,o,"reset"))}}),[t,qe,ce,de,Ge,k,We]),Xe=(0,l.Z)({controlled:ve,default:!1,name:T,state:"open"}),Ye=(0,o.Z)(Xe,2),$e=Ye[0],et=Ye[1],tt=a.useState(!0),nt=(0,o.Z)(tt,2),ot=nt[0],rt=nt[1],at=!ce&&null!=We&&qe===t(We),it=$e&&!Ze,lt=it?q(me.filter((function(e){return!K||!(ce?We:[We]).some((function(t){return null!==t&&ie(e,t)}))})),{inputValue:at&&ot?"":qe,getOptionLabel:t}):[],ct=(0,c.Z)({filteredOptions:lt,value:We,inputValue:qe});a.useEffect((function(){var e=We!==ct.value;_e&&!e||_&&!e||Qe(null,We)}),[We,Qe,_e,ct.value,_]);var ut=$e&&lt.length>0&&!Ze,pt=(0,u.Z)((function(e){-1===e?Ce.current.focus():Ae.querySelector('[data-tag-index="'.concat(e,'"]')).focus()}));a.useEffect((function(){ce&&Me>We.length-1&&(De(-1),pt(-1))}),[We,ce,Me,pt]);var st=(0,u.Z)((function(e){var t=e.event,n=e.index,o=e.reason,r=void 0===o?"auto":o;if(Ee.current=n,-1===n?Ce.current.removeAttribute("aria-activedescendant"):Ce.current.setAttribute("aria-activedescendant","".concat(Ie,"-option-").concat(n)),se&&se(t,-1===n?null:lt[n],r),ke.current){var a=ke.current.querySelector('[role="option"].'.concat(m,"-focused"));a&&(a.classList.remove("".concat(m,"-focused")),a.classList.remove("".concat(m,"-focusVisible")));var i=ke.current;if("listbox"!==ke.current.getAttribute("role")&&(i=ke.current.parentElement.querySelector('[role="listbox"]')),i)if(-1!==n){var l=ke.current.querySelector('[data-option-index="'.concat(n,'"]'));if(l&&(l.classList.add("".concat(m,"-focused")),"keyboard"===r&&l.classList.add("".concat(m,"-focusVisible")),i.scrollHeight>i.clientHeight&&"mouse"!==r&&"touch"!==r)){var c=l,u=i.clientHeight+i.scrollTop,p=c.offsetTop+c.offsetHeight;p>u?i.scrollTop=p-i.clientHeight:c.offsetTop-c.offsetHeight*(Y?1.3:0)<i.scrollTop&&(i.scrollTop=c.offsetTop-c.offsetHeight*(Y?1.3:0))}}else i.scrollTop=0}})),dt=(0,u.Z)((function(e){var n=e.event,o=e.diff,r=e.direction,a=void 0===r?"next":r,i=e.reason,l=void 0===i?"auto":i;if(it){var c=function(e,t){if(!ke.current||e<0||e>=lt.length)return-1;for(var n=e;;){var o=ke.current.querySelector('[data-option-index="'.concat(n,'"]')),r=!W&&(!o||o.disabled||"true"===o.getAttribute("aria-disabled"));if(o&&o.hasAttribute("tabindex")&&!r)return n;if((n="next"===t?(n+1)%lt.length:(n-1+lt.length)%lt.length)===e)return-1}}(function(){var e=lt.length-1;if("reset"===o)return ze;if("start"===o)return 0;if("end"===o)return e;var t=Ee.current+o;return t<0?-1===t&&oe?-1:V&&-1!==Ee.current||Math.abs(o)>1?0:e:t>e?t===e+1&&oe?-1:V||Math.abs(o)>1?e:0:t}(),a);if(st({index:c,reason:l,event:n}),Z&&"reset"!==o)if(-1===c)Ce.current.value=qe;else{var u=t(lt[c]);Ce.current.value=u,0===u.toLowerCase().indexOf(qe.toLowerCase())&&qe.length>0&&Ce.current.setSelectionRange(qe.length,u.length)}}})),ft=a.useCallback((function(){if(it&&!function(){var e,n;if(-1!==Ee.current&&ct.filteredOptions&&ct.filteredOptions.length!==lt.length&&ct.inputValue===qe&&(ce?We.length===ct.value.length&&ct.value.every((function(e,n){return t(We[n])===t(e)})):(e=ct.value,n=We,(e?t(e):"")===(n?t(n):"")))){var o=ct.filteredOptions[Ee.current];if(o&&lt.some((function(e){return t(e)===t(o)})))return!0}return!1}()){var e=ce?We[0]:We;if(0!==lt.length&&null!=e){if(ke.current)if(null==e)Ee.current>=lt.length-1?st({index:lt.length-1}):st({index:Ee.current});else{var n=lt[Ee.current];if(ce&&n&&-1!==f(We,(function(e){return ie(n,e)})))return;var o=f(lt,(function(t){return ie(t,e)}));-1===o?dt({diff:"reset"}):st({index:o})}}else dt({diff:"reset"})}}),[lt.length,!ce&&We,K,dt,st,it,qe,ce]),vt=(0,u.Z)((function(e){(0,p.Z)(ke,e),e&&ft()}));a.useEffect((function(){ft()}),[ft]);var gt=function(e){$e||(et(!0),rt(!0),fe&&fe(e))},ht=function(e,t){$e&&(et(!1),pe&&pe(e,t))},mt=function(e,t,n,o){if(ce){if(We.length===t.length&&We.every((function(e,n){return e===t[n]})))return}else if(We===t)return;ue&&ue(e,t,n,o),je(t)},bt=a.useRef(!1),Zt=function(e,t){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"options",o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"selectOption",r=t;if(ce){var a=f(r=Array.isArray(We)?We.slice():[],(function(e){return ie(t,e)}));-1===a?r.push(t):"freeSolo"!==n&&(r.splice(a,1),o="removeOption")}Qe(e,r),mt(e,r,o,{option:t}),E||e&&(e.ctrlKey||e.metaKey)||ht(e,o),(!0===P||"touch"===P&&bt.current||"mouse"===P&&!bt.current)&&Ce.current.blur()};var xt=function(e,t){if(ce){""===qe&&ht(e,"toggleInput");var n=Me;-1===Me?""===qe&&"previous"===t&&(n=We.length-1):((n+="next"===t?1:-1)<0&&(n=0),n===We.length&&(n=-1)),n=function(e,t){if(-1===e)return-1;for(var n=e;;){if("next"===t&&n===We.length||"previous"===t&&-1===n)return-1;var o=Ae.querySelector('[data-tag-index="'.concat(n,'"]'));if(o&&o.hasAttribute("tabindex")&&!o.disabled&&"true"!==o.getAttribute("aria-disabled"))return n;n+="next"===t?1:-1}}(n,t),De(n),pt(n)}},yt=function(e){Se.current=!0,Ge(""),de&&de(e,"","clear"),mt(e,ce?[]:null,"clear")},Ot=function(e){return function(t){if(e.onKeyDown&&e.onKeyDown(t),!t.defaultMuiPrevented&&(-1!==Me&&-1===["ArrowLeft","ArrowRight"].indexOf(t.key)&&(De(-1),pt(-1)),229!==t.which))switch(t.key){case"Home":it&&ee&&(t.preventDefault(),dt({diff:"start",direction:"next",reason:"keyboard",event:t}));break;case"End":it&&ee&&(t.preventDefault(),dt({diff:"end",direction:"previous",reason:"keyboard",event:t}));break;case"PageUp":t.preventDefault(),dt({diff:-g,direction:"previous",reason:"keyboard",event:t}),gt(t);break;case"PageDown":t.preventDefault(),dt({diff:g,direction:"next",reason:"keyboard",event:t}),gt(t);break;case"ArrowDown":t.preventDefault(),dt({diff:1,direction:"next",reason:"keyboard",event:t}),gt(t);break;case"ArrowUp":t.preventDefault(),dt({diff:-1,direction:"previous",reason:"keyboard",event:t}),gt(t);break;case"ArrowLeft":xt(t,"previous");break;case"ArrowRight":xt(t,"next");break;case"Enter":if(-1!==Ee.current&&it){var n=lt[Ee.current],o=!!J&&J(n);if(t.preventDefault(),o)return;Zt(t,n,"selectOption"),Z&&Ce.current.setSelectionRange(Ce.current.value.length,Ce.current.value.length)}else _&&""!==qe&&!1===at&&(ce&&t.preventDefault(),Zt(t,qe,"createOption","freeSolo"));break;case"Escape":it?(t.preventDefault(),t.stopPropagation(),ht(t,"escape")):L&&(""!==qe||ce&&We.length>0)&&(t.preventDefault(),t.stopPropagation(),yt(t));break;case"Backspace":if(ce&&!Ze&&""===qe&&We.length>0){var r=-1===Me?We.length-1:Me,a=We.slice();a.splice(r,1),mt(t,a,"removeOption",{option:We[r]})}break;case"Delete":if(ce&&!Ze&&""===qe&&We.length>0&&-1!==Me){var i=Me,l=We.slice();l.splice(i,1),mt(t,l,"removeOption",{option:We[i]})}}}},It=function(e){Je(!0),he&&!Se.current&&gt(e)},St=function(e){s(ke)?Ce.current.focus():(Je(!1),Pe.current=!0,Se.current=!1,I&&-1!==Ee.current&&it?Zt(e,lt[Ee.current],"blur"):I&&_&&""!==qe?Zt(e,qe,"blur","freeSolo"):k&&Qe(e,We),ht(e,"blur"))},Pt=function(e){var t=e.target.value;qe!==t&&(Ge(t),rt(!1),de&&de(e,t,"input")),""===t?D||ce||mt(e,null,"clear"):gt(e)},Ct=function(e){var t=Number(e.currentTarget.getAttribute("data-option-index"));Ee.current!==t&&st({event:e,index:t,reason:"mouse"})},kt=function(e){st({event:e,index:Number(e.currentTarget.getAttribute("data-option-index")),reason:"touch"}),bt.current=!0},wt=function(e){var t=Number(e.currentTarget.getAttribute("data-option-index"));Zt(e,lt[t],"selectOption"),bt.current=!1},Lt=function(e){return function(t){var n=We.slice();n.splice(e,1),mt(t,n,"removeOption",{option:We[e]})}},At=function(e){$e?ht(e,"toggleInput"):gt(e)},Tt=function(e){e.currentTarget.contains(e.target)&&e.target.getAttribute("id")!==Ie&&e.preventDefault()},Rt=function(e){e.currentTarget.contains(e.target)&&(Ce.current.focus(),ye&&Pe.current&&Ce.current.selectionEnd-Ce.current.selectionStart===0&&Ce.current.select(),Pe.current=!1)},Nt=function(e){F||""!==qe&&$e||At(e)},Mt=_&&qe.length>0;Mt=Mt||(ce?We.length>0:null!==We);var Dt=lt;if(Y){new Map;Dt=lt.reduce((function(e,t,n){var o=Y(t);return e.length>0&&e[e.length-1].group===o?e[e.length-1].options.push(t):e.push({key:n,index:n,group:o,options:[t]}),e}),[])}return F&&_e&&St(),{getRootProps:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return(0,r.Z)({"aria-owns":ut?"".concat(Ie,"-listbox"):null},e,{onKeyDown:Ot(e),onMouseDown:Tt,onClick:Rt})},getInputLabelProps:function(){return{id:"".concat(Ie,"-label"),htmlFor:Ie}},getInputProps:function(){return{id:Ie,value:qe,onBlur:St,onFocus:It,onChange:Pt,onMouseDown:Nt,"aria-activedescendant":it?"":null,"aria-autocomplete":Z?"both":"list","aria-controls":ut?"".concat(Ie,"-listbox"):void 0,"aria-expanded":ut,autoComplete:"off",ref:Ce,autoCapitalize:"none",spellCheck:"false",role:"combobox",disabled:F}},getClearProps:function(){return{tabIndex:-1,type:"button",onClick:yt}},getPopupIndicatorProps:function(){return{tabIndex:-1,type:"button",onClick:At}},getTagProps:function(e){var t=e.index;return(0,r.Z)({key:t,"data-tag-index":t,tabIndex:-1},!Ze&&{onDelete:Lt(t)})},getListboxProps:function(){return{role:"listbox",id:"".concat(Ie,"-listbox"),"aria-labelledby":"".concat(Ie,"-label"),ref:vt,onMouseDown:function(e){e.preventDefault()}}},getOptionProps:function(e){var n=e.index,o=e.option,r=(ce?We:[We]).some((function(e){return null!=e&&ie(o,e)})),a=!!J&&J(o);return{key:t(o),tabIndex:-1,role:"option",id:"".concat(Ie,"-option-").concat(n),onMouseMove:Ct,onClick:wt,onTouchStart:kt,"data-option-index":n,"aria-disabled":a,"aria-selected":r}},id:Ie,inputValue:qe,value:We,dirty:Mt,expanded:it&&Ae,popupOpen:it,focused:_e||-1!==Me,anchorEl:Ae,setAnchorEl:Te,focusedTag:Me,groupedOptions:Dt}}}}]);
@@ -1 +1 @@
1
- "use strict";(self.webpackChunk_abtnode_webapp=self.webpackChunk_abtnode_webapp||[]).push([[6511],{86511:function(e,n,t){t.r(n),t.d(n,{default:function(){return re}});var r=t(71171),a=t(5057),i=t(33518),o=t(85493),c=t(15849),u=t(68420),s=t(11750),l=t(39434),p=t(39948),d=t(10697),f=t(94464),v=t(88574),m=t(28726),h=t(38242),b=t(81010),x=t(87363),g=(t(68534),t(86229)),k=t(1722),Z=t(96234),y=t(35432),w=t(49983),j=t(58238),P=t(29054),B=t(73545),S=t(14491),L=t(4651),D=t(96266),E=function(e){var n={},t=null;return(0,h.forEachBlockletSync)(e,(function(e){n[e.meta.bundleDid]?t=(0,h.getDisplayName)(e,!0):e.meta.bundleDid&&(n[e.meta.bundleDid]=!0)})),t},_=function(e,n,t){var r=e.hostname,a=e.href;if(!n)return a;if(t){var i,o=/\d+[-.]\d+[-.]\d+[-.]\d+/.exec(r);if(!o)return a;var c=o[0],u=(((null===(i=n.site)||void 0===i?void 0:i.domainAliases)||[]).map((function(e){return e.value})).filter(Boolean).find((function(e){return e.endsWith(y.DEFAULT_DID_DOMAIN)}))||"").replace(".".concat(y.DEFAULT_DID_DOMAIN),"");return u?a.replace(r,"".concat(u,"-").concat(c,".").concat(y.DEFAULT_IP_DOMAIN_SUFFIX)):a}return a.replace(n.meta.bundleDid,n.appPid)};function C(){var e=(0,u.PE)().t,n=(0,B.T)().api,t=(0,P.y0)().blocklet,r=(0,j.h6)().inService,i=(0,a.useState)(!1),o=(0,Z.Z)(i,2),c=o[0],s=o[1],l=(0,a.useState)(5),d=(0,Z.Z)(l,2),f=d[0],b=d[1],x=t&&t.structVersion!==y.APP_STRUCT_VERSION;return[x&&(0,D.jsxs)(v.Z,{type:"warning",style:{margin:"12px 0"},children:[(0,D.jsxs)(p.Z,{display:"flex",alignItems:"center",children:[(0,D.jsx)(m.Z,{variant:"contained",size:"small",color:"primary",onClick:function(){return function(){try{if("running"===t.status)return void g.Z.error(e("blocklet.migrate.tip.running"));var n=E(t);if(n)return void g.Z.error(e("blocklet.migrate.tip.duplicate",{name:n}));s(!0)}catch(r){g.Z.error((0,S.Z)(r))}}()},style:{marginRight:8},children:e("blocklet.migrate.intro.l1")}),(0,D.jsx)("span",{children:e("blocklet.migrate.intro.l2")})]}),["l3","l4","l5","l6"].map((function(n){return(0,D.jsx)(p.Z,{display:"flex",alignItems:"center",children:e("blocklet.migrate.intro.".concat(n))},n)}))]},"alert"),t&&(0,D.jsx)(w.Z,{popup:!0,open:c,saveConnect:!1,forceConnected:!1,action:"migrate-app-to-struct-v2",checkFn:n.get,checkTimeout:3e5,onSuccess:function(){var e=_(window.location,t,r);setTimeout((function(){window.location.href=e}),5e3),b(5),setInterval((function(){b((function(e){return e-1}))}),1e3)},extraParams:{appDid:t.appDid,did:t.meta.did,wt:(0,L.iK)(t,!0),title:(0,h.getDisplayName)(t)},messages:{title:e("blocklet.migrate.title"),scan:e("blocklet.migrate.scan"),confirm:e("blocklet.migrate.confirm"),success:f>=0?e("blocklet.migrate.success",{sec:f}):"Redirecting..."},onClose:function(){return s(!1)}},"connect")]}C.propTypes={};var N,G=t(35966),A=t(43019),I=t(44846),T=t(78123),O=t(75793),U=t(17022),z=t(13671),K=t(74094),R=t(7199),F=(0,a.lazy)((function(){return Promise.all([t.e(7718),t.e(7020),t.e(999),t.e(9277)]).then(t.bind(t,99277))})),M=(0,a.lazy)((function(){return Promise.all([t.e(7718),t.e(7020),t.e(8537),t.e(105),t.e(2294),t.e(95),t.e(6547),t.e(5760),t.e(506),t.e(7150),t.e(6791),t.e(8499),t.e(4404),t.e(8973)]).then(t.bind(t,5119))})),V=(0,a.lazy)((function(){return Promise.all([t.e(7718),t.e(7020),t.e(105),t.e(6547),t.e(506),t.e(5953),t.e(1294),t.e(2311),t.e(4775)]).then(t.bind(t,14775))})),$=(0,a.lazy)((function(){return Promise.all([t.e(7718),t.e(442),t.e(9662),t.e(7676),t.e(8986)]).then(t.bind(t,13239))})),X=(0,a.lazy)((function(){return Promise.all([t.e(7718),t.e(7020),t.e(1237),t.e(2305),t.e(5979),t.e(2537)]).then(t.bind(t,75979))})),Y=(0,a.lazy)((function(){return Promise.all([t.e(7718),t.e(7020),t.e(8537),t.e(105),t.e(2294),t.e(95),t.e(6547),t.e(5760),t.e(1494),t.e(5672),t.e(3216)]).then(t.bind(t,75672))})),W=(0,a.lazy)((function(){return Promise.all([t.e(7718),t.e(7020),t.e(8537),t.e(105),t.e(2294),t.e(95),t.e(4901),t.e(1685),t.e(5555)]).then(t.bind(t,85555))})),q=(0,a.lazy)((function(){return Promise.all([t.e(7718),t.e(7020),t.e(8537),t.e(105),t.e(2294),t.e(95),t.e(2911),t.e(4901),t.e(442),t.e(5526),t.e(1237),t.e(7638),t.e(1685),t.e(7657),t.e(5953),t.e(3135),t.e(6783),t.e(4404),t.e(2264),t.e(1037)]).then(t.bind(t,81037))})),J=(0,a.lazy)((function(){return Promise.all([t.e(7718),t.e(9327),t.e(8219)]).then(t.bind(t,92379))})),Q=(0,a.lazy)((function(){return Promise.all([t.e(7718),t.e(7020),t.e(8537),t.e(105),t.e(2294),t.e(95),t.e(6547),t.e(5760),t.e(7534)]).then(t.bind(t,87534))})),H=(0,a.lazy)((function(){return Promise.all([t.e(7718),t.e(7020),t.e(4901),t.e(3896),t.e(2611)]).then(t.bind(t,42611))})),ee=(0,a.lazy)((function(){return Promise.all([t.e(7718),t.e(7020),t.e(8537),t.e(105),t.e(2294),t.e(95),t.e(6547),t.e(5760),t.e(9354),t.e(4650)]).then(t.bind(t,34650))})),ne=function(e){return e.children};function te(){var e,n=(0,o.useNavigate)(),t=(0,o.useParams)().tab,r=void 0===t?"overview":t,i=(0,z.y0)(),Z=i.did,w=i.blocklet,j=i.error,P=i.client,B=i.actions,S=B.setBlocklet,L=B.refreshBlocklet,E=(0,O.h6)().refresh,_=(0,u.PE)().t,N=(0,a.useCallback)((function(){return(0,D.jsx)($,{scope:Z})}),[Z]),A=(null===w||void 0===w||null===(e=w.environments.find((function(e){return"BLOCKLET_APP_URL"===e.key})))||void 0===e?void 0:e.value)||window.location.origin,te=function(e){return(0,K.bV)(e,A)},re=function(e){n("/blocklets/".concat(Z,"/").concat(e))},ie=!w||(0,K.wS)(w.status)?[]:(0,h.getAppMissingConfigs)(w),oe=null,ce=[{label:_("common.overview"),value:"overview"},{breadcrumbsLabel:_("common.components"),label:(0,D.jsx)(d.Z,{color:"error",variant:"dot",invisible:!ie.length,children:_("common.components")}),value:"components"}];if(j)oe=(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(v.Z,{type:"error",variant:"icon",children:(0,K.Z)(j)}),(0,D.jsx)(m.Z,{onClick:function(){return L()},children:(0,D.jsx)("span",{style:{textDecoration:"underline"},children:_("common.retry")})})]});else if(w){var ue,se={overview:(0,D.jsx)(F,{}),configuration:M,navigation:V,services:W,members:(0,D.jsx)(Y,{type:"blocklet",createPassportSvg:te}),passports:X,components:q,"audit-logs":N,logs:J,runtime:(0,D.jsx)(Q,{}),traffic:(0,D.jsx)(H,{client:P,did:Z}),storage:(0,D.jsx)(ee,{})};"configuration"===r&&(0,K.wS)(w.status)&&re("overview"),(0,K.wS)(w.status)||(ce.push({label:_("common.members"),value:"members"}),ce.push({label:_("common.passport"),value:"passports"}),ce.push({label:_("common.configuration"),value:"configuration"})),ce.push({label:_("common.auditLogs"),value:"audit-logs"}),w&&null!==(ue=w.children)&&void 0!==ue&&ue.length&&w.structVersion===y.APP_STRUCT_VERSION&&ce.push({label:_("common.logs"),value:"logs"}),ce.push({label:_("common.configNavigation"),value:"navigation"}),ce.push({label:_("common.runtime"),value:"runtime"}),ce.push({label:_("common.traffic"),value:"traffic"}),ce.push({label:_("common.storage"),value:"storage"}),(0,h.getBlockletServices)(w).length&&ce.splice(2,0,{label:_("blocklet.services"),value:"services"});var le=se[r]||se.overview;oe=(0,D.jsxs)(x.g,{type:"components",children:[!(0,h.isExternalBlocklet)(w)&&(0,D.jsx)(f.Z,{tabs:ce,current:r,onChange:re,scrollButtons:"auto"}),(0,D.jsx)("div",{className:"page-content",children:(0,D.jsx)(a.Suspense,{fallback:(0,D.jsx)(G.Z,{relative:"parent",children:(0,D.jsx)(I.Z,{})}),children:(0,a.isValidElement)(le)?le:(0,D.jsx)(le,{blocklet:w,onUpdate:function(e){e&&S(e),L()},createPassportSvg:te})})})]})}else oe=(0,D.jsx)(G.Z,{relative:"parent",children:(0,D.jsx)(I.Z,{})});var pe=ce.find((function(e){return e.value===r})),de=w?U.G6:ne;return(0,D.jsx)(de,{teamDid:Z,children:(0,D.jsxs)(ae,{children:[(0,D.jsxs)(l.Z,{separator:"\u203a","aria-label":"breadcrumb",className:"page-breadcrumb",children:[(0,D.jsx)(c.Link,{color:"textSecondary",to:"/blocklets",children:_("common.blocklets")}),(0,D.jsx)(c.NavLink,{to:"/blocklets/".concat(Z,"/overview"),style:function(e){return e?{color:"inherit"}:{}},children:_("common.detail")}),(0,D.jsx)(s.Z,{color:"textSecondary",children:pe?pe.breadcrumbsLabel||pe.label:""})]}),(0,D.jsxs)(s.Z,{component:"div",className:"page-header",children:[(0,D.jsxs)(s.Z,{component:"h2",variant:"h4",className:"page-title",color:"textPrimary",children:[w?(0,D.jsx)(k.Z,{blocklet:w,style:{marginRight:16}}):null,w?(0,D.jsxs)(p.Z,{display:"flex",alignItems:"center",children:[(0,D.jsx)(p.Z,{children:(0,h.getDisplayName)(w)}),"unknown"!==(null===w||void 0===w?void 0:w.status)&&(0,D.jsx)(b.Z,{size:"12px",style:{marginLeft:8},status:w.status,source:w.source})]}):"".concat(_("common.blocklet")," ").concat(_("common.detail"))]}),(0,D.jsx)(R.Z,{permission:"mutate_blocklets",children:!!w&&!(0,h.isExternalBlocklet)(w)&&(0,D.jsx)(T.Z,{className:"page-actions",blocklet:w,onStart:function(){},onComplete:function(e){var t=e.action,r=e.error;r?g.Z.error(r.message):"remove"===t?(E(),n("/blocklets")):L()},variant:"group"})})]}),(0,D.jsx)(C,{}),oe]})})}function re(){var e=(0,o.useParams)().did;return e?(0,D.jsx)(z.$8,{did:e,children:(0,D.jsx)(A.wV,{children:(0,D.jsx)(te,{})})}):null}var ae=i.Z.main(N||(N=(0,r.Z)(["\n .page-header {\n display: flex;\n justify-content: space-between;\n align-items: center;\n }\n\n .page-title {\n display: flex;\n align-items: center;\n\n .page-link {\n font-size: 15px;\n margin-top: 8px;\n margin-left: 8px;\n }\n }\n\n .page-content {\n margin-top: 16px;\n }\n\n @media (max-width: ","px) {\n .page-header {\n flex-direction: column;\n align-items: flex-start;\n .page-actions,\n .MuiButtonGroup-root {\n width: 100%;\n }\n .MuiButtonGroup-root {\n .MuiButtonBase-root {\n flex: 1;\n }\n .blocklet-action-text {\n display: none;\n }\n }\n }\n\n .page-title {\n margin-bottom: 15px;\n }\n }\n"])),(function(e){return e.theme.breakpoints.values.md}))},43019:function(e,n,t){t.d(n,{wV:function(){return S},XN:function(){return L}});var r=t(32723),a=t(33028),i=t(34795),o=t(96234),c=t(5057),u=t(55898),s=t.n(u),l=t(86229),p=t(68420),d=t(76811),f=t(29054),v=t(84584),m=t(41899),h=t(58238),b=t(65873);function x(e){return g.apply(this,arguments)}function g(){return g=(0,i.Z)((0,r.Z)().mark((function e(n){var t,o,c,u,s;return(0,r.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=n.blockletDid,o=n.nodeApi,c=n.spaceGateways,u=!1,e.next=4,Promise.all(c.map(function(){var e=(0,i.Z)((0,r.Z)().mark((function e(n){var t,i;return(0,r.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=n.name,e.next=3,(0,v.nU)(n.endpoint);case 3:return i=e.sent,(0,b.isEmpty)(i)||i===t||(t=i,u=!0),e.abrupt("return",(0,a.Z)((0,a.Z)({},n),{},{name:t}));case 6:case"end":return e.stop()}}),e)})));return function(n){return e.apply(this,arguments)}}()));case 4:if(s=e.sent,!u){e.next=8;break}return e.next=8,Promise.all(s.filter((function(e){return e.did})).map((function(e){return o.updateBlockletSpaceGateway({input:{did:t,where:{did:e.did},spaceGateway:(0,a.Z)({},e)}})})));case 8:return e.abrupt("return",s);case 9:case"end":return e.stop()}}),e)}))),g.apply(this,arguments)}var k=t(99875);var Z=t(14491);function y(){var e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{deps:[],setLoading:function(){}},t=n.deps,a=n.setLoading,u=(0,f.y0)().blocklet,s=(0,c.useState)([]),p=(0,o.Z)(s,2),d=p[0],v=p[1],x=(0,h.h6)().api,g=(0,b.debounce)((0,i.Z)((0,r.Z)().mark((function e(){var n,t;return(0,r.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,a(!0),u){e.next=5;break}return v([]),e.abrupt("return");case 5:return e.next=7,x.getBlockletBackups({input:{did:u.meta.did}});case 7:n=e.sent,t=n.backups,v(null!==t&&void 0!==t?t:[]),e.next=16;break;case 12:e.prev=12,e.t0=e.catch(0),console.error(e.t0),l.Z.error((0,Z.Z)(e.t0));case 16:return e.prev=16,a(!1),e.finish(16);case 19:case"end":return e.stop()}}),e,null,[[0,12,16,19]])}))),2e3);return(0,m.Z)((0,i.Z)((0,r.Z)().mark((function e(){return(0,r.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:g();case 1:case"end":return e.stop()}}),e)}))),[null===u||void 0===u||null===(e=u.meta)||void 0===e?void 0:e.did].concat(t)),{backups:d}}var w=function(e){var n=e.appDid,t=y().backups,r=(0,c.useState)({message:"",progress:0,completed:!1}),i=(0,o.Z)(r,2),u=i[0],s=i[1];return(0,(0,h.h6)().ws.useSubscription)(d.BlockletEvents.backupProgress,(function(e){n===(null===e||void 0===e?void 0:e.appDid)&&s((function(){return(0,a.Z)({},e)}))}),[n]),(0,c.useEffect)((function(){var e;if(null!==t&&void 0!==t&&t.length&&(0,b.isNull)(null===(e=t[0])||void 0===e?void 0:e.status)){var n=(0,o.Z)(t,1)[0];s((function(){return{message:n.message,progress:n.progress,completed:Boolean(n.progress>=100)}}))}}),[t]),u};var j=t(96266),P=(0,c.createContext)({}),B=P.Provider;P.Consumer;function S(e){var n=e.children,t=(0,p.PE)().t,u=(0,h.h6)().api,s=(0,f.y0)().blocklet,b=(0,c.useState)(!1),g=(0,o.Z)(b,2),Z=g[0],P=g[1],S=(0,c.useState)(!1),L=(0,o.Z)(S,2),D=L[0],E=L[1],_=function(){var e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=n.setLoading,a=n.refresh,u=(0,f.y0)(),s=u.blocklet,p=u.actions.refreshBlocklet,d=null===s||void 0===s||null===(e=s.meta)||void 0===e?void 0:e.did,v=(0,c.useState)([]),b=(0,o.Z)(v,2),g=b[0],Z=b[1],y=(0,h.h6)().api;return(0,m.Z)((0,i.Z)((0,r.Z)().mark((function e(){var n,a,i;return(0,r.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,d){e.next=4;break}return Z([]),e.abrupt("return");case 4:return null===t||void 0===t||t(!0),e.next=7,y.getBlockletSpaceGateways({input:{did:d}});case 7:return n=e.sent,a=n.spaceGateways,e.next=11,x({blockletDid:d,nodeApi:y,spaceGateways:a});case 11:i=e.sent,Z(null!==i&&void 0!==i?i:[]),e.next=19;break;case 15:e.prev=15,e.t0=e.catch(0),console.error(e.t0),l.Z.error((0,k.Z)(e.t0));case 19:return e.prev=19,null===t||void 0===t||t(!1),e.finish(19);case 22:case"end":return e.stop()}}),e,null,[[0,15,19,22]])}))),[d,p,a]),{spaceGateways:g}}({refresh:D,setLoading:P}),C=_.spaceGateways,N=w({appDid:null===s||void 0===s?void 0:s.appDid}),G=(0,c.useState)(!1),A=(0,o.Z)(G,2),I=A[0],T=A[1],O=(0,c.useMemo)((function(){return(0,v.mo)(null===s||void 0===s?void 0:s.environments)}),[s,D,I]),U=(0,c.useState)(!1),z=(0,o.Z)(U,2),K=z[0],R=y({deps:[N],setLoading:z[1]}).backups,F=(0,c.useState)(null===C||void 0===C?void 0:C.find((function(e){return e.endpoint===O}))),M=(0,o.Z)(F,2),V=M[0],$=M[1],X=(0,c.useState)(!1),Y=(0,o.Z)(X,2),W=Y[0],q=Y[1],J=function(){var e,n=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{deps:[]}).deps,t=(0,f.y0)().blocklet,a=(0,h.h6)().api,u=(0,c.useState)(null),s=(0,o.Z)(u,2),l=s[0],p=s[1];return(0,m.Z)((0,i.Z)((0,r.Z)().mark((function e(){var n,i,o;return(0,r.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null===t||void 0===t||null===(n=t.meta)||void 0===n||!n.did){e.next=6;break}return e.next=3,a.getAutoBackup({input:{did:t.meta.did}});case 3:i=e.sent,o=i.autoBackup,p(o);case 6:case"end":return e.stop()}}),e)}))),[null===t||void 0===t||null===(e=t.meta)||void 0===e?void 0:e.did].concat(n)),l}({deps:[W]}),Q=function(){var e=(0,i.Z)((0,r.Z)().mark((function e(n,t){return(0,r.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return C.push((0,a.Z)((0,a.Z)({},n),{},{loading:!0})),e.next=3,u.addBlockletSpaceGateway({input:{did:s.meta.did,spaceGateway:n}});case 3:if(O===t){e.next=6;break}return e.next=6,u.configBlocklet({input:{did:[s.meta.did],configs:[{key:d.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:t}]}});case 6:ne(),$(n);case 8:case"end":return e.stop()}}),e)})));return function(n,t){return e.apply(this,arguments)}}(),H=function(){var e=(0,i.Z)((0,r.Z)().mark((function e(n){return(0,r.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n){e.next=2;break}return e.abrupt("return");case 2:if(n.endpoint!==O){e.next=5;break}return l.Z.warning(t("storage.spaces.gateway.delete.failedForConnected")),e.abrupt("return");case 5:return e.next=7,u.deleteBlockletSpaceGateway({input:{did:s.meta.did,spaceGatewayDid:null===n||void 0===n?void 0:n.did}});case 7:ne(),$(n);case 9:case"end":return e.stop()}}),e)})));return function(n){return e.apply(this,arguments)}}(),ee=function(){var e=(0,i.Z)((0,r.Z)().mark((function e(n){var a;return(0,r.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,u.updateBlockletSpaceGateway({input:{did:s.meta.did,where:{did:n.did},spaceGateway:n}});case 2:if(O===n.endpoint){e.next=5;break}return e.next=5,u.configBlocklet({input:{did:[s.meta.did],configs:[{key:d.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:n.endpoint}]}});case 5:l.Z.success(t("storage.spaces.connectedWithName",{name:null!==(a=null===n||void 0===n?void 0:n.name)&&void 0!==a?a:"DID Spaces"})),ne();case 7:case"end":return e.stop()}}),e)})));return function(n){return e.apply(this,arguments)}}(),ne=function(){E((function(e){return!e}))},te=function(){var e=(0,i.Z)((0,r.Z)().mark((function e(n){return(0,r.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,u.updateAutoBackup({input:{did:s.meta.did,autoBackup:n}});case 2:re();case 3:case"end":return e.stop()}}),e)})));return function(n){return e.apply(this,arguments)}}(),re=function(){q((function(e){return!e}))};return(0,j.jsx)(B,{value:{spaceGateways:C,selectedSpaceGateway:V,addSpaceGateway:Q,deleteSpaceGateway:H,updateSpaceGateway:ee,refreshSpaceGateways:ne,spaceGatewaysLoading:Z,spaceGatewayIsSelected:function(e){return(null===e||void 0===e?void 0:e.endpoint)===O},updateAutoBackup:te,backupEndpoint:O,backupProgress:N,backups:R,backupsLoading:K,refreshBackupEndpoint:function(){T((function(e){return!e}))},autoBackup:J},children:n})}function L(){return(0,c.useContext)(P)}S.propTypes={children:s().any.isRequired},S.defaultProps={}},60344:function(e,n,t){t.d(n,{hi:function(){return i},od:function(){return a.a}});var r=t(10458),a=t.n(r);a().defaults.timeout=1e4;var i=a().create()},84584:function(e,n,t){t.d(n,{Jf:function(){return y},LQ:function(){return f},Nb:function(){return v},Xv:function(){return p},ag:function(){return b},mo:function(){return h},nD:function(){return d},nU:function(){return k},w2:function(){return x}});var r=t(32723),a=t(34795),i=t(82434),o=t.n(i),c=t(76811),u=t(65873),s=t(2842),l=t(60344);function p(e){var n=e.replace(/\/api\/space\/.+/,""),t=e.replace(/\/$/,"").split("/"),r=t.at(-4),a=t.at(-2);return(0,s.xn)(n,"space",r,"apps",a,"explorer?key=/apps/".concat(a,"/.did-objects/").concat(a,"/"))}function d(e){var n=e.replace(/\/api\/space\/.+/,""),t=e.replace(/\/$/,"").split("/").at(-4);return(0,s.xn)(n,"space",t)}function f(e){return e.replace(/\/$/,"").split("/").at(-4)}function v(e){return m.apply(this,arguments)}function m(){return(m=(0,a.Z)((0,r.Z)().mark((function e(n){var t,a;return(0,r.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,o()(n)){e.next=3;break}return e.abrupt("return",!1);case 3:return e.next=5,l.hi.head(n,{timeout:5e3});case 5:return t=e.sent,a=t.headers,e.abrupt("return","true"===a["x-listable"]&&"true"===a["x-readable"]&&"true"===a["x-writeable"]);case 10:return e.prev=10,e.t0=e.catch(0),console.error(e.t0),e.abrupt("return",!1);case 14:case"end":return e.stop()}}),e,null,[[0,10]])})))).apply(this,arguments)}function h(e){var n;return(null===e||void 0===e||null===(n=e.find((function(e){return e.key===c.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT})))||void 0===n?void 0:n.value)||""}function b(e){var n=new URL(e);return(0,s.xn)(n.origin,n.pathname)}function x(e){return g.apply(this,arguments)}function g(){return(g=(0,a.Z)((0,r.Z)().mark((function e(n){var t,a,i,c,p;return(0,r.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,o()(n)){e.next=3;break}return e.abrupt("return",!1);case 3:return t=b(n),a=(0,s.xn)(t,"space/api/did/one-click-authorization/token"),e.next=7,l.hi.get(a,{timeout:5e3});case 7:return i=e.sent,c=i.status,p=i.data,e.abrupt("return",200===c&&(0,u.isObject)(p));case 13:return e.prev=13,e.t0=e.catch(0),console.error(e.t0),e.abrupt("return",!1);case 17:case"end":return e.stop()}}),e,null,[[0,13]])})))).apply(this,arguments)}function k(e){return Z.apply(this,arguments)}function Z(){return(Z=(0,a.Z)((0,r.Z)().mark((function e(n){var t,a,i;return(0,r.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,o()(n)){e.next=3;break}return e.abrupt("return","");case 3:return e.next=5,l.hi.head(n,{timeout:3e3});case 5:return t=e.sent,a=t.headers,i=a["x-space-name"],e.abrupt("return",i?decodeURIComponent(i):"");case 11:return e.prev=11,e.t0=e.catch(0),console.error(e.t0),e.abrupt("return","");case 15:case"end":return e.stop()}}),e,null,[[0,11]])})))).apply(this,arguments)}function y(e){var n=e.replace(/\/api\/space\/.+/,""),t=e.replace(/\/$/,"").split("/").at(-4);return(0,s.xn)(n,"/api/space/nft/display?spaceDid=".concat(t))}}}]);
1
+ "use strict";(self.webpackChunk_abtnode_webapp=self.webpackChunk_abtnode_webapp||[]).push([[6511],{86511:function(e,n,t){t.r(n),t.d(n,{default:function(){return re}});var r=t(71171),a=t(5057),i=t(33518),o=t(85493),c=t(15849),u=t(68420),s=t(11750),l=t(39434),p=t(39948),d=t(10697),f=t(94464),v=t(88574),m=t(28726),h=t(38242),b=t(81010),x=t(87363),g=(t(68534),t(86229)),k=t(1722),Z=t(96234),y=t(35432),w=t(49983),j=t(58238),P=t(29054),B=t(73545),S=t(14491),L=t(4651),D=t(96266),E=function(e){var n={},t=null;return(0,h.forEachBlockletSync)(e,(function(e){n[e.meta.bundleDid]?t=(0,h.getDisplayName)(e,!0):e.meta.bundleDid&&(n[e.meta.bundleDid]=!0)})),t},_=function(e,n,t){var r=e.hostname,a=e.href;if(!n)return a;if(t){var i,o=/\d+[-.]\d+[-.]\d+[-.]\d+/.exec(r);if(!o)return a;var c=o[0],u=(((null===(i=n.site)||void 0===i?void 0:i.domainAliases)||[]).map((function(e){return e.value})).filter(Boolean).find((function(e){return e.endsWith(y.DEFAULT_DID_DOMAIN)}))||"").replace(".".concat(y.DEFAULT_DID_DOMAIN),"");return u?a.replace(r,"".concat(u,"-").concat(c,".").concat(y.DEFAULT_IP_DOMAIN_SUFFIX)):a}return a.replace(n.meta.bundleDid,n.appPid)};function C(){var e=(0,u.PE)().t,n=(0,B.T)().api,t=(0,P.y0)().blocklet,r=(0,j.h6)().inService,i=(0,a.useState)(!1),o=(0,Z.Z)(i,2),c=o[0],s=o[1],l=(0,a.useState)(5),d=(0,Z.Z)(l,2),f=d[0],b=d[1],x=t&&t.structVersion!==y.APP_STRUCT_VERSION;return[x&&(0,D.jsxs)(v.Z,{type:"warning",style:{margin:"12px 0"},children:[(0,D.jsxs)(p.Z,{display:"flex",alignItems:"center",children:[(0,D.jsx)(m.Z,{variant:"contained",size:"small",color:"primary",onClick:function(){return function(){try{if("running"===t.status)return void g.Z.error(e("blocklet.migrate.tip.running"));var n=E(t);if(n)return void g.Z.error(e("blocklet.migrate.tip.duplicate",{name:n}));s(!0)}catch(r){g.Z.error((0,S.Z)(r))}}()},style:{marginRight:8},children:e("blocklet.migrate.intro.l1")}),(0,D.jsx)("span",{children:e("blocklet.migrate.intro.l2")})]}),["l3","l4","l5","l6"].map((function(n){return(0,D.jsx)(p.Z,{display:"flex",alignItems:"center",children:e("blocklet.migrate.intro.".concat(n))},n)}))]},"alert"),t&&(0,D.jsx)(w.Z,{popup:!0,open:c,saveConnect:!1,forceConnected:!1,action:"migrate-app-to-struct-v2",checkFn:n.get,checkTimeout:3e5,onSuccess:function(){var e=_(window.location,t,r);setTimeout((function(){window.location.href=e}),5e3),b(5),setInterval((function(){b((function(e){return e-1}))}),1e3)},extraParams:{appDid:t.appDid,did:t.meta.did,wt:(0,L.iK)(t,!0),title:(0,h.getDisplayName)(t)},messages:{title:e("blocklet.migrate.title"),scan:e("blocklet.migrate.scan"),confirm:e("blocklet.migrate.confirm"),success:f>=0?e("blocklet.migrate.success",{sec:f}):"Redirecting..."},onClose:function(){return s(!1)}},"connect")]}C.propTypes={};var N,G=t(35966),A=t(43019),I=t(44846),T=t(78123),O=t(75793),U=t(17022),z=t(13671),K=t(74094),R=t(7199),F=(0,a.lazy)((function(){return Promise.all([t.e(7718),t.e(7020),t.e(999),t.e(9277)]).then(t.bind(t,99277))})),M=(0,a.lazy)((function(){return Promise.all([t.e(7718),t.e(7020),t.e(8537),t.e(105),t.e(2294),t.e(95),t.e(6547),t.e(5760),t.e(506),t.e(7150),t.e(6791),t.e(8499),t.e(4404),t.e(8973)]).then(t.bind(t,5119))})),V=(0,a.lazy)((function(){return Promise.all([t.e(7718),t.e(7020),t.e(105),t.e(6547),t.e(506),t.e(5953),t.e(1294),t.e(2311),t.e(4775)]).then(t.bind(t,14775))})),$=(0,a.lazy)((function(){return Promise.all([t.e(7718),t.e(442),t.e(9662),t.e(7676),t.e(8986)]).then(t.bind(t,13239))})),X=(0,a.lazy)((function(){return Promise.all([t.e(7718),t.e(7020),t.e(1237),t.e(2305),t.e(5979),t.e(2537)]).then(t.bind(t,75979))})),Y=(0,a.lazy)((function(){return Promise.all([t.e(7718),t.e(7020),t.e(8537),t.e(105),t.e(2294),t.e(95),t.e(6547),t.e(5760),t.e(1494),t.e(5672),t.e(3216)]).then(t.bind(t,75672))})),W=(0,a.lazy)((function(){return Promise.all([t.e(7718),t.e(7020),t.e(8537),t.e(105),t.e(2294),t.e(95),t.e(4901),t.e(1685),t.e(5555)]).then(t.bind(t,85555))})),q=(0,a.lazy)((function(){return Promise.all([t.e(7718),t.e(7020),t.e(8537),t.e(105),t.e(2294),t.e(95),t.e(2911),t.e(4901),t.e(442),t.e(5526),t.e(1237),t.e(7638),t.e(1685),t.e(7657),t.e(5953),t.e(3135),t.e(6783),t.e(4404),t.e(2264),t.e(1037)]).then(t.bind(t,81037))})),J=(0,a.lazy)((function(){return Promise.all([t.e(7718),t.e(9327),t.e(8219)]).then(t.bind(t,92379))})),Q=(0,a.lazy)((function(){return Promise.all([t.e(7718),t.e(7020),t.e(8537),t.e(105),t.e(2294),t.e(95),t.e(6547),t.e(5760),t.e(7534)]).then(t.bind(t,87534))})),H=(0,a.lazy)((function(){return Promise.all([t.e(7718),t.e(7020),t.e(4901),t.e(3896),t.e(2611)]).then(t.bind(t,42611))})),ee=(0,a.lazy)((function(){return Promise.all([t.e(7718),t.e(7020),t.e(8537),t.e(105),t.e(2294),t.e(95),t.e(6547),t.e(5760),t.e(9354),t.e(4650)]).then(t.bind(t,34650))})),ne=function(e){return e.children};function te(){var e,n=(0,o.useNavigate)(),t=(0,o.useParams)().tab,r=void 0===t?"overview":t,i=(0,z.y0)(),Z=i.did,w=i.blocklet,j=i.error,P=i.client,B=i.actions,S=B.setBlocklet,L=B.refreshBlocklet,E=(0,O.h6)().refresh,_=(0,u.PE)().t,N=(0,a.useCallback)((function(){return(0,D.jsx)($,{scope:Z})}),[Z]),A=(null===w||void 0===w||null===(e=w.environments.find((function(e){return"BLOCKLET_APP_URL"===e.key})))||void 0===e?void 0:e.value)||window.location.origin,te=function(e){return(0,K.bV)(e,A)},re=function(e){n("/blocklets/".concat(Z,"/").concat(e))},ie=!w||(0,K.wS)(w.status)?[]:(0,h.getAppMissingConfigs)(w),oe=null,ce=[{label:_("common.overview"),value:"overview"},{breadcrumbsLabel:_("common.components"),label:(0,D.jsx)(d.Z,{color:"error",variant:"dot",invisible:!ie.length,children:_("common.components")}),value:"components"}];if(j)oe=(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(v.Z,{type:"error",variant:"icon",children:(0,K.Z)(j)}),(0,D.jsx)(m.Z,{onClick:function(){return L()},children:(0,D.jsx)("span",{style:{textDecoration:"underline"},children:_("common.retry")})})]});else if(w){var ue,se={overview:(0,D.jsx)(F,{}),configuration:M,navigation:V,services:W,members:(0,D.jsx)(Y,{type:"blocklet",createPassportSvg:te}),passports:X,components:q,"audit-logs":N,logs:J,runtime:(0,D.jsx)(Q,{}),traffic:(0,D.jsx)(H,{client:P,did:Z}),storage:(0,D.jsx)(ee,{})};"configuration"===r&&(0,K.wS)(w.status)&&re("overview"),(0,K.wS)(w.status)||(ce.push({label:_("common.members"),value:"members"}),ce.push({label:_("common.passport"),value:"passports"}),ce.push({label:_("common.configuration"),value:"configuration"})),ce.push({label:_("common.auditLogs"),value:"audit-logs"}),w&&null!==(ue=w.children)&&void 0!==ue&&ue.length&&w.structVersion===y.APP_STRUCT_VERSION&&ce.push({label:_("common.logs"),value:"logs"}),ce.push({label:_("common.configNavigation"),value:"navigation"}),ce.push({label:_("common.runtime"),value:"runtime"}),ce.push({label:_("common.traffic"),value:"traffic"}),ce.push({label:_("common.storage"),value:"storage"}),(0,h.getBlockletServices)(w).length&&ce.splice(2,0,{label:_("blocklet.services"),value:"services"});var le=se[r]||se.overview;oe=(0,D.jsxs)(x.g,{type:"components",children:[!(0,h.isExternalBlocklet)(w)&&(0,D.jsx)(f.Z,{tabs:ce,current:r,onChange:re,scrollButtons:"auto"}),(0,D.jsx)("div",{className:"page-content",children:(0,D.jsx)(a.Suspense,{fallback:(0,D.jsx)(G.Z,{relative:"parent",children:(0,D.jsx)(I.Z,{})}),children:(0,a.isValidElement)(le)?le:(0,D.jsx)(le,{blocklet:w,onUpdate:function(e){e&&S(e),L()},createPassportSvg:te})})})]})}else oe=(0,D.jsx)(G.Z,{relative:"parent",children:(0,D.jsx)(I.Z,{})});var pe=ce.find((function(e){return e.value===r})),de=w?U.G6:ne;return(0,D.jsx)(de,{teamDid:Z,children:(0,D.jsxs)(ae,{children:[(0,D.jsxs)(l.Z,{separator:"\u203a","aria-label":"breadcrumb",className:"page-breadcrumb",children:[(0,D.jsx)(c.Link,{color:"textSecondary",to:"/blocklets",children:_("common.blocklets")}),(0,D.jsx)(c.NavLink,{to:"/blocklets/".concat(Z,"/overview"),style:function(e){return e?{color:"inherit"}:{}},children:_("common.detail")}),(0,D.jsx)(s.Z,{color:"textSecondary",children:pe?pe.breadcrumbsLabel||pe.label:""})]}),(0,D.jsxs)(s.Z,{component:"div",className:"page-header",children:[(0,D.jsxs)(s.Z,{component:"h2",variant:"h4",className:"page-title",color:"textPrimary",children:[w?(0,D.jsx)(k.Z,{blocklet:w,style:{marginRight:16}}):null,w?(0,D.jsxs)(p.Z,{display:"flex",alignItems:"center",children:[(0,D.jsx)(p.Z,{children:(0,h.getDisplayName)(w)}),"unknown"!==(null===w||void 0===w?void 0:w.status)&&(0,D.jsx)(b.Z,{size:"12px",style:{marginLeft:8},status:w.status,source:w.source})]}):"".concat(_("common.blocklet")," ").concat(_("common.detail"))]}),(0,D.jsx)(R.Z,{permission:"mutate_blocklets",children:!!w&&!(0,h.isExternalBlocklet)(w)&&(0,D.jsx)(T.Z,{className:"page-actions",blocklet:w,onStart:function(){},onComplete:function(e){var t=e.action,r=e.error;r?g.Z.error(r.message):"remove"===t?(E(),n("/blocklets")):L()},variant:"group"})})]}),(0,D.jsx)(C,{}),oe]})})}function re(){var e=(0,o.useParams)().did;return e?(0,D.jsx)(z.$8,{did:e,children:(0,D.jsx)(A.wV,{children:(0,D.jsx)(te,{})})}):null}var ae=i.Z.main(N||(N=(0,r.Z)(["\n .page-header {\n display: flex;\n justify-content: space-between;\n align-items: center;\n }\n\n .page-title {\n display: flex;\n align-items: center;\n\n .page-link {\n font-size: 15px;\n margin-top: 8px;\n margin-left: 8px;\n }\n }\n\n .page-content {\n margin-top: 16px;\n }\n\n @media (max-width: ","px) {\n .page-header {\n flex-direction: column;\n align-items: flex-start;\n .page-actions,\n .MuiButtonGroup-root {\n width: 100%;\n }\n .MuiButtonGroup-root {\n .MuiButtonBase-root {\n flex: 1;\n }\n .blocklet-action-text {\n display: none;\n }\n }\n }\n\n .page-title {\n margin-bottom: 15px;\n }\n }\n"])),(function(e){return e.theme.breakpoints.values.md}))},43019:function(e,n,t){t.d(n,{wV:function(){return S},XN:function(){return L}});var r=t(32723),a=t(33028),i=t(34795),o=t(96234),c=t(5057),u=t(55898),s=t.n(u),l=t(86229),p=t(68420),d=t(76811),f=t(29054),v=t(84584),m=t(41899),h=t(58238),b=t(65873);function x(e){return g.apply(this,arguments)}function g(){return g=(0,i.Z)((0,r.Z)().mark((function e(n){var t,o,c,u,s;return(0,r.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=n.blockletDid,o=n.nodeApi,c=n.spaceGateways,u=!1,e.next=4,Promise.all(c.map(function(){var e=(0,i.Z)((0,r.Z)().mark((function e(n){var t,i;return(0,r.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=n.name,e.next=3,(0,v.nU)(n.endpoint);case 3:return i=e.sent,(0,b.isEmpty)(i)||i===t||(t=i,u=!0),e.abrupt("return",(0,a.Z)((0,a.Z)({},n),{},{name:t}));case 6:case"end":return e.stop()}}),e)})));return function(n){return e.apply(this,arguments)}}()));case 4:if(s=e.sent,!u){e.next=8;break}return e.next=8,Promise.all(s.filter((function(e){return e.did})).map((function(e){return o.updateBlockletSpaceGateway({input:{did:t,where:{did:e.did},spaceGateway:(0,a.Z)({},e)}})})));case 8:return e.abrupt("return",s);case 9:case"end":return e.stop()}}),e)}))),g.apply(this,arguments)}var k=t(99875);var Z=t(14491);function y(){var e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{deps:[],setLoading:function(){}},t=n.deps,a=n.setLoading,u=(0,f.y0)().blocklet,s=(0,c.useState)([]),p=(0,o.Z)(s,2),d=p[0],v=p[1],x=(0,h.h6)().api,g=(0,b.debounce)((0,i.Z)((0,r.Z)().mark((function e(){var n,t;return(0,r.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,a(!0),u){e.next=5;break}return v([]),e.abrupt("return");case 5:return e.next=7,x.getBlockletBackups({input:{did:u.meta.did}});case 7:n=e.sent,t=n.backups,v(null!==t&&void 0!==t?t:[]),e.next=16;break;case 12:e.prev=12,e.t0=e.catch(0),console.error(e.t0),l.Z.error((0,Z.Z)(e.t0));case 16:return e.prev=16,a(!1),e.finish(16);case 19:case"end":return e.stop()}}),e,null,[[0,12,16,19]])}))),2e3);return(0,m.Z)((0,i.Z)((0,r.Z)().mark((function e(){return(0,r.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:g();case 1:case"end":return e.stop()}}),e)}))),[null===u||void 0===u||null===(e=u.meta)||void 0===e?void 0:e.did].concat(t)),{backups:d}}var w=function(e){var n=e.appDid,t=y().backups,r=(0,c.useState)({message:"",progress:0,completed:!1}),i=(0,o.Z)(r,2),u=i[0],s=i[1];return(0,(0,h.h6)().ws.useSubscription)(d.BlockletEvents.backupProgress,(function(e){n===(null===e||void 0===e?void 0:e.appDid)&&s((function(){return(0,a.Z)({},e)}))}),[n]),(0,c.useEffect)((function(){var e;if(null!==t&&void 0!==t&&t.length&&(0,b.isNull)(null===(e=t[0])||void 0===e?void 0:e.status)){var n=(0,o.Z)(t,1)[0];s((function(){return{message:n.message,progress:n.progress,completed:Boolean(n.progress>=100)}}))}}),[t]),u};var j=t(96266),P=(0,c.createContext)({}),B=P.Provider;P.Consumer;function S(e){var n=e.children,t=(0,p.PE)().t,u=(0,h.h6)().api,s=(0,f.y0)().blocklet,b=(0,c.useState)(!1),g=(0,o.Z)(b,2),Z=g[0],P=g[1],S=(0,c.useState)(!1),L=(0,o.Z)(S,2),D=L[0],E=L[1],_=function(){var e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=n.setLoading,a=n.refresh,u=(0,f.y0)(),s=u.blocklet,p=u.actions.refreshBlocklet,d=null===s||void 0===s||null===(e=s.meta)||void 0===e?void 0:e.did,v=(0,c.useState)([]),b=(0,o.Z)(v,2),g=b[0],Z=b[1],y=(0,h.h6)().api;return(0,m.Z)((0,i.Z)((0,r.Z)().mark((function e(){var n,a,i;return(0,r.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,d){e.next=4;break}return Z([]),e.abrupt("return");case 4:return null===t||void 0===t||t(!0),e.next=7,y.getBlockletSpaceGateways({input:{did:d}});case 7:return n=e.sent,a=n.spaceGateways,e.next=11,x({blockletDid:d,nodeApi:y,spaceGateways:a});case 11:i=e.sent,Z(null!==i&&void 0!==i?i:[]),e.next=19;break;case 15:e.prev=15,e.t0=e.catch(0),console.error(e.t0),l.Z.error((0,k.Z)(e.t0));case 19:return e.prev=19,null===t||void 0===t||t(!1),e.finish(19);case 22:case"end":return e.stop()}}),e,null,[[0,15,19,22]])}))),[d,p,a]),{spaceGateways:g}}({refresh:D,setLoading:P}),C=_.spaceGateways,N=w({appDid:null===s||void 0===s?void 0:s.appDid}),G=(0,c.useState)(!1),A=(0,o.Z)(G,2),I=A[0],T=A[1],O=(0,c.useMemo)((function(){return(0,v.mo)(null===s||void 0===s?void 0:s.environments)}),[s,D,I]),U=(0,c.useState)(!1),z=(0,o.Z)(U,2),K=z[0],R=y({deps:[N],setLoading:z[1]}).backups,F=(0,c.useState)(null===C||void 0===C?void 0:C.find((function(e){return e.endpoint===O}))),M=(0,o.Z)(F,2),V=M[0],$=M[1],X=(0,c.useState)(!1),Y=(0,o.Z)(X,2),W=Y[0],q=Y[1],J=function(){var e,n=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{deps:[]}).deps,t=(0,f.y0)().blocklet,a=(0,h.h6)().api,u=(0,c.useState)(null),s=(0,o.Z)(u,2),l=s[0],p=s[1];return(0,m.Z)((0,i.Z)((0,r.Z)().mark((function e(){var n,i,o;return(0,r.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null===t||void 0===t||null===(n=t.meta)||void 0===n||!n.did){e.next=6;break}return e.next=3,a.getAutoBackup({input:{did:t.meta.did}});case 3:i=e.sent,o=i.autoBackup,p(o);case 6:case"end":return e.stop()}}),e)}))),[null===t||void 0===t||null===(e=t.meta)||void 0===e?void 0:e.did].concat(n)),l}({deps:[W]}),Q=function(){E((function(e){return!e}))},H=function(){var e=(0,i.Z)((0,r.Z)().mark((function e(n,t){return(0,r.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return C.push((0,a.Z)((0,a.Z)({},n),{},{loading:!0})),e.next=3,u.addBlockletSpaceGateway({input:{did:s.meta.did,spaceGateway:n}});case 3:if(O===t){e.next=6;break}return e.next=6,u.configBlocklet({input:{did:[s.meta.did],configs:[{key:d.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:t}]}});case 6:Q(),$(n);case 8:case"end":return e.stop()}}),e)})));return function(n,t){return e.apply(this,arguments)}}(),ee=function(){var e=(0,i.Z)((0,r.Z)().mark((function e(n){return(0,r.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n){e.next=2;break}return e.abrupt("return");case 2:if(n.endpoint!==O){e.next=5;break}return l.Z.warning(t("storage.spaces.gateway.delete.failedForConnected")),e.abrupt("return");case 5:return e.next=7,u.deleteBlockletSpaceGateway({input:{did:s.meta.did,spaceGatewayDid:null===n||void 0===n?void 0:n.did}});case 7:Q(),$(n);case 9:case"end":return e.stop()}}),e)})));return function(n){return e.apply(this,arguments)}}(),ne=function(){var e=(0,i.Z)((0,r.Z)().mark((function e(n){var a;return(0,r.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,u.updateBlockletSpaceGateway({input:{did:s.meta.did,where:{did:n.did},spaceGateway:n}});case 2:if(O===n.endpoint){e.next=5;break}return e.next=5,u.configBlocklet({input:{did:[s.meta.did],configs:[{key:d.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:n.endpoint}]}});case 5:l.Z.success(t("storage.spaces.connectedWithName",{name:null!==(a=null===n||void 0===n?void 0:n.name)&&void 0!==a?a:"DID Spaces"})),Q();case 7:case"end":return e.stop()}}),e)})));return function(n){return e.apply(this,arguments)}}(),te=function(){var e=(0,i.Z)((0,r.Z)().mark((function e(n){return(0,r.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,u.updateAutoBackup({input:{did:s.meta.did,autoBackup:n}});case 2:q((function(e){return!e}));case 3:case"end":return e.stop()}}),e)})));return function(n){return e.apply(this,arguments)}}();return(0,j.jsx)(B,{value:{spaceGateways:C,selectedSpaceGateway:V,addSpaceGateway:H,deleteSpaceGateway:ee,updateSpaceGateway:ne,refreshSpaceGateways:Q,spaceGatewaysLoading:Z,spaceGatewayIsSelected:function(e){return(null===e||void 0===e?void 0:e.endpoint)===O},updateAutoBackup:te,backupEndpoint:O,backupProgress:N,backups:R,backupsLoading:K,refreshBackupEndpoint:function(){T((function(e){return!e}))},autoBackup:J},children:n})}function L(){return(0,c.useContext)(P)}S.propTypes={children:s().any.isRequired},S.defaultProps={}},60344:function(e,n,t){t.d(n,{hi:function(){return i},od:function(){return a.a}});var r=t(10458),a=t.n(r);a().defaults.timeout=1e4;var i=a().create()},84584:function(e,n,t){t.d(n,{Jf:function(){return y},LQ:function(){return f},Nb:function(){return v},Xv:function(){return p},ag:function(){return b},mo:function(){return h},nD:function(){return d},nU:function(){return k},w2:function(){return x}});var r=t(32723),a=t(34795),i=t(82434),o=t.n(i),c=t(76811),u=t(65873),s=t(2842),l=t(60344);function p(e){var n=e.replace(/\/api\/space\/.+/,""),t=e.replace(/\/$/,"").split("/"),r=t.at(-4),a=t.at(-2);return(0,s.xn)(n,"space",r,"apps",a,"explorer?key=/apps/".concat(a,"/.did-objects/").concat(a,"/"))}function d(e){var n=e.replace(/\/api\/space\/.+/,""),t=e.replace(/\/$/,"").split("/").at(-4);return(0,s.xn)(n,"space",t)}function f(e){return e.replace(/\/$/,"").split("/").at(-4)}function v(e){return m.apply(this,arguments)}function m(){return(m=(0,a.Z)((0,r.Z)().mark((function e(n){var t,a;return(0,r.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,o()(n)){e.next=3;break}return e.abrupt("return",!1);case 3:return e.next=5,l.hi.head(n,{timeout:5e3});case 5:return t=e.sent,a=t.headers,e.abrupt("return","true"===a["x-listable"]&&"true"===a["x-readable"]&&"true"===a["x-writeable"]);case 10:return e.prev=10,e.t0=e.catch(0),console.error(e.t0),e.abrupt("return",!1);case 14:case"end":return e.stop()}}),e,null,[[0,10]])})))).apply(this,arguments)}function h(e){var n;return(null===e||void 0===e||null===(n=e.find((function(e){return e.key===c.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT})))||void 0===n?void 0:n.value)||""}function b(e){var n=new URL(e);return(0,s.xn)(n.origin,n.pathname)}function x(e){return g.apply(this,arguments)}function g(){return(g=(0,a.Z)((0,r.Z)().mark((function e(n){var t,a,i,c,p;return(0,r.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,o()(n)){e.next=3;break}return e.abrupt("return",!1);case 3:return t=b(n),a=(0,s.xn)(t,"space/api/did/one-click-authorization/token"),e.next=7,l.hi.get(a,{timeout:5e3});case 7:return i=e.sent,c=i.status,p=i.data,e.abrupt("return",200===c&&(0,u.isObject)(p));case 13:return e.prev=13,e.t0=e.catch(0),console.error(e.t0),e.abrupt("return",!1);case 17:case"end":return e.stop()}}),e,null,[[0,13]])})))).apply(this,arguments)}function k(e){return Z.apply(this,arguments)}function Z(){return(Z=(0,a.Z)((0,r.Z)().mark((function e(n){var t,a,i;return(0,r.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,o()(n)){e.next=3;break}return e.abrupt("return","");case 3:return e.next=5,l.hi.head(n,{timeout:3e3});case 5:return t=e.sent,a=t.headers,i=a["x-space-name"],e.abrupt("return",i?decodeURIComponent(i):"");case 11:return e.prev=11,e.t0=e.catch(0),console.error(e.t0),e.abrupt("return","");case 15:case"end":return e.stop()}}),e,null,[[0,11]])})))).apply(this,arguments)}function y(e){var n=e.replace(/\/api\/space\/.+/,""),t=e.replace(/\/$/,"").split("/").at(-4);return(0,s.xn)(n,"/api/space/nft/display?spaceDid=".concat(t))}}}]);
@@ -1 +1 @@
1
- (self.webpackChunk_abtnode_webapp=self.webpackChunk_abtnode_webapp||[]).push([[7022],{13671:function(e,t,n){"use strict";n.d(t,{$8:function(){return _},y0:function(){return O}});var r=n(96234),i=n(5057),o=n(68420),u=n(36991),a=n(14491),s=n(29054),c=n(56666),l=n(33028),d=n(32723),f=n(34795),v=n(40807),m=n.n(v),p=n(24914),h=n.n(p),g=n(76811),k=n(86229),Z=n(4651),b=n(6352),E=n.n(b),x=n(32243),S=n.n(x),D=n(35432),w=n(49714),y=n(41365),R=n.n(y),P=S()((function(e){var t=new URL(e),n=t.origin;return t.hostname===window.location.hostname||R()(E()(n,D.WELLKNOWN_PING_PREFIX))})),B={};function C(e){var t=e.urls,n=e.checkAccessible,o=void 0===n?R():n,u=e.disableCache,a=void 0!==u&&u,s=(0,i.useRef)(t.filter((function(e){return B[e]})).map((function(e){return B[e]}))),c=s.current.length===t.length,l=(0,i.useState)(c?s.current:[]),v=(0,r.Z)(l,2),m=v[0],p=v[1],h=(0,i.useState)(!c),g=(0,r.Z)(h,2),k=g[0],Z=g[1],b=(0,i.useMemo)((function(){return!k&&m.length?m[0]:null}),[m,k]);return(0,i.useEffect)((function(){if((null===t||void 0===t?void 0:t.length)>0&&!c){var e=function(){var e=(0,f.Z)((0,d.Z)().mark((function e(){var n;return(0,d.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Z(!0),!a){e.next=8;break}return e.next=4,(0,w.evaluateURLs)(t,{checkAccessible:o});case 4:(n=e.sent).forEach((function(e){B[e.url]=e})),e.next=13;break;case 8:return e.next=10,(0,w.evaluateURLs)(t.filter((function(e){return!B[e]})),{checkAccessible:o});case 10:e.sent.forEach((function(e){B[e.url]=e})),n=t.map((function(e){return B[e]})).sort((function(e,t){return t.score-e.score}));case 13:p(n),Z(!1);case 15:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();e()}}),[t,a,c]),{urlsState:m,loading:k,recommendedUrlState:b,recommendedUrl:null===b||void 0===b?void 0:b.url}}function U(e){var t,n,o,u,s,v,p,b,E=e.did,x=e.client,S=e.useSubscription,D=e.getIP,w=e.useLocaleContext,y=e.disableSubscription,R=w(),B=R.t,U=R.locale,I=(0,i.useState)(null),N=(0,r.Z)(I,2),A=N[0],L=N[1],T=(0,i.useState)(!1),_=(0,r.Z)(T,2),O=_[0],F=_[1],G=(0,i.useState)(!1),H=(0,r.Z)(G,2),K=H[0],M=H[1],V=(0,i.useState)(),j=(0,r.Z)(V,2),q=j[0],J=j[1],W=(0,i.useState)({cpu:[],memory:[]}),$=(0,r.Z)(W,2),Q=$[0],X=$[1],Y=(0,i.useState)({}),z=(0,r.Z)(Y,2),ee=z[0],te=z[1],ne=null!==q&&void 0!==q&&null!==(t=q.site)&&void 0!==t&&null!==(n=t.domainAliases)&&void 0!==n&&n.length?JSON.stringify(q.site.domainAliases.map((function(e){return e.value}))):"",re=function(e){var t,n=C({urls:(0,i.useMemo)((function(){return e.map((function(e){return(0,a.Sk)(e)}))}),[e]),checkAccessible:P}),r=n.urlsState,o=n.loading,u=n.recommendedUrl;if(o)t={domainsAccessibility:e.reduce((function(e,t){return(0,l.Z)((0,l.Z)({},e),{},(0,c.Z)({},t,{loading:!0}))}),{}),recommendedDomain:null};else{var s,d=r.reduce((function(e,t){var n=new URL(t.url).hostname;return e[n]=(0,l.Z)((0,l.Z)({},t),{},{domain:n}),e}),{}),f=(null===(s=r.find((function(e){return e.accessible})))||void 0===s?void 0:s.url)||u;t={domainsAccessibility:d,recommendedDomain:f?new URL(f).hostname:null}}return t}((0,i.useMemo)((function(){var e;return((null===q||void 0===q||null===(e=q.site)||void 0===e?void 0:e.domainAliases)||[]).map((function(e){return e.value}))}),[ne])),ie=re.domainsAccessibility,oe=re.recommendedDomain,ue=function(){var e=(0,f.Z)((0,d.Z)().mark((function e(){var t,n;return(0,d.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return M(!0),e.prev=1,e.next=4,x.getBlocklet({input:{did:E,attachRuntimeInfo:!0}});case 4:return t=e.sent,n=t.blocklet,e.next=8,(0,Z.Gv)(n,{getIP:D});case 8:J(n),e.next=14;break;case 11:e.prev=11,e.t0=e.catch(1),k.Z.error(e.t0.message);case 14:return e.prev=14,M(!1),e.finish(14);case 17:case"end":return e.stop()}}),e,null,[[1,11,14,17]])})));return function(){return e.apply(this,arguments)}}(),ae=function(){var e=(0,f.Z)((0,d.Z)().mark((function e(){var t;return(0,d.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,x.getBlockletRuntimeHistory({input:{did:E,hours:6}});case 3:(t=e.sent)&&X({cpu:t.history.map((function(e){return{date:e.date,value:e.cpu}})),memory:t.history.map((function(e){return{date:e.date,value:e.mem}}))}),e.next=10;break;case 7:e.prev=7,e.t0=e.catch(0),k.Z.error(e.t0.message);case 10:case"end":return e.stop()}}),e,null,[[0,7]])})));return function(){return e.apply(this,arguments)}}(),se=function(){var e=(0,f.Z)((0,d.Z)().mark((function e(){var t,n,r,i,o,u,a,s=arguments;return(0,d.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=(t=s.length>0&&void 0!==s[0]?s[0]:{}).showError,r=void 0===n||n,i=t.attachRuntimeInfo,o=void 0===i||i,!O){e.next=3;break}return e.abrupt("return");case 3:return e.prev=3,F(!0),L(null),e.next=8,x.getBlocklet({input:{did:E}});case 8:if(u=e.sent,!(a=u.blocklet)){e.next=16;break}J((function(e){return(0,Z.Gv)(a,{fixRuntime:"merge-old",oldBlocklet:e}),a})),F(!1),o&&(ue(),ae()),e.next=17;break;case 16:throw new Error(B("blocklet.notFound"));case 17:e.next=24;break;case 19:e.prev=19,e.t0=e.catch(3),F(!1),L(e.t0),r&&k.Z.error(e.t0.message);case 24:case"end":return e.stop()}}),e,null,[[3,19]])})));return function(){return e.apply(this,arguments)}}(),ce=function(e){var t;(null===e||void 0===e||null===(t=e.meta)||void 0===t?void 0:t.did)===q.meta.did&&se({showError:!1})},le=function(e){var t;(null===e||void 0===e||null===(t=e.meta)||void 0===t?void 0:t.did)===q.meta.did&&se({attachRuntimeInfo:!1,showError:!1})},de=function(){E&&ne&&x.checkDomains({input:{did:E}}).catch((function(e){console.error(e)}))},fe=function(){var e=(0,f.Z)((0,d.Z)().mark((function e(t){var n,r;return(0,d.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,x.configNavigations({input:{did:E,navigations:t}});case 2:n=e.sent,r=n.blocklet,J(r);case 5:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}();(0,i.useEffect)((function(){ne&&!y&&de()}),[ne,y]),S(g.BlockletEvents.domainStatus,(function(e){te((function(t){return(0,l.Z)((0,l.Z)({},t),{},(0,c.Z)({},e.domain,(0,l.Z)((0,l.Z)({},t[e.domain]),e)))}))}),[null===q||void 0===q||null===(o=q.meta)||void 0===o?void 0:o.did,!y]),S(g.BlockletEvents.statusChange,(function(e){var t;(null===e||void 0===e||null===(t=e.meta)||void 0===t?void 0:t.did)===q.meta.did&&(J((function(t){var n=(0,l.Z)({},t);return n.status=(0,g.fromBlockletStatus)(e.status),(n.children||[]).forEach((function(t){var n=e.children.find((function(e){var n,r;return(null===(n=e.meta)||void 0===n?void 0:n.did)===(null===(r=t.meta)||void 0===r?void 0:r.did)}));n&&(t.status=(0,g.fromBlockletStatus)(n.status))})),n})),le(e))}),[null===q||void 0===q||null===(u=q.meta)||void 0===u?void 0:u.did,!y]),S(g.BlockletEvents.storeChange,le,[null===q||void 0===q||null===(s=q.meta)||void 0===s?void 0:s.did,!y]),S(g.BlockletEvents.installed,ce,[null===q||void 0===q||null===(v=q.meta)||void 0===v?void 0:v.did,!y]),S(g.BlockletEvents.upgraded,ce,[null===q||void 0===q||null===(p=q.meta)||void 0===p?void 0:p.did,!y]),S(g.BlockletEvents.updated,ce,[null===q||void 0===q||null===(b=q.meta)||void 0===b?void 0:b.did,!y]);var ve=q?m()(q,{site:{domainAliases:q.site.domainAliases.map((function(e){var t=e.value,n=(0,a.H$)(t);return e.domainStatus=h()(ee[n],["domain","meta"]),e.accessibility=h()(ie[t],["domain"]),e.href=(0,a.vH)({blocklet:q,domain:e,params:(0,a.f0)(q,U)}),e}))}}):null;return{loading:O,loadingRuntimeInfo:K,error:A,blocklet:ve,runtimeHistory:Q,recommendedDomain:oe||"",actions:{refreshBlocklet:se,refreshDomainStatus:de,setBlocklet:J,configNavigations:fe}}}var I=n(38242),N=n(75793),A=n(33234),L=n(96266),T=s.Tw.Provider;s.Tw.Consumer;function _(e){var t=e.did,n=e.children,s=(0,N.h6)(),c=s.api,l=s.ws.useSubscription,d=(0,i.useState)(),f=(0,r.Z)(d,2),v=f[0],m=f[1],p=U({did:t,client:c,useSubscription:l,getIP:A.Z,useLocaleContext:o.PE}),h=p.loading,g=p.loadingRuntimeInfo,k=p.error,Z=p.blocklet,b=p.recommendedDomain,E=p.runtimeHistory,x=p.actions,S=x.refreshBlocklet,D=x.refreshDomainStatus,w=x.setBlocklet,y=x.configNavigations;(0,i.useEffect)((function(){S()}),[t]),(0,i.useEffect)((function(){if(Z&&null!==Z&&void 0!==Z&&Z.controller){var e=Z.controller;(0,a.Nh)(e.chainHost,e.nftId).then((function(e){e.expirationDate=(0,u.getNftExpirationDate)(e),e.expired=(0,u.isNFTExpired)(e),m(e)})).catch((function(e){return console.error(e)}))}}),[null===Z||void 0===Z?void 0:Z.appPid]);var R={did:t,client:c,loading:h,loadingRuntimeInfo:g,error:k,blocklet:Z,recommendedDomain:b,runtimeHistory:E,nftState:v,appIdList:Z?(0,I.getBlockletAppIdList)(Z):[],actions:{refreshBlocklet:S,refreshDomainStatus:D,setBlocklet:w,configNavigations:y}};return(0,L.jsx)(T,{value:R,children:n})}function O(){return(0,i.useContext)(s.Tw)}},17022:function(e,t,n){"use strict";n.d(t,{G6:function(){return w}});var r=n(32723),i=n(34795),o=n(96234),u=n(5057),a=n(35432),s=n(76811),c=n(38242),l=n(86229),d=n(14491),f=n(17425),v=n(4651),m=n(75793),p=n(13671),h=n(34937),g=n(96266),k=f.Gy.Provider,Z=(f.Gy.Consumer,function(e,t,n){return e===t.did?t.name:n?(0,c.getDisplayName)(n):""}),b=function(e,t,n){if(n){var r=n.environments.find((function(e){return e.key===s.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_PASSPORT_COLOR}));return r?r.value:"auto"}return"default"},E=function(e,t,n){return e===t.did?t.trustedPassports||[]:n&&n.trustedPassports||[]},x=function(e,t,n){return e===t.did?t.trustedFactories||[]:n&&n.trustedFactories||[]},S=function(e,t,n){return e===t.did?e:n&&((n.environments||[]).find((function(e){return"BLOCKLET_APP_ID"===e.key}))||{}).value||""},D=function(e,t,n){return e===t.did?!1!==t.enablePassportIssuance:!n||!1!==n.enablePassportIssuance};function w(e){var t=e.teamDid,n=e.children,s=(0,m.h6)(),c=s.api,f=s.info,w=(0,p.y0)()||{},y=w.recommendedDomain,R=w.blocklet,P=(0,u.useState)([]),B=(0,o.Z)(P,2),C=B[0],U=B[1],I=(0,u.useState)([]),N=(0,o.Z)(I,2),A=N[0],L=N[1],T=(0,u.useState)([]),_=(0,o.Z)(T,2),O=_[0],F=_[1],G=Z(t,f,R),H=b(t,f,R),K=E(t,f,R),M=x(t,f,R),V=S(t,f,R),j=D(t,f,R),q=function(){var e=(0,i.Z)((0,r.Z)().mark((function e(t){var n;return(0,r.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,c.doBatchQuery({getRoles:{input:{teamDid:t}},getPermissions:{input:{teamDid:t}},getInvitations:{input:{teamDid:t}}});case 3:n=e.sent,L((n.getRoles.roles||[]).filter((function(e){return!a.RBAC_CONFIG.roles.some((function(t){return t.name===e.name&&(!t.passport||t.noHuman)}))})).map((function(e){return e.description=e.description||"Use this passport to connect ".concat(G," as ").concat(e.title),e}))),F(n.getPermissions.permissions||[]),U(n.getInvitations.invitations||[]),e.next=12;break;case 9:e.prev=9,e.t0=e.catch(0),l.Z.error(e.t0.message);case 12:case"end":return e.stop()}}),e,null,[[0,9]])})));return function(t){return e.apply(this,arguments)}}();(0,u.useEffect)((function(){q(t)}),[t]);var J=function(e){e.teamDid===t&&q(t)};(0,h.mU)(a.EVENTS.USER_ADDED,J,[t]),(0,h.mU)(a.EVENTS.USER_REMOVED,J,[t]),(0,h.mU)(a.EVENTS.USER_UPDATED,J,[t]);var W={teamDid:t,teamIssuerDid:V,teamName:G,invitations:C,roles:A,permissions:O,trustedPassports:K,trustedFactories:M,isNodeTeam:t===f.did,enablePassportIssuance:j,refresh:function(){return q(t)},passportColor:H,endpoint:t===f.did?(0,v.RU)(f):(0,d.Sk)(y),blocklet:R,api:{getUser:function(){var e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).did,n={teamDid:t,user:{did:e}};return c.getUser({input:n})},getUsers:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e.query,r=e.paging,i={teamDid:t};return r&&(i.paging=r),n&&(i.query=n),i.sort={lastLoginAt:-1},c.getUsers({input:i})},getUsersCountPerRole:function(){return c.getUsersCountPerRole({input:{teamDid:t}})}}};return(0,g.jsx)(k,{value:W,children:n})}w.defaultProps={}},36991:function(e,t,n){var r=n(59408),i=n(43681),o=function(e){return r(i(e,"data.value.expirationDate",[]))},u=function(e){return!!e&&new Date(e).getTime()<=Date.now()};e.exports={isNFTExpired:function(e){var t=o(e);return u(t)},getNftExpirationDate:o,isNFTConsumed:function(e){return!!e.data.value.consumedTime}}},17425:function(e,t,n){"use strict";n.d(t,{DJ:function(){return o},Gy:function(){return i}});var r=n(5057),i=(0,r.createContext)({});i.Provider,i.Consumer;function o(){return(0,r.useContext)(i)}}}]);
1
+ (self.webpackChunk_abtnode_webapp=self.webpackChunk_abtnode_webapp||[]).push([[7022],{13671:function(e,t,n){"use strict";n.d(t,{$8:function(){return _},y0:function(){return O}});var r=n(96234),i=n(5057),o=n(68420),u=n(36991),a=n(14491),s=n(29054),c=n(56666),l=n(33028),d=n(32723),f=n(34795),v=n(40807),m=n.n(v),p=n(24914),h=n.n(p),g=n(76811),k=n(86229),Z=n(4651),b=n(6352),E=n.n(b),x=n(32243),S=n.n(x),D=n(35432),w=n(49714),y=n(41365),R=n.n(y),P=S()((function(e){var t=new URL(e),n=t.origin;return t.hostname===window.location.hostname||R()(E()(n,D.WELLKNOWN_PING_PREFIX))})),B={};function C(e){var t=e.urls,n=e.checkAccessible,o=void 0===n?R():n,u=e.disableCache,a=void 0!==u&&u,s=(0,i.useRef)(t.filter((function(e){return B[e]})).map((function(e){return B[e]}))),c=s.current.length===t.length,l=(0,i.useState)(c?s.current:[]),v=(0,r.Z)(l,2),m=v[0],p=v[1],h=(0,i.useState)(!c),g=(0,r.Z)(h,2),k=g[0],Z=g[1],b=(0,i.useMemo)((function(){return!k&&m.length?m[0]:null}),[m,k]);return(0,i.useEffect)((function(){if((null===t||void 0===t?void 0:t.length)>0&&!c){var e=function(){var e=(0,f.Z)((0,d.Z)().mark((function e(){var n;return(0,d.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Z(!0),!a){e.next=8;break}return e.next=4,(0,w.evaluateURLs)(t,{checkAccessible:o});case 4:(n=e.sent).forEach((function(e){B[e.url]=e})),e.next=13;break;case 8:return e.next=10,(0,w.evaluateURLs)(t.filter((function(e){return!B[e]})),{checkAccessible:o});case 10:e.sent.forEach((function(e){B[e.url]=e})),n=t.map((function(e){return B[e]})).sort((function(e,t){return t.score-e.score}));case 13:p(n),Z(!1);case 15:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();e()}}),[t,a,c]),{urlsState:m,loading:k,recommendedUrlState:b,recommendedUrl:null===b||void 0===b?void 0:b.url}}function U(e){var t,n,o,u,s,v,p,b,E=e.did,x=e.client,S=e.useSubscription,D=e.getIP,w=e.useLocaleContext,y=e.disableSubscription,R=w(),B=R.t,U=R.locale,I=(0,i.useState)(null),N=(0,r.Z)(I,2),A=N[0],L=N[1],T=(0,i.useState)(!1),_=(0,r.Z)(T,2),O=_[0],F=_[1],G=(0,i.useState)(!1),H=(0,r.Z)(G,2),K=H[0],M=H[1],V=(0,i.useState)(),j=(0,r.Z)(V,2),q=j[0],J=j[1],W=(0,i.useState)({cpu:[],memory:[]}),$=(0,r.Z)(W,2),Q=$[0],X=$[1],Y=(0,i.useState)({}),z=(0,r.Z)(Y,2),ee=z[0],te=z[1],ne=null!==q&&void 0!==q&&null!==(t=q.site)&&void 0!==t&&null!==(n=t.domainAliases)&&void 0!==n&&n.length?JSON.stringify(q.site.domainAliases.map((function(e){return e.value}))):"",re=function(e){var t,n=C({urls:(0,i.useMemo)((function(){return e.map((function(e){return(0,a.Sk)(e)}))}),[e]),checkAccessible:P}),r=n.urlsState,o=n.loading,u=n.recommendedUrl;if(o)t={domainsAccessibility:e.reduce((function(e,t){return(0,l.Z)((0,l.Z)({},e),{},(0,c.Z)({},t,{loading:!0}))}),{}),recommendedDomain:null};else{var s,d=r.reduce((function(e,t){var n=new URL(t.url).hostname;return e[n]=(0,l.Z)((0,l.Z)({},t),{},{domain:n}),e}),{}),f=(null===(s=r.find((function(e){return e.accessible})))||void 0===s?void 0:s.url)||u;t={domainsAccessibility:d,recommendedDomain:f?new URL(f).hostname:null}}return t}((0,i.useMemo)((function(){var e;return((null===q||void 0===q||null===(e=q.site)||void 0===e?void 0:e.domainAliases)||[]).map((function(e){return e.value}))}),[ne])),ie=re.domainsAccessibility,oe=re.recommendedDomain,ue=function(){var e=(0,f.Z)((0,d.Z)().mark((function e(){var t,n;return(0,d.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return M(!0),e.prev=1,e.next=4,x.getBlocklet({input:{did:E,attachRuntimeInfo:!0}});case 4:return t=e.sent,n=t.blocklet,e.next=8,(0,Z.Gv)(n,{getIP:D});case 8:J(n),e.next=14;break;case 11:e.prev=11,e.t0=e.catch(1),k.Z.error(e.t0.message);case 14:return e.prev=14,M(!1),e.finish(14);case 17:case"end":return e.stop()}}),e,null,[[1,11,14,17]])})));return function(){return e.apply(this,arguments)}}(),ae=function(){var e=(0,f.Z)((0,d.Z)().mark((function e(){var t;return(0,d.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,x.getBlockletRuntimeHistory({input:{did:E,hours:6}});case 3:(t=e.sent)&&X({cpu:t.history.map((function(e){return{date:e.date,value:e.cpu}})),memory:t.history.map((function(e){return{date:e.date,value:e.mem}}))}),e.next=10;break;case 7:e.prev=7,e.t0=e.catch(0),k.Z.error(e.t0.message);case 10:case"end":return e.stop()}}),e,null,[[0,7]])})));return function(){return e.apply(this,arguments)}}(),se=function(){var e=(0,f.Z)((0,d.Z)().mark((function e(){var t,n,r,i,o,u,a,s=arguments;return(0,d.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=(t=s.length>0&&void 0!==s[0]?s[0]:{}).showError,r=void 0===n||n,i=t.attachRuntimeInfo,o=void 0===i||i,!O){e.next=3;break}return e.abrupt("return");case 3:return e.prev=3,F(!0),L(null),e.next=8,x.getBlocklet({input:{did:E}});case 8:if(u=e.sent,!(a=u.blocklet)){e.next=16;break}J((function(e){return(0,Z.Gv)(a,{fixRuntime:"merge-old",oldBlocklet:e}),a})),F(!1),o&&(ue(),ae()),e.next=17;break;case 16:throw new Error(B("blocklet.notFound"));case 17:e.next=24;break;case 19:e.prev=19,e.t0=e.catch(3),F(!1),L(e.t0),r&&k.Z.error(e.t0.message);case 24:case"end":return e.stop()}}),e,null,[[3,19]])})));return function(){return e.apply(this,arguments)}}(),ce=function(e){var t;(null===e||void 0===e||null===(t=e.meta)||void 0===t?void 0:t.did)===q.meta.did&&se({showError:!1})},le=function(e){var t;(null===e||void 0===e||null===(t=e.meta)||void 0===t?void 0:t.did)===q.meta.did&&se({attachRuntimeInfo:!1,showError:!1})},de=function(){E&&ne&&x.checkDomains({input:{did:E}}).catch((function(e){console.error(e)}))},fe=function(){var e=(0,f.Z)((0,d.Z)().mark((function e(t){var n,r;return(0,d.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,x.configNavigations({input:{did:E,navigations:t}});case 2:n=e.sent,r=n.blocklet,J(r);case 5:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}();(0,i.useEffect)((function(){ne&&!y&&de()}),[ne,y]),S(g.BlockletEvents.domainStatus,(function(e){te((function(t){return(0,l.Z)((0,l.Z)({},t),{},(0,c.Z)({},e.domain,(0,l.Z)((0,l.Z)({},t[e.domain]),e)))}))}),[null===q||void 0===q||null===(o=q.meta)||void 0===o?void 0:o.did,!y]),S(g.BlockletEvents.statusChange,(function(e){var t;(null===e||void 0===e||null===(t=e.meta)||void 0===t?void 0:t.did)===q.meta.did&&(J((function(t){var n=(0,l.Z)({},t);return n.status=(0,g.fromBlockletStatus)(e.status),(n.children||[]).forEach((function(t){var n=e.children.find((function(e){var n,r;return(null===(n=e.meta)||void 0===n?void 0:n.did)===(null===(r=t.meta)||void 0===r?void 0:r.did)}));n&&(t.status=(0,g.fromBlockletStatus)(n.status))})),n})),le(e))}),[null===q||void 0===q||null===(u=q.meta)||void 0===u?void 0:u.did,!y]),S(g.BlockletEvents.storeChange,le,[null===q||void 0===q||null===(s=q.meta)||void 0===s?void 0:s.did,!y]),S(g.BlockletEvents.installed,ce,[null===q||void 0===q||null===(v=q.meta)||void 0===v?void 0:v.did,!y]),S(g.BlockletEvents.upgraded,ce,[null===q||void 0===q||null===(p=q.meta)||void 0===p?void 0:p.did,!y]),S(g.BlockletEvents.updated,ce,[null===q||void 0===q||null===(b=q.meta)||void 0===b?void 0:b.did,!y]);var ve=q?m()(q,{site:{domainAliases:q.site.domainAliases.map((function(e){var t=e.value,n=(0,a.H$)(t);return e.domainStatus=h()(ee[n],["domain","meta"]),e.accessibility=h()(ie[t],["domain"]),e.href=(0,a.vH)({blocklet:q,domain:e,params:(0,a.f0)(q,U)}),e}))}}):null;return{loading:O,loadingRuntimeInfo:K,error:A,blocklet:ve,runtimeHistory:Q,recommendedDomain:oe||"",actions:{refreshBlocklet:se,refreshDomainStatus:de,setBlocklet:J,configNavigations:fe}}}var I=n(38242),N=n(75793),A=n(33234),L=n(96266),T=s.Tw.Provider;s.Tw.Consumer;function _(e){var t=e.did,n=e.children,s=(0,N.h6)(),c=s.api,l=s.ws.useSubscription,d=(0,i.useState)(),f=(0,r.Z)(d,2),v=f[0],m=f[1],p=U({did:t,client:c,useSubscription:l,getIP:A.Z,useLocaleContext:o.PE}),h=p.loading,g=p.loadingRuntimeInfo,k=p.error,Z=p.blocklet,b=p.recommendedDomain,E=p.runtimeHistory,x=p.actions,S=x.refreshBlocklet,D=x.refreshDomainStatus,w=x.setBlocklet,y=x.configNavigations;(0,i.useEffect)((function(){S()}),[t]),(0,i.useEffect)((function(){if(Z&&null!==Z&&void 0!==Z&&Z.controller){var e=Z.controller;(0,a.Nh)(e.chainHost,e.nftId).then((function(e){e.expirationDate=(0,u.getNftExpirationDate)(e),e.expired=(0,u.isNFTExpired)(e),m(e)})).catch((function(e){return console.error(e)}))}}),[null===Z||void 0===Z?void 0:Z.appPid]);var R={did:t,client:c,loading:h,loadingRuntimeInfo:g,error:k,blocklet:Z,recommendedDomain:b,runtimeHistory:E,nftState:v,appIdList:Z?(0,I.getBlockletAppIdList)(Z):[],actions:{refreshBlocklet:S,refreshDomainStatus:D,setBlocklet:w,configNavigations:y}};return(0,L.jsx)(T,{value:R,children:n})}function O(){return(0,i.useContext)(s.Tw)}},17022:function(e,t,n){"use strict";n.d(t,{G6:function(){return w}});var r=n(32723),i=n(34795),o=n(96234),u=n(5057),a=n(35432),s=n(76811),c=n(38242),l=n(86229),d=n(14491),f=n(17425),v=n(4651),m=n(75793),p=n(13671),h=n(34937),g=n(96266),k=f.Gy.Provider,Z=(f.Gy.Consumer,function(e,t,n){return e===t.did?t.name:n?(0,c.getDisplayName)(n):""}),b=function(e,t,n){if(n){var r=n.environments.find((function(e){return e.key===s.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_PASSPORT_COLOR}));return r?r.value:"auto"}return"default"},E=function(e,t,n){return e===t.did?t.trustedPassports||[]:n&&n.trustedPassports||[]},x=function(e,t,n){return e===t.did?t.trustedFactories||[]:n&&n.trustedFactories||[]},S=function(e,t,n){return e===t.did?e:n&&((n.environments||[]).find((function(e){return"BLOCKLET_APP_ID"===e.key}))||{}).value||""},D=function(e,t,n){return e===t.did?!1!==t.enablePassportIssuance:!n||!1!==n.enablePassportIssuance};function w(e){var t=e.teamDid,n=e.children,s=(0,m.h6)(),c=s.api,f=s.info,w=(0,p.y0)()||{},y=w.recommendedDomain,R=w.blocklet,P=(0,u.useState)([]),B=(0,o.Z)(P,2),C=B[0],U=B[1],I=(0,u.useState)([]),N=(0,o.Z)(I,2),A=N[0],L=N[1],T=(0,u.useState)([]),_=(0,o.Z)(T,2),O=_[0],F=_[1],G=Z(t,f,R),H=b(t,f,R),K=E(t,f,R),M=x(t,f,R),V=S(t,f,R),j=D(t,f,R),q=function(){var e=(0,i.Z)((0,r.Z)().mark((function e(t){var n;return(0,r.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,c.doBatchQuery({getRoles:{input:{teamDid:t}},getPermissions:{input:{teamDid:t}},getInvitations:{input:{teamDid:t}}});case 3:n=e.sent,L((n.getRoles.roles||[]).filter((function(e){return!a.RBAC_CONFIG.roles.some((function(t){return t.name===e.name&&(!t.passport||t.noHuman)}))})).map((function(e){return e.description=e.description||"Use this passport to connect ".concat(G," as ").concat(e.title),e}))),F(n.getPermissions.permissions||[]),U(n.getInvitations.invitations||[]),e.next=12;break;case 9:e.prev=9,e.t0=e.catch(0),l.Z.error(e.t0.message);case 12:case"end":return e.stop()}}),e,null,[[0,9]])})));return function(t){return e.apply(this,arguments)}}();(0,u.useEffect)((function(){q(t)}),[t]);var J=function(e){e.teamDid===t&&q(t)};(0,h.mU)(a.EVENTS.USER_ADDED,J,[t]),(0,h.mU)(a.EVENTS.USER_REMOVED,J,[t]),(0,h.mU)(a.EVENTS.USER_UPDATED,J,[t]);var W={teamDid:t,teamIssuerDid:V,teamName:G,invitations:C,roles:A,permissions:O,trustedPassports:K,trustedFactories:M,isNodeTeam:t===f.did,enablePassportIssuance:j,refresh:function(){return q(t)},passportColor:H,endpoint:t===f.did?(0,v.RU)(f):(0,d.Sk)(y),blocklet:R,api:{getUser:function(){var e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).did,n={teamDid:t,user:{did:e}};return c.getUser({input:n})},getUsers:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e.query,r=e.paging,i={teamDid:t};return r&&(i.paging=r),n&&(i.query=n),i.sort={lastLoginAt:-1},c.getUsers({input:i})},getUsersCountPerRole:function(){return c.getUsersCountPerRole({input:{teamDid:t}})}}};return(0,g.jsx)(k,{value:W,children:n})}w.defaultProps={}},36991:function(e,t,n){var r=n(59408),i=n(43681),o=function(e){return r(i(e,"data.value.expirationDate",[]))};e.exports={isNFTExpired:function(e){return function(e){return!!e&&new Date(e).getTime()<=Date.now()}(o(e))},getNftExpirationDate:o,isNFTConsumed:function(e){return!!e.data.value.consumedTime}}},17425:function(e,t,n){"use strict";n.d(t,{DJ:function(){return o},Gy:function(){return i}});var r=n(5057),i=(0,r.createContext)({});i.Provider,i.Consumer;function o(){return(0,r.useContext)(i)}}}]);