@abtnode/blocklet-services 1.16.42-beta-20250409-161010-b0a88c5c → 1.16.42-beta-20250412-074212-ef879757
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/api/index.js +1 -1
- package/api/routes/user.js +2 -2
- package/api/services/auth/session.js +35 -2
- package/api/services/studio/index.js +1 -1
- package/dist/assets/{ArrowDropDown-CDjPVis_.js → ArrowDropDown-C_E3qkPd.js} +1 -1
- package/dist/assets/{CheckCircle-BHD7aj9l.js → CheckCircle-D7Ntmb2o.js} +1 -1
- package/dist/assets/{ChevronLeft-CUdxcGLW.js → ChevronLeft-BIgT65EY.js} +1 -1
- package/dist/assets/{ChevronRight-Bol9kSyE.js → ChevronRight-foZmiP4J.js} +1 -1
- package/dist/assets/{DeleteOutline-BiIEYa8g.js → DeleteOutline-CKVA3PXs.js} +1 -1
- package/dist/assets/{Done-kAy_Y9ti.js → Done-BDrYSkZM.js} +1 -1
- package/dist/assets/{Download-COul5Jpx.js → Download-BQiSNQBP.js} +1 -1
- package/dist/assets/{Error-xVtnHALO.js → Error-CK4gTMoT.js} +1 -1
- package/dist/assets/{ExpandLess-CW9G6ynD.js → ExpandLess-1B6PdCYC.js} +1 -1
- package/dist/assets/{Google-D98Bf-5Y.js → Google-DimUFzIe.js} +1 -1
- package/dist/assets/{InfoOutlined-jnMrCCfZ.js → InfoOutlined-CEHciuDy.js} +1 -1
- package/dist/assets/{Launch-DFNlDQlk.js → Launch-DX76v5dw.js} +1 -1
- package/dist/assets/{LaunchOutlined-yZsgpXar.js → LaunchOutlined-CnOQGhu-.js} +1 -1
- package/dist/assets/{MoreHoriz-BqdKN70-.js → MoreHoriz-THEF6D0C.js} +1 -1
- package/dist/assets/{PlayArrow-CXtQLadK.js → PlayArrow-DpcMtsY5.js} +1 -1
- package/dist/assets/{TuneOutlined-EaV8HxdX.js → TuneOutlined-DHqZ7jGz.js} +1 -1
- package/dist/assets/{ViewList-BPuXZDcI.js → ViewList-DOu7Co_L.js} +1 -1
- package/dist/assets/{access-control-CuKW2kRZ.js → access-control-CkJaSWqQ.js} +1 -1
- package/dist/assets/{actions-DqeM3yie.js → actions-CAL1KFv7.js} +1 -1
- package/dist/assets/add-component-core-CcE5hcL-.js +762 -0
- package/dist/assets/add-resource-CWB03UX7.js +1 -0
- package/dist/assets/{addon-B5UBB-pU.js → addon-D1_etOjl.js} +1 -1
- package/dist/assets/{advanced-Cvboset8.js → advanced-xfBXRmMb.js} +4 -38
- package/dist/assets/api-kwOW9mRz.js +1 -0
- package/dist/assets/{appearance-DmQgth7a.js → appearance-CSHu4pbk.js} +1 -1
- package/dist/assets/ar-Cb5zQ0go.js +13 -0
- package/dist/assets/{audit-logs-LLoqbniS.js → audit-logs-JU-7pKhW.js} +3 -3
- package/dist/assets/{base32-CMrsHquD.js → base32-CLGITfm-.js} +1 -1
- package/dist/assets/branding-BWmZMyhk.js +55 -0
- package/dist/assets/{branding-BfxdFbW1.js → branding-CcjXuXBu.js} +2 -2
- package/dist/assets/bundle-avatar-DW07bLBG.js +1 -0
- package/dist/assets/{button-OxbVr1Od.js → button-BSJ2z68-.js} +1 -1
- package/dist/assets/{click-to-copy-q_I2l6Sg.js → click-to-copy-C9iEVQIO.js} +1 -1
- package/dist/assets/cloneDeep-DHAAvuEH.js +1 -0
- package/dist/assets/{complete-ogipf6id.js → complete-DJafaAbP.js} +2 -2
- package/dist/assets/{component-DVhWy5jQ.js → component-Dixh8MiE.js} +1 -1
- package/dist/assets/{config-YsfQuvvt.js → config-DnWRl-e4.js} +2 -2
- package/dist/assets/{config-BdUShvO-.js → config-DzZULB-q.js} +1 -1
- package/dist/assets/{config-navigation-C4hgzi4R.js → config-navigation-Dy2e3bWx.js} +6 -6
- package/dist/assets/{config-space-DJ-fZ6j4.js → config-space-D9XSZ43O.js} +1 -1
- package/dist/assets/{confirm-C1Nde1Nq.js → confirm-D36_98HC.js} +1 -1
- package/dist/assets/connect-DfFQY1g3.js +1 -0
- package/dist/assets/connect-XFyjVd39.js +5 -0
- package/dist/assets/{connect-to-CdG3TX0A.js → connect-to-nV6QlEXH.js} +1 -1
- package/dist/assets/dashboard-BX25tvc1.js +262 -0
- package/dist/assets/de-BOcpEFUQ.js +13 -0
- package/dist/assets/{delete-confirm-CpPzqeJx.js → delete-confirm-DXKGHbZ0.js} +1 -1
- package/dist/assets/{did-address-D-fI5ZyH.js → did-address-B_VfxEC5.js} +1 -1
- package/dist/assets/domain-BwDvbkr6.js +9 -0
- package/dist/assets/{domain-action-card-Crwneu7N.js → domain-action-card-CE5RoGLV.js} +2 -2
- package/dist/assets/domains-D7bzAvx0.js +1 -0
- package/dist/assets/{email-DGh9v0en.js → email-Blo2BcBK.js} +2 -2
- package/dist/assets/es-DAe7HpzA.js +14 -0
- package/dist/assets/{exchange-passport-CgGOJDm9.js → exchange-passport-C2ib3_Sn.js} +1 -1
- package/dist/assets/fr-Chv_7X3-.js +13 -0
- package/dist/assets/{fuel-CItPP5Vk.js → fuel-Dy1g5bbZ.js} +1 -1
- package/dist/assets/{get-safe-url-B2BlmlqT.js → get-safe-url-BOY9UAaI.js} +1 -1
- package/dist/assets/{get-safe-url-C2N97NJc.js → get-safe-url-D_Puq_oh.js} +1 -1
- package/dist/assets/hi-BqgGDMzX.js +11 -0
- package/dist/assets/{home-12LB7wlV.js → home-CjHQSa_8.js} +1 -1
- package/dist/assets/id-DbN1Ye4x.js +14 -0
- package/dist/assets/{iframe-54rcs7kU.js → iframe-BhRKCdFb.js} +1 -1
- package/dist/assets/{index-643kpB1h.js → index-9aeq_G-H.js} +1 -1
- package/dist/assets/{index-Du71d9ZJ.js → index-9fAsRy5T.js} +1 -1
- package/dist/assets/index-B0eRJvP0.js +346 -0
- package/dist/assets/{index-G26gYrxE.js → index-BFJrqJbJ.js} +2 -2
- package/dist/assets/{index-DQC9zneB.js → index-BqFOxrIh.js} +4 -4
- package/dist/assets/{index-0CgHVUpB.js → index-C1nvgBfF.js} +1 -1
- package/dist/assets/{index-D5G2v7wN.js → index-CAftUN2f.js} +2 -2
- package/dist/assets/{index-4WjT4o1e.js → index-CH6NslvK.js} +1 -1
- package/dist/assets/index-C_bxIWi7.js +55 -0
- package/dist/assets/{index-CTpJt8AJ.js → index-CwaFNZTA.js} +47 -34
- package/dist/assets/index-DF8FqhFx.js +6 -0
- package/dist/assets/{index-BIu-u1kW.js → index-DR9nQ2tJ.js} +1 -1
- package/dist/assets/{index-YqrAgavD.js → index-DW20Eg1X.js} +1 -1
- package/dist/assets/{index-DKPGWA5E.js → index-Du2DtxVt.js} +2 -2
- package/dist/assets/index-FiEfCjCd.js +113 -0
- package/dist/assets/index-_bdib4_X.js +290 -0
- package/dist/assets/{index-9XJ5HzSd.js → index-lIOjK585.js} +1 -1
- package/dist/assets/{index-CB6NPYWM.js → index-rMaglH7e.js} +3 -3
- package/dist/assets/{index-DVogNW6l.js → index-uyugLR5M.js} +1 -1
- package/dist/assets/{invitation-BBqRmSx1.js → invitation-BhpO2wrv.js} +3 -3
- package/dist/assets/{invite-CKxzd-7d.js → invite-Dho4ZotB.js} +1 -1
- package/dist/assets/{issue-passport-BA7u3NC-.js → issue-passport-ChG1IKWf.js} +1 -1
- package/dist/assets/{item-DssQyiFI.js → item-CuaUMkzc.js} +2 -2
- package/dist/assets/ja-Bv-A_sTl.js +14 -0
- package/dist/assets/ko-Bl3kd-sp.js +14 -0
- package/dist/assets/landing-page-B5nKEn_3.js +1 -0
- package/dist/assets/{layout-R4Ynfcbq.js → layout-DMTV9CZD.js} +1 -1
- package/dist/assets/{list-BhXWs05I.js → list-BpDs72YC.js} +9 -9
- package/dist/assets/localization-WUgLuLwU.js +1 -0
- package/dist/assets/{log-D4PQ7UF3.js → log-BHx8x694.js} +1 -1
- package/dist/assets/logger-Bd77RetM.js +1 -0
- package/dist/assets/login-C8IgtQHG.js +1 -0
- package/dist/assets/{login-oauth-callback-BzcAZfXM.js → login-oauth-callback-5AlLzjZ2.js} +1 -1
- package/dist/assets/logo-uploader-COdhJAZk.js +133 -0
- package/dist/assets/{lost-passport-DD7XCIgg.js → lost-passport-D7rMK1P8.js} +1 -1
- package/dist/assets/omit-IjXSqbDA.js +1 -0
- package/dist/assets/{open-window-Dsc5mHei.js → open-window-CX_mRFPs.js} +1 -1
- package/dist/assets/overview-d6gDgxnh.js +85 -0
- package/dist/assets/{page-header-B7j9M6Zp.js → page-header-DWf5vODI.js} +1 -1
- package/dist/assets/{permission-CLAOGeOf.js → permission-CmHMB8NK.js} +1 -1
- package/dist/assets/{preferences-qZW-dsds.js → preferences-COMN8FgJ.js} +1 -1
- package/dist/assets/{profile-embed-6mTqkL03.js → profile-embed-Crj1xM6Z.js} +1 -1
- package/dist/assets/pt-B7_jgyK-.js +12 -0
- package/dist/assets/publish-resource-KUiHUSOS.js +1 -0
- package/dist/assets/{react-beautiful-dnd.esm-Bu3K07pf.js → react-beautiful-dnd.esm-B3HYEQUw.js} +1 -1
- package/dist/assets/{relative-time-Cu4jaQ9H.js → relative-time-B-K8BXmq.js} +1 -1
- package/dist/assets/ru-CToatViJ.js +11 -0
- package/dist/assets/{runtime-kNyRK8Hy.js → runtime-BLeEmHaM.js} +1 -1
- package/dist/assets/sdk-j4w1A_X4.js +1 -0
- package/dist/assets/{security-Dkk4FgYt.js → security-4VIghIsi.js} +4 -4
- package/dist/assets/session-0rF5SuCk.js +1 -0
- package/dist/assets/setup-Bbl0UvNZ.js +19 -0
- package/dist/assets/{spaces-B_lJq3Uz.js → spaces-CyFGYf34.js} +1 -1
- package/dist/assets/{start-C53MN0u7.js → start-D0qy1O4h.js} +1 -1
- package/dist/assets/{status-5Z1CW-le.js → status-B9rkBROD.js} +1 -1
- package/dist/assets/{step-actions-CujnheOz.js → step-actions-BxdcbLc6.js} +1 -1
- package/dist/assets/{studio-BYzuzhpL.js → studio-cLKWVbyy.js} +1 -1
- package/dist/assets/{switch-control-DWiX5YiK.js → switch-control-DpvMHPLC.js} +1 -1
- package/dist/assets/th-23Hwasay.js +12 -0
- package/dist/assets/{traffic-WemHsP0B.js → traffic-Diahv-s-.js} +3 -3
- package/dist/assets/{transfer-CF7CWbdm.js → transfer-DIxD0NHy.js} +1 -1
- package/dist/assets/{unsubscribe-Dfof7yLG.js → unsubscribe-C3uPy6Yj.js} +1 -1
- package/dist/assets/useAsync-BxB2TpDl.js +1 -0
- package/dist/assets/useAsync-L7_fHBH5.js +1 -0
- package/dist/assets/useAsyncRetry-W2lp7mi1.js +7 -0
- package/dist/assets/{useLocalStorage-DLwAkPmo.js → useLocalStorage-Cq9THoCr.js} +1 -1
- package/dist/assets/{user-center-CowUpoIn.js → user-center-CcFqKY18.js} +2 -2
- package/dist/assets/{util-B6E4W35Y.js → util-1n1Ulk5w.js} +1 -1
- package/dist/assets/{util-C57yoAn6.js → util-B_UMdXQ8.js} +1 -1
- package/dist/assets/{vendor-arcblock-CD8CMsgQ.js → vendor-arcblock-V3HYELzG.js} +95 -99
- package/dist/assets/{vendor-hooks-8r-lvvPs.js → vendor-hooks-DN4nZ7TU.js} +1 -1
- package/dist/assets/vendor-utils-C3FZIS9A.js +11 -0
- package/dist/assets/{vendor-ux-did-connect-DlrX4cqq.js → vendor-ux-did-connect-DEbq97Xz.js} +149 -158
- package/dist/assets/vi-D-QGxDS1.js +12 -0
- package/dist/assets/wrap-locale-D2zd2sgL.js +1 -0
- package/dist/assets/{zh-D4Lak9gZ.js → zh-gJhiLbCP.js} +1 -1
- package/dist/assets/zh-nDA-W8Iz.js +15 -0
- package/dist/assets/zh-tw-B9PQstHP.js +14 -0
- package/dist/images/all-done.png +0 -0
- package/dist/index.html +5 -5
- package/dist/service-worker.js +1 -1
- package/package.json +30 -29
- package/dist/assets/add-component-core-DXPSI3Ti.js +0 -762
- package/dist/assets/add-resource-S3Z1zjbJ.js +0 -1
- package/dist/assets/api-BVwAqPhr.js +0 -1
- package/dist/assets/ar-688M-cDq.js +0 -3
- package/dist/assets/branding-DcviCyPr.js +0 -50
- package/dist/assets/bundle-avatar-Ci9fNblN.js +0 -1
- package/dist/assets/cloneDeep-g5lbcy6_.js +0 -1
- package/dist/assets/connect-BkxyLG9H.js +0 -1
- package/dist/assets/connect-dGBjAgNF.js +0 -5
- package/dist/assets/dashboard-2jQIZ8v5.js +0 -222
- package/dist/assets/de-dAK4siFW.js +0 -3
- package/dist/assets/domain-1X_uRV9L.js +0 -9
- package/dist/assets/domains-BHkUaPc7.js +0 -1
- package/dist/assets/es-DScgwpYm.js +0 -3
- package/dist/assets/fr-BBQTxbA5.js +0 -3
- package/dist/assets/hi-Bw7OKUaN.js +0 -1
- package/dist/assets/id-CKyyz3c3.js +0 -3
- package/dist/assets/index-3dawiJIg.js +0 -6
- package/dist/assets/index-Bj10Vbvc.js +0 -113
- package/dist/assets/index-C4dzrN-k.js +0 -290
- package/dist/assets/index-CFs0La6o.js +0 -15
- package/dist/assets/index-jny05NvM.js +0 -346
- package/dist/assets/ja-C9-S8RGg.js +0 -3
- package/dist/assets/ko-B7Et6Phj.js +0 -3
- package/dist/assets/landing-page-2uYUfHoY.js +0 -1
- package/dist/assets/localization-BsSUbpzO.js +0 -1
- package/dist/assets/login-CuCcTu--.js +0 -1
- package/dist/assets/logo-uploader-C9TwiAKx.js +0 -134
- package/dist/assets/omit-DF3Nt1_-.js +0 -1
- package/dist/assets/overview-BjFpvrpN.js +0 -85
- package/dist/assets/pt-BYJAg1Zs.js +0 -1
- package/dist/assets/publish-resource-DO-PRxdk.js +0 -1
- package/dist/assets/ru-DUqsqieR.js +0 -1
- package/dist/assets/sdk-BjsIctsl.js +0 -1
- package/dist/assets/session-UJ7B0EdV.js +0 -1
- package/dist/assets/setup-SAEzURDR.js +0 -19
- package/dist/assets/th-BIzIDice.js +0 -1
- package/dist/assets/useAsync-De6s-0n9.js +0 -1
- package/dist/assets/useAsyncRetry-B6OdNqyX.js +0 -7
- package/dist/assets/vendor-utils-Cm2BKG2b.js +0 -11
- package/dist/assets/vi-DQnObbNS.js +0 -1
- package/dist/assets/wrap-locale-NNP_yq5G.js +0 -1
- package/dist/assets/zh-DQI8vsAI.js +0 -4
- package/dist/assets/zh-tw-DqaJtqXb.js +0 -3
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{u as q,Z as W,bH as Y,h as be,$ as fe,a6 as ge,bG as je}from"./vendor-ux-did-connect-DlrX4cqq.js";import{x as ye,m as de,j as we}from"./vendor-hooks-8r-lvvPs.js";import{r as C,b as Z}from"./vendor-react-DEoibe3W.js";import{d as X}from"./InfoOutlined-jnMrCCfZ.js";import{z as N,C as ce,t as ke}from"./index-CTpJt8AJ.js";import{u as F,a as ve,C as K}from"./dashboard-2jQIZ8v5.js";import{E as o,j as e,D as Ee,ac as Ce,r as Te,a4 as f,M as ie,T as S,a3 as U,ad as ee,y as Se,x as B,br as ae,bN as V,a5 as A,L as G,z as Q,bk as Re,A as O,I as _,C as Ie,bp as Me,ae as P,c3 as Pe,al as De,bf as J,bo as ze,b3 as We,c4 as Ae,c5 as Oe,b4 as $e,ag as qe,bY as Le,s as pe,t as Be,c6 as He,c7 as Ne,c8 as Fe,c9 as Ue,ca as _e}from"./vendor-mui-core-1jJmAutq.js";import{l as Ye}from"./vendor-arcblock-CD8CMsgQ.js";import{d as Ke}from"./ExpandLess-CW9G6ynD.js";import{z as ue,x as Ve,y as Je}from"./vendor-utils-Cm2BKG2b.js";import{C as Ge}from"./confirm-C1Nde1Nq.js";import{A as Qe}from"./actions-DqeM3yie.js";import"./lottie-web-jYmAQWuC.js";import"./useLocalStorage-DLwAkPmo.js";import"./PlayArrow-CXtQLadK.js";import"./get-safe-url-C2N97NJc.js";import"./format-error-BrmqJs5a.js";import"./index-DVogNW6l.js";import"./session-UJ7B0EdV.js";import"./useAsyncRetry-B6OdNqyX.js";import"./useAsync-De6s-0n9.js";import"./useSetState-CWq0AVWn.js";import"./use-mobile-DjnNmGRG.js";import"./MoreHoriz-BqdKN70-.js";const Ze=t=>{var j,y;const[d,c]=C.useState(null),[l,b]=C.useState(!t),[R,p]=C.useState(null),{blocklet:n}=ce(),a=(y=(j=n==null?void 0:n.site)==null?void 0:j.domainAliases[0])==null?void 0:y.value,v=C.useMemo(()=>{const h={};return d&&(d.sources.forEach(r=>{h[r.did]={source:r,events:[],count:0}}),d.events.forEach(r=>{h[r.source]&&(h[r.source].events.push(r),h[r.source].count+=1)})),h},[d]),T=async()=>{try{if(b(!0),!a)return;const r=await(await fetch(`https://${a}/.well-known/service/openevent.json`)).json();c(r),p(null)}catch(h){p(h instanceof Error?h:new Error(String(h)))}finally{b(!1)}};return C.useEffect(()=>{T()},[a]),{openEvent:d,setOpenEvent:c,eventsBySource:v,loading:l,error:R,loadData:T}};function te({eventsBySource:t,selectedEvents:d,setSelectedEvents:c,error:l}){const{t:b}=q(),[R,p]=C.useState({}),n=C.useMemo(()=>{const r={};return Object.entries(t).forEach(([w,{events:g}])=>{const E=g.filter(u=>d[`${u.type}-${u.source}`]).length;r[w]=E}),r},[t,d]),a=C.useMemo(()=>Object.values(n).reduce((r,w)=>r+w,0),[n]),v=C.useMemo(()=>Object.values(t).reduce((r,{events:w})=>r+w.length,0),[t]),T=(r,w)=>{w.stopPropagation(),p({...R,[r]:!R[r]})},j=r=>{const w=`${r.type}-${r.source}`;c(g=>({...g,[w]:!g[w]}))},y=(r,w)=>{const g={};r.forEach(E=>{const u=`${E.type}-${E.source}`;g[u]=!w}),c(E=>({...E,...g}))},h=r=>{const w={};Object.values(t).forEach(({events:g})=>{g.forEach(E=>{const u=`${E.type}-${E.source}`;w[u]=r.target.checked})}),c(w)};return e.jsxs(f,{sx:{width:"100%"},children:[e.jsxs(f,{sx:{display:"flex",alignItems:"center",mb:1,mt:1},children:[e.jsx(ae,{control:e.jsx(V,{onChange:h,checked:a>0&&a===v}),label:e.jsxs(f,{sx:{display:"flex",alignItems:"center",cursor:"pointer"},children:[b("webhookEndpoint.selectAllEvents"),e.jsx(f,{sx:{display:"flex",alignItems:"center"},children:e.jsx(A,{title:b("webhookEndpoint.selectAllEventsTooltip"),placement:"right",children:e.jsx(X,{fontSize:"small",sx:{ml:.5,cursor:"help"}})})})]}),sx:{m:0}}),a>0&&e.jsx(S,{variant:"body2",color:"primary",sx:{ml:"auto"},children:b("webhookEndpoint.selectedEventsCount",{count:a})})]}),e.jsx(f,{sx:{maxHeight:"50vh",overflow:"auto"},children:e.jsx(G,{disablePadding:!0,sx:{border:"1px solid #e0e0e0",borderRadius:"4px"},children:Object.entries(t).map(([r,{source:w,events:g,count:E}],u)=>{const M=n[r]>0,i=n[r]===g.length&&g.length>0,x=R[r];return e.jsxs(Z.Fragment,{children:[e.jsx(Q,{sx:{borderBottom:u<Object.keys(t).length-1?"1px solid #f0f0f0":"none",px:2,py:1.5,"&:hover":{bgcolor:"rgba(0, 0, 0, 0.02)"}},children:e.jsxs(f,{sx:{display:"flex",width:"100%",justifyContent:"space-between",alignItems:"center"},onClick:s=>{s.target.closest(".MuiFormControlLabel-root")||T(r,s)},children:[e.jsx(f,{sx:{display:"flex",alignItems:"center"},children:g.length>0&&e.jsx(ae,{control:e.jsx(V,{checked:i,indeterminate:M&&!i,onChange:s=>{s.stopPropagation(),y(g,i)}}),label:e.jsxs(f,{sx:{display:"flex",alignItems:"center",gap:1},children:[w.logo&&e.jsx(Re,{src:w.logo,sx:{width:24,height:24}}),e.jsx(f,{children:w.title||r}),M&&e.jsx(O,{label:b("webhookEndpoint.selectedCount",{count:n[r]}),size:"small",sx:{mt:"2px",height:"20px",fontSize:"12px",bgcolor:s=>`${s.palette.primary.main}20`,color:"primary.main",fontWeight:500}})]}),sx:{m:0,"& .MuiFormControlLabel-label":{flex:1}}})}),e.jsxs(f,{sx:{display:"flex",alignItems:"center"},children:[e.jsx(S,{variant:"body2",color:"text.secondary",sx:{mr:1},children:b("webhookEndpoint.eventsCount",{count:E})}),g.length>0&&e.jsx(_,{size:"small",edge:"end",children:x?e.jsx(Ke,{}):e.jsx(Ye,{})})]})]})}),g.length>0&&e.jsx(Ie,{in:x,timeout:"auto",unmountOnExit:!0,children:e.jsx(G,{disablePadding:!0,sx:{pl:2,pr:2,py:1,bgcolor:"rgba(0, 0, 0, 0.01)"},children:g.map(s=>{const m=`${s.type}-${s.source}`,k=!!d[m];return e.jsx(Q,{dense:!0,sx:{py:.75},onClick:()=>j(s),children:e.jsxs(f,{sx:{display:"flex",alignItems:"flex-start",width:"100%"},children:[e.jsx(V,{checked:k,sx:{mr:1}}),e.jsxs(f,{children:[e.jsx(S,{variant:"body1",sx:{cursor:"pointer"},children:s.type}),e.jsx(S,{variant:"caption",color:"text.disabled",sx:{display:"block",cursor:"pointer"},children:s.description})]})]})},m)})})})]},r)})})}),l&&e.jsx(Me,{error:!0,sx:{mt:1},children:l})]})}te.propTypes={eventsBySource:o.objectOf(o.shape({source:o.shape({did:o.string.isRequired,title:o.string,description:o.string,version:o.string,logo:o.string}).isRequired,events:o.arrayOf(o.shape({type:o.string.isRequired,description:o.string.isRequired,source:o.string.isRequired})).isRequired,count:o.number.isRequired})).isRequired,selectedEvents:o.objectOf(o.bool).isRequired,setSelectedEvents:o.func.isRequired,error:o.string};te.defaultProps={error:null};function oe({id:t,url:d,description:c,enabledEvents:l,onSubmit:b,onClose:R}){var s;const{t:p}=q(),[n,a]=C.useState({}),{teamDid:v}=F(),{api:T}=N(),{loading:j,error:y,eventsBySource:h}=Ze(),{control:r,handleSubmit:w,formState:{errors:g},reset:E,setValue:u,trigger:M}=ve({defaultValues:{url:"",description:""}});C.useEffect(()=>{const m=Object.values(n).some(k=>k);u("selectedEvents",m?"valid":""),M("selectedEvents")},[n,u,M]);const i=()=>{a({}),E(),R()},x=async m=>{const k=Object.keys(n).filter(I=>n[I]),D={url:m.url,description:m.description,enabledEvents:k.map(I=>{const[$,L]=I.split("-");return!$||!L?null:{type:$,source:L}}).filter(Boolean)};try{if(t){const I=await T.updateWebhookEndpoint({input:{teamDid:v,id:t,data:D}});W.success(`${p("webhookEndpoint.updateWebhook")} ${p("webhookEndpoint.success")}`),b(I)}else{const I=await T.createWebhookEndpoint({input:{teamDid:v,input:D}});W.success(`${p("webhookEndpoint.createWebhook")} ${p("webhookEndpoint.success")}`),b(I)}}catch(I){W.error(I==null?void 0:I.message)}i()};return C.useEffect(()=>{E({url:d,description:c}),a(l.reduce((m,k)=>(m[`${k.type}-${k.source}`]=!0,m),{}))},[E,a,d,c,l]),e.jsx(Ee,{open:!0,onClose:i,maxWidth:"lg",fullWidth:!0,sx:{"& .MuiDialog-paper":{minHeight:600}},children:e.jsxs("form",{onSubmit:w(x),children:[e.jsx(Ce,{children:p(t?"webhookEndpoint.editWebhookTitle":"webhookEndpoint.createWebhookTitle")}),e.jsx(Te,{children:e.jsxs(f,{sx:{display:"flex",flexDirection:"column",gap:2,mt:2},children:[e.jsx(K,{name:"url",control:r,rules:{required:p("webhookEndpoint.validation.urlRequired"),pattern:{value:/^(http|https):\/\/[^ "]+$/,message:p("webhookEndpoint.validation.urlInvalid")}},render:({field:m})=>{var k;return e.jsx(ie,{...m,label:p("webhookEndpoint.url.label"),fullWidth:!0,error:!!g.url,helperText:(k=g.url)==null?void 0:k.message})}}),e.jsx(K,{name:"description",control:r,rules:{required:p("webhookEndpoint.validation.descriptionRequired")},render:({field:m})=>{var k;return e.jsx(ie,{...m,label:p("webhookEndpoint.description.label"),fullWidth:!0,multiline:!0,minRows:2,maxRows:4,error:!!g.description,helperText:(k=g.description)==null?void 0:k.message})}}),e.jsx(K,{name:"selectedEvents",control:r,rules:{required:p("webhookEndpoint.validation.eventRequired")},render:({field:m})=>e.jsx("input",{type:"hidden",...m})}),!j&&h&&Object.keys(h).length>0&&e.jsx(te,{eventsBySource:h,selectedEvents:n,setSelectedEvents:a,error:(s=g.selectedEvents)==null?void 0:s.message}),!j&&(!h||Object.keys(h).length===0)&&e.jsx(S,{color:"text.secondary",children:p("webhookEndpoint.noAvailableEvents")}),j&&e.jsx(f,{sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"500px",width:"100%"},children:e.jsx(U,{size:20})}),y&&e.jsx(ee,{severity:"error",children:p("webhookEndpoint.loadingError",{message:y==null?void 0:y.message})})]})}),e.jsxs(Se,{sx:{p:"8px 24px 24px"},children:[e.jsx(B,{onClick:i,children:p("common.cancel")}),e.jsx(B,{type:"submit",variant:"contained",color:"primary",children:p(t?"webhookEndpoint.updateWebhook":"webhookEndpoint.saveWebhook")})]})]})})}oe.propTypes={onSubmit:o.func.isRequired,id:o.string,url:o.string,description:o.string,enabledEvents:o.arrayOf(o.shape({type:o.string.isRequired,source:o.string.isRequired})),onClose:o.func};oe.defaultProps={id:null,url:"",description:"",enabledEvents:[],onClose:()=>{}};function he(t){switch(t){case"enabled":return"success";case"disabled":default:return"default"}}const Xe=(t="en")=>t==="tw"?"zh":t;function H(t,d="YYYY-MM-DD HH:mm:ss",c="en"){return t?ke(t).locale(Xe(c)).format(d):"-"}function et(t){return typeof t=="number"?!1:ue(t)}function tt(t){return t>=200&&t<300}function z(t){const d=et(t.value);return e.jsxs(e.Fragment,{children:[e.jsxs(P,{direction:"column",alignItems:"flex-start",children:[e.jsxs(S,{component:"div",variant:"body1",mb:1,color:"text.primary",sx:{fontWeight:500},children:[t.label,!!t.tip&&e.jsx(A,{title:t.tip,children:e.jsx(Pe,{fontSize:"small"})})]}),e.jsx(S,{component:"div",variant:"body1",color:d?"text.disabled":"text.secondary",sx:{width:"100%",minHeight:"24px"},children:d?"-":t.value})]}),t.divider&&e.jsx(De,{orientation:"vertical",flexItem:!0})]})}z.propTypes={label:o.oneOfType([o.string,o.node]).isRequired,value:o.oneOfType([o.string,o.node]).isRequired,tip:o.oneOfType([o.string,o.node]),divider:o.bool};z.defaultProps={tip:"",divider:!1};function ne(t){return e.jsxs(P,{className:"section-header",direction:"row",justifyContent:"space-between",alignItems:"center",flexWrap:"wrap",gap:1,sx:{mb:t.mb,mt:t.mt,pb:1},children:[e.jsx(S,{variant:"h3",sx:{fontSize:{xs:"18px",md:"1.09375rem"}},component:"div",children:t.title}),t.children]})}ne.propTypes={title:o.oneOfType([o.string,o.node]).isRequired,children:o.node,mb:o.number,mt:o.number};ne.defaultProps={children:null,mb:1.5,mt:1.5};const ot={width:24,height:24,body:'<path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 6H6a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2v-6m-7 1l9-9m-5 0h5v5"/>'},nt=t=>{const d={};return t.forEach(c=>{var b;const l=new Date(c.createdAt).toLocaleDateString();d[l]||(d[l]=[]),(b=d[l])==null||b.push(c)}),d};function se({eventId:t,webhookEndpointId:d,event:c}){const{api:l}=N(),{t:b}=q(),{teamDid:R}=F(),{blocklet:p}=ce(),{data:n,loadMore:a,loadingMore:v,loading:T}=ye(u=>{const i=u?Math.ceil(u.list.length/15)+1:1;return l.getWebhookAttempts({input:{teamDid:R,input:{eventId:t,webhookId:d},paging:{page:i,pageSize:15}}})},{reloadDeps:[t,d]}),j=(n==null?void 0:n.list)||[],[y,h]=C.useState(null),r=nt(j);C.useEffect(()=>{!y&&(n!=null&&n.list.length)&&h(n.list[0])},[n==null?void 0:n.list.length,y]);const w=u=>{h(u)};if(T)return e.jsx(U,{});const g=n&&n.list.length<n.paging.total,E=u=>{var M,i,x,s,m;if(u.responseBody&&((M=u.responseBody)!=null&&M.sessionId)&&((i=u.responseBody)!=null&&i.projectId)&&((x=u.responseBody)!=null&&x.agentId)){const k=(m=(s=p==null?void 0:p.site)==null?void 0:s.domainAliases[0])==null?void 0:m.value,D=(p.children||[]).find($=>{var L;return((L=$==null?void 0:$.meta)==null?void 0:L.name)==="ai-studio"}),I=Ve(Je(`https://${k}`,(D==null?void 0:D.mountPoint)||"","projects",u.responseBody.projectId,"logs/main"),{sessionId:u.responseBody.sessionId,agentId:u.responseBody.agentId});return e.jsx(_,{sx:{fontSize:20},onClick:()=>window.open(I,"_blank"),children:e.jsx(f,{component:be,icon:ot})})}return null};return e.jsxs(J,{container:!0,spacing:{xs:0,md:1},sx:{height:1},children:[e.jsx(J,{item:!0,xs:12,md:4,height:1,children:ue(Object.keys(r))?e.jsx(S,{color:"text.secondary",children:b("webhookEndpoint.waitingForEvents")}):e.jsxs(e.Fragment,{children:[e.jsx(G,{sx:{maxHeight:"calc(100% - 40px)",py:0,overflowY:"auto"},children:Object.entries(r).map(([u,M])=>e.jsxs(Z.Fragment,{children:[e.jsx(ze,{children:u}),M.map(i=>e.jsxs(Q,{sx:{cursor:"pointer"},onClick:()=>w(i),selected:y===i,secondaryAction:e.jsx(S,{color:"text.secondary",children:H(i.createdAt,"HH:mm:ss")}),children:[e.jsx(We,{sx:{minWidth:0,mr:1.5},children:tt(i.responseStatus)===!1?e.jsx(Ae,{color:"error"}):e.jsx(Oe,{color:"success"})}),e.jsx($e,{primary:e.jsx(S,{color:"text.primary",children:i.event.type})})]},i.id))]},u))}),g&&e.jsx(f,{display:"flex",justifyContent:"center",alignItems:"center",width:1,children:e.jsx(B,{variant:"text",type:"button",color:"inherit",onClick:a,disabled:v,sx:{color:u=>u.palette.text.disabled},children:b(v?"webhookEndpoint.loadingMore":"webhookEndpoint.loadMore")})})]})}),e.jsxs(J,{item:!0,xs:12,md:8,height:1,children:[y&&e.jsxs(P,{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(f,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(S,{variant:"h6",children:t?y.endpoint.url:y.event.type}),e.jsx(f,{children:E(y)})]}),e.jsxs(f,{children:[e.jsxs(S,{variant:"h6",children:[b("webhookEndpoint.response")," (",y.responseStatus,")"]}),e.jsx(Y,{language:"json",children:JSON.stringify(y.responseBody,null,2)})]}),e.jsxs(f,{children:[e.jsx(P,{direction:"row",alignItems:"center",spacing:1,children:e.jsx(S,{variant:"h6",children:b("webhookEndpoint.request")})}),e.jsx(Y,{language:"json",sx:{margin:0},children:JSON.stringify(y.event,null,2)})]})]}),(n==null?void 0:n.list.length)===0&&c&&e.jsxs(f,{children:[e.jsx(P,{direction:"row",alignItems:"center",spacing:1,children:e.jsx(S,{variant:"h6",children:b("webhookEndpoint.eventData")})}),e.jsx(Y,{language:"json",sx:{margin:0},children:JSON.stringify(c.data,null,2)})]})]})]})}se.propTypes={eventId:o.string,webhookEndpointId:o.string,event:o.shape({type:o.string,data:o.object,request:o.object,requestInfo:o.object})};se.defaultProps={eventId:"",webhookEndpointId:"",event:null};function xe({id:t,onClose:d}){var v,T,j,y;const{t:c}=q(),{api:l}=N(),{teamDid:b}=F(),{loading:R,error:p,data:n}=de(()=>l.getWebhookEndpoint({input:{teamDid:b,id:t}})),a=n==null?void 0:n.data;return p?e.jsx(ee,{severity:"error",children:p.message}):R||!a?e.jsx(f,{display:"flex",justifyContent:"center",alignItems:"center",height:1,width:1,children:e.jsx(U,{})}):e.jsxs(st,{direction:"column",sx:{height:{xs:"auto",md:1}},children:[e.jsxs(f,{children:[e.jsxs(P,{direction:"row",justifyContent:"space-between",alignItems:"center",children:[e.jsx(P,{flex:1,width:0,children:e.jsxs(f,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(S,{variant:"h5",fontWeight:600,sx:{overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis"},children:a.description}),e.jsx(A,{title:a.url,children:e.jsx(X,{sx:{fontSize:"16px",marginTop:"2px"}})})]})}),e.jsx(P,{direction:"row",alignItems:"center",children:e.jsx(_,{edge:"end",color:"inherit",onClick:d,children:e.jsx(Le,{})})})]}),e.jsx(f,{mt:2,children:e.jsxs(P,{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(z,{label:c("common.status"),value:e.jsx(O,{size:"small",variant:"filled",label:a.status,color:he(a.status),sx:{borderRadius:"4px",lineHeight:"20px",textTransform:"capitalize"}}),divider:!0}),e.jsx(z,{label:c("webhookEndpoint.listen"),value:e.jsx(A,{arrow:!0,title:e.jsx("ul",{style:{padding:0,margin:0},children:a.enabledEvents.map(h=>e.jsx("li",{style:{fontSize:"0.7875rem"},children:h==null?void 0:h.type},h))}),children:e.jsx(O,{size:"small",variant:"filled",label:c("webhookEndpoint.eventsCount",{count:a.enabledEvents.length}),sx:{borderRadius:"4px",lineHeight:"20px",textTransform:"capitalize"}})}),divider:!0}),e.jsx(z,{label:c("webhookEndpoint.version"),value:a.apiVersion,divider:!0}),e.jsx(z,{label:c("common.createdAt"),value:H(a.createdAt),divider:!0}),e.jsx(z,{label:c("common.updatedAt"),value:H(a.updatedAt),divider:!0}),e.jsx(z,{label:c("common.createdBy"),value:e.jsx(A,{arrow:!0,title:(v=a.createUser)==null?void 0:v.did,children:e.jsx(O,{size:"small",variant:"filled",label:(T=a.createUser)==null?void 0:T.fullName,sx:{borderRadius:"4px",lineHeight:"20px",textTransform:"capitalize"}})}),divider:!0}),e.jsx(z,{label:c("common.updatedBy"),value:e.jsx(A,{arrow:!0,title:(j=a.updateUser)==null?void 0:j.did,children:e.jsx(O,{size:"small",variant:"filled",label:(y=a.updateUser)==null?void 0:y.fullName,sx:{borderRadius:"4px",lineHeight:"20px",textTransform:"capitalize"}})})})]})})]}),e.jsxs(P,{className:"section",flex:1,height:0,overflow:"hidden",children:[e.jsx(ne,{title:c("webhookEndpoint.attempts"),mb:0,mt:4}),e.jsx(P,{height:0,flex:1,overflow:"hidden",children:e.jsx(se,{webhookEndpointId:a.id})})]})]})}xe.propTypes={id:o.string.isRequired,onClose:o.func.isRequired};const st=pe(P)``;function me({open:t,onClose:d,id:c}){return e.jsx(qe,{anchor:"right",open:t,onClose:d,PaperProps:{sx:{width:"90vw",maxWidth:"1200px"}},children:e.jsx(f,{sx:{height:"100vh",p:3},children:e.jsx(xe,{id:c,onClose:d})})})}me.propTypes={open:o.bool.isRequired,onClose:o.func.isRequired,id:o.string.isRequired};function le(){return null}const re=Z.memo(({options:t,columns:d,toolbar:c=!0,footer:l=!0,hasRowLink:b=!1,emptyNodeText:R="",...p})=>{const{locale:n}=q(),a=Be(j=>j.breakpoints.down("md")),v={print:!1,download:!1,filter:!1,selectableRows:"none",rowsPerPage:a?5:10,rowsPerPageOptions:[5,10,20,50,100],searchDebounceTime:300,tableBodyHeight:"100%",loading:!0},T={};return c||(T.TableToolbar=le),l||(T.TableFooter=le),e.jsx(rt,{locale:n,options:{...v,...t},columns:(d||[]).map(j=>(j.options=j.options||{},j.options.filter=j.options.filter||!1,j.options.sort=j.options.sort||!1,j)),emptyNode:e.jsx(fe,{children:R}),...p,components:T,hasRowLink:b,isMobile:a})});re.propTypes={options:o.object,columns:o.array,toolbar:o.bool,footer:o.bool,hasRowLink:o.bool,emptyNodeText:o.node,durable:o.string,durableKeys:o.array,data:o.array,loading:o.bool,onChange:o.func,title:o.node,components:o.object};re.defaultProps={options:{},columns:[],toolbar:!0,footer:!0,hasRowLink:!1,emptyNodeText:null,durable:"",durableKeys:[],data:[],loading:!1,onChange:()=>{},title:null,components:{}};const rt=pe(ge)`
|
|
1
|
+
import{u as q,Y as W,bI as Y,h as be,_ as fe,a5 as ge,bJ as je}from"./vendor-ux-did-connect-DEbq97Xz.js";import{x as ye,m as de,j as we}from"./vendor-hooks-DN4nZ7TU.js";import{r as C,b as X}from"./vendor-react-DEoibe3W.js";import{d as Z}from"./InfoOutlined-CEHciuDy.js";import{z as N,C as ce,t as ke}from"./index-CwaFNZTA.js";import{u as F,a as ve,C as K}from"./dashboard-BX25tvc1.js";import{E as o,j as e,D as Ee,ac as Ce,r as Te,a4 as f,M as ie,T as S,a3 as U,ad as ee,y as Se,x as B,br as ae,bN as J,a5 as A,L as Q,z as G,bk as Re,A as O,I as _,C as Ie,bp as Me,ae as P,c3 as Pe,al as De,bf as V,bo as ze,b3 as We,c4 as Ae,c5 as Oe,b4 as $e,ag as qe,bY as Le,s as pe,t as Be,c6 as He,c7 as Ne,c8 as Fe,c9 as Ue,ca as _e}from"./vendor-mui-core-1jJmAutq.js";import{l as Ye}from"./vendor-arcblock-V3HYELzG.js";import{d as Ke}from"./ExpandLess-1B6PdCYC.js";import{z as ue,x as Je,y as Ve}from"./vendor-utils-C3FZIS9A.js";import{C as Qe}from"./confirm-D36_98HC.js";import{A as Ge}from"./actions-CAL1KFv7.js";import"./lottie-web-jYmAQWuC.js";import"./useLocalStorage-Cq9THoCr.js";import"./PlayArrow-DpcMtsY5.js";import"./get-safe-url-D_Puq_oh.js";import"./format-error-BrmqJs5a.js";import"./index-uyugLR5M.js";import"./session-0rF5SuCk.js";import"./useAsyncRetry-W2lp7mi1.js";import"./useAsync-BxB2TpDl.js";import"./useSetState-CWq0AVWn.js";import"./use-mobile-DpXDDjat.js";import"./MoreHoriz-THEF6D0C.js";const Xe=t=>{var j,y;const[d,c]=C.useState(null),[l,b]=C.useState(!t),[R,p]=C.useState(null),{blocklet:n}=ce(),a=(y=(j=n==null?void 0:n.site)==null?void 0:j.domainAliases[0])==null?void 0:y.value,v=C.useMemo(()=>{const h={};return d&&(d.sources.forEach(r=>{h[r.did]={source:r,events:[],count:0}}),d.events.forEach(r=>{h[r.source]&&(h[r.source].events.push(r),h[r.source].count+=1)})),h},[d]),T=async()=>{try{if(b(!0),!a)return;const r=await(await fetch(`https://${a}/.well-known/service/openevent.json`)).json();c(r),p(null)}catch(h){p(h instanceof Error?h:new Error(String(h)))}finally{b(!1)}};return C.useEffect(()=>{T()},[a]),{openEvent:d,setOpenEvent:c,eventsBySource:v,loading:l,error:R,loadData:T}};function te({eventsBySource:t,selectedEvents:d,setSelectedEvents:c,error:l}){const{t:b}=q(),[R,p]=C.useState({}),n=C.useMemo(()=>{const r={};return Object.entries(t).forEach(([w,{events:g}])=>{const E=g.filter(u=>d[`${u.type}-${u.source}`]).length;r[w]=E}),r},[t,d]),a=C.useMemo(()=>Object.values(n).reduce((r,w)=>r+w,0),[n]),v=C.useMemo(()=>Object.values(t).reduce((r,{events:w})=>r+w.length,0),[t]),T=(r,w)=>{w.stopPropagation(),p({...R,[r]:!R[r]})},j=r=>{const w=`${r.type}-${r.source}`;c(g=>({...g,[w]:!g[w]}))},y=(r,w)=>{const g={};r.forEach(E=>{const u=`${E.type}-${E.source}`;g[u]=!w}),c(E=>({...E,...g}))},h=r=>{const w={};Object.values(t).forEach(({events:g})=>{g.forEach(E=>{const u=`${E.type}-${E.source}`;w[u]=r.target.checked})}),c(w)};return e.jsxs(f,{sx:{width:"100%"},children:[e.jsxs(f,{sx:{display:"flex",alignItems:"center",mb:1,mt:1},children:[e.jsx(ae,{control:e.jsx(J,{onChange:h,checked:a>0&&a===v}),label:e.jsxs(f,{sx:{display:"flex",alignItems:"center",cursor:"pointer"},children:[b("webhookEndpoint.selectAllEvents"),e.jsx(f,{sx:{display:"flex",alignItems:"center"},children:e.jsx(A,{title:b("webhookEndpoint.selectAllEventsTooltip"),placement:"right",children:e.jsx(Z,{fontSize:"small",sx:{ml:.5,cursor:"help"}})})})]}),sx:{m:0}}),a>0&&e.jsx(S,{variant:"body2",color:"primary",sx:{ml:"auto"},children:b("webhookEndpoint.selectedEventsCount",{count:a})})]}),e.jsx(f,{sx:{maxHeight:"50vh",overflow:"auto"},children:e.jsx(Q,{disablePadding:!0,sx:{border:"1px solid #e0e0e0",borderRadius:"4px"},children:Object.entries(t).map(([r,{source:w,events:g,count:E}],u)=>{const M=n[r]>0,i=n[r]===g.length&&g.length>0,x=R[r];return e.jsxs(X.Fragment,{children:[e.jsx(G,{sx:{borderBottom:u<Object.keys(t).length-1?"1px solid #f0f0f0":"none",px:2,py:1.5,"&:hover":{bgcolor:"rgba(0, 0, 0, 0.02)"}},children:e.jsxs(f,{sx:{display:"flex",width:"100%",justifyContent:"space-between",alignItems:"center"},onClick:s=>{s.target.closest(".MuiFormControlLabel-root")||T(r,s)},children:[e.jsx(f,{sx:{display:"flex",alignItems:"center"},children:g.length>0&&e.jsx(ae,{control:e.jsx(J,{checked:i,indeterminate:M&&!i,onChange:s=>{s.stopPropagation(),y(g,i)}}),label:e.jsxs(f,{sx:{display:"flex",alignItems:"center",gap:1},children:[w.logo&&e.jsx(Re,{src:w.logo,sx:{width:24,height:24}}),e.jsx(f,{children:w.title||r}),M&&e.jsx(O,{label:b("webhookEndpoint.selectedCount",{count:n[r]}),size:"small",sx:{mt:"2px",height:"20px",fontSize:"12px",bgcolor:s=>`${s.palette.primary.main}20`,color:"primary.main",fontWeight:500}})]}),sx:{m:0,"& .MuiFormControlLabel-label":{flex:1}}})}),e.jsxs(f,{sx:{display:"flex",alignItems:"center"},children:[e.jsx(S,{variant:"body2",color:"text.secondary",sx:{mr:1},children:b("webhookEndpoint.eventsCount",{count:E})}),g.length>0&&e.jsx(_,{size:"small",edge:"end",children:x?e.jsx(Ke,{}):e.jsx(Ye,{})})]})]})}),g.length>0&&e.jsx(Ie,{in:x,timeout:"auto",unmountOnExit:!0,children:e.jsx(Q,{disablePadding:!0,sx:{pl:2,pr:2,py:1,bgcolor:"rgba(0, 0, 0, 0.01)"},children:g.map(s=>{const m=`${s.type}-${s.source}`,k=!!d[m];return e.jsx(G,{dense:!0,sx:{py:.75},onClick:()=>j(s),children:e.jsxs(f,{sx:{display:"flex",alignItems:"flex-start",width:"100%"},children:[e.jsx(J,{checked:k,sx:{mr:1}}),e.jsxs(f,{children:[e.jsx(S,{variant:"body1",sx:{cursor:"pointer"},children:s.type}),e.jsx(S,{variant:"caption",color:"text.disabled",sx:{display:"block",cursor:"pointer"},children:s.description})]})]})},m)})})})]},r)})})}),l&&e.jsx(Me,{error:!0,sx:{mt:1},children:l})]})}te.propTypes={eventsBySource:o.objectOf(o.shape({source:o.shape({did:o.string.isRequired,title:o.string,description:o.string,version:o.string,logo:o.string}).isRequired,events:o.arrayOf(o.shape({type:o.string.isRequired,description:o.string.isRequired,source:o.string.isRequired})).isRequired,count:o.number.isRequired})).isRequired,selectedEvents:o.objectOf(o.bool).isRequired,setSelectedEvents:o.func.isRequired,error:o.string};te.defaultProps={error:null};function oe({id:t,url:d,description:c,enabledEvents:l,onSubmit:b,onClose:R}){var s;const{t:p}=q(),[n,a]=C.useState({}),{teamDid:v}=F(),{api:T}=N(),{loading:j,error:y,eventsBySource:h}=Xe(),{control:r,handleSubmit:w,formState:{errors:g},reset:E,setValue:u,trigger:M}=ve({defaultValues:{url:"",description:""}});C.useEffect(()=>{const m=Object.values(n).some(k=>k);u("selectedEvents",m?"valid":""),M("selectedEvents")},[n,u,M]);const i=()=>{a({}),E(),R()},x=async m=>{const k=Object.keys(n).filter(I=>n[I]),D={url:m.url,description:m.description,enabledEvents:k.map(I=>{const[$,L]=I.split("-");return!$||!L?null:{type:$,source:L}}).filter(Boolean)};try{if(t){const I=await T.updateWebhookEndpoint({input:{teamDid:v,id:t,data:D}});W.success(`${p("webhookEndpoint.updateWebhook")} ${p("webhookEndpoint.success")}`),b(I)}else{const I=await T.createWebhookEndpoint({input:{teamDid:v,input:D}});W.success(`${p("webhookEndpoint.createWebhook")} ${p("webhookEndpoint.success")}`),b(I)}}catch(I){W.error(I==null?void 0:I.message)}i()};return C.useEffect(()=>{E({url:d,description:c}),a(l.reduce((m,k)=>(m[`${k.type}-${k.source}`]=!0,m),{}))},[E,a,d,c,l]),e.jsx(Ee,{open:!0,onClose:i,maxWidth:"lg",fullWidth:!0,sx:{"& .MuiDialog-paper":{minHeight:600}},children:e.jsxs("form",{onSubmit:w(x),children:[e.jsx(Ce,{children:p(t?"webhookEndpoint.editWebhookTitle":"webhookEndpoint.createWebhookTitle")}),e.jsx(Te,{children:e.jsxs(f,{sx:{display:"flex",flexDirection:"column",gap:2,mt:2},children:[e.jsx(K,{name:"url",control:r,rules:{required:p("webhookEndpoint.validation.urlRequired"),pattern:{value:/^(http|https):\/\/[^ "]+$/,message:p("webhookEndpoint.validation.urlInvalid")}},render:({field:m})=>{var k;return e.jsx(ie,{...m,label:p("webhookEndpoint.url.label"),fullWidth:!0,error:!!g.url,helperText:(k=g.url)==null?void 0:k.message})}}),e.jsx(K,{name:"description",control:r,rules:{required:p("webhookEndpoint.validation.descriptionRequired")},render:({field:m})=>{var k;return e.jsx(ie,{...m,label:p("webhookEndpoint.description.label"),fullWidth:!0,multiline:!0,minRows:2,maxRows:4,error:!!g.description,helperText:(k=g.description)==null?void 0:k.message})}}),e.jsx(K,{name:"selectedEvents",control:r,rules:{required:p("webhookEndpoint.validation.eventRequired")},render:({field:m})=>e.jsx("input",{type:"hidden",...m})}),!j&&h&&Object.keys(h).length>0&&e.jsx(te,{eventsBySource:h,selectedEvents:n,setSelectedEvents:a,error:(s=g.selectedEvents)==null?void 0:s.message}),!j&&(!h||Object.keys(h).length===0)&&e.jsx(S,{color:"text.secondary",children:p("webhookEndpoint.noAvailableEvents")}),j&&e.jsx(f,{sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"500px",width:"100%"},children:e.jsx(U,{size:20})}),y&&e.jsx(ee,{severity:"error",children:p("webhookEndpoint.loadingError",{message:y==null?void 0:y.message})})]})}),e.jsxs(Se,{sx:{p:"8px 24px 24px"},children:[e.jsx(B,{onClick:i,children:p("common.cancel")}),e.jsx(B,{type:"submit",variant:"contained",color:"primary",children:p(t?"webhookEndpoint.updateWebhook":"webhookEndpoint.saveWebhook")})]})]})})}oe.propTypes={onSubmit:o.func.isRequired,id:o.string,url:o.string,description:o.string,enabledEvents:o.arrayOf(o.shape({type:o.string.isRequired,source:o.string.isRequired})),onClose:o.func};oe.defaultProps={id:null,url:"",description:"",enabledEvents:[],onClose:()=>{}};function he(t){switch(t){case"enabled":return"success";case"disabled":default:return"default"}}const Ze=(t="en")=>t==="tw"?"zh":t;function H(t,d="YYYY-MM-DD HH:mm:ss",c="en"){return t?ke(t).locale(Ze(c)).format(d):"-"}function et(t){return typeof t=="number"?!1:ue(t)}function tt(t){return t>=200&&t<300}function z(t){const d=et(t.value);return e.jsxs(e.Fragment,{children:[e.jsxs(P,{direction:"column",alignItems:"flex-start",children:[e.jsxs(S,{component:"div",variant:"body1",mb:1,color:"text.primary",sx:{fontWeight:500},children:[t.label,!!t.tip&&e.jsx(A,{title:t.tip,children:e.jsx(Pe,{fontSize:"small"})})]}),e.jsx(S,{component:"div",variant:"body1",color:d?"text.disabled":"text.secondary",sx:{width:"100%",minHeight:"24px"},children:d?"-":t.value})]}),t.divider&&e.jsx(De,{orientation:"vertical",flexItem:!0})]})}z.propTypes={label:o.oneOfType([o.string,o.node]).isRequired,value:o.oneOfType([o.string,o.node]).isRequired,tip:o.oneOfType([o.string,o.node]),divider:o.bool};z.defaultProps={tip:"",divider:!1};function ne(t){return e.jsxs(P,{className:"section-header",direction:"row",justifyContent:"space-between",alignItems:"center",flexWrap:"wrap",gap:1,sx:{mb:t.mb,mt:t.mt,pb:1},children:[e.jsx(S,{variant:"h3",sx:{fontSize:{xs:"18px",md:"1.09375rem"}},component:"div",children:t.title}),t.children]})}ne.propTypes={title:o.oneOfType([o.string,o.node]).isRequired,children:o.node,mb:o.number,mt:o.number};ne.defaultProps={children:null,mb:1.5,mt:1.5};const ot={width:24,height:24,body:'<path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 6H6a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2v-6m-7 1l9-9m-5 0h5v5"/>'},nt=t=>{const d={};return t.forEach(c=>{var b;const l=new Date(c.createdAt).toLocaleDateString();d[l]||(d[l]=[]),(b=d[l])==null||b.push(c)}),d};function se({eventId:t,webhookEndpointId:d,event:c}){const{api:l}=N(),{t:b}=q(),{teamDid:R}=F(),{blocklet:p}=ce(),{data:n,loadMore:a,loadingMore:v,loading:T}=ye(u=>{const i=u?Math.ceil(u.list.length/15)+1:1;return l.getWebhookAttempts({input:{teamDid:R,input:{eventId:t,webhookId:d},paging:{page:i,pageSize:15}}})},{reloadDeps:[t,d]}),j=(n==null?void 0:n.list)||[],[y,h]=C.useState(null),r=nt(j);C.useEffect(()=>{!y&&(n!=null&&n.list.length)&&h(n.list[0])},[n==null?void 0:n.list.length,y]);const w=u=>{h(u)};if(T)return e.jsx(U,{});const g=n&&n.list.length<n.paging.total,E=u=>{var M,i,x,s,m;if(u.responseBody&&((M=u.responseBody)!=null&&M.sessionId)&&((i=u.responseBody)!=null&&i.projectId)&&((x=u.responseBody)!=null&&x.agentId)){const k=(m=(s=p==null?void 0:p.site)==null?void 0:s.domainAliases[0])==null?void 0:m.value,D=(p.children||[]).find($=>{var L;return((L=$==null?void 0:$.meta)==null?void 0:L.name)==="ai-studio"}),I=Je(Ve(`https://${k}`,(D==null?void 0:D.mountPoint)||"","projects",u.responseBody.projectId,"logs/main"),{sessionId:u.responseBody.sessionId,agentId:u.responseBody.agentId});return e.jsx(_,{sx:{fontSize:20},onClick:()=>window.open(I,"_blank"),children:e.jsx(f,{component:be,icon:ot})})}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:ue(Object.keys(r))?e.jsx(S,{color:"text.secondary",children:b("webhookEndpoint.waitingForEvents")}):e.jsxs(e.Fragment,{children:[e.jsx(Q,{sx:{maxHeight:"calc(100% - 40px)",py:0,overflowY:"auto"},children:Object.entries(r).map(([u,M])=>e.jsxs(X.Fragment,{children:[e.jsx(ze,{children:u}),M.map(i=>e.jsxs(G,{sx:{cursor:"pointer"},onClick:()=>w(i),selected:y===i,secondaryAction:e.jsx(S,{color:"text.secondary",children:H(i.createdAt,"HH:mm:ss")}),children:[e.jsx(We,{sx:{minWidth:0,mr:1.5},children:tt(i.responseStatus)===!1?e.jsx(Ae,{color:"error"}):e.jsx(Oe,{color:"success"})}),e.jsx($e,{primary:e.jsx(S,{color:"text.primary",children:i.event.type})})]},i.id))]},u))}),g&&e.jsx(f,{display:"flex",justifyContent:"center",alignItems:"center",width:1,children:e.jsx(B,{variant:"text",type:"button",color:"inherit",onClick:a,disabled:v,sx:{color:u=>u.palette.text.disabled},children:b(v?"webhookEndpoint.loadingMore":"webhookEndpoint.loadMore")})})]})}),e.jsxs(V,{item:!0,xs:12,md:8,height:1,children:[y&&e.jsxs(P,{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(f,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(S,{variant:"h6",children:t?y.endpoint.url:y.event.type}),e.jsx(f,{children:E(y)})]}),e.jsxs(f,{children:[e.jsxs(S,{variant:"h6",children:[b("webhookEndpoint.response")," (",y.responseStatus,")"]}),e.jsx(Y,{language:"json",children:JSON.stringify(y.responseBody,null,2)})]}),e.jsxs(f,{children:[e.jsx(P,{direction:"row",alignItems:"center",spacing:1,children:e.jsx(S,{variant:"h6",children:b("webhookEndpoint.request")})}),e.jsx(Y,{language:"json",sx:{margin:0},children:JSON.stringify(y.event,null,2)})]})]}),(n==null?void 0:n.list.length)===0&&c&&e.jsxs(f,{children:[e.jsx(P,{direction:"row",alignItems:"center",spacing:1,children:e.jsx(S,{variant:"h6",children:b("webhookEndpoint.eventData")})}),e.jsx(Y,{language:"json",sx:{margin:0},children:JSON.stringify(c.data,null,2)})]})]})]})}se.propTypes={eventId:o.string,webhookEndpointId:o.string,event:o.shape({type:o.string,data:o.object,request:o.object,requestInfo:o.object})};se.defaultProps={eventId:"",webhookEndpointId:"",event:null};function xe({id:t,onClose:d}){var v,T,j,y;const{t:c}=q(),{api:l}=N(),{teamDid:b}=F(),{loading:R,error:p,data:n}=de(()=>l.getWebhookEndpoint({input:{teamDid:b,id:t}})),a=n==null?void 0:n.data;return p?e.jsx(ee,{severity:"error",children:p.message}):R||!a?e.jsx(f,{display:"flex",justifyContent:"center",alignItems:"center",height:1,width:1,children:e.jsx(U,{})}):e.jsxs(st,{direction:"column",sx:{height:{xs:"auto",md:1}},children:[e.jsxs(f,{children:[e.jsxs(P,{direction:"row",justifyContent:"space-between",alignItems:"center",children:[e.jsx(P,{flex:1,width:0,children:e.jsxs(f,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(S,{variant:"h5",fontWeight:600,sx:{overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis"},children:a.description}),e.jsx(A,{title:a.url,children:e.jsx(Z,{sx:{fontSize:"16px",marginTop:"2px"}})})]})}),e.jsx(P,{direction:"row",alignItems:"center",children:e.jsx(_,{edge:"end",color:"inherit",onClick:d,children:e.jsx(Le,{})})})]}),e.jsx(f,{mt:2,children:e.jsxs(P,{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(z,{label:c("common.status"),value:e.jsx(O,{size:"small",variant:"filled",label:a.status,color:he(a.status),sx:{borderRadius:"4px",lineHeight:"20px",textTransform:"capitalize"}}),divider:!0}),e.jsx(z,{label:c("webhookEndpoint.listen"),value:e.jsx(A,{arrow:!0,title:e.jsx("ul",{style:{padding:0,margin:0},children:a.enabledEvents.map(h=>e.jsx("li",{style:{fontSize:"0.7875rem"},children:h==null?void 0:h.type},h))}),children:e.jsx(O,{size:"small",variant:"filled",label:c("webhookEndpoint.eventsCount",{count:a.enabledEvents.length}),sx:{borderRadius:"4px",lineHeight:"20px",textTransform:"capitalize"}})}),divider:!0}),e.jsx(z,{label:c("webhookEndpoint.version"),value:a.apiVersion,divider:!0}),e.jsx(z,{label:c("common.createdAt"),value:H(a.createdAt),divider:!0}),e.jsx(z,{label:c("common.updatedAt"),value:H(a.updatedAt),divider:!0}),e.jsx(z,{label:c("common.createdBy"),value:e.jsx(A,{arrow:!0,title:(v=a.createUser)==null?void 0:v.did,children:e.jsx(O,{size:"small",variant:"filled",label:(T=a.createUser)==null?void 0:T.fullName,sx:{borderRadius:"4px",lineHeight:"20px",textTransform:"capitalize"}})}),divider:!0}),e.jsx(z,{label:c("common.updatedBy"),value:e.jsx(A,{arrow:!0,title:(j=a.updateUser)==null?void 0:j.did,children:e.jsx(O,{size:"small",variant:"filled",label:(y=a.updateUser)==null?void 0:y.fullName,sx:{borderRadius:"4px",lineHeight:"20px",textTransform:"capitalize"}})})})]})})]}),e.jsxs(P,{className:"section",flex:1,height:0,overflow:"hidden",children:[e.jsx(ne,{title:c("webhookEndpoint.attempts"),mb:0,mt:4}),e.jsx(P,{height:0,flex:1,overflow:"hidden",children:e.jsx(se,{webhookEndpointId:a.id})})]})]})}xe.propTypes={id:o.string.isRequired,onClose:o.func.isRequired};const st=pe(P)``;function me({open:t,onClose:d,id:c}){return e.jsx(qe,{anchor:"right",open:t,onClose:d,PaperProps:{sx:{width:"90vw",maxWidth:"1200px"}},children:e.jsx(f,{sx:{height:"100vh",p:3},children:e.jsx(xe,{id:c,onClose:d})})})}me.propTypes={open:o.bool.isRequired,onClose:o.func.isRequired,id:o.string.isRequired};function le(){return null}const re=X.memo(({options:t,columns:d,toolbar:c=!0,footer:l=!0,hasRowLink:b=!1,emptyNodeText:R="",...p})=>{const{locale:n}=q(),a=Be(j=>j.breakpoints.down("md")),v={print:!1,download:!1,filter:!1,selectableRows:"none",rowsPerPage:a?5:10,rowsPerPageOptions:[5,10,20,50,100],searchDebounceTime:300,tableBodyHeight:"100%",loading:!0},T={};return c||(T.TableToolbar=le),l||(T.TableFooter=le),e.jsx(rt,{locale:n,options:{...v,...t},columns:(d||[]).map(j=>(j.options=j.options||{},j.options.filter=j.options.filter||!1,j.options.sort=j.options.sort||!1,j)),emptyNode:e.jsx(fe,{children:R}),...p,components:T,hasRowLink:b,isMobile:a})});re.propTypes={options:o.object,columns:o.array,toolbar:o.bool,footer:o.bool,hasRowLink:o.bool,emptyNodeText:o.node,durable:o.string,durableKeys:o.array,data:o.array,loading:o.bool,onChange:o.func,title:o.node,components:o.object};re.defaultProps={options:{},columns:[],toolbar:!0,footer:!0,hasRowLink:!1,emptyNodeText:null,durable:"",durableKeys:[],data:[],loading:!1,onChange:()=>{},title:null,components:{}};const rt=pe(ge)`
|
|
2
2
|
.MuiPaper-root {
|
|
3
3
|
border-radius: 8px;
|
|
4
4
|
overflow: hidden;
|
|
@@ -135,4 +135,4 @@ import{u as q,Z as W,bH as Y,h as be,$ as fe,a6 as ge,bG as je}from"./vendor-ux-
|
|
|
135
135
|
width: inherit;
|
|
136
136
|
}
|
|
137
137
|
}
|
|
138
|
-
`,it=re;function Pt(){const{teamDid:t}=F(),d=`webhook-endpoints-${t}`,c=je(d),{t:l}=q(),{api:b}=N(),[R,p]=C.useState(""),[n,a]=C.useState({webhookDetail:{open:!1,id:null},createEdit:{open:!1,id:null,url:"",description:"",enabledEvents:[]},deleteConfirm:null}),[v,T]=we(d,{defaultValue:{pageSize:c.rowsPerPage||20,page:c.page?c.page+1:1}}),{loading:j,error:y,data:h,refresh:r}=de(()=>b.getWebhookEndpoints({input:{teamDid:t,paging:{page:v.page,pageSize:v.pageSize}}}));C.useEffect(()=>{r()},[v,r]);const w=C.useCallback(async(i,x)=>{try{await b.updateWebhookEndpoint({input:{teamDid:t,id:i.id,data:{status:x?"disabled":"enabled"}}}),r(),W.success(`${l(x?"webhookEndpoint.disable":"webhookEndpoint.enable")}${l("webhookEndpoint.success")}`)}catch(s){W.error(s==null?void 0:s.message)}},[b,t,r,l]),g=C.useCallback(async i=>{try{await b.deleteWebhookEndpoint({input:{teamDid:t,id:i}}),r(),a(x=>({...x,deleteConfirm:null})),W.success(`${l("common.delete")}${l("webhookEndpoint.success")}`)}catch(x){W.error(x==null?void 0:x.message)}},[b,t,r,l]),E=(i,x)=>{let s=i.page+1;const m=i.searchText||"";if(m!==R){p(m);return}if(x==="changePage"||x==="changeRowsPerPage"){x!=="changePage"&&(s=1);const k={page:s,pageSize:i.rowsPerPage};p(""),T(k)}};if(y)return e.jsx(ee,{severity:"error",children:y.message});if(j||!h)return e.jsx(f,{display:"flex",justifyContent:"center",alignItems:"center",width:1,height:500,children:e.jsx(U,{})});const u=((h==null?void 0:h.list)||[]).filter(i=>{if(!R)return!0;const x=R.toLowerCase();return i.description.toLowerCase().includes(x)||i.url.toLowerCase().includes(x)}),M=[{label:"URL",name:"url",options:{customBodyRenderLite:(i,x)=>{const s=u[x];return e.jsxs(f,{sx:{display:"flex",alignItems:"center",cursor:"pointer",gap:.5},children:[e.jsx(S,{variant:"body2",children:s.description}),e.jsx(f,{sx:{display:"flex"},onClick:m=>{m.stopPropagation()},children:e.jsx(A,{title:s.url,children:e.jsx(
|
|
138
|
+
`,it=re;function Pt(){const{teamDid:t}=F(),d=`webhook-endpoints-${t}`,c=je(d),{t:l}=q(),{api:b}=N(),[R,p]=C.useState(""),[n,a]=C.useState({webhookDetail:{open:!1,id:null},createEdit:{open:!1,id:null,url:"",description:"",enabledEvents:[]},deleteConfirm:null}),[v,T]=we(d,{defaultValue:{pageSize:c.rowsPerPage||20,page:c.page?c.page+1:1}}),{loading:j,error:y,data:h,refresh:r}=de(()=>b.getWebhookEndpoints({input:{teamDid:t,paging:{page:v.page,pageSize:v.pageSize}}}));C.useEffect(()=>{r()},[v,r]);const w=C.useCallback(async(i,x)=>{try{await b.updateWebhookEndpoint({input:{teamDid:t,id:i.id,data:{status:x?"disabled":"enabled"}}}),r(),W.success(`${l(x?"webhookEndpoint.disable":"webhookEndpoint.enable")}${l("webhookEndpoint.success")}`)}catch(s){W.error(s==null?void 0:s.message)}},[b,t,r,l]),g=C.useCallback(async i=>{try{await b.deleteWebhookEndpoint({input:{teamDid:t,id:i}}),r(),a(x=>({...x,deleteConfirm:null})),W.success(`${l("common.delete")}${l("webhookEndpoint.success")}`)}catch(x){W.error(x==null?void 0:x.message)}},[b,t,r,l]),E=(i,x)=>{let s=i.page+1;const m=i.searchText||"";if(m!==R){p(m);return}if(x==="changePage"||x==="changeRowsPerPage"){x!=="changePage"&&(s=1);const k={page:s,pageSize:i.rowsPerPage};p(""),T(k)}};if(y)return e.jsx(ee,{severity:"error",children:y.message});if(j||!h)return e.jsx(f,{display:"flex",justifyContent:"center",alignItems:"center",width:1,height:500,children:e.jsx(U,{})});const u=((h==null?void 0:h.list)||[]).filter(i=>{if(!R)return!0;const x=R.toLowerCase();return i.description.toLowerCase().includes(x)||i.url.toLowerCase().includes(x)}),M=[{label:"URL",name:"url",options:{customBodyRenderLite:(i,x)=>{const s=u[x];return e.jsxs(f,{sx:{display:"flex",alignItems:"center",cursor:"pointer",gap:.5},children:[e.jsx(S,{variant:"body2",children:s.description}),e.jsx(f,{sx:{display:"flex"},onClick:m=>{m.stopPropagation()},children:e.jsx(A,{title:s.url,children:e.jsx(Z,{sx:{fontSize:"15px",marginTop:"1px"}})})})]})}}},{label:"Events",name:"events",options:{customBodyRenderLite:(i,x)=>{const s=u[x];return e.jsx(f,{sx:{display:"flex",alignItems:"center",gap:1,flexWrap:"wrap"},children:s.enabledEvents.map(m=>e.jsx(O,{size:"small",variant:"filled",label:m.type,sx:{borderRadius:"4px",textTransform:"capitalize"}},`${s.source}-${m.type}`))})}}},{label:l("common.status"),name:"status",options:{customBodyRenderLite:(i,x)=>{const s=u[x];return e.jsx(O,{size:"small",variant:"filled",label:l(`webhookEndpoint.${s==null?void 0:s.status}`),color:he(s==null?void 0:s.status),sx:{borderRadius:"4px",textTransform:"capitalize"}},`status-${s.status}`)}}},{label:l("common.createdAt"),name:"createdAt",minWidth:200,options:{customBodyRender:i=>H(i)}},{label:l("common.actions"),name:"actions",width:100,align:"center",verticalKeyAlign:"center",options:{customBodyRenderLite:(i,x)=>{const s=u[x],m=(s==null?void 0:s.status)==="enabled";return e.jsx(Ge,{actions:[{icon:m?e.jsx(He,{}):e.jsx(Ne,{}),text:l(m?"webhookEndpoint.disable":"webhookEndpoint.enable"),onClick:k=>{k.stopPropagation(),w(s,m)}},{icon:e.jsx(Fe,{}),text:l("common.edit"),onClick:k=>{k.stopPropagation(),a(D=>({...D,createEdit:{open:!0,id:s.id,url:s.url,description:s.description,enabledEvents:s.enabledEvents}}))}},{icon:e.jsx(Ue,{}),text:l("common.delete"),onClick:k=>{k.stopPropagation(),a(D=>({...D,deleteConfirm:{title:l("webhookEndpoint.deleteWebhook.title"),description:l("webhookEndpoint.deleteWebhook.description"),confirm:l("common.confirm"),cancel:l("common.cancel"),onConfirm:()=>g(s.id),onCancel:()=>a(I=>({...I,deleteConfirm:null}))}}))}}]})}}}];return e.jsxs(e.Fragment,{children:[e.jsx(it,{durable:d,durableKeys:["page","rowsPerPage"],data:u,columns:M,options:{count:h.count,page:v.page-1,rowsPerPage:v.pageSize,customToolbar:()=>e.jsx(_,{onClick:()=>a(i=>({...i,createEdit:{...i.createEdit,open:!0}})),children:e.jsx(_e,{})},"add"),onRowClick:(i,{dataIndex:x})=>{const s=h.list[x];a(m=>({...m,webhookDetail:{open:!0,id:s.id}}))}},loading:j,onChange:E,title:e.jsx(S,{variant:"h6",children:l("webhookEndpoint.title")}),emptyNodeText:e.jsxs(P,{gap:1,children:[l("webhookEndpoint.noWebhooksAdded"),e.jsx(B,{variant:"contained",color:"primary",onClick:()=>a(i=>({...i,createEdit:{...i.createEdit,open:!0}})),children:l("webhookEndpoint.createWebhook")})]})}),n.webhookDetail.open&&e.jsx(me,{open:!0,onClose:()=>a(i=>({...i,webhookDetail:{open:!1,id:null}})),id:n.webhookDetail.id}),n.createEdit.open&&e.jsx(oe,{onSubmit:r,...n.createEdit,onClose:()=>a(i=>({...i,createEdit:{id:null,url:"",description:"",enabledEvents:[],open:!1}}))}),n.deleteConfirm&&e.jsx(Qe,{title:n.deleteConfirm.title,description:n.deleteConfirm.description,confirm:n.deleteConfirm.confirm,cancel:n.deleteConfirm.cancel,params:n.deleteConfirm.params,onConfirm:n.deleteConfirm.onConfirm,onCancel:n.deleteConfirm.onCancel})]})}export{Pt as default};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-
|
|
2
|
-
import{r as m,f as gt,l as tt,L as me,u as js,i as ks,j as ct}from"./vendor-react-DEoibe3W.js";import{a2 as ke,j as e,t as Le,a4 as c,bk as vo,E as r,a5 as xe,I as ce,T as N,b$ as Co,D as ot,aa as ge,at as ys,bN as Je,ad as wo,br as Xe,bt as ht,x as se,a3 as Ye,P as So,G as Io,v as jt,a0 as Do,an as To,ak as fe,al as Rs,ac as _o,r as Po,bQ as vs,K as Ve,y as qo,M as oe,ae as Se,au as Cs,L as ws,z as Ss,b4 as Is,as as $o,ar as Qe,by as Ds,bz as Ts,c0 as _s,c1 as Ps,bm as ft,bn as qs,bp as $s,bC as Ls,bD as at}from"./vendor-mui-core-1jJmAutq.js";import{z as ye,C as ze,a1 as Ns,f as lo,a9 as ro}from"./index-CTpJt8AJ.js";import{r as Re,p as G,u as te,l as As,B as Me,b3 as Lo,W as No,b1 as Ao,an as zs,bo as Bs,a6 as kt,Z as M,a2 as Es,h as ae,bp as Ws,b6 as Os,g as $e,al as yt,ar as Ms}from"./vendor-ux-did-connect-DlrX4cqq.js";import{z as Rt,c as ue,l as Vs,F as Us,_ as zo,G as De,p as Fs}from"./vendor-arcblock-CD8CMsgQ.js";import{d as Hs}from"./Error-xVtnHALO.js";import{C as vt}from"./confirm-C1Nde1Nq.js";import{u as Ue}from"./session-UJ7B0EdV.js";import{W as io}from"./did-address-D-fI5ZyH.js";import{E as Fe}from"./empty-spinner-Cia24BVr.js";import{B as Ct}from"./bundle-avatar-Ci9fNblN.js";import{S as je}from"./shorten-label-DDBwv81M.js";import{L as wt}from"./list-header-BibBP5t1.js";import{Y as Gs,y as be,H as St,D as Bo}from"./vendor-utils-Cm2BKG2b.js";import{d as Js}from"./Download-COul5Jpx.js";import{C as Eo}from"./click-to-copy-q_I2l6Sg.js";import{Q as Xs}from"./QuestionMarkCircle-5K6WR8Pc.js";import{u as Ys}from"./vendor-hooks-8r-lvvPs.js";import{_ as Ie}from"./useSetState-CWq0AVWn.js";import{c as It}from"./index-DVQCgvFb.js";import{E as Dt}from"./index-Cuoxr9xB.js";import{p as Ze}from"./index-YqrAgavD.js";import"./api-BVwAqPhr.js";import{d as Qs}from"./ChevronRight-Bol9kSyE.js";import{T as Zs,a as Ks}from"./vendor-mui-x-CPwlD3uT.js";import{d as co}from"./DeleteOutline-BiIEYa8g.js";import{D as ao,C as uo,P as po}from"./react-beautiful-dnd.esm-Bu3K07pf.js";import{c as en,A as Wo,u as tn,S as on,U as sn,a as dt,b as Oo,n as nn,e as ln,f as ho,g as rn,h as cn}from"./item-DssQyiFI.js";import{d as an}from"./ArrowDropDown-CDjPVis_.js";import{f as Ne}from"./format-error-BrmqJs5a.js";import{d as dn}from"./Launch-DFNlDQlk.js";import{M as un}from"./index-BTOIZL6e.js";import{r as pn}from"./index-BYsXlcQC.js";import{d as hn}from"./Done-kAy_Y9ti.js";import"./lottie-web-jYmAQWuC.js";import"./raf-schd.esm-B3j6BePR.js";import"./delete-confirm-CpPzqeJx.js";import"./get-safe-url-C2N97NJc.js";var Tt={},fn=ke;Object.defineProperty(Tt,"__esModule",{value:!0});var Mo=Tt.default=void 0,bn=fn(Re()),mn=e;Mo=Tt.default=(0,bn.default)((0,mn.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 _t={},xn=ke;Object.defineProperty(_t,"__esModule",{value:!0});var Vo=_t.default=void 0,gn=xn(Re()),jn=e;Vo=_t.default=(0,gn.default)((0,jn.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 Pt={},kn=ke;Object.defineProperty(Pt,"__esModule",{value:!0});var Uo=Pt.default=void 0,yn=kn(Re()),Rn=e;Uo=Pt.default=(0,yn.default)((0,Rn.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 qt({did:t,projectId:o,title:s,logo:i,describe:l}){const n=`${`${G.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${t}/${o}/logo/upload`}/${i}`,[u,a]=m.useState(!1),h=Le(x=>x.breakpoints.down("md"));return e.jsxs(c,{sx:{display:"flex",flexDirection:"row",color:u?"primary.main":"grey.900",gap:1},onPointerEnter:()=>a(!0),onPointerLeave:()=>a(!1),children:[e.jsx(vo,{sx:{borderRadius:1},src:n}),e.jsxs(c,{children:[e.jsx(je,{hiddenTip:!0,maxLength:"24",sx:{fontSize:"14px",fontWeight:"500",color:h?"primary.main":""},children:s||"/"}),e.jsx(je,{hiddenTip:!0,maxLength:"58",sx:{fontSize:"12px",color:h||u?"primary.main":"grey.700"},children:l||"/"})]})]})}qt.propTypes={projectId:r.string.isRequired,did:r.string.isRequired,title:r.string.isRequired,logo:r.string.isRequired,describe:r.string.isRequired};function $t({initUrl:t}){const o=gt(),s=(t==null?void 0:t.searchParams.get("tenantScope"))||"",{t:i,locale:l}=te(),{api:d}=ye(),{api:n}=Ue(),[u,a]=m.useState(!0),{blocklet:h}=ze(),[x,S]=m.useState(null),[y,p]=m.useState(!1),f=Le(g=>g.breakpoints.down("xl")),R=Le(g=>g.breakpoints.down("md")),{componentDid:I=""}=tt(),[j,D]=m.useState(null),[k,T]=m.useState(""),L=()=>{d.getProjects({input:{did:h.meta.did,componentDid:I,tenantScope:s}}).then(g=>{const _=(g==null?void 0:g.projects)||[];a(!1),D(_)}).catch(g=>{a(!1),M.error(g.message)})},z=()=>{o(`${G.UNOWNED_DID}/create/none`,{replace:!0})},B=g=>{S(g)},v=()=>{a(!1),p(!0)},C=()=>{p(!1),S(null)},H=g=>{M.error(g.message),p(!1),S(null)},W=g=>{if(!(g!=null&&g.deleted)){M.error("Delete project failed");return}L(),p(!1),S(null)};m.useEffect(()=>{L()},[]);const b=m.useMemo(()=>{if(!k)return j;let g=k==null?void 0:k.trim();return g?(g=As.toAddress(g).toLocaleLowerCase(),j.filter(_=>_.blockletTitle.toLowerCase().includes(g)||_.blockletDid.toLowerCase().includes(g))):j},[j,k]);if(!j&&u)return e.jsx(c,{sx:{display:"flex",justifyContent:"center",alignItems:"center",marginTop:"40px"},children:e.jsx(Fe,{})});if(!j)return null;if(!j.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:i("blocklet.publish.blockletEmptyTip")}),e.jsx(c,{sx:{fontSize:14,color:"text.secondary",mb:3},children:i("blocklet.publish.createBlockletTip")}),e.jsx(Me,{onClick:z,variant:"contained",children:i("blocklet.publish.createBlocklet")})]});const w=[{label:"Blocklet",name:"blockletTitle",minWidth:160,options:{customBodyRenderLite:g=>{const _=j[g];return e.jsx(me,{to:`${_.id}`,children:e.jsx(qt,{did:h.meta.did,projectId:_.id,logo:_.blockletLogo,title:_.blockletTitle,describe:_.blockletDescription})})}}},{label:"Version",name:"blockletVersion",options:{searchable:!1,customBodyRender:g=>g?e.jsx(Lo,{type:"success",children:g}):""}},{label:"DID",name:"blockletDid",options:{customBodyRender:g=>g?e.jsx(io,{size:14,compact:!0,responsive:!1,did:g}):null}},f||I?null:{label:i("common.createdBy"),name:"createdBy",options:{customBodyRender:g=>g?e.jsx(io,{onClick:()=>{o(`/.well-known/service/admin/members?did=${g}`)},style:{cursor:"pointer"},size:14,compact:!0,copyable:!1,showQrcode:!1,responsive:!1,did:g}):null}},f||I?null:{label:i("common.scope"),name:"componentDid",options:{customBodyRender:g=>{const _=(h.children||[]).find(J=>J.meta.did===g);return _?e.jsxs(c,{display:"flex",alignItems:"center",justifyContent:"flex-start",children:[e.jsx(Ct,{size:14,blocklet:_,ancestors:[h]}),e.jsx(c,{ml:.5,sx:{ml:.5,color:"text.primary",fontSize:14},children:_.meta.title})]},g):""}}},f||s?null:{label:i("blocklet.publish.tenantScope"),name:"tenantScope",options:{customBodyRender:g=>e.jsx(c,{ml:.5,sx:{ml:.5,color:"text.primary",fontSize:14},children:e.jsx(je,{children:g})})}},{label:i("common.updatedAt"),name:"updatedAt",options:{searchable:!1,customBodyRender:g=>e.jsx(No,{value:Number(g),locale:l})}},{label:i("common.actions"),name:"actions",options:{searchable:!1,customBodyRenderLite:g=>{const _=j[g];return e.jsxs(c,{display:"flex",children:[e.jsx(me,{to:`${_.id}/new-release/${_.lastReleaseId}`,children:e.jsx(xe,{title:i("blocklet.publish.createRelease"),placement:"top",children:e.jsx(ce,{color:"primary","aria-label":"create",children:e.jsx(Mo,{style:{fontSize:18}})})})}),!!_.lastReleaseId&&e.jsx(xe,{title:i("blocklet.publish.viewLastRelease",{name:_.blockletTitle}),placement:"top",children:e.jsx(ce,{color:"secondary","aria-label":"create",children:e.jsx(me,{style:{display:"flex"},to:`${_.id}/view/${_.lastReleaseId}`,children:e.jsx(Vo,{sx:{fontSize:18}})})})}),e.jsx(xe,{title:i("blocklet.publish.delete",{name:_.blockletTitle}),placement:"top",children:e.jsx(ce,{color:"primary","aria-label":"delete",onClick:()=>B(_),children:e.jsx(Ao,{sx:{fontSize:18}})})})]})}}}].filter(Boolean),q=y?e.jsx(zs,{open:!0,popup:!0,onClose:C,action:"check-has-project-id",locale:l,checkFn:n.get,saveConnect:!1,forceConnected:!1,checkTimeout:5*60*1e3,onSuccess:W,onError:H,extraParams:{projectId:x.id,did:h.meta.did,name:x.blockletTitle},messages:{title:i("blocklet.publish.deleteProject.title",{name:x.blockletTitle}),scan:i("blocklet.publish.deleteProject.scan",{name:x.blockletTitle}),confirm:i("blocklet.publish.deleteProject.confirm"),success:i("blocklet.publish.deleteProject.success")}}):null;return e.jsxs(c,{children:[e.jsx(wt,{sx:{mb:2},left:e.jsxs(c,{display:"flex",flexDirection:"row",alignItems:"center",children:[e.jsx(c,{sx:{fontSize:"1.2rem",fontWeight:"bold"},children:i("common.blockletStudio")}),e.jsx(xe,{title:i("blocklet.publish.createBlockletTip"),arrow:!0,placement:"right",children:e.jsx(Uo,{sx:{opacity:.6,fontSize:"1.1em",ml:1}})})]}),actions:e.jsxs(e.Fragment,{children:[e.jsx(Bs,{options:{searchPlaceholder:i("blocklet.list.searchPlaceholder"),searchDebounceTime:600,searchAlwaysOpen:R},search:k,searchText:k,searchTextUpdate:T,searchClose:()=>T(""),onSearchOpen:()=>{}}),e.jsxs(Me,{onClick:z,variant:"contained",children:[e.jsx(Rt,{style:{fontSize:"1.3em",marginRight:4}}),i("blocklet.publish.createBlocklet")]})]})}),e.jsx(kt,{className:"main-table",locale:l,data:b,columns:w,options:{search:!1,sort:!1,download:!1,filter:!1,print:!1,viewColumns:!1,searchAlwaysOpen:!0,rowsPerPageOptions:[10,20,50,100]}}),x&&e.jsx(vt,{title:`${i("common.delete")} ${x.blockletTitle}`,description:i("blocklet.publish.deleteProject.description"),confirm:i("common.confirm"),onConfirm:v,onCancel:()=>S(null),children:e.jsx(c,{sx:{marginTop:2},children:[i("blocklet.publish.deleteProject.tip1"),i("blocklet.publish.deleteProject.tip2"),i("blocklet.publish.deleteProject.tip3")].map(g=>e.jsxs(c,{sx:{display:"flex",marginTop:1,flexDirection:"row",alignItems:"flex-start"},children:[e.jsx(Hs,{color:"warning",sx:{marginRight:1,fontSize:20,marginTop:"2px"}}),e.jsx(N,{component:"span",variant:"inherit",color:"text.secondary",children:g})]}))})}),q]})}$t.propTypes={initUrl:r.object};$t.defaultProps={initUrl:null};var Lt={},vn=ke;Object.defineProperty(Lt,"__esModule",{value:!0});var Fo=Lt.default=void 0,Cn=vn(Re()),fo=e;Fo=Lt.default=(0,Cn.default)([(0,fo.jsx)("path",{d:"M20 17H4V5h8V3H4c-1.11 0-2 .89-2 2v12c0 1.1.89 2 2 2h4v2h8v-2h4c1.1 0 2-.9 2-2v-3h-2z"},"0"),(0,fo.jsx)("path",{d:"m17 14 5-5-1.41-1.41L18 10.17V3h-2v7.17l-2.59-2.58L12 9z"},"1")],"InstallDesktop");const wn=(t,o)=>{if(!t)return"";try{return o?JSON.parse(t)[o]:JSON.parse(t)}catch{}return t},Ho=wn;function Sn(){var B;const{t,locale:o}=te(),{projectId:s}=tt(),{api:i}=ye(),[l,d]=m.useState(!0),{blocklet:n}=ze(),u=Le(v=>v.breakpoints.down("md")),[a,h]=m.useState(null),[x,S]=m.useState(null),[y,p]=m.useState(null),f=(B=window.env)==null?void 0:B.serverEndpoint,R=()=>{i.getReleases({input:{did:n.meta.did,projectId:s}}).then(v=>{const C=(v==null?void 0:v.releases)||[];d(!1),h(C)}).catch(v=>{d(!1),M.error(v.message)})},I=()=>{i.doBatchQuery({getProject:{input:{did:n.meta.did,projectId:s}},getReleases:{input:{did:n.meta.did,projectId:s}}}).then(v=>{S(v.getProject.project||{}),h(v.getReleases.releases||[]),d(!1)}).catch(v=>{d(!1),M.error(v.message)})};m.useEffect(()=>{I()},[]);const[j,D]=m.useState(""),k=()=>{d(!1);const v=y.id;i.deleteRelease({input:{did:n.meta.did,projectId:s,releaseId:v}}).then(()=>{d(!1),R(),M.success(t("common.removeSuccess")),p(null)}).catch(C=>{d(!1),M.error(C.message)})},T=v=>{p(v)};if(!a&&l)return e.jsx(c,{sx:{display:"flex",justifyContent:"center",alignItems:"center",marginTop:"40px"},children:e.jsx(Fe,{})});if(!a)return null;const L=e.jsxs(Co,{className:"breadcrumbs","aria-label":"breadcrumb",children:[e.jsx(me,{to:"..",children:t("common.blockletStudio")}),e.jsx(N,{color:"text.primary",children:e.jsx(je,{maxLength:u?6:30,children:x.blockletTitle})})]});if(!a.length)return e.jsxs(e.Fragment,{children:[L,e.jsxs(c,{display:"flex",flexDirection:"column",alignItems:"center",pt:10,children:[e.jsx(c,{sx:{fontSize:20,fontWeight:"bold",mb:3},children:t("blocklet.publish.releaseEmptyTip")}),e.jsx(c,{sx:{fontSize:14,color:"text.secondary",mb:3},children:t("blocklet.publish.createReleaseTip")}),e.jsx(me,{to:"create/none",children:e.jsx(Me,{variant:"contained",children:t("blocklet.publish.createRelease")})})]})]});const z=[{label:t("common.version"),name:"blockletVersion",minWidth:160,options:{customBodyRenderLite:v=>{const C=a[v];return e.jsx(me,{to:`view/${C.id}`,children:e.jsx(qt,{did:n.meta.did,projectId:x.id,logo:C.blockletLogo,title:C.blockletVersion,describe:C.blockletTitle})})}}},{label:t("blocklet.publish.releaseNote"),name:"note",options:{customBodyRenderLite:v=>{const C=a[v];return e.jsx(N,{className:"note",children:Ho(C.note,"note")})}}},{label:t("common.status"),name:"status",options:{customBodyRender:v=>e.jsx(Lo,{type:v==="published"?"success":"warning",children:v==="published"?"Released":Gs(v)})}},{label:t("common.lastPublishedAt"),name:"updatedAt",options:{customBodyRenderLite:v=>{const C=a[v];return C.status!==ue.PROJECT.RELEASE_STATUS.published?"":e.jsx(No,{value:Number(C.updatedAt),locale:o})}}},{label:t("common.actions"),name:"actions",options:{customBodyRenderLite:v=>{var q;const C=a[v];let H="",W="";const b=C.status==="published";if(b){const g=be(f,`/api/project/${n.meta.did}/${x.id}/${x.lastReleaseId}/release/blocklet.json`),_=new URL(f);_.pathname=be(_.pathname,"/launch-blocklet/agreement"),_.searchParams.set("blocklet_meta_url",g),H=_.href,W=be(`${G.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${n.meta.did}/${x.id}/${x.lastReleaseId}/download/${(x.lastReleaseFiles||[])[0]}`)}const w=(q=x.blockletComponents)!=null&&q.some(g=>g.included)||C.uploadedResource?"pack":"resource";return e.jsxs(c,{display:"flex",alignItems:"center",children:[b&&w==="pack"&&e.jsx(xe,{title:t("blocklet.publish.install",{name:x.blockletTitle}),placement:"top",children:e.jsx(ce,{color:"secondary","aria-label":"create",children:e.jsx("a",{style:{display:"flex"},href:H,target:"_blank",rel:"noreferrer",children:e.jsx(Fo,{sx:{fontSize:18}})})})}),b&&e.jsx(xe,{title:t("blocklet.publish.download",{name:x.blockletTitle}),placement:"top",children:e.jsx(ce,{color:"primary","aria-label":"download",children:e.jsx("a",{style:{display:"flex"},href:W,children:e.jsx(Js,{sx:{fontSize:18}})})})}),e.jsx(xe,{title:t("blocklet.publish.delete",{name:x.blockletTitle}),placement:"top",children:e.jsx(ce,{color:"primary","aria-label":"delete",onClick:()=>T(C),children:e.jsx(Ao,{sx:{fontSize:18}})})})]})}}}];return e.jsxs(In,{children:[e.jsx(wt,{sx:{mb:2},left:L,actions:e.jsxs(e.Fragment,{children:[e.jsx(Me,{variant:"outlined",onClick:()=>{const v=be(f,`/api/project/${n.meta.did}/${s}/blocklet.json`);D(v)},children:t("blocklet.publish.copyInstallUrl")}),e.jsx(me,{to:"new-release/none",children:e.jsxs(Me,{variant:"contained",children:[e.jsx(Rt,{style:{fontSize:"1.3em",marginRight:4}}),t("blocklet.publish.createRelease")]})})]})}),e.jsx(ot,{fullWidth:!0,maxWidth:"sm",open:j,onClose:()=>D(""),children:e.jsxs(c,{sx:{py:5,px:4,wordBreak:"break-all"},children:[e.jsx(N,{variant:"h6",sx:{mb:2},children:t("blocklet.publish.installResourceTip")}),e.jsx(Eo,{children:j}),e.jsxs(N,{sx:{mt:2},children:[t("blocklet.publish.installResourceTip2"),e.jsx("a",{style:{marginLeft:4},href:"https://www.arcblock.io/docs/blocklet-developer/how-to-use-install-url",target:"_blank",rel:"noreferrer",children:t("blocklet.publish.installResourceHelp")})]})]})}),e.jsx(kt,{className:"main-table",verticalKeyWidth:100,locale:o,data:a,columns:z,options:{sort:!1,download:!1,filter:!1,print:!1,search:!1}}),y&&e.jsx(vt,{title:t(`${t("common.delete")} ${y.blockletVersion}`),description:t("blocklet.publish.deleteReleaseTip"),confirm:t("common.confirm"),onConfirm:k,onCancel:()=>p(null)})]})}const In=ge(c)`
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-rMaglH7e.js","assets/vendor-ux-did-connect-DEbq97Xz.js","assets/vendor-react-DEoibe3W.js","assets/vendor-utils-C3FZIS9A.js","assets/vendor-mui-core-1jJmAutq.js","assets/vendor-hooks-DN4nZ7TU.js","assets/lottie-web-jYmAQWuC.js","assets/vendor-ux-did-connect-BDmhBveY.css","assets/vendor-arcblock-V3HYELzG.js","assets/index-C1nvgBfF.js","assets/index-CwaFNZTA.js","assets/index-DVQCgvFb.js","assets/index-AgKpYdvC.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{r as m,f as gt,l as tt,L as me,u as js,i as ks,j as ct}from"./vendor-react-DEoibe3W.js";import{a2 as ke,j as e,t as Le,a4 as c,bk as vo,E as r,a5 as xe,I as ce,T as N,b$ as Co,D as ot,aa as ge,at as ys,bN as Je,ad as wo,br as Xe,bt as ht,x as se,a3 as Ye,P as So,G as Io,v as jt,a0 as Do,an as To,ak as fe,al as Rs,ac as _o,r as Po,bQ as vs,K as Ve,y as qo,M as oe,ae as Se,au as Cs,L as ws,z as Ss,b4 as Is,as as $o,ar as Qe,by as Ds,bz as Ts,c0 as _s,c1 as Ps,bm as ft,bn as qs,bp as $s,bC as Ls,bD as at}from"./vendor-mui-core-1jJmAutq.js";import{z as ye,C as ze,a2 as Ns,f as lo,aa as ro}from"./index-CwaFNZTA.js";import{r as Re,p as G,u as te,l as As,B as Me,b3 as Lo,V as No,b1 as Ao,am as zs,bq as Bs,a5 as kt,Y as M,a1 as Es,h as ae,br as Ws,b6 as Os,g as $e,ak as yt,aq as Ms}from"./vendor-ux-did-connect-DEbq97Xz.js";import{z as Rt,c as ue,l as Vs,F as Us,_ as zo,G as De,p as Fs}from"./vendor-arcblock-V3HYELzG.js";import{d as Hs}from"./Error-CK4gTMoT.js";import{C as vt}from"./confirm-D36_98HC.js";import{u as Ue}from"./session-0rF5SuCk.js";import{W as io}from"./did-address-B_VfxEC5.js";import{E as Fe}from"./empty-spinner-Cia24BVr.js";import{B as Ct}from"./bundle-avatar-DW07bLBG.js";import{S as je}from"./shorten-label-DDBwv81M.js";import{L as wt}from"./list-header-BibBP5t1.js";import{Z as Gs,y as be,I as St,D as Bo}from"./vendor-utils-C3FZIS9A.js";import{d as Js}from"./Download-BQiSNQBP.js";import{C as Eo}from"./click-to-copy-C9iEVQIO.js";import{Q as Xs}from"./QuestionMarkCircle-5K6WR8Pc.js";import{u as Ys}from"./vendor-hooks-DN4nZ7TU.js";import{_ as Ie}from"./useSetState-CWq0AVWn.js";import{c as It}from"./index-DVQCgvFb.js";import{E as Dt}from"./index-Cuoxr9xB.js";import{p as Ze}from"./index-DW20Eg1X.js";import"./api-kwOW9mRz.js";import{d as Qs}from"./ChevronRight-foZmiP4J.js";import{T as Zs,a as Ks}from"./vendor-mui-x-CPwlD3uT.js";import{d as co}from"./DeleteOutline-CKVA3PXs.js";import{D as ao,C as uo,P as po}from"./react-beautiful-dnd.esm-B3HYEQUw.js";import{c as en,A as Wo,u as tn,S as on,U as sn,a as dt,b as Oo,n as nn,e as ln,f as ho,g as rn,h as cn}from"./item-CuaUMkzc.js";import{d as an}from"./ArrowDropDown-C_E3qkPd.js";import{f as Ne}from"./format-error-BrmqJs5a.js";import{d as dn}from"./Launch-DX76v5dw.js";import{M as un}from"./index-BTOIZL6e.js";import{r as pn}from"./index-BYsXlcQC.js";import{d as hn}from"./Done-BDrYSkZM.js";import"./lottie-web-jYmAQWuC.js";import"./raf-schd.esm-B3j6BePR.js";import"./delete-confirm-DXKGHbZ0.js";import"./get-safe-url-D_Puq_oh.js";var Tt={},fn=ke;Object.defineProperty(Tt,"__esModule",{value:!0});var Mo=Tt.default=void 0,bn=fn(Re()),mn=e;Mo=Tt.default=(0,bn.default)((0,mn.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 _t={},xn=ke;Object.defineProperty(_t,"__esModule",{value:!0});var Vo=_t.default=void 0,gn=xn(Re()),jn=e;Vo=_t.default=(0,gn.default)((0,jn.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 Pt={},kn=ke;Object.defineProperty(Pt,"__esModule",{value:!0});var Uo=Pt.default=void 0,yn=kn(Re()),Rn=e;Uo=Pt.default=(0,yn.default)((0,Rn.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 qt({did:t,projectId:o,title:s,logo:i,describe:l}){const n=`${`${G.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${t}/${o}/logo/upload`}/${i}`,[u,a]=m.useState(!1),h=Le(x=>x.breakpoints.down("md"));return e.jsxs(c,{sx:{display:"flex",flexDirection:"row",color:u?"primary.main":"grey.900",gap:1},onPointerEnter:()=>a(!0),onPointerLeave:()=>a(!1),children:[e.jsx(vo,{sx:{borderRadius:1},src:n}),e.jsxs(c,{children:[e.jsx(je,{hiddenTip:!0,maxLength:"24",sx:{fontSize:"14px",fontWeight:"500",color:h?"primary.main":""},children:s||"/"}),e.jsx(je,{hiddenTip:!0,maxLength:"58",sx:{fontSize:"12px",color:h||u?"primary.main":"grey.700"},children:l||"/"})]})]})}qt.propTypes={projectId:r.string.isRequired,did:r.string.isRequired,title:r.string.isRequired,logo:r.string.isRequired,describe:r.string.isRequired};function $t({initUrl:t}){const o=gt(),s=(t==null?void 0:t.searchParams.get("tenantScope"))||"",{t:i,locale:l}=te(),{api:d}=ye(),{api:n}=Ue(),[u,a]=m.useState(!0),{blocklet:h}=ze(),[x,S]=m.useState(null),[y,p]=m.useState(!1),f=Le(g=>g.breakpoints.down("xl")),R=Le(g=>g.breakpoints.down("md")),{componentDid:I=""}=tt(),[j,D]=m.useState(null),[k,T]=m.useState(""),L=()=>{d.getProjects({input:{did:h.meta.did,componentDid:I,tenantScope:s}}).then(g=>{const _=(g==null?void 0:g.projects)||[];a(!1),D(_)}).catch(g=>{a(!1),M.error(g.message)})},z=()=>{o(`${G.UNOWNED_DID}/create/none`,{replace:!0})},B=g=>{S(g)},v=()=>{a(!1),p(!0)},C=()=>{p(!1),S(null)},H=g=>{M.error(g.message),p(!1),S(null)},W=g=>{if(!(g!=null&&g.deleted)){M.error("Delete project failed");return}L(),p(!1),S(null)};m.useEffect(()=>{L()},[]);const b=m.useMemo(()=>{if(!k)return j;let g=k==null?void 0:k.trim();return g?(g=As.toAddress(g).toLocaleLowerCase(),j.filter(_=>_.blockletTitle.toLowerCase().includes(g)||_.blockletDid.toLowerCase().includes(g))):j},[j,k]);if(!j&&u)return e.jsx(c,{sx:{display:"flex",justifyContent:"center",alignItems:"center",marginTop:"40px"},children:e.jsx(Fe,{})});if(!j)return null;if(!j.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:i("blocklet.publish.blockletEmptyTip")}),e.jsx(c,{sx:{fontSize:14,color:"text.secondary",mb:3},children:i("blocklet.publish.createBlockletTip")}),e.jsx(Me,{onClick:z,variant:"contained",children:i("blocklet.publish.createBlocklet")})]});const w=[{label:"Blocklet",name:"blockletTitle",minWidth:160,options:{customBodyRenderLite:g=>{const _=j[g];return e.jsx(me,{to:`${_.id}`,children:e.jsx(qt,{did:h.meta.did,projectId:_.id,logo:_.blockletLogo,title:_.blockletTitle,describe:_.blockletDescription})})}}},{label:"Version",name:"blockletVersion",options:{searchable:!1,customBodyRender:g=>g?e.jsx(Lo,{type:"success",children:g}):""}},{label:"DID",name:"blockletDid",options:{customBodyRender:g=>g?e.jsx(io,{size:14,compact:!0,responsive:!1,did:g}):null}},f||I?null:{label:i("common.createdBy"),name:"createdBy",options:{customBodyRender:g=>g?e.jsx(io,{onClick:()=>{o(`/.well-known/service/admin/members?did=${g}`)},style:{cursor:"pointer"},size:14,compact:!0,copyable:!1,showQrcode:!1,responsive:!1,did:g}):null}},f||I?null:{label:i("common.scope"),name:"componentDid",options:{customBodyRender:g=>{const _=(h.children||[]).find(J=>J.meta.did===g);return _?e.jsxs(c,{display:"flex",alignItems:"center",justifyContent:"flex-start",children:[e.jsx(Ct,{size:14,blocklet:_,ancestors:[h]}),e.jsx(c,{ml:.5,sx:{ml:.5,color:"text.primary",fontSize:14},children:_.meta.title})]},g):""}}},f||s?null:{label:i("blocklet.publish.tenantScope"),name:"tenantScope",options:{customBodyRender:g=>e.jsx(c,{ml:.5,sx:{ml:.5,color:"text.primary",fontSize:14},children:e.jsx(je,{children:g})})}},{label:i("common.updatedAt"),name:"updatedAt",options:{searchable:!1,customBodyRender:g=>e.jsx(No,{value:Number(g),locale:l})}},{label:i("common.actions"),name:"actions",options:{searchable:!1,customBodyRenderLite:g=>{const _=j[g];return e.jsxs(c,{display:"flex",children:[e.jsx(me,{to:`${_.id}/new-release/${_.lastReleaseId}`,children:e.jsx(xe,{title:i("blocklet.publish.createRelease"),placement:"top",children:e.jsx(ce,{color:"primary","aria-label":"create",children:e.jsx(Mo,{style:{fontSize:18}})})})}),!!_.lastReleaseId&&e.jsx(xe,{title:i("blocklet.publish.viewLastRelease",{name:_.blockletTitle}),placement:"top",children:e.jsx(ce,{color:"secondary","aria-label":"create",children:e.jsx(me,{style:{display:"flex"},to:`${_.id}/view/${_.lastReleaseId}`,children:e.jsx(Vo,{sx:{fontSize:18}})})})}),e.jsx(xe,{title:i("blocklet.publish.delete",{name:_.blockletTitle}),placement:"top",children:e.jsx(ce,{color:"primary","aria-label":"delete",onClick:()=>B(_),children:e.jsx(Ao,{sx:{fontSize:18}})})})]})}}}].filter(Boolean),q=y?e.jsx(zs,{open:!0,popup:!0,onClose:C,action:"check-has-project-id",locale:l,checkFn:n.get,saveConnect:!1,forceConnected:!1,checkTimeout:5*60*1e3,onSuccess:W,onError:H,extraParams:{projectId:x.id,did:h.meta.did,name:x.blockletTitle},messages:{title:i("blocklet.publish.deleteProject.title",{name:x.blockletTitle}),scan:i("blocklet.publish.deleteProject.scan",{name:x.blockletTitle}),confirm:i("blocklet.publish.deleteProject.confirm"),success:i("blocklet.publish.deleteProject.success")}}):null;return e.jsxs(c,{children:[e.jsx(wt,{sx:{mb:2},left:e.jsxs(c,{display:"flex",flexDirection:"row",alignItems:"center",children:[e.jsx(c,{sx:{fontSize:"1.2rem",fontWeight:"bold"},children:i("common.blockletStudio")}),e.jsx(xe,{title:i("blocklet.publish.createBlockletTip"),arrow:!0,placement:"right",children:e.jsx(Uo,{sx:{opacity:.6,fontSize:"1.1em",ml:1}})})]}),actions:e.jsxs(e.Fragment,{children:[e.jsx(Bs,{options:{searchPlaceholder:i("blocklet.list.searchPlaceholder"),searchDebounceTime:600,searchAlwaysOpen:R},search:k,searchText:k,searchTextUpdate:T,searchClose:()=>T(""),onSearchOpen:()=>{}}),e.jsxs(Me,{onClick:z,variant:"contained",children:[e.jsx(Rt,{style:{fontSize:"1.3em",marginRight:4}}),i("blocklet.publish.createBlocklet")]})]})}),e.jsx(kt,{className:"main-table",locale:l,data:b,columns:w,options:{search:!1,sort:!1,download:!1,filter:!1,print:!1,viewColumns:!1,searchAlwaysOpen:!0,rowsPerPageOptions:[10,20,50,100]}}),x&&e.jsx(vt,{title:`${i("common.delete")} ${x.blockletTitle}`,description:i("blocklet.publish.deleteProject.description"),confirm:i("common.confirm"),onConfirm:v,onCancel:()=>S(null),children:e.jsx(c,{sx:{marginTop:2},children:[i("blocklet.publish.deleteProject.tip1"),i("blocklet.publish.deleteProject.tip2"),i("blocklet.publish.deleteProject.tip3")].map(g=>e.jsxs(c,{sx:{display:"flex",marginTop:1,flexDirection:"row",alignItems:"flex-start"},children:[e.jsx(Hs,{color:"warning",sx:{marginRight:1,fontSize:20,marginTop:"2px"}}),e.jsx(N,{component:"span",variant:"inherit",color:"text.secondary",children:g})]}))})}),q]})}$t.propTypes={initUrl:r.object};$t.defaultProps={initUrl:null};var Lt={},vn=ke;Object.defineProperty(Lt,"__esModule",{value:!0});var Fo=Lt.default=void 0,Cn=vn(Re()),fo=e;Fo=Lt.default=(0,Cn.default)([(0,fo.jsx)("path",{d:"M20 17H4V5h8V3H4c-1.11 0-2 .89-2 2v12c0 1.1.89 2 2 2h4v2h8v-2h4c1.1 0 2-.9 2-2v-3h-2z"},"0"),(0,fo.jsx)("path",{d:"m17 14 5-5-1.41-1.41L18 10.17V3h-2v7.17l-2.59-2.58L12 9z"},"1")],"InstallDesktop");const wn=(t,o)=>{if(!t)return"";try{return o?JSON.parse(t)[o]:JSON.parse(t)}catch{}return t},Ho=wn;function Sn(){var B;const{t,locale:o}=te(),{projectId:s}=tt(),{api:i}=ye(),[l,d]=m.useState(!0),{blocklet:n}=ze(),u=Le(v=>v.breakpoints.down("md")),[a,h]=m.useState(null),[x,S]=m.useState(null),[y,p]=m.useState(null),f=(B=window.env)==null?void 0:B.serverEndpoint,R=()=>{i.getReleases({input:{did:n.meta.did,projectId:s}}).then(v=>{const C=(v==null?void 0:v.releases)||[];d(!1),h(C)}).catch(v=>{d(!1),M.error(v.message)})},I=()=>{i.doBatchQuery({getProject:{input:{did:n.meta.did,projectId:s}},getReleases:{input:{did:n.meta.did,projectId:s}}}).then(v=>{S(v.getProject.project||{}),h(v.getReleases.releases||[]),d(!1)}).catch(v=>{d(!1),M.error(v.message)})};m.useEffect(()=>{I()},[]);const[j,D]=m.useState(""),k=()=>{d(!1);const v=y.id;i.deleteRelease({input:{did:n.meta.did,projectId:s,releaseId:v}}).then(()=>{d(!1),R(),M.success(t("common.removeSuccess")),p(null)}).catch(C=>{d(!1),M.error(C.message)})},T=v=>{p(v)};if(!a&&l)return e.jsx(c,{sx:{display:"flex",justifyContent:"center",alignItems:"center",marginTop:"40px"},children:e.jsx(Fe,{})});if(!a)return null;const L=e.jsxs(Co,{className:"breadcrumbs","aria-label":"breadcrumb",children:[e.jsx(me,{to:"..",children:t("common.blockletStudio")}),e.jsx(N,{color:"text.primary",children:e.jsx(je,{maxLength:u?6:30,children:x.blockletTitle})})]});if(!a.length)return e.jsxs(e.Fragment,{children:[L,e.jsxs(c,{display:"flex",flexDirection:"column",alignItems:"center",pt:10,children:[e.jsx(c,{sx:{fontSize:20,fontWeight:"bold",mb:3},children:t("blocklet.publish.releaseEmptyTip")}),e.jsx(c,{sx:{fontSize:14,color:"text.secondary",mb:3},children:t("blocklet.publish.createReleaseTip")}),e.jsx(me,{to:"create/none",children:e.jsx(Me,{variant:"contained",children:t("blocklet.publish.createRelease")})})]})]});const z=[{label:t("common.version"),name:"blockletVersion",minWidth:160,options:{customBodyRenderLite:v=>{const C=a[v];return e.jsx(me,{to:`view/${C.id}`,children:e.jsx(qt,{did:n.meta.did,projectId:x.id,logo:C.blockletLogo,title:C.blockletVersion,describe:C.blockletTitle})})}}},{label:t("blocklet.publish.releaseNote"),name:"note",options:{customBodyRenderLite:v=>{const C=a[v];return e.jsx(N,{className:"note",children:Ho(C.note,"note")})}}},{label:t("common.status"),name:"status",options:{customBodyRender:v=>e.jsx(Lo,{type:v==="published"?"success":"warning",children:v==="published"?"Released":Gs(v)})}},{label:t("common.lastPublishedAt"),name:"updatedAt",options:{customBodyRenderLite:v=>{const C=a[v];return C.status!==ue.PROJECT.RELEASE_STATUS.published?"":e.jsx(No,{value:Number(C.updatedAt),locale:o})}}},{label:t("common.actions"),name:"actions",options:{customBodyRenderLite:v=>{var q;const C=a[v];let H="",W="";const b=C.status==="published";if(b){const g=be(f,`/api/project/${n.meta.did}/${x.id}/${x.lastReleaseId}/release/blocklet.json`),_=new URL(f);_.pathname=be(_.pathname,"/launch-blocklet/agreement"),_.searchParams.set("blocklet_meta_url",g),H=_.href,W=be(`${G.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${n.meta.did}/${x.id}/${x.lastReleaseId}/download/${(x.lastReleaseFiles||[])[0]}`)}const w=(q=x.blockletComponents)!=null&&q.some(g=>g.included)||C.uploadedResource?"pack":"resource";return e.jsxs(c,{display:"flex",alignItems:"center",children:[b&&w==="pack"&&e.jsx(xe,{title:t("blocklet.publish.install",{name:x.blockletTitle}),placement:"top",children:e.jsx(ce,{color:"secondary","aria-label":"create",children:e.jsx("a",{style:{display:"flex"},href:H,target:"_blank",rel:"noreferrer",children:e.jsx(Fo,{sx:{fontSize:18}})})})}),b&&e.jsx(xe,{title:t("blocklet.publish.download",{name:x.blockletTitle}),placement:"top",children:e.jsx(ce,{color:"primary","aria-label":"download",children:e.jsx("a",{style:{display:"flex"},href:W,children:e.jsx(Js,{sx:{fontSize:18}})})})}),e.jsx(xe,{title:t("blocklet.publish.delete",{name:x.blockletTitle}),placement:"top",children:e.jsx(ce,{color:"primary","aria-label":"delete",onClick:()=>T(C),children:e.jsx(Ao,{sx:{fontSize:18}})})})]})}}}];return e.jsxs(In,{children:[e.jsx(wt,{sx:{mb:2},left:L,actions:e.jsxs(e.Fragment,{children:[e.jsx(Me,{variant:"outlined",onClick:()=>{const v=be(f,`/api/project/${n.meta.did}/${s}/blocklet.json`);D(v)},children:t("blocklet.publish.copyInstallUrl")}),e.jsx(me,{to:"new-release/none",children:e.jsxs(Me,{variant:"contained",children:[e.jsx(Rt,{style:{fontSize:"1.3em",marginRight:4}}),t("blocklet.publish.createRelease")]})})]})}),e.jsx(ot,{fullWidth:!0,maxWidth:"sm",open:j,onClose:()=>D(""),children:e.jsxs(c,{sx:{py:5,px:4,wordBreak:"break-all"},children:[e.jsx(N,{variant:"h6",sx:{mb:2},children:t("blocklet.publish.installResourceTip")}),e.jsx(Eo,{children:j}),e.jsxs(N,{sx:{mt:2},children:[t("blocklet.publish.installResourceTip2"),e.jsx("a",{style:{marginLeft:4},href:"https://www.arcblock.io/docs/blocklet-developer/how-to-use-install-url",target:"_blank",rel:"noreferrer",children:t("blocklet.publish.installResourceHelp")})]})]})}),e.jsx(kt,{className:"main-table",verticalKeyWidth:100,locale:o,data:a,columns:z,options:{sort:!1,download:!1,filter:!1,print:!1,search:!1}}),y&&e.jsx(vt,{title:t(`${t("common.delete")} ${y.blockletVersion}`),description:t("blocklet.publish.deleteReleaseTip"),confirm:t("common.confirm"),onConfirm:k,onCancel:()=>p(null)})]})}const In=ge(c)`
|
|
3
3
|
.main-table > div:first-child {
|
|
4
4
|
display: none;
|
|
5
5
|
}
|
|
@@ -121,7 +121,7 @@ import{r as m,f as gt,l as tt,L as me,u as js,i as ks,j as ct}from"./vendor-reac
|
|
|
121
121
|
background: #fff;
|
|
122
122
|
z-index: 10;
|
|
123
123
|
}
|
|
124
|
-
`;var Mt={},En=ke;Object.defineProperty(Mt,"__esModule",{value:!0});var bt=Mt.default=void 0,Wn=En(Re()),On=e;bt=Mt.default=(0,Wn.default)((0,On.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 mo="lastWantToConnectStoreId";function Mn(t){var u,a;const[o,s]=m.useState(null),{session:i}=Ue(),l=m.useCallback(h=>{s(h),localStorage.setItem(mo,h==null?void 0:h.id)},[s]),d=m.useMemo(()=>{var y,p,f,R;const h=localStorage.getItem(mo),x=h?(((y=t==null?void 0:t.settings)==null?void 0:y.storeList)||[]).find(I=>I.id===h):null;if(x)return x;let S=(((p=t==null?void 0:t.settings)==null?void 0:p.storeList)||[]).find(I=>{var j;return!(I.id!==G.BLOCKLET_STORE.id||I.scope&&I.scope!=="studio"&&I.scope!==((j=i==null?void 0:i.user)==null?void 0:j.did))});return S||(S=(R=(f=t==null?void 0:t.settings)==null?void 0:f.storeList)==null?void 0:R[0]),S},[(u=t==null?void 0:t.settings)==null?void 0:u.storeList,(a=i==null?void 0:i.user)==null?void 0:a.did]);return[o||d||{},l]}const pt={};async function Qo(t,{interval:o=1e3,maxDuration:s=120*1e3,intervalFirst:i=4e3,timerKey:l=""}){pt[l]&&clearTimeout(pt[l]),await new Promise(u=>setTimeout(u,i));const d=Date.now(),n=async(u,a)=>{try{const h=await t();u(h)}catch(h){Date.now()-d>s?a(h):l?pt[l]=setTimeout(()=>n(u,a),o):setTimeout(()=>n(u,a),o)}};return new Promise(n)}function Vn(){return Math.random().toString(36).slice(2)+Math.random().toString(36).slice(2)+`${Date.now()}`.slice(-6)}function Un(t,{did:o,projectId:s,messageId:i}){return Qo(async()=>{var d;const l=await t.getProject({input:{did:o,projectId:s,messageId:i}});if(!((d=l==null?void 0:l.project)!=null&&d.blockletDid))throw new Error("Connected store not found");return l.project.blockletDid},{timerKey:"connect-studio"})}function Fn(t,{did:o,projectId:s,storeId:i}){return Qo(async()=>{var n,u;const l=await t.getProject({input:{did:o,projectId:s,messageId:""}});if(!((u=(n=l==null?void 0:l.project)==null?void 0:n.connectedStores)!=null&&u.length))throw new Error("Connected store not found");if(!l.project.connectedStores.find(a=>a.storeId===i))throw new Error("Connected store not found")},{timerKey:`connect-store-${i}`})}const Hn=({fromBlocklet:t,nodeInfo:o,blocklet:s,userDid:i})=>{var n,u;const l=t?(n=s==null?void 0:s.meta)==null?void 0:n.did:o==null?void 0:o.did;let d=t?((u=s==null?void 0:s.settings)==null?void 0:u.storeList)||[]:(o==null?void 0:o.blockletRegistryList)||[];return Array.isArray(d)||(d=[]),d=d.filter(a=>a.protected||!a.scope||a.scope==="studio"||a.scope===i),{teamDid:l,storeList:d}},Vt=Hn;function Ut({blocklet:t,store:o={},onChangeStore:s,onClick:i,disabled:l,loading:d,componentDid:n}){var b,w,q;const{t:u}=te(),{session:a}=Ue(),{api:h,info:x,inService:S}=ye(),y=ze(),[p,f]=m.useState(!1),R=m.useRef(null),[I,j]=m.useState(!1),[D,k]=m.useState(null),T=g=>{s(g),f(!1)},L=()=>{f(!p)},z=g=>{R.current&&R.current.contains(g.target)||f(!1)},B=()=>{j(!0)},v=()=>{j(!1)},C=async()=>{var g;if(D)try{await h.deleteBlockletStore({input:{teamDid:t.meta.did,url:D.url,projectId:"",scope:D.scope||"studio"}}),await((g=y==null?void 0:y.actions)==null?void 0:g.refreshBlocklet())}catch(_){M.error(`Remove Blocklet Store Error: ${Ne(_)}`)}finally{k(null)}},{storeList:H}=Vt({fromBlocklet:S,blocklet:t,nodeInfo:x,componentDid:n,userDid:(b=a==null?void 0:a.user)==null?void 0:b.did}),W=(w=t==null?void 0:t.meta)==null?void 0:w.did;return e.jsxs(e.Fragment,{children:[e.jsxs(ht,{disabled:l,ref:R,variant:"contained",color:"primary","aria-label":"Button group with connect store",children:[e.jsxs(se,{onClick:i,children:[d&&e.jsx(Ye,{size:14,sx:{mr:.5}}),`${u("common.connect")} ${o.name||""}`]}),e.jsx(se,{size:"small","aria-controls":p?"split-button-menu":void 0,"aria-expanded":p?"true":void 0,"aria-label":"select merge strategy","aria-haspopup":"menu",onClick:L,children:e.jsx(an,{})})]}),e.jsx(So,{sx:{zIndex:10},open:p,anchorEl:R.current,placement:"bottom-end",role:void 0,transition:!0,disablePortal:!0,children:({TransitionProps:g})=>e.jsx(Io,{...g,style:{transformOrigin:"center top"},children:e.jsx(jt,{children:e.jsx(Do,{onClickAway:z,children:e.jsxs(To,{id:"split-button-menu",autoFocusItem:!0,sx:{maxHeight:300,overflowY:"auto",zIndex:10},children:[H==null?void 0:H.map(_=>{var J;return e.jsxs(fe,{selected:_.id===(o==null?void 0:o.id),sx:{height:56},onClick:()=>T(_),children:[e.jsxs(c,{children:[e.jsx(je,{sx:{fontSize:"16px"},maxLength:24,children:_.name}),e.jsx(je,{sx:{fontSize:"13px",opacity:.6},maxLength:30,children:_.url})]}),en({store:_,userDid:(J=a==null?void 0:a.user)==null?void 0:J.did})&&e.jsx(ce,{sx:{ml:1},onClick:U=>{U.preventDefault(),U.stopPropagation(),k(_)},children:e.jsx(ae,{icon:"ic:outline-delete"})})]},_.url)}),e.jsx(Rs,{}),e.jsxs(fe,{onClick:B,children:[e.jsx(Rt,{font:!0}),e.jsx(N,{variant:"inherit",children:u("store.blockletRegistry.addRegistry")})]})]})})})})}),I&&e.jsx(Wo,{hiddenChildren:!0,open:!0,onClose:v,teamDid:W,storeList:H,scope:"studio",onAdd:(q=y==null?void 0:y.actions)==null?void 0:q.refreshBlocklet}),D&&e.jsx(vt,{displayError:!0,title:`${u("common.delete")} ${D.name}`,description:u("blocklet.publish.deleteStoreTip",{name:D.name}),confirm:u("common.confirm"),onConfirm:C,onCancel:()=>k(null)})]})}Ut.propTypes={store:r.object,blocklet:r.object,onChangeStore:r.func.isRequired,onClick:r.func.isRequired,loading:r.bool.isRequired,disabled:r.bool.isRequired,componentDid:r.string.isRequired,projectType:r.string.isRequired,getData:r.func.isRequired};Ut.defaultProps={store:null,blocklet:null};const Gn=(t,o,s)=>{const i=`${G.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${o.meta.did}/${s}/logo/upload`,l=`${G.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${o.meta.did}/${s}/screenshot/upload`,d=t!=null&&t.blockletLogo?`${i}/${t.blockletLogo}`:`${G.WELLKNOWN_SERVICE_PATH_PREFIX}/static/images/logo.png`,n=((t==null?void 0:t.blockletScreenshots)||[]).filter(Boolean).map(u=>`${l}/${u}`);return{logoUrl:d,screenshotUrls:n,uploadLogoPrefix:i,uploadScreenshotPrefix:l}},Zo=Gn,Jn=t=>{const o=t.includes("youtube.com")||t.includes("youtu.be"),s=t.includes("vimeo.com");return o||s};function st({url:t,style:o,controls:s,modestbranding:i}){var u;const{t:l}=te(),d=t.includes("youtube.com")||t.includes("youtu.be"),n=t.includes("vimeo.com");if(d){const a=((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/${a}?modestbranding=${i}&controls=${s}&rel=0`,title:"YouTube video player",style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",border:"none",...o},allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0})})}if(n){const a=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/${a}`,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(ae,{icon:"carbon:video-off",style:{fontSize:40,marginBottom:"10px",opacity:.5}}),e.jsx(N,{variant:"body1",sx:{opacity:.5},children:l("studio.videoDialogNoSrc")})]})})}st.propTypes={url:r.string.isRequired,style:r.object,controls:r.number,modestbranding:r.number};st.defaultProps={style:{},controls:1,modestbranding:1};function Ko({setParams:t,onClose:o,params:s}){const{t:i}=te(),[l,d]=m.useState(""),n=l&&s.blockletVideos.includes(l),u=Jn(l),a=()=>{t(h=>{const x=[...h.blockletVideos];return x.push(l),{...h,blockletVideos:x}}),o()};return e.jsxs(ot,{open:!0,fullWidth:!0,maxWidth:"sm",children:[e.jsx(_o,{children:i("studio.videoDialogTitle")}),e.jsxs(Po,{children:[e.jsx(vs,{fullWidth:!0,value:l,onChange:h=>d(h.target.value),placeholder:i("studio.videoInputLabel"),endAdornment:l?e.jsx(Ve,{position:"end",children:e.jsx(ce,{onClick:()=>d(""),children:e.jsx(Os,{})})}):null,error:n}),n&&e.jsx(N,{variant:"body2",color:"error",children:i("studio.duplicateVideo")}),e.jsx(st,{url:l,style:{marginTop:"20px",borderRadius:"4px"}})]}),e.jsxs(qo,{children:[e.jsx(se,{onClick:()=>o(),children:i("studio.cancel")}),e.jsx(se,{disabled:!u||n,onClick:a,children:i("studio.confirm")})]})]})}Ko.propTypes={onClose:r.func.isRequired,params:r.object.isRequired,setParams:r.func.isRequired};function mt({errors:t,storeList:o,...s}){const{t:i}=te();return e.jsxs(c,{...s,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:i("blocklet.publish.storeRule.warning")}),t&&Object.entries(t).map(([l,d])=>{const n=Object.values(d),u=o.find(a=>a.url===l);return n.length>0&&e.jsxs(c,{children:[e.jsx(xe,{title:l,children:e.jsx(c,{component:"span",sx:{cursor:"pointer"},children:u.name})}),n.map(a=>e.jsx(c,{component:"li",ml:2,breakWords:!0,children:a},a))]},l)})]})}mt.propTypes={errors:r.object.isRequired,storeList:r.array.isRequired};const xo=m.lazy(()=>zo(()=>import("./index-CB6NPYWM.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12])).then(t=>({default:t.Uploader})));function es({projectId:t,readOnly:o,loading:s,blocklet:i,params:l,setParams:d,paramsErrTip:n,setParamsErrTip:u,warning:a,setLoading:h,initUrl:x,initLogoUrl:S,setInitLogoUrl:y,componentDid:p}){const{t:f,locale:R}=te(),{api:I}=ye(),j=gt(),D=m.useRef(null),k=m.useRef(null),[T,L]=Mn(i),[z,B]=m.useState(!1),v=tn({messageType:"connect-store-message",onOpen:()=>h(!0),onClose:()=>h(!1)}),C=async $=>{const V=setTimeout(()=>{h(!1)},2e4),F=await Un(I,$);h(!1),clearTimeout(V),window.parent.postMessage({event:"studioDialog.connected",componentDid:p},"*"),j(window.location.pathname.replace(`${G.UNOWNED_DID}/create`,`${F}/create`),{replace:!0})},H=()=>{if(!l.blockletTitle){M.error(f("blocklet.publish.errorTip.noTitle"));return}if(!(T!=null&&T.url)){M.error(f("blocklet.publish.noStoreSelected"));return}const $=Vn();v(async(V,F)=>{var Q,X,ie;try{const Y=await I.connectByStudio({input:{did:(Q=i==null?void 0:i.meta)==null?void 0:Q.did,blockletTitle:l==null?void 0:l.blockletTitle,storeUrl:T.url,storeId:T.id,storeName:T.name,type:((X=l==null?void 0:l.blockletComponents)==null?void 0:X.length)>0?"pack":"resource",componentDid:p,messageId:$,tenantScope:(x==null?void 0:x.searchParams.get("tenantScope"))||""}});if(!(Y!=null&&Y.url)){M.error("failed to connect to store");return}F(Y.url),C({did:(ie=i==null?void 0:i.meta)==null?void 0:ie.did,projectId:"",messageId:$})}catch(Y){const de=Ne(Y);M.error(de),h(!1)}})},{logoUrl:W,screenshotUrls:b,uploadLogoPrefix:w,uploadScreenshotPrefix:q}=Zo(l,i,t),{logoErrors:g,screenshotErrors:_,storeList:J,hasLogoWarning:U,hasScreenshotWarning:re}=a,K=()=>o?!1:!t||t===G.UNOWNED_DID?(M.error(f("blocklet.publish.errorTip.noFirstDid")),!1):!0,ee=$=>{if(!$.destination)return;const V=Array.from(l.blockletScreenshots),[F]=V.splice($.source.index,1);V.splice($.destination.index,0,F),d(Q=>({...Q,blockletScreenshots:V}))},Be=$=>{if(!$.destination)return;const V=Array.from(l.blockletVideos),[F]=V.splice($.source.index,1);V.splice($.destination.index,0,F),d(Q=>({...Q,blockletVideos:V}))};return e.jsxs(Xn,{children:[e.jsx(c,{display:"flex",className:"section",children:e.jsxs(c,{sx:{flex:1},children:[e.jsx(oe,{disabled:s||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:l.blockletTitle||"",onChange:$=>{u({blockletTitle:""}),d({blockletTitle:$.target.value})},error:!!n.blockletTitle,helperText:n.blockletTitle||""}),e.jsx(oe,{required:!0,label:"Blocklet DID",fullWidth:!0,readonly:!0,disabled:!0,autoComplete:"off",variant:"outlined",InputProps:{"data-cy":"export-blocklet-did",endAdornment:t===G.UNOWNED_DID&&e.jsx(Ve,{position:"end",children:e.jsx(Ut,{blocklet:i,store:T,componentDid:p,onChangeStore:L,disabled:!l.blockletTitle||o||s,loading:s,onClick:H})})},error:!!n.projectId,helperText:n.projectId||"",value:t===G.UNOWNED_DID?"":`did:abt:${t}`,sx:{mt:3}}),e.jsx(oe,{disabled:s||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:l.blockletDescription||"",onChange:$=>{u({blockletDescription:""}),d({blockletDescription:$.target.value})},error:!!n.blockletDescription,helperText:n.blockletDescription||"",sx:{mt:3}}),e.jsx(oe,{disabled:s||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:l.blockletHomepage||"",onChange:$=>{$.target.value&&!/^(http|https):\/\//.test($.target.value)?u({blockletHomepage:f("blocklet.publish.errorTip.invalidUrl")}):u({blockletHomepage:""}),d({blockletHomepage:$.target.value})},error:!!n.blockletHomepage,helperText:n.blockletHomepage||"",sx:{mt:3}}),e.jsx(oe,{disabled:s||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:l.blockletCommunity||"",onChange:$=>{$.target.value&&!/^(http|https):\/\//.test($.target.value)?u({blockletCommunity:f("blocklet.publish.errorTip.invalidUrl")}):u({blockletCommunity:""}),d({blockletCommunity:$.target.value})},error:!!n.blockletCommunity,helperText:n.blockletCommunity||"",sx:{mt:3}}),e.jsx(oe,{disabled:s||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:l.blockletSupport||"",onChange:$=>{$.target.value&&!/^(http|https):\/\//.test($.target.value)&&!/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/.test($.target.value)?u({blockletSupport:f("blocklet.publish.errorTip.invalidUrlOrEmail")}):u({blockletSupport:""}),d({blockletSupport:$.target.value})},error:!!n.blockletSupport,helperText:n.blockletSupport||"",sx:{mt:3}}),e.jsx(oe,{disabled:s||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:l.blockletRepository||"",onChange:$=>{$.target.value&&!/^(git|https|svn)/.test($.target.value)?u({blockletRepository:f("blocklet.publish.errorTip.invalidUrl")}):u({blockletRepository:""}),d({blockletRepository:$.target.value})},error:!!n.blockletRepository,helperText:n.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(Se,{direction:"column",spacing:1,sx:{mr:2,width:"160px"},children:[e.jsx(N,{variant:"subtitle1",sx:{fontWeight:"bold"},children:f("common.logo")}),e.jsxs(Se,{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:"#555"},children:[f("studio.type"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"#007ec6"},children:"png, jpg, webp, svg"})]})}),e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"#555"},children:[f("studio.ratio"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"#007ec6"},children:"256x256"})]})}),e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"#555"},children:[f("studio.size"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"#007ec6"},children:"<500Kb"})]})})]})]}),e.jsx(c,{sx:{flex:1,cursor:o?"default":"pointer",display:"flex",alignItems:"flex-end"},children:e.jsx(vo,{variant:"square",sx:{width:80,height:80},alt:"Blocklet Logo",src:S||W,onClick:()=>{var $;K()&&(($=D.current)==null||$.open())}})})]}),U&&e.jsx(mt,{errors:g,storeList:J,mt:3}),e.jsxs(c,{display:"flex",mt:3,flexDirection:"row",flexWrap:"wrap",children:[e.jsxs(Se,{direction:"column",spacing:1,sx:{mr:2,width:"160px"},children:[e.jsx(N,{variant:"subtitle1",sx:{fontWeight:"bold"},children:f("common.screenshot")}),e.jsxs(Se,{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:"#555"},children:[f("studio.ratio"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"#007ec6"},children:"16 / 9"})]})}),e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"#555"},children:[f("studio.count"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"#007ec6"},children:"1~5"})]})}),e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"#555"},children:[f("studio.size"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"#007ec6"},children:"<5MB"})]})}),!o&&e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"#555"},children:[f("studio.order"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"#007ec6"},children:f("studio.orderTip")})]})})]})]}),e.jsx(ao,{onDragEnd:o?void 0:ee,children:e.jsx(uo,{droppableId:"screenshots",direction:"horizontal",isDropDisabled:o,children:($,V)=>e.jsxs(c,{display:"flex",alignItems:"center",sx:{flex:1,flexWrap:"wrap",minHeight:160,background:V.isDraggingOver?"#f5f5f5":"transparent",transition:"background-color 0.2s ease",border:V.isDraggingOver?"2px dashed #999":"none",borderRadius:"4px"},ref:$.innerRef,...$.droppableProps,children:[b.map((F,Q)=>e.jsx(po,{draggableId:F,index:Q,isDragDisabled:o,children:(X,ie)=>e.jsxs(c,{ref:X.innerRef,...X.draggableProps,className:"screenshot",sx:{transform:ie.isDragging?"scale(1.05)":"none",boxShadow:ie.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:F}),!o&&e.jsx(ce,{...X.dragHandleProps,className:"action",style:{right:40,zIndex:10,color:"#fff"},children:e.jsx(bt,{})}),!o&&e.jsx(ce,{className:"action",onClick:()=>{d(Y=>{const de=[...Y.blockletScreenshots];return de.splice(Q,1),{...Y,blockletScreenshots:de}})},children:e.jsx(co,{})})]})},F)),$.placeholder,b.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 F;K()&&((F=k.current)==null||F.open())},children:"+"})]})})})]}),re&&e.jsx(mt,{errors:_,storeList:J}),e.jsxs(c,{display:"flex",mt:3,flexDirection:"row",flexWrap:"wrap",children:[e.jsxs(Se,{direction:"column",spacing:1,sx:{mr:2,width:"160px"},children:[e.jsx(N,{variant:"subtitle1",sx:{fontWeight:"bold"},children:f("studio.video")}),e.jsxs(Se,{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:"#555"},children:[f("studio.videoType"),":"," "]}),e.jsxs(c,{component:"span",sx:{color:"#007ec6"},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:"#555"},children:[f("studio.count"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"#007ec6"},children:"1~3"})]})}),!o&&e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"#555"},children:[f("studio.order"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"#007ec6"},children:f("studio.orderTip")})]})})]})]}),e.jsx(ao,{onDragEnd:o?void 0:Be,children:e.jsx(uo,{droppableId:"videos",direction:"horizontal",isDropDisabled:o,children:($,V)=>e.jsxs(c,{display:"flex",alignItems:"center",sx:{flex:1,flexWrap:"wrap",minHeight:160,background:V.isDraggingOver?"#f5f5f5":"transparent",transition:"background-color 0.2s ease",border:V.isDraggingOver?"2px dashed #999":"none",borderRadius:"4px"},ref:$.innerRef,...$.droppableProps,children:[l.blockletVideos.map((F,Q)=>e.jsx(po,{draggableId:F,index:Q,isDragDisabled:o,children:(X,ie)=>e.jsxs(c,{ref:X.innerRef,...X.draggableProps,className:"screenshot",sx:{transform:ie.isDragging?"scale(1.05)":"none",boxShadow:ie.isDragging?"0 5px 10px rgba(0,0,0,0.15)":"none",transition:"transform 0.2s ease, box-shadow 0.2s ease"},children:[e.jsx(st,{url:F,style:{pointerEvents:ie.isDragging?"none":"auto"}}),!o&&e.jsx(ce,{...X.dragHandleProps,className:"action",style:{right:40,zIndex:10,color:"#fff"},children:e.jsx(bt,{})}),!o&&e.jsx(ce,{className:"action",onClick:()=>{d(Y=>{const de=[...Y.blockletVideos];return de.splice(Q,1),{...Y,blockletVideos:de}})},children:e.jsx(co,{})})]})},F)),$.placeholder,l.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:()=>{K()&&B(!0)},children:"+"})]})})})]})]})}),e.jsxs(m.Suspense,{fallback:e.jsx(Fe,{}),children:[e.jsx(xo,{ref:D,locale:R,popup:!0,onUploadFinish:$=>{var V;d({blockletLogo:$.data.filename}),y(""),(V=D.current)==null||V.close()},plugins:["ImageEditor"],installerProps:{disabled:!0},apiPathProps:{uploader:w,disableMediaKitPrefix:!0,disableMediaKitStatus:!0},coreProps:{restrictions:{allowedFileTypes:["image/png","image/jpeg","image/webp","application/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"),z&&e.jsx(Ko,{onClose:()=>B(!1),params:l,setParams:d}),e.jsx(xo,{ref:k,popup:!0,onUploadFinish:$=>{var V;d(F=>{var X;const Q=F.blockletScreenshots||[];return Q.push((X=$.data)==null?void 0:X.filename),{...F,blockletScreenshots:Q}}),(V=k.current)==null||V.close()},installerProps:{disabled:!0},plugins:["ImageEditor"],apiPathProps:{uploader:q,disableMediaKitPrefix:!0,disableMediaKitStatus:!0},coreProps:{restrictions:{allowedFileTypes:["image/*","application/svg+xml"],maxFileSize:1024*1024*5,maxNumberOfFiles:5-b.length}},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,autoCropArea:1,aspectRatio:16/9,initialAspectRatio:16/9,croppedCanvasOptions:{minWidth:1280,minHeight:720,maxWidth:1280*2,maxHeight:720*2}}}},"uploader-screenshot")]})]})}es.propTypes={projectId:r.string.isRequired,readOnly:r.bool.isRequired,params:r.object.isRequired,setParams:r.func.isRequired,paramsErrTip:r.object.isRequired,setParamsErrTip:r.func.isRequired,warning:r.object.isRequired,loading:r.bool.isRequired,blocklet:r.object.isRequired,setLoading:r.func.isRequired,initUrl:r.object.isRequired,componentDid:r.isRequired,initLogoUrl:r.string.isRequired,setInitLogoUrl:r.func.isRequired};const Xn=ge.div`
|
|
124
|
+
`;var Mt={},En=ke;Object.defineProperty(Mt,"__esModule",{value:!0});var bt=Mt.default=void 0,Wn=En(Re()),On=e;bt=Mt.default=(0,Wn.default)((0,On.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 mo="lastWantToConnectStoreId";function Mn(t){var u,a;const[o,s]=m.useState(null),{session:i}=Ue(),l=m.useCallback(h=>{s(h),localStorage.setItem(mo,h==null?void 0:h.id)},[s]),d=m.useMemo(()=>{var y,p,f,R;const h=localStorage.getItem(mo),x=h?(((y=t==null?void 0:t.settings)==null?void 0:y.storeList)||[]).find(I=>I.id===h):null;if(x)return x;let S=(((p=t==null?void 0:t.settings)==null?void 0:p.storeList)||[]).find(I=>{var j;return!(I.id!==G.BLOCKLET_STORE.id||I.scope&&I.scope!=="studio"&&I.scope!==((j=i==null?void 0:i.user)==null?void 0:j.did))});return S||(S=(R=(f=t==null?void 0:t.settings)==null?void 0:f.storeList)==null?void 0:R[0]),S},[(u=t==null?void 0:t.settings)==null?void 0:u.storeList,(a=i==null?void 0:i.user)==null?void 0:a.did]);return[o||d||{},l]}const pt={};async function Qo(t,{interval:o=1e3,maxDuration:s=120*1e3,intervalFirst:i=4e3,timerKey:l=""}){pt[l]&&clearTimeout(pt[l]),await new Promise(u=>setTimeout(u,i));const d=Date.now(),n=async(u,a)=>{try{const h=await t();u(h)}catch(h){Date.now()-d>s?a(h):l?pt[l]=setTimeout(()=>n(u,a),o):setTimeout(()=>n(u,a),o)}};return new Promise(n)}function Vn(){return Math.random().toString(36).slice(2)+Math.random().toString(36).slice(2)+`${Date.now()}`.slice(-6)}function Un(t,{did:o,projectId:s,messageId:i}){return Qo(async()=>{var d;const l=await t.getProject({input:{did:o,projectId:s,messageId:i}});if(!((d=l==null?void 0:l.project)!=null&&d.blockletDid))throw new Error("Connected store not found");return l.project.blockletDid},{timerKey:"connect-studio"})}function Fn(t,{did:o,projectId:s,storeId:i}){return Qo(async()=>{var n,u;const l=await t.getProject({input:{did:o,projectId:s,messageId:""}});if(!((u=(n=l==null?void 0:l.project)==null?void 0:n.connectedStores)!=null&&u.length))throw new Error("Connected store not found");if(!l.project.connectedStores.find(a=>a.storeId===i))throw new Error("Connected store not found")},{timerKey:`connect-store-${i}`})}const Hn=({fromBlocklet:t,nodeInfo:o,blocklet:s,userDid:i})=>{var n,u;const l=t?(n=s==null?void 0:s.meta)==null?void 0:n.did:o==null?void 0:o.did;let d=t?((u=s==null?void 0:s.settings)==null?void 0:u.storeList)||[]:(o==null?void 0:o.blockletRegistryList)||[];return Array.isArray(d)||(d=[]),d=d.filter(a=>a.protected||!a.scope||a.scope==="studio"||a.scope===i),{teamDid:l,storeList:d}},Vt=Hn;function Ut({blocklet:t,store:o={},onChangeStore:s,onClick:i,disabled:l,loading:d,componentDid:n}){var b,w,q;const{t:u}=te(),{session:a}=Ue(),{api:h,info:x,inService:S}=ye(),y=ze(),[p,f]=m.useState(!1),R=m.useRef(null),[I,j]=m.useState(!1),[D,k]=m.useState(null),T=g=>{s(g),f(!1)},L=()=>{f(!p)},z=g=>{R.current&&R.current.contains(g.target)||f(!1)},B=()=>{j(!0)},v=()=>{j(!1)},C=async()=>{var g;if(D)try{await h.deleteBlockletStore({input:{teamDid:t.meta.did,url:D.url,projectId:"",scope:D.scope||"studio"}}),await((g=y==null?void 0:y.actions)==null?void 0:g.refreshBlocklet())}catch(_){M.error(`Remove Blocklet Store Error: ${Ne(_)}`)}finally{k(null)}},{storeList:H}=Vt({fromBlocklet:S,blocklet:t,nodeInfo:x,componentDid:n,userDid:(b=a==null?void 0:a.user)==null?void 0:b.did}),W=(w=t==null?void 0:t.meta)==null?void 0:w.did;return e.jsxs(e.Fragment,{children:[e.jsxs(ht,{disabled:l,ref:R,variant:"contained",color:"primary","aria-label":"Button group with connect store",children:[e.jsxs(se,{onClick:i,children:[d&&e.jsx(Ye,{size:14,sx:{mr:.5}}),`${u("common.connect")} ${o.name||""}`]}),e.jsx(se,{size:"small","aria-controls":p?"split-button-menu":void 0,"aria-expanded":p?"true":void 0,"aria-label":"select merge strategy","aria-haspopup":"menu",onClick:L,children:e.jsx(an,{})})]}),e.jsx(So,{sx:{zIndex:10},open:p,anchorEl:R.current,placement:"bottom-end",role:void 0,transition:!0,disablePortal:!0,children:({TransitionProps:g})=>e.jsx(Io,{...g,style:{transformOrigin:"center top"},children:e.jsx(jt,{children:e.jsx(Do,{onClickAway:z,children:e.jsxs(To,{id:"split-button-menu",autoFocusItem:!0,sx:{maxHeight:300,overflowY:"auto",zIndex:10},children:[H==null?void 0:H.map(_=>{var J;return e.jsxs(fe,{selected:_.id===(o==null?void 0:o.id),sx:{height:56},onClick:()=>T(_),children:[e.jsxs(c,{children:[e.jsx(je,{sx:{fontSize:"16px"},maxLength:24,children:_.name}),e.jsx(je,{sx:{fontSize:"13px",opacity:.6},maxLength:30,children:_.url})]}),en({store:_,userDid:(J=a==null?void 0:a.user)==null?void 0:J.did})&&e.jsx(ce,{sx:{ml:1},onClick:U=>{U.preventDefault(),U.stopPropagation(),k(_)},children:e.jsx(ae,{icon:"ic:outline-delete"})})]},_.url)}),e.jsx(Rs,{}),e.jsxs(fe,{onClick:B,children:[e.jsx(Rt,{font:!0}),e.jsx(N,{variant:"inherit",children:u("store.blockletRegistry.addRegistry")})]})]})})})})}),I&&e.jsx(Wo,{hiddenChildren:!0,open:!0,onClose:v,teamDid:W,storeList:H,scope:"studio",onAdd:(q=y==null?void 0:y.actions)==null?void 0:q.refreshBlocklet}),D&&e.jsx(vt,{displayError:!0,title:`${u("common.delete")} ${D.name}`,description:u("blocklet.publish.deleteStoreTip",{name:D.name}),confirm:u("common.confirm"),onConfirm:C,onCancel:()=>k(null)})]})}Ut.propTypes={store:r.object,blocklet:r.object,onChangeStore:r.func.isRequired,onClick:r.func.isRequired,loading:r.bool.isRequired,disabled:r.bool.isRequired,componentDid:r.string.isRequired,projectType:r.string.isRequired,getData:r.func.isRequired};Ut.defaultProps={store:null,blocklet:null};const Gn=(t,o,s)=>{const i=`${G.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${o.meta.did}/${s}/logo/upload`,l=`${G.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${o.meta.did}/${s}/screenshot/upload`,d=t!=null&&t.blockletLogo?`${i}/${t.blockletLogo}`:`${G.WELLKNOWN_SERVICE_PATH_PREFIX}/static/images/logo.png`,n=((t==null?void 0:t.blockletScreenshots)||[]).filter(Boolean).map(u=>`${l}/${u}`);return{logoUrl:d,screenshotUrls:n,uploadLogoPrefix:i,uploadScreenshotPrefix:l}},Zo=Gn,Jn=t=>{const o=t.includes("youtube.com")||t.includes("youtu.be"),s=t.includes("vimeo.com");return o||s};function st({url:t,style:o,controls:s,modestbranding:i}){var u;const{t:l}=te(),d=t.includes("youtube.com")||t.includes("youtu.be"),n=t.includes("vimeo.com");if(d){const a=((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/${a}?modestbranding=${i}&controls=${s}&rel=0`,title:"YouTube video player",style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",border:"none",...o},allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0})})}if(n){const a=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/${a}`,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(ae,{icon:"carbon:video-off",style:{fontSize:40,marginBottom:"10px",opacity:.5}}),e.jsx(N,{variant:"body1",sx:{opacity:.5},children:l("studio.videoDialogNoSrc")})]})})}st.propTypes={url:r.string.isRequired,style:r.object,controls:r.number,modestbranding:r.number};st.defaultProps={style:{},controls:1,modestbranding:1};function Ko({setParams:t,onClose:o,params:s}){const{t:i}=te(),[l,d]=m.useState(""),n=l&&s.blockletVideos.includes(l),u=Jn(l),a=()=>{t(h=>{const x=[...h.blockletVideos];return x.push(l),{...h,blockletVideos:x}}),o()};return e.jsxs(ot,{open:!0,fullWidth:!0,maxWidth:"sm",children:[e.jsx(_o,{children:i("studio.videoDialogTitle")}),e.jsxs(Po,{children:[e.jsx(vs,{fullWidth:!0,value:l,onChange:h=>d(h.target.value),placeholder:i("studio.videoInputLabel"),endAdornment:l?e.jsx(Ve,{position:"end",children:e.jsx(ce,{onClick:()=>d(""),children:e.jsx(Os,{})})}):null,error:n}),n&&e.jsx(N,{variant:"body2",color:"error",children:i("studio.duplicateVideo")}),e.jsx(st,{url:l,style:{marginTop:"20px",borderRadius:"4px"}})]}),e.jsxs(qo,{children:[e.jsx(se,{onClick:()=>o(),children:i("studio.cancel")}),e.jsx(se,{disabled:!u||n,onClick:a,children:i("studio.confirm")})]})]})}Ko.propTypes={onClose:r.func.isRequired,params:r.object.isRequired,setParams:r.func.isRequired};function mt({errors:t,storeList:o,...s}){const{t:i}=te();return e.jsxs(c,{...s,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:i("blocklet.publish.storeRule.warning")}),t&&Object.entries(t).map(([l,d])=>{const n=Object.values(d),u=o.find(a=>a.url===l);return n.length>0&&e.jsxs(c,{children:[e.jsx(xe,{title:l,children:e.jsx(c,{component:"span",sx:{cursor:"pointer"},children:u.name})}),n.map(a=>e.jsx(c,{component:"li",ml:2,breakWords:!0,children:a},a))]},l)})]})}mt.propTypes={errors:r.object.isRequired,storeList:r.array.isRequired};const xo=m.lazy(()=>zo(()=>import("./index-rMaglH7e.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12])).then(t=>({default:t.Uploader})));function es({projectId:t,readOnly:o,loading:s,blocklet:i,params:l,setParams:d,paramsErrTip:n,setParamsErrTip:u,warning:a,setLoading:h,initUrl:x,initLogoUrl:S,setInitLogoUrl:y,componentDid:p}){const{t:f,locale:R}=te(),{api:I}=ye(),j=gt(),D=m.useRef(null),k=m.useRef(null),[T,L]=Mn(i),[z,B]=m.useState(!1),v=tn({messageType:"connect-store-message",onOpen:()=>h(!0),onClose:()=>h(!1)}),C=async $=>{const V=setTimeout(()=>{h(!1)},2e4),F=await Un(I,$);h(!1),clearTimeout(V),window.parent.postMessage({event:"studioDialog.connected",componentDid:p},"*"),j(window.location.pathname.replace(`${G.UNOWNED_DID}/create`,`${F}/create`),{replace:!0})},H=()=>{if(!l.blockletTitle){M.error(f("blocklet.publish.errorTip.noTitle"));return}if(!(T!=null&&T.url)){M.error(f("blocklet.publish.noStoreSelected"));return}const $=Vn();v(async(V,F)=>{var Q,X,ie;try{const Y=await I.connectByStudio({input:{did:(Q=i==null?void 0:i.meta)==null?void 0:Q.did,blockletTitle:l==null?void 0:l.blockletTitle,storeUrl:T.url,storeId:T.id,storeName:T.name,type:((X=l==null?void 0:l.blockletComponents)==null?void 0:X.length)>0?"pack":"resource",componentDid:p,messageId:$,tenantScope:(x==null?void 0:x.searchParams.get("tenantScope"))||""}});if(!(Y!=null&&Y.url)){M.error("failed to connect to store");return}F(Y.url),C({did:(ie=i==null?void 0:i.meta)==null?void 0:ie.did,projectId:"",messageId:$})}catch(Y){const de=Ne(Y);M.error(de),h(!1)}})},{logoUrl:W,screenshotUrls:b,uploadLogoPrefix:w,uploadScreenshotPrefix:q}=Zo(l,i,t),{logoErrors:g,screenshotErrors:_,storeList:J,hasLogoWarning:U,hasScreenshotWarning:re}=a,K=()=>o?!1:!t||t===G.UNOWNED_DID?(M.error(f("blocklet.publish.errorTip.noFirstDid")),!1):!0,ee=$=>{if(!$.destination)return;const V=Array.from(l.blockletScreenshots),[F]=V.splice($.source.index,1);V.splice($.destination.index,0,F),d(Q=>({...Q,blockletScreenshots:V}))},Be=$=>{if(!$.destination)return;const V=Array.from(l.blockletVideos),[F]=V.splice($.source.index,1);V.splice($.destination.index,0,F),d(Q=>({...Q,blockletVideos:V}))};return e.jsxs(Xn,{children:[e.jsx(c,{display:"flex",className:"section",children:e.jsxs(c,{sx:{flex:1},children:[e.jsx(oe,{disabled:s||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:l.blockletTitle||"",onChange:$=>{u({blockletTitle:""}),d({blockletTitle:$.target.value})},error:!!n.blockletTitle,helperText:n.blockletTitle||""}),e.jsx(oe,{required:!0,label:"Blocklet DID",fullWidth:!0,readonly:!0,disabled:!0,autoComplete:"off",variant:"outlined",InputProps:{"data-cy":"export-blocklet-did",endAdornment:t===G.UNOWNED_DID&&e.jsx(Ve,{position:"end",children:e.jsx(Ut,{blocklet:i,store:T,componentDid:p,onChangeStore:L,disabled:!l.blockletTitle||o||s,loading:s,onClick:H})})},error:!!n.projectId,helperText:n.projectId||"",value:t===G.UNOWNED_DID?"":`did:abt:${t}`,sx:{mt:3}}),e.jsx(oe,{disabled:s||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:l.blockletDescription||"",onChange:$=>{u({blockletDescription:""}),d({blockletDescription:$.target.value})},error:!!n.blockletDescription,helperText:n.blockletDescription||"",sx:{mt:3}}),e.jsx(oe,{disabled:s||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:l.blockletHomepage||"",onChange:$=>{$.target.value&&!/^(http|https):\/\//.test($.target.value)?u({blockletHomepage:f("blocklet.publish.errorTip.invalidUrl")}):u({blockletHomepage:""}),d({blockletHomepage:$.target.value})},error:!!n.blockletHomepage,helperText:n.blockletHomepage||"",sx:{mt:3}}),e.jsx(oe,{disabled:s||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:l.blockletCommunity||"",onChange:$=>{$.target.value&&!/^(http|https):\/\//.test($.target.value)?u({blockletCommunity:f("blocklet.publish.errorTip.invalidUrl")}):u({blockletCommunity:""}),d({blockletCommunity:$.target.value})},error:!!n.blockletCommunity,helperText:n.blockletCommunity||"",sx:{mt:3}}),e.jsx(oe,{disabled:s||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:l.blockletSupport||"",onChange:$=>{$.target.value&&!/^(http|https):\/\//.test($.target.value)&&!/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/.test($.target.value)?u({blockletSupport:f("blocklet.publish.errorTip.invalidUrlOrEmail")}):u({blockletSupport:""}),d({blockletSupport:$.target.value})},error:!!n.blockletSupport,helperText:n.blockletSupport||"",sx:{mt:3}}),e.jsx(oe,{disabled:s||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:l.blockletRepository||"",onChange:$=>{$.target.value&&!/^(git|https|svn)/.test($.target.value)?u({blockletRepository:f("blocklet.publish.errorTip.invalidUrl")}):u({blockletRepository:""}),d({blockletRepository:$.target.value})},error:!!n.blockletRepository,helperText:n.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(Se,{direction:"column",spacing:1,sx:{mr:2,width:"160px"},children:[e.jsx(N,{variant:"subtitle1",sx:{fontWeight:"bold"},children:f("common.logo")}),e.jsxs(Se,{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:"#555"},children:[f("studio.type"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"#007ec6"},children:"png, jpg, webp, svg"})]})}),e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"#555"},children:[f("studio.ratio"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"#007ec6"},children:"256x256"})]})}),e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"#555"},children:[f("studio.size"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"#007ec6"},children:"<500Kb"})]})})]})]}),e.jsx(c,{sx:{flex:1,cursor:o?"default":"pointer",display:"flex",alignItems:"flex-end"},children:e.jsx(vo,{variant:"square",sx:{width:80,height:80},alt:"Blocklet Logo",src:S||W,onClick:()=>{var $;K()&&(($=D.current)==null||$.open())}})})]}),U&&e.jsx(mt,{errors:g,storeList:J,mt:3}),e.jsxs(c,{display:"flex",mt:3,flexDirection:"row",flexWrap:"wrap",children:[e.jsxs(Se,{direction:"column",spacing:1,sx:{mr:2,width:"160px"},children:[e.jsx(N,{variant:"subtitle1",sx:{fontWeight:"bold"},children:f("common.screenshot")}),e.jsxs(Se,{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:"#555"},children:[f("studio.ratio"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"#007ec6"},children:"16 / 9"})]})}),e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"#555"},children:[f("studio.count"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"#007ec6"},children:"1~5"})]})}),e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"#555"},children:[f("studio.size"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"#007ec6"},children:"<5MB"})]})}),!o&&e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"#555"},children:[f("studio.order"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"#007ec6"},children:f("studio.orderTip")})]})})]})]}),e.jsx(ao,{onDragEnd:o?void 0:ee,children:e.jsx(uo,{droppableId:"screenshots",direction:"horizontal",isDropDisabled:o,children:($,V)=>e.jsxs(c,{display:"flex",alignItems:"center",sx:{flex:1,flexWrap:"wrap",minHeight:160,background:V.isDraggingOver?"#f5f5f5":"transparent",transition:"background-color 0.2s ease",border:V.isDraggingOver?"2px dashed #999":"none",borderRadius:"4px"},ref:$.innerRef,...$.droppableProps,children:[b.map((F,Q)=>e.jsx(po,{draggableId:F,index:Q,isDragDisabled:o,children:(X,ie)=>e.jsxs(c,{ref:X.innerRef,...X.draggableProps,className:"screenshot",sx:{transform:ie.isDragging?"scale(1.05)":"none",boxShadow:ie.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:F}),!o&&e.jsx(ce,{...X.dragHandleProps,className:"action",style:{right:40,zIndex:10,color:"#fff"},children:e.jsx(bt,{})}),!o&&e.jsx(ce,{className:"action",onClick:()=>{d(Y=>{const de=[...Y.blockletScreenshots];return de.splice(Q,1),{...Y,blockletScreenshots:de}})},children:e.jsx(co,{})})]})},F)),$.placeholder,b.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 F;K()&&((F=k.current)==null||F.open())},children:"+"})]})})})]}),re&&e.jsx(mt,{errors:_,storeList:J}),e.jsxs(c,{display:"flex",mt:3,flexDirection:"row",flexWrap:"wrap",children:[e.jsxs(Se,{direction:"column",spacing:1,sx:{mr:2,width:"160px"},children:[e.jsx(N,{variant:"subtitle1",sx:{fontWeight:"bold"},children:f("studio.video")}),e.jsxs(Se,{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:"#555"},children:[f("studio.videoType"),":"," "]}),e.jsxs(c,{component:"span",sx:{color:"#007ec6"},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:"#555"},children:[f("studio.count"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"#007ec6"},children:"1~3"})]})}),!o&&e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"#555"},children:[f("studio.order"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"#007ec6"},children:f("studio.orderTip")})]})})]})]}),e.jsx(ao,{onDragEnd:o?void 0:Be,children:e.jsx(uo,{droppableId:"videos",direction:"horizontal",isDropDisabled:o,children:($,V)=>e.jsxs(c,{display:"flex",alignItems:"center",sx:{flex:1,flexWrap:"wrap",minHeight:160,background:V.isDraggingOver?"#f5f5f5":"transparent",transition:"background-color 0.2s ease",border:V.isDraggingOver?"2px dashed #999":"none",borderRadius:"4px"},ref:$.innerRef,...$.droppableProps,children:[l.blockletVideos.map((F,Q)=>e.jsx(po,{draggableId:F,index:Q,isDragDisabled:o,children:(X,ie)=>e.jsxs(c,{ref:X.innerRef,...X.draggableProps,className:"screenshot",sx:{transform:ie.isDragging?"scale(1.05)":"none",boxShadow:ie.isDragging?"0 5px 10px rgba(0,0,0,0.15)":"none",transition:"transform 0.2s ease, box-shadow 0.2s ease"},children:[e.jsx(st,{url:F,style:{pointerEvents:ie.isDragging?"none":"auto"}}),!o&&e.jsx(ce,{...X.dragHandleProps,className:"action",style:{right:40,zIndex:10,color:"#fff"},children:e.jsx(bt,{})}),!o&&e.jsx(ce,{className:"action",onClick:()=>{d(Y=>{const de=[...Y.blockletVideos];return de.splice(Q,1),{...Y,blockletVideos:de}})},children:e.jsx(co,{})})]})},F)),$.placeholder,l.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:()=>{K()&&B(!0)},children:"+"})]})})})]})]})}),e.jsxs(m.Suspense,{fallback:e.jsx(Fe,{}),children:[e.jsx(xo,{ref:D,locale:R,popup:!0,onUploadFinish:$=>{var V;d({blockletLogo:$.data.filename}),y(""),(V=D.current)==null||V.close()},plugins:["ImageEditor"],installerProps:{disabled:!0},apiPathProps:{uploader:w,disableMediaKitPrefix:!0,disableMediaKitStatus:!0},coreProps:{restrictions:{allowedFileTypes:["image/png","image/jpeg","image/webp","image/svg+xml"],maxFileSize:1024*1024*.5,maxNumberOfFiles:1}},dashboardProps:{autoOpen:"imageEditor"},imageEditorProps:{actions:{revert:!0,rotate:!0,granularRotate:!0,flip:!0,zoomIn:!0,zoomOut:!0,cropSquare:!1,cropWidescreen:!1,cropWidescreenVertical:!1},cropperOptions:{autoCrop:!0,aspectRatio:1,initialAspectRatio:1,autoCropArea:1,croppedCanvasOptions:{minWidth:256,minHeight:256}}}},"uploader-logo"),z&&e.jsx(Ko,{onClose:()=>B(!1),params:l,setParams:d}),e.jsx(xo,{ref:k,popup:!0,onUploadFinish:$=>{var V;d(F=>{var X;const Q=F.blockletScreenshots||[];return Q.push((X=$.data)==null?void 0:X.filename),{...F,blockletScreenshots:Q}}),(V=k.current)==null||V.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-b.length}},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,autoCropArea:1,aspectRatio:16/9,initialAspectRatio:16/9,croppedCanvasOptions:{minWidth:1280,minHeight:720,maxWidth:1280*2,maxHeight:720*2}}}},"uploader-screenshot")]})]})}es.propTypes={projectId:r.string.isRequired,readOnly:r.bool.isRequired,params:r.object.isRequired,setParams:r.func.isRequired,paramsErrTip:r.object.isRequired,setParamsErrTip:r.func.isRequired,warning:r.object.isRequired,loading:r.bool.isRequired,blocklet:r.object.isRequired,setLoading:r.func.isRequired,initUrl:r.object.isRequired,componentDid:r.isRequired,initLogoUrl:r.string.isRequired,setInitLogoUrl:r.func.isRequired};const Xn=ge.div`
|
|
125
125
|
margin-top: 24px;
|
|
126
126
|
.screenshot {
|
|
127
127
|
margin-bottom: 16px;
|
|
@@ -169,7 +169,7 @@ import{r as m,f as gt,l as tt,L as me,u as js,i as ks,j as ct}from"./vendor-reac
|
|
|
169
169
|
padding-bottom: 12px;
|
|
170
170
|
border-bottom: ${({theme:t})=>`1px solid ${t.palette.divider}`};
|
|
171
171
|
}
|
|
172
|
-
`;function rs({text:t}){return t?e.jsx(un,{wrapperElement:{"data-color-mode":"light"},source:Fs.sanitize(t),rehypePlugins:[[pn,{target:"_blank"}]]}):e.jsx(Ae,{Icon:Dt})}rs.propTypes={text:r.string.isRequired};function is({params:t,setParams:o,paramsErrTip:s,loading:i,setParamsErrTip:l,readOnly:d}){var x;const{t:n}=te(),[u,a]=m.useState(d?"preview":"write"),h=(S,y)=>{a(y)};return e.jsxs(c,{sx:{border:"1px solid #fff",width:"100%",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:n("common.introduction")}),e.jsxs($o,{value:u,onChange:h,"aria-label":"wrapped label tabs example",children:[e.jsx(Qe,{value:"write",label:"Write"}),e.jsx(Qe,{value:"preview",label:"Preview"})]})]}),e.jsx(c,{display:u==="write"?"block":"none",sx:{width:"100%",marginTop:3},children:e.jsx(oe,{disabled:i||d,sx:{border:"none"},placeholder:`Blocklet ${n("common.introduction")}`,InputProps:{"data-cy":"export-blocklet-introduction",readOnly:d,endAdornment:e.jsxs(Ve,{position:"end",children:[((x=t==null?void 0:t.blockletIntroduction)==null?void 0:x.length)||0," / ",ue.PROJECT.MAX_INTRO_LENGTH]})},autoComplete:"off",variant:"outlined",fullWidth:!0,multiline:!0,minRows:4,value:t.blockletIntroduction||"",onChange:S=>{l({blockletIntroduction:""}),o({blockletIntroduction:S.target.value.slice(0,ue.PROJECT.MAX_INTRO_LENGTH)})},error:!!s.blockletIntroduction,helperText:s.blockletIntroduction||""})}),e.jsx(c,{display:u==="preview"?"block":"none",mt:3,children:e.jsx(rs,{text:t.blockletIntroduction||""})})]})}is.propTypes={params:r.object.isRequired,setParams:r.func.isRequired,paramsErrTip:r.object.isRequired,setParamsErrTip:r.func.isRequired,readOnly:r.bool.isRequired,loading:r.bool.isRequired};var Gt={},ll=ke;Object.defineProperty(Gt,"__esModule",{value:!0});var xt=Gt.default=void 0,rl=ll(Re()),jo=e;xt=Gt.default=(0,rl.default)([(0,jo.jsx)("circle",{cx:"12",cy:"19",r:"2"},"0"),(0,jo.jsx)("path",{d:"M10 3h4v12h-4z"},"1")],"PriorityHigh");function Jt({step:t,ok:o,active:s,error:i,warning:l}){let d="grey.500",n=t+1;return o&&(n=e.jsx(hn,{sx:{fontSize:18,margin:0},color:"white"})),i||!o&&s>t?(d="error.main",n=e.jsx(xt,{sx:{fontSize:18,margin:0},color:"white"})):l?(d="warning.main",n=e.jsx(xt,{sx:{fontSize:18,margin:0},color:"white"})):s>=t&&(d="primary.main"),e.jsx(c,{width:24,height:24,bgcolor:d,borderRadius:"100%",color:"white",display:"flex",justifyContent:"center",fontWeight:"bold",fontSize:14,alignItems:"center",children:n})}Jt.propTypes={step:r.number,ok:r.bool,active:r.number,error:r.string,warning:r.bool};Jt.defaultProps={step:0,ok:!1,active:0,error:"",warning:!1};function cs({steps:t,activeStep:o,setActiveStep:s,hasSelectedResources:i,params:l,loading:d,paramsErrTip:n,warning:u,viewMode:a,projectId:h}){const{t:x}=te(),S=()=>{s(R=>R+1)},y=()=>{s(R=>R-1)},p=R=>R===0?(n==null?void 0:n.blockletTitle)||(n==null?void 0:n.projectId)||(n==null?void 0:n.blockletDescription)||(n==null?void 0:n.blockletHomepage)||(n==null?void 0:n.blockletSupport)||(n==null?void 0:n.blockletCommunity)||(n==null?void 0:n.blockletRepository):R===2?(n==null?void 0:n.blockletResource)||(n==null?void 0:n.blockletDocker)||(n==null?void 0:n.dockerImageName):R>=4?(n==null?void 0:n.blockletVersion)||(n==null?void 0:n.note):"",f=a||os({hasSelectedResources:i,params:l,projectId:h,t:x})===null;return e.jsxs(c,{sx:{width:300,maxWidth:300,minWidth:300,padding:2,border:"1px solid #ccc",borderRadius:2},children:[e.jsx(Ds,{activeStep:o,orientation:"vertical",children:t.map((R,I)=>{const j={},D=d||!sl({hasSelectedResources:i,params:l,projectId:h,step:I,t:x}),k=d?"":p(I);return k&&(j.optional=e.jsx(N,{variant:"caption",color:"error",children:k}),j.error=!0),e.jsxs(Ts,{children:[e.jsx(_s,{icon:e.jsx(Jt,{error:k,warning:I===0?u.hasWarning:!1,active:f?99:o,step:I,ok:D}),sx:{cursor:"pointer",color:k?"error.main":"inherit"},disabled:!1,onClick:()=>s(I),...j,children:e.jsx(N,{fontSize:"14px",fontWeight:"500",color:k||!D&&o>I?"error.main":"inherit",children:R.label})}),e.jsxs(Ps,{children:[e.jsx(N,{fontSize:12,children:R.description}),!f&&e.jsx(c,{sx:{mb:2},children:e.jsxs("div",{children:[I<t.length-1&&e.jsx(se,{variant:"contained",onClick:S,sx:{mt:1,mr:1},disabled:k||!D,children:x("common.continue")}),I>0&&e.jsx(se,{disabled:I===0,onClick:y,sx:{mt:1,mr:1},children:x("common.back")})]})})]})]},R.label)})}),o>=t.length-1&&e.jsx(jt,{square:!0,elevation:0,sx:{p:3},children:e.jsx(N,{fontSize:12,sx:{opacity:.5},children:"Click right top button to release"})})]})}cs.propTypes={steps:r.array.isRequired,activeStep:r.number.isRequired,setActiveStep:r.func.isRequired,params:r.object.isRequired,viewMode:r.string.isRequired,loading:r.bool.isRequired,projectId:r.string.isRequired,hasSelectedResources:r.bool.isRequired,warning:r.object.isRequired,paramsErrTip:r.shape({projectId:r.string,blockletVersion:r.string,blockletTitle:r.string,blockletDescription:r.string,note:r.string,blockletResource:r.string,blockletHomepage:r.string,blockletSupport:r.string,blockletCommunity:r.string,blockletRepository:r.string,blockletDocker:r.object,dockerImageName:r.string}).isRequired};const il=[".zip",".gz"],cl=1024*1024*100,al=m.lazy(()=>zo(()=>import("./index-CB6NPYWM.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12])).then(t=>({default:t.Uploader})));function Xt({app:t,projectId:o,readOnly:s,params:i,setParams:l,setParamsErrTip:d,error:n}){const{t:u,locale:a}=te(),h=m.useRef(null),x=()=>s?!1:!o||o===G.UNOWNED_DID?(M.error(u("blocklet.publish.errorTip.noFirstDid")),!1):!0,S=`${G.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(Se,{direction:"row",alignItems:"center",spacing:1,sx:{flex:1,cursor:s?"default":"pointer"},children:[!!i.uploadedResource&&e.jsx(N,{component:"a",href:`${S}/params.uploadedResource`,children:i.uploadedResource}),!s&&e.jsx(se,{variant:"outlined",size:"small",onClick:()=>{var y;x()&&((y=h.current)==null||y.open())},children:i.uploadedResource?u("common.change"):u("common.upload")})]}),e.jsx(m.Suspense,{fallback:e.jsx(Fe,{}),children:e.jsx(al,{ref:h,locale:a,popup:!0,onUploadFinish:y=>{var p;l({uploadedResource:y.data.filename}),d({blockletResource:""}),(p=h.current)==null||p.close()},plugins:["ImageEditor"],installerProps:{disabled:!0},apiPathProps:{uploader:S,disableMediaKitPrefix:!0,disableMediaKitStatus:!0},coreProps:{restrictions:{allowedFileExts:il,maxFileSize:cl,maxNumberOfFiles:1}}},"uploader-resource")}),!!n&&e.jsx(c,{color:"error.main",mt:1,fontSize:14,children:n})]})}Xt.propTypes={app:r.object.isRequired,projectId:r.string.isRequired,readOnly:r.bool.isRequired,params:r.object.isRequired,setParams:r.func.isRequired,error:r.string.isRequired,setParamsErrTip:r.func.isRequired};Xt.defaultProps={};function Ke({readOnly:t,params:o,setParams:s,paramsErrTip:i,setParamsErrTip:l,loading:d}){var u;const{t:n}=te();return e.jsx(c,{display:"flex",mt:3,className:"section",children:e.jsxs(c,{sx:{flex:1},children:[e.jsx(oe,{required:!0,disabled:d||t,label:`Blocklet ${n("common.version")}`,placeholder:`Blocklet ${n("common.version")}`,InputProps:{"data-cy":"blocklet-version",readOnly:t},autoComplete:"off",variant:"outlined",fullWidth:!0,value:o.blockletVersion||"",onChange:a=>{l({blockletVersion:""}),s({blockletVersion:a.target.value})},error:!!i.blockletVersion,helperText:i.blockletVersion||""}),e.jsx(oe,{label:n("blocklet.publish.releaseNote"),autoComplete:"off",disabled:d||t,variant:"outlined",InputProps:{"data-cy":"release-note",readOnly:t,endAdornment:e.jsxs(Ve,{position:"end",children:[((u=o==null?void 0:o.note)==null?void 0:u.length)||0," / ",ue.PROJECT.MAX_NOTE_LENGTH]})},fullWidth:!0,multiline:!0,minRows:4,required:!0,value:o.note||"",onChange:a=>{l({note:""}),s({note:a.target.value.slice(0,ue.PROJECT.MAX_NOTE_LENGTH)})},error:!!i.note,helperText:i.note||"",sx:{mt:3}})]})})}Ke.propTypes={readOnly:r.bool.isRequired,params:r.object.isRequired,setParams:r.func.isRequired,paramsErrTip:r.object.isRequired,setParamsErrTip:r.func.isRequired,loading:r.bool.isRequired};Ke.defaultProps={};function as(t){for(const o in t)typeof t[o]=="string"?t[o]=t[o].replace(/\\\\/g,"\\"):typeof t[o]=="object"&&t[o]!==null&&as(t[o]);return t}function et({index:t,item:o,dockerParams:s,setDockerParams:i,dataKey:l,t:d,readOnly:n}){const u=(o==null?void 0:o.value)||"",[a,h]=m.useState(!1),x=()=>{var W;(W=s[l])==null||W.splice(t,1),i({...s,[l]:[...s[l]]})},S=(W,b)=>{var w;(w=s[l])!=null&&w[t]&&(b?(s[l][t].custom=s[l][t].value,s[l][t].value=`$${dt(o.key)}`):(s[l][t].value=s[l][t].custom||"",s[l][t].custom="")),i({...s,[l]:[...s[l]]})},y=(W,b)=>{var q;const w=((q=s[l][t])==null?void 0:q.value)||"";s[l][t]={...s[l][t],secure:b,value:b&&w===ue.BLOCKLET_AUTOMATIC_ENV_VALUE?"":w},i({...s,[l]:[...s[l]]})},p=(W,b)=>{s[l][t]={...s[l][t],shared:b},i({...s,[l]:[...s[l]]})},f=(W,b)=>{var q;const w=((q=s[l][t])==null?void 0:q.value)||"";s[l][t]={...s[l][t],required:b,value:b&&w===ue.BLOCKLET_AUTOMATIC_ENV_VALUE?"":w},i({...s,[l]:[...s[l]]})},R=(W,b)=>{s[l][t]={...s[l][t],value:b?ue.BLOCKLET_AUTOMATIC_ENV_VALUE:"",secure:!1,required:!1},i({...s,[l]:[...s[l]]})},I=W=>{s[l][t]={...s[l][t],description:W.target.value},i({...s,[l]:[...s[l]]})},j=W=>{const b=W.target.value==="web"?"web":"docker";b==="web"&&s.dockerArgs.forEach(g=>{g.type="docker"});const q=`/${s.dockerImage.replace(/\W/g,"-")}-${t}`;s.dockerArgs[t]={...s.dockerArgs[t],type:b,path:b==="docker"?q:"/",protocol:"http",prefix:b==="docker"?q:"/",name:"publicUrl",port:"BLOCKLET_PORT"},i({...s,dockerArgs:[...s.dockerArgs]})},D=W=>{s.dockerArgs[t]={...s.dockerArgs[t],proxyBehavior:W.target.value==="direct"?"direct":"service"},i({...s,dockerArgs:[...s.dockerArgs]})},k=W=>{const b=W.target.value;s[l][t]={...s[l][t],prefix:b,path:b==="*"?"/":b},i({...s,[l]:[...s[l]]})},T=W=>{var b;(b=s[l])!=null&&b[t]&&(s[l][t].value=W.target.value),i({...s,[l]:[...s[l]]})},L=u===`$${dt(o.key)}`||o.custom,z=l==="dockerArgs"&&!Oo[o.key],B=nn[o.key],v=l==="dockerEnvs",C=o.key==="--publish";let H=o.key;return C&&o.type==="web"?H="--publish (Web)":v&&(H=`--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:H})}),e.jsxs(c,{sx:{display:"flex",flexDirection:"column",gap:1,flex:1},children:[e.jsx(oe,{disabled:n||L||z||o.value===ue.BLOCKLET_AUTOMATIC_ENV_VALUE,placeholder:"",value:L?`$${dt(o.key)}`:u,sx:{flex:1},InputProps:{endAdornment:e.jsxs(Ve,{position:"end",sx:{zoom:.9},children:[(!(B||z)||v||C)&&e.jsx(ce,{onClick:()=>h(!0),children:e.jsx(ae,{icon:"icon-park-outline:setting-config"})}),!n&&e.jsx(ce,{onClick:x,color:z?"error":"default",children:e.jsx(ae,{icon:"ic:round-delete"})})]})},error:z,onChange:T}),z&&e.jsx(N,{variant:"caption",color:"error",children:d("blocklet.publish.docker.noAllowTheArg")}),o.key==="--publish"&&e.jsx(N,{variant:"caption",color:"text.secondary",children:d("blocklet.publish.docker.publishTips")}),o.key==="--volume"&&ln[o.key](u)&&e.jsx(N,{variant:"caption",color:"error",children:d("blocklet.publish.docker.volumeTips")})]}),a&&e.jsx(yt,{open:!0,fullWidth:!0,maxWidth:"sm",PaperProps:{style:{minHeight:0}},title:d(v?"blocklet.publish.docker.modifyEnv":"blocklet.publish.docker.modifyParam"),onClose:()=>h(!1),children:e.jsxs(c,{sx:{display:"flex",flexDirection:"column",gap:1,paddingBottom:2},children:[B||z||v?null:e.jsxs(c,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(N,{children:d("blocklet.publish.docker.needCustomInput")}),e.jsx(De,{disabled:n,checked:L,onChange:S,sx:{zoom:.9}})]}),v&&e.jsxs(c,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(N,{children:d("blocklet.publish.docker.shared")}),e.jsx(De,{disabled:n,checked:o.shared,onChange:p,sx:{zoom:.9}})]}),v&&e.jsxs(c,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(N,{children:d("blocklet.publish.docker.required")}),e.jsx(De,{disabled:n,checked:o.required,onChange:f,sx:{zoom:.9}})]}),v&&e.jsxs(c,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(N,{children:d("blocklet.publish.docker.secure")}),e.jsx(De,{disabled:n,checked:o.secure,onChange:y,sx:{zoom:.9}})]}),v&&e.jsxs(c,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(N,{children:d("blocklet.publish.docker.autoGenerated")}),e.jsx(De,{disabled:n,checked:o.value===ue.BLOCKLET_AUTOMATIC_ENV_VALUE,onChange:R,sx:{zoom:.9}})]}),v&&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:d("blocklet.publish.docker.description")}),e.jsx(oe,{disabled:n,value:o.description,onChange:I,sx:{flex:1},label:d("blocklet.publish.docker.description")})]}),C&&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:d("blocklet.publish.docker.portType")}),e.jsxs(ft,{value:o.type||"docker",onChange:j,children:[e.jsx(fe,{value:"docker",children:"Docker"}),e.jsx(fe,{value:"web",children:"Web"})]})]}),C&&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:d("blocklet.publish.docker.proxyBehavior")}),e.jsxs(ft,{value:o.proxyBehavior||"service",onChange:D,children:[e.jsx(fe,{value:"service",children:d("blocklet.publish.docker.serviceProxy")}),e.jsx(fe,{value:"direct",children:d("blocklet.publish.docker.directProxy")})]})]}),C&&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:d("blocklet.publish.docker.prefix")}),e.jsx(oe,{disabled:n,value:o.prefix,onChange:k,sx:{flex:1},label:d("blocklet.publish.docker.prefix")})]})]})})]})}et.propTypes={dockerParams:r.object.isRequired,setDockerParams:r.func.isRequired,dataKey:r.string.isRequired,item:r.object.isRequired,t:r.func.isRequired,readOnly:r.bool.isRequired,index:r.number.isRequired};et.defaultProps={};const dl=`
|
|
172
|
+
`;function rs({text:t}){return t?e.jsx(un,{wrapperElement:{"data-color-mode":"light"},source:Fs.sanitize(t),rehypePlugins:[[pn,{target:"_blank"}]]}):e.jsx(Ae,{Icon:Dt})}rs.propTypes={text:r.string.isRequired};function is({params:t,setParams:o,paramsErrTip:s,loading:i,setParamsErrTip:l,readOnly:d}){var x;const{t:n}=te(),[u,a]=m.useState(d?"preview":"write"),h=(S,y)=>{a(y)};return e.jsxs(c,{sx:{border:"1px solid #fff",width:"100%",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:n("common.introduction")}),e.jsxs($o,{value:u,onChange:h,"aria-label":"wrapped label tabs example",children:[e.jsx(Qe,{value:"write",label:"Write"}),e.jsx(Qe,{value:"preview",label:"Preview"})]})]}),e.jsx(c,{display:u==="write"?"block":"none",sx:{width:"100%",marginTop:3},children:e.jsx(oe,{disabled:i||d,sx:{border:"none"},placeholder:`Blocklet ${n("common.introduction")}`,InputProps:{"data-cy":"export-blocklet-introduction",readOnly:d,endAdornment:e.jsxs(Ve,{position:"end",children:[((x=t==null?void 0:t.blockletIntroduction)==null?void 0:x.length)||0," / ",ue.PROJECT.MAX_INTRO_LENGTH]})},autoComplete:"off",variant:"outlined",fullWidth:!0,multiline:!0,minRows:4,value:t.blockletIntroduction||"",onChange:S=>{l({blockletIntroduction:""}),o({blockletIntroduction:S.target.value.slice(0,ue.PROJECT.MAX_INTRO_LENGTH)})},error:!!s.blockletIntroduction,helperText:s.blockletIntroduction||""})}),e.jsx(c,{display:u==="preview"?"block":"none",mt:3,children:e.jsx(rs,{text:t.blockletIntroduction||""})})]})}is.propTypes={params:r.object.isRequired,setParams:r.func.isRequired,paramsErrTip:r.object.isRequired,setParamsErrTip:r.func.isRequired,readOnly:r.bool.isRequired,loading:r.bool.isRequired};var Gt={},ll=ke;Object.defineProperty(Gt,"__esModule",{value:!0});var xt=Gt.default=void 0,rl=ll(Re()),jo=e;xt=Gt.default=(0,rl.default)([(0,jo.jsx)("circle",{cx:"12",cy:"19",r:"2"},"0"),(0,jo.jsx)("path",{d:"M10 3h4v12h-4z"},"1")],"PriorityHigh");function Jt({step:t,ok:o,active:s,error:i,warning:l}){let d="grey.500",n=t+1;return o&&(n=e.jsx(hn,{sx:{fontSize:18,margin:0},color:"white"})),i||!o&&s>t?(d="error.main",n=e.jsx(xt,{sx:{fontSize:18,margin:0},color:"white"})):l?(d="warning.main",n=e.jsx(xt,{sx:{fontSize:18,margin:0},color:"white"})):s>=t&&(d="primary.main"),e.jsx(c,{width:24,height:24,bgcolor:d,borderRadius:"100%",color:"white",display:"flex",justifyContent:"center",fontWeight:"bold",fontSize:14,alignItems:"center",children:n})}Jt.propTypes={step:r.number,ok:r.bool,active:r.number,error:r.string,warning:r.bool};Jt.defaultProps={step:0,ok:!1,active:0,error:"",warning:!1};function cs({steps:t,activeStep:o,setActiveStep:s,hasSelectedResources:i,params:l,loading:d,paramsErrTip:n,warning:u,viewMode:a,projectId:h}){const{t:x}=te(),S=()=>{s(R=>R+1)},y=()=>{s(R=>R-1)},p=R=>R===0?(n==null?void 0:n.blockletTitle)||(n==null?void 0:n.projectId)||(n==null?void 0:n.blockletDescription)||(n==null?void 0:n.blockletHomepage)||(n==null?void 0:n.blockletSupport)||(n==null?void 0:n.blockletCommunity)||(n==null?void 0:n.blockletRepository):R===2?(n==null?void 0:n.blockletResource)||(n==null?void 0:n.blockletDocker)||(n==null?void 0:n.dockerImageName):R>=4?(n==null?void 0:n.blockletVersion)||(n==null?void 0:n.note):"",f=a||os({hasSelectedResources:i,params:l,projectId:h,t:x})===null;return e.jsxs(c,{sx:{width:300,maxWidth:300,minWidth:300,padding:2,border:"1px solid #ccc",borderRadius:2},children:[e.jsx(Ds,{activeStep:o,orientation:"vertical",children:t.map((R,I)=>{const j={},D=d||!sl({hasSelectedResources:i,params:l,projectId:h,step:I,t:x}),k=d?"":p(I);return k&&(j.optional=e.jsx(N,{variant:"caption",color:"error",children:k}),j.error=!0),e.jsxs(Ts,{children:[e.jsx(_s,{icon:e.jsx(Jt,{error:k,warning:I===0?u.hasWarning:!1,active:f?99:o,step:I,ok:D}),sx:{cursor:"pointer",color:k?"error.main":"inherit"},disabled:!1,onClick:()=>s(I),...j,children:e.jsx(N,{fontSize:"14px",fontWeight:"500",color:k||!D&&o>I?"error.main":"inherit",children:R.label})}),e.jsxs(Ps,{children:[e.jsx(N,{fontSize:12,children:R.description}),!f&&e.jsx(c,{sx:{mb:2},children:e.jsxs("div",{children:[I<t.length-1&&e.jsx(se,{variant:"contained",onClick:S,sx:{mt:1,mr:1},disabled:k||!D,children:x("common.continue")}),I>0&&e.jsx(se,{disabled:I===0,onClick:y,sx:{mt:1,mr:1},children:x("common.back")})]})})]})]},R.label)})}),o>=t.length-1&&e.jsx(jt,{square:!0,elevation:0,sx:{p:3},children:e.jsx(N,{fontSize:12,sx:{opacity:.5},children:"Click right top button to release"})})]})}cs.propTypes={steps:r.array.isRequired,activeStep:r.number.isRequired,setActiveStep:r.func.isRequired,params:r.object.isRequired,viewMode:r.string.isRequired,loading:r.bool.isRequired,projectId:r.string.isRequired,hasSelectedResources:r.bool.isRequired,warning:r.object.isRequired,paramsErrTip:r.shape({projectId:r.string,blockletVersion:r.string,blockletTitle:r.string,blockletDescription:r.string,note:r.string,blockletResource:r.string,blockletHomepage:r.string,blockletSupport:r.string,blockletCommunity:r.string,blockletRepository:r.string,blockletDocker:r.object,dockerImageName:r.string}).isRequired};const il=[".zip",".gz"],cl=1024*1024*100,al=m.lazy(()=>zo(()=>import("./index-rMaglH7e.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12])).then(t=>({default:t.Uploader})));function Xt({app:t,projectId:o,readOnly:s,params:i,setParams:l,setParamsErrTip:d,error:n}){const{t:u,locale:a}=te(),h=m.useRef(null),x=()=>s?!1:!o||o===G.UNOWNED_DID?(M.error(u("blocklet.publish.errorTip.noFirstDid")),!1):!0,S=`${G.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(Se,{direction:"row",alignItems:"center",spacing:1,sx:{flex:1,cursor:s?"default":"pointer"},children:[!!i.uploadedResource&&e.jsx(N,{component:"a",href:`${S}/params.uploadedResource`,children:i.uploadedResource}),!s&&e.jsx(se,{variant:"outlined",size:"small",onClick:()=>{var y;x()&&((y=h.current)==null||y.open())},children:i.uploadedResource?u("common.change"):u("common.upload")})]}),e.jsx(m.Suspense,{fallback:e.jsx(Fe,{}),children:e.jsx(al,{ref:h,locale:a,popup:!0,onUploadFinish:y=>{var p;l({uploadedResource:y.data.filename}),d({blockletResource:""}),(p=h.current)==null||p.close()},plugins:["ImageEditor"],installerProps:{disabled:!0},apiPathProps:{uploader:S,disableMediaKitPrefix:!0,disableMediaKitStatus:!0},coreProps:{restrictions:{allowedFileExts:il,maxFileSize:cl,maxNumberOfFiles:1}}},"uploader-resource")}),!!n&&e.jsx(c,{color:"error.main",mt:1,fontSize:14,children:n})]})}Xt.propTypes={app:r.object.isRequired,projectId:r.string.isRequired,readOnly:r.bool.isRequired,params:r.object.isRequired,setParams:r.func.isRequired,error:r.string.isRequired,setParamsErrTip:r.func.isRequired};Xt.defaultProps={};function Ke({readOnly:t,params:o,setParams:s,paramsErrTip:i,setParamsErrTip:l,loading:d}){var u;const{t:n}=te();return e.jsx(c,{display:"flex",mt:3,className:"section",children:e.jsxs(c,{sx:{flex:1},children:[e.jsx(oe,{required:!0,disabled:d||t,label:`Blocklet ${n("common.version")}`,placeholder:`Blocklet ${n("common.version")}`,InputProps:{"data-cy":"blocklet-version",readOnly:t},autoComplete:"off",variant:"outlined",fullWidth:!0,value:o.blockletVersion||"",onChange:a=>{l({blockletVersion:""}),s({blockletVersion:a.target.value})},error:!!i.blockletVersion,helperText:i.blockletVersion||""}),e.jsx(oe,{label:n("blocklet.publish.releaseNote"),autoComplete:"off",disabled:d||t,variant:"outlined",InputProps:{"data-cy":"release-note",readOnly:t,endAdornment:e.jsxs(Ve,{position:"end",children:[((u=o==null?void 0:o.note)==null?void 0:u.length)||0," / ",ue.PROJECT.MAX_NOTE_LENGTH]})},fullWidth:!0,multiline:!0,minRows:4,required:!0,value:o.note||"",onChange:a=>{l({note:""}),s({note:a.target.value.slice(0,ue.PROJECT.MAX_NOTE_LENGTH)})},error:!!i.note,helperText:i.note||"",sx:{mt:3}})]})})}Ke.propTypes={readOnly:r.bool.isRequired,params:r.object.isRequired,setParams:r.func.isRequired,paramsErrTip:r.object.isRequired,setParamsErrTip:r.func.isRequired,loading:r.bool.isRequired};Ke.defaultProps={};function as(t){for(const o in t)typeof t[o]=="string"?t[o]=t[o].replace(/\\\\/g,"\\"):typeof t[o]=="object"&&t[o]!==null&&as(t[o]);return t}function et({index:t,item:o,dockerParams:s,setDockerParams:i,dataKey:l,t:d,readOnly:n}){const u=(o==null?void 0:o.value)||"",[a,h]=m.useState(!1),x=()=>{var W;(W=s[l])==null||W.splice(t,1),i({...s,[l]:[...s[l]]})},S=(W,b)=>{var w;(w=s[l])!=null&&w[t]&&(b?(s[l][t].custom=s[l][t].value,s[l][t].value=`$${dt(o.key)}`):(s[l][t].value=s[l][t].custom||"",s[l][t].custom="")),i({...s,[l]:[...s[l]]})},y=(W,b)=>{var q;const w=((q=s[l][t])==null?void 0:q.value)||"";s[l][t]={...s[l][t],secure:b,value:b&&w===ue.BLOCKLET_AUTOMATIC_ENV_VALUE?"":w},i({...s,[l]:[...s[l]]})},p=(W,b)=>{s[l][t]={...s[l][t],shared:b},i({...s,[l]:[...s[l]]})},f=(W,b)=>{var q;const w=((q=s[l][t])==null?void 0:q.value)||"";s[l][t]={...s[l][t],required:b,value:b&&w===ue.BLOCKLET_AUTOMATIC_ENV_VALUE?"":w},i({...s,[l]:[...s[l]]})},R=(W,b)=>{s[l][t]={...s[l][t],value:b?ue.BLOCKLET_AUTOMATIC_ENV_VALUE:"",secure:!1,required:!1},i({...s,[l]:[...s[l]]})},I=W=>{s[l][t]={...s[l][t],description:W.target.value},i({...s,[l]:[...s[l]]})},j=W=>{const b=W.target.value==="web"?"web":"docker";b==="web"&&s.dockerArgs.forEach(g=>{g.type="docker"});const q=`/${s.dockerImage.replace(/\W/g,"-")}-${t}`;s.dockerArgs[t]={...s.dockerArgs[t],type:b,path:b==="docker"?q:"/",protocol:"http",prefix:b==="docker"?q:"/",name:"publicUrl",port:"BLOCKLET_PORT"},i({...s,dockerArgs:[...s.dockerArgs]})},D=W=>{s.dockerArgs[t]={...s.dockerArgs[t],proxyBehavior:W.target.value==="direct"?"direct":"service"},i({...s,dockerArgs:[...s.dockerArgs]})},k=W=>{const b=W.target.value;s[l][t]={...s[l][t],prefix:b,path:b==="*"?"/":b},i({...s,[l]:[...s[l]]})},T=W=>{var b;(b=s[l])!=null&&b[t]&&(s[l][t].value=W.target.value),i({...s,[l]:[...s[l]]})},L=u===`$${dt(o.key)}`||o.custom,z=l==="dockerArgs"&&!Oo[o.key],B=nn[o.key],v=l==="dockerEnvs",C=o.key==="--publish";let H=o.key;return C&&o.type==="web"?H="--publish (Web)":v&&(H=`--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:H})}),e.jsxs(c,{sx:{display:"flex",flexDirection:"column",gap:1,flex:1},children:[e.jsx(oe,{disabled:n||L||z||o.value===ue.BLOCKLET_AUTOMATIC_ENV_VALUE,placeholder:"",value:L?`$${dt(o.key)}`:u,sx:{flex:1},InputProps:{endAdornment:e.jsxs(Ve,{position:"end",sx:{zoom:.9},children:[(!(B||z)||v||C)&&e.jsx(ce,{onClick:()=>h(!0),children:e.jsx(ae,{icon:"icon-park-outline:setting-config"})}),!n&&e.jsx(ce,{onClick:x,color:z?"error":"default",children:e.jsx(ae,{icon:"ic:round-delete"})})]})},error:z,onChange:T}),z&&e.jsx(N,{variant:"caption",color:"error",children:d("blocklet.publish.docker.noAllowTheArg")}),o.key==="--publish"&&e.jsx(N,{variant:"caption",color:"text.secondary",children:d("blocklet.publish.docker.publishTips")}),o.key==="--volume"&&ln[o.key](u)&&e.jsx(N,{variant:"caption",color:"error",children:d("blocklet.publish.docker.volumeTips")})]}),a&&e.jsx(yt,{open:!0,fullWidth:!0,maxWidth:"sm",PaperProps:{style:{minHeight:0}},title:d(v?"blocklet.publish.docker.modifyEnv":"blocklet.publish.docker.modifyParam"),onClose:()=>h(!1),children:e.jsxs(c,{sx:{display:"flex",flexDirection:"column",gap:1,paddingBottom:2},children:[B||z||v?null:e.jsxs(c,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(N,{children:d("blocklet.publish.docker.needCustomInput")}),e.jsx(De,{disabled:n,checked:L,onChange:S,sx:{zoom:.9}})]}),v&&e.jsxs(c,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(N,{children:d("blocklet.publish.docker.shared")}),e.jsx(De,{disabled:n,checked:o.shared,onChange:p,sx:{zoom:.9}})]}),v&&e.jsxs(c,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(N,{children:d("blocklet.publish.docker.required")}),e.jsx(De,{disabled:n,checked:o.required,onChange:f,sx:{zoom:.9}})]}),v&&e.jsxs(c,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(N,{children:d("blocklet.publish.docker.secure")}),e.jsx(De,{disabled:n,checked:o.secure,onChange:y,sx:{zoom:.9}})]}),v&&e.jsxs(c,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(N,{children:d("blocklet.publish.docker.autoGenerated")}),e.jsx(De,{disabled:n,checked:o.value===ue.BLOCKLET_AUTOMATIC_ENV_VALUE,onChange:R,sx:{zoom:.9}})]}),v&&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:d("blocklet.publish.docker.description")}),e.jsx(oe,{disabled:n,value:o.description,onChange:I,sx:{flex:1},label:d("blocklet.publish.docker.description")})]}),C&&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:d("blocklet.publish.docker.portType")}),e.jsxs(ft,{value:o.type||"docker",onChange:j,children:[e.jsx(fe,{value:"docker",children:"Docker"}),e.jsx(fe,{value:"web",children:"Web"})]})]}),C&&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:d("blocklet.publish.docker.proxyBehavior")}),e.jsxs(ft,{value:o.proxyBehavior||"service",onChange:D,children:[e.jsx(fe,{value:"service",children:d("blocklet.publish.docker.serviceProxy")}),e.jsx(fe,{value:"direct",children:d("blocklet.publish.docker.directProxy")})]})]}),C&&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:d("blocklet.publish.docker.prefix")}),e.jsx(oe,{disabled:n,value:o.prefix,onChange:k,sx:{flex:1},label:d("blocklet.publish.docker.prefix")})]})]})})]})}et.propTypes={dockerParams:r.object.isRequired,setDockerParams:r.func.isRequired,dataKey:r.string.isRequired,item:r.object.isRequired,t:r.func.isRequired,readOnly:r.bool.isRequired,index:r.number.isRequired};et.defaultProps={};const dl=`
|
|
173
173
|
docker run --name postgrest
|
|
174
174
|
-p 3000:3000
|
|
175
175
|
-e PGRST_DB_URI="postgres://username:password@host:port/database"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{p as b}from"./vendor-utils-
|
|
1
|
+
import{p as b}from"./vendor-utils-C3FZIS9A.js";function c(o){if(typeof o!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(o))}function A(o,e){for(var r="",i=0,l=-1,t=0,n,f=0;f<=o.length;++f){if(f<o.length)n=o.charCodeAt(f);else{if(n===47)break;n=47}if(n===47){if(!(l===f-1||t===1))if(l!==f-1&&t===2){if(r.length<2||i!==2||r.charCodeAt(r.length-1)!==46||r.charCodeAt(r.length-2)!==46){if(r.length>2){var s=r.lastIndexOf("/");if(s!==r.length-1){s===-1?(r="",i=0):(r=r.slice(0,s),i=r.length-1-r.lastIndexOf("/")),l=f,t=0;continue}}else if(r.length===2||r.length===1){r="",i=0,l=f,t=0;continue}}e&&(r.length>0?r+="/..":r="..",i=2)}else r.length>0?r+="/"+o.slice(l+1,f):r=o.slice(l+1,f),i=f-l-1;l=f,t=0}else n===46&&t!==-1?++t:t=-1}return r}function h(o,e){var r=e.dir||e.root,i=e.base||(e.name||"")+(e.ext||"");return r?r===e.root?r+i:r+o+i:i}var g={resolve:function(){for(var e="",r=!1,i,l=arguments.length-1;l>=-1&&!r;l--){var t;l>=0?t=arguments[l]:(i===void 0&&(i=b.cwd()),t=i),c(t),t.length!==0&&(e=t+"/"+e,r=t.charCodeAt(0)===47)}return e=A(e,!r),r?e.length>0?"/"+e:"/":e.length>0?e:"."},normalize:function(e){if(c(e),e.length===0)return".";var r=e.charCodeAt(0)===47,i=e.charCodeAt(e.length-1)===47;return e=A(e,!r),e.length===0&&!r&&(e="."),e.length>0&&i&&(e+="/"),r?"/"+e:e},isAbsolute:function(e){return c(e),e.length>0&&e.charCodeAt(0)===47},join:function(){if(arguments.length===0)return".";for(var e,r=0;r<arguments.length;++r){var i=arguments[r];c(i),i.length>0&&(e===void 0?e=i:e+="/"+i)}return e===void 0?".":g.normalize(e)},relative:function(e,r){if(c(e),c(r),e===r||(e=g.resolve(e),r=g.resolve(r),e===r))return"";for(var i=1;i<e.length&&e.charCodeAt(i)===47;++i);for(var l=e.length,t=l-i,n=1;n<r.length&&r.charCodeAt(n)===47;++n);for(var f=r.length,s=f-n,v=t<s?t:s,u=-1,a=0;a<=v;++a){if(a===v){if(s>v){if(r.charCodeAt(n+a)===47)return r.slice(n+a+1);if(a===0)return r.slice(n+a)}else t>v&&(e.charCodeAt(i+a)===47?u=a:a===0&&(u=0));break}var m=e.charCodeAt(i+a),C=r.charCodeAt(n+a);if(m!==C)break;m===47&&(u=a)}var d="";for(a=i+u+1;a<=l;++a)(a===l||e.charCodeAt(a)===47)&&(d.length===0?d+="..":d+="/..");return d.length>0?d+r.slice(n+u):(n+=u,r.charCodeAt(n)===47&&++n,r.slice(n))},_makeLong:function(e){return e},dirname:function(e){if(c(e),e.length===0)return".";for(var r=e.charCodeAt(0),i=r===47,l=-1,t=!0,n=e.length-1;n>=1;--n)if(r=e.charCodeAt(n),r===47){if(!t){l=n;break}}else t=!1;return l===-1?i?"/":".":i&&l===1?"//":e.slice(0,l)},basename:function(e,r){if(r!==void 0&&typeof r!="string")throw new TypeError('"ext" argument must be a string');c(e);var i=0,l=-1,t=!0,n;if(r!==void 0&&r.length>0&&r.length<=e.length){if(r.length===e.length&&r===e)return"";var f=r.length-1,s=-1;for(n=e.length-1;n>=0;--n){var v=e.charCodeAt(n);if(v===47){if(!t){i=n+1;break}}else s===-1&&(t=!1,s=n+1),f>=0&&(v===r.charCodeAt(f)?--f===-1&&(l=n):(f=-1,l=s))}return i===l?l=s:l===-1&&(l=e.length),e.slice(i,l)}else{for(n=e.length-1;n>=0;--n)if(e.charCodeAt(n)===47){if(!t){i=n+1;break}}else l===-1&&(t=!1,l=n+1);return l===-1?"":e.slice(i,l)}},extname:function(e){c(e);for(var r=-1,i=0,l=-1,t=!0,n=0,f=e.length-1;f>=0;--f){var s=e.charCodeAt(f);if(s===47){if(!t){i=f+1;break}continue}l===-1&&(t=!1,l=f+1),s===46?r===-1?r=f:n!==1&&(n=1):r!==-1&&(n=-1)}return r===-1||l===-1||n===0||n===1&&r===l-1&&r===i+1?"":e.slice(r,l)},format:function(e){if(e===null||typeof e!="object")throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof e);return h("/",e)},parse:function(e){c(e);var r={root:"",dir:"",base:"",ext:"",name:""};if(e.length===0)return r;var i=e.charCodeAt(0),l=i===47,t;l?(r.root="/",t=1):t=0;for(var n=-1,f=0,s=-1,v=!0,u=e.length-1,a=0;u>=t;--u){if(i=e.charCodeAt(u),i===47){if(!v){f=u+1;break}continue}s===-1&&(v=!1,s=u+1),i===46?n===-1?n=u:a!==1&&(a=1):n!==-1&&(a=-1)}return n===-1||s===-1||a===0||a===1&&n===s-1&&n===f+1?s!==-1&&(f===0&&l?r.base=r.name=e.slice(1,s):r.base=r.name=e.slice(f,s)):(f===0&&l?(r.name=e.slice(1,n),r.base=e.slice(1,s)):(r.name=e.slice(f,n),r.base=e.slice(f,s)),r.ext=e.slice(n,s)),f>0?r.dir=e.slice(0,f-1):l&&(r.dir="/"),r},sep:"/",delimiter:":",win32:null,posix:null};g.posix=g;var y=g;export{y as p};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as d}from"./vendor-react-DEoibe3W.js";import{E as l,j as n,a4 as g,b2 as G,M as H,I as O,a3 as
|
|
1
|
+
import{r as d}from"./vendor-react-DEoibe3W.js";import{E as l,j as n,a4 as g,b2 as G,M as H,I as O,a3 as J,bZ as U,aa as Y}from"./vendor-mui-core-1jJmAutq.js";import{a$ as Z,aJ as Q,d as v}from"./vendor-ux-did-connect-DEbq97Xz.js";import{d as ee}from"./Done-BDrYSkZM.js";import{C as te}from"./Google-DimUFzIe.js";import{a7 as ne,f as re}from"./index-CwaFNZTA.js";import{R as oe,F as se,L as ie}from"./logo-uploader-COdhJAZk.js";const S={description:l.string,editing:l.bool,onChange:l.func,required:l.bool,value:l.any,componentProps:l.object,render:l.func,renderFormItem:l.func};function _({editing:r,value:o,onChange:a}){const[c,u]=d.useState(!1),m=d.useRef(),p=d.useRef(o);d.useEffect(()=>{let s=null;return r&&(s=setTimeout(()=>{u(!0)},50)),()=>{clearTimeout(s)}},[r]);const k=s=>{p.current=s,a(s)},b=()=>{u(!1),a(p.current)},C=n.jsx(g,{className:"form-item-input slot",px:1,children:n.jsxs(g,{display:"flex",alignItems:"center",children:[o,o!=="auto"&&n.jsx("div",{style:{marginLeft:4,backgroundColor:o,width:"1em",height:"1em",borderRadius:"0.2em"}})]})}),f=n.jsxs(g,{display:"flex",flexGrow:1,alignItems:"center",height:"40px",onKeyDown:b,children:[n.jsx(g,{display:"flex",alignItems:"center",onClick:()=>u(!0),children:n.jsx("div",{ref:m,style:{flexShrink:0,marginLeft:"8px",backgroundColor:o,width:"32px",height:"32px",boxSizing:"border-box",borderRadius:"8px",border:"1px solid #eee",cursor:o==="auto"?"default":"pointer"}})}),n.jsx(G,{open:c,anchorEl:m.current,onClose:()=>u(!1),anchorOrigin:{vertical:"bottom",horizontal:"center"},transformOrigin:{vertical:"top",horizontal:"center"},children:n.jsx(te,{color:o,onChange:s=>k(s.hex)})})]});return r?f:C}_.propTypes=S;function D({editing:r,description:o,value:a,onChange:c,componentProps:u,...m}){const{placeholder:p}=u,k=d.useRef(a),{t:b}=d.useContext(Z),C=s=>{s.key==="Enter"&&c(k.current,"confirm")},f=s=>{k.current=s,c(s)};return r?n.jsx(H,{style:{flex:1},fullWidth:!0,value:a,onChange:s=>{s.persist(),f(s.target.value)},autoFocus:!0,size:"small",variant:"outlined",placeholder:o||p,onKeyDown:C,...m}):n.jsx(g,{px:1,className:"form-item-input slot",children:a||n.jsx("span",{className:"placeholder",children:b("common.requiredInputPlaceholder",{name:o||p})})})}D.propTypes=S;D.defaultProps={componentProps:{}};function T({editing:r,value:o,onChange:a,componentProps:c,...u}){const{blocklet:m}=c,p=o==="auto"?Q.getPassportColorFromDid(m.appDid):o;return n.jsxs(g,{display:"flex",alignItems:"center",children:[n.jsx("div",{style:{width:96,marginRight:12},dangerouslySetInnerHTML:{__html:ne({title:"Owner",issuer:re.getDisplayName(m),issuerDid:m.appDid,ownerName:"Your Name",ownerDid:m.appDid,preferredColor:o||"auto"})}}),n.jsx(_,{...u,editing:r,value:r?p:o,onChange:a,componentProps:c})]})}T.propTypes={...S,componentProps:l.shape({blocklet:l.object.isRequired}).isRequired};T.defaultProps={};const ae=U`
|
|
2
2
|
0%, 100% {
|
|
3
3
|
transform: scale(1) translateX(0);
|
|
4
4
|
}
|
|
@@ -8,4 +8,4 @@ import{r as d}from"./vendor-react-DEoibe3W.js";import{E as l,j as n,a4 as g,b2 a
|
|
|
8
8
|
25%, 75% {
|
|
9
9
|
transform: scale(1.1) translateX(3px);
|
|
10
10
|
}
|
|
11
|
-
`,le={input:D,color:_,passport:T,uploader:r=>n.jsx(ie,{...r.componentProps})};function ce(r,{editing:o=!1}){const{componentType:a="input",render:c,renderFormItem:u}=r;return o&&u?u:!o&&c?c:le[a==null?void 0:a.toLowerCase()]}function z({schema:r,loading:o,value:a,defaultValue:c,onChange:u,style:m,disabled:p}){const k=Object.prototype.toString.call(a)==="[object Object]",[b,C]=d.useState([]),[f,s]=d.useState(k?a:c),V=d.useMemo(()=>r.length===1,[r]),h=d.useCallback(e=>b.find(t=>t.key===e),[b]);d.useEffect(()=>{var e;V&&((e=r[0])!=null&&e.required)&&C([{key:r[0].key,editing:!0,initialValue:c[r[0].key]}])},[r,V,c]);const I=d.useCallback(e=>{C(t=>t.find(i=>i.key===e.key)?t.map(i=>i.key===e.key?e:{...i}):[e].concat(t))},[]),P=d.useCallback((e,t,x)=>{const{key:i,secure:w}=e,y=h(i)??{...e};y.editing=!0;const R=f[i]!==t;y.edited=t&&y.initialValue!==t,y.initialValue=c[i];const j={...f,[i]:t};R&&s(j),u({[i]:t},{allValues:j,action:x,currentItem:e}),x==="confirm"&&w&&s({...f,[i]:"__encrypted__"}),x==="confirm"&&(y.initialValue=f[i]),["confirm","cancel"].includes(x)&&(y.editing=!1,y.edited=!1),I(y)},[c,f,u,I,h]);function K(e,{editing:t=!1}){const{key:x}=e,i=k?a[x]:f[x];return i==="__encrypted__"?t?"":"******":i}const F=d.useCallback(e=>{const t=h(e.key);t&&P(e,t.initialValue,"cancel")},[h,P]),q=d.useCallback(e=>{const t=h(e.key);!t||!t.edited||(t.shaking=!0,I(t),setTimeout(()=>{t.shaking=!1,I(t)},500))},[h,I]),B=d.useCallback(e=>{const t=h(e.key);!t||!t.edited?F(e):q(e)},[h,q,F]);return n.jsx(de,{className:"form",style:m,children:r==null?void 0:r.map(e=>{const{key:t,description:x,required:i,solo:w=!1,hidden:y=!1,componentProps:L={},skipButtonDisabled:R=!1}=e;if(y)return null;const j=h(t),{editing:E,shaking:M}=j??{},N=K(e,{editing:E}),W=ce(e,{editing:E}),X={inputProps:{"data-cy":"schema-form-item-component"},key:t,description:x,editing:E,value:N,onChange:($,A="change")=>P(e,$,A),componentProps:L,skipButtonDisabled:R,onBlur:()=>B(e)};return n.jsxs(g,{className:"form-item",children:[!w&&n.jsxs(g,{className:"form-item-label",style:{color:i&&!N?"#ff0000":"#333"},children:[x,i&&n.jsx(oe,{})]}),n.jsxs(g,{className:"form-item-body",children:[n.jsx(g,{className:"form-item-input","data-cy":"schema-form-item-edit",sx:{textAlign:w?"center":"left"},style:{cursor:"text"},onClick:()=>{p||j!=null&&j.edited||R||P(e,f[t],"edit")},children:n.jsx(W,{...X})}),!w&&n.jsx(g,{className:"form-item-action",style:{marginLeft:0},children:E?n.jsxs(n.Fragment,{children:[j.edited?n.jsx(O,{"data-cy":"schema-form-item-confirm",onClick:()=>{P(e,N,"confirm")},disabled:p||o,sx:{animation:M?`${ae} 0.5s linear`:"none"},style:{paddingRight:4},size:"large",children:o?n.jsx(
|
|
11
|
+
`,le={input:D,color:_,passport:T,uploader:r=>n.jsx(ie,{...r.componentProps})};function ce(r,{editing:o=!1}){const{componentType:a="input",render:c,renderFormItem:u}=r;return o&&u?u:!o&&c?c:le[a==null?void 0:a.toLowerCase()]}function z({schema:r,loading:o,value:a,defaultValue:c,onChange:u,style:m,disabled:p}){const k=Object.prototype.toString.call(a)==="[object Object]",[b,C]=d.useState([]),[f,s]=d.useState(k?a:c),V=d.useMemo(()=>r.length===1,[r]),h=d.useCallback(e=>b.find(t=>t.key===e),[b]);d.useEffect(()=>{var e;V&&((e=r[0])!=null&&e.required)&&C([{key:r[0].key,editing:!0,initialValue:c[r[0].key]}])},[r,V,c]);const I=d.useCallback(e=>{C(t=>t.find(i=>i.key===e.key)?t.map(i=>i.key===e.key?e:{...i}):[e].concat(t))},[]),P=d.useCallback((e,t,x)=>{const{key:i,secure:w}=e,y=h(i)??{...e};y.editing=!0;const R=f[i]!==t;y.edited=t&&y.initialValue!==t,y.initialValue=c[i];const j={...f,[i]:t};R&&s(j),u({[i]:t},{allValues:j,action:x,currentItem:e}),x==="confirm"&&w&&s({...f,[i]:"__encrypted__"}),x==="confirm"&&(y.initialValue=f[i]),["confirm","cancel"].includes(x)&&(y.editing=!1,y.edited=!1),I(y)},[c,f,u,I,h]);function K(e,{editing:t=!1}){const{key:x}=e,i=k?a[x]:f[x];return i==="__encrypted__"?t?"":"******":i}const F=d.useCallback(e=>{const t=h(e.key);t&&P(e,t.initialValue,"cancel")},[h,P]),q=d.useCallback(e=>{const t=h(e.key);!t||!t.edited||(t.shaking=!0,I(t),setTimeout(()=>{t.shaking=!1,I(t)},500))},[h,I]),B=d.useCallback(e=>{const t=h(e.key);!t||!t.edited?F(e):q(e)},[h,q,F]);return n.jsx(de,{className:"form",style:m,children:r==null?void 0:r.map(e=>{const{key:t,description:x,required:i,solo:w=!1,hidden:y=!1,componentProps:L={},skipButtonDisabled:R=!1}=e;if(y)return null;const j=h(t),{editing:E,shaking:M}=j??{},N=K(e,{editing:E}),W=ce(e,{editing:E}),X={inputProps:{"data-cy":"schema-form-item-component"},key:t,description:x,editing:E,value:N,onChange:($,A="change")=>P(e,$,A),componentProps:L,skipButtonDisabled:R,onBlur:()=>B(e)};return n.jsxs(g,{className:"form-item",children:[!w&&n.jsxs(g,{className:"form-item-label",style:{color:i&&!N?"#ff0000":"#333"},children:[x,i&&n.jsx(oe,{})]}),n.jsxs(g,{className:"form-item-body",children:[n.jsx(g,{className:"form-item-input","data-cy":"schema-form-item-edit",sx:{textAlign:w?"center":"left"},style:{cursor:"text"},onClick:()=>{p||j!=null&&j.edited||R||P(e,f[t],"edit")},children:n.jsx(W,{...X})}),!w&&n.jsx(g,{className:"form-item-action",style:{marginLeft:0},children:E?n.jsxs(n.Fragment,{children:[j.edited?n.jsx(O,{"data-cy":"schema-form-item-confirm",onClick:()=>{P(e,N,"confirm")},disabled:p||o,sx:{animation:M?`${ae} 0.5s linear`:"none"},style:{paddingRight:4},size:"large",children:o?n.jsx(J,{size:24}):n.jsx(ee,{})}):null,n.jsx(O,{"data-cy":"schema-form-item-cancel",onClick:()=>F(e),style:{paddingLeft:j.edited?4:8},disabled:p||o,size:"large",children:n.jsx(v,{})})]}):null})]})]},t)})})}z.propTypes={schema:l.array.isRequired,loading:l.bool,onChange:l.func.isRequired,value:l.object,defaultValue:l.object,style:l.object,disabled:l.bool};z.defaultProps={loading:!1,value:void 0,defaultValue:{},style:{},disabled:!1};const de=Y(se)``;export{z as S};
|
|
@@ -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 a,a4 as m,bf as y,T as V,M as R,bC as L,br as _,bD as U,cw as j,x as v,aa as D,ab as w,c9 as J,dm as W,dn as q,I as H,dp as X,e as Y,bY as K}from"./vendor-mui-core-1jJmAutq.js";import{r as u}from"./vendor-react-DEoibe3W.js";import{G as Q,a as M,e as Z,i as a0,b as i0}from"./vendor-hooks-
|
|
2
|
+
import{j as a,a4 as m,bf as y,T as V,M as R,bC as L,br as _,bD as U,cw as j,x as v,aa as D,ab as w,c9 as J,dm as W,dn as q,I as H,dp as X,e as Y,bY as K}from"./vendor-mui-core-1jJmAutq.js";import{r as u}from"./vendor-react-DEoibe3W.js";import{G as Q,a as M,e as Z,i as a0,b as i0}from"./vendor-hooks-DN4nZ7TU.js";import{T as r0,bp as x0}from"./vendor-ux-did-connect-DEbq97Xz.js";import{_ as t0}from"./vendor-arcblock-V3HYELzG.js";import{aJ as k0}from"./vendor-utils-C3FZIS9A.js";import{getAIKitComponent as s0}from"./index-rMaglH7e.js";import"./lottie-web-jYmAQWuC.js";import"./index-C1nvgBfF.js";import"./index-CwaFNZTA.js";import"./index-DVQCgvFb.js";const O=u.createContext({}),I=()=>u.useContext(O);function m0({children:i,restrictions:n,i18n:s,theme:r}){const[e,h]=Q({loading:!1}),l=x=>h(f=>({...f,loading:x})),c=u.useMemo(()=>({...e,onLoading:l,restrictions:n,i18n:s}),[e]);return a.jsx(r0,{theme:r,children:a.jsx(O.Provider,{value:c,children:i})})}const e0=["1024x1024","1024x1792","1792x1024"],o0=["256x256","512x512","1024x1024"],n0=[{label:"DALL·E 3",value:"dall-e-3"},{label:"DALL·E 2",value:"dall-e-2"}];function l0({onSubmit:i}){const{loading:n,i18n:s}=I(),r=M({model:"dall-e-3",prompt:"",size:"1024x1024",number:1}),e=()=>{const x=JSON.parse(JSON.stringify(r));Object.values(r).every(G=>!!G)&&i(x)},{run:h}=Z(e,{wait:500}),l={width:"100%",pl:"12px",pr:"16px"},c=r.model==="dall-e-2"?o0:e0;return a.jsxs(p0,{onSubmit:x=>x.preventDefault(),children:[a.jsx(m,{sx:{flex:1,overflowY:"auto",overflowX:"hidden",m:2,mb:0},children:a.jsxs(y,{container:!0,gap:2.5,children:[a.jsxs(y,{item:!0,xs:12,children:[a.jsx(V,{gutterBottom:!0,className:"title label",children:s("aiImagePrompt")}),a.jsx(R,{sx:{width:1,mt:1},size:"small",type:"text",required:!0,placeholder:s("aiImagePromptTip"),multiline:!0,minRows:5,maxRows:6,value:r.prompt??"",onChange:x=>{x.stopPropagation(),r.prompt=x.target.value},inputProps:{maxLength:1e3}})]}),a.jsxs(y,{item:!0,xs:12,children:[a.jsx(V,{gutterBottom:!0,className:"title label",children:`${s("aiImageModel")}`}),a.jsx(L,{row:!0,sx:{".MuiFormControlLabel-label":{fontSize:"12px"}},value:r.model,onChange:x=>{r.number=1,r.size="1024x1024",r.model=x.target.value},children:n0.map(x=>a.jsx(_,{value:x.value,control:a.jsx(U,{size:"small"}),label:x.label},x.label))})]}),a.jsxs(y,{item:!0,xs:12,children:[a.jsx(V,{gutterBottom:!0,className:"title label",children:`${s("aiImageSize")}: ${r.size}`}),a.jsx(y,{container:!0,sx:{gap:2.5,pt:1},children:a.jsx(m,{flex:1,children:a.jsx(m,{...l,children:a.jsx(j,{size:"small",min:0,max:c.length-1,step:1,value:c.findIndex(x=>x==r.size),onChange:(x,f)=>{r.size=c[f]}})})})})]}),r.model==="dall-e-2"&&a.jsxs(y,{item:!0,xs:12,children:[a.jsx(V,{gutterBottom:!0,className:"title label",children:`${s("aiImageNumber")}: ${r.number}`}),a.jsx(m,{...l,children:a.jsx(j,{size:"small",defaultValue:1,valueLabelDisplay:"auto",step:1,min:1,max:10,value:r.number,onChange:(x,f)=>{x.stopPropagation(),r.number=Number(f)}})})]})]})}),a.jsx(v,{sx:{m:2,transition:"all 0.3s"},className:"submit-ai",variant:"contained",onClick:h,disabled:n,children:s(n?"aiImageGenerating":"aiImageGenerate")},n?"loading-submit":"submit")]})}const p0=D(m)`
|
|
3
3
|
display: flex;
|
|
4
4
|
flex-direction: column;
|
|
5
5
|
height: 100%;
|