@abtnode/webapp 1.16.21-beta-445a8baa → 1.16.21-beta-2e75c75c
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/blocklet.js +1 -1
- package/blocklet.yml +1 -1
- package/build/asset-manifest.json +40 -39
- package/build/index.html +1 -1
- package/build/service-worker.js +1 -1
- package/build/static/js/1366.f2fe8ce7.chunk.js +2 -0
- package/build/static/js/{1667.488a600b.chunk.js → 1667.4403e42c.chunk.js} +1 -1
- package/build/static/js/1846.5498f998.chunk.js +1 -0
- package/build/static/js/{2334.311ae46d.chunk.js → 2334.2b408137.chunk.js} +1 -1
- package/build/static/js/2743.99b9b3be.chunk.js +1 -0
- package/build/static/js/{2960.a9d50cef.chunk.js → 2960.e4c10af0.chunk.js} +1 -1
- package/build/static/js/3058.cea35b61.chunk.js +1 -0
- package/build/static/js/{3389.282a0683.chunk.js → 3389.1c4a79ac.chunk.js} +1 -1
- package/build/static/js/3883.062d06a9.chunk.js +1 -0
- package/build/static/js/406.37ef18fa.chunk.js +1 -0
- package/build/static/js/4382.f8edadf8.chunk.js +2 -0
- package/build/static/js/{4382.3efe04e3.chunk.js.LICENSE.txt → 4382.f8edadf8.chunk.js.LICENSE.txt} +0 -7
- package/build/static/js/4509.04d35bd4.chunk.js +2 -0
- package/build/static/js/{4549.2e181d10.chunk.js → 4549.295531bf.chunk.js} +1 -1
- package/build/static/js/{4775.19ec4c25.chunk.js → 4775.124a71e4.chunk.js} +1 -1
- package/build/static/js/{4906.aced1b76.chunk.js → 4906.eb0403a8.chunk.js} +1 -1
- package/build/static/js/5015.c33215f2.chunk.js +1 -0
- package/build/static/js/{5526.1c49cfe0.chunk.js → 5526.7f392e7e.chunk.js} +2 -2
- package/build/static/js/{5526.1c49cfe0.chunk.js.LICENSE.txt → 5526.7f392e7e.chunk.js.LICENSE.txt} +1 -1
- package/build/static/js/{5672.19e3e3e6.chunk.js → 5672.71c6240f.chunk.js} +1 -1
- package/build/static/js/5760.02d5f257.chunk.js +1 -0
- package/build/static/js/{1494.35b60e8f.chunk.js → 5887.530ce24e.chunk.js} +2 -2
- package/build/static/js/5914.593c14f7.chunk.js +2 -0
- package/build/static/js/6016.036a6045.chunk.js +1 -0
- package/build/static/js/{6230.3ad32909.chunk.js → 6230.467a9016.chunk.js} +1 -1
- package/build/static/js/6511.44e20630.chunk.js +1 -0
- package/build/static/js/{6780.0338caf8.chunk.js → 6780.aa9fb3ec.chunk.js} +1 -1
- package/build/static/js/{6950.9b84af05.chunk.js → 6950.29776777.chunk.js} +1 -1
- package/build/static/js/7150.691b3551.chunk.js +1 -0
- package/build/static/js/7534.74be3785.chunk.js +1 -0
- package/build/static/js/{7657.ec1da0b4.chunk.js → 7657.60faa231.chunk.js} +2 -2
- package/build/static/js/7687.c54b6889.chunk.js +1 -0
- package/build/static/js/7875.c99786d4.chunk.js +2 -0
- package/build/static/js/{7913.2359b90e.chunk.js → 7913.6ff42e1a.chunk.js} +1 -1
- package/build/static/js/8537.687f4a57.chunk.js +1 -0
- package/build/static/js/9249.e1b97ff3.chunk.js +1 -0
- package/build/static/js/9327.cefafd96.chunk.js +1 -0
- package/build/static/js/9552.29d817f2.chunk.js +1 -0
- package/build/static/js/main.b030daf3.js +2 -0
- package/build/static/js/{main.24534c8b.js.LICENSE.txt → main.b030daf3.js.LICENSE.txt} +1 -1
- package/build/static/media/login-bg.9936fc84e60f5cea6739.png +0 -0
- package/package.json +1 -1
- package/build/static/js/1366.da3d7a8e.chunk.js +0 -2
- package/build/static/js/2435.88762f30.chunk.js +0 -1
- package/build/static/js/3883.5c4045b6.chunk.js +0 -1
- package/build/static/js/3896.de9209b2.chunk.js +0 -1
- package/build/static/js/4240.ecc8270b.chunk.js +0 -1
- package/build/static/js/4382.3efe04e3.chunk.js +0 -2
- package/build/static/js/4509.231da63f.chunk.js +0 -2
- package/build/static/js/4930.9bd4e54c.chunk.js +0 -2
- package/build/static/js/5396.56766685.chunk.js +0 -1
- package/build/static/js/5555.3e38d927.chunk.js +0 -1
- package/build/static/js/5760.82f7dc8f.chunk.js +0 -1
- package/build/static/js/6511.fbff9582.chunk.js +0 -1
- package/build/static/js/7150.ff7c498c.chunk.js +0 -1
- package/build/static/js/7534.c27466a0.chunk.js +0 -1
- package/build/static/js/7687.1a079d52.chunk.js +0 -1
- package/build/static/js/7706.74e51876.chunk.js +0 -2
- package/build/static/js/8537.b03e14a8.chunk.js +0 -1
- package/build/static/js/8585.b9c88d3c.chunk.js +0 -1
- package/build/static/js/9249.c5031d0b.chunk.js +0 -1
- package/build/static/js/9327.4b32dd25.chunk.js +0 -1
- package/build/static/js/9552.3effa95b.chunk.js +0 -1
- package/build/static/js/main.24534c8b.js +0 -2
- /package/build/static/js/{1366.da3d7a8e.chunk.js.LICENSE.txt → 1366.f2fe8ce7.chunk.js.LICENSE.txt} +0 -0
- /package/build/static/js/{1494.35b60e8f.chunk.js.LICENSE.txt → 4509.04d35bd4.chunk.js.LICENSE.txt} +0 -0
- /package/build/static/js/{4509.231da63f.chunk.js.LICENSE.txt → 5887.530ce24e.chunk.js.LICENSE.txt} +0 -0
- /package/build/static/js/{7706.74e51876.chunk.js.LICENSE.txt → 5914.593c14f7.chunk.js.LICENSE.txt} +0 -0
- /package/build/static/js/{7657.ec1da0b4.chunk.js.LICENSE.txt → 7657.60faa231.chunk.js.LICENSE.txt} +0 -0
- /package/build/static/js/{4930.9bd4e54c.chunk.js.LICENSE.txt → 7875.c99786d4.chunk.js.LICENSE.txt} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";(self.webpackChunk_abtnode_webapp=self.webpackChunk_abtnode_webapp||[]).push([[4775],{19371:function(e,n,t){var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(n,"__esModule",{value:!0}),n.splitNavigationBySection=n.flattenNavigation=n.checkLink=n.joinLink=n.cleanOrphanNavigation=n.filterNavigation=n.nestNavigationList=n.isMatchSection=n.deepWalk=n.parseNavigation=void 0;const o=i(t(10905)),a=i(t(50482)),l=i(t(8708)),r=i(t(3785)),s=i(t(24914)),c=i(t(25842)),d=i(t(6352)),u=i(t(56977)),m=i(t(6018)),v=t(65873),f=i(t(32828)),p=t(45239);Object.defineProperty(n,"checkLink",{enumerable:!0,get:function(){return p.checkLink}});const h="header",g="/",x="/",k="/";function b(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:()=>{},{key:t="children",order:i="first"}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!function e(o){let{index:a=0,parent:l=null,level:r=0}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Array.isArray(o)?o.forEach(((n,t)=>{e(n,{index:t,parent:l,level:r+1})})):o&&("first"===i&&n(o,l,{index:a,level:r}),e(o[t],{parent:o,level:r}),"last"===i&&n(o,l,{index:a,level:r}))}(e)}function j(e,n){return!(n!==h||!(0,r.default)(e))||(Array.isArray(e)?e.includes(n):e===n)}function y(e){try{return JSON.parse(e)}catch{return e}}function Z(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"/",n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";if((0,m.default)(n||""))return n;const t=u.default.join(e,n||x);return t.length>1&&t.endsWith("/")?t.slice(0,t.length-1):t}function L(e,n){let{strict:t=!0}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=e,o=n;if(t||(i=i||"/",o=o||"/"),(0,v.isObject)(i)&&(0,v.isString)(o)&&(0,p.checkLink)(o))return Object.keys(i).reduce(((e,n)=>(e[n]=Z(i[n],o),e)),{});if((0,v.isString)(i)&&(0,p.checkLink)(i)&&(0,v.isObject)(o))return Object.keys(o).reduce(((e,n)=>(e[n]=Z(i,o[n]),e)),{});if((0,v.isString)(i)&&(0,v.isString)(o))return(0,p.checkLink)(i)||(0,p.checkLink)(o)?Z(i,o):o;if((0,v.isObject)(i)&&(0,v.isObject)(o)){return[...new Set([...Object.keys(i),...Object.keys(o)])].reduce(((e,n)=>(e[n]=Z(i[n],o[n]),e)),{})}return o}function N(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],{depth:n=1,transform:t=(e=>e)}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const i=(0,c.default)(e),o=[];return b(i,((e,i,a)=>{let{level:l}=a;if(l>=n){const{items:n=[]}=e;if(n&&Array.isArray(n)&&n.length>0){delete e.items;const a=n.map((n=>t(n,e)));if(i)i.items.push(...a);else{const n=t((0,s.default)(e,["items"]),i);o.push(n,...a)}}else if(1===l){const n=t((0,s.default)(e,["items"]),i);o.push(n)}}else 1===l&&o.push(e)}),{key:"items",order:"last"}),o}function S(e,n){return n&&Array.isArray(e.items)?e.items.filter((t=>(0,r.default)(t.section)?j(e.section,n):!!j(t.section,n))).map((e=>({...e,section:n}))):[]}function w(e){const n=(0,c.default)(e),t=[];for(const i of n){const o=(0,c.default)((0,s.default)(i,["items"])),a=[];function l(e,n){const t=S(e,n);a.push({...o,section:n,items:t})}if(Array.isArray(i.section))for(const r of i.section)l(i,r);else if(i.section){const{section:d}=i;l(i,d)}else if(i.items&&i.items.length>0){const u=i.items.reduce(((e,n)=>{const{section:t=[h]}=n||{};return e.push(...t),e}),[]),m=[...new Set(u)];for(const v of m)l(i,v)}else a.push({...i,section:h});t.push(...a)}return t}function C(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];const n=(0,c.default)(e);return n.reduceRight(((e,t,i)=>{if(t.parent){const e=n.find((e=>t.section&&e.section?e.section===t.section&&e.id===t.parent:e.id===t.parent));e&&(e.items||(e.items=[]),e.items=[t,...e.items]),n.splice(i,1)}return null}),null),n}n.deepWalk=b,n.isMatchSection=j,n.joinLink=function(e,n){const t=(0,c.default)(e);return b(t,((e,t)=>{const i=e.component||e.child;if(i){const t=n.find((e=>e.name===i));t&&(e.link=L(t.link,e.link,{strict:!1}))}else t&&(e.link=L(t.link,e.link))}),{key:"items"}),t},n.flattenNavigation=N,n.splitNavigationBySection=w,n.nestNavigationList=C,n.filterNavigation=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];const t=C(e);return b(t,(e=>{if(null!==e&&void 0!==e&&e.component&&(n.some((n=>n.name===e.component))||(e.visible=!1)),e.items&&e.items.length)for(let n=e.items.length-1;n>=0;n--)!1===e.items[n].visible&&e.items.splice(n,1)}),{key:"items"}),t.filter((e=>{var n;return!1!==e.visible&&!(e.items&&Array.isArray(e.items)&&e.items.length>0&&null!==(n=e.items)&&void 0!==n&&n.every((e=>!1===e.visible)))}))},n.cleanOrphanNavigation=function(e){return e.map((e=>e.items&&Array.isArray(e.items)&&1===e.items.length&&["header","footer","",void 0,null].includes(e.section)?e.items[0]:e))},n.parseNavigation=function(){var e;let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{beforeProcess:i=(e=>e)}=t,{navigationList:r,components:s}=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=[],t=function t(i){var o,a;let l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const r=[],{children:s=[],meta:u={}}=i,m=(0,c.default)((null===u||void 0===u?void 0:u.navigation)||[]);(0,f.default)(u)&&!1!==(null===(o=i.meta)||void 0===o||null===(a=o.capabilities)||void 0===a?void 0:a.navigation)&&r.push(...m);const v=l.name||"",p=l.mountPoint||g,k=i===e?"":u.name||"",b=i===e?"":i.mountPoint||g;for(const e of s){var j,y,Z,L;if(!(0,f.default)(e.meta))continue;const i=e.meta.name,o=e.mountPoint,a=[v,k,i].filter(Boolean).join("."),l=e.meta.navigation||[],s=(0,d.default)(p,b,o);!1!==(null===(j=e.meta)||void 0===j||null===(y=j.capabilities)||void 0===y?void 0:y.navigation)&&n.push({did:e.meta.did,name:a,link:s,title:e.meta.title||"",navigation:l.map((e=>({section:h,...e})))});const c=m.find((e=>!!e.component&&e.component===i));if(c){if(!c.link)if(e.meta.navigation&&e.meta.navigation.length>0){const n=t(e,{mountPoint:b,name:k});var N;n.length>0&&(c.items=null!==(N=c.items)&&void 0!==N?N:[],c.items.push(...n))}else c.link=x}else if(!1!==(null===(Z=e.meta)||void 0===Z||null===(L=Z.capabilities)||void 0===L?void 0:L.navigation)){const n=t(e,{mountPoint:b,name:k}),o={title:e.meta.title,component:i,id:e.meta.did};n.length>0?(o.items=n,o.link=void 0):o.link=x,r.push(o)}}return r}(e);return{navigationList:t,components:n}}(n),u=(null===n||void 0===n||null===(e=n.settings)||void 0===e?void 0:e.navigations)||[],m=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;const t=N((0,c.default)(e),{depth:n,transform:(e,n)=>{var t;return n&&(e._parent||(e._parent=n.id,n.component||(e.link=L(n.link,e.link))),e.section=e.section||n.section||[h],e.visible=null!==(t=e.visible)&&void 0!==t?t:n.visible),e.component=[n.component,e.component].filter(Boolean).join("."),e}});return b(t,(e=>{e.items&&e.items.length>0&&e.items.reduceRight(((n,t)=>{if(t._parent){const n=e.items.findIndex((e=>e.id===t._parent));n>=0&&e.items.splice(n,1),delete t._parent}return null}),null)}),{key:"items"}),t}(i(r)),v=N(w(function(e){const n=(0,c.default)(e).filter((e=>e.id));return b(n,((e,n)=>{var t;if(e.items&&e.items.length){for(let n=e.items.length-1;n>=0;n--)e.items[n].id||e.items.splice(n,1);0===e.items.length&&e.component&&(e.link=e.link||x)}n&&(e.parent=n.id,e.id=[n.id,e.id].join(k)),e.from=e.from||"yaml",e.visible=null===(t=e.visible)||void 0===t||t}),{key:"items"}),n}(m)).reduce(((e,n)=>{const t=["bottom","social","sessionManager"].includes(n.section);let i=!1;const o=s.find((e=>"/"===e.link));if(o&&n.id===o.did&&(i=!0),t||i){if(n.items&&n.items.length>0)return e.push(...n.items.map((e=>{const{section:t}=n,i=L(n.link,e.link),o=[n.component,e.component].filter(Boolean).join(".");return{...e,section:t,link:i,component:o,parent:""}}))),e;if(i)return e}return e.push(n),e}),[]),{transform(e,n){let{component:t}=e;return null!==n&&void 0!==n&&n.component&&(t=[n.component,e.component].filter(Boolean).join(".")),{...e,component:t}}});return{navigationList:(0,o.default)(u.map((e=>{const n={...e};return n.role&&(n.role=y(n.role)),n.section&&(n.section=y(n.section)),n.title&&(n.title=y(n.title)),n.link&&(n.link=y(n.link)),n})),v,((e,n)=>{const t=["id","section"];return(0,a.default)((0,l.default)(e,t),(0,l.default)(n,t))})),components:s,builtinList:v}}},14775:(e,n,t)=>{t.r(n),t.d(n,{default:()=>dn});var i=t(5057),o=t(39948),a=t(56556),l=t(49127),r=t(80576),s=t(6041),c=t(74490),d=t(72904),u=t(25228),m=t(51177),v=t(95301),f=t(11750),p=t(39067),h=t(86229),g=t(55498),x=t(12673),k=t(13128),b=t(68420),j=t(61059),y=t(92706),Z=t.n(y),L=t(55898),N=t.n(L),S=t(17540),w=t(86272),C=t.n(w),P=t(26271),O=t.n(P),E=t(50482),A=t.n(E),R=t(20877),T=t(36095),_=t(96266);function M(e){let{prevPath:n,nextPath:t}=e;const i=n.length,o=t.length;return!(i!==o||!A()(n.slice(0,i-1),t.slice(0,o-1)))}function I(e){let{treeNode:n}=e;const{locale:t}=(0,b.PE)();return(0,_.jsxs)(_.Fragment,{children:[n.icon&&(0,_.jsx)(g.JO,{style:{marginRight:4},icon:n.icon}),function(){const{title:e,subtitle:a}=n;let l=e,r=a;return O()(e)&&(l=e[t]),!(0,i.isValidElement)(a)&&O()(a)&&(r=a[t]),(0,_.jsxs)(o.Z,{display:"flex",alignItems:"center",children:[(0,_.jsx)(f.Z,{variant:"subtitle1",fontSize:16,children:l}),a&&(0,_.jsx)(f.Z,{variant:"body2",color:"gray",ml:1.5,lineHeight:1,children:r})]})}()]})}function D(e){let{treeData:n,setTreeData:t,renderActions:i}=e;const o=n.map((e=>({...e,expanded:!0}))),a={};return"undefined"!==typeof window&&(a.context=window),(0,_.jsx)(T.W,{backend:R.HTML5Backend,...a,children:(0,_.jsx)(S.oP,{generateNodeProps:e=>({buttons:i({data:e.node,className:"list-item-actions"}),icons:(0,_.jsx)(g.JO,{icon:"ic:round-drag-indicator"}),title:(0,_.jsx)(I,{treeNode:e.node})}),maxDepth:2,isVirtualized:!1,treeData:o,onChange:t,canDrop:M,theme:C()})})}I.propTypes={treeNode:N().object.isRequired},D.propTypes={treeData:N().object.isRequired,setTreeData:N().func,renderActions:N().func},D.defaultProps={setTreeData:()=>{},renderActions:()=>{}};const W=D;var z=t(28726),J=t(63769),F=t(67680),B=t(53070),q=t(47020),G=t(41899),V=t(11251),K=t(24914),H=t.n(K),U=t(8708),Q=t.n(U),Y=t(82488),X=t.n(Y),$=t(78164),ee=t.n($),ne=t(75506),te=t.n(ne),ie=t(2765),oe=t.n(ie),ae=t(25842),le=t.n(ae),re=t(80506),se=t(19371),ce=t(6352),de=t.n(ce),ue=t(2842),me=t(6018),ve=t.n(me),fe=t(77277),pe=t(63838),he=t(65873),ge=t(27156),xe=t(23985),ke=t(11819),be=t(19654),je=t(90067),ye=t(44067),Ze=t(12594);function Le(e){let{fullWidth:n,multiple:t,required:i,label:a,placeholer:l,options:d,helperText:u,error:v,margin:p,...h}=e;const g=d.find((e=>e.value===h.value)),x=null===g||void 0===g?void 0:g.title;return(0,_.jsxs)(r.Z,{margin:p,fullWidth:n,error:v,children:[(0,_.jsx)(s.Z,{children:"".concat(a).concat(i?"*":"")}),(0,_.jsxs)(m.Z,{multiple:t,input:(0,_.jsx)(Ze.Z,{defaultValue:x,sx:{flex:1},required:i,label:a,inputProps:{margin:p}}),renderValue:e=>{if(t)return(0,_.jsx)(o.Z,{sx:{display:"flex",flexWrap:"wrap",gap:.5},children:e.map((e=>{const n=d.find((n=>n.value===e));return n&&n.title&&(0,_.jsx)(be.Z,{size:"small",label:n.title},e)}))});const n=d.find((n=>n.value===e));return n&&n.title&&(0,_.jsxs)(o.Z,{children:[(0,_.jsx)(f.Z,{component:"span",children:n.title}),(0,_.jsx)(f.Z,{marginLeft:1,component:"span",variant:"body2",color:"text.secondary",children:n.description})]})},...h,children:[(0,_.jsx)(c.Z,{disabled:!0,children:(0,_.jsx)("em",{children:l})}),!t&&(0,_.jsx)(c.Z,{value:"",children:"None"}),d.map((e=>e&&e.value&&(0,_.jsxs)(c.Z,{value:e.value,children:[(0,_.jsx)(ye.Z,{children:e.title}),e.description&&(0,_.jsx)(f.Z,{variant:"body2",color:"text.secondary",children:e.description})]},e.value)))]}),(0,_.jsx)(je.Z,{children:u})]})}Le.propTypes={error:N().bool,required:N().bool,multiple:N().bool,fullWidth:N().bool,label:N().string,placeholer:N().string,options:N().array,helperText:N().string,margin:N().string},Le.defaultProps={error:!1,required:!1,multiple:!1,fullWidth:!1,label:"",placeholer:"",options:[],helperText:"",margin:""};const Ne=Le,Se="en";function we(e){let{sx:n,onAdd:t,onChange:l,locales:r,localeMap:s,onRemoveLocale:c}=e;const{t:d}=(0,b.PE)(),u=(0,i.useRef)(),[m,v]=(0,i.useState)(null),p=(0,x.Z)({currentLocale:Se,localeList:[],inputLocale:"",localeError:""}),h=(0,i.useMemo)((()=>!!m),[m]),k=(0,i.useMemo)((()=>r.includes(p.currentLocale)?p.currentLocale:Se),[r,p.currentLocale]),j=(0,i.useMemo)((()=>Object.keys((0,he.omit)(s,[...p.localeList,Se])).map((e=>({title:s[e],value:e})))),[p.localeList]),y=(0,i.useMemo)((()=>{var e;const n=s[Se]||(null===(e=Object.values(s))||void 0===e?void 0:e[0]);return"Default (".concat(n,")")}),[s]);function Z(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";const n=function(e){return e?"en"!==e&&!p.localeList.includes(e)||d("navigation.form.localeExists",{value:e}):d("common.requiredErrorText",{name:"Locale"})}(null===e||void 0===e?void 0:e.trim());return p.localeError=!0!==n?n:"",n}function L(){var e;const n=null===(e=p.inputLocale)||void 0===e?void 0:e.trim();!0===Z(n)&&(N(),p.localeList.push(n),p.currentLocale=n,t(n))}function N(){v(null),p.inputLocale="",p.localeError=""}return(0,i.useEffect)((()=>{p.localeList=[...r]}),[r,p]),(0,pe.Z)("enter",(()=>{setTimeout((()=>{L()}))}),{target:u}),(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)(ge.Z,{sx:n,value:k,onChange:(e,n)=>{p.currentLocale=n,l(n)},children:[(0,_.jsx)(xe.Z,{label:y,value:"en"}),p.localeList.map((e=>(0,_.jsx)(xe.Z,{sx:{position:"relative"},label:(0,_.jsxs)(_.Fragment,{children:[s[e],(0,_.jsx)(F.Z,{size:"small",color:"inherit",sx:{position:"absolute",top:0,right:0},onClick:n=>{!function(e,n){e.preventDefault(),e.stopPropagation(),p.localeList=(0,he.without)(p.localeList,n),c(n),n===p.currentLocale&&(p.currentLocale=Se)}(n,e)},children:(0,_.jsx)(g.JO,{icon:"mdi:close",height:14})})]}),value:e},e))),(0,_.jsx)(F.Z,{color:"primary",disableFocusRipple:!0,sx:{width:"48px"},onClick:e=>{v(e.currentTarget)},children:(0,_.jsx)(g.JO,{icon:"mdi:plus"})})]}),(0,_.jsx)(ke.ZP,{open:h,anchorEl:m,onClose:N,anchorOrigin:{vertical:"bottom",horizontal:"left"},children:(0,_.jsxs)(o.Z,{sx:{p:2,width:"270px"},children:[(0,_.jsx)(f.Z,{variant:"subtitle2",children:d("navigation.form.localePlaceholder")}),(0,_.jsx)(o.Z,{mt:1,children:(0,_.jsx)(Ne,{required:!0,fullWidth:!0,label:"Locale",value:p.inputLocale,options:j,onChange:function(e){const{value:n}=e.target;Z(n),p.inputLocale=n},error:!!p.localeError,helperText:p.localeError||" "})}),(0,_.jsx)(o.Z,{display:"flex",justifyContent:"flex-end",children:(0,_.jsx)(a.Z,{size:"small",variant:"contained",onClick:L,children:d("common.confirm")})})]})})]})}we.propTypes={sx:N().any,onAdd:N().func,onChange:N().func,onRemoveLocale:N().func,localeMap:N().object,locales:N().array},we.defaultProps={sx:null,onAdd:()=>{},onChange:()=>{},onRemoveLocale:()=>{},localeMap:{},locales:[]};const Ce=we;var Pe=t(17425),Oe=t(29054);const Ee="en",Ae={title:{[Ee]:""},link:{[Ee]:""}};function Re(e){let{icon:n}=e;const[t,o]=(0,i.useState)(!1);return(0,G.Z)((async()=>{o(!1),await(0,g.GL)(n),o(!0)}),[n]),n?t?(0,_.jsx)(g.JO,{icon:n}):(0,_.jsx)(g.JO,{color:"#f06f6e",icon:"ic:baseline-error"}):(0,_.jsx)(g.JO,{icon:"codicon:blank"})}Re.propTypes={icon:N().string.isRequired};const Te=(0,i.forwardRef)((function(e,n){let{section:t,components:a,rawNavigations:l}=e;const{roles:s}=(0,Pe.DJ)(),{t:c,locale:d}=(0,b.PE)(),{blocklet:u}=(0,Oe.y0)(),m=(0,i.useMemo)((()=>{const e=u.environments.find((e=>"BLOCKLET_APP_LANGUAGES"===e.key));return(e?e.value.split(","):["en","zh"]).filter((e=>fe.SUPPORTED_LANGUAGES[e])).reduce(((e,n)=>(e[n]=fe.SUPPORTED_LANGUAGES[n].nativeName,e)),{})}),[u.environments]),v=(0,i.useRef)((()=>{})),[p,{setFalse:j,setTrue:y}]=(0,V.Z)(!1),Z=(0,x.Z)({isRoot:!0,type:"add",linkDisabled:!1,locale:Ee,formState:le()(Ae),get localeList(){return ee()(Object.keys(this.formState.title),Ee)}}),{handleSubmit:L,control:N,watch:S,setValue:w,clearErrors:C,formState:{errors:P}}=(0,re.cI)({mode:"onChange",defaultValues:{id:void 0,title:void 0,icon:void 0,link:void 0,component:void 0,parent:void 0,role:[]}});(0,i.useEffect)((()=>{w("title",Z.formState.title[Z.locale]),w("link",Z.formState.link[Z.locale])}),[w,Z.locale,p]);const E=S("component"),A=S("title"),R=S("link"),T=S("icon"),M=S("parent");(0,i.useEffect)((()=>{Z.formState.title[Z.locale]=A}),[A]),(0,i.useEffect)((()=>{Z.formState.link[Z.locale]=R}),[R]);const I=(0,i.useMemo)((()=>l.find((e=>{if(E){return a.find((e=>e.name===E)).did===e.id}return e.id===M}))),[a,l,E,M]),D=(0,i.useMemo)((()=>{if(null!==I&&void 0!==I&&I.component){const e=a.find((e=>e.name===I.component)),{link:n}=e||{},t=O()(n)?n[Z.locale]:n;if(E)return(0,ue.QT)(t);const i=O()(I.link)?I.link[Z.locale]:I.link;return(0,ue.QT)(de()(t,i||"/"))}return null}),[a,Z.locale,I,E]),W=(0,i.useMemo)((()=>{const{component:e}=I||{},n=a.find((n=>n.name===e)),{navigation:i=[]}=n||{};return(0,se.flattenNavigation)(i,{transform:(e,n)=>(null!==n&&void 0!==n&&n.section&&(e.section=e.section||n.section),e)}).filter((e=>e.link)).filter((e=>(0,se.isMatchSection)(e.section,t))).map((e=>({label:e.link,title:e.title[d]||e.title})))}),[I,a,t,d]),G=(0,i.useMemo)((()=>{const e={add:c("common.create"),edit:c("common.edit")}[Z.type];return e?"".concat(e," ").concat(c("navigation.navigation")):"--"}),[Z.type,c]),K=(0,i.useCallback)((()=>{Z.isRoot=!0,Z.locale=Ee,Z.type="add",Z.linkDisabled=!1,v.current=()=>{},w("id",void 0),w("icon",void 0),w("title",void 0),w("link",void 0),w("component",void 0),w("parent",void 0),w("role",[]),Z.formState=le()(Ae),C()}),[C,w,Z]),U=(0,i.useCallback)((function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Z.localeList.length>0&&(new Set(X()(Z.formState.title)).size>1&&(e.title=Z.formState.title),new Set(X()(Z.formState.link)).size>1&&(e.link=Z.formState.link)),te()(e.role)&&(e.role=void 0),e}),[Z.formState.link,Z.formState.title,Z.localeList]),Y=(0,i.useCallback)((()=>{j(),setTimeout((()=>{K()}))}),[K,j]),$=(0,i.useCallback)((function(){let{parent:e}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:()=>{};Z.type="add",Z.isRoot=!e,w("parent",null===e||void 0===e?void 0:e.id),v.current=e=>{n(Y,e)},y()}),[Y,y,w,Z]),ne=(0,i.useCallback)((function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:()=>{};const{id:t,title:i,icon:o,link:a,parent:l,component:r,role:s=[]}=e;w("id",t),w("icon",o),"tmpl"===e.from&&(Z.linkDisabled=!0),oe()(i)?Z.formState.title=Z.localeList.reduce(((e,n)=>(e[n]=i,e)),{[Ee]:i}):O()(i)?Z.formState.title=le()(i):Z.formState.title={},oe()(a)?Z.formState.link=Z.localeList.reduce(((e,n)=>(e[n]=a,e)),{[Ee]:a}):O()(a)?Z.formState.link=le()(a):Z.formState.link={},w("component",r),w("parent",l),w("role",s||[]),y(),Z.type="edit",Z.isRoot=!l,v.current=e=>{const t=Q()(e,["id","title","icon","link","role"]);n(Y,t)}}),[Y,y,w,Z]);function ie(e){const n=null===e||void 0===e?void 0:e.trim();return n?!(n.length>24)||c("navigation.form.titleTooLong",{len:24}):c("common.requiredErrorText",{name:c("navigation.form.title")})}function ae(e){const n=null===e||void 0===e?void 0:e.trim();return n?!!(0,se.checkLink)(n)||c("navigation.form.invalidLink"):!!Z.isRoot||c("common.requiredErrorText",{name:c("navigation.form.link")})}(0,i.useImperativeHandle)(n,(()=>({add:$,edit:ne,close:Y})),[$,Y,ne]);const ce=(0,i.useCallback)((e=>{Z.locale=e,Z.formState.title[e]||(Z.formState.title[e]=""),Z.formState.link[e]||(Z.formState.link[e]=""),setTimeout((()=>{C()}))}),[C,Z]),me=(0,i.useCallback)((()=>{const{title:e,link:n}=Z.formState;for(const t of Object.keys(e)){const n=ie(e[t]);if(!0!==n)return n}for(const t of Object.keys(n)){const e=ae(n[t]);if(!0!==e)return e}return!0}),[Z.formState]),pe=(0,i.useCallback)((e=>{const n=me();!0===n?v.current(U(e)):h.Z.error(n)}),[me,U]),he=(0,i.useCallback)((e=>{Z.formState.title=H()(Z.formState.title,e),Z.formState.link=H()(Z.formState.link,e)}),[Z.formState]),ge=(0,i.useCallback)((e=>{var n,t;Z.locale=e,Z.formState.title[e]=null===(n=Z.formState.title)||void 0===n?void 0:n[Ee],Z.formState.link[e]=null===(t=Z.formState.link)||void 0===t?void 0:t[Ee],setTimeout((()=>{C()}))}),[C,Z]);return(0,_.jsxs)(k.ZP,{open:p,title:G,onClose:Y,actions:(0,_.jsx)(z.Z,{onClick:L(pe),color:"primary",autoFocus:!0,variant:"contained",children:c("common.confirm")}),children:[(0,_.jsx)(Ce,{sx:{mb:1},onAdd:ge,onChange:ce,onRemoveLocale:he,localeMap:m,locales:Z.localeList}),(0,_.jsxs)("form",{noValidate:!0,autoComplete:"off",children:[(0,_.jsx)(re.Qr,{name:"title",control:N,rules:{validate:ie},render:e=>{var n,t;let{field:i}=e;return(0,_.jsx)(q.Z,{fullWidth:!0,variant:"outlined",margin:"dense",required:!0,placeholder:c("navigation.form.titlePlaceholder"),label:c("navigation.form.title"),disabled:Z.isEdit,error:!(null===P||void 0===P||null===(n=P.title)||void 0===n||!n.message),helperText:(null===P||void 0===P||null===(t=P.title)||void 0===t?void 0:t.message)||" ",...i})}}),(0,_.jsx)(re.Qr,{name:"icon",control:N,rules:{validate:async function(e){const n=null===e||void 0===e?void 0:e.trim();if(n)try{await(0,g.GL)(n)}catch{return c("navigation.form.invalidIcon")}return!0}},render:e=>{var n,t;let{field:i}=e;return(0,_.jsx)(q.Z,{fullWidth:!0,variant:"outlined",margin:"dense",placeholder:c("navigation.form.iconPlaceholder"),label:c("navigation.form.icon"),error:!(null===P||void 0===P||null===(n=P.icon)||void 0===n||!n.message),disabled:Z.locale!==Ee,helperText:(null===P||void 0===P||null===(t=P.icon)||void 0===t?void 0:t.message)||(0,_.jsx)(o.Z,{display:"flex",children:(0,_.jsxs)(o.Z,{component:"a",href:"https://icones.js.org",target:"_blank",display:"flex",alignItems:"center",children:[c("navigation.form.findMoreIcon")," ",(0,_.jsx)(g.JO,{style:{marginLeft:4},icon:"radix-icons:external-link"})]})}),...i,InputProps:{endAdornment:(0,_.jsx)(B.Z,{position:"end",children:(0,_.jsx)(F.Z,{sx:{cursor:"default"},disableFocusRipple:!0,disableRipple:!0,children:T&&(0,_.jsx)(Re,{icon:T})})})}})}}),Z.isRoot&&(0,_.jsx)(re.Qr,{name:"component",control:N,render:e=>{var n,t;let{field:i}=e;return(0,_.jsx)(Ne,{fullWidth:!0,margin:"dense",disabled:"edit"===Z.type||Z.locale!==Ee,label:c("navigation.form.component"),placeholer:c("navigation.form.componentPlaceholder"),options:a.map((e=>({title:e.title,value:e.name,description:e.link}))),error:!(null===P||void 0===P||null===(n=P.component)||void 0===n||!n.message),helperText:(null===P||void 0===P||null===(t=P.component)||void 0===t?void 0:t.message)||" ",...H()(i,"ref")})}}),(0,_.jsx)(re.Qr,{name:"link",control:N,rules:{validate:ae},render:e=>{let{field:n}=e;return(0,_.jsx)(r.Z,{fullWidth:!0,margin:"dense",children:(0,_.jsx)(J.Z,{disablePortal:!0,freeSolo:!0,blurOnSelect:!0,autoSelect:!0,fullWidth:!0,disabled:Z.linkDisabled,isOptionEqualToValue:e=>e.label,options:W,renderInput:e=>{var n,t;return(0,_.jsx)(q.Z,{...e,placeholder:c("navigation.form.linkPlaceholder"),label:c("navigation.form.link"),error:!(null===P||void 0===P||null===(n=P.link)||void 0===n||!n.message),helperText:(null===P||void 0===P||null===(t=P.link)||void 0===t?void 0:t.message)||"/abc/bcd or /abc or https://arcblock.io",InputProps:{startAdornment:D?(0,_.jsx)(B.Z,{position:"start",sx:{textDecoration:ve()(R||"")?"line-through":""},children:D}):null}})},renderOption:(e,n)=>(0,_.jsxs)(o.Z,{component:"li",...e,children:[n.label,(0,_.jsx)(f.Z,{marginLeft:1,component:"span",variant:"body2",color:"text.secondary",children:n.title})]}),margin:"dense",...n,onChange:()=>{},onInputChange:(e,t)=>{n.onChange(t)}})})}}),["dashboard","sessionManager"].includes(t)&&(0,_.jsx)(re.Qr,{name:"role",control:N,render:e=>{var n,t;let{field:i}=e;return(0,_.jsx)(Ne,{fullWidth:!0,multiple:!0,margin:"dense",label:c("navigation.form.role"),placeholer:c("navigation.form.rolePlaceholder"),options:s.map((e=>({title:e.title,value:e.name}))),error:!(null===P||void 0===P||null===(n=P.role)||void 0===n||!n.message),helperText:(null===P||void 0===P||null===(t=P.role)||void 0===t?void 0:t.message)||" ",...H()(i,"ref")})}})]})]})}));Te.propTypes={section:N().string,components:N().array,rawNavigations:N().array},Te.defaultProps={section:"",components:[],rawNavigations:[]};const _e=Te;function Me(e){let{className:n,add:t,edit:o,toggle:a,del:l,data:r,section:s}=e;const{t:c}=(0,b.PE)(),d=["yaml","tmpl"].includes(r.from),u=(0,i.isValidElement)(r.subtitle);function m(e){e.preventDefault(),e.stopPropagation()}const v=(0,i.useCallback)((e=>{m(e),t(r)}),[t,r]),f=(0,i.useCallback)((e=>{m(e),o(r)}),[o,r]),p=(0,i.useCallback)((e=>{m(e),a(r)}),[a,r]),h=(0,i.useCallback)((e=>{m(e),l(r)}),[l,r]);return(0,_.jsxs)("div",{className:n,children:[!r.parent&&["header","footer","dashboard"].includes(s)&&(0,_.jsx)("span",{title:c(u?"navigation.action.noAddSub":"navigation.action.addSub"),children:(0,_.jsx)(F.Z,{size:"small",color:"success",onClick:v,disabled:u,children:(0,_.jsx)(g.JO,{icon:"mdi:plus-box-outline"})})}),(0,_.jsx)("span",{title:c(u?"navigation.action.noEdit":"navigation.action.edit"),children:(0,_.jsx)(F.Z,{size:"small",color:"primary",onClick:f,disabled:u,children:(0,_.jsx)(g.JO,{icon:"mdi:pencil"})})}),(0,_.jsx)("span",{title:u?c("navigation.action.noEdit"):r.visible?c("navigation.action.hide"):c("navigation.action.show"),children:(0,_.jsx)(F.Z,{size:"small",color:"warning",onClick:p,disabled:u,children:!1===r.visible?(0,_.jsx)(g.JO,{icon:"mdi:eye-off-outline"}):(0,_.jsx)(g.JO,{icon:"mdi:eye-outline"})})}),(0,_.jsx)("span",{title:c(d&&!u?"navigation.action.noDel":"navigation.action.del"),children:(0,_.jsx)(F.Z,{disabled:d&&!u,size:"small",color:"error",onClick:h,children:(0,_.jsx)(g.JO,{icon:"mdi:delete"})})})]})}Me.propTypes={data:N().object.isRequired,className:N().string,add:N().func,edit:N().func,toggle:N().func,del:N().func,section:N().string},Me.defaultProps={className:"",add:()=>{},edit:()=>{},toggle:()=>{},del:()=>{},section:""};const Ie=Me;var De=t(3785),We=t.n(De),ze=t(79683),Je=t.n(ze),Fe=t(35432),Be=t(14491);const qe="/",Ge="header",Ve={sessionManager:[{id:"/sessionManager",title:{en:"Manage",zh:"\u7ba1\u7406"},section:["sessionManager"],icon:"ion:settings-outline",link:"".concat(Fe.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(Fe.WELLKNOWN_SERVICE_PATH_PREFIX,"/admin/members"),from:"tmpl"},{id:"passport",title:{en:"Passport",zh:"\u901a\u884c\u8bc1"},icon:"icon-park-outline:passport",link:"".concat(Fe.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(Fe.WELLKNOWN_SERVICE_PATH_PREFIX,"/admin"),from:"tmpl"}]}]};function Ke(e,n){return e.section&&n.section?e.section===n.section&&e.id===n.id:e.id===n.id}function He(){const{blocklet:e,actions:n}=(0,Oe.y0)(),{navigationList:t,components:o,builtinList:a}=(0,se.parseNavigation)(e,{beforeProcess(e){const n=le()(e);return Ve.dashboard.forEach((e=>{n.some((n=>n.id===e.id))||n.push(e)})),n.some((e=>e.id&&(e.section||[]).includes("sessionManager")))||n.push(...Ve.sessionManager),n}}),l=(0,x.Z)({rawNavigation:le()(t),activeSection:Ge,components:o}),r=(0,i.useMemo)((()=>(0,se.nestNavigationList)(l.rawNavigation)),[l.rawNavigation]),s=(0,i.useMemo)((()=>{const e=(0,se.filterNavigation)(l.rawNavigation,o),n=(0,se.joinLink)(e,o);return(0,se.cleanOrphanNavigation)(n)}),[o,l.rawNavigation]);function c(e){if(!e.id)return"";const n=(0,se.flattenNavigation)((0,se.joinLink)(r,o)),t=n.find((n=>n.id===e.id));function i(e){let{name:n}=e;return(0,_.jsx)(be.Z,{label:"Uninstalled: ".concat(n),color:"error",size:"small",variant:"outlined",sx:{fontSize:10,height:20}})}if(null!==t&&void 0!==t&&t.component){if(!o.some((e=>e.name===t.component)))return(0,_.jsx)(i,{name:t.component})}else if(t.parent){const e=n.find((e=>e.id===t.parent));if(null!==e&&void 0!==e&&e.component&&!o.some((n=>n.name===e.component)))return(0,_.jsx)(i,{name:e.component})}return null===t||void 0===t?void 0:t.link}function d(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:qe;return e.map((e=>{const t=o.find((n=>n.name===e.component)),i=(null===t||void 0===t?void 0:t.link)||n,a=e.items||[],{link:l}=e;return{title:e.title,subtitle:c(e),link:l,icon:e.icon,children:d(a,l||qe),section:e.section,visible:e.visible,parent:e.parent,component:e.component,id:e.id,role:e.role,from:e.from,__base:i}}))}async function u(e){const t=e.map((e=>Je()(e,We()))).map((e=>{const n={...e};return n.role&&Array.isArray(n.role)&&(n.role=JSON.stringify(n.role)),n.section&&Array.isArray(n.section)&&(n.section=JSON.stringify(n.section)),n.title&&n.title instanceof Object&&(n.title=JSON.stringify(n.title)),n.link&&n.link instanceof Object&&(n.link=JSON.stringify(n.link)),n}));await n.configNavigations(t)}return{state:l,navigation:s,components:o,getNavigationFullLink:c,updateActiveSection:function(e){l.activeSection=e},updateNavigationItem:function(e){!function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];const n=l.rawNavigation.map((n=>{const t=e.find((e=>Ke({...e,section:l.activeSection},n)));return t?{...n,...t}:n}));l.rawNavigation=n}([e])},delNavigationItem:function(e){const n=l.rawNavigation.filter((n=>n.id===e||n.parent===e)).map((e=>e.id));l.rawNavigation=l.rawNavigation.filter((e=>!n.includes(e.id)))},addNavigationItem:function(){const e={...arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},id:(0,Be.x0)(),section:l.activeSection,visible:!0};l.rawNavigation=[...l.rawNavigation,e]},updateNavigationTree:function(e){const n=[];(0,se.deepWalk)(e,((e,t)=>{const i={...H()(e,["children","expand"]),parent:null===t||void 0===t?void 0:t.id};n.push(i)}));const t=l.rawNavigation.filter((e=>{if(!l.activeSection)return!1;const t=n.find((n=>Ke(n,e)));return!t||!(0,se.isMatchSection)(t.section,l.activeSection)}));l.rawNavigation=[...t,...n]},getNavigation:function(e){return d(le()(r).filter((n=>(0,se.isMatchSection)(n.section,e))))},saveNavigationList:u,resetNavigation:async function(){await u([]),l.rawNavigation=le()(a)}}}var Ue,Qe=t(71171),Ye=t(1192),Xe=t(2484),$e=t(5873),en=t(88764),nn=t(55402),tn=t(5939),on=t(33518),an=t(49522);function ln(e){var n,t,i,a;let{className:l,navigation:r}=e;const{blocklet:s}=(0,Oe.y0)(),{logoUrl:c}=(0,an.Z)({blocklet:s}),d=null===s||void 0===s||null===(n=s.environments)||void 0===n||null===(t=n.find((e=>e.key===fe.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_COPYRIGHT_OWNER)))||void 0===t?void 0:t.value,u=null===s||void 0===s||null===(i=s.environments)||void 0===i||null===(a=i.find((e=>e.key===fe.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_COPYRIGHT_YEAR)))||void 0===a?void 0:a.value,m=d||u?{owner:d,year:u}:void 0,v={appId:s.appDid,appLogo:c,appName:s.meta.title,enableConnect:!0,enableLocale:!1,navigation:r,copyright:m};return(0,_.jsx)(en.Z,{children:(0,_.jsxs)(o.Z,{className:l,children:[(0,_.jsx)(Ye.Z,{meta:v}),(0,_.jsx)(o.Z,{children:(0,_.jsx)($e.Z,{meta:v,invalidPathFallback:()=>{},headerProps:{style:{display:"none"}},children:(0,_.jsx)(nn.ZP,{container:!0,spacing:2,children:new Array(6).fill().map(((e,n)=>(0,_.jsxs)(nn.ZP,{item:!0,xs:4,children:[(0,_.jsx)(tn.Z,{animation:!1,variant:"rectangular",width:"100%",height:120}),(0,_.jsxs)(o.Z,{sx:{pt:.5},children:[(0,_.jsx)(tn.Z,{animation:!1}),(0,_.jsx)(tn.Z,{width:"60%",animation:!1})]})]},n)))})})}),(0,_.jsx)(Xe.Z,{meta:v})]})})}ln.propTypes={className:N().string,navigation:N().array},ln.defaultProps={className:"",navigation:[]};const rn=(0,on.Z)(ln)(Ue||(Ue=(0,Qe.Z)(["\n .dashboard {\n height: auto !important;\n }\n .dashboard-content + div {\n display: none;\n }\n"]))),sn={login:Z(),logout:Z(),switch:Z(),switchDid:Z(),switchProfile:Z(),switchPassport:Z(),useDid:()=>({walletDid:"abcdefghijklmnopqrstuvwxyz"}),useOAuth:()=>({logoutOAuth:Z(),bindOAuth:Z(),configs:{},switchOAuthPassport:Z()})},cn={header:"Header",footer:"Footer",bottom:"Footer Link",social:"Footer Social",dashboard:"Dashboard",sessionManager:"SessionManager"};const dn=function(){const{t:e}=(0,b.PE)(),{blocklet:n}=(0,Oe.y0)(),t=(0,i.useRef)(null),{roles:y}=(0,Pe.DJ)(),Z=(0,d.Z)((e=>e.breakpoints.down("md"))),L=(0,x.Z)({saveLoading:!1,resetLoading:!1,showResetConfirm:!1,mockRole:"owner"}),{state:N,navigation:S,getNavigation:w,saveNavigationList:C,resetNavigation:P,updateActiveSection:O,updateNavigationTree:E,updateNavigationItem:A,delNavigationItem:R,addNavigationItem:T}=He(),M=(0,i.useCallback)((e=>{t.current.add({parent:e},((e,n)=>{T(n),e()}))}),[T]),I=(0,i.useCallback)((function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};switch(e){case"edit":t.current.edit(n,((e,n)=>{A(n),e()}));break;case"toggle":A({id:n.id,visible:!n.visible});break;case"del":R(n.id)}}),[R,A]),D=(0,i.useCallback)((async()=>{try{L.saveLoading=!0,await C(N.rawNavigation),h.Z.success(e("common.succeeded"))}catch(n){h.Z.error((0,_.jsxs)(o.Z,{children:[(0,_.jsx)(f.Z,{variant:"subtitle2",children:e("navigation.actionFailed")}),(0,_.jsx)(f.Z,{variant:"body1",children:(0,Be.Z)(n)||n.error})]}))}finally{L.saveLoading=!1}}),[N.rawNavigation,L,C,e]),z=(0,i.useCallback)((async()=>{try{L.resetLoading=!0,await P(),h.Z.success(e("navigation.action.resetSuccessful"),{variant:"success"})}catch(n){h.Z.error((0,_.jsxs)(o.Z,{children:[(0,_.jsx)(f.Z,{variant:"subtitle2",children:e("navigation.actionFailed")}),(0,_.jsx)(f.Z,{variant:"body1",children:(0,Be.Z)(n)||n.error})]}))}finally{L.resetLoading=!1}}),[L,P,e]),J=(0,i.useMemo)((()=>({session:{...sn,user:{did:n.appDid,fullName:"Preview User",role:L.mockRole}}})),[n.appDid,L.mockRole]);return(0,_.jsxs)(_.Fragment,{children:[Z&&(0,_.jsx)(m.Z,{fullWidth:!0,size:"small",value:N.activeSection,onChange:e=>O(e.target.value),children:Object.keys(cn).map((e=>(0,_.jsxs)(c.Z,{value:e,children:[cn[e]," (".concat(w(e).length,")")]})))}),!Z&&(0,_.jsx)(l.Z,{variant:"outlined",children:Object.keys(cn).map((e=>(0,_.jsxs)(a.Z,{variant:N.activeSection===e?"contained":void 0,onClick:()=>O(e),children:[cn[e]," (".concat(w(e).length,")")]},e)))}),(0,_.jsxs)(v.Z,{variant:"dense",sx:{paddingLeft:"0px !important",paddingRight:"0px !important",mt:2},children:[(0,_.jsx)(f.Z,{variant:"h6",component:"div",sx:{flexGrow:1},children:e("common.config")}),(0,_.jsx)(l.Z,{variant:"outlined",children:(0,_.jsx)(p.Z,{size:"small",variant:"outlined",color:"error",startIcon:(0,_.jsx)(g.JO,{icon:"system-uicons:reset"}),sx:{mr:2},loading:L.resetLoading,loadingPosition:"start",onClick:()=>{L.showResetConfirm=!0},children:e("navigation.action.reset")})}),(0,_.jsxs)(l.Z,{variant:"outlined",children:[(0,_.jsx)(a.Z,{size:"small",variant:"outlined",startIcon:(0,_.jsx)(g.JO,{icon:"mdi:plus"}),onClick:()=>M(),children:e("navigation.action.new")}),(0,_.jsx)(p.Z,{size:"small",variant:"contained",startIcon:(0,_.jsx)(g.JO,{icon:"mdi:content-save"}),loading:L.saveLoading,loadingPosition:"start",onClick:D,children:e("common.save")})]})]}),(0,_.jsx)(u.Z,{variant:"outlined",sx:{display:"flex",height:280,overflow:"hidden"},children:(0,_.jsx)(u.Z,{elevation:0,sx:{flex:1,overflow:"auto"},children:(0,_.jsx)(W,{treeData:w(N.activeSection),setTreeData:E,renderActions:e=>{let{data:n,className:t}=e;return(0,_.jsx)(Ie,{data:n,className:t,section:N.activeSection,add:function(){return M(...arguments)},del:function(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++)n[t]=arguments[t];return I("del",...n)},edit:function(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++)n[t]=arguments[t];return I("edit",...n)},toggle:function(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++)n[t]=arguments[t];return I("toggle",...n)}})}})})}),(0,_.jsxs)(v.Z,{variant:"dense",sx:{paddingLeft:"0px !important",paddingRight:"0px !important",mt:3},children:[(0,_.jsx)(f.Z,{variant:"h6",component:"div",sx:{flexGrow:1},children:e("common.preview")}),(0,_.jsxs)(r.Z,{sx:{m:1,minWidth:120},size:"small",children:[(0,_.jsx)(s.Z,{children:e("common.role")}),(0,_.jsx)(m.Z,{value:L.mockRole,label:"Role",onChange:e=>{L.mockRole=e.target.value},children:y.map((e=>(0,_.jsx)(c.Z,{value:e.name,children:e.title},e.name)))})]})]}),(0,_.jsx)(u.Z,{variant:"outlined",children:(0,_.jsx)(j.B3.Provider,{value:J,children:(0,_.jsx)(rn,{navigation:S})})}),(0,_.jsx)(_e,{ref:t,section:N.activeSection,components:N.components,rawNavigations:N.rawNavigation}),(0,_.jsx)(k.I4,{confirmButton:{text:e("common.confirm"),props:{variant:"contained",color:"error"}},cancelButton:{text:e("common.cancel"),props:{color:"primary"}},open:L.showResetConfirm,title:e("navigation.action.restConfirmTitle"),onConfirm:async()=>{await z(),L.showResetConfirm=!1},onCancel:()=>{L.showResetConfirm=!1},children:(0,_.jsx)("p",{children:e("navigation.action.restConfirmDesc")})})]})}}}]);
|
|
1
|
+
"use strict";(self.webpackChunk_abtnode_webapp=self.webpackChunk_abtnode_webapp||[]).push([[4775],{19371:function(e,n,t){var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(n,"__esModule",{value:!0}),n.splitNavigationBySection=n.flattenNavigation=n.checkLink=n.joinLink=n.cleanOrphanNavigation=n.filterNavigation=n.nestNavigationList=n.isMatchSection=n.deepWalk=n.parseNavigation=void 0;const o=i(t(10905)),a=i(t(50482)),l=i(t(8708)),r=i(t(3785)),s=i(t(24914)),c=i(t(25842)),d=i(t(6352)),u=i(t(56977)),m=i(t(6018)),v=t(65873),f=i(t(32828)),p=t(45239);Object.defineProperty(n,"checkLink",{enumerable:!0,get:function(){return p.checkLink}});const h="header",g="/",x="/",k="/";function b(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:()=>{},{key:t="children",order:i="first"}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!function e(o){let{index:a=0,parent:l=null,level:r=0}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Array.isArray(o)?o.forEach(((n,t)=>{e(n,{index:t,parent:l,level:r+1})})):o&&("first"===i&&n(o,l,{index:a,level:r}),e(o[t],{parent:o,level:r}),"last"===i&&n(o,l,{index:a,level:r}))}(e)}function j(e,n){return!(n!==h||!(0,r.default)(e))||(Array.isArray(e)?e.includes(n):e===n)}function y(e){try{return JSON.parse(e)}catch{return e}}function Z(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"/",n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";if((0,m.default)(n||""))return n;const t=u.default.join(e,n||x);return t.length>1&&t.endsWith("/")?t.slice(0,t.length-1):t}function L(e,n){let{strict:t=!0}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=e,o=n;if(t||(i=i||"/",o=o||"/"),(0,v.isObject)(i)&&(0,v.isString)(o)&&(0,p.checkLink)(o))return Object.keys(i).reduce(((e,n)=>(e[n]=Z(i[n],o),e)),{});if((0,v.isString)(i)&&(0,p.checkLink)(i)&&(0,v.isObject)(o))return Object.keys(o).reduce(((e,n)=>(e[n]=Z(i,o[n]),e)),{});if((0,v.isString)(i)&&(0,v.isString)(o))return(0,p.checkLink)(i)||(0,p.checkLink)(o)?Z(i,o):o;if((0,v.isObject)(i)&&(0,v.isObject)(o)){return[...new Set([...Object.keys(i),...Object.keys(o)])].reduce(((e,n)=>(e[n]=Z(i[n],o[n]),e)),{})}return o}function N(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],{depth:n=1,transform:t=(e=>e)}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const i=(0,c.default)(e),o=[];return b(i,((e,i,a)=>{let{level:l}=a;if(l>=n){const{items:n=[]}=e;if(n&&Array.isArray(n)&&n.length>0){delete e.items;const a=n.map((n=>t(n,e)));if(i)i.items.push(...a);else{const n=t((0,s.default)(e,["items"]),i);o.push(n,...a)}}else if(1===l){const n=t((0,s.default)(e,["items"]),i);o.push(n)}}else 1===l&&o.push(e)}),{key:"items",order:"last"}),o}function S(e,n){return n&&Array.isArray(e.items)?e.items.filter((t=>(0,r.default)(t.section)?j(e.section,n):!!j(t.section,n))).map((e=>({...e,section:n}))):[]}function w(e){const n=(0,c.default)(e),t=[];for(const i of n){const o=(0,c.default)((0,s.default)(i,["items"])),a=[];function l(e,n){const t=S(e,n);a.push({...o,section:n,items:t})}if(Array.isArray(i.section))for(const r of i.section)l(i,r);else if(i.section){const{section:d}=i;l(i,d)}else if(i.items&&i.items.length>0){const u=i.items.reduce(((e,n)=>{const{section:t=[h]}=n||{};return e.push(...t),e}),[]),m=[...new Set(u)];for(const v of m)l(i,v)}else a.push({...i,section:h});t.push(...a)}return t}function C(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];const n=(0,c.default)(e);return n.reduceRight(((e,t,i)=>{if(t.parent){const e=n.find((e=>t.section&&e.section?e.section===t.section&&e.id===t.parent:e.id===t.parent));e&&(e.items||(e.items=[]),e.items=[t,...e.items]),n.splice(i,1)}return null}),null),n}n.deepWalk=b,n.isMatchSection=j,n.joinLink=function(e,n){const t=(0,c.default)(e);return b(t,((e,t)=>{const i=e.component||e.child;if(i){const t=n.find((e=>e.name===i));t&&(e.link=L(t.link,e.link,{strict:!1}))}else t&&(e.link=L(t.link,e.link))}),{key:"items"}),t},n.flattenNavigation=N,n.splitNavigationBySection=w,n.nestNavigationList=C,n.filterNavigation=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];const t=C(e);return b(t,(e=>{if(null!==e&&void 0!==e&&e.component&&(n.some((n=>n.name===e.component))||(e.visible=!1)),e.items&&e.items.length)for(let n=e.items.length-1;n>=0;n--)!1===e.items[n].visible&&e.items.splice(n,1)}),{key:"items"}),t.filter((e=>{var n;return!1!==e.visible&&!(e.items&&Array.isArray(e.items)&&e.items.length>0&&null!==(n=e.items)&&void 0!==n&&n.every((e=>!1===e.visible)))}))},n.cleanOrphanNavigation=function(e){return e.map((e=>e.items&&Array.isArray(e.items)&&1===e.items.length&&["header","footer","",void 0,null].includes(e.section)?e.items[0]:e))},n.parseNavigation=function(){var e;let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{beforeProcess:i=(e=>e)}=t,{navigationList:r,components:s}=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=[],t=function t(i){var o,a;let l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const r=[],{children:s=[],meta:u={}}=i,m=(0,c.default)((null===u||void 0===u?void 0:u.navigation)||[]);(0,f.default)(u)&&!1!==(null===(o=i.meta)||void 0===o||null===(a=o.capabilities)||void 0===a?void 0:a.navigation)&&r.push(...m);const v=l.name||"",p=l.mountPoint||g,k=i===e?"":u.name||"",b=i===e?"":i.mountPoint||g;for(const e of s){var j,y,Z,L;if(!(0,f.default)(e.meta))continue;const i=e.meta.name,o=e.mountPoint,a=[v,k,i].filter(Boolean).join("."),l=e.meta.navigation||[],s=(0,d.default)(p,b,o);!1!==(null===(j=e.meta)||void 0===j||null===(y=j.capabilities)||void 0===y?void 0:y.navigation)&&n.push({did:e.meta.did,name:a,link:s,title:e.meta.title||"",navigation:l.map((e=>({section:h,...e})))});const c=m.find((e=>!!e.component&&e.component===i));if(c){if(!c.link)if(e.meta.navigation&&e.meta.navigation.length>0){const n=t(e,{mountPoint:b,name:k});var N;n.length>0&&(c.items=null!==(N=c.items)&&void 0!==N?N:[],c.items.push(...n))}else c.link=x}else if(!1!==(null===(Z=e.meta)||void 0===Z||null===(L=Z.capabilities)||void 0===L?void 0:L.navigation)){const n=t(e,{mountPoint:b,name:k}),o={title:e.meta.title,component:i,id:e.meta.did};n.length>0?(o.items=n,o.link=void 0):o.link=x,r.push(o)}}return r}(e);return{navigationList:t,components:n}}(n),u=(null===n||void 0===n||null===(e=n.settings)||void 0===e?void 0:e.navigations)||[],m=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;const t=N((0,c.default)(e),{depth:n,transform:(e,n)=>{var t;return n&&(e._parent||(e._parent=n.id,n.component||(e.link=L(n.link,e.link))),e.section=e.section||n.section||[h],e.visible=null!==(t=e.visible)&&void 0!==t?t:n.visible),e.component=[n.component,e.component].filter(Boolean).join("."),e}});return b(t,(e=>{e.items&&e.items.length>0&&e.items.reduceRight(((n,t)=>{if(t._parent){const n=e.items.findIndex((e=>e.id===t._parent));n>=0&&e.items.splice(n,1),delete t._parent}return null}),null)}),{key:"items"}),t}(i(r)),v=N(w(function(e){const n=(0,c.default)(e).filter((e=>e.id));return b(n,((e,n)=>{var t;if(e.items&&e.items.length){for(let n=e.items.length-1;n>=0;n--)e.items[n].id||e.items.splice(n,1);0===e.items.length&&e.component&&(e.link=e.link||x)}n&&(e.parent=n.id,e.id=[n.id,e.id].join(k)),e.from=e.from||"yaml",e.visible=null===(t=e.visible)||void 0===t||t}),{key:"items"}),n}(m)).reduce(((e,n)=>{const t=["bottom","social","sessionManager"].includes(n.section);let i=!1;const o=s.find((e=>"/"===e.link));if(o&&n.id===o.did&&(i=!0),t||i){if(n.items&&n.items.length>0)return e.push(...n.items.map((e=>{const{section:t}=n,i=L(n.link,e.link),o=[n.component,e.component].filter(Boolean).join(".");return{...e,section:t,link:i,component:o,parent:""}}))),e;if(i)return e}return e.push(n),e}),[]),{transform(e,n){let{component:t}=e;return null!==n&&void 0!==n&&n.component&&(t=[n.component,e.component].filter(Boolean).join(".")),{...e,component:t}}});return{navigationList:(0,o.default)(u.map((e=>{const n={...e};return n.role&&(n.role=y(n.role)),n.section&&(n.section=y(n.section)),n.title&&(n.title=y(n.title)),n.link&&(n.link=y(n.link)),n})),v,((e,n)=>{const t=["id","section"];return(0,a.default)((0,l.default)(e,t),(0,l.default)(n,t))})),components:s,builtinList:v}}},14775:(e,n,t)=>{t.r(n),t.d(n,{default:()=>dn});var i=t(5057),o=t(39948),a=t(56556),l=t(49127),r=t(80576),s=t(6041),c=t(74490),d=t(72904),u=t(25228),m=t(51177),v=t(95301),f=t(11750),p=t(39067),h=t(86229),g=t(55498),x=t(12673),k=t(13128),b=t(68420),j=t(97721),y=t(92706),Z=t.n(y),L=t(55898),N=t.n(L),S=t(17540),w=t(86272),C=t.n(w),P=t(26271),O=t.n(P),E=t(50482),A=t.n(E),R=t(20877),T=t(36095),_=t(96266);function M(e){let{prevPath:n,nextPath:t}=e;const i=n.length,o=t.length;return!(i!==o||!A()(n.slice(0,i-1),t.slice(0,o-1)))}function I(e){let{treeNode:n}=e;const{locale:t}=(0,b.PE)();return(0,_.jsxs)(_.Fragment,{children:[n.icon&&(0,_.jsx)(g.JO,{style:{marginRight:4},icon:n.icon}),function(){const{title:e,subtitle:a}=n;let l=e,r=a;return O()(e)&&(l=e[t]),!(0,i.isValidElement)(a)&&O()(a)&&(r=a[t]),(0,_.jsxs)(o.Z,{display:"flex",alignItems:"center",children:[(0,_.jsx)(f.Z,{variant:"subtitle1",fontSize:16,children:l}),a&&(0,_.jsx)(f.Z,{variant:"body2",color:"gray",ml:1.5,lineHeight:1,children:r})]})}()]})}function D(e){let{treeData:n,setTreeData:t,renderActions:i}=e;const o=n.map((e=>({...e,expanded:!0}))),a={};return"undefined"!==typeof window&&(a.context=window),(0,_.jsx)(T.W,{backend:R.HTML5Backend,...a,children:(0,_.jsx)(S.oP,{generateNodeProps:e=>({buttons:i({data:e.node,className:"list-item-actions"}),icons:(0,_.jsx)(g.JO,{icon:"ic:round-drag-indicator"}),title:(0,_.jsx)(I,{treeNode:e.node})}),maxDepth:2,isVirtualized:!1,treeData:o,onChange:t,canDrop:M,theme:C()})})}I.propTypes={treeNode:N().object.isRequired},D.propTypes={treeData:N().object.isRequired,setTreeData:N().func,renderActions:N().func},D.defaultProps={setTreeData:()=>{},renderActions:()=>{}};const W=D;var z=t(28726),J=t(63769),F=t(67680),B=t(53070),q=t(47020),G=t(41899),V=t(11251),K=t(24914),H=t.n(K),U=t(8708),Q=t.n(U),Y=t(82488),X=t.n(Y),$=t(78164),ee=t.n($),ne=t(75506),te=t.n(ne),ie=t(2765),oe=t.n(ie),ae=t(25842),le=t.n(ae),re=t(80506),se=t(19371),ce=t(6352),de=t.n(ce),ue=t(2842),me=t(6018),ve=t.n(me),fe=t(77277),pe=t(63838),he=t(65873),ge=t(27156),xe=t(23985),ke=t(11819),be=t(19654),je=t(90067),ye=t(44067),Ze=t(12594);function Le(e){let{fullWidth:n,multiple:t,required:i,label:a,placeholer:l,options:d,helperText:u,error:v,margin:p,...h}=e;const g=d.find((e=>e.value===h.value)),x=null===g||void 0===g?void 0:g.title;return(0,_.jsxs)(r.Z,{margin:p,fullWidth:n,error:v,children:[(0,_.jsx)(s.Z,{children:"".concat(a).concat(i?"*":"")}),(0,_.jsxs)(m.Z,{multiple:t,input:(0,_.jsx)(Ze.Z,{defaultValue:x,sx:{flex:1},required:i,label:a,inputProps:{margin:p}}),renderValue:e=>{if(t)return(0,_.jsx)(o.Z,{sx:{display:"flex",flexWrap:"wrap",gap:.5},children:e.map((e=>{const n=d.find((n=>n.value===e));return n&&n.title&&(0,_.jsx)(be.Z,{size:"small",label:n.title},e)}))});const n=d.find((n=>n.value===e));return n&&n.title&&(0,_.jsxs)(o.Z,{children:[(0,_.jsx)(f.Z,{component:"span",children:n.title}),(0,_.jsx)(f.Z,{marginLeft:1,component:"span",variant:"body2",color:"text.secondary",children:n.description})]})},...h,children:[(0,_.jsx)(c.Z,{disabled:!0,children:(0,_.jsx)("em",{children:l})}),!t&&(0,_.jsx)(c.Z,{value:"",children:"None"}),d.map((e=>e&&e.value&&(0,_.jsxs)(c.Z,{value:e.value,children:[(0,_.jsx)(ye.Z,{children:e.title}),e.description&&(0,_.jsx)(f.Z,{variant:"body2",color:"text.secondary",children:e.description})]},e.value)))]}),(0,_.jsx)(je.Z,{children:u})]})}Le.propTypes={error:N().bool,required:N().bool,multiple:N().bool,fullWidth:N().bool,label:N().string,placeholer:N().string,options:N().array,helperText:N().string,margin:N().string},Le.defaultProps={error:!1,required:!1,multiple:!1,fullWidth:!1,label:"",placeholer:"",options:[],helperText:"",margin:""};const Ne=Le,Se="en";function we(e){let{sx:n,onAdd:t,onChange:l,locales:r,localeMap:s,onRemoveLocale:c}=e;const{t:d}=(0,b.PE)(),u=(0,i.useRef)(),[m,v]=(0,i.useState)(null),p=(0,x.Z)({currentLocale:Se,localeList:[],inputLocale:"",localeError:""}),h=(0,i.useMemo)((()=>!!m),[m]),k=(0,i.useMemo)((()=>r.includes(p.currentLocale)?p.currentLocale:Se),[r,p.currentLocale]),j=(0,i.useMemo)((()=>Object.keys((0,he.omit)(s,[...p.localeList,Se])).map((e=>({title:s[e],value:e})))),[p.localeList]),y=(0,i.useMemo)((()=>{var e;const n=s[Se]||(null===(e=Object.values(s))||void 0===e?void 0:e[0]);return"Default (".concat(n,")")}),[s]);function Z(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";const n=function(e){return e?"en"!==e&&!p.localeList.includes(e)||d("navigation.form.localeExists",{value:e}):d("common.requiredErrorText",{name:"Locale"})}(null===e||void 0===e?void 0:e.trim());return p.localeError=!0!==n?n:"",n}function L(){var e;const n=null===(e=p.inputLocale)||void 0===e?void 0:e.trim();!0===Z(n)&&(N(),p.localeList.push(n),p.currentLocale=n,t(n))}function N(){v(null),p.inputLocale="",p.localeError=""}return(0,i.useEffect)((()=>{p.localeList=[...r]}),[r,p]),(0,pe.Z)("enter",(()=>{setTimeout((()=>{L()}))}),{target:u}),(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)(ge.Z,{sx:n,value:k,onChange:(e,n)=>{p.currentLocale=n,l(n)},children:[(0,_.jsx)(xe.Z,{label:y,value:"en"}),p.localeList.map((e=>(0,_.jsx)(xe.Z,{sx:{position:"relative"},label:(0,_.jsxs)(_.Fragment,{children:[s[e],(0,_.jsx)(F.Z,{size:"small",color:"inherit",sx:{position:"absolute",top:0,right:0},onClick:n=>{!function(e,n){e.preventDefault(),e.stopPropagation(),p.localeList=(0,he.without)(p.localeList,n),c(n),n===p.currentLocale&&(p.currentLocale=Se)}(n,e)},children:(0,_.jsx)(g.JO,{icon:"mdi:close",height:14})})]}),value:e},e))),(0,_.jsx)(F.Z,{color:"primary",disableFocusRipple:!0,sx:{width:"48px"},onClick:e=>{v(e.currentTarget)},children:(0,_.jsx)(g.JO,{icon:"mdi:plus"})})]}),(0,_.jsx)(ke.ZP,{open:h,anchorEl:m,onClose:N,anchorOrigin:{vertical:"bottom",horizontal:"left"},children:(0,_.jsxs)(o.Z,{sx:{p:2,width:"270px"},children:[(0,_.jsx)(f.Z,{variant:"subtitle2",children:d("navigation.form.localePlaceholder")}),(0,_.jsx)(o.Z,{mt:1,children:(0,_.jsx)(Ne,{required:!0,fullWidth:!0,label:"Locale",value:p.inputLocale,options:j,onChange:function(e){const{value:n}=e.target;Z(n),p.inputLocale=n},error:!!p.localeError,helperText:p.localeError||" "})}),(0,_.jsx)(o.Z,{display:"flex",justifyContent:"flex-end",children:(0,_.jsx)(a.Z,{size:"small",variant:"contained",onClick:L,children:d("common.confirm")})})]})})]})}we.propTypes={sx:N().any,onAdd:N().func,onChange:N().func,onRemoveLocale:N().func,localeMap:N().object,locales:N().array},we.defaultProps={sx:null,onAdd:()=>{},onChange:()=>{},onRemoveLocale:()=>{},localeMap:{},locales:[]};const Ce=we;var Pe=t(17425),Oe=t(29054);const Ee="en",Ae={title:{[Ee]:""},link:{[Ee]:""}};function Re(e){let{icon:n}=e;const[t,o]=(0,i.useState)(!1);return(0,G.Z)((async()=>{o(!1),await(0,g.GL)(n),o(!0)}),[n]),n?t?(0,_.jsx)(g.JO,{icon:n}):(0,_.jsx)(g.JO,{color:"#f06f6e",icon:"ic:baseline-error"}):(0,_.jsx)(g.JO,{icon:"codicon:blank"})}Re.propTypes={icon:N().string.isRequired};const Te=(0,i.forwardRef)((function(e,n){let{section:t,components:a,rawNavigations:l}=e;const{roles:s}=(0,Pe.DJ)(),{t:c,locale:d}=(0,b.PE)(),{blocklet:u}=(0,Oe.y0)(),m=(0,i.useMemo)((()=>{const e=u.environments.find((e=>"BLOCKLET_APP_LANGUAGES"===e.key));return(e?e.value.split(","):["en","zh"]).filter((e=>fe.SUPPORTED_LANGUAGES[e])).reduce(((e,n)=>(e[n]=fe.SUPPORTED_LANGUAGES[n].nativeName,e)),{})}),[u.environments]),v=(0,i.useRef)((()=>{})),[p,{setFalse:j,setTrue:y}]=(0,V.Z)(!1),Z=(0,x.Z)({isRoot:!0,type:"add",linkDisabled:!1,locale:Ee,formState:le()(Ae),get localeList(){return ee()(Object.keys(this.formState.title),Ee)}}),{handleSubmit:L,control:N,watch:S,setValue:w,clearErrors:C,formState:{errors:P}}=(0,re.cI)({mode:"onChange",defaultValues:{id:void 0,title:void 0,icon:void 0,link:void 0,component:void 0,parent:void 0,role:[]}});(0,i.useEffect)((()=>{w("title",Z.formState.title[Z.locale]),w("link",Z.formState.link[Z.locale])}),[w,Z.locale,p]);const E=S("component"),A=S("title"),R=S("link"),T=S("icon"),M=S("parent");(0,i.useEffect)((()=>{Z.formState.title[Z.locale]=A}),[A]),(0,i.useEffect)((()=>{Z.formState.link[Z.locale]=R}),[R]);const I=(0,i.useMemo)((()=>l.find((e=>{if(E){return a.find((e=>e.name===E)).did===e.id}return e.id===M}))),[a,l,E,M]),D=(0,i.useMemo)((()=>{if(null!==I&&void 0!==I&&I.component){const e=a.find((e=>e.name===I.component)),{link:n}=e||{},t=O()(n)?n[Z.locale]:n;if(E)return(0,ue.QT)(t);const i=O()(I.link)?I.link[Z.locale]:I.link;return(0,ue.QT)(de()(t,i||"/"))}return null}),[a,Z.locale,I,E]),W=(0,i.useMemo)((()=>{const{component:e}=I||{},n=a.find((n=>n.name===e)),{navigation:i=[]}=n||{};return(0,se.flattenNavigation)(i,{transform:(e,n)=>(null!==n&&void 0!==n&&n.section&&(e.section=e.section||n.section),e)}).filter((e=>e.link)).filter((e=>(0,se.isMatchSection)(e.section,t))).map((e=>({label:e.link,title:e.title[d]||e.title})))}),[I,a,t,d]),G=(0,i.useMemo)((()=>{const e={add:c("common.create"),edit:c("common.edit")}[Z.type];return e?"".concat(e," ").concat(c("navigation.navigation")):"--"}),[Z.type,c]),K=(0,i.useCallback)((()=>{Z.isRoot=!0,Z.locale=Ee,Z.type="add",Z.linkDisabled=!1,v.current=()=>{},w("id",void 0),w("icon",void 0),w("title",void 0),w("link",void 0),w("component",void 0),w("parent",void 0),w("role",[]),Z.formState=le()(Ae),C()}),[C,w,Z]),U=(0,i.useCallback)((function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Z.localeList.length>0&&(new Set(X()(Z.formState.title)).size>1&&(e.title=Z.formState.title),new Set(X()(Z.formState.link)).size>1&&(e.link=Z.formState.link)),te()(e.role)&&(e.role=void 0),e}),[Z.formState.link,Z.formState.title,Z.localeList]),Y=(0,i.useCallback)((()=>{j(),setTimeout((()=>{K()}))}),[K,j]),$=(0,i.useCallback)((function(){let{parent:e}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:()=>{};Z.type="add",Z.isRoot=!e,w("parent",null===e||void 0===e?void 0:e.id),v.current=e=>{n(Y,e)},y()}),[Y,y,w,Z]),ne=(0,i.useCallback)((function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:()=>{};const{id:t,title:i,icon:o,link:a,parent:l,component:r,role:s=[]}=e;w("id",t),w("icon",o),"tmpl"===e.from&&(Z.linkDisabled=!0),oe()(i)?Z.formState.title=Z.localeList.reduce(((e,n)=>(e[n]=i,e)),{[Ee]:i}):O()(i)?Z.formState.title=le()(i):Z.formState.title={},oe()(a)?Z.formState.link=Z.localeList.reduce(((e,n)=>(e[n]=a,e)),{[Ee]:a}):O()(a)?Z.formState.link=le()(a):Z.formState.link={},w("component",r),w("parent",l),w("role",s||[]),y(),Z.type="edit",Z.isRoot=!l,v.current=e=>{const t=Q()(e,["id","title","icon","link","role"]);n(Y,t)}}),[Y,y,w,Z]);function ie(e){const n=null===e||void 0===e?void 0:e.trim();return n?!(n.length>24)||c("navigation.form.titleTooLong",{len:24}):c("common.requiredErrorText",{name:c("navigation.form.title")})}function ae(e){const n=null===e||void 0===e?void 0:e.trim();return n?!!(0,se.checkLink)(n)||c("navigation.form.invalidLink"):!!Z.isRoot||c("common.requiredErrorText",{name:c("navigation.form.link")})}(0,i.useImperativeHandle)(n,(()=>({add:$,edit:ne,close:Y})),[$,Y,ne]);const ce=(0,i.useCallback)((e=>{Z.locale=e,Z.formState.title[e]||(Z.formState.title[e]=""),Z.formState.link[e]||(Z.formState.link[e]=""),setTimeout((()=>{C()}))}),[C,Z]),me=(0,i.useCallback)((()=>{const{title:e,link:n}=Z.formState;for(const t of Object.keys(e)){const n=ie(e[t]);if(!0!==n)return n}for(const t of Object.keys(n)){const e=ae(n[t]);if(!0!==e)return e}return!0}),[Z.formState]),pe=(0,i.useCallback)((e=>{const n=me();!0===n?v.current(U(e)):h.Z.error(n)}),[me,U]),he=(0,i.useCallback)((e=>{Z.formState.title=H()(Z.formState.title,e),Z.formState.link=H()(Z.formState.link,e)}),[Z.formState]),ge=(0,i.useCallback)((e=>{var n,t;Z.locale=e,Z.formState.title[e]=null===(n=Z.formState.title)||void 0===n?void 0:n[Ee],Z.formState.link[e]=null===(t=Z.formState.link)||void 0===t?void 0:t[Ee],setTimeout((()=>{C()}))}),[C,Z]);return(0,_.jsxs)(k.ZP,{open:p,title:G,onClose:Y,actions:(0,_.jsx)(z.Z,{onClick:L(pe),color:"primary",autoFocus:!0,variant:"contained",children:c("common.confirm")}),children:[(0,_.jsx)(Ce,{sx:{mb:1},onAdd:ge,onChange:ce,onRemoveLocale:he,localeMap:m,locales:Z.localeList}),(0,_.jsxs)("form",{noValidate:!0,autoComplete:"off",children:[(0,_.jsx)(re.Qr,{name:"title",control:N,rules:{validate:ie},render:e=>{var n,t;let{field:i}=e;return(0,_.jsx)(q.Z,{fullWidth:!0,variant:"outlined",margin:"dense",required:!0,placeholder:c("navigation.form.titlePlaceholder"),label:c("navigation.form.title"),disabled:Z.isEdit,error:!(null===P||void 0===P||null===(n=P.title)||void 0===n||!n.message),helperText:(null===P||void 0===P||null===(t=P.title)||void 0===t?void 0:t.message)||" ",...i})}}),(0,_.jsx)(re.Qr,{name:"icon",control:N,rules:{validate:async function(e){const n=null===e||void 0===e?void 0:e.trim();if(n)try{await(0,g.GL)(n)}catch{return c("navigation.form.invalidIcon")}return!0}},render:e=>{var n,t;let{field:i}=e;return(0,_.jsx)(q.Z,{fullWidth:!0,variant:"outlined",margin:"dense",placeholder:c("navigation.form.iconPlaceholder"),label:c("navigation.form.icon"),error:!(null===P||void 0===P||null===(n=P.icon)||void 0===n||!n.message),disabled:Z.locale!==Ee,helperText:(null===P||void 0===P||null===(t=P.icon)||void 0===t?void 0:t.message)||(0,_.jsx)(o.Z,{display:"flex",children:(0,_.jsxs)(o.Z,{component:"a",href:"https://icones.js.org",target:"_blank",display:"flex",alignItems:"center",children:[c("navigation.form.findMoreIcon")," ",(0,_.jsx)(g.JO,{style:{marginLeft:4},icon:"radix-icons:external-link"})]})}),...i,InputProps:{endAdornment:(0,_.jsx)(B.Z,{position:"end",children:(0,_.jsx)(F.Z,{sx:{cursor:"default"},disableFocusRipple:!0,disableRipple:!0,children:T&&(0,_.jsx)(Re,{icon:T})})})}})}}),Z.isRoot&&(0,_.jsx)(re.Qr,{name:"component",control:N,render:e=>{var n,t;let{field:i}=e;return(0,_.jsx)(Ne,{fullWidth:!0,margin:"dense",disabled:"edit"===Z.type||Z.locale!==Ee,label:c("navigation.form.component"),placeholer:c("navigation.form.componentPlaceholder"),options:a.map((e=>({title:e.title,value:e.name,description:e.link}))),error:!(null===P||void 0===P||null===(n=P.component)||void 0===n||!n.message),helperText:(null===P||void 0===P||null===(t=P.component)||void 0===t?void 0:t.message)||" ",...H()(i,"ref")})}}),(0,_.jsx)(re.Qr,{name:"link",control:N,rules:{validate:ae},render:e=>{let{field:n}=e;return(0,_.jsx)(r.Z,{fullWidth:!0,margin:"dense",children:(0,_.jsx)(J.Z,{disablePortal:!0,freeSolo:!0,blurOnSelect:!0,autoSelect:!0,fullWidth:!0,disabled:Z.linkDisabled,isOptionEqualToValue:e=>e.label,options:W,renderInput:e=>{var n,t;return(0,_.jsx)(q.Z,{...e,placeholder:c("navigation.form.linkPlaceholder"),label:c("navigation.form.link"),error:!(null===P||void 0===P||null===(n=P.link)||void 0===n||!n.message),helperText:(null===P||void 0===P||null===(t=P.link)||void 0===t?void 0:t.message)||"/abc/bcd or /abc or https://arcblock.io",InputProps:{startAdornment:D?(0,_.jsx)(B.Z,{position:"start",sx:{textDecoration:ve()(R||"")?"line-through":""},children:D}):null}})},renderOption:(e,n)=>(0,_.jsxs)(o.Z,{component:"li",...e,children:[n.label,(0,_.jsx)(f.Z,{marginLeft:1,component:"span",variant:"body2",color:"text.secondary",children:n.title})]}),margin:"dense",...n,onChange:()=>{},onInputChange:(e,t)=>{n.onChange(t)}})})}}),["dashboard","sessionManager"].includes(t)&&(0,_.jsx)(re.Qr,{name:"role",control:N,render:e=>{var n,t;let{field:i}=e;return(0,_.jsx)(Ne,{fullWidth:!0,multiple:!0,margin:"dense",label:c("navigation.form.role"),placeholer:c("navigation.form.rolePlaceholder"),options:s.map((e=>({title:e.title,value:e.name}))),error:!(null===P||void 0===P||null===(n=P.role)||void 0===n||!n.message),helperText:(null===P||void 0===P||null===(t=P.role)||void 0===t?void 0:t.message)||" ",...H()(i,"ref")})}})]})]})}));Te.propTypes={section:N().string,components:N().array,rawNavigations:N().array},Te.defaultProps={section:"",components:[],rawNavigations:[]};const _e=Te;function Me(e){let{className:n,add:t,edit:o,toggle:a,del:l,data:r,section:s}=e;const{t:c}=(0,b.PE)(),d=["yaml","tmpl"].includes(r.from),u=(0,i.isValidElement)(r.subtitle);function m(e){e.preventDefault(),e.stopPropagation()}const v=(0,i.useCallback)((e=>{m(e),t(r)}),[t,r]),f=(0,i.useCallback)((e=>{m(e),o(r)}),[o,r]),p=(0,i.useCallback)((e=>{m(e),a(r)}),[a,r]),h=(0,i.useCallback)((e=>{m(e),l(r)}),[l,r]);return(0,_.jsxs)("div",{className:n,children:[!r.parent&&["header","footer","dashboard"].includes(s)&&(0,_.jsx)("span",{title:c(u?"navigation.action.noAddSub":"navigation.action.addSub"),children:(0,_.jsx)(F.Z,{size:"small",color:"success",onClick:v,disabled:u,children:(0,_.jsx)(g.JO,{icon:"mdi:plus-box-outline"})})}),(0,_.jsx)("span",{title:c(u?"navigation.action.noEdit":"navigation.action.edit"),children:(0,_.jsx)(F.Z,{size:"small",color:"primary",onClick:f,disabled:u,children:(0,_.jsx)(g.JO,{icon:"mdi:pencil"})})}),(0,_.jsx)("span",{title:u?c("navigation.action.noEdit"):r.visible?c("navigation.action.hide"):c("navigation.action.show"),children:(0,_.jsx)(F.Z,{size:"small",color:"warning",onClick:p,disabled:u,children:!1===r.visible?(0,_.jsx)(g.JO,{icon:"mdi:eye-off-outline"}):(0,_.jsx)(g.JO,{icon:"mdi:eye-outline"})})}),(0,_.jsx)("span",{title:c(d&&!u?"navigation.action.noDel":"navigation.action.del"),children:(0,_.jsx)(F.Z,{disabled:d&&!u,size:"small",color:"error",onClick:h,children:(0,_.jsx)(g.JO,{icon:"mdi:delete"})})})]})}Me.propTypes={data:N().object.isRequired,className:N().string,add:N().func,edit:N().func,toggle:N().func,del:N().func,section:N().string},Me.defaultProps={className:"",add:()=>{},edit:()=>{},toggle:()=>{},del:()=>{},section:""};const Ie=Me;var De=t(3785),We=t.n(De),ze=t(79683),Je=t.n(ze),Fe=t(35432),Be=t(14491);const qe="/",Ge="header",Ve={sessionManager:[{id:"/sessionManager",title:{en:"Manage",zh:"\u7ba1\u7406"},section:["sessionManager"],icon:"ion:settings-outline",link:"".concat(Fe.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(Fe.WELLKNOWN_SERVICE_PATH_PREFIX,"/admin/members"),from:"tmpl"},{id:"passport",title:{en:"Passport",zh:"\u901a\u884c\u8bc1"},icon:"icon-park-outline:passport",link:"".concat(Fe.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(Fe.WELLKNOWN_SERVICE_PATH_PREFIX,"/admin"),from:"tmpl"}]}]};function Ke(e,n){return e.section&&n.section?e.section===n.section&&e.id===n.id:e.id===n.id}function He(){const{blocklet:e,actions:n}=(0,Oe.y0)(),{navigationList:t,components:o,builtinList:a}=(0,se.parseNavigation)(e,{beforeProcess(e){const n=le()(e);return Ve.dashboard.forEach((e=>{n.some((n=>n.id===e.id))||n.push(e)})),n.some((e=>e.id&&(e.section||[]).includes("sessionManager")))||n.push(...Ve.sessionManager),n}}),l=(0,x.Z)({rawNavigation:le()(t),activeSection:Ge,components:o}),r=(0,i.useMemo)((()=>(0,se.nestNavigationList)(l.rawNavigation)),[l.rawNavigation]),s=(0,i.useMemo)((()=>{const e=(0,se.filterNavigation)(l.rawNavigation,o),n=(0,se.joinLink)(e,o);return(0,se.cleanOrphanNavigation)(n)}),[o,l.rawNavigation]);function c(e){if(!e.id)return"";const n=(0,se.flattenNavigation)((0,se.joinLink)(r,o)),t=n.find((n=>n.id===e.id));function i(e){let{name:n}=e;return(0,_.jsx)(be.Z,{label:"Uninstalled: ".concat(n),color:"error",size:"small",variant:"outlined",sx:{fontSize:10,height:20}})}if(null!==t&&void 0!==t&&t.component){if(!o.some((e=>e.name===t.component)))return(0,_.jsx)(i,{name:t.component})}else if(t.parent){const e=n.find((e=>e.id===t.parent));if(null!==e&&void 0!==e&&e.component&&!o.some((n=>n.name===e.component)))return(0,_.jsx)(i,{name:e.component})}return null===t||void 0===t?void 0:t.link}function d(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:qe;return e.map((e=>{const t=o.find((n=>n.name===e.component)),i=(null===t||void 0===t?void 0:t.link)||n,a=e.items||[],{link:l}=e;return{title:e.title,subtitle:c(e),link:l,icon:e.icon,children:d(a,l||qe),section:e.section,visible:e.visible,parent:e.parent,component:e.component,id:e.id,role:e.role,from:e.from,__base:i}}))}async function u(e){const t=e.map((e=>Je()(e,We()))).map((e=>{const n={...e};return n.role&&Array.isArray(n.role)&&(n.role=JSON.stringify(n.role)),n.section&&Array.isArray(n.section)&&(n.section=JSON.stringify(n.section)),n.title&&n.title instanceof Object&&(n.title=JSON.stringify(n.title)),n.link&&n.link instanceof Object&&(n.link=JSON.stringify(n.link)),n}));await n.configNavigations(t)}return{state:l,navigation:s,components:o,getNavigationFullLink:c,updateActiveSection:function(e){l.activeSection=e},updateNavigationItem:function(e){!function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];const n=l.rawNavigation.map((n=>{const t=e.find((e=>Ke({...e,section:l.activeSection},n)));return t?{...n,...t}:n}));l.rawNavigation=n}([e])},delNavigationItem:function(e){const n=l.rawNavigation.filter((n=>n.id===e||n.parent===e)).map((e=>e.id));l.rawNavigation=l.rawNavigation.filter((e=>!n.includes(e.id)))},addNavigationItem:function(){const e={...arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},id:(0,Be.x0)(),section:l.activeSection,visible:!0};l.rawNavigation=[...l.rawNavigation,e]},updateNavigationTree:function(e){const n=[];(0,se.deepWalk)(e,((e,t)=>{const i={...H()(e,["children","expand"]),parent:null===t||void 0===t?void 0:t.id};n.push(i)}));const t=l.rawNavigation.filter((e=>{if(!l.activeSection)return!1;const t=n.find((n=>Ke(n,e)));return!t||!(0,se.isMatchSection)(t.section,l.activeSection)}));l.rawNavigation=[...t,...n]},getNavigation:function(e){return d(le()(r).filter((n=>(0,se.isMatchSection)(n.section,e))))},saveNavigationList:u,resetNavigation:async function(){await u([]),l.rawNavigation=le()(a)}}}var Ue,Qe=t(71171),Ye=t(1192),Xe=t(2484),$e=t(5873),en=t(88764),nn=t(55402),tn=t(5939),on=t(33518),an=t(49522);function ln(e){var n,t,i,a;let{className:l,navigation:r}=e;const{blocklet:s}=(0,Oe.y0)(),{logoUrl:c}=(0,an.Z)({blocklet:s}),d=null===s||void 0===s||null===(n=s.environments)||void 0===n||null===(t=n.find((e=>e.key===fe.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_COPYRIGHT_OWNER)))||void 0===t?void 0:t.value,u=null===s||void 0===s||null===(i=s.environments)||void 0===i||null===(a=i.find((e=>e.key===fe.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_COPYRIGHT_YEAR)))||void 0===a?void 0:a.value,m=d||u?{owner:d,year:u}:void 0,v={appId:s.appDid,appLogo:c,appName:s.meta.title,enableConnect:!0,enableLocale:!1,navigation:r,copyright:m};return(0,_.jsx)(en.Z,{children:(0,_.jsxs)(o.Z,{className:l,children:[(0,_.jsx)(Ye.Z,{meta:v}),(0,_.jsx)(o.Z,{children:(0,_.jsx)($e.Z,{meta:v,invalidPathFallback:()=>{},headerProps:{style:{display:"none"}},children:(0,_.jsx)(nn.ZP,{container:!0,spacing:2,children:new Array(6).fill().map(((e,n)=>(0,_.jsxs)(nn.ZP,{item:!0,xs:4,children:[(0,_.jsx)(tn.Z,{animation:!1,variant:"rectangular",width:"100%",height:120}),(0,_.jsxs)(o.Z,{sx:{pt:.5},children:[(0,_.jsx)(tn.Z,{animation:!1}),(0,_.jsx)(tn.Z,{width:"60%",animation:!1})]})]},n)))})})}),(0,_.jsx)(Xe.Z,{meta:v})]})})}ln.propTypes={className:N().string,navigation:N().array},ln.defaultProps={className:"",navigation:[]};const rn=(0,on.Z)(ln)(Ue||(Ue=(0,Qe.Z)(["\n .dashboard {\n height: auto !important;\n }\n .dashboard-content + div {\n display: none;\n }\n"]))),sn={login:Z(),logout:Z(),switch:Z(),switchDid:Z(),switchProfile:Z(),switchPassport:Z(),useDid:()=>({walletDid:"abcdefghijklmnopqrstuvwxyz"}),useOAuth:()=>({logoutOAuth:Z(),bindOAuth:Z(),configs:{},switchOAuthPassport:Z()})},cn={header:"Header",footer:"Footer",bottom:"Footer Link",social:"Footer Social",dashboard:"Dashboard",sessionManager:"SessionManager"};const dn=function(){const{t:e}=(0,b.PE)(),{blocklet:n}=(0,Oe.y0)(),t=(0,i.useRef)(null),{roles:y}=(0,Pe.DJ)(),Z=(0,d.Z)((e=>e.breakpoints.down("md"))),L=(0,x.Z)({saveLoading:!1,resetLoading:!1,showResetConfirm:!1,mockRole:"owner"}),{state:N,navigation:S,getNavigation:w,saveNavigationList:C,resetNavigation:P,updateActiveSection:O,updateNavigationTree:E,updateNavigationItem:A,delNavigationItem:R,addNavigationItem:T}=He(),M=(0,i.useCallback)((e=>{t.current.add({parent:e},((e,n)=>{T(n),e()}))}),[T]),I=(0,i.useCallback)((function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};switch(e){case"edit":t.current.edit(n,((e,n)=>{A(n),e()}));break;case"toggle":A({id:n.id,visible:!n.visible});break;case"del":R(n.id)}}),[R,A]),D=(0,i.useCallback)((async()=>{try{L.saveLoading=!0,await C(N.rawNavigation),h.Z.success(e("common.succeeded"))}catch(n){h.Z.error((0,_.jsxs)(o.Z,{children:[(0,_.jsx)(f.Z,{variant:"subtitle2",children:e("navigation.actionFailed")}),(0,_.jsx)(f.Z,{variant:"body1",children:(0,Be.Z)(n)||n.error})]}))}finally{L.saveLoading=!1}}),[N.rawNavigation,L,C,e]),z=(0,i.useCallback)((async()=>{try{L.resetLoading=!0,await P(),h.Z.success(e("navigation.action.resetSuccessful"),{variant:"success"})}catch(n){h.Z.error((0,_.jsxs)(o.Z,{children:[(0,_.jsx)(f.Z,{variant:"subtitle2",children:e("navigation.actionFailed")}),(0,_.jsx)(f.Z,{variant:"body1",children:(0,Be.Z)(n)||n.error})]}))}finally{L.resetLoading=!1}}),[L,P,e]),J=(0,i.useMemo)((()=>({session:{...sn,user:{did:n.appDid,fullName:"Preview User",role:L.mockRole}}})),[n.appDid,L.mockRole]);return(0,_.jsxs)(_.Fragment,{children:[Z&&(0,_.jsx)(m.Z,{fullWidth:!0,size:"small",value:N.activeSection,onChange:e=>O(e.target.value),children:Object.keys(cn).map((e=>(0,_.jsxs)(c.Z,{value:e,children:[cn[e]," (".concat(w(e).length,")")]})))}),!Z&&(0,_.jsx)(l.Z,{variant:"outlined",children:Object.keys(cn).map((e=>(0,_.jsxs)(a.Z,{variant:N.activeSection===e?"contained":void 0,onClick:()=>O(e),children:[cn[e]," (".concat(w(e).length,")")]},e)))}),(0,_.jsxs)(v.Z,{variant:"dense",sx:{paddingLeft:"0px !important",paddingRight:"0px !important",mt:2},children:[(0,_.jsx)(f.Z,{variant:"h6",component:"div",sx:{flexGrow:1},children:e("common.config")}),(0,_.jsx)(l.Z,{variant:"outlined",children:(0,_.jsx)(p.Z,{size:"small",variant:"outlined",color:"error",startIcon:(0,_.jsx)(g.JO,{icon:"system-uicons:reset"}),sx:{mr:2},loading:L.resetLoading,loadingPosition:"start",onClick:()=>{L.showResetConfirm=!0},children:e("navigation.action.reset")})}),(0,_.jsxs)(l.Z,{variant:"outlined",children:[(0,_.jsx)(a.Z,{size:"small",variant:"outlined",startIcon:(0,_.jsx)(g.JO,{icon:"mdi:plus"}),onClick:()=>M(),children:e("navigation.action.new")}),(0,_.jsx)(p.Z,{size:"small",variant:"contained",startIcon:(0,_.jsx)(g.JO,{icon:"mdi:content-save"}),loading:L.saveLoading,loadingPosition:"start",onClick:D,children:e("common.save")})]})]}),(0,_.jsx)(u.Z,{variant:"outlined",sx:{display:"flex",height:280,overflow:"hidden"},children:(0,_.jsx)(u.Z,{elevation:0,sx:{flex:1,overflow:"auto"},children:(0,_.jsx)(W,{treeData:w(N.activeSection),setTreeData:E,renderActions:e=>{let{data:n,className:t}=e;return(0,_.jsx)(Ie,{data:n,className:t,section:N.activeSection,add:function(){return M(...arguments)},del:function(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++)n[t]=arguments[t];return I("del",...n)},edit:function(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++)n[t]=arguments[t];return I("edit",...n)},toggle:function(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++)n[t]=arguments[t];return I("toggle",...n)}})}})})}),(0,_.jsxs)(v.Z,{variant:"dense",sx:{paddingLeft:"0px !important",paddingRight:"0px !important",mt:3},children:[(0,_.jsx)(f.Z,{variant:"h6",component:"div",sx:{flexGrow:1},children:e("common.preview")}),(0,_.jsxs)(r.Z,{sx:{m:1,minWidth:120},size:"small",children:[(0,_.jsx)(s.Z,{children:e("common.role")}),(0,_.jsx)(m.Z,{value:L.mockRole,label:"Role",onChange:e=>{L.mockRole=e.target.value},children:y.map((e=>(0,_.jsx)(c.Z,{value:e.name,children:e.title},e.name)))})]})]}),(0,_.jsx)(u.Z,{variant:"outlined",children:(0,_.jsx)(j.B3.Provider,{value:J,children:(0,_.jsx)(rn,{navigation:S})})}),(0,_.jsx)(_e,{ref:t,section:N.activeSection,components:N.components,rawNavigations:N.rawNavigation}),(0,_.jsx)(k.I4,{confirmButton:{text:e("common.confirm"),props:{variant:"contained",color:"error"}},cancelButton:{text:e("common.cancel"),props:{color:"primary"}},open:L.showResetConfirm,title:e("navigation.action.restConfirmTitle"),onConfirm:async()=>{await z(),L.showResetConfirm=!1},onCancel:()=>{L.showResetConfirm=!1},children:(0,_.jsx)("p",{children:e("navigation.action.restConfirmDesc")})})]})}}}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";(self.webpackChunk_abtnode_webapp=self.webpackChunk_abtnode_webapp||[]).push([[4906],{7199:(e,t,n)=>{n.d(t,{V:()=>o.V,Z:()=>o.Z});var o=n(63406)},44906:(e,t,n)=>{n.r(t),n.d(t,{default:()=>se});var o=n(71171),r=n(5057),i=n(6352),s=n.n(i),a=n(33518),l=n(67654),c=n(11750),d=n(39948),u=n(39434),m=n(68420),p=n(5952),h=n(75793),f=n(38898),x=n(52439),y=n(71569),g=n(77121),b=n(35432),v=n(44727),j=n(4651),Z=n(74094),k=n(85493),R=n(38242),C=n(44846),P=n(28726),w=n(49983),S=n(86229),D=n(77277),N=n(23484),E=n(34937);var T=n(7199),F=n(10458),_=n.n(F),q=n(13128),U=n(73170),A=n(96266);function L(e){let{meta:t,onCancel:n,handlePaySuccess:o,storeUrl:i}=e;const{t:a}=(0,m.PE)(),{info:l}=(0,h.h6)(),[d,u]=(0,r.useState)("both"),[p,f]=(0,r.useState)(1),x=(0,Z.yP)(l),y=(0,j.FM)(t,l,i),g=()=>{o(y)},b=(0,R.getDisplayName)({meta:t});if("purchase"===d&&2===p)return(0,A.jsx)(w.Z,{open:!0,popup:!0,baseUrl:i,action:"acquire-asset",checkFn:_().create({baseURL:s()(i,"/store")}).get,onSuccess:g,onClose:n,checkTimeout:3e5,extraParams:{factory:t.nftFactory},webWalletUrl:x,disableClose:!0,saveConnect:!1,showDownload:!1,messages:{title:a("store.purchase.auth.title",{name:b}),scan:a("store.purchase.auth.scan"),confirm:a("store.purchase.auth.confirm"),success:(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(c.Z,{gutterBottom:!0,children:a("store.purchase.auth.success")}),(0,A.jsxs)(c.Z,{variant:"subtitle2",children:[" ",a("store.purchase.autoLaunch",{name:b})]})]})}});const v=q.ZP;return(0,A.jsx)(v,{title:a("store.purchase.title",{name:b}),disableEscapeKeyDown:!0,open:!0,fullWidth:!0,onClose:(e,t)=>{"backdropClick"!==t&&n()},children:(0,A.jsx)("div",{style:{marginBottom:16},children:(0,A.jsx)(U.AP,{action:d,onNext:()=>{d&&(f(2),"verify"===d&&(window.location.href=y))},onSelect:e=>{e!==d&&u(e)}})})})}L.defaultProps={handlePaySuccess:e=>{setTimeout((()=>{window.location.href=e}),1e3)}};const W=L;var B,M=n(25339);function z(e){let{meta:t,buttonText:n,storeUrl:o}=e;const{t:i}=(0,m.PE)(),s=(0,k.useNavigate)(),{info:a}=(0,h.h6)(),{api:c}=(0,M.Tt)(),d=!1===(0,R.isFreeBlocklet)(t),[u,p]=(0,r.useState)(!1),{hasPurchased:f}=function(e){const t=(0,N.Z)(),n=(0,k.useNavigate)(),[o,i]=(0,l.Z)("sid:blocklet:purchase:".concat(e)),[s,a]=(0,r.useState)(!1),[c,d]=(0,r.useState)(null),u=()=>{const{pathname:e,searchParams:t}=new URL(window.location.href),o=window.env&&window.env.apiPrefix?window.env.apiPrefix:"/";t.get("sid")&&(i(""),n(e.replace(o,"/"),{replace:!0}))},m=!(!t.get("assetDid")||!o||t.get("sid")!==o);return(0,E.mU)(D.BlockletEvents.purchaseChange,(t=>{t.did===e&&(d(t.session),["declined","confirmed","error"].includes(t.session.status)&&(a(!0),setTimeout(u,2e3)))})),(0,r.useEffect)((()=>{c&&c.id!==o&&i(c.id)}),[c]),{hasCompleted:s,hasPurchased:m,session:c,setSession:d,doRedirect:u}}(t.did),[x,y]=(0,r.useState)(!1),[g]=(0,l.Z)("instant-blocklet-install",!1),[b,F]=(0,r.useState)(!1),_=(0,r.useMemo)((()=>u?i(d?"blocklet.status.purchasing":"blocklet.status.waiting"):""),[u,i,d]),q=(0,r.useMemo)((()=>d?n.purchase:n.launch),[d,n]),U=e=>{e.preventDefault(),e.stopPropagation();try{if(p(!0),d)return void y(!0);if(g)return void F(!0);if(!d){const e=(0,j.FM)(t,a,o);return void(window.location.href=e)}}catch(n){S.Z.error((0,Z.Z)(n),{autoHideDuration:5e3}),console.error("Blocklet installed failed",n)}finally{p(!1)}};return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(v.Kk,{children:(0,A.jsx)(T.Z,{permission:"mutate_blocklets",children:e=>(0,A.jsx)(P.Z,{onClick:U,size:"small",disabled:Boolean(_||!e),variant:"outlined",color:"primary","data-cy":"install-blocklet",children:_?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(C.Z,{size:16,style:{marginRight:3}}),_]}):q},t.did)})}),(f||x)&&(0,A.jsx)(W,{method:"launch",meta:t,mode:"both",onCancel:()=>{p(!1),y(!1)},storeUrl:o}),b&&(0,A.jsx)(w.Z,{popup:!0,open:!0,forceConnected:!1,className:"launch-from-url-auth",action:"launch-free-blocklet-by-session",checkFn:c.get,checkTimeout:3e5,onSuccess:e=>{p(!1),F(!1),s("/blocklets/".concat(e.appDid,"/components"))},extraParams:{title:t.title,blockletMetaUrl:decodeURIComponent((0,Z.Rn)(o,t.did).trim())},messages:{title:i("setup.keyPair.title"),scan:i("setup.keyPair.scan"),confirm:i("setup.keyPair.confirm"),success:i("setup.keyPair.success")},onClose:()=>{p(!1),F(!1)}})]})}z.defaultProps={};const I=(e,t,n)=>{const o=(0,j.RU)(t);return s()(n,"/blocklets/".concat(e.did,"/?server-url=").concat(o))},V=e=>{let{meta:t,attribute:n,value:o}=e;return t._formatted?t._formatted[n]:o};function H(e){let{blocklet:t,endpoint:n}=e;const{t:o}=(0,m.PE)(),r=(0,h.h6)();let i=s()(r.imgPrefix,"blocklet.png");const a=n;if(a.startsWith("http")&&t.logo)i=s()(a,(0,Z.lk)(t.did,t.logo));else{let e=(window.env.apiPrefix||"/").replace(/^\/+/,"").replace(/\/+$/,"");e&&(e="/".concat(e)),i=s()(e,"/blocklet/logo/".concat(t.did))}const l=(null===r||void 0===r?void 0:r.info.mode)!==b.NODE_MODES.SERVERLESS,c={meta:t,buttonText:{purchase:o("common.purchase"),launch:o("common.launch")},storeUrl:a};return(0,A.jsx)(f.Z,{href:I(t,r.info,n),style:{color:"initial",textDecoration:"none"},onClick:e=>!!e.currentTarget.contains(e.target)||(e.preventDefault(),!1),target:"_blank",children:(0,A.jsx)(O,{title:V({meta:t,attribute:"title",value:t.title||t.name}),did:t.did,description:V({meta:t,attribute:"description",value:t.description}),cover:t.logo?i:"",version:t.version,button:l?(0,A.jsx)("div",{style:{display:"flex",alignItems:"center"},children:(0,A.jsx)(z,{...c})}):null})})}function K(e){var t;let{storeUrl:n,handleSearchSelect:o,extraFilter:i,...s}=e;const{locale:a}=(0,m.PE)(),l=(0,h.h6)(),[c,d]=(0,r.useState)({}),u=n,p=null===l||void 0===l||null===(t=l.info)||void 0===t?void 0:t.version;return(0,r.useEffect)((()=>{d({})}),[u]),(0,A.jsx)(x.ErrorBoundary,{FallbackComponent:y.H,resetKeys:[u],children:(0,A.jsx)("div",{...s,children:(0,A.jsx)(g.Z,{blockletRender:e=>{const t={...e,endpoint:u};return(0,A.jsx)(H,{...t})},baseSearch:!0,endpoint:u,locale:a,onFilterChange:e=>{d(e)},onSearchSelect:o,filters:c,extraFilter:i,serverVersion:p})})})}H.defaultProps={endpoint:""},K.defaultProps={handleSearchSelect:null,extraFilter:void 0};const O=(0,a.Z)(v.ZP)(B||(B=(0,o.Z)(["\n .ms-highlight {\n color: ",";\n }\n"])),(e=>e.theme.palette.primary.main));var $=n(92877),Q=n(19577),Y=n(2478),G=n(44067),J=n(46954),X=n(49390),ee=n(22714),te=n(45170);const ne=(0,$.Z)((()=>({buttonText:{textTransform:"none !important"},iconRoot:{minWidth:24},menuName:{display:"flex",flexDirection:"column",marginRight:"100px","& span":{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}}}))),oe=(0,r.forwardRef)(((e,t)=>{let{onChange:n,onDelete:o}=e;const{info:i}=(0,h.h6)(),{t:s}=(0,m.PE)(),[a,d]=(0,r.useState)(!1),[u,f]=(0,r.useState)(!1),[x,y]=(0,r.useState)(-1),g=ne(),[b,v]=(0,l.Z)(p.WC),j=Math.max(i.blockletRegistryList.findIndex((e=>e.url===b)),0);return(0,r.useImperativeHandle)(t,(()=>({setOpen:f}))),(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(T.Z,{permission:"mutate_node",children:e=>(0,A.jsx)(P.Z,{disabled:!e,classes:{text:g.buttonText},color:"secondary","data-cy":"store-toggle",onClick:()=>{f(!0)},endIcon:(0,A.jsx)(X.Z,{}),children:(0,A.jsx)(c.Z,{color:"secondary",children:i.blockletRegistryList[j].name})})}),(0,A.jsx)(q.ZP,{title:s("store.blockletRegistry.switchRegistry"),disableEscapeKeyDown:!0,disablePortal:!1,fullWidth:!0,open:u,onClose:()=>f(!1),children:(0,A.jsxs)(Q.Z,{className:g.tabPanel,children:[i.blockletRegistryList.map(((e,t)=>(0,A.jsxs)(Y.ZP,{button:!0,disabled:a,selected:j===t,"data-cy":"store-switch",onClick:()=>{a||(t!==j?(e=>{try{d(!0),y(e);const t=i.blockletRegistryList[e];v(t.url),n(t.url),f(!1)}catch(t){console.error(t),S.Z.error("".concat(s("store.blockletRegistry.changeFailed")," ").concat((0,Z.Z)(t)))}finally{d(!1)}})(t):f(!1))},children:[(0,A.jsx)(J.Z,{className:g.iconRoot,children:x===t&&a&&(0,A.jsx)(C.Z,{size:16})}),(0,A.jsx)(G.Z,{children:(0,A.jsx)(te.Z,{teamDid:i.did,store:e,onDelete:()=>o(e.url)})})]},e.url))),(0,A.jsx)(ee.Z,{disabled:a,onAdd:n,teamDid:i.did,blockletRegistryList:i.blockletRegistryList})]})})]})}));oe.defaultProps={onChange:()=>{},onDelete:()=>{}};const re=oe;var ie;function se(){const{t:e}=(0,m.PE)(),{info:t}=(0,h.h6)(),[n]=(0,l.Z)(p.WC),{blockletRegistryList:o}=t,i=o.find((e=>n===e.url))||o[0],[a,f]=(0,r.useState)(i.url),x=t.routing.adminPath,y=s()(window.location.origin,x),g=(0,r.useRef)(null);return(0,A.jsxs)(ae,{children:[(0,A.jsxs)(u.Z,{separator:"\u203a","aria-label":"breadcrumb",className:"page-breadcrumb",children:[(0,A.jsx)(c.Z,{color:"textPrimary",children:e("common.store")}),(0,A.jsx)(re,{ref:g,onChange:e=>f(e),onDelete:e=>{var n;a===e&&f(null===(n=t.blockletRegistryList[0])||void 0===n?void 0:n.url)}})]}),(0,A.jsx)(d.Z,{className:"store-header",display:"flex",justifyContent:"space-between",p:0,m:0,children:(0,A.jsx)(c.Z,{component:"h2",variant:"h4",className:"page-header",color:"textPrimary",children:e("store.headerDescription")})}),(0,A.jsx)(K,{className:"blocklet-list",handleSearchSelect:e=>{let{detailUrl:t}=e;const n=new URL(t);n.searchParams.set("server-url",y);const o=document.createElement("a");o.setAttribute("target","_blank"),o.setAttribute("href",n.href),o.click()},storeUrl:a})]})}const ae=a.Z.main(ie||(ie=(0,o.Z)(["\n @media (max-width: ","px) {\n .store-header {\n flex-direction: column;\n margin-bottom: 32px !important;\n }\n\n .page-header {\n margin-bottom: 16px !important;\n }\n }\n .blocklet-list {\n aside:hover {\n height: calc(100vh - 235px);\n }\n }\n"])),(e=>e.theme.breakpoints.values.sm))},73170:(e,t,n)=>{n.d(t,{$7:()=>x,AP:()=>g});var o=n(92877),r=n(55898),i=n.n(r),s=n(19577),a=n(2478),l=n(44067),c=n(46954),d=n(42507),u=n(40184),m=n(28726),p=n(76223),h=n(68420),f=n(96266);const x={meta:i().object.isRequired,onCancel:i().func.isRequired},y=(0,o.Z)((()=>({dialogAuth:{padding:"0 0 24px !important","& .auth-title":{textAlign:"center !important",marginBottom:"4px !important"},"& .auth-tip--scan":{textAlign:"center !important"}},iconRoot:{minWidth:48}})));function g(e){let{action:t,onSelect:n,onNext:o}=e;const r=y(),{t:i}=(0,h.PE)(),x=[{action:"purchase",title:i("store.purchase.purchase.title"),description:i("store.purchase.purchase.description")},{action:"verify",title:i("store.purchase.verify.title"),description:i("store.purchase.verify.description")}];return(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(s.Z,{className:r.tabPanel,children:x.map((e=>(0,f.jsxs)(a.ZP,{button:!0,selected:t===e.action,onClick:()=>n(e.action),children:[(0,f.jsx)(c.Z,{className:r.iconRoot,children:"purchase"===e.action?(0,f.jsx)(d.Z,{style:{color:"purchase"===t?p.Z.primary.main:"#AAA",fontSize:32}}):(0,f.jsx)(u.Z,{style:{color:"verify"===t?p.Z.primary.main:"#AAA",fontSize:32}})}),(0,f.jsx)(l.Z,{primary:e.title,secondary:e.description})]},e.action)))}),o&&(0,f.jsx)(m.Z,{fullWidth:!0,disabled:!t,variant:"contained",color:"primary",style:{marginTop:16},onClick:o,children:i("common.next")})]})}g.propTypes={action:i().oneOf(["both","purchase","verify"]).isRequired,onSelect:i().func.isRequired,onNext:i().func.isRequired}},50185:(e,t,n)=>{n.d(t,{Z:()=>c});var o=n(5057),r=n(55898),i=n.n(r),s=n(12937),a=n(68420),l=n(96266);function c(e){let{children:t,...n}=e;const{t:r}=(0,o.useContext)(a.RD);return(0,l.jsx)(s.Z,{tip:r("common.copyTip"),copiedTip:r("common.copiedTip"),...n,children:t})}c.propTypes={children:i().any.isRequired}},71363:(e,t,n)=>{n.d(t,{Z:()=>m});var o=n(55898),r=n.n(o),i=n(11750),s=n(47020),a=n(93938),l=n(68420),c=n(50185),d=n(70461),u=n(96266);function m(e){let{title:t,description:n,confirmPlaceholder:o,cancel:r,confirm:m,params:p,onCancel:h,onConfirm:f,keyName:x}=e;const{t:y}=(0,l.PE)(),g={title:()=>(0,u.jsxs)("div",{children:[t," (".concat(x,")")]}),description:(e,t)=>(0,u.jsxs)("div",{children:[(0,u.jsx)(a.Z,{severity:"warning",style:{width:"100%"},children:y("common.notice")}),(0,u.jsx)("div",{style:{marginTop:24,marginBottom:24},dangerouslySetInnerHTML:{__html:n}}),(0,u.jsxs)("div",{style:{marginBottom:24},children:[y("common.click"),"\uff1a",(0,u.jsx)(c.Z,{"data-cy":"click-copy",children:x})]}),(0,u.jsx)(i.Z,{component:"div",children:(0,u.jsx)(s.Z,{label:o,autoComplete:"off","data-cy":"delete-confirm-input",variant:"outlined",fullWidth:!0,autoFocus:!0,value:e.inputVal,onChange:n=>{var o;o={...e,inputVal:n.target.value,__disableConfirm:x!==n.target.value},t({...o,__disableConfirm:o.__disableConfirm})}})})]}),confirm:m,cancel:r,onConfirm:f,onCancel:h,params:{inputVal:"",__disableConfirm:!0,...p}};return(0,u.jsx)(d.Z,{title:g.title,description:g.description,confirm:g.confirm,cancel:g.cancel,params:g.params,onConfirm:g.onConfirm,onCancel:g.onCancel})}m.propTypes={title:r().any.isRequired,keyName:r().any.isRequired,description:r().any.isRequired,confirmPlaceholder:r().any.isRequired,cancel:r().string,confirm:r().string,params:r().object,onCancel:r().func,onConfirm:r().func.isRequired},m.defaultProps={onCancel:()=>{},cancel:"",confirm:"Confirm",params:{}}},22714:(e,t,n)=>{n.d(t,{Z:()=>j});var o=n(5057),r=n(55898),i=n.n(r),s=n(92877),a=n(44846),l=n(13128),c=n(55372),d=n(11750),u=n(47020),m=n(2478),p=n(44919),h=n(68420),f=n(28726),x=n(88574),y=n(58238),g=n(14491),b=n(96266);const v=(0,s.Z)((e=>({addMenuItemRoot:{justifyContent:"center",color:e.palette.primary.main,lineHeight:"3.2"}})));function j(e){let{disabled:t,storeList:n,teamDid:r,onAdd:i}=e;const{api:s}=(0,y.h6)(),[j,Z]=(0,o.useState)(!1),[k,R]=(0,o.useState)(!0),[C,P]=(0,o.useState)(!1),[w,S]=(0,o.useState)(""),[D,N]=(0,o.useState)(""),{t:E}=(0,h.PE)(),T=v(),F=async()=>{Z(!0);try{const{isNew:e,decoded:t}=(0,g.bQ)(w,n);if(!e)throw new Error(E("store.blockletRegistry.haveSameRegistry"));await s.addBlockletStore({input:{teamDid:r,url:t}}),i(t),P(!1)}catch(e){const t="".concat(E("store.blockletRegistry.addFailed")," ").concat((0,g.Z)(e));N(t)}finally{Z(!1)}};return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(m.ZP,{button:!0,disabled:t,className:T.addMenuItemRoot,onClick:()=>{P(!0)},children:[(0,b.jsx)(p.Z,{font:!0}),(0,b.jsx)(d.Z,{variant:"inherit",children:E("store.blockletRegistry.addRegistry")})]}),(0,b.jsxs)(l.ZP,{title:E("store.blockletRegistry.addRegistry"),fullWidth:!0,maxWidth:"md",open:C,onClose:()=>P(!1),PaperProps:{style:{minHeight:"auto"}},actions:(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(f.Z,{onClick:e=>{e.stopPropagation(),P(!1)},color:"inherit",children:E("common.cancel")}),(0,b.jsxs)(f.Z,{onClick:e=>{e.stopPropagation(),F()},color:"primary","data-cy":"install-blocklet-next-step",disabled:j||!w||k,variant:"contained",autoFocus:!0,children:[j&&(0,b.jsx)(a.Z,{size:16}),E("common.confirm")]})]}),children:[(0,b.jsx)("div",{style:{paddingTop:12,overflowY:"hidden"},children:(0,b.jsx)(c.Z,{component:"div",children:(0,b.jsx)(d.Z,{component:"div",children:(0,b.jsx)(u.Z,{label:E("store.blockletRegistry.registryUrl"),autoComplete:"off",variant:"outlined",name:"url",fullWidth:!0,value:w,onChange:e=>{N(null);let t=!1;e.target.value.trim()||(t=!0),e.target.value.trim()||N(E("store.blockletRegistry.registryUrlEmpty")),S(e.target.value),R(t)},disabled:j,onKeyPress:e=>{"Enter"===e.key&&(e.preventDefault(),e.target.value.trim()?F():N(E("store.blockletRegistry.registryUrlEmpty")))}})})})}),!!D&&(0,b.jsx)(x.Z,{type:"error",style:{width:"100%"},children:D})]})]})}j.propTypes={teamDid:i().string.isRequired,disabled:i().bool,storeList:i().array,onAdd:i().func},j.defaultProps={disabled:!1,storeList:[],onAdd:()=>{}}},45170:(e,t,n)=>{n.d(t,{Z:()=>j});var o=n(92877),r=n(11750),i=n(83580),s=n(94552),a=n(67680),l=n(55898),c=n.n(l),d=n(5057),u=n(96366),m=n(68420),p=n(47595),h=n(86229),f=n(58238),x=n(71363),y=n(14491),g=n(96266);function b(e){let{store:t,teamDid:n,onDelete:o}=e;const{api:r}=(0,f.h6)(),{t:i}=(0,m.PE)(),[s,l]=(0,d.useState)(!1),[c,b]=(0,d.useState)(null),v=(0,u.Z)(),j={keyName:t.url,title:i("store.blockletRegistry.deleteRegistry"),description:i("store.blockletRegistry.deleteDesc",{name:"<b>".concat(t.url,"</b>"),color:v.palette.error.main}),confirmPlaceholder:i("store.blockletRegistry.confirmDesc",{name:t.url}),confirm:i("common.delConfirm"),cancel:i("common.cancel"),onConfirm:async()=>{try{l(!0),await r.deleteBlockletStore({input:{teamDid:n,url:t.url}}),o&&"function"===typeof o&&o()}catch(e){h.Z.error("Remove Blocklet Store Error: ".concat((0,y.Z)(e)))}finally{l(!1),b(null)}},onCancel:()=>{l(!1),b(null)}};return(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(a.Z,{disabled:s,onClick:e=>{e.stopPropagation(),b(j)},size:"large",children:(0,g.jsx)(p.default,{})}),c&&(0,g.jsx)(x.Z,{keyName:c.keyName,title:c.title,description:c.description,confirmPlaceholder:c.confirmPlaceholder,confirm:c.confirm,cancel:c.cancel,params:c.params,onConfirm:c.onConfirm,onCancel:c.onCancel})]})}b.propTypes={teamDid:c().string.isRequired,store:c().object.isRequired,onDelete:c().func},b.defaultProps={onDelete:()=>{}};const v=(0,o.Z)((()=>({buttonText:{textTransform:"none !important"},iconRoot:{minWidth:24},menuName:{display:"flex",flexDirection:"column",marginRight:"100px","& span":{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}}})));function j(e){let{teamDid:t,store:n,onDelete:o}=e;const l=v();return(0,g.jsxs)("div",{className:l.menuName,children:[(0,g.jsx)(r.Z,{component:"span",variant:"subtitle1",style:{fontWeight:"400"},children:n.name}),(0,g.jsx)(r.Z,{className:"url",component:"span",variant:"inherit",children:"".concat(n.url)}),(0,g.jsxs)(i.Z,{children:[(0,g.jsx)(a.Z,{onClick:e=>{e.stopPropagation(),window.open(n.url)},size:"large",children:(0,g.jsx)(s.Z,{})}),!n.protected&&(0,g.jsx)(b,{store:n,onDelete:o,teamDid:t})]})]})}j.propTypes={teamDid:c().string.isRequired,store:c().shape({name:c().string.isRequired,url:c().string.isRequired,protected:c().bool}).isRequired,onDelete:c().func},j.defaultProps={onDelete:()=>{}}},5952:(e,t,n)=>{n.d(t,{K_:()=>o,WC:()=>r});const o="blocklet-add-component-registry",r="server-add-registry"}}]);
|
|
1
|
+
"use strict";(self.webpackChunk_abtnode_webapp=self.webpackChunk_abtnode_webapp||[]).push([[4906],{7199:(e,t,n)=>{n.d(t,{V:()=>o.V,Z:()=>o.Z});var o=n(63406)},44906:(e,t,n)=>{n.r(t),n.d(t,{default:()=>se});var o=n(71171),r=n(5057),i=n(6352),s=n.n(i),a=n(33518),l=n(67654),c=n(11750),d=n(39948),u=n(39434),m=n(68420),p=n(5952),h=n(75793),f=n(38898),x=n(52439),y=n(71569),g=n(77121),b=n(35432),v=n(44727),j=n(4651),Z=n(74094),k=n(85493),R=n(38242),C=n(44846),P=n(28726),w=n(43316),S=n(86229),D=n(77277),N=n(23484),E=n(34937);var T=n(7199),F=n(10458),_=n.n(F),q=n(13128),U=n(73170),A=n(96266);function L(e){let{meta:t,onCancel:n,handlePaySuccess:o,storeUrl:i}=e;const{t:a}=(0,m.PE)(),{info:l}=(0,h.h6)(),[d,u]=(0,r.useState)("both"),[p,f]=(0,r.useState)(1),x=(0,Z.yP)(l),y=(0,j.FM)(t,l,i),g=()=>{o(y)},b=(0,R.getDisplayName)({meta:t});if("purchase"===d&&2===p)return(0,A.jsx)(w.Z,{open:!0,popup:!0,baseUrl:i,action:"acquire-asset",checkFn:_().create({baseURL:s()(i,"/store")}).get,onSuccess:g,onClose:n,checkTimeout:3e5,extraParams:{factory:t.nftFactory},webWalletUrl:x,disableClose:!0,saveConnect:!1,showDownload:!1,messages:{title:a("store.purchase.auth.title",{name:b}),scan:a("store.purchase.auth.scan"),confirm:a("store.purchase.auth.confirm"),success:(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(c.Z,{gutterBottom:!0,children:a("store.purchase.auth.success")}),(0,A.jsxs)(c.Z,{variant:"subtitle2",children:[" ",a("store.purchase.autoLaunch",{name:b})]})]})}});const v=q.ZP;return(0,A.jsx)(v,{title:a("store.purchase.title",{name:b}),disableEscapeKeyDown:!0,open:!0,fullWidth:!0,onClose:(e,t)=>{"backdropClick"!==t&&n()},children:(0,A.jsx)("div",{style:{marginBottom:16},children:(0,A.jsx)(U.AP,{action:d,onNext:()=>{d&&(f(2),"verify"===d&&(window.location.href=y))},onSelect:e=>{e!==d&&u(e)}})})})}L.defaultProps={handlePaySuccess:e=>{setTimeout((()=>{window.location.href=e}),1e3)}};const W=L;var B,M=n(25339);function z(e){let{meta:t,buttonText:n,storeUrl:o}=e;const{t:i}=(0,m.PE)(),s=(0,k.useNavigate)(),{info:a}=(0,h.h6)(),{api:c}=(0,M.Tt)(),d=!1===(0,R.isFreeBlocklet)(t),[u,p]=(0,r.useState)(!1),{hasPurchased:f}=function(e){const t=(0,N.Z)(),n=(0,k.useNavigate)(),[o,i]=(0,l.Z)("sid:blocklet:purchase:".concat(e)),[s,a]=(0,r.useState)(!1),[c,d]=(0,r.useState)(null),u=()=>{const{pathname:e,searchParams:t}=new URL(window.location.href),o=window.env&&window.env.apiPrefix?window.env.apiPrefix:"/";t.get("sid")&&(i(""),n(e.replace(o,"/"),{replace:!0}))},m=!(!t.get("assetDid")||!o||t.get("sid")!==o);return(0,E.mU)(D.BlockletEvents.purchaseChange,(t=>{t.did===e&&(d(t.session),["declined","confirmed","error"].includes(t.session.status)&&(a(!0),setTimeout(u,2e3)))})),(0,r.useEffect)((()=>{c&&c.id!==o&&i(c.id)}),[c]),{hasCompleted:s,hasPurchased:m,session:c,setSession:d,doRedirect:u}}(t.did),[x,y]=(0,r.useState)(!1),[g]=(0,l.Z)("instant-blocklet-install",!1),[b,F]=(0,r.useState)(!1),_=(0,r.useMemo)((()=>u?i(d?"blocklet.status.purchasing":"blocklet.status.waiting"):""),[u,i,d]),q=(0,r.useMemo)((()=>d?n.purchase:n.launch),[d,n]),U=e=>{e.preventDefault(),e.stopPropagation();try{if(p(!0),d)return void y(!0);if(g)return void F(!0);if(!d){const e=(0,j.FM)(t,a,o);return void(window.location.href=e)}}catch(n){S.Z.error((0,Z.Z)(n),{autoHideDuration:5e3}),console.error("Blocklet installed failed",n)}finally{p(!1)}};return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(v.Kk,{children:(0,A.jsx)(T.Z,{permission:"mutate_blocklets",children:e=>(0,A.jsx)(P.Z,{onClick:U,size:"small",disabled:Boolean(_||!e),variant:"outlined",color:"primary","data-cy":"install-blocklet",children:_?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(C.Z,{size:16,style:{marginRight:3}}),_]}):q},t.did)})}),(f||x)&&(0,A.jsx)(W,{method:"launch",meta:t,mode:"both",onCancel:()=>{p(!1),y(!1)},storeUrl:o}),b&&(0,A.jsx)(w.Z,{popup:!0,open:!0,forceConnected:!1,className:"launch-from-url-auth",action:"launch-free-blocklet-by-session",checkFn:c.get,checkTimeout:3e5,onSuccess:e=>{p(!1),F(!1),s("/blocklets/".concat(e.appDid,"/components"))},extraParams:{title:t.title,blockletMetaUrl:decodeURIComponent((0,Z.Rn)(o,t.did).trim())},messages:{title:i("setup.keyPair.title"),scan:i("setup.keyPair.scan"),confirm:i("setup.keyPair.confirm"),success:i("setup.keyPair.success")},onClose:()=>{p(!1),F(!1)}})]})}z.defaultProps={};const I=(e,t,n)=>{const o=(0,j.RU)(t);return s()(n,"/blocklets/".concat(e.did,"/?server-url=").concat(o))},V=e=>{let{meta:t,attribute:n,value:o}=e;return t._formatted?t._formatted[n]:o};function H(e){let{blocklet:t,endpoint:n}=e;const{t:o}=(0,m.PE)(),r=(0,h.h6)();let i=s()(r.imgPrefix,"blocklet.png");const a=n;if(a.startsWith("http")&&t.logo)i=s()(a,(0,Z.lk)(t.did,t.logo));else{let e=(window.env.apiPrefix||"/").replace(/^\/+/,"").replace(/\/+$/,"");e&&(e="/".concat(e)),i=s()(e,"/blocklet/logo/".concat(t.did))}const l=(null===r||void 0===r?void 0:r.info.mode)!==b.NODE_MODES.SERVERLESS,c={meta:t,buttonText:{purchase:o("common.purchase"),launch:o("common.launch")},storeUrl:a};return(0,A.jsx)(f.Z,{href:I(t,r.info,n),style:{color:"initial",textDecoration:"none"},onClick:e=>!!e.currentTarget.contains(e.target)||(e.preventDefault(),!1),target:"_blank",children:(0,A.jsx)(O,{title:V({meta:t,attribute:"title",value:t.title||t.name}),did:t.did,description:V({meta:t,attribute:"description",value:t.description}),cover:t.logo?i:"",version:t.version,button:l?(0,A.jsx)("div",{style:{display:"flex",alignItems:"center"},children:(0,A.jsx)(z,{...c})}):null})})}function K(e){var t;let{storeUrl:n,handleSearchSelect:o,extraFilter:i,...s}=e;const{locale:a}=(0,m.PE)(),l=(0,h.h6)(),[c,d]=(0,r.useState)({}),u=n,p=null===l||void 0===l||null===(t=l.info)||void 0===t?void 0:t.version;return(0,r.useEffect)((()=>{d({})}),[u]),(0,A.jsx)(x.ErrorBoundary,{FallbackComponent:y.H,resetKeys:[u],children:(0,A.jsx)("div",{...s,children:(0,A.jsx)(g.Z,{blockletRender:e=>{const t={...e,endpoint:u};return(0,A.jsx)(H,{...t})},baseSearch:!0,endpoint:u,locale:a,onFilterChange:e=>{d(e)},onSearchSelect:o,filters:c,extraFilter:i,serverVersion:p})})})}H.defaultProps={endpoint:""},K.defaultProps={handleSearchSelect:null,extraFilter:void 0};const O=(0,a.Z)(v.ZP)(B||(B=(0,o.Z)(["\n .ms-highlight {\n color: ",";\n }\n"])),(e=>e.theme.palette.primary.main));var $=n(92877),Q=n(19577),Y=n(2478),G=n(44067),J=n(46954),X=n(49390),ee=n(22714),te=n(45170);const ne=(0,$.Z)((()=>({buttonText:{textTransform:"none !important"},iconRoot:{minWidth:24},menuName:{display:"flex",flexDirection:"column",marginRight:"100px","& span":{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}}}))),oe=(0,r.forwardRef)(((e,t)=>{let{onChange:n,onDelete:o}=e;const{info:i}=(0,h.h6)(),{t:s}=(0,m.PE)(),[a,d]=(0,r.useState)(!1),[u,f]=(0,r.useState)(!1),[x,y]=(0,r.useState)(-1),g=ne(),[b,v]=(0,l.Z)(p.WC),j=Math.max(i.blockletRegistryList.findIndex((e=>e.url===b)),0);return(0,r.useImperativeHandle)(t,(()=>({setOpen:f}))),(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(T.Z,{permission:"mutate_node",children:e=>(0,A.jsx)(P.Z,{disabled:!e,classes:{text:g.buttonText},color:"secondary","data-cy":"store-toggle",onClick:()=>{f(!0)},endIcon:(0,A.jsx)(X.Z,{}),children:(0,A.jsx)(c.Z,{color:"secondary",children:i.blockletRegistryList[j].name})})}),(0,A.jsx)(q.ZP,{title:s("store.blockletRegistry.switchRegistry"),disableEscapeKeyDown:!0,disablePortal:!1,fullWidth:!0,open:u,onClose:()=>f(!1),children:(0,A.jsxs)(Q.Z,{className:g.tabPanel,children:[i.blockletRegistryList.map(((e,t)=>(0,A.jsxs)(Y.ZP,{button:!0,disabled:a,selected:j===t,"data-cy":"store-switch",onClick:()=>{a||(t!==j?(e=>{try{d(!0),y(e);const t=i.blockletRegistryList[e];v(t.url),n(t.url),f(!1)}catch(t){console.error(t),S.Z.error("".concat(s("store.blockletRegistry.changeFailed")," ").concat((0,Z.Z)(t)))}finally{d(!1)}})(t):f(!1))},children:[(0,A.jsx)(J.Z,{className:g.iconRoot,children:x===t&&a&&(0,A.jsx)(C.Z,{size:16})}),(0,A.jsx)(G.Z,{children:(0,A.jsx)(te.Z,{teamDid:i.did,store:e,onDelete:()=>o(e.url)})})]},e.url))),(0,A.jsx)(ee.Z,{disabled:a,onAdd:n,teamDid:i.did,blockletRegistryList:i.blockletRegistryList})]})})]})}));oe.defaultProps={onChange:()=>{},onDelete:()=>{}};const re=oe;var ie;function se(){const{t:e}=(0,m.PE)(),{info:t}=(0,h.h6)(),[n]=(0,l.Z)(p.WC),{blockletRegistryList:o}=t,i=o.find((e=>n===e.url))||o[0],[a,f]=(0,r.useState)(i.url),x=t.routing.adminPath,y=s()(window.location.origin,x),g=(0,r.useRef)(null);return(0,A.jsxs)(ae,{children:[(0,A.jsxs)(u.Z,{separator:"\u203a","aria-label":"breadcrumb",className:"page-breadcrumb",children:[(0,A.jsx)(c.Z,{color:"textPrimary",children:e("common.store")}),(0,A.jsx)(re,{ref:g,onChange:e=>f(e),onDelete:e=>{var n;a===e&&f(null===(n=t.blockletRegistryList[0])||void 0===n?void 0:n.url)}})]}),(0,A.jsx)(d.Z,{className:"store-header",display:"flex",justifyContent:"space-between",p:0,m:0,children:(0,A.jsx)(c.Z,{component:"h2",variant:"h4",className:"page-header",color:"textPrimary",children:e("store.headerDescription")})}),(0,A.jsx)(K,{className:"blocklet-list",handleSearchSelect:e=>{let{detailUrl:t}=e;const n=new URL(t);n.searchParams.set("server-url",y);const o=document.createElement("a");o.setAttribute("target","_blank"),o.setAttribute("href",n.href),o.click()},storeUrl:a})]})}const ae=a.Z.main(ie||(ie=(0,o.Z)(["\n @media (max-width: ","px) {\n .store-header {\n flex-direction: column;\n margin-bottom: 32px !important;\n }\n\n .page-header {\n margin-bottom: 16px !important;\n }\n }\n .blocklet-list {\n aside:hover {\n height: calc(100vh - 235px);\n }\n }\n"])),(e=>e.theme.breakpoints.values.sm))},73170:(e,t,n)=>{n.d(t,{$7:()=>x,AP:()=>g});var o=n(92877),r=n(55898),i=n.n(r),s=n(19577),a=n(2478),l=n(44067),c=n(46954),d=n(42507),u=n(40184),m=n(28726),p=n(76223),h=n(68420),f=n(96266);const x={meta:i().object.isRequired,onCancel:i().func.isRequired},y=(0,o.Z)((()=>({dialogAuth:{padding:"0 0 24px !important","& .auth-title":{textAlign:"center !important",marginBottom:"4px !important"},"& .auth-tip--scan":{textAlign:"center !important"}},iconRoot:{minWidth:48}})));function g(e){let{action:t,onSelect:n,onNext:o}=e;const r=y(),{t:i}=(0,h.PE)(),x=[{action:"purchase",title:i("store.purchase.purchase.title"),description:i("store.purchase.purchase.description")},{action:"verify",title:i("store.purchase.verify.title"),description:i("store.purchase.verify.description")}];return(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(s.Z,{className:r.tabPanel,children:x.map((e=>(0,f.jsxs)(a.ZP,{button:!0,selected:t===e.action,onClick:()=>n(e.action),children:[(0,f.jsx)(c.Z,{className:r.iconRoot,children:"purchase"===e.action?(0,f.jsx)(d.Z,{style:{color:"purchase"===t?p.Z.primary.main:"#AAA",fontSize:32}}):(0,f.jsx)(u.Z,{style:{color:"verify"===t?p.Z.primary.main:"#AAA",fontSize:32}})}),(0,f.jsx)(l.Z,{primary:e.title,secondary:e.description})]},e.action)))}),o&&(0,f.jsx)(m.Z,{fullWidth:!0,disabled:!t,variant:"contained",color:"primary",style:{marginTop:16},onClick:o,children:i("common.next")})]})}g.propTypes={action:i().oneOf(["both","purchase","verify"]).isRequired,onSelect:i().func.isRequired,onNext:i().func.isRequired}},50185:(e,t,n)=>{n.d(t,{Z:()=>c});var o=n(5057),r=n(55898),i=n.n(r),s=n(12937),a=n(68420),l=n(96266);function c(e){let{children:t,...n}=e;const{t:r}=(0,o.useContext)(a.RD);return(0,l.jsx)(s.Z,{tip:r("common.copyTip"),copiedTip:r("common.copiedTip"),...n,children:t})}c.propTypes={children:i().any.isRequired}},71363:(e,t,n)=>{n.d(t,{Z:()=>m});var o=n(55898),r=n.n(o),i=n(11750),s=n(47020),a=n(93938),l=n(68420),c=n(50185),d=n(70461),u=n(96266);function m(e){let{title:t,description:n,confirmPlaceholder:o,cancel:r,confirm:m,params:p,onCancel:h,onConfirm:f,keyName:x}=e;const{t:y}=(0,l.PE)(),g={title:()=>(0,u.jsxs)("div",{children:[t," (".concat(x,")")]}),description:(e,t)=>(0,u.jsxs)("div",{children:[(0,u.jsx)(a.Z,{severity:"warning",style:{width:"100%"},children:y("common.notice")}),(0,u.jsx)("div",{style:{marginTop:24,marginBottom:24},dangerouslySetInnerHTML:{__html:n}}),(0,u.jsxs)("div",{style:{marginBottom:24},children:[y("common.click"),"\uff1a",(0,u.jsx)(c.Z,{"data-cy":"click-copy",children:x})]}),(0,u.jsx)(i.Z,{component:"div",children:(0,u.jsx)(s.Z,{label:o,autoComplete:"off","data-cy":"delete-confirm-input",variant:"outlined",fullWidth:!0,autoFocus:!0,value:e.inputVal,onChange:n=>{var o;o={...e,inputVal:n.target.value,__disableConfirm:x!==n.target.value},t({...o,__disableConfirm:o.__disableConfirm})}})})]}),confirm:m,cancel:r,onConfirm:f,onCancel:h,params:{inputVal:"",__disableConfirm:!0,...p}};return(0,u.jsx)(d.Z,{title:g.title,description:g.description,confirm:g.confirm,cancel:g.cancel,params:g.params,onConfirm:g.onConfirm,onCancel:g.onCancel})}m.propTypes={title:r().any.isRequired,keyName:r().any.isRequired,description:r().any.isRequired,confirmPlaceholder:r().any.isRequired,cancel:r().string,confirm:r().string,params:r().object,onCancel:r().func,onConfirm:r().func.isRequired},m.defaultProps={onCancel:()=>{},cancel:"",confirm:"Confirm",params:{}}},22714:(e,t,n)=>{n.d(t,{Z:()=>j});var o=n(5057),r=n(55898),i=n.n(r),s=n(92877),a=n(44846),l=n(13128),c=n(55372),d=n(11750),u=n(47020),m=n(2478),p=n(44919),h=n(68420),f=n(28726),x=n(88574),y=n(58238),g=n(14491),b=n(96266);const v=(0,s.Z)((e=>({addMenuItemRoot:{justifyContent:"center",color:e.palette.primary.main,lineHeight:"3.2"}})));function j(e){let{disabled:t,storeList:n,teamDid:r,onAdd:i}=e;const{api:s}=(0,y.h6)(),[j,Z]=(0,o.useState)(!1),[k,R]=(0,o.useState)(!0),[C,P]=(0,o.useState)(!1),[w,S]=(0,o.useState)(""),[D,N]=(0,o.useState)(""),{t:E}=(0,h.PE)(),T=v(),F=async()=>{Z(!0);try{const{isNew:e,decoded:t}=(0,g.bQ)(w,n);if(!e)throw new Error(E("store.blockletRegistry.haveSameRegistry"));await s.addBlockletStore({input:{teamDid:r,url:t}}),i(t),P(!1)}catch(e){const t="".concat(E("store.blockletRegistry.addFailed")," ").concat((0,g.Z)(e));N(t)}finally{Z(!1)}};return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(m.ZP,{button:!0,disabled:t,className:T.addMenuItemRoot,onClick:()=>{P(!0)},children:[(0,b.jsx)(p.Z,{font:!0}),(0,b.jsx)(d.Z,{variant:"inherit",children:E("store.blockletRegistry.addRegistry")})]}),(0,b.jsxs)(l.ZP,{title:E("store.blockletRegistry.addRegistry"),fullWidth:!0,maxWidth:"md",open:C,onClose:()=>P(!1),PaperProps:{style:{minHeight:"auto"}},actions:(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(f.Z,{onClick:e=>{e.stopPropagation(),P(!1)},color:"inherit",children:E("common.cancel")}),(0,b.jsxs)(f.Z,{onClick:e=>{e.stopPropagation(),F()},color:"primary","data-cy":"install-blocklet-next-step",disabled:j||!w||k,variant:"contained",autoFocus:!0,children:[j&&(0,b.jsx)(a.Z,{size:16}),E("common.confirm")]})]}),children:[(0,b.jsx)("div",{style:{paddingTop:12,overflowY:"hidden"},children:(0,b.jsx)(c.Z,{component:"div",children:(0,b.jsx)(d.Z,{component:"div",children:(0,b.jsx)(u.Z,{label:E("store.blockletRegistry.registryUrl"),autoComplete:"off",variant:"outlined",name:"url",fullWidth:!0,value:w,onChange:e=>{N(null);let t=!1;e.target.value.trim()||(t=!0),e.target.value.trim()||N(E("store.blockletRegistry.registryUrlEmpty")),S(e.target.value),R(t)},disabled:j,onKeyPress:e=>{"Enter"===e.key&&(e.preventDefault(),e.target.value.trim()?F():N(E("store.blockletRegistry.registryUrlEmpty")))}})})})}),!!D&&(0,b.jsx)(x.Z,{type:"error",style:{width:"100%"},children:D})]})]})}j.propTypes={teamDid:i().string.isRequired,disabled:i().bool,storeList:i().array,onAdd:i().func},j.defaultProps={disabled:!1,storeList:[],onAdd:()=>{}}},45170:(e,t,n)=>{n.d(t,{Z:()=>j});var o=n(92877),r=n(11750),i=n(83580),s=n(94552),a=n(67680),l=n(55898),c=n.n(l),d=n(5057),u=n(96366),m=n(68420),p=n(47595),h=n(86229),f=n(58238),x=n(71363),y=n(14491),g=n(96266);function b(e){let{store:t,teamDid:n,onDelete:o}=e;const{api:r}=(0,f.h6)(),{t:i}=(0,m.PE)(),[s,l]=(0,d.useState)(!1),[c,b]=(0,d.useState)(null),v=(0,u.Z)(),j={keyName:t.url,title:i("store.blockletRegistry.deleteRegistry"),description:i("store.blockletRegistry.deleteDesc",{name:"<b>".concat(t.url,"</b>"),color:v.palette.error.main}),confirmPlaceholder:i("store.blockletRegistry.confirmDesc",{name:t.url}),confirm:i("common.delConfirm"),cancel:i("common.cancel"),onConfirm:async()=>{try{l(!0),await r.deleteBlockletStore({input:{teamDid:n,url:t.url}}),o&&"function"===typeof o&&o()}catch(e){h.Z.error("Remove Blocklet Store Error: ".concat((0,y.Z)(e)))}finally{l(!1),b(null)}},onCancel:()=>{l(!1),b(null)}};return(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(a.Z,{disabled:s,onClick:e=>{e.stopPropagation(),b(j)},size:"large",children:(0,g.jsx)(p.default,{})}),c&&(0,g.jsx)(x.Z,{keyName:c.keyName,title:c.title,description:c.description,confirmPlaceholder:c.confirmPlaceholder,confirm:c.confirm,cancel:c.cancel,params:c.params,onConfirm:c.onConfirm,onCancel:c.onCancel})]})}b.propTypes={teamDid:c().string.isRequired,store:c().object.isRequired,onDelete:c().func},b.defaultProps={onDelete:()=>{}};const v=(0,o.Z)((()=>({buttonText:{textTransform:"none !important"},iconRoot:{minWidth:24},menuName:{display:"flex",flexDirection:"column",marginRight:"100px","& span":{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}}})));function j(e){let{teamDid:t,store:n,onDelete:o}=e;const l=v();return(0,g.jsxs)("div",{className:l.menuName,children:[(0,g.jsx)(r.Z,{component:"span",variant:"subtitle1",style:{fontWeight:"400"},children:n.name}),(0,g.jsx)(r.Z,{className:"url",component:"span",variant:"inherit",children:"".concat(n.url)}),(0,g.jsxs)(i.Z,{children:[(0,g.jsx)(a.Z,{onClick:e=>{e.stopPropagation(),window.open(n.url)},size:"large",children:(0,g.jsx)(s.Z,{})}),!n.protected&&(0,g.jsx)(b,{store:n,onDelete:o,teamDid:t})]})]})}j.propTypes={teamDid:c().string.isRequired,store:c().shape({name:c().string.isRequired,url:c().string.isRequired,protected:c().bool}).isRequired,onDelete:c().func},j.defaultProps={onDelete:()=>{}}},5952:(e,t,n)=>{n.d(t,{K_:()=>o,WC:()=>r});const o="blocklet-add-component-registry",r="server-add-registry"}}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(self.webpackChunk_abtnode_webapp=self.webpackChunk_abtnode_webapp||[]).push([[5015],{85555:(n,t,e)=>{e.r(t),e.d(t,{default:()=>h});var a=e(5057),o=e(68420),i=e(28358),r=e(38242),l=e(74782),s=e(35918),d=e(96266);function h(n){let{blocklet:t,...e}=n;const{t:h}=(0,a.useContext)(o.RD),u=(0,r.getBlockletServices)(t);if(0===u.length)return(0,d.jsx)("div",{children:h("blocklet.noService")});const c=[{title:h("common.name"),field:"name"},{title:h("common.protocol"),field:"protocol"},{title:h("common.port"),field:"port"},{title:h("blocklet.upstreamPort"),field:"upstreamPort"}];return(0,d.jsx)(l.Z,{...e,children:(0,d.jsx)(i.ZP,{columns:c,icons:{...s.Z},options:{sorting:!1,emptyRowsWhenPaging:!1,actionsColumnIndex:-1,tableLayout:"auto",maxBodyHeight:"100%",search:!1,pageSize:1e3,pageSizeOptions:[1e3]},localization:{body:{emptyDataSourceMessage:h("blocklet.noService")}},data:u})})}},35918:(n,t,e)=>{e.d(t,{Z:()=>v});var a=e(44919),o=e(42876),i=e(27773),r=e(11997),l=e(93734),s=e(76667),d=e(39293),h=e(36903),u=e(3422),c=e(92273),p=e(72906),m=e(57201),g=e(49390),b=e(33225),f=e(30770);const v={Add:a.Z,Check:o.default,Delete:i.default,Edit:s.default,Clear:r.default,DetailPanel:c.default,Filter:d.Z,FirstPage:h.default,LastPage:u.default,NextPage:c.default,PreviousPage:p.default,Search:m.default,ResetSearch:r.default,SortArrow:g.Z,Export:l.default,ThirdStateCheck:b.default,ViewColumn:f.default}},74782:(n,t,e)=>{e.d(t,{Z:()=>i});var a,o=e(71171);const i=e(33518).Z.div(a||(a=(0,o.Z)(["\n .MuiPaper-root {\n box-shadow: none !important;\n border: none !important;\n border-radius: 0 !important;\n background: transparent;\n }\n .MuiToolbar-root {\n background: transparent;\n padding-left: 0;\n display: none;\n }\n\n &.show-pagination {\n .MuiTablePagination-toolbar {\n display: flex;\n }\n }\n\n .MuiTableHead-root th {\n min-width: 100px;\n background: transparent;\n }\n\n .MuiTable-root {\n overflow-y: hidden;\n }\n .MuiTableRow-root {\n border: none !important;\n }\n\n .MuiTableCell-root {\n padding-right: 16px;\n &:last-of-type {\n padding-right: 0;\n }\n }\n\n /* @material-table/core@next \u517c\u5bb9 mui v5, \u4f46 pagination \u6837\u5f0f\u4f3c\u4e4e\u6709\u4e9b\u95ee\u9898, \u6682\u5730\u5b9a\u5236\u4e0b\u9762\u7684\u6837\u5f0f\u4fee\u590d, \u540e\u9762\u8003\u8651\u5f03\u7528 material-table */\n .MuiTablePagination-selectLabel,\n .MuiTablePagination-displayedRows {\n display: none;\n }\n .MuiTypography-caption {\n display: inline-block;\n }\n .MuiTablePagination-selectLabel + .MuiInputBase-root {\n margin-right: 8px;\n }\n"])))},44919:(n,t,e)=>{var a=e(71600);t.Z=void 0;var o=a(e(56930)),i=e(96266),r=(0,o.default)((0,i.jsx)("path",{d:"M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"}),"Add");t.Z=r},5939:(n,t,e)=>{e.d(t,{Z:()=>A});var a=e(71171),o=e(31461),i=e(7896),r=e(5057),l=e(9978),s=e(21371),d=e(91213),h=e(32493),u=e(66685),c=e(62773),p=e(42908),m=e(31821),g=e(18561);function b(n){return(0,g.Z)("MuiSkeleton",n)}(0,m.Z)("MuiSkeleton",["root","text","rectangular","rounded","circular","pulse","wave","withChildren","fitContent","heightAuto"]);var f,v,w,k,y=e(96266);const Z=["animation","className","component","height","style","variant","width"];let C,x,S,M;const P=(0,s.keyframes)(C||(C=f||(f=(0,a.Z)(["\n 0% {\n opacity: 1;\n }\n\n 50% {\n opacity: 0.4;\n }\n\n 100% {\n opacity: 1;\n }\n"])))),R=(0,s.keyframes)(x||(x=v||(v=(0,a.Z)(["\n 0% {\n transform: translateX(-100%);\n }\n\n 50% {\n /* +0.5s of delay between each loop */\n transform: translateX(100%);\n }\n\n 100% {\n transform: translateX(100%);\n }\n"])))),T=(0,c.ZP)("span",{name:"MuiSkeleton",slot:"Root",overridesResolver:(n,t)=>{const{ownerState:e}=n;return[t.root,t[e.variant],!1!==e.animation&&t[e.animation],e.hasChildren&&t.withChildren,e.hasChildren&&!e.width&&t.fitContent,e.hasChildren&&!e.height&&t.heightAuto]}})((n=>{let{theme:t,ownerState:e}=n;const a=(0,h.Wy)(t.shape.borderRadius)||"px",o=(0,h.YL)(t.shape.borderRadius);return(0,i.Z)({display:"block",backgroundColor:t.vars?t.vars.palette.Skeleton.bg:(0,u.Fq)(t.palette.text.primary,"light"===t.palette.mode?.11:.13),height:"1.2em"},"text"===e.variant&&{marginTop:0,marginBottom:0,height:"auto",transformOrigin:"0 55%",transform:"scale(1, 0.60)",borderRadius:"".concat(o).concat(a,"/").concat(Math.round(o/.6*10)/10).concat(a),"&:empty:before":{content:'"\\00a0"'}},"circular"===e.variant&&{borderRadius:"50%"},"rounded"===e.variant&&{borderRadius:(t.vars||t).shape.borderRadius},e.hasChildren&&{"& > *":{visibility:"hidden"}},e.hasChildren&&!e.width&&{maxWidth:"fit-content"},e.hasChildren&&!e.height&&{height:"auto"})}),(n=>{let{ownerState:t}=n;return"pulse"===t.animation&&(0,s.css)(S||(S=w||(w=(0,a.Z)(["\n animation: "," 2s ease-in-out 0.5s infinite;\n "]))),P)}),(n=>{let{ownerState:t,theme:e}=n;return"wave"===t.animation&&(0,s.css)(M||(M=k||(k=(0,a.Z)(["\n position: relative;\n overflow: hidden;\n\n /* Fix bug in Safari https://bugs.webkit.org/show_bug.cgi?id=68196 */\n -webkit-mask-image: -webkit-radial-gradient(white, black);\n\n &::after {\n animation: "," 2s linear 0.5s infinite;\n background: linear-gradient(\n 90deg,\n transparent,\n ",",\n transparent\n );\n content: '';\n position: absolute;\n transform: translateX(-100%); /* Avoid flash during server-side hydration */\n bottom: 0;\n left: 0;\n right: 0;\n top: 0;\n }\n "]))),R,(e.vars||e).palette.action.hover)})),A=r.forwardRef((function(n,t){const e=(0,p.Z)({props:n,name:"MuiSkeleton"}),{animation:a="pulse",className:r,component:s="span",height:h,style:u,variant:c="text",width:m}=e,g=(0,o.Z)(e,Z),f=(0,i.Z)({},e,{animation:a,component:s,variant:c,hasChildren:Boolean(g.children)}),v=(n=>{const{classes:t,variant:e,animation:a,hasChildren:o,width:i,height:r}=n,l={root:["root",e,a,o&&"withChildren",o&&!i&&"fitContent",o&&!r&&"heightAuto"]};return(0,d.Z)(l,b,t)})(f);return(0,y.jsx)(T,(0,i.Z)({as:s,ref:t,className:(0,l.Z)(v.root,r),ownerState:f},g,{style:(0,i.Z)({width:m,height:h},u)}))}))}}]);
|