@abtnode/blocklet-services 1.16.51-beta-20250904-031834-c611f059 → 1.16.51-beta-20250905-051437-fe05adb2
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/ocap.js +53 -5
- package/api/routes/user.js +83 -149
- package/api/services/auth/session.js +4 -4
- package/api/socket/channel/eventbus.js +11 -1
- package/api/util/check-user.js +64 -0
- package/dist/assets/{AdapterDayjs-CFnh9vjd.js → AdapterDayjs-CC5qW8X_.js} +1 -1
- package/dist/assets/{Google-CW-20wJE.js → Google-BTGwy4Tl.js} +1 -1
- package/dist/assets/{access-control-BizMX9Jn.js → access-control-6ZXyzt4u.js} +1 -1
- package/dist/assets/{actions-DAS8NTxZ.js → actions-Cqn-jwqV.js} +1 -1
- package/dist/assets/{add-component-core-DehX9hAF.js → add-component-core-YkDFxrKl.js} +35 -35
- package/dist/assets/{add-resource-cFXEx4Mb.js → add-resource-OQ7hF_IO.js} +1 -1
- package/dist/assets/{addon-CuC7As5-.js → addon-BkKDTdVJ.js} +1 -1
- package/dist/assets/{advanced-B7LnG-Wt.js → advanced-CT4_Pijp.js} +1 -1
- package/dist/assets/{aigne-CGcWPgm4.js → aigne-DnDNvsxR.js} +1 -1
- package/dist/assets/api-sewNv0AE.js +1 -0
- package/dist/assets/{appearance-CMbl6GXr.js → appearance-D4izVpn9.js} +1 -1
- package/dist/assets/{arrow-down.svg-C5U2GopL.js → arrow-down.svg-CmUDD5Ct.js} +1 -1
- package/dist/assets/{audit-logs-BR5IC8uX.js → audit-logs-BYmYxN_X.js} +1 -1
- package/dist/assets/{authorize-BbkMLYEs.js → authorize-DZtDnqj7.js} +1 -1
- package/dist/assets/{base-chart-DF3hJ1RO.js → base-chart-o9AZYZ--.js} +1 -1
- package/dist/assets/{base32-YcmXpCcj.js → base32-DBozFUZ2.js} +1 -1
- package/dist/assets/bedrock-yFRPpe__.png +0 -0
- package/dist/assets/{bind-account-OAALSOef.js → bind-account-DtwFMPu6.js} +1 -1
- package/dist/assets/branding-BOVSmux-.js +1 -0
- package/dist/assets/{branding-F8Vu_6kc.js → branding-CsRcDE0s.js} +2 -2
- package/dist/assets/{branding-CV15gC6i.js → branding-yPr_q0Uc.js} +1 -1
- package/dist/assets/{bundle-avatar-Bj24dA31.js → bundle-avatar-RF-josr5.js} +1 -1
- package/dist/assets/button-DY13Itzc.js +1 -0
- package/dist/assets/{click-to-copy-BMR8lTEv.js → click-to-copy-fi9Ffgbr.js} +1 -1
- package/dist/assets/{cloneDeep-CXHTtsEc.js → cloneDeep-sSKmkjV3.js} +1 -1
- package/dist/assets/{collapse-8NywKzkD.js → collapse-Cf8moIch.js} +1 -1
- package/dist/assets/{complete-MnVDnuuG.js → complete-e6hBRX3N.js} +1 -1
- package/dist/assets/{component-Bk_-E4gg.js → component-XnltTgOf.js} +3 -3
- package/dist/assets/{config-Dr92nV4I.js → config-BGwcsbBr.js} +1 -1
- package/dist/assets/{config-Bn0_m02e.js → config-BppSCyM-.js} +1 -1
- package/dist/assets/{config-BTL01fgU.js → config-ChvIwoil.js} +1 -1
- package/dist/assets/{config-navigation-DqeOzGVr.js → config-navigation-vJrJrwXE.js} +9 -9
- package/dist/assets/{config-space-O69Nv0aB.js → config-space-CTTPnPjr.js} +1 -1
- package/dist/assets/{confirm-DG4ITIko.js → confirm-CylT1MuR.js} +1 -1
- package/dist/assets/{connect-DL2dlLBg.js → connect-D1U71zMh.js} +1 -1
- package/dist/assets/{connect-ChI6OGaf.js → connect-D9SITMTZ.js} +1 -1
- package/dist/assets/{connect-to-C2mb3SLL.js → connect-to-B7H-Chnx.js} +1 -1
- package/dist/assets/{content-layout-C8_nylvn.js → content-layout-CotAwqHA.js} +1 -1
- package/dist/assets/{createClass-BQk0eOTp.js → createClass-CedsFAiy.js} +1 -1
- package/dist/assets/{dashboard-DV0LBHTV.js → dashboard-hbcsb63I.js} +3 -3
- package/dist/assets/deepseek-C3x42pq3.png +0 -0
- package/dist/assets/{delete-confirm-DWLdmGwG.js → delete-confirm-CsNBLZ0O.js} +1 -1
- package/dist/assets/{did-address-Df2xj-8v.js → did-address-BZQ3OHpT.js} +1 -1
- package/dist/assets/{domain-DpAqDcFt.js → domain-0OPS16_V.js} +1 -1
- package/dist/assets/{domain-action-card-BNiWQCQ3.js → domain-action-card-DNug7dz9.js} +2 -2
- package/dist/assets/domains-Ds15DpYS.js +1 -0
- package/dist/assets/doubao-yPqHSkLx.png +0 -0
- package/dist/assets/{email-CklgLemm.js → email-CRS4tNpx.js} +1 -1
- package/dist/assets/{empty-spinner-8MrwYy6o.js → empty-spinner-DYg7efl9.js} +1 -1
- package/dist/assets/engine-FgocryKo.js +1 -0
- package/dist/assets/{exchange-passport-WsgMY25n.js → exchange-passport-GffYf_m-.js} +1 -1
- package/dist/assets/{form-DI2NdlIg.js → form-DlK4omzK.js} +1 -1
- package/dist/assets/{form-text-input-D3GvGNCj.js → form-text-input-Dhhcv8eW.js} +1 -1
- package/dist/assets/{form-wrapper-CyRbKpkJ.js → form-wrapper-BEhcx7Ef.js} +1 -1
- package/dist/assets/{fuel-B9OsPuGR.js → fuel-CqQax_BS.js} +1 -1
- package/dist/assets/gemini-DffKpc81.png +0 -0
- package/dist/assets/{gen-access-key-CxfRvtHl.js → gen-access-key-DgO3So4-.js} +1 -1
- package/dist/assets/{gen-simple-access-key-CkVVA533.js → gen-simple-access-key-CLexjALx.js} +1 -1
- package/dist/assets/get-safe-url-DXqaEhFh.js +1 -0
- package/dist/assets/google-DT1VSJ0m.png +0 -0
- package/dist/assets/{hdkey-CRIWCUzf.js → hdkey-CHxXj9P3.js} +1 -1
- package/dist/assets/{home-CL12xJFi.js → home-CJwCCJel.js} +1 -1
- package/dist/assets/ideogram-REIjy0Er.png +0 -0
- package/dist/assets/{iframe-C5cUHhd8.js → iframe-BTIpP4Hw.js} +1 -1
- package/dist/assets/{index-ggMl8oln.js → index-7ggrWc16.js} +4 -4
- package/dist/assets/{index-BEhPdNPV.js → index-AlukFQyB.js} +1 -1
- package/dist/assets/index-BH75RD8c.js +30 -0
- package/dist/assets/{index-CTJcDBG9.js → index-BMJ9thMh.js} +1 -1
- package/dist/assets/{index-B_XelxpM.js → index-BPzAOInQ.js} +1 -1
- package/dist/assets/index-BRKdK9jJ.js +177 -0
- package/dist/assets/{index-yBrWp7fO.js → index-BWQTJ4kw.js} +1 -1
- package/dist/assets/{index-UylIOMye.js → index-BamsQCM-.js} +113 -113
- package/dist/assets/{index-BGrrYkUR.js → index-BiB2e8Yu.js} +4 -4
- package/dist/assets/index-BoOZkuTi.js +1 -0
- package/dist/assets/index-BvdzRjbh.js +271 -0
- package/dist/assets/{index-DTsM42Id.js → index-CZyIUWF0.js} +1 -1
- package/dist/assets/{index-cZYnZ4B7.js → index-CjfDGq-5.js} +1 -1
- package/dist/assets/{index-8fv-5AAQ.js → index-Ct3iQdTC.js} +1 -1
- package/dist/assets/{index-CFLZaEiL.js → index-DAxAF51T.js} +1 -1
- package/dist/assets/{index-BORYB__L.js → index-DO9UDa6G.js} +1 -1
- package/dist/assets/{index-D6ay4OGg.js → index-DOLfG_0X.js} +8 -8
- package/dist/assets/{index-oUY4wc3e.js → index-DQ60VjsN.js} +1 -1
- package/dist/assets/{index-TvxuFSBz.js → index-DSrm_rK4.js} +4 -4
- package/dist/assets/{index-BOtYQVYn.js → index-DYfNv4CN.js} +1 -1
- package/dist/assets/{index-Ch35mI2K.js → index-DdXpn59U.js} +1 -1
- package/dist/assets/{index-DDc4xNxF.js → index-Dh4j6qyG.js} +3 -3
- package/dist/assets/{index-BoHT1W-z.js → index-Dn1L9Nu2.js} +1 -1
- package/dist/assets/{index-DkalauYm.js → index-K-GfrQtE.js} +1 -1
- package/dist/assets/{index-BlUSkcPF.js → index-LrrgtY15.js} +2 -2
- package/dist/assets/{index-D12D99od.js → index-R5F7CSrk.js} +1 -1
- package/dist/assets/{index-Dnk-V5A3.js → index-eF2PLa8g.js} +1 -1
- package/dist/assets/{index--e0vFPst.js → index-lPzqDjdD.js} +1 -1
- package/dist/assets/{index-qbpx4ho0.js → index-m4b2voqL.js} +9 -9
- package/dist/assets/{index--dY679jL.js → index-vnGvaRYC.js} +1 -1
- package/dist/assets/{invitation-Dw_3wbU_.js → invitation-CpSWefdW.js} +1 -1
- package/dist/assets/{invite-D2VAra9S.js → invite-AYEjhFQ0.js} +1 -1
- package/dist/assets/{isURL-BXV7aNks.js → isURL-BNktOhyT.js} +1 -1
- package/dist/assets/{issue-passport-YNIfHEWU.js → issue-passport-FIUqn8xz.js} +1 -1
- package/dist/assets/{item-CRkxqMEd.js → item-PqlihMZp.js} +1 -1
- package/dist/assets/{landing-page-axrQrFAe.js → landing-page-iAUVw0Ie.js} +1 -1
- package/dist/assets/{launch-result-message-CYwb6iA9.js → launch-result-message-CFpqIQB2.js} +1 -1
- package/dist/assets/{layout-DHabex9A.js → layout-BzSJPpmA.js} +1 -1
- package/dist/assets/list-0sUwxo0D.js +4 -0
- package/dist/assets/{list-LS9VMpKO.js → list-DiTAJfbm.js} +2 -2
- package/dist/assets/{list-header-DdgW2mjM.js → list-header-DELs3iEf.js} +1 -1
- package/dist/assets/localization-Bo7Gfk7M.js +1 -0
- package/dist/assets/{log-BqfK7lKM.js → log-BP8tEg4T.js} +1 -1
- package/dist/assets/logger-CvoADwsx.js +1 -0
- package/dist/assets/{login-MUf1UgXC.js → login-BhegLCH_.js} +1 -1
- package/dist/assets/{login-oauth-callback-nvA1-MHC.js → login-oauth-callback-CPTNuxD4.js} +1 -1
- package/dist/assets/{logo-uploader-COwE7-CG.js → logo-uploader-CJlzjDbr.js} +2 -2
- package/dist/assets/{lost-passport-15i-h32g.js → lost-passport-BJcnymBH.js} +1 -1
- package/dist/assets/{observability-4ZKd3ESd.js → observability-CarzdE5-.js} +1 -1
- package/dist/assets/ollama-C7MZn2d_.png +0 -0
- package/dist/assets/{omit-s-NbcM4Z.js → omit-C2ouGG7F.js} +1 -1
- package/dist/assets/{open-window-CG51J4gC.js → open-window--cmVNAN5.js} +1 -1
- package/dist/assets/openai-DlpqJdrb.png +0 -0
- package/dist/assets/{over-due-invoice-payment-DBpVXkfx.js → over-due-invoice-payment-Cr2kTw63.js} +1 -1
- package/dist/assets/{overview-B9lpCSRm.js → overview-BQiifSE9.js} +1 -1
- package/dist/assets/{page-header-CyNE6Ofr.js → page-header-CIjuv0WX.js} +1 -1
- package/dist/assets/{passport-item-DybEL-4U.js → passport-item-u44phIJc.js} +1 -1
- package/dist/assets/{permission-BFrFUit7.js → permission-DCakrWTT.js} +1 -1
- package/dist/assets/{playground-DeasY3DH.js → playground-6dTtbzYq.js} +1 -1
- package/dist/assets/poe-B588TgZu.png +0 -0
- package/dist/assets/preferences-eL-qWovr.js +1 -0
- package/dist/assets/profile-embed-CG26T6ks.js +1 -0
- package/dist/assets/publish-resource-sC6DGUJ-.js +1 -0
- package/dist/assets/{react-beautiful-dnd.esm-CiUp8xsU.js → react-beautiful-dnd.esm-CQcgZoy2.js} +1 -1
- package/dist/assets/{react-stripe.esm-CvJuW6o6.js → react-stripe.esm-BHOF7FLg.js} +1 -1
- package/dist/assets/{required-McYgDRcp.js → required-CtPXGgxr.js} +1 -1
- package/dist/assets/{runtime-DRKR2vcm.js → runtime-D6AwdQxS.js} +1 -1
- package/dist/assets/{sanitize-BSfQHy23.js → sanitize-BwaMGjTb.js} +1 -1
- package/dist/assets/sdk-D1Af0QY_.js +1 -0
- package/dist/assets/{section-DSgkHUgY.js → section-4lLmF6fb.js} +1 -1
- package/dist/assets/{security-6K3NLRV1.js → security-BA1zPj2C.js} +1 -1
- package/dist/assets/{session-HjmNdK0I.js → session-t9gAHtO2.js} +1 -1
- package/dist/assets/{setup-Cmh0SuN8.js → setup-HVlps4V-.js} +1 -1
- package/dist/assets/{shorten-label-CphpNRtN.js → shorten-label-BYntTWDs.js} +1 -1
- package/dist/assets/{simple-select-B6PbGWwo.js → simple-select-3dAlIQHx.js} +1 -1
- package/dist/assets/{spaces-BODiJUEs.js → spaces-DH0QfvNS.js} +1 -1
- package/dist/assets/{start-B1fjvXGG.js → start-BuDZLaw8.js} +1 -1
- package/dist/assets/{starting-progress-CCfzhLUS.js → starting-progress-DSrsuJKX.js} +1 -1
- package/dist/assets/{status-C8JIpIsB.js → status-DMVFJ7Ns.js} +1 -1
- package/dist/assets/{step-actions-DSUIHhcl.js → step-actions-viiOlGZP.js} +1 -1
- package/dist/assets/{studio-BP9bO0-g.js → studio-MPC5GOTw.js} +1 -1
- package/dist/assets/{switch-control-BAMq90al.js → switch-control-DhPPQXXT.js} +1 -1
- package/dist/assets/{table-tips-DyJrgU_f.js → table-tips-DHbTBOnI.js} +1 -1
- package/dist/assets/{team-BD_3DJh4.js → team-PwzFoyAO.js} +1 -1
- package/dist/assets/{traffic-CzjP91eE.js → traffic-BTX68PbB.js} +1 -1
- package/dist/assets/{transfer-BNGu3nRa.js → transfer-CaVw1Uf4.js} +1 -1
- package/dist/assets/{unsubscribe-BsWf1MUr.js → unsubscribe-uHK5uqdd.js} +1 -1
- package/dist/assets/{use-app-logo-CaQrhdt8.js → use-app-logo-CNyOsQwv.js} +1 -1
- package/dist/assets/{use-mobile-BTugf2DR.js → use-mobile-C8UweHoJ.js} +1 -1
- package/dist/assets/{use-mobile-BjYFyM2N.js → use-mobile-D2h0sedv.js} +1 -1
- package/dist/assets/{use-server-logo-B7LbKzj5.js → use-server-logo-D2sYKpzr.js} +1 -1
- package/dist/assets/{use-window-close-BSqwQaeS.js → use-window-close-6fEaqfn0.js} +1 -1
- package/dist/assets/{useAsync-BGvZXHet.js → useAsync-CNAYLnLm.js} +1 -1
- package/dist/assets/{useAsync-BWNXO1rj.js → useAsync-DZevTxbv.js} +1 -1
- package/dist/assets/{useAsyncRetry-CpdhLok_.js → useAsyncRetry-ODp5sGTA.js} +1 -1
- package/dist/assets/{useLocalStorage-DVau1hEB.js → useLocalStorage-QnmPEXnx.js} +1 -1
- package/dist/assets/{user-center-CuEVuAdh.js → user-center-MGVe1Tl4.js} +3 -3
- package/dist/assets/user-follower-DnS-dznO.js +32 -0
- package/dist/assets/{user-sessions-CatK1_Zw.js → user-sessions-UGCijU4z.js} +1 -1
- package/dist/assets/{util-CUI_ZmDM.js → util-BT_TGAHY.js} +1 -1
- package/dist/assets/{util-DuIMhFew.js → util-xXS8bje8.js} +1 -1
- package/dist/assets/{vendor-arcblock-CpQy1iPf.js → vendor-arcblock-Gj9ygDGP.js} +1 -1
- package/dist/assets/{vendor-hooks-BCWx0EFG.js → vendor-hooks-DLNZ8kxG.js} +2 -2
- package/dist/assets/{vendor-mui-core-BkVXEDpj.js → vendor-mui-core-Bq_sfmbr.js} +1 -1
- package/dist/assets/{vendor-mui-x-DiiSwpci.js → vendor-mui-x-BbwECMfi.js} +1 -1
- package/dist/assets/{vendor-utils-Vg_blW2I.js → vendor-utils-DQK0pEML.js} +1 -1
- package/dist/assets/{vendor-ux-BuVrSS5Q.js → vendor-ux-BagecGKr.js} +2 -2
- package/dist/assets/{wait-connect-BA3jKwDf.js → wait-connect-B5cBJUbg.js} +1 -1
- package/dist/assets/{wizard-DJpPahxg.js → wizard-DmXX1YRu.js} +2 -2
- package/dist/assets/{wizard-components-CJnpL0XW.js → wizard-components-DK6w0tqC.js} +2 -2
- package/dist/assets/{wrap-locale-CVa5Q-hE.js → wrap-locale-As5nSm9H.js} +1 -1
- package/dist/assets/{zh-CdNKkRMR.js → zh-DilEt4P2.js} +1 -1
- package/dist/index.html +6 -6
- package/dist/service-worker.js +1 -1
- package/package.json +37 -37
- package/dist/assets/api-UEK-NQqw.js +0 -1
- package/dist/assets/branding-BiutQrwI.js +0 -1
- package/dist/assets/button-AjggtWPi.js +0 -1
- package/dist/assets/domains-B_SpbTrj.js +0 -1
- package/dist/assets/engine-GV-p3Fxn.js +0 -1
- package/dist/assets/get-safe-url-BXm7L7_P.js +0 -1
- package/dist/assets/index-BOu91gPz.js +0 -30
- package/dist/assets/index-BYbLccyT.js +0 -161
- package/dist/assets/index-BzsXxOiG.js +0 -271
- package/dist/assets/index-DCrnmu85.js +0 -1
- package/dist/assets/list-wxt9eC9U.js +0 -4
- package/dist/assets/localization-D_4reWfj.js +0 -1
- package/dist/assets/logger-B9nd1rH0.js +0 -1
- package/dist/assets/preferences-rTRVaG_q.js +0 -1
- package/dist/assets/profile-embed-DZX01PjZ.js +0 -1
- package/dist/assets/publish-resource-CJTUgGn8.js +0 -1
- package/dist/assets/sdk-xBIHQiyx.js +0 -1
- package/dist/assets/user-follower-D-nWZARf.js +0 -32
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e,a6 as P,ak as E}from"./vendor-mui-core-
|
|
1
|
+
import{j as e,a6 as P,ak as E}from"./vendor-mui-core-Bq_sfmbr.js";import{r as T,i as k}from"./vendor-react-Dvs43sk9.js";import{o as j}from"./vendor-arcblock-Gj9ygDGP.js";import{T as C,H as d,Q as S}from"./vendor-ux-BagecGKr.js";import{v as W,c as v,S as I,s as R,b as U}from"./index-BamsQCM-.js";import{K as b}from"./landing-page-iAUVw0Ie.js";import{w as L}from"./wrap-locale-As5nSm9H.js";import{g as N}from"./get-safe-url-DXqaEhFh.js";import"./vendor-utils-DQK0pEML.js";import"./vendor-hooks-DLNZ8kxG.js";import"./lottie-web-4koyQiv_.js";function _({SessionContext:n,webWalletUrl:a,onSuccess:o}){const{api:t,session:i}=T.useContext(n),{t:s,locale:h}=C(),f=k(),{searchParams:p}=new URL(window.location.href),l=p.get("redirect"),g=async(r,w)=>{o(r,w),await i.refresh(),d.success(s("exchangePassport.success")),setTimeout(()=>{if(l){const c=decodeURIComponent(l);c.startsWith(v.WELLKNOWN_SERVICE_PATH_PREFIX)?f(c,{replace:!0}):window.location.href=N(c)}else window.location.href=window.env.pathPrefix||window.env.apiPrefix||"/"},3e3)},u=r=>{d.error(r.message)},m={},x=p.get("componentId");return x&&(m.componentId=x),i.loading?e.jsx(j,{children:e.jsx(P,{})}):e.jsx(b,{did:window?.blocklet?.appPid||window?.env?.appPid,children:e.jsx(E,{sx:{maxWidth:"100%",height:"100%"},children:e.jsx(W,{popup:!0,open:!0,className:"connect",action:"exchange-passport",checkFn:t.get,checkTimeout:10*60*1e3,webWalletUrl:a,onSuccess:g,onError:u,locale:h,messages:{title:s("exchangePassport.dialog.title"),scan:s("exchangePassport.dialog.scan"),confirm:s("exchangePassport.dialog.confirm"),success:s("exchangePassport.dialog.success")},extraParams:m,extraContent:null,hideCloseButton:!0})})})}const B=L(_);function y(){const n=S(),a=(o,t)=>{o.sessionToken&&(R(t(o.sessionToken)),U(t(o.refreshToken)))};return e.jsx(B,{SessionContext:I,webWalletUrl:n,onSuccess:a})}export{y as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{D as w,j as o,a6 as v,T as B,bo as S}from"./vendor-mui-core-
|
|
1
|
+
import{D as w,j as o,a6 as v,T as B,bo as S}from"./vendor-mui-core-Bq_sfmbr.js";import{o as T}from"./vendor-arcblock-Gj9ygDGP.js";import{T as k,F}from"./vendor-ux-BagecGKr.js";import{r as _}from"./vendor-react-Dvs43sk9.js";import{l as P}from"./vendor-hooks-DLNZ8kxG.js";import{a3 as M,L as D}from"./index-BamsQCM-.js";import"./vendor-utils-DQK0pEML.js";import"./lottie-web-4koyQiv_.js";const{Elements:I,PaymentElement:R,useElements:z,useStripe:N,loadStripe:L,LinkAuthenticationElement:O}=globalThis.__STRIPE_COMPONENTS__,W=S("div")`
|
|
2
2
|
width: 100%;
|
|
3
3
|
opacity: 0;
|
|
4
4
|
transition: opacity 300ms ease;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as N,r as o}from"./vendor-react-Dvs43sk9.js";import{j as e,I as w,bg as G,Q as U,bD as H,O as Q,P as $,ai as J,o as Y,M as Z,W as s,z as V,ak as d,a6 as ee,bE as se,aj as te,F as ne,bF as ae}from"./vendor-mui-core-
|
|
1
|
+
import{a as N,r as o}from"./vendor-react-Dvs43sk9.js";import{j as e,I as w,bg as G,Q as U,bD as H,O as Q,P as $,ai as J,o as Y,M as Z,W as s,z as V,ak as d,a6 as ee,bE as se,aj as te,F as ne,bF as ae}from"./vendor-mui-core-Bq_sfmbr.js";import{G as re}from"./vendor-ux-BagecGKr.js";import{R as le}from"./required-CtPXGgxr.js";import{F as oe}from"./form-wrapper-BEhcx7Ef.js";import{e as ie}from"./edit.svg-DycWG9v3.js";function L({triggers:l=[],onEnterEdit:n,disabled:p}){const a=N.useRef(null),[h,c]=N.useState(!1),k=r=>{c(!1),r()},C=()=>{c(r=>!r)},i=r=>{a.current&&a.current.contains(r.target)||c(!1)};return l.length===0?e.jsx(w,{"data-cy":"schema-form-item-edit",onClick:n,disabled:p,size:"large",children:e.jsx(ie,{})}):e.jsxs(e.Fragment,{children:[e.jsx(G,{variant:"outlined",ref:a,"aria-label":"split button",children:e.jsx(U,{size:"large","aria-controls":h?"split-button-menu":void 0,"aria-expanded":h?"true":void 0,sx:{paddingLeft:"12px",paddingRight:"12px"},onClick:C,children:e.jsx(H,{})})}),e.jsx(Q,{sx:{zIndex:9999},open:h,anchorEl:a.current,role:void 0,placement:"bottom-end",children:e.jsx($,{children:e.jsx(J,{onClickAway:i,children:e.jsx(Y,{id:"split-button-menu",autoFocusItem:!0,children:l.map(r=>e.jsx(Z,{onClick:()=>k(r.handler),children:r.title},r.key))})})})})]})}L.propTypes={triggers:s.arrayOf(s.shape({key:s.string.isRequired,title:s.string.isRequired,handler:s.func.isRequired})),onEnterEdit:s.func.isRequired,disabled:s.bool.isRequired};const D=(l,n,p)=>l===null&&n&&p?"******":l?n?"******":l:"",ce=ae`
|
|
2
2
|
0%, 100% {
|
|
3
3
|
transform: scale(1) translateX(0);
|
|
4
4
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as e,ak as s,a6 as w,a$ as B,bc as N,at as v,W as d}from"./vendor-mui-core-
|
|
1
|
+
import{j as e,ak as s,a6 as w,a$ as B,bc as N,at as v,W as d}from"./vendor-mui-core-Bq_sfmbr.js";import{r as l}from"./vendor-react-Dvs43sk9.js";import{C as I}from"./vendor-utils-DQK0pEML.js";import{G as $}from"./vendor-ux-BagecGKr.js";import{m as L,a as E,v as z}from"./index-BamsQCM-.js";import{W as A}from"./did-address-BZQ3OHpT.js";import{a as D}from"./page-header-CIjuv0WX.js";import{S as F}from"./layout-BzSJPpmA.js";import{S as P}from"./step-actions-viiOlGZP.js";import{S as m}from"./button-DY13Itzc.js";import"./vendor-hooks-DLNZ8kxG.js";import"./lottie-web-4koyQiv_.js";import"./vendor-arcblock-Gj9ygDGP.js";import"./content-layout-CotAwqHA.js";import"./use-mobile-C8UweHoJ.js";function R({onNext:n=()=>{},onPrevious:x=()=>{}}){const{locale:u,t}=l.useContext($),{blocklet:a,gas:c,tokenInfo:f,actions:h}=L(),{api:j}=E(),[y,o]=l.useState(!1),{need:p="",current:g="",owe:r=99999,deficiency:k,symbol:b="",endpoint:i}=c||{},{origin:C="/"}=i?new URL(i):{};l.useEffect(()=>{const W=setInterval(()=>{h.refreshFuel()},2e3);return()=>{clearInterval(W)}},[]);const S=()=>{o(!1)};return c?e.jsxs(T,{children:[e.jsx("div",{className:"header",children:e.jsx(D,{title:t("setup.fuel.title"),onClickBack:x})}),e.jsxs(s,{className:"qr-body",children:[e.jsxs(s,{className:"tip",sx:{mb:6},children:[t("setup.fuel.tipStart").replace("slot",""),e.jsx("span",{className:"amount",children:`${p} ${b}`}),t("setup.fuel.tipEnd")]}),e.jsx(s,{sx:{fontSize:16,fontWeight:"fontWeightBold",mb:.5},children:t("setup.fuel.addressTitle")}),e.jsxs(s,{sx:{display:"flex",alignItems:"center"},children:[e.jsx(A,{className:"address",did:a.appDid}),e.jsx(B,{style:{lineHeight:1},target:"_blank",href:I(C,"/explorer/accounts/",a.appDid),underline:"hover",children:e.jsx(N,{className:"icon-launch"})})]}),e.jsx(s,{sx:{my:2},children:e.jsx(m,{color:"primary",onClick:()=>o(!0),disabled:!r,children:t("setup.fuel.fuelApp")})}),e.jsx(z,{popup:!0,open:y,action:"fuel",checkFn:j.get,checkTimeout:10*60*1e3,onSuccess:S,onClose:()=>o(!1),locale:u,messages:{title:t("setup.connect.title"),scan:t("setup.connect.scan"),confirm:t("setup.connect.confirm"),success:t("setup.connect.success")},extraParams:{amount:k,...f,endpoint:i}}),e.jsxs(s,{sx:{display:"flex",color:"text.secondary"},children:[e.jsxs(s,{sx:{display:"flex"},children:[e.jsxs(s,{children:[t("setup.fuel.need"),":"]}),e.jsx(s,{sx:{ml:.5,color:"primary.main",fontWeight:"fontWeightBold"},children:p})]}),e.jsxs(s,{sx:{display:"flex",ml:3},children:[e.jsxs(s,{children:[t("setup.fuel.current"),":"]}),e.jsx(s,{sx:{ml:.5,color:r>0?"error.main":"primary.main",fontWeight:"fontWeightBold"},children:g})]})]})]}),e.jsx(P,{mt:8,children:e.jsx(m,{disabled:r>0,onClick:()=>n(),children:t("setup.next")})})]}):e.jsx(s,{sx:{display:"flex",justifyContent:"center",alignItems:"center",width:"100%"},children:e.jsx(w,{})})}R.propTypes={onNext:d.func,onPrevious:d.func};const T=v(F)`
|
|
2
2
|
.qr-body {
|
|
3
3
|
width: 580px;
|
|
4
4
|
${n=>n.theme.breakpoints.down("md")} {
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{D as E,j as e,Q as S,b3 as P,b0 as R,ak as r,T as c,a6 as _}from"./vendor-mui-core-
|
|
1
|
+
import{D as E,j as e,Q as S,b3 as P,b0 as R,ak as r,T as c,a6 as _}from"./vendor-mui-core-Bq_sfmbr.js";import{a as I,T as L,c as N,t as p,U as T,V as U}from"./index-BamsQCM-.js";import{o as W}from"./vendor-arcblock-Gj9ygDGP.js";import{G as A}from"./vendor-ux-BagecGKr.js";import{g as D,b as w}from"./vendor-hooks-DLNZ8kxG.js";import{i as z,r as i,u as F}from"./vendor-react-Dvs43sk9.js";import{K as a}from"./landing-page-iAUVw0Ie.js";import{C as K}from"./vendor-utils-DQK0pEML.js";import{u as M}from"./use-window-close-6fEaqfn0.js";import"./lottie-web-4koyQiv_.js";function Z(){const m=z(),l=i.useRef(null),{t:s,locale:d}=i.useContext(A),{api:x,connectApi:f}=I(),[h]=F(),j=E(),k=M(),n=D({ready:!1,success:!1,error:null,invalidSession:!1}),b=()=>{try{const o=new URL(window.location.href);if(o.hash.includes("invalid")){n.invalidSession=!0;return}const u=o.searchParams.get("__connect_url__"),v=T(u);if(!U(v))throw new Error("No token");n.ready=!0}catch{n.invalidSession=!0,m("#invalid",{replace:!0})}};i.useLayoutEffect(()=>b(),[]);const C=w(o=>{n.error=o.message,window.opener?.postMessage({type:"connect-endpoint-message",error:n.error},"*"),m("#invalid",{replace:!0})}),g=w(()=>{window.opener?.postMessage({type:"connect-endpoint-message",success:!0},"*"),n.success=!0}),t=h.get("source")||"Generate Access Key";i.useEffect(()=>{l.current&&n.ready&&f.open({locale:d,containerEl:l.current,action:"gen-access-key",extraParams:{remark:t},checkFn:x.get,saveConnect:!1,forceConnected:!1,className:"connect",popup:!1,baseUrl:window.location.origin,prefix:K(window.location.origin,N.WELLKNOWN_SERVICE_PATH_PREFIX,L),messages:{title:s("connectCli.title"),scan:s("connectCli.scan"),confirm:s("auth.confirm"),success:s("connectCli.success")},onSuccess:g,onError:C},{locale:d})},[f,n.ready,x,C,g,d,s,t]);const y=e.jsx(S,{variant:"outlined",color:"primary",size:"small",startIcon:e.jsx(P,{}),href:"/",style:{borderRadius:4},children:s("connectCli.home")});if(n.invalidSession)return e.jsx(a,{did:window.blocklet?.appPid,standalone:!0,children:e.jsx(p,{style:{backgroundColor:"transparent"},status:"error",title:s("connectCli.invalidSession"),description:s("connectCli.invalidSessionDesc"),extra:y})},"invalid");if(n.error){const o=n.error,u=y;return e.jsx(a,{did:window.blocklet?.appPid,standalone:!0,children:e.jsx(p,{style:{backgroundColor:"transparent"},status:"error",title:s("connectCli.connectionError"),description:o,extra:u})},"error")}return n.success?(h.has("closeOnSuccess")&&k(),e.jsx(a,{did:window.blocklet?.appPid,standalone:!0,children:e.jsx(p,{style:{backgroundColor:"transparent"},status:"info",icon:e.jsx(R,{style:{color:j.palette.success.main,fontSize:72}}),title:s("connectCli.success",{source:t}),description:`${s("connectCli.successDesc",{source:t})} ${s("connectCli.upload")}`})},"success")):n.ready?e.jsx(a,{did:window.blocklet?.appPid,standalone:!0,children:e.jsxs(r,{sx:{maxWidth:"100%",height:"100%"},children:[e.jsxs(r,{sx:{mb:5},children:[e.jsx(c,{variant:"h4",component:"h1",sx:{mb:1,fontWeight:"bold",textAlign:"center"},children:s("connectCli.tips.title")}),e.jsxs(r,{sx:{display:"flex",flexDirection:"column",gap:1,alignItems:"center"},children:[e.jsx(c,{sx:{color:"text.secondary"},children:s("connectCli.tips.item1")}),e.jsx(c,{sx:{color:"text.secondary"},children:s("connectCli.tips.item2")}),e.jsx(c,{sx:{color:"text.secondary"},children:s("connectCli.tips.item3")})]})]}),e.jsx(r,{sx:{display:"inline-block"},ref:l})]})},"ready"):e.jsx(W,{children:e.jsx(_,{})})}export{Z as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e,ak as r,T as v,a6 as E,b1 as J,Q as P,a$ as Q,D as V,aX as M,bM as O,b0 as X}from"./vendor-mui-core-
|
|
1
|
+
import{j as e,ak as r,T as v,a6 as E,b1 as J,Q as P,a$ as Q,D as V,aX as M,bM as O,b0 as X}from"./vendor-mui-core-Bq_sfmbr.js";import{r as p,i as Y,u as Z}from"./vendor-react-Dvs43sk9.js";import{O as ee,a as ne,e as se,U as W,t as oe,au as te,c as re}from"./index-BamsQCM-.js";import{n as S,C as R}from"./vendor-utils-DQK0pEML.js";import{g as K,b as d,p as ie,q as ae}from"./vendor-hooks-DLNZ8kxG.js";import{M as $,T as H,a5 as ce,C as q,a2 as le}from"./vendor-ux-BagecGKr.js";import{o as ue}from"./vendor-arcblock-Gj9ygDGP.js";import{K as de}from"./landing-page-iAUVw0Ie.js";import{B as pe,o as he,l as xe}from"./index-DYfNv4CN.js";import{u as fe}from"./use-window-close-6fEaqfn0.js";import"./lottie-web-4koyQiv_.js";function ge({requestAppInfo:i,currentAppInfo:y}){return e.jsxs(r,{sx:{textAlign:"center",display:"flex",flexDirection:"column",alignItems:"center",gap:2},children:[e.jsxs(r,{sx:{display:"flex",alignItems:"center",justifyContent:"center"},children:[e.jsx($,{src:y.appLogo,alt:"Server",width:48,height:48,useProxyFallback:!0}),e.jsxs(r,{sx:{mx:2,display:"flex",alignItems:"center","& .dot":{width:8,height:8,borderRadius:"50%",bgcolor:"grey.500",mx:.5}},children:[e.jsx(r,{className:"dot"}),e.jsx(r,{className:"dot"}),e.jsx(r,{className:"dot"})]}),e.jsx($,{src:i.appLogo,alt:i.appName,width:48,height:48,useProxyFallback:!0})]}),e.jsxs(v,{sx:{mb:1,fontSize:"1.2rem"},children:["Authorize"," ",e.jsx(r,{component:"span",sx:{color:"primary.main"},children:i.appName})]})]})}const me={en:{notThis:"Not you?",useAnother:"Use another account",authorize:"Authorize",connect:"Connect",cancel:"Cancel"},zh:{notThis:"不是这个?",useAnother:"使用其他账户",authorize:"授权",connect:"Connect",cancel:"取消"}};function je({session:i,requestAppInfo:y,currentAppInfo:T,children:_=null,userInfo:o=void 0,hideSwitchConnect:k=!1,hideAuthorize:n=!1,hideCancel:z=!1,hideButton:b=!1,notThisText:N=void 0,authorizeText:t=void 0,connectText:a=void 0,cancelText:L=void 0,useAnotherText:C=void 0,slotProps:l=void 0,onConnect:I=S,onAuthorize:U=S,onSwitchConnect:D=S,onCancel:x=S,ref:w}){const c=K({loading:!1}),{locale:A="en"}=H()||{},h=d((j,G={})=>ce(me,j,A,"en",G)),f=d(()=>{c.loading=!1}),s=d(()=>{c.loading=!0,I?.(f)}),u=d(()=>{c.loading=!0,D?.(f)}),g=d(()=>{c.loading=!0,U?.(f)}),B=d(()=>{x?.()});if(p.useImperativeHandle(w,()=>({closeLoading:f})),i.loading||!i.initialized)return e.jsx(ue,{children:e.jsx(E,{})});const m=o??i?.user;return e.jsx(de,{did:window.blocklet?.appPid,standalone:!0,children:e.jsx(r,{...l?.root,sx:q({width:420,maxWidth:"100%"},l?.root?.sx),children:e.jsx(ee,{hideCloseButton:!0,...l?.didConnectContainer,children:e.jsxs(r,{...l?.contentContainer,sx:q({display:"flex",flexDirection:"column",gap:1.5,p:{xs:2,lg:3,xl:4},pt:{xs:3,xl:4},bgcolor:"background.paper"},l?.contentContainer?.sx),children:[e.jsx(ge,{requestAppInfo:y,currentAppInfo:T}),m?e.jsxs(e.Fragment,{children:[e.jsx(pe,{user:m,showDid:!0,cardType:xe.Detailed,infoType:he.Minimal}),e.jsx(r,{})]}):null,_,b?null:e.jsxs(e.Fragment,{children:[e.jsx(r,{sx:{border:"1px solid",borderColor:"divider",borderRadius:2,overflow:"hidden",my:1}}),e.jsxs(J,{direction:"row",spacing:2,children:[z?null:e.jsx(P,{color:"inherit",variant:"outlined",size:"large",fullWidth:!0,onClick:B,sx:{color:"grey.500"},children:L||h("cancel")}),m&&!n?e.jsxs(P,{variant:"contained",size:"large",fullWidth:!0,onClick:g,disabled:c.loading,children:[c.loading?e.jsx(E,{size:20,sx:{mr:1}}):null,t||h("authorize")]}):e.jsxs(P,{variant:"contained",size:"large",fullWidth:!0,disabled:c.loading,onClick:s,children:[c.loading?e.jsx(E,{size:20,sx:{mr:1}}):null,a||h("connect")]})]})]}),k||!m?null:e.jsx(r,{sx:{textAlign:"center"},children:e.jsxs(v,{variant:"body2",sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:1},children:[N||h("notThis")," ",e.jsx(Q,{underline:"hover",onClick:u,sx:{cursor:"pointer"},children:C||h("useAnother")})]})})]})})})})}const ye=R(window.location.origin,re.WELLKNOWN_BLOCKLET_USER_PATH,"settings#user-center-access-key-setting"),F=3e3;function Le(){const i=p.useRef(null),[y,T]=p.useState(),[_]=ie({targetDate:y}),{session:o}=ne(),k=V(),n=K({ready:!1,success:!1,error:null,invalidSession:!1,token:null}),[z,b]=ae("currentUserInfo",{defaultValue:null}),N=Y(),{t}=H(),[a]=Z(),L=fe(),[,C]=p.useState(!0),[l,I]=p.useState({appName:a.get("cli")?a.get("appName")??t("aigne.cli"):"",appLogo:a.get("cli")?a.get("appLogo"):""}),U=async()=>{C(!0);try{const s=a.get("__url__"),u=s?W(s):null;if(!u){C(!1);return}const g="__blocklet__.js?type=json",m=new URL(u).origin,{data:j}=await te.get(R(m,g));I({appName:j?.appName,appUrl:j?.appUrl,appLogo:R(j?.appUrl,j?.appLogo)})}catch(s){console.error(s)}finally{C(!1)}},D=()=>{U(),o.user&&b(o.user);try{const s=new URL(window.location.href);if(s.hash.includes("invalid")){n.invalidSession=!0;return}const u=s.searchParams.get("__token__"),g=u?W(u):null;if(!g)throw new Error("No token");n.token=g,n.ready=!0}catch(s){n.invalidSession=!0,n.error=s.message,window.opener?.postMessage({type:"connect-aigne-message",error:s.message},"*"),N("#invalid",{replace:!0})}};p.useLayoutEffect(()=>D(),[]);const x=window.blocklet,w=a.get("source")||"Generate Access Key",c=d(async s=>{try{await se.post("/access-key/authorize",{source:w,sid:n.token}),n.success=!0,window.opener?.postMessage({type:"connect-aigne-message",success:!0},"*"),a.has("closeOnSuccess")&&(T(Date.now()+F),setTimeout(()=>L(),F))}catch(u){console.error(u)}finally{s()}}),A=d(()=>{o.login()}),h=d(()=>{window.close()});p.useEffect(()=>{o.initialized&&!o.user&&(le()||A())},[o?.user,o?.initialized,A]),p.useEffect(()=>{o.open||i.current?.closeLoading?.()},[o.open]);const f=()=>n.error?e.jsxs(M,{severity:"error",children:[e.jsx(O,{children:t("aigne.notAuthorized")}),n.error]}):n.success?e.jsx(oe,{style:{backgroundColor:"transparent"},status:"info",icon:e.jsx(X,{style:{color:k.palette.success.main,fontSize:72}}),title:t("connectCli.success",{source:w}),description:`${t("connectCli.successDesc",{source:w})} ${a.has("closeOnSuccess")?t("connectCli.closeDelay",{seconds:Math.ceil(_/1e3)}):""}`}):e.jsxs(M,{severity:"info",children:[e.jsx(O,{children:t("aigne.connectTo",{appName:x.appName})}),e.jsx(v,{component:"li",variant:"body2",children:t("aigne.accessTips.tips1",{appName:l.appName,accessAppName:x.appName})}),e.jsx(v,{component:"li",variant:"body2",children:t("aigne.accessTips.tips2",{appName:l.appName})}),e.jsx(v,{component:"li",variant:"body2",sx:{"& a":{color:"inherit",textDecoration:"underline"}},dangerouslySetInnerHTML:{__html:t("aigne.accessTips.tips3",{url:ye,accessAppName:x.appName})}})]});return e.jsx(je,{ref:i,session:o,requestAppInfo:l,currentAppInfo:x,userInfo:z,onAuthorize:c,onConnect:A,onSwitchConnect:o.switchDid,onCancel:h,hideAuthorize:!!n.error,hideSwitchConnect:n.success,hideButton:n.success,authorizeText:t("common.approve"),slotProps:{root:{sx:{width:500}}},children:f()})}export{Le as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{R as t}from"./index-BamsQCM-.js";import{H as e}from"./vendor-ux-BagecGKr.js";function c(...o){try{return t(...o)}catch(r){throw e.error("Invalid redirect url"),console.error("Invalid redirect url",r),r}}export{c as g};
|
|
Binary file
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{p as ae}from"./vendor-react-Dvs43sk9.js";import{ax as Se,ay as Rr,az as Ir,aA as qr,aB as jr,aC as Nr,aD as wr,aE as xr,aF as We,aG as _r,s as Kr,aH as Tr,aI as Ur}from"./vendor-ux-
|
|
1
|
+
import{p as ae}from"./vendor-react-Dvs43sk9.js";import{ax as Se,ay as Rr,az as Ir,aA as qr,aB as jr,aC as Nr,aD as wr,aE as xr,aF as We,aG as _r,s as Kr,aH as Tr,aI as Ur}from"./vendor-ux-BagecGKr.js";import{bk as mr}from"./index-BamsQCM-.js";var Pe={exports:{}},Re={},Xe;function Sr(){if(Xe)return Re;Xe=1;function h(u){"@babel/helpers - typeof";return h=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(p){return typeof p}:function(p){return p&&typeof Symbol=="function"&&p.constructor===Symbol&&p!==Symbol.prototype?"symbol":typeof p},h(u)}function w(u,p,S){return Object.defineProperty(u,"prototype",{writable:!1}),u}function s(u,p){if(!(u instanceof p))throw new TypeError("Cannot call a class as a function")}function b(u,p){if(typeof p!="function"&&p!==null)throw new TypeError("Super expression must either be null or a function");u.prototype=Object.create(p&&p.prototype,{constructor:{value:u,writable:!0,configurable:!0}}),Object.defineProperty(u,"prototype",{writable:!1}),p&&K(u,p)}function K(u,p){return K=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(x,M){return x.__proto__=M,x},K(u,p)}function L(u){var p=n();return function(){var x=e(u),M;if(p){var U=e(this).constructor;M=Reflect.construct(x,arguments,U)}else M=x.apply(this,arguments);return v(this,M)}}function v(u,p){if(p&&(h(p)==="object"||typeof p=="function"))return p;if(p!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return f(u)}function f(u){if(u===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return u}function n(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function e(u){return e=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(S){return S.__proto__||Object.getPrototypeOf(S)},e(u)}var t={},d,y;function l(u,p,S){S||(S=Error);function x(U,H,V){return typeof p=="string"?p:p(U,H,V)}var M=function(U){b(V,U);var H=L(V);function V(X,te,Z){var J;return s(this,V),J=H.call(this,x(X,te,Z)),J.code=u,J}return w(V)}(S);t[u]=M}function q(u,p){if(Array.isArray(u)){var S=u.length;return u=u.map(function(x){return String(x)}),S>2?"one of ".concat(p," ").concat(u.slice(0,S-1).join(", "),", or ")+u[S-1]:S===2?"one of ".concat(p," ").concat(u[0]," or ").concat(u[1]):"of ".concat(p," ").concat(u[0])}else return"of ".concat(p," ").concat(String(u))}function O(u,p,S){return u.substr(0,p.length)===p}function A(u,p,S){return(S===void 0||S>u.length)&&(S=u.length),u.substring(S-p.length,S)===p}function j(u,p,S){return typeof S!="number"&&(S=0),S+p.length>u.length?!1:u.indexOf(p,S)!==-1}return l("ERR_AMBIGUOUS_ARGUMENT",'The "%s" argument is ambiguous. %s',TypeError),l("ERR_INVALID_ARG_TYPE",function(u,p,S){d===void 0&&(d=He()),d(typeof u=="string","'name' must be a string");var x;typeof p=="string"&&O(p,"not ")?(x="must not be",p=p.replace(/^not /,"")):x="must be";var M;if(A(u," argument"))M="The ".concat(u," ").concat(x," ").concat(q(p,"type"));else{var U=j(u,".")?"property":"argument";M='The "'.concat(u,'" ').concat(U," ").concat(x," ").concat(q(p,"type"))}return M+=". Received type ".concat(h(S)),M},TypeError),l("ERR_INVALID_ARG_VALUE",function(u,p){var S=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"is invalid";y===void 0&&(y=Se());var x=y.inspect(p);return x.length>128&&(x="".concat(x.slice(0,128),"...")),"The argument '".concat(u,"' ").concat(S,". Received ").concat(x)},TypeError),l("ERR_INVALID_RETURN_VALUE",function(u,p,S){var x;return S&&S.constructor&&S.constructor.name?x="instance of ".concat(S.constructor.name):x="type ".concat(h(S)),"Expected ".concat(u,' to be returned from the "').concat(p,'"')+" function but got ".concat(x,".")},TypeError),l("ERR_MISSING_ARGS",function(){for(var u=arguments.length,p=new Array(u),S=0;S<u;S++)p[S]=arguments[S];d===void 0&&(d=He()),d(p.length>0,"At least one arg needs to be specified");var x="The ",M=p.length;switch(p=p.map(function(U){return'"'.concat(U,'"')}),M){case 1:x+="".concat(p[0]," argument");break;case 2:x+="".concat(p[0]," and ").concat(p[1]," arguments");break;default:x+=p.slice(0,M-1).join(", "),x+=", and ".concat(p[M-1]," arguments");break}return"".concat(x," must be specified")},TypeError),Re.codes=t,Re}var Ie,Je;function Br(){if(Je)return Ie;Je=1;function h(g,E){var T=Object.keys(g);if(Object.getOwnPropertySymbols){var N=Object.getOwnPropertySymbols(g);E&&(N=N.filter(function(C){return Object.getOwnPropertyDescriptor(g,C).enumerable})),T.push.apply(T,N)}return T}function w(g){for(var E=1;E<arguments.length;E++){var T=arguments[E]!=null?arguments[E]:{};E%2?h(Object(T),!0).forEach(function(N){s(g,N,T[N])}):Object.getOwnPropertyDescriptors?Object.defineProperties(g,Object.getOwnPropertyDescriptors(T)):h(Object(T)).forEach(function(N){Object.defineProperty(g,N,Object.getOwnPropertyDescriptor(T,N))})}return g}function s(g,E,T){return E=v(E),E in g?Object.defineProperty(g,E,{value:T,enumerable:!0,configurable:!0,writable:!0}):g[E]=T,g}function b(g,E){if(!(g instanceof E))throw new TypeError("Cannot call a class as a function")}function K(g,E){for(var T=0;T<E.length;T++){var N=E[T];N.enumerable=N.enumerable||!1,N.configurable=!0,"value"in N&&(N.writable=!0),Object.defineProperty(g,v(N.key),N)}}function L(g,E,T){return E&&K(g.prototype,E),Object.defineProperty(g,"prototype",{writable:!1}),g}function v(g){var E=f(g,"string");return u(E)==="symbol"?E:String(E)}function f(g,E){if(u(g)!=="object"||g===null)return g;var T=g[Symbol.toPrimitive];if(T!==void 0){var N=T.call(g,E);if(u(N)!=="object")return N;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(g)}function n(g,E){if(typeof E!="function"&&E!==null)throw new TypeError("Super expression must either be null or a function");g.prototype=Object.create(E&&E.prototype,{constructor:{value:g,writable:!0,configurable:!0}}),Object.defineProperty(g,"prototype",{writable:!1}),E&&A(g,E)}function e(g){var E=q();return function(){var N=j(g),C;if(E){var a=j(this).constructor;C=Reflect.construct(N,arguments,a)}else C=N.apply(this,arguments);return t(this,C)}}function t(g,E){if(E&&(u(E)==="object"||typeof E=="function"))return E;if(E!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return d(g)}function d(g){if(g===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return g}function y(g){var E=typeof Map=="function"?new Map:void 0;return y=function(N){if(N===null||!O(N))return N;if(typeof N!="function")throw new TypeError("Super expression must either be null or a function");if(typeof E<"u"){if(E.has(N))return E.get(N);E.set(N,C)}function C(){return l(N,arguments,j(this).constructor)}return C.prototype=Object.create(N.prototype,{constructor:{value:C,enumerable:!1,writable:!0,configurable:!0}}),A(C,N)},y(g)}function l(g,E,T){return q()?l=Reflect.construct.bind():l=function(C,a,i){var c=[null];c.push.apply(c,a);var R=Function.bind.apply(C,c),m=new R;return i&&A(m,i.prototype),m},l.apply(null,arguments)}function q(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function O(g){return Function.toString.call(g).indexOf("[native code]")!==-1}function A(g,E){return A=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(N,C){return N.__proto__=C,N},A(g,E)}function j(g){return j=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(T){return T.__proto__||Object.getPrototypeOf(T)},j(g)}function u(g){"@babel/helpers - typeof";return u=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(E){return typeof E}:function(E){return E&&typeof Symbol=="function"&&E.constructor===Symbol&&E!==Symbol.prototype?"symbol":typeof E},u(g)}var p=Se(),S=p.inspect,x=Sr(),M=x.codes.ERR_INVALID_ARG_TYPE;function U(g,E,T){return(T===void 0||T>g.length)&&(T=g.length),g.substring(T-E.length,T)===E}function H(g,E){if(E=Math.floor(E),g.length==0||E==0)return"";var T=g.length*E;for(E=Math.floor(Math.log(E)/Math.log(2));E;)g+=g,E--;return g+=g.substring(0,T-g.length),g}var V="",X="",te="",Z="",J={deepStrictEqual:"Expected values to be strictly deep-equal:",strictEqual:"Expected values to be strictly equal:",strictEqualObject:'Expected "actual" to be reference-equal to "expected":',deepEqual:"Expected values to be loosely deep-equal:",equal:"Expected values to be loosely equal:",notDeepStrictEqual:'Expected "actual" not to be strictly deep-equal to:',notStrictEqual:'Expected "actual" to be strictly unequal to:',notStrictEqualObject:'Expected "actual" not to be reference-equal to "expected":',notDeepEqual:'Expected "actual" not to be loosely deep-equal to:',notEqual:'Expected "actual" to be loosely unequal to:',notIdentical:"Values identical but not reference-equal:"},he=10;function de(g){var E=Object.keys(g),T=Object.create(Object.getPrototypeOf(g));return E.forEach(function(N){T[N]=g[N]}),Object.defineProperty(T,"message",{value:g.message}),T}function oe(g){return S(g,{compact:!1,customInspect:!1,depth:1e3,maxArrayLength:1/0,showHidden:!1,breakLength:1/0,showProxy:!1,sorted:!0,getters:!0})}function ye(g,E,T){var N="",C="",a=0,i="",c=!1,R=oe(g),m=R.split(`
|
|
2
2
|
`),I=oe(E).split(`
|
|
3
3
|
`),B=0,z="";if(T==="strictEqual"&&u(g)==="object"&&u(E)==="object"&&g!==null&&E!==null&&(T="strictEqualObject"),m.length===1&&I.length===1&&m[0]!==I[0]){var W=m[0].length+I[0].length;if(W<=he){if((u(g)!=="object"||g===null)&&(u(E)!=="object"||E===null)&&(g!==0||E!==0))return"".concat(J[T],`
|
|
4
4
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as o,b1 as n}from"./vendor-mui-core-
|
|
1
|
+
import{j as o,b1 as n}from"./vendor-mui-core-Bq_sfmbr.js";import{L as r}from"./vendor-react-Dvs43sk9.js";import{D as i}from"./vendor-ux-BagecGKr.js";import{c as t}from"./index-BamsQCM-.js";import{S as e}from"./studio-MPC5GOTw.js";import"./vendor-utils-DQK0pEML.js";import"./vendor-hooks-DLNZ8kxG.js";import"./lottie-web-4koyQiv_.js";import"./vendor-arcblock-Gj9ygDGP.js";import"./index-vnGvaRYC.js";function L(){return o.jsx(e,{children:o.jsxs(n,{direction:"row",spacing:2,sx:{m:4},children:[o.jsx(i,{component:r,to:`${t.WELLKNOWN_SERVICE_PATH_PREFIX}/studio/preferences`,size:"large",color:"primary",variant:"outlined",children:"Preference Builder"}),o.jsx(i,{component:r,to:`${t.WELLKNOWN_SERVICE_PATH_PREFIX}/studio/branding`,size:"large",color:"primary",variant:"outlined",children:"Branding Images"}),o.jsx(i,{component:r,to:`${t.WELLKNOWN_SERVICE_PATH_PREFIX}/studio/localization`,size:"large",color:"primary",variant:"outlined",children:"Localization"})]})})}export{L as default};
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as E}from"./vendor-react-Dvs43sk9.js";import{a0 as L}from"./index-
|
|
1
|
+
import{a as E}from"./vendor-react-Dvs43sk9.js";import{a0 as L}from"./index-BamsQCM-.js";const $=({url:r,allowFullScreen:o,position:a,display:i,height:u,width:y,overflow:c,styles:f,onLoad:p,onMouseOver:m,onMouseOut:w,scrolling:b,id:d,frameBorder:n,ariaHidden:O,sandbox:s,allow:j,className:g,title:h,ariaLabel:k,ariaLabelledby:P,name:v,target:A,loading:F,importance:I,referrerpolicy:M,allowpaymentrequest:S,src:q,key:x})=>{const t=L({src:q||r,target:A||null,style:{position:a||null,display:i||"initial",overflow:c||null},scrolling:b||null,allowpaymentrequest:S||null,importance:I||null,sandbox:s&&[...s].join(" ")||null,loading:F||null,styles:f||null,name:v||null,className:g||null,allowFullScreen:"allowFullScreen",referrerpolicy:M||null,title:h||null,allow:j||null,id:d||null,"aria-labelledby":P||null,"aria-hidden":O||null,"aria-label":k||null,width:y||null,height:u||null,onLoad:p||null,onMouseOver:m||null,onMouseOut:w||null,key:x||"iframe"});let l=Object.create(null);for(let e of Object.keys(t))t[e]!=null&&(l[e]=t[e]);for(let e of Object.keys(l.style))l.style[e]==null&&delete l.style[e];if(l.styles)for(let e of Object.keys(l.styles))l.styles.hasOwnProperty(e)&&(l.style[e]=l.styles[e]),Object.keys(l.styles).pop()==e&&delete l.styles;if(o)if("allow"in l){const e=l.allow.replace("fullscreen","");l.allow=`fullscreen ${e.trim()}`.trim()}else l.allow="fullscreen";return n>=0&&(l.style.hasOwnProperty("border")||(l.style.border=n)),E.createElement("iframe",Object.assign({},l))};export{$ as I};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-
|
|
2
|
-
import{r as k,i as It,j as rt,L as we,g as fo,k as As,l as qs,m as bt}from"./vendor-react-Dvs43sk9.js";import{J as Oe,j as e,ak as a,b4 as Et,W as n,am as ke,I as ce,dv as Ns,dw as _s,
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-DOLfG_0X.js","assets/index-BamsQCM-.js","assets/vendor-mui-core-Bq_sfmbr.js","assets/vendor-react-Dvs43sk9.js","assets/vendor-ux-BagecGKr.js","assets/vendor-utils-DQK0pEML.js","assets/vendor-hooks-DLNZ8kxG.js","assets/lottie-web-4koyQiv_.js","assets/vendor-ux-DYcPPYq2.css","assets/vendor-arcblock-Gj9ygDGP.js","assets/index-DrVXX4fX.css","assets/index-BPy8_fa2.js","assets/index-DRYJ0xIl.js","assets/index-B5LvOF-F.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{r as k,i as It,j as rt,L as we,g as fo,k as As,l as qs,m as bt}from"./vendor-react-Dvs43sk9.js";import{J as Oe,j as e,ak as a,b4 as Et,W as n,am as ke,I as ce,dv as Ns,dw as _s,ch as xo,cf as nt,dx as Ws,a_ as Os,T as A,s as go,dy as ko,dz as zs,cK as Bs,Y as lt,at as ve,av as Vs,dA as Us,a5 as Ze,aX as it,bc as Pt,c6 as Ms,bf as Fs,b6 as Ye,cS as Hs,bg as et,Q as G,a6 as Se,bD as Js,O as jo,K as yo,P as Lt,ai as wo,o as vo,M as be,a3 as Xs,bB as Co,$ as Ro,bv as Gs,A as He,aJ as Ks,R as So,z as ne,b1 as Re,dB as Xt,bW as tt,dC as To,V as Do,S as $t,aP as Io,bC as Zs,D as Eo,cp as Ys,aQ as Qs,aR as er,cq as tr,cr as or,bE as Po,aq as sr,dD as rr,a1 as Lo,a0 as ot,bi as Gt,bH as nr,bI as lr,dE as ir,dF as cr,bb as vt,y as ar,F as dr,bp as ur,bq as ft}from"./vendor-mui-core-Bq_sfmbr.js";import{c as F,Z as ge,a8 as De,be as pr,v as hr,X as me,bZ as mr,Y as br,f as Kt,b_ as fr,au as Zt,ba as xr,bD as gr,b$ as kr,c0 as jr,c1 as yr}from"./index-BamsQCM-.js";import{T as X,ai as $o,D as $e,al as Ao,a6 as qo,aa as wr,ac as At,H as W,P as qt,aZ as Nt,ab as ae,_ as No,a7 as We,F as ct,L as _o}from"./vendor-ux-BagecGKr.js";import{C as at}from"./confirm-CylT1MuR.js";import{u as ze}from"./session-t9gAHtO2.js";import{W as Ct}from"./did-address-BZQ3OHpT.js";import{E as Je}from"./empty-spinner-DYg7efl9.js";import{B as _t}from"./bundle-avatar-RF-josr5.js";import{S as Te}from"./shorten-label-BYntTWDs.js";import{L as Wt}from"./list-header-DELs3iEf.js";import{K as vr,C as ue,A as Ot,D as Wo,a0 as Cr}from"./vendor-utils-DQK0pEML.js";import{C as Oo}from"./click-to-copy-fi9Ffgbr.js";import{t as Rr}from"./question-mark-circle.svg-B4stD6SS.js";import{l as Sr,b as Tr}from"./vendor-hooks-DLNZ8kxG.js";import{u as Me}from"./useSetState-DFuQZPPV.js";import{e as Dr}from"./engine-FgocryKo.js";import"./api-sewNv0AE.js";import{T as Ir,S as Er}from"./vendor-mui-x-BbwECMfi.js";import{D as Yt,C as Qt,P as eo}from"./react-beautiful-dnd.esm-CQcgZoy2.js";import{u as zo,c as Pr,w as Lr,a as $r,b as Ar}from"./wait-connect-B5cBJUbg.js";import{f as xe}from"./index-DBs9Ljax.js";import{c as qr,A as Bo,S as Nr,U as _r,r as Wr}from"./item-PqlihMZp.js";import{D as Or}from"./delete-confirm-CsNBLZ0O.js";import{g as Vo}from"./get-safe-url-DXqaEhFh.js";import{u as Le}from"./index-BWQTJ4kw.js";import{M as zr}from"./index-DdXpn59U.js";import{r as Br}from"./index-CZyIUWF0.js";import"./vendor-arcblock-Gj9ygDGP.js";import"./lottie-web-4koyQiv_.js";import"./raf-schd.esm-CHNehTG3.js";function zt({did:t,projectId:o,title:s,logo:r,describe:l}){const i=`${`${F.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${t}/${o}/logo/upload`}/${r}`,[d,u]=k.useState(!1),x=Oe(p=>p.breakpoints.down("md"));return e.jsxs(a,{sx:{display:"flex",flexDirection:"row",color:d?"primary.main":"grey.900",gap:1},onPointerEnter:()=>u(!0),onPointerLeave:()=>u(!1),children:[e.jsx(Et,{sx:{borderRadius:1},src:i}),e.jsxs(a,{children:[e.jsx(Te,{hiddenTip:!0,maxLength:"24",sx:{fontSize:"14px",fontWeight:"500",color:x?"primary.main":""},children:s||"/"}),e.jsx(Te,{hiddenTip:!0,maxLength:"58",sx:{fontSize:"12px",color:x||d?"primary.main":"grey.700"},children:l||"/"})]})]})}zt.propTypes={projectId:n.string.isRequired,did:n.string.isRequired,title:n.string.isRequired,logo:n.string.isRequired,describe:n.string.isRequired};function Uo({initUrl:t=null}){const o=It(),s=t?.searchParams.get("tenantScope")||"",{t:r,locale:l}=X(),{api:c}=ge(),{api:i}=ze(),[d,u]=k.useState(!0),{blocklet:x}=De(),[p,m]=k.useState(null),[f,b]=k.useState(!1),h=Oe(E=>E.breakpoints.down("xl")),j=Oe(E=>E.breakpoints.down("md")),{componentDid:v=""}=rt(),[g,C]=k.useState(null),D=`publish-${x.meta.did}`,R=$o(D),[y,T]=k.useState({searchText:R.searchText||"",pageSize:R.rowsPerPage||10,page:1}),O=()=>{c.getProjects({input:{did:x.meta.did,componentDid:v,tenantScope:s}}).then(E=>{const I=E?.projects||[];u(!1),C(I)}).catch(E=>{u(!1),W.error(E.message)})},N=()=>{o(`${F.UNOWNED_DID}/create/none/0.0.0`,{replace:!0})},z=E=>{m(E)},K=()=>{u(!1),b(!0)},P=()=>{b(!1),m(null)},L=E=>{W.error(E.message),b(!1),m(null)},w=E=>{if(!E?.deleted){W.error("Delete project failed");return}O(),b(!1),m(null)};k.useEffect(()=>{O()},[]);const S=k.useMemo(()=>{if(!y.searchText)return g;let E=y.searchText?.trim();return E?(E=pr.toAddress(E).toLocaleLowerCase(),g.filter(I=>I.blockletTitle.toLowerCase().includes(E)||I.blockletDid.toLowerCase().includes(E))):g},[g,y.searchText]);if(!g&&d)return e.jsx(a,{sx:{display:"flex",justifyContent:"center",alignItems:"center",marginTop:"40px"},children:e.jsx(Je,{})});if(!g)return null;if(!g.length)return e.jsxs(a,{sx:{display:"flex",flexDirection:"column",alignItems:"center",pt:10},children:[e.jsx(a,{sx:{fontSize:20,fontWeight:"bold",mb:3},children:r("blocklet.publish.blockletEmptyTip")}),e.jsx(a,{sx:{fontSize:14,color:"text.secondary",mb:3},children:r("blocklet.publish.createBlockletTip")}),e.jsx($e,{onClick:N,variant:"contained",children:r("blocklet.publish.createBlocklet")})]});const Y=[{label:"Blocklet",name:"blockletTitle",minWidth:160,options:{customBodyRenderLite:E=>{const I=g[E];return e.jsx(we,{to:`${I.id}`,children:e.jsx(zt,{did:x.meta.did,projectId:I.id,logo:I.blockletLogo,title:I.blockletTitle,describe:I.blockletDescription})})}}},{label:"Version",name:"blockletVersion",options:{searchable:!1,customBodyRender:E=>E?e.jsx(Ao,{type:"success",children:E}):""}},{label:"DID",name:"blockletDid",options:{customBodyRender:E=>E?e.jsx(Ct,{size:14,compact:!0,responsive:!1,did:E}):null}},h||v?null:{label:r("common.createdBy"),name:"createdBy",options:{customBodyRender:E=>E?e.jsx(Ct,{onClick:()=>{o(`${F.WELLKNOWN_SERVICE_PATH_PREFIX}/admin/members?did=${E}`)},style:{cursor:"pointer"},size:14,compact:!0,copyable:!1,showQrcode:!1,responsive:!1,did:E}):null}},h||v?null:{label:r("common.scope"),name:"componentDid",options:{customBodyRender:E=>{const I=(x.children||[]).find(V=>V.meta.did===E);return I?e.jsxs(a,{sx:{display:"flex",alignItems:"center",justifyContent:"flex-start"},children:[e.jsx(_t,{size:14,blocklet:I,ancestors:[x]}),e.jsx(a,{sx:{ml:.5,color:"text.primary",fontSize:14},children:I.meta.title})]},E):""}}},h||s?null:{label:r("blocklet.publish.tenantScope"),name:"tenantScope",options:{customBodyRender:E=>e.jsx(a,{sx:{ml:.5,color:"text.primary",fontSize:14},children:e.jsx(Te,{children:E})})}},{label:r("common.updatedAt"),name:"updatedAt",options:{searchable:!1,customBodyRender:E=>e.jsx(qo,{value:Number(E),locale:l})}},{label:r("common.actions"),name:"actions",options:{searchable:!1,customBodyRenderLite:E=>{const I=g[E];return e.jsxs(a,{sx:{display:"flex"},children:[e.jsx(we,{to:`${I.id}/new-release/none/${I.lastReleaseId}`,children:e.jsx(ke,{title:r("blocklet.publish.createRelease"),placement:"top",children:e.jsx(ce,{color:"primary","aria-label":"create",children:e.jsx(Ns,{style:{fontSize:18}})})})}),!!I.lastReleaseId&&e.jsx(ke,{title:r("blocklet.publish.viewLastRelease",{name:I.blockletTitle}),placement:"top",children:e.jsx(ce,{color:"secondary","aria-label":"create",children:e.jsx(we,{style:{display:"flex"},to:`${I.id}/view/${I.lastReleaseId}/${I.blockletVersion}`,children:e.jsx(_s,{sx:{fontSize:18}})})})}),e.jsx(ke,{title:r("blocklet.publish.delete",{name:I.blockletTitle}),placement:"top",children:e.jsx(ce,{color:"primary","aria-label":"delete",onClick:()=>z(I),children:e.jsx(xo,{sx:{fontSize:18}})})})]})}}}].filter(Boolean),H=({page:E,rowsPerPage:I,searchText:V})=>{y.pageSize!==I?T(U=>({...U,searchText:"",pageSize:I,page:1})):y.page!==E+1?T(U=>({...U,searchText:"",page:E+1})):y.searchText!==V&&T(U=>({...U,searchText:V,page:1}))},Q=f?e.jsx(hr,{open:!0,popup:!0,onClose:P,action:"check-has-project-id",locale:l,checkFn:i.get,saveConnect:!1,forceConnected:!1,checkTimeout:5*60*1e3,onSuccess:w,onError:L,extraParams:{projectId:p.id,did:x.meta.did,name:p.blockletTitle},messages:{title:r("blocklet.publish.deleteProject.title",{name:p.blockletTitle}),scan:r("blocklet.publish.deleteProject.scan",{name:p.blockletTitle}),confirm:r("blocklet.publish.deleteProject.confirm"),success:r("blocklet.publish.deleteProject.success")}}):null;return e.jsxs(Vr,{children:[e.jsx(Wt,{sx:{mb:2},left:e.jsxs(a,{sx:{display:"flex",flexDirection:"row",alignItems:"center"},children:[e.jsx(a,{sx:{fontSize:"1.2rem",fontWeight:"bold"},children:r("common.blockletStudio")}),e.jsx(ke,{title:r("blocklet.publish.createBlockletTip"),arrow:!0,placement:"right",children:e.jsx(Ws,{sx:{opacity:.6,fontSize:"1.1em",ml:1}})})]}),actions:e.jsxs(e.Fragment,{children:[e.jsx(wr,{options:{searchPlaceholder:r("blocklet.list.searchPlaceholder"),searchDebounceTime:600,searchAlwaysOpen:j},search:y.searchText,searchText:y.searchText,searchTextUpdate:E=>T(I=>({...I,searchText:E})),searchClose:()=>T(E=>({...E,searchText:""})),onSearchOpen:()=>{}}),e.jsxs($e,{onClick:N,variant:"contained",children:[e.jsx(nt,{style:{fontSize:"1.3em",marginRight:4}}),r("blocklet.publish.createBlocklet")]})]})}),e.jsx(At,{className:"main-table",locale:l,data:S,columns:Y,options:{search:!1,sort:!1,download:!1,filter:!1,print:!1,viewColumns:!1,searchAlwaysOpen:!0,rowsPerPageOptions:[10,20,50,100]},durable:D,onChange:H}),p&&e.jsx(at,{title:`${r("common.delete")} ${p.blockletTitle}`,description:r("blocklet.publish.deleteProject.description"),confirm:r("common.confirm"),onConfirm:K,onCancel:()=>m(null),children:e.jsx(a,{sx:{marginTop:2},children:[r("blocklet.publish.deleteProject.tip1"),r("blocklet.publish.deleteProject.tip2"),r("blocklet.publish.deleteProject.tip3")].map(E=>e.jsxs(a,{sx:{display:"flex",marginTop:1,flexDirection:"row",alignItems:"flex-start"},children:[e.jsx(Os,{color:"warning",sx:{marginRight:1,fontSize:20,marginTop:"2px"}}),e.jsx(A,{component:"span",variant:"inherit",sx:{color:"text.secondary"},children:E})]}))})}),Q]})}const Vr=go(a)`
|
|
3
3
|
${({theme:t})=>t.breakpoints.down("md")} {
|
|
4
4
|
.MuiTableRow-root {
|
|
5
5
|
border-color: ${({theme:t})=>t.palette.divider};
|
|
@@ -142,7 +142,7 @@ import{r as k,i as It,j as rt,L as we,g as fo,k as As,l as qs,m as bt}from"./ven
|
|
|
142
142
|
background: #fff;
|
|
143
143
|
z-index: 10;
|
|
144
144
|
}
|
|
145
|
-
`,io="lastWantToConnectStoreId";function rn(t){const[o,s]=k.useState(null),{session:r}=ze(),l=k.useCallback(d=>{s(d),localStorage.setItem(io,d?.id)},[s]),c=k.useMemo(()=>{const d=localStorage.getItem(io),u=d?(t?.settings?.storeList||[]).find(p=>p.id===d):null;if(u)return u;let x=(t?.settings?.storeList||[]).find(p=>!(p.id!==F.BLOCKLET_STORE.id||p.scope&&p.scope!=="studio"&&p.scope!==r?.user?.did));return x||(x=t?.settings?.storeList?.[0]),x},[t?.settings?.storeList,r?.user?.did]);return[o||c||{},l]}const Bt=({fromBlocklet:t,nodeInfo:o,blocklet:s,userDid:r})=>{const l=t?s?.meta?.did:o?.did;let c=t?s?.settings?.storeList||[]:o?.blockletRegistryList||[];return Array.isArray(c)||(c=[]),c=c.filter(i=>i.protected||Cr(i.scope)||i.scope==="studio"||i.scope===r),{teamDid:l,storeList:c}};function es({blocklet:t=null,store:o=null,onChangeStore:s,onClick:r,disabled:l,loading:c,componentDid:i}){const{t:d}=X(),{session:u}=ze(),{api:x,info:p,inService:m}=ge(),f=De(),[b,h]=k.useState(!1),j=k.useRef(null),[v,g]=k.useState(!1),[C,D]=k.useState(null),R=L=>{s(L),h(!1)},y=()=>{h(!b)},T=L=>{j.current&&j.current.contains(L.target)||h(!1)},O=()=>{g(!0)},N=()=>{g(!1)},z=async()=>{if(C)try{await x.deleteBlockletStore({input:{teamDid:t.meta.did,url:C.url,projectId:"",scope:C.scope||"studio"}}),await f?.actions?.refreshBlocklet()}catch(L){W.error(`Remove Blocklet Store Error: ${xe(L)}`)}finally{D(null)}},{storeList:K}=Bt({fromBlocklet:m,blocklet:t,nodeInfo:p,userDid:u?.user?.did}),P=t?.meta?.did;return e.jsxs(e.Fragment,{children:[e.jsxs(et,{disabled:l,ref:j,variant:"contained",color:"primary","aria-label":"Button group with connect store",children:[e.jsxs(G,{onClick:r,children:[c&&e.jsx(Se,{size:14,sx:{mr:.5}}),`${d("common.connect")} ${o.name||""}`]}),e.jsx(G,{size:"small","aria-controls":b?"split-button-menu":void 0,"aria-expanded":b?"true":void 0,"aria-label":"select merge strategy","aria-haspopup":"menu",onClick:y,children:e.jsx(Js,{})})]}),e.jsx(jo,{sx:{zIndex:10},open:b,anchorEl:j.current,placement:"bottom-end",role:void 0,transition:!0,disablePortal:!0,children:({TransitionProps:L})=>e.jsx(yo,{...L,style:{transformOrigin:"center top"},children:e.jsx(Lt,{children:e.jsx(wo,{onClickAway:T,children:e.jsxs(vo,{id:"split-button-menu",autoFocusItem:!0,sx:{maxHeight:300,overflowY:"auto",zIndex:10},children:[K?.map(w=>e.jsxs(be,{selected:w.id===o?.id,sx:{height:56},onClick:()=>R(w),children:[e.jsxs(a,{children:[e.jsx(Te,{sx:{fontSize:"16px"},maxLength:24,children:w.name}),e.jsx(Te,{sx:{fontSize:"13px",opacity:.6},maxLength:30,children:w.url})]}),qr({store:w,userDid:u?.user?.did})&&e.jsx(ce,{sx:{ml:1},onClick:S=>{S.preventDefault(),S.stopPropagation(),D(w)},children:e.jsx(ae,{icon:"ic:outline-delete"})})]},w.url)),e.jsx(Xs,{}),e.jsxs(be,{onClick:O,children:[e.jsx(nt,{font:!0}),e.jsx(A,{variant:"inherit",children:d("store.blockletRegistry.addRegistry")})]})]})})})})}),v&&e.jsx(Bo,{hiddenChildren:!0,open:!0,onClose:N,teamDid:P,storeList:K,scope:"studio",onAdd:f?.actions?.refreshBlocklet}),C&&e.jsx(at,{displayError:!0,title:`${d("common.delete")} ${C.name}`,description:d("blocklet.publish.deleteStoreTip",{name:C.name}),confirm:d("common.confirm"),onConfirm:z,onCancel:()=>D(null)})]})}es.propTypes={store:n.object,blocklet:n.object,onChangeStore:n.func.isRequired,onClick:n.func.isRequired,loading:n.bool.isRequired,disabled:n.bool.isRequired,componentDid:n.string.isRequired,projectType:n.string.isRequired,getData:n.func.isRequired};const ts=(t,o,s)=>{const r=`${F.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${o.meta.did}/${s}/logo/upload`,l=`${F.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${o.meta.did}/${s}/screenshot/upload`,c=t?.blockletLogo?`${r}/${t.blockletLogo}`:`${F.WELLKNOWN_SERVICE_PATH_PREFIX}/static/images/logo.png`,i=(t?.blockletScreenshots||[]).filter(Boolean).map(d=>`${l}/${d}`);return{logoUrl:c,screenshotUrls:i,uploadLogoPrefix:r,uploadScreenshotPrefix:l}},nn=t=>{const o=t.includes("youtube.com")||t.includes("youtu.be"),s=t.includes("vimeo.com");return o||s};function Vt({url:t,style:o={},controls:s=1,modestbranding:r=1}){const{t:l}=X(),c=t.includes("youtube.com")||t.includes("youtu.be"),i=t.includes("vimeo.com");if(c){const d=t.split("v=")[1]?.split("&")[0]||t.split("/").pop();return e.jsx("div",{style:{position:"relative",width:"100%",paddingTop:"56.25%",pointerEvents:o?.pointerEvents||"auto"},children:e.jsx("iframe",{src:`https://www.youtube.com/embed/${d}?modestbranding=${r}&controls=${s}&rel=0`,title:"YouTube video player",style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",border:"none",...o},allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0})})}if(i){const d=t.split("/").pop();return e.jsx("div",{style:{position:"relative",width:"100%",paddingTop:"56.25%",pointerEvents:o.pointerEvents||"auto"},children:e.jsx("iframe",{src:`https://player.vimeo.com/video/${d}`,title:"Vimeo video player",style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",border:"none",...o},allow:"autoplay; fullscreen; picture-in-picture",allowFullScreen:!0})})}return e.jsx(a,{style:{position:"relative",width:"100%",paddingTop:"56.25%"},children:e.jsxs(a,{style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",border:"none",backgroundColor:"rgba(0, 0, 0, 0.04)",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",...o},allow:"autoplay; fullscreen; picture-in-picture",allowFullScreen:!0,children:[e.jsx(ae,{icon:"carbon:video-off",style:{fontSize:40,marginBottom:"10px",opacity:.5}}),e.jsx(A,{variant:"body1",sx:{opacity:.5},children:l("studio.videoDialogNoSrc")})]})})}Vt.propTypes={url:n.string.isRequired,style:n.object,controls:n.number,modestbranding:n.number};function os({setParams:t,onClose:o,params:s}){const{t:r}=X(),[l,c]=k.useState(""),i=l&&s.blockletVideos.includes(l),d=nn(l),u=()=>{t(x=>{const p=[...x.blockletVideos];return p.push(l),{...x,blockletVideos:p}}),o()};return e.jsxs(lt,{open:!0,fullWidth:!0,maxWidth:"sm",children:[e.jsx(Co,{children:r("studio.videoDialogTitle")}),e.jsxs(Ro,{children:[e.jsx(Gs,{fullWidth:!0,value:l,onChange:x=>c(x.target.value),placeholder:r("studio.videoInputLabel"),endAdornment:l?e.jsx(He,{position:"end",children:e.jsx(ce,{onClick:()=>c(""),children:e.jsx(Ks,{})})}):null,error:i}),i&&e.jsx(A,{variant:"body2",color:"error",children:r("studio.duplicateVideo")}),e.jsx(Vt,{url:l,style:{marginTop:"20px",borderRadius:"4px"}})]}),e.jsxs(So,{children:[e.jsx(G,{onClick:()=>o(),children:r("studio.cancel")}),e.jsx(G,{disabled:!d||i,onClick:u,children:r("studio.confirm")})]})]})}os.propTypes={onClose:n.func.isRequired,params:n.object.isRequired,setParams:n.func.isRequired};function Rt({errors:t,storeList:o,...s}){const{t:r}=X();return e.jsxs(a,{...s,sx:[{color:"warning.main",fontSize:"14px",border:"1px solid rgba(214, 164, 64, 0.34)",borderRadius:"4px",py:2,px:1.5,position:"relative"},...Array.isArray(s.sx)?s.sx:[s.sx]],children:[e.jsx(A,{variant:"caption",sx:{fontWeight:"bold",position:"absolute",top:-10,left:12,backgroundColor:"white",px:1,width:"fit-content"},children:r("blocklet.publish.storeRule.warning")}),t&&Object.entries(t).map(([l,c])=>{const i=Object.values(c),d=o.find(u=>u.url===l);return i.length>0&&e.jsxs(a,{children:[e.jsx(ke,{title:l,children:e.jsx(a,{component:"span",sx:{cursor:"pointer"},children:d.name})}),i.map(u=>e.jsx(a,{component:"li",sx:{ml:2,wordBreak:!0},children:u},u))]},l)})]})}Rt.propTypes={errors:n.object.isRequired,storeList:n.array.isRequired};const co=k.lazy(()=>No(()=>import("./index-D6ay4OGg.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13])).then(t=>({default:t.Uploader})));function ss({projectId:t,readOnly:o,loading:s,blocklet:r,params:l,setParams:c,paramsErrTip:i,setParamsErrTip:d,warning:u,setLoading:x,initUrl:p=null,initLogoUrl:m,setInitLogoUrl:f,componentDid:b=""}){const{t:h,locale:j}=X(),{api:v}=ge(),g=It(),C=k.useRef(null),D=k.useRef(null),[R,y]=rn(r),[T,O]=k.useState(!1),N=zo({messageType:"connect-store-message",onOpen:()=>x(!0),onClose:()=>x(!1)}),z=async q=>{const Z=setTimeout(()=>{x(!1)},2e4),J=await Lr(v,q);x(!1),clearTimeout(Z),window.parent.postMessage({event:"studioDialog.connected",componentDid:b},"*"),g(window.location.pathname.replace(`${F.UNOWNED_DID}/create`,`${J}/create`),{replace:!0})},K=()=>{if(!l.blockletTitle){W.error(h("blocklet.publish.errorTip.noTitle"));return}if(!R?.url){W.error(h("blocklet.publish.noStoreSelected"));return}const q=Pr();N(async(Z,J)=>{try{const se=await v.connectByStudio({input:{did:r?.meta?.did,blockletTitle:l?.blockletTitle,storeUrl:R.url,storeId:R.id,storeName:R.name,type:l?.blockletComponents?.length>0?"pack":"resource",componentDid:b,messageId:q,tenantScope:p?.searchParams.get("tenantScope")||""}});if(!se?.url){W.error("failed to connect to store");return}J(se.url),z({did:r?.meta?.did,projectId:"",messageId:q})}catch(se){const de=xe(se);W.error(de),x(!1)}})},{logoUrl:P,screenshotUrls:L,uploadLogoPrefix:w,uploadScreenshotPrefix:S}=ts(l,r,t),{logoErrors:Y,screenshotErrors:H,storeList:Q,hasLogoWarning:E,hasScreenshotWarning:I}=u,V=()=>o?!1:!t||t===F.UNOWNED_DID?(W.error(h("blocklet.publish.errorTip.noFirstDid")),!1):!0,U=q=>{if(!q.destination)return;const Z=Array.from(l.blockletScreenshots),[J]=Z.splice(q.source.index,1);Z.splice(q.destination.index,0,J),c(se=>({...se,blockletScreenshots:Z}))},ee=q=>{if(!q.destination)return;const Z=Array.from(l.blockletVideos),[J]=Z.splice(q.source.index,1);Z.splice(q.destination.index,0,J),c(se=>({...se,blockletVideos:Z}))};return e.jsxs(ln,{children:[e.jsx(a,{className:"section",sx:{display:"flex"},children:e.jsxs(a,{sx:{flex:1},children:[e.jsx(ne,{disabled:s||o,label:`Blocklet ${h("common.title")}`,placeholder:`Blocklet ${h("common.title")}`,autoComplete:"off",variant:"outlined",fullWidth:!0,required:!0,value:l.blockletTitle||"",onChange:q=>{d({blockletTitle:""}),c({blockletTitle:q.target.value})},error:!!i.blockletTitle,helperText:i.blockletTitle||"",slotProps:{input:{"data-cy":"blocklet-title",readOnly:o}}}),e.jsx(ne,{required:!0,label:"Blocklet DID",fullWidth:!0,readonly:!0,disabled:!0,autoComplete:"off",variant:"outlined",error:!!i.projectId,helperText:i.projectId||"",value:t===F.UNOWNED_DID?"":`did:abt:${t}`,sx:{mt:3},slotProps:{input:{"data-cy":"export-blocklet-did",endAdornment:t===F.UNOWNED_DID&&e.jsx(He,{position:"end",children:e.jsx(es,{blocklet:r,store:R,componentDid:b,onChangeStore:y,disabled:!l.blockletTitle||o||s,loading:s,onClick:K})})}}}),e.jsx(ne,{disabled:s||o,label:`Blocklet ${h("common.description")}`,placeholder:`Blocklet ${h("common.description")}`,required:!0,autoComplete:"off",variant:"outlined",fullWidth:!0,value:l.blockletDescription||"",onChange:q=>{d({blockletDescription:""}),c({blockletDescription:q.target.value.slice(0,159)})},error:!!i.blockletDescription,helperText:i.blockletDescription||"",sx:{mt:3},slotProps:{input:{"data-cy":"blocklet-description",readOnly:o}}}),e.jsx(ne,{disabled:s||o,label:`Blocklet ${h("common.homepageTip")}`,placeholder:`Blocklet ${h("common.homepageTip")}`,autoComplete:"off",variant:"outlined",fullWidth:!0,value:l.blockletHomepage||"",onChange:q=>{q.target.value&&!/^(http|https):\/\//.test(q.target.value)?d({blockletHomepage:h("blocklet.publish.errorTip.invalidUrl")}):d({blockletHomepage:""}),c({blockletHomepage:q.target.value})},error:!!i.blockletHomepage,helperText:i.blockletHomepage||"",sx:{mt:3},slotProps:{input:{"data-cy":"blocklet-homepage",readOnly:o}}}),e.jsx(ne,{disabled:s||o,label:`Blocklet ${h("common.community")}`,placeholder:`Blocklet ${h("common.community")}`,autoComplete:"off",variant:"outlined",fullWidth:!0,value:l.blockletCommunity||"",onChange:q=>{q.target.value&&!/^(http|https):\/\//.test(q.target.value)?d({blockletCommunity:h("blocklet.publish.errorTip.invalidUrl")}):d({blockletCommunity:""}),c({blockletCommunity:q.target.value})},error:!!i.blockletCommunity,helperText:i.blockletCommunity||"",sx:{mt:3},slotProps:{input:{"data-cy":"blocklet-community",readOnly:o}}}),e.jsx(ne,{disabled:s||o,label:`Blocklet ${h("common.support")}`,placeholder:`Blocklet ${h("common.support")}`,autoComplete:"off",variant:"outlined",fullWidth:!0,value:l.blockletSupport||"",onChange:q=>{q.target.value&&!/^(http|https):\/\//.test(q.target.value)&&!/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/.test(q.target.value)?d({blockletSupport:h("blocklet.publish.errorTip.invalidUrlOrEmail")}):d({blockletSupport:""}),c({blockletSupport:q.target.value})},error:!!i.blockletSupport,helperText:i.blockletSupport||"",sx:{mt:3},slotProps:{input:{"data-cy":"blocklet-support",readOnly:o}}}),e.jsx(ne,{disabled:s||o,label:`Blocklet ${h("common.repository")}`,placeholder:`Blocklet ${h("common.repository")}`,autoComplete:"off",variant:"outlined",fullWidth:!0,value:l.blockletRepository||"",onChange:q=>{q.target.value&&!/^(git|https|svn)/.test(q.target.value)?d({blockletRepository:h("blocklet.publish.errorTip.invalidUrl")}):d({blockletRepository:""}),c({blockletRepository:q.target.value})},error:!!i.blockletRepository,helperText:i.blockletRepository||"",sx:{mt:3},slotProps:{input:{"data-cy":"blocklet-repository",readOnly:o}}})]})}),e.jsx(a,{className:"section full-width",sx:{display:"flex",mt:3},children:e.jsxs(a,{sx:{flex:1,overflow:"hidden"},children:[e.jsxs(a,{sx:{display:"flex",flexDirection:"row",flexWrap:"wrap"},children:[e.jsxs(Re,{direction:"column",spacing:1,sx:{mr:2,width:"160px"},children:[e.jsx(A,{variant:"subtitle1",sx:{fontWeight:"bold"},children:h("common.logo")}),e.jsxs(Re,{direction:"column",spacing:1,sx:{alignItems:"flex-start",opacity:.8,fontSize:"12px"},children:[e.jsx(a,{children:e.jsxs(a,{component:"span",children:[e.jsxs(a,{component:"span",sx:{color:"text.secondary"},children:[h("studio.type"),":"," "]}),e.jsx(a,{component:"span",sx:{color:"secondary.main"},children:"png, jpg, webp, svg"})]})}),e.jsx(a,{children:e.jsxs(a,{component:"span",children:[e.jsxs(a,{component:"span",sx:{color:"text.secondary"},children:[h("studio.ratio"),":"," "]}),e.jsx(a,{component:"span",sx:{color:"secondary.main"},children:"256x256"})]})}),e.jsx(a,{children:e.jsxs(a,{component:"span",children:[e.jsxs(a,{component:"span",sx:{color:"text.secondary"},children:[h("studio.size"),":"," "]}),e.jsx(a,{component:"span",sx:{color:"secondary.main"},children:"<500Kb"})]})})]})]}),e.jsx(a,{sx:{flex:1,cursor:o?"default":"pointer",display:"flex",alignItems:"flex-end"},children:e.jsx(Et,{variant:"square",sx:{width:80,height:80},alt:"Blocklet Logo",src:m||P,onClick:()=>{V()&&C.current?.open()}})})]}),E&&e.jsx(Rt,{errors:Y,storeList:Q,mt:3}),e.jsxs(a,{sx:{display:"flex",mt:3,flexDirection:"row",flexWrap:"wrap"},children:[e.jsxs(Re,{direction:"column",spacing:1,sx:{mr:2,width:"160px"},children:[e.jsx(A,{variant:"subtitle1",sx:{fontWeight:"bold"},children:h("common.screenshot")}),e.jsxs(Re,{direction:"column",spacing:1,sx:{alignItems:"flex-start",opacity:.8,fontSize:"12px"},children:[e.jsx(a,{sx:{border:"none"},variant:"outlined",size:"small",children:e.jsxs(a,{component:"span",children:[e.jsxs(a,{component:"span",sx:{color:"text.secondary"},children:[h("studio.ratio"),":"," "]}),e.jsx(a,{component:"span",sx:{color:"secondary.main"},children:"16 / 9"})]})}),e.jsx(a,{children:e.jsxs(a,{component:"span",children:[e.jsxs(a,{component:"span",sx:{color:"text.secondary"},children:[h("studio.count"),":"," "]}),e.jsx(a,{component:"span",sx:{color:"secondary.main"},children:"1~5"})]})}),e.jsx(a,{children:e.jsxs(a,{component:"span",children:[e.jsxs(a,{component:"span",sx:{color:"text.secondary"},children:[h("studio.size"),":"," "]}),e.jsx(a,{component:"span",sx:{color:"secondary.main"},children:"<5MB"})]})}),!o&&e.jsx(a,{children:e.jsxs(a,{component:"span",children:[e.jsxs(a,{component:"span",sx:{color:"text.secondary"},children:[h("studio.order"),":"," "]}),e.jsx(a,{component:"span",sx:{color:"secondary.main"},children:h("studio.orderTip")})]})})]})]}),e.jsx(Yt,{onDragEnd:o?void 0:U,children:e.jsx(Qt,{droppableId:"screenshots",direction:"horizontal",isDropDisabled:o,children:(q,Z)=>e.jsxs(a,{ref:q.innerRef,...q.droppableProps,sx:{display:"flex",alignItems:"center",flex:1,flexWrap:"wrap",minHeight:160,background:Z.isDraggingOver?"grey.100":"transparent",transition:"background-color 0.2s ease",border:Z.isDraggingOver?"2px dashed #999":"none",borderRadius:"4px"},children:[L.map((J,se)=>e.jsx(eo,{draggableId:J,index:se,isDragDisabled:o,children:(de,le)=>e.jsxs(a,{ref:de.innerRef,...de.draggableProps,className:"screenshot",sx:{transform:le.isDragging?"scale(1.05)":"none",boxShadow:le.isDragging?"0 5px 10px rgba(0,0,0,0.15)":"none",transition:"transform 0.2s ease, box-shadow 0.2s ease"},children:[e.jsx("img",{alt:"screenshot",src:J}),!o&&e.jsx(ce,{...de.dragHandleProps,className:"action",style:{right:40,zIndex:10,color:"#fff"},children:e.jsx(Xt,{})}),!o&&e.jsx(ce,{className:"action",onClick:()=>{c(pe=>{const he=[...pe.blockletScreenshots];return he.splice(se,1),{...pe,blockletScreenshots:he}})},children:e.jsx(tt,{})})]})},J)),q.placeholder,L.length<5&&e.jsx(a,{onClick:()=>{V()&&D.current?.open()},sx:{display:"flex",justifyContent:"center",alignItems:"center",fontSize:40,width:240,height:135,background:"#eee",cursor:o?"default":"pointer",color:"#999",mb:2},children:"+"})]})})})]}),I&&e.jsx(Rt,{errors:H,storeList:Q}),e.jsxs(a,{sx:{display:"flex",mt:3,flexDirection:"row",flexWrap:"wrap"},children:[e.jsxs(Re,{direction:"column",spacing:1,sx:{mr:2,width:"160px"},children:[e.jsx(A,{variant:"subtitle1",sx:{fontWeight:"bold"},children:h("studio.video")}),e.jsxs(Re,{direction:"column",spacing:1,sx:{alignItems:"flex-start",opacity:.8,fontSize:"12px"},children:[e.jsx(a,{children:e.jsxs(a,{component:"span",children:[e.jsxs(a,{component:"span",sx:{color:"text.secondary"},children:[h("studio.videoType"),":"," "]}),e.jsxs(a,{component:"span",sx:{color:"secondary.main"},children:[e.jsx("a",{href:"https://www.youtube.com/",target:"_blank",rel:"noreferrer",children:"Youtube"}),","," ",e.jsx("a",{href:"https://vimeo.com/",target:"_blank",rel:"noreferrer",children:"Vimeo"})]})]})}),e.jsx(a,{children:e.jsxs(a,{component:"span",children:[e.jsxs(a,{component:"span",sx:{color:"text.secondary"},children:[h("studio.count"),":"," "]}),e.jsx(a,{component:"span",sx:{color:"secondary.main"},children:"1~3"})]})}),!o&&e.jsx(a,{children:e.jsxs(a,{component:"span",children:[e.jsxs(a,{component:"span",sx:{color:"text.secondary"},children:[h("studio.order"),":"," "]}),e.jsx(a,{component:"span",sx:{color:"secondary.main"},children:h("studio.orderTip")})]})})]})]}),e.jsx(Yt,{onDragEnd:o?void 0:ee,children:e.jsx(Qt,{droppableId:"videos",direction:"horizontal",isDropDisabled:o,children:(q,Z)=>e.jsxs(a,{ref:q.innerRef,...q.droppableProps,sx:{display:"flex",alignItems:"center",flex:1,flexWrap:"wrap",minHeight:160,background:Z.isDraggingOver?"#f5f5f5":"transparent",transition:"background-color 0.2s ease",border:Z.isDraggingOver?"2px dashed #999":"none",borderRadius:"4px"},children:[l.blockletVideos.map((J,se)=>e.jsx(eo,{draggableId:J,index:se,isDragDisabled:o,children:(de,le)=>e.jsxs(a,{ref:de.innerRef,...de.draggableProps,className:"screenshot",sx:{transform:le.isDragging?"scale(1.05)":"none",boxShadow:le.isDragging?"0 5px 10px rgba(0,0,0,0.15)":"none",transition:"transform 0.2s ease, box-shadow 0.2s ease"},children:[e.jsx(Vt,{url:J,style:{pointerEvents:le.isDragging?"none":"auto"}}),!o&&e.jsx(ce,{...de.dragHandleProps,className:"action",style:{right:40,zIndex:10,color:"#fff"},children:e.jsx(Xt,{})}),!o&&e.jsx(ce,{className:"action",onClick:()=>{c(pe=>{const he=[...pe.blockletVideos];return he.splice(se,1),{...pe,blockletVideos:he}})},children:e.jsx(tt,{})})]})},J)),q.placeholder,l.blockletVideos.length<3&&e.jsx(a,{onClick:()=>{V()&&O(!0)},sx:{display:"flex",justifyContent:"center",alignItems:"center",fontSize:40,width:240,height:135,background:"#eee",cursor:o?"default":"pointer",color:"#999",mb:2},children:"+"})]})})})]})]})}),e.jsxs(k.Suspense,{fallback:e.jsx(Je,{}),children:[e.jsx(co,{ref:C,locale:j,popup:!0,onUploadFinish:q=>{c({blockletLogo:q.data.filename}),f(""),C.current?.close()},plugins:["ImageEditor"],installerProps:{disabled:!0},apiPathProps:{uploader:w,disableMediaKitPrefix:!0,disableMediaKitStatus:!0},coreProps:{restrictions:{allowedFileTypes:["image/png","image/jpeg","image/webp","image/svg+xml"],maxFileSize:1024*1024*.5,maxNumberOfFiles:1}},dashboardProps:{autoOpen:"imageEditor"},imageEditorProps:{actions:{revert:!0,rotate:!0,granularRotate:!0,flip:!0,zoomIn:!0,zoomOut:!0,cropSquare:!1,cropWidescreen:!1,cropWidescreenVertical:!1},cropperOptions:{autoCrop:!0,aspectRatio:1,initialAspectRatio:1,autoCropArea:1,croppedCanvasOptions:{minWidth:256,minHeight:256}}}},"uploader-logo"),T&&e.jsx(os,{onClose:()=>O(!1),params:l,setParams:c}),e.jsx(co,{ref:D,locale:j,popup:!0,onUploadFinish:q=>{c(Z=>{const J=Z.blockletScreenshots||[];return J.push(q.data?.filename),{...Z,blockletScreenshots:J}}),D.current?.close()},installerProps:{disabled:!0},plugins:["ImageEditor"],apiPathProps:{uploader:S,disableMediaKitPrefix:!0,disableMediaKitStatus:!0},coreProps:{restrictions:{allowedFileTypes:["image/*","image/svg+xml"],maxFileSize:1024*1024*5,maxNumberOfFiles:5-L.length}},imageEditorProps:{actions:{revert:!0,rotate:!0,granularRotate:!0,flip:!0,zoomIn:!0,zoomOut:!0,cropSquare:!1,cropWidescreen:!1,cropWidescreenVertical:!1},cropperOptions:{autoCrop:!0,autoCropArea:1,aspectRatio:16/9,initialAspectRatio:16/9,croppedCanvasOptions:{minWidth:1280,minHeight:720,maxWidth:1280*2,maxHeight:720*2}}}},"uploader-screenshot")]})]})}ss.propTypes={projectId:n.string.isRequired,readOnly:n.bool.isRequired,params:n.object.isRequired,setParams:n.func.isRequired,paramsErrTip:n.object.isRequired,setParamsErrTip:n.func.isRequired,warning:n.object.isRequired,loading:n.bool.isRequired,blocklet:n.object.isRequired,setLoading:n.func.isRequired,initUrl:n.object,componentDid:n.string,initLogoUrl:n.string.isRequired,setInitLogoUrl:n.func.isRequired};const ln=ve.div`
|
|
145
|
+
`,io="lastWantToConnectStoreId";function rn(t){const[o,s]=k.useState(null),{session:r}=ze(),l=k.useCallback(d=>{s(d),localStorage.setItem(io,d?.id)},[s]),c=k.useMemo(()=>{const d=localStorage.getItem(io),u=d?(t?.settings?.storeList||[]).find(p=>p.id===d):null;if(u)return u;let x=(t?.settings?.storeList||[]).find(p=>!(p.id!==F.BLOCKLET_STORE.id||p.scope&&p.scope!=="studio"&&p.scope!==r?.user?.did));return x||(x=t?.settings?.storeList?.[0]),x},[t?.settings?.storeList,r?.user?.did]);return[o||c||{},l]}const Bt=({fromBlocklet:t,nodeInfo:o,blocklet:s,userDid:r})=>{const l=t?s?.meta?.did:o?.did;let c=t?s?.settings?.storeList||[]:o?.blockletRegistryList||[];return Array.isArray(c)||(c=[]),c=c.filter(i=>i.protected||Cr(i.scope)||i.scope==="studio"||i.scope===r),{teamDid:l,storeList:c}};function es({blocklet:t=null,store:o=null,onChangeStore:s,onClick:r,disabled:l,loading:c,componentDid:i}){const{t:d}=X(),{session:u}=ze(),{api:x,info:p,inService:m}=ge(),f=De(),[b,h]=k.useState(!1),j=k.useRef(null),[v,g]=k.useState(!1),[C,D]=k.useState(null),R=L=>{s(L),h(!1)},y=()=>{h(!b)},T=L=>{j.current&&j.current.contains(L.target)||h(!1)},O=()=>{g(!0)},N=()=>{g(!1)},z=async()=>{if(C)try{await x.deleteBlockletStore({input:{teamDid:t.meta.did,url:C.url,projectId:"",scope:C.scope||"studio"}}),await f?.actions?.refreshBlocklet()}catch(L){W.error(`Remove Blocklet Store Error: ${xe(L)}`)}finally{D(null)}},{storeList:K}=Bt({fromBlocklet:m,blocklet:t,nodeInfo:p,userDid:u?.user?.did}),P=t?.meta?.did;return e.jsxs(e.Fragment,{children:[e.jsxs(et,{disabled:l,ref:j,variant:"contained",color:"primary","aria-label":"Button group with connect store",children:[e.jsxs(G,{onClick:r,children:[c&&e.jsx(Se,{size:14,sx:{mr:.5}}),`${d("common.connect")} ${o.name||""}`]}),e.jsx(G,{size:"small","aria-controls":b?"split-button-menu":void 0,"aria-expanded":b?"true":void 0,"aria-label":"select merge strategy","aria-haspopup":"menu",onClick:y,children:e.jsx(Js,{})})]}),e.jsx(jo,{sx:{zIndex:10},open:b,anchorEl:j.current,placement:"bottom-end",role:void 0,transition:!0,disablePortal:!0,children:({TransitionProps:L})=>e.jsx(yo,{...L,style:{transformOrigin:"center top"},children:e.jsx(Lt,{children:e.jsx(wo,{onClickAway:T,children:e.jsxs(vo,{id:"split-button-menu",autoFocusItem:!0,sx:{maxHeight:300,overflowY:"auto",zIndex:10},children:[K?.map(w=>e.jsxs(be,{selected:w.id===o?.id,sx:{height:56},onClick:()=>R(w),children:[e.jsxs(a,{children:[e.jsx(Te,{sx:{fontSize:"16px"},maxLength:24,children:w.name}),e.jsx(Te,{sx:{fontSize:"13px",opacity:.6},maxLength:30,children:w.url})]}),qr({store:w,userDid:u?.user?.did})&&e.jsx(ce,{sx:{ml:1},onClick:S=>{S.preventDefault(),S.stopPropagation(),D(w)},children:e.jsx(ae,{icon:"ic:outline-delete"})})]},w.url)),e.jsx(Xs,{}),e.jsxs(be,{onClick:O,children:[e.jsx(nt,{font:!0}),e.jsx(A,{variant:"inherit",children:d("store.blockletRegistry.addRegistry")})]})]})})})})}),v&&e.jsx(Bo,{hiddenChildren:!0,open:!0,onClose:N,teamDid:P,storeList:K,scope:"studio",onAdd:f?.actions?.refreshBlocklet}),C&&e.jsx(at,{displayError:!0,title:`${d("common.delete")} ${C.name}`,description:d("blocklet.publish.deleteStoreTip",{name:C.name}),confirm:d("common.confirm"),onConfirm:z,onCancel:()=>D(null)})]})}es.propTypes={store:n.object,blocklet:n.object,onChangeStore:n.func.isRequired,onClick:n.func.isRequired,loading:n.bool.isRequired,disabled:n.bool.isRequired,componentDid:n.string.isRequired,projectType:n.string.isRequired,getData:n.func.isRequired};const ts=(t,o,s)=>{const r=`${F.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${o.meta.did}/${s}/logo/upload`,l=`${F.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${o.meta.did}/${s}/screenshot/upload`,c=t?.blockletLogo?`${r}/${t.blockletLogo}`:`${F.WELLKNOWN_SERVICE_PATH_PREFIX}/static/images/logo.png`,i=(t?.blockletScreenshots||[]).filter(Boolean).map(d=>`${l}/${d}`);return{logoUrl:c,screenshotUrls:i,uploadLogoPrefix:r,uploadScreenshotPrefix:l}},nn=t=>{const o=t.includes("youtube.com")||t.includes("youtu.be"),s=t.includes("vimeo.com");return o||s};function Vt({url:t,style:o={},controls:s=1,modestbranding:r=1}){const{t:l}=X(),c=t.includes("youtube.com")||t.includes("youtu.be"),i=t.includes("vimeo.com");if(c){const d=t.split("v=")[1]?.split("&")[0]||t.split("/").pop();return e.jsx("div",{style:{position:"relative",width:"100%",paddingTop:"56.25%",pointerEvents:o?.pointerEvents||"auto"},children:e.jsx("iframe",{src:`https://www.youtube.com/embed/${d}?modestbranding=${r}&controls=${s}&rel=0`,title:"YouTube video player",style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",border:"none",...o},allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0})})}if(i){const d=t.split("/").pop();return e.jsx("div",{style:{position:"relative",width:"100%",paddingTop:"56.25%",pointerEvents:o.pointerEvents||"auto"},children:e.jsx("iframe",{src:`https://player.vimeo.com/video/${d}`,title:"Vimeo video player",style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",border:"none",...o},allow:"autoplay; fullscreen; picture-in-picture",allowFullScreen:!0})})}return e.jsx(a,{style:{position:"relative",width:"100%",paddingTop:"56.25%"},children:e.jsxs(a,{style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",border:"none",backgroundColor:"rgba(0, 0, 0, 0.04)",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",...o},allow:"autoplay; fullscreen; picture-in-picture",allowFullScreen:!0,children:[e.jsx(ae,{icon:"carbon:video-off",style:{fontSize:40,marginBottom:"10px",opacity:.5}}),e.jsx(A,{variant:"body1",sx:{opacity:.5},children:l("studio.videoDialogNoSrc")})]})})}Vt.propTypes={url:n.string.isRequired,style:n.object,controls:n.number,modestbranding:n.number};function os({setParams:t,onClose:o,params:s}){const{t:r}=X(),[l,c]=k.useState(""),i=l&&s.blockletVideos.includes(l),d=nn(l),u=()=>{t(x=>{const p=[...x.blockletVideos];return p.push(l),{...x,blockletVideos:p}}),o()};return e.jsxs(lt,{open:!0,fullWidth:!0,maxWidth:"sm",children:[e.jsx(Co,{children:r("studio.videoDialogTitle")}),e.jsxs(Ro,{children:[e.jsx(Gs,{fullWidth:!0,value:l,onChange:x=>c(x.target.value),placeholder:r("studio.videoInputLabel"),endAdornment:l?e.jsx(He,{position:"end",children:e.jsx(ce,{onClick:()=>c(""),children:e.jsx(Ks,{})})}):null,error:i}),i&&e.jsx(A,{variant:"body2",color:"error",children:r("studio.duplicateVideo")}),e.jsx(Vt,{url:l,style:{marginTop:"20px",borderRadius:"4px"}})]}),e.jsxs(So,{children:[e.jsx(G,{onClick:()=>o(),children:r("studio.cancel")}),e.jsx(G,{disabled:!d||i,onClick:u,children:r("studio.confirm")})]})]})}os.propTypes={onClose:n.func.isRequired,params:n.object.isRequired,setParams:n.func.isRequired};function Rt({errors:t,storeList:o,...s}){const{t:r}=X();return e.jsxs(a,{...s,sx:[{color:"warning.main",fontSize:"14px",border:"1px solid rgba(214, 164, 64, 0.34)",borderRadius:"4px",py:2,px:1.5,position:"relative"},...Array.isArray(s.sx)?s.sx:[s.sx]],children:[e.jsx(A,{variant:"caption",sx:{fontWeight:"bold",position:"absolute",top:-10,left:12,backgroundColor:"white",px:1,width:"fit-content"},children:r("blocklet.publish.storeRule.warning")}),t&&Object.entries(t).map(([l,c])=>{const i=Object.values(c),d=o.find(u=>u.url===l);return i.length>0&&e.jsxs(a,{children:[e.jsx(ke,{title:l,children:e.jsx(a,{component:"span",sx:{cursor:"pointer"},children:d.name})}),i.map(u=>e.jsx(a,{component:"li",sx:{ml:2,wordBreak:!0},children:u},u))]},l)})]})}Rt.propTypes={errors:n.object.isRequired,storeList:n.array.isRequired};const co=k.lazy(()=>No(()=>import("./index-DOLfG_0X.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13])).then(t=>({default:t.Uploader})));function ss({projectId:t,readOnly:o,loading:s,blocklet:r,params:l,setParams:c,paramsErrTip:i,setParamsErrTip:d,warning:u,setLoading:x,initUrl:p=null,initLogoUrl:m,setInitLogoUrl:f,componentDid:b=""}){const{t:h,locale:j}=X(),{api:v}=ge(),g=It(),C=k.useRef(null),D=k.useRef(null),[R,y]=rn(r),[T,O]=k.useState(!1),N=zo({messageType:"connect-store-message",onOpen:()=>x(!0),onClose:()=>x(!1)}),z=async q=>{const Z=setTimeout(()=>{x(!1)},2e4),J=await Lr(v,q);x(!1),clearTimeout(Z),window.parent.postMessage({event:"studioDialog.connected",componentDid:b},"*"),g(window.location.pathname.replace(`${F.UNOWNED_DID}/create`,`${J}/create`),{replace:!0})},K=()=>{if(!l.blockletTitle){W.error(h("blocklet.publish.errorTip.noTitle"));return}if(!R?.url){W.error(h("blocklet.publish.noStoreSelected"));return}const q=Pr();N(async(Z,J)=>{try{const se=await v.connectByStudio({input:{did:r?.meta?.did,blockletTitle:l?.blockletTitle,storeUrl:R.url,storeId:R.id,storeName:R.name,type:l?.blockletComponents?.length>0?"pack":"resource",componentDid:b,messageId:q,tenantScope:p?.searchParams.get("tenantScope")||""}});if(!se?.url){W.error("failed to connect to store");return}J(se.url),z({did:r?.meta?.did,projectId:"",messageId:q})}catch(se){const de=xe(se);W.error(de),x(!1)}})},{logoUrl:P,screenshotUrls:L,uploadLogoPrefix:w,uploadScreenshotPrefix:S}=ts(l,r,t),{logoErrors:Y,screenshotErrors:H,storeList:Q,hasLogoWarning:E,hasScreenshotWarning:I}=u,V=()=>o?!1:!t||t===F.UNOWNED_DID?(W.error(h("blocklet.publish.errorTip.noFirstDid")),!1):!0,U=q=>{if(!q.destination)return;const Z=Array.from(l.blockletScreenshots),[J]=Z.splice(q.source.index,1);Z.splice(q.destination.index,0,J),c(se=>({...se,blockletScreenshots:Z}))},ee=q=>{if(!q.destination)return;const Z=Array.from(l.blockletVideos),[J]=Z.splice(q.source.index,1);Z.splice(q.destination.index,0,J),c(se=>({...se,blockletVideos:Z}))};return e.jsxs(ln,{children:[e.jsx(a,{className:"section",sx:{display:"flex"},children:e.jsxs(a,{sx:{flex:1},children:[e.jsx(ne,{disabled:s||o,label:`Blocklet ${h("common.title")}`,placeholder:`Blocklet ${h("common.title")}`,autoComplete:"off",variant:"outlined",fullWidth:!0,required:!0,value:l.blockletTitle||"",onChange:q=>{d({blockletTitle:""}),c({blockletTitle:q.target.value})},error:!!i.blockletTitle,helperText:i.blockletTitle||"",slotProps:{input:{"data-cy":"blocklet-title",readOnly:o}}}),e.jsx(ne,{required:!0,label:"Blocklet DID",fullWidth:!0,readonly:!0,disabled:!0,autoComplete:"off",variant:"outlined",error:!!i.projectId,helperText:i.projectId||"",value:t===F.UNOWNED_DID?"":`did:abt:${t}`,sx:{mt:3},slotProps:{input:{"data-cy":"export-blocklet-did",endAdornment:t===F.UNOWNED_DID&&e.jsx(He,{position:"end",children:e.jsx(es,{blocklet:r,store:R,componentDid:b,onChangeStore:y,disabled:!l.blockletTitle||o||s,loading:s,onClick:K})})}}}),e.jsx(ne,{disabled:s||o,label:`Blocklet ${h("common.description")}`,placeholder:`Blocklet ${h("common.description")}`,required:!0,autoComplete:"off",variant:"outlined",fullWidth:!0,value:l.blockletDescription||"",onChange:q=>{d({blockletDescription:""}),c({blockletDescription:q.target.value.slice(0,159)})},error:!!i.blockletDescription,helperText:i.blockletDescription||"",sx:{mt:3},slotProps:{input:{"data-cy":"blocklet-description",readOnly:o}}}),e.jsx(ne,{disabled:s||o,label:`Blocklet ${h("common.homepageTip")}`,placeholder:`Blocklet ${h("common.homepageTip")}`,autoComplete:"off",variant:"outlined",fullWidth:!0,value:l.blockletHomepage||"",onChange:q=>{q.target.value&&!/^(http|https):\/\//.test(q.target.value)?d({blockletHomepage:h("blocklet.publish.errorTip.invalidUrl")}):d({blockletHomepage:""}),c({blockletHomepage:q.target.value})},error:!!i.blockletHomepage,helperText:i.blockletHomepage||"",sx:{mt:3},slotProps:{input:{"data-cy":"blocklet-homepage",readOnly:o}}}),e.jsx(ne,{disabled:s||o,label:`Blocklet ${h("common.community")}`,placeholder:`Blocklet ${h("common.community")}`,autoComplete:"off",variant:"outlined",fullWidth:!0,value:l.blockletCommunity||"",onChange:q=>{q.target.value&&!/^(http|https):\/\//.test(q.target.value)?d({blockletCommunity:h("blocklet.publish.errorTip.invalidUrl")}):d({blockletCommunity:""}),c({blockletCommunity:q.target.value})},error:!!i.blockletCommunity,helperText:i.blockletCommunity||"",sx:{mt:3},slotProps:{input:{"data-cy":"blocklet-community",readOnly:o}}}),e.jsx(ne,{disabled:s||o,label:`Blocklet ${h("common.support")}`,placeholder:`Blocklet ${h("common.support")}`,autoComplete:"off",variant:"outlined",fullWidth:!0,value:l.blockletSupport||"",onChange:q=>{q.target.value&&!/^(http|https):\/\//.test(q.target.value)&&!/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/.test(q.target.value)?d({blockletSupport:h("blocklet.publish.errorTip.invalidUrlOrEmail")}):d({blockletSupport:""}),c({blockletSupport:q.target.value})},error:!!i.blockletSupport,helperText:i.blockletSupport||"",sx:{mt:3},slotProps:{input:{"data-cy":"blocklet-support",readOnly:o}}}),e.jsx(ne,{disabled:s||o,label:`Blocklet ${h("common.repository")}`,placeholder:`Blocklet ${h("common.repository")}`,autoComplete:"off",variant:"outlined",fullWidth:!0,value:l.blockletRepository||"",onChange:q=>{q.target.value&&!/^(git|https|svn)/.test(q.target.value)?d({blockletRepository:h("blocklet.publish.errorTip.invalidUrl")}):d({blockletRepository:""}),c({blockletRepository:q.target.value})},error:!!i.blockletRepository,helperText:i.blockletRepository||"",sx:{mt:3},slotProps:{input:{"data-cy":"blocklet-repository",readOnly:o}}})]})}),e.jsx(a,{className:"section full-width",sx:{display:"flex",mt:3},children:e.jsxs(a,{sx:{flex:1,overflow:"hidden"},children:[e.jsxs(a,{sx:{display:"flex",flexDirection:"row",flexWrap:"wrap"},children:[e.jsxs(Re,{direction:"column",spacing:1,sx:{mr:2,width:"160px"},children:[e.jsx(A,{variant:"subtitle1",sx:{fontWeight:"bold"},children:h("common.logo")}),e.jsxs(Re,{direction:"column",spacing:1,sx:{alignItems:"flex-start",opacity:.8,fontSize:"12px"},children:[e.jsx(a,{children:e.jsxs(a,{component:"span",children:[e.jsxs(a,{component:"span",sx:{color:"text.secondary"},children:[h("studio.type"),":"," "]}),e.jsx(a,{component:"span",sx:{color:"secondary.main"},children:"png, jpg, webp, svg"})]})}),e.jsx(a,{children:e.jsxs(a,{component:"span",children:[e.jsxs(a,{component:"span",sx:{color:"text.secondary"},children:[h("studio.ratio"),":"," "]}),e.jsx(a,{component:"span",sx:{color:"secondary.main"},children:"256x256"})]})}),e.jsx(a,{children:e.jsxs(a,{component:"span",children:[e.jsxs(a,{component:"span",sx:{color:"text.secondary"},children:[h("studio.size"),":"," "]}),e.jsx(a,{component:"span",sx:{color:"secondary.main"},children:"<500Kb"})]})})]})]}),e.jsx(a,{sx:{flex:1,cursor:o?"default":"pointer",display:"flex",alignItems:"flex-end"},children:e.jsx(Et,{variant:"square",sx:{width:80,height:80},alt:"Blocklet Logo",src:m||P,onClick:()=>{V()&&C.current?.open()}})})]}),E&&e.jsx(Rt,{errors:Y,storeList:Q,mt:3}),e.jsxs(a,{sx:{display:"flex",mt:3,flexDirection:"row",flexWrap:"wrap"},children:[e.jsxs(Re,{direction:"column",spacing:1,sx:{mr:2,width:"160px"},children:[e.jsx(A,{variant:"subtitle1",sx:{fontWeight:"bold"},children:h("common.screenshot")}),e.jsxs(Re,{direction:"column",spacing:1,sx:{alignItems:"flex-start",opacity:.8,fontSize:"12px"},children:[e.jsx(a,{sx:{border:"none"},variant:"outlined",size:"small",children:e.jsxs(a,{component:"span",children:[e.jsxs(a,{component:"span",sx:{color:"text.secondary"},children:[h("studio.ratio"),":"," "]}),e.jsx(a,{component:"span",sx:{color:"secondary.main"},children:"16 / 9"})]})}),e.jsx(a,{children:e.jsxs(a,{component:"span",children:[e.jsxs(a,{component:"span",sx:{color:"text.secondary"},children:[h("studio.count"),":"," "]}),e.jsx(a,{component:"span",sx:{color:"secondary.main"},children:"1~5"})]})}),e.jsx(a,{children:e.jsxs(a,{component:"span",children:[e.jsxs(a,{component:"span",sx:{color:"text.secondary"},children:[h("studio.size"),":"," "]}),e.jsx(a,{component:"span",sx:{color:"secondary.main"},children:"<5MB"})]})}),!o&&e.jsx(a,{children:e.jsxs(a,{component:"span",children:[e.jsxs(a,{component:"span",sx:{color:"text.secondary"},children:[h("studio.order"),":"," "]}),e.jsx(a,{component:"span",sx:{color:"secondary.main"},children:h("studio.orderTip")})]})})]})]}),e.jsx(Yt,{onDragEnd:o?void 0:U,children:e.jsx(Qt,{droppableId:"screenshots",direction:"horizontal",isDropDisabled:o,children:(q,Z)=>e.jsxs(a,{ref:q.innerRef,...q.droppableProps,sx:{display:"flex",alignItems:"center",flex:1,flexWrap:"wrap",minHeight:160,background:Z.isDraggingOver?"grey.100":"transparent",transition:"background-color 0.2s ease",border:Z.isDraggingOver?"2px dashed #999":"none",borderRadius:"4px"},children:[L.map((J,se)=>e.jsx(eo,{draggableId:J,index:se,isDragDisabled:o,children:(de,le)=>e.jsxs(a,{ref:de.innerRef,...de.draggableProps,className:"screenshot",sx:{transform:le.isDragging?"scale(1.05)":"none",boxShadow:le.isDragging?"0 5px 10px rgba(0,0,0,0.15)":"none",transition:"transform 0.2s ease, box-shadow 0.2s ease"},children:[e.jsx("img",{alt:"screenshot",src:J}),!o&&e.jsx(ce,{...de.dragHandleProps,className:"action",style:{right:40,zIndex:10,color:"#fff"},children:e.jsx(Xt,{})}),!o&&e.jsx(ce,{className:"action",onClick:()=>{c(pe=>{const he=[...pe.blockletScreenshots];return he.splice(se,1),{...pe,blockletScreenshots:he}})},children:e.jsx(tt,{})})]})},J)),q.placeholder,L.length<5&&e.jsx(a,{onClick:()=>{V()&&D.current?.open()},sx:{display:"flex",justifyContent:"center",alignItems:"center",fontSize:40,width:240,height:135,background:"#eee",cursor:o?"default":"pointer",color:"#999",mb:2},children:"+"})]})})})]}),I&&e.jsx(Rt,{errors:H,storeList:Q}),e.jsxs(a,{sx:{display:"flex",mt:3,flexDirection:"row",flexWrap:"wrap"},children:[e.jsxs(Re,{direction:"column",spacing:1,sx:{mr:2,width:"160px"},children:[e.jsx(A,{variant:"subtitle1",sx:{fontWeight:"bold"},children:h("studio.video")}),e.jsxs(Re,{direction:"column",spacing:1,sx:{alignItems:"flex-start",opacity:.8,fontSize:"12px"},children:[e.jsx(a,{children:e.jsxs(a,{component:"span",children:[e.jsxs(a,{component:"span",sx:{color:"text.secondary"},children:[h("studio.videoType"),":"," "]}),e.jsxs(a,{component:"span",sx:{color:"secondary.main"},children:[e.jsx("a",{href:"https://www.youtube.com/",target:"_blank",rel:"noreferrer",children:"Youtube"}),","," ",e.jsx("a",{href:"https://vimeo.com/",target:"_blank",rel:"noreferrer",children:"Vimeo"})]})]})}),e.jsx(a,{children:e.jsxs(a,{component:"span",children:[e.jsxs(a,{component:"span",sx:{color:"text.secondary"},children:[h("studio.count"),":"," "]}),e.jsx(a,{component:"span",sx:{color:"secondary.main"},children:"1~3"})]})}),!o&&e.jsx(a,{children:e.jsxs(a,{component:"span",children:[e.jsxs(a,{component:"span",sx:{color:"text.secondary"},children:[h("studio.order"),":"," "]}),e.jsx(a,{component:"span",sx:{color:"secondary.main"},children:h("studio.orderTip")})]})})]})]}),e.jsx(Yt,{onDragEnd:o?void 0:ee,children:e.jsx(Qt,{droppableId:"videos",direction:"horizontal",isDropDisabled:o,children:(q,Z)=>e.jsxs(a,{ref:q.innerRef,...q.droppableProps,sx:{display:"flex",alignItems:"center",flex:1,flexWrap:"wrap",minHeight:160,background:Z.isDraggingOver?"#f5f5f5":"transparent",transition:"background-color 0.2s ease",border:Z.isDraggingOver?"2px dashed #999":"none",borderRadius:"4px"},children:[l.blockletVideos.map((J,se)=>e.jsx(eo,{draggableId:J,index:se,isDragDisabled:o,children:(de,le)=>e.jsxs(a,{ref:de.innerRef,...de.draggableProps,className:"screenshot",sx:{transform:le.isDragging?"scale(1.05)":"none",boxShadow:le.isDragging?"0 5px 10px rgba(0,0,0,0.15)":"none",transition:"transform 0.2s ease, box-shadow 0.2s ease"},children:[e.jsx(Vt,{url:J,style:{pointerEvents:le.isDragging?"none":"auto"}}),!o&&e.jsx(ce,{...de.dragHandleProps,className:"action",style:{right:40,zIndex:10,color:"#fff"},children:e.jsx(Xt,{})}),!o&&e.jsx(ce,{className:"action",onClick:()=>{c(pe=>{const he=[...pe.blockletVideos];return he.splice(se,1),{...pe,blockletVideos:he}})},children:e.jsx(tt,{})})]})},J)),q.placeholder,l.blockletVideos.length<3&&e.jsx(a,{onClick:()=>{V()&&O(!0)},sx:{display:"flex",justifyContent:"center",alignItems:"center",fontSize:40,width:240,height:135,background:"#eee",cursor:o?"default":"pointer",color:"#999",mb:2},children:"+"})]})})})]})]})}),e.jsxs(k.Suspense,{fallback:e.jsx(Je,{}),children:[e.jsx(co,{ref:C,locale:j,popup:!0,onUploadFinish:q=>{c({blockletLogo:q.data.filename}),f(""),C.current?.close()},plugins:["ImageEditor"],installerProps:{disabled:!0},apiPathProps:{uploader:w,disableMediaKitPrefix:!0,disableMediaKitStatus:!0},coreProps:{restrictions:{allowedFileTypes:["image/png","image/jpeg","image/webp","image/svg+xml"],maxFileSize:1024*1024*.5,maxNumberOfFiles:1}},dashboardProps:{autoOpen:"imageEditor"},imageEditorProps:{actions:{revert:!0,rotate:!0,granularRotate:!0,flip:!0,zoomIn:!0,zoomOut:!0,cropSquare:!1,cropWidescreen:!1,cropWidescreenVertical:!1},cropperOptions:{autoCrop:!0,aspectRatio:1,initialAspectRatio:1,autoCropArea:1,croppedCanvasOptions:{minWidth:256,minHeight:256}}}},"uploader-logo"),T&&e.jsx(os,{onClose:()=>O(!1),params:l,setParams:c}),e.jsx(co,{ref:D,locale:j,popup:!0,onUploadFinish:q=>{c(Z=>{const J=Z.blockletScreenshots||[];return J.push(q.data?.filename),{...Z,blockletScreenshots:J}}),D.current?.close()},installerProps:{disabled:!0},plugins:["ImageEditor"],apiPathProps:{uploader:S,disableMediaKitPrefix:!0,disableMediaKitStatus:!0},coreProps:{restrictions:{allowedFileTypes:["image/*","image/svg+xml"],maxFileSize:1024*1024*5,maxNumberOfFiles:5-L.length}},imageEditorProps:{actions:{revert:!0,rotate:!0,granularRotate:!0,flip:!0,zoomIn:!0,zoomOut:!0,cropSquare:!1,cropWidescreen:!1,cropWidescreenVertical:!1},cropperOptions:{autoCrop:!0,autoCropArea:1,aspectRatio:16/9,initialAspectRatio:16/9,croppedCanvasOptions:{minWidth:1280,minHeight:720,maxWidth:1280*2,maxHeight:720*2}}}},"uploader-screenshot")]})]})}ss.propTypes={projectId:n.string.isRequired,readOnly:n.bool.isRequired,params:n.object.isRequired,setParams:n.func.isRequired,paramsErrTip:n.object.isRequired,setParamsErrTip:n.func.isRequired,warning:n.object.isRequired,loading:n.bool.isRequired,blocklet:n.object.isRequired,setLoading:n.func.isRequired,initUrl:n.object,componentDid:n.string,initLogoUrl:n.string.isRequired,setInitLogoUrl:n.func.isRequired};const ln=ve.div`
|
|
146
146
|
margin-top: 24px;
|
|
147
147
|
.screenshot {
|
|
148
148
|
margin-bottom: 16px;
|
|
@@ -190,7 +190,7 @@ import{r as k,i as It,j as rt,L as we,g as fo,k as As,l as qs,m as bt}from"./ven
|
|
|
190
190
|
padding-bottom: 12px;
|
|
191
191
|
border-bottom: ${({theme:t})=>`1px solid ${t.palette.divider}`};
|
|
192
192
|
}
|
|
193
|
-
`;function bs({text:t}){const{palette:o}=Eo();return t?e.jsx(zr,{style:{backgroundColor:o.background.default,color:o.text.primary},wrapperElement:{"data-color-mode":"light"},source:gr.sanitize(t),rehypePlugins:[[Br,{target:"_blank"}]]}):e.jsx(Fe,{Icon:Nt})}bs.propTypes={text:n.string.isRequired};function fs({params:t,setParams:o,paramsErrTip:s,loading:r,setParamsErrTip:l,readOnly:c}){const{t:i}=X(),[d,u]=k.useState(c?"preview":"write"),x=(p,m)=>{u(m)};return e.jsxs(a,{sx:{border:"1px solid transparent",borderRadius:2},children:[e.jsxs(a,{sx:{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center"},children:[e.jsx(A,{variant:"h6",sx:{fontWeight:"bold"},children:i("common.introduction")}),e.jsxs(Lo,{value:d,onChange:x,"aria-label":"wrapped label tabs example",children:[e.jsx(ot,{value:"write",label:"Write"}),e.jsx(ot,{value:"preview",label:"Preview"})]})]}),e.jsx(a,{sx:{display:d==="write"?"block":"none",width:"100%",marginTop:3},children:e.jsx(ne,{disabled:r||c,sx:{border:"none"},placeholder:`Blocklet ${i("common.introduction")}`,autoComplete:"off",variant:"outlined",fullWidth:!0,multiline:!0,minRows:4,value:t.blockletIntroduction||"",onChange:p=>{l({blockletIntroduction:""}),o({blockletIntroduction:p.target.value.slice(0,me.PROJECT.MAX_INTRO_LENGTH)})},error:!!s.blockletIntroduction,helperText:s.blockletIntroduction||"",slotProps:{input:{"data-cy":"export-blocklet-introduction",readOnly:c,endAdornment:e.jsxs(He,{position:"end",children:[t?.blockletIntroduction?.length||0," / ",me.PROJECT.MAX_INTRO_LENGTH]})}}})}),e.jsx(a,{sx:{display:d==="preview"?"block":"none",mt:3},children:e.jsx(bs,{text:t.blockletIntroduction||""})})]})}fs.propTypes={params:n.object.isRequired,setParams:n.func.isRequired,paramsErrTip:n.object.isRequired,setParamsErrTip:n.func.isRequired,readOnly:n.bool.isRequired,loading:n.bool.isRequired};function xs({step:t=0,ok:o=!1,active:s=0,error:r="",warning:l=!1}){let c="grey.500",i=t+1;return o&&(i=e.jsx(Po,{sx:{fontSize:18,margin:0},color:"white"})),r||!o&&s>t?(c="error.main",i=e.jsx(Gt,{sx:{fontSize:18,margin:0},color:"white"})):l?(c="warning.main",i=e.jsx(Gt,{sx:{fontSize:18,margin:0},color:"white"})):s>=t&&(c="primary.main"),e.jsx(a,{sx:{width:24,height:24,bgcolor:c,borderRadius:"100%",color:"white",display:"flex",justifyContent:"center",fontWeight:"bold",fontSize:14,alignItems:"center"},children:i})}xs.propTypes={step:n.number,ok:n.bool,active:n.number,error:n.string,warning:n.bool};function gs({steps:t,activeStep:o,setActiveStep:s,hasSelectedResources:r=!1,params:l,loading:c,paramsErrTip:i,warning:d,viewMode:u="",projectId:x}){const{t:p}=X(),m=()=>{s(j=>j+1)},f=()=>{s(j=>j-1)},b=j=>j===0?i?.blockletTitle||i?.projectId||i?.blockletDescription||i?.blockletHomepage||i?.blockletSupport||i?.blockletCommunity||i?.blockletRepository:j===2?i?.blockletResource||i?.blockletDocker||i?.dockerImageName:j>=4?i?.blockletVersion||i?.note:"",h=u||rs({params:l,projectId:x,t:p})===null;return e.jsxs(a,{sx:{width:300,maxWidth:300,minWidth:300,padding:2,border:"1px solid",borderColor:"divider",borderRadius:1},children:[e.jsx(nr,{activeStep:o,orientation:"vertical",children:t.map((j,v)=>{const g={},C=c||!pn({params:l,projectId:x,step:v,t:p}),D=c?"":b(v);return D&&(g.optional=e.jsx(A,{variant:"caption",color:"error",sx:{wordBreak:"break-word"},children:D}),g.error=!0),e.jsxs(lr,{children:[e.jsx(ir,{icon:e.jsx(xs,{error:D,warning:v===0?d.hasWarning:!1,active:h?99:o,step:v,ok:C}),sx:{cursor:"pointer",color:D?"error.main":"inherit"},disabled:!1,onClick:()=>s(v),...g,children:e.jsx(A,{fontSize:"14px",fontWeight:"500",color:D||!C&&o>v?"error.main":"inherit",children:j.label})}),e.jsxs(cr,{children:[e.jsx(A,{fontSize:12,children:j.description}),!h&&e.jsx(a,{sx:{mb:2},children:e.jsxs("div",{children:[v<t.length-1&&e.jsx(G,{variant:"contained",onClick:m,sx:{mt:1,mr:1},disabled:D||!C,children:p("common.continue")}),v>0&&e.jsx(G,{disabled:v===0,onClick:f,sx:{mt:1,mr:1},children:p("common.back")})]})})]})]},j.label)})}),o>=t.length-1&&e.jsx(Lt,{square:!0,elevation:0,sx:{p:3},children:e.jsx(A,{fontSize:12,sx:{opacity:.5},children:"Click right top button to release"})})]})}gs.propTypes={steps:n.array.isRequired,activeStep:n.number.isRequired,setActiveStep:n.func.isRequired,params:n.object.isRequired,viewMode:n.oneOfType([n.string,n.bool]),loading:n.bool.isRequired,projectId:n.string.isRequired,hasSelectedResources:n.oneOfType([n.string,n.bool]),warning:n.object.isRequired,paramsErrTip:n.shape({projectId:n.string,blockletVersion:n.string,blockletTitle:n.string,blockletDescription:n.string,note:n.string,blockletResource:n.string,blockletHomepage:n.string,blockletSupport:n.string,blockletCommunity:n.string,blockletRepository:n.string,blockletDocker:n.object,dockerImageName:n.string}).isRequired};const mn=[".zip",".gz"],bn=1024*1024*100,fn=k.lazy(()=>No(()=>import("./index-D6ay4OGg.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13])).then(t=>({default:t.Uploader})));function ks({app:t,projectId:o,readOnly:s,params:r,setParams:l,setParamsErrTip:c,error:i}){const{t:d,locale:u}=X(),x=k.useRef(null),p=()=>s?!1:!o||o===F.UNOWNED_DID?(W.error(d("blocklet.publish.errorTip.noFirstDid")),!1):!0,m=`${F.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${t.meta.did}/${o}/resource/upload`;return e.jsxs(a,{sx:{mt:3},children:[e.jsx(A,{gutterBottom:!0,children:d("blocklet.publish.resourceUpload")}),e.jsxs(Re,{direction:"row",spacing:1,sx:{alignItems:"center",flex:1,cursor:s?"default":"pointer"},children:[!!r.uploadedResource&&e.jsx(A,{component:"a",href:`${m}/params.uploadedResource`,children:r.uploadedResource}),!s&&e.jsx(G,{variant:"outlined",size:"small",onClick:()=>{p()&&x.current?.open()},children:r.uploadedResource?d("common.change"):d("common.upload")})]}),e.jsx(k.Suspense,{fallback:e.jsx(Je,{}),children:e.jsx(fn,{ref:x,locale:u,popup:!0,onUploadFinish:f=>{l({uploadedResource:f.data.filename}),c({blockletResource:""}),x.current?.close()},plugins:["ImageEditor"],installerProps:{disabled:!0},apiPathProps:{uploader:m,disableMediaKitPrefix:!0,disableMediaKitStatus:!0},coreProps:{restrictions:{allowedFileExts:mn,maxFileSize:bn,maxNumberOfFiles:1}}},"uploader-resource")}),!!i&&e.jsx(a,{sx:{color:"error.main",mt:1,fontSize:14},children:i})]})}ks.propTypes={app:n.object.isRequired,projectId:n.string.isRequired,readOnly:n.bool.isRequired,params:n.object.isRequired,setParams:n.func.isRequired,error:n.string.isRequired,setParamsErrTip:n.func.isRequired};function Tt({readOnly:t,params:o,setParams:s,paramsErrTip:r,setParamsErrTip:l,loading:c}){const{t:i}=X();return e.jsx(a,{className:"section",sx:{display:"flex",mt:3},children:e.jsxs(a,{sx:{flex:1},children:[e.jsx(ne,{required:!0,disabled:c||t,label:`Blocklet ${i("common.version")}`,placeholder:`Blocklet ${i("common.version")}`,autoComplete:"off",variant:"outlined",fullWidth:!0,value:o.blockletVersion||"",onChange:d=>{l({blockletVersion:""}),s({blockletVersion:d.target.value})},error:!!r.blockletVersion,helperText:r.blockletVersion||"",slotProps:{input:{"data-cy":"blocklet-version",readOnly:t}}}),e.jsx(ne,{label:i("blocklet.publish.releaseNote"),autoComplete:"off",disabled:c||t,variant:"outlined",fullWidth:!0,multiline:!0,minRows:4,required:!0,value:o.note||"",onChange:d=>{l({note:""}),s({note:d.target.value.slice(0,me.PROJECT.MAX_NOTE_LENGTH)})},error:!!r.note,helperText:r.note||"",sx:{mt:3},slotProps:{input:{"data-cy":"release-note",readOnly:t,endAdornment:e.jsxs(He,{position:"end",children:[o?.note?.length||0," / ",me.PROJECT.MAX_NOTE_LENGTH]})}}})]})})}Tt.propTypes={readOnly:n.bool.isRequired,params:n.object.isRequired,setParams:n.func.isRequired,paramsErrTip:n.object.isRequired,setParamsErrTip:n.func.isRequired,loading:n.bool.isRequired};function js(t){for(const o in t)typeof t[o]=="string"?t[o]=t[o].replace(/\\\\/g,"\\"):typeof t[o]=="object"&&t[o]!==null&&js(t[o]);return t}var xn=Wr();const oe=fo(xn),gn={"-a":"--attach","-d":"--detach","-e":"--env","-h":"--hostname","-i":"--interactive","-it":"-it","-rm":"-rm","-m":"--memory","-p":"--publish","-P":"--publish-all","-l":"--label","-n":"--name","-q":"--quiet","-x":"--x-registry","-t":"--tty","-u":"--user","-v":"--volume","-w":"--workdir","-cgroupns":"--cgroupns","-cpus":"--cpus","-g":"--gpus","-ip6":"--ip6","--read-only":"--read-only","--add-host":"--add-host","--attach":"--attach","--blkio-weight":"--blkio-weight","--blkio-weight-device":"--blkio-weight-device","--cap-add":"--cap-add","--cap-drop":"--cap-drop","--cgroup-parent":"--cgroup-parent","--cidfile":"--cidfile","--cpu-period":"--cpu-period","--cpu-quota":"--cpu-quota","--cpu-rt-period":"--cpu-rt-period","--cpu-rt-runtime":"--cpu-rt-runtime","--cpu-shares":"--cpu-shares","--cpus":"--cpus","--cpuset-cpus":"--cpuset-cpus","--cpuset-mems":"--cpuset-mems","--detach":"--detach","--detach-keys":"--detach-keys","--device":"--device","--device-cgroup-rule":"--device-cgroup-rule","--device-read-bps":"--device-read-bps","--device-read-iops":"--device-read-iops","--device-write-bps":"--device-write-bps","--device-write-iops":"--device-write-iops","--disable-content-trust":"--disable-content-trust","--dns":"--dns","--dns-opt":"--dns-opt","--dns-search":"--dns-search","--domainname":"--domainname","--entrypoint":"--entrypoint","--env":"--env","--env-file":"--env-file","--expose":"--expose","--gpus":"--gpus","--group-add":"--group-add","--health-cmd":"--health-cmd","--health-interval":"--health-interval","--health-retries":"--health-retries","--health-start-period":"--health-start-period","--health-timeout":"--health-timeout","--help":"--help","--hostname":"--hostname","--init":"--init","--interactive":"--interactive","--ip":"--ip","--ip6":"--ip6","--ipc":"--ipc","--isolation":"--isolation","--kernel-memory":"--kernel-memory","--label":"--label","--label-file":"--label-file","--link":"--link","--link-local-ip":"--link-local-ip","--log-driver":"--log-driver","--log-opt":"--log-opt","--mac-address":"--mac-address","--memory":"--memory","--memory-reservation":"--memory-reservation","--memory-swap":"--memory-swap","--memory-swappiness":"--memory-swappiness","--mount":"--mount","--name":"--name","--network":"--network","--network-alias":"--network-alias","--no-healthcheck":"--no-healthcheck","--oom-kill-disable":"--oom-kill-disable","--oom-score-adj":"--oom-score-adj","--pid":"--pid","--pids-limit":"--pids-limit","--platform":"--platform","--privileged":"--privileged","--publish":"--publish","--publish-all":"--publish-all","--pull":"--pull","--restart":"--restart","--rm":"--rm","--runtime":"--runtime","--security-opt":"--security-opt","--shm-size":"--shm-size","--stop-signal":"--stop-signal","--stop-timeout":"--stop-timeout","--storage-opt":"--storage-opt","--sysctl":"--sysctl","--tmpfs":"--tmpfs","--tty":"--tty","--ulimit":"--ulimit","--user":"--user","--userns":"--userns","--uts":"--uts","--volume":"--volume","--volume-driver":"--volume-driver","--volumes-from":"--volumes-from","--workdir":"--workdir"},Ut={"--env":!0,"--publish":!0,"--volume":!0,"--attach":!0,"--quiet":!0,"--entrypoint":!0,"--workdir":!0,"--cidfile":!0,"--detach-keys":!0,"--disable-content-trust":!0,"--domainname":!0,"--expose":!0,"--ip":!0,"--link-local-ip":!0,"--platform":!0},kn={"--volume":!0,"--publish":!0},jn=new Set(["--publish","--volume"]),ys=t=>{const[o]=t.split(":");return o?.startsWith("/")||o?.startsWith("./")||o?.startsWith("../")||o?.startsWith("~")||o?.startsWith("$BLOCKLET")};function yn(t){return t.map(o=>{if(o.key!=="--volume"||o.value.startsWith("$BLOCKLET_APP_DIR/")||o.value.startsWith("$BLOCKLET_DATA_DIR/"))return o;const[s,...r]=o.value.split(":");if(!s||!ys(o.value))return o;const l=s.startsWith("/")?`$BLOCKLET_DATA_DIR${s}`:`$BLOCKLET_DATA_DIR/${s}`;return{...o,value:[l,...r].join(":")}})}function wn(t){let o=!0;return t.find(r=>r.key==="--publish"&&r.type==="web")?t.map(r=>{if(r.key==="--publish"){const l={...r,type:o?"docker":r.type};return o=r.type==="web",l}return r}):t.map(r=>{if(r.key==="--publish"){const l={...r,type:o?"web":"docker"};return o=!1,l}return r})}function po(t){if(!t)return{dockerArgs:[],dockerEnvs:[],dockerImage:"",dockerCommand:""};if(t=t.trim(),t.startsWith("$ docker run")&&(t=t.replace("$ docker run","docker run")),!t.startsWith("docker run"))return{dockerArgs:[],dockerEnvs:[],dockerImage:"",dockerCommand:""};const s=t.replace(/\\\n/g,"").replace(/\n/g," ").trim().match(/(?:[^\s"']+|'[^']*'|"[^"]*")+/g);if(!s)return{dockerArgs:[],dockerEnvs:[],dockerImage:"",dockerCommand:""};const r=[],l=[];let c=0,i="",d="";const u=[];for(;c<s.length;){const p=s[c];if(!p){c++;continue}if(p==="docker"||p==="run"){c++;continue}if((p==="-e"||p==="--env")&&c+1<s.length){const m=s[c+1]||"",[f,...b]=m.split("=");if(f){const h=b.join("=").replace(/^['"]|['"]$/g,"");l.push({key:f,value:h})}c+=2;continue}if(p.startsWith("-")&&u.length===0){const m=p.indexOf("=");let f=p,b=null;m!==-1&&(f=p.substring(0,m),b=p.substring(m+1).replace(/^['"]|['"]$/g,""));const h=gn[f];if(!h){c+=2;continue}if(h==="--publish"){let j="";if(b)j=b,r.push({key:h,value:j});else if(c+1<s.length&&!(s[c+1]||"").startsWith("-")){j=(s[c+1]||"").replace(/^['"]|['"]$/g,""),r.push({key:h,value:j}),c+=2;continue}else{r.push({key:h,value:"true"}),c++;continue}c++;continue}if(b!==null){r.push({key:h,value:b}),c++;continue}else if(c+1<s.length&&!(s[c+1]||"").startsWith("-")){const j=(s[c+1]||"").replace(/^['"]|['"]$/g,"");r.push({key:h,value:j}),c+=2;continue}else{r.push({key:h,value:"true"}),c++;continue}}u.push(p),c++}i=u[0]||"",d=u.slice(1).join(" ");const x=[];for(const p of r)p.name="",p.path="",p.prefix="",p.protocol="",p.proxyBehavior="service",p.type="docker",!(jn.has(p.key)&&p.value==="true")&&x.push(p);for(const p of l)p.custom="",p.description="",p.secure=!1,p.shared=!1,p.required=!1;return{dockerArgs:wn(yn(x)),dockerEnvs:l,dockerImage:i,dockerCommand:d}}function vn({dockerArgs:t,dockerEnvs:o,dockerImage:s,dockerCommand:r}){if(t.length===0&&o.length===0&&!s)return"";const l=["docker run \\"],c=new Set(["--publish","--volume","--expose","--device","--mount","--label","--cap-add","--cap-drop","--add-host","--dns","--network-alias","--sysctl","--ulimit","--network"]);for(const i of t){const{key:d,value:u}=i;if(c.has(d))if(u==="true")l.push(` ${d} \\`);else{const x=/[\s"']/g.test(u)?`"${u}"`:u;l.push(` ${d} ${x} \\`)}else if(!l.some(x=>x.startsWith(` ${d}`)))if(u==="true")l.push(` ${d} \\`);else{const x=/[\s"']/g.test(u)?`"${u}"`:u;l.push(` ${d} ${x} \\`)}}for(const i of o){const{key:d,value:u}=i,x=/["']/g.test(u)?u:`"${u}"`;l.push(` -e ${d}=${x} \\`)}return s&&l.push(` ${s} \\`),r&&l.push(` ${r} \\`),l[l.length-1]?.endsWith(" \\")&&(l[l.length-1]=(l[l.length-1]||"").slice(0,-2)),l.join(`
|
|
193
|
+
`;function bs({text:t}){const{palette:o}=Eo();return t?e.jsx(zr,{style:{backgroundColor:o.background.default,color:o.text.primary},wrapperElement:{"data-color-mode":"light"},source:gr.sanitize(t),rehypePlugins:[[Br,{target:"_blank"}]]}):e.jsx(Fe,{Icon:Nt})}bs.propTypes={text:n.string.isRequired};function fs({params:t,setParams:o,paramsErrTip:s,loading:r,setParamsErrTip:l,readOnly:c}){const{t:i}=X(),[d,u]=k.useState(c?"preview":"write"),x=(p,m)=>{u(m)};return e.jsxs(a,{sx:{border:"1px solid transparent",borderRadius:2},children:[e.jsxs(a,{sx:{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center"},children:[e.jsx(A,{variant:"h6",sx:{fontWeight:"bold"},children:i("common.introduction")}),e.jsxs(Lo,{value:d,onChange:x,"aria-label":"wrapped label tabs example",children:[e.jsx(ot,{value:"write",label:"Write"}),e.jsx(ot,{value:"preview",label:"Preview"})]})]}),e.jsx(a,{sx:{display:d==="write"?"block":"none",width:"100%",marginTop:3},children:e.jsx(ne,{disabled:r||c,sx:{border:"none"},placeholder:`Blocklet ${i("common.introduction")}`,autoComplete:"off",variant:"outlined",fullWidth:!0,multiline:!0,minRows:4,value:t.blockletIntroduction||"",onChange:p=>{l({blockletIntroduction:""}),o({blockletIntroduction:p.target.value.slice(0,me.PROJECT.MAX_INTRO_LENGTH)})},error:!!s.blockletIntroduction,helperText:s.blockletIntroduction||"",slotProps:{input:{"data-cy":"export-blocklet-introduction",readOnly:c,endAdornment:e.jsxs(He,{position:"end",children:[t?.blockletIntroduction?.length||0," / ",me.PROJECT.MAX_INTRO_LENGTH]})}}})}),e.jsx(a,{sx:{display:d==="preview"?"block":"none",mt:3},children:e.jsx(bs,{text:t.blockletIntroduction||""})})]})}fs.propTypes={params:n.object.isRequired,setParams:n.func.isRequired,paramsErrTip:n.object.isRequired,setParamsErrTip:n.func.isRequired,readOnly:n.bool.isRequired,loading:n.bool.isRequired};function xs({step:t=0,ok:o=!1,active:s=0,error:r="",warning:l=!1}){let c="grey.500",i=t+1;return o&&(i=e.jsx(Po,{sx:{fontSize:18,margin:0},color:"white"})),r||!o&&s>t?(c="error.main",i=e.jsx(Gt,{sx:{fontSize:18,margin:0},color:"white"})):l?(c="warning.main",i=e.jsx(Gt,{sx:{fontSize:18,margin:0},color:"white"})):s>=t&&(c="primary.main"),e.jsx(a,{sx:{width:24,height:24,bgcolor:c,borderRadius:"100%",color:"white",display:"flex",justifyContent:"center",fontWeight:"bold",fontSize:14,alignItems:"center"},children:i})}xs.propTypes={step:n.number,ok:n.bool,active:n.number,error:n.string,warning:n.bool};function gs({steps:t,activeStep:o,setActiveStep:s,hasSelectedResources:r=!1,params:l,loading:c,paramsErrTip:i,warning:d,viewMode:u="",projectId:x}){const{t:p}=X(),m=()=>{s(j=>j+1)},f=()=>{s(j=>j-1)},b=j=>j===0?i?.blockletTitle||i?.projectId||i?.blockletDescription||i?.blockletHomepage||i?.blockletSupport||i?.blockletCommunity||i?.blockletRepository:j===2?i?.blockletResource||i?.blockletDocker||i?.dockerImageName:j>=4?i?.blockletVersion||i?.note:"",h=u||rs({params:l,projectId:x,t:p})===null;return e.jsxs(a,{sx:{width:300,maxWidth:300,minWidth:300,padding:2,border:"1px solid",borderColor:"divider",borderRadius:1},children:[e.jsx(nr,{activeStep:o,orientation:"vertical",children:t.map((j,v)=>{const g={},C=c||!pn({params:l,projectId:x,step:v,t:p}),D=c?"":b(v);return D&&(g.optional=e.jsx(A,{variant:"caption",color:"error",sx:{wordBreak:"break-word"},children:D}),g.error=!0),e.jsxs(lr,{children:[e.jsx(ir,{icon:e.jsx(xs,{error:D,warning:v===0?d.hasWarning:!1,active:h?99:o,step:v,ok:C}),sx:{cursor:"pointer",color:D?"error.main":"inherit"},disabled:!1,onClick:()=>s(v),...g,children:e.jsx(A,{fontSize:"14px",fontWeight:"500",color:D||!C&&o>v?"error.main":"inherit",children:j.label})}),e.jsxs(cr,{children:[e.jsx(A,{fontSize:12,children:j.description}),!h&&e.jsx(a,{sx:{mb:2},children:e.jsxs("div",{children:[v<t.length-1&&e.jsx(G,{variant:"contained",onClick:m,sx:{mt:1,mr:1},disabled:D||!C,children:p("common.continue")}),v>0&&e.jsx(G,{disabled:v===0,onClick:f,sx:{mt:1,mr:1},children:p("common.back")})]})})]})]},j.label)})}),o>=t.length-1&&e.jsx(Lt,{square:!0,elevation:0,sx:{p:3},children:e.jsx(A,{fontSize:12,sx:{opacity:.5},children:"Click right top button to release"})})]})}gs.propTypes={steps:n.array.isRequired,activeStep:n.number.isRequired,setActiveStep:n.func.isRequired,params:n.object.isRequired,viewMode:n.oneOfType([n.string,n.bool]),loading:n.bool.isRequired,projectId:n.string.isRequired,hasSelectedResources:n.oneOfType([n.string,n.bool]),warning:n.object.isRequired,paramsErrTip:n.shape({projectId:n.string,blockletVersion:n.string,blockletTitle:n.string,blockletDescription:n.string,note:n.string,blockletResource:n.string,blockletHomepage:n.string,blockletSupport:n.string,blockletCommunity:n.string,blockletRepository:n.string,blockletDocker:n.object,dockerImageName:n.string}).isRequired};const mn=[".zip",".gz"],bn=1024*1024*100,fn=k.lazy(()=>No(()=>import("./index-DOLfG_0X.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13])).then(t=>({default:t.Uploader})));function ks({app:t,projectId:o,readOnly:s,params:r,setParams:l,setParamsErrTip:c,error:i}){const{t:d,locale:u}=X(),x=k.useRef(null),p=()=>s?!1:!o||o===F.UNOWNED_DID?(W.error(d("blocklet.publish.errorTip.noFirstDid")),!1):!0,m=`${F.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${t.meta.did}/${o}/resource/upload`;return e.jsxs(a,{sx:{mt:3},children:[e.jsx(A,{gutterBottom:!0,children:d("blocklet.publish.resourceUpload")}),e.jsxs(Re,{direction:"row",spacing:1,sx:{alignItems:"center",flex:1,cursor:s?"default":"pointer"},children:[!!r.uploadedResource&&e.jsx(A,{component:"a",href:`${m}/params.uploadedResource`,children:r.uploadedResource}),!s&&e.jsx(G,{variant:"outlined",size:"small",onClick:()=>{p()&&x.current?.open()},children:r.uploadedResource?d("common.change"):d("common.upload")})]}),e.jsx(k.Suspense,{fallback:e.jsx(Je,{}),children:e.jsx(fn,{ref:x,locale:u,popup:!0,onUploadFinish:f=>{l({uploadedResource:f.data.filename}),c({blockletResource:""}),x.current?.close()},plugins:["ImageEditor"],installerProps:{disabled:!0},apiPathProps:{uploader:m,disableMediaKitPrefix:!0,disableMediaKitStatus:!0},coreProps:{restrictions:{allowedFileExts:mn,maxFileSize:bn,maxNumberOfFiles:1}}},"uploader-resource")}),!!i&&e.jsx(a,{sx:{color:"error.main",mt:1,fontSize:14},children:i})]})}ks.propTypes={app:n.object.isRequired,projectId:n.string.isRequired,readOnly:n.bool.isRequired,params:n.object.isRequired,setParams:n.func.isRequired,error:n.string.isRequired,setParamsErrTip:n.func.isRequired};function Tt({readOnly:t,params:o,setParams:s,paramsErrTip:r,setParamsErrTip:l,loading:c}){const{t:i}=X();return e.jsx(a,{className:"section",sx:{display:"flex",mt:3},children:e.jsxs(a,{sx:{flex:1},children:[e.jsx(ne,{required:!0,disabled:c||t,label:`Blocklet ${i("common.version")}`,placeholder:`Blocklet ${i("common.version")}`,autoComplete:"off",variant:"outlined",fullWidth:!0,value:o.blockletVersion||"",onChange:d=>{l({blockletVersion:""}),s({blockletVersion:d.target.value})},error:!!r.blockletVersion,helperText:r.blockletVersion||"",slotProps:{input:{"data-cy":"blocklet-version",readOnly:t}}}),e.jsx(ne,{label:i("blocklet.publish.releaseNote"),autoComplete:"off",disabled:c||t,variant:"outlined",fullWidth:!0,multiline:!0,minRows:4,required:!0,value:o.note||"",onChange:d=>{l({note:""}),s({note:d.target.value.slice(0,me.PROJECT.MAX_NOTE_LENGTH)})},error:!!r.note,helperText:r.note||"",sx:{mt:3},slotProps:{input:{"data-cy":"release-note",readOnly:t,endAdornment:e.jsxs(He,{position:"end",children:[o?.note?.length||0," / ",me.PROJECT.MAX_NOTE_LENGTH]})}}})]})})}Tt.propTypes={readOnly:n.bool.isRequired,params:n.object.isRequired,setParams:n.func.isRequired,paramsErrTip:n.object.isRequired,setParamsErrTip:n.func.isRequired,loading:n.bool.isRequired};function js(t){for(const o in t)typeof t[o]=="string"?t[o]=t[o].replace(/\\\\/g,"\\"):typeof t[o]=="object"&&t[o]!==null&&js(t[o]);return t}var xn=Wr();const oe=fo(xn),gn={"-a":"--attach","-d":"--detach","-e":"--env","-h":"--hostname","-i":"--interactive","-it":"-it","-rm":"-rm","-m":"--memory","-p":"--publish","-P":"--publish-all","-l":"--label","-n":"--name","-q":"--quiet","-x":"--x-registry","-t":"--tty","-u":"--user","-v":"--volume","-w":"--workdir","-cgroupns":"--cgroupns","-cpus":"--cpus","-g":"--gpus","-ip6":"--ip6","--read-only":"--read-only","--add-host":"--add-host","--attach":"--attach","--blkio-weight":"--blkio-weight","--blkio-weight-device":"--blkio-weight-device","--cap-add":"--cap-add","--cap-drop":"--cap-drop","--cgroup-parent":"--cgroup-parent","--cidfile":"--cidfile","--cpu-period":"--cpu-period","--cpu-quota":"--cpu-quota","--cpu-rt-period":"--cpu-rt-period","--cpu-rt-runtime":"--cpu-rt-runtime","--cpu-shares":"--cpu-shares","--cpus":"--cpus","--cpuset-cpus":"--cpuset-cpus","--cpuset-mems":"--cpuset-mems","--detach":"--detach","--detach-keys":"--detach-keys","--device":"--device","--device-cgroup-rule":"--device-cgroup-rule","--device-read-bps":"--device-read-bps","--device-read-iops":"--device-read-iops","--device-write-bps":"--device-write-bps","--device-write-iops":"--device-write-iops","--disable-content-trust":"--disable-content-trust","--dns":"--dns","--dns-opt":"--dns-opt","--dns-search":"--dns-search","--domainname":"--domainname","--entrypoint":"--entrypoint","--env":"--env","--env-file":"--env-file","--expose":"--expose","--gpus":"--gpus","--group-add":"--group-add","--health-cmd":"--health-cmd","--health-interval":"--health-interval","--health-retries":"--health-retries","--health-start-period":"--health-start-period","--health-timeout":"--health-timeout","--help":"--help","--hostname":"--hostname","--init":"--init","--interactive":"--interactive","--ip":"--ip","--ip6":"--ip6","--ipc":"--ipc","--isolation":"--isolation","--kernel-memory":"--kernel-memory","--label":"--label","--label-file":"--label-file","--link":"--link","--link-local-ip":"--link-local-ip","--log-driver":"--log-driver","--log-opt":"--log-opt","--mac-address":"--mac-address","--memory":"--memory","--memory-reservation":"--memory-reservation","--memory-swap":"--memory-swap","--memory-swappiness":"--memory-swappiness","--mount":"--mount","--name":"--name","--network":"--network","--network-alias":"--network-alias","--no-healthcheck":"--no-healthcheck","--oom-kill-disable":"--oom-kill-disable","--oom-score-adj":"--oom-score-adj","--pid":"--pid","--pids-limit":"--pids-limit","--platform":"--platform","--privileged":"--privileged","--publish":"--publish","--publish-all":"--publish-all","--pull":"--pull","--restart":"--restart","--rm":"--rm","--runtime":"--runtime","--security-opt":"--security-opt","--shm-size":"--shm-size","--stop-signal":"--stop-signal","--stop-timeout":"--stop-timeout","--storage-opt":"--storage-opt","--sysctl":"--sysctl","--tmpfs":"--tmpfs","--tty":"--tty","--ulimit":"--ulimit","--user":"--user","--userns":"--userns","--uts":"--uts","--volume":"--volume","--volume-driver":"--volume-driver","--volumes-from":"--volumes-from","--workdir":"--workdir"},Ut={"--env":!0,"--publish":!0,"--volume":!0,"--attach":!0,"--quiet":!0,"--entrypoint":!0,"--workdir":!0,"--cidfile":!0,"--detach-keys":!0,"--disable-content-trust":!0,"--domainname":!0,"--expose":!0,"--ip":!0,"--link-local-ip":!0,"--platform":!0},kn={"--volume":!0,"--publish":!0},jn=new Set(["--publish","--volume"]),ys=t=>{const[o]=t.split(":");return o?.startsWith("/")||o?.startsWith("./")||o?.startsWith("../")||o?.startsWith("~")||o?.startsWith("$BLOCKLET")};function yn(t){return t.map(o=>{if(o.key!=="--volume"||o.value.startsWith("$BLOCKLET_APP_DIR/")||o.value.startsWith("$BLOCKLET_DATA_DIR/"))return o;const[s,...r]=o.value.split(":");if(!s||!ys(o.value))return o;const l=s.startsWith("/")?`$BLOCKLET_DATA_DIR${s}`:`$BLOCKLET_DATA_DIR/${s}`;return{...o,value:[l,...r].join(":")}})}function wn(t){let o=!0;return t.find(r=>r.key==="--publish"&&r.type==="web")?t.map(r=>{if(r.key==="--publish"){const l={...r,type:o?"docker":r.type};return o=r.type==="web",l}return r}):t.map(r=>{if(r.key==="--publish"){const l={...r,type:o?"web":"docker"};return o=!1,l}return r})}function po(t){if(!t)return{dockerArgs:[],dockerEnvs:[],dockerImage:"",dockerCommand:""};if(t=t.trim(),t.startsWith("$ docker run")&&(t=t.replace("$ docker run","docker run")),!t.startsWith("docker run"))return{dockerArgs:[],dockerEnvs:[],dockerImage:"",dockerCommand:""};const s=t.replace(/\\\n/g,"").replace(/\n/g," ").trim().match(/(?:[^\s"']+|'[^']*'|"[^"]*")+/g);if(!s)return{dockerArgs:[],dockerEnvs:[],dockerImage:"",dockerCommand:""};const r=[],l=[];let c=0,i="",d="";const u=[];for(;c<s.length;){const p=s[c];if(!p){c++;continue}if(p==="docker"||p==="run"){c++;continue}if((p==="-e"||p==="--env")&&c+1<s.length){const m=s[c+1]||"",[f,...b]=m.split("=");if(f){const h=b.join("=").replace(/^['"]|['"]$/g,"");l.push({key:f,value:h})}c+=2;continue}if(p.startsWith("-")&&u.length===0){const m=p.indexOf("=");let f=p,b=null;m!==-1&&(f=p.substring(0,m),b=p.substring(m+1).replace(/^['"]|['"]$/g,""));const h=gn[f];if(!h){c+=2;continue}if(h==="--publish"){let j="";if(b)j=b,r.push({key:h,value:j});else if(c+1<s.length&&!(s[c+1]||"").startsWith("-")){j=(s[c+1]||"").replace(/^['"]|['"]$/g,""),r.push({key:h,value:j}),c+=2;continue}else{r.push({key:h,value:"true"}),c++;continue}c++;continue}if(b!==null){r.push({key:h,value:b}),c++;continue}else if(c+1<s.length&&!(s[c+1]||"").startsWith("-")){const j=(s[c+1]||"").replace(/^['"]|['"]$/g,"");r.push({key:h,value:j}),c+=2;continue}else{r.push({key:h,value:"true"}),c++;continue}}u.push(p),c++}i=u[0]||"",d=u.slice(1).join(" ");const x=[];for(const p of r)p.name="",p.path="",p.prefix="",p.protocol="",p.proxyBehavior="service",p.type="docker",!(jn.has(p.key)&&p.value==="true")&&x.push(p);for(const p of l)p.custom="",p.description="",p.secure=!1,p.shared=!1,p.required=!1;return{dockerArgs:wn(yn(x)),dockerEnvs:l,dockerImage:i,dockerCommand:d}}function vn({dockerArgs:t,dockerEnvs:o,dockerImage:s,dockerCommand:r}){if(t.length===0&&o.length===0&&!s)return"";const l=["docker run \\"],c=new Set(["--publish","--volume","--expose","--device","--mount","--label","--cap-add","--cap-drop","--add-host","--dns","--network-alias","--sysctl","--ulimit","--network"]);for(const i of t){const{key:d,value:u}=i;if(c.has(d))if(u==="true")l.push(` ${d} \\`);else{const x=/[\s"']/g.test(u)?`"${u}"`:u;l.push(` ${d} ${x} \\`)}else if(!l.some(x=>x.startsWith(` ${d}`)))if(u==="true")l.push(` ${d} \\`);else{const x=/[\s"']/g.test(u)?`"${u}"`:u;l.push(` ${d} ${x} \\`)}}for(const i of o){const{key:d,value:u}=i,x=/["']/g.test(u)?u:`"${u}"`;l.push(` -e ${d}=${x} \\`)}return s&&l.push(` ${s} \\`),r&&l.push(` ${r} \\`),l[l.length-1]?.endsWith(" \\")&&(l[l.length-1]=(l[l.length-1]||"").slice(0,-2)),l.join(`
|
|
194
194
|
`)}const ws={"--volume":t=>{const[o]=t.split(":");return o?ys(t)&&!t.startsWith("$BLOCKLET_APP_DIR/")&&!t.startsWith("$BLOCKLET_DATA_DIR/")?"Volume must start with $BLOCKLET_APP_DIR or $BLOCKLET_DATA_DIR":t.indexOf("..")>-1?'Volume cannot contain ".."':"":"Volume must start with key:value"}},Qe=t=>t.replace(/^[-]+/,"").replace(/-([a-z])/g,(r,l)=>l.toUpperCase()),Cn=t=>`--${t.replace(/([A-Z])/g,"-$1").toLowerCase()}`,Rn=[" -- ","~","&","|",">","<","{","}","[","]",";","$","!","*","%","&&","||",","],Sn=["rm ","sudo "];function vs(t){if(t==="")return;if(/(\n|\\n|\\\n|\t|\\t|\\\t)/.test(t))throw new Error("Docker CMD is invalid");const s=t.toLocaleLowerCase();if(Sn.some(l=>s.indexOf(l)!==-1))throw new Error("Docker CMD is invalid");if(Rn.some(l=>t.indexOf(l)!==-1))throw new Error("Docker CMD is invalid");if(!/^(?:(?:[a-zA-Z0-9\-_.\/:=\s]+)|(?:\@{1,2}[a-zA-Z_][a-zA-Z0-9_]*))+$/.test(t))throw new Error("Docker CMD is invalid")}const Tn=Array.from(new Set(Object.keys(Ut).map(Qe))),Dn=["publish","volume"];oe.object({workdir:oe.string().trim().optional(),image:oe.string().trim().regex(/^[^\s]+$/).optional(),shell:oe.string().trim().optional(),volumes:oe.array().items(oe.string().trim()).optional(),script:oe.string().trim().optional(),installNodeModules:oe.boolean().optional(),skipWrapDockerfile:oe.boolean().optional(),command:oe.string().allow("").default("").optional().custom((t,o)=>{try{return vs(t),t}catch(s){return o.error("any.invalid",{message:s.message})}},"Docker CMD validation"),runBaseScript:oe.boolean().optional(),...Tn.reduce((t,o)=>{const s=ws[Cn(o)];return Dn.includes(o)?(t[o]=oe.array().items(oe.string().trim()).optional(),s?t[o]=oe.array().items(oe.string().trim().custom((r,l)=>{const c=s(r);return c?l.message(c):r})).optional():t[o]=oe.array().items(oe.string().trim()).optional(),t):(s?t[o]=oe.string().trim().custom((r,l)=>{const c=s(r);return c?l.message(c):r}).optional():t[o]=oe.string().trim().optional(),t)},{})}).optional();function Dt({index:t,item:o,dockerParams:s,setDockerParams:r,dataKey:l,t:c,readOnly:i}){const d=o?.value||"",[u,x]=k.useState(!1),p=()=>{s[l]?.splice(t,1),r({...s,[l]:[...s[l]]})},m=(P,L)=>{s[l]?.[t]&&(L?(s[l][t].custom=s[l][t].value,s[l][t].value=`$${Qe(o.key)}`):(s[l][t].value=s[l][t].custom||"",s[l][t].custom="")),r({...s,[l]:[...s[l]]})},f=(P,L)=>{const w=s[l][t]?.value||"";s[l][t]={...s[l][t],secure:L,value:L&&w===me.BLOCKLET_AUTOMATIC_ENV_VALUE?"":w},r({...s,[l]:[...s[l]]})},b=(P,L)=>{s[l][t]={...s[l][t],shared:L},r({...s,[l]:[...s[l]]})},h=(P,L)=>{const w=s[l][t]?.value||"";s[l][t]={...s[l][t],required:L,value:L&&w===me.BLOCKLET_AUTOMATIC_ENV_VALUE?"":w},r({...s,[l]:[...s[l]]})},j=(P,L)=>{s[l][t]={...s[l][t],value:L?me.BLOCKLET_AUTOMATIC_ENV_VALUE:"",secure:!1,required:!1},r({...s,[l]:[...s[l]]})},v=P=>{s[l][t]={...s[l][t],description:P.target.value},r({...s,[l]:[...s[l]]})},g=P=>{const L=P.target.value==="web"?"web":"docker";L==="web"&&s.dockerArgs.forEach(Y=>{Y.type="docker"});const S=`/${s.dockerImage.replace(/\W/g,"-")}-${t}`;s.dockerArgs[t]={...s.dockerArgs[t],type:L,path:L==="docker"?S:"/",protocol:"http",prefix:L==="docker"?S:"/",name:"publicUrl",port:"BLOCKLET_PORT"},r({...s,dockerArgs:[...s.dockerArgs]})},C=P=>{s.dockerArgs[t]={...s.dockerArgs[t],proxyBehavior:P.target.value==="direct"?"direct":"service"},r({...s,dockerArgs:[...s.dockerArgs]})},D=P=>{const L=P.target.value;s[l][t]={...s[l][t],prefix:L,path:L==="*"?"/":L},r({...s,[l]:[...s[l]]})},R=P=>{s[l]?.[t]&&(s[l][t].value=P.target.value),r({...s,[l]:[...s[l]]})},y=d===`$${Qe(o.key)}`||o.custom,T=l==="dockerArgs"&&!Ut[o.key],O=kn[o.key],N=l==="dockerEnvs",z=o.key==="--publish";let K=o.key;return z&&o.type==="web"?K="--publish (Web)":N&&(K=`--env ${o.key}`),e.jsxs(a,{sx:{display:"flex",flexDirection:"row",gap:2,alignItems:"center"},children:[e.jsx(a,{sx:{width:250},children:e.jsx(A,{sx:{textOverflow:"ellipsis",width:"100%",overflow:"hidden"},children:K})}),e.jsxs(a,{sx:{display:"flex",flexDirection:"column",gap:1,flex:1},children:[e.jsx(ne,{disabled:i||y||T||o.value===me.BLOCKLET_AUTOMATIC_ENV_VALUE,placeholder:"",value:y?`$${Qe(o.key)}`:d,sx:{flex:1},error:T,onChange:R,slotProps:{input:{endAdornment:e.jsxs(He,{position:"end",sx:{zoom:.9},children:[(!(O||T)||N||z)&&e.jsx(ce,{onClick:()=>x(!0),children:e.jsx(ae,{icon:"icon-park-outline:setting-config"})}),!i&&e.jsx(ce,{onClick:p,color:T?"error":"default",children:e.jsx(ae,{icon:"ic:round-delete"})})]})}}}),T&&e.jsx(A,{variant:"caption",color:"error",children:c("blocklet.publish.docker.noAllowTheArg")}),o.key==="--publish"&&e.jsx(A,{variant:"caption",sx:{color:"text.secondary"},children:c("blocklet.publish.docker.publishTips")}),o.key==="--volume"&&ws[o.key](d)&&e.jsx(A,{variant:"caption",color:"error",children:c("blocklet.publish.docker.volumeTips")})]}),u&&e.jsx(ct,{open:!0,fullWidth:!0,maxWidth:"sm",PaperProps:{style:{minHeight:0}},title:c(N?"blocklet.publish.docker.modifyEnv":"blocklet.publish.docker.modifyParam"),onClose:()=>x(!1),children:e.jsxs(a,{sx:{display:"flex",flexDirection:"column",gap:1,paddingBottom:2},children:[O||T||N?null:e.jsxs(a,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(A,{children:c("blocklet.publish.docker.needCustomInput")}),e.jsx(Le,{disabled:i,checked:y,onChange:m,sx:{zoom:.9}})]}),N&&e.jsxs(a,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(A,{children:c("blocklet.publish.docker.shared")}),e.jsx(Le,{disabled:i,checked:o.shared,onChange:b,sx:{zoom:.9}})]}),N&&e.jsxs(a,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(A,{children:c("blocklet.publish.docker.required")}),e.jsx(Le,{disabled:i,checked:o.required,onChange:h,sx:{zoom:.9}})]}),N&&e.jsxs(a,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(A,{children:c("blocklet.publish.docker.secure")}),e.jsx(Le,{disabled:i,checked:o.secure,onChange:f,sx:{zoom:.9}})]}),N&&e.jsxs(a,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(A,{children:c("blocklet.publish.docker.autoGenerated")}),e.jsx(Le,{disabled:i,checked:o.value===me.BLOCKLET_AUTOMATIC_ENV_VALUE,onChange:j,sx:{zoom:.9}})]}),N&&e.jsxs(a,{sx:{mt:1,width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(A,{sx:{flex:1},children:c("blocklet.publish.docker.description")}),e.jsx(ne,{disabled:i,value:o.description,onChange:v,sx:{flex:1},label:c("blocklet.publish.docker.description")})]}),z&&e.jsxs(a,{sx:{mt:1,width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(A,{sx:{flex:1},children:c("blocklet.publish.docker.portType")}),e.jsxs(vt,{value:o.type||"docker",onChange:g,children:[e.jsx(be,{value:"docker",children:"Docker"}),e.jsx(be,{value:"web",children:"Web"})]})]}),z&&o.type==="web"&&e.jsxs(a,{sx:{mt:1,width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(A,{sx:{flex:1},children:c("blocklet.publish.docker.proxyBehavior")}),e.jsxs(vt,{value:o.proxyBehavior||"service",onChange:C,children:[e.jsx(be,{value:"service",children:c("blocklet.publish.docker.serviceProxy")}),e.jsx(be,{value:"direct",children:c("blocklet.publish.docker.directProxy")})]})]}),z&&o.type==="web"&&e.jsxs(a,{sx:{mt:1,width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(A,{sx:{flex:1},children:c("blocklet.publish.docker.prefix")}),e.jsx(ne,{disabled:i,value:o.prefix,onChange:D,sx:{flex:1},label:c("blocklet.publish.docker.prefix")})]})]})})]})}Dt.propTypes={dockerParams:n.object.isRequired,setDockerParams:n.func.isRequired,dataKey:n.string.isRequired,item:n.object.isRequired,t:n.func.isRequired,readOnly:n.bool.isRequired,index:n.number.isRequired};const In=`
|
|
195
195
|
docker run --name postgrest
|
|
196
196
|
-p 3000:3000
|