@abtnode/webapp 1.16.20-beta-bb1cd034 → 1.16.20-beta-e32e39d7
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.yml +1 -1
- package/build/asset-manifest.json +5 -5
- package/build/index.html +1 -1
- package/build/service-worker.js +1 -1
- package/build/static/js/{3883.61409707.chunk.js → 3883.46d0ebdd.chunk.js} +1 -1
- package/build/static/js/4775.b0cede7b.chunk.js +1 -0
- package/build/static/js/9277.babc5673.chunk.js +1 -0
- package/build/static/js/{main.d254ff10.js → main.c88b220e.js} +2 -2
- package/package.json +1 -1
- package/build/static/js/4775.c9c59b2e.chunk.js +0 -1
- package/build/static/js/9277.b9c7a9e7.chunk.js +0 -1
- /package/build/static/js/{main.d254ff10.js.LICENSE.txt → main.c88b220e.js.LICENSE.txt} +0 -0
|
@@ -0,0 +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(68598),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(76811),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")})})]})}}}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_abtnode_webapp=self.webpackChunk_abtnode_webapp||[]).push([[9277],{56742:(e,n,i)=>{const{toBuffer:t,toAddress:o}=i(49394),{base32:r}=i(46422);e.exports={encode:e=>{if(!e)return e;const n=t(o(e));return r.encode(n)}}},44543:(e,n,i)=>{const t=i(57156);e.exports=(e,n)=>t(e)===t(n)},92726:(e,n,i)=>{"use strict";i.d(n,{Z:()=>x});var t,o=i(71171),r=i(5057),a=i(55898),s=i.n(a),l=i(33518),d=i(67680),c=i(61533),m=i(74490),u=i(45267),p=i(46954),f=i(44067),h=i(96266);function x(e){let{actions:n,size:i,...t}=e;const[o,a]=(0,r.useState)(null),s=Boolean(o),l=e=>{try{e.stopPropagation(),e.preventDefault()}catch{}a(null)};return(0,h.jsxs)(g,{...t,children:[(0,h.jsx)(d.Z,{"aria-label":"more","aria-controls":"actions-menu","aria-haspopup":"true","data-cy":"actions-menu-icon",onClick:e=>{try{e.stopPropagation(),e.preventDefault()}catch{}a(e.currentTarget)},size:i,children:(0,h.jsx)(u.Z,{})}),(0,h.jsx)(c.Z,{id:"actions-menu","data-cy":"actions-menu",anchorEl:o,keepMounted:!0,open:s,onClose:l,PaperProps:{},children:n.map(((e,n)=>{if("function"===typeof e)return e({close:l});const{icon:i,text:t,onClick:o,disabled:a=!1,...s}=e;return(0,r.createElement)(m.Z,{...s,disabled:a,dense:!0,onClick:async e=>{await o(e),l()},key:n,"data-cy":"actions-menu-".concat(n)},(0,h.jsx)(p.Z,{style:{minWidth:24,marginRight:8},children:i}),(0,h.jsx)(f.Z,{primary:t}))}))})]})}x.propTypes={actions:s().array,size:s().oneOf(["small","medium","large"])},x.defaultProps={actions:[],size:"small"};const g=l.Z.div(t||(t=(0,o.Z)([""])))},99277:(e,n,i)=>{"use strict";i.r(n),i.d(n,{default:()=>Le});var t=i(71171),o=i(28726),r=i(33518),a=i(5057),s=i(17655),l=i(76720),d=i(64886),c=i(68420),m=i(19778),u=i(38242),p=i(11750),f=i(29054),h=i(58238),x=i(17450),g=i(14491),v=i(81010),j=i(4651),y=i(55898),b=i.n(y),Z=i(44919),k=i(76416),D=i(93938),P=i(39948),C=i(38763),T=i(75392),S=i(67680),R=i(11819),w=i(75239),A=i(96366),E=i(72904),I=i(56742),F=i(49714),q=i(18067),z=i(25710),N=i(44846),L=i(63406),_=i(74511),B=i(88574),O=i(86229),M=i(76811),W=i(70461),U=i(96266);const H=e=>["waiting","creating","renewaling"].includes(e);function K(e){var n,i;const{t:t}=(0,c.PE)(),[o,r]=(0,a.useState)(!1),{inService:s}=(0,h.h6)(),[l,d]=(0,a.useState)(null),{siteId:m,domain:u,onAdd:p,children:x,did:g}=e,[v,j]=(0,a.useState)(!1),{api:y,ws:{useSubscription:b}}=(0,h.h6)(),{mode:Z,actions:{refreshDomainStatus:k}}=(0,f.y0)(),D=(0,_.Z)((async()=>{const{cert:e}=await y.findCertificateByDomain({input:{domain:u,did:g}});return e})),P=(e,n)=>{e.domain===u&&(j(!1),r(!1),s&&"setup"!==Z&&("success"===n?O.Z.success(t("setup.domain.genCertSuccess",{domain:e.domain})):"error"===n&&O.Z.error(t("setup.domain.genCertFailed",{domain:e.domain,message:e.message}))))};if((0,a.useEffect)((()=>{var e;D.loading||j(H(null===(e=D.value)||void 0===e?void 0:e.status))}),[D.loading,null===(n=D.value)||void 0===n?void 0:n.status]),b(M.BlockletEvents.certError,(e=>P(e,"error"))),b(M.BlockletEvents.certIssued,(e=>{D.retry(),k(e.domain),P(e,"success")})),D.loading)return"";if("normal"===(null===(i=D.value)||void 0===i?void 0:i.status))return"";const C={title:t("router.cert.genLetsEncryptCert.title"),description:(0,U.jsxs)("div",{children:[(0,U.jsx)(B.Z,{type:"success",children:t("router.cert.genLetsEncryptCert.dnsTip")}),t("router.cert.genLetsEncryptCert.description")]}),confirm:t("common.confirm"),onConfirm:async()=>{r(!0);try{await y.issueLetsEncryptCert({input:{siteId:m,domain:u,did:g,inBlockletSetup:"setup"===Z}}),p(),j(!0)}catch(e){console.error(e),j(!1)}finally{r(!1),d(null)}},onCancel:()=>{r(!1),d(null)}};return(0,U.jsxs)(U.Fragment,{children:[v?(0,U.jsx)(w.Z,{title:t("router.cert.issuing"),children:(0,U.jsx)(N.Z,{size:12})}):x({loading:o,open:e=>{e.stopPropagation(),d(C)}}),l&&(0,U.jsx)(W.Z,{color:"primary",title:l.title,description:l.description,confirm:l.confirm,params:l.params,onConfirm:l.onConfirm,onCancel:l.onCancel})]})}function V(e){const{domain:n,domainStatus:i,...t}=e;return!(0,g.rM)(n)||null!==i&&void 0!==i&&i.isHttps?"":(0,U.jsx)(K,{domain:n,...t})}K.propTypes={domain:b().string.isRequired,did:b().string.isRequired,siteId:b().string.isRequired,onAdd:b().func,children:b().any},K.defaultProps={onAdd:()=>{},children:null},V.propTypes={domain:b().string.isRequired,domainStatus:b().shape({isHttps:b().bool}).isRequired,did:b().string.isRequired,onAdd:b().func,children:b().any},V.defaultProps={onAdd:()=>{},children:null};var Y=i(11593),G=i(74490),X=i(31853),J=i(51233),Q=i(49983),$=i(96538),ee=i(38898),ne=i(47020),ie=i(92706),te=i.n(ie),oe=i(11854),re=i.n(oe),ae=i(6352),se=i.n(ae),le=i(60344),de=i(12937);function ce(e){let{domain:n,resolvedTarget:i,...t}=e;const{t:o,locale:r}=(0,c.PE)();return(0,U.jsxs)(P.Z,{sx:{backgroundColor:"rgb(236, 251, 253)",borderColor:"rgb(236, 251, 253)",borderRadius:"8px",padding:"12px"},...t,children:[(0,U.jsxs)(P.Z,{display:"flex",children:[o("router.domain.setup.tipStart"),n&&(0,U.jsx)(P.Z,{mx:.5,color:"primary.main",fontWeight:"fontWeightBold",children:n}),o("router.domain.setup.tipEnd"),":"]}),(0,U.jsxs)(P.Z,{sx:{"&>div":{mb:0},marginTop:"8px"},children:[(0,U.jsx)(me,{label:o("router.domain.setup.recordType"),value:"CNAME",locale:r}),(0,U.jsx)(me,{label:o("router.domain.setup.recordValue"),value:i,locale:r})]})]})}function me(e){let{locale:n,label:i,value:t}=e;const o=(0,E.Z)((e=>e.breakpoints.down("md"))),r=(0,A.Z)();return(0,U.jsx)(d.Z,{name:i,nameWidth:120,children:(0,U.jsxs)(P.Z,{sx:{display:"flex",alignItems:"center",lineHeight:1},children:[(0,U.jsx)(p.Z,{component:"span",color:"primary.main",overflow:"auto",sx:o?{maxWidth:"95%",wordWrap:"break-word"}:{wordWrap:"break-word"},children:t}),(0,U.jsx)(de.q,{content:t,locale:n,style:{marginLeft:"4px",color:r.palette.text.secondary}})]})})}function ue(e){let{siteId:n,teamDid:i,cnameDomain:t,defaultCustomDomain:r,onInputDomain:a,appId:s,appPk:l,onSuccess:d,disabled:m,autoFocus:u,inBlockletSetup:p,...f}=e;const{t:x,locale:v}=(0,c.PE)(),{api:j,info:y}=(0,h.h6)(),[b,Z]=(0,X.Z)({domain:r,error:null,type:null!==y&&void 0!==y&&y.nftDomainUrl?"nftDomain":"inputDomain",showNFTDomainAuth:!1});let k="";y.nftDomainUrl&&(k=se()(y.nftDomainUrl,"/api"));const D=async e=>{let{domain:t,nftDid:o,chainHost:r}=e;try{const e=(0,J.sf)(t);await j.addDomainAlias({input:{id:n,type:"nft-domain",domainAlias:e,nftDid:o,chainHost:r,teamDid:i,inBlockletSetup:p}}),await(0,g._v)(2e3),Z({confirmSetting:null,showNFTDomainAuth:!1}),d({domain:e,type:b.type,nftDid:o,chainHost:r})}finally{Z({openAuthNFTDomain:!1})}},C={inputDomain:{name:x("router.domainAlias.inputDomain"),component:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(ne.Z,{label:x("router.domainAlias.add.domainDescription"),helperText:b.error||x("router.domainAlias.add.helperText"),inputProps:{"data-cy":"domain-name-input"},fullWidth:!0,disabled:m,value:b.domain,onChange:e=>{var n;const i=re()(null===(n=e.target)||void 0===n?void 0:n.value);Z({domain:i});const t=(0,g.ub)(i,v);Z({domain:i,error:t}),a({domain:i,error:t})},autoFocus:u,onBlur:()=>{b.domain||Z({error:null})},size:"small",variant:"outlined",error:!!b.error}),(0,U.jsx)(ce,{domain:b.domain,resolvedTarget:t,style:{marginTop:"8px"}})]})}};null!==y&&void 0!==y&&y.nftDomainUrl&&(C.nftDomain={name:x("router.domainAlias.nftDomain"),component:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(P.Z,{sx:{maxWidth:"640px",color:"text.secondary",fontSize:"14px"},children:[(0,U.jsx)("div",{children:x("router.domainAlias.addDomainNFT.tips")}),(0,U.jsxs)("div",{children:[x("router.domainAlias.addDomainNFT.buyTip"),(0,U.jsxs)(ee.Z,{href:y.nftDomainUrl,sx:{fontSize:"14px",display:"inline-flex",alignItems:"center"},target:"_blank",children:[(0,U.jsx)("i",{children:x("router.domainAlias.addDomainNFT.buy")}),(0,U.jsx)($.Z,{fontSize:"small"})]})]})]}),(0,U.jsx)(o.Z,{sx:{marginTop:"8px"},disabled:m,onClick:()=>Z({showNFTDomainAuth:!0}),variant:"contained",children:x("router.domainAlias.addDomainNFT.showNFT")}),(0,U.jsx)(Q.Z,{open:b.showNFTDomainAuth,popup:!0,useSocket:!1,action:"authorize",baseUrl:k,checkFn:le.od.create({baseURL:k}).get,extraParams:{delegatee:s,delegateePk:l},onSuccess:D,onClose:()=>Z({showNFTDomainAuth:!1}),checkTimeout:3e5,showDownload:!1,messages:{title:x("router.domainAlias.addDomainNFT.connect.title"),scan:x("router.domainAlias.addDomainNFT.connect.scan"),confirm:x("router.domainAlias.addDomainNFT.connect.confirm"),success:x("router.domainAlias.addDomainNFT.connect.success")}})]})});const T=Object.keys(C);return T.sort((e=>"inputDomain"===e?1:-1)),(0,U.jsx)(P.Z,{...f,children:(0,U.jsx)(P.Z,{sx:{display:"flex",flexDirection:"column",justifyContent:"flex-start",gap:"1em"},children:T.map(((e,n)=>{var i,t;return(0,U.jsxs)(P.Z,{children:[T.length>1&&(0,U.jsx)(P.Z,{children:"".concat(x("optionsOrder.".concat(n+1)),": ").concat(null===(i=C[e])||void 0===i?void 0:i.name)}),(0,U.jsx)(P.Z,{sx:{marginTop:"8px"},children:null===(t=C[e])||void 0===t?void 0:t.component})]},e)}))})})}function pe(e){let{id:n,children:i,title:t,teamDid:o,systemDomains:r,appId:a,appPk:s}=e;const{t:l}=(0,c.PE)(),{api:d}=(0,h.h6)(),[m,u]=(0,X.Z)({loading:!1,confirmSetting:null}),p=r.find((e=>(0,F.isDidDomain)(e))),f={title:t||l("router.domainAlias.add.title"),description:function(e,i,t){return(0,U.jsx)(ue,{siteId:n,teamDid:o,cnameDomain:p,onSuccess:()=>u({confirmSetting:null}),onInputDomain:n=>{let{domain:o,error:r}=n;i({...e,domain:o,__disableConfirm:!!r}),t(r)},appId:a,appPk:s})},confirm:l("common.confirm"),cancel:l("common.cancel"),params:{domain:"",__disableConfirm:!0},onConfirm:async e=>{if(!m.loading){u({loading:!0});try{await d.addDomainAlias({input:{id:n,domainAlias:(0,J.sf)(e.domain),teamDid:o}}),await(0,g._v)(2e3),u({confirmSetting:null})}finally{u({loading:!1})}}},onCancel:()=>{u({loading:!1,confirmSetting:null})}},x=e=>{e.stopPropagation(),u({confirmSetting:f})};return(0,U.jsxs)(U.Fragment,{children:["function"===typeof i?i({loading:m.loading,open:x}):(0,U.jsxs)(G.Z,{onClick:x,className:"rule-action","data-cy":"action-add-domain-alias",children:[m.loading?(0,U.jsx)(N.Z,{size:16}):(0,U.jsx)(Y.Z,{style:{fontSize:18,marginRight:5}}),l("router.domainAlias.add.title")]}),m.confirmSetting&&(0,U.jsx)(W.Z,{title:m.confirmSetting.title,description:m.confirmSetting.description,confirm:m.confirmSetting.confirm,cancel:m.confirmSetting.cancel,params:m.confirmSetting.params,onConfirm:m.confirmSetting.onConfirm,onCancel:m.confirmSetting.onCancel,color:"primary",loading:m.loading,maxWidth:"lg"})]})}ce.propTypes={domain:b().string,resolvedTarget:b().string.isRequired},ce.defaultProps={domain:""},me.propTypes={locale:b().string.isRequired,label:b().string.isRequired,value:b().string.isRequired},ue.propTypes={siteId:b().string.isRequired,teamDid:b().string.isRequired,cnameDomain:b().string.isRequired,defaultCustomDomain:b().string,onInputDomain:b().func,onSuccess:b().func,appId:b().string,appPk:b().string,disabled:b().bool,autoFocus:b().bool,inBlockletSetup:b().bool},ue.defaultProps={defaultCustomDomain:"",onInputDomain:te(),onSuccess:te(),appId:"",appPk:"",disabled:!1,autoFocus:!0,inBlockletSetup:!1},pe.propTypes={id:b().string.isRequired,children:b().any,title:b().string,teamDid:b().string,systemDomains:b().arrayOf(b().string).isRequired,appId:b().string,appPk:b().string.isRequired},pe.defaultProps={children:null,title:"",teamDid:"",appId:null};var fe=i(46954),he=i(44067),xe=i(27773),ge=i(92726);function ve(e){const{t:n}=(0,c.PE)(),[i,t]=(0,a.useState)(!1),[r,s]=(0,a.useState)(null),{id:l,domain:d,children:m,teamDid:u}=e,{api:p}=(0,h.h6)(),f={title:n("router.domainAlias.delete.title"),description:n("router.domainAlias.delete.description"),confirm:n("common.confirm"),onConfirm:async()=>{t(!0);try{await p.deleteDomainAlias({input:{id:l,domainAlias:d,teamDid:u}}),await(0,g._v)(2e3)}catch(e){O.Z.error(e.message)}finally{s(null),t(!1)}},onCancel:()=>{t(!1),s(null)}},x=e=>{e.stopPropagation(),s(f)};return(0,U.jsxs)(U.Fragment,{children:["function"===typeof m?m({loading:i,open:x}):(0,U.jsxs)(o.Z,{edge:"end",onClick:x,size:"small",className:"rule-action",color:"error","data-cy":"action-delete-domain-alias",children:[i?(0,U.jsx)(N.Z,{size:16}):(0,U.jsx)(xe.default,{style:{fontSize:16}}),n("router.domainAlias.delete.title")]}),r&&(0,U.jsx)(W.Z,{title:r.title,description:r.description,confirm:r.confirm,params:r.params,onConfirm:r.onConfirm,onCancel:r.onCancel})]})}function je(e){let{site:n,domain:i,blocklet:t}=e;const{t:o}=(0,c.PE)(),r=i.value===window.location.hostname;return(0,U.jsx)(ge.Z,{"data-cy":"domain-actions",size:"large",actions:[e=>{var a;let{close:s}=e;return(0,U.jsx)(ve,{id:n.id,domain:i.value,teamDid:null===t||void 0===t||null===(a=t.meta)||void 0===a?void 0:a.did,children:e=>{let{open:n}=e;return(0,U.jsx)(w.Z,{title:r?o("blocklet.router.currentDomainTip"):"",children:(0,U.jsx)("span",{children:(0,U.jsxs)(G.Z,{disabled:i.isProtected||r,dense:!0,onClick:e=>{s(),n(e)},"data-cy":"action-toggle-block",children:[(0,U.jsx)(fe.Z,{style:{minWidth:24,marginRight:8},children:(0,U.jsx)(xe.default,{})}),(0,U.jsx)(he.Z,{primary:o("common.delete")})]},"remove")})})}})}]})}ve.propTypes={id:b().string.isRequired,domain:b().string.isRequired,children:b().any,teamDid:b().string},ve.defaultProps={children:null,teamDid:""},je.propTypes={site:b().object.isRequired,domain:b().object.isRequired,blocklet:b().object.isRequired},je.defaultProps={};var ye=i(31942),be=i(69569);const Ze=b().shape({href:b().string,accessibility:b().shape({loading:b().bool,accessible:b().bool}),domainStatus:b().shape({isHttps:b().bool,matchedCert:b().object}),dns:b().shape({resolved:b().bool,ip:b().string})});var ke,De=i(43681),Pe=i.n(De);function Ce(e){let{certificate:n}=e;const[i,t]=(0,a.useState)(null),o=(0,h.h6)(),{t:r,locale:s}=(0,c.PE)(),l=()=>{t(null)},d=Boolean(i);return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(ye.Z,{"aria-owns":d?"mouse-over-popover":void 0,onMouseEnter:e=>{t(e.currentTarget)},onMouseLeave:l,style:{color:"#44cdc6",fontSize:20,cursor:"pointer"}}),(0,U.jsx)(R.ZP,{id:"mouse-over-popover",style:{pointerEvents:"none"},open:d,anchorEl:i,anchorOrigin:{vertical:"bottom",horizontal:"left"},transformOrigin:{vertical:"top",horizontal:"left"},onClose:l,disableRestoreFocus:!0,children:(0,U.jsx)(C.Z,{children:(0,U.jsxs)(T.Z,{style:{display:"flex"},children:[(0,U.jsx)("div",{children:(0,U.jsx)("img",{src:"".concat(o.imgPrefix,"/https-certificate-icon.png"),alt:"certificate icon",style:{maxHeight:"100%",maxWidth:"100%"}})}),(0,U.jsxs)(p.Z,{component:"div",style:{marginLeft:"16px"},children:[(0,U.jsx)(p.Z,{component:"div",style:{fontWeight:"bold"},children:n.domain}),(0,U.jsx)(p.Z,{component:"div",children:"".concat(r("common.issuer"),": ").concat(Pe()(n,"issuer.commonName",""))}),(0,U.jsx)(p.Z,{component:"div",children:"".concat(r("router.cert.issuedOn"),": ").concat((0,g.pz)(n.validFrom,s))}),(0,U.jsx)(p.Z,{component:"div",children:"".concat(r("router.cert.expiryOn"),": ").concat((0,g.pz)(n.validTo,s))})]})]})})})]})}function Te(e){let{domain:n,filters:i}=e;const{t:t}=(0,c.PE)(),{value:o,domainStatus:r}=n;if(!(0,g.rM)(o))return null;let s=null,l=null;const{isHttps:d,matchedCert:m}=r;if(!(0,g.ao)(o)){const{dns:{resolved:e,ip:n}={}}=r;s=e||"127.0.0.1"===n?(0,U.jsx)(w.Z,{title:t("router.domain.verify.ok"),children:(0,U.jsx)(be.Z,{color:"success"})}):(0,U.jsx)(w.Z,{title:t("router.domain.verify.notResolved"),children:(0,U.jsx)(be.Z,{color:"error"})})}l=d?(0,U.jsx)(Ce,{certificate:m}):(0,U.jsx)(w.Z,{title:t("router.domain.https.bad"),children:(0,U.jsx)(ye.Z,{style:{color:"#D0021B",fontSize:20,cursor:"pointer"}})});const u=i.map((e=>"domain"===e?s:"http"===e?l:null));return(0,a.createElement)(a.Fragment,null,...u)}Ce.propTypes={certificate:b().object},Ce.defaultProps={certificate:{}},Te.propTypes={domain:Ze.isRequired,filters:b().array},Te.defaultProps={filters:["domain","http"]};const Se=(0,L.V)(Ae,"mutate_blocklets"),Re=(0,L.V)(Ae,"",g.Wf);function we(e){const{inService:n}=(0,h.h6)(),{blocklet:i,loadingRuntimeInfo:t}=(0,f.y0)();let o=Se;return n&&(o=Re),(0,U.jsx)(o,{...e,blocklet:i,inService:n,loadingRuntimeInfo:t})}function Ae(e){var n,i,t,r;let{hasPermission:d,blocklet:m,loadingRuntimeInfo:p,inService:f,listOnly:h}=e;const{t:x}=(0,c.PE)(),[v,y]=(0,a.useState)(!1),b=(0,E.Z)((e=>e.breakpoints.down("md"))),k=(0,a.useMemo)((()=>{let e=d;return(0,j.ep)(m)&&(e=e&&f),e}),[d,f,m]),{site:C}=m,T=(0,a.useMemo)((()=>{var e;return(0,g.oE)(null===(e=m.site)||void 0===e?void 0:e.domainAliases)}),[null===(n=m.site)||void 0===n?void 0:n.domainAliases]),S=[],R=[],w=(0,I.encode)(m.appPid),A=null===(i=m.environments)||void 0===i||null===(t=i.find((e=>"BLOCKLET_APP_PK"===e.key)))||void 0===t?void 0:t.value,q=(0,g.M6)(T);return T.forEach((e=>{const n=e.value||"";(0,F.isDidDomain)(n)&&!n.startsWith(w)?R.push(e):S.push(e)})),(0,U.jsxs)(U.Fragment,{children:[!h&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(P.Z,{className:"title first",display:"flex",justifyContent:"space-between",alignItems:"center",children:[(0,U.jsx)(P.Z,{children:x("common.domain")}),k&&(0,U.jsx)(pe,{id:C.id,title:x("router.domain.add.title"),teamDid:null===(r=m.meta)||void 0===r?void 0:r.did,appId:m.appPid,appPk:A,systemDomains:null===q||void 0===q?void 0:q.map((e=>e.value)),children:e=>{let{open:n}=e;return(0,U.jsxs)(o.Z,{style:{marginLeft:16},variant:"contained",color:"primary","data-cy":"add-domain-alias",onClick:n,disabled:(0,u.isInProgress)(m.status),children:[(0,U.jsx)(Z.Z,{style:{fontSize:"1.3em",marginRight:4}}),x("common.add")]})}})]}),!1===(0,u.isAccessible)(m.status)&&(0,U.jsx)(P.Z,{mt:1.5,mb:1.5,children:(0,U.jsx)(D.Z,{severity:"warning",children:x("blocklet.router.noRunning")})})]}),(0,U.jsx)(P.Z,{sx:{display:"flex",flexDirection:"column",gap:1},children:(v?T:S).map((e=>{var n,i;const t=e.value;return(0,U.jsxs)(a.Fragment,{children:[b&&(0,U.jsxs)(P.Z,{display:"flex",flexDirection:"column",children:[(0,U.jsx)(P.Z,{display:"flex",alignItems:"center",justifyContent:"flex-start",children:(0,U.jsx)(Ee,{domain:e,target:"_blank",children:e.value})}),(0,U.jsxs)(P.Z,{display:"flex",alignItems:"center",justifyContent:"space-between",children:[(0,U.jsxs)(P.Z,{sx:{display:"flex",alignItems:"center",justifyContent:"flex-start",gap:1},children:[(0,U.jsx)(Te,{domain:e,filters:["domain"]},"".concat(e.value,"-domain")),(0,U.jsx)(qe,{siteId:null===(n=m.site)||void 0===n?void 0:n.id,domain:e,blocklet:m,hasMutatePermission:k})]}),(0,U.jsx)(P.Z,{sx:{button:{padding:0}},children:(0,U.jsx)(Fe,{hasMutatePermission:k,site:C,domain:e,blocklet:m})})]})]},t),!b&&(0,U.jsxs)(P.Z,{display:"flex",alignItems:"center",justifyContent:"space-between",children:[(0,U.jsxs)(P.Z,{display:"flex",alignItems:"center",justifyContent:"flex-start",children:[(0,U.jsx)(Te,{domain:e,filters:["domain"]},"".concat(e.value,"-domain")),(0,U.jsx)(P.Z,{sx:{ml:2,mr:.5},children:(0,U.jsx)(Ee,{domain:e,target:"_blank",children:e.value})}),(0,U.jsx)(qe,{siteId:null===(i=m.site)||void 0===i?void 0:i.id,domain:e,blocklet:m,hasMutatePermission:k})]}),(0,U.jsx)(P.Z,{sx:{button:{padding:0}},children:(0,U.jsx)(Fe,{hasMutatePermission:k,site:C,domain:e,blocklet:m})})]},t)]},t)}))}),R.length>0&&(0,U.jsx)("div",{style:{marginLeft:"20px",marginTop:"12px"},children:(0,U.jsx)(o.Z,{endIcon:v?(0,U.jsx)(s.Z,{}):(0,U.jsx)(l.Z,{}),onClick:()=>y(!v),children:x(v?"common.collapseAll":"blocklet.router.showAllDomains")})}),!T.length&&(p?(0,U.jsx)(N.Z,{size:16}):(0,U.jsx)(z.Z,{children:x("common.empty")}))]})}function Ee(e){let{domain:n,children:i,...t}=e;const{t:o}=(0,c.PE)(),{href:r,accessibility:a}=n;return!a||a.loading?(0,U.jsxs)(Ie,{...t,children:[i,(0,U.jsx)(w.Z,{title:o("blocklet.router.checkUrlAccessible"),placement:"top-end",children:(0,U.jsx)("span",{className:"status",children:(0,U.jsx)(N.Z,{size:12})})})]}):a.accessible?(0,U.jsx)(Ie,{...t,children:(0,U.jsx)("a",{href:r,target:"_blank",rel:"noopener noreferrer",children:i})}):(0,U.jsx)(Ie,{...t,children:(0,U.jsx)(w.Z,{title:o("blocklet.router.urlInaccessible"),placement:"top-end",children:(0,U.jsx)("span",{children:i})})})}we.propTypes={listOnly:b().bool},we.defaultProps={listOnly:!1},Ae.propTypes={hasPermission:b().bool,blocklet:b().object.isRequired,loadingRuntimeInfo:b().bool,inService:b().bool.isRequired,listOnly:b().bool},Ae.defaultProps={hasPermission:!1,loadingRuntimeInfo:!1,listOnly:!1},Ee.propTypes={domain:Ze.isRequired,children:b().any.isRequired};const Ie=r.Z.span(ke||(ke=(0,t.Z)(["\n &,\n & > * {\n color: #222;\n font-size: 18px;\n word-break: break-all;\n }\n\n .status {\n margin-left: 8px;\n }\n"])));function Fe(e){let{hasMutatePermission:n,site:i,domain:t,blocklet:o}=e;const r=(0,A.Z)(),{t:a}=(0,c.PE)();return n&&!t.isProtected?(0,U.jsx)(je,{site:i,domain:t,blocklet:o}):(0,U.jsx)(w.Z,{title:a("blocklet.router.domainLockTooltip"),placement:"top",children:(0,U.jsx)(S.Z,{disabled:!0,size:"large",style:{pointerEvents:"auto",paddingTop:0,paddingBottom:0},children:(0,U.jsx)(q.Z,{style:{fill:r.palette.text.disabled}})})})}function qe(e){let{siteId:n,domain:i,blocklet:t,hasMutatePermission:r}=e;const s=(0,A.Z)(),{t:l}=(0,c.PE)(),[d,m]=(0,a.useState)(null),u=()=>{m(null)};return(0,U.jsxs)(P.Z,{sx:{display:"flex",justifyContent:"flex-start",alignItems:"center",gap:1},children:["nft-domain"===i.type&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(k.Z,{onMouseEnter:e=>{m(e.currentTarget)},onMouseLeave:u,style:{cursor:"pointer",fill:s.palette.primary.main}}),(0,U.jsx)(R.ZP,{id:"mouse-over-popover",style:{pointerEvents:"none"},open:Boolean(d),anchorEl:d,anchorOrigin:{vertical:"bottom",horizontal:"left"},transformOrigin:{vertical:"top",horizontal:"left"},onClose:u,disableRestoreFocus:!0,children:(0,U.jsx)(C.Z,{children:(0,U.jsxs)(T.Z,{style:{display:"flex",flexDirection:"column"},children:[(0,U.jsxs)(p.Z,{component:"div",style:{display:"flex",alignItems:"center"},children:[(0,U.jsx)(k.Z,{style:{fill:s.palette.primary.main}}),(0,U.jsx)(p.Z,{component:"span",style:{marginLeft:"8px",fontSize:"18px",fontWeight:"bolder"},children:l("router.domainAlias.nftDomain")})]}),(0,U.jsxs)(p.Z,{component:"div",style:{display:"flex",marginTop:"12px"},children:[(0,U.jsx)(p.Z,{component:"span",style:{width:"80px",marginRight:"8px"},children:l("common.domain")}),(0,U.jsx)(p.Z,{component:"span",children:i.value})]}),(0,U.jsxs)(p.Z,{component:"div",style:{display:"flex"},children:[(0,U.jsx)(p.Z,{component:"span",style:{width:"80px",marginRight:"8px"},children:"NFT"}),(0,U.jsx)(x.Z,{did:i.nftDid})]})]})})})]}),(0,U.jsx)(Te,{domain:i,filters:["http"]},"".concat(i.value,"-http")),r&&(0,U.jsx)(V,{siteId:n,domain:i.value,domainStatus:i.domainStatus,did:t.meta.did,children:e=>{let{open:n}=e;return(0,U.jsx)(o.Z,{sx:{padding:0},size:"small",onClick:e=>n(e),children:l("router.cert.genLetsEncryptCert.title")})}})]})}var ze;Fe.propTypes={hasMutatePermission:b().bool.isRequired,site:b().object.isRequired,domain:Ze.isRequired,blocklet:b().object.isRequired},qe.propTypes={siteId:b().string.isRequired,domain:Ze.isRequired,blocklet:b().object.isRequired,hasMutatePermission:b().bool.isRequired};const Ne={arcblock:"ArcBlock",ethereum:"Ethereum"};function Le(){var e,n,i,t,r;const{t:p,locale:y}=(0,c.PE)(),{info:b,inService:Z}=(0,h.h6)(),[k,D]=(0,a.useState)(!1),{blocklet:P}=(0,f.y0)(),{appDid:C,appPid:T,migratedFrom:S=[]}=P,R=null===(e=P.environments.find((e=>"BLOCKLET_APP_CHAIN_TYPE"===e.key)))||void 0===e?void 0:e.value,w=[C?{name:p("blocklet.appId"),value:(0,U.jsx)(x.Z,{did:C})}:null,T?{name:p("blocklet.appPid"),value:(0,U.jsx)(x.Z,{did:T})}:null,(null===S||void 0===S?void 0:S.length)>1?{name:p("blocklet.alsoKnownAs"),value:(0,U.jsxs)("div",{children:[(k?S.slice(1):S.slice(1,2)).map((e=>(0,U.jsx)(x.Z,{did:e.appDid}))),S.length>2&&(0,U.jsx)(o.Z,{style:{marginLeft:"18px"},endIcon:k?(0,U.jsx)(s.Z,{}):(0,U.jsx)(l.Z,{}),onClick:()=>D(!k),children:p(k?"common.collapseAll":"blocklet.router.showAllDIDs")})]})}:null,{name:p("common.name"),value:(0,u.getDisplayName)(P,!0)},{name:p("common.status"),value:(0,U.jsx)(v.Z,{status:P.status,source:P.source})},(0,j.ep)(P)?{name:"NFT",value:(0,U.jsx)(x.Z,{external:!0,href:(0,g.E8)(null===P||void 0===P||null===(n=P.controller)||void 0===n?void 0:n.chainHost,null===P||void 0===P||null===(i=P.controller)||void 0===i?void 0:i.nftId,"asset"),did:null===P||void 0===P||null===(t=P.controller)||void 0===t?void 0:t.nftId})}:null,{name:p("blocklet.installedAt"),value:(0,g.B2)(P.installedAt,y)},{name:p("blocklet.overview.accessControl"),value:p("team.whoCanAccess.".concat((0,u.getWhoCanAccess)(P),".title"))},{name:p("common.owner"),value:null!==(r=P.settings)&&void 0!==r&&r.owner?(0,U.jsx)(x.Z,{did:P.settings.owner.did}):"--"},{name:p("blocklet.config.walletType.name"),value:Ne[R||"arcblock"]||R},P.externalSkSource?{name:p("blocklet.skSource"),value:P.externalSkSource}:null].filter(Boolean);Z&&w.push({name:p("common.serverDid"),value:(0,U.jsx)(x.Z,{did:b.did})},{name:p("common.serverVersion"),value:(0,U.jsx)(m.Z,{children:b.version})});return(0,U.jsxs)(_e,{component:"div",children:[(0,U.jsx)(we,{}),(0,U.jsx)("div",{className:"title",children:(0,U.jsx)("span",{children:p("common.basicInfo")})}),(0,U.jsx)("div",{className:"basicInfo",children:(A=w,A.map((e=>(0,U.jsx)(d.Z,{style:{display:"flex",alignItems:"flex-start"},valueComponent:"div",nameWidth:120,name:e.name,nameFormatter:()=>e.name,children:e.value},e.name))))})]});var A}Le.propTypes={};const _e=(0,r.Z)(p.Z)(ze||(ze=(0,t.Z)(["\n .title {\n font-size: 1.2rem;\n font-weight: bold;\n margin-top: ",";\n margin-bottom: ",";\n\n &.first {\n margin-top: 0;\n }\n }\n"])),(e=>e.theme.spacing(5)),(e=>e.theme.spacing(3)))},51233:(e,n,i)=>{"use strict";i.d(n,{Rw:()=>c,fX:()=>d,sf:()=>m});var t=i(35432),o=i(44543),r=i.n(o),a=i(76811),s=i(32828);const l=(e,n)=>{if(e.type===t.ROUTING_RULE_TYPES.REDIRECT){if(!e.url)return new Error("".concat(n("router.validation.redirectUrlRequired")));if(!e.redirectCode)return new Error("redirect ".concat(n("router.validation.redirectCodeRequired")))}else if(e.type===t.ROUTING_RULE_TYPES.BLOCKLET&&!e.did)return new Error(n("router.validation.didRequired"));return null},d=(e,n)=>{const i=l(e,n);return i||(e.pathPrefix.length?e.pathPrefix.length>150?new Error(n("router.validation.pathPrefixTooLong",{length:150})):null:new Error(n("router.validation.pathPrefixCannotBeEmpty")))},c=e=>{let{params:n,blocklets:i,blocklet:t,locale:o="en"}=e;if(t){let e=(t.children||[]).find((e=>(0,s.default)(e.meta)&&r()(e.mountPoint,n.pathPrefix)));if("gateway"!==t.meta.group&&"/"===n.pathPrefix&&(e="/"),e)return{zh:"\u6302\u8f7d\u70b9 ".concat(n.pathPrefix," \u5df2\u5b58\u5728\uff0c\u8bf7\u4f7f\u7528\u5176\u4ed6\u6302\u8f7d\u70b9"),en:"The mount point ".concat(n.pathPrefix," already exist, please use another mount point")}[o]}const l=i.find((e=>e.meta.did===n.did));if(!l)return"";const d=l.meta.interfaces.find((e=>"web"===e.type));return d&&d.prefix!==a.BLOCKLET_DYNAMIC_PATH_PREFIX&&n.pathPrefix!==d.prefix?{zh:"\u8be5 blocklet \u53ea\u80fd\u6302\u8f7d\u5728 ".concat(d.prefix),en:"This blocklet can only be mounted on ".concat(d.prefix)}[o]:""},m=e=>{if(!e||"string"!==typeof e)return e;let n=e.trim();try{return n=n.toLowerCase(),n.startsWith("http://")||n.startsWith("https://")?new URL(n).hostname:n}catch(i){return console.error("format domain failed",i),n}}}}]);
|