@abtnode/blocklet-services 1.16.44-beta-20250523-232943-369d21c5 → 1.16.44-beta-20250526-130644-5e05dc90

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 (137) hide show
  1. package/api/util/index.js +6 -0
  2. package/dist/assets/{AdapterDayjs-DnsMePpQ.js → AdapterDayjs-Bs_Q9JXL.js} +1 -1
  3. package/dist/assets/{ArrowDropDown-Dzy2X1bv.js → ArrowDropDown-DUn14Acv.js} +1 -1
  4. package/dist/assets/{CheckCircle-DA1-Q3VQ.js → CheckCircle-DsdIIzds.js} +1 -1
  5. package/dist/assets/{ChevronLeft-C7-bj_BM.js → ChevronLeft-BXDIS6AE.js} +1 -1
  6. package/dist/assets/{ChevronRight-CA18V4hg.js → ChevronRight-BfSAowju.js} +1 -1
  7. package/dist/assets/{DeleteOutline-DIXSGJ49.js → DeleteOutline-lCPjjhKz.js} +1 -1
  8. package/dist/assets/{Done-BHbsILFJ.js → Done-BoNuG9Iy.js} +1 -1
  9. package/dist/assets/{Download-CmhNaqwS.js → Download-4NCgy4QK.js} +1 -1
  10. package/dist/assets/{Edit-CNRD5aKM.js → Edit-BqpcPg9o.js} +1 -1
  11. package/dist/assets/{Error-DDQf7Wzw.js → Error-B7SzGNr8.js} +1 -1
  12. package/dist/assets/{ExpandLess-D15nWpBQ.js → ExpandLess-EFI-Ij5Y.js} +1 -1
  13. package/dist/assets/{Google-BEEvQjkX.js → Google-DYpd3dQM.js} +1 -1
  14. package/dist/assets/{Home-C8za96Ud.js → Home-Ccm-s4KT.js} +1 -1
  15. package/dist/assets/{InfoOutlined-Cxpk0UTX.js → InfoOutlined-Duq1UDPu.js} +1 -1
  16. package/dist/assets/{Launch-CKr_eo1b.js → Launch-ipC6Ic2p.js} +1 -1
  17. package/dist/assets/{LaunchOutlined-Drryv7vp.js → LaunchOutlined-C-M166rt.js} +1 -1
  18. package/dist/assets/{MoreHoriz-CKCGMlB8.js → MoreHoriz-jwSUI8G2.js} +1 -1
  19. package/dist/assets/{PlayArrow-CrmMAssx.js → PlayArrow-Cv1uXXJt.js} +1 -1
  20. package/dist/assets/{TuneOutlined-Dp4gMD_8.js → TuneOutlined-BvxrpP1M.js} +1 -1
  21. package/dist/assets/{ViewList-ByzGtByR.js → ViewList-PrXAmQts.js} +1 -1
  22. package/dist/assets/{access-control-EYKfTdyZ.js → access-control-Dvlg7x0h.js} +1 -1
  23. package/dist/assets/{actions-XNIU_ion.js → actions-BA8hCarh.js} +1 -1
  24. package/dist/assets/{add-component-core-CKSc86QZ.js → add-component-core-RTpy3oS3.js} +31 -31
  25. package/dist/assets/{add-resource-DFFU3s6r.js → add-resource-DKnJ3N_A.js} +1 -1
  26. package/dist/assets/{addon-DGwzoD-f.js → addon-DmglQWiB.js} +1 -1
  27. package/dist/assets/{advanced-dEhSilIC.js → advanced-CzssFl-I.js} +1 -1
  28. package/dist/assets/{appearance-fl_Qmz60.js → appearance-DIaCQMdO.js} +1 -1
  29. package/dist/assets/{audit-logs-T_rQofLT.js → audit-logs-BwUEGKxZ.js} +1 -1
  30. package/dist/assets/{authorize-BAWXv5fL.js → authorize-DqVeyhPc.js} +1 -1
  31. package/dist/assets/{base32-DEQDAhbh.js → base32-D35YSxth.js} +1 -1
  32. package/dist/assets/{branding-BaN8vHON.js → branding-D9cgoVZN.js} +2 -2
  33. package/dist/assets/{branding-BTvktwMq.js → branding-yRBlkhNg.js} +1 -1
  34. package/dist/assets/{bundle-avatar-Bn82ny8E.js → bundle-avatar-BP8xFngr.js} +1 -1
  35. package/dist/assets/{button-D7WVH4Bm.js → button-Da_a32NC.js} +1 -1
  36. package/dist/assets/{click-to-copy-DsH0RQVg.js → click-to-copy-B26zKr7i.js} +1 -1
  37. package/dist/assets/{collapse-DRHShQoZ.js → collapse-BF9pIOsL.js} +1 -1
  38. package/dist/assets/{complete-B3gpz2H0.js → complete-BFgID4Zc.js} +1 -1
  39. package/dist/assets/{component-CxESL3Iu.js → component-ESUBkOno.js} +1 -1
  40. package/dist/assets/{config-CKVskCpr.js → config-Bt_JcEZR.js} +1 -1
  41. package/dist/assets/config-navigation-Dyu8rgOf.js +26 -0
  42. package/dist/assets/{config-C77UXU2G.js → config-rMbgmGkF.js} +1 -1
  43. package/dist/assets/{config-space-CPPhaFPB.js → config-space-D2Cjeyk0.js} +1 -1
  44. package/dist/assets/{confirm-Dg7hYCJT.js → confirm-CiiHIA-a.js} +1 -1
  45. package/dist/assets/{connect-Ctst7unk.js → connect-Druwkt_h.js} +1 -1
  46. package/dist/assets/{connect-C3we9ebX.js → connect-QKA3Mcyx.js} +1 -1
  47. package/dist/assets/{connect-to-DOaPjxw6.js → connect-to-BLuNgRR8.js} +1 -1
  48. package/dist/assets/{dashboard-i-yx5Pql.js → dashboard-vkFEu-wZ.js} +13 -13
  49. package/dist/assets/{delete-confirm-BvvDet1u.js → delete-confirm-BPtFZ4JP.js} +1 -1
  50. package/dist/assets/{did-address-2a_50VlM.js → did-address-BtAnHi7m.js} +1 -1
  51. package/dist/assets/{domain-CuSKFz52.js → domain-CSsoH0JI.js} +1 -1
  52. package/dist/assets/{domain-action-card-DRQUwMj6.js → domain-action-card-CEIB4y6O.js} +1 -1
  53. package/dist/assets/domains-DySxSy7r.js +1 -0
  54. package/dist/assets/{email-B00NK4Kp.js → email-D6f0kuZJ.js} +1 -1
  55. package/dist/assets/{exchange-passport-DZ1Omnfv.js → exchange-passport-CyZiYD_w.js} +1 -1
  56. package/dist/assets/{fuel-DkJB9TXk.js → fuel-BzVicj7n.js} +1 -1
  57. package/dist/assets/{gen-access-key-DME0XOB3.js → gen-access-key-DiLTrx9k.js} +1 -1
  58. package/dist/assets/{get-safe-url-BdFxF8pA.js → get-safe-url-CiQ8_q49.js} +1 -1
  59. package/dist/assets/{get-safe-url-DfW-qoLB.js → get-safe-url-DSt3eVbO.js} +1 -1
  60. package/dist/assets/{home-DtVAZY8s.js → home-AVCu7DmN.js} +1 -1
  61. package/dist/assets/{iframe-dmrNn49R.js → iframe-CJ1Wo1WH.js} +1 -1
  62. package/dist/assets/{index-BGbF_TCU.js → index-8lA5-nM7.js} +3 -3
  63. package/dist/assets/{index-Ddqbpb3u.js → index-99E5Ux4J.js} +1 -1
  64. package/dist/assets/{index-Diy9mBRc.js → index-B7Ih-tce.js} +1 -1
  65. package/dist/assets/{index-BnFkiSCK.js → index-BDhncHq5.js} +1 -1
  66. package/dist/assets/{index-C5N0NjEs.js → index-BhMu-yLO.js} +1 -1
  67. package/dist/assets/{index-C2FIN4Ee.js → index-Biu0_3VS.js} +1 -1
  68. package/dist/assets/{index-DWV8Jczt.js → index-CCsDojsm.js} +1 -1
  69. package/dist/assets/index-CG5aY0sO.js +6 -0
  70. package/dist/assets/{index-Dmcajroh.js → index-CVeug3aj.js} +1 -1
  71. package/dist/assets/{index-CBALX7k4.js → index-Cj_-M8SX.js} +1 -1
  72. package/dist/assets/{index-AMPo4oen.js → index-CkuD5Vfn.js} +1 -1
  73. package/dist/assets/{index-BOrnIOJA.js → index-CpRFDVw4.js} +1 -1
  74. package/dist/assets/{index-Ck-L27nB.js → index-DJzuhKQh.js} +4 -4
  75. package/dist/assets/{index-BAVIVYtT.js → index-D_aS7-BV.js} +1 -1
  76. package/dist/assets/{index-Cf3pTZQS.js → index-DeD4o13y.js} +1 -1
  77. package/dist/assets/{index-C2wxmxz2.js → index-IuBCAZn2.js} +1 -1
  78. package/dist/assets/{index-D669bu3T.js → index-Jryn5flm.js} +4 -4
  79. package/dist/assets/{index-CXjHuFcg.js → index-XdA5ax9j.js} +1 -1
  80. package/dist/assets/{index-C9-sIzmv.js → index-hO3Mo-qi.js} +1 -1
  81. package/dist/assets/{index-iphP5FWX.js → index-nhpGyAFA.js} +1 -1
  82. package/dist/assets/{invitation-DgyvRGj7.js → invitation-CbZcjplG.js} +1 -1
  83. package/dist/assets/{invite-CpiILEDC.js → invite-CG68Mxoz.js} +1 -1
  84. package/dist/assets/{issue-passport-BtYhvb89.js → issue-passport-3aP4u6AF.js} +1 -1
  85. package/dist/assets/{item-JiENn3N2.js → item-DLwktWNI.js} +1 -1
  86. package/dist/assets/{landing-page-DErP-951.js → landing-page-B3KyXZXw.js} +1 -1
  87. package/dist/assets/{layout-D40Fy8O5.js → layout-BzSCNNrb.js} +1 -1
  88. package/dist/assets/{list-vUoPUWDO.js → list-D29W3nMj.js} +1 -1
  89. package/dist/assets/{list-Dm4NCtd2.js → list-y33VQBpr.js} +2 -2
  90. package/dist/assets/localization-Y6Zfd1Kb.js +1 -0
  91. package/dist/assets/{log-B2MHND50.js → log-D5wtGlYv.js} +1 -1
  92. package/dist/assets/{logger-DRlJhYNs.js → logger-DTzDRWqY.js} +1 -1
  93. package/dist/assets/{login-CGPNIfmK.js → login-Bq9K3qHu.js} +1 -1
  94. package/dist/assets/{login-oauth-callback-T6cLlJXo.js → login-oauth-callback-DjqRVYt8.js} +1 -1
  95. package/dist/assets/{logo-uploader-PUDZmwys.js → logo-uploader-B-RJuXxH.js} +3 -3
  96. package/dist/assets/{lost-passport-CPgs6iwG.js → lost-passport-n3UXYXA8.js} +1 -1
  97. package/dist/assets/{open-window-xER4N-kf.js → open-window-Dyr68wBS.js} +1 -1
  98. package/dist/assets/{overview-DnOgyK55.js → overview-C2L5ReTa.js} +1 -1
  99. package/dist/assets/{page-header-IRqa6Qvs.js → page-header-BS-digIw.js} +1 -1
  100. package/dist/assets/{passport-item-BugDNovJ.js → passport-item-B9iOvD4Y.js} +1 -1
  101. package/dist/assets/{permission-BkpeOUF9.js → permission-CbTKdC7W.js} +1 -1
  102. package/dist/assets/{preferences-CaXn4vHX.js → preferences-DETzTJeF.js} +1 -1
  103. package/dist/assets/{profile-embed-DP-NpR-H.js → profile-embed-7uAZGWnU.js} +1 -1
  104. package/dist/assets/{publish-resource-3814heud.js → publish-resource-Bk1sOsMC.js} +1 -1
  105. package/dist/assets/{react-beautiful-dnd.esm-CXMxXaUW.js → react-beautiful-dnd.esm-WW1RMrIr.js} +1 -1
  106. package/dist/assets/{runtime-DiYnPWFr.js → runtime-CA329eRU.js} +1 -1
  107. package/dist/assets/sdk-Bxy9kDUo.js +1 -0
  108. package/dist/assets/{security-B9_Hq9IS.js → security-BYPCwU9I.js} +1 -1
  109. package/dist/assets/{session-E0e-X6-a.js → session-ugMCR4Iu.js} +1 -1
  110. package/dist/assets/{setup-BaybnOtz.js → setup-BuHGJK0U.js} +3 -3
  111. package/dist/assets/{spaces-BKlIkPYo.js → spaces-CTEbtAyX.js} +1 -1
  112. package/dist/assets/{start-CGbnYNse.js → start-Df7Wiv2W.js} +1 -1
  113. package/dist/assets/{starting-progress-CyKicFZc.js → starting-progress-Dvw39Hou.js} +1 -1
  114. package/dist/assets/{status-Bcm8tb3P.js → status-CH0vjcu4.js} +1 -1
  115. package/dist/assets/{step-actions-Cg48h78A.js → step-actions-QyMIKyQA.js} +1 -1
  116. package/dist/assets/{studio-BSiEg8xP.js → studio-B1PGcNac.js} +1 -1
  117. package/dist/assets/{switch-control-DzZXz9Ks.js → switch-control-D5eJVUaV.js} +1 -1
  118. package/dist/assets/{table-tips-BP0JTpDH.js → table-tips-biAHyN1z.js} +1 -1
  119. package/dist/assets/{traffic-B6tOFf5s.js → traffic-DVUW14yF.js} +1 -1
  120. package/dist/assets/{transfer-DgLkTH8K.js → transfer-CsdMd63R.js} +1 -1
  121. package/dist/assets/{unsubscribe-BqDBVi9S.js → unsubscribe-1jeXeeTi.js} +1 -1
  122. package/dist/assets/{use-blocklet-logo-7IVWq7WH.js → use-blocklet-logo-a8QJI4r-.js} +1 -1
  123. package/dist/assets/{useLocalStorage-DvcK7KsP.js → useLocalStorage-BDA4jbwL.js} +1 -1
  124. package/dist/assets/{user-center-Sntfjt65.js → user-center-BQcfE646.js} +3 -3
  125. package/dist/assets/{util-D9dsxEYk.js → util-BwAoiA7E.js} +1 -1
  126. package/dist/assets/{util-IzAdTupy.js → util-D-q3oYk9.js} +1 -1
  127. package/dist/assets/{vendor-arcblock-CUb0jDdY.js → vendor-arcblock-5qqHEVGo.js} +4 -4
  128. package/dist/assets/{vendor-ux-did-connect-DprdyYny.js → vendor-ux-did-connect-DROQhYpS.js} +92 -92
  129. package/dist/assets/{wrap-locale-Q616uqhq.js → wrap-locale-CvN5krOj.js} +1 -1
  130. package/dist/index.html +3 -3
  131. package/dist/service-worker.js +1 -1
  132. package/package.json +31 -31
  133. package/dist/assets/config-navigation-C40INCPl.js +0 -26
  134. package/dist/assets/domains-QTRMAE0S.js +0 -1
  135. package/dist/assets/index-v_V1vBsu.js +0 -6
  136. package/dist/assets/localization-Dale72UG.js +0 -1
  137. package/dist/assets/sdk-DeUOtvaE.js +0 -1
@@ -1 +1 @@
1
- import{a as B,Z as q,bN as U,I as ge,bO as fe,a0 as je,a7 as ye,bu as we}from"./vendor-ux-did-connect-DprdyYny.js";import{t as ke,l as de,j as Ee}from"./vendor-hooks-BgUTpb6X.js";import{r as T,b as Q}from"./vendor-react-DEoibe3W.js";import{d as X}from"./InfoOutlined-Cxpk0UTX.js";import{j as ve,O as Ce}from"./vendor-arcblock-CUb0jDdY.js";import{D as F,aA as Se,aB as K,G as pe,y as Te}from"./index-Ck-L27nB.js";import{u as _}from"./dashboard-i-yx5Pql.js";import{u as Re}from"./use-mobile-BAa0wi8o.js";import{H as t,j as e,D as Ie,aj as ze,t as De,aa as m,O as re,T as R,ab as M,ak as Z,z as Pe,y as H,bs as le,bR as Y,ad as $,L as J,A as G,bc as Oe,E as L,I as ee,C as Ae,bq as We,al as D,cg as qe,X as $e,bb as V,bp as Le,b4 as Be,ch as Me,ci as He,b5 as Ne,an as Fe,c0 as _e,s as ue,v as Ue,cj as Ke,ck as Ye,cl as Ve,cm as Je}from"./vendor-mui-core-BV2FUxWJ.js";import{d as Ge}from"./ExpandLess-D15nWpBQ.js";import{b as he,z as Qe,A as Xe}from"./vendor-utils-rHXShPKm.js";import{C as Ze}from"./confirm-Dg7hYCJT.js";import{A as et}from"./actions-XNIU_ion.js";import{T as ae}from"./table-tips-BP0JTpDH.js";import"./lottie-web-jYmAQWuC.js";import"./useLocalStorage-DvcK7KsP.js";import"./index-8eXqqyHQ.js";import"./PlayArrow-CrmMAssx.js";import"./get-safe-url-BdFxF8pA.js";import"./session-E0e-X6-a.js";import"./use-blocklet-logo-7IVWq7WH.js";import"./dot-DX56IFTM.js";import"./useAsync-Dv214fz8.js";import"./useSetState-CWq0AVWn.js";import"./use-mobile-C21X4TYN.js";import"./MoreHoriz-CKCGMlB8.js";const tt=o=>{var f,w;const[p,u]=T.useState(null),[E,s]=T.useState(!o),[I,c]=T.useState(null),{blocklet:a}=pe(),d=(w=(f=a==null?void 0:a.site)==null?void 0:f.domainAliases[0])==null?void 0:w.value,j=T.useMemo(()=>{const b={};return p&&(p.sources.forEach(l=>{b[l.did]={source:l,events:[],count:0}}),p.events.forEach(l=>{b[l.source]&&(b[l.source].events.push(l),b[l.source].count+=1)})),b},[p]),y=async()=>{try{if(s(!0),!d)return;const l=await(await fetch(`https://${d}/.well-known/service/openevent.json`)).json();u(l),c(null)}catch(b){c(b instanceof Error?b:new Error(String(b)))}finally{s(!1)}};return T.useEffect(()=>{y()},[d]),{openEvent:p,setOpenEvent:u,eventsBySource:j,loading:E,error:I,loadData:y}};function te({eventsBySource:o,selectedEvents:p,setSelectedEvents:u,error:E}){const{t:s}=B(),[I,c]=T.useState({}),a=T.useMemo(()=>{const l={};return Object.entries(o).forEach(([g,{events:h}])=>{const S=h.filter(x=>p[`${x.type}-${x.source}`]).length;l[g]=S}),l},[o,p]),d=T.useMemo(()=>Object.values(a).reduce((l,g)=>l+g,0),[a]),j=T.useMemo(()=>Object.values(o).reduce((l,{events:g})=>l+g.length,0),[o]),y=(l,g)=>{g.stopPropagation(),c({...I,[l]:!I[l]})},f=l=>{const g=`${l.type}-${l.source}`;u(h=>({...h,[g]:!h[g]}))},w=(l,g)=>{const h={};l.forEach(S=>{const x=`${S.type}-${S.source}`;h[x]=!g}),u(S=>({...S,...h}))},b=l=>{const g={};Object.values(o).forEach(({events:h})=>{h.forEach(S=>{const x=`${S.type}-${S.source}`;g[x]=l.target.checked})}),u(g)};return e.jsxs(m,{sx:{width:"100%"},children:[e.jsxs(m,{sx:{display:"flex",alignItems:"center",mb:1,mt:1},children:[e.jsx(le,{control:e.jsx(Y,{onChange:b,checked:d>0&&d===j}),label:e.jsxs(m,{sx:{display:"flex",alignItems:"center",cursor:"pointer"},children:[s("webhookEndpoint.selectAllEvents"),e.jsx(m,{sx:{display:"flex",alignItems:"center"},children:e.jsx($,{title:s("webhookEndpoint.selectAllEventsTooltip"),placement:"right",children:e.jsx(X,{fontSize:"small",sx:{ml:.5,cursor:"help"}})})})]}),sx:{m:0}}),d>0&&e.jsx(R,{variant:"body2",color:"primary",sx:{ml:"auto"},children:s("webhookEndpoint.selectedEventsCount",{count:d})})]}),e.jsx(m,{sx:{maxHeight:"50vh",overflow:"auto"},children:e.jsx(J,{disablePadding:!0,sx:{border:"1px solid",borderColor:"divider",borderRadius:"4px"},children:Object.entries(o).map(([l,{source:g,events:h,count:S}],x)=>{const z=a[l]>0,k=a[l]===h.length&&h.length>0,O=I[l];return e.jsxs(Q.Fragment,{children:[e.jsx(G,{sx:{borderBottom:({palette:i})=>x<Object.keys(o).length-1?`1px solid ${i.divider}`:"none",px:2,py:1.5,"&:hover":{bgcolor:"rgba(0, 0, 0, 0.02)"}},children:e.jsxs(m,{sx:{display:"flex",width:"100%",justifyContent:"space-between",alignItems:"center"},onClick:i=>{i.target.closest(".MuiFormControlLabel-root")||y(l,i)},children:[e.jsx(m,{sx:{display:"flex",alignItems:"center"},children:h.length>0&&e.jsx(le,{control:e.jsx(Y,{checked:k,indeterminate:z&&!k,onChange:i=>{i.stopPropagation(),w(h,k)}}),label:e.jsxs(m,{sx:{display:"flex",alignItems:"center",gap:1},children:[g.logo&&e.jsx(Oe,{src:g.logo,sx:{width:24,height:24}}),e.jsx(m,{children:g.title||l}),z&&e.jsx(L,{label:s("webhookEndpoint.selectedCount",{count:a[l]}),size:"small",sx:{mt:"2px",height:"20px",fontSize:"12px",bgcolor:i=>`${i.palette.primary.main}20`,color:"primary.main",fontWeight:500}})]}),sx:{m:0,"& .MuiFormControlLabel-label":{flex:1}}})}),e.jsxs(m,{sx:{display:"flex",alignItems:"center"},children:[e.jsx(R,{variant:"body2",color:"text.secondary",sx:{mr:1},children:s("webhookEndpoint.eventsCount",{count:S})}),h.length>0&&e.jsx(ee,{size:"small",edge:"end",children:O?e.jsx(Ge,{}):e.jsx(ve,{})})]})]})}),h.length>0&&e.jsx(Ae,{in:O,timeout:"auto",unmountOnExit:!0,children:e.jsx(J,{disablePadding:!0,sx:{pl:2,pr:2,py:1,bgcolor:"rgba(0, 0, 0, 0.01)"},children:h.map(i=>{const r=`${i.type}-${i.source}`,n=!!p[r];return e.jsx(G,{dense:!0,sx:{py:.75},onClick:()=>f(i),children:e.jsxs(m,{sx:{display:"flex",alignItems:"flex-start",width:"100%"},children:[e.jsx(Y,{checked:n,sx:{mr:1}}),e.jsxs(m,{children:[e.jsx(R,{variant:"body1",sx:{cursor:"pointer"},children:i.type}),e.jsx(R,{variant:"caption",color:"text.disabled",sx:{display:"block",cursor:"pointer"},children:i.description})]})]})},r)})})})]},l)})})}),E&&e.jsx(We,{error:!0,sx:{mt:1},children:E})]})}te.propTypes={eventsBySource:t.objectOf(t.shape({source:t.shape({did:t.string.isRequired,title:t.string,description:t.string,version:t.string,logo:t.string}).isRequired,events:t.arrayOf(t.shape({type:t.string.isRequired,description:t.string.isRequired,source:t.string.isRequired})).isRequired,count:t.number.isRequired})).isRequired,selectedEvents:t.objectOf(t.bool).isRequired,setSelectedEvents:t.func.isRequired,error:t.string};te.defaultProps={error:null};function oe({id:o,url:p,description:u,enabledEvents:E,onSubmit:s,onClose:I}){var i;const{t:c}=B(),[a,d]=T.useState({}),{teamDid:j}=_(),{api:y}=F(),{loading:f,error:w,eventsBySource:b}=tt(),{control:l,handleSubmit:g,formState:{errors:h},reset:S,setValue:x,trigger:z}=Se({defaultValues:{url:"",description:""}});T.useEffect(()=>{const r=Object.values(a).some(n=>n);x("selectedEvents",r?"valid":""),z("selectedEvents")},[a,x,z]);const k=()=>{d({}),S(),I()},O=async r=>{const n=Object.keys(a).filter(v=>a[v]),C={url:r.url,description:r.description,enabledEvents:n.map(v=>{const[P,W]=v.split("-");return!P||!W?null:{type:P,source:W}}).filter(Boolean)};try{if(o){const v=await y.updateWebhookEndpoint({input:{teamDid:j,id:o,data:C}});q.success(`${c("webhookEndpoint.updateWebhook")} ${c("webhookEndpoint.success")}`),s(v)}else{const v=await y.createWebhookEndpoint({input:{teamDid:j,input:C}});q.success(`${c("webhookEndpoint.createWebhook")} ${c("webhookEndpoint.success")}`),s(v)}}catch(v){q.error(v==null?void 0:v.message)}k()};return T.useEffect(()=>{S({url:p,description:u}),d(E.reduce((r,n)=>(r[`${n.type}-${n.source}`]=!0,r),{}))},[S,d,p,u,E]),e.jsx(Ie,{open:!0,onClose:k,maxWidth:"lg",fullWidth:!0,sx:{"& .MuiDialog-paper":{minHeight:600}},children:e.jsxs("form",{onSubmit:g(O),children:[e.jsx(ze,{children:c(o?"webhookEndpoint.editWebhookTitle":"webhookEndpoint.createWebhookTitle")}),e.jsx(De,{children:e.jsxs(m,{sx:{display:"flex",flexDirection:"column",gap:2,mt:2},children:[e.jsx(K,{name:"url",control:l,rules:{required:c("webhookEndpoint.validation.urlRequired"),pattern:{value:/^(http|https):\/\/[^ "]+$/,message:c("webhookEndpoint.validation.urlInvalid")}},render:({field:r})=>{var n;return e.jsx(re,{...r,label:c("webhookEndpoint.url.label"),fullWidth:!0,error:!!h.url,helperText:(n=h.url)==null?void 0:n.message})}}),e.jsx(K,{name:"description",control:l,rules:{required:c("webhookEndpoint.validation.descriptionRequired")},render:({field:r})=>{var n;return e.jsx(re,{...r,label:c("webhookEndpoint.description.label"),fullWidth:!0,multiline:!0,minRows:2,maxRows:4,error:!!h.description,helperText:(n=h.description)==null?void 0:n.message})}}),e.jsx(K,{name:"selectedEvents",control:l,rules:{required:c("webhookEndpoint.validation.eventRequired")},render:({field:r})=>e.jsx("input",{type:"hidden",...r})}),!f&&b&&Object.keys(b).length>0&&e.jsx(te,{eventsBySource:b,selectedEvents:a,setSelectedEvents:d,error:(i=h.selectedEvents)==null?void 0:i.message}),!f&&(!b||Object.keys(b).length===0)&&e.jsx(R,{color:"text.secondary",children:c("webhookEndpoint.noAvailableEvents")}),f&&e.jsx(m,{sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"500px",width:"100%"},children:e.jsx(M,{size:20})}),w&&e.jsx(Z,{severity:"error",children:c("webhookEndpoint.loadingError",{message:w==null?void 0:w.message})})]})}),e.jsxs(Pe,{sx:{p:"8px 24px 24px"},children:[e.jsx(H,{onClick:k,children:c("common.cancel")}),e.jsx(H,{type:"submit",variant:"contained",color:"primary",children:c(o?"webhookEndpoint.updateWebhook":"webhookEndpoint.saveWebhook")})]})]})})}oe.propTypes={onSubmit:t.func.isRequired,id:t.string,url:t.string,description:t.string,enabledEvents:t.arrayOf(t.shape({type:t.string.isRequired,source:t.string.isRequired})),onClose:t.func};oe.defaultProps={id:null,url:"",description:"",enabledEvents:[],onClose:()=>{}};function xe(o){switch(o){case"enabled":return"success";case"disabled":default:return"default"}}const ot=(o="en")=>o==="tw"?"zh":o;function N(o,p="YYYY-MM-DD HH:mm:ss",u="en"){return o?Te(o).locale(ot(u)).format(p):"-"}function st(o){return typeof o=="number"?!1:he(o)}function nt(o){return o>=200&&o<300}function A(o){const p=st(o.value);return e.jsxs(e.Fragment,{children:[e.jsxs(D,{direction:"column",alignItems:"flex-start",children:[e.jsxs(R,{component:"div",variant:"body1",mb:1,color:"text.primary",sx:{fontWeight:500},children:[o.label,!!o.tip&&e.jsx($,{title:o.tip,children:e.jsx(qe,{fontSize:"small"})})]}),e.jsx(R,{component:"div",variant:"body1",color:p?"text.disabled":"text.secondary",sx:{width:"100%",minHeight:"24px"},children:p?"-":o.value})]}),o.divider&&e.jsx($e,{orientation:"vertical",flexItem:!0})]})}A.propTypes={label:t.oneOfType([t.string,t.node]).isRequired,value:t.oneOfType([t.string,t.node]).isRequired,tip:t.oneOfType([t.string,t.node]),divider:t.bool};A.defaultProps={tip:"",divider:!1};function se(o){return e.jsxs(D,{className:"section-header",direction:"row",justifyContent:"space-between",alignItems:"center",flexWrap:"wrap",gap:1,sx:{mb:o.mb,mt:o.mt,pb:1},children:[e.jsx(R,{variant:"h3",sx:{fontSize:{xs:"18px",md:"1.09375rem"}},component:"div",children:o.title}),o.children]})}se.propTypes={title:t.oneOfType([t.string,t.node]).isRequired,children:t.node,mb:t.number,mt:t.number};se.defaultProps={children:null,mb:1.5,mt:1.5};const it=o=>{const p={};return o.forEach(u=>{var s;const E=new Date(u.createdAt).toLocaleDateString();p[E]||(p[E]=[]),(s=p[E])==null||s.push(u)}),p};function ne({eventId:o,webhookEndpointId:p,event:u}){const{api:E}=F(),{t:s}=B(),{teamDid:I}=_(),{blocklet:c}=pe(),{data:a,loadMore:d,loadingMore:j,loading:y}=ke(x=>{const k=x?Math.ceil(x.list.length/15)+1:1;return E.getWebhookAttempts({input:{teamDid:I,input:{eventId:o,webhookId:p},paging:{page:k,pageSize:15}}})},{reloadDeps:[o,p]}),f=(a==null?void 0:a.list)||[],[w,b]=T.useState(null),l=it(f);T.useEffect(()=>{!w&&(a!=null&&a.list.length)&&b(a.list[0])},[a==null?void 0:a.list.length,w]);const g=x=>{b(x)};if(y)return e.jsx(M,{});const h=a&&a.list.length<a.paging.total,S=x=>{var z,k,O,i,r;if(x.responseBody&&((z=x.responseBody)!=null&&z.sessionId)&&((k=x.responseBody)!=null&&k.projectId)&&((O=x.responseBody)!=null&&O.agentId)){const n=(r=(i=c==null?void 0:c.site)==null?void 0:i.domainAliases[0])==null?void 0:r.value,C=(c.children||[]).find(P=>{var W;return((W=P==null?void 0:P.meta)==null?void 0:W.name)==="ai-studio"}),v=Qe(Xe(`https://${n}`,(C==null?void 0:C.mountPoint)||"","projects",x.responseBody.projectId,"logs/main"),{sessionId:x.responseBody.sessionId,agentId:x.responseBody.agentId});return e.jsx(ee,{sx:{fontSize:20},onClick:()=>window.open(v,"_blank"),children:e.jsx(m,{component:ge,icon:fe})})}return null};return e.jsxs(V,{container:!0,spacing:{xs:0,md:1},sx:{height:1},children:[e.jsx(V,{item:!0,xs:12,md:4,height:1,children:he(Object.keys(l))?e.jsx(R,{color:"text.secondary",children:s("webhookEndpoint.waitingForEvents")}):e.jsxs(e.Fragment,{children:[e.jsx(J,{sx:{maxHeight:"calc(100% - 40px)",py:0,overflowY:"auto"},children:Object.entries(l).map(([x,z])=>e.jsxs(Q.Fragment,{children:[e.jsx(Le,{children:x}),z.map(k=>e.jsxs(G,{sx:{cursor:"pointer"},onClick:()=>g(k),selected:w===k,secondaryAction:e.jsx(R,{color:"text.secondary",children:N(k.createdAt,"HH:mm:ss")}),children:[e.jsx(Be,{sx:{minWidth:0,mr:1.5},children:nt(k.responseStatus)===!1?e.jsx(Me,{color:"error"}):e.jsx(He,{color:"success"})}),e.jsx(Ne,{primary:e.jsx(R,{color:"text.primary",children:k.event.type})})]},k.id))]},x))}),h&&e.jsx(m,{display:"flex",justifyContent:"center",alignItems:"center",width:1,children:e.jsx(H,{variant:"text",type:"button",color:"inherit",onClick:d,disabled:j,sx:{color:x=>x.palette.text.disabled},children:s(j?"webhookEndpoint.loadingMore":"webhookEndpoint.loadMore")})})]})}),e.jsxs(V,{item:!0,xs:12,md:8,height:1,children:[w&&e.jsxs(D,{height:1,overflow:"auto",direction:"column",spacing:2,sx:{pl:{xs:0,md:1},mt:{xs:2,md:0},borderLeft:{xs:"none"}},children:[e.jsxs(m,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(R,{variant:"h6",children:o?w.endpoint.url:w.event.type}),e.jsx(m,{children:S(w)})]}),e.jsxs(m,{children:[e.jsxs(R,{variant:"h6",children:[s("webhookEndpoint.response")," (",w.responseStatus,")"]}),e.jsx(U,{language:"json",children:JSON.stringify(w.responseBody,null,2)})]}),e.jsxs(m,{children:[e.jsx(D,{direction:"row",alignItems:"center",spacing:1,children:e.jsx(R,{variant:"h6",children:s("webhookEndpoint.request")})}),e.jsx(U,{language:"json",sx:{margin:0},children:JSON.stringify(w.event,null,2)})]})]}),(a==null?void 0:a.list.length)===0&&u&&e.jsxs(m,{children:[e.jsx(D,{direction:"row",alignItems:"center",spacing:1,children:e.jsx(R,{variant:"h6",children:s("webhookEndpoint.eventData")})}),e.jsx(U,{language:"json",sx:{margin:0},children:JSON.stringify(u.data,null,2)})]})]})]})}ne.propTypes={eventId:t.string,webhookEndpointId:t.string,event:t.shape({type:t.string,data:t.object,request:t.object,requestInfo:t.object})};ne.defaultProps={eventId:"",webhookEndpointId:"",event:null};function me({id:o,onClose:p}){var j,y,f,w;const{t:u}=B(),{api:E}=F(),{teamDid:s}=_(),{loading:I,error:c,data:a}=de(()=>E.getWebhookEndpoint({input:{teamDid:s,id:o}})),d=a==null?void 0:a.data;return c?e.jsx(Z,{severity:"error",children:c.message}):I||!d?e.jsx(m,{display:"flex",justifyContent:"center",alignItems:"center",height:1,width:1,children:e.jsx(M,{})}):e.jsxs(rt,{direction:"column",sx:{height:{xs:"auto",md:1}},children:[e.jsxs(m,{children:[e.jsxs(D,{direction:"row",justifyContent:"space-between",alignItems:"center",children:[e.jsx(D,{flex:1,width:0,children:e.jsxs(m,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(R,{variant:"h5",fontWeight:600,sx:{overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis"},children:d.description}),e.jsx($,{title:d.url,children:e.jsx(X,{sx:{fontSize:"16px",marginTop:"2px"}})})]})}),e.jsx(D,{direction:"row",alignItems:"center",children:e.jsx(ee,{edge:"end",color:"inherit",onClick:p,children:e.jsx(_e,{})})})]}),e.jsx(m,{mt:2,children:e.jsxs(D,{className:"section-body",direction:{xs:"column",md:"row"},spacing:{xs:1,md:3},justifyContent:"flex-start",flexWrap:"wrap",sx:{pt:2,mt:2,borderTop:"1px solid #eee"},children:[e.jsx(A,{label:u("common.status"),value:e.jsx(L,{size:"small",variant:"filled",label:d.status,color:xe(d.status),sx:{borderRadius:"4px",lineHeight:"20px",textTransform:"capitalize"}}),divider:!0}),e.jsx(A,{label:u("webhookEndpoint.listen"),value:e.jsx($,{arrow:!0,title:e.jsx("ul",{style:{padding:0,margin:0},children:d.enabledEvents.map(b=>e.jsx("li",{style:{fontSize:"0.7875rem"},children:b==null?void 0:b.type},b))}),children:e.jsx(L,{size:"small",variant:"filled",label:u("webhookEndpoint.eventsCount",{count:d.enabledEvents.length}),sx:{borderRadius:"4px",lineHeight:"20px",textTransform:"capitalize"}})}),divider:!0}),e.jsx(A,{label:u("webhookEndpoint.version"),value:d.apiVersion,divider:!0}),e.jsx(A,{label:u("common.createdAt"),value:N(d.createdAt),divider:!0}),e.jsx(A,{label:u("common.updatedAt"),value:N(d.updatedAt),divider:!0}),e.jsx(A,{label:u("common.createdBy"),value:e.jsx($,{arrow:!0,title:(j=d.createUser)==null?void 0:j.did,children:e.jsx(L,{size:"small",variant:"filled",label:(y=d.createUser)==null?void 0:y.fullName,sx:{borderRadius:"4px",lineHeight:"20px",textTransform:"capitalize"}})}),divider:!0}),e.jsx(A,{label:u("common.updatedBy"),value:e.jsx($,{arrow:!0,title:(f=d.updateUser)==null?void 0:f.did,children:e.jsx(L,{size:"small",variant:"filled",label:(w=d.updateUser)==null?void 0:w.fullName,sx:{borderRadius:"4px",lineHeight:"20px",textTransform:"capitalize"}})})})]})})]}),e.jsxs(D,{className:"section",flex:1,height:0,overflow:"hidden",children:[e.jsx(se,{title:u("webhookEndpoint.attempts"),mb:0,mt:4}),e.jsx(D,{height:0,flex:1,overflow:"hidden",children:e.jsx(ne,{webhookEndpointId:d.id})})]})]})}me.propTypes={id:t.string.isRequired,onClose:t.func.isRequired};const rt=ue(D)``;function be({open:o,onClose:p,id:u}){return e.jsx(Fe,{anchor:"right",open:o,onClose:p,PaperProps:{sx:{width:"90vw",maxWidth:"1200px"}},children:e.jsx(m,{sx:{height:"100vh",p:3},children:e.jsx(me,{id:u,onClose:p})})})}be.propTypes={open:t.bool.isRequired,onClose:t.func.isRequired,id:t.string.isRequired};function ce(){return null}const ie=Q.memo(({options:o,columns:p,toolbar:u=!0,footer:E=!0,hasRowLink:s=!1,emptyNodeText:I="",...c})=>{const{locale:a}=B(),d=Ue(f=>f.breakpoints.down("md")),j={print:!1,download:!1,filter:!1,selectableRows:"none",rowsPerPage:d?5:10,rowsPerPageOptions:[5,10,20,50,100],searchDebounceTime:300,tableBodyHeight:"100%",loading:!0},y={};return u||(y.TableToolbar=ce),E||(y.TableFooter=ce),e.jsx(lt,{locale:a,options:{...j,...o},columns:(p||[]).map(f=>(f.options=f.options||{},f.options.filter=f.options.filter||!1,f.options.sort=f.options.sort||!1,f)),emptyNode:e.jsx(je,{children:I}),...c,components:y,hasRowLink:s,isMobile:d})});ie.propTypes={options:t.object,columns:t.array,toolbar:t.bool,footer:t.bool,hasRowLink:t.bool,emptyNodeText:t.node,durable:t.string,durableKeys:t.array,data:t.array,loading:t.bool,onChange:t.func,title:t.node,components:t.object};ie.defaultProps={options:{},columns:[],toolbar:!0,footer:!0,hasRowLink:!1,emptyNodeText:null,durable:"",durableKeys:[],data:[],loading:!1,onChange:()=>{},title:null,components:{}};const lt=ue(ye)``,at=ie;function Wt(){const{teamDid:o}=_(),p=Re(),u=`webhook-endpoints-${o}`,E=we(u),{t:s,locale:I}=B(),{api:c}=F(),[a,d]=T.useState(""),[j,y]=T.useState({webhookDetail:{open:!1,id:null},createEdit:{open:!1,id:null,url:"",description:"",enabledEvents:[]},deleteConfirm:null}),[f,w]=Ee(u,{defaultValue:{pageSize:E.rowsPerPage||20,page:E.page?E.page+1:1}}),{loading:b,error:l,data:g,refresh:h}=de(()=>c.getWebhookEndpoints({input:{teamDid:o,paging:{page:f.page,pageSize:f.pageSize}}}));T.useEffect(()=>{h()},[f,h]);const S=T.useCallback(async(i,r)=>{try{await c.updateWebhookEndpoint({input:{teamDid:o,id:i.id,data:{status:r?"disabled":"enabled"}}}),h(),q.success(`${s(r?"webhookEndpoint.disable":"webhookEndpoint.enable")}${s("webhookEndpoint.success")}`)}catch(n){q.error(n==null?void 0:n.message)}},[c,o,h,s]),x=T.useCallback(async i=>{try{await c.deleteWebhookEndpoint({input:{teamDid:o,id:i}}),h(),y(r=>({...r,deleteConfirm:null})),q.success(`${s("common.delete")}${s("webhookEndpoint.success")}`)}catch(r){q.error(r==null?void 0:r.message)}},[c,o,h,s]),z=(i,r)=>{let n=i.page+1;const C=i.searchText||"";if(C!==a){d(C);return}if(r==="changePage"||r==="changeRowsPerPage"){r!=="changePage"&&(n=1);const v={page:n,pageSize:i.rowsPerPage};d(""),w(v)}};if(l)return e.jsx(Z,{severity:"error",children:l.message});if(b||!g)return e.jsx(m,{display:"flex",justifyContent:"center",alignItems:"center",width:1,height:500,children:e.jsx(M,{})});const k=((g==null?void 0:g.list)||[]).filter(i=>{if(!a)return!0;const r=a.toLowerCase();return i.description.toLowerCase().includes(r)||i.url.toLowerCase().includes(r)}),O=[{label:"URL",name:"url",options:{customBodyRenderLite:(i,r)=>{const n=k[r];return e.jsxs(m,{sx:{display:"flex",alignItems:"center",cursor:"pointer",gap:.5},children:[e.jsx(R,{variant:"body2",children:n.description}),e.jsx(m,{sx:{display:"flex"},onClick:C=>{C.stopPropagation()},children:e.jsx($,{title:n.url,children:e.jsx(X,{sx:{fontSize:"15px",marginTop:"1px"}})})})]})}}},{label:"Events",name:"events",options:{customBodyRenderLite:(i,r)=>{const n=k[r];return e.jsx(m,{sx:{display:"flex",alignItems:"center",gap:1,flexWrap:"wrap"},children:n.enabledEvents.map(C=>e.jsx(L,{size:"small",variant:"filled",label:C.type,sx:{borderRadius:"4px",textTransform:"capitalize"}},`${n.source}-${C.type}`))})}}},{label:s("common.status"),name:"status",options:{customBodyRenderLite:(i,r)=>{const n=k[r];return e.jsx(L,{size:"small",variant:"filled",label:s(`webhookEndpoint.${n==null?void 0:n.status}`),color:xe(n==null?void 0:n.status),sx:{borderRadius:"4px",textTransform:"capitalize"}},`status-${n.status}`)}}},{label:s("common.createdAt"),name:"createdAt",minWidth:200,options:{customBodyRender:i=>N(i)}},{label:s("common.actions"),name:"actions",width:100,align:"center",verticalKeyAlign:"center",options:{customBodyRenderLite:(i,r)=>{const n=k[r],C=(n==null?void 0:n.status)==="enabled";return e.jsx(et,{actions:[{icon:C?e.jsx(Ke,{}):e.jsx(Ye,{}),text:s(C?"webhookEndpoint.disable":"webhookEndpoint.enable"),onClick:v=>{v.stopPropagation(),S(n,C)}},{icon:e.jsx(Ve,{}),text:s("common.edit"),onClick:v=>{v.stopPropagation(),y(P=>({...P,createEdit:{open:!0,id:n.id,url:n.url,description:n.description,enabledEvents:n.enabledEvents}}))}},{icon:e.jsx(Je,{}),text:s("common.delete"),onClick:v=>{v.stopPropagation(),y(P=>({...P,deleteConfirm:{title:s("webhookEndpoint.deleteWebhook.title"),description:s("webhookEndpoint.deleteWebhook.description"),confirm:s("common.confirm"),cancel:s("common.cancel"),onConfirm:()=>x(n.id),onCancel:()=>y(W=>({...W,deleteConfirm:null}))}}))}}]})}}}];return e.jsxs(m,{sx:{".custom-toobar-btns":{gap:"8px"},".custom-toobar-title .custom-toobar-title-inner>span":{display:"flex",alignItems:"center","white-space":"inherit",height:"100%"}},children:[p?e.jsx(ae,{title:s("webhookEndpoint.listTitle"),tooltipTitle:s("webhookEndpoint.tooltipTitle"),link:`https://www.arcblock.io/docs/blocklet-developer/${I}/webhook`}):null,e.jsx(at,{durable:u,durableKeys:["page","rowsPerPage"],data:k,columns:O,options:{count:g.count,page:f.page-1,rowsPerPage:f.pageSize,viewColumns:!1,onRowClick:(i,{dataIndex:r})=>{const n=g.list[r];y(C=>({...C,webhookDetail:{open:!0,id:n.id}}))}},loading:b,onChange:z,emptyNodeText:e.jsx(D,{gap:1,children:s("webhookEndpoint.noWebhooksAdded")}),title:p?null:e.jsx(ae,{title:s("webhookEndpoint.listTitle"),tooltipTitle:s("webhookEndpoint.tooltipTitle"),link:`https://www.arcblock.io/docs/blocklet-developer/${I}/webhook`}),customButtons:[e.jsxs(H,{sx:{color:"common.white"},edge:"end",variant:"contained",color:"primary",onClick:()=>y(i=>({...i,createEdit:{...i.createEdit,open:!0}})),className:"rule-action",children:[b?e.jsx(M,{size:16}):e.jsx(Ce,{style:{fontSize:16}}),s("common.create")]},"add")]}),j.webhookDetail.open&&e.jsx(be,{open:!0,onClose:()=>y(i=>({...i,webhookDetail:{open:!1,id:null}})),id:j.webhookDetail.id}),j.createEdit.open&&e.jsx(oe,{onSubmit:h,...j.createEdit,onClose:()=>y(i=>({...i,createEdit:{id:null,url:"",description:"",enabledEvents:[],open:!1}}))}),j.deleteConfirm&&e.jsx(Ze,{title:j.deleteConfirm.title,description:j.deleteConfirm.description,confirm:j.deleteConfirm.confirm,cancel:j.deleteConfirm.cancel,params:j.deleteConfirm.params,onConfirm:j.deleteConfirm.onConfirm,onCancel:j.deleteConfirm.onCancel})]})}export{Wt as default};
1
+ import{a as B,Z as q,bN as U,I as ge,bO as fe,a0 as je,a7 as ye,bu as we}from"./vendor-ux-did-connect-DROQhYpS.js";import{t as ke,l as de,j as Ee}from"./vendor-hooks-BgUTpb6X.js";import{r as T,b as Q}from"./vendor-react-DEoibe3W.js";import{d as X}from"./InfoOutlined-Duq1UDPu.js";import{j as ve,O as Ce}from"./vendor-arcblock-5qqHEVGo.js";import{D as F,aA as Se,aB as K,G as pe,y as Te}from"./index-DJzuhKQh.js";import{u as _}from"./dashboard-vkFEu-wZ.js";import{u as Re}from"./use-mobile-BAa0wi8o.js";import{H as t,j as e,D as Ie,aj as ze,t as De,aa as m,O as re,T as R,ab as M,ak as Z,z as Pe,y as H,bs as le,bR as Y,ad as $,L as J,A as G,bc as Oe,E as L,I as ee,C as Ae,bq as We,al as D,cg as qe,X as $e,bb as V,bp as Le,b4 as Be,ch as Me,ci as He,b5 as Ne,an as Fe,c0 as _e,s as ue,v as Ue,cj as Ke,ck as Ye,cl as Ve,cm as Je}from"./vendor-mui-core-BV2FUxWJ.js";import{d as Ge}from"./ExpandLess-EFI-Ij5Y.js";import{b as he,z as Qe,A as Xe}from"./vendor-utils-rHXShPKm.js";import{C as Ze}from"./confirm-CiiHIA-a.js";import{A as et}from"./actions-BA8hCarh.js";import{T as ae}from"./table-tips-biAHyN1z.js";import"./lottie-web-jYmAQWuC.js";import"./useLocalStorage-BDA4jbwL.js";import"./index-8eXqqyHQ.js";import"./PlayArrow-Cv1uXXJt.js";import"./get-safe-url-CiQ8_q49.js";import"./session-ugMCR4Iu.js";import"./use-blocklet-logo-a8QJI4r-.js";import"./dot-DX56IFTM.js";import"./useAsync-Dv214fz8.js";import"./useSetState-CWq0AVWn.js";import"./use-mobile-C21X4TYN.js";import"./MoreHoriz-jwSUI8G2.js";const tt=o=>{var f,w;const[p,u]=T.useState(null),[E,s]=T.useState(!o),[I,c]=T.useState(null),{blocklet:a}=pe(),d=(w=(f=a==null?void 0:a.site)==null?void 0:f.domainAliases[0])==null?void 0:w.value,j=T.useMemo(()=>{const b={};return p&&(p.sources.forEach(l=>{b[l.did]={source:l,events:[],count:0}}),p.events.forEach(l=>{b[l.source]&&(b[l.source].events.push(l),b[l.source].count+=1)})),b},[p]),y=async()=>{try{if(s(!0),!d)return;const l=await(await fetch(`https://${d}/.well-known/service/openevent.json`)).json();u(l),c(null)}catch(b){c(b instanceof Error?b:new Error(String(b)))}finally{s(!1)}};return T.useEffect(()=>{y()},[d]),{openEvent:p,setOpenEvent:u,eventsBySource:j,loading:E,error:I,loadData:y}};function te({eventsBySource:o,selectedEvents:p,setSelectedEvents:u,error:E}){const{t:s}=B(),[I,c]=T.useState({}),a=T.useMemo(()=>{const l={};return Object.entries(o).forEach(([g,{events:h}])=>{const S=h.filter(x=>p[`${x.type}-${x.source}`]).length;l[g]=S}),l},[o,p]),d=T.useMemo(()=>Object.values(a).reduce((l,g)=>l+g,0),[a]),j=T.useMemo(()=>Object.values(o).reduce((l,{events:g})=>l+g.length,0),[o]),y=(l,g)=>{g.stopPropagation(),c({...I,[l]:!I[l]})},f=l=>{const g=`${l.type}-${l.source}`;u(h=>({...h,[g]:!h[g]}))},w=(l,g)=>{const h={};l.forEach(S=>{const x=`${S.type}-${S.source}`;h[x]=!g}),u(S=>({...S,...h}))},b=l=>{const g={};Object.values(o).forEach(({events:h})=>{h.forEach(S=>{const x=`${S.type}-${S.source}`;g[x]=l.target.checked})}),u(g)};return e.jsxs(m,{sx:{width:"100%"},children:[e.jsxs(m,{sx:{display:"flex",alignItems:"center",mb:1,mt:1},children:[e.jsx(le,{control:e.jsx(Y,{onChange:b,checked:d>0&&d===j}),label:e.jsxs(m,{sx:{display:"flex",alignItems:"center",cursor:"pointer"},children:[s("webhookEndpoint.selectAllEvents"),e.jsx(m,{sx:{display:"flex",alignItems:"center"},children:e.jsx($,{title:s("webhookEndpoint.selectAllEventsTooltip"),placement:"right",children:e.jsx(X,{fontSize:"small",sx:{ml:.5,cursor:"help"}})})})]}),sx:{m:0}}),d>0&&e.jsx(R,{variant:"body2",color:"primary",sx:{ml:"auto"},children:s("webhookEndpoint.selectedEventsCount",{count:d})})]}),e.jsx(m,{sx:{maxHeight:"50vh",overflow:"auto"},children:e.jsx(J,{disablePadding:!0,sx:{border:"1px solid",borderColor:"divider",borderRadius:"4px"},children:Object.entries(o).map(([l,{source:g,events:h,count:S}],x)=>{const z=a[l]>0,k=a[l]===h.length&&h.length>0,O=I[l];return e.jsxs(Q.Fragment,{children:[e.jsx(G,{sx:{borderBottom:({palette:i})=>x<Object.keys(o).length-1?`1px solid ${i.divider}`:"none",px:2,py:1.5,"&:hover":{bgcolor:"rgba(0, 0, 0, 0.02)"}},children:e.jsxs(m,{sx:{display:"flex",width:"100%",justifyContent:"space-between",alignItems:"center"},onClick:i=>{i.target.closest(".MuiFormControlLabel-root")||y(l,i)},children:[e.jsx(m,{sx:{display:"flex",alignItems:"center"},children:h.length>0&&e.jsx(le,{control:e.jsx(Y,{checked:k,indeterminate:z&&!k,onChange:i=>{i.stopPropagation(),w(h,k)}}),label:e.jsxs(m,{sx:{display:"flex",alignItems:"center",gap:1},children:[g.logo&&e.jsx(Oe,{src:g.logo,sx:{width:24,height:24}}),e.jsx(m,{children:g.title||l}),z&&e.jsx(L,{label:s("webhookEndpoint.selectedCount",{count:a[l]}),size:"small",sx:{mt:"2px",height:"20px",fontSize:"12px",bgcolor:i=>`${i.palette.primary.main}20`,color:"primary.main",fontWeight:500}})]}),sx:{m:0,"& .MuiFormControlLabel-label":{flex:1}}})}),e.jsxs(m,{sx:{display:"flex",alignItems:"center"},children:[e.jsx(R,{variant:"body2",color:"text.secondary",sx:{mr:1},children:s("webhookEndpoint.eventsCount",{count:S})}),h.length>0&&e.jsx(ee,{size:"small",edge:"end",children:O?e.jsx(Ge,{}):e.jsx(ve,{})})]})]})}),h.length>0&&e.jsx(Ae,{in:O,timeout:"auto",unmountOnExit:!0,children:e.jsx(J,{disablePadding:!0,sx:{pl:2,pr:2,py:1,bgcolor:"rgba(0, 0, 0, 0.01)"},children:h.map(i=>{const r=`${i.type}-${i.source}`,n=!!p[r];return e.jsx(G,{dense:!0,sx:{py:.75},onClick:()=>f(i),children:e.jsxs(m,{sx:{display:"flex",alignItems:"flex-start",width:"100%"},children:[e.jsx(Y,{checked:n,sx:{mr:1}}),e.jsxs(m,{children:[e.jsx(R,{variant:"body1",sx:{cursor:"pointer"},children:i.type}),e.jsx(R,{variant:"caption",color:"text.disabled",sx:{display:"block",cursor:"pointer"},children:i.description})]})]})},r)})})})]},l)})})}),E&&e.jsx(We,{error:!0,sx:{mt:1},children:E})]})}te.propTypes={eventsBySource:t.objectOf(t.shape({source:t.shape({did:t.string.isRequired,title:t.string,description:t.string,version:t.string,logo:t.string}).isRequired,events:t.arrayOf(t.shape({type:t.string.isRequired,description:t.string.isRequired,source:t.string.isRequired})).isRequired,count:t.number.isRequired})).isRequired,selectedEvents:t.objectOf(t.bool).isRequired,setSelectedEvents:t.func.isRequired,error:t.string};te.defaultProps={error:null};function oe({id:o,url:p,description:u,enabledEvents:E,onSubmit:s,onClose:I}){var i;const{t:c}=B(),[a,d]=T.useState({}),{teamDid:j}=_(),{api:y}=F(),{loading:f,error:w,eventsBySource:b}=tt(),{control:l,handleSubmit:g,formState:{errors:h},reset:S,setValue:x,trigger:z}=Se({defaultValues:{url:"",description:""}});T.useEffect(()=>{const r=Object.values(a).some(n=>n);x("selectedEvents",r?"valid":""),z("selectedEvents")},[a,x,z]);const k=()=>{d({}),S(),I()},O=async r=>{const n=Object.keys(a).filter(v=>a[v]),C={url:r.url,description:r.description,enabledEvents:n.map(v=>{const[P,W]=v.split("-");return!P||!W?null:{type:P,source:W}}).filter(Boolean)};try{if(o){const v=await y.updateWebhookEndpoint({input:{teamDid:j,id:o,data:C}});q.success(`${c("webhookEndpoint.updateWebhook")} ${c("webhookEndpoint.success")}`),s(v)}else{const v=await y.createWebhookEndpoint({input:{teamDid:j,input:C}});q.success(`${c("webhookEndpoint.createWebhook")} ${c("webhookEndpoint.success")}`),s(v)}}catch(v){q.error(v==null?void 0:v.message)}k()};return T.useEffect(()=>{S({url:p,description:u}),d(E.reduce((r,n)=>(r[`${n.type}-${n.source}`]=!0,r),{}))},[S,d,p,u,E]),e.jsx(Ie,{open:!0,onClose:k,maxWidth:"lg",fullWidth:!0,sx:{"& .MuiDialog-paper":{minHeight:600}},children:e.jsxs("form",{onSubmit:g(O),children:[e.jsx(ze,{children:c(o?"webhookEndpoint.editWebhookTitle":"webhookEndpoint.createWebhookTitle")}),e.jsx(De,{children:e.jsxs(m,{sx:{display:"flex",flexDirection:"column",gap:2,mt:2},children:[e.jsx(K,{name:"url",control:l,rules:{required:c("webhookEndpoint.validation.urlRequired"),pattern:{value:/^(http|https):\/\/[^ "]+$/,message:c("webhookEndpoint.validation.urlInvalid")}},render:({field:r})=>{var n;return e.jsx(re,{...r,label:c("webhookEndpoint.url.label"),fullWidth:!0,error:!!h.url,helperText:(n=h.url)==null?void 0:n.message})}}),e.jsx(K,{name:"description",control:l,rules:{required:c("webhookEndpoint.validation.descriptionRequired")},render:({field:r})=>{var n;return e.jsx(re,{...r,label:c("webhookEndpoint.description.label"),fullWidth:!0,multiline:!0,minRows:2,maxRows:4,error:!!h.description,helperText:(n=h.description)==null?void 0:n.message})}}),e.jsx(K,{name:"selectedEvents",control:l,rules:{required:c("webhookEndpoint.validation.eventRequired")},render:({field:r})=>e.jsx("input",{type:"hidden",...r})}),!f&&b&&Object.keys(b).length>0&&e.jsx(te,{eventsBySource:b,selectedEvents:a,setSelectedEvents:d,error:(i=h.selectedEvents)==null?void 0:i.message}),!f&&(!b||Object.keys(b).length===0)&&e.jsx(R,{color:"text.secondary",children:c("webhookEndpoint.noAvailableEvents")}),f&&e.jsx(m,{sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"500px",width:"100%"},children:e.jsx(M,{size:20})}),w&&e.jsx(Z,{severity:"error",children:c("webhookEndpoint.loadingError",{message:w==null?void 0:w.message})})]})}),e.jsxs(Pe,{sx:{p:"8px 24px 24px"},children:[e.jsx(H,{onClick:k,children:c("common.cancel")}),e.jsx(H,{type:"submit",variant:"contained",color:"primary",children:c(o?"webhookEndpoint.updateWebhook":"webhookEndpoint.saveWebhook")})]})]})})}oe.propTypes={onSubmit:t.func.isRequired,id:t.string,url:t.string,description:t.string,enabledEvents:t.arrayOf(t.shape({type:t.string.isRequired,source:t.string.isRequired})),onClose:t.func};oe.defaultProps={id:null,url:"",description:"",enabledEvents:[],onClose:()=>{}};function xe(o){switch(o){case"enabled":return"success";case"disabled":default:return"default"}}const ot=(o="en")=>o==="tw"?"zh":o;function N(o,p="YYYY-MM-DD HH:mm:ss",u="en"){return o?Te(o).locale(ot(u)).format(p):"-"}function st(o){return typeof o=="number"?!1:he(o)}function nt(o){return o>=200&&o<300}function A(o){const p=st(o.value);return e.jsxs(e.Fragment,{children:[e.jsxs(D,{direction:"column",alignItems:"flex-start",children:[e.jsxs(R,{component:"div",variant:"body1",mb:1,color:"text.primary",sx:{fontWeight:500},children:[o.label,!!o.tip&&e.jsx($,{title:o.tip,children:e.jsx(qe,{fontSize:"small"})})]}),e.jsx(R,{component:"div",variant:"body1",color:p?"text.disabled":"text.secondary",sx:{width:"100%",minHeight:"24px"},children:p?"-":o.value})]}),o.divider&&e.jsx($e,{orientation:"vertical",flexItem:!0})]})}A.propTypes={label:t.oneOfType([t.string,t.node]).isRequired,value:t.oneOfType([t.string,t.node]).isRequired,tip:t.oneOfType([t.string,t.node]),divider:t.bool};A.defaultProps={tip:"",divider:!1};function se(o){return e.jsxs(D,{className:"section-header",direction:"row",justifyContent:"space-between",alignItems:"center",flexWrap:"wrap",gap:1,sx:{mb:o.mb,mt:o.mt,pb:1},children:[e.jsx(R,{variant:"h3",sx:{fontSize:{xs:"18px",md:"1.09375rem"}},component:"div",children:o.title}),o.children]})}se.propTypes={title:t.oneOfType([t.string,t.node]).isRequired,children:t.node,mb:t.number,mt:t.number};se.defaultProps={children:null,mb:1.5,mt:1.5};const it=o=>{const p={};return o.forEach(u=>{var s;const E=new Date(u.createdAt).toLocaleDateString();p[E]||(p[E]=[]),(s=p[E])==null||s.push(u)}),p};function ne({eventId:o,webhookEndpointId:p,event:u}){const{api:E}=F(),{t:s}=B(),{teamDid:I}=_(),{blocklet:c}=pe(),{data:a,loadMore:d,loadingMore:j,loading:y}=ke(x=>{const k=x?Math.ceil(x.list.length/15)+1:1;return E.getWebhookAttempts({input:{teamDid:I,input:{eventId:o,webhookId:p},paging:{page:k,pageSize:15}}})},{reloadDeps:[o,p]}),f=(a==null?void 0:a.list)||[],[w,b]=T.useState(null),l=it(f);T.useEffect(()=>{!w&&(a!=null&&a.list.length)&&b(a.list[0])},[a==null?void 0:a.list.length,w]);const g=x=>{b(x)};if(y)return e.jsx(M,{});const h=a&&a.list.length<a.paging.total,S=x=>{var z,k,O,i,r;if(x.responseBody&&((z=x.responseBody)!=null&&z.sessionId)&&((k=x.responseBody)!=null&&k.projectId)&&((O=x.responseBody)!=null&&O.agentId)){const n=(r=(i=c==null?void 0:c.site)==null?void 0:i.domainAliases[0])==null?void 0:r.value,C=(c.children||[]).find(P=>{var W;return((W=P==null?void 0:P.meta)==null?void 0:W.name)==="ai-studio"}),v=Qe(Xe(`https://${n}`,(C==null?void 0:C.mountPoint)||"","projects",x.responseBody.projectId,"logs/main"),{sessionId:x.responseBody.sessionId,agentId:x.responseBody.agentId});return e.jsx(ee,{sx:{fontSize:20},onClick:()=>window.open(v,"_blank"),children:e.jsx(m,{component:ge,icon:fe})})}return null};return e.jsxs(V,{container:!0,spacing:{xs:0,md:1},sx:{height:1},children:[e.jsx(V,{item:!0,xs:12,md:4,height:1,children:he(Object.keys(l))?e.jsx(R,{color:"text.secondary",children:s("webhookEndpoint.waitingForEvents")}):e.jsxs(e.Fragment,{children:[e.jsx(J,{sx:{maxHeight:"calc(100% - 40px)",py:0,overflowY:"auto"},children:Object.entries(l).map(([x,z])=>e.jsxs(Q.Fragment,{children:[e.jsx(Le,{children:x}),z.map(k=>e.jsxs(G,{sx:{cursor:"pointer"},onClick:()=>g(k),selected:w===k,secondaryAction:e.jsx(R,{color:"text.secondary",children:N(k.createdAt,"HH:mm:ss")}),children:[e.jsx(Be,{sx:{minWidth:0,mr:1.5},children:nt(k.responseStatus)===!1?e.jsx(Me,{color:"error"}):e.jsx(He,{color:"success"})}),e.jsx(Ne,{primary:e.jsx(R,{color:"text.primary",children:k.event.type})})]},k.id))]},x))}),h&&e.jsx(m,{display:"flex",justifyContent:"center",alignItems:"center",width:1,children:e.jsx(H,{variant:"text",type:"button",color:"inherit",onClick:d,disabled:j,sx:{color:x=>x.palette.text.disabled},children:s(j?"webhookEndpoint.loadingMore":"webhookEndpoint.loadMore")})})]})}),e.jsxs(V,{item:!0,xs:12,md:8,height:1,children:[w&&e.jsxs(D,{height:1,overflow:"auto",direction:"column",spacing:2,sx:{pl:{xs:0,md:1},mt:{xs:2,md:0},borderLeft:{xs:"none"}},children:[e.jsxs(m,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(R,{variant:"h6",children:o?w.endpoint.url:w.event.type}),e.jsx(m,{children:S(w)})]}),e.jsxs(m,{children:[e.jsxs(R,{variant:"h6",children:[s("webhookEndpoint.response")," (",w.responseStatus,")"]}),e.jsx(U,{language:"json",children:JSON.stringify(w.responseBody,null,2)})]}),e.jsxs(m,{children:[e.jsx(D,{direction:"row",alignItems:"center",spacing:1,children:e.jsx(R,{variant:"h6",children:s("webhookEndpoint.request")})}),e.jsx(U,{language:"json",sx:{margin:0},children:JSON.stringify(w.event,null,2)})]})]}),(a==null?void 0:a.list.length)===0&&u&&e.jsxs(m,{children:[e.jsx(D,{direction:"row",alignItems:"center",spacing:1,children:e.jsx(R,{variant:"h6",children:s("webhookEndpoint.eventData")})}),e.jsx(U,{language:"json",sx:{margin:0},children:JSON.stringify(u.data,null,2)})]})]})]})}ne.propTypes={eventId:t.string,webhookEndpointId:t.string,event:t.shape({type:t.string,data:t.object,request:t.object,requestInfo:t.object})};ne.defaultProps={eventId:"",webhookEndpointId:"",event:null};function me({id:o,onClose:p}){var j,y,f,w;const{t:u}=B(),{api:E}=F(),{teamDid:s}=_(),{loading:I,error:c,data:a}=de(()=>E.getWebhookEndpoint({input:{teamDid:s,id:o}})),d=a==null?void 0:a.data;return c?e.jsx(Z,{severity:"error",children:c.message}):I||!d?e.jsx(m,{display:"flex",justifyContent:"center",alignItems:"center",height:1,width:1,children:e.jsx(M,{})}):e.jsxs(rt,{direction:"column",sx:{height:{xs:"auto",md:1}},children:[e.jsxs(m,{children:[e.jsxs(D,{direction:"row",justifyContent:"space-between",alignItems:"center",children:[e.jsx(D,{flex:1,width:0,children:e.jsxs(m,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(R,{variant:"h5",fontWeight:600,sx:{overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis"},children:d.description}),e.jsx($,{title:d.url,children:e.jsx(X,{sx:{fontSize:"16px",marginTop:"2px"}})})]})}),e.jsx(D,{direction:"row",alignItems:"center",children:e.jsx(ee,{edge:"end",color:"inherit",onClick:p,children:e.jsx(_e,{})})})]}),e.jsx(m,{mt:2,children:e.jsxs(D,{className:"section-body",direction:{xs:"column",md:"row"},spacing:{xs:1,md:3},justifyContent:"flex-start",flexWrap:"wrap",sx:{pt:2,mt:2,borderTop:"1px solid #eee"},children:[e.jsx(A,{label:u("common.status"),value:e.jsx(L,{size:"small",variant:"filled",label:d.status,color:xe(d.status),sx:{borderRadius:"4px",lineHeight:"20px",textTransform:"capitalize"}}),divider:!0}),e.jsx(A,{label:u("webhookEndpoint.listen"),value:e.jsx($,{arrow:!0,title:e.jsx("ul",{style:{padding:0,margin:0},children:d.enabledEvents.map(b=>e.jsx("li",{style:{fontSize:"0.7875rem"},children:b==null?void 0:b.type},b))}),children:e.jsx(L,{size:"small",variant:"filled",label:u("webhookEndpoint.eventsCount",{count:d.enabledEvents.length}),sx:{borderRadius:"4px",lineHeight:"20px",textTransform:"capitalize"}})}),divider:!0}),e.jsx(A,{label:u("webhookEndpoint.version"),value:d.apiVersion,divider:!0}),e.jsx(A,{label:u("common.createdAt"),value:N(d.createdAt),divider:!0}),e.jsx(A,{label:u("common.updatedAt"),value:N(d.updatedAt),divider:!0}),e.jsx(A,{label:u("common.createdBy"),value:e.jsx($,{arrow:!0,title:(j=d.createUser)==null?void 0:j.did,children:e.jsx(L,{size:"small",variant:"filled",label:(y=d.createUser)==null?void 0:y.fullName,sx:{borderRadius:"4px",lineHeight:"20px",textTransform:"capitalize"}})}),divider:!0}),e.jsx(A,{label:u("common.updatedBy"),value:e.jsx($,{arrow:!0,title:(f=d.updateUser)==null?void 0:f.did,children:e.jsx(L,{size:"small",variant:"filled",label:(w=d.updateUser)==null?void 0:w.fullName,sx:{borderRadius:"4px",lineHeight:"20px",textTransform:"capitalize"}})})})]})})]}),e.jsxs(D,{className:"section",flex:1,height:0,overflow:"hidden",children:[e.jsx(se,{title:u("webhookEndpoint.attempts"),mb:0,mt:4}),e.jsx(D,{height:0,flex:1,overflow:"hidden",children:e.jsx(ne,{webhookEndpointId:d.id})})]})]})}me.propTypes={id:t.string.isRequired,onClose:t.func.isRequired};const rt=ue(D)``;function be({open:o,onClose:p,id:u}){return e.jsx(Fe,{anchor:"right",open:o,onClose:p,PaperProps:{sx:{width:"90vw",maxWidth:"1200px"}},children:e.jsx(m,{sx:{height:"100vh",p:3},children:e.jsx(me,{id:u,onClose:p})})})}be.propTypes={open:t.bool.isRequired,onClose:t.func.isRequired,id:t.string.isRequired};function ce(){return null}const ie=Q.memo(({options:o,columns:p,toolbar:u=!0,footer:E=!0,hasRowLink:s=!1,emptyNodeText:I="",...c})=>{const{locale:a}=B(),d=Ue(f=>f.breakpoints.down("md")),j={print:!1,download:!1,filter:!1,selectableRows:"none",rowsPerPage:d?5:10,rowsPerPageOptions:[5,10,20,50,100],searchDebounceTime:300,tableBodyHeight:"100%",loading:!0},y={};return u||(y.TableToolbar=ce),E||(y.TableFooter=ce),e.jsx(lt,{locale:a,options:{...j,...o},columns:(p||[]).map(f=>(f.options=f.options||{},f.options.filter=f.options.filter||!1,f.options.sort=f.options.sort||!1,f)),emptyNode:e.jsx(je,{children:I}),...c,components:y,hasRowLink:s,isMobile:d})});ie.propTypes={options:t.object,columns:t.array,toolbar:t.bool,footer:t.bool,hasRowLink:t.bool,emptyNodeText:t.node,durable:t.string,durableKeys:t.array,data:t.array,loading:t.bool,onChange:t.func,title:t.node,components:t.object};ie.defaultProps={options:{},columns:[],toolbar:!0,footer:!0,hasRowLink:!1,emptyNodeText:null,durable:"",durableKeys:[],data:[],loading:!1,onChange:()=>{},title:null,components:{}};const lt=ue(ye)``,at=ie;function Wt(){const{teamDid:o}=_(),p=Re(),u=`webhook-endpoints-${o}`,E=we(u),{t:s,locale:I}=B(),{api:c}=F(),[a,d]=T.useState(""),[j,y]=T.useState({webhookDetail:{open:!1,id:null},createEdit:{open:!1,id:null,url:"",description:"",enabledEvents:[]},deleteConfirm:null}),[f,w]=Ee(u,{defaultValue:{pageSize:E.rowsPerPage||20,page:E.page?E.page+1:1}}),{loading:b,error:l,data:g,refresh:h}=de(()=>c.getWebhookEndpoints({input:{teamDid:o,paging:{page:f.page,pageSize:f.pageSize}}}));T.useEffect(()=>{h()},[f,h]);const S=T.useCallback(async(i,r)=>{try{await c.updateWebhookEndpoint({input:{teamDid:o,id:i.id,data:{status:r?"disabled":"enabled"}}}),h(),q.success(`${s(r?"webhookEndpoint.disable":"webhookEndpoint.enable")}${s("webhookEndpoint.success")}`)}catch(n){q.error(n==null?void 0:n.message)}},[c,o,h,s]),x=T.useCallback(async i=>{try{await c.deleteWebhookEndpoint({input:{teamDid:o,id:i}}),h(),y(r=>({...r,deleteConfirm:null})),q.success(`${s("common.delete")}${s("webhookEndpoint.success")}`)}catch(r){q.error(r==null?void 0:r.message)}},[c,o,h,s]),z=(i,r)=>{let n=i.page+1;const C=i.searchText||"";if(C!==a){d(C);return}if(r==="changePage"||r==="changeRowsPerPage"){r!=="changePage"&&(n=1);const v={page:n,pageSize:i.rowsPerPage};d(""),w(v)}};if(l)return e.jsx(Z,{severity:"error",children:l.message});if(b||!g)return e.jsx(m,{display:"flex",justifyContent:"center",alignItems:"center",width:1,height:500,children:e.jsx(M,{})});const k=((g==null?void 0:g.list)||[]).filter(i=>{if(!a)return!0;const r=a.toLowerCase();return i.description.toLowerCase().includes(r)||i.url.toLowerCase().includes(r)}),O=[{label:"URL",name:"url",options:{customBodyRenderLite:(i,r)=>{const n=k[r];return e.jsxs(m,{sx:{display:"flex",alignItems:"center",cursor:"pointer",gap:.5},children:[e.jsx(R,{variant:"body2",children:n.description}),e.jsx(m,{sx:{display:"flex"},onClick:C=>{C.stopPropagation()},children:e.jsx($,{title:n.url,children:e.jsx(X,{sx:{fontSize:"15px",marginTop:"1px"}})})})]})}}},{label:"Events",name:"events",options:{customBodyRenderLite:(i,r)=>{const n=k[r];return e.jsx(m,{sx:{display:"flex",alignItems:"center",gap:1,flexWrap:"wrap"},children:n.enabledEvents.map(C=>e.jsx(L,{size:"small",variant:"filled",label:C.type,sx:{borderRadius:"4px",textTransform:"capitalize"}},`${n.source}-${C.type}`))})}}},{label:s("common.status"),name:"status",options:{customBodyRenderLite:(i,r)=>{const n=k[r];return e.jsx(L,{size:"small",variant:"filled",label:s(`webhookEndpoint.${n==null?void 0:n.status}`),color:xe(n==null?void 0:n.status),sx:{borderRadius:"4px",textTransform:"capitalize"}},`status-${n.status}`)}}},{label:s("common.createdAt"),name:"createdAt",minWidth:200,options:{customBodyRender:i=>N(i)}},{label:s("common.actions"),name:"actions",width:100,align:"center",verticalKeyAlign:"center",options:{customBodyRenderLite:(i,r)=>{const n=k[r],C=(n==null?void 0:n.status)==="enabled";return e.jsx(et,{actions:[{icon:C?e.jsx(Ke,{}):e.jsx(Ye,{}),text:s(C?"webhookEndpoint.disable":"webhookEndpoint.enable"),onClick:v=>{v.stopPropagation(),S(n,C)}},{icon:e.jsx(Ve,{}),text:s("common.edit"),onClick:v=>{v.stopPropagation(),y(P=>({...P,createEdit:{open:!0,id:n.id,url:n.url,description:n.description,enabledEvents:n.enabledEvents}}))}},{icon:e.jsx(Je,{}),text:s("common.delete"),onClick:v=>{v.stopPropagation(),y(P=>({...P,deleteConfirm:{title:s("webhookEndpoint.deleteWebhook.title"),description:s("webhookEndpoint.deleteWebhook.description"),confirm:s("common.confirm"),cancel:s("common.cancel"),onConfirm:()=>x(n.id),onCancel:()=>y(W=>({...W,deleteConfirm:null}))}}))}}]})}}}];return e.jsxs(m,{sx:{".custom-toobar-btns":{gap:"8px"},".custom-toobar-title .custom-toobar-title-inner>span":{display:"flex",alignItems:"center","white-space":"inherit",height:"100%"}},children:[p?e.jsx(ae,{title:s("webhookEndpoint.listTitle"),tooltipTitle:s("webhookEndpoint.tooltipTitle"),link:`https://www.arcblock.io/docs/blocklet-developer/${I}/webhook`}):null,e.jsx(at,{durable:u,durableKeys:["page","rowsPerPage"],data:k,columns:O,options:{count:g.count,page:f.page-1,rowsPerPage:f.pageSize,viewColumns:!1,onRowClick:(i,{dataIndex:r})=>{const n=g.list[r];y(C=>({...C,webhookDetail:{open:!0,id:n.id}}))}},loading:b,onChange:z,emptyNodeText:e.jsx(D,{gap:1,children:s("webhookEndpoint.noWebhooksAdded")}),title:p?null:e.jsx(ae,{title:s("webhookEndpoint.listTitle"),tooltipTitle:s("webhookEndpoint.tooltipTitle"),link:`https://www.arcblock.io/docs/blocklet-developer/${I}/webhook`}),customButtons:[e.jsxs(H,{sx:{color:"common.white"},edge:"end",variant:"contained",color:"primary",onClick:()=>y(i=>({...i,createEdit:{...i.createEdit,open:!0}})),className:"rule-action",children:[b?e.jsx(M,{size:16}):e.jsx(Ce,{style:{fontSize:16}}),s("common.create")]},"add")]}),j.webhookDetail.open&&e.jsx(be,{open:!0,onClose:()=>y(i=>({...i,webhookDetail:{open:!1,id:null}})),id:j.webhookDetail.id}),j.createEdit.open&&e.jsx(oe,{onSubmit:h,...j.createEdit,onClose:()=>y(i=>({...i,createEdit:{id:null,url:"",description:"",enabledEvents:[],open:!1}}))}),j.deleteConfirm&&e.jsx(Ze,{title:j.deleteConfirm.title,description:j.deleteConfirm.description,confirm:j.deleteConfirm.confirm,cancel:j.deleteConfirm.cancel,params:j.deleteConfirm.params,onConfirm:j.deleteConfirm.onConfirm,onCancel:j.deleteConfirm.onCancel})]})}export{Wt as default};
@@ -1 +1 @@
1
- import{j as t,aa as s,H as i,T as a}from"./vendor-mui-core-BV2FUxWJ.js";import{a as f}from"./vendor-ux-did-connect-DprdyYny.js";import{L as g,r as k}from"./vendor-react-DEoibe3W.js";import"./index-Ck-L27nB.js";import"./vendor-utils-rHXShPKm.js";import"./vendor-hooks-BgUTpb6X.js";import"./lottie-web-jYmAQWuC.js";import"./vendor-arcblock-CUb0jDdY.js";const p=(e,o)=>[e,...Array.isArray(o)?o:[o]],l=(e=2)=>({overflow:"hidden",textOverflow:"ellipsis",wordBreak:"break-word",display:"-webkit-box",WebkitLineClamp:e,WebkitBoxOrient:"vertical"});function d({sx:e,...o}){const r=p({display:"flex",flexWrap:"wrap",mx:-1},e);return t.jsx(s,{sx:r,...o})}d.propTypes={sx:i.object};d.defaultProps={sx:{}};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 u({title:e,desc:o,extra:r,cover:c,icon:n,to:x,sx:h}){const m=p({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,n&&t.jsx(s,{sx:{position:"absolute",top:44,left:16,zIndex:1,width:56,height:56},children:t.jsx(w,{icon:n})})]}),t.jsx(a,{sx:{mt:1,fontSize:"1.25rem",fontWeight:600,...l()},children:e}),o&&t.jsx(a,{variant:"body2",sx:{my:1,...l(),color:"text.secondary"},children:o}),r]})})})}u.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="/.well-known/service/static/assets/doc-board-bg-DWZHV9Ng.png";function b({board:e,sx:o,...r}){return t.jsx(u,{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})}b.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(d,{children:o.map(r=>t.jsx(b,{board:r},r.id))})}export{I as default};
1
+ import{j as t,aa as s,H as i,T as a}from"./vendor-mui-core-BV2FUxWJ.js";import{a as f}from"./vendor-ux-did-connect-DROQhYpS.js";import{L as g,r as k}from"./vendor-react-DEoibe3W.js";import"./index-DJzuhKQh.js";import"./vendor-utils-rHXShPKm.js";import"./vendor-hooks-BgUTpb6X.js";import"./lottie-web-jYmAQWuC.js";import"./vendor-arcblock-5qqHEVGo.js";const p=(e,o)=>[e,...Array.isArray(o)?o:[o]],l=(e=2)=>({overflow:"hidden",textOverflow:"ellipsis",wordBreak:"break-word",display:"-webkit-box",WebkitLineClamp:e,WebkitBoxOrient:"vertical"});function d({sx:e,...o}){const r=p({display:"flex",flexWrap:"wrap",mx:-1},e);return t.jsx(s,{sx:r,...o})}d.propTypes={sx:i.object};d.defaultProps={sx:{}};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 u({title:e,desc:o,extra:r,cover:c,icon:n,to:x,sx:h}){const m=p({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,n&&t.jsx(s,{sx:{position:"absolute",top:44,left:16,zIndex:1,width:56,height:56},children:t.jsx(w,{icon:n})})]}),t.jsx(a,{sx:{mt:1,fontSize:"1.25rem",fontWeight:600,...l()},children:e}),o&&t.jsx(a,{variant:"body2",sx:{my:1,...l(),color:"text.secondary"},children:o}),r]})})})}u.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="/.well-known/service/static/assets/doc-board-bg-DWZHV9Ng.png";function b({board:e,sx:o,...r}){return t.jsx(u,{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})}b.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(d,{children:o.map(r=>t.jsx(b,{board:r},r.id))})}export{I as default};
@@ -1 +1 @@
1
- import{j as t,ah as r}from"./vendor-mui-core-BV2FUxWJ.js";import{r as s}from"./vendor-react-DEoibe3W.js";import{b2 as a}from"./vendor-ux-did-connect-DprdyYny.js";import{R as e}from"./vendor-arcblock-CUb0jDdY.js";import"./vendor-utils-rHXShPKm.js";import"./vendor-hooks-BgUTpb6X.js";import"./lottie-web-jYmAQWuC.js";function x(){const{t:o}=s.useContext(a);return t.jsx(n,{style:{paddingTop:"25vh"},children:t.jsx(e,{status:"404",description:o("noMatch.desc"),style:{backgroundColor:"transparent"}})})}const n=r.main``;export{x as default};
1
+ import{j as t,ah as r}from"./vendor-mui-core-BV2FUxWJ.js";import{r as s}from"./vendor-react-DEoibe3W.js";import{b2 as a}from"./vendor-ux-did-connect-DROQhYpS.js";import{R as e}from"./vendor-arcblock-5qqHEVGo.js";import"./vendor-utils-rHXShPKm.js";import"./vendor-hooks-BgUTpb6X.js";import"./lottie-web-jYmAQWuC.js";function x(){const{t:o}=s.useContext(a);return t.jsx(n,{style:{paddingTop:"25vh"},children:t.jsx(e,{status:"404",description:o("noMatch.desc"),style:{backgroundColor:"transparent"}})})}const n=r.main``;export{x as default};
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-BGbF_TCU.js","assets/vendor-ux-did-connect-DprdyYny.js","assets/vendor-react-DEoibe3W.js","assets/vendor-utils-rHXShPKm.js","assets/vendor-mui-core-BV2FUxWJ.js","assets/vendor-hooks-BgUTpb6X.js","assets/lottie-web-jYmAQWuC.js","assets/vendor-ux-did-connect-DpSGLE7B.css","assets/vendor-arcblock-CUb0jDdY.js","assets/index-Bs1kxR8_.js","assets/index-Ck-L27nB.js","assets/index-DOq-_YXu.css","assets/index-DVQCgvFb.js","assets/index-AgKpYdvC.css"])))=>i.map(i=>d[i]);
2
- import{r as j,f as Et,l as ut,L as we,g as Hn,u as Jn,i as Gn,j as wt}from"./vendor-react-DEoibe3W.js";import{a9 as Ie,j as e,v as Ve,aa as c,bc as Lt,H as s,ad as ye,I as de,T as N,s as Xn,c6 as Jo,D as pt,ah as Re,at as Yn,bR as ot,ak as ht,bs as nt,bw as st,y as ee,ab as Se,P as Go,G as Xo,w as qt,a8 as Yo,M as Zo,q as be,X as Zn,aj as Qo,t as Ko,bU as Qn,N as Ye,z as en,O as re,al as Ce,as as tn,L as on,A as Nt,b5 as nn,bJ as sn,bx as Kn,e as rn,ap as es,b_ as ts,af as os,U as ln,W as rt,bE as ns,bF as ss,c7 as rs,c8 as ls,bn as It,bo as is,bq as cs,bu as as,bv as Rt}from"./vendor-mui-core-BV2FUxWJ.js";import{D as ke,G as Te,ag as ds,a8 as us,f as Io,ah as To,ac as ps,ai as hs,aj as fs,ak as bs}from"./index-Ck-L27nB.js";import{r as $e,j as Y,a as Q,bu as cn,h as ms,B as Le,b7 as an,W as dn,b4 as un,ao as xs,bv as gs,a7 as At,Z as M,a3 as js,I as ue,bw as ks,ba as ys,_ as pn,b as Me,am as ft,b5 as vs,as as hn}from"./vendor-ux-did-connect-DprdyYny.js";import{O as bt,c as fe,j as ws,W as Rs,X as Ee,p as Cs}from"./vendor-arcblock-CUb0jDdY.js";import{d as Ss}from"./Error-DDQf7Wzw.js";import{C as mt}from"./confirm-Dg7hYCJT.js";import{u as Fe}from"./session-E0e-X6-a.js";import{W as Tt}from"./did-address-2a_50VlM.js";import{E as Ze}from"./empty-spinner-BdaCO6xq.js";import{B as zt}from"./bundle-avatar-Bn82ny8E.js";import{S as De}from"./shorten-label-DPIZ5X7v.js";import{L as Ot}from"./list-header-xt282ZMS.js";import{$ as Ds,A as pe,J as Wt,E as fn}from"./vendor-utils-rHXShPKm.js";import{d as Is}from"./Download-CmhNaqwS.js";import{C as bn}from"./click-to-copy-DsH0RQVg.js";import{Q as Ts}from"./QuestionMarkCircle-DTGyWFVS.js";import{x as $s,u as Ps}from"./vendor-hooks-BgUTpb6X.js";import{_ as Xe}from"./useSetState-CWq0AVWn.js";import{c as Bt}from"./index-DVQCgvFb.js";import{d as Mt}from"./Launch-CKr_eo1b.js";import{E as Vt}from"./index-D2uDBC1o.js";import"./api-BjteVZFg.js";import{d as _s}from"./ChevronRight-CA18V4hg.js";import{T as Es,a as Ls}from"./vendor-mui-x-Bo-XOtzq.js";import{d as lt}from"./DeleteOutline-DIXSGJ49.js";import{D as $o,C as Po,P as _o}from"./react-beautiful-dnd.esm-CXMxXaUW.js";import{c as qs,A as mn,u as xn,S as Ns,a as As,b as zs,e as Os,U as Ws,f as Ct,g as gn,n as Bs,h as Ms,i as Eo,k as Vs,l as Us}from"./item-JiENn3N2.js";import{d as Fs}from"./ArrowDropDown-Dzy2X1bv.js";import{f as je}from"./index-8eXqqyHQ.js";import{d as jn}from"./Done-BHbsILFJ.js";import{D as Hs}from"./delete-confirm-BvvDet1u.js";import{g as kn}from"./get-safe-url-BdFxF8pA.js";import{M as Js}from"./index-RsjqbOR7.js";import{r as Gs}from"./index-BmXcRfZR.js";import"./lottie-web-jYmAQWuC.js";import"./raf-schd.esm-B3j6BePR.js";var Ut={},Xs=Ie;Object.defineProperty(Ut,"__esModule",{value:!0});var yn=Ut.default=void 0,Ys=Xs($e()),Zs=e;yn=Ut.default=(0,Ys.default)((0,Zs.jsx)("path",{d:"M19 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2m-2 10h-4v4h-2v-4H7v-2h4V7h2v4h4z"}),"AddBox");var Ft={},Qs=Ie;Object.defineProperty(Ft,"__esModule",{value:!0});var vn=Ft.default=void 0,Ks=Qs($e()),er=e;vn=Ft.default=(0,Ks.default)((0,er.jsx)("path",{d:"M14 2H6c-1.1 0-2 .9-2 2v16c0 1.1.89 2 1.99 2H15v-8h5V8zm-1 7V3.5L18.5 9zm4 12.66V16h5.66v2h-2.24l2.95 2.95-1.41 1.41L19 19.41v2.24h-2z"}),"FileOpen");var Ht={},tr=Ie;Object.defineProperty(Ht,"__esModule",{value:!0});var wn=Ht.default=void 0,or=tr($e()),nr=e;wn=Ht.default=(0,or.default)((0,nr.jsx)("path",{d:"M11 18h2v-2h-2zm1-16C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8m0-14c-2.21 0-4 1.79-4 4h2c0-1.1.9-2 2-2s2 .9 2 2c0 2-3 1.75-3 5h2c0-2.25 3-2.5 3-5 0-2.21-1.79-4-4-4"}),"HelpOutlineOutlined");function Jt({did:t,projectId:o,title:n,logo:r,describe:i}){const l=`${`${Y.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${t}/${o}/logo/upload`}/${r}`,[u,d]=j.useState(!1),x=Ve(b=>b.breakpoints.down("md"));return e.jsxs(c,{sx:{display:"flex",flexDirection:"row",color:u?"primary.main":"grey.900",gap:1},onPointerEnter:()=>d(!0),onPointerLeave:()=>d(!1),children:[e.jsx(Lt,{sx:{borderRadius:1},src:l}),e.jsxs(c,{children:[e.jsx(De,{hiddenTip:!0,maxLength:"24",sx:{fontSize:"14px",fontWeight:"500",color:x?"primary.main":""},children:n||"/"}),e.jsx(De,{hiddenTip:!0,maxLength:"58",sx:{fontSize:"12px",color:x||u?"primary.main":"grey.700"},children:i||"/"})]})]})}Jt.propTypes={projectId:s.string.isRequired,did:s.string.isRequired,title:s.string.isRequired,logo:s.string.isRequired,describe:s.string.isRequired};function Gt({initUrl:t}){const o=Et(),n=(t==null?void 0:t.searchParams.get("tenantScope"))||"",{t:r,locale:i}=Q(),{api:a}=ke(),{api:l}=Fe(),[u,d]=j.useState(!0),{blocklet:x}=Te(),[b,p]=j.useState(null),[h,m]=j.useState(!1),f=Ve(C=>C.breakpoints.down("xl")),y=Ve(C=>C.breakpoints.down("md")),{componentDid:v=""}=ut(),[g,k]=j.useState(null),S=`publish-${x.meta.did}`,R=cn(S),[T,D]=j.useState({searchText:R.searchText||"",pageSize:R.rowsPerPage||10,page:1}),B=()=>{a.getProjects({input:{did:x.meta.did,componentDid:v,tenantScope:n}}).then(C=>{const _=(C==null?void 0:C.projects)||[];d(!1),k(_)}).catch(C=>{d(!1),M.error(C.message)})},$=()=>{o(`${Y.UNOWNED_DID}/create/none/0.0.0`,{replace:!0})},z=C=>{p(C)},J=()=>{d(!1),m(!0)},U=()=>{m(!1),p(null)},w=C=>{M.error(C.message),m(!1),p(null)},I=C=>{if(!(C!=null&&C.deleted)){M.error("Delete project failed");return}B(),m(!1),p(null)};j.useEffect(()=>{B()},[]);const q=j.useMemo(()=>{var _;if(!T.searchText)return g;let C=(_=T.searchText)==null?void 0:_.trim();return C?(C=ms.toAddress(C).toLocaleLowerCase(),g.filter(G=>G.blockletTitle.toLowerCase().includes(C)||G.blockletDid.toLowerCase().includes(C))):g},[g,T.searchText]);if(!g&&u)return e.jsx(c,{sx:{display:"flex",justifyContent:"center",alignItems:"center",marginTop:"40px"},children:e.jsx(Ze,{})});if(!g)return null;if(!g.length)return e.jsxs(c,{display:"flex",flexDirection:"column",alignItems:"center",pt:10,children:[e.jsx(c,{sx:{fontSize:20,fontWeight:"bold",mb:3},children:r("blocklet.publish.blockletEmptyTip")}),e.jsx(c,{sx:{fontSize:14,color:"text.secondary",mb:3},children:r("blocklet.publish.createBlockletTip")}),e.jsx(Le,{onClick:$,variant:"contained",children:r("blocklet.publish.createBlocklet")})]});const P=[{label:"Blocklet",name:"blockletTitle",minWidth:160,options:{customBodyRenderLite:C=>{const _=g[C];return e.jsx(we,{to:`${_.id}`,children:e.jsx(Jt,{did:x.meta.did,projectId:_.id,logo:_.blockletLogo,title:_.blockletTitle,describe:_.blockletDescription})})}}},{label:"Version",name:"blockletVersion",options:{searchable:!1,customBodyRender:C=>C?e.jsx(an,{type:"success",children:C}):""}},{label:"DID",name:"blockletDid",options:{customBodyRender:C=>C?e.jsx(Tt,{size:14,compact:!0,responsive:!1,did:C}):null}},f||v?null:{label:r("common.createdBy"),name:"createdBy",options:{customBodyRender:C=>C?e.jsx(Tt,{onClick:()=>{o(`/.well-known/service/admin/members?did=${C}`)},style:{cursor:"pointer"},size:14,compact:!0,copyable:!1,showQrcode:!1,responsive:!1,did:C}):null}},f||v?null:{label:r("common.scope"),name:"componentDid",options:{customBodyRender:C=>{const _=(x.children||[]).find(G=>G.meta.did===C);return _?e.jsxs(c,{display:"flex",alignItems:"center",justifyContent:"flex-start",children:[e.jsx(zt,{size:14,blocklet:_,ancestors:[x]}),e.jsx(c,{ml:.5,sx:{ml:.5,color:"text.primary",fontSize:14},children:_.meta.title})]},C):""}}},f||n?null:{label:r("blocklet.publish.tenantScope"),name:"tenantScope",options:{customBodyRender:C=>e.jsx(c,{ml:.5,sx:{ml:.5,color:"text.primary",fontSize:14},children:e.jsx(De,{children:C})})}},{label:r("common.updatedAt"),name:"updatedAt",options:{searchable:!1,customBodyRender:C=>e.jsx(dn,{value:Number(C),locale:i})}},{label:r("common.actions"),name:"actions",options:{searchable:!1,customBodyRenderLite:C=>{const _=g[C];return e.jsxs(c,{display:"flex",children:[e.jsx(we,{to:`${_.id}/new-release/${_.lastReleaseId}`,children:e.jsx(ye,{title:r("blocklet.publish.createRelease"),placement:"top",children:e.jsx(de,{color:"primary","aria-label":"create",children:e.jsx(yn,{style:{fontSize:18}})})})}),!!_.lastReleaseId&&e.jsx(ye,{title:r("blocklet.publish.viewLastRelease",{name:_.blockletTitle}),placement:"top",children:e.jsx(de,{color:"secondary","aria-label":"create",children:e.jsx(we,{style:{display:"flex"},to:`${_.id}/view/${_.lastReleaseId}/${_.blockletVersion}`,children:e.jsx(vn,{sx:{fontSize:18}})})})}),e.jsx(ye,{title:r("blocklet.publish.delete",{name:_.blockletTitle}),placement:"top",children:e.jsx(de,{color:"primary","aria-label":"delete",onClick:()=>z(_),children:e.jsx(un,{sx:{fontSize:18}})})})]})}}}].filter(Boolean),A=({page:C,rowsPerPage:_,searchText:G})=>{T.pageSize!==_?D(F=>({...F,searchText:"",pageSize:_,page:1})):T.page!==C+1?D(F=>({...F,searchText:"",page:C+1})):T.searchText!==G&&D(F=>({...F,searchText:G,page:1}))},H=h?e.jsx(xs,{open:!0,popup:!0,onClose:U,action:"check-has-project-id",locale:i,checkFn:l.get,saveConnect:!1,forceConnected:!1,checkTimeout:5*60*1e3,onSuccess:I,onError:w,extraParams:{projectId:b.id,did:x.meta.did,name:b.blockletTitle},messages:{title:r("blocklet.publish.deleteProject.title",{name:b.blockletTitle}),scan:r("blocklet.publish.deleteProject.scan",{name:b.blockletTitle}),confirm:r("blocklet.publish.deleteProject.confirm"),success:r("blocklet.publish.deleteProject.success")}}):null;return e.jsxs(sr,{children:[e.jsx(Ot,{sx:{mb:2},left:e.jsxs(c,{display:"flex",flexDirection:"row",alignItems:"center",children:[e.jsx(c,{sx:{fontSize:"1.2rem",fontWeight:"bold"},children:r("common.blockletStudio")}),e.jsx(ye,{title:r("blocklet.publish.createBlockletTip"),arrow:!0,placement:"right",children:e.jsx(wn,{sx:{opacity:.6,fontSize:"1.1em",ml:1}})})]}),actions:e.jsxs(e.Fragment,{children:[e.jsx(gs,{options:{searchPlaceholder:r("blocklet.list.searchPlaceholder"),searchDebounceTime:600,searchAlwaysOpen:y},search:T.searchText,searchText:T.searchText,searchTextUpdate:C=>D(_=>({..._,searchText:C})),searchClose:()=>D(C=>({...C,searchText:""})),onSearchOpen:()=>{}}),e.jsxs(Le,{onClick:$,variant:"contained",children:[e.jsx(bt,{style:{fontSize:"1.3em",marginRight:4}}),r("blocklet.publish.createBlocklet")]})]})}),e.jsx(At,{className:"main-table",locale:i,data:q,columns:P,options:{search:!1,sort:!1,download:!1,filter:!1,print:!1,viewColumns:!1,searchAlwaysOpen:!0,rowsPerPageOptions:[10,20,50,100]},durable:S,onChange:A}),b&&e.jsx(mt,{title:`${r("common.delete")} ${b.blockletTitle}`,description:r("blocklet.publish.deleteProject.description"),confirm:r("common.confirm"),onConfirm:J,onCancel:()=>p(null),children:e.jsx(c,{sx:{marginTop:2},children:[r("blocklet.publish.deleteProject.tip1"),r("blocklet.publish.deleteProject.tip2"),r("blocklet.publish.deleteProject.tip3")].map(C=>e.jsxs(c,{sx:{display:"flex",marginTop:1,flexDirection:"row",alignItems:"flex-start"},children:[e.jsx(Ss,{color:"warning",sx:{marginRight:1,fontSize:20,marginTop:"2px"}}),e.jsx(N,{component:"span",variant:"inherit",color:"text.secondary",children:C})]}))})}),H]})}const sr=Xn(c)`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-8lA5-nM7.js","assets/vendor-ux-did-connect-DROQhYpS.js","assets/vendor-react-DEoibe3W.js","assets/vendor-utils-rHXShPKm.js","assets/vendor-mui-core-BV2FUxWJ.js","assets/vendor-hooks-BgUTpb6X.js","assets/lottie-web-jYmAQWuC.js","assets/vendor-ux-did-connect-DpSGLE7B.css","assets/vendor-arcblock-5qqHEVGo.js","assets/index-Bs1kxR8_.js","assets/index-DJzuhKQh.js","assets/index-DOq-_YXu.css","assets/index-DVQCgvFb.js","assets/index-AgKpYdvC.css"])))=>i.map(i=>d[i]);
2
+ import{r as j,f as Et,l as ut,L as we,g as Hn,u as Jn,i as Gn,j as wt}from"./vendor-react-DEoibe3W.js";import{a9 as Ie,j as e,v as Ve,aa as c,bc as Lt,H as s,ad as ye,I as de,T as N,s as Xn,c6 as Jo,D as pt,ah as Re,at as Yn,bR as ot,ak as ht,bs as nt,bw as st,y as ee,ab as Se,P as Go,G as Xo,w as qt,a8 as Yo,M as Zo,q as be,X as Zn,aj as Qo,t as Ko,bU as Qn,N as Ye,z as en,O as re,al as Ce,as as tn,L as on,A as Nt,b5 as nn,bJ as sn,bx as Kn,e as rn,ap as es,b_ as ts,af as os,U as ln,W as rt,bE as ns,bF as ss,c7 as rs,c8 as ls,bn as It,bo as is,bq as cs,bu as as,bv as Rt}from"./vendor-mui-core-BV2FUxWJ.js";import{D as ke,G as Te,ag as ds,a8 as us,f as Io,ah as To,ac as ps,ai as hs,aj as fs,ak as bs}from"./index-DJzuhKQh.js";import{r as $e,j as Y,a as Q,bu as cn,h as ms,B as Le,b7 as an,W as dn,b4 as un,ao as xs,bv as gs,a7 as At,Z as M,a3 as js,I as ue,bw as ks,ba as ys,_ as pn,b as Me,am as ft,b5 as vs,as as hn}from"./vendor-ux-did-connect-DROQhYpS.js";import{O as bt,c as fe,j as ws,W as Rs,X as Ee,p as Cs}from"./vendor-arcblock-5qqHEVGo.js";import{d as Ss}from"./Error-B7SzGNr8.js";import{C as mt}from"./confirm-CiiHIA-a.js";import{u as Fe}from"./session-ugMCR4Iu.js";import{W as Tt}from"./did-address-BtAnHi7m.js";import{E as Ze}from"./empty-spinner-BdaCO6xq.js";import{B as zt}from"./bundle-avatar-BP8xFngr.js";import{S as De}from"./shorten-label-DPIZ5X7v.js";import{L as Ot}from"./list-header-xt282ZMS.js";import{$ as Ds,A as pe,J as Wt,E as fn}from"./vendor-utils-rHXShPKm.js";import{d as Is}from"./Download-4NCgy4QK.js";import{C as bn}from"./click-to-copy-B26zKr7i.js";import{Q as Ts}from"./QuestionMarkCircle-DTGyWFVS.js";import{x as $s,u as Ps}from"./vendor-hooks-BgUTpb6X.js";import{_ as Xe}from"./useSetState-CWq0AVWn.js";import{c as Bt}from"./index-DVQCgvFb.js";import{d as Mt}from"./Launch-ipC6Ic2p.js";import{E as Vt}from"./index-D2uDBC1o.js";import"./api-BjteVZFg.js";import{d as _s}from"./ChevronRight-BfSAowju.js";import{T as Es,a as Ls}from"./vendor-mui-x-Bo-XOtzq.js";import{d as lt}from"./DeleteOutline-lCPjjhKz.js";import{D as $o,C as Po,P as _o}from"./react-beautiful-dnd.esm-WW1RMrIr.js";import{c as qs,A as mn,u as xn,S as Ns,a as As,b as zs,e as Os,U as Ws,f as Ct,g as gn,n as Bs,h as Ms,i as Eo,k as Vs,l as Us}from"./item-DLwktWNI.js";import{d as Fs}from"./ArrowDropDown-DUn14Acv.js";import{f as je}from"./index-8eXqqyHQ.js";import{d as jn}from"./Done-BoNuG9Iy.js";import{D as Hs}from"./delete-confirm-BPtFZ4JP.js";import{g as kn}from"./get-safe-url-CiQ8_q49.js";import{M as Js}from"./index-RsjqbOR7.js";import{r as Gs}from"./index-BmXcRfZR.js";import"./lottie-web-jYmAQWuC.js";import"./raf-schd.esm-B3j6BePR.js";var Ut={},Xs=Ie;Object.defineProperty(Ut,"__esModule",{value:!0});var yn=Ut.default=void 0,Ys=Xs($e()),Zs=e;yn=Ut.default=(0,Ys.default)((0,Zs.jsx)("path",{d:"M19 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2m-2 10h-4v4h-2v-4H7v-2h4V7h2v4h4z"}),"AddBox");var Ft={},Qs=Ie;Object.defineProperty(Ft,"__esModule",{value:!0});var vn=Ft.default=void 0,Ks=Qs($e()),er=e;vn=Ft.default=(0,Ks.default)((0,er.jsx)("path",{d:"M14 2H6c-1.1 0-2 .9-2 2v16c0 1.1.89 2 1.99 2H15v-8h5V8zm-1 7V3.5L18.5 9zm4 12.66V16h5.66v2h-2.24l2.95 2.95-1.41 1.41L19 19.41v2.24h-2z"}),"FileOpen");var Ht={},tr=Ie;Object.defineProperty(Ht,"__esModule",{value:!0});var wn=Ht.default=void 0,or=tr($e()),nr=e;wn=Ht.default=(0,or.default)((0,nr.jsx)("path",{d:"M11 18h2v-2h-2zm1-16C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8m0-14c-2.21 0-4 1.79-4 4h2c0-1.1.9-2 2-2s2 .9 2 2c0 2-3 1.75-3 5h2c0-2.25 3-2.5 3-5 0-2.21-1.79-4-4-4"}),"HelpOutlineOutlined");function Jt({did:t,projectId:o,title:n,logo:r,describe:i}){const l=`${`${Y.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${t}/${o}/logo/upload`}/${r}`,[u,d]=j.useState(!1),x=Ve(b=>b.breakpoints.down("md"));return e.jsxs(c,{sx:{display:"flex",flexDirection:"row",color:u?"primary.main":"grey.900",gap:1},onPointerEnter:()=>d(!0),onPointerLeave:()=>d(!1),children:[e.jsx(Lt,{sx:{borderRadius:1},src:l}),e.jsxs(c,{children:[e.jsx(De,{hiddenTip:!0,maxLength:"24",sx:{fontSize:"14px",fontWeight:"500",color:x?"primary.main":""},children:n||"/"}),e.jsx(De,{hiddenTip:!0,maxLength:"58",sx:{fontSize:"12px",color:x||u?"primary.main":"grey.700"},children:i||"/"})]})]})}Jt.propTypes={projectId:s.string.isRequired,did:s.string.isRequired,title:s.string.isRequired,logo:s.string.isRequired,describe:s.string.isRequired};function Gt({initUrl:t}){const o=Et(),n=(t==null?void 0:t.searchParams.get("tenantScope"))||"",{t:r,locale:i}=Q(),{api:a}=ke(),{api:l}=Fe(),[u,d]=j.useState(!0),{blocklet:x}=Te(),[b,p]=j.useState(null),[h,m]=j.useState(!1),f=Ve(C=>C.breakpoints.down("xl")),y=Ve(C=>C.breakpoints.down("md")),{componentDid:v=""}=ut(),[g,k]=j.useState(null),S=`publish-${x.meta.did}`,R=cn(S),[T,D]=j.useState({searchText:R.searchText||"",pageSize:R.rowsPerPage||10,page:1}),B=()=>{a.getProjects({input:{did:x.meta.did,componentDid:v,tenantScope:n}}).then(C=>{const _=(C==null?void 0:C.projects)||[];d(!1),k(_)}).catch(C=>{d(!1),M.error(C.message)})},$=()=>{o(`${Y.UNOWNED_DID}/create/none/0.0.0`,{replace:!0})},z=C=>{p(C)},J=()=>{d(!1),m(!0)},U=()=>{m(!1),p(null)},w=C=>{M.error(C.message),m(!1),p(null)},I=C=>{if(!(C!=null&&C.deleted)){M.error("Delete project failed");return}B(),m(!1),p(null)};j.useEffect(()=>{B()},[]);const q=j.useMemo(()=>{var _;if(!T.searchText)return g;let C=(_=T.searchText)==null?void 0:_.trim();return C?(C=ms.toAddress(C).toLocaleLowerCase(),g.filter(G=>G.blockletTitle.toLowerCase().includes(C)||G.blockletDid.toLowerCase().includes(C))):g},[g,T.searchText]);if(!g&&u)return e.jsx(c,{sx:{display:"flex",justifyContent:"center",alignItems:"center",marginTop:"40px"},children:e.jsx(Ze,{})});if(!g)return null;if(!g.length)return e.jsxs(c,{display:"flex",flexDirection:"column",alignItems:"center",pt:10,children:[e.jsx(c,{sx:{fontSize:20,fontWeight:"bold",mb:3},children:r("blocklet.publish.blockletEmptyTip")}),e.jsx(c,{sx:{fontSize:14,color:"text.secondary",mb:3},children:r("blocklet.publish.createBlockletTip")}),e.jsx(Le,{onClick:$,variant:"contained",children:r("blocklet.publish.createBlocklet")})]});const P=[{label:"Blocklet",name:"blockletTitle",minWidth:160,options:{customBodyRenderLite:C=>{const _=g[C];return e.jsx(we,{to:`${_.id}`,children:e.jsx(Jt,{did:x.meta.did,projectId:_.id,logo:_.blockletLogo,title:_.blockletTitle,describe:_.blockletDescription})})}}},{label:"Version",name:"blockletVersion",options:{searchable:!1,customBodyRender:C=>C?e.jsx(an,{type:"success",children:C}):""}},{label:"DID",name:"blockletDid",options:{customBodyRender:C=>C?e.jsx(Tt,{size:14,compact:!0,responsive:!1,did:C}):null}},f||v?null:{label:r("common.createdBy"),name:"createdBy",options:{customBodyRender:C=>C?e.jsx(Tt,{onClick:()=>{o(`/.well-known/service/admin/members?did=${C}`)},style:{cursor:"pointer"},size:14,compact:!0,copyable:!1,showQrcode:!1,responsive:!1,did:C}):null}},f||v?null:{label:r("common.scope"),name:"componentDid",options:{customBodyRender:C=>{const _=(x.children||[]).find(G=>G.meta.did===C);return _?e.jsxs(c,{display:"flex",alignItems:"center",justifyContent:"flex-start",children:[e.jsx(zt,{size:14,blocklet:_,ancestors:[x]}),e.jsx(c,{ml:.5,sx:{ml:.5,color:"text.primary",fontSize:14},children:_.meta.title})]},C):""}}},f||n?null:{label:r("blocklet.publish.tenantScope"),name:"tenantScope",options:{customBodyRender:C=>e.jsx(c,{ml:.5,sx:{ml:.5,color:"text.primary",fontSize:14},children:e.jsx(De,{children:C})})}},{label:r("common.updatedAt"),name:"updatedAt",options:{searchable:!1,customBodyRender:C=>e.jsx(dn,{value:Number(C),locale:i})}},{label:r("common.actions"),name:"actions",options:{searchable:!1,customBodyRenderLite:C=>{const _=g[C];return e.jsxs(c,{display:"flex",children:[e.jsx(we,{to:`${_.id}/new-release/${_.lastReleaseId}`,children:e.jsx(ye,{title:r("blocklet.publish.createRelease"),placement:"top",children:e.jsx(de,{color:"primary","aria-label":"create",children:e.jsx(yn,{style:{fontSize:18}})})})}),!!_.lastReleaseId&&e.jsx(ye,{title:r("blocklet.publish.viewLastRelease",{name:_.blockletTitle}),placement:"top",children:e.jsx(de,{color:"secondary","aria-label":"create",children:e.jsx(we,{style:{display:"flex"},to:`${_.id}/view/${_.lastReleaseId}/${_.blockletVersion}`,children:e.jsx(vn,{sx:{fontSize:18}})})})}),e.jsx(ye,{title:r("blocklet.publish.delete",{name:_.blockletTitle}),placement:"top",children:e.jsx(de,{color:"primary","aria-label":"delete",onClick:()=>z(_),children:e.jsx(un,{sx:{fontSize:18}})})})]})}}}].filter(Boolean),A=({page:C,rowsPerPage:_,searchText:G})=>{T.pageSize!==_?D(F=>({...F,searchText:"",pageSize:_,page:1})):T.page!==C+1?D(F=>({...F,searchText:"",page:C+1})):T.searchText!==G&&D(F=>({...F,searchText:G,page:1}))},H=h?e.jsx(xs,{open:!0,popup:!0,onClose:U,action:"check-has-project-id",locale:i,checkFn:l.get,saveConnect:!1,forceConnected:!1,checkTimeout:5*60*1e3,onSuccess:I,onError:w,extraParams:{projectId:b.id,did:x.meta.did,name:b.blockletTitle},messages:{title:r("blocklet.publish.deleteProject.title",{name:b.blockletTitle}),scan:r("blocklet.publish.deleteProject.scan",{name:b.blockletTitle}),confirm:r("blocklet.publish.deleteProject.confirm"),success:r("blocklet.publish.deleteProject.success")}}):null;return e.jsxs(sr,{children:[e.jsx(Ot,{sx:{mb:2},left:e.jsxs(c,{display:"flex",flexDirection:"row",alignItems:"center",children:[e.jsx(c,{sx:{fontSize:"1.2rem",fontWeight:"bold"},children:r("common.blockletStudio")}),e.jsx(ye,{title:r("blocklet.publish.createBlockletTip"),arrow:!0,placement:"right",children:e.jsx(wn,{sx:{opacity:.6,fontSize:"1.1em",ml:1}})})]}),actions:e.jsxs(e.Fragment,{children:[e.jsx(gs,{options:{searchPlaceholder:r("blocklet.list.searchPlaceholder"),searchDebounceTime:600,searchAlwaysOpen:y},search:T.searchText,searchText:T.searchText,searchTextUpdate:C=>D(_=>({..._,searchText:C})),searchClose:()=>D(C=>({...C,searchText:""})),onSearchOpen:()=>{}}),e.jsxs(Le,{onClick:$,variant:"contained",children:[e.jsx(bt,{style:{fontSize:"1.3em",marginRight:4}}),r("blocklet.publish.createBlocklet")]})]})}),e.jsx(At,{className:"main-table",locale:i,data:q,columns:P,options:{search:!1,sort:!1,download:!1,filter:!1,print:!1,viewColumns:!1,searchAlwaysOpen:!0,rowsPerPageOptions:[10,20,50,100]},durable:S,onChange:A}),b&&e.jsx(mt,{title:`${r("common.delete")} ${b.blockletTitle}`,description:r("blocklet.publish.deleteProject.description"),confirm:r("common.confirm"),onConfirm:J,onCancel:()=>p(null),children:e.jsx(c,{sx:{marginTop:2},children:[r("blocklet.publish.deleteProject.tip1"),r("blocklet.publish.deleteProject.tip2"),r("blocklet.publish.deleteProject.tip3")].map(C=>e.jsxs(c,{sx:{display:"flex",marginTop:1,flexDirection:"row",alignItems:"flex-start"},children:[e.jsx(Ss,{color:"warning",sx:{marginRight:1,fontSize:20,marginTop:"2px"}}),e.jsx(N,{component:"span",variant:"inherit",color:"text.secondary",children:C})]}))})}),H]})}const sr=Xn(c)`
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 j,f as Et,l as ut,L as we,g as Hn,u as Jn,i as Gn,j as wt}from"./ven
142
142
  background: #fff;
143
143
  z-index: 10;
144
144
  }
145
- `;var no={},Lr=Ie;Object.defineProperty(no,"__esModule",{value:!0});var $t=no.default=void 0,qr=Lr($e()),Nr=e;$t=no.default=(0,qr.default)((0,Nr.jsx)("path",{d:"M11 18c0 1.1-.9 2-2 2s-2-.9-2-2 .9-2 2-2 2 .9 2 2m-2-8c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m0-6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m6 4c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2m0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2"}),"DragIndicator");const zo="lastWantToConnectStoreId";function Ar(t){var u,d;const[o,n]=j.useState(null),{session:r}=Fe(),i=j.useCallback(x=>{n(x),localStorage.setItem(zo,x==null?void 0:x.id)},[n]),a=j.useMemo(()=>{var h,m,f,y;const x=localStorage.getItem(zo),b=x?(((h=t==null?void 0:t.settings)==null?void 0:h.storeList)||[]).find(v=>v.id===x):null;if(b)return b;let p=(((m=t==null?void 0:t.settings)==null?void 0:m.storeList)||[]).find(v=>{var g;return!(v.id!==Y.BLOCKLET_STORE.id||v.scope&&v.scope!=="studio"&&v.scope!==((g=r==null?void 0:r.user)==null?void 0:g.did))});return p||(p=(y=(f=t==null?void 0:t.settings)==null?void 0:f.storeList)==null?void 0:y[0]),p},[(u=t==null?void 0:t.settings)==null?void 0:u.storeList,(d=r==null?void 0:r.user)==null?void 0:d.did]);return[o||a||{},i]}const Dt={};async function so(t,{interval:o=1e3,maxDuration:n=120*1e3,intervalFirst:r=4e3,timerKey:i=""}){Dt[i]&&clearTimeout(Dt[i]),await new Promise(u=>setTimeout(u,r));const a=Date.now(),l=async(u,d)=>{try{const x=await t();u(x)}catch(x){Date.now()-a>n?d(x):i?Dt[i]=setTimeout(()=>l(u,d),o):setTimeout(()=>l(u,d),o)}};return new Promise(l)}function zr(){return Math.random().toString(36).slice(2)+Math.random().toString(36).slice(2)+`${Date.now()}`.slice(-6)}function Or(t,{did:o,projectId:n,messageId:r}){return so(async()=>{var a;const i=await t.getProject({input:{did:o,projectId:n,messageId:r}});if(!((a=i==null?void 0:i.project)!=null&&a.blockletDid))throw new Error("Connected store not found");return i.project.blockletDid},{timerKey:"connect-studio"})}function Wr(t,{did:o,projectId:n,storeId:r}){return so(async()=>{var l,u;const i=await t.getProject({input:{did:o,projectId:n,messageId:""}});if(!((u=(l=i==null?void 0:i.project)==null?void 0:l.connectedStores)!=null&&u.length))throw new Error("Connected store not found");if(!i.project.connectedStores.find(d=>d.storeId===r))throw new Error("Connected store not found")},{timerKey:`connect-store-${r}`})}function Br(t,{did:o,projectId:n,endpointId:r}){return so(async()=>{var l,u;const i=await t.getProject({input:{did:o,projectId:n,messageId:""}});if(!((u=(l=i==null?void 0:i.project)==null?void 0:l.connectedEndpoints)!=null&&u.length))throw new Error("Connected endpoint not found");if(!i.project.connectedEndpoints.find(d=>d.endpointId===r))throw new Error("Connected endpoint not found")},{timerKey:`connect-store-${r}`})}const Mr=({fromBlocklet:t,nodeInfo:o,blocklet:n,userDid:r})=>{var l,u;const i=t?(l=n==null?void 0:n.meta)==null?void 0:l.did:o==null?void 0:o.did;let a=t?((u=n==null?void 0:n.settings)==null?void 0:u.storeList)||[]:(o==null?void 0:o.blockletRegistryList)||[];return Array.isArray(a)||(a=[]),a=a.filter(d=>d.protected||!d.scope||d.scope==="studio"||d.scope===r),{teamDid:i,storeList:a}},ro=Mr;function lo({blocklet:t,store:o={},onChangeStore:n,onClick:r,disabled:i,loading:a,componentDid:l}){var w,I,q;const{t:u}=Q(),{session:d}=Fe(),{api:x,info:b,inService:p}=ke(),h=Te(),[m,f]=j.useState(!1),y=j.useRef(null),[v,g]=j.useState(!1),[k,S]=j.useState(null),R=P=>{n(P),f(!1)},T=()=>{f(!m)},D=P=>{y.current&&y.current.contains(P.target)||f(!1)},B=()=>{g(!0)},$=()=>{g(!1)},z=async()=>{var P;if(k)try{await x.deleteBlockletStore({input:{teamDid:t.meta.did,url:k.url,projectId:"",scope:k.scope||"studio"}}),await((P=h==null?void 0:h.actions)==null?void 0:P.refreshBlocklet())}catch(A){M.error(`Remove Blocklet Store Error: ${je(A)}`)}finally{S(null)}},{storeList:J}=ro({fromBlocklet:p,blocklet:t,nodeInfo:b,componentDid:l,userDid:(w=d==null?void 0:d.user)==null?void 0:w.did}),U=(I=t==null?void 0:t.meta)==null?void 0:I.did;return e.jsxs(e.Fragment,{children:[e.jsxs(st,{disabled:i,ref:y,variant:"contained",color:"primary","aria-label":"Button group with connect store",children:[e.jsxs(ee,{onClick:r,children:[a&&e.jsx(Se,{size:14,sx:{mr:.5}}),`${u("common.connect")} ${o.name||""}`]}),e.jsx(ee,{size:"small","aria-controls":m?"split-button-menu":void 0,"aria-expanded":m?"true":void 0,"aria-label":"select merge strategy","aria-haspopup":"menu",onClick:T,children:e.jsx(Fs,{})})]}),e.jsx(Go,{sx:{zIndex:10},open:m,anchorEl:y.current,placement:"bottom-end",role:void 0,transition:!0,disablePortal:!0,children:({TransitionProps:P})=>e.jsx(Xo,{...P,style:{transformOrigin:"center top"},children:e.jsx(qt,{children:e.jsx(Yo,{onClickAway:D,children:e.jsxs(Zo,{id:"split-button-menu",autoFocusItem:!0,sx:{maxHeight:300,overflowY:"auto",zIndex:10},children:[J==null?void 0:J.map(A=>{var H;return e.jsxs(be,{selected:A.id===(o==null?void 0:o.id),sx:{height:56},onClick:()=>R(A),children:[e.jsxs(c,{children:[e.jsx(De,{sx:{fontSize:"16px"},maxLength:24,children:A.name}),e.jsx(De,{sx:{fontSize:"13px",opacity:.6},maxLength:30,children:A.url})]}),qs({store:A,userDid:(H=d==null?void 0:d.user)==null?void 0:H.did})&&e.jsx(de,{sx:{ml:1},onClick:C=>{C.preventDefault(),C.stopPropagation(),S(A)},children:e.jsx(ue,{icon:"ic:outline-delete"})})]},A.url)}),e.jsx(Zn,{}),e.jsxs(be,{onClick:B,children:[e.jsx(bt,{font:!0}),e.jsx(N,{variant:"inherit",children:u("store.blockletRegistry.addRegistry")})]})]})})})})}),v&&e.jsx(mn,{hiddenChildren:!0,open:!0,onClose:$,teamDid:U,storeList:J,scope:"studio",onAdd:(q=h==null?void 0:h.actions)==null?void 0:q.refreshBlocklet}),k&&e.jsx(mt,{displayError:!0,title:`${u("common.delete")} ${k.name}`,description:u("blocklet.publish.deleteStoreTip",{name:k.name}),confirm:u("common.confirm"),onConfirm:z,onCancel:()=>S(null)})]})}lo.propTypes={store:s.object,blocklet:s.object,onChangeStore:s.func.isRequired,onClick:s.func.isRequired,loading:s.bool.isRequired,disabled:s.bool.isRequired,componentDid:s.string.isRequired,projectType:s.string.isRequired,getData:s.func.isRequired};lo.defaultProps={store:null,blocklet:null};const Vr=(t,o,n)=>{const r=`${Y.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${o.meta.did}/${n}/logo/upload`,i=`${Y.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${o.meta.did}/${n}/screenshot/upload`,a=t!=null&&t.blockletLogo?`${r}/${t.blockletLogo}`:`${Y.WELLKNOWN_SERVICE_PATH_PREFIX}/static/images/logo.png`,l=((t==null?void 0:t.blockletScreenshots)||[]).filter(Boolean).map(u=>`${i}/${u}`);return{logoUrl:a,screenshotUrls:l,uploadLogoPrefix:r,uploadScreenshotPrefix:i}},$n=Vr,Ur=t=>{const o=t.includes("youtube.com")||t.includes("youtu.be"),n=t.includes("vimeo.com");return o||n};function xt({url:t,style:o,controls:n,modestbranding:r}){var u;const{t:i}=Q(),a=t.includes("youtube.com")||t.includes("youtu.be"),l=t.includes("vimeo.com");if(a){const d=((u=t.split("v=")[1])==null?void 0:u.split("&")[0])||t.split("/").pop();return e.jsx("div",{style:{position:"relative",width:"100%",paddingTop:"56.25%",pointerEvents:(o==null?void 0:o.pointerEvents)||"auto"},children:e.jsx("iframe",{src:`https://www.youtube.com/embed/${d}?modestbranding=${r}&controls=${n}&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(l){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(c,{style:{position:"relative",width:"100%",paddingTop:"56.25%"},children:e.jsxs(c,{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(ue,{icon:"carbon:video-off",style:{fontSize:40,marginBottom:"10px",opacity:.5}}),e.jsx(N,{variant:"body1",sx:{opacity:.5},children:i("studio.videoDialogNoSrc")})]})})}xt.propTypes={url:s.string.isRequired,style:s.object,controls:s.number,modestbranding:s.number};xt.defaultProps={style:{},controls:1,modestbranding:1};function Pn({setParams:t,onClose:o,params:n}){const{t:r}=Q(),[i,a]=j.useState(""),l=i&&n.blockletVideos.includes(i),u=Ur(i),d=()=>{t(x=>{const b=[...x.blockletVideos];return b.push(i),{...x,blockletVideos:b}}),o()};return e.jsxs(pt,{open:!0,fullWidth:!0,maxWidth:"sm",children:[e.jsx(Qo,{children:r("studio.videoDialogTitle")}),e.jsxs(Ko,{children:[e.jsx(Qn,{fullWidth:!0,value:i,onChange:x=>a(x.target.value),placeholder:r("studio.videoInputLabel"),endAdornment:i?e.jsx(Ye,{position:"end",children:e.jsx(de,{onClick:()=>a(""),children:e.jsx(ys,{})})}):null,error:l}),l&&e.jsx(N,{variant:"body2",color:"error",children:r("studio.duplicateVideo")}),e.jsx(xt,{url:i,style:{marginTop:"20px",borderRadius:"4px"}})]}),e.jsxs(en,{children:[e.jsx(ee,{onClick:()=>o(),children:r("studio.cancel")}),e.jsx(ee,{disabled:!u||l,onClick:d,children:r("studio.confirm")})]})]})}Pn.propTypes={onClose:s.func.isRequired,params:s.object.isRequired,setParams:s.func.isRequired};function Pt({errors:t,storeList:o,...n}){const{t:r}=Q();return e.jsxs(c,{...n,color:"warning.main",fontSize:"14px",sx:{border:"1px solid rgba(214, 164, 64, 0.34)",borderRadius:"4px",py:2,px:1.5,position:"relative"},children:[e.jsx(N,{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(([i,a])=>{const l=Object.values(a),u=o.find(d=>d.url===i);return l.length>0&&e.jsxs(c,{children:[e.jsx(ye,{title:i,children:e.jsx(c,{component:"span",sx:{cursor:"pointer"},children:u.name})}),l.map(d=>e.jsx(c,{component:"li",ml:2,sx:{wordBreak:!0},children:d},d))]},i)})]})}Pt.propTypes={errors:s.object.isRequired,storeList:s.array.isRequired};const Oo=j.lazy(()=>pn(()=>import("./index-BGbF_TCU.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13])).then(t=>({default:t.Uploader})));function io({projectId:t,readOnly:o,loading:n,blocklet:r,params:i,setParams:a,paramsErrTip:l,setParamsErrTip:u,warning:d,setLoading:x,initUrl:b,initLogoUrl:p,setInitLogoUrl:h,componentDid:m}){const{t:f,locale:y}=Q(),{api:v}=ke(),g=Et(),k=j.useRef(null),S=j.useRef(null),[R,T]=Ar(r),[D,B]=j.useState(!1),$=xn({messageType:"connect-store-message",onOpen:()=>x(!0),onClose:()=>x(!1)}),z=async E=>{const Z=setTimeout(()=>{x(!1)},2e4),X=await Or(v,E);x(!1),clearTimeout(Z),window.parent.postMessage({event:"studioDialog.connected",componentDid:m},"*"),g(window.location.pathname.replace(`${Y.UNOWNED_DID}/create`,`${X}/create`),{replace:!0})},J=()=>{if(!i.blockletTitle){M.error(f("blocklet.publish.errorTip.noTitle"));return}if(!(R!=null&&R.url)){M.error(f("blocklet.publish.noStoreSelected"));return}const E=zr();$(async(Z,X)=>{var oe,le,te;try{const ne=await v.connectByStudio({input:{did:(oe=r==null?void 0:r.meta)==null?void 0:oe.did,blockletTitle:i==null?void 0:i.blockletTitle,storeUrl:R.url,storeId:R.id,storeName:R.name,type:((le=i==null?void 0:i.blockletComponents)==null?void 0:le.length)>0?"pack":"resource",componentDid:m,messageId:E,tenantScope:(b==null?void 0:b.searchParams.get("tenantScope"))||""}});if(!(ne!=null&&ne.url)){M.error("failed to connect to store");return}X(ne.url),z({did:(te=r==null?void 0:r.meta)==null?void 0:te.did,projectId:"",messageId:E})}catch(ne){const ae=je(ne);M.error(ae),x(!1)}})},{logoUrl:U,screenshotUrls:w,uploadLogoPrefix:I,uploadScreenshotPrefix:q}=$n(i,r,t),{logoErrors:P,screenshotErrors:A,storeList:H,hasLogoWarning:C,hasScreenshotWarning:_}=d,G=()=>o?!1:!t||t===Y.UNOWNED_DID?(M.error(f("blocklet.publish.errorTip.noFirstDid")),!1):!0,F=E=>{if(!E.destination)return;const Z=Array.from(i.blockletScreenshots),[X]=Z.splice(E.source.index,1);Z.splice(E.destination.index,0,X),a(oe=>({...oe,blockletScreenshots:Z}))},K=E=>{if(!E.destination)return;const Z=Array.from(i.blockletVideos),[X]=Z.splice(E.source.index,1);Z.splice(E.destination.index,0,X),a(oe=>({...oe,blockletVideos:Z}))};return e.jsxs(Fr,{children:[e.jsx(c,{display:"flex",className:"section",children:e.jsxs(c,{sx:{flex:1},children:[e.jsx(re,{disabled:n||o,label:`Blocklet ${f("common.title")}`,placeholder:`Blocklet ${f("common.title")}`,InputProps:{"data-cy":"blocklet-title",readOnly:o},autoComplete:"off",variant:"outlined",fullWidth:!0,required:!0,value:i.blockletTitle||"",onChange:E=>{u({blockletTitle:""}),a({blockletTitle:E.target.value})},error:!!l.blockletTitle,helperText:l.blockletTitle||""}),e.jsx(re,{required:!0,label:"Blocklet DID",fullWidth:!0,readonly:!0,disabled:!0,autoComplete:"off",variant:"outlined",InputProps:{"data-cy":"export-blocklet-did",endAdornment:t===Y.UNOWNED_DID&&e.jsx(Ye,{position:"end",children:e.jsx(lo,{blocklet:r,store:R,componentDid:m,onChangeStore:T,disabled:!i.blockletTitle||o||n,loading:n,onClick:J})})},error:!!l.projectId,helperText:l.projectId||"",value:t===Y.UNOWNED_DID?"":`did:abt:${t}`,sx:{mt:3}}),e.jsx(re,{disabled:n||o,label:`Blocklet ${f("common.description")}`,placeholder:`Blocklet ${f("common.description")}`,InputProps:{"data-cy":"blocklet-description",readOnly:o},required:!0,autoComplete:"off",variant:"outlined",fullWidth:!0,value:i.blockletDescription||"",onChange:E=>{u({blockletDescription:""}),a({blockletDescription:E.target.value.slice(0,159)})},error:!!l.blockletDescription,helperText:l.blockletDescription||"",sx:{mt:3}}),e.jsx(re,{disabled:n||o,label:`Blocklet ${f("common.homepageTip")}`,placeholder:`Blocklet ${f("common.homepageTip")}`,InputProps:{"data-cy":"blocklet-homepage",readOnly:o},autoComplete:"off",variant:"outlined",fullWidth:!0,value:i.blockletHomepage||"",onChange:E=>{E.target.value&&!/^(http|https):\/\//.test(E.target.value)?u({blockletHomepage:f("blocklet.publish.errorTip.invalidUrl")}):u({blockletHomepage:""}),a({blockletHomepage:E.target.value})},error:!!l.blockletHomepage,helperText:l.blockletHomepage||"",sx:{mt:3}}),e.jsx(re,{disabled:n||o,label:`Blocklet ${f("common.community")}`,placeholder:`Blocklet ${f("common.community")}`,InputProps:{"data-cy":"blocklet-community",readOnly:o},autoComplete:"off",variant:"outlined",fullWidth:!0,value:i.blockletCommunity||"",onChange:E=>{E.target.value&&!/^(http|https):\/\//.test(E.target.value)?u({blockletCommunity:f("blocklet.publish.errorTip.invalidUrl")}):u({blockletCommunity:""}),a({blockletCommunity:E.target.value})},error:!!l.blockletCommunity,helperText:l.blockletCommunity||"",sx:{mt:3}}),e.jsx(re,{disabled:n||o,label:`Blocklet ${f("common.support")}`,placeholder:`Blocklet ${f("common.support")}`,InputProps:{"data-cy":"blocklet-support",readOnly:o},autoComplete:"off",variant:"outlined",fullWidth:!0,value:i.blockletSupport||"",onChange:E=>{E.target.value&&!/^(http|https):\/\//.test(E.target.value)&&!/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/.test(E.target.value)?u({blockletSupport:f("blocklet.publish.errorTip.invalidUrlOrEmail")}):u({blockletSupport:""}),a({blockletSupport:E.target.value})},error:!!l.blockletSupport,helperText:l.blockletSupport||"",sx:{mt:3}}),e.jsx(re,{disabled:n||o,label:`Blocklet ${f("common.repository")}`,placeholder:`Blocklet ${f("common.repository")}`,InputProps:{"data-cy":"blocklet-repository",readOnly:o},autoComplete:"off",variant:"outlined",fullWidth:!0,value:i.blockletRepository||"",onChange:E=>{E.target.value&&!/^(git|https|svn)/.test(E.target.value)?u({blockletRepository:f("blocklet.publish.errorTip.invalidUrl")}):u({blockletRepository:""}),a({blockletRepository:E.target.value})},error:!!l.blockletRepository,helperText:l.blockletRepository||"",sx:{mt:3}})]})}),e.jsx(c,{display:"flex",mt:3,className:"section full-width",children:e.jsxs(c,{flex:1,overflow:"hidden",children:[e.jsxs(c,{display:"flex",flexDirection:"row",flexWrap:"wrap",children:[e.jsxs(Ce,{direction:"column",spacing:1,sx:{mr:2,width:"160px"},children:[e.jsx(N,{variant:"subtitle1",sx:{fontWeight:"bold"},children:f("common.logo")}),e.jsxs(Ce,{direction:"column",alignItems:"flex-start",spacing:1,sx:{opacity:.8,fontSize:"12px"},children:[e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"text.secondary"},children:[f("studio.type"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"secondary.main"},children:"png, jpg, webp, svg"})]})}),e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"text.secondary"},children:[f("studio.ratio"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"secondary.main"},children:"256x256"})]})}),e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"text.secondary"},children:[f("studio.size"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"secondary.main"},children:"<500Kb"})]})})]})]}),e.jsx(c,{sx:{flex:1,cursor:o?"default":"pointer",display:"flex",alignItems:"flex-end"},children:e.jsx(Lt,{variant:"square",sx:{width:80,height:80},alt:"Blocklet Logo",src:p||U,onClick:()=>{var E;G()&&((E=k.current)==null||E.open())}})})]}),C&&e.jsx(Pt,{errors:P,storeList:H,mt:3}),e.jsxs(c,{display:"flex",mt:3,flexDirection:"row",flexWrap:"wrap",children:[e.jsxs(Ce,{direction:"column",spacing:1,sx:{mr:2,width:"160px"},children:[e.jsx(N,{variant:"subtitle1",sx:{fontWeight:"bold"},children:f("common.screenshot")}),e.jsxs(Ce,{direction:"column",alignItems:"flex-start",spacing:1,sx:{opacity:.8,fontSize:"12px"},children:[e.jsx(c,{sx:{border:"none"},variant:"outlined",size:"small",children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"text.secondary"},children:[f("studio.ratio"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"secondary.main"},children:"16 / 9"})]})}),e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"text.secondary"},children:[f("studio.count"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"secondary.main"},children:"1~5"})]})}),e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"text.secondary"},children:[f("studio.size"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"secondary.main"},children:"<5MB"})]})}),!o&&e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"text.secondary"},children:[f("studio.order"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"secondary.main"},children:f("studio.orderTip")})]})})]})]}),e.jsx($o,{onDragEnd:o?void 0:F,children:e.jsx(Po,{droppableId:"screenshots",direction:"horizontal",isDropDisabled:o,children:(E,Z)=>e.jsxs(c,{display:"flex",alignItems:"center",sx:{flex:1,flexWrap:"wrap",minHeight:160,background:Z.isDraggingOver?"grey.100":"transparent",transition:"background-color 0.2s ease",border:Z.isDraggingOver?"2px dashed #999":"none",borderRadius:"4px"},ref:E.innerRef,...E.droppableProps,children:[w.map((X,oe)=>e.jsx(_o,{draggableId:X,index:oe,isDragDisabled:o,children:(le,te)=>e.jsxs(c,{ref:le.innerRef,...le.draggableProps,className:"screenshot",sx:{transform:te.isDragging?"scale(1.05)":"none",boxShadow:te.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:X}),!o&&e.jsx(de,{...le.dragHandleProps,className:"action",style:{right:40,zIndex:10,color:"#fff"},children:e.jsx($t,{})}),!o&&e.jsx(de,{className:"action",onClick:()=>{a(ne=>{const ae=[...ne.blockletScreenshots];return ae.splice(oe,1),{...ne,blockletScreenshots:ae}})},children:e.jsx(lt,{})})]})},X)),E.placeholder,w.length<5&&e.jsx(c,{sx:{width:240,height:135,background:"#eee",cursor:o?"default":"pointer",color:"#999",mb:2},display:"flex",justifyContent:"center",alignItems:"center",fontSize:40,onClick:()=>{var X;G()&&((X=S.current)==null||X.open())},children:"+"})]})})})]}),_&&e.jsx(Pt,{errors:A,storeList:H}),e.jsxs(c,{display:"flex",mt:3,flexDirection:"row",flexWrap:"wrap",children:[e.jsxs(Ce,{direction:"column",spacing:1,sx:{mr:2,width:"160px"},children:[e.jsx(N,{variant:"subtitle1",sx:{fontWeight:"bold"},children:f("studio.video")}),e.jsxs(Ce,{direction:"column",alignItems:"flex-start",spacing:1,sx:{opacity:.8,fontSize:"12px"},children:[e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"text.secondary"},children:[f("studio.videoType"),":"," "]}),e.jsxs(c,{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(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"text.secondary"},children:[f("studio.count"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"secondary.main"},children:"1~3"})]})}),!o&&e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"text.secondary"},children:[f("studio.order"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"secondary.main"},children:f("studio.orderTip")})]})})]})]}),e.jsx($o,{onDragEnd:o?void 0:K,children:e.jsx(Po,{droppableId:"videos",direction:"horizontal",isDropDisabled:o,children:(E,Z)=>e.jsxs(c,{display:"flex",alignItems:"center",sx:{flex:1,flexWrap:"wrap",minHeight:160,background:Z.isDraggingOver?"#f5f5f5":"transparent",transition:"background-color 0.2s ease",border:Z.isDraggingOver?"2px dashed #999":"none",borderRadius:"4px"},ref:E.innerRef,...E.droppableProps,children:[i.blockletVideos.map((X,oe)=>e.jsx(_o,{draggableId:X,index:oe,isDragDisabled:o,children:(le,te)=>e.jsxs(c,{ref:le.innerRef,...le.draggableProps,className:"screenshot",sx:{transform:te.isDragging?"scale(1.05)":"none",boxShadow:te.isDragging?"0 5px 10px rgba(0,0,0,0.15)":"none",transition:"transform 0.2s ease, box-shadow 0.2s ease"},children:[e.jsx(xt,{url:X,style:{pointerEvents:te.isDragging?"none":"auto"}}),!o&&e.jsx(de,{...le.dragHandleProps,className:"action",style:{right:40,zIndex:10,color:"#fff"},children:e.jsx($t,{})}),!o&&e.jsx(de,{className:"action",onClick:()=>{a(ne=>{const ae=[...ne.blockletVideos];return ae.splice(oe,1),{...ne,blockletVideos:ae}})},children:e.jsx(lt,{})})]})},X)),E.placeholder,i.blockletVideos.length<3&&e.jsx(c,{sx:{width:240,height:135,background:"#eee",cursor:o?"default":"pointer",color:"#999",mb:2},display:"flex",justifyContent:"center",alignItems:"center",fontSize:40,onClick:()=>{G()&&B(!0)},children:"+"})]})})})]})]})}),e.jsxs(j.Suspense,{fallback:e.jsx(Ze,{}),children:[e.jsx(Oo,{ref:k,locale:y,popup:!0,onUploadFinish:E=>{var Z;a({blockletLogo:E.data.filename}),h(""),(Z=k.current)==null||Z.close()},plugins:["ImageEditor"],installerProps:{disabled:!0},apiPathProps:{uploader:I,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"),D&&e.jsx(Pn,{onClose:()=>B(!1),params:i,setParams:a}),e.jsx(Oo,{ref:S,locale:y,popup:!0,onUploadFinish:E=>{var Z;a(X=>{var le;const oe=X.blockletScreenshots||[];return oe.push((le=E.data)==null?void 0:le.filename),{...X,blockletScreenshots:oe}}),(Z=S.current)==null||Z.close()},installerProps:{disabled:!0},plugins:["ImageEditor"],apiPathProps:{uploader:q,disableMediaKitPrefix:!0,disableMediaKitStatus:!0},coreProps:{restrictions:{allowedFileTypes:["image/*","image/svg+xml"],maxFileSize:1024*1024*5,maxNumberOfFiles:5-w.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")]})]})}io.propTypes={projectId:s.string.isRequired,readOnly:s.bool.isRequired,params:s.object.isRequired,setParams:s.func.isRequired,paramsErrTip:s.object.isRequired,setParamsErrTip:s.func.isRequired,warning:s.object.isRequired,loading:s.bool.isRequired,blocklet:s.object.isRequired,setLoading:s.func.isRequired,initUrl:s.object,componentDid:s.string,initLogoUrl:s.string.isRequired,setInitLogoUrl:s.func.isRequired};io.defaultProps={initUrl:null,componentDid:""};const Fr=Re.div`
145
+ `;var no={},Lr=Ie;Object.defineProperty(no,"__esModule",{value:!0});var $t=no.default=void 0,qr=Lr($e()),Nr=e;$t=no.default=(0,qr.default)((0,Nr.jsx)("path",{d:"M11 18c0 1.1-.9 2-2 2s-2-.9-2-2 .9-2 2-2 2 .9 2 2m-2-8c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m0-6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m6 4c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2m0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2"}),"DragIndicator");const zo="lastWantToConnectStoreId";function Ar(t){var u,d;const[o,n]=j.useState(null),{session:r}=Fe(),i=j.useCallback(x=>{n(x),localStorage.setItem(zo,x==null?void 0:x.id)},[n]),a=j.useMemo(()=>{var h,m,f,y;const x=localStorage.getItem(zo),b=x?(((h=t==null?void 0:t.settings)==null?void 0:h.storeList)||[]).find(v=>v.id===x):null;if(b)return b;let p=(((m=t==null?void 0:t.settings)==null?void 0:m.storeList)||[]).find(v=>{var g;return!(v.id!==Y.BLOCKLET_STORE.id||v.scope&&v.scope!=="studio"&&v.scope!==((g=r==null?void 0:r.user)==null?void 0:g.did))});return p||(p=(y=(f=t==null?void 0:t.settings)==null?void 0:f.storeList)==null?void 0:y[0]),p},[(u=t==null?void 0:t.settings)==null?void 0:u.storeList,(d=r==null?void 0:r.user)==null?void 0:d.did]);return[o||a||{},i]}const Dt={};async function so(t,{interval:o=1e3,maxDuration:n=120*1e3,intervalFirst:r=4e3,timerKey:i=""}){Dt[i]&&clearTimeout(Dt[i]),await new Promise(u=>setTimeout(u,r));const a=Date.now(),l=async(u,d)=>{try{const x=await t();u(x)}catch(x){Date.now()-a>n?d(x):i?Dt[i]=setTimeout(()=>l(u,d),o):setTimeout(()=>l(u,d),o)}};return new Promise(l)}function zr(){return Math.random().toString(36).slice(2)+Math.random().toString(36).slice(2)+`${Date.now()}`.slice(-6)}function Or(t,{did:o,projectId:n,messageId:r}){return so(async()=>{var a;const i=await t.getProject({input:{did:o,projectId:n,messageId:r}});if(!((a=i==null?void 0:i.project)!=null&&a.blockletDid))throw new Error("Connected store not found");return i.project.blockletDid},{timerKey:"connect-studio"})}function Wr(t,{did:o,projectId:n,storeId:r}){return so(async()=>{var l,u;const i=await t.getProject({input:{did:o,projectId:n,messageId:""}});if(!((u=(l=i==null?void 0:i.project)==null?void 0:l.connectedStores)!=null&&u.length))throw new Error("Connected store not found");if(!i.project.connectedStores.find(d=>d.storeId===r))throw new Error("Connected store not found")},{timerKey:`connect-store-${r}`})}function Br(t,{did:o,projectId:n,endpointId:r}){return so(async()=>{var l,u;const i=await t.getProject({input:{did:o,projectId:n,messageId:""}});if(!((u=(l=i==null?void 0:i.project)==null?void 0:l.connectedEndpoints)!=null&&u.length))throw new Error("Connected endpoint not found");if(!i.project.connectedEndpoints.find(d=>d.endpointId===r))throw new Error("Connected endpoint not found")},{timerKey:`connect-store-${r}`})}const Mr=({fromBlocklet:t,nodeInfo:o,blocklet:n,userDid:r})=>{var l,u;const i=t?(l=n==null?void 0:n.meta)==null?void 0:l.did:o==null?void 0:o.did;let a=t?((u=n==null?void 0:n.settings)==null?void 0:u.storeList)||[]:(o==null?void 0:o.blockletRegistryList)||[];return Array.isArray(a)||(a=[]),a=a.filter(d=>d.protected||!d.scope||d.scope==="studio"||d.scope===r),{teamDid:i,storeList:a}},ro=Mr;function lo({blocklet:t,store:o={},onChangeStore:n,onClick:r,disabled:i,loading:a,componentDid:l}){var w,I,q;const{t:u}=Q(),{session:d}=Fe(),{api:x,info:b,inService:p}=ke(),h=Te(),[m,f]=j.useState(!1),y=j.useRef(null),[v,g]=j.useState(!1),[k,S]=j.useState(null),R=P=>{n(P),f(!1)},T=()=>{f(!m)},D=P=>{y.current&&y.current.contains(P.target)||f(!1)},B=()=>{g(!0)},$=()=>{g(!1)},z=async()=>{var P;if(k)try{await x.deleteBlockletStore({input:{teamDid:t.meta.did,url:k.url,projectId:"",scope:k.scope||"studio"}}),await((P=h==null?void 0:h.actions)==null?void 0:P.refreshBlocklet())}catch(A){M.error(`Remove Blocklet Store Error: ${je(A)}`)}finally{S(null)}},{storeList:J}=ro({fromBlocklet:p,blocklet:t,nodeInfo:b,componentDid:l,userDid:(w=d==null?void 0:d.user)==null?void 0:w.did}),U=(I=t==null?void 0:t.meta)==null?void 0:I.did;return e.jsxs(e.Fragment,{children:[e.jsxs(st,{disabled:i,ref:y,variant:"contained",color:"primary","aria-label":"Button group with connect store",children:[e.jsxs(ee,{onClick:r,children:[a&&e.jsx(Se,{size:14,sx:{mr:.5}}),`${u("common.connect")} ${o.name||""}`]}),e.jsx(ee,{size:"small","aria-controls":m?"split-button-menu":void 0,"aria-expanded":m?"true":void 0,"aria-label":"select merge strategy","aria-haspopup":"menu",onClick:T,children:e.jsx(Fs,{})})]}),e.jsx(Go,{sx:{zIndex:10},open:m,anchorEl:y.current,placement:"bottom-end",role:void 0,transition:!0,disablePortal:!0,children:({TransitionProps:P})=>e.jsx(Xo,{...P,style:{transformOrigin:"center top"},children:e.jsx(qt,{children:e.jsx(Yo,{onClickAway:D,children:e.jsxs(Zo,{id:"split-button-menu",autoFocusItem:!0,sx:{maxHeight:300,overflowY:"auto",zIndex:10},children:[J==null?void 0:J.map(A=>{var H;return e.jsxs(be,{selected:A.id===(o==null?void 0:o.id),sx:{height:56},onClick:()=>R(A),children:[e.jsxs(c,{children:[e.jsx(De,{sx:{fontSize:"16px"},maxLength:24,children:A.name}),e.jsx(De,{sx:{fontSize:"13px",opacity:.6},maxLength:30,children:A.url})]}),qs({store:A,userDid:(H=d==null?void 0:d.user)==null?void 0:H.did})&&e.jsx(de,{sx:{ml:1},onClick:C=>{C.preventDefault(),C.stopPropagation(),S(A)},children:e.jsx(ue,{icon:"ic:outline-delete"})})]},A.url)}),e.jsx(Zn,{}),e.jsxs(be,{onClick:B,children:[e.jsx(bt,{font:!0}),e.jsx(N,{variant:"inherit",children:u("store.blockletRegistry.addRegistry")})]})]})})})})}),v&&e.jsx(mn,{hiddenChildren:!0,open:!0,onClose:$,teamDid:U,storeList:J,scope:"studio",onAdd:(q=h==null?void 0:h.actions)==null?void 0:q.refreshBlocklet}),k&&e.jsx(mt,{displayError:!0,title:`${u("common.delete")} ${k.name}`,description:u("blocklet.publish.deleteStoreTip",{name:k.name}),confirm:u("common.confirm"),onConfirm:z,onCancel:()=>S(null)})]})}lo.propTypes={store:s.object,blocklet:s.object,onChangeStore:s.func.isRequired,onClick:s.func.isRequired,loading:s.bool.isRequired,disabled:s.bool.isRequired,componentDid:s.string.isRequired,projectType:s.string.isRequired,getData:s.func.isRequired};lo.defaultProps={store:null,blocklet:null};const Vr=(t,o,n)=>{const r=`${Y.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${o.meta.did}/${n}/logo/upload`,i=`${Y.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${o.meta.did}/${n}/screenshot/upload`,a=t!=null&&t.blockletLogo?`${r}/${t.blockletLogo}`:`${Y.WELLKNOWN_SERVICE_PATH_PREFIX}/static/images/logo.png`,l=((t==null?void 0:t.blockletScreenshots)||[]).filter(Boolean).map(u=>`${i}/${u}`);return{logoUrl:a,screenshotUrls:l,uploadLogoPrefix:r,uploadScreenshotPrefix:i}},$n=Vr,Ur=t=>{const o=t.includes("youtube.com")||t.includes("youtu.be"),n=t.includes("vimeo.com");return o||n};function xt({url:t,style:o,controls:n,modestbranding:r}){var u;const{t:i}=Q(),a=t.includes("youtube.com")||t.includes("youtu.be"),l=t.includes("vimeo.com");if(a){const d=((u=t.split("v=")[1])==null?void 0:u.split("&")[0])||t.split("/").pop();return e.jsx("div",{style:{position:"relative",width:"100%",paddingTop:"56.25%",pointerEvents:(o==null?void 0:o.pointerEvents)||"auto"},children:e.jsx("iframe",{src:`https://www.youtube.com/embed/${d}?modestbranding=${r}&controls=${n}&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(l){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(c,{style:{position:"relative",width:"100%",paddingTop:"56.25%"},children:e.jsxs(c,{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(ue,{icon:"carbon:video-off",style:{fontSize:40,marginBottom:"10px",opacity:.5}}),e.jsx(N,{variant:"body1",sx:{opacity:.5},children:i("studio.videoDialogNoSrc")})]})})}xt.propTypes={url:s.string.isRequired,style:s.object,controls:s.number,modestbranding:s.number};xt.defaultProps={style:{},controls:1,modestbranding:1};function Pn({setParams:t,onClose:o,params:n}){const{t:r}=Q(),[i,a]=j.useState(""),l=i&&n.blockletVideos.includes(i),u=Ur(i),d=()=>{t(x=>{const b=[...x.blockletVideos];return b.push(i),{...x,blockletVideos:b}}),o()};return e.jsxs(pt,{open:!0,fullWidth:!0,maxWidth:"sm",children:[e.jsx(Qo,{children:r("studio.videoDialogTitle")}),e.jsxs(Ko,{children:[e.jsx(Qn,{fullWidth:!0,value:i,onChange:x=>a(x.target.value),placeholder:r("studio.videoInputLabel"),endAdornment:i?e.jsx(Ye,{position:"end",children:e.jsx(de,{onClick:()=>a(""),children:e.jsx(ys,{})})}):null,error:l}),l&&e.jsx(N,{variant:"body2",color:"error",children:r("studio.duplicateVideo")}),e.jsx(xt,{url:i,style:{marginTop:"20px",borderRadius:"4px"}})]}),e.jsxs(en,{children:[e.jsx(ee,{onClick:()=>o(),children:r("studio.cancel")}),e.jsx(ee,{disabled:!u||l,onClick:d,children:r("studio.confirm")})]})]})}Pn.propTypes={onClose:s.func.isRequired,params:s.object.isRequired,setParams:s.func.isRequired};function Pt({errors:t,storeList:o,...n}){const{t:r}=Q();return e.jsxs(c,{...n,color:"warning.main",fontSize:"14px",sx:{border:"1px solid rgba(214, 164, 64, 0.34)",borderRadius:"4px",py:2,px:1.5,position:"relative"},children:[e.jsx(N,{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(([i,a])=>{const l=Object.values(a),u=o.find(d=>d.url===i);return l.length>0&&e.jsxs(c,{children:[e.jsx(ye,{title:i,children:e.jsx(c,{component:"span",sx:{cursor:"pointer"},children:u.name})}),l.map(d=>e.jsx(c,{component:"li",ml:2,sx:{wordBreak:!0},children:d},d))]},i)})]})}Pt.propTypes={errors:s.object.isRequired,storeList:s.array.isRequired};const Oo=j.lazy(()=>pn(()=>import("./index-8lA5-nM7.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13])).then(t=>({default:t.Uploader})));function io({projectId:t,readOnly:o,loading:n,blocklet:r,params:i,setParams:a,paramsErrTip:l,setParamsErrTip:u,warning:d,setLoading:x,initUrl:b,initLogoUrl:p,setInitLogoUrl:h,componentDid:m}){const{t:f,locale:y}=Q(),{api:v}=ke(),g=Et(),k=j.useRef(null),S=j.useRef(null),[R,T]=Ar(r),[D,B]=j.useState(!1),$=xn({messageType:"connect-store-message",onOpen:()=>x(!0),onClose:()=>x(!1)}),z=async E=>{const Z=setTimeout(()=>{x(!1)},2e4),X=await Or(v,E);x(!1),clearTimeout(Z),window.parent.postMessage({event:"studioDialog.connected",componentDid:m},"*"),g(window.location.pathname.replace(`${Y.UNOWNED_DID}/create`,`${X}/create`),{replace:!0})},J=()=>{if(!i.blockletTitle){M.error(f("blocklet.publish.errorTip.noTitle"));return}if(!(R!=null&&R.url)){M.error(f("blocklet.publish.noStoreSelected"));return}const E=zr();$(async(Z,X)=>{var oe,le,te;try{const ne=await v.connectByStudio({input:{did:(oe=r==null?void 0:r.meta)==null?void 0:oe.did,blockletTitle:i==null?void 0:i.blockletTitle,storeUrl:R.url,storeId:R.id,storeName:R.name,type:((le=i==null?void 0:i.blockletComponents)==null?void 0:le.length)>0?"pack":"resource",componentDid:m,messageId:E,tenantScope:(b==null?void 0:b.searchParams.get("tenantScope"))||""}});if(!(ne!=null&&ne.url)){M.error("failed to connect to store");return}X(ne.url),z({did:(te=r==null?void 0:r.meta)==null?void 0:te.did,projectId:"",messageId:E})}catch(ne){const ae=je(ne);M.error(ae),x(!1)}})},{logoUrl:U,screenshotUrls:w,uploadLogoPrefix:I,uploadScreenshotPrefix:q}=$n(i,r,t),{logoErrors:P,screenshotErrors:A,storeList:H,hasLogoWarning:C,hasScreenshotWarning:_}=d,G=()=>o?!1:!t||t===Y.UNOWNED_DID?(M.error(f("blocklet.publish.errorTip.noFirstDid")),!1):!0,F=E=>{if(!E.destination)return;const Z=Array.from(i.blockletScreenshots),[X]=Z.splice(E.source.index,1);Z.splice(E.destination.index,0,X),a(oe=>({...oe,blockletScreenshots:Z}))},K=E=>{if(!E.destination)return;const Z=Array.from(i.blockletVideos),[X]=Z.splice(E.source.index,1);Z.splice(E.destination.index,0,X),a(oe=>({...oe,blockletVideos:Z}))};return e.jsxs(Fr,{children:[e.jsx(c,{display:"flex",className:"section",children:e.jsxs(c,{sx:{flex:1},children:[e.jsx(re,{disabled:n||o,label:`Blocklet ${f("common.title")}`,placeholder:`Blocklet ${f("common.title")}`,InputProps:{"data-cy":"blocklet-title",readOnly:o},autoComplete:"off",variant:"outlined",fullWidth:!0,required:!0,value:i.blockletTitle||"",onChange:E=>{u({blockletTitle:""}),a({blockletTitle:E.target.value})},error:!!l.blockletTitle,helperText:l.blockletTitle||""}),e.jsx(re,{required:!0,label:"Blocklet DID",fullWidth:!0,readonly:!0,disabled:!0,autoComplete:"off",variant:"outlined",InputProps:{"data-cy":"export-blocklet-did",endAdornment:t===Y.UNOWNED_DID&&e.jsx(Ye,{position:"end",children:e.jsx(lo,{blocklet:r,store:R,componentDid:m,onChangeStore:T,disabled:!i.blockletTitle||o||n,loading:n,onClick:J})})},error:!!l.projectId,helperText:l.projectId||"",value:t===Y.UNOWNED_DID?"":`did:abt:${t}`,sx:{mt:3}}),e.jsx(re,{disabled:n||o,label:`Blocklet ${f("common.description")}`,placeholder:`Blocklet ${f("common.description")}`,InputProps:{"data-cy":"blocklet-description",readOnly:o},required:!0,autoComplete:"off",variant:"outlined",fullWidth:!0,value:i.blockletDescription||"",onChange:E=>{u({blockletDescription:""}),a({blockletDescription:E.target.value.slice(0,159)})},error:!!l.blockletDescription,helperText:l.blockletDescription||"",sx:{mt:3}}),e.jsx(re,{disabled:n||o,label:`Blocklet ${f("common.homepageTip")}`,placeholder:`Blocklet ${f("common.homepageTip")}`,InputProps:{"data-cy":"blocklet-homepage",readOnly:o},autoComplete:"off",variant:"outlined",fullWidth:!0,value:i.blockletHomepage||"",onChange:E=>{E.target.value&&!/^(http|https):\/\//.test(E.target.value)?u({blockletHomepage:f("blocklet.publish.errorTip.invalidUrl")}):u({blockletHomepage:""}),a({blockletHomepage:E.target.value})},error:!!l.blockletHomepage,helperText:l.blockletHomepage||"",sx:{mt:3}}),e.jsx(re,{disabled:n||o,label:`Blocklet ${f("common.community")}`,placeholder:`Blocklet ${f("common.community")}`,InputProps:{"data-cy":"blocklet-community",readOnly:o},autoComplete:"off",variant:"outlined",fullWidth:!0,value:i.blockletCommunity||"",onChange:E=>{E.target.value&&!/^(http|https):\/\//.test(E.target.value)?u({blockletCommunity:f("blocklet.publish.errorTip.invalidUrl")}):u({blockletCommunity:""}),a({blockletCommunity:E.target.value})},error:!!l.blockletCommunity,helperText:l.blockletCommunity||"",sx:{mt:3}}),e.jsx(re,{disabled:n||o,label:`Blocklet ${f("common.support")}`,placeholder:`Blocklet ${f("common.support")}`,InputProps:{"data-cy":"blocklet-support",readOnly:o},autoComplete:"off",variant:"outlined",fullWidth:!0,value:i.blockletSupport||"",onChange:E=>{E.target.value&&!/^(http|https):\/\//.test(E.target.value)&&!/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/.test(E.target.value)?u({blockletSupport:f("blocklet.publish.errorTip.invalidUrlOrEmail")}):u({blockletSupport:""}),a({blockletSupport:E.target.value})},error:!!l.blockletSupport,helperText:l.blockletSupport||"",sx:{mt:3}}),e.jsx(re,{disabled:n||o,label:`Blocklet ${f("common.repository")}`,placeholder:`Blocklet ${f("common.repository")}`,InputProps:{"data-cy":"blocklet-repository",readOnly:o},autoComplete:"off",variant:"outlined",fullWidth:!0,value:i.blockletRepository||"",onChange:E=>{E.target.value&&!/^(git|https|svn)/.test(E.target.value)?u({blockletRepository:f("blocklet.publish.errorTip.invalidUrl")}):u({blockletRepository:""}),a({blockletRepository:E.target.value})},error:!!l.blockletRepository,helperText:l.blockletRepository||"",sx:{mt:3}})]})}),e.jsx(c,{display:"flex",mt:3,className:"section full-width",children:e.jsxs(c,{flex:1,overflow:"hidden",children:[e.jsxs(c,{display:"flex",flexDirection:"row",flexWrap:"wrap",children:[e.jsxs(Ce,{direction:"column",spacing:1,sx:{mr:2,width:"160px"},children:[e.jsx(N,{variant:"subtitle1",sx:{fontWeight:"bold"},children:f("common.logo")}),e.jsxs(Ce,{direction:"column",alignItems:"flex-start",spacing:1,sx:{opacity:.8,fontSize:"12px"},children:[e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"text.secondary"},children:[f("studio.type"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"secondary.main"},children:"png, jpg, webp, svg"})]})}),e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"text.secondary"},children:[f("studio.ratio"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"secondary.main"},children:"256x256"})]})}),e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"text.secondary"},children:[f("studio.size"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"secondary.main"},children:"<500Kb"})]})})]})]}),e.jsx(c,{sx:{flex:1,cursor:o?"default":"pointer",display:"flex",alignItems:"flex-end"},children:e.jsx(Lt,{variant:"square",sx:{width:80,height:80},alt:"Blocklet Logo",src:p||U,onClick:()=>{var E;G()&&((E=k.current)==null||E.open())}})})]}),C&&e.jsx(Pt,{errors:P,storeList:H,mt:3}),e.jsxs(c,{display:"flex",mt:3,flexDirection:"row",flexWrap:"wrap",children:[e.jsxs(Ce,{direction:"column",spacing:1,sx:{mr:2,width:"160px"},children:[e.jsx(N,{variant:"subtitle1",sx:{fontWeight:"bold"},children:f("common.screenshot")}),e.jsxs(Ce,{direction:"column",alignItems:"flex-start",spacing:1,sx:{opacity:.8,fontSize:"12px"},children:[e.jsx(c,{sx:{border:"none"},variant:"outlined",size:"small",children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"text.secondary"},children:[f("studio.ratio"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"secondary.main"},children:"16 / 9"})]})}),e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"text.secondary"},children:[f("studio.count"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"secondary.main"},children:"1~5"})]})}),e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"text.secondary"},children:[f("studio.size"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"secondary.main"},children:"<5MB"})]})}),!o&&e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"text.secondary"},children:[f("studio.order"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"secondary.main"},children:f("studio.orderTip")})]})})]})]}),e.jsx($o,{onDragEnd:o?void 0:F,children:e.jsx(Po,{droppableId:"screenshots",direction:"horizontal",isDropDisabled:o,children:(E,Z)=>e.jsxs(c,{display:"flex",alignItems:"center",sx:{flex:1,flexWrap:"wrap",minHeight:160,background:Z.isDraggingOver?"grey.100":"transparent",transition:"background-color 0.2s ease",border:Z.isDraggingOver?"2px dashed #999":"none",borderRadius:"4px"},ref:E.innerRef,...E.droppableProps,children:[w.map((X,oe)=>e.jsx(_o,{draggableId:X,index:oe,isDragDisabled:o,children:(le,te)=>e.jsxs(c,{ref:le.innerRef,...le.draggableProps,className:"screenshot",sx:{transform:te.isDragging?"scale(1.05)":"none",boxShadow:te.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:X}),!o&&e.jsx(de,{...le.dragHandleProps,className:"action",style:{right:40,zIndex:10,color:"#fff"},children:e.jsx($t,{})}),!o&&e.jsx(de,{className:"action",onClick:()=>{a(ne=>{const ae=[...ne.blockletScreenshots];return ae.splice(oe,1),{...ne,blockletScreenshots:ae}})},children:e.jsx(lt,{})})]})},X)),E.placeholder,w.length<5&&e.jsx(c,{sx:{width:240,height:135,background:"#eee",cursor:o?"default":"pointer",color:"#999",mb:2},display:"flex",justifyContent:"center",alignItems:"center",fontSize:40,onClick:()=>{var X;G()&&((X=S.current)==null||X.open())},children:"+"})]})})})]}),_&&e.jsx(Pt,{errors:A,storeList:H}),e.jsxs(c,{display:"flex",mt:3,flexDirection:"row",flexWrap:"wrap",children:[e.jsxs(Ce,{direction:"column",spacing:1,sx:{mr:2,width:"160px"},children:[e.jsx(N,{variant:"subtitle1",sx:{fontWeight:"bold"},children:f("studio.video")}),e.jsxs(Ce,{direction:"column",alignItems:"flex-start",spacing:1,sx:{opacity:.8,fontSize:"12px"},children:[e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"text.secondary"},children:[f("studio.videoType"),":"," "]}),e.jsxs(c,{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(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"text.secondary"},children:[f("studio.count"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"secondary.main"},children:"1~3"})]})}),!o&&e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"text.secondary"},children:[f("studio.order"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"secondary.main"},children:f("studio.orderTip")})]})})]})]}),e.jsx($o,{onDragEnd:o?void 0:K,children:e.jsx(Po,{droppableId:"videos",direction:"horizontal",isDropDisabled:o,children:(E,Z)=>e.jsxs(c,{display:"flex",alignItems:"center",sx:{flex:1,flexWrap:"wrap",minHeight:160,background:Z.isDraggingOver?"#f5f5f5":"transparent",transition:"background-color 0.2s ease",border:Z.isDraggingOver?"2px dashed #999":"none",borderRadius:"4px"},ref:E.innerRef,...E.droppableProps,children:[i.blockletVideos.map((X,oe)=>e.jsx(_o,{draggableId:X,index:oe,isDragDisabled:o,children:(le,te)=>e.jsxs(c,{ref:le.innerRef,...le.draggableProps,className:"screenshot",sx:{transform:te.isDragging?"scale(1.05)":"none",boxShadow:te.isDragging?"0 5px 10px rgba(0,0,0,0.15)":"none",transition:"transform 0.2s ease, box-shadow 0.2s ease"},children:[e.jsx(xt,{url:X,style:{pointerEvents:te.isDragging?"none":"auto"}}),!o&&e.jsx(de,{...le.dragHandleProps,className:"action",style:{right:40,zIndex:10,color:"#fff"},children:e.jsx($t,{})}),!o&&e.jsx(de,{className:"action",onClick:()=>{a(ne=>{const ae=[...ne.blockletVideos];return ae.splice(oe,1),{...ne,blockletVideos:ae}})},children:e.jsx(lt,{})})]})},X)),E.placeholder,i.blockletVideos.length<3&&e.jsx(c,{sx:{width:240,height:135,background:"#eee",cursor:o?"default":"pointer",color:"#999",mb:2},display:"flex",justifyContent:"center",alignItems:"center",fontSize:40,onClick:()=>{G()&&B(!0)},children:"+"})]})})})]})]})}),e.jsxs(j.Suspense,{fallback:e.jsx(Ze,{}),children:[e.jsx(Oo,{ref:k,locale:y,popup:!0,onUploadFinish:E=>{var Z;a({blockletLogo:E.data.filename}),h(""),(Z=k.current)==null||Z.close()},plugins:["ImageEditor"],installerProps:{disabled:!0},apiPathProps:{uploader:I,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"),D&&e.jsx(Pn,{onClose:()=>B(!1),params:i,setParams:a}),e.jsx(Oo,{ref:S,locale:y,popup:!0,onUploadFinish:E=>{var Z;a(X=>{var le;const oe=X.blockletScreenshots||[];return oe.push((le=E.data)==null?void 0:le.filename),{...X,blockletScreenshots:oe}}),(Z=S.current)==null||Z.close()},installerProps:{disabled:!0},plugins:["ImageEditor"],apiPathProps:{uploader:q,disableMediaKitPrefix:!0,disableMediaKitStatus:!0},coreProps:{restrictions:{allowedFileTypes:["image/*","image/svg+xml"],maxFileSize:1024*1024*5,maxNumberOfFiles:5-w.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")]})]})}io.propTypes={projectId:s.string.isRequired,readOnly:s.bool.isRequired,params:s.object.isRequired,setParams:s.func.isRequired,paramsErrTip:s.object.isRequired,setParamsErrTip:s.func.isRequired,warning:s.object.isRequired,loading:s.bool.isRequired,blocklet:s.object.isRequired,setLoading:s.func.isRequired,initUrl:s.object,componentDid:s.string,initLogoUrl:s.string.isRequired,setInitLogoUrl:s.func.isRequired};io.defaultProps={initUrl:null,componentDid:""};const Fr=Re.div`
146
146
  margin-top: 24px;
147
147
  .screenshot {
148
148
  margin-bottom: 16px;
@@ -190,7 +190,7 @@ import{r as j,f as Et,l as ut,L as we,g as Hn,u as Jn,i as Gn,j as wt}from"./ven
190
190
  padding-bottom: 12px;
191
191
  border-bottom: ${({theme:t})=>`1px solid ${t.palette.divider}`};
192
192
  }
193
- `;function Nn({text:t}){const{palette:o}=rn();return t?e.jsx(Js,{style:{backgroundColor:o.background.default,color:o.text.primary},wrapperElement:{"data-color-mode":"light"},source:Cs.sanitize(t),rehypePlugins:[[Gs,{target:"_blank"}]]}):e.jsx(Ue,{Icon:Vt})}Nn.propTypes={text:s.string.isRequired};function An({params:t,setParams:o,paramsErrTip:n,loading:r,setParamsErrTip:i,readOnly:a}){var b;const{t:l}=Q(),[u,d]=j.useState(a?"preview":"write"),x=(p,h)=>{d(h)};return e.jsxs(c,{sx:{border:"1px solid transparent",borderRadius:2},children:[e.jsxs(c,{sx:{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center"},children:[e.jsx(N,{variant:"h6",fontWeight:"bold",sx:{},children:l("common.introduction")}),e.jsxs(ln,{value:u,onChange:x,"aria-label":"wrapped label tabs example",children:[e.jsx(rt,{value:"write",label:"Write"}),e.jsx(rt,{value:"preview",label:"Preview"})]})]}),e.jsx(c,{display:u==="write"?"block":"none",sx:{width:"100%",marginTop:3},children:e.jsx(re,{disabled:r||a,sx:{border:"none"},placeholder:`Blocklet ${l("common.introduction")}`,InputProps:{"data-cy":"export-blocklet-introduction",readOnly:a,endAdornment:e.jsxs(Ye,{position:"end",children:[((b=t==null?void 0:t.blockletIntroduction)==null?void 0:b.length)||0," / ",fe.PROJECT.MAX_INTRO_LENGTH]})},autoComplete:"off",variant:"outlined",fullWidth:!0,multiline:!0,minRows:4,value:t.blockletIntroduction||"",onChange:p=>{i({blockletIntroduction:""}),o({blockletIntroduction:p.target.value.slice(0,fe.PROJECT.MAX_INTRO_LENGTH)})},error:!!n.blockletIntroduction,helperText:n.blockletIntroduction||""})}),e.jsx(c,{display:u==="preview"?"block":"none",mt:3,children:e.jsx(Nn,{text:t.blockletIntroduction||""})})]})}An.propTypes={params:s.object.isRequired,setParams:s.func.isRequired,paramsErrTip:s.object.isRequired,setParamsErrTip:s.func.isRequired,readOnly:s.bool.isRequired,loading:s.bool.isRequired};var go={},nl=Ie;Object.defineProperty(go,"__esModule",{value:!0});var _t=go.default=void 0,sl=nl($e()),Mo=e;_t=go.default=(0,sl.default)([(0,Mo.jsx)("circle",{cx:"12",cy:"19",r:"2"},"0"),(0,Mo.jsx)("path",{d:"M10 3h4v12h-4z"},"1")],"PriorityHigh");function jo({step:t,ok:o,active:n,error:r,warning:i}){let a="grey.500",l=t+1;return o&&(l=e.jsx(jn,{sx:{fontSize:18,margin:0},color:"white"})),r||!o&&n>t?(a="error.main",l=e.jsx(_t,{sx:{fontSize:18,margin:0},color:"white"})):i?(a="warning.main",l=e.jsx(_t,{sx:{fontSize:18,margin:0},color:"white"})):n>=t&&(a="primary.main"),e.jsx(c,{width:24,height:24,bgcolor:a,borderRadius:"100%",color:"white",display:"flex",justifyContent:"center",fontWeight:"bold",fontSize:14,alignItems:"center",children:l})}jo.propTypes={step:s.number,ok:s.bool,active:s.number,error:s.string,warning:s.bool};jo.defaultProps={step:0,ok:!1,active:0,error:"",warning:!1};function ko({steps:t,activeStep:o,setActiveStep:n,hasSelectedResources:r,params:i,loading:a,paramsErrTip:l,warning:u,viewMode:d,projectId:x}){const{t:b}=Q(),p=()=>{n(y=>y+1)},h=()=>{n(y=>y-1)},m=y=>y===0?(l==null?void 0:l.blockletTitle)||(l==null?void 0:l.projectId)||(l==null?void 0:l.blockletDescription)||(l==null?void 0:l.blockletHomepage)||(l==null?void 0:l.blockletSupport)||(l==null?void 0:l.blockletCommunity)||(l==null?void 0:l.blockletRepository):y===2?(l==null?void 0:l.blockletResource)||(l==null?void 0:l.blockletDocker)||(l==null?void 0:l.dockerImageName):y>=4?(l==null?void 0:l.blockletVersion)||(l==null?void 0:l.note):"",f=d||En({hasSelectedResources:r,params:i,projectId:x,t:b})===null;return e.jsxs(c,{sx:{width:300,maxWidth:300,minWidth:300,padding:2,border:"1px solid",borderColor:"divider",borderRadius:1},children:[e.jsx(ns,{activeStep:o,orientation:"vertical",children:t.map((y,v)=>{const g={},k=a||!Kr({hasSelectedResources:r,params:i,projectId:x,step:v,t:b}),S=a?"":m(v);return S&&(g.optional=e.jsx(N,{variant:"caption",color:"error",sx:{wordBreak:"break-word"},children:S}),g.error=!0),e.jsxs(ss,{children:[e.jsx(rs,{icon:e.jsx(jo,{error:S,warning:v===0?u.hasWarning:!1,active:f?99:o,step:v,ok:k}),sx:{cursor:"pointer",color:S?"error.main":"inherit"},disabled:!1,onClick:()=>n(v),...g,children:e.jsx(N,{fontSize:"14px",fontWeight:"500",color:S||!k&&o>v?"error.main":"inherit",children:y.label})}),e.jsxs(ls,{children:[e.jsx(N,{fontSize:12,children:y.description}),!f&&e.jsx(c,{sx:{mb:2},children:e.jsxs("div",{children:[v<t.length-1&&e.jsx(ee,{variant:"contained",onClick:p,sx:{mt:1,mr:1},disabled:S||!k,children:b("common.continue")}),v>0&&e.jsx(ee,{disabled:v===0,onClick:h,sx:{mt:1,mr:1},children:b("common.back")})]})})]})]},y.label)})}),o>=t.length-1&&e.jsx(qt,{square:!0,elevation:0,sx:{p:3},children:e.jsx(N,{fontSize:12,sx:{opacity:.5},children:"Click right top button to release"})})]})}ko.propTypes={steps:s.array.isRequired,activeStep:s.number.isRequired,setActiveStep:s.func.isRequired,params:s.object.isRequired,viewMode:s.oneOfType([s.string,s.bool]),loading:s.bool.isRequired,projectId:s.string.isRequired,hasSelectedResources:s.oneOfType([s.string,s.bool]),warning:s.object.isRequired,paramsErrTip:s.shape({projectId:s.string,blockletVersion:s.string,blockletTitle:s.string,blockletDescription:s.string,note:s.string,blockletResource:s.string,blockletHomepage:s.string,blockletSupport:s.string,blockletCommunity:s.string,blockletRepository:s.string,blockletDocker:s.object,dockerImageName:s.string}).isRequired};ko.defaultProps={hasSelectedResources:!1,viewMode:""};const rl=[".zip",".gz"],ll=1024*1024*100,il=j.lazy(()=>pn(()=>import("./index-BGbF_TCU.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13])).then(t=>({default:t.Uploader})));function yo({app:t,projectId:o,readOnly:n,params:r,setParams:i,setParamsErrTip:a,error:l}){const{t:u,locale:d}=Q(),x=j.useRef(null),b=()=>n?!1:!o||o===Y.UNOWNED_DID?(M.error(u("blocklet.publish.errorTip.noFirstDid")),!1):!0,p=`${Y.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${t.meta.did}/${o}/resource/upload`;return e.jsxs(c,{sx:{mt:3},children:[e.jsx(N,{gutterBottom:!0,children:u("blocklet.publish.resourceUpload")}),e.jsxs(Ce,{direction:"row",alignItems:"center",spacing:1,sx:{flex:1,cursor:n?"default":"pointer"},children:[!!r.uploadedResource&&e.jsx(N,{component:"a",href:`${p}/params.uploadedResource`,children:r.uploadedResource}),!n&&e.jsx(ee,{variant:"outlined",size:"small",onClick:()=>{var h;b()&&((h=x.current)==null||h.open())},children:r.uploadedResource?u("common.change"):u("common.upload")})]}),e.jsx(j.Suspense,{fallback:e.jsx(Ze,{}),children:e.jsx(il,{ref:x,locale:d,popup:!0,onUploadFinish:h=>{var m;i({uploadedResource:h.data.filename}),a({blockletResource:""}),(m=x.current)==null||m.close()},plugins:["ImageEditor"],installerProps:{disabled:!0},apiPathProps:{uploader:p,disableMediaKitPrefix:!0,disableMediaKitStatus:!0},coreProps:{restrictions:{allowedFileExts:rl,maxFileSize:ll,maxNumberOfFiles:1}}},"uploader-resource")}),!!l&&e.jsx(c,{color:"error.main",mt:1,fontSize:14,children:l})]})}yo.propTypes={app:s.object.isRequired,projectId:s.string.isRequired,readOnly:s.bool.isRequired,params:s.object.isRequired,setParams:s.func.isRequired,error:s.string.isRequired,setParamsErrTip:s.func.isRequired};yo.defaultProps={};function at({readOnly:t,params:o,setParams:n,paramsErrTip:r,setParamsErrTip:i,loading:a}){var u;const{t:l}=Q();return e.jsx(c,{display:"flex",mt:3,className:"section",children:e.jsxs(c,{sx:{flex:1},children:[e.jsx(re,{required:!0,disabled:a||t,label:`Blocklet ${l("common.version")}`,placeholder:`Blocklet ${l("common.version")}`,InputProps:{"data-cy":"blocklet-version",readOnly:t},autoComplete:"off",variant:"outlined",fullWidth:!0,value:o.blockletVersion||"",onChange:d=>{i({blockletVersion:""}),n({blockletVersion:d.target.value})},error:!!r.blockletVersion,helperText:r.blockletVersion||""}),e.jsx(re,{label:l("blocklet.publish.releaseNote"),autoComplete:"off",disabled:a||t,variant:"outlined",InputProps:{"data-cy":"release-note",readOnly:t,endAdornment:e.jsxs(Ye,{position:"end",children:[((u=o==null?void 0:o.note)==null?void 0:u.length)||0," / ",fe.PROJECT.MAX_NOTE_LENGTH]})},fullWidth:!0,multiline:!0,minRows:4,required:!0,value:o.note||"",onChange:d=>{i({note:""}),n({note:d.target.value.slice(0,fe.PROJECT.MAX_NOTE_LENGTH)})},error:!!r.note,helperText:r.note||"",sx:{mt:3}})]})})}at.propTypes={readOnly:s.bool.isRequired,params:s.object.isRequired,setParams:s.func.isRequired,paramsErrTip:s.object.isRequired,setParamsErrTip:s.func.isRequired,loading:s.bool.isRequired};at.defaultProps={};function zn(t){for(const o in t)typeof t[o]=="string"?t[o]=t[o].replace(/\\\\/g,"\\"):typeof t[o]=="object"&&t[o]!==null&&zn(t[o]);return t}function dt({index:t,item:o,dockerParams:n,setDockerParams:r,dataKey:i,t:a,readOnly:l}){const u=(o==null?void 0:o.value)||"",[d,x]=j.useState(!1),b=()=>{var U;(U=n[i])==null||U.splice(t,1),r({...n,[i]:[...n[i]]})},p=(U,w)=>{var I;(I=n[i])!=null&&I[t]&&(w?(n[i][t].custom=n[i][t].value,n[i][t].value=`$${Ct(o.key)}`):(n[i][t].value=n[i][t].custom||"",n[i][t].custom="")),r({...n,[i]:[...n[i]]})},h=(U,w)=>{var q;const I=((q=n[i][t])==null?void 0:q.value)||"";n[i][t]={...n[i][t],secure:w,value:w&&I===fe.BLOCKLET_AUTOMATIC_ENV_VALUE?"":I},r({...n,[i]:[...n[i]]})},m=(U,w)=>{n[i][t]={...n[i][t],shared:w},r({...n,[i]:[...n[i]]})},f=(U,w)=>{var q;const I=((q=n[i][t])==null?void 0:q.value)||"";n[i][t]={...n[i][t],required:w,value:w&&I===fe.BLOCKLET_AUTOMATIC_ENV_VALUE?"":I},r({...n,[i]:[...n[i]]})},y=(U,w)=>{n[i][t]={...n[i][t],value:w?fe.BLOCKLET_AUTOMATIC_ENV_VALUE:"",secure:!1,required:!1},r({...n,[i]:[...n[i]]})},v=U=>{n[i][t]={...n[i][t],description:U.target.value},r({...n,[i]:[...n[i]]})},g=U=>{const w=U.target.value==="web"?"web":"docker";w==="web"&&n.dockerArgs.forEach(P=>{P.type="docker"});const q=`/${n.dockerImage.replace(/\W/g,"-")}-${t}`;n.dockerArgs[t]={...n.dockerArgs[t],type:w,path:w==="docker"?q:"/",protocol:"http",prefix:w==="docker"?q:"/",name:"publicUrl",port:"BLOCKLET_PORT"},r({...n,dockerArgs:[...n.dockerArgs]})},k=U=>{n.dockerArgs[t]={...n.dockerArgs[t],proxyBehavior:U.target.value==="direct"?"direct":"service"},r({...n,dockerArgs:[...n.dockerArgs]})},S=U=>{const w=U.target.value;n[i][t]={...n[i][t],prefix:w,path:w==="*"?"/":w},r({...n,[i]:[...n[i]]})},R=U=>{var w;(w=n[i])!=null&&w[t]&&(n[i][t].value=U.target.value),r({...n,[i]:[...n[i]]})},T=u===`$${Ct(o.key)}`||o.custom,D=i==="dockerArgs"&&!gn[o.key],B=Bs[o.key],$=i==="dockerEnvs",z=o.key==="--publish";let J=o.key;return z&&o.type==="web"?J="--publish (Web)":$&&(J=`--env ${o.key}`),e.jsxs(c,{sx:{display:"flex",flexDirection:"row",gap:2,alignItems:"center"},children:[e.jsx(c,{sx:{width:250},children:e.jsx(N,{sx:{textOverflow:"ellipsis",width:"100%",overflow:"hidden"},children:J})}),e.jsxs(c,{sx:{display:"flex",flexDirection:"column",gap:1,flex:1},children:[e.jsx(re,{disabled:l||T||D||o.value===fe.BLOCKLET_AUTOMATIC_ENV_VALUE,placeholder:"",value:T?`$${Ct(o.key)}`:u,sx:{flex:1},InputProps:{endAdornment:e.jsxs(Ye,{position:"end",sx:{zoom:.9},children:[(!(B||D)||$||z)&&e.jsx(de,{onClick:()=>x(!0),children:e.jsx(ue,{icon:"icon-park-outline:setting-config"})}),!l&&e.jsx(de,{onClick:b,color:D?"error":"default",children:e.jsx(ue,{icon:"ic:round-delete"})})]})},error:D,onChange:R}),D&&e.jsx(N,{variant:"caption",color:"error",children:a("blocklet.publish.docker.noAllowTheArg")}),o.key==="--publish"&&e.jsx(N,{variant:"caption",color:"text.secondary",children:a("blocklet.publish.docker.publishTips")}),o.key==="--volume"&&Ms[o.key](u)&&e.jsx(N,{variant:"caption",color:"error",children:a("blocklet.publish.docker.volumeTips")})]}),d&&e.jsx(ft,{open:!0,fullWidth:!0,maxWidth:"sm",PaperProps:{style:{minHeight:0}},title:a($?"blocklet.publish.docker.modifyEnv":"blocklet.publish.docker.modifyParam"),onClose:()=>x(!1),children:e.jsxs(c,{sx:{display:"flex",flexDirection:"column",gap:1,paddingBottom:2},children:[B||D||$?null:e.jsxs(c,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(N,{children:a("blocklet.publish.docker.needCustomInput")}),e.jsx(Ee,{disabled:l,checked:T,onChange:p,sx:{zoom:.9}})]}),$&&e.jsxs(c,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(N,{children:a("blocklet.publish.docker.shared")}),e.jsx(Ee,{disabled:l,checked:o.shared,onChange:m,sx:{zoom:.9}})]}),$&&e.jsxs(c,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(N,{children:a("blocklet.publish.docker.required")}),e.jsx(Ee,{disabled:l,checked:o.required,onChange:f,sx:{zoom:.9}})]}),$&&e.jsxs(c,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(N,{children:a("blocklet.publish.docker.secure")}),e.jsx(Ee,{disabled:l,checked:o.secure,onChange:h,sx:{zoom:.9}})]}),$&&e.jsxs(c,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(N,{children:a("blocklet.publish.docker.autoGenerated")}),e.jsx(Ee,{disabled:l,checked:o.value===fe.BLOCKLET_AUTOMATIC_ENV_VALUE,onChange:y,sx:{zoom:.9}})]}),$&&e.jsxs(c,{sx:{mt:1,width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(N,{sx:{flex:1},children:a("blocklet.publish.docker.description")}),e.jsx(re,{disabled:l,value:o.description,onChange:v,sx:{flex:1},label:a("blocklet.publish.docker.description")})]}),z&&e.jsxs(c,{sx:{mt:1,width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(N,{sx:{flex:1},children:a("blocklet.publish.docker.portType")}),e.jsxs(It,{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(c,{sx:{mt:1,width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(N,{sx:{flex:1},children:a("blocklet.publish.docker.proxyBehavior")}),e.jsxs(It,{value:o.proxyBehavior||"service",onChange:k,children:[e.jsx(be,{value:"service",children:a("blocklet.publish.docker.serviceProxy")}),e.jsx(be,{value:"direct",children:a("blocklet.publish.docker.directProxy")})]})]}),z&&o.type==="web"&&e.jsxs(c,{sx:{mt:1,width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(N,{sx:{flex:1},children:a("blocklet.publish.docker.prefix")}),e.jsx(re,{disabled:l,value:o.prefix,onChange:S,sx:{flex:1},label:a("blocklet.publish.docker.prefix")})]})]})})]})}dt.propTypes={dockerParams:s.object.isRequired,setDockerParams:s.func.isRequired,dataKey:s.string.isRequired,item:s.object.isRequired,t:s.func.isRequired,readOnly:s.bool.isRequired,index:s.number.isRequired};dt.defaultProps={};const cl=`
193
+ `;function Nn({text:t}){const{palette:o}=rn();return t?e.jsx(Js,{style:{backgroundColor:o.background.default,color:o.text.primary},wrapperElement:{"data-color-mode":"light"},source:Cs.sanitize(t),rehypePlugins:[[Gs,{target:"_blank"}]]}):e.jsx(Ue,{Icon:Vt})}Nn.propTypes={text:s.string.isRequired};function An({params:t,setParams:o,paramsErrTip:n,loading:r,setParamsErrTip:i,readOnly:a}){var b;const{t:l}=Q(),[u,d]=j.useState(a?"preview":"write"),x=(p,h)=>{d(h)};return e.jsxs(c,{sx:{border:"1px solid transparent",borderRadius:2},children:[e.jsxs(c,{sx:{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center"},children:[e.jsx(N,{variant:"h6",fontWeight:"bold",sx:{},children:l("common.introduction")}),e.jsxs(ln,{value:u,onChange:x,"aria-label":"wrapped label tabs example",children:[e.jsx(rt,{value:"write",label:"Write"}),e.jsx(rt,{value:"preview",label:"Preview"})]})]}),e.jsx(c,{display:u==="write"?"block":"none",sx:{width:"100%",marginTop:3},children:e.jsx(re,{disabled:r||a,sx:{border:"none"},placeholder:`Blocklet ${l("common.introduction")}`,InputProps:{"data-cy":"export-blocklet-introduction",readOnly:a,endAdornment:e.jsxs(Ye,{position:"end",children:[((b=t==null?void 0:t.blockletIntroduction)==null?void 0:b.length)||0," / ",fe.PROJECT.MAX_INTRO_LENGTH]})},autoComplete:"off",variant:"outlined",fullWidth:!0,multiline:!0,minRows:4,value:t.blockletIntroduction||"",onChange:p=>{i({blockletIntroduction:""}),o({blockletIntroduction:p.target.value.slice(0,fe.PROJECT.MAX_INTRO_LENGTH)})},error:!!n.blockletIntroduction,helperText:n.blockletIntroduction||""})}),e.jsx(c,{display:u==="preview"?"block":"none",mt:3,children:e.jsx(Nn,{text:t.blockletIntroduction||""})})]})}An.propTypes={params:s.object.isRequired,setParams:s.func.isRequired,paramsErrTip:s.object.isRequired,setParamsErrTip:s.func.isRequired,readOnly:s.bool.isRequired,loading:s.bool.isRequired};var go={},nl=Ie;Object.defineProperty(go,"__esModule",{value:!0});var _t=go.default=void 0,sl=nl($e()),Mo=e;_t=go.default=(0,sl.default)([(0,Mo.jsx)("circle",{cx:"12",cy:"19",r:"2"},"0"),(0,Mo.jsx)("path",{d:"M10 3h4v12h-4z"},"1")],"PriorityHigh");function jo({step:t,ok:o,active:n,error:r,warning:i}){let a="grey.500",l=t+1;return o&&(l=e.jsx(jn,{sx:{fontSize:18,margin:0},color:"white"})),r||!o&&n>t?(a="error.main",l=e.jsx(_t,{sx:{fontSize:18,margin:0},color:"white"})):i?(a="warning.main",l=e.jsx(_t,{sx:{fontSize:18,margin:0},color:"white"})):n>=t&&(a="primary.main"),e.jsx(c,{width:24,height:24,bgcolor:a,borderRadius:"100%",color:"white",display:"flex",justifyContent:"center",fontWeight:"bold",fontSize:14,alignItems:"center",children:l})}jo.propTypes={step:s.number,ok:s.bool,active:s.number,error:s.string,warning:s.bool};jo.defaultProps={step:0,ok:!1,active:0,error:"",warning:!1};function ko({steps:t,activeStep:o,setActiveStep:n,hasSelectedResources:r,params:i,loading:a,paramsErrTip:l,warning:u,viewMode:d,projectId:x}){const{t:b}=Q(),p=()=>{n(y=>y+1)},h=()=>{n(y=>y-1)},m=y=>y===0?(l==null?void 0:l.blockletTitle)||(l==null?void 0:l.projectId)||(l==null?void 0:l.blockletDescription)||(l==null?void 0:l.blockletHomepage)||(l==null?void 0:l.blockletSupport)||(l==null?void 0:l.blockletCommunity)||(l==null?void 0:l.blockletRepository):y===2?(l==null?void 0:l.blockletResource)||(l==null?void 0:l.blockletDocker)||(l==null?void 0:l.dockerImageName):y>=4?(l==null?void 0:l.blockletVersion)||(l==null?void 0:l.note):"",f=d||En({hasSelectedResources:r,params:i,projectId:x,t:b})===null;return e.jsxs(c,{sx:{width:300,maxWidth:300,minWidth:300,padding:2,border:"1px solid",borderColor:"divider",borderRadius:1},children:[e.jsx(ns,{activeStep:o,orientation:"vertical",children:t.map((y,v)=>{const g={},k=a||!Kr({hasSelectedResources:r,params:i,projectId:x,step:v,t:b}),S=a?"":m(v);return S&&(g.optional=e.jsx(N,{variant:"caption",color:"error",sx:{wordBreak:"break-word"},children:S}),g.error=!0),e.jsxs(ss,{children:[e.jsx(rs,{icon:e.jsx(jo,{error:S,warning:v===0?u.hasWarning:!1,active:f?99:o,step:v,ok:k}),sx:{cursor:"pointer",color:S?"error.main":"inherit"},disabled:!1,onClick:()=>n(v),...g,children:e.jsx(N,{fontSize:"14px",fontWeight:"500",color:S||!k&&o>v?"error.main":"inherit",children:y.label})}),e.jsxs(ls,{children:[e.jsx(N,{fontSize:12,children:y.description}),!f&&e.jsx(c,{sx:{mb:2},children:e.jsxs("div",{children:[v<t.length-1&&e.jsx(ee,{variant:"contained",onClick:p,sx:{mt:1,mr:1},disabled:S||!k,children:b("common.continue")}),v>0&&e.jsx(ee,{disabled:v===0,onClick:h,sx:{mt:1,mr:1},children:b("common.back")})]})})]})]},y.label)})}),o>=t.length-1&&e.jsx(qt,{square:!0,elevation:0,sx:{p:3},children:e.jsx(N,{fontSize:12,sx:{opacity:.5},children:"Click right top button to release"})})]})}ko.propTypes={steps:s.array.isRequired,activeStep:s.number.isRequired,setActiveStep:s.func.isRequired,params:s.object.isRequired,viewMode:s.oneOfType([s.string,s.bool]),loading:s.bool.isRequired,projectId:s.string.isRequired,hasSelectedResources:s.oneOfType([s.string,s.bool]),warning:s.object.isRequired,paramsErrTip:s.shape({projectId:s.string,blockletVersion:s.string,blockletTitle:s.string,blockletDescription:s.string,note:s.string,blockletResource:s.string,blockletHomepage:s.string,blockletSupport:s.string,blockletCommunity:s.string,blockletRepository:s.string,blockletDocker:s.object,dockerImageName:s.string}).isRequired};ko.defaultProps={hasSelectedResources:!1,viewMode:""};const rl=[".zip",".gz"],ll=1024*1024*100,il=j.lazy(()=>pn(()=>import("./index-8lA5-nM7.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13])).then(t=>({default:t.Uploader})));function yo({app:t,projectId:o,readOnly:n,params:r,setParams:i,setParamsErrTip:a,error:l}){const{t:u,locale:d}=Q(),x=j.useRef(null),b=()=>n?!1:!o||o===Y.UNOWNED_DID?(M.error(u("blocklet.publish.errorTip.noFirstDid")),!1):!0,p=`${Y.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${t.meta.did}/${o}/resource/upload`;return e.jsxs(c,{sx:{mt:3},children:[e.jsx(N,{gutterBottom:!0,children:u("blocklet.publish.resourceUpload")}),e.jsxs(Ce,{direction:"row",alignItems:"center",spacing:1,sx:{flex:1,cursor:n?"default":"pointer"},children:[!!r.uploadedResource&&e.jsx(N,{component:"a",href:`${p}/params.uploadedResource`,children:r.uploadedResource}),!n&&e.jsx(ee,{variant:"outlined",size:"small",onClick:()=>{var h;b()&&((h=x.current)==null||h.open())},children:r.uploadedResource?u("common.change"):u("common.upload")})]}),e.jsx(j.Suspense,{fallback:e.jsx(Ze,{}),children:e.jsx(il,{ref:x,locale:d,popup:!0,onUploadFinish:h=>{var m;i({uploadedResource:h.data.filename}),a({blockletResource:""}),(m=x.current)==null||m.close()},plugins:["ImageEditor"],installerProps:{disabled:!0},apiPathProps:{uploader:p,disableMediaKitPrefix:!0,disableMediaKitStatus:!0},coreProps:{restrictions:{allowedFileExts:rl,maxFileSize:ll,maxNumberOfFiles:1}}},"uploader-resource")}),!!l&&e.jsx(c,{color:"error.main",mt:1,fontSize:14,children:l})]})}yo.propTypes={app:s.object.isRequired,projectId:s.string.isRequired,readOnly:s.bool.isRequired,params:s.object.isRequired,setParams:s.func.isRequired,error:s.string.isRequired,setParamsErrTip:s.func.isRequired};yo.defaultProps={};function at({readOnly:t,params:o,setParams:n,paramsErrTip:r,setParamsErrTip:i,loading:a}){var u;const{t:l}=Q();return e.jsx(c,{display:"flex",mt:3,className:"section",children:e.jsxs(c,{sx:{flex:1},children:[e.jsx(re,{required:!0,disabled:a||t,label:`Blocklet ${l("common.version")}`,placeholder:`Blocklet ${l("common.version")}`,InputProps:{"data-cy":"blocklet-version",readOnly:t},autoComplete:"off",variant:"outlined",fullWidth:!0,value:o.blockletVersion||"",onChange:d=>{i({blockletVersion:""}),n({blockletVersion:d.target.value})},error:!!r.blockletVersion,helperText:r.blockletVersion||""}),e.jsx(re,{label:l("blocklet.publish.releaseNote"),autoComplete:"off",disabled:a||t,variant:"outlined",InputProps:{"data-cy":"release-note",readOnly:t,endAdornment:e.jsxs(Ye,{position:"end",children:[((u=o==null?void 0:o.note)==null?void 0:u.length)||0," / ",fe.PROJECT.MAX_NOTE_LENGTH]})},fullWidth:!0,multiline:!0,minRows:4,required:!0,value:o.note||"",onChange:d=>{i({note:""}),n({note:d.target.value.slice(0,fe.PROJECT.MAX_NOTE_LENGTH)})},error:!!r.note,helperText:r.note||"",sx:{mt:3}})]})})}at.propTypes={readOnly:s.bool.isRequired,params:s.object.isRequired,setParams:s.func.isRequired,paramsErrTip:s.object.isRequired,setParamsErrTip:s.func.isRequired,loading:s.bool.isRequired};at.defaultProps={};function zn(t){for(const o in t)typeof t[o]=="string"?t[o]=t[o].replace(/\\\\/g,"\\"):typeof t[o]=="object"&&t[o]!==null&&zn(t[o]);return t}function dt({index:t,item:o,dockerParams:n,setDockerParams:r,dataKey:i,t:a,readOnly:l}){const u=(o==null?void 0:o.value)||"",[d,x]=j.useState(!1),b=()=>{var U;(U=n[i])==null||U.splice(t,1),r({...n,[i]:[...n[i]]})},p=(U,w)=>{var I;(I=n[i])!=null&&I[t]&&(w?(n[i][t].custom=n[i][t].value,n[i][t].value=`$${Ct(o.key)}`):(n[i][t].value=n[i][t].custom||"",n[i][t].custom="")),r({...n,[i]:[...n[i]]})},h=(U,w)=>{var q;const I=((q=n[i][t])==null?void 0:q.value)||"";n[i][t]={...n[i][t],secure:w,value:w&&I===fe.BLOCKLET_AUTOMATIC_ENV_VALUE?"":I},r({...n,[i]:[...n[i]]})},m=(U,w)=>{n[i][t]={...n[i][t],shared:w},r({...n,[i]:[...n[i]]})},f=(U,w)=>{var q;const I=((q=n[i][t])==null?void 0:q.value)||"";n[i][t]={...n[i][t],required:w,value:w&&I===fe.BLOCKLET_AUTOMATIC_ENV_VALUE?"":I},r({...n,[i]:[...n[i]]})},y=(U,w)=>{n[i][t]={...n[i][t],value:w?fe.BLOCKLET_AUTOMATIC_ENV_VALUE:"",secure:!1,required:!1},r({...n,[i]:[...n[i]]})},v=U=>{n[i][t]={...n[i][t],description:U.target.value},r({...n,[i]:[...n[i]]})},g=U=>{const w=U.target.value==="web"?"web":"docker";w==="web"&&n.dockerArgs.forEach(P=>{P.type="docker"});const q=`/${n.dockerImage.replace(/\W/g,"-")}-${t}`;n.dockerArgs[t]={...n.dockerArgs[t],type:w,path:w==="docker"?q:"/",protocol:"http",prefix:w==="docker"?q:"/",name:"publicUrl",port:"BLOCKLET_PORT"},r({...n,dockerArgs:[...n.dockerArgs]})},k=U=>{n.dockerArgs[t]={...n.dockerArgs[t],proxyBehavior:U.target.value==="direct"?"direct":"service"},r({...n,dockerArgs:[...n.dockerArgs]})},S=U=>{const w=U.target.value;n[i][t]={...n[i][t],prefix:w,path:w==="*"?"/":w},r({...n,[i]:[...n[i]]})},R=U=>{var w;(w=n[i])!=null&&w[t]&&(n[i][t].value=U.target.value),r({...n,[i]:[...n[i]]})},T=u===`$${Ct(o.key)}`||o.custom,D=i==="dockerArgs"&&!gn[o.key],B=Bs[o.key],$=i==="dockerEnvs",z=o.key==="--publish";let J=o.key;return z&&o.type==="web"?J="--publish (Web)":$&&(J=`--env ${o.key}`),e.jsxs(c,{sx:{display:"flex",flexDirection:"row",gap:2,alignItems:"center"},children:[e.jsx(c,{sx:{width:250},children:e.jsx(N,{sx:{textOverflow:"ellipsis",width:"100%",overflow:"hidden"},children:J})}),e.jsxs(c,{sx:{display:"flex",flexDirection:"column",gap:1,flex:1},children:[e.jsx(re,{disabled:l||T||D||o.value===fe.BLOCKLET_AUTOMATIC_ENV_VALUE,placeholder:"",value:T?`$${Ct(o.key)}`:u,sx:{flex:1},InputProps:{endAdornment:e.jsxs(Ye,{position:"end",sx:{zoom:.9},children:[(!(B||D)||$||z)&&e.jsx(de,{onClick:()=>x(!0),children:e.jsx(ue,{icon:"icon-park-outline:setting-config"})}),!l&&e.jsx(de,{onClick:b,color:D?"error":"default",children:e.jsx(ue,{icon:"ic:round-delete"})})]})},error:D,onChange:R}),D&&e.jsx(N,{variant:"caption",color:"error",children:a("blocklet.publish.docker.noAllowTheArg")}),o.key==="--publish"&&e.jsx(N,{variant:"caption",color:"text.secondary",children:a("blocklet.publish.docker.publishTips")}),o.key==="--volume"&&Ms[o.key](u)&&e.jsx(N,{variant:"caption",color:"error",children:a("blocklet.publish.docker.volumeTips")})]}),d&&e.jsx(ft,{open:!0,fullWidth:!0,maxWidth:"sm",PaperProps:{style:{minHeight:0}},title:a($?"blocklet.publish.docker.modifyEnv":"blocklet.publish.docker.modifyParam"),onClose:()=>x(!1),children:e.jsxs(c,{sx:{display:"flex",flexDirection:"column",gap:1,paddingBottom:2},children:[B||D||$?null:e.jsxs(c,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(N,{children:a("blocklet.publish.docker.needCustomInput")}),e.jsx(Ee,{disabled:l,checked:T,onChange:p,sx:{zoom:.9}})]}),$&&e.jsxs(c,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(N,{children:a("blocklet.publish.docker.shared")}),e.jsx(Ee,{disabled:l,checked:o.shared,onChange:m,sx:{zoom:.9}})]}),$&&e.jsxs(c,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(N,{children:a("blocklet.publish.docker.required")}),e.jsx(Ee,{disabled:l,checked:o.required,onChange:f,sx:{zoom:.9}})]}),$&&e.jsxs(c,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(N,{children:a("blocklet.publish.docker.secure")}),e.jsx(Ee,{disabled:l,checked:o.secure,onChange:h,sx:{zoom:.9}})]}),$&&e.jsxs(c,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(N,{children:a("blocklet.publish.docker.autoGenerated")}),e.jsx(Ee,{disabled:l,checked:o.value===fe.BLOCKLET_AUTOMATIC_ENV_VALUE,onChange:y,sx:{zoom:.9}})]}),$&&e.jsxs(c,{sx:{mt:1,width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(N,{sx:{flex:1},children:a("blocklet.publish.docker.description")}),e.jsx(re,{disabled:l,value:o.description,onChange:v,sx:{flex:1},label:a("blocklet.publish.docker.description")})]}),z&&e.jsxs(c,{sx:{mt:1,width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(N,{sx:{flex:1},children:a("blocklet.publish.docker.portType")}),e.jsxs(It,{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(c,{sx:{mt:1,width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(N,{sx:{flex:1},children:a("blocklet.publish.docker.proxyBehavior")}),e.jsxs(It,{value:o.proxyBehavior||"service",onChange:k,children:[e.jsx(be,{value:"service",children:a("blocklet.publish.docker.serviceProxy")}),e.jsx(be,{value:"direct",children:a("blocklet.publish.docker.directProxy")})]})]}),z&&o.type==="web"&&e.jsxs(c,{sx:{mt:1,width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(N,{sx:{flex:1},children:a("blocklet.publish.docker.prefix")}),e.jsx(re,{disabled:l,value:o.prefix,onChange:S,sx:{flex:1},label:a("blocklet.publish.docker.prefix")})]})]})})]})}dt.propTypes={dockerParams:s.object.isRequired,setDockerParams:s.func.isRequired,dataKey:s.string.isRequired,item:s.object.isRequired,t:s.func.isRequired,readOnly:s.bool.isRequired,index:s.number.isRequired};dt.defaultProps={};const cl=`
194
194
  docker run --name postgrest
195
195
  -p 3000:3000
196
196
  -e PGRST_DB_URI="postgres://username:password@host:port/database"
@@ -1,5 +1,5 @@
1
1
  const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/lottie-react.esm-D2t-u0YU.js","assets/vendor-react-DEoibe3W.js"])))=>i.map(i=>d[i]);
2
- import{j as e,aa as n,bb as g,T as S,O as U,bu as q,bs as W,bv as H,cI as L,y as O,ah as I,ai as N,cm as J,dA as X,dB as K,I as Y,dC as Q,e as Z,c0 as ee}from"./vendor-mui-core-BV2FUxWJ.js";import{r as b}from"./vendor-react-DEoibe3W.js";import{H as te,a as B,e as re,i as ie,b as oe}from"./vendor-hooks-BgUTpb6X.js";import{T as ae,bt as se,_}from"./vendor-ux-did-connect-DprdyYny.js";import{aP as ne}from"./vendor-utils-rHXShPKm.js";import{getAIKitComponent as le}from"./index-BGbF_TCU.js";import"./lottie-web-jYmAQWuC.js";import"./vendor-arcblock-CUb0jDdY.js";import"./index-Bs1kxR8_.js";import"./index-Ck-L27nB.js";import"./index-DVQCgvFb.js";const F=b.createContext({}),D=()=>b.useContext(F);function de({children:t,restrictions:c,i18n:s,theme:o}){const[l,f]=te({loading:!1}),x=a=>f(j=>({...j,loading:a})),p=b.useMemo(()=>({...l,onLoading:x,restrictions:c,i18n:s}),[l]);return e.jsx(ae,{theme:o,children:e.jsx(F.Provider,{value:p,children:t})})}const ce=["1024x1024","1024x1792","1792x1024"],xe=["256x256","512x512","1024x1024"],ue=[{label:"DALL·E 3",value:"dall-e-3"},{label:"DALL·E 2",value:"dall-e-2"}];function me({onSubmit:t}){const{loading:c,i18n:s}=D(),o=B({model:"dall-e-3",prompt:"",size:"1024x1024",number:1}),l=()=>{const a=JSON.parse(JSON.stringify(o));Object.values(o).every(y=>!!y)&&t(a)},{run:f}=re(l,{wait:500}),x={width:"100%",pl:1,pr:1},p=o.model==="dall-e-2"?xe:ce;return e.jsxs(pe,{onSubmit:a=>a.preventDefault(),children:[e.jsx(n,{sx:{flex:1,overflowY:"auto",overflowX:"hidden",m:2,mb:0},children:e.jsxs(g,{container:!0,gap:2.5,children:[e.jsxs(g,{item:!0,xs:12,children:[e.jsx(S,{gutterBottom:!0,className:"title label",color:"text.primary",children:s("aiImagePrompt")}),e.jsx(U,{sx:{width:1,mt:1},size:"small",type:"text",required:!0,placeholder:s("aiImagePromptTip"),multiline:!0,minRows:5,maxRows:6,value:o.prompt??"",onChange:a=>{a.stopPropagation(),o.prompt=a.target.value},inputProps:{maxLength:1e3}})]}),e.jsxs(g,{item:!0,xs:12,children:[e.jsx(S,{gutterBottom:!0,className:"title label",color:"text.primary",children:`${s("aiImageModel")}`}),e.jsx(q,{row:!0,sx:{".MuiFormControlLabel-label":{fontSize:"12px",color:"text.primary"}},value:o.model,onChange:a=>{o.number=1,o.size="1024x1024",o.model=a.target.value},children:ue.map(a=>e.jsx(W,{value:a.value,control:e.jsx(H,{size:"small"}),label:a.label},a.label))})]}),e.jsxs(g,{item:!0,xs:12,children:[e.jsx(S,{gutterBottom:!0,className:"title label",color:"text.primary",children:`${s("aiImageSize")}: ${o.size}`}),e.jsx(g,{container:!0,sx:{gap:2.5,pt:1},children:e.jsx(n,{flex:1,children:e.jsx(n,{...x,children:e.jsx(L,{size:"small",min:0,max:p.length-1,step:1,value:p.findIndex(a=>a==o.size),onChange:(a,j)=>{o.size=p[j]}})})})})]}),o.model==="dall-e-2"&&e.jsxs(g,{item:!0,xs:12,children:[e.jsx(S,{gutterBottom:!0,className:"title label",color:"text.primary",children:`${s("aiImageNumber")}: ${o.number}`}),e.jsx(n,{...x,children:e.jsx(L,{size:"small",defaultValue:1,valueLabelDisplay:"auto",step:1,min:1,max:10,value:o.number,onChange:(a,j)=>{a.stopPropagation(),o.number=Number(j)}})})]})]})}),e.jsx(O,{sx:{m:2,transition:"all 0.3s"},className:"submit-ai",variant:"contained",onClick:f,disabled:c,children:s(c?"aiImageGenerating":"aiImageGenerate")},c?"loading-submit":"submit")]})}const pe=I(n)`
2
+ import{j as e,aa as n,bb as g,T as S,O as U,bu as q,bs as W,bv as H,cI as L,y as O,ah as I,ai as N,cm as J,dA as X,dB as K,I as Y,dC as Q,e as Z,c0 as ee}from"./vendor-mui-core-BV2FUxWJ.js";import{r as b}from"./vendor-react-DEoibe3W.js";import{H as te,a as B,e as re,i as ie,b as oe}from"./vendor-hooks-BgUTpb6X.js";import{T as ae,bt as se,_}from"./vendor-ux-did-connect-DROQhYpS.js";import{aP as ne}from"./vendor-utils-rHXShPKm.js";import{getAIKitComponent as le}from"./index-8lA5-nM7.js";import"./lottie-web-jYmAQWuC.js";import"./vendor-arcblock-5qqHEVGo.js";import"./index-Bs1kxR8_.js";import"./index-DJzuhKQh.js";import"./index-DVQCgvFb.js";const F=b.createContext({}),D=()=>b.useContext(F);function de({children:t,restrictions:c,i18n:s,theme:o}){const[l,f]=te({loading:!1}),x=a=>f(j=>({...j,loading:a})),p=b.useMemo(()=>({...l,onLoading:x,restrictions:c,i18n:s}),[l]);return e.jsx(ae,{theme:o,children:e.jsx(F.Provider,{value:p,children:t})})}const ce=["1024x1024","1024x1792","1792x1024"],xe=["256x256","512x512","1024x1024"],ue=[{label:"DALL·E 3",value:"dall-e-3"},{label:"DALL·E 2",value:"dall-e-2"}];function me({onSubmit:t}){const{loading:c,i18n:s}=D(),o=B({model:"dall-e-3",prompt:"",size:"1024x1024",number:1}),l=()=>{const a=JSON.parse(JSON.stringify(o));Object.values(o).every(y=>!!y)&&t(a)},{run:f}=re(l,{wait:500}),x={width:"100%",pl:1,pr:1},p=o.model==="dall-e-2"?xe:ce;return e.jsxs(pe,{onSubmit:a=>a.preventDefault(),children:[e.jsx(n,{sx:{flex:1,overflowY:"auto",overflowX:"hidden",m:2,mb:0},children:e.jsxs(g,{container:!0,gap:2.5,children:[e.jsxs(g,{item:!0,xs:12,children:[e.jsx(S,{gutterBottom:!0,className:"title label",color:"text.primary",children:s("aiImagePrompt")}),e.jsx(U,{sx:{width:1,mt:1},size:"small",type:"text",required:!0,placeholder:s("aiImagePromptTip"),multiline:!0,minRows:5,maxRows:6,value:o.prompt??"",onChange:a=>{a.stopPropagation(),o.prompt=a.target.value},inputProps:{maxLength:1e3}})]}),e.jsxs(g,{item:!0,xs:12,children:[e.jsx(S,{gutterBottom:!0,className:"title label",color:"text.primary",children:`${s("aiImageModel")}`}),e.jsx(q,{row:!0,sx:{".MuiFormControlLabel-label":{fontSize:"12px",color:"text.primary"}},value:o.model,onChange:a=>{o.number=1,o.size="1024x1024",o.model=a.target.value},children:ue.map(a=>e.jsx(W,{value:a.value,control:e.jsx(H,{size:"small"}),label:a.label},a.label))})]}),e.jsxs(g,{item:!0,xs:12,children:[e.jsx(S,{gutterBottom:!0,className:"title label",color:"text.primary",children:`${s("aiImageSize")}: ${o.size}`}),e.jsx(g,{container:!0,sx:{gap:2.5,pt:1},children:e.jsx(n,{flex:1,children:e.jsx(n,{...x,children:e.jsx(L,{size:"small",min:0,max:p.length-1,step:1,value:p.findIndex(a=>a==o.size),onChange:(a,j)=>{o.size=p[j]}})})})})]}),o.model==="dall-e-2"&&e.jsxs(g,{item:!0,xs:12,children:[e.jsx(S,{gutterBottom:!0,className:"title label",color:"text.primary",children:`${s("aiImageNumber")}: ${o.number}`}),e.jsx(n,{...x,children:e.jsx(L,{size:"small",defaultValue:1,valueLabelDisplay:"auto",step:1,min:1,max:10,value:o.number,onChange:(a,j)=>{a.stopPropagation(),o.number=Number(j)}})})]})]})}),e.jsx(O,{sx:{m:2,transition:"all 0.3s"},className:"submit-ai",variant:"contained",onClick:f,disabled:c,children:s(c?"aiImageGenerating":"aiImageGenerate")},c?"loading-submit":"submit")]})}const pe=I(n)`
3
3
  display: flex;
4
4
  flex-direction: column;
5
5
  height: 100%;
@@ -1 +1 @@
1
- import{r as h}from"./vendor-react-DEoibe3W.js";import{H as e,j as a,bo as Y,bq as w,O as S,q as j,aa as v}from"./vendor-mui-core-BV2FUxWJ.js";import{y as s}from"./index-Ck-L27nB.js";import{a as H}from"./vendor-ux-did-connect-DprdyYny.js";import{A as M}from"./vendor-arcblock-CUb0jDdY.js";import{f as _}from"./vendor-hooks-BgUTpb6X.js";import{L as A,D as y}from"./vendor-mui-x-Bo-XOtzq.js";import{A as C}from"./AdapterDayjs-DnsMePpQ.js";function x({value:r,onChange:i,error:m,helperText:u,label:t,timezone:n}){const f=n?s().tz(n):s(),p=_(()=>{let l=s();return r&&(l=n?s(r).tz(n):s(r)),l.format("YYYY-MM-DD[T]HH:mm")},[r,n]),D=l=>{const T=n?s(l).tz(n).format("YYYY-MM-DD HH:mm:00"):s(l).format("YYYY-MM-DD HH:mm:00");i(new Date(T))};return a.jsx(A,{dateAdapter:C,children:a.jsxs(Y,{fullWidth:!0,error:m,children:[a.jsx(y,{label:t,minDateTime:f,value:s(p),onChange:D,slotProps:{textField:{error:m,helperText:m?u:""}},format:"YYYY-MM-DD HH:mm"}),u&&a.jsx(w,{children:u})]})})}x.propTypes={value:e.oneOfType([e.string,e.instanceOf(Date)]),onChange:e.func.isRequired,error:e.bool,helperText:e.string,label:e.string,timezone:e.string};x.defaultProps={value:null,error:!1,helperText:"",label:"",timezone:""};function E(r){return a.jsx(M,{...r,width:20,height:20})}const c={MINUTES_30:30*60*1e3,HOUR_1:60*60*1e3,HOURS_3:3*60*60*1e3,DAY_1:24*60*60*1e3,DAYS_7:7*24*60*60*1e3,DAYS_30:30*24*60*60*1e3};function b({placeholder:r,value:i,onChange:m,timezone:u}){const{t}=H(),[n,f]=h.useState(i||""),[p,D]=h.useState(null),l=h.useMemo(()=>[{value:new Date(Date.now()+c.MINUTES_30),label:`30 ${t("common.minutes")}`},{value:new Date(Date.now()+c.HOUR_1),label:`1 ${t("common.hour")}`},{value:new Date(Date.now()+c.HOURS_3),label:`3 ${t("common.hours")}`},{value:new Date(Date.now()+c.DAY_1),label:`1 ${t("common.day")}`},{value:new Date(Date.now()+c.DAYS_7),label:`7 ${t("common.days")}`},{value:new Date(Date.now()+c.DAYS_30),label:`30 ${t("common.days")}`},{value:"custom",label:t("common.custom")}],[t]),T=o=>{if(f(o),o==="custom"){const d=s().toDate();D(d),m(d)}else m(o)},g=o=>{D(o),m(o)};return h.useEffect(()=>{i&&(l.find(d=>s(d.value).isSame(i))||(f("custom"),D(i)))},[]),a.jsxs(a.Fragment,{children:[a.jsx(Y,{fullWidth:!0,children:a.jsx(S,{select:!0,value:n,label:r||t("team.passport.passportExpireTime"),onChange:o=>T(o.target.value),variant:"outlined",SelectProps:{IconComponent:E},children:l.map(o=>a.jsx(j,{value:o.value,children:o.label},o.value))})}),n==="custom"&&a.jsx(v,{children:a.jsx(x,{value:p,onChange:g,label:t("team.passport.customExpireTime"),timezone:u,error:!p,helperText:p?void 0:t("team.passport.customExpireTime")})})]})}b.propTypes={value:e.oneOfType([e.string,e.instanceOf(Date)]),onChange:e.func.isRequired,timezone:e.string,placeholder:e.string};b.defaultProps={value:"",timezone:"",placeholder:""};export{b as T};
1
+ import{r as h}from"./vendor-react-DEoibe3W.js";import{H as e,j as a,bo as Y,bq as w,O as S,q as j,aa as v}from"./vendor-mui-core-BV2FUxWJ.js";import{y as s}from"./index-DJzuhKQh.js";import{a as H}from"./vendor-ux-did-connect-DROQhYpS.js";import{A as M}from"./vendor-arcblock-5qqHEVGo.js";import{f as _}from"./vendor-hooks-BgUTpb6X.js";import{L as A,D as y}from"./vendor-mui-x-Bo-XOtzq.js";import{A as C}from"./AdapterDayjs-Bs_Q9JXL.js";function x({value:r,onChange:i,error:m,helperText:u,label:t,timezone:n}){const f=n?s().tz(n):s(),p=_(()=>{let l=s();return r&&(l=n?s(r).tz(n):s(r)),l.format("YYYY-MM-DD[T]HH:mm")},[r,n]),D=l=>{const T=n?s(l).tz(n).format("YYYY-MM-DD HH:mm:00"):s(l).format("YYYY-MM-DD HH:mm:00");i(new Date(T))};return a.jsx(A,{dateAdapter:C,children:a.jsxs(Y,{fullWidth:!0,error:m,children:[a.jsx(y,{label:t,minDateTime:f,value:s(p),onChange:D,slotProps:{textField:{error:m,helperText:m?u:""}},format:"YYYY-MM-DD HH:mm"}),u&&a.jsx(w,{children:u})]})})}x.propTypes={value:e.oneOfType([e.string,e.instanceOf(Date)]),onChange:e.func.isRequired,error:e.bool,helperText:e.string,label:e.string,timezone:e.string};x.defaultProps={value:null,error:!1,helperText:"",label:"",timezone:""};function E(r){return a.jsx(M,{...r,width:20,height:20})}const c={MINUTES_30:30*60*1e3,HOUR_1:60*60*1e3,HOURS_3:3*60*60*1e3,DAY_1:24*60*60*1e3,DAYS_7:7*24*60*60*1e3,DAYS_30:30*24*60*60*1e3};function b({placeholder:r,value:i,onChange:m,timezone:u}){const{t}=H(),[n,f]=h.useState(i||""),[p,D]=h.useState(null),l=h.useMemo(()=>[{value:new Date(Date.now()+c.MINUTES_30),label:`30 ${t("common.minutes")}`},{value:new Date(Date.now()+c.HOUR_1),label:`1 ${t("common.hour")}`},{value:new Date(Date.now()+c.HOURS_3),label:`3 ${t("common.hours")}`},{value:new Date(Date.now()+c.DAY_1),label:`1 ${t("common.day")}`},{value:new Date(Date.now()+c.DAYS_7),label:`7 ${t("common.days")}`},{value:new Date(Date.now()+c.DAYS_30),label:`30 ${t("common.days")}`},{value:"custom",label:t("common.custom")}],[t]),T=o=>{if(f(o),o==="custom"){const d=s().toDate();D(d),m(d)}else m(o)},g=o=>{D(o),m(o)};return h.useEffect(()=>{i&&(l.find(d=>s(d.value).isSame(i))||(f("custom"),D(i)))},[]),a.jsxs(a.Fragment,{children:[a.jsx(Y,{fullWidth:!0,children:a.jsx(S,{select:!0,value:n,label:r||t("team.passport.passportExpireTime"),onChange:o=>T(o.target.value),variant:"outlined",SelectProps:{IconComponent:E},children:l.map(o=>a.jsx(j,{value:o.value,children:o.label},o.value))})}),n==="custom"&&a.jsx(v,{children:a.jsx(x,{value:p,onChange:g,label:t("team.passport.customExpireTime"),timezone:u,error:!p,helperText:p?void 0:t("team.passport.customExpireTime")})})]})}b.propTypes={value:e.oneOfType([e.string,e.instanceOf(Date)]),onChange:e.func.isRequired,timezone:e.string,placeholder:e.string};b.defaultProps={value:"",timezone:"",placeholder:""};export{b as T};
@@ -1,4 +1,4 @@
1
- import{j as r,bc as W,aa as m,ad as P,bT as K,T as S,ah as J,bb as R,e as k,w as V}from"./vendor-mui-core-BV2FUxWJ.js";import{r as x}from"./vendor-react-DEoibe3W.js";import{i as X,h as Z,aJ as G,Y as $,X as Q,I as Y,Q as E}from"./vendor-ux-did-connect-DprdyYny.js";import{x as q,C as ee,y as B,z as te}from"./vendor-arcblock-CUb0jDdY.js";import{f as v,u as re}from"./vendor-hooks-BgUTpb6X.js";import{ai as T,A as ne,Z as ae}from"./vendor-utils-rHXShPKm.js";import oe from"./Phone-BkOMNOMO.js";import ie from"./Location-DxPzfR_p.js";import se from"./Email-BirbvqZ3.js";import H from"./Timezone-D91Of94T.js";let g=function(e){return e.AvatarOnly="AvatarOnly",e.Detailed="Detailed",e}({}),j=function(e){return e.NameOnly="NameOnly",e.Minimal="Minimal",e.Basic="Basic",e}({}),D=null;try{D=new X}catch(e){console.error("Failed to initialize BlockletSDK:",e),D=null}const L="ux_user_",le=60*60*1e3,ce=e=>{if(typeof sessionStorage>"u")return null;try{const t=`${L}${e}`,n=sessionStorage.getItem(t);if(!n)return null;const a=JSON.parse(n),s=a.timestamp||0;return Date.now()-s>le?(sessionStorage.removeItem(t),null):a.user}catch(t){return console.error(`Failed to load user cache for did ${e}:`,t),null}},de=(e,t)=>{if(!(typeof sessionStorage>"u"))try{const n=`${L}${e}`,a={user:t,timestamp:Date.now()};sessionStorage.setItem(n,JSON.stringify(a))}catch(n){console.error(`Failed to save user cache for did ${e}:`,n)}};function ue(e){if(!e)return null;let t="";return e.fullName?t=e.fullName.charAt(0).toUpperCase():e.email?t=e.email.split("@")[0].charAt(0).toUpperCase():t=e.did?e.did.charAt(0).toUpperCase():"?",t}function fe(e){if(!e||typeof e!="string")return!1;try{const t=Z.toTypeInfo(e);return t.role!==void 0&&t.role!==G.types.RoleType.ROLE_APPLICATION}catch(t){return console.error("Failed to check if did is user did:",t),!1}}async function me(e){if(!e)return null;const t=ce(e);if(t)return t;if(!D)return null;try{const n=await D.user.getUserPublicInfo({did:e});return n&&de(e,n),n}catch(n){return console.error("Failed to get user by did:",n),null}}const M=(e,t=48,n=void 0,a=void 0,s=!1)=>{const o=i=>{a==null||a(e,i)};if(!e.avatar){const i=ue(e),{className:d,style:h,alt:p}=n||{};return r.jsx(W,{onClick:o,className:d,style:h,alt:p,sx:{width:t,height:t,fontSize:t*.4,cursor:s||a?"pointer":"default"},variant:"circular",children:i})}return r.jsx(m,{className:"user-card__avatar",display:"flex",children:r.jsx($,{size:t,did:e.did,variant:"circle",style:{cursor:s||a?"pointer":"default"},onClick:o,src:e.avatar,alt:e.fullName||"",...n||{}})})},he=(e,t=120)=>e?r.jsx(m,{sx:{maxWidth:t},className:"user-card__top-right-content",children:e()}):null;function _({user:e,avatarSize:t,shouldShowHoverCard:n,renderCardContent:a,tooltipTitle:s,tooltipProps:o,avatarProps:i,onAvatarClick:d}){const h=M(e,t,i,d,n||!!s);return s?r.jsx(P,{enterDelay:200,title:s,placement:"bottom",...o??{},children:h}):n?r.jsx(P,{enterDelay:200,title:a?a():null,placement:"bottom",arrow:!1,TransitionComponent:K,PopperProps:{sx:{"& .MuiTooltip-tooltip":{backgroundColor:"transparent",p:0,maxWidth:500,zIndex:1e3}}},...o??{},children:h}):h}function xe(e){const{user:t,infoType:n,avatarSize:a=48,shouldShowHoverCard:s=!1,renderCardContent:o,...i}=e;return n===j.NameOnly?r.jsx(_,{user:t,avatarSize:a,shouldShowHoverCard:!1,renderCardContent:o,tooltipTitle:t.fullName||t.email||t.did,...i}):r.jsx(_,{user:t,avatarSize:a,shouldShowHoverCard:s,renderCardContent:o,...i})}function pe(e){const{user:t,avatarSize:n=48,onAvatarClick:a}=e;return r.jsxs(r.Fragment,{children:[M(t,n,e.avatarProps,a),r.jsx(S,{variant:"body1",children:t.fullName||t.email||t.did})]})}function ye(e){const{user:t,showDid:n,didProps:a,avatarSize:s,shouldShowHoverCard:o,renderCardContent:i,renderTopRightContent:d,topRightMaxWidth:h,avatarProps:p,shortenLabelProps:b,renderName:C,...w}=e;return r.jsxs(m,{display:"flex",justifyContent:"space-between",alignItems:"center",className:"user-card__avatar-content",children:[r.jsxs(m,{display:"flex",justifyContent:"flex-start",alignItems:"center",gap:1,flex:1,minWidth:0,children:[r.jsx(_,{user:t,avatarSize:s,shouldShowHoverCard:o,renderCardContent:i,avatarProps:p,...w}),r.jsxs(m,{children:[r.jsx(S,{variant:"subtitle1",fontWeight:500,color:"text.primary",className:"user-card__full-name-label",fontSize:18,noWrap:!0,sx:{lineHeight:1.1},children:C?C(t):r.jsx(q,{sx:{fontWeight:500},...b,children:t.fullName||t.email||t.did})}),n&&t.did?r.jsx(Q,{did:t.did,size:14,copyable:!0,compact:!0,locale:"en",sx:{lineHeight:1.5},...a??{}}):null]})]}),he(d,h)]})}const ge=x.memo(ye),be={timezone:H,email:se,phone:oe,location:ie,link:B};function Ce(e){return ae(e)}function I(e){return e?{filter:"brightness(0) saturate(100%) invert(1)"}:{}}const N={width:16,height:16};function ve({value:e}){const n=k().palette.mode==="dark";return r.jsxs(m,{display:"flex",alignItems:"center",gap:1,className:"user-card__timezone-field",children:[r.jsx(H,{...N,style:I(n)}),r.jsx(ee,{value:e,variant:"body2",color:"grey.800"})]})}function je({value:e}){const[t,n]=x.useState(!1),s=k().palette.mode==="dark",o=v(()=>{try{const d=new URL(e);return ne(d.origin,"favicon.ico")}catch{return""}},[e]),i=()=>{n(!0)};return r.jsxs(m,{display:"flex",alignItems:"center",gap:1,className:"user-card__link-field",children:[o&&!t?r.jsx("img",{src:o,alt:"site icon",style:{width:16,height:16,objectFit:"contain"},onError:i}):r.jsx(B,{...N,style:I(s)}),r.jsx(z,{variant:"body2",color:"grey.800",children:r.jsx(S,{component:"a",href:e,style:{textDecoration:"none",color:"inherit",fontSize:"inherit"},target:"_blank",variant:"body2",color:"grey.800",rel:"noopener noreferrer",children:Ce(e)})})]})}function U({field:e,value:t,children:n}){const a=be[e],o=k().palette.mode==="dark",i=I(o);return r.jsxs(m,{display:"flex",alignItems:"center",gap:1,className:`user-card__${e}-field`,children:[a?r.jsx(a,{...N,style:i}):r.jsx(Y,{icon:te,...N,...i}),r.jsx(z,{variant:"body2",color:"grey.800",children:n??t})]},e)}function Se({user:e,isFull:t=!1,renderFields:n}){var F;const a=v(()=>n??["bio","email","phone","location","timezone","link"],[n]),s=v(()=>a.includes("bio"),[a]),o=v(()=>e.metadata??{joinedAt:e==null?void 0:e.createdAt,email:e==null?void 0:e.email,phone:{country:"cn",phoneNumber:(e==null?void 0:e.phone)??""}},[e]),i=v(()=>e.address,[e.address]),d=x.useCallback(l=>{var f,c,u;if(!l)return"";switch(l){case"bio":return((f=e.metadata)==null?void 0:f.bio)||"";case"email":return o.email||e.email||"";case"phone":return((c=o.phone)==null?void 0:c.phoneNumber)||e.phone||"";case"location":return(i==null?void 0:i.city)||o.location||"";case"timezone":return o.timezone||"";case"link":return((u=o.links)==null?void 0:u.map(y=>y.url).filter(Boolean))||[];default:return e[l]||""}},[e,o,i]),{effectiveRenderCount:h}=x.useMemo(()=>{const l=a.filter(c=>{if(c==="bio")return!1;const u=d(c);return u==null||u===""?!1:T(u)?u.length>0:String(u).trim().length>0}),f=l.reduce((c,u)=>{const y=d(u);return c+(Array.isArray(y)?y.filter(A=>A&&String(A).trim()).length:1)},0);return{visibleFields:l,effectiveRenderCount:f}},[a,d]),p=h>4,b=re(l=>l!=null&&String(l).trim().length>0),C=x.useMemo(()=>{const l=[];return a.forEach(f=>{if(f==="bio")return;const c=d(f);c&&(T(c)?c.forEach((u,y)=>{b(u)&&l.push({field:f,value:u,key:`${f}-${y}`})}):b(c)&&l.push({field:f,value:c,key:f}))}),l},[a,d,b]);if(a.length===0)return null;const w=l=>{const{field:f,value:c,key:u}=l;switch(f){case"link":return r.jsx(je,{value:c},u);case"timezone":return r.jsx(ve,{value:c},u);case"email":return r.jsx(U,{field:f,value:c,children:r.jsx(S,{component:"a",href:`mailto:${c}`,rel:"noopener noreferrer",referrerPolicy:"no-referrer",style:{color:"inherit",textDecoration:"none",fontSize:"inherit"},children:c})});default:return r.jsx(U,{field:f,value:c},u)}};return r.jsxs(m,{mt:1,display:"flex",flexDirection:"column",gap:1.5,className:"user-card__basic-content",children:[s&&((F=e.metadata)==null?void 0:F.bio)&&r.jsx(z,{variant:"body2",color:"grey.800",className:"user-card__bio-field",children:e.metadata.bio}),p?r.jsx(R,{container:!0,spacing:.5,children:C.map(l=>r.jsx(R,{item:!0,xs:6,children:w(l)},l.key))}):r.jsx(m,{display:"flex",flexDirection:"column",gap:.5,children:C.map(l=>w(l))})]})}const z=J(S)`
1
+ import{j as r,bc as W,aa as m,ad as P,bT as K,T as S,ah as J,bb as R,e as k,w as V}from"./vendor-mui-core-BV2FUxWJ.js";import{r as x}from"./vendor-react-DEoibe3W.js";import{i as X,h as Z,aJ as G,Y as $,X as Q,I as Y,Q as E}from"./vendor-ux-did-connect-DROQhYpS.js";import{x as q,C as ee,y as B,z as te}from"./vendor-arcblock-5qqHEVGo.js";import{f as v,u as re}from"./vendor-hooks-BgUTpb6X.js";import{ai as T,A as ne,Z as ae}from"./vendor-utils-rHXShPKm.js";import oe from"./Phone-BkOMNOMO.js";import ie from"./Location-DxPzfR_p.js";import se from"./Email-BirbvqZ3.js";import H from"./Timezone-D91Of94T.js";let g=function(e){return e.AvatarOnly="AvatarOnly",e.Detailed="Detailed",e}({}),j=function(e){return e.NameOnly="NameOnly",e.Minimal="Minimal",e.Basic="Basic",e}({}),D=null;try{D=new X}catch(e){console.error("Failed to initialize BlockletSDK:",e),D=null}const L="ux_user_",le=60*60*1e3,ce=e=>{if(typeof sessionStorage>"u")return null;try{const t=`${L}${e}`,n=sessionStorage.getItem(t);if(!n)return null;const a=JSON.parse(n),s=a.timestamp||0;return Date.now()-s>le?(sessionStorage.removeItem(t),null):a.user}catch(t){return console.error(`Failed to load user cache for did ${e}:`,t),null}},de=(e,t)=>{if(!(typeof sessionStorage>"u"))try{const n=`${L}${e}`,a={user:t,timestamp:Date.now()};sessionStorage.setItem(n,JSON.stringify(a))}catch(n){console.error(`Failed to save user cache for did ${e}:`,n)}};function ue(e){if(!e)return null;let t="";return e.fullName?t=e.fullName.charAt(0).toUpperCase():e.email?t=e.email.split("@")[0].charAt(0).toUpperCase():t=e.did?e.did.charAt(0).toUpperCase():"?",t}function fe(e){if(!e||typeof e!="string")return!1;try{const t=Z.toTypeInfo(e);return t.role!==void 0&&t.role!==G.types.RoleType.ROLE_APPLICATION}catch(t){return console.error("Failed to check if did is user did:",t),!1}}async function me(e){if(!e)return null;const t=ce(e);if(t)return t;if(!D)return null;try{const n=await D.user.getUserPublicInfo({did:e});return n&&de(e,n),n}catch(n){return console.error("Failed to get user by did:",n),null}}const M=(e,t=48,n=void 0,a=void 0,s=!1)=>{const o=i=>{a==null||a(e,i)};if(!e.avatar){const i=ue(e),{className:d,style:h,alt:p}=n||{};return r.jsx(W,{onClick:o,className:d,style:h,alt:p,sx:{width:t,height:t,fontSize:t*.4,cursor:s||a?"pointer":"default"},variant:"circular",children:i})}return r.jsx(m,{className:"user-card__avatar",display:"flex",children:r.jsx($,{size:t,did:e.did,variant:"circle",style:{cursor:s||a?"pointer":"default"},onClick:o,src:e.avatar,alt:e.fullName||"",...n||{}})})},he=(e,t=120)=>e?r.jsx(m,{sx:{maxWidth:t},className:"user-card__top-right-content",children:e()}):null;function _({user:e,avatarSize:t,shouldShowHoverCard:n,renderCardContent:a,tooltipTitle:s,tooltipProps:o,avatarProps:i,onAvatarClick:d}){const h=M(e,t,i,d,n||!!s);return s?r.jsx(P,{enterDelay:200,title:s,placement:"bottom",...o??{},children:h}):n?r.jsx(P,{enterDelay:200,title:a?a():null,placement:"bottom",arrow:!1,TransitionComponent:K,PopperProps:{sx:{"& .MuiTooltip-tooltip":{backgroundColor:"transparent",p:0,maxWidth:500,zIndex:1e3}}},...o??{},children:h}):h}function xe(e){const{user:t,infoType:n,avatarSize:a=48,shouldShowHoverCard:s=!1,renderCardContent:o,...i}=e;return n===j.NameOnly?r.jsx(_,{user:t,avatarSize:a,shouldShowHoverCard:!1,renderCardContent:o,tooltipTitle:t.fullName||t.email||t.did,...i}):r.jsx(_,{user:t,avatarSize:a,shouldShowHoverCard:s,renderCardContent:o,...i})}function pe(e){const{user:t,avatarSize:n=48,onAvatarClick:a}=e;return r.jsxs(r.Fragment,{children:[M(t,n,e.avatarProps,a),r.jsx(S,{variant:"body1",children:t.fullName||t.email||t.did})]})}function ye(e){const{user:t,showDid:n,didProps:a,avatarSize:s,shouldShowHoverCard:o,renderCardContent:i,renderTopRightContent:d,topRightMaxWidth:h,avatarProps:p,shortenLabelProps:b,renderName:C,...w}=e;return r.jsxs(m,{display:"flex",justifyContent:"space-between",alignItems:"center",className:"user-card__avatar-content",children:[r.jsxs(m,{display:"flex",justifyContent:"flex-start",alignItems:"center",gap:1,flex:1,minWidth:0,children:[r.jsx(_,{user:t,avatarSize:s,shouldShowHoverCard:o,renderCardContent:i,avatarProps:p,...w}),r.jsxs(m,{children:[r.jsx(S,{variant:"subtitle1",fontWeight:500,color:"text.primary",className:"user-card__full-name-label",fontSize:18,noWrap:!0,sx:{lineHeight:1.1},children:C?C(t):r.jsx(q,{sx:{fontWeight:500},...b,children:t.fullName||t.email||t.did})}),n&&t.did?r.jsx(Q,{did:t.did,size:14,copyable:!0,compact:!0,locale:"en",sx:{lineHeight:1.5},...a??{}}):null]})]}),he(d,h)]})}const ge=x.memo(ye),be={timezone:H,email:se,phone:oe,location:ie,link:B};function Ce(e){return ae(e)}function I(e){return e?{filter:"brightness(0) saturate(100%) invert(1)"}:{}}const N={width:16,height:16};function ve({value:e}){const n=k().palette.mode==="dark";return r.jsxs(m,{display:"flex",alignItems:"center",gap:1,className:"user-card__timezone-field",children:[r.jsx(H,{...N,style:I(n)}),r.jsx(ee,{value:e,variant:"body2",color:"grey.800"})]})}function je({value:e}){const[t,n]=x.useState(!1),s=k().palette.mode==="dark",o=v(()=>{try{const d=new URL(e);return ne(d.origin,"favicon.ico")}catch{return""}},[e]),i=()=>{n(!0)};return r.jsxs(m,{display:"flex",alignItems:"center",gap:1,className:"user-card__link-field",children:[o&&!t?r.jsx("img",{src:o,alt:"site icon",style:{width:16,height:16,objectFit:"contain"},onError:i}):r.jsx(B,{...N,style:I(s)}),r.jsx(z,{variant:"body2",color:"grey.800",children:r.jsx(S,{component:"a",href:e,style:{textDecoration:"none",color:"inherit",fontSize:"inherit"},target:"_blank",variant:"body2",color:"grey.800",rel:"noopener noreferrer",children:Ce(e)})})]})}function U({field:e,value:t,children:n}){const a=be[e],o=k().palette.mode==="dark",i=I(o);return r.jsxs(m,{display:"flex",alignItems:"center",gap:1,className:`user-card__${e}-field`,children:[a?r.jsx(a,{...N,style:i}):r.jsx(Y,{icon:te,...N,...i}),r.jsx(z,{variant:"body2",color:"grey.800",children:n??t})]},e)}function Se({user:e,isFull:t=!1,renderFields:n}){var F;const a=v(()=>n??["bio","email","phone","location","timezone","link"],[n]),s=v(()=>a.includes("bio"),[a]),o=v(()=>e.metadata??{joinedAt:e==null?void 0:e.createdAt,email:e==null?void 0:e.email,phone:{country:"cn",phoneNumber:(e==null?void 0:e.phone)??""}},[e]),i=v(()=>e.address,[e.address]),d=x.useCallback(l=>{var f,c,u;if(!l)return"";switch(l){case"bio":return((f=e.metadata)==null?void 0:f.bio)||"";case"email":return o.email||e.email||"";case"phone":return((c=o.phone)==null?void 0:c.phoneNumber)||e.phone||"";case"location":return(i==null?void 0:i.city)||o.location||"";case"timezone":return o.timezone||"";case"link":return((u=o.links)==null?void 0:u.map(y=>y.url).filter(Boolean))||[];default:return e[l]||""}},[e,o,i]),{effectiveRenderCount:h}=x.useMemo(()=>{const l=a.filter(c=>{if(c==="bio")return!1;const u=d(c);return u==null||u===""?!1:T(u)?u.length>0:String(u).trim().length>0}),f=l.reduce((c,u)=>{const y=d(u);return c+(Array.isArray(y)?y.filter(A=>A&&String(A).trim()).length:1)},0);return{visibleFields:l,effectiveRenderCount:f}},[a,d]),p=h>4,b=re(l=>l!=null&&String(l).trim().length>0),C=x.useMemo(()=>{const l=[];return a.forEach(f=>{if(f==="bio")return;const c=d(f);c&&(T(c)?c.forEach((u,y)=>{b(u)&&l.push({field:f,value:u,key:`${f}-${y}`})}):b(c)&&l.push({field:f,value:c,key:f}))}),l},[a,d,b]);if(a.length===0)return null;const w=l=>{const{field:f,value:c,key:u}=l;switch(f){case"link":return r.jsx(je,{value:c},u);case"timezone":return r.jsx(ve,{value:c},u);case"email":return r.jsx(U,{field:f,value:c,children:r.jsx(S,{component:"a",href:`mailto:${c}`,rel:"noopener noreferrer",referrerPolicy:"no-referrer",style:{color:"inherit",textDecoration:"none",fontSize:"inherit"},children:c})});default:return r.jsx(U,{field:f,value:c},u)}};return r.jsxs(m,{mt:1,display:"flex",flexDirection:"column",gap:1.5,className:"user-card__basic-content",children:[s&&((F=e.metadata)==null?void 0:F.bio)&&r.jsx(z,{variant:"body2",color:"grey.800",className:"user-card__bio-field",children:e.metadata.bio}),p?r.jsx(R,{container:!0,spacing:.5,children:C.map(l=>r.jsx(R,{item:!0,xs:6,children:w(l)},l.key))}):r.jsx(m,{display:"flex",flexDirection:"column",gap:.5,children:C.map(l=>w(l))})]})}const z=J(S)`
2
2
  flex: 1;
3
3
  display: -webkit-box;
4
4
  line-height: 1.5;
@@ -1,4 +1,4 @@
1
- import{H as i,ah as v,j as s,bH as T,aa as N,ab as D,s as E}from"./vendor-mui-core-BV2FUxWJ.js";import{a as $,m as H,u as b,l as M}from"./vendor-hooks-BgUTpb6X.js";import{a as q,R as F}from"./vendor-arcblock-CUb0jDdY.js";import{r as u}from"./vendor-react-DEoibe3W.js";import{b2 as U,am as B,a as j,aR as O,j as Y,b3 as S,Y as W}from"./vendor-ux-did-connect-DprdyYny.js";import{y as V,z as X,A as L,B as z}from"./index-Ck-L27nB.js";import{A as J}from"./vendor-utils-rHXShPKm.js";import{u as K}from"./use-passport-id-B-b-_oYF.js";import{u as G}from"./session-E0e-X6-a.js";import{b as Q}from"./sdk-DeUOtvaE.js";import{d as Z}from"./CheckCircle-DA1-Q3VQ.js";import{w as ee}from"./wrap-locale-Q616uqhq.js";function P({invitation:e,createPassportSvg:a,passportColor:c}){const[p,n]=u.useState(!1),{t}=u.useContext(U),l=u.useMemo(()=>(e.role.title||e.role.name).toUpperCase(),[e.role.title,e.role.name]),m=u.useMemo(()=>a({title:l,issuer:e.info.name,issuerDid:e.info.appDid,ownerName:"Your Name",ownerDid:e.info.appDid,preferredColor:e.info.passportColor||c,extra:e.passportExpireTime?{key:"Exp",value:V(e.passportExpireTime).format("YYYY-MM-DD HH:mm:ss")}:void 0}),[e,l]),f=u.useCallback(()=>{n(!0)},[]),r=u.useCallback(()=>{n(!1)},[]);return s.jsxs(s.Fragment,{children:[s.jsx(se,{children:s.jsxs("div",{className:"invite-passport__card",onClick:f,children:[!!e.display&&s.jsx(q,{data:e.display,style:{width:"100%",height:"100%"}}),!e.display&&s.jsx("div",{className:"invite-passport__cover",dangerouslySetInnerHTML:{__html:m}})]})}),s.jsx(B,{open:p,title:t("invite.viewPermission"),PaperProps:{style:{minHeight:"auto",paddingBottom:"20px"}},onClose:r,children:e.role.permissions&&e.role.permissions.length>0?s.jsx("ul",{style:{listStyle:"circle",padding:"0 20px"},children:e.role.permissions.map(o=>s.jsx("li",{style:{listStyle:"circle"},children:o.description},o.name))}):s.jsxs("div",{style:{color:"#999",textAlign:"center"},children:[s.jsx(T,{style:{width:"30px",height:"30px"}}),s.jsx("div",{children:t("invite.emptyPermission")})]})})]})}P.propTypes={invitation:i.object.isRequired,createPassportSvg:i.func.isRequired,passportColor:i.string};P.defaultProps={passportColor:"auto"};const se=v.div`
1
+ import{H as i,ah as v,j as s,bH as T,aa as N,ab as D,s as E}from"./vendor-mui-core-BV2FUxWJ.js";import{a as $,m as H,u as b,l as M}from"./vendor-hooks-BgUTpb6X.js";import{a as q,R as F}from"./vendor-arcblock-5qqHEVGo.js";import{r as u}from"./vendor-react-DEoibe3W.js";import{b2 as U,am as B,a as j,aR as O,j as Y,b3 as S,Y as W}from"./vendor-ux-did-connect-DROQhYpS.js";import{y as V,z as X,A as L,B as z}from"./index-DJzuhKQh.js";import{A as J}from"./vendor-utils-rHXShPKm.js";import{u as K}from"./use-passport-id-B-b-_oYF.js";import{u as G}from"./session-ugMCR4Iu.js";import{b as Q}from"./sdk-Bxy9kDUo.js";import{d as Z}from"./CheckCircle-DsdIIzds.js";import{w as ee}from"./wrap-locale-CvN5krOj.js";function P({invitation:e,createPassportSvg:a,passportColor:c}){const[p,n]=u.useState(!1),{t}=u.useContext(U),l=u.useMemo(()=>(e.role.title||e.role.name).toUpperCase(),[e.role.title,e.role.name]),m=u.useMemo(()=>a({title:l,issuer:e.info.name,issuerDid:e.info.appDid,ownerName:"Your Name",ownerDid:e.info.appDid,preferredColor:e.info.passportColor||c,extra:e.passportExpireTime?{key:"Exp",value:V(e.passportExpireTime).format("YYYY-MM-DD HH:mm:ss")}:void 0}),[e,l]),f=u.useCallback(()=>{n(!0)},[]),r=u.useCallback(()=>{n(!1)},[]);return s.jsxs(s.Fragment,{children:[s.jsx(se,{children:s.jsxs("div",{className:"invite-passport__card",onClick:f,children:[!!e.display&&s.jsx(q,{data:e.display,style:{width:"100%",height:"100%"}}),!e.display&&s.jsx("div",{className:"invite-passport__cover",dangerouslySetInnerHTML:{__html:m}})]})}),s.jsx(B,{open:p,title:t("invite.viewPermission"),PaperProps:{style:{minHeight:"auto",paddingBottom:"20px"}},onClose:r,children:e.role.permissions&&e.role.permissions.length>0?s.jsx("ul",{style:{listStyle:"circle",padding:"0 20px"},children:e.role.permissions.map(o=>s.jsx("li",{style:{listStyle:"circle"},children:o.description},o.name))}):s.jsxs("div",{style:{color:"#999",textAlign:"center"},children:[s.jsx(T,{style:{width:"30px",height:"30px"}}),s.jsx("div",{children:t("invite.emptyPermission")})]})})]})}P.propTypes={invitation:i.object.isRequired,createPassportSvg:i.func.isRequired,passportColor:i.string};P.defaultProps={passportColor:"auto"};const se=v.div`
2
2
  display: flex;
3
3
  max-width: 350px;
4
4
  margin: 30px auto;