@abtnode/blocklet-services 1.17.4-beta-20251204-152224-243ff54f → 1.17.4-beta-20251206-081442-6f622450

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (123) hide show
  1. package/dist/assets/{access-control-DOpkbifA.js → access-control-B--RR-vm.js} +1 -1
  2. package/dist/assets/{add-component-core-wpc1J2BH.js → add-component-core-CbHQ3LY3.js} +1 -1
  3. package/dist/assets/{add-resource-CslAO771.js → add-resource-xrpuZv6x.js} +1 -1
  4. package/dist/assets/{addon-DdNYGDp4.js → addon-Dd6xL7zL.js} +1 -1
  5. package/dist/assets/{advanced-QWXBTgpB.js → advanced-1IEcQ4BY.js} +1 -1
  6. package/dist/assets/{aigne-DoudzB_0.js → aigne-D8qB8XI2.js} +1 -1
  7. package/dist/assets/{appearance-C--T1yEy.js → appearance-s1XHOcN5.js} +1 -1
  8. package/dist/assets/{arrow-down.svg-BE-0knfW.js → arrow-down.svg-DS2CM9yc.js} +1 -1
  9. package/dist/assets/{audit-logs-CBGJi3D2.js → audit-logs-BiI8AcP1.js} +1 -1
  10. package/dist/assets/{authorize-QdLwmrZR.js → authorize-By9fI2Mn.js} +1 -1
  11. package/dist/assets/{bind-account-D5vP44eh.js → bind-account-BuCiE77m.js} +1 -1
  12. package/dist/assets/{branding-_1kxBl_k.js → branding-B-_5M7AA.js} +1 -1
  13. package/dist/assets/{branding-De5qPtGR.js → branding-BkL7Vr9B.js} +1 -1
  14. package/dist/assets/{branding-B0sUWGQz.js → branding-KF4dojTk.js} +1 -1
  15. package/dist/assets/{bundle-avatar-32N3x3xU.js → bundle-avatar-B6BCKAZI.js} +1 -1
  16. package/dist/assets/{complete-Dow8rsOd.js → complete-DeLBg2wU.js} +1 -1
  17. package/dist/assets/{component-BAz0O6p3.js → component-toAzqGbn.js} +2 -2
  18. package/dist/assets/{config-CpjVTk_0.js → config-DFGwMi3j.js} +1 -1
  19. package/dist/assets/{config-S1ErpcbM.js → config-Dz_9pP3o.js} +1 -1
  20. package/dist/assets/{config-CzKzlfrL.js → config-NQEwUL-b.js} +1 -1
  21. package/dist/assets/{config-navigation-CDLoKHDM.js → config-navigation-CXnHO78b.js} +2 -2
  22. package/dist/assets/{config-space-BywO8K6k.js → config-space-D3N5gAYj.js} +1 -1
  23. package/dist/assets/{confirm-CsXep4ZX.js → confirm-B8poMcDB.js} +1 -1
  24. package/dist/assets/{connect-Dg3BjAlC.js → connect-ByBk3Ykg.js} +1 -1
  25. package/dist/assets/{connect-BVziqmk-.js → connect-DWbEMKR2.js} +1 -1
  26. package/dist/assets/{connect-to-DvsUYNJv.js → connect-to-loiyl2FX.js} +1 -1
  27. package/dist/assets/{dashboard-CL6mI9qw.js → dashboard-ZkYlBsz9.js} +2 -2
  28. package/dist/assets/{delete-confirm-BSzvSp8_.js → delete-confirm-CP7dMVbK.js} +1 -1
  29. package/dist/assets/{domain-CNIwNykZ.js → domain-aJrfyaFq.js} +1 -1
  30. package/dist/assets/{domain-action-card-BWxruxm4.js → domain-action-card-T3DMiJ6y.js} +1 -1
  31. package/dist/assets/{domains-CYSnteZ-.js → domains-BPVkMJUk.js} +1 -1
  32. package/dist/assets/{email-BUE0xhg8.js → email-DpDZQx2o.js} +1 -1
  33. package/dist/assets/engine-B4EBuR9s.js +1 -0
  34. package/dist/assets/{exchange-passport-B_YUy8xg.js → exchange-passport-DEX7Vnd2.js} +1 -1
  35. package/dist/assets/{form-C3lQx0_f.js → form-CZk7gGF5.js} +1 -1
  36. package/dist/assets/{fuel-8vtXn14o.js → fuel-D7bh8uqP.js} +1 -1
  37. package/dist/assets/{gen-access-key-Cv0mVir2.js → gen-access-key-DzPkfBc9.js} +1 -1
  38. package/dist/assets/{gen-simple-access-key-CG7rkGCK.js → gen-simple-access-key-CQ9qw4jw.js} +1 -1
  39. package/dist/assets/{get-safe-url-DB8WYPm8.js → get-safe-url-DqysS0i0.js} +1 -1
  40. package/dist/assets/{home-Da9sD5LZ.js → home-DEfq8uA_.js} +1 -1
  41. package/dist/assets/{iframe-BOu2WQ8Y.js → iframe-CsQprVNt.js} +1 -1
  42. package/dist/assets/{index-BO-5QIwf.js → index-B-HAZ9hX.js} +1 -1
  43. package/dist/assets/{index-d0ayyNAl.js → index-B40Ot_fG.js} +3 -3
  44. package/dist/assets/{index-DSbS9vii.js → index-BCNnxNjx.js} +1 -1
  45. package/dist/assets/{index-CVclk1-n.js → index-BFLLNw1f.js} +1 -1
  46. package/dist/assets/{index-Cmd4UiOo.js → index-BIbviVFd.js} +1 -1
  47. package/dist/assets/{index-DdXkI8FK.js → index-BWTZc_vF.js} +1 -1
  48. package/dist/assets/{index-C5-jy29d.js → index-BYlDintX.js} +1 -1
  49. package/dist/assets/{index-z0V_qaSH.js → index-Bkbb52cW.js} +1 -1
  50. package/dist/assets/{index-9EeZkpuz.js → index-CJfAqgBx.js} +1 -1
  51. package/dist/assets/{index-DkaI7B4e.js → index-CTf9yUdG.js} +1 -1
  52. package/dist/assets/{index-BHyRI_gV.js → index-ChvYynmY.js} +1 -1
  53. package/dist/assets/{index-ByefI9hC.js → index-D-h8rR5H.js} +1 -1
  54. package/dist/assets/{index-BzDzFVcf.js → index-D8_V9EUB.js} +2 -2
  55. package/dist/assets/{index-CEbTLr_A.js → index-DG-EmQV7.js} +1 -1
  56. package/dist/assets/{index-CJongjoV.js → index-DICBSC-l.js} +1 -1
  57. package/dist/assets/{index-BmFAdUmE.js → index-DIrD5peJ.js} +1 -1
  58. package/dist/assets/{index-B3lpnLC0.js → index-DP1F1qui.js} +1 -1
  59. package/dist/assets/{index-CzTPIbVu.js → index-DPVF41-X.js} +1 -1
  60. package/dist/assets/{index-jPmRCtiq.js → index-DY2wgD65.js} +3 -3
  61. package/dist/assets/{index-CC4kGiqP.js → index-Dc3r2tW_.js} +1 -1
  62. package/dist/assets/{index-BpulWIIa.js → index-Dd9YRflg.js} +1 -1
  63. package/dist/assets/{index-CY8CdteZ.js → index-DlLprvFn.js} +1 -1
  64. package/dist/assets/{index-DQCqwXpW.js → index-DlWDftSS.js} +2 -2
  65. package/dist/assets/{index-DiNmJxr2.js → index-Ds2MIhg-.js} +1 -1
  66. package/dist/assets/{index-DFfEr4If.js → index-ROfvHq3O.js} +1 -1
  67. package/dist/assets/{index-o-_irE6S.js → index-VviNsFaG.js} +1 -1
  68. package/dist/assets/{invitation-Dr0R_Zm3.js → invitation-Bc44mbuq.js} +1 -1
  69. package/dist/assets/{invitations-DgB-ff90.js → invitations-BEDVQ-Hf.js} +1 -1
  70. package/dist/assets/{invite-DM8gXHE_.js → invite-BHzE7oqO.js} +1 -1
  71. package/dist/assets/{isURL-CTWDUgGm.js → isURL-C1rexYxN.js} +1 -1
  72. package/dist/assets/{issue-passport-5xsfQh4x.js → issue-passport-de5WFyKh.js} +1 -1
  73. package/dist/assets/{item-B7J3-doM.js → item-CkQtfUug.js} +1 -1
  74. package/dist/assets/{landing-page-D5rNUC4m.js → landing-page-YRQZx_TA.js} +1 -1
  75. package/dist/assets/{layout-Dqc1Rw-q.js → layout-PANci1G8.js} +1 -1
  76. package/dist/assets/{list-uwVz32FG.js → list-B1fwLddk.js} +1 -1
  77. package/dist/assets/{list-Dm7-Jiww.js → list-D73zz7M4.js} +1 -1
  78. package/dist/assets/{localization-ByyQzA4g.js → localization-DrupLSfg.js} +1 -1
  79. package/dist/assets/{log-DmRGsyT9.js → log-D7d73mBq.js} +1 -1
  80. package/dist/assets/{login-DVxbUkmV.js → login-BWInW269.js} +1 -1
  81. package/dist/assets/{login-oauth-callback-D3NWzIdd.js → login-oauth-callback-C76PLkco.js} +1 -1
  82. package/dist/assets/{logo-uploader-Bs_7E0-m.js → logo-uploader-DY97Qerr.js} +1 -1
  83. package/dist/assets/{lost-passport-DR_9dtm9.js → lost-passport-XvA9c4-q.js} +1 -1
  84. package/dist/assets/{open-window-n4P49X8a.js → open-window-D5S3rUHq.js} +1 -1
  85. package/dist/assets/{over-due-invoice-payment-C-ZuUAsL.js → over-due-invoice-payment-BfrNEMR8.js} +1 -1
  86. package/dist/assets/{overview-Tdx-8ilS.js → overview-o8mZ0F2z.js} +1 -1
  87. package/dist/assets/{passport-DnUeoVIR.js → passport-YH_G5MTs.js} +1 -1
  88. package/dist/assets/{passport-item-DAeIvzgs.js → passport-item-BoSTQBY8.js} +1 -1
  89. package/dist/assets/{permission-iIDMQlq_.js → permission-D8tLXhxc.js} +1 -1
  90. package/dist/assets/{preferences-RXCdhC2X.js → preferences-CYpeJnk0.js} +1 -1
  91. package/dist/assets/{profile-embed-xkS3CrGD.js → profile-embed-yyBq-6RJ.js} +1 -1
  92. package/dist/assets/{publish-resource-CcexZ4v9.js → publish-resource-BfKebeU1.js} +1 -1
  93. package/dist/assets/{runtime-DeZdhum6.js → runtime-6xHvA-Pc.js} +1 -1
  94. package/dist/assets/sdk-pKOkxK_z.js +1 -0
  95. package/dist/assets/{security-C6PwatSL.js → security-zwwJeC1a.js} +1 -1
  96. package/dist/assets/{session-L__eR8rN.js → session-f4MooMkP.js} +1 -1
  97. package/dist/assets/{setup-C6HhC4jt.js → setup-B3RL8SLi.js} +1 -1
  98. package/dist/assets/{simple-select-CxoXsQVr.js → simple-select-CwQixF2I.js} +1 -1
  99. package/dist/assets/{spaces-24WmguiI.js → spaces-Cgv_XshJ.js} +1 -1
  100. package/dist/assets/{start-CEgdy1zB.js → start-DHLF7IZ_.js} +1 -1
  101. package/dist/assets/{starting-progress-BoRrvgWe.js → starting-progress-BpvLQZab.js} +1 -1
  102. package/dist/assets/{status-viNRhemG.js → status-DMr8vsBX.js} +1 -1
  103. package/dist/assets/{step-actions-C_mNllFC.js → step-actions-D5Cu9stE.js} +1 -1
  104. package/dist/assets/{studio-CH0XVaW0.js → studio-DaYihdce.js} +1 -1
  105. package/dist/assets/{team-Caq5y5Xs.js → team-DP9eK2IU.js} +1 -1
  106. package/dist/assets/{traffic-KlkugfEB.js → traffic-BNaBsch3.js} +1 -1
  107. package/dist/assets/{transfer-CXj22i68.js → transfer-D2jin5px.js} +1 -1
  108. package/dist/assets/{unsubscribe-Bm4Jw2Kh.js → unsubscribe-DMDzpquZ.js} +1 -1
  109. package/dist/assets/{use-app-logo-C_3MNDVC.js → use-app-logo-D5-5iGIj.js} +1 -1
  110. package/dist/assets/{user-center-eZZBxCnH.js → user-center-CuY8RA2W.js} +2 -2
  111. package/dist/assets/{user-follower-udSlTR0u.js → user-follower-DFhaINQH.js} +1 -1
  112. package/dist/assets/{util-BQfBCQq1.js → util-lUirhe3W.js} +1 -1
  113. package/dist/assets/{util-9a6OMNK7.js → util-t3irFmx-.js} +1 -1
  114. package/dist/assets/{wait-connect-D-anNiug.js → wait-connect-DEq0_d-q.js} +1 -1
  115. package/dist/assets/{wizard-DnHSYuTP.js → wizard-D-ebFxOY.js} +1 -1
  116. package/dist/assets/{wizard-components-C6KwiiLp.js → wizard-components-BMVfnHKJ.js} +1 -1
  117. package/dist/assets/{wrap-locale--xtBp5yb.js → wrap-locale-4DQEBpTB.js} +1 -1
  118. package/dist/assets/{zh-Djej3j0D.js → zh-C6yisjDZ.js} +1 -1
  119. package/dist/index.html +1 -1
  120. package/dist/service-worker.js +1 -1
  121. package/package.json +23 -23
  122. package/dist/assets/engine-D_YTKCbf.js +0 -1
  123. package/dist/assets/sdk-DxKHN0C9.js +0 -1
@@ -1,5 +1,5 @@
1
1
  const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=[window.__toCdnUrl("assets/vendor-ux-DYcPPYq2.css"),window.__toCdnUrl("assets/index-DrVXX4fX.css"),window.__toCdnUrl("assets/index-B5LvOF-F.css")])))=>i.map(i=>d[i]);
2
- import{r as k,i as It,j as rt,L as we,g as xo,k as qs,l as Ns,m as bt}from"./vendor-react-CUXIiAnY.js";import{J as Oe,j as e,ak as a,b4 as Et,W as n,am as xe,I as ce,dw as _s,dx as Ws,bb as go,cb as nt,T as $,dy as Os,a_ as zs,s as ko,cx as jo,dz as Bs,cO as Vs,Y as lt,at as ve,av as Us,dA as Ms,a5 as He,aX as it,bd as Pt,c7 as Fs,bh as Hs,b6 as Me,cW as Js,bi as et,Q as G,a6 as Se,bE as Xs,O as yo,K as wo,P as Lt,ai as vo,o as Co,M as be,a3 as Gs,bC as Ro,$ as So,bw as Ks,A as Xe,aJ as Ys,R as To,z as ne,b1 as Re,dB as Xt,bX as tt,dC as Do,V as Io,S as At,aP as Eo,bD as Zs,D as Po,cr as Qs,aQ as er,aR as tr,cs as or,ct as sr,bF as Lo,aq as rr,dD as nr,a1 as Ao,a0 as ot,bj as Gt,bP as lr,bQ as ir,dE as cr,dF as ar,bc as vt,y as dr,F as ur,bq as pr,br as ft}from"./vendor-mui-core-BPQ6AEW_.js";import{c as F,_ as ke,ac as De,v as hr,Y as me,bO as mr,Z as br,e as Kt,bP as fr,az as Yt,b8 as xr,bx as gr,bQ as kr,bR as jr,bS as yr}from"./index-jPmRCtiq.js";import{V as X,a2 as $o,x as wr,n as Ae,Q as qo,z as No,P as vr,h as $t,H as W,q as qt,aK as Nt,U as ae,_ as _o,A as We,b as ct,j as Wo}from"./vendor-ux-r9bApERu.js";import{C as at}from"./confirm-CsXep4ZX.js";import{u as ze}from"./session-L__eR8rN.js";import{W as Ct}from"./did-address-j4poFq12.js";import{E as Ge}from"./empty-spinner-G6osPzkH.js";import{B as _t}from"./bundle-avatar-32N3x3xU.js";import{S as Te}from"./shorten-label-D6jbe4l0.js";import{L as Wt}from"./list-header-Cv_gaaAc.js";import{K as Cr,C as ue,A as Ot,D as Oo,a0 as Rr}from"./vendor-utils-BgSaqjGx.js";import{C as zo}from"./click-to-copy-BuSTGPjJ.js";import{t as Zt}from"./question-mark-circle.svg-DK9nTUDZ.js";import{l as Sr,b as Tr}from"./vendor-hooks-PN9SWiQm.js";import{u as Fe}from"./useSetState-cWrp7qoX.js";import{e as Dr}from"./engine-D_YTKCbf.js";import"./api-uGeIZn4a.js";import{T as Ir,S as Er}from"./vendor-mui-x-CWNb8fsW.js";import{D as Qt,C as eo,P as to}from"./react-beautiful-dnd.esm-DFHKVO-K.js";import{u as Bo,c as Pr,w as Lr,a as Ar,b as $r}from"./wait-connect-D-anNiug.js";import{f as ge}from"./index-DBs9Ljax.js";import{c as qr,A as Vo,S as Nr,U as _r,r as Wr}from"./item-B7J3-doM.js";import{D as Or}from"./delete-confirm-BSzvSp8_.js";import{g as Uo}from"./get-safe-url-DB8WYPm8.js";import{u as Le}from"./index-B7Hwfql4.js";import{M as zr}from"./index-Dx6HKVtJ.js";import{r as Br}from"./index-Dy3yCmIK.js";import"./vendor-arcblock-D8WYBDYe.js";import"./lottie-web-4koyQiv_.js";import"./raf-schd.esm-JNUhxcps.js";function zt({did:t,projectId:o,title:s,logo:r,describe:l}){const i=`${`${F.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${t}/${o}/logo/upload`}/${r}`,[d,u]=k.useState(!1),x=Oe(p=>p.breakpoints.down("md"));return e.jsxs(a,{sx:{display:"flex",flexDirection:"row",color:d?"primary.main":"grey.900",gap:1},onPointerEnter:()=>u(!0),onPointerLeave:()=>u(!1),children:[e.jsx(Et,{sx:{borderRadius:1},src:i}),e.jsxs(a,{children:[e.jsx(Te,{hiddenTip:!0,maxLength:"24",sx:{fontSize:"14px",fontWeight:"500",color:x?"primary.main":""},children:s||"/"}),e.jsx(Te,{hiddenTip:!0,maxLength:"58",sx:{fontSize:"12px",color:x||d?"primary.main":"grey.700"},children:l||"/"})]})]})}zt.propTypes={projectId:n.string.isRequired,did:n.string.isRequired,title:n.string.isRequired,logo:n.string.isRequired,describe:n.string.isRequired};function Mo({initUrl:t=null}){const o=It(),s=t?.searchParams.get("tenantScope")||"",{t:r,locale:l}=X(),{api:c}=ke(),{api:i}=ze(),[d,u]=k.useState(!0),{blocklet:x}=De(),[p,m]=k.useState(null),[f,b]=k.useState(!1),h=Oe(E=>E.breakpoints.down("xl")),j=Oe(E=>E.breakpoints.down("md")),{componentDid:v=""}=rt(),[g,C]=k.useState(null),D=`publish-${x.meta.did}`,R=$o(D),[y,T]=k.useState({searchText:R.searchText||"",pageSize:R.rowsPerPage||10,page:1}),O=()=>{c.getProjects({input:{did:x.meta.did,componentDid:v,tenantScope:s}}).then(E=>{const I=E?.projects||[];u(!1),C(I)}).catch(E=>{u(!1),W.error(E.message)})},N=()=>{o(`${F.UNOWNED_DID}/create/none/0.0.0`,{replace:!0})},z=E=>{m(E)},K=()=>{u(!1),b(!0)},P=()=>{b(!1),m(null)},A=E=>{W.error(E.message),b(!1),m(null)},w=E=>{if(!E?.deleted){W.error("Delete project failed");return}O(),b(!1),m(null)};k.useEffect(()=>{O()},[]);const S=k.useMemo(()=>{if(!y.searchText)return g;let E=y.searchText?.trim();return E?(E=wr.toAddress(E).toLocaleLowerCase(),g.filter(I=>I.blockletTitle.toLowerCase().includes(E)||I.blockletDid.toLowerCase().includes(E))):g},[g,y.searchText]);if(!g&&d)return e.jsx(a,{sx:{display:"flex",justifyContent:"center",alignItems:"center",marginTop:"40px"},children:e.jsx(Ge,{})});if(!g)return null;if(!g.length)return e.jsxs(a,{sx:{display:"flex",flexDirection:"column",alignItems:"center",pt:10},children:[e.jsx(a,{sx:{fontSize:20,fontWeight:"bold",mb:3},children:r("blocklet.publish.blockletEmptyTip")}),e.jsx(a,{sx:{fontSize:14,color:"text.secondary",mb:3},children:r("blocklet.publish.createBlockletTip")}),e.jsx(Ae,{onClick:N,variant:"contained",children:r("blocklet.publish.createBlocklet")})]});const Z=[{label:"Blocklet",name:"blockletTitle",minWidth:160,options:{customBodyRenderLite:E=>{const I=g[E];return e.jsx(we,{to:`${I.id}`,children:e.jsx(zt,{did:x.meta.did,projectId:I.id,logo:I.blockletLogo,title:I.blockletTitle,describe:I.blockletDescription})})}}},{label:"Version",name:"blockletVersion",options:{searchable:!1,customBodyRender:E=>E?e.jsx(qo,{type:"success",children:E}):""}},{label:"DID",name:"blockletDid",options:{customBodyRender:E=>E?e.jsx(Ct,{size:14,compact:!0,responsive:!1,did:E}):null}},h||v?null:{label:r("common.createdBy"),name:"createdBy",options:{customBodyRender:E=>E?e.jsx(Ct,{onClick:()=>{o(`${F.WELLKNOWN_SERVICE_PATH_PREFIX}/admin/members?did=${E}`)},style:{cursor:"pointer"},size:14,compact:!0,copyable:!1,showQrcode:!1,responsive:!1,did:E}):null}},h||v?null:{label:r("common.scope"),name:"componentDid",options:{customBodyRender:E=>{const I=(x.children||[]).find(V=>V.meta.did===E);return I?e.jsxs(a,{sx:{display:"flex",alignItems:"center",justifyContent:"flex-start"},children:[e.jsx(_t,{size:14,blocklet:I,ancestors:[x]}),e.jsx(a,{sx:{ml:.5,color:"text.primary",fontSize:14},children:I.meta.title})]},E):""}}},h||s?null:{label:r("blocklet.publish.tenantScope"),name:"tenantScope",options:{customBodyRender:E=>e.jsx(a,{sx:{ml:.5,color:"text.primary",fontSize:14},children:e.jsx(Te,{children:E})})}},{label:r("common.updatedAt"),name:"updatedAt",options:{searchable:!1,customBodyRender:E=>e.jsx(No,{value:Number(E),locale:l})}},{label:r("common.actions"),name:"actions",options:{searchable:!1,customBodyRenderLite:E=>{const I=g[E];return e.jsxs(a,{sx:{display:"flex"},children:[e.jsx(we,{to:`${I.id}/new-release/none/${I.lastReleaseId}`,children:e.jsx(xe,{title:r("blocklet.publish.createRelease"),placement:"top",children:e.jsx(ce,{color:"primary","aria-label":"create",children:e.jsx(_s,{style:{fontSize:18}})})})}),!!I.lastReleaseId&&e.jsx(xe,{title:r("blocklet.publish.viewLastRelease",{name:I.blockletTitle}),placement:"top",children:e.jsx(ce,{color:"secondary","aria-label":"create",children:e.jsx(we,{style:{display:"flex"},to:`${I.id}/view/${I.lastReleaseId}/${I.blockletVersion}`,children:e.jsx(Ws,{sx:{fontSize:18}})})})}),e.jsx(xe,{title:r("blocklet.publish.delete",{name:I.blockletTitle}),placement:"top",children:e.jsx(ce,{color:"primary","aria-label":"delete",onClick:()=>z(I),children:e.jsx(go,{sx:{fontSize:18}})})})]})}}}].filter(Boolean),H=({page:E,rowsPerPage:I,searchText:V})=>{y.pageSize!==I?T(U=>({...U,searchText:"",pageSize:I,page:1})):y.page!==E+1?T(U=>({...U,searchText:"",page:E+1})):y.searchText!==V&&T(U=>({...U,searchText:V,page:1}))},Q=f?e.jsx(hr,{open:!0,popup:!0,onClose:P,action:"check-has-project-id",locale:l,checkFn:i.get,saveConnect:!1,forceConnected:!1,checkTimeout:5*60*1e3,onSuccess:w,onError:A,extraParams:{projectId:p.id,did:x.meta.did,name:p.blockletTitle},messages:{title:r("blocklet.publish.deleteProject.title",{name:p.blockletTitle}),scan:r("blocklet.publish.deleteProject.scan",{name:p.blockletTitle}),confirm:r("blocklet.publish.deleteProject.confirm"),success:r("blocklet.publish.deleteProject.success")}}):null;return e.jsxs(Vr,{children:[e.jsx(Wt,{sx:{mb:2},left:e.jsxs(a,{sx:{display:"flex",flexDirection:"row",alignItems:"center"},children:[e.jsxs($,{variant:"h4",children:[r("common.blocklets")," (",S.length,")"]}),e.jsx(xe,{title:r("blocklet.publish.createBlockletTip"),arrow:!0,placement:"right",children:e.jsx(Os,{sx:{opacity:.6,fontSize:"1.1em",ml:1}})})]}),actions:e.jsxs(e.Fragment,{children:[e.jsx(vr,{options:{searchPlaceholder:r("blocklet.list.searchPlaceholder"),searchDebounceTime:600,searchAlwaysOpen:j},search:y.searchText,searchText:y.searchText,searchTextUpdate:E=>T(I=>({...I,searchText:E})),searchClose:()=>T(E=>({...E,searchText:""})),onSearchOpen:()=>{}}),e.jsxs(Ae,{onClick:N,variant:"contained",children:[e.jsx(nt,{style:{fontSize:"1.3em",marginRight:4}}),r("blocklet.publish.createBlocklet")]})]})}),e.jsx($t,{className:"main-table",locale:l,data:S,columns:Z,options:{search:!1,sort:!1,download:!1,filter:!1,print:!1,viewColumns:!1,searchAlwaysOpen:!0,rowsPerPageOptions:[10,20,50,100]},durable:D,onChange:H}),p&&e.jsx(at,{title:`${r("common.delete")} ${p.blockletTitle}`,description:r("blocklet.publish.deleteProject.description"),confirm:r("common.confirm"),onConfirm:K,onCancel:()=>m(null),children:e.jsx(a,{sx:{marginTop:2},children:[r("blocklet.publish.deleteProject.tip1"),r("blocklet.publish.deleteProject.tip2"),r("blocklet.publish.deleteProject.tip3")].map(E=>e.jsxs(a,{sx:{display:"flex",marginTop:1,flexDirection:"row",alignItems:"flex-start"},children:[e.jsx(zs,{color:"warning",sx:{marginRight:1,fontSize:20,marginTop:"2px"}}),e.jsx($,{component:"span",variant:"inherit",sx:{color:"text.secondary"},children:E})]}))})}),Q]})}const Vr=ko(a)`
2
+ import{r as k,i as It,j as rt,L as we,g as xo,k as qs,l as Ns,m as bt}from"./vendor-react-CUXIiAnY.js";import{J as Oe,j as e,ak as a,b4 as Et,W as n,am as xe,I as ce,dw as _s,dx as Ws,bb as go,cb as nt,T as $,dy as Os,a_ as zs,s as ko,cx as jo,dz as Bs,cO as Vs,Y as lt,at as ve,av as Us,dA as Ms,a5 as He,aX as it,bd as Pt,c7 as Fs,bh as Hs,b6 as Me,cW as Js,bi as et,Q as G,a6 as Se,bE as Xs,O as yo,K as wo,P as Lt,ai as vo,o as Co,M as be,a3 as Gs,bC as Ro,$ as So,bw as Ks,A as Xe,aJ as Ys,R as To,z as ne,b1 as Re,dB as Xt,bX as tt,dC as Do,V as Io,S as At,aP as Eo,bD as Zs,D as Po,cr as Qs,aQ as er,aR as tr,cs as or,ct as sr,bF as Lo,aq as rr,dD as nr,a1 as Ao,a0 as ot,bj as Gt,bP as lr,bQ as ir,dE as cr,dF as ar,bc as vt,y as dr,F as ur,bq as pr,br as ft}from"./vendor-mui-core-BPQ6AEW_.js";import{c as F,_ as ke,ac as De,v as hr,Y as me,bO as mr,Z as br,e as Kt,bP as fr,az as Yt,b8 as xr,bx as gr,bQ as kr,bR as jr,bS as yr}from"./index-DY2wgD65.js";import{V as X,a2 as $o,x as wr,n as Ae,Q as qo,z as No,P as vr,h as $t,H as W,q as qt,aK as Nt,U as ae,_ as _o,A as We,b as ct,j as Wo}from"./vendor-ux-r9bApERu.js";import{C as at}from"./confirm-B8poMcDB.js";import{u as ze}from"./session-f4MooMkP.js";import{W as Ct}from"./did-address-j4poFq12.js";import{E as Ge}from"./empty-spinner-G6osPzkH.js";import{B as _t}from"./bundle-avatar-B6BCKAZI.js";import{S as Te}from"./shorten-label-D6jbe4l0.js";import{L as Wt}from"./list-header-Cv_gaaAc.js";import{K as Cr,C as ue,A as Ot,D as Oo,a0 as Rr}from"./vendor-utils-BgSaqjGx.js";import{C as zo}from"./click-to-copy-BuSTGPjJ.js";import{t as Zt}from"./question-mark-circle.svg-DK9nTUDZ.js";import{l as Sr,b as Tr}from"./vendor-hooks-PN9SWiQm.js";import{u as Fe}from"./useSetState-cWrp7qoX.js";import{e as Dr}from"./engine-B4EBuR9s.js";import"./api-uGeIZn4a.js";import{T as Ir,S as Er}from"./vendor-mui-x-CWNb8fsW.js";import{D as Qt,C as eo,P as to}from"./react-beautiful-dnd.esm-DFHKVO-K.js";import{u as Bo,c as Pr,w as Lr,a as Ar,b as $r}from"./wait-connect-DEq0_d-q.js";import{f as ge}from"./index-DBs9Ljax.js";import{c as qr,A as Vo,S as Nr,U as _r,r as Wr}from"./item-CkQtfUug.js";import{D as Or}from"./delete-confirm-CP7dMVbK.js";import{g as Uo}from"./get-safe-url-DqysS0i0.js";import{u as Le}from"./index-B7Hwfql4.js";import{M as zr}from"./index-Dx6HKVtJ.js";import{r as Br}from"./index-Dy3yCmIK.js";import"./vendor-arcblock-D8WYBDYe.js";import"./lottie-web-4koyQiv_.js";import"./raf-schd.esm-JNUhxcps.js";function zt({did:t,projectId:o,title:s,logo:r,describe:l}){const i=`${`${F.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${t}/${o}/logo/upload`}/${r}`,[d,u]=k.useState(!1),x=Oe(p=>p.breakpoints.down("md"));return e.jsxs(a,{sx:{display:"flex",flexDirection:"row",color:d?"primary.main":"grey.900",gap:1},onPointerEnter:()=>u(!0),onPointerLeave:()=>u(!1),children:[e.jsx(Et,{sx:{borderRadius:1},src:i}),e.jsxs(a,{children:[e.jsx(Te,{hiddenTip:!0,maxLength:"24",sx:{fontSize:"14px",fontWeight:"500",color:x?"primary.main":""},children:s||"/"}),e.jsx(Te,{hiddenTip:!0,maxLength:"58",sx:{fontSize:"12px",color:x||d?"primary.main":"grey.700"},children:l||"/"})]})]})}zt.propTypes={projectId:n.string.isRequired,did:n.string.isRequired,title:n.string.isRequired,logo:n.string.isRequired,describe:n.string.isRequired};function Mo({initUrl:t=null}){const o=It(),s=t?.searchParams.get("tenantScope")||"",{t:r,locale:l}=X(),{api:c}=ke(),{api:i}=ze(),[d,u]=k.useState(!0),{blocklet:x}=De(),[p,m]=k.useState(null),[f,b]=k.useState(!1),h=Oe(E=>E.breakpoints.down("xl")),j=Oe(E=>E.breakpoints.down("md")),{componentDid:v=""}=rt(),[g,C]=k.useState(null),D=`publish-${x.meta.did}`,R=$o(D),[y,T]=k.useState({searchText:R.searchText||"",pageSize:R.rowsPerPage||10,page:1}),O=()=>{c.getProjects({input:{did:x.meta.did,componentDid:v,tenantScope:s}}).then(E=>{const I=E?.projects||[];u(!1),C(I)}).catch(E=>{u(!1),W.error(E.message)})},N=()=>{o(`${F.UNOWNED_DID}/create/none/0.0.0`,{replace:!0})},z=E=>{m(E)},K=()=>{u(!1),b(!0)},P=()=>{b(!1),m(null)},A=E=>{W.error(E.message),b(!1),m(null)},w=E=>{if(!E?.deleted){W.error("Delete project failed");return}O(),b(!1),m(null)};k.useEffect(()=>{O()},[]);const S=k.useMemo(()=>{if(!y.searchText)return g;let E=y.searchText?.trim();return E?(E=wr.toAddress(E).toLocaleLowerCase(),g.filter(I=>I.blockletTitle.toLowerCase().includes(E)||I.blockletDid.toLowerCase().includes(E))):g},[g,y.searchText]);if(!g&&d)return e.jsx(a,{sx:{display:"flex",justifyContent:"center",alignItems:"center",marginTop:"40px"},children:e.jsx(Ge,{})});if(!g)return null;if(!g.length)return e.jsxs(a,{sx:{display:"flex",flexDirection:"column",alignItems:"center",pt:10},children:[e.jsx(a,{sx:{fontSize:20,fontWeight:"bold",mb:3},children:r("blocklet.publish.blockletEmptyTip")}),e.jsx(a,{sx:{fontSize:14,color:"text.secondary",mb:3},children:r("blocklet.publish.createBlockletTip")}),e.jsx(Ae,{onClick:N,variant:"contained",children:r("blocklet.publish.createBlocklet")})]});const Z=[{label:"Blocklet",name:"blockletTitle",minWidth:160,options:{customBodyRenderLite:E=>{const I=g[E];return e.jsx(we,{to:`${I.id}`,children:e.jsx(zt,{did:x.meta.did,projectId:I.id,logo:I.blockletLogo,title:I.blockletTitle,describe:I.blockletDescription})})}}},{label:"Version",name:"blockletVersion",options:{searchable:!1,customBodyRender:E=>E?e.jsx(qo,{type:"success",children:E}):""}},{label:"DID",name:"blockletDid",options:{customBodyRender:E=>E?e.jsx(Ct,{size:14,compact:!0,responsive:!1,did:E}):null}},h||v?null:{label:r("common.createdBy"),name:"createdBy",options:{customBodyRender:E=>E?e.jsx(Ct,{onClick:()=>{o(`${F.WELLKNOWN_SERVICE_PATH_PREFIX}/admin/members?did=${E}`)},style:{cursor:"pointer"},size:14,compact:!0,copyable:!1,showQrcode:!1,responsive:!1,did:E}):null}},h||v?null:{label:r("common.scope"),name:"componentDid",options:{customBodyRender:E=>{const I=(x.children||[]).find(V=>V.meta.did===E);return I?e.jsxs(a,{sx:{display:"flex",alignItems:"center",justifyContent:"flex-start"},children:[e.jsx(_t,{size:14,blocklet:I,ancestors:[x]}),e.jsx(a,{sx:{ml:.5,color:"text.primary",fontSize:14},children:I.meta.title})]},E):""}}},h||s?null:{label:r("blocklet.publish.tenantScope"),name:"tenantScope",options:{customBodyRender:E=>e.jsx(a,{sx:{ml:.5,color:"text.primary",fontSize:14},children:e.jsx(Te,{children:E})})}},{label:r("common.updatedAt"),name:"updatedAt",options:{searchable:!1,customBodyRender:E=>e.jsx(No,{value:Number(E),locale:l})}},{label:r("common.actions"),name:"actions",options:{searchable:!1,customBodyRenderLite:E=>{const I=g[E];return e.jsxs(a,{sx:{display:"flex"},children:[e.jsx(we,{to:`${I.id}/new-release/none/${I.lastReleaseId}`,children:e.jsx(xe,{title:r("blocklet.publish.createRelease"),placement:"top",children:e.jsx(ce,{color:"primary","aria-label":"create",children:e.jsx(_s,{style:{fontSize:18}})})})}),!!I.lastReleaseId&&e.jsx(xe,{title:r("blocklet.publish.viewLastRelease",{name:I.blockletTitle}),placement:"top",children:e.jsx(ce,{color:"secondary","aria-label":"create",children:e.jsx(we,{style:{display:"flex"},to:`${I.id}/view/${I.lastReleaseId}/${I.blockletVersion}`,children:e.jsx(Ws,{sx:{fontSize:18}})})})}),e.jsx(xe,{title:r("blocklet.publish.delete",{name:I.blockletTitle}),placement:"top",children:e.jsx(ce,{color:"primary","aria-label":"delete",onClick:()=>z(I),children:e.jsx(go,{sx:{fontSize:18}})})})]})}}}].filter(Boolean),H=({page:E,rowsPerPage:I,searchText:V})=>{y.pageSize!==I?T(U=>({...U,searchText:"",pageSize:I,page:1})):y.page!==E+1?T(U=>({...U,searchText:"",page:E+1})):y.searchText!==V&&T(U=>({...U,searchText:V,page:1}))},Q=f?e.jsx(hr,{open:!0,popup:!0,onClose:P,action:"check-has-project-id",locale:l,checkFn:i.get,saveConnect:!1,forceConnected:!1,checkTimeout:5*60*1e3,onSuccess:w,onError:A,extraParams:{projectId:p.id,did:x.meta.did,name:p.blockletTitle},messages:{title:r("blocklet.publish.deleteProject.title",{name:p.blockletTitle}),scan:r("blocklet.publish.deleteProject.scan",{name:p.blockletTitle}),confirm:r("blocklet.publish.deleteProject.confirm"),success:r("blocklet.publish.deleteProject.success")}}):null;return e.jsxs(Vr,{children:[e.jsx(Wt,{sx:{mb:2},left:e.jsxs(a,{sx:{display:"flex",flexDirection:"row",alignItems:"center"},children:[e.jsxs($,{variant:"h4",children:[r("common.blocklets")," (",S.length,")"]}),e.jsx(xe,{title:r("blocklet.publish.createBlockletTip"),arrow:!0,placement:"right",children:e.jsx(Os,{sx:{opacity:.6,fontSize:"1.1em",ml:1}})})]}),actions:e.jsxs(e.Fragment,{children:[e.jsx(vr,{options:{searchPlaceholder:r("blocklet.list.searchPlaceholder"),searchDebounceTime:600,searchAlwaysOpen:j},search:y.searchText,searchText:y.searchText,searchTextUpdate:E=>T(I=>({...I,searchText:E})),searchClose:()=>T(E=>({...E,searchText:""})),onSearchOpen:()=>{}}),e.jsxs(Ae,{onClick:N,variant:"contained",children:[e.jsx(nt,{style:{fontSize:"1.3em",marginRight:4}}),r("blocklet.publish.createBlocklet")]})]})}),e.jsx($t,{className:"main-table",locale:l,data:S,columns:Z,options:{search:!1,sort:!1,download:!1,filter:!1,print:!1,viewColumns:!1,searchAlwaysOpen:!0,rowsPerPageOptions:[10,20,50,100]},durable:D,onChange:H}),p&&e.jsx(at,{title:`${r("common.delete")} ${p.blockletTitle}`,description:r("blocklet.publish.deleteProject.description"),confirm:r("common.confirm"),onConfirm:K,onCancel:()=>m(null),children:e.jsx(a,{sx:{marginTop:2},children:[r("blocklet.publish.deleteProject.tip1"),r("blocklet.publish.deleteProject.tip2"),r("blocklet.publish.deleteProject.tip3")].map(E=>e.jsxs(a,{sx:{display:"flex",marginTop:1,flexDirection:"row",alignItems:"flex-start"},children:[e.jsx(zs,{color:"warning",sx:{marginRight:1,fontSize:20,marginTop:"2px"}}),e.jsx($,{component:"span",variant:"inherit",sx:{color:"text.secondary"},children:E})]}))})}),Q]})}const Vr=ko(a)`
3
3
  ${({theme:t})=>t.breakpoints.down("md")} {
4
4
  .MuiTableRow-root {
5
5
  border-color: ${({theme:t})=>t.palette.divider};
@@ -142,7 +142,7 @@ import{r as k,i as It,j as rt,L as we,g as xo,k as qs,l as Ns,m as bt}from"./ven
142
142
  background: #fff;
143
143
  z-index: 10;
144
144
  }
145
- `,co="lastWantToConnectStoreId";function rn(t){const[o,s]=k.useState(null),{session:r}=ze(),l=k.useCallback(d=>{s(d),localStorage.setItem(co,d?.id)},[s]),c=k.useMemo(()=>{const d=localStorage.getItem(co),u=d?(t?.settings?.storeList||[]).find(p=>p.id===d):null;if(u)return u;let x=(t?.settings?.storeList||[]).find(p=>!(p.id!==F.BLOCKLET_STORE.id||p.scope&&p.scope!=="studio"&&p.scope!==r?.user?.did));return x||(x=t?.settings?.storeList?.[0]),x},[t?.settings?.storeList,r?.user?.did]);return[o||c||{},l]}const Bt=({fromBlocklet:t,nodeInfo:o,blocklet:s,userDid:r})=>{const l=t?s?.meta?.did:o?.did;let c=t?s?.settings?.storeList||[]:o?.blockletRegistryList||[];return Array.isArray(c)||(c=[]),c=c.filter(i=>i.protected||Rr(i.scope)||i.scope==="studio"||i.scope===r),{teamDid:l,storeList:c}};function ts({blocklet:t=null,store:o=null,onChangeStore:s,onClick:r,disabled:l,loading:c,componentDid:i}){const{t:d}=X(),{session:u}=ze(),{api:x,info:p,inService:m}=ke(),f=De(),[b,h]=k.useState(!1),j=k.useRef(null),[v,g]=k.useState(!1),[C,D]=k.useState(null),R=A=>{s(A),h(!1)},y=()=>{h(!b)},T=A=>{j.current&&j.current.contains(A.target)||h(!1)},O=()=>{g(!0)},N=()=>{g(!1)},z=async()=>{if(C)try{await x.deleteBlockletStore({input:{teamDid:t.meta.did,url:C.url,projectId:"",scope:C.scope||"studio"}}),await f?.actions?.refreshBlocklet()}catch(A){W.error(`Remove Blocklet Store Error: ${ge(A)}`)}finally{D(null)}},{storeList:K}=Bt({fromBlocklet:m,blocklet:t,nodeInfo:p,userDid:u?.user?.did}),P=t?.meta?.did;return e.jsxs(e.Fragment,{children:[e.jsxs(et,{disabled:l,ref:j,variant:"contained",color:"primary","aria-label":"Button group with connect store",children:[e.jsxs(G,{onClick:r,children:[c&&e.jsx(Se,{size:14,sx:{mr:.5}}),`${d("common.connect")} ${o.name||""}`]}),e.jsx(G,{size:"small","aria-controls":b?"split-button-menu":void 0,"aria-expanded":b?"true":void 0,"aria-label":"select merge strategy","aria-haspopup":"menu",onClick:y,children:e.jsx(Xs,{})})]}),e.jsx(yo,{sx:{zIndex:10},open:b,anchorEl:j.current,placement:"bottom-end",role:void 0,transition:!0,disablePortal:!0,children:({TransitionProps:A})=>e.jsx(wo,{...A,style:{transformOrigin:"center top"},children:e.jsx(Lt,{children:e.jsx(vo,{onClickAway:T,children:e.jsxs(Co,{id:"split-button-menu",autoFocusItem:!0,sx:{maxHeight:300,overflowY:"auto",zIndex:10},children:[K?.map(w=>e.jsxs(be,{selected:w.id===o?.id,sx:{height:56},onClick:()=>R(w),children:[e.jsxs(a,{children:[e.jsx(Te,{sx:{fontSize:"16px"},maxLength:24,children:w.name}),e.jsx(Te,{sx:{fontSize:"13px",opacity:.6},maxLength:30,children:w.url})]}),qr({store:w,userDid:u?.user?.did})&&e.jsx(ce,{sx:{ml:1},onClick:S=>{S.preventDefault(),S.stopPropagation(),D(w)},children:e.jsx(ae,{icon:"ic:outline-delete"})})]},w.url)),e.jsx(Gs,{}),e.jsxs(be,{onClick:O,children:[e.jsx(nt,{font:!0}),e.jsx($,{variant:"inherit",children:d("store.blockletRegistry.addRegistry")})]})]})})})})}),v&&e.jsx(Vo,{hiddenChildren:!0,open:!0,onClose:N,teamDid:P,storeList:K,scope:"studio",onAdd:f?.actions?.refreshBlocklet}),C&&e.jsx(at,{displayError:!0,title:`${d("common.delete")} ${C.name}`,description:d("blocklet.publish.deleteStoreTip",{name:C.name}),confirm:d("common.confirm"),onConfirm:z,onCancel:()=>D(null)})]})}ts.propTypes={store:n.object,blocklet:n.object,onChangeStore:n.func.isRequired,onClick:n.func.isRequired,loading:n.bool.isRequired,disabled:n.bool.isRequired,componentDid:n.string.isRequired,projectType:n.string.isRequired,getData:n.func.isRequired};const os=(t,o,s)=>{const r=`${F.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${o.meta.did}/${s}/logo/upload`,l=`${F.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${o.meta.did}/${s}/screenshot/upload`,c=t?.blockletLogo?`${r}/${t.blockletLogo}`:`${F.WELLKNOWN_SERVICE_PATH_PREFIX}/static/images/logo.png`,i=(t?.blockletScreenshots||[]).filter(Boolean).map(d=>`${l}/${d}`);return{logoUrl:c,screenshotUrls:i,uploadLogoPrefix:r,uploadScreenshotPrefix:l}},nn=t=>{const o=t.includes("youtube.com")||t.includes("youtu.be"),s=t.includes("vimeo.com");return o||s};function Vt({url:t,style:o={},controls:s=1,modestbranding:r=1}){const{t:l}=X(),c=t.includes("youtube.com")||t.includes("youtu.be"),i=t.includes("vimeo.com");if(c){const d=t.split("v=")[1]?.split("&")[0]||t.split("/").pop();return e.jsx("div",{style:{position:"relative",width:"100%",paddingTop:"56.25%",pointerEvents:o?.pointerEvents||"auto"},children:e.jsx("iframe",{src:`https://www.youtube.com/embed/${d}?modestbranding=${r}&controls=${s}&rel=0`,title:"YouTube video player",style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",border:"none",...o},allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0})})}if(i){const d=t.split("/").pop();return e.jsx("div",{style:{position:"relative",width:"100%",paddingTop:"56.25%",pointerEvents:o.pointerEvents||"auto"},children:e.jsx("iframe",{src:`https://player.vimeo.com/video/${d}`,title:"Vimeo video player",style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",border:"none",...o},allow:"autoplay; fullscreen; picture-in-picture",allowFullScreen:!0})})}return e.jsx(a,{style:{position:"relative",width:"100%",paddingTop:"56.25%"},children:e.jsxs(a,{style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",border:"none",backgroundColor:"rgba(0, 0, 0, 0.04)",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",...o},allow:"autoplay; fullscreen; picture-in-picture",allowFullScreen:!0,children:[e.jsx(ae,{icon:"carbon:video-off",style:{fontSize:40,marginBottom:"10px",opacity:.5}}),e.jsx($,{variant:"body1",sx:{opacity:.5},children:l("studio.videoDialogNoSrc")})]})})}Vt.propTypes={url:n.string.isRequired,style:n.object,controls:n.number,modestbranding:n.number};function ss({setParams:t,onClose:o,params:s}){const{t:r}=X(),[l,c]=k.useState(""),i=l&&s.blockletVideos.includes(l),d=nn(l),u=()=>{t(x=>{const p=[...x.blockletVideos];return p.push(l),{...x,blockletVideos:p}}),o()};return e.jsxs(lt,{open:!0,fullWidth:!0,maxWidth:"sm",children:[e.jsx(Ro,{children:r("studio.videoDialogTitle")}),e.jsxs(So,{children:[e.jsx(Ks,{fullWidth:!0,value:l,onChange:x=>c(x.target.value),placeholder:r("studio.videoInputLabel"),endAdornment:l?e.jsx(Xe,{position:"end",children:e.jsx(ce,{onClick:()=>c(""),children:e.jsx(Ys,{})})}):null,error:i}),i&&e.jsx($,{variant:"body2",color:"error",children:r("studio.duplicateVideo")}),e.jsx(Vt,{url:l,style:{marginTop:"20px",borderRadius:"4px"}})]}),e.jsxs(To,{children:[e.jsx(G,{onClick:()=>o(),children:r("studio.cancel")}),e.jsx(G,{disabled:!d||i,onClick:u,children:r("studio.confirm")})]})]})}ss.propTypes={onClose:n.func.isRequired,params:n.object.isRequired,setParams:n.func.isRequired};function Rt({errors:t,storeList:o,...s}){const{t:r}=X();return e.jsxs(a,{...s,sx:[{color:"warning.main",fontSize:"14px",border:"1px solid rgba(214, 164, 64, 0.34)",borderRadius:"4px",py:2,px:1.5,position:"relative"},...Array.isArray(s.sx)?s.sx:[s.sx]],children:[e.jsx($,{variant:"caption",sx:{fontWeight:"bold",position:"absolute",top:-10,left:12,backgroundColor:"white",px:1,width:"fit-content"},children:r("blocklet.publish.storeRule.warning")}),t&&Object.entries(t).map(([l,c])=>{const i=Object.values(c),d=o.find(u=>u.url===l);return i.length>0&&e.jsxs(a,{children:[e.jsx(xe,{title:l,children:e.jsx(a,{component:"span",sx:{cursor:"pointer"},children:d.name})}),i.map(u=>e.jsx(a,{component:"li",sx:{ml:2,wordBreak:!0},children:u},u))]},l)})]})}Rt.propTypes={errors:n.object.isRequired,storeList:n.array.isRequired};const ao=k.lazy(()=>_o(()=>import("./index-BzDzFVcf.js"),__vite__mapDeps([0,1,2]),import.meta.url).then(t=>({default:t.Uploader})));function rs({projectId:t,readOnly:o,loading:s,blocklet:r,params:l,setParams:c,paramsErrTip:i,setParamsErrTip:d,warning:u,setLoading:x,initUrl:p=null,initLogoUrl:m,setInitLogoUrl:f,componentDid:b=""}){const{t:h,locale:j}=X(),{api:v}=ke(),g=It(),C=k.useRef(null),D=k.useRef(null),[R,y]=rn(r),[T,O]=k.useState(!1),N=Bo({messageType:"connect-store-message",onOpen:()=>x(!0),onClose:()=>x(!1)}),z=async q=>{const Y=setTimeout(()=>{x(!1)},2e4),J=await Lr(v,q);x(!1),clearTimeout(Y),window.parent.postMessage({event:"studioDialog.connected",componentDid:b},"*"),g(window.location.pathname.replace(`${F.UNOWNED_DID}/create`,`${J}/create`),{replace:!0})},K=()=>{if(!l.blockletTitle){W.error(h("blocklet.publish.errorTip.noTitle"));return}if(!R?.url){W.error(h("blocklet.publish.noStoreSelected"));return}const q=Pr();N(async(Y,J)=>{try{const se=await v.connectByStudio({input:{did:r?.meta?.did,blockletTitle:l?.blockletTitle,storeUrl:R.url,storeId:R.id,storeName:R.name,type:l?.blockletComponents?.length>0?"pack":"resource",componentDid:b,messageId:q,tenantScope:p?.searchParams.get("tenantScope")||""}});if(!se?.url){W.error("failed to connect to store");return}J(se.url),z({did:r?.meta?.did,projectId:"",messageId:q})}catch(se){const de=ge(se);W.error(de),x(!1)}})},{logoUrl:P,screenshotUrls:A,uploadLogoPrefix:w,uploadScreenshotPrefix:S}=os(l,r,t),{logoErrors:Z,screenshotErrors:H,storeList:Q,hasLogoWarning:E,hasScreenshotWarning:I}=u,V=()=>o?!1:!t||t===F.UNOWNED_DID?(W.error(h("blocklet.publish.errorTip.noFirstDid")),!1):!0,U=q=>{if(!q.destination)return;const Y=Array.from(l.blockletScreenshots),[J]=Y.splice(q.source.index,1);Y.splice(q.destination.index,0,J),c(se=>({...se,blockletScreenshots:Y}))},ee=q=>{if(!q.destination)return;const Y=Array.from(l.blockletVideos),[J]=Y.splice(q.source.index,1);Y.splice(q.destination.index,0,J),c(se=>({...se,blockletVideos:Y}))};return e.jsxs(ln,{children:[e.jsx(a,{className:"section",sx:{display:"flex"},children:e.jsxs(a,{sx:{flex:1},children:[e.jsx(ne,{disabled:s||o,label:`Blocklet ${h("common.title")}`,placeholder:`Blocklet ${h("common.title")}`,autoComplete:"off",variant:"outlined",fullWidth:!0,required:!0,value:l.blockletTitle||"",onChange:q=>{d({blockletTitle:""}),c({blockletTitle:q.target.value})},error:!!i.blockletTitle,helperText:i.blockletTitle||"",slotProps:{input:{"data-cy":"blocklet-title",readOnly:o}}}),e.jsx(ne,{required:!0,label:"Blocklet DID",fullWidth:!0,readonly:!0,disabled:!0,autoComplete:"off",variant:"outlined",error:!!i.projectId,helperText:i.projectId||"",value:t===F.UNOWNED_DID?"":`did:abt:${t}`,sx:{mt:3},slotProps:{input:{"data-cy":"export-blocklet-did",endAdornment:t===F.UNOWNED_DID&&e.jsx(Xe,{position:"end",children:e.jsx(ts,{blocklet:r,store:R,componentDid:b,onChangeStore:y,disabled:!l.blockletTitle||o||s,loading:s,onClick:K})})}}}),e.jsx(ne,{disabled:s||o,label:`Blocklet ${h("common.description")}`,placeholder:`Blocklet ${h("common.description")}`,required:!0,autoComplete:"off",variant:"outlined",fullWidth:!0,value:l.blockletDescription||"",onChange:q=>{d({blockletDescription:""}),c({blockletDescription:q.target.value.slice(0,159)})},error:!!i.blockletDescription,helperText:i.blockletDescription||"",sx:{mt:3},slotProps:{input:{"data-cy":"blocklet-description",readOnly:o}}}),e.jsx(ne,{disabled:s||o,label:`Blocklet ${h("common.homepageTip")}`,placeholder:`Blocklet ${h("common.homepageTip")}`,autoComplete:"off",variant:"outlined",fullWidth:!0,value:l.blockletHomepage||"",onChange:q=>{q.target.value&&!/^(http|https):\/\//.test(q.target.value)?d({blockletHomepage:h("blocklet.publish.errorTip.invalidUrl")}):d({blockletHomepage:""}),c({blockletHomepage:q.target.value})},error:!!i.blockletHomepage,helperText:i.blockletHomepage||"",sx:{mt:3},slotProps:{input:{"data-cy":"blocklet-homepage",readOnly:o}}}),e.jsx(ne,{disabled:s||o,label:`Blocklet ${h("common.community")}`,placeholder:`Blocklet ${h("common.community")}`,autoComplete:"off",variant:"outlined",fullWidth:!0,value:l.blockletCommunity||"",onChange:q=>{q.target.value&&!/^(http|https):\/\//.test(q.target.value)?d({blockletCommunity:h("blocklet.publish.errorTip.invalidUrl")}):d({blockletCommunity:""}),c({blockletCommunity:q.target.value})},error:!!i.blockletCommunity,helperText:i.blockletCommunity||"",sx:{mt:3},slotProps:{input:{"data-cy":"blocklet-community",readOnly:o}}}),e.jsx(ne,{disabled:s||o,label:`Blocklet ${h("common.support")}`,placeholder:`Blocklet ${h("common.support")}`,autoComplete:"off",variant:"outlined",fullWidth:!0,value:l.blockletSupport||"",onChange:q=>{q.target.value&&!/^(http|https):\/\//.test(q.target.value)&&!/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/.test(q.target.value)?d({blockletSupport:h("blocklet.publish.errorTip.invalidUrlOrEmail")}):d({blockletSupport:""}),c({blockletSupport:q.target.value})},error:!!i.blockletSupport,helperText:i.blockletSupport||"",sx:{mt:3},slotProps:{input:{"data-cy":"blocklet-support",readOnly:o}}}),e.jsx(ne,{disabled:s||o,label:`Blocklet ${h("common.repository")}`,placeholder:`Blocklet ${h("common.repository")}`,autoComplete:"off",variant:"outlined",fullWidth:!0,value:l.blockletRepository||"",onChange:q=>{q.target.value&&!/^(git|https|svn)/.test(q.target.value)?d({blockletRepository:h("blocklet.publish.errorTip.invalidUrl")}):d({blockletRepository:""}),c({blockletRepository:q.target.value})},error:!!i.blockletRepository,helperText:i.blockletRepository||"",sx:{mt:3},slotProps:{input:{"data-cy":"blocklet-repository",readOnly:o}}})]})}),e.jsx(a,{className:"section full-width",sx:{display:"flex",mt:3},children:e.jsxs(a,{sx:{flex:1,overflow:"hidden"},children:[e.jsxs(a,{sx:{display:"flex",flexDirection:"row",flexWrap:"wrap"},children:[e.jsxs(Re,{direction:"column",spacing:1,sx:{mr:2,width:"160px"},children:[e.jsx($,{variant:"subtitle1",sx:{fontWeight:"bold"},children:h("common.logo")}),e.jsxs(Re,{direction:"column",spacing:1,sx:{alignItems:"flex-start",opacity:.8,fontSize:"12px"},children:[e.jsx(a,{children:e.jsxs(a,{component:"span",children:[e.jsxs(a,{component:"span",sx:{color:"text.secondary"},children:[h("studio.type"),":"," "]}),e.jsx(a,{component:"span",sx:{color:"secondary.main"},children:"png, jpg, webp, svg"})]})}),e.jsx(a,{children:e.jsxs(a,{component:"span",children:[e.jsxs(a,{component:"span",sx:{color:"text.secondary"},children:[h("studio.ratio"),":"," "]}),e.jsx(a,{component:"span",sx:{color:"secondary.main"},children:"256x256"})]})}),e.jsx(a,{children:e.jsxs(a,{component:"span",children:[e.jsxs(a,{component:"span",sx:{color:"text.secondary"},children:[h("studio.size"),":"," "]}),e.jsx(a,{component:"span",sx:{color:"secondary.main"},children:"<500Kb"})]})})]})]}),e.jsx(a,{sx:{flex:1,cursor:o?"default":"pointer",display:"flex",alignItems:"flex-end"},children:e.jsx(Et,{variant:"square",sx:{width:80,height:80},alt:"Blocklet Logo",src:m||P,onClick:()=>{V()&&C.current?.open()}})})]}),E&&e.jsx(Rt,{errors:Z,storeList:Q,mt:3}),e.jsxs(a,{sx:{display:"flex",mt:3,flexDirection:"row",flexWrap:"wrap"},children:[e.jsxs(Re,{direction:"column",spacing:1,sx:{mr:2,width:"160px"},children:[e.jsx($,{variant:"subtitle1",sx:{fontWeight:"bold"},children:h("common.screenshot")}),e.jsxs(Re,{direction:"column",spacing:1,sx:{alignItems:"flex-start",opacity:.8,fontSize:"12px"},children:[e.jsx(a,{sx:{border:"none"},variant:"outlined",size:"small",children:e.jsxs(a,{component:"span",children:[e.jsxs(a,{component:"span",sx:{color:"text.secondary"},children:[h("studio.ratio"),":"," "]}),e.jsx(a,{component:"span",sx:{color:"secondary.main"},children:"16 / 9"})]})}),e.jsx(a,{children:e.jsxs(a,{component:"span",children:[e.jsxs(a,{component:"span",sx:{color:"text.secondary"},children:[h("studio.count"),":"," "]}),e.jsx(a,{component:"span",sx:{color:"secondary.main"},children:"1~5"})]})}),e.jsx(a,{children:e.jsxs(a,{component:"span",children:[e.jsxs(a,{component:"span",sx:{color:"text.secondary"},children:[h("studio.size"),":"," "]}),e.jsx(a,{component:"span",sx:{color:"secondary.main"},children:"<5MB"})]})}),!o&&e.jsx(a,{children:e.jsxs(a,{component:"span",children:[e.jsxs(a,{component:"span",sx:{color:"text.secondary"},children:[h("studio.order"),":"," "]}),e.jsx(a,{component:"span",sx:{color:"secondary.main"},children:h("studio.orderTip")})]})})]})]}),e.jsx(Qt,{onDragEnd:o?void 0:U,children:e.jsx(eo,{droppableId:"screenshots",direction:"horizontal",isDropDisabled:o,children:(q,Y)=>e.jsxs(a,{ref:q.innerRef,...q.droppableProps,sx:{display:"flex",alignItems:"center",flex:1,flexWrap:"wrap",minHeight:160,background:Y.isDraggingOver?"grey.100":"transparent",transition:"background-color 0.2s ease",border:Y.isDraggingOver?"2px dashed #999":"none",borderRadius:"4px"},children:[A.map((J,se)=>e.jsx(to,{draggableId:J,index:se,isDragDisabled:o,children:(de,le)=>e.jsxs(a,{ref:de.innerRef,...de.draggableProps,className:"screenshot",sx:{transform:le.isDragging?"scale(1.05)":"none",boxShadow:le.isDragging?"0 5px 10px rgba(0,0,0,0.15)":"none",transition:"transform 0.2s ease, box-shadow 0.2s ease"},children:[e.jsx("img",{alt:"screenshot",src:J}),!o&&e.jsx(ce,{...de.dragHandleProps,className:"action",style:{right:40,zIndex:10,color:"#fff"},children:e.jsx(Xt,{})}),!o&&e.jsx(ce,{className:"action",onClick:()=>{c(pe=>{const he=[...pe.blockletScreenshots];return he.splice(se,1),{...pe,blockletScreenshots:he}})},children:e.jsx(tt,{})})]})},J)),q.placeholder,A.length<5&&e.jsx(a,{onClick:()=>{V()&&D.current?.open()},sx:{display:"flex",justifyContent:"center",alignItems:"center",fontSize:40,width:240,height:135,background:"#eee",cursor:o?"default":"pointer",color:"#999",mb:2},children:"+"})]})})})]}),I&&e.jsx(Rt,{errors:H,storeList:Q}),e.jsxs(a,{sx:{display:"flex",mt:3,flexDirection:"row",flexWrap:"wrap"},children:[e.jsxs(Re,{direction:"column",spacing:1,sx:{mr:2,width:"160px"},children:[e.jsx($,{variant:"subtitle1",sx:{fontWeight:"bold"},children:h("studio.video")}),e.jsxs(Re,{direction:"column",spacing:1,sx:{alignItems:"flex-start",opacity:.8,fontSize:"12px"},children:[e.jsx(a,{children:e.jsxs(a,{component:"span",children:[e.jsxs(a,{component:"span",sx:{color:"text.secondary"},children:[h("studio.videoType"),":"," "]}),e.jsxs(a,{component:"span",sx:{color:"secondary.main"},children:[e.jsx("a",{href:"https://www.youtube.com/",target:"_blank",rel:"noreferrer",children:"Youtube"}),","," ",e.jsx("a",{href:"https://vimeo.com/",target:"_blank",rel:"noreferrer",children:"Vimeo"})]})]})}),e.jsx(a,{children:e.jsxs(a,{component:"span",children:[e.jsxs(a,{component:"span",sx:{color:"text.secondary"},children:[h("studio.count"),":"," "]}),e.jsx(a,{component:"span",sx:{color:"secondary.main"},children:"1~3"})]})}),!o&&e.jsx(a,{children:e.jsxs(a,{component:"span",children:[e.jsxs(a,{component:"span",sx:{color:"text.secondary"},children:[h("studio.order"),":"," "]}),e.jsx(a,{component:"span",sx:{color:"secondary.main"},children:h("studio.orderTip")})]})})]})]}),e.jsx(Qt,{onDragEnd:o?void 0:ee,children:e.jsx(eo,{droppableId:"videos",direction:"horizontal",isDropDisabled:o,children:(q,Y)=>e.jsxs(a,{ref:q.innerRef,...q.droppableProps,sx:{display:"flex",alignItems:"center",flex:1,flexWrap:"wrap",minHeight:160,background:Y.isDraggingOver?"#f5f5f5":"transparent",transition:"background-color 0.2s ease",border:Y.isDraggingOver?"2px dashed #999":"none",borderRadius:"4px"},children:[l.blockletVideos.map((J,se)=>e.jsx(to,{draggableId:J,index:se,isDragDisabled:o,children:(de,le)=>e.jsxs(a,{ref:de.innerRef,...de.draggableProps,className:"screenshot",sx:{transform:le.isDragging?"scale(1.05)":"none",boxShadow:le.isDragging?"0 5px 10px rgba(0,0,0,0.15)":"none",transition:"transform 0.2s ease, box-shadow 0.2s ease"},children:[e.jsx(Vt,{url:J,style:{pointerEvents:le.isDragging?"none":"auto"}}),!o&&e.jsx(ce,{...de.dragHandleProps,className:"action",style:{right:40,zIndex:10,color:"#fff"},children:e.jsx(Xt,{})}),!o&&e.jsx(ce,{className:"action",onClick:()=>{c(pe=>{const he=[...pe.blockletVideos];return he.splice(se,1),{...pe,blockletVideos:he}})},children:e.jsx(tt,{})})]})},J)),q.placeholder,l.blockletVideos.length<3&&e.jsx(a,{onClick:()=>{V()&&O(!0)},sx:{display:"flex",justifyContent:"center",alignItems:"center",fontSize:40,width:240,height:135,background:"#eee",cursor:o?"default":"pointer",color:"#999",mb:2},children:"+"})]})})})]})]})}),e.jsxs(k.Suspense,{fallback:e.jsx(Ge,{}),children:[e.jsx(ao,{ref:C,locale:j,popup:!0,onUploadFinish:q=>{c({blockletLogo:q.data.filename}),f(""),C.current?.close()},plugins:["ImageEditor"],installerProps:{disabled:!0},apiPathProps:{uploader:w,disableMediaKitPrefix:!0,disableMediaKitStatus:!0},coreProps:{restrictions:{allowedFileTypes:["image/png","image/jpeg","image/webp","image/svg+xml"],maxFileSize:1024*1024*.5,maxNumberOfFiles:1}},dashboardProps:{autoOpen:"imageEditor"},imageEditorProps:{actions:{revert:!0,rotate:!0,granularRotate:!0,flip:!0,zoomIn:!0,zoomOut:!0,cropSquare:!1,cropWidescreen:!1,cropWidescreenVertical:!1},cropperOptions:{autoCrop:!0,aspectRatio:1,initialAspectRatio:1,autoCropArea:1,croppedCanvasOptions:{minWidth:256,minHeight:256}}}},"uploader-logo"),T&&e.jsx(ss,{onClose:()=>O(!1),params:l,setParams:c}),e.jsx(ao,{ref:D,locale:j,popup:!0,onUploadFinish:q=>{c(Y=>{const J=Y.blockletScreenshots||[];return J.push(q.data?.filename),{...Y,blockletScreenshots:J}}),D.current?.close()},installerProps:{disabled:!0},plugins:["ImageEditor"],apiPathProps:{uploader:S,disableMediaKitPrefix:!0,disableMediaKitStatus:!0},coreProps:{restrictions:{allowedFileTypes:["image/*","image/svg+xml"],maxFileSize:1024*1024*5,maxNumberOfFiles:5-A.length}},imageEditorProps:{actions:{revert:!0,rotate:!0,granularRotate:!0,flip:!0,zoomIn:!0,zoomOut:!0,cropSquare:!1,cropWidescreen:!1,cropWidescreenVertical:!1},cropperOptions:{autoCrop:!0,autoCropArea:1,aspectRatio:16/9,initialAspectRatio:16/9,croppedCanvasOptions:{minWidth:1280,minHeight:720,maxWidth:1280*2,maxHeight:720*2}}}},"uploader-screenshot")]})]})}rs.propTypes={projectId:n.string.isRequired,readOnly:n.bool.isRequired,params:n.object.isRequired,setParams:n.func.isRequired,paramsErrTip:n.object.isRequired,setParamsErrTip:n.func.isRequired,warning:n.object.isRequired,loading:n.bool.isRequired,blocklet:n.object.isRequired,setLoading:n.func.isRequired,initUrl:n.object,componentDid:n.string,initLogoUrl:n.string.isRequired,setInitLogoUrl:n.func.isRequired};const ln=ve.div`
145
+ `,co="lastWantToConnectStoreId";function rn(t){const[o,s]=k.useState(null),{session:r}=ze(),l=k.useCallback(d=>{s(d),localStorage.setItem(co,d?.id)},[s]),c=k.useMemo(()=>{const d=localStorage.getItem(co),u=d?(t?.settings?.storeList||[]).find(p=>p.id===d):null;if(u)return u;let x=(t?.settings?.storeList||[]).find(p=>!(p.id!==F.BLOCKLET_STORE.id||p.scope&&p.scope!=="studio"&&p.scope!==r?.user?.did));return x||(x=t?.settings?.storeList?.[0]),x},[t?.settings?.storeList,r?.user?.did]);return[o||c||{},l]}const Bt=({fromBlocklet:t,nodeInfo:o,blocklet:s,userDid:r})=>{const l=t?s?.meta?.did:o?.did;let c=t?s?.settings?.storeList||[]:o?.blockletRegistryList||[];return Array.isArray(c)||(c=[]),c=c.filter(i=>i.protected||Rr(i.scope)||i.scope==="studio"||i.scope===r),{teamDid:l,storeList:c}};function ts({blocklet:t=null,store:o=null,onChangeStore:s,onClick:r,disabled:l,loading:c,componentDid:i}){const{t:d}=X(),{session:u}=ze(),{api:x,info:p,inService:m}=ke(),f=De(),[b,h]=k.useState(!1),j=k.useRef(null),[v,g]=k.useState(!1),[C,D]=k.useState(null),R=A=>{s(A),h(!1)},y=()=>{h(!b)},T=A=>{j.current&&j.current.contains(A.target)||h(!1)},O=()=>{g(!0)},N=()=>{g(!1)},z=async()=>{if(C)try{await x.deleteBlockletStore({input:{teamDid:t.meta.did,url:C.url,projectId:"",scope:C.scope||"studio"}}),await f?.actions?.refreshBlocklet()}catch(A){W.error(`Remove Blocklet Store Error: ${ge(A)}`)}finally{D(null)}},{storeList:K}=Bt({fromBlocklet:m,blocklet:t,nodeInfo:p,userDid:u?.user?.did}),P=t?.meta?.did;return e.jsxs(e.Fragment,{children:[e.jsxs(et,{disabled:l,ref:j,variant:"contained",color:"primary","aria-label":"Button group with connect store",children:[e.jsxs(G,{onClick:r,children:[c&&e.jsx(Se,{size:14,sx:{mr:.5}}),`${d("common.connect")} ${o.name||""}`]}),e.jsx(G,{size:"small","aria-controls":b?"split-button-menu":void 0,"aria-expanded":b?"true":void 0,"aria-label":"select merge strategy","aria-haspopup":"menu",onClick:y,children:e.jsx(Xs,{})})]}),e.jsx(yo,{sx:{zIndex:10},open:b,anchorEl:j.current,placement:"bottom-end",role:void 0,transition:!0,disablePortal:!0,children:({TransitionProps:A})=>e.jsx(wo,{...A,style:{transformOrigin:"center top"},children:e.jsx(Lt,{children:e.jsx(vo,{onClickAway:T,children:e.jsxs(Co,{id:"split-button-menu",autoFocusItem:!0,sx:{maxHeight:300,overflowY:"auto",zIndex:10},children:[K?.map(w=>e.jsxs(be,{selected:w.id===o?.id,sx:{height:56},onClick:()=>R(w),children:[e.jsxs(a,{children:[e.jsx(Te,{sx:{fontSize:"16px"},maxLength:24,children:w.name}),e.jsx(Te,{sx:{fontSize:"13px",opacity:.6},maxLength:30,children:w.url})]}),qr({store:w,userDid:u?.user?.did})&&e.jsx(ce,{sx:{ml:1},onClick:S=>{S.preventDefault(),S.stopPropagation(),D(w)},children:e.jsx(ae,{icon:"ic:outline-delete"})})]},w.url)),e.jsx(Gs,{}),e.jsxs(be,{onClick:O,children:[e.jsx(nt,{font:!0}),e.jsx($,{variant:"inherit",children:d("store.blockletRegistry.addRegistry")})]})]})})})})}),v&&e.jsx(Vo,{hiddenChildren:!0,open:!0,onClose:N,teamDid:P,storeList:K,scope:"studio",onAdd:f?.actions?.refreshBlocklet}),C&&e.jsx(at,{displayError:!0,title:`${d("common.delete")} ${C.name}`,description:d("blocklet.publish.deleteStoreTip",{name:C.name}),confirm:d("common.confirm"),onConfirm:z,onCancel:()=>D(null)})]})}ts.propTypes={store:n.object,blocklet:n.object,onChangeStore:n.func.isRequired,onClick:n.func.isRequired,loading:n.bool.isRequired,disabled:n.bool.isRequired,componentDid:n.string.isRequired,projectType:n.string.isRequired,getData:n.func.isRequired};const os=(t,o,s)=>{const r=`${F.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${o.meta.did}/${s}/logo/upload`,l=`${F.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${o.meta.did}/${s}/screenshot/upload`,c=t?.blockletLogo?`${r}/${t.blockletLogo}`:`${F.WELLKNOWN_SERVICE_PATH_PREFIX}/static/images/logo.png`,i=(t?.blockletScreenshots||[]).filter(Boolean).map(d=>`${l}/${d}`);return{logoUrl:c,screenshotUrls:i,uploadLogoPrefix:r,uploadScreenshotPrefix:l}},nn=t=>{const o=t.includes("youtube.com")||t.includes("youtu.be"),s=t.includes("vimeo.com");return o||s};function Vt({url:t,style:o={},controls:s=1,modestbranding:r=1}){const{t:l}=X(),c=t.includes("youtube.com")||t.includes("youtu.be"),i=t.includes("vimeo.com");if(c){const d=t.split("v=")[1]?.split("&")[0]||t.split("/").pop();return e.jsx("div",{style:{position:"relative",width:"100%",paddingTop:"56.25%",pointerEvents:o?.pointerEvents||"auto"},children:e.jsx("iframe",{src:`https://www.youtube.com/embed/${d}?modestbranding=${r}&controls=${s}&rel=0`,title:"YouTube video player",style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",border:"none",...o},allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0})})}if(i){const d=t.split("/").pop();return e.jsx("div",{style:{position:"relative",width:"100%",paddingTop:"56.25%",pointerEvents:o.pointerEvents||"auto"},children:e.jsx("iframe",{src:`https://player.vimeo.com/video/${d}`,title:"Vimeo video player",style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",border:"none",...o},allow:"autoplay; fullscreen; picture-in-picture",allowFullScreen:!0})})}return e.jsx(a,{style:{position:"relative",width:"100%",paddingTop:"56.25%"},children:e.jsxs(a,{style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",border:"none",backgroundColor:"rgba(0, 0, 0, 0.04)",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",...o},allow:"autoplay; fullscreen; picture-in-picture",allowFullScreen:!0,children:[e.jsx(ae,{icon:"carbon:video-off",style:{fontSize:40,marginBottom:"10px",opacity:.5}}),e.jsx($,{variant:"body1",sx:{opacity:.5},children:l("studio.videoDialogNoSrc")})]})})}Vt.propTypes={url:n.string.isRequired,style:n.object,controls:n.number,modestbranding:n.number};function ss({setParams:t,onClose:o,params:s}){const{t:r}=X(),[l,c]=k.useState(""),i=l&&s.blockletVideos.includes(l),d=nn(l),u=()=>{t(x=>{const p=[...x.blockletVideos];return p.push(l),{...x,blockletVideos:p}}),o()};return e.jsxs(lt,{open:!0,fullWidth:!0,maxWidth:"sm",children:[e.jsx(Ro,{children:r("studio.videoDialogTitle")}),e.jsxs(So,{children:[e.jsx(Ks,{fullWidth:!0,value:l,onChange:x=>c(x.target.value),placeholder:r("studio.videoInputLabel"),endAdornment:l?e.jsx(Xe,{position:"end",children:e.jsx(ce,{onClick:()=>c(""),children:e.jsx(Ys,{})})}):null,error:i}),i&&e.jsx($,{variant:"body2",color:"error",children:r("studio.duplicateVideo")}),e.jsx(Vt,{url:l,style:{marginTop:"20px",borderRadius:"4px"}})]}),e.jsxs(To,{children:[e.jsx(G,{onClick:()=>o(),children:r("studio.cancel")}),e.jsx(G,{disabled:!d||i,onClick:u,children:r("studio.confirm")})]})]})}ss.propTypes={onClose:n.func.isRequired,params:n.object.isRequired,setParams:n.func.isRequired};function Rt({errors:t,storeList:o,...s}){const{t:r}=X();return e.jsxs(a,{...s,sx:[{color:"warning.main",fontSize:"14px",border:"1px solid rgba(214, 164, 64, 0.34)",borderRadius:"4px",py:2,px:1.5,position:"relative"},...Array.isArray(s.sx)?s.sx:[s.sx]],children:[e.jsx($,{variant:"caption",sx:{fontWeight:"bold",position:"absolute",top:-10,left:12,backgroundColor:"white",px:1,width:"fit-content"},children:r("blocklet.publish.storeRule.warning")}),t&&Object.entries(t).map(([l,c])=>{const i=Object.values(c),d=o.find(u=>u.url===l);return i.length>0&&e.jsxs(a,{children:[e.jsx(xe,{title:l,children:e.jsx(a,{component:"span",sx:{cursor:"pointer"},children:d.name})}),i.map(u=>e.jsx(a,{component:"li",sx:{ml:2,wordBreak:!0},children:u},u))]},l)})]})}Rt.propTypes={errors:n.object.isRequired,storeList:n.array.isRequired};const ao=k.lazy(()=>_o(()=>import("./index-D8_V9EUB.js"),__vite__mapDeps([0,1,2]),import.meta.url).then(t=>({default:t.Uploader})));function rs({projectId:t,readOnly:o,loading:s,blocklet:r,params:l,setParams:c,paramsErrTip:i,setParamsErrTip:d,warning:u,setLoading:x,initUrl:p=null,initLogoUrl:m,setInitLogoUrl:f,componentDid:b=""}){const{t:h,locale:j}=X(),{api:v}=ke(),g=It(),C=k.useRef(null),D=k.useRef(null),[R,y]=rn(r),[T,O]=k.useState(!1),N=Bo({messageType:"connect-store-message",onOpen:()=>x(!0),onClose:()=>x(!1)}),z=async q=>{const Y=setTimeout(()=>{x(!1)},2e4),J=await Lr(v,q);x(!1),clearTimeout(Y),window.parent.postMessage({event:"studioDialog.connected",componentDid:b},"*"),g(window.location.pathname.replace(`${F.UNOWNED_DID}/create`,`${J}/create`),{replace:!0})},K=()=>{if(!l.blockletTitle){W.error(h("blocklet.publish.errorTip.noTitle"));return}if(!R?.url){W.error(h("blocklet.publish.noStoreSelected"));return}const q=Pr();N(async(Y,J)=>{try{const se=await v.connectByStudio({input:{did:r?.meta?.did,blockletTitle:l?.blockletTitle,storeUrl:R.url,storeId:R.id,storeName:R.name,type:l?.blockletComponents?.length>0?"pack":"resource",componentDid:b,messageId:q,tenantScope:p?.searchParams.get("tenantScope")||""}});if(!se?.url){W.error("failed to connect to store");return}J(se.url),z({did:r?.meta?.did,projectId:"",messageId:q})}catch(se){const de=ge(se);W.error(de),x(!1)}})},{logoUrl:P,screenshotUrls:A,uploadLogoPrefix:w,uploadScreenshotPrefix:S}=os(l,r,t),{logoErrors:Z,screenshotErrors:H,storeList:Q,hasLogoWarning:E,hasScreenshotWarning:I}=u,V=()=>o?!1:!t||t===F.UNOWNED_DID?(W.error(h("blocklet.publish.errorTip.noFirstDid")),!1):!0,U=q=>{if(!q.destination)return;const Y=Array.from(l.blockletScreenshots),[J]=Y.splice(q.source.index,1);Y.splice(q.destination.index,0,J),c(se=>({...se,blockletScreenshots:Y}))},ee=q=>{if(!q.destination)return;const Y=Array.from(l.blockletVideos),[J]=Y.splice(q.source.index,1);Y.splice(q.destination.index,0,J),c(se=>({...se,blockletVideos:Y}))};return e.jsxs(ln,{children:[e.jsx(a,{className:"section",sx:{display:"flex"},children:e.jsxs(a,{sx:{flex:1},children:[e.jsx(ne,{disabled:s||o,label:`Blocklet ${h("common.title")}`,placeholder:`Blocklet ${h("common.title")}`,autoComplete:"off",variant:"outlined",fullWidth:!0,required:!0,value:l.blockletTitle||"",onChange:q=>{d({blockletTitle:""}),c({blockletTitle:q.target.value})},error:!!i.blockletTitle,helperText:i.blockletTitle||"",slotProps:{input:{"data-cy":"blocklet-title",readOnly:o}}}),e.jsx(ne,{required:!0,label:"Blocklet DID",fullWidth:!0,readonly:!0,disabled:!0,autoComplete:"off",variant:"outlined",error:!!i.projectId,helperText:i.projectId||"",value:t===F.UNOWNED_DID?"":`did:abt:${t}`,sx:{mt:3},slotProps:{input:{"data-cy":"export-blocklet-did",endAdornment:t===F.UNOWNED_DID&&e.jsx(Xe,{position:"end",children:e.jsx(ts,{blocklet:r,store:R,componentDid:b,onChangeStore:y,disabled:!l.blockletTitle||o||s,loading:s,onClick:K})})}}}),e.jsx(ne,{disabled:s||o,label:`Blocklet ${h("common.description")}`,placeholder:`Blocklet ${h("common.description")}`,required:!0,autoComplete:"off",variant:"outlined",fullWidth:!0,value:l.blockletDescription||"",onChange:q=>{d({blockletDescription:""}),c({blockletDescription:q.target.value.slice(0,159)})},error:!!i.blockletDescription,helperText:i.blockletDescription||"",sx:{mt:3},slotProps:{input:{"data-cy":"blocklet-description",readOnly:o}}}),e.jsx(ne,{disabled:s||o,label:`Blocklet ${h("common.homepageTip")}`,placeholder:`Blocklet ${h("common.homepageTip")}`,autoComplete:"off",variant:"outlined",fullWidth:!0,value:l.blockletHomepage||"",onChange:q=>{q.target.value&&!/^(http|https):\/\//.test(q.target.value)?d({blockletHomepage:h("blocklet.publish.errorTip.invalidUrl")}):d({blockletHomepage:""}),c({blockletHomepage:q.target.value})},error:!!i.blockletHomepage,helperText:i.blockletHomepage||"",sx:{mt:3},slotProps:{input:{"data-cy":"blocklet-homepage",readOnly:o}}}),e.jsx(ne,{disabled:s||o,label:`Blocklet ${h("common.community")}`,placeholder:`Blocklet ${h("common.community")}`,autoComplete:"off",variant:"outlined",fullWidth:!0,value:l.blockletCommunity||"",onChange:q=>{q.target.value&&!/^(http|https):\/\//.test(q.target.value)?d({blockletCommunity:h("blocklet.publish.errorTip.invalidUrl")}):d({blockletCommunity:""}),c({blockletCommunity:q.target.value})},error:!!i.blockletCommunity,helperText:i.blockletCommunity||"",sx:{mt:3},slotProps:{input:{"data-cy":"blocklet-community",readOnly:o}}}),e.jsx(ne,{disabled:s||o,label:`Blocklet ${h("common.support")}`,placeholder:`Blocklet ${h("common.support")}`,autoComplete:"off",variant:"outlined",fullWidth:!0,value:l.blockletSupport||"",onChange:q=>{q.target.value&&!/^(http|https):\/\//.test(q.target.value)&&!/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/.test(q.target.value)?d({blockletSupport:h("blocklet.publish.errorTip.invalidUrlOrEmail")}):d({blockletSupport:""}),c({blockletSupport:q.target.value})},error:!!i.blockletSupport,helperText:i.blockletSupport||"",sx:{mt:3},slotProps:{input:{"data-cy":"blocklet-support",readOnly:o}}}),e.jsx(ne,{disabled:s||o,label:`Blocklet ${h("common.repository")}`,placeholder:`Blocklet ${h("common.repository")}`,autoComplete:"off",variant:"outlined",fullWidth:!0,value:l.blockletRepository||"",onChange:q=>{q.target.value&&!/^(git|https|svn)/.test(q.target.value)?d({blockletRepository:h("blocklet.publish.errorTip.invalidUrl")}):d({blockletRepository:""}),c({blockletRepository:q.target.value})},error:!!i.blockletRepository,helperText:i.blockletRepository||"",sx:{mt:3},slotProps:{input:{"data-cy":"blocklet-repository",readOnly:o}}})]})}),e.jsx(a,{className:"section full-width",sx:{display:"flex",mt:3},children:e.jsxs(a,{sx:{flex:1,overflow:"hidden"},children:[e.jsxs(a,{sx:{display:"flex",flexDirection:"row",flexWrap:"wrap"},children:[e.jsxs(Re,{direction:"column",spacing:1,sx:{mr:2,width:"160px"},children:[e.jsx($,{variant:"subtitle1",sx:{fontWeight:"bold"},children:h("common.logo")}),e.jsxs(Re,{direction:"column",spacing:1,sx:{alignItems:"flex-start",opacity:.8,fontSize:"12px"},children:[e.jsx(a,{children:e.jsxs(a,{component:"span",children:[e.jsxs(a,{component:"span",sx:{color:"text.secondary"},children:[h("studio.type"),":"," "]}),e.jsx(a,{component:"span",sx:{color:"secondary.main"},children:"png, jpg, webp, svg"})]})}),e.jsx(a,{children:e.jsxs(a,{component:"span",children:[e.jsxs(a,{component:"span",sx:{color:"text.secondary"},children:[h("studio.ratio"),":"," "]}),e.jsx(a,{component:"span",sx:{color:"secondary.main"},children:"256x256"})]})}),e.jsx(a,{children:e.jsxs(a,{component:"span",children:[e.jsxs(a,{component:"span",sx:{color:"text.secondary"},children:[h("studio.size"),":"," "]}),e.jsx(a,{component:"span",sx:{color:"secondary.main"},children:"<500Kb"})]})})]})]}),e.jsx(a,{sx:{flex:1,cursor:o?"default":"pointer",display:"flex",alignItems:"flex-end"},children:e.jsx(Et,{variant:"square",sx:{width:80,height:80},alt:"Blocklet Logo",src:m||P,onClick:()=>{V()&&C.current?.open()}})})]}),E&&e.jsx(Rt,{errors:Z,storeList:Q,mt:3}),e.jsxs(a,{sx:{display:"flex",mt:3,flexDirection:"row",flexWrap:"wrap"},children:[e.jsxs(Re,{direction:"column",spacing:1,sx:{mr:2,width:"160px"},children:[e.jsx($,{variant:"subtitle1",sx:{fontWeight:"bold"},children:h("common.screenshot")}),e.jsxs(Re,{direction:"column",spacing:1,sx:{alignItems:"flex-start",opacity:.8,fontSize:"12px"},children:[e.jsx(a,{sx:{border:"none"},variant:"outlined",size:"small",children:e.jsxs(a,{component:"span",children:[e.jsxs(a,{component:"span",sx:{color:"text.secondary"},children:[h("studio.ratio"),":"," "]}),e.jsx(a,{component:"span",sx:{color:"secondary.main"},children:"16 / 9"})]})}),e.jsx(a,{children:e.jsxs(a,{component:"span",children:[e.jsxs(a,{component:"span",sx:{color:"text.secondary"},children:[h("studio.count"),":"," "]}),e.jsx(a,{component:"span",sx:{color:"secondary.main"},children:"1~5"})]})}),e.jsx(a,{children:e.jsxs(a,{component:"span",children:[e.jsxs(a,{component:"span",sx:{color:"text.secondary"},children:[h("studio.size"),":"," "]}),e.jsx(a,{component:"span",sx:{color:"secondary.main"},children:"<5MB"})]})}),!o&&e.jsx(a,{children:e.jsxs(a,{component:"span",children:[e.jsxs(a,{component:"span",sx:{color:"text.secondary"},children:[h("studio.order"),":"," "]}),e.jsx(a,{component:"span",sx:{color:"secondary.main"},children:h("studio.orderTip")})]})})]})]}),e.jsx(Qt,{onDragEnd:o?void 0:U,children:e.jsx(eo,{droppableId:"screenshots",direction:"horizontal",isDropDisabled:o,children:(q,Y)=>e.jsxs(a,{ref:q.innerRef,...q.droppableProps,sx:{display:"flex",alignItems:"center",flex:1,flexWrap:"wrap",minHeight:160,background:Y.isDraggingOver?"grey.100":"transparent",transition:"background-color 0.2s ease",border:Y.isDraggingOver?"2px dashed #999":"none",borderRadius:"4px"},children:[A.map((J,se)=>e.jsx(to,{draggableId:J,index:se,isDragDisabled:o,children:(de,le)=>e.jsxs(a,{ref:de.innerRef,...de.draggableProps,className:"screenshot",sx:{transform:le.isDragging?"scale(1.05)":"none",boxShadow:le.isDragging?"0 5px 10px rgba(0,0,0,0.15)":"none",transition:"transform 0.2s ease, box-shadow 0.2s ease"},children:[e.jsx("img",{alt:"screenshot",src:J}),!o&&e.jsx(ce,{...de.dragHandleProps,className:"action",style:{right:40,zIndex:10,color:"#fff"},children:e.jsx(Xt,{})}),!o&&e.jsx(ce,{className:"action",onClick:()=>{c(pe=>{const he=[...pe.blockletScreenshots];return he.splice(se,1),{...pe,blockletScreenshots:he}})},children:e.jsx(tt,{})})]})},J)),q.placeholder,A.length<5&&e.jsx(a,{onClick:()=>{V()&&D.current?.open()},sx:{display:"flex",justifyContent:"center",alignItems:"center",fontSize:40,width:240,height:135,background:"#eee",cursor:o?"default":"pointer",color:"#999",mb:2},children:"+"})]})})})]}),I&&e.jsx(Rt,{errors:H,storeList:Q}),e.jsxs(a,{sx:{display:"flex",mt:3,flexDirection:"row",flexWrap:"wrap"},children:[e.jsxs(Re,{direction:"column",spacing:1,sx:{mr:2,width:"160px"},children:[e.jsx($,{variant:"subtitle1",sx:{fontWeight:"bold"},children:h("studio.video")}),e.jsxs(Re,{direction:"column",spacing:1,sx:{alignItems:"flex-start",opacity:.8,fontSize:"12px"},children:[e.jsx(a,{children:e.jsxs(a,{component:"span",children:[e.jsxs(a,{component:"span",sx:{color:"text.secondary"},children:[h("studio.videoType"),":"," "]}),e.jsxs(a,{component:"span",sx:{color:"secondary.main"},children:[e.jsx("a",{href:"https://www.youtube.com/",target:"_blank",rel:"noreferrer",children:"Youtube"}),","," ",e.jsx("a",{href:"https://vimeo.com/",target:"_blank",rel:"noreferrer",children:"Vimeo"})]})]})}),e.jsx(a,{children:e.jsxs(a,{component:"span",children:[e.jsxs(a,{component:"span",sx:{color:"text.secondary"},children:[h("studio.count"),":"," "]}),e.jsx(a,{component:"span",sx:{color:"secondary.main"},children:"1~3"})]})}),!o&&e.jsx(a,{children:e.jsxs(a,{component:"span",children:[e.jsxs(a,{component:"span",sx:{color:"text.secondary"},children:[h("studio.order"),":"," "]}),e.jsx(a,{component:"span",sx:{color:"secondary.main"},children:h("studio.orderTip")})]})})]})]}),e.jsx(Qt,{onDragEnd:o?void 0:ee,children:e.jsx(eo,{droppableId:"videos",direction:"horizontal",isDropDisabled:o,children:(q,Y)=>e.jsxs(a,{ref:q.innerRef,...q.droppableProps,sx:{display:"flex",alignItems:"center",flex:1,flexWrap:"wrap",minHeight:160,background:Y.isDraggingOver?"#f5f5f5":"transparent",transition:"background-color 0.2s ease",border:Y.isDraggingOver?"2px dashed #999":"none",borderRadius:"4px"},children:[l.blockletVideos.map((J,se)=>e.jsx(to,{draggableId:J,index:se,isDragDisabled:o,children:(de,le)=>e.jsxs(a,{ref:de.innerRef,...de.draggableProps,className:"screenshot",sx:{transform:le.isDragging?"scale(1.05)":"none",boxShadow:le.isDragging?"0 5px 10px rgba(0,0,0,0.15)":"none",transition:"transform 0.2s ease, box-shadow 0.2s ease"},children:[e.jsx(Vt,{url:J,style:{pointerEvents:le.isDragging?"none":"auto"}}),!o&&e.jsx(ce,{...de.dragHandleProps,className:"action",style:{right:40,zIndex:10,color:"#fff"},children:e.jsx(Xt,{})}),!o&&e.jsx(ce,{className:"action",onClick:()=>{c(pe=>{const he=[...pe.blockletVideos];return he.splice(se,1),{...pe,blockletVideos:he}})},children:e.jsx(tt,{})})]})},J)),q.placeholder,l.blockletVideos.length<3&&e.jsx(a,{onClick:()=>{V()&&O(!0)},sx:{display:"flex",justifyContent:"center",alignItems:"center",fontSize:40,width:240,height:135,background:"#eee",cursor:o?"default":"pointer",color:"#999",mb:2},children:"+"})]})})})]})]})}),e.jsxs(k.Suspense,{fallback:e.jsx(Ge,{}),children:[e.jsx(ao,{ref:C,locale:j,popup:!0,onUploadFinish:q=>{c({blockletLogo:q.data.filename}),f(""),C.current?.close()},plugins:["ImageEditor"],installerProps:{disabled:!0},apiPathProps:{uploader:w,disableMediaKitPrefix:!0,disableMediaKitStatus:!0},coreProps:{restrictions:{allowedFileTypes:["image/png","image/jpeg","image/webp","image/svg+xml"],maxFileSize:1024*1024*.5,maxNumberOfFiles:1}},dashboardProps:{autoOpen:"imageEditor"},imageEditorProps:{actions:{revert:!0,rotate:!0,granularRotate:!0,flip:!0,zoomIn:!0,zoomOut:!0,cropSquare:!1,cropWidescreen:!1,cropWidescreenVertical:!1},cropperOptions:{autoCrop:!0,aspectRatio:1,initialAspectRatio:1,autoCropArea:1,croppedCanvasOptions:{minWidth:256,minHeight:256}}}},"uploader-logo"),T&&e.jsx(ss,{onClose:()=>O(!1),params:l,setParams:c}),e.jsx(ao,{ref:D,locale:j,popup:!0,onUploadFinish:q=>{c(Y=>{const J=Y.blockletScreenshots||[];return J.push(q.data?.filename),{...Y,blockletScreenshots:J}}),D.current?.close()},installerProps:{disabled:!0},plugins:["ImageEditor"],apiPathProps:{uploader:S,disableMediaKitPrefix:!0,disableMediaKitStatus:!0},coreProps:{restrictions:{allowedFileTypes:["image/*","image/svg+xml"],maxFileSize:1024*1024*5,maxNumberOfFiles:5-A.length}},imageEditorProps:{actions:{revert:!0,rotate:!0,granularRotate:!0,flip:!0,zoomIn:!0,zoomOut:!0,cropSquare:!1,cropWidescreen:!1,cropWidescreenVertical:!1},cropperOptions:{autoCrop:!0,autoCropArea:1,aspectRatio:16/9,initialAspectRatio:16/9,croppedCanvasOptions:{minWidth:1280,minHeight:720,maxWidth:1280*2,maxHeight:720*2}}}},"uploader-screenshot")]})]})}rs.propTypes={projectId:n.string.isRequired,readOnly:n.bool.isRequired,params:n.object.isRequired,setParams:n.func.isRequired,paramsErrTip:n.object.isRequired,setParamsErrTip:n.func.isRequired,warning:n.object.isRequired,loading:n.bool.isRequired,blocklet:n.object.isRequired,setLoading:n.func.isRequired,initUrl:n.object,componentDid:n.string,initLogoUrl:n.string.isRequired,setInitLogoUrl:n.func.isRequired};const ln=ve.div`
146
146
  margin-top: 24px;
147
147
  .screenshot {
148
148
  margin-bottom: 16px;
@@ -190,7 +190,7 @@ import{r as k,i as It,j as rt,L as we,g as xo,k as qs,l as Ns,m as bt}from"./ven
190
190
  padding-bottom: 12px;
191
191
  border-bottom: ${({theme:t})=>`1px solid ${t.palette.divider}`};
192
192
  }
193
- `;function fs({text:t}){const{palette:o}=Po();return t?e.jsx(zr,{style:{backgroundColor:o.background.default,color:o.text.primary},wrapperElement:{"data-color-mode":"light"},source:gr.sanitize(t),rehypePlugins:[[Br,{target:"_blank"}]]}):e.jsx(Je,{Icon:Nt})}fs.propTypes={text:n.string.isRequired};function xs({params:t,setParams:o,paramsErrTip:s,loading:r,setParamsErrTip:l,readOnly:c}){const{t:i}=X(),[d,u]=k.useState(c?"preview":"write"),x=(p,m)=>{u(m)};return e.jsxs(a,{sx:{border:"1px solid transparent",borderRadius:2},children:[e.jsxs(a,{sx:{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center"},children:[e.jsx($,{variant:"h6",sx:{fontWeight:"bold"},children:i("common.introduction")}),e.jsxs(Ao,{value:d,onChange:x,"aria-label":"wrapped label tabs example",children:[e.jsx(ot,{value:"write",label:"Write"}),e.jsx(ot,{value:"preview",label:"Preview"})]})]}),e.jsx(a,{sx:{display:d==="write"?"block":"none",width:"100%",marginTop:3},children:e.jsx(ne,{disabled:r||c,sx:{border:"none"},placeholder:`Blocklet ${i("common.introduction")}`,autoComplete:"off",variant:"outlined",fullWidth:!0,multiline:!0,minRows:4,value:t.blockletIntroduction||"",onChange:p=>{l({blockletIntroduction:""}),o({blockletIntroduction:p.target.value.slice(0,me.PROJECT.MAX_INTRO_LENGTH)})},error:!!s.blockletIntroduction,helperText:s.blockletIntroduction||"",slotProps:{input:{"data-cy":"export-blocklet-introduction",readOnly:c,endAdornment:e.jsxs(Xe,{position:"end",children:[t?.blockletIntroduction?.length||0," / ",me.PROJECT.MAX_INTRO_LENGTH]})}}})}),e.jsx(a,{sx:{display:d==="preview"?"block":"none",mt:3},children:e.jsx(fs,{text:t.blockletIntroduction||""})})]})}xs.propTypes={params:n.object.isRequired,setParams:n.func.isRequired,paramsErrTip:n.object.isRequired,setParamsErrTip:n.func.isRequired,readOnly:n.bool.isRequired,loading:n.bool.isRequired};function gs({step:t=0,ok:o=!1,active:s=0,error:r="",warning:l=!1}){let c="grey.500",i=t+1;return o&&(i=e.jsx(Lo,{sx:{fontSize:18,margin:0},color:"white"})),r||!o&&s>t?(c="error.main",i=e.jsx(Gt,{sx:{fontSize:18,margin:0},color:"white"})):l?(c="warning.main",i=e.jsx(Gt,{sx:{fontSize:18,margin:0},color:"white"})):s>=t&&(c="primary.main"),e.jsx(a,{sx:{width:24,height:24,bgcolor:c,borderRadius:"100%",color:"white",display:"flex",justifyContent:"center",fontWeight:"bold",fontSize:14,alignItems:"center"},children:i})}gs.propTypes={step:n.number,ok:n.bool,active:n.number,error:n.string,warning:n.bool};function ks({steps:t,activeStep:o,setActiveStep:s,hasSelectedResources:r=!1,params:l,loading:c,paramsErrTip:i,warning:d,viewMode:u="",projectId:x}){const{t:p}=X(),m=()=>{s(j=>j+1)},f=()=>{s(j=>j-1)},b=j=>j===0?i?.blockletTitle||i?.projectId||i?.blockletDescription||i?.blockletHomepage||i?.blockletSupport||i?.blockletCommunity||i?.blockletRepository:j===2?i?.blockletResource||i?.blockletDocker||i?.dockerImageName:j>=4?i?.blockletVersion||i?.note:"",h=u||ns({params:l,projectId:x,t:p})===null;return e.jsxs(a,{sx:{width:300,maxWidth:300,minWidth:300,padding:2,border:"1px solid",borderColor:"divider",borderRadius:1},children:[e.jsx(lr,{activeStep:o,orientation:"vertical",children:t.map((j,v)=>{const g={},C=c||!pn({params:l,projectId:x,step:v,t:p}),D=c?"":b(v);return D&&(g.optional=e.jsx($,{variant:"caption",color:"error",sx:{wordBreak:"break-word"},children:D}),g.error=!0),e.jsxs(ir,{children:[e.jsx(cr,{icon:e.jsx(gs,{error:D,warning:v===0?d.hasWarning:!1,active:h?99:o,step:v,ok:C}),sx:{cursor:"pointer",color:D?"error.main":"inherit"},disabled:!1,onClick:()=>s(v),...g,children:e.jsx($,{fontSize:"14px",fontWeight:"500",color:D||!C&&o>v?"error.main":"inherit",children:j.label})}),e.jsxs(ar,{children:[e.jsx($,{fontSize:12,children:j.description}),!h&&e.jsx(a,{sx:{mb:2},children:e.jsxs("div",{children:[v<t.length-1&&e.jsx(G,{variant:"contained",onClick:m,sx:{mt:1,mr:1},disabled:D||!C,children:p("common.continue")}),v>0&&e.jsx(G,{disabled:v===0,onClick:f,sx:{mt:1,mr:1},children:p("common.back")})]})})]})]},j.label)})}),o>=t.length-1&&e.jsx(Lt,{square:!0,elevation:0,sx:{p:3},children:e.jsx($,{fontSize:12,sx:{opacity:.5},children:"Click right top button to release"})})]})}ks.propTypes={steps:n.array.isRequired,activeStep:n.number.isRequired,setActiveStep:n.func.isRequired,params:n.object.isRequired,viewMode:n.oneOfType([n.string,n.bool]),loading:n.bool.isRequired,projectId:n.string.isRequired,hasSelectedResources:n.oneOfType([n.string,n.bool]),warning:n.object.isRequired,paramsErrTip:n.shape({projectId:n.string,blockletVersion:n.string,blockletTitle:n.string,blockletDescription:n.string,note:n.string,blockletResource:n.string,blockletHomepage:n.string,blockletSupport:n.string,blockletCommunity:n.string,blockletRepository:n.string,blockletDocker:n.object,dockerImageName:n.string}).isRequired};const mn=[".zip",".gz"],bn=1024*1024*100,fn=k.lazy(()=>_o(()=>import("./index-BzDzFVcf.js"),__vite__mapDeps([0,1,2]),import.meta.url).then(t=>({default:t.Uploader})));function js({app:t,projectId:o,readOnly:s,params:r,setParams:l,setParamsErrTip:c,error:i}){const{t:d,locale:u}=X(),x=k.useRef(null),p=()=>s?!1:!o||o===F.UNOWNED_DID?(W.error(d("blocklet.publish.errorTip.noFirstDid")),!1):!0,m=`${F.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${t.meta.did}/${o}/resource/upload`;return e.jsxs(a,{sx:{mt:3},children:[e.jsx($,{gutterBottom:!0,children:d("blocklet.publish.resourceUpload")}),e.jsxs(Re,{direction:"row",spacing:1,sx:{alignItems:"center",flex:1,cursor:s?"default":"pointer"},children:[!!r.uploadedResource&&e.jsx($,{component:"a",href:`${m}/params.uploadedResource`,children:r.uploadedResource}),!s&&e.jsx(G,{variant:"outlined",size:"small",onClick:()=>{p()&&x.current?.open()},children:r.uploadedResource?d("common.change"):d("common.upload")})]}),e.jsx(k.Suspense,{fallback:e.jsx(Ge,{}),children:e.jsx(fn,{ref:x,locale:u,popup:!0,onUploadFinish:f=>{l({uploadedResource:f.data.filename}),c({blockletResource:""}),x.current?.close()},plugins:["ImageEditor"],installerProps:{disabled:!0},apiPathProps:{uploader:m,disableMediaKitPrefix:!0,disableMediaKitStatus:!0},coreProps:{restrictions:{allowedFileExts:mn,maxFileSize:bn,maxNumberOfFiles:1}}},"uploader-resource")}),!!i&&e.jsx(a,{sx:{color:"error.main",mt:1,fontSize:14},children:i})]})}js.propTypes={app:n.object.isRequired,projectId:n.string.isRequired,readOnly:n.bool.isRequired,params:n.object.isRequired,setParams:n.func.isRequired,error:n.string.isRequired,setParamsErrTip:n.func.isRequired};function Tt({readOnly:t,params:o,setParams:s,paramsErrTip:r,setParamsErrTip:l,loading:c}){const{t:i}=X();return e.jsx(a,{className:"section",sx:{display:"flex",mt:3},children:e.jsxs(a,{sx:{flex:1},children:[e.jsx(ne,{required:!0,disabled:c||t,label:`Blocklet ${i("common.version")}`,placeholder:`Blocklet ${i("common.version")}`,autoComplete:"off",variant:"outlined",fullWidth:!0,value:o.blockletVersion||"",onChange:d=>{l({blockletVersion:""}),s({blockletVersion:d.target.value})},error:!!r.blockletVersion,helperText:r.blockletVersion||"",slotProps:{input:{"data-cy":"blocklet-version",readOnly:t}}}),e.jsx(ne,{label:i("blocklet.publish.releaseNote"),autoComplete:"off",disabled:c||t,variant:"outlined",fullWidth:!0,multiline:!0,minRows:4,required:!0,value:o.note||"",onChange:d=>{l({note:""}),s({note:d.target.value.slice(0,me.PROJECT.MAX_NOTE_LENGTH)})},error:!!r.note,helperText:r.note||"",sx:{mt:3},slotProps:{input:{"data-cy":"release-note",readOnly:t,endAdornment:e.jsxs(Xe,{position:"end",children:[o?.note?.length||0," / ",me.PROJECT.MAX_NOTE_LENGTH]})}}})]})})}Tt.propTypes={readOnly:n.bool.isRequired,params:n.object.isRequired,setParams:n.func.isRequired,paramsErrTip:n.object.isRequired,setParamsErrTip:n.func.isRequired,loading:n.bool.isRequired};function ys(t){for(const o in t)typeof t[o]=="string"?t[o]=t[o].replace(/\\\\/g,"\\"):typeof t[o]=="object"&&t[o]!==null&&ys(t[o]);return t}var xn=Wr();const oe=xo(xn),gn={"-a":"--attach","-d":"--detach","-e":"--env","-h":"--hostname","-i":"--interactive","-it":"-it","-rm":"-rm","-m":"--memory","-p":"--publish","-P":"--publish-all","-l":"--label","-n":"--name","-q":"--quiet","-x":"--x-registry","-t":"--tty","-u":"--user","-v":"--volume","-w":"--workdir","-cgroupns":"--cgroupns","-cpus":"--cpus","-g":"--gpus","-ip6":"--ip6","--read-only":"--read-only","--add-host":"--add-host","--attach":"--attach","--blkio-weight":"--blkio-weight","--blkio-weight-device":"--blkio-weight-device","--cap-add":"--cap-add","--cap-drop":"--cap-drop","--cgroup-parent":"--cgroup-parent","--cidfile":"--cidfile","--cpu-period":"--cpu-period","--cpu-quota":"--cpu-quota","--cpu-rt-period":"--cpu-rt-period","--cpu-rt-runtime":"--cpu-rt-runtime","--cpu-shares":"--cpu-shares","--cpus":"--cpus","--cpuset-cpus":"--cpuset-cpus","--cpuset-mems":"--cpuset-mems","--detach":"--detach","--detach-keys":"--detach-keys","--device":"--device","--device-cgroup-rule":"--device-cgroup-rule","--device-read-bps":"--device-read-bps","--device-read-iops":"--device-read-iops","--device-write-bps":"--device-write-bps","--device-write-iops":"--device-write-iops","--disable-content-trust":"--disable-content-trust","--dns":"--dns","--dns-opt":"--dns-opt","--dns-search":"--dns-search","--domainname":"--domainname","--entrypoint":"--entrypoint","--env":"--env","--env-file":"--env-file","--expose":"--expose","--gpus":"--gpus","--group-add":"--group-add","--health-cmd":"--health-cmd","--health-interval":"--health-interval","--health-retries":"--health-retries","--health-start-period":"--health-start-period","--health-timeout":"--health-timeout","--help":"--help","--hostname":"--hostname","--init":"--init","--interactive":"--interactive","--ip":"--ip","--ip6":"--ip6","--ipc":"--ipc","--isolation":"--isolation","--kernel-memory":"--kernel-memory","--label":"--label","--label-file":"--label-file","--link":"--link","--link-local-ip":"--link-local-ip","--log-driver":"--log-driver","--log-opt":"--log-opt","--mac-address":"--mac-address","--memory":"--memory","--memory-reservation":"--memory-reservation","--memory-swap":"--memory-swap","--memory-swappiness":"--memory-swappiness","--mount":"--mount","--name":"--name","--network":"--network","--network-alias":"--network-alias","--no-healthcheck":"--no-healthcheck","--oom-kill-disable":"--oom-kill-disable","--oom-score-adj":"--oom-score-adj","--pid":"--pid","--pids-limit":"--pids-limit","--platform":"--platform","--privileged":"--privileged","--publish":"--publish","--publish-all":"--publish-all","--pull":"--pull","--restart":"--restart","--rm":"--rm","--runtime":"--runtime","--security-opt":"--security-opt","--shm-size":"--shm-size","--stop-signal":"--stop-signal","--stop-timeout":"--stop-timeout","--storage-opt":"--storage-opt","--sysctl":"--sysctl","--tmpfs":"--tmpfs","--tty":"--tty","--ulimit":"--ulimit","--user":"--user","--userns":"--userns","--uts":"--uts","--volume":"--volume","--volume-driver":"--volume-driver","--volumes-from":"--volumes-from","--workdir":"--workdir"},Ut={"--env":!0,"--publish":!0,"--volume":!0,"--attach":!0,"--quiet":!0,"--entrypoint":!0,"--workdir":!0,"--cidfile":!0,"--detach-keys":!0,"--disable-content-trust":!0,"--domainname":!0,"--expose":!0,"--ip":!0,"--link-local-ip":!0,"--platform":!0},kn={"--volume":!0,"--publish":!0},jn=new Set(["--publish","--volume"]),ws=t=>{const[o]=t.split(":");return o?.startsWith("/")||o?.startsWith("./")||o?.startsWith("../")||o?.startsWith("~")||o?.startsWith("$BLOCKLET")};function yn(t){return t.map(o=>{if(o.key!=="--volume"||o.value.startsWith("$BLOCKLET_APP_DIR/")||o.value.startsWith("$BLOCKLET_DATA_DIR/"))return o;const[s,...r]=o.value.split(":");if(!s||!ws(o.value))return o;const l=s.startsWith("/")?`$BLOCKLET_DATA_DIR${s}`:`$BLOCKLET_DATA_DIR/${s}`;return{...o,value:[l,...r].join(":")}})}function wn(t){let o=!0;return t.find(r=>r.key==="--publish"&&r.type==="web")?t.map(r=>{if(r.key==="--publish"){const l={...r,type:o?"docker":r.type};return o=r.type==="web",l}return r}):t.map(r=>{if(r.key==="--publish"){const l={...r,type:o?"web":"docker"};return o=!1,l}return r})}function ho(t){if(!t)return{dockerArgs:[],dockerEnvs:[],dockerImage:"",dockerCommand:""};if(t=t.trim(),t.startsWith("$ docker run")&&(t=t.replace("$ docker run","docker run")),!t.startsWith("docker run"))return{dockerArgs:[],dockerEnvs:[],dockerImage:"",dockerCommand:""};const s=t.replace(/\\\n/g,"").replace(/\n/g," ").trim().match(/(?:[^\s"']+|'[^']*'|"[^"]*")+/g);if(!s)return{dockerArgs:[],dockerEnvs:[],dockerImage:"",dockerCommand:""};const r=[],l=[];let c=0,i="",d="";const u=[];for(;c<s.length;){const p=s[c];if(!p){c++;continue}if(p==="docker"||p==="run"){c++;continue}if((p==="-e"||p==="--env")&&c+1<s.length){const m=s[c+1]||"",[f,...b]=m.split("=");if(f){const h=b.join("=").replace(/^['"]|['"]$/g,"");l.push({key:f,value:h})}c+=2;continue}if(p.startsWith("-")&&u.length===0){const m=p.indexOf("=");let f=p,b=null;m!==-1&&(f=p.substring(0,m),b=p.substring(m+1).replace(/^['"]|['"]$/g,""));const h=gn[f];if(!h){c+=2;continue}if(h==="--publish"){let j="";if(b)j=b,r.push({key:h,value:j});else if(c+1<s.length&&!(s[c+1]||"").startsWith("-")){j=(s[c+1]||"").replace(/^['"]|['"]$/g,""),r.push({key:h,value:j}),c+=2;continue}else{r.push({key:h,value:"true"}),c++;continue}c++;continue}if(b!==null){r.push({key:h,value:b}),c++;continue}else if(c+1<s.length&&!(s[c+1]||"").startsWith("-")){const j=(s[c+1]||"").replace(/^['"]|['"]$/g,"");r.push({key:h,value:j}),c+=2;continue}else{r.push({key:h,value:"true"}),c++;continue}}u.push(p),c++}i=u[0]||"",d=u.slice(1).join(" ");const x=[];for(const p of r)p.name="",p.path="",p.prefix="",p.protocol="",p.proxyBehavior="service",p.type="docker",!(jn.has(p.key)&&p.value==="true")&&x.push(p);for(const p of l)p.custom="",p.description="",p.secure=!1,p.shared=!1,p.required=!1;return{dockerArgs:wn(yn(x)),dockerEnvs:l,dockerImage:i,dockerCommand:d}}function vn({dockerArgs:t,dockerEnvs:o,dockerImage:s,dockerCommand:r}){if(t.length===0&&o.length===0&&!s)return"";const l=["docker run \\"],c=new Set(["--publish","--volume","--expose","--device","--mount","--label","--cap-add","--cap-drop","--add-host","--dns","--network-alias","--sysctl","--ulimit","--network"]);for(const i of t){const{key:d,value:u}=i;if(c.has(d))if(u==="true")l.push(` ${d} \\`);else{const x=/[\s"']/g.test(u)?`"${u}"`:u;l.push(` ${d} ${x} \\`)}else if(!l.some(x=>x.startsWith(` ${d}`)))if(u==="true")l.push(` ${d} \\`);else{const x=/[\s"']/g.test(u)?`"${u}"`:u;l.push(` ${d} ${x} \\`)}}for(const i of o){const{key:d,value:u}=i,x=/["']/g.test(u)?u:`"${u}"`;l.push(` -e ${d}=${x} \\`)}return s&&l.push(` ${s} \\`),r&&l.push(` ${r} \\`),l[l.length-1]?.endsWith(" \\")&&(l[l.length-1]=(l[l.length-1]||"").slice(0,-2)),l.join(`
193
+ `;function fs({text:t}){const{palette:o}=Po();return t?e.jsx(zr,{style:{backgroundColor:o.background.default,color:o.text.primary},wrapperElement:{"data-color-mode":"light"},source:gr.sanitize(t),rehypePlugins:[[Br,{target:"_blank"}]]}):e.jsx(Je,{Icon:Nt})}fs.propTypes={text:n.string.isRequired};function xs({params:t,setParams:o,paramsErrTip:s,loading:r,setParamsErrTip:l,readOnly:c}){const{t:i}=X(),[d,u]=k.useState(c?"preview":"write"),x=(p,m)=>{u(m)};return e.jsxs(a,{sx:{border:"1px solid transparent",borderRadius:2},children:[e.jsxs(a,{sx:{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center"},children:[e.jsx($,{variant:"h6",sx:{fontWeight:"bold"},children:i("common.introduction")}),e.jsxs(Ao,{value:d,onChange:x,"aria-label":"wrapped label tabs example",children:[e.jsx(ot,{value:"write",label:"Write"}),e.jsx(ot,{value:"preview",label:"Preview"})]})]}),e.jsx(a,{sx:{display:d==="write"?"block":"none",width:"100%",marginTop:3},children:e.jsx(ne,{disabled:r||c,sx:{border:"none"},placeholder:`Blocklet ${i("common.introduction")}`,autoComplete:"off",variant:"outlined",fullWidth:!0,multiline:!0,minRows:4,value:t.blockletIntroduction||"",onChange:p=>{l({blockletIntroduction:""}),o({blockletIntroduction:p.target.value.slice(0,me.PROJECT.MAX_INTRO_LENGTH)})},error:!!s.blockletIntroduction,helperText:s.blockletIntroduction||"",slotProps:{input:{"data-cy":"export-blocklet-introduction",readOnly:c,endAdornment:e.jsxs(Xe,{position:"end",children:[t?.blockletIntroduction?.length||0," / ",me.PROJECT.MAX_INTRO_LENGTH]})}}})}),e.jsx(a,{sx:{display:d==="preview"?"block":"none",mt:3},children:e.jsx(fs,{text:t.blockletIntroduction||""})})]})}xs.propTypes={params:n.object.isRequired,setParams:n.func.isRequired,paramsErrTip:n.object.isRequired,setParamsErrTip:n.func.isRequired,readOnly:n.bool.isRequired,loading:n.bool.isRequired};function gs({step:t=0,ok:o=!1,active:s=0,error:r="",warning:l=!1}){let c="grey.500",i=t+1;return o&&(i=e.jsx(Lo,{sx:{fontSize:18,margin:0},color:"white"})),r||!o&&s>t?(c="error.main",i=e.jsx(Gt,{sx:{fontSize:18,margin:0},color:"white"})):l?(c="warning.main",i=e.jsx(Gt,{sx:{fontSize:18,margin:0},color:"white"})):s>=t&&(c="primary.main"),e.jsx(a,{sx:{width:24,height:24,bgcolor:c,borderRadius:"100%",color:"white",display:"flex",justifyContent:"center",fontWeight:"bold",fontSize:14,alignItems:"center"},children:i})}gs.propTypes={step:n.number,ok:n.bool,active:n.number,error:n.string,warning:n.bool};function ks({steps:t,activeStep:o,setActiveStep:s,hasSelectedResources:r=!1,params:l,loading:c,paramsErrTip:i,warning:d,viewMode:u="",projectId:x}){const{t:p}=X(),m=()=>{s(j=>j+1)},f=()=>{s(j=>j-1)},b=j=>j===0?i?.blockletTitle||i?.projectId||i?.blockletDescription||i?.blockletHomepage||i?.blockletSupport||i?.blockletCommunity||i?.blockletRepository:j===2?i?.blockletResource||i?.blockletDocker||i?.dockerImageName:j>=4?i?.blockletVersion||i?.note:"",h=u||ns({params:l,projectId:x,t:p})===null;return e.jsxs(a,{sx:{width:300,maxWidth:300,minWidth:300,padding:2,border:"1px solid",borderColor:"divider",borderRadius:1},children:[e.jsx(lr,{activeStep:o,orientation:"vertical",children:t.map((j,v)=>{const g={},C=c||!pn({params:l,projectId:x,step:v,t:p}),D=c?"":b(v);return D&&(g.optional=e.jsx($,{variant:"caption",color:"error",sx:{wordBreak:"break-word"},children:D}),g.error=!0),e.jsxs(ir,{children:[e.jsx(cr,{icon:e.jsx(gs,{error:D,warning:v===0?d.hasWarning:!1,active:h?99:o,step:v,ok:C}),sx:{cursor:"pointer",color:D?"error.main":"inherit"},disabled:!1,onClick:()=>s(v),...g,children:e.jsx($,{fontSize:"14px",fontWeight:"500",color:D||!C&&o>v?"error.main":"inherit",children:j.label})}),e.jsxs(ar,{children:[e.jsx($,{fontSize:12,children:j.description}),!h&&e.jsx(a,{sx:{mb:2},children:e.jsxs("div",{children:[v<t.length-1&&e.jsx(G,{variant:"contained",onClick:m,sx:{mt:1,mr:1},disabled:D||!C,children:p("common.continue")}),v>0&&e.jsx(G,{disabled:v===0,onClick:f,sx:{mt:1,mr:1},children:p("common.back")})]})})]})]},j.label)})}),o>=t.length-1&&e.jsx(Lt,{square:!0,elevation:0,sx:{p:3},children:e.jsx($,{fontSize:12,sx:{opacity:.5},children:"Click right top button to release"})})]})}ks.propTypes={steps:n.array.isRequired,activeStep:n.number.isRequired,setActiveStep:n.func.isRequired,params:n.object.isRequired,viewMode:n.oneOfType([n.string,n.bool]),loading:n.bool.isRequired,projectId:n.string.isRequired,hasSelectedResources:n.oneOfType([n.string,n.bool]),warning:n.object.isRequired,paramsErrTip:n.shape({projectId:n.string,blockletVersion:n.string,blockletTitle:n.string,blockletDescription:n.string,note:n.string,blockletResource:n.string,blockletHomepage:n.string,blockletSupport:n.string,blockletCommunity:n.string,blockletRepository:n.string,blockletDocker:n.object,dockerImageName:n.string}).isRequired};const mn=[".zip",".gz"],bn=1024*1024*100,fn=k.lazy(()=>_o(()=>import("./index-D8_V9EUB.js"),__vite__mapDeps([0,1,2]),import.meta.url).then(t=>({default:t.Uploader})));function js({app:t,projectId:o,readOnly:s,params:r,setParams:l,setParamsErrTip:c,error:i}){const{t:d,locale:u}=X(),x=k.useRef(null),p=()=>s?!1:!o||o===F.UNOWNED_DID?(W.error(d("blocklet.publish.errorTip.noFirstDid")),!1):!0,m=`${F.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${t.meta.did}/${o}/resource/upload`;return e.jsxs(a,{sx:{mt:3},children:[e.jsx($,{gutterBottom:!0,children:d("blocklet.publish.resourceUpload")}),e.jsxs(Re,{direction:"row",spacing:1,sx:{alignItems:"center",flex:1,cursor:s?"default":"pointer"},children:[!!r.uploadedResource&&e.jsx($,{component:"a",href:`${m}/params.uploadedResource`,children:r.uploadedResource}),!s&&e.jsx(G,{variant:"outlined",size:"small",onClick:()=>{p()&&x.current?.open()},children:r.uploadedResource?d("common.change"):d("common.upload")})]}),e.jsx(k.Suspense,{fallback:e.jsx(Ge,{}),children:e.jsx(fn,{ref:x,locale:u,popup:!0,onUploadFinish:f=>{l({uploadedResource:f.data.filename}),c({blockletResource:""}),x.current?.close()},plugins:["ImageEditor"],installerProps:{disabled:!0},apiPathProps:{uploader:m,disableMediaKitPrefix:!0,disableMediaKitStatus:!0},coreProps:{restrictions:{allowedFileExts:mn,maxFileSize:bn,maxNumberOfFiles:1}}},"uploader-resource")}),!!i&&e.jsx(a,{sx:{color:"error.main",mt:1,fontSize:14},children:i})]})}js.propTypes={app:n.object.isRequired,projectId:n.string.isRequired,readOnly:n.bool.isRequired,params:n.object.isRequired,setParams:n.func.isRequired,error:n.string.isRequired,setParamsErrTip:n.func.isRequired};function Tt({readOnly:t,params:o,setParams:s,paramsErrTip:r,setParamsErrTip:l,loading:c}){const{t:i}=X();return e.jsx(a,{className:"section",sx:{display:"flex",mt:3},children:e.jsxs(a,{sx:{flex:1},children:[e.jsx(ne,{required:!0,disabled:c||t,label:`Blocklet ${i("common.version")}`,placeholder:`Blocklet ${i("common.version")}`,autoComplete:"off",variant:"outlined",fullWidth:!0,value:o.blockletVersion||"",onChange:d=>{l({blockletVersion:""}),s({blockletVersion:d.target.value})},error:!!r.blockletVersion,helperText:r.blockletVersion||"",slotProps:{input:{"data-cy":"blocklet-version",readOnly:t}}}),e.jsx(ne,{label:i("blocklet.publish.releaseNote"),autoComplete:"off",disabled:c||t,variant:"outlined",fullWidth:!0,multiline:!0,minRows:4,required:!0,value:o.note||"",onChange:d=>{l({note:""}),s({note:d.target.value.slice(0,me.PROJECT.MAX_NOTE_LENGTH)})},error:!!r.note,helperText:r.note||"",sx:{mt:3},slotProps:{input:{"data-cy":"release-note",readOnly:t,endAdornment:e.jsxs(Xe,{position:"end",children:[o?.note?.length||0," / ",me.PROJECT.MAX_NOTE_LENGTH]})}}})]})})}Tt.propTypes={readOnly:n.bool.isRequired,params:n.object.isRequired,setParams:n.func.isRequired,paramsErrTip:n.object.isRequired,setParamsErrTip:n.func.isRequired,loading:n.bool.isRequired};function ys(t){for(const o in t)typeof t[o]=="string"?t[o]=t[o].replace(/\\\\/g,"\\"):typeof t[o]=="object"&&t[o]!==null&&ys(t[o]);return t}var xn=Wr();const oe=xo(xn),gn={"-a":"--attach","-d":"--detach","-e":"--env","-h":"--hostname","-i":"--interactive","-it":"-it","-rm":"-rm","-m":"--memory","-p":"--publish","-P":"--publish-all","-l":"--label","-n":"--name","-q":"--quiet","-x":"--x-registry","-t":"--tty","-u":"--user","-v":"--volume","-w":"--workdir","-cgroupns":"--cgroupns","-cpus":"--cpus","-g":"--gpus","-ip6":"--ip6","--read-only":"--read-only","--add-host":"--add-host","--attach":"--attach","--blkio-weight":"--blkio-weight","--blkio-weight-device":"--blkio-weight-device","--cap-add":"--cap-add","--cap-drop":"--cap-drop","--cgroup-parent":"--cgroup-parent","--cidfile":"--cidfile","--cpu-period":"--cpu-period","--cpu-quota":"--cpu-quota","--cpu-rt-period":"--cpu-rt-period","--cpu-rt-runtime":"--cpu-rt-runtime","--cpu-shares":"--cpu-shares","--cpus":"--cpus","--cpuset-cpus":"--cpuset-cpus","--cpuset-mems":"--cpuset-mems","--detach":"--detach","--detach-keys":"--detach-keys","--device":"--device","--device-cgroup-rule":"--device-cgroup-rule","--device-read-bps":"--device-read-bps","--device-read-iops":"--device-read-iops","--device-write-bps":"--device-write-bps","--device-write-iops":"--device-write-iops","--disable-content-trust":"--disable-content-trust","--dns":"--dns","--dns-opt":"--dns-opt","--dns-search":"--dns-search","--domainname":"--domainname","--entrypoint":"--entrypoint","--env":"--env","--env-file":"--env-file","--expose":"--expose","--gpus":"--gpus","--group-add":"--group-add","--health-cmd":"--health-cmd","--health-interval":"--health-interval","--health-retries":"--health-retries","--health-start-period":"--health-start-period","--health-timeout":"--health-timeout","--help":"--help","--hostname":"--hostname","--init":"--init","--interactive":"--interactive","--ip":"--ip","--ip6":"--ip6","--ipc":"--ipc","--isolation":"--isolation","--kernel-memory":"--kernel-memory","--label":"--label","--label-file":"--label-file","--link":"--link","--link-local-ip":"--link-local-ip","--log-driver":"--log-driver","--log-opt":"--log-opt","--mac-address":"--mac-address","--memory":"--memory","--memory-reservation":"--memory-reservation","--memory-swap":"--memory-swap","--memory-swappiness":"--memory-swappiness","--mount":"--mount","--name":"--name","--network":"--network","--network-alias":"--network-alias","--no-healthcheck":"--no-healthcheck","--oom-kill-disable":"--oom-kill-disable","--oom-score-adj":"--oom-score-adj","--pid":"--pid","--pids-limit":"--pids-limit","--platform":"--platform","--privileged":"--privileged","--publish":"--publish","--publish-all":"--publish-all","--pull":"--pull","--restart":"--restart","--rm":"--rm","--runtime":"--runtime","--security-opt":"--security-opt","--shm-size":"--shm-size","--stop-signal":"--stop-signal","--stop-timeout":"--stop-timeout","--storage-opt":"--storage-opt","--sysctl":"--sysctl","--tmpfs":"--tmpfs","--tty":"--tty","--ulimit":"--ulimit","--user":"--user","--userns":"--userns","--uts":"--uts","--volume":"--volume","--volume-driver":"--volume-driver","--volumes-from":"--volumes-from","--workdir":"--workdir"},Ut={"--env":!0,"--publish":!0,"--volume":!0,"--attach":!0,"--quiet":!0,"--entrypoint":!0,"--workdir":!0,"--cidfile":!0,"--detach-keys":!0,"--disable-content-trust":!0,"--domainname":!0,"--expose":!0,"--ip":!0,"--link-local-ip":!0,"--platform":!0},kn={"--volume":!0,"--publish":!0},jn=new Set(["--publish","--volume"]),ws=t=>{const[o]=t.split(":");return o?.startsWith("/")||o?.startsWith("./")||o?.startsWith("../")||o?.startsWith("~")||o?.startsWith("$BLOCKLET")};function yn(t){return t.map(o=>{if(o.key!=="--volume"||o.value.startsWith("$BLOCKLET_APP_DIR/")||o.value.startsWith("$BLOCKLET_DATA_DIR/"))return o;const[s,...r]=o.value.split(":");if(!s||!ws(o.value))return o;const l=s.startsWith("/")?`$BLOCKLET_DATA_DIR${s}`:`$BLOCKLET_DATA_DIR/${s}`;return{...o,value:[l,...r].join(":")}})}function wn(t){let o=!0;return t.find(r=>r.key==="--publish"&&r.type==="web")?t.map(r=>{if(r.key==="--publish"){const l={...r,type:o?"docker":r.type};return o=r.type==="web",l}return r}):t.map(r=>{if(r.key==="--publish"){const l={...r,type:o?"web":"docker"};return o=!1,l}return r})}function ho(t){if(!t)return{dockerArgs:[],dockerEnvs:[],dockerImage:"",dockerCommand:""};if(t=t.trim(),t.startsWith("$ docker run")&&(t=t.replace("$ docker run","docker run")),!t.startsWith("docker run"))return{dockerArgs:[],dockerEnvs:[],dockerImage:"",dockerCommand:""};const s=t.replace(/\\\n/g,"").replace(/\n/g," ").trim().match(/(?:[^\s"']+|'[^']*'|"[^"]*")+/g);if(!s)return{dockerArgs:[],dockerEnvs:[],dockerImage:"",dockerCommand:""};const r=[],l=[];let c=0,i="",d="";const u=[];for(;c<s.length;){const p=s[c];if(!p){c++;continue}if(p==="docker"||p==="run"){c++;continue}if((p==="-e"||p==="--env")&&c+1<s.length){const m=s[c+1]||"",[f,...b]=m.split("=");if(f){const h=b.join("=").replace(/^['"]|['"]$/g,"");l.push({key:f,value:h})}c+=2;continue}if(p.startsWith("-")&&u.length===0){const m=p.indexOf("=");let f=p,b=null;m!==-1&&(f=p.substring(0,m),b=p.substring(m+1).replace(/^['"]|['"]$/g,""));const h=gn[f];if(!h){c+=2;continue}if(h==="--publish"){let j="";if(b)j=b,r.push({key:h,value:j});else if(c+1<s.length&&!(s[c+1]||"").startsWith("-")){j=(s[c+1]||"").replace(/^['"]|['"]$/g,""),r.push({key:h,value:j}),c+=2;continue}else{r.push({key:h,value:"true"}),c++;continue}c++;continue}if(b!==null){r.push({key:h,value:b}),c++;continue}else if(c+1<s.length&&!(s[c+1]||"").startsWith("-")){const j=(s[c+1]||"").replace(/^['"]|['"]$/g,"");r.push({key:h,value:j}),c+=2;continue}else{r.push({key:h,value:"true"}),c++;continue}}u.push(p),c++}i=u[0]||"",d=u.slice(1).join(" ");const x=[];for(const p of r)p.name="",p.path="",p.prefix="",p.protocol="",p.proxyBehavior="service",p.type="docker",!(jn.has(p.key)&&p.value==="true")&&x.push(p);for(const p of l)p.custom="",p.description="",p.secure=!1,p.shared=!1,p.required=!1;return{dockerArgs:wn(yn(x)),dockerEnvs:l,dockerImage:i,dockerCommand:d}}function vn({dockerArgs:t,dockerEnvs:o,dockerImage:s,dockerCommand:r}){if(t.length===0&&o.length===0&&!s)return"";const l=["docker run \\"],c=new Set(["--publish","--volume","--expose","--device","--mount","--label","--cap-add","--cap-drop","--add-host","--dns","--network-alias","--sysctl","--ulimit","--network"]);for(const i of t){const{key:d,value:u}=i;if(c.has(d))if(u==="true")l.push(` ${d} \\`);else{const x=/[\s"']/g.test(u)?`"${u}"`:u;l.push(` ${d} ${x} \\`)}else if(!l.some(x=>x.startsWith(` ${d}`)))if(u==="true")l.push(` ${d} \\`);else{const x=/[\s"']/g.test(u)?`"${u}"`:u;l.push(` ${d} ${x} \\`)}}for(const i of o){const{key:d,value:u}=i,x=/["']/g.test(u)?u:`"${u}"`;l.push(` -e ${d}=${x} \\`)}return s&&l.push(` ${s} \\`),r&&l.push(` ${r} \\`),l[l.length-1]?.endsWith(" \\")&&(l[l.length-1]=(l[l.length-1]||"").slice(0,-2)),l.join(`
194
194
  `)}const vs={"--volume":t=>{const[o]=t.split(":");return o?ws(t)&&!t.startsWith("$BLOCKLET_APP_DIR/")&&!t.startsWith("$BLOCKLET_DATA_DIR/")?"Volume must start with $BLOCKLET_APP_DIR or $BLOCKLET_DATA_DIR":t.indexOf("..")>-1?'Volume cannot contain ".."':"":"Volume must start with key:value"}},Qe=t=>t.replace(/^[-]+/,"").replace(/-([a-z])/g,(r,l)=>l.toUpperCase()),Cn=t=>`--${t.replace(/([A-Z])/g,"-$1").toLowerCase()}`,Rn=[" -- ","~","&","|",">","<","{","}","[","]",";","$","!","*","%","&&","||",","],Sn=["rm ","sudo "];function Cs(t){if(t==="")return;if(/(\n|\\n|\\\n|\t|\\t|\\\t)/.test(t))throw new Error("Docker CMD is invalid");const s=t.toLocaleLowerCase();if(Sn.some(l=>s.indexOf(l)!==-1))throw new Error("Docker CMD is invalid");if(Rn.some(l=>t.indexOf(l)!==-1))throw new Error("Docker CMD is invalid");if(!/^(?:(?:[a-zA-Z0-9\-_.\/:=\s]+)|(?:\@{1,2}[a-zA-Z_][a-zA-Z0-9_]*))+$/.test(t))throw new Error("Docker CMD is invalid")}const Tn=Array.from(new Set(Object.keys(Ut).map(Qe))),Dn=["publish","volume"];oe.object({workdir:oe.string().trim().optional(),image:oe.string().trim().regex(/^[^\s]+$/).optional(),shell:oe.string().trim().optional(),volumes:oe.array().items(oe.string().trim()).optional(),script:oe.string().trim().optional(),installNodeModules:oe.boolean().optional(),skipWrapDockerfile:oe.boolean().optional(),command:oe.string().allow("").default("").optional().custom((t,o)=>{try{return Cs(t),t}catch(s){return o.error("any.invalid",{message:s.message})}},"Docker CMD validation"),runBaseScript:oe.boolean().optional(),...Tn.reduce((t,o)=>{const s=vs[Cn(o)];return Dn.includes(o)?(t[o]=oe.array().items(oe.string().trim()).optional(),s?t[o]=oe.array().items(oe.string().trim().custom((r,l)=>{const c=s(r);return c?l.message(c):r})).optional():t[o]=oe.array().items(oe.string().trim()).optional(),t):(s?t[o]=oe.string().trim().custom((r,l)=>{const c=s(r);return c?l.message(c):r}).optional():t[o]=oe.string().trim().optional(),t)},{})}).optional();function Dt({index:t,item:o,dockerParams:s,setDockerParams:r,dataKey:l,t:c,readOnly:i}){const d=o?.value||"",[u,x]=k.useState(!1),p=()=>{s[l]?.splice(t,1),r({...s,[l]:[...s[l]]})},m=(P,A)=>{s[l]?.[t]&&(A?(s[l][t].custom=s[l][t].value,s[l][t].value=`$${Qe(o.key)}`):(s[l][t].value=s[l][t].custom||"",s[l][t].custom="")),r({...s,[l]:[...s[l]]})},f=(P,A)=>{const w=s[l][t]?.value||"";s[l][t]={...s[l][t],secure:A,value:A&&w===me.BLOCKLET_AUTOMATIC_ENV_VALUE?"":w},r({...s,[l]:[...s[l]]})},b=(P,A)=>{s[l][t]={...s[l][t],shared:A},r({...s,[l]:[...s[l]]})},h=(P,A)=>{const w=s[l][t]?.value||"";s[l][t]={...s[l][t],required:A,value:A&&w===me.BLOCKLET_AUTOMATIC_ENV_VALUE?"":w},r({...s,[l]:[...s[l]]})},j=(P,A)=>{s[l][t]={...s[l][t],value:A?me.BLOCKLET_AUTOMATIC_ENV_VALUE:"",secure:!1,required:!1},r({...s,[l]:[...s[l]]})},v=P=>{s[l][t]={...s[l][t],description:P.target.value},r({...s,[l]:[...s[l]]})},g=P=>{const A=P.target.value==="web"?"web":"docker";A==="web"&&s.dockerArgs.forEach(Z=>{Z.type="docker"});const S=`/${s.dockerImage.replace(/\W/g,"-")}-${t}`;s.dockerArgs[t]={...s.dockerArgs[t],type:A,path:A==="docker"?S:"/",protocol:"http",prefix:A==="docker"?S:"/",name:"publicUrl",port:"BLOCKLET_PORT"},r({...s,dockerArgs:[...s.dockerArgs]})},C=P=>{s.dockerArgs[t]={...s.dockerArgs[t],proxyBehavior:P.target.value==="direct"?"direct":"service"},r({...s,dockerArgs:[...s.dockerArgs]})},D=P=>{const A=P.target.value;s[l][t]={...s[l][t],prefix:A,path:A==="*"?"/":A},r({...s,[l]:[...s[l]]})},R=P=>{s[l]?.[t]&&(s[l][t].value=P.target.value),r({...s,[l]:[...s[l]]})},y=d===`$${Qe(o.key)}`||o.custom,T=l==="dockerArgs"&&!Ut[o.key],O=kn[o.key],N=l==="dockerEnvs",z=o.key==="--publish";let K=o.key;return z&&o.type==="web"?K="--publish (Web)":N&&(K=`--env ${o.key}`),e.jsxs(a,{sx:{display:"flex",flexDirection:"row",gap:2,alignItems:"center"},children:[e.jsx(a,{sx:{width:250},children:e.jsx($,{sx:{textOverflow:"ellipsis",width:"100%",overflow:"hidden"},children:K})}),e.jsxs(a,{sx:{display:"flex",flexDirection:"column",gap:1,flex:1},children:[e.jsx(ne,{disabled:i||y||T||o.value===me.BLOCKLET_AUTOMATIC_ENV_VALUE,placeholder:"",value:y?`$${Qe(o.key)}`:d,sx:{flex:1},error:T,onChange:R,slotProps:{input:{endAdornment:e.jsxs(Xe,{position:"end",sx:{zoom:.9},children:[(!(O||T)||N||z)&&e.jsx(ce,{onClick:()=>x(!0),children:e.jsx(ae,{icon:"icon-park-outline:setting-config"})}),!i&&e.jsx(ce,{onClick:p,color:T?"error":"default",children:e.jsx(ae,{icon:"ic:round-delete"})})]})}}}),T&&e.jsx($,{variant:"caption",color:"error",children:c("blocklet.publish.docker.noAllowTheArg")}),o.key==="--publish"&&e.jsx($,{variant:"caption",sx:{color:"text.secondary"},children:c("blocklet.publish.docker.publishTips")}),o.key==="--volume"&&vs[o.key](d)&&e.jsx($,{variant:"caption",color:"error",children:c("blocklet.publish.docker.volumeTips")})]}),u&&e.jsx(ct,{open:!0,fullWidth:!0,maxWidth:"sm",PaperProps:{style:{minHeight:0}},title:c(N?"blocklet.publish.docker.modifyEnv":"blocklet.publish.docker.modifyParam"),onClose:()=>x(!1),children:e.jsxs(a,{sx:{display:"flex",flexDirection:"column",gap:1,paddingBottom:2},children:[O||T||N?null:e.jsxs(a,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx($,{children:c("blocklet.publish.docker.needCustomInput")}),e.jsx(Le,{disabled:i,checked:y,onChange:m,sx:{zoom:.9}})]}),N&&e.jsxs(a,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx($,{children:c("blocklet.publish.docker.shared")}),e.jsx(Le,{disabled:i,checked:o.shared,onChange:b,sx:{zoom:.9}})]}),N&&e.jsxs(a,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx($,{children:c("blocklet.publish.docker.required")}),e.jsx(Le,{disabled:i,checked:o.required,onChange:h,sx:{zoom:.9}})]}),N&&e.jsxs(a,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx($,{children:c("blocklet.publish.docker.secure")}),e.jsx(Le,{disabled:i,checked:o.secure,onChange:f,sx:{zoom:.9}})]}),N&&e.jsxs(a,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx($,{children:c("blocklet.publish.docker.autoGenerated")}),e.jsx(Le,{disabled:i,checked:o.value===me.BLOCKLET_AUTOMATIC_ENV_VALUE,onChange:j,sx:{zoom:.9}})]}),N&&e.jsxs(a,{sx:{mt:1,width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx($,{sx:{flex:1},children:c("blocklet.publish.docker.description")}),e.jsx(ne,{disabled:i,value:o.description,onChange:v,sx:{flex:1},label:c("blocklet.publish.docker.description")})]}),z&&e.jsxs(a,{sx:{mt:1,width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx($,{sx:{flex:1},children:c("blocklet.publish.docker.portType")}),e.jsxs(vt,{value:o.type||"docker",onChange:g,children:[e.jsx(be,{value:"docker",children:"Docker"}),e.jsx(be,{value:"web",children:"Web"})]})]}),z&&o.type==="web"&&e.jsxs(a,{sx:{mt:1,width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx($,{sx:{flex:1},children:c("blocklet.publish.docker.proxyBehavior")}),e.jsxs(vt,{value:o.proxyBehavior||"service",onChange:C,children:[e.jsx(be,{value:"service",children:c("blocklet.publish.docker.serviceProxy")}),e.jsx(be,{value:"direct",children:c("blocklet.publish.docker.directProxy")})]})]}),z&&o.type==="web"&&e.jsxs(a,{sx:{mt:1,width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx($,{sx:{flex:1},children:c("blocklet.publish.docker.prefix")}),e.jsx(ne,{disabled:i,value:o.prefix,onChange:D,sx:{flex:1},label:c("blocklet.publish.docker.prefix")})]})]})})]})}Dt.propTypes={dockerParams:n.object.isRequired,setDockerParams:n.func.isRequired,dataKey:n.string.isRequired,item:n.object.isRequired,t:n.func.isRequired,readOnly:n.bool.isRequired,index:n.number.isRequired};const In=`
195
195
  docker run --name postgrest
196
196
  -p 3000:3000
@@ -1,4 +1,4 @@
1
- import{j as e,ak as m,b4 as st,W as h,ar as L,cx as ot,a$ as it,T as N,c3 as at,c4 as lt,D as ct,V as dt,I as Oe,bb as oe,U as Z,n as ce,S as mt,cy as ut,Q as J,ai as gt,am as de,bf as pt,cb as xt,cc as ht,b1 as ze,b7 as ft,b8 as bt,b9 as vt,cz as yt,cA as jt,s as Ct,J as wt,c1 as Ot,z as me,bD as Ne,aX as St,a6 as Tt,bV as Pt,aj as It,y as Dt,x as kt,bc as Mt,M as zt}from"./vendor-mui-core-BPQ6AEW_.js";import{V as B,H as O,h as Be,z as Se,U as Re,i as _e,p as Rt,a2 as Et,b as ge,n as Ee}from"./vendor-ux-r9bApERu.js";import{r as C,i as qe,k as At}from"./vendor-react-CUXIiAnY.js";import{g as G,b as j,k as Ue,a as Wt,v as Lt,q as Nt,c as Bt}from"./vendor-hooks-PN9SWiQm.js";import{ar as ie,at as ae,c as Pe,_ as He,aA as _t,as as ue,Y as qt,b6 as Ut,o as Ht}from"./index-jPmRCtiq.js";import{u as Fe}from"./team-Caq5y5Xs.js";import{u as $e}from"./use-mobile-ajdJIsoX.js";import{A as Ft}from"./actions-DhSvOHy-.js";import{u as Je}from"./session-L__eR8rN.js";import{f as E}from"./index-DBs9Ljax.js";import{v as Ce}from"./index-ySP_m_Ux.js";import{e as Ve,A as $t,n as te}from"./vendor-utils-BgSaqjGx.js";import{F as Ae}from"./form-text-input-Sp9mVO8Z.js";import{e as Jt}from"./edit.svg-Dz9cVo7r.js";import{C as Vt}from"./lock.svg-BPCZ0CT3.js";import{D as Kt,a as Gt,b as Xt,M as Qt}from"./index-BmFAdUmE.js";import{c as Yt}from"./passport-DnUeoVIR.js";import{C as Zt}from"./click-to-copy-BuSTGPjJ.js";import{I as er}from"./invitations-DgB-ff90.js";function Ke({members:t,total:o}){return e.jsxs(m,{className:"members-avatar-group",sx:{display:"flex",alignItems:"center","& > *:not(:first-of-type)":{ml:-1}},children:[t.map((a,i)=>e.jsx(m,{sx:{position:"relative",zIndex:i},children:e.jsx(ie,{did:a.userDid,avatarSize:32,cardType:ae.AvatarOnly,showHoverCard:!1})},a.userDid)),o>5&&e.jsxs(st,{sx:{width:32,height:32,bgcolor:"grey",fontSize:14},children:["+",o-5]})]})}Ke.propTypes={members:h.array.isRequired,total:h.number.isRequired};function Ge({org:t={},loading:o=!1}){const{t:a,locale:i}=B();return t.id?o?e.jsxs(m,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(L,{variant:"text",width:50,height:24}),e.jsx(L,{variant:"text",width:20,height:24})]}):e.jsxs(ot,{"aria-label":"breadcrumb",children:[e.jsx(it,{underline:"hover",color:"inherit",href:`${Pe.WELLKNOWN_SERVICE_PATH_PREFIX}/user/orgs?locale=${i}`,children:a("common.orgs")}),e.jsx(N,{children:t.name})]}):null}Ge.propTypes={org:h.object.isRequired,loading:h.bool};function tr(t){if(!t)return"";if(/[\u4e00-\u9fa5]/.test(t.charAt(0)))return t.charAt(0);const o=t.trim().split(/\s+/);return o.length>1?o.slice(0,2).map(a=>a.charAt(0).toUpperCase()).join(""):t.charAt(0).toUpperCase()}function Xe({org:t,loading:o=!1}){return e.jsxs(m,{sx:{display:"flex",alignItems:"center",gap:2},children:[e.jsx(m,{sx:{width:56,height:56,borderRadius:1,backgroundColor:"grey.100",display:"flex",alignItems:"center",justifyContent:"center"},children:o?e.jsx(L,{variant:"text",width:25,height:25}):e.jsx(N,{sx:{fontSize:30,fontWeight:600},children:tr(t.name)})}),e.jsxs(m,{sx:{flex:1,display:"flex",flexDirection:"column",justifyContent:"space-between"},children:[e.jsx(N,{variant:"h4",sx:{overflow:"hidden",display:"-webkit-box",WebkitLineClamp:1,WebkitBoxOrient:"vertical",textOverflow:"ellipsis"},children:o?e.jsx(L,{variant:"text",width:"10%",height:24}):t.name||"-"}),e.jsx(N,{variant:"body1",sx:{fontSize:14,lineHeight:1.2,overflow:"hidden",display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical"},children:o?e.jsx(L,{variant:"text",width:"30%",height:24}):t.description||"-"})]})]})}Xe.propTypes={org:h.shape({name:h.string,description:h.string}).isRequired,loading:h.bool};function Ie({tabs:t,currentTab:o,onTabChange:a,loading:i=!1,extra:r=null}){return e.jsxs(m,{sx:{display:"flex",gap:1,alignItems:"center",justifyContent:"space-between",flexWrap:"wrap"},children:[i?e.jsx(L,{variant:"text",width:300,height:56}):e.jsx(at,{color:"primary",size:"small",value:o,exclusive:!0,onChange:(s,u)=>{u!==null&&a(u)},disabled:i,children:t.map(s=>e.jsx(lt,{size:"small",value:s.value,children:s.label},s.value))}),e.jsx(m,{children:r})]})}Ie.propTypes={tabs:h.array.isRequired,currentTab:h.string.isRequired,onTabChange:h.func.isRequired,loading:h.bool,extra:h.node};const Qe=C.createContext({}),{Provider:rr,Consumer:Rr}=Qe,we={type:"",org:{},paging:{page:1,pageSize:10}};function nr({children:t,editable:o=!0,mode:a="user-center",id:i=""}){const{t:r}=B(),{api:s}=He(),{teamDid:u}=Fe(),{session:b}=Je(),[g,y]=C.useState(!1),[I,d]=C.useState(0),[w,T]=C.useState(0),f=G({loading:!1,org:null,members:[],membersPaging:{page:1,pageSize:10},invitations:[],refresh:null,editable:!1,roles:[],error:null}),x=C.useMemo(()=>b?.user?.did,[b?.user?.did]),z=G({all:JSON.parse(JSON.stringify(we)),myCreated:JSON.parse(JSON.stringify({...we,type:"owned"})),myJoined:JSON.parse(JSON.stringify({...we,type:"joined"}))}),D=G({mode:"",org:null}),v=G({loading:!1,org:null,showInvite:!1,showInviting:!1,inviteLink:"",roles:[],mode:"list"}),S=G({mode:"create",item:null,loading:!1,org:null,visible:!1}),U=C.useMemo(()=>window.blocklet?.settings?.org||{},[]),{confirmApi:H,confirmHolder:X}=_t(),re=j(async({org:n={},type:c="",paging:p={page:1,pageSize:10}})=>{try{y(!0);const R=await s.getOrgs({input:{teamDid:u,paging:p,org:n,...c?{type:c}:{}}});return z.all={org:n,paging:p,type:c},R}catch(R){console.error(R),O.error(E(R));return}finally{y(!1)}}),M=j(async({org:n={},paging:c={page:1,pageSize:10}})=>{try{y(!0);const p=await s.getOrgs({input:{teamDid:u,paging:c,org:n,type:"owned"}});return d(p?.paging?.total||0),z.myCreated={org:n,paging:c,type:"owned"},p}catch(p){console.error(p),O.error(E(p));return}finally{y(!1)}}),A=j(async({org:n={},paging:c={page:1,pageSize:10}})=>{try{y(!0);const p=await s.getOrgs({input:{teamDid:u,paging:c,org:n,type:"joined"}});return z.myJoined={org:n,paging:c,type:"joined"},p}catch(p){console.error(p),O.error(E(p));return}finally{y(!1)}}),k=j(()=>{T(n=>n+1)}),F=j(async n=>{try{await s.deleteOrg({input:{teamDid:u,id:n.id}}),k()}catch(c){console.error(c),O.error(E(c))}}),pe=j(n=>new Promise((c,p)=>{H.open({title:r("team.orgs.deleteConfirm",{name:n.name}),content:r("team.orgs.deleteConfirmDescription"),confirmButtonText:r("common.delete"),cancelButtonText:r("common.cancel"),confirmButtonProps:{color:"error"},onConfirm:async R=>{await F(n),R(),c()},onCancel:()=>{p()}})})),xe=j(async n=>{try{await s.updateOrg({input:{teamDid:u,org:n}}),O.success(r("team.orgs.mutate.updateSuccess"))}catch(c){console.error(c),O.error(E(c))}}),ee=j(async n=>{try{await s.createOrg({input:{teamDid:u,name:n.name,description:n.description}}),O.success(r("team.orgs.mutate.createSuccess")),k()}catch(c){console.error(c),O.error(E(c))}}),V=j(async(n,c=f.membersPaging)=>{try{const p=await s.getOrgMembers({input:{teamDid:u,orgId:n,paging:c}});f.members=p.users,f.membersPaging=p.paging}catch(p){console.error(p),O.error(E(p))}}),ne=j(async(n,c={page:1,pageSize:10})=>{try{const p=await s.getInvitations({input:{teamDid:u,orgId:n,paging:c}});f.invitations=p.invitations}catch(p){console.error(p),O.error(E(p))}}),Q=j(async n=>{try{const c=await s.getRoles({input:{teamDid:u,orgId:n}});f.roles=c.roles,v.roles=c.roles}catch(c){console.error(c),O.error(E(c))}}),he=j(async(n,c)=>{try{await s.removeOrgMember({input:{teamDid:u,orgId:n,userDid:c}}),O.success(r("team.orgs.invite.removeSuccess")),Promise.all([V(n),ne(n)])}catch(p){console.error(p),O.error(E(p))}}),Y=j((n,c)=>{const{user:p,status:R}=c,$=R==="inviting";return new Promise((ye,le)=>{H.open({title:$?r("team.orgs.member.removeInvitingMember",{name:p.fullName}):r("team.orgs.member.removeMemberConfirm",{name:p.fullName}),content:$?r("team.orgs.member.removeInvitingMemberDescription",{name:p.fullName}):r("team.orgs.member.removeMemberConfirmDescription"),confirmButtonProps:{color:"error"},onConfirm:async je=>{await he(n,p.did),je(),ye()},onCancel:()=>{le()}})})}),se=j(async n=>{try{const c=await s.getOrg({input:{teamDid:u,id:n}});f.org=c.org,f.error=null,f.editable=o?c?.org?.ownerDid===x:!1}catch(c){f.error=E(c),console.error(c),O.error(E(c))}}),fe=j(n=>{if(!U?.enabled){O.error(r("team.orgs.mutate.orgNotEnabled"));return}D.org=n,D.mode="update"}),be=j(()=>{if(!U?.enabled){O.error(r("team.orgs.mutate.orgNotEnabled"));return}const{maxOrgPerUser:n=10}=U;if(n<=I){O.error(r("team.orgs.mutate.maxOrgPerUser",{maxOrgPerUser:n}));return}D.org={},D.mode="create"}),ve=j(({org:n,open:c=!1,mode:p="list"})=>{if(c&&n){if(v.org=n,v.mode=p,!U?.enabled){O.error(r("team.orgs.mutate.orgNotEnabled"));return}const{maxMemberPerOrg:R=100}=U;if(n.membersCount=n.membersCount||1,R<=(n?.membersCount??1)){O.error(r("team.orgs.mutate.maxMemberPerOrg",{maxMemberPerOrg:R}));return}Q(n.id)}else v.mode="list",v.org=null,v.roles=[],v.inviteLink="";v.showInvite=c}),Me=j(({org:n,open:c=!1})=>{v.showInviting=c,v.org=c?n:null}),K=j(()=>{D.org=null,D.mode=""}),l=j(async n=>{try{if(f.loading=!0,await se(n),f.error)return;f.editable?await Promise.all([V(n),ne(n),Q(n)]):await Promise.all([V(n),Q(n)])}catch(c){console.error(c)}finally{f.loading=!1}}),P=j(async({userDids:n,role:c,email:p,inviteType:R})=>{try{const{org:$}=v||{};if(!$)throw new Error(400,"Org is not found");v.loading=!0;const ye=await s.inviteMembersToOrg({input:{userDids:n,email:p,teamDid:u,orgId:$.id,role:c,inviteType:R}}),{failedDids:le,inviteLink:je}=ye.data||{};R==="external"?v.inviteLink=je:le.length?O.success(r("team.orgs.invite.failed",{count:le.length})):O.success(r("team.orgs.invite.success")),v.mode==="detail"?l($.id):k()}catch($){console.error($),O.error(E($))}finally{v.loading=!1}}),W=j(({org:n,mode:c="create",open:p=!1,item:R=null})=>{S.visible=p,S.org=p?n:null,S.mode=p?c:"create",S.item=p&&c==="update"?R:null});C.useEffect(()=>{i&&l(i)},[i,l]);const q={editable:o,refresh:k,refreshTrigger:w,loading:g,mode:a,teamDid:u,onTriggerEditOrg:fe,onTriggerCreateOrg:be,onCancelMutateOrg:K,mutationParams:D,inviteParams:{...v,onTriggerInviteDialog:ve,onTriggerInvitingDialog:Me},orgDetail:{...f,refresh:l},passportParams:{...S,onTriggerPassportDialog:W},requests:{getAllOrgs:re,getMyCreatedOrgs:M,getMyJoinedOrgs:A,deleteOrg:pe,updateOrg:xe,createOrg:ee,getOrgMembers:V,getOrgInvitations:ne,removeOrgMember:Y,getOrg:se,inviteMembers:P,getOrgRoles:Q}};return e.jsxs(rr,{value:q,children:[t,X]})}function _(){return C.useContext(Qe)}function Ye({index:t=0}){const o=[{name:"75%",info:"45%",detail:"60%"},{name:"65%",info:"55%",detail:"40%"},{name:"90%",info:"30%",detail:"65%"}],a=o[t%o.length];return e.jsxs(mt,{sx:{px:0,py:1},children:[e.jsx(ut,{children:e.jsx(L,{variant:"circular",width:32,height:32})}),e.jsxs(m,{sx:{flex:1},children:[e.jsx(L,{variant:"text",width:a.name,height:20,sx:{mb:.5}}),e.jsx(L,{variant:"text",width:a.info,height:16,sx:{mb:.25}})]})]})}Ye.propTypes={index:h.number};function sr(){const{t,locale:o}=B(),{orgDetail:a,requests:i}=_(),{org:r,members:s,loading:u,editable:b,membersPaging:g}=a||{},y=ct(),I=(T,f)=>{f==="changePage"&&(g.page=T.page+1,i.getOrgMembers(r.id,g)),f==="changeRowsPerPage"&&(g.page=1,g.pageSize=T.rowsPerPage,i.getOrgMembers(r.id,g))},d=[{name:"user",label:" ",options:{filter:!1,sort:!1,setCellHeaderProps:()=>({style:{display:"none"}}),setCellProps:()=>({style:{width:"33.33%"}}),customBodyRender:(T,f)=>{const x=s[f.rowIndex];if(!x||!x.user)return null;const{user:z}=x,D=x.userDid===r.ownerDid;return e.jsx(m,{sx:{py:{xs:.5,sm:1}},children:e.jsx(ie,{avatarSize:32,user:z,showDid:!0,cardType:ae.Detailed,infoType:ue.Minimal,sx:{border:0,padding:0},showHoverCard:!1,renderTopRightContent:b&&!D?()=>e.jsx(m,{sx:{display:{xs:"block",sm:"none"}},children:e.jsx(Oe,{size:"small",color:"error","aria-label":"delete",title:t("team.orgs.invite.remove"),onClick:v=>{v.stopPropagation(),i.removeOrgMember(r.id,x)},children:e.jsx(oe,{fontSize:"small"})})}):void 0})})}}},{name:"status",label:" ",options:{filter:!1,sort:!1,setCellHeaderProps:()=>({style:{display:"none"}}),setCellProps:()=>({style:{width:"33.33%"}}),customBodyRender:(T,f)=>{const x=s[f.rowIndex];if(!x||!x.user)return null;const{user:z}=x,{passports:D=[]}=z;return e.jsxs(m,{sx:{display:"flex",flexDirection:{xs:"column",sm:"row"},gap:.5,alignItems:"flex-start",py:{xs:.5,sm:1}},children:[e.jsxs(m,{sx:{display:{xs:"flex",sm:"none"},flexDirection:"row",gap:.5,alignItems:"center",flexWrap:"nowrap",overflow:"auto",maxWidth:"100%"},children:[D.map(v=>e.jsx(Z,{label:v.title,size:"small",sx:{flexShrink:0}},v.id)),x.status==="inviting"?e.jsx(Z,{label:t("common.inviting"),size:"small",sx:{backgroundColor:ce(y.palette.warning.main,.15),color:y.palette.warning.dark,flexShrink:0}}):e.jsx(Z,{label:t("team.orgs.active"),size:"small",sx:{backgroundColor:ce(y.palette.success.main,.15),color:y.palette.success.dark,flexShrink:0}}),x.updatedAt&&e.jsxs(N,{variant:"caption",color:"text.secondary",sx:{whiteSpace:"nowrap",flexShrink:0},children:[x.status==="inviting"?t("team.orgs.invitedAt"):t("team.orgs.joinedAt")," ",e.jsx(Se,{value:x.updatedAt})]})]}),e.jsxs(m,{sx:{display:{xs:"none",sm:"flex"},flexDirection:"row",gap:.5,alignItems:"center"},children:[D.map(v=>e.jsx(Z,{label:v.title,size:"small"},v.id)),x.status==="inviting"?e.jsx(Z,{label:t("common.inviting"),size:"small",sx:{backgroundColor:ce(y.palette.warning.main,.15),color:y.palette.warning.dark}}):e.jsx(Z,{label:t("team.orgs.active"),size:"small",sx:{backgroundColor:ce(y.palette.success.main,.15),color:y.palette.success.dark}})]})]})}}},{name:"updatedAt",label:" ",options:{filter:!1,sort:!1,setCellHeaderProps:()=>({style:{display:"none"}}),setCellProps:()=>({style:{width:"33.33%"}}),customBodyRender:(T,f)=>{const x=s[f.rowIndex];return!x||!x.updatedAt?null:e.jsx(m,{sx:{py:{xs:.5,sm:1},display:{xs:"none",sm:"flex"},flexDirection:"column",gap:.5,minWidth:0},children:e.jsxs(N,{variant:"caption",color:"text.secondary",sx:{whiteSpace:"nowrap"},children:[x.status==="inviting"?t("team.orgs.invitedAt"):t("team.orgs.joinedAt"),e.jsx(Se,{value:x.updatedAt})]})})}}},{name:"actions",label:" ",options:{filter:!1,sort:!1,setCellHeaderProps:()=>({style:{display:"none"}}),setCellProps:()=>({style:{width:"80px",minWidth:"80px",maxWidth:"80px"}}),customBodyRender:(T,f)=>{const x=s[f.rowIndex];if(!x||!x.user)return null;const z=x.userDid===r.ownerDid;return!b||z?null:e.jsx(m,{sx:{py:{xs:.5,sm:1},display:{xs:"none",sm:"block"}},children:e.jsx(Oe,{color:"error","aria-label":"delete",title:t("team.orgs.invite.remove"),onClick:()=>i.removeOrgMember(r.id,x),children:e.jsx(oe,{})})})}}}],w={sort:!1,download:!1,filter:!1,print:!1,search:!1,viewColumns:!1,selectableRows:"none",expandableRowsOnClick:!1,page:g.page-1,rowsPerPage:g.pageSize,count:g.total||0,pagination:g.pageCount>1};return u?e.jsx(m,{className:"members-list",children:e.jsx(dt,{sx:{width:"100%",bgcolor:"background.paper"},children:Array.from({length:3},(T,f)=>e.jsx(Ye,{index:f},`skeleton-${f}`))})}):e.jsx(m,{className:"members-list",sx:{width:"100%","& .org-members-table > div":{overflow:"hidden"},"& .MuiPaper-root":{overflow:{xs:"hidden",sm:"auto"}},"& table":{width:{xs:"100%",sm:"auto"},tableLayout:{xs:"fixed",sm:"auto"}},"& .MuiTableRow-root .MuiTableCell-root":{py:{xs:.5,sm:1}},"& tbody tr":{display:{xs:"grid",sm:"table-row"},gridTemplateColumns:{xs:"1fr",sm:"auto"},gridTemplateRows:{xs:"auto auto",sm:"auto"},"& td":{display:{xs:"block !important",sm:"table-cell !important"},"&:nth-of-type(1)":{gridColumn:{xs:"1",sm:"auto"},gridRow:{xs:"1",sm:"auto"}},"&:nth-of-type(2)":{gridColumn:{xs:"1",sm:"auto"},gridRow:{xs:"2",sm:"auto"},minWidth:{xs:0,sm:"auto"}},"&:nth-of-type(3), &:nth-of-type(4)":{display:{xs:"none !important",sm:"table-cell !important"}}}}},children:e.jsx(Be,{className:"org-members-table",data:s,columns:d,loading:u,onChange:I,locale:o,options:w})})}function or(){const{t}=B(),{orgDetail:o,inviteParams:a}=_(),{invitations:i,editable:r,org:s}=o||{};return r?e.jsxs(m,{sx:{display:"flex",gap:1},children:[e.jsxs(J,{variant:"outlined",style:{flexShrink:0},color:"primary",size:"small",onClick:()=>{a.onTriggerInvitingDialog({org:s,open:!0})},children:[e.jsx(Re,{style:{height:"1em",marginRight:4},icon:"tabler:user"}),t("common.inviting"),i.length?` (${i.length})`:""]}),e.jsx(J,{variant:"contained",size:"small",onClick:()=>{a.onTriggerInviteDialog({org:s,open:!0,mode:"detail"})},startIcon:e.jsx(Re,{style:{fontSize:14},icon:"tabler:user-plus"}),children:t("common.invite")})]}):null}function De({children:t,...o}){const a=$e(),[i,r]=C.useState(!1),s=j(()=>{r(!i)});return C.useEffect(()=>{r(!1)},[a]),a?e.jsx(gt,{onClickAway:()=>r(!1),children:e.jsx(de,{...o,disableFocusListener:!0,disableHoverListener:!0,disableTouchListener:!0,slotProps:{popper:{disablePortal:!0}},open:i,onClose:s,children:C.cloneElement(t,{onClick:s})})}):e.jsx(de,{...o,children:t})}De.propTypes=de.propTypes;De.defaultProps=de.defaultProps;function ir(){const{orgDetail:t,requests:o}=_(),{org:a,loading:i,editable:r}=t||{},{t:s,locale:u}=B(),b=qe(),g=C.useMemo(()=>{const{settings:d={}}=window.blocklet||{};return Ve(d,"org.maxMemberPerOrg",100)},[]),y=j(async(d,w)=>{const T={...$t(a,["id","name","description"]),[d]:w};await o.updateOrg(T),t.refresh(T.id)}),I=j(async()=>{await o.deleteOrg(a),b(`${Pe.WELLKNOWN_SERVICE_PATH_PREFIX}/user/orgs?locale=${u}`)});return e.jsxs(m,{children:[e.jsxs(m,{sx:{display:"grid",gridTemplateColumns:"1fr",gap:2},children:[e.jsx(Ce,{valueComponent:"div",nameWidth:180,name:s("team.orgs.mutate.name"),children:r?e.jsx(Ae,{style:{marginTop:0},disabled:i,loading:i,initialValue:a.name,onSubmit:d=>y("name",d)}):a.name},a.name),e.jsx(Ce,{valueComponent:"div",nameWidth:180,name:s("common.description"),children:r?e.jsx(Ae,{style:{marginTop:0},disabled:i,loading:i,initialValue:a.description,type:"textarea",rows:3,onSubmit:d=>y("description",d)}):a.description},a.description),e.jsx(Ce,{valueComponent:"div",nameWidth:180,name:e.jsxs(N,{sx:{display:"flex",alignItems:"center",gap:.5},children:[s("team.orgs.invite.maxMembers"),e.jsx(De,{title:s("team.orgs.invite.maxMembersTip"),children:e.jsx(pt,{fontSize:"small",sx:{cursor:"pointer",fontSize:14}})})]}),children:g},a.id)]}),r&&e.jsx(m,{display:"flex",justifyContent:"flex-end",children:e.jsx(J,{variant:"contained",color:"error",size:"small",startIcon:e.jsx(oe,{style:{fontSize:16}}),onClick:I,children:s("team.orgs.deleteOrg")})})]})}function ar(){const{orgDetail:t,requests:o}=_(),{roles:a,org:i,editable:r}=t||{},[s,u]=C.useState(!1),b=(window.blocklet?.environments||[]).find(g=>g.key===qt.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_PASSPORT_COLOR)?.value||"auto";return e.jsxs(Kt,{children:[e.jsx(m,{className:"list",children:a.map(g=>e.jsx(Gt,{role:g,createPassportSvg:Yt,onUpdate:u,actions:r?e.jsx("div",{className:"action",children:Ut(g.name)?e.jsx(Vt,{}):e.jsx(Jt,{})}):null,passportProps:{issuer:i.name,issuerDid:i.ownerDid,ownerDid:i.ownerDid,preferredColor:b}},g.name))}),s&&e.jsx(Xt,{onCancel:()=>u(!1),roles:a,onSuccess:()=>{u(!1),o.getOrgRoles(i.id)},onDelete:()=>{u(!1),o.getOrgRoles(i.id)},mode:"update",roleName:s.name,item:s,orgId:i.id,hasPermission:r})]})}function lr(){const{t}=B(),{orgDetail:o,passportParams:a}=_(),{org:i,editable:r}=o||{};return r?e.jsx(m,{sx:{display:"flex",gap:1},children:e.jsx(J,{variant:"contained",size:"small",onClick:()=>{a.onTriggerPassportDialog({org:i,open:!0})},startIcon:e.jsx(xt,{}),children:t("team.passport.create.title")})}):null}function cr(){const{teamDid:t,passportParams:o,requests:a}=_(),{visible:i,org:r}=o||{};return i?e.jsx(Qt,{teamDid:t,orgId:r.id,onCancel:()=>o.onTriggerPassportDialog({open:!1}),onSuccess:()=>{o.onTriggerPassportDialog({open:!1}),a.getOrgRoles(r.id)}}):null}function ke({id:t="",inDialog:o=!1}){const{orgDetail:a}=_(),{t:i}=B(),[r,s]=C.useState("members"),{org:u,loading:b,refresh:g,error:y}=a||{},I=[{label:i("team.orgs.members"),value:"members"},{label:i("common.settings"),value:"settings"},{label:i("team.member.passports"),value:"passports"}];if(C.useEffect(()=>{t&&o&&g(t)},[t,o]),y)return e.jsx(_e,{children:y});if(!u)return null;const d=()=>r==="members"?e.jsx(or,{}):r==="passports"?e.jsx(lr,{}):null;return e.jsxs(m,{children:[!o&&e.jsx(Ge,{org:u,loading:b}),e.jsxs(m,{sx:{mt:2},children:[e.jsx(Xe,{org:u,loading:b}),e.jsxs(m,{sx:{mt:1,p:2,border:w=>`1px solid ${w.palette.divider}`,borderRadius:1},children:[e.jsx(Ie,{tabs:I,currentTab:r,onTabChange:s,loading:b,extra:d()}),e.jsxs(m,{sx:{mt:2},children:[r==="members"&&e.jsx(sr,{}),r==="settings"&&e.jsx(ir,{}),r==="passports"&&e.jsx(ar,{})]})]})]})]})}ke.propTypes={id:h.string,inDialog:h.bool};function dr(){const{t,locale:o}=C.useContext(Rt),{teamDid:a}=Fe(),i=C.useRef(null),[r,s]=C.useState(null),[u,b]=C.useState(0),g=$e(),y=`orgs-${a}`,I=Et(y),d=G({searchText:I.searchText||"",pageSize:I.rowsPerPage||10,page:1}),{editable:w,loading:T,requests:f,onTriggerEditOrg:x,onTriggerCreateOrg:z,refreshTrigger:D}=_(),{data:v,refresh:S}=Ue(async()=>{const M={};d.searchText&&(M.name=d.searchText,M.description=d.searchText);const{orgs:A,paging:k}=await f.getAllOrgs({org:M,paging:{page:d.page,pageSize:d.pageSize}});return b(k.total),A},{refreshDeps:[a,d.page,d.pageSize,d.searchText],onError:M=>{O.error(E(M))}}),U=({page:M,rowsPerPage:A,searchText:k})=>{d.pageSize!==A?(d.pageSize=A,d.page=1):d.page!==M+1?d.page=M+1:d.searchText!==k&&(d.searchText=k,d.page=1)};C.useEffect(()=>{D>0&&S&&S()},[D,S]);const H=[{label:t("common.orgs"),name:"name"},{label:t("common.members"),name:"members",options:{customBodyRender:(M,{rowIndex:A})=>{const k=v[A];return e.jsx(Ke,{members:k.members,total:k.membersCount})}}},{label:t("team.orgs.description"),name:"description"},{label:t("common.createdBy"),name:"owner",options:{customBodyRender:(M,{rowIndex:A})=>{const k=v[A];return e.jsx(m,{children:e.jsx(ie,{showHoverCard:!1,avatarSize:32,did:k.ownerDid,cardType:ae.Detailed,infoType:ue.Minimal,sx:{border:0,padding:0,...g&&{minWidth:"unset"}}})})}}},{label:t("common.createdAt"),name:"createdAt",options:{customBodyRender:M=>e.jsx(m,{children:M?e.jsx(Se,{value:M,locale:o}):"-"})}},w&&{label:t("common.actions"),name:"actions",width:100,align:"center",verticalKeyAlign:"center",options:{customBodyRender:(M,{rowIndex:A})=>{const k=v[A];return e.jsx(m,{children:e.jsx(Ft,{"data-cy":"orgs-table-actions",actions:[{icon:e.jsx(ht,{}),text:t("common.edit"),onClick:F=>{F.stopPropagation(),x(k)}},{icon:e.jsx(oe,{}),text:t("common.delete"),onClick:F=>{F.stopPropagation(),f.deleteOrg(k)}}]})})}}}],X={sort:!1,download:!1,filter:!1,print:!1,expandableRowsOnClick:!0,onRowClick(M,A,k){if(i.current?.contains(k.target)){const F=v[A.dataIndex];s(F)}},page:d.page-1,rowsPerPage:d.pageSize,count:u,searchDebounceTime:600},re=w?[e.jsx(J,{variant:"contained",size:"small",onClick:()=>{z()},children:t("common.create")},"add")]:[];return e.jsxs(m,{children:[e.jsx("div",{ref:i,className:"orgs-table",children:e.jsx(Be,{className:"orgs-table",verticalKeyWidth:100,loading:T,columns:H,data:v||[],locale:o,durable:y,durableKeys:["page","rowsPerPage"],customButtons:re,options:X,onChange:U})}),r&&e.jsx(ge,{fullWidth:!0,maxWidth:"lg",title:r.name,open:!!r,onClose:()=>s(null),sx:{".MuiDialogContent-root":{pt:0}},children:e.jsx(ke,{id:r.id,inDialog:!0})})]})}function Ze({org:t,onInviteUser:o=te,onDelete:a=te,onClick:i=te,loading:r=!1,editable:s=!0}){const{t:u}=B(),{session:b}=Je(),g=C.useMemo(()=>b?.user?.did===t.ownerDid,[b?.user?.did,t.ownerDid]),y=()=>s?e.jsxs(e.Fragment,{children:[e.jsx(We,{variant:"outlined",size:"small",startIcon:e.jsx(jt,{style:{fontSize:16}}),onClick:d=>{d.stopPropagation(),o?.(t)},children:u("common.invite")}),e.jsx(We,{variant:"contained",color:"error",size:"small",startIcon:e.jsx(oe,{style:{fontSize:16}}),onClick:d=>{d.stopPropagation(),a?.(t)},children:u("common.delete")})]}):null,I=j(()=>g?null:t?.passports?.length>0?e.jsx(Z,{label:t.passports[0].title,size:"small"}):null);return e.jsx(ze,{sx:{flexDirection:{xs:"column",md:"row"},gap:{xs:2,md:2},cursor:"pointer",minWidth:300},onClick:()=>i?.(t),children:e.jsxs(ft,{sx:{boxShadow:1,border:"1px solid",borderColor:"divider",backgroundColor:"background.default",flex:1,display:"flex",flexDirection:"column"},children:[e.jsx(bt,{title:e.jsxs(ze,{direction:"row",spacing:1,sx:{alignItems:"center",justifyContent:"space-between"},children:[r?e.jsx(L,{variant:"text",width:"100%",height:24}):e.jsx(N,{variant:"h4",sx:{fontWeight:600},children:t.name}),r?e.jsx(L,{variant:"text",width:50,height:24}):I()]}),sx:{pb:2}}),e.jsxs(vt,{sx:{pt:0,flex:1,display:"flex",flexDirection:"column",gap:1,"&.MuiCardContent-root":{pb:2}},children:[e.jsx(N,{variant:"body2",sx:{color:"text.secondary",overflow:"hidden",display:"-webkit-box",WebkitLineClamp:3,WebkitBoxOrient:"vertical",height:56},children:r?e.jsxs(e.Fragment,{children:[e.jsx(L,{variant:"text",width:"100%",height:24}),e.jsx(L,{variant:"text",width:"80%",height:24})]}):t.description}),e.jsxs(m,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[r?e.jsx(L,{variant:"text",width:"30%",height:24}):e.jsxs(m,{sx:{display:"flex",alignItems:"center",gap:.5,color:"text.secondary",fontSize:14},children:[e.jsx(yt,{sx:{fontSize:"18px"}}),e.jsxs("span",{children:[t.membersCount||t.members?.length||1," ",u("team.orgs.members")]})]}),e.jsx(m,{sx:{display:"flex",alignItems:"center",gap:1},children:r?e.jsxs(e.Fragment,{children:[e.jsx(L,{variant:"text",width:50,height:24}),e.jsx(L,{variant:"text",width:50,height:24})]}):y()})]})]})]})})}Ze.propTypes={org:h.object.isRequired,onInviteUser:h.func,onDelete:h.func,onClick:h.func,loading:h.bool,editable:h.bool};const We=Ct(J)`
1
+ import{j as e,ak as m,b4 as st,W as h,ar as L,cx as ot,a$ as it,T as N,c3 as at,c4 as lt,D as ct,V as dt,I as Oe,bb as oe,U as Z,n as ce,S as mt,cy as ut,Q as J,ai as gt,am as de,bf as pt,cb as xt,cc as ht,b1 as ze,b7 as ft,b8 as bt,b9 as vt,cz as yt,cA as jt,s as Ct,J as wt,c1 as Ot,z as me,bD as Ne,aX as St,a6 as Tt,bV as Pt,aj as It,y as Dt,x as kt,bc as Mt,M as zt}from"./vendor-mui-core-BPQ6AEW_.js";import{V as B,H as O,h as Be,z as Se,U as Re,i as _e,p as Rt,a2 as Et,b as ge,n as Ee}from"./vendor-ux-r9bApERu.js";import{r as C,i as qe,k as At}from"./vendor-react-CUXIiAnY.js";import{g as G,b as j,k as Ue,a as Wt,v as Lt,q as Nt,c as Bt}from"./vendor-hooks-PN9SWiQm.js";import{ar as ie,at as ae,c as Pe,_ as He,aA as _t,as as ue,Y as qt,b6 as Ut,o as Ht}from"./index-DY2wgD65.js";import{u as Fe}from"./team-DP9eK2IU.js";import{u as $e}from"./use-mobile-ajdJIsoX.js";import{A as Ft}from"./actions-DhSvOHy-.js";import{u as Je}from"./session-f4MooMkP.js";import{f as E}from"./index-DBs9Ljax.js";import{v as Ce}from"./index-ySP_m_Ux.js";import{e as Ve,A as $t,n as te}from"./vendor-utils-BgSaqjGx.js";import{F as Ae}from"./form-text-input-Sp9mVO8Z.js";import{e as Jt}from"./edit.svg-Dz9cVo7r.js";import{C as Vt}from"./lock.svg-BPCZ0CT3.js";import{D as Kt,a as Gt,b as Xt,M as Qt}from"./index-DIrD5peJ.js";import{c as Yt}from"./passport-YH_G5MTs.js";import{C as Zt}from"./click-to-copy-BuSTGPjJ.js";import{I as er}from"./invitations-BEDVQ-Hf.js";function Ke({members:t,total:o}){return e.jsxs(m,{className:"members-avatar-group",sx:{display:"flex",alignItems:"center","& > *:not(:first-of-type)":{ml:-1}},children:[t.map((a,i)=>e.jsx(m,{sx:{position:"relative",zIndex:i},children:e.jsx(ie,{did:a.userDid,avatarSize:32,cardType:ae.AvatarOnly,showHoverCard:!1})},a.userDid)),o>5&&e.jsxs(st,{sx:{width:32,height:32,bgcolor:"grey",fontSize:14},children:["+",o-5]})]})}Ke.propTypes={members:h.array.isRequired,total:h.number.isRequired};function Ge({org:t={},loading:o=!1}){const{t:a,locale:i}=B();return t.id?o?e.jsxs(m,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(L,{variant:"text",width:50,height:24}),e.jsx(L,{variant:"text",width:20,height:24})]}):e.jsxs(ot,{"aria-label":"breadcrumb",children:[e.jsx(it,{underline:"hover",color:"inherit",href:`${Pe.WELLKNOWN_SERVICE_PATH_PREFIX}/user/orgs?locale=${i}`,children:a("common.orgs")}),e.jsx(N,{children:t.name})]}):null}Ge.propTypes={org:h.object.isRequired,loading:h.bool};function tr(t){if(!t)return"";if(/[\u4e00-\u9fa5]/.test(t.charAt(0)))return t.charAt(0);const o=t.trim().split(/\s+/);return o.length>1?o.slice(0,2).map(a=>a.charAt(0).toUpperCase()).join(""):t.charAt(0).toUpperCase()}function Xe({org:t,loading:o=!1}){return e.jsxs(m,{sx:{display:"flex",alignItems:"center",gap:2},children:[e.jsx(m,{sx:{width:56,height:56,borderRadius:1,backgroundColor:"grey.100",display:"flex",alignItems:"center",justifyContent:"center"},children:o?e.jsx(L,{variant:"text",width:25,height:25}):e.jsx(N,{sx:{fontSize:30,fontWeight:600},children:tr(t.name)})}),e.jsxs(m,{sx:{flex:1,display:"flex",flexDirection:"column",justifyContent:"space-between"},children:[e.jsx(N,{variant:"h4",sx:{overflow:"hidden",display:"-webkit-box",WebkitLineClamp:1,WebkitBoxOrient:"vertical",textOverflow:"ellipsis"},children:o?e.jsx(L,{variant:"text",width:"10%",height:24}):t.name||"-"}),e.jsx(N,{variant:"body1",sx:{fontSize:14,lineHeight:1.2,overflow:"hidden",display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical"},children:o?e.jsx(L,{variant:"text",width:"30%",height:24}):t.description||"-"})]})]})}Xe.propTypes={org:h.shape({name:h.string,description:h.string}).isRequired,loading:h.bool};function Ie({tabs:t,currentTab:o,onTabChange:a,loading:i=!1,extra:r=null}){return e.jsxs(m,{sx:{display:"flex",gap:1,alignItems:"center",justifyContent:"space-between",flexWrap:"wrap"},children:[i?e.jsx(L,{variant:"text",width:300,height:56}):e.jsx(at,{color:"primary",size:"small",value:o,exclusive:!0,onChange:(s,u)=>{u!==null&&a(u)},disabled:i,children:t.map(s=>e.jsx(lt,{size:"small",value:s.value,children:s.label},s.value))}),e.jsx(m,{children:r})]})}Ie.propTypes={tabs:h.array.isRequired,currentTab:h.string.isRequired,onTabChange:h.func.isRequired,loading:h.bool,extra:h.node};const Qe=C.createContext({}),{Provider:rr,Consumer:Rr}=Qe,we={type:"",org:{},paging:{page:1,pageSize:10}};function nr({children:t,editable:o=!0,mode:a="user-center",id:i=""}){const{t:r}=B(),{api:s}=He(),{teamDid:u}=Fe(),{session:b}=Je(),[g,y]=C.useState(!1),[I,d]=C.useState(0),[w,T]=C.useState(0),f=G({loading:!1,org:null,members:[],membersPaging:{page:1,pageSize:10},invitations:[],refresh:null,editable:!1,roles:[],error:null}),x=C.useMemo(()=>b?.user?.did,[b?.user?.did]),z=G({all:JSON.parse(JSON.stringify(we)),myCreated:JSON.parse(JSON.stringify({...we,type:"owned"})),myJoined:JSON.parse(JSON.stringify({...we,type:"joined"}))}),D=G({mode:"",org:null}),v=G({loading:!1,org:null,showInvite:!1,showInviting:!1,inviteLink:"",roles:[],mode:"list"}),S=G({mode:"create",item:null,loading:!1,org:null,visible:!1}),U=C.useMemo(()=>window.blocklet?.settings?.org||{},[]),{confirmApi:H,confirmHolder:X}=_t(),re=j(async({org:n={},type:c="",paging:p={page:1,pageSize:10}})=>{try{y(!0);const R=await s.getOrgs({input:{teamDid:u,paging:p,org:n,...c?{type:c}:{}}});return z.all={org:n,paging:p,type:c},R}catch(R){console.error(R),O.error(E(R));return}finally{y(!1)}}),M=j(async({org:n={},paging:c={page:1,pageSize:10}})=>{try{y(!0);const p=await s.getOrgs({input:{teamDid:u,paging:c,org:n,type:"owned"}});return d(p?.paging?.total||0),z.myCreated={org:n,paging:c,type:"owned"},p}catch(p){console.error(p),O.error(E(p));return}finally{y(!1)}}),A=j(async({org:n={},paging:c={page:1,pageSize:10}})=>{try{y(!0);const p=await s.getOrgs({input:{teamDid:u,paging:c,org:n,type:"joined"}});return z.myJoined={org:n,paging:c,type:"joined"},p}catch(p){console.error(p),O.error(E(p));return}finally{y(!1)}}),k=j(()=>{T(n=>n+1)}),F=j(async n=>{try{await s.deleteOrg({input:{teamDid:u,id:n.id}}),k()}catch(c){console.error(c),O.error(E(c))}}),pe=j(n=>new Promise((c,p)=>{H.open({title:r("team.orgs.deleteConfirm",{name:n.name}),content:r("team.orgs.deleteConfirmDescription"),confirmButtonText:r("common.delete"),cancelButtonText:r("common.cancel"),confirmButtonProps:{color:"error"},onConfirm:async R=>{await F(n),R(),c()},onCancel:()=>{p()}})})),xe=j(async n=>{try{await s.updateOrg({input:{teamDid:u,org:n}}),O.success(r("team.orgs.mutate.updateSuccess"))}catch(c){console.error(c),O.error(E(c))}}),ee=j(async n=>{try{await s.createOrg({input:{teamDid:u,name:n.name,description:n.description}}),O.success(r("team.orgs.mutate.createSuccess")),k()}catch(c){console.error(c),O.error(E(c))}}),V=j(async(n,c=f.membersPaging)=>{try{const p=await s.getOrgMembers({input:{teamDid:u,orgId:n,paging:c}});f.members=p.users,f.membersPaging=p.paging}catch(p){console.error(p),O.error(E(p))}}),ne=j(async(n,c={page:1,pageSize:10})=>{try{const p=await s.getInvitations({input:{teamDid:u,orgId:n,paging:c}});f.invitations=p.invitations}catch(p){console.error(p),O.error(E(p))}}),Q=j(async n=>{try{const c=await s.getRoles({input:{teamDid:u,orgId:n}});f.roles=c.roles,v.roles=c.roles}catch(c){console.error(c),O.error(E(c))}}),he=j(async(n,c)=>{try{await s.removeOrgMember({input:{teamDid:u,orgId:n,userDid:c}}),O.success(r("team.orgs.invite.removeSuccess")),Promise.all([V(n),ne(n)])}catch(p){console.error(p),O.error(E(p))}}),Y=j((n,c)=>{const{user:p,status:R}=c,$=R==="inviting";return new Promise((ye,le)=>{H.open({title:$?r("team.orgs.member.removeInvitingMember",{name:p.fullName}):r("team.orgs.member.removeMemberConfirm",{name:p.fullName}),content:$?r("team.orgs.member.removeInvitingMemberDescription",{name:p.fullName}):r("team.orgs.member.removeMemberConfirmDescription"),confirmButtonProps:{color:"error"},onConfirm:async je=>{await he(n,p.did),je(),ye()},onCancel:()=>{le()}})})}),se=j(async n=>{try{const c=await s.getOrg({input:{teamDid:u,id:n}});f.org=c.org,f.error=null,f.editable=o?c?.org?.ownerDid===x:!1}catch(c){f.error=E(c),console.error(c),O.error(E(c))}}),fe=j(n=>{if(!U?.enabled){O.error(r("team.orgs.mutate.orgNotEnabled"));return}D.org=n,D.mode="update"}),be=j(()=>{if(!U?.enabled){O.error(r("team.orgs.mutate.orgNotEnabled"));return}const{maxOrgPerUser:n=10}=U;if(n<=I){O.error(r("team.orgs.mutate.maxOrgPerUser",{maxOrgPerUser:n}));return}D.org={},D.mode="create"}),ve=j(({org:n,open:c=!1,mode:p="list"})=>{if(c&&n){if(v.org=n,v.mode=p,!U?.enabled){O.error(r("team.orgs.mutate.orgNotEnabled"));return}const{maxMemberPerOrg:R=100}=U;if(n.membersCount=n.membersCount||1,R<=(n?.membersCount??1)){O.error(r("team.orgs.mutate.maxMemberPerOrg",{maxMemberPerOrg:R}));return}Q(n.id)}else v.mode="list",v.org=null,v.roles=[],v.inviteLink="";v.showInvite=c}),Me=j(({org:n,open:c=!1})=>{v.showInviting=c,v.org=c?n:null}),K=j(()=>{D.org=null,D.mode=""}),l=j(async n=>{try{if(f.loading=!0,await se(n),f.error)return;f.editable?await Promise.all([V(n),ne(n),Q(n)]):await Promise.all([V(n),Q(n)])}catch(c){console.error(c)}finally{f.loading=!1}}),P=j(async({userDids:n,role:c,email:p,inviteType:R})=>{try{const{org:$}=v||{};if(!$)throw new Error(400,"Org is not found");v.loading=!0;const ye=await s.inviteMembersToOrg({input:{userDids:n,email:p,teamDid:u,orgId:$.id,role:c,inviteType:R}}),{failedDids:le,inviteLink:je}=ye.data||{};R==="external"?v.inviteLink=je:le.length?O.success(r("team.orgs.invite.failed",{count:le.length})):O.success(r("team.orgs.invite.success")),v.mode==="detail"?l($.id):k()}catch($){console.error($),O.error(E($))}finally{v.loading=!1}}),W=j(({org:n,mode:c="create",open:p=!1,item:R=null})=>{S.visible=p,S.org=p?n:null,S.mode=p?c:"create",S.item=p&&c==="update"?R:null});C.useEffect(()=>{i&&l(i)},[i,l]);const q={editable:o,refresh:k,refreshTrigger:w,loading:g,mode:a,teamDid:u,onTriggerEditOrg:fe,onTriggerCreateOrg:be,onCancelMutateOrg:K,mutationParams:D,inviteParams:{...v,onTriggerInviteDialog:ve,onTriggerInvitingDialog:Me},orgDetail:{...f,refresh:l},passportParams:{...S,onTriggerPassportDialog:W},requests:{getAllOrgs:re,getMyCreatedOrgs:M,getMyJoinedOrgs:A,deleteOrg:pe,updateOrg:xe,createOrg:ee,getOrgMembers:V,getOrgInvitations:ne,removeOrgMember:Y,getOrg:se,inviteMembers:P,getOrgRoles:Q}};return e.jsxs(rr,{value:q,children:[t,X]})}function _(){return C.useContext(Qe)}function Ye({index:t=0}){const o=[{name:"75%",info:"45%",detail:"60%"},{name:"65%",info:"55%",detail:"40%"},{name:"90%",info:"30%",detail:"65%"}],a=o[t%o.length];return e.jsxs(mt,{sx:{px:0,py:1},children:[e.jsx(ut,{children:e.jsx(L,{variant:"circular",width:32,height:32})}),e.jsxs(m,{sx:{flex:1},children:[e.jsx(L,{variant:"text",width:a.name,height:20,sx:{mb:.5}}),e.jsx(L,{variant:"text",width:a.info,height:16,sx:{mb:.25}})]})]})}Ye.propTypes={index:h.number};function sr(){const{t,locale:o}=B(),{orgDetail:a,requests:i}=_(),{org:r,members:s,loading:u,editable:b,membersPaging:g}=a||{},y=ct(),I=(T,f)=>{f==="changePage"&&(g.page=T.page+1,i.getOrgMembers(r.id,g)),f==="changeRowsPerPage"&&(g.page=1,g.pageSize=T.rowsPerPage,i.getOrgMembers(r.id,g))},d=[{name:"user",label:" ",options:{filter:!1,sort:!1,setCellHeaderProps:()=>({style:{display:"none"}}),setCellProps:()=>({style:{width:"33.33%"}}),customBodyRender:(T,f)=>{const x=s[f.rowIndex];if(!x||!x.user)return null;const{user:z}=x,D=x.userDid===r.ownerDid;return e.jsx(m,{sx:{py:{xs:.5,sm:1}},children:e.jsx(ie,{avatarSize:32,user:z,showDid:!0,cardType:ae.Detailed,infoType:ue.Minimal,sx:{border:0,padding:0},showHoverCard:!1,renderTopRightContent:b&&!D?()=>e.jsx(m,{sx:{display:{xs:"block",sm:"none"}},children:e.jsx(Oe,{size:"small",color:"error","aria-label":"delete",title:t("team.orgs.invite.remove"),onClick:v=>{v.stopPropagation(),i.removeOrgMember(r.id,x)},children:e.jsx(oe,{fontSize:"small"})})}):void 0})})}}},{name:"status",label:" ",options:{filter:!1,sort:!1,setCellHeaderProps:()=>({style:{display:"none"}}),setCellProps:()=>({style:{width:"33.33%"}}),customBodyRender:(T,f)=>{const x=s[f.rowIndex];if(!x||!x.user)return null;const{user:z}=x,{passports:D=[]}=z;return e.jsxs(m,{sx:{display:"flex",flexDirection:{xs:"column",sm:"row"},gap:.5,alignItems:"flex-start",py:{xs:.5,sm:1}},children:[e.jsxs(m,{sx:{display:{xs:"flex",sm:"none"},flexDirection:"row",gap:.5,alignItems:"center",flexWrap:"nowrap",overflow:"auto",maxWidth:"100%"},children:[D.map(v=>e.jsx(Z,{label:v.title,size:"small",sx:{flexShrink:0}},v.id)),x.status==="inviting"?e.jsx(Z,{label:t("common.inviting"),size:"small",sx:{backgroundColor:ce(y.palette.warning.main,.15),color:y.palette.warning.dark,flexShrink:0}}):e.jsx(Z,{label:t("team.orgs.active"),size:"small",sx:{backgroundColor:ce(y.palette.success.main,.15),color:y.palette.success.dark,flexShrink:0}}),x.updatedAt&&e.jsxs(N,{variant:"caption",color:"text.secondary",sx:{whiteSpace:"nowrap",flexShrink:0},children:[x.status==="inviting"?t("team.orgs.invitedAt"):t("team.orgs.joinedAt")," ",e.jsx(Se,{value:x.updatedAt})]})]}),e.jsxs(m,{sx:{display:{xs:"none",sm:"flex"},flexDirection:"row",gap:.5,alignItems:"center"},children:[D.map(v=>e.jsx(Z,{label:v.title,size:"small"},v.id)),x.status==="inviting"?e.jsx(Z,{label:t("common.inviting"),size:"small",sx:{backgroundColor:ce(y.palette.warning.main,.15),color:y.palette.warning.dark}}):e.jsx(Z,{label:t("team.orgs.active"),size:"small",sx:{backgroundColor:ce(y.palette.success.main,.15),color:y.palette.success.dark}})]})]})}}},{name:"updatedAt",label:" ",options:{filter:!1,sort:!1,setCellHeaderProps:()=>({style:{display:"none"}}),setCellProps:()=>({style:{width:"33.33%"}}),customBodyRender:(T,f)=>{const x=s[f.rowIndex];return!x||!x.updatedAt?null:e.jsx(m,{sx:{py:{xs:.5,sm:1},display:{xs:"none",sm:"flex"},flexDirection:"column",gap:.5,minWidth:0},children:e.jsxs(N,{variant:"caption",color:"text.secondary",sx:{whiteSpace:"nowrap"},children:[x.status==="inviting"?t("team.orgs.invitedAt"):t("team.orgs.joinedAt"),e.jsx(Se,{value:x.updatedAt})]})})}}},{name:"actions",label:" ",options:{filter:!1,sort:!1,setCellHeaderProps:()=>({style:{display:"none"}}),setCellProps:()=>({style:{width:"80px",minWidth:"80px",maxWidth:"80px"}}),customBodyRender:(T,f)=>{const x=s[f.rowIndex];if(!x||!x.user)return null;const z=x.userDid===r.ownerDid;return!b||z?null:e.jsx(m,{sx:{py:{xs:.5,sm:1},display:{xs:"none",sm:"block"}},children:e.jsx(Oe,{color:"error","aria-label":"delete",title:t("team.orgs.invite.remove"),onClick:()=>i.removeOrgMember(r.id,x),children:e.jsx(oe,{})})})}}}],w={sort:!1,download:!1,filter:!1,print:!1,search:!1,viewColumns:!1,selectableRows:"none",expandableRowsOnClick:!1,page:g.page-1,rowsPerPage:g.pageSize,count:g.total||0,pagination:g.pageCount>1};return u?e.jsx(m,{className:"members-list",children:e.jsx(dt,{sx:{width:"100%",bgcolor:"background.paper"},children:Array.from({length:3},(T,f)=>e.jsx(Ye,{index:f},`skeleton-${f}`))})}):e.jsx(m,{className:"members-list",sx:{width:"100%","& .org-members-table > div":{overflow:"hidden"},"& .MuiPaper-root":{overflow:{xs:"hidden",sm:"auto"}},"& table":{width:{xs:"100%",sm:"auto"},tableLayout:{xs:"fixed",sm:"auto"}},"& .MuiTableRow-root .MuiTableCell-root":{py:{xs:.5,sm:1}},"& tbody tr":{display:{xs:"grid",sm:"table-row"},gridTemplateColumns:{xs:"1fr",sm:"auto"},gridTemplateRows:{xs:"auto auto",sm:"auto"},"& td":{display:{xs:"block !important",sm:"table-cell !important"},"&:nth-of-type(1)":{gridColumn:{xs:"1",sm:"auto"},gridRow:{xs:"1",sm:"auto"}},"&:nth-of-type(2)":{gridColumn:{xs:"1",sm:"auto"},gridRow:{xs:"2",sm:"auto"},minWidth:{xs:0,sm:"auto"}},"&:nth-of-type(3), &:nth-of-type(4)":{display:{xs:"none !important",sm:"table-cell !important"}}}}},children:e.jsx(Be,{className:"org-members-table",data:s,columns:d,loading:u,onChange:I,locale:o,options:w})})}function or(){const{t}=B(),{orgDetail:o,inviteParams:a}=_(),{invitations:i,editable:r,org:s}=o||{};return r?e.jsxs(m,{sx:{display:"flex",gap:1},children:[e.jsxs(J,{variant:"outlined",style:{flexShrink:0},color:"primary",size:"small",onClick:()=>{a.onTriggerInvitingDialog({org:s,open:!0})},children:[e.jsx(Re,{style:{height:"1em",marginRight:4},icon:"tabler:user"}),t("common.inviting"),i.length?` (${i.length})`:""]}),e.jsx(J,{variant:"contained",size:"small",onClick:()=>{a.onTriggerInviteDialog({org:s,open:!0,mode:"detail"})},startIcon:e.jsx(Re,{style:{fontSize:14},icon:"tabler:user-plus"}),children:t("common.invite")})]}):null}function De({children:t,...o}){const a=$e(),[i,r]=C.useState(!1),s=j(()=>{r(!i)});return C.useEffect(()=>{r(!1)},[a]),a?e.jsx(gt,{onClickAway:()=>r(!1),children:e.jsx(de,{...o,disableFocusListener:!0,disableHoverListener:!0,disableTouchListener:!0,slotProps:{popper:{disablePortal:!0}},open:i,onClose:s,children:C.cloneElement(t,{onClick:s})})}):e.jsx(de,{...o,children:t})}De.propTypes=de.propTypes;De.defaultProps=de.defaultProps;function ir(){const{orgDetail:t,requests:o}=_(),{org:a,loading:i,editable:r}=t||{},{t:s,locale:u}=B(),b=qe(),g=C.useMemo(()=>{const{settings:d={}}=window.blocklet||{};return Ve(d,"org.maxMemberPerOrg",100)},[]),y=j(async(d,w)=>{const T={...$t(a,["id","name","description"]),[d]:w};await o.updateOrg(T),t.refresh(T.id)}),I=j(async()=>{await o.deleteOrg(a),b(`${Pe.WELLKNOWN_SERVICE_PATH_PREFIX}/user/orgs?locale=${u}`)});return e.jsxs(m,{children:[e.jsxs(m,{sx:{display:"grid",gridTemplateColumns:"1fr",gap:2},children:[e.jsx(Ce,{valueComponent:"div",nameWidth:180,name:s("team.orgs.mutate.name"),children:r?e.jsx(Ae,{style:{marginTop:0},disabled:i,loading:i,initialValue:a.name,onSubmit:d=>y("name",d)}):a.name},a.name),e.jsx(Ce,{valueComponent:"div",nameWidth:180,name:s("common.description"),children:r?e.jsx(Ae,{style:{marginTop:0},disabled:i,loading:i,initialValue:a.description,type:"textarea",rows:3,onSubmit:d=>y("description",d)}):a.description},a.description),e.jsx(Ce,{valueComponent:"div",nameWidth:180,name:e.jsxs(N,{sx:{display:"flex",alignItems:"center",gap:.5},children:[s("team.orgs.invite.maxMembers"),e.jsx(De,{title:s("team.orgs.invite.maxMembersTip"),children:e.jsx(pt,{fontSize:"small",sx:{cursor:"pointer",fontSize:14}})})]}),children:g},a.id)]}),r&&e.jsx(m,{display:"flex",justifyContent:"flex-end",children:e.jsx(J,{variant:"contained",color:"error",size:"small",startIcon:e.jsx(oe,{style:{fontSize:16}}),onClick:I,children:s("team.orgs.deleteOrg")})})]})}function ar(){const{orgDetail:t,requests:o}=_(),{roles:a,org:i,editable:r}=t||{},[s,u]=C.useState(!1),b=(window.blocklet?.environments||[]).find(g=>g.key===qt.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_PASSPORT_COLOR)?.value||"auto";return e.jsxs(Kt,{children:[e.jsx(m,{className:"list",children:a.map(g=>e.jsx(Gt,{role:g,createPassportSvg:Yt,onUpdate:u,actions:r?e.jsx("div",{className:"action",children:Ut(g.name)?e.jsx(Vt,{}):e.jsx(Jt,{})}):null,passportProps:{issuer:i.name,issuerDid:i.ownerDid,ownerDid:i.ownerDid,preferredColor:b}},g.name))}),s&&e.jsx(Xt,{onCancel:()=>u(!1),roles:a,onSuccess:()=>{u(!1),o.getOrgRoles(i.id)},onDelete:()=>{u(!1),o.getOrgRoles(i.id)},mode:"update",roleName:s.name,item:s,orgId:i.id,hasPermission:r})]})}function lr(){const{t}=B(),{orgDetail:o,passportParams:a}=_(),{org:i,editable:r}=o||{};return r?e.jsx(m,{sx:{display:"flex",gap:1},children:e.jsx(J,{variant:"contained",size:"small",onClick:()=>{a.onTriggerPassportDialog({org:i,open:!0})},startIcon:e.jsx(xt,{}),children:t("team.passport.create.title")})}):null}function cr(){const{teamDid:t,passportParams:o,requests:a}=_(),{visible:i,org:r}=o||{};return i?e.jsx(Qt,{teamDid:t,orgId:r.id,onCancel:()=>o.onTriggerPassportDialog({open:!1}),onSuccess:()=>{o.onTriggerPassportDialog({open:!1}),a.getOrgRoles(r.id)}}):null}function ke({id:t="",inDialog:o=!1}){const{orgDetail:a}=_(),{t:i}=B(),[r,s]=C.useState("members"),{org:u,loading:b,refresh:g,error:y}=a||{},I=[{label:i("team.orgs.members"),value:"members"},{label:i("common.settings"),value:"settings"},{label:i("team.member.passports"),value:"passports"}];if(C.useEffect(()=>{t&&o&&g(t)},[t,o]),y)return e.jsx(_e,{children:y});if(!u)return null;const d=()=>r==="members"?e.jsx(or,{}):r==="passports"?e.jsx(lr,{}):null;return e.jsxs(m,{children:[!o&&e.jsx(Ge,{org:u,loading:b}),e.jsxs(m,{sx:{mt:2},children:[e.jsx(Xe,{org:u,loading:b}),e.jsxs(m,{sx:{mt:1,p:2,border:w=>`1px solid ${w.palette.divider}`,borderRadius:1},children:[e.jsx(Ie,{tabs:I,currentTab:r,onTabChange:s,loading:b,extra:d()}),e.jsxs(m,{sx:{mt:2},children:[r==="members"&&e.jsx(sr,{}),r==="settings"&&e.jsx(ir,{}),r==="passports"&&e.jsx(ar,{})]})]})]})]})}ke.propTypes={id:h.string,inDialog:h.bool};function dr(){const{t,locale:o}=C.useContext(Rt),{teamDid:a}=Fe(),i=C.useRef(null),[r,s]=C.useState(null),[u,b]=C.useState(0),g=$e(),y=`orgs-${a}`,I=Et(y),d=G({searchText:I.searchText||"",pageSize:I.rowsPerPage||10,page:1}),{editable:w,loading:T,requests:f,onTriggerEditOrg:x,onTriggerCreateOrg:z,refreshTrigger:D}=_(),{data:v,refresh:S}=Ue(async()=>{const M={};d.searchText&&(M.name=d.searchText,M.description=d.searchText);const{orgs:A,paging:k}=await f.getAllOrgs({org:M,paging:{page:d.page,pageSize:d.pageSize}});return b(k.total),A},{refreshDeps:[a,d.page,d.pageSize,d.searchText],onError:M=>{O.error(E(M))}}),U=({page:M,rowsPerPage:A,searchText:k})=>{d.pageSize!==A?(d.pageSize=A,d.page=1):d.page!==M+1?d.page=M+1:d.searchText!==k&&(d.searchText=k,d.page=1)};C.useEffect(()=>{D>0&&S&&S()},[D,S]);const H=[{label:t("common.orgs"),name:"name"},{label:t("common.members"),name:"members",options:{customBodyRender:(M,{rowIndex:A})=>{const k=v[A];return e.jsx(Ke,{members:k.members,total:k.membersCount})}}},{label:t("team.orgs.description"),name:"description"},{label:t("common.createdBy"),name:"owner",options:{customBodyRender:(M,{rowIndex:A})=>{const k=v[A];return e.jsx(m,{children:e.jsx(ie,{showHoverCard:!1,avatarSize:32,did:k.ownerDid,cardType:ae.Detailed,infoType:ue.Minimal,sx:{border:0,padding:0,...g&&{minWidth:"unset"}}})})}}},{label:t("common.createdAt"),name:"createdAt",options:{customBodyRender:M=>e.jsx(m,{children:M?e.jsx(Se,{value:M,locale:o}):"-"})}},w&&{label:t("common.actions"),name:"actions",width:100,align:"center",verticalKeyAlign:"center",options:{customBodyRender:(M,{rowIndex:A})=>{const k=v[A];return e.jsx(m,{children:e.jsx(Ft,{"data-cy":"orgs-table-actions",actions:[{icon:e.jsx(ht,{}),text:t("common.edit"),onClick:F=>{F.stopPropagation(),x(k)}},{icon:e.jsx(oe,{}),text:t("common.delete"),onClick:F=>{F.stopPropagation(),f.deleteOrg(k)}}]})})}}}],X={sort:!1,download:!1,filter:!1,print:!1,expandableRowsOnClick:!0,onRowClick(M,A,k){if(i.current?.contains(k.target)){const F=v[A.dataIndex];s(F)}},page:d.page-1,rowsPerPage:d.pageSize,count:u,searchDebounceTime:600},re=w?[e.jsx(J,{variant:"contained",size:"small",onClick:()=>{z()},children:t("common.create")},"add")]:[];return e.jsxs(m,{children:[e.jsx("div",{ref:i,className:"orgs-table",children:e.jsx(Be,{className:"orgs-table",verticalKeyWidth:100,loading:T,columns:H,data:v||[],locale:o,durable:y,durableKeys:["page","rowsPerPage"],customButtons:re,options:X,onChange:U})}),r&&e.jsx(ge,{fullWidth:!0,maxWidth:"lg",title:r.name,open:!!r,onClose:()=>s(null),sx:{".MuiDialogContent-root":{pt:0}},children:e.jsx(ke,{id:r.id,inDialog:!0})})]})}function Ze({org:t,onInviteUser:o=te,onDelete:a=te,onClick:i=te,loading:r=!1,editable:s=!0}){const{t:u}=B(),{session:b}=Je(),g=C.useMemo(()=>b?.user?.did===t.ownerDid,[b?.user?.did,t.ownerDid]),y=()=>s?e.jsxs(e.Fragment,{children:[e.jsx(We,{variant:"outlined",size:"small",startIcon:e.jsx(jt,{style:{fontSize:16}}),onClick:d=>{d.stopPropagation(),o?.(t)},children:u("common.invite")}),e.jsx(We,{variant:"contained",color:"error",size:"small",startIcon:e.jsx(oe,{style:{fontSize:16}}),onClick:d=>{d.stopPropagation(),a?.(t)},children:u("common.delete")})]}):null,I=j(()=>g?null:t?.passports?.length>0?e.jsx(Z,{label:t.passports[0].title,size:"small"}):null);return e.jsx(ze,{sx:{flexDirection:{xs:"column",md:"row"},gap:{xs:2,md:2},cursor:"pointer",minWidth:300},onClick:()=>i?.(t),children:e.jsxs(ft,{sx:{boxShadow:1,border:"1px solid",borderColor:"divider",backgroundColor:"background.default",flex:1,display:"flex",flexDirection:"column"},children:[e.jsx(bt,{title:e.jsxs(ze,{direction:"row",spacing:1,sx:{alignItems:"center",justifyContent:"space-between"},children:[r?e.jsx(L,{variant:"text",width:"100%",height:24}):e.jsx(N,{variant:"h4",sx:{fontWeight:600},children:t.name}),r?e.jsx(L,{variant:"text",width:50,height:24}):I()]}),sx:{pb:2}}),e.jsxs(vt,{sx:{pt:0,flex:1,display:"flex",flexDirection:"column",gap:1,"&.MuiCardContent-root":{pb:2}},children:[e.jsx(N,{variant:"body2",sx:{color:"text.secondary",overflow:"hidden",display:"-webkit-box",WebkitLineClamp:3,WebkitBoxOrient:"vertical",height:56},children:r?e.jsxs(e.Fragment,{children:[e.jsx(L,{variant:"text",width:"100%",height:24}),e.jsx(L,{variant:"text",width:"80%",height:24})]}):t.description}),e.jsxs(m,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[r?e.jsx(L,{variant:"text",width:"30%",height:24}):e.jsxs(m,{sx:{display:"flex",alignItems:"center",gap:.5,color:"text.secondary",fontSize:14},children:[e.jsx(yt,{sx:{fontSize:"18px"}}),e.jsxs("span",{children:[t.membersCount||t.members?.length||1," ",u("team.orgs.members")]})]}),e.jsx(m,{sx:{display:"flex",alignItems:"center",gap:1},children:r?e.jsxs(e.Fragment,{children:[e.jsx(L,{variant:"text",width:50,height:24}),e.jsx(L,{variant:"text",width:50,height:24})]}):y()})]})]})]})})}Ze.propTypes={org:h.object.isRequired,onInviteUser:h.func,onDelete:h.func,onClick:h.func,loading:h.bool,editable:h.bool};const We=Ct(J)`
2
2
  font-weight: 500;
3
3
  .MuiButton-icon {
4
4
  margin-right: 4px;
@@ -1 +1 @@
1
- import{j as t,ak as s,T as n,W as i}from"./vendor-mui-core-BPQ6AEW_.js";import{V as f}from"./vendor-ux-r9bApERu.js";import{L as g,r as k}from"./vendor-react-CUXIiAnY.js";import"./index-jPmRCtiq.js";import"./vendor-utils-BgSaqjGx.js";import"./vendor-hooks-PN9SWiQm.js";import"./lottie-web-4koyQiv_.js";import"./vendor-arcblock-D8WYBDYe.js";const l=(e,o)=>[e,...Array.isArray(o)?o:[o]],a=(e=2)=>({overflow:"hidden",textOverflow:"ellipsis",wordBreak:"break-word",display:"-webkit-box",WebkitLineClamp:e,WebkitBoxOrient:"vertical"});function p({sx:e={},...o}){const r=l({display:"flex",flexWrap:"wrap",mx:-1},e);return t.jsx(s,{sx:r,...o})}p.propTypes={sx:i.object};function w({icon:e}){const[o,r]=k.useState(!1);return!e||o?null:typeof e=="string"?t.jsx(s,{component:"img",src:e,alt:"",sx:{width:1,height:1},onError:()=>r(!0)}):e}w.propTypes={icon:i.oneOfType([i.string,i.node]).isRequired};function b({title:e,desc:o,extra:r,cover:c,icon:d,to:x,sx:h}){const m=l({position:"relative",flexBasis:{xs:"100%",sm:"50%",md:"33.33%",lg:"25%"},maxWidth:{xs:"100%",sm:"50%",md:"33.33%",lg:"25%"},mb:{xs:2,md:6},px:1},h);return t.jsx(s,{sx:m,children:t.jsx(s,{component:g,to:x,target:"_blank",sx:{display:"flex",flexDirection:"column",gap:1,height:1,pt:0,color:"inherit",textDecoration:"none",borderRadius:1,cursor:"pointer"},children:t.jsxs(s,{children:[t.jsxs(s,{sx:{position:"relative"},children:[c,d&&t.jsx(s,{sx:{position:"absolute",top:44,left:16,zIndex:1,width:56,height:56},children:t.jsx(w,{icon:d})})]}),t.jsx(n,{sx:{mt:1,fontSize:"1.25rem",fontWeight:600,...a()},children:e}),o&&t.jsx(n,{variant:"body2",sx:{my:1,...a(),color:"text.secondary"},children:o}),r]})})})}b.propTypes={title:i.string.isRequired,desc:i.string.isRequired,extra:i.node.isRequired,cover:i.string.isRequired,icon:i.string.isRequired,to:i.string.isRequired,sx:i.object.isRequired};const j=""+window.__toCdnUrl("assets/doc-board-bg-DWZHV9Ng.png");function u({board:e,sx:o,...r}){return t.jsx(b,{date:e.createdAt,sx:o,to:e.link,title:e.title,desc:e.desc,cover:t.jsx(s,{sx:{position:"relative",paddingTop:`${9/16*100}%`,border:1,borderColor:"divider",borderRadius:1,overflow:"hidden"},children:t.jsx(s,{component:"img",src:j,alt:"",sx:{position:"absolute",top:0,left:0,width:1,filter:c=>c.palette.mode==="dark"?"brightness(0.28) contrast(1.1)":"none"}})}),icon:e.icon,...r})}u.propTypes={board:i.object.isRequired,sx:i.object.isRequired};function I(){const{locale:e}=f(),o=[{id:"1",title:"Blocklet Platform",desc:"Guide to understand and build on our blocklet platform",icon:"https://www.arcblock.io/favicon.ico",link:`https://www.arcblock.io/docs/blocklet-developer/${e}/getting-started`},{id:"2",title:"Create Blocklet",desc:"Build blocklet with just one command line.",icon:"https://www.arcblock.io/favicon.ico",link:`https://www.arcblock.io/docs/createblocklet/${e}/quick-start`},{id:"3",title:"Blocklet Launcher",desc:"Streamlining Blocklet Launching.",icon:"https://www.arcblock.io/docs/uploads/5a4f4716bc8061532a535fe816a9169c.png",link:`https://www.arcblock.io/docs/launcher/${e}/launcher-welcome`},{id:"4",title:"DID Spaces",desc:"Digital Spaces for Decentralized Identity (DID)",icon:"https://www.arcblock.io/docs/uploads/3a8b142d7c940c57eced71eddba2ff19.png",link:`https://www.arcblock.io/docs/did-spaces/${e}/did-spaces-getting-started`},{id:"5",title:"DID Wallet",desc:"DID Wallet Support docs",icon:"https://www.arcblock.io/docs/uploads/59ddb28f405ee670428e5fe1ff12d104.png",link:`https://www.arcblock.io/docs/did-wallet/${e}/get-started`},{id:"6",title:"DID Names",desc:"Naming Service based on NFT and verifiable credentials",icon:"https://www.didnames.io/favicon.ico?imageFilter=resize&w=32",link:`https://www.arcblock.io/docs/did-domain/${e}/did-domain-faq`},{id:"7",title:"Blockchain",desc:"The ledger for ArcBlock ecosystem",icon:"https://www.arcblock.io/docs/uploads/4a20c152faae0f104ed0815ff3b8b48b.png",link:`https://www.arcblock.io/docs/blockchain/${e}/blockchain-how-to-guides`},{id:"8",title:"DID Connect",desc:"The open protocol and development kit for connecting users and dapps",icon:"https://www.arcblock.io/docs/uploads/d189118f89b56e9d5b03ad5a0212a4ab.png",link:`https://www.arcblock.io/docs/did-connect/${e}/developer-guides`}];return t.jsx(p,{children:o.map(r=>t.jsx(u,{board:r},r.id))})}export{I as default};
1
+ import{j as t,ak as s,T as n,W as i}from"./vendor-mui-core-BPQ6AEW_.js";import{V as f}from"./vendor-ux-r9bApERu.js";import{L as g,r as k}from"./vendor-react-CUXIiAnY.js";import"./index-DY2wgD65.js";import"./vendor-utils-BgSaqjGx.js";import"./vendor-hooks-PN9SWiQm.js";import"./lottie-web-4koyQiv_.js";import"./vendor-arcblock-D8WYBDYe.js";const l=(e,o)=>[e,...Array.isArray(o)?o:[o]],a=(e=2)=>({overflow:"hidden",textOverflow:"ellipsis",wordBreak:"break-word",display:"-webkit-box",WebkitLineClamp:e,WebkitBoxOrient:"vertical"});function p({sx:e={},...o}){const r=l({display:"flex",flexWrap:"wrap",mx:-1},e);return t.jsx(s,{sx:r,...o})}p.propTypes={sx:i.object};function w({icon:e}){const[o,r]=k.useState(!1);return!e||o?null:typeof e=="string"?t.jsx(s,{component:"img",src:e,alt:"",sx:{width:1,height:1},onError:()=>r(!0)}):e}w.propTypes={icon:i.oneOfType([i.string,i.node]).isRequired};function b({title:e,desc:o,extra:r,cover:c,icon:d,to:x,sx:h}){const m=l({position:"relative",flexBasis:{xs:"100%",sm:"50%",md:"33.33%",lg:"25%"},maxWidth:{xs:"100%",sm:"50%",md:"33.33%",lg:"25%"},mb:{xs:2,md:6},px:1},h);return t.jsx(s,{sx:m,children:t.jsx(s,{component:g,to:x,target:"_blank",sx:{display:"flex",flexDirection:"column",gap:1,height:1,pt:0,color:"inherit",textDecoration:"none",borderRadius:1,cursor:"pointer"},children:t.jsxs(s,{children:[t.jsxs(s,{sx:{position:"relative"},children:[c,d&&t.jsx(s,{sx:{position:"absolute",top:44,left:16,zIndex:1,width:56,height:56},children:t.jsx(w,{icon:d})})]}),t.jsx(n,{sx:{mt:1,fontSize:"1.25rem",fontWeight:600,...a()},children:e}),o&&t.jsx(n,{variant:"body2",sx:{my:1,...a(),color:"text.secondary"},children:o}),r]})})})}b.propTypes={title:i.string.isRequired,desc:i.string.isRequired,extra:i.node.isRequired,cover:i.string.isRequired,icon:i.string.isRequired,to:i.string.isRequired,sx:i.object.isRequired};const j=""+window.__toCdnUrl("assets/doc-board-bg-DWZHV9Ng.png");function u({board:e,sx:o,...r}){return t.jsx(b,{date:e.createdAt,sx:o,to:e.link,title:e.title,desc:e.desc,cover:t.jsx(s,{sx:{position:"relative",paddingTop:`${9/16*100}%`,border:1,borderColor:"divider",borderRadius:1,overflow:"hidden"},children:t.jsx(s,{component:"img",src:j,alt:"",sx:{position:"absolute",top:0,left:0,width:1,filter:c=>c.palette.mode==="dark"?"brightness(0.28) contrast(1.1)":"none"}})}),icon:e.icon,...r})}u.propTypes={board:i.object.isRequired,sx:i.object.isRequired};function I(){const{locale:e}=f(),o=[{id:"1",title:"Blocklet Platform",desc:"Guide to understand and build on our blocklet platform",icon:"https://www.arcblock.io/favicon.ico",link:`https://www.arcblock.io/docs/blocklet-developer/${e}/getting-started`},{id:"2",title:"Create Blocklet",desc:"Build blocklet with just one command line.",icon:"https://www.arcblock.io/favicon.ico",link:`https://www.arcblock.io/docs/createblocklet/${e}/quick-start`},{id:"3",title:"Blocklet Launcher",desc:"Streamlining Blocklet Launching.",icon:"https://www.arcblock.io/docs/uploads/5a4f4716bc8061532a535fe816a9169c.png",link:`https://www.arcblock.io/docs/launcher/${e}/launcher-welcome`},{id:"4",title:"DID Spaces",desc:"Digital Spaces for Decentralized Identity (DID)",icon:"https://www.arcblock.io/docs/uploads/3a8b142d7c940c57eced71eddba2ff19.png",link:`https://www.arcblock.io/docs/did-spaces/${e}/did-spaces-getting-started`},{id:"5",title:"DID Wallet",desc:"DID Wallet Support docs",icon:"https://www.arcblock.io/docs/uploads/59ddb28f405ee670428e5fe1ff12d104.png",link:`https://www.arcblock.io/docs/did-wallet/${e}/get-started`},{id:"6",title:"DID Names",desc:"Naming Service based on NFT and verifiable credentials",icon:"https://www.didnames.io/favicon.ico?imageFilter=resize&w=32",link:`https://www.arcblock.io/docs/did-domain/${e}/did-domain-faq`},{id:"7",title:"Blockchain",desc:"The ledger for ArcBlock ecosystem",icon:"https://www.arcblock.io/docs/uploads/4a20c152faae0f104ed0815ff3b8b48b.png",link:`https://www.arcblock.io/docs/blockchain/${e}/blockchain-how-to-guides`},{id:"8",title:"DID Connect",desc:"The open protocol and development kit for connecting users and dapps",icon:"https://www.arcblock.io/docs/uploads/d189118f89b56e9d5b03ad5a0212a4ab.png",link:`https://www.arcblock.io/docs/did-connect/${e}/developer-guides`}];return t.jsx(p,{children:o.map(r=>t.jsx(u,{board:r},r.id))})}export{I as default};
@@ -1,4 +1,4 @@
1
- import{j as a,D as M,T as _,ce as T,Q as W,cf as q,aV as X,ak as h,cg as Y,aU as Z,av as B,f as C,b$ as J,ch as K}from"./vendor-mui-core-BPQ6AEW_.js";import{r as d,k as L,L as z,n as ee,o as ae}from"./vendor-react-CUXIiAnY.js";import{H as E,aW as te}from"./index-jPmRCtiq.js";import{e as ie}from"./vendor-hooks-PN9SWiQm.js";import{M as re,l as m,a0 as A,a1 as S}from"./vendor-ux-r9bApERu.js";import{z as oe}from"./vendor-arcblock-D8WYBDYe.js";const H=d.createContext(null),se=e=>{const i=d.use(H);return d.useLayoutEffect(()=>{},[]),i};function le({children:e=void 0,...i}){const[t,r]=d.useState({inFullPage:!1,showToggleButton:!1,headerVisibleInFullPage:!0,footerVisibleInFullPage:!1,sidebarVisibleInFullPage:!1}),s=()=>{r(o=>({...o,inFullPage:!o.inFullPage}))},l=d.useMemo(()=>({...t,headerVisible:!t.inFullPage||t.headerVisibleInFullPage,footerVisible:!t.inFullPage||t.footerVisibleInFullPage,sidebarVisible:!t.inFullPage||t.sidebarVisibleInFullPage,toggleFullPage:s,configure:o=>r(n=>({...n,...o}))}),[t]);return a.jsx(H,{value:l,...i,children:e})}function ne({name:e,size:i=36,alt:t="",color:r="#000000",prefix:s="/images",showBadge:l=!1,style:o={},...n}){const c=`${s}/${e}-${r.replace(/^#/,"")}.png`;return a.jsxs(de,{style:{width:i,height:i},children:[a.jsx(re,{width:i,height:i,alt:t||e,src:c,style:Object.assign({width:i},o),...n}),l&&a.jsx("i",{className:"badge-point"})]})}const de=m("div")`
1
+ import{j as a,D as M,T as _,ce as T,Q as W,cf as q,aV as X,ak as h,cg as Y,aU as Z,av as B,f as C,b$ as J,ch as K}from"./vendor-mui-core-BPQ6AEW_.js";import{r as d,k as L,L as z,n as ee,o as ae}from"./vendor-react-CUXIiAnY.js";import{H as E,aW as te}from"./index-DY2wgD65.js";import{e as ie}from"./vendor-hooks-PN9SWiQm.js";import{M as re,l as m,a0 as A,a1 as S}from"./vendor-ux-r9bApERu.js";import{z as oe}from"./vendor-arcblock-D8WYBDYe.js";const H=d.createContext(null),se=e=>{const i=d.use(H);return d.useLayoutEffect(()=>{},[]),i};function le({children:e=void 0,...i}){const[t,r]=d.useState({inFullPage:!1,showToggleButton:!1,headerVisibleInFullPage:!0,footerVisibleInFullPage:!1,sidebarVisibleInFullPage:!1}),s=()=>{r(o=>({...o,inFullPage:!o.inFullPage}))},l=d.useMemo(()=>({...t,headerVisible:!t.inFullPage||t.headerVisibleInFullPage,footerVisible:!t.inFullPage||t.footerVisibleInFullPage,sidebarVisible:!t.inFullPage||t.sidebarVisibleInFullPage,toggleFullPage:s,configure:o=>r(n=>({...n,...o}))}),[t]);return a.jsx(H,{value:l,...i,children:e})}function ne({name:e,size:i=36,alt:t="",color:r="#000000",prefix:s="/images",showBadge:l=!1,style:o={},...n}){const c=`${s}/${e}-${r.replace(/^#/,"")}.png`;return a.jsxs(de,{style:{width:i,height:i},children:[a.jsx(re,{width:i,height:i,alt:t||e,src:c,style:Object.assign({width:i},o),...n}),l&&a.jsx("i",{className:"badge-point"})]})}const de=m("div")`
2
2
  position: relative;
3
3
  .badge-point {
4
4
  position: absolute;
@@ -1,4 +1,4 @@
1
- import{W as o,j as n,ak as h,f as y,bh as q,av as w,D as I}from"./vendor-mui-core-BPQ6AEW_.js";import{r as $}from"./vendor-react-CUXIiAnY.js";import{l as k,a3 as W,V as A,m as B,K as H}from"./vendor-ux-r9bApERu.js";import{aX as Y,aY as V,aZ as Z,a_ as C,k as K,a$ as P,b0 as X,b1 as G,am as J,b2 as N,b3 as Q}from"./index-jPmRCtiq.js";import{Y as U,I as ee,Z as ne}from"./vendor-utils-BgSaqjGx.js";import{a as oe}from"./vendor-hooks-PN9SWiQm.js";function z({name:e="",logo:t="",description:i="",...c}){if(!e&&!t&&!i)return null;const d=$.isValidElement(t)?t:n.jsx("img",{src:t,alt:e});return n.jsxs(te,{...c,children:[n.jsxs("div",{children:[t&&n.jsx(h,{component:"a",href:"/",className:"footer-brand-logo",children:d}),e&&n.jsx("div",{className:"footer-brand-name",children:e})]}),i&&n.jsx("div",{className:"footer-brand-desc",children:i})]})}z.propTypes={name:o.node,logo:o.node,description:o.string};const te=k("div")`
1
+ import{W as o,j as n,ak as h,f as y,bh as q,av as w,D as I}from"./vendor-mui-core-BPQ6AEW_.js";import{r as $}from"./vendor-react-CUXIiAnY.js";import{l as k,a3 as W,V as A,m as B,K as H}from"./vendor-ux-r9bApERu.js";import{aX as Y,aY as V,aZ as Z,a_ as C,k as K,a$ as P,b0 as X,b1 as G,am as J,b2 as N,b3 as Q}from"./index-DY2wgD65.js";import{Y as U,I as ee,Z as ne}from"./vendor-utils-BgSaqjGx.js";import{a as oe}from"./vendor-hooks-PN9SWiQm.js";function z({name:e="",logo:t="",description:i="",...c}){if(!e&&!t&&!i)return null;const d=$.isValidElement(t)?t:n.jsx("img",{src:t,alt:e});return n.jsxs(te,{...c,children:[n.jsxs("div",{children:[t&&n.jsx(h,{component:"a",href:"/",className:"footer-brand-logo",children:d}),e&&n.jsx("div",{className:"footer-brand-name",children:e})]}),i&&n.jsx("div",{className:"footer-brand-desc",children:i})]})}z.propTypes={name:o.node,logo:o.node,description:o.string};const te=k("div")`
2
2
  display: flex;
3
3
  flex-direction: column;
4
4
  font-size: 14px;
@@ -1,4 +1,4 @@
1
- import{B as qr}from"./vendor-utils-BgSaqjGx.js";import{p as ae}from"./vendor-react-CUXIiAnY.js";import{ag as Se,ah as jr,ai as xr,aj as Nr,ak as _r,al as Kr,am as Sr,an as Tr,ao as ke,ap as Ur,aq as Br,ar as Dr,as as Mr,a6 as Lr,r as Cr}from"./vendor-ux-r9bApERu.js";import{be as Or,aG as Vr}from"./index-jPmRCtiq.js";var Pe={exports:{}},Re={},Je;function Ar(){if(Je)return Re;Je=1;function h(u){"@babel/helpers - typeof";return h=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(p){return typeof p}:function(p){return p&&typeof Symbol=="function"&&p.constructor===Symbol&&p!==Symbol.prototype?"symbol":typeof p},h(u)}function g(u,p,S){return Object.defineProperty(u,"prototype",{writable:!1}),u}function s(u,p){if(!(u instanceof p))throw new TypeError("Cannot call a class as a function")}function b(u,p){if(typeof p!="function"&&p!==null)throw new TypeError("Super expression must either be null or a function");u.prototype=Object.create(p&&p.prototype,{constructor:{value:u,writable:!0,configurable:!0}}),Object.defineProperty(u,"prototype",{writable:!1}),p&&_(u,p)}function _(u,p){return _=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(N,B){return N.__proto__=B,N},_(u,p)}function L(u){var p=n();return function(){var N=e(u),B;if(p){var K=e(this).constructor;B=Reflect.construct(N,arguments,K)}else B=N.apply(this,arguments);return E(this,B)}}function E(u,p){if(p&&(h(p)==="object"||typeof p=="function"))return p;if(p!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return f(u)}function f(u){if(u===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return u}function n(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function e(u){return e=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(S){return S.__proto__||Object.getPrototypeOf(S)},e(u)}var r={},d,y;function l(u,p,S){S||(S=Error);function N(K,H,V){return typeof p=="string"?p:p(K,H,V)}var B=function(K){b(V,K);var H=L(V);function V(W,te,Z){var J;return s(this,V),J=H.call(this,N(W,te,Z)),J.code=u,J}return g(V)}(S);r[u]=B}function q(u,p){if(Array.isArray(u)){var S=u.length;return u=u.map(function(N){return String(N)}),S>2?"one of ".concat(p," ").concat(u.slice(0,S-1).join(", "),", or ")+u[S-1]:S===2?"one of ".concat(p," ").concat(u[0]," or ").concat(u[1]):"of ".concat(p," ").concat(u[0])}else return"of ".concat(p," ").concat(String(u))}function O(u,p,S){return u.substr(0,p.length)===p}function A(u,p,S){return(S===void 0||S>u.length)&&(S=u.length),u.substring(S-p.length,S)===p}function j(u,p,S){return typeof S!="number"&&(S=0),S+p.length>u.length?!1:u.indexOf(p,S)!==-1}return l("ERR_AMBIGUOUS_ARGUMENT",'The "%s" argument is ambiguous. %s',TypeError),l("ERR_INVALID_ARG_TYPE",function(u,p,S){d===void 0&&(d=We()),d(typeof u=="string","'name' must be a string");var N;typeof p=="string"&&O(p,"not ")?(N="must not be",p=p.replace(/^not /,"")):N="must be";var B;if(A(u," argument"))B="The ".concat(u," ").concat(N," ").concat(q(p,"type"));else{var K=j(u,".")?"property":"argument";B='The "'.concat(u,'" ').concat(K," ").concat(N," ").concat(q(p,"type"))}return B+=". Received type ".concat(h(S)),B},TypeError),l("ERR_INVALID_ARG_VALUE",function(u,p){var S=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"is invalid";y===void 0&&(y=Se());var N=y.inspect(p);return N.length>128&&(N="".concat(N.slice(0,128),"...")),"The argument '".concat(u,"' ").concat(S,". Received ").concat(N)},TypeError),l("ERR_INVALID_RETURN_VALUE",function(u,p,S){var N;return S&&S.constructor&&S.constructor.name?N="instance of ".concat(S.constructor.name):N="type ".concat(h(S)),"Expected ".concat(u,' to be returned from the "').concat(p,'"')+" function but got ".concat(N,".")},TypeError),l("ERR_MISSING_ARGS",function(){for(var u=arguments.length,p=new Array(u),S=0;S<u;S++)p[S]=arguments[S];d===void 0&&(d=We()),d(p.length>0,"At least one arg needs to be specified");var N="The ",B=p.length;switch(p=p.map(function(K){return'"'.concat(K,'"')}),B){case 1:N+="".concat(p[0]," argument");break;case 2:N+="".concat(p[0]," and ").concat(p[1]," arguments");break;default:N+=p.slice(0,B-1).join(", "),N+=", and ".concat(p[B-1]," arguments");break}return"".concat(N," must be specified")},TypeError),Re.codes=r,Re}var Ie,Qe;function Fr(){if(Qe)return Ie;Qe=1;function h(v,m){var U=Object.keys(v);if(Object.getOwnPropertySymbols){var x=Object.getOwnPropertySymbols(v);m&&(x=x.filter(function(C){return Object.getOwnPropertyDescriptor(v,C).enumerable})),U.push.apply(U,x)}return U}function g(v){for(var m=1;m<arguments.length;m++){var U=arguments[m]!=null?arguments[m]:{};m%2?h(Object(U),!0).forEach(function(x){s(v,x,U[x])}):Object.getOwnPropertyDescriptors?Object.defineProperties(v,Object.getOwnPropertyDescriptors(U)):h(Object(U)).forEach(function(x){Object.defineProperty(v,x,Object.getOwnPropertyDescriptor(U,x))})}return v}function s(v,m,U){return m=E(m),m in v?Object.defineProperty(v,m,{value:U,enumerable:!0,configurable:!0,writable:!0}):v[m]=U,v}function b(v,m){if(!(v instanceof m))throw new TypeError("Cannot call a class as a function")}function _(v,m){for(var U=0;U<m.length;U++){var x=m[U];x.enumerable=x.enumerable||!1,x.configurable=!0,"value"in x&&(x.writable=!0),Object.defineProperty(v,E(x.key),x)}}function L(v,m,U){return m&&_(v.prototype,m),Object.defineProperty(v,"prototype",{writable:!1}),v}function E(v){var m=f(v,"string");return u(m)==="symbol"?m:String(m)}function f(v,m){if(u(v)!=="object"||v===null)return v;var U=v[Symbol.toPrimitive];if(U!==void 0){var x=U.call(v,m);if(u(x)!=="object")return x;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(v)}function n(v,m){if(typeof m!="function"&&m!==null)throw new TypeError("Super expression must either be null or a function");v.prototype=Object.create(m&&m.prototype,{constructor:{value:v,writable:!0,configurable:!0}}),Object.defineProperty(v,"prototype",{writable:!1}),m&&A(v,m)}function e(v){var m=q();return function(){var x=j(v),C;if(m){var a=j(this).constructor;C=Reflect.construct(x,arguments,a)}else C=x.apply(this,arguments);return r(this,C)}}function r(v,m){if(m&&(u(m)==="object"||typeof m=="function"))return m;if(m!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return d(v)}function d(v){if(v===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return v}function y(v){var m=typeof Map=="function"?new Map:void 0;return y=function(x){if(x===null||!O(x))return x;if(typeof x!="function")throw new TypeError("Super expression must either be null or a function");if(typeof m<"u"){if(m.has(x))return m.get(x);m.set(x,C)}function C(){return l(x,arguments,j(this).constructor)}return C.prototype=Object.create(x.prototype,{constructor:{value:C,enumerable:!1,writable:!0,configurable:!0}}),A(C,x)},y(v)}function l(v,m,U){return q()?l=Reflect.construct.bind():l=function(C,a,i){var c=[null];c.push.apply(c,a);var R=Function.bind.apply(C,c),w=new R;return i&&A(w,i.prototype),w},l.apply(null,arguments)}function q(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function O(v){return Function.toString.call(v).indexOf("[native code]")!==-1}function A(v,m){return A=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(x,C){return x.__proto__=C,x},A(v,m)}function j(v){return j=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(U){return U.__proto__||Object.getPrototypeOf(U)},j(v)}function u(v){"@babel/helpers - typeof";return u=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(m){return typeof m}:function(m){return m&&typeof Symbol=="function"&&m.constructor===Symbol&&m!==Symbol.prototype?"symbol":typeof m},u(v)}var p=Se(),S=p.inspect,N=Ar(),B=N.codes.ERR_INVALID_ARG_TYPE;function K(v,m,U){return(U===void 0||U>v.length)&&(U=v.length),v.substring(U-m.length,U)===m}function H(v,m){if(m=Math.floor(m),v.length==0||m==0)return"";var U=v.length*m;for(m=Math.floor(Math.log(m)/Math.log(2));m;)v+=v,m--;return v+=v.substring(0,U-v.length),v}var V="",W="",te="",Z="",J={deepStrictEqual:"Expected values to be strictly deep-equal:",strictEqual:"Expected values to be strictly equal:",strictEqualObject:'Expected "actual" to be reference-equal to "expected":',deepEqual:"Expected values to be loosely deep-equal:",equal:"Expected values to be loosely equal:",notDeepStrictEqual:'Expected "actual" not to be strictly deep-equal to:',notStrictEqual:'Expected "actual" to be strictly unequal to:',notStrictEqualObject:'Expected "actual" not to be reference-equal to "expected":',notDeepEqual:'Expected "actual" not to be loosely deep-equal to:',notEqual:'Expected "actual" to be loosely unequal to:',notIdentical:"Values identical but not reference-equal:"},he=10;function de(v){var m=Object.keys(v),U=Object.create(Object.getPrototypeOf(v));return m.forEach(function(x){U[x]=v[x]}),Object.defineProperty(U,"message",{value:v.message}),U}function oe(v){return S(v,{compact:!1,customInspect:!1,depth:1e3,maxArrayLength:1/0,showHidden:!1,breakLength:1/0,showProxy:!1,sorted:!0,getters:!0})}function ye(v,m,U){var x="",C="",a=0,i="",c=!1,R=oe(v),w=R.split(`
1
+ import{B as qr}from"./vendor-utils-BgSaqjGx.js";import{p as ae}from"./vendor-react-CUXIiAnY.js";import{ag as Se,ah as jr,ai as xr,aj as Nr,ak as _r,al as Kr,am as Sr,an as Tr,ao as ke,ap as Ur,aq as Br,ar as Dr,as as Mr,a6 as Lr,r as Cr}from"./vendor-ux-r9bApERu.js";import{be as Or,aG as Vr}from"./index-DY2wgD65.js";var Pe={exports:{}},Re={},Je;function Ar(){if(Je)return Re;Je=1;function h(u){"@babel/helpers - typeof";return h=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(p){return typeof p}:function(p){return p&&typeof Symbol=="function"&&p.constructor===Symbol&&p!==Symbol.prototype?"symbol":typeof p},h(u)}function g(u,p,S){return Object.defineProperty(u,"prototype",{writable:!1}),u}function s(u,p){if(!(u instanceof p))throw new TypeError("Cannot call a class as a function")}function b(u,p){if(typeof p!="function"&&p!==null)throw new TypeError("Super expression must either be null or a function");u.prototype=Object.create(p&&p.prototype,{constructor:{value:u,writable:!0,configurable:!0}}),Object.defineProperty(u,"prototype",{writable:!1}),p&&_(u,p)}function _(u,p){return _=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(N,B){return N.__proto__=B,N},_(u,p)}function L(u){var p=n();return function(){var N=e(u),B;if(p){var K=e(this).constructor;B=Reflect.construct(N,arguments,K)}else B=N.apply(this,arguments);return E(this,B)}}function E(u,p){if(p&&(h(p)==="object"||typeof p=="function"))return p;if(p!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return f(u)}function f(u){if(u===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return u}function n(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function e(u){return e=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(S){return S.__proto__||Object.getPrototypeOf(S)},e(u)}var r={},d,y;function l(u,p,S){S||(S=Error);function N(K,H,V){return typeof p=="string"?p:p(K,H,V)}var B=function(K){b(V,K);var H=L(V);function V(W,te,Z){var J;return s(this,V),J=H.call(this,N(W,te,Z)),J.code=u,J}return g(V)}(S);r[u]=B}function q(u,p){if(Array.isArray(u)){var S=u.length;return u=u.map(function(N){return String(N)}),S>2?"one of ".concat(p," ").concat(u.slice(0,S-1).join(", "),", or ")+u[S-1]:S===2?"one of ".concat(p," ").concat(u[0]," or ").concat(u[1]):"of ".concat(p," ").concat(u[0])}else return"of ".concat(p," ").concat(String(u))}function O(u,p,S){return u.substr(0,p.length)===p}function A(u,p,S){return(S===void 0||S>u.length)&&(S=u.length),u.substring(S-p.length,S)===p}function j(u,p,S){return typeof S!="number"&&(S=0),S+p.length>u.length?!1:u.indexOf(p,S)!==-1}return l("ERR_AMBIGUOUS_ARGUMENT",'The "%s" argument is ambiguous. %s',TypeError),l("ERR_INVALID_ARG_TYPE",function(u,p,S){d===void 0&&(d=We()),d(typeof u=="string","'name' must be a string");var N;typeof p=="string"&&O(p,"not ")?(N="must not be",p=p.replace(/^not /,"")):N="must be";var B;if(A(u," argument"))B="The ".concat(u," ").concat(N," ").concat(q(p,"type"));else{var K=j(u,".")?"property":"argument";B='The "'.concat(u,'" ').concat(K," ").concat(N," ").concat(q(p,"type"))}return B+=". Received type ".concat(h(S)),B},TypeError),l("ERR_INVALID_ARG_VALUE",function(u,p){var S=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"is invalid";y===void 0&&(y=Se());var N=y.inspect(p);return N.length>128&&(N="".concat(N.slice(0,128),"...")),"The argument '".concat(u,"' ").concat(S,". Received ").concat(N)},TypeError),l("ERR_INVALID_RETURN_VALUE",function(u,p,S){var N;return S&&S.constructor&&S.constructor.name?N="instance of ".concat(S.constructor.name):N="type ".concat(h(S)),"Expected ".concat(u,' to be returned from the "').concat(p,'"')+" function but got ".concat(N,".")},TypeError),l("ERR_MISSING_ARGS",function(){for(var u=arguments.length,p=new Array(u),S=0;S<u;S++)p[S]=arguments[S];d===void 0&&(d=We()),d(p.length>0,"At least one arg needs to be specified");var N="The ",B=p.length;switch(p=p.map(function(K){return'"'.concat(K,'"')}),B){case 1:N+="".concat(p[0]," argument");break;case 2:N+="".concat(p[0]," and ").concat(p[1]," arguments");break;default:N+=p.slice(0,B-1).join(", "),N+=", and ".concat(p[B-1]," arguments");break}return"".concat(N," must be specified")},TypeError),Re.codes=r,Re}var Ie,Qe;function Fr(){if(Qe)return Ie;Qe=1;function h(v,m){var U=Object.keys(v);if(Object.getOwnPropertySymbols){var x=Object.getOwnPropertySymbols(v);m&&(x=x.filter(function(C){return Object.getOwnPropertyDescriptor(v,C).enumerable})),U.push.apply(U,x)}return U}function g(v){for(var m=1;m<arguments.length;m++){var U=arguments[m]!=null?arguments[m]:{};m%2?h(Object(U),!0).forEach(function(x){s(v,x,U[x])}):Object.getOwnPropertyDescriptors?Object.defineProperties(v,Object.getOwnPropertyDescriptors(U)):h(Object(U)).forEach(function(x){Object.defineProperty(v,x,Object.getOwnPropertyDescriptor(U,x))})}return v}function s(v,m,U){return m=E(m),m in v?Object.defineProperty(v,m,{value:U,enumerable:!0,configurable:!0,writable:!0}):v[m]=U,v}function b(v,m){if(!(v instanceof m))throw new TypeError("Cannot call a class as a function")}function _(v,m){for(var U=0;U<m.length;U++){var x=m[U];x.enumerable=x.enumerable||!1,x.configurable=!0,"value"in x&&(x.writable=!0),Object.defineProperty(v,E(x.key),x)}}function L(v,m,U){return m&&_(v.prototype,m),Object.defineProperty(v,"prototype",{writable:!1}),v}function E(v){var m=f(v,"string");return u(m)==="symbol"?m:String(m)}function f(v,m){if(u(v)!=="object"||v===null)return v;var U=v[Symbol.toPrimitive];if(U!==void 0){var x=U.call(v,m);if(u(x)!=="object")return x;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(v)}function n(v,m){if(typeof m!="function"&&m!==null)throw new TypeError("Super expression must either be null or a function");v.prototype=Object.create(m&&m.prototype,{constructor:{value:v,writable:!0,configurable:!0}}),Object.defineProperty(v,"prototype",{writable:!1}),m&&A(v,m)}function e(v){var m=q();return function(){var x=j(v),C;if(m){var a=j(this).constructor;C=Reflect.construct(x,arguments,a)}else C=x.apply(this,arguments);return r(this,C)}}function r(v,m){if(m&&(u(m)==="object"||typeof m=="function"))return m;if(m!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return d(v)}function d(v){if(v===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return v}function y(v){var m=typeof Map=="function"?new Map:void 0;return y=function(x){if(x===null||!O(x))return x;if(typeof x!="function")throw new TypeError("Super expression must either be null or a function");if(typeof m<"u"){if(m.has(x))return m.get(x);m.set(x,C)}function C(){return l(x,arguments,j(this).constructor)}return C.prototype=Object.create(x.prototype,{constructor:{value:C,enumerable:!1,writable:!0,configurable:!0}}),A(C,x)},y(v)}function l(v,m,U){return q()?l=Reflect.construct.bind():l=function(C,a,i){var c=[null];c.push.apply(c,a);var R=Function.bind.apply(C,c),w=new R;return i&&A(w,i.prototype),w},l.apply(null,arguments)}function q(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function O(v){return Function.toString.call(v).indexOf("[native code]")!==-1}function A(v,m){return A=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(x,C){return x.__proto__=C,x},A(v,m)}function j(v){return j=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(U){return U.__proto__||Object.getPrototypeOf(U)},j(v)}function u(v){"@babel/helpers - typeof";return u=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(m){return typeof m}:function(m){return m&&typeof Symbol=="function"&&m.constructor===Symbol&&m!==Symbol.prototype?"symbol":typeof m},u(v)}var p=Se(),S=p.inspect,N=Ar(),B=N.codes.ERR_INVALID_ARG_TYPE;function K(v,m,U){return(U===void 0||U>v.length)&&(U=v.length),v.substring(U-m.length,U)===m}function H(v,m){if(m=Math.floor(m),v.length==0||m==0)return"";var U=v.length*m;for(m=Math.floor(Math.log(m)/Math.log(2));m;)v+=v,m--;return v+=v.substring(0,U-v.length),v}var V="",W="",te="",Z="",J={deepStrictEqual:"Expected values to be strictly deep-equal:",strictEqual:"Expected values to be strictly equal:",strictEqualObject:'Expected "actual" to be reference-equal to "expected":',deepEqual:"Expected values to be loosely deep-equal:",equal:"Expected values to be loosely equal:",notDeepStrictEqual:'Expected "actual" not to be strictly deep-equal to:',notStrictEqual:'Expected "actual" to be strictly unequal to:',notStrictEqualObject:'Expected "actual" not to be reference-equal to "expected":',notDeepEqual:'Expected "actual" not to be loosely deep-equal to:',notEqual:'Expected "actual" to be loosely unequal to:',notIdentical:"Values identical but not reference-equal:"},he=10;function de(v){var m=Object.keys(v),U=Object.create(Object.getPrototypeOf(v));return m.forEach(function(x){U[x]=v[x]}),Object.defineProperty(U,"message",{value:v.message}),U}function oe(v){return S(v,{compact:!1,customInspect:!1,depth:1e3,maxArrayLength:1/0,showHidden:!1,breakLength:1/0,showProxy:!1,sorted:!0,getters:!0})}function ye(v,m,U){var x="",C="",a=0,i="",c=!1,R=oe(v),w=R.split(`
2
2
  `),I=oe(m).split(`
3
3
  `),D=0,z="";if(U==="strictEqual"&&u(v)==="object"&&u(m)==="object"&&v!==null&&m!==null&&(U="strictEqualObject"),w.length===1&&I.length===1&&w[0]!==I[0]){var k=w[0].length+I[0].length;if(k<=he){if((u(v)!=="object"||v===null)&&(u(m)!=="object"||m===null)&&(v!==0||m!==0))return"".concat(J[U],`
4
4