@abtnode/webapp 1.16.20-beta-e363262e → 1.16.20-beta-bb1cd034

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abtnode/webapp",
3
- "version": "1.16.20-beta-e363262e",
3
+ "version": "1.16.20-beta-bb1cd034",
4
4
  "keywords": [
5
5
  "arcblock",
6
6
  "react"
@@ -1 +0,0 @@
1
- (self.webpackChunk_abtnode_webapp=self.webpackChunk_abtnode_webapp||[]).push([[7022],{13671:(e,t,n)=>{"use strict";n.d(t,{$8:()=>A,y0:()=>L});var i=n(5057),o=n(68420),s=n(36991),a=n(14491),l=n(29054),r=n(40807),d=n.n(r),c=n(24914),u=n.n(c),m=n(76811),v=n(86229),p=n(4651),f=n(6352),g=n.n(f),h=n(32243),k=n.n(h),E=n(35432),S=n(49714),D=n(41365),b=n.n(D);const y=k()((e=>{const{origin:t,hostname:n}=new URL(e);return n===window.location.hostname||b()(g()(t,E.WELLKNOWN_PING_PREFIX))})),C={};function R(e){let{urls:t,checkAccessible:n=b(),disableCache:o=!1}=e;const s=(0,i.useRef)(t.filter((e=>C[e])).map((e=>C[e]))),a=s.current.length===t.length,[l,r]=(0,i.useState)(a?s.current:[]),[d,c]=(0,i.useState)(!a),u=(0,i.useMemo)((()=>!d&&l.length?l[0]:null),[l,d]);return(0,i.useEffect)((()=>{if((null===t||void 0===t?void 0:t.length)>0&&!a){(async()=>{let e;if(c(!0),o)e=await(0,S.evaluateURLs)(t,{checkAccessible:n}),e.forEach((e=>{C[e.url]=e}));else{(await(0,S.evaluateURLs)(t.filter((e=>!C[e])),{checkAccessible:n})).forEach((e=>{C[e.url]=e})),e=t.map((e=>C[e])).sort(((e,t)=>t.score-e.score))}r(e),c(!1)})()}}),[t,o,a]),{urlsState:l,loading:d,recommendedUrlState:u,recommendedUrl:null===u||void 0===u?void 0:u.url}}function B(e){var t,n,o,s,l,r,c,f;let{did:g,client:h,useSubscription:k,getIP:E,useLocaleContext:S,disableSubscription:D}=e;const{t:b,locale:C}=S(),[B,P]=(0,i.useState)(null),[w,U]=(0,i.useState)(!1),[I,N]=(0,i.useState)(!1),[x,A]=(0,i.useState)(),[L,T]=(0,i.useState)({cpu:[],memory:[]}),[_,O]=(0,i.useState)({}),F=null!==x&&void 0!==x&&null!==(t=x.site)&&void 0!==t&&null!==(n=t.domainAliases)&&void 0!==n&&n.length?JSON.stringify(x.site.domainAliases.map((e=>e.value))):"",H=(0,i.useMemo)((()=>{var e;return((null===x||void 0===x||null===(e=x.site)||void 0===e?void 0:e.domainAliases)||[]).map((e=>e.value))}),[F]),{domainsAccessibility:G,recommendedDomain:K}=function(e){const t=(0,i.useMemo)((()=>e.map((e=>(0,a.Sk)(e)))),[e]),{urlsState:n,loading:o,recommendedUrl:s}=R({urls:t,checkAccessible:y});let l;if(o)l={domainsAccessibility:e.reduce(((e,t)=>({...e,[t]:{loading:!0}})),{}),recommendedDomain:null};else{var r;const e=n.reduce(((e,t)=>{const n=new URL(t.url).hostname;return e[n]={...t,domain:n},e}),{}),t=(null===(r=n.find((e=>e.accessible)))||void 0===r?void 0:r.url)||s;l={domainsAccessibility:e,recommendedDomain:t?new URL(t).hostname:null}}return l}(H),Z=async function(){let{showError:e=!0,attachRuntimeInfo:t=!0}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!w)try{U(!0),P(null);const{blocklet:e}=await h.getBlocklet({input:{did:g}});if(!e)throw new Error(b("blocklet.notFound"));A((t=>((0,p.Gv)(e,{fixRuntime:"merge-old",oldBlocklet:t}),e))),U(!1),t&&((async()=>{N(!0);try{const{blocklet:e}=await h.getBlocklet({input:{did:g,attachRuntimeInfo:!0}});await(0,p.Gv)(e,{getIP:E}),A(e)}catch(e){v.Z.error(e.message)}finally{N(!1)}})(),(async()=>{try{const e=await h.getBlockletRuntimeHistory({input:{did:g,hours:6}});e&&T({cpu:e.history.map((e=>({date:e.date,value:e.cpu}))),memory:e.history.map((e=>({date:e.date,value:e.mem})))})}catch(e){v.Z.error(e.message)}})())}catch(n){U(!1),P(n),e&&v.Z.error(n.message)}},M=e=>{var t;(null===e||void 0===e||null===(t=e.meta)||void 0===t?void 0:t.did)===x.meta.did&&Z({showError:!1})},V=e=>{var t;(null===e||void 0===e||null===(t=e.meta)||void 0===t?void 0:t.did)===x.meta.did&&Z({attachRuntimeInfo:!1,showError:!1})},j=()=>{g&&F&&h.checkDomains({input:{did:g}}).catch((e=>{console.error(e)}))};(0,i.useEffect)((()=>{F&&!D&&j()}),[F,D]),k(m.BlockletEvents.domainStatus,(e=>{O((t=>({...t,[e.domain]:{...t[e.domain],...e}})))}),[null===x||void 0===x||null===(o=x.meta)||void 0===o?void 0:o.did,!D]),k(m.BlockletEvents.statusChange,(e=>{var t;(null===e||void 0===e||null===(t=e.meta)||void 0===t?void 0:t.did)===x.meta.did&&(A((t=>{const n={...t};return n.status=(0,m.fromBlockletStatus)(e.status),(n.children||[]).forEach((t=>{const n=e.children.find((e=>{var n,i;return(null===(n=e.meta)||void 0===n?void 0:n.did)===(null===(i=t.meta)||void 0===i?void 0:i.did)}));n&&(t.status=(0,m.fromBlockletStatus)(n.status))})),n})),V(e))}),[null===x||void 0===x||null===(s=x.meta)||void 0===s?void 0:s.did,!D]),k(m.BlockletEvents.storeChange,V,[null===x||void 0===x||null===(l=x.meta)||void 0===l?void 0:l.did,!D]),k(m.BlockletEvents.installed,M,[null===x||void 0===x||null===(r=x.meta)||void 0===r?void 0:r.did,!D]),k(m.BlockletEvents.upgraded,M,[null===x||void 0===x||null===(c=x.meta)||void 0===c?void 0:c.did,!D]),k(m.BlockletEvents.updated,M,[null===x||void 0===x||null===(f=x.meta)||void 0===f?void 0:f.did,!D]);const q=x?d()(x,{site:{domainAliases:x.site.domainAliases.map((e=>{const t=e.value,n=(0,a.H$)(t);return e.domainStatus=u()(_[n],["domain","meta"]),e.accessibility=u()(G[t],["domain"]),e.href=(0,a.vH)({blocklet:x,domain:e,params:(0,a.f0)(x,C)}),e}))}}):null;return{loading:w,loadingRuntimeInfo:I,error:B,blocklet:q,runtimeHistory:L,recommendedDomain:K||"",actions:{refreshBlocklet:Z,refreshDomainStatus:j,setBlocklet:A,configNavigations:async e=>{const{blocklet:t}=await h.configNavigations({input:{did:g,navigations:e}});A(t)}}}}var P=n(38242),w=n(75793),U=n(33234),I=n(96266);const{Provider:N,Consumer:x}=l.BlockletContext;function A(e){let{did:t,children:n}=e;const{api:l,ws:{useSubscription:r}}=(0,w.h6)(),[d,c]=(0,i.useState)(),{loading:u,loadingRuntimeInfo:m,error:v,blocklet:p,recommendedDomain:f,runtimeHistory:g,actions:{refreshBlocklet:h,refreshDomainStatus:k,setBlocklet:E,configNavigations:S}}=B({did:t,client:l,useSubscription:r,getIP:U.Z,useLocaleContext:o.PE});(0,i.useEffect)((()=>{h()}),[t]),(0,i.useEffect)((()=>{if(!p||null===p||void 0===p||!p.controller)return;const{controller:e}=p;(0,a.Nh)(e.chainHost,e.nftId).then((e=>{e.expirationDate=(0,s.getNftExpirationDate)(e),e.expired=(0,s.isNFTExpired)(e),c(e)})).catch((e=>console.error(e)))}),[null===p||void 0===p?void 0:p.appPid]);const D={did:t,client:l,loading:u,loadingRuntimeInfo:m,error:v,blocklet:p,recommendedDomain:f,runtimeHistory:g,nftState:d,appIdList:p?(0,P.getBlockletAppIdList)(p):[],actions:{refreshBlocklet:h,refreshDomainStatus:k,setBlocklet:E,configNavigations:S}};return(0,I.jsx)(N,{value:D,children:n})}function L(){return(0,i.useContext)(l.BlockletContext)}},17022:(e,t,n)=>{"use strict";n.d(t,{G6:()=>y});var i=n(5057),o=n(35432),s=n(76811),a=n(38242),l=n(86229),r=n(14491),d=n(17425),c=n(4651),u=n(75793),m=n(13671),v=n(34937),p=n(96266);const{Provider:f,Consumer:g}=d.TeamContext,h=(e,t,n)=>e===t.did?t.name:n?(0,a.getDisplayName)(n):"",k=(e,t,n)=>{if(n){const e=n.environments.find((e=>e.key===s.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_PASSPORT_COLOR));return e?e.value:"auto"}return"default"},E=(e,t,n)=>e===t.did?t.trustedPassports||[]:n&&n.trustedPassports||[],S=(e,t,n)=>e===t.did?t.trustedFactories||[]:n&&n.trustedFactories||[],D=(e,t,n)=>{if(e===t.did)return e;if(n){return((n.environments||[]).find((e=>"BLOCKLET_APP_ID"===e.key))||{}).value||""}return""},b=(e,t,n)=>e===t.did?!1!==t.enablePassportIssuance:!n||!1!==n.enablePassportIssuance;function y(e){let{teamDid:t,children:n}=e;const{api:s,info:a}=(0,u.h6)(),{recommendedDomain:d,blocklet:g}=(0,m.y0)()||{},[y,C]=(0,i.useState)([]),[R,B]=(0,i.useState)([]),[P,w]=(0,i.useState)([]),U=h(t,a,g),I=k(t,a,g),N=E(t,a,g),x=S(t,a,g),A=D(t,a,g),L=b(t,a,g),T=async e=>{try{const t=await s.doBatchQuery({getRoles:{input:{teamDid:e}},getPermissions:{input:{teamDid:e}},getInvitations:{input:{teamDid:e}}});B((t.getRoles.roles||[]).filter((e=>!o.RBAC_CONFIG.roles.some((t=>t.name===e.name&&(!t.passport||t.noHuman))))).map((e=>(e.description=e.description||"Use this passport to connect ".concat(U," as ").concat(e.title),e)))),w(t.getPermissions.permissions||[]),C(t.getInvitations.invitations||[])}catch(t){l.Z.error(t.message)}};(0,i.useEffect)((()=>{T(t)}),[t]);const _=e=>{e.teamDid===t&&T(t)};(0,v.mU)(o.EVENTS.USER_ADDED,_,[t]),(0,v.mU)(o.EVENTS.USER_REMOVED,_,[t]),(0,v.mU)(o.EVENTS.USER_UPDATED,_,[t]);const O={teamDid:t,teamIssuerDid:A,teamName:U,invitations:y,roles:R,permissions:P,trustedPassports:N,trustedFactories:x,isNodeTeam:t===a.did,enablePassportIssuance:L,refresh:()=>T(t),passportColor:I,endpoint:t===a.did?(0,c.RU)(a):(0,r.Sk)(d),blocklet:g,api:{getUser:function(){let{did:e}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n={teamDid:t,user:{did:e}};return s.getUser({input:n})},getUsers:function(){let{query:e,paging:n}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const i={teamDid:t};return n&&(i.paging=n),e&&(i.query=e),i.sort={lastLoginAt:-1},s.getUsers({input:i})},getUsersCountPerRole:()=>s.getUsersCountPerRole({input:{teamDid:t}})}};return(0,p.jsx)(f,{value:O,children:n})}y.defaultProps={}},36991:(e,t,n)=>{const i=n(59408),o=n(43681),s=e=>i(o(e,"data.value.expirationDate",[]));e.exports={isNFTExpired:e=>(e=>!!e&&new Date(e).getTime()<=Date.now())(s(e)),getNftExpirationDate:s,isNFTConsumed:e=>!!e.data.value.consumedTime}},17425:(e,t,n)=>{"use strict";n.d(t,{DJ:()=>l,TeamContext:()=>o});var i=n(5057);const o=(0,i.createContext)({}),{Provider:s,Consumer:a}=o;function l(){return(0,i.useContext)(o)}}}]);
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunk_abtnode_webapp=self.webpackChunk_abtnode_webapp||[]).push([[8973],{80378:(e,n,t)=>{t.d(n,{Z:()=>u});var i=t(55898),o=t.n(i),a=t(62681),l=t(72333),s=t(6352),r=t.n(s),c=t(35432),d=t(58238),p=t(14491);var m=t(96266);function u(e){let{blocklet:n,style:t,size:i,ancestors:o,...s}=e;const u=(0,d.h6)(),{logoUrl:h,inService:f}=function(e){var n;let{blocklet:t,ancestors:i=[]}=e;const o=(0,d.h6)(),{inService:a}=o,l="?v=".concat(null===t||void 0===t||null===(n=t.meta)||void 0===n?void 0:n.version).concat((0,p.XN)(null===t||void 0===t?void 0:t.status)?"~":"");let s=a?r()(p.zn,c.WELLKNOWN_SERVICE_PATH_PREFIX,"/blocklet/logo-bundle",l):r()(o.imgPrefix,"blocklet.png");if("registry"===t.source&&t.deployedFrom&&t.meta.logo)s=r()(t.deployedFrom,(0,p.lk)(t.meta.bundleDid,t.meta.logo),l);else{const e=window.env.apiPrefix||"/",n=i.concat(t),o=a?n.slice(1):n;s=r()(e,"/blocklet/logo-bundle".concat(o.map((e=>"/".concat(e.meta.did))).join("")),l)}return{logoUrl:s,inService:a}}({blocklet:n,ancestors:o}),{variant:g}=s,x=f?()=>{}:e=>{e.target.src="".concat(u.imgPrefix,"/blocklet.png")};let b=(0,m.jsx)("img",{src:h,onError:x,alt:n.meta.name,style:{width:i}});return n.meta.logo||(b=(0,m.jsx)(l.Z,{did:n.meta.did||"",responsive:!0})),(0,m.jsx)(a.Z,{variant:g||"square",style:Object.assign({backgroundColor:"transparent",width:i,height:i,borderRadius:10},t),...s,children:b})}u.propTypes={blocklet:o().object.isRequired,style:o().object,size:o().oneOfType([o().number,o().string]),ancestors:o().array},u.defaultProps={style:{},size:40,ancestors:[]}},74286:(e,n,t)=>{t.d(n,{Z:()=>s});var i=t(55898),o=t.n(i),a=t(39948),l=t(96266);function s(e){let{depth:n}=e;return(0,l.jsx)(a.Z,{ml:Math.max(2*(n-1),0),sx:{borderBottom:1,borderColor:"rgba(0,0,0,0.12)"}},"group-collapse-box")}s.propTypes={depth:o().number},s.defaultProps={depth:1}},44784:(e,n,t)=>{t.d(n,{Z:()=>d});var i,o=t(71171),a=t(33518),l=t(82790),s=t(96266);function r(e){let{labelProps:n,className:t,style:i,...o}=e;const a={...n,labelPlacement:(null===n||void 0===n?void 0:n.labelPlacement)||"start"};return(0,s.jsx)(c,{className:t,style:i,children:(0,s.jsx)(l.Z,{labelProps:a,...o})})}r.propTypes=l.Z.propTypes,r.defaultProps=l.Z.defaultProps;const c=a.Z.div(i||(i=(0,o.Z)(["\n max-width: 300px;\n > label {\n display: flex;\n justify-content: space-between;\n width: 100%;\n margin-left: 0;\n margin-right: 0;\n }\n "," {\n max-width: 100%;\n }\n"])),(e=>{let{theme:n}=e;return n.breakpoints.down("sm")})),d=r},59375:(e,n,t)=>{t.d(n,{Z:()=>j});var i,o=t(71171),a=t(5057),l=t(55898),s=t.n(l),r=t(6352),c=t.n(r),d=t(33518),p=t(92706),m=t.n(p),u=t(39948),h=t(52277),f=t.n(h),g=t(68420),x=t(96266);const b=(0,a.lazy)((()=>Promise.all([t.e(1294),t.e(3826)]).then(t.bind(t,23826)).then((e=>({default:e.Uploader}))))),Z="/blocklet/logo/upload";function j(e){let{url:n,height:t,width:i,enabled:o,type:l,did:s,prefix:r,headers:d,onUploaded:p}=e;const{t:m}=(0,g.PE)(),h=(0,a.useRef)(null),j={cursor:o?"pointer":"default","&::after":{content:'"'.concat(m("common.switch"),'"')}};return(0,x.jsxs)(v,{id:"uploader-".concat(s,"-").concat(l),children:[(0,x.jsx)(b,{ref:h,popup:!0,onUploadFinish:()=>{var e;p(),null===(e=h.current)||void 0===e||e.close()},plugins:["ImageEditor"],apiPathProps:{uploader:c()(r,Z,l,s),disableMediaKitPrefix:!0},coreProps:{restrictions:{allowedFileTypes:["image/*",".jpg",".jpeg",".png",".gif",".svg"],maxFileSize:10485760,maxNumberOfFiles:1}},tusProps:{headers:d}}),(0,x.jsx)(u.Z,{className:f()("uploader-wrapper",o&&"enabled"),sx:j,onClick:()=>{var e;null===(e=h.current)||void 0===e||e.open()},children:(0,x.jsx)("img",{alt:"Logo",src:n,style:{height:t,width:i}})})]},"uploader-".concat(s,"-").concat(l))}j.propTypes={url:s().string.isRequired,type:s().oneOf(["square","rect","favicon"]).isRequired,did:s().string.isRequired,prefix:s().string.isRequired,headers:s().func,onUploaded:s().func,height:s().number,width:s().any,enabled:s().bool},j.defaultProps={height:80,width:"auto",enabled:!0,headers:()=>({}),onUploaded:m()};const v=d.Z.div(i||(i=(0,o.Z)(["\n .uploader-wrapper {\n display: inline-flex;\n position: relative;\n font-size: 0px;\n &.enabled {\n cursor: pointer;\n }\n &::after {\n display: none;\n }\n &.enabled::after {\n display: block;\n opacity: 0;\n position: absolute;\n bottom: 0;\n background: rgba(0, 0, 0, 0.2);\n left: 0;\n right: 0;\n height: 2.2em;\n color: white;\n text-align: center;\n font-size: 12px;\n line-height: 2em;\n transition: opacity 0.3s ease;\n }\n &:hover::after {\n opacity: 1;\n }\n }\n"])))},5119:(e,n,t)=>{t.r(n),t.d(n,{default:()=>lt});var i=t(71171),o=t(5057),a=t(33518),l=t(55898),s=t.n(l),r=t(96181),c=t(6352),d=t.n(c),p=t(35432),m=t(39948),u=t(55402),h=t(82275),f=t(96399),g=t(65688),x=t(37633),b=t(48037),Z=t(92273),j=t(76720),v=t(15849),y=t(68420),k=t(94464),C=t(38242),w=t(80378),S=t(1722),L=t(43681),E=t.n(L),P=t(50482),_=t.n(P),A=t(16147),T=t(29034),N=t(28726),R=t(80578),O=t(76811),I=t(86229),F=t(28641),B=t(44846),z=t(13727),U=t(56184),D=t(67680),K=t(74490),W=t(51177),q=t(19654),G=t(96366),V=t(90067),H=t(35406),M=t(11875),Y=t(95890),J=t(96266);const Q={PaperProps:{style:{maxHeight:224,width:250}}},X=(e,n,t)=>({fontWeight:-1===n.indexOf(e)?t.typography.fontWeightRegular:t.typography.fontWeightMedium});function $(e){let{label:n,disabled:t,required:i,initialValue:a,onChange:l,style:s,onSubmit:r,triggers:c,options:d,formatterBeforeSubmit:p,helperText:u,...h}=e;const f=(0,G.Z)(),[g,x]=(0,o.useState)(!1),[b,Z]=(0,o.useState)(!1),[j,v]=(0,o.useState)(a),[y,k]=(0,o.useState)(j),C=g?(0,J.jsx)(W.Z,{value:y,onChange:e=>{let{value:n}=e.target;n="string"===typeof n?n.split(","):n,k(n),l(n)},fullWidth:!0,multiple:!0,variant:"outlined",margin:"dense",renderValue:e=>(0,J.jsx)(m.Z,{sx:{display:"flex",flexWrap:"wrap"},children:e.filter((e=>d.some((n=>n.code===e)))).map((e=>(0,J.jsx)(q.Z,{label:d.find((n=>n.code===e)).name,style:{marginRight:8},size:"small"},e)))}),MenuProps:Q,...h,children:d.map((e=>(0,J.jsx)(K.Z,{value:e.code,style:X(e.code,y,f),children:e.name},e.code)))}):(0,J.jsx)(m.Z,{px:1,className:"form-item-input slot",style:{whiteSpace:"pre-wrap"},children:y.filter((e=>d.some((n=>n.code===e)))).map((e=>(0,J.jsx)(q.Z,{label:d.find((n=>n.code===e)).name,style:{marginRight:8},size:"small"},e)))});return(0,J.jsx)(M.Z,{className:"form",style:s,children:(0,J.jsxs)(m.Z,{className:"form-item",children:[(0,J.jsxs)(m.Z,{className:"form-item-label",children:[n,i&&(0,J.jsx)(H.Z,{})]}),(0,J.jsxs)(m.Z,{className:"form-item-body",children:[(0,J.jsx)(m.Z,{className:"form-item-input",children:C}),(0,J.jsx)(m.Z,{className:"form-item-action",children:g?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(D.Z,{"data-cy":"schema-form-item-confirm",onClick:async()=>{Z(!0);try{!1===await r("function"===typeof p?p(y):y)?k(j):(k(y),v(y))}catch(e){k(j)}finally{Z(!1),x(!1)}},disabled:t||b,size:"large",children:b?(0,J.jsx)(B.Z,{size:24}):(0,J.jsx)(U.Z,{})}),(0,J.jsx)(D.Z,{"data-cy":"schema-form-item-cancel",onClick:()=>{k(j),x(!1)},disabled:t||b,size:"large",children:(0,J.jsx)(z.default,{})})]}):(0,J.jsx)(Y.Z,{triggers:c,onEnterEdit:()=>x(!0),disabled:t})})]}),g&&u&&(0,J.jsx)(V.Z,{children:u})]})})}$.propTypes={style:s().object,onSubmit:s().func,onChange:s().func,label:s().string,initialValue:s().string,required:s().bool,disabled:s().bool,triggers:s().array,options:s().array,helperText:s().string,formatterBeforeSubmit:s().func},$.defaultProps={style:{},onSubmit:()=>{},onChange:()=>{},label:"",initialValue:"",required:!1,disabled:!1,triggers:[],options:[],helperText:"",formatterBeforeSubmit:e=>e.join(",")};var ee,ne=t(58238),te=t(14491),ie=t(54063),oe=t(63406),ae=t(78410),le=t(31853),se=t(49983),re=t(70461),ce=t(73545),de=t(29054);function pe(e){let{initialValue:n,onChange:t,disabled:i,loading:o}=e;const{t:a}=(0,y.PE)(),{api:l}=(0,ce.T)(),{blocklet:s}=(0,de.y0)(),[r,c]=(0,le.Z)({newAppSk:"",isConnectOpen:!1}),d=()=>c({isConnectOpen:!1}),u=s.structVersion===p.APP_STRUCT_VERSION?[{key:"rotate-with-did-wallet",title:"Migrate with DID Wallet",handler:()=>{(0,te.An)(s.status)?I.Z.error(a("blocklet.error.isRunning")):(0,C.isInProgress)(s.status)?I.Z.error(a("blocklet.error.isInProgress")):c({isConnectOpen:!0})}}]:[];return[(0,J.jsx)(F.Z,{disabled:i,loading:o,initialValue:n,onSubmit:e=>(c({newAppSk:e}),!1),triggers:u,secure:!0}),r.newAppSk&&(0,J.jsx)(re.Z,{title:a("blocklet.config.appSkTitle"),description:(0,J.jsxs)(m.Z,{children:[(0,J.jsx)(m.Z,{children:a("blocklet.config.appSkChangeTip")}),(0,J.jsx)(m.Z,{fontWeight:"bold",mt:2,children:a("blocklet.config.appDidChangeTip")}),(0,J.jsxs)(me,{children:[(0,J.jsx)("li",{children:a("blocklet.config.appDidChangeTipL1")}),(0,J.jsx)("li",{children:a("blocklet.config.appDidChangeTipL2")})]})]}),confirm:a("confirm"),cancel:a("cancel"),onConfirm:()=>(async e=>{try{await t(e)}finally{c({newAppSk:""})}})(r.newAppSk),onCancel:()=>c({newAppSk:""})}),(0,J.jsx)(se.Z,{popup:!0,open:r.isConnectOpen,forceConnected:!1,saveConnect:!1,action:"rotate-key-pair",checkFn:l.get,checkTimeout:3e5,onSuccess:d,extraParams:{appDid:s.appDid},messages:{title:a("setup.keyPair.title"),scan:a("setup.keyPair.scan"),confirm:a("setup.keyPair.confirm"),success:a("setup.keyPair.success")},onClose:d})]}pe.propTypes={initialValue:s().string,onChange:s().func,disabled:s().bool,loading:s().bool},pe.defaultProps={initialValue:"default",onChange:()=>{},disabled:!1,loading:!1};const me=(0,a.Z)("ul")(ee||(ee=(0,i.Z)(["\n padding-left: 16px;\n li {\n margin-top: 8px;\n list-style: disk;\n font-weight: bold;\n }\n"])));var ue,he=t(13128),fe=t(55372),ge=t(11750),xe=t(88574),be=t(26174),Ze=t(88092),je=t(50185),ve=t(17425);function ye(e){let{onCancel:n,onSuccess:t,onError:i}=e;const{api:a}=(0,o.useContext)(ce.B),[l,s]=(0,o.useState)(!1),{t:r,locale:c}=(0,y.PE)(),[d,p]=(0,o.useState)(""),[u,h]=(0,o.useState)(!1),[f,g]=(0,o.useState)(0),[x,b]=(0,o.useState)(""),{endpoint:Z}=(0,ve.DJ)(),[j,v]=(0,o.useState)(!1),k=e=>{p(null),s(!0);try{b(e.result),g(w.length-1)}catch(n){const e=(0,te.Z)(n);p(e),i(n)}finally{s(!1)}},C=()=>{h(!1),g(0)},w=[{body:(0,J.jsxs)(m.Z,{children:[(0,J.jsx)(ge.Z,{children:r("team.transferApp.transferDialog.tips.progress")}),(0,J.jsx)(ge.Z,{mt:3,mb:2,children:r("team.transferApp.transferDialog.tips.newOwnerPermissions")})]}),cancel:r("common.cancel"),confirm:r("team.transferApp.transferDialog.createTransferLink"),onCancel:n,onConfirm:()=>{h(!0),g(1)}},{body:()=>(0,J.jsx)(se.Z,{action:"transfer-app-owner",open:u,locale:c,checkFn:a.get,onClose:C,onSuccess:k,checkTimeout:3e5,extraParams:{},messages:{title:r("team.transferApp.connectDialog.title"),scan:r("team.transferApp.connectDialog.scan"),confirm:r("team.transferApp.connectDialog.confirm"),success:r("team.transferApp.connectDialog.success")},popup:!0})},{body:()=>{const e=(0,te.VP)({transferId:x.transferId,endpoint:Z});return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(m.Z,{component:ke,dangerouslySetInnerHTML:{__html:r("team.transferApp.transferDialog.createSuccessTip1")}}),(0,J.jsx)(m.Z,{component:ke,mt:2,children:(0,J.jsx)(ke,{children:r("team.transferApp.transferDialog.createSuccessTip3")})}),(0,J.jsxs)(m.Z,{children:[(0,J.jsx)(m.Z,{component:ke,mt:2,children:(0,J.jsx)(ke,{children:r("team.transferApp.transferDialog.createSuccessTip2",{expireDate:(0,te.B2)(x.expireDate,c)})})}),(0,J.jsx)(m.Z,{my:1,children:(0,J.jsx)(je.Z,{children:e})})]}),(0,J.jsx)("div",{children:(0,J.jsx)(be.Z,{value:"end",control:(0,J.jsx)(Ze.Z,{checked:j,onChange:e=>v(e.target.checked)}),label:r("team.transferApp.transferDialog.iKnow"),labelPlacement:"end"})})]})},confirm:r("common.confirm"),onConfirm:t}],S=w[f];return(0,J.jsxs)(he.ZP,{title:(0,J.jsx)(ke,{className:"title",children:r("team.transferApp.transferDialog.title")}),fullWidth:!0,open:!0,showCloseButton:!1,actions:(0,J.jsxs)(J.Fragment,{children:[S.cancel&&(0,J.jsx)(N.Z,{onClick:S.onCancel,color:"inherit",children:S.cancel}),(0,J.jsxs)(N.Z,{onClick:S.onConfirm,color:"error",disabled:l||f===w.length-1&&!j,variant:"contained",autoFocus:!0,children:[l&&(0,J.jsx)(B.Z,{size:16}),S.confirm]})]}),children:[(0,J.jsx)(fe.Z,{component:"div",children:"function"===typeof S.body?S.body():S.body}),!!d&&(0,J.jsx)(xe.Z,{type:"error",variant:"icon",children:d})]})}ye.propTypes={onCancel:s().func.isRequired,onSuccess:s().func.isRequired,onError:s().func},ye.defaultProps={onError:()=>{}};const ke=a.Z.div(ue||(ue=(0,i.Z)(["\n font-size: 16px;\n font-weight: bold;\n &.title {\n font-size: 20px;\n }\n"])));var Ce,we=t(49522),Se=t(59375);const Le=Object.keys(O.SUPPORTED_LANGUAGES).map((e=>({code:e,name:O.SUPPORTED_LANGUAGES[e].nativeName})));function Ee(e){var n;let{blocklet:t,onUpdate:i,hasPermission:a,...l}=e;const{api:s,inService:r,prefix:c,getSessionInHeader:d,ws:{useSubscription:u}}=(0,ne.h6)(),{t:h}=(0,o.useContext)(y.RD),[f,g]=(0,o.useState)(""),[x,b]=(0,o.useState)(""),[Z,j]=(0,o.useState)(!1),v=(0,C.getWhoCanAccess)(t),k=null===t||void 0===t||null===(n=t.settings)||void 0===n?void 0:n.publicToStore,w=x||!a,{logoUrl:S,rectLogoUrl:L,faviconUrl:P}=(0,we.Z)({blocklet:t}),{did:B}=t.meta,{site:z}=t,U=E()(t.meta,"capabilities.clusterMode",!1);if(u(p.EVENTS.NODE_RUNTIME_INFO,(e=>{U&&g(E()(e,"cpu.physicalCores",""))})),(0,te.wS)(t.status))return null;const D=t.environments.find((e=>e.key===O.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_DELETABLE)),K=!D||"yes"===D.value,W=t.environments.find((e=>e.key===O.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_LANGUAGES)),q=t.environments.find((e=>e.key===O.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_URL)),G=t.environments.find((e=>e.key===O.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_COPYRIGHT_OWNER)),V=t.environments.find((e=>e.key===O.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_COPYRIGHT_YEAR)),H=[{key:O.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_NAME,description:h("blocklet.config.name"),value:t.environments.find((e=>"BLOCKLET_APP_NAME"===e.key)).value},{key:O.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_DESCRIPTION,description:h("blocklet.config.description"),value:t.environments.find((e=>"BLOCKLET_APP_DESCRIPTION"===e.key)).value},{key:O.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_URL,description:h("blocklet.config.appUrl"),value:q?q.value:""},{key:O.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_COPYRIGHT_OWNER,description:h("blocklet.config.copyrightOwner"),value:G?G.value:""},{key:O.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_COPYRIGHT_YEAR,description:h("blocklet.config.copyrightYear"),value:V?V.value:""}];if(U){const e=t.configs.find((e=>e.key===O.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_CLUSTER_SIZE)),n=e?e.value:f;H.push({key:O.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_CLUSTER_SIZE,description:h("blocklet.config.clusterSize"),value:n,cpuCores:f})}const M=async(e,n)=>{if(e===O.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_CLUSTER_SIZE){const e=(0,te.I)({value:n,cpuCores:f});if(e)return void I.Z.error(e)}const o=[{key:e,value:n}];try{b(!0);const{blocklet:e}=await s.configBlocklet({input:{did:t.meta.did,configs:o}});i(e)}catch(a){I.Z.error(a.message)}finally{b(!1)}};return(0,J.jsxs)(Te,{...l,children:[H.map((e=>(0,J.jsxs)(m.Z,{className:"config-form",mt:2,children:[(0,J.jsx)(m.Z,{className:"config-label",fontSize:14,mb:0,children:e.description}),(0,J.jsx)(F.Z,{style:{marginTop:0},disabled:x||w,loading:x,initialValue:e.value,onSubmit:n=>M(e.key,n)})]}))),(0,J.jsx)(m.Z,{className:"config-form",component:T.Z,my:3}),(0,J.jsx)(m.Z,{className:"config-label",fontSize:14,mb:1,sx:{flexGrow:0,width:"auto"},children:h("blocklet.config.logoSquare")}),(0,J.jsx)(Se.Z,{did:t.meta.did,height:80,width:80,type:"square",prefix:c,url:S,enabled:a,headers:d}),(0,J.jsx)(m.Z,{className:"config-label",fontSize:14,mt:4,children:h("blocklet.config.logoRect")}),(0,J.jsx)(m.Z,{mb:1.5,className:"config-desc",children:h("blocklet.config.logoRectDesc")}),(0,J.jsx)(Se.Z,{did:t.meta.did,height:80,type:"rect",prefix:c,url:L,enabled:a,headers:d}),(0,J.jsx)(m.Z,{className:"config-label",fontSize:14,mt:4,children:h("blocklet.config.logoFavicon")}),(0,J.jsx)(m.Z,{mb:1.5,className:"config-desc",children:h("blocklet.config.logoFaviconDesc")}),(0,J.jsx)(Se.Z,{did:t.meta.did,height:25,width:25,type:"favicon",prefix:c,url:P,enabled:a,headers:d}),(0,J.jsx)(m.Z,{className:"config-form",children:"all"===v&&"registry"===t.source&&(0,J.jsxs)(m.Z,{className:"config-item",children:[(0,J.jsxs)(m.Z,{className:"config-label",children:[h("blocklet.config.access.publicToStore"),(0,J.jsx)(m.Z,{className:"config-desc",children:h("blocklet.config.access.publicInstanceTip")})]}),(0,J.jsx)(A.Z,{disabled:w,checked:k,defaultChecked:!0,onChange:async e=>{if(!x){b(!0);try{const{checked:n}=e.target,{blocklet:o}=await s.configPublicToStore({input:{did:t.meta.did,publicToStore:n}});i(o)}catch(n){I.Z.error(n.message)}finally{b(!1)}}}})]})}),(0,J.jsx)(m.Z,{className:"config-form",component:T.Z,my:3}),(0,J.jsxs)(m.Z,{className:"config-form",mt:2,children:[(0,J.jsx)(m.Z,{className:"config-label",fontSize:14,mb:0,children:h("blocklet.config.languages")}),(0,J.jsx)($,{style:{marginTop:0},disabled:x||w,loading:x,options:Le,initialValue:W?W.value.split(","):["en","zh"],onSubmit:e=>M("BLOCKLET_APP_LANGUAGES",e),helperText:h("blocklet.config.selectLanguagesTip")})]}),(0,J.jsx)(m.Z,{className:"config-form",component:T.Z,my:3}),(0,J.jsx)(m.Z,{className:"config-form",mt:2,children:(0,J.jsx)(m.Z,{className:"config-label",mb:0,children:h("common.security")})}),(0,J.jsxs)(m.Z,{className:"config-form",mt:2,children:[(0,J.jsx)(m.Z,{className:"config-label",fontSize:14,mb:0,children:h("router.domainSecurity.cors.title")}),(0,J.jsx)(m.Z,{mb:1.5,className:"config-desc",children:h("router.domainSecurity.cors.description",{name:"the blocklet"})}),(0,J.jsx)(F.Z,{style:{marginTop:0},disabled:x||w,loading:x,initialValue:(z.corsAllowedOrigins||[]).join(", "),onSubmit:async e=>{const n=z.corsAllowedOrigins||[],i=e.split(",").map((e=>e.trim())).filter(Boolean);if(_()(n,i))return!1;try{b(!0);const e=i.length?i:["__none__"];await s.updateRoutingSite({input:{id:z.id,corsAllowedOrigins:e,teamDid:t.meta.did}}),b(!1)}catch(o){return I.Z.error(o.message),b(!1),!1}return!0}})]}),(0,J.jsx)(m.Z,{className:"config-form",component:T.Z,my:3}),(0,J.jsx)(m.Z,{mb:2,className:"config-label",fontSize:20,children:h("blocklet.config.dangerZone")}),(0,J.jsxs)(m.Z,{px:2,py:1,sx:{border:"1px solid red",borderRadius:2},children:[(0,J.jsx)(m.Z,{className:"config-form",mt:2,children:!r&&(0,J.jsxs)(m.Z,{className:"config-item",children:[(0,J.jsxs)(m.Z,{className:"config-label",children:[h("blocklet.config.deletable.name"),(0,J.jsx)(m.Z,{className:"config-desc",children:h(K?"blocklet.config.deletable.disable":"blocklet.config.deletable.enable")})]}),(0,J.jsx)(A.Z,{disabled:w,checked:!K,defaultChecked:!0,onChange:async e=>{if(!x){b(!0);try{const{checked:n}=e.target,{blocklet:o}=await s.configBlocklet({input:{did:t.meta.did,configs:[{key:O.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_DELETABLE,value:n?"no":"yes"}]}});i(o)}catch(n){I.Z.error(n.message)}finally{b(!1)}}}})]})}),(0,J.jsxs)(m.Z,{className:"config-form",mt:2,children:[(0,J.jsx)(m.Z,{className:"config-label",fontSize:14,mb:0,children:h("blocklet.config.sk")}),(0,J.jsx)(pe,{disabled:x||w,loading:x,initialValue:t.environments.find((e=>"BLOCKLET_APP_SK"===e.key)).value,onChange:async e=>{if(!x){b(!0);try{const{blocklet:n}=await s.configBlocklet({input:{did:t.meta.did,configs:[{key:O.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_SK,value:e}]}});i(n)}catch(n){I.Z.error(n.message)}finally{b(!1)}}}})]}),r&&(0,J.jsx)(oe.Z,{role:"owner",children:e=>(e||ie.C)&&(0,J.jsxs)(m.Z,{className:"config-form",mt:2,children:[(0,J.jsxs)(m.Z,{className:"config-item",children:[(0,J.jsx)(m.Z,{className:"config-label",mb:0,children:h("team.transferApp.name")}),(0,J.jsxs)(N.Z,{style:{flexShrink:0},variant:"contained",edge:"end",color:"error",size:"small","data-cy":"transfer-app",onClick:()=>j(!0),children:[(0,J.jsx)(R.Z,{style:{fontSize:"1.3em",marginRight:4}}),h("team.transferApp.name")]})]}),Z&&(0,J.jsx)(ye,{onCancel:()=>j(!1),onSuccess:()=>j(!1)})]})}),(0,J.jsx)(m.Z,{className:"config-form",mt:2,children:(0,J.jsxs)(m.Z,{className:"config-item",children:[(0,J.jsxs)(m.Z,{className:"config-label",children:[h("blocklet.config.clearCache.name"),(0,J.jsx)(m.Z,{className:"config-desc",children:h("blocklet.config.clearCache.purpose")})]}),(0,J.jsx)(ae.Z,{teamDid:B})]})})]})]})}const Pe=(0,oe.V)(Ee,"mutate_blocklets"),_e=(0,oe.V)(Ee,"",te.Wf);function Ae(e){const{inService:n}=(0,ne.h6)();return n?(0,J.jsx)(_e,{...e}):(0,J.jsx)(Pe,{...e})}Ee.propTypes={blocklet:s().object.isRequired,onUpdate:s().func,hasPermission:s().bool},Ee.defaultProps={onUpdate:()=>{},hasPermission:!1};const Te=a.Z.div(Ce||(Ce=(0,i.Z)(["\n padding-top: 24px;\n .config-form {\n flex-grow: 1;\n overflow-y: auto;\n "," {\n width: 100%;\n flex-shrink: 0;\n padding: 0 24px;\n transform: translate(0, 0);\n }\n }\n\n .config-item {\n display: flex;\n align-items: center;\n justify-content: space-between;\n margin: 16px 0;\n }\n\n .config-label {\n font-weight: bold;\n }\n\n .config-desc {\n font-weight: normal;\n font-size: 12px;\n color: #666;\n }\n\n .form-item {\n margin-top: 0;\n }\n"])),(e=>e.theme.breakpoints.down("md")));var Ne=t(25710),Re=t(93066),Oe=t(80576),Ie=t(47020),Fe=t(56556),Be=t(8708),ze=t.n(Be),Ue=t(99360),De=t(80506),Ke=t(766),We=t.n(Ke),qe=t(24529),Ge=t.n(qe),Ve=t(16727),He=t.n(Ve);const Me={enabled:!1,secure:!1,from:"",host:"",port:"",user:"",password:""};const Ye=function(){var e,n,t;const{api:i}=(0,ne.h6)(),{blocklet:o}=(0,de.y0)(),{t:a}=(0,y.PE)(),l=null===o||void 0===o||null===(e=o.meta)||void 0===e?void 0:e.did,s=Object.assign({...Me},(null===o||void 0===o||null===(n=o.settings)||void 0===n||null===(t=n.notification)||void 0===t?void 0:t.email)||{}),{handleSubmit:r,control:c,formState:d,watch:p,reset:u}=(0,De.cI)({defaultValues:ze()(s,Object.keys(Me))}),h=p("enabled"),f=(0,Ue.Z)((async e=>{try{var n,t;const{blocklet:o}=await i.configNotification({input:{did:l,notification:JSON.stringify({email:e})}}),s=Object.assign({...Me},(null===o||void 0===o||null===(n=o.settings)||void 0===n||null===(t=n.notification)||void 0===t?void 0:t.email)||{});u(s),I.Z.success(a("oauth.saveSuccess"))}catch(o){I.Z.error(o.message||a("oauth.saveFailed"))}})),g=(0,Ue.Z)((e=>{const n=null===e||void 0===e?void 0:e.trim();return n?!!We()(n)||a("notification.email.fromInvalid"):a("notification.email.fromRequired")})),x=(0,Ue.Z)((e=>{const n=null===e||void 0===e?void 0:e.trim();return n?!!Ge()(n,{require_host:!1,protocols:[]})||a("notification.email.hostInvalid"):a("notification.email.hostRequired")})),b=(0,Ue.Z)((e=>e?!!He()(e)||a("notification.email.portInvalid"):a("notification.email.portRequired"))),Z=(0,Ue.Z)((e=>!(null===e||void 0===e||!e.trim())||a("notification.email.userRequired"))),j=(0,Ue.Z)((e=>!(null===e||void 0===e||!e.trim())||a("notification.email.passwordRequired"))),v=(0,Ue.Z)((()=>!0));return(0,J.jsx)(m.Z,{children:(0,J.jsxs)("form",{onSubmit:r(f),disabled:!0,children:[(0,J.jsx)(De.Qr,{name:"enabled",control:c,render:e=>{let{field:n}=e;return(0,J.jsx)(be.Z,{control:(0,J.jsx)(A.Z,{checked:n.value,...n}),label:a("notification.email.enable"),sx:{marginBottom:"8px"}})}}),(0,J.jsx)(De.Qr,{name:"from",control:c,rules:{validate:h?g:v},render:e=>{var n;let{field:t}=e;return(0,J.jsx)(Oe.Z,{fullWidth:!0,children:(0,J.jsx)(Ie.Z,{...t,label:a("notification.email.from"),error:!!d.errors[t.name],helperText:(null===(n=d.errors[t.name])||void 0===n?void 0:n.message)||"\u3000",disabled:!h})})}}),(0,J.jsx)(De.Qr,{name:"host",control:c,rules:{validate:h?x:v},render:e=>{var n;let{field:t}=e;return(0,J.jsx)(Oe.Z,{fullWidth:!0,children:(0,J.jsx)(Ie.Z,{...t,error:!!d.errors[t.name],label:a("notification.email.host"),helperText:(null===(n=d.errors[t.name])||void 0===n?void 0:n.message)||"\u3000",disabled:!h})})}}),(0,J.jsx)(De.Qr,{name:"port",control:c,rules:{validate:h?b:v},render:e=>{var n;let{field:t}=e;return(0,J.jsx)(Oe.Z,{fullWidth:!0,children:(0,J.jsx)(Ie.Z,{...t,type:"number",error:!!d.errors[t.name],label:a("notification.email.port"),helperText:(null===(n=d.errors[t.name])||void 0===n?void 0:n.message)||"\u3000",disabled:!h})})}}),(0,J.jsx)(De.Qr,{name:"user",control:c,rules:{validate:h?Z:v},render:e=>{var n;let{field:t}=e;return(0,J.jsx)(Oe.Z,{fullWidth:!0,children:(0,J.jsx)(Ie.Z,{...t,error:!!d.errors[t.name],label:a("notification.email.user"),helperText:(null===(n=d.errors[t.name])||void 0===n?void 0:n.message)||"\u3000",disabled:!h})})}}),(0,J.jsx)(De.Qr,{name:"password",control:c,rules:{validate:h?j:v},render:e=>{var n;let{field:t}=e;return(0,J.jsx)(Oe.Z,{fullWidth:!0,children:(0,J.jsx)(Ie.Z,{...t,type:"password",error:!!d.errors[t.name],label:a("notification.email.password"),helperText:(null===(n=d.errors[t.name])||void 0===n?void 0:n.message)||"\u3000",disabled:!h})})}}),(0,J.jsx)(De.Qr,{name:"secure",control:c,rules:{validate:v},render:e=>{let{field:n}=e;return(0,J.jsx)(Oe.Z,{fullWidth:!0,children:(0,J.jsx)(be.Z,{control:(0,J.jsx)(A.Z,{checked:n.value,...n,disabled:!h}),label:a("notification.email.secure"),style:{marginBottom:16}})})}}),(0,J.jsx)(Fe.Z,{type:"submit",variant:"contained",onSubmit:r(f),disabled:!d.isDirty,children:a("oauth.save")})]})})},Je=[{label:(0,J.jsx)(m.Z,{textAlign:"center",width:"100%",children:"Email"}),value:"email"},{label:(0,J.jsx)(m.Z,{textAlign:"center",width:"100%",children:"More"}),value:"more"}];const Qe=function(){const[e,n]=(0,o.useState)(Je[0].value),{t:t}=(0,o.useContext)(y.RD),i=(0,Re.Z)((()=>({email:(0,J.jsx)(Ye,{}),more:(0,J.jsx)(m.Z,{children:(0,J.jsx)(Ne.Z,{children:t("notification.comingSoon")})})})),[t]);return(0,J.jsxs)(m.Z,{children:[(0,J.jsx)(k.Z,{tabs:Je,current:e,onChange:n}),(0,J.jsx)(m.Z,{marginTop:"10px",children:i[e]})]})};var Xe=t(75239),$e=t(48342),en=t(94552),nn=t(24558),tn=t(74286),on=t(76667),an=t(70648),ln=t(44067),sn=t(7664),rn=t(44123),cn=t(53906);const dn=[{value:p.WHO_CAN_ACCESS.ALL,icon:cn.Z,title:{zh:"\u6240\u6709\u4eba\u53ef\u8bbf\u95ee",en:"Accessible to all"},description:{zh:"\u5411\u6240\u6709\u4eba\u5f00\u653e\uff0c\u65e0\u9700\u901a\u884c\u8bc1\u5373\u53ef\u8bbf\u95ee\u5e94\u7528",en:"Open to the world anyone can access without passport"}},{value:p.WHO_CAN_ACCESS.INVITED,icon:rn.Z,title:{zh:"\u53ea\u6709\u88ab\u9080\u8bf7\u7684\u4eba\u53ef\u4ee5\u8bbf\u95ee",en:"Only invited people can access"},description:{zh:"\u7a0d\u540e\u60a8\u53ef\u4ee5\u5728\u7ba1\u7406\u9875\u9762\u4e2d\u9080\u8bf7\u6210\u5458",en:"You can invite members later in the admin page"}},{value:p.WHO_CAN_ACCESS.OWNER,icon:sn.Z,title:{zh:"\u53ea\u6709\u5e94\u7528\u6240\u6709\u8005\u53ef\u4ee5\u8bbf\u95ee",en:"Only Owner of the blocklet can access"},description:{zh:"\u5fc5\u987b\u63d0\u4f9b\u6240\u6709\u8005\u901a\u884c\u8bc1\u624d\u80fd\u8bbf\u95ee\u5e94\u7528",en:"You must provide owner passport to access this application"}}];var pn,mn;const un="roles",hn=[...dn,{value:un,icon:an.Z,title:{zh:"\u6307\u5b9a\u901a\u884c\u8bc1\u53ef\u8bbf\u95ee",en:"Accessible to selected passports"},description:{zh:"\u53ea\u6709\u6307\u5b9a\u7684\u901a\u884c\u8bc1\u53ef\u4ee5\u8bbf\u95ee",en:"Only specified passports can access"}}],fn=(e,n)=>{if(e&&e.startsWith(p.WHO_CAN_ACCESS_PREFIX_ROLES)){const t=(0,C.getRolesFromAuthConfig)({whoCanAccess:e}),i=n.filter((e=>t.includes(e.name)));return{access:un,roles:i}}return{access:e,roles:[]}},gn=function(e,n){let{roles:t=[]}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const i=(e.configs||[]).find((e=>e.key===O.BLOCKLET_CONFIGURABLE_KEY.COMPONENT_ACCESS_WHO));if(i)return fn(i.value,t);if(n&&E()(n,"settings.whoCanAccess")&&E()(n,"settings.whoCanAccess")!==p.WHO_CAN_ACCESS.ALL)return fn(E()(n,"settings.whoCanAccess"),t);const o=(0,C.findServiceFromMeta)(e.meta,p.NODE_SERVICES.AUTH);return E()(o,"config.whoCanAccess")?fn(o.config.whoCanAccess,t):{access:p.WHO_CAN_ACCESS.ALL,roles:[]}};function xn(e){let{blocklet:n,ancestors:t,children:i}=e;const a=(0,G.Z)(),[l,s]=(0,o.useState)(""),{t:r,locale:c}=(0,y.PE)(),{api:d}=(0,ne.h6)(),{roles:u}=(0,ve.DJ)(),[h,f]=(0,o.useState)(""),g=t[0]||n,{access:x,roles:b}=gn(n,g,{roles:u}),[Z,j]=(0,o.useState)(x),[v,k]=(0,o.useState)(b),w=[...t.map((e=>e.meta.did)),n.meta.did],S={marginRight:4,fontSize:18,verticalAlign:"text-bottom",color:a.palette.text.secondary},L=t.concat(n).map((e=>(0,C.getDisplayName)(e,!0))).join(" / ");if((0,te.wS)(n.status))return null;if("unknown"===n.status&&(0,te.wS)(n.status))return null;const E=()=>{s(!1)},P=e=>{e.stopPropagation(),s(!0)},_=h||Z===un&&!v.length;return["function"===typeof i?i({open:P}):(0,J.jsx)(D.Z,{onClick:P,"data-cy":"action-config-component",children:(0,J.jsx)(on.default,{})}),l&&(0,J.jsxs)(bn,{open:!0,fullWidth:!0,title:L,onClose:E,PaperProps:{style:{minHeight:"auto"}},actions:(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(N.Z,{onClick:E,color:"inherit","data-cy":"config-access-cancel",children:r("common.cancel")}),(0,J.jsxs)(N.Z,{onClick:async()=>{if(!h){f(!0);try{let e=Z;e===un&&(e="".concat(p.WHO_CAN_ACCESS_PREFIX_ROLES).concat(v.map((e=>e.name)).join(","))),await d.updateWhoCanAccess({input:{did:w,whoCanAccess:e}}),I.Z.success(r("blocklet.config.access.updatedTip")),E(),f(!1)}catch(e){f(!1),I.Z.error((0,te.Z)(e))}}},color:"primary",disabled:_,variant:"contained",autoFocus:!0,"data-cy":"config-access-confirm",children:[h&&(0,J.jsx)(B.Z,{size:16}),r("common.confirm")]})]}),children:[(0,J.jsx)(m.Z,{mt:4,mb:3,children:(0,J.jsx)(Ie.Z,{label:r("blocklet.config.access.description"),select:!0,fullWidth:!0,value:Z,onChange:e=>{const{value:n}=e.target;j(n)},"data-cy":"config-access-select",SelectProps:{renderValue:e=>{const n=hn.find((n=>n.value===e));return n?(0,J.jsxs)(m.Z,{children:[(0,J.jsx)(n.icon,{style:S}),n.title[c]]}):null}},children:hn.map((e=>(0,J.jsxs)(Zn,{value:e.value,sx:{display:"block"},"data-cy":"config-access-opt-".concat(e.value),children:[(0,J.jsxs)(m.Z,{display:"flex",alignItems:"center",children:[(0,J.jsx)(e.icon,{style:S}),(0,J.jsx)(m.Z,{children:e.title[c]})]}),(0,J.jsx)(m.Z,{children:(0,J.jsx)(m.Z,{className:"tip",children:e.description[c]})})]})))})}),Z===un&&(0,J.jsx)(m.Z,{mt:4,mb:3,children:(0,J.jsx)(Ie.Z,{label:r("blocklet.config.access.description"),select:!0,fullWidth:!0,value:v.map((e=>e.name)),onChange:e=>{k(u.filter((n=>(e.target.value||[]).includes(n.name))))},SelectProps:{multiple:!0,renderValue:e=>(0,J.jsx)(m.Z,{sx:{display:"flex",flexWrap:"wrap",gap:.5},children:e.map((e=>{const n=u.find((n=>n.name===e));return(0,J.jsx)(q.Z,{label:n.title},n.text)}))})},children:u.map((e=>{let{name:n,title:t}=e;return(0,J.jsxs)(K.Z,{value:n,children:[(0,J.jsx)(Ze.Z,{checked:v.some((e=>e.name===n))}),(0,J.jsx)(ln.Z,{primary:t})]},n)}))})})]})]}xn.propTypes={blocklet:s().object.isRequired,ancestors:s().array,children:s().any},xn.defaultProps={ancestors:[],children:null};const bn=(0,a.Z)(he.ZP)(pn||(pn=(0,i.Z)(["\n .MuiDialogContent-root {\n padding-top: 0;\n margin-top: -32px;\n }\n .MuiToolbar-root {\n padding-right: 12px;\n }\n .ux-dialog_right {\n padding-right: 20px;\n }\n"]))),Zn=(0,a.Z)(K.Z)(mn||(mn=(0,i.Z)(["\n .tip {\n font-size: 12px;\n color: ",";\n }\n"])),(e=>e.theme.palette.text.secondary));var jn;function vn(e){var n;let{blocklet:t,ancestors:i,depth:a}=e;const l=(0,G.Z)(),{t:s,locale:r}=(0,y.PE)(),{roles:c}=(0,ve.DJ)(),[d,p]=(0,o.useState)(!0),{recommendedDomain:u}=(0,de.y0)(),h=i[0]||t,f="/".concat(i.map((e=>e.mountPoint||"/")).join("/"),"/").concat(t.mountPoint||"/").replace(/\/+/g,"/"),g=(0,te.vH)({blocklet:h,domain:{value:u},mountPoint:f,params:(0,te.f0)(h,r)}),x={fill:l.palette.text.secondary},b=a>0&&t.children.length>0,v=(0,J.jsx)(D.Z,{size:"small",children:d?(0,J.jsx)(j.Z,{fontSize:"inherit"}):(0,J.jsx)(Z.default,{fontSize:"inherit"})}),{access:k,roles:S}=gn(t,h,{roles:c});let L;if("roles"!==k)L=dn.find((e=>e.value===k))||dn[2];else{const e=S.map((e=>e.title)).join("/");L={title:{zh:"\u53ea\u6709 ".concat(e," \u53ef\u4ee5\u8bbf\u95ee"),en:"Only ".concat(e," can access")}}}return[(a>0||"gateway"!==t.meta.group)&&(0,J.jsxs)(m.Z,{display:"flex",py:2,className:"component-item",justifyContent:"space-between",alignItems:"center",children:[(0,J.jsxs)(m.Z,{pl:Math.max(2*(a-1),0),width:{xs:300,md:400},display:"flex",alignItems:"center",style:{cursor:b?"pointer":"cursor"},onClick:()=>b&&p(!d),children:[b?v:(0,J.jsx)(m.Z,{width:28}),(0,J.jsx)(w.Z,{blocklet:t,ancestors:i}),(0,J.jsxs)(m.Z,{ml:"16px",children:[(0,J.jsx)(m.Z,{style:{color:"#222",fontSize:18},children:(0,C.getDisplayName)(t,!0)}),(0,J.jsx)(m.Z,{display:"flex",alignItems:"center",children:(0,J.jsx)(m.Z,{color:"text.secondary",children:L.title[r]})})]})]},t),(0,J.jsxs)(m.Z,{children:[(0,J.jsx)(Xe.Z,{title:s("common.visit"),children:(0,J.jsx)("a",{target:"_blank",href:g,rel:"noopener noreferrer",title:g,children:(0,J.jsx)(D.Z,{children:(0,J.jsx)(en.Z,{})})})}),(0,J.jsx)(xn,{blocklet:t,ancestors:i,children:e=>{let{open:n}=e;return(0,J.jsx)(Xe.Z,{title:s("common.edit"),children:(0,J.jsx)(D.Z,{onClick:n,"data-cy":"btn-edit-".concat(t.meta.did),children:(0,J.jsx)(nn.Z,{style:x})})})}})]},"actions")]},"group-not-gateway-box"),(0,J.jsx)(tn.Z,{depth:a},"line"),null!==(n=t.children)&&void 0!==n&&n.length?(0,J.jsx)($e.Z,{in:d,children:t.children.map((e=>(0,J.jsx)(vn,{blocklet:e,ancestors:[...i,t],depth:a+1},"".concat(a+1,"-").concat(e.meta.did))))},"blocklet-collapse"):null]}function yn(){const{t:e}=(0,y.PE)(),{blocklet:n}=(0,de.y0)(),t=[...n.children]||[];return"gateway"!==n.meta.group&&t.unshift(n),(0,J.jsx)(kn,{component:"div",children:t&&t.length?[(0,J.jsx)(m.Z,{mt:2,ml:{xs:"-12px",md:"-24px"},style:{maxWidth:1080},children:(0,J.jsx)(vn,{blocklet:n},"0-".concat(n.meta.did))},"top-blocklet-".concat(n.meta.did))]:(0,J.jsx)(m.Z,{mt:8,children:(0,J.jsx)(Ne.Z,{children:e("blocklet.component.noComponent")})})})}vn.propTypes={blocklet:s().object.isRequired,ancestors:s().array,depth:s().number},vn.defaultProps={ancestors:[],depth:0},yn.propTypes={};const kn=(0,a.Z)(m.Z)(jn||(jn=(0,i.Z)(["\n .title {\n font-size: 1.2rem;\n font-weight: bold;\n margin-top: ",";\n margin-bottom: ",";\n &.first {\n margin-top: 0;\n }\n }\n"])),(e=>e.theme.spacing(5)),(e=>e.theme.spacing(3)));var Cn=t(44784);const wn=function(){var e,n,t;const{api:i}=(0,ne.h6)(),{blocklet:o}=(0,de.y0)(),{t:a}=(0,y.PE)(),l=null===o||void 0===o||null===(e=o.meta)||void 0===e?void 0:e.did,s=Object.assign({enabled:!1,domain:"",clientId:""},(null===o||void 0===o||null===(n=o.settings)||void 0===n||null===(t=n.oauth)||void 0===t?void 0:t.auth0)||{}),{handleSubmit:r,control:c,formState:d,watch:p,reset:u}=(0,De.cI)({defaultValues:ze()(s,["domain","clientId","enabled"])}),h=p("enabled"),f=(0,Ue.Z)((async e=>{try{var n,t;const{blocklet:o}=await i.configOAuth({input:{did:l,oauth:JSON.stringify({auth0:e})}}),s=Object.assign({enabled:!1,domain:"",clientId:""},(null===o||void 0===o||null===(n=o.settings)||void 0===n||null===(t=n.oauth)||void 0===t?void 0:t.auth0)||{});u(s),I.Z.success(a("oauth.saveSuccess"))}catch(o){I.Z.error(o.message||a("oauth.saveFailed"))}})),g=(0,Ue.Z)((e=>!(null===e||void 0===e||!e.trim())||a("oauth.auth0.domainDescribe"))),x=(0,Ue.Z)((e=>!(null===e||void 0===e||!e.trim())||a("oauth.auth0.clientIdDescribe"))),b=(0,Ue.Z)((()=>!0));return(0,J.jsx)(m.Z,{children:(0,J.jsxs)("form",{onSubmit:r(f),disabled:!0,children:[(0,J.jsx)(De.Qr,{name:"enabled",control:c,render:e=>{let{field:n}=e;return(0,J.jsx)(be.Z,{control:(0,J.jsx)(Cn.Z,{checked:n.value,style:{marginRight:"6px"},...n}),label:a("oauth.auth0.enable"),sx:{marginBottom:2,ml:1}})}}),(0,J.jsx)(De.Qr,{name:"domain",control:c,rules:{validate:h?g:b},render:e=>{var n;let{field:t}=e;return(0,J.jsx)(Oe.Z,{fullWidth:!0,children:(0,J.jsx)(Ie.Z,{...t,label:a("oauth.auth0.domain"),error:!!d.errors[t.name],helperText:(null===(n=d.errors[t.name])||void 0===n?void 0:n.message)||"\u3000",disabled:!h})})}}),(0,J.jsx)(De.Qr,{name:"clientId",control:c,rules:{validate:h?x:b},render:e=>{var n;let{field:t}=e;return(0,J.jsx)(Oe.Z,{fullWidth:!0,children:(0,J.jsx)(Ie.Z,{...t,error:!!d.errors[t.name],label:a("oauth.auth0.clientId"),helperText:(null===(n=d.errors[t.name])||void 0===n?void 0:n.message)||"\u3000",disabled:!h})})}}),(0,J.jsx)(Fe.Z,{type:"submit",variant:"contained",onSubmit:r(f),disabled:!d.isDirty,children:a("oauth.save")})]})})};var Sn=t(77150),Ln=t(24103);const En={ttl:604800};function Pn(e){const n=arguments.length>1&&void 0!==arguments[1]&&arguments[1]?86400*e.ttl:e.ttl/86400;return{...e,ttl:n}}function _n(){var e,n;const{api:t}=(0,ne.h6)(),{blocklet:i}=(0,de.y0)(),o=null===i||void 0===i||null===(e=i.meta)||void 0===e?void 0:e.did,a=Object.assign({},En,(null===i||void 0===i||null===(n=i.settings)||void 0===n?void 0:n.session)||{}),{handleSubmit:l,control:s,formState:r,reset:c}=(0,De.cI)({defaultValues:ze()(Pn(a),["ttl"])}),{t:d}=(0,y.PE)(),p=(0,Ue.Z)((async e=>{try{var n;const{blocklet:i}=await t.updateAppSessionConfig({input:{did:o,config:Pn(e,!0)}}),a=Object.assign({},En,ze()((null===i||void 0===i||null===(n=i.settings)||void 0===n?void 0:n.session)||{},["ttl"]));c(Pn(a)),I.Z.success(d("common.configSuccess"))}catch(i){I.Z.error(i.message)}}));return(0,J.jsx)(m.Z,{children:(0,J.jsxs)("form",{onSubmit:l(p),disabled:!0,children:[(0,J.jsx)(De.Qr,{name:"ttl",control:s,render:e=>{let{field:n}=e;return(0,J.jsx)(Oe.Z,{fullWidth:!0,sx:{mb:2},children:(0,J.jsxs)(Ln.Z,{px:3,children:[(0,J.jsx)(m.Z,{mx:-3,my:.5,children:d("blocklet.config.session.ttl",{day:n.value})}),(0,J.jsx)(Sn.ZP,{...n,defaultValue:7,step:1,marks:[{value:1,label:d("blocklet.config.session.day",{day:1})},{value:7,label:d("blocklet.config.session.days",{day:7})},{value:14,label:d("blocklet.config.session.days",{day:14})},{value:21,label:d("blocklet.config.session.days",{day:21})},{value:30,label:d("blocklet.config.session.days",{day:30})}],min:1,max:30,valueLabelDisplay:"auto",style:{maxWidth:"360px"}})]})})}}),(0,J.jsx)(Fe.Z,{type:"submit",variant:"contained",onSubmit:l(p),disabled:!r.isDirty,children:d("oauth.save")})]})})}var An=t(82555),Tn=t(30333),Nn=t(75760),Rn=t(97038),On=t(12673),In=t(92706),Fn=t.n(In);const Bn=(0,o.forwardRef)(((e,n)=>{const{t:t}=(0,o.useContext)(y.RD),i=(0,On.Z)({show:!1,title:"",content:"",onConfirm:Fn(),onCancel:Fn(),loading:!1}),a=(0,Ue.Z)((function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};i.show=!0,i.title=e.title,i.content=e.content,i.onConfirm=e.onConfirm||Fn(),i.onCancel=e.onCancel||Fn(),i.loading=!1})),l=(0,Ue.Z)((()=>{i.title="",i.content="",i.onConfirm=Fn(),i.onCancel=Fn()})),s=(0,Ue.Z)((()=>{i.show=!1,setTimeout((()=>{l()}),300)})),r=(0,Ue.Z)((()=>{s(),null===i||void 0===i||i.onCancel()}),[]),c=(0,Ue.Z)((async()=>{i.loading=!0;try{await(null===i||void 0===i?void 0:i.onConfirm(s))}finally{i.loading=!1}}),[]);return(0,o.useImperativeHandle)(n,(()=>({open:a,close:s})),[a,s]),(0,J.jsx)(he.I4,{open:i.show,title:i.title,onConfirm:c,onCancel:r,confirmButton:{text:t("common.confirm"),props:{variant:"contained",color:"primary",loading:i.loading}},cancelButton:{text:t("common.cancel"),props:{variant:"outlined",color:"primary"}},children:i.content})}));var zn=t(64886),Un=t(42080),Dn=t.n(Un),Kn=t(75506),Wn=t.n(Kn),qn=t(47685),Gn=t(13260),Vn=t(82434),Hn=t.n(Vn);const Mn=(0,o.forwardRef)(((e,n)=>{var t,i;const{t:a}=(0,o.useContext)(y.RD),{blocklet:l}=(0,de.y0)(),{api:s}=(0,ne.h6)(),r=(0,On.Z)({mode:"view",show:!1,data:{},callback:Fn()}),c=(0,qn.Fg)(),p=(null===c||void 0===c||null===(t=c.transitions)||void 0===t||null===(i=t.duration)||void 0===i?void 0:i.leavingScreen)||300,u=(0,Ue.Z)((()=>{r.mode="view",r.data={},r.callback=Fn()}),[]),h=(0,Ue.Z)((()=>{r.show=!1,setTimeout((()=>{u()}),p)}),[]),f=(0,Ue.Z)((e=>{r.mode="view",r.show=!0,r.data=e}),[]),g=(0,Ue.Z)((function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Fn();r.mode="approve",r.show=!0,r.data=e,r.callback=n}),[]);(0,o.useImperativeHandle)(n,(()=>({open:f,close:h,approve:g})),[f,h,g]);const x=(0,Re.Z)((()=>{if(!r.show)return[];r.data.migratedFrom=[r.data.appId,r.data.appPid];const e=["appName","appLogo","appId","appPid","migratedFrom","appDescription","appUrl","version","appliedAt","status","serverId","serverVersion"];return!1!==r.data.isMaster&&Dn()(e,"appliedAt","status"),e.map((e=>{const n=a("federated.info.".concat(e));let t=r.data[e];if("appName"===e&&r.data.isMaster&&(t=(0,J.jsxs)(m.Z,{children:[(0,J.jsx)(An.Z,{component:Tn.Z}),t]})),["appId","appPid","serverId"].includes(e)&&(t=(0,J.jsx)(Gn.kL,{children:t})),["appUrl"].includes(e)&&(t=(0,J.jsx)(m.Z,{component:"a",href:t,target:"_blank",children:t})),["appLogo"].includes(e)){const e=Hn()(t)?t:d()(r.data.appUrl||"",t||"");try{const n=new URL(e);n.searchParams.set("imageFilter","resize"),n.searchParams.set("w","80"),n.searchParams.set("h","80"),t=(0,J.jsx)("img",{src:n.href,width:"60",height:"60",alt:r.data.appName})}catch{t=(0,J.jsx)("img",{src:e,width:"60",height:"60",alt:r.data.appName})}}if("status"===e&&(t=t&&a("federated.status.".concat(t))),"migratedFrom"===e){t=(r.data.migratedFrom||[]).filter((e=>![r.data.appId,r.data.appPid].includes(e))).map((e=>(0,J.jsx)(Gn.kL,{children:e})))}return Wn()(t)&&(t="-"),{name:n,value:t}}))}),[r.data]),b="approve"===r.mode,Z=(0,Ue.Z)((async()=>{await s.auditFederatedLogin({input:{memberPid:r.data.appPid,did:l.appPid,status:"rejected"}}),h(),null===r||void 0===r||r.callback(!1)})),j=(0,Ue.Z)((async()=>{await s.auditFederatedLogin({input:{memberPid:r.data.appPid,did:l.appPid,status:"approved"}}),h(),null===r||void 0===r||r.callback(!0)}));return(0,J.jsx)(he.ZP,{open:r.show,title:a(b?"federated.approveToJoinLogin":"federated.siteDetail"),onClose:h,actions:b?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(Fe.Z,{color:"error",variant:"contained",onClick:Z,children:a("common.reject")}),(0,J.jsx)(Fe.Z,{variant:"contained",onClick:j,children:a("common.approve")})]}):(0,J.jsx)(Fe.Z,{variant:"outlined",onClick:h,children:a("common.close")}),children:x.map((e=>(0,J.jsx)(zn.Z,{style:{alignItems:"flex-start"},valueComponent:"div",nameWidth:180,name:e.name,children:e.value},e.name)))})}));var Yn=t(79842),Jn=t(85408),Qn=t.n(Jn);const Xn=(0,o.forwardRef)(((e,n)=>{var t,i;const a=(0,qn.Fg)(),l=(null===a||void 0===a||null===(t=a.transitions)||void 0===t||null===(i=t.duration)||void 0===i?void 0:i.leavingScreen)||300,{t:s}=(0,o.useContext)(y.RD),r=(0,On.Z)({show:!1,data:{link:""}}),c=(0,Ue.Z)((()=>{r.data.link=""}),[]),d=(0,Ue.Z)((()=>{r.show=!1,setTimeout((()=>{c()}),l)}),[]),p=(0,Ue.Z)((e=>{let{link:n}=e;r.show=!0,r.data.link=n}),[]);(0,o.useImperativeHandle)(n,(()=>({open:p,close:d})),[p,d]);const u=(0,Ue.Z)((()=>{Qn()(r.data.link),d()}),[d]);return(0,J.jsxs)(he.ZP,{open:r.show,title:s("federated.joinFederatedLogin"),onClose:d,PaperProps:{style:{minHeight:"unset"}},actions:(0,J.jsx)(N.Z,{color:"primary",autoFocus:!0,variant:"contained",onClick:u,children:s("common.copyAndClose")}),children:[(0,J.jsx)(m.Z,{mb:1,children:s("federated.inviteJoinFederatedLoginDescription")}),(0,J.jsx)(m.Z,{sx:{"& .copy-button":{display:"none !important"}},children:(0,J.jsx)(Yn.Z,{language:"shell",style:{marginBottom:0},children:r.data.link})})]})}));function $n(e){var n,t,i,a,l;let{mode:s}=e;const r=(0,o.useRef)(null),c=(0,o.useRef)(null),{t:d,locale:p}=(0,o.useContext)(y.RD),{blocklet:u,actions:{refreshBlocklet:h}}=(0,de.y0)(),{confirmApi:f,confirmHolder:g}=function(){const e=(0,o.useRef)(null),n=(0,Ue.Z)((function(){for(var n,t=arguments.length,i=new Array(t),o=0;o<t;o++)i[o]=arguments[o];null===(n=e.current)||void 0===n||n.open(...i)})),t=(0,Ue.Z)((function(){for(var n,t=arguments.length,i=new Array(t),o=0;o<t;o++)i[o]=arguments[o];null===(n=e.current)||void 0===n||n.close(...i)})),i={open:n,close:t};return{confirmHolder:(0,J.jsx)(Bn,{ref:e}),confirmApi:i}}(),{api:x}=(0,ne.h6)(),b=(null===(n=u.settings.federated)||void 0===n?void 0:n.sites)||[],Z=(null===(t=u.settings.federated)||void 0===t?void 0:t.config)||{},j=!1!==Z.isMaster,v=(0,Ue.Z)((e=>{var n;null===(n=c.current)||void 0===n||n.open(e)})),k=(0,Ue.Z)((e=>{var n;null===(n=c.current)||void 0===n||n.approve(e,h)})),C=(0,Ue.Z)((e=>{f.open({title:d("federated.disableFederatedLogin"),content:d("federated.disableFederatedLoginDescription"),async onConfirm(n){await x.auditFederatedLogin({input:{memberPid:e.appPid,did:u.appPid,status:"revoked"}}),n()}})})),w=(0,Ue.Z)((e=>{f.open({title:d("federated.enableFederatedLogin"),content:d("federated.enableFederatedLoginDescription"),async onConfirm(n){await x.auditFederatedLogin({input:{memberPid:e.appPid,did:u.appPid,status:"approved"}}),n()}})})),S=(0,Re.Z)((()=>{const e=[{label:d("common.name"),name:"appName",options:{customBodyRenderLite:e=>{const n=b[e],t=!1!==n.isMaster;return(0,J.jsx)(m.Z,{display:"inline-block",children:(0,J.jsxs)(m.Z,{component:"a",display:"flex",alignItems:"center",href:n.appUrl,target:"_blank",onClick:e=>{e.stopPropagation()},children:[t&&(0,J.jsx)(An.Z,{component:Tn.Z,style:{marginRight:"4px"}}),n.appName]})})}}},{label:d("common.did"),name:"appId",options:{customBodyRenderLite:e=>{const n=b[e];return(0,J.jsx)(Rn.Z,{children:n.appId})}}},{label:d("common.status"),name:"status",options:{customBodyRenderLite:e=>{const n=b[e],t=!1!==n.isMaster;return(0,J.jsx)(m.Z,{children:t?"-":d("federated.status.".concat(n.status))})}}}];return j&&e.push({label:d("common.actions"),name:"actions",options:{customBodyRenderLite:e=>{const n=b[e],t=!1!==n.isMaster;return(0,J.jsx)(m.Z,{display:"flex",gap:1,children:t?(0,J.jsxs)(J.Fragment,{children:["rejected"===n.status&&(0,J.jsx)(N.Z,{variant:"contained",color:"error",size:"small",onClick:e=>{e.stopPropagation()},children:d("federated.status.rejected")}),"revoked"===n.status&&(0,J.jsx)(N.Z,{variant:"contained",color:"secondary",size:"small",onClick:e=>{e.stopPropagation()},children:d("federated.status.revoked")})]}):(0,J.jsxs)(J.Fragment,{children:["pending"===n.status&&(0,J.jsx)(N.Z,{variant:"contained",color:"primary",size:"small",onClick:e=>{e.stopPropagation(),k(n)},children:d("federated.status.pending")}),"approved"===n.status&&(0,J.jsx)(N.Z,{variant:"contained",color:"error",size:"small",onClick:e=>{e.stopPropagation(),C(n)},style:{whiteSpace:"nowrap"},children:d("federated.revoke")}),"revoked"===n.status&&(0,J.jsx)(N.Z,{variant:"contained",color:"warning",size:"small",onClick:e=>{e.stopPropagation(),w(n)},style:{whiteSpace:"nowrap"},children:d("federated.approve")})]})})}}}),e}),[Z.appId,b,j,d]),L=(0,Re.Z)((()=>({sort:!0,download:!1,filter:!1,print:!1,expandableRowsOnClick:!0,onRowClick(e,n){let{dataIndex:t}=n;const i=b[t];v(i)}})),[]),E=(0,Ue.Z)((()=>{const e=u.environments.find((e=>e.key===O.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_URL));var n;null!==e&&void 0!==e&&e.value?null===(n=r.current)||void 0===n||n.open({link:e.value}):I.Z.error(d("federated.failedToGetFederatedLoginLink"))}),[null===(i=u.site)||void 0===i||null===(a=i.domainAliases)||void 0===a||null===(l=a[0])||void 0===l?void 0:l.href]),P=(0,Ue.Z)((()=>{f.open({title:d("federated.quitFederatedLogin"),content:d("federated.quitFederatedLoginDescription"),async onConfirm(e){await x.quitFederatedLogin({input:{did:u.appPid}}),e()}})})),_=(0,Ue.Z)((()=>{f.open({title:d("federated.disbandFederatedLogin"),content:d("federated.disbandFederatedLoginDescription"),async onConfirm(e){await x.disbandFederatedLogin({input:{did:u.appPid}}),e()}})})),A=[];return"master"!==s?A.push((0,J.jsx)(N.Z,{size:"small",variant:"contained",color:"error",onClick:P,sx:{ml:1},children:d("federated.quitFederatedLogin")},"quitFederatedLogin")):(A.push((0,J.jsx)(N.Z,{size:"small",variant:"contained",onClick:E,sx:{ml:1},children:d("federated.inviteJoinFederatedLogin")},"inviteJoinFederatedLogin")),A.push((0,J.jsx)(N.Z,{color:"error",size:"small",variant:"contained",onClick:_,sx:{ml:1},children:d("federated.disbandFederatedLogin")},"disbandFederatedLogin"))),(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(Nn.Z,{className:"main-table",locale:p,data:b,columns:S,customButtons:A,title:(0,J.jsx)(m.Z,{className:"table-toolbar-left",children:d("oauth.federated")}),options:L}),g,(0,J.jsx)(Xn,{ref:r}),(0,J.jsx)(Mn,{ref:c})]})}$n.propTypes={mode:s().oneOf(["member","master"])},$n.defaultProps={mode:"member"};const et=$n,nt=(0,o.forwardRef)(((e,n)=>{var t,i;const{t:a}=(0,o.useContext)(y.RD),{api:l}=(0,ne.h6)(),{blocklet:s}=(0,de.y0)(),r=null===s||void 0===s?void 0:s.appPid,c=(0,qn.Fg)(),d=(null===c||void 0===c||null===(t=c.transitions)||void 0===t||null===(i=t.duration)||void 0===i?void 0:i.leavingScreen)||300,p=(0,On.Z)({show:!1,appUrl:"",appUrlError:"",callback:Fn()}),u=(0,Ue.Z)((()=>{p.appUrl="",p.appUrlError="",p.callback=Fn()}),[]),h=(0,Ue.Z)((()=>{p.show=!1,setTimeout((()=>{u()}),d)}),[]),f=(0,Ue.Z)((function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Fn();p.show=!0,p.callback=e}),[]);(0,o.useImperativeHandle)(n,(()=>({open:f,close:h})),[f,h]);const g=(0,Ue.Z)((e=>{if(!e)throw new Error(a("federated.federatedJoinAppUrlRequired"));if(!Hn()(e))throw new Error(a("federated.federatedJoinAppUrlInvalid"))})),x=(0,Ue.Z)((async()=>{try{g(p.appUrl);const e=await l.joinFederatedLogin({input:{did:r,appUrl:p.appUrl}});p.show=!1,h(),null===p||void 0===p||p.callback(e)}catch(e){p.appUrlError=e.message}}),[h,r]);return(0,J.jsxs)(he.ZP,{open:p.show,title:a("federated.joinFederatedLogin"),onClose:h,PaperProps:{style:{minHeight:"unset"}},actions:(0,J.jsx)(N.Z,{color:"primary",autoFocus:!0,variant:"contained",onClick:x,children:a("common.confirm")}),children:[(0,J.jsx)(m.Z,{mb:1,children:a("federated.joinFederatedLoginDescription")}),(0,J.jsx)(Ie.Z,{fullWidth:!0,variant:"outlined",margin:"dense",placeholder:a("federated.federatedJoinAppUrl"),label:a("federated.federatedJoinAppUrl"),value:p.appUrl,error:!!p.appUrlError,helperText:p.appUrlError||"eg: https://www.arcblock.io",onChange:e=>{p.appUrl=e.target.value}})]})}));function tt(){var e,n,t,i;const a=(0,o.useRef)(null),l=(0,o.useRef)(null),{t:s}=(0,o.useContext)(y.RD),{blocklet:r,actions:{refreshBlocklet:c}}=(0,de.y0)(),d=(0,Ue.Z)((()=>{var e,n,t;const i=null===(e=r.site)||void 0===e||null===(n=e.domainAliases)||void 0===n||null===(t=n[0])||void 0===t?void 0:t.href;if(i)try{var o;const e=new URL(i);null===(o=a.current)||void 0===o||o.open({link:e.origin})}catch{I.Z.error(s("federated.failedToGetFederatedLoginLink"))}}),[null===(e=r.site)||void 0===e||null===(n=e.domainAliases)||void 0===n||null===(t=n[0])||void 0===t?void 0:t.href]),p=(0,Ue.Z)((()=>{var e;null===(e=l.current)||void 0===e||e.open((()=>{c()}))}),[c]);if((null===(i=r.settings.federated)||void 0===i?void 0:i.sites.length)>0){var u;const e=!1!==(null===(u=r.settings.federated)||void 0===u?void 0:u.config.isMaster);return(0,J.jsx)(et,{mode:e?"master":"member"})}return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(m.Z,{display:"flex",flexDirection:"column",gap:2,justifyContent:"center",alignItems:"center",minHeight:"200px",children:[(0,J.jsx)(N.Z,{variant:"contained",onClick:d,children:s("federated.inviteJoinFederatedLogin")}),(0,J.jsx)(T.Z,{sx:{width:"150px",color:"rgba(0, 0, 0, 0.3)"},children:"OR"}),(0,J.jsx)(N.Z,{variant:"outlined",onClick:p,children:s("federated.joinFederatedLogin")})]}),(0,J.jsx)(Xn,{ref:a}),(0,J.jsx)(nt,{ref:l})]})}const it=function(){const{t:e}=(0,o.useContext)(y.RD),n=[{label:(0,J.jsx)(m.Z,{textAlign:"center",width:"100%",children:e("oauth.commonSettings")}),value:"settings"},{label:(0,J.jsx)(m.Z,{textAlign:"center",width:"100%",children:e("oauth.federated")}),value:"federated"},{label:(0,J.jsx)(m.Z,{textAlign:"center",width:"100%",children:"Auth0"}),value:"auth0"},{label:(0,J.jsx)(m.Z,{textAlign:"center",width:"100%",children:e("oauth.moreLogin")}),value:"more"}],[t,i]=(0,o.useState)(n[0].value),a=(0,Re.Z)((()=>({auth0:(0,J.jsx)(wn,{}),federated:(0,J.jsx)(tt,{}),more:(0,J.jsx)(m.Z,{children:(0,J.jsx)(Ne.Z,{children:e("oauth.comingSoon")})}),settings:(0,J.jsx)(m.Z,{children:(0,J.jsx)(_n,{})})})),[e]);return(0,J.jsxs)(m.Z,{children:[(0,J.jsx)(k.Z,{tabs:n,current:t,onChange:i}),(0,J.jsx)(m.Z,{marginTop:"10px",children:a[t]})]})};var ot;const at=e=>{let{tabs:n,blocklet:t,ancestors:i=[],depth:o=1,t:a}=e;const l=[...i.map((e=>e.meta.did)),t.meta.did].join("/"),s=!(null!==i&&void 0!==i&&i.length);n.push({label:(0,J.jsxs)(m.Z,{pl:2*Math.max(1,o-1),display:"flex",alignItems:"center",justifyContent:"flex-start",children:[s?(0,J.jsx)(S.Z,{size:24,blocklet:t}):(0,J.jsx)(w.Z,{size:24,blocklet:t,ancestors:i}),(0,J.jsx)(m.Z,{ml:"16px",children:(0,J.jsx)(m.Z,{style:{color:"#222"},children:s?a("blocklet.component.container"):(0,C.getDisplayName)(t,!0)})})]},l),value:l}),t.children.length>0&&t.children.forEach((e=>{at({tabs:n,blocklet:e,ancestors:[...i,t],depth:o+1,t:a})}))};function lt(e){let{blocklet:n,onUpdate:t,...i}=e;const{t:a}=(0,o.useContext)(y.RD),{info:l,inService:s}=(0,ne.h6)(),[c,C]=(0,o.useState)(!0),[w,S]=(0,v.useSearchParams)(),L=w.get("tab")||"general",E=[{label:(0,J.jsxs)(m.Z,{display:"flex",alignItems:"center","data-cy":"configuration-tab-general",children:[(0,J.jsx)(h.Z,{sx:{fontSize:24}}),(0,J.jsx)(m.Z,{ml:"16px",children:(0,J.jsx)(m.Z,{style:{color:"#222"},children:a("common.general")})})]},"general"),value:"general"},{label:(0,J.jsxs)(m.Z,{display:"flex",alignItems:"center","data-cy":"configuration-tab-access",children:[(0,J.jsx)(f.Z,{sx:{fontSize:24}}),(0,J.jsx)(m.Z,{ml:"16px",children:(0,J.jsx)(m.Z,{style:{color:"#222"},children:a("common.access")})})]},"access"),value:"access"},{label:(0,J.jsxs)(m.Z,{display:"flex",alignItems:"center","data-cy":"configuration-tab-oauth",children:[(0,J.jsx)(g.Z,{sx:{fontSize:24}}),(0,J.jsx)(m.Z,{ml:"16px",children:(0,J.jsx)(m.Z,{style:{color:"#222"},children:a("common.login")})})]},"oauth"),value:"oauth"},{label:(0,J.jsxs)(m.Z,{display:"flex",alignItems:"center","data-cy":"configuration-tab-notification",children:[(0,J.jsx)(x.Z,{sx:{fontSize:24}}),(0,J.jsx)(m.Z,{ml:"16px",children:(0,J.jsx)(m.Z,{style:{color:"#222"},children:a("common.notification")})})]},"notification"),value:"notification"},{label:(0,J.jsxs)(m.Z,{display:"flex",alignItems:"center","data-cy":"configuration-tab-preference",children:[(0,J.jsx)(m.Z,{ml:-2,style:{transform:"translateY(2px)"},children:c?(0,J.jsx)(j.Z,{fontSize:"inherit"}):(0,J.jsx)(Z.default,{fontSize:"inherit"})}),(0,J.jsx)(b.Z,{sx:{fontSize:24}}),(0,J.jsx)(m.Z,{ml:"16px",children:(0,J.jsx)(m.Z,{style:{color:"#222"},children:a("common.preferences")})})]},"preference"),value:"preference"}];c&&at({tabs:E,blocklet:n,t:a});let P=null;if("general"===L)P=(0,J.jsx)(Ae,{blocklet:n,onUpdate:t});else if("access"===L)P=(0,J.jsx)(yn,{});else if("oauth"===L)P=(0,J.jsx)(it,{});else if("notification"===L)P=(0,J.jsx)(Qe,{});else{const e=s?p.WELLKNOWN_SERVICE_PATH_PREFIX:l.routing.adminPath,n=new URLSearchParams;s||n.set("authKey","__sst"),n.set("schemaKey",d()(window.location.origin,e,"/api/preferences?id=".concat(encodeURIComponent(L)))),P=(0,J.jsx)(r.Z,{url:"".concat(d()(window.location.origin,e,"/hosted/form-collector/"),"?").concat(n.toString()),width:"100%",height:"100%",frameBorder:0,styles:{border:0}})}return(0,J.jsx)(st,{...i,children:(0,J.jsxs)(u.ZP,{container:!0,spacing:4,columns:24,children:[(0,J.jsx)(u.ZP,{item:!0,sm:7,md:5,children:(0,J.jsx)(k.Z,{tabs:E,current:L,orientation:"vertical",onChange:e=>{"preference"===e?C(!c):S((n=>("general"===e?n.delete("tab"):n.set("tab",e),n)))},sx:{borderRight:1,height:"100%",borderColor:"divider"}})}),(0,J.jsx)(u.ZP,{item:!0,sm:17,md:19,children:(0,J.jsx)(m.Z,{style:{minHeight:"66vh",height:"100%",position:"relative",overflow:"hidden"},children:P})})]})})}lt.propTypes={blocklet:s().object.isRequired,onUpdate:s().func},lt.defaultProps={onUpdate:()=>{}};const st=a.Z.div(ot||(ot=(0,i.Z)(["\n .MuiTab-root {\n text-align: left;\n align-items: flex-start;\n font-weight: normal;\n }\n .Mui-selected {\n font-weight: bold;\n }\n"])))},78410:(e,n,t)=>{t.d(n,{Z:()=>m});var i=t(5057),o=t(86229),a=t(28726),l=t(44846),s=t(68420),r=t(14491),c=t(58238),d=t(70461),p=t(96266);function m(e){let{teamDid:n,size:t="small",...m}=e;const{t:u}=(0,s.PE)(),{api:h}=(0,c.h6)(),[f,g]=(0,i.useState)(!1),[x,b]=(0,i.useState)(null),Z={title:u("blocklet.config.clearCache.title"),description:u("blocklet.config.clearCache.description"),confirm:u("common.confirm"),cancel:u("common.cancel"),onConfirm:async()=>{try{var e;g(!0);const t=await h.clearCache({input:{teamDid:n}});o.Z.success(u("blocklet.config.clearCache.success",{count:(null===(e=t.removed)||void 0===e?void 0:e.length)||0}))}catch(t){o.Z.error((0,r.Z)(t))}finally{g(!1),b(null)}},onCancel:()=>{g(!1),b(null)}};return(0,p.jsxs)("div",{...m,children:[(0,p.jsxs)(a.Z,{onClick:()=>b(Z),color:"error",variant:"outlined",size:t,children:[f?(0,p.jsx)(l.Z,{size:16,style:{marginRight:5}}):null,u("blocklet.config.clearCache.action")]}),x&&(0,p.jsx)(d.Z,{title:x.title,description:x.description,confirm:x.confirm,cancel:x.cancel,onConfirm:x.onConfirm,onCancel:x.onCancel})]})}},50185:(e,n,t)=>{t.d(n,{Z:()=>c});var i=t(5057),o=t(55898),a=t.n(o),l=t(12937),s=t(68420),r=t(96266);function c(e){let{children:n,...t}=e;const{t:o}=(0,i.useContext)(s.RD);return(0,r.jsx)(l.Z,{tip:o("common.copyTip"),copiedTip:o("common.copiedTip"),...t,children:n})}c.propTypes={children:a().any.isRequired}},28641:(e,n,t)=>{t.d(n,{Z:()=>x});var i=t(5057),o=t(55898),a=t.n(o),l=t(39948),s=t(47020),r=t(44846),c=t(13727),d=t(56184),p=t(67680),m=t(35406),u=t(11875),h=t(95890),f=t(96266);const g=(e,n,t)=>null===e&&n&&t?"******":e?n?"******":e:"";function x(e){let{label:n,disabled:t,required:o,initialValue:a,onChange:x,placeholder:b,style:Z,onSubmit:j,secure:v,triggers:y,formatterBeforeSubmit:k,...C}=e;const[w,S]=(0,i.useState)(!1),[L,E]=(0,i.useState)(!1),[P,_]=(0,i.useState)(v&&"__encrypted__"===a?null:a),[A,T]=(0,i.useState)(P),N=async()=>{E(!0);try{if(!1===await j(A))T(P);else{let e=A;"function"===typeof k&&(e=k(A)),T(e),_(e)}}catch(e){T(P)}finally{E(!1),S(!1)}},R=w?(0,f.jsx)(s.Z,{style:{flex:1},fullWidth:!0,value:A,onChange:e=>{var n;n=e.target.value,T(n),x(n)},autoFocus:!0,size:"small",variant:"outlined",placeholder:b,onKeyDown:e=>{"Enter"===e.key&&N()},disabled:t,type:v?"password":"text",...C}):(0,f.jsx)(l.Z,{px:1,className:"form-item-input slot",style:{whiteSpace:"pre-wrap"},children:g(A,v,a)});return(0,f.jsx)(u.Z,{className:"form",style:Z,children:(0,f.jsxs)(l.Z,{className:"form-item",children:[(0,f.jsxs)(l.Z,{className:"form-item-label",children:[n,o&&(0,f.jsx)(m.Z,{})]}),(0,f.jsxs)(l.Z,{className:"form-item-body",children:[(0,f.jsx)(l.Z,{className:"form-item-input",children:R}),(0,f.jsx)(l.Z,{className:"form-item-action",children:w?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(p.Z,{"data-cy":"schema-form-item-confirm",onClick:N,disabled:t||L,size:"large",children:L?(0,f.jsx)(r.Z,{size:24}):(0,f.jsx)(d.Z,{})}),(0,f.jsx)(p.Z,{"data-cy":"schema-form-item-cancel",onClick:()=>{T(P),S(!1)},disabled:t||L,size:"large",children:(0,f.jsx)(c.default,{})})]}):(0,f.jsx)(h.Z,{triggers:y,onEnterEdit:()=>S(!0),disabled:t})})]})]})})}x.propTypes={style:a().object,onSubmit:a().func,onChange:a().func,label:a().string,initialValue:a().string,placeholder:a().string,required:a().bool,disabled:a().bool,secure:a().bool,triggers:a().array,formatterBeforeSubmit:a().func},x.defaultProps={style:{},onSubmit:()=>{},onChange:()=>{},label:"",initialValue:"",placeholder:"",required:!1,disabled:!1,secure:!1,triggers:[],formatterBeforeSubmit:null}},11875:(e,n,t)=>{t.d(n,{Z:()=>s});var i,o=t(71171),a=t(33518),l=t(39948);const s=(0,a.Z)(l.Z)(i||(i=(0,o.Z)(["\n width: 100%;\n flex-grow: 1;\n overflow-y: auto;\n "," {\n width: 100%;\n flex-shrink: 0;\n padding: 0 24px;\n transform: translate(0, 0);\n /* max-height: 60vh; */\n }\n\n .form-item {\n width: 100%;\n margin-bottom: 24px;\n position: relative;\n "," {\n flex-wrap: wrap;\n justify-content: space-between;\n width: 100%;\n flex-shrink: 0;\n }\n }\n\n .form-item-body {\n display: flex;\n align-items: center;\n width: 100%;\n margin-top: 4px;\n }\n\n .form-item-label {\n line-height: 1.2;\n font-size: 14px;\n color: #888;\n font-weight: bold;\n\n "," {\n text-align: left;\n width: auto;\n flex-grow: 1;\n }\n }\n\n .form-item-input {\n flex-grow: 1;\n overflow: hidden;\n white-space: nowrap;\n text-overflow: ellipsis;\n\n &.slot {\n height: 40px;\n line-height: 40px;\n background: #f8f8f8;\n font-size: 16px;\n\n .MuiChip-root {\n margin-top: -4px;\n }\n }\n\n .MuiSelect-select {\n padding: 8px;\n }\n }\n\n .form-item-action {\n // width: 100px;\n text-align: left;\n margin-left: 12px;\n flex-shrink: 0;\n "," {\n width: auto;\n margin-left: 0px;\n }\n .MuiIconButton-root {\n padding: 8px;\n svg {\n fill: #888;\n }\n &.Mui-disabled {\n opacity: 0.4;\n }\n }\n }\n"])),(e=>e.theme.breakpoints.down("md")),(e=>e.theme.breakpoints.down("md")),(e=>e.theme.breakpoints.down("md")),(e=>e.theme.breakpoints.down("md")))},95890:(e,n,t)=>{t.d(n,{Z:()=>x});var i=t(5057),o=t(55898),a=t.n(o),l=t(24558),s=t(67680),r=t(56556),c=t(49127),d=t(49390),p=t(37200),m=t(25228),u=t(24202),h=t(74490),f=t(1733),g=t(96266);function x(e){let{triggers:n,onEnterEdit:t,disabled:o}=e;const a=i.useRef(null),[x,b]=i.useState(!1);return 0===n.length?(0,g.jsx)(s.Z,{"data-cy":"schema-form-item-edit",onClick:t,disabled:o,size:"large",children:(0,g.jsx)(l.Z,{})}):(0,g.jsxs)(g.Fragment,{children:[(0,g.jsxs)(c.Z,{variant:"outlined",ref:a,"aria-label":"split button",children:[(0,g.jsx)(r.Z,{"data-cy":"schema-form-item-edit",onClick:t,disabled:o,size:"large",children:(0,g.jsx)(l.Z,{})}),(0,g.jsx)(r.Z,{size:"small","aria-controls":x?"split-button-menu":void 0,"aria-expanded":x?"true":void 0,onClick:()=>{b((e=>!e))},children:(0,g.jsx)(d.Z,{})})]}),(0,g.jsx)(u.Z,{sx:{zIndex:9999},open:x,anchorEl:a.current,role:void 0,placement:"bottom-end",children:(0,g.jsx)(m.Z,{children:(0,g.jsx)(p.d,{onClickAway:e=>{a.current&&a.current.contains(e.target)||b(!1)},children:(0,g.jsx)(f.Z,{id:"split-button-menu",autoFocusItem:!0,children:n.map((e=>(0,g.jsx)(h.Z,{onClick:()=>{return n=e.handler,b(!1),void n();var n},children:e.title},e.key)))})})})})]})}x.propTypes={triggers:a().arrayOf(a().shape({key:a().string.isRequired,title:a().string.isRequired,handler:a().func.isRequired})),onEnterEdit:a().func.isRequired,disabled:a().bool.isRequired},x.defaultProps={triggers:[]}},35406:(e,n,t)=>{t.d(n,{Z:()=>a});var i,o=t(71171);const a=t(33518).Z.span(i||(i=(0,o.Z)(["\n color: ",";\n &::before {\n content: '*';\n }\n"])),(e=>e.theme.palette.error.main))},54063:(e,n,t)=>{t.d(n,{C:()=>i});const i="true"===localStorage.getItem("enableDebug")}}]);